@basemaps/landing 6.30.0 → 6.32.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +33 -0
- package/build/attribution.d.ts.map +1 -1
- package/build/attribution.js +2 -1
- package/build/attribution.js.map +1 -1
- package/build/components/map.js +2 -1
- package/build/components/map.js.map +1 -1
- package/dist/examples/index.openlayers.attribution.wmts.3857.html +1 -1
- package/dist/{index-6.30.0-467e63869a31f2e1.css → index-6.32.1-467e63869a31f2e1.css} +0 -0
- package/dist/index-6.32.1-481aae500054659a.js +567 -0
- package/dist/{index-6.30.0-3328a19b1b63f913.js → index-6.32.1-bec8c5656eed35ac.js} +624 -137
- package/dist/index.html +2 -2
- package/dist/index.js +41 -41
- package/dist/lib/{attribution-6.30.0-431936fcac8e2647.js → attribution-6.32.1-431936fcac8e2647.js} +0 -0
- package/dist/lib/{attribution-6.30.0-a5dcb359f35150b9.js → attribution-6.32.1-a5dcb359f35150b9.js} +0 -0
- package/package.json +8 -8
- package/dist/index-6.30.0-7bdec3e7d1c65337.js +0 -567
|
@@ -0,0 +1,567 @@
|
|
|
1
|
+
var n0=Object.create;var Dd=Object.defineProperty;var s0=Object.getOwnPropertyDescriptor;var a0=Object.getOwnPropertyNames;var o0=Object.getPrototypeOf,l0=Object.prototype.hasOwnProperty;var Rd=(s,l)=>()=>(s&&(l=s(s=0)),l);var Ds=(s,l)=>()=>(l||s((l={exports:{}}).exports,l),l.exports);var h0=(s,l,h,y)=>{if(l&&typeof l=="object"||typeof l=="function")for(let _ of a0(l))!l0.call(s,_)&&_!==h&&Dd(s,_,{get:()=>l[_],enumerable:!(y=s0(l,_))||y.enumerable});return s};var da=(s,l,h)=>(h=s!=null?n0(o0(s)):{},h0(l||!s||!s.__esModule?Dd(h,"default",{value:s,enumerable:!0}):h,s));function Rs(s,l){for(var h in l)s[h]=l[h];return s}function jd(s){var l=s.parentNode;l&&l.removeChild(s)}function K(s,l,h){var y,_,a,T={};for(a in l)a=="key"?y=l[a]:a=="ref"?_=l[a]:T[a]=l[a];if(arguments.length>2&&(T.children=arguments.length>3?Yh.call(arguments,2):h),typeof s=="function"&&s.defaultProps!=null)for(a in s.defaultProps)T[a]===void 0&&(T[a]=s.defaultProps[a]);return Zh(s,T,y,_,null)}function Zh(s,l,h,y,_){var a={type:s,props:l,key:h,ref:y,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:_??++Vd};return _==null&&Si.vnode!=null&&Si.vnode(a),a}function _t(s){return s.children}function Ti(s,l){this.props=s,this.context=l}function co(s,l){if(l==null)return s.__?co(s.__,s.__.__k.indexOf(s)+1):null;for(var h;l<s.__k.length;l++)if((h=s.__k[l])!=null&&h.__e!=null)return h.__e;return typeof s.type=="function"?co(s):null}function $d(s){var l,h;if((s=s.__)!=null&&s.__c!=null){for(s.__e=s.__c.base=null,l=0;l<s.__k.length;l++)if((h=s.__k[l])!=null&&h.__e!=null){s.__e=s.__c.base=h.__e;break}return $d(s)}}function Fd(s){(!s.__d&&(s.__d=!0)&&Ll.push(s)&&!Xh.__r++||Bd!==Si.debounceRendering)&&((Bd=Si.debounceRendering)||Gd)(Xh)}function Xh(){for(var s;Xh.__r=Ll.length;)s=Ll.sort(function(l,h){return l.__v.__b-h.__v.__b}),Ll=[],s.some(function(l){var h,y,_,a,T,M;l.__d&&(T=(a=(h=l).__v).__e,(M=h.__P)&&(y=[],(_=Rs({},a)).__v=a.__v+1,Ru(M,a,_,h.__n,M.ownerSVGElement!==void 0,a.__h!=null?[T]:null,y,T??co(a),a.__h),Xd(y,a),a.__e!=T&&$d(a)))})}function Wd(s,l,h,y,_,a,T,M,D,N){var L,tt,pt,ft,yt,Ft,kt,Ot=y&&y.__k||qd,he=Ot.length;for(h.__k=[],L=0;L<l.length;L++)if((ft=h.__k[L]=(ft=l[L])==null||typeof ft=="boolean"?null:typeof ft=="string"||typeof ft=="number"||typeof ft=="bigint"?Zh(null,ft,null,null,ft):Array.isArray(ft)?Zh(_t,{children:ft},null,null,null):ft.__b>0?Zh(ft.type,ft.props,ft.key,null,ft.__v):ft)!=null){if(ft.__=h,ft.__b=h.__b+1,(pt=Ot[L])===null||pt&&ft.key==pt.key&&ft.type===pt.type)Ot[L]=void 0;else for(tt=0;tt<he;tt++){if((pt=Ot[tt])&&ft.key==pt.key&&ft.type===pt.type){Ot[tt]=void 0;break}pt=null}Ru(s,ft,pt=pt||Hh,_,a,T,M,D,N),yt=ft.__e,(tt=ft.ref)&&pt.ref!=tt&&(kt||(kt=[]),pt.ref&&kt.push(pt.ref,null,ft),kt.push(tt,ft.__c||yt,ft)),yt!=null?(Ft==null&&(Ft=yt),typeof ft.type=="function"&&ft.__k===pt.__k?ft.__d=D=Zd(ft,D,s):D=Hd(s,ft,pt,Ot,yt,D),typeof h.type=="function"&&(h.__d=D)):D&&pt.__e==D&&D.parentNode!=s&&(D=co(pt))}for(h.__e=Ft,L=he;L--;)Ot[L]!=null&&(typeof h.type=="function"&&Ot[L].__e!=null&&Ot[L].__e==h.__d&&(h.__d=co(y,L+1)),Yd(Ot[L],Ot[L]));if(kt)for(L=0;L<kt.length;L++)Kd(kt[L],kt[++L],kt[++L])}function Zd(s,l,h){for(var y,_=s.__k,a=0;_&&a<_.length;a++)(y=_[a])&&(y.__=s,l=typeof y.type=="function"?Zd(y,l,h):Hd(h,y,y,_,y.__e,l));return l}function Hd(s,l,h,y,_,a){var T,M,D;if(l.__d!==void 0)T=l.__d,l.__d=void 0;else if(h==null||_!=a||_.parentNode==null)t:if(a==null||a.parentNode!==s)s.appendChild(_),T=null;else{for(M=a,D=0;(M=M.nextSibling)&&D<y.length;D+=2)if(M==_)break t;s.insertBefore(_,a),T=a}return T!==void 0?T:_.nextSibling}function d0(s,l,h,y,_){var a;for(a in h)a==="children"||a==="key"||a in l||Kh(s,a,null,h[a],y);for(a in l)_&&typeof l[a]!="function"||a==="children"||a==="key"||a==="value"||a==="checked"||h[a]===l[a]||Kh(s,a,l[a],h[a],y)}function Od(s,l,h){l[0]==="-"?s.setProperty(l,h):s[l]=h==null?"":typeof h!="number"||p0.test(l)?h:h+"px"}function Kh(s,l,h,y,_){var a;t:if(l==="style")if(typeof h=="string")s.style.cssText=h;else{if(typeof y=="string"&&(s.style.cssText=y=""),y)for(l in y)h&&l in h||Od(s.style,l,"");if(h)for(l in h)y&&h[l]===y[l]||Od(s.style,l,h[l])}else if(l[0]==="o"&&l[1]==="n")a=l!==(l=l.replace(/Capture$/,"")),l=l.toLowerCase()in s?l.toLowerCase().slice(2):l.slice(2),s.l||(s.l={}),s.l[l+a]=h,h?y||s.addEventListener(l,a?Ud:Nd,a):s.removeEventListener(l,a?Ud:Nd,a);else if(l!=="dangerouslySetInnerHTML"){if(_)l=l.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(l!=="href"&&l!=="list"&&l!=="form"&&l!=="tabIndex"&&l!=="download"&&l in s)try{s[l]=h??"";break t}catch{}typeof h=="function"||(h!=null&&(h!==!1||l[0]==="a"&&l[1]==="r")?s.setAttribute(l,h):s.removeAttribute(l))}}function Nd(s){this.l[s.type+!1](Si.event?Si.event(s):s)}function Ud(s){this.l[s.type+!0](Si.event?Si.event(s):s)}function Ru(s,l,h,y,_,a,T,M,D){var N,L,tt,pt,ft,yt,Ft,kt,Ot,he,ne,be,xe,me=l.type;if(l.constructor!==void 0)return null;h.__h!=null&&(D=h.__h,M=l.__e=h.__e,l.__h=null,a=[M]),(N=Si.__b)&&N(l);try{t:if(typeof me=="function"){if(kt=l.props,Ot=(N=me.contextType)&&y[N.__c],he=N?Ot?Ot.props.value:N.__:y,h.__c?Ft=(L=l.__c=h.__c).__=L.__E:("prototype"in me&&me.prototype.render?l.__c=L=new me(kt,he):(l.__c=L=new Ti(kt,he),L.constructor=me,L.render=m0),Ot&&Ot.sub(L),L.props=kt,L.state||(L.state={}),L.context=he,L.__n=y,tt=L.__d=!0,L.__h=[]),L.__s==null&&(L.__s=L.state),me.getDerivedStateFromProps!=null&&(L.__s==L.state&&(L.__s=Rs({},L.__s)),Rs(L.__s,me.getDerivedStateFromProps(kt,L.__s))),pt=L.props,ft=L.state,tt)me.getDerivedStateFromProps==null&&L.componentWillMount!=null&&L.componentWillMount(),L.componentDidMount!=null&&L.__h.push(L.componentDidMount);else{if(me.getDerivedStateFromProps==null&&kt!==pt&&L.componentWillReceiveProps!=null&&L.componentWillReceiveProps(kt,he),!L.__e&&L.shouldComponentUpdate!=null&&L.shouldComponentUpdate(kt,L.__s,he)===!1||l.__v===h.__v){L.props=kt,L.state=L.__s,l.__v!==h.__v&&(L.__d=!1),L.__v=l,l.__e=h.__e,l.__k=h.__k,l.__k.forEach(function(Ge){Ge&&(Ge.__=l)}),L.__h.length&&T.push(L);break t}L.componentWillUpdate!=null&&L.componentWillUpdate(kt,L.__s,he),L.componentDidUpdate!=null&&L.__h.push(function(){L.componentDidUpdate(pt,ft,yt)})}if(L.context=he,L.props=kt,L.__v=l,L.__P=s,ne=Si.__r,be=0,"prototype"in me&&me.prototype.render)L.state=L.__s,L.__d=!1,ne&&ne(l),N=L.render(L.props,L.state,L.context);else do L.__d=!1,ne&&ne(l),N=L.render(L.props,L.state,L.context),L.state=L.__s;while(L.__d&&++be<25);L.state=L.__s,L.getChildContext!=null&&(y=Rs(Rs({},y),L.getChildContext())),tt||L.getSnapshotBeforeUpdate==null||(yt=L.getSnapshotBeforeUpdate(pt,ft)),xe=N!=null&&N.type===_t&&N.key==null?N.props.children:N,Wd(s,Array.isArray(xe)?xe:[xe],l,h,y,_,a,T,M,D),L.base=l.__e,l.__h=null,L.__h.length&&T.push(L),Ft&&(L.__E=L.__=null),L.__e=!1}else a==null&&l.__v===h.__v?(l.__k=h.__k,l.__e=h.__e):l.__e=f0(h.__e,l,h,y,_,a,T,D);(N=Si.diffed)&&N(l)}catch(Ge){l.__v=null,(D||a!=null)&&(l.__e=M,l.__h=!!D,a[a.indexOf(M)]=null),Si.__e(Ge,l,h)}}function Xd(s,l){Si.__c&&Si.__c(l,s),s.some(function(h){try{s=h.__h,h.__h=[],s.some(function(y){y.call(h)})}catch(y){Si.__e(y,h.__v)}})}function f0(s,l,h,y,_,a,T,M){var D,N,L,tt=h.props,pt=l.props,ft=l.type,yt=0;if(ft==="svg"&&(_=!0),a!=null){for(;yt<a.length;yt++)if((D=a[yt])&&"setAttribute"in D==!!ft&&(ft?D.localName===ft:D.nodeType===3)){s=D,a[yt]=null;break}}if(s==null){if(ft===null)return document.createTextNode(pt);s=_?document.createElementNS("http://www.w3.org/2000/svg",ft):document.createElement(ft,pt.is&&pt),a=null,M=!1}if(ft===null)tt===pt||M&&s.data===pt||(s.data=pt);else{if(a=a&&Yh.call(s.childNodes),N=(tt=h.props||Hh).dangerouslySetInnerHTML,L=pt.dangerouslySetInnerHTML,!M){if(a!=null)for(tt={},yt=0;yt<s.attributes.length;yt++)tt[s.attributes[yt].name]=s.attributes[yt].value;(L||N)&&(L&&(N&&L.__html==N.__html||L.__html===s.innerHTML)||(s.innerHTML=L&&L.__html||""))}if(d0(s,pt,tt,_,M),L)l.__k=[];else if(yt=l.props.children,Wd(s,Array.isArray(yt)?yt:[yt],l,h,y,_&&ft!=="foreignObject",a,T,a?a[0]:h.__k&&co(h,0),M),a!=null)for(yt=a.length;yt--;)a[yt]!=null&&jd(a[yt]);M||("value"in pt&&(yt=pt.value)!==void 0&&(yt!==s.value||ft==="progress"&&!yt||ft==="option"&&yt!==tt.value)&&Kh(s,"value",yt,tt.value,!1),"checked"in pt&&(yt=pt.checked)!==void 0&&yt!==s.checked&&Kh(s,"checked",yt,tt.checked,!1))}return s}function Kd(s,l,h){try{typeof s=="function"?s(l):s.current=l}catch(y){Si.__e(y,h)}}function Yd(s,l,h){var y,_;if(Si.unmount&&Si.unmount(s),(y=s.ref)&&(y.current&&y.current!==s.__e||Kd(y,null,l)),(y=s.__c)!=null){if(y.componentWillUnmount)try{y.componentWillUnmount()}catch(a){Si.__e(a,l)}y.base=y.__P=null}if(y=s.__k)for(_=0;_<y.length;_++)y[_]&&Yd(y[_],l,typeof s.type!="function");h||s.__e==null||jd(s.__e),s.__e=s.__d=void 0}function m0(s,l,h){return this.constructor(s,h)}function Jd(s,l,h){var y,_,a;Si.__&&Si.__(s,l),_=(y=typeof h=="function")?null:h&&h.__k||l.__k,a=[],Ru(l,s=(!y&&h||l).__k=K(_t,null,[s]),_||Hh,Hh,l.ownerSVGElement!==void 0,!y&&h?[h]:_?null:l.firstChild?Yh.call(l.childNodes):null,a,!y&&h?h:_?_.__e:l.firstChild,y),Xd(a,s)}var Yh,Si,Vd,c0,Ll,Gd,Bd,u0,Hh,qd,p0,Jr=Rd(()=>{Z();Hh={},qd=[],p0=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;Yh=qd.slice,Si={__e:function(s,l,h,y){for(var _,a,T;l=l.__;)if((_=l.__c)&&!_.__)try{if((a=_.constructor)&&a.getDerivedStateFromError!=null&&(_.setState(a.getDerivedStateFromError(s)),T=_.__d),_.componentDidCatch!=null&&(_.componentDidCatch(s,y||{}),T=_.__d),T)return _.__E=_}catch(M){s=M}throw s}},Vd=0,c0=function(s){return s!=null&&s.constructor===void 0},Ti.prototype.setState=function(s,l){var h;h=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=Rs({},this.state),typeof s=="function"&&(s=s(Rs({},h),this.props)),s&&Rs(h,s),s!=null&&this.__v&&(l&&this.__h.push(l),Fd(this))},Ti.prototype.forceUpdate=function(s){this.__v&&(this.__e=!0,s&&this.__h.push(s),Fd(this))},Ti.prototype.render=_t,Ll=[],Gd=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Xh.__r=0,u0=0});var Z=Rd(()=>{Jr()});var Qd=Ds(()=>{Z()});var lf=Ds(Qh=>{"use strict";Z();Object.defineProperty(Qh,"__esModule",{value:!0});Qh.Nztm2000Quad=void 0;Qh.Nztm2000Quad={type:"TileMatrixSetType",title:"LINZ NZTM2000 Map Tile Grid V2",abstract:"",identifier:"NZTM2000Quad",supportedCRS:"https://www.opengis.net/def/crs/EPSG/0/2193",boundingBox:{type:"BoundingBoxType",crs:"https://www.opengis.net/def/crs/EPSG/0/2193",lowerCorner:[419435.9938,-32605867284e-4],upperCorner:[104381901652e-4,6758167443e-3]},tileMatrix:[{type:"TileMatrixType",identifier:"0",scaleDenominator:139770566007179e-6,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:1,matrixHeight:1},{type:"TileMatrixType",identifier:"1",scaleDenominator:698852830035895e-7,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:2,matrixHeight:2},{type:"TileMatrixType",identifier:"2",scaleDenominator:3494264150179475e-8,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:4,matrixHeight:4},{type:"TileMatrixType",identifier:"3",scaleDenominator:17471320750897374e-9,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:8,matrixHeight:8},{type:"TileMatrixType",identifier:"4",scaleDenominator:8735660375448687e-9,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:16,matrixHeight:16},{type:"TileMatrixType",identifier:"5",scaleDenominator:4.3678301877243435e6,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:32,matrixHeight:32},{type:"TileMatrixType",identifier:"6",scaleDenominator:2.1839150938621718e6,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:64,matrixHeight:64},{type:"TileMatrixType",identifier:"7",scaleDenominator:1.0919575469310859e6,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:128,matrixHeight:128},{type:"TileMatrixType",identifier:"8",scaleDenominator:545978.7734655429,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:256,matrixHeight:256},{type:"TileMatrixType",identifier:"9",scaleDenominator:272989.38673277147,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:512,matrixHeight:512},{type:"TileMatrixType",identifier:"10",scaleDenominator:136494.69336638573,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:1024,matrixHeight:1024},{type:"TileMatrixType",identifier:"11",scaleDenominator:68247.34668319287,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:2048,matrixHeight:2048},{type:"TileMatrixType",identifier:"12",scaleDenominator:34123.67334159643,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:4096,matrixHeight:4096},{type:"TileMatrixType",identifier:"13",scaleDenominator:17061.836670798217,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:8192,matrixHeight:8192},{type:"TileMatrixType",identifier:"14",scaleDenominator:8530.918335399108,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:16384,matrixHeight:16384},{type:"TileMatrixType",identifier:"15",scaleDenominator:4265.459167699554,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:32768,matrixHeight:32768},{type:"TileMatrixType",identifier:"16",scaleDenominator:2132.729583849777,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:65536,matrixHeight:65536},{type:"TileMatrixType",identifier:"17",scaleDenominator:1066.3647919248886,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:131072,matrixHeight:131072},{type:"TileMatrixType",identifier:"18",scaleDenominator:533.1823959624443,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:262144,matrixHeight:262144},{type:"TileMatrixType",identifier:"19",scaleDenominator:266.59119798122214,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:524288,matrixHeight:524288},{type:"TileMatrixType",identifier:"20",scaleDenominator:133.29559899061107,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:1048576,matrixHeight:1048576},{type:"TileMatrixType",identifier:"21",scaleDenominator:66.64779949530553,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:2097152,matrixHeight:2097152}]}});var hf=Ds(tc=>{"use strict";Z();Object.defineProperty(tc,"__esModule",{value:!0});tc.Nztm2000=void 0;tc.Nztm2000={type:"TileMatrixSetType",title:"LINZ NZTM2000 Map Tile Grid",abstract:"See https://www.linz.govt.nz/data/linz-data-service/guides-and-documentation/nztm2000-map-tile-service-schema",identifier:"NZTM2000",supportedCRS:"https://www.opengis.net/def/crs/EPSG/0/2193",boundingBox:{type:"BoundingBoxType",crs:"https://www.opengis.net/def/crs/EPSG/0/2193",lowerCorner:[3087e3,274e3],upperCorner:[7173e3,3327e3]},tileMatrix:[{type:"TileMatrixType",identifier:"0",scaleDenominator:32e6,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:2,matrixHeight:4},{type:"TileMatrixType",identifier:"1",scaleDenominator:16e6,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:4,matrixHeight:8},{type:"TileMatrixType",identifier:"2",scaleDenominator:8e6,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:8,matrixHeight:16},{type:"TileMatrixType",identifier:"3",scaleDenominator:4e6,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:16,matrixHeight:32},{type:"TileMatrixType",identifier:"4",scaleDenominator:2e6,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:32,matrixHeight:64},{type:"TileMatrixType",identifier:"5",scaleDenominator:1e6,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:64,matrixHeight:128},{type:"TileMatrixType",identifier:"6",scaleDenominator:5e5,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:128,matrixHeight:256},{type:"TileMatrixType",identifier:"7",scaleDenominator:25e4,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:256,matrixHeight:512},{type:"TileMatrixType",identifier:"8",scaleDenominator:1e5,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:640,matrixHeight:1280},{type:"TileMatrixType",identifier:"9",scaleDenominator:5e4,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:1280,matrixHeight:2560},{type:"TileMatrixType",identifier:"10",scaleDenominator:25e3,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:2560,matrixHeight:5120},{type:"TileMatrixType",identifier:"11",scaleDenominator:1e4,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:6400,matrixHeight:12800},{type:"TileMatrixType",identifier:"12",scaleDenominator:5e3,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:12800,matrixHeight:25600},{type:"TileMatrixType",identifier:"13",scaleDenominator:2500,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:25600,matrixHeight:51200},{type:"TileMatrixType",identifier:"14",scaleDenominator:1e3,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:64e3,matrixHeight:128e3},{type:"TileMatrixType",identifier:"15",scaleDenominator:500,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:128e3,matrixHeight:256e3},{type:"TileMatrixType",identifier:"16",scaleDenominator:250,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:256e3,matrixHeight:512e3}]}});var cf=Ds(fo=>{"use strict";Z();Object.defineProperty(fo,"__esModule",{value:!0});fo.Nztm2000=fo.Nztm2000Quad=void 0;var T0=lf();Object.defineProperty(fo,"Nztm2000Quad",{enumerable:!0,get:function(){return T0.Nztm2000Quad}});var E0=hf();Object.defineProperty(fo,"Nztm2000",{enumerable:!0,get:function(){return E0.Nztm2000}})});var pf=Ds(es=>{"use strict";Z();Object.defineProperty(es,"__esModule",{value:!0});es.once=es.Emitter=es.ALL_EVENTS=void 0;es.ALL_EVENTS=Symbol("ALL_EVENTS");function I0(s,l){return s.add(l),function(){return s.delete(l)}}function uf(s,...l){if(s)for(let{fn:h}of s)h(...l)}var Vu=class{constructor(){this.$=Object.create(null)}on(l,h){let y=this.$[l]=this.$[l]||new Set;return I0(y,{fn:h})}emit(l,...h){uf(this.$[l],...h),uf(this.$[es.ALL_EVENTS],{type:l,args:h})}};es.Emitter=Vu;function C0(s,l,h){let y=s.on(l,function(...a){return y(),h(...a)});return y}es.once=C0});var ff=Ds((Eb,df)=>{"use strict";Z();df.exports=ic;ic.polyline=ic;ic.polygon=P0;function ic(s,l,h){var y=s.length,_=go(s[0],l),a=[],T,M,D,N,L;for(h||(h=[]),T=1;T<y;T++){for(M=s[T-1],D=s[T],N=L=go(D,l);;)if(_|N){if(_&N)break;_?(M=qu(M,D,_,l),_=go(M,l)):(D=qu(M,D,N,l),N=go(D,l))}else{a.push(M),N!==L?(a.push(D),T<y-1&&(h.push(a),a=[])):T===y-1&&a.push(D);break}_=L}return a.length&&h.push(a),h}function P0(s,l){var h,y,_,a,T,M,D;for(y=1;y<=8;y*=2){for(h=[],_=s[s.length-1],a=!(go(_,l)&y),T=0;T<s.length;T++)M=s[T],D=!(go(M,l)&y),D!==a&&h.push(qu(_,M,y,l)),D&&h.push(M),_=M,a=D;if(s=h,!s.length)break}return h}function qu(s,l,h,y){return h&8?[s[0]+(l[0]-s[0])*(y[3]-s[1])/(l[1]-s[1]),y[3]]:h&4?[s[0]+(l[0]-s[0])*(y[1]-s[1])/(l[1]-s[1]),y[1]]:h&2?[y[2],s[1]+(l[1]-s[1])*(y[2]-s[0])/(l[0]-s[0])]:h&1?[y[0],s[1]+(l[1]-s[1])*(y[0]-s[0])/(l[0]-s[0])]:null}function go(s,l){var h=0;return s[0]<l[0]?h|=1:s[0]>l[2]&&(h|=2),s[1]<l[1]?h|=4:s[1]>l[3]&&(h|=8),h}});var mf=Ds((ju,$u)=>{Z();(function(s,l){typeof ju=="object"&&typeof $u<"u"?$u.exports=l():typeof define=="function"&&define.amd?define(l):(s=typeof globalThis<"u"?globalThis:s||self,s.polygonClipping=l())})(ju,function(){"use strict";function s(mt,U){if(!(mt instanceof U))throw new TypeError("Cannot call a class as a function")}function l(mt,U){for(var B=0;B<U.length;B++){var V=U[B];V.enumerable=V.enumerable||!1,V.configurable=!0,"value"in V&&(V.writable=!0),Object.defineProperty(mt,V.key,V)}}function h(mt,U,B){return U&&l(mt.prototype,U),B&&l(mt,B),mt}var y=function(){function mt(U,B){this.next=null,this.key=U,this.data=B,this.left=null,this.right=null}return mt}();function _(mt,U){return mt>U?1:mt<U?-1:0}function a(mt,U,B){for(var V=new y(null,null),X=V,st=V;;){var xt=B(mt,U.key);if(xt<0){if(U.left===null)break;if(B(mt,U.left.key)<0){var Dt=U.left;if(U.left=Dt.right,Dt.right=U,U=Dt,U.left===null)break}st.left=U,st=U,U=U.left}else if(xt>0){if(U.right===null)break;if(B(mt,U.right.key)>0){var Dt=U.right;if(U.right=Dt.left,Dt.left=U,U=Dt,U.right===null)break}X.right=U,X=U,U=U.right}else break}return X.right=U.left,st.left=U.right,U.left=V.right,U.right=V.left,U}function T(mt,U,B,V){var X=new y(mt,U);if(B===null)return X.left=X.right=null,X;B=a(mt,B,V);var st=V(mt,B.key);return st<0?(X.left=B.left,X.right=B,B.left=null):st>=0&&(X.right=B.right,X.left=B,B.right=null),X}function M(mt,U,B){var V=null,X=null;if(U){U=a(mt,U,B);var st=B(U.key,mt);st===0?(V=U.left,X=U.right):st<0?(X=U.right,U.right=null,V=U):(V=U.left,U.left=null,X=U)}return{left:V,right:X}}function D(mt,U,B){return U===null?mt:(mt===null||(U=a(mt.key,U,B),U.left=mt),U)}function N(mt,U,B,V,X){if(mt){V(""+U+(B?"\u2514\u2500\u2500 ":"\u251C\u2500\u2500 ")+X(mt)+`
|
|
2
|
+
`);var st=U+(B?" ":"\u2502 ");mt.left&&N(mt.left,st,!1,V,X),mt.right&&N(mt.right,st,!0,V,X)}}var L=function(){function mt(U){U===void 0&&(U=_),this._root=null,this._size=0,this._comparator=U}return mt.prototype.insert=function(U,B){return this._size++,this._root=T(U,B,this._root,this._comparator)},mt.prototype.add=function(U,B){var V=new y(U,B);this._root===null&&(V.left=V.right=null,this._size++,this._root=V);var X=this._comparator,st=a(U,this._root,X),xt=X(U,st.key);return xt===0?this._root=st:(xt<0?(V.left=st.left,V.right=st,st.left=null):xt>0&&(V.right=st.right,V.left=st,st.right=null),this._size++,this._root=V),this._root},mt.prototype.remove=function(U){this._root=this._remove(U,this._root,this._comparator)},mt.prototype._remove=function(U,B,V){var X;if(B===null)return null;B=a(U,B,V);var st=V(U,B.key);return st===0?(B.left===null?X=B.right:(X=a(U,B.left,V),X.right=B.right),this._size--,X):B},mt.prototype.pop=function(){var U=this._root;if(U){for(;U.left;)U=U.left;return this._root=a(U.key,this._root,this._comparator),this._root=this._remove(U.key,this._root,this._comparator),{key:U.key,data:U.data}}return null},mt.prototype.findStatic=function(U){for(var B=this._root,V=this._comparator;B;){var X=V(U,B.key);if(X===0)return B;X<0?B=B.left:B=B.right}return null},mt.prototype.find=function(U){return this._root&&(this._root=a(U,this._root,this._comparator),this._comparator(U,this._root.key)!==0)?null:this._root},mt.prototype.contains=function(U){for(var B=this._root,V=this._comparator;B;){var X=V(U,B.key);if(X===0)return!0;X<0?B=B.left:B=B.right}return!1},mt.prototype.forEach=function(U,B){for(var V=this._root,X=[],st=!1;!st;)V!==null?(X.push(V),V=V.left):X.length!==0?(V=X.pop(),U.call(B,V),V=V.right):st=!0;return this},mt.prototype.range=function(U,B,V,X){for(var st=[],xt=this._comparator,Dt=this._root,Ut;st.length!==0||Dt;)if(Dt)st.push(Dt),Dt=Dt.left;else{if(Dt=st.pop(),Ut=xt(Dt.key,B),Ut>0)break;if(xt(Dt.key,U)>=0&&V.call(X,Dt))return this;Dt=Dt.right}return this},mt.prototype.keys=function(){var U=[];return this.forEach(function(B){var V=B.key;return U.push(V)}),U},mt.prototype.values=function(){var U=[];return this.forEach(function(B){var V=B.data;return U.push(V)}),U},mt.prototype.min=function(){return this._root?this.minNode(this._root).key:null},mt.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},mt.prototype.minNode=function(U){if(U===void 0&&(U=this._root),U)for(;U.left;)U=U.left;return U},mt.prototype.maxNode=function(U){if(U===void 0&&(U=this._root),U)for(;U.right;)U=U.right;return U},mt.prototype.at=function(U){for(var B=this._root,V=!1,X=0,st=[];!V;)if(B)st.push(B),B=B.left;else if(st.length>0){if(B=st.pop(),X===U)return B;X++,B=B.right}else V=!0;return null},mt.prototype.next=function(U){var B=this._root,V=null;if(U.right){for(V=U.right;V.left;)V=V.left;return V}for(var X=this._comparator;B;){var st=X(U.key,B.key);if(st===0)break;st<0?(V=B,B=B.left):B=B.right}return V},mt.prototype.prev=function(U){var B=this._root,V=null;if(U.left!==null){for(V=U.left;V.right;)V=V.right;return V}for(var X=this._comparator;B;){var st=X(U.key,B.key);if(st===0)break;st<0?B=B.left:(V=B,B=B.right)}return V},mt.prototype.clear=function(){return this._root=null,this._size=0,this},mt.prototype.toList=function(){return ft(this._root)},mt.prototype.load=function(U,B,V){B===void 0&&(B=[]),V===void 0&&(V=!1);var X=U.length,st=this._comparator;if(V&&kt(U,B,0,X-1,st),this._root===null)this._root=tt(U,B,0,X),this._size=X;else{var xt=Ft(this.toList(),pt(U,B),st);X=this._size+X,this._root=yt({head:xt},0,X)}return this},mt.prototype.isEmpty=function(){return this._root===null},Object.defineProperty(mt.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(mt.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),mt.prototype.toString=function(U){U===void 0&&(U=function(X){return String(X.key)});var B=[];return N(this._root,"",!0,function(V){return B.push(V)},U),B.join("")},mt.prototype.update=function(U,B,V){var X=this._comparator,st=M(U,this._root,X),xt=st.left,Dt=st.right;X(U,B)<0?Dt=T(B,V,Dt,X):xt=T(B,V,xt,X),this._root=D(xt,Dt,X)},mt.prototype.split=function(U){return M(U,this._root,this._comparator)},mt}();function tt(mt,U,B,V){var X=V-B;if(X>0){var st=B+Math.floor(X/2),xt=mt[st],Dt=U[st],Ut=new y(xt,Dt);return Ut.left=tt(mt,U,B,st),Ut.right=tt(mt,U,st+1,V),Ut}return null}function pt(mt,U){for(var B=new y(null,null),V=B,X=0;X<mt.length;X++)V=V.next=new y(mt[X],U[X]);return V.next=null,B.next}function ft(mt){for(var U=mt,B=[],V=!1,X=new y(null,null),st=X;!V;)U?(B.push(U),U=U.left):B.length>0?(U=st=st.next=B.pop(),U=U.right):V=!0;return st.next=null,X.next}function yt(mt,U,B){var V=B-U;if(V>0){var X=U+Math.floor(V/2),st=yt(mt,U,X),xt=mt.head;return xt.left=st,mt.head=mt.head.next,xt.right=yt(mt,X+1,B),xt}return null}function Ft(mt,U,B){for(var V=new y(null,null),X=V,st=mt,xt=U;st!==null&&xt!==null;)B(st.key,xt.key)<0?(X.next=st,st=st.next):(X.next=xt,xt=xt.next),X=X.next;return st!==null?X.next=st:xt!==null&&(X.next=xt),V.next}function kt(mt,U,B,V,X){if(!(B>=V)){for(var st=mt[B+V>>1],xt=B-1,Dt=V+1;;){do xt++;while(X(mt[xt],st)<0);do Dt--;while(X(mt[Dt],st)>0);if(xt>=Dt)break;var Ut=mt[xt];mt[xt]=mt[Dt],mt[Dt]=Ut,Ut=U[xt],U[xt]=U[Dt],U[Dt]=Ut}kt(mt,U,B,Dt,X),kt(mt,U,Dt+1,V,X)}}var Ot=function(U,B){return U.ll.x<=B.x&&B.x<=U.ur.x&&U.ll.y<=B.y&&B.y<=U.ur.y},he=function(U,B){if(B.ur.x<U.ll.x||U.ur.x<B.ll.x||B.ur.y<U.ll.y||U.ur.y<B.ll.y)return null;var V=U.ll.x<B.ll.x?B.ll.x:U.ll.x,X=U.ur.x<B.ur.x?U.ur.x:B.ur.x,st=U.ll.y<B.ll.y?B.ll.y:U.ll.y,xt=U.ur.y<B.ur.y?U.ur.y:B.ur.y;return{ll:{x:V,y:st},ur:{x:X,y:xt}}},ne=Number.EPSILON;ne===void 0&&(ne=Math.pow(2,-52));var be=ne*ne,xe=function(U,B){if(-ne<U&&U<ne&&-ne<B&&B<ne)return 0;var V=U-B;return V*V<be*U*B?0:U<B?-1:1},me=function(){function mt(){s(this,mt),this.reset()}return h(mt,[{key:"reset",value:function(){this.xRounder=new Ge,this.yRounder=new Ge}},{key:"round",value:function(B,V){return{x:this.xRounder.round(B),y:this.yRounder.round(V)}}}]),mt}(),Ge=function(){function mt(){s(this,mt),this.tree=new L,this.round(0)}return h(mt,[{key:"round",value:function(B){var V=this.tree.add(B),X=this.tree.prev(V);if(X!==null&&xe(V.key,X.key)===0)return this.tree.remove(B),X.key;var st=this.tree.next(V);return st!==null&&xe(V.key,st.key)===0?(this.tree.remove(B),st.key):B}}]),mt}(),Ne=new me,di=function(U,B){return U.x*B.y-U.y*B.x},Bi=function(U,B){return U.x*B.x+U.y*B.y},Yi=function(U,B,V){var X={x:B.x-U.x,y:B.y-U.y},st={x:V.x-U.x,y:V.y-U.y},xt=di(X,st);return xe(xt,0)},Fi=function(U){return Math.sqrt(Bi(U,U))},jr=function(U,B,V){var X={x:B.x-U.x,y:B.y-U.y},st={x:V.x-U.x,y:V.y-U.y};return di(st,X)/Fi(st)/Fi(X)},ye=function(U,B,V){var X={x:B.x-U.x,y:B.y-U.y},st={x:V.x-U.x,y:V.y-U.y};return Bi(st,X)/Fi(st)/Fi(X)},zr=function(U,B,V){return B.y===0?null:{x:U.x+B.x/B.y*(V-U.y),y:V}},$r=function(U,B,V){return B.x===0?null:{x:V,y:U.y+B.y/B.x*(V-U.x)}},en=function(U,B,V,X){if(B.x===0)return $r(V,X,U.x);if(X.x===0)return $r(U,B,V.x);if(B.y===0)return zr(V,X,U.y);if(X.y===0)return zr(U,B,V.y);var st=di(B,X);if(st==0)return null;var xt={x:V.x-U.x,y:V.y-U.y},Dt=di(xt,B)/st,Ut=di(xt,X)/st,ct=U.x+Ut*B.x,Ct=V.x+Dt*X.x,Te=U.y+Ut*B.y,Ie=V.y+Dt*X.y,oe=(ct+Ct)/2,Oe=(Te+Ie)/2;return{x:oe,y:Oe}},_i=function(){h(mt,null,[{key:"compare",value:function(B,V){var X=mt.comparePoints(B.point,V.point);return X!==0?X:(B.point!==V.point&&B.link(V),B.isLeft!==V.isLeft?B.isLeft?1:-1:kr.compare(B.segment,V.segment))}},{key:"comparePoints",value:function(B,V){return B.x<V.x?-1:B.x>V.x?1:B.y<V.y?-1:B.y>V.y?1:0}}]);function mt(U,B){s(this,mt),U.events===void 0?U.events=[this]:U.events.push(this),this.point=U,this.isLeft=B}return h(mt,[{key:"link",value:function(B){if(B.point===this.point)throw new Error("Tried to link already linked events");for(var V=B.point.events,X=0,st=V.length;X<st;X++){var xt=V[X];this.point.events.push(xt),xt.point=this.point}this.checkForConsuming()}},{key:"checkForConsuming",value:function(){for(var B=this.point.events.length,V=0;V<B;V++){var X=this.point.events[V];if(X.segment.consumedBy===void 0)for(var st=V+1;st<B;st++){var xt=this.point.events[st];xt.consumedBy===void 0&&X.otherSE.point.events===xt.otherSE.point.events&&X.segment.consume(xt.segment)}}}},{key:"getAvailableLinkedEvents",value:function(){for(var B=[],V=0,X=this.point.events.length;V<X;V++){var st=this.point.events[V];st!==this&&!st.segment.ringOut&&st.segment.isInResult()&&B.push(st)}return B}},{key:"getLeftmostComparator",value:function(B){var V=this,X=new Map,st=function(Dt){var Ut=Dt.otherSE;X.set(Dt,{sine:jr(V.point,B.point,Ut.point),cosine:ye(V.point,B.point,Ut.point)})};return function(xt,Dt){X.has(xt)||st(xt),X.has(Dt)||st(Dt);var Ut=X.get(xt),ct=Ut.sine,Ct=Ut.cosine,Te=X.get(Dt),Ie=Te.sine,oe=Te.cosine;return ct>=0&&Ie>=0?Ct<oe?1:Ct>oe?-1:0:ct<0&&Ie<0?Ct<oe?-1:Ct>oe?1:0:Ie<ct?-1:Ie>ct?1:0}}}]),mt}(),mn=0,kr=function(){h(mt,null,[{key:"compare",value:function(B,V){var X=B.leftSE.point.x,st=V.leftSE.point.x,xt=B.rightSE.point.x,Dt=V.rightSE.point.x;if(Dt<X)return 1;if(xt<st)return-1;var Ut=B.leftSE.point.y,ct=V.leftSE.point.y,Ct=B.rightSE.point.y,Te=V.rightSE.point.y;if(X<st){if(ct<Ut&&ct<Ct)return 1;if(ct>Ut&&ct>Ct)return-1;var Ie=B.comparePoint(V.leftSE.point);if(Ie<0)return 1;if(Ie>0)return-1;var oe=V.comparePoint(B.rightSE.point);return oe!==0?oe:-1}if(X>st){if(Ut<ct&&Ut<Te)return-1;if(Ut>ct&&Ut>Te)return 1;var Oe=V.comparePoint(B.leftSE.point);if(Oe!==0)return Oe;var Ce=B.comparePoint(V.rightSE.point);return Ce<0?1:Ce>0?-1:1}if(Ut<ct)return-1;if(Ut>ct)return 1;if(xt<Dt){var Qe=V.comparePoint(B.rightSE.point);if(Qe!==0)return Qe}if(xt>Dt){var Pe=B.comparePoint(V.rightSE.point);if(Pe<0)return 1;if(Pe>0)return-1}if(xt!==Dt){var Vt=Ct-Ut,ge=xt-X,ce=Te-ct,ai=Dt-st;if(Vt>ge&&ce<ai)return 1;if(Vt<ge&&ce>ai)return-1}return xt>Dt?1:xt<Dt||Ct<Te?-1:Ct>Te?1:B.id<V.id?-1:B.id>V.id?1:0}}]);function mt(U,B,V,X){s(this,mt),this.id=++mn,this.leftSE=U,U.segment=this,U.otherSE=B,this.rightSE=B,B.segment=this,B.otherSE=U,this.rings=V,this.windings=X}return h(mt,[{key:"replaceRightSE",value:function(B){this.rightSE=B,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}},{key:"bbox",value:function(){var B=this.leftSE.point.y,V=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:B<V?B:V},ur:{x:this.rightSE.point.x,y:B>V?B:V}}}},{key:"vector",value:function(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}},{key:"isAnEndpoint",value:function(B){return B.x===this.leftSE.point.x&&B.y===this.leftSE.point.y||B.x===this.rightSE.point.x&&B.y===this.rightSE.point.y}},{key:"comparePoint",value:function(B){if(this.isAnEndpoint(B))return 0;var V=this.leftSE.point,X=this.rightSE.point,st=this.vector();if(V.x===X.x)return B.x===V.x?0:B.x<V.x?1:-1;var xt=(B.y-V.y)/st.y,Dt=V.x+xt*st.x;if(B.x===Dt)return 0;var Ut=(B.x-V.x)/st.x,ct=V.y+Ut*st.y;return B.y===ct?0:B.y<ct?-1:1}},{key:"getIntersection",value:function(B){var V=this.bbox(),X=B.bbox(),st=he(V,X);if(st===null)return null;var xt=this.leftSE.point,Dt=this.rightSE.point,Ut=B.leftSE.point,ct=B.rightSE.point,Ct=Ot(V,Ut)&&this.comparePoint(Ut)===0,Te=Ot(X,xt)&&B.comparePoint(xt)===0,Ie=Ot(V,ct)&&this.comparePoint(ct)===0,oe=Ot(X,Dt)&&B.comparePoint(Dt)===0;if(Te&&Ct)return oe&&!Ie?Dt:!oe&&Ie?ct:null;if(Te)return Ie&&xt.x===ct.x&&xt.y===ct.y?null:xt;if(Ct)return oe&&Dt.x===Ut.x&&Dt.y===Ut.y?null:Ut;if(oe&&Ie)return null;if(oe)return Dt;if(Ie)return ct;var Oe=en(xt,this.vector(),Ut,B.vector());return Oe===null||!Ot(st,Oe)?null:Ne.round(Oe.x,Oe.y)}},{key:"split",value:function(B){var V=[],X=B.events!==void 0,st=new _i(B,!0),xt=new _i(B,!1),Dt=this.rightSE;this.replaceRightSE(xt),V.push(xt),V.push(st);var Ut=new mt(st,Dt,this.rings.slice(),this.windings.slice());return _i.comparePoints(Ut.leftSE.point,Ut.rightSE.point)>0&&Ut.swapEvents(),_i.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),X&&(st.checkForConsuming(),xt.checkForConsuming()),V}},{key:"swapEvents",value:function(){var B=this.rightSE;this.rightSE=this.leftSE,this.leftSE=B,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(var V=0,X=this.windings.length;V<X;V++)this.windings[V]*=-1}},{key:"consume",value:function(B){for(var V=this,X=B;V.consumedBy;)V=V.consumedBy;for(;X.consumedBy;)X=X.consumedBy;var st=mt.compare(V,X);if(st!==0){if(st>0){var xt=V;V=X,X=xt}if(V.prev===X){var Dt=V;V=X,X=Dt}for(var Ut=0,ct=X.rings.length;Ut<ct;Ut++){var Ct=X.rings[Ut],Te=X.windings[Ut],Ie=V.rings.indexOf(Ct);Ie===-1?(V.rings.push(Ct),V.windings.push(Te)):V.windings[Ie]+=Te}X.rings=null,X.windings=null,X.consumedBy=V,X.leftSE.consumedBy=V.leftSE,X.rightSE.consumedBy=V.rightSE}}},{key:"prevInResult",value:function(){return this._prevInResult!==void 0?this._prevInResult:(this.prev?this.prev.isInResult()?this._prevInResult=this.prev:this._prevInResult=this.prev.prevInResult():this._prevInResult=null,this._prevInResult)}},{key:"beforeState",value:function(){if(this._beforeState!==void 0)return this._beforeState;if(!this.prev)this._beforeState={rings:[],windings:[],multiPolys:[]};else{var B=this.prev.consumedBy||this.prev;this._beforeState=B.afterState()}return this._beforeState}},{key:"afterState",value:function(){if(this._afterState!==void 0)return this._afterState;var B=this.beforeState();this._afterState={rings:B.rings.slice(0),windings:B.windings.slice(0),multiPolys:[]};for(var V=this._afterState.rings,X=this._afterState.windings,st=this._afterState.multiPolys,xt=0,Dt=this.rings.length;xt<Dt;xt++){var Ut=this.rings[xt],ct=this.windings[xt],Ct=V.indexOf(Ut);Ct===-1?(V.push(Ut),X.push(ct)):X[Ct]+=ct}for(var Te=[],Ie=[],oe=0,Oe=V.length;oe<Oe;oe++)if(X[oe]!==0){var Ce=V[oe],Qe=Ce.poly;if(Ie.indexOf(Qe)===-1)if(Ce.isExterior)Te.push(Qe);else{Ie.indexOf(Qe)===-1&&Ie.push(Qe);var Pe=Te.indexOf(Ce.poly);Pe!==-1&&Te.splice(Pe,1)}}for(var Vt=0,ge=Te.length;Vt<ge;Vt++){var ce=Te[Vt].multiPoly;st.indexOf(ce)===-1&&st.push(ce)}return this._afterState}},{key:"isInResult",value:function(){if(this.consumedBy)return!1;if(this._isInResult!==void 0)return this._isInResult;var B=this.beforeState().multiPolys,V=this.afterState().multiPolys;switch(Je.type){case"union":{var X=B.length===0,st=V.length===0;this._isInResult=X!==st;break}case"intersection":{var xt,Dt;B.length<V.length?(xt=B.length,Dt=V.length):(xt=V.length,Dt=B.length),this._isInResult=Dt===Je.numMultiPolys&&xt<Dt;break}case"xor":{var Ut=Math.abs(B.length-V.length);this._isInResult=Ut%2===1;break}case"difference":{var ct=function(Te){return Te.length===1&&Te[0].isSubject};this._isInResult=ct(B)!==ct(V);break}default:throw new Error("Unrecognized operation type found ".concat(Je.type))}return this._isInResult}}],[{key:"fromRing",value:function(B,V,X){var st,xt,Dt,Ut=_i.comparePoints(B,V);if(Ut<0)st=B,xt=V,Dt=1;else if(Ut>0)st=V,xt=B,Dt=-1;else throw new Error("Tried to create degenerate segment at [".concat(B.x,", ").concat(B.y,"]"));var ct=new _i(st,!0),Ct=new _i(xt,!1);return new mt(ct,Ct,[X],[Dt])}}]),mt}(),Lr=function(){function mt(U,B,V){if(s(this,mt),!Array.isArray(U)||U.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=B,this.isExterior=V,this.segments=[],typeof U[0][0]!="number"||typeof U[0][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var X=Ne.round(U[0][0],U[0][1]);this.bbox={ll:{x:X.x,y:X.y},ur:{x:X.x,y:X.y}};for(var st=X,xt=1,Dt=U.length;xt<Dt;xt++){if(typeof U[xt][0]!="number"||typeof U[xt][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var Ut=Ne.round(U[xt][0],U[xt][1]);Ut.x===st.x&&Ut.y===st.y||(this.segments.push(kr.fromRing(st,Ut,this)),Ut.x<this.bbox.ll.x&&(this.bbox.ll.x=Ut.x),Ut.y<this.bbox.ll.y&&(this.bbox.ll.y=Ut.y),Ut.x>this.bbox.ur.x&&(this.bbox.ur.x=Ut.x),Ut.y>this.bbox.ur.y&&(this.bbox.ur.y=Ut.y),st=Ut)}(X.x!==st.x||X.y!==st.y)&&this.segments.push(kr.fromRing(st,X,this))}return h(mt,[{key:"getSweepEvents",value:function(){for(var B=[],V=0,X=this.segments.length;V<X;V++){var st=this.segments[V];B.push(st.leftSE),B.push(st.rightSE)}return B}}]),mt}(),rn=function(){function mt(U,B){if(s(this,mt),!Array.isArray(U))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new Lr(U[0],this,!0),this.bbox={ll:{x:this.exteriorRing.bbox.ll.x,y:this.exteriorRing.bbox.ll.y},ur:{x:this.exteriorRing.bbox.ur.x,y:this.exteriorRing.bbox.ur.y}},this.interiorRings=[];for(var V=1,X=U.length;V<X;V++){var st=new Lr(U[V],this,!1);st.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=st.bbox.ll.x),st.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=st.bbox.ll.y),st.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=st.bbox.ur.x),st.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=st.bbox.ur.y),this.interiorRings.push(st)}this.multiPoly=B}return h(mt,[{key:"getSweepEvents",value:function(){for(var B=this.exteriorRing.getSweepEvents(),V=0,X=this.interiorRings.length;V<X;V++)for(var st=this.interiorRings[V].getSweepEvents(),xt=0,Dt=st.length;xt<Dt;xt++)B.push(st[xt]);return B}}]),mt}(),nn=function(){function mt(U,B){if(s(this,mt),!Array.isArray(U))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");try{typeof U[0][0][0]=="number"&&(U=[U])}catch{}this.polys=[],this.bbox={ll:{x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY},ur:{x:Number.NEGATIVE_INFINITY,y:Number.NEGATIVE_INFINITY}};for(var V=0,X=U.length;V<X;V++){var st=new rn(U[V],this);st.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=st.bbox.ll.x),st.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=st.bbox.ll.y),st.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=st.bbox.ur.x),st.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=st.bbox.ur.y),this.polys.push(st)}this.isSubject=B}return h(mt,[{key:"getSweepEvents",value:function(){for(var B=[],V=0,X=this.polys.length;V<X;V++)for(var st=this.polys[V].getSweepEvents(),xt=0,Dt=st.length;xt<Dt;xt++)B.push(st[xt]);return B}}]),mt}(),gr=function(){h(mt,null,[{key:"factory",value:function(B){for(var V=[],X=0,st=B.length;X<st;X++){var xt=B[X];if(!(!xt.isInResult()||xt.ringOut)){for(var Dt=null,Ut=xt.leftSE,ct=xt.rightSE,Ct=[Ut],Te=Ut.point,Ie=[];Dt=Ut,Ut=ct,Ct.push(Ut),Ut.point!==Te;)for(;;){var oe=Ut.getAvailableLinkedEvents();if(oe.length===0){var Oe=Ct[0].point,Ce=Ct[Ct.length-1].point;throw new Error("Unable to complete output ring starting at [".concat(Oe.x,",")+" ".concat(Oe.y,"]. Last matching segment found ends at")+" [".concat(Ce.x,", ").concat(Ce.y,"]."))}if(oe.length===1){ct=oe[0].otherSE;break}for(var Qe=null,Pe=0,Vt=Ie.length;Pe<Vt;Pe++)if(Ie[Pe].point===Ut.point){Qe=Pe;break}if(Qe!==null){var ge=Ie.splice(Qe)[0],ce=Ct.splice(ge.index);ce.unshift(ce[0].otherSE),V.push(new mt(ce.reverse()));continue}Ie.push({index:Ct.length,point:Ut.point});var ai=Ut.getLeftmostComparator(Dt);ct=oe.sort(ai)[0].otherSE;break}V.push(new mt(Ct))}}return V}}]);function mt(U){s(this,mt),this.events=U;for(var B=0,V=U.length;B<V;B++)U[B].segment.ringOut=this;this.poly=null}return h(mt,[{key:"getGeom",value:function(){for(var B=this.events[0].point,V=[B],X=1,st=this.events.length-1;X<st;X++){var xt=this.events[X].point,Dt=this.events[X+1].point;Yi(xt,B,Dt)!==0&&(V.push(xt),B=xt)}if(V.length===1)return null;var Ut=V[0],ct=V[1];Yi(Ut,B,ct)===0&&V.shift(),V.push(V[0]);for(var Ct=this.isExteriorRing()?1:-1,Te=this.isExteriorRing()?0:V.length-1,Ie=this.isExteriorRing()?V.length:-1,oe=[],Oe=Te;Oe!=Ie;Oe+=Ct)oe.push([V[Oe].x,V[Oe].y]);return oe}},{key:"isExteriorRing",value:function(){if(this._isExteriorRing===void 0){var B=this.enclosingRing();this._isExteriorRing=B?!B.isExteriorRing():!0}return this._isExteriorRing}},{key:"enclosingRing",value:function(){return this._enclosingRing===void 0&&(this._enclosingRing=this._calcEnclosingRing()),this._enclosingRing}},{key:"_calcEnclosingRing",value:function(){for(var B=this.events[0],V=1,X=this.events.length;V<X;V++){var st=this.events[V];_i.compare(B,st)>0&&(B=st)}for(var xt=B.segment.prevInResult(),Dt=xt?xt.prevInResult():null;;){if(!xt)return null;if(!Dt)return xt.ringOut;if(Dt.ringOut!==xt.ringOut)return Dt.ringOut.enclosingRing()!==xt.ringOut?xt.ringOut:xt.ringOut.enclosingRing();xt=Dt.prevInResult(),Dt=xt?xt.prevInResult():null}}}]),mt}(),Dr=function(){function mt(U){s(this,mt),this.exteriorRing=U,U.poly=this,this.interiorRings=[]}return h(mt,[{key:"addInterior",value:function(B){this.interiorRings.push(B),B.poly=this}},{key:"getGeom",value:function(){var B=[this.exteriorRing.getGeom()];if(B[0]===null)return null;for(var V=0,X=this.interiorRings.length;V<X;V++){var st=this.interiorRings[V].getGeom();st!==null&&B.push(st)}return B}}]),mt}(),Wr=function(){function mt(U){s(this,mt),this.rings=U,this.polys=this._composePolys(U)}return h(mt,[{key:"getGeom",value:function(){for(var B=[],V=0,X=this.polys.length;V<X;V++){var st=this.polys[V].getGeom();st!==null&&B.push(st)}return B}},{key:"_composePolys",value:function(B){for(var V=[],X=0,st=B.length;X<st;X++){var xt=B[X];if(!xt.poly)if(xt.isExteriorRing())V.push(new Dr(xt));else{var Dt=xt.enclosingRing();Dt.poly||V.push(new Dr(Dt)),Dt.poly.addInterior(xt)}}return V}}]),mt}(),Tn=function(){function mt(U){var B=arguments.length>1&&arguments[1]!==void 0?arguments[1]:kr.compare;s(this,mt),this.queue=U,this.tree=new L(B),this.segments=[]}return h(mt,[{key:"process",value:function(B){var V=B.segment,X=[];if(B.consumedBy)return B.isLeft?this.queue.remove(B.otherSE):this.tree.remove(V),X;var st=B.isLeft?this.tree.insert(V):this.tree.find(V);if(!st)throw new Error("Unable to find segment #".concat(V.id," ")+"[".concat(V.leftSE.point.x,", ").concat(V.leftSE.point.y,"] -> ")+"[".concat(V.rightSE.point.x,", ").concat(V.rightSE.point.y,"] ")+"in SweepLine tree. Please submit a bug report.");for(var xt=st,Dt=st,Ut=void 0,ct=void 0;Ut===void 0;)xt=this.tree.prev(xt),xt===null?Ut=null:xt.key.consumedBy===void 0&&(Ut=xt.key);for(;ct===void 0;)Dt=this.tree.next(Dt),Dt===null?ct=null:Dt.key.consumedBy===void 0&&(ct=Dt.key);if(B.isLeft){var Ct=null;if(Ut){var Te=Ut.getIntersection(V);if(Te!==null&&(V.isAnEndpoint(Te)||(Ct=Te),!Ut.isAnEndpoint(Te)))for(var Ie=this._splitSafely(Ut,Te),oe=0,Oe=Ie.length;oe<Oe;oe++)X.push(Ie[oe])}var Ce=null;if(ct){var Qe=ct.getIntersection(V);if(Qe!==null&&(V.isAnEndpoint(Qe)||(Ce=Qe),!ct.isAnEndpoint(Qe)))for(var Pe=this._splitSafely(ct,Qe),Vt=0,ge=Pe.length;Vt<ge;Vt++)X.push(Pe[Vt])}if(Ct!==null||Ce!==null){var ce=null;if(Ct===null)ce=Ce;else if(Ce===null)ce=Ct;else{var ai=_i.comparePoints(Ct,Ce);ce=ai<=0?Ct:Ce}this.queue.remove(V.rightSE),X.push(V.rightSE);for(var $i=V.split(ce),_e=0,ir=$i.length;_e<ir;_e++)X.push($i[_e])}X.length>0?(this.tree.remove(V),X.push(B)):(this.segments.push(V),V.prev=Ut)}else{if(Ut&&ct){var mi=Ut.getIntersection(ct);if(mi!==null){if(!Ut.isAnEndpoint(mi))for(var rr=this._splitSafely(Ut,mi),ri=0,He=rr.length;ri<He;ri++)X.push(rr[ri]);if(!ct.isAnEndpoint(mi))for(var Vi=this._splitSafely(ct,mi),yr=0,gi=Vi.length;yr<gi;yr++)X.push(Vi[yr])}}this.tree.remove(V)}return X}},{key:"_splitSafely",value:function(B,V){this.tree.remove(B);var X=B.rightSE;this.queue.remove(X);var st=B.split(V);return st.push(X),B.consumedBy===void 0&&this.tree.insert(B),st}}]),mt}(),Dn=typeof process<"u"&&process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE||1e6,Rn=typeof process<"u"&&process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS||1e6,us=function(){function mt(){s(this,mt)}return h(mt,[{key:"run",value:function(B,V,X){Je.type=B,Ne.reset();for(var st=[new nn(V,!0)],xt=0,Dt=X.length;xt<Dt;xt++)st.push(new nn(X[xt],!1));if(Je.numMultiPolys=st.length,Je.type==="difference")for(var Ut=st[0],ct=1;ct<st.length;)he(st[ct].bbox,Ut.bbox)!==null?ct++:st.splice(ct,1);if(Je.type==="intersection"){for(var Ct=0,Te=st.length;Ct<Te;Ct++)for(var Ie=st[Ct],oe=Ct+1,Oe=st.length;oe<Oe;oe++)if(he(Ie.bbox,st[oe].bbox)===null)return[]}for(var Ce=new L(_i.compare),Qe=0,Pe=st.length;Qe<Pe;Qe++)for(var Vt=st[Qe].getSweepEvents(),ge=0,ce=Vt.length;ge<ce;ge++)if(Ce.insert(Vt[ge]),Ce.size>Dn)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big). Please file a bug report.");for(var ai=new Tn(Ce),$i=Ce.size,_e=Ce.pop();_e;){var ir=_e.key;if(Ce.size===$i){var mi=ir.segment;throw new Error("Unable to pop() ".concat(ir.isLeft?"left":"right"," SweepEvent ")+"[".concat(ir.point.x,", ").concat(ir.point.y,"] from segment #").concat(mi.id," ")+"[".concat(mi.leftSE.point.x,", ").concat(mi.leftSE.point.y,"] -> ")+"[".concat(mi.rightSE.point.x,", ").concat(mi.rightSE.point.y,"] from queue. ")+"Please file a bug report.")}if(Ce.size>Dn)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big). Please file a bug report.");if(ai.segments.length>Rn)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments). Please file a bug report.");for(var rr=ai.process(ir),ri=0,He=rr.length;ri<He;ri++){var Vi=rr[ri];Vi.consumedBy===void 0&&Ce.insert(Vi)}$i=Ce.size,_e=Ce.pop()}Ne.reset();var yr=gr.factory(ai.segments),gi=new Wr(yr);return gi.getGeom()}}]),mt}(),Je=new us,sn=function(U){for(var B=arguments.length,V=new Array(B>1?B-1:0),X=1;X<B;X++)V[X-1]=arguments[X];return Je.run("union",U,V)},Bn=function(U){for(var B=arguments.length,V=new Array(B>1?B-1:0),X=1;X<B;X++)V[X-1]=arguments[X];return Je.run("intersection",U,V)},gn=function(U){for(var B=arguments.length,V=new Array(B>1?B-1:0),X=1;X<B;X++)V[X-1]=arguments[X];return Je.run("xor",U,V)},Rr=function(U){for(var B=arguments.length,V=new Array(B>1?B-1:0),X=1;X<B;X++)V[X-1]=arguments[X];return Je.run("difference",U,V)},ps={union:sn,intersection:Bn,xor:gn,difference:Rr};return ps})});var Sc=Ds((cp,up)=>{Z();(function(s,l){typeof cp=="object"&&typeof up<"u"?up.exports=l():typeof define=="function"&&define.amd?define(l):(s=typeof globalThis<"u"?globalThis:s||self,s.maplibregl=l())})(cp,function(){"use strict";var s,l,h;function y(a,T){if(!s)s=T;else if(!l)l=T;else{var M="var sharedChunk = {}; ("+s+")(sharedChunk); ("+l+")(sharedChunk);",D={};s(D),h=T(D),typeof window<"u"&&(h.workerUrl=window.URL.createObjectURL(new Blob([M],{type:"text/javascript"})))}}y(["exports"],function(a){"use strict";var T=M;function M(i,t,r,o){this.cx=3*i,this.bx=3*(r-i)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*t,this.by=3*(o-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=i,this.p1y=t,this.p2x=r,this.p2y=o}function D(i,t,r,o){let u=new T(i,t,r,o);return function(f){return u.solve(f)}}M.prototype={sampleCurveX:function(i){return((this.ax*i+this.bx)*i+this.cx)*i},sampleCurveY:function(i){return((this.ay*i+this.by)*i+this.cy)*i},sampleCurveDerivativeX:function(i){return(3*this.ax*i+2*this.bx)*i+this.cx},solveCurveX:function(i,t){if(t===void 0&&(t=1e-6),i<0)return 0;if(i>1)return 1;for(var r=i,o=0;o<8;o++){var u=this.sampleCurveX(r)-i;if(Math.abs(u)<t)return r;var f=this.sampleCurveDerivativeX(r);if(Math.abs(f)<1e-6)break;r-=u/f}var m=0,x=1;for(r=i,o=0;o<20&&(u=this.sampleCurveX(r),!(Math.abs(u-i)<t));o++)i>u?m=r:x=r,r=.5*(x-m)+m;return r},solve:function(i,t){return this.sampleCurveY(this.solveCurveX(i,t))}};let N=D(.25,.1,.25,1);function L(i,t,r){return Math.min(r,Math.max(t,i))}function tt(i,t,r){let o=r-t,u=((i-t)%o+o)%o+t;return u===t?r:u}function pt(i,...t){for(let r of t)for(let o in r)i[o]=r[o];return i}let ft=1;function yt(i,t){i.forEach(r=>{t[r]&&(t[r]=t[r].bind(t))})}function Ft(i,t,r){let o={};for(let u in i)o[u]=t.call(r||this,i[u],u,i);return o}function kt(i,t,r){let o={};for(let u in i)t.call(r||this,i[u],u,i)&&(o[u]=i[u]);return o}function Ot(i){return Array.isArray(i)?i.map(Ot):typeof i=="object"&&i?Ft(i,Ot):i}let he={};function ne(i){he[i]||(typeof console<"u"&&console.warn(i),he[i]=!0)}function be(i,t,r){return(r.y-i.y)*(t.x-i.x)>(t.y-i.y)*(r.x-i.x)}function xe(i){let t=0;for(let r,o,u=0,f=i.length,m=f-1;u<f;m=u++)r=i[u],o=i[m],t+=(o.x-r.x)*(r.y+o.y);return t}function me(){return typeof WorkerGlobalScope<"u"&&typeof self<"u"&&self instanceof WorkerGlobalScope}function Ge(i){let t={};if(i.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(r,o,u,f)=>{let m=u||f;return t[o]=!m||m.toLowerCase(),""}),t["max-age"]){let r=parseInt(t["max-age"],10);isNaN(r)?delete t["max-age"]:t["max-age"]=r}return t}let Ne,di,Bi=null;function Yi(i){if(Bi==null){let t=i.navigator?i.navigator.userAgent:null;Bi=!!i.safari||!(!t||!(/\b(iPad|iPhone|iPod)\b/.test(t)||t.match("Safari")&&!t.match("Chrome")))}return Bi}function Fi(i){return typeof ImageBitmap<"u"&&i instanceof ImageBitmap}let jr={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frame(i){let t=requestAnimationFrame(i);return{cancel:()=>cancelAnimationFrame(t)}},getImageData(i,t=0){let r=window.document.createElement("canvas"),o=r.getContext("2d");if(!o)throw new Error("failed to create canvas 2d context");return r.width=i.width,r.height=i.height,o.drawImage(i,0,0,i.width,i.height),o.getImageData(-t,-t,i.width+2*t,i.height+2*t)},resolveURL:i=>(Ne||(Ne=document.createElement("a")),Ne.href=i,Ne.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(di==null&&(di=matchMedia("(prefers-reduced-motion: reduce)")),di.matches)}};var ye=zr;function zr(i,t){this.x=i,this.y=t}zr.prototype={clone:function(){return new zr(this.x,this.y)},add:function(i){return this.clone()._add(i)},sub:function(i){return this.clone()._sub(i)},multByPoint:function(i){return this.clone()._multByPoint(i)},divByPoint:function(i){return this.clone()._divByPoint(i)},mult:function(i){return this.clone()._mult(i)},div:function(i){return this.clone()._div(i)},rotate:function(i){return this.clone()._rotate(i)},rotateAround:function(i,t){return this.clone()._rotateAround(i,t)},matMult:function(i){return this.clone()._matMult(i)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(i){return this.x===i.x&&this.y===i.y},dist:function(i){return Math.sqrt(this.distSqr(i))},distSqr:function(i){var t=i.x-this.x,r=i.y-this.y;return t*t+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(i){return Math.atan2(this.y-i.y,this.x-i.x)},angleWith:function(i){return this.angleWithSep(i.x,i.y)},angleWithSep:function(i,t){return Math.atan2(this.x*t-this.y*i,this.x*i+this.y*t)},_matMult:function(i){var t=i[2]*this.x+i[3]*this.y;return this.x=i[0]*this.x+i[1]*this.y,this.y=t,this},_add:function(i){return this.x+=i.x,this.y+=i.y,this},_sub:function(i){return this.x-=i.x,this.y-=i.y,this},_mult:function(i){return this.x*=i,this.y*=i,this},_div:function(i){return this.x/=i,this.y/=i,this},_multByPoint:function(i){return this.x*=i.x,this.y*=i.y,this},_divByPoint:function(i){return this.x/=i.x,this.y/=i.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var i=this.y;return this.y=this.x,this.x=-i,this},_rotate:function(i){var t=Math.cos(i),r=Math.sin(i),o=r*this.x+t*this.y;return this.x=t*this.x-r*this.y,this.y=o,this},_rotateAround:function(i,t){var r=Math.cos(i),o=Math.sin(i),u=t.y+o*(this.x-t.x)+r*(this.y-t.y);return this.x=t.x+r*(this.x-t.x)-o*(this.y-t.y),this.y=u,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},zr.convert=function(i){return i instanceof zr?i:Array.isArray(i)?new zr(i[0],i[1]):i};let $r={MAX_PARALLEL_IMAGE_REQUESTS:16,REGISTERED_PROTOCOLS:{}},en="mapbox-tiles",_i,mn,kr=500,Lr=50;function rn(){typeof caches>"u"||_i||(_i=caches.open(en))}let nn=1/0,gr={supported:!1,testSupport:function(i){!Tn&&Wr&&(Dn?Rn(i):Dr=i)}},Dr,Wr,Tn=!1,Dn=!1;function Rn(i){let t=i.createTexture();i.bindTexture(i.TEXTURE_2D,t);try{if(i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,Wr),i.isContextLost())return;gr.supported=!0}catch{}i.deleteTexture(t),Tn=!0}typeof document<"u"&&(Wr=document.createElement("img"),Wr.onload=function(){Dr&&Rn(Dr),Dr=null,Dn=!0},Wr.onerror=function(){Tn=!0,Dr=null},Wr.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");let us={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image"};typeof Object.freeze=="function"&&Object.freeze(us);class Je extends Error{constructor(t,r,o,u){super(`AJAXError: ${r} (${t}): ${o}`),this.status=t,this.statusText=r,this.url=o,this.body=u}}let sn=me()?()=>self.worker&&self.worker.referrer:()=>(window.location.protocol==="blob:"?window.parent:window).location.href;function Bn(i,t){let r=new AbortController,o=new Request(i.url,{method:i.method||"GET",body:i.body,credentials:i.credentials,headers:i.headers,referrer:sn(),signal:r.signal}),u=!1,f=!1;return i.type==="json"&&o.headers.set("Accept","application/json"),((m,x,b)=>{if(f)return;let E=Date.now();fetch(o).then(A=>A.ok?((z,R,O)=>{(i.type==="arrayBuffer"?z.arrayBuffer():i.type==="json"?z.json():z.text()).then(G=>{f||(R&&O&&function(et,it,dt){if(rn(),!_i)return;let bt={status:it.status,statusText:it.statusText,headers:new Headers};it.headers.forEach((Et,Rt)=>bt.headers.set(Rt,Et));let vt=Ge(it.headers.get("Cache-Control")||"");vt["no-store"]||(vt["max-age"]&&bt.headers.set("Expires",new Date(dt+1e3*vt["max-age"]).toUTCString()),new Date(bt.headers.get("Expires")).getTime()-dt<42e4||function(Et,Rt){if(mn===void 0)try{new Response(new ReadableStream),mn=!0}catch{mn=!1}mn?Rt(Et.body):Et.blob().then(Rt)}(it,Et=>{let Rt=new Response(Et,bt);rn(),_i&&_i.then(zt=>zt.put(function(ee){let le=ee.indexOf("?");return le<0?ee:ee.slice(0,le)}(et.url),Rt)).catch(zt=>ne(zt.message))}))}(o,R,O),u=!0,t(null,G,z.headers.get("Cache-Control"),z.headers.get("Expires")))}).catch(G=>{f||t(new Error(G.message))})})(A,null,E):A.blob().then(z=>t(new Je(A.status,A.statusText,i.url,z)))).catch(A=>{A.code!==20&&t(new Error(A.message))})})(),{cancel:()=>{f=!0,u||r.abort()}}}let gn=function(i,t){if(/:\/\//.test(i.url)&&!/^https?:|^file:/.test(i.url)){if(me()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",i,t);if(!me()){let o=i.url.substring(0,i.url.indexOf("://"));return($r.REGISTERED_PROTOCOLS[o]||Bn)(i,t)}}if(!(/^file:/.test(r=i.url)||/^file:/.test(sn())&&!/^\w+:/.test(r))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return Bn(i,t);if(me()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",i,t,void 0,!0)}var r;return function(o,u){let f=new XMLHttpRequest;f.open(o.method||"GET",o.url,!0),o.type==="arrayBuffer"&&(f.responseType="arraybuffer");for(let m in o.headers)f.setRequestHeader(m,o.headers[m]);return o.type==="json"&&(f.responseType="text",f.setRequestHeader("Accept","application/json")),f.withCredentials=o.credentials==="include",f.onerror=()=>{u(new Error(f.statusText))},f.onload=()=>{if((f.status>=200&&f.status<300||f.status===0)&&f.response!==null){let m=f.response;if(o.type==="json")try{m=JSON.parse(f.response)}catch(x){return u(x)}u(null,m,f.getResponseHeader("Cache-Control"),f.getResponseHeader("Expires"))}else{let m=new Blob([f.response],{type:f.getResponseHeader("Content-Type")});u(new Je(f.status,f.statusText,o.url,m))}},f.send(o.body),{cancel:()=>f.abort()}}(i,t)},Rr=function(i,t){return gn(pt(i,{type:"arrayBuffer"}),t)};function ps(i){let t=window.document.createElement("a");return t.href=i,t.protocol===window.document.location.protocol&&t.host===window.document.location.host}let mt="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=",U,B;U=[],B=0;let V=function(i,t){if(gr.supported&&(i.headers||(i.headers={}),i.headers.accept="image/webp,*/*"),B>=$r.MAX_PARALLEL_IMAGE_REQUESTS){let f={requestParameters:i,callback:t,cancelled:!1,cancel(){this.cancelled=!0}};return U.push(f),f}B++;let r=!1,o=()=>{if(!r)for(r=!0,B--;U.length&&B<$r.MAX_PARALLEL_IMAGE_REQUESTS;){let f=U.shift(),{requestParameters:m,callback:x,cancelled:b}=f;b||(f.cancel=V(m,x).cancel)}},u=Rr(i,(f,m,x,b)=>{o(),f?t(f):m&&function(E,A){typeof createImageBitmap=="function"?function(z,R){let O=new Blob([new Uint8Array(z)],{type:"image/png"});createImageBitmap(O).then(G=>{R(null,G)}).catch(G=>{R(new Error(`Could not load image because of ${G.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})}(E,A):function(z,R){let O=new Image;O.onload=()=>{R(null,O),URL.revokeObjectURL(O.src),O.onload=null,window.requestAnimationFrame(()=>{O.src=mt})},O.onerror=()=>R(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));let G=new Blob([new Uint8Array(z)],{type:"image/png"});O.src=z.byteLength?URL.createObjectURL(G):mt}(E,A)}(m,(E,A)=>{E!=null?t(E):A!=null&&t(null,A,{cacheControl:x,expires:b})})});return{cancel:()=>{u.cancel(),o()}}};function X(i,t,r){r[i]&&r[i].indexOf(t)!==-1||(r[i]=r[i]||[],r[i].push(t))}function st(i,t,r){if(r&&r[i]){let o=r[i].indexOf(t);o!==-1&&r[i].splice(o,1)}}class xt{constructor(t,r={}){pt(this,r),this.type=t}}class Dt extends xt{constructor(t,r={}){super("error",pt({error:t},r))}}class Ut{on(t,r){return this._listeners=this._listeners||{},X(t,r,this._listeners),this}off(t,r){return st(t,r,this._listeners),st(t,r,this._oneTimeListeners),this}once(t,r){return this._oneTimeListeners=this._oneTimeListeners||{},X(t,r,this._oneTimeListeners),this}fire(t,r){typeof t=="string"&&(t=new xt(t,r||{}));let o=t.type;if(this.listens(o)){t.target=this;let u=this._listeners&&this._listeners[o]?this._listeners[o].slice():[];for(let x of u)x.call(this,t);let f=this._oneTimeListeners&&this._oneTimeListeners[o]?this._oneTimeListeners[o].slice():[];for(let x of f)st(o,x,this._oneTimeListeners),x.call(this,t);let m=this._eventedParent;m&&(pt(t,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),m.fire(t))}else t instanceof Dt&&console.error(t.error);return this}listens(t){return this._listeners&&this._listeners[t]&&this._listeners[t].length>0||this._oneTimeListeners&&this._oneTimeListeners[t]&&this._oneTimeListeners[t].length>0||this._eventedParent&&this._eventedParent.listens(t)}setEventedParent(t,r){return this._eventedParent=t,this._eventedParentData=r,this}}var ct={$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"},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:"number",default:2,minimum:0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"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}},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 Ct{constructor(t,r,o,u){this.message=(t?`${t}: `:"")+o,u&&(this.identifier=u),r!=null&&r.__line__&&(this.line=r.__line__)}}function Te(i){let t=i.value;return t?[new Ct(i.key,t,"constants have been deprecated as of v8")]:[]}function Ie(i,...t){for(let r of t)for(let o in r)i[o]=r[o];return i}function oe(i){return i instanceof Number||i instanceof String||i instanceof Boolean?i.valueOf():i}function Oe(i){if(Array.isArray(i))return i.map(Oe);if(i instanceof Object&&!(i instanceof Number||i instanceof String||i instanceof Boolean)){let t={};for(let r in i)t[r]=Oe(i[r]);return t}return oe(i)}class Ce extends Error{constructor(t,r){super(r),this.message=r,this.key=t}}class Qe{constructor(t,r=[]){this.parent=t,this.bindings={};for(let[o,u]of r)this.bindings[o]=u}concat(t){return new Qe(this,t)}get(t){if(this.bindings[t])return this.bindings[t];if(this.parent)return this.parent.get(t);throw new Error(`${t} not found in scope.`)}has(t){return!!this.bindings[t]||!!this.parent&&this.parent.has(t)}}let Pe={kind:"null"},Vt={kind:"number"},ge={kind:"string"},ce={kind:"boolean"},ai={kind:"color"},$i={kind:"object"},_e={kind:"value"},ir={kind:"collator"},mi={kind:"formatted"},rr={kind:"resolvedImage"};function ri(i,t){return{kind:"array",itemType:i,N:t}}function He(i){if(i.kind==="array"){let t=He(i.itemType);return typeof i.N=="number"?`array<${t}, ${i.N}>`:i.itemType.kind==="value"?"array":`array<${t}>`}return i.kind}let Vi=[Pe,Vt,ge,ce,ai,mi,$i,ri(_e),rr];function yr(i,t){if(t.kind==="error")return null;if(i.kind==="array"){if(t.kind==="array"&&(t.N===0&&t.itemType.kind==="value"||!yr(i.itemType,t.itemType))&&(typeof i.N!="number"||i.N===t.N))return null}else{if(i.kind===t.kind)return null;if(i.kind==="value"){for(let r of Vi)if(!yr(r,t))return null}}return`Expected ${He(i)} but found ${He(t)} instead.`}function gi(i,t){return t.some(r=>r.kind===i.kind)}function Zr(i,t){return t.some(r=>r==="null"?i===null:r==="array"?Array.isArray(i):r==="object"?i&&!Array.isArray(i)&&typeof i=="object":r===typeof i)}var Hr,qs={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 ds(i){return(i=Math.round(i))<0?0:i>255?255:i}function fs(i){return ds(i[i.length-1]==="%"?parseFloat(i)/100*255:parseInt(i))}function W(i){return(t=i[i.length-1]==="%"?parseFloat(i)/100:parseFloat(i))<0?0:t>1?1:t;var t}function I(i,t,r){return r<0?r+=1:r>1&&(r-=1),6*r<1?i+(t-i)*r*6:2*r<1?t:3*r<2?i+(t-i)*(2/3-r)*6:i}try{Hr={}.parseCSSColor=function(i){var t,r=i.replace(/ /g,"").toLowerCase();if(r in qs)return qs[r].slice();if(r[0]==="#")return r.length===4?(t=parseInt(r.substr(1),16))>=0&&t<=4095?[(3840&t)>>4|(3840&t)>>8,240&t|(240&t)>>4,15&t|(15&t)<<4,1]:null:r.length===7&&(t=parseInt(r.substr(1),16))>=0&&t<=16777215?[(16711680&t)>>16,(65280&t)>>8,255&t,1]:null;var o=r.indexOf("("),u=r.indexOf(")");if(o!==-1&&u+1===r.length){var f=r.substr(0,o),m=r.substr(o+1,u-(o+1)).split(","),x=1;switch(f){case"rgba":if(m.length!==4)return null;x=W(m.pop());case"rgb":return m.length!==3?null:[fs(m[0]),fs(m[1]),fs(m[2]),x];case"hsla":if(m.length!==4)return null;x=W(m.pop());case"hsl":if(m.length!==3)return null;var b=(parseFloat(m[0])%360+360)%360/360,E=W(m[1]),A=W(m[2]),z=A<=.5?A*(E+1):A+E-A*E,R=2*A-z;return[ds(255*I(R,z,b+1/3)),ds(255*I(R,z,b)),ds(255*I(R,z,b-1/3)),x];default:return null}}return null}}catch{}class P{constructor(t,r,o,u=1){this.r=t,this.g=r,this.b=o,this.a=u}static parse(t){if(!t)return;if(t instanceof P)return t;if(typeof t!="string")return;let r=Hr(t);return r?new P(r[0]/255*r[3],r[1]/255*r[3],r[2]/255*r[3],r[3]):void 0}toString(){let[t,r,o,u]=this.toArray();return`rgba(${Math.round(t)},${Math.round(r)},${Math.round(o)},${u})`}toArray(){let{r:t,g:r,b:o,a:u}=this;return u===0?[0,0,0,0]:[255*t/u,255*r/u,255*o/u,u]}}P.black=new P(0,0,0,1),P.white=new P(1,1,1,1),P.transparent=new P(0,0,0,0),P.red=new P(1,0,0,1);class q{constructor(t,r,o){this.sensitivity=t?r?"variant":"case":r?"accent":"base",this.locale=o,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(t,r){return this.collator.compare(t,r)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class H{constructor(t,r,o,u,f){this.text=t,this.image=r,this.scale=o,this.fontStack=u,this.textColor=f}}class Y{constructor(t){this.sections=t}static fromString(t){return new Y([new H(t,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(t=>t.text.length!==0||t.image&&t.image.name.length!==0)}static factory(t){return t instanceof Y?t:Y.fromString(t)}toString(){return this.sections.length===0?"":this.sections.map(t=>t.text).join("")}serialize(){let t=["format"];for(let r of this.sections){if(r.image){t.push(["image",r.image.name]);continue}t.push(r.text);let o={};r.fontStack&&(o["text-font"]=["literal",r.fontStack.split(",")]),r.scale&&(o["font-scale"]=r.scale),r.textColor&&(o["text-color"]=["rgba"].concat(r.textColor.toArray())),t.push(o)}return t}}class at{constructor(t){this.name=t.name,this.available=t.available}toString(){return this.name}static fromString(t){return t?new at({name:t,available:!1}):null}serialize(){return["image",this.name]}}function rt(i,t,r,o){return typeof i=="number"&&i>=0&&i<=255&&typeof t=="number"&&t>=0&&t<=255&&typeof r=="number"&&r>=0&&r<=255?o===void 0||typeof o=="number"&&o>=0&&o<=1?null:`Invalid rgba value [${[i,t,r,o].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof o=="number"?[i,t,r,o]:[i,t,r]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function nt(i){if(i===null||typeof i=="string"||typeof i=="boolean"||typeof i=="number"||i instanceof P||i instanceof q||i instanceof Y||i instanceof at)return!0;if(Array.isArray(i)){for(let t of i)if(!nt(t))return!1;return!0}if(typeof i=="object"){for(let t in i)if(!nt(i[t]))return!1;return!0}return!1}function ot(i){if(i===null)return Pe;if(typeof i=="string")return ge;if(typeof i=="boolean")return ce;if(typeof i=="number")return Vt;if(i instanceof P)return ai;if(i instanceof q)return ir;if(i instanceof Y)return mi;if(i instanceof at)return rr;if(Array.isArray(i)){let t=i.length,r;for(let o of i){let u=ot(o);if(r){if(r===u)continue;r=_e;break}r=u}return ri(r||_e,t)}return $i}function St(i){let t=typeof i;return i===null?"":t==="string"||t==="number"||t==="boolean"?String(i):i instanceof P||i instanceof Y||i instanceof at?i.toString():JSON.stringify(i)}class Lt{constructor(t,r){this.type=t,this.value=r}static parse(t,r){if(t.length!==2)return r.error(`'literal' expression requires exactly one argument, but found ${t.length-1} instead.`);if(!nt(t[1]))return r.error("invalid value");let o=t[1],u=ot(o),f=r.expectedType;return u.kind!=="array"||u.N!==0||!f||f.kind!=="array"||typeof f.N=="number"&&f.N!==0||(u=f),new Lt(u,o)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}serialize(){return this.type.kind==="array"||this.type.kind==="object"?["literal",this.value]:this.value instanceof P?["rgba"].concat(this.value.toArray()):this.value instanceof Y?this.value.serialize():this.value}}class wt{constructor(t){this.name="ExpressionEvaluationError",this.message=t}toJSON(){return this.message}}let re={string:ge,number:Vt,boolean:ce,object:$i};class Jt{constructor(t,r){this.type=t,this.args=r}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");let o,u=1,f=t[0];if(f==="array"){let x,b;if(t.length>2){let E=t[1];if(typeof E!="string"||!(E in re)||E==="object")return r.error('The item type argument of "array" must be one of string, number, boolean',1);x=re[E],u++}else x=_e;if(t.length>3){if(t[2]!==null&&(typeof t[2]!="number"||t[2]<0||t[2]!==Math.floor(t[2])))return r.error('The length argument to "array" must be a positive integer literal',2);b=t[2],u++}o=ri(x,b)}else o=re[f];let m=[];for(;u<t.length;u++){let x=r.parse(t[u],u,_e);if(!x)return null;m.push(x)}return new Jt(o,m)}evaluate(t){for(let r=0;r<this.args.length;r++){let o=this.args[r].evaluate(t);if(!yr(this.type,ot(o)))return o;if(r===this.args.length-1)throw new wt(`Expected value to be of type ${He(this.type)}, but found ${He(ot(o))} instead.`)}return null}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}serialize(){let t=this.type,r=[t.kind];if(t.kind==="array"){let o=t.itemType;if(o.kind==="string"||o.kind==="number"||o.kind==="boolean"){r.push(o.kind);let u=t.N;(typeof u=="number"||this.args.length>1)&&r.push(u)}}return r.concat(this.args.map(o=>o.serialize()))}}class ae{constructor(t){this.type=mi,this.sections=t}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");let o=t[1];if(!Array.isArray(o)&&typeof o=="object")return r.error("First argument must be an image or text section.");let u=[],f=!1;for(let m=1;m<=t.length-1;++m){let x=t[m];if(f&&typeof x=="object"&&!Array.isArray(x)){f=!1;let b=null;if(x["font-scale"]&&(b=r.parse(x["font-scale"],1,Vt),!b))return null;let E=null;if(x["text-font"]&&(E=r.parse(x["text-font"],1,ri(ge)),!E))return null;let A=null;if(x["text-color"]&&(A=r.parse(x["text-color"],1,ai),!A))return null;let z=u[u.length-1];z.scale=b,z.font=E,z.textColor=A}else{let b=r.parse(t[m],1,_e);if(!b)return null;let E=b.type.kind;if(E!=="string"&&E!=="value"&&E!=="null"&&E!=="resolvedImage")return r.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");f=!0,u.push({content:b,scale:null,font:null,textColor:null})}}return new ae(u)}evaluate(t){return new Y(this.sections.map(r=>{let o=r.content.evaluate(t);return ot(o)===rr?new H("",o,null,null,null):new H(St(o),null,r.scale?r.scale.evaluate(t):null,r.font?r.font.evaluate(t).join(","):null,r.textColor?r.textColor.evaluate(t):null)}))}eachChild(t){for(let r of this.sections)t(r.content),r.scale&&t(r.scale),r.font&&t(r.font),r.textColor&&t(r.textColor)}outputDefined(){return!1}serialize(){let t=["format"];for(let r of this.sections){t.push(r.content.serialize());let o={};r.scale&&(o["font-scale"]=r.scale.serialize()),r.font&&(o["text-font"]=r.font.serialize()),r.textColor&&(o["text-color"]=r.textColor.serialize()),t.push(o)}return t}}class pe{constructor(t){this.type=rr,this.input=t}static parse(t,r){if(t.length!==2)return r.error("Expected two arguments.");let o=r.parse(t[1],1,ge);return o?new pe(o):r.error("No image name provided.")}evaluate(t){let r=this.input.evaluate(t),o=at.fromString(r);return o&&t.availableImages&&(o.available=t.availableImages.indexOf(r)>-1),o}eachChild(t){t(this.input)}outputDefined(){return!1}serialize(){return["image",this.input.serialize()]}}let Ue={"to-boolean":ce,"to-color":ai,"to-number":Vt,"to-string":ge};class De{constructor(t,r){this.type=t,this.args=r}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");let o=t[0];if((o==="to-boolean"||o==="to-string")&&t.length!==2)return r.error("Expected one argument.");let u=Ue[o],f=[];for(let m=1;m<t.length;m++){let x=r.parse(t[m],m,_e);if(!x)return null;f.push(x)}return new De(u,f)}evaluate(t){if(this.type.kind==="boolean")return Boolean(this.args[0].evaluate(t));if(this.type.kind==="color"){let r,o;for(let u of this.args){if(r=u.evaluate(t),o=null,r instanceof P)return r;if(typeof r=="string"){let f=t.parseColor(r);if(f)return f}else if(Array.isArray(r)&&(o=r.length<3||r.length>4?`Invalid rbga value ${JSON.stringify(r)}: expected an array containing either three or four numeric values.`:rt(r[0],r[1],r[2],r[3]),!o))return new P(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new wt(o||`Could not parse color from value '${typeof r=="string"?r:String(JSON.stringify(r))}'`)}if(this.type.kind==="number"){let r=null;for(let o of this.args){if(r=o.evaluate(t),r===null)return 0;let u=Number(r);if(!isNaN(u))return u}throw new wt(`Could not convert ${JSON.stringify(r)} to number.`)}return this.type.kind==="formatted"?Y.fromString(St(this.args[0].evaluate(t))):this.type.kind==="resolvedImage"?at.fromString(St(this.args[0].evaluate(t))):St(this.args[0].evaluate(t))}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}serialize(){if(this.type.kind==="formatted")return new ae([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if(this.type.kind==="resolvedImage")return new pe(this.args[0]).serialize();let t=[`to-${this.type.kind}`];return this.eachChild(r=>{t.push(r.serialize())}),t}}let ze=["Unknown","Point","LineString","Polygon"];class Ee{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"?ze[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(t){let r=this._parseColorCache[t];return r||(r=this._parseColorCache[t]=P.parse(t)),r}}class Se{constructor(t,r,o,u){this.name=t,this.type=r,this._evaluate=o,this.args=u}evaluate(t){return this._evaluate(t,this.args)}eachChild(t){this.args.forEach(t)}outputDefined(){return!1}serialize(){return[this.name].concat(this.args.map(t=>t.serialize()))}static parse(t,r){let o=t[0],u=Se.definitions[o];if(!u)return r.error(`Unknown expression "${o}". If you wanted a literal array, use ["literal", [...]].`,0);let f=Array.isArray(u)?u[0]:u.type,m=Array.isArray(u)?[[u[1],u[2]]]:u.overloads,x=m.filter(([E])=>!Array.isArray(E)||E.length===t.length-1),b=null;for(let[E,A]of x){b=new Ea(r.registry,r.path,null,r.scope);let z=[],R=!1;for(let O=1;O<t.length;O++){let G=t[O],et=Array.isArray(E)?E[O-1]:E.type,it=b.parse(G,1+z.length,et);if(!it){R=!0;break}z.push(it)}if(!R)if(Array.isArray(E)&&E.length!==z.length)b.error(`Expected ${E.length} arguments, but found ${z.length} instead.`);else{for(let O=0;O<z.length;O++){let G=Array.isArray(E)?E[O]:E.type,et=z[O];b.concat(O+1).checkSubtype(G,et.type)}if(b.errors.length===0)return new Se(o,f,A,z)}}if(x.length===1)r.errors.push(...b.errors);else{let E=(x.length?x:m).map(([z])=>{return R=z,Array.isArray(R)?`(${R.map(He).join(", ")})`:`(${He(R.type)}...)`;var R}).join(" | "),A=[];for(let z=1;z<t.length;z++){let R=r.parse(t[z],1+A.length);if(!R)return null;A.push(He(R.type))}r.error(`Expected arguments of type ${E}, but found (${A.join(", ")}) instead.`)}return null}static register(t,r){Se.definitions=r;for(let o in r)t[o]=Se}}class wi{constructor(t,r,o){this.type=ir,this.locale=o,this.caseSensitive=t,this.diacriticSensitive=r}static parse(t,r){if(t.length!==2)return r.error("Expected one argument.");let o=t[1];if(typeof o!="object"||Array.isArray(o))return r.error("Collator options argument must be an object.");let u=r.parse(o["case-sensitive"]!==void 0&&o["case-sensitive"],1,ce);if(!u)return null;let f=r.parse(o["diacritic-sensitive"]!==void 0&&o["diacritic-sensitive"],1,ce);if(!f)return null;let m=null;return o.locale&&(m=r.parse(o.locale,1,ge),!m)?null:new wi(u,f,m)}evaluate(t){return new q(this.caseSensitive.evaluate(t),this.diacriticSensitive.evaluate(t),this.locale?this.locale.evaluate(t):null)}eachChild(t){t(this.caseSensitive),t(this.diacriticSensitive),this.locale&&t(this.locale)}outputDefined(){return!1}serialize(){let t={};return t["case-sensitive"]=this.caseSensitive.serialize(),t["diacritic-sensitive"]=this.diacriticSensitive.serialize(),this.locale&&(t.locale=this.locale.serialize()),["collator",t]}}let xi=8192;function Gi(i,t){i[0]=Math.min(i[0],t[0]),i[1]=Math.min(i[1],t[1]),i[2]=Math.max(i[2],t[0]),i[3]=Math.max(i[3],t[1])}function Wi(i,t){return!(i[0]<=t[0]||i[2]>=t[2]||i[1]<=t[1]||i[3]>=t[3])}function ko(i,t){let r=(180+i[0])/360,o=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i[1]*Math.PI/360)))/360,u=Math.pow(2,t.z);return[Math.round(r*u*xi),Math.round(o*u*xi)]}function Lo(i,t,r){let o=i[0]-t[0],u=i[1]-t[1],f=i[0]-r[0],m=i[1]-r[1];return o*m-f*u==0&&o*f<=0&&u*m<=0}function ni(i,t){let r=!1;for(let m=0,x=t.length;m<x;m++){let b=t[m];for(let E=0,A=b.length;E<A-1;E++){if(Lo(i,b[E],b[E+1]))return!1;(u=b[E])[1]>(o=i)[1]!=(f=b[E+1])[1]>o[1]&&o[0]<(f[0]-u[0])*(o[1]-u[1])/(f[1]-u[1])+u[0]&&(r=!r)}}var o,u,f;return r}function Pc(i,t){for(let r=0;r<t.length;r++)if(ni(i,t[r]))return!0;return!1}function Do(i,t,r,o){let u=o[0]-r[0],f=o[1]-r[1],m=(i[0]-r[0])*f-u*(i[1]-r[1]),x=(t[0]-r[0])*f-u*(t[1]-r[1]);return m>0&&x<0||m<0&&x>0}function zc(i,t,r){for(let E of r)for(let A=0;A<E.length-1;++A)if((x=[(m=E[A+1])[0]-(f=E[A])[0],m[1]-f[1]])[0]*(b=[(u=t)[0]-(o=i)[0],u[1]-o[1]])[1]-x[1]*b[0]!=0&&Do(o,u,f,m)&&Do(f,m,o,u))return!0;var o,u,f,m,x,b;return!1}function Ro(i,t){for(let r=0;r<i.length;++r)if(!ni(i[r],t))return!1;for(let r=0;r<i.length-1;++r)if(zc(i[r],i[r+1],t))return!1;return!0}function Zl(i,t){for(let r=0;r<t.length;r++)if(Ro(i,t[r]))return!0;return!1}function Bo(i,t,r){let o=[];for(let u=0;u<i.length;u++){let f=[];for(let m=0;m<i[u].length;m++){let x=ko(i[u][m],r);Gi(t,x),f.push(x)}o.push(f)}return o}function Fo(i,t,r){let o=[];for(let u=0;u<i.length;u++){let f=Bo(i[u],t,r);o.push(f)}return o}function Oo(i,t,r,o){if(i[0]<r[0]||i[0]>r[2]){let u=.5*o,f=i[0]-r[0]>u?-o:r[0]-i[0]>u?o:0;f===0&&(f=i[0]-r[2]>u?-o:r[2]-i[0]>u?o:0),i[0]+=f}Gi(t,i)}function Hl(i,t,r,o){let u=Math.pow(2,o.z)*xi,f=[o.x*xi,o.y*xi],m=[];for(let x of i)for(let b of x){let E=[b.x+f[0],b.y+f[1]];Oo(E,t,r,u),m.push(E)}return m}function Xl(i,t,r,o){let u=Math.pow(2,o.z)*xi,f=[o.x*xi,o.y*xi],m=[];for(let b of i){let E=[];for(let A of b){let z=[A.x+f[0],A.y+f[1]];Gi(t,z),E.push(z)}m.push(E)}if(t[2]-t[0]<=u/2){(x=t)[0]=x[1]=1/0,x[2]=x[3]=-1/0;for(let b of m)for(let E of b)Oo(E,t,r,u)}var x;return m}class Fn{constructor(t,r){this.type=ce,this.geojson=t,this.geometries=r}static parse(t,r){if(t.length!==2)return r.error(`'within' expression requires exactly one argument, but found ${t.length-1} instead.`);if(nt(t[1])){let o=t[1];if(o.type==="FeatureCollection")for(let u=0;u<o.features.length;++u){let f=o.features[u].geometry.type;if(f==="Polygon"||f==="MultiPolygon")return new Fn(o,o.features[u].geometry)}else if(o.type==="Feature"){let u=o.geometry.type;if(u==="Polygon"||u==="MultiPolygon")return new Fn(o,o.geometry)}else if(o.type==="Polygon"||o.type==="MultiPolygon")return new Fn(o,o)}return r.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(t.geometry()!=null&&t.canonicalID()!=null){if(t.geometryType()==="Point")return function(r,o){let u=[1/0,1/0,-1/0,-1/0],f=[1/0,1/0,-1/0,-1/0],m=r.canonicalID();if(o.type==="Polygon"){let x=Bo(o.coordinates,f,m),b=Hl(r.geometry(),u,f,m);if(!Wi(u,f))return!1;for(let E of b)if(!ni(E,x))return!1}if(o.type==="MultiPolygon"){let x=Fo(o.coordinates,f,m),b=Hl(r.geometry(),u,f,m);if(!Wi(u,f))return!1;for(let E of b)if(!Pc(E,x))return!1}return!0}(t,this.geometries);if(t.geometryType()==="LineString")return function(r,o){let u=[1/0,1/0,-1/0,-1/0],f=[1/0,1/0,-1/0,-1/0],m=r.canonicalID();if(o.type==="Polygon"){let x=Bo(o.coordinates,f,m),b=Xl(r.geometry(),u,f,m);if(!Wi(u,f))return!1;for(let E of b)if(!Ro(E,x))return!1}if(o.type==="MultiPolygon"){let x=Fo(o.coordinates,f,m),b=Xl(r.geometry(),u,f,m);if(!Wi(u,f))return!1;for(let E of b)if(!Zl(E,x))return!1}return!0}(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}serialize(){return["within",this.geojson]}}function Sa(i){if(i instanceof Se&&(i.name==="get"&&i.args.length===1||i.name==="feature-state"||i.name==="has"&&i.args.length===1||i.name==="properties"||i.name==="geometry-type"||i.name==="id"||/^filter-/.test(i.name))||i instanceof Fn)return!1;let t=!0;return i.eachChild(r=>{t&&!Sa(r)&&(t=!1)}),t}function ms(i){if(i instanceof Se&&i.name==="feature-state")return!1;let t=!0;return i.eachChild(r=>{t&&!ms(r)&&(t=!1)}),t}function js(i,t){if(i instanceof Se&&t.indexOf(i.name)>=0)return!1;let r=!0;return i.eachChild(o=>{r&&!js(o,t)&&(r=!1)}),r}class Ta{constructor(t,r){this.type=r.type,this.name=t,this.boundExpression=r}static parse(t,r){if(t.length!==2||typeof t[1]!="string")return r.error("'var' expression requires exactly one string literal argument.");let o=t[1];return r.scope.has(o)?new Ta(o,r.scope.get(o)):r.error(`Unknown variable "${o}". Make sure "${o}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(t){return this.boundExpression.evaluate(t)}eachChild(){}outputDefined(){return!1}serialize(){return["var",this.name]}}class Ea{constructor(t,r=[],o,u=new Qe,f=[]){this.registry=t,this.path=r,this.key=r.map(m=>`[${m}]`).join(""),this.scope=u,this.errors=f,this.expectedType=o}parse(t,r,o,u,f={}){return r?this.concat(r,o,u)._parse(t,f):this._parse(t,f)}_parse(t,r){function o(u,f,m){return m==="assert"?new Jt(f,[u]):m==="coerce"?new De(f,[u]):u}if(t!==null&&typeof t!="string"&&typeof t!="boolean"&&typeof t!="number"||(t=["literal",t]),Array.isArray(t)){if(t.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');let u=t[0];if(typeof u!="string")return this.error(`Expression name must be a string, but found ${typeof u} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;let f=this.registry[u];if(f){let m=f.parse(t,this);if(!m)return null;if(this.expectedType){let x=this.expectedType,b=m.type;if(x.kind!=="string"&&x.kind!=="number"&&x.kind!=="boolean"&&x.kind!=="object"&&x.kind!=="array"||b.kind!=="value")if(x.kind!=="color"&&x.kind!=="formatted"&&x.kind!=="resolvedImage"||b.kind!=="value"&&b.kind!=="string"){if(this.checkSubtype(x,b))return null}else m=o(m,x,r.typeAnnotation||"coerce");else m=o(m,x,r.typeAnnotation||"assert")}if(!(m instanceof Lt)&&m.type.kind!=="resolvedImage"&&$s(m)){let x=new Ee;try{m=new Lt(m.type,m.evaluate(x))}catch(b){return this.error(b.message),null}}return m}return this.error(`Unknown expression "${u}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(t===void 0?"'undefined' value invalid. Use null instead.":typeof t=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof t} instead.`)}concat(t,r,o){let u=typeof t=="number"?this.path.concat(t):this.path,f=o?this.scope.concat(o):this.scope;return new Ea(this.registry,u,r||null,f,this.errors)}error(t,...r){let o=`${this.key}${r.map(u=>`[${u}]`).join("")}`;this.errors.push(new Ce(o,t))}checkSubtype(t,r){let o=yr(t,r);return o&&this.error(o),o}}function $s(i){if(i instanceof Ta)return $s(i.boundExpression);if(i instanceof Se&&i.name==="error"||i instanceof wi||i instanceof Fn)return!1;let t=i instanceof De||i instanceof Jt,r=!0;return i.eachChild(o=>{r=t?r&&$s(o):r&&o instanceof Lt}),!!r&&Sa(i)&&js(i,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function Ia(i,t){let r=i.length-1,o,u,f=0,m=r,x=0;for(;f<=m;)if(x=Math.floor((f+m)/2),o=i[x],u=i[x+1],o<=t){if(x===r||t<u)return x;f=x+1}else{if(!(o>t))throw new wt("Input is not a number.");m=x-1}return 0}class Ws{constructor(t,r,o){this.type=t,this.input=r,this.labels=[],this.outputs=[];for(let[u,f]of o)this.labels.push(u),this.outputs.push(f)}static parse(t,r){if(t.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return r.error("Expected an even number of arguments.");let o=r.parse(t[1],1,Vt);if(!o)return null;let u=[],f=null;r.expectedType&&r.expectedType.kind!=="value"&&(f=r.expectedType);for(let m=1;m<t.length;m+=2){let x=m===1?-1/0:t[m],b=t[m+1],E=m,A=m+1;if(typeof x!="number")return r.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',E);if(u.length&&u[u.length-1][0]>=x)return r.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',E);let z=r.parse(b,A,f);if(!z)return null;f=f||z.type,u.push([x,z])}return new Ws(f,o,u)}evaluate(t){let r=this.labels,o=this.outputs;if(r.length===1)return o[0].evaluate(t);let u=this.input.evaluate(t);if(u<=r[0])return o[0].evaluate(t);let f=r.length;return u>=r[f-1]?o[f-1].evaluate(t):o[Ia(r,u)].evaluate(t)}eachChild(t){t(this.input);for(let r of this.outputs)t(r)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}serialize(){let t=["step",this.input.serialize()];for(let r=0;r<this.labels.length;r++)r>0&&t.push(this.labels[r]),t.push(this.outputs[r].serialize());return t}}function Ai(i,t,r){return i*(1-r)+t*r}var Zs=Object.freeze({__proto__:null,number:Ai,color:function(i,t,r){return new P(Ai(i.r,t.r,r),Ai(i.g,t.g,r),Ai(i.b,t.b,r),Ai(i.a,t.a,r))},array:function(i,t,r){return i.map((o,u)=>Ai(o,t[u],r))}});let No=.95047,Kl=1.08883,Yl=4/29,Ca=6/29,Uo=3*Ca*Ca,kc=Math.PI/180,Lc=180/Math.PI;function Vo(i){return i>.008856451679035631?Math.pow(i,1/3):i/Uo+Yl}function Go(i){return i>Ca?i*i*i:Uo*(i-Yl)}function qo(i){return 255*(i<=.0031308?12.92*i:1.055*Math.pow(i,1/2.4)-.055)}function jo(i){return(i/=255)<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4)}function Jl(i){let t=jo(i.r),r=jo(i.g),o=jo(i.b),u=Vo((.4124564*t+.3575761*r+.1804375*o)/No),f=Vo((.2126729*t+.7151522*r+.072175*o)/1);return{l:116*f-16,a:500*(u-f),b:200*(f-Vo((.0193339*t+.119192*r+.9503041*o)/Kl)),alpha:i.a}}function $e(i){let t=(i.l+16)/116,r=isNaN(i.a)?t:t+i.a/500,o=isNaN(i.b)?t:t-i.b/200;return t=1*Go(t),r=No*Go(r),o=Kl*Go(o),new P(qo(3.2404542*r-1.5371385*t-.4985314*o),qo(-.969266*r+1.8760108*t+.041556*o),qo(.0556434*r-.2040259*t+1.0572252*o),i.alpha)}function Dc(i,t,r){let o=t-i;return i+r*(o>180||o<-180?o-360*Math.round(o/360):o)}let Hs={forward:Jl,reverse:$e,interpolate:function(i,t,r){return{l:Ai(i.l,t.l,r),a:Ai(i.a,t.a,r),b:Ai(i.b,t.b,r),alpha:Ai(i.alpha,t.alpha,r)}}},Xs={forward:function(i){let{l:t,a:r,b:o}=Jl(i),u=Math.atan2(o,r)*Lc;return{h:u<0?u+360:u,c:Math.sqrt(r*r+o*o),l:t,alpha:i.a}},reverse:function(i){let t=i.h*kc,r=i.c;return $e({l:i.l,a:Math.cos(t)*r,b:Math.sin(t)*r,alpha:i.alpha})},interpolate:function(i,t,r){return{h:Dc(i.h,t.h,r),c:Ai(i.c,t.c,r),l:Ai(i.l,t.l,r),alpha:Ai(i.alpha,t.alpha,r)}}};var Ql=Object.freeze({__proto__:null,lab:Hs,hcl:Xs});class _r{constructor(t,r,o,u,f){this.type=t,this.operator=r,this.interpolation=o,this.input=u,this.labels=[],this.outputs=[];for(let[m,x]of f)this.labels.push(m),this.outputs.push(x)}static interpolationFactor(t,r,o,u){let f=0;if(t.name==="exponential")f=$o(r,t.base,o,u);else if(t.name==="linear")f=$o(r,1,o,u);else if(t.name==="cubic-bezier"){let m=t.controlPoints;f=new T(m[0],m[1],m[2],m[3]).solve($o(r,1,o,u))}return f}static parse(t,r){let[o,u,f,...m]=t;if(!Array.isArray(u)||u.length===0)return r.error("Expected an interpolation type expression.",1);if(u[0]==="linear")u={name:"linear"};else if(u[0]==="exponential"){let E=u[1];if(typeof E!="number")return r.error("Exponential interpolation requires a numeric base.",1,1);u={name:"exponential",base:E}}else{if(u[0]!=="cubic-bezier")return r.error(`Unknown interpolation type ${String(u[0])}`,1,0);{let E=u.slice(1);if(E.length!==4||E.some(A=>typeof A!="number"||A<0||A>1))return r.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);u={name:"cubic-bezier",controlPoints:E}}}if(t.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return r.error("Expected an even number of arguments.");if(f=r.parse(f,2,Vt),!f)return null;let x=[],b=null;o==="interpolate-hcl"||o==="interpolate-lab"?b=ai:r.expectedType&&r.expectedType.kind!=="value"&&(b=r.expectedType);for(let E=0;E<m.length;E+=2){let A=m[E],z=m[E+1],R=E+3,O=E+4;if(typeof A!="number")return r.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',R);if(x.length&&x[x.length-1][0]>=A)return r.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',R);let G=r.parse(z,O,b);if(!G)return null;b=b||G.type,x.push([A,G])}return b.kind==="number"||b.kind==="color"||b.kind==="array"&&b.itemType.kind==="number"&&typeof b.N=="number"?new _r(b,o,u,f,x):r.error(`Type ${He(b)} is not interpolatable.`)}evaluate(t){let r=this.labels,o=this.outputs;if(r.length===1)return o[0].evaluate(t);let u=this.input.evaluate(t);if(u<=r[0])return o[0].evaluate(t);let f=r.length;if(u>=r[f-1])return o[f-1].evaluate(t);let m=Ia(r,u),x=_r.interpolationFactor(this.interpolation,u,r[m],r[m+1]),b=o[m].evaluate(t),E=o[m+1].evaluate(t);return this.operator==="interpolate"?Zs[this.type.kind.toLowerCase()](b,E,x):this.operator==="interpolate-hcl"?Xs.reverse(Xs.interpolate(Xs.forward(b),Xs.forward(E),x)):Hs.reverse(Hs.interpolate(Hs.forward(b),Hs.forward(E),x))}eachChild(t){t(this.input);for(let r of this.outputs)t(r)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}serialize(){let t;t=this.interpolation.name==="linear"?["linear"]:this.interpolation.name==="exponential"?this.interpolation.base===1?["linear"]:["exponential",this.interpolation.base]:["cubic-bezier"].concat(this.interpolation.controlPoints);let r=[this.operator,t,this.input.serialize()];for(let o=0;o<this.labels.length;o++)r.push(this.labels[o],this.outputs[o].serialize());return r}}function $o(i,t,r,o){let u=o-r,f=i-r;return u===0?0:t===1?f/u:(Math.pow(t,f)-1)/(Math.pow(t,u)-1)}class Aa{constructor(t,r){this.type=t,this.args=r}static parse(t,r){if(t.length<2)return r.error("Expectected at least one argument.");let o=null,u=r.expectedType;u&&u.kind!=="value"&&(o=u);let f=[];for(let x of t.slice(1)){let b=r.parse(x,1+f.length,o,void 0,{typeAnnotation:"omit"});if(!b)return null;o=o||b.type,f.push(b)}let m=u&&f.some(x=>yr(u,x.type));return new Aa(m?_e:o,f)}evaluate(t){let r,o=null,u=0;for(let f of this.args)if(u++,o=f.evaluate(t),o&&o instanceof at&&!o.available&&(r||(r=o.name),o=null,u===this.args.length&&(o=r)),o!==null)break;return o}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}serialize(){let t=["coalesce"];return this.eachChild(r=>{t.push(r.serialize())}),t}}class Pa{constructor(t,r){this.type=r.type,this.bindings=[].concat(t),this.result=r}evaluate(t){return this.result.evaluate(t)}eachChild(t){for(let r of this.bindings)t(r[1]);t(this.result)}static parse(t,r){if(t.length<4)return r.error(`Expected at least 3 arguments, but found ${t.length-1} instead.`);let o=[];for(let f=1;f<t.length-1;f+=2){let m=t[f];if(typeof m!="string")return r.error(`Expected string, but found ${typeof m} instead.`,f);if(/[^a-zA-Z0-9_]/.test(m))return r.error("Variable names must contain only alphanumeric characters or '_'.",f);let x=r.parse(t[f+1],f+1);if(!x)return null;o.push([m,x])}let u=r.parse(t[t.length-1],t.length-1,r.expectedType,o);return u?new Pa(o,u):null}outputDefined(){return this.result.outputDefined()}serialize(){let t=["let"];for(let[r,o]of this.bindings)t.push(r,o.serialize());return t.push(this.result.serialize()),t}}class Wo{constructor(t,r,o){this.type=t,this.index=r,this.input=o}static parse(t,r){if(t.length!==3)return r.error(`Expected 2 arguments, but found ${t.length-1} instead.`);let o=r.parse(t[1],1,Vt),u=r.parse(t[2],2,ri(r.expectedType||_e));return o&&u?new Wo(u.type.itemType,o,u):null}evaluate(t){let r=this.index.evaluate(t),o=this.input.evaluate(t);if(r<0)throw new wt(`Array index out of bounds: ${r} < 0.`);if(r>=o.length)throw new wt(`Array index out of bounds: ${r} > ${o.length-1}.`);if(r!==Math.floor(r))throw new wt(`Array index must be an integer, but found ${r} instead.`);return o[r]}eachChild(t){t(this.index),t(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}}class Zo{constructor(t,r){this.type=ce,this.needle=t,this.haystack=r}static parse(t,r){if(t.length!==3)return r.error(`Expected 2 arguments, but found ${t.length-1} instead.`);let o=r.parse(t[1],1,_e),u=r.parse(t[2],2,_e);return o&&u?gi(o.type,[ce,ge,Vt,Pe,_e])?new Zo(o,u):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${He(o.type)} instead`):null}evaluate(t){let r=this.needle.evaluate(t),o=this.haystack.evaluate(t);if(!o)return!1;if(!Zr(r,["boolean","string","number","null"]))throw new wt(`Expected first argument to be of type boolean, string, number or null, but found ${He(ot(r))} instead.`);if(!Zr(o,["string","array"]))throw new wt(`Expected second argument to be of type array or string, but found ${He(ot(o))} instead.`);return o.indexOf(r)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize()]}}class za{constructor(t,r,o){this.type=Vt,this.needle=t,this.haystack=r,this.fromIndex=o}static parse(t,r){if(t.length<=2||t.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);let o=r.parse(t[1],1,_e),u=r.parse(t[2],2,_e);if(!o||!u)return null;if(!gi(o.type,[ce,ge,Vt,Pe,_e]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${He(o.type)} instead`);if(t.length===4){let f=r.parse(t[3],3,Vt);return f?new za(o,u,f):null}return new za(o,u)}evaluate(t){let r=this.needle.evaluate(t),o=this.haystack.evaluate(t);if(!Zr(r,["boolean","string","number","null"]))throw new wt(`Expected first argument to be of type boolean, string, number or null, but found ${He(ot(r))} instead.`);if(!Zr(o,["string","array"]))throw new wt(`Expected second argument to be of type array or string, but found ${He(ot(o))} instead.`);if(this.fromIndex){let u=this.fromIndex.evaluate(t);return o.indexOf(r,u)}return o.indexOf(r)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}serialize(){if(this.fromIndex!=null&&this.fromIndex!==void 0){let t=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),t]}return["index-of",this.needle.serialize(),this.haystack.serialize()]}}class Ho{constructor(t,r,o,u,f,m){this.inputType=t,this.type=r,this.input=o,this.cases=u,this.outputs=f,this.otherwise=m}static parse(t,r){if(t.length<5)return r.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if(t.length%2!=1)return r.error("Expected an even number of arguments.");let o,u;r.expectedType&&r.expectedType.kind!=="value"&&(u=r.expectedType);let f={},m=[];for(let E=2;E<t.length-1;E+=2){let A=t[E],z=t[E+1];Array.isArray(A)||(A=[A]);let R=r.concat(E);if(A.length===0)return R.error("Expected at least one branch label.");for(let G of A){if(typeof G!="number"&&typeof G!="string")return R.error("Branch labels must be numbers or strings.");if(typeof G=="number"&&Math.abs(G)>Number.MAX_SAFE_INTEGER)return R.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof G=="number"&&Math.floor(G)!==G)return R.error("Numeric branch labels must be integer values.");if(o){if(R.checkSubtype(o,ot(G)))return null}else o=ot(G);if(f[String(G)]!==void 0)return R.error("Branch labels must be unique.");f[String(G)]=m.length}let O=r.parse(z,E,u);if(!O)return null;u=u||O.type,m.push(O)}let x=r.parse(t[1],1,_e);if(!x)return null;let b=r.parse(t[t.length-1],t.length-1,u);return b?x.type.kind!=="value"&&r.concat(1).checkSubtype(o,x.type)?null:new Ho(o,u,x,f,m,b):null}evaluate(t){let r=this.input.evaluate(t);return(ot(r)===this.inputType&&this.outputs[this.cases[r]]||this.otherwise).evaluate(t)}eachChild(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)}outputDefined(){return this.outputs.every(t=>t.outputDefined())&&this.otherwise.outputDefined()}serialize(){let t=["match",this.input.serialize()],r=Object.keys(this.cases).sort(),o=[],u={};for(let m of r){let x=u[this.cases[m]];x===void 0?(u[this.cases[m]]=o.length,o.push([this.cases[m],[m]])):o[x][1].push(m)}let f=m=>this.inputType.kind==="number"?Number(m):m;for(let[m,x]of o)t.push(x.length===1?f(x[0]):x.map(f)),t.push(this.outputs[m].serialize());return t.push(this.otherwise.serialize()),t}}class Xo{constructor(t,r,o){this.type=t,this.branches=r,this.otherwise=o}static parse(t,r){if(t.length<4)return r.error(`Expected at least 3 arguments, but found only ${t.length-1}.`);if(t.length%2!=0)return r.error("Expected an odd number of arguments.");let o;r.expectedType&&r.expectedType.kind!=="value"&&(o=r.expectedType);let u=[];for(let m=1;m<t.length-1;m+=2){let x=r.parse(t[m],m,ce);if(!x)return null;let b=r.parse(t[m+1],m+1,o);if(!b)return null;u.push([x,b]),o=o||b.type}let f=r.parse(t[t.length-1],t.length-1,o);return f?new Xo(o,u,f):null}evaluate(t){for(let[r,o]of this.branches)if(r.evaluate(t))return o.evaluate(t);return this.otherwise.evaluate(t)}eachChild(t){for(let[r,o]of this.branches)t(r),t(o);t(this.otherwise)}outputDefined(){return this.branches.every(([t,r])=>r.outputDefined())&&this.otherwise.outputDefined()}serialize(){let t=["case"];return this.eachChild(r=>{t.push(r.serialize())}),t}}class ka{constructor(t,r,o,u){this.type=t,this.input=r,this.beginIndex=o,this.endIndex=u}static parse(t,r){if(t.length<=2||t.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);let o=r.parse(t[1],1,_e),u=r.parse(t[2],2,Vt);if(!o||!u)return null;if(!gi(o.type,[ri(_e),ge,_e]))return r.error(`Expected first argument to be of type array or string, but found ${He(o.type)} instead`);if(t.length===4){let f=r.parse(t[3],3,Vt);return f?new ka(o.type,o,u,f):null}return new ka(o.type,o,u)}evaluate(t){let r=this.input.evaluate(t),o=this.beginIndex.evaluate(t);if(!Zr(r,["string","array"]))throw new wt(`Expected first argument to be of type array or string, but found ${He(ot(r))} instead.`);if(this.endIndex){let u=this.endIndex.evaluate(t);return r.slice(o,u)}return r.slice(o)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}serialize(){if(this.endIndex!=null&&this.endIndex!==void 0){let t=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),t]}return["slice",this.input.serialize(),this.beginIndex.serialize()]}}function th(i,t){return i==="=="||i==="!="?t.kind==="boolean"||t.kind==="string"||t.kind==="number"||t.kind==="null"||t.kind==="value":t.kind==="string"||t.kind==="number"||t.kind==="value"}function eh(i,t,r,o){return o.compare(t,r)===0}function gs(i,t,r){let o=i!=="=="&&i!=="!=";return class hg{constructor(f,m,x){this.type=ce,this.lhs=f,this.rhs=m,this.collator=x,this.hasUntypedArgument=f.type.kind==="value"||m.type.kind==="value"}static parse(f,m){if(f.length!==3&&f.length!==4)return m.error("Expected two or three arguments.");let x=f[0],b=m.parse(f[1],1,_e);if(!b)return null;if(!th(x,b.type))return m.concat(1).error(`"${x}" comparisons are not supported for type '${He(b.type)}'.`);let E=m.parse(f[2],2,_e);if(!E)return null;if(!th(x,E.type))return m.concat(2).error(`"${x}" comparisons are not supported for type '${He(E.type)}'.`);if(b.type.kind!==E.type.kind&&b.type.kind!=="value"&&E.type.kind!=="value")return m.error(`Cannot compare types '${He(b.type)}' and '${He(E.type)}'.`);o&&(b.type.kind==="value"&&E.type.kind!=="value"?b=new Jt(E.type,[b]):b.type.kind!=="value"&&E.type.kind==="value"&&(E=new Jt(b.type,[E])));let A=null;if(f.length===4){if(b.type.kind!=="string"&&E.type.kind!=="string"&&b.type.kind!=="value"&&E.type.kind!=="value")return m.error("Cannot use collator to compare non-string types.");if(A=m.parse(f[3],3,ir),!A)return null}return new hg(b,E,A)}evaluate(f){let m=this.lhs.evaluate(f),x=this.rhs.evaluate(f);if(o&&this.hasUntypedArgument){let b=ot(m),E=ot(x);if(b.kind!==E.kind||b.kind!=="string"&&b.kind!=="number")throw new wt(`Expected arguments for "${i}" to be (string, string) or (number, number), but found (${b.kind}, ${E.kind}) instead.`)}if(this.collator&&!o&&this.hasUntypedArgument){let b=ot(m),E=ot(x);if(b.kind!=="string"||E.kind!=="string")return t(f,m,x)}return this.collator?r(f,m,x,this.collator.evaluate(f)):t(f,m,x)}eachChild(f){f(this.lhs),f(this.rhs),this.collator&&f(this.collator)}outputDefined(){return!0}serialize(){let f=[i];return this.eachChild(m=>{f.push(m.serialize())}),f}}}let Rc=gs("==",function(i,t,r){return t===r},eh),Bc=gs("!=",function(i,t,r){return t!==r},function(i,t,r,o){return!eh(0,t,r,o)}),Fc=gs("<",function(i,t,r){return t<r},function(i,t,r,o){return o.compare(t,r)<0}),Oc=gs(">",function(i,t,r){return t>r},function(i,t,r,o){return o.compare(t,r)>0}),Nc=gs("<=",function(i,t,r){return t<=r},function(i,t,r,o){return o.compare(t,r)<=0}),Uc=gs(">=",function(i,t,r){return t>=r},function(i,t,r,o){return o.compare(t,r)>=0});class Ko{constructor(t,r,o,u,f){this.type=ge,this.number=t,this.locale=r,this.currency=o,this.minFractionDigits=u,this.maxFractionDigits=f}static parse(t,r){if(t.length!==3)return r.error("Expected two arguments.");let o=r.parse(t[1],1,Vt);if(!o)return null;let u=t[2];if(typeof u!="object"||Array.isArray(u))return r.error("NumberFormat options argument must be an object.");let f=null;if(u.locale&&(f=r.parse(u.locale,1,ge),!f))return null;let m=null;if(u.currency&&(m=r.parse(u.currency,1,ge),!m))return null;let x=null;if(u["min-fraction-digits"]&&(x=r.parse(u["min-fraction-digits"],1,Vt),!x))return null;let b=null;return u["max-fraction-digits"]&&(b=r.parse(u["max-fraction-digits"],1,Vt),!b)?null:new Ko(o,f,m,x,b)}evaluate(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))}eachChild(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)}outputDefined(){return!1}serialize(){let t={};return this.locale&&(t.locale=this.locale.serialize()),this.currency&&(t.currency=this.currency.serialize()),this.minFractionDigits&&(t["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(t["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),t]}}class Yo{constructor(t){this.type=Vt,this.input=t}static parse(t,r){if(t.length!==2)return r.error(`Expected 1 argument, but found ${t.length-1} instead.`);let o=r.parse(t[1],1);return o?o.type.kind!=="array"&&o.type.kind!=="string"&&o.type.kind!=="value"?r.error(`Expected argument of type string or array, but found ${He(o.type)} instead.`):new Yo(o):null}evaluate(t){let r=this.input.evaluate(t);if(typeof r=="string"||Array.isArray(r))return r.length;throw new wt(`Expected value to be of type string or array, but found ${He(ot(r))} instead.`)}eachChild(t){t(this.input)}outputDefined(){return!1}serialize(){let t=["length"];return this.eachChild(r=>{t.push(r.serialize())}),t}}let ys={"==":Rc,"!=":Bc,">":Oc,"<":Fc,">=":Uc,"<=":Nc,array:Jt,at:Wo,boolean:Jt,case:Xo,coalesce:Aa,collator:wi,format:ae,image:pe,in:Zo,"index-of":za,interpolate:_r,"interpolate-hcl":_r,"interpolate-lab":_r,length:Yo,let:Pa,literal:Lt,match:Ho,number:Jt,"number-format":Ko,object:Jt,slice:ka,step:Ws,string:Jt,"to-boolean":De,"to-color":De,"to-number":De,"to-string":De,var:Ta,within:Fn};function ih(i,[t,r,o,u]){t=t.evaluate(i),r=r.evaluate(i),o=o.evaluate(i);let f=u?u.evaluate(i):1,m=rt(t,r,o,f);if(m)throw new wt(m);return new P(t/255*f,r/255*f,o/255*f,f)}function rh(i,t){return i in t}function Jo(i,t){let r=t[i];return r===void 0?null:r}function On(i){return{type:i}}function nh(i){return{result:"success",value:i}}function Nn(i){return{result:"error",value:i}}function _s(i){return i["property-type"]==="data-driven"||i["property-type"]==="cross-faded-data-driven"}function sh(i){return!!i.expression&&i.expression.parameters.indexOf("zoom")>-1}function Qo(i){return!!i.expression&&i.expression.interpolated}function Me(i){return i instanceof Number?"number":i instanceof String?"string":i instanceof Boolean?"boolean":Array.isArray(i)?"array":i===null?"null":typeof i}function La(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)}function Ye(i){return i}function Da(i,t){let r=t.type==="color",o=i.stops&&typeof i.stops[0][0]=="object",u=o||!(o||i.property!==void 0),f=i.type||(Qo(t)?"exponential":"interval");if(r&&((i=Ie({},i)).stops&&(i.stops=i.stops.map(E=>[E[0],P.parse(E[1])])),i.default=P.parse(i.default?i.default:t.default)),i.colorSpace&&i.colorSpace!=="rgb"&&!Ql[i.colorSpace])throw new Error(`Unknown color space: ${i.colorSpace}`);let m,x,b;if(f==="exponential")m=tl;else if(f==="interval")m=Ra;else if(f==="categorical"){m=vi,x=Object.create(null);for(let E of i.stops)x[E[0]]=E[1];b=typeof i.stops[0][0]}else{if(f!=="identity")throw new Error(`Unknown function type "${f}"`);m=Vc}if(o){let E={},A=[];for(let O=0;O<i.stops.length;O++){let G=i.stops[O],et=G[0].zoom;E[et]===void 0&&(E[et]={zoom:et,type:i.type,property:i.property,default:i.default,stops:[]},A.push(et)),E[et].stops.push([G[0].value,G[1]])}let z=[];for(let O of A)z.push([E[O].zoom,Da(E[O],t)]);let R={name:"linear"};return{kind:"composite",interpolationType:R,interpolationFactor:_r.interpolationFactor.bind(void 0,R),zoomStops:z.map(O=>O[0]),evaluate:({zoom:O},G)=>tl({stops:z,base:i.base},t,O).evaluate(O,G)}}if(u){let E=f==="exponential"?{name:"exponential",base:i.base!==void 0?i.base:1}:null;return{kind:"camera",interpolationType:E,interpolationFactor:_r.interpolationFactor.bind(void 0,E),zoomStops:i.stops.map(A=>A[0]),evaluate:({zoom:A})=>m(i,t,A,x,b)}}return{kind:"source",evaluate(E,A){let z=A&&A.properties?A.properties[i.property]:void 0;return z===void 0?li(i.default,t.default):m(i,t,z,x,b)}}}function li(i,t,r){return i!==void 0?i:t!==void 0?t:r!==void 0?r:void 0}function vi(i,t,r,o,u){return li(typeof r===u?o[r]:void 0,i.default,t.default)}function Ra(i,t,r){if(Me(r)!=="number")return li(i.default,t.default);let o=i.stops.length;if(o===1||r<=i.stops[0][0])return i.stops[0][1];if(r>=i.stops[o-1][0])return i.stops[o-1][1];let u=Ia(i.stops.map(f=>f[0]),r);return i.stops[u][1]}function tl(i,t,r){let o=i.base!==void 0?i.base:1;if(Me(r)!=="number")return li(i.default,t.default);let u=i.stops.length;if(u===1||r<=i.stops[0][0])return i.stops[0][1];if(r>=i.stops[u-1][0])return i.stops[u-1][1];let f=Ia(i.stops.map(A=>A[0]),r),m=function(A,z,R,O){let G=O-R,et=A-R;return G===0?0:z===1?et/G:(Math.pow(z,et)-1)/(Math.pow(z,G)-1)}(r,o,i.stops[f][0],i.stops[f+1][0]),x=i.stops[f][1],b=i.stops[f+1][1],E=Zs[t.type]||Ye;if(i.colorSpace&&i.colorSpace!=="rgb"){let A=Ql[i.colorSpace];E=(z,R)=>A.reverse(A.interpolate(A.forward(z),A.forward(R),m))}return typeof x.evaluate=="function"?{evaluate(...A){let z=x.evaluate.apply(void 0,A),R=b.evaluate.apply(void 0,A);if(z!==void 0&&R!==void 0)return E(z,R,m)}}:E(x,b,m)}function Vc(i,t,r){return t.type==="color"?r=P.parse(r):t.type==="formatted"?r=Y.fromString(r.toString()):t.type==="resolvedImage"?r=at.fromString(r.toString()):Me(r)===t.type||t.type==="enum"&&t.values[r]||(r=void 0),li(r,i.default,t.default)}Se.register(ys,{error:[{kind:"error"},[ge],(i,[t])=>{throw new wt(t.evaluate(i))}],typeof:[ge,[_e],(i,[t])=>He(ot(t.evaluate(i)))],"to-rgba":[ri(Vt,4),[ai],(i,[t])=>t.evaluate(i).toArray()],rgb:[ai,[Vt,Vt,Vt],ih],rgba:[ai,[Vt,Vt,Vt,Vt],ih],has:{type:ce,overloads:[[[ge],(i,[t])=>rh(t.evaluate(i),i.properties())],[[ge,$i],(i,[t,r])=>rh(t.evaluate(i),r.evaluate(i))]]},get:{type:_e,overloads:[[[ge],(i,[t])=>Jo(t.evaluate(i),i.properties())],[[ge,$i],(i,[t,r])=>Jo(t.evaluate(i),r.evaluate(i))]]},"feature-state":[_e,[ge],(i,[t])=>Jo(t.evaluate(i),i.featureState||{})],properties:[$i,[],i=>i.properties()],"geometry-type":[ge,[],i=>i.geometryType()],id:[_e,[],i=>i.id()],zoom:[Vt,[],i=>i.globals.zoom],"heatmap-density":[Vt,[],i=>i.globals.heatmapDensity||0],"line-progress":[Vt,[],i=>i.globals.lineProgress||0],accumulated:[_e,[],i=>i.globals.accumulated===void 0?null:i.globals.accumulated],"+":[Vt,On(Vt),(i,t)=>{let r=0;for(let o of t)r+=o.evaluate(i);return r}],"*":[Vt,On(Vt),(i,t)=>{let r=1;for(let o of t)r*=o.evaluate(i);return r}],"-":{type:Vt,overloads:[[[Vt,Vt],(i,[t,r])=>t.evaluate(i)-r.evaluate(i)],[[Vt],(i,[t])=>-t.evaluate(i)]]},"/":[Vt,[Vt,Vt],(i,[t,r])=>t.evaluate(i)/r.evaluate(i)],"%":[Vt,[Vt,Vt],(i,[t,r])=>t.evaluate(i)%r.evaluate(i)],ln2:[Vt,[],()=>Math.LN2],pi:[Vt,[],()=>Math.PI],e:[Vt,[],()=>Math.E],"^":[Vt,[Vt,Vt],(i,[t,r])=>Math.pow(t.evaluate(i),r.evaluate(i))],sqrt:[Vt,[Vt],(i,[t])=>Math.sqrt(t.evaluate(i))],log10:[Vt,[Vt],(i,[t])=>Math.log(t.evaluate(i))/Math.LN10],ln:[Vt,[Vt],(i,[t])=>Math.log(t.evaluate(i))],log2:[Vt,[Vt],(i,[t])=>Math.log(t.evaluate(i))/Math.LN2],sin:[Vt,[Vt],(i,[t])=>Math.sin(t.evaluate(i))],cos:[Vt,[Vt],(i,[t])=>Math.cos(t.evaluate(i))],tan:[Vt,[Vt],(i,[t])=>Math.tan(t.evaluate(i))],asin:[Vt,[Vt],(i,[t])=>Math.asin(t.evaluate(i))],acos:[Vt,[Vt],(i,[t])=>Math.acos(t.evaluate(i))],atan:[Vt,[Vt],(i,[t])=>Math.atan(t.evaluate(i))],min:[Vt,On(Vt),(i,t)=>Math.min(...t.map(r=>r.evaluate(i)))],max:[Vt,On(Vt),(i,t)=>Math.max(...t.map(r=>r.evaluate(i)))],abs:[Vt,[Vt],(i,[t])=>Math.abs(t.evaluate(i))],round:[Vt,[Vt],(i,[t])=>{let r=t.evaluate(i);return r<0?-Math.round(-r):Math.round(r)}],floor:[Vt,[Vt],(i,[t])=>Math.floor(t.evaluate(i))],ceil:[Vt,[Vt],(i,[t])=>Math.ceil(t.evaluate(i))],"filter-==":[ce,[ge,_e],(i,[t,r])=>i.properties()[t.value]===r.value],"filter-id-==":[ce,[_e],(i,[t])=>i.id()===t.value],"filter-type-==":[ce,[ge],(i,[t])=>i.geometryType()===t.value],"filter-<":[ce,[ge,_e],(i,[t,r])=>{let o=i.properties()[t.value],u=r.value;return typeof o==typeof u&&o<u}],"filter-id-<":[ce,[_e],(i,[t])=>{let r=i.id(),o=t.value;return typeof r==typeof o&&r<o}],"filter->":[ce,[ge,_e],(i,[t,r])=>{let o=i.properties()[t.value],u=r.value;return typeof o==typeof u&&o>u}],"filter-id->":[ce,[_e],(i,[t])=>{let r=i.id(),o=t.value;return typeof r==typeof o&&r>o}],"filter-<=":[ce,[ge,_e],(i,[t,r])=>{let o=i.properties()[t.value],u=r.value;return typeof o==typeof u&&o<=u}],"filter-id-<=":[ce,[_e],(i,[t])=>{let r=i.id(),o=t.value;return typeof r==typeof o&&r<=o}],"filter->=":[ce,[ge,_e],(i,[t,r])=>{let o=i.properties()[t.value],u=r.value;return typeof o==typeof u&&o>=u}],"filter-id->=":[ce,[_e],(i,[t])=>{let r=i.id(),o=t.value;return typeof r==typeof o&&r>=o}],"filter-has":[ce,[_e],(i,[t])=>t.value in i.properties()],"filter-has-id":[ce,[],i=>i.id()!==null&&i.id()!==void 0],"filter-type-in":[ce,[ri(ge)],(i,[t])=>t.value.indexOf(i.geometryType())>=0],"filter-id-in":[ce,[ri(_e)],(i,[t])=>t.value.indexOf(i.id())>=0],"filter-in-small":[ce,[ge,ri(_e)],(i,[t,r])=>r.value.indexOf(i.properties()[t.value])>=0],"filter-in-large":[ce,[ge,ri(_e)],(i,[t,r])=>function(o,u,f,m){for(;f<=m;){let x=f+m>>1;if(u[x]===o)return!0;u[x]>o?m=x-1:f=x+1}return!1}(i.properties()[t.value],r.value,0,r.value.length-1)],all:{type:ce,overloads:[[[ce,ce],(i,[t,r])=>t.evaluate(i)&&r.evaluate(i)],[On(ce),(i,t)=>{for(let r of t)if(!r.evaluate(i))return!1;return!0}]]},any:{type:ce,overloads:[[[ce,ce],(i,[t,r])=>t.evaluate(i)||r.evaluate(i)],[On(ce),(i,t)=>{for(let r of t)if(r.evaluate(i))return!0;return!1}]]},"!":[ce,[ce],(i,[t])=>!t.evaluate(i)],"is-supported-script":[ce,[ge],(i,[t])=>{let r=i.globals&&i.globals.isSupportedScript;return!r||r(t.evaluate(i))}],upcase:[ge,[ge],(i,[t])=>t.evaluate(i).toUpperCase()],downcase:[ge,[ge],(i,[t])=>t.evaluate(i).toLowerCase()],concat:[ge,On(_e),(i,t)=>t.map(r=>St(r.evaluate(i))).join("")],"resolved-locale":[ge,[ir],(i,[t])=>t.evaluate(i).resolvedLocale()]});class el{constructor(t,r){this.expression=t,this._warningHistory={},this._evaluator=new Ee,this._defaultValue=r?function(o){return o.type==="color"&&La(o.default)?new P(0,0,0,0):o.type==="color"?P.parse(o.default)||null:o.default===void 0?null:o.default}(r):null,this._enumValues=r&&r.type==="enum"?r.values:null}evaluateWithoutErrorHandling(t,r,o,u,f,m){return this._evaluator.globals=t,this._evaluator.feature=r,this._evaluator.featureState=o,this._evaluator.canonical=u,this._evaluator.availableImages=f||null,this._evaluator.formattedSection=m,this.expression.evaluate(this._evaluator)}evaluate(t,r,o,u,f,m){this._evaluator.globals=t,this._evaluator.feature=r||null,this._evaluator.featureState=o||null,this._evaluator.canonical=u,this._evaluator.availableImages=f||null,this._evaluator.formattedSection=m||null;try{let x=this.expression.evaluate(this._evaluator);if(x==null||typeof x=="number"&&x!=x)return this._defaultValue;if(this._enumValues&&!(x in this._enumValues))throw new wt(`Expected value to be one of ${Object.keys(this._enumValues).map(b=>JSON.stringify(b)).join(", ")}, but found ${JSON.stringify(x)} instead.`);return x}catch(x){return this._warningHistory[x.message]||(this._warningHistory[x.message]=!0,typeof console<"u"&&console.warn(x.message)),this._defaultValue}}}function Ba(i){return Array.isArray(i)&&i.length>0&&typeof i[0]=="string"&&i[0]in ys}function Fa(i,t){let r=new Ea(ys,[],t?function(u){let f={color:ai,string:ge,number:Vt,enum:ge,boolean:ce,formatted:mi,resolvedImage:rr};return u.type==="array"?ri(f[u.value]||_e,u.length):f[u.type]}(t):void 0),o=r.parse(i,void 0,void 0,void 0,t&&t.type==="string"?{typeAnnotation:"coerce"}:void 0);return o?nh(new el(o,t)):Nn(r.errors)}class Oa{constructor(t,r){this.kind=t,this._styleExpression=r,this.isStateDependent=t!=="constant"&&!ms(r.expression)}evaluateWithoutErrorHandling(t,r,o,u,f,m){return this._styleExpression.evaluateWithoutErrorHandling(t,r,o,u,f,m)}evaluate(t,r,o,u,f,m){return this._styleExpression.evaluate(t,r,o,u,f,m)}}class Na{constructor(t,r,o,u){this.kind=t,this.zoomStops=o,this._styleExpression=r,this.isStateDependent=t!=="camera"&&!ms(r.expression),this.interpolationType=u}evaluateWithoutErrorHandling(t,r,o,u,f,m){return this._styleExpression.evaluateWithoutErrorHandling(t,r,o,u,f,m)}evaluate(t,r,o,u,f,m){return this._styleExpression.evaluate(t,r,o,u,f,m)}interpolationFactor(t,r,o){return this.interpolationType?_r.interpolationFactor(this.interpolationType,t,r,o):0}}function il(i,t){let r=Fa(i,t);if(r.result==="error")return r;let o=r.value.expression,u=Sa(o);if(!u&&!_s(t))return Nn([new Ce("","data expressions not supported")]);let f=js(o,["zoom"]);if(!f&&!sh(t))return Nn([new Ce("","zoom expressions not supported")]);let m=Ua(o);return m||f?m instanceof Ce?Nn([m]):m instanceof _r&&!Qo(t)?Nn([new Ce("",'"interpolate" expressions cannot be used with this property')]):nh(m?new Na(u?"camera":"composite",r.value,m.labels,m instanceof _r?m.interpolation:void 0):new Oa(u?"constant":"source",r.value)):Nn([new Ce("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class xs{constructor(t,r){this._parameters=t,this._specification=r,Ie(this,Da(this._parameters,this._specification))}static deserialize(t){return new xs(t._parameters,t._specification)}static serialize(t){return{_parameters:t._parameters,_specification:t._specification}}}function Ua(i){let t=null;if(i instanceof Pa)t=Ua(i.result);else if(i instanceof Aa){for(let r of i.args)if(t=Ua(r),t)break}else(i instanceof Ws||i instanceof _r)&&i.input instanceof Se&&i.input.name==="zoom"&&(t=i);return t instanceof Ce||i.eachChild(r=>{let o=Ua(r);o instanceof Ce?t=o:!t&&o?t=new Ce("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):t&&o&&t!==o&&(t=new Ce("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),t}function Xr(i){let t=i.key,r=i.value,o=i.valueSpec||{},u=i.objectElementValidators||{},f=i.style,m=i.styleSpec,x=[],b=Me(r);if(b!=="object")return[new Ct(t,r,`object expected, ${b} found`)];for(let E in r){let A=E.split(".")[0],z=o[A]||o["*"],R;if(u[A])R=u[A];else if(o[A])R=lr;else if(u["*"])R=u["*"];else{if(!o["*"]){x.push(new Ct(t,r[E],`unknown property "${E}"`));continue}R=lr}x=x.concat(R({key:(t&&`${t}.`)+E,value:r[E],valueSpec:z,style:f,styleSpec:m,object:r,objectKey:E},r))}for(let E in o)u[E]||o[E].required&&o[E].default===void 0&&r[E]===void 0&&x.push(new Ct(t,r,`missing required property "${E}"`));return x}function ah(i){let t=i.value,r=i.valueSpec,o=i.style,u=i.styleSpec,f=i.key,m=i.arrayElementValidator||lr;if(Me(t)!=="array")return[new Ct(f,t,`array expected, ${Me(t)} found`)];if(r.length&&t.length!==r.length)return[new Ct(f,t,`array length ${r.length} expected, length ${t.length} found`)];if(r["min-length"]&&t.length<r["min-length"])return[new Ct(f,t,`array length at least ${r["min-length"]} expected, length ${t.length} found`)];let x={type:r.value,values:r.values};u.$version<7&&(x.function=r.function),Me(r.value)==="object"&&(x=r.value);let b=[];for(let E=0;E<t.length;E++)b=b.concat(m({array:t,arrayIndex:E,value:t[E],valueSpec:x,style:o,styleSpec:u,key:`${f}[${E}]`}));return b}function oh(i){let t=i.key,r=i.value,o=i.valueSpec,u=Me(r);return u==="number"&&r!=r&&(u="NaN"),u!=="number"?[new Ct(t,r,`number expected, ${u} found`)]:"minimum"in o&&r<o.minimum?[new Ct(t,r,`${r} is less than the minimum value ${o.minimum}`)]:"maximum"in o&&r>o.maximum?[new Ct(t,r,`${r} is greater than the maximum value ${o.maximum}`)]:[]}function lh(i){let t=i.valueSpec,r=oe(i.value.type),o,u,f,m={},x=r!=="categorical"&&i.value.property===void 0,b=!x,E=Me(i.value.stops)==="array"&&Me(i.value.stops[0])==="array"&&Me(i.value.stops[0][0])==="object",A=Xr({key:i.key,value:i.value,valueSpec:i.styleSpec.function,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{stops:function(O){if(r==="identity")return[new Ct(O.key,O.value,'identity function may not have a "stops" property')];let G=[],et=O.value;return G=G.concat(ah({key:O.key,value:et,valueSpec:O.valueSpec,style:O.style,styleSpec:O.styleSpec,arrayElementValidator:z})),Me(et)==="array"&&et.length===0&&G.push(new Ct(O.key,et,"array must have at least one stop")),G},default:function(O){return lr({key:O.key,value:O.value,valueSpec:t,style:O.style,styleSpec:O.styleSpec})}}});return r==="identity"&&x&&A.push(new Ct(i.key,i.value,'missing required property "property"')),r==="identity"||i.value.stops||A.push(new Ct(i.key,i.value,'missing required property "stops"')),r==="exponential"&&i.valueSpec.expression&&!Qo(i.valueSpec)&&A.push(new Ct(i.key,i.value,"exponential functions not supported")),i.styleSpec.$version>=8&&(b&&!_s(i.valueSpec)?A.push(new Ct(i.key,i.value,"property functions not supported")):x&&!sh(i.valueSpec)&&A.push(new Ct(i.key,i.value,"zoom functions not supported"))),r!=="categorical"&&!E||i.value.property!==void 0||A.push(new Ct(i.key,i.value,'"property" property is required')),A;function z(O){let G=[],et=O.value,it=O.key;if(Me(et)!=="array")return[new Ct(it,et,`array expected, ${Me(et)} found`)];if(et.length!==2)return[new Ct(it,et,`array length 2 expected, length ${et.length} found`)];if(E){if(Me(et[0])!=="object")return[new Ct(it,et,`object expected, ${Me(et[0])} found`)];if(et[0].zoom===void 0)return[new Ct(it,et,"object stop key must have zoom")];if(et[0].value===void 0)return[new Ct(it,et,"object stop key must have value")];if(f&&f>oe(et[0].zoom))return[new Ct(it,et[0].zoom,"stop zoom values must appear in ascending order")];oe(et[0].zoom)!==f&&(f=oe(et[0].zoom),u=void 0,m={}),G=G.concat(Xr({key:`${it}[0]`,value:et[0],valueSpec:{zoom:{}},style:O.style,styleSpec:O.styleSpec,objectElementValidators:{zoom:oh,value:R}}))}else G=G.concat(R({key:`${it}[0]`,value:et[0],valueSpec:{},style:O.style,styleSpec:O.styleSpec},et));return Ba(Oe(et[1]))?G.concat([new Ct(`${it}[1]`,et[1],"expressions are not allowed in function stops.")]):G.concat(lr({key:`${it}[1]`,value:et[1],valueSpec:t,style:O.style,styleSpec:O.styleSpec}))}function R(O,G){let et=Me(O.value),it=oe(O.value),dt=O.value!==null?O.value:G;if(o){if(et!==o)return[new Ct(O.key,dt,`${et} stop domain type must match previous stop domain type ${o}`)]}else o=et;if(et!=="number"&&et!=="string"&&et!=="boolean")return[new Ct(O.key,dt,"stop domain value must be a number, string, or boolean")];if(et!=="number"&&r!=="categorical"){let bt=`number expected, ${et} found`;return _s(t)&&r===void 0&&(bt+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new Ct(O.key,dt,bt)]}return r!=="categorical"||et!=="number"||isFinite(it)&&Math.floor(it)===it?r!=="categorical"&&et==="number"&&u!==void 0&&it<u?[new Ct(O.key,dt,"stop domain values must appear in ascending order")]:(u=it,r==="categorical"&&it in m?[new Ct(O.key,dt,"stop domain values must be unique")]:(m[it]=!0,[])):[new Ct(O.key,dt,`integer expected, found ${it}`)]}}function vs(i){let t=(i.expressionContext==="property"?il:Fa)(Oe(i.value),i.valueSpec);if(t.result==="error")return t.value.map(o=>new Ct(`${i.key}${o.key}`,i.value,o.message));let r=t.value.expression||t.value._styleExpression.expression;if(i.expressionContext==="property"&&i.propertyKey==="text-font"&&!r.outputDefined())return[new Ct(i.key,i.value,`Invalid data expression for "${i.propertyKey}". Output values must be contained as literals within the expression.`)];if(i.expressionContext==="property"&&i.propertyType==="layout"&&!ms(r))return[new Ct(i.key,i.value,'"feature-state" data expressions are not supported with layout properties.')];if(i.expressionContext==="filter"&&!ms(r))return[new Ct(i.key,i.value,'"feature-state" data expressions are not supported with filters.')];if(i.expressionContext&&i.expressionContext.indexOf("cluster")===0){if(!js(r,["zoom","feature-state"]))return[new Ct(i.key,i.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(i.expressionContext==="cluster-initial"&&!Sa(r))return[new Ct(i.key,i.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Va(i){let t=i.key,r=i.value,o=i.valueSpec,u=[];return Array.isArray(o.values)?o.values.indexOf(oe(r))===-1&&u.push(new Ct(t,r,`expected one of [${o.values.join(", ")}], ${JSON.stringify(r)} found`)):Object.keys(o.values).indexOf(oe(r))===-1&&u.push(new Ct(t,r,`expected one of [${Object.keys(o.values).join(", ")}], ${JSON.stringify(r)} found`)),u}function rl(i){if(i===!0||i===!1)return!0;if(!Array.isArray(i)||i.length===0)return!1;switch(i[0]){case"has":return i.length>=2&&i[1]!=="$id"&&i[1]!=="$type";case"in":return i.length>=3&&(typeof i[1]!="string"||Array.isArray(i[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return i.length!==3||Array.isArray(i[1])||Array.isArray(i[2]);case"any":case"all":for(let t of i.slice(1))if(!rl(t)&&typeof t!="boolean")return!1;return!0;default:return!0}}let hh={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Ga(i){if(i==null)return{filter:()=>!0,needGeometry:!1};rl(i)||(i=Ks(i));let t=Fa(i,hh);if(t.result==="error")throw new Error(t.value.map(r=>`${r.key}: ${r.message}`).join(", "));return{filter:(r,o,u)=>t.value.evaluate(r,o,{},u),needGeometry:ch(i)}}function qa(i,t){return i<t?-1:i>t?1:0}function ch(i){if(!Array.isArray(i))return!1;if(i[0]==="within")return!0;for(let t=1;t<i.length;t++)if(ch(i[t]))return!0;return!1}function Ks(i){if(!i)return!0;let t=i[0];return i.length<=1?t!=="any":t==="=="?nl(i[1],i[2],"=="):t==="!="?bs(nl(i[1],i[2],"==")):t==="<"||t===">"||t==="<="||t===">="?nl(i[1],i[2],t):t==="any"?(r=i.slice(1),["any"].concat(r.map(Ks))):t==="all"?["all"].concat(i.slice(1).map(Ks)):t==="none"?["all"].concat(i.slice(1).map(Ks).map(bs)):t==="in"?ja(i[1],i.slice(2)):t==="!in"?bs(ja(i[1],i.slice(2))):t==="has"?$a(i[1]):t==="!has"?bs($a(i[1])):t!=="within"||i;var r}function nl(i,t,r){switch(i){case"$type":return[`filter-type-${r}`,t];case"$id":return[`filter-id-${r}`,t];default:return[`filter-${r}`,i,t]}}function ja(i,t){if(t.length===0)return!1;switch(i){case"$type":return["filter-type-in",["literal",t]];case"$id":return["filter-id-in",["literal",t]];default:return t.length>200&&!t.some(r=>typeof r!=typeof t[0])?["filter-in-large",i,["literal",t.sort(qa)]]:["filter-in-small",i,["literal",t]]}}function $a(i){switch(i){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",i]}}function bs(i){return["!",i]}function Ys(i){return rl(Oe(i.value))?vs(Ie({},i,{expressionContext:"filter",valueSpec:{value:"boolean"}})):uh(i)}function uh(i){let t=i.value,r=i.key;if(Me(t)!=="array")return[new Ct(r,t,`array expected, ${Me(t)} found`)];let o=i.styleSpec,u,f=[];if(t.length<1)return[new Ct(r,t,"filter array must have at least 1 element")];switch(f=f.concat(Va({key:`${r}[0]`,value:t[0],valueSpec:o.filter_operator,style:i.style,styleSpec:i.styleSpec})),oe(t[0])){case"<":case"<=":case">":case">=":t.length>=2&&oe(t[1])==="$type"&&f.push(new Ct(r,t,`"$type" cannot be use with operator "${t[0]}"`));case"==":case"!=":t.length!==3&&f.push(new Ct(r,t,`filter array for operator "${t[0]}" must have 3 elements`));case"in":case"!in":t.length>=2&&(u=Me(t[1]),u!=="string"&&f.push(new Ct(`${r}[1]`,t[1],`string expected, ${u} found`)));for(let m=2;m<t.length;m++)u=Me(t[m]),oe(t[1])==="$type"?f=f.concat(Va({key:`${r}[${m}]`,value:t[m],valueSpec:o.geometry_type,style:i.style,styleSpec:i.styleSpec})):u!=="string"&&u!=="number"&&u!=="boolean"&&f.push(new Ct(`${r}[${m}]`,t[m],`string, number, or boolean expected, ${u} found`));break;case"any":case"all":case"none":for(let m=1;m<t.length;m++)f=f.concat(uh({key:`${r}[${m}]`,value:t[m],style:i.style,styleSpec:i.styleSpec}));break;case"has":case"!has":u=Me(t[1]),t.length!==2?f.push(new Ct(r,t,`filter array for "${t[0]}" operator must have 2 elements`)):u!=="string"&&f.push(new Ct(`${r}[1]`,t[1],`string expected, ${u} found`));break;case"within":u=Me(t[1]),t.length!==2?f.push(new Ct(r,t,`filter array for "${t[0]}" operator must have 2 elements`)):u!=="object"&&f.push(new Ct(`${r}[1]`,t[1],`object expected, ${u} found`))}return f}function Js(i,t){let r=i.key,o=i.style,u=i.styleSpec,f=i.value,m=i.objectKey,x=u[`${t}_${i.layerType}`];if(!x)return[];let b=m.match(/^(.*)-transition$/);if(t==="paint"&&b&&x[b[1]]&&x[b[1]].transition)return lr({key:r,value:f,valueSpec:u.transition,style:o,styleSpec:u});let E=i.valueSpec||x[m];if(!E)return[new Ct(r,f,`unknown property "${m}"`)];let A;if(Me(f)==="string"&&_s(E)&&!E.tokens&&(A=/^{([^}]+)}$/.exec(f)))return[new Ct(r,f,`"${m}" does not support interpolation syntax
|
|
3
|
+
Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(A[1])} }\`.`)];let z=[];return i.layerType==="symbol"&&(m==="text-field"&&o&&!o.glyphs&&z.push(new Ct(r,f,'use of "text-field" requires a style "glyphs" property')),m==="text-font"&&La(Oe(f))&&oe(f.type)==="identity"&&z.push(new Ct(r,f,'"text-font" does not support identity functions'))),z.concat(lr({key:i.key,value:f,valueSpec:E,style:o,styleSpec:u,expressionContext:"property",propertyType:t,propertyKey:m}))}function ph(i){return Js(i,"paint")}function dh(i){return Js(i,"layout")}function fh(i){let t=[],r=i.value,o=i.key,u=i.style,f=i.styleSpec;r.type||r.ref||t.push(new Ct(o,r,'either "type" or "ref" is required'));let m=oe(r.type),x=oe(r.ref);if(r.id){let b=oe(r.id);for(let E=0;E<i.arrayIndex;E++){let A=u.layers[E];oe(A.id)===b&&t.push(new Ct(o,r.id,`duplicate layer id "${r.id}", previously used at line ${A.id.__line__}`))}}if("ref"in r){let b;["type","source","source-layer","filter","layout"].forEach(E=>{E in r&&t.push(new Ct(o,r[E],`"${E}" is prohibited for ref layers`))}),u.layers.forEach(E=>{oe(E.id)===x&&(b=E)}),b?b.ref?t.push(new Ct(o,r.ref,"ref cannot reference another ref layer")):m=oe(b.type):t.push(new Ct(o,r.ref,`ref layer "${x}" not found`))}else if(m!=="background")if(r.source){let b=u.sources&&u.sources[r.source],E=b&&oe(b.type);b?E==="vector"&&m==="raster"?t.push(new Ct(o,r.source,`layer "${r.id}" requires a raster source`)):E==="raster"&&m!=="raster"?t.push(new Ct(o,r.source,`layer "${r.id}" requires a vector source`)):E!=="vector"||r["source-layer"]?E==="raster-dem"&&m!=="hillshade"?t.push(new Ct(o,r.source,"raster-dem source can only be used with layer type 'hillshade'.")):m!=="line"||!r.paint||!r.paint["line-gradient"]||E==="geojson"&&b.lineMetrics||t.push(new Ct(o,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):t.push(new Ct(o,r,`layer "${r.id}" must specify a "source-layer"`)):t.push(new Ct(o,r.source,`source "${r.source}" not found`))}else t.push(new Ct(o,r,'missing required property "source"'));return t=t.concat(Xr({key:o,value:r,valueSpec:f.layer,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{"*":()=>[],type:()=>lr({key:`${o}.type`,value:r.type,valueSpec:f.layer.type,style:i.style,styleSpec:i.styleSpec,object:r,objectKey:"type"}),filter:Ys,layout:b=>Xr({layer:r,key:b.key,value:b.value,style:b.style,styleSpec:b.styleSpec,objectElementValidators:{"*":E=>dh(Ie({layerType:m},E))}}),paint:b=>Xr({layer:r,key:b.key,value:b.value,style:b.style,styleSpec:b.styleSpec,objectElementValidators:{"*":E=>ph(Ie({layerType:m},E))}})}})),t}function ws(i){let t=i.value,r=i.key,o=Me(t);return o!=="string"?[new Ct(r,t,`string expected, ${o} found`)]:[]}let mh={promoteId:function({key:i,value:t}){if(Me(t)==="string")return ws({key:i,value:t});{let r=[];for(let o in t)r.push(...ws({key:`${i}.${o}`,value:t[o]}));return r}}};function Qs(i){let t=i.value,r=i.key,o=i.styleSpec,u=i.style;if(!t.type)return[new Ct(r,t,'"type" is required')];let f=oe(t.type),m;switch(f){case"vector":case"raster":case"raster-dem":return m=Xr({key:r,value:t,valueSpec:o[`source_${f.replace("-","_")}`],style:i.style,styleSpec:o,objectElementValidators:mh}),m;case"geojson":if(m=Xr({key:r,value:t,valueSpec:o.source_geojson,style:u,styleSpec:o,objectElementValidators:mh}),t.cluster)for(let x in t.clusterProperties){let[b,E]=t.clusterProperties[x],A=typeof b=="string"?[b,["accumulated"],["get",x]]:b;m.push(...vs({key:`${r}.${x}.map`,value:E,expressionContext:"cluster-map"})),m.push(...vs({key:`${r}.${x}.reduce`,value:A,expressionContext:"cluster-reduce"}))}return m;case"video":return Xr({key:r,value:t,valueSpec:o.source_video,style:u,styleSpec:o});case"image":return Xr({key:r,value:t,valueSpec:o.source_image,style:u,styleSpec:o});case"canvas":return[new Ct(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Va({key:`${r}.type`,value:t.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:u,styleSpec:o})}}function ta(i){let t=i.value,r=i.styleSpec,o=r.light,u=i.style,f=[],m=Me(t);if(t===void 0)return f;if(m!=="object")return f=f.concat([new Ct("light",t,`object expected, ${m} found`)]),f;for(let x in t){let b=x.match(/^(.*)-transition$/);f=f.concat(b&&o[b[1]]&&o[b[1]].transition?lr({key:x,value:t[x],valueSpec:r.transition,style:u,styleSpec:r}):o[x]?lr({key:x,value:t[x],valueSpec:o[x],style:u,styleSpec:r}):[new Ct(x,t[x],`unknown property "${x}"`)])}return f}let xr={"*":()=>[],array:ah,boolean:function(i){let t=i.value,r=i.key,o=Me(t);return o!=="boolean"?[new Ct(r,t,`boolean expected, ${o} found`)]:[]},number:oh,color:function(i){let t=i.key,r=i.value,o=Me(r);return o!=="string"?[new Ct(t,r,`color expected, ${o} found`)]:Hr(r)===null?[new Ct(t,r,`color expected, "${r}" found`)]:[]},constants:Te,enum:Va,filter:Ys,function:lh,layer:fh,object:Xr,source:Qs,light:ta,string:ws,formatted:function(i){return ws(i).length===0?[]:vs(i)},resolvedImage:function(i){return ws(i).length===0?[]:vs(i)}};function lr(i){let t=i.value,r=i.valueSpec,o=i.styleSpec;return r.expression&&La(oe(t))?lh(i):r.expression&&Ba(Oe(t))?vs(i):r.type&&xr[r.type]?xr[r.type](i):Xr(Ie({},i,{valueSpec:r.type?o[r.type]:r}))}function Gc(i){let t=i.value,r=i.key,o=ws(i);return o.length||(t.indexOf("{fontstack}")===-1&&o.push(new Ct(r,t,'"glyphs" url must include a "{fontstack}" token')),t.indexOf("{range}")===-1&&o.push(new Ct(r,t,'"glyphs" url must include a "{range}" token'))),o}function Un(i,t=ct){let r=[];return r=r.concat(lr({key:"",value:i,valueSpec:t.$root,styleSpec:t,style:i,objectElementValidators:{glyphs:Gc,"*":()=>[]}})),i.constants&&(r=r.concat(Te({key:"constants",value:i.constants,style:i,styleSpec:t}))),gh(r)}function gh(i){return[].concat(i).sort((t,r)=>t.line-r.line)}function Ms(i){return function(...t){return gh(i.apply(this,t))}}Un.source=Ms(Qs),Un.light=Ms(ta),Un.layer=Ms(fh),Un.filter=Ms(Ys),Un.paintProperty=Ms(ph),Un.layoutProperty=Ms(dh);let Vn=Un,qc=Vn.light,sl=Vn.paintProperty,jc=Vn.layoutProperty;function yh(i,t){let r=!1;if(t&&t.length)for(let o of t)i.fire(new Dt(new Error(o.message))),r=!0;return r}class Gn{constructor(t,r,o){let u=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;let m=new Int32Array(this.arrayBuffer);t=m[0],this.d=(r=m[1])+2*(o=m[2]);for(let b=0;b<this.d*this.d;b++){let E=m[3+b],A=m[3+b+1];u.push(E===A?null:m.subarray(E,A))}let x=m[3+u.length+1];this.keys=m.subarray(m[3+u.length],x),this.bboxes=m.subarray(x),this.insert=this._insertReadonly}else{this.d=r+2*o;for(let m=0;m<this.d*this.d;m++)u.push([]);this.keys=[],this.bboxes=[]}this.n=r,this.extent=t,this.padding=o,this.scale=r/t,this.uid=0;let f=o/r*t;this.min=-f,this.max=t+f}insert(t,r,o,u,f){this._forEachCell(r,o,u,f,this._insertCell,this.uid++,void 0,void 0),this.keys.push(t),this.bboxes.push(r),this.bboxes.push(o),this.bboxes.push(u),this.bboxes.push(f)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(t,r,o,u,f,m){this.cells[f].push(m)}query(t,r,o,u,f){let m=this.min,x=this.max;if(t<=m&&r<=m&&x<=o&&x<=u&&!f)return Array.prototype.slice.call(this.keys);{let b=[];return this._forEachCell(t,r,o,u,this._queryCell,b,{},f),b}}_queryCell(t,r,o,u,f,m,x,b){let E=this.cells[f];if(E!==null){let A=this.keys,z=this.bboxes;for(let R=0;R<E.length;R++){let O=E[R];if(x[O]===void 0){let G=4*O;(b?b(z[G+0],z[G+1],z[G+2],z[G+3]):t<=z[G+2]&&r<=z[G+3]&&o>=z[G+0]&&u>=z[G+1])?(x[O]=!0,m.push(A[O])):x[O]=!1}}}}_forEachCell(t,r,o,u,f,m,x,b){let E=this._convertToCellCoord(t),A=this._convertToCellCoord(r),z=this._convertToCellCoord(o),R=this._convertToCellCoord(u);for(let O=E;O<=z;O++)for(let G=A;G<=R;G++){let et=this.d*G+O;if((!b||b(this._convertFromCellCoord(O),this._convertFromCellCoord(G),this._convertFromCellCoord(O+1),this._convertFromCellCoord(G+1)))&&f.call(this,t,r,o,u,et,m,x,b))return}}_convertFromCellCoord(t){return(t-this.padding)/this.scale}_convertToCellCoord(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;let t=this.cells,r=3+this.cells.length+1+1,o=0;for(let m=0;m<this.cells.length;m++)o+=this.cells[m].length;let u=new Int32Array(r+o+this.keys.length+this.bboxes.length);u[0]=this.extent,u[1]=this.n,u[2]=this.padding;let f=r;for(let m=0;m<t.length;m++){let x=t[m];u[3+m]=f,u.set(x,f),f+=x.length}return u[3+t.length]=f,u.set(this.keys,f),f+=this.keys.length,u[3+t.length+1]=f,u.set(this.bboxes,f),f+=this.bboxes.length,u.buffer}static serialize(t,r){let o=t.toArrayBuffer();return r&&r.push(o),{buffer:o}}static deserialize(t){return new Gn(t.buffer)}}let Ss={};function te(i,t,r={}){Object.defineProperty(t,"_classRegistryKey",{value:i,writeable:!1}),Ss[i]={klass:t,omit:r.omit||[],shallow:r.shallow||[]}}te("Object",Object),te("TransferableGridIndex",Gn),te("Color",P),te("Error",Error),te("AJAXError",Je),te("ResolvedImage",at),te("StylePropertyFunction",xs),te("StyleExpression",el,{omit:["_evaluator"]}),te("ZoomDependentExpression",Na),te("ZoomConstantExpression",Oa),te("CompoundExpression",Se,{omit:["_evaluate"]});for(let i in ys)ys[i]._classRegistryKey||te(`Expression_${i}`,ys[i]);function al(i){return i&&typeof ArrayBuffer<"u"&&(i instanceof ArrayBuffer||i.constructor&&i.constructor.name==="ArrayBuffer")}function ea(i,t){if(i==null||typeof i=="boolean"||typeof i=="number"||typeof i=="string"||i instanceof Boolean||i instanceof Number||i instanceof String||i instanceof Date||i instanceof RegExp||i instanceof Blob)return i;if(al(i)||Fi(i))return t&&t.push(i),i;if(ArrayBuffer.isView(i)){let r=i;return t&&t.push(r.buffer),r}if(i instanceof ImageData)return t&&t.push(i.data.buffer),i;if(Array.isArray(i)){let r=[];for(let o of i)r.push(ea(o,t));return r}if(typeof i=="object"){let r=i.constructor,o=r._classRegistryKey;if(!o)throw new Error("can't serialize object of unregistered class");let u=r.serialize?r.serialize(i,t):{};if(!r.serialize){for(let f in i){if(!i.hasOwnProperty(f)||Ss[o].omit.indexOf(f)>=0)continue;let m=i[f];u[f]=Ss[o].shallow.indexOf(f)>=0?m:ea(m,t)}i instanceof Error&&(u.message=i.message)}if(u.$name)throw new Error("$name property is reserved for worker serialization logic.");return o!=="Object"&&(u.$name=o),u}throw new Error("can't serialize object of type "+typeof i)}function qn(i){if(i==null||typeof i=="boolean"||typeof i=="number"||typeof i=="string"||i instanceof Boolean||i instanceof Number||i instanceof String||i instanceof Date||i instanceof RegExp||i instanceof Blob||al(i)||Fi(i)||ArrayBuffer.isView(i)||i instanceof ImageData)return i;if(Array.isArray(i))return i.map(qn);if(typeof i=="object"){let t=i.$name||"Object";if(!Ss[t])throw new Error(`can't deserialize unregistered class ${t}`);let{klass:r}=Ss[t];if(!r)throw new Error(`can't deserialize unregistered class ${t}`);if(r.deserialize)return r.deserialize(i);let o=Object.create(r.prototype);for(let u of Object.keys(i)){if(u==="$name")continue;let f=i[u];o[u]=Ss[t].shallow.indexOf(u)>=0?f:qn(f)}return o}throw new Error("can't deserialize object of type "+typeof i)}class ia{constructor(){this.first=!0}update(t,r){let o=Math.floor(t);return this.first?(this.first=!1,this.lastIntegerZoom=o,this.lastIntegerZoomTime=0,this.lastZoom=t,this.lastFloorZoom=o,!0):(this.lastFloorZoom>o?(this.lastIntegerZoom=o+1,this.lastIntegerZoomTime=r):this.lastFloorZoom<o&&(this.lastIntegerZoom=o,this.lastIntegerZoomTime=r),t!==this.lastZoom&&(this.lastZoom=t,this.lastFloorZoom=o,!0))}}let Zt={"Latin-1 Supplement":i=>i>=128&&i<=255,Arabic:i=>i>=1536&&i<=1791,"Arabic Supplement":i=>i>=1872&&i<=1919,"Arabic Extended-A":i=>i>=2208&&i<=2303,"Hangul Jamo":i=>i>=4352&&i<=4607,"Unified Canadian Aboriginal Syllabics":i=>i>=5120&&i<=5759,Khmer:i=>i>=6016&&i<=6143,"Unified Canadian Aboriginal Syllabics Extended":i=>i>=6320&&i<=6399,"General Punctuation":i=>i>=8192&&i<=8303,"Letterlike Symbols":i=>i>=8448&&i<=8527,"Number Forms":i=>i>=8528&&i<=8591,"Miscellaneous Technical":i=>i>=8960&&i<=9215,"Control Pictures":i=>i>=9216&&i<=9279,"Optical Character Recognition":i=>i>=9280&&i<=9311,"Enclosed Alphanumerics":i=>i>=9312&&i<=9471,"Geometric Shapes":i=>i>=9632&&i<=9727,"Miscellaneous Symbols":i=>i>=9728&&i<=9983,"Miscellaneous Symbols and Arrows":i=>i>=11008&&i<=11263,"CJK Radicals Supplement":i=>i>=11904&&i<=12031,"Kangxi Radicals":i=>i>=12032&&i<=12255,"Ideographic Description Characters":i=>i>=12272&&i<=12287,"CJK Symbols and Punctuation":i=>i>=12288&&i<=12351,Hiragana:i=>i>=12352&&i<=12447,Katakana:i=>i>=12448&&i<=12543,Bopomofo:i=>i>=12544&&i<=12591,"Hangul Compatibility Jamo":i=>i>=12592&&i<=12687,Kanbun:i=>i>=12688&&i<=12703,"Bopomofo Extended":i=>i>=12704&&i<=12735,"CJK Strokes":i=>i>=12736&&i<=12783,"Katakana Phonetic Extensions":i=>i>=12784&&i<=12799,"Enclosed CJK Letters and Months":i=>i>=12800&&i<=13055,"CJK Compatibility":i=>i>=13056&&i<=13311,"CJK Unified Ideographs Extension A":i=>i>=13312&&i<=19903,"Yijing Hexagram Symbols":i=>i>=19904&&i<=19967,"CJK Unified Ideographs":i=>i>=19968&&i<=40959,"Yi Syllables":i=>i>=40960&&i<=42127,"Yi Radicals":i=>i>=42128&&i<=42191,"Hangul Jamo Extended-A":i=>i>=43360&&i<=43391,"Hangul Syllables":i=>i>=44032&&i<=55215,"Hangul Jamo Extended-B":i=>i>=55216&&i<=55295,"Private Use Area":i=>i>=57344&&i<=63743,"CJK Compatibility Ideographs":i=>i>=63744&&i<=64255,"Arabic Presentation Forms-A":i=>i>=64336&&i<=65023,"Vertical Forms":i=>i>=65040&&i<=65055,"CJK Compatibility Forms":i=>i>=65072&&i<=65103,"Small Form Variants":i=>i>=65104&&i<=65135,"Arabic Presentation Forms-B":i=>i>=65136&&i<=65279,"Halfwidth and Fullwidth Forms":i=>i>=65280&&i<=65519};function ol(i){for(let t of i)if(ra(t.charCodeAt(0)))return!0;return!1}function _h(i){for(let t of i)if(!$c(t.charCodeAt(0)))return!1;return!0}function $c(i){return!(Zt.Arabic(i)||Zt["Arabic Supplement"](i)||Zt["Arabic Extended-A"](i)||Zt["Arabic Presentation Forms-A"](i)||Zt["Arabic Presentation Forms-B"](i))}function ra(i){return!(i!==746&&i!==747&&(i<4352||!(Zt["Bopomofo Extended"](i)||Zt.Bopomofo(i)||Zt["CJK Compatibility Forms"](i)&&!(i>=65097&&i<=65103)||Zt["CJK Compatibility Ideographs"](i)||Zt["CJK Compatibility"](i)||Zt["CJK Radicals Supplement"](i)||Zt["CJK Strokes"](i)||!(!Zt["CJK Symbols and Punctuation"](i)||i>=12296&&i<=12305||i>=12308&&i<=12319||i===12336)||Zt["CJK Unified Ideographs Extension A"](i)||Zt["CJK Unified Ideographs"](i)||Zt["Enclosed CJK Letters and Months"](i)||Zt["Hangul Compatibility Jamo"](i)||Zt["Hangul Jamo Extended-A"](i)||Zt["Hangul Jamo Extended-B"](i)||Zt["Hangul Jamo"](i)||Zt["Hangul Syllables"](i)||Zt.Hiragana(i)||Zt["Ideographic Description Characters"](i)||Zt.Kanbun(i)||Zt["Kangxi Radicals"](i)||Zt["Katakana Phonetic Extensions"](i)||Zt.Katakana(i)&&i!==12540||!(!Zt["Halfwidth and Fullwidth Forms"](i)||i===65288||i===65289||i===65293||i>=65306&&i<=65310||i===65339||i===65341||i===65343||i>=65371&&i<=65503||i===65507||i>=65512&&i<=65519)||!(!Zt["Small Form Variants"](i)||i>=65112&&i<=65118||i>=65123&&i<=65126)||Zt["Unified Canadian Aboriginal Syllabics"](i)||Zt["Unified Canadian Aboriginal Syllabics Extended"](i)||Zt["Vertical Forms"](i)||Zt["Yijing Hexagram Symbols"](i)||Zt["Yi Syllables"](i)||Zt["Yi Radicals"](i))))}function xh(i){return!(ra(i)||function(t){return!!(Zt["Latin-1 Supplement"](t)&&(t===167||t===169||t===174||t===177||t===188||t===189||t===190||t===215||t===247)||Zt["General Punctuation"](t)&&(t===8214||t===8224||t===8225||t===8240||t===8241||t===8251||t===8252||t===8258||t===8263||t===8264||t===8265||t===8273)||Zt["Letterlike Symbols"](t)||Zt["Number Forms"](t)||Zt["Miscellaneous Technical"](t)&&(t>=8960&&t<=8967||t>=8972&&t<=8991||t>=8996&&t<=9e3||t===9003||t>=9085&&t<=9114||t>=9150&&t<=9165||t===9167||t>=9169&&t<=9179||t>=9186&&t<=9215)||Zt["Control Pictures"](t)&&t!==9251||Zt["Optical Character Recognition"](t)||Zt["Enclosed Alphanumerics"](t)||Zt["Geometric Shapes"](t)||Zt["Miscellaneous Symbols"](t)&&!(t>=9754&&t<=9759)||Zt["Miscellaneous Symbols and Arrows"](t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||Zt["CJK Symbols and Punctuation"](t)||Zt.Katakana(t)||Zt["Private Use Area"](t)||Zt["CJK Compatibility Forms"](t)||Zt["Small Form Variants"](t)||Zt["Halfwidth and Fullwidth Forms"](t)||t===8734||t===8756||t===8757||t>=9984&&t<=10087||t>=10102&&t<=10131||t===65532||t===65533)}(i))}function vh(i){return i>=1424&&i<=2303||Zt["Arabic Presentation Forms-A"](i)||Zt["Arabic Presentation Forms-B"](i)}function Wc(i,t){return!(!t&&vh(i)||i>=2304&&i<=3583||i>=3840&&i<=4255||Zt.Khmer(i))}function Zc(i){for(let t of i)if(vh(t.charCodeAt(0)))return!0;return!1}let Wa="deferred",ll="loading",hl="loaded",cl=null,hr="unavailable",En=null,bh=function(i){i&&typeof i=="string"&&i.indexOf("NetworkError")>-1&&(hr="error"),cl&&cl(i)};function ul(){Ts.fire(new xt("pluginStateChange",{pluginStatus:hr,pluginURL:En}))}let Ts=new Ut,pl=function(){return hr},Za=function(){if(hr!==Wa||!En)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");hr=ll,ul(),En&&Rr({url:En},i=>{i?bh(i):(hr=hl,ul())})},Br={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>hr===hl||Br.applyArabicShaping!=null,isLoading:()=>hr===ll,setState(i){hr=i.pluginStatus,En=i.pluginURL},isParsed:()=>Br.applyArabicShaping!=null&&Br.processBidirectionalText!=null&&Br.processStyledBidirectionalText!=null,getPluginURL:()=>En};class hi{constructor(t,r){this.zoom=t,r?(this.now=r.now,this.fadeDuration=r.fadeDuration,this.zoomHistory=r.zoomHistory,this.transition=r.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new ia,this.transition={})}isSupportedScript(t){return function(r,o){for(let u of r)if(!Wc(u.charCodeAt(0),o))return!1;return!0}(t,Br.isLoaded())}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){let t=this.zoom,r=t-Math.floor(t),o=this.crossFadingFactor();return t>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:r+(1-r)*o}:{fromScale:.5,toScale:1,t:1-(1-o)*r}}}class Ha{constructor(t,r){this.property=t,this.value=r,this.expression=function(o,u){if(La(o))return new xs(o,u);if(Ba(o)){let f=il(o,u);if(f.result==="error")throw new Error(f.value.map(m=>`${m.key}: ${m.message}`).join(", "));return f.value}{let f=o;return typeof o=="string"&&u.type==="color"&&(f=P.parse(o)),{kind:"constant",evaluate:()=>f}}}(r===void 0?t.specification.default:r,t.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(t,r,o){return this.property.possiblyEvaluate(this,t,r,o)}}class Xa{constructor(t){this.property=t,this.value=new Ha(t,void 0)}transitioned(t,r){return new wh(this.property,this.value,r,pt({},t.transition,this.transition),t.now)}untransitioned(){return new wh(this.property,this.value,null,{},0)}}class dl{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues)}getValue(t){return Ot(this._values[t].value.value)}setValue(t,r){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new Xa(this._values[t].property)),this._values[t].value=new Ha(this._values[t].property,r===null?void 0:Ot(r))}getTransition(t){return Ot(this._values[t].transition)}setTransition(t,r){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new Xa(this._values[t].property)),this._values[t].transition=Ot(r)||void 0}serialize(){let t={};for(let r of Object.keys(this._values)){let o=this.getValue(r);o!==void 0&&(t[r]=o);let u=this.getTransition(r);u!==void 0&&(t[`${r}-transition`]=u)}return t}transitioned(t,r){let o=new Mh(this._properties);for(let u of Object.keys(this._values))o._values[u]=this._values[u].transitioned(t,r._values[u]);return o}untransitioned(){let t=new Mh(this._properties);for(let r of Object.keys(this._values))t._values[r]=this._values[r].untransitioned();return t}}class wh{constructor(t,r,o,u,f){this.property=t,this.value=r,this.begin=f+u.delay||0,this.end=this.begin+u.duration||0,t.specification.transition&&(u.delay||u.duration)&&(this.prior=o)}possiblyEvaluate(t,r,o){let u=t.now||0,f=this.value.possiblyEvaluate(t,r,o),m=this.prior;if(m){if(u>this.end)return this.prior=null,f;if(this.value.isDataDriven())return this.prior=null,f;if(u<this.begin)return m.possiblyEvaluate(t,r,o);{let x=(u-this.begin)/(this.end-this.begin);return this.property.interpolate(m.possiblyEvaluate(t,r,o),f,function(b){if(b<=0)return 0;if(b>=1)return 1;let E=b*b,A=E*b;return 4*(b<.5?A:3*(b-E)+A-.75)}(x))}}return f}}class Mh{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)}possiblyEvaluate(t,r,o){let u=new Ka(this._properties);for(let f of Object.keys(this._values))u._values[f]=this._values[f].possiblyEvaluate(t,r,o);return u}hasTransition(){for(let t of Object.keys(this._values))if(this._values[t].prior)return!0;return!1}}class Hc{constructor(t){this._properties=t,this._values=Object.create(t.defaultPropertyValues)}getValue(t){return Ot(this._values[t].value)}setValue(t,r){this._values[t]=new Ha(this._values[t].property,r===null?void 0:Ot(r))}serialize(){let t={};for(let r of Object.keys(this._values)){let o=this.getValue(r);o!==void 0&&(t[r]=o)}return t}possiblyEvaluate(t,r,o){let u=new Ka(this._properties);for(let f of Object.keys(this._values))u._values[f]=this._values[f].possiblyEvaluate(t,r,o);return u}}class an{constructor(t,r,o){this.property=t,this.value=r,this.parameters=o}isConstant(){return this.value.kind==="constant"}constantOr(t){return this.value.kind==="constant"?this.value.value:t}evaluate(t,r,o,u){return this.property.evaluate(this.value,this.parameters,t,r,o,u)}}class Ka{constructor(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues)}get(t){return this._values[t]}}class se{constructor(t){this.specification=t}possiblyEvaluate(t,r){return t.expression.evaluate(r)}interpolate(t,r,o){let u=Zs[this.specification.type];return u?u(t,r,o):t}}class de{constructor(t,r){this.specification=t,this.overrides=r}possiblyEvaluate(t,r,o,u){return new an(this,t.expression.kind==="constant"||t.expression.kind==="camera"?{kind:"constant",value:t.expression.evaluate(r,null,{},o,u)}:t.expression,r)}interpolate(t,r,o){if(t.value.kind!=="constant"||r.value.kind!=="constant")return t;if(t.value.value===void 0||r.value.value===void 0)return new an(this,{kind:"constant",value:void 0},t.parameters);let u=Zs[this.specification.type];return u?new an(this,{kind:"constant",value:u(t.value.value,r.value.value,o)},t.parameters):t}evaluate(t,r,o,u,f,m){return t.kind==="constant"?t.value:t.evaluate(r,o,u,f,m)}}class na extends de{possiblyEvaluate(t,r,o,u){if(t.value===void 0)return new an(this,{kind:"constant",value:void 0},r);if(t.expression.kind==="constant"){let f=t.expression.evaluate(r,null,{},o,u),m=t.property.specification.type==="resolvedImage"&&typeof f!="string"?f.name:f,x=this._calculate(m,m,m,r);return new an(this,{kind:"constant",value:x},r)}if(t.expression.kind==="camera"){let f=this._calculate(t.expression.evaluate({zoom:r.zoom-1}),t.expression.evaluate({zoom:r.zoom}),t.expression.evaluate({zoom:r.zoom+1}),r);return new an(this,{kind:"constant",value:f},r)}return new an(this,t.expression,r)}evaluate(t,r,o,u,f,m){if(t.kind==="source"){let x=t.evaluate(r,o,u,f,m);return this._calculate(x,x,x,r)}return t.kind==="composite"?this._calculate(t.evaluate({zoom:Math.floor(r.zoom)-1},o,u),t.evaluate({zoom:Math.floor(r.zoom)},o,u),t.evaluate({zoom:Math.floor(r.zoom)+1},o,u),r):t.value}_calculate(t,r,o,u){return u.zoom>u.zoomHistory.lastIntegerZoom?{from:t,to:r}:{from:o,to:r}}interpolate(t){return t}}class sa{constructor(t){this.specification=t}possiblyEvaluate(t,r,o,u){if(t.value!==void 0){if(t.expression.kind==="constant"){let f=t.expression.evaluate(r,null,{},o,u);return this._calculate(f,f,f,r)}return this._calculate(t.expression.evaluate(new hi(Math.floor(r.zoom-1),r)),t.expression.evaluate(new hi(Math.floor(r.zoom),r)),t.expression.evaluate(new hi(Math.floor(r.zoom+1),r)),r)}}_calculate(t,r,o,u){return u.zoom>u.zoomHistory.lastIntegerZoom?{from:t,to:r}:{from:o,to:r}}interpolate(t){return t}}class fl{constructor(t){this.specification=t}possiblyEvaluate(t,r,o,u){return!!t.expression.evaluate(r,null,{},o,u)}interpolate(){return!1}}class Oi{constructor(t){this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(let r in t){let o=t[r];o.specification.overridable&&this.overridableProperties.push(r);let u=this.defaultPropertyValues[r]=new Ha(o,void 0),f=this.defaultTransitionablePropertyValues[r]=new Xa(o);this.defaultTransitioningPropertyValues[r]=f.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=u.possiblyEvaluate({})}}}te("DataDrivenProperty",de),te("DataConstantProperty",se),te("CrossFadedDataDrivenProperty",na),te("CrossFadedProperty",sa),te("ColorRampProperty",fl);let jn="-transition";class cr extends Ut{constructor(t,r){if(super(),this.id=t.id,this.type=t.type,this._featureFilter={filter:()=>!0,needGeometry:!1},t.type!=="custom"&&(this.metadata=(t=t).metadata,this.minzoom=t.minzoom,this.maxzoom=t.maxzoom,t.type!=="background"&&(this.source=t.source,this.sourceLayer=t["source-layer"],this.filter=t.filter),r.layout&&(this._unevaluatedLayout=new Hc(r.layout)),r.paint)){this._transitionablePaint=new dl(r.paint);for(let o in t.paint)this.setPaintProperty(o,t.paint[o],{validate:!1});for(let o in t.layout)this.setLayoutProperty(o,t.layout[o],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Ka(r.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(t){return t==="visibility"?this.visibility:this._unevaluatedLayout.getValue(t)}setLayoutProperty(t,r,o={}){r!=null&&this._validate(jc,`layers.${this.id}.layout.${t}`,t,r,o)||(t!=="visibility"?this._unevaluatedLayout.setValue(t,r):this.visibility=r)}getPaintProperty(t){return t.endsWith(jn)?this._transitionablePaint.getTransition(t.slice(0,-jn.length)):this._transitionablePaint.getValue(t)}setPaintProperty(t,r,o={}){if(r!=null&&this._validate(sl,`layers.${this.id}.paint.${t}`,t,r,o))return!1;if(t.endsWith(jn))return this._transitionablePaint.setTransition(t.slice(0,-jn.length),r||void 0),!1;{let u=this._transitionablePaint._values[t],f=u.property.specification["property-type"]==="cross-faded-data-driven",m=u.value.isDataDriven(),x=u.value;this._transitionablePaint.setValue(t,r),this._handleSpecialPaintPropertyUpdate(t);let b=this._transitionablePaint._values[t].value;return b.isDataDriven()||m||f||this._handleOverridablePaintPropertyUpdate(t,x,b)}}_handleSpecialPaintPropertyUpdate(t){}_handleOverridablePaintPropertyUpdate(t,r,o){return!1}isHidden(t){return!!(this.minzoom&&t<this.minzoom)||!!(this.maxzoom&&t>=this.maxzoom)||this.visibility==="none"}updateTransitions(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(t,r){t.getCrossfadeParameters&&(this._crossfadeParameters=t.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t,void 0,r)),this.paint=this._transitioningPaint.possiblyEvaluate(t,void 0,r)}serialize(){let t={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&&(t.layout=t.layout||{},t.layout.visibility=this.visibility),kt(t,(r,o)=>!(r===void 0||o==="layout"&&!Object.keys(r).length||o==="paint"&&!Object.keys(r).length))}_validate(t,r,o,u,f={}){return(!f||f.validate!==!1)&&yh(this,t.call(Vn,{key:r,layerType:this.type,objectKey:o,value:u,styleSpec:ct,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(let t in this.paint._values){let r=this.paint.get(t);if(r instanceof an&&_s(r.property.specification)&&(r.value.kind==="source"||r.value.kind==="composite")&&r.value.isStateDependent)return!0}return!1}}let Xc={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class aa{constructor(t,r){this._structArray=t,this._pos1=r*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class oi{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(t,r){return t._trim(),r&&(t.isTransferred=!0,r.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}}static deserialize(t){let r=Object.create(this.prototype);return r.arrayBuffer=t.arrayBuffer,r.length=t.length,r.capacity=t.arrayBuffer.byteLength/r.bytesPerElement,r._refreshViews(),r}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(t){this.reserve(t),this.length=t}reserve(t){if(t>this.capacity){this.capacity=Math.max(t,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);let r=this.uint8;this._refreshViews(),r&&this.uint8.set(r)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function Ni(i,t=1){let r=0,o=0;return{members:i.map(u=>{let f=Xc[u.type].BYTES_PER_ELEMENT,m=r=Sh(r,Math.max(t,f)),x=u.components||1;return o=Math.max(o,f),r+=f*x,{name:u.name,type:u.type,components:x,offset:m}}),size:Sh(r,Math.max(o,t)),alignment:t}}function Sh(i,t){return Math.ceil(i/t)*t}class Es extends oi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r){let o=this.length;return this.resize(o+1),this.emplace(o,t,r)}emplace(t,r,o){let u=2*t;return this.int16[u+0]=r,this.int16[u+1]=o,t}}Es.prototype.bytesPerElement=4,te("StructArrayLayout2i4",Es);class oa extends oi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,o,u){let f=this.length;return this.resize(f+1),this.emplace(f,t,r,o,u)}emplace(t,r,o,u,f){let m=4*t;return this.int16[m+0]=r,this.int16[m+1]=o,this.int16[m+2]=u,this.int16[m+3]=f,t}}oa.prototype.bytesPerElement=8,te("StructArrayLayout4i8",oa);class p extends oi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,o,u,f,m){let x=this.length;return this.resize(x+1),this.emplace(x,t,r,o,u,f,m)}emplace(t,r,o,u,f,m,x){let b=6*t;return this.int16[b+0]=r,this.int16[b+1]=o,this.int16[b+2]=u,this.int16[b+3]=f,this.int16[b+4]=m,this.int16[b+5]=x,t}}p.prototype.bytesPerElement=12,te("StructArrayLayout2i4i12",p);class e extends oi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,o,u,f,m){let x=this.length;return this.resize(x+1),this.emplace(x,t,r,o,u,f,m)}emplace(t,r,o,u,f,m,x){let b=4*t,E=8*t;return this.int16[b+0]=r,this.int16[b+1]=o,this.uint8[E+4]=u,this.uint8[E+5]=f,this.uint8[E+6]=m,this.uint8[E+7]=x,t}}e.prototype.bytesPerElement=8,te("StructArrayLayout2i4ub8",e);class n extends oi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r){let o=this.length;return this.resize(o+1),this.emplace(o,t,r)}emplace(t,r,o){let u=2*t;return this.float32[u+0]=r,this.float32[u+1]=o,t}}n.prototype.bytesPerElement=8,te("StructArrayLayout2f8",n);class c extends oi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,o,u,f,m,x,b,E,A){let z=this.length;return this.resize(z+1),this.emplace(z,t,r,o,u,f,m,x,b,E,A)}emplace(t,r,o,u,f,m,x,b,E,A,z){let R=10*t;return this.uint16[R+0]=r,this.uint16[R+1]=o,this.uint16[R+2]=u,this.uint16[R+3]=f,this.uint16[R+4]=m,this.uint16[R+5]=x,this.uint16[R+6]=b,this.uint16[R+7]=E,this.uint16[R+8]=A,this.uint16[R+9]=z,t}}c.prototype.bytesPerElement=20,te("StructArrayLayout10ui20",c);class d extends oi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,o,u,f,m,x,b,E,A,z,R){let O=this.length;return this.resize(O+1),this.emplace(O,t,r,o,u,f,m,x,b,E,A,z,R)}emplace(t,r,o,u,f,m,x,b,E,A,z,R,O){let G=12*t;return this.int16[G+0]=r,this.int16[G+1]=o,this.int16[G+2]=u,this.int16[G+3]=f,this.uint16[G+4]=m,this.uint16[G+5]=x,this.uint16[G+6]=b,this.uint16[G+7]=E,this.int16[G+8]=A,this.int16[G+9]=z,this.int16[G+10]=R,this.int16[G+11]=O,t}}d.prototype.bytesPerElement=24,te("StructArrayLayout4i4ui4i24",d);class g extends oi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r,o){let u=this.length;return this.resize(u+1),this.emplace(u,t,r,o)}emplace(t,r,o,u){let f=3*t;return this.float32[f+0]=r,this.float32[f+1]=o,this.float32[f+2]=u,t}}g.prototype.bytesPerElement=12,te("StructArrayLayout3f12",g);class v extends oi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(t){let r=this.length;return this.resize(r+1),this.emplace(r,t)}emplace(t,r){return this.uint32[1*t+0]=r,t}}v.prototype.bytesPerElement=4,te("StructArrayLayout1ul4",v);class w extends oi{_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(t,r,o,u,f,m,x,b,E){let A=this.length;return this.resize(A+1),this.emplace(A,t,r,o,u,f,m,x,b,E)}emplace(t,r,o,u,f,m,x,b,E,A){let z=10*t,R=5*t;return this.int16[z+0]=r,this.int16[z+1]=o,this.int16[z+2]=u,this.int16[z+3]=f,this.int16[z+4]=m,this.int16[z+5]=x,this.uint32[R+3]=b,this.uint16[z+8]=E,this.uint16[z+9]=A,t}}w.prototype.bytesPerElement=20,te("StructArrayLayout6i1ul2ui20",w);class S extends oi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,o,u,f,m){let x=this.length;return this.resize(x+1),this.emplace(x,t,r,o,u,f,m)}emplace(t,r,o,u,f,m,x){let b=6*t;return this.int16[b+0]=r,this.int16[b+1]=o,this.int16[b+2]=u,this.int16[b+3]=f,this.int16[b+4]=m,this.int16[b+5]=x,t}}S.prototype.bytesPerElement=12,te("StructArrayLayout2i2i2i12",S);class C extends oi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,o,u,f){let m=this.length;return this.resize(m+1),this.emplace(m,t,r,o,u,f)}emplace(t,r,o,u,f,m){let x=4*t,b=8*t;return this.float32[x+0]=r,this.float32[x+1]=o,this.float32[x+2]=u,this.int16[b+6]=f,this.int16[b+7]=m,t}}C.prototype.bytesPerElement=16,te("StructArrayLayout2f1f2i16",C);class k extends oi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r,o,u){let f=this.length;return this.resize(f+1),this.emplace(f,t,r,o,u)}emplace(t,r,o,u,f){let m=12*t,x=3*t;return this.uint8[m+0]=r,this.uint8[m+1]=o,this.float32[x+1]=u,this.float32[x+2]=f,t}}k.prototype.bytesPerElement=12,te("StructArrayLayout2ub2f12",k);class F extends oi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,o){let u=this.length;return this.resize(u+1),this.emplace(u,t,r,o)}emplace(t,r,o,u){let f=3*t;return this.uint16[f+0]=r,this.uint16[f+1]=o,this.uint16[f+2]=u,t}}F.prototype.bytesPerElement=6,te("StructArrayLayout3ui6",F);class j extends oi{_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(t,r,o,u,f,m,x,b,E,A,z,R,O,G,et,it,dt){let bt=this.length;return this.resize(bt+1),this.emplace(bt,t,r,o,u,f,m,x,b,E,A,z,R,O,G,et,it,dt)}emplace(t,r,o,u,f,m,x,b,E,A,z,R,O,G,et,it,dt,bt){let vt=24*t,Et=12*t,Rt=48*t;return this.int16[vt+0]=r,this.int16[vt+1]=o,this.uint16[vt+2]=u,this.uint16[vt+3]=f,this.uint32[Et+2]=m,this.uint32[Et+3]=x,this.uint32[Et+4]=b,this.uint16[vt+10]=E,this.uint16[vt+11]=A,this.uint16[vt+12]=z,this.float32[Et+7]=R,this.float32[Et+8]=O,this.uint8[Rt+36]=G,this.uint8[Rt+37]=et,this.uint8[Rt+38]=it,this.uint32[Et+10]=dt,this.int16[vt+22]=bt,t}}j.prototype.bytesPerElement=48,te("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",j);class Q extends oi{_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(t,r,o,u,f,m,x,b,E,A,z,R,O,G,et,it,dt,bt,vt,Et,Rt,zt,ee,le,Xt,Kt,Wt,Qt){let Yt=this.length;return this.resize(Yt+1),this.emplace(Yt,t,r,o,u,f,m,x,b,E,A,z,R,O,G,et,it,dt,bt,vt,Et,Rt,zt,ee,le,Xt,Kt,Wt,Qt)}emplace(t,r,o,u,f,m,x,b,E,A,z,R,O,G,et,it,dt,bt,vt,Et,Rt,zt,ee,le,Xt,Kt,Wt,Qt,Yt){let Gt=34*t,fe=17*t;return this.int16[Gt+0]=r,this.int16[Gt+1]=o,this.int16[Gt+2]=u,this.int16[Gt+3]=f,this.int16[Gt+4]=m,this.int16[Gt+5]=x,this.int16[Gt+6]=b,this.int16[Gt+7]=E,this.uint16[Gt+8]=A,this.uint16[Gt+9]=z,this.uint16[Gt+10]=R,this.uint16[Gt+11]=O,this.uint16[Gt+12]=G,this.uint16[Gt+13]=et,this.uint16[Gt+14]=it,this.uint16[Gt+15]=dt,this.uint16[Gt+16]=bt,this.uint16[Gt+17]=vt,this.uint16[Gt+18]=Et,this.uint16[Gt+19]=Rt,this.uint16[Gt+20]=zt,this.uint16[Gt+21]=ee,this.uint16[Gt+22]=le,this.uint32[fe+12]=Xt,this.float32[fe+13]=Kt,this.float32[fe+14]=Wt,this.float32[fe+15]=Qt,this.float32[fe+16]=Yt,t}}Q.prototype.bytesPerElement=68,te("StructArrayLayout8i15ui1ul4f68",Q);class $ extends oi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t){let r=this.length;return this.resize(r+1),this.emplace(r,t)}emplace(t,r){return this.float32[1*t+0]=r,t}}$.prototype.bytesPerElement=4,te("StructArrayLayout1f4",$);class J extends oi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,o){let u=this.length;return this.resize(u+1),this.emplace(u,t,r,o)}emplace(t,r,o,u){let f=3*t;return this.int16[f+0]=r,this.int16[f+1]=o,this.int16[f+2]=u,t}}J.prototype.bytesPerElement=6,te("StructArrayLayout3i6",J);class lt extends oi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,o){let u=this.length;return this.resize(u+1),this.emplace(u,t,r,o)}emplace(t,r,o,u){let f=4*t;return this.uint32[2*t+0]=r,this.uint16[f+2]=o,this.uint16[f+3]=u,t}}lt.prototype.bytesPerElement=8,te("StructArrayLayout1ul2ui8",lt);class ht extends oi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r){let o=this.length;return this.resize(o+1),this.emplace(o,t,r)}emplace(t,r,o){let u=2*t;return this.uint16[u+0]=r,this.uint16[u+1]=o,t}}ht.prototype.bytesPerElement=4,te("StructArrayLayout2ui4",ht);class gt extends oi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t){let r=this.length;return this.resize(r+1),this.emplace(r,t)}emplace(t,r){return this.uint16[1*t+0]=r,t}}gt.prototype.bytesPerElement=2,te("StructArrayLayout1ui2",gt);class ut extends oi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r,o,u){let f=this.length;return this.resize(f+1),this.emplace(f,t,r,o,u)}emplace(t,r,o,u,f){let m=4*t;return this.float32[m+0]=r,this.float32[m+1]=o,this.float32[m+2]=u,this.float32[m+3]=f,t}}ut.prototype.bytesPerElement=16,te("StructArrayLayout4f16",ut);class At extends aa{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 ye(this.anchorPointX,this.anchorPointY)}}At.prototype.size=20;class Mt extends w{get(t){return new At(this,t)}}te("CollisionBoxArray",Mt);class Tt extends aa{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(t){this._structArray.uint8[this._pos1+37]=t}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(t){this._structArray.uint8[this._pos1+38]=t}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(t){this._structArray.uint32[this._pos4+10]=t}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}Tt.prototype.size=48;class Nt extends j{get(t){return new Tt(this,t)}}te("PlacedSymbolArray",Nt);class jt extends aa{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(t){this._structArray.uint32[this._pos4+12]=t}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]}}jt.prototype.size=68;class It extends Q{get(t){return new jt(this,t)}}te("SymbolInstanceArray",It);class ie extends ${getoffsetX(t){return this.float32[1*t+0]}}te("GlyphOffsetArray",ie);class Ht extends J{getx(t){return this.int16[3*t+0]}gety(t){return this.int16[3*t+1]}gettileUnitDistanceFromAnchor(t){return this.int16[3*t+2]}}te("SymbolLineVertexArray",Ht);class ve extends aa{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]}}ve.prototype.size=8;class Fe extends lt{get(t){return new ve(this,t)}}te("FeatureIndexArray",Fe);class ke extends Es{}class Re extends Es{}class yi extends p{}class we extends e{}class qe extends n{}class ti extends c{}class Zi extends d{}class vr extends g{}class Fr extends v{}class Or extends S{}class In extends k{}class ur extends F{}class on extends ht{}let $n=Ni([{name:"a_pos",components:2,type:"Int16"}],4),{members:br}=$n;class je{constructor(t=[]){this.segments=t}prepareSegment(t,r,o,u){let f=this.segments[this.segments.length-1];return t>je.MAX_VERTEX_ARRAY_LENGTH&&ne(`Max vertices per segment is ${je.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${t}`),(!f||f.vertexLength+t>je.MAX_VERTEX_ARRAY_LENGTH||f.sortKey!==u)&&(f={vertexOffset:r.length,primitiveOffset:o.length,vertexLength:0,primitiveLength:0},u!==void 0&&(f.sortKey=u),this.segments.push(f)),f}get(){return this.segments}destroy(){for(let t of this.segments)for(let r in t.vaos)t.vaos[r].destroy()}static simpleSegment(t,r,o,u){return new je([{vertexOffset:t,primitiveOffset:r,vertexLength:o,primitiveLength:u,vaos:{},sortKey:0}])}}function Xe(i,t){return 256*(i=L(Math.floor(i),0,255))+L(Math.floor(t),0,255)}je.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,te("SegmentVector",je);let Pi=Ni([{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 nr={exports:{}},ci={exports:{}};ci.exports=function(i,t){var r,o,u,f,m,x,b,E;for(o=i.length-(r=3&i.length),u=t,m=3432918353,x=461845907,E=0;E<o;)b=255&i.charCodeAt(E)|(255&i.charCodeAt(++E))<<8|(255&i.charCodeAt(++E))<<16|(255&i.charCodeAt(++E))<<24,++E,u=27492+(65535&(f=5*(65535&(u=(u^=b=(65535&(b=(b=(65535&b)*m+(((b>>>16)*m&65535)<<16)&4294967295)<<15|b>>>17))*x+(((b>>>16)*x&65535)<<16)&4294967295)<<13|u>>>19))+((5*(u>>>16)&65535)<<16)&4294967295))+((58964+(f>>>16)&65535)<<16);switch(b=0,r){case 3:b^=(255&i.charCodeAt(E+2))<<16;case 2:b^=(255&i.charCodeAt(E+1))<<8;case 1:u^=b=(65535&(b=(b=(65535&(b^=255&i.charCodeAt(E)))*m+(((b>>>16)*m&65535)<<16)&4294967295)<<15|b>>>17))*x+(((b>>>16)*x&65535)<<16)&4294967295}return u^=i.length,u=2246822507*(65535&(u^=u>>>16))+((2246822507*(u>>>16)&65535)<<16)&4294967295,u=3266489909*(65535&(u^=u>>>13))+((3266489909*(u>>>16)&65535)<<16)&4294967295,(u^=u>>>16)>>>0};var Wn={exports:{}};Wn.exports=function(i,t){for(var r,o=i.length,u=t^o,f=0;o>=4;)r=1540483477*(65535&(r=255&i.charCodeAt(f)|(255&i.charCodeAt(++f))<<8|(255&i.charCodeAt(++f))<<16|(255&i.charCodeAt(++f))<<24))+((1540483477*(r>>>16)&65535)<<16),u=1540483477*(65535&u)+((1540483477*(u>>>16)&65535)<<16)^(r=1540483477*(65535&(r^=r>>>24))+((1540483477*(r>>>16)&65535)<<16)),o-=4,++f;switch(o){case 3:u^=(255&i.charCodeAt(f+2))<<16;case 2:u^=(255&i.charCodeAt(f+1))<<8;case 1:u=1540483477*(65535&(u^=255&i.charCodeAt(f)))+((1540483477*(u>>>16)&65535)<<16)}return u=1540483477*(65535&(u^=u>>>13))+((1540483477*(u>>>16)&65535)<<16),(u^=u>>>15)>>>0};var ln=ci.exports,Ya=Wn.exports;nr.exports=ln,nr.exports.murmur3=ln,nr.exports.murmur2=Ya;var ml=nr.exports;class Ja{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(t,r,o,u){this.ids.push(Th(t)),this.positions.push(r,o,u)}getPositions(t){let r=Th(t),o=0,u=this.ids.length-1;for(;o<u;){let m=o+u>>1;this.ids[m]>=r?u=m:o=m+1}let f=[];for(;this.ids[o]===r;)f.push({index:this.positions[3*o],start:this.positions[3*o+1],end:this.positions[3*o+2]}),o++;return f}static serialize(t,r){let o=new Float64Array(t.ids),u=new Uint32Array(t.positions);return Zn(o,u,0,o.length-1),r&&r.push(o.buffer,u.buffer),{ids:o,positions:u}}static deserialize(t){let r=new Ja;return r.ids=t.ids,r.positions=t.positions,r.indexed=!0,r}}function Th(i){let t=+i;return!isNaN(t)&&t<=Number.MAX_SAFE_INTEGER?t:ml(String(i))}function Zn(i,t,r,o){for(;r<o;){let u=i[r+o>>1],f=r-1,m=o+1;for(;;){do f++;while(i[f]<u);do m--;while(i[m]>u);if(f>=m)break;Qa(i,f,m),Qa(t,3*f,3*m),Qa(t,3*f+1,3*m+1),Qa(t,3*f+2,3*m+2)}m-r<o-m?(Zn(i,t,r,m),r=m+1):(Zn(i,t,m+1,o),o=m)}}function Qa(i,t,r){let o=i[t];i[t]=i[r],i[r]=o}te("FeaturePositionMap",Ja);class hn{constructor(t,r){this.gl=t.gl,this.location=r}}class Is extends hn{constructor(t,r){super(t,r),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1f(this.location,t))}}class fp extends hn{constructor(t,r){super(t,r),this.current=[0,0,0,0]}set(t){t[0]===this.current[0]&&t[1]===this.current[1]&&t[2]===this.current[2]&&t[3]===this.current[3]||(this.current=t,this.gl.uniform4f(this.location,t[0],t[1],t[2],t[3]))}}class mp extends hn{constructor(t,r){super(t,r),this.current=P.transparent}set(t){t.r===this.current.r&&t.g===this.current.g&&t.b===this.current.b&&t.a===this.current.a||(this.current=t,this.gl.uniform4f(this.location,t.r,t.g,t.b,t.a))}}let yg=new Float32Array(16);function Kc(i){return[Xe(255*i.r,255*i.g),Xe(255*i.b,255*i.a)]}class gl{constructor(t,r,o){this.value=t,this.uniformNames=r.map(u=>`u_${u}`),this.type=o}setUniform(t,r,o){t.set(o.constantOr(this.value))}getBinding(t,r,o){return this.type==="color"?new mp(t,r):new Is(t,r)}}class to{constructor(t,r){this.uniformNames=r.map(o=>`u_${o}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(t,r){this.pixelRatioFrom=r.pixelRatio,this.pixelRatioTo=t.pixelRatio,this.patternFrom=r.tlbr,this.patternTo=t.tlbr}setUniform(t,r,o,u){let f=u==="u_pattern_to"?this.patternTo:u==="u_pattern_from"?this.patternFrom:u==="u_pixel_ratio_to"?this.pixelRatioTo:u==="u_pixel_ratio_from"?this.pixelRatioFrom:null;f&&t.set(f)}getBinding(t,r,o){return o.substr(0,9)==="u_pattern"?new fp(t,r):new Is(t,r)}}class Hn{constructor(t,r,o,u){this.expression=t,this.type=o,this.maxValue=0,this.paintVertexAttributes=r.map(f=>({name:`a_${f}`,type:"Float32",components:o==="color"?2:1,offset:0})),this.paintVertexArray=new u}populatePaintArray(t,r,o,u,f){let m=this.paintVertexArray.length,x=this.expression.evaluate(new hi(0),r,{},u,[],f);this.paintVertexArray.resize(t),this._setPaintValue(m,t,x)}updatePaintArray(t,r,o,u){let f=this.expression.evaluate({zoom:0},o,u);this._setPaintValue(t,r,f)}_setPaintValue(t,r,o){if(this.type==="color"){let u=Kc(o);for(let f=t;f<r;f++)this.paintVertexArray.emplace(f,u[0],u[1])}else{for(let u=t;u<r;u++)this.paintVertexArray.emplace(u,o);this.maxValue=Math.max(this.maxValue,Math.abs(o))}}upload(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class yn{constructor(t,r,o,u,f,m){this.expression=t,this.uniformNames=r.map(x=>`u_${x}_t`),this.type=o,this.useIntegerZoom=u,this.zoom=f,this.maxValue=0,this.paintVertexAttributes=r.map(x=>({name:`a_${x}`,type:"Float32",components:o==="color"?4:2,offset:0})),this.paintVertexArray=new m}populatePaintArray(t,r,o,u,f){let m=this.expression.evaluate(new hi(this.zoom),r,{},u,[],f),x=this.expression.evaluate(new hi(this.zoom+1),r,{},u,[],f),b=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(b,t,m,x)}updatePaintArray(t,r,o,u){let f=this.expression.evaluate({zoom:this.zoom},o,u),m=this.expression.evaluate({zoom:this.zoom+1},o,u);this._setPaintValue(t,r,f,m)}_setPaintValue(t,r,o,u){if(this.type==="color"){let f=Kc(o),m=Kc(u);for(let x=t;x<r;x++)this.paintVertexArray.emplace(x,f[0],f[1],m[0],m[1])}else{for(let f=t;f<r;f++)this.paintVertexArray.emplace(f,o,u);this.maxValue=Math.max(this.maxValue,Math.abs(o),Math.abs(u))}}upload(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(t,r){let o=this.useIntegerZoom?Math.floor(r.zoom):r.zoom,u=L(this.expression.interpolationFactor(o,this.zoom,this.zoom+1),0,1);t.set(u)}getBinding(t,r,o){return new Is(t,r)}}class Cs{constructor(t,r,o,u,f,m){this.expression=t,this.type=r,this.useIntegerZoom=o,this.zoom=u,this.layerId=m,this.zoomInPaintVertexArray=new f,this.zoomOutPaintVertexArray=new f}populatePaintArray(t,r,o){let u=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(t),this.zoomOutPaintVertexArray.resize(t),this._setPaintValues(u,t,r.patterns&&r.patterns[this.layerId],o)}updatePaintArray(t,r,o,u,f){this._setPaintValues(t,r,o.patterns&&o.patterns[this.layerId],f)}_setPaintValues(t,r,o,u){if(!u||!o)return;let{min:f,mid:m,max:x}=o,b=u[f],E=u[m],A=u[x];if(b&&E&&A)for(let z=t;z<r;z++)this.zoomInPaintVertexArray.emplace(z,E.tl[0],E.tl[1],E.br[0],E.br[1],b.tl[0],b.tl[1],b.br[0],b.br[1],E.pixelRatio,b.pixelRatio),this.zoomOutPaintVertexArray.emplace(z,E.tl[0],E.tl[1],E.br[0],E.br[1],A.tl[0],A.tl[1],A.br[0],A.br[1],E.pixelRatio,A.pixelRatio)}upload(t){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=t.createVertexBuffer(this.zoomInPaintVertexArray,Pi.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=t.createVertexBuffer(this.zoomOutPaintVertexArray,Pi.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class gp{constructor(t,r,o){this.binders={},this._buffers=[];let u=[];for(let f in t.paint._values){if(!o(f))continue;let m=t.paint.get(f);if(!(m instanceof an&&_s(m.property.specification)))continue;let x=_g(f,t.type),b=m.value,E=m.property.specification.type,A=m.property.useIntegerZoom,z=m.property.specification["property-type"],R=z==="cross-faded"||z==="cross-faded-data-driven";if(b.kind==="constant")this.binders[f]=R?new to(b.value,x):new gl(b.value,x,E),u.push(`/u_${f}`);else if(b.kind==="source"||R){let O=yp(f,E,"source");this.binders[f]=R?new Cs(b,E,A,r,O,t.id):new Hn(b,x,E,O),u.push(`/a_${f}`)}else{let O=yp(f,E,"composite");this.binders[f]=new yn(b,x,E,A,r,O),u.push(`/z_${f}`)}}this.cacheKey=u.sort().join("")}getMaxValue(t){let r=this.binders[t];return r instanceof Hn||r instanceof yn?r.maxValue:0}populatePaintArrays(t,r,o,u,f){for(let m in this.binders){let x=this.binders[m];(x instanceof Hn||x instanceof yn||x instanceof Cs)&&x.populatePaintArray(t,r,o,u,f)}}setConstantPatternPositions(t,r){for(let o in this.binders){let u=this.binders[o];u instanceof to&&u.setConstantPatternPositions(t,r)}}updatePaintArrays(t,r,o,u,f){let m=!1;for(let x in t){let b=r.getPositions(x);for(let E of b){let A=o.feature(E.index);for(let z in this.binders){let R=this.binders[z];if((R instanceof Hn||R instanceof yn||R instanceof Cs)&&R.expression.isStateDependent===!0){let O=u.paint.get(z);R.expression=O.value,R.updatePaintArray(E.start,E.end,A,t[x],f),m=!0}}}}return m}defines(){let t=[];for(let r in this.binders){let o=this.binders[r];(o instanceof gl||o instanceof to)&&t.push(...o.uniformNames.map(u=>`#define HAS_UNIFORM_${u}`))}return t}getBinderAttributes(){let t=[];for(let r in this.binders){let o=this.binders[r];if(o instanceof Hn||o instanceof yn)for(let u=0;u<o.paintVertexAttributes.length;u++)t.push(o.paintVertexAttributes[u].name);else if(o instanceof Cs)for(let u=0;u<Pi.members.length;u++)t.push(Pi.members[u].name)}return t}getBinderUniforms(){let t=[];for(let r in this.binders){let o=this.binders[r];if(o instanceof gl||o instanceof to||o instanceof yn)for(let u of o.uniformNames)t.push(u)}return t}getPaintVertexBuffers(){return this._buffers}getUniforms(t,r){let o=[];for(let u in this.binders){let f=this.binders[u];if(f instanceof gl||f instanceof to||f instanceof yn){for(let m of f.uniformNames)if(r[m]){let x=f.getBinding(t,r[m],m);o.push({name:m,property:u,binding:x})}}}return o}setUniforms(t,r,o,u){for(let{name:f,property:m,binding:x}of r)this.binders[m].setUniform(x,u,o.get(m),f)}updatePaintBuffers(t){this._buffers=[];for(let r in this.binders){let o=this.binders[r];if(t&&o instanceof Cs){let u=t.fromScale===2?o.zoomInPaintVertexBuffer:o.zoomOutPaintVertexBuffer;u&&this._buffers.push(u)}else(o instanceof Hn||o instanceof yn)&&o.paintVertexBuffer&&this._buffers.push(o.paintVertexBuffer)}}upload(t){for(let r in this.binders){let o=this.binders[r];(o instanceof Hn||o instanceof yn||o instanceof Cs)&&o.upload(t)}this.updatePaintBuffers()}destroy(){for(let t in this.binders){let r=this.binders[t];(r instanceof Hn||r instanceof yn||r instanceof Cs)&&r.destroy()}}}class la{constructor(t,r,o=()=>!0){this.programConfigurations={};for(let u of t)this.programConfigurations[u.id]=new gp(u,r,o);this.needsUpload=!1,this._featureMap=new Ja,this._bufferOffset=0}populatePaintArrays(t,r,o,u,f,m){for(let x in this.programConfigurations)this.programConfigurations[x].populatePaintArrays(t,r,u,f,m);r.id!==void 0&&this._featureMap.add(r.id,o,this._bufferOffset,t),this._bufferOffset=t,this.needsUpload=!0}updatePaintArrays(t,r,o,u){for(let f of o)this.needsUpload=this.programConfigurations[f.id].updatePaintArrays(t,this._featureMap,r,f,u)||this.needsUpload}get(t){return this.programConfigurations[t]}upload(t){if(this.needsUpload){for(let r in this.programConfigurations)this.programConfigurations[r].upload(t);this.needsUpload=!1}}destroy(){for(let t in this.programConfigurations)this.programConfigurations[t].destroy()}}function _g(i,t){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[i]||[i.replace(`${t}-`,"").replace(/-/g,"_")]}function yp(i,t,r){let o={color:{source:n,composite:ut},number:{source:$,composite:n}},u=function(f){return{"line-pattern":{source:ti,composite:ti},"fill-pattern":{source:ti,composite:ti},"fill-extrusion-pattern":{source:ti,composite:ti}}[f]}(i);return u&&u[r]||o[t][r]}te("ConstantBinder",gl),te("CrossFadedConstantBinder",to),te("SourceExpressionBinder",Hn),te("CrossFadedCompositeBinder",Cs),te("CompositeExpressionBinder",yn),te("ProgramConfiguration",gp,{omit:["_buffers"]}),te("ProgramConfigurationSet",la);var Ui=8192;let Yc=Math.pow(2,14)-1,_p=-Yc-1;function ha(i){let t=Ui/i.extent,r=i.loadGeometry();for(let o=0;o<r.length;o++){let u=r[o];for(let f=0;f<u.length;f++){let m=u[f],x=Math.round(m.x*t),b=Math.round(m.y*t);m.x=L(x,_p,Yc),m.y=L(b,_p,Yc),(x<m.x||x>m.x+1||b<m.y||b>m.y+1)&&ne("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return r}function ca(i,t){return{type:i.type,id:i.id,properties:i.properties,geometry:t?ha(i):[]}}function Eh(i,t,r,o,u){i.emplaceBack(2*t+(o+1)/2,2*r+(u+1)/2)}class Jc{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(r=>r.id),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new ke,this.indexArray=new ur,this.segments=new je,this.programConfigurations=new la(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(t,r,o){let u=this.layers[0],f=[],m=null,x=!1;u.type==="circle"&&(m=u.layout.get("circle-sort-key"),x=!m.isConstant());for(let{feature:b,id:E,index:A,sourceLayerIndex:z}of t){let R=this.layers[0]._featureFilter.needGeometry,O=ca(b,R);if(!this.layers[0]._featureFilter.filter(new hi(this.zoom),O,o))continue;let G=x?m.evaluate(O,{},o):void 0,et={id:E,properties:b.properties,type:b.type,sourceLayerIndex:z,index:A,geometry:R?O.geometry:ha(b),patterns:{},sortKey:G};f.push(et)}x&&f.sort((b,E)=>b.sortKey-E.sortKey);for(let b of f){let{geometry:E,index:A,sourceLayerIndex:z}=b,R=t[A].feature;this.addFeature(b,E,A,o),r.featureIndex.insert(R,E,A,z,this.index)}}update(t,r,o){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,o)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,br),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(t,r,o,u){for(let f of r)for(let m of f){let x=m.x,b=m.y;if(x<0||x>=Ui||b<0||b>=Ui)continue;let E=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,t.sortKey),A=E.vertexLength;Eh(this.layoutVertexArray,x,b,-1,-1),Eh(this.layoutVertexArray,x,b,1,-1),Eh(this.layoutVertexArray,x,b,1,1),Eh(this.layoutVertexArray,x,b,-1,1),this.indexArray.emplaceBack(A,A+1,A+2),this.indexArray.emplaceBack(A,A+3,A+2),E.vertexLength+=4,E.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,o,{},u)}}function xp(i,t){for(let r=0;r<i.length;r++)if(eo(t,i[r]))return!0;for(let r=0;r<t.length;r++)if(eo(i,t[r]))return!0;return!!Qc(i,t)}function xg(i,t,r){return!!eo(i,t)||!!tu(t,i,r)}function vp(i,t){if(i.length===1)return wp(t,i[0]);for(let r=0;r<t.length;r++){let o=t[r];for(let u=0;u<o.length;u++)if(eo(i,o[u]))return!0}for(let r=0;r<i.length;r++)if(wp(t,i[r]))return!0;for(let r=0;r<t.length;r++)if(Qc(i,t[r]))return!0;return!1}function vg(i,t,r){if(i.length>1){if(Qc(i,t))return!0;for(let o=0;o<t.length;o++)if(tu(t[o],i,r))return!0}for(let o=0;o<i.length;o++)if(tu(i[o],t,r))return!0;return!1}function Qc(i,t){if(i.length===0||t.length===0)return!1;for(let r=0;r<i.length-1;r++){let o=i[r],u=i[r+1];for(let f=0;f<t.length-1;f++)if(bg(o,u,t[f],t[f+1]))return!0}return!1}function bg(i,t,r,o){return be(i,r,o)!==be(t,r,o)&&be(i,t,r)!==be(i,t,o)}function tu(i,t,r){let o=r*r;if(t.length===1)return i.distSqr(t[0])<o;for(let u=1;u<t.length;u++)if(bp(i,t[u-1],t[u])<o)return!0;return!1}function bp(i,t,r){let o=t.distSqr(r);if(o===0)return i.distSqr(t);let u=((i.x-t.x)*(r.x-t.x)+(i.y-t.y)*(r.y-t.y))/o;return i.distSqr(u<0?t:u>1?r:r.sub(t)._mult(u)._add(t))}function wp(i,t){let r,o,u,f=!1;for(let m=0;m<i.length;m++){r=i[m];for(let x=0,b=r.length-1;x<r.length;b=x++)o=r[x],u=r[b],o.y>t.y!=u.y>t.y&&t.x<(u.x-o.x)*(t.y-o.y)/(u.y-o.y)+o.x&&(f=!f)}return f}function eo(i,t){let r=!1;for(let o=0,u=i.length-1;o<i.length;u=o++){let f=i[o],m=i[u];f.y>t.y!=m.y>t.y&&t.x<(m.x-f.x)*(t.y-f.y)/(m.y-f.y)+f.x&&(r=!r)}return r}function wg(i,t,r){let o=r[0],u=r[2];if(i.x<o.x&&t.x<o.x||i.x>u.x&&t.x>u.x||i.y<o.y&&t.y<o.y||i.y>u.y&&t.y>u.y)return!1;let f=be(i,t,r[0]);return f!==be(i,t,r[1])||f!==be(i,t,r[2])||f!==be(i,t,r[3])}function yl(i,t,r){let o=t.paint.get(i).value;return o.kind==="constant"?o.value:r.programConfigurations.get(t.id).getMaxValue(i)}function Ih(i){return Math.sqrt(i[0]*i[0]+i[1]*i[1])}function Ch(i,t,r,o,u){if(!t[0]&&!t[1])return i;let f=ye.convert(t)._mult(u);r==="viewport"&&f._rotate(-o);let m=[];for(let x=0;x<i.length;x++)m.push(i[x].sub(f));return m}te("CircleBucket",Jc,{omit:["layers"]});let Mg=new Oi({"circle-sort-key":new de(ct.layout_circle["circle-sort-key"])});var Sg={paint:new Oi({"circle-radius":new de(ct.paint_circle["circle-radius"]),"circle-color":new de(ct.paint_circle["circle-color"]),"circle-blur":new de(ct.paint_circle["circle-blur"]),"circle-opacity":new de(ct.paint_circle["circle-opacity"]),"circle-translate":new se(ct.paint_circle["circle-translate"]),"circle-translate-anchor":new se(ct.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new se(ct.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new se(ct.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new de(ct.paint_circle["circle-stroke-width"]),"circle-stroke-color":new de(ct.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new de(ct.paint_circle["circle-stroke-opacity"])}),layout:Mg},io=typeof Float32Array<"u"?Float32Array:Array;function eu(i){return i[0]=1,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=1,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=1,i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i}function Mp(i,t,r){var o=t[0],u=t[1],f=t[2],m=t[3],x=t[4],b=t[5],E=t[6],A=t[7],z=t[8],R=t[9],O=t[10],G=t[11],et=t[12],it=t[13],dt=t[14],bt=t[15],vt=r[0],Et=r[1],Rt=r[2],zt=r[3];return i[0]=vt*o+Et*x+Rt*z+zt*et,i[1]=vt*u+Et*b+Rt*R+zt*it,i[2]=vt*f+Et*E+Rt*O+zt*dt,i[3]=vt*m+Et*A+Rt*G+zt*bt,i[4]=(vt=r[4])*o+(Et=r[5])*x+(Rt=r[6])*z+(zt=r[7])*et,i[5]=vt*u+Et*b+Rt*R+zt*it,i[6]=vt*f+Et*E+Rt*O+zt*dt,i[7]=vt*m+Et*A+Rt*G+zt*bt,i[8]=(vt=r[8])*o+(Et=r[9])*x+(Rt=r[10])*z+(zt=r[11])*et,i[9]=vt*u+Et*b+Rt*R+zt*it,i[10]=vt*f+Et*E+Rt*O+zt*dt,i[11]=vt*m+Et*A+Rt*G+zt*bt,i[12]=(vt=r[12])*o+(Et=r[13])*x+(Rt=r[14])*z+(zt=r[15])*et,i[13]=vt*u+Et*b+Rt*R+zt*it,i[14]=vt*f+Et*E+Rt*O+zt*dt,i[15]=vt*m+Et*A+Rt*G+zt*bt,i}Math.hypot||(Math.hypot=function(){for(var i=0,t=arguments.length;t--;)i+=arguments[t]*arguments[t];return Math.sqrt(i)});var _l,Tg=Mp;function Ah(i,t,r){var o=t[0],u=t[1],f=t[2],m=t[3];return i[0]=r[0]*o+r[4]*u+r[8]*f+r[12]*m,i[1]=r[1]*o+r[5]*u+r[9]*f+r[13]*m,i[2]=r[2]*o+r[6]*u+r[10]*f+r[14]*m,i[3]=r[3]*o+r[7]*u+r[11]*f+r[15]*m,i}function Sp(i,t){let r=Ah([],[i.x,i.y,0,1],t);return new ye(r[0]/r[3],r[1]/r[3])}_l=new io(4),io!=Float32Array&&(_l[0]=0,_l[1]=0,_l[2]=0,_l[3]=0);class Tp extends Jc{}te("HeatmapBucket",Tp,{omit:["layers"]});var Eg={paint:new Oi({"heatmap-radius":new de(ct.paint_heatmap["heatmap-radius"]),"heatmap-weight":new de(ct.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new se(ct.paint_heatmap["heatmap-intensity"]),"heatmap-color":new fl(ct.paint_heatmap["heatmap-color"]),"heatmap-opacity":new se(ct.paint_heatmap["heatmap-opacity"])})};function iu(i,{width:t,height:r},o,u){if(u){if(u instanceof Uint8ClampedArray)u=new Uint8Array(u.buffer);else if(u.length!==t*r*o)throw new RangeError(`mismatched image size. expected: ${u.length} but got: ${t*r*o}`)}else u=new Uint8Array(t*r*o);return i.width=t,i.height=r,i.data=u,i}function Ep(i,{width:t,height:r},o){if(t===i.width&&r===i.height)return;let u=iu({},{width:t,height:r},o);ru(i,u,{x:0,y:0},{x:0,y:0},{width:Math.min(i.width,t),height:Math.min(i.height,r)},o),i.width=t,i.height=r,i.data=u.data}function ru(i,t,r,o,u,f){if(u.width===0||u.height===0)return t;if(u.width>i.width||u.height>i.height||r.x>i.width-u.width||r.y>i.height-u.height)throw new RangeError("out of range source coordinates for image copy");if(u.width>t.width||u.height>t.height||o.x>t.width-u.width||o.y>t.height-u.height)throw new RangeError("out of range destination coordinates for image copy");let m=i.data,x=t.data;for(let b=0;b<u.height;b++){let E=((r.y+b)*i.width+r.x)*f,A=((o.y+b)*t.width+o.x)*f;for(let z=0;z<u.width*f;z++)x[A+z]=m[E+z]}return t}class xl{constructor(t,r){iu(this,t,1,r)}resize(t){Ep(this,t,1)}clone(){return new xl({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,r,o,u,f){ru(t,r,o,u,f,1)}}class Kr{constructor(t,r){iu(this,t,4,r)}resize(t){Ep(this,t,4)}replace(t,r){r?this.data.set(t):this.data=t instanceof Uint8ClampedArray?new Uint8Array(t.buffer):t}clone(){return new Kr({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,r,o,u,f){ru(t,r,o,u,f,4)}}function Ip(i){let t={},r=i.resolution||256,o=i.clips?i.clips.length:1,u=i.image||new Kr({width:r,height:o}),f=(m,x,b)=>{t[i.evaluationKey]=b;let E=i.expression.evaluate(t);u.data[m+x+0]=Math.floor(255*E.r/E.a),u.data[m+x+1]=Math.floor(255*E.g/E.a),u.data[m+x+2]=Math.floor(255*E.b/E.a),u.data[m+x+3]=Math.floor(255*E.a)};if(i.clips)for(let m=0,x=0;m<o;++m,x+=4*r)for(let b=0,E=0;b<r;b++,E+=4){let A=b/(r-1),{start:z,end:R}=i.clips[m];f(x,E,z*(1-A)+R*A)}else for(let m=0,x=0;m<r;m++,x+=4)f(0,x,m/(r-1));return u}te("AlphaImage",xl),te("RGBAImage",Kr);var Ig={paint:new Oi({"hillshade-illumination-direction":new se(ct.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new se(ct.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new se(ct.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new se(ct.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new se(ct.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new se(ct.paint_hillshade["hillshade-accent-color"])})};let Cg=Ni([{name:"a_pos",components:2,type:"Int16"}],4),{members:Ag}=Cg;var nu={exports:{}};function Ph(i,t,r){r=r||2;var o,u,f,m,x,b,E,A=t&&t.length,z=A?t[0]*r:i.length,R=Cp(i,0,z,r,!0),O=[];if(!R||R.next===R.prev)return O;if(A&&(R=function(et,it,dt,bt){var vt,Et,Rt,zt=[];for(vt=0,Et=it.length;vt<Et;vt++)(Rt=Cp(et,it[vt]*bt,vt<Et-1?it[vt+1]*bt:et.length,bt,!1))===Rt.next&&(Rt.steiner=!0),zt.push(Fg(Rt));for(zt.sort(Dg),vt=0;vt<zt.length;vt++)dt=As(dt=Rg(zt[vt],dt),dt.next);return dt}(i,t,R,r)),i.length>80*r){o=f=i[0],u=m=i[1];for(var G=r;G<z;G+=r)(x=i[G])<o&&(o=x),(b=i[G+1])<u&&(u=b),x>f&&(f=x),b>m&&(m=b);E=(E=Math.max(f-o,m-u))!==0?1/E:0}return vl(R,O,r,o,u,E),O}function Cp(i,t,r,o,u){var f,m;if(u===ou(i,t,r,o)>0)for(f=t;f<r;f+=o)m=zp(f,i[f],i[f+1],m);else for(f=r-o;f>=t;f-=o)m=zp(f,i[f],i[f+1],m);return m&&zh(m,m.next)&&(wl(m),m=m.next),m}function As(i,t){if(!i)return i;t||(t=i);var r,o=i;do if(r=!1,o.steiner||!zh(o,o.next)&&Mi(o.prev,o,o.next)!==0)o=o.next;else{if(wl(o),(o=t=o.prev)===o.next)break;r=!0}while(r||o!==t);return t}function vl(i,t,r,o,u,f,m){if(i){!m&&f&&function(A,z,R,O){var G=A;do G.z===null&&(G.z=su(G.x,G.y,z,R,O)),G.prevZ=G.prev,G.nextZ=G.next,G=G.next;while(G!==A);G.prevZ.nextZ=null,G.prevZ=null,function(et){var it,dt,bt,vt,Et,Rt,zt,ee,le=1;do{for(dt=et,et=null,Et=null,Rt=0;dt;){for(Rt++,bt=dt,zt=0,it=0;it<le&&(zt++,bt=bt.nextZ);it++);for(ee=le;zt>0||ee>0&&bt;)zt!==0&&(ee===0||!bt||dt.z<=bt.z)?(vt=dt,dt=dt.nextZ,zt--):(vt=bt,bt=bt.nextZ,ee--),Et?Et.nextZ=vt:et=vt,vt.prevZ=Et,Et=vt;dt=bt}Et.nextZ=null,le*=2}while(Rt>1)}(G)}(i,o,u,f);for(var x,b,E=i;i.prev!==i.next;)if(x=i.prev,b=i.next,f?zg(i,o,u,f):Pg(i))t.push(x.i/r),t.push(i.i/r),t.push(b.i/r),wl(i),i=b.next,E=b.next;else if((i=b)===E){m?m===1?vl(i=kg(As(i),t,r),t,r,o,u,f,2):m===2&&Lg(i,t,r,o,u,f):vl(As(i),t,r,o,u,f,1);break}}}function Pg(i){var t=i.prev,r=i,o=i.next;if(Mi(t,r,o)>=0)return!1;for(var u=i.next.next;u!==i.prev;){if(ro(t.x,t.y,r.x,r.y,o.x,o.y,u.x,u.y)&&Mi(u.prev,u,u.next)>=0)return!1;u=u.next}return!0}function zg(i,t,r,o){var u=i.prev,f=i,m=i.next;if(Mi(u,f,m)>=0)return!1;for(var x=u.x>f.x?u.x>m.x?u.x:m.x:f.x>m.x?f.x:m.x,b=u.y>f.y?u.y>m.y?u.y:m.y:f.y>m.y?f.y:m.y,E=su(u.x<f.x?u.x<m.x?u.x:m.x:f.x<m.x?f.x:m.x,u.y<f.y?u.y<m.y?u.y:m.y:f.y<m.y?f.y:m.y,t,r,o),A=su(x,b,t,r,o),z=i.prevZ,R=i.nextZ;z&&z.z>=E&&R&&R.z<=A;){if(z!==i.prev&&z!==i.next&&ro(u.x,u.y,f.x,f.y,m.x,m.y,z.x,z.y)&&Mi(z.prev,z,z.next)>=0||(z=z.prevZ,R!==i.prev&&R!==i.next&&ro(u.x,u.y,f.x,f.y,m.x,m.y,R.x,R.y)&&Mi(R.prev,R,R.next)>=0))return!1;R=R.nextZ}for(;z&&z.z>=E;){if(z!==i.prev&&z!==i.next&&ro(u.x,u.y,f.x,f.y,m.x,m.y,z.x,z.y)&&Mi(z.prev,z,z.next)>=0)return!1;z=z.prevZ}for(;R&&R.z<=A;){if(R!==i.prev&&R!==i.next&&ro(u.x,u.y,f.x,f.y,m.x,m.y,R.x,R.y)&&Mi(R.prev,R,R.next)>=0)return!1;R=R.nextZ}return!0}function kg(i,t,r){var o=i;do{var u=o.prev,f=o.next.next;!zh(u,f)&&Ap(u,o,o.next,f)&&bl(u,f)&&bl(f,u)&&(t.push(u.i/r),t.push(o.i/r),t.push(f.i/r),wl(o),wl(o.next),o=i=f),o=o.next}while(o!==i);return As(o)}function Lg(i,t,r,o,u,f){var m=i;do{for(var x=m.next.next;x!==m.prev;){if(m.i!==x.i&&Og(m,x)){var b=Pp(m,x);return m=As(m,m.next),b=As(b,b.next),vl(m,t,r,o,u,f),void vl(b,t,r,o,u,f)}x=x.next}m=m.next}while(m!==i)}function Dg(i,t){return i.x-t.x}function Rg(i,t){var r=function(f,m){var x,b=m,E=f.x,A=f.y,z=-1/0;do{if(A<=b.y&&A>=b.next.y&&b.next.y!==b.y){var R=b.x+(A-b.y)*(b.next.x-b.x)/(b.next.y-b.y);if(R<=E&&R>z){if(z=R,R===E){if(A===b.y)return b;if(A===b.next.y)return b.next}x=b.x<b.next.x?b:b.next}}b=b.next}while(b!==m);if(!x)return null;if(E===z)return x;var O,G=x,et=x.x,it=x.y,dt=1/0;b=x;do E>=b.x&&b.x>=et&&E!==b.x&&ro(A<it?E:z,A,et,it,A<it?z:E,A,b.x,b.y)&&(O=Math.abs(A-b.y)/(E-b.x),bl(b,f)&&(O<dt||O===dt&&(b.x>x.x||b.x===x.x&&Bg(x,b)))&&(x=b,dt=O)),b=b.next;while(b!==G);return x}(i,t);if(!r)return t;var o=Pp(r,i),u=As(r,r.next);return As(o,o.next),t===r?u:t}function Bg(i,t){return Mi(i.prev,i,t.prev)<0&&Mi(t.next,i,i.next)<0}function su(i,t,r,o,u){return(i=1431655765&((i=858993459&((i=252645135&((i=16711935&((i=32767*(i-r)*u)|i<<8))|i<<4))|i<<2))|i<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-o)*u)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function Fg(i){var t=i,r=i;do(t.x<r.x||t.x===r.x&&t.y<r.y)&&(r=t),t=t.next;while(t!==i);return r}function ro(i,t,r,o,u,f,m,x){return(u-m)*(t-x)-(i-m)*(f-x)>=0&&(i-m)*(o-x)-(r-m)*(t-x)>=0&&(r-m)*(f-x)-(u-m)*(o-x)>=0}function Og(i,t){return i.next.i!==t.i&&i.prev.i!==t.i&&!function(r,o){var u=r;do{if(u.i!==r.i&&u.next.i!==r.i&&u.i!==o.i&&u.next.i!==o.i&&Ap(u,u.next,r,o))return!0;u=u.next}while(u!==r);return!1}(i,t)&&(bl(i,t)&&bl(t,i)&&function(r,o){var u=r,f=!1,m=(r.x+o.x)/2,x=(r.y+o.y)/2;do u.y>x!=u.next.y>x&&u.next.y!==u.y&&m<(u.next.x-u.x)*(x-u.y)/(u.next.y-u.y)+u.x&&(f=!f),u=u.next;while(u!==r);return f}(i,t)&&(Mi(i.prev,i,t.prev)||Mi(i,t.prev,t))||zh(i,t)&&Mi(i.prev,i,i.next)>0&&Mi(t.prev,t,t.next)>0)}function Mi(i,t,r){return(t.y-i.y)*(r.x-t.x)-(t.x-i.x)*(r.y-t.y)}function zh(i,t){return i.x===t.x&&i.y===t.y}function Ap(i,t,r,o){var u=Lh(Mi(i,t,r)),f=Lh(Mi(i,t,o)),m=Lh(Mi(r,o,i)),x=Lh(Mi(r,o,t));return u!==f&&m!==x||!(u!==0||!kh(i,r,t))||!(f!==0||!kh(i,o,t))||!(m!==0||!kh(r,i,o))||!(x!==0||!kh(r,t,o))}function kh(i,t,r){return t.x<=Math.max(i.x,r.x)&&t.x>=Math.min(i.x,r.x)&&t.y<=Math.max(i.y,r.y)&&t.y>=Math.min(i.y,r.y)}function Lh(i){return i>0?1:i<0?-1:0}function bl(i,t){return Mi(i.prev,i,i.next)<0?Mi(i,t,i.next)>=0&&Mi(i,i.prev,t)>=0:Mi(i,t,i.prev)<0||Mi(i,i.next,t)<0}function Pp(i,t){var r=new au(i.i,i.x,i.y),o=new au(t.i,t.x,t.y),u=i.next,f=t.prev;return i.next=t,t.prev=i,r.next=u,u.prev=r,o.next=r,r.prev=o,f.next=o,o.prev=f,o}function zp(i,t,r,o){var u=new au(i,t,r);return o?(u.next=o.next,u.prev=o,o.next.prev=u,o.next=u):(u.prev=u,u.next=u),u}function wl(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function au(i,t,r){this.i=i,this.x=t,this.y=r,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function ou(i,t,r,o){for(var u=0,f=t,m=r-o;f<r;f+=o)u+=(i[m]-i[f])*(i[f+1]+i[m+1]),m=f;return u}nu.exports=Ph,nu.exports.default=Ph,Ph.deviation=function(i,t,r,o){var u=t&&t.length,f=Math.abs(ou(i,0,u?t[0]*r:i.length,r));if(u)for(var m=0,x=t.length;m<x;m++)f-=Math.abs(ou(i,t[m]*r,m<x-1?t[m+1]*r:i.length,r));var b=0;for(m=0;m<o.length;m+=3){var E=o[m]*r,A=o[m+1]*r,z=o[m+2]*r;b+=Math.abs((i[E]-i[z])*(i[A+1]-i[E+1])-(i[E]-i[A])*(i[z+1]-i[E+1]))}return f===0&&b===0?0:Math.abs((b-f)/f)},Ph.flatten=function(i){for(var t=i[0][0].length,r={vertices:[],holes:[],dimensions:t},o=0,u=0;u<i.length;u++){for(var f=0;f<i[u].length;f++)for(var m=0;m<t;m++)r.vertices.push(i[u][f][m]);u>0&&r.holes.push(o+=i[u-1].length)}return r};var kp=nu.exports;function Ng(i,t,r,o,u){Lp(i,t,r||0,o||i.length-1,u||Ug)}function Lp(i,t,r,o,u){for(;o>r;){if(o-r>600){var f=o-r+1,m=t-r+1,x=Math.log(f),b=.5*Math.exp(2*x/3),E=.5*Math.sqrt(x*b*(f-b)/f)*(m-f/2<0?-1:1);Lp(i,t,Math.max(r,Math.floor(t-m*b/f+E)),Math.min(o,Math.floor(t+(f-m)*b/f+E)),u)}var A=i[t],z=r,R=o;for(Ml(i,r,t),u(i[o],A)>0&&Ml(i,r,o);z<R;){for(Ml(i,z,R),z++,R--;u(i[z],A)<0;)z++;for(;u(i[R],A)>0;)R--}u(i[r],A)===0?Ml(i,r,R):Ml(i,++R,o),R<=t&&(r=R+1),t<=R&&(o=R-1)}}function Ml(i,t,r){var o=i[t];i[t]=i[r],i[r]=o}function Ug(i,t){return i<t?-1:i>t?1:0}function lu(i,t){let r=i.length;if(r<=1)return[i];let o=[],u,f;for(let m=0;m<r;m++){let x=xe(i[m]);x!==0&&(i[m].area=Math.abs(x),f===void 0&&(f=x<0),f===x<0?(u&&o.push(u),u=[i[m]]):u.push(i[m]))}if(u&&o.push(u),t>1)for(let m=0;m<o.length;m++)o[m].length<=t||(Ng(o[m],t,1,o[m].length-1,Vg),o[m]=o[m].slice(0,t));return o}function Vg(i,t){return t.area-i.area}function hu(i,t,r){let o=r.patternDependencies,u=!1;for(let f of t){let m=f.paint.get(`${i}-pattern`);m.isConstant()||(u=!0);let x=m.constantOr(null);x&&(u=!0,o[x.to]=!0,o[x.from]=!0)}return u}function cu(i,t,r,o,u){let f=u.patternDependencies;for(let m of t){let x=m.paint.get(`${i}-pattern`).value;if(x.kind!=="constant"){let b=x.evaluate({zoom:o-1},r,{},u.availableImages),E=x.evaluate({zoom:o},r,{},u.availableImages),A=x.evaluate({zoom:o+1},r,{},u.availableImages);b=b&&b.name?b.name:b,E=E&&E.name?E.name:E,A=A&&A.name?A.name:A,f[b]=!0,f[E]=!0,f[A]=!0,r.patterns[m.id]={min:b,mid:E,max:A}}}return r}class uu{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(r=>r.id),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new Re,this.indexArray=new ur,this.indexArray2=new on,this.programConfigurations=new la(t.layers,t.zoom),this.segments=new je,this.segments2=new je,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(t,r,o){this.hasPattern=hu("fill",this.layers,r);let u=this.layers[0].layout.get("fill-sort-key"),f=!u.isConstant(),m=[];for(let{feature:x,id:b,index:E,sourceLayerIndex:A}of t){let z=this.layers[0]._featureFilter.needGeometry,R=ca(x,z);if(!this.layers[0]._featureFilter.filter(new hi(this.zoom),R,o))continue;let O=f?u.evaluate(R,{},o,r.availableImages):void 0,G={id:b,properties:x.properties,type:x.type,sourceLayerIndex:A,index:E,geometry:z?R.geometry:ha(x),patterns:{},sortKey:O};m.push(G)}f&&m.sort((x,b)=>x.sortKey-b.sortKey);for(let x of m){let{geometry:b,index:E,sourceLayerIndex:A}=x;if(this.hasPattern){let z=cu("fill",this.layers,x,this.zoom,r);this.patternFeatures.push(z)}else this.addFeature(x,b,E,o,{});r.featureIndex.insert(t[E].feature,b,E,A,this.index)}}update(t,r,o){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,o)}addFeatures(t,r,o){for(let u of this.patternFeatures)this.addFeature(u,u.geometry,u.index,r,o)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Ag),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.indexBuffer2=t.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(t),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(t,r,o,u,f){for(let m of lu(r,500)){let x=0;for(let O of m)x+=O.length;let b=this.segments.prepareSegment(x,this.layoutVertexArray,this.indexArray),E=b.vertexLength,A=[],z=[];for(let O of m){if(O.length===0)continue;O!==m[0]&&z.push(A.length/2);let G=this.segments2.prepareSegment(O.length,this.layoutVertexArray,this.indexArray2),et=G.vertexLength;this.layoutVertexArray.emplaceBack(O[0].x,O[0].y),this.indexArray2.emplaceBack(et+O.length-1,et),A.push(O[0].x),A.push(O[0].y);for(let it=1;it<O.length;it++)this.layoutVertexArray.emplaceBack(O[it].x,O[it].y),this.indexArray2.emplaceBack(et+it-1,et+it),A.push(O[it].x),A.push(O[it].y);G.vertexLength+=O.length,G.primitiveLength+=O.length}let R=kp(A,z);for(let O=0;O<R.length;O+=3)this.indexArray.emplaceBack(E+R[O],E+R[O+1],E+R[O+2]);b.vertexLength+=x,b.primitiveLength+=R.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,o,f,u)}}te("FillBucket",uu,{omit:["layers","patternFeatures"]});let Gg=new Oi({"fill-sort-key":new de(ct.layout_fill["fill-sort-key"])});var qg={paint:new Oi({"fill-antialias":new se(ct.paint_fill["fill-antialias"]),"fill-opacity":new de(ct.paint_fill["fill-opacity"]),"fill-color":new de(ct.paint_fill["fill-color"]),"fill-outline-color":new de(ct.paint_fill["fill-outline-color"]),"fill-translate":new se(ct.paint_fill["fill-translate"]),"fill-translate-anchor":new se(ct.paint_fill["fill-translate-anchor"]),"fill-pattern":new na(ct.paint_fill["fill-pattern"])}),layout:Gg};let jg=Ni([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),{members:$g}=jg;var Ps={},Wg=ye,Dp=no;function no(i,t,r,o,u){this.properties={},this.extent=r,this.type=0,this._pbf=i,this._geometry=-1,this._keys=o,this._values=u,i.readFields(Zg,this,t)}function Zg(i,t,r){i==1?t.id=r.readVarint():i==2?function(o,u){for(var f=o.readVarint()+o.pos;o.pos<f;){var m=u._keys[o.readVarint()],x=u._values[o.readVarint()];u.properties[m]=x}}(r,t):i==3?t.type=r.readVarint():i==4&&(t._geometry=r.pos)}function Hg(i){for(var t,r,o=0,u=0,f=i.length,m=f-1;u<f;m=u++)o+=((r=i[m]).x-(t=i[u]).x)*(t.y+r.y);return o}no.types=["Unknown","Point","LineString","Polygon"],no.prototype.loadGeometry=function(){var i=this._pbf;i.pos=this._geometry;for(var t,r=i.readVarint()+i.pos,o=1,u=0,f=0,m=0,x=[];i.pos<r;){if(u<=0){var b=i.readVarint();o=7&b,u=b>>3}if(u--,o===1||o===2)f+=i.readSVarint(),m+=i.readSVarint(),o===1&&(t&&x.push(t),t=[]),t.push(new Wg(f,m));else{if(o!==7)throw new Error("unknown command "+o);t&&t.push(t[0].clone())}}return t&&x.push(t),x},no.prototype.bbox=function(){var i=this._pbf;i.pos=this._geometry;for(var t=i.readVarint()+i.pos,r=1,o=0,u=0,f=0,m=1/0,x=-1/0,b=1/0,E=-1/0;i.pos<t;){if(o<=0){var A=i.readVarint();r=7&A,o=A>>3}if(o--,r===1||r===2)(u+=i.readSVarint())<m&&(m=u),u>x&&(x=u),(f+=i.readSVarint())<b&&(b=f),f>E&&(E=f);else if(r!==7)throw new Error("unknown command "+r)}return[m,b,x,E]},no.prototype.toGeoJSON=function(i,t,r){var o,u,f=this.extent*Math.pow(2,r),m=this.extent*i,x=this.extent*t,b=this.loadGeometry(),E=no.types[this.type];function A(O){for(var G=0;G<O.length;G++){var et=O[G];O[G]=[360*(et.x+m)/f-180,360/Math.PI*Math.atan(Math.exp((180-360*(et.y+x)/f)*Math.PI/180))-90]}}switch(this.type){case 1:var z=[];for(o=0;o<b.length;o++)z[o]=b[o][0];A(b=z);break;case 2:for(o=0;o<b.length;o++)A(b[o]);break;case 3:for(b=function(O){var G=O.length;if(G<=1)return[O];for(var et,it,dt=[],bt=0;bt<G;bt++){var vt=Hg(O[bt]);vt!==0&&(it===void 0&&(it=vt<0),it===vt<0?(et&&dt.push(et),et=[O[bt]]):et.push(O[bt]))}return et&&dt.push(et),dt}(b),o=0;o<b.length;o++)for(u=0;u<b[o].length;u++)A(b[o][u])}b.length===1?b=b[0]:E="Multi"+E;var R={type:"Feature",geometry:{type:E,coordinates:b},properties:this.properties};return"id"in this&&(R.id=this.id),R};var Xg=Dp,Rp=Bp;function Bp(i,t){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=i,this._keys=[],this._values=[],this._features=[],i.readFields(Kg,this,t),this.length=this._features.length}function Kg(i,t,r){i===15?t.version=r.readVarint():i===1?t.name=r.readString():i===5?t.extent=r.readVarint():i===2?t._features.push(r.pos):i===3?t._keys.push(r.readString()):i===4&&t._values.push(function(o){for(var u=null,f=o.readVarint()+o.pos;o.pos<f;){var m=o.readVarint()>>3;u=m===1?o.readString():m===2?o.readFloat():m===3?o.readDouble():m===4?o.readVarint64():m===5?o.readVarint():m===6?o.readSVarint():m===7?o.readBoolean():null}return u}(r))}Bp.prototype.feature=function(i){if(i<0||i>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[i];var t=this._pbf.readVarint()+this._pbf.pos;return new Xg(this._pbf,t,this.extent,this._keys,this._values)};var Yg=Rp;function Jg(i,t,r){if(i===3){var o=new Yg(r,r.readVarint()+r.pos);o.length&&(t[o.name]=o)}}Ps.VectorTile=function(i,t){this.layers=i.readFields(Jg,{},t)},Ps.VectorTileFeature=Dp,Ps.VectorTileLayer=Rp;let Qg=Ps.VectorTileFeature.types,pu=Math.pow(2,13);function Sl(i,t,r,o,u,f,m,x){i.emplaceBack(t,r,2*Math.floor(o*pu)+m,u*pu*2,f*pu*2,Math.round(x))}class du{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(r=>r.id),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new yi,this.indexArray=new ur,this.programConfigurations=new la(t.layers,t.zoom),this.segments=new je,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(t,r,o){this.features=[],this.hasPattern=hu("fill-extrusion",this.layers,r);for(let{feature:u,id:f,index:m,sourceLayerIndex:x}of t){let b=this.layers[0]._featureFilter.needGeometry,E=ca(u,b);if(!this.layers[0]._featureFilter.filter(new hi(this.zoom),E,o))continue;let A={id:f,sourceLayerIndex:x,index:m,geometry:b?E.geometry:ha(u),properties:u.properties,type:u.type,patterns:{}};this.hasPattern?this.features.push(cu("fill-extrusion",this.layers,A,this.zoom,r)):this.addFeature(A,A.geometry,m,o,{}),r.featureIndex.insert(u,A.geometry,m,x,this.index,!0)}}addFeatures(t,r,o){for(let u of this.features){let{geometry:f}=u;this.addFeature(u,f,u.index,r,o)}}update(t,r,o){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,o)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,$g),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(t,r,o,u,f){for(let m of lu(r,500)){let x=0;for(let O of m)x+=O.length;let b=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(let O of m){if(O.length===0||ey(O))continue;let G=0;for(let et=0;et<O.length;et++){let it=O[et];if(et>=1){let dt=O[et-1];if(!ty(it,dt)){b.vertexLength+4>je.MAX_VERTEX_ARRAY_LENGTH&&(b=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));let bt=it.sub(dt)._perp()._unit(),vt=dt.dist(it);G+vt>32768&&(G=0),Sl(this.layoutVertexArray,it.x,it.y,bt.x,bt.y,0,0,G),Sl(this.layoutVertexArray,it.x,it.y,bt.x,bt.y,0,1,G),G+=vt,Sl(this.layoutVertexArray,dt.x,dt.y,bt.x,bt.y,0,0,G),Sl(this.layoutVertexArray,dt.x,dt.y,bt.x,bt.y,0,1,G);let Et=b.vertexLength;this.indexArray.emplaceBack(Et,Et+2,Et+1),this.indexArray.emplaceBack(Et+1,Et+2,Et+3),b.vertexLength+=4,b.primitiveLength+=2}}}}if(b.vertexLength+x>je.MAX_VERTEX_ARRAY_LENGTH&&(b=this.segments.prepareSegment(x,this.layoutVertexArray,this.indexArray)),Qg[t.type]!=="Polygon")continue;let E=[],A=[],z=b.vertexLength;for(let O of m)if(O.length!==0){O!==m[0]&&A.push(E.length/2);for(let G=0;G<O.length;G++){let et=O[G];Sl(this.layoutVertexArray,et.x,et.y,0,0,1,1,0),E.push(et.x),E.push(et.y)}}let R=kp(E,A);for(let O=0;O<R.length;O+=3)this.indexArray.emplaceBack(z+R[O],z+R[O+2],z+R[O+1]);b.primitiveLength+=R.length/3,b.vertexLength+=x}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,o,f,u)}}function ty(i,t){return i.x===t.x&&(i.x<0||i.x>Ui)||i.y===t.y&&(i.y<0||i.y>Ui)}function ey(i){return i.every(t=>t.x<0)||i.every(t=>t.x>Ui)||i.every(t=>t.y<0)||i.every(t=>t.y>Ui)}te("FillExtrusionBucket",du,{omit:["layers","features"]});var iy={paint:new Oi({"fill-extrusion-opacity":new se(ct["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new de(ct["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new se(ct["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new se(ct["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new na(ct["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new de(ct["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new de(ct["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new se(ct["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})};function Tl(i,t){return i.x*t.x+i.y*t.y}function Fp(i,t){if(i.length===1){let r=0,o=t[r++],u;for(;!u||o.equals(u);)if(u=t[r++],!u)return 1/0;for(;r<t.length;r++){let f=t[r],m=i[0],x=u.sub(o),b=f.sub(o),E=m.sub(o),A=Tl(x,x),z=Tl(x,b),R=Tl(b,b),O=Tl(E,x),G=Tl(E,b),et=A*R-z*z,it=(R*O-z*G)/et,dt=(A*G-z*O)/et,bt=o.z*(1-it-dt)+u.z*it+f.z*dt;if(isFinite(bt))return bt}return 1/0}{let r=1/0;for(let o of t)r=Math.min(r,o.z);return r}}let ry=Ni([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:ny}=ry,sy=Ni([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:ay}=sy,oy=Ps.VectorTileFeature.types,ly=Math.cos(Math.PI/180*37.5),Op=Math.pow(2,14)/.5;class fu{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(r=>r.id),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(r=>{this.gradients[r.id]={}}),this.layoutVertexArray=new we,this.layoutVertexArray2=new qe,this.indexArray=new ur,this.programConfigurations=new la(t.layers,t.zoom),this.segments=new je,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(t,r,o){this.hasPattern=hu("line",this.layers,r);let u=this.layers[0].layout.get("line-sort-key"),f=!u.isConstant(),m=[];for(let{feature:x,id:b,index:E,sourceLayerIndex:A}of t){let z=this.layers[0]._featureFilter.needGeometry,R=ca(x,z);if(!this.layers[0]._featureFilter.filter(new hi(this.zoom),R,o))continue;let O=f?u.evaluate(R,{},o):void 0,G={id:b,properties:x.properties,type:x.type,sourceLayerIndex:A,index:E,geometry:z?R.geometry:ha(x),patterns:{},sortKey:O};m.push(G)}f&&m.sort((x,b)=>x.sortKey-b.sortKey);for(let x of m){let{geometry:b,index:E,sourceLayerIndex:A}=x;if(this.hasPattern){let z=cu("line",this.layers,x,this.zoom,r);this.patternFeatures.push(z)}else this.addFeature(x,b,E,o,{});r.featureIndex.insert(t[E].feature,b,E,A,this.index)}}update(t,r,o){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,o)}addFeatures(t,r,o){for(let u of this.patternFeatures)this.addFeature(u,u.geometry,u.index,r,o)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=t.createVertexBuffer(this.layoutVertexArray2,ay)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,ny),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(t){if(t.properties&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_end"))return{start:+t.properties.mapbox_clip_start,end:+t.properties.mapbox_clip_end}}addFeature(t,r,o,u,f){let m=this.layers[0].layout,x=m.get("line-join").evaluate(t,{}),b=m.get("line-cap"),E=m.get("line-miter-limit"),A=m.get("line-round-limit");this.lineClips=this.lineFeatureClips(t);for(let z of r)this.addLine(z,t,x,b,E,A);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,o,f,u)}addLine(t,r,o,u,f,m){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let dt=0;dt<t.length-1;dt++)this.totalDistance+=t[dt].dist(t[dt+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}let x=oy[r.type]==="Polygon",b=t.length;for(;b>=2&&t[b-1].equals(t[b-2]);)b--;let E=0;for(;E<b-1&&t[E].equals(t[E+1]);)E++;if(b<(x?3:2))return;o==="bevel"&&(f=1.05);let A=this.overscaling<=16?122880/(512*this.overscaling):0,z=this.segments.prepareSegment(10*b,this.layoutVertexArray,this.indexArray),R,O,G,et,it;this.e1=this.e2=-1,x&&(R=t[b-2],it=t[E].sub(R)._unit()._perp());for(let dt=E;dt<b;dt++){if(G=dt===b-1?x?t[E+1]:void 0:t[dt+1],G&&t[dt].equals(G))continue;it&&(et=it),R&&(O=R),R=t[dt],it=G?G.sub(R)._unit()._perp():et,et=et||it;let bt=et.add(it);bt.x===0&&bt.y===0||bt._unit();let vt=et.x*it.x+et.y*it.y,Et=bt.x*it.x+bt.y*it.y,Rt=Et!==0?1/Et:1/0,zt=2*Math.sqrt(2-2*Et),ee=Et<ly&&O&&G,le=et.x*it.y-et.y*it.x>0;if(ee&&dt>E){let Wt=R.dist(O);if(Wt>2*A){let Qt=R.sub(R.sub(O)._mult(A/Wt)._round());this.updateDistance(O,Qt),this.addCurrentVertex(Qt,et,0,0,z),O=Qt}}let Xt=O&&G,Kt=Xt?o:x?"butt":u;if(Xt&&Kt==="round"&&(Rt<m?Kt="miter":Rt<=2&&(Kt="fakeround")),Kt==="miter"&&Rt>f&&(Kt="bevel"),Kt==="bevel"&&(Rt>2&&(Kt="flipbevel"),Rt<f&&(Kt="miter")),O&&this.updateDistance(O,R),Kt==="miter")bt._mult(Rt),this.addCurrentVertex(R,bt,0,0,z);else if(Kt==="flipbevel"){if(Rt>100)bt=it.mult(-1);else{let Wt=Rt*et.add(it).mag()/et.sub(it).mag();bt._perp()._mult(Wt*(le?-1:1))}this.addCurrentVertex(R,bt,0,0,z),this.addCurrentVertex(R,bt.mult(-1),0,0,z)}else if(Kt==="bevel"||Kt==="fakeround"){let Wt=-Math.sqrt(Rt*Rt-1),Qt=le?Wt:0,Yt=le?0:Wt;if(O&&this.addCurrentVertex(R,et,Qt,Yt,z),Kt==="fakeround"){let Gt=Math.round(180*zt/Math.PI/20);for(let fe=1;fe<Gt;fe++){let ue=fe/Gt;if(ue!==.5){let Ke=ue-.5;ue+=ue*Ke*(ue-1)*((1.0904+vt*(vt*(3.55645-1.43519*vt)-3.2452))*Ke*Ke+(.848013+vt*(.215638*vt-1.06021)))}let Be=it.sub(et)._mult(ue)._add(et)._unit()._mult(le?-1:1);this.addHalfVertex(R,Be.x,Be.y,!1,le,0,z)}}G&&this.addCurrentVertex(R,it,-Qt,-Yt,z)}else if(Kt==="butt")this.addCurrentVertex(R,bt,0,0,z);else if(Kt==="square"){let Wt=O?1:-1;this.addCurrentVertex(R,bt,Wt,Wt,z)}else Kt==="round"&&(O&&(this.addCurrentVertex(R,et,0,0,z),this.addCurrentVertex(R,et,1,1,z,!0)),G&&(this.addCurrentVertex(R,it,-1,-1,z,!0),this.addCurrentVertex(R,it,0,0,z)));if(ee&&dt<b-1){let Wt=R.dist(G);if(Wt>2*A){let Qt=R.add(G.sub(R)._mult(A/Wt)._round());this.updateDistance(R,Qt),this.addCurrentVertex(Qt,it,0,0,z),R=Qt}}}}addCurrentVertex(t,r,o,u,f,m=!1){let x=r.y*u-r.x,b=-r.y-r.x*u;this.addHalfVertex(t,r.x+r.y*o,r.y-r.x*o,m,!1,o,f),this.addHalfVertex(t,x,b,m,!0,-u,f),this.distance>Op/2&&this.totalDistance===0&&(this.distance=0,this.addCurrentVertex(t,r,o,u,f,m))}addHalfVertex({x:t,y:r},o,u,f,m,x,b){let E=.5*(this.lineClips?this.scaledDistance*(Op-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((t<<1)+(f?1:0),(r<<1)+(m?1:0),Math.round(63*o)+128,Math.round(63*u)+128,1+(x===0?0:x<0?-1:1)|(63&E)<<2,E>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);let A=b.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,A),b.primitiveLength++),m?this.e2=A:this.e1=A}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(t,r){this.distance+=t.dist(r),this.updateScaledDistance()}}te("LineBucket",fu,{omit:["layers","patternFeatures"]});let hy=new Oi({"line-cap":new se(ct.layout_line["line-cap"]),"line-join":new de(ct.layout_line["line-join"]),"line-miter-limit":new se(ct.layout_line["line-miter-limit"]),"line-round-limit":new se(ct.layout_line["line-round-limit"]),"line-sort-key":new de(ct.layout_line["line-sort-key"])});var Np={paint:new Oi({"line-opacity":new de(ct.paint_line["line-opacity"]),"line-color":new de(ct.paint_line["line-color"]),"line-translate":new se(ct.paint_line["line-translate"]),"line-translate-anchor":new se(ct.paint_line["line-translate-anchor"]),"line-width":new de(ct.paint_line["line-width"]),"line-gap-width":new de(ct.paint_line["line-gap-width"]),"line-offset":new de(ct.paint_line["line-offset"]),"line-blur":new de(ct.paint_line["line-blur"]),"line-dasharray":new sa(ct.paint_line["line-dasharray"]),"line-pattern":new na(ct.paint_line["line-pattern"]),"line-gradient":new fl(ct.paint_line["line-gradient"])}),layout:hy};let Up=new class extends de{possiblyEvaluate(i,t){return t=new hi(Math.floor(t.zoom),{now:t.now,fadeDuration:t.fadeDuration,zoomHistory:t.zoomHistory,transition:t.transition}),super.possiblyEvaluate(i,t)}evaluate(i,t,r,o){return t=pt({},t,{zoom:Math.floor(t.zoom)}),super.evaluate(i,t,r,o)}}(Np.paint.properties["line-width"].specification);function Vp(i,t){return t>0?t+2*i:i}Up.useIntegerZoom=!0;let cy=Ni([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),uy=Ni([{name:"a_projected_pos",components:3,type:"Float32"}],4);Ni([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);let py=Ni([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]);Ni([{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"}]);let Gp=Ni([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),dy=Ni([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function fy(i,t,r){return i.sections.forEach(o=>{o.text=function(u,f,m){let x=f.layout.get("text-transform").evaluate(m,{});return x==="uppercase"?u=u.toLocaleUpperCase():x==="lowercase"&&(u=u.toLocaleLowerCase()),Br.applyArabicShaping&&(u=Br.applyArabicShaping(u)),u}(o.text,t,r)}),i}Ni([{name:"triangle",components:3,type:"Uint16"}]),Ni([{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"}]),Ni([{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"}]),Ni([{type:"Float32",name:"offsetX"}]),Ni([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]);let El={"!":"\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,mu=ei,qp=function(i,t,r,o,u){var f,m,x=8*u-o-1,b=(1<<x)-1,E=b>>1,A=-7,z=r?u-1:0,R=r?-1:1,O=i[t+z];for(z+=R,f=O&(1<<-A)-1,O>>=-A,A+=x;A>0;f=256*f+i[t+z],z+=R,A-=8);for(m=f&(1<<-A)-1,f>>=-A,A+=o;A>0;m=256*m+i[t+z],z+=R,A-=8);if(f===0)f=1-E;else{if(f===b)return m?NaN:1/0*(O?-1:1);m+=Math.pow(2,o),f-=E}return(O?-1:1)*m*Math.pow(2,f-o)},jp=function(i,t,r,o,u,f){var m,x,b,E=8*f-u-1,A=(1<<E)-1,z=A>>1,R=u===23?Math.pow(2,-24)-Math.pow(2,-77):0,O=o?0:f-1,G=o?1:-1,et=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(x=isNaN(t)?1:0,m=A):(m=Math.floor(Math.log(t)/Math.LN2),t*(b=Math.pow(2,-m))<1&&(m--,b*=2),(t+=m+z>=1?R/b:R*Math.pow(2,1-z))*b>=2&&(m++,b/=2),m+z>=A?(x=0,m=A):m+z>=1?(x=(t*b-1)*Math.pow(2,u),m+=z):(x=t*Math.pow(2,z-1)*Math.pow(2,u),m=0));u>=8;i[r+O]=255&x,O+=G,x/=256,u-=8);for(m=m<<u|x,E+=u;E>0;i[r+O]=255&m,O+=G,m/=256,E-=8);i[r+O-G]|=128*et};function ei(i){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(i)?i:new Uint8Array(i||0),this.pos=0,this.type=0,this.length=this.buf.length}ei.Varint=0,ei.Fixed64=1,ei.Bytes=2,ei.Fixed32=5;var zs,gu=4294967296,$p=1/gu,Wp=typeof TextDecoder>"u"?null:new TextDecoder("utf8");function Xn(i){return i.type===ei.Bytes?i.readVarint()+i.pos:i.pos+1}function so(i,t,r){return r?4294967296*t+(i>>>0):4294967296*(t>>>0)+(i>>>0)}function Zp(i,t,r){var o=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(7*Math.LN2));r.realloc(o);for(var u=r.pos-1;u>=i;u--)r.buf[u+o]=r.buf[u]}function my(i,t){for(var r=0;r<i.length;r++)t.writeVarint(i[r])}function gy(i,t){for(var r=0;r<i.length;r++)t.writeSVarint(i[r])}function yy(i,t){for(var r=0;r<i.length;r++)t.writeFloat(i[r])}function _y(i,t){for(var r=0;r<i.length;r++)t.writeDouble(i[r])}function xy(i,t){for(var r=0;r<i.length;r++)t.writeBoolean(i[r])}function vy(i,t){for(var r=0;r<i.length;r++)t.writeFixed32(i[r])}function by(i,t){for(var r=0;r<i.length;r++)t.writeSFixed32(i[r])}function wy(i,t){for(var r=0;r<i.length;r++)t.writeFixed64(i[r])}function My(i,t){for(var r=0;r<i.length;r++)t.writeSFixed64(i[r])}function Dh(i,t){return(i[t]|i[t+1]<<8|i[t+2]<<16)+16777216*i[t+3]}function ao(i,t,r){i[r]=t,i[r+1]=t>>>8,i[r+2]=t>>>16,i[r+3]=t>>>24}function Hp(i,t){return(i[t]|i[t+1]<<8|i[t+2]<<16)+(i[t+3]<<24)}function Sy(i,t,r){i===1&&r.readMessage(Ty,t)}function Ty(i,t,r){if(i===3){let{id:o,bitmap:u,width:f,height:m,left:x,top:b,advance:E}=r.readMessage(Ey,{});t.push({id:o,bitmap:new xl({width:f+6,height:m+6},u),metrics:{width:f,height:m,left:x,top:b,advance:E}})}}function Ey(i,t,r){i===1?t.id=r.readVarint():i===2?t.bitmap=r.readBytes():i===3?t.width=r.readVarint():i===4?t.height=r.readVarint():i===5?t.left=r.readSVarint():i===6?t.top=r.readSVarint():i===7&&(t.advance=r.readVarint())}function Xp(i){let t=0,r=0;for(let m of i)t+=m.w*m.h,r=Math.max(r,m.w);i.sort((m,x)=>x.h-m.h);let o=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(t/.95)),r),h:1/0}],u=0,f=0;for(let m of i)for(let x=o.length-1;x>=0;x--){let b=o[x];if(!(m.w>b.w||m.h>b.h)){if(m.x=b.x,m.y=b.y,f=Math.max(f,m.y+m.h),u=Math.max(u,m.x+m.w),m.w===b.w&&m.h===b.h){let E=o.pop();x<o.length&&(o[x]=E)}else m.h===b.h?(b.x+=m.w,b.w-=m.w):m.w===b.w?(b.y+=m.h,b.h-=m.h):(o.push({x:b.x+m.w,y:b.y,w:b.w-m.w,h:m.h}),b.y+=m.h,b.h-=m.h);break}}return{w:u,h:f,fill:t/(u*f)||0}}ei.prototype={destroy:function(){this.buf=null},readFields:function(i,t,r){for(r=r||this.length;this.pos<r;){var o=this.readVarint(),u=o>>3,f=this.pos;this.type=7&o,i(u,t,this),this.pos===f&&this.skip(o)}return t},readMessage:function(i,t){return this.readFields(i,t,this.readVarint()+this.pos)},readFixed32:function(){var i=Dh(this.buf,this.pos);return this.pos+=4,i},readSFixed32:function(){var i=Hp(this.buf,this.pos);return this.pos+=4,i},readFixed64:function(){var i=Dh(this.buf,this.pos)+Dh(this.buf,this.pos+4)*gu;return this.pos+=8,i},readSFixed64:function(){var i=Dh(this.buf,this.pos)+Hp(this.buf,this.pos+4)*gu;return this.pos+=8,i},readFloat:function(){var i=qp(this.buf,this.pos,!0,23,4);return this.pos+=4,i},readDouble:function(){var i=qp(this.buf,this.pos,!0,52,8);return this.pos+=8,i},readVarint:function(i){var t,r,o=this.buf;return t=127&(r=o[this.pos++]),r<128?t:(t|=(127&(r=o[this.pos++]))<<7,r<128?t:(t|=(127&(r=o[this.pos++]))<<14,r<128?t:(t|=(127&(r=o[this.pos++]))<<21,r<128?t:function(u,f,m){var x,b,E=m.buf;if(x=(112&(b=E[m.pos++]))>>4,b<128||(x|=(127&(b=E[m.pos++]))<<3,b<128)||(x|=(127&(b=E[m.pos++]))<<10,b<128)||(x|=(127&(b=E[m.pos++]))<<17,b<128)||(x|=(127&(b=E[m.pos++]))<<24,b<128)||(x|=(1&(b=E[m.pos++]))<<31,b<128))return so(u,x,f);throw new Error("Expected varint not more than 10 bytes")}(t|=(15&(r=o[this.pos]))<<28,i,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var i=this.readVarint();return i%2==1?(i+1)/-2:i/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var i=this.readVarint()+this.pos,t=this.pos;return this.pos=i,i-t>=12&&Wp?function(r,o,u){return Wp.decode(r.subarray(o,u))}(this.buf,t,i):function(r,o,u){for(var f="",m=o;m<u;){var x,b,E,A=r[m],z=null,R=A>239?4:A>223?3:A>191?2:1;if(m+R>u)break;R===1?A<128&&(z=A):R===2?(192&(x=r[m+1]))==128&&(z=(31&A)<<6|63&x)<=127&&(z=null):R===3?(b=r[m+2],(192&(x=r[m+1]))==128&&(192&b)==128&&((z=(15&A)<<12|(63&x)<<6|63&b)<=2047||z>=55296&&z<=57343)&&(z=null)):R===4&&(b=r[m+2],E=r[m+3],(192&(x=r[m+1]))==128&&(192&b)==128&&(192&E)==128&&((z=(15&A)<<18|(63&x)<<12|(63&b)<<6|63&E)<=65535||z>=1114112)&&(z=null)),z===null?(z=65533,R=1):z>65535&&(z-=65536,f+=String.fromCharCode(z>>>10&1023|55296),z=56320|1023&z),f+=String.fromCharCode(z),m+=R}return f}(this.buf,t,i)},readBytes:function(){var i=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,i);return this.pos=i,t},readPackedVarint:function(i,t){if(this.type!==ei.Bytes)return i.push(this.readVarint(t));var r=Xn(this);for(i=i||[];this.pos<r;)i.push(this.readVarint(t));return i},readPackedSVarint:function(i){if(this.type!==ei.Bytes)return i.push(this.readSVarint());var t=Xn(this);for(i=i||[];this.pos<t;)i.push(this.readSVarint());return i},readPackedBoolean:function(i){if(this.type!==ei.Bytes)return i.push(this.readBoolean());var t=Xn(this);for(i=i||[];this.pos<t;)i.push(this.readBoolean());return i},readPackedFloat:function(i){if(this.type!==ei.Bytes)return i.push(this.readFloat());var t=Xn(this);for(i=i||[];this.pos<t;)i.push(this.readFloat());return i},readPackedDouble:function(i){if(this.type!==ei.Bytes)return i.push(this.readDouble());var t=Xn(this);for(i=i||[];this.pos<t;)i.push(this.readDouble());return i},readPackedFixed32:function(i){if(this.type!==ei.Bytes)return i.push(this.readFixed32());var t=Xn(this);for(i=i||[];this.pos<t;)i.push(this.readFixed32());return i},readPackedSFixed32:function(i){if(this.type!==ei.Bytes)return i.push(this.readSFixed32());var t=Xn(this);for(i=i||[];this.pos<t;)i.push(this.readSFixed32());return i},readPackedFixed64:function(i){if(this.type!==ei.Bytes)return i.push(this.readFixed64());var t=Xn(this);for(i=i||[];this.pos<t;)i.push(this.readFixed64());return i},readPackedSFixed64:function(i){if(this.type!==ei.Bytes)return i.push(this.readSFixed64());var t=Xn(this);for(i=i||[];this.pos<t;)i.push(this.readSFixed64());return i},skip:function(i){var t=7&i;if(t===ei.Varint)for(;this.buf[this.pos++]>127;);else if(t===ei.Bytes)this.pos=this.readVarint()+this.pos;else if(t===ei.Fixed32)this.pos+=4;else{if(t!==ei.Fixed64)throw new Error("Unimplemented type: "+t);this.pos+=8}},writeTag:function(i,t){this.writeVarint(i<<3|t)},realloc:function(i){for(var t=this.length||16;t<this.pos+i;)t*=2;if(t!==this.length){var r=new Uint8Array(t);r.set(this.buf),this.buf=r,this.length=t}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(i){this.realloc(4),ao(this.buf,i,this.pos),this.pos+=4},writeSFixed32:function(i){this.realloc(4),ao(this.buf,i,this.pos),this.pos+=4},writeFixed64:function(i){this.realloc(8),ao(this.buf,-1&i,this.pos),ao(this.buf,Math.floor(i*$p),this.pos+4),this.pos+=8},writeSFixed64:function(i){this.realloc(8),ao(this.buf,-1&i,this.pos),ao(this.buf,Math.floor(i*$p),this.pos+4),this.pos+=8},writeVarint:function(i){(i=+i||0)>268435455||i<0?function(t,r){var o,u;if(t>=0?(o=t%4294967296|0,u=t/4294967296|0):(u=~(-t/4294967296),4294967295^(o=~(-t%4294967296))?o=o+1|0:(o=0,u=u+1|0)),t>=18446744073709552e3||t<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");r.realloc(10),function(f,m,x){x.buf[x.pos++]=127&f|128,f>>>=7,x.buf[x.pos++]=127&f|128,f>>>=7,x.buf[x.pos++]=127&f|128,f>>>=7,x.buf[x.pos++]=127&f|128,x.buf[x.pos]=127&(f>>>=7)}(o,0,r),function(f,m){var x=(7&f)<<4;m.buf[m.pos++]|=x|((f>>>=3)?128:0),f&&(m.buf[m.pos++]=127&f|((f>>>=7)?128:0),f&&(m.buf[m.pos++]=127&f|((f>>>=7)?128:0),f&&(m.buf[m.pos++]=127&f|((f>>>=7)?128:0),f&&(m.buf[m.pos++]=127&f|((f>>>=7)?128:0),f&&(m.buf[m.pos++]=127&f)))))}(u,r)}(i,this):(this.realloc(4),this.buf[this.pos++]=127&i|(i>127?128:0),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|(i>127?128:0),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|(i>127?128:0),i<=127||(this.buf[this.pos++]=i>>>7&127))))},writeSVarint:function(i){this.writeVarint(i<0?2*-i-1:2*i)},writeBoolean:function(i){this.writeVarint(Boolean(i))},writeString:function(i){i=String(i),this.realloc(4*i.length),this.pos++;var t=this.pos;this.pos=function(o,u,f){for(var m,x,b=0;b<u.length;b++){if((m=u.charCodeAt(b))>55295&&m<57344){if(!x){m>56319||b+1===u.length?(o[f++]=239,o[f++]=191,o[f++]=189):x=m;continue}if(m<56320){o[f++]=239,o[f++]=191,o[f++]=189,x=m;continue}m=x-55296<<10|m-56320|65536,x=null}else x&&(o[f++]=239,o[f++]=191,o[f++]=189,x=null);m<128?o[f++]=m:(m<2048?o[f++]=m>>6|192:(m<65536?o[f++]=m>>12|224:(o[f++]=m>>18|240,o[f++]=m>>12&63|128),o[f++]=m>>6&63|128),o[f++]=63&m|128)}return f}(this.buf,i,this.pos);var r=this.pos-t;r>=128&&Zp(t,r,this),this.pos=t-1,this.writeVarint(r),this.pos+=r},writeFloat:function(i){this.realloc(4),jp(this.buf,i,this.pos,!0,23,4),this.pos+=4},writeDouble:function(i){this.realloc(8),jp(this.buf,i,this.pos,!0,52,8),this.pos+=8},writeBytes:function(i){var t=i.length;this.writeVarint(t),this.realloc(t);for(var r=0;r<t;r++)this.buf[this.pos++]=i[r]},writeRawMessage:function(i,t){this.pos++;var r=this.pos;i(t,this);var o=this.pos-r;o>=128&&Zp(r,o,this),this.pos=r-1,this.writeVarint(o),this.pos+=o},writeMessage:function(i,t,r){this.writeTag(i,ei.Bytes),this.writeRawMessage(t,r)},writePackedVarint:function(i,t){t.length&&this.writeMessage(i,my,t)},writePackedSVarint:function(i,t){t.length&&this.writeMessage(i,gy,t)},writePackedBoolean:function(i,t){t.length&&this.writeMessage(i,xy,t)},writePackedFloat:function(i,t){t.length&&this.writeMessage(i,yy,t)},writePackedDouble:function(i,t){t.length&&this.writeMessage(i,_y,t)},writePackedFixed32:function(i,t){t.length&&this.writeMessage(i,vy,t)},writePackedSFixed32:function(i,t){t.length&&this.writeMessage(i,by,t)},writePackedFixed64:function(i,t){t.length&&this.writeMessage(i,wy,t)},writePackedSFixed64:function(i,t){t.length&&this.writeMessage(i,My,t)},writeBytesField:function(i,t){this.writeTag(i,ei.Bytes),this.writeBytes(t)},writeFixed32Field:function(i,t){this.writeTag(i,ei.Fixed32),this.writeFixed32(t)},writeSFixed32Field:function(i,t){this.writeTag(i,ei.Fixed32),this.writeSFixed32(t)},writeFixed64Field:function(i,t){this.writeTag(i,ei.Fixed64),this.writeFixed64(t)},writeSFixed64Field:function(i,t){this.writeTag(i,ei.Fixed64),this.writeSFixed64(t)},writeVarintField:function(i,t){this.writeTag(i,ei.Varint),this.writeVarint(t)},writeSVarintField:function(i,t){this.writeTag(i,ei.Varint),this.writeSVarint(t)},writeStringField:function(i,t){this.writeTag(i,ei.Bytes),this.writeString(t)},writeFloatField:function(i,t){this.writeTag(i,ei.Fixed32),this.writeFloat(t)},writeDoubleField:function(i,t){this.writeTag(i,ei.Fixed64),this.writeDouble(t)},writeBooleanField:function(i,t){this.writeVarintField(i,Boolean(t))}};class yu{constructor(t,{pixelRatio:r,version:o,stretchX:u,stretchY:f,content:m}){this.paddedRect=t,this.pixelRatio=r,this.stretchX=u,this.stretchY=f,this.content=m,this.version=o}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 Kp{constructor(t,r){let o={},u={};this.haveRenderCallbacks=[];let f=[];this.addImages(t,o,f),this.addImages(r,u,f);let{w:m,h:x}=Xp(f),b=new Kr({width:m||1,height:x||1});for(let E in t){let A=t[E],z=o[E].paddedRect;Kr.copy(A.data,b,{x:0,y:0},{x:z.x+1,y:z.y+1},A.data)}for(let E in r){let A=r[E],z=u[E].paddedRect,R=z.x+1,O=z.y+1,G=A.data.width,et=A.data.height;Kr.copy(A.data,b,{x:0,y:0},{x:R,y:O},A.data),Kr.copy(A.data,b,{x:0,y:et-1},{x:R,y:O-1},{width:G,height:1}),Kr.copy(A.data,b,{x:0,y:0},{x:R,y:O+et},{width:G,height:1}),Kr.copy(A.data,b,{x:G-1,y:0},{x:R-1,y:O},{width:1,height:et}),Kr.copy(A.data,b,{x:0,y:0},{x:R+G,y:O},{width:1,height:et})}this.image=b,this.iconPositions=o,this.patternPositions=u}addImages(t,r,o){for(let u in t){let f=t[u],m={x:0,y:0,w:f.data.width+2,h:f.data.height+2};o.push(m),r[u]=new yu(m,f),f.hasRenderCallback&&this.haveRenderCallbacks.push(u)}}patchUpdatedImages(t,r){t.dispatchRenderCallbacks(this.haveRenderCallbacks);for(let o in t.updatedImages)this.patchUpdatedImage(this.iconPositions[o],t.getImage(o),r),this.patchUpdatedImage(this.patternPositions[o],t.getImage(o),r)}patchUpdatedImage(t,r,o){if(!t||!r||t.version===r.version)return;t.version=r.version;let[u,f]=t.tl;o.update(r.data,void 0,{x:u,y:f})}}te("ImagePosition",yu),te("ImageAtlas",Kp),a.WritingMode=void 0,(zs=a.WritingMode||(a.WritingMode={}))[zs.none=0]="none",zs[zs.horizontal=1]="horizontal",zs[zs.vertical=2]="vertical",zs[zs.horizontalOnly=3]="horizontalOnly";let Rh=-17;class Il{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(t,r){let o=new Il;return o.scale=t||1,o.fontStack=r,o}static forImage(t){let r=new Il;return r.imageName=t,r}}class oo{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(t,r){let o=new oo;for(let u=0;u<t.sections.length;u++){let f=t.sections[u];f.image?o.addImageSection(f):o.addTextSection(f,r)}return o}length(){return this.text.length}getSection(t){return this.sections[this.sectionIndex[t]]}getSectionIndex(t){return this.sectionIndex[t]}getCharCode(t){return this.text.charCodeAt(t)}verticalizePunctuation(){this.text=function(t){let r="";for(let o=0;o<t.length;o++){let u=t.charCodeAt(o+1)||null,f=t.charCodeAt(o-1)||null;r+=u&&xh(u)&&!El[t[o+1]]||f&&xh(f)&&!El[t[o-1]]||!El[t[o]]?t[o]:El[t[o]]}return r}(this.text)}trim(){let t=0;for(let o=0;o<this.text.length&&Fh[this.text.charCodeAt(o)];o++)t++;let r=this.text.length;for(let o=this.text.length-1;o>=0&&o>=t&&Fh[this.text.charCodeAt(o)];o--)r--;this.text=this.text.substring(t,r),this.sectionIndex=this.sectionIndex.slice(t,r)}substring(t,r){let o=new oo;return o.text=this.text.substring(t,r),o.sectionIndex=this.sectionIndex.slice(t,r),o.sections=this.sections,o}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((t,r)=>Math.max(t,this.sections[r].scale),0)}addTextSection(t,r){this.text+=t.text,this.sections.push(Il.forText(t.scale,t.fontStack||r));let o=this.sections.length-1;for(let u=0;u<t.text.length;++u)this.sectionIndex.push(o)}addImageSection(t){let r=t.image?t.image.name:"";if(r.length===0)return void ne("Can't add FormattedSection with an empty image.");let o=this.getNextImageSectionCharCode();o?(this.text+=String.fromCharCode(o),this.sections.push(Il.forImage(r)),this.sectionIndex.push(this.sections.length-1)):ne("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function Bh(i,t,r,o,u,f,m,x,b,E,A,z,R,O,G,et){let it=oo.fromFeature(i,u),dt;z===a.WritingMode.vertical&&it.verticalizePunctuation();let{processBidirectionalText:bt,processStyledBidirectionalText:vt}=Br;if(bt&&it.sections.length===1){dt=[];let zt=bt(it.toString(),_u(it,E,f,t,o,O,G));for(let ee of zt){let le=new oo;le.text=ee,le.sections=it.sections;for(let Xt=0;Xt<ee.length;Xt++)le.sectionIndex.push(0);dt.push(le)}}else if(vt){dt=[];let zt=vt(it.text,it.sectionIndex,_u(it,E,f,t,o,O,G));for(let ee of zt){let le=new oo;le.text=ee[0],le.sectionIndex=ee[1],le.sections=it.sections,dt.push(le)}}else dt=function(zt,ee){let le=[],Xt=zt.text,Kt=0;for(let Wt of ee)le.push(zt.substring(Kt,Wt)),Kt=Wt;return Kt<Xt.length&&le.push(zt.substring(Kt,Xt.length)),le}(it,_u(it,E,f,t,o,O,G));let Et=[],Rt={positionedLines:Et,text:it.toString(),top:A[1],bottom:A[1],left:A[0],right:A[0],writingMode:z,iconsInText:!1,verticalizable:!1};return function(zt,ee,le,Xt,Kt,Wt,Qt,Yt,Gt,fe,ue,Be){let Ke=0,ui=Rh,pi=0,Ji=0,zi=Yt==="right"?1:Yt==="left"?0:.5,ki=0;for(let Li of Kt){Li.trim();let tr=Li.getMaxScale(),ar=(tr-1)*Hi,pr={positionedGlyphs:[],lineOffset:0};zt.positionedLines[ki]=pr;let Mr=pr.positionedGlyphs,Sr=0;if(!Li.length()){ui+=Wt,++ki;continue}for(let ji=0;ji<Li.length();ji++){let Le=Li.getSection(ji),Nr=Li.getSectionIndex(ji),er=Li.getCharCode(ji),or=0,un=null,_n=null,xn=null,Yn=Hi,pn=!(Gt===a.WritingMode.horizontal||!ue&&!ra(er)||ue&&(Fh[er]||(qi=er,Zt.Arabic(qi)||Zt["Arabic Supplement"](qi)||Zt["Arabic Extended-A"](qi)||Zt["Arabic Presentation Forms-A"](qi)||Zt["Arabic Presentation Forms-B"](qi))));if(Le.imageName){let Yr=Xt[Le.imageName];if(!Yr)continue;xn=Le.imageName,zt.iconsInText=zt.iconsInText||!0,_n=Yr.paddedRect;let Tr=Yr.displaySize;Le.scale=Le.scale*Hi/Be,un={width:Tr[0],height:Tr[1],left:1,top:-3,advance:pn?Tr[1]:Tr[0]},or=ar+(Hi-Tr[1]*Le.scale),Yn=un.advance;let Jn=pn?Tr[0]*Le.scale-Hi*tr:Tr[1]*Le.scale-Hi*tr;Jn>0&&Jn>Sr&&(Sr=Jn)}else{let Yr=le[Le.fontStack],Tr=Yr&&Yr[er];if(Tr&&Tr.rect)_n=Tr.rect,un=Tr.metrics;else{let Jn=ee[Le.fontStack],Pl=Jn&&Jn[er];if(!Pl)continue;un=Pl.metrics}or=(tr-Le.scale)*Hi}pn?(zt.verticalizable=!0,Mr.push({glyph:er,imageName:xn,x:Ke,y:ui+or,vertical:pn,scale:Le.scale,fontStack:Le.fontStack,sectionIndex:Nr,metrics:un,rect:_n}),Ke+=Yn*Le.scale+fe):(Mr.push({glyph:er,imageName:xn,x:Ke,y:ui+or,vertical:pn,scale:Le.scale,fontStack:Le.fontStack,sectionIndex:Nr,metrics:un,rect:_n}),Ke+=un.advance*Le.scale+fe)}Mr.length!==0&&(pi=Math.max(Ke-fe,pi),Ay(Mr,0,Mr.length-1,zi,Sr)),Ke=0;let fi=Wt*tr+Sr;pr.lineOffset=Math.max(Sr,ar),ui+=fi,Ji=Math.max(fi,Ji),++ki}var qi;let Qi=ui-Rh,{horizontalAlign:sr,verticalAlign:wr}=xu(Qt);(function(Li,tr,ar,pr,Mr,Sr,fi,ji,Le){let Nr=(tr-ar)*Mr,er=0;er=Sr!==fi?-ji*pr-Rh:(-pr*Le+.5)*fi;for(let or of Li)for(let un of or.positionedGlyphs)un.x+=Nr,un.y+=er})(zt.positionedLines,zi,sr,wr,pi,Ji,Wt,Qi,Kt.length),zt.top+=-wr*Qi,zt.bottom=zt.top+Qi,zt.left+=-sr*pi,zt.right=zt.left+pi}(Rt,t,r,o,dt,m,x,b,z,E,R,et),!function(zt){for(let ee of zt)if(ee.positionedGlyphs.length!==0)return!1;return!0}(Et)&&Rt}let Fh={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Iy={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 Yp(i,t,r,o,u,f){if(t.imageName){let m=o[t.imageName];return m?m.displaySize[0]*t.scale*Hi/f+u:0}{let m=r[t.fontStack],x=m&&m[i];return x?x.metrics.advance*t.scale+u:0}}function Jp(i,t,r,o){let u=Math.pow(i-t,2);return o?i<t?u/2:2*u:u+Math.abs(r)*r}function Cy(i,t,r){let o=0;return i===10&&(o-=1e4),r&&(o+=150),i!==40&&i!==65288||(o+=50),t!==41&&t!==65289||(o+=50),o}function Qp(i,t,r,o,u,f){let m=null,x=Jp(t,r,u,f);for(let b of o){let E=Jp(t-b.x,r,u,f)+b.badness;E<=x&&(m=b,x=E)}return{index:i,x:t,priorBreak:m,badness:x}}function td(i){return i?td(i.priorBreak).concat(i.index):[]}function _u(i,t,r,o,u,f,m){if(f!=="point")return[];if(!i)return[];let x=[],b=function(R,O,G,et,it,dt){let bt=0;for(let vt=0;vt<R.length();vt++){let Et=R.getSection(vt);bt+=Yp(R.getCharCode(vt),Et,et,it,O,dt)}return bt/Math.max(1,Math.ceil(bt/G))}(i,t,r,o,u,m),E=i.text.indexOf("\u200B")>=0,A=0;for(let R=0;R<i.length();R++){let O=i.getSection(R),G=i.getCharCode(R);if(Fh[G]||(A+=Yp(G,O,o,u,t,m)),R<i.length()-1){let et=!((z=G)<11904||!(Zt["Bopomofo Extended"](z)||Zt.Bopomofo(z)||Zt["CJK Compatibility Forms"](z)||Zt["CJK Compatibility Ideographs"](z)||Zt["CJK Compatibility"](z)||Zt["CJK Radicals Supplement"](z)||Zt["CJK Strokes"](z)||Zt["CJK Symbols and Punctuation"](z)||Zt["CJK Unified Ideographs Extension A"](z)||Zt["CJK Unified Ideographs"](z)||Zt["Enclosed CJK Letters and Months"](z)||Zt["Halfwidth and Fullwidth Forms"](z)||Zt.Hiragana(z)||Zt["Ideographic Description Characters"](z)||Zt["Kangxi Radicals"](z)||Zt["Katakana Phonetic Extensions"](z)||Zt.Katakana(z)||Zt["Vertical Forms"](z)||Zt["Yi Radicals"](z)||Zt["Yi Syllables"](z)));(Iy[G]||et||O.imageName)&&x.push(Qp(R+1,A,b,x,Cy(G,i.getCharCode(R+1),et&&E),!1))}}var z;return td(Qp(i.length(),A,b,x,0,!0))}function xu(i){let t=.5,r=.5;switch(i){case"right":case"top-right":case"bottom-right":t=1;break;case"left":case"top-left":case"bottom-left":t=0}switch(i){case"bottom":case"bottom-right":case"bottom-left":r=1;break;case"top":case"top-right":case"top-left":r=0}return{horizontalAlign:t,verticalAlign:r}}function Ay(i,t,r,o,u){if(!o&&!u)return;let f=i[r],m=(i[r].x+f.metrics.advance*f.scale)*o;for(let x=t;x<=r;x++)i[x].x-=m,i[x].y+=u}function Py(i,t,r){let{horizontalAlign:o,verticalAlign:u}=xu(r),f=t[0]-i.displaySize[0]*o,m=t[1]-i.displaySize[1]*u;return{image:i,top:m,bottom:m+i.displaySize[1],left:f,right:f+i.displaySize[0]}}function ed(i,t,r,o,u,f){let m=i.image,x;if(m.content){let it=m.content,dt=m.pixelRatio||1;x=[it[0]/dt,it[1]/dt,m.displaySize[0]-it[2]/dt,m.displaySize[1]-it[3]/dt]}let b=t.left*f,E=t.right*f,A,z,R,O;r==="width"||r==="both"?(O=u[0]+b-o[3],z=u[0]+E+o[1]):(O=u[0]+(b+E-m.displaySize[0])/2,z=O+m.displaySize[0]);let G=t.top*f,et=t.bottom*f;return r==="height"||r==="both"?(A=u[1]+G-o[0],R=u[1]+et+o[2]):(A=u[1]+(G+et-m.displaySize[1])/2,R=A+m.displaySize[1]),{image:m,top:A,right:z,bottom:R,left:O,collisionPadding:x}}let Kn=128;function id(i,t){let{expression:r}=t;if(r.kind==="constant")return{kind:"constant",layoutSize:r.evaluate(new hi(i+1))};if(r.kind==="source")return{kind:"source"};{let{zoomStops:o,interpolationType:u}=r,f=0;for(;f<o.length&&o[f]<=i;)f++;f=Math.max(0,f-1);let m=f;for(;m<o.length&&o[m]<i+1;)m++;m=Math.min(o.length-1,m);let x=o[f],b=o[m];return r.kind==="composite"?{kind:"composite",minZoom:x,maxZoom:b,interpolationType:u}:{kind:"camera",minZoom:x,maxZoom:b,minSize:r.evaluate(new hi(x)),maxSize:r.evaluate(new hi(b)),interpolationType:u}}}class ks extends ye{constructor(t,r,o,u){super(t,r),this.angle=o,u!==void 0&&(this.segment=u)}clone(){return new ks(this.x,this.y,this.angle,this.segment)}}function rd(i,t,r,o,u){if(t.segment===void 0)return!0;let f=t,m=t.segment+1,x=0;for(;x>-r/2;){if(m--,m<0)return!1;x-=i[m].dist(f),f=i[m]}x+=i[m].dist(i[m+1]),m++;let b=[],E=0;for(;x<r/2;){let A=i[m],z=i[m+1];if(!z)return!1;let R=i[m-1].angleTo(A)-A.angleTo(z);for(R=Math.abs((R+3*Math.PI)%(2*Math.PI)-Math.PI),b.push({distance:x,angleDelta:R}),E+=R;x-b[0].distance>o;)E-=b.shift().angleDelta;if(E>u)return!1;m++,x+=A.dist(z)}return!0}function nd(i){let t=0;for(let r=0;r<i.length-1;r++)t+=i[r].dist(i[r+1]);return t}function sd(i,t,r){return i?.6*t*r:0}function ad(i,t){return Math.max(i?i.right-i.left:0,t?t.right-t.left:0)}function zy(i,t,r,o,u,f){let m=sd(r,u,f),x=ad(r,o)*f,b=0,E=nd(i)/2;for(let A=0;A<i.length-1;A++){let z=i[A],R=i[A+1],O=z.dist(R);if(b+O>E){let G=(E-b)/O,et=Ai(z.x,R.x,G),it=Ai(z.y,R.y,G),dt=new ks(et,it,R.angleTo(z),A);return dt._round(),!m||rd(i,dt,x,m,t)?dt:void 0}b+=O}}function ky(i,t,r,o,u,f,m,x,b){let E=sd(o,f,m),A=ad(o,u),z=A*m,R=i[0].x===0||i[0].x===b||i[0].y===0||i[0].y===b;return t-z<t/4&&(t=z+t/4),od(i,R?t/2*x%t:(A/2+2*f)*m*x%t,t,E,r,z,R,!1,b)}function od(i,t,r,o,u,f,m,x,b){let E=f/2,A=nd(i),z=0,R=t-r,O=[];for(let G=0;G<i.length-1;G++){let et=i[G],it=i[G+1],dt=et.dist(it),bt=it.angleTo(et);for(;R+r<z+dt;){R+=r;let vt=(R-z)/dt,Et=Ai(et.x,it.x,vt),Rt=Ai(et.y,it.y,vt);if(Et>=0&&Et<b&&Rt>=0&&Rt<b&&R-E>=0&&R+E<=A){let zt=new ks(Et,Rt,bt,G);zt._round(),o&&!rd(i,zt,f,o,u)||O.push(zt)}}z+=dt}return x||O.length||m||(O=od(i,z/2,r,o,u,f,m,!0,b)),O}function ld(i,t,r,o,u){let f=[];for(let m=0;m<i.length;m++){let x=i[m],b;for(let E=0;E<x.length-1;E++){let A=x[E],z=x[E+1];A.x<t&&z.x<t||(A.x<t?A=new ye(t,A.y+(t-A.x)/(z.x-A.x)*(z.y-A.y))._round():z.x<t&&(z=new ye(t,A.y+(t-A.x)/(z.x-A.x)*(z.y-A.y))._round()),A.y<r&&z.y<r||(A.y<r?A=new ye(A.x+(r-A.y)/(z.y-A.y)*(z.x-A.x),r)._round():z.y<r&&(z=new ye(A.x+(r-A.y)/(z.y-A.y)*(z.x-A.x),r)._round()),A.x>=o&&z.x>=o||(A.x>=o?A=new ye(o,A.y+(o-A.x)/(z.x-A.x)*(z.y-A.y))._round():z.x>=o&&(z=new ye(o,A.y+(o-A.x)/(z.x-A.x)*(z.y-A.y))._round()),A.y>=u&&z.y>=u||(A.y>=u?A=new ye(A.x+(u-A.y)/(z.y-A.y)*(z.x-A.x),u)._round():z.y>=u&&(z=new ye(A.x+(u-A.y)/(z.y-A.y)*(z.x-A.x),u)._round()),b&&A.equals(b[b.length-1])||(b=[A],f.push(b)),b.push(z)))))}}return f}function hd(i,t,r,o){let u=[],f=i.image,m=f.pixelRatio,x=f.paddedRect.w-2,b=f.paddedRect.h-2,E=i.right-i.left,A=i.bottom-i.top,z=f.stretchX||[[0,x]],R=f.stretchY||[[0,b]],O=(Wt,Qt)=>Wt+Qt[1]-Qt[0],G=z.reduce(O,0),et=R.reduce(O,0),it=x-G,dt=b-et,bt=0,vt=G,Et=0,Rt=et,zt=0,ee=it,le=0,Xt=dt;if(f.content&&o){let Wt=f.content;bt=Oh(z,0,Wt[0]),Et=Oh(R,0,Wt[1]),vt=Oh(z,Wt[0],Wt[2]),Rt=Oh(R,Wt[1],Wt[3]),zt=Wt[0]-bt,le=Wt[1]-Et,ee=Wt[2]-Wt[0]-vt,Xt=Wt[3]-Wt[1]-Rt}let Kt=(Wt,Qt,Yt,Gt)=>{let fe=Nh(Wt.stretch-bt,vt,E,i.left),ue=Uh(Wt.fixed-zt,ee,Wt.stretch,G),Be=Nh(Qt.stretch-Et,Rt,A,i.top),Ke=Uh(Qt.fixed-le,Xt,Qt.stretch,et),ui=Nh(Yt.stretch-bt,vt,E,i.left),pi=Uh(Yt.fixed-zt,ee,Yt.stretch,G),Ji=Nh(Gt.stretch-Et,Rt,A,i.top),zi=Uh(Gt.fixed-le,Xt,Gt.stretch,et),ki=new ye(fe,Be),qi=new ye(ui,Be),Qi=new ye(ui,Ji),sr=new ye(fe,Ji),wr=new ye(ue/m,Ke/m),Li=new ye(pi/m,zi/m),tr=t*Math.PI/180;if(tr){let Mr=Math.sin(tr),Sr=Math.cos(tr),fi=[Sr,-Mr,Mr,Sr];ki._matMult(fi),qi._matMult(fi),sr._matMult(fi),Qi._matMult(fi)}let ar=Wt.stretch+Wt.fixed,pr=Qt.stretch+Qt.fixed;return{tl:ki,tr:qi,bl:sr,br:Qi,tex:{x:f.paddedRect.x+1+ar,y:f.paddedRect.y+1+pr,w:Yt.stretch+Yt.fixed-ar,h:Gt.stretch+Gt.fixed-pr},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:wr,pixelOffsetBR:Li,minFontScaleX:ee/m/E,minFontScaleY:Xt/m/A,isSDF:r}};if(o&&(f.stretchX||f.stretchY)){let Wt=cd(z,it,G),Qt=cd(R,dt,et);for(let Yt=0;Yt<Wt.length-1;Yt++){let Gt=Wt[Yt],fe=Wt[Yt+1];for(let ue=0;ue<Qt.length-1;ue++)u.push(Kt(Gt,Qt[ue],fe,Qt[ue+1]))}}else u.push(Kt({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:x+1},{fixed:0,stretch:b+1}));return u}function Oh(i,t,r){let o=0;for(let u of i)o+=Math.max(t,Math.min(r,u[1]))-Math.max(t,Math.min(r,u[0]));return o}function cd(i,t,r){let o=[{fixed:-1,stretch:0}];for(let[u,f]of i){let m=o[o.length-1];o.push({fixed:u-m.stretch,stretch:m.stretch}),o.push({fixed:u-m.stretch,stretch:m.stretch+(f-u)})}return o.push({fixed:t+1,stretch:r}),o}function Nh(i,t,r,o){return i/t*r+o}function Uh(i,t,r,o){return i-t*r/o}te("Anchor",ks);class Vh{constructor(t,r,o,u,f,m,x,b,E,A){if(this.boxStartIndex=t.length,E){let z=m.top,R=m.bottom,O=m.collisionPadding;O&&(z-=O[1],R+=O[3]);let G=R-z;G>0&&(G=Math.max(10,G),this.circleDiameter=G)}else{let z=m.top*x-b,R=m.bottom*x+b,O=m.left*x-b,G=m.right*x+b,et=m.collisionPadding;if(et&&(O-=et[0]*x,z-=et[1]*x,G+=et[2]*x,R+=et[3]*x),A){let it=new ye(O,z),dt=new ye(G,z),bt=new ye(O,R),vt=new ye(G,R),Et=A*Math.PI/180;it._rotate(Et),dt._rotate(Et),bt._rotate(Et),vt._rotate(Et),O=Math.min(it.x,dt.x,bt.x,vt.x),G=Math.max(it.x,dt.x,bt.x,vt.x),z=Math.min(it.y,dt.y,bt.y,vt.y),R=Math.max(it.y,dt.y,bt.y,vt.y)}t.emplaceBack(r.x,r.y,O,z,G,R,o,u,f)}this.boxEndIndex=t.length}}class Ly{constructor(t=[],r=Dy){if(this.data=t,this.length=this.data.length,this.compare=r,this.length>0)for(let o=(this.length>>1)-1;o>=0;o--)this._down(o)}push(t){this.data.push(t),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;let t=this.data[0],r=this.data.pop();return this.length--,this.length>0&&(this.data[0]=r,this._down(0)),t}peek(){return this.data[0]}_up(t){let{data:r,compare:o}=this,u=r[t];for(;t>0;){let f=t-1>>1,m=r[f];if(o(u,m)>=0)break;r[t]=m,t=f}r[t]=u}_down(t){let{data:r,compare:o}=this,u=this.length>>1,f=r[t];for(;t<u;){let m=1+(t<<1),x=r[m],b=m+1;if(b<this.length&&o(r[b],x)<0&&(m=b,x=r[b]),o(x,f)>=0)break;r[t]=x,t=m}r[t]=f}}function Dy(i,t){return i<t?-1:i>t?1:0}function Ry(i,t=1,r=!1){let o=1/0,u=1/0,f=-1/0,m=-1/0,x=i[0];for(let O=0;O<x.length;O++){let G=x[O];(!O||G.x<o)&&(o=G.x),(!O||G.y<u)&&(u=G.y),(!O||G.x>f)&&(f=G.x),(!O||G.y>m)&&(m=G.y)}let b=Math.min(f-o,m-u),E=b/2,A=new Ly([],By);if(b===0)return new ye(o,u);for(let O=o;O<f;O+=b)for(let G=u;G<m;G+=b)A.push(new lo(O+E,G+E,E,i));let z=function(O){let G=0,et=0,it=0,dt=O[0];for(let bt=0,vt=dt.length,Et=vt-1;bt<vt;Et=bt++){let Rt=dt[bt],zt=dt[Et],ee=Rt.x*zt.y-zt.x*Rt.y;et+=(Rt.x+zt.x)*ee,it+=(Rt.y+zt.y)*ee,G+=3*ee}return new lo(et/G,it/G,0,O)}(i),R=A.length;for(;A.length;){let O=A.pop();(O.d>z.d||!z.d)&&(z=O,r&&console.log("found best %d after %d probes",Math.round(1e4*O.d)/1e4,R)),O.max-z.d<=t||(E=O.h/2,A.push(new lo(O.p.x-E,O.p.y-E,E,i)),A.push(new lo(O.p.x+E,O.p.y-E,E,i)),A.push(new lo(O.p.x-E,O.p.y+E,E,i)),A.push(new lo(O.p.x+E,O.p.y+E,E,i)),R+=4)}return r&&(console.log(`num probes: ${R}`),console.log(`best distance: ${z.d}`)),z.p}function By(i,t){return t.max-i.max}function lo(i,t,r,o){this.p=new ye(i,t),this.h=r,this.d=function(u,f){let m=!1,x=1/0;for(let b=0;b<f.length;b++){let E=f[b];for(let A=0,z=E.length,R=z-1;A<z;R=A++){let O=E[A],G=E[R];O.y>u.y!=G.y>u.y&&u.x<(G.x-O.x)*(u.y-O.y)/(G.y-O.y)+O.x&&(m=!m),x=Math.min(x,bp(u,O,G))}}return(m?1:-1)*Math.sqrt(x)}(this.p,o),this.max=this.d+this.h*Math.SQRT2}let vu=Number.POSITIVE_INFINITY;function ud(i,t){return t[1]!==vu?function(r,o,u){let f=0,m=0;switch(o=Math.abs(o),u=Math.abs(u),r){case"top-right":case"top-left":case"top":m=u-7;break;case"bottom-right":case"bottom-left":case"bottom":m=7-u}switch(r){case"top-right":case"bottom-right":case"right":f=-o;break;case"top-left":case"bottom-left":case"left":f=o}return[f,m]}(i,t[0],t[1]):function(r,o){let u=0,f=0;o<0&&(o=0);let m=o/Math.sqrt(2);switch(r){case"top-right":case"top-left":f=m-7;break;case"bottom-right":case"bottom-left":f=7-m;break;case"bottom":f=7-o;break;case"top":f=o-7}switch(r){case"top-right":case"bottom-right":u=-m;break;case"top-left":case"bottom-left":u=m;break;case"left":u=o;break;case"right":u=-o}return[u,f]}(i,t[0])}function bu(i){switch(i){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function Fy(i,t,r,o,u,f,m,x,b,E,A){let z=f.textMaxSize.evaluate(t,{});z===void 0&&(z=m);let R=i.layers[0].layout,O=R.get("icon-offset").evaluate(t,{},A),G=dd(r.horizontal),et=m/24,it=i.tilePixelRatio*et,dt=i.tilePixelRatio*z/24,bt=i.tilePixelRatio*x,vt=i.tilePixelRatio*R.get("symbol-spacing"),Et=R.get("text-padding")*i.tilePixelRatio,Rt=R.get("icon-padding")*i.tilePixelRatio,zt=R.get("text-max-angle")/180*Math.PI,ee=R.get("text-rotation-alignment")!=="viewport"&&R.get("symbol-placement")!=="point",le=R.get("icon-rotation-alignment")==="map"&&R.get("symbol-placement")!=="point",Xt=R.get("symbol-placement"),Kt=vt/2,Wt=R.get("icon-text-fit"),Qt;o&&Wt!=="none"&&(i.allowVerticalPlacement&&r.vertical&&(Qt=ed(o,r.vertical,Wt,R.get("icon-text-fit-padding"),O,et)),G&&(o=ed(o,G,Wt,R.get("icon-text-fit-padding"),O,et)));let Yt=(Gt,fe)=>{fe.x<0||fe.x>=Ui||fe.y<0||fe.y>=Ui||function(ue,Be,Ke,ui,pi,Ji,zi,ki,qi,Qi,sr,wr,Li,tr,ar,pr,Mr,Sr,fi,ji,Le,Nr,er,or,un){let _n=ue.addToLineVertexArray(Be,Ke),xn,Yn,pn,Yr,Tr=0,Jn=0,Pl=0,Ad=0,zu=-1,ku=-1,Qn={},Pd=ml(""),Lu=0,Du=0;if(ki._unevaluatedLayout.getValue("text-radial-offset")===void 0?[Lu,Du]=ki.layout.get("text-offset").evaluate(Le,{},or).map(Er=>Er*Hi):(Lu=ki.layout.get("text-radial-offset").evaluate(Le,{},or)*Hi,Du=vu),ue.allowVerticalPlacement&&ui.vertical){let Er=ki.layout.get("text-rotate").evaluate(Le,{},or)+90;pn=new Vh(qi,Be,Qi,sr,wr,ui.vertical,Li,tr,ar,Er),zi&&(Yr=new Vh(qi,Be,Qi,sr,wr,zi,Mr,Sr,ar,Er))}if(pi){let Er=ki.layout.get("icon-rotate").evaluate(Le,{}),Cn=ki.layout.get("icon-text-fit")!=="none",zl=hd(pi,Er,er,Cn),kl=zi?hd(zi,Er,er,Cn):void 0;Yn=new Vh(qi,Be,Qi,sr,wr,pi,Mr,Sr,!1,Er),Tr=4*zl.length;let Ld=ue.iconSizeData,pa=null;Ld.kind==="source"?(pa=[Kn*ki.layout.get("icon-size").evaluate(Le,{})],pa[0]>Ls&&ne(`${ue.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)):Ld.kind==="composite"&&(pa=[Kn*Nr.compositeIconSizes[0].evaluate(Le,{},or),Kn*Nr.compositeIconSizes[1].evaluate(Le,{},or)],(pa[0]>Ls||pa[1]>Ls)&&ne(`${ue.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)),ue.addSymbols(ue.icon,zl,pa,ji,fi,Le,a.WritingMode.none,Be,_n.lineStartIndex,_n.lineLength,-1,or),zu=ue.icon.placedSymbolArray.length-1,kl&&(Jn=4*kl.length,ue.addSymbols(ue.icon,kl,pa,ji,fi,Le,a.WritingMode.vertical,Be,_n.lineStartIndex,_n.lineLength,-1,or),ku=ue.icon.placedSymbolArray.length-1)}let zd=Object.keys(ui.horizontal);for(let Er of zd){let Cn=ui.horizontal[Er];if(!xn){Pd=ml(Cn.text);let kl=ki.layout.get("text-rotate").evaluate(Le,{},or);xn=new Vh(qi,Be,Qi,sr,wr,Cn,Li,tr,ar,kl)}let zl=Cn.positionedLines.length===1;if(Pl+=pd(ue,Be,Cn,Ji,ki,ar,Le,pr,_n,ui.vertical?a.WritingMode.horizontal:a.WritingMode.horizontalOnly,zl?zd:[Er],Qn,zu,Nr,or),zl)break}ui.vertical&&(Ad+=pd(ue,Be,ui.vertical,Ji,ki,ar,Le,pr,_n,a.WritingMode.vertical,["vertical"],Qn,ku,Nr,or));let Ky=xn?xn.boxStartIndex:ue.collisionBoxArray.length,Yy=xn?xn.boxEndIndex:ue.collisionBoxArray.length,Jy=pn?pn.boxStartIndex:ue.collisionBoxArray.length,Qy=pn?pn.boxEndIndex:ue.collisionBoxArray.length,t0=Yn?Yn.boxStartIndex:ue.collisionBoxArray.length,e0=Yn?Yn.boxEndIndex:ue.collisionBoxArray.length,i0=Yr?Yr.boxStartIndex:ue.collisionBoxArray.length,r0=Yr?Yr.boxEndIndex:ue.collisionBoxArray.length,vn=-1,Wh=(Er,Cn)=>Er&&Er.circleDiameter?Math.max(Er.circleDiameter,Cn):Cn;vn=Wh(xn,vn),vn=Wh(pn,vn),vn=Wh(Yn,vn),vn=Wh(Yr,vn);let kd=vn>-1?1:0;kd&&(vn*=un/Hi),ue.glyphOffsetArray.length>=ho.MAX_GLYPHS&&ne("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),Le.sortKey!==void 0&&ue.addToSortKeyRanges(ue.symbolInstances.length,Le.sortKey),ue.symbolInstances.emplaceBack(Be.x,Be.y,Qn.right>=0?Qn.right:-1,Qn.center>=0?Qn.center:-1,Qn.left>=0?Qn.left:-1,Qn.vertical||-1,zu,ku,Pd,Ky,Yy,Jy,Qy,t0,e0,i0,r0,Qi,Pl,Ad,Tr,Jn,kd,0,Li,Lu,Du,vn)}(i,fe,Gt,r,o,u,Qt,i.layers[0],i.collisionBoxArray,t.index,t.sourceLayerIndex,i.index,it,Et,ee,b,bt,Rt,le,O,t,f,E,A,m)};if(Xt==="line")for(let Gt of ld(t.geometry,0,0,Ui,Ui)){let fe=ky(Gt,vt,zt,r.vertical||G,o,24,dt,i.overscaling,Ui);for(let ue of fe){let Be=G;Be&&Oy(i,Be.text,Kt,ue)||Yt(Gt,ue)}}else if(Xt==="line-center"){for(let Gt of t.geometry)if(Gt.length>1){let fe=zy(Gt,zt,r.vertical||G,o,24,dt);fe&&Yt(Gt,fe)}}else if(t.type==="Polygon")for(let Gt of lu(t.geometry,0)){let fe=Ry(Gt,16);Yt(Gt[0],new ks(fe.x,fe.y,0))}else if(t.type==="LineString")for(let Gt of t.geometry)Yt(Gt,new ks(Gt[0].x,Gt[0].y,0));else if(t.type==="Point")for(let Gt of t.geometry)for(let fe of Gt)Yt([fe],new ks(fe.x,fe.y,0))}let Ls=32640;function pd(i,t,r,o,u,f,m,x,b,E,A,z,R,O,G){let et=function(bt,vt,Et,Rt,zt,ee,le,Xt){let Kt=Rt.layout.get("text-rotate").evaluate(ee,{})*Math.PI/180,Wt=[];for(let Qt of vt.positionedLines)for(let Yt of Qt.positionedGlyphs){if(!Yt.rect)continue;let Gt=Yt.rect||{},fe=4,ue=!0,Be=1,Ke=0,ui=(zt||Xt)&&Yt.vertical,pi=Yt.metrics.advance*Yt.scale/2;if(Xt&&vt.verticalizable){let fi=(Yt.scale-1)*Hi,ji=(Hi-Yt.metrics.width*Yt.scale)/2;Ke=Qt.lineOffset/2-(Yt.imageName?-ji:fi)}if(Yt.imageName){let fi=le[Yt.imageName];ue=fi.sdf,Be=fi.pixelRatio,fe=1/Be}let Ji=zt?[Yt.x+pi,Yt.y]:[0,0],zi=zt?[0,0]:[Yt.x+pi+Et[0],Yt.y+Et[1]-Ke],ki=[0,0];ui&&(ki=zi,zi=[0,0]);let qi=(Yt.metrics.left-fe)*Yt.scale-pi+zi[0],Qi=(-Yt.metrics.top-fe)*Yt.scale+zi[1],sr=qi+Gt.w*Yt.scale/Be,wr=Qi+Gt.h*Yt.scale/Be,Li=new ye(qi,Qi),tr=new ye(sr,Qi),ar=new ye(qi,wr),pr=new ye(sr,wr);if(ui){let fi=new ye(-pi,pi-Rh),ji=-Math.PI/2,Le=12-pi,Nr=new ye(22-Le,-(Yt.imageName?Le:0)),er=new ye(...ki);Li._rotateAround(ji,fi)._add(Nr)._add(er),tr._rotateAround(ji,fi)._add(Nr)._add(er),ar._rotateAround(ji,fi)._add(Nr)._add(er),pr._rotateAround(ji,fi)._add(Nr)._add(er)}if(Kt){let fi=Math.sin(Kt),ji=Math.cos(Kt),Le=[ji,-fi,fi,ji];Li._matMult(Le),tr._matMult(Le),ar._matMult(Le),pr._matMult(Le)}let Mr=new ye(0,0),Sr=new ye(0,0);Wt.push({tl:Li,tr,bl:ar,br:pr,tex:Gt,writingMode:vt.writingMode,glyphOffset:Ji,sectionIndex:Yt.sectionIndex,isSDF:ue,pixelOffsetTL:Mr,pixelOffsetBR:Sr,minFontScaleX:0,minFontScaleY:0})}return Wt}(0,r,x,u,f,m,o,i.allowVerticalPlacement),it=i.textSizeData,dt=null;it.kind==="source"?(dt=[Kn*u.layout.get("text-size").evaluate(m,{})],dt[0]>Ls&&ne(`${i.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)):it.kind==="composite"&&(dt=[Kn*O.compositeTextSizes[0].evaluate(m,{},G),Kn*O.compositeTextSizes[1].evaluate(m,{},G)],(dt[0]>Ls||dt[1]>Ls)&&ne(`${i.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)),i.addSymbols(i.text,et,dt,x,f,m,E,t,b.lineStartIndex,b.lineLength,R,G);for(let bt of A)z[bt]=i.text.placedSymbolArray.length-1;return 4*et.length}function dd(i){for(let t in i)return i[t];return null}function Oy(i,t,r,o){let u=i.compareText;if(t in u){let f=u[t];for(let m=f.length-1;m>=0;m--)if(o.dist(f[m])<r)return!0}else u[t]=[];return u[t].push(o),!1}let Ny=Ps.VectorTileFeature.types,Uy=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function Gh(i,t,r,o,u,f,m,x,b,E,A,z,R){let O=x?Math.min(Ls,Math.round(x[0])):0,G=x?Math.min(Ls,Math.round(x[1])):0;i.emplaceBack(t,r,Math.round(32*o),Math.round(32*u),f,m,(O<<1)+(b?1:0),G,16*E,16*A,256*z,256*R)}function wu(i,t,r){i.emplaceBack(t.x,t.y,r),i.emplaceBack(t.x,t.y,r),i.emplaceBack(t.x,t.y,r),i.emplaceBack(t.x,t.y,r)}function Vy(i){for(let t of i.sections)if(Zc(t.text))return!0;return!1}class Mu{constructor(t){this.layoutVertexArray=new Zi,this.indexArray=new ur,this.programConfigurations=t,this.segments=new je,this.dynamicLayoutVertexArray=new vr,this.opacityVertexArray=new Fr,this.placedSymbolArray=new Nt}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(t,r,o,u){this.isEmpty()||(o&&(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,cy.members),this.indexBuffer=t.createIndexBuffer(this.indexArray,r),this.dynamicLayoutVertexBuffer=t.createVertexBuffer(this.dynamicLayoutVertexArray,uy.members,!0),this.opacityVertexBuffer=t.createVertexBuffer(this.opacityVertexArray,Uy,!0),this.opacityVertexBuffer.itemSize=1),(o||u)&&this.programConfigurations.upload(t))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}}te("SymbolBuffers",Mu);class Su{constructor(t,r,o){this.layoutVertexArray=new t,this.layoutAttributes=r,this.indexArray=new o,this.segments=new je,this.collisionVertexArray=new In}upload(t){this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=t.createVertexBuffer(this.collisionVertexArray,py.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}te("CollisionBuffers",Su);class ho{constructor(t){this.collisionBoxArray=t.collisionBoxArray,this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(m=>m.id),this.index=t.index,this.pixelRatio=t.pixelRatio,this.sourceLayerIndex=t.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=eu([]),this.placementViewportMatrix=eu([]);let r=this.layers[0]._unevaluatedLayout._values;this.textSizeData=id(this.zoom,r["text-size"]),this.iconSizeData=id(this.zoom,r["icon-size"]);let o=this.layers[0].layout,u=o.get("symbol-sort-key"),f=o.get("symbol-z-order");this.canOverlap=Eu(o,"text-overlap","text-allow-overlap")!=="never"||Eu(o,"icon-overlap","icon-allow-overlap")!=="never"||o.get("text-ignore-placement")||o.get("icon-ignore-placement"),this.sortFeaturesByKey=f!=="viewport-y"&&!u.isConstant(),this.sortFeaturesByY=(f==="viewport-y"||f==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,o.get("symbol-placement")==="point"&&(this.writingModes=o.get("text-writing-mode").map(m=>a.WritingMode[m])),this.stateDependentLayerIds=this.layers.filter(m=>m.isStateDependent()).map(m=>m.id),this.sourceID=t.sourceID}createArrays(){this.text=new Mu(new la(this.layers,this.zoom,t=>/^text/.test(t))),this.icon=new Mu(new la(this.layers,this.zoom,t=>/^icon/.test(t))),this.glyphOffsetArray=new ie,this.lineVertexArray=new Ht,this.symbolInstances=new It}calculateGlyphDependencies(t,r,o,u,f){for(let m=0;m<t.length;m++)if(r[t.charCodeAt(m)]=!0,(o||u)&&f){let x=El[t.charAt(m)];x&&(r[x.charCodeAt(0)]=!0)}}populate(t,r,o){let u=this.layers[0],f=u.layout,m=f.get("text-font"),x=f.get("text-field"),b=f.get("icon-image"),E=(x.value.kind!=="constant"||x.value.value instanceof Y&&!x.value.value.isEmpty()||x.value.value.toString().length>0)&&(m.value.kind!=="constant"||m.value.value.length>0),A=b.value.kind!=="constant"||!!b.value.value||Object.keys(b.parameters).length>0,z=f.get("symbol-sort-key");if(this.features=[],!E&&!A)return;let R=r.iconDependencies,O=r.glyphDependencies,G=r.availableImages,et=new hi(this.zoom);for(let{feature:it,id:dt,index:bt,sourceLayerIndex:vt}of t){let Et=u._featureFilter.needGeometry,Rt=ca(it,Et);if(!u._featureFilter.filter(et,Rt,o))continue;let zt,ee;if(Et||(Rt.geometry=ha(it)),E){let Xt=u.getValueAndResolveTokens("text-field",Rt,o,G),Kt=Y.factory(Xt);Vy(Kt)&&(this.hasRTLText=!0),(!this.hasRTLText||pl()==="unavailable"||this.hasRTLText&&Br.isParsed())&&(zt=fy(Kt,u,Rt))}if(A){let Xt=u.getValueAndResolveTokens("icon-image",Rt,o,G);ee=Xt instanceof at?Xt:at.fromString(Xt)}if(!zt&&!ee)continue;let le=this.sortFeaturesByKey?z.evaluate(Rt,{},o):void 0;if(this.features.push({id:dt,text:zt,icon:ee,index:bt,sourceLayerIndex:vt,geometry:Rt.geometry,properties:it.properties,type:Ny[it.type],sortKey:le}),ee&&(R[ee.name]=!0),zt){let Xt=m.evaluate(Rt,{},o).join(","),Kt=f.get("text-rotation-alignment")!=="viewport"&&f.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(a.WritingMode.vertical)>=0;for(let Wt of zt.sections)if(Wt.image)R[Wt.image.name]=!0;else{let Qt=ol(zt.toString()),Yt=Wt.fontStack||Xt,Gt=O[Yt]=O[Yt]||{};this.calculateGlyphDependencies(Wt.text,Gt,Kt,this.allowVerticalPlacement,Qt)}}}f.get("symbol-placement")==="line"&&(this.features=function(it){let dt={},bt={},vt=[],Et=0;function Rt(Xt){vt.push(it[Xt]),Et++}function zt(Xt,Kt,Wt){let Qt=bt[Xt];return delete bt[Xt],bt[Kt]=Qt,vt[Qt].geometry[0].pop(),vt[Qt].geometry[0]=vt[Qt].geometry[0].concat(Wt[0]),Qt}function ee(Xt,Kt,Wt){let Qt=dt[Kt];return delete dt[Kt],dt[Xt]=Qt,vt[Qt].geometry[0].shift(),vt[Qt].geometry[0]=Wt[0].concat(vt[Qt].geometry[0]),Qt}function le(Xt,Kt,Wt){let Qt=Wt?Kt[0][Kt[0].length-1]:Kt[0][0];return`${Xt}:${Qt.x}:${Qt.y}`}for(let Xt=0;Xt<it.length;Xt++){let Kt=it[Xt],Wt=Kt.geometry,Qt=Kt.text?Kt.text.toString():null;if(!Qt){Rt(Xt);continue}let Yt=le(Qt,Wt),Gt=le(Qt,Wt,!0);if(Yt in bt&&Gt in dt&&bt[Yt]!==dt[Gt]){let fe=ee(Yt,Gt,Wt),ue=zt(Yt,Gt,vt[fe].geometry);delete dt[Yt],delete bt[Gt],bt[le(Qt,vt[ue].geometry,!0)]=ue,vt[fe].geometry=null}else Yt in bt?zt(Yt,Gt,Wt):Gt in dt?ee(Yt,Gt,Wt):(Rt(Xt),dt[Yt]=Et-1,bt[Gt]=Et-1)}return vt.filter(Xt=>Xt.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((it,dt)=>it.sortKey-dt.sortKey)}update(t,r,o){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(t,r,this.layers,o),this.icon.programConfigurations.updatePaintArrays(t,r,this.layers,o))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(t){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(t),this.iconCollisionBox.upload(t)),this.text.upload(t,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(t,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(t,r){let o=this.lineVertexArray.length;if(t.segment!==void 0){let u=t.dist(r[t.segment+1]),f=t.dist(r[t.segment]),m={};for(let x=t.segment+1;x<r.length;x++)m[x]={x:r[x].x,y:r[x].y,tileUnitDistanceFromAnchor:u},x<r.length-1&&(u+=r[x+1].dist(r[x]));for(let x=t.segment||0;x>=0;x--)m[x]={x:r[x].x,y:r[x].y,tileUnitDistanceFromAnchor:f},x>0&&(f+=r[x-1].dist(r[x]));for(let x=0;x<r.length;x++){let b=m[x];this.lineVertexArray.emplaceBack(b.x,b.y,b.tileUnitDistanceFromAnchor)}}return{lineStartIndex:o,lineLength:this.lineVertexArray.length-o}}addSymbols(t,r,o,u,f,m,x,b,E,A,z,R){let O=t.indexArray,G=t.layoutVertexArray,et=t.segments.prepareSegment(4*r.length,G,O,this.canOverlap?m.sortKey:void 0),it=this.glyphOffsetArray.length,dt=et.vertexLength,bt=this.allowVerticalPlacement&&x===a.WritingMode.vertical?Math.PI/2:0,vt=m.text&&m.text.sections;for(let Et=0;Et<r.length;Et++){let{tl:Rt,tr:zt,bl:ee,br:le,tex:Xt,pixelOffsetTL:Kt,pixelOffsetBR:Wt,minFontScaleX:Qt,minFontScaleY:Yt,glyphOffset:Gt,isSDF:fe,sectionIndex:ue}=r[Et],Be=et.vertexLength,Ke=Gt[1];Gh(G,b.x,b.y,Rt.x,Ke+Rt.y,Xt.x,Xt.y,o,fe,Kt.x,Kt.y,Qt,Yt),Gh(G,b.x,b.y,zt.x,Ke+zt.y,Xt.x+Xt.w,Xt.y,o,fe,Wt.x,Kt.y,Qt,Yt),Gh(G,b.x,b.y,ee.x,Ke+ee.y,Xt.x,Xt.y+Xt.h,o,fe,Kt.x,Wt.y,Qt,Yt),Gh(G,b.x,b.y,le.x,Ke+le.y,Xt.x+Xt.w,Xt.y+Xt.h,o,fe,Wt.x,Wt.y,Qt,Yt),wu(t.dynamicLayoutVertexArray,b,bt),O.emplaceBack(Be,Be+1,Be+2),O.emplaceBack(Be+1,Be+2,Be+3),et.vertexLength+=4,et.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(Gt[0]),Et!==r.length-1&&ue===r[Et+1].sectionIndex||t.programConfigurations.populatePaintArrays(G.length,m,m.index,{},R,vt&&vt[ue])}t.placedSymbolArray.emplaceBack(b.x,b.y,it,this.glyphOffsetArray.length-it,dt,E,A,b.segment,o?o[0]:0,o?o[1]:0,u[0],u[1],x,0,!1,0,z)}_addCollisionDebugVertex(t,r,o,u,f,m){return r.emplaceBack(0,0),t.emplaceBack(o.x,o.y,u,f,Math.round(m.x),Math.round(m.y))}addCollisionDebugVertices(t,r,o,u,f,m,x){let b=f.segments.prepareSegment(4,f.layoutVertexArray,f.indexArray),E=b.vertexLength,A=f.layoutVertexArray,z=f.collisionVertexArray,R=x.anchorX,O=x.anchorY;this._addCollisionDebugVertex(A,z,m,R,O,new ye(t,r)),this._addCollisionDebugVertex(A,z,m,R,O,new ye(o,r)),this._addCollisionDebugVertex(A,z,m,R,O,new ye(o,u)),this._addCollisionDebugVertex(A,z,m,R,O,new ye(t,u)),b.vertexLength+=4;let G=f.indexArray;G.emplaceBack(E,E+1),G.emplaceBack(E+1,E+2),G.emplaceBack(E+2,E+3),G.emplaceBack(E+3,E),b.primitiveLength+=4}addDebugCollisionBoxes(t,r,o,u){for(let f=t;f<r;f++){let m=this.collisionBoxArray.get(f);this.addCollisionDebugVertices(m.x1,m.y1,m.x2,m.y2,u?this.textCollisionBox:this.iconCollisionBox,m.anchorPoint,o)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new Su(Or,Gp.members,on),this.iconCollisionBox=new Su(Or,Gp.members,on);for(let t=0;t<this.symbolInstances.length;t++){let r=this.symbolInstances.get(t);this.addDebugCollisionBoxes(r.textBoxStartIndex,r.textBoxEndIndex,r,!0),this.addDebugCollisionBoxes(r.verticalTextBoxStartIndex,r.verticalTextBoxEndIndex,r,!0),this.addDebugCollisionBoxes(r.iconBoxStartIndex,r.iconBoxEndIndex,r,!1),this.addDebugCollisionBoxes(r.verticalIconBoxStartIndex,r.verticalIconBoxEndIndex,r,!1)}}_deserializeCollisionBoxesForSymbol(t,r,o,u,f,m,x,b,E){let A={};for(let z=r;z<o;z++){let R=t.get(z);A.textBox={x1:R.x1,y1:R.y1,x2:R.x2,y2:R.y2,anchorPointX:R.anchorPointX,anchorPointY:R.anchorPointY},A.textFeatureIndex=R.featureIndex;break}for(let z=u;z<f;z++){let R=t.get(z);A.verticalTextBox={x1:R.x1,y1:R.y1,x2:R.x2,y2:R.y2,anchorPointX:R.anchorPointX,anchorPointY:R.anchorPointY},A.verticalTextFeatureIndex=R.featureIndex;break}for(let z=m;z<x;z++){let R=t.get(z);A.iconBox={x1:R.x1,y1:R.y1,x2:R.x2,y2:R.y2,anchorPointX:R.anchorPointX,anchorPointY:R.anchorPointY},A.iconFeatureIndex=R.featureIndex;break}for(let z=b;z<E;z++){let R=t.get(z);A.verticalIconBox={x1:R.x1,y1:R.y1,x2:R.x2,y2:R.y2,anchorPointX:R.anchorPointX,anchorPointY:R.anchorPointY},A.verticalIconFeatureIndex=R.featureIndex;break}return A}deserializeCollisionBoxes(t){this.collisionArrays=[];for(let r=0;r<this.symbolInstances.length;r++){let o=this.symbolInstances.get(r);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(t,o.textBoxStartIndex,o.textBoxEndIndex,o.verticalTextBoxStartIndex,o.verticalTextBoxEndIndex,o.iconBoxStartIndex,o.iconBoxEndIndex,o.verticalIconBoxStartIndex,o.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(t,r){let o=t.placedSymbolArray.get(r),u=o.vertexStartIndex+4*o.numGlyphs;for(let f=o.vertexStartIndex;f<u;f+=4)t.indexArray.emplaceBack(f,f+1,f+2),t.indexArray.emplaceBack(f+1,f+2,f+3)}getSortedSymbolIndexes(t){if(this.sortedAngle===t&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;let r=Math.sin(t),o=Math.cos(t),u=[],f=[],m=[];for(let x=0;x<this.symbolInstances.length;++x){m.push(x);let b=this.symbolInstances.get(x);u.push(0|Math.round(r*b.anchorX+o*b.anchorY)),f.push(b.featureIndex)}return m.sort((x,b)=>u[x]-u[b]||f[b]-f[x]),m}addToSortKeyRanges(t,r){let o=this.sortKeyRanges[this.sortKeyRanges.length-1];o&&o.sortKey===r?o.symbolInstanceEnd=t+1:this.sortKeyRanges.push({sortKey:r,symbolInstanceStart:t,symbolInstanceEnd:t+1})}sortFeatures(t){if(this.sortFeaturesByY&&this.sortedAngle!==t&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(t),this.sortedAngle=t,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(let r of this.symbolInstanceIndexes){let o=this.symbolInstances.get(r);this.featureSortOrder.push(o.featureIndex),[o.rightJustifiedTextSymbolIndex,o.centerJustifiedTextSymbolIndex,o.leftJustifiedTextSymbolIndex].forEach((u,f,m)=>{u>=0&&m.indexOf(u)===f&&this.addIndicesForPlacedSymbol(this.text,u)}),o.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,o.verticalPlacedTextSymbolIndex),o.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,o.placedIconSymbolIndex),o.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,o.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}te("SymbolBucket",ho,{omit:["layers","collisionBoxArray","features","compareText"]}),ho.MAX_GLYPHS=65535,ho.addDynamicAttributes=wu;let Gy=new Oi({"symbol-placement":new se(ct.layout_symbol["symbol-placement"]),"symbol-spacing":new se(ct.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new se(ct.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new de(ct.layout_symbol["symbol-sort-key"]),"symbol-z-order":new se(ct.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new se(ct.layout_symbol["icon-allow-overlap"]),"icon-overlap":new se(ct.layout_symbol["icon-overlap"]),"icon-ignore-placement":new se(ct.layout_symbol["icon-ignore-placement"]),"icon-optional":new se(ct.layout_symbol["icon-optional"]),"icon-rotation-alignment":new se(ct.layout_symbol["icon-rotation-alignment"]),"icon-size":new de(ct.layout_symbol["icon-size"]),"icon-text-fit":new se(ct.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new se(ct.layout_symbol["icon-text-fit-padding"]),"icon-image":new de(ct.layout_symbol["icon-image"]),"icon-rotate":new de(ct.layout_symbol["icon-rotate"]),"icon-padding":new se(ct.layout_symbol["icon-padding"]),"icon-keep-upright":new se(ct.layout_symbol["icon-keep-upright"]),"icon-offset":new de(ct.layout_symbol["icon-offset"]),"icon-anchor":new de(ct.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new se(ct.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new se(ct.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new se(ct.layout_symbol["text-rotation-alignment"]),"text-field":new de(ct.layout_symbol["text-field"]),"text-font":new de(ct.layout_symbol["text-font"]),"text-size":new de(ct.layout_symbol["text-size"]),"text-max-width":new de(ct.layout_symbol["text-max-width"]),"text-line-height":new se(ct.layout_symbol["text-line-height"]),"text-letter-spacing":new de(ct.layout_symbol["text-letter-spacing"]),"text-justify":new de(ct.layout_symbol["text-justify"]),"text-radial-offset":new de(ct.layout_symbol["text-radial-offset"]),"text-variable-anchor":new se(ct.layout_symbol["text-variable-anchor"]),"text-anchor":new de(ct.layout_symbol["text-anchor"]),"text-max-angle":new se(ct.layout_symbol["text-max-angle"]),"text-writing-mode":new se(ct.layout_symbol["text-writing-mode"]),"text-rotate":new de(ct.layout_symbol["text-rotate"]),"text-padding":new se(ct.layout_symbol["text-padding"]),"text-keep-upright":new se(ct.layout_symbol["text-keep-upright"]),"text-transform":new de(ct.layout_symbol["text-transform"]),"text-offset":new de(ct.layout_symbol["text-offset"]),"text-allow-overlap":new se(ct.layout_symbol["text-allow-overlap"]),"text-overlap":new se(ct.layout_symbol["text-overlap"]),"text-ignore-placement":new se(ct.layout_symbol["text-ignore-placement"]),"text-optional":new se(ct.layout_symbol["text-optional"])});var Tu={paint:new Oi({"icon-opacity":new de(ct.paint_symbol["icon-opacity"]),"icon-color":new de(ct.paint_symbol["icon-color"]),"icon-halo-color":new de(ct.paint_symbol["icon-halo-color"]),"icon-halo-width":new de(ct.paint_symbol["icon-halo-width"]),"icon-halo-blur":new de(ct.paint_symbol["icon-halo-blur"]),"icon-translate":new se(ct.paint_symbol["icon-translate"]),"icon-translate-anchor":new se(ct.paint_symbol["icon-translate-anchor"]),"text-opacity":new de(ct.paint_symbol["text-opacity"]),"text-color":new de(ct.paint_symbol["text-color"],{runtimeType:ai,getOverride:i=>i.textColor,hasOverride:i=>!!i.textColor}),"text-halo-color":new de(ct.paint_symbol["text-halo-color"]),"text-halo-width":new de(ct.paint_symbol["text-halo-width"]),"text-halo-blur":new de(ct.paint_symbol["text-halo-blur"]),"text-translate":new se(ct.paint_symbol["text-translate"]),"text-translate-anchor":new se(ct.paint_symbol["text-translate-anchor"])}),layout:Gy};class fd{constructor(t){this.type=t.property.overrides?t.property.overrides.runtimeType:Pe,this.defaultValue=t}evaluate(t){if(t.formattedSection){let r=this.defaultValue.property.overrides;if(r&&r.hasOverride(t.formattedSection))return r.getOverride(t.formattedSection)}return t.feature&&t.featureState?this.defaultValue.evaluate(t.feature,t.featureState):this.defaultValue.property.specification.default}eachChild(t){this.defaultValue.isConstant()||t(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}te("FormatSectionOverride",fd,{omit:["defaultValue"]});class qh extends cr{constructor(t){super(t,Tu)}recalculate(t,r){if(super.recalculate(t,r),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout._values["icon-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout._values["text-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")==="map"?"map":"viewport"),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),this.layout.get("symbol-placement")==="point"){let o=this.layout.get("text-writing-mode");if(o){let u=[];for(let f of o)u.indexOf(f)<0&&u.push(f);this.layout._values["text-writing-mode"]=u}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(t,r,o,u){let f=this.layout.get(t).evaluate(r,{},o,u),m=this._unevaluatedLayout._values[t];return m.isDataDriven()||Ba(m.value)||!f?f:function(x,b){return b.replace(/{([^{}]+)}/g,(E,A)=>A in x?String(x[A]):"")}(r.properties,f)}createBucket(t){return new ho(t)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(let t of Tu.paint.overridableProperties){if(!qh.hasPaintOverride(this.layout,t))continue;let r=this.paint.get(t),o=new fd(r),u=new el(o,r.property.specification),f=null;f=r.value.kind==="constant"||r.value.kind==="source"?new Oa("source",u):new Na("composite",u,r.value.zoomStops,r.value._interpolationType),this.paint._values[t]=new an(r.property,f,r.parameters)}}_handleOverridablePaintPropertyUpdate(t,r,o){return!(!this.layout||r.isDataDriven()||o.isDataDriven())&&qh.hasPaintOverride(this.layout,t)}static hasPaintOverride(t,r){let o=t.get("text-field"),u=Tu.paint.properties[r],f=!1,m=x=>{for(let b of x)if(u.overrides&&u.overrides.hasOverride(b))return void(f=!0)};if(o.value.kind==="constant"&&o.value.value instanceof Y)m(o.value.value.sections);else if(o.value.kind==="source"){let x=E=>{f||(E instanceof Lt&&ot(E.value)===mi?m(E.value.sections):E instanceof ae?m(E.sections):E.eachChild(x))},b=o.value;b._styleExpression&&x(b._styleExpression.expression)}return f}}function Eu(i,t,r){let o="never",u=i.get(t);return u?o=u:i.get(r)&&(o="always"),o}var qy={paint:new Oi({"background-color":new se(ct.paint_background["background-color"]),"background-pattern":new sa(ct.paint_background["background-pattern"]),"background-opacity":new se(ct.paint_background["background-opacity"])})},jy={paint:new Oi({"raster-opacity":new se(ct.paint_raster["raster-opacity"]),"raster-hue-rotate":new se(ct.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new se(ct.paint_raster["raster-brightness-min"]),"raster-brightness-max":new se(ct.paint_raster["raster-brightness-max"]),"raster-saturation":new se(ct.paint_raster["raster-saturation"]),"raster-contrast":new se(ct.paint_raster["raster-contrast"]),"raster-resampling":new se(ct.paint_raster["raster-resampling"]),"raster-fade-duration":new se(ct.paint_raster["raster-fade-duration"])})};class $y extends cr{constructor(t){super(t,{}),this.onAdd=r=>{this.implementation.onAdd&&this.implementation.onAdd(r,r.painter.context.gl)},this.onRemove=r=>{this.implementation.onRemove&&this.implementation.onRemove(r,r.painter.context.gl)},this.implementation=t}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){}}let Wy={circle:class extends cr{constructor(i){super(i,Sg)}createBucket(i){return new Jc(i)}queryRadius(i){let t=i;return yl("circle-radius",this,t)+yl("circle-stroke-width",this,t)+Ih(this.paint.get("circle-translate"))}queryIntersectsFeature(i,t,r,o,u,f,m,x){let b=Ch(i,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),f.angle,m),E=this.paint.get("circle-radius").evaluate(t,r)+this.paint.get("circle-stroke-width").evaluate(t,r),A=this.paint.get("circle-pitch-alignment")==="map",z=A?b:function(O,G){return O.map(et=>Sp(et,G))}(b,x),R=A?E*m:E;for(let O of o)for(let G of O){let et=A?G:Sp(G,x),it=R,dt=Ah([],[G.x,G.y,0,1],x);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?it*=dt[3]/f.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(it*=f.cameraToCenterDistance/dt[3]),xg(z,et,it))return!0}return!1}},heatmap:class extends cr{constructor(i){super(i,Eg),this._updateColorRamp()}createBucket(i){return new Tp(i)}_handleSpecialPaintPropertyUpdate(i){i==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=Ip({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 cr{constructor(i){super(i,Ig)}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}},fill:class extends cr{constructor(i){super(i,qg)}recalculate(i,t){super.recalculate(i,t);let r=this.paint._values["fill-outline-color"];r.value.kind==="constant"&&r.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(i){return new uu(i)}queryRadius(){return Ih(this.paint.get("fill-translate"))}queryIntersectsFeature(i,t,r,o,u,f,m){return vp(Ch(i,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),f.angle,m),o)}isTileClipped(){return!0}},"fill-extrusion":class extends cr{constructor(i){super(i,iy)}createBucket(i){return new du(i)}queryRadius(){return Ih(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(i,t,r,o,u,f,m,x){let b=Ch(i,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),f.angle,m),E=this.paint.get("fill-extrusion-height").evaluate(t,r),A=this.paint.get("fill-extrusion-base").evaluate(t,r),z=function(O,G,et,it){let dt=[];for(let bt of O){let vt=[bt.x,bt.y,0,1];Ah(vt,vt,G),dt.push(new ye(vt[0]/vt[3],vt[1]/vt[3]))}return dt}(b,x),R=function(O,G,et,it){let dt=[],bt=[],vt=it[8]*G,Et=it[9]*G,Rt=it[10]*G,zt=it[11]*G,ee=it[8]*et,le=it[9]*et,Xt=it[10]*et,Kt=it[11]*et;for(let Wt of O){let Qt=[],Yt=[];for(let Gt of Wt){let fe=Gt.x,ue=Gt.y,Be=it[0]*fe+it[4]*ue+it[12],Ke=it[1]*fe+it[5]*ue+it[13],ui=it[2]*fe+it[6]*ue+it[14],pi=it[3]*fe+it[7]*ue+it[15],Ji=ui+Rt,zi=pi+zt,ki=Be+ee,qi=Ke+le,Qi=ui+Xt,sr=pi+Kt,wr=new ye((Be+vt)/zi,(Ke+Et)/zi);wr.z=Ji/zi,Qt.push(wr);let Li=new ye(ki/sr,qi/sr);Li.z=Qi/sr,Yt.push(Li)}dt.push(Qt),bt.push(Yt)}return[dt,bt]}(o,A,E,x);return function(O,G,et){let it=1/0;vp(et,G)&&(it=Fp(et,G[0]));for(let dt=0;dt<G.length;dt++){let bt=G[dt],vt=O[dt];for(let Et=0;Et<bt.length-1;Et++){let Rt=bt[Et],zt=[Rt,bt[Et+1],vt[Et+1],vt[Et],Rt];xp(et,zt)&&(it=Math.min(it,Fp(et,zt)))}}return it!==1/0&&it}(R[0],R[1],z)}},line:class extends cr{constructor(i){super(i,Np),this.gradientVersion=0}_handleSpecialPaintPropertyUpdate(i){i==="line-gradient"&&(this.stepInterpolant=this._transitionablePaint._values["line-gradient"].value.expression._styleExpression.expression instanceof Ws,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER)}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(i,t){super.recalculate(i,t),this.paint._values["line-floorwidth"]=Up.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,i)}createBucket(i){return new fu(i)}queryRadius(i){let t=i,r=Vp(yl("line-width",this,t),yl("line-gap-width",this,t)),o=yl("line-offset",this,t);return r/2+Math.abs(o)+Ih(this.paint.get("line-translate"))}queryIntersectsFeature(i,t,r,o,u,f,m){let x=Ch(i,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),f.angle,m),b=m/2*Vp(this.paint.get("line-width").evaluate(t,r),this.paint.get("line-gap-width").evaluate(t,r)),E=this.paint.get("line-offset").evaluate(t,r);return E&&(o=function(A,z){let R=[];for(let O=0;O<A.length;O++){let G=A[O],et=[];for(let it=0;it<G.length;it++){let dt=G[it-1],bt=G[it],vt=G[it+1],Et=it===0?new ye(0,0):bt.sub(dt)._unit()._perp(),Rt=it===G.length-1?new ye(0,0):vt.sub(bt)._unit()._perp(),zt=Et._add(Rt)._unit(),ee=zt.x*Rt.x+zt.y*Rt.y;ee!==0&&zt._mult(1/ee),et.push(zt._mult(z)._add(bt))}R.push(et)}return R}(o,E*m)),function(A,z,R){for(let O=0;O<z.length;O++){let G=z[O];if(A.length>=3){for(let et=0;et<G.length;et++)if(eo(A,G[et]))return!0}if(vg(A,G,R))return!0}return!1}(x,o,b)}isTileClipped(){return!0}},symbol:qh,background:class extends cr{constructor(i){super(i,qy)}},raster:class extends cr{constructor(i){super(i,jy)}}};class Zy{constructor(t){this._callback=t,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{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=()=>{}}}let md=63710088e-1;class bi{constructor(t,r){if(isNaN(t)||isNaN(r))throw new Error(`Invalid LngLat object: (${t}, ${r})`);if(this.lng=+t,this.lat=+r,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new bi(tt(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(t){let r=Math.PI/180,o=this.lat*r,u=t.lat*r,f=Math.sin(o)*Math.sin(u)+Math.cos(o)*Math.cos(u)*Math.cos((t.lng-this.lng)*r);return md*Math.acos(Math.min(f,1))}toBounds(t=0){let r=360*t/40075017,o=r/Math.cos(Math.PI/180*this.lat);return new ua(new bi(this.lng-o,this.lat-r),new bi(this.lng+o,this.lat+r))}static convert(t){if(t instanceof bi)return t;if(Array.isArray(t)&&(t.length===2||t.length===3))return new bi(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&typeof t=="object"&&t!==null)return new bi(Number("lng"in t?t.lng:t.lon),Number(t.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}}class ua{constructor(t,r){t&&(r?this.setSouthWest(t).setNorthEast(r):t.length===4?this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]]):this.setSouthWest(t[0]).setNorthEast(t[1]))}setNorthEast(t){return this._ne=t instanceof bi?new bi(t.lng,t.lat):bi.convert(t),this}setSouthWest(t){return this._sw=t instanceof bi?new bi(t.lng,t.lat):bi.convert(t),this}extend(t){let r=this._sw,o=this._ne,u,f;if(t instanceof bi)u=t,f=t;else{if(!(t instanceof ua))return Array.isArray(t)?t.length===4||t.every(Array.isArray)?this.extend(ua.convert(t)):this.extend(bi.convert(t)):this;if(u=t._sw,f=t._ne,!u||!f)return this}return r||o?(r.lng=Math.min(u.lng,r.lng),r.lat=Math.min(u.lat,r.lat),o.lng=Math.max(f.lng,o.lng),o.lat=Math.max(f.lat,o.lat)):(this._sw=new bi(u.lng,u.lat),this._ne=new bi(f.lng,f.lat)),this}getCenter(){return new bi((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 bi(this.getWest(),this.getNorth())}getSouthEast(){return new bi(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(t){let{lng:r,lat:o}=bi.convert(t),u=this._sw.lng<=r&&r<=this._ne.lng;return this._sw.lng>this._ne.lng&&(u=this._sw.lng>=r&&r>=this._ne.lng),this._sw.lat<=o&&o<=this._ne.lat&&u}static convert(t){return t instanceof ua?t:t&&new ua(t)}}let gd=2*Math.PI*md;function yd(i){return gd*Math.cos(i*Math.PI/180)}function _d(i){return(180+i)/360}function xd(i){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i*Math.PI/360)))/360}function vd(i,t){return i/yd(t)}function Iu(i){return 360/Math.PI*Math.atan(Math.exp((180-360*i)*Math.PI/180))-90}class jh{constructor(t,r,o=0){this.x=+t,this.y=+r,this.z=+o}static fromLngLat(t,r=0){let o=bi.convert(t);return new jh(_d(o.lng),xd(o.lat),vd(r,o.lat))}toLngLat(){return new bi(360*this.x-180,Iu(this.y))}toAltitude(){return this.z*yd(Iu(this.y))}meterInMercatorCoordinateUnits(){return 1/gd*(t=Iu(this.y),1/Math.cos(t*Math.PI/180));var t}}function bd(i,t,r){var o=2*Math.PI*6378137/256/Math.pow(2,r);return[i*o-2*Math.PI*6378137/2,t*o-2*Math.PI*6378137/2]}class Cu{constructor(t,r,o){this.z=t,this.x=r,this.y=o,this.key=Cl(0,t,t,r,o)}equals(t){return this.z===t.z&&this.x===t.x&&this.y===t.y}url(t,r,o){let u=(m=this.y,x=this.z,b=bd(256*(f=this.x),256*(m=Math.pow(2,x)-m-1),x),E=bd(256*(f+1),256*(m+1),x),b[0]+","+b[1]+","+E[0]+","+E[1]);var f,m,x,b,E;let A=function(z,R,O){let G,et="";for(let it=z;it>0;it--)G=1<<it-1,et+=(R&G?1:0)+(O&G?2:0);return et}(this.z,this.x,this.y);return t[(this.x+this.y)%t.length].replace(/{prefix}/g,(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String(o==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,r>1?"@2x":"").replace(/{quadkey}/g,A).replace(/{bbox-epsg-3857}/g,u)}getTilePoint(t){let r=Math.pow(2,this.z);return new ye((t.x*r-this.x)*Ui,(t.y*r-this.y)*Ui)}toString(){return`${this.z}/${this.x}/${this.y}`}}class wd{constructor(t,r){this.wrap=t,this.canonical=r,this.key=Cl(t,r.z,r.z,r.x,r.y)}}class cn{constructor(t,r,o,u,f){this.overscaledZ=t,this.wrap=r,this.canonical=new Cu(o,+u,+f),this.key=Cl(r,t,o,u,f)}equals(t){return this.overscaledZ===t.overscaledZ&&this.wrap===t.wrap&&this.canonical.equals(t.canonical)}scaledTo(t){let r=this.canonical.z-t;return t>this.canonical.z?new cn(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new cn(t,this.wrap,t,this.canonical.x>>r,this.canonical.y>>r)}calculateScaledKey(t,r){let o=this.canonical.z-t;return t>this.canonical.z?Cl(this.wrap*+r,t,this.canonical.z,this.canonical.x,this.canonical.y):Cl(this.wrap*+r,t,t,this.canonical.x>>o,this.canonical.y>>o)}isChildOf(t){if(t.wrap!==this.wrap)return!1;let r=this.canonical.z-t.canonical.z;return t.overscaledZ===0||t.overscaledZ<this.overscaledZ&&t.canonical.x===this.canonical.x>>r&&t.canonical.y===this.canonical.y>>r}children(t){if(this.overscaledZ>=t)return[new cn(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];let r=this.canonical.z+1,o=2*this.canonical.x,u=2*this.canonical.y;return[new cn(r,this.wrap,r,o,u),new cn(r,this.wrap,r,o+1,u),new cn(r,this.wrap,r,o,u+1),new cn(r,this.wrap,r,o+1,u+1)]}isLessThan(t){return this.wrap<t.wrap||!(this.wrap>t.wrap)&&(this.overscaledZ<t.overscaledZ||!(this.overscaledZ>t.overscaledZ)&&(this.canonical.x<t.canonical.x||!(this.canonical.x>t.canonical.x)&&this.canonical.y<t.canonical.y))}wrapped(){return new cn(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(t){return new cn(this.overscaledZ,t,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new wd(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(t){return this.canonical.getTilePoint(new jh(t.x-this.wrap,t.y))}}function Cl(i,t,r,o,u){(i*=2)<0&&(i=-1*i-1);let f=1<<r;return(f*f*i+f*u+o).toString(36)+r.toString(36)+t.toString(36)}te("CanonicalTileID",Cu),te("OverscaledTileID",cn,{omit:["posMatrix"]});class Md{constructor(t,r,o){if(this.uid=t,r.height!==r.width)throw new RangeError("DEM tiles must be square");if(o&&o!=="mapbox"&&o!=="terrarium")return void ne(`"${o}" is not a valid encoding type. Valid types include "mapbox" and "terrarium".`);this.stride=r.height;let u=this.dim=r.height-2;this.data=new Uint32Array(r.data.buffer),this.encoding=o||"mapbox";for(let f=0;f<u;f++)this.data[this._idx(-1,f)]=this.data[this._idx(0,f)],this.data[this._idx(u,f)]=this.data[this._idx(u-1,f)],this.data[this._idx(f,-1)]=this.data[this._idx(f,0)],this.data[this._idx(f,u)]=this.data[this._idx(f,u-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(u,-1)]=this.data[this._idx(u-1,0)],this.data[this._idx(-1,u)]=this.data[this._idx(0,u-1)],this.data[this._idx(u,u)]=this.data[this._idx(u-1,u-1)]}get(t,r){let o=new Uint8Array(this.data.buffer),u=4*this._idx(t,r);return(this.encoding==="terrarium"?this._unpackTerrarium:this._unpackMapbox)(o[u],o[u+1],o[u+2])}getUnpackVector(){return this.encoding==="terrarium"?[256,1,1/256,32768]:[6553.6,25.6,.1,1e4]}_idx(t,r){if(t<-1||t>=this.dim+1||r<-1||r>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(r+1)*this.stride+(t+1)}_unpackMapbox(t,r,o){return(256*t*256+256*r+o)/10-1e4}_unpackTerrarium(t,r,o){return 256*t+r+o/256-32768}getPixels(){return new Kr({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(t,r,o){if(this.dim!==t.dim)throw new Error("dem dimension mismatch");let u=r*this.dim,f=r*this.dim+this.dim,m=o*this.dim,x=o*this.dim+this.dim;switch(r){case-1:u=f-1;break;case 1:f=u+1}switch(o){case-1:m=x-1;break;case 1:x=m+1}let b=-r*this.dim,E=-o*this.dim;for(let A=m;A<x;A++)for(let z=u;z<f;z++)this.data[this._idx(z,A)]=t.data[this._idx(z+b,A+E)]}}te("DEMData",Md);class Sd{constructor(t){this._stringToNumber={},this._numberToString=[];for(let r=0;r<t.length;r++){let o=t[r];this._stringToNumber[o]=r,this._numberToString[r]=o}}encode(t){return this._stringToNumber[t]}decode(t){return this._numberToString[t]}}class Td{constructor(t,r,o,u,f){this.type="Feature",this._vectorTileFeature=t,t._z=r,t._x=o,t._y=u,this.properties=t.properties,this.id=f}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(t){this._geometry=t}toJSON(){let t={geometry:this.geometry};for(let r in this)r!=="_geometry"&&r!=="_vectorTileFeature"&&(t[r]=this[r]);return t}}class Ed{constructor(t,r){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new Gn(Ui,16,0),this.grid3D=new Gn(Ui,16,0),this.featureIndexArray=new Fe,this.promoteId=r}insert(t,r,o,u,f,m){let x=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(o,u,f);let b=m?this.grid3D:this.grid;for(let E=0;E<r.length;E++){let A=r[E],z=[1/0,1/0,-1/0,-1/0];for(let R=0;R<A.length;R++){let O=A[R];z[0]=Math.min(z[0],O.x),z[1]=Math.min(z[1],O.y),z[2]=Math.max(z[2],O.x),z[3]=Math.max(z[3],O.y)}z[0]<Ui&&z[1]<Ui&&z[2]>=0&&z[3]>=0&&b.insert(x,z[0],z[1],z[2],z[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new Ps.VectorTile(new mu(this.rawTileData)).layers,this.sourceLayerCoder=new Sd(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(t,r,o,u){this.loadVTLayers();let f=t.params||{},m=Ui/t.tileSize/t.scale,x=Ga(f.filter),b=t.queryGeometry,E=t.queryPadding*m,A=Cd(b),z=this.grid.query(A.minX-E,A.minY-E,A.maxX+E,A.maxY+E),R=Cd(t.cameraQueryGeometry),O=this.grid3D.query(R.minX-E,R.minY-E,R.maxX+E,R.maxY+E,(it,dt,bt,vt)=>function(Et,Rt,zt,ee,le){for(let Kt of Et)if(Rt<=Kt.x&&zt<=Kt.y&&ee>=Kt.x&&le>=Kt.y)return!0;let Xt=[new ye(Rt,zt),new ye(Rt,le),new ye(ee,le),new ye(ee,zt)];if(Et.length>2){for(let Kt of Xt)if(eo(Et,Kt))return!0}for(let Kt=0;Kt<Et.length-1;Kt++)if(wg(Et[Kt],Et[Kt+1],Xt))return!0;return!1}(t.cameraQueryGeometry,it-E,dt-E,bt+E,vt+E));for(let it of O)z.push(it);z.sort(Hy);let G={},et;for(let it=0;it<z.length;it++){let dt=z[it];if(dt===et)continue;et=dt;let bt=this.featureIndexArray.get(dt),vt=null;this.loadMatchingFeature(G,bt.bucketIndex,bt.sourceLayerIndex,bt.featureIndex,x,f.layers,f.availableImages,r,o,u,(Et,Rt,zt)=>(vt||(vt=ha(Et)),Rt.queryIntersectsFeature(b,Et,zt,vt,this.z,t.transform,m,t.pixelPosMatrix)))}return G}loadMatchingFeature(t,r,o,u,f,m,x,b,E,A,z){let R=this.bucketLayerIDs[r];if(m&&!function(it,dt){for(let bt=0;bt<it.length;bt++)if(dt.indexOf(it[bt])>=0)return!0;return!1}(m,R))return;let O=this.sourceLayerCoder.decode(o),G=this.vtLayers[O].feature(u);if(f.needGeometry){let it=ca(G,!0);if(!f.filter(new hi(this.tileID.overscaledZ),it,this.tileID.canonical))return}else if(!f.filter(new hi(this.tileID.overscaledZ),G))return;let et=this.getId(G,O);for(let it=0;it<R.length;it++){let dt=R[it];if(m&&m.indexOf(dt)<0)continue;let bt=b[dt];if(!bt)continue;let vt={};et&&A&&(vt=A.getState(bt.sourceLayer||"_geojsonTileLayer",et));let Et=pt({},E[dt]);Et.paint=Id(Et.paint,bt.paint,G,vt,x),Et.layout=Id(Et.layout,bt.layout,G,vt,x);let Rt=!z||z(G,bt,vt);if(!Rt)continue;let zt=new Td(G,this.z,this.x,this.y,et);zt.layer=Et;let ee=t[dt];ee===void 0&&(ee=t[dt]=[]),ee.push({featureIndex:u,feature:zt,intersectionZ:Rt})}}lookupSymbolFeatures(t,r,o,u,f,m,x,b){let E={};this.loadVTLayers();let A=Ga(f);for(let z of t)this.loadMatchingFeature(E,o,u,z,A,m,x,b,r);return E}hasLayer(t){for(let r of this.bucketLayerIDs)for(let o of r)if(t===o)return!0;return!1}getId(t,r){let o=t.id;return this.promoteId&&(o=t.properties[typeof this.promoteId=="string"?this.promoteId:this.promoteId[r]],typeof o=="boolean"&&(o=Number(o))),o}}function Id(i,t,r,o,u){return Ft(i,(f,m)=>{let x=t instanceof Ka?t.get(m):null;return x&&x.evaluate?x.evaluate(r,o,u):x})}function Cd(i){let t=1/0,r=1/0,o=-1/0,u=-1/0;for(let f of i)t=Math.min(t,f.x),r=Math.min(r,f.y),o=Math.max(o,f.x),u=Math.max(u,f.y);return{minX:t,minY:r,maxX:o,maxY:u}}function Hy(i,t){return t-i}var Au;te("FeatureIndex",Ed,{omit:["rawTileData","sourceLayerCoder"]}),a.PerformanceMarkers=void 0,(Au=a.PerformanceMarkers||(a.PerformanceMarkers={})).create="create",Au.load="load",Au.fullLoad="fullLoad";let $h=null,Al=[],Pu=1e3/30,Xy={mark(i){performance.mark(i)},frame(i){let t=i;$h!=null&&Al.push(t-$h),$h=t},clearMetrics(){$h=null,Al=[],performance.clearMeasures("loadTime"),performance.clearMeasures("fullLoadTime");for(let i in a.PerformanceMarkers)performance.clearMarks(a.PerformanceMarkers[i])},getPerformanceMetrics(){performance.measure("loadTime",a.PerformanceMarkers.create,a.PerformanceMarkers.load),performance.measure("fullLoadTime",a.PerformanceMarkers.create,a.PerformanceMarkers.fullLoad);let i=performance.getEntriesByName("loadTime")[0].duration,t=performance.getEntriesByName("fullLoadTime")[0].duration,r=Al.length,o=1/(Al.reduce((f,m)=>f+m,0)/r/1e3),u=Al.filter(f=>f>Pu).reduce((f,m)=>f+(m-Pu)/Pu,0);return{loadTime:i,fullLoadTime:t,fps:o,percentDroppedFrames:u/(r+u)*100}}};a.AJAXError=Je,a.ARRAY_TYPE=io,a.Actor=class{constructor(i,t,r){this.target=i,this.parent=t,this.mapId=r,this.callbacks={},this.tasks={},this.taskQueue=[],this.cancelCallbacks={},yt(["receive","process"],this),this.invoker=new Zy(this.process),this.target.addEventListener("message",this.receive,!1),this.globalScope=me()?i:window}send(i,t,r,o,u=!1){let f=Math.round(1e18*Math.random()).toString(36).substring(0,10);r&&(this.callbacks[f]=r);let m=Yi(this.globalScope)?void 0:[];return this.target.postMessage({id:f,type:i,hasCallback:!!r,targetMapId:o,mustQueue:u,sourceMapId:this.mapId,data:ea(t,m)},m),{cancel:()=>{r&&delete this.callbacks[f],this.target.postMessage({id:f,type:"<cancel>",targetMapId:o,sourceMapId:this.mapId})}}}receive(i){let t=i.data,r=t.id;if(r&&(!t.targetMapId||this.mapId===t.targetMapId))if(t.type==="<cancel>"){delete this.tasks[r];let o=this.cancelCallbacks[r];delete this.cancelCallbacks[r],o&&o()}else me()||t.mustQueue?(this.tasks[r]=t,this.taskQueue.push(r),this.invoker.trigger()):this.processTask(r,t)}process(){if(!this.taskQueue.length)return;let i=this.taskQueue.shift(),t=this.tasks[i];delete this.tasks[i],this.taskQueue.length&&this.invoker.trigger(),t&&this.processTask(i,t)}processTask(i,t){if(t.type==="<response>"){let r=this.callbacks[i];delete this.callbacks[i],r&&(t.error?r(qn(t.error)):r(null,qn(t.data)))}else{let r=!1,o=Yi(this.globalScope)?void 0:[],u=t.hasCallback?(x,b)=>{r=!0,delete this.cancelCallbacks[i],this.target.postMessage({id:i,type:"<response>",sourceMapId:this.mapId,error:x?ea(x):null,data:ea(b,o)},o)}:x=>{r=!0},f=null,m=qn(t.data);if(this.parent[t.type])f=this.parent[t.type](t.sourceMapId,m,u);else if(this.parent.getWorkerSource){let x=t.type.split(".");f=this.parent.getWorkerSource(t.sourceMapId,x[0],m.source)[x[1]](m,u)}else u(new Error(`Could not find function ${t.type}`));!r&&f&&f.cancel&&(this.cancelCallbacks[i]=f.cancel)}}remove(){this.invoker.remove(),this.target.removeEventListener("message",this.receive,!1)}},a.AlphaImage=xl,a.CanonicalTileID=Cu,a.CollisionBoxArray=Mt,a.CollisionCircleLayoutArray=class extends C{},a.Color=P,a.DEMData=Md,a.DataConstantProperty=se,a.DictionaryCoder=Sd,a.EXTENT=Ui,a.ErrorEvent=Dt,a.EvaluationParameters=hi,a.Event=xt,a.Evented=Ut,a.FeatureIndex=Ed,a.FillBucket=uu,a.FillExtrusionBucket=du,a.GeoJSONFeature=Td,a.ImageAtlas=Kp,a.ImagePosition=yu,a.LineBucket=fu,a.LineStripIndexArray=class extends gt{},a.LngLat=bi,a.LngLatBounds=ua,a.MercatorCoordinate=jh,a.ONE_EM=Hi,a.OverscaledTileID=cn,a.PerformanceUtils=Xy,a.PosArray=class extends Es{},a.Properties=Oi,a.QuadTriangleArray=class extends F{},a.RGBAImage=Kr,a.RasterBoundsArray=class extends oa{},a.RequestPerformance=class{constructor(i){this._marks={start:[i.url,"start"].join("#"),end:[i.url,"end"].join("#"),measure:i.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let i=performance.getEntriesByName(this._marks.measure);return i.length===0&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),i=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),i}},a.ResourceType=us,a.SegmentVector=je,a.SymbolBucket=ho,a.Transitionable=dl,a.TriangleIndexArray=ur,a.Uniform1f=Is,a.Uniform1i=class extends hn{constructor(i,t){super(i,t),this.current=0}set(i){this.current!==i&&(this.current=i,this.gl.uniform1i(this.location,i))}},a.Uniform2f=class extends hn{constructor(i,t){super(i,t),this.current=[0,0]}set(i){i[0]===this.current[0]&&i[1]===this.current[1]||(this.current=i,this.gl.uniform2f(this.location,i[0],i[1]))}},a.Uniform3f=class extends hn{constructor(i,t){super(i,t),this.current=[0,0,0]}set(i){i[0]===this.current[0]&&i[1]===this.current[1]&&i[2]===this.current[2]||(this.current=i,this.gl.uniform3f(this.location,i[0],i[1],i[2]))}},a.Uniform4f=fp,a.UniformColor=mp,a.UniformMatrix4f=class extends hn{constructor(i,t){super(i,t),this.current=yg}set(i){if(i[12]!==this.current[12]||i[0]!==this.current[0])return this.current=i,void this.gl.uniformMatrix4fv(this.location,!1,i);for(let t=1;t<16;t++)if(i[t]!==this.current[t]){this.current=i,this.gl.uniformMatrix4fv(this.location,!1,i);break}}},a.UnwrappedTileID=wd,a.ValidationError=Ct,a.ZoomHistory=ia,a.addDynamicAttributes=wu,a.asyncAll=function(i,t,r){if(!i.length)return r(null,[]);let o=i.length,u=new Array(i.length),f=null;i.forEach((m,x)=>{t(m,(b,E)=>{b&&(f=b),u[x]=E,--o==0&&r(f,u)})})},a.bezier=D,a.bindAll=yt,a.cacheEntryPossiblyAdded=function(i){nn++,nn>Lr&&(i.getActor().send("enforceCacheSizeLimit",kr),nn=0)},a.clamp=L,a.clearTileCache=function(i){let t=caches.delete(en);i&&t.catch(i).then(()=>i())},a.clipLine=ld,a.clone=function(i){var t=new io(16);return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],t},a.clone$1=Ot,a.collisionCircleLayout=dy,a.config=$r,a.create=function(){var i=new io(16);return io!=Float32Array&&(i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[11]=0,i[12]=0,i[13]=0,i[14]=0),i[0]=1,i[5]=1,i[10]=1,i[15]=1,i},a.createExpression=Fa,a.createFilter=Ga,a.createLayout=Ni,a.createStyleLayer=function(i){return i.type==="custom"?new $y(i):new Wy[i.type](i)},a.dot=function(i,t){return i[0]*t[0]+i[1]*t[1]+i[2]*t[2]+i[3]*t[3]},a.ease=N,a.emitValidationErrors=yh,a.enforceCacheSizeLimit=function(i){rn(),_i&&_i.then(t=>{t.keys().then(r=>{for(let o=0;o<r.length-i;o++)t.delete(r[o])})})},a.evaluateSizeForFeature=function(i,{uSize:t,uSizeT:r},{lowerSize:o,upperSize:u}){return i.kind==="source"?o/Kn:i.kind==="composite"?Ai(o/Kn,u/Kn,r):t},a.evaluateSizeForZoom=function(i,t){let r=0,o=0;if(i.kind==="constant")o=i.layoutSize;else if(i.kind!=="source"){let{interpolationType:u,minZoom:f,maxZoom:m}=i,x=u?L(_r.interpolationFactor(u,t,f,m),0,1):0;i.kind==="camera"?o=Ai(i.minSize,i.maxSize,x):r=x}return{uSizeT:r,uSize:o}},a.evaluateVariableOffset=ud,a.evented=Ts,a.exported=jr,a.exported$1=gr,a.extend=pt,a.filterObject=kt,a.getAnchorAlignment=xu,a.getAnchorJustification=bu,a.getArrayBuffer=Rr,a.getImage=V,a.getJSON=function(i,t){return gn(pt(i,{type:"json"}),t)},a.getOverlapMode=Eu,a.getRTLTextPluginStatus=pl,a.getReferrer=sn,a.getVideo=function(i,t){let r=window.document.createElement("video");r.muted=!0,r.onloadstart=function(){t(null,r)};for(let o=0;o<i.length;o++){let u=window.document.createElement("source");ps(i[o])||(r.crossOrigin="Anonymous"),u.src=i[o],r.appendChild(u)}return{cancel:()=>{}}},a.identity=eu,a.invert=function(i,t){var r=t[0],o=t[1],u=t[2],f=t[3],m=t[4],x=t[5],b=t[6],E=t[7],A=t[8],z=t[9],R=t[10],O=t[11],G=t[12],et=t[13],it=t[14],dt=t[15],bt=r*x-o*m,vt=r*b-u*m,Et=r*E-f*m,Rt=o*b-u*x,zt=o*E-f*x,ee=u*E-f*b,le=A*et-z*G,Xt=A*it-R*G,Kt=A*dt-O*G,Wt=z*it-R*et,Qt=z*dt-O*et,Yt=R*dt-O*it,Gt=bt*Yt-vt*Qt+Et*Wt+Rt*Kt-zt*Xt+ee*le;return Gt?(i[0]=(x*Yt-b*Qt+E*Wt)*(Gt=1/Gt),i[1]=(u*Qt-o*Yt-f*Wt)*Gt,i[2]=(et*ee-it*zt+dt*Rt)*Gt,i[3]=(R*zt-z*ee-O*Rt)*Gt,i[4]=(b*Kt-m*Yt-E*Xt)*Gt,i[5]=(r*Yt-u*Kt+f*Xt)*Gt,i[6]=(it*Et-G*ee-dt*vt)*Gt,i[7]=(A*ee-R*Et+O*vt)*Gt,i[8]=(m*Qt-x*Kt+E*le)*Gt,i[9]=(o*Kt-r*Qt-f*le)*Gt,i[10]=(G*zt-et*Et+dt*bt)*Gt,i[11]=(z*Et-A*zt-O*bt)*Gt,i[12]=(x*Xt-m*Wt-b*le)*Gt,i[13]=(r*Wt-o*Xt+u*le)*Gt,i[14]=(et*vt-G*Rt-it*bt)*Gt,i[15]=(A*Rt-z*vt+R*bt)*Gt,i):null},a.isImageBitmap=Fi,a.isSafari=Yi,a.keysDifference=function(i,t){let r=[];for(let o in i)o in t||r.push(o);return r},a.lazyLoadRTLTextPlugin=function(){Br.isLoading()||Br.isLoaded()||pl()!=="deferred"||Za()},a.makeRequest=gn,a.mapObject=Ft,a.mercatorXfromLng=_d,a.mercatorYfromLat=xd,a.mercatorZfromAltitude=vd,a.mul=Tg,a.multiply=Mp,a.nextPowerOfTwo=function(i){return i<=1?1:Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))},a.number=Ai,a.ortho=function(i,t,r,o,u,f,m){var x=1/(t-r),b=1/(o-u),E=1/(f-m);return i[0]=-2*x,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=-2*b,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=2*E,i[11]=0,i[12]=(t+r)*x,i[13]=(u+o)*b,i[14]=(m+f)*E,i[15]=1,i},a.parseCacheControl=Ge,a.parseGlyphPBF=function(i){return new mu(i).readFields(Sy,[])},a.pbf=mu,a.performSymbolLayout=function(i,t,r,o,u,f,m){i.createArrays(),i.tilePixelRatio=Ui/(512*i.overscaling),i.compareText={},i.iconsNeedLinear=!1;let x=i.layers[0].layout,b=i.layers[0]._unevaluatedLayout._values,E={layoutIconSize:b["icon-size"].possiblyEvaluate(new hi(i.zoom+1),m),layoutTextSize:b["text-size"].possiblyEvaluate(new hi(i.zoom+1),m),textMaxSize:b["text-size"].possiblyEvaluate(new hi(18))};if(i.textSizeData.kind==="composite"){let{minZoom:G,maxZoom:et}=i.textSizeData;E.compositeTextSizes=[b["text-size"].possiblyEvaluate(new hi(G),m),b["text-size"].possiblyEvaluate(new hi(et),m)]}if(i.iconSizeData.kind==="composite"){let{minZoom:G,maxZoom:et}=i.iconSizeData;E.compositeIconSizes=[b["icon-size"].possiblyEvaluate(new hi(G),m),b["icon-size"].possiblyEvaluate(new hi(et),m)]}let A=x.get("text-line-height")*Hi,z=x.get("text-rotation-alignment")!=="viewport"&&x.get("symbol-placement")!=="point",R=x.get("text-keep-upright"),O=x.get("text-size");for(let G of i.features){let et=x.get("text-font").evaluate(G,{},m).join(","),it=O.evaluate(G,{},m),dt=E.layoutTextSize.evaluate(G,{},m),bt=E.layoutIconSize.evaluate(G,{},m),vt={horizontal:{},vertical:void 0},Et=G.text,Rt,zt=[0,0];if(Et){let Xt=Et.toString(),Kt=x.get("text-letter-spacing").evaluate(G,{},m)*Hi,Wt=_h(Xt)?Kt:0,Qt=x.get("text-anchor").evaluate(G,{},m),Yt=x.get("text-variable-anchor");if(!Yt){let Ke=x.get("text-radial-offset").evaluate(G,{},m);zt=Ke?ud(Qt,[Ke*Hi,vu]):x.get("text-offset").evaluate(G,{},m).map(ui=>ui*Hi)}let Gt=z?"center":x.get("text-justify").evaluate(G,{},m),fe=x.get("symbol-placement"),ue=fe==="point"?x.get("text-max-width").evaluate(G,{},m)*Hi:0,Be=()=>{i.allowVerticalPlacement&&ol(Xt)&&(vt.vertical=Bh(Et,t,r,u,et,ue,A,Qt,"left",Wt,zt,a.WritingMode.vertical,!0,fe,dt,it))};if(!z&&Yt){let Ke=Gt==="auto"?Yt.map(pi=>bu(pi)):[Gt],ui=!1;for(let pi=0;pi<Ke.length;pi++){let Ji=Ke[pi];if(!vt.horizontal[Ji])if(ui)vt.horizontal[Ji]=vt.horizontal[0];else{let zi=Bh(Et,t,r,u,et,ue,A,"center",Ji,Wt,zt,a.WritingMode.horizontal,!1,fe,dt,it);zi&&(vt.horizontal[Ji]=zi,ui=zi.positionedLines.length===1)}}Be()}else{Gt==="auto"&&(Gt=bu(Qt));let Ke=Bh(Et,t,r,u,et,ue,A,Qt,Gt,Wt,zt,a.WritingMode.horizontal,!1,fe,dt,it);Ke&&(vt.horizontal[Gt]=Ke),Be(),ol(Xt)&&z&&R&&(vt.vertical=Bh(Et,t,r,u,et,ue,A,Qt,Gt,Wt,zt,a.WritingMode.vertical,!1,fe,dt,it))}}let ee=!1;if(G.icon&&G.icon.name){let Xt=o[G.icon.name];Xt&&(Rt=Py(u[G.icon.name],x.get("icon-offset").evaluate(G,{},m),x.get("icon-anchor").evaluate(G,{},m)),ee=!!Xt.sdf,i.sdfIcons===void 0?i.sdfIcons=ee:i.sdfIcons!==ee&&ne("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(Xt.pixelRatio!==i.pixelRatio||x.get("icon-rotate").constantOr(1)!==0)&&(i.iconsNeedLinear=!0))}let le=dd(vt.horizontal)||vt.vertical;i.iconsInText=!!le&&le.iconsInText,(le||Rt)&&Fy(i,G,vt,Rt,o,E,dt,bt,zt,ee,m)}f&&i.generateCollisionDebugBuffers()},a.perspective=function(i,t,r,o,u){var f,m=1/Math.tan(t/2);return i[0]=m/r,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=m,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[11]=-1,i[12]=0,i[13]=0,i[15]=0,u!=null&&u!==1/0?(i[10]=(u+o)*(f=1/(o-u)),i[14]=2*u*o*f):(i[10]=-1,i[14]=-2*o),i},a.pick=function(i,t){let r={};for(let o=0;o<t.length;o++){let u=t[o];u in i&&(r[u]=i[u])}return r},a.plugin=Br,a.pointGeometry=ye,a.polygonIntersectsPolygon=xp,a.potpack=Xp,a.refProperties=["type","source","source-layer","minzoom","maxzoom","filter","layout"],a.register=te,a.registerForPluginStateChange=function(i){return i({pluginStatus:hr,pluginURL:En}),Ts.on("pluginStateChange",i),i},a.renderColorRamp=Ip,a.rotateX=function(i,t,r){var o=Math.sin(r),u=Math.cos(r),f=t[4],m=t[5],x=t[6],b=t[7],E=t[8],A=t[9],z=t[10],R=t[11];return t!==i&&(i[0]=t[0],i[1]=t[1],i[2]=t[2],i[3]=t[3],i[12]=t[12],i[13]=t[13],i[14]=t[14],i[15]=t[15]),i[4]=f*u+E*o,i[5]=m*u+A*o,i[6]=x*u+z*o,i[7]=b*u+R*o,i[8]=E*u-f*o,i[9]=A*u-m*o,i[10]=z*u-x*o,i[11]=R*u-b*o,i},a.rotateZ=function(i,t,r){var o=Math.sin(r),u=Math.cos(r),f=t[0],m=t[1],x=t[2],b=t[3],E=t[4],A=t[5],z=t[6],R=t[7];return t!==i&&(i[8]=t[8],i[9]=t[9],i[10]=t[10],i[11]=t[11],i[12]=t[12],i[13]=t[13],i[14]=t[14],i[15]=t[15]),i[0]=f*u+E*o,i[1]=m*u+A*o,i[2]=x*u+z*o,i[3]=b*u+R*o,i[4]=E*u-f*o,i[5]=A*u-m*o,i[6]=z*u-x*o,i[7]=R*u-b*o,i},a.scale=function(i,t,r){var o=r[0],u=r[1],f=r[2];return i[0]=t[0]*o,i[1]=t[1]*o,i[2]=t[2]*o,i[3]=t[3]*o,i[4]=t[4]*u,i[5]=t[5]*u,i[6]=t[6]*u,i[7]=t[7]*u,i[8]=t[8]*f,i[9]=t[9]*f,i[10]=t[10]*f,i[11]=t[11]*f,i[12]=t[12],i[13]=t[13],i[14]=t[14],i[15]=t[15],i},a.scale$1=function(i,t,r){return i[0]=t[0]*r,i[1]=t[1]*r,i[2]=t[2]*r,i[3]=t[3]*r,i},a.setCacheLimits=function(i,t){kr=i,Lr=t},a.setRTLTextPlugin=function(i,t,r=!1){if(hr===Wa||hr===ll||hr===hl)throw new Error("setRTLTextPlugin cannot be called multiple times.");En=jr.resolveURL(i),hr=Wa,cl=t,ul(),r||Za()},a.spec=ct,a.sphericalToCartesian=function([i,t,r]){return t+=90,t*=Math.PI/180,r*=Math.PI/180,{x:i*Math.cos(t)*Math.sin(r),y:i*Math.sin(t)*Math.sin(r),z:i*Math.cos(r)}},a.toEvaluationFeature=ca,a.transformMat4=Ah,a.translate=function(i,t,r){var o,u,f,m,x,b,E,A,z,R,O,G,et=r[0],it=r[1],dt=r[2];return t===i?(i[12]=t[0]*et+t[4]*it+t[8]*dt+t[12],i[13]=t[1]*et+t[5]*it+t[9]*dt+t[13],i[14]=t[2]*et+t[6]*it+t[10]*dt+t[14],i[15]=t[3]*et+t[7]*it+t[11]*dt+t[15]):(u=t[1],f=t[2],m=t[3],x=t[4],b=t[5],E=t[6],A=t[7],z=t[8],R=t[9],O=t[10],G=t[11],i[0]=o=t[0],i[1]=u,i[2]=f,i[3]=m,i[4]=x,i[5]=b,i[6]=E,i[7]=A,i[8]=z,i[9]=R,i[10]=O,i[11]=G,i[12]=o*et+x*it+z*dt+t[12],i[13]=u*et+b*it+R*dt+t[13],i[14]=f*et+E*it+O*dt+t[14],i[15]=m*et+A*it+G*dt+t[15]),i},a.triggerPluginCompletionEvent=bh,a.unicodeBlockLookup=Zt,a.uniqueId=function(){return ft++},a.validateCustomStyleLayer=function(i){let t=[],r=i.id;return r===void 0&&t.push({message:`layers.${r}: missing required property "id"`}),i.render===void 0&&t.push({message:`layers.${r}: missing required method "render"`}),i.renderingMode&&i.renderingMode!=="2d"&&i.renderingMode!=="3d"&&t.push({message:`layers.${r}: property "renderingMode" must be either "2d" or "3d"`}),t},a.validateLight=qc,a.validateStyle=Vn,a.vectorTile=Ps,a.warnOnce=ne,a.wrap=tt}),y(["./shared"],function(a){"use strict";function T(W){let I=typeof W;if(I==="number"||I==="boolean"||I==="string"||W==null)return JSON.stringify(W);if(Array.isArray(W)){let H="[";for(let Y of W)H+=`${T(Y)},`;return`${H}]`}let P=Object.keys(W).sort(),q="{";for(let H=0;H<P.length;H++)q+=`${JSON.stringify(P[H])}:${T(W[P[H]])},`;return`${q}}`}function M(W){let I="";for(let P of a.refProperties)I+=`/${T(W[P])}`;return I}class D{constructor(I){this.keyCache={},I&&this.replace(I)}replace(I){this._layerConfigs={},this._layers={},this.update(I,[])}update(I,P){for(let H of I){this._layerConfigs[H.id]=H;let Y=this._layers[H.id]=a.createStyleLayer(H);Y._featureFilter=a.createFilter(Y.filter),this.keyCache[H.id]&&delete this.keyCache[H.id]}for(let H of P)delete this.keyCache[H],delete this._layerConfigs[H],delete this._layers[H];this.familiesBySource={};let q=function(H,Y){let at={};for(let nt=0;nt<H.length;nt++){let ot=Y&&Y[H[nt].id]||M(H[nt]);Y&&(Y[H[nt].id]=ot);let St=at[ot];St||(St=at[ot]=[]),St.push(H[nt])}let rt=[];for(let nt in at)rt.push(at[nt]);return rt}(Object.values(this._layerConfigs),this.keyCache);for(let H of q){let Y=H.map(Lt=>this._layers[Lt.id]),at=Y[0];if(at.visibility==="none")continue;let rt=at.source||"",nt=this.familiesBySource[rt];nt||(nt=this.familiesBySource[rt]={});let ot=at.sourceLayer||"_geojsonTileLayer",St=nt[ot];St||(St=nt[ot]=[]),St.push(Y)}}}class N{constructor(I){let P={},q=[];for(let rt in I){let nt=I[rt],ot=P[rt]={};for(let St in nt){let Lt=nt[+St];if(!Lt||Lt.bitmap.width===0||Lt.bitmap.height===0)continue;let wt={x:0,y:0,w:Lt.bitmap.width+2,h:Lt.bitmap.height+2};q.push(wt),ot[St]={rect:wt,metrics:Lt.metrics}}}let{w:H,h:Y}=a.potpack(q),at=new a.AlphaImage({width:H||1,height:Y||1});for(let rt in I){let nt=I[rt];for(let ot in nt){let St=nt[+ot];if(!St||St.bitmap.width===0||St.bitmap.height===0)continue;let Lt=P[rt][ot].rect;a.AlphaImage.copy(St.bitmap,at,{x:0,y:0},{x:Lt.x+1,y:Lt.y+1},St.bitmap)}}this.image=at,this.positions=P}}a.register("GlyphAtlas",N);class L{constructor(I){this.tileID=new a.OverscaledTileID(I.tileID.overscaledZ,I.tileID.wrap,I.tileID.canonical.z,I.tileID.canonical.x,I.tileID.canonical.y),this.uid=I.uid,this.zoom=I.zoom,this.pixelRatio=I.pixelRatio,this.tileSize=I.tileSize,this.source=I.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=I.showCollisionBoxes,this.collectResourceTiming=!!I.collectResourceTiming,this.returnDependencies=!!I.returnDependencies,this.promoteId=I.promoteId}parse(I,P,q,H,Y){this.status="parsing",this.data=I,this.collisionBoxArray=new a.CollisionBoxArray;let at=new a.DictionaryCoder(Object.keys(I.layers).sort()),rt=new a.FeatureIndex(this.tileID,this.promoteId);rt.bucketLayerIDs=[];let nt={},ot={featureIndex:rt,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:q},St=P.familiesBySource[this.source];for(let ze in St){let Ee=I.layers[ze];if(!Ee)continue;Ee.version===1&&a.warnOnce(`Vector tile source "${this.source}" layer "${ze}" does not use vector tile spec v2 and therefore may have some rendering errors.`);let Se=at.encode(ze),wi=[];for(let xi=0;xi<Ee.length;xi++){let Gi=Ee.feature(xi),Wi=rt.getId(Gi,ze);wi.push({feature:Gi,id:Wi,index:xi,sourceLayerIndex:Se})}for(let xi of St[ze]){let Gi=xi[0];Gi.minzoom&&this.zoom<Math.floor(Gi.minzoom)||Gi.maxzoom&&this.zoom>=Gi.maxzoom||Gi.visibility!=="none"&&(tt(xi,this.zoom,q),(nt[Gi.id]=Gi.createBucket({index:rt.bucketLayerIDs.length,layers:xi,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:Se,sourceID:this.source})).populate(wi,ot,this.tileID.canonical),rt.bucketLayerIDs.push(xi.map(Wi=>Wi.id)))}}let Lt,wt,re,Jt,ae=a.mapObject(ot.glyphDependencies,ze=>Object.keys(ze).map(Number));Object.keys(ae).length?H.send("getGlyphs",{uid:this.uid,stacks:ae},(ze,Ee)=>{Lt||(Lt=ze,wt=Ee,De.call(this))}):wt={};let pe=Object.keys(ot.iconDependencies);pe.length?H.send("getImages",{icons:pe,source:this.source,tileID:this.tileID,type:"icons"},(ze,Ee)=>{Lt||(Lt=ze,re=Ee,De.call(this))}):re={};let Ue=Object.keys(ot.patternDependencies);function De(){if(Lt)return Y(Lt);if(wt&&re&&Jt){let ze=new N(wt),Ee=new a.ImageAtlas(re,Jt);for(let Se in nt){let wi=nt[Se];wi instanceof a.SymbolBucket?(tt(wi.layers,this.zoom,q),a.performSymbolLayout(wi,wt,ze.positions,re,Ee.iconPositions,this.showCollisionBoxes,this.tileID.canonical)):wi.hasPattern&&(wi instanceof a.LineBucket||wi instanceof a.FillBucket||wi instanceof a.FillExtrusionBucket)&&(tt(wi.layers,this.zoom,q),wi.addFeatures(ot,this.tileID.canonical,Ee.patternPositions))}this.status="done",Y(null,{buckets:Object.values(nt).filter(Se=>!Se.isEmpty()),featureIndex:rt,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:ze.image,imageAtlas:Ee,glyphMap:this.returnDependencies?wt:null,iconMap:this.returnDependencies?re:null,glyphPositions:this.returnDependencies?ze.positions:null})}}Ue.length?H.send("getImages",{icons:Ue,source:this.source,tileID:this.tileID,type:"patterns"},(ze,Ee)=>{Lt||(Lt=ze,Jt=Ee,De.call(this))}):Jt={},De.call(this)}}function tt(W,I,P){let q=new a.EvaluationParameters(I);for(let H of W)H.recalculate(q,P)}function pt(W,I){let P=a.getArrayBuffer(W.request,(q,H,Y,at)=>{q?I(q):H&&I(null,{vectorTile:new a.vectorTile.VectorTile(new a.pbf(H)),rawData:H,cacheControl:Y,expires:at})});return()=>{P.cancel(),I()}}class ft{constructor(I,P,q,H){this.actor=I,this.layerIndex=P,this.availableImages=q,this.loadVectorData=H||pt,this.loading={},this.loaded={}}loadTile(I,P){let q=I.uid;this.loading||(this.loading={});let H=!!(I&&I.request&&I.request.collectResourceTiming)&&new a.RequestPerformance(I.request),Y=this.loading[q]=new L(I);Y.abort=this.loadVectorData(I,(at,rt)=>{if(delete this.loading[q],at||!rt)return Y.status="done",this.loaded[q]=Y,P(at);let nt=rt.rawData,ot={};rt.expires&&(ot.expires=rt.expires),rt.cacheControl&&(ot.cacheControl=rt.cacheControl);let St={};if(H){let Lt=H.finish();Lt&&(St.resourceTiming=JSON.parse(JSON.stringify(Lt)))}Y.vectorTile=rt.vectorTile,Y.parse(rt.vectorTile,this.layerIndex,this.availableImages,this.actor,(Lt,wt)=>{if(Lt||!wt)return P(Lt);P(null,a.extend({rawTileData:nt.slice(0)},wt,ot,St))}),this.loaded=this.loaded||{},this.loaded[q]=Y})}reloadTile(I,P){let q=this.loaded,H=I.uid,Y=this;if(q&&q[H]){let at=q[H];at.showCollisionBoxes=I.showCollisionBoxes;let rt=(nt,ot)=>{let St=at.reloadCallback;St&&(delete at.reloadCallback,at.parse(at.vectorTile,Y.layerIndex,this.availableImages,Y.actor,St)),P(nt,ot)};at.status==="parsing"?at.reloadCallback=rt:at.status==="done"&&(at.vectorTile?at.parse(at.vectorTile,this.layerIndex,this.availableImages,this.actor,rt):rt())}}abortTile(I,P){let q=this.loading,H=I.uid;q&&q[H]&&q[H].abort&&(q[H].abort(),delete q[H]),P()}removeTile(I,P){let q=this.loaded,H=I.uid;q&&q[H]&&delete q[H],P()}}class yt{constructor(){this.loaded={}}loadTile(I,P){let{uid:q,encoding:H,rawImageData:Y}=I,at=a.isImageBitmap(Y)?this.getImageData(Y):Y,rt=new a.DEMData(q,at,H);this.loaded=this.loaded||{},this.loaded[q]=rt,P(null,rt)}getImageData(I){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(I.width,I.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d")),this.offscreenCanvas.width=I.width,this.offscreenCanvas.height=I.height,this.offscreenCanvasContext.drawImage(I,0,0,I.width,I.height);let P=this.offscreenCanvasContext.getImageData(-1,-1,I.width+2,I.height+2);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),new a.RGBAImage({width:P.width,height:P.height},P.data)}removeTile(I){let P=this.loaded,q=I.uid;P&&P[q]&&delete P[q]}}var Ft=function W(I,P){var q,H=I&&I.type;if(H==="FeatureCollection")for(q=0;q<I.features.length;q++)W(I.features[q],P);else if(H==="GeometryCollection")for(q=0;q<I.geometries.length;q++)W(I.geometries[q],P);else if(H==="Feature")W(I.geometry,P);else if(H==="Polygon")kt(I.coordinates,P);else if(H==="MultiPolygon")for(q=0;q<I.coordinates.length;q++)kt(I.coordinates[q],P);return I};function kt(W,I){if(W.length!==0){Ot(W[0],I);for(var P=1;P<W.length;P++)Ot(W[P],!I)}}function Ot(W,I){for(var P=0,q=0,H=0,Y=W.length,at=Y-1;H<Y;at=H++){var rt=(W[H][0]-W[at][0])*(W[at][1]+W[H][1]),nt=P+rt;q+=Math.abs(P)>=Math.abs(rt)?P-nt+rt:rt-nt+P,P=nt}P+q>=0!=!!I&&W.reverse()}let he=a.vectorTile.VectorTileFeature.prototype.toGeoJSON;class ne{constructor(I){this._feature=I,this.extent=a.EXTENT,this.type=I.type,this.properties=I.tags,"id"in I&&!isNaN(I.id)&&(this.id=parseInt(I.id,10))}loadGeometry(){if(this._feature.type===1){let I=[];for(let P of this._feature.geometry)I.push([new a.pointGeometry(P[0],P[1])]);return I}{let I=[];for(let P of this._feature.geometry){let q=[];for(let H of P)q.push(new a.pointGeometry(H[0],H[1]));I.push(q)}return I}}toGeoJSON(I,P,q){return he.call(this,I,P,q)}}class be{constructor(I){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=a.EXTENT,this.length=I.length,this._features=I}feature(I){return new ne(this._features[I])}}var xe={exports:{}},me=a.pointGeometry,Ge=a.vectorTile.VectorTileFeature,Ne=di;function di(W,I){this.options=I||{},this.features=W,this.length=W.length}function Bi(W,I){this.id=typeof W.id=="number"?W.id:void 0,this.type=W.type,this.rawGeometry=W.type===1?[W.geometry]:W.geometry,this.properties=W.tags,this.extent=I||4096}di.prototype.feature=function(W){return new Bi(this.features[W],this.options.extent)},Bi.prototype.loadGeometry=function(){var W=this.rawGeometry;this.geometry=[];for(var I=0;I<W.length;I++){for(var P=W[I],q=[],H=0;H<P.length;H++)q.push(new me(P[H][0],P[H][1]));this.geometry.push(q)}return this.geometry},Bi.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var W=this.geometry,I=1/0,P=-1/0,q=1/0,H=-1/0,Y=0;Y<W.length;Y++)for(var at=W[Y],rt=0;rt<at.length;rt++){var nt=at[rt];I=Math.min(I,nt.x),P=Math.max(P,nt.x),q=Math.min(q,nt.y),H=Math.max(H,nt.y)}return[I,q,P,H]},Bi.prototype.toGeoJSON=Ge.prototype.toGeoJSON;var Yi=a.pbf,Fi=Ne;function jr(W){var I=new Yi;return function(P,q){for(var H in P.layers)q.writeMessage(3,ye,P.layers[H])}(W,I),I.finish()}function ye(W,I){var P;I.writeVarintField(15,W.version||1),I.writeStringField(1,W.name||""),I.writeVarintField(5,W.extent||4096);var q={keys:[],values:[],keycache:{},valuecache:{}};for(P=0;P<W.length;P++)q.feature=W.feature(P),I.writeMessage(2,zr,q);var H=q.keys;for(P=0;P<H.length;P++)I.writeStringField(3,H[P]);var Y=q.values;for(P=0;P<Y.length;P++)I.writeMessage(4,kr,Y[P])}function zr(W,I){var P=W.feature;P.id!==void 0&&I.writeVarintField(1,P.id),I.writeMessage(2,$r,W),I.writeVarintField(3,P.type),I.writeMessage(4,mn,P)}function $r(W,I){var P=W.feature,q=W.keys,H=W.values,Y=W.keycache,at=W.valuecache;for(var rt in P.properties){var nt=P.properties[rt],ot=Y[rt];if(nt!==null){ot===void 0&&(q.push(rt),Y[rt]=ot=q.length-1),I.writeVarint(ot);var St=typeof nt;St!=="string"&&St!=="boolean"&&St!=="number"&&(nt=JSON.stringify(nt));var Lt=St+":"+nt,wt=at[Lt];wt===void 0&&(H.push(nt),at[Lt]=wt=H.length-1),I.writeVarint(wt)}}}function en(W,I){return(I<<3)+(7&W)}function _i(W){return W<<1^W>>31}function mn(W,I){for(var P=W.loadGeometry(),q=W.type,H=0,Y=0,at=P.length,rt=0;rt<at;rt++){var nt=P[rt],ot=1;q===1&&(ot=nt.length),I.writeVarint(en(1,ot));for(var St=q===3?nt.length-1:nt.length,Lt=0;Lt<St;Lt++){Lt===1&&q!==1&&I.writeVarint(en(2,St-1));var wt=nt[Lt].x-H,re=nt[Lt].y-Y;I.writeVarint(_i(wt)),I.writeVarint(_i(re)),H+=wt,Y+=re}q===3&&I.writeVarint(en(7,1))}}function kr(W,I){var P=typeof W;P==="string"?I.writeStringField(1,W):P==="boolean"?I.writeBooleanField(7,W):P==="number"&&(W%1!=0?I.writeDoubleField(3,W):W<0?I.writeSVarintField(6,W):I.writeVarintField(5,W))}xe.exports=jr,xe.exports.fromVectorTileJs=jr,xe.exports.fromGeojsonVt=function(W,I){I=I||{};var P={};for(var q in W)P[q]=new Fi(W[q].features,I),P[q].name=q,P[q].version=I.version,P[q].extent=I.extent;return jr({layers:P})},xe.exports.GeoJSONWrapper=Fi;var Lr=xe.exports;function rn(W,I,P,q,H,Y){if(H-q<=P)return;let at=q+H>>1;nn(W,I,at,q,H,Y%2),rn(W,I,P,q,at-1,Y+1),rn(W,I,P,at+1,H,Y+1)}function nn(W,I,P,q,H,Y){for(;H>q;){if(H-q>600){let ot=H-q+1,St=P-q+1,Lt=Math.log(ot),wt=.5*Math.exp(2*Lt/3),re=.5*Math.sqrt(Lt*wt*(ot-wt)/ot)*(St-ot/2<0?-1:1);nn(W,I,P,Math.max(q,Math.floor(P-St*wt/ot+re)),Math.min(H,Math.floor(P+(ot-St)*wt/ot+re)),Y)}let at=I[2*P+Y],rt=q,nt=H;for(gr(W,I,q,P),I[2*H+Y]>at&&gr(W,I,q,H);rt<nt;){for(gr(W,I,rt,nt),rt++,nt--;I[2*rt+Y]<at;)rt++;for(;I[2*nt+Y]>at;)nt--}I[2*q+Y]===at?gr(W,I,q,nt):(nt++,gr(W,I,nt,H)),nt<=P&&(q=nt+1),P<=nt&&(H=nt-1)}}function gr(W,I,P,q){Dr(W,P,q),Dr(I,2*P,2*q),Dr(I,2*P+1,2*q+1)}function Dr(W,I,P){let q=W[I];W[I]=W[P],W[P]=q}function Wr(W,I,P,q){let H=W-P,Y=I-q;return H*H+Y*Y}let Tn=W=>W[0],Dn=W=>W[1];class Rn{constructor(I,P=Tn,q=Dn,H=64,Y=Float64Array){this.nodeSize=H,this.points=I;let at=I.length<65536?Uint16Array:Uint32Array,rt=this.ids=new at(I.length),nt=this.coords=new Y(2*I.length);for(let ot=0;ot<I.length;ot++)rt[ot]=ot,nt[2*ot]=P(I[ot]),nt[2*ot+1]=q(I[ot]);rn(rt,nt,H,0,rt.length-1,0)}range(I,P,q,H){return function(Y,at,rt,nt,ot,St,Lt){let wt=[0,Y.length-1,0],re=[],Jt,ae;for(;wt.length;){let pe=wt.pop(),Ue=wt.pop(),De=wt.pop();if(Ue-De<=Lt){for(let Se=De;Se<=Ue;Se++)Jt=at[2*Se],ae=at[2*Se+1],Jt>=rt&&Jt<=ot&&ae>=nt&&ae<=St&&re.push(Y[Se]);continue}let ze=Math.floor((De+Ue)/2);Jt=at[2*ze],ae=at[2*ze+1],Jt>=rt&&Jt<=ot&&ae>=nt&&ae<=St&&re.push(Y[ze]);let Ee=(pe+1)%2;(pe===0?rt<=Jt:nt<=ae)&&(wt.push(De),wt.push(ze-1),wt.push(Ee)),(pe===0?ot>=Jt:St>=ae)&&(wt.push(ze+1),wt.push(Ue),wt.push(Ee))}return re}(this.ids,this.coords,I,P,q,H,this.nodeSize)}within(I,P,q){return function(H,Y,at,rt,nt,ot){let St=[0,H.length-1,0],Lt=[],wt=nt*nt;for(;St.length;){let re=St.pop(),Jt=St.pop(),ae=St.pop();if(Jt-ae<=ot){for(let Ee=ae;Ee<=Jt;Ee++)Wr(Y[2*Ee],Y[2*Ee+1],at,rt)<=wt&&Lt.push(H[Ee]);continue}let pe=Math.floor((ae+Jt)/2),Ue=Y[2*pe],De=Y[2*pe+1];Wr(Ue,De,at,rt)<=wt&&Lt.push(H[pe]);let ze=(re+1)%2;(re===0?at-nt<=Ue:rt-nt<=De)&&(St.push(ae),St.push(pe-1),St.push(ze)),(re===0?at+nt>=Ue:rt+nt>=De)&&(St.push(pe+1),St.push(Jt),St.push(ze))}return Lt}(this.ids,this.coords,I,P,q,this.nodeSize)}}let us={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:W=>W},Je=Math.fround||(sn=new Float32Array(1),W=>(sn[0]=+W,sn[0]));var sn;class Bn{constructor(I){this.options=X(Object.create(us),I),this.trees=new Array(this.options.maxZoom+1)}load(I){let{log:P,minZoom:q,maxZoom:H,nodeSize:Y}=this.options;P&&console.time("total time");let at=`prepare ${I.length} points`;P&&console.time(at),this.points=I;let rt=[];for(let nt=0;nt<I.length;nt++)I[nt].geometry&&rt.push(Rr(I[nt],nt));this.trees[H+1]=new Rn(rt,st,xt,Y,Float32Array),P&&console.timeEnd(at);for(let nt=H;nt>=q;nt--){let ot=+Date.now();rt=this._cluster(rt,nt),this.trees[nt]=new Rn(rt,st,xt,Y,Float32Array),P&&console.log("z%d: %d clusters in %dms",nt,rt.length,+Date.now()-ot)}return P&&console.timeEnd("total time"),this}getClusters(I,P){let q=((I[0]+180)%360+360)%360-180,H=Math.max(-90,Math.min(90,I[1])),Y=I[2]===180?180:((I[2]+180)%360+360)%360-180,at=Math.max(-90,Math.min(90,I[3]));if(I[2]-I[0]>=360)q=-180,Y=180;else if(q>Y){let St=this.getClusters([q,H,180,at],P),Lt=this.getClusters([-180,H,Y,at],P);return St.concat(Lt)}let rt=this.trees[this._limitZoom(P)],nt=rt.range(U(q),B(at),U(Y),B(H)),ot=[];for(let St of nt){let Lt=rt.points[St];ot.push(Lt.numPoints?ps(Lt):this.points[Lt.index])}return ot}getChildren(I){let P=this._getOriginId(I),q=this._getOriginZoom(I),H="No cluster with the specified id.",Y=this.trees[q];if(!Y)throw new Error(H);let at=Y.points[P];if(!at)throw new Error(H);let rt=this.options.radius/(this.options.extent*Math.pow(2,q-1)),nt=Y.within(at.x,at.y,rt),ot=[];for(let St of nt){let Lt=Y.points[St];Lt.parentId===I&&ot.push(Lt.numPoints?ps(Lt):this.points[Lt.index])}if(ot.length===0)throw new Error(H);return ot}getLeaves(I,P,q){let H=[];return this._appendLeaves(H,I,P=P||10,q=q||0,0),H}getTile(I,P,q){let H=this.trees[this._limitZoom(I)],Y=Math.pow(2,I),{extent:at,radius:rt}=this.options,nt=rt/at,ot=(q-nt)/Y,St=(q+1+nt)/Y,Lt={features:[]};return this._addTileFeatures(H.range((P-nt)/Y,ot,(P+1+nt)/Y,St),H.points,P,q,Y,Lt),P===0&&this._addTileFeatures(H.range(1-nt/Y,ot,1,St),H.points,Y,q,Y,Lt),P===Y-1&&this._addTileFeatures(H.range(0,ot,nt/Y,St),H.points,-1,q,Y,Lt),Lt.features.length?Lt:null}getClusterExpansionZoom(I){let P=this._getOriginZoom(I)-1;for(;P<=this.options.maxZoom;){let q=this.getChildren(I);if(P++,q.length!==1)break;I=q[0].properties.cluster_id}return P}_appendLeaves(I,P,q,H,Y){let at=this.getChildren(P);for(let rt of at){let nt=rt.properties;if(nt&&nt.cluster?Y+nt.point_count<=H?Y+=nt.point_count:Y=this._appendLeaves(I,nt.cluster_id,q,H,Y):Y<H?Y++:I.push(rt),I.length===q)break}return Y}_addTileFeatures(I,P,q,H,Y,at){for(let rt of I){let nt=P[rt],ot=nt.numPoints,St,Lt,wt;if(ot)St=mt(nt),Lt=nt.x,wt=nt.y;else{let ae=this.points[nt.index];St=ae.properties,Lt=U(ae.geometry.coordinates[0]),wt=B(ae.geometry.coordinates[1])}let re={type:1,geometry:[[Math.round(this.options.extent*(Lt*Y-q)),Math.round(this.options.extent*(wt*Y-H))]],tags:St},Jt;ot?Jt=nt.id:this.options.generateId?Jt=nt.index:this.points[nt.index].id&&(Jt=this.points[nt.index].id),Jt!==void 0&&(re.id=Jt),at.features.push(re)}}_limitZoom(I){return Math.max(this.options.minZoom,Math.min(+I,this.options.maxZoom+1))}_cluster(I,P){let q=[],{radius:H,extent:Y,reduce:at,minPoints:rt}=this.options,nt=H/(Y*Math.pow(2,P));for(let ot=0;ot<I.length;ot++){let St=I[ot];if(St.zoom<=P)continue;St.zoom=P;let Lt=this.trees[P+1],wt=Lt.within(St.x,St.y,nt),re=St.numPoints||1,Jt=re;for(let ae of wt){let pe=Lt.points[ae];pe.zoom>P&&(Jt+=pe.numPoints||1)}if(Jt>re&&Jt>=rt){let ae=St.x*re,pe=St.y*re,Ue=at&&re>1?this._map(St,!0):null,De=(ot<<5)+(P+1)+this.points.length;for(let ze of wt){let Ee=Lt.points[ze];if(Ee.zoom<=P)continue;Ee.zoom=P;let Se=Ee.numPoints||1;ae+=Ee.x*Se,pe+=Ee.y*Se,Ee.parentId=De,at&&(Ue||(Ue=this._map(St,!0)),at(Ue,this._map(Ee)))}St.parentId=De,q.push(gn(ae/Jt,pe/Jt,De,Jt,Ue))}else if(q.push(St),Jt>1)for(let ae of wt){let pe=Lt.points[ae];pe.zoom<=P||(pe.zoom=P,q.push(pe))}}return q}_getOriginId(I){return I-this.points.length>>5}_getOriginZoom(I){return(I-this.points.length)%32}_map(I,P){if(I.numPoints)return P?X({},I.properties):I.properties;let q=this.points[I.index].properties,H=this.options.map(q);return P&&H===q?X({},H):H}}function gn(W,I,P,q,H){return{x:Je(W),y:Je(I),zoom:1/0,id:P,parentId:-1,numPoints:q,properties:H}}function Rr(W,I){let[P,q]=W.geometry.coordinates;return{x:Je(U(P)),y:Je(B(q)),zoom:1/0,index:I,parentId:-1}}function ps(W){return{type:"Feature",id:W.id,properties:mt(W),geometry:{type:"Point",coordinates:[(I=W.x,360*(I-.5)),V(W.y)]}};var I}function mt(W){let I=W.numPoints,P=I>=1e4?`${Math.round(I/1e3)}k`:I>=1e3?Math.round(I/100)/10+"k":I;return X(X({},W.properties),{cluster:!0,cluster_id:W.id,point_count:I,point_count_abbreviated:P})}function U(W){return W/360+.5}function B(W){let I=Math.sin(W*Math.PI/180),P=.5-.25*Math.log((1+I)/(1-I))/Math.PI;return P<0?0:P>1?1:P}function V(W){let I=(180-360*W)*Math.PI/180;return 360*Math.atan(Math.exp(I))/Math.PI-90}function X(W,I){for(let P in I)W[P]=I[P];return W}function st(W){return W.x}function xt(W){return W.y}function Dt(W,I,P,q){for(var H,Y=q,at=P-I>>1,rt=P-I,nt=W[I],ot=W[I+1],St=W[P],Lt=W[P+1],wt=I+3;wt<P;wt+=3){var re=Ut(W[wt],W[wt+1],nt,ot,St,Lt);if(re>Y)H=wt,Y=re;else if(re===Y){var Jt=Math.abs(wt-at);Jt<rt&&(H=wt,rt=Jt)}}Y>q&&(H-I>3&&Dt(W,I,H,q),W[H+2]=Y,P-H>3&&Dt(W,H,P,q))}function Ut(W,I,P,q,H,Y){var at=H-P,rt=Y-q;if(at!==0||rt!==0){var nt=((W-P)*at+(I-q)*rt)/(at*at+rt*rt);nt>1?(P=H,q=Y):nt>0&&(P+=at*nt,q+=rt*nt)}return(at=W-P)*at+(rt=I-q)*rt}function ct(W,I,P,q){var H={id:W===void 0?null:W,type:I,geometry:P,tags:q,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(Y){var at=Y.geometry,rt=Y.type;if(rt==="Point"||rt==="MultiPoint"||rt==="LineString")Ct(Y,at);else if(rt==="Polygon"||rt==="MultiLineString")for(var nt=0;nt<at.length;nt++)Ct(Y,at[nt]);else if(rt==="MultiPolygon")for(nt=0;nt<at.length;nt++)for(var ot=0;ot<at[nt].length;ot++)Ct(Y,at[nt][ot])}(H),H}function Ct(W,I){for(var P=0;P<I.length;P+=3)W.minX=Math.min(W.minX,I[P]),W.minY=Math.min(W.minY,I[P+1]),W.maxX=Math.max(W.maxX,I[P]),W.maxY=Math.max(W.maxY,I[P+1])}function Te(W,I,P,q){if(I.geometry){var H=I.geometry.coordinates,Y=I.geometry.type,at=Math.pow(P.tolerance/((1<<P.maxZoom)*P.extent),2),rt=[],nt=I.id;if(P.promoteId?nt=I.properties[P.promoteId]:P.generateId&&(nt=q||0),Y==="Point")Ie(H,rt);else if(Y==="MultiPoint")for(var ot=0;ot<H.length;ot++)Ie(H[ot],rt);else if(Y==="LineString")oe(H,rt,at,!1);else if(Y==="MultiLineString"){if(P.lineMetrics){for(ot=0;ot<H.length;ot++)oe(H[ot],rt=[],at,!1),W.push(ct(nt,"LineString",rt,I.properties));return}Oe(H,rt,at,!1)}else if(Y==="Polygon")Oe(H,rt,at,!0);else{if(Y!=="MultiPolygon"){if(Y==="GeometryCollection"){for(ot=0;ot<I.geometry.geometries.length;ot++)Te(W,{id:nt,geometry:I.geometry.geometries[ot],properties:I.properties},P,q);return}throw new Error("Input data is not a valid GeoJSON object.")}for(ot=0;ot<H.length;ot++){var St=[];Oe(H[ot],St,at,!0),rt.push(St)}}W.push(ct(nt,Y,rt,I.properties))}}function Ie(W,I){I.push(Ce(W[0])),I.push(Qe(W[1])),I.push(0)}function oe(W,I,P,q){for(var H,Y,at=0,rt=0;rt<W.length;rt++){var nt=Ce(W[rt][0]),ot=Qe(W[rt][1]);I.push(nt),I.push(ot),I.push(0),rt>0&&(at+=q?(H*ot-nt*Y)/2:Math.sqrt(Math.pow(nt-H,2)+Math.pow(ot-Y,2))),H=nt,Y=ot}var St=I.length-3;I[2]=1,Dt(I,0,St,P),I[St+2]=1,I.size=Math.abs(at),I.start=0,I.end=I.size}function Oe(W,I,P,q){for(var H=0;H<W.length;H++){var Y=[];oe(W[H],Y,P,q),I.push(Y)}}function Ce(W){return W/360+.5}function Qe(W){var I=Math.sin(W*Math.PI/180),P=.5-.25*Math.log((1+I)/(1-I))/Math.PI;return P<0?0:P>1?1:P}function Pe(W,I,P,q,H,Y,at,rt){if(q/=I,Y>=(P/=I)&&at<q)return W;if(at<P||Y>=q)return null;for(var nt=[],ot=0;ot<W.length;ot++){var St=W[ot],Lt=St.geometry,wt=St.type,re=H===0?St.minX:St.minY,Jt=H===0?St.maxX:St.maxY;if(re>=P&&Jt<q)nt.push(St);else if(!(Jt<P||re>=q)){var ae=[];if(wt==="Point"||wt==="MultiPoint")Vt(Lt,ae,P,q,H);else if(wt==="LineString")ge(Lt,ae,P,q,H,!1,rt.lineMetrics);else if(wt==="MultiLineString")ai(Lt,ae,P,q,H,!1);else if(wt==="Polygon")ai(Lt,ae,P,q,H,!0);else if(wt==="MultiPolygon")for(var pe=0;pe<Lt.length;pe++){var Ue=[];ai(Lt[pe],Ue,P,q,H,!0),Ue.length&&ae.push(Ue)}if(ae.length){if(rt.lineMetrics&&wt==="LineString"){for(pe=0;pe<ae.length;pe++)nt.push(ct(St.id,wt,ae[pe],St.tags));continue}wt!=="LineString"&&wt!=="MultiLineString"||(ae.length===1?(wt="LineString",ae=ae[0]):wt="MultiLineString"),wt!=="Point"&&wt!=="MultiPoint"||(wt=ae.length===3?"Point":"MultiPoint"),nt.push(ct(St.id,wt,ae,St.tags))}}}return nt.length?nt:null}function Vt(W,I,P,q,H){for(var Y=0;Y<W.length;Y+=3){var at=W[Y+H];at>=P&&at<=q&&(I.push(W[Y]),I.push(W[Y+1]),I.push(W[Y+2]))}}function ge(W,I,P,q,H,Y,at){for(var rt,nt,ot=ce(W),St=H===0?_e:ir,Lt=W.start,wt=0;wt<W.length-3;wt+=3){var re=W[wt],Jt=W[wt+1],ae=W[wt+2],pe=W[wt+3],Ue=W[wt+4],De=H===0?re:Jt,ze=H===0?pe:Ue,Ee=!1;at&&(rt=Math.sqrt(Math.pow(re-pe,2)+Math.pow(Jt-Ue,2))),De<P?ze>P&&(nt=St(ot,re,Jt,pe,Ue,P),at&&(ot.start=Lt+rt*nt)):De>q?ze<q&&(nt=St(ot,re,Jt,pe,Ue,q),at&&(ot.start=Lt+rt*nt)):$i(ot,re,Jt,ae),ze<P&&De>=P&&(nt=St(ot,re,Jt,pe,Ue,P),Ee=!0),ze>q&&De<=q&&(nt=St(ot,re,Jt,pe,Ue,q),Ee=!0),!Y&&Ee&&(at&&(ot.end=Lt+rt*nt),I.push(ot),ot=ce(W)),at&&(Lt+=rt)}var Se=W.length-3;re=W[Se],Jt=W[Se+1],ae=W[Se+2],(De=H===0?re:Jt)>=P&&De<=q&&$i(ot,re,Jt,ae),Se=ot.length-3,Y&&Se>=3&&(ot[Se]!==ot[0]||ot[Se+1]!==ot[1])&&$i(ot,ot[0],ot[1],ot[2]),ot.length&&I.push(ot)}function ce(W){var I=[];return I.size=W.size,I.start=W.start,I.end=W.end,I}function ai(W,I,P,q,H,Y){for(var at=0;at<W.length;at++)ge(W[at],I,P,q,H,Y,!1)}function $i(W,I,P,q){W.push(I),W.push(P),W.push(q)}function _e(W,I,P,q,H,Y){var at=(Y-I)/(q-I);return W.push(Y),W.push(P+(H-P)*at),W.push(1),at}function ir(W,I,P,q,H,Y){var at=(Y-P)/(H-P);return W.push(I+(q-I)*at),W.push(Y),W.push(1),at}function mi(W,I){for(var P=[],q=0;q<W.length;q++){var H,Y=W[q],at=Y.type;if(at==="Point"||at==="MultiPoint"||at==="LineString")H=rr(Y.geometry,I);else if(at==="MultiLineString"||at==="Polygon"){H=[];for(var rt=0;rt<Y.geometry.length;rt++)H.push(rr(Y.geometry[rt],I))}else if(at==="MultiPolygon")for(H=[],rt=0;rt<Y.geometry.length;rt++){for(var nt=[],ot=0;ot<Y.geometry[rt].length;ot++)nt.push(rr(Y.geometry[rt][ot],I));H.push(nt)}P.push(ct(Y.id,at,H,Y.tags))}return P}function rr(W,I){var P=[];P.size=W.size,W.start!==void 0&&(P.start=W.start,P.end=W.end);for(var q=0;q<W.length;q+=3)P.push(W[q]+I,W[q+1],W[q+2]);return P}function ri(W,I){if(W.transformed)return W;var P,q,H,Y=1<<W.z,at=W.x,rt=W.y;for(P=0;P<W.features.length;P++){var nt=W.features[P],ot=nt.geometry,St=nt.type;if(nt.geometry=[],St===1)for(q=0;q<ot.length;q+=2)nt.geometry.push(He(ot[q],ot[q+1],I,Y,at,rt));else for(q=0;q<ot.length;q++){var Lt=[];for(H=0;H<ot[q].length;H+=2)Lt.push(He(ot[q][H],ot[q][H+1],I,Y,at,rt));nt.geometry.push(Lt)}}return W.transformed=!0,W}function He(W,I,P,q,H,Y){return[Math.round(P*(W*q-H)),Math.round(P*(I*q-Y))]}function Vi(W,I,P,q,H){for(var Y=I===H.maxZoom?0:H.tolerance/((1<<I)*H.extent),at={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:P,y:q,z:I,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0},rt=0;rt<W.length;rt++){at.numFeatures++,yr(at,W[rt],Y,H);var nt=W[rt].minX,ot=W[rt].minY,St=W[rt].maxX,Lt=W[rt].maxY;nt<at.minX&&(at.minX=nt),ot<at.minY&&(at.minY=ot),St>at.maxX&&(at.maxX=St),Lt>at.maxY&&(at.maxY=Lt)}return at}function yr(W,I,P,q){var H=I.geometry,Y=I.type,at=[];if(Y==="Point"||Y==="MultiPoint")for(var rt=0;rt<H.length;rt+=3)at.push(H[rt]),at.push(H[rt+1]),W.numPoints++,W.numSimplified++;else if(Y==="LineString")gi(at,H,W,P,!1,!1);else if(Y==="MultiLineString"||Y==="Polygon")for(rt=0;rt<H.length;rt++)gi(at,H[rt],W,P,Y==="Polygon",rt===0);else if(Y==="MultiPolygon")for(var nt=0;nt<H.length;nt++){var ot=H[nt];for(rt=0;rt<ot.length;rt++)gi(at,ot[rt],W,P,!0,rt===0)}if(at.length){var St=I.tags||null;if(Y==="LineString"&&q.lineMetrics){for(var Lt in St={},I.tags)St[Lt]=I.tags[Lt];St.mapbox_clip_start=H.start/H.size,St.mapbox_clip_end=H.end/H.size}var wt={geometry:at,type:Y==="Polygon"||Y==="MultiPolygon"?3:Y==="LineString"||Y==="MultiLineString"?2:1,tags:St};I.id!==null&&(wt.id=I.id),W.features.push(wt)}}function gi(W,I,P,q,H,Y){var at=q*q;if(q>0&&I.size<(H?at:q))P.numPoints+=I.length/3;else{for(var rt=[],nt=0;nt<I.length;nt+=3)(q===0||I[nt+2]>at)&&(P.numSimplified++,rt.push(I[nt]),rt.push(I[nt+1])),P.numPoints++;H&&function(ot,St){for(var Lt=0,wt=0,re=ot.length,Jt=re-2;wt<re;Jt=wt,wt+=2)Lt+=(ot[wt]-ot[Jt])*(ot[wt+1]+ot[Jt+1]);if(Lt>0===St)for(wt=0,re=ot.length;wt<re/2;wt+=2){var ae=ot[wt],pe=ot[wt+1];ot[wt]=ot[re-2-wt],ot[wt+1]=ot[re-1-wt],ot[re-2-wt]=ae,ot[re-1-wt]=pe}}(rt,Y),W.push(rt)}}function Zr(W,I){var P=(I=this.options=function(H,Y){for(var at in Y)H[at]=Y[at];return H}(Object.create(this.options),I)).debug;if(P&&console.time("preprocess data"),I.maxZoom<0||I.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(I.promoteId&&I.generateId)throw new Error("promoteId and generateId cannot be used together.");var q=function(H,Y){var at=[];if(H.type==="FeatureCollection")for(var rt=0;rt<H.features.length;rt++)Te(at,H.features[rt],Y,rt);else Te(at,H.type==="Feature"?H:{geometry:H},Y);return at}(W,I);this.tiles={},this.tileCoords=[],P&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",I.indexMaxZoom,I.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),q=function(H,Y){var at=Y.buffer/Y.extent,rt=H,nt=Pe(H,1,-1-at,at,0,-1,2,Y),ot=Pe(H,1,1-at,2+at,0,-1,2,Y);return(nt||ot)&&(rt=Pe(H,1,-at,1+at,0,-1,2,Y)||[],nt&&(rt=mi(nt,1).concat(rt)),ot&&(rt=rt.concat(mi(ot,-1)))),rt}(q,I),q.length&&this.splitTile(q,0,0,0),P&&(q.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}function Hr(W,I,P){return 32*((1<<W)*P+I)+W}function qs(W,I){let P=W.tileID.canonical;if(!this._geoJSONIndex)return I(null,null);let q=this._geoJSONIndex.getTile(P.z,P.x,P.y);if(!q)return I(null,null);let H=new be(q.features),Y=Lr(H);Y.byteOffset===0&&Y.byteLength===Y.buffer.byteLength||(Y=new Uint8Array(Y)),I(null,{vectorTile:H,rawData:Y.buffer})}Zr.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},Zr.prototype.splitTile=function(W,I,P,q,H,Y,at){for(var rt=[W,I,P,q],nt=this.options,ot=nt.debug;rt.length;){q=rt.pop(),P=rt.pop(),I=rt.pop(),W=rt.pop();var St=1<<I,Lt=Hr(I,P,q),wt=this.tiles[Lt];if(!wt&&(ot>1&&console.time("creation"),wt=this.tiles[Lt]=Vi(W,I,P,q,nt),this.tileCoords.push({z:I,x:P,y:q}),ot)){ot>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",I,P,q,wt.numFeatures,wt.numPoints,wt.numSimplified),console.timeEnd("creation"));var re="z"+I;this.stats[re]=(this.stats[re]||0)+1,this.total++}if(wt.source=W,H){if(I===nt.maxZoom||I===H)continue;var Jt=1<<H-I;if(P!==Math.floor(Y/Jt)||q!==Math.floor(at/Jt))continue}else if(I===nt.indexMaxZoom||wt.numPoints<=nt.indexMaxPoints)continue;if(wt.source=null,W.length!==0){ot>1&&console.time("clipping");var ae,pe,Ue,De,ze,Ee,Se=.5*nt.buffer/nt.extent,wi=.5-Se,xi=.5+Se,Gi=1+Se;ae=pe=Ue=De=null,ze=Pe(W,St,P-Se,P+xi,0,wt.minX,wt.maxX,nt),Ee=Pe(W,St,P+wi,P+Gi,0,wt.minX,wt.maxX,nt),W=null,ze&&(ae=Pe(ze,St,q-Se,q+xi,1,wt.minY,wt.maxY,nt),pe=Pe(ze,St,q+wi,q+Gi,1,wt.minY,wt.maxY,nt),ze=null),Ee&&(Ue=Pe(Ee,St,q-Se,q+xi,1,wt.minY,wt.maxY,nt),De=Pe(Ee,St,q+wi,q+Gi,1,wt.minY,wt.maxY,nt),Ee=null),ot>1&&console.timeEnd("clipping"),rt.push(ae||[],I+1,2*P,2*q),rt.push(pe||[],I+1,2*P,2*q+1),rt.push(Ue||[],I+1,2*P+1,2*q),rt.push(De||[],I+1,2*P+1,2*q+1)}}},Zr.prototype.getTile=function(W,I,P){var q=this.options,H=q.extent,Y=q.debug;if(W<0||W>24)return null;var at=1<<W,rt=Hr(W,I=(I%at+at)%at,P);if(this.tiles[rt])return ri(this.tiles[rt],H);Y>1&&console.log("drilling down to z%d-%d-%d",W,I,P);for(var nt,ot=W,St=I,Lt=P;!nt&&ot>0;)ot--,St=Math.floor(St/2),Lt=Math.floor(Lt/2),nt=this.tiles[Hr(ot,St,Lt)];return nt&&nt.source?(Y>1&&console.log("found parent tile z%d-%d-%d",ot,St,Lt),Y>1&&console.time("drilling down"),this.splitTile(nt.source,ot,St,Lt,W,I,P),Y>1&&console.timeEnd("drilling down"),this.tiles[rt]?ri(this.tiles[rt],H):null):null};class ds extends ft{constructor(I,P,q,H){super(I,P,q,qs),H&&(this.loadGeoJSON=H)}loadData(I,P){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),this._pendingCallback=P,this._pendingLoadDataParams=I,this._state&&this._state!=="Idle"?this._state="NeedsLoadData":(this._state="Coalescing",this._loadData())}_loadData(){if(!this._pendingCallback||!this._pendingLoadDataParams)return;let I=this._pendingCallback,P=this._pendingLoadDataParams;delete this._pendingCallback,delete this._pendingLoadDataParams;let q=!!(P&&P.request&&P.request.collectResourceTiming)&&new a.RequestPerformance(P.request);this.loadGeoJSON(P,(H,Y)=>{if(H||!Y)return I(H);if(typeof Y!="object")return I(new Error(`Input data given to '${P.source}' is not a valid GeoJSON object.`));{Ft(Y,!0);try{if(P.filter){let rt=a.createExpression(P.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(rt.result==="error")throw new Error(rt.value.map(ot=>`${ot.key}: ${ot.message}`).join(", "));let nt=Y.features.filter(ot=>rt.value.evaluate({zoom:0},ot));Y={type:"FeatureCollection",features:nt}}this._geoJSONIndex=P.cluster?new Bn(function({superclusterOptions:rt,clusterProperties:nt}){if(!nt||!rt)return rt;let ot={},St={},Lt={accumulated:null,zoom:0},wt={properties:null},re=Object.keys(nt);for(let Jt of re){let[ae,pe]=nt[Jt],Ue=a.createExpression(pe),De=a.createExpression(typeof ae=="string"?[ae,["accumulated"],["get",Jt]]:ae);ot[Jt]=Ue.value,St[Jt]=De.value}return rt.map=Jt=>{wt.properties=Jt;let ae={};for(let pe of re)ae[pe]=ot[pe].evaluate(Lt,wt);return ae},rt.reduce=(Jt,ae)=>{wt.properties=ae;for(let pe of re)Lt.accumulated=Jt[pe],Jt[pe]=St[pe].evaluate(Lt,wt)},rt}(P)).load(Y.features):function(rt,nt){return new Zr(rt,nt)}(Y,P.geojsonVtOptions)}catch(rt){return I(rt)}this.loaded={};let at={};if(q){let rt=q.finish();rt&&(at.resourceTiming={},at.resourceTiming[P.source]=JSON.parse(JSON.stringify(rt)))}I(null,at)}})}coalesce(){this._state==="Coalescing"?this._state="Idle":this._state==="NeedsLoadData"&&(this._state="Coalescing",this._loadData())}reloadTile(I,P){let q=this.loaded;return q&&q[I.uid]?super.reloadTile(I,P):this.loadTile(I,P)}loadGeoJSON(I,P){if(I.request)a.getJSON(I.request,P);else{if(typeof I.data!="string")return P(new Error(`Input data given to '${I.source}' is not a valid GeoJSON object.`));try{return P(null,JSON.parse(I.data))}catch{return P(new Error(`Input data given to '${I.source}' is not a valid GeoJSON object.`))}}}removeSource(I,P){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),P()}getClusterExpansionZoom(I,P){try{P(null,this._geoJSONIndex.getClusterExpansionZoom(I.clusterId))}catch(q){P(q)}}getClusterChildren(I,P){try{P(null,this._geoJSONIndex.getChildren(I.clusterId))}catch(q){P(q)}}getClusterLeaves(I,P){try{P(null,this._geoJSONIndex.getLeaves(I.clusterId,I.limit,I.offset))}catch(q){P(q)}}}class fs{constructor(I){this.self=I,this.actor=new a.Actor(I,this),this.layerIndexes={},this.availableImages={},this.workerSourceTypes={vector:ft,geojson:ds},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(P,q)=>{if(this.workerSourceTypes[P])throw new Error(`Worker source with name "${P}" already registered.`);this.workerSourceTypes[P]=q},this.self.registerRTLTextPlugin=P=>{if(a.plugin.isParsed())throw new Error("RTL text plugin already registered.");a.plugin.applyArabicShaping=P.applyArabicShaping,a.plugin.processBidirectionalText=P.processBidirectionalText,a.plugin.processStyledBidirectionalText=P.processStyledBidirectionalText}}setReferrer(I,P){this.referrer=P}setImages(I,P,q){this.availableImages[I]=P;for(let H in this.workerSources[I]){let Y=this.workerSources[I][H];for(let at in Y)Y[at].availableImages=P}q()}setLayers(I,P,q){this.getLayerIndex(I).replace(P),q()}updateLayers(I,P,q){this.getLayerIndex(I).update(P.layers,P.removedIds),q()}loadTile(I,P,q){this.getWorkerSource(I,P.type,P.source).loadTile(P,q)}loadDEMTile(I,P,q){this.getDEMWorkerSource(I,P.source).loadTile(P,q)}reloadTile(I,P,q){this.getWorkerSource(I,P.type,P.source).reloadTile(P,q)}abortTile(I,P,q){this.getWorkerSource(I,P.type,P.source).abortTile(P,q)}removeTile(I,P,q){this.getWorkerSource(I,P.type,P.source).removeTile(P,q)}removeDEMTile(I,P){this.getDEMWorkerSource(I,P.source).removeTile(P)}removeSource(I,P,q){if(!this.workerSources[I]||!this.workerSources[I][P.type]||!this.workerSources[I][P.type][P.source])return;let H=this.workerSources[I][P.type][P.source];delete this.workerSources[I][P.type][P.source],H.removeSource!==void 0?H.removeSource(P,q):q()}loadWorkerSource(I,P,q){try{this.self.importScripts(P.url),q()}catch(H){q(H.toString())}}syncRTLPluginState(I,P,q){try{a.plugin.setState(P);let H=a.plugin.getPluginURL();if(a.plugin.isLoaded()&&!a.plugin.isParsed()&&H!=null){this.self.importScripts(H);let Y=a.plugin.isParsed();q(Y?void 0:new Error(`RTL Text Plugin failed to import scripts from ${H}`),Y)}}catch(H){q(H.toString())}}getAvailableImages(I){let P=this.availableImages[I];return P||(P=[]),P}getLayerIndex(I){let P=this.layerIndexes[I];return P||(P=this.layerIndexes[I]=new D),P}getWorkerSource(I,P,q){if(this.workerSources[I]||(this.workerSources[I]={}),this.workerSources[I][P]||(this.workerSources[I][P]={}),!this.workerSources[I][P][q]){let H={send:(Y,at,rt)=>{this.actor.send(Y,at,rt,I)}};this.workerSources[I][P][q]=new this.workerSourceTypes[P](H,this.getLayerIndex(I),this.getAvailableImages(I))}return this.workerSources[I][P][q]}getDEMWorkerSource(I,P){return this.demWorkerSources[I]||(this.demWorkerSources[I]={}),this.demWorkerSources[I][P]||(this.demWorkerSources[I][P]=new yt),this.demWorkerSources[I][P]}enforceCacheSizeLimit(I,P){a.enforceCacheSizeLimit(P)}}return typeof WorkerGlobalScope<"u"&&typeof self<"u"&&self instanceof WorkerGlobalScope&&(self.worker=new fs(self)),fs}),y(["./shared"],function(a){"use strict";var T=M;function M(p){return!function(e){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 c,d,g=new Blob([""],{type:"text/javascript"}),v=URL.createObjectURL(g);try{d=new Worker(v),c=!0}catch{c=!1}return d&&d.terminate(),URL.revokeObjectURL(v),c}()?"Uint8ClampedArray"in window?ArrayBuffer.isView?function(){var c=document.createElement("canvas");c.width=c.height=1;var d=c.getContext("2d");if(!d)return!1;var g=d.getImageData(0,0,1,1);return g&&g.width===c.width}()?(D[n=e&&e.failIfMajorPerformanceCaveat]===void 0&&(D[n]=function(c){var d,g=function(v){var w=document.createElement("canvas"),S=Object.create(M.webGLContextAttributes);return S.failIfMajorPerformanceCaveat=v,w.getContext("webgl",S)||w.getContext("experimental-webgl",S)}(c);if(!g)return!1;try{d=g.createShader(g.VERTEX_SHADER)}catch{return!1}return!(!d||g.isContextLost())&&(g.shaderSource(d,"void main() {}"),g.compileShader(d),g.getShaderParameter(d,g.COMPILE_STATUS)===!0)}(n)),D[n]?document.documentMode?"insufficient ECMAScript 6 support":void 0:"insufficient WebGL support"):"insufficient Canvas/getImageData support":"insufficient ArrayBuffer support":"insufficient Uint8ClampedArray support":"insufficient worker support":"insufficient JSON support":"insufficient Object support":"insufficient Function support":"insufficent Array support";var n}(p)}var D={};function N(p,e){if(Array.isArray(p)){if(!Array.isArray(e)||p.length!==e.length)return!1;for(let n=0;n<p.length;n++)if(!N(p[n],e[n]))return!1;return!0}if(typeof p=="object"&&p!==null&&e!==null){if(typeof e!="object"||Object.keys(p).length!==Object.keys(e).length)return!1;for(let n in p)if(!N(p[n],e[n]))return!1;return!0}return p===e}M.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0};class L{static testProp(e){if(!L.docStyle)return e[0];for(let n=0;n<e.length;n++)if(e[n]in L.docStyle)return e[n];return e[0]}static create(e,n,c){let d=window.document.createElement(e);return n!==void 0&&(d.className=n),c&&c.appendChild(d),d}static createNS(e,n){return window.document.createElementNS(e,n)}static disableDrag(){L.docStyle&&L.selectProp&&(L.userSelect=L.docStyle[L.selectProp],L.docStyle[L.selectProp]="none")}static enableDrag(){L.docStyle&&L.selectProp&&(L.docStyle[L.selectProp]=L.userSelect)}static setTransform(e,n){e.style[L.transformProp]=n}static addEventListener(e,n,c,d={}){e.addEventListener(n,c,"passive"in d?d:d.capture)}static removeEventListener(e,n,c,d={}){e.removeEventListener(n,c,"passive"in d?d:d.capture)}static suppressClickInternal(e){e.preventDefault(),e.stopPropagation(),window.removeEventListener("click",L.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",L.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",L.suppressClickInternal,!0)},0)}static mousePos(e,n){let c=e.getBoundingClientRect();return new a.pointGeometry(n.clientX-c.left-e.clientLeft,n.clientY-c.top-e.clientTop)}static touchPos(e,n){let c=e.getBoundingClientRect(),d=[];for(let g=0;g<n.length;g++)d.push(new a.pointGeometry(n[g].clientX-c.left-e.clientLeft,n[g].clientY-c.top-e.clientTop));return d}static mouseButton(e){return e.button}static remove(e){e.parentNode&&e.parentNode.removeChild(e)}}L.docStyle=typeof window<"u"&&window.document&&window.document.documentElement.style,L.selectProp=L.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),L.transformProp=L.testProp(["transform","WebkitTransform"]);class tt{constructor(e){this._transformRequestFn=e}transformRequest(e,n){return this._transformRequestFn&&this._transformRequestFn(e,n)||{url:e}}normalizeSpriteURL(e,n,c){let d=function(g){let v=g.match(pt);if(!v)throw new Error(`Unable to parse URL "${g}"`);return{protocol:v[1],authority:v[2],path:v[3]||"/",params:v[4]?v[4].split("&"):[]}}(e);return d.path+=`${n}${c}`,function(g){let v=g.params.length?`?${g.params.join("&")}`:"";return`${g.protocol}://${g.authority}${g.path}${v}`}(d)}setTransformRequest(e){this._transformRequestFn=e}}let pt=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function ft(p){var e=new a.ARRAY_TYPE(3);return e[0]=p[0],e[1]=p[1],e[2]=p[2],e}var yt,Ft=function(p,e,n){return p[0]=e[0]-n[0],p[1]=e[1]-n[1],p[2]=e[2]-n[2],p};yt=new a.ARRAY_TYPE(3),a.ARRAY_TYPE!=Float32Array&&(yt[0]=0,yt[1]=0,yt[2]=0);var kt=function(p){var e=p[0],n=p[1];return e*e+n*n};(function(){var p=new a.ARRAY_TYPE(2);a.ARRAY_TYPE!=Float32Array&&(p[0]=0,p[1]=0)})();class Ot{constructor(e,n,c,d){this.context=e,this.format=c,this.texture=e.gl.createTexture(),this.update(n,d)}update(e,n,c){let{width:d,height:g}=e,v=!(this.size&&this.size[0]===d&&this.size[1]===g||c),{context:w}=this,{gl:S}=w;if(this.useMipmap=Boolean(n&&n.useMipmap),S.bindTexture(S.TEXTURE_2D,this.texture),w.pixelStoreUnpackFlipY.set(!1),w.pixelStoreUnpack.set(1),w.pixelStoreUnpackPremultiplyAlpha.set(this.format===S.RGBA&&(!n||n.premultiply!==!1)),v)this.size=[d,g],e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||a.isImageBitmap(e)?S.texImage2D(S.TEXTURE_2D,0,this.format,this.format,S.UNSIGNED_BYTE,e):S.texImage2D(S.TEXTURE_2D,0,this.format,d,g,0,this.format,S.UNSIGNED_BYTE,e.data);else{let{x:C,y:k}=c||{x:0,y:0};e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||a.isImageBitmap(e)?S.texSubImage2D(S.TEXTURE_2D,0,C,k,S.RGBA,S.UNSIGNED_BYTE,e):S.texSubImage2D(S.TEXTURE_2D,0,C,k,d,g,S.RGBA,S.UNSIGNED_BYTE,e.data)}this.useMipmap&&this.isSizePowerOfTwo()&&S.generateMipmap(S.TEXTURE_2D)}bind(e,n,c){let{context:d}=this,{gl:g}=d;g.bindTexture(g.TEXTURE_2D,this.texture),c!==g.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(c=g.LINEAR),e!==this.filter&&(g.texParameteri(g.TEXTURE_2D,g.TEXTURE_MAG_FILTER,e),g.texParameteri(g.TEXTURE_2D,g.TEXTURE_MIN_FILTER,c||e),this.filter=e),n!==this.wrap&&(g.texParameteri(g.TEXTURE_2D,g.TEXTURE_WRAP_S,n),g.texParameteri(g.TEXTURE_2D,g.TEXTURE_WRAP_T,n),this.wrap=n)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){let{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}}function he(p){let{userImage:e}=p;return!!(e&&e.render&&e.render())&&(p.data.replace(new Uint8Array(e.data.buffer)),!0)}class ne extends a.Evented{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new a.RGBAImage({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(e){if(this.loaded!==e&&(this.loaded=e,e)){for(let{ids:n,callback:c}of this.requestors)this._notify(n,c);this.requestors=[]}}getImage(e){return this.images[e]}addImage(e,n){this._validate(e,n)&&(this.images[e]=n)}_validate(e,n){let c=!0;return this._validateStretch(n.stretchX,n.data&&n.data.width)||(this.fire(new a.ErrorEvent(new Error(`Image "${e}" has invalid "stretchX" value`))),c=!1),this._validateStretch(n.stretchY,n.data&&n.data.height)||(this.fire(new a.ErrorEvent(new Error(`Image "${e}" has invalid "stretchY" value`))),c=!1),this._validateContent(n.content,n)||(this.fire(new a.ErrorEvent(new Error(`Image "${e}" has invalid "content" value`))),c=!1),c}_validateStretch(e,n){if(!e)return!0;let c=0;for(let d of e){if(d[0]<c||d[1]<d[0]||n<d[1])return!1;c=d[1]}return!0}_validateContent(e,n){return!(e&&(e.length!==4||e[0]<0||n.data.width<e[0]||e[1]<0||n.data.height<e[1]||e[2]<0||n.data.width<e[2]||e[3]<0||n.data.height<e[3]||e[2]<e[0]||e[3]<e[1]))}updateImage(e,n){n.version=this.images[e].version+1,this.images[e]=n,this.updatedImages[e]=!0}removeImage(e){let n=this.images[e];delete this.images[e],delete this.patterns[e],n.userImage&&n.userImage.onRemove&&n.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(e,n){let c=!0;if(!this.isLoaded())for(let d of e)this.images[d]||(c=!1);this.isLoaded()||c?this._notify(e,n):this.requestors.push({ids:e,callback:n})}_notify(e,n){let c={};for(let d of e){this.images[d]||this.fire(new a.Event("styleimagemissing",{id:d}));let g=this.images[d];g?c[d]={data:g.data.clone(),pixelRatio:g.pixelRatio,sdf:g.sdf,version:g.version,stretchX:g.stretchX,stretchY:g.stretchY,content:g.content,hasRenderCallback:Boolean(g.userImage&&g.userImage.render)}:a.warnOnce(`Image "${d}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`)}n(null,c)}getPixelSize(){let{width:e,height:n}=this.atlasImage;return{width:e,height:n}}getPattern(e){let n=this.patterns[e],c=this.getImage(e);if(!c)return null;if(n&&n.position.version===c.version)return n.position;if(n)n.position.version=c.version;else{let d={w:c.data.width+2,h:c.data.height+2,x:0,y:0},g=new a.ImagePosition(d,c);this.patterns[e]={bin:d,position:g}}return this._updatePatternAtlas(),this.patterns[e].position}bind(e){let n=e.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new Ot(e,this.atlasImage,n.RGBA),this.atlasTexture.bind(n.LINEAR,n.CLAMP_TO_EDGE)}_updatePatternAtlas(){let e=[];for(let g in this.patterns)e.push(this.patterns[g].bin);let{w:n,h:c}=a.potpack(e),d=this.atlasImage;d.resize({width:n||1,height:c||1});for(let g in this.patterns){let{bin:v}=this.patterns[g],w=v.x+1,S=v.y+1,C=this.images[g].data,k=C.width,F=C.height;a.RGBAImage.copy(C,d,{x:0,y:0},{x:w,y:S},{width:k,height:F}),a.RGBAImage.copy(C,d,{x:0,y:F-1},{x:w,y:S-1},{width:k,height:1}),a.RGBAImage.copy(C,d,{x:0,y:0},{x:w,y:S+F},{width:k,height:1}),a.RGBAImage.copy(C,d,{x:k-1,y:0},{x:w-1,y:S},{width:1,height:F}),a.RGBAImage.copy(C,d,{x:0,y:0},{x:w+k,y:S},{width:1,height:F})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(e){for(let n of e){if(this.callbackDispatchedThisFrame[n])continue;this.callbackDispatchedThisFrame[n]=!0;let c=this.images[n];he(c)&&this.updateImage(n,c)}}}let be=1e20;function xe(p,e,n,c,d,g,v,w,S){for(let C=e;C<e+c;C++)me(p,n*g+C,g,d,v,w,S);for(let C=n;C<n+d;C++)me(p,C*g+e,1,c,v,w,S)}function me(p,e,n,c,d,g,v){g[0]=0,v[0]=-be,v[1]=be,d[0]=p[e];for(let w=1,S=0,C=0;w<c;w++){d[w]=p[e+w*n];let k=w*w;do{let F=g[S];C=(d[w]-d[F]+k-F*F)/(w-F)/2}while(C<=v[S]&&--S>-1);S++,g[S]=w,v[S]=C,v[S+1]=be}for(let w=0,S=0;w<c;w++){for(;v[S+1]<w;)S++;let C=g[S],k=w-C;p[e+w*n]=d[C]+k*k}}class Ge{constructor(e,n){this.requestManager=e,this.localIdeographFontFamily=n,this.entries={}}setURL(e){this.url=e}getGlyphs(e,n){let c=[];for(let d in e)for(let g of e[d])c.push({stack:d,id:g});a.asyncAll(c,({stack:d,id:g},v)=>{let w=this.entries[d];w||(w=this.entries[d]={glyphs:{},requests:{},ranges:{}});let S=w.glyphs[g];if(S!==void 0)return void v(null,{stack:d,id:g,glyph:S});if(S=this._tinySDF(w,d,g),S)return w.glyphs[g]=S,void v(null,{stack:d,id:g,glyph:S});let C=Math.floor(g/256);if(256*C>65535)return void v(new Error("glyphs > 65535 not supported"));if(w.ranges[C])return void v(null,{stack:d,id:g,glyph:S});let k=w.requests[C];k||(k=w.requests[C]=[],Ge.loadGlyphRange(d,C,this.url,this.requestManager,(F,j)=>{if(j){for(let Q in j)this._doesCharSupportLocalGlyph(+Q)||(w.glyphs[+Q]=j[+Q]);w.ranges[C]=!0}for(let Q of k)Q(F,j);delete w.requests[C]})),k.push((F,j)=>{F?v(F):j&&v(null,{stack:d,id:g,glyph:j[g]||null})})},(d,g)=>{if(d)n(d);else if(g){let v={};for(let{stack:w,id:S,glyph:C}of g)(v[w]||(v[w]={}))[S]=C&&{id:C.id,bitmap:C.bitmap.clone(),metrics:C.metrics};n(null,v)}})}_doesCharSupportLocalGlyph(e){return!!this.localIdeographFontFamily&&(a.unicodeBlockLookup["CJK Unified Ideographs"](e)||a.unicodeBlockLookup["Hangul Syllables"](e)||a.unicodeBlockLookup.Hiragana(e)||a.unicodeBlockLookup.Katakana(e))}_tinySDF(e,n,c){let d=this.localIdeographFontFamily;if(!d||!this._doesCharSupportLocalGlyph(c))return;let g=e.tinySDF;if(!g){let w="400";/bold/i.test(n)?w="900":/medium/i.test(n)?w="500":/light/i.test(n)&&(w="200"),g=e.tinySDF=new Ge.TinySDF({fontSize:24,buffer:3,radius:8,cutoff:.25,fontFamily:d,fontWeight:w})}let v=g.draw(String.fromCharCode(c));return{id:c,bitmap:new a.AlphaImage({width:v.width||30,height:v.height||30},v.data),metrics:{width:v.glyphWidth||24,height:v.glyphHeight||24,left:v.glyphLeft||0,top:v.glyphTop-27||-8,advance:v.glyphAdvance||24}}}}Ge.loadGlyphRange=function(p,e,n,c,d){let g=256*e,v=g+255,w=c.transformRequest(n.replace("{fontstack}",p).replace("{range}",`${g}-${v}`),a.ResourceType.Glyphs);a.getArrayBuffer(w,(S,C)=>{if(S)d(S);else if(C){let k={};for(let F of a.parseGlyphPBF(C))k[F.id]=F;d(null,k)}})},Ge.TinySDF=class{constructor({fontSize:p=24,buffer:e=3,radius:n=8,cutoff:c=.25,fontFamily:d="sans-serif",fontWeight:g="normal",fontStyle:v="normal"}={}){this.buffer=e,this.cutoff=c,this.radius=n;let w=this.size=p+4*e,S=this._createCanvas(w),C=this.ctx=S.getContext("2d",{willReadFrequently:!0});C.font=`${v} ${g} ${p}px ${d}`,C.textBaseline="alphabetic",C.textAlign="left",C.fillStyle="black",this.gridOuter=new Float64Array(w*w),this.gridInner=new Float64Array(w*w),this.f=new Float64Array(w),this.z=new Float64Array(w+1),this.v=new Uint16Array(w)}_createCanvas(p){let e=document.createElement("canvas");return e.width=e.height=p,e}draw(p){let{width:e,actualBoundingBoxAscent:n,actualBoundingBoxDescent:c,actualBoundingBoxLeft:d,actualBoundingBoxRight:g}=this.ctx.measureText(p),v=Math.ceil(n),w=Math.min(this.size-this.buffer,Math.ceil(g-d)),S=Math.min(this.size-this.buffer,v+Math.ceil(c)),C=w+2*this.buffer,k=S+2*this.buffer,F=Math.max(C*k,0),j=new Uint8ClampedArray(F),Q={data:j,width:C,height:k,glyphWidth:w,glyphHeight:S,glyphTop:v,glyphLeft:0,glyphAdvance:e};if(w===0||S===0)return Q;let{ctx:$,buffer:J,gridInner:lt,gridOuter:ht}=this;$.clearRect(J,J,w,S),$.fillText(p,J,J+v);let gt=$.getImageData(J,J,w,S);ht.fill(be,0,F),lt.fill(0,0,F);for(let ut=0;ut<S;ut++)for(let At=0;At<w;At++){let Mt=gt.data[4*(ut*w+At)+3]/255;if(Mt===0)continue;let Tt=(ut+J)*C+At+J;if(Mt===1)ht[Tt]=0,lt[Tt]=be;else{let Nt=.5-Mt;ht[Tt]=Nt>0?Nt*Nt:0,lt[Tt]=Nt<0?Nt*Nt:0}}xe(ht,0,0,C,k,C,this.f,this.v,this.z),xe(lt,J,J,w,S,C,this.f,this.v,this.z);for(let ut=0;ut<F;ut++){let At=Math.sqrt(ht[ut])-Math.sqrt(lt[ut]);j[ut]=Math.round(255-255*(At/this.radius+this.cutoff))}return Q}};let Ne=new a.Properties({anchor:new a.DataConstantProperty(a.spec.light.anchor),position:new class{constructor(){this.specification=a.spec.light.position}possiblyEvaluate(p,e){return a.sphericalToCartesian(p.expression.evaluate(e))}interpolate(p,e,n){return{x:a.number(p.x,e.x,n),y:a.number(p.y,e.y,n),z:a.number(p.z,e.z,n)}}},color:new a.DataConstantProperty(a.spec.light.color),intensity:new a.DataConstantProperty(a.spec.light.intensity)}),di="-transition";class Bi extends a.Evented{constructor(e){super(),this._transitionable=new a.Transitionable(Ne),this.setLight(e),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(e,n={}){if(!this._validate(a.validateLight,e,n))for(let c in e){let d=e[c];c.endsWith(di)?this._transitionable.setTransition(c.slice(0,-di.length),d):this._transitionable.setValue(c,d)}}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(e,n,c){return(!c||c.validate!==!1)&&a.emitValidationErrors(this,e.call(a.validateStyle,a.extend({value:n,style:{glyphs:!0,sprite:!0},styleSpec:a.spec})))}}class Yi{constructor(e,n){this.width=e,this.height=n,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(e,n){let c=e.join(",")+String(n);return this.dashEntry[c]||(this.dashEntry[c]=this.addDash(e,n)),this.dashEntry[c]}getDashRanges(e,n,c){let d=[],g=e.length%2==1?-e[e.length-1]*c:0,v=e[0]*c,w=!0;d.push({left:g,right:v,isDash:w,zeroLength:e[0]===0});let S=e[0];for(let C=1;C<e.length;C++){w=!w;let k=e[C];g=S*c,S+=k,v=S*c,d.push({left:g,right:v,isDash:w,zeroLength:k===0})}return d}addRoundDash(e,n,c){let d=n/2;for(let g=-c;g<=c;g++){let v=this.width*(this.nextRow+c+g),w=0,S=e[w];for(let C=0;C<this.width;C++){C/S.right>1&&(S=e[++w]);let k=Math.abs(C-S.left),F=Math.abs(C-S.right),j=Math.min(k,F),Q,$=g/c*(d+1);if(S.isDash){let J=d-Math.abs($);Q=Math.sqrt(j*j+J*J)}else Q=d-Math.sqrt(j*j+$*$);this.data[v+C]=Math.max(0,Math.min(255,Q+128))}}}addRegularDash(e){for(let w=e.length-1;w>=0;--w){let S=e[w],C=e[w+1];S.zeroLength?e.splice(w,1):C&&C.isDash===S.isDash&&(C.left=S.left,e.splice(w,1))}let n=e[0],c=e[e.length-1];n.isDash===c.isDash&&(n.left=c.left-this.width,c.right=n.right+this.width);let d=this.width*this.nextRow,g=0,v=e[g];for(let w=0;w<this.width;w++){w/v.right>1&&(v=e[++g]);let S=Math.abs(w-v.left),C=Math.abs(w-v.right),k=Math.min(S,C);this.data[d+w]=Math.max(0,Math.min(255,(v.isDash?k:-k)+128))}}addDash(e,n){let c=n?7:0,d=2*c+1;if(this.nextRow+d>this.height)return a.warnOnce("LineAtlas out of space"),null;let g=0;for(let w=0;w<e.length;w++)g+=e[w];if(g!==0){let w=this.width/g,S=this.getDashRanges(e,this.width,w);n?this.addRoundDash(S,w,c):this.addRegularDash(S)}let v={y:(this.nextRow+c+.5)/this.height,height:2*c/this.height,width:g};return this.nextRow+=d,this.dirty=!0,v}bind(e){let n=e.gl;this.texture?(n.bindTexture(n.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,n.texSubImage2D(n.TEXTURE_2D,0,0,0,this.width,this.height,n.ALPHA,n.UNSIGNED_BYTE,this.data))):(this.texture=n.createTexture(),n.bindTexture(n.TEXTURE_2D,this.texture),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.REPEAT),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.REPEAT),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.LINEAR),n.texImage2D(n.TEXTURE_2D,0,n.ALPHA,this.width,this.height,0,n.ALPHA,n.UNSIGNED_BYTE,this.data))}}class Fi{constructor(e,n){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=a.uniqueId();let c=this.workerPool.acquire(this.id);for(let d=0;d<c.length;d++){let g=new Fi.Actor(c[d],n,this.id);g.name=`Worker ${d}`,this.actors.push(g)}}broadcast(e,n,c){a.asyncAll(this.actors,(d,g)=>{d.send(e,n,g)},c=c||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(){this.actors.forEach(e=>{e.remove()}),this.actors=[],this.workerPool.release(this.id)}}function jr(p,e,n){let c=function(d,g){if(d)return n(d);if(g){let v=a.pick(a.extend(g,p),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);g.vector_layers&&(v.vectorLayers=g.vector_layers,v.vectorLayerIds=v.vectorLayers.map(w=>w.id)),n(null,v)}};return p.url?a.getJSON(e.transformRequest(p.url,a.ResourceType.Source),c):a.exported.frame(()=>c(null,p))}Fi.Actor=a.Actor;class ye{constructor(e,n,c){this.bounds=a.LngLatBounds.convert(this.validateBounds(e)),this.minzoom=n||0,this.maxzoom=c||24}validateBounds(e){return Array.isArray(e)&&e.length===4?[Math.max(-180,e[0]),Math.max(-90,e[1]),Math.min(180,e[2]),Math.min(90,e[3])]:[-180,-90,180,90]}contains(e){let n=Math.pow(2,e.z),c=Math.floor(a.mercatorXfromLng(this.bounds.getWest())*n),d=Math.floor(a.mercatorYfromLat(this.bounds.getNorth())*n),g=Math.ceil(a.mercatorXfromLng(this.bounds.getEast())*n),v=Math.ceil(a.mercatorYfromLat(this.bounds.getSouth())*n);return e.x>=c&&e.x<g&&e.y>=d&&e.y<v}}class zr extends a.Evented{constructor(e,n,c,d){if(super(),this.id=e,this.dispatcher=c,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,a.extend(this,a.pick(n,["url","scheme","tileSize","promoteId"])),this._options=a.extend({type:"vector"},n),this._collectResourceTiming=n.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(d)}load(){this._loaded=!1,this.fire(new a.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=jr(this._options,this.map._requestManager,(e,n)=>{this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),e?this.fire(new a.ErrorEvent(e)):n&&(a.extend(this,n),n.bounds&&(this.tileBounds=new ye(n.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(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}onAdd(e){this.map=e,this.load()}setSourceProperty(e){this._tileJSONRequest&&this._tileJSONRequest.cancel(),e(),this.load()}setTiles(e){return this.setSourceProperty(()=>{this._options.tiles=e}),this}setUrl(e){return this.setSourceProperty(()=>{this.url=e,this._options.url=e}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return a.extend({},this._options)}loadTile(e,n){let c=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),d={request:this.map._requestManager.transformRequest(c,a.ResourceType.Tile),uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,tileSize:this.tileSize*e.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};function g(v,w){return delete e.request,e.aborted?n(null):v&&v.status!==404?n(v):(w&&w.resourceTiming&&(e.resourceTiming=w.resourceTiming),this.map._refreshExpiredTiles&&w&&e.setExpiryData(w),e.loadVectorData(w,this.map.painter),a.cacheEntryPossiblyAdded(this.dispatcher),n(null),void(e.reloadCallback&&(this.loadTile(e,e.reloadCallback),e.reloadCallback=null)))}d.request.collectResourceTiming=this._collectResourceTiming,e.actor&&e.state!=="expired"?e.state==="loading"?e.reloadCallback=n:e.request=e.actor.send("reloadTile",d,g.bind(this)):(e.actor=this.dispatcher.getActor(),e.request=e.actor.send("loadTile",d,g.bind(this)))}abortTile(e){e.request&&(e.request.cancel(),delete e.request),e.actor&&e.actor.send("abortTile",{uid:e.uid,type:this.type,source:this.id},void 0)}unloadTile(e){e.unloadVectorData(),e.actor&&e.actor.send("removeTile",{uid:e.uid,type:this.type,source:this.id},void 0)}hasTransition(){return!1}}class $r extends a.Evented{constructor(e,n,c,d){super(),this.id=e,this.dispatcher=c,this.setEventedParent(d),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"},n),a.extend(this,a.pick(n,["url","scheme","tileSize"]))}load(){this._loaded=!1,this.fire(new a.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=jr(this._options,this.map._requestManager,(e,n)=>{this._tileJSONRequest=null,this._loaded=!0,e?this.fire(new a.ErrorEvent(e)):n&&(a.extend(this,n),n.bounds&&(this.tileBounds=new ye(n.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(e){this.map=e,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return a.extend({},this._options)}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}loadTile(e,n){let c=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);e.request=a.getImage(this.map._requestManager.transformRequest(c,a.ResourceType.Tile),(d,g,v)=>{if(delete e.request,e.aborted)e.state="unloaded",n(null);else if(d)e.state="errored",n(d);else if(g){this.map._refreshExpiredTiles&&e.setExpiryData(v);let w=this.map.painter.context,S=w.gl;e.texture=this.map.painter.getTileTexture(g.width),e.texture?e.texture.update(g,{useMipmap:!0}):(e.texture=new Ot(w,g,S.RGBA,{useMipmap:!0}),e.texture.bind(S.LINEAR,S.CLAMP_TO_EDGE,S.LINEAR_MIPMAP_NEAREST),w.extTextureFilterAnisotropic&&S.texParameterf(S.TEXTURE_2D,w.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,w.extTextureFilterAnisotropicMax)),e.state="loaded",a.cacheEntryPossiblyAdded(this.dispatcher),n(null)}})}abortTile(e,n){e.request&&(e.request.cancel(),delete e.request),n()}unloadTile(e,n){e.texture&&this.map.painter.saveTileTexture(e.texture),n()}hasTransition(){return!1}}let en;class _i extends $r{constructor(e,n,c,d){super(e,n,c,d),this.type="raster-dem",this.maxzoom=22,this._options=a.extend({type:"raster-dem"},n),this.encoding=n.encoding||"mapbox"}serialize(){return{type:"raster-dem",url:this.url,tileSize:this.tileSize,tiles:this.tiles,bounds:this.bounds,encoding:this.encoding}}loadTile(e,n){let c=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);function d(g,v){g&&(e.state="errored",n(g)),v&&(e.dem=v,e.needsHillshadePrepare=!0,e.state="loaded",n(null))}e.request=a.getImage(this.map._requestManager.transformRequest(c,a.ResourceType.Tile),function(g,v){if(delete e.request,e.aborted)e.state="unloaded",n(null);else if(g)e.state="errored",n(g);else if(v){this.map._refreshExpiredTiles&&e.setExpiryData(v),delete v.cacheControl,delete v.expires;let w=a.isImageBitmap(v)&&(en==null&&(en=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),en)?v:a.exported.getImageData(v,1),S={uid:e.uid,coord:e.tileID,source:this.id,rawImageData:w,encoding:this.encoding};e.actor&&e.state!=="expired"||(e.actor=this.dispatcher.getActor(),e.actor.send("loadDEMTile",S,d.bind(this)))}}.bind(this)),e.neighboringTiles=this._getNeighboringTiles(e.tileID)}_getNeighboringTiles(e){let n=e.canonical,c=Math.pow(2,n.z),d=(n.x-1+c)%c,g=n.x===0?e.wrap-1:e.wrap,v=(n.x+1+c)%c,w=n.x+1===c?e.wrap+1:e.wrap,S={};return S[new a.OverscaledTileID(e.overscaledZ,g,n.z,d,n.y).key]={backfilled:!1},S[new a.OverscaledTileID(e.overscaledZ,w,n.z,v,n.y).key]={backfilled:!1},n.y>0&&(S[new a.OverscaledTileID(e.overscaledZ,g,n.z,d,n.y-1).key]={backfilled:!1},S[new a.OverscaledTileID(e.overscaledZ,e.wrap,n.z,n.x,n.y-1).key]={backfilled:!1},S[new a.OverscaledTileID(e.overscaledZ,w,n.z,v,n.y-1).key]={backfilled:!1}),n.y+1<c&&(S[new a.OverscaledTileID(e.overscaledZ,g,n.z,d,n.y+1).key]={backfilled:!1},S[new a.OverscaledTileID(e.overscaledZ,e.wrap,n.z,n.x,n.y+1).key]={backfilled:!1},S[new a.OverscaledTileID(e.overscaledZ,w,n.z,v,n.y+1).key]={backfilled:!1}),S}unloadTile(e){e.demTexture&&this.map.painter.saveTileTexture(e.demTexture),e.fbo&&(e.fbo.destroy(),delete e.fbo),e.dem&&delete e.dem,delete e.neighboringTiles,e.state="unloaded",e.actor&&e.actor.send("removeDEMTile",{uid:e.uid,source:this.id})}}class mn extends a.Evented{constructor(e,n,c,d){super(),this.id=e,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._pendingLoads=0,this.actor=c.getActor(),this.setEventedParent(d),this._data=n.data,this._options=a.extend({},n),this._collectResourceTiming=n.collectResourceTiming,n.maxzoom!==void 0&&(this.maxzoom=n.maxzoom),n.type&&(this.type=n.type),n.attribution&&(this.attribution=n.attribution),this.promoteId=n.promoteId;let g=a.EXTENT/this.tileSize;this.workerOptions=a.extend({source:this.id,cluster:n.cluster||!1,geojsonVtOptions:{buffer:(n.buffer!==void 0?n.buffer:128)*g,tolerance:(n.tolerance!==void 0?n.tolerance:.375)*g,extent:a.EXTENT,maxZoom:this.maxzoom,lineMetrics:n.lineMetrics||!1,generateId:n.generateId||!1},superclusterOptions:{maxZoom:n.clusterMaxZoom!==void 0?n.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,n.clusterMinPoints||2),extent:a.EXTENT,radius:(n.clusterRadius||50)*g,log:!1,generateId:n.generateId||!1},clusterProperties:n.clusterProperties,filter:n.filter},n.workerOptions)}load(){this._updateWorkerData("metadata")}onAdd(e){this.map=e,this.load()}setData(e){return this._data=e,this._updateWorkerData("content"),this}getClusterExpansionZoom(e,n){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:e,source:this.id},n),this}getClusterChildren(e,n){return this.actor.send("geojson.getClusterChildren",{clusterId:e,source:this.id},n),this}getClusterLeaves(e,n,c,d){return this.actor.send("geojson.getClusterLeaves",{source:this.id,clusterId:e,limit:n,offset:c},d),this}_updateWorkerData(e){let n=a.extend({},this.workerOptions),c=this._data;typeof c=="string"?(n.request=this.map._requestManager.transformRequest(a.exported.resolveURL(c),a.ResourceType.Source),n.request.collectResourceTiming=this._collectResourceTiming):n.data=JSON.stringify(c),this._pendingLoads++,this.fire(new a.Event("dataloading",{dataType:"source"})),this.actor.send(`${this.type}.loadData`,n,(d,g)=>{if(this._pendingLoads--,this._removed||g&&g.abandoned)return;let v=null;if(g&&g.resourceTiming&&g.resourceTiming[this.id]&&(v=g.resourceTiming[this.id].slice(0)),this.actor.send(`${this.type}.coalesce`,{source:n.source},null),d)return void this.fire(new a.ErrorEvent(d));let w={dataType:"source",sourceDataType:e};this._collectResourceTiming&&v&&v.length>0&&a.extend(w,{resourceTiming:v}),this.fire(new a.Event("data",w))})}loaded(){return this._pendingLoads===0}loadTile(e,n){let c=e.actor?"reloadTile":"loadTile";e.actor=this.actor;let d={type:this.type,uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};e.request=this.actor.send(c,d,(g,v)=>(delete e.request,e.unloadVectorData(),e.aborted?n(null):g?n(g):(e.loadVectorData(v,this.map.painter,c==="reloadTile"),n(null))))}abortTile(e){e.request&&(e.request.cancel(),delete e.request),e.aborted=!0}unloadTile(e){e.unloadVectorData(),this.actor.send("removeTile",{uid:e.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 kr=a.createLayout([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class Lr extends a.Evented{constructor(e,n,c,d){super(),this.id=e,this.dispatcher=c,this.coordinates=n.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(d),this.options=n}load(e,n){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),(c,d)=>{this._loaded=!0,c?this.fire(new a.ErrorEvent(c)):d&&(this.image=d,e&&(this.coordinates=e),n&&n(),this._finishLoading())})}loaded(){return this._loaded}updateImage(e){return this.image&&e.url?(this.options.url=e.url,this.load(e.coordinates,()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new a.Event("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(e){this.map=e,this.load()}setCoordinates(e){this.coordinates=e;let n=e.map(a.MercatorCoordinate.fromLngLat);this.tileID=function(d){let g=1/0,v=1/0,w=-1/0,S=-1/0;for(let j of d)g=Math.min(g,j.x),v=Math.min(v,j.y),w=Math.max(w,j.x),S=Math.max(S,j.y);let C=Math.max(w-g,S-v),k=Math.max(0,Math.floor(-Math.log(C)/Math.LN2)),F=Math.pow(2,k);return new a.CanonicalTileID(k,Math.floor((g+w)/2*F),Math.floor((v+S)/2*F))}(n),this.minzoom=this.maxzoom=this.tileID.z;let c=n.map(d=>this.tileID.getTilePoint(d)._round());return this._boundsArray=new a.RasterBoundsArray,this._boundsArray.emplaceBack(c[0].x,c[0].y,0,0),this._boundsArray.emplaceBack(c[1].x,c[1].y,a.EXTENT,0),this._boundsArray.emplaceBack(c[3].x,c[3].y,0,a.EXTENT),this._boundsArray.emplaceBack(c[2].x,c[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;let e=this.map.painter.context,n=e.gl;this.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,kr.members)),this.boundsSegments||(this.boundsSegments=a.SegmentVector.simpleSegment(0,0,4,2)),this.texture||(this.texture=new Ot(e,this.image,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));for(let c in this.tiles){let d=this.tiles[c];d.state!=="loaded"&&(d.state="loaded",d.texture=this.texture)}}loadTile(e,n){this.tileID&&this.tileID.equals(e.tileID.canonical)?(this.tiles[String(e.tileID.wrap)]=e,e.buckets={},n(null)):(e.state="errored",n(null))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class rn extends Lr{constructor(e,n,c,d){super(e,n,c,d),this.roundZoom=!0,this.type="video",this.options=n}load(){this._loaded=!1;let e=this.options;this.urls=[];for(let n of e.urls)this.urls.push(this.map._requestManager.transformRequest(n,a.ResourceType.Source).url);a.getVideo(this.urls,(n,c)=>{this._loaded=!0,n?this.fire(new a.ErrorEvent(n)):c&&(this.video=c,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(e){if(this.video){let n=this.video.seekable;e<n.start(0)||e>n.end(0)?this.fire(new a.ErrorEvent(new a.ValidationError(`sources.${this.id}`,null,`Playback for this video can be set only between the ${n.start(0)} and ${n.end(0)}-second mark.`))):this.video.currentTime=e}}getVideo(){return this.video}onAdd(e){this.map||(this.map=e,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;let e=this.map.painter.context,n=e.gl;this.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,kr.members)),this.boundsSegments||(this.boundsSegments=a.SegmentVector.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE),n.texSubImage2D(n.TEXTURE_2D,0,0,0,n.RGBA,n.UNSIGNED_BYTE,this.video)):(this.texture=new Ot(e,this.video,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));for(let c in this.tiles){let d=this.tiles[c];d.state!=="loaded"&&(d.state="loaded",d.texture=this.texture)}}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class nn extends Lr{constructor(e,n,c,d){super(e,n,c,d),n.coordinates?Array.isArray(n.coordinates)&&n.coordinates.length===4&&!n.coordinates.some(g=>!Array.isArray(g)||g.length!==2||g.some(v=>typeof v!="number"))||this.fire(new a.ErrorEvent(new a.ValidationError(`sources.${e}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new a.ErrorEvent(new a.ValidationError(`sources.${e}`,null,'missing required property "coordinates"'))),n.animate&&typeof n.animate!="boolean"&&this.fire(new a.ErrorEvent(new a.ValidationError(`sources.${e}`,null,'optional "animate" property must be a boolean value'))),n.canvas?typeof n.canvas=="string"||n.canvas instanceof HTMLCanvasElement||this.fire(new a.ErrorEvent(new a.ValidationError(`sources.${e}`,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.${e}`,null,'missing required property "canvas"'))),this.options=n,this.animate=n.animate===void 0||n.animate}load(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new 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(e){this.map=e,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let e=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,e=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,e=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;let n=this.map.painter.context,c=n.gl;this.boundsBuffer||(this.boundsBuffer=n.createVertexBuffer(this._boundsArray,kr.members)),this.boundsSegments||(this.boundsSegments=a.SegmentVector.simpleSegment(0,0,4,2)),this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new Ot(n,this.canvas,c.RGBA,{premultiply:!0});for(let d in this.tiles){let g=this.tiles[d];g.state!=="loaded"&&(g.state="loaded",g.texture=this.texture)}}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(let e of[this.canvas.width,this.canvas.height])if(isNaN(e)||e<=0)return!0;return!1}}let gr={vector:zr,raster:$r,"raster-dem":_i,geojson:mn,video:rn,image:Lr,canvas:nn};function Dr(p,e){let n=a.create();return a.translate(n,n,[1,1,0]),a.scale(n,n,[.5*p.width,.5*p.height,1]),a.multiply(n,n,p.calculatePosMatrix(e.toUnwrapped()))}function Wr(p,e,n,c,d,g){let v=function(F,j,Q){if(F)for(let $ of F){let J=j[$];if(J&&J.source===Q&&J.type==="fill-extrusion")return!0}else for(let $ in j){let J=j[$];if(J.source===Q&&J.type==="fill-extrusion")return!0}return!1}(d&&d.layers,e,p.id),w=g.maxPitchScaleFactor(),S=p.tilesIn(c,w,v);S.sort(Tn);let C=[];for(let F of S)C.push({wrappedTileID:F.tileID.wrapped().key,queryResults:F.tile.queryRenderedFeatures(e,n,p._state,F.queryGeometry,F.cameraQueryGeometry,F.scale,d,g,w,Dr(p.transform,F.tileID))});let k=function(F){let j={},Q={};for(let $ of F){let J=$.queryResults,lt=$.wrappedTileID,ht=Q[lt]=Q[lt]||{};for(let gt in J){let ut=J[gt],At=ht[gt]=ht[gt]||{},Mt=j[gt]=j[gt]||[];for(let Tt of ut)At[Tt.featureIndex]||(At[Tt.featureIndex]=!0,Mt.push(Tt))}}return j}(C);for(let F in k)k[F].forEach(j=>{let Q=j.feature,$=p.getFeatureState(Q.layer["source-layer"],Q.id);Q.source=Q.layer.source,Q.layer["source-layer"]&&(Q.sourceLayer=Q.layer["source-layer"]),Q.state=$});return k}function Tn(p,e){let n=p.tileID,c=e.tileID;return n.overscaledZ-c.overscaledZ||n.canonical.y-c.canonical.y||n.wrap-c.wrap||n.canonical.x-c.canonical.x}class Dn{constructor(e,n){this.tileID=e,this.uid=a.uniqueId(),this.uses=0,this.tileSize=n,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.expiredRequestCount=0,this.state="loading"}registerFadeDuration(e){let n=e+this.timeAdded;n<a.exported.now()||this.fadeEndTime&&n<this.fadeEndTime||(this.fadeEndTime=n)}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}loadVectorData(e,n,c){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",e){e.featureIndex&&(this.latestFeatureIndex=e.featureIndex,e.rawTileData?(this.latestRawTileData=e.rawTileData,this.latestFeatureIndex.rawTileData=e.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=e.collisionBoxArray,this.buckets=function(d,g){let v={};if(!g)return v;for(let w of d){let S=w.layerIds.map(C=>g.getLayer(C)).filter(Boolean);if(S.length!==0){w.layers=S,w.stateDependentLayerIds&&(w.stateDependentLayers=w.stateDependentLayerIds.map(C=>S.filter(k=>k.id===C)[0]));for(let C of S)v[C.id]=w}}return v}(e.buckets,n.style),this.hasSymbolBuckets=!1;for(let d in this.buckets){let g=this.buckets[d];if(g instanceof a.SymbolBucket){if(this.hasSymbolBuckets=!0,!c)break;g.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(let d in this.buckets){let g=this.buckets[d];if(g instanceof a.SymbolBucket&&g.hasRTLText){this.hasRTLText=!0,a.lazyLoadRTLTextPlugin();break}}this.queryPadding=0;for(let d in this.buckets){let g=this.buckets[d];this.queryPadding=Math.max(this.queryPadding,n.style.getLayer(d).queryRadius(g))}e.imageAtlas&&(this.imageAtlas=e.imageAtlas),e.glyphAtlasImage&&(this.glyphAtlasImage=e.glyphAtlasImage)}else this.collisionBoxArray=new a.CollisionBoxArray}unloadVectorData(){for(let e in this.buckets)this.buckets[e].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(e){return this.buckets[e.id]}upload(e){for(let c in this.buckets){let d=this.buckets[c];d.uploadPending()&&d.upload(e)}let n=e.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new Ot(e,this.imageAtlas.image,n.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new Ot(e,this.glyphAtlasImage,n.ALPHA),this.glyphAtlasImage=null)}prepare(e){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(e,this.imageAtlasTexture)}queryRenderedFeatures(e,n,c,d,g,v,w,S,C,k){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:d,cameraQueryGeometry:g,scale:v,tileSize:this.tileSize,pixelPosMatrix:k,transform:S,params:w,queryPadding:this.queryPadding*C},e,n,c):{}}querySourceFeatures(e,n){let c=this.latestFeatureIndex;if(!c||!c.rawTileData)return;let d=c.loadVTLayers(),g=n?n.sourceLayer:"",v=d._geojsonTileLayer||d[g];if(!v)return;let w=a.createFilter(n&&n.filter),{z:S,x:C,y:k}=this.tileID.canonical,F={z:S,x:C,y:k};for(let j=0;j<v.length;j++){let Q=v.feature(j);if(w.needGeometry){let lt=a.toEvaluationFeature(Q,!0);if(!w.filter(new a.EvaluationParameters(this.tileID.overscaledZ),lt,this.tileID.canonical))continue}else if(!w.filter(new a.EvaluationParameters(this.tileID.overscaledZ),Q))continue;let $=c.getId(Q,g),J=new a.GeoJSONFeature(Q,S,C,k,$);J.tile=F,e.push(J)}}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(e){let n=this.expirationTime;if(e.cacheControl){let c=a.parseCacheControl(e.cacheControl);c["max-age"]&&(this.expirationTime=Date.now()+1e3*c["max-age"])}else e.expires&&(this.expirationTime=new Date(e.expires).getTime());if(this.expirationTime){let c=Date.now(),d=!1;if(this.expirationTime>c)d=!1;else if(n)if(this.expirationTime<n)d=!0;else{let g=this.expirationTime-n;g?this.expirationTime=c+Math.max(g,3e4):d=!0}else d=!0;d?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-new Date().getTime(),Math.pow(2,31)-1)}setFeatureState(e,n){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||Object.keys(e).length===0)return;let c=this.latestFeatureIndex.loadVTLayers();for(let d in this.buckets){if(!n.style.hasLayer(d))continue;let g=this.buckets[d],v=g.layers[0].sourceLayer||"_geojsonTileLayer",w=c[v],S=e[v];if(!w||!S||Object.keys(S).length===0)continue;g.update(S,w,this.imageAtlas&&this.imageAtlas.patternPositions||{});let C=n&&n.style&&n.style.getLayer(d);C&&(this.queryPadding=Math.max(this.queryPadding,C.queryRadius(g)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<a.exported.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(e){this.symbolFadeHoldUntil=a.exported.now()+e}setDependencies(e,n){let c={};for(let d of n)c[d]=!0;this.dependencies[e]=c}hasDependency(e,n){for(let c of e){let d=this.dependencies[c];if(d){for(let g of n)if(d[g])return!0}}return!1}}class Rn{constructor(e,n){this.max=e,this.onRemove=n,this.reset()}reset(){for(let e in this.data)for(let n of this.data[e])n.timeout&&clearTimeout(n.timeout),this.onRemove(n.value);return this.data={},this.order=[],this}add(e,n,c){let d=e.wrapped().key;this.data[d]===void 0&&(this.data[d]=[]);let g={value:n,timeout:void 0};if(c!==void 0&&(g.timeout=setTimeout(()=>{this.remove(e,g)},c)),this.data[d].push(g),this.order.push(d),this.order.length>this.max){let v=this._getAndRemoveByKey(this.order[0]);v&&this.onRemove(v)}return this}has(e){return e.wrapped().key in this.data}getAndRemove(e){return this.has(e)?this._getAndRemoveByKey(e.wrapped().key):null}_getAndRemoveByKey(e){let n=this.data[e].shift();return n.timeout&&clearTimeout(n.timeout),this.data[e].length===0&&delete this.data[e],this.order.splice(this.order.indexOf(e),1),n.value}getByKey(e){let n=this.data[e];return n?n[0].value:null}get(e){return this.has(e)?this.data[e.wrapped().key][0].value:null}remove(e,n){if(!this.has(e))return this;let c=e.wrapped().key,d=n===void 0?0:this.data[c].indexOf(n),g=this.data[c][d];return this.data[c].splice(d,1),g.timeout&&clearTimeout(g.timeout),this.data[c].length===0&&delete this.data[c],this.onRemove(g.value),this.order.splice(this.order.indexOf(c),1),this}setMaxSize(e){for(this.max=e;this.order.length>this.max;){let n=this._getAndRemoveByKey(this.order[0]);n&&this.onRemove(n)}return this}filter(e){let n=[];for(let c in this.data)for(let d of this.data[c])e(d.value)||n.push(d);for(let c of n)this.remove(c.value.tileID,c)}}class us{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(e,n,c){let d=String(n);if(this.stateChanges[e]=this.stateChanges[e]||{},this.stateChanges[e][d]=this.stateChanges[e][d]||{},a.extend(this.stateChanges[e][d],c),this.deletedStates[e]===null){this.deletedStates[e]={};for(let g in this.state[e])g!==d&&(this.deletedStates[e][g]=null)}else if(this.deletedStates[e]&&this.deletedStates[e][d]===null){this.deletedStates[e][d]={};for(let g in this.state[e][d])c[g]||(this.deletedStates[e][d][g]=null)}else for(let g in c)this.deletedStates[e]&&this.deletedStates[e][d]&&this.deletedStates[e][d][g]===null&&delete this.deletedStates[e][d][g]}removeFeatureState(e,n,c){if(this.deletedStates[e]===null)return;let d=String(n);if(this.deletedStates[e]=this.deletedStates[e]||{},c&&n!==void 0)this.deletedStates[e][d]!==null&&(this.deletedStates[e][d]=this.deletedStates[e][d]||{},this.deletedStates[e][d][c]=null);else if(n!==void 0)if(this.stateChanges[e]&&this.stateChanges[e][d])for(c in this.deletedStates[e][d]={},this.stateChanges[e][d])this.deletedStates[e][d][c]=null;else this.deletedStates[e][d]=null;else this.deletedStates[e]=null}getState(e,n){let c=String(n),d=a.extend({},(this.state[e]||{})[c],(this.stateChanges[e]||{})[c]);if(this.deletedStates[e]===null)return{};if(this.deletedStates[e]){let g=this.deletedStates[e][n];if(g===null)return{};for(let v in g)delete d[v]}return d}initializeTileState(e,n){e.setFeatureState(this.state,n)}coalesceChanges(e,n){let c={};for(let d in this.stateChanges){this.state[d]=this.state[d]||{};let g={};for(let v in this.stateChanges[d])this.state[d][v]||(this.state[d][v]={}),a.extend(this.state[d][v],this.stateChanges[d][v]),g[v]=this.state[d][v];c[d]=g}for(let d in this.deletedStates){this.state[d]=this.state[d]||{};let g={};if(this.deletedStates[d]===null)for(let v in this.state[d])g[v]={},this.state[d][v]={};else for(let v in this.deletedStates[d]){if(this.deletedStates[d][v]===null)this.state[d][v]={};else for(let w of Object.keys(this.deletedStates[d][v]))delete this.state[d][v][w];g[v]=this.state[d][v]}c[d]=c[d]||{},a.extend(c[d],g)}if(this.stateChanges={},this.deletedStates={},Object.keys(c).length!==0)for(let d in e)e[d].setFeatureState(c,n)}}class Je extends a.Evented{constructor(e,n,c){super(),this.id=e,this.dispatcher=c,this.on("data",d=>{d.dataType==="source"&&d.sourceDataType==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&d.dataType==="source"&&d.sourceDataType==="content"&&(this.reload(),this.transform&&this.update(this.transform))}),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=function(d,g,v,w){let S=new gr[g.type](d,g,v,w);if(S.id!==d)throw new Error(`Expected Source id to be ${d} instead of ${S.id}`);return a.bindAll(["load","abort","unload","serialize","prepare"],S),S}(e,n,c,this),this._tiles={},this._cache=new Rn(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new us}onAdd(e){this.map=e,this._maxTileCacheSize=e?e._maxTileCacheSize:null,this._source&&this._source.onAdd&&this._source.onAdd(e)}onRemove(e){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(e)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;for(let e in this._tiles){let n=this._tiles[e];if(n.state!=="loaded"&&n.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;let e=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,e&&this.reload(),this.transform&&this.update(this.transform)}_loadTile(e,n){return this._source.loadTile(e,n)}_unloadTile(e){if(this._source.unloadTile)return this._source.unloadTile(e,()=>{})}_abortTile(e){this._source.abortTile&&this._source.abortTile(e,()=>{}),this._source.fire(new a.Event("dataabort",{tile:e,coord:e.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(e){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(let n in this._tiles){let c=this._tiles[n];c.upload(e),c.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(e=>e.tileID).sort(sn).map(e=>e.key)}getRenderableIds(e){let n=[];for(let c in this._tiles)this._isIdRenderable(c,e)&&n.push(this._tiles[c]);return e?n.sort((c,d)=>{let g=c.tileID,v=d.tileID,w=new a.pointGeometry(g.canonical.x,g.canonical.y)._rotate(this.transform.angle),S=new a.pointGeometry(v.canonical.x,v.canonical.y)._rotate(this.transform.angle);return g.overscaledZ-v.overscaledZ||S.y-w.y||S.x-w.x}).map(c=>c.tileID.key):n.map(c=>c.tileID).sort(sn).map(c=>c.key)}hasRenderableParent(e){let n=this.findLoadedParent(e,0);return!!n&&this._isIdRenderable(n.tileID.key)}_isIdRenderable(e,n){return this._tiles[e]&&this._tiles[e].hasData()&&!this._coveredTiles[e]&&(n||!this._tiles[e].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(let e in this._tiles)this._tiles[e].state!=="errored"&&this._reloadTile(e,"reloading")}}_reloadTile(e,n){let c=this._tiles[e];c&&(c.state!=="loading"&&(c.state=n),this._loadTile(c,this._tileLoaded.bind(this,c,e,n)))}_tileLoaded(e,n,c,d){if(d)return e.state="errored",void(d.status!==404?this._source.fire(new a.ErrorEvent(d,{tile:e})):this.update(this.transform));e.timeAdded=a.exported.now(),c==="expired"&&(e.refreshedUponExpiration=!0),this._setTileReloadTimer(n,e),this.getSource().type==="raster-dem"&&e.dem&&this._backfillDEM(e),this._state.initializeTileState(e,this.map?this.map.painter:null),e.aborted||this._source.fire(new a.Event("data",{dataType:"source",tile:e,coord:e.tileID}))}_backfillDEM(e){let n=this.getRenderableIds();for(let d=0;d<n.length;d++){let g=n[d];if(e.neighboringTiles&&e.neighboringTiles[g]){let v=this.getTileByID(g);c(e,v),c(v,e)}}function c(d,g){d.needsHillshadePrepare=!0;let v=g.tileID.canonical.x-d.tileID.canonical.x,w=g.tileID.canonical.y-d.tileID.canonical.y,S=Math.pow(2,d.tileID.canonical.z),C=g.tileID.key;v===0&&w===0||Math.abs(w)>1||(Math.abs(v)>1&&(Math.abs(v+S)===1?v+=S:Math.abs(v-S)===1&&(v-=S)),g.dem&&d.dem&&(d.dem.backfillBorder(g.dem,v,w),d.neighboringTiles&&d.neighboringTiles[C]&&(d.neighboringTiles[C].backfilled=!0)))}}getTile(e){return this.getTileByID(e.key)}getTileByID(e){return this._tiles[e]}_retainLoadedChildren(e,n,c,d){for(let g in this._tiles){let v=this._tiles[g];if(d[g]||!v.hasData()||v.tileID.overscaledZ<=n||v.tileID.overscaledZ>c)continue;let w=v.tileID;for(;v&&v.tileID.overscaledZ>n+1;){let C=v.tileID.scaledTo(v.tileID.overscaledZ-1);v=this._tiles[C.key],v&&v.hasData()&&(w=C)}let S=w;for(;S.overscaledZ>n;)if(S=S.scaledTo(S.overscaledZ-1),e[S.key]){d[w.key]=w;break}}}findLoadedParent(e,n){if(e.key in this._loadedParentTiles){let c=this._loadedParentTiles[e.key];return c&&c.tileID.overscaledZ>=n?c:null}for(let c=e.overscaledZ-1;c>=n;c--){let d=e.scaledTo(c),g=this._getLoadedTile(d);if(g)return g}}_getLoadedTile(e){let n=this._tiles[e.key];return n&&n.hasData()?n:this._cache.getByKey(e.wrapped().key)}updateCacheSize(e){let n=Math.ceil(e.width/this._source.tileSize)+1,c=Math.ceil(e.height/this._source.tileSize)+1,d=Math.floor(n*c*5),g=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,d):d;this._cache.setMaxSize(g)}handleWrapJump(e){let n=Math.round((e-(this._prevLng===void 0?e:this._prevLng))/360);if(this._prevLng=e,n){let c={};for(let d in this._tiles){let g=this._tiles[d];g.tileID=g.tileID.unwrapTo(g.tileID.wrap+n),c[g.tileID.key]=g}this._tiles=c;for(let d in this._timers)clearTimeout(this._timers[d]),delete this._timers[d];for(let d in this._tiles)this._setTileReloadTimer(d,this._tiles[d])}}update(e){if(this.transform=e,!this._sourceLoaded||this._paused)return;let n;this.updateCacheSize(e),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used?this._source.tileID?n=e.getVisibleUnwrappedCoordinates(this._source.tileID).map(S=>new a.OverscaledTileID(S.canonical.z,S.wrap,S.canonical.z,S.canonical.x,S.canonical.y)):(n=e.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}),this._source.hasTile&&(n=n.filter(S=>this._source.hasTile(S)))):n=[];let c=e.coveringZoomLevel(this._source),d=Math.max(c-Je.maxOverzooming,this._source.minzoom),g=Math.max(c+Je.maxUnderzooming,this._source.minzoom),v=this._updateRetainedTiles(n,c);if(Bn(this._source.type)){let S={},C={},k=Object.keys(v);for(let F of k){let j=v[F],Q=this._tiles[F];if(!Q||Q.fadeEndTime&&Q.fadeEndTime<=a.exported.now())continue;let $=this.findLoadedParent(j,d);$&&(this._addTile($.tileID),S[$.tileID.key]=$.tileID),C[F]=j}this._retainLoadedChildren(C,c,g,v);for(let F in S)v[F]||(this._coveredTiles[F]=!0,v[F]=S[F])}for(let S in v)this._tiles[S].clearFadeHold();let w=a.keysDifference(this._tiles,v);for(let S of w){let C=this._tiles[S];C.hasSymbolBuckets&&!C.holdingForFade()?C.setHoldDuration(this.map._fadeDuration):C.hasSymbolBuckets&&!C.symbolFadeFinished()||this._removeTile(S)}this._updateLoadedParentTileCache()}releaseSymbolFadeTiles(){for(let e in this._tiles)this._tiles[e].holdingForFade()&&this._removeTile(e)}_updateRetainedTiles(e,n){let c={},d={},g=Math.max(n-Je.maxOverzooming,this._source.minzoom),v=Math.max(n+Je.maxUnderzooming,this._source.minzoom),w={};for(let S of e){let C=this._addTile(S);c[S.key]=S,C.hasData()||n<this._source.maxzoom&&(w[S.key]=S)}this._retainLoadedChildren(w,n,v,c);for(let S of e){let C=this._tiles[S.key];if(C.hasData())continue;if(n+1>this._source.maxzoom){let F=S.children(this._source.maxzoom)[0],j=this.getTile(F);if(j&&j.hasData()){c[F.key]=F;continue}}else{let F=S.children(this._source.maxzoom);if(c[F[0].key]&&c[F[1].key]&&c[F[2].key]&&c[F[3].key])continue}let k=C.wasRequested();for(let F=S.overscaledZ-1;F>=g;--F){let j=S.scaledTo(F);if(d[j.key]||(d[j.key]=!0,C=this.getTile(j),!C&&k&&(C=this._addTile(j)),C&&(c[j.key]=j,k=C.wasRequested(),C.hasData())))break}}return c}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(let e in this._tiles){let n=[],c,d=this._tiles[e].tileID;for(;d.overscaledZ>0;){if(d.key in this._loadedParentTiles){c=this._loadedParentTiles[d.key];break}n.push(d.key);let g=d.scaledTo(d.overscaledZ-1);if(c=this._getLoadedTile(g),c)break;d=g}for(let g of n)this._loadedParentTiles[g]=c}}_addTile(e){let n=this._tiles[e.key];if(n)return n;n=this._cache.getAndRemove(e),n&&(this._setTileReloadTimer(e.key,n),n.tileID=e,this._state.initializeTileState(n,this.map?this.map.painter:null),this._cacheTimers[e.key]&&(clearTimeout(this._cacheTimers[e.key]),delete this._cacheTimers[e.key],this._setTileReloadTimer(e.key,n)));let c=n;return n||(n=new Dn(e,this._source.tileSize*e.overscaleFactor()),this._loadTile(n,this._tileLoaded.bind(this,n,e.key,n.state))),n.uses++,this._tiles[e.key]=n,c||this._source.fire(new a.Event("dataloading",{tile:n,coord:n.tileID,dataType:"source"})),n}_setTileReloadTimer(e,n){e in this._timers&&(clearTimeout(this._timers[e]),delete this._timers[e]);let c=n.getExpiryTimeout();c&&(this._timers[e]=setTimeout(()=>{this._reloadTile(e,"expired"),delete this._timers[e]},c))}_removeTile(e){let n=this._tiles[e];n&&(n.uses--,delete this._tiles[e],this._timers[e]&&(clearTimeout(this._timers[e]),delete this._timers[e]),n.uses>0||(n.hasData()&&n.state!=="reloading"?this._cache.add(n.tileID,n,n.getExpiryTimeout()):(n.aborted=!0,this._abortTile(n),this._unloadTile(n))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(let e in this._tiles)this._removeTile(e);this._cache.reset()}tilesIn(e,n,c){let d=[],g=this.transform;if(!g)return d;let v=c?g.getCameraQueryGeometry(e):e,w=e.map($=>g.pointCoordinate($)),S=v.map($=>g.pointCoordinate($)),C=this.getIds(),k=1/0,F=1/0,j=-1/0,Q=-1/0;for(let $ of S)k=Math.min(k,$.x),F=Math.min(F,$.y),j=Math.max(j,$.x),Q=Math.max(Q,$.y);for(let $=0;$<C.length;$++){let J=this._tiles[C[$]];if(J.holdingForFade())continue;let lt=J.tileID,ht=Math.pow(2,g.zoom-J.tileID.overscaledZ),gt=n*J.queryPadding*a.EXTENT/J.tileSize/ht,ut=[lt.getTilePoint(new a.MercatorCoordinate(k,F)),lt.getTilePoint(new a.MercatorCoordinate(j,Q))];if(ut[0].x-gt<a.EXTENT&&ut[0].y-gt<a.EXTENT&&ut[1].x+gt>=0&&ut[1].y+gt>=0){let At=w.map(Tt=>lt.getTilePoint(Tt)),Mt=S.map(Tt=>lt.getTilePoint(Tt));d.push({tile:J,tileID:lt,queryGeometry:At,cameraQueryGeometry:Mt,scale:ht})}}return d}getVisibleCoordinates(e){let n=this.getRenderableIds(e).map(c=>this._tiles[c].tileID);for(let c of n)c.posMatrix=this.transform.calculatePosMatrix(c.toUnwrapped());return n}hasTransition(){if(this._source.hasTransition())return!0;if(Bn(this._source.type))for(let e in this._tiles){let n=this._tiles[e];if(n.fadeEndTime!==void 0&&n.fadeEndTime>=a.exported.now())return!0}return!1}setFeatureState(e,n,c){this._state.updateState(e=e||"_geojsonTileLayer",n,c)}removeFeatureState(e,n,c){this._state.removeFeatureState(e=e||"_geojsonTileLayer",n,c)}getFeatureState(e,n){return this._state.getState(e=e||"_geojsonTileLayer",n)}setDependencies(e,n,c){let d=this._tiles[e];d&&d.setDependencies(n,c)}reloadTilesForDependencies(e,n){for(let c in this._tiles)this._tiles[c].hasDependency(e,n)&&this._reloadTile(c,"reloading");this._cache.filter(c=>!c.hasDependency(e,n))}}function sn(p,e){let n=Math.abs(2*p.wrap)-+(p.wrap<0),c=Math.abs(2*e.wrap)-+(e.wrap<0);return p.overscaledZ-e.overscaledZ||c-n||e.canonical.y-p.canonical.y||e.canonical.x-p.canonical.x}function Bn(p){return p==="raster"||p==="image"||p==="video"}Je.maxOverzooming=10,Je.maxUnderzooming=3;let gn="mapboxgl_preloaded_worker_pool";class Rr{constructor(){this.active={}}acquire(e){if(!this.workers)for(this.workers=[];this.workers.length<Rr.workerCount;)this.workers.push(new Worker(oa.workerUrl));return this.active[e]=!0,this.workers.slice()}release(e){delete this.active[e],this.numActive()===0&&(this.workers.forEach(n=>{n.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[gn]}numActive(){return Object.keys(this.active).length}}let ps=Math.floor(a.exported.hardwareConcurrency/2),mt;function U(){return mt||(mt=new Rr),mt}function B(p,e){let n={};for(let c in p)c!=="ref"&&(n[c]=p[c]);return a.refProperties.forEach(c=>{c in e&&(n[c]=e[c])}),n}function V(p){p=p.slice();let e=Object.create(null);for(let n=0;n<p.length;n++)e[p[n].id]=p[n];for(let n=0;n<p.length;n++)"ref"in p[n]&&(p[n]=B(p[n],e[p[n].ref]));return p}Rr.workerCount=Math.max(Math.min(ps,6),1);let X={setStyle:"setStyle",addLayer:"addLayer",removeLayer:"removeLayer",setPaintProperty:"setPaintProperty",setLayoutProperty:"setLayoutProperty",setFilter:"setFilter",addSource:"addSource",removeSource:"removeSource",setGeoJSONSourceData:"setGeoJSONSourceData",setLayerZoomRange:"setLayerZoomRange",setLayerProperty:"setLayerProperty",setCenter:"setCenter",setZoom:"setZoom",setBearing:"setBearing",setPitch:"setPitch",setSprite:"setSprite",setGlyphs:"setGlyphs",setTransition:"setTransition",setLight:"setLight"};function st(p,e,n){n.push({command:X.addSource,args:[p,e[p]]})}function xt(p,e,n){e.push({command:X.removeSource,args:[p]}),n[p]=!0}function Dt(p,e,n,c){xt(p,n,c),st(p,e,n)}function Ut(p,e,n){let c;for(c in p[n])if(Object.prototype.hasOwnProperty.call(p[n],c)&&c!=="data"&&!N(p[n][c],e[n][c]))return!1;for(c in e[n])if(Object.prototype.hasOwnProperty.call(e[n],c)&&c!=="data"&&!N(p[n][c],e[n][c]))return!1;return!0}function ct(p,e,n,c,d,g){let v;for(v in e=e||{},p=p||{})Object.prototype.hasOwnProperty.call(p,v)&&(N(p[v],e[v])||n.push({command:g,args:[c,v,e[v],d]}));for(v in e)Object.prototype.hasOwnProperty.call(e,v)&&!Object.prototype.hasOwnProperty.call(p,v)&&(N(p[v],e[v])||n.push({command:g,args:[c,v,e[v],d]}))}function Ct(p){return p.id}function Te(p,e){return p[e.id]=e,p}class Ie{constructor(e,n){this.reset(e,n)}reset(e,n){this.points=e||[],this._distances=[0];for(let c=1;c<this.points.length;c++)this._distances[c]=this._distances[c-1]+this.points[c].dist(this.points[c-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(n||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(e){if(this.points.length===1)return this.points[0];e=a.clamp(e,0,1);let n=1,c=this._distances[n],d=e*this.paddedLength+this.padding;for(;c<d&&n<this._distances.length;)c=this._distances[++n];let g=n-1,v=this._distances[g],w=c-v,S=w>0?(d-v)/w:0;return this.points[g].mult(1-S).add(this.points[n].mult(S))}}function oe(p,e){let n=!0;return p==="always"||p!=="never"&&e!=="never"||(n=!1),n}class Oe{constructor(e,n,c){let d=this.boxCells=[],g=this.circleCells=[];this.xCellCount=Math.ceil(e/c),this.yCellCount=Math.ceil(n/c);for(let v=0;v<this.xCellCount*this.yCellCount;v++)d.push([]),g.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=e,this.height=n,this.xScale=this.xCellCount/e,this.yScale=this.yCellCount/n,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(e,n,c,d,g){this._forEachCell(n,c,d,g,this._insertBoxCell,this.boxUid++),this.boxKeys.push(e),this.bboxes.push(n),this.bboxes.push(c),this.bboxes.push(d),this.bboxes.push(g)}insertCircle(e,n,c,d){this._forEachCell(n-d,c-d,n+d,c+d,this._insertCircleCell,this.circleUid++),this.circleKeys.push(e),this.circles.push(n),this.circles.push(c),this.circles.push(d)}_insertBoxCell(e,n,c,d,g,v){this.boxCells[g].push(v)}_insertCircleCell(e,n,c,d,g,v){this.circleCells[g].push(v)}_query(e,n,c,d,g,v,w){if(c<0||e>this.width||d<0||n>this.height)return[];let S=[];if(e<=0&&n<=0&&this.width<=c&&this.height<=d){if(g)return[{key:null,x1:e,y1:n,x2:c,y2:d}];for(let C=0;C<this.boxKeys.length;C++)S.push({key:this.boxKeys[C],x1:this.bboxes[4*C],y1:this.bboxes[4*C+1],x2:this.bboxes[4*C+2],y2:this.bboxes[4*C+3]});for(let C=0;C<this.circleKeys.length;C++){let k=this.circles[3*C],F=this.circles[3*C+1],j=this.circles[3*C+2];S.push({key:this.circleKeys[C],x1:k-j,y1:F-j,x2:k+j,y2:F+j})}}else this._forEachCell(e,n,c,d,this._queryCell,S,{hitTest:g,overlapMode:v,seenUids:{box:{},circle:{}}},w);return S}query(e,n,c,d){return this._query(e,n,c,d,!1,null)}hitTest(e,n,c,d,g,v){return this._query(e,n,c,d,!0,g,v).length>0}hitTestCircle(e,n,c,d,g){let v=e-c,w=e+c,S=n-c,C=n+c;if(w<0||v>this.width||C<0||S>this.height)return!1;let k=[];return this._forEachCell(v,S,w,C,this._queryCellCircle,k,{hitTest:!0,overlapMode:d,circle:{x:e,y:n,radius:c},seenUids:{box:{},circle:{}}},g),k.length>0}_queryCell(e,n,c,d,g,v,w,S){let{seenUids:C,hitTest:k,overlapMode:F}=w,j=this.boxCells[g];if(j!==null){let $=this.bboxes;for(let J of j)if(!C.box[J]){C.box[J]=!0;let lt=4*J,ht=this.boxKeys[J];if(e<=$[lt+2]&&n<=$[lt+3]&&c>=$[lt+0]&&d>=$[lt+1]&&(!S||S(ht))&&(!k||!oe(F,ht.overlapMode))&&(v.push({key:ht,x1:$[lt],y1:$[lt+1],x2:$[lt+2],y2:$[lt+3]}),k))return!0}}let Q=this.circleCells[g];if(Q!==null){let $=this.circles;for(let J of Q)if(!C.circle[J]){C.circle[J]=!0;let lt=3*J,ht=this.circleKeys[J];if(this._circleAndRectCollide($[lt],$[lt+1],$[lt+2],e,n,c,d)&&(!S||S(ht))&&(!k||!oe(F,ht.overlapMode))){let gt=$[lt],ut=$[lt+1],At=$[lt+2];if(v.push({key:ht,x1:gt-At,y1:ut-At,x2:gt+At,y2:ut+At}),k)return!0}}}return!1}_queryCellCircle(e,n,c,d,g,v,w,S){let{circle:C,seenUids:k,overlapMode:F}=w,j=this.boxCells[g];if(j!==null){let $=this.bboxes;for(let J of j)if(!k.box[J]){k.box[J]=!0;let lt=4*J,ht=this.boxKeys[J];if(this._circleAndRectCollide(C.x,C.y,C.radius,$[lt+0],$[lt+1],$[lt+2],$[lt+3])&&(!S||S(ht))&&!oe(F,ht.overlapMode))return v.push(!0),!0}}let Q=this.circleCells[g];if(Q!==null){let $=this.circles;for(let J of Q)if(!k.circle[J]){k.circle[J]=!0;let lt=3*J,ht=this.circleKeys[J];if(this._circlesCollide($[lt],$[lt+1],$[lt+2],C.x,C.y,C.radius)&&(!S||S(ht))&&!oe(F,ht.overlapMode))return v.push(!0),!0}}}_forEachCell(e,n,c,d,g,v,w,S){let C=this._convertToXCellCoord(e),k=this._convertToYCellCoord(n),F=this._convertToXCellCoord(c),j=this._convertToYCellCoord(d);for(let Q=C;Q<=F;Q++)for(let $=k;$<=j;$++)if(g.call(this,e,n,c,d,this.xCellCount*$+Q,v,w,S))return}_convertToXCellCoord(e){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(e*this.xScale)))}_convertToYCellCoord(e){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(e*this.yScale)))}_circlesCollide(e,n,c,d,g,v){let w=d-e,S=g-n,C=c+v;return C*C>w*w+S*S}_circleAndRectCollide(e,n,c,d,g,v,w){let S=(v-d)/2,C=Math.abs(e-(d+S));if(C>S+c)return!1;let k=(w-g)/2,F=Math.abs(n-(g+k));if(F>k+c)return!1;if(C<=S||F<=k)return!0;let j=C-S,Q=F-k;return j*j+Q*Q<=c*c}}function Ce(p,e,n,c,d){let g=a.create();return e?(a.scale(g,g,[1/d,1/d,1]),n||a.rotateZ(g,g,c.angle)):a.multiply(g,c.labelPlaneMatrix,p),g}function Qe(p,e,n,c,d){if(e){let g=a.clone(p);return a.scale(g,g,[d,d,1]),n||a.rotateZ(g,g,-c.angle),g}return c.glCoordMatrix}function Pe(p,e){let n=[p.x,p.y,0,1];He(n,n,e);let c=n[3];return{point:new a.pointGeometry(n[0]/c,n[1]/c),signedDistanceFromCamera:c}}function Vt(p,e){return .5+p/e*.5}function ge(p,e){let n=p[0]/p[3],c=p[1]/p[3];return n>=-e[0]&&n<=e[0]&&c>=-e[1]&&c<=e[1]}function ce(p,e,n,c,d,g,v,w,S){let C=c?p.textSizeData:p.iconSizeData,k=a.evaluateSizeForZoom(C,n.transform.zoom),F=[256/n.width*2+1,256/n.height*2+1],j=c?p.text.dynamicLayoutVertexArray:p.icon.dynamicLayoutVertexArray;j.clear();let Q=p.lineVertexArray,$=c?p.text.placedSymbolArray:p.icon.placedSymbolArray,J=n.transform.width/n.transform.height,lt=!1;for(let ht=0;ht<$.length;ht++){let gt=$.get(ht);if(gt.hidden||gt.writingMode===a.WritingMode.vertical&&!lt){ri(gt.numGlyphs,j);continue}lt=!1;let ut=[gt.anchorX,gt.anchorY,0,1];if(a.transformMat4(ut,ut,e),!ge(ut,F)){ri(gt.numGlyphs,j);continue}let At=Vt(n.transform.cameraToCenterDistance,ut[3]),Mt=a.evaluateSizeForFeature(C,k,gt),Tt=v?Mt/At:Mt*At,Nt=new a.pointGeometry(gt.anchorX,gt.anchorY),jt=Pe(Nt,d).point,It={},ie=_e(gt,Tt,!1,w,e,d,g,p.glyphOffsetArray,Q,j,jt,Nt,It,J,S);lt=ie.useVertical,(ie.notEnoughRoom||lt||ie.needsFlipping&&_e(gt,Tt,!0,w,e,d,g,p.glyphOffsetArray,Q,j,jt,Nt,It,J,S).notEnoughRoom)&&ri(gt.numGlyphs,j)}c?p.text.dynamicLayoutVertexBuffer.updateData(j):p.icon.dynamicLayoutVertexBuffer.updateData(j)}function ai(p,e,n,c,d,g,v,w,S,C,k,F){let j=w.glyphStartIndex+w.numGlyphs,Q=w.lineStartIndex,$=w.lineStartIndex+w.lineLength,J=e.getoffsetX(w.glyphStartIndex),lt=e.getoffsetX(j-1),ht=mi(p*J,n,c,d,g,v,w.segment,Q,$,S,C,k,F);if(!ht)return null;let gt=mi(p*lt,n,c,d,g,v,w.segment,Q,$,S,C,k,F);return gt?{first:ht,last:gt}:null}function $i(p,e,n,c){return p===a.WritingMode.horizontal&&Math.abs(n.y-e.y)>Math.abs(n.x-e.x)*c?{useVertical:!0}:(p===a.WritingMode.vertical?e.y<n.y:e.x>n.x)?{needsFlipping:!0}:null}function _e(p,e,n,c,d,g,v,w,S,C,k,F,j,Q,$){let J=e/24,lt=p.lineOffsetX*J,ht=p.lineOffsetY*J,gt;if(p.numGlyphs>1){let ut=p.glyphStartIndex+p.numGlyphs,At=p.lineStartIndex,Mt=p.lineStartIndex+p.lineLength,Tt=ai(J,w,lt,ht,n,k,F,p,S,g,j,$);if(!Tt)return{notEnoughRoom:!0};let Nt=Pe(Tt.first.point,v).point,jt=Pe(Tt.last.point,v).point;if(c&&!n){let It=$i(p.writingMode,Nt,jt,Q);if(It)return It}gt=[Tt.first];for(let It=p.glyphStartIndex+1;It<ut-1;It++)gt.push(mi(J*w.getoffsetX(It),lt,ht,n,k,F,p.segment,At,Mt,S,g,j,$));gt.push(Tt.last)}else{if(c&&!n){let At=Pe(F,d).point,Mt=p.lineStartIndex+p.segment+1,Tt=new a.pointGeometry(S.getx(Mt),S.gety(Mt)),Nt=Pe(Tt,d),jt=Nt.signedDistanceFromCamera>0?Nt.point:ir(F,Tt,At,1,d),It=$i(p.writingMode,At,jt,Q);if(It)return It}let ut=mi(J*w.getoffsetX(p.glyphStartIndex),lt,ht,n,k,F,p.segment,p.lineStartIndex,p.lineStartIndex+p.lineLength,S,g,j,$);if(!ut)return{notEnoughRoom:!0};gt=[ut]}for(let ut of gt)a.addDynamicAttributes(C,ut.point,ut.angle);return{}}function ir(p,e,n,c,d){let g=Pe(p.add(p.sub(e)._unit()),d).point,v=n.sub(g);return n.add(v._mult(c/v.mag()))}function mi(p,e,n,c,d,g,v,w,S,C,k,F,j){let Q=c?p-e:p+e,$=Q>0?1:-1,J=0;c&&($*=-1,J=Math.PI),$<0&&(J+=Math.PI);let lt=$>0?w+v:w+v+1,ht=d,gt=d,ut=0,At=0,Mt=Math.abs(Q),Tt=[];for(;ut+At<=Mt;){if(lt+=$,lt<w||lt>=S)return null;if(gt=ht,Tt.push(ht),ht=F[lt],ht===void 0){let Ht=new a.pointGeometry(C.getx(lt),C.gety(lt)),ve=Pe(Ht,k);if(ve.signedDistanceFromCamera>0)ht=F[lt]=ve.point;else{let Fe=lt-$;ht=ir(ut===0?g:new a.pointGeometry(C.getx(Fe),C.gety(Fe)),Ht,gt,Mt-ut+1,k)}}ut+=At,At=gt.dist(ht)}let Nt=(Mt-ut)/At,jt=ht.sub(gt),It=jt.mult(Nt)._add(gt);It._add(jt._unit()._perp()._mult(n*$));let ie=J+Math.atan2(ht.y-gt.y,ht.x-gt.x);return Tt.push(It),{point:It,angle:j?ie:0,path:Tt}}let rr=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function ri(p,e){for(let n=0;n<p;n++){let c=e.length;e.resize(c+4),e.float32.set(rr,3*c)}}function He(p,e,n){let c=e[0],d=e[1];return p[0]=n[0]*c+n[4]*d+n[12],p[1]=n[1]*c+n[5]*d+n[13],p[3]=n[3]*c+n[7]*d+n[15],p}let Vi=100;class yr{constructor(e,n=new Oe(e.width+200,e.height+200,25),c=new Oe(e.width+200,e.height+200,25)){this.transform=e,this.grid=n,this.ignoredGrid=c,this.pitchfactor=Math.cos(e._pitch)*e.cameraToCenterDistance,this.screenRightBoundary=e.width+Vi,this.screenBottomBoundary=e.height+Vi,this.gridRightBoundary=e.width+200,this.gridBottomBoundary=e.height+200}placeCollisionBox(e,n,c,d,g){let v=this.projectAndGetPerspectiveRatio(d,e.anchorPointX,e.anchorPointY),w=c*v.perspectiveRatio,S=e.x1*w+v.point.x,C=e.y1*w+v.point.y,k=e.x2*w+v.point.x,F=e.y2*w+v.point.y;return!this.isInsideGrid(S,C,k,F)||n!=="always"&&this.grid.hitTest(S,C,k,F,n,g)?{box:[],offscreen:!1}:{box:[S,C,k,F],offscreen:this.isOffscreen(S,C,k,F)}}placeCollisionCircles(e,n,c,d,g,v,w,S,C,k,F,j,Q){let $=[],J=new a.pointGeometry(n.anchorX,n.anchorY),lt=Pe(J,v),ht=Vt(this.transform.cameraToCenterDistance,lt.signedDistanceFromCamera),gt=(k?g/ht:g*ht)/a.ONE_EM,ut=Pe(J,w).point,At=ai(gt,d,n.lineOffsetX*gt,n.lineOffsetY*gt,!1,ut,J,n,c,w,{},!1),Mt=!1,Tt=!1,Nt=!0;if(At){let jt=.5*j*ht+Q,It=new a.pointGeometry(-100,-100),ie=new a.pointGeometry(this.screenRightBoundary,this.screenBottomBoundary),Ht=new Ie,ve=At.first,Fe=At.last,ke=[];for(let we=ve.path.length-1;we>=1;we--)ke.push(ve.path[we]);for(let we=1;we<Fe.path.length;we++)ke.push(Fe.path[we]);let Re=2.5*jt;if(S){let we=ke.map(qe=>Pe(qe,S));ke=we.some(qe=>qe.signedDistanceFromCamera<=0)?[]:we.map(qe=>qe.point)}let yi=[];if(ke.length>0){let we=ke[0].clone(),qe=ke[0].clone();for(let ti=1;ti<ke.length;ti++)we.x=Math.min(we.x,ke[ti].x),we.y=Math.min(we.y,ke[ti].y),qe.x=Math.max(qe.x,ke[ti].x),qe.y=Math.max(qe.y,ke[ti].y);yi=we.x>=It.x&&qe.x<=ie.x&&we.y>=It.y&&qe.y<=ie.y?[ke]:qe.x<It.x||we.x>ie.x||qe.y<It.y||we.y>ie.y?[]:a.clipLine([ke],It.x,It.y,ie.x,ie.y)}for(let we of yi){Ht.reset(we,.25*jt);let qe=0;qe=Ht.length<=.5*jt?1:Math.ceil(Ht.paddedLength/Re)+1;for(let ti=0;ti<qe;ti++){let Zi=ti/Math.max(qe-1,1),vr=Ht.lerp(Zi),Fr=vr.x+Vi,Or=vr.y+Vi;$.push(Fr,Or,jt,0);let In=Fr-jt,ur=Or-jt,on=Fr+jt,$n=Or+jt;if(Nt=Nt&&this.isOffscreen(In,ur,on,$n),Tt=Tt||this.isInsideGrid(In,ur,on,$n),e!=="always"&&this.grid.hitTestCircle(Fr,Or,jt,e,F)&&(Mt=!0,!C))return{circles:[],offscreen:!1,collisionDetected:Mt}}}}return{circles:!C&&Mt||!Tt?[]:$,offscreen:Nt,collisionDetected:Mt}}queryRenderedSymbols(e){if(e.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};let n=[],c=1/0,d=1/0,g=-1/0,v=-1/0;for(let k of e){let F=new a.pointGeometry(k.x+Vi,k.y+Vi);c=Math.min(c,F.x),d=Math.min(d,F.y),g=Math.max(g,F.x),v=Math.max(v,F.y),n.push(F)}let w=this.grid.query(c,d,g,v).concat(this.ignoredGrid.query(c,d,g,v)),S={},C={};for(let k of w){let F=k.key;if(S[F.bucketInstanceId]===void 0&&(S[F.bucketInstanceId]={}),S[F.bucketInstanceId][F.featureIndex])continue;let j=[new a.pointGeometry(k.x1,k.y1),new a.pointGeometry(k.x2,k.y1),new a.pointGeometry(k.x2,k.y2),new a.pointGeometry(k.x1,k.y2)];a.polygonIntersectsPolygon(n,j)&&(S[F.bucketInstanceId][F.featureIndex]=!0,C[F.bucketInstanceId]===void 0&&(C[F.bucketInstanceId]=[]),C[F.bucketInstanceId].push(F.featureIndex))}return C}insertCollisionBox(e,n,c,d,g,v){(c?this.ignoredGrid:this.grid).insert({bucketInstanceId:d,featureIndex:g,collisionGroupID:v,overlapMode:n},e[0],e[1],e[2],e[3])}insertCollisionCircles(e,n,c,d,g,v){let w=c?this.ignoredGrid:this.grid,S={bucketInstanceId:d,featureIndex:g,collisionGroupID:v,overlapMode:n};for(let C=0;C<e.length;C+=4)w.insertCircle(S,e[C],e[C+1],e[C+2])}projectAndGetPerspectiveRatio(e,n,c){let d=[n,c,0,1];return He(d,d,e),{point:new a.pointGeometry((d[0]/d[3]+1)/2*this.transform.width+Vi,(-d[1]/d[3]+1)/2*this.transform.height+Vi),perspectiveRatio:.5+this.transform.cameraToCenterDistance/d[3]*.5}}isOffscreen(e,n,c,d){return c<Vi||e>=this.screenRightBoundary||d<Vi||n>this.screenBottomBoundary}isInsideGrid(e,n,c,d){return c>=0&&e<this.gridRightBoundary&&d>=0&&n<this.gridBottomBoundary}getViewportMatrix(){let e=a.identity([]);return a.translate(e,e,[-100,-100,0]),e}}function gi(p,e,n){return e*(a.EXTENT/(p.tileSize*Math.pow(2,n-p.tileID.overscaledZ)))}class Zr{constructor(e,n,c,d){this.opacity=e?Math.max(0,Math.min(1,e.opacity+(e.placed?n:-n))):d&&c?1:0,this.placed=c}isHidden(){return this.opacity===0&&!this.placed}}class Hr{constructor(e,n,c,d,g){this.text=new Zr(e?e.text:null,n,c,g),this.icon=new Zr(e?e.icon:null,n,d,g)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class qs{constructor(e,n,c){this.text=e,this.icon=n,this.skipFade=c}}class ds{constructor(){this.invProjMatrix=a.create(),this.viewportMatrix=a.create(),this.circles=[]}}class fs{constructor(e,n,c,d,g){this.bucketInstanceId=e,this.featureIndex=n,this.sourceLayerIndex=c,this.bucketIndex=d,this.tileID=g}}class W{constructor(e){this.crossSourceCollisions=e,this.maxGroupID=0,this.collisionGroups={}}get(e){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[e]){let n=++this.maxGroupID;this.collisionGroups[e]={ID:n,predicate:c=>c.collisionGroupID===n}}return this.collisionGroups[e]}}function I(p,e,n,c,d){let{horizontalAlign:g,verticalAlign:v}=a.getAnchorAlignment(p),w=-(g-.5)*e,S=-(v-.5)*n,C=a.evaluateVariableOffset(p,c);return new a.pointGeometry(w+C[0]*d,S+C[1]*d)}function P(p,e,n,c,d,g){let{x1:v,x2:w,y1:S,y2:C,anchorPointX:k,anchorPointY:F}=p,j=new a.pointGeometry(e,n);return c&&j._rotate(d?g:-g),{x1:v+j.x,y1:S+j.y,x2:w+j.x,y2:C+j.y,anchorPointX:k,anchorPointY:F}}class q{constructor(e,n,c,d){this.transform=e.clone(),this.collisionIndex=new yr(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=n,this.retainedQueryData={},this.collisionGroups=new W(c),this.collisionCircleArrays={},this.prevPlacement=d,d&&(d.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(e,n,c,d){let g=c.getBucket(n),v=c.latestFeatureIndex;if(!g||!v||n.id!==g.layerIds[0])return;let w=c.collisionBoxArray,S=g.layers[0].layout,C=Math.pow(2,this.transform.zoom-c.tileID.overscaledZ),k=c.tileSize/a.EXTENT,F=this.transform.calculatePosMatrix(c.tileID.toUnwrapped()),j=S.get("text-pitch-alignment")==="map",Q=S.get("text-rotation-alignment")==="map",$=gi(c,1,this.transform.zoom),J=Ce(F,j,Q,this.transform,$),lt=null;if(j){let gt=Qe(F,j,Q,this.transform,$);lt=a.multiply([],this.transform.labelPlaneMatrix,gt)}this.retainedQueryData[g.bucketInstanceId]=new fs(g.bucketInstanceId,v,g.sourceLayerIndex,g.index,c.tileID);let ht={bucket:g,layout:S,posMatrix:F,textLabelPlaneMatrix:J,labelToScreenMatrix:lt,scale:C,textPixelRatio:k,holdingForFade:c.holdingForFade(),collisionBoxArray:w,partiallyEvaluatedTextSize:a.evaluateSizeForZoom(g.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(g.sourceID)};if(d)for(let gt of g.sortKeyRanges){let{sortKey:ut,symbolInstanceStart:At,symbolInstanceEnd:Mt}=gt;e.push({sortKey:ut,symbolInstanceStart:At,symbolInstanceEnd:Mt,parameters:ht})}else e.push({symbolInstanceStart:0,symbolInstanceEnd:g.symbolInstances.length,parameters:ht})}attemptAnchorPlacement(e,n,c,d,g,v,w,S,C,k,F,j,Q,$,J){let lt=[j.textOffset0,j.textOffset1],ht=I(e,c,d,lt,g),gt=this.collisionIndex.placeCollisionBox(P(n,ht.x,ht.y,v,w,this.transform.angle),F,S,C,k.predicate);if((!J||this.collisionIndex.placeCollisionBox(P(J,ht.x,ht.y,v,w,this.transform.angle),F,S,C,k.predicate).box.length!==0)&>.box.length>0){let ut;return this.prevPlacement&&this.prevPlacement.variableOffsets[j.crossTileID]&&this.prevPlacement.placements[j.crossTileID]&&this.prevPlacement.placements[j.crossTileID].text&&(ut=this.prevPlacement.variableOffsets[j.crossTileID].anchor),this.variableOffsets[j.crossTileID]={textOffset:lt,width:c,height:d,anchor:e,textBoxScale:g,prevAnchor:ut},this.markUsedJustification(Q,e,j,$),Q.allowVerticalPlacement&&(this.markUsedOrientation(Q,$,j),this.placedOrientations[j.crossTileID]=$),{shift:ht,placedGlyphBoxes:gt}}}placeLayerBucketPart(e,n,c){let{bucket:d,layout:g,posMatrix:v,textLabelPlaneMatrix:w,labelToScreenMatrix:S,textPixelRatio:C,holdingForFade:k,collisionBoxArray:F,partiallyEvaluatedTextSize:j,collisionGroup:Q}=e.parameters,$=g.get("text-optional"),J=g.get("icon-optional"),lt=a.getOverlapMode(g,"text-overlap","text-allow-overlap"),ht=lt==="always",gt=a.getOverlapMode(g,"icon-overlap","icon-allow-overlap"),ut=gt==="always",At=g.get("text-rotation-alignment")==="map",Mt=g.get("text-pitch-alignment")==="map",Tt=g.get("icon-text-fit")!=="none",Nt=g.get("symbol-z-order")==="viewport-y",jt=ht&&(ut||!d.hasIconData()||J),It=ut&&(ht||!d.hasTextData()||$);!d.collisionArrays&&F&&d.deserializeCollisionBoxes(F);let ie=(Ht,ve)=>{if(n[Ht.crossTileID])return;if(k)return void(this.placements[Ht.crossTileID]=new qs(!1,!1,!1));let Fe=!1,ke=!1,Re=!0,yi=null,we={box:null,offscreen:null},qe={box:null,offscreen:null},ti=null,Zi=null,vr=null,Fr=0,Or=0,In=0;ve.textFeatureIndex?Fr=ve.textFeatureIndex:Ht.useRuntimeCollisionCircles&&(Fr=Ht.featureIndex),ve.verticalTextFeatureIndex&&(Or=ve.verticalTextFeatureIndex);let ur=ve.textBox;if(ur){let br=Xe=>{let Pi=a.WritingMode.horizontal;if(d.allowVerticalPlacement&&!Xe&&this.prevPlacement){let nr=this.prevPlacement.placedOrientations[Ht.crossTileID];nr&&(this.placedOrientations[Ht.crossTileID]=nr,Pi=nr,this.markUsedOrientation(d,Pi,Ht))}return Pi},je=(Xe,Pi)=>{if(d.allowVerticalPlacement&&Ht.numVerticalGlyphVertices>0&&ve.verticalTextBox){for(let nr of d.writingModes)if(nr===a.WritingMode.vertical?(we=Pi(),qe=we):we=Xe(),we&&we.box&&we.box.length)break}else we=Xe()};if(g.get("text-variable-anchor")){let Xe=g.get("text-variable-anchor");if(this.prevPlacement&&this.prevPlacement.variableOffsets[Ht.crossTileID]){let ci=this.prevPlacement.variableOffsets[Ht.crossTileID];Xe.indexOf(ci.anchor)>0&&(Xe=Xe.filter(Wn=>Wn!==ci.anchor),Xe.unshift(ci.anchor))}let Pi=(ci,Wn,ln)=>{let Ya=ci.x2-ci.x1,ml=ci.y2-ci.y1,Ja=Ht.textBoxScale,Th=Tt&>==="never"?Wn:null,Zn={box:[],offscreen:!1},Qa=lt!=="never"?2*Xe.length:Xe.length;for(let hn=0;hn<Qa;++hn){let Is=this.attemptAnchorPlacement(Xe[hn%Xe.length],ci,Ya,ml,Ja,At,Mt,C,v,Q,hn>=Xe.length?lt:"never",Ht,d,ln,Th);if(Is&&(Zn=Is.placedGlyphBoxes,Zn&&Zn.box&&Zn.box.length)){Fe=!0,yi=Is.shift;break}}return Zn};je(()=>Pi(ur,ve.iconBox,a.WritingMode.horizontal),()=>{let ci=ve.verticalTextBox;return d.allowVerticalPlacement&&!(we&&we.box&&we.box.length)&&Ht.numVerticalGlyphVertices>0&&ci?Pi(ci,ve.verticalIconBox,a.WritingMode.vertical):{box:null,offscreen:null}}),we&&(Fe=we.box,Re=we.offscreen);let nr=br(we&&we.box);if(!Fe&&this.prevPlacement){let ci=this.prevPlacement.variableOffsets[Ht.crossTileID];ci&&(this.variableOffsets[Ht.crossTileID]=ci,this.markUsedJustification(d,ci.anchor,Ht,nr))}}else{let Xe=(Pi,nr)=>{let ci=this.collisionIndex.placeCollisionBox(Pi,lt,C,v,Q.predicate);return ci&&ci.box&&ci.box.length&&(this.markUsedOrientation(d,nr,Ht),this.placedOrientations[Ht.crossTileID]=nr),ci};je(()=>Xe(ur,a.WritingMode.horizontal),()=>{let Pi=ve.verticalTextBox;return d.allowVerticalPlacement&&Ht.numVerticalGlyphVertices>0&&Pi?Xe(Pi,a.WritingMode.vertical):{box:null,offscreen:null}}),br(we&&we.box&&we.box.length)}}if(ti=we,Fe=ti&&ti.box&&ti.box.length>0,Re=ti&&ti.offscreen,Ht.useRuntimeCollisionCircles){let br=d.text.placedSymbolArray.get(Ht.centerJustifiedTextSymbolIndex),je=a.evaluateSizeForFeature(d.textSizeData,j,br),Xe=g.get("text-padding");Zi=this.collisionIndex.placeCollisionCircles(lt,br,d.lineVertexArray,d.glyphOffsetArray,je,v,w,S,c,Mt,Q.predicate,Ht.collisionCircleDiameter,Xe),Fe=ht||Zi.circles.length>0&&!Zi.collisionDetected,Re=Re&&Zi.offscreen}if(ve.iconFeatureIndex&&(In=ve.iconFeatureIndex),ve.iconBox){let br=je=>{let Xe=Tt&&yi?P(je,yi.x,yi.y,At,Mt,this.transform.angle):je;return this.collisionIndex.placeCollisionBox(Xe,gt,C,v,Q.predicate)};qe&&qe.box&&qe.box.length&&ve.verticalIconBox?(vr=br(ve.verticalIconBox),ke=vr.box.length>0):(vr=br(ve.iconBox),ke=vr.box.length>0),Re=Re&&vr.offscreen}let on=$||Ht.numHorizontalGlyphVertices===0&&Ht.numVerticalGlyphVertices===0,$n=J||Ht.numIconVertices===0;if(on||$n?$n?on||(ke=ke&&Fe):Fe=ke&&Fe:ke=Fe=ke&&Fe,Fe&&ti&&ti.box&&this.collisionIndex.insertCollisionBox(ti.box,lt,g.get("text-ignore-placement"),d.bucketInstanceId,qe&&qe.box&&Or?Or:Fr,Q.ID),ke&&vr&&this.collisionIndex.insertCollisionBox(vr.box,gt,g.get("icon-ignore-placement"),d.bucketInstanceId,In,Q.ID),Zi&&(Fe&&this.collisionIndex.insertCollisionCircles(Zi.circles,lt,g.get("text-ignore-placement"),d.bucketInstanceId,Fr,Q.ID),c)){let br=d.bucketInstanceId,je=this.collisionCircleArrays[br];je===void 0&&(je=this.collisionCircleArrays[br]=new ds);for(let Xe=0;Xe<Zi.circles.length;Xe+=4)je.circles.push(Zi.circles[Xe+0]),je.circles.push(Zi.circles[Xe+1]),je.circles.push(Zi.circles[Xe+2]),je.circles.push(Zi.collisionDetected?1:0)}this.placements[Ht.crossTileID]=new qs(Fe||jt,ke||It,Re||d.justReloaded),n[Ht.crossTileID]=!0};if(Nt){let Ht=d.getSortedSymbolIndexes(this.transform.angle);for(let ve=Ht.length-1;ve>=0;--ve){let Fe=Ht[ve];ie(d.symbolInstances.get(Fe),d.collisionArrays[Fe])}}else for(let Ht=e.symbolInstanceStart;Ht<e.symbolInstanceEnd;Ht++)ie(d.symbolInstances.get(Ht),d.collisionArrays[Ht]);if(c&&d.bucketInstanceId in this.collisionCircleArrays){let Ht=this.collisionCircleArrays[d.bucketInstanceId];a.invert(Ht.invProjMatrix,v),Ht.viewportMatrix=this.collisionIndex.getViewportMatrix()}d.justReloaded=!1}markUsedJustification(e,n,c,d){let g;g=d===a.WritingMode.vertical?c.verticalPlacedTextSymbolIndex:{left:c.leftJustifiedTextSymbolIndex,center:c.centerJustifiedTextSymbolIndex,right:c.rightJustifiedTextSymbolIndex}[a.getAnchorJustification(n)];let v=[c.leftJustifiedTextSymbolIndex,c.centerJustifiedTextSymbolIndex,c.rightJustifiedTextSymbolIndex,c.verticalPlacedTextSymbolIndex];for(let w of v)w>=0&&(e.text.placedSymbolArray.get(w).crossTileID=g>=0&&w!==g?0:c.crossTileID)}markUsedOrientation(e,n,c){let d=n===a.WritingMode.horizontal||n===a.WritingMode.horizontalOnly?n:0,g=n===a.WritingMode.vertical?n:0,v=[c.leftJustifiedTextSymbolIndex,c.centerJustifiedTextSymbolIndex,c.rightJustifiedTextSymbolIndex];for(let w of v)e.text.placedSymbolArray.get(w).placedOrientation=d;c.verticalPlacedTextSymbolIndex&&(e.text.placedSymbolArray.get(c.verticalPlacedTextSymbolIndex).placedOrientation=g)}commit(e){this.commitTime=e,this.zoomAtLastRecencyCheck=this.transform.zoom;let n=this.prevPlacement,c=!1;this.prevZoomAdjustment=n?n.zoomAdjustment(this.transform.zoom):0;let d=n?n.symbolFadeChange(e):1,g=n?n.opacities:{},v=n?n.variableOffsets:{},w=n?n.placedOrientations:{};for(let S in this.placements){let C=this.placements[S],k=g[S];k?(this.opacities[S]=new Hr(k,d,C.text,C.icon),c=c||C.text!==k.text.placed||C.icon!==k.icon.placed):(this.opacities[S]=new Hr(null,d,C.text,C.icon,C.skipFade),c=c||C.text||C.icon)}for(let S in g){let C=g[S];if(!this.opacities[S]){let k=new Hr(C,d,!1,!1);k.isHidden()||(this.opacities[S]=k,c=c||C.text.placed||C.icon.placed)}}for(let S in v)this.variableOffsets[S]||!this.opacities[S]||this.opacities[S].isHidden()||(this.variableOffsets[S]=v[S]);for(let S in w)this.placedOrientations[S]||!this.opacities[S]||this.opacities[S].isHidden()||(this.placedOrientations[S]=w[S]);c?this.lastPlacementChangeTime=e:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=n?n.lastPlacementChangeTime:e)}updateLayerOpacities(e,n){let c={};for(let d of n){let g=d.getBucket(e);g&&d.latestFeatureIndex&&e.id===g.layerIds[0]&&this.updateBucketOpacities(g,c,d.collisionBoxArray)}}updateBucketOpacities(e,n,c){e.hasTextData()&&e.text.opacityVertexArray.clear(),e.hasIconData()&&e.icon.opacityVertexArray.clear(),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexArray.clear(),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexArray.clear();let d=e.layers[0].layout,g=new Hr(null,0,!1,!1,!0),v=d.get("text-allow-overlap"),w=d.get("icon-allow-overlap"),S=d.get("text-variable-anchor"),C=d.get("text-rotation-alignment")==="map",k=d.get("text-pitch-alignment")==="map",F=d.get("icon-text-fit")!=="none",j=new Hr(null,0,v&&(w||!e.hasIconData()||d.get("icon-optional")),w&&(v||!e.hasTextData()||d.get("text-optional")),!0);!e.collisionArrays&&c&&(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData())&&e.deserializeCollisionBoxes(c);let Q=($,J,lt)=>{for(let ht=0;ht<J/4;ht++)$.opacityVertexArray.emplaceBack(lt)};for(let $=0;$<e.symbolInstances.length;$++){let J=e.symbolInstances.get($),{numHorizontalGlyphVertices:lt,numVerticalGlyphVertices:ht,crossTileID:gt}=J,ut=this.opacities[gt];n[gt]?ut=g:ut||(ut=j,this.opacities[gt]=ut),n[gt]=!0;let At=J.numIconVertices>0,Mt=this.placedOrientations[J.crossTileID],Tt=Mt===a.WritingMode.vertical,Nt=Mt===a.WritingMode.horizontal||Mt===a.WritingMode.horizontalOnly;if(lt>0||ht>0){let jt=wt(ut.text);Q(e.text,lt,Tt?re:jt),Q(e.text,ht,Nt?re:jt);let It=ut.text.isHidden();[J.rightJustifiedTextSymbolIndex,J.centerJustifiedTextSymbolIndex,J.leftJustifiedTextSymbolIndex].forEach(ve=>{ve>=0&&(e.text.placedSymbolArray.get(ve).hidden=It||Tt?1:0)}),J.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(J.verticalPlacedTextSymbolIndex).hidden=It||Nt?1:0);let ie=this.variableOffsets[J.crossTileID];ie&&this.markUsedJustification(e,ie.anchor,J,Mt);let Ht=this.placedOrientations[J.crossTileID];Ht&&(this.markUsedJustification(e,"left",J,Ht),this.markUsedOrientation(e,Ht,J))}if(At){let jt=wt(ut.icon),It=!(F&&J.verticalPlacedIconSymbolIndex&&Tt);J.placedIconSymbolIndex>=0&&(Q(e.icon,J.numIconVertices,It?jt:re),e.icon.placedSymbolArray.get(J.placedIconSymbolIndex).hidden=ut.icon.isHidden()),J.verticalPlacedIconSymbolIndex>=0&&(Q(e.icon,J.numVerticalIconVertices,It?re:jt),e.icon.placedSymbolArray.get(J.verticalPlacedIconSymbolIndex).hidden=ut.icon.isHidden())}if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){let jt=e.collisionArrays[$];if(jt){let It=new a.pointGeometry(0,0);if(jt.textBox||jt.verticalTextBox){let Ht=!0;if(S){let ve=this.variableOffsets[gt];ve?(It=I(ve.anchor,ve.width,ve.height,ve.textOffset,ve.textBoxScale),C&&It._rotate(k?this.transform.angle:-this.transform.angle)):Ht=!1}jt.textBox&&H(e.textCollisionBox.collisionVertexArray,ut.text.placed,!Ht||Tt,It.x,It.y),jt.verticalTextBox&&H(e.textCollisionBox.collisionVertexArray,ut.text.placed,!Ht||Nt,It.x,It.y)}let ie=Boolean(!Nt&&jt.verticalIconBox);jt.iconBox&&H(e.iconCollisionBox.collisionVertexArray,ut.icon.placed,ie,F?It.x:0,F?It.y:0),jt.verticalIconBox&&H(e.iconCollisionBox.collisionVertexArray,ut.icon.placed,!ie,F?It.x:0,F?It.y:0)}}}if(e.sortFeatures(this.transform.angle),this.retainedQueryData[e.bucketInstanceId]&&(this.retainedQueryData[e.bucketInstanceId].featureSortOrder=e.featureSortOrder),e.hasTextData()&&e.text.opacityVertexBuffer&&e.text.opacityVertexBuffer.updateData(e.text.opacityVertexArray),e.hasIconData()&&e.icon.opacityVertexBuffer&&e.icon.opacityVertexBuffer.updateData(e.icon.opacityVertexArray),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexBuffer&&e.iconCollisionBox.collisionVertexBuffer.updateData(e.iconCollisionBox.collisionVertexArray),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexBuffer&&e.textCollisionBox.collisionVertexBuffer.updateData(e.textCollisionBox.collisionVertexArray),e.bucketInstanceId in this.collisionCircleArrays){let $=this.collisionCircleArrays[e.bucketInstanceId];e.placementInvProjMatrix=$.invProjMatrix,e.placementViewportMatrix=$.viewportMatrix,e.collisionCircleArray=$.circles,delete this.collisionCircleArrays[e.bucketInstanceId]}}symbolFadeChange(e){return this.fadeDuration===0?1:(e-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(e){return Math.max(0,(this.transform.zoom-e)/1.5)}hasTransitions(e){return this.stale||e-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(e,n){let c=this.zoomAtLastRecencyCheck===n?1-this.zoomAdjustment(n):1;return this.zoomAtLastRecencyCheck=n,this.commitTime+this.fadeDuration*c>e}setStale(){this.stale=!0}}function H(p,e,n,c,d){p.emplaceBack(e?1:0,n?1:0,c||0,d||0),p.emplaceBack(e?1:0,n?1:0,c||0,d||0),p.emplaceBack(e?1:0,n?1:0,c||0,d||0),p.emplaceBack(e?1:0,n?1:0,c||0,d||0)}let Y=Math.pow(2,25),at=Math.pow(2,24),rt=Math.pow(2,17),nt=Math.pow(2,16),ot=Math.pow(2,9),St=Math.pow(2,8),Lt=Math.pow(2,1);function wt(p){if(p.opacity===0&&!p.placed)return 0;if(p.opacity===1&&p.placed)return 4294967295;let e=p.placed?1:0,n=Math.floor(127*p.opacity);return n*Y+e*at+n*rt+e*nt+n*ot+e*St+n*Lt+e}let re=0;class Jt{constructor(e){this._sortAcrossTiles=e.layout.get("symbol-z-order")!=="viewport-y"&&!e.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(e,n,c,d,g){let v=this._bucketParts;for(;this._currentTileIndex<e.length;)if(n.getBucketParts(v,d,e[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,g())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,v.sort((w,S)=>w.sortKey-S.sortKey));this._currentPartIndex<v.length;)if(n.placeLayerBucketPart(v[this._currentPartIndex],this._seenCrossTileIDs,c),this._currentPartIndex++,g())return!0;return!1}}class ae{constructor(e,n,c,d,g,v,w){this.placement=new q(e,g,v,w),this._currentPlacementIndex=n.length-1,this._forceFullPlacement=c,this._showCollisionBoxes=d,this._done=!1}isDone(){return this._done}continuePlacement(e,n,c){let d=a.exported.now(),g=()=>{let v=a.exported.now()-d;return!this._forceFullPlacement&&v>2};for(;this._currentPlacementIndex>=0;){let v=n[e[this._currentPlacementIndex]],w=this.placement.collisionIndex.transform.zoom;if(v.type==="symbol"&&(!v.minzoom||v.minzoom<=w)&&(!v.maxzoom||v.maxzoom>w)){if(this._inProgressLayer||(this._inProgressLayer=new Jt(v)),this._inProgressLayer.continuePlacement(c[v.source],this.placement,this._showCollisionBoxes,v,g))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(e){return this.placement.commit(e),this.placement}}let pe=512/a.EXTENT/2;class Ue{constructor(e,n,c){this.tileID=e,this.indexedSymbolInstances={},this.bucketInstanceId=c;for(let d=0;d<n.length;d++){let g=n.get(d),v=g.key;this.indexedSymbolInstances[v]||(this.indexedSymbolInstances[v]=[]),this.indexedSymbolInstances[v].push({crossTileID:g.crossTileID,coord:this.getScaledCoordinates(g,e)})}}getScaledCoordinates(e,n){let c=pe/Math.pow(2,n.canonical.z-this.tileID.canonical.z);return{x:Math.floor((n.canonical.x*a.EXTENT+e.anchorX)*c),y:Math.floor((n.canonical.y*a.EXTENT+e.anchorY)*c)}}findMatches(e,n,c){let d=this.tileID.canonical.z<n.canonical.z?1:Math.pow(2,this.tileID.canonical.z-n.canonical.z);for(let g=0;g<e.length;g++){let v=e.get(g);if(v.crossTileID)continue;let w=this.indexedSymbolInstances[v.key];if(!w)continue;let S=this.getScaledCoordinates(v,n);for(let C of w)if(Math.abs(C.coord.x-S.x)<=d&&Math.abs(C.coord.y-S.y)<=d&&!c[C.crossTileID]){c[C.crossTileID]=!0,v.crossTileID=C.crossTileID;break}}}}class De{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class ze{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(e){let n=Math.round((e-this.lng)/360);if(n!==0)for(let c in this.indexes){let d=this.indexes[c],g={};for(let v in d){let w=d[v];w.tileID=w.tileID.unwrapTo(w.tileID.wrap+n),g[w.tileID.key]=w}this.indexes[c]=g}this.lng=e}addBucket(e,n,c){if(this.indexes[e.overscaledZ]&&this.indexes[e.overscaledZ][e.key]){if(this.indexes[e.overscaledZ][e.key].bucketInstanceId===n.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(e.overscaledZ,this.indexes[e.overscaledZ][e.key])}for(let g=0;g<n.symbolInstances.length;g++)n.symbolInstances.get(g).crossTileID=0;this.usedCrossTileIDs[e.overscaledZ]||(this.usedCrossTileIDs[e.overscaledZ]={});let d=this.usedCrossTileIDs[e.overscaledZ];for(let g in this.indexes){let v=this.indexes[g];if(Number(g)>e.overscaledZ)for(let w in v){let S=v[w];S.tileID.isChildOf(e)&&S.findMatches(n.symbolInstances,e,d)}else{let w=v[e.scaledTo(Number(g)).key];w&&w.findMatches(n.symbolInstances,e,d)}}for(let g=0;g<n.symbolInstances.length;g++){let v=n.symbolInstances.get(g);v.crossTileID||(v.crossTileID=c.generate(),d[v.crossTileID]=!0)}return this.indexes[e.overscaledZ]===void 0&&(this.indexes[e.overscaledZ]={}),this.indexes[e.overscaledZ][e.key]=new Ue(e,n.symbolInstances,n.bucketInstanceId),!0}removeBucketCrossTileIDs(e,n){for(let c in n.indexedSymbolInstances)for(let d of n.indexedSymbolInstances[c])delete this.usedCrossTileIDs[e][d.crossTileID]}removeStaleBuckets(e){let n=!1;for(let c in this.indexes){let d=this.indexes[c];for(let g in d)e[d[g].bucketInstanceId]||(this.removeBucketCrossTileIDs(c,d[g]),delete d[g],n=!0)}return n}}class Ee{constructor(){this.layerIndexes={},this.crossTileIDs=new De,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(e,n,c){let d=this.layerIndexes[e.id];d===void 0&&(d=this.layerIndexes[e.id]=new ze);let g=!1,v={};d.handleWrapJump(c);for(let w of n){let S=w.getBucket(e);S&&e.id===S.layerIds[0]&&(S.bucketInstanceId||(S.bucketInstanceId=++this.maxBucketInstanceId),d.addBucket(w.tileID,S,this.crossTileIDs)&&(g=!0),v[S.bucketInstanceId]=!0)}return d.removeStaleBuckets(v)&&(g=!0),g}pruneUnusedLayers(e){let n={};e.forEach(c=>{n[c]=!0});for(let c in this.layerIndexes)n[c]||delete this.layerIndexes[c]}}let Se=(p,e)=>a.emitValidationErrors(p,e&&e.filter(n=>n.identifier!=="source.canvas")),wi=a.pick(X,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData"]),xi=a.pick(X,["setCenter","setZoom","setBearing","setPitch"]),Gi=function(){let p={},e=a.spec.$version;for(let n in a.spec.$root){let c=a.spec.$root[n];if(c.required){let d=null;d=n==="version"?e:c.type==="array"?[]:{},d!=null&&(p[n]=d)}}return p}();class Wi extends a.Evented{constructor(e,n={}){super(),this.map=e,this.dispatcher=new Fi(U(),this),this.imageManager=new ne,this.imageManager.setEventedParent(this),this.glyphManager=new Ge(e._requestManager,n.localIdeographFontFamily),this.lineAtlas=new Yi(256,512),this.crossTileSymbolIndex=new Ee,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());let c=this;this._rtlTextPluginCallback=Wi.registerForPluginStateChange(d=>{c.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:d.pluginStatus,pluginURL:d.pluginURL},(g,v)=>{if(a.triggerPluginCompletionEvent(g),v&&v.every(w=>w))for(let w in c.sourceCaches)c.sourceCaches[w].reload()})}),this.on("data",d=>{if(d.dataType!=="source"||d.sourceDataType!=="metadata")return;let g=this.sourceCaches[d.sourceId];if(!g)return;let v=g.getSource();if(v&&v.vectorLayerIds)for(let w in this._layers){let S=this._layers[w];S.source===v.id&&this._validateLayer(S)}})}loadURL(e,n={}){this.fire(new a.Event("dataloading",{dataType:"style"}));let c=typeof n.validate!="boolean"||n.validate,d=this.map._requestManager.transformRequest(e,a.ResourceType.Style);this._request=a.getJSON(d,(g,v)=>{this._request=null,g?this.fire(new a.ErrorEvent(g)):v&&this._load(v,c)})}loadJSON(e,n={}){this.fire(new a.Event("dataloading",{dataType:"style"})),this._request=a.exported.frame(()=>{this._request=null,this._load(e,n.validate!==!1)})}loadEmpty(){this.fire(new a.Event("dataloading",{dataType:"style"})),this._load(Gi,!1)}_load(e,n){if(n&&Se(this,a.validateStyle(e)))return;this._loaded=!0,this.stylesheet=e;for(let d in e.sources)this.addSource(d,e.sources[d],{validate:!1});e.sprite?this._loadSprite(e.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(e.glyphs);let c=V(this.stylesheet.layers);this._order=c.map(d=>d.id),this._layers={},this._serializedLayers={};for(let d of c)d=a.createStyleLayer(d),d.setEventedParent(this,{layer:{id:d.id}}),this._layers[d.id]=d,this._serializedLayers[d.id]=d.serialize();this.dispatcher.broadcast("setLayers",this._serializeLayers(this._order)),this.light=new Bi(this.stylesheet.light),this.fire(new a.Event("data",{dataType:"style"})),this.fire(new a.Event("style.load"))}_loadSprite(e){this._spriteRequest=function(n,c,d,g){let v,w,S,C=d>1?"@2x":"",k=a.getJSON(c.transformRequest(c.normalizeSpriteURL(n,C,".json"),a.ResourceType.SpriteJSON),(Q,$)=>{k=null,S||(S=Q,v=$,j())}),F=a.getImage(c.transformRequest(c.normalizeSpriteURL(n,C,".png"),a.ResourceType.SpriteImage),(Q,$)=>{F=null,S||(S=Q,w=$,j())});function j(){if(S)g(S);else if(v&&w){let Q=a.exported.getImageData(w),$={};for(let J in v){let{width:lt,height:ht,x:gt,y:ut,sdf:At,pixelRatio:Mt,stretchX:Tt,stretchY:Nt,content:jt}=v[J],It=new a.RGBAImage({width:lt,height:ht});a.RGBAImage.copy(Q,It,{x:gt,y:ut},{x:0,y:0},{width:lt,height:ht}),$[J]={data:It,pixelRatio:Mt,sdf:At,stretchX:Tt,stretchY:Nt,content:jt}}g(null,$)}}return{cancel(){k&&(k.cancel(),k=null),F&&(F.cancel(),F=null)}}}(e,this.map._requestManager,this.map.getPixelRatio(),(n,c)=>{if(this._spriteRequest=null,n)this.fire(new a.ErrorEvent(n));else if(c)for(let d in c)this.imageManager.addImage(d,c[d]);this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new a.Event("data",{dataType:"style"}))})}_validateLayer(e){let n=this.sourceCaches[e.source];if(!n)return;let c=e.sourceLayer;if(!c)return;let d=n.getSource();(d.type==="geojson"||d.vectorLayerIds&&d.vectorLayerIds.indexOf(c)===-1)&&this.fire(new a.ErrorEvent(new Error(`Source layer "${c}" does not exist on source "${d.id}" as specified by style layer "${e.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(let e in this.sourceCaches)if(!this.sourceCaches[e].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeLayers(e){let n=[];for(let c of e){let d=this._layers[c];d.type!=="custom"&&n.push(d.serialize())}return n}hasTransitions(){if(this.light&&this.light.hasTransition())return!0;for(let e in this.sourceCaches)if(this.sourceCaches[e].hasTransition())return!0;for(let e in this._layers)if(this._layers[e].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(e){if(!this._loaded)return;let n=this._changed;if(this._changed){let d=Object.keys(this._updatedLayers),g=Object.keys(this._removedLayers);(d.length||g.length)&&this._updateWorkerLayers(d,g);for(let v in this._updatedSources){let w=this._updatedSources[v];w==="reload"?this._reloadSource(v):w==="clear"&&this._clearSource(v)}this._updateTilesForChangedImages();for(let v in this._updatedPaintProps)this._layers[v].updateTransitions(e);this.light.updateTransitions(e),this._resetUpdates()}let c={};for(let d in this.sourceCaches){let g=this.sourceCaches[d];c[d]=g.used,g.used=!1}for(let d of this._order){let g=this._layers[d];g.recalculate(e,this._availableImages),!g.isHidden(e.zoom)&&g.source&&(this.sourceCaches[g.source].used=!0)}for(let d in c){let g=this.sourceCaches[d];c[d]!==g.used&&g.fire(new a.Event("data",{sourceDataType:"visibility",dataType:"source",sourceId:d}))}this.light.recalculate(e),this.z=e.zoom,n&&this.fire(new a.Event("data",{dataType:"style"}))}_updateTilesForChangedImages(){let e=Object.keys(this._changedImages);if(e.length){for(let n in this.sourceCaches)this.sourceCaches[n].reloadTilesForDependencies(["icons","patterns"],e);this._changedImages={}}}_updateWorkerLayers(e,n){this.dispatcher.broadcast("updateLayers",{layers:this._serializeLayers(e),removedIds:n})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={}}setState(e){if(this._checkLoaded(),Se(this,a.validateStyle(e)))return!1;(e=a.clone$1(e)).layers=V(e.layers);let n=function(d,g){if(!d)return[{command:X.setStyle,args:[g]}];let v=[];try{if(!N(d.version,g.version))return[{command:X.setStyle,args:[g]}];N(d.center,g.center)||v.push({command:X.setCenter,args:[g.center]}),N(d.zoom,g.zoom)||v.push({command:X.setZoom,args:[g.zoom]}),N(d.bearing,g.bearing)||v.push({command:X.setBearing,args:[g.bearing]}),N(d.pitch,g.pitch)||v.push({command:X.setPitch,args:[g.pitch]}),N(d.sprite,g.sprite)||v.push({command:X.setSprite,args:[g.sprite]}),N(d.glyphs,g.glyphs)||v.push({command:X.setGlyphs,args:[g.glyphs]}),N(d.transition,g.transition)||v.push({command:X.setTransition,args:[g.transition]}),N(d.light,g.light)||v.push({command:X.setLight,args:[g.light]});let w={},S=[];(function(k,F,j,Q){let $;for($ in F=F||{},k=k||{})Object.prototype.hasOwnProperty.call(k,$)&&(Object.prototype.hasOwnProperty.call(F,$)||xt($,j,Q));for($ in F)Object.prototype.hasOwnProperty.call(F,$)&&(Object.prototype.hasOwnProperty.call(k,$)?N(k[$],F[$])||(k[$].type==="geojson"&&F[$].type==="geojson"&&Ut(k,F,$)?j.push({command:X.setGeoJSONSourceData,args:[$,F[$].data]}):Dt($,F,j,Q)):st($,F,j))})(d.sources,g.sources,S,w);let C=[];d.layers&&d.layers.forEach(k=>{w[k.source]?v.push({command:X.removeLayer,args:[k.id]}):C.push(k)}),v=v.concat(S),function(k,F,j){F=F||[];let Q=(k=k||[]).map(Ct),$=F.map(Ct),J=k.reduce(Te,{}),lt=F.reduce(Te,{}),ht=Q.slice(),gt=Object.create(null),ut,At,Mt,Tt,Nt,jt,It;for(ut=0,At=0;ut<Q.length;ut++)Mt=Q[ut],Object.prototype.hasOwnProperty.call(lt,Mt)?At++:(j.push({command:X.removeLayer,args:[Mt]}),ht.splice(ht.indexOf(Mt,At),1));for(ut=0,At=0;ut<$.length;ut++)Mt=$[$.length-1-ut],ht[ht.length-1-ut]!==Mt&&(Object.prototype.hasOwnProperty.call(J,Mt)?(j.push({command:X.removeLayer,args:[Mt]}),ht.splice(ht.lastIndexOf(Mt,ht.length-At),1)):At++,jt=ht[ht.length-ut],j.push({command:X.addLayer,args:[lt[Mt],jt]}),ht.splice(ht.length-ut,0,Mt),gt[Mt]=!0);for(ut=0;ut<$.length;ut++)if(Mt=$[ut],Tt=J[Mt],Nt=lt[Mt],!gt[Mt]&&!N(Tt,Nt))if(N(Tt.source,Nt.source)&&N(Tt["source-layer"],Nt["source-layer"])&&N(Tt.type,Nt.type)){for(It in ct(Tt.layout,Nt.layout,j,Mt,null,X.setLayoutProperty),ct(Tt.paint,Nt.paint,j,Mt,null,X.setPaintProperty),N(Tt.filter,Nt.filter)||j.push({command:X.setFilter,args:[Mt,Nt.filter]}),N(Tt.minzoom,Nt.minzoom)&&N(Tt.maxzoom,Nt.maxzoom)||j.push({command:X.setLayerZoomRange,args:[Mt,Nt.minzoom,Nt.maxzoom]}),Tt)Object.prototype.hasOwnProperty.call(Tt,It)&&It!=="layout"&&It!=="paint"&&It!=="filter"&&It!=="metadata"&&It!=="minzoom"&&It!=="maxzoom"&&(It.indexOf("paint.")===0?ct(Tt[It],Nt[It],j,Mt,It.slice(6),X.setPaintProperty):N(Tt[It],Nt[It])||j.push({command:X.setLayerProperty,args:[Mt,It,Nt[It]]}));for(It in Nt)Object.prototype.hasOwnProperty.call(Nt,It)&&!Object.prototype.hasOwnProperty.call(Tt,It)&&It!=="layout"&&It!=="paint"&&It!=="filter"&&It!=="metadata"&&It!=="minzoom"&&It!=="maxzoom"&&(It.indexOf("paint.")===0?ct(Tt[It],Nt[It],j,Mt,It.slice(6),X.setPaintProperty):N(Tt[It],Nt[It])||j.push({command:X.setLayerProperty,args:[Mt,It,Nt[It]]}))}else j.push({command:X.removeLayer,args:[Mt]}),jt=ht[ht.lastIndexOf(Mt)+1],j.push({command:X.addLayer,args:[Nt,jt]})}(C,g.layers,v)}catch(w){console.warn("Unable to compute style diff:",w),v=[{command:X.setStyle,args:[g]}]}return v}(this.serialize(),e).filter(d=>!(d.command in xi));if(n.length===0)return!1;let c=n.filter(d=>!(d.command in wi));if(c.length>0)throw new Error(`Unimplemented: ${c.map(d=>d.command).join(", ")}.`);return n.forEach(d=>{d.command!=="setTransition"&&this[d.command].apply(this,d.args)}),this.stylesheet=e,!0}addImage(e,n){if(this.getImage(e))return this.fire(new a.ErrorEvent(new Error(`An image named "${e}" already exists.`)));this.imageManager.addImage(e,n),this._afterImageUpdated(e)}updateImage(e,n){this.imageManager.updateImage(e,n)}getImage(e){return this.imageManager.getImage(e)}removeImage(e){if(!this.getImage(e))return this.fire(new a.ErrorEvent(new Error(`An image named "${e}" does not exist.`)));this.imageManager.removeImage(e),this._afterImageUpdated(e)}_afterImageUpdated(e){this._availableImages=this.imageManager.listImages(),this._changedImages[e]=!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(e,n,c={}){if(this._checkLoaded(),this.sourceCaches[e]!==void 0)throw new Error(`Source "${e}" already exists.`);if(!n.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(n).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(n.type)>=0&&this._validate(a.validateStyle.source,`sources.${e}`,n,null,c))return;this.map&&this.map._collectResourceTiming&&(n.collectResourceTiming=!0);let d=this.sourceCaches[e]=new Je(e,n,this.dispatcher);d.style=this,d.setEventedParent(this,()=>({isSourceLoaded:this.loaded(),source:d.serialize(),sourceId:e})),d.onAdd(this.map),this._changed=!0}removeSource(e){if(this._checkLoaded(),this.sourceCaches[e]===void 0)throw new Error("There is no source with this ID");for(let c in this._layers)if(this._layers[c].source===e)return this.fire(new a.ErrorEvent(new Error(`Source "${e}" cannot be removed while layer "${c}" is using it.`)));let n=this.sourceCaches[e];delete this.sourceCaches[e],delete this._updatedSources[e],n.fire(new a.Event("data",{sourceDataType:"metadata",dataType:"source",sourceId:e})),n.setEventedParent(null),n.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(e,n){this._checkLoaded(),this.sourceCaches[e].getSource().setData(n),this._changed=!0}getSource(e){return this.sourceCaches[e]&&this.sourceCaches[e].getSource()}addLayer(e,n,c={}){this._checkLoaded();let d=e.id;if(this.getLayer(d))return void this.fire(new a.ErrorEvent(new Error(`Layer "${d}" already exists on this map.`)));let g;if(e.type==="custom"){if(Se(this,a.validateCustomStyleLayer(e)))return;g=a.createStyleLayer(e)}else{if(typeof e.source=="object"&&(this.addSource(d,e.source),e=a.clone$1(e),e=a.extend(e,{source:d})),this._validate(a.validateStyle.layer,`layers.${d}`,e,{arrayIndex:-1},c))return;g=a.createStyleLayer(e),this._validateLayer(g),g.setEventedParent(this,{layer:{id:d}}),this._serializedLayers[g.id]=g.serialize()}let v=n?this._order.indexOf(n):this._order.length;if(n&&v===-1)this.fire(new a.ErrorEvent(new Error(`Cannot add layer "${d}" before non-existing layer "${n}".`)));else{if(this._order.splice(v,0,d),this._layerOrderChanged=!0,this._layers[d]=g,this._removedLayers[d]&&g.source&&g.type!=="custom"){let w=this._removedLayers[d];delete this._removedLayers[d],w.type!==g.type?this._updatedSources[g.source]="clear":(this._updatedSources[g.source]="reload",this.sourceCaches[g.source].pause())}this._updateLayer(g),g.onAdd&&g.onAdd(this.map)}}moveLayer(e,n){if(this._checkLoaded(),this._changed=!0,!this._layers[e])return void this.fire(new a.ErrorEvent(new Error(`The layer '${e}' does not exist in the map's style and cannot be moved.`)));if(e===n)return;let c=this._order.indexOf(e);this._order.splice(c,1);let d=n?this._order.indexOf(n):this._order.length;n&&d===-1?this.fire(new a.ErrorEvent(new Error(`Cannot move layer "${e}" before non-existing layer "${n}".`))):(this._order.splice(d,0,e),this._layerOrderChanged=!0)}removeLayer(e){this._checkLoaded();let n=this._layers[e];if(!n)return void this.fire(new a.ErrorEvent(new Error(`Cannot remove non-existing layer "${e}".`)));n.setEventedParent(null);let c=this._order.indexOf(e);this._order.splice(c,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[e]=n,delete this._layers[e],delete this._serializedLayers[e],delete this._updatedLayers[e],delete this._updatedPaintProps[e],n.onRemove&&n.onRemove(this.map)}getLayer(e){return this._layers[e]}hasLayer(e){return e in this._layers}setLayerZoomRange(e,n,c){this._checkLoaded();let d=this.getLayer(e);d?d.minzoom===n&&d.maxzoom===c||(n!=null&&(d.minzoom=n),c!=null&&(d.maxzoom=c),this._updateLayer(d)):this.fire(new a.ErrorEvent(new Error(`Cannot set the zoom range of non-existing layer "${e}".`)))}setFilter(e,n,c={}){this._checkLoaded();let d=this.getLayer(e);if(d){if(!N(d.filter,n))return n==null?(d.filter=void 0,void this._updateLayer(d)):void(this._validate(a.validateStyle.filter,`layers.${d.id}.filter`,n,null,c)||(d.filter=a.clone$1(n),this._updateLayer(d)))}else this.fire(new a.ErrorEvent(new Error(`Cannot filter non-existing layer "${e}".`)))}getFilter(e){return a.clone$1(this.getLayer(e).filter)}setLayoutProperty(e,n,c,d={}){this._checkLoaded();let g=this.getLayer(e);g?N(g.getLayoutProperty(n),c)||(g.setLayoutProperty(n,c,d),this._updateLayer(g)):this.fire(new a.ErrorEvent(new Error(`Cannot style non-existing layer "${e}".`)))}getLayoutProperty(e,n){let c=this.getLayer(e);if(c)return c.getLayoutProperty(n);this.fire(new a.ErrorEvent(new Error(`Cannot get style of non-existing layer "${e}".`)))}setPaintProperty(e,n,c,d={}){this._checkLoaded();let g=this.getLayer(e);g?N(g.getPaintProperty(n),c)||(g.setPaintProperty(n,c,d)&&this._updateLayer(g),this._changed=!0,this._updatedPaintProps[e]=!0):this.fire(new a.ErrorEvent(new Error(`Cannot style non-existing layer "${e}".`)))}getPaintProperty(e,n){return this.getLayer(e).getPaintProperty(n)}setFeatureState(e,n){this._checkLoaded();let c=e.source,d=e.sourceLayer,g=this.sourceCaches[c];if(g===void 0)return void this.fire(new a.ErrorEvent(new Error(`The source '${c}' does not exist in the map's style.`)));let v=g.getSource().type;v==="geojson"&&d?this.fire(new a.ErrorEvent(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):v!=="vector"||d?(e.id===void 0&&this.fire(new a.ErrorEvent(new Error("The feature id parameter must be provided."))),g.setFeatureState(d,e.id,n)):this.fire(new a.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(e,n){this._checkLoaded();let c=e.source,d=this.sourceCaches[c];if(d===void 0)return void this.fire(new a.ErrorEvent(new Error(`The source '${c}' does not exist in the map's style.`)));let g=d.getSource().type,v=g==="vector"?e.sourceLayer:void 0;g!=="vector"||v?n&&typeof e.id!="string"&&typeof e.id!="number"?this.fire(new a.ErrorEvent(new Error("A feature id is required to remove its specific state property."))):d.removeFeatureState(v,e.id,n):this.fire(new a.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(e){this._checkLoaded();let n=e.source,c=e.sourceLayer,d=this.sourceCaches[n];if(d!==void 0)return d.getSource().type!=="vector"||c?(e.id===void 0&&this.fire(new a.ErrorEvent(new Error("The feature id parameter must be provided."))),d.getFeatureState(c,e.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 '${n}' 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,e=>e.serialize()),layers:this._serializeLayers(this._order)},e=>e!==void 0)}_updateLayer(e){this._updatedLayers[e.id]=!0,e.source&&!this._updatedSources[e.source]&&this.sourceCaches[e.source].getSource().type!=="raster"&&(this._updatedSources[e.source]="reload",this.sourceCaches[e.source].pause()),this._changed=!0}_flattenAndSortRenderedFeatures(e){let n=v=>this._layers[v].type==="fill-extrusion",c={},d=[];for(let v=this._order.length-1;v>=0;v--){let w=this._order[v];if(n(w)){c[w]=v;for(let S of e){let C=S[w];if(C)for(let k of C)d.push(k)}}}d.sort((v,w)=>w.intersectionZ-v.intersectionZ);let g=[];for(let v=this._order.length-1;v>=0;v--){let w=this._order[v];if(n(w))for(let S=d.length-1;S>=0;S--){let C=d[S].feature;if(c[C.layer.id]<v)break;g.push(C),d.pop()}else for(let S of e){let C=S[w];if(C)for(let k of C)g.push(k.feature)}}return g}queryRenderedFeatures(e,n,c){n&&n.filter&&this._validate(a.validateStyle.filter,"queryRenderedFeatures.filter",n.filter,null,n);let d={};if(n&&n.layers){if(!Array.isArray(n.layers))return this.fire(new a.ErrorEvent(new Error("parameters.layers must be an Array."))),[];for(let v of n.layers){let w=this._layers[v];if(!w)return this.fire(new a.ErrorEvent(new Error(`The layer '${v}' does not exist in the map's style and cannot be queried for features.`))),[];d[w.source]=!0}}let g=[];n.availableImages=this._availableImages;for(let v in this.sourceCaches)n.layers&&!d[v]||g.push(Wr(this.sourceCaches[v],this._layers,this._serializedLayers,e,n,c));return this.placement&&g.push(function(v,w,S,C,k,F,j){let Q={},$=F.queryRenderedSymbols(C),J=[];for(let lt of Object.keys($).map(Number))J.push(j[lt]);J.sort(Tn);for(let lt of J){let ht=lt.featureIndex.lookupSymbolFeatures($[lt.bucketInstanceId],w,lt.bucketIndex,lt.sourceLayerIndex,k.filter,k.layers,k.availableImages,v);for(let gt in ht){let ut=Q[gt]=Q[gt]||[],At=ht[gt];At.sort((Mt,Tt)=>{let Nt=lt.featureSortOrder;if(Nt){let jt=Nt.indexOf(Mt.featureIndex);return Nt.indexOf(Tt.featureIndex)-jt}return Tt.featureIndex-Mt.featureIndex});for(let Mt of At)ut.push(Mt)}}for(let lt in Q)Q[lt].forEach(ht=>{let gt=ht.feature,ut=S[v[lt].source].getFeatureState(gt.layer["source-layer"],gt.id);gt.source=gt.layer.source,gt.layer["source-layer"]&&(gt.sourceLayer=gt.layer["source-layer"]),gt.state=ut});return Q}(this._layers,this._serializedLayers,this.sourceCaches,e,n,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(g)}querySourceFeatures(e,n){n&&n.filter&&this._validate(a.validateStyle.filter,"querySourceFeatures.filter",n.filter,null,n);let c=this.sourceCaches[e];return c?function(d,g){let v=d.getRenderableIds().map(C=>d.getTileByID(C)),w=[],S={};for(let C=0;C<v.length;C++){let k=v[C],F=k.tileID.canonical.key;S[F]||(S[F]=!0,k.querySourceFeatures(w,g))}return w}(c,n):[]}addSourceType(e,n,c){return Wi.getSourceType(e)?c(new Error(`A source type called "${e}" already exists.`)):(Wi.setSourceType(e,n),n.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:e,url:n.workerSourceURL},c):c(null,null))}getLight(){return this.light.getLight()}setLight(e,n={}){this._checkLoaded();let c=this.light.getLight(),d=!1;for(let v in e)if(!N(e[v],c[v])){d=!0;break}if(!d)return;let g={now:a.exported.now(),transition:a.extend({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(e,n),this.light.updateTransitions(g)}_validate(e,n,c,d,g={}){return(!g||g.validate!==!1)&&Se(this,e.call(a.validateStyle,a.extend({key:n,style:this.serialize(),value:c,styleSpec:a.spec},d)))}_remove(){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),a.evented.off("pluginStateChange",this._rtlTextPluginCallback);for(let e in this._layers)this._layers[e].setEventedParent(null);for(let e in this.sourceCaches){let n=this.sourceCaches[e];n.setEventedParent(null),n.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),this.dispatcher.remove()}_clearSource(e){this.sourceCaches[e].clearTiles()}_reloadSource(e){this.sourceCaches[e].resume(),this.sourceCaches[e].reload()}_updateSources(e){for(let n in this.sourceCaches)this.sourceCaches[n].update(e)}_generateCollisionBoxes(){for(let e in this.sourceCaches)this._reloadSource(e)}_updatePlacement(e,n,c,d,g=!1){let v=!1,w=!1,S={};for(let C of this._order){let k=this._layers[C];if(k.type!=="symbol")continue;if(!S[k.source]){let j=this.sourceCaches[k.source];S[k.source]=j.getRenderableIds(!0).map(Q=>j.getTileByID(Q)).sort((Q,$)=>$.tileID.overscaledZ-Q.tileID.overscaledZ||(Q.tileID.isLessThan($.tileID)?-1:1))}let F=this.crossTileSymbolIndex.addLayer(k,S[k.source],e.center.lng);v=v||F}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((g=g||this._layerOrderChanged||c===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(a.exported.now(),e.zoom))&&(this.pauseablePlacement=new ae(e,this._order,g,n,c,d,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,S),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(a.exported.now()),w=!0),v&&this.pauseablePlacement.placement.setStale()),w||v)for(let C of this._order){let k=this._layers[C];k.type==="symbol"&&this.placement.updateLayerOpacities(k,S[k.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(a.exported.now())}_releaseSymbolFadeTiles(){for(let e in this.sourceCaches)this.sourceCaches[e].releaseSymbolFadeTiles()}getImages(e,n,c){this.imageManager.getImages(n.icons,c),this._updateTilesForChangedImages();let d=this.sourceCaches[n.source];d&&d.setDependencies(n.tileID.key,n.type,n.icons)}getGlyphs(e,n,c){this.glyphManager.getGlyphs(n.stacks,c)}getResource(e,n,c){return a.makeRequest(n,c)}}Wi.getSourceType=function(p){return gr[p]},Wi.setSourceType=function(p,e){gr[p]=e},Wi.registerForPluginStateChange=a.registerForPluginStateChange;var ko=a.createLayout([{name:"a_pos",type:"Int16",components:2}]),Lo={prelude:ni(`#ifdef GL_ES
|
|
4
|
+
precision mediump float;
|
|
5
|
+
#else
|
|
6
|
+
#if !defined(lowp)
|
|
7
|
+
#define lowp
|
|
8
|
+
#endif
|
|
9
|
+
#if !defined(mediump)
|
|
10
|
+
#define mediump
|
|
11
|
+
#endif
|
|
12
|
+
#if !defined(highp)
|
|
13
|
+
#define highp
|
|
14
|
+
#endif
|
|
15
|
+
#endif`,`#ifdef GL_ES
|
|
16
|
+
precision highp float;
|
|
17
|
+
#else
|
|
18
|
+
#if !defined(lowp)
|
|
19
|
+
#define lowp
|
|
20
|
+
#endif
|
|
21
|
+
#if !defined(mediump)
|
|
22
|
+
#define mediump
|
|
23
|
+
#endif
|
|
24
|
+
#if !defined(highp)
|
|
25
|
+
#define highp
|
|
26
|
+
#endif
|
|
27
|
+
#endif
|
|
28
|
+
vec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0
|
|
29
|
+
);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}`),background:ni(`uniform vec4 u_color;uniform float u_opacity;void main() {gl_FragColor=u_color*u_opacity;
|
|
30
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
31
|
+
gl_FragColor=vec4(1.0);
|
|
32
|
+
#endif
|
|
33
|
+
}`,"attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),backgroundPattern:ni(`uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_mix)*u_opacity;
|
|
34
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
35
|
+
gl_FragColor=vec4(1.0);
|
|
36
|
+
#endif
|
|
37
|
+
}`,"uniform mat4 u_matrix;uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}"),circle:ni(`varying vec3 v_data;
|
|
38
|
+
#pragma mapbox: define highp vec4 color
|
|
39
|
+
#pragma mapbox: define mediump float radius
|
|
40
|
+
#pragma mapbox: define lowp float blur
|
|
41
|
+
#pragma mapbox: define lowp float opacity
|
|
42
|
+
#pragma mapbox: define highp vec4 stroke_color
|
|
43
|
+
#pragma mapbox: define mediump float stroke_width
|
|
44
|
+
#pragma mapbox: define lowp float stroke_opacity
|
|
45
|
+
void main() {
|
|
46
|
+
#pragma mapbox: initialize highp vec4 color
|
|
47
|
+
#pragma mapbox: initialize mediump float radius
|
|
48
|
+
#pragma mapbox: initialize lowp float blur
|
|
49
|
+
#pragma mapbox: initialize lowp float opacity
|
|
50
|
+
#pragma mapbox: initialize highp vec4 stroke_color
|
|
51
|
+
#pragma mapbox: initialize mediump float stroke_width
|
|
52
|
+
#pragma mapbox: initialize lowp float stroke_opacity
|
|
53
|
+
vec2 extrude=v_data.xy;float extrude_length=length(extrude);lowp float antialiasblur=v_data.z;float antialiased_blur=-max(blur,antialiasblur);float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));gl_FragColor=opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);
|
|
54
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
55
|
+
gl_FragColor=vec4(1.0);
|
|
56
|
+
#endif
|
|
57
|
+
}`,`uniform mat4 u_matrix;uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;attribute vec2 a_pos;varying vec3 v_data;
|
|
58
|
+
#pragma mapbox: define highp vec4 color
|
|
59
|
+
#pragma mapbox: define mediump float radius
|
|
60
|
+
#pragma mapbox: define lowp float blur
|
|
61
|
+
#pragma mapbox: define lowp float opacity
|
|
62
|
+
#pragma mapbox: define highp vec4 stroke_color
|
|
63
|
+
#pragma mapbox: define mediump float stroke_width
|
|
64
|
+
#pragma mapbox: define lowp float stroke_opacity
|
|
65
|
+
void main(void) {
|
|
66
|
+
#pragma mapbox: initialize highp vec4 color
|
|
67
|
+
#pragma mapbox: initialize mediump float radius
|
|
68
|
+
#pragma mapbox: initialize lowp float blur
|
|
69
|
+
#pragma mapbox: initialize lowp float opacity
|
|
70
|
+
#pragma mapbox: initialize highp vec4 stroke_color
|
|
71
|
+
#pragma mapbox: initialize mediump float stroke_width
|
|
72
|
+
#pragma mapbox: initialize lowp float stroke_opacity
|
|
73
|
+
vec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);if (u_pitch_with_map) {vec2 corner_position=circle_center;if (u_scale_with_map) {corner_position+=extrude*(radius+stroke_width)*u_extrude_scale;} else {vec4 projected_center=u_matrix*vec4(circle_center,0,1);corner_position+=extrude*(radius+stroke_width)*u_extrude_scale*(projected_center.w/u_camera_to_center_distance);}gl_Position=u_matrix*vec4(corner_position,0,1);} else {gl_Position=u_matrix*vec4(circle_center,0,1);if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);}`),clippingMask:ni("void main() {gl_FragColor=vec4(1.0);}","attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),heatmap:ni(`uniform highp float u_intensity;varying vec2 v_extrude;
|
|
74
|
+
#pragma mapbox: define highp float weight
|
|
75
|
+
#define GAUSS_COEF 0.3989422804014327
|
|
76
|
+
void main() {
|
|
77
|
+
#pragma mapbox: initialize highp float weight
|
|
78
|
+
float d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);gl_FragColor=vec4(val,1.0,1.0,1.0);
|
|
79
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
80
|
+
gl_FragColor=vec4(1.0);
|
|
81
|
+
#endif
|
|
82
|
+
}`,`uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;attribute vec2 a_pos;varying vec2 v_extrude;
|
|
83
|
+
#pragma mapbox: define highp float weight
|
|
84
|
+
#pragma mapbox: define mediump float radius
|
|
85
|
+
const highp float ZERO=1.0/255.0/16.0;
|
|
86
|
+
#define GAUSS_COEF 0.3989422804014327
|
|
87
|
+
void main(void) {
|
|
88
|
+
#pragma mapbox: initialize highp float weight
|
|
89
|
+
#pragma mapbox: initialize mediump float radius
|
|
90
|
+
vec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec4 pos=vec4(floor(a_pos*0.5)+extrude,0,1);gl_Position=u_matrix*pos;}`),heatmapTexture:ni(`uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;varying vec2 v_pos;void main() {float t=texture2D(u_image,v_pos).r;vec4 color=texture2D(u_color_ramp,vec2(t,0.5));gl_FragColor=color*u_opacity;
|
|
91
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
92
|
+
gl_FragColor=vec4(0.0);
|
|
93
|
+
#endif
|
|
94
|
+
}`,"uniform mat4 u_matrix;uniform vec2 u_world;attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"),collisionBox:ni("varying float v_placed;varying float v_notUsed;void main() {float alpha=0.5;gl_FragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {gl_FragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {gl_FragColor*=.1;}}","attribute vec2 a_pos;attribute vec2 a_anchor_pos;attribute vec2 a_extrude;attribute vec2 a_placed;attribute vec2 a_shift;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;varying float v_placed;varying float v_notUsed;void main() {vec4 projectedPoint=u_matrix*vec4(a_anchor_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);gl_Position=u_matrix*vec4(a_pos,0.0,1.0);gl_Position.xy+=(a_extrude+a_shift)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}"),collisionCircle:ni("varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);gl_FragColor=color*alpha*opacity_t;}","attribute vec2 a_pos;attribute float a_radius;attribute vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),debug:ni("uniform highp vec4 u_color;uniform sampler2D u_overlay;varying vec2 v_uv;void main() {vec4 overlay_color=texture2D(u_overlay,v_uv);gl_FragColor=mix(u_color,overlay_color,overlay_color.a);}","attribute vec2 a_pos;varying vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,0,1);}"),fill:ni(`#pragma mapbox: define highp vec4 color
|
|
95
|
+
#pragma mapbox: define lowp float opacity
|
|
96
|
+
void main() {
|
|
97
|
+
#pragma mapbox: initialize highp vec4 color
|
|
98
|
+
#pragma mapbox: initialize lowp float opacity
|
|
99
|
+
gl_FragColor=color*opacity;
|
|
100
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
101
|
+
gl_FragColor=vec4(1.0);
|
|
102
|
+
#endif
|
|
103
|
+
}`,`attribute vec2 a_pos;uniform mat4 u_matrix;
|
|
104
|
+
#pragma mapbox: define highp vec4 color
|
|
105
|
+
#pragma mapbox: define lowp float opacity
|
|
106
|
+
void main() {
|
|
107
|
+
#pragma mapbox: initialize highp vec4 color
|
|
108
|
+
#pragma mapbox: initialize lowp float opacity
|
|
109
|
+
gl_Position=u_matrix*vec4(a_pos,0,1);}`),fillOutline:ni(`varying vec2 v_pos;
|
|
110
|
+
#pragma mapbox: define highp vec4 outline_color
|
|
111
|
+
#pragma mapbox: define lowp float opacity
|
|
112
|
+
void main() {
|
|
113
|
+
#pragma mapbox: initialize highp vec4 outline_color
|
|
114
|
+
#pragma mapbox: initialize lowp float opacity
|
|
115
|
+
float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=outline_color*(alpha*opacity);
|
|
116
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
117
|
+
gl_FragColor=vec4(1.0);
|
|
118
|
+
#endif
|
|
119
|
+
}`,`attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos;
|
|
120
|
+
#pragma mapbox: define highp vec4 outline_color
|
|
121
|
+
#pragma mapbox: define lowp float opacity
|
|
122
|
+
void main() {
|
|
123
|
+
#pragma mapbox: initialize highp vec4 outline_color
|
|
124
|
+
#pragma mapbox: initialize lowp float opacity
|
|
125
|
+
gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`),fillOutlinePattern:ni(`uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;
|
|
126
|
+
#pragma mapbox: define lowp float opacity
|
|
127
|
+
#pragma mapbox: define lowp vec4 pattern_from
|
|
128
|
+
#pragma mapbox: define lowp vec4 pattern_to
|
|
129
|
+
void main() {
|
|
130
|
+
#pragma mapbox: initialize lowp float opacity
|
|
131
|
+
#pragma mapbox: initialize mediump vec4 pattern_from
|
|
132
|
+
#pragma mapbox: initialize mediump vec4 pattern_to
|
|
133
|
+
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=mix(color1,color2,u_fade)*alpha*opacity;
|
|
134
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
135
|
+
gl_FragColor=vec4(1.0);
|
|
136
|
+
#endif
|
|
137
|
+
}`,`uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;
|
|
138
|
+
#pragma mapbox: define lowp float opacity
|
|
139
|
+
#pragma mapbox: define lowp vec4 pattern_from
|
|
140
|
+
#pragma mapbox: define lowp vec4 pattern_to
|
|
141
|
+
#pragma mapbox: define lowp float pixel_ratio_from
|
|
142
|
+
#pragma mapbox: define lowp float pixel_ratio_to
|
|
143
|
+
void main() {
|
|
144
|
+
#pragma mapbox: initialize lowp float opacity
|
|
145
|
+
#pragma mapbox: initialize mediump vec4 pattern_from
|
|
146
|
+
#pragma mapbox: initialize mediump vec4 pattern_to
|
|
147
|
+
#pragma mapbox: initialize lowp float pixel_ratio_from
|
|
148
|
+
#pragma mapbox: initialize lowp float pixel_ratio_to
|
|
149
|
+
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`),fillPattern:ni(`#ifdef GL_ES
|
|
150
|
+
precision highp float;
|
|
151
|
+
#endif
|
|
152
|
+
uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;
|
|
153
|
+
#pragma mapbox: define lowp float opacity
|
|
154
|
+
#pragma mapbox: define lowp vec4 pattern_from
|
|
155
|
+
#pragma mapbox: define lowp vec4 pattern_to
|
|
156
|
+
void main() {
|
|
157
|
+
#pragma mapbox: initialize lowp float opacity
|
|
158
|
+
#pragma mapbox: initialize mediump vec4 pattern_from
|
|
159
|
+
#pragma mapbox: initialize mediump vec4 pattern_to
|
|
160
|
+
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_fade)*opacity;
|
|
161
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
162
|
+
gl_FragColor=vec4(1.0);
|
|
163
|
+
#endif
|
|
164
|
+
}`,`uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;
|
|
165
|
+
#pragma mapbox: define lowp float opacity
|
|
166
|
+
#pragma mapbox: define lowp vec4 pattern_from
|
|
167
|
+
#pragma mapbox: define lowp vec4 pattern_to
|
|
168
|
+
#pragma mapbox: define lowp float pixel_ratio_from
|
|
169
|
+
#pragma mapbox: define lowp float pixel_ratio_to
|
|
170
|
+
void main() {
|
|
171
|
+
#pragma mapbox: initialize lowp float opacity
|
|
172
|
+
#pragma mapbox: initialize mediump vec4 pattern_from
|
|
173
|
+
#pragma mapbox: initialize mediump vec4 pattern_to
|
|
174
|
+
#pragma mapbox: initialize lowp float pixel_ratio_from
|
|
175
|
+
#pragma mapbox: initialize lowp float pixel_ratio_to
|
|
176
|
+
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}`),fillExtrusion:ni(`varying vec4 v_color;void main() {gl_FragColor=v_color;
|
|
177
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
178
|
+
gl_FragColor=vec4(1.0);
|
|
179
|
+
#endif
|
|
180
|
+
}`,`uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;attribute vec2 a_pos;attribute vec4 a_normal_ed;varying vec4 v_color;
|
|
181
|
+
#pragma mapbox: define highp float base
|
|
182
|
+
#pragma mapbox: define highp float height
|
|
183
|
+
#pragma mapbox: define highp vec4 color
|
|
184
|
+
void main() {
|
|
185
|
+
#pragma mapbox: initialize highp float base
|
|
186
|
+
#pragma mapbox: initialize highp float height
|
|
187
|
+
#pragma mapbox: initialize highp vec4 color
|
|
188
|
+
vec3 normal=a_normal_ed.xyz;base=max(0.0,base);height=max(0.0,height);float t=mod(normal.x,2.0);gl_Position=u_matrix*vec4(a_pos,t > 0.0 ? height : base,1);float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;float directional=clamp(dot(normal/16384.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}`),fillExtrusionPattern:ni(`uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;
|
|
189
|
+
#pragma mapbox: define lowp float base
|
|
190
|
+
#pragma mapbox: define lowp float height
|
|
191
|
+
#pragma mapbox: define lowp vec4 pattern_from
|
|
192
|
+
#pragma mapbox: define lowp vec4 pattern_to
|
|
193
|
+
#pragma mapbox: define lowp float pixel_ratio_from
|
|
194
|
+
#pragma mapbox: define lowp float pixel_ratio_to
|
|
195
|
+
void main() {
|
|
196
|
+
#pragma mapbox: initialize lowp float base
|
|
197
|
+
#pragma mapbox: initialize lowp float height
|
|
198
|
+
#pragma mapbox: initialize mediump vec4 pattern_from
|
|
199
|
+
#pragma mapbox: initialize mediump vec4 pattern_to
|
|
200
|
+
#pragma mapbox: initialize lowp float pixel_ratio_from
|
|
201
|
+
#pragma mapbox: initialize lowp float pixel_ratio_to
|
|
202
|
+
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);gl_FragColor=mixedColor*v_lighting;
|
|
203
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
204
|
+
gl_FragColor=vec4(1.0);
|
|
205
|
+
#endif
|
|
206
|
+
}`,`uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute vec2 a_pos;attribute vec4 a_normal_ed;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;
|
|
207
|
+
#pragma mapbox: define lowp float base
|
|
208
|
+
#pragma mapbox: define lowp float height
|
|
209
|
+
#pragma mapbox: define lowp vec4 pattern_from
|
|
210
|
+
#pragma mapbox: define lowp vec4 pattern_to
|
|
211
|
+
#pragma mapbox: define lowp float pixel_ratio_from
|
|
212
|
+
#pragma mapbox: define lowp float pixel_ratio_to
|
|
213
|
+
void main() {
|
|
214
|
+
#pragma mapbox: initialize lowp float base
|
|
215
|
+
#pragma mapbox: initialize lowp float height
|
|
216
|
+
#pragma mapbox: initialize mediump vec4 pattern_from
|
|
217
|
+
#pragma mapbox: initialize mediump vec4 pattern_to
|
|
218
|
+
#pragma mapbox: initialize lowp float pixel_ratio_from
|
|
219
|
+
#pragma mapbox: initialize lowp float pixel_ratio_to
|
|
220
|
+
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;base=max(0.0,base);height=max(0.0,height);float t=mod(normal.x,2.0);float z=t > 0.0 ? height : base;gl_Position=u_matrix*vec4(a_pos,z,1);vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0
|
|
221
|
+
? a_pos
|
|
222
|
+
: vec2(edgedistance,z*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}`),hillshadePrepare:ni(`#ifdef GL_ES
|
|
223
|
+
precision highp float;
|
|
224
|
+
#endif
|
|
225
|
+
uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))/pow(2.0,exaggeration+(19.2562-u_zoom));gl_FragColor=clamp(vec4(deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);
|
|
226
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
227
|
+
gl_FragColor=vec4(1.0);
|
|
228
|
+
#endif
|
|
229
|
+
}`,"uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:ni(`uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;
|
|
230
|
+
#define PI 3.141592653589793
|
|
231
|
+
void main() {vec4 pixel=texture2D(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);gl_FragColor=accent_color*(1.0-shade_color.a)+shade_color;
|
|
232
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
233
|
+
gl_FragColor=vec4(1.0);
|
|
234
|
+
#endif
|
|
235
|
+
}`,"uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;}"),line:ni(`uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;
|
|
236
|
+
#pragma mapbox: define highp vec4 color
|
|
237
|
+
#pragma mapbox: define lowp float blur
|
|
238
|
+
#pragma mapbox: define lowp float opacity
|
|
239
|
+
void main() {
|
|
240
|
+
#pragma mapbox: initialize highp vec4 color
|
|
241
|
+
#pragma mapbox: initialize lowp float blur
|
|
242
|
+
#pragma mapbox: initialize lowp float opacity
|
|
243
|
+
float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);gl_FragColor=color*(alpha*opacity);
|
|
244
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
245
|
+
gl_FragColor=vec4(1.0);
|
|
246
|
+
#endif
|
|
247
|
+
}`,`
|
|
248
|
+
#define scale 0.015873016
|
|
249
|
+
attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp float v_linesofar;
|
|
250
|
+
#pragma mapbox: define highp vec4 color
|
|
251
|
+
#pragma mapbox: define lowp float blur
|
|
252
|
+
#pragma mapbox: define lowp float opacity
|
|
253
|
+
#pragma mapbox: define mediump float gapwidth
|
|
254
|
+
#pragma mapbox: define lowp float offset
|
|
255
|
+
#pragma mapbox: define mediump float width
|
|
256
|
+
void main() {
|
|
257
|
+
#pragma mapbox: initialize highp vec4 color
|
|
258
|
+
#pragma mapbox: initialize lowp float blur
|
|
259
|
+
#pragma mapbox: initialize lowp float opacity
|
|
260
|
+
#pragma mapbox: initialize mediump float gapwidth
|
|
261
|
+
#pragma mapbox: initialize lowp float offset
|
|
262
|
+
#pragma mapbox: initialize mediump float width
|
|
263
|
+
float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;v_width2=vec2(outset,inset);}`),lineGradient:ni(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp vec2 v_uv;
|
|
264
|
+
#pragma mapbox: define lowp float blur
|
|
265
|
+
#pragma mapbox: define lowp float opacity
|
|
266
|
+
void main() {
|
|
267
|
+
#pragma mapbox: initialize lowp float blur
|
|
268
|
+
#pragma mapbox: initialize lowp float opacity
|
|
269
|
+
float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture2D(u_image,v_uv);gl_FragColor=color*(alpha*opacity);
|
|
270
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
271
|
+
gl_FragColor=vec4(1.0);
|
|
272
|
+
#endif
|
|
273
|
+
}`,`
|
|
274
|
+
#define scale 0.015873016
|
|
275
|
+
attribute vec2 a_pos_normal;attribute vec4 a_data;attribute float a_uv_x;attribute float a_split_index;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp vec2 v_uv;
|
|
276
|
+
#pragma mapbox: define lowp float blur
|
|
277
|
+
#pragma mapbox: define lowp float opacity
|
|
278
|
+
#pragma mapbox: define mediump float gapwidth
|
|
279
|
+
#pragma mapbox: define lowp float offset
|
|
280
|
+
#pragma mapbox: define mediump float width
|
|
281
|
+
void main() {
|
|
282
|
+
#pragma mapbox: initialize lowp float blur
|
|
283
|
+
#pragma mapbox: initialize lowp float opacity
|
|
284
|
+
#pragma mapbox: initialize mediump float gapwidth
|
|
285
|
+
#pragma mapbox: initialize lowp float offset
|
|
286
|
+
#pragma mapbox: initialize mediump float width
|
|
287
|
+
float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;v_width2=vec2(outset,inset);}`),linePattern:ni(`#ifdef GL_ES
|
|
288
|
+
precision highp float;
|
|
289
|
+
#endif
|
|
290
|
+
uniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;
|
|
291
|
+
#pragma mapbox: define lowp vec4 pattern_from
|
|
292
|
+
#pragma mapbox: define lowp vec4 pattern_to
|
|
293
|
+
#pragma mapbox: define lowp float pixel_ratio_from
|
|
294
|
+
#pragma mapbox: define lowp float pixel_ratio_to
|
|
295
|
+
#pragma mapbox: define lowp float blur
|
|
296
|
+
#pragma mapbox: define lowp float opacity
|
|
297
|
+
void main() {
|
|
298
|
+
#pragma mapbox: initialize mediump vec4 pattern_from
|
|
299
|
+
#pragma mapbox: initialize mediump vec4 pattern_to
|
|
300
|
+
#pragma mapbox: initialize lowp float pixel_ratio_from
|
|
301
|
+
#pragma mapbox: initialize lowp float pixel_ratio_to
|
|
302
|
+
#pragma mapbox: initialize lowp float blur
|
|
303
|
+
#pragma mapbox: initialize lowp float opacity
|
|
304
|
+
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture2D(u_image,pos_a),texture2D(u_image,pos_b),u_fade);gl_FragColor=color*alpha*opacity;
|
|
305
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
306
|
+
gl_FragColor=vec4(1.0);
|
|
307
|
+
#endif
|
|
308
|
+
}`,`
|
|
309
|
+
#define scale 0.015873016
|
|
310
|
+
#define LINE_DISTANCE_SCALE 2.0
|
|
311
|
+
attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;
|
|
312
|
+
#pragma mapbox: define lowp float blur
|
|
313
|
+
#pragma mapbox: define lowp float opacity
|
|
314
|
+
#pragma mapbox: define lowp float offset
|
|
315
|
+
#pragma mapbox: define mediump float gapwidth
|
|
316
|
+
#pragma mapbox: define mediump float width
|
|
317
|
+
#pragma mapbox: define lowp float floorwidth
|
|
318
|
+
#pragma mapbox: define lowp vec4 pattern_from
|
|
319
|
+
#pragma mapbox: define lowp vec4 pattern_to
|
|
320
|
+
#pragma mapbox: define lowp float pixel_ratio_from
|
|
321
|
+
#pragma mapbox: define lowp float pixel_ratio_to
|
|
322
|
+
void main() {
|
|
323
|
+
#pragma mapbox: initialize lowp float blur
|
|
324
|
+
#pragma mapbox: initialize lowp float opacity
|
|
325
|
+
#pragma mapbox: initialize lowp float offset
|
|
326
|
+
#pragma mapbox: initialize mediump float gapwidth
|
|
327
|
+
#pragma mapbox: initialize mediump float width
|
|
328
|
+
#pragma mapbox: initialize lowp float floorwidth
|
|
329
|
+
#pragma mapbox: initialize mediump vec4 pattern_from
|
|
330
|
+
#pragma mapbox: initialize mediump vec4 pattern_to
|
|
331
|
+
#pragma mapbox: initialize lowp float pixel_ratio_from
|
|
332
|
+
#pragma mapbox: initialize lowp float pixel_ratio_to
|
|
333
|
+
float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}`),lineSDF:ni(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;
|
|
334
|
+
#pragma mapbox: define highp vec4 color
|
|
335
|
+
#pragma mapbox: define lowp float blur
|
|
336
|
+
#pragma mapbox: define lowp float opacity
|
|
337
|
+
#pragma mapbox: define mediump float width
|
|
338
|
+
#pragma mapbox: define lowp float floorwidth
|
|
339
|
+
void main() {
|
|
340
|
+
#pragma mapbox: initialize highp vec4 color
|
|
341
|
+
#pragma mapbox: initialize lowp float blur
|
|
342
|
+
#pragma mapbox: initialize lowp float opacity
|
|
343
|
+
#pragma mapbox: initialize mediump float width
|
|
344
|
+
#pragma mapbox: initialize lowp float floorwidth
|
|
345
|
+
float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture2D(u_image,v_tex_a).a;float sdfdist_b=texture2D(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);alpha*=smoothstep(0.5-u_sdfgamma/floorwidth,0.5+u_sdfgamma/floorwidth,sdfdist);gl_FragColor=color*(alpha*opacity);
|
|
346
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
347
|
+
gl_FragColor=vec4(1.0);
|
|
348
|
+
#endif
|
|
349
|
+
}`,`
|
|
350
|
+
#define scale 0.015873016
|
|
351
|
+
#define LINE_DISTANCE_SCALE 2.0
|
|
352
|
+
attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_patternscale_a;uniform float u_tex_y_a;uniform vec2 u_patternscale_b;uniform float u_tex_y_b;uniform vec2 u_units_to_pixels;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;
|
|
353
|
+
#pragma mapbox: define highp vec4 color
|
|
354
|
+
#pragma mapbox: define lowp float blur
|
|
355
|
+
#pragma mapbox: define lowp float opacity
|
|
356
|
+
#pragma mapbox: define mediump float gapwidth
|
|
357
|
+
#pragma mapbox: define lowp float offset
|
|
358
|
+
#pragma mapbox: define mediump float width
|
|
359
|
+
#pragma mapbox: define lowp float floorwidth
|
|
360
|
+
void main() {
|
|
361
|
+
#pragma mapbox: initialize highp vec4 color
|
|
362
|
+
#pragma mapbox: initialize lowp float blur
|
|
363
|
+
#pragma mapbox: initialize lowp float opacity
|
|
364
|
+
#pragma mapbox: initialize mediump float gapwidth
|
|
365
|
+
#pragma mapbox: initialize lowp float offset
|
|
366
|
+
#pragma mapbox: initialize mediump float width
|
|
367
|
+
#pragma mapbox: initialize lowp float floorwidth
|
|
368
|
+
float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;v_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}`),raster:ni(`uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;varying vec2 v_pos0;varying vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture2D(u_image0,v_pos0);vec4 color1=texture2D(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);gl_FragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);
|
|
369
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
370
|
+
gl_FragColor=vec4(1.0);
|
|
371
|
+
#endif
|
|
372
|
+
}`,"uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos0=(((a_texture_pos/8192.0)-0.5)/u_buffer_scale )+0.5;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}"),symbolIcon:ni(`uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity;
|
|
373
|
+
#pragma mapbox: define lowp float opacity
|
|
374
|
+
void main() {
|
|
375
|
+
#pragma mapbox: initialize lowp float opacity
|
|
376
|
+
lowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha;
|
|
377
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
378
|
+
gl_FragColor=vec4(1.0);
|
|
379
|
+
#endif
|
|
380
|
+
}`,`const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;varying vec2 v_tex;varying float v_fade_opacity;
|
|
381
|
+
#pragma mapbox: define lowp float opacity
|
|
382
|
+
void main() {
|
|
383
|
+
#pragma mapbox: initialize lowp float opacity
|
|
384
|
+
vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
|
|
385
|
+
camera_to_anchor_distance/u_camera_to_center_distance :
|
|
386
|
+
u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,0.0,1.0);gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0),0.0,1.0);v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;v_fade_opacity=max(0.0,min(1.0,fade_opacity[0]+fade_change));}`),symbolSDF:ni(`#define SDF_PX 8.0
|
|
387
|
+
uniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1;
|
|
388
|
+
#pragma mapbox: define highp vec4 fill_color
|
|
389
|
+
#pragma mapbox: define highp vec4 halo_color
|
|
390
|
+
#pragma mapbox: define lowp float opacity
|
|
391
|
+
#pragma mapbox: define lowp float halo_width
|
|
392
|
+
#pragma mapbox: define lowp float halo_blur
|
|
393
|
+
void main() {
|
|
394
|
+
#pragma mapbox: initialize highp vec4 fill_color
|
|
395
|
+
#pragma mapbox: initialize highp vec4 halo_color
|
|
396
|
+
#pragma mapbox: initialize lowp float opacity
|
|
397
|
+
#pragma mapbox: initialize lowp float halo_width
|
|
398
|
+
#pragma mapbox: initialize lowp float halo_blur
|
|
399
|
+
float EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);
|
|
400
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
401
|
+
gl_FragColor=vec4(1.0);
|
|
402
|
+
#endif
|
|
403
|
+
}`,`const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;varying vec2 v_data0;varying vec3 v_data1;
|
|
404
|
+
#pragma mapbox: define highp vec4 fill_color
|
|
405
|
+
#pragma mapbox: define highp vec4 halo_color
|
|
406
|
+
#pragma mapbox: define lowp float opacity
|
|
407
|
+
#pragma mapbox: define lowp float halo_width
|
|
408
|
+
#pragma mapbox: define lowp float halo_blur
|
|
409
|
+
void main() {
|
|
410
|
+
#pragma mapbox: initialize highp vec4 fill_color
|
|
411
|
+
#pragma mapbox: initialize highp vec4 halo_color
|
|
412
|
+
#pragma mapbox: initialize lowp float opacity
|
|
413
|
+
#pragma mapbox: initialize lowp float halo_width
|
|
414
|
+
#pragma mapbox: initialize lowp float halo_blur
|
|
415
|
+
vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
|
|
416
|
+
camera_to_anchor_distance/u_camera_to_center_distance :
|
|
417
|
+
u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,0.0,1.0);gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset),0.0,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(1.0,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}`),symbolTextAndIcon:ni(`#define SDF_PX 8.0
|
|
418
|
+
#define SDF 1.0
|
|
419
|
+
#define ICON 0.0
|
|
420
|
+
uniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;varying vec4 v_data0;varying vec4 v_data1;
|
|
421
|
+
#pragma mapbox: define highp vec4 fill_color
|
|
422
|
+
#pragma mapbox: define highp vec4 halo_color
|
|
423
|
+
#pragma mapbox: define lowp float opacity
|
|
424
|
+
#pragma mapbox: define lowp float halo_width
|
|
425
|
+
#pragma mapbox: define lowp float halo_blur
|
|
426
|
+
void main() {
|
|
427
|
+
#pragma mapbox: initialize highp vec4 fill_color
|
|
428
|
+
#pragma mapbox: initialize highp vec4 halo_color
|
|
429
|
+
#pragma mapbox: initialize lowp float opacity
|
|
430
|
+
#pragma mapbox: initialize lowp float halo_width
|
|
431
|
+
#pragma mapbox: initialize lowp float halo_blur
|
|
432
|
+
float fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha;
|
|
433
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
434
|
+
gl_FragColor=vec4(1.0);
|
|
435
|
+
#endif
|
|
436
|
+
return;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);
|
|
437
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
438
|
+
gl_FragColor=vec4(1.0);
|
|
439
|
+
#endif
|
|
440
|
+
}`,`const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;varying vec4 v_data0;varying vec4 v_data1;
|
|
441
|
+
#pragma mapbox: define highp vec4 fill_color
|
|
442
|
+
#pragma mapbox: define highp vec4 halo_color
|
|
443
|
+
#pragma mapbox: define lowp float opacity
|
|
444
|
+
#pragma mapbox: define lowp float halo_width
|
|
445
|
+
#pragma mapbox: define lowp float halo_blur
|
|
446
|
+
void main() {
|
|
447
|
+
#pragma mapbox: initialize highp vec4 fill_color
|
|
448
|
+
#pragma mapbox: initialize highp vec4 halo_color
|
|
449
|
+
#pragma mapbox: initialize lowp float opacity
|
|
450
|
+
#pragma mapbox: initialize lowp float halo_width
|
|
451
|
+
#pragma mapbox: initialize lowp float halo_blur
|
|
452
|
+
vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
|
|
453
|
+
camera_to_anchor_distance/u_camera_to_center_distance :
|
|
454
|
+
u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,0.0,1.0);gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale),0.0,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(1.0,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}`)};function ni(p,e){let n=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,c=e.match(/attribute ([\w]+) ([\w]+)/g),d=p.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),g=e.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),v=g?g.concat(d):d,w={};return{fragmentSource:p=p.replace(n,(S,C,k,F,j)=>(w[j]=!0,C==="define"?`
|
|
455
|
+
#ifndef HAS_UNIFORM_u_${j}
|
|
456
|
+
varying ${k} ${F} ${j};
|
|
457
|
+
#else
|
|
458
|
+
uniform ${k} ${F} u_${j};
|
|
459
|
+
#endif
|
|
460
|
+
`:`
|
|
461
|
+
#ifdef HAS_UNIFORM_u_${j}
|
|
462
|
+
${k} ${F} ${j} = u_${j};
|
|
463
|
+
#endif
|
|
464
|
+
`)),vertexSource:e=e.replace(n,(S,C,k,F,j)=>{let Q=F==="float"?"vec2":"vec4",$=j.match(/color/)?"color":Q;return w[j]?C==="define"?`
|
|
465
|
+
#ifndef HAS_UNIFORM_u_${j}
|
|
466
|
+
uniform lowp float u_${j}_t;
|
|
467
|
+
attribute ${k} ${Q} a_${j};
|
|
468
|
+
varying ${k} ${F} ${j};
|
|
469
|
+
#else
|
|
470
|
+
uniform ${k} ${F} u_${j};
|
|
471
|
+
#endif
|
|
472
|
+
`:$==="vec4"?`
|
|
473
|
+
#ifndef HAS_UNIFORM_u_${j}
|
|
474
|
+
${j} = a_${j};
|
|
475
|
+
#else
|
|
476
|
+
${k} ${F} ${j} = u_${j};
|
|
477
|
+
#endif
|
|
478
|
+
`:`
|
|
479
|
+
#ifndef HAS_UNIFORM_u_${j}
|
|
480
|
+
${j} = unpack_mix_${$}(a_${j}, u_${j}_t);
|
|
481
|
+
#else
|
|
482
|
+
${k} ${F} ${j} = u_${j};
|
|
483
|
+
#endif
|
|
484
|
+
`:C==="define"?`
|
|
485
|
+
#ifndef HAS_UNIFORM_u_${j}
|
|
486
|
+
uniform lowp float u_${j}_t;
|
|
487
|
+
attribute ${k} ${Q} a_${j};
|
|
488
|
+
#else
|
|
489
|
+
uniform ${k} ${F} u_${j};
|
|
490
|
+
#endif
|
|
491
|
+
`:$==="vec4"?`
|
|
492
|
+
#ifndef HAS_UNIFORM_u_${j}
|
|
493
|
+
${k} ${F} ${j} = a_${j};
|
|
494
|
+
#else
|
|
495
|
+
${k} ${F} ${j} = u_${j};
|
|
496
|
+
#endif
|
|
497
|
+
`:`
|
|
498
|
+
#ifndef HAS_UNIFORM_u_${j}
|
|
499
|
+
${k} ${F} ${j} = unpack_mix_${$}(a_${j}, u_${j}_t);
|
|
500
|
+
#else
|
|
501
|
+
${k} ${F} ${j} = u_${j};
|
|
502
|
+
#endif
|
|
503
|
+
`}),staticAttributes:c,staticUniforms:v}}class Pc{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(e,n,c,d,g,v,w,S){this.context=e;let C=this.boundPaintVertexBuffers.length!==d.length;for(let k=0;!C&&k<d.length;k++)this.boundPaintVertexBuffers[k]!==d[k]&&(C=!0);e.extVertexArrayObject&&this.vao&&this.boundProgram===n&&this.boundLayoutVertexBuffer===c&&!C&&this.boundIndexBuffer===g&&this.boundVertexOffset===v&&this.boundDynamicVertexBuffer===w&&this.boundDynamicVertexBuffer2===S?(e.bindVertexArrayOES.set(this.vao),w&&w.bind(),g&&g.dynamicDraw&&g.bind(),S&&S.bind()):this.freshBind(n,c,d,g,v,w,S)}freshBind(e,n,c,d,g,v,w){let S,C=e.numAttributes,k=this.context,F=k.gl;if(k.extVertexArrayObject)this.vao&&this.destroy(),this.vao=k.extVertexArrayObject.createVertexArrayOES(),k.bindVertexArrayOES.set(this.vao),S=0,this.boundProgram=e,this.boundLayoutVertexBuffer=n,this.boundPaintVertexBuffers=c,this.boundIndexBuffer=d,this.boundVertexOffset=g,this.boundDynamicVertexBuffer=v,this.boundDynamicVertexBuffer2=w;else{S=k.currentNumAttributes||0;for(let j=C;j<S;j++)F.disableVertexAttribArray(j)}n.enableAttributes(F,e);for(let j of c)j.enableAttributes(F,e);v&&v.enableAttributes(F,e),w&&w.enableAttributes(F,e),n.bind(),n.setVertexAttribPointers(F,e,g);for(let j of c)j.bind(),j.setVertexAttribPointers(F,e,g);v&&(v.bind(),v.setVertexAttribPointers(F,e,g)),d&&d.bind(),w&&(w.bind(),w.setVertexAttribPointers(F,e,g)),k.currentNumAttributes=C}destroy(){this.vao&&(this.context.extVertexArrayObject.deleteVertexArrayOES(this.vao),this.vao=null)}}function Do(p){let e=[];for(let n=0;n<p.length;n++){if(p[n]===null)continue;let c=p[n].split(" ");e.push(c.pop())}return e}class zc{constructor(e,n,c,d,g,v){let w=e.gl;this.program=w.createProgram();let S=Do(c.staticAttributes),C=d?d.getBinderAttributes():[],k=S.concat(C),F=c.staticUniforms?Do(c.staticUniforms):[],j=d?d.getBinderUniforms():[],Q=F.concat(j),$=[];for(let Mt of Q)$.indexOf(Mt)<0&&$.push(Mt);let J=d?d.defines():[];v&&J.push("#define OVERDRAW_INSPECTOR;");let lt=J.concat(Lo.prelude.fragmentSource,c.fragmentSource).join(`
|
|
504
|
+
`),ht=J.concat(Lo.prelude.vertexSource,c.vertexSource).join(`
|
|
505
|
+
`),gt=w.createShader(w.FRAGMENT_SHADER);if(w.isContextLost())return void(this.failedToCreate=!0);w.shaderSource(gt,lt),w.compileShader(gt),w.attachShader(this.program,gt);let ut=w.createShader(w.VERTEX_SHADER);if(w.isContextLost())return void(this.failedToCreate=!0);w.shaderSource(ut,ht),w.compileShader(ut),w.attachShader(this.program,ut),this.attributes={};let At={};this.numAttributes=k.length;for(let Mt=0;Mt<this.numAttributes;Mt++)k[Mt]&&(w.bindAttribLocation(this.program,Mt,k[Mt]),this.attributes[k[Mt]]=Mt);w.linkProgram(this.program),w.deleteShader(ut),w.deleteShader(gt);for(let Mt=0;Mt<$.length;Mt++){let Tt=$[Mt];if(Tt&&!At[Tt]){let Nt=w.getUniformLocation(this.program,Tt);Nt&&(At[Tt]=Nt)}}this.fixedUniforms=g(e,At),this.binderUniforms=d?d.getUniforms(e,At):[]}draw(e,n,c,d,g,v,w,S,C,k,F,j,Q,$,J,lt){let ht=e.gl;if(this.failedToCreate)return;e.program.set(this.program),e.setDepthMode(c),e.setStencilMode(d),e.setColorMode(g),e.setCullFace(v);for(let ut in this.fixedUniforms)this.fixedUniforms[ut].set(w[ut]);$&&$.setUniforms(e,this.binderUniforms,j,{zoom:Q});let gt={[ht.LINES]:2,[ht.TRIANGLES]:3,[ht.LINE_STRIP]:1}[n];for(let ut of F.get()){let At=ut.vaos||(ut.vaos={});(At[S]||(At[S]=new Pc)).bind(e,this,C,$?$.getPaintVertexBuffers():[],k,ut.vertexOffset,J,lt),ht.drawElements(n,ut.primitiveLength*gt,ht.UNSIGNED_SHORT,ut.primitiveOffset*gt*2)}}}function Ro(p,e,n){let c=1/gi(n,1,e.transform.tileZoom),d=Math.pow(2,n.tileID.overscaledZ),g=n.tileSize*Math.pow(2,e.transform.tileZoom)/d,v=g*(n.tileID.canonical.x+n.tileID.wrap*d),w=g*n.tileID.canonical.y;return{u_image:0,u_texsize:n.imageAtlasTexture.size,u_scale:[c,p.fromScale,p.toScale],u_fade:p.t,u_pixel_coord_upper:[v>>16,w>>16],u_pixel_coord_lower:[65535&v,65535&w]}}let Zl=(p,e,n,c)=>{let d=e.style.light,g=d.properties.get("position"),v=[g.x,g.y,g.z],w=function(){var C=new a.ARRAY_TYPE(9);return a.ARRAY_TYPE!=Float32Array&&(C[1]=0,C[2]=0,C[3]=0,C[5]=0,C[6]=0,C[7]=0),C[0]=1,C[4]=1,C[8]=1,C}();d.properties.get("anchor")==="viewport"&&function(C,k){var F=Math.sin(k),j=Math.cos(k);C[0]=j,C[1]=F,C[2]=0,C[3]=-F,C[4]=j,C[5]=0,C[6]=0,C[7]=0,C[8]=1}(w,-e.transform.angle),function(C,k,F){var j=k[0],Q=k[1],$=k[2];C[0]=j*F[0]+Q*F[3]+$*F[6],C[1]=j*F[1]+Q*F[4]+$*F[7],C[2]=j*F[2]+Q*F[5]+$*F[8]}(v,v,w);let S=d.properties.get("color");return{u_matrix:p,u_lightpos:v,u_lightintensity:d.properties.get("intensity"),u_lightcolor:[S.r,S.g,S.b],u_vertical_gradient:+n,u_opacity:c}},Bo=(p,e,n,c,d,g,v)=>a.extend(Zl(p,e,n,c),Ro(g,e,v),{u_height_factor:-Math.pow(2,d.overscaledZ)/v.tileSize/8}),Fo=p=>({u_matrix:p}),Oo=(p,e,n,c)=>a.extend(Fo(p),Ro(n,e,c)),Hl=(p,e)=>({u_matrix:p,u_world:e}),Xl=(p,e,n,c,d)=>a.extend(Oo(p,e,n,c),{u_world:d}),Fn=(p,e,n,c)=>{let d=p.transform,g,v;if(c.paint.get("circle-pitch-alignment")==="map"){let w=gi(n,1,d.zoom);g=!0,v=[w,w]}else g=!1,v=d.pixelsToGLUnits;return{u_camera_to_center_distance:d.cameraToCenterDistance,u_scale_with_map:+(c.paint.get("circle-pitch-scale")==="map"),u_matrix:p.translatePosMatrix(e.posMatrix,n,c.paint.get("circle-translate"),c.paint.get("circle-translate-anchor")),u_pitch_with_map:+g,u_device_pixel_ratio:p.pixelRatio,u_extrude_scale:v}},Sa=(p,e,n)=>{let c=gi(n,1,e.zoom),d=Math.pow(2,e.zoom-n.tileID.overscaledZ),g=n.tileID.overscaleFactor();return{u_matrix:p,u_camera_to_center_distance:e.cameraToCenterDistance,u_pixels_to_tile_units:c,u_extrude_scale:[e.pixelsToGLUnits[0]/(c*d),e.pixelsToGLUnits[1]/(c*d)],u_overscale_factor:g}},ms=(p,e,n=1)=>({u_matrix:p,u_color:e,u_overlay:0,u_overlay_scale:n}),js=p=>({u_matrix:p}),Ta=(p,e,n,c)=>({u_matrix:p,u_extrude_scale:gi(e,1,n),u_intensity:c});function Ea(p,e){let n=Math.pow(2,e.canonical.z),c=e.canonical.y;return[new a.MercatorCoordinate(0,c/n).toLngLat().lat,new a.MercatorCoordinate(0,(c+1)/n).toLngLat().lat]}let $s=(p,e,n)=>{let c=p.transform;return{u_matrix:No(p,e,n),u_ratio:1/gi(e,1,c.zoom),u_device_pixel_ratio:p.pixelRatio,u_units_to_pixels:[1/c.pixelsToGLUnits[0],1/c.pixelsToGLUnits[1]]}},Ia=(p,e,n,c)=>a.extend($s(p,e,n),{u_image:0,u_image_height:c}),Ws=(p,e,n,c)=>{let d=p.transform,g=Zs(e,d);return{u_matrix:No(p,e,n),u_texsize:e.imageAtlasTexture.size,u_ratio:1/gi(e,1,d.zoom),u_device_pixel_ratio:p.pixelRatio,u_image:0,u_scale:[g,c.fromScale,c.toScale],u_fade:c.t,u_units_to_pixels:[1/d.pixelsToGLUnits[0],1/d.pixelsToGLUnits[1]]}},Ai=(p,e,n,c,d)=>{let g=p.lineAtlas,v=Zs(e,p.transform),w=n.layout.get("line-cap")==="round",S=g.getDash(c.from,w),C=g.getDash(c.to,w),k=S.width*d.fromScale,F=C.width*d.toScale;return a.extend($s(p,e,n),{u_patternscale_a:[v/k,-S.height/2],u_patternscale_b:[v/F,-C.height/2],u_sdfgamma:g.width/(256*Math.min(k,F)*p.pixelRatio)/2,u_image:0,u_tex_y_a:S.y,u_tex_y_b:C.y,u_mix:d.t})};function Zs(p,e){return 1/gi(p,1,e.tileZoom)}function No(p,e,n){return p.translatePosMatrix(e.tileID.posMatrix,e,n.paint.get("line-translate"),n.paint.get("line-translate-anchor"))}let Kl=(p,e,n,c,d)=>{return{u_matrix:p,u_tl_parent:e,u_scale_parent:n,u_buffer_scale:1,u_fade_t:c.mix,u_opacity:c.opacity*d.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:d.paint.get("raster-brightness-min"),u_brightness_high:d.paint.get("raster-brightness-max"),u_saturation_factor:(v=d.paint.get("raster-saturation"),v>0?1-1/(1.001-v):-v),u_contrast_factor:(g=d.paint.get("raster-contrast"),g>0?1/(1-g):1+g),u_spin_weights:Yl(d.paint.get("raster-hue-rotate"))};var g,v};function Yl(p){p*=Math.PI/180;let e=Math.sin(p),n=Math.cos(p);return[(2*n+1)/3,(-Math.sqrt(3)*e-n+1)/3,(Math.sqrt(3)*e-n+1)/3]}let Ca=(p,e,n,c,d,g,v,w,S,C)=>{let k=d.transform;return{u_is_size_zoom_constant:+(p==="constant"||p==="source"),u_is_size_feature_constant:+(p==="constant"||p==="camera"),u_size_t:e?e.uSizeT:0,u_size:e?e.uSize:0,u_camera_to_center_distance:k.cameraToCenterDistance,u_pitch:k.pitch/360*2*Math.PI,u_rotate_symbol:+n,u_aspect_ratio:k.width/k.height,u_fade_change:d.options.fadeDuration?d.symbolFadeChange:1,u_matrix:g,u_label_plane_matrix:v,u_coord_matrix:w,u_is_text:+S,u_pitch_with_map:+c,u_texsize:C,u_texture:0}},Uo=(p,e,n,c,d,g,v,w,S,C,k)=>{let F=d.transform;return a.extend(Ca(p,e,n,c,d,g,v,w,S,C),{u_gamma_scale:c?Math.cos(F._pitch)*F.cameraToCenterDistance:1,u_device_pixel_ratio:d.pixelRatio,u_is_halo:+k})},kc=(p,e,n,c,d,g,v,w,S,C)=>a.extend(Uo(p,e,n,c,d,g,v,w,!0,S,!0),{u_texsize_icon:C,u_texture_icon:1}),Lc=(p,e,n)=>({u_matrix:p,u_opacity:e,u_color:n}),Vo=(p,e,n,c,d,g)=>a.extend(function(v,w,S,C){let k=S.imageManager.getPattern(v.from.toString()),F=S.imageManager.getPattern(v.to.toString()),{width:j,height:Q}=S.imageManager.getPixelSize(),$=Math.pow(2,C.tileID.overscaledZ),J=C.tileSize*Math.pow(2,S.transform.tileZoom)/$,lt=J*(C.tileID.canonical.x+C.tileID.wrap*$),ht=J*C.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:k.tl,u_pattern_br_a:k.br,u_pattern_tl_b:F.tl,u_pattern_br_b:F.br,u_texsize:[j,Q],u_mix:w.t,u_pattern_size_a:k.displaySize,u_pattern_size_b:F.displaySize,u_scale_a:w.fromScale,u_scale_b:w.toScale,u_tile_units_to_pixels:1/gi(C,1,S.transform.tileZoom),u_pixel_coord_upper:[lt>>16,ht>>16],u_pixel_coord_lower:[65535<,65535&ht]}}(c,g,n,d),{u_matrix:p,u_opacity:e}),Go={fillExtrusion:(p,e)=>({u_matrix:new a.UniformMatrix4f(p,e.u_matrix),u_lightpos:new a.Uniform3f(p,e.u_lightpos),u_lightintensity:new a.Uniform1f(p,e.u_lightintensity),u_lightcolor:new a.Uniform3f(p,e.u_lightcolor),u_vertical_gradient:new a.Uniform1f(p,e.u_vertical_gradient),u_opacity:new a.Uniform1f(p,e.u_opacity)}),fillExtrusionPattern:(p,e)=>({u_matrix:new a.UniformMatrix4f(p,e.u_matrix),u_lightpos:new a.Uniform3f(p,e.u_lightpos),u_lightintensity:new a.Uniform1f(p,e.u_lightintensity),u_lightcolor:new a.Uniform3f(p,e.u_lightcolor),u_vertical_gradient:new a.Uniform1f(p,e.u_vertical_gradient),u_height_factor:new a.Uniform1f(p,e.u_height_factor),u_image:new a.Uniform1i(p,e.u_image),u_texsize:new a.Uniform2f(p,e.u_texsize),u_pixel_coord_upper:new a.Uniform2f(p,e.u_pixel_coord_upper),u_pixel_coord_lower:new a.Uniform2f(p,e.u_pixel_coord_lower),u_scale:new a.Uniform3f(p,e.u_scale),u_fade:new a.Uniform1f(p,e.u_fade),u_opacity:new a.Uniform1f(p,e.u_opacity)}),fill:(p,e)=>({u_matrix:new a.UniformMatrix4f(p,e.u_matrix)}),fillPattern:(p,e)=>({u_matrix:new a.UniformMatrix4f(p,e.u_matrix),u_image:new a.Uniform1i(p,e.u_image),u_texsize:new a.Uniform2f(p,e.u_texsize),u_pixel_coord_upper:new a.Uniform2f(p,e.u_pixel_coord_upper),u_pixel_coord_lower:new a.Uniform2f(p,e.u_pixel_coord_lower),u_scale:new a.Uniform3f(p,e.u_scale),u_fade:new a.Uniform1f(p,e.u_fade)}),fillOutline:(p,e)=>({u_matrix:new a.UniformMatrix4f(p,e.u_matrix),u_world:new a.Uniform2f(p,e.u_world)}),fillOutlinePattern:(p,e)=>({u_matrix:new a.UniformMatrix4f(p,e.u_matrix),u_world:new a.Uniform2f(p,e.u_world),u_image:new a.Uniform1i(p,e.u_image),u_texsize:new a.Uniform2f(p,e.u_texsize),u_pixel_coord_upper:new a.Uniform2f(p,e.u_pixel_coord_upper),u_pixel_coord_lower:new a.Uniform2f(p,e.u_pixel_coord_lower),u_scale:new a.Uniform3f(p,e.u_scale),u_fade:new a.Uniform1f(p,e.u_fade)}),circle:(p,e)=>({u_camera_to_center_distance:new a.Uniform1f(p,e.u_camera_to_center_distance),u_scale_with_map:new a.Uniform1i(p,e.u_scale_with_map),u_pitch_with_map:new a.Uniform1i(p,e.u_pitch_with_map),u_extrude_scale:new a.Uniform2f(p,e.u_extrude_scale),u_device_pixel_ratio:new a.Uniform1f(p,e.u_device_pixel_ratio),u_matrix:new a.UniformMatrix4f(p,e.u_matrix)}),collisionBox:(p,e)=>({u_matrix:new a.UniformMatrix4f(p,e.u_matrix),u_camera_to_center_distance:new a.Uniform1f(p,e.u_camera_to_center_distance),u_pixels_to_tile_units:new a.Uniform1f(p,e.u_pixels_to_tile_units),u_extrude_scale:new a.Uniform2f(p,e.u_extrude_scale),u_overscale_factor:new a.Uniform1f(p,e.u_overscale_factor)}),collisionCircle:(p,e)=>({u_matrix:new a.UniformMatrix4f(p,e.u_matrix),u_inv_matrix:new a.UniformMatrix4f(p,e.u_inv_matrix),u_camera_to_center_distance:new a.Uniform1f(p,e.u_camera_to_center_distance),u_viewport_size:new a.Uniform2f(p,e.u_viewport_size)}),debug:(p,e)=>({u_color:new a.UniformColor(p,e.u_color),u_matrix:new a.UniformMatrix4f(p,e.u_matrix),u_overlay:new a.Uniform1i(p,e.u_overlay),u_overlay_scale:new a.Uniform1f(p,e.u_overlay_scale)}),clippingMask:(p,e)=>({u_matrix:new a.UniformMatrix4f(p,e.u_matrix)}),heatmap:(p,e)=>({u_extrude_scale:new a.Uniform1f(p,e.u_extrude_scale),u_intensity:new a.Uniform1f(p,e.u_intensity),u_matrix:new a.UniformMatrix4f(p,e.u_matrix)}),heatmapTexture:(p,e)=>({u_matrix:new a.UniformMatrix4f(p,e.u_matrix),u_world:new a.Uniform2f(p,e.u_world),u_image:new a.Uniform1i(p,e.u_image),u_color_ramp:new a.Uniform1i(p,e.u_color_ramp),u_opacity:new a.Uniform1f(p,e.u_opacity)}),hillshade:(p,e)=>({u_matrix:new a.UniformMatrix4f(p,e.u_matrix),u_image:new a.Uniform1i(p,e.u_image),u_latrange:new a.Uniform2f(p,e.u_latrange),u_light:new a.Uniform2f(p,e.u_light),u_shadow:new a.UniformColor(p,e.u_shadow),u_highlight:new a.UniformColor(p,e.u_highlight),u_accent:new a.UniformColor(p,e.u_accent)}),hillshadePrepare:(p,e)=>({u_matrix:new a.UniformMatrix4f(p,e.u_matrix),u_image:new a.Uniform1i(p,e.u_image),u_dimension:new a.Uniform2f(p,e.u_dimension),u_zoom:new a.Uniform1f(p,e.u_zoom),u_unpack:new a.Uniform4f(p,e.u_unpack)}),line:(p,e)=>({u_matrix:new a.UniformMatrix4f(p,e.u_matrix),u_ratio:new a.Uniform1f(p,e.u_ratio),u_device_pixel_ratio:new a.Uniform1f(p,e.u_device_pixel_ratio),u_units_to_pixels:new a.Uniform2f(p,e.u_units_to_pixels)}),lineGradient:(p,e)=>({u_matrix:new a.UniformMatrix4f(p,e.u_matrix),u_ratio:new a.Uniform1f(p,e.u_ratio),u_device_pixel_ratio:new a.Uniform1f(p,e.u_device_pixel_ratio),u_units_to_pixels:new a.Uniform2f(p,e.u_units_to_pixels),u_image:new a.Uniform1i(p,e.u_image),u_image_height:new a.Uniform1f(p,e.u_image_height)}),linePattern:(p,e)=>({u_matrix:new a.UniformMatrix4f(p,e.u_matrix),u_texsize:new a.Uniform2f(p,e.u_texsize),u_ratio:new a.Uniform1f(p,e.u_ratio),u_device_pixel_ratio:new a.Uniform1f(p,e.u_device_pixel_ratio),u_image:new a.Uniform1i(p,e.u_image),u_units_to_pixels:new a.Uniform2f(p,e.u_units_to_pixels),u_scale:new a.Uniform3f(p,e.u_scale),u_fade:new a.Uniform1f(p,e.u_fade)}),lineSDF:(p,e)=>({u_matrix:new a.UniformMatrix4f(p,e.u_matrix),u_ratio:new a.Uniform1f(p,e.u_ratio),u_device_pixel_ratio:new a.Uniform1f(p,e.u_device_pixel_ratio),u_units_to_pixels:new a.Uniform2f(p,e.u_units_to_pixels),u_patternscale_a:new a.Uniform2f(p,e.u_patternscale_a),u_patternscale_b:new a.Uniform2f(p,e.u_patternscale_b),u_sdfgamma:new a.Uniform1f(p,e.u_sdfgamma),u_image:new a.Uniform1i(p,e.u_image),u_tex_y_a:new a.Uniform1f(p,e.u_tex_y_a),u_tex_y_b:new a.Uniform1f(p,e.u_tex_y_b),u_mix:new a.Uniform1f(p,e.u_mix)}),raster:(p,e)=>({u_matrix:new a.UniformMatrix4f(p,e.u_matrix),u_tl_parent:new a.Uniform2f(p,e.u_tl_parent),u_scale_parent:new a.Uniform1f(p,e.u_scale_parent),u_buffer_scale:new a.Uniform1f(p,e.u_buffer_scale),u_fade_t:new a.Uniform1f(p,e.u_fade_t),u_opacity:new a.Uniform1f(p,e.u_opacity),u_image0:new a.Uniform1i(p,e.u_image0),u_image1:new a.Uniform1i(p,e.u_image1),u_brightness_low:new a.Uniform1f(p,e.u_brightness_low),u_brightness_high:new a.Uniform1f(p,e.u_brightness_high),u_saturation_factor:new a.Uniform1f(p,e.u_saturation_factor),u_contrast_factor:new a.Uniform1f(p,e.u_contrast_factor),u_spin_weights:new a.Uniform3f(p,e.u_spin_weights)}),symbolIcon:(p,e)=>({u_is_size_zoom_constant:new a.Uniform1i(p,e.u_is_size_zoom_constant),u_is_size_feature_constant:new a.Uniform1i(p,e.u_is_size_feature_constant),u_size_t:new a.Uniform1f(p,e.u_size_t),u_size:new a.Uniform1f(p,e.u_size),u_camera_to_center_distance:new a.Uniform1f(p,e.u_camera_to_center_distance),u_pitch:new a.Uniform1f(p,e.u_pitch),u_rotate_symbol:new a.Uniform1i(p,e.u_rotate_symbol),u_aspect_ratio:new a.Uniform1f(p,e.u_aspect_ratio),u_fade_change:new a.Uniform1f(p,e.u_fade_change),u_matrix:new a.UniformMatrix4f(p,e.u_matrix),u_label_plane_matrix:new a.UniformMatrix4f(p,e.u_label_plane_matrix),u_coord_matrix:new a.UniformMatrix4f(p,e.u_coord_matrix),u_is_text:new a.Uniform1i(p,e.u_is_text),u_pitch_with_map:new a.Uniform1i(p,e.u_pitch_with_map),u_texsize:new a.Uniform2f(p,e.u_texsize),u_texture:new a.Uniform1i(p,e.u_texture)}),symbolSDF:(p,e)=>({u_is_size_zoom_constant:new a.Uniform1i(p,e.u_is_size_zoom_constant),u_is_size_feature_constant:new a.Uniform1i(p,e.u_is_size_feature_constant),u_size_t:new a.Uniform1f(p,e.u_size_t),u_size:new a.Uniform1f(p,e.u_size),u_camera_to_center_distance:new a.Uniform1f(p,e.u_camera_to_center_distance),u_pitch:new a.Uniform1f(p,e.u_pitch),u_rotate_symbol:new a.Uniform1i(p,e.u_rotate_symbol),u_aspect_ratio:new a.Uniform1f(p,e.u_aspect_ratio),u_fade_change:new a.Uniform1f(p,e.u_fade_change),u_matrix:new a.UniformMatrix4f(p,e.u_matrix),u_label_plane_matrix:new a.UniformMatrix4f(p,e.u_label_plane_matrix),u_coord_matrix:new a.UniformMatrix4f(p,e.u_coord_matrix),u_is_text:new a.Uniform1i(p,e.u_is_text),u_pitch_with_map:new a.Uniform1i(p,e.u_pitch_with_map),u_texsize:new a.Uniform2f(p,e.u_texsize),u_texture:new a.Uniform1i(p,e.u_texture),u_gamma_scale:new a.Uniform1f(p,e.u_gamma_scale),u_device_pixel_ratio:new a.Uniform1f(p,e.u_device_pixel_ratio),u_is_halo:new a.Uniform1i(p,e.u_is_halo)}),symbolTextAndIcon:(p,e)=>({u_is_size_zoom_constant:new a.Uniform1i(p,e.u_is_size_zoom_constant),u_is_size_feature_constant:new a.Uniform1i(p,e.u_is_size_feature_constant),u_size_t:new a.Uniform1f(p,e.u_size_t),u_size:new a.Uniform1f(p,e.u_size),u_camera_to_center_distance:new a.Uniform1f(p,e.u_camera_to_center_distance),u_pitch:new a.Uniform1f(p,e.u_pitch),u_rotate_symbol:new a.Uniform1i(p,e.u_rotate_symbol),u_aspect_ratio:new a.Uniform1f(p,e.u_aspect_ratio),u_fade_change:new a.Uniform1f(p,e.u_fade_change),u_matrix:new a.UniformMatrix4f(p,e.u_matrix),u_label_plane_matrix:new a.UniformMatrix4f(p,e.u_label_plane_matrix),u_coord_matrix:new a.UniformMatrix4f(p,e.u_coord_matrix),u_is_text:new a.Uniform1i(p,e.u_is_text),u_pitch_with_map:new a.Uniform1i(p,e.u_pitch_with_map),u_texsize:new a.Uniform2f(p,e.u_texsize),u_texsize_icon:new a.Uniform2f(p,e.u_texsize_icon),u_texture:new a.Uniform1i(p,e.u_texture),u_texture_icon:new a.Uniform1i(p,e.u_texture_icon),u_gamma_scale:new a.Uniform1f(p,e.u_gamma_scale),u_device_pixel_ratio:new a.Uniform1f(p,e.u_device_pixel_ratio),u_is_halo:new a.Uniform1i(p,e.u_is_halo)}),background:(p,e)=>({u_matrix:new a.UniformMatrix4f(p,e.u_matrix),u_opacity:new a.Uniform1f(p,e.u_opacity),u_color:new a.UniformColor(p,e.u_color)}),backgroundPattern:(p,e)=>({u_matrix:new a.UniformMatrix4f(p,e.u_matrix),u_opacity:new a.Uniform1f(p,e.u_opacity),u_image:new a.Uniform1i(p,e.u_image),u_pattern_tl_a:new a.Uniform2f(p,e.u_pattern_tl_a),u_pattern_br_a:new a.Uniform2f(p,e.u_pattern_br_a),u_pattern_tl_b:new a.Uniform2f(p,e.u_pattern_tl_b),u_pattern_br_b:new a.Uniform2f(p,e.u_pattern_br_b),u_texsize:new a.Uniform2f(p,e.u_texsize),u_mix:new a.Uniform1f(p,e.u_mix),u_pattern_size_a:new a.Uniform2f(p,e.u_pattern_size_a),u_pattern_size_b:new a.Uniform2f(p,e.u_pattern_size_b),u_scale_a:new a.Uniform1f(p,e.u_scale_a),u_scale_b:new a.Uniform1f(p,e.u_scale_b),u_pixel_coord_upper:new a.Uniform2f(p,e.u_pixel_coord_upper),u_pixel_coord_lower:new a.Uniform2f(p,e.u_pixel_coord_lower),u_tile_units_to_pixels:new a.Uniform1f(p,e.u_tile_units_to_pixels)})};class qo{constructor(e,n,c){this.context=e;let d=e.gl;this.buffer=d.createBuffer(),this.dynamicDraw=Boolean(c),this.context.unbindVAO(),e.bindElementBuffer.set(this.buffer),d.bufferData(d.ELEMENT_ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?d.DYNAMIC_DRAW:d.STATIC_DRAW),this.dynamicDraw||delete n.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(e){let n=this.context.gl;this.context.unbindVAO(),this.bind(),n.bufferSubData(n.ELEMENT_ARRAY_BUFFER,0,e.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}let jo={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class Jl{constructor(e,n,c,d){this.length=n.length,this.attributes=c,this.itemSize=n.bytesPerElement,this.dynamicDraw=d,this.context=e;let g=e.gl;this.buffer=g.createBuffer(),e.bindVertexBuffer.set(this.buffer),g.bufferData(g.ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?g.DYNAMIC_DRAW:g.STATIC_DRAW),this.dynamicDraw||delete n.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(e){let n=this.context.gl;this.bind(),n.bufferSubData(n.ARRAY_BUFFER,0,e.arrayBuffer)}enableAttributes(e,n){for(let c=0;c<this.attributes.length;c++){let d=n.attributes[this.attributes[c].name];d!==void 0&&e.enableVertexAttribArray(d)}}setVertexAttribPointers(e,n,c){for(let d=0;d<this.attributes.length;d++){let g=this.attributes[d],v=n.attributes[g.name];v!==void 0&&e.vertexAttribPointer(v,g.components,e[jo[g.type]],!1,this.itemSize,g.offset+this.itemSize*(c||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class $e{constructor(e){this.gl=e.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(e){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class Dc extends $e{getDefault(){return a.Color.transparent}set(e){let n=this.current;(e.r!==n.r||e.g!==n.g||e.b!==n.b||e.a!==n.a||this.dirty)&&(this.gl.clearColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}}class Hs extends $e{getDefault(){return 1}set(e){(e!==this.current||this.dirty)&&(this.gl.clearDepth(e),this.current=e,this.dirty=!1)}}class Xs extends $e{getDefault(){return 0}set(e){(e!==this.current||this.dirty)&&(this.gl.clearStencil(e),this.current=e,this.dirty=!1)}}class Ql extends $e{getDefault(){return[!0,!0,!0,!0]}set(e){let n=this.current;(e[0]!==n[0]||e[1]!==n[1]||e[2]!==n[2]||e[3]!==n[3]||this.dirty)&&(this.gl.colorMask(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}class _r extends $e{getDefault(){return!0}set(e){(e!==this.current||this.dirty)&&(this.gl.depthMask(e),this.current=e,this.dirty=!1)}}class $o extends $e{getDefault(){return 255}set(e){(e!==this.current||this.dirty)&&(this.gl.stencilMask(e),this.current=e,this.dirty=!1)}}class Aa extends $e{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(e){let n=this.current;(e.func!==n.func||e.ref!==n.ref||e.mask!==n.mask||this.dirty)&&(this.gl.stencilFunc(e.func,e.ref,e.mask),this.current=e,this.dirty=!1)}}class Pa extends $e{getDefault(){let e=this.gl;return[e.KEEP,e.KEEP,e.KEEP]}set(e){let n=this.current;(e[0]!==n[0]||e[1]!==n[1]||e[2]!==n[2]||this.dirty)&&(this.gl.stencilOp(e[0],e[1],e[2]),this.current=e,this.dirty=!1)}}class Wo extends $e{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let n=this.gl;e?n.enable(n.STENCIL_TEST):n.disable(n.STENCIL_TEST),this.current=e,this.dirty=!1}}class Zo extends $e{getDefault(){return[0,1]}set(e){let n=this.current;(e[0]!==n[0]||e[1]!==n[1]||this.dirty)&&(this.gl.depthRange(e[0],e[1]),this.current=e,this.dirty=!1)}}class za extends $e{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let n=this.gl;e?n.enable(n.DEPTH_TEST):n.disable(n.DEPTH_TEST),this.current=e,this.dirty=!1}}class Ho extends $e{getDefault(){return this.gl.LESS}set(e){(e!==this.current||this.dirty)&&(this.gl.depthFunc(e),this.current=e,this.dirty=!1)}}class Xo extends $e{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let n=this.gl;e?n.enable(n.BLEND):n.disable(n.BLEND),this.current=e,this.dirty=!1}}class ka extends $e{getDefault(){let e=this.gl;return[e.ONE,e.ZERO]}set(e){let n=this.current;(e[0]!==n[0]||e[1]!==n[1]||this.dirty)&&(this.gl.blendFunc(e[0],e[1]),this.current=e,this.dirty=!1)}}class th extends $e{getDefault(){return a.Color.transparent}set(e){let n=this.current;(e.r!==n.r||e.g!==n.g||e.b!==n.b||e.a!==n.a||this.dirty)&&(this.gl.blendColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}}class eh extends $e{getDefault(){return this.gl.FUNC_ADD}set(e){(e!==this.current||this.dirty)&&(this.gl.blendEquation(e),this.current=e,this.dirty=!1)}}class gs extends $e{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let n=this.gl;e?n.enable(n.CULL_FACE):n.disable(n.CULL_FACE),this.current=e,this.dirty=!1}}class Rc extends $e{getDefault(){return this.gl.BACK}set(e){(e!==this.current||this.dirty)&&(this.gl.cullFace(e),this.current=e,this.dirty=!1)}}class Bc extends $e{getDefault(){return this.gl.CCW}set(e){(e!==this.current||this.dirty)&&(this.gl.frontFace(e),this.current=e,this.dirty=!1)}}class Fc extends $e{getDefault(){return null}set(e){(e!==this.current||this.dirty)&&(this.gl.useProgram(e),this.current=e,this.dirty=!1)}}class Oc extends $e{getDefault(){return this.gl.TEXTURE0}set(e){(e!==this.current||this.dirty)&&(this.gl.activeTexture(e),this.current=e,this.dirty=!1)}}class Nc extends $e{getDefault(){let e=this.gl;return[0,0,e.drawingBufferWidth,e.drawingBufferHeight]}set(e){let n=this.current;(e[0]!==n[0]||e[1]!==n[1]||e[2]!==n[2]||e[3]!==n[3]||this.dirty)&&(this.gl.viewport(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}class Uc extends $e{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let n=this.gl;n.bindFramebuffer(n.FRAMEBUFFER,e),this.current=e,this.dirty=!1}}class Ko extends $e{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let n=this.gl;n.bindRenderbuffer(n.RENDERBUFFER,e),this.current=e,this.dirty=!1}}class Yo extends $e{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let n=this.gl;n.bindTexture(n.TEXTURE_2D,e),this.current=e,this.dirty=!1}}class ys extends $e{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let n=this.gl;n.bindBuffer(n.ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}class ih extends $e{getDefault(){return null}set(e){let n=this.gl;n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}class rh extends $e{constructor(e){super(e),this.vao=e.extVertexArrayObject}getDefault(){return null}set(e){this.vao&&(e!==this.current||this.dirty)&&(this.vao.bindVertexArrayOES(e),this.current=e,this.dirty=!1)}}class Jo extends $e{getDefault(){return 4}set(e){if(e===this.current&&!this.dirty)return;let n=this.gl;n.pixelStorei(n.UNPACK_ALIGNMENT,e),this.current=e,this.dirty=!1}}class On extends $e{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let n=this.gl;n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e),this.current=e,this.dirty=!1}}class nh extends $e{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let n=this.gl;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,e),this.current=e,this.dirty=!1}}class Nn extends $e{constructor(e,n){super(e),this.context=e,this.parent=n}getDefault(){return null}}class _s extends Nn{setDirty(){this.dirty=!0}set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let n=this.gl;n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,e,0),this.current=e,this.dirty=!1}}class sh extends Nn{set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let n=this.gl;n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,e),this.current=e,this.dirty=!1}}class Qo{constructor(e,n,c,d){this.context=e,this.width=n,this.height=c;let g=this.framebuffer=e.gl.createFramebuffer();this.colorAttachment=new _s(e,g),d&&(this.depthAttachment=new sh(e,g))}destroy(){let e=this.context.gl,n=this.colorAttachment.get();if(n&&e.deleteTexture(n),this.depthAttachment){let c=this.depthAttachment.get();c&&e.deleteRenderbuffer(c)}e.deleteFramebuffer(this.framebuffer)}}class Me{constructor(e,n,c){this.blendFunction=e,this.blendColor=n,this.mask=c}}Me.Replace=[1,0],Me.disabled=new Me(Me.Replace,a.Color.transparent,[!1,!1,!1,!1]),Me.unblended=new Me(Me.Replace,a.Color.transparent,[!0,!0,!0,!0]),Me.alphaBlended=new Me([1,771],a.Color.transparent,[!0,!0,!0,!0]);class La{constructor(e){this.gl=e,this.extVertexArrayObject=this.gl.getExtension("OES_vertex_array_object"),this.clearColor=new Dc(this),this.clearDepth=new Hs(this),this.clearStencil=new Xs(this),this.colorMask=new Ql(this),this.depthMask=new _r(this),this.stencilMask=new $o(this),this.stencilFunc=new Aa(this),this.stencilOp=new Pa(this),this.stencilTest=new Wo(this),this.depthRange=new Zo(this),this.depthTest=new za(this),this.depthFunc=new Ho(this),this.blend=new Xo(this),this.blendFunc=new ka(this),this.blendColor=new th(this),this.blendEquation=new eh(this),this.cullFace=new gs(this),this.cullFaceSide=new Rc(this),this.frontFace=new Bc(this),this.program=new Fc(this),this.activeTexture=new Oc(this),this.viewport=new Nc(this),this.bindFramebuffer=new Uc(this),this.bindRenderbuffer=new Ko(this),this.bindTexture=new Yo(this),this.bindVertexBuffer=new ys(this),this.bindElementBuffer=new ih(this),this.bindVertexArrayOES=this.extVertexArrayObject&&new rh(this),this.pixelStoreUnpack=new Jo(this),this.pixelStoreUnpackPremultiplyAlpha=new On(this),this.pixelStoreUnpackFlipY=new nh(this),this.extTextureFilterAnisotropic=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=e.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.extTextureHalfFloat=e.getExtension("OES_texture_half_float"),this.extTextureHalfFloat&&(e.getExtension("OES_texture_half_float_linear"),this.extRenderToTextureHalfFloat=e.getExtension("EXT_color_buffer_half_float")),this.extTimerQuery=e.getExtension("EXT_disjoint_timer_query"),this.maxTextureSize=e.getParameter(e.MAX_TEXTURE_SIZE)}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.extVertexArrayObject&&(this.bindVertexArrayOES.dirty=!0),this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(e,n){return new qo(this,e,n)}createVertexBuffer(e,n,c){return new Jl(this,e,n,c)}createRenderbuffer(e,n,c){let d=this.gl,g=d.createRenderbuffer();return this.bindRenderbuffer.set(g),d.renderbufferStorage(d.RENDERBUFFER,e,n,c),this.bindRenderbuffer.set(null),g}createFramebuffer(e,n,c){return new Qo(this,e,n,c)}clear({color:e,depth:n}){let c=this.gl,d=0;e&&(d|=c.COLOR_BUFFER_BIT,this.clearColor.set(e),this.colorMask.set([!0,!0,!0,!0])),n!==void 0&&(d|=c.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(n),this.depthMask.set(!0)),c.clear(d)}setCullFace(e){e.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(e.mode),this.frontFace.set(e.frontFace))}setDepthMode(e){e.func!==this.gl.ALWAYS||e.mask?(this.depthTest.set(!0),this.depthFunc.set(e.func),this.depthMask.set(e.mask),this.depthRange.set(e.range)):this.depthTest.set(!1)}setStencilMode(e){e.test.func!==this.gl.ALWAYS||e.mask?(this.stencilTest.set(!0),this.stencilMask.set(e.mask),this.stencilOp.set([e.fail,e.depthFail,e.pass]),this.stencilFunc.set({func:e.test.func,ref:e.ref,mask:e.test.mask})):this.stencilTest.set(!1)}setColorMode(e){N(e.blendFunction,Me.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(e.blendFunction),this.blendColor.set(e.blendColor)),this.colorMask.set(e.mask)}unbindVAO(){this.extVertexArrayObject&&this.bindVertexArrayOES.set(null)}}class Ye{constructor(e,n,c){this.func=e,this.mask=n,this.range=c}}Ye.ReadOnly=!1,Ye.ReadWrite=!0,Ye.disabled=new Ye(519,Ye.ReadOnly,[0,1]);let Da=7680;class li{constructor(e,n,c,d,g,v){this.test=e,this.ref=n,this.mask=c,this.fail=d,this.depthFail=g,this.pass=v}}li.disabled=new li({func:519,mask:0},0,0,Da,Da,Da);class vi{constructor(e,n,c){this.enable=e,this.mode=n,this.frontFace=c}}let Ra;function tl(p,e,n,c,d,g,v){let w=p.context,S=w.gl,C=p.useProgram("collisionBox"),k=[],F=0,j=0;for(let ut=0;ut<c.length;ut++){let At=c[ut],Mt=e.getTile(At),Tt=Mt.getBucket(n);if(!Tt)continue;let Nt=At.posMatrix;d[0]===0&&d[1]===0||(Nt=p.translatePosMatrix(At.posMatrix,Mt,d,g));let jt=v?Tt.textCollisionBox:Tt.iconCollisionBox,It=Tt.collisionCircleArray;if(It.length>0){let ie=a.create(),Ht=Nt;a.mul(ie,Tt.placementInvProjMatrix,p.transform.glCoordMatrix),a.mul(ie,ie,Tt.placementViewportMatrix),k.push({circleArray:It,circleOffset:j,transform:Ht,invTransform:ie}),F+=It.length/4,j=F}jt&&C.draw(w,S.LINES,Ye.disabled,li.disabled,p.colorModeForRenderPass(),vi.disabled,Sa(Nt,p.transform,Mt),n.id,jt.layoutVertexBuffer,jt.indexBuffer,jt.segments,null,p.transform.zoom,null,null,jt.collisionVertexBuffer)}if(!v||!k.length)return;let Q=p.useProgram("collisionCircle"),$=new a.CollisionCircleLayoutArray;$.resize(4*F),$._trim();let J=0;for(let ut of k)for(let At=0;At<ut.circleArray.length/4;At++){let Mt=4*At,Tt=ut.circleArray[Mt+0],Nt=ut.circleArray[Mt+1],jt=ut.circleArray[Mt+2],It=ut.circleArray[Mt+3];$.emplace(J++,Tt,Nt,jt,It,0),$.emplace(J++,Tt,Nt,jt,It,1),$.emplace(J++,Tt,Nt,jt,It,2),$.emplace(J++,Tt,Nt,jt,It,3)}(!Ra||Ra.length<2*F)&&(Ra=function(ut){let At=2*ut,Mt=new a.QuadTriangleArray;Mt.resize(At),Mt._trim();for(let Tt=0;Tt<At;Tt++){let Nt=6*Tt;Mt.uint16[Nt+0]=4*Tt+0,Mt.uint16[Nt+1]=4*Tt+1,Mt.uint16[Nt+2]=4*Tt+2,Mt.uint16[Nt+3]=4*Tt+2,Mt.uint16[Nt+4]=4*Tt+3,Mt.uint16[Nt+5]=4*Tt+0}return Mt}(F));let lt=w.createIndexBuffer(Ra,!0),ht=w.createVertexBuffer($,a.collisionCircleLayout.members,!0);for(let ut of k){let At={u_matrix:ut.transform,u_inv_matrix:ut.invTransform,u_camera_to_center_distance:(gt=p.transform).cameraToCenterDistance,u_viewport_size:[gt.width,gt.height]};Q.draw(w,S.TRIANGLES,Ye.disabled,li.disabled,p.colorModeForRenderPass(),vi.disabled,At,n.id,ht,lt,a.SegmentVector.simpleSegment(0,2*ut.circleOffset,ut.circleArray.length,ut.circleArray.length/2),null,p.transform.zoom,null,null,null)}var gt;ht.destroy(),lt.destroy()}vi.disabled=new vi(!1,1029,2305),vi.backCCW=new vi(!0,1029,2305);let Vc=a.identity(new Float32Array(16));function el(p,e,n,c,d,g){let{horizontalAlign:v,verticalAlign:w}=a.getAnchorAlignment(p),S=-(v-.5)*e,C=-(w-.5)*n,k=a.evaluateVariableOffset(p,c);return new a.pointGeometry((S/d+k[0])*g,(C/d+k[1])*g)}function Ba(p,e,n,c,d,g,v,w,S,C){let k=p.text.placedSymbolArray,F=p.text.dynamicLayoutVertexArray,j=p.icon.dynamicLayoutVertexArray,Q={};F.clear();for(let $=0;$<k.length;$++){let J=k.get($),lt=p.allowVerticalPlacement&&!J.placedOrientation,ht=J.hidden||!J.crossTileID||lt?null:c[J.crossTileID];if(ht){let gt=new a.pointGeometry(J.anchorX,J.anchorY),ut=Pe(gt,n?v:g),At=Vt(d.cameraToCenterDistance,ut.signedDistanceFromCamera),Mt=a.evaluateSizeForFeature(p.textSizeData,S,J)*At/a.ONE_EM;n&&(Mt*=p.tilePixelRatio/w);let{width:Tt,height:Nt,anchor:jt,textOffset:It,textBoxScale:ie}=ht,Ht=el(jt,Tt,Nt,It,ie,Mt),ve=n?Pe(gt.add(Ht),g).point:ut.point.add(e?Ht.rotate(-d.angle):Ht),Fe=p.allowVerticalPlacement&&J.placedOrientation===a.WritingMode.vertical?Math.PI/2:0;for(let ke=0;ke<J.numGlyphs;ke++)a.addDynamicAttributes(F,ve,Fe);C&&J.associatedIconIndex>=0&&(Q[J.associatedIconIndex]={shiftedAnchor:ve,angle:Fe})}else ri(J.numGlyphs,F)}if(C){j.clear();let $=p.icon.placedSymbolArray;for(let J=0;J<$.length;J++){let lt=$.get(J);if(lt.hidden)ri(lt.numGlyphs,j);else{let ht=Q[J];if(ht)for(let gt=0;gt<lt.numGlyphs;gt++)a.addDynamicAttributes(j,ht.shiftedAnchor,ht.angle);else ri(lt.numGlyphs,j)}}p.icon.dynamicLayoutVertexBuffer.updateData(j)}p.text.dynamicLayoutVertexBuffer.updateData(F)}function Fa(p,e,n){return n.iconsInText&&e?"symbolTextAndIcon":p?"symbolSDF":"symbolIcon"}function Oa(p,e,n,c,d,g,v,w,S,C,k,F){let j=p.context,Q=j.gl,$=p.transform,J=w==="map",lt=S==="map",ht=w!=="viewport"&&n.layout.get("symbol-placement")!=="point",gt=J&&!lt&&!ht,ut=!n.layout.get("symbol-sort-key").isConstant(),At=!1,Mt=p.depthModeForSublayer(0,Ye.ReadOnly),Tt=n.layout.get("text-variable-anchor"),Nt=[];for(let jt of c){let It=e.getTile(jt),ie=It.getBucket(n);if(!ie)continue;let Ht=d?ie.text:ie.icon;if(!Ht||!Ht.segments.get().length)continue;let ve=Ht.programConfigurations.get(n.id),Fe=d||ie.sdfIcons,ke=d?ie.textSizeData:ie.iconSizeData,Re=lt||$.pitch!==0,yi=p.useProgram(Fa(Fe,d,ie),ve),we=a.evaluateSizeForZoom(ke,$.zoom),qe,ti,Zi,vr,Fr=[0,0],Or=null;if(d){if(ti=It.glyphAtlasTexture,Zi=Q.LINEAR,qe=It.glyphAtlasTexture.size,ie.iconsInText){Fr=It.imageAtlasTexture.size,Or=It.imageAtlasTexture;let ln=ke.kind==="composite"||ke.kind==="camera";vr=Re||p.options.rotating||p.options.zooming||ln?Q.LINEAR:Q.NEAREST}}else{let ln=n.layout.get("icon-size").constantOr(0)!==1||ie.iconsNeedLinear;ti=It.imageAtlasTexture,Zi=Fe||p.options.rotating||p.options.zooming||ln||Re?Q.LINEAR:Q.NEAREST,qe=It.imageAtlasTexture.size}let In=gi(It,1,p.transform.zoom),ur=Ce(jt.posMatrix,lt,J,p.transform,In),on=Qe(jt.posMatrix,lt,J,p.transform,In),$n=Tt&&ie.hasTextData(),br=n.layout.get("icon-text-fit")!=="none"&&$n&&ie.hasIconData();if(ht){let ln=n.layout.get("text-rotation-alignment")==="map";ce(ie,jt.posMatrix,p,d,ur,on,lt,C,ln)}let je=p.translatePosMatrix(jt.posMatrix,It,g,v),Xe=ht||d&&Tt||br?Vc:ur,Pi=p.translatePosMatrix(on,It,g,v,!0),nr=Fe&&n.paint.get(d?"text-halo-width":"icon-halo-width").constantOr(1)!==0,ci;ci=Fe?ie.iconsInText?kc(ke.kind,we,gt,lt,p,je,Xe,Pi,qe,Fr):Uo(ke.kind,we,gt,lt,p,je,Xe,Pi,d,qe,!0):Ca(ke.kind,we,gt,lt,p,je,Xe,Pi,d,qe);let Wn={program:yi,buffers:Ht,uniformValues:ci,atlasTexture:ti,atlasTextureIcon:Or,atlasInterpolation:Zi,atlasInterpolationIcon:vr,isSDF:Fe,hasHalo:nr};if(ut&&ie.canOverlap){At=!0;let ln=Ht.segments.get();for(let Ya of ln)Nt.push({segments:new a.SegmentVector([Ya]),sortKey:Ya.sortKey,state:Wn})}else Nt.push({segments:Ht.segments,sortKey:0,state:Wn})}At&&Nt.sort((jt,It)=>jt.sortKey-It.sortKey);for(let jt of Nt){let It=jt.state;if(j.activeTexture.set(Q.TEXTURE0),It.atlasTexture.bind(It.atlasInterpolation,Q.CLAMP_TO_EDGE),It.atlasTextureIcon&&(j.activeTexture.set(Q.TEXTURE1),It.atlasTextureIcon&&It.atlasTextureIcon.bind(It.atlasInterpolationIcon,Q.CLAMP_TO_EDGE)),It.isSDF){let ie=It.uniformValues;It.hasHalo&&(ie.u_is_halo=1,Na(It.buffers,jt.segments,n,p,It.program,Mt,k,F,ie)),ie.u_is_halo=0}Na(It.buffers,jt.segments,n,p,It.program,Mt,k,F,It.uniformValues)}}function Na(p,e,n,c,d,g,v,w,S){let C=c.context;d.draw(C,C.gl.TRIANGLES,g,v,w,vi.disabled,S,n.id,p.layoutVertexBuffer,p.indexBuffer,e,n.paint,c.transform.zoom,p.programConfigurations.get(n.id),p.dynamicLayoutVertexBuffer,p.opacityVertexBuffer)}function il(p,e,n,c,d,g,v){let w=p.context.gl,S=n.paint.get("fill-pattern"),C=S&&S.constantOr(1),k=n.getCrossfadeParameters(),F,j,Q,$,J;v?(j=C&&!n.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",F=w.LINES):(j=C?"fillPattern":"fill",F=w.TRIANGLES);for(let lt of c){let ht=e.getTile(lt);if(C&&!ht.patternsLoaded())continue;let gt=ht.getBucket(n);if(!gt)continue;let ut=gt.programConfigurations.get(n.id),At=p.useProgram(j,ut);C&&(p.context.activeTexture.set(w.TEXTURE0),ht.imageAtlasTexture.bind(w.LINEAR,w.CLAMP_TO_EDGE),ut.updatePaintBuffers(k));let Mt=S.constantOr(null);if(Mt&&ht.imageAtlas){let Nt=ht.imageAtlas,jt=Nt.patternPositions[Mt.to.toString()],It=Nt.patternPositions[Mt.from.toString()];jt&&It&&ut.setConstantPatternPositions(jt,It)}let Tt=p.translatePosMatrix(lt.posMatrix,ht,n.paint.get("fill-translate"),n.paint.get("fill-translate-anchor"));if(v){$=gt.indexBuffer2,J=gt.segments2;let Nt=[w.drawingBufferWidth,w.drawingBufferHeight];Q=j==="fillOutlinePattern"&&C?Xl(Tt,p,k,ht,Nt):Hl(Tt,Nt)}else $=gt.indexBuffer,J=gt.segments,Q=C?Oo(Tt,p,k,ht):Fo(Tt);At.draw(p.context,F,d,p.stencilModeForClipping(lt),g,vi.disabled,Q,n.id,gt.layoutVertexBuffer,$,J,n.paint,p.transform.zoom,ut)}}function xs(p,e,n,c,d,g,v){let w=p.context,S=w.gl,C=n.paint.get("fill-extrusion-pattern"),k=C.constantOr(1),F=n.getCrossfadeParameters(),j=n.paint.get("fill-extrusion-opacity");for(let Q of c){let $=e.getTile(Q),J=$.getBucket(n);if(!J)continue;let lt=J.programConfigurations.get(n.id),ht=p.useProgram(k?"fillExtrusionPattern":"fillExtrusion",lt);k&&(p.context.activeTexture.set(S.TEXTURE0),$.imageAtlasTexture.bind(S.LINEAR,S.CLAMP_TO_EDGE),lt.updatePaintBuffers(F));let gt=C.constantOr(null);if(gt&&$.imageAtlas){let Tt=$.imageAtlas,Nt=Tt.patternPositions[gt.to.toString()],jt=Tt.patternPositions[gt.from.toString()];Nt&&jt&<.setConstantPatternPositions(Nt,jt)}let ut=p.translatePosMatrix(Q.posMatrix,$,n.paint.get("fill-extrusion-translate"),n.paint.get("fill-extrusion-translate-anchor")),At=n.paint.get("fill-extrusion-vertical-gradient"),Mt=k?Bo(ut,p,At,j,Q,F,$):Zl(ut,p,At,j);ht.draw(w,w.gl.TRIANGLES,d,g,v,vi.backCCW,Mt,n.id,J.layoutVertexBuffer,J.indexBuffer,J.segments,n.paint,p.transform.zoom,lt)}}function Ua(p,e,n,c,d,g){let v=p.context,w=v.gl,S=e.fbo;if(!S)return;let C=p.useProgram("hillshade");v.activeTexture.set(w.TEXTURE0),w.bindTexture(w.TEXTURE_2D,S.colorAttachment.get());let k=((F,j,Q)=>{let $=Q.paint.get("hillshade-shadow-color"),J=Q.paint.get("hillshade-highlight-color"),lt=Q.paint.get("hillshade-accent-color"),ht=Q.paint.get("hillshade-illumination-direction")*(Math.PI/180);Q.paint.get("hillshade-illumination-anchor")==="viewport"&&(ht-=F.transform.angle);let gt=!F.options.moving;return{u_matrix:F.transform.calculatePosMatrix(j.tileID.toUnwrapped(),gt),u_image:0,u_latrange:Ea(0,j.tileID),u_light:[Q.paint.get("hillshade-exaggeration"),ht],u_shadow:$,u_highlight:J,u_accent:lt}})(p,e,n);C.draw(v,w.TRIANGLES,c,d,g,vi.disabled,k,n.id,p.rasterBoundsBuffer,p.quadTriangleIndexBuffer,p.rasterBoundsSegments)}function Xr(p,e,n,c,d,g){let v=p.context,w=v.gl,S=e.dem;if(S&&S.data){let C=S.dim,k=S.stride,F=S.getPixels();if(v.activeTexture.set(w.TEXTURE1),v.pixelStoreUnpackPremultiplyAlpha.set(!1),e.demTexture=e.demTexture||p.getTileTexture(k),e.demTexture){let Q=e.demTexture;Q.update(F,{premultiply:!1}),Q.bind(w.NEAREST,w.CLAMP_TO_EDGE)}else e.demTexture=new Ot(v,F,w.RGBA,{premultiply:!1}),e.demTexture.bind(w.NEAREST,w.CLAMP_TO_EDGE);v.activeTexture.set(w.TEXTURE0);let j=e.fbo;if(!j){let Q=new Ot(v,{width:C,height:C,data:null},w.RGBA);Q.bind(w.LINEAR,w.CLAMP_TO_EDGE),j=e.fbo=v.createFramebuffer(C,C,!0),j.colorAttachment.set(Q.texture)}v.bindFramebuffer.set(j.framebuffer),v.viewport.set([0,0,C,C]),p.useProgram("hillshadePrepare").draw(v,w.TRIANGLES,c,d,g,vi.disabled,((Q,$)=>{let J=$.stride,lt=a.create();return a.ortho(lt,0,a.EXTENT,-a.EXTENT,0,0,1),a.translate(lt,lt,[0,-a.EXTENT,0]),{u_matrix:lt,u_image:1,u_dimension:[J,J],u_zoom:Q.overscaledZ,u_unpack:$.getUnpackVector()}})(e.tileID,S),n.id,p.rasterBoundsBuffer,p.quadTriangleIndexBuffer,p.rasterBoundsSegments),e.needsHillshadePrepare=!1}}function ah(p,e,n,c,d){let g=c.paint.get("raster-fade-duration");if(g>0){let v=a.exported.now(),w=(v-p.timeAdded)/g,S=e?(v-e.timeAdded)/g:-1,C=n.getSource(),k=d.coveringZoomLevel({tileSize:C.tileSize,roundZoom:C.roundZoom}),F=!e||Math.abs(e.tileID.overscaledZ-k)>Math.abs(p.tileID.overscaledZ-k),j=F&&p.refreshedUponExpiration?1:a.clamp(F?w:1-S,0,1);return p.refreshedUponExpiration&&w>=1&&(p.refreshedUponExpiration=!1),e?{opacity:1,mix:1-j}:{opacity:j,mix:0}}return{opacity:1,mix:0}}let oh=new a.Color(1,0,0,1),lh=new a.Color(0,1,0,1),vs=new a.Color(0,0,1,1),Va=new a.Color(1,0,1,1),rl=new a.Color(0,1,1,1);function hh(p,e,n,c){qa(p,0,e+n/2,p.transform.width,n,c)}function Ga(p,e,n,c){qa(p,e-n/2,0,n,p.transform.height,c)}function qa(p,e,n,c,d,g){let v=p.context,w=v.gl;w.enable(w.SCISSOR_TEST),w.scissor(e*p.pixelRatio,n*p.pixelRatio,c*p.pixelRatio,d*p.pixelRatio),v.clear({color:g}),w.disable(w.SCISSOR_TEST)}function ch(p,e,n){let c=p.context,d=c.gl,g=n.posMatrix,v=p.useProgram("debug"),w=Ye.disabled,S=li.disabled,C=p.colorModeForRenderPass(),k="$debug";c.activeTexture.set(d.TEXTURE0),p.emptyTexture.bind(d.LINEAR,d.CLAMP_TO_EDGE),v.draw(c,d.LINE_STRIP,w,S,C,vi.disabled,ms(g,a.Color.red),k,p.debugBuffer,p.tileBorderIndexBuffer,p.debugSegments);let F=e.getTileByID(n.key).latestRawTileData,j=Math.floor((F&&F.byteLength||0)/1024),Q=e.getTile(n).tileSize,$=512/Math.min(Q,512)*(n.overscaledZ/p.transform.zoom)*.5,J=n.canonical.toString();n.overscaledZ!==n.canonical.z&&(J+=` => ${n.overscaledZ}`),function(lt,ht){lt.initDebugOverlayCanvas();let gt=lt.debugOverlayCanvas,ut=lt.context.gl,At=lt.debugOverlayCanvas.getContext("2d");At.clearRect(0,0,gt.width,gt.height),At.shadowColor="white",At.shadowBlur=2,At.lineWidth=1.5,At.strokeStyle="white",At.textBaseline="top",At.font="bold 36px Open Sans, sans-serif",At.fillText(ht,5,5),At.strokeText(ht,5,5),lt.debugOverlayTexture.update(gt),lt.debugOverlayTexture.bind(ut.LINEAR,ut.CLAMP_TO_EDGE)}(p,`${J} ${j}kb`),v.draw(c,d.TRIANGLES,w,S,Me.alphaBlended,vi.disabled,ms(g,a.Color.transparent,$),k,p.debugBuffer,p.quadTriangleIndexBuffer,p.debugSegments)}let Ks={symbol:function(p,e,n,c,d){if(p.renderPass!=="translucent")return;let g=li.disabled,v=p.colorModeForRenderPass();n.layout.get("text-variable-anchor")&&function(w,S,C,k,F,j,Q){let $=S.transform,J=F==="map",lt=j==="map";for(let ht of w){let gt=k.getTile(ht),ut=gt.getBucket(C);if(!ut||!ut.text||!ut.text.segments.get().length)continue;let At=a.evaluateSizeForZoom(ut.textSizeData,$.zoom),Mt=gi(gt,1,S.transform.zoom),Tt=Ce(ht.posMatrix,lt,J,S.transform,Mt),Nt=C.layout.get("icon-text-fit")!=="none"&&ut.hasIconData();if(At){let jt=Math.pow(2,$.zoom-gt.tileID.overscaledZ);Ba(ut,J,lt,Q,$,Tt,ht.posMatrix,jt,At,Nt)}}}(c,p,n,e,n.layout.get("text-rotation-alignment"),n.layout.get("text-pitch-alignment"),d),n.paint.get("icon-opacity").constantOr(1)!==0&&Oa(p,e,n,c,!1,n.paint.get("icon-translate"),n.paint.get("icon-translate-anchor"),n.layout.get("icon-rotation-alignment"),n.layout.get("icon-pitch-alignment"),n.layout.get("icon-keep-upright"),g,v),n.paint.get("text-opacity").constantOr(1)!==0&&Oa(p,e,n,c,!0,n.paint.get("text-translate"),n.paint.get("text-translate-anchor"),n.layout.get("text-rotation-alignment"),n.layout.get("text-pitch-alignment"),n.layout.get("text-keep-upright"),g,v),e.map.showCollisionBoxes&&(tl(p,e,n,c,n.paint.get("text-translate"),n.paint.get("text-translate-anchor"),!0),tl(p,e,n,c,n.paint.get("icon-translate"),n.paint.get("icon-translate-anchor"),!1))},circle:function(p,e,n,c){if(p.renderPass!=="translucent")return;let d=n.paint.get("circle-opacity"),g=n.paint.get("circle-stroke-width"),v=n.paint.get("circle-stroke-opacity"),w=!n.layout.get("circle-sort-key").isConstant();if(d.constantOr(1)===0&&(g.constantOr(1)===0||v.constantOr(1)===0))return;let S=p.context,C=S.gl,k=p.depthModeForSublayer(0,Ye.ReadOnly),F=li.disabled,j=p.colorModeForRenderPass(),Q=[];for(let $=0;$<c.length;$++){let J=c[$],lt=e.getTile(J),ht=lt.getBucket(n);if(!ht)continue;let gt=ht.programConfigurations.get(n.id),ut={programConfiguration:gt,program:p.useProgram("circle",gt),layoutVertexBuffer:ht.layoutVertexBuffer,indexBuffer:ht.indexBuffer,uniformValues:Fn(p,J,lt,n)};if(w){let At=ht.segments.get();for(let Mt of At)Q.push({segments:new a.SegmentVector([Mt]),sortKey:Mt.sortKey,state:ut})}else Q.push({segments:ht.segments,sortKey:0,state:ut})}w&&Q.sort(($,J)=>$.sortKey-J.sortKey);for(let $ of Q){let{programConfiguration:J,program:lt,layoutVertexBuffer:ht,indexBuffer:gt,uniformValues:ut}=$.state;lt.draw(S,C.TRIANGLES,k,F,j,vi.disabled,ut,n.id,ht,gt,$.segments,n.paint,p.transform.zoom,J)}},heatmap:function(p,e,n,c){if(n.paint.get("heatmap-opacity")!==0)if(p.renderPass==="offscreen"){let d=p.context,g=d.gl,v=li.disabled,w=new Me([g.ONE,g.ONE],a.Color.transparent,[!0,!0,!0,!0]);(function(S,C,k){let F=S.gl;S.activeTexture.set(F.TEXTURE1),S.viewport.set([0,0,C.width/4,C.height/4]);let j=k.heatmapFbo;if(j)F.bindTexture(F.TEXTURE_2D,j.colorAttachment.get()),S.bindFramebuffer.set(j.framebuffer);else{let Q=F.createTexture();F.bindTexture(F.TEXTURE_2D,Q),F.texParameteri(F.TEXTURE_2D,F.TEXTURE_WRAP_S,F.CLAMP_TO_EDGE),F.texParameteri(F.TEXTURE_2D,F.TEXTURE_WRAP_T,F.CLAMP_TO_EDGE),F.texParameteri(F.TEXTURE_2D,F.TEXTURE_MIN_FILTER,F.LINEAR),F.texParameteri(F.TEXTURE_2D,F.TEXTURE_MAG_FILTER,F.LINEAR),j=k.heatmapFbo=S.createFramebuffer(C.width/4,C.height/4,!1),function($,J,lt,ht){let gt=$.gl;gt.texImage2D(gt.TEXTURE_2D,0,gt.RGBA,J.width/4,J.height/4,0,gt.RGBA,$.extRenderToTextureHalfFloat?$.extTextureHalfFloat.HALF_FLOAT_OES:gt.UNSIGNED_BYTE,null),ht.colorAttachment.set(lt)}(S,C,Q,j)}})(d,p,n),d.clear({color:a.Color.transparent});for(let S=0;S<c.length;S++){let C=c[S];if(e.hasRenderableParent(C))continue;let k=e.getTile(C),F=k.getBucket(n);if(!F)continue;let j=F.programConfigurations.get(n.id),Q=p.useProgram("heatmap",j),{zoom:$}=p.transform;Q.draw(d,g.TRIANGLES,Ye.disabled,v,w,vi.disabled,Ta(C.posMatrix,k,$,n.paint.get("heatmap-intensity")),n.id,F.layoutVertexBuffer,F.indexBuffer,F.segments,n.paint,p.transform.zoom,j)}d.viewport.set([0,0,p.width,p.height])}else p.renderPass==="translucent"&&(p.context.setColorMode(p.colorModeForRenderPass()),function(d,g){let v=d.context,w=v.gl,S=g.heatmapFbo;if(!S)return;v.activeTexture.set(w.TEXTURE0),w.bindTexture(w.TEXTURE_2D,S.colorAttachment.get()),v.activeTexture.set(w.TEXTURE1);let C=g.colorRampTexture;C||(C=g.colorRampTexture=new Ot(v,g.colorRamp,w.RGBA)),C.bind(w.LINEAR,w.CLAMP_TO_EDGE),d.useProgram("heatmapTexture").draw(v,w.TRIANGLES,Ye.disabled,li.disabled,d.colorModeForRenderPass(),vi.disabled,((k,F,j,Q)=>{let $=a.create();a.ortho($,0,k.width,k.height,0,0,1);let J=k.context.gl;return{u_matrix:$,u_world:[J.drawingBufferWidth,J.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:F.paint.get("heatmap-opacity")}})(d,g),g.id,d.viewportBuffer,d.quadTriangleIndexBuffer,d.viewportSegments,g.paint,d.transform.zoom)}(p,n))},line:function(p,e,n,c){if(p.renderPass!=="translucent")return;let d=n.paint.get("line-opacity"),g=n.paint.get("line-width");if(d.constantOr(1)===0||g.constantOr(1)===0)return;let v=p.depthModeForSublayer(0,Ye.ReadOnly),w=p.colorModeForRenderPass(),S=n.paint.get("line-dasharray"),C=n.paint.get("line-pattern"),k=C.constantOr(1),F=n.paint.get("line-gradient"),j=n.getCrossfadeParameters(),Q=k?"linePattern":S?"lineSDF":F?"lineGradient":"line",$=p.context,J=$.gl,lt=!0;for(let ht of c){let gt=e.getTile(ht);if(k&&!gt.patternsLoaded())continue;let ut=gt.getBucket(n);if(!ut)continue;let At=ut.programConfigurations.get(n.id),Mt=p.context.program.get(),Tt=p.useProgram(Q,At),Nt=lt||Tt.program!==Mt,jt=C.constantOr(null);if(jt&>.imageAtlas){let ie=gt.imageAtlas,Ht=ie.patternPositions[jt.to.toString()],ve=ie.patternPositions[jt.from.toString()];Ht&&ve&&At.setConstantPatternPositions(Ht,ve)}let It=k?Ws(p,gt,n,j):S?Ai(p,gt,n,S,j):F?Ia(p,gt,n,ut.lineClipsArray.length):$s(p,gt,n);if(k)$.activeTexture.set(J.TEXTURE0),gt.imageAtlasTexture.bind(J.LINEAR,J.CLAMP_TO_EDGE),At.updatePaintBuffers(j);else if(S&&(Nt||p.lineAtlas.dirty))$.activeTexture.set(J.TEXTURE0),p.lineAtlas.bind($);else if(F){let ie=ut.gradients[n.id],Ht=ie.texture;if(n.gradientVersion!==ie.version){let ve=256;if(n.stepInterpolant){let Fe=e.getSource().maxzoom,ke=ht.canonical.z===Fe?Math.ceil(1<<p.transform.maxZoom-ht.canonical.z):1;ve=a.clamp(a.nextPowerOfTwo(ut.maxLineLength/a.EXTENT*1024*ke),256,$.maxTextureSize)}ie.gradient=a.renderColorRamp({expression:n.gradientExpression(),evaluationKey:"lineProgress",resolution:ve,image:ie.gradient||void 0,clips:ut.lineClipsArray}),ie.texture?ie.texture.update(ie.gradient):ie.texture=new Ot($,ie.gradient,J.RGBA),ie.version=n.gradientVersion,Ht=ie.texture}$.activeTexture.set(J.TEXTURE0),Ht.bind(n.stepInterpolant?J.NEAREST:J.LINEAR,J.CLAMP_TO_EDGE)}Tt.draw($,J.TRIANGLES,v,p.stencilModeForClipping(ht),w,vi.disabled,It,n.id,ut.layoutVertexBuffer,ut.indexBuffer,ut.segments,n.paint,p.transform.zoom,At,ut.layoutVertexBuffer2),lt=!1}},fill:function(p,e,n,c){let d=n.paint.get("fill-color"),g=n.paint.get("fill-opacity");if(g.constantOr(1)===0)return;let v=p.colorModeForRenderPass(),w=n.paint.get("fill-pattern"),S=p.opaquePassEnabledForLayer()&&!w.constantOr(1)&&d.constantOr(a.Color.transparent).a===1&&g.constantOr(0)===1?"opaque":"translucent";if(p.renderPass===S){let C=p.depthModeForSublayer(1,p.renderPass==="opaque"?Ye.ReadWrite:Ye.ReadOnly);il(p,e,n,c,C,v,!1)}if(p.renderPass==="translucent"&&n.paint.get("fill-antialias")){let C=p.depthModeForSublayer(n.getPaintProperty("fill-outline-color")?2:0,Ye.ReadOnly);il(p,e,n,c,C,v,!0)}},"fill-extrusion":function(p,e,n,c){let d=n.paint.get("fill-extrusion-opacity");if(d!==0&&p.renderPass==="translucent"){let g=new Ye(p.context.gl.LEQUAL,Ye.ReadWrite,p.depthRangeFor3D);if(d!==1||n.paint.get("fill-extrusion-pattern").constantOr(1))xs(p,e,n,c,g,li.disabled,Me.disabled),xs(p,e,n,c,g,p.stencilModeFor3D(),p.colorModeForRenderPass());else{let v=p.colorModeForRenderPass();xs(p,e,n,c,g,li.disabled,v)}}},hillshade:function(p,e,n,c){if(p.renderPass!=="offscreen"&&p.renderPass!=="translucent")return;let d=p.context,g=p.depthModeForSublayer(0,Ye.ReadOnly),v=p.colorModeForRenderPass(),[w,S]=p.renderPass==="translucent"?p.stencilConfigForOverlap(c):[{},c];for(let C of S){let k=e.getTile(C);k.needsHillshadePrepare&&p.renderPass==="offscreen"?Xr(p,k,n,g,li.disabled,v):p.renderPass==="translucent"&&Ua(p,k,n,g,w[C.overscaledZ],v)}d.viewport.set([0,0,p.width,p.height])},raster:function(p,e,n,c){if(p.renderPass!=="translucent"||n.paint.get("raster-opacity")===0||!c.length)return;let d=p.context,g=d.gl,v=e.getSource(),w=p.useProgram("raster"),S=p.colorModeForRenderPass(),[C,k]=v instanceof Lr?[{},c]:p.stencilConfigForOverlap(c),F=k[k.length-1].overscaledZ,j=!p.options.moving;for(let Q of k){let $=p.depthModeForSublayer(Q.overscaledZ-F,n.paint.get("raster-opacity")===1?Ye.ReadWrite:Ye.ReadOnly,g.LESS),J=e.getTile(Q),lt=p.transform.calculatePosMatrix(Q.toUnwrapped(),j);J.registerFadeDuration(n.paint.get("raster-fade-duration"));let ht=e.findLoadedParent(Q,0),gt=ah(J,ht,e,n,p.transform),ut,At,Mt=n.paint.get("raster-resampling")==="nearest"?g.NEAREST:g.LINEAR;d.activeTexture.set(g.TEXTURE0),J.texture.bind(Mt,g.CLAMP_TO_EDGE,g.LINEAR_MIPMAP_NEAREST),d.activeTexture.set(g.TEXTURE1),ht?(ht.texture.bind(Mt,g.CLAMP_TO_EDGE,g.LINEAR_MIPMAP_NEAREST),ut=Math.pow(2,ht.tileID.overscaledZ-J.tileID.overscaledZ),At=[J.tileID.canonical.x*ut%1,J.tileID.canonical.y*ut%1]):J.texture.bind(Mt,g.CLAMP_TO_EDGE,g.LINEAR_MIPMAP_NEAREST);let Tt=Kl(lt,At||[0,0],ut||1,gt,n);v instanceof Lr?w.draw(d,g.TRIANGLES,$,li.disabled,S,vi.disabled,Tt,n.id,v.boundsBuffer,p.quadTriangleIndexBuffer,v.boundsSegments):w.draw(d,g.TRIANGLES,$,C[Q.overscaledZ],S,vi.disabled,Tt,n.id,p.rasterBoundsBuffer,p.quadTriangleIndexBuffer,p.rasterBoundsSegments)}},background:function(p,e,n){let c=n.paint.get("background-color"),d=n.paint.get("background-opacity");if(d===0)return;let g=p.context,v=g.gl,w=p.transform,S=w.tileSize,C=n.paint.get("background-pattern");if(p.isPatternMissing(C))return;let k=!C&&c.a===1&&d===1&&p.opaquePassEnabledForLayer()?"opaque":"translucent";if(p.renderPass!==k)return;let F=li.disabled,j=p.depthModeForSublayer(0,k==="opaque"?Ye.ReadWrite:Ye.ReadOnly),Q=p.colorModeForRenderPass(),$=p.useProgram(C?"backgroundPattern":"background"),J=w.coveringTiles({tileSize:S});C&&(g.activeTexture.set(v.TEXTURE0),p.imageManager.bind(p.context));let lt=n.getCrossfadeParameters();for(let ht of J){let gt=p.transform.calculatePosMatrix(ht.toUnwrapped()),ut=C?Vo(gt,d,p,C,{tileID:ht,tileSize:S},lt):Lc(gt,d,c);$.draw(g,v.TRIANGLES,j,F,Q,vi.disabled,ut,n.id,p.tileExtentBuffer,p.quadTriangleIndexBuffer,p.tileExtentSegments)}},debug:function(p,e,n){for(let c=0;c<n.length;c++)ch(p,e,n[c])},custom:function(p,e,n){let c=p.context,d=n.implementation;if(p.renderPass==="offscreen"){let g=d.prerender;g&&(p.setCustomLayerDefaults(),c.setColorMode(p.colorModeForRenderPass()),g.call(d,c.gl,p.transform.customLayerMatrix()),c.setDirty(),p.setBaseState())}else if(p.renderPass==="translucent"){p.setCustomLayerDefaults(),c.setColorMode(p.colorModeForRenderPass()),c.setStencilMode(li.disabled);let g=d.renderingMode==="3d"?new Ye(p.context.gl.LEQUAL,Ye.ReadWrite,p.depthRangeFor3D):p.depthModeForSublayer(0,Ye.ReadOnly);c.setDepthMode(g),d.render(c.gl,p.transform.customLayerMatrix()),c.setDirty(),p.setBaseState(),c.bindFramebuffer.set(null)}}};class nl{constructor(e,n){this.context=new La(e),this.transform=n,this._tileTextures={},this.setup(),this.numSublayers=Je.maxUnderzooming+Je.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Ee,this.gpuTimers={}}resize(e,n,c){if(this.width=e*c,this.height=n*c,this.pixelRatio=c,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(let d of this.style._order)this.style._layers[d].resize()}setup(){let e=this.context,n=new a.PosArray;n.emplaceBack(0,0),n.emplaceBack(a.EXTENT,0),n.emplaceBack(0,a.EXTENT),n.emplaceBack(a.EXTENT,a.EXTENT),this.tileExtentBuffer=e.createVertexBuffer(n,ko.members),this.tileExtentSegments=a.SegmentVector.simpleSegment(0,0,4,2);let c=new a.PosArray;c.emplaceBack(0,0),c.emplaceBack(a.EXTENT,0),c.emplaceBack(0,a.EXTENT),c.emplaceBack(a.EXTENT,a.EXTENT),this.debugBuffer=e.createVertexBuffer(c,ko.members),this.debugSegments=a.SegmentVector.simpleSegment(0,0,4,5);let d=new a.RasterBoundsArray;d.emplaceBack(0,0,0,0),d.emplaceBack(a.EXTENT,0,a.EXTENT,0),d.emplaceBack(0,a.EXTENT,0,a.EXTENT),d.emplaceBack(a.EXTENT,a.EXTENT,a.EXTENT,a.EXTENT),this.rasterBoundsBuffer=e.createVertexBuffer(d,kr.members),this.rasterBoundsSegments=a.SegmentVector.simpleSegment(0,0,4,2);let g=new a.PosArray;g.emplaceBack(0,0),g.emplaceBack(1,0),g.emplaceBack(0,1),g.emplaceBack(1,1),this.viewportBuffer=e.createVertexBuffer(g,ko.members),this.viewportSegments=a.SegmentVector.simpleSegment(0,0,4,2);let v=new a.LineStripIndexArray;v.emplaceBack(0),v.emplaceBack(1),v.emplaceBack(3),v.emplaceBack(2),v.emplaceBack(0),this.tileBorderIndexBuffer=e.createIndexBuffer(v);let w=new a.TriangleIndexArray;w.emplaceBack(0,1,2),w.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=e.createIndexBuffer(w),this.emptyTexture=new Ot(e,{width:1,height:1,data:new Uint8Array([0,0,0,0])},e.gl.RGBA);let S=this.context.gl;this.stencilClearMode=new li({func:S.ALWAYS,mask:0},0,255,S.ZERO,S.ZERO,S.ZERO)}clearStencil(){let e=this.context,n=e.gl;this.nextStencilID=1,this.currentStencilSource=void 0;let c=a.create();a.ortho(c,0,this.width,this.height,0,0,1),a.scale(c,c,[n.drawingBufferWidth,n.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(e,n.TRIANGLES,Ye.disabled,this.stencilClearMode,Me.disabled,vi.disabled,js(c),"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(e,n){if(this.currentStencilSource===e.source||!e.isTileClipped()||!n||!n.length)return;this.currentStencilSource=e.source;let c=this.context,d=c.gl;this.nextStencilID+n.length>256&&this.clearStencil(),c.setColorMode(Me.disabled),c.setDepthMode(Ye.disabled);let g=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(let v of n){let w=this._tileClippingMaskIDs[v.key]=this.nextStencilID++;g.draw(c,d.TRIANGLES,Ye.disabled,new li({func:d.ALWAYS,mask:0},w,255,d.KEEP,d.KEEP,d.REPLACE),Me.disabled,vi.disabled,js(v.posMatrix),"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();let e=this.nextStencilID++,n=this.context.gl;return new li({func:n.NOTEQUAL,mask:255},e,255,n.KEEP,n.KEEP,n.REPLACE)}stencilModeForClipping(e){let n=this.context.gl;return new li({func:n.EQUAL,mask:255},this._tileClippingMaskIDs[e.key],0,n.KEEP,n.KEEP,n.REPLACE)}stencilConfigForOverlap(e){let n=this.context.gl,c=e.sort((v,w)=>w.overscaledZ-v.overscaledZ),d=c[c.length-1].overscaledZ,g=c[0].overscaledZ-d+1;if(g>1){this.currentStencilSource=void 0,this.nextStencilID+g>256&&this.clearStencil();let v={};for(let w=0;w<g;w++)v[w+d]=new li({func:n.GEQUAL,mask:255},w+this.nextStencilID,255,n.KEEP,n.KEEP,n.REPLACE);return this.nextStencilID+=g,[v,c]}return[{[d]:li.disabled},c]}colorModeForRenderPass(){let e=this.context.gl;return this._showOverdrawInspector?new Me([e.CONSTANT_COLOR,e.ONE],new a.Color(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?Me.unblended:Me.alphaBlended}depthModeForSublayer(e,n,c){if(!this.opaquePassEnabledForLayer())return Ye.disabled;let d=1-((1+this.currentLayer)*this.numSublayers+e)*this.depthEpsilon;return new Ye(c||this.context.gl.LEQUAL,n,[d,d])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(e,n){this.style=e,this.options=n,this.lineAtlas=e.lineAtlas,this.imageManager=e.imageManager,this.glyphManager=e.glyphManager,this.symbolFadeChange=e.placement.symbolFadeChange(a.exported.now()),this.imageManager.beginFrame();let c=this.style._order,d=this.style.sourceCaches;for(let S in d){let C=d[S];C.used&&C.prepare(this.context)}let g={},v={},w={};for(let S in d){let C=d[S];g[S]=C.getVisibleCoordinates(),v[S]=g[S].slice().reverse(),w[S]=C.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let S=0;S<c.length;S++)if(this.style._layers[c[S]].is3D()){this.opaquePassCutoff=S;break}this.renderPass="offscreen";for(let S of c){let C=this.style._layers[S];if(!C.hasOffscreenPass()||C.isHidden(this.transform.zoom))continue;let k=v[C.source];(C.type==="custom"||k.length)&&this.renderLayer(this,d[C.source],C,k)}for(this.context.bindFramebuffer.set(null),this.context.clear({color:n.showOverdrawInspector?a.Color.black:a.Color.transparent,depth:1}),this.clearStencil(),this._showOverdrawInspector=n.showOverdrawInspector,this.depthRangeFor3D=[0,1-(e._order.length+2)*this.numSublayers*this.depthEpsilon],this.renderPass="opaque",this.currentLayer=c.length-1;this.currentLayer>=0;this.currentLayer--){let S=this.style._layers[c[this.currentLayer]],C=d[S.source],k=g[S.source];this._renderTileClippingMasks(S,k),this.renderLayer(this,C,S,k)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<c.length;this.currentLayer++){let S=this.style._layers[c[this.currentLayer]],C=d[S.source],k=(S.type==="symbol"?w:v)[S.source];this._renderTileClippingMasks(S,g[S.source]),this.renderLayer(this,C,S,k)}if(this.options.showTileBoundaries){let S,C;Object.values(this.style._layers).forEach(k=>{k.source&&!k.isHidden(this.transform.zoom)&&(k.source!==(C&&C.id)&&(C=this.style.sourceCaches[k.source]),(!S||S.getSource().maxzoom<C.getSource().maxzoom)&&(S=C))}),S&&Ks.debug(this,S,S.getVisibleCoordinates())}this.options.showPadding&&function(S){let C=S.transform.padding;hh(S,S.transform.height-(C.top||0),3,oh),hh(S,C.bottom||0,3,lh),Ga(S,C.left||0,3,vs),Ga(S,S.transform.width-(C.right||0),3,Va);let k=S.transform.centerPoint;(function(F,j,Q,$){qa(F,j-1,Q-10,2,20,$),qa(F,j-10,Q-1,20,2,$)})(S,k.x,S.transform.height-k.y,rl)}(this),this.context.setDefault()}renderLayer(e,n,c,d){c.isHidden(this.transform.zoom)||(c.type==="background"||c.type==="custom"||d.length)&&(this.id=c.id,this.gpuTimingStart(c),Ks[c.type](e,n,c,d,this.style.placement.variableOffsets),this.gpuTimingEnd())}gpuTimingStart(e){if(!this.options.gpuTiming)return;let n=this.context.extTimerQuery,c=this.gpuTimers[e.id];c||(c=this.gpuTimers[e.id]={calls:0,cpuTime:0,query:n.createQueryEXT()}),c.calls++,n.beginQueryEXT(n.TIME_ELAPSED_EXT,c.query)}gpuTimingEnd(){if(!this.options.gpuTiming)return;let e=this.context.extTimerQuery;e.endQueryEXT(e.TIME_ELAPSED_EXT)}collectGpuTimers(){let e=this.gpuTimers;return this.gpuTimers={},e}queryGpuTimers(e){let n={};for(let c in e){let d=e[c],g=this.context.extTimerQuery,v=g.getQueryObjectEXT(d.query,g.QUERY_RESULT_EXT)/1e6;g.deleteQueryEXT(d.query),n[c]=v}return n}translatePosMatrix(e,n,c,d,g){if(!c[0]&&!c[1])return e;let v=g?d==="map"?this.transform.angle:0:d==="viewport"?-this.transform.angle:0;if(v){let C=Math.sin(v),k=Math.cos(v);c=[c[0]*k-c[1]*C,c[0]*C+c[1]*k]}let w=[g?c[0]:gi(n,c[0],this.transform.zoom),g?c[1]:gi(n,c[1],this.transform.zoom),0],S=new Float32Array(16);return a.translate(S,e,w),S}saveTileTexture(e){let n=this._tileTextures[e.size[0]];n?n.push(e):this._tileTextures[e.size[0]]=[e]}getTileTexture(e){let n=this._tileTextures[e];return n&&n.length>0?n.pop():null}isPatternMissing(e){if(!e)return!1;if(!e.from||!e.to)return!0;let n=this.imageManager.getPattern(e.from.toString()),c=this.imageManager.getPattern(e.to.toString());return!n||!c}useProgram(e,n){this.cache=this.cache||{};let c=`${e}${n?n.cacheKey:""}${this._showOverdrawInspector?"/overdraw":""}`;return this.cache[c]||(this.cache[c]=new zc(this.context,e,Lo[e],n,Go[e],this._showOverdrawInspector)),this.cache[c]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){let e=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(e.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new Ot(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}}class ja{constructor(e,n){this.points=e,this.planes=n}static fromInvProjectionMatrix(e,n,c){let d=Math.pow(2,c),g=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map(w=>a.transformMat4([],w,e)).map(w=>a.scale$1([],w,1/w[3]/n*d)),v=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(w=>{let S=function(j,Q){var $=Q[0],J=Q[1],lt=Q[2],ht=$*$+J*J+lt*lt;return ht>0&&(ht=1/Math.sqrt(ht)),j[0]=Q[0]*ht,j[1]=Q[1]*ht,j[2]=Q[2]*ht,j}([],function(j,Q,$){var J=Q[0],lt=Q[1],ht=Q[2],gt=$[0],ut=$[1],At=$[2];return j[0]=lt*At-ht*ut,j[1]=ht*gt-J*At,j[2]=J*ut-lt*gt,j}([],Ft([],g[w[0]],g[w[1]]),Ft([],g[w[2]],g[w[1]]))),C=-((k=S)[0]*(F=g[w[1]])[0]+k[1]*F[1]+k[2]*F[2]);var k,F;return S.concat(C)});return new ja(g,v)}}class $a{constructor(e,n){this.min=e,this.max=n,this.center=function(c,d,g){return c[0]=.5*d[0],c[1]=.5*d[1],c[2]=.5*d[2],c}([],function(c,d,g){return c[0]=d[0]+g[0],c[1]=d[1]+g[1],c[2]=d[2]+g[2],c}([],this.min,this.max))}quadrant(e){let n=[e%2==0,e<2],c=ft(this.min),d=ft(this.max);for(let g=0;g<n.length;g++)c[g]=n[g]?this.min[g]:this.center[g],d[g]=n[g]?this.center[g]:this.max[g];return d[2]=this.max[2],new $a(c,d)}distanceX(e){return Math.max(Math.min(this.max[0],e[0]),this.min[0])-e[0]}distanceY(e){return Math.max(Math.min(this.max[1],e[1]),this.min[1])-e[1]}intersects(e){let n=[[this.min[0],this.min[1],0,1],[this.max[0],this.min[1],0,1],[this.max[0],this.max[1],0,1],[this.min[0],this.max[1],0,1]],c=!0;for(let d=0;d<e.planes.length;d++){let g=e.planes[d],v=0;for(let w=0;w<n.length;w++)a.dot(g,n[w])>=0&&v++;if(v===0)return 0;v!==n.length&&(c=!1)}if(c)return 2;for(let d=0;d<3;d++){let g=Number.MAX_VALUE,v=-Number.MAX_VALUE;for(let w=0;w<e.points.length;w++){let S=e.points[w][d]-this.min[d];g=Math.min(g,S),v=Math.max(v,S)}if(v<0||g>this.max[d]-this.min[d])return 0}return 1}}class bs{constructor(e=0,n=0,c=0,d=0){if(isNaN(e)||e<0||isNaN(n)||n<0||isNaN(c)||c<0||isNaN(d)||d<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=e,this.bottom=n,this.left=c,this.right=d}interpolate(e,n,c){return n.top!=null&&e.top!=null&&(this.top=a.number(e.top,n.top,c)),n.bottom!=null&&e.bottom!=null&&(this.bottom=a.number(e.bottom,n.bottom,c)),n.left!=null&&e.left!=null&&(this.left=a.number(e.left,n.left,c)),n.right!=null&&e.right!=null&&(this.right=a.number(e.right,n.right,c)),this}getCenter(e,n){let c=a.clamp((this.left+e-this.right)/2,0,e),d=a.clamp((this.top+n-this.bottom)/2,0,n);return new a.pointGeometry(c,d)}equals(e){return this.top===e.top&&this.bottom===e.bottom&&this.left===e.left&&this.right===e.right}clone(){return new bs(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}class Ys{constructor(e,n,c,d,g){this.tileSize=512,this.maxValidLatitude=85.051129,this._renderWorldCopies=g===void 0||!!g,this._minZoom=e||0,this._maxZoom=n||22,this._minPitch=c??0,this._maxPitch=d??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new a.LngLat(0,0),this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new bs,this._posMatrixCache={},this._alignedPosMatrixCache={}}clone(){let e=new Ys(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return e.tileSize=this.tileSize,e.latRange=this.latRange,e.width=this.width,e.height=this.height,e._center=this._center,e.zoom=this.zoom,e.angle=this.angle,e._fov=this._fov,e._pitch=this._pitch,e._unmodified=this._unmodified,e._edgeInsets=this._edgeInsets.clone(),e._calcMatrices(),e}get minZoom(){return this._minZoom}set minZoom(e){this._minZoom!==e&&(this._minZoom=e,this.zoom=Math.max(this.zoom,e))}get maxZoom(){return this._maxZoom}set maxZoom(e){this._maxZoom!==e&&(this._maxZoom=e,this.zoom=Math.min(this.zoom,e))}get minPitch(){return this._minPitch}set minPitch(e){this._minPitch!==e&&(this._minPitch=e,this.pitch=Math.max(this.pitch,e))}get maxPitch(){return this._maxPitch}set maxPitch(e){this._maxPitch!==e&&(this._maxPitch=e,this.pitch=Math.min(this.pitch,e))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(e){e===void 0?e=!0:e===null&&(e=!1),this._renderWorldCopies=e}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new a.pointGeometry(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(e){let n=-a.wrap(e,-180,180)*Math.PI/180;this.angle!==n&&(this._unmodified=!1,this.angle=n,this._calcMatrices(),this.rotationMatrix=function(){var c=new a.ARRAY_TYPE(4);return a.ARRAY_TYPE!=Float32Array&&(c[1]=0,c[2]=0),c[0]=1,c[3]=1,c}(),function(c,d,g){var v=d[0],w=d[1],S=d[2],C=d[3],k=Math.sin(g),F=Math.cos(g);c[0]=v*F+S*k,c[1]=w*F+C*k,c[2]=v*-k+S*F,c[3]=w*-k+C*F}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(e){let n=a.clamp(e,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==n&&(this._unmodified=!1,this._pitch=n,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(e){e=Math.max(.01,Math.min(60,e)),this._fov!==e&&(this._unmodified=!1,this._fov=e/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(e){let n=Math.min(Math.max(e,this.minZoom),this.maxZoom);this._zoom!==n&&(this._unmodified=!1,this._zoom=n,this.scale=this.zoomScale(n),this.tileZoom=Math.floor(n),this.zoomFraction=n-this.tileZoom,this._constrain(),this._calcMatrices())}get center(){return this._center}set center(e){e.lat===this._center.lat&&e.lng===this._center.lng||(this._unmodified=!1,this._center=e,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(e){this._edgeInsets.equals(e)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,e,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(e){return this._edgeInsets.equals(e)}interpolatePadding(e,n,c){this._unmodified=!1,this._edgeInsets.interpolate(e,n,c),this._constrain(),this._calcMatrices()}coveringZoomLevel(e){let n=(e.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/e.tileSize));return Math.max(0,n)}getVisibleUnwrappedCoordinates(e){let n=[new a.UnwrappedTileID(0,e)];if(this._renderWorldCopies){let c=this.pointCoordinate(new a.pointGeometry(0,0)),d=this.pointCoordinate(new a.pointGeometry(this.width,0)),g=this.pointCoordinate(new a.pointGeometry(this.width,this.height)),v=this.pointCoordinate(new a.pointGeometry(0,this.height)),w=Math.floor(Math.min(c.x,d.x,g.x,v.x)),S=Math.floor(Math.max(c.x,d.x,g.x,v.x)),C=1;for(let k=w-C;k<=S+C;k++)k!==0&&n.push(new a.UnwrappedTileID(k,e))}return n}coveringTiles(e){let n=this.coveringZoomLevel(e),c=n;if(e.minzoom!==void 0&&n<e.minzoom)return[];e.maxzoom!==void 0&&n>e.maxzoom&&(n=e.maxzoom);let d=a.MercatorCoordinate.fromLngLat(this.center),g=Math.pow(2,n),v=[g*d.x,g*d.y,0],w=ja.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,n),S=e.minzoom||0;this.pitch<=60&&this._edgeInsets.top<.1&&(S=n);let C=$=>({aabb:new $a([$*g,0,0],[($+1)*g,g,0]),zoom:0,x:0,y:0,wrap:$,fullyVisible:!1}),k=[],F=[],j=n,Q=e.reparseOverscaled?c:n;if(this._renderWorldCopies)for(let $=1;$<=3;$++)k.push(C(-$)),k.push(C($));for(k.push(C(0));k.length>0;){let $=k.pop(),J=$.x,lt=$.y,ht=$.fullyVisible;if(!ht){let Tt=$.aabb.intersects(w);if(Tt===0)continue;ht=Tt===2}let gt=$.aabb.distanceX(v),ut=$.aabb.distanceY(v),At=Math.max(Math.abs(gt),Math.abs(ut)),Mt=3+(1<<j-$.zoom)-2;if($.zoom===j||At>Mt&&$.zoom>=S)F.push({tileID:new a.OverscaledTileID($.zoom===j?Q:$.zoom,$.wrap,$.zoom,J,lt),distanceSq:kt([v[0]-.5-J,v[1]-.5-lt])});else for(let Tt=0;Tt<4;Tt++){let Nt=(J<<1)+Tt%2,jt=(lt<<1)+(Tt>>1);k.push({aabb:$.aabb.quadrant(Tt),zoom:$.zoom+1,x:Nt,y:jt,wrap:$.wrap,fullyVisible:ht})}}return F.sort(($,J)=>$.distanceSq-J.distanceSq).map($=>$.tileID)}resize(e,n){this.width=e,this.height=n,this.pixelsToGLUnits=[2/e,-2/n],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(e){return Math.pow(2,e)}scaleZoom(e){return Math.log(e)/Math.LN2}project(e){let n=a.clamp(e.lat,-this.maxValidLatitude,this.maxValidLatitude);return new a.pointGeometry(a.mercatorXfromLng(e.lng)*this.worldSize,a.mercatorYfromLat(n)*this.worldSize)}unproject(e){return new a.MercatorCoordinate(e.x/this.worldSize,e.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}setLocationAtPoint(e,n){let c=this.pointCoordinate(n),d=this.pointCoordinate(this.centerPoint),g=this.locationCoordinate(e),v=new a.MercatorCoordinate(g.x-(c.x-d.x),g.y-(c.y-d.y));this.center=this.coordinateLocation(v),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(e){return this.coordinatePoint(this.locationCoordinate(e))}pointLocation(e){return this.coordinateLocation(this.pointCoordinate(e))}locationCoordinate(e){return a.MercatorCoordinate.fromLngLat(e)}coordinateLocation(e){return e.toLngLat()}pointCoordinate(e){let n=[e.x,e.y,0,1],c=[e.x,e.y,1,1];a.transformMat4(n,n,this.pixelMatrixInverse),a.transformMat4(c,c,this.pixelMatrixInverse);let d=n[3],g=c[3],v=n[1]/d,w=c[1]/g,S=n[2]/d,C=c[2]/g,k=S===C?0:(0-S)/(C-S);return new a.MercatorCoordinate(a.number(n[0]/d,c[0]/g,k)/this.worldSize,a.number(v,w,k)/this.worldSize)}coordinatePoint(e){let n=[e.x*this.worldSize,e.y*this.worldSize,0,1];return a.transformMat4(n,n,this.pixelMatrix),new a.pointGeometry(n[0]/n[3],n[1]/n[3])}getBounds(){return new a.LngLatBounds().extend(this.pointLocation(new a.pointGeometry(0,0))).extend(this.pointLocation(new a.pointGeometry(this.width,0))).extend(this.pointLocation(new a.pointGeometry(this.width,this.height))).extend(this.pointLocation(new a.pointGeometry(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new a.LngLatBounds([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null}setMaxBounds(e){e?(this.lngRange=[e.getWest(),e.getEast()],this.latRange=[e.getSouth(),e.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-this.maxValidLatitude,this.maxValidLatitude])}calculatePosMatrix(e,n=!1){let c=e.key,d=n?this._alignedPosMatrixCache:this._posMatrixCache;if(d[c])return d[c];let g=e.canonical,v=this.worldSize/this.zoomScale(g.z),w=g.x+Math.pow(2,g.z)*e.wrap,S=a.identity(new Float64Array(16));return a.translate(S,S,[w*v,g.y*v,0]),a.scale(S,S,[v/a.EXTENT,v/a.EXTENT,1]),a.multiply(S,n?this.alignedProjMatrix:this.projMatrix,S),d[c]=new Float32Array(S),d[c]}customLayerMatrix(){return this.mercatorMatrix.slice()}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;let e,n,c,d,g=-90,v=90,w=-180,S=180,C=this.size,k=this._unmodified;if(this.latRange){let Q=this.latRange;g=a.mercatorYfromLat(Q[1])*this.worldSize,v=a.mercatorYfromLat(Q[0])*this.worldSize,e=v-g<C.y?C.y/(v-g):0}if(this.lngRange){let Q=this.lngRange;w=a.mercatorXfromLng(Q[0])*this.worldSize,S=a.mercatorXfromLng(Q[1])*this.worldSize,n=S-w<C.x?C.x/(S-w):0}let F=this.point,j=Math.max(n||0,e||0);if(j)return this.center=this.unproject(new a.pointGeometry(n?(S+w)/2:F.x,e?(v+g)/2:F.y)),this.zoom+=this.scaleZoom(j),this._unmodified=k,void(this._constraining=!1);if(this.latRange){let Q=F.y,$=C.y/2;Q-$<g&&(d=g+$),Q+$>v&&(d=v-$)}if(this.lngRange){let Q=F.x,$=C.x/2;Q-$<w&&(c=w+$),Q+$>S&&(c=S-$)}c===void 0&&d===void 0||(this.center=this.unproject(new a.pointGeometry(c!==void 0?c:F.x,d!==void 0?d:F.y))),this._unmodified=k,this._constraining=!1}_calcMatrices(){if(!this.height)return;let e=this.centerOffset;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height;let n=Math.PI/2+this._pitch,c=this._fov*(.5+e.y/this.height),d=Math.sin(c)*this.cameraToCenterDistance/Math.sin(a.clamp(Math.PI-n-c,.01,Math.PI-.01)),g=this.point,v=g.x,w=g.y,S=1.01*(Math.cos(Math.PI/2-this._pitch)*d+this.cameraToCenterDistance),C=this.height/50,k=new Float64Array(16);a.perspective(k,this._fov,this.width/this.height,C,S),k[8]=2*-e.x/this.width,k[9]=2*e.y/this.height,a.scale(k,k,[1,-1,1]),a.translate(k,k,[0,0,-this.cameraToCenterDistance]),a.rotateX(k,k,this._pitch),a.rotateZ(k,k,this.angle),a.translate(k,k,[-v,-w,0]),this.mercatorMatrix=a.scale([],k,[this.worldSize,this.worldSize,this.worldSize]),a.scale(k,k,[1,1,a.mercatorZfromAltitude(1,this.center.lat)*this.worldSize]),this.projMatrix=k,this.invProjMatrix=a.invert([],this.projMatrix);let F=this.width%2/2,j=this.height%2/2,Q=Math.cos(this.angle),$=Math.sin(this.angle),J=v-Math.round(v)+Q*F+$*j,lt=w-Math.round(w)+Q*j+$*F,ht=new Float64Array(k);if(a.translate(ht,ht,[J>.5?J-1:J,lt>.5?lt-1:lt,0]),this.alignedProjMatrix=ht,k=a.create(),a.scale(k,k,[this.width/2,-this.height/2,1]),a.translate(k,k,[1,-1,0]),this.labelPlaneMatrix=k,k=a.create(),a.scale(k,k,[1,-1,1]),a.translate(k,k,[-1,-1,0]),a.scale(k,k,[2/this.width,2/this.height,1]),this.glCoordMatrix=k,this.pixelMatrix=a.multiply(new Float64Array(16),this.labelPlaneMatrix,this.projMatrix),k=a.invert(new Float64Array(16),this.pixelMatrix),!k)throw new Error("failed to invert matrix");this.pixelMatrixInverse=k,this._posMatrixCache={},this._alignedPosMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;let e=this.pointCoordinate(new a.pointGeometry(0,0)),n=[e.x*this.worldSize,e.y*this.worldSize,0,1];return a.transformMat4(n,n,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){let e=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new a.pointGeometry(0,e))}getCameraQueryGeometry(e){let n=this.getCameraPoint();if(e.length===1)return[e[0],n];{let c=n.x,d=n.y,g=n.x,v=n.y;for(let w of e)c=Math.min(c,w.x),d=Math.min(d,w.y),g=Math.max(g,w.x),v=Math.max(v,w.y);return[new a.pointGeometry(c,d),new a.pointGeometry(g,d),new a.pointGeometry(g,v),new a.pointGeometry(c,v),new a.pointGeometry(c,d)]}}}class uh{constructor(e){this._hashName=e&&encodeURIComponent(e),a.bindAll(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=function(n,c){let d=!1,g=null,v=()=>{g=null,d&&(n(),g=setTimeout(v,300),d=!1)};return()=>(d=!0,g||v(),g)}(this._updateHashUnthrottled.bind(this))}addTo(e){return this._map=e,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),delete this._map,this}getHashString(e){let n=this._map.getCenter(),c=Math.round(100*this._map.getZoom())/100,d=Math.ceil((c*Math.LN2+Math.log(512/360/.5))/Math.LN10),g=Math.pow(10,d),v=Math.round(n.lng*g)/g,w=Math.round(n.lat*g)/g,S=this._map.getBearing(),C=this._map.getPitch(),k="";if(k+=e?`/${v}/${w}/${c}`:`${c}/${w}/${v}`,(S||C)&&(k+="/"+Math.round(10*S)/10),C&&(k+=`/${Math.round(C)}`),this._hashName){let F=this._hashName,j=!1,Q=window.location.hash.slice(1).split("&").map($=>{let J=$.split("=")[0];return J===F?(j=!0,`${J}=${k}`):$}).filter($=>$);return j||Q.push(`${F}=${k}`),`#${Q.join("&")}`}return`#${k}`}_getCurrentHash(){let e=window.location.hash.replace("#","");if(this._hashName){let n;return e.split("&").map(c=>c.split("=")).forEach(c=>{c[0]===this._hashName&&(n=c)}),(n&&n[1]||"").split("/")}return e.split("/")}_onHashChange(){let e=this._getCurrentHash();if(e.length>=3&&!e.some(n=>isNaN(n))){let n=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(e[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+e[2],+e[1]],zoom:+e[0],bearing:n,pitch:+(e[4]||0)}),!0}return!1}_updateHashUnthrottled(){let e=window.location.href.replace(/(#.+)?$/,this.getHashString());try{window.history.replaceState(window.history.state,null,e)}catch{}}}let Js={linearity:.3,easing:a.bezier(0,0,.3,1)},ph=a.extend({deceleration:2500,maxSpeed:1400},Js),dh=a.extend({deceleration:20,maxSpeed:1400},Js),fh=a.extend({deceleration:1e3,maxSpeed:360},Js),ws=a.extend({deceleration:1e3,maxSpeed:90},Js);class mh{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:a.exported.now(),settings:e})}_drainInertiaBuffer(){let e=this._inertiaBuffer,n=a.exported.now();for(;e.length>0&&n-e[0].time>160;)e.shift()}_onMoveEnd(e){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;let n={zoom:0,bearing:0,pitch:0,pan:new a.pointGeometry(0,0),pinchAround:void 0,around:void 0};for(let{settings:g}of this._inertiaBuffer)n.zoom+=g.zoomDelta||0,n.bearing+=g.bearingDelta||0,n.pitch+=g.pitchDelta||0,g.panDelta&&n.pan._add(g.panDelta),g.around&&(n.around=g.around),g.pinchAround&&(n.pinchAround=g.pinchAround);let c=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,d={};if(n.pan.mag()){let g=ta(n.pan.mag(),c,a.extend({},ph,e||{}));d.offset=n.pan.mult(g.amount/n.pan.mag()),d.center=this._map.transform.center,Qs(d,g)}if(n.zoom){let g=ta(n.zoom,c,dh);d.zoom=this._map.transform.zoom+g.amount,Qs(d,g)}if(n.bearing){let g=ta(n.bearing,c,fh);d.bearing=this._map.transform.bearing+a.clamp(g.amount,-179,179),Qs(d,g)}if(n.pitch){let g=ta(n.pitch,c,ws);d.pitch=this._map.transform.pitch+g.amount,Qs(d,g)}if(d.zoom||d.bearing){let g=n.pinchAround===void 0?n.around:n.pinchAround;d.around=g?this._map.unproject(g):this._map.getCenter()}return this.clear(),a.extend(d,{noMoveStart:!0})}}function Qs(p,e){(!p.duration||p.duration<e.duration)&&(p.duration=e.duration,p.easing=e.easing)}function ta(p,e,n){let{maxSpeed:c,linearity:d,deceleration:g}=n,v=a.clamp(p*d/(e/1e3),-c,c),w=Math.abs(v)/(g*d);return{easing:n.easing,duration:1e3*w,amount:v*(w/2)}}class xr extends a.Event{constructor(e,n,c,d={}){let g=L.mousePos(n.getCanvasContainer(),c),v=n.unproject(g);super(e,a.extend({point:g,lngLat:v,originalEvent:c},d)),this._defaultPrevented=!1,this.target=n}preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}}class lr extends a.Event{constructor(e,n,c){let d=e==="touchend"?c.changedTouches:c.touches,g=L.touchPos(n.getCanvasContainer(),d),v=g.map(S=>n.unproject(S)),w=g.reduce((S,C,k,F)=>S.add(C.div(F.length)),new a.pointGeometry(0,0));super(e,{points:g,point:w,lngLats:v,lngLat:n.unproject(w),originalEvent:c}),this._defaultPrevented=!1}preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}}class Gc extends a.Event{constructor(e,n,c){super(e,{originalEvent:c}),this._defaultPrevented=!1}preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}}class Un{constructor(e,n){this._map=e,this._clickTolerance=n.clickTolerance}reset(){delete this._mousedownPos}wheel(e){return this._firePreventable(new Gc(e.type,this._map,e))}mousedown(e,n){return this._mousedownPos=n,this._firePreventable(new xr(e.type,this._map,e))}mouseup(e){this._map.fire(new xr(e.type,this._map,e))}click(e,n){this._mousedownPos&&this._mousedownPos.dist(n)>=this._clickTolerance||this._map.fire(new xr(e.type,this._map,e))}dblclick(e){return this._firePreventable(new xr(e.type,this._map,e))}mouseover(e){this._map.fire(new xr(e.type,this._map,e))}mouseout(e){this._map.fire(new xr(e.type,this._map,e))}touchstart(e){return this._firePreventable(new lr(e.type,this._map,e))}touchmove(e){this._map.fire(new lr(e.type,this._map,e))}touchend(e){this._map.fire(new lr(e.type,this._map,e))}touchcancel(e){this._map.fire(new lr(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class gh{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,delete this._contextMenuEvent}mousemove(e){this._map.fire(new xr(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new xr("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._map.fire(new xr(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Ms{constructor(e,n){this._map=e,this._el=e.getCanvasContainer(),this._container=e.getContainer(),this._clickTolerance=n.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(e,n){this.isEnabled()&&e.shiftKey&&e.button===0&&(L.disableDrag(),this._startPos=this._lastPos=n,this._active=!0)}mousemoveWindow(e,n){if(!this._active)return;let c=n;if(this._lastPos.equals(c)||!this._box&&c.dist(this._startPos)<this._clickTolerance)return;let d=this._startPos;this._lastPos=c,this._box||(this._box=L.create("div","maplibregl-boxzoom mapboxgl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair","mapboxgl-crosshair"),this._fireEvent("boxzoomstart",e));let g=Math.min(d.x,c.x),v=Math.max(d.x,c.x),w=Math.min(d.y,c.y),S=Math.max(d.y,c.y);L.setTransform(this._box,`translate(${g}px,${w}px)`),this._box.style.width=v-g+"px",this._box.style.height=S-w+"px"}mouseupWindow(e,n){if(!this._active||e.button!==0)return;let c=this._startPos,d=n;if(this.reset(),L.suppressClick(),c.x!==d.x||c.y!==d.y)return this._map.fire(new a.Event("boxzoomend",{originalEvent:e})),{cameraAnimation:g=>g.fitScreenCoordinates(c,d,this._map.getBearing(),{linear:!0})};this._fireEvent("boxzoomcancel",e)}keydown(e){this._active&&e.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",e))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair","mapboxgl-crosshair"),this._box&&(L.remove(this._box),this._box=null),L.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(e,n){return this._map.fire(new a.Event(e,{originalEvent:n}))}}function Vn(p,e){let n={};for(let c=0;c<p.length;c++)n[p[c].identifier]=e[c];return n}class qc{constructor(e){this.reset(),this.numTouches=e.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(e,n,c){(this.centroid||c.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=e.timeStamp),c.length===this.numTouches&&(this.centroid=function(d){let g=new a.pointGeometry(0,0);for(let v of d)g._add(v);return g.div(d.length)}(n),this.touches=Vn(c,n)))}touchmove(e,n,c){if(this.aborted||!this.centroid)return;let d=Vn(c,n);for(let g in this.touches){let v=this.touches[g],w=d[g];(!w||w.dist(v)>30)&&(this.aborted=!0)}}touchend(e,n,c){if((!this.centroid||e.timeStamp-this.startTime>500)&&(this.aborted=!0),c.length===0){let d=!this.aborted&&this.centroid;if(this.reset(),d)return d}}}class sl{constructor(e){this.singleTap=new qc(e),this.numTaps=e.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(e,n,c){this.singleTap.touchstart(e,n,c)}touchmove(e,n,c){this.singleTap.touchmove(e,n,c)}touchend(e,n,c){let d=this.singleTap.touchend(e,n,c);if(d){let g=e.timeStamp-this.lastTime<500,v=!this.lastTap||this.lastTap.dist(d)<30;if(g&&v||this.reset(),this.count++,this.lastTime=e.timeStamp,this.lastTap=d,this.count===this.numTaps)return this.reset(),d}}}class jc{constructor(){this._zoomIn=new sl({numTouches:1,numTaps:2}),this._zoomOut=new sl({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(e,n,c){this._zoomIn.touchstart(e,n,c),this._zoomOut.touchstart(e,n,c)}touchmove(e,n,c){this._zoomIn.touchmove(e,n,c),this._zoomOut.touchmove(e,n,c)}touchend(e,n,c){let d=this._zoomIn.touchend(e,n,c),g=this._zoomOut.touchend(e,n,c);return d?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:v=>v.easeTo({duration:300,zoom:v.getZoom()+1,around:v.unproject(d)},{originalEvent:e})}):g?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:v=>v.easeTo({duration:300,zoom:v.getZoom()-1,around:v.unproject(g)},{originalEvent:e})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}let yh={0:1,2:2};class Gn{constructor(e){this.reset(),this._clickTolerance=e.clickTolerance||1}reset(){this._active=!1,this._moved=!1,delete this._lastPoint,delete this._eventButton}_correctButton(e,n){return!1}_move(e,n){return{}}mousedown(e,n){if(this._lastPoint)return;let c=L.mouseButton(e);this._correctButton(e,c)&&(this._lastPoint=n,this._eventButton=c)}mousemoveWindow(e,n){let c=this._lastPoint;if(c){if(e.preventDefault(),function(d,g){let v=yh[g];return d.buttons===void 0||(d.buttons&v)!==v}(e,this._eventButton))this.reset();else if(this._moved||!(n.dist(c)<this._clickTolerance))return this._moved=!0,this._lastPoint=n,this._move(c,n)}}mouseupWindow(e){this._lastPoint&&L.mouseButton(e)===this._eventButton&&(this._moved&&L.suppressClick(),this.reset())}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Ss extends Gn{mousedown(e,n){super.mousedown(e,n),this._lastPoint&&(this._active=!0)}_correctButton(e,n){return n===0&&!e.ctrlKey}_move(e,n){return{around:n,panDelta:n.sub(e)}}}class te extends Gn{_correctButton(e,n){return n===0&&e.ctrlKey||n===2}_move(e,n){let c=.8*(n.x-e.x);if(c)return this._active=!0,{bearingDelta:c}}contextmenu(e){e.preventDefault()}}class al extends Gn{_correctButton(e,n){return n===0&&e.ctrlKey||n===2}_move(e,n){let c=-.5*(n.y-e.y);if(c)return this._active=!0,{pitchDelta:c}}contextmenu(e){e.preventDefault()}}class ea{constructor(e){this._minTouches=1,this._clickTolerance=e.clickTolerance||1,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new a.pointGeometry(0,0)}touchstart(e,n,c){return this._calculateTransform(e,n,c)}touchmove(e,n,c){if(this._active&&!(c.length<this._minTouches))return e.preventDefault(),this._calculateTransform(e,n,c)}touchend(e,n,c){this._calculateTransform(e,n,c),this._active&&c.length<this._minTouches&&this.reset()}touchcancel(){this.reset()}_calculateTransform(e,n,c){c.length>0&&(this._active=!0);let d=Vn(c,n),g=new a.pointGeometry(0,0),v=new a.pointGeometry(0,0),w=0;for(let C in d){let k=d[C],F=this._touches[C];F&&(g._add(k),v._add(k.sub(F)),w++,d[C]=k)}if(this._touches=d,w<this._minTouches||!v.mag())return;let S=v.div(w);return this._sum._add(S),this._sum.mag()<this._clickTolerance?void 0:{around:g.div(w),panDelta:S}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class qn{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}_start(e){}_move(e,n,c){return{}}touchstart(e,n,c){this._firstTwoTouches||c.length<2||(this._firstTwoTouches=[c[0].identifier,c[1].identifier],this._start([n[0],n[1]]))}touchmove(e,n,c){if(!this._firstTwoTouches)return;e.preventDefault();let[d,g]=this._firstTwoTouches,v=ia(c,n,d),w=ia(c,n,g);if(!v||!w)return;let S=this._aroundCenter?null:v.add(w).div(2);return this._move([v,w],S,e)}touchend(e,n,c){if(!this._firstTwoTouches)return;let[d,g]=this._firstTwoTouches,v=ia(c,n,d),w=ia(c,n,g);v&&w||(this._active&&L.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(e){this._enabled=!0,this._aroundCenter=!!e&&e.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}function ia(p,e,n){for(let c=0;c<p.length;c++)if(p[c].identifier===n)return e[c]}function Zt(p,e){return Math.log(p/e)/Math.LN2}class ol extends qn{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(e){this._startDistance=this._distance=e[0].dist(e[1])}_move(e,n){let c=this._distance;if(this._distance=e[0].dist(e[1]),this._active||!(Math.abs(Zt(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:Zt(this._distance,c),pinchAround:n}}}function _h(p,e){return 180*p.angleWith(e)/Math.PI}class $c extends qn{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(e){this._startVector=this._vector=e[0].sub(e[1]),this._minDiameter=e[0].dist(e[1])}_move(e,n){let c=this._vector;if(this._vector=e[0].sub(e[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:_h(this._vector,c),pinchAround:n}}_isBelowThreshold(e){this._minDiameter=Math.min(this._minDiameter,e.mag());let n=25/(Math.PI*this._minDiameter)*360,c=_h(e,this._startVector);return Math.abs(c)<n}}function ra(p){return Math.abs(p.y)>Math.abs(p.x)}class xh extends qn{reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}_start(e){this._lastPoints=e,ra(e[0].sub(e[1]))&&(this._valid=!1)}_move(e,n,c){let d=e[0].sub(this._lastPoints[0]),g=e[1].sub(this._lastPoints[1]);if(this._valid=this.gestureBeginsVertically(d,g,c.timeStamp),this._valid)return this._lastPoints=e,this._active=!0,{pitchDelta:(d.y+g.y)/2*-.5}}gestureBeginsVertically(e,n,c){if(this._valid!==void 0)return this._valid;let d=e.mag()>=2,g=n.mag()>=2;if(!d&&!g)return;if(!d||!g)return this._firstMove===void 0&&(this._firstMove=c),c-this._firstMove<100&&void 0;let v=e.y>0==n.y>0;return ra(e)&&ra(n)&&v}}let vh={panStep:100,bearingStep:15,pitchStep:10};class Wc{constructor(){let e=vh;this._panStep=e.panStep,this._bearingStep=e.bearingStep,this._pitchStep=e.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;let n=0,c=0,d=0,g=0,v=0;switch(e.keyCode){case 61:case 107:case 171:case 187:n=1;break;case 189:case 109:case 173:n=-1;break;case 37:e.shiftKey?c=-1:(e.preventDefault(),g=-1);break;case 39:e.shiftKey?c=1:(e.preventDefault(),g=1);break;case 38:e.shiftKey?d=1:(e.preventDefault(),v=-1);break;case 40:e.shiftKey?d=-1:(e.preventDefault(),v=1);break;default:return}return this._rotationDisabled&&(c=0,d=0),{cameraAnimation:w=>{let S=w.getZoom();w.easeTo({duration:300,easeId:"keyboardHandler",easing:Zc,zoom:n?Math.round(S)+n*(e.shiftKey?2:1):S,bearing:w.getBearing()+c*this._bearingStep,pitch:w.getPitch()+d*this._pitchStep,offset:[-g*this._panStep,-v*this._panStep],center:w.getCenter()},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function Zc(p){return p*(2-p)}let Wa=4.000244140625;class ll{constructor(e,n){this._map=e,this._el=e.getCanvasContainer(),this._handler=n,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222,a.bindAll(["_onTimeout"],this)}setZoomRate(e){this._defaultZoomRate=e}setWheelZoomRate(e){this._wheelZoomRate=e}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(e){this.isEnabled()||(this._enabled=!0,this._aroundCenter=e&&e.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}wheel(e){if(!this.isEnabled())return;let n=e.deltaMode===WheelEvent.DOM_DELTA_LINE?40*e.deltaY:e.deltaY,c=a.exported.now(),d=c-(this._lastWheelEventTime||0);this._lastWheelEventTime=c,n!==0&&n%Wa==0?this._type="wheel":n!==0&&Math.abs(n)<4?this._type="trackpad":d>400?(this._type=null,this._lastValue=n,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(d*n)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,n+=this._lastValue)),e.shiftKey&&n&&(n/=4),this._type&&(this._lastWheelEvent=e,this._delta-=n,this._active||this._start(e)),e.preventDefault()}_onTimeout(e){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(e)}_start(e){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);let n=L.mousePos(this._el,e);this._around=a.LngLat.convert(this._aroundCenter?this._map.getCenter():this._map.unproject(n)),this._aroundPoint=this._map.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;let e=this._map.transform;if(this._delta!==0){let w=this._type==="wheel"&&Math.abs(this._delta)>Wa?this._wheelZoomRate:this._defaultZoomRate,S=2/(1+Math.exp(-Math.abs(this._delta*w)));this._delta<0&&S!==0&&(S=1/S);let C=typeof this._targetZoom=="number"?e.zoomScale(this._targetZoom):e.scale;this._targetZoom=Math.min(e.maxZoom,Math.max(e.minZoom,e.scaleZoom(C*S))),this._type==="wheel"&&(this._startZoom=e.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}let n=typeof this._targetZoom=="number"?this._targetZoom:e.zoom,c=this._startZoom,d=this._easing,g,v=!1;if(this._type==="wheel"&&c&&d){let w=Math.min((a.exported.now()-this._lastWheelEventTime)/200,1),S=d(w);g=a.number(c,n,S),w<1?this._frameId||(this._frameId=!0):v=!0}else g=n,v=!0;return this._active=!0,v&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!v,zoomDelta:g-e.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(e){let n=a.ease;if(this._prevEase){let c=this._prevEase,d=(a.exported.now()-c.start)/c.duration,g=c.easing(d+.01)-c.easing(d),v=.27/Math.sqrt(g*g+1e-4)*.01,w=Math.sqrt(.0729-v*v);n=a.bezier(v,w,.25,1)}return this._prevEase={start:a.exported.now(),duration:e,easing:n},n}reset(){this._active=!1}}class hl{constructor(e,n){this._clickZoom=e,this._tapZoom=n}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class cl{constructor(){this.reset()}reset(){this._active=!1}dblclick(e,n){return e.preventDefault(),{cameraAnimation:c=>{c.easeTo({duration:300,zoom:c.getZoom()+(e.shiftKey?-1:1),around:c.unproject(n)},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class hr{constructor(){this._tap=new sl({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,this._tap.reset()}touchstart(e,n,c){this._swipePoint||(this._tapTime&&e.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?c.length>0&&(this._swipePoint=n[0],this._swipeTouch=c[0].identifier):this._tap.touchstart(e,n,c))}touchmove(e,n,c){if(this._tapTime){if(this._swipePoint){if(c[0].identifier!==this._swipeTouch)return;let d=n[0],g=d.y-this._swipePoint.y;return this._swipePoint=d,e.preventDefault(),this._active=!0,{zoomDelta:g/128}}}else this._tap.touchmove(e,n,c)}touchend(e,n,c){this._tapTime?this._swipePoint&&c.length===0&&this.reset():this._tap.touchend(e,n,c)&&(this._tapTime=e.timeStamp)}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class En{constructor(e,n,c){this._el=e,this._mousePan=n,this._touchPan=c}enable(e){this._inertiaOptions=e||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan","mapboxgl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan","mapboxgl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class bh{constructor(e,n,c){this._pitchWithRotate=e.pitchWithRotate,this._mouseRotate=n,this._mousePitch=c}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class ul{constructor(e,n,c,d){this._el=e,this._touchZoom=n,this._touchRotate=c,this._tapDragZoom=d,this._rotationDisabled=!1,this._enabled=!0}enable(e){this._touchZoom.enable(e),this._rotationDisabled||this._touchRotate.enable(e),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate","mapboxgl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate","mapboxgl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}let Ts=p=>p.zoom||p.drag||p.pitch||p.rotate;class pl extends a.Event{}function Za(p){return p.panDelta&&p.panDelta.mag()||p.zoomDelta||p.bearingDelta||p.pitchDelta}class Br{constructor(e,n){this._map=e,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new mh(e),this._bearingSnap=n.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(n),a.bindAll(["handleEvent","handleWindowEvent"],this);let c=this._el;this._listeners=[[c,"touchstart",{passive:!0}],[c,"touchmove",{passive:!1}],[c,"touchend",void 0],[c,"touchcancel",void 0],[c,"mousedown",void 0],[c,"mousemove",void 0],[c,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[c,"mouseover",void 0],[c,"mouseout",void 0],[c,"dblclick",void 0],[c,"click",void 0],[c,"keydown",{capture:!1}],[c,"keyup",void 0],[c,"wheel",{passive:!1}],[c,"contextmenu",void 0],[window,"blur",void 0]];for(let[d,g,v]of this._listeners)L.addEventListener(d,g,d===document?this.handleWindowEvent:this.handleEvent,v)}destroy(){for(let[e,n,c]of this._listeners)L.removeEventListener(e,n,e===document?this.handleWindowEvent:this.handleEvent,c)}_addDefaultHandlers(e){let n=this._map,c=n.getCanvasContainer();this._add("mapEvent",new Un(n,e));let d=n.boxZoom=new Ms(n,e);this._add("boxZoom",d);let g=new jc,v=new cl;n.doubleClickZoom=new hl(v,g),this._add("tapZoom",g),this._add("clickZoom",v);let w=new hr;this._add("tapDragZoom",w);let S=n.touchPitch=new xh;this._add("touchPitch",S);let C=new te(e),k=new al(e);n.dragRotate=new bh(e,C,k),this._add("mouseRotate",C,["mousePitch"]),this._add("mousePitch",k,["mouseRotate"]);let F=new Ss(e),j=new ea(e);n.dragPan=new En(c,F,j),this._add("mousePan",F),this._add("touchPan",j,["touchZoom","touchRotate"]);let Q=new $c,$=new ol;n.touchZoomRotate=new ul(c,$,Q,w),this._add("touchRotate",Q,["touchPan","touchZoom"]),this._add("touchZoom",$,["touchPan","touchRotate"]);let J=n.scrollZoom=new ll(n,this);this._add("scrollZoom",J,["mousePan"]);let lt=n.keyboard=new Wc;this._add("keyboard",lt),this._add("blockableMapEvent",new gh(n));for(let ht of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])e.interactive&&e[ht]&&n[ht].enable(e[ht])}_add(e,n,c){this._handlers.push({handlerName:e,handler:n,allowed:c}),this._handlersById[e]=n}stop(e){if(!this._updatingCamera){for(let{handler:n}of this._handlers)n.reset();this._inertia.clear(),this._fireEvents({},{},e),this._changes=[]}}isActive(){for(let{handler:e}of this._handlers)if(e.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return Boolean(Ts(this._eventsInProgress))||this.isZooming()}_blockedByActive(e,n,c){for(let d in e)if(d!==c&&(!n||n.indexOf(d)<0))return!0;return!1}handleWindowEvent(e){this.handleEvent(e,`${e.type}Window`)}_getMapTouches(e){let n=[];for(let c of e)this._el.contains(c.target)&&n.push(c);return n}handleEvent(e,n){if(e.type==="blur")return void this.stop(!0);this._updatingCamera=!0;let c=e.type==="renderFrame"?void 0:e,d={needsRenderFrame:!1},g={},v={},w=e.touches,S=w?this._getMapTouches(w):void 0,C=S?L.touchPos(this._el,S):L.mousePos(this._el,e);for(let{handlerName:j,handler:Q,allowed:$}of this._handlers){if(!Q.isEnabled())continue;let J;this._blockedByActive(v,$,j)?Q.reset():Q[n||e.type]&&(J=Q[n||e.type](e,C,S),this.mergeHandlerResult(d,g,J,j,c),J&&J.needsRenderFrame&&this._triggerRenderFrame()),(J||Q.isActive())&&(v[j]=Q)}let k={};for(let j in this._previousActiveHandlers)v[j]||(k[j]=c);this._previousActiveHandlers=v,(Object.keys(k).length||Za(d))&&(this._changes.push([d,g,k]),this._triggerRenderFrame()),(Object.keys(v).length||Za(d))&&this._map._stop(!0),this._updatingCamera=!1;let{cameraAnimation:F}=d;F&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],F(this._map))}mergeHandlerResult(e,n,c,d,g){if(!c)return;a.extend(e,c);let v={handlerName:d,originalEvent:c.originalEvent||g};c.zoomDelta!==void 0&&(n.zoom=v),c.panDelta!==void 0&&(n.drag=v),c.pitchDelta!==void 0&&(n.pitch=v),c.bearingDelta!==void 0&&(n.rotate=v)}_applyChanges(){let e={},n={},c={};for(let[d,g,v]of this._changes)d.panDelta&&(e.panDelta=(e.panDelta||new a.pointGeometry(0,0))._add(d.panDelta)),d.zoomDelta&&(e.zoomDelta=(e.zoomDelta||0)+d.zoomDelta),d.bearingDelta&&(e.bearingDelta=(e.bearingDelta||0)+d.bearingDelta),d.pitchDelta&&(e.pitchDelta=(e.pitchDelta||0)+d.pitchDelta),d.around!==void 0&&(e.around=d.around),d.pinchAround!==void 0&&(e.pinchAround=d.pinchAround),d.noInertia&&(e.noInertia=d.noInertia),a.extend(n,g),a.extend(c,v);this._updateMapTransform(e,n,c),this._changes=[]}_updateMapTransform(e,n,c){let d=this._map,g=d.transform;if(!Za(e))return this._fireEvents(n,c,!0);let{panDelta:v,zoomDelta:w,bearingDelta:S,pitchDelta:C,around:k,pinchAround:F}=e;F!==void 0&&(k=F),d._stop(!0),k=k||d.transform.centerPoint;let j=g.pointLocation(v?k.sub(v):k);S&&(g.bearing+=S),C&&(g.pitch+=C),w&&(g.zoom+=w),g.setLocationAtPoint(j,k),this._map._update(),e.noInertia||this._inertia.record(e),this._fireEvents(n,c,!0)}_fireEvents(e,n,c){let d=Ts(this._eventsInProgress),g=Ts(e),v={};for(let k in e){let{originalEvent:F}=e[k];this._eventsInProgress[k]||(v[`${k}start`]=F),this._eventsInProgress[k]=e[k]}!d&&g&&this._fireEvent("movestart",g.originalEvent);for(let k in v)this._fireEvent(k,v[k]);g&&this._fireEvent("move",g.originalEvent);for(let k in e){let{originalEvent:F}=e[k];this._fireEvent(k,F)}let w={},S;for(let k in this._eventsInProgress){let{handlerName:F,originalEvent:j}=this._eventsInProgress[k];this._handlersById[F].isActive()||(delete this._eventsInProgress[k],S=n[F]||j,w[`${k}end`]=S)}for(let k in w)this._fireEvent(k,w[k]);let C=Ts(this._eventsInProgress);if(c&&(d||g)&&!C){this._updatingCamera=!0;let k=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),F=j=>j!==0&&-this._bearingSnap<j&&j<this._bearingSnap;k?(F(k.bearing||this._map.getBearing())&&(k.bearing=0),this._map.easeTo(k,{originalEvent:S})):(this._map.fire(new a.Event("moveend",{originalEvent:S})),F(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(e,n){this._map.fire(new a.Event(e,n?{originalEvent:n}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(e=>{delete this._frameId,this.handleEvent(new pl("renderFrame",{timeStamp:e})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}let hi={extend:(p,...e)=>a.extend(p,...e),run(p){p()},logToElement(p,e=!1,n="log"){let c=window.document.getElementById(n);c&&(e&&(c.innerHTML=""),c.innerHTML+=`<br>${p}`)}};class Ha extends a.Evented{constructor(e,n){super(),this._moving=!1,this._zooming=!1,this.transform=e,this._bearingSnap=n.bearingSnap,a.bindAll(["_renderFrameCallback"],this)}getCenter(){return new a.LngLat(this.transform.center.lng,this.transform.center.lat)}setCenter(e,n){return this.jumpTo({center:e},n)}panBy(e,n,c){return e=a.pointGeometry.convert(e).mult(-1),this.panTo(this.transform.center,a.extend({offset:e},n),c)}panTo(e,n,c){return this.easeTo(a.extend({center:e},n),c)}getZoom(){return this.transform.zoom}setZoom(e,n){return this.jumpTo({zoom:e},n),this}zoomTo(e,n,c){return this.easeTo(a.extend({zoom:e},n),c)}zoomIn(e,n){return this.zoomTo(this.getZoom()+1,e,n),this}zoomOut(e,n){return this.zoomTo(this.getZoom()-1,e,n),this}getBearing(){return this.transform.bearing}setBearing(e,n){return this.jumpTo({bearing:e},n),this}getPadding(){return this.transform.padding}setPadding(e,n){return this.jumpTo({padding:e},n),this}rotateTo(e,n,c){return this.easeTo(a.extend({bearing:e},n),c)}resetNorth(e,n){return this.rotateTo(0,a.extend({duration:1e3},e),n),this}resetNorthPitch(e,n){return this.easeTo(a.extend({bearing:0,pitch:0,duration:1e3},e),n),this}snapToNorth(e,n){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(e,n):this}getPitch(){return this.transform.pitch}setPitch(e,n){return this.jumpTo({pitch:e},n),this}cameraForBounds(e,n){e=a.LngLatBounds.convert(e);let c=n&&n.bearing||0;return this._cameraForBoxAndBearing(e.getNorthWest(),e.getSouthEast(),c,n)}_cameraForBoxAndBearing(e,n,c,d){let g={top:0,bottom:0,right:0,left:0};if(typeof(d=a.extend({padding:g,offset:[0,0],maxZoom:this.transform.maxZoom},d)).padding=="number"){let Mt=d.padding;d.padding={top:Mt,bottom:Mt,right:Mt,left:Mt}}d.padding=a.extend(g,d.padding);let v=this.transform,w=v.padding,S=v.project(a.LngLat.convert(e)),C=v.project(a.LngLat.convert(n)),k=S.rotate(-c*Math.PI/180),F=C.rotate(-c*Math.PI/180),j=new a.pointGeometry(Math.max(k.x,F.x),Math.max(k.y,F.y)),Q=new a.pointGeometry(Math.min(k.x,F.x),Math.min(k.y,F.y)),$=j.sub(Q),J=(v.width-(w.left+w.right+d.padding.left+d.padding.right))/$.x,lt=(v.height-(w.top+w.bottom+d.padding.top+d.padding.bottom))/$.y;if(lt<0||J<0)return void a.warnOnce("Map cannot fit within canvas with the given bounds, padding, and/or offset.");let ht=Math.min(v.scaleZoom(v.scale*Math.min(J,lt)),d.maxZoom),gt=a.pointGeometry.convert(d.offset),ut=new a.pointGeometry((d.padding.left-d.padding.right)/2,(d.padding.top-d.padding.bottom)/2).rotate(c*Math.PI/180),At=gt.add(ut).mult(v.scale/v.zoomScale(ht));return{center:v.unproject(S.add(C).div(2).sub(At)),zoom:ht,bearing:c}}fitBounds(e,n,c){return this._fitInternal(this.cameraForBounds(e,n),n,c)}fitScreenCoordinates(e,n,c,d,g){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(a.pointGeometry.convert(e)),this.transform.pointLocation(a.pointGeometry.convert(n)),c,d),d,g)}_fitInternal(e,n,c){return e?(delete(n=a.extend(e,n)).padding,n.linear?this.easeTo(n,c):this.flyTo(n,c)):this}jumpTo(e,n){this.stop();let c=this.transform,d=!1,g=!1,v=!1;return"zoom"in e&&c.zoom!==+e.zoom&&(d=!0,c.zoom=+e.zoom),e.center!==void 0&&(c.center=a.LngLat.convert(e.center)),"bearing"in e&&c.bearing!==+e.bearing&&(g=!0,c.bearing=+e.bearing),"pitch"in e&&c.pitch!==+e.pitch&&(v=!0,c.pitch=+e.pitch),e.padding==null||c.isPaddingEqual(e.padding)||(c.padding=e.padding),this.fire(new a.Event("movestart",n)).fire(new a.Event("move",n)),d&&this.fire(new a.Event("zoomstart",n)).fire(new a.Event("zoom",n)).fire(new a.Event("zoomend",n)),g&&this.fire(new a.Event("rotatestart",n)).fire(new a.Event("rotate",n)).fire(new a.Event("rotateend",n)),v&&this.fire(new a.Event("pitchstart",n)).fire(new a.Event("pitch",n)).fire(new a.Event("pitchend",n)),this.fire(new a.Event("moveend",n))}easeTo(e,n){this._stop(!1,e.easeId),((e=a.extend({offset:[0,0],duration:500,easing:a.ease},e)).animate===!1||!e.essential&&a.exported.prefersReducedMotion)&&(e.duration=0);let c=this.transform,d=this.getZoom(),g=this.getBearing(),v=this.getPitch(),w=this.getPadding(),S="zoom"in e?+e.zoom:d,C="bearing"in e?this._normalizeBearing(e.bearing,g):g,k="pitch"in e?+e.pitch:v,F="padding"in e?e.padding:c.padding,j=a.pointGeometry.convert(e.offset),Q=c.centerPoint.add(j),$=c.pointLocation(Q),J=a.LngLat.convert(e.center||$);this._normalizeCenter(J);let lt=c.project($),ht=c.project(J).sub(lt),gt=c.zoomScale(S-d),ut,At;e.around&&(ut=a.LngLat.convert(e.around),At=c.locationPoint(ut));let Mt={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||S!==d,this._rotating=this._rotating||g!==C,this._pitching=this._pitching||k!==v,this._padding=!c.isPaddingEqual(F),this._easeId=e.easeId,this._prepareEase(n,e.noMoveStart,Mt),this._ease(Tt=>{if(this._zooming&&(c.zoom=a.number(d,S,Tt)),this._rotating&&(c.bearing=a.number(g,C,Tt)),this._pitching&&(c.pitch=a.number(v,k,Tt)),this._padding&&(c.interpolatePadding(w,F,Tt),Q=c.centerPoint.add(j)),ut)c.setLocationAtPoint(ut,At);else{let Nt=c.zoomScale(c.zoom-d),jt=S>d?Math.min(2,gt):Math.max(.5,gt),It=Math.pow(jt,1-Tt),ie=c.unproject(lt.add(ht.mult(Tt*It)).mult(Nt));c.setLocationAtPoint(c.renderWorldCopies?ie.wrap():ie,Q)}this._fireMoveEvents(n)},Tt=>{this._afterEase(n,Tt)},e),this}_prepareEase(e,n,c={}){this._moving=!0,n||c.moving||this.fire(new a.Event("movestart",e)),this._zooming&&!c.zooming&&this.fire(new a.Event("zoomstart",e)),this._rotating&&!c.rotating&&this.fire(new a.Event("rotatestart",e)),this._pitching&&!c.pitching&&this.fire(new a.Event("pitchstart",e))}_fireMoveEvents(e){this.fire(new a.Event("move",e)),this._zooming&&this.fire(new a.Event("zoom",e)),this._rotating&&this.fire(new a.Event("rotate",e)),this._pitching&&this.fire(new a.Event("pitch",e))}_afterEase(e,n){if(this._easeId&&n&&this._easeId===n)return;delete this._easeId;let c=this._zooming,d=this._rotating,g=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,c&&this.fire(new a.Event("zoomend",e)),d&&this.fire(new a.Event("rotateend",e)),g&&this.fire(new a.Event("pitchend",e)),this.fire(new a.Event("moveend",e))}flyTo(e,n){if(!e.essential&&a.exported.prefersReducedMotion){let Re=a.pick(e,["center","zoom","bearing","pitch","around"]);return this.jumpTo(Re,n)}this.stop(),e=a.extend({offset:[0,0],speed:1.2,curve:1.42,easing:a.ease},e);let c=this.transform,d=this.getZoom(),g=this.getBearing(),v=this.getPitch(),w=this.getPadding(),S="zoom"in e?a.clamp(+e.zoom,c.minZoom,c.maxZoom):d,C="bearing"in e?this._normalizeBearing(e.bearing,g):g,k="pitch"in e?+e.pitch:v,F="padding"in e?e.padding:c.padding,j=c.zoomScale(S-d),Q=a.pointGeometry.convert(e.offset),$=c.centerPoint.add(Q),J=c.pointLocation($),lt=a.LngLat.convert(e.center||J);this._normalizeCenter(lt);let ht=c.project(J),gt=c.project(lt).sub(ht),ut=e.curve,At=Math.max(c.width,c.height),Mt=At/j,Tt=gt.mag();if("minZoom"in e){let Re=a.clamp(Math.min(e.minZoom,d,S),c.minZoom,c.maxZoom),yi=At/c.zoomScale(Re-d);ut=Math.sqrt(yi/Tt*2)}let Nt=ut*ut;function jt(Re){let yi=(Mt*Mt-At*At+(Re?-1:1)*Nt*Nt*Tt*Tt)/(2*(Re?Mt:At)*Nt*Tt);return Math.log(Math.sqrt(yi*yi+1)-yi)}function It(Re){return(Math.exp(Re)-Math.exp(-Re))/2}function ie(Re){return(Math.exp(Re)+Math.exp(-Re))/2}let Ht=jt(0),ve=function(Re){return ie(Ht)/ie(Ht+ut*Re)},Fe=function(Re){return At*((ie(Ht)*(It(yi=Ht+ut*Re)/ie(yi))-It(Ht))/Nt)/Tt;var yi},ke=(jt(1)-Ht)/ut;if(Math.abs(Tt)<1e-6||!isFinite(ke)){if(Math.abs(At-Mt)<1e-6)return this.easeTo(e,n);let Re=Mt<At?-1:1;ke=Math.abs(Math.log(Mt/At))/ut,Fe=function(){return 0},ve=function(yi){return Math.exp(Re*ut*yi)}}return e.duration="duration"in e?+e.duration:1e3*ke/("screenSpeed"in e?+e.screenSpeed/ut:+e.speed),e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=g!==C,this._pitching=k!==v,this._padding=!c.isPaddingEqual(F),this._prepareEase(n,!1),this._ease(Re=>{let yi=Re*ke,we=1/ve(yi);c.zoom=Re===1?S:d+c.scaleZoom(we),this._rotating&&(c.bearing=a.number(g,C,Re)),this._pitching&&(c.pitch=a.number(v,k,Re)),this._padding&&(c.interpolatePadding(w,F,Re),$=c.centerPoint.add(Q));let qe=Re===1?lt:c.unproject(ht.add(gt.mult(Fe(yi))).mult(we));c.setLocationAtPoint(c.renderWorldCopies?qe.wrap():qe,$),this._fireMoveEvents(n)},()=>this._afterEase(n),e),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(e,n){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){let c=this._onEaseEnd;delete this._onEaseEnd,c.call(this,n)}if(!e){let c=this.handlers;c&&c.stop(!1)}return this}_ease(e,n,c){c.animate===!1||c.duration===0?(e(1),n()):(this._easeStart=a.exported.now(),this._easeOptions=c,this._onEaseFrame=e,this._onEaseEnd=n,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){let e=Math.min((a.exported.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(e)),e<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(e,n){e=a.wrap(e,-180,180);let c=Math.abs(e-n);return Math.abs(e-360-n)<c&&(e-=360),Math.abs(e+360-n)<c&&(e+=360),e}_normalizeCenter(e){let n=this.transform;if(!n.renderWorldCopies||n.lngRange)return;let c=e.lng-n.center.lng;e.lng+=c>180?-360:c<-180?360:0}}class Xa{constructor(e={}){this.options=e,a.bindAll(["_toggleAttribution","_updateData","_updateCompact","_updateCompactMinimize"],this)}getDefaultPosition(){return"bottom-right"}onAdd(e){return this._map=e,this._compact=this.options&&this.options.compact,this._container=L.create("details","maplibregl-ctrl maplibregl-ctrl-attrib mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=L.create("summary","maplibregl-ctrl-attrib-button mapboxgl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=L.create("div","maplibregl-ctrl-attrib-inner mapboxgl-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._container}onRemove(){L.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(e,n){let c=this._map._getUIString(`AttributionControl.${n}`);e.title=c,e.setAttribute("aria-label",c)}_toggleAttribution(){this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show","mapboxgl-compact-show")):(this._container.classList.add("maplibregl-compact-show","mapboxgl-compact-show"),this._container.removeAttribute("open")))}_updateData(e){!e||e.sourceDataType!=="metadata"&&e.sourceDataType!=="visibility"&&e.dataType!=="style"||this._updateAttributions()}_updateAttributions(){if(!this._map.style)return;let e=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?e=e.concat(this.options.customAttribution.map(d=>typeof d!="string"?"":d)):typeof this.options.customAttribution=="string"&&e.push(this.options.customAttribution)),this._map.style.stylesheet){let d=this._map.style.stylesheet;this.styleOwner=d.owner,this.styleId=d.id}let n=this._map.style.sourceCaches;for(let d in n){let g=n[d];if(g.used){let v=g.getSource();v.attribution&&e.indexOf(v.attribution)<0&&e.push(v.attribution)}}e=e.filter(d=>String(d).trim()),e.sort((d,g)=>d.length-g.length),e=e.filter((d,g)=>{for(let v=g+1;v<e.length;v++)if(e[v].indexOf(d)>=0)return!1;return!0});let c=e.join(" | ");c!==this._attribHTML&&(this._attribHTML=c,e.length?(this._innerContainer.innerHTML=c,this._container.classList.remove("maplibregl-attrib-empty","mapboxgl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty","mapboxgl-attrib-empty"),this._updateCompact(),this._editLink=null)}_updateCompact(){this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact===!1?this._container.setAttribute("open",""):this._container.classList.contains("maplibregl-compact")||this._container.classList.contains("maplibregl-attrib-empty")||(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","mapboxgl-compact","maplibregl-compact-show","mapboxgl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show","mapboxgl-compact","mapboxgl-compact-show"))}_updateCompactMinimize(){this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show","mapboxgl-compact-show")}}class dl{constructor(e={}){this.options=e,a.bindAll(["_updateCompact"],this)}getDefaultPosition(){return"bottom-left"}onAdd(e){this._map=e,this._compact=this.options&&this.options.compact,this._container=L.create("div","maplibregl-ctrl mapboxgl-ctrl");let n=L.create("a","maplibregl-ctrl-logo mapboxgl-ctrl-logo");return n.target="_blank",n.rel="noopener nofollow",n.href="https://maplibre.org/",n.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),n.setAttribute("rel","noopener nofollow"),this._container.appendChild(n),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){L.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}_updateCompact(){let e=this._container.children;if(e.length){let n=e[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&n.classList.add("maplibregl-compact","mapboxgl-compact"):n.classList.remove("maplibregl-compact","mapboxgl-compact")}}}class wh{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(e){let n=++this._id;return this._queue.push({callback:e,id:n,cancelled:!1}),n}remove(e){let n=this._currentlyRunning,c=n?this._queue.concat(n):this._queue;for(let d of c)if(d.id===e)return void(d.cancelled=!0)}run(e=0){let n=this._currentlyRunning=this._queue;this._queue=[];for(let c of n)if(!c.cancelled&&(c.callback(e),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}let Mh={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"Mapbox logo","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm"},Hc={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,maplibreLogo:!1,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,maxTileCacheSize:null,localIdeographFontFamily:"sans-serif",transformRequest:null,fadeDuration:300,crossSourceCollisions:!0},an={showCompass:!0,showZoom:!0,visualizePitch:!1};class Ka{constructor(e,n,c=!1){this._clickTolerance=10,this.element=n,this.mouseRotate=new te({clickTolerance:e.dragRotate._mouseRotate._clickTolerance}),this.map=e,c&&(this.mousePitch=new al({clickTolerance:e.dragRotate._mousePitch._clickTolerance})),a.bindAll(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),L.addEventListener(n,"mousedown",this.mousedown),L.addEventListener(n,"touchstart",this.touchstart,{passive:!1}),L.addEventListener(n,"touchmove",this.touchmove),L.addEventListener(n,"touchend",this.touchend),L.addEventListener(n,"touchcancel",this.reset)}down(e,n){this.mouseRotate.mousedown(e,n),this.mousePitch&&this.mousePitch.mousedown(e,n),L.disableDrag()}move(e,n){let c=this.map,d=this.mouseRotate.mousemoveWindow(e,n);if(d&&d.bearingDelta&&c.setBearing(c.getBearing()+d.bearingDelta),this.mousePitch){let g=this.mousePitch.mousemoveWindow(e,n);g&&g.pitchDelta&&c.setPitch(c.getPitch()+g.pitchDelta)}}off(){let e=this.element;L.removeEventListener(e,"mousedown",this.mousedown),L.removeEventListener(e,"touchstart",this.touchstart,{passive:!1}),L.removeEventListener(e,"touchmove",this.touchmove),L.removeEventListener(e,"touchend",this.touchend),L.removeEventListener(e,"touchcancel",this.reset),this.offTemp()}offTemp(){L.enableDrag(),L.removeEventListener(window,"mousemove",this.mousemove),L.removeEventListener(window,"mouseup",this.mouseup)}mousedown(e){this.down(a.extend({},e,{ctrlKey:!0,preventDefault:()=>e.preventDefault()}),L.mousePos(this.element,e)),L.addEventListener(window,"mousemove",this.mousemove),L.addEventListener(window,"mouseup",this.mouseup)}mousemove(e){this.move(e,L.mousePos(this.element,e))}mouseup(e){this.mouseRotate.mouseupWindow(e),this.mousePitch&&this.mousePitch.mouseupWindow(e),this.offTemp()}touchstart(e){e.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=L.touchPos(this.element,e.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:()=>e.preventDefault()},this._startPos))}touchmove(e){e.targetTouches.length!==1?this.reset():(this._lastPos=L.touchPos(this.element,e.targetTouches)[0],this.move({preventDefault:()=>e.preventDefault()},this._lastPos))}touchend(e){e.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),this.reset()}reset(){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()}}function se(p,e,n){if(p=new a.LngLat(p.lng,p.lat),e){let c=new a.LngLat(p.lng-360,p.lat),d=new a.LngLat(p.lng+360,p.lat),g=n.locationPoint(p).distSqr(e);n.locationPoint(c).distSqr(e)<g?p=c:n.locationPoint(d).distSqr(e)<g&&(p=d)}for(;Math.abs(p.lng-n.center.lng)>180;){let c=n.locationPoint(p);if(c.x>=0&&c.y>=0&&c.x<=n.width&&c.y<=n.height)break;p.lng>n.center.lng?p.lng-=360:p.lng+=360}return p}let de={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"};function na(p,e,n){let c=p.classList;for(let d in de)c.remove(`maplibregl-${n}-anchor-${d}`,`mapboxgl-${n}-anchor-${d}`);c.add(`maplibregl-${n}-anchor-${e}`,`mapboxgl-${n}-anchor-${e}`)}class sa extends a.Evented{constructor(e,n){if(super(),(e instanceof HTMLElement||n)&&(e=a.extend({element:e},n)),a.bindAll(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress"],this),this._anchor=e&&e.anchor||"center",this._color=e&&e.color||"#3FB1CE",this._scale=e&&e.scale||1,this._draggable=e&&e.draggable||!1,this._clickTolerance=e&&e.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=e&&e.rotation||0,this._rotationAlignment=e&&e.rotationAlignment||"auto",this._pitchAlignment=e&&e.pitchAlignment&&e.pitchAlignment!=="auto"?e.pitchAlignment:this._rotationAlignment,e&&e.element)this._element=e.element,this._offset=a.pointGeometry.convert(e&&e.offset||[0,0]);else{this._defaultMarker=!0,this._element=L.create("div"),this._element.setAttribute("aria-label","Map marker");let c=L.createNS("http://www.w3.org/2000/svg","svg"),d=41,g=27;c.setAttributeNS(null,"display","block"),c.setAttributeNS(null,"height",`${d}px`),c.setAttributeNS(null,"width",`${g}px`),c.setAttributeNS(null,"viewBox",`0 0 ${g} ${d}`);let v=L.createNS("http://www.w3.org/2000/svg","g");v.setAttributeNS(null,"stroke","none"),v.setAttributeNS(null,"stroke-width","1"),v.setAttributeNS(null,"fill","none"),v.setAttributeNS(null,"fill-rule","evenodd");let w=L.createNS("http://www.w3.org/2000/svg","g");w.setAttributeNS(null,"fill-rule","nonzero");let S=L.createNS("http://www.w3.org/2000/svg","g");S.setAttributeNS(null,"transform","translate(3.0, 29.0)"),S.setAttributeNS(null,"fill","#000000");let C=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(let gt of C){let ut=L.createNS("http://www.w3.org/2000/svg","ellipse");ut.setAttributeNS(null,"opacity","0.04"),ut.setAttributeNS(null,"cx","10.5"),ut.setAttributeNS(null,"cy","5.80029008"),ut.setAttributeNS(null,"rx",gt.rx),ut.setAttributeNS(null,"ry",gt.ry),S.appendChild(ut)}let k=L.createNS("http://www.w3.org/2000/svg","g");k.setAttributeNS(null,"fill",this._color);let F=L.createNS("http://www.w3.org/2000/svg","path");F.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),k.appendChild(F);let j=L.createNS("http://www.w3.org/2000/svg","g");j.setAttributeNS(null,"opacity","0.25"),j.setAttributeNS(null,"fill","#000000");let Q=L.createNS("http://www.w3.org/2000/svg","path");Q.setAttributeNS(null,"d","M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"),j.appendChild(Q);let $=L.createNS("http://www.w3.org/2000/svg","g");$.setAttributeNS(null,"transform","translate(6.0, 7.0)"),$.setAttributeNS(null,"fill","#FFFFFF");let J=L.createNS("http://www.w3.org/2000/svg","g");J.setAttributeNS(null,"transform","translate(8.0, 8.0)");let lt=L.createNS("http://www.w3.org/2000/svg","circle");lt.setAttributeNS(null,"fill","#000000"),lt.setAttributeNS(null,"opacity","0.25"),lt.setAttributeNS(null,"cx","5.5"),lt.setAttributeNS(null,"cy","5.5"),lt.setAttributeNS(null,"r","5.4999962");let ht=L.createNS("http://www.w3.org/2000/svg","circle");ht.setAttributeNS(null,"fill","#FFFFFF"),ht.setAttributeNS(null,"cx","5.5"),ht.setAttributeNS(null,"cy","5.5"),ht.setAttributeNS(null,"r","5.4999962"),J.appendChild(lt),J.appendChild(ht),w.appendChild(S),w.appendChild(k),w.appendChild(j),w.appendChild($),w.appendChild(J),c.appendChild(w),c.setAttributeNS(null,"height",d*this._scale+"px"),c.setAttributeNS(null,"width",g*this._scale+"px"),this._element.appendChild(c),this._offset=a.pointGeometry.convert(e&&e.offset||[0,-14])}this._element.classList.add("maplibregl-marker","mapboxgl-marker"),this._element.addEventListener("dragstart",c=>{c.preventDefault()}),this._element.addEventListener("mousedown",c=>{c.preventDefault()}),na(this._element,this._anchor,"marker"),this._popup=null}addTo(e){return this.remove(),this._map=e,e.getCanvasContainer().appendChild(this._element),e.on("move",this._update),e.on("moveend",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),L.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=a.LngLat.convert(e),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(e){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),e){if(!("offset"in e.options)){let d=Math.sqrt(Math.pow(13.5,2)/2);e.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[d,-1*(38.1-13.5+d)],"bottom-right":[-d,-1*(38.1-13.5+d)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=e,this._lngLat&&this._popup.setLngLat(this._lngLat),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}_onKeyPress(e){let n=e.code,c=e.charCode||e.keyCode;n!=="Space"&&n!=="Enter"&&c!==32&&c!==13||this.togglePopup()}_onMapClick(e){let n=e.originalEvent.target,c=this._element;this._popup&&(n===c||c.contains(n))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){let e=this._popup;return e?(e.isOpen()?e.remove():e.addTo(this._map),this):this}_update(e){if(!this._map)return;this._map.transform.renderWorldCopies&&(this._lngLat=se(this._lngLat,this._pos,this._map.transform)),this._pos=this._map.project(this._lngLat)._add(this._offset);let n="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?n=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(n=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let c="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?c="rotateX(0deg)":this._pitchAlignment==="map"&&(c=`rotateX(${this._map.getPitch()}deg)`),e&&e.type!=="moveend"||(this._pos=this._pos.round()),L.setTransform(this._element,`${de[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${c} ${n}`)}getOffset(){return this._offset}setOffset(e){return this._offset=a.pointGeometry.convert(e),this._update(),this}_onMove(e){if(!this._isDragging){let n=this._clickTolerance||this._map._clickTolerance;this._isDragging=e.point.dist(this._pointerdownPos)>=n}this._isDragging&&(this._pos=e.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new a.Event("dragstart"))),this.fire(new a.Event("drag")))}_onUp(){this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._state==="active"&&this.fire(new a.Event("dragend")),this._state="inactive"}_addDragHandler(e){this._element.contains(e.originalEvent.target)&&(e.preventDefault(),this._positionDelta=e.point.sub(this._pos).add(this._offset),this._pointerdownPos=e.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))}setDraggable(e){return this._draggable=!!e,this._map&&(e?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(e){return this._rotation=e||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(e){return this._rotationAlignment=e||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(e){return this._pitchAlignment=e&&e!=="auto"?e:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}}let fl={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0},Oi,jn=0,cr=!1,Xc={maxWidth:100,unit:"metric"};function aa(p,e,n){let c=n&&n.maxWidth||100,d=p._container.clientHeight/2,g=p.unproject([0,d]),v=p.unproject([c,d]),w=g.distanceTo(v);if(n&&n.unit==="imperial"){let S=3.2808*w;S>5280?oi(e,c,S/5280,p._getUIString("ScaleControl.Miles")):oi(e,c,S,p._getUIString("ScaleControl.Feet"))}else n&&n.unit==="nautical"?oi(e,c,w/1852,p._getUIString("ScaleControl.NauticalMiles")):w>=1e3?oi(e,c,w/1e3,p._getUIString("ScaleControl.Kilometers")):oi(e,c,w,p._getUIString("ScaleControl.Meters"))}function oi(p,e,n,c){let d=function(g){let v=Math.pow(10,`${Math.floor(g)}`.length-1),w=g/v;return w=w>=10?10:w>=5?5:w>=3?3:w>=2?2:w>=1?1:function(S){let C=Math.pow(10,Math.ceil(-Math.log(S)/Math.LN10));return Math.round(S*C)/C}(w),v*w}(n);p.style.width=e*(d/n)+"px",p.innerHTML=`${d} ${c}`}let Ni={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},Sh=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Es(p){if(p){if(typeof p=="number"){let e=Math.round(Math.sqrt(.5*Math.pow(p,2)));return{center:new a.pointGeometry(0,0),top:new a.pointGeometry(0,p),"top-left":new a.pointGeometry(e,e),"top-right":new a.pointGeometry(-e,e),bottom:new a.pointGeometry(0,-p),"bottom-left":new a.pointGeometry(e,-e),"bottom-right":new a.pointGeometry(-e,-e),left:new a.pointGeometry(p,0),right:new a.pointGeometry(-p,0)}}if(p instanceof a.pointGeometry||Array.isArray(p)){let e=a.pointGeometry.convert(p);return{center:e,top:e,"top-left":e,"top-right":e,bottom:e,"bottom-left":e,"bottom-right":e,left:e,right:e}}return{center:a.pointGeometry.convert(p.center||[0,0]),top:a.pointGeometry.convert(p.top||[0,0]),"top-left":a.pointGeometry.convert(p["top-left"]||[0,0]),"top-right":a.pointGeometry.convert(p["top-right"]||[0,0]),bottom:a.pointGeometry.convert(p.bottom||[0,0]),"bottom-left":a.pointGeometry.convert(p["bottom-left"]||[0,0]),"bottom-right":a.pointGeometry.convert(p["bottom-right"]||[0,0]),left:a.pointGeometry.convert(p.left||[0,0]),right:a.pointGeometry.convert(p.right||[0,0])}}return Es(new a.pointGeometry(0,0))}let oa={supported:T,setRTLTextPlugin:a.setRTLTextPlugin,getRTLTextPluginStatus:a.getRTLTextPluginStatus,Map:class extends Ha{constructor(p){var e;if(a.PerformanceUtils.mark(a.PerformanceMarkers.create),(p=a.extend({},Hc,p)).minZoom!=null&&p.maxZoom!=null&&p.minZoom>p.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(p.minPitch!=null&&p.maxPitch!=null&&p.minPitch>p.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(p.minPitch!=null&&p.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(p.maxPitch!=null&&p.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new Ys(p.minZoom,p.maxZoom,p.minPitch,p.maxPitch,p.renderWorldCopies),{bearingSnap:p.bearingSnap}),this._interactive=p.interactive,this._maxTileCacheSize=p.maxTileCacheSize,this._failIfMajorPerformanceCaveat=p.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=p.preserveDrawingBuffer,this._antialias=p.antialias,this._trackResize=p.trackResize,this._bearingSnap=p.bearingSnap,this._refreshExpiredTiles=p.refreshExpiredTiles,this._fadeDuration=p.fadeDuration,this._crossSourceCollisions=p.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=p.collectResourceTiming,this._renderTaskQueue=new wh,this._controls=[],this._mapId=a.uniqueId(),this._locale=a.extend({},Mh,p.locale),this._clickTolerance=p.clickTolerance,this._pixelRatio=(e=p.pixelRatio)!==null&&e!==void 0?e:devicePixelRatio,this._requestManager=new tt(p.transformRequest),typeof p.container=="string"){if(this._container=document.getElementById(p.container),!this._container)throw new Error(`Container '${p.container}' not found.`)}else{if(!(p.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=p.container}if(p.maxBounds&&this.setMaxBounds(p.maxBounds),a.bindAll(["_onWindowOnline","_onWindowResize","_onMapScroll","_contextLost","_contextRestored"],this),this._setupContainer(),this._setupPainter(),this.painter===void 0)throw new Error("Failed to initialize WebGL.");this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),typeof window<"u"&&(addEventListener("online",this._onWindowOnline,!1),addEventListener("resize",this._onWindowResize,!1),addEventListener("orientationchange",this._onWindowResize,!1)),this.handlers=new Br(this,p),this._hash=p.hash&&new uh(typeof p.hash=="string"&&p.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:p.center,zoom:p.zoom,bearing:p.bearing,pitch:p.pitch}),p.bounds&&(this.resize(),this.fitBounds(p.bounds,a.extend({},p.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=p.localIdeographFontFamily,p.style&&this.setStyle(p.style,{localIdeographFontFamily:p.localIdeographFontFamily}),p.attributionControl&&this.addControl(new Xa({customAttribution:p.customAttribution})),p.maplibreLogo&&this.addControl(new dl,p.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",n=>{this._update(n.dataType==="style"),this.fire(new a.Event(`${n.dataType}data`,n))}),this.on("dataloading",n=>{this.fire(new a.Event(`${n.dataType}dataloading`,n))}),this.on("dataabort",n=>{this.fire(new a.Event("sourcedataabort",n))})}_getMapId(){return this._mapId}addControl(p,e){if(e===void 0&&(e=p.getDefaultPosition?p.getDefaultPosition():"top-right"),!p||!p.onAdd)return this.fire(new a.ErrorEvent(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));let n=p.onAdd(this);this._controls.push(p);let c=this._controlPositions[e];return e.indexOf("bottom")!==-1?c.insertBefore(n,c.firstChild):c.appendChild(n),this}removeControl(p){if(!p||!p.onRemove)return this.fire(new a.ErrorEvent(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));let e=this._controls.indexOf(p);return e>-1&&this._controls.splice(e,1),p.onRemove(this),this}hasControl(p){return this._controls.indexOf(p)>-1}resize(p){let e=this._containerDimensions(),n=e[0],c=e[1];this._resizeCanvas(n,c,this.getPixelRatio()),this.transform.resize(n,c),this.painter.resize(n,c,this.getPixelRatio());let d=!this._moving;return d&&(this.stop(),this.fire(new a.Event("movestart",p)).fire(new a.Event("move",p))),this.fire(new a.Event("resize",p)),d&&this.fire(new a.Event("moveend",p)),this}getPixelRatio(){return this._pixelRatio}setPixelRatio(p){let[e,n]=this._containerDimensions();this._pixelRatio=p,this._resizeCanvas(e,n,p),this.painter.resize(e,n,p)}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(p){return this.transform.setMaxBounds(a.LngLatBounds.convert(p)),this._update()}setMinZoom(p){if((p=p??-2)>=-2&&p<=this.transform.maxZoom)return this.transform.minZoom=p,this._update(),this.getZoom()<p&&this.setZoom(p),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(p){if((p=p??22)>=this.transform.minZoom)return this.transform.maxZoom=p,this._update(),this.getZoom()>p&&this.setZoom(p),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(p){if((p=p??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(p>=0&&p<=this.transform.maxPitch)return this.transform.minPitch=p,this._update(),this.getPitch()<p&&this.setPitch(p),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(p){if((p=p??60)>85)throw new Error("maxPitch must be less than or equal to 85");if(p>=this.transform.minPitch)return this.transform.maxPitch=p,this._update(),this.getPitch()>p&&this.setPitch(p),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(p){return this.transform.renderWorldCopies=p,this._update()}project(p){return this.transform.locationPoint(a.LngLat.convert(p))}unproject(p){return this.transform.pointLocation(a.pointGeometry.convert(p))}isMoving(){return this._moving||this.handlers.isMoving()}isZooming(){return this._zooming||this.handlers.isZooming()}isRotating(){return this._rotating||this.handlers.isRotating()}_createDelegatedListener(p,e,n){if(p==="mouseenter"||p==="mouseover"){let c=!1;return{layer:e,listener:n,delegates:{mousemove:g=>{let v=this.getLayer(e)?this.queryRenderedFeatures(g.point,{layers:[e]}):[];v.length?c||(c=!0,n.call(this,new xr(p,this,g.originalEvent,{features:v}))):c=!1},mouseout:()=>{c=!1}}}}if(p==="mouseleave"||p==="mouseout"){let c=!1;return{layer:e,listener:n,delegates:{mousemove:v=>{(this.getLayer(e)?this.queryRenderedFeatures(v.point,{layers:[e]}):[]).length?c=!0:c&&(c=!1,n.call(this,new xr(p,this,v.originalEvent)))},mouseout:v=>{c&&(c=!1,n.call(this,new xr(p,this,v.originalEvent)))}}}}{let c=d=>{let g=this.getLayer(e)?this.queryRenderedFeatures(d.point,{layers:[e]}):[];g.length&&(d.features=g,n.call(this,d),delete d.features)};return{layer:e,listener:n,delegates:{[p]:c}}}}on(p,e,n){if(n===void 0)return super.on(p,e);let c=this._createDelegatedListener(p,e,n);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[p]=this._delegatedListeners[p]||[],this._delegatedListeners[p].push(c);for(let d in c.delegates)this.on(d,c.delegates[d]);return this}once(p,e,n){if(n===void 0)return super.once(p,e);let c=this._createDelegatedListener(p,e,n);for(let d in c.delegates)this.once(d,c.delegates[d]);return this}off(p,e,n){return n===void 0?super.off(p,e):(this._delegatedListeners&&this._delegatedListeners[p]&&(c=>{let d=this._delegatedListeners[p];for(let g=0;g<d.length;g++){let v=d[g];if(v.layer===e&&v.listener===n){for(let w in v.delegates)this.off(w,v.delegates[w]);return d.splice(g,1),this}}})(),this)}queryRenderedFeatures(p,e){if(!this.style)return[];let n;if(e!==void 0||p===void 0||p instanceof a.pointGeometry||Array.isArray(p)||(e=p,p=void 0),e=e||{},(p=p||[[0,0],[this.transform.width,this.transform.height]])instanceof a.pointGeometry||typeof p[0]=="number")n=[a.pointGeometry.convert(p)];else{let c=a.pointGeometry.convert(p[0]),d=a.pointGeometry.convert(p[1]);n=[c,new a.pointGeometry(d.x,c.y),d,new a.pointGeometry(c.x,d.y),c]}return this.style.queryRenderedFeatures(n,e,this.transform)}querySourceFeatures(p,e){return this.style.querySourceFeatures(p,e)}setStyle(p,e){return(e=a.extend({},{localIdeographFontFamily:this._localIdeographFontFamily},e)).diff!==!1&&e.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&p?(this._diffStyle(p,e),this):(this._localIdeographFontFamily=e.localIdeographFontFamily,this._updateStyle(p,e))}setTransformRequest(p){return this._requestManager.setTransformRequest(p),this}_getUIString(p){let e=this._locale[p];if(e==null)throw new Error(`Missing UI string '${p}'`);return e}_updateStyle(p,e){return this.style&&(this.style.setEventedParent(null),this.style._remove()),p?(this.style=new Wi(this,e||{}),this.style.setEventedParent(this,{style:this.style}),typeof p=="string"?this.style.loadURL(p):this.style.loadJSON(p),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new Wi(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(p,e){if(typeof p=="string"){let n=this._requestManager.transformRequest(p,a.ResourceType.Style);a.getJSON(n,(c,d)=>{c?this.fire(new a.ErrorEvent(c)):d&&this._updateDiff(d,e)})}else typeof p=="object"&&this._updateDiff(p,e)}_updateDiff(p,e){try{this.style.setState(p)&&this._update(!0)}catch(n){a.warnOnce(`Unable to perform style diff: ${n.message||n.error||n}. Rebuilding the style from scratch.`),this._updateStyle(p,e)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():a.warnOnce("There is no style added to the map.")}addSource(p,e){return this._lazyInitEmptyStyle(),this.style.addSource(p,e),this._update(!0)}isSourceLoaded(p){let e=this.style&&this.style.sourceCaches[p];if(e!==void 0)return e.loaded();this.fire(new a.ErrorEvent(new Error(`There is no source with ID '${p}'`)))}areTilesLoaded(){let p=this.style&&this.style.sourceCaches;for(let e in p){let n=p[e]._tiles;for(let c in n){let d=n[c];if(d.state!=="loaded"&&d.state!=="errored")return!1}}return!0}addSourceType(p,e,n){return this._lazyInitEmptyStyle(),this.style.addSourceType(p,e,n)}removeSource(p){return this.style.removeSource(p),this._update(!0)}getSource(p){return this.style.getSource(p)}addImage(p,e,{pixelRatio:n=1,sdf:c=!1,stretchX:d,stretchY:g,content:v}={}){if(this._lazyInitEmptyStyle(),e instanceof HTMLImageElement||a.isImageBitmap(e)){let{width:w,height:S,data:C}=a.exported.getImageData(e);this.style.addImage(p,{data:new a.RGBAImage({width:w,height:S},C),pixelRatio:n,stretchX:d,stretchY:g,content:v,sdf:c,version:0})}else{if(e.width===void 0||e.height===void 0)return this.fire(new a.ErrorEvent(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{let{width:w,height:S,data:C}=e,k=e;this.style.addImage(p,{data:new a.RGBAImage({width:w,height:S},new Uint8Array(C)),pixelRatio:n,stretchX:d,stretchY:g,content:v,sdf:c,version:0,userImage:k}),k.onAdd&&k.onAdd(this,p)}}}updateImage(p,e){let n=this.style.getImage(p);if(!n)return this.fire(new a.ErrorEvent(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));let c=e instanceof HTMLImageElement||a.isImageBitmap(e)?a.exported.getImageData(e):e,{width:d,height:g,data:v}=c;if(d===void 0||g===void 0)return this.fire(new a.ErrorEvent(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(d!==n.data.width||g!==n.data.height)return this.fire(new a.ErrorEvent(new Error("The width and height of the updated image must be that same as the previous version of the image")));let w=!(e instanceof HTMLImageElement||a.isImageBitmap(e));n.data.replace(v,w),this.style.updateImage(p,n)}hasImage(p){return p?!!this.style.getImage(p):(this.fire(new a.ErrorEvent(new Error("Missing required image id"))),!1)}removeImage(p){this.style.removeImage(p)}loadImage(p,e){a.getImage(this._requestManager.transformRequest(p,a.ResourceType.Image),e)}listImages(){return this.style.listImages()}addLayer(p,e){return this._lazyInitEmptyStyle(),this.style.addLayer(p,e),this._update(!0)}moveLayer(p,e){return this.style.moveLayer(p,e),this._update(!0)}removeLayer(p){return this.style.removeLayer(p),this._update(!0)}getLayer(p){return this.style.getLayer(p)}setLayerZoomRange(p,e,n){return this.style.setLayerZoomRange(p,e,n),this._update(!0)}setFilter(p,e,n={}){return this.style.setFilter(p,e,n),this._update(!0)}getFilter(p){return this.style.getFilter(p)}setPaintProperty(p,e,n,c={}){return this.style.setPaintProperty(p,e,n,c),this._update(!0)}getPaintProperty(p,e){return this.style.getPaintProperty(p,e)}setLayoutProperty(p,e,n,c={}){return this.style.setLayoutProperty(p,e,n,c),this._update(!0)}getLayoutProperty(p,e){return this.style.getLayoutProperty(p,e)}setLight(p,e={}){return this._lazyInitEmptyStyle(),this.style.setLight(p,e),this._update(!0)}getLight(){return this.style.getLight()}setFeatureState(p,e){return this.style.setFeatureState(p,e),this._update()}removeFeatureState(p,e){return this.style.removeFeatureState(p,e),this._update()}getFeatureState(p){return this.style.getFeatureState(p)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let p=0,e=0;return this._container&&(p=this._container.clientWidth||400,e=this._container.clientHeight||300),[p,e]}_setupContainer(){let p=this._container;p.classList.add("maplibregl-map","mapboxgl-map");let e=this._canvasContainer=L.create("div","maplibregl-canvas-container mapboxgl-canvas-container",p);this._interactive&&e.classList.add("maplibregl-interactive","mapboxgl-interactive"),this._canvas=L.create("canvas","maplibregl-canvas mapboxgl-canvas",e),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex","0"),this._canvas.setAttribute("aria-label","Map"),this._canvas.setAttribute("role","region");let n=this._containerDimensions();this._resizeCanvas(n[0],n[1],this.getPixelRatio());let c=this._controlContainer=L.create("div","maplibregl-control-container mapboxgl-control-container",p),d=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(g=>{d[g]=L.create("div",`maplibregl-ctrl-${g} mapboxgl-ctrl-${g}`,c)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(p,e,n){this._canvas.width=n*p,this._canvas.height=n*e,this._canvas.style.width=`${p}px`,this._canvas.style.height=`${e}px`}_setupPainter(){let p=a.extend({},T.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),e=this._canvas.getContext("webgl",p)||this._canvas.getContext("experimental-webgl",p);e?(this.painter=new nl(e,this.transform),a.exported$1.testSupport(e)):this.fire(new a.ErrorEvent(new Error("Failed to initialize WebGL")))}_contextLost(p){p.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new a.Event("webglcontextlost",{originalEvent:p}))}_contextRestored(p){this._setupPainter(),this.resize(),this._update(),this.fire(new a.Event("webglcontextrestored",{originalEvent:p}))}_onMapScroll(p){if(p.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(p){return this.style?(this._styleDirty=this._styleDirty||p,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(p){return this._update(),this._renderTaskQueue.add(p)}_cancelRenderFrame(p){this._renderTaskQueue.remove(p)}_render(p){let e,n=0,c=this.painter.context.extTimerQuery;if(this.listens("gpu-timing-frame")&&(e=c.createQueryEXT(),c.beginQueryEXT(c.TIME_ELAPSED_EXT,e),n=a.exported.now()),this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(p),this._removed)return;let d=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;let v=this.transform.zoom,w=a.exported.now();this.style.zoomHistory.update(v,w);let S=new a.EvaluationParameters(v,{now:w,fadeDuration:this._fadeDuration,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),C=S.crossFadingFactor();C===1&&C===this._crossFadingFactor||(d=!0,this._crossFadingFactor=C),this.style.update(S)}if(this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,this._fadeDuration,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:this._fadeDuration,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer")}),this.fire(new a.Event("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,a.PerformanceUtils.mark(a.PerformanceMarkers.load),this.fire(new a.Event("load"))),this.style&&(this.style.hasTransitions()||d)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),this.listens("gpu-timing-frame")){let v=a.exported.now()-n;c.endQueryEXT(c.TIME_ELAPSED_EXT,e),setTimeout(()=>{let w=c.getQueryObjectEXT(e,c.QUERY_RESULT_EXT)/1e6;c.deleteQueryEXT(e),this.fire(new a.Event("gpu-timing-frame",{cpuTime:v,gpuTime:w}))},50)}if(this.listens("gpu-timing-layer")){let v=this.painter.collectGpuTimers();setTimeout(()=>{let w=this.painter.queryGpuTimers(v);this.fire(new a.Event("gpu-timing-layer",{layerTimes:w}))},50)}let g=this._sourcesDirty||this._styleDirty||this._placementDirty;return g||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new a.Event("idle")),!this._loaded||this._fullyLoaded||g||(this._fullyLoaded=!0,a.PerformanceUtils.mark(a.PerformanceMarkers.fullLoad)),this}redraw(){return this.style&&(this._frame&&(this._frame.cancel(),this._frame=null),this._render(0)),this}remove(){this._hash&&this._hash.remove();for(let e of this._controls)e.onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&(removeEventListener("resize",this._onWindowResize,!1),removeEventListener("orientationchange",this._onWindowResize,!1),removeEventListener("online",this._onWindowOnline,!1));let p=this.painter.context.gl.getExtension("WEBGL_lose_context");p&&p.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),L.remove(this._canvasContainer),L.remove(this._controlContainer),this._container.classList.remove("maplibregl-map","mapboxgl-map"),a.PerformanceUtils.clearMetrics(),this._removed=!0,this.fire(new a.Event("remove"))}triggerRepaint(){this.style&&!this._frame&&(this._frame=a.exported.frame(p=>{a.PerformanceUtils.frame(p),this._frame=null,this._render(p)}))}_onWindowOnline(){this._update()}_onWindowResize(p){this._trackResize&&this.resize({originalEvent:p})._update()}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(p){this._showTileBoundaries!==p&&(this._showTileBoundaries=p,this._update())}get showPadding(){return!!this._showPadding}set showPadding(p){this._showPadding!==p&&(this._showPadding=p,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(p){this._showCollisionBoxes!==p&&(this._showCollisionBoxes=p,p?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(p){this._showOverdrawInspector!==p&&(this._showOverdrawInspector=p,this._update())}get repaint(){return!!this._repaint}set repaint(p){this._repaint!==p&&(this._repaint=p,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(p){this._vertices=p,this._update()}_setCacheLimits(p,e){a.setCacheLimits(p,e)}},NavigationControl:class{constructor(p){this.options=a.extend({},an,p),this._container=L.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",e=>e.preventDefault()),this.options.showZoom&&(a.bindAll(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in mapboxgl-ctrl-zoom-in",e=>this._map.zoomIn({},{originalEvent:e})),L.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out mapboxgl-ctrl-zoom-out",e=>this._map.zoomOut({},{originalEvent:e})),L.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(a.bindAll(["_rotateCompassArrow"],this),this._compass=this._createButton("maplibregl-ctrl-compass mapboxgl-ctrl-compass",e=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:e}):this._map.resetNorth({},{originalEvent:e})}),this._compassIcon=L.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){let p=this._map.getZoom(),e=p===this._map.getMaxZoom(),n=p===this._map.getMinZoom();this._zoomInButton.disabled=e,this._zoomOutButton.disabled=n,this._zoomInButton.setAttribute("aria-disabled",e.toString()),this._zoomOutButton.setAttribute("aria-disabled",n.toString())}_rotateCompassArrow(){let p=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=p}onAdd(p){return this._map=p,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new Ka(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){L.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(p,e){let n=L.create("button",p,this._container);return n.type="button",n.addEventListener("click",e),n}_setButtonTitle(p,e){let n=this._map._getUIString(`NavigationControl.${e}`);p.title=n,p.setAttribute("aria-label",n)}},GeolocateControl:class extends a.Evented{constructor(p){super(),this.options=a.extend({},fl,p),a.bindAll(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker"],this)}onAdd(p){var e;return this._map=p,this._container=L.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),e=this._setupUI,Oi!==void 0?e(Oi):window.navigator.permissions!==void 0?window.navigator.permissions.query({name:"geolocation"}).then(n=>{Oi=n.state!=="denied",e(Oi)}):(Oi=!!window.navigator.geolocation,e(Oi)),this._container}onRemove(){this._geolocationWatchID!==void 0&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),L.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,jn=0,cr=!1}_isOutOfMapMaxBounds(p){let e=this._map.getMaxBounds(),n=p.coords;return e&&(n.longitude<e.getWest()||n.longitude>e.getEast()||n.latitude<e.getSouth()||n.latitude>e.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting")}}_onSuccess(p){if(this._map){if(this._isOutOfMapMaxBounds(p))return this._setErrorState(),this.fire(new a.Event("outofmaxbounds",p)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=p,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background")}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(p),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(p),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale","mapboxgl-user-location-dot-stale"),this.fire(new a.Event("geolocate",p)),this._finish()}}_updateCamera(p){let e=new a.LngLat(p.coords.longitude,p.coords.latitude),n=p.coords.accuracy,c=this._map.getBearing(),d=a.extend({bearing:c},this.options.fitBoundsOptions);this._map.fitBounds(e.toBounds(n),d,{geolocateSource:!0})}_updateMarker(p){if(p){let e=new a.LngLat(p.coords.longitude,p.coords.latitude);this._accuracyCircleMarker.setLngLat(e).addTo(this._map),this._userLocationDotMarker.setLngLat(e).addTo(this._map),this._accuracy=p.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){let p=this._map._container.clientHeight/2,e=this._map.unproject([0,p]),n=this._map.unproject([1,p]),c=e.distanceTo(n),d=Math.ceil(2*this._accuracy/c);this._circleElement.style.width=`${d}px`,this._circleElement.style.height=`${d}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}_onError(p){if(this._map){if(this.options.trackUserLocation)if(p.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;let e=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=e,this._geolocateButton.setAttribute("aria-label",e),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(p.code===3&&cr)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale","mapboxgl-user-location-dot-stale"),this.fire(new a.Event("error",p)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(p){if(this._container.addEventListener("contextmenu",e=>e.preventDefault()),this._geolocateButton=L.create("button","maplibregl-ctrl-geolocate mapboxgl-ctrl-geolocate",this._container),L.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",p===!1){a.warnOnce("Geolocation support is not available so the GeolocateControl will be disabled.");let e=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=e,this._geolocateButton.setAttribute("aria-label",e)}else{let e=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=e,this._geolocateButton.setAttribute("aria-label",e)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=L.create("div","maplibregl-user-location-dot mapboxgl-user-location-dot"),this._userLocationDotMarker=new sa(this._dotElement),this._circleElement=L.create("div","maplibregl-user-location-accuracy-circle mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new sa({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",e=>{e.geolocateSource||this._watchState!=="ACTIVE_LOCK"||e.originalEvent&&e.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this.fire(new a.Event("trackuserlocationend")))})}trigger(){if(!this._setup)return a.warnOnce("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new a.Event("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":jn--,cr=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this.fire(new a.Event("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new a.Event("trackuserlocationstart"))}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active")}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let p;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),jn++,jn>1?(p={maximumAge:6e5,timeout:0},cr=!0):(p=this.options.positionOptions,cr=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,p)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},AttributionControl:Xa,LogoControl:dl,ScaleControl:class{constructor(p){this.options=a.extend({},Xc,p),a.bindAll(["_onMove","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_onMove(){aa(this._map,this._container,this.options)}onAdd(p){return this._map=p,this._container=L.create("div","maplibregl-ctrl maplibregl-ctrl-scale mapboxgl-ctrl mapboxgl-ctrl-scale",p.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){L.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}setUnit(p){this.options.unit=p,aa(this._map,this._container,this.options)}},FullscreenControl:class{constructor(p){this._fullscreen=!1,p&&p.container&&(p.container instanceof HTMLElement?this._container=p.container:a.warnOnce("Full screen control 'container' must be a DOM element.")),a.bindAll(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(p){return this._map=p,this._container||(this._container=this._map.getContainer()),this._controlContainer=L.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",a.warnOnce("This device does not support fullscreen mode.")),this._controlContainer}onRemove(){L.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._changeIcon)}_checkFullscreenSupport(){return!!(document.fullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled||document.webkitFullscreenEnabled)}_setupUI(){let p=this._fullscreenButton=L.create("button","maplibregl-ctrl-fullscreen mapboxgl-ctrl-fullscreen",this._controlContainer);L.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",p).setAttribute("aria-hidden","true"),p.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){let p=this._getTitle();this._fullscreenButton.setAttribute("aria-label",p),this._fullscreenButton.title=p}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_changeIcon(){(window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement)===this._container!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-fullscreen"),this._updateTitle())}_onClickFullscreen(){this._isFullscreen()?window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen&&window.document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()}},Popup:class extends a.Evented{constructor(p){super(),this.options=a.extend(Object.create(Ni),p),a.bindAll(["_update","_onClose","remove","_onMouseMove","_onMouseUp","_onDrag"],this)}addTo(p){return this._map&&this.remove(),this._map=p,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer","mapboxgl-track-pointer")):this._map.on("move",this._update),this.fire(new a.Event("open")),this}isOpen(){return!!this._map}remove(){return this._content&&L.remove(this._content),this._container&&(L.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),delete this._map),this.fire(new a.Event("close")),this}getLngLat(){return this._lngLat}setLngLat(p){return this._lngLat=a.LngLat.convert(p),this._pos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer","mapboxgl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer","mapboxgl-track-pointer")),this}getElement(){return this._container}setText(p){return this.setDOMContent(document.createTextNode(p))}setHTML(p){let e=document.createDocumentFragment(),n=document.createElement("body"),c;for(n.innerHTML=p;c=n.firstChild,c;)e.appendChild(c);return this.setDOMContent(e)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(p){return this.options.maxWidth=p,this._update(),this}setDOMContent(p){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=L.create("div","maplibregl-popup-content mapboxgl-popup-content",this._container);return this._content.appendChild(p),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(p){this._container&&this._container.classList.add(p)}removeClassName(p){this._container&&this._container.classList.remove(p)}setOffset(p){return this.options.offset=p,this._update(),this}toggleClassName(p){if(this._container)return this._container.classList.toggle(p)}_createCloseButton(){this.options.closeButton&&(this._closeButton=L.create("button","maplibregl-popup-close-button mapboxgl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_onMouseUp(p){this._update(p.point)}_onMouseMove(p){this._update(p.point)}_onDrag(p){this._update(p.point)}_update(p){if(!this._map||!this._lngLat&&!this._trackPointer||!this._content||(this._container||(this._container=L.create("div","maplibregl-popup mapboxgl-popup",this._map.getContainer()),this._tip=L.create("div","maplibregl-popup-tip mapboxgl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className&&this.options.className.split(" ").forEach(g=>this._container.classList.add(g)),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer")),this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._map.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=se(this._lngLat,this._pos,this._map.transform)),this._trackPointer&&!p))return;let e=this._pos=this._trackPointer&&p?p:this._map.project(this._lngLat),n=this.options.anchor,c=Es(this.options.offset);if(!n){let g=this._container.offsetWidth,v=this._container.offsetHeight,w;w=e.y+c.bottom.y<v?["top"]:e.y>this._map.transform.height-v?["bottom"]:[],e.x<g/2?w.push("left"):e.x>this._map.transform.width-g/2&&w.push("right"),n=w.length===0?"bottom":w.join("-")}let d=e.add(c[n]).round();L.setTransform(this._container,`${de[n]} translate(${d.x}px,${d.y}px)`),na(this._container,n,"popup")}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;let p=this._container.querySelector(Sh);p&&p.focus()}_onClose(){this.remove()}},Marker:sa,Style:Wi,LngLat:a.LngLat,LngLatBounds:a.LngLatBounds,Point:a.pointGeometry,MercatorCoordinate:a.MercatorCoordinate,Evented:a.Evented,AJAXError:a.AJAXError,config:a.config,CanvasSource:nn,GeoJSONSource:mn,ImageSource:Lr,RasterDEMTileSource:_i,RasterTileSource:$r,VectorTileSource:zr,VideoSource:rn,prewarm:function(){U().acquire(gn)},clearPrewarmedResources:function(){let p=mt;p&&(p.isPreloaded()&&p.numActive()===1?(p.release(gn),mt=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},get workerCount(){return Rr.workerCount},set workerCount(p){Rr.workerCount=p},get maxParallelImageRequests(){return a.config.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(p){a.config.MAX_PARALLEL_IMAGE_REQUESTS=p},clearStorage(p){a.clearTileCache(p)},workerUrl:"",addProtocol(p,e){a.config.REGISTERED_PROTOCOLS[p]=e},removeProtocol(p){delete a.config.REGISTERED_PROTOCOLS[p]}};return hi.extend(oa,{isSafari:a.isSafari,getPerformanceMetrics:a.PerformanceUtils.getPerformanceMetrics}),oa});var _=h;return _})});Z();Jr();Z();Jr();Z();Z();Z();function fa(s){var l=new Error(s);return l.source="ulid",l}var Jh="0123456789ABCDEFGHJKMNPQRSTVWXYZ",uo=Jh.length,Bu=Math.pow(2,48)-1,Fu=10,tf=16;function g0(s){var l=Math.floor(s()*uo);return l===uo&&(l=uo-1),Jh.charAt(l)}function y0(s,l){if(isNaN(s))throw new Error(s+" must be a number");if(s>Bu)throw fa("cannot encode time greater than "+Bu);if(s<0)throw fa("time must be positive");if(Number.isInteger(s)===!1)throw fa("time must be an integer");for(var h=void 0,y="";l>0;l--)h=s%uo,y=Jh.charAt(h)+y,s=(s-h)/uo;return y}function _0(s,l){for(var h="";s>0;s--)h=g0(l)+h;return h}function ef(s){if(s.length!==Fu+tf)throw fa("malformed ulid");var l=s.substr(0,Fu).split("").reverse().reduce(function(h,y,_){var a=Jh.indexOf(y);if(a===-1)throw fa("invalid character found: "+y);return h+=a*Math.pow(uo,_)},0);if(l>Bu)throw fa("malformed ulid, timestamp too large");return l}function x0(){var s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,l=arguments[1];l||(l=typeof window<"u"?window:null);var h=l&&(l.crypto||l.msCrypto);if(h)return function(){var _=new Uint8Array(1);return h.getRandomValues(_),_[0]/255};try{var y=Qd();return function(){return y.randomBytes(1).readUInt8()/255}}catch{}if(s){try{console.error("secure crypto unusable, falling back to insecure Math.random()!")}catch{}return function(){return Math.random()}}throw fa("secure crypto unusable, insecure Math.random not allowed")}function v0(s){return s||(s=x0()),function(h){return isNaN(h)&&(h=Date.now()),y0(h,Fu)+_0(tf,s)}}var rf=v0();var nf=()=>typeof localStorage<"u",b0=24*60*60*1e3,w0=30*b0;function Dl(){let s="c"+rf().toLowerCase();return nf()&&localStorage.setItem("api-key",s),s}function sf(){if(!nf())return Dl();let s=localStorage.getItem("api-key");if(s==null||!s.startsWith("c"))return Dl();try{let l=ef(s.slice(1).toUpperCase());return Date.now()-w0<l?s:Dl()}catch{return Dl()}}Z();Z();Z();var Di=class{constructor(l,h,y,_){this.x=l,this.y=h,this.width=y,this.height=_}get bottom(){return this.y+this.height}get right(){return this.x+this.width}intersects(l){return this.x<l.right&&l.x<this.right&&this.y<l.bottom&&l.y<this.bottom}containsBounds(l){return Di.contains(this,l)}intersection(l){let h=Math.max(this.x,l.x),y=Math.min(this.x+this.width,l.x+l.width),_=Math.max(this.y,l.y),a=Math.min(this.y+this.height,l.y+l.height);return y>h&&a>_?new Di(h,_,y-h,a-_):null}static union(l){if(l.length===0)throw new Error("Union on empty list is not allowed");let{x:h,y}=l[0],_=h+l[0].width,a=y+l[0].height;for(let T=1;T<l.length;++T){let M=l[T];h=Math.min(h,M.x),_=Math.max(_,M.x+M.width),y=Math.min(y,M.y),a=Math.max(a,M.y+M.height)}return new Di(h,y,_-h,a-y)}union(l){return Di.union([this,l])}toJson(){return{x:this.x,y:this.y,width:this.width,height:this.height}}toBbox(){return[this.x,this.y,this.right,this.bottom]}toPolygon(){return[[[this.x,this.y],[this.x,this.bottom],[this.right,this.bottom],[this.right,this.y],[this.x,this.y]]]}scale(l,h=l){return new Di(this.x*l,this.y*h,this.width*l,this.height*h)}scaleFromCenter(l,h=l){let y=this.width*l,_=this.height*h;return new Di(this.x-.5*(y-this.width),this.y-.5*(_-this.height),y,_)}pad(l,h=l){return new Di(this.x-l,this.y-h,this.width+l*2,this.height+h*2)}round(l=0){let h=Math.round(this.x-l),y=Math.round(this.y-l);return new Di(h,y,Math.round(this.right+l)-h,Math.round(this.bottom+l)-y)}add(l){return new Di(this.x+l.x,this.y+l.y,this.width,this.height)}subtract(l){return new Di(this.x-l.x,this.y-l.y,this.width,this.height)}static fromMultiPolygon(l){if(l.length===0)return new Di(0,0,0,0);let h=l[0][0][0][0],y=l[0][0][0][1],_=h,a=y;for(let[T]of l)for(let[M,D]of T)M<h?h=M:M>_&&(_=M),D<y?y=D:D>a&&(a=D);return new Di(h,y,_-h,a-y)}static fromBbox([l,h,y,_]){return new Di(Math.min(l,y),Math.min(h,_),Math.abs(y-l),Math.abs(_-h))}static fromUpperLeftLowerRight(l,h){return new Di(l.x,l.y,h.x-l.x,h.y-l.y)}static fromJson(l){return new Di(l.x,l.y,l.width,l.height)}static compareArea(l,h){let y=l.width*l.height-h.width*h.height;if(y!==0)return y;let _=l.x-h.x;return _===0?l.y-h.y:_}static contains(l,h){return l.x<=h.x&&l.x+l.width>=h.x+h.width&&l.y<=h.y&&l.y+l.height>=h.y+h.height}};Z();var We;(function(s){s[s.Google=3857]="Google",s[s.Wgs84=4326]="Wgs84",s[s.Nztm2000=2193]="Nztm2000",s[s.Citm2000=3793]="Citm2000"})(We||(We={}));var Ou={google:We.Google,epsg3857:We.Google,[We.Google]:We.Google,globalmercator:We.Google,wgs84:We.Wgs84,epsg4326:We.Wgs84,[We.Wgs84]:We.Wgs84,nztm:We.Nztm2000,epsg2193:We.Nztm2000,[We.Nztm2000]:We.Nztm2000,nztm2000:We.Nztm2000,citm:We.Citm2000,epsg3793:We.Citm2000,[We.Citm2000]:We.Citm2000,citm2000:We.Citm2000},Ve=class{constructor(l){if(this.code=l,Ve.Codes.has(l))throw new Error(`Duplicate EPSG code created: ${l}`);Ve.Codes.set(this.code,this)}toString(){return this.code.toString()}toJSON(){return this.code}toEpsgString(){return`EPSG:${this.code}`}toUrn(){return`urn:ogc:def:crs:EPSG::${this.code}`}static get(l){let h=Ve.Codes.get(l);if(h==null)throw new Error(`Invalid EPSG:${l}`);return h}static tryGet(l){if(l!=null)return Ve.Codes.get(l)}static parseCode(l){var h;return l.startsWith("urn:")?Ou[l.slice(l.lastIndexOf(":")+1)]:l.startsWith("https://")?Ou[l.slice(l.lastIndexOf("/")+1)]:(h=Ou[l.replace(/[\W_]/g,"").toLowerCase()])!==null&&h!==void 0?h:null}static parse(l){let h=Ve.parseCode(l);return h==null?null:Ve.get(h)}};Ve.Codes=new Map;Ve.Google=new Ve(We.Google);Ve.Wgs84=new Ve(We.Wgs84);Ve.Nztm2000=new Ve(We.Nztm2000);Ve.Citm2000=new Ve(We.Citm2000);Z();var q1="0".charCodeAt(0),j1="1".charCodeAt(0),$1="2".charCodeAt(0),W1="3".charCodeAt(0);Z();Z();var po;(function(s){s[s.Xy=0]="Xy",s[s.Yx=1]="Yx"})(po||(po={}));function af(s){return s===Ve.Nztm2000?po.Yx:po.Xy}function M0(s,l){return l.scaleDenominator-s.scaleDenominator}var Bs=class{constructor(l){this.zooms=[],this.indexX=0,this.indexY=1,this.zoomConversionMap=new Map,this.def=l,this.tileSize=l.tileMatrix[0].tileHeight;let h=l.tileMatrix.slice().sort(M0),y={};for(let N of h){if(y[N.identifier])throw new Error(`Duplicate tileMatrix identifier ${N.identifier}`);if(N.tileHeight!==N.tileWidth)throw new Error("Only square tiles supported");if(N.tileHeight!==this.tileSize)throw new Error("All tiles must have the same tile size");y[N.identifier]=!0}this.zooms=h;let _=Ve.parse(l.supportedCRS);if(_==null)throw new Error(`Unable to find supported projection ${l.supportedCRS}`);this.projection=_,af(this.projection)===po.Yx&&(this.indexX=1,this.indexY=0);let{lowerCorner:a,upperCorner:T}=l.boundingBox,M=a[this.indexX],D=a[this.indexY];this.extent=new Di(M,D,T[this.indexX]-M,T[this.indexY]-D)}get maxZoom(){return this.zooms.length-1}get identifier(){return this.def.identifier}pixelScale(l){let h=this.zooms[l];if(h==null)throw new Error(`Zoom not found :${l}`);return h.scaleDenominator*28e-5}tileToPixels(l,h){return{x:l*this.tileSize,y:h*this.tileSize}}pixelsToTile(l,h,y){let _=Math.floor(l/this.tileSize),a=Math.floor(h/this.tileSize);return{x:_,y:a,z:y}}sourceToPixels(l,h,y){let _=this.zooms[y],a=this.pixelScale(y),T=(l-_.topLeftCorner[this.indexX])/a,M=(_.topLeftCorner[this.indexY]-h)/a;return{x:T,y:M}}pixelsToSource(l,h,y){let _=this.zooms[y],a=this.pixelScale(y),T=_.topLeftCorner[this.indexX]+l*a,M=_.topLeftCorner[this.indexY]-h*a;return{x:T,y:M}}tileToSource(l){let h=this.tileToPixels(l.x,l.y);return this.pixelsToSource(h.x,h.y,l.z)}tileToSourceBounds(l){let h=this.tileToSource(l),y=this.pixelScale(l.z)*this.tileSize;return new Di(h.x,h.y-y,y,y)}*topLevelTiles(){let{matrixWidth:h,matrixHeight:y}=this.zooms[0];for(let _=0;_<y;++_)for(let a=0;a<h;++a)yield{x:a,y:_,z:0};return null}*coverTile(l){if(l==null)return yield*this.topLevelTiles(),null;let h=l.z+1,{matrixWidth:y,matrixHeight:_}=this.zooms[l.z],{matrixWidth:a,matrixHeight:T}=this.zooms[h],M=a/y,D=T/_,N=Math.floor(l.x*M),L=Math.floor(l.y*D),tt=Math.ceil((l.x+1)*M),pt=Math.ceil((l.y+1)*D);for(let ft=L;ft<pt;++ft)for(let yt=N;yt<tt;++yt)yield{x:yt,y:ft,z:h};return null}static tileToName(l){return`${l.z}-${l.x}-${l.y}`}static nameToTile(l){let h=l.split("-");if(h.length===3){let y=Number(h[0]),_=Number(h[1]),a=Number(h[2]);if(!(isNaN(y)||isNaN(a)||isNaN(_)))return{x:_,y:a,z:y}}throw new Error(`Invalid tile name '${l}'`)}findBestZoom(l){let h=this.zoomConversionMap.get(l);return h==null&&(h=this.convertZoomLevel(l),this.zoomConversionMap.set(l,h)),h}convertZoomLevel(l){for(let h=0;h<this.zooms.length;h++){let y=this.zooms[h].scaleDenominator-l;if(y>1e-5)continue;if(h===0)return h;let _=this.zooms[h-1].scaleDenominator-l;return Math.abs(y)<_?h:h-1}return this.maxZoom}static convertZoomLevel(l,h,y,_=!0){return h.identifier===y.identifier||(l>=h.maxZoom&&(l=h.maxZoom),_&&l===0)?l:_&&l===h.maxZoom?y.maxZoom:y.findBestZoom(h.zooms[l].scaleDenominator)}};Z();var of={Version:"1.0.0-beta.2",License:"CC BY 4.0",BaseMapsExtension:"https://basemaps.linz.govt.nz/json-schema/stac-basemaps-extension/1.0/schema.json"};Z();Z();var S0={type:"TileMatrixSetType",title:"Google Maps Compatible for the World",identifier:"WebMercatorQuad",boundingBox:{type:"BoundingBoxType",crs:"http://www.opengis.net/def/crs/EPSG/0/3857",lowerCorner:[-200375083427892e-7,-200375083427892e-7],upperCorner:[200375083427892e-7,200375083427892e-7]},supportedCRS:"https://www.opengis.net/def/crs/EPSG/0/3857",wellKnownScaleSet:"https://www.opengis.net/def/wkss/OGC/1.0/GoogleMapsCompatible",tileMatrix:[{type:"TileMatrixType",identifier:"0",scaleDenominator:559082264028717e-6,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:1,matrixHeight:1},{type:"TileMatrixType",identifier:"1",scaleDenominator:279541132014358e-6,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:2,matrixHeight:2},{type:"TileMatrixType",identifier:"2",scaleDenominator:139770566007179e-6,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:4,matrixHeight:4},{type:"TileMatrixType",identifier:"3",scaleDenominator:698852830035897e-7,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:8,matrixHeight:8},{type:"TileMatrixType",identifier:"4",scaleDenominator:349426415017948e-7,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:16,matrixHeight:16},{type:"TileMatrixType",identifier:"5",scaleDenominator:174713207508974e-7,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:32,matrixHeight:32},{type:"TileMatrixType",identifier:"6",scaleDenominator:873566037544871e-8,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:64,matrixHeight:64},{type:"TileMatrixType",identifier:"7",scaleDenominator:436783018772435e-8,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:128,matrixHeight:128},{type:"TileMatrixType",identifier:"8",scaleDenominator:218391509386217e-8,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:256,matrixHeight:256},{type:"TileMatrixType",identifier:"9",scaleDenominator:109195754693108e-8,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:512,matrixHeight:512},{type:"TileMatrixType",identifier:"10",scaleDenominator:545978.773465544,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:1024,matrixHeight:1024},{type:"TileMatrixType",identifier:"11",scaleDenominator:272989.386732772,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:2048,matrixHeight:2048},{type:"TileMatrixType",identifier:"12",scaleDenominator:136494.693366386,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:4096,matrixHeight:4096},{type:"TileMatrixType",identifier:"13",scaleDenominator:68247.346683193,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:8192,matrixHeight:8192},{type:"TileMatrixType",identifier:"14",scaleDenominator:34123.6733415964,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:16384,matrixHeight:16384},{type:"TileMatrixType",identifier:"15",scaleDenominator:17061.8366707982,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:32768,matrixHeight:32768},{type:"TileMatrixType",identifier:"16",scaleDenominator:8530.91833539913,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:65536,matrixHeight:65536},{type:"TileMatrixType",identifier:"17",scaleDenominator:4265.45916769956,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:131072,matrixHeight:131072},{type:"TileMatrixType",identifier:"18",scaleDenominator:2132.72958384978,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:262144,matrixHeight:262144},{type:"TileMatrixType",identifier:"19",scaleDenominator:1066.36479192489,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:524288,matrixHeight:524288},{type:"TileMatrixType",identifier:"20",scaleDenominator:533.182395962445,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:1048576,matrixHeight:1048576},{type:"TileMatrixType",identifier:"21",scaleDenominator:266.591197981222,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:2097152,matrixHeight:2097152},{type:"TileMatrixType",identifier:"22",scaleDenominator:133.295598990611,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:4194304,matrixHeight:4194304},{type:"TileMatrixType",identifier:"23",scaleDenominator:66.6477994953056,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:8388608,matrixHeight:8388608},{type:"TileMatrixType",identifier:"24",scaleDenominator:33.3238997476528,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:16777216,matrixHeight:16777216}]},ii=new Bs(S0);Z();var ec=da(cf(),1),ts=new Bs(ec.Nztm2000),An=new Bs(ec.Nztm2000Quad);var ma={All:[ii,ts,An],Defaults:new Map([[Ve.Google.code,ii],[Ve.Nztm2000.code,ts]]),get(s){let l=this.tryGet(s);if(l==null)throw new Error("Failed to lookup TileMatrixSet: "+s);return l},tryGet(s){var l,h;return s==null?null:typeof s=="number"?(l=this.Defaults.get(s))!==null&&l!==void 0?l:null:(h=this.Defaults.get(s.code))!==null&&h!==void 0?h:null},find(s){if(s==null)return null;let l=Ve.parse(s);if(l!=null)return ma.tryGet(l);for(let h of ma.All)if(h.identifier===s)return h;return null}};Z();var Nu;(function(s){s.Png="png",s.Jpeg="jpeg",s.Webp="webp",s.Avif="avif"})(Nu||(Nu={}));var Uu;(function(s){s.MapboxVectorTiles="pbf"})(Uu||(Uu={}));var ag=da(pf(),1);Z();var mo={debug:!1,"debug.background":!1,"debug.source":!1,"debug.cog":!1,"debug.screenshot":!1,"debug.layer.linz-aerial":0,"debug.layer.linz-topographic":0,"debug.layer.osm":0},Rl=class{static toUrl(l,h){if(l.debug===!0){h.append("debug","true");for(let[y,_]of Object.entries(l))y==="debug"||mo[y]===_||h.append(y,String(_))}}static fromUrl(l,h){let y=h.get("debug")!=null,_=!1;if(y===!1){for(let[a,T]of Object.entries(mo))_=ga(l,a,T)||_;return _}return _=ga(l,"debug",!0),_=ga(l,"debug.background",h.get("debug.background"))||_,_=ga(l,"debug.source",h.get("debug.source")!=null)||_,_=ga(l,"debug.cog",h.get("debug.cog")!=null)||_,_=ga(l,"debug.screenshot",h.get("debug.screenshot")!=null)||_,_=Gu(l,"debug.layer.linz-aerial",h.get("debug.layer.linz-aerial"))||_,_=Gu(l,"debug.layer.linz-topographic",h.get("debug.layer.linz-topographic"))||_,_=Gu(l,"debug.layer.osm",h.get("debug.layer.osm"))||_,_}};function A0(s,l=0){if(s==null)return l;let h=Number(s);return isNaN(h)?l:h}function ga(s,l,h){return h==null&&(h=mo[l]),s[l]===h?!1:(s[l]=h,!0)}function Gu(s,l,h){return ga(s,l,A0(h))}Z();Z();Z();Z();var yf=da(ff(),1),_f=da(mf(),1);Z();function gf(s){return[[[s[0],s[1]],[s[2],s[1]],[s[2],s[3]],[s[0],s[3]],[s[0],s[1]]]]}var{intersection:Wu,union:Ab}=_f.default;function z0(s,l){return s[0]===l[0]&&s[1]===l[1]}function k0(s,l){return Wu(s,gf(l))}function Zu(s,l){let h=[];for(let y of s){let _=yf.default.polygon(y[0],l);_.length!==0&&(z0(_[0],_[_.length-1])||_.push(_[0]),h.push([_]))}return k0(h,l)}Z();Z();var Bl=s=>(s<-360?s=-(-s%360):s>360&&(s=s%360),s<-180?360+s:s>180?s-360:s),ya=(s,l)=>{let h=l-s;return h>180?h-360:h<-180?h+360:h},L0=(s,l)=>Bl(s+(l<s?l+360-s:l-s)),Fs={boxLonCenter(s){return Bl(s[0]+.5*(s[2]<s[0]?360+s[2]-s[0]:s[2]-s[0]))},delta:ya,crossesAM(s,l){return Math.sign(ya(s,l))!==Math.sign(l-s)},normLon:Bl,normExtent(s){return[Bl(s[0]),s[1],Bl(s[2]),s[3]]},union(s,l){if(l==null)return s.slice();let h=Fs.boxLonCenter(s),y=Fs.boxLonCenter(l);if(ya(h,y)<0)return this.union(l,s);let _=s.slice(),a=L0(h,y);return ya(a,l[0])<ya(a,s[0])&&(_[0]=l[0]),ya(a,l[2])>ya(a,s[2])&&(_[2]=l[2]),l[1]<s[1]&&(_[1]=l[1]),l[3]>s[3]&&(_[3]=l[3]),_},intersects(s,l){if(s[1]>l[3]||l[1]>s[3])return!1;let h=s[0],y=l[0],_=h<s[2]?s[2]:s[2]+360,a=y<l[2]?l[2]:l[2]+360;return h<=a&&y<=_||h+360<=a&&y<=_+360||h<=a+360&&y+360<=_},ringToBbox(s){if(s.length<3)throw new Error("Invalid ring");let l=!1,h=s[0],y=h[0],_=h[1],a=y,T=_,M=y;for(let D=1;D<s.length;++D){let N=s[D],L=N[0];Fs.crossesAM(M,L)&&(l=!l),l&&(L<0?L+=360:(M+=360,D===1&&(y=a=M))),L<y?y=L:L>a&&(a=L);let pt=N[1];pt<_?_=pt:pt>T&&(T=pt),M=N[0]}return[this.normLon(y),_,this.normLon(a),T]},multiPolygonToBbox(s){let l=null;for(let h of s){if(h.length===0)continue;let y=h[0];if(y.length<3)continue;let _=this.ringToBbox(y);l=l==null?_:this.union(l,_)}if(l==null)throw new Error("Invalid multipolygon");return l},bboxToMultiPolygon(s){let l=[s[0],s[1]],h=[s[2],s[1]],y=[s[0],s[3]],_=[s[2],s[3]];return s[0]<s[2]?[[[l,y,_,h,l]]]:[[[l,y,[180,_[1]],[180,h[1]],l]],[[_,h,[-180,l[1]],[-180,y[1]],_]]]}};var D0=[-180,-90,180,90],R0=[180,-90,360,90];function B0(s,l,h){return[l[0]+(h[0]-l[0])*s,l[1]+(h[1]-l[1])*s]}function F0(s){let l=[];for(let h of Zu(s,D0))l.push(h);for(let h of Zu(s,R0))l.push(h.map(y=>y.map(_=>[_[0]-360,_[1]])));return l}function xf(s,l,h=!0){let y=!1,_=!1,a=s.map(T=>T.map(M=>{let D=[];if(M.length===0)return D;let N=M[0],L=null,tt=0;for(let pt of M){let ft=l(pt),yt=ft[0];if(L!=null){let Ft=Fs.crossesAM(tt,yt);if(Ft&&(y=!0,_=!_),_&&(yt<0?ft[0]=yt+360:L[0]=tt+360),Ft){let kt=(180-ft[0])/(L[0]-ft[0]),Ot=l(B0(kt,pt,N));D.push([180,Ot[1]])}}D.push(ft),N=pt,L=ft,tt=yt}return D}));return y&&h?F0(a):a}Z();Z();function O0(s){return{type:"Polygon",coordinates:s}}function vf(s,l={}){return{type:"Feature",geometry:O0(s),properties:l}}function bf(s,l={}){return{type:"Feature",geometry:{type:"MultiPolygon",coordinates:s},properties:l}}Z();Z();Z();Z();Z();Z();function wf(s){s("EPSG:4326","+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees"),s("EPSG:4269","+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees"),s("EPSG:3857","+title=WGS 84 / Pseudo-Mercator +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs"),s.WGS84=s["EPSG:4326"],s["EPSG:3785"]=s["EPSG:3857"],s.GOOGLE=s["EPSG:3857"],s["EPSG:900913"]=s["EPSG:3857"],s["EPSG:102113"]=s["EPSG:3857"]}Z();Z();var bn=1,wn=2,yo=3,Mf=4,Fl=5,Hu=6378137,Sf=6356752314e-3,Xu=.0066943799901413165,_a=484813681109536e-20,Bt=Math.PI/2,Tf=.16666666666666666,Ef=.04722222222222222,If=.022156084656084655,qt=1e-10,Ei=.017453292519943295,Ur=57.29577951308232,Ze=Math.PI/4,Os=Math.PI*2,Ii=3.14159265359;Z();var Ir={};Ir.greenwich=0;Ir.lisbon=-9.131906111111;Ir.paris=2.337229166667;Ir.bogota=-74.080916666667;Ir.madrid=-3.687938888889;Ir.rome=12.452333333333;Ir.bern=7.439583333333;Ir.jakarta=106.807719444444;Ir.ferro=-17.666666666667;Ir.brussels=4.367975;Ir.stockholm=18.058277777778;Ir.athens=23.7163375;Ir.oslo=10.722916666667;Z();var Cf={ft:{to_meter:.3048},"us-ft":{to_meter:1200/3937}};Z();var Af=/[\s_\-\/\(\)]/g;function Qr(s,l){if(s[l])return s[l];for(var h=Object.keys(s),y=l.toLowerCase().replace(Af,""),_=-1,a,T;++_<h.length;)if(a=h[_],T=a.toLowerCase().replace(Af,""),T===y)return s[a]}function Ol(s){var l={},h=s.split("+").map(function(M){return M.trim()}).filter(function(M){return M}).reduce(function(M,D){var N=D.split("=");return N.push(!0),M[N[0].toLowerCase()]=N[1],M},{}),y,_,a,T={proj:"projName",datum:"datumCode",rf:function(M){l.rf=parseFloat(M)},lat_0:function(M){l.lat0=M*Ei},lat_1:function(M){l.lat1=M*Ei},lat_2:function(M){l.lat2=M*Ei},lat_ts:function(M){l.lat_ts=M*Ei},lon_0:function(M){l.long0=M*Ei},lon_1:function(M){l.long1=M*Ei},lon_2:function(M){l.long2=M*Ei},alpha:function(M){l.alpha=parseFloat(M)*Ei},gamma:function(M){l.rectified_grid_angle=parseFloat(M)},lonc:function(M){l.longc=M*Ei},x_0:function(M){l.x0=parseFloat(M)},y_0:function(M){l.y0=parseFloat(M)},k_0:function(M){l.k0=parseFloat(M)},k:function(M){l.k0=parseFloat(M)},a:function(M){l.a=parseFloat(M)},b:function(M){l.b=parseFloat(M)},r_a:function(){l.R_A=!0},zone:function(M){l.zone=parseInt(M,10)},south:function(){l.utmSouth=!0},towgs84:function(M){l.datum_params=M.split(",").map(function(D){return parseFloat(D)})},to_meter:function(M){l.to_meter=parseFloat(M)},units:function(M){l.units=M;var D=Qr(Cf,M);D&&(l.to_meter=D.to_meter)},from_greenwich:function(M){l.from_greenwich=M*Ei},pm:function(M){var D=Qr(Ir,M);l.from_greenwich=(D||parseFloat(M))*Ei},nadgrids:function(M){M==="@null"?l.datumCode="none":l.nadgrids=M},axis:function(M){var D="ewnsud";M.length===3&&D.indexOf(M.substr(0,1))!==-1&&D.indexOf(M.substr(1,1))!==-1&&D.indexOf(M.substr(2,1))!==-1&&(l.axis=M)},approx:function(){l.approx=!0}};for(y in h)_=h[y],y in T?(a=T[y],typeof a=="function"?a(_):l[a]=_):l[y]=_;return typeof l.datumCode=="string"&&l.datumCode!=="WGS84"&&(l.datumCode=l.datumCode.toLowerCase()),l}Z();Z();var Pf=G0,Nl=1,zf=2,kf=3,rc=4,Lf=5,Ku=-1,N0=/\s/,U0=/[A-Za-z]/,V0=/[A-Za-z84_]/,nc=/[,\]]/,Df=/[\d\.E\-\+]/;function is(s){if(typeof s!="string")throw new Error("not a string");this.text=s.trim(),this.level=0,this.place=0,this.root=null,this.stack=[],this.currentObject=null,this.state=Nl}is.prototype.readCharicter=function(){var s=this.text[this.place++];if(this.state!==rc)for(;N0.test(s);){if(this.place>=this.text.length)return;s=this.text[this.place++]}switch(this.state){case Nl:return this.neutral(s);case zf:return this.keyword(s);case rc:return this.quoted(s);case Lf:return this.afterquote(s);case kf:return this.number(s);case Ku:return}};is.prototype.afterquote=function(s){if(s==='"'){this.word+='"',this.state=rc;return}if(nc.test(s)){this.word=this.word.trim(),this.afterItem(s);return}throw new Error(`havn't handled "`+s+'" in afterquote yet, index '+this.place)};is.prototype.afterItem=function(s){if(s===","){this.word!==null&&this.currentObject.push(this.word),this.word=null,this.state=Nl;return}if(s==="]"){this.level--,this.word!==null&&(this.currentObject.push(this.word),this.word=null),this.state=Nl,this.currentObject=this.stack.pop(),this.currentObject||(this.state=Ku);return}};is.prototype.number=function(s){if(Df.test(s)){this.word+=s;return}if(nc.test(s)){this.word=parseFloat(this.word),this.afterItem(s);return}throw new Error(`havn't handled "`+s+'" in number yet, index '+this.place)};is.prototype.quoted=function(s){if(s==='"'){this.state=Lf;return}this.word+=s};is.prototype.keyword=function(s){if(V0.test(s)){this.word+=s;return}if(s==="["){var l=[];l.push(this.word),this.level++,this.root===null?this.root=l:this.currentObject.push(l),this.stack.push(this.currentObject),this.currentObject=l,this.state=Nl;return}if(nc.test(s)){this.afterItem(s);return}throw new Error(`havn't handled "`+s+'" in keyword yet, index '+this.place)};is.prototype.neutral=function(s){if(U0.test(s)){this.word=s,this.state=zf;return}if(s==='"'){this.word="",this.state=rc;return}if(Df.test(s)){this.word=s,this.state=kf;return}if(nc.test(s)){this.afterItem(s);return}throw new Error(`havn't handled "`+s+'" in neutral yet, index '+this.place)};is.prototype.output=function(){for(;this.place<this.text.length;)this.readCharicter();if(this.state===Ku)return this.root;throw new Error('unable to parse string "'+this.text+'". State is '+this.state)};function G0(s){var l=new is(s);return l.output()}Z();function Rf(s,l,h){Array.isArray(l)&&(h.unshift(l),l=null);var y=l?{}:s,_=h.reduce(function(a,T){return xa(T,a),a},y);l&&(s[l]=_)}function xa(s,l){if(!Array.isArray(s)){l[s]=!0;return}var h=s.shift();if(h==="PARAMETER"&&(h=s.shift()),s.length===1){if(Array.isArray(s[0])){l[h]={},xa(s[0],l[h]);return}l[h]=s[0];return}if(!s.length){l[h]=!0;return}if(h==="TOWGS84"){l[h]=s;return}if(h==="AXIS"){h in l||(l[h]=[]),l[h].push(s);return}Array.isArray(h)||(l[h]={});var y;switch(h){case"UNIT":case"PRIMEM":case"VERT_DATUM":l[h]={name:s[0].toLowerCase(),convert:s[1]},s.length===3&&xa(s[2],l[h]);return;case"SPHEROID":case"ELLIPSOID":l[h]={name:s[0],a:s[1],rf:s[2]},s.length===4&&xa(s[3],l[h]);return;case"PROJECTEDCRS":case"PROJCRS":case"GEOGCS":case"GEOCCS":case"PROJCS":case"LOCAL_CS":case"GEODCRS":case"GEODETICCRS":case"GEODETICDATUM":case"EDATUM":case"ENGINEERINGDATUM":case"VERT_CS":case"VERTCRS":case"VERTICALCRS":case"COMPD_CS":case"COMPOUNDCRS":case"ENGINEERINGCRS":case"ENGCRS":case"FITTED_CS":case"LOCAL_DATUM":case"DATUM":s[0]=["name",s[0]],Rf(l,h,s);return;default:for(y=-1;++y<s.length;)if(!Array.isArray(s[y]))return xa(s,l[h]);return Rf(l,h,s)}}var q0=.017453292519943295;function j0(s,l){var h=l[0],y=l[1];!(h in s)&&y in s&&(s[h]=s[y],l.length===3&&(s[h]=l[2](s[h])))}function rs(s){return s*q0}function $0(s){if(s.type==="GEOGCS"?s.projName="longlat":s.type==="LOCAL_CS"?(s.projName="identity",s.local=!0):typeof s.PROJECTION=="object"?s.projName=Object.keys(s.PROJECTION)[0]:s.projName=s.PROJECTION,s.AXIS){for(var l="",h=0,y=s.AXIS.length;h<y;++h){var _=[s.AXIS[h][0].toLowerCase(),s.AXIS[h][1].toLowerCase()];_[0].indexOf("north")!==-1||(_[0]==="y"||_[0]==="lat")&&_[1]==="north"?l+="n":_[0].indexOf("south")!==-1||(_[0]==="y"||_[0]==="lat")&&_[1]==="south"?l+="s":_[0].indexOf("east")!==-1||(_[0]==="x"||_[0]==="lon")&&_[1]==="east"?l+="e":(_[0].indexOf("west")!==-1||(_[0]==="x"||_[0]==="lon")&&_[1]==="west")&&(l+="w")}l.length===2&&(l+="u"),l.length===3&&(s.axis=l)}s.UNIT&&(s.units=s.UNIT.name.toLowerCase(),s.units==="metre"&&(s.units="meter"),s.UNIT.convert&&(s.type==="GEOGCS"?s.DATUM&&s.DATUM.SPHEROID&&(s.to_meter=s.UNIT.convert*s.DATUM.SPHEROID.a):s.to_meter=s.UNIT.convert));var a=s.GEOGCS;s.type==="GEOGCS"&&(a=s),a&&(a.DATUM?s.datumCode=a.DATUM.name.toLowerCase():s.datumCode=a.name.toLowerCase(),s.datumCode.slice(0,2)==="d_"&&(s.datumCode=s.datumCode.slice(2)),(s.datumCode==="new_zealand_geodetic_datum_1949"||s.datumCode==="new_zealand_1949")&&(s.datumCode="nzgd49"),(s.datumCode==="wgs_1984"||s.datumCode==="world_geodetic_system_1984")&&(s.PROJECTION==="Mercator_Auxiliary_Sphere"&&(s.sphere=!0),s.datumCode="wgs84"),s.datumCode.slice(-6)==="_ferro"&&(s.datumCode=s.datumCode.slice(0,-6)),s.datumCode.slice(-8)==="_jakarta"&&(s.datumCode=s.datumCode.slice(0,-8)),~s.datumCode.indexOf("belge")&&(s.datumCode="rnb72"),a.DATUM&&a.DATUM.SPHEROID&&(s.ellps=a.DATUM.SPHEROID.name.replace("_19","").replace(/[Cc]larke\_18/,"clrk"),s.ellps.toLowerCase().slice(0,13)==="international"&&(s.ellps="intl"),s.a=a.DATUM.SPHEROID.a,s.rf=parseFloat(a.DATUM.SPHEROID.rf,10)),a.DATUM&&a.DATUM.TOWGS84&&(s.datum_params=a.DATUM.TOWGS84),~s.datumCode.indexOf("osgb_1936")&&(s.datumCode="osgb36"),~s.datumCode.indexOf("osni_1952")&&(s.datumCode="osni52"),(~s.datumCode.indexOf("tm65")||~s.datumCode.indexOf("geodetic_datum_of_1965"))&&(s.datumCode="ire65"),s.datumCode==="ch1903+"&&(s.datumCode="ch1903"),~s.datumCode.indexOf("israel")&&(s.datumCode="isr93")),s.b&&!isFinite(s.b)&&(s.b=s.a);function T(N){var L=s.to_meter||1;return N*L}var M=function(N){return j0(s,N)},D=[["standard_parallel_1","Standard_Parallel_1"],["standard_parallel_1","Latitude of 1st standard parallel"],["standard_parallel_2","Standard_Parallel_2"],["standard_parallel_2","Latitude of 2nd standard parallel"],["false_easting","False_Easting"],["false_easting","False easting"],["false-easting","Easting at false origin"],["false_northing","False_Northing"],["false_northing","False northing"],["false_northing","Northing at false origin"],["central_meridian","Central_Meridian"],["central_meridian","Longitude of natural origin"],["central_meridian","Longitude of false origin"],["latitude_of_origin","Latitude_Of_Origin"],["latitude_of_origin","Central_Parallel"],["latitude_of_origin","Latitude of natural origin"],["latitude_of_origin","Latitude of false origin"],["scale_factor","Scale_Factor"],["k0","scale_factor"],["latitude_of_center","Latitude_Of_Center"],["latitude_of_center","Latitude_of_center"],["lat0","latitude_of_center",rs],["longitude_of_center","Longitude_Of_Center"],["longitude_of_center","Longitude_of_center"],["longc","longitude_of_center",rs],["x0","false_easting",T],["y0","false_northing",T],["long0","central_meridian",rs],["lat0","latitude_of_origin",rs],["lat0","standard_parallel_1",rs],["lat1","standard_parallel_1",rs],["lat2","standard_parallel_2",rs],["azimuth","Azimuth"],["alpha","azimuth",rs],["srsCode","name"]];D.forEach(M),!s.long0&&s.longc&&(s.projName==="Albers_Conic_Equal_Area"||s.projName==="Lambert_Azimuthal_Equal_Area")&&(s.long0=s.longc),!s.lat_ts&&s.lat1&&(s.projName==="Stereographic_South_Pole"||s.projName==="Polar Stereographic (variant B)")&&(s.lat0=rs(s.lat1>0?90:-90),s.lat_ts=s.lat1)}function sc(s){var l=Pf(s),h=l.shift(),y=l.shift();l.unshift(["name",y]),l.unshift(["type",h]);var _={};return xa(l,_),$0(_),_}function dn(s){var l=this;if(arguments.length===2){var h=arguments[1];typeof h=="string"?h.charAt(0)==="+"?dn[s]=Ol(arguments[1]):dn[s]=sc(arguments[1]):dn[s]=h}else if(arguments.length===1){if(Array.isArray(s))return s.map(function(y){Array.isArray(y)?dn.apply(l,y):dn(y)});if(typeof s=="string"){if(s in dn)return dn[s]}else"EPSG"in s?dn["EPSG:"+s.EPSG]=s:"ESRI"in s?dn["ESRI:"+s.ESRI]=s:"IAU2000"in s?dn["IAU2000:"+s.IAU2000]=s:console.log(s);return}}wf(dn);var _o=dn;function W0(s){return typeof s=="string"}function Z0(s){return s in _o}var H0=["PROJECTEDCRS","PROJCRS","GEOGCS","GEOCCS","PROJCS","LOCAL_CS","GEODCRS","GEODETICCRS","GEODETICDATUM","ENGCRS","ENGINEERINGCRS"];function X0(s){return H0.some(function(l){return s.indexOf(l)>-1})}var K0=["3857","900913","3785","102113"];function Y0(s){var l=Qr(s,"authority");if(!!l){var h=Qr(l,"epsg");return h&&K0.indexOf(h)>-1}}function J0(s){var l=Qr(s,"extension");if(!!l)return Qr(l,"proj4")}function Q0(s){return s[0]==="+"}function t_(s){if(W0(s)){if(Z0(s))return _o[s];if(X0(s)){var l=sc(s);if(Y0(l))return _o["EPSG:3857"];var h=J0(l);return h?Ol(h):l}if(Q0(s))return Ol(s)}else return s}var Bf=t_;Z();function Yu(s,l){s=s||{};var h,y;if(!l)return s;for(y in l)h=l[y],h!==void 0&&(s[y]=h);return s}Z();Z();Z();function dr(s,l,h){var y=s*l;return h/Math.sqrt(1-y*y)}Z();Z();function Pn(s){return s<0?-1:1}function $t(s){return Math.abs(s)<=Ii?s:s-Pn(s)*Os}Z();function Cr(s,l,h){var y=s*h,_=.5*s;return y=Math.pow((1-y)/(1+y),_),Math.tan(.5*(Bt-l))/y}Z();function ns(s,l){for(var h=.5*s,y,_,a=Bt-2*Math.atan(l),T=0;T<=15;T++)if(y=s*Math.sin(a),_=Bt-2*Math.atan(l*Math.pow((1-y)/(1+y),h))-a,a+=_,Math.abs(_)<=1e-10)return a;return-9999}function e_(){var s=this.b/this.a;this.es=1-s*s,"x0"in this||(this.x0=0),"y0"in this||(this.y0=0),this.e=Math.sqrt(this.es),this.lat_ts?this.sphere?this.k0=Math.cos(this.lat_ts):this.k0=dr(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)):this.k0||(this.k?this.k0=this.k:this.k0=1)}function i_(s){var l=s.x,h=s.y;if(h*Ur>90&&h*Ur<-90&&l*Ur>180&&l*Ur<-180)return null;var y,_;if(Math.abs(Math.abs(h)-Bt)<=qt)return null;if(this.sphere)y=this.x0+this.a*this.k0*$t(l-this.long0),_=this.y0+this.a*this.k0*Math.log(Math.tan(Ze+.5*h));else{var a=Math.sin(h),T=Cr(this.e,h,a);y=this.x0+this.a*this.k0*$t(l-this.long0),_=this.y0-this.a*this.k0*Math.log(T)}return s.x=y,s.y=_,s}function r_(s){var l=s.x-this.x0,h=s.y-this.y0,y,_;if(this.sphere)_=Bt-2*Math.atan(Math.exp(-h/(this.a*this.k0)));else{var a=Math.exp(-h/(this.a*this.k0));if(_=ns(this.e,a),_===-9999)return null}return y=$t(this.long0+l/(this.a*this.k0)),s.x=y,s.y=_,s}var n_=["Mercator","Popular Visualisation Pseudo Mercator","Mercator_1SP","Mercator_Auxiliary_Sphere","merc"],Ff={init:e_,forward:i_,inverse:r_,names:n_};Z();function s_(){}function Of(s){return s}var a_=["longlat","identity"],Nf={init:s_,forward:Of,inverse:Of,names:a_};var o_=[Ff,Nf],ac={},oc=[];function Uf(s,l){var h=oc.length;return s.names?(oc[h]=s,s.names.forEach(function(y){ac[y.toLowerCase()]=h}),this):(console.log(l),!0)}function l_(s){if(!s)return!1;var l=s.toLowerCase();if(typeof ac[l]<"u"&&oc[ac[l]])return oc[ac[l]]}function h_(){o_.forEach(Uf)}var Vf={start:h_,add:Uf,get:l_};Z();Z();var Ae={};Ae.MERIT={a:6378137,rf:298.257,ellipseName:"MERIT 1983"};Ae.SGS85={a:6378136,rf:298.257,ellipseName:"Soviet Geodetic System 85"};Ae.GRS80={a:6378137,rf:298.257222101,ellipseName:"GRS 1980(IUGG, 1980)"};Ae.IAU76={a:6378140,rf:298.257,ellipseName:"IAU 1976"};Ae.airy={a:6377563396e-3,b:635625691e-2,ellipseName:"Airy 1830"};Ae.APL4={a:6378137,rf:298.25,ellipseName:"Appl. Physics. 1965"};Ae.NWL9D={a:6378145,rf:298.25,ellipseName:"Naval Weapons Lab., 1965"};Ae.mod_airy={a:6377340189e-3,b:6356034446e-3,ellipseName:"Modified Airy"};Ae.andrae={a:637710443e-2,rf:300,ellipseName:"Andrae 1876 (Den., Iclnd.)"};Ae.aust_SA={a:6378160,rf:298.25,ellipseName:"Australian Natl & S. Amer. 1969"};Ae.GRS67={a:6378160,rf:298.247167427,ellipseName:"GRS 67(IUGG 1967)"};Ae.bessel={a:6377397155e-3,rf:299.1528128,ellipseName:"Bessel 1841"};Ae.bess_nam={a:6377483865e-3,rf:299.1528128,ellipseName:"Bessel 1841 (Namibia)"};Ae.clrk66={a:63782064e-1,b:63565838e-1,ellipseName:"Clarke 1866"};Ae.clrk80={a:6378249145e-3,rf:293.4663,ellipseName:"Clarke 1880 mod."};Ae.clrk58={a:6378293645208759e-9,rf:294.2606763692654,ellipseName:"Clarke 1858"};Ae.CPM={a:63757387e-1,rf:334.29,ellipseName:"Comm. des Poids et Mesures 1799"};Ae.delmbr={a:6376428,rf:311.5,ellipseName:"Delambre 1810 (Belgium)"};Ae.engelis={a:637813605e-2,rf:298.2566,ellipseName:"Engelis 1985"};Ae.evrst30={a:6377276345e-3,rf:300.8017,ellipseName:"Everest 1830"};Ae.evrst48={a:6377304063e-3,rf:300.8017,ellipseName:"Everest 1948"};Ae.evrst56={a:6377301243e-3,rf:300.8017,ellipseName:"Everest 1956"};Ae.evrst69={a:6377295664e-3,rf:300.8017,ellipseName:"Everest 1969"};Ae.evrstSS={a:6377298556e-3,rf:300.8017,ellipseName:"Everest (Sabah & Sarawak)"};Ae.fschr60={a:6378166,rf:298.3,ellipseName:"Fischer (Mercury Datum) 1960"};Ae.fschr60m={a:6378155,rf:298.3,ellipseName:"Fischer 1960"};Ae.fschr68={a:6378150,rf:298.3,ellipseName:"Fischer 1968"};Ae.helmert={a:6378200,rf:298.3,ellipseName:"Helmert 1906"};Ae.hough={a:6378270,rf:297,ellipseName:"Hough"};Ae.intl={a:6378388,rf:297,ellipseName:"International 1909 (Hayford)"};Ae.kaula={a:6378163,rf:298.24,ellipseName:"Kaula 1961"};Ae.lerch={a:6378139,rf:298.257,ellipseName:"Lerch 1979"};Ae.mprts={a:6397300,rf:191,ellipseName:"Maupertius 1738"};Ae.new_intl={a:63781575e-1,b:63567722e-1,ellipseName:"New International 1967"};Ae.plessis={a:6376523,rf:6355863,ellipseName:"Plessis 1817 (France)"};Ae.krass={a:6378245,rf:298.3,ellipseName:"Krassovsky, 1942"};Ae.SEasia={a:6378155,b:63567733205e-4,ellipseName:"Southeast Asia"};Ae.walbeck={a:6376896,b:63558348467e-4,ellipseName:"Walbeck"};Ae.WGS60={a:6378165,rf:298.3,ellipseName:"WGS 60"};Ae.WGS66={a:6378145,rf:298.25,ellipseName:"WGS 66"};Ae.WGS7={a:6378135,rf:298.26,ellipseName:"WGS 72"};var Gf=Ae.WGS84={a:6378137,rf:298.257223563,ellipseName:"WGS 84"};Ae.sphere={a:6370997,b:6370997,ellipseName:"Normal Sphere (r=6370997)"};function qf(s,l,h,y){var _=s*s,a=l*l,T=(_-a)/_,M=0;y?(s*=1-T*(Tf+T*(Ef+T*If)),_=s*s,T=0):M=Math.sqrt(T);var D=(_-a)/a;return{es:T,e:M,ep2:D}}function jf(s,l,h,y,_){if(!s){var a=Qr(Ae,y);a||(a=Gf),s=a.a,l=a.b,h=a.rf}return h&&!l&&(l=(1-1/h)*s),(h===0||Math.abs(s-l)<qt)&&(_=!0,l=s),{a:s,b:l,rf:h,sphere:_}}Z();var Xi={};Xi.wgs84={towgs84:"0,0,0",ellipse:"WGS84",datumName:"WGS84"};Xi.ch1903={towgs84:"674.374,15.056,405.346",ellipse:"bessel",datumName:"swiss"};Xi.ggrs87={towgs84:"-199.87,74.79,246.62",ellipse:"GRS80",datumName:"Greek_Geodetic_Reference_System_1987"};Xi.nad83={towgs84:"0,0,0",ellipse:"GRS80",datumName:"North_American_Datum_1983"};Xi.nad27={nadgrids:"@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat",ellipse:"clrk66",datumName:"North_American_Datum_1927"};Xi.potsdam={towgs84:"598.1,73.7,418.2,0.202,0.045,-2.455,6.7",ellipse:"bessel",datumName:"Potsdam Rauenberg 1950 DHDN"};Xi.carthage={towgs84:"-263.0,6.0,431.0",ellipse:"clark80",datumName:"Carthage 1934 Tunisia"};Xi.hermannskogel={towgs84:"577.326,90.129,463.919,5.137,1.474,5.297,2.4232",ellipse:"bessel",datumName:"Hermannskogel"};Xi.osni52={towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"airy",datumName:"Irish National"};Xi.ire65={towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"mod_airy",datumName:"Ireland 1965"};Xi.rassadiran={towgs84:"-133.63,-157.5,-158.62",ellipse:"intl",datumName:"Rassadiran"};Xi.nzgd49={towgs84:"59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993",ellipse:"intl",datumName:"New Zealand Geodetic Datum 1949"};Xi.osgb36={towgs84:"446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894",ellipse:"airy",datumName:"Airy 1830"};Xi.s_jtsk={towgs84:"589,76,480",ellipse:"bessel",datumName:"S-JTSK (Ferro)"};Xi.beduaram={towgs84:"-106,-87,188",ellipse:"clrk80",datumName:"Beduaram"};Xi.gunung_segara={towgs84:"-403,684,41",ellipse:"bessel",datumName:"Gunung Segara Jakarta"};Xi.rnb72={towgs84:"106.869,-52.2978,103.724,-0.33657,0.456955,-1.84218,1",ellipse:"intl",datumName:"Reseau National Belge 1972"};Z();function c_(s,l,h,y,_,a,T){var M={};return s===void 0||s==="none"?M.datum_type=Fl:M.datum_type=Mf,l&&(M.datum_params=l.map(parseFloat),(M.datum_params[0]!==0||M.datum_params[1]!==0||M.datum_params[2]!==0)&&(M.datum_type=bn),M.datum_params.length>3&&(M.datum_params[3]!==0||M.datum_params[4]!==0||M.datum_params[5]!==0||M.datum_params[6]!==0)&&(M.datum_type=wn,M.datum_params[3]*=_a,M.datum_params[4]*=_a,M.datum_params[5]*=_a,M.datum_params[6]=M.datum_params[6]/1e6+1)),T&&(M.datum_type=yo,M.grids=T),M.a=h,M.b=y,M.es=_,M.ep2=a,M}var $f=c_;Z();var Wf={};function Qu(s,l){var h=new DataView(l),y=p_(h),_=d_(h,y);_.nSubgrids>1&&console.log("Only single NTv2 subgrids are currently supported, subsequent sub grids are ignored");var a=f_(h,_,y),T={header:_,subgrids:a};return Wf[s]=T,T}function Zf(s){if(s===void 0)return null;var l=s.split(",");return l.map(u_)}function u_(s){if(s.length===0)return null;var l=s[0]==="@";return l&&(s=s.slice(1)),s==="null"?{name:"null",mandatory:!l,grid:null,isNull:!0}:{name:s,mandatory:!l,grid:Wf[s]||null,isNull:!1}}function xo(s){return s/3600*Math.PI/180}function p_(s){var l=s.getInt32(8,!1);return l===11?!1:(l=s.getInt32(8,!0),l!==11&&console.warn("Failed to detect nadgrid endian-ness, defaulting to little-endian"),!0)}function d_(s,l){return{nFields:s.getInt32(8,l),nSubgridFields:s.getInt32(24,l),nSubgrids:s.getInt32(40,l),shiftType:Ju(s,56,56+8).trim(),fromSemiMajorAxis:s.getFloat64(120,l),fromSemiMinorAxis:s.getFloat64(136,l),toSemiMajorAxis:s.getFloat64(152,l),toSemiMinorAxis:s.getFloat64(168,l)}}function Ju(s,l,h){return String.fromCharCode.apply(null,new Uint8Array(s.buffer.slice(l,h)))}function f_(s,l,h){for(var y=176,_=[],a=0;a<l.nSubgrids;a++){var T=g_(s,y,h),M=y_(s,y,T,h),D=Math.round(1+(T.upperLongitude-T.lowerLongitude)/T.longitudeInterval),N=Math.round(1+(T.upperLatitude-T.lowerLatitude)/T.latitudeInterval);_.push({ll:[xo(T.lowerLongitude),xo(T.lowerLatitude)],del:[xo(T.longitudeInterval),xo(T.latitudeInterval)],lim:[D,N],count:T.gridNodeCount,cvs:m_(M)})}return _}function m_(s){return s.map(function(l){return[xo(l.longitudeShift),xo(l.latitudeShift)]})}function g_(s,l,h){return{name:Ju(s,l+8,l+16).trim(),parent:Ju(s,l+24,l+24+8).trim(),lowerLatitude:s.getFloat64(l+72,h),upperLatitude:s.getFloat64(l+88,h),lowerLongitude:s.getFloat64(l+104,h),upperLongitude:s.getFloat64(l+120,h),latitudeInterval:s.getFloat64(l+136,h),longitudeInterval:s.getFloat64(l+152,h),gridNodeCount:s.getInt32(l+168,h)}}function y_(s,l,h,y){for(var _=l+176,a=16,T=[],M=0;M<h.gridNodeCount;M++){var D={latitudeShift:s.getFloat32(_+M*a,y),longitudeShift:s.getFloat32(_+M*a+4,y),latitudeAccuracy:s.getFloat32(_+M*a+8,y),longitudeAccuracy:s.getFloat32(_+M*a+12,y)};T.push(D)}return T}function vo(s,l){if(!(this instanceof vo))return new vo(s);l=l||function(N){if(N)throw N};var h=Bf(s);if(typeof h!="object"){l(s);return}var y=vo.projections.get(h.projName);if(!y){l(s);return}if(h.datumCode&&h.datumCode!=="none"){var _=Qr(Xi,h.datumCode);_&&(h.datum_params=h.datum_params||(_.towgs84?_.towgs84.split(","):null),h.ellps=_.ellipse,h.datumName=_.datumName?_.datumName:h.datumCode)}h.k0=h.k0||1,h.axis=h.axis||"enu",h.ellps=h.ellps||"wgs84",h.lat1=h.lat1||h.lat0;var a=jf(h.a,h.b,h.rf,h.ellps,h.sphere),T=qf(a.a,a.b,a.rf,h.R_A),M=Zf(h.nadgrids),D=h.datum||$f(h.datumCode,h.datum_params,a.a,a.b,T.es,T.ep2,M);Yu(this,h),Yu(this,y),this.a=a.a,this.b=a.b,this.rf=a.rf,this.sphere=a.sphere,this.es=T.es,this.e=T.e,this.ep2=T.ep2,this.datum=D,this.init(),l(null,this)}vo.projections=Vf;vo.projections.start();var Ns=vo;Z();Z();Z();function Hf(s,l){return s.datum_type!==l.datum_type||s.a!==l.a||Math.abs(s.es-l.es)>5e-11?!1:s.datum_type===bn?s.datum_params[0]===l.datum_params[0]&&s.datum_params[1]===l.datum_params[1]&&s.datum_params[2]===l.datum_params[2]:s.datum_type===wn?s.datum_params[0]===l.datum_params[0]&&s.datum_params[1]===l.datum_params[1]&&s.datum_params[2]===l.datum_params[2]&&s.datum_params[3]===l.datum_params[3]&&s.datum_params[4]===l.datum_params[4]&&s.datum_params[5]===l.datum_params[5]&&s.datum_params[6]===l.datum_params[6]:!0}function lc(s,l,h){var y=s.x,_=s.y,a=s.z?s.z:0,T,M,D,N;if(_<-Bt&&_>-1.001*Bt)_=-Bt;else if(_>Bt&&_<1.001*Bt)_=Bt;else{if(_<-Bt)return{x:-1/0,y:-1/0,z:s.z};if(_>Bt)return{x:1/0,y:1/0,z:s.z}}return y>Math.PI&&(y-=2*Math.PI),M=Math.sin(_),N=Math.cos(_),D=M*M,T=h/Math.sqrt(1-l*D),{x:(T+a)*N*Math.cos(y),y:(T+a)*N*Math.sin(y),z:(T*(1-l)+a)*M}}function hc(s,l,h,y){var _=1e-12,a=_*_,T=30,M,D,N,L,tt,pt,ft,yt,Ft,kt,Ot,he,ne,be=s.x,xe=s.y,me=s.z?s.z:0,Ge,Ne,di;if(M=Math.sqrt(be*be+xe*xe),D=Math.sqrt(be*be+xe*xe+me*me),M/h<_){if(Ge=0,D/h<_)return Ne=Bt,di=-y,{x:s.x,y:s.y,z:s.z}}else Ge=Math.atan2(xe,be);N=me/D,L=M/D,tt=1/Math.sqrt(1-l*(2-l)*L*L),yt=L*(1-l)*tt,Ft=N*tt,ne=0;do ne++,ft=h/Math.sqrt(1-l*Ft*Ft),di=M*yt+me*Ft-ft*(1-l*Ft*Ft),pt=l*ft/(ft+di),tt=1/Math.sqrt(1-pt*(2-pt)*L*L),kt=L*(1-pt)*tt,Ot=N*tt,he=Ot*yt-kt*Ft,yt=kt,Ft=Ot;while(he*he>a&&ne<T);return Ne=Math.atan(Ot/Math.abs(kt)),{x:Ge,y:Ne,z:di}}function Xf(s,l,h){if(l===bn)return{x:s.x+h[0],y:s.y+h[1],z:s.z+h[2]};if(l===wn){var y=h[0],_=h[1],a=h[2],T=h[3],M=h[4],D=h[5],N=h[6];return{x:N*(s.x-D*s.y+M*s.z)+y,y:N*(D*s.x+s.y-T*s.z)+_,z:N*(-M*s.x+T*s.y+s.z)+a}}}function Kf(s,l,h){if(l===bn)return{x:s.x-h[0],y:s.y-h[1],z:s.z-h[2]};if(l===wn){var y=h[0],_=h[1],a=h[2],T=h[3],M=h[4],D=h[5],N=h[6],L=(s.x-y)/N,tt=(s.y-_)/N,pt=(s.z-a)/N;return{x:L+D*tt-M*pt,y:-D*L+tt+T*pt,z:M*L-T*tt+pt}}}function cc(s){return s===bn||s===wn}function Qf(s,l,h){if(Hf(s,l)||s.datum_type===Fl||l.datum_type===Fl)return h;var y=s.a,_=s.es;if(s.datum_type===yo){var a=Yf(s,!1,h);if(a!==0)return;y=Hu,_=Xu}var T=l.a,M=l.b,D=l.es;if(l.datum_type===yo&&(T=Hu,M=Sf,D=Xu),_===D&&y===T&&!cc(s.datum_type)&&!cc(l.datum_type))return h;if(h=lc(h,_,y),cc(s.datum_type)&&(h=Xf(h,s.datum_type,s.datum_params)),cc(l.datum_type)&&(h=Kf(h,l.datum_type,l.datum_params)),h=hc(h,D,T,M),l.datum_type===yo){var N=Yf(l,!0,h);if(N!==0)return}return h}function Yf(s,l,h){if(s.grids===null||s.grids.length===0)return console.log("Grid shift grids not found"),-1;for(var y={x:-h.x,y:h.y},_={x:Number.NaN,y:Number.NaN},a=!1,T=[],M=0;M<s.grids.length;M++){var D=s.grids[M];if(T.push(D.name),D.isNull){_=y;break}if(a=D.mandatory,D.grid===null){if(D.mandatory)return console.log("Unable to find mandatory grid '"+D.name+"'"),-1;continue}var N=D.grid.subgrids[0],L=(Math.abs(N.del[1])+Math.abs(N.del[0]))/1e4,tt=N.ll[0]-L,pt=N.ll[1]-L,ft=N.ll[0]+(N.lim[0]-1)*N.del[0]+L,yt=N.ll[1]+(N.lim[1]-1)*N.del[1]+L;if(!(pt>y.y||tt>y.x||yt<y.y||ft<y.x)&&(_=__(y,l,N),!isNaN(_.x)))break}return isNaN(_.x)?(console.log("Failed to find a grid shift table for location '"+-y.x*Ur+" "+y.y*Ur+" tried: '"+T+"'"),-1):(h.x=-_.x,h.y=_.y,0)}function __(s,l,h){var y={x:Number.NaN,y:Number.NaN};if(isNaN(s.x))return y;var _={x:s.x,y:s.y};_.x-=h.ll[0],_.y-=h.ll[1],_.x=$t(_.x-Math.PI)+Math.PI;var a=Jf(_,h);if(l){if(isNaN(a.x))return y;a.x=_.x-a.x,a.y=_.y-a.y;var T=9,M=1e-12,D,N;do{if(N=Jf(a,h),isNaN(N.x)){console.log("Inverse grid shift iteration failed, presumably at grid edge. Using first approximation.");break}D={x:_.x-(N.x+a.x),y:_.y-(N.y+a.y)},a.x+=D.x,a.y+=D.y}while(T--&&Math.abs(D.x)>M&&Math.abs(D.y)>M);if(T<0)return console.log("Inverse grid shift iterator failed to converge."),y;y.x=$t(a.x+h.ll[0]),y.y=a.y+h.ll[1]}else isNaN(a.x)||(y.x=s.x+a.x,y.y=s.y+a.y);return y}function Jf(s,l){var h={x:s.x/l.del[0],y:s.y/l.del[1]},y={x:Math.floor(h.x),y:Math.floor(h.y)},_={x:h.x-1*y.x,y:h.y-1*y.y},a={x:Number.NaN,y:Number.NaN},T;if(y.x<0||y.x>=l.lim[0]||y.y<0||y.y>=l.lim[1])return a;T=y.y*l.lim[0]+y.x;var M={x:l.cvs[T][0],y:l.cvs[T][1]};T++;var D={x:l.cvs[T][0],y:l.cvs[T][1]};T+=l.lim[0];var N={x:l.cvs[T][0],y:l.cvs[T][1]};T--;var L={x:l.cvs[T][0],y:l.cvs[T][1]},tt=_.x*_.y,pt=_.x*(1-_.y),ft=(1-_.x)*(1-_.y),yt=(1-_.x)*_.y;return a.x=ft*M.x+pt*D.x+yt*L.x+tt*N.x,a.y=ft*M.y+pt*D.y+yt*L.y+tt*N.y,a}Z();function tp(s,l,h){var y=h.x,_=h.y,a=h.z||0,T,M,D,N={};for(D=0;D<3;D++)if(!(l&&D===2&&h.z===void 0))switch(D===0?(T=y,"ew".indexOf(s.axis[D])!==-1?M="x":M="y"):D===1?(T=_,"ns".indexOf(s.axis[D])!==-1?M="y":M="x"):(T=a,M="z"),s.axis[D]){case"e":N[M]=T;break;case"w":N[M]=-T;break;case"n":N[M]=T;break;case"s":N[M]=-T;break;case"u":h[M]!==void 0&&(N.z=T);break;case"d":h[M]!==void 0&&(N.z=-T);break;default:return null}return N}Z();function uc(s){var l={x:s[0],y:s[1]};return s.length>2&&(l.z=s[2]),s.length>3&&(l.m=s[3]),l}Z();function em(s){tm(s.x),tm(s.y)}function tm(s){if(typeof Number.isFinite=="function"){if(Number.isFinite(s))return;throw new TypeError("coordinates must be finite numbers")}if(typeof s!="number"||s!==s||!isFinite(s))throw new TypeError("coordinates must be finite numbers")}function x_(s,l){return(s.datum.datum_type===bn||s.datum.datum_type===wn)&&l.datumCode!=="WGS84"||(l.datum.datum_type===bn||l.datum.datum_type===wn)&&s.datumCode!=="WGS84"}function va(s,l,h,y){var _;if(Array.isArray(h)&&(h=uc(h)),em(h),s.datum&&l.datum&&x_(s,l)&&(_=new Ns("WGS84"),h=va(s,_,h,y),s=_),y&&s.axis!=="enu"&&(h=tp(s,!1,h)),s.projName==="longlat")h={x:h.x*Ei,y:h.y*Ei,z:h.z||0};else if(s.to_meter&&(h={x:h.x*s.to_meter,y:h.y*s.to_meter,z:h.z||0}),h=s.inverse(h),!h)return;if(s.from_greenwich&&(h.x+=s.from_greenwich),h=Qf(s.datum,l.datum,h),!!h)return l.from_greenwich&&(h={x:h.x-l.from_greenwich,y:h.y,z:h.z||0}),l.projName==="longlat"?h={x:h.x*Ur,y:h.y*Ur,z:h.z||0}:(h=l.forward(h),l.to_meter&&(h={x:h.x/l.to_meter,y:h.y/l.to_meter,z:h.z||0})),y&&l.axis!=="enu"?tp(l,!0,h):h}var im=Ns("WGS84");function ep(s,l,h,y){var _,a,T;return Array.isArray(h)?(_=va(s,l,h,y)||{x:NaN,y:NaN},h.length>2?typeof s.name<"u"&&s.name==="geocent"||typeof l.name<"u"&&l.name==="geocent"?typeof _.z=="number"?[_.x,_.y,_.z].concat(h.splice(3)):[_.x,_.y,h[2]].concat(h.splice(3)):[_.x,_.y].concat(h.splice(2)):[_.x,_.y]):(a=va(s,l,h,y),T=Object.keys(h),T.length===2||T.forEach(function(M){if(typeof s.name<"u"&&s.name==="geocent"||typeof l.name<"u"&&l.name==="geocent"){if(M==="x"||M==="y"||M==="z")return}else if(M==="x"||M==="y")return;a[M]=h[M]}),a)}function rm(s){return s instanceof Ns?s:s.oProj?s.oProj:Ns(s)}function v_(s,l,h){s=rm(s);var y=!1,_;return typeof l>"u"?(l=s,s=im,y=!0):(typeof l.x<"u"||Array.isArray(l))&&(h=l,l=s,s=im,y=!0),l=rm(l),h?ep(s,l,h):(_={forward:function(a,T){return ep(s,l,a,T)},inverse:function(a,T){return ep(l,s,a,T)}},y&&(_.oProj=l),_)}var Vr=v_;Z();Z();var nm=6,am="AJSAJS",om="AFAFAF",bo=65,Gr=73,fn=79,Ul=86,Vl=90,lm={forward:rp,inverse:b_,toPoint:np};function rp(s,l){return l=l||5,S_(w_({lat:s[1],lon:s[0]}),l)}function b_(s){var l=sp(cm(s.toUpperCase()));return l.lat&&l.lon?[l.lon,l.lat,l.lon,l.lat]:[l.left,l.bottom,l.right,l.top]}function np(s){var l=sp(cm(s.toUpperCase()));return l.lat&&l.lon?[l.lon,l.lat]:[(l.left+l.right)/2,(l.top+l.bottom)/2]}function ip(s){return s*(Math.PI/180)}function sm(s){return 180*(s/Math.PI)}function w_(s){var l=s.lat,h=s.lon,y=6378137,_=.00669438,a=.9996,T,M,D,N,L,tt,pt,ft=ip(l),yt=ip(h),Ft,kt;kt=Math.floor((h+180)/6)+1,h===180&&(kt=60),l>=56&&l<64&&h>=3&&h<12&&(kt=32),l>=72&&l<84&&(h>=0&&h<9?kt=31:h>=9&&h<21?kt=33:h>=21&&h<33?kt=35:h>=33&&h<42&&(kt=37)),T=(kt-1)*6-180+3,Ft=ip(T),M=_/(1-_),D=y/Math.sqrt(1-_*Math.sin(ft)*Math.sin(ft)),N=Math.tan(ft)*Math.tan(ft),L=M*Math.cos(ft)*Math.cos(ft),tt=Math.cos(ft)*(yt-Ft),pt=y*((1-_/4-3*_*_/64-5*_*_*_/256)*ft-(3*_/8+3*_*_/32+45*_*_*_/1024)*Math.sin(2*ft)+(15*_*_/256+45*_*_*_/1024)*Math.sin(4*ft)-35*_*_*_/3072*Math.sin(6*ft));var Ot=a*D*(tt+(1-N+L)*tt*tt*tt/6+(5-18*N+N*N+72*L-58*M)*tt*tt*tt*tt*tt/120)+5e5,he=a*(pt+D*Math.tan(ft)*(tt*tt/2+(5-N+9*L+4*L*L)*tt*tt*tt*tt/24+(61-58*N+N*N+600*L-330*M)*tt*tt*tt*tt*tt*tt/720));return l<0&&(he+=1e7),{northing:Math.round(he),easting:Math.round(Ot),zoneNumber:kt,zoneLetter:M_(l)}}function sp(s){var l=s.northing,h=s.easting,y=s.zoneLetter,_=s.zoneNumber;if(_<0||_>60)return null;var a=.9996,T=6378137,M=.00669438,D,N=(1-Math.sqrt(1-M))/(1+Math.sqrt(1-M)),L,tt,pt,ft,yt,Ft,kt,Ot,he,ne=h-5e5,be=l;y<"N"&&(be-=1e7),kt=(_-1)*6-180+3,D=M/(1-M),Ft=be/a,Ot=Ft/(T*(1-M/4-3*M*M/64-5*M*M*M/256)),he=Ot+(3*N/2-27*N*N*N/32)*Math.sin(2*Ot)+(21*N*N/16-55*N*N*N*N/32)*Math.sin(4*Ot)+151*N*N*N/96*Math.sin(6*Ot),L=T/Math.sqrt(1-M*Math.sin(he)*Math.sin(he)),tt=Math.tan(he)*Math.tan(he),pt=D*Math.cos(he)*Math.cos(he),ft=T*(1-M)/Math.pow(1-M*Math.sin(he)*Math.sin(he),1.5),yt=ne/(L*a);var xe=he-L*Math.tan(he)/ft*(yt*yt/2-(5+3*tt+10*pt-4*pt*pt-9*D)*yt*yt*yt*yt/24+(61+90*tt+298*pt+45*tt*tt-252*D-3*pt*pt)*yt*yt*yt*yt*yt*yt/720);xe=sm(xe);var me=(yt-(1+2*tt+pt)*yt*yt*yt/6+(5-2*pt+28*tt-3*pt*pt+8*D+24*tt*tt)*yt*yt*yt*yt*yt/120)/Math.cos(he);me=kt+sm(me);var Ge;if(s.accuracy){var Ne=sp({northing:s.northing+s.accuracy,easting:s.easting+s.accuracy,zoneLetter:s.zoneLetter,zoneNumber:s.zoneNumber});Ge={top:Ne.lat,right:Ne.lon,bottom:xe,left:me}}else Ge={lat:xe,lon:me};return Ge}function M_(s){var l="Z";return 84>=s&&s>=72?l="X":72>s&&s>=64?l="W":64>s&&s>=56?l="V":56>s&&s>=48?l="U":48>s&&s>=40?l="T":40>s&&s>=32?l="S":32>s&&s>=24?l="R":24>s&&s>=16?l="Q":16>s&&s>=8?l="P":8>s&&s>=0?l="N":0>s&&s>=-8?l="M":-8>s&&s>=-16?l="L":-16>s&&s>=-24?l="K":-24>s&&s>=-32?l="J":-32>s&&s>=-40?l="H":-40>s&&s>=-48?l="G":-48>s&&s>=-56?l="F":-56>s&&s>=-64?l="E":-64>s&&s>=-72?l="D":-72>s&&s>=-80&&(l="C"),l}function S_(s,l){var h="00000"+s.easting,y="00000"+s.northing;return s.zoneNumber+s.zoneLetter+T_(s.easting,s.northing,s.zoneNumber)+h.substr(h.length-5,l)+y.substr(y.length-5,l)}function T_(s,l,h){var y=hm(h),_=Math.floor(s/1e5),a=Math.floor(l/1e5)%20;return E_(_,a,y)}function hm(s){var l=s%nm;return l===0&&(l=nm),l}function E_(s,l,h){var y=h-1,_=am.charCodeAt(y),a=om.charCodeAt(y),T=_+s-1,M=a+l,D=!1;T>Vl&&(T=T-Vl+bo-1,D=!0),(T===Gr||_<Gr&&T>Gr||(T>Gr||_<Gr)&&D)&&T++,(T===fn||_<fn&&T>fn||(T>fn||_<fn)&&D)&&(T++,T===Gr&&T++),T>Vl&&(T=T-Vl+bo-1),M>Ul?(M=M-Ul+bo-1,D=!0):D=!1,(M===Gr||a<Gr&&M>Gr||(M>Gr||a<Gr)&&D)&&M++,(M===fn||a<fn&&M>fn||(M>fn||a<fn)&&D)&&(M++,M===Gr&&M++),M>Ul&&(M=M-Ul+bo-1);var N=String.fromCharCode(T)+String.fromCharCode(M);return N}function cm(s){if(s&&s.length===0)throw"MGRSPoint coverting from nothing";for(var l=s.length,h=null,y="",_,a=0;!/[A-Z]/.test(_=s.charAt(a));){if(a>=2)throw"MGRSPoint bad conversion from: "+s;y+=_,a++}var T=parseInt(y,10);if(a===0||a+3>l)throw"MGRSPoint bad conversion from: "+s;var M=s.charAt(a++);if(M<="A"||M==="B"||M==="Y"||M>="Z"||M==="I"||M==="O")throw"MGRSPoint zone letter "+M+" not handled: "+s;h=s.substring(a,a+=2);for(var D=hm(T),N=I_(h.charAt(0),D),L=C_(h.charAt(1),D);L<A_(M);)L+=2e6;var tt=l-a;if(tt%2!==0)throw`MGRSPoint has to have an even number
|
|
506
|
+
of digits after the zone letter and two 100km letters - front
|
|
507
|
+
half for easting meters, second half for
|
|
508
|
+
northing meters`+s;var pt=tt/2,ft=0,yt=0,Ft,kt,Ot,he,ne;return pt>0&&(Ft=1e5/Math.pow(10,pt),kt=s.substring(a,a+pt),ft=parseFloat(kt)*Ft,Ot=s.substring(a+pt),yt=parseFloat(Ot)*Ft),he=ft+N,ne=yt+L,{easting:he,northing:ne,zoneLetter:M,zoneNumber:T,accuracy:Ft}}function I_(s,l){for(var h=am.charCodeAt(l-1),y=1e5,_=!1;h!==s.charCodeAt(0);){if(h++,h===Gr&&h++,h===fn&&h++,h>Vl){if(_)throw"Bad character: "+s;h=bo,_=!0}y+=1e5}return y}function C_(s,l){if(s>"V")throw"MGRSPoint given invalid Northing "+s;for(var h=om.charCodeAt(l-1),y=0,_=!1;h!==s.charCodeAt(0);){if(h++,h===Gr&&h++,h===fn&&h++,h>Ul){if(_)throw"Bad character: "+s;h=bo,_=!0}y+=1e5}return y}function A_(s){var l;switch(s){case"C":l=11e5;break;case"D":l=2e6;break;case"E":l=28e5;break;case"F":l=37e5;break;case"G":l=46e5;break;case"H":l=55e5;break;case"J":l=64e5;break;case"K":l=73e5;break;case"L":l=82e5;break;case"M":l=91e5;break;case"N":l=0;break;case"P":l=8e5;break;case"Q":l=17e5;break;case"R":l=26e5;break;case"S":l=35e5;break;case"T":l=44e5;break;case"U":l=53e5;break;case"V":l=62e5;break;case"W":l=7e6;break;case"X":l=79e5;break;default:l=-1}if(l>=0)return l;throw"Invalid zone letter: "+s}function wo(s,l,h){if(!(this instanceof wo))return new wo(s,l,h);if(Array.isArray(s))this.x=s[0],this.y=s[1],this.z=s[2]||0;else if(typeof s=="object")this.x=s.x,this.y=s.y,this.z=s.z||0;else if(typeof s=="string"&&typeof l>"u"){var y=s.split(",");this.x=parseFloat(y[0],10),this.y=parseFloat(y[1],10),this.z=parseFloat(y[2],10)||0}else this.x=s,this.y=l,this.z=h||0;console.warn("proj4.Point will be removed in version 3, use proj4.toPoint")}wo.fromMGRS=function(s){return new wo(np(s))};wo.prototype.toMGRS=function(s){return rp([this.x,this.y],s)};var um=wo;Z();Z();Z();var P_=1,z_=.25,pm=.046875,dm=.01953125,fm=.01068115234375,k_=.75,L_=.46875,D_=.013020833333333334,R_=.007120768229166667,B_=.3645833333333333,F_=.005696614583333333,O_=.3076171875;function pc(s){var l=[];l[0]=P_-s*(z_+s*(pm+s*(dm+s*fm))),l[1]=s*(k_-s*(pm+s*(dm+s*fm)));var h=s*s;return l[2]=h*(L_-s*(D_+s*R_)),h*=s,l[3]=h*(B_-s*F_),l[4]=h*s*O_,l}Z();function ba(s,l,h,y){return h*=l,l*=l,y[0]*s-h*(y[1]+l*(y[2]+l*(y[3]+l*y[4])))}Z();var N_=20;function dc(s,l,h){for(var y=1/(1-l),_=s,a=N_;a;--a){var T=Math.sin(_),M=1-l*T*T;if(M=(ba(_,T,Math.cos(_),h)-s)*(M*Math.sqrt(M))*y,_-=M,Math.abs(M)<qt)return _}return _}function U_(){this.x0=this.x0!==void 0?this.x0:0,this.y0=this.y0!==void 0?this.y0:0,this.long0=this.long0!==void 0?this.long0:0,this.lat0=this.lat0!==void 0?this.lat0:0,this.es&&(this.en=pc(this.es),this.ml0=ba(this.lat0,Math.sin(this.lat0),Math.cos(this.lat0),this.en))}function V_(s){var l=s.x,h=s.y,y=$t(l-this.long0),_,a,T,M=Math.sin(h),D=Math.cos(h);if(this.es){var L=D*y,tt=Math.pow(L,2),pt=this.ep2*Math.pow(D,2),ft=Math.pow(pt,2),yt=Math.abs(D)>qt?Math.tan(h):0,Ft=Math.pow(yt,2),kt=Math.pow(Ft,2);_=1-this.es*Math.pow(M,2),L=L/Math.sqrt(_);var Ot=ba(h,M,D,this.en);a=this.a*(this.k0*L*(1+tt/6*(1-Ft+pt+tt/20*(5-18*Ft+kt+14*pt-58*Ft*pt+tt/42*(61+179*kt-kt*Ft-479*Ft)))))+this.x0,T=this.a*(this.k0*(Ot-this.ml0+M*y*L/2*(1+tt/12*(5-Ft+9*pt+4*ft+tt/30*(61+kt-58*Ft+270*pt-330*Ft*pt+tt/56*(1385+543*kt-kt*Ft-3111*Ft))))))+this.y0}else{var N=D*Math.sin(y);if(Math.abs(Math.abs(N)-1)<qt)return 93;if(a=.5*this.a*this.k0*Math.log((1+N)/(1-N))+this.x0,T=D*Math.cos(y)/Math.sqrt(1-Math.pow(N,2)),N=Math.abs(T),N>=1){if(N-1>qt)return 93;T=0}else T=Math.acos(T);h<0&&(T=-T),T=this.a*this.k0*(T-this.lat0)+this.y0}return s.x=a,s.y=T,s}function G_(s){var l,h,y,_,a=(s.x-this.x0)*(1/this.a),T=(s.y-this.y0)*(1/this.a);if(this.es)if(l=this.ml0+T/this.k0,h=dc(l,this.es,this.en),Math.abs(h)<Bt){var tt=Math.sin(h),pt=Math.cos(h),ft=Math.abs(pt)>qt?Math.tan(h):0,yt=this.ep2*Math.pow(pt,2),Ft=Math.pow(yt,2),kt=Math.pow(ft,2),Ot=Math.pow(kt,2);l=1-this.es*Math.pow(tt,2);var he=a*Math.sqrt(l)/this.k0,ne=Math.pow(he,2);l=l*ft,y=h-l*ne/(1-this.es)*.5*(1-ne/12*(5+3*kt-9*yt*kt+yt-4*Ft-ne/30*(61+90*kt-252*yt*kt+45*Ot+46*yt-ne/56*(1385+3633*kt+4095*Ot+1574*Ot*kt)))),_=$t(this.long0+he*(1-ne/6*(1+2*kt+yt-ne/20*(5+28*kt+24*Ot+8*yt*kt+6*yt-ne/42*(61+662*kt+1320*Ot+720*Ot*kt))))/pt)}else y=Bt*Pn(T),_=0;else{var M=Math.exp(a/this.k0),D=.5*(M-1/M),N=this.lat0+T/this.k0,L=Math.cos(N);l=Math.sqrt((1-Math.pow(L,2))/(1+Math.pow(D,2))),y=Math.asin(l),T<0&&(y=-y),D===0&&L===0?_=0:_=$t(Math.atan2(D,L)+this.long0)}return s.x=_,s.y=y,s}var q_=["Fast_Transverse_Mercator","Fast Transverse Mercator"],Mo={init:U_,forward:V_,inverse:G_,names:q_};Z();Z();function fc(s){var l=Math.exp(s);return l=(l-1/l)/2,l}Z();function Ar(s,l){s=Math.abs(s),l=Math.abs(l);var h=Math.max(s,l),y=Math.min(s,l)/(h||1);return h*Math.sqrt(1+Math.pow(y,2))}Z();Z();function mm(s){var l=1+s,h=l-1;return h===0?s:s*Math.log(l)/h}function gm(s){var l=Math.abs(s);return l=mm(l*(1+l/(Ar(1,l)+1))),s<0?-l:l}Z();function mc(s,l){for(var h=2*Math.cos(2*l),y=s.length-1,_=s[y],a=0,T;--y>=0;)T=-a+h*_+s[y],a=_,_=T;return l+T*Math.sin(2*l)}Z();function ym(s,l){for(var h=2*Math.cos(l),y=s.length-1,_=s[y],a=0,T;--y>=0;)T=-a+h*_+s[y],a=_,_=T;return Math.sin(l)*T}Z();Z();function _m(s){var l=Math.exp(s);return l=(l+1/l)/2,l}function ap(s,l,h){for(var y=Math.sin(l),_=Math.cos(l),a=fc(h),T=_m(h),M=2*_*T,D=-2*y*a,N=s.length-1,L=s[N],tt=0,pt=0,ft=0,yt,Ft;--N>=0;)yt=pt,Ft=tt,pt=L,tt=ft,L=-yt+M*pt-D*tt+s[N],ft=-Ft+D*pt+M*tt;return M=y*T,D=_*a,[M*L-D*ft,M*ft+D*L]}function j_(){if(!this.approx&&(isNaN(this.es)||this.es<=0))throw new Error('Incorrect elliptical usage. Try using the +approx option in the proj string, or PROJECTION["Fast_Transverse_Mercator"] in the WKT.');this.approx&&(Mo.init.apply(this),this.forward=Mo.forward,this.inverse=Mo.inverse),this.x0=this.x0!==void 0?this.x0:0,this.y0=this.y0!==void 0?this.y0:0,this.long0=this.long0!==void 0?this.long0:0,this.lat0=this.lat0!==void 0?this.lat0:0,this.cgb=[],this.cbg=[],this.utg=[],this.gtu=[];var s=this.es/(1+Math.sqrt(1-this.es)),l=s/(2-s),h=l;this.cgb[0]=l*(2+l*(-2/3+l*(-2+l*(116/45+l*(26/45+l*(-2854/675)))))),this.cbg[0]=l*(-2+l*(2/3+l*(4/3+l*(-82/45+l*(32/45+l*(4642/4725)))))),h=h*l,this.cgb[1]=h*(7/3+l*(-8/5+l*(-227/45+l*(2704/315+l*(2323/945))))),this.cbg[1]=h*(5/3+l*(-16/15+l*(-13/9+l*(904/315+l*(-1522/945))))),h=h*l,this.cgb[2]=h*(56/15+l*(-136/35+l*(-1262/105+l*(73814/2835)))),this.cbg[2]=h*(-26/15+l*(34/21+l*(8/5+l*(-12686/2835)))),h=h*l,this.cgb[3]=h*(4279/630+l*(-332/35+l*(-399572/14175))),this.cbg[3]=h*(1237/630+l*(-12/5+l*(-24832/14175))),h=h*l,this.cgb[4]=h*(4174/315+l*(-144838/6237)),this.cbg[4]=h*(-734/315+l*(109598/31185)),h=h*l,this.cgb[5]=h*(601676/22275),this.cbg[5]=h*(444337/155925),h=Math.pow(l,2),this.Qn=this.k0/(1+l)*(1+h*(1/4+h*(1/64+h/256))),this.utg[0]=l*(-.5+l*(2/3+l*(-37/96+l*(1/360+l*(81/512+l*(-96199/604800)))))),this.gtu[0]=l*(.5+l*(-2/3+l*(5/16+l*(41/180+l*(-127/288+l*(7891/37800)))))),this.utg[1]=h*(-1/48+l*(-1/15+l*(437/1440+l*(-46/105+l*(1118711/3870720))))),this.gtu[1]=h*(13/48+l*(-3/5+l*(557/1440+l*(281/630+l*(-1983433/1935360))))),h=h*l,this.utg[2]=h*(-17/480+l*(37/840+l*(209/4480+l*(-5569/90720)))),this.gtu[2]=h*(61/240+l*(-103/140+l*(15061/26880+l*(167603/181440)))),h=h*l,this.utg[3]=h*(-4397/161280+l*(11/504+l*(830251/7257600))),this.gtu[3]=h*(49561/161280+l*(-179/168+l*(6601661/7257600))),h=h*l,this.utg[4]=h*(-4583/161280+l*(108847/3991680)),this.gtu[4]=h*(34729/80640+l*(-3418889/1995840)),h=h*l,this.utg[5]=h*(-20648693/638668800),this.gtu[5]=h*(212378941/319334400);var y=mc(this.cbg,this.lat0);this.Zb=-this.Qn*(y+ym(this.gtu,2*y))}function $_(s){var l=$t(s.x-this.long0),h=s.y;h=mc(this.cbg,h);var y=Math.sin(h),_=Math.cos(h),a=Math.sin(l),T=Math.cos(l);h=Math.atan2(y,T*_),l=Math.atan2(a*_,Ar(y,_*T)),l=gm(Math.tan(l));var M=ap(this.gtu,2*h,2*l);h=h+M[0],l=l+M[1];var D,N;return Math.abs(l)<=2.623395162778?(D=this.a*(this.Qn*l)+this.x0,N=this.a*(this.Qn*h+this.Zb)+this.y0):(D=1/0,N=1/0),s.x=D,s.y=N,s}function W_(s){var l=(s.x-this.x0)*(1/this.a),h=(s.y-this.y0)*(1/this.a);h=(h-this.Zb)/this.Qn,l=l/this.Qn;var y,_;if(Math.abs(l)<=2.623395162778){var a=ap(this.utg,2*h,2*l);h=h+a[0],l=l+a[1],l=Math.atan(fc(l));var T=Math.sin(h),M=Math.cos(h),D=Math.sin(l),N=Math.cos(l);h=Math.atan2(T*N,Ar(D,N*M)),l=Math.atan2(D,N*M),y=$t(l+this.long0),_=mc(this.cgb,h)}else y=1/0,_=1/0;return s.x=y,s.y=_,s}var Z_=["Extended_Transverse_Mercator","Extended Transverse Mercator","etmerc","Transverse_Mercator","Transverse Mercator","tmerc"],So={init:j_,forward:$_,inverse:W_,names:Z_};Z();Z();function xm(s,l){if(s===void 0){if(s=Math.floor(($t(l)+Math.PI)*30/Math.PI)+1,s<0)return 0;if(s>60)return 60}return s}var H_="etmerc";function X_(){var s=xm(this.zone,this.long0);if(s===void 0)throw new Error("unknown utm zone");this.lat0=0,this.long0=(6*Math.abs(s)-183)*Ei,this.x0=5e5,this.y0=this.utmSouth?1e7:0,this.k0=.9996,So.init.apply(this),this.forward=So.forward,this.inverse=So.inverse}var K_=["Universal Transverse Mercator System","utm"],vm={init:X_,names:K_,dependsOn:H_};Z();Z();Z();function gc(s,l){return Math.pow((1-s)/(1+s),l)}var Y_=20;function J_(){var s=Math.sin(this.lat0),l=Math.cos(this.lat0);l*=l,this.rc=Math.sqrt(1-this.es)/(1-this.es*s*s),this.C=Math.sqrt(1+this.es*l*l/(1-this.es)),this.phic0=Math.asin(s/this.C),this.ratexp=.5*this.C*this.e,this.K=Math.tan(.5*this.phic0+Ze)/(Math.pow(Math.tan(.5*this.lat0+Ze),this.C)*gc(this.e*s,this.ratexp))}function Q_(s){var l=s.x,h=s.y;return s.y=2*Math.atan(this.K*Math.pow(Math.tan(.5*h+Ze),this.C)*gc(this.e*Math.sin(h),this.ratexp))-Bt,s.x=this.C*l,s}function tx(s){for(var l=1e-14,h=s.x/this.C,y=s.y,_=Math.pow(Math.tan(.5*y+Ze)/this.K,1/this.C),a=Y_;a>0&&(y=2*Math.atan(_*gc(this.e*Math.sin(s.y),-.5*this.e))-Bt,!(Math.abs(y-s.y)<l));--a)s.y=y;return a?(s.x=h,s.y=y,s):null}var ex=["gauss"],yc={init:J_,forward:Q_,inverse:tx,names:ex};function ix(){yc.init.apply(this),this.rc&&(this.sinc0=Math.sin(this.phic0),this.cosc0=Math.cos(this.phic0),this.R2=2*this.rc,this.title||(this.title="Oblique Stereographic Alternative"))}function rx(s){var l,h,y,_;return s.x=$t(s.x-this.long0),yc.forward.apply(this,[s]),l=Math.sin(s.y),h=Math.cos(s.y),y=Math.cos(s.x),_=this.k0*this.R2/(1+this.sinc0*l+this.cosc0*h*y),s.x=_*h*Math.sin(s.x),s.y=_*(this.cosc0*l-this.sinc0*h*y),s.x=this.a*s.x+this.x0,s.y=this.a*s.y+this.y0,s}function nx(s){var l,h,y,_,a;if(s.x=(s.x-this.x0)/this.a,s.y=(s.y-this.y0)/this.a,s.x/=this.k0,s.y/=this.k0,a=Math.sqrt(s.x*s.x+s.y*s.y)){var T=2*Math.atan2(a,this.R2);l=Math.sin(T),h=Math.cos(T),_=Math.asin(h*this.sinc0+s.y*l*this.cosc0/a),y=Math.atan2(s.x*l,a*this.cosc0*h-s.y*this.sinc0*l)}else _=this.phic0,y=0;return s.x=y,s.y=_,yc.inverse.apply(this,[s]),s.x=$t(s.x+this.long0),s}var sx=["Stereographic_North_Pole","Oblique_Stereographic","Polar_Stereographic","sterea","Oblique Stereographic Alternative","Double_Stereographic"],bm={init:ix,forward:rx,inverse:nx,names:sx};Z();function ax(s,l,h){return l*=h,Math.tan(.5*(Bt+s))*Math.pow((1-l)/(1+l),.5*h)}function ox(){this.coslat0=Math.cos(this.lat0),this.sinlat0=Math.sin(this.lat0),this.sphere?this.k0===1&&!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=qt&&(this.k0=.5*(1+Pn(this.lat0)*Math.sin(this.lat_ts))):(Math.abs(this.coslat0)<=qt&&(this.lat0>0?this.con=1:this.con=-1),this.cons=Math.sqrt(Math.pow(1+this.e,1+this.e)*Math.pow(1-this.e,1-this.e)),this.k0===1&&!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=qt&&(this.k0=.5*this.cons*dr(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts))/Cr(this.e,this.con*this.lat_ts,this.con*Math.sin(this.lat_ts))),this.ms1=dr(this.e,this.sinlat0,this.coslat0),this.X0=2*Math.atan(this.ssfn_(this.lat0,this.sinlat0,this.e))-Bt,this.cosX0=Math.cos(this.X0),this.sinX0=Math.sin(this.X0))}function lx(s){var l=s.x,h=s.y,y=Math.sin(h),_=Math.cos(h),a,T,M,D,N,L,tt=$t(l-this.long0);return Math.abs(Math.abs(l-this.long0)-Math.PI)<=qt&&Math.abs(h+this.lat0)<=qt?(s.x=NaN,s.y=NaN,s):this.sphere?(a=2*this.k0/(1+this.sinlat0*y+this.coslat0*_*Math.cos(tt)),s.x=this.a*a*_*Math.sin(tt)+this.x0,s.y=this.a*a*(this.coslat0*y-this.sinlat0*_*Math.cos(tt))+this.y0,s):(T=2*Math.atan(this.ssfn_(h,y,this.e))-Bt,D=Math.cos(T),M=Math.sin(T),Math.abs(this.coslat0)<=qt?(N=Cr(this.e,h*this.con,this.con*y),L=2*this.a*this.k0*N/this.cons,s.x=this.x0+L*Math.sin(l-this.long0),s.y=this.y0-this.con*L*Math.cos(l-this.long0),s):(Math.abs(this.sinlat0)<qt?(a=2*this.a*this.k0/(1+D*Math.cos(tt)),s.y=a*M):(a=2*this.a*this.k0*this.ms1/(this.cosX0*(1+this.sinX0*M+this.cosX0*D*Math.cos(tt))),s.y=a*(this.cosX0*M-this.sinX0*D*Math.cos(tt))+this.y0),s.x=a*D*Math.sin(tt)+this.x0,s))}function hx(s){s.x-=this.x0,s.y-=this.y0;var l,h,y,_,a,T=Math.sqrt(s.x*s.x+s.y*s.y);if(this.sphere){var M=2*Math.atan(T/(2*this.a*this.k0));return l=this.long0,h=this.lat0,T<=qt?(s.x=l,s.y=h,s):(h=Math.asin(Math.cos(M)*this.sinlat0+s.y*Math.sin(M)*this.coslat0/T),Math.abs(this.coslat0)<qt?this.lat0>0?l=$t(this.long0+Math.atan2(s.x,-1*s.y)):l=$t(this.long0+Math.atan2(s.x,s.y)):l=$t(this.long0+Math.atan2(s.x*Math.sin(M),T*this.coslat0*Math.cos(M)-s.y*this.sinlat0*Math.sin(M))),s.x=l,s.y=h,s)}else if(Math.abs(this.coslat0)<=qt){if(T<=qt)return h=this.lat0,l=this.long0,s.x=l,s.y=h,s;s.x*=this.con,s.y*=this.con,y=T*this.cons/(2*this.a*this.k0),h=this.con*ns(this.e,y),l=this.con*$t(this.con*this.long0+Math.atan2(s.x,-1*s.y))}else _=2*Math.atan(T*this.cosX0/(2*this.a*this.k0*this.ms1)),l=this.long0,T<=qt?a=this.X0:(a=Math.asin(Math.cos(_)*this.sinX0+s.y*Math.sin(_)*this.cosX0/T),l=$t(this.long0+Math.atan2(s.x*Math.sin(_),T*this.cosX0*Math.cos(_)-s.y*this.sinX0*Math.sin(_)))),h=-1*ns(this.e,Math.tan(.5*(Bt+a)));return s.x=l,s.y=h,s}var cx=["stere","Stereographic_South_Pole","Polar Stereographic (variant B)"],wm={init:ox,forward:lx,inverse:hx,names:cx,ssfn_:ax};Z();function ux(){var s=this.lat0;this.lambda0=this.long0;var l=Math.sin(s),h=this.a,y=this.rf,_=1/y,a=2*_-Math.pow(_,2),T=this.e=Math.sqrt(a);this.R=this.k0*h*Math.sqrt(1-a)/(1-a*Math.pow(l,2)),this.alpha=Math.sqrt(1+a/(1-a)*Math.pow(Math.cos(s),4)),this.b0=Math.asin(l/this.alpha);var M=Math.log(Math.tan(Math.PI/4+this.b0/2)),D=Math.log(Math.tan(Math.PI/4+s/2)),N=Math.log((1+T*l)/(1-T*l));this.K=M-this.alpha*D+this.alpha*T/2*N}function px(s){var l=Math.log(Math.tan(Math.PI/4-s.y/2)),h=this.e/2*Math.log((1+this.e*Math.sin(s.y))/(1-this.e*Math.sin(s.y))),y=-this.alpha*(l+h)+this.K,_=2*(Math.atan(Math.exp(y))-Math.PI/4),a=this.alpha*(s.x-this.lambda0),T=Math.atan(Math.sin(a)/(Math.sin(this.b0)*Math.tan(_)+Math.cos(this.b0)*Math.cos(a))),M=Math.asin(Math.cos(this.b0)*Math.sin(_)-Math.sin(this.b0)*Math.cos(_)*Math.cos(a));return s.y=this.R/2*Math.log((1+Math.sin(M))/(1-Math.sin(M)))+this.y0,s.x=this.R*T+this.x0,s}function dx(s){for(var l=s.x-this.x0,h=s.y-this.y0,y=l/this.R,_=2*(Math.atan(Math.exp(h/this.R))-Math.PI/4),a=Math.asin(Math.cos(this.b0)*Math.sin(_)+Math.sin(this.b0)*Math.cos(_)*Math.cos(y)),T=Math.atan(Math.sin(y)/(Math.cos(this.b0)*Math.cos(y)-Math.sin(this.b0)*Math.tan(_))),M=this.lambda0+T/this.alpha,D=0,N=a,L=-1e3,tt=0;Math.abs(N-L)>1e-7;){if(++tt>20)return;D=1/this.alpha*(Math.log(Math.tan(Math.PI/4+a/2))-this.K)+this.e*Math.log(Math.tan(Math.PI/4+Math.asin(this.e*Math.sin(N))/2)),L=N,N=2*Math.atan(Math.exp(D))-Math.PI/2}return s.x=M,s.y=N,s}var fx=["somerc"],Mm={init:ux,forward:px,inverse:dx,names:fx};Z();var To=1e-7;function mx(s){var l=["Hotine_Oblique_Mercator","Hotine_Oblique_Mercator_Azimuth_Natural_Origin"],h=typeof s.PROJECTION=="object"?Object.keys(s.PROJECTION)[0]:s.PROJECTION;return"no_uoff"in s||"no_off"in s||l.indexOf(h)!==-1}function gx(){var s,l,h,y,_,a,T,M,D,N,L=0,tt,pt=0,ft=0,yt=0,Ft=0,kt=0,Ot=0,he;this.no_off=mx(this),this.no_rot="no_rot"in this;var ne=!1;"alpha"in this&&(ne=!0);var be=!1;if("rectified_grid_angle"in this&&(be=!0),ne&&(Ot=this.alpha),be&&(L=this.rectified_grid_angle*Ei),ne||be)pt=this.longc;else if(ft=this.long1,Ft=this.lat1,yt=this.long2,kt=this.lat2,Math.abs(Ft-kt)<=To||(s=Math.abs(Ft))<=To||Math.abs(s-Bt)<=To||Math.abs(Math.abs(this.lat0)-Bt)<=To||Math.abs(Math.abs(kt)-Bt)<=To)throw new Error;var xe=1-this.es;l=Math.sqrt(xe),Math.abs(this.lat0)>qt?(M=Math.sin(this.lat0),h=Math.cos(this.lat0),s=1-this.es*M*M,this.B=h*h,this.B=Math.sqrt(1+this.es*this.B*this.B/xe),this.A=this.B*this.k0*l/s,y=this.B*l/(h*Math.sqrt(s)),_=y*y-1,_<=0?_=0:(_=Math.sqrt(_),this.lat0<0&&(_=-_)),this.E=_+=y,this.E*=Math.pow(Cr(this.e,this.lat0,M),this.B)):(this.B=1/l,this.A=this.k0,this.E=y=_=1),ne||be?(ne?(tt=Math.asin(Math.sin(Ot)/y),be||(L=Ot)):(tt=L,Ot=Math.asin(y*Math.sin(tt))),this.lam0=pt-Math.asin(.5*(_-1/_)*Math.tan(tt))/this.B):(a=Math.pow(Cr(this.e,Ft,Math.sin(Ft)),this.B),T=Math.pow(Cr(this.e,kt,Math.sin(kt)),this.B),_=this.E/a,D=(T-a)/(T+a),N=this.E*this.E,N=(N-T*a)/(N+T*a),s=ft-yt,s<-Math.pi?yt-=Os:s>Math.pi&&(yt+=Os),this.lam0=$t(.5*(ft+yt)-Math.atan(N*Math.tan(.5*this.B*(ft-yt))/D)/this.B),tt=Math.atan(2*Math.sin(this.B*$t(ft-this.lam0))/(_-1/_)),L=Ot=Math.asin(y*Math.sin(tt))),this.singam=Math.sin(tt),this.cosgam=Math.cos(tt),this.sinrot=Math.sin(L),this.cosrot=Math.cos(L),this.rB=1/this.B,this.ArB=this.A*this.rB,this.BrA=1/this.ArB,he=this.A*this.B,this.no_off?this.u_0=0:(this.u_0=Math.abs(this.ArB*Math.atan(Math.sqrt(y*y-1)/Math.cos(Ot))),this.lat0<0&&(this.u_0=-this.u_0)),_=.5*tt,this.v_pole_n=this.ArB*Math.log(Math.tan(Ze-_)),this.v_pole_s=this.ArB*Math.log(Math.tan(Ze+_))}function yx(s){var l={},h,y,_,a,T,M,D,N;if(s.x=s.x-this.lam0,Math.abs(Math.abs(s.y)-Bt)>qt){if(T=this.E/Math.pow(Cr(this.e,s.y,Math.sin(s.y)),this.B),M=1/T,h=.5*(T-M),y=.5*(T+M),a=Math.sin(this.B*s.x),_=(h*this.singam-a*this.cosgam)/y,Math.abs(Math.abs(_)-1)<qt)throw new Error;N=.5*this.ArB*Math.log((1-_)/(1+_)),M=Math.cos(this.B*s.x),Math.abs(M)<To?D=this.A*s.x:D=this.ArB*Math.atan2(h*this.cosgam+a*this.singam,M)}else N=s.y>0?this.v_pole_n:this.v_pole_s,D=this.ArB*s.y;return this.no_rot?(l.x=D,l.y=N):(D-=this.u_0,l.x=N*this.cosrot+D*this.sinrot,l.y=D*this.cosrot-N*this.sinrot),l.x=this.a*l.x+this.x0,l.y=this.a*l.y+this.y0,l}function _x(s){var l,h,y,_,a,T,M,D={};if(s.x=(s.x-this.x0)*(1/this.a),s.y=(s.y-this.y0)*(1/this.a),this.no_rot?(h=s.y,l=s.x):(h=s.x*this.cosrot-s.y*this.sinrot,l=s.y*this.cosrot+s.x*this.sinrot+this.u_0),y=Math.exp(-this.BrA*h),_=.5*(y-1/y),a=.5*(y+1/y),T=Math.sin(this.BrA*l),M=(T*this.cosgam+_*this.singam)/a,Math.abs(Math.abs(M)-1)<qt)D.x=0,D.y=M<0?-Bt:Bt;else{if(D.y=this.E/Math.sqrt((1+M)/(1-M)),D.y=ns(this.e,Math.pow(D.y,1/this.B)),D.y===1/0)throw new Error;D.x=-this.rB*Math.atan2(_*this.cosgam-T*this.singam,Math.cos(this.BrA*l))}return D.x+=this.lam0,D}var xx=["Hotine_Oblique_Mercator","Hotine Oblique Mercator","Hotine_Oblique_Mercator_Azimuth_Natural_Origin","Hotine_Oblique_Mercator_Two_Point_Natural_Origin","Hotine_Oblique_Mercator_Azimuth_Center","Oblique_Mercator","omerc"],Sm={init:gx,forward:yx,inverse:_x,names:xx};Z();function vx(){if(this.lat2||(this.lat2=this.lat1),this.k0||(this.k0=1),this.x0=this.x0||0,this.y0=this.y0||0,!(Math.abs(this.lat1+this.lat2)<qt)){var s=this.b/this.a;this.e=Math.sqrt(1-s*s);var l=Math.sin(this.lat1),h=Math.cos(this.lat1),y=dr(this.e,l,h),_=Cr(this.e,this.lat1,l),a=Math.sin(this.lat2),T=Math.cos(this.lat2),M=dr(this.e,a,T),D=Cr(this.e,this.lat2,a),N=Cr(this.e,this.lat0,Math.sin(this.lat0));Math.abs(this.lat1-this.lat2)>qt?this.ns=Math.log(y/M)/Math.log(_/D):this.ns=l,isNaN(this.ns)&&(this.ns=l),this.f0=y/(this.ns*Math.pow(_,this.ns)),this.rh=this.a*this.f0*Math.pow(N,this.ns),this.title||(this.title="Lambert Conformal Conic")}}function bx(s){var l=s.x,h=s.y;Math.abs(2*Math.abs(h)-Math.PI)<=qt&&(h=Pn(h)*(Bt-2*qt));var y=Math.abs(Math.abs(h)-Bt),_,a;if(y>qt)_=Cr(this.e,h,Math.sin(h)),a=this.a*this.f0*Math.pow(_,this.ns);else{if(y=h*this.ns,y<=0)return null;a=0}var T=this.ns*$t(l-this.long0);return s.x=this.k0*(a*Math.sin(T))+this.x0,s.y=this.k0*(this.rh-a*Math.cos(T))+this.y0,s}function wx(s){var l,h,y,_,a,T=(s.x-this.x0)/this.k0,M=this.rh-(s.y-this.y0)/this.k0;this.ns>0?(l=Math.sqrt(T*T+M*M),h=1):(l=-Math.sqrt(T*T+M*M),h=-1);var D=0;if(l!==0&&(D=Math.atan2(h*T,h*M)),l!==0||this.ns>0){if(h=1/this.ns,y=Math.pow(l/(this.a*this.f0),h),_=ns(this.e,y),_===-9999)return null}else _=-Bt;return a=$t(D/this.ns+this.long0),s.x=a,s.y=_,s}var Mx=["Lambert Tangential Conformal Conic Projection","Lambert_Conformal_Conic","Lambert_Conformal_Conic_1SP","Lambert_Conformal_Conic_2SP","lcc","Lambert Conic Conformal (1SP)","Lambert Conic Conformal (2SP)"],Tm={init:vx,forward:bx,inverse:wx,names:Mx};Z();function Sx(){this.a=6377397155e-3,this.es=.006674372230614,this.e=Math.sqrt(this.es),this.lat0||(this.lat0=.863937979737193),this.long0||(this.long0=.7417649320975901-.308341501185665),this.k0||(this.k0=.9999),this.s45=.785398163397448,this.s90=2*this.s45,this.fi0=this.lat0,this.e2=this.es,this.e=Math.sqrt(this.e2),this.alfa=Math.sqrt(1+this.e2*Math.pow(Math.cos(this.fi0),4)/(1-this.e2)),this.uq=1.04216856380474,this.u0=Math.asin(Math.sin(this.fi0)/this.alfa),this.g=Math.pow((1+this.e*Math.sin(this.fi0))/(1-this.e*Math.sin(this.fi0)),this.alfa*this.e/2),this.k=Math.tan(this.u0/2+this.s45)/Math.pow(Math.tan(this.fi0/2+this.s45),this.alfa)*this.g,this.k1=this.k0,this.n0=this.a*Math.sqrt(1-this.e2)/(1-this.e2*Math.pow(Math.sin(this.fi0),2)),this.s0=1.37008346281555,this.n=Math.sin(this.s0),this.ro0=this.k1*this.n0/Math.tan(this.s0),this.ad=this.s90-this.uq}function Tx(s){var l,h,y,_,a,T,M,D=s.x,N=s.y,L=$t(D-this.long0);return l=Math.pow((1+this.e*Math.sin(N))/(1-this.e*Math.sin(N)),this.alfa*this.e/2),h=2*(Math.atan(this.k*Math.pow(Math.tan(N/2+this.s45),this.alfa)/l)-this.s45),y=-L*this.alfa,_=Math.asin(Math.cos(this.ad)*Math.sin(h)+Math.sin(this.ad)*Math.cos(h)*Math.cos(y)),a=Math.asin(Math.cos(h)*Math.sin(y)/Math.cos(_)),T=this.n*a,M=this.ro0*Math.pow(Math.tan(this.s0/2+this.s45),this.n)/Math.pow(Math.tan(_/2+this.s45),this.n),s.y=M*Math.cos(T)/1,s.x=M*Math.sin(T)/1,this.czech||(s.y*=-1,s.x*=-1),s}function Ex(s){var l,h,y,_,a,T,M,D,N=s.x;s.x=s.y,s.y=N,this.czech||(s.y*=-1,s.x*=-1),T=Math.sqrt(s.x*s.x+s.y*s.y),a=Math.atan2(s.y,s.x),_=a/Math.sin(this.s0),y=2*(Math.atan(Math.pow(this.ro0/T,1/this.n)*Math.tan(this.s0/2+this.s45))-this.s45),l=Math.asin(Math.cos(this.ad)*Math.sin(y)-Math.sin(this.ad)*Math.cos(y)*Math.cos(_)),h=Math.asin(Math.cos(y)*Math.sin(_)/Math.cos(l)),s.x=this.long0-h/this.alfa,M=l,D=0;var L=0;do s.y=2*(Math.atan(Math.pow(this.k,-1/this.alfa)*Math.pow(Math.tan(l/2+this.s45),1/this.alfa)*Math.pow((1+this.e*Math.sin(M))/(1-this.e*Math.sin(M)),this.e/2))-this.s45),Math.abs(M-s.y)<1e-10&&(D=1),M=s.y,L+=1;while(D===0&&L<15);return L>=15?null:s}var Ix=["Krovak","krovak"],Em={init:Sx,forward:Tx,inverse:Ex,names:Ix};Z();Z();function Ki(s,l,h,y,_){return s*_-l*Math.sin(2*_)+h*Math.sin(4*_)-y*Math.sin(6*_)}Z();function ss(s){return 1-.25*s*(1+s/16*(3+1.25*s))}Z();function as(s){return .375*s*(1+.25*s*(1+.46875*s))}Z();function os(s){return .05859375*s*s*(1+.75*s)}Z();function ls(s){return s*s*s*(35/3072)}Z();function hs(s,l,h){var y=l*h;return s/Math.sqrt(1-y*y)}Z();function Mn(s){return Math.abs(s)<Bt?s:s-Pn(s)*Math.PI}Z();function wa(s,l,h,y,_){var a,T;a=s/l;for(var M=0;M<15;M++)if(T=(s-(l*a-h*Math.sin(2*a)+y*Math.sin(4*a)-_*Math.sin(6*a)))/(l-2*h*Math.cos(2*a)+4*y*Math.cos(4*a)-6*_*Math.cos(6*a)),a+=T,Math.abs(T)<=1e-10)return a;return NaN}function Cx(){this.sphere||(this.e0=ss(this.es),this.e1=as(this.es),this.e2=os(this.es),this.e3=ls(this.es),this.ml0=this.a*Ki(this.e0,this.e1,this.e2,this.e3,this.lat0))}function Ax(s){var l,h,y=s.x,_=s.y;if(y=$t(y-this.long0),this.sphere)l=this.a*Math.asin(Math.cos(_)*Math.sin(y)),h=this.a*(Math.atan2(Math.tan(_),Math.cos(y))-this.lat0);else{var a=Math.sin(_),T=Math.cos(_),M=hs(this.a,this.e,a),D=Math.tan(_)*Math.tan(_),N=y*Math.cos(_),L=N*N,tt=this.es*T*T/(1-this.es),pt=this.a*Ki(this.e0,this.e1,this.e2,this.e3,_);l=M*N*(1-L*D*(1/6-(8-D+8*tt)*L/120)),h=pt-this.ml0+M*a/T*L*(.5+(5-D+6*tt)*L/24)}return s.x=l+this.x0,s.y=h+this.y0,s}function Px(s){s.x-=this.x0,s.y-=this.y0;var l=s.x/this.a,h=s.y/this.a,y,_;if(this.sphere){var a=h+this.lat0;y=Math.asin(Math.sin(a)*Math.cos(l)),_=Math.atan2(Math.tan(l),Math.cos(a))}else{var T=this.ml0/this.a+h,M=wa(T,this.e0,this.e1,this.e2,this.e3);if(Math.abs(Math.abs(M)-Bt)<=qt)return s.x=this.long0,s.y=Bt,h<0&&(s.y*=-1),s;var D=hs(this.a,this.e,Math.sin(M)),N=D*D*D/this.a/this.a*(1-this.es),L=Math.pow(Math.tan(M),2),tt=l*this.a/D,pt=tt*tt;y=M-D*Math.tan(M)/N*tt*tt*(.5-(1+3*L)*tt*tt/24),_=tt*(1-pt*(L/3+(1+3*L)*L*pt/15))/Math.cos(M)}return s.x=$t(_+this.long0),s.y=Mn(y),s}var zx=["Cassini","Cassini_Soldner","cass"],Im={init:Cx,forward:Ax,inverse:Px,names:zx};Z();Z();function Sn(s,l){var h;return s>1e-7?(h=s*l,(1-s*s)*(l/(1-h*h)-.5/s*Math.log((1-h)/(1+h)))):2*l}var kx=1,Lx=2,Dx=3,Rx=4;function Bx(){var s=Math.abs(this.lat0);if(Math.abs(s-Bt)<qt?this.mode=this.lat0<0?this.S_POLE:this.N_POLE:Math.abs(s)<qt?this.mode=this.EQUIT:this.mode=this.OBLIQ,this.es>0){var l;switch(this.qp=Sn(this.e,1),this.mmf=.5/(1-this.es),this.apa=$x(this.es),this.mode){case this.N_POLE:this.dd=1;break;case this.S_POLE:this.dd=1;break;case this.EQUIT:this.rq=Math.sqrt(.5*this.qp),this.dd=1/this.rq,this.xmf=1,this.ymf=.5*this.qp;break;case this.OBLIQ:this.rq=Math.sqrt(.5*this.qp),l=Math.sin(this.lat0),this.sinb1=Sn(this.e,l)/this.qp,this.cosb1=Math.sqrt(1-this.sinb1*this.sinb1),this.dd=Math.cos(this.lat0)/(Math.sqrt(1-this.es*l*l)*this.rq*this.cosb1),this.ymf=(this.xmf=this.rq)/this.dd,this.xmf*=this.dd;break}}else this.mode===this.OBLIQ&&(this.sinph0=Math.sin(this.lat0),this.cosph0=Math.cos(this.lat0))}function Fx(s){var l,h,y,_,a,T,M,D,N,L,tt=s.x,pt=s.y;if(tt=$t(tt-this.long0),this.sphere){if(a=Math.sin(pt),L=Math.cos(pt),y=Math.cos(tt),this.mode===this.OBLIQ||this.mode===this.EQUIT){if(h=this.mode===this.EQUIT?1+L*y:1+this.sinph0*a+this.cosph0*L*y,h<=qt)return null;h=Math.sqrt(2/h),l=h*L*Math.sin(tt),h*=this.mode===this.EQUIT?a:this.cosph0*a-this.sinph0*L*y}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(y=-y),Math.abs(pt+this.lat0)<qt)return null;h=Ze-pt*.5,h=2*(this.mode===this.S_POLE?Math.cos(h):Math.sin(h)),l=h*Math.sin(tt),h*=y}}else{switch(M=0,D=0,N=0,y=Math.cos(tt),_=Math.sin(tt),a=Math.sin(pt),T=Sn(this.e,a),(this.mode===this.OBLIQ||this.mode===this.EQUIT)&&(M=T/this.qp,D=Math.sqrt(1-M*M)),this.mode){case this.OBLIQ:N=1+this.sinb1*M+this.cosb1*D*y;break;case this.EQUIT:N=1+D*y;break;case this.N_POLE:N=Bt+pt,T=this.qp-T;break;case this.S_POLE:N=pt-Bt,T=this.qp+T;break}if(Math.abs(N)<qt)return null;switch(this.mode){case this.OBLIQ:case this.EQUIT:N=Math.sqrt(2/N),this.mode===this.OBLIQ?h=this.ymf*N*(this.cosb1*M-this.sinb1*D*y):h=(N=Math.sqrt(2/(1+D*y)))*M*this.ymf,l=this.xmf*N*D*_;break;case this.N_POLE:case this.S_POLE:T>=0?(l=(N=Math.sqrt(T))*_,h=y*(this.mode===this.S_POLE?N:-N)):l=h=0;break}}return s.x=this.a*l+this.x0,s.y=this.a*h+this.y0,s}function Ox(s){s.x-=this.x0,s.y-=this.y0;var l=s.x/this.a,h=s.y/this.a,y,_,a,T,M,D,N;if(this.sphere){var L=0,tt,pt=0;if(tt=Math.sqrt(l*l+h*h),_=tt*.5,_>1)return null;switch(_=2*Math.asin(_),(this.mode===this.OBLIQ||this.mode===this.EQUIT)&&(pt=Math.sin(_),L=Math.cos(_)),this.mode){case this.EQUIT:_=Math.abs(tt)<=qt?0:Math.asin(h*pt/tt),l*=pt,h=L*tt;break;case this.OBLIQ:_=Math.abs(tt)<=qt?this.lat0:Math.asin(L*this.sinph0+h*pt*this.cosph0/tt),l*=pt*this.cosph0,h=(L-Math.sin(_)*this.sinph0)*tt;break;case this.N_POLE:h=-h,_=Bt-_;break;case this.S_POLE:_-=Bt;break}y=h===0&&(this.mode===this.EQUIT||this.mode===this.OBLIQ)?0:Math.atan2(l,h)}else{if(N=0,this.mode===this.OBLIQ||this.mode===this.EQUIT){if(l/=this.dd,h*=this.dd,D=Math.sqrt(l*l+h*h),D<qt)return s.x=this.long0,s.y=this.lat0,s;T=2*Math.asin(.5*D/this.rq),a=Math.cos(T),l*=T=Math.sin(T),this.mode===this.OBLIQ?(N=a*this.sinb1+h*T*this.cosb1/D,M=this.qp*N,h=D*this.cosb1*a-h*this.sinb1*T):(N=h*T/D,M=this.qp*N,h=D*a)}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(h=-h),M=l*l+h*h,!M)return s.x=this.long0,s.y=this.lat0,s;N=1-M/this.qp,this.mode===this.S_POLE&&(N=-N)}y=Math.atan2(l,h),_=Wx(Math.asin(N),this.apa)}return s.x=$t(this.long0+y),s.y=_,s}var Nx=.3333333333333333,Ux=.17222222222222222,Vx=.10257936507936508,Gx=.06388888888888888,qx=.0664021164021164,jx=.016415012942191543;function $x(s){var l,h=[];return h[0]=s*Nx,l=s*s,h[0]+=l*Ux,h[1]=l*Gx,l*=s,h[0]+=l*Vx,h[1]+=l*qx,h[2]=l*jx,h}function Wx(s,l){var h=s+s;return s+l[0]*Math.sin(h)+l[1]*Math.sin(h+h)+l[2]*Math.sin(h+h+h)}var Zx=["Lambert Azimuthal Equal Area","Lambert_Azimuthal_Equal_Area","laea"],Cm={init:Bx,forward:Fx,inverse:Ox,names:Zx,S_POLE:kx,N_POLE:Lx,EQUIT:Dx,OBLIQ:Rx};Z();Z();function qr(s){return Math.abs(s)>1&&(s=s>1?1:-1),Math.asin(s)}function Hx(){Math.abs(this.lat1+this.lat2)<qt||(this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e3=Math.sqrt(this.es),this.sin_po=Math.sin(this.lat1),this.cos_po=Math.cos(this.lat1),this.t1=this.sin_po,this.con=this.sin_po,this.ms1=dr(this.e3,this.sin_po,this.cos_po),this.qs1=Sn(this.e3,this.sin_po,this.cos_po),this.sin_po=Math.sin(this.lat2),this.cos_po=Math.cos(this.lat2),this.t2=this.sin_po,this.ms2=dr(this.e3,this.sin_po,this.cos_po),this.qs2=Sn(this.e3,this.sin_po,this.cos_po),this.sin_po=Math.sin(this.lat0),this.cos_po=Math.cos(this.lat0),this.t3=this.sin_po,this.qs0=Sn(this.e3,this.sin_po,this.cos_po),Math.abs(this.lat1-this.lat2)>qt?this.ns0=(this.ms1*this.ms1-this.ms2*this.ms2)/(this.qs2-this.qs1):this.ns0=this.con,this.c=this.ms1*this.ms1+this.ns0*this.qs1,this.rh=this.a*Math.sqrt(this.c-this.ns0*this.qs0)/this.ns0)}function Xx(s){var l=s.x,h=s.y;this.sin_phi=Math.sin(h),this.cos_phi=Math.cos(h);var y=Sn(this.e3,this.sin_phi,this.cos_phi),_=this.a*Math.sqrt(this.c-this.ns0*y)/this.ns0,a=this.ns0*$t(l-this.long0),T=_*Math.sin(a)+this.x0,M=this.rh-_*Math.cos(a)+this.y0;return s.x=T,s.y=M,s}function Kx(s){var l,h,y,_,a,T;return s.x-=this.x0,s.y=this.rh-s.y+this.y0,this.ns0>=0?(l=Math.sqrt(s.x*s.x+s.y*s.y),y=1):(l=-Math.sqrt(s.x*s.x+s.y*s.y),y=-1),_=0,l!==0&&(_=Math.atan2(y*s.x,y*s.y)),y=l*this.ns0/this.a,this.sphere?T=Math.asin((this.c-y*y)/(2*this.ns0)):(h=(this.c-y*y)/this.ns0,T=this.phi1z(this.e3,h)),a=$t(_/this.ns0+this.long0),s.x=a,s.y=T,s}function Yx(s,l){var h,y,_,a,T,M=qr(.5*l);if(s<qt)return M;for(var D=s*s,N=1;N<=25;N++)if(h=Math.sin(M),y=Math.cos(M),_=s*h,a=1-_*_,T=.5*a*a/y*(l/(1-D)-h/a+.5/s*Math.log((1-_)/(1+_))),M=M+T,Math.abs(T)<=1e-7)return M;return null}var Jx=["Albers_Conic_Equal_Area","Albers","aea"],Am={init:Hx,forward:Xx,inverse:Kx,names:Jx,phi1z:Yx};Z();function Qx(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0),this.infinity_dist=1e3*this.a,this.rc=1}function tv(s){var l,h,y,_,a,T,M,D,N=s.x,L=s.y;return y=$t(N-this.long0),l=Math.sin(L),h=Math.cos(L),_=Math.cos(y),T=this.sin_p14*l+this.cos_p14*h*_,a=1,T>0||Math.abs(T)<=qt?(M=this.x0+this.a*a*h*Math.sin(y)/T,D=this.y0+this.a*a*(this.cos_p14*l-this.sin_p14*h*_)/T):(M=this.x0+this.infinity_dist*h*Math.sin(y),D=this.y0+this.infinity_dist*(this.cos_p14*l-this.sin_p14*h*_)),s.x=M,s.y=D,s}function ev(s){var l,h,y,_,a,T;return s.x=(s.x-this.x0)/this.a,s.y=(s.y-this.y0)/this.a,s.x/=this.k0,s.y/=this.k0,(l=Math.sqrt(s.x*s.x+s.y*s.y))?(_=Math.atan2(l,this.rc),h=Math.sin(_),y=Math.cos(_),T=qr(y*this.sin_p14+s.y*h*this.cos_p14/l),a=Math.atan2(s.x*h,l*this.cos_p14*y-s.y*this.sin_p14*h),a=$t(this.long0+a)):(T=this.phic0,a=0),s.x=a,s.y=T,s}var iv=["gnom"],Pm={init:Qx,forward:tv,inverse:ev,names:iv};Z();Z();function zm(s,l){var h=1-(1-s*s)/(2*s)*Math.log((1-s)/(1+s));if(Math.abs(Math.abs(l)-h)<1e-6)return l<0?-1*Bt:Bt;for(var y=Math.asin(.5*l),_,a,T,M,D=0;D<30;D++)if(a=Math.sin(y),T=Math.cos(y),M=s*a,_=Math.pow(1-M*M,2)/(2*T)*(l/(1-s*s)-a/(1-M*M)+.5/s*Math.log((1-M)/(1+M))),y+=_,Math.abs(_)<=1e-10)return y;return NaN}function rv(){this.sphere||(this.k0=dr(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)))}function nv(s){var l=s.x,h=s.y,y,_,a=$t(l-this.long0);if(this.sphere)y=this.x0+this.a*a*Math.cos(this.lat_ts),_=this.y0+this.a*Math.sin(h)/Math.cos(this.lat_ts);else{var T=Sn(this.e,Math.sin(h));y=this.x0+this.a*this.k0*a,_=this.y0+this.a*T*.5/this.k0}return s.x=y,s.y=_,s}function sv(s){s.x-=this.x0,s.y-=this.y0;var l,h;return this.sphere?(l=$t(this.long0+s.x/this.a/Math.cos(this.lat_ts)),h=Math.asin(s.y/this.a*Math.cos(this.lat_ts))):(h=zm(this.e,2*s.y*this.k0/this.a),l=$t(this.long0+s.x/(this.a*this.k0))),s.x=l,s.y=h,s}var av=["cea"],km={init:rv,forward:nv,inverse:sv,names:av};Z();function ov(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||"Equidistant Cylindrical (Plate Carre)",this.rc=Math.cos(this.lat_ts)}function lv(s){var l=s.x,h=s.y,y=$t(l-this.long0),_=Mn(h-this.lat0);return s.x=this.x0+this.a*y*this.rc,s.y=this.y0+this.a*_,s}function hv(s){var l=s.x,h=s.y;return s.x=$t(this.long0+(l-this.x0)/(this.a*this.rc)),s.y=Mn(this.lat0+(h-this.y0)/this.a),s}var cv=["Equirectangular","Equidistant_Cylindrical","eqc"],Lm={init:ov,forward:lv,inverse:hv,names:cv};Z();var Dm=20;function uv(){this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e=Math.sqrt(this.es),this.e0=ss(this.es),this.e1=as(this.es),this.e2=os(this.es),this.e3=ls(this.es),this.ml0=this.a*Ki(this.e0,this.e1,this.e2,this.e3,this.lat0)}function pv(s){var l=s.x,h=s.y,y,_,a,T=$t(l-this.long0);if(a=T*Math.sin(h),this.sphere)Math.abs(h)<=qt?(y=this.a*T,_=-1*this.a*this.lat0):(y=this.a*Math.sin(a)/Math.tan(h),_=this.a*(Mn(h-this.lat0)+(1-Math.cos(a))/Math.tan(h)));else if(Math.abs(h)<=qt)y=this.a*T,_=-1*this.ml0;else{var M=hs(this.a,this.e,Math.sin(h))/Math.tan(h);y=M*Math.sin(a),_=this.a*Ki(this.e0,this.e1,this.e2,this.e3,h)-this.ml0+M*(1-Math.cos(a))}return s.x=y+this.x0,s.y=_+this.y0,s}function dv(s){var l,h,y,_,a,T,M,D,N;if(y=s.x-this.x0,_=s.y-this.y0,this.sphere)if(Math.abs(_+this.a*this.lat0)<=qt)l=$t(y/this.a+this.long0),h=0;else{T=this.lat0+_/this.a,M=y*y/this.a/this.a+T*T,D=T;var L;for(a=Dm;a;--a)if(L=Math.tan(D),N=-1*(T*(D*L+1)-D-.5*(D*D+M)*L)/((D-T)/L-1),D+=N,Math.abs(N)<=qt){h=D;break}l=$t(this.long0+Math.asin(y*Math.tan(D)/this.a)/Math.sin(h))}else if(Math.abs(_+this.ml0)<=qt)h=0,l=$t(this.long0+y/this.a);else{T=(this.ml0+_)/this.a,M=y*y/this.a/this.a+T*T,D=T;var tt,pt,ft,yt,Ft;for(a=Dm;a;--a)if(Ft=this.e*Math.sin(D),tt=Math.sqrt(1-Ft*Ft)*Math.tan(D),pt=this.a*Ki(this.e0,this.e1,this.e2,this.e3,D),ft=this.e0-2*this.e1*Math.cos(2*D)+4*this.e2*Math.cos(4*D)-6*this.e3*Math.cos(6*D),yt=pt/this.a,N=(T*(tt*yt+1)-yt-.5*tt*(yt*yt+M))/(this.es*Math.sin(2*D)*(yt*yt+M-2*T*yt)/(4*tt)+(T-yt)*(tt*ft-2/Math.sin(2*D))-ft),D-=N,Math.abs(N)<=qt){h=D;break}tt=Math.sqrt(1-this.es*Math.pow(Math.sin(h),2))*Math.tan(h),l=$t(this.long0+Math.asin(y*tt/this.a)/Math.sin(h))}return s.x=l,s.y=h,s}var fv=["Polyconic","poly"],Rm={init:uv,forward:pv,inverse:dv,names:fv};Z();function mv(){this.A=[],this.A[1]=.6399175073,this.A[2]=-.1358797613,this.A[3]=.063294409,this.A[4]=-.02526853,this.A[5]=.0117879,this.A[6]=-.0055161,this.A[7]=.0026906,this.A[8]=-.001333,this.A[9]=67e-5,this.A[10]=-34e-5,this.B_re=[],this.B_im=[],this.B_re[1]=.7557853228,this.B_im[1]=0,this.B_re[2]=.249204646,this.B_im[2]=.003371507,this.B_re[3]=-.001541739,this.B_im[3]=.04105856,this.B_re[4]=-.10162907,this.B_im[4]=.01727609,this.B_re[5]=-.26623489,this.B_im[5]=-.36249218,this.B_re[6]=-.6870983,this.B_im[6]=-1.1651967,this.C_re=[],this.C_im=[],this.C_re[1]=1.3231270439,this.C_im[1]=0,this.C_re[2]=-.577245789,this.C_im[2]=-.007809598,this.C_re[3]=.508307513,this.C_im[3]=-.112208952,this.C_re[4]=-.15094762,this.C_im[4]=.18200602,this.C_re[5]=1.01418179,this.C_im[5]=1.64497696,this.C_re[6]=1.9660549,this.C_im[6]=2.5127645,this.D=[],this.D[1]=1.5627014243,this.D[2]=.5185406398,this.D[3]=-.03333098,this.D[4]=-.1052906,this.D[5]=-.0368594,this.D[6]=.007317,this.D[7]=.0122,this.D[8]=.00394,this.D[9]=-.0013}function gv(s){var l,h=s.x,y=s.y,_=y-this.lat0,a=h-this.long0,T=_/_a*1e-5,M=a,D=1,N=0;for(l=1;l<=10;l++)D=D*T,N=N+this.A[l]*D;var L=N,tt=M,pt=1,ft=0,yt,Ft,kt=0,Ot=0;for(l=1;l<=6;l++)yt=pt*L-ft*tt,Ft=ft*L+pt*tt,pt=yt,ft=Ft,kt=kt+this.B_re[l]*pt-this.B_im[l]*ft,Ot=Ot+this.B_im[l]*pt+this.B_re[l]*ft;return s.x=Ot*this.a+this.x0,s.y=kt*this.a+this.y0,s}function yv(s){var l,h=s.x,y=s.y,_=h-this.x0,a=y-this.y0,T=a/this.a,M=_/this.a,D=1,N=0,L,tt,pt=0,ft=0;for(l=1;l<=6;l++)L=D*T-N*M,tt=N*T+D*M,D=L,N=tt,pt=pt+this.C_re[l]*D-this.C_im[l]*N,ft=ft+this.C_im[l]*D+this.C_re[l]*N;for(var yt=0;yt<this.iterations;yt++){var Ft=pt,kt=ft,Ot,he,ne=T,be=M;for(l=2;l<=6;l++)Ot=Ft*pt-kt*ft,he=kt*pt+Ft*ft,Ft=Ot,kt=he,ne=ne+(l-1)*(this.B_re[l]*Ft-this.B_im[l]*kt),be=be+(l-1)*(this.B_im[l]*Ft+this.B_re[l]*kt);Ft=1,kt=0;var xe=this.B_re[1],me=this.B_im[1];for(l=2;l<=6;l++)Ot=Ft*pt-kt*ft,he=kt*pt+Ft*ft,Ft=Ot,kt=he,xe=xe+l*(this.B_re[l]*Ft-this.B_im[l]*kt),me=me+l*(this.B_im[l]*Ft+this.B_re[l]*kt);var Ge=xe*xe+me*me;pt=(ne*xe+be*me)/Ge,ft=(be*xe-ne*me)/Ge}var Ne=pt,di=ft,Bi=1,Yi=0;for(l=1;l<=9;l++)Bi=Bi*Ne,Yi=Yi+this.D[l]*Bi;var Fi=this.lat0+Yi*_a*1e5,jr=this.long0+di;return s.x=jr,s.y=Fi,s}var _v=["New_Zealand_Map_Grid","nzmg"],Bm={init:mv,forward:gv,inverse:yv,names:_v};Z();function xv(){}function vv(s){var l=s.x,h=s.y,y=$t(l-this.long0),_=this.x0+this.a*y,a=this.y0+this.a*Math.log(Math.tan(Math.PI/4+h/2.5))*1.25;return s.x=_,s.y=a,s}function bv(s){s.x-=this.x0,s.y-=this.y0;var l=$t(this.long0+s.x/this.a),h=2.5*(Math.atan(Math.exp(.8*s.y/this.a))-Math.PI/4);return s.x=l,s.y=h,s}var wv=["Miller_Cylindrical","mill"],Fm={init:xv,forward:vv,inverse:bv,names:wv};Z();var Mv=20;function Sv(){this.sphere?(this.n=1,this.m=0,this.es=0,this.C_y=Math.sqrt((this.m+1)/this.n),this.C_x=this.C_y/(this.m+1)):this.en=pc(this.es)}function Tv(s){var l,h,y=s.x,_=s.y;if(y=$t(y-this.long0),this.sphere){if(!this.m)_=this.n!==1?Math.asin(this.n*Math.sin(_)):_;else for(var a=this.n*Math.sin(_),T=Mv;T;--T){var M=(this.m*_+Math.sin(_)-a)/(this.m+Math.cos(_));if(_-=M,Math.abs(M)<qt)break}l=this.a*this.C_x*y*(this.m+Math.cos(_)),h=this.a*this.C_y*_}else{var D=Math.sin(_),N=Math.cos(_);h=this.a*ba(_,D,N,this.en),l=this.a*y*N/Math.sqrt(1-this.es*D*D)}return s.x=l,s.y=h,s}function Ev(s){var l,h,y,_;return s.x-=this.x0,y=s.x/this.a,s.y-=this.y0,l=s.y/this.a,this.sphere?(l/=this.C_y,y=y/(this.C_x*(this.m+Math.cos(l))),this.m?l=qr((this.m*l+Math.sin(l))/this.n):this.n!==1&&(l=qr(Math.sin(l)/this.n)),y=$t(y+this.long0),l=Mn(l)):(l=dc(s.y/this.a,this.es,this.en),_=Math.abs(l),_<Bt?(_=Math.sin(l),h=this.long0+s.x*Math.sqrt(1-this.es*_*_)/(this.a*Math.cos(l)),y=$t(h)):_-qt<Bt&&(y=this.long0)),s.x=y,s.y=l,s}var Iv=["Sinusoidal","sinu"],Om={init:Sv,forward:Tv,inverse:Ev,names:Iv};Z();function Cv(){}function Av(s){for(var l=s.x,h=s.y,y=$t(l-this.long0),_=h,a=Math.PI*Math.sin(h);;){var T=-(_+Math.sin(_)-a)/(1+Math.cos(_));if(_+=T,Math.abs(T)<qt)break}_/=2,Math.PI/2-Math.abs(h)<qt&&(y=0);var M=.900316316158*this.a*y*Math.cos(_)+this.x0,D=1.4142135623731*this.a*Math.sin(_)+this.y0;return s.x=M,s.y=D,s}function Pv(s){var l,h;s.x-=this.x0,s.y-=this.y0,h=s.y/(1.4142135623731*this.a),Math.abs(h)>.999999999999&&(h=.999999999999),l=Math.asin(h);var y=$t(this.long0+s.x/(.900316316158*this.a*Math.cos(l)));y<-Math.PI&&(y=-Math.PI),y>Math.PI&&(y=Math.PI),h=(2*l+Math.sin(2*l))/Math.PI,Math.abs(h)>1&&(h=1);var _=Math.asin(h);return s.x=y,s.y=_,s}var zv=["Mollweide","moll"],Nm={init:Cv,forward:Av,inverse:Pv,names:zv};Z();function kv(){Math.abs(this.lat1+this.lat2)<qt||(this.lat2=this.lat2||this.lat1,this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e=Math.sqrt(this.es),this.e0=ss(this.es),this.e1=as(this.es),this.e2=os(this.es),this.e3=ls(this.es),this.sinphi=Math.sin(this.lat1),this.cosphi=Math.cos(this.lat1),this.ms1=dr(this.e,this.sinphi,this.cosphi),this.ml1=Ki(this.e0,this.e1,this.e2,this.e3,this.lat1),Math.abs(this.lat1-this.lat2)<qt?this.ns=this.sinphi:(this.sinphi=Math.sin(this.lat2),this.cosphi=Math.cos(this.lat2),this.ms2=dr(this.e,this.sinphi,this.cosphi),this.ml2=Ki(this.e0,this.e1,this.e2,this.e3,this.lat2),this.ns=(this.ms1-this.ms2)/(this.ml2-this.ml1)),this.g=this.ml1+this.ms1/this.ns,this.ml0=Ki(this.e0,this.e1,this.e2,this.e3,this.lat0),this.rh=this.a*(this.g-this.ml0))}function Lv(s){var l=s.x,h=s.y,y;if(this.sphere)y=this.a*(this.g-h);else{var _=Ki(this.e0,this.e1,this.e2,this.e3,h);y=this.a*(this.g-_)}var a=this.ns*$t(l-this.long0),T=this.x0+y*Math.sin(a),M=this.y0+this.rh-y*Math.cos(a);return s.x=T,s.y=M,s}function Dv(s){s.x-=this.x0,s.y=this.rh-s.y+this.y0;var l,h,y,_;this.ns>=0?(h=Math.sqrt(s.x*s.x+s.y*s.y),l=1):(h=-Math.sqrt(s.x*s.x+s.y*s.y),l=-1);var a=0;if(h!==0&&(a=Math.atan2(l*s.x,l*s.y)),this.sphere)return _=$t(this.long0+a/this.ns),y=Mn(this.g-h/this.a),s.x=_,s.y=y,s;var T=this.g-h/this.a;return y=wa(T,this.e0,this.e1,this.e2,this.e3),_=$t(this.long0+a/this.ns),s.x=_,s.y=y,s}var Rv=["Equidistant_Conic","eqdc"],Um={init:kv,forward:Lv,inverse:Dv,names:Rv};Z();function Bv(){this.R=this.a}function Fv(s){var l=s.x,h=s.y,y=$t(l-this.long0),_,a;Math.abs(h)<=qt&&(_=this.x0+this.R*y,a=this.y0);var T=qr(2*Math.abs(h/Math.PI));(Math.abs(y)<=qt||Math.abs(Math.abs(h)-Bt)<=qt)&&(_=this.x0,h>=0?a=this.y0+Math.PI*this.R*Math.tan(.5*T):a=this.y0+Math.PI*this.R*-Math.tan(.5*T));var M=.5*Math.abs(Math.PI/y-y/Math.PI),D=M*M,N=Math.sin(T),L=Math.cos(T),tt=L/(N+L-1),pt=tt*tt,ft=tt*(2/N-1),yt=ft*ft,Ft=Math.PI*this.R*(M*(tt-yt)+Math.sqrt(D*(tt-yt)*(tt-yt)-(yt+D)*(pt-yt)))/(yt+D);y<0&&(Ft=-Ft),_=this.x0+Ft;var kt=D+tt;return Ft=Math.PI*this.R*(ft*kt-M*Math.sqrt((yt+D)*(D+1)-kt*kt))/(yt+D),h>=0?a=this.y0+Ft:a=this.y0-Ft,s.x=_,s.y=a,s}function Ov(s){var l,h,y,_,a,T,M,D,N,L,tt,pt,ft;return s.x-=this.x0,s.y-=this.y0,tt=Math.PI*this.R,y=s.x/tt,_=s.y/tt,a=y*y+_*_,T=-Math.abs(_)*(1+a),M=T-2*_*_+y*y,D=-2*T+1+2*_*_+a*a,ft=_*_/D+(2*M*M*M/D/D/D-9*T*M/D/D)/27,N=(T-M*M/3/D)/D,L=2*Math.sqrt(-N/3),tt=3*ft/N/L,Math.abs(tt)>1&&(tt>=0?tt=1:tt=-1),pt=Math.acos(tt)/3,s.y>=0?h=(-L*Math.cos(pt+Math.PI/3)-M/3/D)*Math.PI:h=-(-L*Math.cos(pt+Math.PI/3)-M/3/D)*Math.PI,Math.abs(y)<qt?l=this.long0:l=$t(this.long0+Math.PI*(a-1+Math.sqrt(1+2*(y*y-_*_)+a*a))/2/y),s.x=l,s.y=h,s}var Nv=["Van_der_Grinten_I","VanDerGrinten","vandg"],Vm={init:Bv,forward:Fv,inverse:Ov,names:Nv};Z();function Uv(){this.sin_p12=Math.sin(this.lat0),this.cos_p12=Math.cos(this.lat0)}function Vv(s){var l=s.x,h=s.y,y=Math.sin(s.y),_=Math.cos(s.y),a=$t(l-this.long0),T,M,D,N,L,tt,pt,ft,yt,Ft,kt,Ot,he,ne,be,xe,me,Ge,Ne,di,Bi,Yi,Fi;return this.sphere?Math.abs(this.sin_p12-1)<=qt?(s.x=this.x0+this.a*(Bt-h)*Math.sin(a),s.y=this.y0-this.a*(Bt-h)*Math.cos(a),s):Math.abs(this.sin_p12+1)<=qt?(s.x=this.x0+this.a*(Bt+h)*Math.sin(a),s.y=this.y0+this.a*(Bt+h)*Math.cos(a),s):(Ge=this.sin_p12*y+this.cos_p12*_*Math.cos(a),xe=Math.acos(Ge),me=xe?xe/Math.sin(xe):1,s.x=this.x0+this.a*me*_*Math.sin(a),s.y=this.y0+this.a*me*(this.cos_p12*y-this.sin_p12*_*Math.cos(a)),s):(T=ss(this.es),M=as(this.es),D=os(this.es),N=ls(this.es),Math.abs(this.sin_p12-1)<=qt?(L=this.a*Ki(T,M,D,N,Bt),tt=this.a*Ki(T,M,D,N,h),s.x=this.x0+(L-tt)*Math.sin(a),s.y=this.y0-(L-tt)*Math.cos(a),s):Math.abs(this.sin_p12+1)<=qt?(L=this.a*Ki(T,M,D,N,Bt),tt=this.a*Ki(T,M,D,N,h),s.x=this.x0+(L+tt)*Math.sin(a),s.y=this.y0+(L+tt)*Math.cos(a),s):(pt=y/_,ft=hs(this.a,this.e,this.sin_p12),yt=hs(this.a,this.e,y),Ft=Math.atan((1-this.es)*pt+this.es*ft*this.sin_p12/(yt*_)),kt=Math.atan2(Math.sin(a),this.cos_p12*Math.tan(Ft)-this.sin_p12*Math.cos(a)),kt===0?Ne=Math.asin(this.cos_p12*Math.sin(Ft)-this.sin_p12*Math.cos(Ft)):Math.abs(Math.abs(kt)-Math.PI)<=qt?Ne=-Math.asin(this.cos_p12*Math.sin(Ft)-this.sin_p12*Math.cos(Ft)):Ne=Math.asin(Math.sin(a)*Math.cos(Ft)/Math.sin(kt)),Ot=this.e*this.sin_p12/Math.sqrt(1-this.es),he=this.e*this.cos_p12*Math.cos(kt)/Math.sqrt(1-this.es),ne=Ot*he,be=he*he,di=Ne*Ne,Bi=di*Ne,Yi=Bi*Ne,Fi=Yi*Ne,xe=ft*Ne*(1-di*be*(1-be)/6+Bi/8*ne*(1-2*be)+Yi/120*(be*(4-7*be)-3*Ot*Ot*(1-7*be))-Fi/48*ne),s.x=this.x0+xe*Math.sin(kt),s.y=this.y0+xe*Math.cos(kt),s))}function Gv(s){s.x-=this.x0,s.y-=this.y0;var l,h,y,_,a,T,M,D,N,L,tt,pt,ft,yt,Ft,kt,Ot,he,ne,be,xe,me,Ge,Ne;return this.sphere?(l=Math.sqrt(s.x*s.x+s.y*s.y),l>2*Bt*this.a?void 0:(h=l/this.a,y=Math.sin(h),_=Math.cos(h),a=this.long0,Math.abs(l)<=qt?T=this.lat0:(T=qr(_*this.sin_p12+s.y*y*this.cos_p12/l),M=Math.abs(this.lat0)-Bt,Math.abs(M)<=qt?this.lat0>=0?a=$t(this.long0+Math.atan2(s.x,-s.y)):a=$t(this.long0-Math.atan2(-s.x,s.y)):a=$t(this.long0+Math.atan2(s.x*y,l*this.cos_p12*_-s.y*this.sin_p12*y))),s.x=a,s.y=T,s)):(D=ss(this.es),N=as(this.es),L=os(this.es),tt=ls(this.es),Math.abs(this.sin_p12-1)<=qt?(pt=this.a*Ki(D,N,L,tt,Bt),l=Math.sqrt(s.x*s.x+s.y*s.y),ft=pt-l,T=wa(ft/this.a,D,N,L,tt),a=$t(this.long0+Math.atan2(s.x,-1*s.y)),s.x=a,s.y=T,s):Math.abs(this.sin_p12+1)<=qt?(pt=this.a*Ki(D,N,L,tt,Bt),l=Math.sqrt(s.x*s.x+s.y*s.y),ft=l-pt,T=wa(ft/this.a,D,N,L,tt),a=$t(this.long0+Math.atan2(s.x,s.y)),s.x=a,s.y=T,s):(l=Math.sqrt(s.x*s.x+s.y*s.y),kt=Math.atan2(s.x,s.y),yt=hs(this.a,this.e,this.sin_p12),Ot=Math.cos(kt),he=this.e*this.cos_p12*Ot,ne=-he*he/(1-this.es),be=3*this.es*(1-ne)*this.sin_p12*this.cos_p12*Ot/(1-this.es),xe=l/yt,me=xe-ne*(1+ne)*Math.pow(xe,3)/6-be*(1+3*ne)*Math.pow(xe,4)/24,Ge=1-ne*me*me/2-xe*me*me*me/6,Ft=Math.asin(this.sin_p12*Math.cos(me)+this.cos_p12*Math.sin(me)*Ot),a=$t(this.long0+Math.asin(Math.sin(kt)*Math.sin(me)/Math.cos(Ft))),Ne=Math.sin(Ft),T=Math.atan2((Ne-this.es*Ge*this.sin_p12)*Math.tan(Ft),Ne*(1-this.es)),s.x=a,s.y=T,s))}var qv=["Azimuthal_Equidistant","aeqd"],Gm={init:Uv,forward:Vv,inverse:Gv,names:qv};Z();function jv(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0)}function $v(s){var l,h,y,_,a,T,M,D,N=s.x,L=s.y;return y=$t(N-this.long0),l=Math.sin(L),h=Math.cos(L),_=Math.cos(y),T=this.sin_p14*l+this.cos_p14*h*_,a=1,(T>0||Math.abs(T)<=qt)&&(M=this.a*a*h*Math.sin(y),D=this.y0+this.a*a*(this.cos_p14*l-this.sin_p14*h*_)),s.x=M,s.y=D,s}function Wv(s){var l,h,y,_,a,T,M;return s.x-=this.x0,s.y-=this.y0,l=Math.sqrt(s.x*s.x+s.y*s.y),h=qr(l/this.a),y=Math.sin(h),_=Math.cos(h),T=this.long0,Math.abs(l)<=qt?(M=this.lat0,s.x=T,s.y=M,s):(M=qr(_*this.sin_p14+s.y*y*this.cos_p14/l),a=Math.abs(this.lat0)-Bt,Math.abs(a)<=qt?(this.lat0>=0?T=$t(this.long0+Math.atan2(s.x,-s.y)):T=$t(this.long0-Math.atan2(-s.x,s.y)),s.x=T,s.y=M,s):(T=$t(this.long0+Math.atan2(s.x*y,l*this.cos_p14*_-s.y*this.sin_p14*y)),s.x=T,s.y=M,s))}var Zv=["ortho"],qm={init:jv,forward:$v,inverse:Wv,names:Zv};Z();var Ci={FRONT:1,RIGHT:2,BACK:3,LEFT:4,TOP:5,BOTTOM:6},si={AREA_0:1,AREA_1:2,AREA_2:3,AREA_3:4};function Hv(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||"Quadrilateralized Spherical Cube",this.lat0>=Bt-Ze/2?this.face=Ci.TOP:this.lat0<=-(Bt-Ze/2)?this.face=Ci.BOTTOM:Math.abs(this.long0)<=Ze?this.face=Ci.FRONT:Math.abs(this.long0)<=Bt+Ze?this.face=this.long0>0?Ci.RIGHT:Ci.LEFT:this.face=Ci.BACK,this.es!==0&&(this.one_minus_f=1-(this.a-this.b)/this.a,this.one_minus_f_squared=this.one_minus_f*this.one_minus_f)}function Xv(s){var l={x:0,y:0},h,y,_,a,T,M,D={value:0};if(s.x-=this.long0,this.es!==0?h=Math.atan(this.one_minus_f_squared*Math.tan(s.y)):h=s.y,y=s.x,this.face===Ci.TOP)a=Bt-h,y>=Ze&&y<=Bt+Ze?(D.value=si.AREA_0,_=y-Bt):y>Bt+Ze||y<=-(Bt+Ze)?(D.value=si.AREA_1,_=y>0?y-Ii:y+Ii):y>-(Bt+Ze)&&y<=-Ze?(D.value=si.AREA_2,_=y+Bt):(D.value=si.AREA_3,_=y);else if(this.face===Ci.BOTTOM)a=Bt+h,y>=Ze&&y<=Bt+Ze?(D.value=si.AREA_0,_=-y+Bt):y<Ze&&y>=-Ze?(D.value=si.AREA_1,_=-y):y<-Ze&&y>=-(Bt+Ze)?(D.value=si.AREA_2,_=-y-Bt):(D.value=si.AREA_3,_=y>0?-y+Ii:-y-Ii);else{var N,L,tt,pt,ft,yt,Ft;this.face===Ci.RIGHT?y=Eo(y,+Bt):this.face===Ci.BACK?y=Eo(y,+Ii):this.face===Ci.LEFT&&(y=Eo(y,-Bt)),pt=Math.sin(h),ft=Math.cos(h),yt=Math.sin(y),Ft=Math.cos(y),N=ft*Ft,L=ft*yt,tt=pt,this.face===Ci.FRONT?(a=Math.acos(N),_=_c(a,tt,L,D)):this.face===Ci.RIGHT?(a=Math.acos(L),_=_c(a,tt,-N,D)):this.face===Ci.BACK?(a=Math.acos(-N),_=_c(a,tt,-L,D)):this.face===Ci.LEFT?(a=Math.acos(-L),_=_c(a,tt,N,D)):(a=_=0,D.value=si.AREA_0)}return M=Math.atan(12/Ii*(_+Math.acos(Math.sin(_)*Math.cos(Ze))-Bt)),T=Math.sqrt((1-Math.cos(a))/(Math.cos(M)*Math.cos(M))/(1-Math.cos(Math.atan(1/Math.cos(_))))),D.value===si.AREA_1?M+=Bt:D.value===si.AREA_2?M+=Ii:D.value===si.AREA_3&&(M+=1.5*Ii),l.x=T*Math.cos(M),l.y=T*Math.sin(M),l.x=l.x*this.a+this.x0,l.y=l.y*this.a+this.y0,s.x=l.x,s.y=l.y,s}function Kv(s){var l={lam:0,phi:0},h,y,_,a,T,M,D,N,L,tt={value:0};if(s.x=(s.x-this.x0)/this.a,s.y=(s.y-this.y0)/this.a,y=Math.atan(Math.sqrt(s.x*s.x+s.y*s.y)),h=Math.atan2(s.y,s.x),s.x>=0&&s.x>=Math.abs(s.y)?tt.value=si.AREA_0:s.y>=0&&s.y>=Math.abs(s.x)?(tt.value=si.AREA_1,h-=Bt):s.x<0&&-s.x>=Math.abs(s.y)?(tt.value=si.AREA_2,h=h<0?h+Ii:h-Ii):(tt.value=si.AREA_3,h+=Bt),L=Ii/12*Math.tan(h),T=Math.sin(L)/(Math.cos(L)-1/Math.sqrt(2)),M=Math.atan(T),_=Math.cos(h),a=Math.tan(y),D=1-_*_*a*a*(1-Math.cos(Math.atan(1/Math.cos(M)))),D<-1?D=-1:D>1&&(D=1),this.face===Ci.TOP)N=Math.acos(D),l.phi=Bt-N,tt.value===si.AREA_0?l.lam=M+Bt:tt.value===si.AREA_1?l.lam=M<0?M+Ii:M-Ii:tt.value===si.AREA_2?l.lam=M-Bt:l.lam=M;else if(this.face===Ci.BOTTOM)N=Math.acos(D),l.phi=N-Bt,tt.value===si.AREA_0?l.lam=-M+Bt:tt.value===si.AREA_1?l.lam=-M:tt.value===si.AREA_2?l.lam=-M-Bt:l.lam=M<0?-M-Ii:-M+Ii;else{var pt,ft,yt;pt=D,L=pt*pt,L>=1?yt=0:yt=Math.sqrt(1-L)*Math.sin(M),L+=yt*yt,L>=1?ft=0:ft=Math.sqrt(1-L),tt.value===si.AREA_1?(L=ft,ft=-yt,yt=L):tt.value===si.AREA_2?(ft=-ft,yt=-yt):tt.value===si.AREA_3&&(L=ft,ft=yt,yt=-L),this.face===Ci.RIGHT?(L=pt,pt=-ft,ft=L):this.face===Ci.BACK?(pt=-pt,ft=-ft):this.face===Ci.LEFT&&(L=pt,pt=ft,ft=-L),l.phi=Math.acos(-yt)-Bt,l.lam=Math.atan2(ft,pt),this.face===Ci.RIGHT?l.lam=Eo(l.lam,-Bt):this.face===Ci.BACK?l.lam=Eo(l.lam,-Ii):this.face===Ci.LEFT&&(l.lam=Eo(l.lam,+Bt))}if(this.es!==0){var Ft,kt,Ot;Ft=l.phi<0?1:0,kt=Math.tan(l.phi),Ot=this.b/Math.sqrt(kt*kt+this.one_minus_f_squared),l.phi=Math.atan(Math.sqrt(this.a*this.a-Ot*Ot)/(this.one_minus_f*Ot)),Ft&&(l.phi=-l.phi)}return l.lam+=this.long0,s.x=l.lam,s.y=l.phi,s}function _c(s,l,h,y){var _;return s<qt?(y.value=si.AREA_0,_=0):(_=Math.atan2(l,h),Math.abs(_)<=Ze?y.value=si.AREA_0:_>Ze&&_<=Bt+Ze?(y.value=si.AREA_1,_-=Bt):_>Bt+Ze||_<=-(Bt+Ze)?(y.value=si.AREA_2,_=_>=0?_-Ii:_+Ii):(y.value=si.AREA_3,_+=Bt)),_}function Eo(s,l){var h=s+l;return h<-Ii?h+=Os:h>+Ii&&(h-=Os),h}var Yv=["Quadrilateralized Spherical Cube","Quadrilateralized_Spherical_Cube","qsc"],jm={init:Hv,forward:Xv,inverse:Kv,names:Yv};Z();var op=[[1,22199e-21,-715515e-10,31103e-10],[.9986,-482243e-9,-24897e-9,-13309e-10],[.9954,-83103e-8,-448605e-10,-986701e-12],[.99,-.00135364,-59661e-9,36777e-10],[.9822,-.00167442,-449547e-11,-572411e-11],[.973,-.00214868,-903571e-10,18736e-12],[.96,-.00305085,-900761e-10,164917e-11],[.9427,-.00382792,-653386e-10,-26154e-10],[.9216,-.00467746,-10457e-8,481243e-11],[.8962,-.00536223,-323831e-10,-543432e-11],[.8679,-.00609363,-113898e-9,332484e-11],[.835,-.00698325,-640253e-10,934959e-12],[.7986,-.00755338,-500009e-10,935324e-12],[.7597,-.00798324,-35971e-9,-227626e-11],[.7186,-.00851367,-701149e-10,-86303e-10],[.6732,-.00986209,-199569e-9,191974e-10],[.6213,-.010418,883923e-10,624051e-11],[.5722,-.00906601,182e-6,624051e-11],[.5322,-.00677797,275608e-9,624051e-11]],Gl=[[-520417e-23,.0124,121431e-23,-845284e-16],[.062,.0124,-126793e-14,422642e-15],[.124,.0124,507171e-14,-160604e-14],[.186,.0123999,-190189e-13,600152e-14],[.248,.0124002,710039e-13,-224e-10],[.31,.0123992,-264997e-12,835986e-13],[.372,.0124029,988983e-12,-311994e-12],[.434,.0123893,-369093e-11,-435621e-12],[.4958,.0123198,-102252e-10,-345523e-12],[.5571,.0121916,-154081e-10,-582288e-12],[.6176,.0119938,-241424e-10,-525327e-12],[.6769,.011713,-320223e-10,-516405e-12],[.7346,.0113541,-397684e-10,-609052e-12],[.7903,.0109107,-489042e-10,-104739e-11],[.8435,.0103431,-64615e-9,-140374e-14],[.8936,.00969686,-64636e-9,-8547e-9],[.9394,.00840947,-192841e-9,-42106e-10],[.9761,.00616527,-256e-6,-42106e-10],[1,.00328947,-319159e-9,-42106e-10]],$m=.8487,Wm=1.3523,Zm=Ur/5,Jv=1/Zm,Io=18,xc=function(s,l){return s[0]+l*(s[1]+l*(s[2]+l*s[3]))},Qv=function(s,l){return s[1]+l*(2*s[2]+l*3*s[3])};function t1(s,l,h,y){for(var _=l;y;--y){var a=s(_);if(_-=a,Math.abs(a)<h)break}return _}function e1(){this.x0=this.x0||0,this.y0=this.y0||0,this.long0=this.long0||0,this.es=0,this.title=this.title||"Robinson"}function i1(s){var l=$t(s.x-this.long0),h=Math.abs(s.y),y=Math.floor(h*Zm);y<0?y=0:y>=Io&&(y=Io-1),h=Ur*(h-Jv*y);var _={x:xc(op[y],h)*l,y:xc(Gl[y],h)};return s.y<0&&(_.y=-_.y),_.x=_.x*this.a*$m+this.x0,_.y=_.y*this.a*Wm+this.y0,_}function r1(s){var l={x:(s.x-this.x0)/(this.a*$m),y:Math.abs(s.y-this.y0)/(this.a*Wm)};if(l.y>=1)l.x/=op[Io][0],l.y=s.y<0?-Bt:Bt;else{var h=Math.floor(l.y*Io);for(h<0?h=0:h>=Io&&(h=Io-1);;)if(Gl[h][0]>l.y)--h;else if(Gl[h+1][0]<=l.y)++h;else break;var y=Gl[h],_=5*(l.y-y[0])/(Gl[h+1][0]-y[0]);_=t1(function(a){return(xc(y,a)-l.y)/Qv(y,a)},_,qt,100),l.x/=xc(op[h],_),l.y=(5*h+_)*Ei,s.y<0&&(l.y=-l.y)}return l.x=$t(l.x+this.long0),l}var n1=["Robinson","robin"],Hm={init:e1,forward:i1,inverse:r1,names:n1};Z();function s1(){this.name="geocent"}function a1(s){var l=lc(s,this.es,this.a);return l}function o1(s){var l=hc(s,this.es,this.a,this.b);return l}var l1=["Geocentric","geocentric","geocent","Geocent"],Xm={init:s1,forward:a1,inverse:o1,names:l1};Z();var fr={N_POLE:0,S_POLE:1,EQUIT:2,OBLIQ:3},ql={h:{def:1e5,num:!0},azi:{def:0,num:!0,degrees:!0},tilt:{def:0,num:!0,degrees:!0},long0:{def:0,num:!0},lat0:{def:0,num:!0}};function h1(){if(Object.keys(ql).forEach(function(h){if(typeof this[h]>"u")this[h]=ql[h].def;else{if(ql[h].num&&isNaN(this[h]))throw new Error("Invalid parameter value, must be numeric "+h+" = "+this[h]);ql[h].num&&(this[h]=parseFloat(this[h]))}ql[h].degrees&&(this[h]=this[h]*Ei)}.bind(this)),Math.abs(Math.abs(this.lat0)-Bt)<qt?this.mode=this.lat0<0?fr.S_POLE:fr.N_POLE:Math.abs(this.lat0)<qt?this.mode=fr.EQUIT:(this.mode=fr.OBLIQ,this.sinph0=Math.sin(this.lat0),this.cosph0=Math.cos(this.lat0)),this.pn1=this.h/this.a,this.pn1<=0||this.pn1>1e10)throw new Error("Invalid height");this.p=1+this.pn1,this.rp=1/this.p,this.h1=1/this.pn1,this.pfact=(this.p+1)*this.h1,this.es=0;var s=this.tilt,l=this.azi;this.cg=Math.cos(l),this.sg=Math.sin(l),this.cw=Math.cos(s),this.sw=Math.sin(s)}function c1(s){s.x-=this.long0;var l=Math.sin(s.y),h=Math.cos(s.y),y=Math.cos(s.x),_,a;switch(this.mode){case fr.OBLIQ:a=this.sinph0*l+this.cosph0*h*y;break;case fr.EQUIT:a=h*y;break;case fr.S_POLE:a=-l;break;case fr.N_POLE:a=l;break}switch(a=this.pn1/(this.p-a),_=a*h*Math.sin(s.x),this.mode){case fr.OBLIQ:a*=this.cosph0*l-this.sinph0*h*y;break;case fr.EQUIT:a*=l;break;case fr.N_POLE:a*=-(h*y);break;case fr.S_POLE:a*=h*y;break}var T,M;return T=a*this.cg+_*this.sg,M=1/(T*this.sw*this.h1+this.cw),_=(_*this.cg-a*this.sg)*this.cw*M,a=T*M,s.x=_*this.a,s.y=a*this.a,s}function u1(s){s.x/=this.a,s.y/=this.a;var l={x:s.x,y:s.y},h,y,_;_=1/(this.pn1-s.y*this.sw),h=this.pn1*s.x*_,y=this.pn1*s.y*this.cw*_,s.x=h*this.cg+y*this.sg,s.y=y*this.cg-h*this.sg;var a=Ar(s.x,s.y);if(Math.abs(a)<qt)l.x=0,l.y=s.y;else{var T,M;switch(M=1-a*a*this.pfact,M=(this.p-Math.sqrt(M))/(this.pn1/a+a/this.pn1),T=Math.sqrt(1-M*M),this.mode){case fr.OBLIQ:l.y=Math.asin(T*this.sinph0+s.y*M*this.cosph0/a),s.y=(T-this.sinph0*Math.sin(l.y))*a,s.x*=M*this.cosph0;break;case fr.EQUIT:l.y=Math.asin(s.y*M/a),s.y=T*a,s.x*=M;break;case fr.N_POLE:l.y=Math.asin(T),s.y=-s.y;break;case fr.S_POLE:l.y=-Math.asin(T);break}l.x=Math.atan2(s.x,s.y)}return s.x=l.x+this.long0,s.y=l.y,s}var p1=["Tilted_Perspective","tpers"],Km={init:h1,forward:c1,inverse:u1,names:p1};Z();function d1(){if(this.flip_axis=this.sweep==="x"?1:0,this.h=Number(this.h),this.radius_g_1=this.h/this.a,this.radius_g_1<=0||this.radius_g_1>1e10)throw new Error;if(this.radius_g=1+this.radius_g_1,this.C=this.radius_g*this.radius_g-1,this.es!==0){var s=1-this.es,l=1/s;this.radius_p=Math.sqrt(s),this.radius_p2=s,this.radius_p_inv2=l,this.shape="ellipse"}else this.radius_p=1,this.radius_p2=1,this.radius_p_inv2=1,this.shape="sphere";this.title||(this.title="Geostationary Satellite View")}function f1(s){var l=s.x,h=s.y,y,_,a,T;if(l=l-this.long0,this.shape==="ellipse"){h=Math.atan(this.radius_p2*Math.tan(h));var M=this.radius_p/Ar(this.radius_p*Math.cos(h),Math.sin(h));if(_=M*Math.cos(l)*Math.cos(h),a=M*Math.sin(l)*Math.cos(h),T=M*Math.sin(h),(this.radius_g-_)*_-a*a-T*T*this.radius_p_inv2<0)return s.x=Number.NaN,s.y=Number.NaN,s;y=this.radius_g-_,this.flip_axis?(s.x=this.radius_g_1*Math.atan(a/Ar(T,y)),s.y=this.radius_g_1*Math.atan(T/y)):(s.x=this.radius_g_1*Math.atan(a/y),s.y=this.radius_g_1*Math.atan(T/Ar(a,y)))}else this.shape==="sphere"&&(y=Math.cos(h),_=Math.cos(l)*y,a=Math.sin(l)*y,T=Math.sin(h),y=this.radius_g-_,this.flip_axis?(s.x=this.radius_g_1*Math.atan(a/Ar(T,y)),s.y=this.radius_g_1*Math.atan(T/y)):(s.x=this.radius_g_1*Math.atan(a/y),s.y=this.radius_g_1*Math.atan(T/Ar(a,y))));return s.x=s.x*this.a,s.y=s.y*this.a,s}function m1(s){var l=-1,h=0,y=0,_,a,T,M;if(s.x=s.x/this.a,s.y=s.y/this.a,this.shape==="ellipse"){this.flip_axis?(y=Math.tan(s.y/this.radius_g_1),h=Math.tan(s.x/this.radius_g_1)*Ar(1,y)):(h=Math.tan(s.x/this.radius_g_1),y=Math.tan(s.y/this.radius_g_1)*Ar(1,h));var D=y/this.radius_p;if(_=h*h+D*D+l*l,a=2*this.radius_g*l,T=a*a-4*_*this.C,T<0)return s.x=Number.NaN,s.y=Number.NaN,s;M=(-a-Math.sqrt(T))/(2*_),l=this.radius_g+M*l,h*=M,y*=M,s.x=Math.atan2(h,l),s.y=Math.atan(y*Math.cos(s.x)/l),s.y=Math.atan(this.radius_p_inv2*Math.tan(s.y))}else if(this.shape==="sphere"){if(this.flip_axis?(y=Math.tan(s.y/this.radius_g_1),h=Math.tan(s.x/this.radius_g_1)*Math.sqrt(1+y*y)):(h=Math.tan(s.x/this.radius_g_1),y=Math.tan(s.y/this.radius_g_1)*Math.sqrt(1+h*h)),_=h*h+y*y+l*l,a=2*this.radius_g*l,T=a*a-4*_*this.C,T<0)return s.x=Number.NaN,s.y=Number.NaN,s;M=(-a-Math.sqrt(T))/(2*_),l=this.radius_g+M*l,h*=M,y*=M,s.x=Math.atan2(h,l),s.y=Math.atan(y*Math.cos(s.x)/l)}return s.x=s.x+this.long0,s}var g1=["Geostationary Satellite View","Geostationary_Satellite","geos"],Ym={init:d1,forward:f1,inverse:m1,names:g1};function Jm(s){s.Proj.projections.add(Mo),s.Proj.projections.add(So),s.Proj.projections.add(vm),s.Proj.projections.add(bm),s.Proj.projections.add(wm),s.Proj.projections.add(Mm),s.Proj.projections.add(Sm),s.Proj.projections.add(Tm),s.Proj.projections.add(Em),s.Proj.projections.add(Im),s.Proj.projections.add(Cm),s.Proj.projections.add(Am),s.Proj.projections.add(Pm),s.Proj.projections.add(km),s.Proj.projections.add(Lm),s.Proj.projections.add(Rm),s.Proj.projections.add(Bm),s.Proj.projections.add(Fm),s.Proj.projections.add(Om),s.Proj.projections.add(Nm),s.Proj.projections.add(Um),s.Proj.projections.add(Vm),s.Proj.projections.add(Gm),s.Proj.projections.add(qm),s.Proj.projections.add(jm),s.Proj.projections.add(Hm),s.Proj.projections.add(Xm),s.Proj.projections.add(Km),s.Proj.projections.add(Ym)}Vr.defaultDatum="WGS84";Vr.Proj=Ns;Vr.WGS84=new Vr.Proj("WGS84");Vr.Point=um;Vr.toPoint=uc;Vr.defs=_o;Vr.nadgrid=Qu;Vr.transform=va;Vr.mgrs=lm;Vr.version="__VERSION__";Jm(Vr);var Co=Vr;Z();Z();Z();var mr;(function(s){s[s.UInt8=1]="UInt8",s[s.UInt16=2]="UInt16",s[s.UInt32=4]="UInt32",s[s.UInt64=8]="UInt64",s[s.Double=8]="Double",s[s.Float=4]="Float"})(mr||(mr={}));Z();var Qm=2**32,y1=typeof setImmediate>"u"?setTimeout:setImmediate,Pr=()=>{throw new Error("Method not implemented.")},zn=class{constructor(){this.isLittleEndian=!0,this.delayMs=zn.DefaultDelayMs,this.maxChunkCount=10,this.chunks=zn.DefaultChunkCache(),this.blankFillCount=16,this.maxConcurrentRequests=50,this.toFetch=new Set,this.toFetchPromise=null,this.byteOffset=0,this.getFloat32=Pr,this.getFloat64=Pr,this.getInt8=Pr,this.getInt16=Pr,this.getInt32=Pr,this.setFloat32=Pr,this.setFloat64=Pr,this.setInt8=Pr,this.setInt16=Pr,this.setInt32=Pr,this.setUint8=Pr,this.setUint16=Pr,this.setUint32=Pr,this.setBigInt64=Pr,this.setBigUint64=Pr}static getByteRanges(l,h=32,y=16){if(l.size===0)return{chunks:[],blankFill:[]};let _=[...l.values()].sort((D,N)=>D-N),a=[],T=[];a.push(T);let M=[];for(let D=0;D<_.length;++D){let N=_[D],L=_[D-1];if(T.length>=h)T=[N],a.push(T);else if(D===0||N===L+1)T.push(N);else if(N<L+y){for(let tt=L;tt<N;tt++)T.push(tt+1),M.push(tt+1);M.pop()}else T=[N],a.push(T)}return{chunks:a,blankFill:M}}async fetchData(){if(this.toFetch.size===0)return;let l=this.toFetch;this.toFetch=new Set,this.toFetchPromise=null;let h=zn.getByteRanges(l,this.maxChunkCount,this.blankFillCount),y=[];for(let _ of h.chunks){let a=_[0],T=_[_.length-1],M=a*this.chunkSize,D=T*this.chunkSize+this.chunkSize-M,N=await this.fetchBytes(M,D);if(_.length===1){y[a]=N,this.chunks.set(a,new DataView(N));continue}let L=a*this.chunkSize;for(let tt of _){let pt=tt*this.chunkSize-L,ft=N.slice(pt,pt+this.chunkSize);y[tt]=ft,this.chunks.set(tt,new DataView(ft))}}}async loadBytes(l,h){if(l<0)throw new Error("Offset must be positive");let y=Math.floor(l/this.chunkSize),_=Math.ceil((l+h)/this.chunkSize)-1;for(let a=y;a<=_;a++)this.chunks.has(a)||this.toFetch.add(a);if(this.toFetch.size!==0){if(this.toFetchPromise==null&&(this.toFetchPromise=new Promise(a=>y1(a,this.delayMs)).then(()=>this.fetchData())),this.toFetch.size>this.maxConcurrentRequests)throw new Error("Too many outstanding requests");await this.toFetchPromise}}getChunkId(l){return Math.floor(l/this.chunkSize)}getUint(l,h){switch(h){case mr.UInt8:return this.getUint8(l);case mr.UInt16:return this.getUint16(l);case mr.UInt32:return this.getUint32(l);case mr.UInt64:return this.getUint64(l)}}bytes(l,h){let y=this.isOneChunk(l,h);if(y){let N=this.getView(y),L=l-y*this.chunkSize;return new Uint8Array(N.buffer.slice(L,L+h))}let _=new Uint8Array(h),a=l+h,T=Math.floor(l/this.chunkSize),M=Math.ceil((l+h)/this.chunkSize)-1,D=0;for(let N=T;N<=M;N++){let L=l+D,tt=N*this.chunkSize,pt=this.getView(N),ft=Math.min(a,tt+this.chunkSize),yt=pt.buffer.slice(L-tt,ft-tt);_.set(new Uint8Array(yt),D),D+=yt.byteLength}return _}getView(l){let h=this.chunks.get(l);if(h==null)throw new Error(`Chunk:${l} is not ready`);return h}isOneChunk(l,h){let y=l+h-1,_=Math.floor(l/this.chunkSize);return Math.floor(y/this.chunkSize)-_<1?_:null}hasBytes(l,h=1){let y=Math.floor(l/this.chunkSize),_=Math.ceil((l+h)/this.chunkSize)-1;for(let a=y;a<=_;a++)if(!this.chunks.has(a))return!1;return!0}toRange(l,h){if(h==null)return`bytes=${l}`;if(l<0)throw new Error("Cannot read from remote source with negative offset and length");return`bytes=${l}-${l+h}`}parseContentRange(l){let[h,y]=l.split(" ");if(h!=="bytes")throw new Error("Failed to parse content-range: "+l);if(y==null)throw new Error("Failed to parse content-range: "+l);let[,_]=y.split("/"),a=Number(_);if(isNaN(a))throw new Error("Failed to parse content-range: "+l);return a}get buffer(){throw new Error("Method not implemented.")}get byteLength(){if(this._byteLength)return this._byteLength;throw Error(".size() has not been fetched.")}getUint8(l){let h=Math.floor(l/this.chunkSize),y=this.chunks.get(h);if(y==null)throw new Error(`Chunk:${h} is not ready`);return y.getUint8(l-h*this.chunkSize)}getUint16(l){let h=this.isOneChunk(l,mr.UInt16);if(h!=null)return this.getView(h).getUint16(l-h*this.chunkSize,this.isLittleEndian);let y=this.getUint8(l),_=this.getUint8(l+mr.UInt8);return this.isLittleEndian?y+(_<<8):(y<<8)+_}getUint32(l){let h=this.isOneChunk(l,mr.UInt32);if(h!=null)return this.getView(h).getUint32(l-h*this.chunkSize,this.isLittleEndian);let y=this.getUint16(l),_=this.getUint16(l+mr.UInt16);return this.isLittleEndian?y+_*65536:y*65536+_}getUint64(l){let h=this.isOneChunk(l,mr.UInt64);if(h!=null){let a=this.getView(h);return Number(a.getBigUint64(l-h*this.chunkSize,this.isLittleEndian))}let y=this.getUint32(l),_=this.getUint32(l+mr.UInt32);return this.isLittleEndian?y+_*Qm:y*Qm+_}getBigUint64(l){let h=this.isOneChunk(l,mr.UInt64);if(h!=null)return this.getView(h).getBigUint64(l-h*this.chunkSize,this.isLittleEndian);let y=BigInt(this.getUint32(l)),_=BigInt(this.getUint32(l+mr.UInt32));return this.isLittleEndian?y+(_<<BigInt(32)):(y<<BigInt(32))+_}getBigInt64(){throw new Error("Not implemented.")}};zn.DefaultChunkCache=()=>new Map;zn.DefaultDelayMs=1;Z();Z();var Ao=class extends Error{constructor(l,h,y){super(l),this.name="CompositeError",this.code=h,this.reason=y}static isCompositeError(l){return typeof l!="object"||l==null?!1:l.name==="CompositeError"}};Z();var tg=`PROJCS["NZGD2000 / Chatham Islands TM 2000",
|
|
509
|
+
GEOGCS["NZGD2000",
|
|
510
|
+
DATUM["New_Zealand_Geodetic_Datum_2000",
|
|
511
|
+
SPHEROID["GRS 1980",6378137,298.257222101,
|
|
512
|
+
AUTHORITY["EPSG","7019"]],
|
|
513
|
+
TOWGS84[0,0,0,0,0,0,0],
|
|
514
|
+
AUTHORITY["EPSG","6167"]],
|
|
515
|
+
PRIMEM["Greenwich",0,
|
|
516
|
+
AUTHORITY["EPSG","8901"]],
|
|
517
|
+
UNIT["degree",0.01745329251994328,
|
|
518
|
+
AUTHORITY["EPSG","9122"]],
|
|
519
|
+
AUTHORITY["EPSG","4167"]],
|
|
520
|
+
UNIT["metre",1,
|
|
521
|
+
AUTHORITY["EPSG","9001"]],
|
|
522
|
+
PROJECTION["Transverse_Mercator"],
|
|
523
|
+
PARAMETER["latitude_of_origin",0],
|
|
524
|
+
PARAMETER["central_meridian",-176.5],
|
|
525
|
+
PARAMETER["scale_factor",1],
|
|
526
|
+
PARAMETER["false_easting",3500000],
|
|
527
|
+
PARAMETER["false_northing",10000000],
|
|
528
|
+
AUTHORITY["EPSG","3793"],
|
|
529
|
+
AXIS["Easting",EAST],
|
|
530
|
+
AXIS["Northing",NORTH]]`;Z();var eg=`PROJCS["NZGD2000 / New Zealand Transverse Mercator 2000",
|
|
531
|
+
GEOGCS["NZGD2000",
|
|
532
|
+
DATUM["New_Zealand_Geodetic_Datum_2000",
|
|
533
|
+
SPHEROID["GRS 1980",6378137,298.257222101,
|
|
534
|
+
AUTHORITY["EPSG","7019"]],
|
|
535
|
+
TOWGS84[0,0,0,0,0,0,0],
|
|
536
|
+
AUTHORITY["EPSG","6167"]],
|
|
537
|
+
PRIMEM["Greenwich",0,
|
|
538
|
+
AUTHORITY["EPSG","8901"]],
|
|
539
|
+
UNIT["degree",0.0174532925199433,
|
|
540
|
+
AUTHORITY["EPSG","9122"]],
|
|
541
|
+
AUTHORITY["EPSG","4167"]],
|
|
542
|
+
PROJECTION["Transverse_Mercator"],
|
|
543
|
+
PARAMETER["latitude_of_origin",0],
|
|
544
|
+
PARAMETER["central_meridian",173],
|
|
545
|
+
PARAMETER["scale_factor",0.9996],
|
|
546
|
+
PARAMETER["false_easting",1600000],
|
|
547
|
+
PARAMETER["false_northing",10000000],
|
|
548
|
+
UNIT["metre",1,
|
|
549
|
+
AUTHORITY["EPSG","9001"]],
|
|
550
|
+
AUTHORITY["EPSG","2193"]]`;Co.defs(Ve.Nztm2000.toEpsgString(),eg);Co.defs(Ve.Citm2000.toEpsgString(),tg);var lp=new Map;function _1(s){return s==null?null:typeof s=="number"?s:"code"in s?s.code:"projection"in s?s.projection.code:null}var Us=class{constructor(l){this.epsg=l;try{this.projection=Co(l.toEpsgString(),Ve.Wgs84.toEpsgString())}catch(h){throw new Ao(`Failed to create projection: ${l.toEpsgString()}, ${Ve.Wgs84.toEpsgString()}`,500,h)}}static define(l,h){if(lp.get(l.code)!=null)throw new Error("Duplicate projection definition: "+l.toEpsgString());Co.defs(l.toEpsgString(),h)}static get(l){let h=this.tryGet(l);if(h==null)throw new Error(`Invalid projection: ${l}`);return h}static tryGet(l){let h=_1(l);if(h==null)return null;let y=lp.get(h);if(y!=null)return y;let _=Ve.tryGet(h);return _==null||Co.defs(_.toEpsgString())==null?null:(y=new Us(_),lp.set(h,y),y)}projectMultipolygon(l,h){if(h.epsg.code===this.epsg.code)return l;let{toWgs84:y}=this,{fromWgs84:_}=h;return l.map(a=>a.map(T=>T.map(M=>_(y(M)))))}get toWgs84(){return this.projection.forward}get fromWgs84(){return this.projection.inverse}boundsToWgs84BoundingBox(l){let h=this.toWgs84([l.x,l.y]),y=this.toWgs84([l.x+l.width,l.y+l.height]);return[h[0],h[1],y[0],y[1]]}boundsToGeoJsonFeature(l,h={}){let y=[l.x,l.y],_=[l.x+l.width,l.y],a=[l.x,l.y+l.height],T=[l.x+l.width,l.y+l.height],M=xf([[[y,a,T,_,y]]],this.toWgs84),D=M.length===1?vf(M[0],h):bf(M,h);return D.bbox=this.boundsToWgs84BoundingBox(l),D}toGeoJson(l){return{type:"FeatureCollection",features:l.map(h=>this.boundsToGeoJsonFeature(h,{name:h.name}))}}static getTiffResZoom(l,h,y=1){let _=0;for(;_<l.zooms.length;++_)if(l.pixelScale(_)<=h*y)return _;if(_===l.zooms.length)return _-1;throw new Error("ResZoom not found")}static tileToWgs84Bbox(l,h){let y=l.tileToSource(h),_=l.tileToSource({x:h.x+1,y:h.y+1,z:h.z}),a=this.get(l),[T,M]=a.toWgs84([y.x,_.y]),[D,N]=a.toWgs84([_.x,y.y]);return[T,M,D,N]}static tileCenterToLatLon(l,h){let y=l.tileToSource({x:h.x+.5,y:h.y+.5,z:h.z}),[_,a]=this.get(l).toWgs84([y.x,y.y]);return Us.wrapLatLon(a,_)}static wrapLatLon(l,h){let y={lat:l,lon:h},_=Math.floor(Math.abs(l)/90)%4,a=l>0?90:-90,T=l%90;switch(_){case 0:y.lat=T;break;case 1:y.lat=a-T,y.lon+=180;break;case 2:y.lat=-T,y.lon+=180;break;case 3:y.lat=-a+T;break}return(y.lon>180||y.lon<-180)&&(y.lon-=Math.floor((y.lon+180)/360)*360),y}static findAlignmentLevels(l,h,y){return Math.max(0,this.getTiffResZoom(l,y,2)-h.z)}static getImagePixelWidth(l,h,y){let _=l.tileToSource(h),a=l.tileToSource({x:h.x+1,y:h.y+1,z:h.z});return Math.round((a.x-_.x)/l.pixelScale(y))*2}};Z();var Ri={ImageFormat:"png",toHash(s){return`#@${s.lat.toFixed(7)},${s.lon.toFixed(7)},z${s.zoom}`},parseZoom(s){return s==null||s===""?NaN:s.startsWith("z")?parseFloat(s.slice(1)):s.endsWith("z")?parseFloat(s):NaN},fromHash(s){let l={},h=s.replace("#@",""),[y,_,a]=h.split(","),T=parseFloat(y),M=parseFloat(_);!isNaN(T)&&!isNaN(M)&&(l.lat=T,l.lon=M);let D=Ri.parseZoom(a);return isNaN(D)||(l.zoom=D),l},baseUrl(){let s=Pt.BaseUrl;if(s==="")return window.location.origin;if(!s.startsWith("http"))throw new Error("BaseURL must start with http(s)://");return s},toBaseWmts(){let s=Pt.ApiKey==null||Pt.ApiKey===""?"":`?api=${Pt.ApiKey}`;return`${this.baseUrl()}/v1/tiles/aerial/WMTSCapabilities.xml${s}`},toImageryUrl(s,l){return`${this.baseUrl()}/v1/imagery/${s}/${l}`},toTileUrl(s,l,h,y){let _=Pt.ApiKey==null||Pt.ApiKey===""?"":`?api=${Pt.ApiKey}`,a=`${this.baseUrl()}/v1/tiles/${h}/${l.identifier}`;if(s==="raster")return`${a}/{z}/{x}/{y}.${Ri.ImageFormat}${_}`;if(s==="vector-xyz")return`${a}/{z}/{x}/{y}.pbf${_}`;if(s==="style")return`${a}/style/${y}.json${_}`;if(s==="wmts")return`${a}/WMTSCapabilities.xml${_}`;if(s==="attribution")return`${a}/attribution.json${_}`;if(s==="tile-wmts")return`${a}/{TileMatrix}/{TileCol}/{TileRow}.${Ri.ImageFormat}${_}`;throw new Error("Unknown url type: "+s)}};var jl=class{constructor(l,h=0){this.tileMatrix=l,this.extraZoomLevels=h}getStyle(l,h){return l==="topographic"?Ri.toTileUrl("style",this.tileMatrix,l,h):{version:8,sources:{basemaps:{type:"raster",tiles:[Ri.toTileUrl("raster",this.tileMatrix,l)],tileSize:256}},layers:[{id:"LINZ Raster Basemaps",type:"raster",source:"basemaps"}]}}},x1=new jl(ts,2),v1=new jl(An),rg=new jl(ii),b1=[x1,v1,rg];function Po(s){for(let l of b1)if(s===l.tileMatrix.identifier)return l;return rg}function ig(s){return s.identifier===ii.identifier}function kn(s,l,h){if(l.identifier===h.identifier)return s;if(!ig(l)&&!ig(h))throw new Error("Either tileMatrix or targetTileMatrix must be GoogleTms");let y=Us.get(l).fromWgs84([s.lon,s.lat]),_=l.sourceToPixels(y[0],y[1],Math.round(s.zoom)),a={x:_.x/l.tileSize,y:_.y/l.tileSize,z:Math.round(s.zoom)},T=h.tileToSource(a),M=Us.get(h).toWgs84([T.x,T.y]);return{lon:Math.round(M[0]*1e8)/1e8,lat:Math.round(M[1]*1e8)/1e8,zoom:s.zoom}}function ng(s,l){for(let h of s.features){if(h.geometry.type!=="Polygon")throw new Error("Only polygons supported");for(let y of h.geometry.coordinates)for(let _ of y){let a=kn({lat:_[1],lon:_[0],zoom:l.maxZoom},l,ii);_[0]=a.lon,_[1]=a.lat}}}var sg={[ii.identifier]:{lat:-41.88999621,lon:174.04924373,zoom:5},[ts.identifier]:{lat:-41.277848,lon:174.6763921,zoom:3},[An.identifier]:{lat:-41.88999621,lon:174.04924373,zoom:3}},tn=class extends ag.Emitter{constructor(){super(...arguments);this.style=null;this.layerId="aerial";this.tileMatrix=ii;this.debug={...mo}}get layers(){return this._layers==null&&(this._layers=w1()),this._layers}get isDebug(){return this.debug.debug}get location(){return this._location==null&&(window.addEventListener("popstate",()=>{let h={...sg[this.tileMatrix.identifier],...Ri.fromHash(window.location.hash)};this.setLocation(h)}),this.updateFromUrl(),this._location={...sg[this.tileMatrix.identifier],...Ri.fromHash(window.location.hash)}),this._location}get transformedLocation(){return this.transformLocation(this.location.lat,this.location.lon,this.location.zoom)}get isVector(){return this.layerId==="topographic"}get layerKey(){return this.style==null?this.layerId:`${this.layerId}::${this.style}`}get layerKeyTms(){return`${this.layerKey}::${this.tileMatrix.identifier}`}updateFromUrl(h=window.location.search){let y=new URLSearchParams(h),_=y.get("s")??y.get("style"),a=y.get("i")??"aerial",T=(y.get("p")??ii.identifier).toLowerCase(),M=ma.All.find(L=>L.identifier.toLowerCase()===T);M==null&&(M=ma.get(Ve.parse(T)??Ve.Google)),M.identifier===ts.identifier&&(M=An),Rl.fromUrl(this.debug,y)&&this.emit("change");let N=tn.toUrl(this);this.style=_??null,this.layerId=a.startsWith("im_")?a.slice(3):a,this.tileMatrix=M,this.layerId==="topographic"&&this.style==null&&(this.style="topographic"),this.emit("tileMatrix",this.tileMatrix),this.emit("layer",this.layerId,this.style),N!==tn.toUrl(this)&&this.emit("change")}static toUrl(h){let y=new URLSearchParams;return h.style&&y.append("s",h.style),h.layerId!=="aerial"&&y.append("i",h.layerId),h.tileMatrix.identifier!==ii.identifier&&y.append("p",h.tileMatrix.identifier),Rl.toUrl(h.debug,y),y.toString()}toTileUrl(h,y=this.tileMatrix,_=this.layerId,a=this.style){return Ri.toTileUrl(h,y,_,a)}getLocation(h){let y=h.getCenter();if(y==null)throw new Error("Invalid Map location");let _=Math.floor((h.getZoom()??0)*1e4)/1e4;return Pt.map.transformLocation(y.lat,y.lng,_)}transformLocation(h,y,_){return kn({lat:h,lon:y,zoom:_},ii,this.tileMatrix)}setLocation(h){h.lat===this.location.lat&&h.lon===this.location.lon&&h.zoom===this.location.zoom||(this.location.lat=h.lat,this.location.lon=h.lon,this.location.zoom=h.zoom,this.emit("location",this.location),this.emit("change"))}setTileMatrix(h){this.tileMatrix.identifier!==h.identifier&&(this.emit("tileMatrix",this.tileMatrix),this.emit("change"))}setLayerId(h,y){this.layerId===h&&this.style===y||(this.layerId=h,this.style=y??null,this.emit("layer",this.layerId,this.style),this.emit("change"))}setDebug(h,y=mo[h]){this.debug[h]!==y&&(this.debug[h]=y,this.emit("change"))}};async function w1(){let s=new Map,l=await fetch(Ri.toBaseWmts());if(!l.ok)return s;let _=new DOMParser().parseFromString(await l.text(),"text/xml").getElementsByTagName("Layer"),a=[];for(let T=0;T<_.length;T++){let M=_.item(T);if(M==null)continue;let D=M.getElementsByTagName("ows:Title").item(0)?.textContent,N=M.getElementsByTagName("ows:Identifier").item(0)?.textContent;if(D==null||N==null||D==="aerial")continue;let L=M.getElementsByTagName("ows:Keyword").item(0)?.textContent,tt=M.getElementsByTagName("ows:WGS84BoundingBox").item(0),pt=tt?.getElementsByTagName("ows:UpperCorner").item(0)?.textContent?.split(" ").map(Number),ft=tt?.getElementsByTagName("ows:LowerCorner").item(0)?.textContent?.split(" ").map(Number),yt=M.getElementsByTagName("TileMatrixSet"),Ft=new Set;for(let kt=0;kt<yt.length;kt++){let Ot=S1(yt.item(kt)?.textContent??"");Ot!=null&&Ft.add(Ot.code)}pt==null||ft==null||pt.length!==2||a.push({id:N,name:D.replace("aerial ",""),upperLeft:pt,lowerRight:ft,projections:Ft,category:L})}a.sort((T,M)=>T.name.localeCompare(M.name)),M1(s);for(let T of a)s.set(T.id,T);return s}function M1(s){s.set("aerial",{id:"aerial",name:"Aerial Imagery",projections:new Set([We.Nztm2000,We.Google]),category:"Basemaps"}),s.set("topographic::topographic",{id:"topographic::topographic",name:"Topographic",projections:new Set([We.Google]),category:"Basemaps"})}function S1(s){if(s.toLowerCase().startsWith("epsg"))return Ve.parse(s);let l=ma.find(s);return l==null?null:l.projection}var T1=sf(),Pt={get BaseUrl(){return""},get ApiKey(){return T1},get GoogleAnalytics(){return"UA-23232486-3"},get Version(){return"v6.32.1"},map:new tn};if(Pt.GoogleAnalytics!==""&&typeof window<"u"){window.dataLayer=window.dataLayer||[],window.gtag=function(){window.dataLayer.push(arguments)},window.gtag("js",new Date),window.gtag("config",`${Pt.GoogleAnalytics}`);let s=document.createElement("script");s.setAttribute("async",""),s.setAttribute("src",`https://www.googletagmanager.com/gtag/js?id=${Pt.GoogleAnalytics}`),document.head.appendChild(s)}function Ma(s,l,h){Pt.GoogleAnalytics!==""&&window.gtag("event",l,{event_category:s,value:h})}Z();Jr();var $l=class extends Ti{render(l){return K("i",{class:"material-icons-round md-36"},l.name)}},Ln=class extends Ti{render(l){return K("a",{rel:"noopener",target:"_blank",href:l.href,style:"display:flex;","aria-label":l.ariaLabel},l.children,l.icon?K($l,{name:l.icon}):void 0)}};var vc=class extends Ti{constructor(){super(...arguments);this._events=[]}componentWillMount(){this._events.push(Pt.map.on("change",()=>this.setState(this.state)))}componentWillUnmount(){for(let h of this._events)h();this._events=[]}render(){if(!Pt.map.isDebug)return K("footer",{class:"lui-footer lui-footer-small lui-hide-sm lui-hide-xs",role:"contentinfo"},K("div",{class:"lui-footer-columns"},K("div",{style:"display:flex; align-items:center"},K(Ln,{href:"http://www.govt.nz/",ariaLabel:"New Zealand Government"},K("img",{src:"/assets/logo-nz-govt.svg"}))),K("div",{class:"justify-end"},K("ul",{class:"lui-footer-list"},K("li",{class:"lui-footer-inline-list-item"},"\xA9 2021 Land Information New Zealand"),K("li",{class:"lui-footer-inline-list-item"},K(Ln,{href:"https://www.linz.govt.nz/contact-us"},"Contact")),K("li",{class:"lui-footer-inline-list-item"},K(Ln,{href:"https://www.linz.govt.nz/privacy"},"Privacy")),K("li",{class:"lui-footer-inline-list-item"},K(Ln,{href:"https://www.linz.govt.nz/data/linz-data/linz-basemaps/data-attribution"},"Data Attribution"))))))}};Z();Z();function og(s){var l,h,y="";if(typeof s=="string"||typeof s=="number")y+=s;else if(typeof s=="object")if(Array.isArray(s))for(l=0;l<s.length;l++)s[l]&&(h=og(s[l]))&&(y&&(y+=" "),y+=h);else for(l in s)s[l]&&(y&&(y+=" "),y+=l);return y}function bc(){for(var s=0,l,h,y="";s<arguments.length;)(l=arguments[s++])&&(h=og(l))&&(y&&(y+=" "),y+=h);return y}Jr();Z();Jr();Jr();Z();Jr();var cs=class extends Ti{constructor(){super(...arguments);this._copyTimeout=null;this.copy=()=>{Ma("Ui","copy:"+Pt.map.layerKey+":"+this.props.header.replace(/ /g,"").toLowerCase()),navigator.clipboard.writeText(this.props.value),this.setState({copied:!0}),this._copyTimeout!=null&&clearTimeout(this._copyTimeout),this._copyTimeout=setTimeout(()=>this.setState({copied:!1}),1e3)}}render(){return K("div",{class:"LuiDeprecatedForms"},K("label",null,this.props.header),K("div",{class:bc({"lui-menu-label":!0,"menu-copyable":!0,"menu-copyable-copied":this.state.copied})},K("button",{class:"menu-copyable-icon-button",title:"Copy",onClick:this.copy},K("i",{class:"material-icons-round"},this.state.copied?"check":"content_copy")),K("input",{value:this.props.value,readonly:!0})))}};Z();Jr();var wc=class extends Ti{constructor(){super(...arguments);this._events=[];this.onChange=h=>{let y=h.target,[_,a]=y.value.split("::");Pt.map.setLayerId(_,a),Ma("Ui","layer:"+y.value),Pt.map.layers.then(T=>{let M=T.get(_);M!=null&&Pt.map.emit("bounds",[M.upperLeft,M.lowerRight])}),window.history.pushState(null,"",`?${tn.toUrl(Pt.map)}`)}}componentWillMount(){this.setState({...this.state,currentLayer:Pt.map.layerKey}),Pt.map.layers.then(h=>this.setState({...this.state,layers:h})),this._events.push(Pt.map.on("layer",()=>this.setState({...this.state,currentLayer:Pt.map.layerKey})),Pt.map.on("tileMatrix",()=>this.setState(this.state)))}componentWillUnmount(){for(let h of this._events)h();this._events=[]}render(){return K("div",{class:"LuiDeprecatedForms"},K("h6",null,"Layers"),K("select",{onChange:this.onChange,value:this.state.currentLayer},this.renderAerialLayers()))}renderAerialLayers(){if(this.state.layers==null||this.state.layers.size===0)return;let h=new Map;for(let _ of this.state.layers.values()){if(!_.projections.has(Pt.map.tileMatrix.projection.code))continue;let a=h.get(_.category??"Unknown")??[];a.push(K("option",{value:_.id},_.name.replace(` ${_.category}`,""))),h.set(_.category??"Unknown",a)}if(h.size===0)return;let y=[];for(let[_,a]of h.entries())a.length!==0&&y.push(K("optgroup",{label:_},...a));return K(_t,null,y)}};var Mc=class extends Ti{constructor(){super(...arguments);this._events=[];this.menuToggle=()=>{let h=!this.state.isMenuOpen;Ma("Ui",h?"menu:open":"menu:close"),this.setState({...this.state,isMenuOpen:h})};this.contactUs=()=>{let h="Request Basemaps Developer Access",y=`
|
|
551
|
+
Give us a few key details to sign up for Developer Access to LINZ Basemaps. We will respond with your Apps' unique API key.
|
|
552
|
+
|
|
553
|
+
Your Name:
|
|
554
|
+
|
|
555
|
+
Your Email:
|
|
556
|
+
|
|
557
|
+
Your Service/App URL:
|
|
558
|
+
|
|
559
|
+
`;Ma("Ui","contact-us:click"),window.location.href=`mailto:basemaps@linz.govt.nz?subject=${encodeURI(h)}&body=${encodeURI(y)}`};this._validProjections=new Set([We.Google,We.Nztm2000])}componentWillMount(){this.setState({isMenuOpen:!1}),this._events.push(Pt.map.on("change",()=>this.setState(this.state))),Pt.map.layers.then(h=>this.setState({...this.state,layers:h}))}componentWillUnmount(){for(let h of this._events)h();this._events=[]}render(){if(!Pt.map.isDebug)return K("header",{class:"lui-header"},K("div",{class:"lui-header-row"},K("div",{class:"lui-header-col"},K("div",{class:"lui-header-logo"},K("img",{class:"linz-logo",src:"/assets/logo-linz.svg"})),K("div",{class:"lui-header-title"},K("h1",null,"Basemaps"))),K("div",{class:"lui-header-col"},K("div",{class:"lui-header-menu-item"},K("div",{class:"lui-header-menu-icon"},K("i",{class:"material-icons-round md-36",onClick:this.menuToggle,style:{cursor:"pointer"}},this.state.isMenuOpen?"close":"menu"))))),K("div",{class:bc({"lui-menu-drawer":!0,"lui-menu-drawer-closed":!this.state.isMenuOpen,"lui-menu-drawer-wide":!0}),"aria-hidden":this.state.isMenuOpen},K(wc,null),this.renderLinks(),K("h6",null,"Developer API Keys"),K("p",null,"Contact us for free API keys with better support for public web and mobile apps."),K("button",{class:"lui-button lui-button-tertiary contact-us",onClick:this.contactUs},"Contact us"),this.renderAbout()))}renderAboutLi(h,y,_){return K("li",null,K(Ln,{href:y},h,_??K($l,{name:"launch"})))}renderAbout(){return K(_t,null,K("h6",null,"About Basemaps"),K("ul",{class:"about-links"},this.renderAboutLi("Get started","https://www.linz.govt.nz/data/linz-data/linz-basemaps/get-started-linz-basemaps"),this.renderAboutLi("Technical information","https://www.linz.govt.nz/data/linz-data/linz-basemaps/linz-basemaps-documentation"),this.renderAboutLi("How to use our APIs","https://www.linz.govt.nz/data/linz-data/linz-basemaps/how-use-linz-basemaps-apis"),this.renderAboutLi("Github","https://github.com/linz/basemaps",this.renderGithubLogo()),K("li",null,K(Ln,{href:"https://github.com/linz/basemaps/blob/master/CHANGELOG.md"},"Version ",K("span",{class:"basemaps-version"},Pt.Version)))))}renderGithubLogo(){return K("svg",{style:"width: 24px; height: 24px",viewBox:"0 0 24 24"},K("path",{fill:"currentColor",d:"M12,2A10,10 0 0,0 2,12C2,16.42 4.87,20.17 8.84,21.5C9.34,21.58 9.5,21.27 9.5,21C9.5,20.77 9.5,20.14 9.5,19.31C6.73,19.91 6.14,17.97 6.14,17.97C5.68,16.81 5.03,16.5 5.03,16.5C4.12,15.88 5.1,15.9 5.1,15.9C6.1,15.97 6.63,16.93 6.63,16.93C7.5,18.45 8.97,18 9.54,17.76C9.63,17.11 9.89,16.67 10.17,16.42C7.95,16.17 5.62,15.31 5.62,11.5C5.62,10.39 6,9.5 6.65,8.79C6.55,8.54 6.2,7.5 6.75,6.15C6.75,6.15 7.59,5.88 9.5,7.17C10.29,6.95 11.15,6.84 12,6.84C12.85,6.84 13.71,6.95 14.5,7.17C16.41,5.88 17.25,6.15 17.25,6.15C17.8,7.5 17.45,8.54 17.35,8.79C18,9.5 18.38,10.39 18.38,11.5C18.38,15.32 16.04,16.16 13.81,16.41C14.17,16.72 14.5,17.33 14.5,18.26C14.5,19.6 14.5,20.68 14.5,21C14.5,21.27 14.66,21.59 15.17,21.5C19.14,20.16 22,16.42 22,12A10,10 0 0,0 12,2Z"}))}renderLinks(){return K(_t,null,K("h6",null,"90 day API keys"),K("p",null,"API keys expire after 90 days, if a longer duration is needed please request a developer API key"),K(cs,{header:"Api Key",value:Pt.ApiKey}),this.renderLinksTiles())}validProjections(){return this.state.layers==null?this._validProjections:this.state.layers.get(Pt.map.layerId)?.projections??this._validProjections}renderLinksTiles(){if(Pt.map.isVector)return K(_t,null,K(cs,{header:"StyleJSON",value:Pt.map.toTileUrl("style")}),K(cs,{header:"XYZ",value:Pt.map.toTileUrl("vector-xyz")}));let h=this.validProjections(),y=[];if(h.has(We.Nztm2000)){let _=Pt.map.toTileUrl("wmts",An);y.push(K(cs,{header:"WMTS: NZTM2000Quad",value:_}))}if(h.has(We.Google)){let _=Pt.map.toTileUrl("wmts",ii),a=Pt.map.toTileUrl("raster",ii);y.push(K(cs,{header:"WMTS: WebMercatorQuad",value:_})),y.push(K(cs,{header:"XYZ",value:a}))}return K(_t,null,y)}};Z();var zo=da(Sc(),1);Jr();Z();Z();Z();function cg(s){let l=document.createElement("span");return l.textContent=s,l.innerHTML}var pp=class{constructor(l){this.boundaries=[],this.collection=l;let h=l.summaries["linz:zoom"];this.minZoom=h.min,this.maxZoom=h.max,this.bbox=l.extent.spatial.bbox[0]}intersects(l,h){return h>this.maxZoom||h<this.minZoom||!Fs.intersects(l,this.bbox)?!1:this.intersection(Fs.bboxToMultiPolygon(l))}intersection(l){for(let h of this.boundaries)if(Wu(h,l).length>0)return!0;return!1}addBoundary(l){E1(l),this.boundaries.push(l)}};function E1(s){for(let l of s)for(let h of l)if(h.length!==2)throw new Error("Invalid ring wrong length")}function I1(s){var l;let h=new Map,y=[];for(let _ of s.collections){let a=new pp(_);y.push(a),h.set(_.id,a)}for(let _ of s.features){let a=h.get((l=_.collection)!==null&&l!==void 0?l:"");if(a==null)throw new Error("Could not match feature to collection: "+_.collection);if(_.geometry.type==="Polygon")a.addBoundary(_.geometry.coordinates);else if(_.geometry.type==="MultiPolygon")for(let T of _.geometry.coordinates)a.addBoundary(T)}return y}function ug(s){let{interval:l}=s.extent.temporal;if(l==null||l.length===0)return[-1,-1];let h=l[0],y=new Date(h[0]).getFullYear(),_=(h.length<2?y:new Date(h[1]).getFullYear())-1;return[y,_<y?y:_]}var Vs=class{constructor(l){this.attributions=l}static async load(l){let h=await fetch(l);if(h.ok){let y=await h.json();return Vs.fromStac(y)}throw new Error(`fetch attribution failed [${h.status}] ${h.statusText}`)}static fromStac(l){return new Vs(I1(l).reverse())}filter(l,h){h=Math.round(h);let y=[],{attributions:_}=this;if(_==null)return y;for(let a of _)this.isIgnored!=null&&this.isIgnored(a)||a.intersects(l,h)&&y.push(a.collection);return y}renderList(l){if(l.length===0)return"";let h=cg(l[0].title);if(l.length>1)if(l.length===2)h+=` & ${cg(l[1].title)}`;else{let[y,_]=ug(l[1]);for(let a=1;a<l.length;++a){let[T,M]=ug(l[a]);T!==-1&&(y===-1||T<y)&&(y=T),M!==-1&&(_===-1||M>_)&&(_=M)}y===-1&&(y=_),_!==-1&&(h+=` & others ${y}-${_}`)}return h}};var Wl=da(Sc(),1);var pg=`\xA9 ${of.License} LINZ`,dg=new Map,fg=new Map,Tc=class{constructor(l){this._raf=0;this.attributionHtml="";this.bounds=new Wl.LngLatBounds([0,0,0,0]);this.zoom=-1;this.filteredRecords=[];this.resetAttribution=()=>{this.attributionHtml="",this.updateAttribution()};this.updateAttribution=()=>{if(Pt.map.isVector)return this.vectorAttribution();let l=Pt.map.layerKeyTms,h=dg.get(l);h==null&&(h=Vs.load(Pt.map.toTileUrl("attribution")).catch(()=>null),dg.set(l,h),h.then(y=>{y!=null&&(y.isIgnored=this.isIgnored,fg.set(l,y),this.scheduleRender())})),this.scheduleRender()};this.isIgnored=l=>{let h=l.collection.title.toLowerCase();return h.startsWith("geographx")||h.includes(" dem ")};this.renderAttribution=()=>{this._raf=0;let l=fg.get(Pt.map.layerKeyTms);if(l==null)return this.removeAttribution();this.zoom=Math.round(this.map.getZoom()??0),this.bounds=this.map.getBounds(),this.zoom+=1;let h=this.mapboxBoundToBbox(this.bounds,Pt.map.tileMatrix),y=l.filter(h,this.zoom),_=l.renderList(y);if(_===""?_=pg:_=pg+" - "+_,_!==this.attributionHtml){let a=this.attributionHtml=_;this.removeAttribution(),this.attributionControl=new Wl.default.AttributionControl({compact:!1,customAttribution:a}),this.map.addControl(this.attributionControl,"bottom-right")}this.filteredRecords=y};this.map=l,Gs(l,this.resetAttribution),l.on("move",this.updateAttribution),Pt.map.on("tileMatrix",this.resetAttribution),Pt.map.on("layer",this.resetAttribution)}scheduleRender(){this._scheduled!=null||this._raf!==0||this.map.getZoom()===this.zoom&&this.map.getBounds()===this.bounds||(this.zoom=this.map.getZoom()??0,this.bounds=this.map.getBounds(),this._scheduled=setTimeout(()=>{this._scheduled=void 0,this._raf=requestAnimationFrame(this.renderAttribution)},200))}removeAttribution(){this.attributionControl!=null&&(this.map.removeControl(this.attributionControl),this.attributionControl=null)}mapboxBoundToBbox(l,h){let y={lon:l.getWest(),lat:l.getSouth(),zoom:this.zoom},_={lon:l.getEast(),lat:l.getNorth(),zoom:this.zoom},a=kn(y,ii,h),T=kn(_,ii,h);return[a.lon,a.lat,T.lon,T.lat]}vectorAttribution(){this.removeAttribution(),this.attributionControl=new Wl.default.AttributionControl({compact:!1}),this.map.addControl(this.attributionControl,"bottom-right")}};Z();Jr();function Ec(s,l){return K("input",{className:"debug__slider",type:"range",min:"0",max:"1",step:"0.05",value:String(Pt.map.debug[`debug.layer.${s}`]),onInput:l})}var Ic=class extends Ti{constructor(){super(...arguments);this.waitForMap=()=>{let h=this.props.map;if(h==null){setTimeout(this.waitForMap,20);return}window.MaplibreMap=h,h.resize(),Gs(h,()=>{Pt.map.on("change",()=>{if(this.props.map==null)return;let y=Ri.toHash(Pt.map.getLocation(this.props.map)),_="?"+tn.toUrl(Pt.map);window.history.replaceState(null,"",_+y),this.updateFromConfig()}),this.updateFromConfig(),Pt.map.debug["debug.screenshot"]&&h.once("idle",()=>{let y=document.createElement("div");y.id="map-loaded",y.style.width="1px",y.style.height="1px",document.body.appendChild(y)})})};this.toggleCogs=h=>{let y=h.target;Pt.map.setDebug("debug.cog",y.checked),this.setVectorShown(y.checked,"cog")};this.toggleSource=h=>{let y=h.target;Pt.map.setDebug("debug.source",y.checked),this.setVectorShown(y.checked,"source")};this._layerLoading=new Map;this._styleJson=null;this.adjustTopographic=h=>{let y=h.target;Pt.map.setDebug("debug.layer.linz-topographic",Number(y.value))};this.adjustOsm=h=>{Pt.map.setDebug("debug.layer.osm",Number(h.target.value))};this.adjustLinzAerial=h=>{Pt.map.setDebug("debug.layer.linz-aerial",Number(h.target.value))};this.togglePurple=h=>{let y=h.target;this.setPurple(y.checked)}}componentDidMount(){this.waitForMap()}updateFromConfig(){this.setPurple(Pt.map.debug["debug.background"]==="magenta"),this.adjustRaster("osm",Pt.map.debug["debug.layer.osm"]),this.adjustRaster("linz-aerial",Pt.map.debug["debug.layer.linz-aerial"]),this.adjustVector(Pt.map.debug["debug.layer.linz-topographic"]),this.setVectorShown(Pt.map.debug["debug.source"],"source"),this.setVectorShown(Pt.map.debug["debug.cog"],"cog")}render(){return Pt.map.debug["debug.screenshot"]?null:K("div",{className:"debug"},K("div",{className:"debug__info"},K("label",{className:"debug__label"},"ImageId"),K("div",{className:"debug__value"},Pt.map.layerId)),K("div",{className:"debug__info"},K("label",{className:"debug__label"},"Projection "),K("div",{className:"debug__value"},Pt.map.tileMatrix.projection.toEpsgString())),K("div",{className:"debug__info"},K("label",{className:"debug__label"},"TileMatrix "),K("div",{className:"debug__value"},Pt.map.tileMatrix.identifier)),this.renderSliders(),this.renderPurple(),this.renderCogToggle(),this.renderSourceToggle())}renderPurple(){if(!Pt.map.debug["debug.screenshot"])return K("div",{className:"debug__info"},K("label",{className:"debug__label"},"Purple"),K("input",{type:"checkbox",onClick:this.togglePurple,checked:Pt.map.debug["debug.background"]==="magenta"}))}renderCogToggle(){if(!Pt.map.layerId.startsWith("01"))return null;let h=Ri.toImageryUrl(`im_${Pt.map.layerId}`,"covering.geojson");return K(_t,null,K("div",{className:"debug__info"},K("label",{className:"debug__label"},K("a",{href:h,title:"Source geojson"},"Cogs")),K("input",{type:"checkbox",onClick:this.toggleCogs,checked:Pt.map.debug["debug.cog"]})),this.state.featureSourceId==null?null:K("div",{className:"debug__info",title:String(this.state.featureCogName)},K("label",{className:"debug__label"},"CogId"),String(this.state.featureCogName).split("/").pop()))}renderSourceToggle(){if(!Pt.map.layerId.startsWith("01"))return null;let h=Ri.toImageryUrl(`im_${Pt.map.layerId}`,"source.geojson");return K(_t,null,K("div",{className:"debug__info"},K("label",{className:"debug__label"},K("a",{href:h,title:"Source geojson"},"Source")),K("input",{type:"checkbox",onClick:this.toggleSource,checked:Pt.map.debug["debug.source"]})),this.state.featureSourceId==null?null:K("div",{className:"debug__info",title:String(this.state.featureSourceName)},K("label",{className:"debug__label"},"SourceId"),String(this.state.featureSourceName).split("/").pop()))}trackMouseMove(h,y){let _=`${h}_${y}`,a=`${_}_fill`,T=this.props.map,M,D=y==="source"?"featureSource":"featureCog";T.on("mousemove",a,N=>{let L=N.features;if(L==null||L.length===0)return;let tt=L[0];tt.id!==M&&(M!=null&&T.setFeatureState({source:_,id:M},{hover:!1}),M=tt.id,this.setState({...this.state,[`${D}Id`]:M,[`${D}Name`]:tt.properties?.name}),T.setFeatureState({source:_,id:M},{hover:!0}))}),T.on("mouseleave",a,()=>{M!=null&&(T.setFeatureState({source:_,id:M},{hover:!1}),M=void 0,this.setState({...this.state,[`${D}Id`]:void 0,[`${D}Name`]:void 0}))})}setVectorShown(h,y){let _=this.props.map,a=Pt.map.layerId,T=`${a}_${y}`,M=`${T}_fill`,D=`${T}_line`;if(h===!1){if(_.getLayer(M)==null)return;_.removeLayer(M),_.removeLayer(D);return}if(_.getLayer(D)!=null)return;let N=y==="source"?"#ff00ff":"#ff0000";this.loadSourceLayer(a,y).then(()=>{_.getLayer(D)==null&&(_.addLayer({id:M,type:"fill",source:T,paint:{"fill-opacity":["case",["boolean",["feature-state","hover"],!1],.25,0],"fill-color":N}}),this.trackMouseMove(a,y),_.addLayer({id:D,type:"line",source:T,paint:{"line-color":N,"line-opacity":["case",["boolean",["feature-state","hover"],!1],1,.5],"line-width":["case",["boolean",["feature-state","hover"],!1],2,1]}}))})}loadSourceLayer(h,y){let _=`${h}-${y}`,a=this._layerLoading.get(_);return a==null&&(a=this._loadSourceLayer(h,y),this._layerLoading.set(_,a)),a}async _loadSourceLayer(h,y){let _=this.props.map,a=`${h}_${y}`,T=`${a}_fill`;if(_.getLayer(T)!=null)return;let M=Ri.toImageryUrl(`im_${h}`,y==="source"?"source.geojson":"covering.geojson"),D=await fetch(M);if(!D.ok)return;let N=await D.json();Pt.map.tileMatrix.projection!==ii.projection&&ng(N,Pt.map.tileMatrix);let L=0;for(let tt of N.features)tt.id=L++;_.addSource(a,{type:"geojson",data:N})}renderSliders(){if(!Pt.map.debug["debug.screenshot"])return Pt.map.tileMatrix.identifier!==ii.identifier?K("div",{className:"debug__info"},K("label",{className:"debug__label"},"LINZ Aerial"),Ec("linz-aerial",this.adjustLinzAerial)):K(_t,null,K("div",{className:"debug__info"},K("label",{className:"debug__label"},"OSM"),Ec("osm",this.adjustOsm)),K("div",{className:"debug__info"},K("label",{className:"debug__label"},"Topographic"),Ec("linz-topographic",this.adjustTopographic)),K("div",{className:"debug__info"},K("label",{className:"debug__label"},"LINZ Aerial"),Ec("linz-aerial",this.adjustLinzAerial)))}get styleJson(){return this._styleJson==null&&(this._styleJson=fetch(Ri.toTileUrl("style",Pt.map.tileMatrix,"topographic","topographic")).then(h=>h.json())),this._styleJson}async adjustVector(h){let y=await this.styleJson,_=this.props.map;if(_.getSource("LINZ Basemaps")==null){if(h===0)return;let M=y.sources?.["LINZ Basemaps"];if(M==null)return;_.addSource("LINZ Basemaps",M),_.setStyle({..._.getStyle(),glyphs:y.glyphs,sprite:y.sprite}),_.once("style.load",()=>this.adjustVector(h));return}let T=y.layers?.filter(M=>M.type!=="background"&&M.source==="LINZ Basemaps")??[];if(Pt.map.layerId!=="topographic"){for(let M of T){let D=M.paint??{};M.type==="symbol"?(D["icon-opacity"]=0,D["text-opacity"]=0):D[`${M.type}-opacity`]=0,M.paint=D}if(h===0){for(let M of T)_.getLayer(M.id)!=null&&_.removeLayer(M.id);return}if(_.getLayer(T[0].id)==null){if(h===0)return;for(let M of T)_.addLayer(M)}for(let M of T)_.getLayer(M.id)!=null&&(M.type==="symbol"?(_.setPaintProperty(M.id,"icon-opacity",h),_.setPaintProperty(M.id,"text-opacity",h)):_.setPaintProperty(M.id,`${M.type}-opacity`,h))}}adjustRaster(h,y){this.props.map.getSource(h)==null&&this.props.map.addSource(h,{type:"raster",tiles:[C1(h)],tileSize:256});let _=this.props.map.getLayer(h)==null;if(y===0){_||this.props.map.removeLayer(h);return}if(_){this.props.map.addLayer({id:h,type:"raster",source:h,minzoom:0,maxzoom:24,paint:{"raster-opacity":0}});let a=`${Pt.map.layerId}_source_fill`;this.props.map.getLayer(a)!=null&&this.props.map.moveLayer(h,a)}this.props.map.setPaintProperty(h,"raster-opacity",y)}setPurple(h){Pt.map.setDebug("debug.background",h?"magenta":!1),h?document.body.style.backgroundColor="magenta":document.body.style.backgroundColor=""}};function C1(s){if(s==="osm")return"https://tile.openstreetmap.org/{z}/{x}/{y}.png";if(s==="linz-aerial")return Ri.toTileUrl("raster",Pt.map.tileMatrix,"aerial");throw new Error("Unknown tile server")}Z();var mg=da(Sc(),1);Jr();var Cc=class extends Ti{constructor(){super(...arguments);this._events=[];this._updateTimer=null;this.update=()=>{this._updateTimer==null&&(this._updateTimer=setTimeout(this.updateMap,1e3))};this.updateMap=()=>{this._updateTimer=null;let h=Pt.map.transformedLocation,y=this.getStyleType(),_=`${y.layerId}::${y.style}`;if(this.currentStyle!==_){let T=Po(Pt.map.tileMatrix.identifier).getStyle(y.layerId,y.style);this.currentStyle=_,this.map.setStyle(T)}this.map.setZoom(Math.max(h.zoom-4,0)),this.map.setCenter([h.lon,h.lat]),this.setState(this.state)};this.switchLayer=()=>{let h=this.getStyleType();Pt.map.setLayerId(h.layerId,h.style),this.updateMap(),window.history.pushState(null,"",`?${tn.toUrl(Pt.map)}`)}}componentDidMount(){if(Pt.map.updateFromUrl(),this.el=document.getElementById("map-switcher-map"),this.el==null)return;let h=Pt.map,y=Po(h.tileMatrix.identifier),_=this.getStyleType();this.currentStyle=`${_.layerId}::${_.style}`;let a=y.getStyle(_.layerId,_.style),T=h.transformedLocation;this.map=new mg.default.Map({container:this.el,style:a,center:[T.lon,T.lat],zoom:T.zoom,attributionControl:!1}),Gs(this.map,()=>{this._events.push(Pt.map.on("location",this.update),Pt.map.on("tileMatrix",this.update),Pt.map.on("layer",this.update),Pt.map.on("bounds",this.update)),this.updateMap()})}componentWillUnmount(){this.map&&this.map.remove();for(let h of this._events)h()}getStyleType(){return Pt.map.layerId!=="aerial"?{layerId:"aerial"}:{layerId:"topographic",style:"topographic"}}render(){let h=`Switch map to ${this.getStyleType().layerId}`;return K("div",{id:"map-switcher",class:"map-switcher",onClick:this.switchLayer,title:h},K("div",{id:"map-switcher-map",style:{width:"100%",height:"100%",pointerEvents:"none"}}))}};function Gs(s,l){if(s.loaded())return l();setTimeout(()=>Gs(s,l),100)}var Ac=class extends Ti{constructor(){super(...arguments);this.ignoreNextLocationUpdate=!1;this.updateLocation=()=>{if(this.ignoreNextLocationUpdate){this.ignoreNextLocationUpdate=!1;return}let h=Pt.map.location;this.map.setZoom(h.zoom),this.map.setCenter([h.lon,h.lat])};this.updateBounds=h=>{if(Pt.map.tileMatrix!==ii){let y=zo.default.LngLatBounds.convert(h),_=y.getNorthEast(),a=y.getSouthWest(),T=this.map.getZoom(),M=kn({lat:_.lat,lon:_.lng,zoom:T},Pt.map.tileMatrix,ii),D=kn({lat:a.lat,lon:a.lng,zoom:T},Pt.map.tileMatrix,ii);h=[[M.lon,M.lat],[D.lon,D.lat]]}this.map.fitBounds(h)};this.updateStyle=()=>{this.ensureGeoControl();let y=Po(Pt.map.tileMatrix.identifier).getStyle(Pt.map.layerId,Pt.map.style);this.map.setStyle(y),Pt.map.tileMatrix!==ii?this.map.setMaxBounds([-180,-85.06,180,85.06]):this.map.setMaxBounds(),this.setState(this.state)};this._events=[];this.updateUrlTimer=null;this.onRender=()=>{this.updateUrlTimer==null&&(this.updateUrlTimer=setTimeout(()=>this.setLocationUrl(),1e3))}}ensureGeoControl(){if(!Pt.map.debug["debug.screenshot"])if(Pt.map.tileMatrix===ii){if(this.controlGeo!=null)return;this.controlGeo=new zo.default.GeolocateControl({}),this.map.addControl(this.controlGeo,"top-left")}else{if(this.controlGeo==null)return;this.map.removeControl(this.controlGeo)}}componentDidMount(){if(Pt.map.updateFromUrl(),this.el=document.getElementById("map"),this.el==null)throw new Error("Unable to find #map element");let h=Pt.map,_=Po(h.tileMatrix.identifier).getStyle(h.layerId,h.style),a=kn(h.location,h.tileMatrix,ii);if(this.map=new zo.default.Map({container:this.el,style:_,center:[a.lon,a.lat],zoom:a.zoom,attributionControl:!1}),this.mapAttr=new Tc(this.map),Pt.map.debug["debug.screenshot"]!==!0){let T=new zo.default.NavigationControl({visualizePitch:!0});this.map.addControl(T,"top-left"),Pt.map.isDebug||this.map.addControl(new zo.default.FullscreenControl({container:this.el}))}this.map.on("render",this.onRender),Gs(this.map,()=>{this._events.push(Pt.map.on("location",this.updateLocation),Pt.map.on("tileMatrix",this.updateStyle),Pt.map.on("layer",this.updateStyle),Pt.map.on("bounds",this.updateBounds)),this.updateStyle()})}componentWillUnmount(){this.map&&this.map.remove();for(let h of this._events)h();this._events=[]}render(){let h=Pt.map.tileMatrix===ii&&!Pt.map.isDebug;return K("div",{style:{flex:1,position:"relative"}},K("div",{id:"map",style:{width:"100%",height:"100%"}}),Pt.map.isDebug?K(Ic,{map:this.map}):void 0,h?K(Cc,null):void 0)}setLocationUrl(){this.updateUrlTimer=null;let h=Pt.map.getLocation(this.map);this.ignoreNextLocationUpdate=!0,Pt.map.setLocation(h);let y=Ri.toHash(h);window.history.replaceState(null,"",y)}};Z();var A1="data:image/webp;base64,UklGRiQAAABXRUJQVlA4IBgAAAAwAQCdASoBAAEAAwA0JaQAA3AA/vuUAAA=";function P1(){let s=document.createElement("canvas");return s.getContext&&s.getContext("2d")?s.toDataURL("image/webp").indexOf("data:image/webp")===0:!1}function z1(){let s=new Image,l=new Promise(h=>{s.onload=()=>h(!0),s.onerror=()=>h(!1)});return s.src=A1,l}function gg(){return new Promise(s=>{if(P1())return s(!0);z1().then(s)})}var dp=class extends Ti{render(){return K(_t,null,K(Mc,null),K(Ac,null),K(vc,null))}};document.addEventListener("DOMContentLoaded",async()=>{await await gg()&&(Ri.ImageFormat="webp");let l=document.getElementById("main");if(l==null)throw new Error("Missing #main");Jd(K(dp,null),l)});
|
|
560
|
+
/**
|
|
561
|
+
* splaytree v3.1.0
|
|
562
|
+
* Fast Splay tree for Node and browser
|
|
563
|
+
*
|
|
564
|
+
* @author Alexander Milevski <info@w8r.name>
|
|
565
|
+
* @license MIT
|
|
566
|
+
* @preserve
|
|
567
|
+
*/
|