@basemaps/landing 6.33.0 → 6.35.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/build/__tests__/map.config.test.js +20 -0
  3. package/build/__tests__/map.config.test.js.map +1 -1
  4. package/build/attribution.d.ts +3 -0
  5. package/build/attribution.d.ts.map +1 -1
  6. package/build/attribution.js +1 -1
  7. package/build/attribution.js.map +1 -1
  8. package/build/components/debug.d.ts +15 -19
  9. package/build/components/debug.d.ts.map +1 -1
  10. package/build/components/debug.js +65 -181
  11. package/build/components/debug.js.map +1 -1
  12. package/build/components/layout.header.js +1 -1
  13. package/build/components/layout.header.js.map +1 -1
  14. package/build/config.layer.d.ts +12 -0
  15. package/build/config.layer.d.ts.map +1 -0
  16. package/build/config.layer.js +40 -0
  17. package/build/config.layer.js.map +1 -0
  18. package/build/config.map.d.ts +2 -1
  19. package/build/config.map.d.ts.map +1 -1
  20. package/build/config.map.js +11 -7
  21. package/build/config.map.js.map +1 -1
  22. package/build/debug.map.d.ts +21 -0
  23. package/build/debug.map.d.ts.map +1 -0
  24. package/build/debug.map.js +179 -0
  25. package/build/debug.map.js.map +1 -0
  26. package/build/index.js +2 -0
  27. package/build/index.js.map +1 -1
  28. package/build/tile.matrix.d.ts +1 -1
  29. package/build/tile.matrix.d.ts.map +1 -1
  30. package/build/tile.matrix.js +3 -15
  31. package/build/tile.matrix.js.map +1 -1
  32. package/build/url.d.ts +7 -2
  33. package/build/url.d.ts.map +1 -1
  34. package/build/url.js +42 -11
  35. package/build/url.js.map +1 -1
  36. package/dist/examples/index.openlayers.attribution.wmts.3857.html +1 -1
  37. package/dist/{index-6.33.0-467e63869a31f2e1.css → index-6.35.0-467e63869a31f2e1.css} +0 -0
  38. package/dist/{index-6.33.0-32d4f61662fbd212.js → index-6.35.0-5eab7867ea4ef021.js} +7444 -6861
  39. package/dist/index-6.35.0-96a7f42b0fdac497.js +567 -0
  40. package/dist/index.html +2 -2
  41. package/dist/index.js +35 -35
  42. package/dist/lib/{attribution-6.33.0-a5dcb359f35150b9.js → attribution-6.35.0-b4a0b401b1a4cc45.js} +1 -1
  43. package/dist/lib/{attribution-6.33.0-431936fcac8e2647.js → attribution-6.35.0-fc88f809368e4547.js} +5 -1
  44. package/dist/lib/attribution.js +1 -1
  45. package/package.json +5 -5
  46. package/dist/index-6.33.0-58a76ef19edcbfcf.js +0 -567
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
- var s0=Object.create;var Dd=Object.defineProperty;var a0=Object.getOwnPropertyDescriptor;var o0=Object.getOwnPropertyNames;var l0=Object.getPrototypeOf,h0=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 c0=(s,l,h,y)=>{if(l&&typeof l=="object"||typeof l=="function")for(let _ of o0(l))!h0.call(s,_)&&_!==h&&Dd(s,_,{get:()=>l[_],enumerable:!(y=a0(l,_))||y.enumerable});return s};var da=(s,l,h)=>(h=s!=null?s0(l0(s)):{},c0(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 f0(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"||d0.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=g0),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=m0(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 m0(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(f0(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 g0(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,u0,Ll,Gd,Bd,p0,Hh,qd,d0,Jr=Rd(()=>{Z();Hh={},qd=[],d0=/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,u0=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,p0=0});var Z=Rd(()=>{Jr()});var Qd=Ds(()=>{Z()});var hf=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 cf=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 uf=Ds(fo=>{"use strict";Z();Object.defineProperty(fo,"__esModule",{value:!0});fo.Nztm2000=fo.Nztm2000Quad=void 0;var T0=hf();Object.defineProperty(fo,"Nztm2000Quad",{enumerable:!0,get:function(){return T0.Nztm2000Quad}});var E0=cf();Object.defineProperty(fo,"Nztm2000",{enumerable:!0,get:function(){return E0.Nztm2000}})});var df=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 pf(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){pf(this.$[l],...h),pf(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 mf=Ds((Ib,ff)=>{"use strict";Z();ff.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 gf=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 cg{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 cg(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 _g=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=xg(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 xg(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 vg(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 bg(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(wg(o,u,t[f],t[f+1]))return!0}return!1}function wg(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 Mg(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 Sg=new Oi({"circle-sort-key":new de(ct.layout_circle["circle-sort-key"])});var Tg={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:Sg},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,Eg=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 Ig={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 Cg={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 Ag=Ni([{name:"a_pos",components:2,type:"Int16"}],4),{members:Pg}=Ag;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(Og(Rt));for(zt.sort(Rg),vt=0;vt<zt.length;vt++)dt=As(dt=Bg(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?kg(i,o,u,f):zg(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=Lg(As(i),t,r),t,r,o,u,f,2):m===2&&Dg(i,t,r,o,u,f):vl(As(i),t,r,o,u,f,1);break}}}function zg(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 kg(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 Lg(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 Dg(i,t,r,o,u,f){var m=i;do{for(var x=m.next.next;x!==m.prev;){if(m.i!==x.i&&Ng(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 Rg(i,t){return i.x-t.x}function Bg(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&&Fg(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 Fg(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 Og(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 Ng(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 Ug(i,t,r,o,u){Lp(i,t,r||0,o||i.length-1,u||Vg)}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 Vg(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||(Ug(o[m],t,1,o[m].length-1,Gg),o[m]=o[m].slice(0,t));return o}function Gg(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,Pg),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 qg=new Oi({"fill-sort-key":new de(ct.layout_fill["fill-sort-key"])});var jg={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:qg};let $g=Ni([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),{members:Wg}=$g;var Ps={},Zg=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(Hg,this,t)}function Hg(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 Xg(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 Zg(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=Xg(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 Kg=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(Yg,this,t),this.length=this._features.length}function Yg(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 Kg(this._pbf,t,this.extent,this._keys,this._values)};var Jg=Rp;function Qg(i,t,r){if(i===3){var o=new Jg(r,r.readVarint()+r.pos);o.length&&(t[o.name]=o)}}Ps.VectorTile=function(i,t){this.layers=i.readFields(Qg,{},t)},Ps.VectorTileFeature=Dp,Ps.VectorTileLayer=Rp;let ty=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,Wg),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||iy(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(!ey(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)),ty[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 ey(i,t){return i.x===t.x&&(i.x<0||i.x>Ui)||i.y===t.y&&(i.y<0||i.y>Ui)}function iy(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 ry={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 ny=Ni([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:sy}=ny,ay=Ni([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:oy}=ay,ly=Ps.VectorTileFeature.types,hy=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,oy)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,sy),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=ly[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<hy&&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 cy=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:cy};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 uy=Ni([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),py=Ni([{name:"a_projected_pos",components:3,type:"Float32"}],4);Ni([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);let dy=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),fy=Ni([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function my(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 gy(i,t){for(var r=0;r<i.length;r++)t.writeVarint(i[r])}function yy(i,t){for(var r=0;r<i.length;r++)t.writeSVarint(i[r])}function _y(i,t){for(var r=0;r<i.length;r++)t.writeFloat(i[r])}function xy(i,t){for(var r=0;r<i.length;r++)t.writeDouble(i[r])}function vy(i,t){for(var r=0;r<i.length;r++)t.writeBoolean(i[r])}function by(i,t){for(var r=0;r<i.length;r++)t.writeFixed32(i[r])}function wy(i,t){for(var r=0;r<i.length;r++)t.writeSFixed32(i[r])}function My(i,t){for(var r=0;r<i.length;r++)t.writeFixed64(i[r])}function Sy(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 Ty(i,t,r){i===1&&r.readMessage(Ey,t)}function Ey(i,t,r){if(i===3){let{id:o,bitmap:u,width:f,height:m,left:x,top:b,advance:E}=r.readMessage(Iy,{});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 Iy(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,gy,t)},writePackedSVarint:function(i,t){t.length&&this.writeMessage(i,yy,t)},writePackedBoolean:function(i,t){t.length&&this.writeMessage(i,vy,t)},writePackedFloat:function(i,t){t.length&&this.writeMessage(i,_y,t)},writePackedDouble:function(i,t){t.length&&this.writeMessage(i,xy,t)},writePackedFixed32:function(i,t){t.length&&this.writeMessage(i,by,t)},writePackedSFixed32:function(i,t){t.length&&this.writeMessage(i,wy,t)},writePackedFixed64:function(i,t){t.length&&this.writeMessage(i,My,t)},writePackedSFixed64:function(i,t){t.length&&this.writeMessage(i,Sy,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),Py(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},Cy={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 Ay(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)));(Cy[G]||et||O.imageName)&&x.push(Qp(R+1,A,b,x,Ay(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 Py(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 zy(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 ky(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 Ly(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 Dy{constructor(t=[],r=Ry){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 Ry(i,t){return i<t?-1:i>t?1:0}function By(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 Dy([],Fy);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 Fy(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 Oy(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 Yy=xn?xn.boxStartIndex:ue.collisionBoxArray.length,Jy=xn?xn.boxEndIndex:ue.collisionBoxArray.length,Qy=pn?pn.boxStartIndex:ue.collisionBoxArray.length,t0=pn?pn.boxEndIndex:ue.collisionBoxArray.length,e0=Yn?Yn.boxStartIndex:ue.collisionBoxArray.length,i0=Yn?Yn.boxEndIndex:ue.collisionBoxArray.length,r0=Yr?Yr.boxStartIndex:ue.collisionBoxArray.length,n0=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,Yy,Jy,Qy,t0,e0,i0,r0,n0,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=Ly(Gt,vt,zt,r.vertical||G,o,24,dt,i.overscaling,Ui);for(let ue of fe){let Be=G;Be&&Ny(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=ky(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=By(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 Ny(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 Uy=Ps.VectorTileFeature.types,Vy=[{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 Gy(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,uy.members),this.indexBuffer=t.createIndexBuffer(this.indexArray,r),this.dynamicLayoutVertexBuffer=t.createVertexBuffer(this.dynamicLayoutVertexArray,py.members,!0),this.opacityVertexBuffer=t.createVertexBuffer(this.opacityVertexArray,Vy,!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,dy.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);Gy(Kt)&&(this.hasRTLText=!0),(!this.hasRTLText||pl()==="unavailable"||this.hasRTLText&&Br.isParsed())&&(zt=my(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:Uy[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 qy=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:qy};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 jy={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"])})},$y={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 Wy 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 Zy={circle:class extends cr{constructor(i){super(i,Tg)}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]),vg(z,et,it))return!0}return!1}},heatmap:class extends cr{constructor(i){super(i,Ig),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,Cg)}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}},fill:class extends cr{constructor(i){super(i,jg)}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,ry)}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(bg(A,G,R))return!0}return!1}(x,o,b)}isTileClipped(){return!0}},symbol:qh,background:class extends cr{constructor(i){super(i,jy)}},raster:class extends cr{constructor(i){super(i,$y)}}};class Hy{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(Mg(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(Xy);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 Xy(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,Ky={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 Hy(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=Ky,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=_g}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=fy,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 Wy(i):new Zy[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=Eg,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(Ty,[])},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=zy(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)&&Oy(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)&&gt.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&&gt==="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
1
+ "use strict";var g0=Object.create;var Ud=Object.defineProperty;var y0=Object.getOwnPropertyDescriptor;var _0=Object.getOwnPropertyNames;var x0=Object.getPrototypeOf,v0=Object.prototype.hasOwnProperty;var Vd=(n,o)=>()=>(n&&(o=n(n=0)),o);var is=(n,o)=>()=>(o||n((o={exports:{}}).exports,o),o.exports);var b0=(n,o,h,g)=>{if(o&&typeof o=="object"||typeof o=="function")for(let _ of _0(o))!v0.call(n,_)&&_!==h&&Ud(n,_,{get:()=>o[_],enumerable:!(g=y0(o,_))||g.enumerable});return n};var Ns=(n,o,h)=>(h=n!=null?g0(x0(n)):{},b0(o||!n||!n.__esModule?Ud(h,"default",{value:n,enumerable:!0}):h,n));function Us(n,o){for(var h in o)n[h]=o[h];return n}function Kd(n){var o=n.parentNode;o&&o.removeChild(n)}function vt(n,o,h){var g,_,a,M={};for(a in o)a=="key"?g=o[a]:a=="ref"?_=o[a]:M[a]=o[a];if(arguments.length>2&&(M.children=arguments.length>3?tc.call(arguments,2):h),typeof n=="function"&&n.defaultProps!=null)for(a in n.defaultProps)M[a]===void 0&&(M[a]=n.defaultProps[a]);return Kh(n,M,g,_,null)}function Kh(n,o,h,g,_){var a={type:n,props:o,key:h,ref:g,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:_??++Zd};return _==null&&vi.vnode!=null&&vi.vnode(a),a}function yt(n){return n.children}function Ii(n,o){this.props=n,this.context=o}function po(n,o){if(o==null)return n.__?po(n.__,n.__.__k.indexOf(n)+1):null;for(var h;o<n.__k.length;o++)if((h=n.__k[o])!=null&&h.__e!=null)return h.__e;return typeof n.type=="function"?po(n):null}function Jd(n){var o,h;if((n=n.__)!=null&&n.__c!=null){for(n.__e=n.__c.base=null,o=0;o<n.__k.length;o++)if((h=n.__k[o])!=null&&h.__e!=null){n.__e=n.__c.base=h.__e;break}return Jd(n)}}function qd(n){(!n.__d&&(n.__d=!0)&&Rl.push(n)&&!Yh.__r++||Gd!==vi.debounceRendering)&&((Gd=vi.debounceRendering)||Hd)(Yh)}function Yh(){for(var n;Yh.__r=Rl.length;)n=Rl.sort(function(o,h){return o.__v.__b-h.__v.__b}),Rl=[],n.some(function(o){var h,g,_,a,M,S;o.__d&&(M=(a=(h=o).__v).__e,(S=h.__P)&&(g=[],(_=Us({},a)).__v=a.__v+1,Gu(S,a,_,h.__n,S.ownerSVGElement!==void 0,a.__h!=null?[M]:null,g,M??po(a),a.__h),ef(g,a),a.__e!=M&&Jd(a)))})}function Yd(n,o,h,g,_,a,M,S,D,N){var L,Q,pt,ot,ft,Rt,Ct,Dt=g&&g.__k||Xd,ne=Dt.length;for(h.__k=[],L=0;L<o.length;L++)if((ot=h.__k[L]=(ot=o[L])==null||typeof ot=="boolean"?null:typeof ot=="string"||typeof ot=="number"||typeof ot=="bigint"?Kh(null,ot,null,null,ot):Array.isArray(ot)?Kh(yt,{children:ot},null,null,null):ot.__b>0?Kh(ot.type,ot.props,ot.key,null,ot.__v):ot)!=null){if(ot.__=h,ot.__b=h.__b+1,(pt=Dt[L])===null||pt&&ot.key==pt.key&&ot.type===pt.type)Dt[L]=void 0;else for(Q=0;Q<ne;Q++){if((pt=Dt[Q])&&ot.key==pt.key&&ot.type===pt.type){Dt[Q]=void 0;break}pt=null}Gu(n,ot,pt=pt||Jh,_,a,M,S,D,N),ft=ot.__e,(Q=ot.ref)&&pt.ref!=Q&&(Ct||(Ct=[]),pt.ref&&Ct.push(pt.ref,null,ot),Ct.push(Q,ot.__c||ft,ot)),ft!=null?(Rt==null&&(Rt=ft),typeof ot.type=="function"&&ot.__k===pt.__k?ot.__d=D=Qd(ot,D,n):D=tf(n,ot,pt,Dt,ft,D),typeof h.type=="function"&&(h.__d=D)):D&&pt.__e==D&&D.parentNode!=n&&(D=po(pt))}for(h.__e=Rt,L=ne;L--;)Dt[L]!=null&&(typeof h.type=="function"&&Dt[L].__e!=null&&Dt[L].__e==h.__d&&(h.__d=po(g,L+1)),nf(Dt[L],Dt[L]));if(Ct)for(L=0;L<Ct.length;L++)rf(Ct[L],Ct[++L],Ct[++L])}function Qd(n,o,h){for(var g,_=n.__k,a=0;_&&a<_.length;a++)(g=_[a])&&(g.__=n,o=typeof g.type=="function"?Qd(g,o,h):tf(h,g,g,_,g.__e,o));return o}function tf(n,o,h,g,_,a){var M,S,D;if(o.__d!==void 0)M=o.__d,o.__d=void 0;else if(h==null||_!=a||_.parentNode==null)t:if(a==null||a.parentNode!==n)n.appendChild(_),M=null;else{for(S=a,D=0;(S=S.nextSibling)&&D<g.length;D+=2)if(S==_)break t;n.insertBefore(_,a),M=a}return M!==void 0?M:_.nextSibling}function T0(n,o,h,g,_){var a;for(a in h)a==="children"||a==="key"||a in o||Qh(n,a,null,h[a],g);for(a in o)_&&typeof o[a]!="function"||a==="children"||a==="key"||a==="value"||a==="checked"||h[a]===o[a]||Qh(n,a,o[a],h[a],g)}function jd(n,o,h){o[0]==="-"?n.setProperty(o,h):n[o]=h==null?"":typeof h!="number"||S0.test(o)?h:h+"px"}function Qh(n,o,h,g,_){var a;t:if(o==="style")if(typeof h=="string")n.style.cssText=h;else{if(typeof g=="string"&&(n.style.cssText=g=""),g)for(o in g)h&&o in h||jd(n.style,o,"");if(h)for(o in h)g&&h[o]===g[o]||jd(n.style,o,h[o])}else if(o[0]==="o"&&o[1]==="n")a=o!==(o=o.replace(/Capture$/,"")),o=o.toLowerCase()in n?o.toLowerCase().slice(2):o.slice(2),n.l||(n.l={}),n.l[o+a]=h,h?g||n.addEventListener(o,a?Wd:$d,a):n.removeEventListener(o,a?Wd:$d,a);else if(o!=="dangerouslySetInnerHTML"){if(_)o=o.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(o!=="href"&&o!=="list"&&o!=="form"&&o!=="tabIndex"&&o!=="download"&&o in n)try{n[o]=h??"";break t}catch{}typeof h=="function"||(h!=null&&(h!==!1||o[0]==="a"&&o[1]==="r")?n.setAttribute(o,h):n.removeAttribute(o))}}function $d(n){this.l[n.type+!1](vi.event?vi.event(n):n)}function Wd(n){this.l[n.type+!0](vi.event?vi.event(n):n)}function Gu(n,o,h,g,_,a,M,S,D){var N,L,Q,pt,ot,ft,Rt,Ct,Dt,ne,Ht,fe,me,oe=o.type;if(o.constructor!==void 0)return null;h.__h!=null&&(D=h.__h,S=o.__e=h.__e,o.__h=null,a=[S]),(N=vi.__b)&&N(o);try{t:if(typeof oe=="function"){if(Ct=o.props,Dt=(N=oe.contextType)&&g[N.__c],ne=N?Dt?Dt.props.value:N.__:g,h.__c?Rt=(L=o.__c=h.__c).__=L.__E:("prototype"in oe&&oe.prototype.render?o.__c=L=new oe(Ct,ne):(o.__c=L=new Ii(Ct,ne),L.constructor=oe,L.render=I0),Dt&&Dt.sub(L),L.props=Ct,L.state||(L.state={}),L.context=ne,L.__n=g,Q=L.__d=!0,L.__h=[]),L.__s==null&&(L.__s=L.state),oe.getDerivedStateFromProps!=null&&(L.__s==L.state&&(L.__s=Us({},L.__s)),Us(L.__s,oe.getDerivedStateFromProps(Ct,L.__s))),pt=L.props,ot=L.state,Q)oe.getDerivedStateFromProps==null&&L.componentWillMount!=null&&L.componentWillMount(),L.componentDidMount!=null&&L.__h.push(L.componentDidMount);else{if(oe.getDerivedStateFromProps==null&&Ct!==pt&&L.componentWillReceiveProps!=null&&L.componentWillReceiveProps(Ct,ne),!L.__e&&L.shouldComponentUpdate!=null&&L.shouldComponentUpdate(Ct,L.__s,ne)===!1||o.__v===h.__v){L.props=Ct,L.state=L.__s,o.__v!==h.__v&&(L.__d=!1),L.__v=o,o.__e=h.__e,o.__k=h.__k,o.__k.forEach(function(Ce){Ce&&(Ce.__=o)}),L.__h.length&&M.push(L);break t}L.componentWillUpdate!=null&&L.componentWillUpdate(Ct,L.__s,ne),L.componentDidUpdate!=null&&L.__h.push(function(){L.componentDidUpdate(pt,ot,ft)})}if(L.context=ne,L.props=Ct,L.__v=o,L.__P=n,Ht=vi.__r,fe=0,"prototype"in oe&&oe.prototype.render)L.state=L.__s,L.__d=!1,Ht&&Ht(o),N=L.render(L.props,L.state,L.context);else do L.__d=!1,Ht&&Ht(o),N=L.render(L.props,L.state,L.context),L.state=L.__s;while(L.__d&&++fe<25);L.state=L.__s,L.getChildContext!=null&&(g=Us(Us({},g),L.getChildContext())),Q||L.getSnapshotBeforeUpdate==null||(ft=L.getSnapshotBeforeUpdate(pt,ot)),me=N!=null&&N.type===yt&&N.key==null?N.props.children:N,Yd(n,Array.isArray(me)?me:[me],o,h,g,_,a,M,S,D),L.base=o.__e,o.__h=null,L.__h.length&&M.push(L),Rt&&(L.__E=L.__=null),L.__e=!1}else a==null&&o.__v===h.__v?(o.__k=h.__k,o.__e=h.__e):o.__e=E0(h.__e,o,h,g,_,a,M,D);(N=vi.diffed)&&N(o)}catch(Ce){o.__v=null,(D||a!=null)&&(o.__e=S,o.__h=!!D,a[a.indexOf(S)]=null),vi.__e(Ce,o,h)}}function ef(n,o){vi.__c&&vi.__c(o,n),n.some(function(h){try{n=h.__h,h.__h=[],n.some(function(g){g.call(h)})}catch(g){vi.__e(g,h.__v)}})}function E0(n,o,h,g,_,a,M,S){var D,N,L,Q=h.props,pt=o.props,ot=o.type,ft=0;if(ot==="svg"&&(_=!0),a!=null){for(;ft<a.length;ft++)if((D=a[ft])&&"setAttribute"in D==!!ot&&(ot?D.localName===ot:D.nodeType===3)){n=D,a[ft]=null;break}}if(n==null){if(ot===null)return document.createTextNode(pt);n=_?document.createElementNS("http://www.w3.org/2000/svg",ot):document.createElement(ot,pt.is&&pt),a=null,S=!1}if(ot===null)Q===pt||S&&n.data===pt||(n.data=pt);else{if(a=a&&tc.call(n.childNodes),N=(Q=h.props||Jh).dangerouslySetInnerHTML,L=pt.dangerouslySetInnerHTML,!S){if(a!=null)for(Q={},ft=0;ft<n.attributes.length;ft++)Q[n.attributes[ft].name]=n.attributes[ft].value;(L||N)&&(L&&(N&&L.__html==N.__html||L.__html===n.innerHTML)||(n.innerHTML=L&&L.__html||""))}if(T0(n,pt,Q,_,S),L)o.__k=[];else if(ft=o.props.children,Yd(n,Array.isArray(ft)?ft:[ft],o,h,g,_&&ot!=="foreignObject",a,M,a?a[0]:h.__k&&po(h,0),S),a!=null)for(ft=a.length;ft--;)a[ft]!=null&&Kd(a[ft]);S||("value"in pt&&(ft=pt.value)!==void 0&&(ft!==n.value||ot==="progress"&&!ft||ot==="option"&&ft!==Q.value)&&Qh(n,"value",ft,Q.value,!1),"checked"in pt&&(ft=pt.checked)!==void 0&&ft!==n.checked&&Qh(n,"checked",ft,Q.checked,!1))}return n}function rf(n,o,h){try{typeof n=="function"?n(o):n.current=o}catch(g){vi.__e(g,h)}}function nf(n,o,h){var g,_;if(vi.unmount&&vi.unmount(n),(g=n.ref)&&(g.current&&g.current!==n.__e||rf(g,null,o)),(g=n.__c)!=null){if(g.componentWillUnmount)try{g.componentWillUnmount()}catch(a){vi.__e(a,o)}g.base=g.__P=null}if(g=n.__k)for(_=0;_<g.length;_++)g[_]&&nf(g[_],o,typeof n.type!="function");h||n.__e==null||Kd(n.__e),n.__e=n.__d=void 0}function I0(n,o,h){return this.constructor(n,h)}function sf(n,o,h){var g,_,a;vi.__&&vi.__(n,o),_=(g=typeof h=="function")?null:h&&h.__k||o.__k,a=[],Gu(o,n=(!g&&h||o).__k=vt(yt,null,[n]),_||Jh,Jh,o.ownerSVGElement!==void 0,!g&&h?[h]:_?null:o.firstChild?tc.call(o.childNodes):null,a,!g&&h?h:_?_.__e:o.firstChild,g),ef(a,n)}var tc,vi,Zd,w0,Rl,Hd,Gd,M0,Jh,Xd,S0,Qr=Vd(()=>{W();Jh={},Xd=[],S0=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;tc=Xd.slice,vi={__e:function(n,o,h,g){for(var _,a,M;o=o.__;)if((_=o.__c)&&!_.__)try{if((a=_.constructor)&&a.getDerivedStateFromError!=null&&(_.setState(a.getDerivedStateFromError(n)),M=_.__d),_.componentDidCatch!=null&&(_.componentDidCatch(n,g||{}),M=_.__d),M)return _.__E=_}catch(S){n=S}throw n}},Zd=0,w0=function(n){return n!=null&&n.constructor===void 0},Ii.prototype.setState=function(n,o){var h;h=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=Us({},this.state),typeof n=="function"&&(n=n(Us({},h),this.props)),n&&Us(h,n),n!=null&&this.__v&&(o&&this.__h.push(o),qd(this))},Ii.prototype.forceUpdate=function(n){this.__v&&(this.__e=!0,n&&this.__h.push(n),qd(this))},Ii.prototype.render=yt,Rl=[],Hd=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Yh.__r=0,M0=0});var W=Vd(()=>{"use strict";Qr()});var af=is(()=>{W()});var mf=is(ic=>{"use strict";W();Object.defineProperty(ic,"__esModule",{value:!0});ic.Nztm2000Quad=void 0;ic.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 gf=is(rc=>{"use strict";W();Object.defineProperty(rc,"__esModule",{value:!0});rc.Nztm2000=void 0;rc.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 yf=is(go=>{"use strict";W();Object.defineProperty(go,"__esModule",{value:!0});go.Nztm2000=go.Nztm2000Quad=void 0;var B0=mf();Object.defineProperty(go,"Nztm2000Quad",{enumerable:!0,get:function(){return B0.Nztm2000Quad}});var F0=gf();Object.defineProperty(go,"Nztm2000",{enumerable:!0,get:function(){return F0.Nztm2000}})});var xf=is(ss=>{"use strict";W();Object.defineProperty(ss,"__esModule",{value:!0});ss.once=ss.Emitter=ss.ALL_EVENTS=void 0;ss.ALL_EVENTS=Symbol("ALL_EVENTS");function O0(n,o){return n.add(o),function(){return n.delete(o)}}function _f(n,...o){if(n)for(let{fn:h}of n)h(...o)}var Zu=class{constructor(){this.$=Object.create(null)}on(o,h){let g=this.$[o]=this.$[o]||new Set;return O0(g,{fn:h})}emit(o,...h){_f(this.$[o],...h),_f(this.$[ss.ALL_EVENTS],{type:o,args:h})}};ss.Emitter=Zu;function N0(n,o,h){let g=n.on(o,function(...a){return g(),h(...a)});return g}ss.once=N0});var bf=is((Ub,vf)=>{"use strict";W();vf.exports=sc;sc.polyline=sc;sc.polygon=V0;function sc(n,o,h){var g=n.length,_=_o(n[0],o),a=[],M,S,D,N,L;for(h||(h=[]),M=1;M<g;M++){for(S=n[M-1],D=n[M],N=L=_o(D,o);;)if(_|N){if(_&N)break;_?(S=Xu(S,D,_,o),_=_o(S,o)):(D=Xu(S,D,N,o),N=_o(D,o))}else{a.push(S),N!==L?(a.push(D),M<g-1&&(h.push(a),a=[])):M===g-1&&a.push(D);break}_=L}return a.length&&h.push(a),h}function V0(n,o){var h,g,_,a,M,S,D;for(g=1;g<=8;g*=2){for(h=[],_=n[n.length-1],a=!(_o(_,o)&g),M=0;M<n.length;M++)S=n[M],D=!(_o(S,o)&g),D!==a&&h.push(Xu(_,S,g,o)),D&&h.push(S),_=S,a=D;if(n=h,!n.length)break}return h}function Xu(n,o,h,g){return h&8?[n[0]+(o[0]-n[0])*(g[3]-n[1])/(o[1]-n[1]),g[3]]:h&4?[n[0]+(o[0]-n[0])*(g[1]-n[1])/(o[1]-n[1]),g[1]]:h&2?[g[2],n[1]+(o[1]-n[1])*(g[2]-n[0])/(o[0]-n[0])]:h&1?[g[0],n[1]+(o[1]-n[1])*(g[0]-n[0])/(o[0]-n[0])]:null}function _o(n,o){var h=0;return n[0]<o[0]?h|=1:n[0]>o[2]&&(h|=2),n[1]<o[1]?h|=4:n[1]>o[3]&&(h|=8),h}});var wf=is((Ku,Ju)=>{W();(function(n,o){typeof Ku=="object"&&typeof Ju<"u"?Ju.exports=o():typeof define=="function"&&define.amd?define(o):(n=typeof globalThis<"u"?globalThis:n||self,n.polygonClipping=o())})(Ku,function(){"use strict";function n(mt,U){if(!(mt instanceof U))throw new TypeError("Cannot call a class as a function")}function o(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&&o(mt.prototype,U),B&&o(mt,B),mt}var g=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 g(null,null),X=V,nt=V;;){var _t=B(mt,U.key);if(_t<0){if(U.left===null)break;if(B(mt,U.left.key)<0){var Ft=U.left;if(U.left=Ft.right,Ft.right=U,U=Ft,U.left===null)break}nt.left=U,nt=U,U=U.left}else if(_t>0){if(U.right===null)break;if(B(mt,U.right.key)>0){var Ft=U.right;if(U.right=Ft.left,Ft.left=U,U=Ft,U.right===null)break}X.right=U,X=U,U=U.right}else break}return X.right=U.left,nt.left=U.right,U.left=V.right,U.right=V.left,U}function M(mt,U,B,V){var X=new g(mt,U);if(B===null)return X.left=X.right=null,X;B=a(mt,B,V);var nt=V(mt,B.key);return nt<0?(X.left=B.left,X.right=B,B.left=null):nt>=0&&(X.right=B.right,X.left=B,B.right=null),X}function S(mt,U,B){var V=null,X=null;if(U){U=a(mt,U,B);var nt=B(U.key,mt);nt===0?(V=U.left,X=U.right):nt<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 nt=U+(B?" ":"\u2502 ");mt.left&&N(mt.left,nt,!1,V,X),mt.right&&N(mt.right,nt,!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=M(U,B,this._root,this._comparator)},mt.prototype.add=function(U,B){var V=new g(U,B);this._root===null&&(V.left=V.right=null,this._size++,this._root=V);var X=this._comparator,nt=a(U,this._root,X),_t=X(U,nt.key);return _t===0?this._root=nt:(_t<0?(V.left=nt.left,V.right=nt,nt.left=null):_t>0&&(V.right=nt.right,V.left=nt,nt.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 nt=V(U,B.key);return nt===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=[],nt=!1;!nt;)V!==null?(X.push(V),V=V.left):X.length!==0?(V=X.pop(),U.call(B,V),V=V.right):nt=!0;return this},mt.prototype.range=function(U,B,V,X){for(var nt=[],_t=this._comparator,Ft=this._root,Vt;nt.length!==0||Ft;)if(Ft)nt.push(Ft),Ft=Ft.left;else{if(Ft=nt.pop(),Vt=_t(Ft.key,B),Vt>0)break;if(_t(Ft.key,U)>=0&&V.call(X,Ft))return this;Ft=Ft.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,nt=[];!V;)if(B)nt.push(B),B=B.left;else if(nt.length>0){if(B=nt.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 nt=X(U.key,B.key);if(nt===0)break;nt<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 nt=X(U.key,B.key);if(nt===0)break;nt<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 ot(this._root)},mt.prototype.load=function(U,B,V){B===void 0&&(B=[]),V===void 0&&(V=!1);var X=U.length,nt=this._comparator;if(V&&Ct(U,B,0,X-1,nt),this._root===null)this._root=Q(U,B,0,X),this._size=X;else{var _t=Rt(this.toList(),pt(U,B),nt);X=this._size+X,this._root=ft({head:_t},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,nt=S(U,this._root,X),_t=nt.left,Ft=nt.right;X(U,B)<0?Ft=M(B,V,Ft,X):_t=M(B,V,_t,X),this._root=D(_t,Ft,X)},mt.prototype.split=function(U){return S(U,this._root,this._comparator)},mt}();function Q(mt,U,B,V){var X=V-B;if(X>0){var nt=B+Math.floor(X/2),_t=mt[nt],Ft=U[nt],Vt=new g(_t,Ft);return Vt.left=Q(mt,U,B,nt),Vt.right=Q(mt,U,nt+1,V),Vt}return null}function pt(mt,U){for(var B=new g(null,null),V=B,X=0;X<mt.length;X++)V=V.next=new g(mt[X],U[X]);return V.next=null,B.next}function ot(mt){for(var U=mt,B=[],V=!1,X=new g(null,null),nt=X;!V;)U?(B.push(U),U=U.left):B.length>0?(U=nt=nt.next=B.pop(),U=U.right):V=!0;return nt.next=null,X.next}function ft(mt,U,B){var V=B-U;if(V>0){var X=U+Math.floor(V/2),nt=ft(mt,U,X),_t=mt.head;return _t.left=nt,mt.head=mt.head.next,_t.right=ft(mt,X+1,B),_t}return null}function Rt(mt,U,B){for(var V=new g(null,null),X=V,nt=mt,_t=U;nt!==null&&_t!==null;)B(nt.key,_t.key)<0?(X.next=nt,nt=nt.next):(X.next=_t,_t=_t.next),X=X.next;return nt!==null?X.next=nt:_t!==null&&(X.next=_t),V.next}function Ct(mt,U,B,V,X){if(!(B>=V)){for(var nt=mt[B+V>>1],_t=B-1,Ft=V+1;;){do _t++;while(X(mt[_t],nt)<0);do Ft--;while(X(mt[Ft],nt)>0);if(_t>=Ft)break;var Vt=mt[_t];mt[_t]=mt[Ft],mt[Ft]=Vt,Vt=U[_t],U[_t]=U[Ft],U[Ft]=Vt}Ct(mt,U,B,Ft,X),Ct(mt,U,Ft+1,V,X)}}var Dt=function(U,B){return U.ll.x<=B.x&&B.x<=U.ur.x&&U.ll.y<=B.y&&B.y<=U.ur.y},ne=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,nt=U.ll.y<B.ll.y?B.ll.y:U.ll.y,_t=U.ur.y<B.ur.y?U.ur.y:B.ur.y;return{ll:{x:V,y:nt},ur:{x:X,y:_t}}},Ht=Number.EPSILON;Ht===void 0&&(Ht=Math.pow(2,-52));var fe=Ht*Ht,me=function(U,B){if(-Ht<U&&U<Ht&&-Ht<B&&B<Ht)return 0;var V=U-B;return V*V<fe*U*B?0:U<B?-1:1},oe=function(){function mt(){n(this,mt),this.reset()}return h(mt,[{key:"reset",value:function(){this.xRounder=new Ce,this.yRounder=new Ce}},{key:"round",value:function(B,V){return{x:this.xRounder.round(B),y:this.yRounder.round(V)}}}]),mt}(),Ce=function(){function mt(){n(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&&me(V.key,X.key)===0)return this.tree.remove(B),X.key;var nt=this.tree.next(V);return nt!==null&&me(V.key,nt.key)===0?(this.tree.remove(B),nt.key):B}}]),mt}(),Re=new oe,mi=function(U,B){return U.x*B.y-U.y*B.x},Fi=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},nt={x:V.x-U.x,y:V.y-U.y},_t=mi(X,nt);return me(_t,0)},Oi=function(U){return Math.sqrt(Fi(U,U))},$r=function(U,B,V){var X={x:B.x-U.x,y:B.y-U.y},nt={x:V.x-U.x,y:V.y-U.y};return mi(nt,X)/Oi(nt)/Oi(X)},ve=function(U,B,V){var X={x:B.x-U.x,y:B.y-U.y},nt={x:V.x-U.x,y:V.y-U.y};return Fi(nt,X)/Oi(nt)/Oi(X)},kr=function(U,B,V){return B.y===0?null:{x:U.x+B.x/B.y*(V-U.y),y:V}},Wr=function(U,B,V){return B.x===0?null:{x:V,y:U.y+B.y/B.x*(V-U.x)}},rn=function(U,B,V,X){if(B.x===0)return Wr(V,X,U.x);if(X.x===0)return Wr(U,B,V.x);if(B.y===0)return kr(V,X,U.y);if(X.y===0)return kr(U,B,V.y);var nt=mi(B,X);if(nt==0)return null;var _t={x:V.x-U.x,y:V.y-U.y},Ft=mi(_t,B)/nt,Vt=mi(_t,X)/nt,ct=U.x+Vt*B.x,zt=V.x+Ft*X.x,Ee=U.y+Vt*B.y,Ae=V.y+Ft*X.y,ce=(ct+zt)/2,Ve=(Ee+Ae)/2;return{x:ce,y:Ve}},bi=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:Lr.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){n(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,nt=V.length;X<nt;X++){var _t=V[X];this.point.events.push(_t),_t.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 nt=V+1;nt<B;nt++){var _t=this.point.events[nt];_t.consumedBy===void 0&&X.otherSE.point.events===_t.otherSE.point.events&&X.segment.consume(_t.segment)}}}},{key:"getAvailableLinkedEvents",value:function(){for(var B=[],V=0,X=this.point.events.length;V<X;V++){var nt=this.point.events[V];nt!==this&&!nt.segment.ringOut&&nt.segment.isInResult()&&B.push(nt)}return B}},{key:"getLeftmostComparator",value:function(B){var V=this,X=new Map,nt=function(Ft){var Vt=Ft.otherSE;X.set(Ft,{sine:$r(V.point,B.point,Vt.point),cosine:ve(V.point,B.point,Vt.point)})};return function(_t,Ft){X.has(_t)||nt(_t),X.has(Ft)||nt(Ft);var Vt=X.get(_t),ct=Vt.sine,zt=Vt.cosine,Ee=X.get(Ft),Ae=Ee.sine,ce=Ee.cosine;return ct>=0&&Ae>=0?zt<ce?1:zt>ce?-1:0:ct<0&&Ae<0?zt<ce?-1:zt>ce?1:0:Ae<ct?-1:Ae>ct?1:0}}}]),mt}(),gn=0,Lr=function(){h(mt,null,[{key:"compare",value:function(B,V){var X=B.leftSE.point.x,nt=V.leftSE.point.x,_t=B.rightSE.point.x,Ft=V.rightSE.point.x;if(Ft<X)return 1;if(_t<nt)return-1;var Vt=B.leftSE.point.y,ct=V.leftSE.point.y,zt=B.rightSE.point.y,Ee=V.rightSE.point.y;if(X<nt){if(ct<Vt&&ct<zt)return 1;if(ct>Vt&&ct>zt)return-1;var Ae=B.comparePoint(V.leftSE.point);if(Ae<0)return 1;if(Ae>0)return-1;var ce=V.comparePoint(B.rightSE.point);return ce!==0?ce:-1}if(X>nt){if(Vt<ct&&Vt<Ee)return-1;if(Vt>ct&&Vt>Ee)return 1;var Ve=V.comparePoint(B.leftSE.point);if(Ve!==0)return Ve;var Pe=B.comparePoint(V.rightSE.point);return Pe<0?1:Pe>0?-1:1}if(Vt<ct)return-1;if(Vt>ct)return 1;if(_t<Ft){var ei=V.comparePoint(B.rightSE.point);if(ei!==0)return ei}if(_t>Ft){var ke=B.comparePoint(V.rightSE.point);if(ke<0)return 1;if(ke>0)return-1}if(_t!==Ft){var Gt=zt-Vt,xe=_t-X,pe=Ee-ct,oi=Ft-nt;if(Gt>xe&&pe<oi)return 1;if(Gt<xe&&pe>oi)return-1}return _t>Ft?1:_t<Ft||zt<Ee?-1:zt>Ee?1:B.id<V.id?-1:B.id>V.id?1:0}}]);function mt(U,B,V,X){n(this,mt),this.id=++gn,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,nt=this.vector();if(V.x===X.x)return B.x===V.x?0:B.x<V.x?1:-1;var _t=(B.y-V.y)/nt.y,Ft=V.x+_t*nt.x;if(B.x===Ft)return 0;var Vt=(B.x-V.x)/nt.x,ct=V.y+Vt*nt.y;return B.y===ct?0:B.y<ct?-1:1}},{key:"getIntersection",value:function(B){var V=this.bbox(),X=B.bbox(),nt=ne(V,X);if(nt===null)return null;var _t=this.leftSE.point,Ft=this.rightSE.point,Vt=B.leftSE.point,ct=B.rightSE.point,zt=Dt(V,Vt)&&this.comparePoint(Vt)===0,Ee=Dt(X,_t)&&B.comparePoint(_t)===0,Ae=Dt(V,ct)&&this.comparePoint(ct)===0,ce=Dt(X,Ft)&&B.comparePoint(Ft)===0;if(Ee&&zt)return ce&&!Ae?Ft:!ce&&Ae?ct:null;if(Ee)return Ae&&_t.x===ct.x&&_t.y===ct.y?null:_t;if(zt)return ce&&Ft.x===Vt.x&&Ft.y===Vt.y?null:Vt;if(ce&&Ae)return null;if(ce)return Ft;if(Ae)return ct;var Ve=rn(_t,this.vector(),Vt,B.vector());return Ve===null||!Dt(nt,Ve)?null:Re.round(Ve.x,Ve.y)}},{key:"split",value:function(B){var V=[],X=B.events!==void 0,nt=new bi(B,!0),_t=new bi(B,!1),Ft=this.rightSE;this.replaceRightSE(_t),V.push(_t),V.push(nt);var Vt=new mt(nt,Ft,this.rings.slice(),this.windings.slice());return bi.comparePoints(Vt.leftSE.point,Vt.rightSE.point)>0&&Vt.swapEvents(),bi.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),X&&(nt.checkForConsuming(),_t.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 nt=mt.compare(V,X);if(nt!==0){if(nt>0){var _t=V;V=X,X=_t}if(V.prev===X){var Ft=V;V=X,X=Ft}for(var Vt=0,ct=X.rings.length;Vt<ct;Vt++){var zt=X.rings[Vt],Ee=X.windings[Vt],Ae=V.rings.indexOf(zt);Ae===-1?(V.rings.push(zt),V.windings.push(Ee)):V.windings[Ae]+=Ee}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,nt=this._afterState.multiPolys,_t=0,Ft=this.rings.length;_t<Ft;_t++){var Vt=this.rings[_t],ct=this.windings[_t],zt=V.indexOf(Vt);zt===-1?(V.push(Vt),X.push(ct)):X[zt]+=ct}for(var Ee=[],Ae=[],ce=0,Ve=V.length;ce<Ve;ce++)if(X[ce]!==0){var Pe=V[ce],ei=Pe.poly;if(Ae.indexOf(ei)===-1)if(Pe.isExterior)Ee.push(ei);else{Ae.indexOf(ei)===-1&&Ae.push(ei);var ke=Ee.indexOf(Pe.poly);ke!==-1&&Ee.splice(ke,1)}}for(var Gt=0,xe=Ee.length;Gt<xe;Gt++){var pe=Ee[Gt].multiPoly;nt.indexOf(pe)===-1&&nt.push(pe)}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(ti.type){case"union":{var X=B.length===0,nt=V.length===0;this._isInResult=X!==nt;break}case"intersection":{var _t,Ft;B.length<V.length?(_t=B.length,Ft=V.length):(_t=V.length,Ft=B.length),this._isInResult=Ft===ti.numMultiPolys&&_t<Ft;break}case"xor":{var Vt=Math.abs(B.length-V.length);this._isInResult=Vt%2===1;break}case"difference":{var ct=function(Ee){return Ee.length===1&&Ee[0].isSubject};this._isInResult=ct(B)!==ct(V);break}default:throw new Error("Unrecognized operation type found ".concat(ti.type))}return this._isInResult}}],[{key:"fromRing",value:function(B,V,X){var nt,_t,Ft,Vt=bi.comparePoints(B,V);if(Vt<0)nt=B,_t=V,Ft=1;else if(Vt>0)nt=V,_t=B,Ft=-1;else throw new Error("Tried to create degenerate segment at [".concat(B.x,", ").concat(B.y,"]"));var ct=new bi(nt,!0),zt=new bi(_t,!1);return new mt(ct,zt,[X],[Ft])}}]),mt}(),Dr=function(){function mt(U,B,V){if(n(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=Re.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 nt=X,_t=1,Ft=U.length;_t<Ft;_t++){if(typeof U[_t][0]!="number"||typeof U[_t][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var Vt=Re.round(U[_t][0],U[_t][1]);Vt.x===nt.x&&Vt.y===nt.y||(this.segments.push(Lr.fromRing(nt,Vt,this)),Vt.x<this.bbox.ll.x&&(this.bbox.ll.x=Vt.x),Vt.y<this.bbox.ll.y&&(this.bbox.ll.y=Vt.y),Vt.x>this.bbox.ur.x&&(this.bbox.ur.x=Vt.x),Vt.y>this.bbox.ur.y&&(this.bbox.ur.y=Vt.y),nt=Vt)}(X.x!==nt.x||X.y!==nt.y)&&this.segments.push(Lr.fromRing(nt,X,this))}return h(mt,[{key:"getSweepEvents",value:function(){for(var B=[],V=0,X=this.segments.length;V<X;V++){var nt=this.segments[V];B.push(nt.leftSE),B.push(nt.rightSE)}return B}}]),mt}(),nn=function(){function mt(U,B){if(n(this,mt),!Array.isArray(U))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new Dr(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 nt=new Dr(U[V],this,!1);nt.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=nt.bbox.ll.x),nt.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=nt.bbox.ll.y),nt.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=nt.bbox.ur.x),nt.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=nt.bbox.ur.y),this.interiorRings.push(nt)}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 nt=this.interiorRings[V].getSweepEvents(),_t=0,Ft=nt.length;_t<Ft;_t++)B.push(nt[_t]);return B}}]),mt}(),sn=function(){function mt(U,B){if(n(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 nt=new nn(U[V],this);nt.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=nt.bbox.ll.x),nt.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=nt.bbox.ll.y),nt.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=nt.bbox.ur.x),nt.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=nt.bbox.ur.y),this.polys.push(nt)}this.isSubject=B}return h(mt,[{key:"getSweepEvents",value:function(){for(var B=[],V=0,X=this.polys.length;V<X;V++)for(var nt=this.polys[V].getSweepEvents(),_t=0,Ft=nt.length;_t<Ft;_t++)B.push(nt[_t]);return B}}]),mt}(),yr=function(){h(mt,null,[{key:"factory",value:function(B){for(var V=[],X=0,nt=B.length;X<nt;X++){var _t=B[X];if(!(!_t.isInResult()||_t.ringOut)){for(var Ft=null,Vt=_t.leftSE,ct=_t.rightSE,zt=[Vt],Ee=Vt.point,Ae=[];Ft=Vt,Vt=ct,zt.push(Vt),Vt.point!==Ee;)for(;;){var ce=Vt.getAvailableLinkedEvents();if(ce.length===0){var Ve=zt[0].point,Pe=zt[zt.length-1].point;throw new Error("Unable to complete output ring starting at [".concat(Ve.x,",")+" ".concat(Ve.y,"]. Last matching segment found ends at")+" [".concat(Pe.x,", ").concat(Pe.y,"]."))}if(ce.length===1){ct=ce[0].otherSE;break}for(var ei=null,ke=0,Gt=Ae.length;ke<Gt;ke++)if(Ae[ke].point===Vt.point){ei=ke;break}if(ei!==null){var xe=Ae.splice(ei)[0],pe=zt.splice(xe.index);pe.unshift(pe[0].otherSE),V.push(new mt(pe.reverse()));continue}Ae.push({index:zt.length,point:Vt.point});var oi=Vt.getLeftmostComparator(Ft);ct=ce.sort(oi)[0].otherSE;break}V.push(new mt(zt))}}return V}}]);function mt(U){n(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,nt=this.events.length-1;X<nt;X++){var _t=this.events[X].point,Ft=this.events[X+1].point;Yi(_t,B,Ft)!==0&&(V.push(_t),B=_t)}if(V.length===1)return null;var Vt=V[0],ct=V[1];Yi(Vt,B,ct)===0&&V.shift(),V.push(V[0]);for(var zt=this.isExteriorRing()?1:-1,Ee=this.isExteriorRing()?0:V.length-1,Ae=this.isExteriorRing()?V.length:-1,ce=[],Ve=Ee;Ve!=Ae;Ve+=zt)ce.push([V[Ve].x,V[Ve].y]);return ce}},{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 nt=this.events[V];bi.compare(B,nt)>0&&(B=nt)}for(var _t=B.segment.prevInResult(),Ft=_t?_t.prevInResult():null;;){if(!_t)return null;if(!Ft)return _t.ringOut;if(Ft.ringOut!==_t.ringOut)return Ft.ringOut.enclosingRing()!==_t.ringOut?_t.ringOut:_t.ringOut.enclosingRing();_t=Ft.prevInResult(),Ft=_t?_t.prevInResult():null}}}]),mt}(),Rr=function(){function mt(U){n(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 nt=this.interiorRings[V].getGeom();nt!==null&&B.push(nt)}return B}}]),mt}(),Zr=function(){function mt(U){n(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 nt=this.polys[V].getGeom();nt!==null&&B.push(nt)}return B}},{key:"_composePolys",value:function(B){for(var V=[],X=0,nt=B.length;X<nt;X++){var _t=B[X];if(!_t.poly)if(_t.isExteriorRing())V.push(new Rr(_t));else{var Ft=_t.enclosingRing();Ft.poly||V.push(new Rr(Ft)),Ft.poly.addInterior(_t)}}return V}}]),mt}(),En=function(){function mt(U){var B=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Lr.compare;n(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 nt=B.isLeft?this.tree.insert(V):this.tree.find(V);if(!nt)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 _t=nt,Ft=nt,Vt=void 0,ct=void 0;Vt===void 0;)_t=this.tree.prev(_t),_t===null?Vt=null:_t.key.consumedBy===void 0&&(Vt=_t.key);for(;ct===void 0;)Ft=this.tree.next(Ft),Ft===null?ct=null:Ft.key.consumedBy===void 0&&(ct=Ft.key);if(B.isLeft){var zt=null;if(Vt){var Ee=Vt.getIntersection(V);if(Ee!==null&&(V.isAnEndpoint(Ee)||(zt=Ee),!Vt.isAnEndpoint(Ee)))for(var Ae=this._splitSafely(Vt,Ee),ce=0,Ve=Ae.length;ce<Ve;ce++)X.push(Ae[ce])}var Pe=null;if(ct){var ei=ct.getIntersection(V);if(ei!==null&&(V.isAnEndpoint(ei)||(Pe=ei),!ct.isAnEndpoint(ei)))for(var ke=this._splitSafely(ct,ei),Gt=0,xe=ke.length;Gt<xe;Gt++)X.push(ke[Gt])}if(zt!==null||Pe!==null){var pe=null;if(zt===null)pe=Pe;else if(Pe===null)pe=zt;else{var oi=bi.comparePoints(zt,Pe);pe=oi<=0?zt:Pe}this.queue.remove(V.rightSE),X.push(V.rightSE);for(var Wi=V.split(pe),be=0,rr=Wi.length;be<rr;be++)X.push(Wi[be])}X.length>0?(this.tree.remove(V),X.push(B)):(this.segments.push(V),V.prev=Vt)}else{if(Vt&&ct){var yi=Vt.getIntersection(ct);if(yi!==null){if(!Vt.isAnEndpoint(yi))for(var nr=this._splitSafely(Vt,yi),ni=0,Xe=nr.length;ni<Xe;ni++)X.push(nr[ni]);if(!ct.isAnEndpoint(yi))for(var Gi=this._splitSafely(ct,yi),_r=0,_i=Gi.length;_r<_i;_r++)X.push(Gi[_r])}}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 nt=B.split(V);return nt.push(X),B.consumedBy===void 0&&this.tree.insert(B),nt}}]),mt}(),Bn=typeof process<"u"&&process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE||1e6,Fn=typeof process<"u"&&process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS||1e6,gs=function(){function mt(){n(this,mt)}return h(mt,[{key:"run",value:function(B,V,X){ti.type=B,Re.reset();for(var nt=[new sn(V,!0)],_t=0,Ft=X.length;_t<Ft;_t++)nt.push(new sn(X[_t],!1));if(ti.numMultiPolys=nt.length,ti.type==="difference")for(var Vt=nt[0],ct=1;ct<nt.length;)ne(nt[ct].bbox,Vt.bbox)!==null?ct++:nt.splice(ct,1);if(ti.type==="intersection"){for(var zt=0,Ee=nt.length;zt<Ee;zt++)for(var Ae=nt[zt],ce=zt+1,Ve=nt.length;ce<Ve;ce++)if(ne(Ae.bbox,nt[ce].bbox)===null)return[]}for(var Pe=new L(bi.compare),ei=0,ke=nt.length;ei<ke;ei++)for(var Gt=nt[ei].getSweepEvents(),xe=0,pe=Gt.length;xe<pe;xe++)if(Pe.insert(Gt[xe]),Pe.size>Bn)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big). Please file a bug report.");for(var oi=new En(Pe),Wi=Pe.size,be=Pe.pop();be;){var rr=be.key;if(Pe.size===Wi){var yi=rr.segment;throw new Error("Unable to pop() ".concat(rr.isLeft?"left":"right"," SweepEvent ")+"[".concat(rr.point.x,", ").concat(rr.point.y,"] from segment #").concat(yi.id," ")+"[".concat(yi.leftSE.point.x,", ").concat(yi.leftSE.point.y,"] -> ")+"[".concat(yi.rightSE.point.x,", ").concat(yi.rightSE.point.y,"] from queue. ")+"Please file a bug report.")}if(Pe.size>Bn)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big). Please file a bug report.");if(oi.segments.length>Fn)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments). Please file a bug report.");for(var nr=oi.process(rr),ni=0,Xe=nr.length;ni<Xe;ni++){var Gi=nr[ni];Gi.consumedBy===void 0&&Pe.insert(Gi)}Wi=Pe.size,be=Pe.pop()}Re.reset();var _r=yr.factory(oi.segments),_i=new Zr(_r);return _i.getGeom()}}]),mt}(),ti=new gs,an=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 ti.run("union",U,V)},On=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 ti.run("intersection",U,V)},yn=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 ti.run("xor",U,V)},Br=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 ti.run("difference",U,V)},ys={union:an,intersection:On,xor:yn,difference:Br};return ys})});var cg=is((hI,hg)=>{"use strict";W();function P1(n){if(n.length>=255)throw new TypeError("Alphabet too long");for(var o=new Uint8Array(256),h=0;h<o.length;h++)o[h]=255;for(var g=0;g<n.length;g++){var _=n.charAt(g),a=_.charCodeAt(0);if(o[a]!==255)throw new TypeError(_+" is ambiguous");o[a]=g}var M=n.length,S=n.charAt(0),D=Math.log(M)/Math.log(256),N=Math.log(256)/Math.log(M);function L(ot){if(ot instanceof Uint8Array||(ArrayBuffer.isView(ot)?ot=new Uint8Array(ot.buffer,ot.byteOffset,ot.byteLength):Array.isArray(ot)&&(ot=Uint8Array.from(ot))),!(ot instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(ot.length===0)return"";for(var ft=0,Rt=0,Ct=0,Dt=ot.length;Ct!==Dt&&ot[Ct]===0;)Ct++,ft++;for(var ne=(Dt-Ct)*N+1>>>0,Ht=new Uint8Array(ne);Ct!==Dt;){for(var fe=ot[Ct],me=0,oe=ne-1;(fe!==0||me<Rt)&&oe!==-1;oe--,me++)fe+=256*Ht[oe]>>>0,Ht[oe]=fe%M>>>0,fe=fe/M>>>0;if(fe!==0)throw new Error("Non-zero carry");Rt=me,Ct++}for(var Ce=ne-Rt;Ce!==ne&&Ht[Ce]===0;)Ce++;for(var Re=S.repeat(ft);Ce<ne;++Ce)Re+=n.charAt(Ht[Ce]);return Re}function Q(ot){if(typeof ot!="string")throw new TypeError("Expected String");if(ot.length===0)return new Uint8Array;for(var ft=0,Rt=0,Ct=0;ot[ft]===S;)Rt++,ft++;for(var Dt=(ot.length-ft)*D+1>>>0,ne=new Uint8Array(Dt);ot[ft];){var Ht=o[ot.charCodeAt(ft)];if(Ht===255)return;for(var fe=0,me=Dt-1;(Ht!==0||fe<Ct)&&me!==-1;me--,fe++)Ht+=M*ne[me]>>>0,ne[me]=Ht%256>>>0,Ht=Ht/256>>>0;if(Ht!==0)throw new Error("Non-zero carry");Ct=fe,ft++}for(var oe=Dt-Ct;oe!==Dt&&ne[oe]===0;)oe++;for(var Ce=new Uint8Array(Rt+(Dt-oe)),Re=Rt;oe!==Dt;)Ce[Re++]=ne[oe++];return Ce}function pt(ot){var ft=Q(ot);if(ft)return ft;throw new Error("Non-base"+M+" character")}return{encode:L,decodeUnsafe:Q,decode:pt}}hg.exports=P1});var Ac=is((gp,yp)=>{W();(function(n,o){typeof gp=="object"&&typeof yp<"u"?yp.exports=o():typeof define=="function"&&define.amd?define(o):(n=typeof globalThis<"u"?globalThis:n||self,n.maplibregl=o())})(gp,function(){"use strict";var n,o,h;function g(a,M){if(!n)n=M;else if(!o)o=M;else{var S="var sharedChunk = {}; ("+n+")(sharedChunk); ("+o+")(sharedChunk);",D={};n(D),h=M(D),typeof window<"u"&&(h.workerUrl=window.URL.createObjectURL(new Blob([S],{type:"text/javascript"})))}}g(["exports"],function(a){"use strict";var M=S;function S(i,t,r,l){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*(l-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=i,this.p1y=t,this.p2x=r,this.p2y=l}function D(i,t,r,l){let u=new M(i,t,r,l);return function(f){return u.solve(f)}}S.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,l=0;l<8;l++){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,l=0;l<20&&(u=this.sampleCurveX(r),!(Math.abs(u-i)<t));l++)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 Q(i,t,r){let l=r-t,u=((i-t)%l+l)%l+t;return u===t?r:u}function pt(i,...t){for(let r of t)for(let l in r)i[l]=r[l];return i}let ot=1;function ft(i,t){i.forEach(r=>{t[r]&&(t[r]=t[r].bind(t))})}function Rt(i,t,r){let l={};for(let u in i)l[u]=t.call(r||this,i[u],u,i);return l}function Ct(i,t,r){let l={};for(let u in i)t.call(r||this,i[u],u,i)&&(l[u]=i[u]);return l}function Dt(i){return Array.isArray(i)?i.map(Dt):typeof i=="object"&&i?Rt(i,Dt):i}let ne={};function Ht(i){ne[i]||(typeof console<"u"&&console.warn(i),ne[i]=!0)}function fe(i,t,r){return(r.y-i.y)*(t.x-i.x)>(t.y-i.y)*(r.x-i.x)}function me(i){let t=0;for(let r,l,u=0,f=i.length,m=f-1;u<f;m=u++)r=i[u],l=i[m],t+=(l.x-r.x)*(r.y+l.y);return t}function oe(){return typeof WorkerGlobalScope<"u"&&typeof self<"u"&&self instanceof WorkerGlobalScope}function Ce(i){let t={};if(i.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(r,l,u,f)=>{let m=u||f;return t[l]=!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 Re,mi,Fi=null;function Yi(i){if(Fi==null){let t=i.navigator?i.navigator.userAgent:null;Fi=!!i.safari||!(!t||!(/\b(iPad|iPhone|iPod)\b/.test(t)||t.match("Safari")&&!t.match("Chrome")))}return Fi}function Oi(i){return typeof ImageBitmap<"u"&&i instanceof ImageBitmap}let $r={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"),l=r.getContext("2d");if(!l)throw new Error("failed to create canvas 2d context");return r.width=i.width,r.height=i.height,l.drawImage(i,0,0,i.width,i.height),l.getImageData(-t,-t,i.width+2*t,i.height+2*t)},resolveURL:i=>(Re||(Re=document.createElement("a")),Re.href=i,Re.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(mi==null&&(mi=matchMedia("(prefers-reduced-motion: reduce)")),mi.matches)}};var ve=kr;function kr(i,t){this.x=i,this.y=t}kr.prototype={clone:function(){return new kr(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),l=r*this.x+t*this.y;return this.x=t*this.x-r*this.y,this.y=l,this},_rotateAround:function(i,t){var r=Math.cos(i),l=Math.sin(i),u=t.y+l*(this.x-t.x)+r*(this.y-t.y);return this.x=t.x+r*(this.x-t.x)-l*(this.y-t.y),this.y=u,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},kr.convert=function(i){return i instanceof kr?i:Array.isArray(i)?new kr(i[0],i[1]):i};let Wr={MAX_PARALLEL_IMAGE_REQUESTS:16,REGISTERED_PROTOCOLS:{}},rn="mapbox-tiles",bi,gn,Lr=500,Dr=50;function nn(){typeof caches>"u"||bi||(bi=caches.open(rn))}let sn=1/0,yr={supported:!1,testSupport:function(i){!En&&Zr&&(Bn?Fn(i):Rr=i)}},Rr,Zr,En=!1,Bn=!1;function Fn(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,Zr),i.isContextLost())return;yr.supported=!0}catch{}i.deleteTexture(t),En=!0}typeof document<"u"&&(Zr=document.createElement("img"),Zr.onload=function(){Rr&&Fn(Rr),Rr=null,Bn=!0},Zr.onerror=function(){En=!0,Rr=null},Zr.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");let gs={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image"};typeof Object.freeze=="function"&&Object.freeze(gs);class ti extends Error{constructor(t,r,l,u){super(`AJAXError: ${r} (${t}): ${l}`),this.status=t,this.statusText=r,this.url=l,this.body=u}}let an=oe()?()=>self.worker&&self.worker.referrer:()=>(window.location.protocol==="blob:"?window.parent:window).location.href;function On(i,t){let r=new AbortController,l=new Request(i.url,{method:i.method||"GET",body:i.body,credentials:i.credentials,headers:i.headers,referrer:an(),signal:r.signal}),u=!1,f=!1;return i.type==="json"&&l.headers.set("Accept","application/json"),((m,x,b)=>{if(f)return;let E=Date.now();fetch(l).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(tt,et,dt){if(nn(),!bi)return;let bt={status:et.status,statusText:et.statusText,headers:new Headers};et.headers.forEach((Et,Ot)=>bt.headers.set(Ot,Et));let xt=Ce(et.headers.get("Cache-Control")||"");xt["no-store"]||(xt["max-age"]&&bt.headers.set("Expires",new Date(dt+1e3*xt["max-age"]).toUTCString()),new Date(bt.headers.get("Expires")).getTime()-dt<42e4||function(Et,Ot){if(gn===void 0)try{new Response(new ReadableStream),gn=!0}catch{gn=!1}gn?Ot(Et.body):Et.blob().then(Ot)}(et,Et=>{let Ot=new Response(Et,bt);nn(),bi&&bi.then(Lt=>Lt.put(function(re){let ue=re.indexOf("?");return ue<0?re:re.slice(0,ue)}(tt.url),Ot)).catch(Lt=>Ht(Lt.message))}))}(l,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 ti(A.status,A.statusText,i.url,z)))).catch(A=>{A.code!==20&&t(new Error(A.message))})})(),{cancel:()=>{f=!0,u||r.abort()}}}let yn=function(i,t){if(/:\/\//.test(i.url)&&!/^https?:|^file:/.test(i.url)){if(oe()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",i,t);if(!oe()){let l=i.url.substring(0,i.url.indexOf("://"));return(Wr.REGISTERED_PROTOCOLS[l]||On)(i,t)}}if(!(/^file:/.test(r=i.url)||/^file:/.test(an())&&!/^\w+:/.test(r))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return On(i,t);if(oe()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",i,t,void 0,!0)}var r;return function(l,u){let f=new XMLHttpRequest;f.open(l.method||"GET",l.url,!0),l.type==="arrayBuffer"&&(f.responseType="arraybuffer");for(let m in l.headers)f.setRequestHeader(m,l.headers[m]);return l.type==="json"&&(f.responseType="text",f.setRequestHeader("Accept","application/json")),f.withCredentials=l.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(l.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 ti(f.status,f.statusText,l.url,m))}},f.send(l.body),{cancel:()=>f.abort()}}(i,t)},Br=function(i,t){return yn(pt(i,{type:"arrayBuffer"}),t)};function ys(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(yr.supported&&(i.headers||(i.headers={}),i.headers.accept="image/webp,*/*"),B>=Wr.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,l=()=>{if(!r)for(r=!0,B--;U.length&&B<Wr.MAX_PARALLEL_IMAGE_REQUESTS;){let f=U.shift(),{requestParameters:m,callback:x,cancelled:b}=f;b||(f.cancel=V(m,x).cancel)}},u=Br(i,(f,m,x,b)=>{l(),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(),l()}}};function X(i,t,r){r[i]&&r[i].indexOf(t)!==-1||(r[i]=r[i]||[],r[i].push(t))}function nt(i,t,r){if(r&&r[i]){let l=r[i].indexOf(t);l!==-1&&r[i].splice(l,1)}}class _t{constructor(t,r={}){pt(this,r),this.type=t}}class Ft extends _t{constructor(t,r={}){super("error",pt({error:t},r))}}class Vt{on(t,r){return this._listeners=this._listeners||{},X(t,r,this._listeners),this}off(t,r){return nt(t,r,this._listeners),nt(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 _t(t,r||{}));let l=t.type;if(this.listens(l)){t.target=this;let u=this._listeners&&this._listeners[l]?this._listeners[l].slice():[];for(let x of u)x.call(this,t);let f=this._oneTimeListeners&&this._oneTimeListeners[l]?this._oneTimeListeners[l].slice():[];for(let x of f)nt(l,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 Ft&&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 zt{constructor(t,r,l,u){this.message=(t?`${t}: `:"")+l,u&&(this.identifier=u),r!=null&&r.__line__&&(this.line=r.__line__)}}function Ee(i){let t=i.value;return t?[new zt(i.key,t,"constants have been deprecated as of v8")]:[]}function Ae(i,...t){for(let r of t)for(let l in r)i[l]=r[l];return i}function ce(i){return i instanceof Number||i instanceof String||i instanceof Boolean?i.valueOf():i}function Ve(i){if(Array.isArray(i))return i.map(Ve);if(i instanceof Object&&!(i instanceof Number||i instanceof String||i instanceof Boolean)){let t={};for(let r in i)t[r]=Ve(i[r]);return t}return ce(i)}class Pe extends Error{constructor(t,r){super(r),this.message=r,this.key=t}}class ei{constructor(t,r=[]){this.parent=t,this.bindings={};for(let[l,u]of r)this.bindings[l]=u}concat(t){return new ei(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 ke={kind:"null"},Gt={kind:"number"},xe={kind:"string"},pe={kind:"boolean"},oi={kind:"color"},Wi={kind:"object"},be={kind:"value"},rr={kind:"collator"},yi={kind:"formatted"},nr={kind:"resolvedImage"};function ni(i,t){return{kind:"array",itemType:i,N:t}}function Xe(i){if(i.kind==="array"){let t=Xe(i.itemType);return typeof i.N=="number"?`array<${t}, ${i.N}>`:i.itemType.kind==="value"?"array":`array<${t}>`}return i.kind}let Gi=[ke,Gt,xe,pe,oi,yi,Wi,ni(be),nr];function _r(i,t){if(t.kind==="error")return null;if(i.kind==="array"){if(t.kind==="array"&&(t.N===0&&t.itemType.kind==="value"||!_r(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 Gi)if(!_r(r,t))return null}}return`Expected ${Xe(i)} but found ${Xe(t)} instead.`}function _i(i,t){return t.some(r=>r.kind===i.kind)}function Hr(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 Xr,Zs={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 _s(i){return(i=Math.round(i))<0?0:i>255?255:i}function xs(i){return _s(i[i.length-1]==="%"?parseFloat(i)/100*255:parseInt(i))}function Z(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{Xr={}.parseCSSColor=function(i){var t,r=i.replace(/ /g,"").toLowerCase();if(r in Zs)return Zs[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 l=r.indexOf("("),u=r.indexOf(")");if(l!==-1&&u+1===r.length){var f=r.substr(0,l),m=r.substr(l+1,u-(l+1)).split(","),x=1;switch(f){case"rgba":if(m.length!==4)return null;x=Z(m.pop());case"rgb":return m.length!==3?null:[xs(m[0]),xs(m[1]),xs(m[2]),x];case"hsla":if(m.length!==4)return null;x=Z(m.pop());case"hsl":if(m.length!==3)return null;var b=(parseFloat(m[0])%360+360)%360/360,E=Z(m[1]),A=Z(m[2]),z=A<=.5?A*(E+1):A+E-A*E,R=2*A-z;return[_s(255*I(R,z,b+1/3)),_s(255*I(R,z,b)),_s(255*I(R,z,b-1/3)),x];default:return null}}return null}}catch{}class P{constructor(t,r,l,u=1){this.r=t,this.g=r,this.b=l,this.a=u}static parse(t){if(!t)return;if(t instanceof P)return t;if(typeof t!="string")return;let r=Xr(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,l,u]=this.toArray();return`rgba(${Math.round(t)},${Math.round(r)},${Math.round(l)},${u})`}toArray(){let{r:t,g:r,b:l,a:u}=this;return u===0?[0,0,0,0]:[255*t/u,255*r/u,255*l/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,l){this.sensitivity=t?r?"variant":"case":r?"accent":"base",this.locale=l,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,l,u,f){this.text=t,this.image=r,this.scale=l,this.fontStack=u,this.textColor=f}}class K{constructor(t){this.sections=t}static fromString(t){return new K([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 K?t:K.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 l={};r.fontStack&&(l["text-font"]=["literal",r.fontStack.split(",")]),r.scale&&(l["font-scale"]=r.scale),r.textColor&&(l["text-color"]=["rgba"].concat(r.textColor.toArray())),t.push(l)}return t}}class st{constructor(t){this.name=t.name,this.available=t.available}toString(){return this.name}static fromString(t){return t?new st({name:t,available:!1}):null}serialize(){return["image",this.name]}}function it(i,t,r,l){return typeof i=="number"&&i>=0&&i<=255&&typeof t=="number"&&t>=0&&t<=255&&typeof r=="number"&&r>=0&&r<=255?l===void 0||typeof l=="number"&&l>=0&&l<=1?null:`Invalid rgba value [${[i,t,r,l].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof l=="number"?[i,t,r,l]:[i,t,r]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function rt(i){if(i===null||typeof i=="string"||typeof i=="boolean"||typeof i=="number"||i instanceof P||i instanceof q||i instanceof K||i instanceof st)return!0;if(Array.isArray(i)){for(let t of i)if(!rt(t))return!1;return!0}if(typeof i=="object"){for(let t in i)if(!rt(i[t]))return!1;return!0}return!1}function at(i){if(i===null)return ke;if(typeof i=="string")return xe;if(typeof i=="boolean")return pe;if(typeof i=="number")return Gt;if(i instanceof P)return oi;if(i instanceof q)return rr;if(i instanceof K)return yi;if(i instanceof st)return nr;if(Array.isArray(i)){let t=i.length,r;for(let l of i){let u=at(l);if(r){if(r===u)continue;r=be;break}r=u}return ni(r||be,t)}return Wi}function St(i){let t=typeof i;return i===null?"":t==="string"||t==="number"||t==="boolean"?String(i):i instanceof P||i instanceof K||i instanceof st?i.toString():JSON.stringify(i)}class Bt{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(!rt(t[1]))return r.error("invalid value");let l=t[1],u=at(l),f=r.expectedType;return u.kind!=="array"||u.N!==0||!f||f.kind!=="array"||typeof f.N=="number"&&f.N!==0||(u=f),new Bt(u,l)}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 K?this.value.serialize():this.value}}class wt{constructor(t){this.name="ExpressionEvaluationError",this.message=t}toJSON(){return this.message}}let ae={string:xe,number:Gt,boolean:pe,object:Wi};class te{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 l,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 ae)||E==="object")return r.error('The item type argument of "array" must be one of string, number, boolean',1);x=ae[E],u++}else x=be;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++}l=ni(x,b)}else l=ae[f];let m=[];for(;u<t.length;u++){let x=r.parse(t[u],u,be);if(!x)return null;m.push(x)}return new te(l,m)}evaluate(t){for(let r=0;r<this.args.length;r++){let l=this.args[r].evaluate(t);if(!_r(this.type,at(l)))return l;if(r===this.args.length-1)throw new wt(`Expected value to be of type ${Xe(this.type)}, but found ${Xe(at(l))} 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 l=t.itemType;if(l.kind==="string"||l.kind==="number"||l.kind==="boolean"){r.push(l.kind);let u=t.N;(typeof u=="number"||this.args.length>1)&&r.push(u)}}return r.concat(this.args.map(l=>l.serialize()))}}class he{constructor(t){this.type=yi,this.sections=t}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");let l=t[1];if(!Array.isArray(l)&&typeof l=="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,Gt),!b))return null;let E=null;if(x["text-font"]&&(E=r.parse(x["text-font"],1,ni(xe)),!E))return null;let A=null;if(x["text-color"]&&(A=r.parse(x["text-color"],1,oi),!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,be);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 he(u)}evaluate(t){return new K(this.sections.map(r=>{let l=r.content.evaluate(t);return at(l)===nr?new H("",l,null,null,null):new H(St(l),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 l={};r.scale&&(l["font-scale"]=r.scale.serialize()),r.font&&(l["text-font"]=r.font.serialize()),r.textColor&&(l["text-color"]=r.textColor.serialize()),t.push(l)}return t}}class ge{constructor(t){this.type=nr,this.input=t}static parse(t,r){if(t.length!==2)return r.error("Expected two arguments.");let l=r.parse(t[1],1,xe);return l?new ge(l):r.error("No image name provided.")}evaluate(t){let r=this.input.evaluate(t),l=st.fromString(r);return l&&t.availableImages&&(l.available=t.availableImages.indexOf(r)>-1),l}eachChild(t){t(this.input)}outputDefined(){return!1}serialize(){return["image",this.input.serialize()]}}let Ge={"to-boolean":pe,"to-color":oi,"to-number":Gt,"to-string":xe};class Fe{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 l=t[0];if((l==="to-boolean"||l==="to-string")&&t.length!==2)return r.error("Expected one argument.");let u=Ge[l],f=[];for(let m=1;m<t.length;m++){let x=r.parse(t[m],m,be);if(!x)return null;f.push(x)}return new Fe(u,f)}evaluate(t){if(this.type.kind==="boolean")return Boolean(this.args[0].evaluate(t));if(this.type.kind==="color"){let r,l;for(let u of this.args){if(r=u.evaluate(t),l=null,r instanceof P)return r;if(typeof r=="string"){let f=t.parseColor(r);if(f)return f}else if(Array.isArray(r)&&(l=r.length<3||r.length>4?`Invalid rbga value ${JSON.stringify(r)}: expected an array containing either three or four numeric values.`:it(r[0],r[1],r[2],r[3]),!l))return new P(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new wt(l||`Could not parse color from value '${typeof r=="string"?r:String(JSON.stringify(r))}'`)}if(this.type.kind==="number"){let r=null;for(let l of this.args){if(r=l.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"?K.fromString(St(this.args[0].evaluate(t))):this.type.kind==="resolvedImage"?st.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 he([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if(this.type.kind==="resolvedImage")return new ge(this.args[0]).serialize();let t=[`to-${this.type.kind}`];return this.eachChild(r=>{t.push(r.serialize())}),t}}let Le=["Unknown","Point","LineString","Polygon"];class Ie{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"?Le[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 Te{constructor(t,r,l,u){this.name=t,this.type=r,this._evaluate=l,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 l=t[0],u=Te.definitions[l];if(!u)return r.error(`Unknown expression "${l}". 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 Ca(r.registry,r.path,null,r.scope);let z=[],R=!1;for(let O=1;O<t.length;O++){let G=t[O],tt=Array.isArray(E)?E[O-1]:E.type,et=b.parse(G,1+z.length,tt);if(!et){R=!0;break}z.push(et)}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,tt=z[O];b.concat(O+1).checkSubtype(G,tt.type)}if(b.errors.length===0)return new Te(l,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(Xe).join(", ")})`:`(${Xe(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(Xe(R.type))}r.error(`Expected arguments of type ${E}, but found (${A.join(", ")}) instead.`)}return null}static register(t,r){Te.definitions=r;for(let l in r)t[l]=Te}}class Ti{constructor(t,r,l){this.type=rr,this.locale=l,this.caseSensitive=t,this.diacriticSensitive=r}static parse(t,r){if(t.length!==2)return r.error("Expected one argument.");let l=t[1];if(typeof l!="object"||Array.isArray(l))return r.error("Collator options argument must be an object.");let u=r.parse(l["case-sensitive"]!==void 0&&l["case-sensitive"],1,pe);if(!u)return null;let f=r.parse(l["diacritic-sensitive"]!==void 0&&l["diacritic-sensitive"],1,pe);if(!f)return null;let m=null;return l.locale&&(m=r.parse(l.locale,1,xe),!m)?null:new Ti(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 wi=8192;function qi(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 Zi(i,t){return!(i[0]<=t[0]||i[2]>=t[2]||i[1]<=t[1]||i[3]>=t[3])}function Do(i,t){let r=(180+i[0])/360,l=(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*wi),Math.round(l*u*wi)]}function Ro(i,t,r){let l=i[0]-t[0],u=i[1]-t[1],f=i[0]-r[0],m=i[1]-r[1];return l*m-f*u==0&&l*f<=0&&u*m<=0}function si(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(Ro(i,b[E],b[E+1]))return!1;(u=b[E])[1]>(l=i)[1]!=(f=b[E+1])[1]>l[1]&&l[0]<(f[0]-u[0])*(l[1]-u[1])/(f[1]-u[1])+u[0]&&(r=!r)}}var l,u,f;return r}function Fc(i,t){for(let r=0;r<t.length;r++)if(si(i,t[r]))return!0;return!1}function Bo(i,t,r,l){let u=l[0]-r[0],f=l[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 Oc(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]-(l=i)[0],u[1]-l[1]])[1]-x[1]*b[0]!=0&&Bo(l,u,f,m)&&Bo(f,m,l,u))return!0;var l,u,f,m,x,b;return!1}function Fo(i,t){for(let r=0;r<i.length;++r)if(!si(i[r],t))return!1;for(let r=0;r<i.length-1;++r)if(Oc(i[r],i[r+1],t))return!1;return!0}function Kl(i,t){for(let r=0;r<t.length;r++)if(Fo(i,t[r]))return!0;return!1}function Oo(i,t,r){let l=[];for(let u=0;u<i.length;u++){let f=[];for(let m=0;m<i[u].length;m++){let x=Do(i[u][m],r);qi(t,x),f.push(x)}l.push(f)}return l}function No(i,t,r){let l=[];for(let u=0;u<i.length;u++){let f=Oo(i[u],t,r);l.push(f)}return l}function Uo(i,t,r,l){if(i[0]<r[0]||i[0]>r[2]){let u=.5*l,f=i[0]-r[0]>u?-l:r[0]-i[0]>u?l:0;f===0&&(f=i[0]-r[2]>u?-l:r[2]-i[0]>u?l:0),i[0]+=f}qi(t,i)}function Jl(i,t,r,l){let u=Math.pow(2,l.z)*wi,f=[l.x*wi,l.y*wi],m=[];for(let x of i)for(let b of x){let E=[b.x+f[0],b.y+f[1]];Uo(E,t,r,u),m.push(E)}return m}function Yl(i,t,r,l){let u=Math.pow(2,l.z)*wi,f=[l.x*wi,l.y*wi],m=[];for(let b of i){let E=[];for(let A of b){let z=[A.x+f[0],A.y+f[1]];qi(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)Uo(E,t,r,u)}var x;return m}class Nn{constructor(t,r){this.type=pe,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(rt(t[1])){let l=t[1];if(l.type==="FeatureCollection")for(let u=0;u<l.features.length;++u){let f=l.features[u].geometry.type;if(f==="Polygon"||f==="MultiPolygon")return new Nn(l,l.features[u].geometry)}else if(l.type==="Feature"){let u=l.geometry.type;if(u==="Polygon"||u==="MultiPolygon")return new Nn(l,l.geometry)}else if(l.type==="Polygon"||l.type==="MultiPolygon")return new Nn(l,l)}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,l){let u=[1/0,1/0,-1/0,-1/0],f=[1/0,1/0,-1/0,-1/0],m=r.canonicalID();if(l.type==="Polygon"){let x=Oo(l.coordinates,f,m),b=Jl(r.geometry(),u,f,m);if(!Zi(u,f))return!1;for(let E of b)if(!si(E,x))return!1}if(l.type==="MultiPolygon"){let x=No(l.coordinates,f,m),b=Jl(r.geometry(),u,f,m);if(!Zi(u,f))return!1;for(let E of b)if(!Fc(E,x))return!1}return!0}(t,this.geometries);if(t.geometryType()==="LineString")return function(r,l){let u=[1/0,1/0,-1/0,-1/0],f=[1/0,1/0,-1/0,-1/0],m=r.canonicalID();if(l.type==="Polygon"){let x=Oo(l.coordinates,f,m),b=Yl(r.geometry(),u,f,m);if(!Zi(u,f))return!1;for(let E of b)if(!Fo(E,x))return!1}if(l.type==="MultiPolygon"){let x=No(l.coordinates,f,m),b=Yl(r.geometry(),u,f,m);if(!Zi(u,f))return!1;for(let E of b)if(!Kl(E,x))return!1}return!0}(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}serialize(){return["within",this.geojson]}}function Ea(i){if(i instanceof Te&&(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 Nn)return!1;let t=!0;return i.eachChild(r=>{t&&!Ea(r)&&(t=!1)}),t}function vs(i){if(i instanceof Te&&i.name==="feature-state")return!1;let t=!0;return i.eachChild(r=>{t&&!vs(r)&&(t=!1)}),t}function Hs(i,t){if(i instanceof Te&&t.indexOf(i.name)>=0)return!1;let r=!0;return i.eachChild(l=>{r&&!Hs(l,t)&&(r=!1)}),r}class Ia{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 l=t[1];return r.scope.has(l)?new Ia(l,r.scope.get(l)):r.error(`Unknown variable "${l}". Make sure "${l}" 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 Ca{constructor(t,r=[],l,u=new ei,f=[]){this.registry=t,this.path=r,this.key=r.map(m=>`[${m}]`).join(""),this.scope=u,this.errors=f,this.expectedType=l}parse(t,r,l,u,f={}){return r?this.concat(r,l,u)._parse(t,f):this._parse(t,f)}_parse(t,r){function l(u,f,m){return m==="assert"?new te(f,[u]):m==="coerce"?new Fe(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=l(m,x,r.typeAnnotation||"coerce");else m=l(m,x,r.typeAnnotation||"assert")}if(!(m instanceof Bt)&&m.type.kind!=="resolvedImage"&&Xs(m)){let x=new Ie;try{m=new Bt(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,l){let u=typeof t=="number"?this.path.concat(t):this.path,f=l?this.scope.concat(l):this.scope;return new Ca(this.registry,u,r||null,f,this.errors)}error(t,...r){let l=`${this.key}${r.map(u=>`[${u}]`).join("")}`;this.errors.push(new Pe(l,t))}checkSubtype(t,r){let l=_r(t,r);return l&&this.error(l),l}}function Xs(i){if(i instanceof Ia)return Xs(i.boundExpression);if(i instanceof Te&&i.name==="error"||i instanceof Ti||i instanceof Nn)return!1;let t=i instanceof Fe||i instanceof te,r=!0;return i.eachChild(l=>{r=t?r&&Xs(l):r&&l instanceof Bt}),!!r&&Ea(i)&&Hs(i,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function Aa(i,t){let r=i.length-1,l,u,f=0,m=r,x=0;for(;f<=m;)if(x=Math.floor((f+m)/2),l=i[x],u=i[x+1],l<=t){if(x===r||t<u)return x;f=x+1}else{if(!(l>t))throw new wt("Input is not a number.");m=x-1}return 0}class Ks{constructor(t,r,l){this.type=t,this.input=r,this.labels=[],this.outputs=[];for(let[u,f]of l)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 l=r.parse(t[1],1,Gt);if(!l)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 Ks(f,l,u)}evaluate(t){let r=this.labels,l=this.outputs;if(r.length===1)return l[0].evaluate(t);let u=this.input.evaluate(t);if(u<=r[0])return l[0].evaluate(t);let f=r.length;return u>=r[f-1]?l[f-1].evaluate(t):l[Aa(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 zi(i,t,r){return i*(1-r)+t*r}var Js=Object.freeze({__proto__:null,number:zi,color:function(i,t,r){return new P(zi(i.r,t.r,r),zi(i.g,t.g,r),zi(i.b,t.b,r),zi(i.a,t.a,r))},array:function(i,t,r){return i.map((l,u)=>zi(l,t[u],r))}});let Vo=.95047,Ql=1.08883,th=4/29,Pa=6/29,Go=3*Pa*Pa,Nc=Math.PI/180,Uc=180/Math.PI;function qo(i){return i>.008856451679035631?Math.pow(i,1/3):i/Go+th}function jo(i){return i>Pa?i*i*i:Go*(i-th)}function $o(i){return 255*(i<=.0031308?12.92*i:1.055*Math.pow(i,1/2.4)-.055)}function Wo(i){return(i/=255)<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4)}function eh(i){let t=Wo(i.r),r=Wo(i.g),l=Wo(i.b),u=qo((.4124564*t+.3575761*r+.1804375*l)/Vo),f=qo((.2126729*t+.7151522*r+.072175*l)/1);return{l:116*f-16,a:500*(u-f),b:200*(f-qo((.0193339*t+.119192*r+.9503041*l)/Ql)),alpha:i.a}}function We(i){let t=(i.l+16)/116,r=isNaN(i.a)?t:t+i.a/500,l=isNaN(i.b)?t:t-i.b/200;return t=1*jo(t),r=Vo*jo(r),l=Ql*jo(l),new P($o(3.2404542*r-1.5371385*t-.4985314*l),$o(-.969266*r+1.8760108*t+.041556*l),$o(.0556434*r-.2040259*t+1.0572252*l),i.alpha)}function Vc(i,t,r){let l=t-i;return i+r*(l>180||l<-180?l-360*Math.round(l/360):l)}let Ys={forward:eh,reverse:We,interpolate:function(i,t,r){return{l:zi(i.l,t.l,r),a:zi(i.a,t.a,r),b:zi(i.b,t.b,r),alpha:zi(i.alpha,t.alpha,r)}}},Qs={forward:function(i){let{l:t,a:r,b:l}=eh(i),u=Math.atan2(l,r)*Uc;return{h:u<0?u+360:u,c:Math.sqrt(r*r+l*l),l:t,alpha:i.a}},reverse:function(i){let t=i.h*Nc,r=i.c;return We({l:i.l,a:Math.cos(t)*r,b:Math.sin(t)*r,alpha:i.alpha})},interpolate:function(i,t,r){return{h:Vc(i.h,t.h,r),c:zi(i.c,t.c,r),l:zi(i.l,t.l,r),alpha:zi(i.alpha,t.alpha,r)}}};var ih=Object.freeze({__proto__:null,lab:Ys,hcl:Qs});class xr{constructor(t,r,l,u,f){this.type=t,this.operator=r,this.interpolation=l,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,l,u){let f=0;if(t.name==="exponential")f=Zo(r,t.base,l,u);else if(t.name==="linear")f=Zo(r,1,l,u);else if(t.name==="cubic-bezier"){let m=t.controlPoints;f=new M(m[0],m[1],m[2],m[3]).solve(Zo(r,1,l,u))}return f}static parse(t,r){let[l,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,Gt),!f)return null;let x=[],b=null;l==="interpolate-hcl"||l==="interpolate-lab"?b=oi: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 xr(b,l,u,f,x):r.error(`Type ${Xe(b)} is not interpolatable.`)}evaluate(t){let r=this.labels,l=this.outputs;if(r.length===1)return l[0].evaluate(t);let u=this.input.evaluate(t);if(u<=r[0])return l[0].evaluate(t);let f=r.length;if(u>=r[f-1])return l[f-1].evaluate(t);let m=Aa(r,u),x=xr.interpolationFactor(this.interpolation,u,r[m],r[m+1]),b=l[m].evaluate(t),E=l[m+1].evaluate(t);return this.operator==="interpolate"?Js[this.type.kind.toLowerCase()](b,E,x):this.operator==="interpolate-hcl"?Qs.reverse(Qs.interpolate(Qs.forward(b),Qs.forward(E),x)):Ys.reverse(Ys.interpolate(Ys.forward(b),Ys.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 l=0;l<this.labels.length;l++)r.push(this.labels[l],this.outputs[l].serialize());return r}}function Zo(i,t,r,l){let u=l-r,f=i-r;return u===0?0:t===1?f/u:(Math.pow(t,f)-1)/(Math.pow(t,u)-1)}class za{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 l=null,u=r.expectedType;u&&u.kind!=="value"&&(l=u);let f=[];for(let x of t.slice(1)){let b=r.parse(x,1+f.length,l,void 0,{typeAnnotation:"omit"});if(!b)return null;l=l||b.type,f.push(b)}let m=u&&f.some(x=>_r(u,x.type));return new za(m?be:l,f)}evaluate(t){let r,l=null,u=0;for(let f of this.args)if(u++,l=f.evaluate(t),l&&l instanceof st&&!l.available&&(r||(r=l.name),l=null,u===this.args.length&&(l=r)),l!==null)break;return l}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 ka{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 l=[];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;l.push([m,x])}let u=r.parse(t[t.length-1],t.length-1,r.expectedType,l);return u?new ka(l,u):null}outputDefined(){return this.result.outputDefined()}serialize(){let t=["let"];for(let[r,l]of this.bindings)t.push(r,l.serialize());return t.push(this.result.serialize()),t}}class Ho{constructor(t,r,l){this.type=t,this.index=r,this.input=l}static parse(t,r){if(t.length!==3)return r.error(`Expected 2 arguments, but found ${t.length-1} instead.`);let l=r.parse(t[1],1,Gt),u=r.parse(t[2],2,ni(r.expectedType||be));return l&&u?new Ho(u.type.itemType,l,u):null}evaluate(t){let r=this.index.evaluate(t),l=this.input.evaluate(t);if(r<0)throw new wt(`Array index out of bounds: ${r} < 0.`);if(r>=l.length)throw new wt(`Array index out of bounds: ${r} > ${l.length-1}.`);if(r!==Math.floor(r))throw new wt(`Array index must be an integer, but found ${r} instead.`);return l[r]}eachChild(t){t(this.index),t(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}}class Xo{constructor(t,r){this.type=pe,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 l=r.parse(t[1],1,be),u=r.parse(t[2],2,be);return l&&u?_i(l.type,[pe,xe,Gt,ke,be])?new Xo(l,u):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${Xe(l.type)} instead`):null}evaluate(t){let r=this.needle.evaluate(t),l=this.haystack.evaluate(t);if(!l)return!1;if(!Hr(r,["boolean","string","number","null"]))throw new wt(`Expected first argument to be of type boolean, string, number or null, but found ${Xe(at(r))} instead.`);if(!Hr(l,["string","array"]))throw new wt(`Expected second argument to be of type array or string, but found ${Xe(at(l))} instead.`);return l.indexOf(r)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize()]}}class La{constructor(t,r,l){this.type=Gt,this.needle=t,this.haystack=r,this.fromIndex=l}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 l=r.parse(t[1],1,be),u=r.parse(t[2],2,be);if(!l||!u)return null;if(!_i(l.type,[pe,xe,Gt,ke,be]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${Xe(l.type)} instead`);if(t.length===4){let f=r.parse(t[3],3,Gt);return f?new La(l,u,f):null}return new La(l,u)}evaluate(t){let r=this.needle.evaluate(t),l=this.haystack.evaluate(t);if(!Hr(r,["boolean","string","number","null"]))throw new wt(`Expected first argument to be of type boolean, string, number or null, but found ${Xe(at(r))} instead.`);if(!Hr(l,["string","array"]))throw new wt(`Expected second argument to be of type array or string, but found ${Xe(at(l))} instead.`);if(this.fromIndex){let u=this.fromIndex.evaluate(t);return l.indexOf(r,u)}return l.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 Ko{constructor(t,r,l,u,f,m){this.inputType=t,this.type=r,this.input=l,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 l,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(l){if(R.checkSubtype(l,at(G)))return null}else l=at(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,be);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(l,x.type)?null:new Ko(l,u,x,f,m,b):null}evaluate(t){let r=this.input.evaluate(t);return(at(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(),l=[],u={};for(let m of r){let x=u[this.cases[m]];x===void 0?(u[this.cases[m]]=l.length,l.push([this.cases[m],[m]])):l[x][1].push(m)}let f=m=>this.inputType.kind==="number"?Number(m):m;for(let[m,x]of l)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 Jo{constructor(t,r,l){this.type=t,this.branches=r,this.otherwise=l}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 l;r.expectedType&&r.expectedType.kind!=="value"&&(l=r.expectedType);let u=[];for(let m=1;m<t.length-1;m+=2){let x=r.parse(t[m],m,pe);if(!x)return null;let b=r.parse(t[m+1],m+1,l);if(!b)return null;u.push([x,b]),l=l||b.type}let f=r.parse(t[t.length-1],t.length-1,l);return f?new Jo(l,u,f):null}evaluate(t){for(let[r,l]of this.branches)if(r.evaluate(t))return l.evaluate(t);return this.otherwise.evaluate(t)}eachChild(t){for(let[r,l]of this.branches)t(r),t(l);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 Da{constructor(t,r,l,u){this.type=t,this.input=r,this.beginIndex=l,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 l=r.parse(t[1],1,be),u=r.parse(t[2],2,Gt);if(!l||!u)return null;if(!_i(l.type,[ni(be),xe,be]))return r.error(`Expected first argument to be of type array or string, but found ${Xe(l.type)} instead`);if(t.length===4){let f=r.parse(t[3],3,Gt);return f?new Da(l.type,l,u,f):null}return new Da(l.type,l,u)}evaluate(t){let r=this.input.evaluate(t),l=this.beginIndex.evaluate(t);if(!Hr(r,["string","array"]))throw new wt(`Expected first argument to be of type array or string, but found ${Xe(at(r))} instead.`);if(this.endIndex){let u=this.endIndex.evaluate(t);return r.slice(l,u)}return r.slice(l)}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 rh(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 nh(i,t,r,l){return l.compare(t,r)===0}function bs(i,t,r){let l=i!=="=="&&i!=="!=";return class wg{constructor(f,m,x){this.type=pe,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,be);if(!b)return null;if(!rh(x,b.type))return m.concat(1).error(`"${x}" comparisons are not supported for type '${Xe(b.type)}'.`);let E=m.parse(f[2],2,be);if(!E)return null;if(!rh(x,E.type))return m.concat(2).error(`"${x}" comparisons are not supported for type '${Xe(E.type)}'.`);if(b.type.kind!==E.type.kind&&b.type.kind!=="value"&&E.type.kind!=="value")return m.error(`Cannot compare types '${Xe(b.type)}' and '${Xe(E.type)}'.`);l&&(b.type.kind==="value"&&E.type.kind!=="value"?b=new te(E.type,[b]):b.type.kind!=="value"&&E.type.kind==="value"&&(E=new te(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,rr),!A)return null}return new wg(b,E,A)}evaluate(f){let m=this.lhs.evaluate(f),x=this.rhs.evaluate(f);if(l&&this.hasUntypedArgument){let b=at(m),E=at(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&&!l&&this.hasUntypedArgument){let b=at(m),E=at(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 Gc=bs("==",function(i,t,r){return t===r},nh),qc=bs("!=",function(i,t,r){return t!==r},function(i,t,r,l){return!nh(0,t,r,l)}),jc=bs("<",function(i,t,r){return t<r},function(i,t,r,l){return l.compare(t,r)<0}),$c=bs(">",function(i,t,r){return t>r},function(i,t,r,l){return l.compare(t,r)>0}),Wc=bs("<=",function(i,t,r){return t<=r},function(i,t,r,l){return l.compare(t,r)<=0}),Zc=bs(">=",function(i,t,r){return t>=r},function(i,t,r,l){return l.compare(t,r)>=0});class Yo{constructor(t,r,l,u,f){this.type=xe,this.number=t,this.locale=r,this.currency=l,this.minFractionDigits=u,this.maxFractionDigits=f}static parse(t,r){if(t.length!==3)return r.error("Expected two arguments.");let l=r.parse(t[1],1,Gt);if(!l)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,xe),!f))return null;let m=null;if(u.currency&&(m=r.parse(u.currency,1,xe),!m))return null;let x=null;if(u["min-fraction-digits"]&&(x=r.parse(u["min-fraction-digits"],1,Gt),!x))return null;let b=null;return u["max-fraction-digits"]&&(b=r.parse(u["max-fraction-digits"],1,Gt),!b)?null:new Yo(l,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 Qo{constructor(t){this.type=Gt,this.input=t}static parse(t,r){if(t.length!==2)return r.error(`Expected 1 argument, but found ${t.length-1} instead.`);let l=r.parse(t[1],1);return l?l.type.kind!=="array"&&l.type.kind!=="string"&&l.type.kind!=="value"?r.error(`Expected argument of type string or array, but found ${Xe(l.type)} instead.`):new Qo(l):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 ${Xe(at(r))} instead.`)}eachChild(t){t(this.input)}outputDefined(){return!1}serialize(){let t=["length"];return this.eachChild(r=>{t.push(r.serialize())}),t}}let ws={"==":Gc,"!=":qc,">":$c,"<":jc,">=":Zc,"<=":Wc,array:te,at:Ho,boolean:te,case:Jo,coalesce:za,collator:Ti,format:he,image:ge,in:Xo,"index-of":La,interpolate:xr,"interpolate-hcl":xr,"interpolate-lab":xr,length:Qo,let:ka,literal:Bt,match:Ko,number:te,"number-format":Yo,object:te,slice:Da,step:Ks,string:te,"to-boolean":Fe,"to-color":Fe,"to-number":Fe,"to-string":Fe,var:Ia,within:Nn};function sh(i,[t,r,l,u]){t=t.evaluate(i),r=r.evaluate(i),l=l.evaluate(i);let f=u?u.evaluate(i):1,m=it(t,r,l,f);if(m)throw new wt(m);return new P(t/255*f,r/255*f,l/255*f,f)}function ah(i,t){return i in t}function tl(i,t){let r=t[i];return r===void 0?null:r}function Un(i){return{type:i}}function oh(i){return{result:"success",value:i}}function Vn(i){return{result:"error",value:i}}function Ms(i){return i["property-type"]==="data-driven"||i["property-type"]==="cross-faded-data-driven"}function lh(i){return!!i.expression&&i.expression.parameters.indexOf("zoom")>-1}function el(i){return!!i.expression&&i.expression.interpolated}function Se(i){return i instanceof Number?"number":i instanceof String?"string":i instanceof Boolean?"boolean":Array.isArray(i)?"array":i===null?"null":typeof i}function Ra(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)}function Qe(i){return i}function Ba(i,t){let r=t.type==="color",l=i.stops&&typeof i.stops[0][0]=="object",u=l||!(l||i.property!==void 0),f=i.type||(el(t)?"exponential":"interval");if(r&&((i=Ae({},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"&&!ih[i.colorSpace])throw new Error(`Unknown color space: ${i.colorSpace}`);let m,x,b;if(f==="exponential")m=il;else if(f==="interval")m=Fa;else if(f==="categorical"){m=Mi,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=Hc}if(l){let E={},A=[];for(let O=0;O<i.stops.length;O++){let G=i.stops[O],tt=G[0].zoom;E[tt]===void 0&&(E[tt]={zoom:tt,type:i.type,property:i.property,default:i.default,stops:[]},A.push(tt)),E[tt].stops.push([G[0].value,G[1]])}let z=[];for(let O of A)z.push([E[O].zoom,Ba(E[O],t)]);let R={name:"linear"};return{kind:"composite",interpolationType:R,interpolationFactor:xr.interpolationFactor.bind(void 0,R),zoomStops:z.map(O=>O[0]),evaluate:({zoom:O},G)=>il({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:xr.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?hi(i.default,t.default):m(i,t,z,x,b)}}}function hi(i,t,r){return i!==void 0?i:t!==void 0?t:r!==void 0?r:void 0}function Mi(i,t,r,l,u){return hi(typeof r===u?l[r]:void 0,i.default,t.default)}function Fa(i,t,r){if(Se(r)!=="number")return hi(i.default,t.default);let l=i.stops.length;if(l===1||r<=i.stops[0][0])return i.stops[0][1];if(r>=i.stops[l-1][0])return i.stops[l-1][1];let u=Aa(i.stops.map(f=>f[0]),r);return i.stops[u][1]}function il(i,t,r){let l=i.base!==void 0?i.base:1;if(Se(r)!=="number")return hi(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=Aa(i.stops.map(A=>A[0]),r),m=function(A,z,R,O){let G=O-R,tt=A-R;return G===0?0:z===1?tt/G:(Math.pow(z,tt)-1)/(Math.pow(z,G)-1)}(r,l,i.stops[f][0],i.stops[f+1][0]),x=i.stops[f][1],b=i.stops[f+1][1],E=Js[t.type]||Qe;if(i.colorSpace&&i.colorSpace!=="rgb"){let A=ih[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 Hc(i,t,r){return t.type==="color"?r=P.parse(r):t.type==="formatted"?r=K.fromString(r.toString()):t.type==="resolvedImage"?r=st.fromString(r.toString()):Se(r)===t.type||t.type==="enum"&&t.values[r]||(r=void 0),hi(r,i.default,t.default)}Te.register(ws,{error:[{kind:"error"},[xe],(i,[t])=>{throw new wt(t.evaluate(i))}],typeof:[xe,[be],(i,[t])=>Xe(at(t.evaluate(i)))],"to-rgba":[ni(Gt,4),[oi],(i,[t])=>t.evaluate(i).toArray()],rgb:[oi,[Gt,Gt,Gt],sh],rgba:[oi,[Gt,Gt,Gt,Gt],sh],has:{type:pe,overloads:[[[xe],(i,[t])=>ah(t.evaluate(i),i.properties())],[[xe,Wi],(i,[t,r])=>ah(t.evaluate(i),r.evaluate(i))]]},get:{type:be,overloads:[[[xe],(i,[t])=>tl(t.evaluate(i),i.properties())],[[xe,Wi],(i,[t,r])=>tl(t.evaluate(i),r.evaluate(i))]]},"feature-state":[be,[xe],(i,[t])=>tl(t.evaluate(i),i.featureState||{})],properties:[Wi,[],i=>i.properties()],"geometry-type":[xe,[],i=>i.geometryType()],id:[be,[],i=>i.id()],zoom:[Gt,[],i=>i.globals.zoom],"heatmap-density":[Gt,[],i=>i.globals.heatmapDensity||0],"line-progress":[Gt,[],i=>i.globals.lineProgress||0],accumulated:[be,[],i=>i.globals.accumulated===void 0?null:i.globals.accumulated],"+":[Gt,Un(Gt),(i,t)=>{let r=0;for(let l of t)r+=l.evaluate(i);return r}],"*":[Gt,Un(Gt),(i,t)=>{let r=1;for(let l of t)r*=l.evaluate(i);return r}],"-":{type:Gt,overloads:[[[Gt,Gt],(i,[t,r])=>t.evaluate(i)-r.evaluate(i)],[[Gt],(i,[t])=>-t.evaluate(i)]]},"/":[Gt,[Gt,Gt],(i,[t,r])=>t.evaluate(i)/r.evaluate(i)],"%":[Gt,[Gt,Gt],(i,[t,r])=>t.evaluate(i)%r.evaluate(i)],ln2:[Gt,[],()=>Math.LN2],pi:[Gt,[],()=>Math.PI],e:[Gt,[],()=>Math.E],"^":[Gt,[Gt,Gt],(i,[t,r])=>Math.pow(t.evaluate(i),r.evaluate(i))],sqrt:[Gt,[Gt],(i,[t])=>Math.sqrt(t.evaluate(i))],log10:[Gt,[Gt],(i,[t])=>Math.log(t.evaluate(i))/Math.LN10],ln:[Gt,[Gt],(i,[t])=>Math.log(t.evaluate(i))],log2:[Gt,[Gt],(i,[t])=>Math.log(t.evaluate(i))/Math.LN2],sin:[Gt,[Gt],(i,[t])=>Math.sin(t.evaluate(i))],cos:[Gt,[Gt],(i,[t])=>Math.cos(t.evaluate(i))],tan:[Gt,[Gt],(i,[t])=>Math.tan(t.evaluate(i))],asin:[Gt,[Gt],(i,[t])=>Math.asin(t.evaluate(i))],acos:[Gt,[Gt],(i,[t])=>Math.acos(t.evaluate(i))],atan:[Gt,[Gt],(i,[t])=>Math.atan(t.evaluate(i))],min:[Gt,Un(Gt),(i,t)=>Math.min(...t.map(r=>r.evaluate(i)))],max:[Gt,Un(Gt),(i,t)=>Math.max(...t.map(r=>r.evaluate(i)))],abs:[Gt,[Gt],(i,[t])=>Math.abs(t.evaluate(i))],round:[Gt,[Gt],(i,[t])=>{let r=t.evaluate(i);return r<0?-Math.round(-r):Math.round(r)}],floor:[Gt,[Gt],(i,[t])=>Math.floor(t.evaluate(i))],ceil:[Gt,[Gt],(i,[t])=>Math.ceil(t.evaluate(i))],"filter-==":[pe,[xe,be],(i,[t,r])=>i.properties()[t.value]===r.value],"filter-id-==":[pe,[be],(i,[t])=>i.id()===t.value],"filter-type-==":[pe,[xe],(i,[t])=>i.geometryType()===t.value],"filter-<":[pe,[xe,be],(i,[t,r])=>{let l=i.properties()[t.value],u=r.value;return typeof l==typeof u&&l<u}],"filter-id-<":[pe,[be],(i,[t])=>{let r=i.id(),l=t.value;return typeof r==typeof l&&r<l}],"filter->":[pe,[xe,be],(i,[t,r])=>{let l=i.properties()[t.value],u=r.value;return typeof l==typeof u&&l>u}],"filter-id->":[pe,[be],(i,[t])=>{let r=i.id(),l=t.value;return typeof r==typeof l&&r>l}],"filter-<=":[pe,[xe,be],(i,[t,r])=>{let l=i.properties()[t.value],u=r.value;return typeof l==typeof u&&l<=u}],"filter-id-<=":[pe,[be],(i,[t])=>{let r=i.id(),l=t.value;return typeof r==typeof l&&r<=l}],"filter->=":[pe,[xe,be],(i,[t,r])=>{let l=i.properties()[t.value],u=r.value;return typeof l==typeof u&&l>=u}],"filter-id->=":[pe,[be],(i,[t])=>{let r=i.id(),l=t.value;return typeof r==typeof l&&r>=l}],"filter-has":[pe,[be],(i,[t])=>t.value in i.properties()],"filter-has-id":[pe,[],i=>i.id()!==null&&i.id()!==void 0],"filter-type-in":[pe,[ni(xe)],(i,[t])=>t.value.indexOf(i.geometryType())>=0],"filter-id-in":[pe,[ni(be)],(i,[t])=>t.value.indexOf(i.id())>=0],"filter-in-small":[pe,[xe,ni(be)],(i,[t,r])=>r.value.indexOf(i.properties()[t.value])>=0],"filter-in-large":[pe,[xe,ni(be)],(i,[t,r])=>function(l,u,f,m){for(;f<=m;){let x=f+m>>1;if(u[x]===l)return!0;u[x]>l?m=x-1:f=x+1}return!1}(i.properties()[t.value],r.value,0,r.value.length-1)],all:{type:pe,overloads:[[[pe,pe],(i,[t,r])=>t.evaluate(i)&&r.evaluate(i)],[Un(pe),(i,t)=>{for(let r of t)if(!r.evaluate(i))return!1;return!0}]]},any:{type:pe,overloads:[[[pe,pe],(i,[t,r])=>t.evaluate(i)||r.evaluate(i)],[Un(pe),(i,t)=>{for(let r of t)if(r.evaluate(i))return!0;return!1}]]},"!":[pe,[pe],(i,[t])=>!t.evaluate(i)],"is-supported-script":[pe,[xe],(i,[t])=>{let r=i.globals&&i.globals.isSupportedScript;return!r||r(t.evaluate(i))}],upcase:[xe,[xe],(i,[t])=>t.evaluate(i).toUpperCase()],downcase:[xe,[xe],(i,[t])=>t.evaluate(i).toLowerCase()],concat:[xe,Un(be),(i,t)=>t.map(r=>St(r.evaluate(i))).join("")],"resolved-locale":[xe,[rr],(i,[t])=>t.evaluate(i).resolvedLocale()]});class rl{constructor(t,r){this.expression=t,this._warningHistory={},this._evaluator=new Ie,this._defaultValue=r?function(l){return l.type==="color"&&Ra(l.default)?new P(0,0,0,0):l.type==="color"?P.parse(l.default)||null:l.default===void 0?null:l.default}(r):null,this._enumValues=r&&r.type==="enum"?r.values:null}evaluateWithoutErrorHandling(t,r,l,u,f,m){return this._evaluator.globals=t,this._evaluator.feature=r,this._evaluator.featureState=l,this._evaluator.canonical=u,this._evaluator.availableImages=f||null,this._evaluator.formattedSection=m,this.expression.evaluate(this._evaluator)}evaluate(t,r,l,u,f,m){this._evaluator.globals=t,this._evaluator.feature=r||null,this._evaluator.featureState=l||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 Oa(i){return Array.isArray(i)&&i.length>0&&typeof i[0]=="string"&&i[0]in ws}function Na(i,t){let r=new Ca(ws,[],t?function(u){let f={color:oi,string:xe,number:Gt,enum:xe,boolean:pe,formatted:yi,resolvedImage:nr};return u.type==="array"?ni(f[u.value]||be,u.length):f[u.type]}(t):void 0),l=r.parse(i,void 0,void 0,void 0,t&&t.type==="string"?{typeAnnotation:"coerce"}:void 0);return l?oh(new rl(l,t)):Vn(r.errors)}class Ua{constructor(t,r){this.kind=t,this._styleExpression=r,this.isStateDependent=t!=="constant"&&!vs(r.expression)}evaluateWithoutErrorHandling(t,r,l,u,f,m){return this._styleExpression.evaluateWithoutErrorHandling(t,r,l,u,f,m)}evaluate(t,r,l,u,f,m){return this._styleExpression.evaluate(t,r,l,u,f,m)}}class Va{constructor(t,r,l,u){this.kind=t,this.zoomStops=l,this._styleExpression=r,this.isStateDependent=t!=="camera"&&!vs(r.expression),this.interpolationType=u}evaluateWithoutErrorHandling(t,r,l,u,f,m){return this._styleExpression.evaluateWithoutErrorHandling(t,r,l,u,f,m)}evaluate(t,r,l,u,f,m){return this._styleExpression.evaluate(t,r,l,u,f,m)}interpolationFactor(t,r,l){return this.interpolationType?xr.interpolationFactor(this.interpolationType,t,r,l):0}}function nl(i,t){let r=Na(i,t);if(r.result==="error")return r;let l=r.value.expression,u=Ea(l);if(!u&&!Ms(t))return Vn([new Pe("","data expressions not supported")]);let f=Hs(l,["zoom"]);if(!f&&!lh(t))return Vn([new Pe("","zoom expressions not supported")]);let m=Ga(l);return m||f?m instanceof Pe?Vn([m]):m instanceof xr&&!el(t)?Vn([new Pe("",'"interpolate" expressions cannot be used with this property')]):oh(m?new Va(u?"camera":"composite",r.value,m.labels,m instanceof xr?m.interpolation:void 0):new Ua(u?"constant":"source",r.value)):Vn([new Pe("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Ss{constructor(t,r){this._parameters=t,this._specification=r,Ae(this,Ba(this._parameters,this._specification))}static deserialize(t){return new Ss(t._parameters,t._specification)}static serialize(t){return{_parameters:t._parameters,_specification:t._specification}}}function Ga(i){let t=null;if(i instanceof ka)t=Ga(i.result);else if(i instanceof za){for(let r of i.args)if(t=Ga(r),t)break}else(i instanceof Ks||i instanceof xr)&&i.input instanceof Te&&i.input.name==="zoom"&&(t=i);return t instanceof Pe||i.eachChild(r=>{let l=Ga(r);l instanceof Pe?t=l:!t&&l?t=new Pe("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):t&&l&&t!==l&&(t=new Pe("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),t}function Kr(i){let t=i.key,r=i.value,l=i.valueSpec||{},u=i.objectElementValidators||{},f=i.style,m=i.styleSpec,x=[],b=Se(r);if(b!=="object")return[new zt(t,r,`object expected, ${b} found`)];for(let E in r){let A=E.split(".")[0],z=l[A]||l["*"],R;if(u[A])R=u[A];else if(l[A])R=hr;else if(u["*"])R=u["*"];else{if(!l["*"]){x.push(new zt(t,r[E],`unknown property "${E}"`));continue}R=hr}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 l)u[E]||l[E].required&&l[E].default===void 0&&r[E]===void 0&&x.push(new zt(t,r,`missing required property "${E}"`));return x}function hh(i){let t=i.value,r=i.valueSpec,l=i.style,u=i.styleSpec,f=i.key,m=i.arrayElementValidator||hr;if(Se(t)!=="array")return[new zt(f,t,`array expected, ${Se(t)} found`)];if(r.length&&t.length!==r.length)return[new zt(f,t,`array length ${r.length} expected, length ${t.length} found`)];if(r["min-length"]&&t.length<r["min-length"])return[new zt(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),Se(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:l,styleSpec:u,key:`${f}[${E}]`}));return b}function ch(i){let t=i.key,r=i.value,l=i.valueSpec,u=Se(r);return u==="number"&&r!=r&&(u="NaN"),u!=="number"?[new zt(t,r,`number expected, ${u} found`)]:"minimum"in l&&r<l.minimum?[new zt(t,r,`${r} is less than the minimum value ${l.minimum}`)]:"maximum"in l&&r>l.maximum?[new zt(t,r,`${r} is greater than the maximum value ${l.maximum}`)]:[]}function uh(i){let t=i.valueSpec,r=ce(i.value.type),l,u,f,m={},x=r!=="categorical"&&i.value.property===void 0,b=!x,E=Se(i.value.stops)==="array"&&Se(i.value.stops[0])==="array"&&Se(i.value.stops[0][0])==="object",A=Kr({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 zt(O.key,O.value,'identity function may not have a "stops" property')];let G=[],tt=O.value;return G=G.concat(hh({key:O.key,value:tt,valueSpec:O.valueSpec,style:O.style,styleSpec:O.styleSpec,arrayElementValidator:z})),Se(tt)==="array"&&tt.length===0&&G.push(new zt(O.key,tt,"array must have at least one stop")),G},default:function(O){return hr({key:O.key,value:O.value,valueSpec:t,style:O.style,styleSpec:O.styleSpec})}}});return r==="identity"&&x&&A.push(new zt(i.key,i.value,'missing required property "property"')),r==="identity"||i.value.stops||A.push(new zt(i.key,i.value,'missing required property "stops"')),r==="exponential"&&i.valueSpec.expression&&!el(i.valueSpec)&&A.push(new zt(i.key,i.value,"exponential functions not supported")),i.styleSpec.$version>=8&&(b&&!Ms(i.valueSpec)?A.push(new zt(i.key,i.value,"property functions not supported")):x&&!lh(i.valueSpec)&&A.push(new zt(i.key,i.value,"zoom functions not supported"))),r!=="categorical"&&!E||i.value.property!==void 0||A.push(new zt(i.key,i.value,'"property" property is required')),A;function z(O){let G=[],tt=O.value,et=O.key;if(Se(tt)!=="array")return[new zt(et,tt,`array expected, ${Se(tt)} found`)];if(tt.length!==2)return[new zt(et,tt,`array length 2 expected, length ${tt.length} found`)];if(E){if(Se(tt[0])!=="object")return[new zt(et,tt,`object expected, ${Se(tt[0])} found`)];if(tt[0].zoom===void 0)return[new zt(et,tt,"object stop key must have zoom")];if(tt[0].value===void 0)return[new zt(et,tt,"object stop key must have value")];if(f&&f>ce(tt[0].zoom))return[new zt(et,tt[0].zoom,"stop zoom values must appear in ascending order")];ce(tt[0].zoom)!==f&&(f=ce(tt[0].zoom),u=void 0,m={}),G=G.concat(Kr({key:`${et}[0]`,value:tt[0],valueSpec:{zoom:{}},style:O.style,styleSpec:O.styleSpec,objectElementValidators:{zoom:ch,value:R}}))}else G=G.concat(R({key:`${et}[0]`,value:tt[0],valueSpec:{},style:O.style,styleSpec:O.styleSpec},tt));return Oa(Ve(tt[1]))?G.concat([new zt(`${et}[1]`,tt[1],"expressions are not allowed in function stops.")]):G.concat(hr({key:`${et}[1]`,value:tt[1],valueSpec:t,style:O.style,styleSpec:O.styleSpec}))}function R(O,G){let tt=Se(O.value),et=ce(O.value),dt=O.value!==null?O.value:G;if(l){if(tt!==l)return[new zt(O.key,dt,`${tt} stop domain type must match previous stop domain type ${l}`)]}else l=tt;if(tt!=="number"&&tt!=="string"&&tt!=="boolean")return[new zt(O.key,dt,"stop domain value must be a number, string, or boolean")];if(tt!=="number"&&r!=="categorical"){let bt=`number expected, ${tt} found`;return Ms(t)&&r===void 0&&(bt+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new zt(O.key,dt,bt)]}return r!=="categorical"||tt!=="number"||isFinite(et)&&Math.floor(et)===et?r!=="categorical"&&tt==="number"&&u!==void 0&&et<u?[new zt(O.key,dt,"stop domain values must appear in ascending order")]:(u=et,r==="categorical"&&et in m?[new zt(O.key,dt,"stop domain values must be unique")]:(m[et]=!0,[])):[new zt(O.key,dt,`integer expected, found ${et}`)]}}function Ts(i){let t=(i.expressionContext==="property"?nl:Na)(Ve(i.value),i.valueSpec);if(t.result==="error")return t.value.map(l=>new zt(`${i.key}${l.key}`,i.value,l.message));let r=t.value.expression||t.value._styleExpression.expression;if(i.expressionContext==="property"&&i.propertyKey==="text-font"&&!r.outputDefined())return[new zt(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"&&!vs(r))return[new zt(i.key,i.value,'"feature-state" data expressions are not supported with layout properties.')];if(i.expressionContext==="filter"&&!vs(r))return[new zt(i.key,i.value,'"feature-state" data expressions are not supported with filters.')];if(i.expressionContext&&i.expressionContext.indexOf("cluster")===0){if(!Hs(r,["zoom","feature-state"]))return[new zt(i.key,i.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(i.expressionContext==="cluster-initial"&&!Ea(r))return[new zt(i.key,i.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function qa(i){let t=i.key,r=i.value,l=i.valueSpec,u=[];return Array.isArray(l.values)?l.values.indexOf(ce(r))===-1&&u.push(new zt(t,r,`expected one of [${l.values.join(", ")}], ${JSON.stringify(r)} found`)):Object.keys(l.values).indexOf(ce(r))===-1&&u.push(new zt(t,r,`expected one of [${Object.keys(l.values).join(", ")}], ${JSON.stringify(r)} found`)),u}function sl(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(!sl(t)&&typeof t!="boolean")return!1;return!0;default:return!0}}let ph={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function ja(i){if(i==null)return{filter:()=>!0,needGeometry:!1};sl(i)||(i=ta(i));let t=Na(i,ph);if(t.result==="error")throw new Error(t.value.map(r=>`${r.key}: ${r.message}`).join(", "));return{filter:(r,l,u)=>t.value.evaluate(r,l,{},u),needGeometry:dh(i)}}function $a(i,t){return i<t?-1:i>t?1:0}function dh(i){if(!Array.isArray(i))return!1;if(i[0]==="within")return!0;for(let t=1;t<i.length;t++)if(dh(i[t]))return!0;return!1}function ta(i){if(!i)return!0;let t=i[0];return i.length<=1?t!=="any":t==="=="?al(i[1],i[2],"=="):t==="!="?Es(al(i[1],i[2],"==")):t==="<"||t===">"||t==="<="||t===">="?al(i[1],i[2],t):t==="any"?(r=i.slice(1),["any"].concat(r.map(ta))):t==="all"?["all"].concat(i.slice(1).map(ta)):t==="none"?["all"].concat(i.slice(1).map(ta).map(Es)):t==="in"?Wa(i[1],i.slice(2)):t==="!in"?Es(Wa(i[1],i.slice(2))):t==="has"?Za(i[1]):t==="!has"?Es(Za(i[1])):t!=="within"||i;var r}function al(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 Wa(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($a)]]:["filter-in-small",i,["literal",t]]}}function Za(i){switch(i){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",i]}}function Es(i){return["!",i]}function ea(i){return sl(Ve(i.value))?Ts(Ae({},i,{expressionContext:"filter",valueSpec:{value:"boolean"}})):fh(i)}function fh(i){let t=i.value,r=i.key;if(Se(t)!=="array")return[new zt(r,t,`array expected, ${Se(t)} found`)];let l=i.styleSpec,u,f=[];if(t.length<1)return[new zt(r,t,"filter array must have at least 1 element")];switch(f=f.concat(qa({key:`${r}[0]`,value:t[0],valueSpec:l.filter_operator,style:i.style,styleSpec:i.styleSpec})),ce(t[0])){case"<":case"<=":case">":case">=":t.length>=2&&ce(t[1])==="$type"&&f.push(new zt(r,t,`"$type" cannot be use with operator "${t[0]}"`));case"==":case"!=":t.length!==3&&f.push(new zt(r,t,`filter array for operator "${t[0]}" must have 3 elements`));case"in":case"!in":t.length>=2&&(u=Se(t[1]),u!=="string"&&f.push(new zt(`${r}[1]`,t[1],`string expected, ${u} found`)));for(let m=2;m<t.length;m++)u=Se(t[m]),ce(t[1])==="$type"?f=f.concat(qa({key:`${r}[${m}]`,value:t[m],valueSpec:l.geometry_type,style:i.style,styleSpec:i.styleSpec})):u!=="string"&&u!=="number"&&u!=="boolean"&&f.push(new zt(`${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(fh({key:`${r}[${m}]`,value:t[m],style:i.style,styleSpec:i.styleSpec}));break;case"has":case"!has":u=Se(t[1]),t.length!==2?f.push(new zt(r,t,`filter array for "${t[0]}" operator must have 2 elements`)):u!=="string"&&f.push(new zt(`${r}[1]`,t[1],`string expected, ${u} found`));break;case"within":u=Se(t[1]),t.length!==2?f.push(new zt(r,t,`filter array for "${t[0]}" operator must have 2 elements`)):u!=="object"&&f.push(new zt(`${r}[1]`,t[1],`object expected, ${u} found`))}return f}function ia(i,t){let r=i.key,l=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 hr({key:r,value:f,valueSpec:u.transition,style:l,styleSpec:u});let E=i.valueSpec||x[m];if(!E)return[new zt(r,f,`unknown property "${m}"`)];let A;if(Se(f)==="string"&&Ms(E)&&!E.tokens&&(A=/^{([^}]+)}$/.exec(f)))return[new zt(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"&&l&&!l.glyphs&&z.push(new zt(r,f,'use of "text-field" requires a style "glyphs" property')),m==="text-font"&&Ra(Ve(f))&&ce(f.type)==="identity"&&z.push(new zt(r,f,'"text-font" does not support identity functions'))),z.concat(hr({key:i.key,value:f,valueSpec:E,style:l,styleSpec:u,expressionContext:"property",propertyType:t,propertyKey:m}))}function mh(i){return ia(i,"paint")}function gh(i){return ia(i,"layout")}function yh(i){let t=[],r=i.value,l=i.key,u=i.style,f=i.styleSpec;r.type||r.ref||t.push(new zt(l,r,'either "type" or "ref" is required'));let m=ce(r.type),x=ce(r.ref);if(r.id){let b=ce(r.id);for(let E=0;E<i.arrayIndex;E++){let A=u.layers[E];ce(A.id)===b&&t.push(new zt(l,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 zt(l,r[E],`"${E}" is prohibited for ref layers`))}),u.layers.forEach(E=>{ce(E.id)===x&&(b=E)}),b?b.ref?t.push(new zt(l,r.ref,"ref cannot reference another ref layer")):m=ce(b.type):t.push(new zt(l,r.ref,`ref layer "${x}" not found`))}else if(m!=="background")if(r.source){let b=u.sources&&u.sources[r.source],E=b&&ce(b.type);b?E==="vector"&&m==="raster"?t.push(new zt(l,r.source,`layer "${r.id}" requires a raster source`)):E==="raster"&&m!=="raster"?t.push(new zt(l,r.source,`layer "${r.id}" requires a vector source`)):E!=="vector"||r["source-layer"]?E==="raster-dem"&&m!=="hillshade"?t.push(new zt(l,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 zt(l,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):t.push(new zt(l,r,`layer "${r.id}" must specify a "source-layer"`)):t.push(new zt(l,r.source,`source "${r.source}" not found`))}else t.push(new zt(l,r,'missing required property "source"'));return t=t.concat(Kr({key:l,value:r,valueSpec:f.layer,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{"*":()=>[],type:()=>hr({key:`${l}.type`,value:r.type,valueSpec:f.layer.type,style:i.style,styleSpec:i.styleSpec,object:r,objectKey:"type"}),filter:ea,layout:b=>Kr({layer:r,key:b.key,value:b.value,style:b.style,styleSpec:b.styleSpec,objectElementValidators:{"*":E=>gh(Ae({layerType:m},E))}}),paint:b=>Kr({layer:r,key:b.key,value:b.value,style:b.style,styleSpec:b.styleSpec,objectElementValidators:{"*":E=>mh(Ae({layerType:m},E))}})}})),t}function Is(i){let t=i.value,r=i.key,l=Se(t);return l!=="string"?[new zt(r,t,`string expected, ${l} found`)]:[]}let _h={promoteId:function({key:i,value:t}){if(Se(t)==="string")return Is({key:i,value:t});{let r=[];for(let l in t)r.push(...Is({key:`${i}.${l}`,value:t[l]}));return r}}};function ra(i){let t=i.value,r=i.key,l=i.styleSpec,u=i.style;if(!t.type)return[new zt(r,t,'"type" is required')];let f=ce(t.type),m;switch(f){case"vector":case"raster":case"raster-dem":return m=Kr({key:r,value:t,valueSpec:l[`source_${f.replace("-","_")}`],style:i.style,styleSpec:l,objectElementValidators:_h}),m;case"geojson":if(m=Kr({key:r,value:t,valueSpec:l.source_geojson,style:u,styleSpec:l,objectElementValidators:_h}),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(...Ts({key:`${r}.${x}.map`,value:E,expressionContext:"cluster-map"})),m.push(...Ts({key:`${r}.${x}.reduce`,value:A,expressionContext:"cluster-reduce"}))}return m;case"video":return Kr({key:r,value:t,valueSpec:l.source_video,style:u,styleSpec:l});case"image":return Kr({key:r,value:t,valueSpec:l.source_image,style:u,styleSpec:l});case"canvas":return[new zt(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return qa({key:`${r}.type`,value:t.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:u,styleSpec:l})}}function na(i){let t=i.value,r=i.styleSpec,l=r.light,u=i.style,f=[],m=Se(t);if(t===void 0)return f;if(m!=="object")return f=f.concat([new zt("light",t,`object expected, ${m} found`)]),f;for(let x in t){let b=x.match(/^(.*)-transition$/);f=f.concat(b&&l[b[1]]&&l[b[1]].transition?hr({key:x,value:t[x],valueSpec:r.transition,style:u,styleSpec:r}):l[x]?hr({key:x,value:t[x],valueSpec:l[x],style:u,styleSpec:r}):[new zt(x,t[x],`unknown property "${x}"`)])}return f}let vr={"*":()=>[],array:hh,boolean:function(i){let t=i.value,r=i.key,l=Se(t);return l!=="boolean"?[new zt(r,t,`boolean expected, ${l} found`)]:[]},number:ch,color:function(i){let t=i.key,r=i.value,l=Se(r);return l!=="string"?[new zt(t,r,`color expected, ${l} found`)]:Xr(r)===null?[new zt(t,r,`color expected, "${r}" found`)]:[]},constants:Ee,enum:qa,filter:ea,function:uh,layer:yh,object:Kr,source:ra,light:na,string:Is,formatted:function(i){return Is(i).length===0?[]:Ts(i)},resolvedImage:function(i){return Is(i).length===0?[]:Ts(i)}};function hr(i){let t=i.value,r=i.valueSpec,l=i.styleSpec;return r.expression&&Ra(ce(t))?uh(i):r.expression&&Oa(Ve(t))?Ts(i):r.type&&vr[r.type]?vr[r.type](i):Kr(Ae({},i,{valueSpec:r.type?l[r.type]:r}))}function Xc(i){let t=i.value,r=i.key,l=Is(i);return l.length||(t.indexOf("{fontstack}")===-1&&l.push(new zt(r,t,'"glyphs" url must include a "{fontstack}" token')),t.indexOf("{range}")===-1&&l.push(new zt(r,t,'"glyphs" url must include a "{range}" token'))),l}function Gn(i,t=ct){let r=[];return r=r.concat(hr({key:"",value:i,valueSpec:t.$root,styleSpec:t,style:i,objectElementValidators:{glyphs:Xc,"*":()=>[]}})),i.constants&&(r=r.concat(Ee({key:"constants",value:i.constants,style:i,styleSpec:t}))),xh(r)}function xh(i){return[].concat(i).sort((t,r)=>t.line-r.line)}function Cs(i){return function(...t){return xh(i.apply(this,t))}}Gn.source=Cs(ra),Gn.light=Cs(na),Gn.layer=Cs(yh),Gn.filter=Cs(ea),Gn.paintProperty=Cs(mh),Gn.layoutProperty=Cs(gh);let qn=Gn,Kc=qn.light,ol=qn.paintProperty,Jc=qn.layoutProperty;function vh(i,t){let r=!1;if(t&&t.length)for(let l of t)i.fire(new Ft(new Error(l.message))),r=!0;return r}class jn{constructor(t,r,l){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*(l=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*l;for(let m=0;m<this.d*this.d;m++)u.push([]);this.keys=[],this.bboxes=[]}this.n=r,this.extent=t,this.padding=l,this.scale=r/t,this.uid=0;let f=l/r*t;this.min=-f,this.max=t+f}insert(t,r,l,u,f){this._forEachCell(r,l,u,f,this._insertCell,this.uid++,void 0,void 0),this.keys.push(t),this.bboxes.push(r),this.bboxes.push(l),this.bboxes.push(u),this.bboxes.push(f)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(t,r,l,u,f,m){this.cells[f].push(m)}query(t,r,l,u,f){let m=this.min,x=this.max;if(t<=m&&r<=m&&x<=l&&x<=u&&!f)return Array.prototype.slice.call(this.keys);{let b=[];return this._forEachCell(t,r,l,u,this._queryCell,b,{},f),b}}_queryCell(t,r,l,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]&&l>=z[G+0]&&u>=z[G+1])?(x[O]=!0,m.push(A[O])):x[O]=!1}}}}_forEachCell(t,r,l,u,f,m,x,b){let E=this._convertToCellCoord(t),A=this._convertToCellCoord(r),z=this._convertToCellCoord(l),R=this._convertToCellCoord(u);for(let O=E;O<=z;O++)for(let G=A;G<=R;G++){let tt=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,l,u,tt,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,l=0;for(let m=0;m<this.cells.length;m++)l+=this.cells[m].length;let u=new Int32Array(r+l+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 l=t.toArrayBuffer();return r&&r.push(l),{buffer:l}}static deserialize(t){return new jn(t.buffer)}}let As={};function ie(i,t,r={}){Object.defineProperty(t,"_classRegistryKey",{value:i,writeable:!1}),As[i]={klass:t,omit:r.omit||[],shallow:r.shallow||[]}}ie("Object",Object),ie("TransferableGridIndex",jn),ie("Color",P),ie("Error",Error),ie("AJAXError",ti),ie("ResolvedImage",st),ie("StylePropertyFunction",Ss),ie("StyleExpression",rl,{omit:["_evaluator"]}),ie("ZoomDependentExpression",Va),ie("ZoomConstantExpression",Ua),ie("CompoundExpression",Te,{omit:["_evaluate"]});for(let i in ws)ws[i]._classRegistryKey||ie(`Expression_${i}`,ws[i]);function ll(i){return i&&typeof ArrayBuffer<"u"&&(i instanceof ArrayBuffer||i.constructor&&i.constructor.name==="ArrayBuffer")}function sa(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(ll(i)||Oi(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 l of i)r.push(sa(l,t));return r}if(typeof i=="object"){let r=i.constructor,l=r._classRegistryKey;if(!l)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)||As[l].omit.indexOf(f)>=0)continue;let m=i[f];u[f]=As[l].shallow.indexOf(f)>=0?m:sa(m,t)}i instanceof Error&&(u.message=i.message)}if(u.$name)throw new Error("$name property is reserved for worker serialization logic.");return l!=="Object"&&(u.$name=l),u}throw new Error("can't serialize object of type "+typeof i)}function $n(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||ll(i)||Oi(i)||ArrayBuffer.isView(i)||i instanceof ImageData)return i;if(Array.isArray(i))return i.map($n);if(typeof i=="object"){let t=i.$name||"Object";if(!As[t])throw new Error(`can't deserialize unregistered class ${t}`);let{klass:r}=As[t];if(!r)throw new Error(`can't deserialize unregistered class ${t}`);if(r.deserialize)return r.deserialize(i);let l=Object.create(r.prototype);for(let u of Object.keys(i)){if(u==="$name")continue;let f=i[u];l[u]=As[t].shallow.indexOf(u)>=0?f:$n(f)}return l}throw new Error("can't deserialize object of type "+typeof i)}class aa{constructor(){this.first=!0}update(t,r){let l=Math.floor(t);return this.first?(this.first=!1,this.lastIntegerZoom=l,this.lastIntegerZoomTime=0,this.lastZoom=t,this.lastFloorZoom=l,!0):(this.lastFloorZoom>l?(this.lastIntegerZoom=l+1,this.lastIntegerZoomTime=r):this.lastFloorZoom<l&&(this.lastIntegerZoom=l,this.lastIntegerZoomTime=r),t!==this.lastZoom&&(this.lastZoom=t,this.lastFloorZoom=l,!0))}}let Xt={"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 hl(i){for(let t of i)if(oa(t.charCodeAt(0)))return!0;return!1}function bh(i){for(let t of i)if(!Yc(t.charCodeAt(0)))return!1;return!0}function Yc(i){return!(Xt.Arabic(i)||Xt["Arabic Supplement"](i)||Xt["Arabic Extended-A"](i)||Xt["Arabic Presentation Forms-A"](i)||Xt["Arabic Presentation Forms-B"](i))}function oa(i){return!(i!==746&&i!==747&&(i<4352||!(Xt["Bopomofo Extended"](i)||Xt.Bopomofo(i)||Xt["CJK Compatibility Forms"](i)&&!(i>=65097&&i<=65103)||Xt["CJK Compatibility Ideographs"](i)||Xt["CJK Compatibility"](i)||Xt["CJK Radicals Supplement"](i)||Xt["CJK Strokes"](i)||!(!Xt["CJK Symbols and Punctuation"](i)||i>=12296&&i<=12305||i>=12308&&i<=12319||i===12336)||Xt["CJK Unified Ideographs Extension A"](i)||Xt["CJK Unified Ideographs"](i)||Xt["Enclosed CJK Letters and Months"](i)||Xt["Hangul Compatibility Jamo"](i)||Xt["Hangul Jamo Extended-A"](i)||Xt["Hangul Jamo Extended-B"](i)||Xt["Hangul Jamo"](i)||Xt["Hangul Syllables"](i)||Xt.Hiragana(i)||Xt["Ideographic Description Characters"](i)||Xt.Kanbun(i)||Xt["Kangxi Radicals"](i)||Xt["Katakana Phonetic Extensions"](i)||Xt.Katakana(i)&&i!==12540||!(!Xt["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)||!(!Xt["Small Form Variants"](i)||i>=65112&&i<=65118||i>=65123&&i<=65126)||Xt["Unified Canadian Aboriginal Syllabics"](i)||Xt["Unified Canadian Aboriginal Syllabics Extended"](i)||Xt["Vertical Forms"](i)||Xt["Yijing Hexagram Symbols"](i)||Xt["Yi Syllables"](i)||Xt["Yi Radicals"](i))))}function wh(i){return!(oa(i)||function(t){return!!(Xt["Latin-1 Supplement"](t)&&(t===167||t===169||t===174||t===177||t===188||t===189||t===190||t===215||t===247)||Xt["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)||Xt["Letterlike Symbols"](t)||Xt["Number Forms"](t)||Xt["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)||Xt["Control Pictures"](t)&&t!==9251||Xt["Optical Character Recognition"](t)||Xt["Enclosed Alphanumerics"](t)||Xt["Geometric Shapes"](t)||Xt["Miscellaneous Symbols"](t)&&!(t>=9754&&t<=9759)||Xt["Miscellaneous Symbols and Arrows"](t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||Xt["CJK Symbols and Punctuation"](t)||Xt.Katakana(t)||Xt["Private Use Area"](t)||Xt["CJK Compatibility Forms"](t)||Xt["Small Form Variants"](t)||Xt["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 Mh(i){return i>=1424&&i<=2303||Xt["Arabic Presentation Forms-A"](i)||Xt["Arabic Presentation Forms-B"](i)}function Qc(i,t){return!(!t&&Mh(i)||i>=2304&&i<=3583||i>=3840&&i<=4255||Xt.Khmer(i))}function tu(i){for(let t of i)if(Mh(t.charCodeAt(0)))return!0;return!1}let Ha="deferred",cl="loading",ul="loaded",pl=null,cr="unavailable",In=null,Sh=function(i){i&&typeof i=="string"&&i.indexOf("NetworkError")>-1&&(cr="error"),pl&&pl(i)};function dl(){Ps.fire(new _t("pluginStateChange",{pluginStatus:cr,pluginURL:In}))}let Ps=new Vt,fl=function(){return cr},Xa=function(){if(cr!==Ha||!In)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");cr=cl,dl(),In&&Br({url:In},i=>{i?Sh(i):(cr=ul,dl())})},Fr={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>cr===ul||Fr.applyArabicShaping!=null,isLoading:()=>cr===cl,setState(i){cr=i.pluginStatus,In=i.pluginURL},isParsed:()=>Fr.applyArabicShaping!=null&&Fr.processBidirectionalText!=null&&Fr.processStyledBidirectionalText!=null,getPluginURL:()=>In};class ci{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 aa,this.transition={})}isSupportedScript(t){return function(r,l){for(let u of r)if(!Qc(u.charCodeAt(0),l))return!1;return!0}(t,Fr.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),l=this.crossFadingFactor();return t>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:r+(1-r)*l}:{fromScale:.5,toScale:1,t:1-(1-l)*r}}}class Ka{constructor(t,r){this.property=t,this.value=r,this.expression=function(l,u){if(Ra(l))return new Ss(l,u);if(Oa(l)){let f=nl(l,u);if(f.result==="error")throw new Error(f.value.map(m=>`${m.key}: ${m.message}`).join(", "));return f.value}{let f=l;return typeof l=="string"&&u.type==="color"&&(f=P.parse(l)),{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,l){return this.property.possiblyEvaluate(this,t,r,l)}}class Ja{constructor(t){this.property=t,this.value=new Ka(t,void 0)}transitioned(t,r){return new Th(this.property,this.value,r,pt({},t.transition,this.transition),t.now)}untransitioned(){return new Th(this.property,this.value,null,{},0)}}class ml{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues)}getValue(t){return Dt(this._values[t].value.value)}setValue(t,r){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new Ja(this._values[t].property)),this._values[t].value=new Ka(this._values[t].property,r===null?void 0:Dt(r))}getTransition(t){return Dt(this._values[t].transition)}setTransition(t,r){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new Ja(this._values[t].property)),this._values[t].transition=Dt(r)||void 0}serialize(){let t={};for(let r of Object.keys(this._values)){let l=this.getValue(r);l!==void 0&&(t[r]=l);let u=this.getTransition(r);u!==void 0&&(t[`${r}-transition`]=u)}return t}transitioned(t,r){let l=new Eh(this._properties);for(let u of Object.keys(this._values))l._values[u]=this._values[u].transitioned(t,r._values[u]);return l}untransitioned(){let t=new Eh(this._properties);for(let r of Object.keys(this._values))t._values[r]=this._values[r].untransitioned();return t}}class Th{constructor(t,r,l,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=l)}possiblyEvaluate(t,r,l){let u=t.now||0,f=this.value.possiblyEvaluate(t,r,l),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,l);{let x=(u-this.begin)/(this.end-this.begin);return this.property.interpolate(m.possiblyEvaluate(t,r,l),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 Eh{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)}possiblyEvaluate(t,r,l){let u=new Ya(this._properties);for(let f of Object.keys(this._values))u._values[f]=this._values[f].possiblyEvaluate(t,r,l);return u}hasTransition(){for(let t of Object.keys(this._values))if(this._values[t].prior)return!0;return!1}}class eu{constructor(t){this._properties=t,this._values=Object.create(t.defaultPropertyValues)}getValue(t){return Dt(this._values[t].value)}setValue(t,r){this._values[t]=new Ka(this._values[t].property,r===null?void 0:Dt(r))}serialize(){let t={};for(let r of Object.keys(this._values)){let l=this.getValue(r);l!==void 0&&(t[r]=l)}return t}possiblyEvaluate(t,r,l){let u=new Ya(this._properties);for(let f of Object.keys(this._values))u._values[f]=this._values[f].possiblyEvaluate(t,r,l);return u}}class on{constructor(t,r,l){this.property=t,this.value=r,this.parameters=l}isConstant(){return this.value.kind==="constant"}constantOr(t){return this.value.kind==="constant"?this.value.value:t}evaluate(t,r,l,u){return this.property.evaluate(this.value,this.parameters,t,r,l,u)}}class Ya{constructor(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues)}get(t){return this._values[t]}}class le{constructor(t){this.specification=t}possiblyEvaluate(t,r){return t.expression.evaluate(r)}interpolate(t,r,l){let u=Js[this.specification.type];return u?u(t,r,l):t}}class ye{constructor(t,r){this.specification=t,this.overrides=r}possiblyEvaluate(t,r,l,u){return new on(this,t.expression.kind==="constant"||t.expression.kind==="camera"?{kind:"constant",value:t.expression.evaluate(r,null,{},l,u)}:t.expression,r)}interpolate(t,r,l){if(t.value.kind!=="constant"||r.value.kind!=="constant")return t;if(t.value.value===void 0||r.value.value===void 0)return new on(this,{kind:"constant",value:void 0},t.parameters);let u=Js[this.specification.type];return u?new on(this,{kind:"constant",value:u(t.value.value,r.value.value,l)},t.parameters):t}evaluate(t,r,l,u,f,m){return t.kind==="constant"?t.value:t.evaluate(r,l,u,f,m)}}class la extends ye{possiblyEvaluate(t,r,l,u){if(t.value===void 0)return new on(this,{kind:"constant",value:void 0},r);if(t.expression.kind==="constant"){let f=t.expression.evaluate(r,null,{},l,u),m=t.property.specification.type==="resolvedImage"&&typeof f!="string"?f.name:f,x=this._calculate(m,m,m,r);return new on(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 on(this,{kind:"constant",value:f},r)}return new on(this,t.expression,r)}evaluate(t,r,l,u,f,m){if(t.kind==="source"){let x=t.evaluate(r,l,u,f,m);return this._calculate(x,x,x,r)}return t.kind==="composite"?this._calculate(t.evaluate({zoom:Math.floor(r.zoom)-1},l,u),t.evaluate({zoom:Math.floor(r.zoom)},l,u),t.evaluate({zoom:Math.floor(r.zoom)+1},l,u),r):t.value}_calculate(t,r,l,u){return u.zoom>u.zoomHistory.lastIntegerZoom?{from:t,to:r}:{from:l,to:r}}interpolate(t){return t}}class ha{constructor(t){this.specification=t}possiblyEvaluate(t,r,l,u){if(t.value!==void 0){if(t.expression.kind==="constant"){let f=t.expression.evaluate(r,null,{},l,u);return this._calculate(f,f,f,r)}return this._calculate(t.expression.evaluate(new ci(Math.floor(r.zoom-1),r)),t.expression.evaluate(new ci(Math.floor(r.zoom),r)),t.expression.evaluate(new ci(Math.floor(r.zoom+1),r)),r)}}_calculate(t,r,l,u){return u.zoom>u.zoomHistory.lastIntegerZoom?{from:t,to:r}:{from:l,to:r}}interpolate(t){return t}}class gl{constructor(t){this.specification=t}possiblyEvaluate(t,r,l,u){return!!t.expression.evaluate(r,null,{},l,u)}interpolate(){return!1}}class Ni{constructor(t){this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(let r in t){let l=t[r];l.specification.overridable&&this.overridableProperties.push(r);let u=this.defaultPropertyValues[r]=new Ka(l,void 0),f=this.defaultTransitionablePropertyValues[r]=new Ja(l);this.defaultTransitioningPropertyValues[r]=f.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=u.possiblyEvaluate({})}}}ie("DataDrivenProperty",ye),ie("DataConstantProperty",le),ie("CrossFadedDataDrivenProperty",la),ie("CrossFadedProperty",ha),ie("ColorRampProperty",gl);let Wn="-transition";class ur extends Vt{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 eu(r.layout)),r.paint)){this._transitionablePaint=new ml(r.paint);for(let l in t.paint)this.setPaintProperty(l,t.paint[l],{validate:!1});for(let l in t.layout)this.setLayoutProperty(l,t.layout[l],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Ya(r.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(t){return t==="visibility"?this.visibility:this._unevaluatedLayout.getValue(t)}setLayoutProperty(t,r,l={}){r!=null&&this._validate(Jc,`layers.${this.id}.layout.${t}`,t,r,l)||(t!=="visibility"?this._unevaluatedLayout.setValue(t,r):this.visibility=r)}getPaintProperty(t){return t.endsWith(Wn)?this._transitionablePaint.getTransition(t.slice(0,-Wn.length)):this._transitionablePaint.getValue(t)}setPaintProperty(t,r,l={}){if(r!=null&&this._validate(ol,`layers.${this.id}.paint.${t}`,t,r,l))return!1;if(t.endsWith(Wn))return this._transitionablePaint.setTransition(t.slice(0,-Wn.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,l){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),Ct(t,(r,l)=>!(r===void 0||l==="layout"&&!Object.keys(r).length||l==="paint"&&!Object.keys(r).length))}_validate(t,r,l,u,f={}){return(!f||f.validate!==!1)&&vh(this,t.call(qn,{key:r,layerType:this.type,objectKey:l,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 on&&Ms(r.property.specification)&&(r.value.kind==="source"||r.value.kind==="composite")&&r.value.isStateDependent)return!0}return!1}}let iu={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class ca{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 li{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 Ui(i,t=1){let r=0,l=0;return{members:i.map(u=>{let f=iu[u.type].BYTES_PER_ELEMENT,m=r=Ih(r,Math.max(t,f)),x=u.components||1;return l=Math.max(l,f),r+=f*x,{name:u.name,type:u.type,components:x,offset:m}}),size:Ih(r,Math.max(l,t)),alignment:t}}function Ih(i,t){return Math.ceil(i/t)*t}class zs extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r){let l=this.length;return this.resize(l+1),this.emplace(l,t,r)}emplace(t,r,l){let u=2*t;return this.int16[u+0]=r,this.int16[u+1]=l,t}}zs.prototype.bytesPerElement=4,ie("StructArrayLayout2i4",zs);class ua extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,l,u){let f=this.length;return this.resize(f+1),this.emplace(f,t,r,l,u)}emplace(t,r,l,u,f){let m=4*t;return this.int16[m+0]=r,this.int16[m+1]=l,this.int16[m+2]=u,this.int16[m+3]=f,t}}ua.prototype.bytesPerElement=8,ie("StructArrayLayout4i8",ua);class p extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,l,u,f,m){let x=this.length;return this.resize(x+1),this.emplace(x,t,r,l,u,f,m)}emplace(t,r,l,u,f,m,x){let b=6*t;return this.int16[b+0]=r,this.int16[b+1]=l,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,ie("StructArrayLayout2i4i12",p);class e extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,l,u,f,m){let x=this.length;return this.resize(x+1),this.emplace(x,t,r,l,u,f,m)}emplace(t,r,l,u,f,m,x){let b=4*t,E=8*t;return this.int16[b+0]=r,this.int16[b+1]=l,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,ie("StructArrayLayout2i4ub8",e);class s extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r){let l=this.length;return this.resize(l+1),this.emplace(l,t,r)}emplace(t,r,l){let u=2*t;return this.float32[u+0]=r,this.float32[u+1]=l,t}}s.prototype.bytesPerElement=8,ie("StructArrayLayout2f8",s);class c extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,l,u,f,m,x,b,E,A){let z=this.length;return this.resize(z+1),this.emplace(z,t,r,l,u,f,m,x,b,E,A)}emplace(t,r,l,u,f,m,x,b,E,A,z){let R=10*t;return this.uint16[R+0]=r,this.uint16[R+1]=l,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,ie("StructArrayLayout10ui20",c);class d extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,l,u,f,m,x,b,E,A,z,R){let O=this.length;return this.resize(O+1),this.emplace(O,t,r,l,u,f,m,x,b,E,A,z,R)}emplace(t,r,l,u,f,m,x,b,E,A,z,R,O){let G=12*t;return this.int16[G+0]=r,this.int16[G+1]=l,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,ie("StructArrayLayout4i4ui4i24",d);class y extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r,l){let u=this.length;return this.resize(u+1),this.emplace(u,t,r,l)}emplace(t,r,l,u){let f=3*t;return this.float32[f+0]=r,this.float32[f+1]=l,this.float32[f+2]=u,t}}y.prototype.bytesPerElement=12,ie("StructArrayLayout3f12",y);class v extends li{_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,ie("StructArrayLayout1ul4",v);class w extends li{_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,l,u,f,m,x,b,E){let A=this.length;return this.resize(A+1),this.emplace(A,t,r,l,u,f,m,x,b,E)}emplace(t,r,l,u,f,m,x,b,E,A){let z=10*t,R=5*t;return this.int16[z+0]=r,this.int16[z+1]=l,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,ie("StructArrayLayout6i1ul2ui20",w);class T extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,l,u,f,m){let x=this.length;return this.resize(x+1),this.emplace(x,t,r,l,u,f,m)}emplace(t,r,l,u,f,m,x){let b=6*t;return this.int16[b+0]=r,this.int16[b+1]=l,this.int16[b+2]=u,this.int16[b+3]=f,this.int16[b+4]=m,this.int16[b+5]=x,t}}T.prototype.bytesPerElement=12,ie("StructArrayLayout2i2i2i12",T);class C extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,l,u,f){let m=this.length;return this.resize(m+1),this.emplace(m,t,r,l,u,f)}emplace(t,r,l,u,f,m){let x=4*t,b=8*t;return this.float32[x+0]=r,this.float32[x+1]=l,this.float32[x+2]=u,this.int16[b+6]=f,this.int16[b+7]=m,t}}C.prototype.bytesPerElement=16,ie("StructArrayLayout2f1f2i16",C);class k extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r,l,u){let f=this.length;return this.resize(f+1),this.emplace(f,t,r,l,u)}emplace(t,r,l,u,f){let m=12*t,x=3*t;return this.uint8[m+0]=r,this.uint8[m+1]=l,this.float32[x+1]=u,this.float32[x+2]=f,t}}k.prototype.bytesPerElement=12,ie("StructArrayLayout2ub2f12",k);class F extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,l){let u=this.length;return this.resize(u+1),this.emplace(u,t,r,l)}emplace(t,r,l,u){let f=3*t;return this.uint16[f+0]=r,this.uint16[f+1]=l,this.uint16[f+2]=u,t}}F.prototype.bytesPerElement=6,ie("StructArrayLayout3ui6",F);class j extends li{_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,l,u,f,m,x,b,E,A,z,R,O,G,tt,et,dt){let bt=this.length;return this.resize(bt+1),this.emplace(bt,t,r,l,u,f,m,x,b,E,A,z,R,O,G,tt,et,dt)}emplace(t,r,l,u,f,m,x,b,E,A,z,R,O,G,tt,et,dt,bt){let xt=24*t,Et=12*t,Ot=48*t;return this.int16[xt+0]=r,this.int16[xt+1]=l,this.uint16[xt+2]=u,this.uint16[xt+3]=f,this.uint32[Et+2]=m,this.uint32[Et+3]=x,this.uint32[Et+4]=b,this.uint16[xt+10]=E,this.uint16[xt+11]=A,this.uint16[xt+12]=z,this.float32[Et+7]=R,this.float32[Et+8]=O,this.uint8[Ot+36]=G,this.uint8[Ot+37]=tt,this.uint8[Ot+38]=et,this.uint32[Et+10]=dt,this.int16[xt+22]=bt,t}}j.prototype.bytesPerElement=48,ie("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",j);class Y extends li{_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,l,u,f,m,x,b,E,A,z,R,O,G,tt,et,dt,bt,xt,Et,Ot,Lt,re,ue,Jt,Yt,Zt,ee){let Qt=this.length;return this.resize(Qt+1),this.emplace(Qt,t,r,l,u,f,m,x,b,E,A,z,R,O,G,tt,et,dt,bt,xt,Et,Ot,Lt,re,ue,Jt,Yt,Zt,ee)}emplace(t,r,l,u,f,m,x,b,E,A,z,R,O,G,tt,et,dt,bt,xt,Et,Ot,Lt,re,ue,Jt,Yt,Zt,ee,Qt){let qt=34*t,_e=17*t;return this.int16[qt+0]=r,this.int16[qt+1]=l,this.int16[qt+2]=u,this.int16[qt+3]=f,this.int16[qt+4]=m,this.int16[qt+5]=x,this.int16[qt+6]=b,this.int16[qt+7]=E,this.uint16[qt+8]=A,this.uint16[qt+9]=z,this.uint16[qt+10]=R,this.uint16[qt+11]=O,this.uint16[qt+12]=G,this.uint16[qt+13]=tt,this.uint16[qt+14]=et,this.uint16[qt+15]=dt,this.uint16[qt+16]=bt,this.uint16[qt+17]=xt,this.uint16[qt+18]=Et,this.uint16[qt+19]=Ot,this.uint16[qt+20]=Lt,this.uint16[qt+21]=re,this.uint16[qt+22]=ue,this.uint32[_e+12]=Jt,this.float32[_e+13]=Yt,this.float32[_e+14]=Zt,this.float32[_e+15]=ee,this.float32[_e+16]=Qt,t}}Y.prototype.bytesPerElement=68,ie("StructArrayLayout8i15ui1ul4f68",Y);class $ extends li{_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,ie("StructArrayLayout1f4",$);class J extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,l){let u=this.length;return this.resize(u+1),this.emplace(u,t,r,l)}emplace(t,r,l,u){let f=3*t;return this.int16[f+0]=r,this.int16[f+1]=l,this.int16[f+2]=u,t}}J.prototype.bytesPerElement=6,ie("StructArrayLayout3i6",J);class lt extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,l){let u=this.length;return this.resize(u+1),this.emplace(u,t,r,l)}emplace(t,r,l,u){let f=4*t;return this.uint32[2*t+0]=r,this.uint16[f+2]=l,this.uint16[f+3]=u,t}}lt.prototype.bytesPerElement=8,ie("StructArrayLayout1ul2ui8",lt);class ht extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r){let l=this.length;return this.resize(l+1),this.emplace(l,t,r)}emplace(t,r,l){let u=2*t;return this.uint16[u+0]=r,this.uint16[u+1]=l,t}}ht.prototype.bytesPerElement=4,ie("StructArrayLayout2ui4",ht);class gt extends li{_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,ie("StructArrayLayout1ui2",gt);class ut extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r,l,u){let f=this.length;return this.resize(f+1),this.emplace(f,t,r,l,u)}emplace(t,r,l,u,f){let m=4*t;return this.float32[m+0]=r,this.float32[m+1]=l,this.float32[m+2]=u,this.float32[m+3]=f,t}}ut.prototype.bytesPerElement=16,ie("StructArrayLayout4f16",ut);class kt extends ca{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 ve(this.anchorPointX,this.anchorPointY)}}kt.prototype.size=20;class Mt extends w{get(t){return new kt(this,t)}}ie("CollisionBoxArray",Mt);class Tt extends ca{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 Ut extends j{get(t){return new Tt(this,t)}}ie("PlacedSymbolArray",Ut);class $t extends ca{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]}}$t.prototype.size=68;class Pt extends Y{get(t){return new $t(this,t)}}ie("SymbolInstanceArray",Pt);class se extends ${getoffsetX(t){return this.float32[1*t+0]}}ie("GlyphOffsetArray",se);class Kt 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]}}ie("SymbolLineVertexArray",Kt);class we extends ca{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]}}we.prototype.size=8;class Ue extends lt{get(t){return new we(this,t)}}ie("FeatureIndexArray",Ue);class De extends zs{}class Oe extends zs{}class xi extends p{}class Me extends e{}class je extends s{}class ii extends c{}class Hi extends d{}class br extends y{}class Or extends v{}class Nr extends T{}class Cn extends k{}class pr extends F{}class ln extends ht{}let Zn=Ui([{name:"a_pos",components:2,type:"Int16"}],4),{members:wr}=Zn;class $e{constructor(t=[]){this.segments=t}prepareSegment(t,r,l,u){let f=this.segments[this.segments.length-1];return t>$e.MAX_VERTEX_ARRAY_LENGTH&&Ht(`Max vertices per segment is ${$e.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${t}`),(!f||f.vertexLength+t>$e.MAX_VERTEX_ARRAY_LENGTH||f.sortKey!==u)&&(f={vertexOffset:r.length,primitiveOffset:l.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,l,u){return new $e([{vertexOffset:t,primitiveOffset:r,vertexLength:l,primitiveLength:u,vaos:{},sortKey:0}])}}function Ke(i,t){return 256*(i=L(Math.floor(i),0,255))+L(Math.floor(t),0,255)}$e.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,ie("SegmentVector",$e);let ki=Ui([{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 sr={exports:{}},ui={exports:{}};ui.exports=function(i,t){var r,l,u,f,m,x,b,E;for(l=i.length-(r=3&i.length),u=t,m=3432918353,x=461845907,E=0;E<l;)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 Hn={exports:{}};Hn.exports=function(i,t){for(var r,l=i.length,u=t^l,f=0;l>=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)),l-=4,++f;switch(l){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 hn=ui.exports,Qa=Hn.exports;sr.exports=hn,sr.exports.murmur3=hn,sr.exports.murmur2=Qa;var yl=sr.exports;class to{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(t,r,l,u){this.ids.push(Ch(t)),this.positions.push(r,l,u)}getPositions(t){let r=Ch(t),l=0,u=this.ids.length-1;for(;l<u;){let m=l+u>>1;this.ids[m]>=r?u=m:l=m+1}let f=[];for(;this.ids[l]===r;)f.push({index:this.positions[3*l],start:this.positions[3*l+1],end:this.positions[3*l+2]}),l++;return f}static serialize(t,r){let l=new Float64Array(t.ids),u=new Uint32Array(t.positions);return Xn(l,u,0,l.length-1),r&&r.push(l.buffer,u.buffer),{ids:l,positions:u}}static deserialize(t){let r=new to;return r.ids=t.ids,r.positions=t.positions,r.indexed=!0,r}}function Ch(i){let t=+i;return!isNaN(t)&&t<=Number.MAX_SAFE_INTEGER?t:yl(String(i))}function Xn(i,t,r,l){for(;r<l;){let u=i[r+l>>1],f=r-1,m=l+1;for(;;){do f++;while(i[f]<u);do m--;while(i[m]>u);if(f>=m)break;eo(i,f,m),eo(t,3*f,3*m),eo(t,3*f+1,3*m+1),eo(t,3*f+2,3*m+2)}m-r<l-m?(Xn(i,t,r,m),r=m+1):(Xn(i,t,m+1,l),l=m)}}function eo(i,t,r){let l=i[t];i[t]=i[r],i[r]=l}ie("FeaturePositionMap",to);class cn{constructor(t,r){this.gl=t.gl,this.location=r}}class ks extends cn{constructor(t,r){super(t,r),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1f(this.location,t))}}class vp extends cn{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 bp extends cn{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 Ag=new Float32Array(16);function ru(i){return[Ke(255*i.r,255*i.g),Ke(255*i.b,255*i.a)]}class _l{constructor(t,r,l){this.value=t,this.uniformNames=r.map(u=>`u_${u}`),this.type=l}setUniform(t,r,l){t.set(l.constantOr(this.value))}getBinding(t,r,l){return this.type==="color"?new bp(t,r):new ks(t,r)}}class io{constructor(t,r){this.uniformNames=r.map(l=>`u_${l}`),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,l,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,l){return l.substr(0,9)==="u_pattern"?new vp(t,r):new ks(t,r)}}class Kn{constructor(t,r,l,u){this.expression=t,this.type=l,this.maxValue=0,this.paintVertexAttributes=r.map(f=>({name:`a_${f}`,type:"Float32",components:l==="color"?2:1,offset:0})),this.paintVertexArray=new u}populatePaintArray(t,r,l,u,f){let m=this.paintVertexArray.length,x=this.expression.evaluate(new ci(0),r,{},u,[],f);this.paintVertexArray.resize(t),this._setPaintValue(m,t,x)}updatePaintArray(t,r,l,u){let f=this.expression.evaluate({zoom:0},l,u);this._setPaintValue(t,r,f)}_setPaintValue(t,r,l){if(this.type==="color"){let u=ru(l);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,l);this.maxValue=Math.max(this.maxValue,Math.abs(l))}}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 _n{constructor(t,r,l,u,f,m){this.expression=t,this.uniformNames=r.map(x=>`u_${x}_t`),this.type=l,this.useIntegerZoom=u,this.zoom=f,this.maxValue=0,this.paintVertexAttributes=r.map(x=>({name:`a_${x}`,type:"Float32",components:l==="color"?4:2,offset:0})),this.paintVertexArray=new m}populatePaintArray(t,r,l,u,f){let m=this.expression.evaluate(new ci(this.zoom),r,{},u,[],f),x=this.expression.evaluate(new ci(this.zoom+1),r,{},u,[],f),b=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(b,t,m,x)}updatePaintArray(t,r,l,u){let f=this.expression.evaluate({zoom:this.zoom},l,u),m=this.expression.evaluate({zoom:this.zoom+1},l,u);this._setPaintValue(t,r,f,m)}_setPaintValue(t,r,l,u){if(this.type==="color"){let f=ru(l),m=ru(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,l,u);this.maxValue=Math.max(this.maxValue,Math.abs(l),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 l=this.useIntegerZoom?Math.floor(r.zoom):r.zoom,u=L(this.expression.interpolationFactor(l,this.zoom,this.zoom+1),0,1);t.set(u)}getBinding(t,r,l){return new ks(t,r)}}class Ls{constructor(t,r,l,u,f,m){this.expression=t,this.type=r,this.useIntegerZoom=l,this.zoom=u,this.layerId=m,this.zoomInPaintVertexArray=new f,this.zoomOutPaintVertexArray=new f}populatePaintArray(t,r,l){let u=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(t),this.zoomOutPaintVertexArray.resize(t),this._setPaintValues(u,t,r.patterns&&r.patterns[this.layerId],l)}updatePaintArray(t,r,l,u,f){this._setPaintValues(t,r,l.patterns&&l.patterns[this.layerId],f)}_setPaintValues(t,r,l,u){if(!u||!l)return;let{min:f,mid:m,max:x}=l,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,ki.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=t.createVertexBuffer(this.zoomOutPaintVertexArray,ki.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class wp{constructor(t,r,l){this.binders={},this._buffers=[];let u=[];for(let f in t.paint._values){if(!l(f))continue;let m=t.paint.get(f);if(!(m instanceof on&&Ms(m.property.specification)))continue;let x=Pg(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 io(b.value,x):new _l(b.value,x,E),u.push(`/u_${f}`);else if(b.kind==="source"||R){let O=Mp(f,E,"source");this.binders[f]=R?new Ls(b,E,A,r,O,t.id):new Kn(b,x,E,O),u.push(`/a_${f}`)}else{let O=Mp(f,E,"composite");this.binders[f]=new _n(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 Kn||r instanceof _n?r.maxValue:0}populatePaintArrays(t,r,l,u,f){for(let m in this.binders){let x=this.binders[m];(x instanceof Kn||x instanceof _n||x instanceof Ls)&&x.populatePaintArray(t,r,l,u,f)}}setConstantPatternPositions(t,r){for(let l in this.binders){let u=this.binders[l];u instanceof io&&u.setConstantPatternPositions(t,r)}}updatePaintArrays(t,r,l,u,f){let m=!1;for(let x in t){let b=r.getPositions(x);for(let E of b){let A=l.feature(E.index);for(let z in this.binders){let R=this.binders[z];if((R instanceof Kn||R instanceof _n||R instanceof Ls)&&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 l=this.binders[r];(l instanceof _l||l instanceof io)&&t.push(...l.uniformNames.map(u=>`#define HAS_UNIFORM_${u}`))}return t}getBinderAttributes(){let t=[];for(let r in this.binders){let l=this.binders[r];if(l instanceof Kn||l instanceof _n)for(let u=0;u<l.paintVertexAttributes.length;u++)t.push(l.paintVertexAttributes[u].name);else if(l instanceof Ls)for(let u=0;u<ki.members.length;u++)t.push(ki.members[u].name)}return t}getBinderUniforms(){let t=[];for(let r in this.binders){let l=this.binders[r];if(l instanceof _l||l instanceof io||l instanceof _n)for(let u of l.uniformNames)t.push(u)}return t}getPaintVertexBuffers(){return this._buffers}getUniforms(t,r){let l=[];for(let u in this.binders){let f=this.binders[u];if(f instanceof _l||f instanceof io||f instanceof _n){for(let m of f.uniformNames)if(r[m]){let x=f.getBinding(t,r[m],m);l.push({name:m,property:u,binding:x})}}}return l}setUniforms(t,r,l,u){for(let{name:f,property:m,binding:x}of r)this.binders[m].setUniform(x,u,l.get(m),f)}updatePaintBuffers(t){this._buffers=[];for(let r in this.binders){let l=this.binders[r];if(t&&l instanceof Ls){let u=t.fromScale===2?l.zoomInPaintVertexBuffer:l.zoomOutPaintVertexBuffer;u&&this._buffers.push(u)}else(l instanceof Kn||l instanceof _n)&&l.paintVertexBuffer&&this._buffers.push(l.paintVertexBuffer)}}upload(t){for(let r in this.binders){let l=this.binders[r];(l instanceof Kn||l instanceof _n||l instanceof Ls)&&l.upload(t)}this.updatePaintBuffers()}destroy(){for(let t in this.binders){let r=this.binders[t];(r instanceof Kn||r instanceof _n||r instanceof Ls)&&r.destroy()}}}class pa{constructor(t,r,l=()=>!0){this.programConfigurations={};for(let u of t)this.programConfigurations[u.id]=new wp(u,r,l);this.needsUpload=!1,this._featureMap=new to,this._bufferOffset=0}populatePaintArrays(t,r,l,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,l,this._bufferOffset,t),this._bufferOffset=t,this.needsUpload=!0}updatePaintArrays(t,r,l,u){for(let f of l)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 Pg(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 Mp(i,t,r){let l={color:{source:s,composite:ut},number:{source:$,composite:s}},u=function(f){return{"line-pattern":{source:ii,composite:ii},"fill-pattern":{source:ii,composite:ii},"fill-extrusion-pattern":{source:ii,composite:ii}}[f]}(i);return u&&u[r]||l[t][r]}ie("ConstantBinder",_l),ie("CrossFadedConstantBinder",io),ie("SourceExpressionBinder",Kn),ie("CrossFadedCompositeBinder",Ls),ie("CompositeExpressionBinder",_n),ie("ProgramConfiguration",wp,{omit:["_buffers"]}),ie("ProgramConfigurationSet",pa);var Vi=8192;let nu=Math.pow(2,14)-1,Sp=-nu-1;function da(i){let t=Vi/i.extent,r=i.loadGeometry();for(let l=0;l<r.length;l++){let u=r[l];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,Sp,nu),m.y=L(b,Sp,nu),(x<m.x||x>m.x+1||b<m.y||b>m.y+1)&&Ht("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return r}function fa(i,t){return{type:i.type,id:i.id,properties:i.properties,geometry:t?da(i):[]}}function Ah(i,t,r,l,u){i.emplaceBack(2*t+(l+1)/2,2*r+(u+1)/2)}class su{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 De,this.indexArray=new pr,this.segments=new $e,this.programConfigurations=new pa(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(t,r,l){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=fa(b,R);if(!this.layers[0]._featureFilter.filter(new ci(this.zoom),O,l))continue;let G=x?m.evaluate(O,{},l):void 0,tt={id:E,properties:b.properties,type:b.type,sourceLayerIndex:z,index:A,geometry:R?O.geometry:da(b),patterns:{},sortKey:G};f.push(tt)}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,l),r.featureIndex.insert(R,E,A,z,this.index)}}update(t,r,l){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,l)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,wr),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,l,u){for(let f of r)for(let m of f){let x=m.x,b=m.y;if(x<0||x>=Vi||b<0||b>=Vi)continue;let E=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,t.sortKey),A=E.vertexLength;Ah(this.layoutVertexArray,x,b,-1,-1),Ah(this.layoutVertexArray,x,b,1,-1),Ah(this.layoutVertexArray,x,b,1,1),Ah(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,l,{},u)}}function Tp(i,t){for(let r=0;r<i.length;r++)if(ro(t,i[r]))return!0;for(let r=0;r<t.length;r++)if(ro(i,t[r]))return!0;return!!au(i,t)}function zg(i,t,r){return!!ro(i,t)||!!ou(t,i,r)}function Ep(i,t){if(i.length===1)return Cp(t,i[0]);for(let r=0;r<t.length;r++){let l=t[r];for(let u=0;u<l.length;u++)if(ro(i,l[u]))return!0}for(let r=0;r<i.length;r++)if(Cp(t,i[r]))return!0;for(let r=0;r<t.length;r++)if(au(i,t[r]))return!0;return!1}function kg(i,t,r){if(i.length>1){if(au(i,t))return!0;for(let l=0;l<t.length;l++)if(ou(t[l],i,r))return!0}for(let l=0;l<i.length;l++)if(ou(i[l],t,r))return!0;return!1}function au(i,t){if(i.length===0||t.length===0)return!1;for(let r=0;r<i.length-1;r++){let l=i[r],u=i[r+1];for(let f=0;f<t.length-1;f++)if(Lg(l,u,t[f],t[f+1]))return!0}return!1}function Lg(i,t,r,l){return fe(i,r,l)!==fe(t,r,l)&&fe(i,t,r)!==fe(i,t,l)}function ou(i,t,r){let l=r*r;if(t.length===1)return i.distSqr(t[0])<l;for(let u=1;u<t.length;u++)if(Ip(i,t[u-1],t[u])<l)return!0;return!1}function Ip(i,t,r){let l=t.distSqr(r);if(l===0)return i.distSqr(t);let u=((i.x-t.x)*(r.x-t.x)+(i.y-t.y)*(r.y-t.y))/l;return i.distSqr(u<0?t:u>1?r:r.sub(t)._mult(u)._add(t))}function Cp(i,t){let r,l,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++)l=r[x],u=r[b],l.y>t.y!=u.y>t.y&&t.x<(u.x-l.x)*(t.y-l.y)/(u.y-l.y)+l.x&&(f=!f)}return f}function ro(i,t){let r=!1;for(let l=0,u=i.length-1;l<i.length;u=l++){let f=i[l],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 Dg(i,t,r){let l=r[0],u=r[2];if(i.x<l.x&&t.x<l.x||i.x>u.x&&t.x>u.x||i.y<l.y&&t.y<l.y||i.y>u.y&&t.y>u.y)return!1;let f=fe(i,t,r[0]);return f!==fe(i,t,r[1])||f!==fe(i,t,r[2])||f!==fe(i,t,r[3])}function xl(i,t,r){let l=t.paint.get(i).value;return l.kind==="constant"?l.value:r.programConfigurations.get(t.id).getMaxValue(i)}function Ph(i){return Math.sqrt(i[0]*i[0]+i[1]*i[1])}function zh(i,t,r,l,u){if(!t[0]&&!t[1])return i;let f=ve.convert(t)._mult(u);r==="viewport"&&f._rotate(-l);let m=[];for(let x=0;x<i.length;x++)m.push(i[x].sub(f));return m}ie("CircleBucket",su,{omit:["layers"]});let Rg=new Ni({"circle-sort-key":new ye(ct.layout_circle["circle-sort-key"])});var Bg={paint:new Ni({"circle-radius":new ye(ct.paint_circle["circle-radius"]),"circle-color":new ye(ct.paint_circle["circle-color"]),"circle-blur":new ye(ct.paint_circle["circle-blur"]),"circle-opacity":new ye(ct.paint_circle["circle-opacity"]),"circle-translate":new le(ct.paint_circle["circle-translate"]),"circle-translate-anchor":new le(ct.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new le(ct.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new le(ct.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new ye(ct.paint_circle["circle-stroke-width"]),"circle-stroke-color":new ye(ct.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new ye(ct.paint_circle["circle-stroke-opacity"])}),layout:Rg},no=typeof Float32Array<"u"?Float32Array:Array;function lu(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 Ap(i,t,r){var l=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],tt=t[12],et=t[13],dt=t[14],bt=t[15],xt=r[0],Et=r[1],Ot=r[2],Lt=r[3];return i[0]=xt*l+Et*x+Ot*z+Lt*tt,i[1]=xt*u+Et*b+Ot*R+Lt*et,i[2]=xt*f+Et*E+Ot*O+Lt*dt,i[3]=xt*m+Et*A+Ot*G+Lt*bt,i[4]=(xt=r[4])*l+(Et=r[5])*x+(Ot=r[6])*z+(Lt=r[7])*tt,i[5]=xt*u+Et*b+Ot*R+Lt*et,i[6]=xt*f+Et*E+Ot*O+Lt*dt,i[7]=xt*m+Et*A+Ot*G+Lt*bt,i[8]=(xt=r[8])*l+(Et=r[9])*x+(Ot=r[10])*z+(Lt=r[11])*tt,i[9]=xt*u+Et*b+Ot*R+Lt*et,i[10]=xt*f+Et*E+Ot*O+Lt*dt,i[11]=xt*m+Et*A+Ot*G+Lt*bt,i[12]=(xt=r[12])*l+(Et=r[13])*x+(Ot=r[14])*z+(Lt=r[15])*tt,i[13]=xt*u+Et*b+Ot*R+Lt*et,i[14]=xt*f+Et*E+Ot*O+Lt*dt,i[15]=xt*m+Et*A+Ot*G+Lt*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 vl,Fg=Ap;function kh(i,t,r){var l=t[0],u=t[1],f=t[2],m=t[3];return i[0]=r[0]*l+r[4]*u+r[8]*f+r[12]*m,i[1]=r[1]*l+r[5]*u+r[9]*f+r[13]*m,i[2]=r[2]*l+r[6]*u+r[10]*f+r[14]*m,i[3]=r[3]*l+r[7]*u+r[11]*f+r[15]*m,i}function Pp(i,t){let r=kh([],[i.x,i.y,0,1],t);return new ve(r[0]/r[3],r[1]/r[3])}vl=new no(4),no!=Float32Array&&(vl[0]=0,vl[1]=0,vl[2]=0,vl[3]=0);class zp extends su{}ie("HeatmapBucket",zp,{omit:["layers"]});var Og={paint:new Ni({"heatmap-radius":new ye(ct.paint_heatmap["heatmap-radius"]),"heatmap-weight":new ye(ct.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new le(ct.paint_heatmap["heatmap-intensity"]),"heatmap-color":new gl(ct.paint_heatmap["heatmap-color"]),"heatmap-opacity":new le(ct.paint_heatmap["heatmap-opacity"])})};function hu(i,{width:t,height:r},l,u){if(u){if(u instanceof Uint8ClampedArray)u=new Uint8Array(u.buffer);else if(u.length!==t*r*l)throw new RangeError(`mismatched image size. expected: ${u.length} but got: ${t*r*l}`)}else u=new Uint8Array(t*r*l);return i.width=t,i.height=r,i.data=u,i}function kp(i,{width:t,height:r},l){if(t===i.width&&r===i.height)return;let u=hu({},{width:t,height:r},l);cu(i,u,{x:0,y:0},{x:0,y:0},{width:Math.min(i.width,t),height:Math.min(i.height,r)},l),i.width=t,i.height=r,i.data=u.data}function cu(i,t,r,l,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||l.x>t.width-u.width||l.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=((l.y+b)*t.width+l.x)*f;for(let z=0;z<u.width*f;z++)x[A+z]=m[E+z]}return t}class bl{constructor(t,r){hu(this,t,1,r)}resize(t){kp(this,t,1)}clone(){return new bl({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,r,l,u,f){cu(t,r,l,u,f,1)}}class Jr{constructor(t,r){hu(this,t,4,r)}resize(t){kp(this,t,4)}replace(t,r){r?this.data.set(t):this.data=t instanceof Uint8ClampedArray?new Uint8Array(t.buffer):t}clone(){return new Jr({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,r,l,u,f){cu(t,r,l,u,f,4)}}function Lp(i){let t={},r=i.resolution||256,l=i.clips?i.clips.length:1,u=i.image||new Jr({width:r,height:l}),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<l;++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}ie("AlphaImage",bl),ie("RGBAImage",Jr);var Ng={paint:new Ni({"hillshade-illumination-direction":new le(ct.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new le(ct.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new le(ct.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new le(ct.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new le(ct.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new le(ct.paint_hillshade["hillshade-accent-color"])})};let Ug=Ui([{name:"a_pos",components:2,type:"Int16"}],4),{members:Vg}=Ug;var uu={exports:{}};function Lh(i,t,r){r=r||2;var l,u,f,m,x,b,E,A=t&&t.length,z=A?t[0]*r:i.length,R=Dp(i,0,z,r,!0),O=[];if(!R||R.next===R.prev)return O;if(A&&(R=function(tt,et,dt,bt){var xt,Et,Ot,Lt=[];for(xt=0,Et=et.length;xt<Et;xt++)(Ot=Dp(tt,et[xt]*bt,xt<Et-1?et[xt+1]*bt:tt.length,bt,!1))===Ot.next&&(Ot.steiner=!0),Lt.push(Xg(Ot));for(Lt.sort(Wg),xt=0;xt<Lt.length;xt++)dt=Ds(dt=Zg(Lt[xt],dt),dt.next);return dt}(i,t,R,r)),i.length>80*r){l=f=i[0],u=m=i[1];for(var G=r;G<z;G+=r)(x=i[G])<l&&(l=x),(b=i[G+1])<u&&(u=b),x>f&&(f=x),b>m&&(m=b);E=(E=Math.max(f-l,m-u))!==0?1/E:0}return wl(R,O,r,l,u,E),O}function Dp(i,t,r,l,u){var f,m;if(u===fu(i,t,r,l)>0)for(f=t;f<r;f+=l)m=Fp(f,i[f],i[f+1],m);else for(f=r-l;f>=t;f-=l)m=Fp(f,i[f],i[f+1],m);return m&&Dh(m,m.next)&&(Sl(m),m=m.next),m}function Ds(i,t){if(!i)return i;t||(t=i);var r,l=i;do if(r=!1,l.steiner||!Dh(l,l.next)&&Ei(l.prev,l,l.next)!==0)l=l.next;else{if(Sl(l),(l=t=l.prev)===l.next)break;r=!0}while(r||l!==t);return t}function wl(i,t,r,l,u,f,m){if(i){!m&&f&&function(A,z,R,O){var G=A;do G.z===null&&(G.z=pu(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(tt){var et,dt,bt,xt,Et,Ot,Lt,re,ue=1;do{for(dt=tt,tt=null,Et=null,Ot=0;dt;){for(Ot++,bt=dt,Lt=0,et=0;et<ue&&(Lt++,bt=bt.nextZ);et++);for(re=ue;Lt>0||re>0&&bt;)Lt!==0&&(re===0||!bt||dt.z<=bt.z)?(xt=dt,dt=dt.nextZ,Lt--):(xt=bt,bt=bt.nextZ,re--),Et?Et.nextZ=xt:tt=xt,xt.prevZ=Et,Et=xt;dt=bt}Et.nextZ=null,ue*=2}while(Ot>1)}(G)}(i,l,u,f);for(var x,b,E=i;i.prev!==i.next;)if(x=i.prev,b=i.next,f?qg(i,l,u,f):Gg(i))t.push(x.i/r),t.push(i.i/r),t.push(b.i/r),Sl(i),i=b.next,E=b.next;else if((i=b)===E){m?m===1?wl(i=jg(Ds(i),t,r),t,r,l,u,f,2):m===2&&$g(i,t,r,l,u,f):wl(Ds(i),t,r,l,u,f,1);break}}}function Gg(i){var t=i.prev,r=i,l=i.next;if(Ei(t,r,l)>=0)return!1;for(var u=i.next.next;u!==i.prev;){if(so(t.x,t.y,r.x,r.y,l.x,l.y,u.x,u.y)&&Ei(u.prev,u,u.next)>=0)return!1;u=u.next}return!0}function qg(i,t,r,l){var u=i.prev,f=i,m=i.next;if(Ei(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=pu(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,l),A=pu(x,b,t,r,l),z=i.prevZ,R=i.nextZ;z&&z.z>=E&&R&&R.z<=A;){if(z!==i.prev&&z!==i.next&&so(u.x,u.y,f.x,f.y,m.x,m.y,z.x,z.y)&&Ei(z.prev,z,z.next)>=0||(z=z.prevZ,R!==i.prev&&R!==i.next&&so(u.x,u.y,f.x,f.y,m.x,m.y,R.x,R.y)&&Ei(R.prev,R,R.next)>=0))return!1;R=R.nextZ}for(;z&&z.z>=E;){if(z!==i.prev&&z!==i.next&&so(u.x,u.y,f.x,f.y,m.x,m.y,z.x,z.y)&&Ei(z.prev,z,z.next)>=0)return!1;z=z.prevZ}for(;R&&R.z<=A;){if(R!==i.prev&&R!==i.next&&so(u.x,u.y,f.x,f.y,m.x,m.y,R.x,R.y)&&Ei(R.prev,R,R.next)>=0)return!1;R=R.nextZ}return!0}function jg(i,t,r){var l=i;do{var u=l.prev,f=l.next.next;!Dh(u,f)&&Rp(u,l,l.next,f)&&Ml(u,f)&&Ml(f,u)&&(t.push(u.i/r),t.push(l.i/r),t.push(f.i/r),Sl(l),Sl(l.next),l=i=f),l=l.next}while(l!==i);return Ds(l)}function $g(i,t,r,l,u,f){var m=i;do{for(var x=m.next.next;x!==m.prev;){if(m.i!==x.i&&Kg(m,x)){var b=Bp(m,x);return m=Ds(m,m.next),b=Ds(b,b.next),wl(m,t,r,l,u,f),void wl(b,t,r,l,u,f)}x=x.next}m=m.next}while(m!==i)}function Wg(i,t){return i.x-t.x}function Zg(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,tt=x.x,et=x.y,dt=1/0;b=x;do E>=b.x&&b.x>=tt&&E!==b.x&&so(A<et?E:z,A,tt,et,A<et?z:E,A,b.x,b.y)&&(O=Math.abs(A-b.y)/(E-b.x),Ml(b,f)&&(O<dt||O===dt&&(b.x>x.x||b.x===x.x&&Hg(x,b)))&&(x=b,dt=O)),b=b.next;while(b!==G);return x}(i,t);if(!r)return t;var l=Bp(r,i),u=Ds(r,r.next);return Ds(l,l.next),t===r?u:t}function Hg(i,t){return Ei(i.prev,i,t.prev)<0&&Ei(t.next,i,i.next)<0}function pu(i,t,r,l,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-l)*u)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function Xg(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 so(i,t,r,l,u,f,m,x){return(u-m)*(t-x)-(i-m)*(f-x)>=0&&(i-m)*(l-x)-(r-m)*(t-x)>=0&&(r-m)*(f-x)-(u-m)*(l-x)>=0}function Kg(i,t){return i.next.i!==t.i&&i.prev.i!==t.i&&!function(r,l){var u=r;do{if(u.i!==r.i&&u.next.i!==r.i&&u.i!==l.i&&u.next.i!==l.i&&Rp(u,u.next,r,l))return!0;u=u.next}while(u!==r);return!1}(i,t)&&(Ml(i,t)&&Ml(t,i)&&function(r,l){var u=r,f=!1,m=(r.x+l.x)/2,x=(r.y+l.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)&&(Ei(i.prev,i,t.prev)||Ei(i,t.prev,t))||Dh(i,t)&&Ei(i.prev,i,i.next)>0&&Ei(t.prev,t,t.next)>0)}function Ei(i,t,r){return(t.y-i.y)*(r.x-t.x)-(t.x-i.x)*(r.y-t.y)}function Dh(i,t){return i.x===t.x&&i.y===t.y}function Rp(i,t,r,l){var u=Bh(Ei(i,t,r)),f=Bh(Ei(i,t,l)),m=Bh(Ei(r,l,i)),x=Bh(Ei(r,l,t));return u!==f&&m!==x||!(u!==0||!Rh(i,r,t))||!(f!==0||!Rh(i,l,t))||!(m!==0||!Rh(r,i,l))||!(x!==0||!Rh(r,t,l))}function Rh(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 Bh(i){return i>0?1:i<0?-1:0}function Ml(i,t){return Ei(i.prev,i,i.next)<0?Ei(i,t,i.next)>=0&&Ei(i,i.prev,t)>=0:Ei(i,t,i.prev)<0||Ei(i,i.next,t)<0}function Bp(i,t){var r=new du(i.i,i.x,i.y),l=new du(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,l.next=r,r.prev=l,f.next=l,l.prev=f,l}function Fp(i,t,r,l){var u=new du(i,t,r);return l?(u.next=l.next,u.prev=l,l.next.prev=u,l.next=u):(u.prev=u,u.next=u),u}function Sl(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 du(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 fu(i,t,r,l){for(var u=0,f=t,m=r-l;f<r;f+=l)u+=(i[m]-i[f])*(i[f+1]+i[m+1]),m=f;return u}uu.exports=Lh,uu.exports.default=Lh,Lh.deviation=function(i,t,r,l){var u=t&&t.length,f=Math.abs(fu(i,0,u?t[0]*r:i.length,r));if(u)for(var m=0,x=t.length;m<x;m++)f-=Math.abs(fu(i,t[m]*r,m<x-1?t[m+1]*r:i.length,r));var b=0;for(m=0;m<l.length;m+=3){var E=l[m]*r,A=l[m+1]*r,z=l[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)},Lh.flatten=function(i){for(var t=i[0][0].length,r={vertices:[],holes:[],dimensions:t},l=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(l+=i[u-1].length)}return r};var Op=uu.exports;function Jg(i,t,r,l,u){Np(i,t,r||0,l||i.length-1,u||Yg)}function Np(i,t,r,l,u){for(;l>r;){if(l-r>600){var f=l-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);Np(i,t,Math.max(r,Math.floor(t-m*b/f+E)),Math.min(l,Math.floor(t+(f-m)*b/f+E)),u)}var A=i[t],z=r,R=l;for(Tl(i,r,t),u(i[l],A)>0&&Tl(i,r,l);z<R;){for(Tl(i,z,R),z++,R--;u(i[z],A)<0;)z++;for(;u(i[R],A)>0;)R--}u(i[r],A)===0?Tl(i,r,R):Tl(i,++R,l),R<=t&&(r=R+1),t<=R&&(l=R-1)}}function Tl(i,t,r){var l=i[t];i[t]=i[r],i[r]=l}function Yg(i,t){return i<t?-1:i>t?1:0}function mu(i,t){let r=i.length;if(r<=1)return[i];let l=[],u,f;for(let m=0;m<r;m++){let x=me(i[m]);x!==0&&(i[m].area=Math.abs(x),f===void 0&&(f=x<0),f===x<0?(u&&l.push(u),u=[i[m]]):u.push(i[m]))}if(u&&l.push(u),t>1)for(let m=0;m<l.length;m++)l[m].length<=t||(Jg(l[m],t,1,l[m].length-1,Qg),l[m]=l[m].slice(0,t));return l}function Qg(i,t){return t.area-i.area}function gu(i,t,r){let l=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,l[x.to]=!0,l[x.from]=!0)}return u}function yu(i,t,r,l,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:l-1},r,{},u.availableImages),E=x.evaluate({zoom:l},r,{},u.availableImages),A=x.evaluate({zoom:l+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 _u{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 Oe,this.indexArray=new pr,this.indexArray2=new ln,this.programConfigurations=new pa(t.layers,t.zoom),this.segments=new $e,this.segments2=new $e,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(t,r,l){this.hasPattern=gu("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=fa(x,z);if(!this.layers[0]._featureFilter.filter(new ci(this.zoom),R,l))continue;let O=f?u.evaluate(R,{},l,r.availableImages):void 0,G={id:b,properties:x.properties,type:x.type,sourceLayerIndex:A,index:E,geometry:z?R.geometry:da(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=yu("fill",this.layers,x,this.zoom,r);this.patternFeatures.push(z)}else this.addFeature(x,b,E,l,{});r.featureIndex.insert(t[E].feature,b,E,A,this.index)}}update(t,r,l){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,l)}addFeatures(t,r,l){for(let u of this.patternFeatures)this.addFeature(u,u.geometry,u.index,r,l)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Vg),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,l,u,f){for(let m of mu(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),tt=G.vertexLength;this.layoutVertexArray.emplaceBack(O[0].x,O[0].y),this.indexArray2.emplaceBack(tt+O.length-1,tt),A.push(O[0].x),A.push(O[0].y);for(let et=1;et<O.length;et++)this.layoutVertexArray.emplaceBack(O[et].x,O[et].y),this.indexArray2.emplaceBack(tt+et-1,tt+et),A.push(O[et].x),A.push(O[et].y);G.vertexLength+=O.length,G.primitiveLength+=O.length}let R=Op(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,l,f,u)}}ie("FillBucket",_u,{omit:["layers","patternFeatures"]});let ty=new Ni({"fill-sort-key":new ye(ct.layout_fill["fill-sort-key"])});var ey={paint:new Ni({"fill-antialias":new le(ct.paint_fill["fill-antialias"]),"fill-opacity":new ye(ct.paint_fill["fill-opacity"]),"fill-color":new ye(ct.paint_fill["fill-color"]),"fill-outline-color":new ye(ct.paint_fill["fill-outline-color"]),"fill-translate":new le(ct.paint_fill["fill-translate"]),"fill-translate-anchor":new le(ct.paint_fill["fill-translate-anchor"]),"fill-pattern":new la(ct.paint_fill["fill-pattern"])}),layout:ty};let iy=Ui([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),{members:ry}=iy;var Rs={},ny=ve,Up=ao;function ao(i,t,r,l,u){this.properties={},this.extent=r,this.type=0,this._pbf=i,this._geometry=-1,this._keys=l,this._values=u,i.readFields(sy,this,t)}function sy(i,t,r){i==1?t.id=r.readVarint():i==2?function(l,u){for(var f=l.readVarint()+l.pos;l.pos<f;){var m=u._keys[l.readVarint()],x=u._values[l.readVarint()];u.properties[m]=x}}(r,t):i==3?t.type=r.readVarint():i==4&&(t._geometry=r.pos)}function ay(i){for(var t,r,l=0,u=0,f=i.length,m=f-1;u<f;m=u++)l+=((r=i[m]).x-(t=i[u]).x)*(t.y+r.y);return l}ao.types=["Unknown","Point","LineString","Polygon"],ao.prototype.loadGeometry=function(){var i=this._pbf;i.pos=this._geometry;for(var t,r=i.readVarint()+i.pos,l=1,u=0,f=0,m=0,x=[];i.pos<r;){if(u<=0){var b=i.readVarint();l=7&b,u=b>>3}if(u--,l===1||l===2)f+=i.readSVarint(),m+=i.readSVarint(),l===1&&(t&&x.push(t),t=[]),t.push(new ny(f,m));else{if(l!==7)throw new Error("unknown command "+l);t&&t.push(t[0].clone())}}return t&&x.push(t),x},ao.prototype.bbox=function(){var i=this._pbf;i.pos=this._geometry;for(var t=i.readVarint()+i.pos,r=1,l=0,u=0,f=0,m=1/0,x=-1/0,b=1/0,E=-1/0;i.pos<t;){if(l<=0){var A=i.readVarint();r=7&A,l=A>>3}if(l--,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]},ao.prototype.toGeoJSON=function(i,t,r){var l,u,f=this.extent*Math.pow(2,r),m=this.extent*i,x=this.extent*t,b=this.loadGeometry(),E=ao.types[this.type];function A(O){for(var G=0;G<O.length;G++){var tt=O[G];O[G]=[360*(tt.x+m)/f-180,360/Math.PI*Math.atan(Math.exp((180-360*(tt.y+x)/f)*Math.PI/180))-90]}}switch(this.type){case 1:var z=[];for(l=0;l<b.length;l++)z[l]=b[l][0];A(b=z);break;case 2:for(l=0;l<b.length;l++)A(b[l]);break;case 3:for(b=function(O){var G=O.length;if(G<=1)return[O];for(var tt,et,dt=[],bt=0;bt<G;bt++){var xt=ay(O[bt]);xt!==0&&(et===void 0&&(et=xt<0),et===xt<0?(tt&&dt.push(tt),tt=[O[bt]]):tt.push(O[bt]))}return tt&&dt.push(tt),dt}(b),l=0;l<b.length;l++)for(u=0;u<b[l].length;u++)A(b[l][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 oy=Up,Vp=Gp;function Gp(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(ly,this,t),this.length=this._features.length}function ly(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(l){for(var u=null,f=l.readVarint()+l.pos;l.pos<f;){var m=l.readVarint()>>3;u=m===1?l.readString():m===2?l.readFloat():m===3?l.readDouble():m===4?l.readVarint64():m===5?l.readVarint():m===6?l.readSVarint():m===7?l.readBoolean():null}return u}(r))}Gp.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 oy(this._pbf,t,this.extent,this._keys,this._values)};var hy=Vp;function cy(i,t,r){if(i===3){var l=new hy(r,r.readVarint()+r.pos);l.length&&(t[l.name]=l)}}Rs.VectorTile=function(i,t){this.layers=i.readFields(cy,{},t)},Rs.VectorTileFeature=Up,Rs.VectorTileLayer=Vp;let uy=Rs.VectorTileFeature.types,xu=Math.pow(2,13);function El(i,t,r,l,u,f,m,x){i.emplaceBack(t,r,2*Math.floor(l*xu)+m,u*xu*2,f*xu*2,Math.round(x))}class vu{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 xi,this.indexArray=new pr,this.programConfigurations=new pa(t.layers,t.zoom),this.segments=new $e,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(t,r,l){this.features=[],this.hasPattern=gu("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=fa(u,b);if(!this.layers[0]._featureFilter.filter(new ci(this.zoom),E,l))continue;let A={id:f,sourceLayerIndex:x,index:m,geometry:b?E.geometry:da(u),properties:u.properties,type:u.type,patterns:{}};this.hasPattern?this.features.push(yu("fill-extrusion",this.layers,A,this.zoom,r)):this.addFeature(A,A.geometry,m,l,{}),r.featureIndex.insert(u,A.geometry,m,x,this.index,!0)}}addFeatures(t,r,l){for(let u of this.features){let{geometry:f}=u;this.addFeature(u,f,u.index,r,l)}}update(t,r,l){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,l)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,ry),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,l,u,f){for(let m of mu(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||dy(O))continue;let G=0;for(let tt=0;tt<O.length;tt++){let et=O[tt];if(tt>=1){let dt=O[tt-1];if(!py(et,dt)){b.vertexLength+4>$e.MAX_VERTEX_ARRAY_LENGTH&&(b=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));let bt=et.sub(dt)._perp()._unit(),xt=dt.dist(et);G+xt>32768&&(G=0),El(this.layoutVertexArray,et.x,et.y,bt.x,bt.y,0,0,G),El(this.layoutVertexArray,et.x,et.y,bt.x,bt.y,0,1,G),G+=xt,El(this.layoutVertexArray,dt.x,dt.y,bt.x,bt.y,0,0,G),El(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>$e.MAX_VERTEX_ARRAY_LENGTH&&(b=this.segments.prepareSegment(x,this.layoutVertexArray,this.indexArray)),uy[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 tt=O[G];El(this.layoutVertexArray,tt.x,tt.y,0,0,1,1,0),E.push(tt.x),E.push(tt.y)}}let R=Op(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,l,f,u)}}function py(i,t){return i.x===t.x&&(i.x<0||i.x>Vi)||i.y===t.y&&(i.y<0||i.y>Vi)}function dy(i){return i.every(t=>t.x<0)||i.every(t=>t.x>Vi)||i.every(t=>t.y<0)||i.every(t=>t.y>Vi)}ie("FillExtrusionBucket",vu,{omit:["layers","features"]});var fy={paint:new Ni({"fill-extrusion-opacity":new le(ct["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new ye(ct["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new le(ct["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new le(ct["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new la(ct["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new ye(ct["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new ye(ct["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new le(ct["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})};function Il(i,t){return i.x*t.x+i.y*t.y}function qp(i,t){if(i.length===1){let r=0,l=t[r++],u;for(;!u||l.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(l),b=f.sub(l),E=m.sub(l),A=Il(x,x),z=Il(x,b),R=Il(b,b),O=Il(E,x),G=Il(E,b),tt=A*R-z*z,et=(R*O-z*G)/tt,dt=(A*G-z*O)/tt,bt=l.z*(1-et-dt)+u.z*et+f.z*dt;if(isFinite(bt))return bt}return 1/0}{let r=1/0;for(let l of t)r=Math.min(r,l.z);return r}}let my=Ui([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:gy}=my,yy=Ui([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:_y}=yy,xy=Rs.VectorTileFeature.types,vy=Math.cos(Math.PI/180*37.5),jp=Math.pow(2,14)/.5;class bu{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 Me,this.layoutVertexArray2=new je,this.indexArray=new pr,this.programConfigurations=new pa(t.layers,t.zoom),this.segments=new $e,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(t,r,l){this.hasPattern=gu("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=fa(x,z);if(!this.layers[0]._featureFilter.filter(new ci(this.zoom),R,l))continue;let O=f?u.evaluate(R,{},l):void 0,G={id:b,properties:x.properties,type:x.type,sourceLayerIndex:A,index:E,geometry:z?R.geometry:da(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=yu("line",this.layers,x,this.zoom,r);this.patternFeatures.push(z)}else this.addFeature(x,b,E,l,{});r.featureIndex.insert(t[E].feature,b,E,A,this.index)}}update(t,r,l){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,l)}addFeatures(t,r,l){for(let u of this.patternFeatures)this.addFeature(u,u.geometry,u.index,r,l)}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,_y)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,gy),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,l,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,l,f,u)}addLine(t,r,l,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=xy[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;l==="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,tt,et;this.e1=this.e2=-1,x&&(R=t[b-2],et=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;et&&(tt=et),R&&(O=R),R=t[dt],et=G?G.sub(R)._unit()._perp():tt,tt=tt||et;let bt=tt.add(et);bt.x===0&&bt.y===0||bt._unit();let xt=tt.x*et.x+tt.y*et.y,Et=bt.x*et.x+bt.y*et.y,Ot=Et!==0?1/Et:1/0,Lt=2*Math.sqrt(2-2*Et),re=Et<vy&&O&&G,ue=tt.x*et.y-tt.y*et.x>0;if(re&&dt>E){let Zt=R.dist(O);if(Zt>2*A){let ee=R.sub(R.sub(O)._mult(A/Zt)._round());this.updateDistance(O,ee),this.addCurrentVertex(ee,tt,0,0,z),O=ee}}let Jt=O&&G,Yt=Jt?l:x?"butt":u;if(Jt&&Yt==="round"&&(Ot<m?Yt="miter":Ot<=2&&(Yt="fakeround")),Yt==="miter"&&Ot>f&&(Yt="bevel"),Yt==="bevel"&&(Ot>2&&(Yt="flipbevel"),Ot<f&&(Yt="miter")),O&&this.updateDistance(O,R),Yt==="miter")bt._mult(Ot),this.addCurrentVertex(R,bt,0,0,z);else if(Yt==="flipbevel"){if(Ot>100)bt=et.mult(-1);else{let Zt=Ot*tt.add(et).mag()/tt.sub(et).mag();bt._perp()._mult(Zt*(ue?-1:1))}this.addCurrentVertex(R,bt,0,0,z),this.addCurrentVertex(R,bt.mult(-1),0,0,z)}else if(Yt==="bevel"||Yt==="fakeround"){let Zt=-Math.sqrt(Ot*Ot-1),ee=ue?Zt:0,Qt=ue?0:Zt;if(O&&this.addCurrentVertex(R,tt,ee,Qt,z),Yt==="fakeround"){let qt=Math.round(180*Lt/Math.PI/20);for(let _e=1;_e<qt;_e++){let de=_e/qt;if(de!==.5){let Je=de-.5;de+=de*Je*(de-1)*((1.0904+xt*(xt*(3.55645-1.43519*xt)-3.2452))*Je*Je+(.848013+xt*(.215638*xt-1.06021)))}let Ne=et.sub(tt)._mult(de)._add(tt)._unit()._mult(ue?-1:1);this.addHalfVertex(R,Ne.x,Ne.y,!1,ue,0,z)}}G&&this.addCurrentVertex(R,et,-ee,-Qt,z)}else if(Yt==="butt")this.addCurrentVertex(R,bt,0,0,z);else if(Yt==="square"){let Zt=O?1:-1;this.addCurrentVertex(R,bt,Zt,Zt,z)}else Yt==="round"&&(O&&(this.addCurrentVertex(R,tt,0,0,z),this.addCurrentVertex(R,tt,1,1,z,!0)),G&&(this.addCurrentVertex(R,et,-1,-1,z,!0),this.addCurrentVertex(R,et,0,0,z)));if(re&&dt<b-1){let Zt=R.dist(G);if(Zt>2*A){let ee=R.add(G.sub(R)._mult(A/Zt)._round());this.updateDistance(R,ee),this.addCurrentVertex(ee,et,0,0,z),R=ee}}}}addCurrentVertex(t,r,l,u,f,m=!1){let x=r.y*u-r.x,b=-r.y-r.x*u;this.addHalfVertex(t,r.x+r.y*l,r.y-r.x*l,m,!1,l,f),this.addHalfVertex(t,x,b,m,!0,-u,f),this.distance>jp/2&&this.totalDistance===0&&(this.distance=0,this.addCurrentVertex(t,r,l,u,f,m))}addHalfVertex({x:t,y:r},l,u,f,m,x,b){let E=.5*(this.lineClips?this.scaledDistance*(jp-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((t<<1)+(f?1:0),(r<<1)+(m?1:0),Math.round(63*l)+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()}}ie("LineBucket",bu,{omit:["layers","patternFeatures"]});let by=new Ni({"line-cap":new le(ct.layout_line["line-cap"]),"line-join":new ye(ct.layout_line["line-join"]),"line-miter-limit":new le(ct.layout_line["line-miter-limit"]),"line-round-limit":new le(ct.layout_line["line-round-limit"]),"line-sort-key":new ye(ct.layout_line["line-sort-key"])});var $p={paint:new Ni({"line-opacity":new ye(ct.paint_line["line-opacity"]),"line-color":new ye(ct.paint_line["line-color"]),"line-translate":new le(ct.paint_line["line-translate"]),"line-translate-anchor":new le(ct.paint_line["line-translate-anchor"]),"line-width":new ye(ct.paint_line["line-width"]),"line-gap-width":new ye(ct.paint_line["line-gap-width"]),"line-offset":new ye(ct.paint_line["line-offset"]),"line-blur":new ye(ct.paint_line["line-blur"]),"line-dasharray":new ha(ct.paint_line["line-dasharray"]),"line-pattern":new la(ct.paint_line["line-pattern"]),"line-gradient":new gl(ct.paint_line["line-gradient"])}),layout:by};let Wp=new class extends ye{possiblyEvaluate(i,t){return t=new ci(Math.floor(t.zoom),{now:t.now,fadeDuration:t.fadeDuration,zoomHistory:t.zoomHistory,transition:t.transition}),super.possiblyEvaluate(i,t)}evaluate(i,t,r,l){return t=pt({},t,{zoom:Math.floor(t.zoom)}),super.evaluate(i,t,r,l)}}($p.paint.properties["line-width"].specification);function Zp(i,t){return t>0?t+2*i:i}Wp.useIntegerZoom=!0;let wy=Ui([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),My=Ui([{name:"a_projected_pos",components:3,type:"Float32"}],4);Ui([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);let Sy=Ui([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]);Ui([{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 Hp=Ui([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),Ty=Ui([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function Ey(i,t,r){return i.sections.forEach(l=>{l.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()),Fr.applyArabicShaping&&(u=Fr.applyArabicShaping(u)),u}(l.text,t,r)}),i}Ui([{name:"triangle",components:3,type:"Uint16"}]),Ui([{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"}]),Ui([{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"}]),Ui([{type:"Float32",name:"offsetX"}]),Ui([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]);let Cl={"!":"\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 Xi=24,wu=ri,Xp=function(i,t,r,l,u){var f,m,x=8*u-l-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+=l;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,l),f-=E}return(O?-1:1)*m*Math.pow(2,f-l)},Kp=function(i,t,r,l,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=l?0:f-1,G=l?1:-1,tt=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*tt};function ri(i){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(i)?i:new Uint8Array(i||0),this.pos=0,this.type=0,this.length=this.buf.length}ri.Varint=0,ri.Fixed64=1,ri.Bytes=2,ri.Fixed32=5;var Bs,Mu=4294967296,Jp=1/Mu,Yp=typeof TextDecoder>"u"?null:new TextDecoder("utf8");function Jn(i){return i.type===ri.Bytes?i.readVarint()+i.pos:i.pos+1}function oo(i,t,r){return r?4294967296*t+(i>>>0):4294967296*(t>>>0)+(i>>>0)}function Qp(i,t,r){var l=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(7*Math.LN2));r.realloc(l);for(var u=r.pos-1;u>=i;u--)r.buf[u+l]=r.buf[u]}function Iy(i,t){for(var r=0;r<i.length;r++)t.writeVarint(i[r])}function Cy(i,t){for(var r=0;r<i.length;r++)t.writeSVarint(i[r])}function Ay(i,t){for(var r=0;r<i.length;r++)t.writeFloat(i[r])}function Py(i,t){for(var r=0;r<i.length;r++)t.writeDouble(i[r])}function zy(i,t){for(var r=0;r<i.length;r++)t.writeBoolean(i[r])}function ky(i,t){for(var r=0;r<i.length;r++)t.writeFixed32(i[r])}function Ly(i,t){for(var r=0;r<i.length;r++)t.writeSFixed32(i[r])}function Dy(i,t){for(var r=0;r<i.length;r++)t.writeFixed64(i[r])}function Ry(i,t){for(var r=0;r<i.length;r++)t.writeSFixed64(i[r])}function Fh(i,t){return(i[t]|i[t+1]<<8|i[t+2]<<16)+16777216*i[t+3]}function lo(i,t,r){i[r]=t,i[r+1]=t>>>8,i[r+2]=t>>>16,i[r+3]=t>>>24}function td(i,t){return(i[t]|i[t+1]<<8|i[t+2]<<16)+(i[t+3]<<24)}function By(i,t,r){i===1&&r.readMessage(Fy,t)}function Fy(i,t,r){if(i===3){let{id:l,bitmap:u,width:f,height:m,left:x,top:b,advance:E}=r.readMessage(Oy,{});t.push({id:l,bitmap:new bl({width:f+6,height:m+6},u),metrics:{width:f,height:m,left:x,top:b,advance:E}})}}function Oy(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 ed(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 l=[{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=l.length-1;x>=0;x--){let b=l[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=l.pop();x<l.length&&(l[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):(l.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}}ri.prototype={destroy:function(){this.buf=null},readFields:function(i,t,r){for(r=r||this.length;this.pos<r;){var l=this.readVarint(),u=l>>3,f=this.pos;this.type=7&l,i(u,t,this),this.pos===f&&this.skip(l)}return t},readMessage:function(i,t){return this.readFields(i,t,this.readVarint()+this.pos)},readFixed32:function(){var i=Fh(this.buf,this.pos);return this.pos+=4,i},readSFixed32:function(){var i=td(this.buf,this.pos);return this.pos+=4,i},readFixed64:function(){var i=Fh(this.buf,this.pos)+Fh(this.buf,this.pos+4)*Mu;return this.pos+=8,i},readSFixed64:function(){var i=Fh(this.buf,this.pos)+td(this.buf,this.pos+4)*Mu;return this.pos+=8,i},readFloat:function(){var i=Xp(this.buf,this.pos,!0,23,4);return this.pos+=4,i},readDouble:function(){var i=Xp(this.buf,this.pos,!0,52,8);return this.pos+=8,i},readVarint:function(i){var t,r,l=this.buf;return t=127&(r=l[this.pos++]),r<128?t:(t|=(127&(r=l[this.pos++]))<<7,r<128?t:(t|=(127&(r=l[this.pos++]))<<14,r<128?t:(t|=(127&(r=l[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 oo(u,x,f);throw new Error("Expected varint not more than 10 bytes")}(t|=(15&(r=l[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&&Yp?function(r,l,u){return Yp.decode(r.subarray(l,u))}(this.buf,t,i):function(r,l,u){for(var f="",m=l;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!==ri.Bytes)return i.push(this.readVarint(t));var r=Jn(this);for(i=i||[];this.pos<r;)i.push(this.readVarint(t));return i},readPackedSVarint:function(i){if(this.type!==ri.Bytes)return i.push(this.readSVarint());var t=Jn(this);for(i=i||[];this.pos<t;)i.push(this.readSVarint());return i},readPackedBoolean:function(i){if(this.type!==ri.Bytes)return i.push(this.readBoolean());var t=Jn(this);for(i=i||[];this.pos<t;)i.push(this.readBoolean());return i},readPackedFloat:function(i){if(this.type!==ri.Bytes)return i.push(this.readFloat());var t=Jn(this);for(i=i||[];this.pos<t;)i.push(this.readFloat());return i},readPackedDouble:function(i){if(this.type!==ri.Bytes)return i.push(this.readDouble());var t=Jn(this);for(i=i||[];this.pos<t;)i.push(this.readDouble());return i},readPackedFixed32:function(i){if(this.type!==ri.Bytes)return i.push(this.readFixed32());var t=Jn(this);for(i=i||[];this.pos<t;)i.push(this.readFixed32());return i},readPackedSFixed32:function(i){if(this.type!==ri.Bytes)return i.push(this.readSFixed32());var t=Jn(this);for(i=i||[];this.pos<t;)i.push(this.readSFixed32());return i},readPackedFixed64:function(i){if(this.type!==ri.Bytes)return i.push(this.readFixed64());var t=Jn(this);for(i=i||[];this.pos<t;)i.push(this.readFixed64());return i},readPackedSFixed64:function(i){if(this.type!==ri.Bytes)return i.push(this.readSFixed64());var t=Jn(this);for(i=i||[];this.pos<t;)i.push(this.readSFixed64());return i},skip:function(i){var t=7&i;if(t===ri.Varint)for(;this.buf[this.pos++]>127;);else if(t===ri.Bytes)this.pos=this.readVarint()+this.pos;else if(t===ri.Fixed32)this.pos+=4;else{if(t!==ri.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),lo(this.buf,i,this.pos),this.pos+=4},writeSFixed32:function(i){this.realloc(4),lo(this.buf,i,this.pos),this.pos+=4},writeFixed64:function(i){this.realloc(8),lo(this.buf,-1&i,this.pos),lo(this.buf,Math.floor(i*Jp),this.pos+4),this.pos+=8},writeSFixed64:function(i){this.realloc(8),lo(this.buf,-1&i,this.pos),lo(this.buf,Math.floor(i*Jp),this.pos+4),this.pos+=8},writeVarint:function(i){(i=+i||0)>268435455||i<0?function(t,r){var l,u;if(t>=0?(l=t%4294967296|0,u=t/4294967296|0):(u=~(-t/4294967296),4294967295^(l=~(-t%4294967296))?l=l+1|0:(l=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)}(l,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(l,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?(l[f++]=239,l[f++]=191,l[f++]=189):x=m;continue}if(m<56320){l[f++]=239,l[f++]=191,l[f++]=189,x=m;continue}m=x-55296<<10|m-56320|65536,x=null}else x&&(l[f++]=239,l[f++]=191,l[f++]=189,x=null);m<128?l[f++]=m:(m<2048?l[f++]=m>>6|192:(m<65536?l[f++]=m>>12|224:(l[f++]=m>>18|240,l[f++]=m>>12&63|128),l[f++]=m>>6&63|128),l[f++]=63&m|128)}return f}(this.buf,i,this.pos);var r=this.pos-t;r>=128&&Qp(t,r,this),this.pos=t-1,this.writeVarint(r),this.pos+=r},writeFloat:function(i){this.realloc(4),Kp(this.buf,i,this.pos,!0,23,4),this.pos+=4},writeDouble:function(i){this.realloc(8),Kp(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 l=this.pos-r;l>=128&&Qp(r,l,this),this.pos=r-1,this.writeVarint(l),this.pos+=l},writeMessage:function(i,t,r){this.writeTag(i,ri.Bytes),this.writeRawMessage(t,r)},writePackedVarint:function(i,t){t.length&&this.writeMessage(i,Iy,t)},writePackedSVarint:function(i,t){t.length&&this.writeMessage(i,Cy,t)},writePackedBoolean:function(i,t){t.length&&this.writeMessage(i,zy,t)},writePackedFloat:function(i,t){t.length&&this.writeMessage(i,Ay,t)},writePackedDouble:function(i,t){t.length&&this.writeMessage(i,Py,t)},writePackedFixed32:function(i,t){t.length&&this.writeMessage(i,ky,t)},writePackedSFixed32:function(i,t){t.length&&this.writeMessage(i,Ly,t)},writePackedFixed64:function(i,t){t.length&&this.writeMessage(i,Dy,t)},writePackedSFixed64:function(i,t){t.length&&this.writeMessage(i,Ry,t)},writeBytesField:function(i,t){this.writeTag(i,ri.Bytes),this.writeBytes(t)},writeFixed32Field:function(i,t){this.writeTag(i,ri.Fixed32),this.writeFixed32(t)},writeSFixed32Field:function(i,t){this.writeTag(i,ri.Fixed32),this.writeSFixed32(t)},writeFixed64Field:function(i,t){this.writeTag(i,ri.Fixed64),this.writeFixed64(t)},writeSFixed64Field:function(i,t){this.writeTag(i,ri.Fixed64),this.writeSFixed64(t)},writeVarintField:function(i,t){this.writeTag(i,ri.Varint),this.writeVarint(t)},writeSVarintField:function(i,t){this.writeTag(i,ri.Varint),this.writeSVarint(t)},writeStringField:function(i,t){this.writeTag(i,ri.Bytes),this.writeString(t)},writeFloatField:function(i,t){this.writeTag(i,ri.Fixed32),this.writeFloat(t)},writeDoubleField:function(i,t){this.writeTag(i,ri.Fixed64),this.writeDouble(t)},writeBooleanField:function(i,t){this.writeVarintField(i,Boolean(t))}};class Su{constructor(t,{pixelRatio:r,version:l,stretchX:u,stretchY:f,content:m}){this.paddedRect=t,this.pixelRatio=r,this.stretchX=u,this.stretchY=f,this.content=m,this.version=l}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 id{constructor(t,r){let l={},u={};this.haveRenderCallbacks=[];let f=[];this.addImages(t,l,f),this.addImages(r,u,f);let{w:m,h:x}=ed(f),b=new Jr({width:m||1,height:x||1});for(let E in t){let A=t[E],z=l[E].paddedRect;Jr.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,tt=A.data.height;Jr.copy(A.data,b,{x:0,y:0},{x:R,y:O},A.data),Jr.copy(A.data,b,{x:0,y:tt-1},{x:R,y:O-1},{width:G,height:1}),Jr.copy(A.data,b,{x:0,y:0},{x:R,y:O+tt},{width:G,height:1}),Jr.copy(A.data,b,{x:G-1,y:0},{x:R-1,y:O},{width:1,height:tt}),Jr.copy(A.data,b,{x:0,y:0},{x:R+G,y:O},{width:1,height:tt})}this.image=b,this.iconPositions=l,this.patternPositions=u}addImages(t,r,l){for(let u in t){let f=t[u],m={x:0,y:0,w:f.data.width+2,h:f.data.height+2};l.push(m),r[u]=new Su(m,f),f.hasRenderCallback&&this.haveRenderCallbacks.push(u)}}patchUpdatedImages(t,r){t.dispatchRenderCallbacks(this.haveRenderCallbacks);for(let l in t.updatedImages)this.patchUpdatedImage(this.iconPositions[l],t.getImage(l),r),this.patchUpdatedImage(this.patternPositions[l],t.getImage(l),r)}patchUpdatedImage(t,r,l){if(!t||!r||t.version===r.version)return;t.version=r.version;let[u,f]=t.tl;l.update(r.data,void 0,{x:u,y:f})}}ie("ImagePosition",Su),ie("ImageAtlas",id),a.WritingMode=void 0,(Bs=a.WritingMode||(a.WritingMode={}))[Bs.none=0]="none",Bs[Bs.horizontal=1]="horizontal",Bs[Bs.vertical=2]="vertical",Bs[Bs.horizontalOnly=3]="horizontalOnly";let Oh=-17;class Al{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(t,r){let l=new Al;return l.scale=t||1,l.fontStack=r,l}static forImage(t){let r=new Al;return r.imageName=t,r}}class ho{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(t,r){let l=new ho;for(let u=0;u<t.sections.length;u++){let f=t.sections[u];f.image?l.addImageSection(f):l.addTextSection(f,r)}return l}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 l=0;l<t.length;l++){let u=t.charCodeAt(l+1)||null,f=t.charCodeAt(l-1)||null;r+=u&&wh(u)&&!Cl[t[l+1]]||f&&wh(f)&&!Cl[t[l-1]]||!Cl[t[l]]?t[l]:Cl[t[l]]}return r}(this.text)}trim(){let t=0;for(let l=0;l<this.text.length&&Uh[this.text.charCodeAt(l)];l++)t++;let r=this.text.length;for(let l=this.text.length-1;l>=0&&l>=t&&Uh[this.text.charCodeAt(l)];l--)r--;this.text=this.text.substring(t,r),this.sectionIndex=this.sectionIndex.slice(t,r)}substring(t,r){let l=new ho;return l.text=this.text.substring(t,r),l.sectionIndex=this.sectionIndex.slice(t,r),l.sections=this.sections,l}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(Al.forText(t.scale,t.fontStack||r));let l=this.sections.length-1;for(let u=0;u<t.text.length;++u)this.sectionIndex.push(l)}addImageSection(t){let r=t.image?t.image.name:"";if(r.length===0)return void Ht("Can't add FormattedSection with an empty image.");let l=this.getNextImageSectionCharCode();l?(this.text+=String.fromCharCode(l),this.sections.push(Al.forImage(r)),this.sectionIndex.push(this.sections.length-1)):Ht("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function Nh(i,t,r,l,u,f,m,x,b,E,A,z,R,O,G,tt){let et=ho.fromFeature(i,u),dt;z===a.WritingMode.vertical&&et.verticalizePunctuation();let{processBidirectionalText:bt,processStyledBidirectionalText:xt}=Fr;if(bt&&et.sections.length===1){dt=[];let Lt=bt(et.toString(),Tu(et,E,f,t,l,O,G));for(let re of Lt){let ue=new ho;ue.text=re,ue.sections=et.sections;for(let Jt=0;Jt<re.length;Jt++)ue.sectionIndex.push(0);dt.push(ue)}}else if(xt){dt=[];let Lt=xt(et.text,et.sectionIndex,Tu(et,E,f,t,l,O,G));for(let re of Lt){let ue=new ho;ue.text=re[0],ue.sectionIndex=re[1],ue.sections=et.sections,dt.push(ue)}}else dt=function(Lt,re){let ue=[],Jt=Lt.text,Yt=0;for(let Zt of re)ue.push(Lt.substring(Yt,Zt)),Yt=Zt;return Yt<Jt.length&&ue.push(Lt.substring(Yt,Jt.length)),ue}(et,Tu(et,E,f,t,l,O,G));let Et=[],Ot={positionedLines:Et,text:et.toString(),top:A[1],bottom:A[1],left:A[0],right:A[0],writingMode:z,iconsInText:!1,verticalizable:!1};return function(Lt,re,ue,Jt,Yt,Zt,ee,Qt,qt,_e,de,Ne){let Je=0,pi=Oh,di=0,Qi=0,Li=Qt==="right"?1:Qt==="left"?0:.5,Di=0;for(let Ri of Yt){Ri.trim();let er=Ri.getMaxScale(),or=(er-1)*Xi,dr={positionedGlyphs:[],lineOffset:0};Lt.positionedLines[Di]=dr;let Sr=dr.positionedGlyphs,Tr=0;if(!Ri.length()){pi+=Zt,++Di;continue}for(let $i=0;$i<Ri.length();$i++){let Be=Ri.getSection($i),Ur=Ri.getSectionIndex($i),ir=Ri.getCharCode($i),lr=0,pn=null,xn=null,vn=null,Qn=Xi,dn=!(qt===a.WritingMode.horizontal||!de&&!oa(ir)||de&&(Uh[ir]||(ji=ir,Xt.Arabic(ji)||Xt["Arabic Supplement"](ji)||Xt["Arabic Extended-A"](ji)||Xt["Arabic Presentation Forms-A"](ji)||Xt["Arabic Presentation Forms-B"](ji))));if(Be.imageName){let Yr=Jt[Be.imageName];if(!Yr)continue;vn=Be.imageName,Lt.iconsInText=Lt.iconsInText||!0,xn=Yr.paddedRect;let Er=Yr.displaySize;Be.scale=Be.scale*Xi/Ne,pn={width:Er[0],height:Er[1],left:1,top:-3,advance:dn?Er[1]:Er[0]},lr=or+(Xi-Er[1]*Be.scale),Qn=pn.advance;let ts=dn?Er[0]*Be.scale-Xi*er:Er[1]*Be.scale-Xi*er;ts>0&&ts>Tr&&(Tr=ts)}else{let Yr=ue[Be.fontStack],Er=Yr&&Yr[ir];if(Er&&Er.rect)xn=Er.rect,pn=Er.metrics;else{let ts=re[Be.fontStack],kl=ts&&ts[ir];if(!kl)continue;pn=kl.metrics}lr=(er-Be.scale)*Xi}dn?(Lt.verticalizable=!0,Sr.push({glyph:ir,imageName:vn,x:Je,y:pi+lr,vertical:dn,scale:Be.scale,fontStack:Be.fontStack,sectionIndex:Ur,metrics:pn,rect:xn}),Je+=Qn*Be.scale+_e):(Sr.push({glyph:ir,imageName:vn,x:Je,y:pi+lr,vertical:dn,scale:Be.scale,fontStack:Be.fontStack,sectionIndex:Ur,metrics:pn,rect:xn}),Je+=pn.advance*Be.scale+_e)}Sr.length!==0&&(di=Math.max(Je-_e,di),Vy(Sr,0,Sr.length-1,Li,Tr)),Je=0;let gi=Zt*er+Tr;dr.lineOffset=Math.max(Tr,or),pi+=gi,Qi=Math.max(gi,Qi),++Di}var ji;let tr=pi-Oh,{horizontalAlign:ar,verticalAlign:Mr}=Eu(ee);(function(Ri,er,or,dr,Sr,Tr,gi,$i,Be){let Ur=(er-or)*Sr,ir=0;ir=Tr!==gi?-$i*dr-Oh:(-dr*Be+.5)*gi;for(let lr of Ri)for(let pn of lr.positionedGlyphs)pn.x+=Ur,pn.y+=ir})(Lt.positionedLines,Li,ar,Mr,di,Qi,Zt,tr,Yt.length),Lt.top+=-Mr*tr,Lt.bottom=Lt.top+tr,Lt.left+=-ar*di,Lt.right=Lt.left+di}(Ot,t,r,l,dt,m,x,b,z,E,R,tt),!function(Lt){for(let re of Lt)if(re.positionedGlyphs.length!==0)return!1;return!0}(Et)&&Ot}let Uh={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Ny={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 rd(i,t,r,l,u,f){if(t.imageName){let m=l[t.imageName];return m?m.displaySize[0]*t.scale*Xi/f+u:0}{let m=r[t.fontStack],x=m&&m[i];return x?x.metrics.advance*t.scale+u:0}}function nd(i,t,r,l){let u=Math.pow(i-t,2);return l?i<t?u/2:2*u:u+Math.abs(r)*r}function Uy(i,t,r){let l=0;return i===10&&(l-=1e4),r&&(l+=150),i!==40&&i!==65288||(l+=50),t!==41&&t!==65289||(l+=50),l}function sd(i,t,r,l,u,f){let m=null,x=nd(t,r,u,f);for(let b of l){let E=nd(t-b.x,r,u,f)+b.badness;E<=x&&(m=b,x=E)}return{index:i,x:t,priorBreak:m,badness:x}}function ad(i){return i?ad(i.priorBreak).concat(i.index):[]}function Tu(i,t,r,l,u,f,m){if(f!=="point")return[];if(!i)return[];let x=[],b=function(R,O,G,tt,et,dt){let bt=0;for(let xt=0;xt<R.length();xt++){let Et=R.getSection(xt);bt+=rd(R.getCharCode(xt),Et,tt,et,O,dt)}return bt/Math.max(1,Math.ceil(bt/G))}(i,t,r,l,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(Uh[G]||(A+=rd(G,O,l,u,t,m)),R<i.length()-1){let tt=!((z=G)<11904||!(Xt["Bopomofo Extended"](z)||Xt.Bopomofo(z)||Xt["CJK Compatibility Forms"](z)||Xt["CJK Compatibility Ideographs"](z)||Xt["CJK Compatibility"](z)||Xt["CJK Radicals Supplement"](z)||Xt["CJK Strokes"](z)||Xt["CJK Symbols and Punctuation"](z)||Xt["CJK Unified Ideographs Extension A"](z)||Xt["CJK Unified Ideographs"](z)||Xt["Enclosed CJK Letters and Months"](z)||Xt["Halfwidth and Fullwidth Forms"](z)||Xt.Hiragana(z)||Xt["Ideographic Description Characters"](z)||Xt["Kangxi Radicals"](z)||Xt["Katakana Phonetic Extensions"](z)||Xt.Katakana(z)||Xt["Vertical Forms"](z)||Xt["Yi Radicals"](z)||Xt["Yi Syllables"](z)));(Ny[G]||tt||O.imageName)&&x.push(sd(R+1,A,b,x,Uy(G,i.getCharCode(R+1),tt&&E),!1))}}var z;return ad(sd(i.length(),A,b,x,0,!0))}function Eu(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 Vy(i,t,r,l,u){if(!l&&!u)return;let f=i[r],m=(i[r].x+f.metrics.advance*f.scale)*l;for(let x=t;x<=r;x++)i[x].x-=m,i[x].y+=u}function Gy(i,t,r){let{horizontalAlign:l,verticalAlign:u}=Eu(r),f=t[0]-i.displaySize[0]*l,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 od(i,t,r,l,u,f){let m=i.image,x;if(m.content){let et=m.content,dt=m.pixelRatio||1;x=[et[0]/dt,et[1]/dt,m.displaySize[0]-et[2]/dt,m.displaySize[1]-et[3]/dt]}let b=t.left*f,E=t.right*f,A,z,R,O;r==="width"||r==="both"?(O=u[0]+b-l[3],z=u[0]+E+l[1]):(O=u[0]+(b+E-m.displaySize[0])/2,z=O+m.displaySize[0]);let G=t.top*f,tt=t.bottom*f;return r==="height"||r==="both"?(A=u[1]+G-l[0],R=u[1]+tt+l[2]):(A=u[1]+(G+tt-m.displaySize[1])/2,R=A+m.displaySize[1]),{image:m,top:A,right:z,bottom:R,left:O,collisionPadding:x}}let Yn=128;function ld(i,t){let{expression:r}=t;if(r.kind==="constant")return{kind:"constant",layoutSize:r.evaluate(new ci(i+1))};if(r.kind==="source")return{kind:"source"};{let{zoomStops:l,interpolationType:u}=r,f=0;for(;f<l.length&&l[f]<=i;)f++;f=Math.max(0,f-1);let m=f;for(;m<l.length&&l[m]<i+1;)m++;m=Math.min(l.length-1,m);let x=l[f],b=l[m];return r.kind==="composite"?{kind:"composite",minZoom:x,maxZoom:b,interpolationType:u}:{kind:"camera",minZoom:x,maxZoom:b,minSize:r.evaluate(new ci(x)),maxSize:r.evaluate(new ci(b)),interpolationType:u}}}class Fs extends ve{constructor(t,r,l,u){super(t,r),this.angle=l,u!==void 0&&(this.segment=u)}clone(){return new Fs(this.x,this.y,this.angle,this.segment)}}function hd(i,t,r,l,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>l;)E-=b.shift().angleDelta;if(E>u)return!1;m++,x+=A.dist(z)}return!0}function cd(i){let t=0;for(let r=0;r<i.length-1;r++)t+=i[r].dist(i[r+1]);return t}function ud(i,t,r){return i?.6*t*r:0}function pd(i,t){return Math.max(i?i.right-i.left:0,t?t.right-t.left:0)}function qy(i,t,r,l,u,f){let m=ud(r,u,f),x=pd(r,l)*f,b=0,E=cd(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,tt=zi(z.x,R.x,G),et=zi(z.y,R.y,G),dt=new Fs(tt,et,R.angleTo(z),A);return dt._round(),!m||hd(i,dt,x,m,t)?dt:void 0}b+=O}}function jy(i,t,r,l,u,f,m,x,b){let E=ud(l,f,m),A=pd(l,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),dd(i,R?t/2*x%t:(A/2+2*f)*m*x%t,t,E,r,z,R,!1,b)}function dd(i,t,r,l,u,f,m,x,b){let E=f/2,A=cd(i),z=0,R=t-r,O=[];for(let G=0;G<i.length-1;G++){let tt=i[G],et=i[G+1],dt=tt.dist(et),bt=et.angleTo(tt);for(;R+r<z+dt;){R+=r;let xt=(R-z)/dt,Et=zi(tt.x,et.x,xt),Ot=zi(tt.y,et.y,xt);if(Et>=0&&Et<b&&Ot>=0&&Ot<b&&R-E>=0&&R+E<=A){let Lt=new Fs(Et,Ot,bt,G);Lt._round(),l&&!hd(i,Lt,f,l,u)||O.push(Lt)}}z+=dt}return x||O.length||m||(O=dd(i,z/2,r,l,u,f,m,!0,b)),O}function fd(i,t,r,l,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 ve(t,A.y+(t-A.x)/(z.x-A.x)*(z.y-A.y))._round():z.x<t&&(z=new ve(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 ve(A.x+(r-A.y)/(z.y-A.y)*(z.x-A.x),r)._round():z.y<r&&(z=new ve(A.x+(r-A.y)/(z.y-A.y)*(z.x-A.x),r)._round()),A.x>=l&&z.x>=l||(A.x>=l?A=new ve(l,A.y+(l-A.x)/(z.x-A.x)*(z.y-A.y))._round():z.x>=l&&(z=new ve(l,A.y+(l-A.x)/(z.x-A.x)*(z.y-A.y))._round()),A.y>=u&&z.y>=u||(A.y>=u?A=new ve(A.x+(u-A.y)/(z.y-A.y)*(z.x-A.x),u)._round():z.y>=u&&(z=new ve(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 md(i,t,r,l){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=(Zt,ee)=>Zt+ee[1]-ee[0],G=z.reduce(O,0),tt=R.reduce(O,0),et=x-G,dt=b-tt,bt=0,xt=G,Et=0,Ot=tt,Lt=0,re=et,ue=0,Jt=dt;if(f.content&&l){let Zt=f.content;bt=Vh(z,0,Zt[0]),Et=Vh(R,0,Zt[1]),xt=Vh(z,Zt[0],Zt[2]),Ot=Vh(R,Zt[1],Zt[3]),Lt=Zt[0]-bt,ue=Zt[1]-Et,re=Zt[2]-Zt[0]-xt,Jt=Zt[3]-Zt[1]-Ot}let Yt=(Zt,ee,Qt,qt)=>{let _e=Gh(Zt.stretch-bt,xt,E,i.left),de=qh(Zt.fixed-Lt,re,Zt.stretch,G),Ne=Gh(ee.stretch-Et,Ot,A,i.top),Je=qh(ee.fixed-ue,Jt,ee.stretch,tt),pi=Gh(Qt.stretch-bt,xt,E,i.left),di=qh(Qt.fixed-Lt,re,Qt.stretch,G),Qi=Gh(qt.stretch-Et,Ot,A,i.top),Li=qh(qt.fixed-ue,Jt,qt.stretch,tt),Di=new ve(_e,Ne),ji=new ve(pi,Ne),tr=new ve(pi,Qi),ar=new ve(_e,Qi),Mr=new ve(de/m,Je/m),Ri=new ve(di/m,Li/m),er=t*Math.PI/180;if(er){let Sr=Math.sin(er),Tr=Math.cos(er),gi=[Tr,-Sr,Sr,Tr];Di._matMult(gi),ji._matMult(gi),ar._matMult(gi),tr._matMult(gi)}let or=Zt.stretch+Zt.fixed,dr=ee.stretch+ee.fixed;return{tl:Di,tr:ji,bl:ar,br:tr,tex:{x:f.paddedRect.x+1+or,y:f.paddedRect.y+1+dr,w:Qt.stretch+Qt.fixed-or,h:qt.stretch+qt.fixed-dr},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Mr,pixelOffsetBR:Ri,minFontScaleX:re/m/E,minFontScaleY:Jt/m/A,isSDF:r}};if(l&&(f.stretchX||f.stretchY)){let Zt=gd(z,et,G),ee=gd(R,dt,tt);for(let Qt=0;Qt<Zt.length-1;Qt++){let qt=Zt[Qt],_e=Zt[Qt+1];for(let de=0;de<ee.length-1;de++)u.push(Yt(qt,ee[de],_e,ee[de+1]))}}else u.push(Yt({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:x+1},{fixed:0,stretch:b+1}));return u}function Vh(i,t,r){let l=0;for(let u of i)l+=Math.max(t,Math.min(r,u[1]))-Math.max(t,Math.min(r,u[0]));return l}function gd(i,t,r){let l=[{fixed:-1,stretch:0}];for(let[u,f]of i){let m=l[l.length-1];l.push({fixed:u-m.stretch,stretch:m.stretch}),l.push({fixed:u-m.stretch,stretch:m.stretch+(f-u)})}return l.push({fixed:t+1,stretch:r}),l}function Gh(i,t,r,l){return i/t*r+l}function qh(i,t,r,l){return i-t*r/l}ie("Anchor",Fs);class jh{constructor(t,r,l,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,tt=m.collisionPadding;if(tt&&(O-=tt[0]*x,z-=tt[1]*x,G+=tt[2]*x,R+=tt[3]*x),A){let et=new ve(O,z),dt=new ve(G,z),bt=new ve(O,R),xt=new ve(G,R),Et=A*Math.PI/180;et._rotate(Et),dt._rotate(Et),bt._rotate(Et),xt._rotate(Et),O=Math.min(et.x,dt.x,bt.x,xt.x),G=Math.max(et.x,dt.x,bt.x,xt.x),z=Math.min(et.y,dt.y,bt.y,xt.y),R=Math.max(et.y,dt.y,bt.y,xt.y)}t.emplaceBack(r.x,r.y,O,z,G,R,l,u,f)}this.boxEndIndex=t.length}}class $y{constructor(t=[],r=Wy){if(this.data=t,this.length=this.data.length,this.compare=r,this.length>0)for(let l=(this.length>>1)-1;l>=0;l--)this._down(l)}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:l}=this,u=r[t];for(;t>0;){let f=t-1>>1,m=r[f];if(l(u,m)>=0)break;r[t]=m,t=f}r[t]=u}_down(t){let{data:r,compare:l}=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&&l(r[b],x)<0&&(m=b,x=r[b]),l(x,f)>=0)break;r[t]=x,t=m}r[t]=f}}function Wy(i,t){return i<t?-1:i>t?1:0}function Zy(i,t=1,r=!1){let l=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<l)&&(l=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-l,m-u),E=b/2,A=new $y([],Hy);if(b===0)return new ve(l,u);for(let O=l;O<f;O+=b)for(let G=u;G<m;G+=b)A.push(new co(O+E,G+E,E,i));let z=function(O){let G=0,tt=0,et=0,dt=O[0];for(let bt=0,xt=dt.length,Et=xt-1;bt<xt;Et=bt++){let Ot=dt[bt],Lt=dt[Et],re=Ot.x*Lt.y-Lt.x*Ot.y;tt+=(Ot.x+Lt.x)*re,et+=(Ot.y+Lt.y)*re,G+=3*re}return new co(tt/G,et/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 co(O.p.x-E,O.p.y-E,E,i)),A.push(new co(O.p.x+E,O.p.y-E,E,i)),A.push(new co(O.p.x-E,O.p.y+E,E,i)),A.push(new co(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 Hy(i,t){return t.max-i.max}function co(i,t,r,l){this.p=new ve(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,Ip(u,O,G))}}return(m?1:-1)*Math.sqrt(x)}(this.p,l),this.max=this.d+this.h*Math.SQRT2}let Iu=Number.POSITIVE_INFINITY;function yd(i,t){return t[1]!==Iu?function(r,l,u){let f=0,m=0;switch(l=Math.abs(l),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=-l;break;case"top-left":case"bottom-left":case"left":f=l}return[f,m]}(i,t[0],t[1]):function(r,l){let u=0,f=0;l<0&&(l=0);let m=l/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-l;break;case"top":f=l-7}switch(r){case"top-right":case"bottom-right":u=-m;break;case"top-left":case"bottom-left":u=m;break;case"left":u=l;break;case"right":u=-l}return[u,f]}(i,t[0])}function Cu(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 Xy(i,t,r,l,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=xd(r.horizontal),tt=m/24,et=i.tilePixelRatio*tt,dt=i.tilePixelRatio*z/24,bt=i.tilePixelRatio*x,xt=i.tilePixelRatio*R.get("symbol-spacing"),Et=R.get("text-padding")*i.tilePixelRatio,Ot=R.get("icon-padding")*i.tilePixelRatio,Lt=R.get("text-max-angle")/180*Math.PI,re=R.get("text-rotation-alignment")!=="viewport"&&R.get("symbol-placement")!=="point",ue=R.get("icon-rotation-alignment")==="map"&&R.get("symbol-placement")!=="point",Jt=R.get("symbol-placement"),Yt=xt/2,Zt=R.get("icon-text-fit"),ee;l&&Zt!=="none"&&(i.allowVerticalPlacement&&r.vertical&&(ee=od(l,r.vertical,Zt,R.get("icon-text-fit-padding"),O,tt)),G&&(l=od(l,G,Zt,R.get("icon-text-fit-padding"),O,tt)));let Qt=(qt,_e)=>{_e.x<0||_e.x>=Vi||_e.y<0||_e.y>=Vi||function(de,Ne,Je,pi,di,Qi,Li,Di,ji,tr,ar,Mr,Ri,er,or,dr,Sr,Tr,gi,$i,Be,Ur,ir,lr,pn){let xn=de.addToLineVertexArray(Ne,Je),vn,Qn,dn,Yr,Er=0,ts=0,kl=0,Rd=0,Ou=-1,Nu=-1,es={},Bd=yl(""),Uu=0,Vu=0;if(Di._unevaluatedLayout.getValue("text-radial-offset")===void 0?[Uu,Vu]=Di.layout.get("text-offset").evaluate(Be,{},lr).map(Ir=>Ir*Xi):(Uu=Di.layout.get("text-radial-offset").evaluate(Be,{},lr)*Xi,Vu=Iu),de.allowVerticalPlacement&&pi.vertical){let Ir=Di.layout.get("text-rotate").evaluate(Be,{},lr)+90;dn=new jh(ji,Ne,tr,ar,Mr,pi.vertical,Ri,er,or,Ir),Li&&(Yr=new jh(ji,Ne,tr,ar,Mr,Li,Sr,Tr,or,Ir))}if(di){let Ir=Di.layout.get("icon-rotate").evaluate(Be,{}),An=Di.layout.get("icon-text-fit")!=="none",Ll=md(di,Ir,ir,An),Dl=Li?md(Li,Ir,ir,An):void 0;Qn=new jh(ji,Ne,tr,ar,Mr,di,Sr,Tr,!1,Ir),Er=4*Ll.length;let Nd=de.iconSizeData,ga=null;Nd.kind==="source"?(ga=[Yn*Di.layout.get("icon-size").evaluate(Be,{})],ga[0]>Os&&Ht(`${de.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)):Nd.kind==="composite"&&(ga=[Yn*Ur.compositeIconSizes[0].evaluate(Be,{},lr),Yn*Ur.compositeIconSizes[1].evaluate(Be,{},lr)],(ga[0]>Os||ga[1]>Os)&&Ht(`${de.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)),de.addSymbols(de.icon,Ll,ga,$i,gi,Be,a.WritingMode.none,Ne,xn.lineStartIndex,xn.lineLength,-1,lr),Ou=de.icon.placedSymbolArray.length-1,Dl&&(ts=4*Dl.length,de.addSymbols(de.icon,Dl,ga,$i,gi,Be,a.WritingMode.vertical,Ne,xn.lineStartIndex,xn.lineLength,-1,lr),Nu=de.icon.placedSymbolArray.length-1)}let Fd=Object.keys(pi.horizontal);for(let Ir of Fd){let An=pi.horizontal[Ir];if(!vn){Bd=yl(An.text);let Dl=Di.layout.get("text-rotate").evaluate(Be,{},lr);vn=new jh(ji,Ne,tr,ar,Mr,An,Ri,er,or,Dl)}let Ll=An.positionedLines.length===1;if(kl+=_d(de,Ne,An,Qi,Di,or,Be,dr,xn,pi.vertical?a.WritingMode.horizontal:a.WritingMode.horizontalOnly,Ll?Fd:[Ir],es,Ou,Ur,lr),Ll)break}pi.vertical&&(Rd+=_d(de,Ne,pi.vertical,Qi,Di,or,Be,dr,xn,a.WritingMode.vertical,["vertical"],es,Nu,Ur,lr));let l0=vn?vn.boxStartIndex:de.collisionBoxArray.length,h0=vn?vn.boxEndIndex:de.collisionBoxArray.length,c0=dn?dn.boxStartIndex:de.collisionBoxArray.length,u0=dn?dn.boxEndIndex:de.collisionBoxArray.length,p0=Qn?Qn.boxStartIndex:de.collisionBoxArray.length,d0=Qn?Qn.boxEndIndex:de.collisionBoxArray.length,f0=Yr?Yr.boxStartIndex:de.collisionBoxArray.length,m0=Yr?Yr.boxEndIndex:de.collisionBoxArray.length,bn=-1,Xh=(Ir,An)=>Ir&&Ir.circleDiameter?Math.max(Ir.circleDiameter,An):An;bn=Xh(vn,bn),bn=Xh(dn,bn),bn=Xh(Qn,bn),bn=Xh(Yr,bn);let Od=bn>-1?1:0;Od&&(bn*=pn/Xi),de.glyphOffsetArray.length>=uo.MAX_GLYPHS&&Ht("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),Be.sortKey!==void 0&&de.addToSortKeyRanges(de.symbolInstances.length,Be.sortKey),de.symbolInstances.emplaceBack(Ne.x,Ne.y,es.right>=0?es.right:-1,es.center>=0?es.center:-1,es.left>=0?es.left:-1,es.vertical||-1,Ou,Nu,Bd,l0,h0,c0,u0,p0,d0,f0,m0,tr,kl,Rd,Er,ts,Od,0,Ri,Uu,Vu,bn)}(i,_e,qt,r,l,u,ee,i.layers[0],i.collisionBoxArray,t.index,t.sourceLayerIndex,i.index,et,Et,re,b,bt,Ot,ue,O,t,f,E,A,m)};if(Jt==="line")for(let qt of fd(t.geometry,0,0,Vi,Vi)){let _e=jy(qt,xt,Lt,r.vertical||G,l,24,dt,i.overscaling,Vi);for(let de of _e){let Ne=G;Ne&&Ky(i,Ne.text,Yt,de)||Qt(qt,de)}}else if(Jt==="line-center"){for(let qt of t.geometry)if(qt.length>1){let _e=qy(qt,Lt,r.vertical||G,l,24,dt);_e&&Qt(qt,_e)}}else if(t.type==="Polygon")for(let qt of mu(t.geometry,0)){let _e=Zy(qt,16);Qt(qt[0],new Fs(_e.x,_e.y,0))}else if(t.type==="LineString")for(let qt of t.geometry)Qt(qt,new Fs(qt[0].x,qt[0].y,0));else if(t.type==="Point")for(let qt of t.geometry)for(let _e of qt)Qt([_e],new Fs(_e.x,_e.y,0))}let Os=32640;function _d(i,t,r,l,u,f,m,x,b,E,A,z,R,O,G){let tt=function(bt,xt,Et,Ot,Lt,re,ue,Jt){let Yt=Ot.layout.get("text-rotate").evaluate(re,{})*Math.PI/180,Zt=[];for(let ee of xt.positionedLines)for(let Qt of ee.positionedGlyphs){if(!Qt.rect)continue;let qt=Qt.rect||{},_e=4,de=!0,Ne=1,Je=0,pi=(Lt||Jt)&&Qt.vertical,di=Qt.metrics.advance*Qt.scale/2;if(Jt&&xt.verticalizable){let gi=(Qt.scale-1)*Xi,$i=(Xi-Qt.metrics.width*Qt.scale)/2;Je=ee.lineOffset/2-(Qt.imageName?-$i:gi)}if(Qt.imageName){let gi=ue[Qt.imageName];de=gi.sdf,Ne=gi.pixelRatio,_e=1/Ne}let Qi=Lt?[Qt.x+di,Qt.y]:[0,0],Li=Lt?[0,0]:[Qt.x+di+Et[0],Qt.y+Et[1]-Je],Di=[0,0];pi&&(Di=Li,Li=[0,0]);let ji=(Qt.metrics.left-_e)*Qt.scale-di+Li[0],tr=(-Qt.metrics.top-_e)*Qt.scale+Li[1],ar=ji+qt.w*Qt.scale/Ne,Mr=tr+qt.h*Qt.scale/Ne,Ri=new ve(ji,tr),er=new ve(ar,tr),or=new ve(ji,Mr),dr=new ve(ar,Mr);if(pi){let gi=new ve(-di,di-Oh),$i=-Math.PI/2,Be=12-di,Ur=new ve(22-Be,-(Qt.imageName?Be:0)),ir=new ve(...Di);Ri._rotateAround($i,gi)._add(Ur)._add(ir),er._rotateAround($i,gi)._add(Ur)._add(ir),or._rotateAround($i,gi)._add(Ur)._add(ir),dr._rotateAround($i,gi)._add(Ur)._add(ir)}if(Yt){let gi=Math.sin(Yt),$i=Math.cos(Yt),Be=[$i,-gi,gi,$i];Ri._matMult(Be),er._matMult(Be),or._matMult(Be),dr._matMult(Be)}let Sr=new ve(0,0),Tr=new ve(0,0);Zt.push({tl:Ri,tr:er,bl:or,br:dr,tex:qt,writingMode:xt.writingMode,glyphOffset:Qi,sectionIndex:Qt.sectionIndex,isSDF:de,pixelOffsetTL:Sr,pixelOffsetBR:Tr,minFontScaleX:0,minFontScaleY:0})}return Zt}(0,r,x,u,f,m,l,i.allowVerticalPlacement),et=i.textSizeData,dt=null;et.kind==="source"?(dt=[Yn*u.layout.get("text-size").evaluate(m,{})],dt[0]>Os&&Ht(`${i.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)):et.kind==="composite"&&(dt=[Yn*O.compositeTextSizes[0].evaluate(m,{},G),Yn*O.compositeTextSizes[1].evaluate(m,{},G)],(dt[0]>Os||dt[1]>Os)&&Ht(`${i.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)),i.addSymbols(i.text,tt,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*tt.length}function xd(i){for(let t in i)return i[t];return null}function Ky(i,t,r,l){let u=i.compareText;if(t in u){let f=u[t];for(let m=f.length-1;m>=0;m--)if(l.dist(f[m])<r)return!0}else u[t]=[];return u[t].push(l),!1}let Jy=Rs.VectorTileFeature.types,Yy=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function $h(i,t,r,l,u,f,m,x,b,E,A,z,R){let O=x?Math.min(Os,Math.round(x[0])):0,G=x?Math.min(Os,Math.round(x[1])):0;i.emplaceBack(t,r,Math.round(32*l),Math.round(32*u),f,m,(O<<1)+(b?1:0),G,16*E,16*A,256*z,256*R)}function Au(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 Qy(i){for(let t of i.sections)if(tu(t.text))return!0;return!1}class Pu{constructor(t){this.layoutVertexArray=new Hi,this.indexArray=new pr,this.programConfigurations=t,this.segments=new $e,this.dynamicLayoutVertexArray=new br,this.opacityVertexArray=new Or,this.placedSymbolArray=new Ut}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(t,r,l,u){this.isEmpty()||(l&&(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,wy.members),this.indexBuffer=t.createIndexBuffer(this.indexArray,r),this.dynamicLayoutVertexBuffer=t.createVertexBuffer(this.dynamicLayoutVertexArray,My.members,!0),this.opacityVertexBuffer=t.createVertexBuffer(this.opacityVertexArray,Yy,!0),this.opacityVertexBuffer.itemSize=1),(l||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())}}ie("SymbolBuffers",Pu);class zu{constructor(t,r,l){this.layoutVertexArray=new t,this.layoutAttributes=r,this.indexArray=new l,this.segments=new $e,this.collisionVertexArray=new Cn}upload(t){this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=t.createVertexBuffer(this.collisionVertexArray,Sy.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}ie("CollisionBuffers",zu);class uo{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=lu([]),this.placementViewportMatrix=lu([]);let r=this.layers[0]._unevaluatedLayout._values;this.textSizeData=ld(this.zoom,r["text-size"]),this.iconSizeData=ld(this.zoom,r["icon-size"]);let l=this.layers[0].layout,u=l.get("symbol-sort-key"),f=l.get("symbol-z-order");this.canOverlap=Lu(l,"text-overlap","text-allow-overlap")!=="never"||Lu(l,"icon-overlap","icon-allow-overlap")!=="never"||l.get("text-ignore-placement")||l.get("icon-ignore-placement"),this.sortFeaturesByKey=f!=="viewport-y"&&!u.isConstant(),this.sortFeaturesByY=(f==="viewport-y"||f==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,l.get("symbol-placement")==="point"&&(this.writingModes=l.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 Pu(new pa(this.layers,this.zoom,t=>/^text/.test(t))),this.icon=new Pu(new pa(this.layers,this.zoom,t=>/^icon/.test(t))),this.glyphOffsetArray=new se,this.lineVertexArray=new Kt,this.symbolInstances=new Pt}calculateGlyphDependencies(t,r,l,u,f){for(let m=0;m<t.length;m++)if(r[t.charCodeAt(m)]=!0,(l||u)&&f){let x=Cl[t.charAt(m)];x&&(r[x.charCodeAt(0)]=!0)}}populate(t,r,l){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 K&&!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,tt=new ci(this.zoom);for(let{feature:et,id:dt,index:bt,sourceLayerIndex:xt}of t){let Et=u._featureFilter.needGeometry,Ot=fa(et,Et);if(!u._featureFilter.filter(tt,Ot,l))continue;let Lt,re;if(Et||(Ot.geometry=da(et)),E){let Jt=u.getValueAndResolveTokens("text-field",Ot,l,G),Yt=K.factory(Jt);Qy(Yt)&&(this.hasRTLText=!0),(!this.hasRTLText||fl()==="unavailable"||this.hasRTLText&&Fr.isParsed())&&(Lt=Ey(Yt,u,Ot))}if(A){let Jt=u.getValueAndResolveTokens("icon-image",Ot,l,G);re=Jt instanceof st?Jt:st.fromString(Jt)}if(!Lt&&!re)continue;let ue=this.sortFeaturesByKey?z.evaluate(Ot,{},l):void 0;if(this.features.push({id:dt,text:Lt,icon:re,index:bt,sourceLayerIndex:xt,geometry:Ot.geometry,properties:et.properties,type:Jy[et.type],sortKey:ue}),re&&(R[re.name]=!0),Lt){let Jt=m.evaluate(Ot,{},l).join(","),Yt=f.get("text-rotation-alignment")!=="viewport"&&f.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(a.WritingMode.vertical)>=0;for(let Zt of Lt.sections)if(Zt.image)R[Zt.image.name]=!0;else{let ee=hl(Lt.toString()),Qt=Zt.fontStack||Jt,qt=O[Qt]=O[Qt]||{};this.calculateGlyphDependencies(Zt.text,qt,Yt,this.allowVerticalPlacement,ee)}}}f.get("symbol-placement")==="line"&&(this.features=function(et){let dt={},bt={},xt=[],Et=0;function Ot(Jt){xt.push(et[Jt]),Et++}function Lt(Jt,Yt,Zt){let ee=bt[Jt];return delete bt[Jt],bt[Yt]=ee,xt[ee].geometry[0].pop(),xt[ee].geometry[0]=xt[ee].geometry[0].concat(Zt[0]),ee}function re(Jt,Yt,Zt){let ee=dt[Yt];return delete dt[Yt],dt[Jt]=ee,xt[ee].geometry[0].shift(),xt[ee].geometry[0]=Zt[0].concat(xt[ee].geometry[0]),ee}function ue(Jt,Yt,Zt){let ee=Zt?Yt[0][Yt[0].length-1]:Yt[0][0];return`${Jt}:${ee.x}:${ee.y}`}for(let Jt=0;Jt<et.length;Jt++){let Yt=et[Jt],Zt=Yt.geometry,ee=Yt.text?Yt.text.toString():null;if(!ee){Ot(Jt);continue}let Qt=ue(ee,Zt),qt=ue(ee,Zt,!0);if(Qt in bt&&qt in dt&&bt[Qt]!==dt[qt]){let _e=re(Qt,qt,Zt),de=Lt(Qt,qt,xt[_e].geometry);delete dt[Qt],delete bt[qt],bt[ue(ee,xt[de].geometry,!0)]=de,xt[_e].geometry=null}else Qt in bt?Lt(Qt,qt,Zt):qt in dt?re(Qt,qt,Zt):(Ot(Jt),dt[Qt]=Et-1,bt[qt]=Et-1)}return xt.filter(Jt=>Jt.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((et,dt)=>et.sortKey-dt.sortKey)}update(t,r,l){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(t,r,this.layers,l),this.icon.programConfigurations.updatePaintArrays(t,r,this.layers,l))}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 l=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:l,lineLength:this.lineVertexArray.length-l}}addSymbols(t,r,l,u,f,m,x,b,E,A,z,R){let O=t.indexArray,G=t.layoutVertexArray,tt=t.segments.prepareSegment(4*r.length,G,O,this.canOverlap?m.sortKey:void 0),et=this.glyphOffsetArray.length,dt=tt.vertexLength,bt=this.allowVerticalPlacement&&x===a.WritingMode.vertical?Math.PI/2:0,xt=m.text&&m.text.sections;for(let Et=0;Et<r.length;Et++){let{tl:Ot,tr:Lt,bl:re,br:ue,tex:Jt,pixelOffsetTL:Yt,pixelOffsetBR:Zt,minFontScaleX:ee,minFontScaleY:Qt,glyphOffset:qt,isSDF:_e,sectionIndex:de}=r[Et],Ne=tt.vertexLength,Je=qt[1];$h(G,b.x,b.y,Ot.x,Je+Ot.y,Jt.x,Jt.y,l,_e,Yt.x,Yt.y,ee,Qt),$h(G,b.x,b.y,Lt.x,Je+Lt.y,Jt.x+Jt.w,Jt.y,l,_e,Zt.x,Yt.y,ee,Qt),$h(G,b.x,b.y,re.x,Je+re.y,Jt.x,Jt.y+Jt.h,l,_e,Yt.x,Zt.y,ee,Qt),$h(G,b.x,b.y,ue.x,Je+ue.y,Jt.x+Jt.w,Jt.y+Jt.h,l,_e,Zt.x,Zt.y,ee,Qt),Au(t.dynamicLayoutVertexArray,b,bt),O.emplaceBack(Ne,Ne+1,Ne+2),O.emplaceBack(Ne+1,Ne+2,Ne+3),tt.vertexLength+=4,tt.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(qt[0]),Et!==r.length-1&&de===r[Et+1].sectionIndex||t.programConfigurations.populatePaintArrays(G.length,m,m.index,{},R,xt&&xt[de])}t.placedSymbolArray.emplaceBack(b.x,b.y,et,this.glyphOffsetArray.length-et,dt,E,A,b.segment,l?l[0]:0,l?l[1]:0,u[0],u[1],x,0,!1,0,z)}_addCollisionDebugVertex(t,r,l,u,f,m){return r.emplaceBack(0,0),t.emplaceBack(l.x,l.y,u,f,Math.round(m.x),Math.round(m.y))}addCollisionDebugVertices(t,r,l,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 ve(t,r)),this._addCollisionDebugVertex(A,z,m,R,O,new ve(l,r)),this._addCollisionDebugVertex(A,z,m,R,O,new ve(l,u)),this._addCollisionDebugVertex(A,z,m,R,O,new ve(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,l,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,l)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new zu(Nr,Hp.members,ln),this.iconCollisionBox=new zu(Nr,Hp.members,ln);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,l,u,f,m,x,b,E){let A={};for(let z=r;z<l;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 l=this.symbolInstances.get(r);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(t,l.textBoxStartIndex,l.textBoxEndIndex,l.verticalTextBoxStartIndex,l.verticalTextBoxEndIndex,l.iconBoxStartIndex,l.iconBoxEndIndex,l.verticalIconBoxStartIndex,l.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 l=t.placedSymbolArray.get(r),u=l.vertexStartIndex+4*l.numGlyphs;for(let f=l.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),l=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+l*b.anchorY)),f.push(b.featureIndex)}return m.sort((x,b)=>u[x]-u[b]||f[b]-f[x]),m}addToSortKeyRanges(t,r){let l=this.sortKeyRanges[this.sortKeyRanges.length-1];l&&l.sortKey===r?l.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 l=this.symbolInstances.get(r);this.featureSortOrder.push(l.featureIndex),[l.rightJustifiedTextSymbolIndex,l.centerJustifiedTextSymbolIndex,l.leftJustifiedTextSymbolIndex].forEach((u,f,m)=>{u>=0&&m.indexOf(u)===f&&this.addIndicesForPlacedSymbol(this.text,u)}),l.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,l.verticalPlacedTextSymbolIndex),l.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,l.placedIconSymbolIndex),l.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,l.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}ie("SymbolBucket",uo,{omit:["layers","collisionBoxArray","features","compareText"]}),uo.MAX_GLYPHS=65535,uo.addDynamicAttributes=Au;let t0=new Ni({"symbol-placement":new le(ct.layout_symbol["symbol-placement"]),"symbol-spacing":new le(ct.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new le(ct.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new ye(ct.layout_symbol["symbol-sort-key"]),"symbol-z-order":new le(ct.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new le(ct.layout_symbol["icon-allow-overlap"]),"icon-overlap":new le(ct.layout_symbol["icon-overlap"]),"icon-ignore-placement":new le(ct.layout_symbol["icon-ignore-placement"]),"icon-optional":new le(ct.layout_symbol["icon-optional"]),"icon-rotation-alignment":new le(ct.layout_symbol["icon-rotation-alignment"]),"icon-size":new ye(ct.layout_symbol["icon-size"]),"icon-text-fit":new le(ct.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new le(ct.layout_symbol["icon-text-fit-padding"]),"icon-image":new ye(ct.layout_symbol["icon-image"]),"icon-rotate":new ye(ct.layout_symbol["icon-rotate"]),"icon-padding":new le(ct.layout_symbol["icon-padding"]),"icon-keep-upright":new le(ct.layout_symbol["icon-keep-upright"]),"icon-offset":new ye(ct.layout_symbol["icon-offset"]),"icon-anchor":new ye(ct.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new le(ct.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new le(ct.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new le(ct.layout_symbol["text-rotation-alignment"]),"text-field":new ye(ct.layout_symbol["text-field"]),"text-font":new ye(ct.layout_symbol["text-font"]),"text-size":new ye(ct.layout_symbol["text-size"]),"text-max-width":new ye(ct.layout_symbol["text-max-width"]),"text-line-height":new le(ct.layout_symbol["text-line-height"]),"text-letter-spacing":new ye(ct.layout_symbol["text-letter-spacing"]),"text-justify":new ye(ct.layout_symbol["text-justify"]),"text-radial-offset":new ye(ct.layout_symbol["text-radial-offset"]),"text-variable-anchor":new le(ct.layout_symbol["text-variable-anchor"]),"text-anchor":new ye(ct.layout_symbol["text-anchor"]),"text-max-angle":new le(ct.layout_symbol["text-max-angle"]),"text-writing-mode":new le(ct.layout_symbol["text-writing-mode"]),"text-rotate":new ye(ct.layout_symbol["text-rotate"]),"text-padding":new le(ct.layout_symbol["text-padding"]),"text-keep-upright":new le(ct.layout_symbol["text-keep-upright"]),"text-transform":new ye(ct.layout_symbol["text-transform"]),"text-offset":new ye(ct.layout_symbol["text-offset"]),"text-allow-overlap":new le(ct.layout_symbol["text-allow-overlap"]),"text-overlap":new le(ct.layout_symbol["text-overlap"]),"text-ignore-placement":new le(ct.layout_symbol["text-ignore-placement"]),"text-optional":new le(ct.layout_symbol["text-optional"])});var ku={paint:new Ni({"icon-opacity":new ye(ct.paint_symbol["icon-opacity"]),"icon-color":new ye(ct.paint_symbol["icon-color"]),"icon-halo-color":new ye(ct.paint_symbol["icon-halo-color"]),"icon-halo-width":new ye(ct.paint_symbol["icon-halo-width"]),"icon-halo-blur":new ye(ct.paint_symbol["icon-halo-blur"]),"icon-translate":new le(ct.paint_symbol["icon-translate"]),"icon-translate-anchor":new le(ct.paint_symbol["icon-translate-anchor"]),"text-opacity":new ye(ct.paint_symbol["text-opacity"]),"text-color":new ye(ct.paint_symbol["text-color"],{runtimeType:oi,getOverride:i=>i.textColor,hasOverride:i=>!!i.textColor}),"text-halo-color":new ye(ct.paint_symbol["text-halo-color"]),"text-halo-width":new ye(ct.paint_symbol["text-halo-width"]),"text-halo-blur":new ye(ct.paint_symbol["text-halo-blur"]),"text-translate":new le(ct.paint_symbol["text-translate"]),"text-translate-anchor":new le(ct.paint_symbol["text-translate-anchor"])}),layout:t0};class vd{constructor(t){this.type=t.property.overrides?t.property.overrides.runtimeType:ke,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}}ie("FormatSectionOverride",vd,{omit:["defaultValue"]});class Wh extends ur{constructor(t){super(t,ku)}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 l=this.layout.get("text-writing-mode");if(l){let u=[];for(let f of l)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,l,u){let f=this.layout.get(t).evaluate(r,{},l,u),m=this._unevaluatedLayout._values[t];return m.isDataDriven()||Oa(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 uo(t)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(let t of ku.paint.overridableProperties){if(!Wh.hasPaintOverride(this.layout,t))continue;let r=this.paint.get(t),l=new vd(r),u=new rl(l,r.property.specification),f=null;f=r.value.kind==="constant"||r.value.kind==="source"?new Ua("source",u):new Va("composite",u,r.value.zoomStops,r.value._interpolationType),this.paint._values[t]=new on(r.property,f,r.parameters)}}_handleOverridablePaintPropertyUpdate(t,r,l){return!(!this.layout||r.isDataDriven()||l.isDataDriven())&&Wh.hasPaintOverride(this.layout,t)}static hasPaintOverride(t,r){let l=t.get("text-field"),u=ku.paint.properties[r],f=!1,m=x=>{for(let b of x)if(u.overrides&&u.overrides.hasOverride(b))return void(f=!0)};if(l.value.kind==="constant"&&l.value.value instanceof K)m(l.value.value.sections);else if(l.value.kind==="source"){let x=E=>{f||(E instanceof Bt&&at(E.value)===yi?m(E.value.sections):E instanceof he?m(E.sections):E.eachChild(x))},b=l.value;b._styleExpression&&x(b._styleExpression.expression)}return f}}function Lu(i,t,r){let l="never",u=i.get(t);return u?l=u:i.get(r)&&(l="always"),l}var e0={paint:new Ni({"background-color":new le(ct.paint_background["background-color"]),"background-pattern":new ha(ct.paint_background["background-pattern"]),"background-opacity":new le(ct.paint_background["background-opacity"])})},i0={paint:new Ni({"raster-opacity":new le(ct.paint_raster["raster-opacity"]),"raster-hue-rotate":new le(ct.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new le(ct.paint_raster["raster-brightness-min"]),"raster-brightness-max":new le(ct.paint_raster["raster-brightness-max"]),"raster-saturation":new le(ct.paint_raster["raster-saturation"]),"raster-contrast":new le(ct.paint_raster["raster-contrast"]),"raster-resampling":new le(ct.paint_raster["raster-resampling"]),"raster-fade-duration":new le(ct.paint_raster["raster-fade-duration"])})};class r0 extends ur{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 n0={circle:class extends ur{constructor(i){super(i,Bg)}createBucket(i){return new su(i)}queryRadius(i){let t=i;return xl("circle-radius",this,t)+xl("circle-stroke-width",this,t)+Ph(this.paint.get("circle-translate"))}queryIntersectsFeature(i,t,r,l,u,f,m,x){let b=zh(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(tt=>Pp(tt,G))}(b,x),R=A?E*m:E;for(let O of l)for(let G of O){let tt=A?G:Pp(G,x),et=R,dt=kh([],[G.x,G.y,0,1],x);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?et*=dt[3]/f.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(et*=f.cameraToCenterDistance/dt[3]),zg(z,tt,et))return!0}return!1}},heatmap:class extends ur{constructor(i){super(i,Og),this._updateColorRamp()}createBucket(i){return new zp(i)}_handleSpecialPaintPropertyUpdate(i){i==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=Lp({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 ur{constructor(i){super(i,Ng)}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}},fill:class extends ur{constructor(i){super(i,ey)}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 _u(i)}queryRadius(){return Ph(this.paint.get("fill-translate"))}queryIntersectsFeature(i,t,r,l,u,f,m){return Ep(zh(i,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),f.angle,m),l)}isTileClipped(){return!0}},"fill-extrusion":class extends ur{constructor(i){super(i,fy)}createBucket(i){return new vu(i)}queryRadius(){return Ph(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(i,t,r,l,u,f,m,x){let b=zh(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,tt,et){let dt=[];for(let bt of O){let xt=[bt.x,bt.y,0,1];kh(xt,xt,G),dt.push(new ve(xt[0]/xt[3],xt[1]/xt[3]))}return dt}(b,x),R=function(O,G,tt,et){let dt=[],bt=[],xt=et[8]*G,Et=et[9]*G,Ot=et[10]*G,Lt=et[11]*G,re=et[8]*tt,ue=et[9]*tt,Jt=et[10]*tt,Yt=et[11]*tt;for(let Zt of O){let ee=[],Qt=[];for(let qt of Zt){let _e=qt.x,de=qt.y,Ne=et[0]*_e+et[4]*de+et[12],Je=et[1]*_e+et[5]*de+et[13],pi=et[2]*_e+et[6]*de+et[14],di=et[3]*_e+et[7]*de+et[15],Qi=pi+Ot,Li=di+Lt,Di=Ne+re,ji=Je+ue,tr=pi+Jt,ar=di+Yt,Mr=new ve((Ne+xt)/Li,(Je+Et)/Li);Mr.z=Qi/Li,ee.push(Mr);let Ri=new ve(Di/ar,ji/ar);Ri.z=tr/ar,Qt.push(Ri)}dt.push(ee),bt.push(Qt)}return[dt,bt]}(l,A,E,x);return function(O,G,tt){let et=1/0;Ep(tt,G)&&(et=qp(tt,G[0]));for(let dt=0;dt<G.length;dt++){let bt=G[dt],xt=O[dt];for(let Et=0;Et<bt.length-1;Et++){let Ot=bt[Et],Lt=[Ot,bt[Et+1],xt[Et+1],xt[Et],Ot];Tp(tt,Lt)&&(et=Math.min(et,qp(tt,Lt)))}}return et!==1/0&&et}(R[0],R[1],z)}},line:class extends ur{constructor(i){super(i,$p),this.gradientVersion=0}_handleSpecialPaintPropertyUpdate(i){i==="line-gradient"&&(this.stepInterpolant=this._transitionablePaint._values["line-gradient"].value.expression._styleExpression.expression instanceof Ks,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"]=Wp.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,i)}createBucket(i){return new bu(i)}queryRadius(i){let t=i,r=Zp(xl("line-width",this,t),xl("line-gap-width",this,t)),l=xl("line-offset",this,t);return r/2+Math.abs(l)+Ph(this.paint.get("line-translate"))}queryIntersectsFeature(i,t,r,l,u,f,m){let x=zh(i,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),f.angle,m),b=m/2*Zp(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&&(l=function(A,z){let R=[];for(let O=0;O<A.length;O++){let G=A[O],tt=[];for(let et=0;et<G.length;et++){let dt=G[et-1],bt=G[et],xt=G[et+1],Et=et===0?new ve(0,0):bt.sub(dt)._unit()._perp(),Ot=et===G.length-1?new ve(0,0):xt.sub(bt)._unit()._perp(),Lt=Et._add(Ot)._unit(),re=Lt.x*Ot.x+Lt.y*Ot.y;re!==0&&Lt._mult(1/re),tt.push(Lt._mult(z)._add(bt))}R.push(tt)}return R}(l,E*m)),function(A,z,R){for(let O=0;O<z.length;O++){let G=z[O];if(A.length>=3){for(let tt=0;tt<G.length;tt++)if(ro(A,G[tt]))return!0}if(kg(A,G,R))return!0}return!1}(x,l,b)}isTileClipped(){return!0}},symbol:Wh,background:class extends ur{constructor(i){super(i,e0)}},raster:class extends ur{constructor(i){super(i,i0)}}};class s0{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 bd=63710088e-1;class Si{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 Si(Q(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,l=this.lat*r,u=t.lat*r,f=Math.sin(l)*Math.sin(u)+Math.cos(l)*Math.cos(u)*Math.cos((t.lng-this.lng)*r);return bd*Math.acos(Math.min(f,1))}toBounds(t=0){let r=360*t/40075017,l=r/Math.cos(Math.PI/180*this.lat);return new ma(new Si(this.lng-l,this.lat-r),new Si(this.lng+l,this.lat+r))}static convert(t){if(t instanceof Si)return t;if(Array.isArray(t)&&(t.length===2||t.length===3))return new Si(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&typeof t=="object"&&t!==null)return new Si(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 ma{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 Si?new Si(t.lng,t.lat):Si.convert(t),this}setSouthWest(t){return this._sw=t instanceof Si?new Si(t.lng,t.lat):Si.convert(t),this}extend(t){let r=this._sw,l=this._ne,u,f;if(t instanceof Si)u=t,f=t;else{if(!(t instanceof ma))return Array.isArray(t)?t.length===4||t.every(Array.isArray)?this.extend(ma.convert(t)):this.extend(Si.convert(t)):this;if(u=t._sw,f=t._ne,!u||!f)return this}return r||l?(r.lng=Math.min(u.lng,r.lng),r.lat=Math.min(u.lat,r.lat),l.lng=Math.max(f.lng,l.lng),l.lat=Math.max(f.lat,l.lat)):(this._sw=new Si(u.lng,u.lat),this._ne=new Si(f.lng,f.lat)),this}getCenter(){return new Si((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 Si(this.getWest(),this.getNorth())}getSouthEast(){return new Si(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:l}=Si.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<=l&&l<=this._ne.lat&&u}static convert(t){return t instanceof ma?t:t&&new ma(t)}}let wd=2*Math.PI*bd;function Md(i){return wd*Math.cos(i*Math.PI/180)}function Sd(i){return(180+i)/360}function Td(i){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i*Math.PI/360)))/360}function Ed(i,t){return i/Md(t)}function Du(i){return 360/Math.PI*Math.atan(Math.exp((180-360*i)*Math.PI/180))-90}class Zh{constructor(t,r,l=0){this.x=+t,this.y=+r,this.z=+l}static fromLngLat(t,r=0){let l=Si.convert(t);return new Zh(Sd(l.lng),Td(l.lat),Ed(r,l.lat))}toLngLat(){return new Si(360*this.x-180,Du(this.y))}toAltitude(){return this.z*Md(Du(this.y))}meterInMercatorCoordinateUnits(){return 1/wd*(t=Du(this.y),1/Math.cos(t*Math.PI/180));var t}}function Id(i,t,r){var l=2*Math.PI*6378137/256/Math.pow(2,r);return[i*l-2*Math.PI*6378137/2,t*l-2*Math.PI*6378137/2]}class Ru{constructor(t,r,l){this.z=t,this.x=r,this.y=l,this.key=Pl(0,t,t,r,l)}equals(t){return this.z===t.z&&this.x===t.x&&this.y===t.y}url(t,r,l){let u=(m=this.y,x=this.z,b=Id(256*(f=this.x),256*(m=Math.pow(2,x)-m-1),x),E=Id(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,tt="";for(let et=z;et>0;et--)G=1<<et-1,tt+=(R&G?1:0)+(O&G?2:0);return tt}(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(l==="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 ve((t.x*r-this.x)*Vi,(t.y*r-this.y)*Vi)}toString(){return`${this.z}/${this.x}/${this.y}`}}class Cd{constructor(t,r){this.wrap=t,this.canonical=r,this.key=Pl(t,r.z,r.z,r.x,r.y)}}class un{constructor(t,r,l,u,f){this.overscaledZ=t,this.wrap=r,this.canonical=new Ru(l,+u,+f),this.key=Pl(r,t,l,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 un(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new un(t,this.wrap,t,this.canonical.x>>r,this.canonical.y>>r)}calculateScaledKey(t,r){let l=this.canonical.z-t;return t>this.canonical.z?Pl(this.wrap*+r,t,this.canonical.z,this.canonical.x,this.canonical.y):Pl(this.wrap*+r,t,t,this.canonical.x>>l,this.canonical.y>>l)}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 un(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];let r=this.canonical.z+1,l=2*this.canonical.x,u=2*this.canonical.y;return[new un(r,this.wrap,r,l,u),new un(r,this.wrap,r,l+1,u),new un(r,this.wrap,r,l,u+1),new un(r,this.wrap,r,l+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 un(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(t){return new un(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 Cd(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(t){return this.canonical.getTilePoint(new Zh(t.x-this.wrap,t.y))}}function Pl(i,t,r,l,u){(i*=2)<0&&(i=-1*i-1);let f=1<<r;return(f*f*i+f*u+l).toString(36)+r.toString(36)+t.toString(36)}ie("CanonicalTileID",Ru),ie("OverscaledTileID",un,{omit:["posMatrix"]});class Ad{constructor(t,r,l){if(this.uid=t,r.height!==r.width)throw new RangeError("DEM tiles must be square");if(l&&l!=="mapbox"&&l!=="terrarium")return void Ht(`"${l}" 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=l||"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 l=new Uint8Array(this.data.buffer),u=4*this._idx(t,r);return(this.encoding==="terrarium"?this._unpackTerrarium:this._unpackMapbox)(l[u],l[u+1],l[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,l){return(256*t*256+256*r+l)/10-1e4}_unpackTerrarium(t,r,l){return 256*t+r+l/256-32768}getPixels(){return new Jr({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(t,r,l){if(this.dim!==t.dim)throw new Error("dem dimension mismatch");let u=r*this.dim,f=r*this.dim+this.dim,m=l*this.dim,x=l*this.dim+this.dim;switch(r){case-1:u=f-1;break;case 1:f=u+1}switch(l){case-1:m=x-1;break;case 1:x=m+1}let b=-r*this.dim,E=-l*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)]}}ie("DEMData",Ad);class Pd{constructor(t){this._stringToNumber={},this._numberToString=[];for(let r=0;r<t.length;r++){let l=t[r];this._stringToNumber[l]=r,this._numberToString[r]=l}}encode(t){return this._stringToNumber[t]}decode(t){return this._numberToString[t]}}class zd{constructor(t,r,l,u,f){this.type="Feature",this._vectorTileFeature=t,t._z=r,t._x=l,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 kd{constructor(t,r){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new jn(Vi,16,0),this.grid3D=new jn(Vi,16,0),this.featureIndexArray=new Ue,this.promoteId=r}insert(t,r,l,u,f,m){let x=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(l,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]<Vi&&z[1]<Vi&&z[2]>=0&&z[3]>=0&&b.insert(x,z[0],z[1],z[2],z[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new Rs.VectorTile(new wu(this.rawTileData)).layers,this.sourceLayerCoder=new Pd(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(t,r,l,u){this.loadVTLayers();let f=t.params||{},m=Vi/t.tileSize/t.scale,x=ja(f.filter),b=t.queryGeometry,E=t.queryPadding*m,A=Dd(b),z=this.grid.query(A.minX-E,A.minY-E,A.maxX+E,A.maxY+E),R=Dd(t.cameraQueryGeometry),O=this.grid3D.query(R.minX-E,R.minY-E,R.maxX+E,R.maxY+E,(et,dt,bt,xt)=>function(Et,Ot,Lt,re,ue){for(let Yt of Et)if(Ot<=Yt.x&&Lt<=Yt.y&&re>=Yt.x&&ue>=Yt.y)return!0;let Jt=[new ve(Ot,Lt),new ve(Ot,ue),new ve(re,ue),new ve(re,Lt)];if(Et.length>2){for(let Yt of Jt)if(ro(Et,Yt))return!0}for(let Yt=0;Yt<Et.length-1;Yt++)if(Dg(Et[Yt],Et[Yt+1],Jt))return!0;return!1}(t.cameraQueryGeometry,et-E,dt-E,bt+E,xt+E));for(let et of O)z.push(et);z.sort(a0);let G={},tt;for(let et=0;et<z.length;et++){let dt=z[et];if(dt===tt)continue;tt=dt;let bt=this.featureIndexArray.get(dt),xt=null;this.loadMatchingFeature(G,bt.bucketIndex,bt.sourceLayerIndex,bt.featureIndex,x,f.layers,f.availableImages,r,l,u,(Et,Ot,Lt)=>(xt||(xt=da(Et)),Ot.queryIntersectsFeature(b,Et,Lt,xt,this.z,t.transform,m,t.pixelPosMatrix)))}return G}loadMatchingFeature(t,r,l,u,f,m,x,b,E,A,z){let R=this.bucketLayerIDs[r];if(m&&!function(et,dt){for(let bt=0;bt<et.length;bt++)if(dt.indexOf(et[bt])>=0)return!0;return!1}(m,R))return;let O=this.sourceLayerCoder.decode(l),G=this.vtLayers[O].feature(u);if(f.needGeometry){let et=fa(G,!0);if(!f.filter(new ci(this.tileID.overscaledZ),et,this.tileID.canonical))return}else if(!f.filter(new ci(this.tileID.overscaledZ),G))return;let tt=this.getId(G,O);for(let et=0;et<R.length;et++){let dt=R[et];if(m&&m.indexOf(dt)<0)continue;let bt=b[dt];if(!bt)continue;let xt={};tt&&A&&(xt=A.getState(bt.sourceLayer||"_geojsonTileLayer",tt));let Et=pt({},E[dt]);Et.paint=Ld(Et.paint,bt.paint,G,xt,x),Et.layout=Ld(Et.layout,bt.layout,G,xt,x);let Ot=!z||z(G,bt,xt);if(!Ot)continue;let Lt=new zd(G,this.z,this.x,this.y,tt);Lt.layer=Et;let re=t[dt];re===void 0&&(re=t[dt]=[]),re.push({featureIndex:u,feature:Lt,intersectionZ:Ot})}}lookupSymbolFeatures(t,r,l,u,f,m,x,b){let E={};this.loadVTLayers();let A=ja(f);for(let z of t)this.loadMatchingFeature(E,l,u,z,A,m,x,b,r);return E}hasLayer(t){for(let r of this.bucketLayerIDs)for(let l of r)if(t===l)return!0;return!1}getId(t,r){let l=t.id;return this.promoteId&&(l=t.properties[typeof this.promoteId=="string"?this.promoteId:this.promoteId[r]],typeof l=="boolean"&&(l=Number(l))),l}}function Ld(i,t,r,l,u){return Rt(i,(f,m)=>{let x=t instanceof Ya?t.get(m):null;return x&&x.evaluate?x.evaluate(r,l,u):x})}function Dd(i){let t=1/0,r=1/0,l=-1/0,u=-1/0;for(let f of i)t=Math.min(t,f.x),r=Math.min(r,f.y),l=Math.max(l,f.x),u=Math.max(u,f.y);return{minX:t,minY:r,maxX:l,maxY:u}}function a0(i,t){return t-i}var Bu;ie("FeatureIndex",kd,{omit:["rawTileData","sourceLayerCoder"]}),a.PerformanceMarkers=void 0,(Bu=a.PerformanceMarkers||(a.PerformanceMarkers={})).create="create",Bu.load="load",Bu.fullLoad="fullLoad";let Hh=null,zl=[],Fu=1e3/30,o0={mark(i){performance.mark(i)},frame(i){let t=i;Hh!=null&&zl.push(t-Hh),Hh=t},clearMetrics(){Hh=null,zl=[],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=zl.length,l=1/(zl.reduce((f,m)=>f+m,0)/r/1e3),u=zl.filter(f=>f>Fu).reduce((f,m)=>f+(m-Fu)/Fu,0);return{loadTime:i,fullLoadTime:t,fps:l,percentDroppedFrames:u/(r+u)*100}}};a.AJAXError=ti,a.ARRAY_TYPE=no,a.Actor=class{constructor(i,t,r){this.target=i,this.parent=t,this.mapId=r,this.callbacks={},this.tasks={},this.taskQueue=[],this.cancelCallbacks={},ft(["receive","process"],this),this.invoker=new s0(this.process),this.target.addEventListener("message",this.receive,!1),this.globalScope=oe()?i:window}send(i,t,r,l,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:l,mustQueue:u,sourceMapId:this.mapId,data:sa(t,m)},m),{cancel:()=>{r&&delete this.callbacks[f],this.target.postMessage({id:f,type:"<cancel>",targetMapId:l,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 l=this.cancelCallbacks[r];delete this.cancelCallbacks[r],l&&l()}else oe()||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($n(t.error)):r(null,$n(t.data)))}else{let r=!1,l=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?sa(x):null,data:sa(b,l)},l)}:x=>{r=!0},f=null,m=$n(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=bl,a.CanonicalTileID=Ru,a.CollisionBoxArray=Mt,a.CollisionCircleLayoutArray=class extends C{},a.Color=P,a.DEMData=Ad,a.DataConstantProperty=le,a.DictionaryCoder=Pd,a.EXTENT=Vi,a.ErrorEvent=Ft,a.EvaluationParameters=ci,a.Event=_t,a.Evented=Vt,a.FeatureIndex=kd,a.FillBucket=_u,a.FillExtrusionBucket=vu,a.GeoJSONFeature=zd,a.ImageAtlas=id,a.ImagePosition=Su,a.LineBucket=bu,a.LineStripIndexArray=class extends gt{},a.LngLat=Si,a.LngLatBounds=ma,a.MercatorCoordinate=Zh,a.ONE_EM=Xi,a.OverscaledTileID=un,a.PerformanceUtils=o0,a.PosArray=class extends zs{},a.Properties=Ni,a.QuadTriangleArray=class extends F{},a.RGBAImage=Jr,a.RasterBoundsArray=class extends ua{},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=gs,a.SegmentVector=$e,a.SymbolBucket=uo,a.Transitionable=ml,a.TriangleIndexArray=pr,a.Uniform1f=ks,a.Uniform1i=class extends cn{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 cn{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 cn{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=vp,a.UniformColor=bp,a.UniformMatrix4f=class extends cn{constructor(i,t){super(i,t),this.current=Ag}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=Cd,a.ValidationError=zt,a.ZoomHistory=aa,a.addDynamicAttributes=Au,a.asyncAll=function(i,t,r){if(!i.length)return r(null,[]);let l=i.length,u=new Array(i.length),f=null;i.forEach((m,x)=>{t(m,(b,E)=>{b&&(f=b),u[x]=E,--l==0&&r(f,u)})})},a.bezier=D,a.bindAll=ft,a.cacheEntryPossiblyAdded=function(i){sn++,sn>Dr&&(i.getActor().send("enforceCacheSizeLimit",Lr),sn=0)},a.clamp=L,a.clearTileCache=function(i){let t=caches.delete(rn);i&&t.catch(i).then(()=>i())},a.clipLine=fd,a.clone=function(i){var t=new no(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=Dt,a.collisionCircleLayout=Ty,a.config=Wr,a.create=function(){var i=new no(16);return no!=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=Na,a.createFilter=ja,a.createLayout=Ui,a.createStyleLayer=function(i){return i.type==="custom"?new r0(i):new n0[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=vh,a.enforceCacheSizeLimit=function(i){nn(),bi&&bi.then(t=>{t.keys().then(r=>{for(let l=0;l<r.length-i;l++)t.delete(r[l])})})},a.evaluateSizeForFeature=function(i,{uSize:t,uSizeT:r},{lowerSize:l,upperSize:u}){return i.kind==="source"?l/Yn:i.kind==="composite"?zi(l/Yn,u/Yn,r):t},a.evaluateSizeForZoom=function(i,t){let r=0,l=0;if(i.kind==="constant")l=i.layoutSize;else if(i.kind!=="source"){let{interpolationType:u,minZoom:f,maxZoom:m}=i,x=u?L(xr.interpolationFactor(u,t,f,m),0,1):0;i.kind==="camera"?l=zi(i.minSize,i.maxSize,x):r=x}return{uSizeT:r,uSize:l}},a.evaluateVariableOffset=yd,a.evented=Ps,a.exported=$r,a.exported$1=yr,a.extend=pt,a.filterObject=Ct,a.getAnchorAlignment=Eu,a.getAnchorJustification=Cu,a.getArrayBuffer=Br,a.getImage=V,a.getJSON=function(i,t){return yn(pt(i,{type:"json"}),t)},a.getOverlapMode=Lu,a.getRTLTextPluginStatus=fl,a.getReferrer=an,a.getVideo=function(i,t){let r=window.document.createElement("video");r.muted=!0,r.onloadstart=function(){t(null,r)};for(let l=0;l<i.length;l++){let u=window.document.createElement("source");ys(i[l])||(r.crossOrigin="Anonymous"),u.src=i[l],r.appendChild(u)}return{cancel:()=>{}}},a.identity=lu,a.invert=function(i,t){var r=t[0],l=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],tt=t[13],et=t[14],dt=t[15],bt=r*x-l*m,xt=r*b-u*m,Et=r*E-f*m,Ot=l*b-u*x,Lt=l*E-f*x,re=u*E-f*b,ue=A*tt-z*G,Jt=A*et-R*G,Yt=A*dt-O*G,Zt=z*et-R*tt,ee=z*dt-O*tt,Qt=R*dt-O*et,qt=bt*Qt-xt*ee+Et*Zt+Ot*Yt-Lt*Jt+re*ue;return qt?(i[0]=(x*Qt-b*ee+E*Zt)*(qt=1/qt),i[1]=(u*ee-l*Qt-f*Zt)*qt,i[2]=(tt*re-et*Lt+dt*Ot)*qt,i[3]=(R*Lt-z*re-O*Ot)*qt,i[4]=(b*Yt-m*Qt-E*Jt)*qt,i[5]=(r*Qt-u*Yt+f*Jt)*qt,i[6]=(et*Et-G*re-dt*xt)*qt,i[7]=(A*re-R*Et+O*xt)*qt,i[8]=(m*ee-x*Yt+E*ue)*qt,i[9]=(l*Yt-r*ee-f*ue)*qt,i[10]=(G*Lt-tt*Et+dt*bt)*qt,i[11]=(z*Et-A*Lt-O*bt)*qt,i[12]=(x*Jt-m*Zt-b*ue)*qt,i[13]=(r*Zt-l*Jt+u*ue)*qt,i[14]=(tt*xt-G*Ot-et*bt)*qt,i[15]=(A*Ot-z*xt+R*bt)*qt,i):null},a.isImageBitmap=Oi,a.isSafari=Yi,a.keysDifference=function(i,t){let r=[];for(let l in i)l in t||r.push(l);return r},a.lazyLoadRTLTextPlugin=function(){Fr.isLoading()||Fr.isLoaded()||fl()!=="deferred"||Xa()},a.makeRequest=yn,a.mapObject=Rt,a.mercatorXfromLng=Sd,a.mercatorYfromLat=Td,a.mercatorZfromAltitude=Ed,a.mul=Fg,a.multiply=Ap,a.nextPowerOfTwo=function(i){return i<=1?1:Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))},a.number=zi,a.ortho=function(i,t,r,l,u,f,m){var x=1/(t-r),b=1/(l-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+l)*b,i[14]=(m+f)*E,i[15]=1,i},a.parseCacheControl=Ce,a.parseGlyphPBF=function(i){return new wu(i).readFields(By,[])},a.pbf=wu,a.performSymbolLayout=function(i,t,r,l,u,f,m){i.createArrays(),i.tilePixelRatio=Vi/(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 ci(i.zoom+1),m),layoutTextSize:b["text-size"].possiblyEvaluate(new ci(i.zoom+1),m),textMaxSize:b["text-size"].possiblyEvaluate(new ci(18))};if(i.textSizeData.kind==="composite"){let{minZoom:G,maxZoom:tt}=i.textSizeData;E.compositeTextSizes=[b["text-size"].possiblyEvaluate(new ci(G),m),b["text-size"].possiblyEvaluate(new ci(tt),m)]}if(i.iconSizeData.kind==="composite"){let{minZoom:G,maxZoom:tt}=i.iconSizeData;E.compositeIconSizes=[b["icon-size"].possiblyEvaluate(new ci(G),m),b["icon-size"].possiblyEvaluate(new ci(tt),m)]}let A=x.get("text-line-height")*Xi,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 tt=x.get("text-font").evaluate(G,{},m).join(","),et=O.evaluate(G,{},m),dt=E.layoutTextSize.evaluate(G,{},m),bt=E.layoutIconSize.evaluate(G,{},m),xt={horizontal:{},vertical:void 0},Et=G.text,Ot,Lt=[0,0];if(Et){let Jt=Et.toString(),Yt=x.get("text-letter-spacing").evaluate(G,{},m)*Xi,Zt=bh(Jt)?Yt:0,ee=x.get("text-anchor").evaluate(G,{},m),Qt=x.get("text-variable-anchor");if(!Qt){let Je=x.get("text-radial-offset").evaluate(G,{},m);Lt=Je?yd(ee,[Je*Xi,Iu]):x.get("text-offset").evaluate(G,{},m).map(pi=>pi*Xi)}let qt=z?"center":x.get("text-justify").evaluate(G,{},m),_e=x.get("symbol-placement"),de=_e==="point"?x.get("text-max-width").evaluate(G,{},m)*Xi:0,Ne=()=>{i.allowVerticalPlacement&&hl(Jt)&&(xt.vertical=Nh(Et,t,r,u,tt,de,A,ee,"left",Zt,Lt,a.WritingMode.vertical,!0,_e,dt,et))};if(!z&&Qt){let Je=qt==="auto"?Qt.map(di=>Cu(di)):[qt],pi=!1;for(let di=0;di<Je.length;di++){let Qi=Je[di];if(!xt.horizontal[Qi])if(pi)xt.horizontal[Qi]=xt.horizontal[0];else{let Li=Nh(Et,t,r,u,tt,de,A,"center",Qi,Zt,Lt,a.WritingMode.horizontal,!1,_e,dt,et);Li&&(xt.horizontal[Qi]=Li,pi=Li.positionedLines.length===1)}}Ne()}else{qt==="auto"&&(qt=Cu(ee));let Je=Nh(Et,t,r,u,tt,de,A,ee,qt,Zt,Lt,a.WritingMode.horizontal,!1,_e,dt,et);Je&&(xt.horizontal[qt]=Je),Ne(),hl(Jt)&&z&&R&&(xt.vertical=Nh(Et,t,r,u,tt,de,A,ee,qt,Zt,Lt,a.WritingMode.vertical,!1,_e,dt,et))}}let re=!1;if(G.icon&&G.icon.name){let Jt=l[G.icon.name];Jt&&(Ot=Gy(u[G.icon.name],x.get("icon-offset").evaluate(G,{},m),x.get("icon-anchor").evaluate(G,{},m)),re=!!Jt.sdf,i.sdfIcons===void 0?i.sdfIcons=re:i.sdfIcons!==re&&Ht("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(Jt.pixelRatio!==i.pixelRatio||x.get("icon-rotate").constantOr(1)!==0)&&(i.iconsNeedLinear=!0))}let ue=xd(xt.horizontal)||xt.vertical;i.iconsInText=!!ue&&ue.iconsInText,(ue||Ot)&&Xy(i,G,xt,Ot,l,E,dt,bt,Lt,re,m)}f&&i.generateCollisionDebugBuffers()},a.perspective=function(i,t,r,l,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+l)*(f=1/(l-u)),i[14]=2*u*l*f):(i[10]=-1,i[14]=-2*l),i},a.pick=function(i,t){let r={};for(let l=0;l<t.length;l++){let u=t[l];u in i&&(r[u]=i[u])}return r},a.plugin=Fr,a.pointGeometry=ve,a.polygonIntersectsPolygon=Tp,a.potpack=ed,a.refProperties=["type","source","source-layer","minzoom","maxzoom","filter","layout"],a.register=ie,a.registerForPluginStateChange=function(i){return i({pluginStatus:cr,pluginURL:In}),Ps.on("pluginStateChange",i),i},a.renderColorRamp=Lp,a.rotateX=function(i,t,r){var l=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*l,i[5]=m*u+A*l,i[6]=x*u+z*l,i[7]=b*u+R*l,i[8]=E*u-f*l,i[9]=A*u-m*l,i[10]=z*u-x*l,i[11]=R*u-b*l,i},a.rotateZ=function(i,t,r){var l=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*l,i[1]=m*u+A*l,i[2]=x*u+z*l,i[3]=b*u+R*l,i[4]=E*u-f*l,i[5]=A*u-m*l,i[6]=z*u-x*l,i[7]=R*u-b*l,i},a.scale=function(i,t,r){var l=r[0],u=r[1],f=r[2];return i[0]=t[0]*l,i[1]=t[1]*l,i[2]=t[2]*l,i[3]=t[3]*l,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){Lr=i,Dr=t},a.setRTLTextPlugin=function(i,t,r=!1){if(cr===Ha||cr===cl||cr===ul)throw new Error("setRTLTextPlugin cannot be called multiple times.");In=$r.resolveURL(i),cr=Ha,pl=t,dl(),r||Xa()},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=fa,a.transformMat4=kh,a.translate=function(i,t,r){var l,u,f,m,x,b,E,A,z,R,O,G,tt=r[0],et=r[1],dt=r[2];return t===i?(i[12]=t[0]*tt+t[4]*et+t[8]*dt+t[12],i[13]=t[1]*tt+t[5]*et+t[9]*dt+t[13],i[14]=t[2]*tt+t[6]*et+t[10]*dt+t[14],i[15]=t[3]*tt+t[7]*et+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]=l=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]=l*tt+x*et+z*dt+t[12],i[13]=u*tt+b*et+R*dt+t[13],i[14]=f*tt+E*et+O*dt+t[14],i[15]=m*tt+A*et+G*dt+t[15]),i},a.triggerPluginCompletionEvent=Sh,a.unicodeBlockLookup=Xt,a.uniqueId=function(){return ot++},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=Kc,a.validateStyle=qn,a.vectorTile=Rs,a.warnOnce=Ht,a.wrap=Q}),g(["./shared"],function(a){"use strict";function M(Z){let I=typeof Z;if(I==="number"||I==="boolean"||I==="string"||Z==null)return JSON.stringify(Z);if(Array.isArray(Z)){let H="[";for(let K of Z)H+=`${M(K)},`;return`${H}]`}let P=Object.keys(Z).sort(),q="{";for(let H=0;H<P.length;H++)q+=`${JSON.stringify(P[H])}:${M(Z[P[H]])},`;return`${q}}`}function S(Z){let I="";for(let P of a.refProperties)I+=`/${M(Z[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 K=this._layers[H.id]=a.createStyleLayer(H);K._featureFilter=a.createFilter(K.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,K){let st={};for(let rt=0;rt<H.length;rt++){let at=K&&K[H[rt].id]||S(H[rt]);K&&(K[H[rt].id]=at);let St=st[at];St||(St=st[at]=[]),St.push(H[rt])}let it=[];for(let rt in st)it.push(st[rt]);return it}(Object.values(this._layerConfigs),this.keyCache);for(let H of q){let K=H.map(Bt=>this._layers[Bt.id]),st=K[0];if(st.visibility==="none")continue;let it=st.source||"",rt=this.familiesBySource[it];rt||(rt=this.familiesBySource[it]={});let at=st.sourceLayer||"_geojsonTileLayer",St=rt[at];St||(St=rt[at]=[]),St.push(K)}}}class N{constructor(I){let P={},q=[];for(let it in I){let rt=I[it],at=P[it]={};for(let St in rt){let Bt=rt[+St];if(!Bt||Bt.bitmap.width===0||Bt.bitmap.height===0)continue;let wt={x:0,y:0,w:Bt.bitmap.width+2,h:Bt.bitmap.height+2};q.push(wt),at[St]={rect:wt,metrics:Bt.metrics}}}let{w:H,h:K}=a.potpack(q),st=new a.AlphaImage({width:H||1,height:K||1});for(let it in I){let rt=I[it];for(let at in rt){let St=rt[+at];if(!St||St.bitmap.width===0||St.bitmap.height===0)continue;let Bt=P[it][at].rect;a.AlphaImage.copy(St.bitmap,st,{x:0,y:0},{x:Bt.x+1,y:Bt.y+1},St.bitmap)}}this.image=st,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,K){this.status="parsing",this.data=I,this.collisionBoxArray=new a.CollisionBoxArray;let st=new a.DictionaryCoder(Object.keys(I.layers).sort()),it=new a.FeatureIndex(this.tileID,this.promoteId);it.bucketLayerIDs=[];let rt={},at={featureIndex:it,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:q},St=P.familiesBySource[this.source];for(let Le in St){let Ie=I.layers[Le];if(!Ie)continue;Ie.version===1&&a.warnOnce(`Vector tile source "${this.source}" layer "${Le}" does not use vector tile spec v2 and therefore may have some rendering errors.`);let Te=st.encode(Le),Ti=[];for(let wi=0;wi<Ie.length;wi++){let qi=Ie.feature(wi),Zi=it.getId(qi,Le);Ti.push({feature:qi,id:Zi,index:wi,sourceLayerIndex:Te})}for(let wi of St[Le]){let qi=wi[0];qi.minzoom&&this.zoom<Math.floor(qi.minzoom)||qi.maxzoom&&this.zoom>=qi.maxzoom||qi.visibility!=="none"&&(Q(wi,this.zoom,q),(rt[qi.id]=qi.createBucket({index:it.bucketLayerIDs.length,layers:wi,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:Te,sourceID:this.source})).populate(Ti,at,this.tileID.canonical),it.bucketLayerIDs.push(wi.map(Zi=>Zi.id)))}}let Bt,wt,ae,te,he=a.mapObject(at.glyphDependencies,Le=>Object.keys(Le).map(Number));Object.keys(he).length?H.send("getGlyphs",{uid:this.uid,stacks:he},(Le,Ie)=>{Bt||(Bt=Le,wt=Ie,Fe.call(this))}):wt={};let ge=Object.keys(at.iconDependencies);ge.length?H.send("getImages",{icons:ge,source:this.source,tileID:this.tileID,type:"icons"},(Le,Ie)=>{Bt||(Bt=Le,ae=Ie,Fe.call(this))}):ae={};let Ge=Object.keys(at.patternDependencies);function Fe(){if(Bt)return K(Bt);if(wt&&ae&&te){let Le=new N(wt),Ie=new a.ImageAtlas(ae,te);for(let Te in rt){let Ti=rt[Te];Ti instanceof a.SymbolBucket?(Q(Ti.layers,this.zoom,q),a.performSymbolLayout(Ti,wt,Le.positions,ae,Ie.iconPositions,this.showCollisionBoxes,this.tileID.canonical)):Ti.hasPattern&&(Ti instanceof a.LineBucket||Ti instanceof a.FillBucket||Ti instanceof a.FillExtrusionBucket)&&(Q(Ti.layers,this.zoom,q),Ti.addFeatures(at,this.tileID.canonical,Ie.patternPositions))}this.status="done",K(null,{buckets:Object.values(rt).filter(Te=>!Te.isEmpty()),featureIndex:it,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:Le.image,imageAtlas:Ie,glyphMap:this.returnDependencies?wt:null,iconMap:this.returnDependencies?ae:null,glyphPositions:this.returnDependencies?Le.positions:null})}}Ge.length?H.send("getImages",{icons:Ge,source:this.source,tileID:this.tileID,type:"patterns"},(Le,Ie)=>{Bt||(Bt=Le,te=Ie,Fe.call(this))}):te={},Fe.call(this)}}function Q(Z,I,P){let q=new a.EvaluationParameters(I);for(let H of Z)H.recalculate(q,P)}function pt(Z,I){let P=a.getArrayBuffer(Z.request,(q,H,K,st)=>{q?I(q):H&&I(null,{vectorTile:new a.vectorTile.VectorTile(new a.pbf(H)),rawData:H,cacheControl:K,expires:st})});return()=>{P.cancel(),I()}}class ot{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),K=this.loading[q]=new L(I);K.abort=this.loadVectorData(I,(st,it)=>{if(delete this.loading[q],st||!it)return K.status="done",this.loaded[q]=K,P(st);let rt=it.rawData,at={};it.expires&&(at.expires=it.expires),it.cacheControl&&(at.cacheControl=it.cacheControl);let St={};if(H){let Bt=H.finish();Bt&&(St.resourceTiming=JSON.parse(JSON.stringify(Bt)))}K.vectorTile=it.vectorTile,K.parse(it.vectorTile,this.layerIndex,this.availableImages,this.actor,(Bt,wt)=>{if(Bt||!wt)return P(Bt);P(null,a.extend({rawTileData:rt.slice(0)},wt,at,St))}),this.loaded=this.loaded||{},this.loaded[q]=K})}reloadTile(I,P){let q=this.loaded,H=I.uid,K=this;if(q&&q[H]){let st=q[H];st.showCollisionBoxes=I.showCollisionBoxes;let it=(rt,at)=>{let St=st.reloadCallback;St&&(delete st.reloadCallback,st.parse(st.vectorTile,K.layerIndex,this.availableImages,K.actor,St)),P(rt,at)};st.status==="parsing"?st.reloadCallback=it:st.status==="done"&&(st.vectorTile?st.parse(st.vectorTile,this.layerIndex,this.availableImages,this.actor,it):it())}}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 ft{constructor(){this.loaded={}}loadTile(I,P){let{uid:q,encoding:H,rawImageData:K}=I,st=a.isImageBitmap(K)?this.getImageData(K):K,it=new a.DEMData(q,st,H);this.loaded=this.loaded||{},this.loaded[q]=it,P(null,it)}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 Rt=function Z(I,P){var q,H=I&&I.type;if(H==="FeatureCollection")for(q=0;q<I.features.length;q++)Z(I.features[q],P);else if(H==="GeometryCollection")for(q=0;q<I.geometries.length;q++)Z(I.geometries[q],P);else if(H==="Feature")Z(I.geometry,P);else if(H==="Polygon")Ct(I.coordinates,P);else if(H==="MultiPolygon")for(q=0;q<I.coordinates.length;q++)Ct(I.coordinates[q],P);return I};function Ct(Z,I){if(Z.length!==0){Dt(Z[0],I);for(var P=1;P<Z.length;P++)Dt(Z[P],!I)}}function Dt(Z,I){for(var P=0,q=0,H=0,K=Z.length,st=K-1;H<K;st=H++){var it=(Z[H][0]-Z[st][0])*(Z[st][1]+Z[H][1]),rt=P+it;q+=Math.abs(P)>=Math.abs(it)?P-rt+it:it-rt+P,P=rt}P+q>=0!=!!I&&Z.reverse()}let ne=a.vectorTile.VectorTileFeature.prototype.toGeoJSON;class Ht{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 ne.call(this,I,P,q)}}class fe{constructor(I){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=a.EXTENT,this.length=I.length,this._features=I}feature(I){return new Ht(this._features[I])}}var me={exports:{}},oe=a.pointGeometry,Ce=a.vectorTile.VectorTileFeature,Re=mi;function mi(Z,I){this.options=I||{},this.features=Z,this.length=Z.length}function Fi(Z,I){this.id=typeof Z.id=="number"?Z.id:void 0,this.type=Z.type,this.rawGeometry=Z.type===1?[Z.geometry]:Z.geometry,this.properties=Z.tags,this.extent=I||4096}mi.prototype.feature=function(Z){return new Fi(this.features[Z],this.options.extent)},Fi.prototype.loadGeometry=function(){var Z=this.rawGeometry;this.geometry=[];for(var I=0;I<Z.length;I++){for(var P=Z[I],q=[],H=0;H<P.length;H++)q.push(new oe(P[H][0],P[H][1]));this.geometry.push(q)}return this.geometry},Fi.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var Z=this.geometry,I=1/0,P=-1/0,q=1/0,H=-1/0,K=0;K<Z.length;K++)for(var st=Z[K],it=0;it<st.length;it++){var rt=st[it];I=Math.min(I,rt.x),P=Math.max(P,rt.x),q=Math.min(q,rt.y),H=Math.max(H,rt.y)}return[I,q,P,H]},Fi.prototype.toGeoJSON=Ce.prototype.toGeoJSON;var Yi=a.pbf,Oi=Re;function $r(Z){var I=new Yi;return function(P,q){for(var H in P.layers)q.writeMessage(3,ve,P.layers[H])}(Z,I),I.finish()}function ve(Z,I){var P;I.writeVarintField(15,Z.version||1),I.writeStringField(1,Z.name||""),I.writeVarintField(5,Z.extent||4096);var q={keys:[],values:[],keycache:{},valuecache:{}};for(P=0;P<Z.length;P++)q.feature=Z.feature(P),I.writeMessage(2,kr,q);var H=q.keys;for(P=0;P<H.length;P++)I.writeStringField(3,H[P]);var K=q.values;for(P=0;P<K.length;P++)I.writeMessage(4,Lr,K[P])}function kr(Z,I){var P=Z.feature;P.id!==void 0&&I.writeVarintField(1,P.id),I.writeMessage(2,Wr,Z),I.writeVarintField(3,P.type),I.writeMessage(4,gn,P)}function Wr(Z,I){var P=Z.feature,q=Z.keys,H=Z.values,K=Z.keycache,st=Z.valuecache;for(var it in P.properties){var rt=P.properties[it],at=K[it];if(rt!==null){at===void 0&&(q.push(it),K[it]=at=q.length-1),I.writeVarint(at);var St=typeof rt;St!=="string"&&St!=="boolean"&&St!=="number"&&(rt=JSON.stringify(rt));var Bt=St+":"+rt,wt=st[Bt];wt===void 0&&(H.push(rt),st[Bt]=wt=H.length-1),I.writeVarint(wt)}}}function rn(Z,I){return(I<<3)+(7&Z)}function bi(Z){return Z<<1^Z>>31}function gn(Z,I){for(var P=Z.loadGeometry(),q=Z.type,H=0,K=0,st=P.length,it=0;it<st;it++){var rt=P[it],at=1;q===1&&(at=rt.length),I.writeVarint(rn(1,at));for(var St=q===3?rt.length-1:rt.length,Bt=0;Bt<St;Bt++){Bt===1&&q!==1&&I.writeVarint(rn(2,St-1));var wt=rt[Bt].x-H,ae=rt[Bt].y-K;I.writeVarint(bi(wt)),I.writeVarint(bi(ae)),H+=wt,K+=ae}q===3&&I.writeVarint(rn(7,1))}}function Lr(Z,I){var P=typeof Z;P==="string"?I.writeStringField(1,Z):P==="boolean"?I.writeBooleanField(7,Z):P==="number"&&(Z%1!=0?I.writeDoubleField(3,Z):Z<0?I.writeSVarintField(6,Z):I.writeVarintField(5,Z))}me.exports=$r,me.exports.fromVectorTileJs=$r,me.exports.fromGeojsonVt=function(Z,I){I=I||{};var P={};for(var q in Z)P[q]=new Oi(Z[q].features,I),P[q].name=q,P[q].version=I.version,P[q].extent=I.extent;return $r({layers:P})},me.exports.GeoJSONWrapper=Oi;var Dr=me.exports;function nn(Z,I,P,q,H,K){if(H-q<=P)return;let st=q+H>>1;sn(Z,I,st,q,H,K%2),nn(Z,I,P,q,st-1,K+1),nn(Z,I,P,st+1,H,K+1)}function sn(Z,I,P,q,H,K){for(;H>q;){if(H-q>600){let at=H-q+1,St=P-q+1,Bt=Math.log(at),wt=.5*Math.exp(2*Bt/3),ae=.5*Math.sqrt(Bt*wt*(at-wt)/at)*(St-at/2<0?-1:1);sn(Z,I,P,Math.max(q,Math.floor(P-St*wt/at+ae)),Math.min(H,Math.floor(P+(at-St)*wt/at+ae)),K)}let st=I[2*P+K],it=q,rt=H;for(yr(Z,I,q,P),I[2*H+K]>st&&yr(Z,I,q,H);it<rt;){for(yr(Z,I,it,rt),it++,rt--;I[2*it+K]<st;)it++;for(;I[2*rt+K]>st;)rt--}I[2*q+K]===st?yr(Z,I,q,rt):(rt++,yr(Z,I,rt,H)),rt<=P&&(q=rt+1),P<=rt&&(H=rt-1)}}function yr(Z,I,P,q){Rr(Z,P,q),Rr(I,2*P,2*q),Rr(I,2*P+1,2*q+1)}function Rr(Z,I,P){let q=Z[I];Z[I]=Z[P],Z[P]=q}function Zr(Z,I,P,q){let H=Z-P,K=I-q;return H*H+K*K}let En=Z=>Z[0],Bn=Z=>Z[1];class Fn{constructor(I,P=En,q=Bn,H=64,K=Float64Array){this.nodeSize=H,this.points=I;let st=I.length<65536?Uint16Array:Uint32Array,it=this.ids=new st(I.length),rt=this.coords=new K(2*I.length);for(let at=0;at<I.length;at++)it[at]=at,rt[2*at]=P(I[at]),rt[2*at+1]=q(I[at]);nn(it,rt,H,0,it.length-1,0)}range(I,P,q,H){return function(K,st,it,rt,at,St,Bt){let wt=[0,K.length-1,0],ae=[],te,he;for(;wt.length;){let ge=wt.pop(),Ge=wt.pop(),Fe=wt.pop();if(Ge-Fe<=Bt){for(let Te=Fe;Te<=Ge;Te++)te=st[2*Te],he=st[2*Te+1],te>=it&&te<=at&&he>=rt&&he<=St&&ae.push(K[Te]);continue}let Le=Math.floor((Fe+Ge)/2);te=st[2*Le],he=st[2*Le+1],te>=it&&te<=at&&he>=rt&&he<=St&&ae.push(K[Le]);let Ie=(ge+1)%2;(ge===0?it<=te:rt<=he)&&(wt.push(Fe),wt.push(Le-1),wt.push(Ie)),(ge===0?at>=te:St>=he)&&(wt.push(Le+1),wt.push(Ge),wt.push(Ie))}return ae}(this.ids,this.coords,I,P,q,H,this.nodeSize)}within(I,P,q){return function(H,K,st,it,rt,at){let St=[0,H.length-1,0],Bt=[],wt=rt*rt;for(;St.length;){let ae=St.pop(),te=St.pop(),he=St.pop();if(te-he<=at){for(let Ie=he;Ie<=te;Ie++)Zr(K[2*Ie],K[2*Ie+1],st,it)<=wt&&Bt.push(H[Ie]);continue}let ge=Math.floor((he+te)/2),Ge=K[2*ge],Fe=K[2*ge+1];Zr(Ge,Fe,st,it)<=wt&&Bt.push(H[ge]);let Le=(ae+1)%2;(ae===0?st-rt<=Ge:it-rt<=Fe)&&(St.push(he),St.push(ge-1),St.push(Le)),(ae===0?st+rt>=Ge:it+rt>=Fe)&&(St.push(ge+1),St.push(te),St.push(Le))}return Bt}(this.ids,this.coords,I,P,q,this.nodeSize)}}let gs={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:Z=>Z},ti=Math.fround||(an=new Float32Array(1),Z=>(an[0]=+Z,an[0]));var an;class On{constructor(I){this.options=X(Object.create(gs),I),this.trees=new Array(this.options.maxZoom+1)}load(I){let{log:P,minZoom:q,maxZoom:H,nodeSize:K}=this.options;P&&console.time("total time");let st=`prepare ${I.length} points`;P&&console.time(st),this.points=I;let it=[];for(let rt=0;rt<I.length;rt++)I[rt].geometry&&it.push(Br(I[rt],rt));this.trees[H+1]=new Fn(it,nt,_t,K,Float32Array),P&&console.timeEnd(st);for(let rt=H;rt>=q;rt--){let at=+Date.now();it=this._cluster(it,rt),this.trees[rt]=new Fn(it,nt,_t,K,Float32Array),P&&console.log("z%d: %d clusters in %dms",rt,it.length,+Date.now()-at)}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])),K=I[2]===180?180:((I[2]+180)%360+360)%360-180,st=Math.max(-90,Math.min(90,I[3]));if(I[2]-I[0]>=360)q=-180,K=180;else if(q>K){let St=this.getClusters([q,H,180,st],P),Bt=this.getClusters([-180,H,K,st],P);return St.concat(Bt)}let it=this.trees[this._limitZoom(P)],rt=it.range(U(q),B(st),U(K),B(H)),at=[];for(let St of rt){let Bt=it.points[St];at.push(Bt.numPoints?ys(Bt):this.points[Bt.index])}return at}getChildren(I){let P=this._getOriginId(I),q=this._getOriginZoom(I),H="No cluster with the specified id.",K=this.trees[q];if(!K)throw new Error(H);let st=K.points[P];if(!st)throw new Error(H);let it=this.options.radius/(this.options.extent*Math.pow(2,q-1)),rt=K.within(st.x,st.y,it),at=[];for(let St of rt){let Bt=K.points[St];Bt.parentId===I&&at.push(Bt.numPoints?ys(Bt):this.points[Bt.index])}if(at.length===0)throw new Error(H);return at}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)],K=Math.pow(2,I),{extent:st,radius:it}=this.options,rt=it/st,at=(q-rt)/K,St=(q+1+rt)/K,Bt={features:[]};return this._addTileFeatures(H.range((P-rt)/K,at,(P+1+rt)/K,St),H.points,P,q,K,Bt),P===0&&this._addTileFeatures(H.range(1-rt/K,at,1,St),H.points,K,q,K,Bt),P===K-1&&this._addTileFeatures(H.range(0,at,rt/K,St),H.points,-1,q,K,Bt),Bt.features.length?Bt: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,K){let st=this.getChildren(P);for(let it of st){let rt=it.properties;if(rt&&rt.cluster?K+rt.point_count<=H?K+=rt.point_count:K=this._appendLeaves(I,rt.cluster_id,q,H,K):K<H?K++:I.push(it),I.length===q)break}return K}_addTileFeatures(I,P,q,H,K,st){for(let it of I){let rt=P[it],at=rt.numPoints,St,Bt,wt;if(at)St=mt(rt),Bt=rt.x,wt=rt.y;else{let he=this.points[rt.index];St=he.properties,Bt=U(he.geometry.coordinates[0]),wt=B(he.geometry.coordinates[1])}let ae={type:1,geometry:[[Math.round(this.options.extent*(Bt*K-q)),Math.round(this.options.extent*(wt*K-H))]],tags:St},te;at?te=rt.id:this.options.generateId?te=rt.index:this.points[rt.index].id&&(te=this.points[rt.index].id),te!==void 0&&(ae.id=te),st.features.push(ae)}}_limitZoom(I){return Math.max(this.options.minZoom,Math.min(+I,this.options.maxZoom+1))}_cluster(I,P){let q=[],{radius:H,extent:K,reduce:st,minPoints:it}=this.options,rt=H/(K*Math.pow(2,P));for(let at=0;at<I.length;at++){let St=I[at];if(St.zoom<=P)continue;St.zoom=P;let Bt=this.trees[P+1],wt=Bt.within(St.x,St.y,rt),ae=St.numPoints||1,te=ae;for(let he of wt){let ge=Bt.points[he];ge.zoom>P&&(te+=ge.numPoints||1)}if(te>ae&&te>=it){let he=St.x*ae,ge=St.y*ae,Ge=st&&ae>1?this._map(St,!0):null,Fe=(at<<5)+(P+1)+this.points.length;for(let Le of wt){let Ie=Bt.points[Le];if(Ie.zoom<=P)continue;Ie.zoom=P;let Te=Ie.numPoints||1;he+=Ie.x*Te,ge+=Ie.y*Te,Ie.parentId=Fe,st&&(Ge||(Ge=this._map(St,!0)),st(Ge,this._map(Ie)))}St.parentId=Fe,q.push(yn(he/te,ge/te,Fe,te,Ge))}else if(q.push(St),te>1)for(let he of wt){let ge=Bt.points[he];ge.zoom<=P||(ge.zoom=P,q.push(ge))}}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 yn(Z,I,P,q,H){return{x:ti(Z),y:ti(I),zoom:1/0,id:P,parentId:-1,numPoints:q,properties:H}}function Br(Z,I){let[P,q]=Z.geometry.coordinates;return{x:ti(U(P)),y:ti(B(q)),zoom:1/0,index:I,parentId:-1}}function ys(Z){return{type:"Feature",id:Z.id,properties:mt(Z),geometry:{type:"Point",coordinates:[(I=Z.x,360*(I-.5)),V(Z.y)]}};var I}function mt(Z){let I=Z.numPoints,P=I>=1e4?`${Math.round(I/1e3)}k`:I>=1e3?Math.round(I/100)/10+"k":I;return X(X({},Z.properties),{cluster:!0,cluster_id:Z.id,point_count:I,point_count_abbreviated:P})}function U(Z){return Z/360+.5}function B(Z){let I=Math.sin(Z*Math.PI/180),P=.5-.25*Math.log((1+I)/(1-I))/Math.PI;return P<0?0:P>1?1:P}function V(Z){let I=(180-360*Z)*Math.PI/180;return 360*Math.atan(Math.exp(I))/Math.PI-90}function X(Z,I){for(let P in I)Z[P]=I[P];return Z}function nt(Z){return Z.x}function _t(Z){return Z.y}function Ft(Z,I,P,q){for(var H,K=q,st=P-I>>1,it=P-I,rt=Z[I],at=Z[I+1],St=Z[P],Bt=Z[P+1],wt=I+3;wt<P;wt+=3){var ae=Vt(Z[wt],Z[wt+1],rt,at,St,Bt);if(ae>K)H=wt,K=ae;else if(ae===K){var te=Math.abs(wt-st);te<it&&(H=wt,it=te)}}K>q&&(H-I>3&&Ft(Z,I,H,q),Z[H+2]=K,P-H>3&&Ft(Z,H,P,q))}function Vt(Z,I,P,q,H,K){var st=H-P,it=K-q;if(st!==0||it!==0){var rt=((Z-P)*st+(I-q)*it)/(st*st+it*it);rt>1?(P=H,q=K):rt>0&&(P+=st*rt,q+=it*rt)}return(st=Z-P)*st+(it=I-q)*it}function ct(Z,I,P,q){var H={id:Z===void 0?null:Z,type:I,geometry:P,tags:q,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(K){var st=K.geometry,it=K.type;if(it==="Point"||it==="MultiPoint"||it==="LineString")zt(K,st);else if(it==="Polygon"||it==="MultiLineString")for(var rt=0;rt<st.length;rt++)zt(K,st[rt]);else if(it==="MultiPolygon")for(rt=0;rt<st.length;rt++)for(var at=0;at<st[rt].length;at++)zt(K,st[rt][at])}(H),H}function zt(Z,I){for(var P=0;P<I.length;P+=3)Z.minX=Math.min(Z.minX,I[P]),Z.minY=Math.min(Z.minY,I[P+1]),Z.maxX=Math.max(Z.maxX,I[P]),Z.maxY=Math.max(Z.maxY,I[P+1])}function Ee(Z,I,P,q){if(I.geometry){var H=I.geometry.coordinates,K=I.geometry.type,st=Math.pow(P.tolerance/((1<<P.maxZoom)*P.extent),2),it=[],rt=I.id;if(P.promoteId?rt=I.properties[P.promoteId]:P.generateId&&(rt=q||0),K==="Point")Ae(H,it);else if(K==="MultiPoint")for(var at=0;at<H.length;at++)Ae(H[at],it);else if(K==="LineString")ce(H,it,st,!1);else if(K==="MultiLineString"){if(P.lineMetrics){for(at=0;at<H.length;at++)ce(H[at],it=[],st,!1),Z.push(ct(rt,"LineString",it,I.properties));return}Ve(H,it,st,!1)}else if(K==="Polygon")Ve(H,it,st,!0);else{if(K!=="MultiPolygon"){if(K==="GeometryCollection"){for(at=0;at<I.geometry.geometries.length;at++)Ee(Z,{id:rt,geometry:I.geometry.geometries[at],properties:I.properties},P,q);return}throw new Error("Input data is not a valid GeoJSON object.")}for(at=0;at<H.length;at++){var St=[];Ve(H[at],St,st,!0),it.push(St)}}Z.push(ct(rt,K,it,I.properties))}}function Ae(Z,I){I.push(Pe(Z[0])),I.push(ei(Z[1])),I.push(0)}function ce(Z,I,P,q){for(var H,K,st=0,it=0;it<Z.length;it++){var rt=Pe(Z[it][0]),at=ei(Z[it][1]);I.push(rt),I.push(at),I.push(0),it>0&&(st+=q?(H*at-rt*K)/2:Math.sqrt(Math.pow(rt-H,2)+Math.pow(at-K,2))),H=rt,K=at}var St=I.length-3;I[2]=1,Ft(I,0,St,P),I[St+2]=1,I.size=Math.abs(st),I.start=0,I.end=I.size}function Ve(Z,I,P,q){for(var H=0;H<Z.length;H++){var K=[];ce(Z[H],K,P,q),I.push(K)}}function Pe(Z){return Z/360+.5}function ei(Z){var I=Math.sin(Z*Math.PI/180),P=.5-.25*Math.log((1+I)/(1-I))/Math.PI;return P<0?0:P>1?1:P}function ke(Z,I,P,q,H,K,st,it){if(q/=I,K>=(P/=I)&&st<q)return Z;if(st<P||K>=q)return null;for(var rt=[],at=0;at<Z.length;at++){var St=Z[at],Bt=St.geometry,wt=St.type,ae=H===0?St.minX:St.minY,te=H===0?St.maxX:St.maxY;if(ae>=P&&te<q)rt.push(St);else if(!(te<P||ae>=q)){var he=[];if(wt==="Point"||wt==="MultiPoint")Gt(Bt,he,P,q,H);else if(wt==="LineString")xe(Bt,he,P,q,H,!1,it.lineMetrics);else if(wt==="MultiLineString")oi(Bt,he,P,q,H,!1);else if(wt==="Polygon")oi(Bt,he,P,q,H,!0);else if(wt==="MultiPolygon")for(var ge=0;ge<Bt.length;ge++){var Ge=[];oi(Bt[ge],Ge,P,q,H,!0),Ge.length&&he.push(Ge)}if(he.length){if(it.lineMetrics&&wt==="LineString"){for(ge=0;ge<he.length;ge++)rt.push(ct(St.id,wt,he[ge],St.tags));continue}wt!=="LineString"&&wt!=="MultiLineString"||(he.length===1?(wt="LineString",he=he[0]):wt="MultiLineString"),wt!=="Point"&&wt!=="MultiPoint"||(wt=he.length===3?"Point":"MultiPoint"),rt.push(ct(St.id,wt,he,St.tags))}}}return rt.length?rt:null}function Gt(Z,I,P,q,H){for(var K=0;K<Z.length;K+=3){var st=Z[K+H];st>=P&&st<=q&&(I.push(Z[K]),I.push(Z[K+1]),I.push(Z[K+2]))}}function xe(Z,I,P,q,H,K,st){for(var it,rt,at=pe(Z),St=H===0?be:rr,Bt=Z.start,wt=0;wt<Z.length-3;wt+=3){var ae=Z[wt],te=Z[wt+1],he=Z[wt+2],ge=Z[wt+3],Ge=Z[wt+4],Fe=H===0?ae:te,Le=H===0?ge:Ge,Ie=!1;st&&(it=Math.sqrt(Math.pow(ae-ge,2)+Math.pow(te-Ge,2))),Fe<P?Le>P&&(rt=St(at,ae,te,ge,Ge,P),st&&(at.start=Bt+it*rt)):Fe>q?Le<q&&(rt=St(at,ae,te,ge,Ge,q),st&&(at.start=Bt+it*rt)):Wi(at,ae,te,he),Le<P&&Fe>=P&&(rt=St(at,ae,te,ge,Ge,P),Ie=!0),Le>q&&Fe<=q&&(rt=St(at,ae,te,ge,Ge,q),Ie=!0),!K&&Ie&&(st&&(at.end=Bt+it*rt),I.push(at),at=pe(Z)),st&&(Bt+=it)}var Te=Z.length-3;ae=Z[Te],te=Z[Te+1],he=Z[Te+2],(Fe=H===0?ae:te)>=P&&Fe<=q&&Wi(at,ae,te,he),Te=at.length-3,K&&Te>=3&&(at[Te]!==at[0]||at[Te+1]!==at[1])&&Wi(at,at[0],at[1],at[2]),at.length&&I.push(at)}function pe(Z){var I=[];return I.size=Z.size,I.start=Z.start,I.end=Z.end,I}function oi(Z,I,P,q,H,K){for(var st=0;st<Z.length;st++)xe(Z[st],I,P,q,H,K,!1)}function Wi(Z,I,P,q){Z.push(I),Z.push(P),Z.push(q)}function be(Z,I,P,q,H,K){var st=(K-I)/(q-I);return Z.push(K),Z.push(P+(H-P)*st),Z.push(1),st}function rr(Z,I,P,q,H,K){var st=(K-P)/(H-P);return Z.push(I+(q-I)*st),Z.push(K),Z.push(1),st}function yi(Z,I){for(var P=[],q=0;q<Z.length;q++){var H,K=Z[q],st=K.type;if(st==="Point"||st==="MultiPoint"||st==="LineString")H=nr(K.geometry,I);else if(st==="MultiLineString"||st==="Polygon"){H=[];for(var it=0;it<K.geometry.length;it++)H.push(nr(K.geometry[it],I))}else if(st==="MultiPolygon")for(H=[],it=0;it<K.geometry.length;it++){for(var rt=[],at=0;at<K.geometry[it].length;at++)rt.push(nr(K.geometry[it][at],I));H.push(rt)}P.push(ct(K.id,st,H,K.tags))}return P}function nr(Z,I){var P=[];P.size=Z.size,Z.start!==void 0&&(P.start=Z.start,P.end=Z.end);for(var q=0;q<Z.length;q+=3)P.push(Z[q]+I,Z[q+1],Z[q+2]);return P}function ni(Z,I){if(Z.transformed)return Z;var P,q,H,K=1<<Z.z,st=Z.x,it=Z.y;for(P=0;P<Z.features.length;P++){var rt=Z.features[P],at=rt.geometry,St=rt.type;if(rt.geometry=[],St===1)for(q=0;q<at.length;q+=2)rt.geometry.push(Xe(at[q],at[q+1],I,K,st,it));else for(q=0;q<at.length;q++){var Bt=[];for(H=0;H<at[q].length;H+=2)Bt.push(Xe(at[q][H],at[q][H+1],I,K,st,it));rt.geometry.push(Bt)}}return Z.transformed=!0,Z}function Xe(Z,I,P,q,H,K){return[Math.round(P*(Z*q-H)),Math.round(P*(I*q-K))]}function Gi(Z,I,P,q,H){for(var K=I===H.maxZoom?0:H.tolerance/((1<<I)*H.extent),st={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},it=0;it<Z.length;it++){st.numFeatures++,_r(st,Z[it],K,H);var rt=Z[it].minX,at=Z[it].minY,St=Z[it].maxX,Bt=Z[it].maxY;rt<st.minX&&(st.minX=rt),at<st.minY&&(st.minY=at),St>st.maxX&&(st.maxX=St),Bt>st.maxY&&(st.maxY=Bt)}return st}function _r(Z,I,P,q){var H=I.geometry,K=I.type,st=[];if(K==="Point"||K==="MultiPoint")for(var it=0;it<H.length;it+=3)st.push(H[it]),st.push(H[it+1]),Z.numPoints++,Z.numSimplified++;else if(K==="LineString")_i(st,H,Z,P,!1,!1);else if(K==="MultiLineString"||K==="Polygon")for(it=0;it<H.length;it++)_i(st,H[it],Z,P,K==="Polygon",it===0);else if(K==="MultiPolygon")for(var rt=0;rt<H.length;rt++){var at=H[rt];for(it=0;it<at.length;it++)_i(st,at[it],Z,P,!0,it===0)}if(st.length){var St=I.tags||null;if(K==="LineString"&&q.lineMetrics){for(var Bt in St={},I.tags)St[Bt]=I.tags[Bt];St.mapbox_clip_start=H.start/H.size,St.mapbox_clip_end=H.end/H.size}var wt={geometry:st,type:K==="Polygon"||K==="MultiPolygon"?3:K==="LineString"||K==="MultiLineString"?2:1,tags:St};I.id!==null&&(wt.id=I.id),Z.features.push(wt)}}function _i(Z,I,P,q,H,K){var st=q*q;if(q>0&&I.size<(H?st:q))P.numPoints+=I.length/3;else{for(var it=[],rt=0;rt<I.length;rt+=3)(q===0||I[rt+2]>st)&&(P.numSimplified++,it.push(I[rt]),it.push(I[rt+1])),P.numPoints++;H&&function(at,St){for(var Bt=0,wt=0,ae=at.length,te=ae-2;wt<ae;te=wt,wt+=2)Bt+=(at[wt]-at[te])*(at[wt+1]+at[te+1]);if(Bt>0===St)for(wt=0,ae=at.length;wt<ae/2;wt+=2){var he=at[wt],ge=at[wt+1];at[wt]=at[ae-2-wt],at[wt+1]=at[ae-1-wt],at[ae-2-wt]=he,at[ae-1-wt]=ge}}(it,K),Z.push(it)}}function Hr(Z,I){var P=(I=this.options=function(H,K){for(var st in K)H[st]=K[st];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,K){var st=[];if(H.type==="FeatureCollection")for(var it=0;it<H.features.length;it++)Ee(st,H.features[it],K,it);else Ee(st,H.type==="Feature"?H:{geometry:H},K);return st}(Z,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,K){var st=K.buffer/K.extent,it=H,rt=ke(H,1,-1-st,st,0,-1,2,K),at=ke(H,1,1-st,2+st,0,-1,2,K);return(rt||at)&&(it=ke(H,1,-st,1+st,0,-1,2,K)||[],rt&&(it=yi(rt,1).concat(it)),at&&(it=it.concat(yi(at,-1)))),it}(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 Xr(Z,I,P){return 32*((1<<Z)*P+I)+Z}function Zs(Z,I){let P=Z.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 fe(q.features),K=Dr(H);K.byteOffset===0&&K.byteLength===K.buffer.byteLength||(K=new Uint8Array(K)),I(null,{vectorTile:H,rawData:K.buffer})}Hr.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},Hr.prototype.splitTile=function(Z,I,P,q,H,K,st){for(var it=[Z,I,P,q],rt=this.options,at=rt.debug;it.length;){q=it.pop(),P=it.pop(),I=it.pop(),Z=it.pop();var St=1<<I,Bt=Xr(I,P,q),wt=this.tiles[Bt];if(!wt&&(at>1&&console.time("creation"),wt=this.tiles[Bt]=Gi(Z,I,P,q,rt),this.tileCoords.push({z:I,x:P,y:q}),at)){at>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 ae="z"+I;this.stats[ae]=(this.stats[ae]||0)+1,this.total++}if(wt.source=Z,H){if(I===rt.maxZoom||I===H)continue;var te=1<<H-I;if(P!==Math.floor(K/te)||q!==Math.floor(st/te))continue}else if(I===rt.indexMaxZoom||wt.numPoints<=rt.indexMaxPoints)continue;if(wt.source=null,Z.length!==0){at>1&&console.time("clipping");var he,ge,Ge,Fe,Le,Ie,Te=.5*rt.buffer/rt.extent,Ti=.5-Te,wi=.5+Te,qi=1+Te;he=ge=Ge=Fe=null,Le=ke(Z,St,P-Te,P+wi,0,wt.minX,wt.maxX,rt),Ie=ke(Z,St,P+Ti,P+qi,0,wt.minX,wt.maxX,rt),Z=null,Le&&(he=ke(Le,St,q-Te,q+wi,1,wt.minY,wt.maxY,rt),ge=ke(Le,St,q+Ti,q+qi,1,wt.minY,wt.maxY,rt),Le=null),Ie&&(Ge=ke(Ie,St,q-Te,q+wi,1,wt.minY,wt.maxY,rt),Fe=ke(Ie,St,q+Ti,q+qi,1,wt.minY,wt.maxY,rt),Ie=null),at>1&&console.timeEnd("clipping"),it.push(he||[],I+1,2*P,2*q),it.push(ge||[],I+1,2*P,2*q+1),it.push(Ge||[],I+1,2*P+1,2*q),it.push(Fe||[],I+1,2*P+1,2*q+1)}}},Hr.prototype.getTile=function(Z,I,P){var q=this.options,H=q.extent,K=q.debug;if(Z<0||Z>24)return null;var st=1<<Z,it=Xr(Z,I=(I%st+st)%st,P);if(this.tiles[it])return ni(this.tiles[it],H);K>1&&console.log("drilling down to z%d-%d-%d",Z,I,P);for(var rt,at=Z,St=I,Bt=P;!rt&&at>0;)at--,St=Math.floor(St/2),Bt=Math.floor(Bt/2),rt=this.tiles[Xr(at,St,Bt)];return rt&&rt.source?(K>1&&console.log("found parent tile z%d-%d-%d",at,St,Bt),K>1&&console.time("drilling down"),this.splitTile(rt.source,at,St,Bt,Z,I,P),K>1&&console.timeEnd("drilling down"),this.tiles[it]?ni(this.tiles[it],H):null):null};class _s extends ot{constructor(I,P,q,H){super(I,P,q,Zs),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,K)=>{if(H||!K)return I(H);if(typeof K!="object")return I(new Error(`Input data given to '${P.source}' is not a valid GeoJSON object.`));{Rt(K,!0);try{if(P.filter){let it=a.createExpression(P.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(it.result==="error")throw new Error(it.value.map(at=>`${at.key}: ${at.message}`).join(", "));let rt=K.features.filter(at=>it.value.evaluate({zoom:0},at));K={type:"FeatureCollection",features:rt}}this._geoJSONIndex=P.cluster?new On(function({superclusterOptions:it,clusterProperties:rt}){if(!rt||!it)return it;let at={},St={},Bt={accumulated:null,zoom:0},wt={properties:null},ae=Object.keys(rt);for(let te of ae){let[he,ge]=rt[te],Ge=a.createExpression(ge),Fe=a.createExpression(typeof he=="string"?[he,["accumulated"],["get",te]]:he);at[te]=Ge.value,St[te]=Fe.value}return it.map=te=>{wt.properties=te;let he={};for(let ge of ae)he[ge]=at[ge].evaluate(Bt,wt);return he},it.reduce=(te,he)=>{wt.properties=he;for(let ge of ae)Bt.accumulated=te[ge],te[ge]=St[ge].evaluate(Bt,wt)},it}(P)).load(K.features):function(it,rt){return new Hr(it,rt)}(K,P.geojsonVtOptions)}catch(it){return I(it)}this.loaded={};let st={};if(q){let it=q.finish();it&&(st.resourceTiming={},st.resourceTiming[P.source]=JSON.parse(JSON.stringify(it)))}I(null,st)}})}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 xs{constructor(I){this.self=I,this.actor=new a.Actor(I,this),this.layerIndexes={},this.availableImages={},this.workerSourceTypes={vector:ot,geojson:_s},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 K=this.workerSources[I][H];for(let st in K)K[st].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 K=a.plugin.isParsed();q(K?void 0:new Error(`RTL Text Plugin failed to import scripts from ${H}`),K)}}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:(K,st,it)=>{this.actor.send(K,st,it,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 ft),this.demWorkerSources[I][P]}enforceCacheSizeLimit(I,P){a.enforceCacheSizeLimit(P)}}return typeof WorkerGlobalScope<"u"&&typeof self<"u"&&self instanceof WorkerGlobalScope&&(self.worker=new xs(self)),xs}),g(["./shared"],function(a){"use strict";var M=S;function S(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,y=new Blob([""],{type:"text/javascript"}),v=URL.createObjectURL(y);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 y=d.getImageData(0,0,1,1);return y&&y.width===c.width}()?(D[s=e&&e.failIfMajorPerformanceCaveat]===void 0&&(D[s]=function(c){var d,y=function(v){var w=document.createElement("canvas"),T=Object.create(S.webGLContextAttributes);return T.failIfMajorPerformanceCaveat=v,w.getContext("webgl",T)||w.getContext("experimental-webgl",T)}(c);if(!y)return!1;try{d=y.createShader(y.VERTEX_SHADER)}catch{return!1}return!(!d||y.isContextLost())&&(y.shaderSource(d,"void main() {}"),y.compileShader(d),y.getShaderParameter(d,y.COMPILE_STATUS)===!0)}(s)),D[s]?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 s}(p)}var D={};function N(p,e){if(Array.isArray(p)){if(!Array.isArray(e)||p.length!==e.length)return!1;for(let s=0;s<p.length;s++)if(!N(p[s],e[s]))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 s in p)if(!N(p[s],e[s]))return!1;return!0}return p===e}S.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0};class L{static testProp(e){if(!L.docStyle)return e[0];for(let s=0;s<e.length;s++)if(e[s]in L.docStyle)return e[s];return e[0]}static create(e,s,c){let d=window.document.createElement(e);return s!==void 0&&(d.className=s),c&&c.appendChild(d),d}static createNS(e,s){return window.document.createElementNS(e,s)}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,s){e.style[L.transformProp]=s}static addEventListener(e,s,c,d={}){e.addEventListener(s,c,"passive"in d?d:d.capture)}static removeEventListener(e,s,c,d={}){e.removeEventListener(s,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,s){let c=e.getBoundingClientRect();return new a.pointGeometry(s.clientX-c.left-e.clientLeft,s.clientY-c.top-e.clientTop)}static touchPos(e,s){let c=e.getBoundingClientRect(),d=[];for(let y=0;y<s.length;y++)d.push(new a.pointGeometry(s[y].clientX-c.left-e.clientLeft,s[y].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 Q{constructor(e){this._transformRequestFn=e}transformRequest(e,s){return this._transformRequestFn&&this._transformRequestFn(e,s)||{url:e}}normalizeSpriteURL(e,s,c){let d=function(y){let v=y.match(pt);if(!v)throw new Error(`Unable to parse URL "${y}"`);return{protocol:v[1],authority:v[2],path:v[3]||"/",params:v[4]?v[4].split("&"):[]}}(e);return d.path+=`${s}${c}`,function(y){let v=y.params.length?`?${y.params.join("&")}`:"";return`${y.protocol}://${y.authority}${y.path}${v}`}(d)}setTransformRequest(e){this._transformRequestFn=e}}let pt=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function ot(p){var e=new a.ARRAY_TYPE(3);return e[0]=p[0],e[1]=p[1],e[2]=p[2],e}var ft,Rt=function(p,e,s){return p[0]=e[0]-s[0],p[1]=e[1]-s[1],p[2]=e[2]-s[2],p};ft=new a.ARRAY_TYPE(3),a.ARRAY_TYPE!=Float32Array&&(ft[0]=0,ft[1]=0,ft[2]=0);var Ct=function(p){var e=p[0],s=p[1];return e*e+s*s};(function(){var p=new a.ARRAY_TYPE(2);a.ARRAY_TYPE!=Float32Array&&(p[0]=0,p[1]=0)})();class Dt{constructor(e,s,c,d){this.context=e,this.format=c,this.texture=e.gl.createTexture(),this.update(s,d)}update(e,s,c){let{width:d,height:y}=e,v=!(this.size&&this.size[0]===d&&this.size[1]===y||c),{context:w}=this,{gl:T}=w;if(this.useMipmap=Boolean(s&&s.useMipmap),T.bindTexture(T.TEXTURE_2D,this.texture),w.pixelStoreUnpackFlipY.set(!1),w.pixelStoreUnpack.set(1),w.pixelStoreUnpackPremultiplyAlpha.set(this.format===T.RGBA&&(!s||s.premultiply!==!1)),v)this.size=[d,y],e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||a.isImageBitmap(e)?T.texImage2D(T.TEXTURE_2D,0,this.format,this.format,T.UNSIGNED_BYTE,e):T.texImage2D(T.TEXTURE_2D,0,this.format,d,y,0,this.format,T.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)?T.texSubImage2D(T.TEXTURE_2D,0,C,k,T.RGBA,T.UNSIGNED_BYTE,e):T.texSubImage2D(T.TEXTURE_2D,0,C,k,d,y,T.RGBA,T.UNSIGNED_BYTE,e.data)}this.useMipmap&&this.isSizePowerOfTwo()&&T.generateMipmap(T.TEXTURE_2D)}bind(e,s,c){let{context:d}=this,{gl:y}=d;y.bindTexture(y.TEXTURE_2D,this.texture),c!==y.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(c=y.LINEAR),e!==this.filter&&(y.texParameteri(y.TEXTURE_2D,y.TEXTURE_MAG_FILTER,e),y.texParameteri(y.TEXTURE_2D,y.TEXTURE_MIN_FILTER,c||e),this.filter=e),s!==this.wrap&&(y.texParameteri(y.TEXTURE_2D,y.TEXTURE_WRAP_S,s),y.texParameteri(y.TEXTURE_2D,y.TEXTURE_WRAP_T,s),this.wrap=s)}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 ne(p){let{userImage:e}=p;return!!(e&&e.render&&e.render())&&(p.data.replace(new Uint8Array(e.data.buffer)),!0)}class Ht 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:s,callback:c}of this.requestors)this._notify(s,c);this.requestors=[]}}getImage(e){return this.images[e]}addImage(e,s){this._validate(e,s)&&(this.images[e]=s)}_validate(e,s){let c=!0;return this._validateStretch(s.stretchX,s.data&&s.data.width)||(this.fire(new a.ErrorEvent(new Error(`Image "${e}" has invalid "stretchX" value`))),c=!1),this._validateStretch(s.stretchY,s.data&&s.data.height)||(this.fire(new a.ErrorEvent(new Error(`Image "${e}" has invalid "stretchY" value`))),c=!1),this._validateContent(s.content,s)||(this.fire(new a.ErrorEvent(new Error(`Image "${e}" has invalid "content" value`))),c=!1),c}_validateStretch(e,s){if(!e)return!0;let c=0;for(let d of e){if(d[0]<c||d[1]<d[0]||s<d[1])return!1;c=d[1]}return!0}_validateContent(e,s){return!(e&&(e.length!==4||e[0]<0||s.data.width<e[0]||e[1]<0||s.data.height<e[1]||e[2]<0||s.data.width<e[2]||e[3]<0||s.data.height<e[3]||e[2]<e[0]||e[3]<e[1]))}updateImage(e,s){s.version=this.images[e].version+1,this.images[e]=s,this.updatedImages[e]=!0}removeImage(e){let s=this.images[e];delete this.images[e],delete this.patterns[e],s.userImage&&s.userImage.onRemove&&s.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(e,s){let c=!0;if(!this.isLoaded())for(let d of e)this.images[d]||(c=!1);this.isLoaded()||c?this._notify(e,s):this.requestors.push({ids:e,callback:s})}_notify(e,s){let c={};for(let d of e){this.images[d]||this.fire(new a.Event("styleimagemissing",{id:d}));let y=this.images[d];y?c[d]={data:y.data.clone(),pixelRatio:y.pixelRatio,sdf:y.sdf,version:y.version,stretchX:y.stretchX,stretchY:y.stretchY,content:y.content,hasRenderCallback:Boolean(y.userImage&&y.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.`)}s(null,c)}getPixelSize(){let{width:e,height:s}=this.atlasImage;return{width:e,height:s}}getPattern(e){let s=this.patterns[e],c=this.getImage(e);if(!c)return null;if(s&&s.position.version===c.version)return s.position;if(s)s.position.version=c.version;else{let d={w:c.data.width+2,h:c.data.height+2,x:0,y:0},y=new a.ImagePosition(d,c);this.patterns[e]={bin:d,position:y}}return this._updatePatternAtlas(),this.patterns[e].position}bind(e){let s=e.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new Dt(e,this.atlasImage,s.RGBA),this.atlasTexture.bind(s.LINEAR,s.CLAMP_TO_EDGE)}_updatePatternAtlas(){let e=[];for(let y in this.patterns)e.push(this.patterns[y].bin);let{w:s,h:c}=a.potpack(e),d=this.atlasImage;d.resize({width:s||1,height:c||1});for(let y in this.patterns){let{bin:v}=this.patterns[y],w=v.x+1,T=v.y+1,C=this.images[y].data,k=C.width,F=C.height;a.RGBAImage.copy(C,d,{x:0,y:0},{x:w,y:T},{width:k,height:F}),a.RGBAImage.copy(C,d,{x:0,y:F-1},{x:w,y:T-1},{width:k,height:1}),a.RGBAImage.copy(C,d,{x:0,y:0},{x:w,y:T+F},{width:k,height:1}),a.RGBAImage.copy(C,d,{x:k-1,y:0},{x:w-1,y:T},{width:1,height:F}),a.RGBAImage.copy(C,d,{x:0,y:0},{x:w+k,y:T},{width:1,height:F})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(e){for(let s of e){if(this.callbackDispatchedThisFrame[s])continue;this.callbackDispatchedThisFrame[s]=!0;let c=this.images[s];ne(c)&&this.updateImage(s,c)}}}let fe=1e20;function me(p,e,s,c,d,y,v,w,T){for(let C=e;C<e+c;C++)oe(p,s*y+C,y,d,v,w,T);for(let C=s;C<s+d;C++)oe(p,C*y+e,1,c,v,w,T)}function oe(p,e,s,c,d,y,v){y[0]=0,v[0]=-fe,v[1]=fe,d[0]=p[e];for(let w=1,T=0,C=0;w<c;w++){d[w]=p[e+w*s];let k=w*w;do{let F=y[T];C=(d[w]-d[F]+k-F*F)/(w-F)/2}while(C<=v[T]&&--T>-1);T++,y[T]=w,v[T]=C,v[T+1]=fe}for(let w=0,T=0;w<c;w++){for(;v[T+1]<w;)T++;let C=y[T],k=w-C;p[e+w*s]=d[C]+k*k}}class Ce{constructor(e,s){this.requestManager=e,this.localIdeographFontFamily=s,this.entries={}}setURL(e){this.url=e}getGlyphs(e,s){let c=[];for(let d in e)for(let y of e[d])c.push({stack:d,id:y});a.asyncAll(c,({stack:d,id:y},v)=>{let w=this.entries[d];w||(w=this.entries[d]={glyphs:{},requests:{},ranges:{}});let T=w.glyphs[y];if(T!==void 0)return void v(null,{stack:d,id:y,glyph:T});if(T=this._tinySDF(w,d,y),T)return w.glyphs[y]=T,void v(null,{stack:d,id:y,glyph:T});let C=Math.floor(y/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:y,glyph:T});let k=w.requests[C];k||(k=w.requests[C]=[],Ce.loadGlyphRange(d,C,this.url,this.requestManager,(F,j)=>{if(j){for(let Y in j)this._doesCharSupportLocalGlyph(+Y)||(w.glyphs[+Y]=j[+Y]);w.ranges[C]=!0}for(let Y of k)Y(F,j);delete w.requests[C]})),k.push((F,j)=>{F?v(F):j&&v(null,{stack:d,id:y,glyph:j[y]||null})})},(d,y)=>{if(d)s(d);else if(y){let v={};for(let{stack:w,id:T,glyph:C}of y)(v[w]||(v[w]={}))[T]=C&&{id:C.id,bitmap:C.bitmap.clone(),metrics:C.metrics};s(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,s,c){let d=this.localIdeographFontFamily;if(!d||!this._doesCharSupportLocalGlyph(c))return;let y=e.tinySDF;if(!y){let w="400";/bold/i.test(s)?w="900":/medium/i.test(s)?w="500":/light/i.test(s)&&(w="200"),y=e.tinySDF=new Ce.TinySDF({fontSize:24,buffer:3,radius:8,cutoff:.25,fontFamily:d,fontWeight:w})}let v=y.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}}}}Ce.loadGlyphRange=function(p,e,s,c,d){let y=256*e,v=y+255,w=c.transformRequest(s.replace("{fontstack}",p).replace("{range}",`${y}-${v}`),a.ResourceType.Glyphs);a.getArrayBuffer(w,(T,C)=>{if(T)d(T);else if(C){let k={};for(let F of a.parseGlyphPBF(C))k[F.id]=F;d(null,k)}})},Ce.TinySDF=class{constructor({fontSize:p=24,buffer:e=3,radius:s=8,cutoff:c=.25,fontFamily:d="sans-serif",fontWeight:y="normal",fontStyle:v="normal"}={}){this.buffer=e,this.cutoff=c,this.radius=s;let w=this.size=p+4*e,T=this._createCanvas(w),C=this.ctx=T.getContext("2d",{willReadFrequently:!0});C.font=`${v} ${y} ${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:s,actualBoundingBoxDescent:c,actualBoundingBoxLeft:d,actualBoundingBoxRight:y}=this.ctx.measureText(p),v=Math.ceil(s),w=Math.min(this.size-this.buffer,Math.ceil(y-d)),T=Math.min(this.size-this.buffer,v+Math.ceil(c)),C=w+2*this.buffer,k=T+2*this.buffer,F=Math.max(C*k,0),j=new Uint8ClampedArray(F),Y={data:j,width:C,height:k,glyphWidth:w,glyphHeight:T,glyphTop:v,glyphLeft:0,glyphAdvance:e};if(w===0||T===0)return Y;let{ctx:$,buffer:J,gridInner:lt,gridOuter:ht}=this;$.clearRect(J,J,w,T),$.fillText(p,J,J+v);let gt=$.getImageData(J,J,w,T);ht.fill(fe,0,F),lt.fill(0,0,F);for(let ut=0;ut<T;ut++)for(let kt=0;kt<w;kt++){let Mt=gt.data[4*(ut*w+kt)+3]/255;if(Mt===0)continue;let Tt=(ut+J)*C+kt+J;if(Mt===1)ht[Tt]=0,lt[Tt]=fe;else{let Ut=.5-Mt;ht[Tt]=Ut>0?Ut*Ut:0,lt[Tt]=Ut<0?Ut*Ut:0}}me(ht,0,0,C,k,C,this.f,this.v,this.z),me(lt,J,J,w,T,C,this.f,this.v,this.z);for(let ut=0;ut<F;ut++){let kt=Math.sqrt(ht[ut])-Math.sqrt(lt[ut]);j[ut]=Math.round(255-255*(kt/this.radius+this.cutoff))}return Y}};let Re=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,s){return{x:a.number(p.x,e.x,s),y:a.number(p.y,e.y,s),z:a.number(p.z,e.z,s)}}},color:new a.DataConstantProperty(a.spec.light.color),intensity:new a.DataConstantProperty(a.spec.light.intensity)}),mi="-transition";class Fi extends a.Evented{constructor(e){super(),this._transitionable=new a.Transitionable(Re),this.setLight(e),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(e,s={}){if(!this._validate(a.validateLight,e,s))for(let c in e){let d=e[c];c.endsWith(mi)?this._transitionable.setTransition(c.slice(0,-mi.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,s,c){return(!c||c.validate!==!1)&&a.emitValidationErrors(this,e.call(a.validateStyle,a.extend({value:s,style:{glyphs:!0,sprite:!0},styleSpec:a.spec})))}}class Yi{constructor(e,s){this.width=e,this.height=s,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(e,s){let c=e.join(",")+String(s);return this.dashEntry[c]||(this.dashEntry[c]=this.addDash(e,s)),this.dashEntry[c]}getDashRanges(e,s,c){let d=[],y=e.length%2==1?-e[e.length-1]*c:0,v=e[0]*c,w=!0;d.push({left:y,right:v,isDash:w,zeroLength:e[0]===0});let T=e[0];for(let C=1;C<e.length;C++){w=!w;let k=e[C];y=T*c,T+=k,v=T*c,d.push({left:y,right:v,isDash:w,zeroLength:k===0})}return d}addRoundDash(e,s,c){let d=s/2;for(let y=-c;y<=c;y++){let v=this.width*(this.nextRow+c+y),w=0,T=e[w];for(let C=0;C<this.width;C++){C/T.right>1&&(T=e[++w]);let k=Math.abs(C-T.left),F=Math.abs(C-T.right),j=Math.min(k,F),Y,$=y/c*(d+1);if(T.isDash){let J=d-Math.abs($);Y=Math.sqrt(j*j+J*J)}else Y=d-Math.sqrt(j*j+$*$);this.data[v+C]=Math.max(0,Math.min(255,Y+128))}}}addRegularDash(e){for(let w=e.length-1;w>=0;--w){let T=e[w],C=e[w+1];T.zeroLength?e.splice(w,1):C&&C.isDash===T.isDash&&(C.left=T.left,e.splice(w,1))}let s=e[0],c=e[e.length-1];s.isDash===c.isDash&&(s.left=c.left-this.width,c.right=s.right+this.width);let d=this.width*this.nextRow,y=0,v=e[y];for(let w=0;w<this.width;w++){w/v.right>1&&(v=e[++y]);let T=Math.abs(w-v.left),C=Math.abs(w-v.right),k=Math.min(T,C);this.data[d+w]=Math.max(0,Math.min(255,(v.isDash?k:-k)+128))}}addDash(e,s){let c=s?7:0,d=2*c+1;if(this.nextRow+d>this.height)return a.warnOnce("LineAtlas out of space"),null;let y=0;for(let w=0;w<e.length;w++)y+=e[w];if(y!==0){let w=this.width/y,T=this.getDashRanges(e,this.width,w);s?this.addRoundDash(T,w,c):this.addRegularDash(T)}let v={y:(this.nextRow+c+.5)/this.height,height:2*c/this.height,width:y};return this.nextRow+=d,this.dirty=!0,v}bind(e){let s=e.gl;this.texture?(s.bindTexture(s.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,s.texSubImage2D(s.TEXTURE_2D,0,0,0,this.width,this.height,s.ALPHA,s.UNSIGNED_BYTE,this.data))):(this.texture=s.createTexture(),s.bindTexture(s.TEXTURE_2D,this.texture),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,s.REPEAT),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,s.REPEAT),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,s.LINEAR),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,s.LINEAR),s.texImage2D(s.TEXTURE_2D,0,s.ALPHA,this.width,this.height,0,s.ALPHA,s.UNSIGNED_BYTE,this.data))}}class Oi{constructor(e,s){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 y=new Oi.Actor(c[d],s,this.id);y.name=`Worker ${d}`,this.actors.push(y)}}broadcast(e,s,c){a.asyncAll(this.actors,(d,y)=>{d.send(e,s,y)},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 $r(p,e,s){let c=function(d,y){if(d)return s(d);if(y){let v=a.pick(a.extend(y,p),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);y.vector_layers&&(v.vectorLayers=y.vector_layers,v.vectorLayerIds=v.vectorLayers.map(w=>w.id)),s(null,v)}};return p.url?a.getJSON(e.transformRequest(p.url,a.ResourceType.Source),c):a.exported.frame(()=>c(null,p))}Oi.Actor=a.Actor;class ve{constructor(e,s,c){this.bounds=a.LngLatBounds.convert(this.validateBounds(e)),this.minzoom=s||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 s=Math.pow(2,e.z),c=Math.floor(a.mercatorXfromLng(this.bounds.getWest())*s),d=Math.floor(a.mercatorYfromLat(this.bounds.getNorth())*s),y=Math.ceil(a.mercatorXfromLng(this.bounds.getEast())*s),v=Math.ceil(a.mercatorYfromLat(this.bounds.getSouth())*s);return e.x>=c&&e.x<y&&e.y>=d&&e.y<v}}class kr extends a.Evented{constructor(e,s,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(s,["url","scheme","tileSize","promoteId"])),this._options=a.extend({type:"vector"},s),this._collectResourceTiming=s.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=$r(this._options,this.map._requestManager,(e,s)=>{this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),e?this.fire(new a.ErrorEvent(e)):s&&(a.extend(this,s),s.bounds&&(this.tileBounds=new ve(s.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,s){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 y(v,w){return delete e.request,e.aborted?s(null):v&&v.status!==404?s(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),s(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=s:e.request=e.actor.send("reloadTile",d,y.bind(this)):(e.actor=this.dispatcher.getActor(),e.request=e.actor.send("loadTile",d,y.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 Wr extends a.Evented{constructor(e,s,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"},s),a.extend(this,a.pick(s,["url","scheme","tileSize"]))}load(){this._loaded=!1,this.fire(new a.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=$r(this._options,this.map._requestManager,(e,s)=>{this._tileJSONRequest=null,this._loaded=!0,e?this.fire(new a.ErrorEvent(e)):s&&(a.extend(this,s),s.bounds&&(this.tileBounds=new ve(s.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,s){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,y,v)=>{if(delete e.request,e.aborted)e.state="unloaded",s(null);else if(d)e.state="errored",s(d);else if(y){this.map._refreshExpiredTiles&&e.setExpiryData(v);let w=this.map.painter.context,T=w.gl;e.texture=this.map.painter.getTileTexture(y.width),e.texture?e.texture.update(y,{useMipmap:!0}):(e.texture=new Dt(w,y,T.RGBA,{useMipmap:!0}),e.texture.bind(T.LINEAR,T.CLAMP_TO_EDGE,T.LINEAR_MIPMAP_NEAREST),w.extTextureFilterAnisotropic&&T.texParameterf(T.TEXTURE_2D,w.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,w.extTextureFilterAnisotropicMax)),e.state="loaded",a.cacheEntryPossiblyAdded(this.dispatcher),s(null)}})}abortTile(e,s){e.request&&(e.request.cancel(),delete e.request),s()}unloadTile(e,s){e.texture&&this.map.painter.saveTileTexture(e.texture),s()}hasTransition(){return!1}}let rn;class bi extends Wr{constructor(e,s,c,d){super(e,s,c,d),this.type="raster-dem",this.maxzoom=22,this._options=a.extend({type:"raster-dem"},s),this.encoding=s.encoding||"mapbox"}serialize(){return{type:"raster-dem",url:this.url,tileSize:this.tileSize,tiles:this.tiles,bounds:this.bounds,encoding:this.encoding}}loadTile(e,s){let c=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);function d(y,v){y&&(e.state="errored",s(y)),v&&(e.dem=v,e.needsHillshadePrepare=!0,e.state="loaded",s(null))}e.request=a.getImage(this.map._requestManager.transformRequest(c,a.ResourceType.Tile),function(y,v){if(delete e.request,e.aborted)e.state="unloaded",s(null);else if(y)e.state="errored",s(y);else if(v){this.map._refreshExpiredTiles&&e.setExpiryData(v),delete v.cacheControl,delete v.expires;let w=a.isImageBitmap(v)&&(rn==null&&(rn=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),rn)?v:a.exported.getImageData(v,1),T={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",T,d.bind(this)))}}.bind(this)),e.neighboringTiles=this._getNeighboringTiles(e.tileID)}_getNeighboringTiles(e){let s=e.canonical,c=Math.pow(2,s.z),d=(s.x-1+c)%c,y=s.x===0?e.wrap-1:e.wrap,v=(s.x+1+c)%c,w=s.x+1===c?e.wrap+1:e.wrap,T={};return T[new a.OverscaledTileID(e.overscaledZ,y,s.z,d,s.y).key]={backfilled:!1},T[new a.OverscaledTileID(e.overscaledZ,w,s.z,v,s.y).key]={backfilled:!1},s.y>0&&(T[new a.OverscaledTileID(e.overscaledZ,y,s.z,d,s.y-1).key]={backfilled:!1},T[new a.OverscaledTileID(e.overscaledZ,e.wrap,s.z,s.x,s.y-1).key]={backfilled:!1},T[new a.OverscaledTileID(e.overscaledZ,w,s.z,v,s.y-1).key]={backfilled:!1}),s.y+1<c&&(T[new a.OverscaledTileID(e.overscaledZ,y,s.z,d,s.y+1).key]={backfilled:!1},T[new a.OverscaledTileID(e.overscaledZ,e.wrap,s.z,s.x,s.y+1).key]={backfilled:!1},T[new a.OverscaledTileID(e.overscaledZ,w,s.z,v,s.y+1).key]={backfilled:!1}),T}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 gn extends a.Evented{constructor(e,s,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=s.data,this._options=a.extend({},s),this._collectResourceTiming=s.collectResourceTiming,s.maxzoom!==void 0&&(this.maxzoom=s.maxzoom),s.type&&(this.type=s.type),s.attribution&&(this.attribution=s.attribution),this.promoteId=s.promoteId;let y=a.EXTENT/this.tileSize;this.workerOptions=a.extend({source:this.id,cluster:s.cluster||!1,geojsonVtOptions:{buffer:(s.buffer!==void 0?s.buffer:128)*y,tolerance:(s.tolerance!==void 0?s.tolerance:.375)*y,extent:a.EXTENT,maxZoom:this.maxzoom,lineMetrics:s.lineMetrics||!1,generateId:s.generateId||!1},superclusterOptions:{maxZoom:s.clusterMaxZoom!==void 0?s.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,s.clusterMinPoints||2),extent:a.EXTENT,radius:(s.clusterRadius||50)*y,log:!1,generateId:s.generateId||!1},clusterProperties:s.clusterProperties,filter:s.filter},s.workerOptions)}load(){this._updateWorkerData("metadata")}onAdd(e){this.map=e,this.load()}setData(e){return this._data=e,this._updateWorkerData("content"),this}getClusterExpansionZoom(e,s){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:e,source:this.id},s),this}getClusterChildren(e,s){return this.actor.send("geojson.getClusterChildren",{clusterId:e,source:this.id},s),this}getClusterLeaves(e,s,c,d){return this.actor.send("geojson.getClusterLeaves",{source:this.id,clusterId:e,limit:s,offset:c},d),this}_updateWorkerData(e){let s=a.extend({},this.workerOptions),c=this._data;typeof c=="string"?(s.request=this.map._requestManager.transformRequest(a.exported.resolveURL(c),a.ResourceType.Source),s.request.collectResourceTiming=this._collectResourceTiming):s.data=JSON.stringify(c),this._pendingLoads++,this.fire(new a.Event("dataloading",{dataType:"source"})),this.actor.send(`${this.type}.loadData`,s,(d,y)=>{if(this._pendingLoads--,this._removed||y&&y.abandoned)return;let v=null;if(y&&y.resourceTiming&&y.resourceTiming[this.id]&&(v=y.resourceTiming[this.id].slice(0)),this.actor.send(`${this.type}.coalesce`,{source:s.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,s){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,(y,v)=>(delete e.request,e.unloadVectorData(),e.aborted?s(null):y?s(y):(e.loadVectorData(v,this.map.painter,c==="reloadTile"),s(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 Lr=a.createLayout([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class Dr extends a.Evented{constructor(e,s,c,d){super(),this.id=e,this.dispatcher=c,this.coordinates=s.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(d),this.options=s}load(e,s){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),s&&s(),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 s=e.map(a.MercatorCoordinate.fromLngLat);this.tileID=function(d){let y=1/0,v=1/0,w=-1/0,T=-1/0;for(let j of d)y=Math.min(y,j.x),v=Math.min(v,j.y),w=Math.max(w,j.x),T=Math.max(T,j.y);let C=Math.max(w-y,T-v),k=Math.max(0,Math.floor(-Math.log(C)/Math.LN2)),F=Math.pow(2,k);return new a.CanonicalTileID(k,Math.floor((y+w)/2*F),Math.floor((v+T)/2*F))}(s),this.minzoom=this.maxzoom=this.tileID.z;let c=s.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,s=e.gl;this.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,Lr.members)),this.boundsSegments||(this.boundsSegments=a.SegmentVector.simpleSegment(0,0,4,2)),this.texture||(this.texture=new Dt(e,this.image,s.RGBA),this.texture.bind(s.LINEAR,s.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,s){this.tileID&&this.tileID.equals(e.tileID.canonical)?(this.tiles[String(e.tileID.wrap)]=e,e.buckets={},s(null)):(e.state="errored",s(null))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class nn extends Dr{constructor(e,s,c,d){super(e,s,c,d),this.roundZoom=!0,this.type="video",this.options=s}load(){this._loaded=!1;let e=this.options;this.urls=[];for(let s of e.urls)this.urls.push(this.map._requestManager.transformRequest(s,a.ResourceType.Source).url);a.getVideo(this.urls,(s,c)=>{this._loaded=!0,s?this.fire(new a.ErrorEvent(s)):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 s=this.video.seekable;e<s.start(0)||e>s.end(0)?this.fire(new a.ErrorEvent(new a.ValidationError(`sources.${this.id}`,null,`Playback for this video can be set only between the ${s.start(0)} and ${s.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,s=e.gl;this.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,Lr.members)),this.boundsSegments||(this.boundsSegments=a.SegmentVector.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(s.LINEAR,s.CLAMP_TO_EDGE),s.texSubImage2D(s.TEXTURE_2D,0,0,0,s.RGBA,s.UNSIGNED_BYTE,this.video)):(this.texture=new Dt(e,this.video,s.RGBA),this.texture.bind(s.LINEAR,s.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 sn extends Dr{constructor(e,s,c,d){super(e,s,c,d),s.coordinates?Array.isArray(s.coordinates)&&s.coordinates.length===4&&!s.coordinates.some(y=>!Array.isArray(y)||y.length!==2||y.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"'))),s.animate&&typeof s.animate!="boolean"&&this.fire(new a.ErrorEvent(new a.ValidationError(`sources.${e}`,null,'optional "animate" property must be a boolean value'))),s.canvas?typeof s.canvas=="string"||s.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=s,this.animate=s.animate===void 0||s.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 s=this.map.painter.context,c=s.gl;this.boundsBuffer||(this.boundsBuffer=s.createVertexBuffer(this._boundsArray,Lr.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 Dt(s,this.canvas,c.RGBA,{premultiply:!0});for(let d in this.tiles){let y=this.tiles[d];y.state!=="loaded"&&(y.state="loaded",y.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 yr={vector:kr,raster:Wr,"raster-dem":bi,geojson:gn,video:nn,image:Dr,canvas:sn};function Rr(p,e){let s=a.create();return a.translate(s,s,[1,1,0]),a.scale(s,s,[.5*p.width,.5*p.height,1]),a.multiply(s,s,p.calculatePosMatrix(e.toUnwrapped()))}function Zr(p,e,s,c,d,y){let v=function(F,j,Y){if(F)for(let $ of F){let J=j[$];if(J&&J.source===Y&&J.type==="fill-extrusion")return!0}else for(let $ in j){let J=j[$];if(J.source===Y&&J.type==="fill-extrusion")return!0}return!1}(d&&d.layers,e,p.id),w=y.maxPitchScaleFactor(),T=p.tilesIn(c,w,v);T.sort(En);let C=[];for(let F of T)C.push({wrappedTileID:F.tileID.wrapped().key,queryResults:F.tile.queryRenderedFeatures(e,s,p._state,F.queryGeometry,F.cameraQueryGeometry,F.scale,d,y,w,Rr(p.transform,F.tileID))});let k=function(F){let j={},Y={};for(let $ of F){let J=$.queryResults,lt=$.wrappedTileID,ht=Y[lt]=Y[lt]||{};for(let gt in J){let ut=J[gt],kt=ht[gt]=ht[gt]||{},Mt=j[gt]=j[gt]||[];for(let Tt of ut)kt[Tt.featureIndex]||(kt[Tt.featureIndex]=!0,Mt.push(Tt))}}return j}(C);for(let F in k)k[F].forEach(j=>{let Y=j.feature,$=p.getFeatureState(Y.layer["source-layer"],Y.id);Y.source=Y.layer.source,Y.layer["source-layer"]&&(Y.sourceLayer=Y.layer["source-layer"]),Y.state=$});return k}function En(p,e){let s=p.tileID,c=e.tileID;return s.overscaledZ-c.overscaledZ||s.canonical.y-c.canonical.y||s.wrap-c.wrap||s.canonical.x-c.canonical.x}class Bn{constructor(e,s){this.tileID=e,this.uid=a.uniqueId(),this.uses=0,this.tileSize=s,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 s=e+this.timeAdded;s<a.exported.now()||this.fadeEndTime&&s<this.fadeEndTime||(this.fadeEndTime=s)}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}loadVectorData(e,s,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,y){let v={};if(!y)return v;for(let w of d){let T=w.layerIds.map(C=>y.getLayer(C)).filter(Boolean);if(T.length!==0){w.layers=T,w.stateDependentLayerIds&&(w.stateDependentLayers=w.stateDependentLayerIds.map(C=>T.filter(k=>k.id===C)[0]));for(let C of T)v[C.id]=w}}return v}(e.buckets,s.style),this.hasSymbolBuckets=!1;for(let d in this.buckets){let y=this.buckets[d];if(y instanceof a.SymbolBucket){if(this.hasSymbolBuckets=!0,!c)break;y.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(let d in this.buckets){let y=this.buckets[d];if(y instanceof a.SymbolBucket&&y.hasRTLText){this.hasRTLText=!0,a.lazyLoadRTLTextPlugin();break}}this.queryPadding=0;for(let d in this.buckets){let y=this.buckets[d];this.queryPadding=Math.max(this.queryPadding,s.style.getLayer(d).queryRadius(y))}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 s=e.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new Dt(e,this.imageAtlas.image,s.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new Dt(e,this.glyphAtlasImage,s.ALPHA),this.glyphAtlasImage=null)}prepare(e){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(e,this.imageAtlasTexture)}queryRenderedFeatures(e,s,c,d,y,v,w,T,C,k){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:d,cameraQueryGeometry:y,scale:v,tileSize:this.tileSize,pixelPosMatrix:k,transform:T,params:w,queryPadding:this.queryPadding*C},e,s,c):{}}querySourceFeatures(e,s){let c=this.latestFeatureIndex;if(!c||!c.rawTileData)return;let d=c.loadVTLayers(),y=s?s.sourceLayer:"",v=d._geojsonTileLayer||d[y];if(!v)return;let w=a.createFilter(s&&s.filter),{z:T,x:C,y:k}=this.tileID.canonical,F={z:T,x:C,y:k};for(let j=0;j<v.length;j++){let Y=v.feature(j);if(w.needGeometry){let lt=a.toEvaluationFeature(Y,!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),Y))continue;let $=c.getId(Y,y),J=new a.GeoJSONFeature(Y,T,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 s=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(s)if(this.expirationTime<s)d=!0;else{let y=this.expirationTime-s;y?this.expirationTime=c+Math.max(y,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,s){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||Object.keys(e).length===0)return;let c=this.latestFeatureIndex.loadVTLayers();for(let d in this.buckets){if(!s.style.hasLayer(d))continue;let y=this.buckets[d],v=y.layers[0].sourceLayer||"_geojsonTileLayer",w=c[v],T=e[v];if(!w||!T||Object.keys(T).length===0)continue;y.update(T,w,this.imageAtlas&&this.imageAtlas.patternPositions||{});let C=s&&s.style&&s.style.getLayer(d);C&&(this.queryPadding=Math.max(this.queryPadding,C.queryRadius(y)))}}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,s){let c={};for(let d of s)c[d]=!0;this.dependencies[e]=c}hasDependency(e,s){for(let c of e){let d=this.dependencies[c];if(d){for(let y of s)if(d[y])return!0}}return!1}}class Fn{constructor(e,s){this.max=e,this.onRemove=s,this.reset()}reset(){for(let e in this.data)for(let s of this.data[e])s.timeout&&clearTimeout(s.timeout),this.onRemove(s.value);return this.data={},this.order=[],this}add(e,s,c){let d=e.wrapped().key;this.data[d]===void 0&&(this.data[d]=[]);let y={value:s,timeout:void 0};if(c!==void 0&&(y.timeout=setTimeout(()=>{this.remove(e,y)},c)),this.data[d].push(y),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 s=this.data[e].shift();return s.timeout&&clearTimeout(s.timeout),this.data[e].length===0&&delete this.data[e],this.order.splice(this.order.indexOf(e),1),s.value}getByKey(e){let s=this.data[e];return s?s[0].value:null}get(e){return this.has(e)?this.data[e.wrapped().key][0].value:null}remove(e,s){if(!this.has(e))return this;let c=e.wrapped().key,d=s===void 0?0:this.data[c].indexOf(s),y=this.data[c][d];return this.data[c].splice(d,1),y.timeout&&clearTimeout(y.timeout),this.data[c].length===0&&delete this.data[c],this.onRemove(y.value),this.order.splice(this.order.indexOf(c),1),this}setMaxSize(e){for(this.max=e;this.order.length>this.max;){let s=this._getAndRemoveByKey(this.order[0]);s&&this.onRemove(s)}return this}filter(e){let s=[];for(let c in this.data)for(let d of this.data[c])e(d.value)||s.push(d);for(let c of s)this.remove(c.value.tileID,c)}}class gs{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(e,s,c){let d=String(s);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 y in this.state[e])y!==d&&(this.deletedStates[e][y]=null)}else if(this.deletedStates[e]&&this.deletedStates[e][d]===null){this.deletedStates[e][d]={};for(let y in this.state[e][d])c[y]||(this.deletedStates[e][d][y]=null)}else for(let y in c)this.deletedStates[e]&&this.deletedStates[e][d]&&this.deletedStates[e][d][y]===null&&delete this.deletedStates[e][d][y]}removeFeatureState(e,s,c){if(this.deletedStates[e]===null)return;let d=String(s);if(this.deletedStates[e]=this.deletedStates[e]||{},c&&s!==void 0)this.deletedStates[e][d]!==null&&(this.deletedStates[e][d]=this.deletedStates[e][d]||{},this.deletedStates[e][d][c]=null);else if(s!==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,s){let c=String(s),d=a.extend({},(this.state[e]||{})[c],(this.stateChanges[e]||{})[c]);if(this.deletedStates[e]===null)return{};if(this.deletedStates[e]){let y=this.deletedStates[e][s];if(y===null)return{};for(let v in y)delete d[v]}return d}initializeTileState(e,s){e.setFeatureState(this.state,s)}coalesceChanges(e,s){let c={};for(let d in this.stateChanges){this.state[d]=this.state[d]||{};let y={};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]),y[v]=this.state[d][v];c[d]=y}for(let d in this.deletedStates){this.state[d]=this.state[d]||{};let y={};if(this.deletedStates[d]===null)for(let v in this.state[d])y[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];y[v]=this.state[d][v]}c[d]=c[d]||{},a.extend(c[d],y)}if(this.stateChanges={},this.deletedStates={},Object.keys(c).length!==0)for(let d in e)e[d].setFeatureState(c,s)}}class ti extends a.Evented{constructor(e,s,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,y,v,w){let T=new yr[y.type](d,y,v,w);if(T.id!==d)throw new Error(`Expected Source id to be ${d} instead of ${T.id}`);return a.bindAll(["load","abort","unload","serialize","prepare"],T),T}(e,s,c,this),this._tiles={},this._cache=new Fn(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new gs}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 s=this._tiles[e];if(s.state!=="loaded"&&s.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,s){return this._source.loadTile(e,s)}_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 s in this._tiles){let c=this._tiles[s];c.upload(e),c.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(e=>e.tileID).sort(an).map(e=>e.key)}getRenderableIds(e){let s=[];for(let c in this._tiles)this._isIdRenderable(c,e)&&s.push(this._tiles[c]);return e?s.sort((c,d)=>{let y=c.tileID,v=d.tileID,w=new a.pointGeometry(y.canonical.x,y.canonical.y)._rotate(this.transform.angle),T=new a.pointGeometry(v.canonical.x,v.canonical.y)._rotate(this.transform.angle);return y.overscaledZ-v.overscaledZ||T.y-w.y||T.x-w.x}).map(c=>c.tileID.key):s.map(c=>c.tileID).sort(an).map(c=>c.key)}hasRenderableParent(e){let s=this.findLoadedParent(e,0);return!!s&&this._isIdRenderable(s.tileID.key)}_isIdRenderable(e,s){return this._tiles[e]&&this._tiles[e].hasData()&&!this._coveredTiles[e]&&(s||!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,s){let c=this._tiles[e];c&&(c.state!=="loading"&&(c.state=s),this._loadTile(c,this._tileLoaded.bind(this,c,e,s)))}_tileLoaded(e,s,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(s,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 s=this.getRenderableIds();for(let d=0;d<s.length;d++){let y=s[d];if(e.neighboringTiles&&e.neighboringTiles[y]){let v=this.getTileByID(y);c(e,v),c(v,e)}}function c(d,y){d.needsHillshadePrepare=!0;let v=y.tileID.canonical.x-d.tileID.canonical.x,w=y.tileID.canonical.y-d.tileID.canonical.y,T=Math.pow(2,d.tileID.canonical.z),C=y.tileID.key;v===0&&w===0||Math.abs(w)>1||(Math.abs(v)>1&&(Math.abs(v+T)===1?v+=T:Math.abs(v-T)===1&&(v-=T)),y.dem&&d.dem&&(d.dem.backfillBorder(y.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,s,c,d){for(let y in this._tiles){let v=this._tiles[y];if(d[y]||!v.hasData()||v.tileID.overscaledZ<=s||v.tileID.overscaledZ>c)continue;let w=v.tileID;for(;v&&v.tileID.overscaledZ>s+1;){let C=v.tileID.scaledTo(v.tileID.overscaledZ-1);v=this._tiles[C.key],v&&v.hasData()&&(w=C)}let T=w;for(;T.overscaledZ>s;)if(T=T.scaledTo(T.overscaledZ-1),e[T.key]){d[w.key]=w;break}}}findLoadedParent(e,s){if(e.key in this._loadedParentTiles){let c=this._loadedParentTiles[e.key];return c&&c.tileID.overscaledZ>=s?c:null}for(let c=e.overscaledZ-1;c>=s;c--){let d=e.scaledTo(c),y=this._getLoadedTile(d);if(y)return y}}_getLoadedTile(e){let s=this._tiles[e.key];return s&&s.hasData()?s:this._cache.getByKey(e.wrapped().key)}updateCacheSize(e){let s=Math.ceil(e.width/this._source.tileSize)+1,c=Math.ceil(e.height/this._source.tileSize)+1,d=Math.floor(s*c*5),y=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,d):d;this._cache.setMaxSize(y)}handleWrapJump(e){let s=Math.round((e-(this._prevLng===void 0?e:this._prevLng))/360);if(this._prevLng=e,s){let c={};for(let d in this._tiles){let y=this._tiles[d];y.tileID=y.tileID.unwrapTo(y.tileID.wrap+s),c[y.tileID.key]=y}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 s;this.updateCacheSize(e),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used?this._source.tileID?s=e.getVisibleUnwrappedCoordinates(this._source.tileID).map(T=>new a.OverscaledTileID(T.canonical.z,T.wrap,T.canonical.z,T.canonical.x,T.canonical.y)):(s=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&&(s=s.filter(T=>this._source.hasTile(T)))):s=[];let c=e.coveringZoomLevel(this._source),d=Math.max(c-ti.maxOverzooming,this._source.minzoom),y=Math.max(c+ti.maxUnderzooming,this._source.minzoom),v=this._updateRetainedTiles(s,c);if(On(this._source.type)){let T={},C={},k=Object.keys(v);for(let F of k){let j=v[F],Y=this._tiles[F];if(!Y||Y.fadeEndTime&&Y.fadeEndTime<=a.exported.now())continue;let $=this.findLoadedParent(j,d);$&&(this._addTile($.tileID),T[$.tileID.key]=$.tileID),C[F]=j}this._retainLoadedChildren(C,c,y,v);for(let F in T)v[F]||(this._coveredTiles[F]=!0,v[F]=T[F])}for(let T in v)this._tiles[T].clearFadeHold();let w=a.keysDifference(this._tiles,v);for(let T of w){let C=this._tiles[T];C.hasSymbolBuckets&&!C.holdingForFade()?C.setHoldDuration(this.map._fadeDuration):C.hasSymbolBuckets&&!C.symbolFadeFinished()||this._removeTile(T)}this._updateLoadedParentTileCache()}releaseSymbolFadeTiles(){for(let e in this._tiles)this._tiles[e].holdingForFade()&&this._removeTile(e)}_updateRetainedTiles(e,s){let c={},d={},y=Math.max(s-ti.maxOverzooming,this._source.minzoom),v=Math.max(s+ti.maxUnderzooming,this._source.minzoom),w={};for(let T of e){let C=this._addTile(T);c[T.key]=T,C.hasData()||s<this._source.maxzoom&&(w[T.key]=T)}this._retainLoadedChildren(w,s,v,c);for(let T of e){let C=this._tiles[T.key];if(C.hasData())continue;if(s+1>this._source.maxzoom){let F=T.children(this._source.maxzoom)[0],j=this.getTile(F);if(j&&j.hasData()){c[F.key]=F;continue}}else{let F=T.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=T.overscaledZ-1;F>=y;--F){let j=T.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 s=[],c,d=this._tiles[e].tileID;for(;d.overscaledZ>0;){if(d.key in this._loadedParentTiles){c=this._loadedParentTiles[d.key];break}s.push(d.key);let y=d.scaledTo(d.overscaledZ-1);if(c=this._getLoadedTile(y),c)break;d=y}for(let y of s)this._loadedParentTiles[y]=c}}_addTile(e){let s=this._tiles[e.key];if(s)return s;s=this._cache.getAndRemove(e),s&&(this._setTileReloadTimer(e.key,s),s.tileID=e,this._state.initializeTileState(s,this.map?this.map.painter:null),this._cacheTimers[e.key]&&(clearTimeout(this._cacheTimers[e.key]),delete this._cacheTimers[e.key],this._setTileReloadTimer(e.key,s)));let c=s;return s||(s=new Bn(e,this._source.tileSize*e.overscaleFactor()),this._loadTile(s,this._tileLoaded.bind(this,s,e.key,s.state))),s.uses++,this._tiles[e.key]=s,c||this._source.fire(new a.Event("dataloading",{tile:s,coord:s.tileID,dataType:"source"})),s}_setTileReloadTimer(e,s){e in this._timers&&(clearTimeout(this._timers[e]),delete this._timers[e]);let c=s.getExpiryTimeout();c&&(this._timers[e]=setTimeout(()=>{this._reloadTile(e,"expired"),delete this._timers[e]},c))}_removeTile(e){let s=this._tiles[e];s&&(s.uses--,delete this._tiles[e],this._timers[e]&&(clearTimeout(this._timers[e]),delete this._timers[e]),s.uses>0||(s.hasData()&&s.state!=="reloading"?this._cache.add(s.tileID,s,s.getExpiryTimeout()):(s.aborted=!0,this._abortTile(s),this._unloadTile(s))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(let e in this._tiles)this._removeTile(e);this._cache.reset()}tilesIn(e,s,c){let d=[],y=this.transform;if(!y)return d;let v=c?y.getCameraQueryGeometry(e):e,w=e.map($=>y.pointCoordinate($)),T=v.map($=>y.pointCoordinate($)),C=this.getIds(),k=1/0,F=1/0,j=-1/0,Y=-1/0;for(let $ of T)k=Math.min(k,$.x),F=Math.min(F,$.y),j=Math.max(j,$.x),Y=Math.max(Y,$.y);for(let $=0;$<C.length;$++){let J=this._tiles[C[$]];if(J.holdingForFade())continue;let lt=J.tileID,ht=Math.pow(2,y.zoom-J.tileID.overscaledZ),gt=s*J.queryPadding*a.EXTENT/J.tileSize/ht,ut=[lt.getTilePoint(new a.MercatorCoordinate(k,F)),lt.getTilePoint(new a.MercatorCoordinate(j,Y))];if(ut[0].x-gt<a.EXTENT&&ut[0].y-gt<a.EXTENT&&ut[1].x+gt>=0&&ut[1].y+gt>=0){let kt=w.map(Tt=>lt.getTilePoint(Tt)),Mt=T.map(Tt=>lt.getTilePoint(Tt));d.push({tile:J,tileID:lt,queryGeometry:kt,cameraQueryGeometry:Mt,scale:ht})}}return d}getVisibleCoordinates(e){let s=this.getRenderableIds(e).map(c=>this._tiles[c].tileID);for(let c of s)c.posMatrix=this.transform.calculatePosMatrix(c.toUnwrapped());return s}hasTransition(){if(this._source.hasTransition())return!0;if(On(this._source.type))for(let e in this._tiles){let s=this._tiles[e];if(s.fadeEndTime!==void 0&&s.fadeEndTime>=a.exported.now())return!0}return!1}setFeatureState(e,s,c){this._state.updateState(e=e||"_geojsonTileLayer",s,c)}removeFeatureState(e,s,c){this._state.removeFeatureState(e=e||"_geojsonTileLayer",s,c)}getFeatureState(e,s){return this._state.getState(e=e||"_geojsonTileLayer",s)}setDependencies(e,s,c){let d=this._tiles[e];d&&d.setDependencies(s,c)}reloadTilesForDependencies(e,s){for(let c in this._tiles)this._tiles[c].hasDependency(e,s)&&this._reloadTile(c,"reloading");this._cache.filter(c=>!c.hasDependency(e,s))}}function an(p,e){let s=Math.abs(2*p.wrap)-+(p.wrap<0),c=Math.abs(2*e.wrap)-+(e.wrap<0);return p.overscaledZ-e.overscaledZ||c-s||e.canonical.y-p.canonical.y||e.canonical.x-p.canonical.x}function On(p){return p==="raster"||p==="image"||p==="video"}ti.maxOverzooming=10,ti.maxUnderzooming=3;let yn="mapboxgl_preloaded_worker_pool";class Br{constructor(){this.active={}}acquire(e){if(!this.workers)for(this.workers=[];this.workers.length<Br.workerCount;)this.workers.push(new Worker(ua.workerUrl));return this.active[e]=!0,this.workers.slice()}release(e){delete this.active[e],this.numActive()===0&&(this.workers.forEach(s=>{s.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[yn]}numActive(){return Object.keys(this.active).length}}let ys=Math.floor(a.exported.hardwareConcurrency/2),mt;function U(){return mt||(mt=new Br),mt}function B(p,e){let s={};for(let c in p)c!=="ref"&&(s[c]=p[c]);return a.refProperties.forEach(c=>{c in e&&(s[c]=e[c])}),s}function V(p){p=p.slice();let e=Object.create(null);for(let s=0;s<p.length;s++)e[p[s].id]=p[s];for(let s=0;s<p.length;s++)"ref"in p[s]&&(p[s]=B(p[s],e[p[s].ref]));return p}Br.workerCount=Math.max(Math.min(ys,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 nt(p,e,s){s.push({command:X.addSource,args:[p,e[p]]})}function _t(p,e,s){e.push({command:X.removeSource,args:[p]}),s[p]=!0}function Ft(p,e,s,c){_t(p,s,c),nt(p,e,s)}function Vt(p,e,s){let c;for(c in p[s])if(Object.prototype.hasOwnProperty.call(p[s],c)&&c!=="data"&&!N(p[s][c],e[s][c]))return!1;for(c in e[s])if(Object.prototype.hasOwnProperty.call(e[s],c)&&c!=="data"&&!N(p[s][c],e[s][c]))return!1;return!0}function ct(p,e,s,c,d,y){let v;for(v in e=e||{},p=p||{})Object.prototype.hasOwnProperty.call(p,v)&&(N(p[v],e[v])||s.push({command:y,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])||s.push({command:y,args:[c,v,e[v],d]}))}function zt(p){return p.id}function Ee(p,e){return p[e.id]=e,p}class Ae{constructor(e,s){this.reset(e,s)}reset(e,s){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(s||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 s=1,c=this._distances[s],d=e*this.paddedLength+this.padding;for(;c<d&&s<this._distances.length;)c=this._distances[++s];let y=s-1,v=this._distances[y],w=c-v,T=w>0?(d-v)/w:0;return this.points[y].mult(1-T).add(this.points[s].mult(T))}}function ce(p,e){let s=!0;return p==="always"||p!=="never"&&e!=="never"||(s=!1),s}class Ve{constructor(e,s,c){let d=this.boxCells=[],y=this.circleCells=[];this.xCellCount=Math.ceil(e/c),this.yCellCount=Math.ceil(s/c);for(let v=0;v<this.xCellCount*this.yCellCount;v++)d.push([]),y.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=e,this.height=s,this.xScale=this.xCellCount/e,this.yScale=this.yCellCount/s,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(e,s,c,d,y){this._forEachCell(s,c,d,y,this._insertBoxCell,this.boxUid++),this.boxKeys.push(e),this.bboxes.push(s),this.bboxes.push(c),this.bboxes.push(d),this.bboxes.push(y)}insertCircle(e,s,c,d){this._forEachCell(s-d,c-d,s+d,c+d,this._insertCircleCell,this.circleUid++),this.circleKeys.push(e),this.circles.push(s),this.circles.push(c),this.circles.push(d)}_insertBoxCell(e,s,c,d,y,v){this.boxCells[y].push(v)}_insertCircleCell(e,s,c,d,y,v){this.circleCells[y].push(v)}_query(e,s,c,d,y,v,w){if(c<0||e>this.width||d<0||s>this.height)return[];let T=[];if(e<=0&&s<=0&&this.width<=c&&this.height<=d){if(y)return[{key:null,x1:e,y1:s,x2:c,y2:d}];for(let C=0;C<this.boxKeys.length;C++)T.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];T.push({key:this.circleKeys[C],x1:k-j,y1:F-j,x2:k+j,y2:F+j})}}else this._forEachCell(e,s,c,d,this._queryCell,T,{hitTest:y,overlapMode:v,seenUids:{box:{},circle:{}}},w);return T}query(e,s,c,d){return this._query(e,s,c,d,!1,null)}hitTest(e,s,c,d,y,v){return this._query(e,s,c,d,!0,y,v).length>0}hitTestCircle(e,s,c,d,y){let v=e-c,w=e+c,T=s-c,C=s+c;if(w<0||v>this.width||C<0||T>this.height)return!1;let k=[];return this._forEachCell(v,T,w,C,this._queryCellCircle,k,{hitTest:!0,overlapMode:d,circle:{x:e,y:s,radius:c},seenUids:{box:{},circle:{}}},y),k.length>0}_queryCell(e,s,c,d,y,v,w,T){let{seenUids:C,hitTest:k,overlapMode:F}=w,j=this.boxCells[y];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]&&s<=$[lt+3]&&c>=$[lt+0]&&d>=$[lt+1]&&(!T||T(ht))&&(!k||!ce(F,ht.overlapMode))&&(v.push({key:ht,x1:$[lt],y1:$[lt+1],x2:$[lt+2],y2:$[lt+3]}),k))return!0}}let Y=this.circleCells[y];if(Y!==null){let $=this.circles;for(let J of Y)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,s,c,d)&&(!T||T(ht))&&(!k||!ce(F,ht.overlapMode))){let gt=$[lt],ut=$[lt+1],kt=$[lt+2];if(v.push({key:ht,x1:gt-kt,y1:ut-kt,x2:gt+kt,y2:ut+kt}),k)return!0}}}return!1}_queryCellCircle(e,s,c,d,y,v,w,T){let{circle:C,seenUids:k,overlapMode:F}=w,j=this.boxCells[y];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])&&(!T||T(ht))&&!ce(F,ht.overlapMode))return v.push(!0),!0}}let Y=this.circleCells[y];if(Y!==null){let $=this.circles;for(let J of Y)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)&&(!T||T(ht))&&!ce(F,ht.overlapMode))return v.push(!0),!0}}}_forEachCell(e,s,c,d,y,v,w,T){let C=this._convertToXCellCoord(e),k=this._convertToYCellCoord(s),F=this._convertToXCellCoord(c),j=this._convertToYCellCoord(d);for(let Y=C;Y<=F;Y++)for(let $=k;$<=j;$++)if(y.call(this,e,s,c,d,this.xCellCount*$+Y,v,w,T))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,s,c,d,y,v){let w=d-e,T=y-s,C=c+v;return C*C>w*w+T*T}_circleAndRectCollide(e,s,c,d,y,v,w){let T=(v-d)/2,C=Math.abs(e-(d+T));if(C>T+c)return!1;let k=(w-y)/2,F=Math.abs(s-(y+k));if(F>k+c)return!1;if(C<=T||F<=k)return!0;let j=C-T,Y=F-k;return j*j+Y*Y<=c*c}}function Pe(p,e,s,c,d){let y=a.create();return e?(a.scale(y,y,[1/d,1/d,1]),s||a.rotateZ(y,y,c.angle)):a.multiply(y,c.labelPlaneMatrix,p),y}function ei(p,e,s,c,d){if(e){let y=a.clone(p);return a.scale(y,y,[d,d,1]),s||a.rotateZ(y,y,-c.angle),y}return c.glCoordMatrix}function ke(p,e){let s=[p.x,p.y,0,1];Xe(s,s,e);let c=s[3];return{point:new a.pointGeometry(s[0]/c,s[1]/c),signedDistanceFromCamera:c}}function Gt(p,e){return .5+p/e*.5}function xe(p,e){let s=p[0]/p[3],c=p[1]/p[3];return s>=-e[0]&&s<=e[0]&&c>=-e[1]&&c<=e[1]}function pe(p,e,s,c,d,y,v,w,T){let C=c?p.textSizeData:p.iconSizeData,k=a.evaluateSizeForZoom(C,s.transform.zoom),F=[256/s.width*2+1,256/s.height*2+1],j=c?p.text.dynamicLayoutVertexArray:p.icon.dynamicLayoutVertexArray;j.clear();let Y=p.lineVertexArray,$=c?p.text.placedSymbolArray:p.icon.placedSymbolArray,J=s.transform.width/s.transform.height,lt=!1;for(let ht=0;ht<$.length;ht++){let gt=$.get(ht);if(gt.hidden||gt.writingMode===a.WritingMode.vertical&&!lt){ni(gt.numGlyphs,j);continue}lt=!1;let ut=[gt.anchorX,gt.anchorY,0,1];if(a.transformMat4(ut,ut,e),!xe(ut,F)){ni(gt.numGlyphs,j);continue}let kt=Gt(s.transform.cameraToCenterDistance,ut[3]),Mt=a.evaluateSizeForFeature(C,k,gt),Tt=v?Mt/kt:Mt*kt,Ut=new a.pointGeometry(gt.anchorX,gt.anchorY),$t=ke(Ut,d).point,Pt={},se=be(gt,Tt,!1,w,e,d,y,p.glyphOffsetArray,Y,j,$t,Ut,Pt,J,T);lt=se.useVertical,(se.notEnoughRoom||lt||se.needsFlipping&&be(gt,Tt,!0,w,e,d,y,p.glyphOffsetArray,Y,j,$t,Ut,Pt,J,T).notEnoughRoom)&&ni(gt.numGlyphs,j)}c?p.text.dynamicLayoutVertexBuffer.updateData(j):p.icon.dynamicLayoutVertexBuffer.updateData(j)}function oi(p,e,s,c,d,y,v,w,T,C,k,F){let j=w.glyphStartIndex+w.numGlyphs,Y=w.lineStartIndex,$=w.lineStartIndex+w.lineLength,J=e.getoffsetX(w.glyphStartIndex),lt=e.getoffsetX(j-1),ht=yi(p*J,s,c,d,y,v,w.segment,Y,$,T,C,k,F);if(!ht)return null;let gt=yi(p*lt,s,c,d,y,v,w.segment,Y,$,T,C,k,F);return gt?{first:ht,last:gt}:null}function Wi(p,e,s,c){return p===a.WritingMode.horizontal&&Math.abs(s.y-e.y)>Math.abs(s.x-e.x)*c?{useVertical:!0}:(p===a.WritingMode.vertical?e.y<s.y:e.x>s.x)?{needsFlipping:!0}:null}function be(p,e,s,c,d,y,v,w,T,C,k,F,j,Y,$){let J=e/24,lt=p.lineOffsetX*J,ht=p.lineOffsetY*J,gt;if(p.numGlyphs>1){let ut=p.glyphStartIndex+p.numGlyphs,kt=p.lineStartIndex,Mt=p.lineStartIndex+p.lineLength,Tt=oi(J,w,lt,ht,s,k,F,p,T,y,j,$);if(!Tt)return{notEnoughRoom:!0};let Ut=ke(Tt.first.point,v).point,$t=ke(Tt.last.point,v).point;if(c&&!s){let Pt=Wi(p.writingMode,Ut,$t,Y);if(Pt)return Pt}gt=[Tt.first];for(let Pt=p.glyphStartIndex+1;Pt<ut-1;Pt++)gt.push(yi(J*w.getoffsetX(Pt),lt,ht,s,k,F,p.segment,kt,Mt,T,y,j,$));gt.push(Tt.last)}else{if(c&&!s){let kt=ke(F,d).point,Mt=p.lineStartIndex+p.segment+1,Tt=new a.pointGeometry(T.getx(Mt),T.gety(Mt)),Ut=ke(Tt,d),$t=Ut.signedDistanceFromCamera>0?Ut.point:rr(F,Tt,kt,1,d),Pt=Wi(p.writingMode,kt,$t,Y);if(Pt)return Pt}let ut=yi(J*w.getoffsetX(p.glyphStartIndex),lt,ht,s,k,F,p.segment,p.lineStartIndex,p.lineStartIndex+p.lineLength,T,y,j,$);if(!ut)return{notEnoughRoom:!0};gt=[ut]}for(let ut of gt)a.addDynamicAttributes(C,ut.point,ut.angle);return{}}function rr(p,e,s,c,d){let y=ke(p.add(p.sub(e)._unit()),d).point,v=s.sub(y);return s.add(v._mult(c/v.mag()))}function yi(p,e,s,c,d,y,v,w,T,C,k,F,j){let Y=c?p-e:p+e,$=Y>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,kt=0,Mt=Math.abs(Y),Tt=[];for(;ut+kt<=Mt;){if(lt+=$,lt<w||lt>=T)return null;if(gt=ht,Tt.push(ht),ht=F[lt],ht===void 0){let Kt=new a.pointGeometry(C.getx(lt),C.gety(lt)),we=ke(Kt,k);if(we.signedDistanceFromCamera>0)ht=F[lt]=we.point;else{let Ue=lt-$;ht=rr(ut===0?y:new a.pointGeometry(C.getx(Ue),C.gety(Ue)),Kt,gt,Mt-ut+1,k)}}ut+=kt,kt=gt.dist(ht)}let Ut=(Mt-ut)/kt,$t=ht.sub(gt),Pt=$t.mult(Ut)._add(gt);Pt._add($t._unit()._perp()._mult(s*$));let se=J+Math.atan2(ht.y-gt.y,ht.x-gt.x);return Tt.push(Pt),{point:Pt,angle:j?se:0,path:Tt}}let nr=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function ni(p,e){for(let s=0;s<p;s++){let c=e.length;e.resize(c+4),e.float32.set(nr,3*c)}}function Xe(p,e,s){let c=e[0],d=e[1];return p[0]=s[0]*c+s[4]*d+s[12],p[1]=s[1]*c+s[5]*d+s[13],p[3]=s[3]*c+s[7]*d+s[15],p}let Gi=100;class _r{constructor(e,s=new Ve(e.width+200,e.height+200,25),c=new Ve(e.width+200,e.height+200,25)){this.transform=e,this.grid=s,this.ignoredGrid=c,this.pitchfactor=Math.cos(e._pitch)*e.cameraToCenterDistance,this.screenRightBoundary=e.width+Gi,this.screenBottomBoundary=e.height+Gi,this.gridRightBoundary=e.width+200,this.gridBottomBoundary=e.height+200}placeCollisionBox(e,s,c,d,y){let v=this.projectAndGetPerspectiveRatio(d,e.anchorPointX,e.anchorPointY),w=c*v.perspectiveRatio,T=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(T,C,k,F)||s!=="always"&&this.grid.hitTest(T,C,k,F,s,y)?{box:[],offscreen:!1}:{box:[T,C,k,F],offscreen:this.isOffscreen(T,C,k,F)}}placeCollisionCircles(e,s,c,d,y,v,w,T,C,k,F,j,Y){let $=[],J=new a.pointGeometry(s.anchorX,s.anchorY),lt=ke(J,v),ht=Gt(this.transform.cameraToCenterDistance,lt.signedDistanceFromCamera),gt=(k?y/ht:y*ht)/a.ONE_EM,ut=ke(J,w).point,kt=oi(gt,d,s.lineOffsetX*gt,s.lineOffsetY*gt,!1,ut,J,s,c,w,{},!1),Mt=!1,Tt=!1,Ut=!0;if(kt){let $t=.5*j*ht+Y,Pt=new a.pointGeometry(-100,-100),se=new a.pointGeometry(this.screenRightBoundary,this.screenBottomBoundary),Kt=new Ae,we=kt.first,Ue=kt.last,De=[];for(let Me=we.path.length-1;Me>=1;Me--)De.push(we.path[Me]);for(let Me=1;Me<Ue.path.length;Me++)De.push(Ue.path[Me]);let Oe=2.5*$t;if(T){let Me=De.map(je=>ke(je,T));De=Me.some(je=>je.signedDistanceFromCamera<=0)?[]:Me.map(je=>je.point)}let xi=[];if(De.length>0){let Me=De[0].clone(),je=De[0].clone();for(let ii=1;ii<De.length;ii++)Me.x=Math.min(Me.x,De[ii].x),Me.y=Math.min(Me.y,De[ii].y),je.x=Math.max(je.x,De[ii].x),je.y=Math.max(je.y,De[ii].y);xi=Me.x>=Pt.x&&je.x<=se.x&&Me.y>=Pt.y&&je.y<=se.y?[De]:je.x<Pt.x||Me.x>se.x||je.y<Pt.y||Me.y>se.y?[]:a.clipLine([De],Pt.x,Pt.y,se.x,se.y)}for(let Me of xi){Kt.reset(Me,.25*$t);let je=0;je=Kt.length<=.5*$t?1:Math.ceil(Kt.paddedLength/Oe)+1;for(let ii=0;ii<je;ii++){let Hi=ii/Math.max(je-1,1),br=Kt.lerp(Hi),Or=br.x+Gi,Nr=br.y+Gi;$.push(Or,Nr,$t,0);let Cn=Or-$t,pr=Nr-$t,ln=Or+$t,Zn=Nr+$t;if(Ut=Ut&&this.isOffscreen(Cn,pr,ln,Zn),Tt=Tt||this.isInsideGrid(Cn,pr,ln,Zn),e!=="always"&&this.grid.hitTestCircle(Or,Nr,$t,e,F)&&(Mt=!0,!C))return{circles:[],offscreen:!1,collisionDetected:Mt}}}}return{circles:!C&&Mt||!Tt?[]:$,offscreen:Ut,collisionDetected:Mt}}queryRenderedSymbols(e){if(e.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};let s=[],c=1/0,d=1/0,y=-1/0,v=-1/0;for(let k of e){let F=new a.pointGeometry(k.x+Gi,k.y+Gi);c=Math.min(c,F.x),d=Math.min(d,F.y),y=Math.max(y,F.x),v=Math.max(v,F.y),s.push(F)}let w=this.grid.query(c,d,y,v).concat(this.ignoredGrid.query(c,d,y,v)),T={},C={};for(let k of w){let F=k.key;if(T[F.bucketInstanceId]===void 0&&(T[F.bucketInstanceId]={}),T[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(s,j)&&(T[F.bucketInstanceId][F.featureIndex]=!0,C[F.bucketInstanceId]===void 0&&(C[F.bucketInstanceId]=[]),C[F.bucketInstanceId].push(F.featureIndex))}return C}insertCollisionBox(e,s,c,d,y,v){(c?this.ignoredGrid:this.grid).insert({bucketInstanceId:d,featureIndex:y,collisionGroupID:v,overlapMode:s},e[0],e[1],e[2],e[3])}insertCollisionCircles(e,s,c,d,y,v){let w=c?this.ignoredGrid:this.grid,T={bucketInstanceId:d,featureIndex:y,collisionGroupID:v,overlapMode:s};for(let C=0;C<e.length;C+=4)w.insertCircle(T,e[C],e[C+1],e[C+2])}projectAndGetPerspectiveRatio(e,s,c){let d=[s,c,0,1];return Xe(d,d,e),{point:new a.pointGeometry((d[0]/d[3]+1)/2*this.transform.width+Gi,(-d[1]/d[3]+1)/2*this.transform.height+Gi),perspectiveRatio:.5+this.transform.cameraToCenterDistance/d[3]*.5}}isOffscreen(e,s,c,d){return c<Gi||e>=this.screenRightBoundary||d<Gi||s>this.screenBottomBoundary}isInsideGrid(e,s,c,d){return c>=0&&e<this.gridRightBoundary&&d>=0&&s<this.gridBottomBoundary}getViewportMatrix(){let e=a.identity([]);return a.translate(e,e,[-100,-100,0]),e}}function _i(p,e,s){return e*(a.EXTENT/(p.tileSize*Math.pow(2,s-p.tileID.overscaledZ)))}class Hr{constructor(e,s,c,d){this.opacity=e?Math.max(0,Math.min(1,e.opacity+(e.placed?s:-s))):d&&c?1:0,this.placed=c}isHidden(){return this.opacity===0&&!this.placed}}class Xr{constructor(e,s,c,d,y){this.text=new Hr(e?e.text:null,s,c,y),this.icon=new Hr(e?e.icon:null,s,d,y)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class Zs{constructor(e,s,c){this.text=e,this.icon=s,this.skipFade=c}}class _s{constructor(){this.invProjMatrix=a.create(),this.viewportMatrix=a.create(),this.circles=[]}}class xs{constructor(e,s,c,d,y){this.bucketInstanceId=e,this.featureIndex=s,this.sourceLayerIndex=c,this.bucketIndex=d,this.tileID=y}}class Z{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 s=++this.maxGroupID;this.collisionGroups[e]={ID:s,predicate:c=>c.collisionGroupID===s}}return this.collisionGroups[e]}}function I(p,e,s,c,d){let{horizontalAlign:y,verticalAlign:v}=a.getAnchorAlignment(p),w=-(y-.5)*e,T=-(v-.5)*s,C=a.evaluateVariableOffset(p,c);return new a.pointGeometry(w+C[0]*d,T+C[1]*d)}function P(p,e,s,c,d,y){let{x1:v,x2:w,y1:T,y2:C,anchorPointX:k,anchorPointY:F}=p,j=new a.pointGeometry(e,s);return c&&j._rotate(d?y:-y),{x1:v+j.x,y1:T+j.y,x2:w+j.x,y2:C+j.y,anchorPointX:k,anchorPointY:F}}class q{constructor(e,s,c,d){this.transform=e.clone(),this.collisionIndex=new _r(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=s,this.retainedQueryData={},this.collisionGroups=new Z(c),this.collisionCircleArrays={},this.prevPlacement=d,d&&(d.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(e,s,c,d){let y=c.getBucket(s),v=c.latestFeatureIndex;if(!y||!v||s.id!==y.layerIds[0])return;let w=c.collisionBoxArray,T=y.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=T.get("text-pitch-alignment")==="map",Y=T.get("text-rotation-alignment")==="map",$=_i(c,1,this.transform.zoom),J=Pe(F,j,Y,this.transform,$),lt=null;if(j){let gt=ei(F,j,Y,this.transform,$);lt=a.multiply([],this.transform.labelPlaneMatrix,gt)}this.retainedQueryData[y.bucketInstanceId]=new xs(y.bucketInstanceId,v,y.sourceLayerIndex,y.index,c.tileID);let ht={bucket:y,layout:T,posMatrix:F,textLabelPlaneMatrix:J,labelToScreenMatrix:lt,scale:C,textPixelRatio:k,holdingForFade:c.holdingForFade(),collisionBoxArray:w,partiallyEvaluatedTextSize:a.evaluateSizeForZoom(y.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(y.sourceID)};if(d)for(let gt of y.sortKeyRanges){let{sortKey:ut,symbolInstanceStart:kt,symbolInstanceEnd:Mt}=gt;e.push({sortKey:ut,symbolInstanceStart:kt,symbolInstanceEnd:Mt,parameters:ht})}else e.push({symbolInstanceStart:0,symbolInstanceEnd:y.symbolInstances.length,parameters:ht})}attemptAnchorPlacement(e,s,c,d,y,v,w,T,C,k,F,j,Y,$,J){let lt=[j.textOffset0,j.textOffset1],ht=I(e,c,d,lt,y),gt=this.collisionIndex.placeCollisionBox(P(s,ht.x,ht.y,v,w,this.transform.angle),F,T,C,k.predicate);if((!J||this.collisionIndex.placeCollisionBox(P(J,ht.x,ht.y,v,w,this.transform.angle),F,T,C,k.predicate).box.length!==0)&&gt.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:y,prevAnchor:ut},this.markUsedJustification(Y,e,j,$),Y.allowVerticalPlacement&&(this.markUsedOrientation(Y,$,j),this.placedOrientations[j.crossTileID]=$),{shift:ht,placedGlyphBoxes:gt}}}placeLayerBucketPart(e,s,c){let{bucket:d,layout:y,posMatrix:v,textLabelPlaneMatrix:w,labelToScreenMatrix:T,textPixelRatio:C,holdingForFade:k,collisionBoxArray:F,partiallyEvaluatedTextSize:j,collisionGroup:Y}=e.parameters,$=y.get("text-optional"),J=y.get("icon-optional"),lt=a.getOverlapMode(y,"text-overlap","text-allow-overlap"),ht=lt==="always",gt=a.getOverlapMode(y,"icon-overlap","icon-allow-overlap"),ut=gt==="always",kt=y.get("text-rotation-alignment")==="map",Mt=y.get("text-pitch-alignment")==="map",Tt=y.get("icon-text-fit")!=="none",Ut=y.get("symbol-z-order")==="viewport-y",$t=ht&&(ut||!d.hasIconData()||J),Pt=ut&&(ht||!d.hasTextData()||$);!d.collisionArrays&&F&&d.deserializeCollisionBoxes(F);let se=(Kt,we)=>{if(s[Kt.crossTileID])return;if(k)return void(this.placements[Kt.crossTileID]=new Zs(!1,!1,!1));let Ue=!1,De=!1,Oe=!0,xi=null,Me={box:null,offscreen:null},je={box:null,offscreen:null},ii=null,Hi=null,br=null,Or=0,Nr=0,Cn=0;we.textFeatureIndex?Or=we.textFeatureIndex:Kt.useRuntimeCollisionCircles&&(Or=Kt.featureIndex),we.verticalTextFeatureIndex&&(Nr=we.verticalTextFeatureIndex);let pr=we.textBox;if(pr){let wr=Ke=>{let ki=a.WritingMode.horizontal;if(d.allowVerticalPlacement&&!Ke&&this.prevPlacement){let sr=this.prevPlacement.placedOrientations[Kt.crossTileID];sr&&(this.placedOrientations[Kt.crossTileID]=sr,ki=sr,this.markUsedOrientation(d,ki,Kt))}return ki},$e=(Ke,ki)=>{if(d.allowVerticalPlacement&&Kt.numVerticalGlyphVertices>0&&we.verticalTextBox){for(let sr of d.writingModes)if(sr===a.WritingMode.vertical?(Me=ki(),je=Me):Me=Ke(),Me&&Me.box&&Me.box.length)break}else Me=Ke()};if(y.get("text-variable-anchor")){let Ke=y.get("text-variable-anchor");if(this.prevPlacement&&this.prevPlacement.variableOffsets[Kt.crossTileID]){let ui=this.prevPlacement.variableOffsets[Kt.crossTileID];Ke.indexOf(ui.anchor)>0&&(Ke=Ke.filter(Hn=>Hn!==ui.anchor),Ke.unshift(ui.anchor))}let ki=(ui,Hn,hn)=>{let Qa=ui.x2-ui.x1,yl=ui.y2-ui.y1,to=Kt.textBoxScale,Ch=Tt&&gt==="never"?Hn:null,Xn={box:[],offscreen:!1},eo=lt!=="never"?2*Ke.length:Ke.length;for(let cn=0;cn<eo;++cn){let ks=this.attemptAnchorPlacement(Ke[cn%Ke.length],ui,Qa,yl,to,kt,Mt,C,v,Y,cn>=Ke.length?lt:"never",Kt,d,hn,Ch);if(ks&&(Xn=ks.placedGlyphBoxes,Xn&&Xn.box&&Xn.box.length)){Ue=!0,xi=ks.shift;break}}return Xn};$e(()=>ki(pr,we.iconBox,a.WritingMode.horizontal),()=>{let ui=we.verticalTextBox;return d.allowVerticalPlacement&&!(Me&&Me.box&&Me.box.length)&&Kt.numVerticalGlyphVertices>0&&ui?ki(ui,we.verticalIconBox,a.WritingMode.vertical):{box:null,offscreen:null}}),Me&&(Ue=Me.box,Oe=Me.offscreen);let sr=wr(Me&&Me.box);if(!Ue&&this.prevPlacement){let ui=this.prevPlacement.variableOffsets[Kt.crossTileID];ui&&(this.variableOffsets[Kt.crossTileID]=ui,this.markUsedJustification(d,ui.anchor,Kt,sr))}}else{let Ke=(ki,sr)=>{let ui=this.collisionIndex.placeCollisionBox(ki,lt,C,v,Y.predicate);return ui&&ui.box&&ui.box.length&&(this.markUsedOrientation(d,sr,Kt),this.placedOrientations[Kt.crossTileID]=sr),ui};$e(()=>Ke(pr,a.WritingMode.horizontal),()=>{let ki=we.verticalTextBox;return d.allowVerticalPlacement&&Kt.numVerticalGlyphVertices>0&&ki?Ke(ki,a.WritingMode.vertical):{box:null,offscreen:null}}),wr(Me&&Me.box&&Me.box.length)}}if(ii=Me,Ue=ii&&ii.box&&ii.box.length>0,Oe=ii&&ii.offscreen,Kt.useRuntimeCollisionCircles){let wr=d.text.placedSymbolArray.get(Kt.centerJustifiedTextSymbolIndex),$e=a.evaluateSizeForFeature(d.textSizeData,j,wr),Ke=y.get("text-padding");Hi=this.collisionIndex.placeCollisionCircles(lt,wr,d.lineVertexArray,d.glyphOffsetArray,$e,v,w,T,c,Mt,Y.predicate,Kt.collisionCircleDiameter,Ke),Ue=ht||Hi.circles.length>0&&!Hi.collisionDetected,Oe=Oe&&Hi.offscreen}if(we.iconFeatureIndex&&(Cn=we.iconFeatureIndex),we.iconBox){let wr=$e=>{let Ke=Tt&&xi?P($e,xi.x,xi.y,kt,Mt,this.transform.angle):$e;return this.collisionIndex.placeCollisionBox(Ke,gt,C,v,Y.predicate)};je&&je.box&&je.box.length&&we.verticalIconBox?(br=wr(we.verticalIconBox),De=br.box.length>0):(br=wr(we.iconBox),De=br.box.length>0),Oe=Oe&&br.offscreen}let ln=$||Kt.numHorizontalGlyphVertices===0&&Kt.numVerticalGlyphVertices===0,Zn=J||Kt.numIconVertices===0;if(ln||Zn?Zn?ln||(De=De&&Ue):Ue=De&&Ue:De=Ue=De&&Ue,Ue&&ii&&ii.box&&this.collisionIndex.insertCollisionBox(ii.box,lt,y.get("text-ignore-placement"),d.bucketInstanceId,je&&je.box&&Nr?Nr:Or,Y.ID),De&&br&&this.collisionIndex.insertCollisionBox(br.box,gt,y.get("icon-ignore-placement"),d.bucketInstanceId,Cn,Y.ID),Hi&&(Ue&&this.collisionIndex.insertCollisionCircles(Hi.circles,lt,y.get("text-ignore-placement"),d.bucketInstanceId,Or,Y.ID),c)){let wr=d.bucketInstanceId,$e=this.collisionCircleArrays[wr];$e===void 0&&($e=this.collisionCircleArrays[wr]=new _s);for(let Ke=0;Ke<Hi.circles.length;Ke+=4)$e.circles.push(Hi.circles[Ke+0]),$e.circles.push(Hi.circles[Ke+1]),$e.circles.push(Hi.circles[Ke+2]),$e.circles.push(Hi.collisionDetected?1:0)}this.placements[Kt.crossTileID]=new Zs(Ue||$t,De||Pt,Oe||d.justReloaded),s[Kt.crossTileID]=!0};if(Ut){let Kt=d.getSortedSymbolIndexes(this.transform.angle);for(let we=Kt.length-1;we>=0;--we){let Ue=Kt[we];se(d.symbolInstances.get(Ue),d.collisionArrays[Ue])}}else for(let Kt=e.symbolInstanceStart;Kt<e.symbolInstanceEnd;Kt++)se(d.symbolInstances.get(Kt),d.collisionArrays[Kt]);if(c&&d.bucketInstanceId in this.collisionCircleArrays){let Kt=this.collisionCircleArrays[d.bucketInstanceId];a.invert(Kt.invProjMatrix,v),Kt.viewportMatrix=this.collisionIndex.getViewportMatrix()}d.justReloaded=!1}markUsedJustification(e,s,c,d){let y;y=d===a.WritingMode.vertical?c.verticalPlacedTextSymbolIndex:{left:c.leftJustifiedTextSymbolIndex,center:c.centerJustifiedTextSymbolIndex,right:c.rightJustifiedTextSymbolIndex}[a.getAnchorJustification(s)];let v=[c.leftJustifiedTextSymbolIndex,c.centerJustifiedTextSymbolIndex,c.rightJustifiedTextSymbolIndex,c.verticalPlacedTextSymbolIndex];for(let w of v)w>=0&&(e.text.placedSymbolArray.get(w).crossTileID=y>=0&&w!==y?0:c.crossTileID)}markUsedOrientation(e,s,c){let d=s===a.WritingMode.horizontal||s===a.WritingMode.horizontalOnly?s:0,y=s===a.WritingMode.vertical?s: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=y)}commit(e){this.commitTime=e,this.zoomAtLastRecencyCheck=this.transform.zoom;let s=this.prevPlacement,c=!1;this.prevZoomAdjustment=s?s.zoomAdjustment(this.transform.zoom):0;let d=s?s.symbolFadeChange(e):1,y=s?s.opacities:{},v=s?s.variableOffsets:{},w=s?s.placedOrientations:{};for(let T in this.placements){let C=this.placements[T],k=y[T];k?(this.opacities[T]=new Xr(k,d,C.text,C.icon),c=c||C.text!==k.text.placed||C.icon!==k.icon.placed):(this.opacities[T]=new Xr(null,d,C.text,C.icon,C.skipFade),c=c||C.text||C.icon)}for(let T in y){let C=y[T];if(!this.opacities[T]){let k=new Xr(C,d,!1,!1);k.isHidden()||(this.opacities[T]=k,c=c||C.text.placed||C.icon.placed)}}for(let T in v)this.variableOffsets[T]||!this.opacities[T]||this.opacities[T].isHidden()||(this.variableOffsets[T]=v[T]);for(let T in w)this.placedOrientations[T]||!this.opacities[T]||this.opacities[T].isHidden()||(this.placedOrientations[T]=w[T]);c?this.lastPlacementChangeTime=e:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=s?s.lastPlacementChangeTime:e)}updateLayerOpacities(e,s){let c={};for(let d of s){let y=d.getBucket(e);y&&d.latestFeatureIndex&&e.id===y.layerIds[0]&&this.updateBucketOpacities(y,c,d.collisionBoxArray)}}updateBucketOpacities(e,s,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,y=new Xr(null,0,!1,!1,!0),v=d.get("text-allow-overlap"),w=d.get("icon-allow-overlap"),T=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 Xr(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 Y=($,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];s[gt]?ut=y:ut||(ut=j,this.opacities[gt]=ut),s[gt]=!0;let kt=J.numIconVertices>0,Mt=this.placedOrientations[J.crossTileID],Tt=Mt===a.WritingMode.vertical,Ut=Mt===a.WritingMode.horizontal||Mt===a.WritingMode.horizontalOnly;if(lt>0||ht>0){let $t=wt(ut.text);Y(e.text,lt,Tt?ae:$t),Y(e.text,ht,Ut?ae:$t);let Pt=ut.text.isHidden();[J.rightJustifiedTextSymbolIndex,J.centerJustifiedTextSymbolIndex,J.leftJustifiedTextSymbolIndex].forEach(we=>{we>=0&&(e.text.placedSymbolArray.get(we).hidden=Pt||Tt?1:0)}),J.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(J.verticalPlacedTextSymbolIndex).hidden=Pt||Ut?1:0);let se=this.variableOffsets[J.crossTileID];se&&this.markUsedJustification(e,se.anchor,J,Mt);let Kt=this.placedOrientations[J.crossTileID];Kt&&(this.markUsedJustification(e,"left",J,Kt),this.markUsedOrientation(e,Kt,J))}if(kt){let $t=wt(ut.icon),Pt=!(F&&J.verticalPlacedIconSymbolIndex&&Tt);J.placedIconSymbolIndex>=0&&(Y(e.icon,J.numIconVertices,Pt?$t:ae),e.icon.placedSymbolArray.get(J.placedIconSymbolIndex).hidden=ut.icon.isHidden()),J.verticalPlacedIconSymbolIndex>=0&&(Y(e.icon,J.numVerticalIconVertices,Pt?ae:$t),e.icon.placedSymbolArray.get(J.verticalPlacedIconSymbolIndex).hidden=ut.icon.isHidden())}if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){let $t=e.collisionArrays[$];if($t){let Pt=new a.pointGeometry(0,0);if($t.textBox||$t.verticalTextBox){let Kt=!0;if(T){let we=this.variableOffsets[gt];we?(Pt=I(we.anchor,we.width,we.height,we.textOffset,we.textBoxScale),C&&Pt._rotate(k?this.transform.angle:-this.transform.angle)):Kt=!1}$t.textBox&&H(e.textCollisionBox.collisionVertexArray,ut.text.placed,!Kt||Tt,Pt.x,Pt.y),$t.verticalTextBox&&H(e.textCollisionBox.collisionVertexArray,ut.text.placed,!Kt||Ut,Pt.x,Pt.y)}let se=Boolean(!Ut&&$t.verticalIconBox);$t.iconBox&&H(e.iconCollisionBox.collisionVertexArray,ut.icon.placed,se,F?Pt.x:0,F?Pt.y:0),$t.verticalIconBox&&H(e.iconCollisionBox.collisionVertexArray,ut.icon.placed,!se,F?Pt.x:0,F?Pt.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,s){let c=this.zoomAtLastRecencyCheck===s?1-this.zoomAdjustment(s):1;return this.zoomAtLastRecencyCheck=s,this.commitTime+this.fadeDuration*c>e}setStale(){this.stale=!0}}function H(p,e,s,c,d){p.emplaceBack(e?1:0,s?1:0,c||0,d||0),p.emplaceBack(e?1:0,s?1:0,c||0,d||0),p.emplaceBack(e?1:0,s?1:0,c||0,d||0),p.emplaceBack(e?1:0,s?1:0,c||0,d||0)}let K=Math.pow(2,25),st=Math.pow(2,24),it=Math.pow(2,17),rt=Math.pow(2,16),at=Math.pow(2,9),St=Math.pow(2,8),Bt=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,s=Math.floor(127*p.opacity);return s*K+e*st+s*it+e*rt+s*at+e*St+s*Bt+e}let ae=0;class te{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,s,c,d,y){let v=this._bucketParts;for(;this._currentTileIndex<e.length;)if(s.getBucketParts(v,d,e[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,y())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,v.sort((w,T)=>w.sortKey-T.sortKey));this._currentPartIndex<v.length;)if(s.placeLayerBucketPart(v[this._currentPartIndex],this._seenCrossTileIDs,c),this._currentPartIndex++,y())return!0;return!1}}class he{constructor(e,s,c,d,y,v,w){this.placement=new q(e,y,v,w),this._currentPlacementIndex=s.length-1,this._forceFullPlacement=c,this._showCollisionBoxes=d,this._done=!1}isDone(){return this._done}continuePlacement(e,s,c){let d=a.exported.now(),y=()=>{let v=a.exported.now()-d;return!this._forceFullPlacement&&v>2};for(;this._currentPlacementIndex>=0;){let v=s[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 te(v)),this._inProgressLayer.continuePlacement(c[v.source],this.placement,this._showCollisionBoxes,v,y))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(e){return this.placement.commit(e),this.placement}}let ge=512/a.EXTENT/2;class Ge{constructor(e,s,c){this.tileID=e,this.indexedSymbolInstances={},this.bucketInstanceId=c;for(let d=0;d<s.length;d++){let y=s.get(d),v=y.key;this.indexedSymbolInstances[v]||(this.indexedSymbolInstances[v]=[]),this.indexedSymbolInstances[v].push({crossTileID:y.crossTileID,coord:this.getScaledCoordinates(y,e)})}}getScaledCoordinates(e,s){let c=ge/Math.pow(2,s.canonical.z-this.tileID.canonical.z);return{x:Math.floor((s.canonical.x*a.EXTENT+e.anchorX)*c),y:Math.floor((s.canonical.y*a.EXTENT+e.anchorY)*c)}}findMatches(e,s,c){let d=this.tileID.canonical.z<s.canonical.z?1:Math.pow(2,this.tileID.canonical.z-s.canonical.z);for(let y=0;y<e.length;y++){let v=e.get(y);if(v.crossTileID)continue;let w=this.indexedSymbolInstances[v.key];if(!w)continue;let T=this.getScaledCoordinates(v,s);for(let C of w)if(Math.abs(C.coord.x-T.x)<=d&&Math.abs(C.coord.y-T.y)<=d&&!c[C.crossTileID]){c[C.crossTileID]=!0,v.crossTileID=C.crossTileID;break}}}}class Fe{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Le{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(e){let s=Math.round((e-this.lng)/360);if(s!==0)for(let c in this.indexes){let d=this.indexes[c],y={};for(let v in d){let w=d[v];w.tileID=w.tileID.unwrapTo(w.tileID.wrap+s),y[w.tileID.key]=w}this.indexes[c]=y}this.lng=e}addBucket(e,s,c){if(this.indexes[e.overscaledZ]&&this.indexes[e.overscaledZ][e.key]){if(this.indexes[e.overscaledZ][e.key].bucketInstanceId===s.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(e.overscaledZ,this.indexes[e.overscaledZ][e.key])}for(let y=0;y<s.symbolInstances.length;y++)s.symbolInstances.get(y).crossTileID=0;this.usedCrossTileIDs[e.overscaledZ]||(this.usedCrossTileIDs[e.overscaledZ]={});let d=this.usedCrossTileIDs[e.overscaledZ];for(let y in this.indexes){let v=this.indexes[y];if(Number(y)>e.overscaledZ)for(let w in v){let T=v[w];T.tileID.isChildOf(e)&&T.findMatches(s.symbolInstances,e,d)}else{let w=v[e.scaledTo(Number(y)).key];w&&w.findMatches(s.symbolInstances,e,d)}}for(let y=0;y<s.symbolInstances.length;y++){let v=s.symbolInstances.get(y);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 Ge(e,s.symbolInstances,s.bucketInstanceId),!0}removeBucketCrossTileIDs(e,s){for(let c in s.indexedSymbolInstances)for(let d of s.indexedSymbolInstances[c])delete this.usedCrossTileIDs[e][d.crossTileID]}removeStaleBuckets(e){let s=!1;for(let c in this.indexes){let d=this.indexes[c];for(let y in d)e[d[y].bucketInstanceId]||(this.removeBucketCrossTileIDs(c,d[y]),delete d[y],s=!0)}return s}}class Ie{constructor(){this.layerIndexes={},this.crossTileIDs=new Fe,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(e,s,c){let d=this.layerIndexes[e.id];d===void 0&&(d=this.layerIndexes[e.id]=new Le);let y=!1,v={};d.handleWrapJump(c);for(let w of s){let T=w.getBucket(e);T&&e.id===T.layerIds[0]&&(T.bucketInstanceId||(T.bucketInstanceId=++this.maxBucketInstanceId),d.addBucket(w.tileID,T,this.crossTileIDs)&&(y=!0),v[T.bucketInstanceId]=!0)}return d.removeStaleBuckets(v)&&(y=!0),y}pruneUnusedLayers(e){let s={};e.forEach(c=>{s[c]=!0});for(let c in this.layerIndexes)s[c]||delete this.layerIndexes[c]}}let Te=(p,e)=>a.emitValidationErrors(p,e&&e.filter(s=>s.identifier!=="source.canvas")),Ti=a.pick(X,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData"]),wi=a.pick(X,["setCenter","setZoom","setBearing","setPitch"]),qi=function(){let p={},e=a.spec.$version;for(let s in a.spec.$root){let c=a.spec.$root[s];if(c.required){let d=null;d=s==="version"?e:c.type==="array"?[]:{},d!=null&&(p[s]=d)}}return p}();class Zi extends a.Evented{constructor(e,s={}){super(),this.map=e,this.dispatcher=new Oi(U(),this),this.imageManager=new Ht,this.imageManager.setEventedParent(this),this.glyphManager=new Ce(e._requestManager,s.localIdeographFontFamily),this.lineAtlas=new Yi(256,512),this.crossTileSymbolIndex=new Ie,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=Zi.registerForPluginStateChange(d=>{c.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:d.pluginStatus,pluginURL:d.pluginURL},(y,v)=>{if(a.triggerPluginCompletionEvent(y),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 y=this.sourceCaches[d.sourceId];if(!y)return;let v=y.getSource();if(v&&v.vectorLayerIds)for(let w in this._layers){let T=this._layers[w];T.source===v.id&&this._validateLayer(T)}})}loadURL(e,s={}){this.fire(new a.Event("dataloading",{dataType:"style"}));let c=typeof s.validate!="boolean"||s.validate,d=this.map._requestManager.transformRequest(e,a.ResourceType.Style);this._request=a.getJSON(d,(y,v)=>{this._request=null,y?this.fire(new a.ErrorEvent(y)):v&&this._load(v,c)})}loadJSON(e,s={}){this.fire(new a.Event("dataloading",{dataType:"style"})),this._request=a.exported.frame(()=>{this._request=null,this._load(e,s.validate!==!1)})}loadEmpty(){this.fire(new a.Event("dataloading",{dataType:"style"})),this._load(qi,!1)}_load(e,s){if(s&&Te(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 Fi(this.stylesheet.light),this.fire(new a.Event("data",{dataType:"style"})),this.fire(new a.Event("style.load"))}_loadSprite(e){this._spriteRequest=function(s,c,d,y){let v,w,T,C=d>1?"@2x":"",k=a.getJSON(c.transformRequest(c.normalizeSpriteURL(s,C,".json"),a.ResourceType.SpriteJSON),(Y,$)=>{k=null,T||(T=Y,v=$,j())}),F=a.getImage(c.transformRequest(c.normalizeSpriteURL(s,C,".png"),a.ResourceType.SpriteImage),(Y,$)=>{F=null,T||(T=Y,w=$,j())});function j(){if(T)y(T);else if(v&&w){let Y=a.exported.getImageData(w),$={};for(let J in v){let{width:lt,height:ht,x:gt,y:ut,sdf:kt,pixelRatio:Mt,stretchX:Tt,stretchY:Ut,content:$t}=v[J],Pt=new a.RGBAImage({width:lt,height:ht});a.RGBAImage.copy(Y,Pt,{x:gt,y:ut},{x:0,y:0},{width:lt,height:ht}),$[J]={data:Pt,pixelRatio:Mt,sdf:kt,stretchX:Tt,stretchY:Ut,content:$t}}y(null,$)}}return{cancel(){k&&(k.cancel(),k=null),F&&(F.cancel(),F=null)}}}(e,this.map._requestManager,this.map.getPixelRatio(),(s,c)=>{if(this._spriteRequest=null,s)this.fire(new a.ErrorEvent(s));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 s=this.sourceCaches[e.source];if(!s)return;let c=e.sourceLayer;if(!c)return;let d=s.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 s=[];for(let c of e){let d=this._layers[c];d.type!=="custom"&&s.push(d.serialize())}return s}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 s=this._changed;if(this._changed){let d=Object.keys(this._updatedLayers),y=Object.keys(this._removedLayers);(d.length||y.length)&&this._updateWorkerLayers(d,y);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 y=this.sourceCaches[d];c[d]=y.used,y.used=!1}for(let d of this._order){let y=this._layers[d];y.recalculate(e,this._availableImages),!y.isHidden(e.zoom)&&y.source&&(this.sourceCaches[y.source].used=!0)}for(let d in c){let y=this.sourceCaches[d];c[d]!==y.used&&y.fire(new a.Event("data",{sourceDataType:"visibility",dataType:"source",sourceId:d}))}this.light.recalculate(e),this.z=e.zoom,s&&this.fire(new a.Event("data",{dataType:"style"}))}_updateTilesForChangedImages(){let e=Object.keys(this._changedImages);if(e.length){for(let s in this.sourceCaches)this.sourceCaches[s].reloadTilesForDependencies(["icons","patterns"],e);this._changedImages={}}}_updateWorkerLayers(e,s){this.dispatcher.broadcast("updateLayers",{layers:this._serializeLayers(e),removedIds:s})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={}}setState(e){if(this._checkLoaded(),Te(this,a.validateStyle(e)))return!1;(e=a.clone$1(e)).layers=V(e.layers);let s=function(d,y){if(!d)return[{command:X.setStyle,args:[y]}];let v=[];try{if(!N(d.version,y.version))return[{command:X.setStyle,args:[y]}];N(d.center,y.center)||v.push({command:X.setCenter,args:[y.center]}),N(d.zoom,y.zoom)||v.push({command:X.setZoom,args:[y.zoom]}),N(d.bearing,y.bearing)||v.push({command:X.setBearing,args:[y.bearing]}),N(d.pitch,y.pitch)||v.push({command:X.setPitch,args:[y.pitch]}),N(d.sprite,y.sprite)||v.push({command:X.setSprite,args:[y.sprite]}),N(d.glyphs,y.glyphs)||v.push({command:X.setGlyphs,args:[y.glyphs]}),N(d.transition,y.transition)||v.push({command:X.setTransition,args:[y.transition]}),N(d.light,y.light)||v.push({command:X.setLight,args:[y.light]});let w={},T=[];(function(k,F,j,Y){let $;for($ in F=F||{},k=k||{})Object.prototype.hasOwnProperty.call(k,$)&&(Object.prototype.hasOwnProperty.call(F,$)||_t($,j,Y));for($ in F)Object.prototype.hasOwnProperty.call(F,$)&&(Object.prototype.hasOwnProperty.call(k,$)?N(k[$],F[$])||(k[$].type==="geojson"&&F[$].type==="geojson"&&Vt(k,F,$)?j.push({command:X.setGeoJSONSourceData,args:[$,F[$].data]}):Ft($,F,j,Y)):nt($,F,j))})(d.sources,y.sources,T,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(T),function(k,F,j){F=F||[];let Y=(k=k||[]).map(zt),$=F.map(zt),J=k.reduce(Ee,{}),lt=F.reduce(Ee,{}),ht=Y.slice(),gt=Object.create(null),ut,kt,Mt,Tt,Ut,$t,Pt;for(ut=0,kt=0;ut<Y.length;ut++)Mt=Y[ut],Object.prototype.hasOwnProperty.call(lt,Mt)?kt++:(j.push({command:X.removeLayer,args:[Mt]}),ht.splice(ht.indexOf(Mt,kt),1));for(ut=0,kt=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-kt),1)):kt++,$t=ht[ht.length-ut],j.push({command:X.addLayer,args:[lt[Mt],$t]}),ht.splice(ht.length-ut,0,Mt),gt[Mt]=!0);for(ut=0;ut<$.length;ut++)if(Mt=$[ut],Tt=J[Mt],Ut=lt[Mt],!gt[Mt]&&!N(Tt,Ut))if(N(Tt.source,Ut.source)&&N(Tt["source-layer"],Ut["source-layer"])&&N(Tt.type,Ut.type)){for(Pt in ct(Tt.layout,Ut.layout,j,Mt,null,X.setLayoutProperty),ct(Tt.paint,Ut.paint,j,Mt,null,X.setPaintProperty),N(Tt.filter,Ut.filter)||j.push({command:X.setFilter,args:[Mt,Ut.filter]}),N(Tt.minzoom,Ut.minzoom)&&N(Tt.maxzoom,Ut.maxzoom)||j.push({command:X.setLayerZoomRange,args:[Mt,Ut.minzoom,Ut.maxzoom]}),Tt)Object.prototype.hasOwnProperty.call(Tt,Pt)&&Pt!=="layout"&&Pt!=="paint"&&Pt!=="filter"&&Pt!=="metadata"&&Pt!=="minzoom"&&Pt!=="maxzoom"&&(Pt.indexOf("paint.")===0?ct(Tt[Pt],Ut[Pt],j,Mt,Pt.slice(6),X.setPaintProperty):N(Tt[Pt],Ut[Pt])||j.push({command:X.setLayerProperty,args:[Mt,Pt,Ut[Pt]]}));for(Pt in Ut)Object.prototype.hasOwnProperty.call(Ut,Pt)&&!Object.prototype.hasOwnProperty.call(Tt,Pt)&&Pt!=="layout"&&Pt!=="paint"&&Pt!=="filter"&&Pt!=="metadata"&&Pt!=="minzoom"&&Pt!=="maxzoom"&&(Pt.indexOf("paint.")===0?ct(Tt[Pt],Ut[Pt],j,Mt,Pt.slice(6),X.setPaintProperty):N(Tt[Pt],Ut[Pt])||j.push({command:X.setLayerProperty,args:[Mt,Pt,Ut[Pt]]}))}else j.push({command:X.removeLayer,args:[Mt]}),$t=ht[ht.lastIndexOf(Mt)+1],j.push({command:X.addLayer,args:[Ut,$t]})}(C,y.layers,v)}catch(w){console.warn("Unable to compute style diff:",w),v=[{command:X.setStyle,args:[y]}]}return v}(this.serialize(),e).filter(d=>!(d.command in wi));if(s.length===0)return!1;let c=s.filter(d=>!(d.command in Ti));if(c.length>0)throw new Error(`Unimplemented: ${c.map(d=>d.command).join(", ")}.`);return s.forEach(d=>{d.command!=="setTransition"&&this[d.command].apply(this,d.args)}),this.stylesheet=e,!0}addImage(e,s){if(this.getImage(e))return this.fire(new a.ErrorEvent(new Error(`An image named "${e}" already exists.`)));this.imageManager.addImage(e,s),this._afterImageUpdated(e)}updateImage(e,s){this.imageManager.updateImage(e,s)}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,s,c={}){if(this._checkLoaded(),this.sourceCaches[e]!==void 0)throw new Error(`Source "${e}" already exists.`);if(!s.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(s).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(s.type)>=0&&this._validate(a.validateStyle.source,`sources.${e}`,s,null,c))return;this.map&&this.map._collectResourceTiming&&(s.collectResourceTiming=!0);let d=this.sourceCaches[e]=new ti(e,s,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 s=this.sourceCaches[e];delete this.sourceCaches[e],delete this._updatedSources[e],s.fire(new a.Event("data",{sourceDataType:"metadata",dataType:"source",sourceId:e})),s.setEventedParent(null),s.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(e,s){this._checkLoaded(),this.sourceCaches[e].getSource().setData(s),this._changed=!0}getSource(e){return this.sourceCaches[e]&&this.sourceCaches[e].getSource()}addLayer(e,s,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 y;if(e.type==="custom"){if(Te(this,a.validateCustomStyleLayer(e)))return;y=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;y=a.createStyleLayer(e),this._validateLayer(y),y.setEventedParent(this,{layer:{id:d}}),this._serializedLayers[y.id]=y.serialize()}let v=s?this._order.indexOf(s):this._order.length;if(s&&v===-1)this.fire(new a.ErrorEvent(new Error(`Cannot add layer "${d}" before non-existing layer "${s}".`)));else{if(this._order.splice(v,0,d),this._layerOrderChanged=!0,this._layers[d]=y,this._removedLayers[d]&&y.source&&y.type!=="custom"){let w=this._removedLayers[d];delete this._removedLayers[d],w.type!==y.type?this._updatedSources[y.source]="clear":(this._updatedSources[y.source]="reload",this.sourceCaches[y.source].pause())}this._updateLayer(y),y.onAdd&&y.onAdd(this.map)}}moveLayer(e,s){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===s)return;let c=this._order.indexOf(e);this._order.splice(c,1);let d=s?this._order.indexOf(s):this._order.length;s&&d===-1?this.fire(new a.ErrorEvent(new Error(`Cannot move layer "${e}" before non-existing layer "${s}".`))):(this._order.splice(d,0,e),this._layerOrderChanged=!0)}removeLayer(e){this._checkLoaded();let s=this._layers[e];if(!s)return void this.fire(new a.ErrorEvent(new Error(`Cannot remove non-existing layer "${e}".`)));s.setEventedParent(null);let c=this._order.indexOf(e);this._order.splice(c,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[e]=s,delete this._layers[e],delete this._serializedLayers[e],delete this._updatedLayers[e],delete this._updatedPaintProps[e],s.onRemove&&s.onRemove(this.map)}getLayer(e){return this._layers[e]}hasLayer(e){return e in this._layers}setLayerZoomRange(e,s,c){this._checkLoaded();let d=this.getLayer(e);d?d.minzoom===s&&d.maxzoom===c||(s!=null&&(d.minzoom=s),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,s,c={}){this._checkLoaded();let d=this.getLayer(e);if(d){if(!N(d.filter,s))return s==null?(d.filter=void 0,void this._updateLayer(d)):void(this._validate(a.validateStyle.filter,`layers.${d.id}.filter`,s,null,c)||(d.filter=a.clone$1(s),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,s,c,d={}){this._checkLoaded();let y=this.getLayer(e);y?N(y.getLayoutProperty(s),c)||(y.setLayoutProperty(s,c,d),this._updateLayer(y)):this.fire(new a.ErrorEvent(new Error(`Cannot style non-existing layer "${e}".`)))}getLayoutProperty(e,s){let c=this.getLayer(e);if(c)return c.getLayoutProperty(s);this.fire(new a.ErrorEvent(new Error(`Cannot get style of non-existing layer "${e}".`)))}setPaintProperty(e,s,c,d={}){this._checkLoaded();let y=this.getLayer(e);y?N(y.getPaintProperty(s),c)||(y.setPaintProperty(s,c,d)&&this._updateLayer(y),this._changed=!0,this._updatedPaintProps[e]=!0):this.fire(new a.ErrorEvent(new Error(`Cannot style non-existing layer "${e}".`)))}getPaintProperty(e,s){return this.getLayer(e).getPaintProperty(s)}setFeatureState(e,s){this._checkLoaded();let c=e.source,d=e.sourceLayer,y=this.sourceCaches[c];if(y===void 0)return void this.fire(new a.ErrorEvent(new Error(`The source '${c}' does not exist in the map's style.`)));let v=y.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."))),y.setFeatureState(d,e.id,s)):this.fire(new a.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(e,s){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 y=d.getSource().type,v=y==="vector"?e.sourceLayer:void 0;y!=="vector"||v?s&&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,s):this.fire(new a.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(e){this._checkLoaded();let s=e.source,c=e.sourceLayer,d=this.sourceCaches[s];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 '${s}' 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 s=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(s(w)){c[w]=v;for(let T of e){let C=T[w];if(C)for(let k of C)d.push(k)}}}d.sort((v,w)=>w.intersectionZ-v.intersectionZ);let y=[];for(let v=this._order.length-1;v>=0;v--){let w=this._order[v];if(s(w))for(let T=d.length-1;T>=0;T--){let C=d[T].feature;if(c[C.layer.id]<v)break;y.push(C),d.pop()}else for(let T of e){let C=T[w];if(C)for(let k of C)y.push(k.feature)}}return y}queryRenderedFeatures(e,s,c){s&&s.filter&&this._validate(a.validateStyle.filter,"queryRenderedFeatures.filter",s.filter,null,s);let d={};if(s&&s.layers){if(!Array.isArray(s.layers))return this.fire(new a.ErrorEvent(new Error("parameters.layers must be an Array."))),[];for(let v of s.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 y=[];s.availableImages=this._availableImages;for(let v in this.sourceCaches)s.layers&&!d[v]||y.push(Zr(this.sourceCaches[v],this._layers,this._serializedLayers,e,s,c));return this.placement&&y.push(function(v,w,T,C,k,F,j){let Y={},$=F.queryRenderedSymbols(C),J=[];for(let lt of Object.keys($).map(Number))J.push(j[lt]);J.sort(En);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=Y[gt]=Y[gt]||[],kt=ht[gt];kt.sort((Mt,Tt)=>{let Ut=lt.featureSortOrder;if(Ut){let $t=Ut.indexOf(Mt.featureIndex);return Ut.indexOf(Tt.featureIndex)-$t}return Tt.featureIndex-Mt.featureIndex});for(let Mt of kt)ut.push(Mt)}}for(let lt in Y)Y[lt].forEach(ht=>{let gt=ht.feature,ut=T[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 Y}(this._layers,this._serializedLayers,this.sourceCaches,e,s,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(y)}querySourceFeatures(e,s){s&&s.filter&&this._validate(a.validateStyle.filter,"querySourceFeatures.filter",s.filter,null,s);let c=this.sourceCaches[e];return c?function(d,y){let v=d.getRenderableIds().map(C=>d.getTileByID(C)),w=[],T={};for(let C=0;C<v.length;C++){let k=v[C],F=k.tileID.canonical.key;T[F]||(T[F]=!0,k.querySourceFeatures(w,y))}return w}(c,s):[]}addSourceType(e,s,c){return Zi.getSourceType(e)?c(new Error(`A source type called "${e}" already exists.`)):(Zi.setSourceType(e,s),s.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:e,url:s.workerSourceURL},c):c(null,null))}getLight(){return this.light.getLight()}setLight(e,s={}){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 y={now:a.exported.now(),transition:a.extend({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(e,s),this.light.updateTransitions(y)}_validate(e,s,c,d,y={}){return(!y||y.validate!==!1)&&Te(this,e.call(a.validateStyle,a.extend({key:s,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 s=this.sourceCaches[e];s.setEventedParent(null),s.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 s in this.sourceCaches)this.sourceCaches[s].update(e)}_generateCollisionBoxes(){for(let e in this.sourceCaches)this._reloadSource(e)}_updatePlacement(e,s,c,d,y=!1){let v=!1,w=!1,T={};for(let C of this._order){let k=this._layers[C];if(k.type!=="symbol")continue;if(!T[k.source]){let j=this.sourceCaches[k.source];T[k.source]=j.getRenderableIds(!0).map(Y=>j.getTileByID(Y)).sort((Y,$)=>$.tileID.overscaledZ-Y.tileID.overscaledZ||(Y.tileID.isLessThan($.tileID)?-1:1))}let F=this.crossTileSymbolIndex.addLayer(k,T[k.source],e.center.lng);v=v||F}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((y=y||this._layerOrderChanged||c===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(a.exported.now(),e.zoom))&&(this.pauseablePlacement=new he(e,this._order,y,s,c,d,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,T),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,T[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,s,c){this.imageManager.getImages(s.icons,c),this._updateTilesForChangedImages();let d=this.sourceCaches[s.source];d&&d.setDependencies(s.tileID.key,s.type,s.icons)}getGlyphs(e,s,c){this.glyphManager.getGlyphs(s.stacks,c)}getResource(e,s,c){return a.makeRequest(s,c)}}Zi.getSourceType=function(p){return yr[p]},Zi.setSourceType=function(p,e){yr[p]=e},Zi.registerForPluginStateChange=a.registerForPluginStateChange;var Do=a.createLayout([{name:"a_pos",type:"Int16",components:2}]),Ro={prelude:si(`#ifdef GL_ES
4
4
  precision mediump float;
5
5
  #else
6
6
  #if !defined(lowp)
@@ -26,15 +26,15 @@ precision highp float;
26
26
  #endif
27
27
  #endif
28
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;
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:si(`uniform vec4 u_color;uniform float u_opacity;void main() {gl_FragColor=u_color*u_opacity;
30
30
  #ifdef OVERDRAW_INSPECTOR
31
31
  gl_FragColor=vec4(1.0);
32
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;
33
+ }`,"attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),backgroundPattern:si(`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
34
  #ifdef OVERDRAW_INSPECTOR
35
35
  gl_FragColor=vec4(1.0);
36
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;
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:si(`varying vec3 v_data;
38
38
  #pragma mapbox: define highp vec4 color
39
39
  #pragma mapbox: define mediump float radius
40
40
  #pragma mapbox: define lowp float blur
@@ -70,7 +70,7 @@ void main(void) {
70
70
  #pragma mapbox: initialize highp vec4 stroke_color
71
71
  #pragma mapbox: initialize mediump float stroke_width
72
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;
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:si("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:si(`uniform highp float u_intensity;varying vec2 v_extrude;
74
74
  #pragma mapbox: define highp float weight
75
75
  #define GAUSS_COEF 0.3989422804014327
76
76
  void main() {
@@ -87,11 +87,11 @@ const highp float ZERO=1.0/255.0/16.0;
87
87
  void main(void) {
88
88
  #pragma mapbox: initialize highp float weight
89
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;
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:si(`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
91
  #ifdef OVERDRAW_INSPECTOR
92
92
  gl_FragColor=vec4(0.0);
93
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
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:si("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:si("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:si("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:si(`#pragma mapbox: define highp vec4 color
95
95
  #pragma mapbox: define lowp float opacity
96
96
  void main() {
97
97
  #pragma mapbox: initialize highp vec4 color
@@ -106,7 +106,7 @@ gl_FragColor=vec4(1.0);
106
106
  void main() {
107
107
  #pragma mapbox: initialize highp vec4 color
108
108
  #pragma mapbox: initialize lowp float opacity
109
- gl_Position=u_matrix*vec4(a_pos,0,1);}`),fillOutline:ni(`varying vec2 v_pos;
109
+ gl_Position=u_matrix*vec4(a_pos,0,1);}`),fillOutline:si(`varying vec2 v_pos;
110
110
  #pragma mapbox: define highp vec4 outline_color
111
111
  #pragma mapbox: define lowp float opacity
112
112
  void main() {
@@ -122,7 +122,7 @@ gl_FragColor=vec4(1.0);
122
122
  void main() {
123
123
  #pragma mapbox: initialize highp vec4 outline_color
124
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;
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:si(`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
126
  #pragma mapbox: define lowp float opacity
127
127
  #pragma mapbox: define lowp vec4 pattern_from
128
128
  #pragma mapbox: define lowp vec4 pattern_to
@@ -146,7 +146,7 @@ void main() {
146
146
  #pragma mapbox: initialize mediump vec4 pattern_to
147
147
  #pragma mapbox: initialize lowp float pixel_ratio_from
148
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
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:si(`#ifdef GL_ES
150
150
  precision highp float;
151
151
  #endif
152
152
  uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;
@@ -173,7 +173,7 @@ void main() {
173
173
  #pragma mapbox: initialize mediump vec4 pattern_to
174
174
  #pragma mapbox: initialize lowp float pixel_ratio_from
175
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;
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:si(`varying vec4 v_color;void main() {gl_FragColor=v_color;
177
177
  #ifdef OVERDRAW_INSPECTOR
178
178
  gl_FragColor=vec4(1.0);
179
179
  #endif
@@ -185,7 +185,7 @@ void main() {
185
185
  #pragma mapbox: initialize highp float base
186
186
  #pragma mapbox: initialize highp float height
187
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;
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:si(`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
189
  #pragma mapbox: define lowp float base
190
190
  #pragma mapbox: define lowp float height
191
191
  #pragma mapbox: define lowp vec4 pattern_from
@@ -219,20 +219,20 @@ void main() {
219
219
  #pragma mapbox: initialize lowp float pixel_ratio_to
220
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
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
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:si(`#ifdef GL_ES
223
223
  precision highp float;
224
224
  #endif
225
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
226
  #ifdef OVERDRAW_INSPECTOR
227
227
  gl_FragColor=vec4(1.0);
228
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;
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:si(`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
230
  #define PI 3.141592653589793
231
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
232
  #ifdef OVERDRAW_INSPECTOR
233
233
  gl_FragColor=vec4(1.0);
234
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;
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:si(`uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;
236
236
  #pragma mapbox: define highp vec4 color
237
237
  #pragma mapbox: define lowp float blur
238
238
  #pragma mapbox: define lowp float opacity
@@ -260,7 +260,7 @@ void main() {
260
260
  #pragma mapbox: initialize mediump float gapwidth
261
261
  #pragma mapbox: initialize lowp float offset
262
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;
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:si(`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
264
  #pragma mapbox: define lowp float blur
265
265
  #pragma mapbox: define lowp float opacity
266
266
  void main() {
@@ -284,7 +284,7 @@ void main() {
284
284
  #pragma mapbox: initialize mediump float gapwidth
285
285
  #pragma mapbox: initialize lowp float offset
286
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
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:si(`#ifdef GL_ES
288
288
  precision highp float;
289
289
  #endif
290
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;
@@ -330,7 +330,7 @@ void main() {
330
330
  #pragma mapbox: initialize mediump vec4 pattern_to
331
331
  #pragma mapbox: initialize lowp float pixel_ratio_from
332
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;
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:si(`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
334
  #pragma mapbox: define highp vec4 color
335
335
  #pragma mapbox: define lowp float blur
336
336
  #pragma mapbox: define lowp float opacity
@@ -365,11 +365,11 @@ void main() {
365
365
  #pragma mapbox: initialize lowp float offset
366
366
  #pragma mapbox: initialize mediump float width
367
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);
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:si(`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
369
  #ifdef OVERDRAW_INSPECTOR
370
370
  gl_FragColor=vec4(1.0);
371
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;
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:si(`uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity;
373
373
  #pragma mapbox: define lowp float opacity
374
374
  void main() {
375
375
  #pragma mapbox: initialize lowp float opacity
@@ -383,7 +383,7 @@ void main() {
383
383
  #pragma mapbox: initialize lowp float opacity
384
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
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
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:si(`#define SDF_PX 8.0
387
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
388
  #pragma mapbox: define highp vec4 fill_color
389
389
  #pragma mapbox: define highp vec4 halo_color
@@ -414,7 +414,7 @@ void main() {
414
414
  #pragma mapbox: initialize lowp float halo_blur
415
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
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
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:si(`#define SDF_PX 8.0
418
418
  #define SDF 1.0
419
419
  #define ICON 0.0
420
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;
@@ -451,7 +451,7 @@ void main() {
451
451
  #pragma mapbox: initialize lowp float halo_blur
452
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
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"?`
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 si(p,e){let s=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,c=e.match(/attribute ([\w]+) ([\w]+)/g),d=p.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),y=e.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),v=y?y.concat(d):d,w={};return{fragmentSource:p=p.replace(s,(T,C,k,F,j)=>(w[j]=!0,C==="define"?`
455
455
  #ifndef HAS_UNIFORM_u_${j}
456
456
  varying ${k} ${F} ${j};
457
457
  #else
@@ -461,10 +461,10 @@ uniform ${k} ${F} u_${j};
461
461
  #ifdef HAS_UNIFORM_u_${j}
462
462
  ${k} ${F} ${j} = u_${j};
463
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"?`
464
+ `)),vertexSource:e=e.replace(s,(T,C,k,F,j)=>{let Y=F==="float"?"vec2":"vec4",$=j.match(/color/)?"color":Y;return w[j]?C==="define"?`
465
465
  #ifndef HAS_UNIFORM_u_${j}
466
466
  uniform lowp float u_${j}_t;
467
- attribute ${k} ${Q} a_${j};
467
+ attribute ${k} ${Y} a_${j};
468
468
  varying ${k} ${F} ${j};
469
469
  #else
470
470
  uniform ${k} ${F} u_${j};
@@ -484,7 +484,7 @@ uniform ${k} ${F} u_${j};
484
484
  `:C==="define"?`
485
485
  #ifndef HAS_UNIFORM_u_${j}
486
486
  uniform lowp float u_${j}_t;
487
- attribute ${k} ${Q} a_${j};
487
+ attribute ${k} ${Y} a_${j};
488
488
  #else
489
489
  uniform ${k} ${F} u_${j};
490
490
  #endif
@@ -500,12 +500,12 @@ uniform ${k} ${F} u_${j};
500
500
  #else
501
501
  ${k} ${F} ${j} = u_${j};
502
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&lt,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&&lt.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&&gt.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}&nbsp;${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="&#215;",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 y0(s){var l=Math.floor(s()*uo);return l===uo&&(l=uo-1),Jh.charAt(l)}function _0(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 x0(s,l){for(var h="";s>0;s--)h=y0(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 v0(){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 b0(s){return s||(s=v0()),function(h){return isNaN(h)&&(h=Date.now()),_0(h,Fu)+x0(tf,s)}}var rf=b0();var nf=()=>typeof localStorage<"u",sf=24*60*60*1e3,w0=30*sf,U1=91*sf;function Dl(){let s="c"+rf().toLowerCase();return nf()&&localStorage.setItem("api-key",s),s}function af(){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 j1="0".charCodeAt(0),$1="1".charCodeAt(0),W1="2".charCodeAt(0),Z1="3".charCodeAt(0);Z();Z();var po;(function(s){s[s.Xy=0]="Xy",s[s.Yx=1]="Yx"})(po||(po={}));function of(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=_,of(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 lf={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(uf(),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 og=da(df(),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 _f=da(mf(),1),xf=da(gf(),1);Z();function yf(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:Pb}=xf.default;function z0(s,l){return s[0]===l[0]&&s[1]===l[1]}function k0(s,l){return Wu(s,yf(l))}function Zu(s,l){let h=[];for(let y of s){let _=_f.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 vf(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 bf(s,l={}){return{type:"Feature",geometry:O0(s),properties:l}}function wf(s,l={}){return{type:"Feature",geometry:{type:"MultiPolygon",coordinates:s},properties:l}}Z();Z();Z();Z();Z();Z();function Mf(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,Sf=4,Fl=5,Hu=6378137,Tf=6356752314e-3,Xu=.0066943799901413165,_a=484813681109536e-20,Bt=Math.PI/2,Ef=.16666666666666666,If=.04722222222222222,Cf=.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 Af={ft:{to_meter:.3048},"us-ft":{to_meter:1200/3937}};Z();var Pf=/[\s_\-\/\(\)]/g;function Qr(s,l){if(s[l])return s[l];for(var h=Object.keys(s),y=l.toLowerCase().replace(Pf,""),_=-1,a,T;++_<h.length;)if(a=h[_],T=a.toLowerCase().replace(Pf,""),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(Af,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 zf=G0,Nl=1,kf=2,Lf=3,rc=4,Df=5,Ku=-1,N0=/\s/,U0=/[A-Za-z]/,V0=/[A-Za-z84_]/,nc=/[,\]]/,Rf=/[\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 kf:return this.keyword(s);case rc:return this.quoted(s);case Df:return this.afterquote(s);case Lf: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(Rf.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=Df;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=kf;return}if(s==='"'){this.word="",this.state=rc;return}if(Rf.test(s)){this.word=s,this.state=Lf;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 Bf(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]],Bf(l,h,s);return;default:for(y=-1;++y<s.length;)if(!Array.isArray(s[y]))return xa(s,l[h]);return Bf(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=zf(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}}Mf(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 Ff=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"],Of={init:e_,forward:i_,inverse:r_,names:n_};Z();function s_(){}function Nf(s){return s}var a_=["longlat","identity"],Uf={init:s_,forward:Nf,inverse:Nf,names:a_};var o_=[Of,Uf],ac={},oc=[];function Vf(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(Vf)}var Gf={start:h_,add:Vf,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 qf=Ae.WGS84={a:6378137,rf:298.257223563,ellipseName:"WGS 84"};Ae.sphere={a:6370997,b:6370997,ellipseName:"Normal Sphere (r=6370997)"};function jf(s,l,h,y){var _=s*s,a=l*l,T=(_-a)/_,M=0;y?(s*=1-T*(Ef+T*(If+T*Cf)),_=s*s,T=0):M=Math.sqrt(T);var D=(_-a)/a;return{es:T,e:M,ep2:D}}function $f(s,l,h,y,_){if(!s){var a=Qr(Ae,y);a||(a=qf),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=Sf,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 Wf=c_;Z();var Zf={};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 Zf[s]=T,T}function Hf(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:Zf[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=Ff(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=$f(h.a,h.b,h.rf,h.ellps,h.sphere),T=jf(a.a,a.b,a.rf,h.R_A),M=Hf(h.nadgrids),D=h.datum||Wf(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=Gf;vo.projections.start();var Ns=vo;Z();Z();Z();function Xf(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 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];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 Yf(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 tm(s,l,h){if(Xf(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=Jf(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=Tf,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=Kf(h,s.datum_type,s.datum_params)),cc(l.datum_type)&&(h=Yf(h,l.datum_type,l.datum_params)),h=hc(h,D,T,M),l.datum_type===yo){var N=Jf(l,!0,h);if(N!==0)return}return h}function Jf(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=Qf(_,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=Qf(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 Qf(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 im(s){em(s.x),em(s.y)}function em(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)),im(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=tm(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 rm=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 nm(s){return s instanceof Ns?s:s.oProj?s.oProj:Ns(s)}function v_(s,l,h){s=nm(s);var y=!1,_;return typeof l>"u"?(l=s,s=rm,y=!0):(typeof l.x<"u"||Array.isArray(l))&&(h=l,l=s,s=rm,y=!0),l=nm(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 sm=6,om="AJSAJS",lm="AFAFAF",bo=65,Gr=73,fn=79,Ul=86,Vl=90,hm={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(um(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(um(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 am(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=am(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+am(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=cm(h),_=Math.floor(s/1e5),a=Math.floor(l/1e5)%20;return E_(_,a,y)}function cm(s){var l=s%sm;return l===0&&(l=sm),l}function E_(s,l,h){var y=h-1,_=om.charCodeAt(y),a=lm.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 um(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=cm(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
503
+ `}),staticAttributes:c,staticUniforms:v}}class Fc{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(e,s,c,d,y,v,w,T){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===s&&this.boundLayoutVertexBuffer===c&&!C&&this.boundIndexBuffer===y&&this.boundVertexOffset===v&&this.boundDynamicVertexBuffer===w&&this.boundDynamicVertexBuffer2===T?(e.bindVertexArrayOES.set(this.vao),w&&w.bind(),y&&y.dynamicDraw&&y.bind(),T&&T.bind()):this.freshBind(s,c,d,y,v,w,T)}freshBind(e,s,c,d,y,v,w){let T,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),T=0,this.boundProgram=e,this.boundLayoutVertexBuffer=s,this.boundPaintVertexBuffers=c,this.boundIndexBuffer=d,this.boundVertexOffset=y,this.boundDynamicVertexBuffer=v,this.boundDynamicVertexBuffer2=w;else{T=k.currentNumAttributes||0;for(let j=C;j<T;j++)F.disableVertexAttribArray(j)}s.enableAttributes(F,e);for(let j of c)j.enableAttributes(F,e);v&&v.enableAttributes(F,e),w&&w.enableAttributes(F,e),s.bind(),s.setVertexAttribPointers(F,e,y);for(let j of c)j.bind(),j.setVertexAttribPointers(F,e,y);v&&(v.bind(),v.setVertexAttribPointers(F,e,y)),d&&d.bind(),w&&(w.bind(),w.setVertexAttribPointers(F,e,y)),k.currentNumAttributes=C}destroy(){this.vao&&(this.context.extVertexArrayObject.deleteVertexArrayOES(this.vao),this.vao=null)}}function Bo(p){let e=[];for(let s=0;s<p.length;s++){if(p[s]===null)continue;let c=p[s].split(" ");e.push(c.pop())}return e}class Oc{constructor(e,s,c,d,y,v){let w=e.gl;this.program=w.createProgram();let T=Bo(c.staticAttributes),C=d?d.getBinderAttributes():[],k=T.concat(C),F=c.staticUniforms?Bo(c.staticUniforms):[],j=d?d.getBinderUniforms():[],Y=F.concat(j),$=[];for(let Mt of Y)$.indexOf(Mt)<0&&$.push(Mt);let J=d?d.defines():[];v&&J.push("#define OVERDRAW_INSPECTOR;");let lt=J.concat(Ro.prelude.fragmentSource,c.fragmentSource).join(`
504
+ `),ht=J.concat(Ro.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 kt={};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&&!kt[Tt]){let Ut=w.getUniformLocation(this.program,Tt);Ut&&(kt[Tt]=Ut)}}this.fixedUniforms=y(e,kt),this.binderUniforms=d?d.getUniforms(e,kt):[]}draw(e,s,c,d,y,v,w,T,C,k,F,j,Y,$,J,lt){let ht=e.gl;if(this.failedToCreate)return;e.program.set(this.program),e.setDepthMode(c),e.setStencilMode(d),e.setColorMode(y),e.setCullFace(v);for(let ut in this.fixedUniforms)this.fixedUniforms[ut].set(w[ut]);$&&$.setUniforms(e,this.binderUniforms,j,{zoom:Y});let gt={[ht.LINES]:2,[ht.TRIANGLES]:3,[ht.LINE_STRIP]:1}[s];for(let ut of F.get()){let kt=ut.vaos||(ut.vaos={});(kt[T]||(kt[T]=new Fc)).bind(e,this,C,$?$.getPaintVertexBuffers():[],k,ut.vertexOffset,J,lt),ht.drawElements(s,ut.primitiveLength*gt,ht.UNSIGNED_SHORT,ut.primitiveOffset*gt*2)}}}function Fo(p,e,s){let c=1/_i(s,1,e.transform.tileZoom),d=Math.pow(2,s.tileID.overscaledZ),y=s.tileSize*Math.pow(2,e.transform.tileZoom)/d,v=y*(s.tileID.canonical.x+s.tileID.wrap*d),w=y*s.tileID.canonical.y;return{u_image:0,u_texsize:s.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 Kl=(p,e,s,c)=>{let d=e.style.light,y=d.properties.get("position"),v=[y.x,y.y,y.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],Y=k[1],$=k[2];C[0]=j*F[0]+Y*F[3]+$*F[6],C[1]=j*F[1]+Y*F[4]+$*F[7],C[2]=j*F[2]+Y*F[5]+$*F[8]}(v,v,w);let T=d.properties.get("color");return{u_matrix:p,u_lightpos:v,u_lightintensity:d.properties.get("intensity"),u_lightcolor:[T.r,T.g,T.b],u_vertical_gradient:+s,u_opacity:c}},Oo=(p,e,s,c,d,y,v)=>a.extend(Kl(p,e,s,c),Fo(y,e,v),{u_height_factor:-Math.pow(2,d.overscaledZ)/v.tileSize/8}),No=p=>({u_matrix:p}),Uo=(p,e,s,c)=>a.extend(No(p),Fo(s,e,c)),Jl=(p,e)=>({u_matrix:p,u_world:e}),Yl=(p,e,s,c,d)=>a.extend(Uo(p,e,s,c),{u_world:d}),Nn=(p,e,s,c)=>{let d=p.transform,y,v;if(c.paint.get("circle-pitch-alignment")==="map"){let w=_i(s,1,d.zoom);y=!0,v=[w,w]}else y=!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,s,c.paint.get("circle-translate"),c.paint.get("circle-translate-anchor")),u_pitch_with_map:+y,u_device_pixel_ratio:p.pixelRatio,u_extrude_scale:v}},Ea=(p,e,s)=>{let c=_i(s,1,e.zoom),d=Math.pow(2,e.zoom-s.tileID.overscaledZ),y=s.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:y}},vs=(p,e,s=1)=>({u_matrix:p,u_color:e,u_overlay:0,u_overlay_scale:s}),Hs=p=>({u_matrix:p}),Ia=(p,e,s,c)=>({u_matrix:p,u_extrude_scale:_i(e,1,s),u_intensity:c});function Ca(p,e){let s=Math.pow(2,e.canonical.z),c=e.canonical.y;return[new a.MercatorCoordinate(0,c/s).toLngLat().lat,new a.MercatorCoordinate(0,(c+1)/s).toLngLat().lat]}let Xs=(p,e,s)=>{let c=p.transform;return{u_matrix:Vo(p,e,s),u_ratio:1/_i(e,1,c.zoom),u_device_pixel_ratio:p.pixelRatio,u_units_to_pixels:[1/c.pixelsToGLUnits[0],1/c.pixelsToGLUnits[1]]}},Aa=(p,e,s,c)=>a.extend(Xs(p,e,s),{u_image:0,u_image_height:c}),Ks=(p,e,s,c)=>{let d=p.transform,y=Js(e,d);return{u_matrix:Vo(p,e,s),u_texsize:e.imageAtlasTexture.size,u_ratio:1/_i(e,1,d.zoom),u_device_pixel_ratio:p.pixelRatio,u_image:0,u_scale:[y,c.fromScale,c.toScale],u_fade:c.t,u_units_to_pixels:[1/d.pixelsToGLUnits[0],1/d.pixelsToGLUnits[1]]}},zi=(p,e,s,c,d)=>{let y=p.lineAtlas,v=Js(e,p.transform),w=s.layout.get("line-cap")==="round",T=y.getDash(c.from,w),C=y.getDash(c.to,w),k=T.width*d.fromScale,F=C.width*d.toScale;return a.extend(Xs(p,e,s),{u_patternscale_a:[v/k,-T.height/2],u_patternscale_b:[v/F,-C.height/2],u_sdfgamma:y.width/(256*Math.min(k,F)*p.pixelRatio)/2,u_image:0,u_tex_y_a:T.y,u_tex_y_b:C.y,u_mix:d.t})};function Js(p,e){return 1/_i(p,1,e.tileZoom)}function Vo(p,e,s){return p.translatePosMatrix(e.tileID.posMatrix,e,s.paint.get("line-translate"),s.paint.get("line-translate-anchor"))}let Ql=(p,e,s,c,d)=>{return{u_matrix:p,u_tl_parent:e,u_scale_parent:s,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:(y=d.paint.get("raster-contrast"),y>0?1/(1-y):1+y),u_spin_weights:th(d.paint.get("raster-hue-rotate"))};var y,v};function th(p){p*=Math.PI/180;let e=Math.sin(p),s=Math.cos(p);return[(2*s+1)/3,(-Math.sqrt(3)*e-s+1)/3,(Math.sqrt(3)*e-s+1)/3]}let Pa=(p,e,s,c,d,y,v,w,T,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:+s,u_aspect_ratio:k.width/k.height,u_fade_change:d.options.fadeDuration?d.symbolFadeChange:1,u_matrix:y,u_label_plane_matrix:v,u_coord_matrix:w,u_is_text:+T,u_pitch_with_map:+c,u_texsize:C,u_texture:0}},Go=(p,e,s,c,d,y,v,w,T,C,k)=>{let F=d.transform;return a.extend(Pa(p,e,s,c,d,y,v,w,T,C),{u_gamma_scale:c?Math.cos(F._pitch)*F.cameraToCenterDistance:1,u_device_pixel_ratio:d.pixelRatio,u_is_halo:+k})},Nc=(p,e,s,c,d,y,v,w,T,C)=>a.extend(Go(p,e,s,c,d,y,v,w,!0,T,!0),{u_texsize_icon:C,u_texture_icon:1}),Uc=(p,e,s)=>({u_matrix:p,u_opacity:e,u_color:s}),qo=(p,e,s,c,d,y)=>a.extend(function(v,w,T,C){let k=T.imageManager.getPattern(v.from.toString()),F=T.imageManager.getPattern(v.to.toString()),{width:j,height:Y}=T.imageManager.getPixelSize(),$=Math.pow(2,C.tileID.overscaledZ),J=C.tileSize*Math.pow(2,T.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,Y],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/_i(C,1,T.transform.tileZoom),u_pixel_coord_upper:[lt>>16,ht>>16],u_pixel_coord_lower:[65535&lt,65535&ht]}}(c,y,s,d),{u_matrix:p,u_opacity:e}),jo={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 $o{constructor(e,s,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,s.arrayBuffer,this.dynamicDraw?d.DYNAMIC_DRAW:d.STATIC_DRAW),this.dynamicDraw||delete s.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(e){let s=this.context.gl;this.context.unbindVAO(),this.bind(),s.bufferSubData(s.ELEMENT_ARRAY_BUFFER,0,e.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}let Wo={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class eh{constructor(e,s,c,d){this.length=s.length,this.attributes=c,this.itemSize=s.bytesPerElement,this.dynamicDraw=d,this.context=e;let y=e.gl;this.buffer=y.createBuffer(),e.bindVertexBuffer.set(this.buffer),y.bufferData(y.ARRAY_BUFFER,s.arrayBuffer,this.dynamicDraw?y.DYNAMIC_DRAW:y.STATIC_DRAW),this.dynamicDraw||delete s.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(e){let s=this.context.gl;this.bind(),s.bufferSubData(s.ARRAY_BUFFER,0,e.arrayBuffer)}enableAttributes(e,s){for(let c=0;c<this.attributes.length;c++){let d=s.attributes[this.attributes[c].name];d!==void 0&&e.enableVertexAttribArray(d)}}setVertexAttribPointers(e,s,c){for(let d=0;d<this.attributes.length;d++){let y=this.attributes[d],v=s.attributes[y.name];v!==void 0&&e.vertexAttribPointer(v,y.components,e[Wo[y.type]],!1,this.itemSize,y.offset+this.itemSize*(c||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class We{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 Vc extends We{getDefault(){return a.Color.transparent}set(e){let s=this.current;(e.r!==s.r||e.g!==s.g||e.b!==s.b||e.a!==s.a||this.dirty)&&(this.gl.clearColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}}class Ys extends We{getDefault(){return 1}set(e){(e!==this.current||this.dirty)&&(this.gl.clearDepth(e),this.current=e,this.dirty=!1)}}class Qs extends We{getDefault(){return 0}set(e){(e!==this.current||this.dirty)&&(this.gl.clearStencil(e),this.current=e,this.dirty=!1)}}class ih extends We{getDefault(){return[!0,!0,!0,!0]}set(e){let s=this.current;(e[0]!==s[0]||e[1]!==s[1]||e[2]!==s[2]||e[3]!==s[3]||this.dirty)&&(this.gl.colorMask(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}class xr extends We{getDefault(){return!0}set(e){(e!==this.current||this.dirty)&&(this.gl.depthMask(e),this.current=e,this.dirty=!1)}}class Zo extends We{getDefault(){return 255}set(e){(e!==this.current||this.dirty)&&(this.gl.stencilMask(e),this.current=e,this.dirty=!1)}}class za extends We{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(e){let s=this.current;(e.func!==s.func||e.ref!==s.ref||e.mask!==s.mask||this.dirty)&&(this.gl.stencilFunc(e.func,e.ref,e.mask),this.current=e,this.dirty=!1)}}class ka extends We{getDefault(){let e=this.gl;return[e.KEEP,e.KEEP,e.KEEP]}set(e){let s=this.current;(e[0]!==s[0]||e[1]!==s[1]||e[2]!==s[2]||this.dirty)&&(this.gl.stencilOp(e[0],e[1],e[2]),this.current=e,this.dirty=!1)}}class Ho extends We{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let s=this.gl;e?s.enable(s.STENCIL_TEST):s.disable(s.STENCIL_TEST),this.current=e,this.dirty=!1}}class Xo extends We{getDefault(){return[0,1]}set(e){let s=this.current;(e[0]!==s[0]||e[1]!==s[1]||this.dirty)&&(this.gl.depthRange(e[0],e[1]),this.current=e,this.dirty=!1)}}class La extends We{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let s=this.gl;e?s.enable(s.DEPTH_TEST):s.disable(s.DEPTH_TEST),this.current=e,this.dirty=!1}}class Ko extends We{getDefault(){return this.gl.LESS}set(e){(e!==this.current||this.dirty)&&(this.gl.depthFunc(e),this.current=e,this.dirty=!1)}}class Jo extends We{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let s=this.gl;e?s.enable(s.BLEND):s.disable(s.BLEND),this.current=e,this.dirty=!1}}class Da extends We{getDefault(){let e=this.gl;return[e.ONE,e.ZERO]}set(e){let s=this.current;(e[0]!==s[0]||e[1]!==s[1]||this.dirty)&&(this.gl.blendFunc(e[0],e[1]),this.current=e,this.dirty=!1)}}class rh extends We{getDefault(){return a.Color.transparent}set(e){let s=this.current;(e.r!==s.r||e.g!==s.g||e.b!==s.b||e.a!==s.a||this.dirty)&&(this.gl.blendColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}}class nh extends We{getDefault(){return this.gl.FUNC_ADD}set(e){(e!==this.current||this.dirty)&&(this.gl.blendEquation(e),this.current=e,this.dirty=!1)}}class bs extends We{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let s=this.gl;e?s.enable(s.CULL_FACE):s.disable(s.CULL_FACE),this.current=e,this.dirty=!1}}class Gc extends We{getDefault(){return this.gl.BACK}set(e){(e!==this.current||this.dirty)&&(this.gl.cullFace(e),this.current=e,this.dirty=!1)}}class qc extends We{getDefault(){return this.gl.CCW}set(e){(e!==this.current||this.dirty)&&(this.gl.frontFace(e),this.current=e,this.dirty=!1)}}class jc extends We{getDefault(){return null}set(e){(e!==this.current||this.dirty)&&(this.gl.useProgram(e),this.current=e,this.dirty=!1)}}class $c extends We{getDefault(){return this.gl.TEXTURE0}set(e){(e!==this.current||this.dirty)&&(this.gl.activeTexture(e),this.current=e,this.dirty=!1)}}class Wc extends We{getDefault(){let e=this.gl;return[0,0,e.drawingBufferWidth,e.drawingBufferHeight]}set(e){let s=this.current;(e[0]!==s[0]||e[1]!==s[1]||e[2]!==s[2]||e[3]!==s[3]||this.dirty)&&(this.gl.viewport(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}class Zc extends We{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let s=this.gl;s.bindFramebuffer(s.FRAMEBUFFER,e),this.current=e,this.dirty=!1}}class Yo extends We{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let s=this.gl;s.bindRenderbuffer(s.RENDERBUFFER,e),this.current=e,this.dirty=!1}}class Qo extends We{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let s=this.gl;s.bindTexture(s.TEXTURE_2D,e),this.current=e,this.dirty=!1}}class ws extends We{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let s=this.gl;s.bindBuffer(s.ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}class sh extends We{getDefault(){return null}set(e){let s=this.gl;s.bindBuffer(s.ELEMENT_ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}class ah extends We{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 tl extends We{getDefault(){return 4}set(e){if(e===this.current&&!this.dirty)return;let s=this.gl;s.pixelStorei(s.UNPACK_ALIGNMENT,e),this.current=e,this.dirty=!1}}class Un extends We{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let s=this.gl;s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e),this.current=e,this.dirty=!1}}class oh extends We{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let s=this.gl;s.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,e),this.current=e,this.dirty=!1}}class Vn extends We{constructor(e,s){super(e),this.context=e,this.parent=s}getDefault(){return null}}class Ms extends Vn{setDirty(){this.dirty=!0}set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let s=this.gl;s.framebufferTexture2D(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0,s.TEXTURE_2D,e,0),this.current=e,this.dirty=!1}}class lh extends Vn{set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let s=this.gl;s.framebufferRenderbuffer(s.FRAMEBUFFER,s.DEPTH_ATTACHMENT,s.RENDERBUFFER,e),this.current=e,this.dirty=!1}}class el{constructor(e,s,c,d){this.context=e,this.width=s,this.height=c;let y=this.framebuffer=e.gl.createFramebuffer();this.colorAttachment=new Ms(e,y),d&&(this.depthAttachment=new lh(e,y))}destroy(){let e=this.context.gl,s=this.colorAttachment.get();if(s&&e.deleteTexture(s),this.depthAttachment){let c=this.depthAttachment.get();c&&e.deleteRenderbuffer(c)}e.deleteFramebuffer(this.framebuffer)}}class Se{constructor(e,s,c){this.blendFunction=e,this.blendColor=s,this.mask=c}}Se.Replace=[1,0],Se.disabled=new Se(Se.Replace,a.Color.transparent,[!1,!1,!1,!1]),Se.unblended=new Se(Se.Replace,a.Color.transparent,[!0,!0,!0,!0]),Se.alphaBlended=new Se([1,771],a.Color.transparent,[!0,!0,!0,!0]);class Ra{constructor(e){this.gl=e,this.extVertexArrayObject=this.gl.getExtension("OES_vertex_array_object"),this.clearColor=new Vc(this),this.clearDepth=new Ys(this),this.clearStencil=new Qs(this),this.colorMask=new ih(this),this.depthMask=new xr(this),this.stencilMask=new Zo(this),this.stencilFunc=new za(this),this.stencilOp=new ka(this),this.stencilTest=new Ho(this),this.depthRange=new Xo(this),this.depthTest=new La(this),this.depthFunc=new Ko(this),this.blend=new Jo(this),this.blendFunc=new Da(this),this.blendColor=new rh(this),this.blendEquation=new nh(this),this.cullFace=new bs(this),this.cullFaceSide=new Gc(this),this.frontFace=new qc(this),this.program=new jc(this),this.activeTexture=new $c(this),this.viewport=new Wc(this),this.bindFramebuffer=new Zc(this),this.bindRenderbuffer=new Yo(this),this.bindTexture=new Qo(this),this.bindVertexBuffer=new ws(this),this.bindElementBuffer=new sh(this),this.bindVertexArrayOES=this.extVertexArrayObject&&new ah(this),this.pixelStoreUnpack=new tl(this),this.pixelStoreUnpackPremultiplyAlpha=new Un(this),this.pixelStoreUnpackFlipY=new oh(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,s){return new $o(this,e,s)}createVertexBuffer(e,s,c){return new eh(this,e,s,c)}createRenderbuffer(e,s,c){let d=this.gl,y=d.createRenderbuffer();return this.bindRenderbuffer.set(y),d.renderbufferStorage(d.RENDERBUFFER,e,s,c),this.bindRenderbuffer.set(null),y}createFramebuffer(e,s,c){return new el(this,e,s,c)}clear({color:e,depth:s}){let c=this.gl,d=0;e&&(d|=c.COLOR_BUFFER_BIT,this.clearColor.set(e),this.colorMask.set([!0,!0,!0,!0])),s!==void 0&&(d|=c.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(s),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,Se.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 Qe{constructor(e,s,c){this.func=e,this.mask=s,this.range=c}}Qe.ReadOnly=!1,Qe.ReadWrite=!0,Qe.disabled=new Qe(519,Qe.ReadOnly,[0,1]);let Ba=7680;class hi{constructor(e,s,c,d,y,v){this.test=e,this.ref=s,this.mask=c,this.fail=d,this.depthFail=y,this.pass=v}}hi.disabled=new hi({func:519,mask:0},0,0,Ba,Ba,Ba);class Mi{constructor(e,s,c){this.enable=e,this.mode=s,this.frontFace=c}}let Fa;function il(p,e,s,c,d,y,v){let w=p.context,T=w.gl,C=p.useProgram("collisionBox"),k=[],F=0,j=0;for(let ut=0;ut<c.length;ut++){let kt=c[ut],Mt=e.getTile(kt),Tt=Mt.getBucket(s);if(!Tt)continue;let Ut=kt.posMatrix;d[0]===0&&d[1]===0||(Ut=p.translatePosMatrix(kt.posMatrix,Mt,d,y));let $t=v?Tt.textCollisionBox:Tt.iconCollisionBox,Pt=Tt.collisionCircleArray;if(Pt.length>0){let se=a.create(),Kt=Ut;a.mul(se,Tt.placementInvProjMatrix,p.transform.glCoordMatrix),a.mul(se,se,Tt.placementViewportMatrix),k.push({circleArray:Pt,circleOffset:j,transform:Kt,invTransform:se}),F+=Pt.length/4,j=F}$t&&C.draw(w,T.LINES,Qe.disabled,hi.disabled,p.colorModeForRenderPass(),Mi.disabled,Ea(Ut,p.transform,Mt),s.id,$t.layoutVertexBuffer,$t.indexBuffer,$t.segments,null,p.transform.zoom,null,null,$t.collisionVertexBuffer)}if(!v||!k.length)return;let Y=p.useProgram("collisionCircle"),$=new a.CollisionCircleLayoutArray;$.resize(4*F),$._trim();let J=0;for(let ut of k)for(let kt=0;kt<ut.circleArray.length/4;kt++){let Mt=4*kt,Tt=ut.circleArray[Mt+0],Ut=ut.circleArray[Mt+1],$t=ut.circleArray[Mt+2],Pt=ut.circleArray[Mt+3];$.emplace(J++,Tt,Ut,$t,Pt,0),$.emplace(J++,Tt,Ut,$t,Pt,1),$.emplace(J++,Tt,Ut,$t,Pt,2),$.emplace(J++,Tt,Ut,$t,Pt,3)}(!Fa||Fa.length<2*F)&&(Fa=function(ut){let kt=2*ut,Mt=new a.QuadTriangleArray;Mt.resize(kt),Mt._trim();for(let Tt=0;Tt<kt;Tt++){let Ut=6*Tt;Mt.uint16[Ut+0]=4*Tt+0,Mt.uint16[Ut+1]=4*Tt+1,Mt.uint16[Ut+2]=4*Tt+2,Mt.uint16[Ut+3]=4*Tt+2,Mt.uint16[Ut+4]=4*Tt+3,Mt.uint16[Ut+5]=4*Tt+0}return Mt}(F));let lt=w.createIndexBuffer(Fa,!0),ht=w.createVertexBuffer($,a.collisionCircleLayout.members,!0);for(let ut of k){let kt={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]};Y.draw(w,T.TRIANGLES,Qe.disabled,hi.disabled,p.colorModeForRenderPass(),Mi.disabled,kt,s.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()}Mi.disabled=new Mi(!1,1029,2305),Mi.backCCW=new Mi(!0,1029,2305);let Hc=a.identity(new Float32Array(16));function rl(p,e,s,c,d,y){let{horizontalAlign:v,verticalAlign:w}=a.getAnchorAlignment(p),T=-(v-.5)*e,C=-(w-.5)*s,k=a.evaluateVariableOffset(p,c);return new a.pointGeometry((T/d+k[0])*y,(C/d+k[1])*y)}function Oa(p,e,s,c,d,y,v,w,T,C){let k=p.text.placedSymbolArray,F=p.text.dynamicLayoutVertexArray,j=p.icon.dynamicLayoutVertexArray,Y={};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=ke(gt,s?v:y),kt=Gt(d.cameraToCenterDistance,ut.signedDistanceFromCamera),Mt=a.evaluateSizeForFeature(p.textSizeData,T,J)*kt/a.ONE_EM;s&&(Mt*=p.tilePixelRatio/w);let{width:Tt,height:Ut,anchor:$t,textOffset:Pt,textBoxScale:se}=ht,Kt=rl($t,Tt,Ut,Pt,se,Mt),we=s?ke(gt.add(Kt),y).point:ut.point.add(e?Kt.rotate(-d.angle):Kt),Ue=p.allowVerticalPlacement&&J.placedOrientation===a.WritingMode.vertical?Math.PI/2:0;for(let De=0;De<J.numGlyphs;De++)a.addDynamicAttributes(F,we,Ue);C&&J.associatedIconIndex>=0&&(Y[J.associatedIconIndex]={shiftedAnchor:we,angle:Ue})}else ni(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)ni(lt.numGlyphs,j);else{let ht=Y[J];if(ht)for(let gt=0;gt<lt.numGlyphs;gt++)a.addDynamicAttributes(j,ht.shiftedAnchor,ht.angle);else ni(lt.numGlyphs,j)}}p.icon.dynamicLayoutVertexBuffer.updateData(j)}p.text.dynamicLayoutVertexBuffer.updateData(F)}function Na(p,e,s){return s.iconsInText&&e?"symbolTextAndIcon":p?"symbolSDF":"symbolIcon"}function Ua(p,e,s,c,d,y,v,w,T,C,k,F){let j=p.context,Y=j.gl,$=p.transform,J=w==="map",lt=T==="map",ht=w!=="viewport"&&s.layout.get("symbol-placement")!=="point",gt=J&&!lt&&!ht,ut=!s.layout.get("symbol-sort-key").isConstant(),kt=!1,Mt=p.depthModeForSublayer(0,Qe.ReadOnly),Tt=s.layout.get("text-variable-anchor"),Ut=[];for(let $t of c){let Pt=e.getTile($t),se=Pt.getBucket(s);if(!se)continue;let Kt=d?se.text:se.icon;if(!Kt||!Kt.segments.get().length)continue;let we=Kt.programConfigurations.get(s.id),Ue=d||se.sdfIcons,De=d?se.textSizeData:se.iconSizeData,Oe=lt||$.pitch!==0,xi=p.useProgram(Na(Ue,d,se),we),Me=a.evaluateSizeForZoom(De,$.zoom),je,ii,Hi,br,Or=[0,0],Nr=null;if(d){if(ii=Pt.glyphAtlasTexture,Hi=Y.LINEAR,je=Pt.glyphAtlasTexture.size,se.iconsInText){Or=Pt.imageAtlasTexture.size,Nr=Pt.imageAtlasTexture;let hn=De.kind==="composite"||De.kind==="camera";br=Oe||p.options.rotating||p.options.zooming||hn?Y.LINEAR:Y.NEAREST}}else{let hn=s.layout.get("icon-size").constantOr(0)!==1||se.iconsNeedLinear;ii=Pt.imageAtlasTexture,Hi=Ue||p.options.rotating||p.options.zooming||hn||Oe?Y.LINEAR:Y.NEAREST,je=Pt.imageAtlasTexture.size}let Cn=_i(Pt,1,p.transform.zoom),pr=Pe($t.posMatrix,lt,J,p.transform,Cn),ln=ei($t.posMatrix,lt,J,p.transform,Cn),Zn=Tt&&se.hasTextData(),wr=s.layout.get("icon-text-fit")!=="none"&&Zn&&se.hasIconData();if(ht){let hn=s.layout.get("text-rotation-alignment")==="map";pe(se,$t.posMatrix,p,d,pr,ln,lt,C,hn)}let $e=p.translatePosMatrix($t.posMatrix,Pt,y,v),Ke=ht||d&&Tt||wr?Hc:pr,ki=p.translatePosMatrix(ln,Pt,y,v,!0),sr=Ue&&s.paint.get(d?"text-halo-width":"icon-halo-width").constantOr(1)!==0,ui;ui=Ue?se.iconsInText?Nc(De.kind,Me,gt,lt,p,$e,Ke,ki,je,Or):Go(De.kind,Me,gt,lt,p,$e,Ke,ki,d,je,!0):Pa(De.kind,Me,gt,lt,p,$e,Ke,ki,d,je);let Hn={program:xi,buffers:Kt,uniformValues:ui,atlasTexture:ii,atlasTextureIcon:Nr,atlasInterpolation:Hi,atlasInterpolationIcon:br,isSDF:Ue,hasHalo:sr};if(ut&&se.canOverlap){kt=!0;let hn=Kt.segments.get();for(let Qa of hn)Ut.push({segments:new a.SegmentVector([Qa]),sortKey:Qa.sortKey,state:Hn})}else Ut.push({segments:Kt.segments,sortKey:0,state:Hn})}kt&&Ut.sort(($t,Pt)=>$t.sortKey-Pt.sortKey);for(let $t of Ut){let Pt=$t.state;if(j.activeTexture.set(Y.TEXTURE0),Pt.atlasTexture.bind(Pt.atlasInterpolation,Y.CLAMP_TO_EDGE),Pt.atlasTextureIcon&&(j.activeTexture.set(Y.TEXTURE1),Pt.atlasTextureIcon&&Pt.atlasTextureIcon.bind(Pt.atlasInterpolationIcon,Y.CLAMP_TO_EDGE)),Pt.isSDF){let se=Pt.uniformValues;Pt.hasHalo&&(se.u_is_halo=1,Va(Pt.buffers,$t.segments,s,p,Pt.program,Mt,k,F,se)),se.u_is_halo=0}Va(Pt.buffers,$t.segments,s,p,Pt.program,Mt,k,F,Pt.uniformValues)}}function Va(p,e,s,c,d,y,v,w,T){let C=c.context;d.draw(C,C.gl.TRIANGLES,y,v,w,Mi.disabled,T,s.id,p.layoutVertexBuffer,p.indexBuffer,e,s.paint,c.transform.zoom,p.programConfigurations.get(s.id),p.dynamicLayoutVertexBuffer,p.opacityVertexBuffer)}function nl(p,e,s,c,d,y,v){let w=p.context.gl,T=s.paint.get("fill-pattern"),C=T&&T.constantOr(1),k=s.getCrossfadeParameters(),F,j,Y,$,J;v?(j=C&&!s.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(s);if(!gt)continue;let ut=gt.programConfigurations.get(s.id),kt=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=T.constantOr(null);if(Mt&&ht.imageAtlas){let Ut=ht.imageAtlas,$t=Ut.patternPositions[Mt.to.toString()],Pt=Ut.patternPositions[Mt.from.toString()];$t&&Pt&&ut.setConstantPatternPositions($t,Pt)}let Tt=p.translatePosMatrix(lt.posMatrix,ht,s.paint.get("fill-translate"),s.paint.get("fill-translate-anchor"));if(v){$=gt.indexBuffer2,J=gt.segments2;let Ut=[w.drawingBufferWidth,w.drawingBufferHeight];Y=j==="fillOutlinePattern"&&C?Yl(Tt,p,k,ht,Ut):Jl(Tt,Ut)}else $=gt.indexBuffer,J=gt.segments,Y=C?Uo(Tt,p,k,ht):No(Tt);kt.draw(p.context,F,d,p.stencilModeForClipping(lt),y,Mi.disabled,Y,s.id,gt.layoutVertexBuffer,$,J,s.paint,p.transform.zoom,ut)}}function Ss(p,e,s,c,d,y,v){let w=p.context,T=w.gl,C=s.paint.get("fill-extrusion-pattern"),k=C.constantOr(1),F=s.getCrossfadeParameters(),j=s.paint.get("fill-extrusion-opacity");for(let Y of c){let $=e.getTile(Y),J=$.getBucket(s);if(!J)continue;let lt=J.programConfigurations.get(s.id),ht=p.useProgram(k?"fillExtrusionPattern":"fillExtrusion",lt);k&&(p.context.activeTexture.set(T.TEXTURE0),$.imageAtlasTexture.bind(T.LINEAR,T.CLAMP_TO_EDGE),lt.updatePaintBuffers(F));let gt=C.constantOr(null);if(gt&&$.imageAtlas){let Tt=$.imageAtlas,Ut=Tt.patternPositions[gt.to.toString()],$t=Tt.patternPositions[gt.from.toString()];Ut&&$t&&lt.setConstantPatternPositions(Ut,$t)}let ut=p.translatePosMatrix(Y.posMatrix,$,s.paint.get("fill-extrusion-translate"),s.paint.get("fill-extrusion-translate-anchor")),kt=s.paint.get("fill-extrusion-vertical-gradient"),Mt=k?Oo(ut,p,kt,j,Y,F,$):Kl(ut,p,kt,j);ht.draw(w,w.gl.TRIANGLES,d,y,v,Mi.backCCW,Mt,s.id,J.layoutVertexBuffer,J.indexBuffer,J.segments,s.paint,p.transform.zoom,lt)}}function Ga(p,e,s,c,d,y){let v=p.context,w=v.gl,T=e.fbo;if(!T)return;let C=p.useProgram("hillshade");v.activeTexture.set(w.TEXTURE0),w.bindTexture(w.TEXTURE_2D,T.colorAttachment.get());let k=((F,j,Y)=>{let $=Y.paint.get("hillshade-shadow-color"),J=Y.paint.get("hillshade-highlight-color"),lt=Y.paint.get("hillshade-accent-color"),ht=Y.paint.get("hillshade-illumination-direction")*(Math.PI/180);Y.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:Ca(0,j.tileID),u_light:[Y.paint.get("hillshade-exaggeration"),ht],u_shadow:$,u_highlight:J,u_accent:lt}})(p,e,s);C.draw(v,w.TRIANGLES,c,d,y,Mi.disabled,k,s.id,p.rasterBoundsBuffer,p.quadTriangleIndexBuffer,p.rasterBoundsSegments)}function Kr(p,e,s,c,d,y){let v=p.context,w=v.gl,T=e.dem;if(T&&T.data){let C=T.dim,k=T.stride,F=T.getPixels();if(v.activeTexture.set(w.TEXTURE1),v.pixelStoreUnpackPremultiplyAlpha.set(!1),e.demTexture=e.demTexture||p.getTileTexture(k),e.demTexture){let Y=e.demTexture;Y.update(F,{premultiply:!1}),Y.bind(w.NEAREST,w.CLAMP_TO_EDGE)}else e.demTexture=new Dt(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 Y=new Dt(v,{width:C,height:C,data:null},w.RGBA);Y.bind(w.LINEAR,w.CLAMP_TO_EDGE),j=e.fbo=v.createFramebuffer(C,C,!0),j.colorAttachment.set(Y.texture)}v.bindFramebuffer.set(j.framebuffer),v.viewport.set([0,0,C,C]),p.useProgram("hillshadePrepare").draw(v,w.TRIANGLES,c,d,y,Mi.disabled,((Y,$)=>{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:Y.overscaledZ,u_unpack:$.getUnpackVector()}})(e.tileID,T),s.id,p.rasterBoundsBuffer,p.quadTriangleIndexBuffer,p.rasterBoundsSegments),e.needsHillshadePrepare=!1}}function hh(p,e,s,c,d){let y=c.paint.get("raster-fade-duration");if(y>0){let v=a.exported.now(),w=(v-p.timeAdded)/y,T=e?(v-e.timeAdded)/y:-1,C=s.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-T,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 ch=new a.Color(1,0,0,1),uh=new a.Color(0,1,0,1),Ts=new a.Color(0,0,1,1),qa=new a.Color(1,0,1,1),sl=new a.Color(0,1,1,1);function ph(p,e,s,c){$a(p,0,e+s/2,p.transform.width,s,c)}function ja(p,e,s,c){$a(p,e-s/2,0,s,p.transform.height,c)}function $a(p,e,s,c,d,y){let v=p.context,w=v.gl;w.enable(w.SCISSOR_TEST),w.scissor(e*p.pixelRatio,s*p.pixelRatio,c*p.pixelRatio,d*p.pixelRatio),v.clear({color:y}),w.disable(w.SCISSOR_TEST)}function dh(p,e,s){let c=p.context,d=c.gl,y=s.posMatrix,v=p.useProgram("debug"),w=Qe.disabled,T=hi.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,T,C,Mi.disabled,vs(y,a.Color.red),k,p.debugBuffer,p.tileBorderIndexBuffer,p.debugSegments);let F=e.getTileByID(s.key).latestRawTileData,j=Math.floor((F&&F.byteLength||0)/1024),Y=e.getTile(s).tileSize,$=512/Math.min(Y,512)*(s.overscaledZ/p.transform.zoom)*.5,J=s.canonical.toString();s.overscaledZ!==s.canonical.z&&(J+=` => ${s.overscaledZ}`),function(lt,ht){lt.initDebugOverlayCanvas();let gt=lt.debugOverlayCanvas,ut=lt.context.gl,kt=lt.debugOverlayCanvas.getContext("2d");kt.clearRect(0,0,gt.width,gt.height),kt.shadowColor="white",kt.shadowBlur=2,kt.lineWidth=1.5,kt.strokeStyle="white",kt.textBaseline="top",kt.font="bold 36px Open Sans, sans-serif",kt.fillText(ht,5,5),kt.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,T,Se.alphaBlended,Mi.disabled,vs(y,a.Color.transparent,$),k,p.debugBuffer,p.quadTriangleIndexBuffer,p.debugSegments)}let ta={symbol:function(p,e,s,c,d){if(p.renderPass!=="translucent")return;let y=hi.disabled,v=p.colorModeForRenderPass();s.layout.get("text-variable-anchor")&&function(w,T,C,k,F,j,Y){let $=T.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 kt=a.evaluateSizeForZoom(ut.textSizeData,$.zoom),Mt=_i(gt,1,T.transform.zoom),Tt=Pe(ht.posMatrix,lt,J,T.transform,Mt),Ut=C.layout.get("icon-text-fit")!=="none"&&ut.hasIconData();if(kt){let $t=Math.pow(2,$.zoom-gt.tileID.overscaledZ);Oa(ut,J,lt,Y,$,Tt,ht.posMatrix,$t,kt,Ut)}}}(c,p,s,e,s.layout.get("text-rotation-alignment"),s.layout.get("text-pitch-alignment"),d),s.paint.get("icon-opacity").constantOr(1)!==0&&Ua(p,e,s,c,!1,s.paint.get("icon-translate"),s.paint.get("icon-translate-anchor"),s.layout.get("icon-rotation-alignment"),s.layout.get("icon-pitch-alignment"),s.layout.get("icon-keep-upright"),y,v),s.paint.get("text-opacity").constantOr(1)!==0&&Ua(p,e,s,c,!0,s.paint.get("text-translate"),s.paint.get("text-translate-anchor"),s.layout.get("text-rotation-alignment"),s.layout.get("text-pitch-alignment"),s.layout.get("text-keep-upright"),y,v),e.map.showCollisionBoxes&&(il(p,e,s,c,s.paint.get("text-translate"),s.paint.get("text-translate-anchor"),!0),il(p,e,s,c,s.paint.get("icon-translate"),s.paint.get("icon-translate-anchor"),!1))},circle:function(p,e,s,c){if(p.renderPass!=="translucent")return;let d=s.paint.get("circle-opacity"),y=s.paint.get("circle-stroke-width"),v=s.paint.get("circle-stroke-opacity"),w=!s.layout.get("circle-sort-key").isConstant();if(d.constantOr(1)===0&&(y.constantOr(1)===0||v.constantOr(1)===0))return;let T=p.context,C=T.gl,k=p.depthModeForSublayer(0,Qe.ReadOnly),F=hi.disabled,j=p.colorModeForRenderPass(),Y=[];for(let $=0;$<c.length;$++){let J=c[$],lt=e.getTile(J),ht=lt.getBucket(s);if(!ht)continue;let gt=ht.programConfigurations.get(s.id),ut={programConfiguration:gt,program:p.useProgram("circle",gt),layoutVertexBuffer:ht.layoutVertexBuffer,indexBuffer:ht.indexBuffer,uniformValues:Nn(p,J,lt,s)};if(w){let kt=ht.segments.get();for(let Mt of kt)Y.push({segments:new a.SegmentVector([Mt]),sortKey:Mt.sortKey,state:ut})}else Y.push({segments:ht.segments,sortKey:0,state:ut})}w&&Y.sort(($,J)=>$.sortKey-J.sortKey);for(let $ of Y){let{programConfiguration:J,program:lt,layoutVertexBuffer:ht,indexBuffer:gt,uniformValues:ut}=$.state;lt.draw(T,C.TRIANGLES,k,F,j,Mi.disabled,ut,s.id,ht,gt,$.segments,s.paint,p.transform.zoom,J)}},heatmap:function(p,e,s,c){if(s.paint.get("heatmap-opacity")!==0)if(p.renderPass==="offscreen"){let d=p.context,y=d.gl,v=hi.disabled,w=new Se([y.ONE,y.ONE],a.Color.transparent,[!0,!0,!0,!0]);(function(T,C,k){let F=T.gl;T.activeTexture.set(F.TEXTURE1),T.viewport.set([0,0,C.width/4,C.height/4]);let j=k.heatmapFbo;if(j)F.bindTexture(F.TEXTURE_2D,j.colorAttachment.get()),T.bindFramebuffer.set(j.framebuffer);else{let Y=F.createTexture();F.bindTexture(F.TEXTURE_2D,Y),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=T.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)}(T,C,Y,j)}})(d,p,s),d.clear({color:a.Color.transparent});for(let T=0;T<c.length;T++){let C=c[T];if(e.hasRenderableParent(C))continue;let k=e.getTile(C),F=k.getBucket(s);if(!F)continue;let j=F.programConfigurations.get(s.id),Y=p.useProgram("heatmap",j),{zoom:$}=p.transform;Y.draw(d,y.TRIANGLES,Qe.disabled,v,w,Mi.disabled,Ia(C.posMatrix,k,$,s.paint.get("heatmap-intensity")),s.id,F.layoutVertexBuffer,F.indexBuffer,F.segments,s.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,y){let v=d.context,w=v.gl,T=y.heatmapFbo;if(!T)return;v.activeTexture.set(w.TEXTURE0),w.bindTexture(w.TEXTURE_2D,T.colorAttachment.get()),v.activeTexture.set(w.TEXTURE1);let C=y.colorRampTexture;C||(C=y.colorRampTexture=new Dt(v,y.colorRamp,w.RGBA)),C.bind(w.LINEAR,w.CLAMP_TO_EDGE),d.useProgram("heatmapTexture").draw(v,w.TRIANGLES,Qe.disabled,hi.disabled,d.colorModeForRenderPass(),Mi.disabled,((k,F,j,Y)=>{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,y),y.id,d.viewportBuffer,d.quadTriangleIndexBuffer,d.viewportSegments,y.paint,d.transform.zoom)}(p,s))},line:function(p,e,s,c){if(p.renderPass!=="translucent")return;let d=s.paint.get("line-opacity"),y=s.paint.get("line-width");if(d.constantOr(1)===0||y.constantOr(1)===0)return;let v=p.depthModeForSublayer(0,Qe.ReadOnly),w=p.colorModeForRenderPass(),T=s.paint.get("line-dasharray"),C=s.paint.get("line-pattern"),k=C.constantOr(1),F=s.paint.get("line-gradient"),j=s.getCrossfadeParameters(),Y=k?"linePattern":T?"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(s);if(!ut)continue;let kt=ut.programConfigurations.get(s.id),Mt=p.context.program.get(),Tt=p.useProgram(Y,kt),Ut=lt||Tt.program!==Mt,$t=C.constantOr(null);if($t&&gt.imageAtlas){let se=gt.imageAtlas,Kt=se.patternPositions[$t.to.toString()],we=se.patternPositions[$t.from.toString()];Kt&&we&&kt.setConstantPatternPositions(Kt,we)}let Pt=k?Ks(p,gt,s,j):T?zi(p,gt,s,T,j):F?Aa(p,gt,s,ut.lineClipsArray.length):Xs(p,gt,s);if(k)$.activeTexture.set(J.TEXTURE0),gt.imageAtlasTexture.bind(J.LINEAR,J.CLAMP_TO_EDGE),kt.updatePaintBuffers(j);else if(T&&(Ut||p.lineAtlas.dirty))$.activeTexture.set(J.TEXTURE0),p.lineAtlas.bind($);else if(F){let se=ut.gradients[s.id],Kt=se.texture;if(s.gradientVersion!==se.version){let we=256;if(s.stepInterpolant){let Ue=e.getSource().maxzoom,De=ht.canonical.z===Ue?Math.ceil(1<<p.transform.maxZoom-ht.canonical.z):1;we=a.clamp(a.nextPowerOfTwo(ut.maxLineLength/a.EXTENT*1024*De),256,$.maxTextureSize)}se.gradient=a.renderColorRamp({expression:s.gradientExpression(),evaluationKey:"lineProgress",resolution:we,image:se.gradient||void 0,clips:ut.lineClipsArray}),se.texture?se.texture.update(se.gradient):se.texture=new Dt($,se.gradient,J.RGBA),se.version=s.gradientVersion,Kt=se.texture}$.activeTexture.set(J.TEXTURE0),Kt.bind(s.stepInterpolant?J.NEAREST:J.LINEAR,J.CLAMP_TO_EDGE)}Tt.draw($,J.TRIANGLES,v,p.stencilModeForClipping(ht),w,Mi.disabled,Pt,s.id,ut.layoutVertexBuffer,ut.indexBuffer,ut.segments,s.paint,p.transform.zoom,kt,ut.layoutVertexBuffer2),lt=!1}},fill:function(p,e,s,c){let d=s.paint.get("fill-color"),y=s.paint.get("fill-opacity");if(y.constantOr(1)===0)return;let v=p.colorModeForRenderPass(),w=s.paint.get("fill-pattern"),T=p.opaquePassEnabledForLayer()&&!w.constantOr(1)&&d.constantOr(a.Color.transparent).a===1&&y.constantOr(0)===1?"opaque":"translucent";if(p.renderPass===T){let C=p.depthModeForSublayer(1,p.renderPass==="opaque"?Qe.ReadWrite:Qe.ReadOnly);nl(p,e,s,c,C,v,!1)}if(p.renderPass==="translucent"&&s.paint.get("fill-antialias")){let C=p.depthModeForSublayer(s.getPaintProperty("fill-outline-color")?2:0,Qe.ReadOnly);nl(p,e,s,c,C,v,!0)}},"fill-extrusion":function(p,e,s,c){let d=s.paint.get("fill-extrusion-opacity");if(d!==0&&p.renderPass==="translucent"){let y=new Qe(p.context.gl.LEQUAL,Qe.ReadWrite,p.depthRangeFor3D);if(d!==1||s.paint.get("fill-extrusion-pattern").constantOr(1))Ss(p,e,s,c,y,hi.disabled,Se.disabled),Ss(p,e,s,c,y,p.stencilModeFor3D(),p.colorModeForRenderPass());else{let v=p.colorModeForRenderPass();Ss(p,e,s,c,y,hi.disabled,v)}}},hillshade:function(p,e,s,c){if(p.renderPass!=="offscreen"&&p.renderPass!=="translucent")return;let d=p.context,y=p.depthModeForSublayer(0,Qe.ReadOnly),v=p.colorModeForRenderPass(),[w,T]=p.renderPass==="translucent"?p.stencilConfigForOverlap(c):[{},c];for(let C of T){let k=e.getTile(C);k.needsHillshadePrepare&&p.renderPass==="offscreen"?Kr(p,k,s,y,hi.disabled,v):p.renderPass==="translucent"&&Ga(p,k,s,y,w[C.overscaledZ],v)}d.viewport.set([0,0,p.width,p.height])},raster:function(p,e,s,c){if(p.renderPass!=="translucent"||s.paint.get("raster-opacity")===0||!c.length)return;let d=p.context,y=d.gl,v=e.getSource(),w=p.useProgram("raster"),T=p.colorModeForRenderPass(),[C,k]=v instanceof Dr?[{},c]:p.stencilConfigForOverlap(c),F=k[k.length-1].overscaledZ,j=!p.options.moving;for(let Y of k){let $=p.depthModeForSublayer(Y.overscaledZ-F,s.paint.get("raster-opacity")===1?Qe.ReadWrite:Qe.ReadOnly,y.LESS),J=e.getTile(Y),lt=p.transform.calculatePosMatrix(Y.toUnwrapped(),j);J.registerFadeDuration(s.paint.get("raster-fade-duration"));let ht=e.findLoadedParent(Y,0),gt=hh(J,ht,e,s,p.transform),ut,kt,Mt=s.paint.get("raster-resampling")==="nearest"?y.NEAREST:y.LINEAR;d.activeTexture.set(y.TEXTURE0),J.texture.bind(Mt,y.CLAMP_TO_EDGE,y.LINEAR_MIPMAP_NEAREST),d.activeTexture.set(y.TEXTURE1),ht?(ht.texture.bind(Mt,y.CLAMP_TO_EDGE,y.LINEAR_MIPMAP_NEAREST),ut=Math.pow(2,ht.tileID.overscaledZ-J.tileID.overscaledZ),kt=[J.tileID.canonical.x*ut%1,J.tileID.canonical.y*ut%1]):J.texture.bind(Mt,y.CLAMP_TO_EDGE,y.LINEAR_MIPMAP_NEAREST);let Tt=Ql(lt,kt||[0,0],ut||1,gt,s);v instanceof Dr?w.draw(d,y.TRIANGLES,$,hi.disabled,T,Mi.disabled,Tt,s.id,v.boundsBuffer,p.quadTriangleIndexBuffer,v.boundsSegments):w.draw(d,y.TRIANGLES,$,C[Y.overscaledZ],T,Mi.disabled,Tt,s.id,p.rasterBoundsBuffer,p.quadTriangleIndexBuffer,p.rasterBoundsSegments)}},background:function(p,e,s){let c=s.paint.get("background-color"),d=s.paint.get("background-opacity");if(d===0)return;let y=p.context,v=y.gl,w=p.transform,T=w.tileSize,C=s.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=hi.disabled,j=p.depthModeForSublayer(0,k==="opaque"?Qe.ReadWrite:Qe.ReadOnly),Y=p.colorModeForRenderPass(),$=p.useProgram(C?"backgroundPattern":"background"),J=w.coveringTiles({tileSize:T});C&&(y.activeTexture.set(v.TEXTURE0),p.imageManager.bind(p.context));let lt=s.getCrossfadeParameters();for(let ht of J){let gt=p.transform.calculatePosMatrix(ht.toUnwrapped()),ut=C?qo(gt,d,p,C,{tileID:ht,tileSize:T},lt):Uc(gt,d,c);$.draw(y,v.TRIANGLES,j,F,Y,Mi.disabled,ut,s.id,p.tileExtentBuffer,p.quadTriangleIndexBuffer,p.tileExtentSegments)}},debug:function(p,e,s){for(let c=0;c<s.length;c++)dh(p,e,s[c])},custom:function(p,e,s){let c=p.context,d=s.implementation;if(p.renderPass==="offscreen"){let y=d.prerender;y&&(p.setCustomLayerDefaults(),c.setColorMode(p.colorModeForRenderPass()),y.call(d,c.gl,p.transform.customLayerMatrix()),c.setDirty(),p.setBaseState())}else if(p.renderPass==="translucent"){p.setCustomLayerDefaults(),c.setColorMode(p.colorModeForRenderPass()),c.setStencilMode(hi.disabled);let y=d.renderingMode==="3d"?new Qe(p.context.gl.LEQUAL,Qe.ReadWrite,p.depthRangeFor3D):p.depthModeForSublayer(0,Qe.ReadOnly);c.setDepthMode(y),d.render(c.gl,p.transform.customLayerMatrix()),c.setDirty(),p.setBaseState(),c.bindFramebuffer.set(null)}}};class al{constructor(e,s){this.context=new Ra(e),this.transform=s,this._tileTextures={},this.setup(),this.numSublayers=ti.maxUnderzooming+ti.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Ie,this.gpuTimers={}}resize(e,s,c){if(this.width=e*c,this.height=s*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,s=new a.PosArray;s.emplaceBack(0,0),s.emplaceBack(a.EXTENT,0),s.emplaceBack(0,a.EXTENT),s.emplaceBack(a.EXTENT,a.EXTENT),this.tileExtentBuffer=e.createVertexBuffer(s,Do.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,Do.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,Lr.members),this.rasterBoundsSegments=a.SegmentVector.simpleSegment(0,0,4,2);let y=new a.PosArray;y.emplaceBack(0,0),y.emplaceBack(1,0),y.emplaceBack(0,1),y.emplaceBack(1,1),this.viewportBuffer=e.createVertexBuffer(y,Do.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 Dt(e,{width:1,height:1,data:new Uint8Array([0,0,0,0])},e.gl.RGBA);let T=this.context.gl;this.stencilClearMode=new hi({func:T.ALWAYS,mask:0},0,255,T.ZERO,T.ZERO,T.ZERO)}clearStencil(){let e=this.context,s=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,[s.drawingBufferWidth,s.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(e,s.TRIANGLES,Qe.disabled,this.stencilClearMode,Se.disabled,Mi.disabled,Hs(c),"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(e,s){if(this.currentStencilSource===e.source||!e.isTileClipped()||!s||!s.length)return;this.currentStencilSource=e.source;let c=this.context,d=c.gl;this.nextStencilID+s.length>256&&this.clearStencil(),c.setColorMode(Se.disabled),c.setDepthMode(Qe.disabled);let y=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(let v of s){let w=this._tileClippingMaskIDs[v.key]=this.nextStencilID++;y.draw(c,d.TRIANGLES,Qe.disabled,new hi({func:d.ALWAYS,mask:0},w,255,d.KEEP,d.KEEP,d.REPLACE),Se.disabled,Mi.disabled,Hs(v.posMatrix),"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();let e=this.nextStencilID++,s=this.context.gl;return new hi({func:s.NOTEQUAL,mask:255},e,255,s.KEEP,s.KEEP,s.REPLACE)}stencilModeForClipping(e){let s=this.context.gl;return new hi({func:s.EQUAL,mask:255},this._tileClippingMaskIDs[e.key],0,s.KEEP,s.KEEP,s.REPLACE)}stencilConfigForOverlap(e){let s=this.context.gl,c=e.sort((v,w)=>w.overscaledZ-v.overscaledZ),d=c[c.length-1].overscaledZ,y=c[0].overscaledZ-d+1;if(y>1){this.currentStencilSource=void 0,this.nextStencilID+y>256&&this.clearStencil();let v={};for(let w=0;w<y;w++)v[w+d]=new hi({func:s.GEQUAL,mask:255},w+this.nextStencilID,255,s.KEEP,s.KEEP,s.REPLACE);return this.nextStencilID+=y,[v,c]}return[{[d]:hi.disabled},c]}colorModeForRenderPass(){let e=this.context.gl;return this._showOverdrawInspector?new Se([e.CONSTANT_COLOR,e.ONE],new a.Color(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?Se.unblended:Se.alphaBlended}depthModeForSublayer(e,s,c){if(!this.opaquePassEnabledForLayer())return Qe.disabled;let d=1-((1+this.currentLayer)*this.numSublayers+e)*this.depthEpsilon;return new Qe(c||this.context.gl.LEQUAL,s,[d,d])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(e,s){this.style=e,this.options=s,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 T in d){let C=d[T];C.used&&C.prepare(this.context)}let y={},v={},w={};for(let T in d){let C=d[T];y[T]=C.getVisibleCoordinates(),v[T]=y[T].slice().reverse(),w[T]=C.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let T=0;T<c.length;T++)if(this.style._layers[c[T]].is3D()){this.opaquePassCutoff=T;break}this.renderPass="offscreen";for(let T of c){let C=this.style._layers[T];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:s.showOverdrawInspector?a.Color.black:a.Color.transparent,depth:1}),this.clearStencil(),this._showOverdrawInspector=s.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 T=this.style._layers[c[this.currentLayer]],C=d[T.source],k=y[T.source];this._renderTileClippingMasks(T,k),this.renderLayer(this,C,T,k)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<c.length;this.currentLayer++){let T=this.style._layers[c[this.currentLayer]],C=d[T.source],k=(T.type==="symbol"?w:v)[T.source];this._renderTileClippingMasks(T,y[T.source]),this.renderLayer(this,C,T,k)}if(this.options.showTileBoundaries){let T,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]),(!T||T.getSource().maxzoom<C.getSource().maxzoom)&&(T=C))}),T&&ta.debug(this,T,T.getVisibleCoordinates())}this.options.showPadding&&function(T){let C=T.transform.padding;ph(T,T.transform.height-(C.top||0),3,ch),ph(T,C.bottom||0,3,uh),ja(T,C.left||0,3,Ts),ja(T,T.transform.width-(C.right||0),3,qa);let k=T.transform.centerPoint;(function(F,j,Y,$){$a(F,j-1,Y-10,2,20,$),$a(F,j-10,Y-1,20,2,$)})(T,k.x,T.transform.height-k.y,sl)}(this),this.context.setDefault()}renderLayer(e,s,c,d){c.isHidden(this.transform.zoom)||(c.type==="background"||c.type==="custom"||d.length)&&(this.id=c.id,this.gpuTimingStart(c),ta[c.type](e,s,c,d,this.style.placement.variableOffsets),this.gpuTimingEnd())}gpuTimingStart(e){if(!this.options.gpuTiming)return;let s=this.context.extTimerQuery,c=this.gpuTimers[e.id];c||(c=this.gpuTimers[e.id]={calls:0,cpuTime:0,query:s.createQueryEXT()}),c.calls++,s.beginQueryEXT(s.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 s={};for(let c in e){let d=e[c],y=this.context.extTimerQuery,v=y.getQueryObjectEXT(d.query,y.QUERY_RESULT_EXT)/1e6;y.deleteQueryEXT(d.query),s[c]=v}return s}translatePosMatrix(e,s,c,d,y){if(!c[0]&&!c[1])return e;let v=y?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=[y?c[0]:_i(s,c[0],this.transform.zoom),y?c[1]:_i(s,c[1],this.transform.zoom),0],T=new Float32Array(16);return a.translate(T,e,w),T}saveTileTexture(e){let s=this._tileTextures[e.size[0]];s?s.push(e):this._tileTextures[e.size[0]]=[e]}getTileTexture(e){let s=this._tileTextures[e];return s&&s.length>0?s.pop():null}isPatternMissing(e){if(!e)return!1;if(!e.from||!e.to)return!0;let s=this.imageManager.getPattern(e.from.toString()),c=this.imageManager.getPattern(e.to.toString());return!s||!c}useProgram(e,s){this.cache=this.cache||{};let c=`${e}${s?s.cacheKey:""}${this._showOverdrawInspector?"/overdraw":""}`;return this.cache[c]||(this.cache[c]=new Oc(this.context,e,Ro[e],s,jo[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 Dt(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}}class Wa{constructor(e,s){this.points=e,this.planes=s}static fromInvProjectionMatrix(e,s,c){let d=Math.pow(2,c),y=[[-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]/s*d)),v=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(w=>{let T=function(j,Y){var $=Y[0],J=Y[1],lt=Y[2],ht=$*$+J*J+lt*lt;return ht>0&&(ht=1/Math.sqrt(ht)),j[0]=Y[0]*ht,j[1]=Y[1]*ht,j[2]=Y[2]*ht,j}([],function(j,Y,$){var J=Y[0],lt=Y[1],ht=Y[2],gt=$[0],ut=$[1],kt=$[2];return j[0]=lt*kt-ht*ut,j[1]=ht*gt-J*kt,j[2]=J*ut-lt*gt,j}([],Rt([],y[w[0]],y[w[1]]),Rt([],y[w[2]],y[w[1]]))),C=-((k=T)[0]*(F=y[w[1]])[0]+k[1]*F[1]+k[2]*F[2]);var k,F;return T.concat(C)});return new Wa(y,v)}}class Za{constructor(e,s){this.min=e,this.max=s,this.center=function(c,d,y){return c[0]=.5*d[0],c[1]=.5*d[1],c[2]=.5*d[2],c}([],function(c,d,y){return c[0]=d[0]+y[0],c[1]=d[1]+y[1],c[2]=d[2]+y[2],c}([],this.min,this.max))}quadrant(e){let s=[e%2==0,e<2],c=ot(this.min),d=ot(this.max);for(let y=0;y<s.length;y++)c[y]=s[y]?this.min[y]:this.center[y],d[y]=s[y]?this.center[y]:this.max[y];return d[2]=this.max[2],new Za(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 s=[[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 y=e.planes[d],v=0;for(let w=0;w<s.length;w++)a.dot(y,s[w])>=0&&v++;if(v===0)return 0;v!==s.length&&(c=!1)}if(c)return 2;for(let d=0;d<3;d++){let y=Number.MAX_VALUE,v=-Number.MAX_VALUE;for(let w=0;w<e.points.length;w++){let T=e.points[w][d]-this.min[d];y=Math.min(y,T),v=Math.max(v,T)}if(v<0||y>this.max[d]-this.min[d])return 0}return 1}}class Es{constructor(e=0,s=0,c=0,d=0){if(isNaN(e)||e<0||isNaN(s)||s<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=s,this.left=c,this.right=d}interpolate(e,s,c){return s.top!=null&&e.top!=null&&(this.top=a.number(e.top,s.top,c)),s.bottom!=null&&e.bottom!=null&&(this.bottom=a.number(e.bottom,s.bottom,c)),s.left!=null&&e.left!=null&&(this.left=a.number(e.left,s.left,c)),s.right!=null&&e.right!=null&&(this.right=a.number(e.right,s.right,c)),this}getCenter(e,s){let c=a.clamp((this.left+e-this.right)/2,0,e),d=a.clamp((this.top+s-this.bottom)/2,0,s);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 Es(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}class ea{constructor(e,s,c,d,y){this.tileSize=512,this.maxValidLatitude=85.051129,this._renderWorldCopies=y===void 0||!!y,this._minZoom=e||0,this._maxZoom=s||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 Es,this._posMatrixCache={},this._alignedPosMatrixCache={}}clone(){let e=new ea(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 s=-a.wrap(e,-180,180)*Math.PI/180;this.angle!==s&&(this._unmodified=!1,this.angle=s,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,y){var v=d[0],w=d[1],T=d[2],C=d[3],k=Math.sin(y),F=Math.cos(y);c[0]=v*F+T*k,c[1]=w*F+C*k,c[2]=v*-k+T*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 s=a.clamp(e,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==s&&(this._unmodified=!1,this._pitch=s,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 s=Math.min(Math.max(e,this.minZoom),this.maxZoom);this._zoom!==s&&(this._unmodified=!1,this._zoom=s,this.scale=this.zoomScale(s),this.tileZoom=Math.floor(s),this.zoomFraction=s-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,s,c){this._unmodified=!1,this._edgeInsets.interpolate(e,s,c),this._constrain(),this._calcMatrices()}coveringZoomLevel(e){let s=(e.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/e.tileSize));return Math.max(0,s)}getVisibleUnwrappedCoordinates(e){let s=[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)),y=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,y.x,v.x)),T=Math.floor(Math.max(c.x,d.x,y.x,v.x)),C=1;for(let k=w-C;k<=T+C;k++)k!==0&&s.push(new a.UnwrappedTileID(k,e))}return s}coveringTiles(e){let s=this.coveringZoomLevel(e),c=s;if(e.minzoom!==void 0&&s<e.minzoom)return[];e.maxzoom!==void 0&&s>e.maxzoom&&(s=e.maxzoom);let d=a.MercatorCoordinate.fromLngLat(this.center),y=Math.pow(2,s),v=[y*d.x,y*d.y,0],w=Wa.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,s),T=e.minzoom||0;this.pitch<=60&&this._edgeInsets.top<.1&&(T=s);let C=$=>({aabb:new Za([$*y,0,0],[($+1)*y,y,0]),zoom:0,x:0,y:0,wrap:$,fullyVisible:!1}),k=[],F=[],j=s,Y=e.reparseOverscaled?c:s;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),kt=Math.max(Math.abs(gt),Math.abs(ut)),Mt=3+(1<<j-$.zoom)-2;if($.zoom===j||kt>Mt&&$.zoom>=T)F.push({tileID:new a.OverscaledTileID($.zoom===j?Y:$.zoom,$.wrap,$.zoom,J,lt),distanceSq:Ct([v[0]-.5-J,v[1]-.5-lt])});else for(let Tt=0;Tt<4;Tt++){let Ut=(J<<1)+Tt%2,$t=(lt<<1)+(Tt>>1);k.push({aabb:$.aabb.quadrant(Tt),zoom:$.zoom+1,x:Ut,y:$t,wrap:$.wrap,fullyVisible:ht})}}return F.sort(($,J)=>$.distanceSq-J.distanceSq).map($=>$.tileID)}resize(e,s){this.width=e,this.height=s,this.pixelsToGLUnits=[2/e,-2/s],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 s=a.clamp(e.lat,-this.maxValidLatitude,this.maxValidLatitude);return new a.pointGeometry(a.mercatorXfromLng(e.lng)*this.worldSize,a.mercatorYfromLat(s)*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,s){let c=this.pointCoordinate(s),d=this.pointCoordinate(this.centerPoint),y=this.locationCoordinate(e),v=new a.MercatorCoordinate(y.x-(c.x-d.x),y.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 s=[e.x,e.y,0,1],c=[e.x,e.y,1,1];a.transformMat4(s,s,this.pixelMatrixInverse),a.transformMat4(c,c,this.pixelMatrixInverse);let d=s[3],y=c[3],v=s[1]/d,w=c[1]/y,T=s[2]/d,C=c[2]/y,k=T===C?0:(0-T)/(C-T);return new a.MercatorCoordinate(a.number(s[0]/d,c[0]/y,k)/this.worldSize,a.number(v,w,k)/this.worldSize)}coordinatePoint(e){let s=[e.x*this.worldSize,e.y*this.worldSize,0,1];return a.transformMat4(s,s,this.pixelMatrix),new a.pointGeometry(s[0]/s[3],s[1]/s[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,s=!1){let c=e.key,d=s?this._alignedPosMatrixCache:this._posMatrixCache;if(d[c])return d[c];let y=e.canonical,v=this.worldSize/this.zoomScale(y.z),w=y.x+Math.pow(2,y.z)*e.wrap,T=a.identity(new Float64Array(16));return a.translate(T,T,[w*v,y.y*v,0]),a.scale(T,T,[v/a.EXTENT,v/a.EXTENT,1]),a.multiply(T,s?this.alignedProjMatrix:this.projMatrix,T),d[c]=new Float32Array(T),d[c]}customLayerMatrix(){return this.mercatorMatrix.slice()}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;let e,s,c,d,y=-90,v=90,w=-180,T=180,C=this.size,k=this._unmodified;if(this.latRange){let Y=this.latRange;y=a.mercatorYfromLat(Y[1])*this.worldSize,v=a.mercatorYfromLat(Y[0])*this.worldSize,e=v-y<C.y?C.y/(v-y):0}if(this.lngRange){let Y=this.lngRange;w=a.mercatorXfromLng(Y[0])*this.worldSize,T=a.mercatorXfromLng(Y[1])*this.worldSize,s=T-w<C.x?C.x/(T-w):0}let F=this.point,j=Math.max(s||0,e||0);if(j)return this.center=this.unproject(new a.pointGeometry(s?(T+w)/2:F.x,e?(v+y)/2:F.y)),this.zoom+=this.scaleZoom(j),this._unmodified=k,void(this._constraining=!1);if(this.latRange){let Y=F.y,$=C.y/2;Y-$<y&&(d=y+$),Y+$>v&&(d=v-$)}if(this.lngRange){let Y=F.x,$=C.x/2;Y-$<w&&(c=w+$),Y+$>T&&(c=T-$)}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 s=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-s-c,.01,Math.PI-.01)),y=this.point,v=y.x,w=y.y,T=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,T),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,Y=Math.cos(this.angle),$=Math.sin(this.angle),J=v-Math.round(v)+Y*F+$*j,lt=w-Math.round(w)+Y*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)),s=[e.x*this.worldSize,e.y*this.worldSize,0,1];return a.transformMat4(s,s,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 s=this.getCameraPoint();if(e.length===1)return[e[0],s];{let c=s.x,d=s.y,y=s.x,v=s.y;for(let w of e)c=Math.min(c,w.x),d=Math.min(d,w.y),y=Math.max(y,w.x),v=Math.max(v,w.y);return[new a.pointGeometry(c,d),new a.pointGeometry(y,d),new a.pointGeometry(y,v),new a.pointGeometry(c,v),new a.pointGeometry(c,d)]}}}class fh{constructor(e){this._hashName=e&&encodeURIComponent(e),a.bindAll(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=function(s,c){let d=!1,y=null,v=()=>{y=null,d&&(s(),y=setTimeout(v,300),d=!1)};return()=>(d=!0,y||v(),y)}(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 s=this._map.getCenter(),c=Math.round(100*this._map.getZoom())/100,d=Math.ceil((c*Math.LN2+Math.log(512/360/.5))/Math.LN10),y=Math.pow(10,d),v=Math.round(s.lng*y)/y,w=Math.round(s.lat*y)/y,T=this._map.getBearing(),C=this._map.getPitch(),k="";if(k+=e?`/${v}/${w}/${c}`:`${c}/${w}/${v}`,(T||C)&&(k+="/"+Math.round(10*T)/10),C&&(k+=`/${Math.round(C)}`),this._hashName){let F=this._hashName,j=!1,Y=window.location.hash.slice(1).split("&").map($=>{let J=$.split("=")[0];return J===F?(j=!0,`${J}=${k}`):$}).filter($=>$);return j||Y.push(`${F}=${k}`),`#${Y.join("&")}`}return`#${k}`}_getCurrentHash(){let e=window.location.hash.replace("#","");if(this._hashName){let s;return e.split("&").map(c=>c.split("=")).forEach(c=>{c[0]===this._hashName&&(s=c)}),(s&&s[1]||"").split("/")}return e.split("/")}_onHashChange(){let e=this._getCurrentHash();if(e.length>=3&&!e.some(s=>isNaN(s))){let s=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:s,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 ia={linearity:.3,easing:a.bezier(0,0,.3,1)},mh=a.extend({deceleration:2500,maxSpeed:1400},ia),gh=a.extend({deceleration:20,maxSpeed:1400},ia),yh=a.extend({deceleration:1e3,maxSpeed:360},ia),Is=a.extend({deceleration:1e3,maxSpeed:90},ia);class _h{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,s=a.exported.now();for(;e.length>0&&s-e[0].time>160;)e.shift()}_onMoveEnd(e){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;let s={zoom:0,bearing:0,pitch:0,pan:new a.pointGeometry(0,0),pinchAround:void 0,around:void 0};for(let{settings:y}of this._inertiaBuffer)s.zoom+=y.zoomDelta||0,s.bearing+=y.bearingDelta||0,s.pitch+=y.pitchDelta||0,y.panDelta&&s.pan._add(y.panDelta),y.around&&(s.around=y.around),y.pinchAround&&(s.pinchAround=y.pinchAround);let c=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,d={};if(s.pan.mag()){let y=na(s.pan.mag(),c,a.extend({},mh,e||{}));d.offset=s.pan.mult(y.amount/s.pan.mag()),d.center=this._map.transform.center,ra(d,y)}if(s.zoom){let y=na(s.zoom,c,gh);d.zoom=this._map.transform.zoom+y.amount,ra(d,y)}if(s.bearing){let y=na(s.bearing,c,yh);d.bearing=this._map.transform.bearing+a.clamp(y.amount,-179,179),ra(d,y)}if(s.pitch){let y=na(s.pitch,c,Is);d.pitch=this._map.transform.pitch+y.amount,ra(d,y)}if(d.zoom||d.bearing){let y=s.pinchAround===void 0?s.around:s.pinchAround;d.around=y?this._map.unproject(y):this._map.getCenter()}return this.clear(),a.extend(d,{noMoveStart:!0})}}function ra(p,e){(!p.duration||p.duration<e.duration)&&(p.duration=e.duration,p.easing=e.easing)}function na(p,e,s){let{maxSpeed:c,linearity:d,deceleration:y}=s,v=a.clamp(p*d/(e/1e3),-c,c),w=Math.abs(v)/(y*d);return{easing:s.easing,duration:1e3*w,amount:v*(w/2)}}class vr extends a.Event{constructor(e,s,c,d={}){let y=L.mousePos(s.getCanvasContainer(),c),v=s.unproject(y);super(e,a.extend({point:y,lngLat:v,originalEvent:c},d)),this._defaultPrevented=!1,this.target=s}preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}}class hr extends a.Event{constructor(e,s,c){let d=e==="touchend"?c.changedTouches:c.touches,y=L.touchPos(s.getCanvasContainer(),d),v=y.map(T=>s.unproject(T)),w=y.reduce((T,C,k,F)=>T.add(C.div(F.length)),new a.pointGeometry(0,0));super(e,{points:y,point:w,lngLats:v,lngLat:s.unproject(w),originalEvent:c}),this._defaultPrevented=!1}preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}}class Xc extends a.Event{constructor(e,s,c){super(e,{originalEvent:c}),this._defaultPrevented=!1}preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}}class Gn{constructor(e,s){this._map=e,this._clickTolerance=s.clickTolerance}reset(){delete this._mousedownPos}wheel(e){return this._firePreventable(new Xc(e.type,this._map,e))}mousedown(e,s){return this._mousedownPos=s,this._firePreventable(new vr(e.type,this._map,e))}mouseup(e){this._map.fire(new vr(e.type,this._map,e))}click(e,s){this._mousedownPos&&this._mousedownPos.dist(s)>=this._clickTolerance||this._map.fire(new vr(e.type,this._map,e))}dblclick(e){return this._firePreventable(new vr(e.type,this._map,e))}mouseover(e){this._map.fire(new vr(e.type,this._map,e))}mouseout(e){this._map.fire(new vr(e.type,this._map,e))}touchstart(e){return this._firePreventable(new hr(e.type,this._map,e))}touchmove(e){this._map.fire(new hr(e.type,this._map,e))}touchend(e){this._map.fire(new hr(e.type,this._map,e))}touchcancel(e){this._map.fire(new hr(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class xh{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,delete this._contextMenuEvent}mousemove(e){this._map.fire(new vr(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new vr("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._map.fire(new vr(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Cs{constructor(e,s){this._map=e,this._el=e.getCanvasContainer(),this._container=e.getContainer(),this._clickTolerance=s.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(e,s){this.isEnabled()&&e.shiftKey&&e.button===0&&(L.disableDrag(),this._startPos=this._lastPos=s,this._active=!0)}mousemoveWindow(e,s){if(!this._active)return;let c=s;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 y=Math.min(d.x,c.x),v=Math.max(d.x,c.x),w=Math.min(d.y,c.y),T=Math.max(d.y,c.y);L.setTransform(this._box,`translate(${y}px,${w}px)`),this._box.style.width=v-y+"px",this._box.style.height=T-w+"px"}mouseupWindow(e,s){if(!this._active||e.button!==0)return;let c=this._startPos,d=s;if(this.reset(),L.suppressClick(),c.x!==d.x||c.y!==d.y)return this._map.fire(new a.Event("boxzoomend",{originalEvent:e})),{cameraAnimation:y=>y.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,s){return this._map.fire(new a.Event(e,{originalEvent:s}))}}function qn(p,e){let s={};for(let c=0;c<p.length;c++)s[p[c].identifier]=e[c];return s}class Kc{constructor(e){this.reset(),this.numTouches=e.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(e,s,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 y=new a.pointGeometry(0,0);for(let v of d)y._add(v);return y.div(d.length)}(s),this.touches=qn(c,s)))}touchmove(e,s,c){if(this.aborted||!this.centroid)return;let d=qn(c,s);for(let y in this.touches){let v=this.touches[y],w=d[y];(!w||w.dist(v)>30)&&(this.aborted=!0)}}touchend(e,s,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 ol{constructor(e){this.singleTap=new Kc(e),this.numTaps=e.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(e,s,c){this.singleTap.touchstart(e,s,c)}touchmove(e,s,c){this.singleTap.touchmove(e,s,c)}touchend(e,s,c){let d=this.singleTap.touchend(e,s,c);if(d){let y=e.timeStamp-this.lastTime<500,v=!this.lastTap||this.lastTap.dist(d)<30;if(y&&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 ol({numTouches:1,numTaps:2}),this._zoomOut=new ol({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(e,s,c){this._zoomIn.touchstart(e,s,c),this._zoomOut.touchstart(e,s,c)}touchmove(e,s,c){this._zoomIn.touchmove(e,s,c),this._zoomOut.touchmove(e,s,c)}touchend(e,s,c){let d=this._zoomIn.touchend(e,s,c),y=this._zoomOut.touchend(e,s,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})}):y?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:v=>v.easeTo({duration:300,zoom:v.getZoom()-1,around:v.unproject(y)},{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 vh={0:1,2:2};class jn{constructor(e){this.reset(),this._clickTolerance=e.clickTolerance||1}reset(){this._active=!1,this._moved=!1,delete this._lastPoint,delete this._eventButton}_correctButton(e,s){return!1}_move(e,s){return{}}mousedown(e,s){if(this._lastPoint)return;let c=L.mouseButton(e);this._correctButton(e,c)&&(this._lastPoint=s,this._eventButton=c)}mousemoveWindow(e,s){let c=this._lastPoint;if(c){if(e.preventDefault(),function(d,y){let v=vh[y];return d.buttons===void 0||(d.buttons&v)!==v}(e,this._eventButton))this.reset();else if(this._moved||!(s.dist(c)<this._clickTolerance))return this._moved=!0,this._lastPoint=s,this._move(c,s)}}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 As extends jn{mousedown(e,s){super.mousedown(e,s),this._lastPoint&&(this._active=!0)}_correctButton(e,s){return s===0&&!e.ctrlKey}_move(e,s){return{around:s,panDelta:s.sub(e)}}}class ie extends jn{_correctButton(e,s){return s===0&&e.ctrlKey||s===2}_move(e,s){let c=.8*(s.x-e.x);if(c)return this._active=!0,{bearingDelta:c}}contextmenu(e){e.preventDefault()}}class ll extends jn{_correctButton(e,s){return s===0&&e.ctrlKey||s===2}_move(e,s){let c=-.5*(s.y-e.y);if(c)return this._active=!0,{pitchDelta:c}}contextmenu(e){e.preventDefault()}}class sa{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,s,c){return this._calculateTransform(e,s,c)}touchmove(e,s,c){if(this._active&&!(c.length<this._minTouches))return e.preventDefault(),this._calculateTransform(e,s,c)}touchend(e,s,c){this._calculateTransform(e,s,c),this._active&&c.length<this._minTouches&&this.reset()}touchcancel(){this.reset()}_calculateTransform(e,s,c){c.length>0&&(this._active=!0);let d=qn(c,s),y=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&&(y._add(k),v._add(k.sub(F)),w++,d[C]=k)}if(this._touches=d,w<this._minTouches||!v.mag())return;let T=v.div(w);return this._sum._add(T),this._sum.mag()<this._clickTolerance?void 0:{around:y.div(w),panDelta:T}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class $n{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}_start(e){}_move(e,s,c){return{}}touchstart(e,s,c){this._firstTwoTouches||c.length<2||(this._firstTwoTouches=[c[0].identifier,c[1].identifier],this._start([s[0],s[1]]))}touchmove(e,s,c){if(!this._firstTwoTouches)return;e.preventDefault();let[d,y]=this._firstTwoTouches,v=aa(c,s,d),w=aa(c,s,y);if(!v||!w)return;let T=this._aroundCenter?null:v.add(w).div(2);return this._move([v,w],T,e)}touchend(e,s,c){if(!this._firstTwoTouches)return;let[d,y]=this._firstTwoTouches,v=aa(c,s,d),w=aa(c,s,y);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 aa(p,e,s){for(let c=0;c<p.length;c++)if(p[c].identifier===s)return e[c]}function Xt(p,e){return Math.log(p/e)/Math.LN2}class hl extends $n{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(e){this._startDistance=this._distance=e[0].dist(e[1])}_move(e,s){let c=this._distance;if(this._distance=e[0].dist(e[1]),this._active||!(Math.abs(Xt(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:Xt(this._distance,c),pinchAround:s}}}function bh(p,e){return 180*p.angleWith(e)/Math.PI}class Yc extends $n{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,s){let c=this._vector;if(this._vector=e[0].sub(e[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:bh(this._vector,c),pinchAround:s}}_isBelowThreshold(e){this._minDiameter=Math.min(this._minDiameter,e.mag());let s=25/(Math.PI*this._minDiameter)*360,c=bh(e,this._startVector);return Math.abs(c)<s}}function oa(p){return Math.abs(p.y)>Math.abs(p.x)}class wh extends $n{reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}_start(e){this._lastPoints=e,oa(e[0].sub(e[1]))&&(this._valid=!1)}_move(e,s,c){let d=e[0].sub(this._lastPoints[0]),y=e[1].sub(this._lastPoints[1]);if(this._valid=this.gestureBeginsVertically(d,y,c.timeStamp),this._valid)return this._lastPoints=e,this._active=!0,{pitchDelta:(d.y+y.y)/2*-.5}}gestureBeginsVertically(e,s,c){if(this._valid!==void 0)return this._valid;let d=e.mag()>=2,y=s.mag()>=2;if(!d&&!y)return;if(!d||!y)return this._firstMove===void 0&&(this._firstMove=c),c-this._firstMove<100&&void 0;let v=e.y>0==s.y>0;return oa(e)&&oa(s)&&v}}let Mh={panStep:100,bearingStep:15,pitchStep:10};class Qc{constructor(){let e=Mh;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 s=0,c=0,d=0,y=0,v=0;switch(e.keyCode){case 61:case 107:case 171:case 187:s=1;break;case 189:case 109:case 173:s=-1;break;case 37:e.shiftKey?c=-1:(e.preventDefault(),y=-1);break;case 39:e.shiftKey?c=1:(e.preventDefault(),y=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 T=w.getZoom();w.easeTo({duration:300,easeId:"keyboardHandler",easing:tu,zoom:s?Math.round(T)+s*(e.shiftKey?2:1):T,bearing:w.getBearing()+c*this._bearingStep,pitch:w.getPitch()+d*this._pitchStep,offset:[-y*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 tu(p){return p*(2-p)}let Ha=4.000244140625;class cl{constructor(e,s){this._map=e,this._el=e.getCanvasContainer(),this._handler=s,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 s=e.deltaMode===WheelEvent.DOM_DELTA_LINE?40*e.deltaY:e.deltaY,c=a.exported.now(),d=c-(this._lastWheelEventTime||0);this._lastWheelEventTime=c,s!==0&&s%Ha==0?this._type="wheel":s!==0&&Math.abs(s)<4?this._type="trackpad":d>400?(this._type=null,this._lastValue=s,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(d*s)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,s+=this._lastValue)),e.shiftKey&&s&&(s/=4),this._type&&(this._lastWheelEvent=e,this._delta-=s,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 s=L.mousePos(this._el,e);this._around=a.LngLat.convert(this._aroundCenter?this._map.getCenter():this._map.unproject(s)),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)>Ha?this._wheelZoomRate:this._defaultZoomRate,T=2/(1+Math.exp(-Math.abs(this._delta*w)));this._delta<0&&T!==0&&(T=1/T);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*T))),this._type==="wheel"&&(this._startZoom=e.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}let s=typeof this._targetZoom=="number"?this._targetZoom:e.zoom,c=this._startZoom,d=this._easing,y,v=!1;if(this._type==="wheel"&&c&&d){let w=Math.min((a.exported.now()-this._lastWheelEventTime)/200,1),T=d(w);y=a.number(c,s,T),w<1?this._frameId||(this._frameId=!0):v=!0}else y=s,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:y-e.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(e){let s=a.ease;if(this._prevEase){let c=this._prevEase,d=(a.exported.now()-c.start)/c.duration,y=c.easing(d+.01)-c.easing(d),v=.27/Math.sqrt(y*y+1e-4)*.01,w=Math.sqrt(.0729-v*v);s=a.bezier(v,w,.25,1)}return this._prevEase={start:a.exported.now(),duration:e,easing:s},s}reset(){this._active=!1}}class ul{constructor(e,s){this._clickZoom=e,this._tapZoom=s}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 pl{constructor(){this.reset()}reset(){this._active=!1}dblclick(e,s){return e.preventDefault(),{cameraAnimation:c=>{c.easeTo({duration:300,zoom:c.getZoom()+(e.shiftKey?-1:1),around:c.unproject(s)},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class cr{constructor(){this._tap=new ol({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,this._tap.reset()}touchstart(e,s,c){this._swipePoint||(this._tapTime&&e.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?c.length>0&&(this._swipePoint=s[0],this._swipeTouch=c[0].identifier):this._tap.touchstart(e,s,c))}touchmove(e,s,c){if(this._tapTime){if(this._swipePoint){if(c[0].identifier!==this._swipeTouch)return;let d=s[0],y=d.y-this._swipePoint.y;return this._swipePoint=d,e.preventDefault(),this._active=!0,{zoomDelta:y/128}}}else this._tap.touchmove(e,s,c)}touchend(e,s,c){this._tapTime?this._swipePoint&&c.length===0&&this.reset():this._tap.touchend(e,s,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 In{constructor(e,s,c){this._el=e,this._mousePan=s,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 Sh{constructor(e,s,c){this._pitchWithRotate=e.pitchWithRotate,this._mouseRotate=s,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 dl{constructor(e,s,c,d){this._el=e,this._touchZoom=s,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 Ps=p=>p.zoom||p.drag||p.pitch||p.rotate;class fl extends a.Event{}function Xa(p){return p.panDelta&&p.panDelta.mag()||p.zoomDelta||p.bearingDelta||p.pitchDelta}class Fr{constructor(e,s){this._map=e,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new _h(e),this._bearingSnap=s.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(s),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,y,v]of this._listeners)L.addEventListener(d,y,d===document?this.handleWindowEvent:this.handleEvent,v)}destroy(){for(let[e,s,c]of this._listeners)L.removeEventListener(e,s,e===document?this.handleWindowEvent:this.handleEvent,c)}_addDefaultHandlers(e){let s=this._map,c=s.getCanvasContainer();this._add("mapEvent",new Gn(s,e));let d=s.boxZoom=new Cs(s,e);this._add("boxZoom",d);let y=new Jc,v=new pl;s.doubleClickZoom=new ul(v,y),this._add("tapZoom",y),this._add("clickZoom",v);let w=new cr;this._add("tapDragZoom",w);let T=s.touchPitch=new wh;this._add("touchPitch",T);let C=new ie(e),k=new ll(e);s.dragRotate=new Sh(e,C,k),this._add("mouseRotate",C,["mousePitch"]),this._add("mousePitch",k,["mouseRotate"]);let F=new As(e),j=new sa(e);s.dragPan=new In(c,F,j),this._add("mousePan",F),this._add("touchPan",j,["touchZoom","touchRotate"]);let Y=new Yc,$=new hl;s.touchZoomRotate=new dl(c,$,Y,w),this._add("touchRotate",Y,["touchPan","touchZoom"]),this._add("touchZoom",$,["touchPan","touchRotate"]);let J=s.scrollZoom=new cl(s,this);this._add("scrollZoom",J,["mousePan"]);let lt=s.keyboard=new Qc;this._add("keyboard",lt),this._add("blockableMapEvent",new xh(s));for(let ht of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])e.interactive&&e[ht]&&s[ht].enable(e[ht])}_add(e,s,c){this._handlers.push({handlerName:e,handler:s,allowed:c}),this._handlersById[e]=s}stop(e){if(!this._updatingCamera){for(let{handler:s}of this._handlers)s.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(Ps(this._eventsInProgress))||this.isZooming()}_blockedByActive(e,s,c){for(let d in e)if(d!==c&&(!s||s.indexOf(d)<0))return!0;return!1}handleWindowEvent(e){this.handleEvent(e,`${e.type}Window`)}_getMapTouches(e){let s=[];for(let c of e)this._el.contains(c.target)&&s.push(c);return s}handleEvent(e,s){if(e.type==="blur")return void this.stop(!0);this._updatingCamera=!0;let c=e.type==="renderFrame"?void 0:e,d={needsRenderFrame:!1},y={},v={},w=e.touches,T=w?this._getMapTouches(w):void 0,C=T?L.touchPos(this._el,T):L.mousePos(this._el,e);for(let{handlerName:j,handler:Y,allowed:$}of this._handlers){if(!Y.isEnabled())continue;let J;this._blockedByActive(v,$,j)?Y.reset():Y[s||e.type]&&(J=Y[s||e.type](e,C,T),this.mergeHandlerResult(d,y,J,j,c),J&&J.needsRenderFrame&&this._triggerRenderFrame()),(J||Y.isActive())&&(v[j]=Y)}let k={};for(let j in this._previousActiveHandlers)v[j]||(k[j]=c);this._previousActiveHandlers=v,(Object.keys(k).length||Xa(d))&&(this._changes.push([d,y,k]),this._triggerRenderFrame()),(Object.keys(v).length||Xa(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,s,c,d,y){if(!c)return;a.extend(e,c);let v={handlerName:d,originalEvent:c.originalEvent||y};c.zoomDelta!==void 0&&(s.zoom=v),c.panDelta!==void 0&&(s.drag=v),c.pitchDelta!==void 0&&(s.pitch=v),c.bearingDelta!==void 0&&(s.rotate=v)}_applyChanges(){let e={},s={},c={};for(let[d,y,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(s,y),a.extend(c,v);this._updateMapTransform(e,s,c),this._changes=[]}_updateMapTransform(e,s,c){let d=this._map,y=d.transform;if(!Xa(e))return this._fireEvents(s,c,!0);let{panDelta:v,zoomDelta:w,bearingDelta:T,pitchDelta:C,around:k,pinchAround:F}=e;F!==void 0&&(k=F),d._stop(!0),k=k||d.transform.centerPoint;let j=y.pointLocation(v?k.sub(v):k);T&&(y.bearing+=T),C&&(y.pitch+=C),w&&(y.zoom+=w),y.setLocationAtPoint(j,k),this._map._update(),e.noInertia||this._inertia.record(e),this._fireEvents(s,c,!0)}_fireEvents(e,s,c){let d=Ps(this._eventsInProgress),y=Ps(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&&y&&this._fireEvent("movestart",y.originalEvent);for(let k in v)this._fireEvent(k,v[k]);y&&this._fireEvent("move",y.originalEvent);for(let k in e){let{originalEvent:F}=e[k];this._fireEvent(k,F)}let w={},T;for(let k in this._eventsInProgress){let{handlerName:F,originalEvent:j}=this._eventsInProgress[k];this._handlersById[F].isActive()||(delete this._eventsInProgress[k],T=s[F]||j,w[`${k}end`]=T)}for(let k in w)this._fireEvent(k,w[k]);let C=Ps(this._eventsInProgress);if(c&&(d||y)&&!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:T})):(this._map.fire(new a.Event("moveend",{originalEvent:T})),F(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(e,s){this._map.fire(new a.Event(e,s?{originalEvent:s}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(e=>{delete this._frameId,this.handleEvent(new fl("renderFrame",{timeStamp:e})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}let ci={extend:(p,...e)=>a.extend(p,...e),run(p){p()},logToElement(p,e=!1,s="log"){let c=window.document.getElementById(s);c&&(e&&(c.innerHTML=""),c.innerHTML+=`<br>${p}`)}};class Ka extends a.Evented{constructor(e,s){super(),this._moving=!1,this._zooming=!1,this.transform=e,this._bearingSnap=s.bearingSnap,a.bindAll(["_renderFrameCallback"],this)}getCenter(){return new a.LngLat(this.transform.center.lng,this.transform.center.lat)}setCenter(e,s){return this.jumpTo({center:e},s)}panBy(e,s,c){return e=a.pointGeometry.convert(e).mult(-1),this.panTo(this.transform.center,a.extend({offset:e},s),c)}panTo(e,s,c){return this.easeTo(a.extend({center:e},s),c)}getZoom(){return this.transform.zoom}setZoom(e,s){return this.jumpTo({zoom:e},s),this}zoomTo(e,s,c){return this.easeTo(a.extend({zoom:e},s),c)}zoomIn(e,s){return this.zoomTo(this.getZoom()+1,e,s),this}zoomOut(e,s){return this.zoomTo(this.getZoom()-1,e,s),this}getBearing(){return this.transform.bearing}setBearing(e,s){return this.jumpTo({bearing:e},s),this}getPadding(){return this.transform.padding}setPadding(e,s){return this.jumpTo({padding:e},s),this}rotateTo(e,s,c){return this.easeTo(a.extend({bearing:e},s),c)}resetNorth(e,s){return this.rotateTo(0,a.extend({duration:1e3},e),s),this}resetNorthPitch(e,s){return this.easeTo(a.extend({bearing:0,pitch:0,duration:1e3},e),s),this}snapToNorth(e,s){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(e,s):this}getPitch(){return this.transform.pitch}setPitch(e,s){return this.jumpTo({pitch:e},s),this}cameraForBounds(e,s){e=a.LngLatBounds.convert(e);let c=s&&s.bearing||0;return this._cameraForBoxAndBearing(e.getNorthWest(),e.getSouthEast(),c,s)}_cameraForBoxAndBearing(e,s,c,d){let y={top:0,bottom:0,right:0,left:0};if(typeof(d=a.extend({padding:y,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(y,d.padding);let v=this.transform,w=v.padding,T=v.project(a.LngLat.convert(e)),C=v.project(a.LngLat.convert(s)),k=T.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)),Y=new a.pointGeometry(Math.min(k.x,F.x),Math.min(k.y,F.y)),$=j.sub(Y),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),kt=gt.add(ut).mult(v.scale/v.zoomScale(ht));return{center:v.unproject(T.add(C).div(2).sub(kt)),zoom:ht,bearing:c}}fitBounds(e,s,c){return this._fitInternal(this.cameraForBounds(e,s),s,c)}fitScreenCoordinates(e,s,c,d,y){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(a.pointGeometry.convert(e)),this.transform.pointLocation(a.pointGeometry.convert(s)),c,d),d,y)}_fitInternal(e,s,c){return e?(delete(s=a.extend(e,s)).padding,s.linear?this.easeTo(s,c):this.flyTo(s,c)):this}jumpTo(e,s){this.stop();let c=this.transform,d=!1,y=!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&&(y=!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",s)).fire(new a.Event("move",s)),d&&this.fire(new a.Event("zoomstart",s)).fire(new a.Event("zoom",s)).fire(new a.Event("zoomend",s)),y&&this.fire(new a.Event("rotatestart",s)).fire(new a.Event("rotate",s)).fire(new a.Event("rotateend",s)),v&&this.fire(new a.Event("pitchstart",s)).fire(new a.Event("pitch",s)).fire(new a.Event("pitchend",s)),this.fire(new a.Event("moveend",s))}easeTo(e,s){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(),y=this.getBearing(),v=this.getPitch(),w=this.getPadding(),T="zoom"in e?+e.zoom:d,C="bearing"in e?this._normalizeBearing(e.bearing,y):y,k="pitch"in e?+e.pitch:v,F="padding"in e?e.padding:c.padding,j=a.pointGeometry.convert(e.offset),Y=c.centerPoint.add(j),$=c.pointLocation(Y),J=a.LngLat.convert(e.center||$);this._normalizeCenter(J);let lt=c.project($),ht=c.project(J).sub(lt),gt=c.zoomScale(T-d),ut,kt;e.around&&(ut=a.LngLat.convert(e.around),kt=c.locationPoint(ut));let Mt={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||T!==d,this._rotating=this._rotating||y!==C,this._pitching=this._pitching||k!==v,this._padding=!c.isPaddingEqual(F),this._easeId=e.easeId,this._prepareEase(s,e.noMoveStart,Mt),this._ease(Tt=>{if(this._zooming&&(c.zoom=a.number(d,T,Tt)),this._rotating&&(c.bearing=a.number(y,C,Tt)),this._pitching&&(c.pitch=a.number(v,k,Tt)),this._padding&&(c.interpolatePadding(w,F,Tt),Y=c.centerPoint.add(j)),ut)c.setLocationAtPoint(ut,kt);else{let Ut=c.zoomScale(c.zoom-d),$t=T>d?Math.min(2,gt):Math.max(.5,gt),Pt=Math.pow($t,1-Tt),se=c.unproject(lt.add(ht.mult(Tt*Pt)).mult(Ut));c.setLocationAtPoint(c.renderWorldCopies?se.wrap():se,Y)}this._fireMoveEvents(s)},Tt=>{this._afterEase(s,Tt)},e),this}_prepareEase(e,s,c={}){this._moving=!0,s||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,s){if(this._easeId&&s&&this._easeId===s)return;delete this._easeId;let c=this._zooming,d=this._rotating,y=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)),y&&this.fire(new a.Event("pitchend",e)),this.fire(new a.Event("moveend",e))}flyTo(e,s){if(!e.essential&&a.exported.prefersReducedMotion){let Oe=a.pick(e,["center","zoom","bearing","pitch","around"]);return this.jumpTo(Oe,s)}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(),y=this.getBearing(),v=this.getPitch(),w=this.getPadding(),T="zoom"in e?a.clamp(+e.zoom,c.minZoom,c.maxZoom):d,C="bearing"in e?this._normalizeBearing(e.bearing,y):y,k="pitch"in e?+e.pitch:v,F="padding"in e?e.padding:c.padding,j=c.zoomScale(T-d),Y=a.pointGeometry.convert(e.offset),$=c.centerPoint.add(Y),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,kt=Math.max(c.width,c.height),Mt=kt/j,Tt=gt.mag();if("minZoom"in e){let Oe=a.clamp(Math.min(e.minZoom,d,T),c.minZoom,c.maxZoom),xi=kt/c.zoomScale(Oe-d);ut=Math.sqrt(xi/Tt*2)}let Ut=ut*ut;function $t(Oe){let xi=(Mt*Mt-kt*kt+(Oe?-1:1)*Ut*Ut*Tt*Tt)/(2*(Oe?Mt:kt)*Ut*Tt);return Math.log(Math.sqrt(xi*xi+1)-xi)}function Pt(Oe){return(Math.exp(Oe)-Math.exp(-Oe))/2}function se(Oe){return(Math.exp(Oe)+Math.exp(-Oe))/2}let Kt=$t(0),we=function(Oe){return se(Kt)/se(Kt+ut*Oe)},Ue=function(Oe){return kt*((se(Kt)*(Pt(xi=Kt+ut*Oe)/se(xi))-Pt(Kt))/Ut)/Tt;var xi},De=($t(1)-Kt)/ut;if(Math.abs(Tt)<1e-6||!isFinite(De)){if(Math.abs(kt-Mt)<1e-6)return this.easeTo(e,s);let Oe=Mt<kt?-1:1;De=Math.abs(Math.log(Mt/kt))/ut,Ue=function(){return 0},we=function(xi){return Math.exp(Oe*ut*xi)}}return e.duration="duration"in e?+e.duration:1e3*De/("screenSpeed"in e?+e.screenSpeed/ut:+e.speed),e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=y!==C,this._pitching=k!==v,this._padding=!c.isPaddingEqual(F),this._prepareEase(s,!1),this._ease(Oe=>{let xi=Oe*De,Me=1/we(xi);c.zoom=Oe===1?T:d+c.scaleZoom(Me),this._rotating&&(c.bearing=a.number(y,C,Oe)),this._pitching&&(c.pitch=a.number(v,k,Oe)),this._padding&&(c.interpolatePadding(w,F,Oe),$=c.centerPoint.add(Y));let je=Oe===1?lt:c.unproject(ht.add(gt.mult(Ue(xi))).mult(Me));c.setLocationAtPoint(c.renderWorldCopies?je.wrap():je,$),this._fireMoveEvents(s)},()=>this._afterEase(s),e),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(e,s){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,s)}if(!e){let c=this.handlers;c&&c.stop(!1)}return this}_ease(e,s,c){c.animate===!1||c.duration===0?(e(1),s()):(this._easeStart=a.exported.now(),this._easeOptions=c,this._onEaseFrame=e,this._onEaseEnd=s,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,s){e=a.wrap(e,-180,180);let c=Math.abs(e-s);return Math.abs(e-360-s)<c&&(e-=360),Math.abs(e+360-s)<c&&(e+=360),e}_normalizeCenter(e){let s=this.transform;if(!s.renderWorldCopies||s.lngRange)return;let c=e.lng-s.center.lng;e.lng+=c>180?-360:c<-180?360:0}}class Ja{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,s){let c=this._map._getUIString(`AttributionControl.${s}`);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 s=this._map.style.sourceCaches;for(let d in s){let y=s[d];if(y.used){let v=y.getSource();v.attribution&&e.indexOf(v.attribution)<0&&e.push(v.attribution)}}e=e.filter(d=>String(d).trim()),e.sort((d,y)=>d.length-y.length),e=e.filter((d,y)=>{for(let v=y+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 ml{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 s=L.create("a","maplibregl-ctrl-logo mapboxgl-ctrl-logo");return s.target="_blank",s.rel="noopener nofollow",s.href="https://maplibre.org/",s.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),s.setAttribute("rel","noopener nofollow"),this._container.appendChild(s),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 s=e[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&s.classList.add("maplibregl-compact","mapboxgl-compact"):s.classList.remove("maplibregl-compact","mapboxgl-compact")}}}class Th{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(e){let s=++this._id;return this._queue.push({callback:e,id:s,cancelled:!1}),s}remove(e){let s=this._currentlyRunning,c=s?this._queue.concat(s):this._queue;for(let d of c)if(d.id===e)return void(d.cancelled=!0)}run(e=0){let s=this._currentlyRunning=this._queue;this._queue=[];for(let c of s)if(!c.cancelled&&(c.callback(e),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}let Eh={"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"},eu={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},on={showCompass:!0,showZoom:!0,visualizePitch:!1};class Ya{constructor(e,s,c=!1){this._clickTolerance=10,this.element=s,this.mouseRotate=new ie({clickTolerance:e.dragRotate._mouseRotate._clickTolerance}),this.map=e,c&&(this.mousePitch=new ll({clickTolerance:e.dragRotate._mousePitch._clickTolerance})),a.bindAll(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),L.addEventListener(s,"mousedown",this.mousedown),L.addEventListener(s,"touchstart",this.touchstart,{passive:!1}),L.addEventListener(s,"touchmove",this.touchmove),L.addEventListener(s,"touchend",this.touchend),L.addEventListener(s,"touchcancel",this.reset)}down(e,s){this.mouseRotate.mousedown(e,s),this.mousePitch&&this.mousePitch.mousedown(e,s),L.disableDrag()}move(e,s){let c=this.map,d=this.mouseRotate.mousemoveWindow(e,s);if(d&&d.bearingDelta&&c.setBearing(c.getBearing()+d.bearingDelta),this.mousePitch){let y=this.mousePitch.mousemoveWindow(e,s);y&&y.pitchDelta&&c.setPitch(c.getPitch()+y.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 le(p,e,s){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),y=s.locationPoint(p).distSqr(e);s.locationPoint(c).distSqr(e)<y?p=c:s.locationPoint(d).distSqr(e)<y&&(p=d)}for(;Math.abs(p.lng-s.center.lng)>180;){let c=s.locationPoint(p);if(c.x>=0&&c.y>=0&&c.x<=s.width&&c.y<=s.height)break;p.lng>s.center.lng?p.lng-=360:p.lng+=360}return p}let ye={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 la(p,e,s){let c=p.classList;for(let d in ye)c.remove(`maplibregl-${s}-anchor-${d}`,`mapboxgl-${s}-anchor-${d}`);c.add(`maplibregl-${s}-anchor-${e}`,`mapboxgl-${s}-anchor-${e}`)}class ha extends a.Evented{constructor(e,s){if(super(),(e instanceof HTMLElement||s)&&(e=a.extend({element:e},s)),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,y=27;c.setAttributeNS(null,"display","block"),c.setAttributeNS(null,"height",`${d}px`),c.setAttributeNS(null,"width",`${y}px`),c.setAttributeNS(null,"viewBox",`0 0 ${y} ${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 T=L.createNS("http://www.w3.org/2000/svg","g");T.setAttributeNS(null,"transform","translate(3.0, 29.0)"),T.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),T.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 Y=L.createNS("http://www.w3.org/2000/svg","path");Y.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(Y);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(T),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",y*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()}),la(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 s=e.code,c=e.charCode||e.keyCode;s!=="Space"&&s!=="Enter"&&c!==32&&c!==13||this.togglePopup()}_onMapClick(e){let s=e.originalEvent.target,c=this._element;this._popup&&(s===c||c.contains(s))&&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=le(this._lngLat,this._pos,this._map.transform)),this._pos=this._map.project(this._lngLat)._add(this._offset);let s="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?s=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(s=`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,`${ye[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${c} ${s}`)}getOffset(){return this._offset}setOffset(e){return this._offset=a.pointGeometry.convert(e),this._update(),this}_onMove(e){if(!this._isDragging){let s=this._clickTolerance||this._map._clickTolerance;this._isDragging=e.point.dist(this._pointerdownPos)>=s}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 gl={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0},Ni,Wn=0,ur=!1,iu={maxWidth:100,unit:"metric"};function ca(p,e,s){let c=s&&s.maxWidth||100,d=p._container.clientHeight/2,y=p.unproject([0,d]),v=p.unproject([c,d]),w=y.distanceTo(v);if(s&&s.unit==="imperial"){let T=3.2808*w;T>5280?li(e,c,T/5280,p._getUIString("ScaleControl.Miles")):li(e,c,T,p._getUIString("ScaleControl.Feet"))}else s&&s.unit==="nautical"?li(e,c,w/1852,p._getUIString("ScaleControl.NauticalMiles")):w>=1e3?li(e,c,w/1e3,p._getUIString("ScaleControl.Kilometers")):li(e,c,w,p._getUIString("ScaleControl.Meters"))}function li(p,e,s,c){let d=function(y){let v=Math.pow(10,`${Math.floor(y)}`.length-1),w=y/v;return w=w>=10?10:w>=5?5:w>=3?3:w>=2?2:w>=1?1:function(T){let C=Math.pow(10,Math.ceil(-Math.log(T)/Math.LN10));return Math.round(T*C)/C}(w),v*w}(s);p.style.width=e*(d/s)+"px",p.innerHTML=`${d}&nbsp;${c}`}let Ui={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},Ih=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function zs(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 zs(new a.pointGeometry(0,0))}let ua={supported:M,setRTLTextPlugin:a.setRTLTextPlugin,getRTLTextPluginStatus:a.getRTLTextPluginStatus,Map:class extends Ka{constructor(p){var e;if(a.PerformanceUtils.mark(a.PerformanceMarkers.create),(p=a.extend({},eu,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 ea(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 Th,this._controls=[],this._mapId=a.uniqueId(),this._locale=a.extend({},Eh,p.locale),this._clickTolerance=p.clickTolerance,this._pixelRatio=(e=p.pixelRatio)!==null&&e!==void 0?e:devicePixelRatio,this._requestManager=new Q(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 Fr(this,p),this._hash=p.hash&&new fh(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 Ja({customAttribution:p.customAttribution})),p.maplibreLogo&&this.addControl(new ml,p.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",s=>{this._update(s.dataType==="style"),this.fire(new a.Event(`${s.dataType}data`,s))}),this.on("dataloading",s=>{this.fire(new a.Event(`${s.dataType}dataloading`,s))}),this.on("dataabort",s=>{this.fire(new a.Event("sourcedataabort",s))})}_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 s=p.onAdd(this);this._controls.push(p);let c=this._controlPositions[e];return e.indexOf("bottom")!==-1?c.insertBefore(s,c.firstChild):c.appendChild(s),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(),s=e[0],c=e[1];this._resizeCanvas(s,c,this.getPixelRatio()),this.transform.resize(s,c),this.painter.resize(s,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,s]=this._containerDimensions();this._pixelRatio=p,this._resizeCanvas(e,s,p),this.painter.resize(e,s,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,s){if(p==="mouseenter"||p==="mouseover"){let c=!1;return{layer:e,listener:s,delegates:{mousemove:y=>{let v=this.getLayer(e)?this.queryRenderedFeatures(y.point,{layers:[e]}):[];v.length?c||(c=!0,s.call(this,new vr(p,this,y.originalEvent,{features:v}))):c=!1},mouseout:()=>{c=!1}}}}if(p==="mouseleave"||p==="mouseout"){let c=!1;return{layer:e,listener:s,delegates:{mousemove:v=>{(this.getLayer(e)?this.queryRenderedFeatures(v.point,{layers:[e]}):[]).length?c=!0:c&&(c=!1,s.call(this,new vr(p,this,v.originalEvent)))},mouseout:v=>{c&&(c=!1,s.call(this,new vr(p,this,v.originalEvent)))}}}}{let c=d=>{let y=this.getLayer(e)?this.queryRenderedFeatures(d.point,{layers:[e]}):[];y.length&&(d.features=y,s.call(this,d),delete d.features)};return{layer:e,listener:s,delegates:{[p]:c}}}}on(p,e,s){if(s===void 0)return super.on(p,e);let c=this._createDelegatedListener(p,e,s);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,s){if(s===void 0)return super.once(p,e);let c=this._createDelegatedListener(p,e,s);for(let d in c.delegates)this.once(d,c.delegates[d]);return this}off(p,e,s){return s===void 0?super.off(p,e):(this._delegatedListeners&&this._delegatedListeners[p]&&(c=>{let d=this._delegatedListeners[p];for(let y=0;y<d.length;y++){let v=d[y];if(v.layer===e&&v.listener===s){for(let w in v.delegates)this.off(w,v.delegates[w]);return d.splice(y,1),this}}})(),this)}queryRenderedFeatures(p,e){if(!this.style)return[];let s;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")s=[a.pointGeometry.convert(p)];else{let c=a.pointGeometry.convert(p[0]),d=a.pointGeometry.convert(p[1]);s=[c,new a.pointGeometry(d.x,c.y),d,new a.pointGeometry(c.x,d.y),c]}return this.style.queryRenderedFeatures(s,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 Zi(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 Zi(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(p,e){if(typeof p=="string"){let s=this._requestManager.transformRequest(p,a.ResourceType.Style);a.getJSON(s,(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(s){a.warnOnce(`Unable to perform style diff: ${s.message||s.error||s}. 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 s=p[e]._tiles;for(let c in s){let d=s[c];if(d.state!=="loaded"&&d.state!=="errored")return!1}}return!0}addSourceType(p,e,s){return this._lazyInitEmptyStyle(),this.style.addSourceType(p,e,s)}removeSource(p){return this.style.removeSource(p),this._update(!0)}getSource(p){return this.style.getSource(p)}addImage(p,e,{pixelRatio:s=1,sdf:c=!1,stretchX:d,stretchY:y,content:v}={}){if(this._lazyInitEmptyStyle(),e instanceof HTMLImageElement||a.isImageBitmap(e)){let{width:w,height:T,data:C}=a.exported.getImageData(e);this.style.addImage(p,{data:new a.RGBAImage({width:w,height:T},C),pixelRatio:s,stretchX:d,stretchY:y,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:T,data:C}=e,k=e;this.style.addImage(p,{data:new a.RGBAImage({width:w,height:T},new Uint8Array(C)),pixelRatio:s,stretchX:d,stretchY:y,content:v,sdf:c,version:0,userImage:k}),k.onAdd&&k.onAdd(this,p)}}}updateImage(p,e){let s=this.style.getImage(p);if(!s)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:y,data:v}=c;if(d===void 0||y===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!==s.data.width||y!==s.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));s.data.replace(v,w),this.style.updateImage(p,s)}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,s){return this.style.setLayerZoomRange(p,e,s),this._update(!0)}setFilter(p,e,s={}){return this.style.setFilter(p,e,s),this._update(!0)}getFilter(p){return this.style.getFilter(p)}setPaintProperty(p,e,s,c={}){return this.style.setPaintProperty(p,e,s,c),this._update(!0)}getPaintProperty(p,e){return this.style.getPaintProperty(p,e)}setLayoutProperty(p,e,s,c={}){return this.style.setLayoutProperty(p,e,s,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 s=this._containerDimensions();this._resizeCanvas(s[0],s[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(y=>{d[y]=L.create("div",`maplibregl-ctrl-${y} mapboxgl-ctrl-${y}`,c)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(p,e,s){this._canvas.width=s*p,this._canvas.height=s*e,this._canvas.style.width=`${p}px`,this._canvas.style.height=`${e}px`}_setupPainter(){let p=a.extend({},M.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 al(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,s=0,c=this.painter.context.extTimerQuery;if(this.listens("gpu-timing-frame")&&(e=c.createQueryEXT(),c.beginQueryEXT(c.TIME_ELAPSED_EXT,e),s=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 T=new a.EvaluationParameters(v,{now:w,fadeDuration:this._fadeDuration,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),C=T.crossFadingFactor();C===1&&C===this._crossFadingFactor||(d=!0,this._crossFadingFactor=C),this.style.update(T)}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()-s;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 y=this._sourcesDirty||this._styleDirty||this._placementDirty;return y||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new a.Event("idle")),!this._loaded||this._fullyLoaded||y||(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({},on,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(),s=p===this._map.getMinZoom();this._zoomInButton.disabled=e,this._zoomOutButton.disabled=s,this._zoomInButton.setAttribute("aria-disabled",e.toString()),this._zoomOutButton.setAttribute("aria-disabled",s.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 Ya(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 s=L.create("button",p,this._container);return s.type="button",s.addEventListener("click",e),s}_setButtonTitle(p,e){let s=this._map._getUIString(`NavigationControl.${e}`);p.title=s,p.setAttribute("aria-label",s)}},GeolocateControl:class extends a.Evented{constructor(p){super(),this.options=a.extend({},gl,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,Ni!==void 0?e(Ni):window.navigator.permissions!==void 0?window.navigator.permissions.query({name:"geolocation"}).then(s=>{Ni=s.state!=="denied",e(Ni)}):(Ni=!!window.navigator.geolocation,e(Ni)),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,Wn=0,ur=!1}_isOutOfMapMaxBounds(p){let e=this._map.getMaxBounds(),s=p.coords;return e&&(s.longitude<e.getWest()||s.longitude>e.getEast()||s.latitude<e.getSouth()||s.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),s=p.coords.accuracy,c=this._map.getBearing(),d=a.extend({bearing:c},this.options.fitBoundsOptions);this._map.fitBounds(e.toBounds(s),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]),s=this._map.unproject([1,p]),c=e.distanceTo(s),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&&ur)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 ha(this._dotElement),this._circleElement=L.create("div","maplibregl-user-location-accuracy-circle mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new ha({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":Wn--,ur=!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"),Wn++,Wn>1?(p={maximumAge:6e5,timeout:0},ur=!0):(p=this.options.positionOptions,ur=!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:Ja,LogoControl:ml,ScaleControl:class{constructor(p){this.options=a.extend({},iu,p),a.bindAll(["_onMove","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_onMove(){ca(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,ca(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(Ui),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(),s=document.createElement("body"),c;for(s.innerHTML=p;c=s.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="&#215;",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(y=>this._container.classList.add(y)),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=le(this._lngLat,this._pos,this._map.transform)),this._trackPointer&&!p))return;let e=this._pos=this._trackPointer&&p?p:this._map.project(this._lngLat),s=this.options.anchor,c=zs(this.options.offset);if(!s){let y=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<y/2?w.push("left"):e.x>this._map.transform.width-y/2&&w.push("right"),s=w.length===0?"bottom":w.join("-")}let d=e.add(c[s]).round();L.setTransform(this._container,`${ye[s]} translate(${d.x}px,${d.y}px)`),la(this._container,s,"popup")}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;let p=this._container.querySelector(Ih);p&&p.focus()}_onClose(){this.remove()}},Marker:ha,Style:Zi,LngLat:a.LngLat,LngLatBounds:a.LngLatBounds,Point:a.pointGeometry,MercatorCoordinate:a.MercatorCoordinate,Evented:a.Evented,AJAXError:a.AJAXError,config:a.config,CanvasSource:sn,GeoJSONSource:gn,ImageSource:Dr,RasterDEMTileSource:bi,RasterTileSource:Wr,VectorTileSource:kr,VideoSource:nn,prewarm:function(){U().acquire(yn)},clearPrewarmedResources:function(){let p=mt;p&&(p.isPreloaded()&&p.numActive()===1?(p.release(yn),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 Br.workerCount},set workerCount(p){Br.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 ci.extend(ua,{isSafari:a.isSafari,getPerformanceMetrics:a.PerformanceUtils.getPerformanceMetrics}),ua});var _=h;return _})});W();Qr();W();Qr();W();W();W();function ya(n){var o=new Error(n);return o.source="ulid",o}var ec="0123456789ABCDEFGHJKMNPQRSTVWXYZ",fo=ec.length,qu=Math.pow(2,48)-1,ju=10,of=16;function C0(n){var o=Math.floor(n()*fo);return o===fo&&(o=fo-1),ec.charAt(o)}function A0(n,o){if(isNaN(n))throw new Error(n+" must be a number");if(n>qu)throw ya("cannot encode time greater than "+qu);if(n<0)throw ya("time must be positive");if(Number.isInteger(n)===!1)throw ya("time must be an integer");for(var h=void 0,g="";o>0;o--)h=n%fo,g=ec.charAt(h)+g,n=(n-h)/fo;return g}function P0(n,o){for(var h="";n>0;n--)h=C0(o)+h;return h}function lf(n){if(n.length!==ju+of)throw ya("malformed ulid");var o=n.substr(0,ju).split("").reverse().reduce(function(h,g,_){var a=ec.indexOf(g);if(a===-1)throw ya("invalid character found: "+g);return h+=a*Math.pow(fo,_)},0);if(o>qu)throw ya("malformed ulid, timestamp too large");return o}function z0(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,o=arguments[1];o||(o=typeof window<"u"?window:null);var h=o&&(o.crypto||o.msCrypto);if(h)return function(){var _=new Uint8Array(1);return h.getRandomValues(_),_[0]/255};try{var g=af();return function(){return g.randomBytes(1).readUInt8()/255}}catch{}if(n){try{console.error("secure crypto unusable, falling back to insecure Math.random()!")}catch{}return function(){return Math.random()}}throw ya("secure crypto unusable, insecure Math.random not allowed")}function k0(n){return n||(n=z0()),function(h){return isNaN(h)&&(h=Date.now()),A0(h,ju)+P0(of,n)}}var hf=k0();var cf=()=>typeof localStorage<"u",uf=24*60*60*1e3,L0=30*uf,Q1=91*uf;function Bl(){let n="c"+hf().toLowerCase();return cf()&&localStorage.setItem("api-key",n),n}function pf(){if(!cf())return Bl();let n=localStorage.getItem("api-key");if(n==null||!n.startsWith("c"))return Bl();try{let o=lf(n.slice(1).toUpperCase());return Date.now()-L0<o?n:Bl()}catch{return Bl()}}W();W();W();var Bi=class{constructor(o,h,g,_){this.x=o,this.y=h,this.width=g,this.height=_}get bottom(){return this.y+this.height}get right(){return this.x+this.width}intersects(o){return this.x<o.right&&o.x<this.right&&this.y<o.bottom&&o.y<this.bottom}containsBounds(o){return Bi.contains(this,o)}intersection(o){let h=Math.max(this.x,o.x),g=Math.min(this.x+this.width,o.x+o.width),_=Math.max(this.y,o.y),a=Math.min(this.y+this.height,o.y+o.height);return g>h&&a>_?new Bi(h,_,g-h,a-_):null}static union(o){if(o.length===0)throw new Error("Union on empty list is not allowed");let{x:h,y:g}=o[0],_=h+o[0].width,a=g+o[0].height;for(let M=1;M<o.length;++M){let S=o[M];h=Math.min(h,S.x),_=Math.max(_,S.x+S.width),g=Math.min(g,S.y),a=Math.max(a,S.y+S.height)}return new Bi(h,g,_-h,a-g)}union(o){return Bi.union([this,o])}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(o,h=o){return new Bi(this.x*o,this.y*h,this.width*o,this.height*h)}scaleFromCenter(o,h=o){let g=this.width*o,_=this.height*h;return new Bi(this.x-.5*(g-this.width),this.y-.5*(_-this.height),g,_)}pad(o,h=o){return new Bi(this.x-o,this.y-h,this.width+o*2,this.height+h*2)}round(o=0){let h=Math.round(this.x-o),g=Math.round(this.y-o);return new Bi(h,g,Math.round(this.right+o)-h,Math.round(this.bottom+o)-g)}add(o){return new Bi(this.x+o.x,this.y+o.y,this.width,this.height)}subtract(o){return new Bi(this.x-o.x,this.y-o.y,this.width,this.height)}static fromMultiPolygon(o){if(o.length===0)return new Bi(0,0,0,0);let h=o[0][0][0][0],g=o[0][0][0][1],_=h,a=g;for(let[M]of o)for(let[S,D]of M)S<h?h=S:S>_&&(_=S),D<g?g=D:D>a&&(a=D);return new Bi(h,g,_-h,a-g)}static fromBbox([o,h,g,_]){return new Bi(Math.min(o,g),Math.min(h,_),Math.abs(g-o),Math.abs(_-h))}static fromUpperLeftLowerRight(o,h){return new Bi(o.x,o.y,h.x-o.x,h.y-o.y)}static fromJson(o){return new Bi(o.x,o.y,o.width,o.height)}static compareArea(o,h){let g=o.width*o.height-h.width*h.height;if(g!==0)return g;let _=o.x-h.x;return _===0?o.y-h.y:_}static contains(o,h){return o.x<=h.x&&o.x+o.width>=h.x+h.width&&o.y<=h.y&&o.y+o.height>=h.y+h.height}};W();var Ze;(function(n){n[n.Google=3857]="Google",n[n.Wgs84=4326]="Wgs84",n[n.Nztm2000=2193]="Nztm2000",n[n.Citm2000=3793]="Citm2000"})(Ze||(Ze={}));var $u={google:Ze.Google,epsg3857:Ze.Google,[Ze.Google]:Ze.Google,globalmercator:Ze.Google,wgs84:Ze.Wgs84,epsg4326:Ze.Wgs84,[Ze.Wgs84]:Ze.Wgs84,nztm:Ze.Nztm2000,epsg2193:Ze.Nztm2000,[Ze.Nztm2000]:Ze.Nztm2000,nztm2000:Ze.Nztm2000,citm:Ze.Citm2000,epsg3793:Ze.Citm2000,[Ze.Citm2000]:Ze.Citm2000,citm2000:Ze.Citm2000},qe=class{constructor(o){if(this.code=o,qe.Codes.has(o))throw new Error(`Duplicate EPSG code created: ${o}`);qe.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(o){let h=qe.Codes.get(o);if(h==null)throw new Error(`Invalid EPSG:${o}`);return h}static tryGet(o){if(o!=null)return qe.Codes.get(o)}static parseCode(o){var h;return o.startsWith("urn:")?$u[o.slice(o.lastIndexOf(":")+1)]:o.startsWith("https://")?$u[o.slice(o.lastIndexOf("/")+1)]:(h=$u[o.replace(/[\W_]/g,"").toLowerCase()])!==null&&h!==void 0?h:null}static parse(o){let h=qe.parseCode(o);return h==null?null:qe.get(h)}};qe.Codes=new Map;qe.Google=new qe(Ze.Google);qe.Wgs84=new qe(Ze.Wgs84);qe.Nztm2000=new qe(Ze.Nztm2000);qe.Citm2000=new qe(Ze.Citm2000);W();var rb="0".charCodeAt(0),nb="1".charCodeAt(0),sb="2".charCodeAt(0),ab="3".charCodeAt(0);W();W();var mo;(function(n){n[n.Xy=0]="Xy",n[n.Yx=1]="Yx"})(mo||(mo={}));function df(n){return n===qe.Nztm2000?mo.Yx:mo.Xy}function D0(n,o){return o.scaleDenominator-n.scaleDenominator}var Vs=class{constructor(o){this.zooms=[],this.indexX=0,this.indexY=1,this.zoomConversionMap=new Map,this.def=o,this.tileSize=o.tileMatrix[0].tileHeight;let h=o.tileMatrix.slice().sort(D0),g={};for(let N of h){if(g[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");g[N.identifier]=!0}this.zooms=h;let _=qe.parse(o.supportedCRS);if(_==null)throw new Error(`Unable to find supported projection ${o.supportedCRS}`);this.projection=_,df(this.projection)===mo.Yx&&(this.indexX=1,this.indexY=0);let{lowerCorner:a,upperCorner:M}=o.boundingBox,S=a[this.indexX],D=a[this.indexY];this.extent=new Bi(S,D,M[this.indexX]-S,M[this.indexY]-D)}get maxZoom(){return this.zooms.length-1}get identifier(){return this.def.identifier}pixelScale(o){let h=this.zooms[o];if(h==null)throw new Error(`Zoom not found :${o}`);return h.scaleDenominator*28e-5}tileToPixels(o,h){return{x:o*this.tileSize,y:h*this.tileSize}}pixelsToTile(o,h,g){let _=Math.floor(o/this.tileSize),a=Math.floor(h/this.tileSize);return{x:_,y:a,z:g}}sourceToPixels(o,h,g){let _=this.zooms[g],a=this.pixelScale(g),M=(o-_.topLeftCorner[this.indexX])/a,S=(_.topLeftCorner[this.indexY]-h)/a;return{x:M,y:S}}pixelsToSource(o,h,g){let _=this.zooms[g],a=this.pixelScale(g),M=_.topLeftCorner[this.indexX]+o*a,S=_.topLeftCorner[this.indexY]-h*a;return{x:M,y:S}}tileToSource(o){let h=this.tileToPixels(o.x,o.y);return this.pixelsToSource(h.x,h.y,o.z)}tileToSourceBounds(o){let h=this.tileToSource(o),g=this.pixelScale(o.z)*this.tileSize;return new Bi(h.x,h.y-g,g,g)}*topLevelTiles(){let{matrixWidth:h,matrixHeight:g}=this.zooms[0];for(let _=0;_<g;++_)for(let a=0;a<h;++a)yield{x:a,y:_,z:0};return null}*coverTile(o){if(o==null)return yield*this.topLevelTiles(),null;let h=o.z+1,{matrixWidth:g,matrixHeight:_}=this.zooms[o.z],{matrixWidth:a,matrixHeight:M}=this.zooms[h],S=a/g,D=M/_,N=Math.floor(o.x*S),L=Math.floor(o.y*D),Q=Math.ceil((o.x+1)*S),pt=Math.ceil((o.y+1)*D);for(let ot=L;ot<pt;++ot)for(let ft=N;ft<Q;++ft)yield{x:ft,y:ot,z:h};return null}static tileToName(o){return`${o.z}-${o.x}-${o.y}`}static nameToTile(o){let h=o.split("-");if(h.length===3){let g=Number(h[0]),_=Number(h[1]),a=Number(h[2]);if(!(isNaN(g)||isNaN(a)||isNaN(_)))return{x:_,y:a,z:g}}throw new Error(`Invalid tile name '${o}'`)}findBestZoom(o){let h=this.zoomConversionMap.get(o);return h==null&&(h=this.convertZoomLevel(o),this.zoomConversionMap.set(o,h)),h}convertZoomLevel(o){for(let h=0;h<this.zooms.length;h++){let g=this.zooms[h].scaleDenominator-o;if(g>1e-5)continue;if(h===0)return h;let _=this.zooms[h-1].scaleDenominator-o;return Math.abs(g)<_?h:h-1}return this.maxZoom}static convertZoomLevel(o,h,g,_=!0){return h.identifier===g.identifier||(o>=h.maxZoom&&(o=h.maxZoom),_&&o===0)?o:_&&o===h.maxZoom?g.maxZoom:g.findBestZoom(h.zooms[o].scaleDenominator)}};W();var ff={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"};W();W();var R0={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}]},Ye=new Vs(R0);W();var nc=Ns(yf(),1),rs=new Vs(nc.Nztm2000),Pn=new Vs(nc.Nztm2000Quad);var ns={All:[Ye,rs,Pn],Defaults:new Map([[qe.Google.code,Ye],[qe.Nztm2000.code,rs]]),get(n){let o=this.tryGet(n);if(o==null)throw new Error("Failed to lookup TileMatrixSet: "+n);return o},tryGet(n){var o,h;return n==null?null:typeof n=="number"?(o=this.Defaults.get(n))!==null&&o!==void 0?o:null:(h=this.Defaults.get(n.code))!==null&&h!==void 0?h:null},find(n){if(n==null)return null;let o=qe.parse(n);if(o!=null)return ns.tryGet(o);for(let h of ns.All)if(h.identifier===n)return h;return null}};W();var Fl;(function(n){n.Png="png",n.Jpeg="jpeg",n.Webp="webp",n.Avif="avif"})(Fl||(Fl={}));var Wu;(function(n){n.MapboxVectorTiles="pbf"})(Wu||(Wu={}));var xg=Ns(xf(),1);W();var yo={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},Ol=class{static toUrl(o,h){if(o.debug===!0){h.append("debug","true");for(let[g,_]of Object.entries(o))g==="debug"||yo[g]===_||h.append(g,String(_))}}static fromUrl(o,h){let g=h.get("debug")!=null,_=!1;if(g===!1){for(let[a,M]of Object.entries(yo))_=_a(o,a,M)||_;return _}return _=_a(o,"debug",!0),_=_a(o,"debug.background",h.get("debug.background"))||_,_=_a(o,"debug.source",h.get("debug.source")!=null)||_,_=_a(o,"debug.cog",h.get("debug.cog")!=null)||_,_=_a(o,"debug.screenshot",h.get("debug.screenshot")!=null)||_,_=Hu(o,"debug.layer.linz-aerial",h.get("debug.layer.linz-aerial"))||_,_=Hu(o,"debug.layer.linz-topographic",h.get("debug.layer.linz-topographic"))||_,_=Hu(o,"debug.layer.osm",h.get("debug.layer.osm"))||_,_}};function U0(n,o=0){if(n==null)return o;let h=Number(n);return isNaN(h)?o:h}function _a(n,o,h){return h==null&&(h=yo[o]),n[o]===h?!1:(n[o]=h,!0)}function Hu(n,o,h){return _a(n,o,U0(h))}W();W();W();W();var Sf=Ns(bf(),1),Tf=Ns(wf(),1);W();function Mf(n){return[[[n[0],n[1]],[n[2],n[1]],[n[2],n[3]],[n[0],n[3]],[n[0],n[1]]]]}var{intersection:Yu,union:qb}=Tf.default;function G0(n,o){return n[0]===o[0]&&n[1]===o[1]}function q0(n,o){return Yu(n,Mf(o))}function Qu(n,o){let h=[];for(let g of n){let _=Sf.default.polygon(g[0],o);_.length!==0&&(G0(_[0],_[_.length-1])||_.push(_[0]),h.push([_]))}return q0(h,o)}W();W();var Nl=n=>(n<-360?n=-(-n%360):n>360&&(n=n%360),n<-180?360+n:n>180?n-360:n),xa=(n,o)=>{let h=o-n;return h>180?h-360:h<-180?h+360:h},j0=(n,o)=>Nl(n+(o<n?o+360-n:o-n)),Gs={boxLonCenter(n){return Nl(n[0]+.5*(n[2]<n[0]?360+n[2]-n[0]:n[2]-n[0]))},delta:xa,crossesAM(n,o){return Math.sign(xa(n,o))!==Math.sign(o-n)},normLon:Nl,normExtent(n){return[Nl(n[0]),n[1],Nl(n[2]),n[3]]},union(n,o){if(o==null)return n.slice();let h=Gs.boxLonCenter(n),g=Gs.boxLonCenter(o);if(xa(h,g)<0)return this.union(o,n);let _=n.slice(),a=j0(h,g);return xa(a,o[0])<xa(a,n[0])&&(_[0]=o[0]),xa(a,o[2])>xa(a,n[2])&&(_[2]=o[2]),o[1]<n[1]&&(_[1]=o[1]),o[3]>n[3]&&(_[3]=o[3]),_},intersects(n,o){if(n[1]>o[3]||o[1]>n[3])return!1;let h=n[0],g=o[0],_=h<n[2]?n[2]:n[2]+360,a=g<o[2]?o[2]:o[2]+360;return h<=a&&g<=_||h+360<=a&&g<=_+360||h<=a+360&&g+360<=_},ringToBbox(n){if(n.length<3)throw new Error("Invalid ring");let o=!1,h=n[0],g=h[0],_=h[1],a=g,M=_,S=g;for(let D=1;D<n.length;++D){let N=n[D],L=N[0];Gs.crossesAM(S,L)&&(o=!o),o&&(L<0?L+=360:(S+=360,D===1&&(g=a=S))),L<g?g=L:L>a&&(a=L);let pt=N[1];pt<_?_=pt:pt>M&&(M=pt),S=N[0]}return[this.normLon(g),_,this.normLon(a),M]},multiPolygonToBbox(n){let o=null;for(let h of n){if(h.length===0)continue;let g=h[0];if(g.length<3)continue;let _=this.ringToBbox(g);o=o==null?_:this.union(o,_)}if(o==null)throw new Error("Invalid multipolygon");return o},bboxToMultiPolygon(n){let o=[n[0],n[1]],h=[n[2],n[1]],g=[n[0],n[3]],_=[n[2],n[3]];return n[0]<n[2]?[[[o,g,_,h,o]]]:[[[o,g,[180,_[1]],[180,h[1]],o]],[[_,h,[-180,o[1]],[-180,g[1]],_]]]}};var $0=[-180,-90,180,90],W0=[180,-90,360,90];function Z0(n,o,h){return[o[0]+(h[0]-o[0])*n,o[1]+(h[1]-o[1])*n]}function H0(n){let o=[];for(let h of Qu(n,$0))o.push(h);for(let h of Qu(n,W0))o.push(h.map(g=>g.map(_=>[_[0]-360,_[1]])));return o}function Ef(n,o,h=!0){let g=!1,_=!1,a=n.map(M=>M.map(S=>{let D=[];if(S.length===0)return D;let N=S[0],L=null,Q=0;for(let pt of S){let ot=o(pt),ft=ot[0];if(L!=null){let Rt=Gs.crossesAM(Q,ft);if(Rt&&(g=!0,_=!_),_&&(ft<0?ot[0]=ft+360:L[0]=Q+360),Rt){let Ct=(180-ot[0])/(L[0]-ot[0]),Dt=o(Z0(Ct,pt,N));D.push([180,Dt[1]])}}D.push(ot),N=pt,L=ot,Q=ft}return D}));return g&&h?H0(a):a}W();W();function X0(n){return{type:"Polygon",coordinates:n}}function If(n,o={}){return{type:"Feature",geometry:X0(n),properties:o}}function Cf(n,o={}){return{type:"Feature",geometry:{type:"MultiPolygon",coordinates:n},properties:o}}W();W();W();W();W();W();function Af(n){n("EPSG:4326","+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees"),n("EPSG:4269","+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees"),n("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"),n.WGS84=n["EPSG:4326"],n["EPSG:3785"]=n["EPSG:3857"],n.GOOGLE=n["EPSG:3857"],n["EPSG:900913"]=n["EPSG:3857"],n["EPSG:102113"]=n["EPSG:3857"]}W();W();var wn=1,Mn=2,xo=3,Pf=4,Ul=5,tp=6378137,zf=6356752314e-3,ep=.0066943799901413165,va=484813681109536e-20,Nt=Math.PI/2,kf=.16666666666666666,Lf=.04722222222222222,Df=.022156084656084655,jt=1e-10,Ci=.017453292519943295,Vr=57.29577951308232,He=Math.PI/4,qs=Math.PI*2,Ai=3.14159265359;W();var Cr={};Cr.greenwich=0;Cr.lisbon=-9.131906111111;Cr.paris=2.337229166667;Cr.bogota=-74.080916666667;Cr.madrid=-3.687938888889;Cr.rome=12.452333333333;Cr.bern=7.439583333333;Cr.jakarta=106.807719444444;Cr.ferro=-17.666666666667;Cr.brussels=4.367975;Cr.stockholm=18.058277777778;Cr.athens=23.7163375;Cr.oslo=10.722916666667;W();var Rf={ft:{to_meter:.3048},"us-ft":{to_meter:1200/3937}};W();var Bf=/[\s_\-\/\(\)]/g;function tn(n,o){if(n[o])return n[o];for(var h=Object.keys(n),g=o.toLowerCase().replace(Bf,""),_=-1,a,M;++_<h.length;)if(a=h[_],M=a.toLowerCase().replace(Bf,""),M===g)return n[a]}function Vl(n){var o={},h=n.split("+").map(function(S){return S.trim()}).filter(function(S){return S}).reduce(function(S,D){var N=D.split("=");return N.push(!0),S[N[0].toLowerCase()]=N[1],S},{}),g,_,a,M={proj:"projName",datum:"datumCode",rf:function(S){o.rf=parseFloat(S)},lat_0:function(S){o.lat0=S*Ci},lat_1:function(S){o.lat1=S*Ci},lat_2:function(S){o.lat2=S*Ci},lat_ts:function(S){o.lat_ts=S*Ci},lon_0:function(S){o.long0=S*Ci},lon_1:function(S){o.long1=S*Ci},lon_2:function(S){o.long2=S*Ci},alpha:function(S){o.alpha=parseFloat(S)*Ci},gamma:function(S){o.rectified_grid_angle=parseFloat(S)},lonc:function(S){o.longc=S*Ci},x_0:function(S){o.x0=parseFloat(S)},y_0:function(S){o.y0=parseFloat(S)},k_0:function(S){o.k0=parseFloat(S)},k:function(S){o.k0=parseFloat(S)},a:function(S){o.a=parseFloat(S)},b:function(S){o.b=parseFloat(S)},r_a:function(){o.R_A=!0},zone:function(S){o.zone=parseInt(S,10)},south:function(){o.utmSouth=!0},towgs84:function(S){o.datum_params=S.split(",").map(function(D){return parseFloat(D)})},to_meter:function(S){o.to_meter=parseFloat(S)},units:function(S){o.units=S;var D=tn(Rf,S);D&&(o.to_meter=D.to_meter)},from_greenwich:function(S){o.from_greenwich=S*Ci},pm:function(S){var D=tn(Cr,S);o.from_greenwich=(D||parseFloat(S))*Ci},nadgrids:function(S){S==="@null"?o.datumCode="none":o.nadgrids=S},axis:function(S){var D="ewnsud";S.length===3&&D.indexOf(S.substr(0,1))!==-1&&D.indexOf(S.substr(1,1))!==-1&&D.indexOf(S.substr(2,1))!==-1&&(o.axis=S)},approx:function(){o.approx=!0}};for(g in h)_=h[g],g in M?(a=M[g],typeof a=="function"?a(_):o[a]=_):o[g]=_;return typeof o.datumCode=="string"&&o.datumCode!=="WGS84"&&(o.datumCode=o.datumCode.toLowerCase()),o}W();W();var Ff=Q0,Gl=1,Of=2,Nf=3,ac=4,Uf=5,ip=-1,K0=/\s/,J0=/[A-Za-z]/,Y0=/[A-Za-z84_]/,oc=/[,\]]/,Vf=/[\d\.E\-\+]/;function as(n){if(typeof n!="string")throw new Error("not a string");this.text=n.trim(),this.level=0,this.place=0,this.root=null,this.stack=[],this.currentObject=null,this.state=Gl}as.prototype.readCharicter=function(){var n=this.text[this.place++];if(this.state!==ac)for(;K0.test(n);){if(this.place>=this.text.length)return;n=this.text[this.place++]}switch(this.state){case Gl:return this.neutral(n);case Of:return this.keyword(n);case ac:return this.quoted(n);case Uf:return this.afterquote(n);case Nf:return this.number(n);case ip:return}};as.prototype.afterquote=function(n){if(n==='"'){this.word+='"',this.state=ac;return}if(oc.test(n)){this.word=this.word.trim(),this.afterItem(n);return}throw new Error(`havn't handled "`+n+'" in afterquote yet, index '+this.place)};as.prototype.afterItem=function(n){if(n===","){this.word!==null&&this.currentObject.push(this.word),this.word=null,this.state=Gl;return}if(n==="]"){this.level--,this.word!==null&&(this.currentObject.push(this.word),this.word=null),this.state=Gl,this.currentObject=this.stack.pop(),this.currentObject||(this.state=ip);return}};as.prototype.number=function(n){if(Vf.test(n)){this.word+=n;return}if(oc.test(n)){this.word=parseFloat(this.word),this.afterItem(n);return}throw new Error(`havn't handled "`+n+'" in number yet, index '+this.place)};as.prototype.quoted=function(n){if(n==='"'){this.state=Uf;return}this.word+=n};as.prototype.keyword=function(n){if(Y0.test(n)){this.word+=n;return}if(n==="["){var o=[];o.push(this.word),this.level++,this.root===null?this.root=o:this.currentObject.push(o),this.stack.push(this.currentObject),this.currentObject=o,this.state=Gl;return}if(oc.test(n)){this.afterItem(n);return}throw new Error(`havn't handled "`+n+'" in keyword yet, index '+this.place)};as.prototype.neutral=function(n){if(J0.test(n)){this.word=n,this.state=Of;return}if(n==='"'){this.word="",this.state=ac;return}if(Vf.test(n)){this.word=n,this.state=Nf;return}if(oc.test(n)){this.afterItem(n);return}throw new Error(`havn't handled "`+n+'" in neutral yet, index '+this.place)};as.prototype.output=function(){for(;this.place<this.text.length;)this.readCharicter();if(this.state===ip)return this.root;throw new Error('unable to parse string "'+this.text+'". State is '+this.state)};function Q0(n){var o=new as(n);return o.output()}W();function Gf(n,o,h){Array.isArray(o)&&(h.unshift(o),o=null);var g=o?{}:n,_=h.reduce(function(a,M){return ba(M,a),a},g);o&&(n[o]=_)}function ba(n,o){if(!Array.isArray(n)){o[n]=!0;return}var h=n.shift();if(h==="PARAMETER"&&(h=n.shift()),n.length===1){if(Array.isArray(n[0])){o[h]={},ba(n[0],o[h]);return}o[h]=n[0];return}if(!n.length){o[h]=!0;return}if(h==="TOWGS84"){o[h]=n;return}if(h==="AXIS"){h in o||(o[h]=[]),o[h].push(n);return}Array.isArray(h)||(o[h]={});var g;switch(h){case"UNIT":case"PRIMEM":case"VERT_DATUM":o[h]={name:n[0].toLowerCase(),convert:n[1]},n.length===3&&ba(n[2],o[h]);return;case"SPHEROID":case"ELLIPSOID":o[h]={name:n[0],a:n[1],rf:n[2]},n.length===4&&ba(n[3],o[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":n[0]=["name",n[0]],Gf(o,h,n);return;default:for(g=-1;++g<n.length;)if(!Array.isArray(n[g]))return ba(n,o[h]);return Gf(o,h,n)}}var t_=.017453292519943295;function e_(n,o){var h=o[0],g=o[1];!(h in n)&&g in n&&(n[h]=n[g],o.length===3&&(n[h]=o[2](n[h])))}function os(n){return n*t_}function i_(n){if(n.type==="GEOGCS"?n.projName="longlat":n.type==="LOCAL_CS"?(n.projName="identity",n.local=!0):typeof n.PROJECTION=="object"?n.projName=Object.keys(n.PROJECTION)[0]:n.projName=n.PROJECTION,n.AXIS){for(var o="",h=0,g=n.AXIS.length;h<g;++h){var _=[n.AXIS[h][0].toLowerCase(),n.AXIS[h][1].toLowerCase()];_[0].indexOf("north")!==-1||(_[0]==="y"||_[0]==="lat")&&_[1]==="north"?o+="n":_[0].indexOf("south")!==-1||(_[0]==="y"||_[0]==="lat")&&_[1]==="south"?o+="s":_[0].indexOf("east")!==-1||(_[0]==="x"||_[0]==="lon")&&_[1]==="east"?o+="e":(_[0].indexOf("west")!==-1||(_[0]==="x"||_[0]==="lon")&&_[1]==="west")&&(o+="w")}o.length===2&&(o+="u"),o.length===3&&(n.axis=o)}n.UNIT&&(n.units=n.UNIT.name.toLowerCase(),n.units==="metre"&&(n.units="meter"),n.UNIT.convert&&(n.type==="GEOGCS"?n.DATUM&&n.DATUM.SPHEROID&&(n.to_meter=n.UNIT.convert*n.DATUM.SPHEROID.a):n.to_meter=n.UNIT.convert));var a=n.GEOGCS;n.type==="GEOGCS"&&(a=n),a&&(a.DATUM?n.datumCode=a.DATUM.name.toLowerCase():n.datumCode=a.name.toLowerCase(),n.datumCode.slice(0,2)==="d_"&&(n.datumCode=n.datumCode.slice(2)),(n.datumCode==="new_zealand_geodetic_datum_1949"||n.datumCode==="new_zealand_1949")&&(n.datumCode="nzgd49"),(n.datumCode==="wgs_1984"||n.datumCode==="world_geodetic_system_1984")&&(n.PROJECTION==="Mercator_Auxiliary_Sphere"&&(n.sphere=!0),n.datumCode="wgs84"),n.datumCode.slice(-6)==="_ferro"&&(n.datumCode=n.datumCode.slice(0,-6)),n.datumCode.slice(-8)==="_jakarta"&&(n.datumCode=n.datumCode.slice(0,-8)),~n.datumCode.indexOf("belge")&&(n.datumCode="rnb72"),a.DATUM&&a.DATUM.SPHEROID&&(n.ellps=a.DATUM.SPHEROID.name.replace("_19","").replace(/[Cc]larke\_18/,"clrk"),n.ellps.toLowerCase().slice(0,13)==="international"&&(n.ellps="intl"),n.a=a.DATUM.SPHEROID.a,n.rf=parseFloat(a.DATUM.SPHEROID.rf,10)),a.DATUM&&a.DATUM.TOWGS84&&(n.datum_params=a.DATUM.TOWGS84),~n.datumCode.indexOf("osgb_1936")&&(n.datumCode="osgb36"),~n.datumCode.indexOf("osni_1952")&&(n.datumCode="osni52"),(~n.datumCode.indexOf("tm65")||~n.datumCode.indexOf("geodetic_datum_of_1965"))&&(n.datumCode="ire65"),n.datumCode==="ch1903+"&&(n.datumCode="ch1903"),~n.datumCode.indexOf("israel")&&(n.datumCode="isr93")),n.b&&!isFinite(n.b)&&(n.b=n.a);function M(N){var L=n.to_meter||1;return N*L}var S=function(N){return e_(n,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",os],["longitude_of_center","Longitude_Of_Center"],["longitude_of_center","Longitude_of_center"],["longc","longitude_of_center",os],["x0","false_easting",M],["y0","false_northing",M],["long0","central_meridian",os],["lat0","latitude_of_origin",os],["lat0","standard_parallel_1",os],["lat1","standard_parallel_1",os],["lat2","standard_parallel_2",os],["azimuth","Azimuth"],["alpha","azimuth",os],["srsCode","name"]];D.forEach(S),!n.long0&&n.longc&&(n.projName==="Albers_Conic_Equal_Area"||n.projName==="Lambert_Azimuthal_Equal_Area")&&(n.long0=n.longc),!n.lat_ts&&n.lat1&&(n.projName==="Stereographic_South_Pole"||n.projName==="Polar Stereographic (variant B)")&&(n.lat0=os(n.lat1>0?90:-90),n.lat_ts=n.lat1)}function lc(n){var o=Ff(n),h=o.shift(),g=o.shift();o.unshift(["name",g]),o.unshift(["type",h]);var _={};return ba(o,_),i_(_),_}function fn(n){var o=this;if(arguments.length===2){var h=arguments[1];typeof h=="string"?h.charAt(0)==="+"?fn[n]=Vl(arguments[1]):fn[n]=lc(arguments[1]):fn[n]=h}else if(arguments.length===1){if(Array.isArray(n))return n.map(function(g){Array.isArray(g)?fn.apply(o,g):fn(g)});if(typeof n=="string"){if(n in fn)return fn[n]}else"EPSG"in n?fn["EPSG:"+n.EPSG]=n:"ESRI"in n?fn["ESRI:"+n.ESRI]=n:"IAU2000"in n?fn["IAU2000:"+n.IAU2000]=n:console.log(n);return}}Af(fn);var vo=fn;function r_(n){return typeof n=="string"}function n_(n){return n in vo}var s_=["PROJECTEDCRS","PROJCRS","GEOGCS","GEOCCS","PROJCS","LOCAL_CS","GEODCRS","GEODETICCRS","GEODETICDATUM","ENGCRS","ENGINEERINGCRS"];function a_(n){return s_.some(function(o){return n.indexOf(o)>-1})}var o_=["3857","900913","3785","102113"];function l_(n){var o=tn(n,"authority");if(!!o){var h=tn(o,"epsg");return h&&o_.indexOf(h)>-1}}function h_(n){var o=tn(n,"extension");if(!!o)return tn(o,"proj4")}function c_(n){return n[0]==="+"}function u_(n){if(r_(n)){if(n_(n))return vo[n];if(a_(n)){var o=lc(n);if(l_(o))return vo["EPSG:3857"];var h=h_(o);return h?Vl(h):o}if(c_(n))return Vl(n)}else return n}var qf=u_;W();function rp(n,o){n=n||{};var h,g;if(!o)return n;for(g in o)h=o[g],h!==void 0&&(n[g]=h);return n}W();W();W();function fr(n,o,h){var g=n*o;return h/Math.sqrt(1-g*g)}W();W();function zn(n){return n<0?-1:1}function Wt(n){return Math.abs(n)<=Ai?n:n-zn(n)*qs}W();function Ar(n,o,h){var g=n*h,_=.5*n;return g=Math.pow((1-g)/(1+g),_),Math.tan(.5*(Nt-o))/g}W();function ls(n,o){for(var h=.5*n,g,_,a=Nt-2*Math.atan(o),M=0;M<=15;M++)if(g=n*Math.sin(a),_=Nt-2*Math.atan(o*Math.pow((1-g)/(1+g),h))-a,a+=_,Math.abs(_)<=1e-10)return a;return-9999}function p_(){var n=this.b/this.a;this.es=1-n*n,"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=fr(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)):this.k0||(this.k?this.k0=this.k:this.k0=1)}function d_(n){var o=n.x,h=n.y;if(h*Vr>90&&h*Vr<-90&&o*Vr>180&&o*Vr<-180)return null;var g,_;if(Math.abs(Math.abs(h)-Nt)<=jt)return null;if(this.sphere)g=this.x0+this.a*this.k0*Wt(o-this.long0),_=this.y0+this.a*this.k0*Math.log(Math.tan(He+.5*h));else{var a=Math.sin(h),M=Ar(this.e,h,a);g=this.x0+this.a*this.k0*Wt(o-this.long0),_=this.y0-this.a*this.k0*Math.log(M)}return n.x=g,n.y=_,n}function f_(n){var o=n.x-this.x0,h=n.y-this.y0,g,_;if(this.sphere)_=Nt-2*Math.atan(Math.exp(-h/(this.a*this.k0)));else{var a=Math.exp(-h/(this.a*this.k0));if(_=ls(this.e,a),_===-9999)return null}return g=Wt(this.long0+o/(this.a*this.k0)),n.x=g,n.y=_,n}var m_=["Mercator","Popular Visualisation Pseudo Mercator","Mercator_1SP","Mercator_Auxiliary_Sphere","merc"],jf={init:p_,forward:d_,inverse:f_,names:m_};W();function g_(){}function $f(n){return n}var y_=["longlat","identity"],Wf={init:g_,forward:$f,inverse:$f,names:y_};var __=[jf,Wf],hc={},cc=[];function Zf(n,o){var h=cc.length;return n.names?(cc[h]=n,n.names.forEach(function(g){hc[g.toLowerCase()]=h}),this):(console.log(o),!0)}function x_(n){if(!n)return!1;var o=n.toLowerCase();if(typeof hc[o]<"u"&&cc[hc[o]])return cc[hc[o]]}function v_(){__.forEach(Zf)}var Hf={start:v_,add:Zf,get:x_};W();W();var ze={};ze.MERIT={a:6378137,rf:298.257,ellipseName:"MERIT 1983"};ze.SGS85={a:6378136,rf:298.257,ellipseName:"Soviet Geodetic System 85"};ze.GRS80={a:6378137,rf:298.257222101,ellipseName:"GRS 1980(IUGG, 1980)"};ze.IAU76={a:6378140,rf:298.257,ellipseName:"IAU 1976"};ze.airy={a:6377563396e-3,b:635625691e-2,ellipseName:"Airy 1830"};ze.APL4={a:6378137,rf:298.25,ellipseName:"Appl. Physics. 1965"};ze.NWL9D={a:6378145,rf:298.25,ellipseName:"Naval Weapons Lab., 1965"};ze.mod_airy={a:6377340189e-3,b:6356034446e-3,ellipseName:"Modified Airy"};ze.andrae={a:637710443e-2,rf:300,ellipseName:"Andrae 1876 (Den., Iclnd.)"};ze.aust_SA={a:6378160,rf:298.25,ellipseName:"Australian Natl & S. Amer. 1969"};ze.GRS67={a:6378160,rf:298.247167427,ellipseName:"GRS 67(IUGG 1967)"};ze.bessel={a:6377397155e-3,rf:299.1528128,ellipseName:"Bessel 1841"};ze.bess_nam={a:6377483865e-3,rf:299.1528128,ellipseName:"Bessel 1841 (Namibia)"};ze.clrk66={a:63782064e-1,b:63565838e-1,ellipseName:"Clarke 1866"};ze.clrk80={a:6378249145e-3,rf:293.4663,ellipseName:"Clarke 1880 mod."};ze.clrk58={a:6378293645208759e-9,rf:294.2606763692654,ellipseName:"Clarke 1858"};ze.CPM={a:63757387e-1,rf:334.29,ellipseName:"Comm. des Poids et Mesures 1799"};ze.delmbr={a:6376428,rf:311.5,ellipseName:"Delambre 1810 (Belgium)"};ze.engelis={a:637813605e-2,rf:298.2566,ellipseName:"Engelis 1985"};ze.evrst30={a:6377276345e-3,rf:300.8017,ellipseName:"Everest 1830"};ze.evrst48={a:6377304063e-3,rf:300.8017,ellipseName:"Everest 1948"};ze.evrst56={a:6377301243e-3,rf:300.8017,ellipseName:"Everest 1956"};ze.evrst69={a:6377295664e-3,rf:300.8017,ellipseName:"Everest 1969"};ze.evrstSS={a:6377298556e-3,rf:300.8017,ellipseName:"Everest (Sabah & Sarawak)"};ze.fschr60={a:6378166,rf:298.3,ellipseName:"Fischer (Mercury Datum) 1960"};ze.fschr60m={a:6378155,rf:298.3,ellipseName:"Fischer 1960"};ze.fschr68={a:6378150,rf:298.3,ellipseName:"Fischer 1968"};ze.helmert={a:6378200,rf:298.3,ellipseName:"Helmert 1906"};ze.hough={a:6378270,rf:297,ellipseName:"Hough"};ze.intl={a:6378388,rf:297,ellipseName:"International 1909 (Hayford)"};ze.kaula={a:6378163,rf:298.24,ellipseName:"Kaula 1961"};ze.lerch={a:6378139,rf:298.257,ellipseName:"Lerch 1979"};ze.mprts={a:6397300,rf:191,ellipseName:"Maupertius 1738"};ze.new_intl={a:63781575e-1,b:63567722e-1,ellipseName:"New International 1967"};ze.plessis={a:6376523,rf:6355863,ellipseName:"Plessis 1817 (France)"};ze.krass={a:6378245,rf:298.3,ellipseName:"Krassovsky, 1942"};ze.SEasia={a:6378155,b:63567733205e-4,ellipseName:"Southeast Asia"};ze.walbeck={a:6376896,b:63558348467e-4,ellipseName:"Walbeck"};ze.WGS60={a:6378165,rf:298.3,ellipseName:"WGS 60"};ze.WGS66={a:6378145,rf:298.25,ellipseName:"WGS 66"};ze.WGS7={a:6378135,rf:298.26,ellipseName:"WGS 72"};var Xf=ze.WGS84={a:6378137,rf:298.257223563,ellipseName:"WGS 84"};ze.sphere={a:6370997,b:6370997,ellipseName:"Normal Sphere (r=6370997)"};function Kf(n,o,h,g){var _=n*n,a=o*o,M=(_-a)/_,S=0;g?(n*=1-M*(kf+M*(Lf+M*Df)),_=n*n,M=0):S=Math.sqrt(M);var D=(_-a)/a;return{es:M,e:S,ep2:D}}function Jf(n,o,h,g,_){if(!n){var a=tn(ze,g);a||(a=Xf),n=a.a,o=a.b,h=a.rf}return h&&!o&&(o=(1-1/h)*n),(h===0||Math.abs(n-o)<jt)&&(_=!0,o=n),{a:n,b:o,rf:h,sphere:_}}W();var Ki={};Ki.wgs84={towgs84:"0,0,0",ellipse:"WGS84",datumName:"WGS84"};Ki.ch1903={towgs84:"674.374,15.056,405.346",ellipse:"bessel",datumName:"swiss"};Ki.ggrs87={towgs84:"-199.87,74.79,246.62",ellipse:"GRS80",datumName:"Greek_Geodetic_Reference_System_1987"};Ki.nad83={towgs84:"0,0,0",ellipse:"GRS80",datumName:"North_American_Datum_1983"};Ki.nad27={nadgrids:"@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat",ellipse:"clrk66",datumName:"North_American_Datum_1927"};Ki.potsdam={towgs84:"598.1,73.7,418.2,0.202,0.045,-2.455,6.7",ellipse:"bessel",datumName:"Potsdam Rauenberg 1950 DHDN"};Ki.carthage={towgs84:"-263.0,6.0,431.0",ellipse:"clark80",datumName:"Carthage 1934 Tunisia"};Ki.hermannskogel={towgs84:"577.326,90.129,463.919,5.137,1.474,5.297,2.4232",ellipse:"bessel",datumName:"Hermannskogel"};Ki.osni52={towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"airy",datumName:"Irish National"};Ki.ire65={towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"mod_airy",datumName:"Ireland 1965"};Ki.rassadiran={towgs84:"-133.63,-157.5,-158.62",ellipse:"intl",datumName:"Rassadiran"};Ki.nzgd49={towgs84:"59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993",ellipse:"intl",datumName:"New Zealand Geodetic Datum 1949"};Ki.osgb36={towgs84:"446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894",ellipse:"airy",datumName:"Airy 1830"};Ki.s_jtsk={towgs84:"589,76,480",ellipse:"bessel",datumName:"S-JTSK (Ferro)"};Ki.beduaram={towgs84:"-106,-87,188",ellipse:"clrk80",datumName:"Beduaram"};Ki.gunung_segara={towgs84:"-403,684,41",ellipse:"bessel",datumName:"Gunung Segara Jakarta"};Ki.rnb72={towgs84:"106.869,-52.2978,103.724,-0.33657,0.456955,-1.84218,1",ellipse:"intl",datumName:"Reseau National Belge 1972"};W();function b_(n,o,h,g,_,a,M){var S={};return n===void 0||n==="none"?S.datum_type=Ul:S.datum_type=Pf,o&&(S.datum_params=o.map(parseFloat),(S.datum_params[0]!==0||S.datum_params[1]!==0||S.datum_params[2]!==0)&&(S.datum_type=wn),S.datum_params.length>3&&(S.datum_params[3]!==0||S.datum_params[4]!==0||S.datum_params[5]!==0||S.datum_params[6]!==0)&&(S.datum_type=Mn,S.datum_params[3]*=va,S.datum_params[4]*=va,S.datum_params[5]*=va,S.datum_params[6]=S.datum_params[6]/1e6+1)),M&&(S.datum_type=xo,S.grids=M),S.a=h,S.b=g,S.es=_,S.ep2=a,S}var Yf=b_;W();var Qf={};function sp(n,o){var h=new DataView(o),g=M_(h),_=S_(h,g);_.nSubgrids>1&&console.log("Only single NTv2 subgrids are currently supported, subsequent sub grids are ignored");var a=T_(h,_,g),M={header:_,subgrids:a};return Qf[n]=M,M}function tm(n){if(n===void 0)return null;var o=n.split(",");return o.map(w_)}function w_(n){if(n.length===0)return null;var o=n[0]==="@";return o&&(n=n.slice(1)),n==="null"?{name:"null",mandatory:!o,grid:null,isNull:!0}:{name:n,mandatory:!o,grid:Qf[n]||null,isNull:!1}}function bo(n){return n/3600*Math.PI/180}function M_(n){var o=n.getInt32(8,!1);return o===11?!1:(o=n.getInt32(8,!0),o!==11&&console.warn("Failed to detect nadgrid endian-ness, defaulting to little-endian"),!0)}function S_(n,o){return{nFields:n.getInt32(8,o),nSubgridFields:n.getInt32(24,o),nSubgrids:n.getInt32(40,o),shiftType:np(n,56,56+8).trim(),fromSemiMajorAxis:n.getFloat64(120,o),fromSemiMinorAxis:n.getFloat64(136,o),toSemiMajorAxis:n.getFloat64(152,o),toSemiMinorAxis:n.getFloat64(168,o)}}function np(n,o,h){return String.fromCharCode.apply(null,new Uint8Array(n.buffer.slice(o,h)))}function T_(n,o,h){for(var g=176,_=[],a=0;a<o.nSubgrids;a++){var M=I_(n,g,h),S=C_(n,g,M,h),D=Math.round(1+(M.upperLongitude-M.lowerLongitude)/M.longitudeInterval),N=Math.round(1+(M.upperLatitude-M.lowerLatitude)/M.latitudeInterval);_.push({ll:[bo(M.lowerLongitude),bo(M.lowerLatitude)],del:[bo(M.longitudeInterval),bo(M.latitudeInterval)],lim:[D,N],count:M.gridNodeCount,cvs:E_(S)})}return _}function E_(n){return n.map(function(o){return[bo(o.longitudeShift),bo(o.latitudeShift)]})}function I_(n,o,h){return{name:np(n,o+8,o+16).trim(),parent:np(n,o+24,o+24+8).trim(),lowerLatitude:n.getFloat64(o+72,h),upperLatitude:n.getFloat64(o+88,h),lowerLongitude:n.getFloat64(o+104,h),upperLongitude:n.getFloat64(o+120,h),latitudeInterval:n.getFloat64(o+136,h),longitudeInterval:n.getFloat64(o+152,h),gridNodeCount:n.getInt32(o+168,h)}}function C_(n,o,h,g){for(var _=o+176,a=16,M=[],S=0;S<h.gridNodeCount;S++){var D={latitudeShift:n.getFloat32(_+S*a,g),longitudeShift:n.getFloat32(_+S*a+4,g),latitudeAccuracy:n.getFloat32(_+S*a+8,g),longitudeAccuracy:n.getFloat32(_+S*a+12,g)};M.push(D)}return M}function wo(n,o){if(!(this instanceof wo))return new wo(n);o=o||function(N){if(N)throw N};var h=qf(n);if(typeof h!="object"){o(n);return}var g=wo.projections.get(h.projName);if(!g){o(n);return}if(h.datumCode&&h.datumCode!=="none"){var _=tn(Ki,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),M=Kf(a.a,a.b,a.rf,h.R_A),S=tm(h.nadgrids),D=h.datum||Yf(h.datumCode,h.datum_params,a.a,a.b,M.es,M.ep2,S);rp(this,h),rp(this,g),this.a=a.a,this.b=a.b,this.rf=a.rf,this.sphere=a.sphere,this.es=M.es,this.e=M.e,this.ep2=M.ep2,this.datum=D,this.init(),o(null,this)}wo.projections=Hf;wo.projections.start();var js=wo;W();W();W();function em(n,o){return n.datum_type!==o.datum_type||n.a!==o.a||Math.abs(n.es-o.es)>5e-11?!1:n.datum_type===wn?n.datum_params[0]===o.datum_params[0]&&n.datum_params[1]===o.datum_params[1]&&n.datum_params[2]===o.datum_params[2]:n.datum_type===Mn?n.datum_params[0]===o.datum_params[0]&&n.datum_params[1]===o.datum_params[1]&&n.datum_params[2]===o.datum_params[2]&&n.datum_params[3]===o.datum_params[3]&&n.datum_params[4]===o.datum_params[4]&&n.datum_params[5]===o.datum_params[5]&&n.datum_params[6]===o.datum_params[6]:!0}function uc(n,o,h){var g=n.x,_=n.y,a=n.z?n.z:0,M,S,D,N;if(_<-Nt&&_>-1.001*Nt)_=-Nt;else if(_>Nt&&_<1.001*Nt)_=Nt;else{if(_<-Nt)return{x:-1/0,y:-1/0,z:n.z};if(_>Nt)return{x:1/0,y:1/0,z:n.z}}return g>Math.PI&&(g-=2*Math.PI),S=Math.sin(_),N=Math.cos(_),D=S*S,M=h/Math.sqrt(1-o*D),{x:(M+a)*N*Math.cos(g),y:(M+a)*N*Math.sin(g),z:(M*(1-o)+a)*S}}function pc(n,o,h,g){var _=1e-12,a=_*_,M=30,S,D,N,L,Q,pt,ot,ft,Rt,Ct,Dt,ne,Ht,fe=n.x,me=n.y,oe=n.z?n.z:0,Ce,Re,mi;if(S=Math.sqrt(fe*fe+me*me),D=Math.sqrt(fe*fe+me*me+oe*oe),S/h<_){if(Ce=0,D/h<_)return Re=Nt,mi=-g,{x:n.x,y:n.y,z:n.z}}else Ce=Math.atan2(me,fe);N=oe/D,L=S/D,Q=1/Math.sqrt(1-o*(2-o)*L*L),ft=L*(1-o)*Q,Rt=N*Q,Ht=0;do Ht++,ot=h/Math.sqrt(1-o*Rt*Rt),mi=S*ft+oe*Rt-ot*(1-o*Rt*Rt),pt=o*ot/(ot+mi),Q=1/Math.sqrt(1-pt*(2-pt)*L*L),Ct=L*(1-pt)*Q,Dt=N*Q,ne=Dt*ft-Ct*Rt,ft=Ct,Rt=Dt;while(ne*ne>a&&Ht<M);return Re=Math.atan(Dt/Math.abs(Ct)),{x:Ce,y:Re,z:mi}}function im(n,o,h){if(o===wn)return{x:n.x+h[0],y:n.y+h[1],z:n.z+h[2]};if(o===Mn){var g=h[0],_=h[1],a=h[2],M=h[3],S=h[4],D=h[5],N=h[6];return{x:N*(n.x-D*n.y+S*n.z)+g,y:N*(D*n.x+n.y-M*n.z)+_,z:N*(-S*n.x+M*n.y+n.z)+a}}}function rm(n,o,h){if(o===wn)return{x:n.x-h[0],y:n.y-h[1],z:n.z-h[2]};if(o===Mn){var g=h[0],_=h[1],a=h[2],M=h[3],S=h[4],D=h[5],N=h[6],L=(n.x-g)/N,Q=(n.y-_)/N,pt=(n.z-a)/N;return{x:L+D*Q-S*pt,y:-D*L+Q+M*pt,z:S*L-M*Q+pt}}}function dc(n){return n===wn||n===Mn}function am(n,o,h){if(em(n,o)||n.datum_type===Ul||o.datum_type===Ul)return h;var g=n.a,_=n.es;if(n.datum_type===xo){var a=nm(n,!1,h);if(a!==0)return;g=tp,_=ep}var M=o.a,S=o.b,D=o.es;if(o.datum_type===xo&&(M=tp,S=zf,D=ep),_===D&&g===M&&!dc(n.datum_type)&&!dc(o.datum_type))return h;if(h=uc(h,_,g),dc(n.datum_type)&&(h=im(h,n.datum_type,n.datum_params)),dc(o.datum_type)&&(h=rm(h,o.datum_type,o.datum_params)),h=pc(h,D,M,S),o.datum_type===xo){var N=nm(o,!0,h);if(N!==0)return}return h}function nm(n,o,h){if(n.grids===null||n.grids.length===0)return console.log("Grid shift grids not found"),-1;for(var g={x:-h.x,y:h.y},_={x:Number.NaN,y:Number.NaN},a=!1,M=[],S=0;S<n.grids.length;S++){var D=n.grids[S];if(M.push(D.name),D.isNull){_=g;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,Q=N.ll[0]-L,pt=N.ll[1]-L,ot=N.ll[0]+(N.lim[0]-1)*N.del[0]+L,ft=N.ll[1]+(N.lim[1]-1)*N.del[1]+L;if(!(pt>g.y||Q>g.x||ft<g.y||ot<g.x)&&(_=A_(g,o,N),!isNaN(_.x)))break}return isNaN(_.x)?(console.log("Failed to find a grid shift table for location '"+-g.x*Vr+" "+g.y*Vr+" tried: '"+M+"'"),-1):(h.x=-_.x,h.y=_.y,0)}function A_(n,o,h){var g={x:Number.NaN,y:Number.NaN};if(isNaN(n.x))return g;var _={x:n.x,y:n.y};_.x-=h.ll[0],_.y-=h.ll[1],_.x=Wt(_.x-Math.PI)+Math.PI;var a=sm(_,h);if(o){if(isNaN(a.x))return g;a.x=_.x-a.x,a.y=_.y-a.y;var M=9,S=1e-12,D,N;do{if(N=sm(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(M--&&Math.abs(D.x)>S&&Math.abs(D.y)>S);if(M<0)return console.log("Inverse grid shift iterator failed to converge."),g;g.x=Wt(a.x+h.ll[0]),g.y=a.y+h.ll[1]}else isNaN(a.x)||(g.x=n.x+a.x,g.y=n.y+a.y);return g}function sm(n,o){var h={x:n.x/o.del[0],y:n.y/o.del[1]},g={x:Math.floor(h.x),y:Math.floor(h.y)},_={x:h.x-1*g.x,y:h.y-1*g.y},a={x:Number.NaN,y:Number.NaN},M;if(g.x<0||g.x>=o.lim[0]||g.y<0||g.y>=o.lim[1])return a;M=g.y*o.lim[0]+g.x;var S={x:o.cvs[M][0],y:o.cvs[M][1]};M++;var D={x:o.cvs[M][0],y:o.cvs[M][1]};M+=o.lim[0];var N={x:o.cvs[M][0],y:o.cvs[M][1]};M--;var L={x:o.cvs[M][0],y:o.cvs[M][1]},Q=_.x*_.y,pt=_.x*(1-_.y),ot=(1-_.x)*(1-_.y),ft=(1-_.x)*_.y;return a.x=ot*S.x+pt*D.x+ft*L.x+Q*N.x,a.y=ot*S.y+pt*D.y+ft*L.y+Q*N.y,a}W();function ap(n,o,h){var g=h.x,_=h.y,a=h.z||0,M,S,D,N={};for(D=0;D<3;D++)if(!(o&&D===2&&h.z===void 0))switch(D===0?(M=g,"ew".indexOf(n.axis[D])!==-1?S="x":S="y"):D===1?(M=_,"ns".indexOf(n.axis[D])!==-1?S="y":S="x"):(M=a,S="z"),n.axis[D]){case"e":N[S]=M;break;case"w":N[S]=-M;break;case"n":N[S]=M;break;case"s":N[S]=-M;break;case"u":h[S]!==void 0&&(N.z=M);break;case"d":h[S]!==void 0&&(N.z=-M);break;default:return null}return N}W();function fc(n){var o={x:n[0],y:n[1]};return n.length>2&&(o.z=n[2]),n.length>3&&(o.m=n[3]),o}W();function lm(n){om(n.x),om(n.y)}function om(n){if(typeof Number.isFinite=="function"){if(Number.isFinite(n))return;throw new TypeError("coordinates must be finite numbers")}if(typeof n!="number"||n!==n||!isFinite(n))throw new TypeError("coordinates must be finite numbers")}function P_(n,o){return(n.datum.datum_type===wn||n.datum.datum_type===Mn)&&o.datumCode!=="WGS84"||(o.datum.datum_type===wn||o.datum.datum_type===Mn)&&n.datumCode!=="WGS84"}function wa(n,o,h,g){var _;if(Array.isArray(h)&&(h=fc(h)),lm(h),n.datum&&o.datum&&P_(n,o)&&(_=new js("WGS84"),h=wa(n,_,h,g),n=_),g&&n.axis!=="enu"&&(h=ap(n,!1,h)),n.projName==="longlat")h={x:h.x*Ci,y:h.y*Ci,z:h.z||0};else if(n.to_meter&&(h={x:h.x*n.to_meter,y:h.y*n.to_meter,z:h.z||0}),h=n.inverse(h),!h)return;if(n.from_greenwich&&(h.x+=n.from_greenwich),h=am(n.datum,o.datum,h),!!h)return o.from_greenwich&&(h={x:h.x-o.from_greenwich,y:h.y,z:h.z||0}),o.projName==="longlat"?h={x:h.x*Vr,y:h.y*Vr,z:h.z||0}:(h=o.forward(h),o.to_meter&&(h={x:h.x/o.to_meter,y:h.y/o.to_meter,z:h.z||0})),g&&o.axis!=="enu"?ap(o,!0,h):h}var hm=js("WGS84");function op(n,o,h,g){var _,a,M;return Array.isArray(h)?(_=wa(n,o,h,g)||{x:NaN,y:NaN},h.length>2?typeof n.name<"u"&&n.name==="geocent"||typeof o.name<"u"&&o.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=wa(n,o,h,g),M=Object.keys(h),M.length===2||M.forEach(function(S){if(typeof n.name<"u"&&n.name==="geocent"||typeof o.name<"u"&&o.name==="geocent"){if(S==="x"||S==="y"||S==="z")return}else if(S==="x"||S==="y")return;a[S]=h[S]}),a)}function cm(n){return n instanceof js?n:n.oProj?n.oProj:js(n)}function z_(n,o,h){n=cm(n);var g=!1,_;return typeof o>"u"?(o=n,n=hm,g=!0):(typeof o.x<"u"||Array.isArray(o))&&(h=o,o=n,n=hm,g=!0),o=cm(o),h?op(n,o,h):(_={forward:function(a,M){return op(n,o,a,M)},inverse:function(a,M){return op(o,n,a,M)}},g&&(_.oProj=o),_)}var Gr=z_;W();W();var um=6,dm="AJSAJS",fm="AFAFAF",Mo=65,qr=73,mn=79,ql=86,jl=90,mm={forward:hp,inverse:k_,toPoint:cp};function hp(n,o){return o=o||5,R_(L_({lat:n[1],lon:n[0]}),o)}function k_(n){var o=up(ym(n.toUpperCase()));return o.lat&&o.lon?[o.lon,o.lat,o.lon,o.lat]:[o.left,o.bottom,o.right,o.top]}function cp(n){var o=up(ym(n.toUpperCase()));return o.lat&&o.lon?[o.lon,o.lat]:[(o.left+o.right)/2,(o.top+o.bottom)/2]}function lp(n){return n*(Math.PI/180)}function pm(n){return 180*(n/Math.PI)}function L_(n){var o=n.lat,h=n.lon,g=6378137,_=.00669438,a=.9996,M,S,D,N,L,Q,pt,ot=lp(o),ft=lp(h),Rt,Ct;Ct=Math.floor((h+180)/6)+1,h===180&&(Ct=60),o>=56&&o<64&&h>=3&&h<12&&(Ct=32),o>=72&&o<84&&(h>=0&&h<9?Ct=31:h>=9&&h<21?Ct=33:h>=21&&h<33?Ct=35:h>=33&&h<42&&(Ct=37)),M=(Ct-1)*6-180+3,Rt=lp(M),S=_/(1-_),D=g/Math.sqrt(1-_*Math.sin(ot)*Math.sin(ot)),N=Math.tan(ot)*Math.tan(ot),L=S*Math.cos(ot)*Math.cos(ot),Q=Math.cos(ot)*(ft-Rt),pt=g*((1-_/4-3*_*_/64-5*_*_*_/256)*ot-(3*_/8+3*_*_/32+45*_*_*_/1024)*Math.sin(2*ot)+(15*_*_/256+45*_*_*_/1024)*Math.sin(4*ot)-35*_*_*_/3072*Math.sin(6*ot));var Dt=a*D*(Q+(1-N+L)*Q*Q*Q/6+(5-18*N+N*N+72*L-58*S)*Q*Q*Q*Q*Q/120)+5e5,ne=a*(pt+D*Math.tan(ot)*(Q*Q/2+(5-N+9*L+4*L*L)*Q*Q*Q*Q/24+(61-58*N+N*N+600*L-330*S)*Q*Q*Q*Q*Q*Q/720));return o<0&&(ne+=1e7),{northing:Math.round(ne),easting:Math.round(Dt),zoneNumber:Ct,zoneLetter:D_(o)}}function up(n){var o=n.northing,h=n.easting,g=n.zoneLetter,_=n.zoneNumber;if(_<0||_>60)return null;var a=.9996,M=6378137,S=.00669438,D,N=(1-Math.sqrt(1-S))/(1+Math.sqrt(1-S)),L,Q,pt,ot,ft,Rt,Ct,Dt,ne,Ht=h-5e5,fe=o;g<"N"&&(fe-=1e7),Ct=(_-1)*6-180+3,D=S/(1-S),Rt=fe/a,Dt=Rt/(M*(1-S/4-3*S*S/64-5*S*S*S/256)),ne=Dt+(3*N/2-27*N*N*N/32)*Math.sin(2*Dt)+(21*N*N/16-55*N*N*N*N/32)*Math.sin(4*Dt)+151*N*N*N/96*Math.sin(6*Dt),L=M/Math.sqrt(1-S*Math.sin(ne)*Math.sin(ne)),Q=Math.tan(ne)*Math.tan(ne),pt=D*Math.cos(ne)*Math.cos(ne),ot=M*(1-S)/Math.pow(1-S*Math.sin(ne)*Math.sin(ne),1.5),ft=Ht/(L*a);var me=ne-L*Math.tan(ne)/ot*(ft*ft/2-(5+3*Q+10*pt-4*pt*pt-9*D)*ft*ft*ft*ft/24+(61+90*Q+298*pt+45*Q*Q-252*D-3*pt*pt)*ft*ft*ft*ft*ft*ft/720);me=pm(me);var oe=(ft-(1+2*Q+pt)*ft*ft*ft/6+(5-2*pt+28*Q-3*pt*pt+8*D+24*Q*Q)*ft*ft*ft*ft*ft/120)/Math.cos(ne);oe=Ct+pm(oe);var Ce;if(n.accuracy){var Re=up({northing:n.northing+n.accuracy,easting:n.easting+n.accuracy,zoneLetter:n.zoneLetter,zoneNumber:n.zoneNumber});Ce={top:Re.lat,right:Re.lon,bottom:me,left:oe}}else Ce={lat:me,lon:oe};return Ce}function D_(n){var o="Z";return 84>=n&&n>=72?o="X":72>n&&n>=64?o="W":64>n&&n>=56?o="V":56>n&&n>=48?o="U":48>n&&n>=40?o="T":40>n&&n>=32?o="S":32>n&&n>=24?o="R":24>n&&n>=16?o="Q":16>n&&n>=8?o="P":8>n&&n>=0?o="N":0>n&&n>=-8?o="M":-8>n&&n>=-16?o="L":-16>n&&n>=-24?o="K":-24>n&&n>=-32?o="J":-32>n&&n>=-40?o="H":-40>n&&n>=-48?o="G":-48>n&&n>=-56?o="F":-56>n&&n>=-64?o="E":-64>n&&n>=-72?o="D":-72>n&&n>=-80&&(o="C"),o}function R_(n,o){var h="00000"+n.easting,g="00000"+n.northing;return n.zoneNumber+n.zoneLetter+B_(n.easting,n.northing,n.zoneNumber)+h.substr(h.length-5,o)+g.substr(g.length-5,o)}function B_(n,o,h){var g=gm(h),_=Math.floor(n/1e5),a=Math.floor(o/1e5)%20;return F_(_,a,g)}function gm(n){var o=n%um;return o===0&&(o=um),o}function F_(n,o,h){var g=h-1,_=dm.charCodeAt(g),a=fm.charCodeAt(g),M=_+n-1,S=a+o,D=!1;M>jl&&(M=M-jl+Mo-1,D=!0),(M===qr||_<qr&&M>qr||(M>qr||_<qr)&&D)&&M++,(M===mn||_<mn&&M>mn||(M>mn||_<mn)&&D)&&(M++,M===qr&&M++),M>jl&&(M=M-jl+Mo-1),S>ql?(S=S-ql+Mo-1,D=!0):D=!1,(S===qr||a<qr&&S>qr||(S>qr||a<qr)&&D)&&S++,(S===mn||a<mn&&S>mn||(S>mn||a<mn)&&D)&&(S++,S===qr&&S++),S>ql&&(S=S-ql+Mo-1);var N=String.fromCharCode(M)+String.fromCharCode(S);return N}function ym(n){if(n&&n.length===0)throw"MGRSPoint coverting from nothing";for(var o=n.length,h=null,g="",_,a=0;!/[A-Z]/.test(_=n.charAt(a));){if(a>=2)throw"MGRSPoint bad conversion from: "+n;g+=_,a++}var M=parseInt(g,10);if(a===0||a+3>o)throw"MGRSPoint bad conversion from: "+n;var S=n.charAt(a++);if(S<="A"||S==="B"||S==="Y"||S>="Z"||S==="I"||S==="O")throw"MGRSPoint zone letter "+S+" not handled: "+n;h=n.substring(a,a+=2);for(var D=gm(M),N=O_(h.charAt(0),D),L=N_(h.charAt(1),D);L<U_(S);)L+=2e6;var Q=o-a;if(Q%2!==0)throw`MGRSPoint has to have an even number
506
506
  of digits after the zone letter and two 100km letters - front
507
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=om.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=lm.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 pm=wo;Z();Z();Z();var P_=1,z_=.25,dm=.046875,fm=.01953125,mm=.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*(dm+s*(fm+s*mm))),l[1]=s*(k_-s*(dm+s*(fm+s*mm)));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 gm(s){var l=1+s,h=l-1;return h===0?s:s*Math.log(l)/h}function ym(s){var l=Math.abs(s);return l=gm(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 _m(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 xm(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=xm(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+_m(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=ym(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 vm(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=vm(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"],bm={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"],wm={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)"],Mm={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"],Sm={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"],Tm={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)"],Em={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"],Im={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"],Cm={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"],Am={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"],Pm={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"],zm={init:Qx,forward:tv,inverse:ev,names:iv};Z();Z();function km(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=km(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"],Lm={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"],Dm={init:ov,forward:lv,inverse:hv,names:cv};Z();var Rm=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=Rm;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=Rm;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"],Bm={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"],Fm={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"],Om={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"],Nm={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"],Um={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"],Vm={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"],Gm={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"],qm={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"],jm={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"],$m={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]],Wm=.8487,Zm=1.3523,Hm=Ur/5,Jv=1/Hm,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*Hm);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*Wm+this.x0,_.y=_.y*this.a*Zm+this.y0,_}function r1(s){var l={x:(s.x-this.x0)/(this.a*Wm),y:Math.abs(s.y-this.y0)/(this.a*Zm)};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"],Xm={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"],Km={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"],Ym={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"],Jm={init:d1,forward:f1,inverse:m1,names:g1};function Qm(s){s.Proj.projections.add(Mo),s.Proj.projections.add(So),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(zm),s.Proj.projections.add(Lm),s.Proj.projections.add(Dm),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($m),s.Proj.projections.add(Xm),s.Proj.projections.add(Km),s.Proj.projections.add(Ym),s.Proj.projections.add(Jm)}Vr.defaultDatum="WGS84";Vr.Proj=Ns;Vr.WGS84=new Vr.Proj("WGS84");Vr.Point=pm;Vr.toPoint=uc;Vr.defs=_o;Vr.nadgrid=Qu;Vr.transform=va;Vr.mgrs=hm;Vr.version="__VERSION__";Qm(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 tg=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+_*tg:y*tg+_}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 eg=`PROJCS["NZGD2000 / Chatham Islands TM 2000",
508
+ northing meters`+n;var pt=Q/2,ot=0,ft=0,Rt,Ct,Dt,ne,Ht;return pt>0&&(Rt=1e5/Math.pow(10,pt),Ct=n.substring(a,a+pt),ot=parseFloat(Ct)*Rt,Dt=n.substring(a+pt),ft=parseFloat(Dt)*Rt),ne=ot+N,Ht=ft+L,{easting:ne,northing:Ht,zoneLetter:S,zoneNumber:M,accuracy:Rt}}function O_(n,o){for(var h=dm.charCodeAt(o-1),g=1e5,_=!1;h!==n.charCodeAt(0);){if(h++,h===qr&&h++,h===mn&&h++,h>jl){if(_)throw"Bad character: "+n;h=Mo,_=!0}g+=1e5}return g}function N_(n,o){if(n>"V")throw"MGRSPoint given invalid Northing "+n;for(var h=fm.charCodeAt(o-1),g=0,_=!1;h!==n.charCodeAt(0);){if(h++,h===qr&&h++,h===mn&&h++,h>ql){if(_)throw"Bad character: "+n;h=Mo,_=!0}g+=1e5}return g}function U_(n){var o;switch(n){case"C":o=11e5;break;case"D":o=2e6;break;case"E":o=28e5;break;case"F":o=37e5;break;case"G":o=46e5;break;case"H":o=55e5;break;case"J":o=64e5;break;case"K":o=73e5;break;case"L":o=82e5;break;case"M":o=91e5;break;case"N":o=0;break;case"P":o=8e5;break;case"Q":o=17e5;break;case"R":o=26e5;break;case"S":o=35e5;break;case"T":o=44e5;break;case"U":o=53e5;break;case"V":o=62e5;break;case"W":o=7e6;break;case"X":o=79e5;break;default:o=-1}if(o>=0)return o;throw"Invalid zone letter: "+n}function So(n,o,h){if(!(this instanceof So))return new So(n,o,h);if(Array.isArray(n))this.x=n[0],this.y=n[1],this.z=n[2]||0;else if(typeof n=="object")this.x=n.x,this.y=n.y,this.z=n.z||0;else if(typeof n=="string"&&typeof o>"u"){var g=n.split(",");this.x=parseFloat(g[0],10),this.y=parseFloat(g[1],10),this.z=parseFloat(g[2],10)||0}else this.x=n,this.y=o,this.z=h||0;console.warn("proj4.Point will be removed in version 3, use proj4.toPoint")}So.fromMGRS=function(n){return new So(cp(n))};So.prototype.toMGRS=function(n){return hp([this.x,this.y],n)};var _m=So;W();W();W();var V_=1,G_=.25,xm=.046875,vm=.01953125,bm=.01068115234375,q_=.75,j_=.46875,$_=.013020833333333334,W_=.007120768229166667,Z_=.3645833333333333,H_=.005696614583333333,X_=.3076171875;function mc(n){var o=[];o[0]=V_-n*(G_+n*(xm+n*(vm+n*bm))),o[1]=n*(q_-n*(xm+n*(vm+n*bm)));var h=n*n;return o[2]=h*(j_-n*($_+n*W_)),h*=n,o[3]=h*(Z_-n*H_),o[4]=h*n*X_,o}W();function Ma(n,o,h,g){return h*=o,o*=o,g[0]*n-h*(g[1]+o*(g[2]+o*(g[3]+o*g[4])))}W();var K_=20;function gc(n,o,h){for(var g=1/(1-o),_=n,a=K_;a;--a){var M=Math.sin(_),S=1-o*M*M;if(S=(Ma(_,M,Math.cos(_),h)-n)*(S*Math.sqrt(S))*g,_-=S,Math.abs(S)<jt)return _}return _}function J_(){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=mc(this.es),this.ml0=Ma(this.lat0,Math.sin(this.lat0),Math.cos(this.lat0),this.en))}function Y_(n){var o=n.x,h=n.y,g=Wt(o-this.long0),_,a,M,S=Math.sin(h),D=Math.cos(h);if(this.es){var L=D*g,Q=Math.pow(L,2),pt=this.ep2*Math.pow(D,2),ot=Math.pow(pt,2),ft=Math.abs(D)>jt?Math.tan(h):0,Rt=Math.pow(ft,2),Ct=Math.pow(Rt,2);_=1-this.es*Math.pow(S,2),L=L/Math.sqrt(_);var Dt=Ma(h,S,D,this.en);a=this.a*(this.k0*L*(1+Q/6*(1-Rt+pt+Q/20*(5-18*Rt+Ct+14*pt-58*Rt*pt+Q/42*(61+179*Ct-Ct*Rt-479*Rt)))))+this.x0,M=this.a*(this.k0*(Dt-this.ml0+S*g*L/2*(1+Q/12*(5-Rt+9*pt+4*ot+Q/30*(61+Ct-58*Rt+270*pt-330*Rt*pt+Q/56*(1385+543*Ct-Ct*Rt-3111*Rt))))))+this.y0}else{var N=D*Math.sin(g);if(Math.abs(Math.abs(N)-1)<jt)return 93;if(a=.5*this.a*this.k0*Math.log((1+N)/(1-N))+this.x0,M=D*Math.cos(g)/Math.sqrt(1-Math.pow(N,2)),N=Math.abs(M),N>=1){if(N-1>jt)return 93;M=0}else M=Math.acos(M);h<0&&(M=-M),M=this.a*this.k0*(M-this.lat0)+this.y0}return n.x=a,n.y=M,n}function Q_(n){var o,h,g,_,a=(n.x-this.x0)*(1/this.a),M=(n.y-this.y0)*(1/this.a);if(this.es)if(o=this.ml0+M/this.k0,h=gc(o,this.es,this.en),Math.abs(h)<Nt){var Q=Math.sin(h),pt=Math.cos(h),ot=Math.abs(pt)>jt?Math.tan(h):0,ft=this.ep2*Math.pow(pt,2),Rt=Math.pow(ft,2),Ct=Math.pow(ot,2),Dt=Math.pow(Ct,2);o=1-this.es*Math.pow(Q,2);var ne=a*Math.sqrt(o)/this.k0,Ht=Math.pow(ne,2);o=o*ot,g=h-o*Ht/(1-this.es)*.5*(1-Ht/12*(5+3*Ct-9*ft*Ct+ft-4*Rt-Ht/30*(61+90*Ct-252*ft*Ct+45*Dt+46*ft-Ht/56*(1385+3633*Ct+4095*Dt+1574*Dt*Ct)))),_=Wt(this.long0+ne*(1-Ht/6*(1+2*Ct+ft-Ht/20*(5+28*Ct+24*Dt+8*ft*Ct+6*ft-Ht/42*(61+662*Ct+1320*Dt+720*Dt*Ct))))/pt)}else g=Nt*zn(M),_=0;else{var S=Math.exp(a/this.k0),D=.5*(S-1/S),N=this.lat0+M/this.k0,L=Math.cos(N);o=Math.sqrt((1-Math.pow(L,2))/(1+Math.pow(D,2))),g=Math.asin(o),M<0&&(g=-g),D===0&&L===0?_=0:_=Wt(Math.atan2(D,L)+this.long0)}return n.x=_,n.y=g,n}var tx=["Fast_Transverse_Mercator","Fast Transverse Mercator"],To={init:J_,forward:Y_,inverse:Q_,names:tx};W();W();function yc(n){var o=Math.exp(n);return o=(o-1/o)/2,o}W();function Pr(n,o){n=Math.abs(n),o=Math.abs(o);var h=Math.max(n,o),g=Math.min(n,o)/(h||1);return h*Math.sqrt(1+Math.pow(g,2))}W();W();function wm(n){var o=1+n,h=o-1;return h===0?n:n*Math.log(o)/h}function Mm(n){var o=Math.abs(n);return o=wm(o*(1+o/(Pr(1,o)+1))),n<0?-o:o}W();function _c(n,o){for(var h=2*Math.cos(2*o),g=n.length-1,_=n[g],a=0,M;--g>=0;)M=-a+h*_+n[g],a=_,_=M;return o+M*Math.sin(2*o)}W();function Sm(n,o){for(var h=2*Math.cos(o),g=n.length-1,_=n[g],a=0,M;--g>=0;)M=-a+h*_+n[g],a=_,_=M;return Math.sin(o)*M}W();W();function Tm(n){var o=Math.exp(n);return o=(o+1/o)/2,o}function pp(n,o,h){for(var g=Math.sin(o),_=Math.cos(o),a=yc(h),M=Tm(h),S=2*_*M,D=-2*g*a,N=n.length-1,L=n[N],Q=0,pt=0,ot=0,ft,Rt;--N>=0;)ft=pt,Rt=Q,pt=L,Q=ot,L=-ft+S*pt-D*Q+n[N],ot=-Rt+D*pt+S*Q;return S=g*M,D=_*a,[S*L-D*ot,S*ot+D*L]}function ex(){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&&(To.init.apply(this),this.forward=To.forward,this.inverse=To.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 n=this.es/(1+Math.sqrt(1-this.es)),o=n/(2-n),h=o;this.cgb[0]=o*(2+o*(-2/3+o*(-2+o*(116/45+o*(26/45+o*(-2854/675)))))),this.cbg[0]=o*(-2+o*(2/3+o*(4/3+o*(-82/45+o*(32/45+o*(4642/4725)))))),h=h*o,this.cgb[1]=h*(7/3+o*(-8/5+o*(-227/45+o*(2704/315+o*(2323/945))))),this.cbg[1]=h*(5/3+o*(-16/15+o*(-13/9+o*(904/315+o*(-1522/945))))),h=h*o,this.cgb[2]=h*(56/15+o*(-136/35+o*(-1262/105+o*(73814/2835)))),this.cbg[2]=h*(-26/15+o*(34/21+o*(8/5+o*(-12686/2835)))),h=h*o,this.cgb[3]=h*(4279/630+o*(-332/35+o*(-399572/14175))),this.cbg[3]=h*(1237/630+o*(-12/5+o*(-24832/14175))),h=h*o,this.cgb[4]=h*(4174/315+o*(-144838/6237)),this.cbg[4]=h*(-734/315+o*(109598/31185)),h=h*o,this.cgb[5]=h*(601676/22275),this.cbg[5]=h*(444337/155925),h=Math.pow(o,2),this.Qn=this.k0/(1+o)*(1+h*(1/4+h*(1/64+h/256))),this.utg[0]=o*(-.5+o*(2/3+o*(-37/96+o*(1/360+o*(81/512+o*(-96199/604800)))))),this.gtu[0]=o*(.5+o*(-2/3+o*(5/16+o*(41/180+o*(-127/288+o*(7891/37800)))))),this.utg[1]=h*(-1/48+o*(-1/15+o*(437/1440+o*(-46/105+o*(1118711/3870720))))),this.gtu[1]=h*(13/48+o*(-3/5+o*(557/1440+o*(281/630+o*(-1983433/1935360))))),h=h*o,this.utg[2]=h*(-17/480+o*(37/840+o*(209/4480+o*(-5569/90720)))),this.gtu[2]=h*(61/240+o*(-103/140+o*(15061/26880+o*(167603/181440)))),h=h*o,this.utg[3]=h*(-4397/161280+o*(11/504+o*(830251/7257600))),this.gtu[3]=h*(49561/161280+o*(-179/168+o*(6601661/7257600))),h=h*o,this.utg[4]=h*(-4583/161280+o*(108847/3991680)),this.gtu[4]=h*(34729/80640+o*(-3418889/1995840)),h=h*o,this.utg[5]=h*(-20648693/638668800),this.gtu[5]=h*(212378941/319334400);var g=_c(this.cbg,this.lat0);this.Zb=-this.Qn*(g+Sm(this.gtu,2*g))}function ix(n){var o=Wt(n.x-this.long0),h=n.y;h=_c(this.cbg,h);var g=Math.sin(h),_=Math.cos(h),a=Math.sin(o),M=Math.cos(o);h=Math.atan2(g,M*_),o=Math.atan2(a*_,Pr(g,_*M)),o=Mm(Math.tan(o));var S=pp(this.gtu,2*h,2*o);h=h+S[0],o=o+S[1];var D,N;return Math.abs(o)<=2.623395162778?(D=this.a*(this.Qn*o)+this.x0,N=this.a*(this.Qn*h+this.Zb)+this.y0):(D=1/0,N=1/0),n.x=D,n.y=N,n}function rx(n){var o=(n.x-this.x0)*(1/this.a),h=(n.y-this.y0)*(1/this.a);h=(h-this.Zb)/this.Qn,o=o/this.Qn;var g,_;if(Math.abs(o)<=2.623395162778){var a=pp(this.utg,2*h,2*o);h=h+a[0],o=o+a[1],o=Math.atan(yc(o));var M=Math.sin(h),S=Math.cos(h),D=Math.sin(o),N=Math.cos(o);h=Math.atan2(M*N,Pr(D,N*S)),o=Math.atan2(D,N*S),g=Wt(o+this.long0),_=_c(this.cgb,h)}else g=1/0,_=1/0;return n.x=g,n.y=_,n}var nx=["Extended_Transverse_Mercator","Extended Transverse Mercator","etmerc","Transverse_Mercator","Transverse Mercator","tmerc"],Eo={init:ex,forward:ix,inverse:rx,names:nx};W();W();function Em(n,o){if(n===void 0){if(n=Math.floor((Wt(o)+Math.PI)*30/Math.PI)+1,n<0)return 0;if(n>60)return 60}return n}var sx="etmerc";function ax(){var n=Em(this.zone,this.long0);if(n===void 0)throw new Error("unknown utm zone");this.lat0=0,this.long0=(6*Math.abs(n)-183)*Ci,this.x0=5e5,this.y0=this.utmSouth?1e7:0,this.k0=.9996,Eo.init.apply(this),this.forward=Eo.forward,this.inverse=Eo.inverse}var ox=["Universal Transverse Mercator System","utm"],Im={init:ax,names:ox,dependsOn:sx};W();W();W();function xc(n,o){return Math.pow((1-n)/(1+n),o)}var lx=20;function hx(){var n=Math.sin(this.lat0),o=Math.cos(this.lat0);o*=o,this.rc=Math.sqrt(1-this.es)/(1-this.es*n*n),this.C=Math.sqrt(1+this.es*o*o/(1-this.es)),this.phic0=Math.asin(n/this.C),this.ratexp=.5*this.C*this.e,this.K=Math.tan(.5*this.phic0+He)/(Math.pow(Math.tan(.5*this.lat0+He),this.C)*xc(this.e*n,this.ratexp))}function cx(n){var o=n.x,h=n.y;return n.y=2*Math.atan(this.K*Math.pow(Math.tan(.5*h+He),this.C)*xc(this.e*Math.sin(h),this.ratexp))-Nt,n.x=this.C*o,n}function ux(n){for(var o=1e-14,h=n.x/this.C,g=n.y,_=Math.pow(Math.tan(.5*g+He)/this.K,1/this.C),a=lx;a>0&&(g=2*Math.atan(_*xc(this.e*Math.sin(n.y),-.5*this.e))-Nt,!(Math.abs(g-n.y)<o));--a)n.y=g;return a?(n.x=h,n.y=g,n):null}var px=["gauss"],vc={init:hx,forward:cx,inverse:ux,names:px};function dx(){vc.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 fx(n){var o,h,g,_;return n.x=Wt(n.x-this.long0),vc.forward.apply(this,[n]),o=Math.sin(n.y),h=Math.cos(n.y),g=Math.cos(n.x),_=this.k0*this.R2/(1+this.sinc0*o+this.cosc0*h*g),n.x=_*h*Math.sin(n.x),n.y=_*(this.cosc0*o-this.sinc0*h*g),n.x=this.a*n.x+this.x0,n.y=this.a*n.y+this.y0,n}function mx(n){var o,h,g,_,a;if(n.x=(n.x-this.x0)/this.a,n.y=(n.y-this.y0)/this.a,n.x/=this.k0,n.y/=this.k0,a=Math.sqrt(n.x*n.x+n.y*n.y)){var M=2*Math.atan2(a,this.R2);o=Math.sin(M),h=Math.cos(M),_=Math.asin(h*this.sinc0+n.y*o*this.cosc0/a),g=Math.atan2(n.x*o,a*this.cosc0*h-n.y*this.sinc0*o)}else _=this.phic0,g=0;return n.x=g,n.y=_,vc.inverse.apply(this,[n]),n.x=Wt(n.x+this.long0),n}var gx=["Stereographic_North_Pole","Oblique_Stereographic","Polar_Stereographic","sterea","Oblique Stereographic Alternative","Double_Stereographic"],Cm={init:dx,forward:fx,inverse:mx,names:gx};W();function yx(n,o,h){return o*=h,Math.tan(.5*(Nt+n))*Math.pow((1-o)/(1+o),.5*h)}function _x(){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)<=jt&&(this.k0=.5*(1+zn(this.lat0)*Math.sin(this.lat_ts))):(Math.abs(this.coslat0)<=jt&&(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)<=jt&&(this.k0=.5*this.cons*fr(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts))/Ar(this.e,this.con*this.lat_ts,this.con*Math.sin(this.lat_ts))),this.ms1=fr(this.e,this.sinlat0,this.coslat0),this.X0=2*Math.atan(this.ssfn_(this.lat0,this.sinlat0,this.e))-Nt,this.cosX0=Math.cos(this.X0),this.sinX0=Math.sin(this.X0))}function xx(n){var o=n.x,h=n.y,g=Math.sin(h),_=Math.cos(h),a,M,S,D,N,L,Q=Wt(o-this.long0);return Math.abs(Math.abs(o-this.long0)-Math.PI)<=jt&&Math.abs(h+this.lat0)<=jt?(n.x=NaN,n.y=NaN,n):this.sphere?(a=2*this.k0/(1+this.sinlat0*g+this.coslat0*_*Math.cos(Q)),n.x=this.a*a*_*Math.sin(Q)+this.x0,n.y=this.a*a*(this.coslat0*g-this.sinlat0*_*Math.cos(Q))+this.y0,n):(M=2*Math.atan(this.ssfn_(h,g,this.e))-Nt,D=Math.cos(M),S=Math.sin(M),Math.abs(this.coslat0)<=jt?(N=Ar(this.e,h*this.con,this.con*g),L=2*this.a*this.k0*N/this.cons,n.x=this.x0+L*Math.sin(o-this.long0),n.y=this.y0-this.con*L*Math.cos(o-this.long0),n):(Math.abs(this.sinlat0)<jt?(a=2*this.a*this.k0/(1+D*Math.cos(Q)),n.y=a*S):(a=2*this.a*this.k0*this.ms1/(this.cosX0*(1+this.sinX0*S+this.cosX0*D*Math.cos(Q))),n.y=a*(this.cosX0*S-this.sinX0*D*Math.cos(Q))+this.y0),n.x=a*D*Math.sin(Q)+this.x0,n))}function vx(n){n.x-=this.x0,n.y-=this.y0;var o,h,g,_,a,M=Math.sqrt(n.x*n.x+n.y*n.y);if(this.sphere){var S=2*Math.atan(M/(2*this.a*this.k0));return o=this.long0,h=this.lat0,M<=jt?(n.x=o,n.y=h,n):(h=Math.asin(Math.cos(S)*this.sinlat0+n.y*Math.sin(S)*this.coslat0/M),Math.abs(this.coslat0)<jt?this.lat0>0?o=Wt(this.long0+Math.atan2(n.x,-1*n.y)):o=Wt(this.long0+Math.atan2(n.x,n.y)):o=Wt(this.long0+Math.atan2(n.x*Math.sin(S),M*this.coslat0*Math.cos(S)-n.y*this.sinlat0*Math.sin(S))),n.x=o,n.y=h,n)}else if(Math.abs(this.coslat0)<=jt){if(M<=jt)return h=this.lat0,o=this.long0,n.x=o,n.y=h,n;n.x*=this.con,n.y*=this.con,g=M*this.cons/(2*this.a*this.k0),h=this.con*ls(this.e,g),o=this.con*Wt(this.con*this.long0+Math.atan2(n.x,-1*n.y))}else _=2*Math.atan(M*this.cosX0/(2*this.a*this.k0*this.ms1)),o=this.long0,M<=jt?a=this.X0:(a=Math.asin(Math.cos(_)*this.sinX0+n.y*Math.sin(_)*this.cosX0/M),o=Wt(this.long0+Math.atan2(n.x*Math.sin(_),M*this.cosX0*Math.cos(_)-n.y*this.sinX0*Math.sin(_)))),h=-1*ls(this.e,Math.tan(.5*(Nt+a)));return n.x=o,n.y=h,n}var bx=["stere","Stereographic_South_Pole","Polar Stereographic (variant B)"],Am={init:_x,forward:xx,inverse:vx,names:bx,ssfn_:yx};W();function wx(){var n=this.lat0;this.lambda0=this.long0;var o=Math.sin(n),h=this.a,g=this.rf,_=1/g,a=2*_-Math.pow(_,2),M=this.e=Math.sqrt(a);this.R=this.k0*h*Math.sqrt(1-a)/(1-a*Math.pow(o,2)),this.alpha=Math.sqrt(1+a/(1-a)*Math.pow(Math.cos(n),4)),this.b0=Math.asin(o/this.alpha);var S=Math.log(Math.tan(Math.PI/4+this.b0/2)),D=Math.log(Math.tan(Math.PI/4+n/2)),N=Math.log((1+M*o)/(1-M*o));this.K=S-this.alpha*D+this.alpha*M/2*N}function Mx(n){var o=Math.log(Math.tan(Math.PI/4-n.y/2)),h=this.e/2*Math.log((1+this.e*Math.sin(n.y))/(1-this.e*Math.sin(n.y))),g=-this.alpha*(o+h)+this.K,_=2*(Math.atan(Math.exp(g))-Math.PI/4),a=this.alpha*(n.x-this.lambda0),M=Math.atan(Math.sin(a)/(Math.sin(this.b0)*Math.tan(_)+Math.cos(this.b0)*Math.cos(a))),S=Math.asin(Math.cos(this.b0)*Math.sin(_)-Math.sin(this.b0)*Math.cos(_)*Math.cos(a));return n.y=this.R/2*Math.log((1+Math.sin(S))/(1-Math.sin(S)))+this.y0,n.x=this.R*M+this.x0,n}function Sx(n){for(var o=n.x-this.x0,h=n.y-this.y0,g=o/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(g)),M=Math.atan(Math.sin(g)/(Math.cos(this.b0)*Math.cos(g)-Math.sin(this.b0)*Math.tan(_))),S=this.lambda0+M/this.alpha,D=0,N=a,L=-1e3,Q=0;Math.abs(N-L)>1e-7;){if(++Q>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 n.x=S,n.y=N,n}var Tx=["somerc"],Pm={init:wx,forward:Mx,inverse:Sx,names:Tx};W();var Io=1e-7;function Ex(n){var o=["Hotine_Oblique_Mercator","Hotine_Oblique_Mercator_Azimuth_Natural_Origin"],h=typeof n.PROJECTION=="object"?Object.keys(n.PROJECTION)[0]:n.PROJECTION;return"no_uoff"in n||"no_off"in n||o.indexOf(h)!==-1}function Ix(){var n,o,h,g,_,a,M,S,D,N,L=0,Q,pt=0,ot=0,ft=0,Rt=0,Ct=0,Dt=0,ne;this.no_off=Ex(this),this.no_rot="no_rot"in this;var Ht=!1;"alpha"in this&&(Ht=!0);var fe=!1;if("rectified_grid_angle"in this&&(fe=!0),Ht&&(Dt=this.alpha),fe&&(L=this.rectified_grid_angle*Ci),Ht||fe)pt=this.longc;else if(ot=this.long1,Rt=this.lat1,ft=this.long2,Ct=this.lat2,Math.abs(Rt-Ct)<=Io||(n=Math.abs(Rt))<=Io||Math.abs(n-Nt)<=Io||Math.abs(Math.abs(this.lat0)-Nt)<=Io||Math.abs(Math.abs(Ct)-Nt)<=Io)throw new Error;var me=1-this.es;o=Math.sqrt(me),Math.abs(this.lat0)>jt?(S=Math.sin(this.lat0),h=Math.cos(this.lat0),n=1-this.es*S*S,this.B=h*h,this.B=Math.sqrt(1+this.es*this.B*this.B/me),this.A=this.B*this.k0*o/n,g=this.B*o/(h*Math.sqrt(n)),_=g*g-1,_<=0?_=0:(_=Math.sqrt(_),this.lat0<0&&(_=-_)),this.E=_+=g,this.E*=Math.pow(Ar(this.e,this.lat0,S),this.B)):(this.B=1/o,this.A=this.k0,this.E=g=_=1),Ht||fe?(Ht?(Q=Math.asin(Math.sin(Dt)/g),fe||(L=Dt)):(Q=L,Dt=Math.asin(g*Math.sin(Q))),this.lam0=pt-Math.asin(.5*(_-1/_)*Math.tan(Q))/this.B):(a=Math.pow(Ar(this.e,Rt,Math.sin(Rt)),this.B),M=Math.pow(Ar(this.e,Ct,Math.sin(Ct)),this.B),_=this.E/a,D=(M-a)/(M+a),N=this.E*this.E,N=(N-M*a)/(N+M*a),n=ot-ft,n<-Math.pi?ft-=qs:n>Math.pi&&(ft+=qs),this.lam0=Wt(.5*(ot+ft)-Math.atan(N*Math.tan(.5*this.B*(ot-ft))/D)/this.B),Q=Math.atan(2*Math.sin(this.B*Wt(ot-this.lam0))/(_-1/_)),L=Dt=Math.asin(g*Math.sin(Q))),this.singam=Math.sin(Q),this.cosgam=Math.cos(Q),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,ne=this.A*this.B,this.no_off?this.u_0=0:(this.u_0=Math.abs(this.ArB*Math.atan(Math.sqrt(g*g-1)/Math.cos(Dt))),this.lat0<0&&(this.u_0=-this.u_0)),_=.5*Q,this.v_pole_n=this.ArB*Math.log(Math.tan(He-_)),this.v_pole_s=this.ArB*Math.log(Math.tan(He+_))}function Cx(n){var o={},h,g,_,a,M,S,D,N;if(n.x=n.x-this.lam0,Math.abs(Math.abs(n.y)-Nt)>jt){if(M=this.E/Math.pow(Ar(this.e,n.y,Math.sin(n.y)),this.B),S=1/M,h=.5*(M-S),g=.5*(M+S),a=Math.sin(this.B*n.x),_=(h*this.singam-a*this.cosgam)/g,Math.abs(Math.abs(_)-1)<jt)throw new Error;N=.5*this.ArB*Math.log((1-_)/(1+_)),S=Math.cos(this.B*n.x),Math.abs(S)<Io?D=this.A*n.x:D=this.ArB*Math.atan2(h*this.cosgam+a*this.singam,S)}else N=n.y>0?this.v_pole_n:this.v_pole_s,D=this.ArB*n.y;return this.no_rot?(o.x=D,o.y=N):(D-=this.u_0,o.x=N*this.cosrot+D*this.sinrot,o.y=D*this.cosrot-N*this.sinrot),o.x=this.a*o.x+this.x0,o.y=this.a*o.y+this.y0,o}function Ax(n){var o,h,g,_,a,M,S,D={};if(n.x=(n.x-this.x0)*(1/this.a),n.y=(n.y-this.y0)*(1/this.a),this.no_rot?(h=n.y,o=n.x):(h=n.x*this.cosrot-n.y*this.sinrot,o=n.y*this.cosrot+n.x*this.sinrot+this.u_0),g=Math.exp(-this.BrA*h),_=.5*(g-1/g),a=.5*(g+1/g),M=Math.sin(this.BrA*o),S=(M*this.cosgam+_*this.singam)/a,Math.abs(Math.abs(S)-1)<jt)D.x=0,D.y=S<0?-Nt:Nt;else{if(D.y=this.E/Math.sqrt((1+S)/(1-S)),D.y=ls(this.e,Math.pow(D.y,1/this.B)),D.y===1/0)throw new Error;D.x=-this.rB*Math.atan2(_*this.cosgam-M*this.singam,Math.cos(this.BrA*o))}return D.x+=this.lam0,D}var Px=["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"],zm={init:Ix,forward:Cx,inverse:Ax,names:Px};W();function zx(){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)<jt)){var n=this.b/this.a;this.e=Math.sqrt(1-n*n);var o=Math.sin(this.lat1),h=Math.cos(this.lat1),g=fr(this.e,o,h),_=Ar(this.e,this.lat1,o),a=Math.sin(this.lat2),M=Math.cos(this.lat2),S=fr(this.e,a,M),D=Ar(this.e,this.lat2,a),N=Ar(this.e,this.lat0,Math.sin(this.lat0));Math.abs(this.lat1-this.lat2)>jt?this.ns=Math.log(g/S)/Math.log(_/D):this.ns=o,isNaN(this.ns)&&(this.ns=o),this.f0=g/(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 kx(n){var o=n.x,h=n.y;Math.abs(2*Math.abs(h)-Math.PI)<=jt&&(h=zn(h)*(Nt-2*jt));var g=Math.abs(Math.abs(h)-Nt),_,a;if(g>jt)_=Ar(this.e,h,Math.sin(h)),a=this.a*this.f0*Math.pow(_,this.ns);else{if(g=h*this.ns,g<=0)return null;a=0}var M=this.ns*Wt(o-this.long0);return n.x=this.k0*(a*Math.sin(M))+this.x0,n.y=this.k0*(this.rh-a*Math.cos(M))+this.y0,n}function Lx(n){var o,h,g,_,a,M=(n.x-this.x0)/this.k0,S=this.rh-(n.y-this.y0)/this.k0;this.ns>0?(o=Math.sqrt(M*M+S*S),h=1):(o=-Math.sqrt(M*M+S*S),h=-1);var D=0;if(o!==0&&(D=Math.atan2(h*M,h*S)),o!==0||this.ns>0){if(h=1/this.ns,g=Math.pow(o/(this.a*this.f0),h),_=ls(this.e,g),_===-9999)return null}else _=-Nt;return a=Wt(D/this.ns+this.long0),n.x=a,n.y=_,n}var Dx=["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)"],km={init:zx,forward:kx,inverse:Lx,names:Dx};W();function Rx(){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 Bx(n){var o,h,g,_,a,M,S,D=n.x,N=n.y,L=Wt(D-this.long0);return o=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)/o)-this.s45),g=-L*this.alfa,_=Math.asin(Math.cos(this.ad)*Math.sin(h)+Math.sin(this.ad)*Math.cos(h)*Math.cos(g)),a=Math.asin(Math.cos(h)*Math.sin(g)/Math.cos(_)),M=this.n*a,S=this.ro0*Math.pow(Math.tan(this.s0/2+this.s45),this.n)/Math.pow(Math.tan(_/2+this.s45),this.n),n.y=S*Math.cos(M)/1,n.x=S*Math.sin(M)/1,this.czech||(n.y*=-1,n.x*=-1),n}function Fx(n){var o,h,g,_,a,M,S,D,N=n.x;n.x=n.y,n.y=N,this.czech||(n.y*=-1,n.x*=-1),M=Math.sqrt(n.x*n.x+n.y*n.y),a=Math.atan2(n.y,n.x),_=a/Math.sin(this.s0),g=2*(Math.atan(Math.pow(this.ro0/M,1/this.n)*Math.tan(this.s0/2+this.s45))-this.s45),o=Math.asin(Math.cos(this.ad)*Math.sin(g)-Math.sin(this.ad)*Math.cos(g)*Math.cos(_)),h=Math.asin(Math.cos(g)*Math.sin(_)/Math.cos(o)),n.x=this.long0-h/this.alfa,S=o,D=0;var L=0;do n.y=2*(Math.atan(Math.pow(this.k,-1/this.alfa)*Math.pow(Math.tan(o/2+this.s45),1/this.alfa)*Math.pow((1+this.e*Math.sin(S))/(1-this.e*Math.sin(S)),this.e/2))-this.s45),Math.abs(S-n.y)<1e-10&&(D=1),S=n.y,L+=1;while(D===0&&L<15);return L>=15?null:n}var Ox=["Krovak","krovak"],Lm={init:Rx,forward:Bx,inverse:Fx,names:Ox};W();W();function Ji(n,o,h,g,_){return n*_-o*Math.sin(2*_)+h*Math.sin(4*_)-g*Math.sin(6*_)}W();function hs(n){return 1-.25*n*(1+n/16*(3+1.25*n))}W();function cs(n){return .375*n*(1+.25*n*(1+.46875*n))}W();function us(n){return .05859375*n*n*(1+.75*n)}W();function ps(n){return n*n*n*(35/3072)}W();function ds(n,o,h){var g=o*h;return n/Math.sqrt(1-g*g)}W();function Sn(n){return Math.abs(n)<Nt?n:n-zn(n)*Math.PI}W();function Sa(n,o,h,g,_){var a,M;a=n/o;for(var S=0;S<15;S++)if(M=(n-(o*a-h*Math.sin(2*a)+g*Math.sin(4*a)-_*Math.sin(6*a)))/(o-2*h*Math.cos(2*a)+4*g*Math.cos(4*a)-6*_*Math.cos(6*a)),a+=M,Math.abs(M)<=1e-10)return a;return NaN}function Nx(){this.sphere||(this.e0=hs(this.es),this.e1=cs(this.es),this.e2=us(this.es),this.e3=ps(this.es),this.ml0=this.a*Ji(this.e0,this.e1,this.e2,this.e3,this.lat0))}function Ux(n){var o,h,g=n.x,_=n.y;if(g=Wt(g-this.long0),this.sphere)o=this.a*Math.asin(Math.cos(_)*Math.sin(g)),h=this.a*(Math.atan2(Math.tan(_),Math.cos(g))-this.lat0);else{var a=Math.sin(_),M=Math.cos(_),S=ds(this.a,this.e,a),D=Math.tan(_)*Math.tan(_),N=g*Math.cos(_),L=N*N,Q=this.es*M*M/(1-this.es),pt=this.a*Ji(this.e0,this.e1,this.e2,this.e3,_);o=S*N*(1-L*D*(1/6-(8-D+8*Q)*L/120)),h=pt-this.ml0+S*a/M*L*(.5+(5-D+6*Q)*L/24)}return n.x=o+this.x0,n.y=h+this.y0,n}function Vx(n){n.x-=this.x0,n.y-=this.y0;var o=n.x/this.a,h=n.y/this.a,g,_;if(this.sphere){var a=h+this.lat0;g=Math.asin(Math.sin(a)*Math.cos(o)),_=Math.atan2(Math.tan(o),Math.cos(a))}else{var M=this.ml0/this.a+h,S=Sa(M,this.e0,this.e1,this.e2,this.e3);if(Math.abs(Math.abs(S)-Nt)<=jt)return n.x=this.long0,n.y=Nt,h<0&&(n.y*=-1),n;var D=ds(this.a,this.e,Math.sin(S)),N=D*D*D/this.a/this.a*(1-this.es),L=Math.pow(Math.tan(S),2),Q=o*this.a/D,pt=Q*Q;g=S-D*Math.tan(S)/N*Q*Q*(.5-(1+3*L)*Q*Q/24),_=Q*(1-pt*(L/3+(1+3*L)*L*pt/15))/Math.cos(S)}return n.x=Wt(_+this.long0),n.y=Sn(g),n}var Gx=["Cassini","Cassini_Soldner","cass"],Dm={init:Nx,forward:Ux,inverse:Vx,names:Gx};W();W();function Tn(n,o){var h;return n>1e-7?(h=n*o,(1-n*n)*(o/(1-h*h)-.5/n*Math.log((1-h)/(1+h)))):2*o}var qx=1,jx=2,$x=3,Wx=4;function Zx(){var n=Math.abs(this.lat0);if(Math.abs(n-Nt)<jt?this.mode=this.lat0<0?this.S_POLE:this.N_POLE:Math.abs(n)<jt?this.mode=this.EQUIT:this.mode=this.OBLIQ,this.es>0){var o;switch(this.qp=Tn(this.e,1),this.mmf=.5/(1-this.es),this.apa=iv(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),o=Math.sin(this.lat0),this.sinb1=Tn(this.e,o)/this.qp,this.cosb1=Math.sqrt(1-this.sinb1*this.sinb1),this.dd=Math.cos(this.lat0)/(Math.sqrt(1-this.es*o*o)*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 Hx(n){var o,h,g,_,a,M,S,D,N,L,Q=n.x,pt=n.y;if(Q=Wt(Q-this.long0),this.sphere){if(a=Math.sin(pt),L=Math.cos(pt),g=Math.cos(Q),this.mode===this.OBLIQ||this.mode===this.EQUIT){if(h=this.mode===this.EQUIT?1+L*g:1+this.sinph0*a+this.cosph0*L*g,h<=jt)return null;h=Math.sqrt(2/h),o=h*L*Math.sin(Q),h*=this.mode===this.EQUIT?a:this.cosph0*a-this.sinph0*L*g}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(g=-g),Math.abs(pt+this.lat0)<jt)return null;h=He-pt*.5,h=2*(this.mode===this.S_POLE?Math.cos(h):Math.sin(h)),o=h*Math.sin(Q),h*=g}}else{switch(S=0,D=0,N=0,g=Math.cos(Q),_=Math.sin(Q),a=Math.sin(pt),M=Tn(this.e,a),(this.mode===this.OBLIQ||this.mode===this.EQUIT)&&(S=M/this.qp,D=Math.sqrt(1-S*S)),this.mode){case this.OBLIQ:N=1+this.sinb1*S+this.cosb1*D*g;break;case this.EQUIT:N=1+D*g;break;case this.N_POLE:N=Nt+pt,M=this.qp-M;break;case this.S_POLE:N=pt-Nt,M=this.qp+M;break}if(Math.abs(N)<jt)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*S-this.sinb1*D*g):h=(N=Math.sqrt(2/(1+D*g)))*S*this.ymf,o=this.xmf*N*D*_;break;case this.N_POLE:case this.S_POLE:M>=0?(o=(N=Math.sqrt(M))*_,h=g*(this.mode===this.S_POLE?N:-N)):o=h=0;break}}return n.x=this.a*o+this.x0,n.y=this.a*h+this.y0,n}function Xx(n){n.x-=this.x0,n.y-=this.y0;var o=n.x/this.a,h=n.y/this.a,g,_,a,M,S,D,N;if(this.sphere){var L=0,Q,pt=0;if(Q=Math.sqrt(o*o+h*h),_=Q*.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(Q)<=jt?0:Math.asin(h*pt/Q),o*=pt,h=L*Q;break;case this.OBLIQ:_=Math.abs(Q)<=jt?this.lat0:Math.asin(L*this.sinph0+h*pt*this.cosph0/Q),o*=pt*this.cosph0,h=(L-Math.sin(_)*this.sinph0)*Q;break;case this.N_POLE:h=-h,_=Nt-_;break;case this.S_POLE:_-=Nt;break}g=h===0&&(this.mode===this.EQUIT||this.mode===this.OBLIQ)?0:Math.atan2(o,h)}else{if(N=0,this.mode===this.OBLIQ||this.mode===this.EQUIT){if(o/=this.dd,h*=this.dd,D=Math.sqrt(o*o+h*h),D<jt)return n.x=this.long0,n.y=this.lat0,n;M=2*Math.asin(.5*D/this.rq),a=Math.cos(M),o*=M=Math.sin(M),this.mode===this.OBLIQ?(N=a*this.sinb1+h*M*this.cosb1/D,S=this.qp*N,h=D*this.cosb1*a-h*this.sinb1*M):(N=h*M/D,S=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),S=o*o+h*h,!S)return n.x=this.long0,n.y=this.lat0,n;N=1-S/this.qp,this.mode===this.S_POLE&&(N=-N)}g=Math.atan2(o,h),_=rv(Math.asin(N),this.apa)}return n.x=Wt(this.long0+g),n.y=_,n}var Kx=.3333333333333333,Jx=.17222222222222222,Yx=.10257936507936508,Qx=.06388888888888888,tv=.0664021164021164,ev=.016415012942191543;function iv(n){var o,h=[];return h[0]=n*Kx,o=n*n,h[0]+=o*Jx,h[1]=o*Qx,o*=n,h[0]+=o*Yx,h[1]+=o*tv,h[2]=o*ev,h}function rv(n,o){var h=n+n;return n+o[0]*Math.sin(h)+o[1]*Math.sin(h+h)+o[2]*Math.sin(h+h+h)}var nv=["Lambert Azimuthal Equal Area","Lambert_Azimuthal_Equal_Area","laea"],Rm={init:Zx,forward:Hx,inverse:Xx,names:nv,S_POLE:qx,N_POLE:jx,EQUIT:$x,OBLIQ:Wx};W();W();function jr(n){return Math.abs(n)>1&&(n=n>1?1:-1),Math.asin(n)}function sv(){Math.abs(this.lat1+this.lat2)<jt||(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=fr(this.e3,this.sin_po,this.cos_po),this.qs1=Tn(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=fr(this.e3,this.sin_po,this.cos_po),this.qs2=Tn(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=Tn(this.e3,this.sin_po,this.cos_po),Math.abs(this.lat1-this.lat2)>jt?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 av(n){var o=n.x,h=n.y;this.sin_phi=Math.sin(h),this.cos_phi=Math.cos(h);var g=Tn(this.e3,this.sin_phi,this.cos_phi),_=this.a*Math.sqrt(this.c-this.ns0*g)/this.ns0,a=this.ns0*Wt(o-this.long0),M=_*Math.sin(a)+this.x0,S=this.rh-_*Math.cos(a)+this.y0;return n.x=M,n.y=S,n}function ov(n){var o,h,g,_,a,M;return n.x-=this.x0,n.y=this.rh-n.y+this.y0,this.ns0>=0?(o=Math.sqrt(n.x*n.x+n.y*n.y),g=1):(o=-Math.sqrt(n.x*n.x+n.y*n.y),g=-1),_=0,o!==0&&(_=Math.atan2(g*n.x,g*n.y)),g=o*this.ns0/this.a,this.sphere?M=Math.asin((this.c-g*g)/(2*this.ns0)):(h=(this.c-g*g)/this.ns0,M=this.phi1z(this.e3,h)),a=Wt(_/this.ns0+this.long0),n.x=a,n.y=M,n}function lv(n,o){var h,g,_,a,M,S=jr(.5*o);if(n<jt)return S;for(var D=n*n,N=1;N<=25;N++)if(h=Math.sin(S),g=Math.cos(S),_=n*h,a=1-_*_,M=.5*a*a/g*(o/(1-D)-h/a+.5/n*Math.log((1-_)/(1+_))),S=S+M,Math.abs(M)<=1e-7)return S;return null}var hv=["Albers_Conic_Equal_Area","Albers","aea"],Bm={init:sv,forward:av,inverse:ov,names:hv,phi1z:lv};W();function cv(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0),this.infinity_dist=1e3*this.a,this.rc=1}function uv(n){var o,h,g,_,a,M,S,D,N=n.x,L=n.y;return g=Wt(N-this.long0),o=Math.sin(L),h=Math.cos(L),_=Math.cos(g),M=this.sin_p14*o+this.cos_p14*h*_,a=1,M>0||Math.abs(M)<=jt?(S=this.x0+this.a*a*h*Math.sin(g)/M,D=this.y0+this.a*a*(this.cos_p14*o-this.sin_p14*h*_)/M):(S=this.x0+this.infinity_dist*h*Math.sin(g),D=this.y0+this.infinity_dist*(this.cos_p14*o-this.sin_p14*h*_)),n.x=S,n.y=D,n}function pv(n){var o,h,g,_,a,M;return n.x=(n.x-this.x0)/this.a,n.y=(n.y-this.y0)/this.a,n.x/=this.k0,n.y/=this.k0,(o=Math.sqrt(n.x*n.x+n.y*n.y))?(_=Math.atan2(o,this.rc),h=Math.sin(_),g=Math.cos(_),M=jr(g*this.sin_p14+n.y*h*this.cos_p14/o),a=Math.atan2(n.x*h,o*this.cos_p14*g-n.y*this.sin_p14*h),a=Wt(this.long0+a)):(M=this.phic0,a=0),n.x=a,n.y=M,n}var dv=["gnom"],Fm={init:cv,forward:uv,inverse:pv,names:dv};W();W();function Om(n,o){var h=1-(1-n*n)/(2*n)*Math.log((1-n)/(1+n));if(Math.abs(Math.abs(o)-h)<1e-6)return o<0?-1*Nt:Nt;for(var g=Math.asin(.5*o),_,a,M,S,D=0;D<30;D++)if(a=Math.sin(g),M=Math.cos(g),S=n*a,_=Math.pow(1-S*S,2)/(2*M)*(o/(1-n*n)-a/(1-S*S)+.5/n*Math.log((1-S)/(1+S))),g+=_,Math.abs(_)<=1e-10)return g;return NaN}function fv(){this.sphere||(this.k0=fr(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)))}function mv(n){var o=n.x,h=n.y,g,_,a=Wt(o-this.long0);if(this.sphere)g=this.x0+this.a*a*Math.cos(this.lat_ts),_=this.y0+this.a*Math.sin(h)/Math.cos(this.lat_ts);else{var M=Tn(this.e,Math.sin(h));g=this.x0+this.a*this.k0*a,_=this.y0+this.a*M*.5/this.k0}return n.x=g,n.y=_,n}function gv(n){n.x-=this.x0,n.y-=this.y0;var o,h;return this.sphere?(o=Wt(this.long0+n.x/this.a/Math.cos(this.lat_ts)),h=Math.asin(n.y/this.a*Math.cos(this.lat_ts))):(h=Om(this.e,2*n.y*this.k0/this.a),o=Wt(this.long0+n.x/(this.a*this.k0))),n.x=o,n.y=h,n}var yv=["cea"],Nm={init:fv,forward:mv,inverse:gv,names:yv};W();function _v(){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 xv(n){var o=n.x,h=n.y,g=Wt(o-this.long0),_=Sn(h-this.lat0);return n.x=this.x0+this.a*g*this.rc,n.y=this.y0+this.a*_,n}function vv(n){var o=n.x,h=n.y;return n.x=Wt(this.long0+(o-this.x0)/(this.a*this.rc)),n.y=Sn(this.lat0+(h-this.y0)/this.a),n}var bv=["Equirectangular","Equidistant_Cylindrical","eqc"],Um={init:_v,forward:xv,inverse:vv,names:bv};W();var Vm=20;function wv(){this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e=Math.sqrt(this.es),this.e0=hs(this.es),this.e1=cs(this.es),this.e2=us(this.es),this.e3=ps(this.es),this.ml0=this.a*Ji(this.e0,this.e1,this.e2,this.e3,this.lat0)}function Mv(n){var o=n.x,h=n.y,g,_,a,M=Wt(o-this.long0);if(a=M*Math.sin(h),this.sphere)Math.abs(h)<=jt?(g=this.a*M,_=-1*this.a*this.lat0):(g=this.a*Math.sin(a)/Math.tan(h),_=this.a*(Sn(h-this.lat0)+(1-Math.cos(a))/Math.tan(h)));else if(Math.abs(h)<=jt)g=this.a*M,_=-1*this.ml0;else{var S=ds(this.a,this.e,Math.sin(h))/Math.tan(h);g=S*Math.sin(a),_=this.a*Ji(this.e0,this.e1,this.e2,this.e3,h)-this.ml0+S*(1-Math.cos(a))}return n.x=g+this.x0,n.y=_+this.y0,n}function Sv(n){var o,h,g,_,a,M,S,D,N;if(g=n.x-this.x0,_=n.y-this.y0,this.sphere)if(Math.abs(_+this.a*this.lat0)<=jt)o=Wt(g/this.a+this.long0),h=0;else{M=this.lat0+_/this.a,S=g*g/this.a/this.a+M*M,D=M;var L;for(a=Vm;a;--a)if(L=Math.tan(D),N=-1*(M*(D*L+1)-D-.5*(D*D+S)*L)/((D-M)/L-1),D+=N,Math.abs(N)<=jt){h=D;break}o=Wt(this.long0+Math.asin(g*Math.tan(D)/this.a)/Math.sin(h))}else if(Math.abs(_+this.ml0)<=jt)h=0,o=Wt(this.long0+g/this.a);else{M=(this.ml0+_)/this.a,S=g*g/this.a/this.a+M*M,D=M;var Q,pt,ot,ft,Rt;for(a=Vm;a;--a)if(Rt=this.e*Math.sin(D),Q=Math.sqrt(1-Rt*Rt)*Math.tan(D),pt=this.a*Ji(this.e0,this.e1,this.e2,this.e3,D),ot=this.e0-2*this.e1*Math.cos(2*D)+4*this.e2*Math.cos(4*D)-6*this.e3*Math.cos(6*D),ft=pt/this.a,N=(M*(Q*ft+1)-ft-.5*Q*(ft*ft+S))/(this.es*Math.sin(2*D)*(ft*ft+S-2*M*ft)/(4*Q)+(M-ft)*(Q*ot-2/Math.sin(2*D))-ot),D-=N,Math.abs(N)<=jt){h=D;break}Q=Math.sqrt(1-this.es*Math.pow(Math.sin(h),2))*Math.tan(h),o=Wt(this.long0+Math.asin(g*Q/this.a)/Math.sin(h))}return n.x=o,n.y=h,n}var Tv=["Polyconic","poly"],Gm={init:wv,forward:Mv,inverse:Sv,names:Tv};W();function Ev(){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 Iv(n){var o,h=n.x,g=n.y,_=g-this.lat0,a=h-this.long0,M=_/va*1e-5,S=a,D=1,N=0;for(o=1;o<=10;o++)D=D*M,N=N+this.A[o]*D;var L=N,Q=S,pt=1,ot=0,ft,Rt,Ct=0,Dt=0;for(o=1;o<=6;o++)ft=pt*L-ot*Q,Rt=ot*L+pt*Q,pt=ft,ot=Rt,Ct=Ct+this.B_re[o]*pt-this.B_im[o]*ot,Dt=Dt+this.B_im[o]*pt+this.B_re[o]*ot;return n.x=Dt*this.a+this.x0,n.y=Ct*this.a+this.y0,n}function Cv(n){var o,h=n.x,g=n.y,_=h-this.x0,a=g-this.y0,M=a/this.a,S=_/this.a,D=1,N=0,L,Q,pt=0,ot=0;for(o=1;o<=6;o++)L=D*M-N*S,Q=N*M+D*S,D=L,N=Q,pt=pt+this.C_re[o]*D-this.C_im[o]*N,ot=ot+this.C_im[o]*D+this.C_re[o]*N;for(var ft=0;ft<this.iterations;ft++){var Rt=pt,Ct=ot,Dt,ne,Ht=M,fe=S;for(o=2;o<=6;o++)Dt=Rt*pt-Ct*ot,ne=Ct*pt+Rt*ot,Rt=Dt,Ct=ne,Ht=Ht+(o-1)*(this.B_re[o]*Rt-this.B_im[o]*Ct),fe=fe+(o-1)*(this.B_im[o]*Rt+this.B_re[o]*Ct);Rt=1,Ct=0;var me=this.B_re[1],oe=this.B_im[1];for(o=2;o<=6;o++)Dt=Rt*pt-Ct*ot,ne=Ct*pt+Rt*ot,Rt=Dt,Ct=ne,me=me+o*(this.B_re[o]*Rt-this.B_im[o]*Ct),oe=oe+o*(this.B_im[o]*Rt+this.B_re[o]*Ct);var Ce=me*me+oe*oe;pt=(Ht*me+fe*oe)/Ce,ot=(fe*me-Ht*oe)/Ce}var Re=pt,mi=ot,Fi=1,Yi=0;for(o=1;o<=9;o++)Fi=Fi*Re,Yi=Yi+this.D[o]*Fi;var Oi=this.lat0+Yi*va*1e5,$r=this.long0+mi;return n.x=$r,n.y=Oi,n}var Av=["New_Zealand_Map_Grid","nzmg"],qm={init:Ev,forward:Iv,inverse:Cv,names:Av};W();function Pv(){}function zv(n){var o=n.x,h=n.y,g=Wt(o-this.long0),_=this.x0+this.a*g,a=this.y0+this.a*Math.log(Math.tan(Math.PI/4+h/2.5))*1.25;return n.x=_,n.y=a,n}function kv(n){n.x-=this.x0,n.y-=this.y0;var o=Wt(this.long0+n.x/this.a),h=2.5*(Math.atan(Math.exp(.8*n.y/this.a))-Math.PI/4);return n.x=o,n.y=h,n}var Lv=["Miller_Cylindrical","mill"],jm={init:Pv,forward:zv,inverse:kv,names:Lv};W();var Dv=20;function Rv(){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=mc(this.es)}function Bv(n){var o,h,g=n.x,_=n.y;if(g=Wt(g-this.long0),this.sphere){if(!this.m)_=this.n!==1?Math.asin(this.n*Math.sin(_)):_;else for(var a=this.n*Math.sin(_),M=Dv;M;--M){var S=(this.m*_+Math.sin(_)-a)/(this.m+Math.cos(_));if(_-=S,Math.abs(S)<jt)break}o=this.a*this.C_x*g*(this.m+Math.cos(_)),h=this.a*this.C_y*_}else{var D=Math.sin(_),N=Math.cos(_);h=this.a*Ma(_,D,N,this.en),o=this.a*g*N/Math.sqrt(1-this.es*D*D)}return n.x=o,n.y=h,n}function Fv(n){var o,h,g,_;return n.x-=this.x0,g=n.x/this.a,n.y-=this.y0,o=n.y/this.a,this.sphere?(o/=this.C_y,g=g/(this.C_x*(this.m+Math.cos(o))),this.m?o=jr((this.m*o+Math.sin(o))/this.n):this.n!==1&&(o=jr(Math.sin(o)/this.n)),g=Wt(g+this.long0),o=Sn(o)):(o=gc(n.y/this.a,this.es,this.en),_=Math.abs(o),_<Nt?(_=Math.sin(o),h=this.long0+n.x*Math.sqrt(1-this.es*_*_)/(this.a*Math.cos(o)),g=Wt(h)):_-jt<Nt&&(g=this.long0)),n.x=g,n.y=o,n}var Ov=["Sinusoidal","sinu"],$m={init:Rv,forward:Bv,inverse:Fv,names:Ov};W();function Nv(){}function Uv(n){for(var o=n.x,h=n.y,g=Wt(o-this.long0),_=h,a=Math.PI*Math.sin(h);;){var M=-(_+Math.sin(_)-a)/(1+Math.cos(_));if(_+=M,Math.abs(M)<jt)break}_/=2,Math.PI/2-Math.abs(h)<jt&&(g=0);var S=.900316316158*this.a*g*Math.cos(_)+this.x0,D=1.4142135623731*this.a*Math.sin(_)+this.y0;return n.x=S,n.y=D,n}function Vv(n){var o,h;n.x-=this.x0,n.y-=this.y0,h=n.y/(1.4142135623731*this.a),Math.abs(h)>.999999999999&&(h=.999999999999),o=Math.asin(h);var g=Wt(this.long0+n.x/(.900316316158*this.a*Math.cos(o)));g<-Math.PI&&(g=-Math.PI),g>Math.PI&&(g=Math.PI),h=(2*o+Math.sin(2*o))/Math.PI,Math.abs(h)>1&&(h=1);var _=Math.asin(h);return n.x=g,n.y=_,n}var Gv=["Mollweide","moll"],Wm={init:Nv,forward:Uv,inverse:Vv,names:Gv};W();function qv(){Math.abs(this.lat1+this.lat2)<jt||(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=hs(this.es),this.e1=cs(this.es),this.e2=us(this.es),this.e3=ps(this.es),this.sinphi=Math.sin(this.lat1),this.cosphi=Math.cos(this.lat1),this.ms1=fr(this.e,this.sinphi,this.cosphi),this.ml1=Ji(this.e0,this.e1,this.e2,this.e3,this.lat1),Math.abs(this.lat1-this.lat2)<jt?this.ns=this.sinphi:(this.sinphi=Math.sin(this.lat2),this.cosphi=Math.cos(this.lat2),this.ms2=fr(this.e,this.sinphi,this.cosphi),this.ml2=Ji(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=Ji(this.e0,this.e1,this.e2,this.e3,this.lat0),this.rh=this.a*(this.g-this.ml0))}function jv(n){var o=n.x,h=n.y,g;if(this.sphere)g=this.a*(this.g-h);else{var _=Ji(this.e0,this.e1,this.e2,this.e3,h);g=this.a*(this.g-_)}var a=this.ns*Wt(o-this.long0),M=this.x0+g*Math.sin(a),S=this.y0+this.rh-g*Math.cos(a);return n.x=M,n.y=S,n}function $v(n){n.x-=this.x0,n.y=this.rh-n.y+this.y0;var o,h,g,_;this.ns>=0?(h=Math.sqrt(n.x*n.x+n.y*n.y),o=1):(h=-Math.sqrt(n.x*n.x+n.y*n.y),o=-1);var a=0;if(h!==0&&(a=Math.atan2(o*n.x,o*n.y)),this.sphere)return _=Wt(this.long0+a/this.ns),g=Sn(this.g-h/this.a),n.x=_,n.y=g,n;var M=this.g-h/this.a;return g=Sa(M,this.e0,this.e1,this.e2,this.e3),_=Wt(this.long0+a/this.ns),n.x=_,n.y=g,n}var Wv=["Equidistant_Conic","eqdc"],Zm={init:qv,forward:jv,inverse:$v,names:Wv};W();function Zv(){this.R=this.a}function Hv(n){var o=n.x,h=n.y,g=Wt(o-this.long0),_,a;Math.abs(h)<=jt&&(_=this.x0+this.R*g,a=this.y0);var M=jr(2*Math.abs(h/Math.PI));(Math.abs(g)<=jt||Math.abs(Math.abs(h)-Nt)<=jt)&&(_=this.x0,h>=0?a=this.y0+Math.PI*this.R*Math.tan(.5*M):a=this.y0+Math.PI*this.R*-Math.tan(.5*M));var S=.5*Math.abs(Math.PI/g-g/Math.PI),D=S*S,N=Math.sin(M),L=Math.cos(M),Q=L/(N+L-1),pt=Q*Q,ot=Q*(2/N-1),ft=ot*ot,Rt=Math.PI*this.R*(S*(Q-ft)+Math.sqrt(D*(Q-ft)*(Q-ft)-(ft+D)*(pt-ft)))/(ft+D);g<0&&(Rt=-Rt),_=this.x0+Rt;var Ct=D+Q;return Rt=Math.PI*this.R*(ot*Ct-S*Math.sqrt((ft+D)*(D+1)-Ct*Ct))/(ft+D),h>=0?a=this.y0+Rt:a=this.y0-Rt,n.x=_,n.y=a,n}function Xv(n){var o,h,g,_,a,M,S,D,N,L,Q,pt,ot;return n.x-=this.x0,n.y-=this.y0,Q=Math.PI*this.R,g=n.x/Q,_=n.y/Q,a=g*g+_*_,M=-Math.abs(_)*(1+a),S=M-2*_*_+g*g,D=-2*M+1+2*_*_+a*a,ot=_*_/D+(2*S*S*S/D/D/D-9*M*S/D/D)/27,N=(M-S*S/3/D)/D,L=2*Math.sqrt(-N/3),Q=3*ot/N/L,Math.abs(Q)>1&&(Q>=0?Q=1:Q=-1),pt=Math.acos(Q)/3,n.y>=0?h=(-L*Math.cos(pt+Math.PI/3)-S/3/D)*Math.PI:h=-(-L*Math.cos(pt+Math.PI/3)-S/3/D)*Math.PI,Math.abs(g)<jt?o=this.long0:o=Wt(this.long0+Math.PI*(a-1+Math.sqrt(1+2*(g*g-_*_)+a*a))/2/g),n.x=o,n.y=h,n}var Kv=["Van_der_Grinten_I","VanDerGrinten","vandg"],Hm={init:Zv,forward:Hv,inverse:Xv,names:Kv};W();function Jv(){this.sin_p12=Math.sin(this.lat0),this.cos_p12=Math.cos(this.lat0)}function Yv(n){var o=n.x,h=n.y,g=Math.sin(n.y),_=Math.cos(n.y),a=Wt(o-this.long0),M,S,D,N,L,Q,pt,ot,ft,Rt,Ct,Dt,ne,Ht,fe,me,oe,Ce,Re,mi,Fi,Yi,Oi;return this.sphere?Math.abs(this.sin_p12-1)<=jt?(n.x=this.x0+this.a*(Nt-h)*Math.sin(a),n.y=this.y0-this.a*(Nt-h)*Math.cos(a),n):Math.abs(this.sin_p12+1)<=jt?(n.x=this.x0+this.a*(Nt+h)*Math.sin(a),n.y=this.y0+this.a*(Nt+h)*Math.cos(a),n):(Ce=this.sin_p12*g+this.cos_p12*_*Math.cos(a),me=Math.acos(Ce),oe=me?me/Math.sin(me):1,n.x=this.x0+this.a*oe*_*Math.sin(a),n.y=this.y0+this.a*oe*(this.cos_p12*g-this.sin_p12*_*Math.cos(a)),n):(M=hs(this.es),S=cs(this.es),D=us(this.es),N=ps(this.es),Math.abs(this.sin_p12-1)<=jt?(L=this.a*Ji(M,S,D,N,Nt),Q=this.a*Ji(M,S,D,N,h),n.x=this.x0+(L-Q)*Math.sin(a),n.y=this.y0-(L-Q)*Math.cos(a),n):Math.abs(this.sin_p12+1)<=jt?(L=this.a*Ji(M,S,D,N,Nt),Q=this.a*Ji(M,S,D,N,h),n.x=this.x0+(L+Q)*Math.sin(a),n.y=this.y0+(L+Q)*Math.cos(a),n):(pt=g/_,ot=ds(this.a,this.e,this.sin_p12),ft=ds(this.a,this.e,g),Rt=Math.atan((1-this.es)*pt+this.es*ot*this.sin_p12/(ft*_)),Ct=Math.atan2(Math.sin(a),this.cos_p12*Math.tan(Rt)-this.sin_p12*Math.cos(a)),Ct===0?Re=Math.asin(this.cos_p12*Math.sin(Rt)-this.sin_p12*Math.cos(Rt)):Math.abs(Math.abs(Ct)-Math.PI)<=jt?Re=-Math.asin(this.cos_p12*Math.sin(Rt)-this.sin_p12*Math.cos(Rt)):Re=Math.asin(Math.sin(a)*Math.cos(Rt)/Math.sin(Ct)),Dt=this.e*this.sin_p12/Math.sqrt(1-this.es),ne=this.e*this.cos_p12*Math.cos(Ct)/Math.sqrt(1-this.es),Ht=Dt*ne,fe=ne*ne,mi=Re*Re,Fi=mi*Re,Yi=Fi*Re,Oi=Yi*Re,me=ot*Re*(1-mi*fe*(1-fe)/6+Fi/8*Ht*(1-2*fe)+Yi/120*(fe*(4-7*fe)-3*Dt*Dt*(1-7*fe))-Oi/48*Ht),n.x=this.x0+me*Math.sin(Ct),n.y=this.y0+me*Math.cos(Ct),n))}function Qv(n){n.x-=this.x0,n.y-=this.y0;var o,h,g,_,a,M,S,D,N,L,Q,pt,ot,ft,Rt,Ct,Dt,ne,Ht,fe,me,oe,Ce,Re;return this.sphere?(o=Math.sqrt(n.x*n.x+n.y*n.y),o>2*Nt*this.a?void 0:(h=o/this.a,g=Math.sin(h),_=Math.cos(h),a=this.long0,Math.abs(o)<=jt?M=this.lat0:(M=jr(_*this.sin_p12+n.y*g*this.cos_p12/o),S=Math.abs(this.lat0)-Nt,Math.abs(S)<=jt?this.lat0>=0?a=Wt(this.long0+Math.atan2(n.x,-n.y)):a=Wt(this.long0-Math.atan2(-n.x,n.y)):a=Wt(this.long0+Math.atan2(n.x*g,o*this.cos_p12*_-n.y*this.sin_p12*g))),n.x=a,n.y=M,n)):(D=hs(this.es),N=cs(this.es),L=us(this.es),Q=ps(this.es),Math.abs(this.sin_p12-1)<=jt?(pt=this.a*Ji(D,N,L,Q,Nt),o=Math.sqrt(n.x*n.x+n.y*n.y),ot=pt-o,M=Sa(ot/this.a,D,N,L,Q),a=Wt(this.long0+Math.atan2(n.x,-1*n.y)),n.x=a,n.y=M,n):Math.abs(this.sin_p12+1)<=jt?(pt=this.a*Ji(D,N,L,Q,Nt),o=Math.sqrt(n.x*n.x+n.y*n.y),ot=o-pt,M=Sa(ot/this.a,D,N,L,Q),a=Wt(this.long0+Math.atan2(n.x,n.y)),n.x=a,n.y=M,n):(o=Math.sqrt(n.x*n.x+n.y*n.y),Ct=Math.atan2(n.x,n.y),ft=ds(this.a,this.e,this.sin_p12),Dt=Math.cos(Ct),ne=this.e*this.cos_p12*Dt,Ht=-ne*ne/(1-this.es),fe=3*this.es*(1-Ht)*this.sin_p12*this.cos_p12*Dt/(1-this.es),me=o/ft,oe=me-Ht*(1+Ht)*Math.pow(me,3)/6-fe*(1+3*Ht)*Math.pow(me,4)/24,Ce=1-Ht*oe*oe/2-me*oe*oe*oe/6,Rt=Math.asin(this.sin_p12*Math.cos(oe)+this.cos_p12*Math.sin(oe)*Dt),a=Wt(this.long0+Math.asin(Math.sin(Ct)*Math.sin(oe)/Math.cos(Rt))),Re=Math.sin(Rt),M=Math.atan2((Re-this.es*Ce*this.sin_p12)*Math.tan(Rt),Re*(1-this.es)),n.x=a,n.y=M,n))}var t1=["Azimuthal_Equidistant","aeqd"],Xm={init:Jv,forward:Yv,inverse:Qv,names:t1};W();function e1(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0)}function i1(n){var o,h,g,_,a,M,S,D,N=n.x,L=n.y;return g=Wt(N-this.long0),o=Math.sin(L),h=Math.cos(L),_=Math.cos(g),M=this.sin_p14*o+this.cos_p14*h*_,a=1,(M>0||Math.abs(M)<=jt)&&(S=this.a*a*h*Math.sin(g),D=this.y0+this.a*a*(this.cos_p14*o-this.sin_p14*h*_)),n.x=S,n.y=D,n}function r1(n){var o,h,g,_,a,M,S;return n.x-=this.x0,n.y-=this.y0,o=Math.sqrt(n.x*n.x+n.y*n.y),h=jr(o/this.a),g=Math.sin(h),_=Math.cos(h),M=this.long0,Math.abs(o)<=jt?(S=this.lat0,n.x=M,n.y=S,n):(S=jr(_*this.sin_p14+n.y*g*this.cos_p14/o),a=Math.abs(this.lat0)-Nt,Math.abs(a)<=jt?(this.lat0>=0?M=Wt(this.long0+Math.atan2(n.x,-n.y)):M=Wt(this.long0-Math.atan2(-n.x,n.y)),n.x=M,n.y=S,n):(M=Wt(this.long0+Math.atan2(n.x*g,o*this.cos_p14*_-n.y*this.sin_p14*g)),n.x=M,n.y=S,n))}var n1=["ortho"],Km={init:e1,forward:i1,inverse:r1,names:n1};W();var Pi={FRONT:1,RIGHT:2,BACK:3,LEFT:4,TOP:5,BOTTOM:6},ai={AREA_0:1,AREA_1:2,AREA_2:3,AREA_3:4};function s1(){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>=Nt-He/2?this.face=Pi.TOP:this.lat0<=-(Nt-He/2)?this.face=Pi.BOTTOM:Math.abs(this.long0)<=He?this.face=Pi.FRONT:Math.abs(this.long0)<=Nt+He?this.face=this.long0>0?Pi.RIGHT:Pi.LEFT:this.face=Pi.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 a1(n){var o={x:0,y:0},h,g,_,a,M,S,D={value:0};if(n.x-=this.long0,this.es!==0?h=Math.atan(this.one_minus_f_squared*Math.tan(n.y)):h=n.y,g=n.x,this.face===Pi.TOP)a=Nt-h,g>=He&&g<=Nt+He?(D.value=ai.AREA_0,_=g-Nt):g>Nt+He||g<=-(Nt+He)?(D.value=ai.AREA_1,_=g>0?g-Ai:g+Ai):g>-(Nt+He)&&g<=-He?(D.value=ai.AREA_2,_=g+Nt):(D.value=ai.AREA_3,_=g);else if(this.face===Pi.BOTTOM)a=Nt+h,g>=He&&g<=Nt+He?(D.value=ai.AREA_0,_=-g+Nt):g<He&&g>=-He?(D.value=ai.AREA_1,_=-g):g<-He&&g>=-(Nt+He)?(D.value=ai.AREA_2,_=-g-Nt):(D.value=ai.AREA_3,_=g>0?-g+Ai:-g-Ai);else{var N,L,Q,pt,ot,ft,Rt;this.face===Pi.RIGHT?g=Co(g,+Nt):this.face===Pi.BACK?g=Co(g,+Ai):this.face===Pi.LEFT&&(g=Co(g,-Nt)),pt=Math.sin(h),ot=Math.cos(h),ft=Math.sin(g),Rt=Math.cos(g),N=ot*Rt,L=ot*ft,Q=pt,this.face===Pi.FRONT?(a=Math.acos(N),_=bc(a,Q,L,D)):this.face===Pi.RIGHT?(a=Math.acos(L),_=bc(a,Q,-N,D)):this.face===Pi.BACK?(a=Math.acos(-N),_=bc(a,Q,-L,D)):this.face===Pi.LEFT?(a=Math.acos(-L),_=bc(a,Q,N,D)):(a=_=0,D.value=ai.AREA_0)}return S=Math.atan(12/Ai*(_+Math.acos(Math.sin(_)*Math.cos(He))-Nt)),M=Math.sqrt((1-Math.cos(a))/(Math.cos(S)*Math.cos(S))/(1-Math.cos(Math.atan(1/Math.cos(_))))),D.value===ai.AREA_1?S+=Nt:D.value===ai.AREA_2?S+=Ai:D.value===ai.AREA_3&&(S+=1.5*Ai),o.x=M*Math.cos(S),o.y=M*Math.sin(S),o.x=o.x*this.a+this.x0,o.y=o.y*this.a+this.y0,n.x=o.x,n.y=o.y,n}function o1(n){var o={lam:0,phi:0},h,g,_,a,M,S,D,N,L,Q={value:0};if(n.x=(n.x-this.x0)/this.a,n.y=(n.y-this.y0)/this.a,g=Math.atan(Math.sqrt(n.x*n.x+n.y*n.y)),h=Math.atan2(n.y,n.x),n.x>=0&&n.x>=Math.abs(n.y)?Q.value=ai.AREA_0:n.y>=0&&n.y>=Math.abs(n.x)?(Q.value=ai.AREA_1,h-=Nt):n.x<0&&-n.x>=Math.abs(n.y)?(Q.value=ai.AREA_2,h=h<0?h+Ai:h-Ai):(Q.value=ai.AREA_3,h+=Nt),L=Ai/12*Math.tan(h),M=Math.sin(L)/(Math.cos(L)-1/Math.sqrt(2)),S=Math.atan(M),_=Math.cos(h),a=Math.tan(g),D=1-_*_*a*a*(1-Math.cos(Math.atan(1/Math.cos(S)))),D<-1?D=-1:D>1&&(D=1),this.face===Pi.TOP)N=Math.acos(D),o.phi=Nt-N,Q.value===ai.AREA_0?o.lam=S+Nt:Q.value===ai.AREA_1?o.lam=S<0?S+Ai:S-Ai:Q.value===ai.AREA_2?o.lam=S-Nt:o.lam=S;else if(this.face===Pi.BOTTOM)N=Math.acos(D),o.phi=N-Nt,Q.value===ai.AREA_0?o.lam=-S+Nt:Q.value===ai.AREA_1?o.lam=-S:Q.value===ai.AREA_2?o.lam=-S-Nt:o.lam=S<0?-S-Ai:-S+Ai;else{var pt,ot,ft;pt=D,L=pt*pt,L>=1?ft=0:ft=Math.sqrt(1-L)*Math.sin(S),L+=ft*ft,L>=1?ot=0:ot=Math.sqrt(1-L),Q.value===ai.AREA_1?(L=ot,ot=-ft,ft=L):Q.value===ai.AREA_2?(ot=-ot,ft=-ft):Q.value===ai.AREA_3&&(L=ot,ot=ft,ft=-L),this.face===Pi.RIGHT?(L=pt,pt=-ot,ot=L):this.face===Pi.BACK?(pt=-pt,ot=-ot):this.face===Pi.LEFT&&(L=pt,pt=ot,ot=-L),o.phi=Math.acos(-ft)-Nt,o.lam=Math.atan2(ot,pt),this.face===Pi.RIGHT?o.lam=Co(o.lam,-Nt):this.face===Pi.BACK?o.lam=Co(o.lam,-Ai):this.face===Pi.LEFT&&(o.lam=Co(o.lam,+Nt))}if(this.es!==0){var Rt,Ct,Dt;Rt=o.phi<0?1:0,Ct=Math.tan(o.phi),Dt=this.b/Math.sqrt(Ct*Ct+this.one_minus_f_squared),o.phi=Math.atan(Math.sqrt(this.a*this.a-Dt*Dt)/(this.one_minus_f*Dt)),Rt&&(o.phi=-o.phi)}return o.lam+=this.long0,n.x=o.lam,n.y=o.phi,n}function bc(n,o,h,g){var _;return n<jt?(g.value=ai.AREA_0,_=0):(_=Math.atan2(o,h),Math.abs(_)<=He?g.value=ai.AREA_0:_>He&&_<=Nt+He?(g.value=ai.AREA_1,_-=Nt):_>Nt+He||_<=-(Nt+He)?(g.value=ai.AREA_2,_=_>=0?_-Ai:_+Ai):(g.value=ai.AREA_3,_+=Nt)),_}function Co(n,o){var h=n+o;return h<-Ai?h+=qs:h>+Ai&&(h-=qs),h}var l1=["Quadrilateralized Spherical Cube","Quadrilateralized_Spherical_Cube","qsc"],Jm={init:s1,forward:a1,inverse:o1,names:l1};W();var dp=[[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]],$l=[[-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]],Ym=.8487,Qm=1.3523,tg=Vr/5,h1=1/tg,Ao=18,wc=function(n,o){return n[0]+o*(n[1]+o*(n[2]+o*n[3]))},c1=function(n,o){return n[1]+o*(2*n[2]+o*3*n[3])};function u1(n,o,h,g){for(var _=o;g;--g){var a=n(_);if(_-=a,Math.abs(a)<h)break}return _}function p1(){this.x0=this.x0||0,this.y0=this.y0||0,this.long0=this.long0||0,this.es=0,this.title=this.title||"Robinson"}function d1(n){var o=Wt(n.x-this.long0),h=Math.abs(n.y),g=Math.floor(h*tg);g<0?g=0:g>=Ao&&(g=Ao-1),h=Vr*(h-h1*g);var _={x:wc(dp[g],h)*o,y:wc($l[g],h)};return n.y<0&&(_.y=-_.y),_.x=_.x*this.a*Ym+this.x0,_.y=_.y*this.a*Qm+this.y0,_}function f1(n){var o={x:(n.x-this.x0)/(this.a*Ym),y:Math.abs(n.y-this.y0)/(this.a*Qm)};if(o.y>=1)o.x/=dp[Ao][0],o.y=n.y<0?-Nt:Nt;else{var h=Math.floor(o.y*Ao);for(h<0?h=0:h>=Ao&&(h=Ao-1);;)if($l[h][0]>o.y)--h;else if($l[h+1][0]<=o.y)++h;else break;var g=$l[h],_=5*(o.y-g[0])/($l[h+1][0]-g[0]);_=u1(function(a){return(wc(g,a)-o.y)/c1(g,a)},_,jt,100),o.x/=wc(dp[h],_),o.y=(5*h+_)*Ci,n.y<0&&(o.y=-o.y)}return o.x=Wt(o.x+this.long0),o}var m1=["Robinson","robin"],eg={init:p1,forward:d1,inverse:f1,names:m1};W();function g1(){this.name="geocent"}function y1(n){var o=uc(n,this.es,this.a);return o}function _1(n){var o=pc(n,this.es,this.a,this.b);return o}var x1=["Geocentric","geocentric","geocent","Geocent"],ig={init:g1,forward:y1,inverse:_1,names:x1};W();var mr={N_POLE:0,S_POLE:1,EQUIT:2,OBLIQ:3},Wl={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 v1(){if(Object.keys(Wl).forEach(function(h){if(typeof this[h]>"u")this[h]=Wl[h].def;else{if(Wl[h].num&&isNaN(this[h]))throw new Error("Invalid parameter value, must be numeric "+h+" = "+this[h]);Wl[h].num&&(this[h]=parseFloat(this[h]))}Wl[h].degrees&&(this[h]=this[h]*Ci)}.bind(this)),Math.abs(Math.abs(this.lat0)-Nt)<jt?this.mode=this.lat0<0?mr.S_POLE:mr.N_POLE:Math.abs(this.lat0)<jt?this.mode=mr.EQUIT:(this.mode=mr.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 n=this.tilt,o=this.azi;this.cg=Math.cos(o),this.sg=Math.sin(o),this.cw=Math.cos(n),this.sw=Math.sin(n)}function b1(n){n.x-=this.long0;var o=Math.sin(n.y),h=Math.cos(n.y),g=Math.cos(n.x),_,a;switch(this.mode){case mr.OBLIQ:a=this.sinph0*o+this.cosph0*h*g;break;case mr.EQUIT:a=h*g;break;case mr.S_POLE:a=-o;break;case mr.N_POLE:a=o;break}switch(a=this.pn1/(this.p-a),_=a*h*Math.sin(n.x),this.mode){case mr.OBLIQ:a*=this.cosph0*o-this.sinph0*h*g;break;case mr.EQUIT:a*=o;break;case mr.N_POLE:a*=-(h*g);break;case mr.S_POLE:a*=h*g;break}var M,S;return M=a*this.cg+_*this.sg,S=1/(M*this.sw*this.h1+this.cw),_=(_*this.cg-a*this.sg)*this.cw*S,a=M*S,n.x=_*this.a,n.y=a*this.a,n}function w1(n){n.x/=this.a,n.y/=this.a;var o={x:n.x,y:n.y},h,g,_;_=1/(this.pn1-n.y*this.sw),h=this.pn1*n.x*_,g=this.pn1*n.y*this.cw*_,n.x=h*this.cg+g*this.sg,n.y=g*this.cg-h*this.sg;var a=Pr(n.x,n.y);if(Math.abs(a)<jt)o.x=0,o.y=n.y;else{var M,S;switch(S=1-a*a*this.pfact,S=(this.p-Math.sqrt(S))/(this.pn1/a+a/this.pn1),M=Math.sqrt(1-S*S),this.mode){case mr.OBLIQ:o.y=Math.asin(M*this.sinph0+n.y*S*this.cosph0/a),n.y=(M-this.sinph0*Math.sin(o.y))*a,n.x*=S*this.cosph0;break;case mr.EQUIT:o.y=Math.asin(n.y*S/a),n.y=M*a,n.x*=S;break;case mr.N_POLE:o.y=Math.asin(M),n.y=-n.y;break;case mr.S_POLE:o.y=-Math.asin(M);break}o.x=Math.atan2(n.x,n.y)}return n.x=o.x+this.long0,n.y=o.y,n}var M1=["Tilted_Perspective","tpers"],rg={init:v1,forward:b1,inverse:w1,names:M1};W();function S1(){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 n=1-this.es,o=1/n;this.radius_p=Math.sqrt(n),this.radius_p2=n,this.radius_p_inv2=o,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 T1(n){var o=n.x,h=n.y,g,_,a,M;if(o=o-this.long0,this.shape==="ellipse"){h=Math.atan(this.radius_p2*Math.tan(h));var S=this.radius_p/Pr(this.radius_p*Math.cos(h),Math.sin(h));if(_=S*Math.cos(o)*Math.cos(h),a=S*Math.sin(o)*Math.cos(h),M=S*Math.sin(h),(this.radius_g-_)*_-a*a-M*M*this.radius_p_inv2<0)return n.x=Number.NaN,n.y=Number.NaN,n;g=this.radius_g-_,this.flip_axis?(n.x=this.radius_g_1*Math.atan(a/Pr(M,g)),n.y=this.radius_g_1*Math.atan(M/g)):(n.x=this.radius_g_1*Math.atan(a/g),n.y=this.radius_g_1*Math.atan(M/Pr(a,g)))}else this.shape==="sphere"&&(g=Math.cos(h),_=Math.cos(o)*g,a=Math.sin(o)*g,M=Math.sin(h),g=this.radius_g-_,this.flip_axis?(n.x=this.radius_g_1*Math.atan(a/Pr(M,g)),n.y=this.radius_g_1*Math.atan(M/g)):(n.x=this.radius_g_1*Math.atan(a/g),n.y=this.radius_g_1*Math.atan(M/Pr(a,g))));return n.x=n.x*this.a,n.y=n.y*this.a,n}function E1(n){var o=-1,h=0,g=0,_,a,M,S;if(n.x=n.x/this.a,n.y=n.y/this.a,this.shape==="ellipse"){this.flip_axis?(g=Math.tan(n.y/this.radius_g_1),h=Math.tan(n.x/this.radius_g_1)*Pr(1,g)):(h=Math.tan(n.x/this.radius_g_1),g=Math.tan(n.y/this.radius_g_1)*Pr(1,h));var D=g/this.radius_p;if(_=h*h+D*D+o*o,a=2*this.radius_g*o,M=a*a-4*_*this.C,M<0)return n.x=Number.NaN,n.y=Number.NaN,n;S=(-a-Math.sqrt(M))/(2*_),o=this.radius_g+S*o,h*=S,g*=S,n.x=Math.atan2(h,o),n.y=Math.atan(g*Math.cos(n.x)/o),n.y=Math.atan(this.radius_p_inv2*Math.tan(n.y))}else if(this.shape==="sphere"){if(this.flip_axis?(g=Math.tan(n.y/this.radius_g_1),h=Math.tan(n.x/this.radius_g_1)*Math.sqrt(1+g*g)):(h=Math.tan(n.x/this.radius_g_1),g=Math.tan(n.y/this.radius_g_1)*Math.sqrt(1+h*h)),_=h*h+g*g+o*o,a=2*this.radius_g*o,M=a*a-4*_*this.C,M<0)return n.x=Number.NaN,n.y=Number.NaN,n;S=(-a-Math.sqrt(M))/(2*_),o=this.radius_g+S*o,h*=S,g*=S,n.x=Math.atan2(h,o),n.y=Math.atan(g*Math.cos(n.x)/o)}return n.x=n.x+this.long0,n}var I1=["Geostationary Satellite View","Geostationary_Satellite","geos"],ng={init:S1,forward:T1,inverse:E1,names:I1};function sg(n){n.Proj.projections.add(To),n.Proj.projections.add(Eo),n.Proj.projections.add(Im),n.Proj.projections.add(Cm),n.Proj.projections.add(Am),n.Proj.projections.add(Pm),n.Proj.projections.add(zm),n.Proj.projections.add(km),n.Proj.projections.add(Lm),n.Proj.projections.add(Dm),n.Proj.projections.add(Rm),n.Proj.projections.add(Bm),n.Proj.projections.add(Fm),n.Proj.projections.add(Nm),n.Proj.projections.add(Um),n.Proj.projections.add(Gm),n.Proj.projections.add(qm),n.Proj.projections.add(jm),n.Proj.projections.add($m),n.Proj.projections.add(Wm),n.Proj.projections.add(Zm),n.Proj.projections.add(Hm),n.Proj.projections.add(Xm),n.Proj.projections.add(Km),n.Proj.projections.add(Jm),n.Proj.projections.add(eg),n.Proj.projections.add(ig),n.Proj.projections.add(rg),n.Proj.projections.add(ng)}Gr.defaultDatum="WGS84";Gr.Proj=js;Gr.WGS84=new Gr.Proj("WGS84");Gr.Point=_m;Gr.toPoint=fc;Gr.defs=vo;Gr.nadgrid=sp;Gr.transform=wa;Gr.mgrs=mm;Gr.version="__VERSION__";sg(Gr);var Po=Gr;W();W();W();var gr;(function(n){n[n.UInt8=1]="UInt8",n[n.UInt16=2]="UInt16",n[n.UInt32=4]="UInt32",n[n.UInt64=8]="UInt64",n[n.Double=8]="Double",n[n.Float=4]="Float"})(gr||(gr={}));W();var ag=2**32,C1=typeof setImmediate>"u"?setTimeout:setImmediate,zr=()=>{throw new Error("Method not implemented.")},kn=class{constructor(){this.isLittleEndian=!0,this.delayMs=kn.DefaultDelayMs,this.maxChunkCount=10,this.chunks=kn.DefaultChunkCache(),this.blankFillCount=16,this.maxConcurrentRequests=50,this.toFetch=new Set,this.toFetchPromise=null,this.byteOffset=0,this.getFloat32=zr,this.getFloat64=zr,this.getInt8=zr,this.getInt16=zr,this.getInt32=zr,this.setFloat32=zr,this.setFloat64=zr,this.setInt8=zr,this.setInt16=zr,this.setInt32=zr,this.setUint8=zr,this.setUint16=zr,this.setUint32=zr,this.setBigInt64=zr,this.setBigUint64=zr}static getByteRanges(o,h=32,g=16){if(o.size===0)return{chunks:[],blankFill:[]};let _=[...o.values()].sort((D,N)=>D-N),a=[],M=[];a.push(M);let S=[];for(let D=0;D<_.length;++D){let N=_[D],L=_[D-1];if(M.length>=h)M=[N],a.push(M);else if(D===0||N===L+1)M.push(N);else if(N<L+g){for(let Q=L;Q<N;Q++)M.push(Q+1),S.push(Q+1);S.pop()}else M=[N],a.push(M)}return{chunks:a,blankFill:S}}async fetchData(){if(this.toFetch.size===0)return;let o=this.toFetch;this.toFetch=new Set,this.toFetchPromise=null;let h=kn.getByteRanges(o,this.maxChunkCount,this.blankFillCount),g=[];for(let _ of h.chunks){let a=_[0],M=_[_.length-1],S=a*this.chunkSize,D=M*this.chunkSize+this.chunkSize-S,N=await this.fetchBytes(S,D);if(_.length===1){g[a]=N,this.chunks.set(a,new DataView(N));continue}let L=a*this.chunkSize;for(let Q of _){let pt=Q*this.chunkSize-L,ot=N.slice(pt,pt+this.chunkSize);g[Q]=ot,this.chunks.set(Q,new DataView(ot))}}}async loadBytes(o,h){if(o<0)throw new Error("Offset must be positive");let g=Math.floor(o/this.chunkSize),_=Math.ceil((o+h)/this.chunkSize)-1;for(let a=g;a<=_;a++)this.chunks.has(a)||this.toFetch.add(a);if(this.toFetch.size!==0){if(this.toFetchPromise==null&&(this.toFetchPromise=new Promise(a=>C1(a,this.delayMs)).then(()=>this.fetchData())),this.toFetch.size>this.maxConcurrentRequests)throw new Error("Too many outstanding requests");await this.toFetchPromise}}getChunkId(o){return Math.floor(o/this.chunkSize)}getUint(o,h){switch(h){case gr.UInt8:return this.getUint8(o);case gr.UInt16:return this.getUint16(o);case gr.UInt32:return this.getUint32(o);case gr.UInt64:return this.getUint64(o)}}bytes(o,h){let g=this.isOneChunk(o,h);if(g){let N=this.getView(g),L=o-g*this.chunkSize;return new Uint8Array(N.buffer.slice(L,L+h))}let _=new Uint8Array(h),a=o+h,M=Math.floor(o/this.chunkSize),S=Math.ceil((o+h)/this.chunkSize)-1,D=0;for(let N=M;N<=S;N++){let L=o+D,Q=N*this.chunkSize,pt=this.getView(N),ot=Math.min(a,Q+this.chunkSize),ft=pt.buffer.slice(L-Q,ot-Q);_.set(new Uint8Array(ft),D),D+=ft.byteLength}return _}getView(o){let h=this.chunks.get(o);if(h==null)throw new Error(`Chunk:${o} is not ready`);return h}isOneChunk(o,h){let g=o+h-1,_=Math.floor(o/this.chunkSize);return Math.floor(g/this.chunkSize)-_<1?_:null}hasBytes(o,h=1){let g=Math.floor(o/this.chunkSize),_=Math.ceil((o+h)/this.chunkSize)-1;for(let a=g;a<=_;a++)if(!this.chunks.has(a))return!1;return!0}toRange(o,h){if(h==null)return`bytes=${o}`;if(o<0)throw new Error("Cannot read from remote source with negative offset and length");return`bytes=${o}-${o+h}`}parseContentRange(o){let[h,g]=o.split(" ");if(h!=="bytes")throw new Error("Failed to parse content-range: "+o);if(g==null)throw new Error("Failed to parse content-range: "+o);let[,_]=g.split("/"),a=Number(_);if(isNaN(a))throw new Error("Failed to parse content-range: "+o);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(o){let h=Math.floor(o/this.chunkSize),g=this.chunks.get(h);if(g==null)throw new Error(`Chunk:${h} is not ready`);return g.getUint8(o-h*this.chunkSize)}getUint16(o){let h=this.isOneChunk(o,gr.UInt16);if(h!=null)return this.getView(h).getUint16(o-h*this.chunkSize,this.isLittleEndian);let g=this.getUint8(o),_=this.getUint8(o+gr.UInt8);return this.isLittleEndian?g+(_<<8):(g<<8)+_}getUint32(o){let h=this.isOneChunk(o,gr.UInt32);if(h!=null)return this.getView(h).getUint32(o-h*this.chunkSize,this.isLittleEndian);let g=this.getUint16(o),_=this.getUint16(o+gr.UInt16);return this.isLittleEndian?g+_*65536:g*65536+_}getUint64(o){let h=this.isOneChunk(o,gr.UInt64);if(h!=null){let a=this.getView(h);return Number(a.getBigUint64(o-h*this.chunkSize,this.isLittleEndian))}let g=this.getUint32(o),_=this.getUint32(o+gr.UInt32);return this.isLittleEndian?g+_*ag:g*ag+_}getBigUint64(o){let h=this.isOneChunk(o,gr.UInt64);if(h!=null)return this.getView(h).getBigUint64(o-h*this.chunkSize,this.isLittleEndian);let g=BigInt(this.getUint32(o)),_=BigInt(this.getUint32(o+gr.UInt32));return this.isLittleEndian?g+(_<<BigInt(32)):(g<<BigInt(32))+_}getBigInt64(){throw new Error("Not implemented.")}};kn.DefaultChunkCache=()=>new Map;kn.DefaultDelayMs=1;W();W();var zo=class extends Error{constructor(o,h,g){super(o),this.name="CompositeError",this.code=h,this.reason=g}static isCompositeError(o){return typeof o!="object"||o==null?!1:o.name==="CompositeError"}};W();var og=`PROJCS["NZGD2000 / Chatham Islands TM 2000",
509
509
  GEOGCS["NZGD2000",
510
510
  DATUM["New_Zealand_Geodetic_Datum_2000",
511
511
  SPHEROID["GRS 1980",6378137,298.257222101,
@@ -527,7 +527,7 @@ PARAMETER["false_easting",3500000],
527
527
  PARAMETER["false_northing",10000000],
528
528
  AUTHORITY["EPSG","3793"],
529
529
  AXIS["Easting",EAST],
530
- AXIS["Northing",NORTH]]`;Z();var ig=`PROJCS["NZGD2000 / New Zealand Transverse Mercator 2000",
530
+ AXIS["Northing",NORTH]]`;W();var lg=`PROJCS["NZGD2000 / New Zealand Transverse Mercator 2000",
531
531
  GEOGCS["NZGD2000",
532
532
  DATUM["New_Zealand_Geodetic_Datum_2000",
533
533
  SPHEROID["GRS 1980",6378137,298.257222101,
@@ -547,7 +547,7 @@ PARAMETER["false_easting",1600000],
547
547
  PARAMETER["false_northing",10000000],
548
548
  UNIT["metre",1,
549
549
  AUTHORITY["EPSG","9001"]],
550
- AUTHORITY["EPSG","2193"]]`;Co.defs(Ve.Nztm2000.toEpsgString(),ig);Co.defs(Ve.Citm2000.toEpsgString(),eg);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=vf([[[y,a,T,_,y]]],this.toWgs84),D=M.length===1?bf(M[0],h):wf(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),ng=new jl(ii),b1=[x1,v1,ng];function Po(s){for(let l of b1)if(s===l.tileMatrix.identifier)return l;return ng}function rg(s){return s.identifier===ii.identifier}function kn(s,l,h){if(l.identifier===h.identifier)return s;if(!rg(l)&&!rg(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 sg(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 ag={[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 og.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={...ag[this.tileMatrix.identifier],...Ri.fromHash(window.location.hash)};this.setLocation(h)}),this.updateFromUrl(),this._location={...ag[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=af(),Pt={get BaseUrl(){return""},get ApiKey(){return T1},get GoogleAnalytics(){return"UA-23232486-3"},get Version(){return"v6.33.0"},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 lg(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=lg(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=lg(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=`
550
+ AUTHORITY["EPSG","2193"]]`;Po.defs(qe.Nztm2000.toEpsgString(),lg);Po.defs(qe.Citm2000.toEpsgString(),og);var fp=new Map;function A1(n){return n==null?null:typeof n=="number"?n:"code"in n?n.code:"projection"in n?n.projection.code:null}var Ln=class{constructor(o){this.epsg=o;try{this.projection=Po(o.toEpsgString(),qe.Wgs84.toEpsgString())}catch(h){throw new zo(`Failed to create projection: ${o.toEpsgString()}, ${qe.Wgs84.toEpsgString()}`,500,h)}}static define(o,h){if(fp.get(o.code)!=null)throw new Error("Duplicate projection definition: "+o.toEpsgString());Po.defs(o.toEpsgString(),h)}static get(o){let h=this.tryGet(o);if(h==null)throw new Error(`Invalid projection: ${o}`);return h}static tryGet(o){let h=A1(o);if(h==null)return null;let g=fp.get(h);if(g!=null)return g;let _=qe.tryGet(h);return _==null||Po.defs(_.toEpsgString())==null?null:(g=new Ln(_),fp.set(h,g),g)}projectMultipolygon(o,h){if(h.epsg.code===this.epsg.code)return o;let{toWgs84:g}=this,{fromWgs84:_}=h;return o.map(a=>a.map(M=>M.map(S=>_(g(S)))))}get toWgs84(){return this.projection.forward}get fromWgs84(){return this.projection.inverse}boundsToWgs84BoundingBox(o){let h=this.toWgs84([o.x,o.y]),g=this.toWgs84([o.x+o.width,o.y+o.height]);return[h[0],h[1],g[0],g[1]]}boundsToGeoJsonFeature(o,h={}){let g=[o.x,o.y],_=[o.x+o.width,o.y],a=[o.x,o.y+o.height],M=[o.x+o.width,o.y+o.height],S=Ef([[[g,a,M,_,g]]],this.toWgs84),D=S.length===1?If(S[0],h):Cf(S,h);return D.bbox=this.boundsToWgs84BoundingBox(o),D}toGeoJson(o){return{type:"FeatureCollection",features:o.map(h=>this.boundsToGeoJsonFeature(h,{name:h.name}))}}static getTiffResZoom(o,h,g=1){let _=0;for(;_<o.zooms.length;++_)if(o.pixelScale(_)<=h*g)return _;if(_===o.zooms.length)return _-1;throw new Error("ResZoom not found")}static tileToWgs84Bbox(o,h){let g=o.tileToSource(h),_=o.tileToSource({x:h.x+1,y:h.y+1,z:h.z}),a=this.get(o),[M,S]=a.toWgs84([g.x,_.y]),[D,N]=a.toWgs84([_.x,g.y]);return[M,S,D,N]}static tileCenterToLatLon(o,h){let g=o.tileToSource({x:h.x+.5,y:h.y+.5,z:h.z}),[_,a]=this.get(o).toWgs84([g.x,g.y]);return Ln.wrapLatLon(a,_)}static wrapLatLon(o,h){let g={lat:o,lon:h},_=Math.floor(Math.abs(o)/90)%4,a=o>0?90:-90,M=o%90;switch(_){case 0:g.lat=M;break;case 1:g.lat=a-M,g.lon+=180;break;case 2:g.lat=-M,g.lon+=180;break;case 3:g.lat=-a+M;break}return(g.lon>180||g.lon<-180)&&(g.lon-=Math.floor((g.lon+180)/360)*360),g}static findAlignmentLevels(o,h,g){return Math.max(0,this.getTiffResZoom(o,g,2)-h.z)}static getImagePixelWidth(o,h,g){let _=o.tileToSource(h),a=o.tileToSource({x:h.x+1,y:h.y+1,z:h.z});return Math.round((a.x-_.x)/o.pixelScale(g))*2}};W();W();function Mc(n){let o=Object.entries(n);if(o.length===0)return"";let h=new URLSearchParams;for(let _ of o)_[1]!=null&&h.set(_[0],_[1]);h.sort();let g=h.toString();return g===""?"":`?${g}`}W();var ug=Ns(cg(),1),pg="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",dg=(0,ug.default)(pg),z1=new Set(pg);function fg(n){for(let o=0;o<n.length;o++)if(!z1.has(n.charAt(o)))return!1;return!0}function Sc(n){if(n==null)return null;if(fg(n))return n;let h=new TextEncoder().encode(n);return dg.encode(h)}var fi={ImageFormat:"png",toHash(n){return`#@${n.lat.toFixed(7)},${n.lon.toFixed(7)},z${n.zoom}`},parseZoom(n){return n==null||n===""?NaN:n.startsWith("z")?parseFloat(n.slice(1)):n.endsWith("z")?parseFloat(n):NaN},fromHash(n){let o={},h=n.replace("#@",""),[g,_,a]=h.split(","),M=parseFloat(g),S=parseFloat(_);!isNaN(M)&&!isNaN(S)&&(o.lat=M,o.lon=S);let D=fi.parseZoom(a);return isNaN(D)||(o.zoom=D),o},baseUrl(){let n=It.BaseUrl;if(n==="")return window.location.origin;if(!n.startsWith("http"))throw new Error("BaseURL must start with http(s)://");return n},toBaseWmts(){let n=Mc({api:It.ApiKey,config:Sc(It.map.config)});return`${this.baseUrl()}/v1/tiles/aerial/WMTSCapabilities.xml${n}`},toImageryUrl(n,o){return`${this.baseUrl()}/v1/imagery/${n}/${o}`},toTileUrl(n,o,h,g,_){let a=new URLSearchParams;It.ApiKey!=null&&It.ApiKey!==""&&a.set("api",It.ApiKey),_!=null&&a.set("config",Sc(_)),n==="style"&&(o.identifier!==Ye.identifier&&a.set("tileMatrix",o.identifier),fi.ImageFormat!==Fl.Webp&&a.set("format",fi.ImageFormat));let M="?"+a.toString(),S=`${this.baseUrl()}/v1/tiles/${h}/${o.identifier}`;if(n==="raster")return`${S}/{z}/{x}/{y}.${fi.ImageFormat}${M}`;if(n==="vector-xyz")return`${S}/{z}/{x}/{y}.pbf${M}`;if(n==="style")return`${this.baseUrl()}/v1/styles/${g??h}.json${M}`;if(n==="wmts")return`${S}/WMTSCapabilities.xml${M}`;if(n==="attribution")return`${S}/attribution.json${M}`;if(n==="tile-wmts")return`${S}/{TileMatrix}/{TileCol}/{TileRow}.${fi.ImageFormat}${M}`;throw new Error("Unknown url type: "+n)},toConfigUrl(n,o=It.map.config){let h=Mc({api:It.ApiKey,config:o});return`${this.baseUrl()}/v1/config/${n}.json${h}`},toConfigImageryUrl(n,o,h=It.map.config){let g=Mc({api:It.ApiKey,config:h});return`${this.baseUrl()}/v1/config/${n}/${o}.json${g}`}};var Zl=class{constructor(o,h=0){this.tileMatrix=o,this.extraZoomLevels=h}getStyle(o,h,g=It.map.config){return fi.toTileUrl("style",this.tileMatrix,o,h,g)}},k1=new Zl(rs,2),L1=new Zl(Pn),gg=new Zl(Ye),D1=[k1,L1,gg];function ko(n){for(let o of D1)if(n===o.tileMatrix.identifier)return o;return gg}function mg(n){return n.identifier===Ye.identifier}function Dn(n,o,h){if(o.identifier===h.identifier)return n;if(!mg(o)&&!mg(h))throw new Error("Either tileMatrix or targetTileMatrix must be GoogleTms");let g=Ln.get(o).fromWgs84([n.lon,n.lat]),_=o.sourceToPixels(g[0],g[1],Math.round(n.zoom)),a={x:_.x/o.tileSize,y:_.y/o.tileSize,z:Math.round(n.zoom)},M=h.tileToSource(a),S=Ln.get(h).toWgs84([M.x,M.y]);return{lon:Math.round(S[0]*1e8)/1e8,lat:Math.round(S[1]*1e8)/1e8,zoom:n.zoom}}function yg(n,o){for(let h of n.features){if(h.geometry.type!=="Polygon")throw new Error("Only polygons supported");for(let g of h.geometry.coordinates)for(let _ of g){let a=Dn({lat:_[1],lon:_[0],zoom:o.maxZoom},o,Ye);_[0]=a.lon,_[1]=a.lat}}}var _g={[Ye.identifier]:{lat:-41.88999621,lon:174.04924373,zoom:5},[rs.identifier]:{lat:-41.277848,lon:174.6763921,zoom:3},[Pn.identifier]:{lat:-41.88999621,lon:174.04924373,zoom:3}},en=class extends xg.Emitter{constructor(){super(...arguments);this.style=null;this.layerId="aerial";this.tileMatrix=Ye;this.debug={...yo}}get layers(){return this._layers==null&&(this._layers=R1()),this._layers}get isDebug(){return this.debug.debug}get location(){return this._location==null&&(window.addEventListener("popstate",()=>{let h={..._g[this.tileMatrix.identifier],...fi.fromHash(window.location.hash)};this.setLocation(h)}),this.updateFromUrl(),this._location={..._g[this.tileMatrix.identifier],...fi.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 g=new URLSearchParams(h),_=g.get("s")??g.get("style"),a=g.get("c")??g.get("config"),M=g.get("i")??"aerial",S=(g.get("p")??g.get("tileMatrix")??Ye.identifier).toLowerCase(),D=ns.All.find(Q=>Q.identifier.toLowerCase()===S);D==null&&(D=ns.get(qe.parse(S)??qe.Google)),D.identifier===rs.identifier&&(D=Pn),Ol.fromUrl(this.debug,g)&&this.emit("change");let L=en.toUrl(this);this.config=a,this.style=_??null,this.layerId=M.startsWith("im_")?M.slice(3):M,this.tileMatrix=D,this.layerId==="topographic"&&this.style==null&&(this.style="topographic"),this.emit("tileMatrix",this.tileMatrix),this.emit("layer",this.layerId,this.style),L!==en.toUrl(this)&&this.emit("change")}static toUrl(h){let g=new URLSearchParams;return h.style&&g.append("s",h.style),h.config&&g.append("config",Sc(h.config)),h.layerId!=="aerial"&&g.append("i",h.layerId),h.tileMatrix.identifier!==Ye.identifier&&g.append("p",h.tileMatrix.identifier),Ol.toUrl(h.debug,g),g.toString()}toTileUrl(h,g=this.tileMatrix,_=this.layerId,a=this.style,M=this.config){return fi.toTileUrl(h,g,_,a,M)}getLocation(h){let g=h.getCenter();if(g==null)throw new Error("Invalid Map location");let _=Math.floor((h.getZoom()??0)*1e4)/1e4;return It.map.transformLocation(g.lat,g.lng,_)}transformLocation(h,g,_){return Dn({lat:h,lon:g,zoom:_},Ye,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,g){this.layerId===h&&this.style===g||(this.layerId=h,this.style=g??null,this.emit("layer",this.layerId,this.style),this.emit("change"))}setDebug(h,g=yo[h]){this.debug[h]!==g&&(this.debug[h]=g,this.emit("change"))}};async function R1(){let n=new Map,o=await fetch(fi.toBaseWmts());if(!o.ok)return n;let _=new DOMParser().parseFromString(await o.text(),"text/xml").getElementsByTagName("Layer"),a=[];for(let M=0;M<_.length;M++){let S=_.item(M);if(S==null)continue;let D=S.getElementsByTagName("ows:Title").item(0)?.textContent,N=S.getElementsByTagName("ows:Identifier").item(0)?.textContent;if(D==null||N==null||D==="aerial")continue;let L=S.getElementsByTagName("ows:Keyword").item(0)?.textContent,Q=S.getElementsByTagName("ows:WGS84BoundingBox").item(0),pt=Q?.getElementsByTagName("ows:UpperCorner").item(0)?.textContent?.split(" ").map(Number),ot=Q?.getElementsByTagName("ows:LowerCorner").item(0)?.textContent?.split(" ").map(Number),ft=S.getElementsByTagName("TileMatrixSet"),Rt=new Set;for(let Ct=0;Ct<ft.length;Ct++){let Dt=F1(ft.item(Ct)?.textContent??"");Dt!=null&&Rt.add(Dt.code)}pt==null||ot==null||pt.length!==2||a.push({id:N,name:D.replace("aerial ",""),upperLeft:pt,lowerRight:ot,projections:Rt,category:L})}a.sort((M,S)=>M.name.localeCompare(S.name)),B1(n);for(let M of a)n.set(M.id,M);return n}function B1(n){n.set("aerial",{id:"aerial",name:"Aerial Imagery",projections:new Set([Ze.Nztm2000,Ze.Google]),category:"Basemaps"}),n.set("topographic::topographic",{id:"topographic::topographic",name:"Topographic",projections:new Set([Ze.Google]),category:"Basemaps"})}function F1(n){if(n.toLowerCase().startsWith("epsg"))return qe.parse(n);let o=ns.find(n);return o==null?null:o.projection}var O1=pf(),It={get BaseUrl(){return""},get ApiKey(){return O1},get GoogleAnalytics(){return"UA-23232486-3"},get Version(){return"v6.35.0"},map:new en};if(It.GoogleAnalytics!==""&&typeof window<"u"){window.dataLayer=window.dataLayer||[],window.gtag=function(){window.dataLayer.push(arguments)},window.gtag("js",new Date),window.gtag("config",`${It.GoogleAnalytics}`);let n=document.createElement("script");n.setAttribute("async",""),n.setAttribute("src",`https://www.googletagmanager.com/gtag/js?id=${It.GoogleAnalytics}`),document.head.appendChild(n)}function Ta(n,o,h){It.GoogleAnalytics!==""&&window.gtag("event",o,{event_category:n,value:h})}W();Qr();W();Qr();Qr();var N1=0;function At(n,o,h,g,_){var a,M,S={};for(M in o)M=="ref"?a=o[M]:S[M]=o[M];var D={type:n,props:S,key:h,ref:a,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:--N1,__source:_,__self:g};if(typeof n=="function"&&(a=n.defaultProps))for(M in a)S[M]===void 0&&(S[M]=a[M]);return vi.vnode&&vi.vnode(D),D}var Hl=class extends Ii{render(o){return At("i",{class:"material-icons-round md-36",children:o.name})}},Rn=class extends Ii{render(o){return At("a",{rel:"noopener",target:"_blank",href:o.href,style:"display:flex;","aria-label":o.ariaLabel,children:[o.children,o.icon?At(Hl,{name:o.icon}):void 0]})}};var Tc=class extends Ii{constructor(){super(...arguments);this._events=[]}componentWillMount(){this._events.push(It.map.on("change",()=>this.setState(this.state)))}componentWillUnmount(){for(let h of this._events)h();this._events=[]}render(){if(!It.map.isDebug)return At("footer",{class:"lui-footer lui-footer-small lui-hide-sm lui-hide-xs",role:"contentinfo",children:At("div",{class:"lui-footer-columns",children:[At("div",{style:"display:flex; align-items:center",children:At(Rn,{href:"http://www.govt.nz/",ariaLabel:"New Zealand Government",children:At("img",{src:"/assets/logo-nz-govt.svg"})})}),At("div",{class:"justify-end",children:At("ul",{class:"lui-footer-list",children:[At("li",{class:"lui-footer-inline-list-item",children:"\xA9 2021 Land Information New Zealand"}),At("li",{class:"lui-footer-inline-list-item",children:At(Rn,{href:"https://www.linz.govt.nz/contact-us",children:"Contact"})}),At("li",{class:"lui-footer-inline-list-item",children:At(Rn,{href:"https://www.linz.govt.nz/privacy",children:"Privacy"})}),At("li",{class:"lui-footer-inline-list-item",children:At(Rn,{href:"https://www.linz.govt.nz/data/linz-data/linz-basemaps/data-attribution",children:"Data Attribution"})})]})})]})})}};W();W();function vg(n){var o,h,g="";if(typeof n=="string"||typeof n=="number")g+=n;else if(typeof n=="object")if(Array.isArray(n))for(o=0;o<n.length;o++)n[o]&&(h=vg(n[o]))&&(g&&(g+=" "),g+=h);else for(o in n)n[o]&&(g&&(g+=" "),g+=o);return g}function Ec(){for(var n=0,o,h,g="";n<arguments.length;)(o=arguments[n++])&&(h=vg(o))&&(g&&(g+=" "),g+=h);return g}Qr();W();Qr();var fs=class extends Ii{constructor(){super(...arguments);this._copyTimeout=null;this.copy=()=>{Ta("Ui","copy:"+It.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 At("div",{class:"LuiDeprecatedForms",children:[At("label",{children:this.props.header}),At("div",{class:Ec({"lui-menu-label":!0,"menu-copyable":!0,"menu-copyable-copied":this.state.copied}),children:[At("button",{class:"menu-copyable-icon-button",title:"Copy",onClick:this.copy,children:At("i",{class:"material-icons-round",children:this.state.copied?"check":"content_copy"})}),At("input",{value:this.props.value,readonly:!0})]})]})}};W();Qr();var Ic=class extends Ii{constructor(){super(...arguments);this._events=[];this.onChange=h=>{let g=h.target,[_,a]=g.value.split("::");It.map.setLayerId(_,a),Ta("Ui","layer:"+g.value),It.map.layers.then(M=>{let S=M.get(_);S!=null&&It.map.emit("bounds",[S.upperLeft,S.lowerRight])}),window.history.pushState(null,"",`?${en.toUrl(It.map)}`)}}componentWillMount(){this.setState({...this.state,currentLayer:It.map.layerKey}),It.map.layers.then(h=>this.setState({...this.state,layers:h})),this._events.push(It.map.on("layer",()=>this.setState({...this.state,currentLayer:It.map.layerKey})),It.map.on("tileMatrix",()=>this.setState(this.state)))}componentWillUnmount(){for(let h of this._events)h();this._events=[]}render(){return At("div",{class:"LuiDeprecatedForms",children:[At("h6",{children:"Layers"}),At("select",{onChange:this.onChange,value:this.state.currentLayer,children: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(It.map.tileMatrix.projection.code))continue;let a=h.get(_.category??"Unknown")??[];a.push(At("option",{value:_.id,children:_.name.replace(` ${_.category}`,"")})),h.set(_.category??"Unknown",a)}if(h.size===0)return;let g=[];for(let[_,a]of h.entries())a.length!==0&&g.push(At("optgroup",{label:_,children:[...a]}));return At(yt,{children:g})}};var Cc=class extends Ii{constructor(){super(...arguments);this._events=[];this.menuToggle=()=>{let h=!this.state.isMenuOpen;Ta("Ui",h?"menu:open":"menu:close"),this.setState({...this.state,isMenuOpen:h})};this.contactUs=()=>{let h="Request Basemaps Developer Access",g=`
551
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
552
 
553
553
  Your Name:
@@ -556,7 +556,7 @@ Your Email:
556
556
 
557
557
  Your Service/App URL:
558
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 ug(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 pg(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=ug(l[0].title);if(l.length>1)if(l.length===2)h+=` & ${ug(l[1].title)}`;else{let[y,_]=pg(l[1]);for(let a=1;a<l.length;++a){let[T,M]=pg(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 dg=`\xA9 ${lf.License} LINZ`,fg=new Map,mg=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=fg.get(l);h==null&&(h=Vs.load(Pt.map.toTileUrl("attribution")).catch(()=>null),fg.set(l,h),h.then(y=>{y!=null&&(y.isIgnored=this.isIgnored,mg.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=mg.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(_===""?_=dg:_=dg+" - "+_,_!==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&&sg(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 gg=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 gg.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 yg(){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 yg()&&(Ri.ImageFormat="webp");let l=document.getElementById("main");if(l==null)throw new Error("Missing #main");Jd(K(dp,null),l)});
559
+ `;Ta("Ui","contact-us:click"),window.location.href=`mailto:basemaps@linz.govt.nz?subject=${encodeURI(h)}&body=${encodeURI(g)}`};this._validProjections=new Set([Ze.Google,Ze.Nztm2000])}componentWillMount(){this.setState({isMenuOpen:!1}),this._events.push(It.map.on("change",()=>this.setState(this.state))),It.map.layers.then(h=>this.setState({...this.state,layers:h}))}componentWillUnmount(){for(let h of this._events)h();this._events=[]}render(){if(!It.map.isDebug)return At("header",{class:"lui-header",children:[At("div",{class:"lui-header-row",children:[At("div",{class:"lui-header-col",children:[At("div",{class:"lui-header-logo",children:At("img",{class:"linz-logo",src:"/assets/logo-linz.svg"})}),At("div",{class:"lui-header-title",children:At("h1",{children:"Basemaps"})})]}),At("div",{class:"lui-header-col",children:At("div",{class:"lui-header-menu-item",children:At("div",{class:"lui-header-menu-icon",children:At("i",{class:"material-icons-round md-36",onClick:this.menuToggle,style:{cursor:"pointer"},children:this.state.isMenuOpen?"close":"menu"})})})})]}),At("div",{class:Ec({"lui-menu-drawer":!0,"lui-menu-drawer-closed":!this.state.isMenuOpen,"lui-menu-drawer-wide":!0}),"aria-hidden":this.state.isMenuOpen,children:[At(Ic,{}),this.renderLinks(),At("h6",{children:"Developer API Keys"}),At("p",{children:"Contact us for free API keys with better support for public web and mobile apps."}),At("button",{class:"lui-button lui-button-tertiary contact-us",onClick:this.contactUs,children:"Contact us"}),this.renderAbout()]})]})}renderAboutLi(h,g,_){return At("li",{children:At(Rn,{href:g,children:[h,_??At(Hl,{name:"launch"})]})})}renderAbout(){return At(yt,{children:[At("h6",{children:"About Basemaps"}),At("ul",{class:"about-links",children:[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()),At("li",{children:At(Rn,{href:"https://github.com/linz/basemaps/blob/master/CHANGELOG.md",children:["Version ",At("span",{class:"basemaps-version",children:It.Version})]})})]})]})}renderGithubLogo(){return At("svg",{style:"width: 24px; height: 24px",viewBox:"0 0 24 24",children:At("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 At(yt,{children:[At("h6",{children:"90 day API keys"}),At("p",{children:"API keys expire after 90 days, if a longer duration is needed please request a developer API key"}),At(fs,{header:"Api Key",value:It.ApiKey}),this.renderLinksTiles()]})}validProjections(){return this.state.layers==null?this._validProjections:this.state.layers.get(It.map.layerId)?.projections??this._validProjections}renderLinksTiles(){if(It.map.isVector)return At(yt,{children:[At(fs,{header:"StyleJSON",value:It.map.toTileUrl("style")}),At(fs,{header:"XYZ",value:It.map.toTileUrl("vector-xyz")})]});let h=this.validProjections(),g=[];if(h.has(Ze.Nztm2000)){let _=It.map.toTileUrl("wmts",Pn);g.push(At(fs,{header:"WMTS: NZTM2000Quad",value:_}))}if(h.has(Ze.Google)){let _=It.map.toTileUrl("wmts",Ye),a=It.map.toTileUrl("raster",Ye);g.push(At(fs,{header:"WMTS: WebMercatorQuad",value:_})),g.push(At(fs,{header:"XYZ",value:a}))}return At(yt,{children:g})}};W();var Lo=Ns(Ac(),1);Qr();W();W();W();function Mg(n){let o=document.createElement("span");return o.textContent=n,o.innerHTML}var _p=class{constructor(o){this.boundaries=[],this.collection=o;let h=o.summaries["linz:zoom"];this.minZoom=h.min,this.maxZoom=h.max,this.bbox=o.extent.spatial.bbox[0]}intersects(o,h){return h>this.maxZoom||h<this.minZoom||!Gs.intersects(o,this.bbox)?!1:this.intersection(Gs.bboxToMultiPolygon(o))}intersection(o){for(let h of this.boundaries)if(Yu(h,o).length>0)return!0;return!1}addBoundary(o){U1(o),this.boundaries.push(o)}};function U1(n){for(let o of n)for(let h of o)if(h.length!==2)throw new Error("Invalid ring wrong length")}function V1(n){var o;let h=new Map,g=[];for(let _ of n.collections){let a=new _p(_);g.push(a),h.set(_.id,a)}for(let _ of n.features){let a=h.get((o=_.collection)!==null&&o!==void 0?o:"");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 M of _.geometry.coordinates)a.addBoundary(M)}return g}function Sg(n){let{interval:o}=n.extent.temporal;if(o==null||o.length===0)return[-1,-1];let h=o[0],g=new Date(h[0]).getFullYear(),_=(h.length<2?g:new Date(h[1]).getFullYear())-1;return[g,_<g?g:_]}var $s=class{constructor(o){this.attributions=o}static async load(o){let h=await fetch(o);if(h.ok){let g=await h.json();return $s.fromStac(g)}throw new Error(`fetch attribution failed [${h.status}] ${h.statusText}`)}static fromStac(o){return new $s(V1(o).reverse())}filter(o,h){h=Math.round(h);let g=[],{attributions:_}=this;if(_==null)return g;for(let a of _)this.isIgnored!=null&&this.isIgnored(a)||a.intersects(o,h)&&g.push(a.collection);return g}renderList(o){if(o.length===0)return"";let h=Mg(o[0].title);if(o.length>1)if(o.length===2)h+=` & ${Mg(o[1].title)}`;else{let[g,_]=Sg(o[1]);for(let a=1;a<o.length;++a){let[M,S]=Sg(o[a]);M!==-1&&(g===-1||M<g)&&(g=M),S!==-1&&(_===-1||S>_)&&(_=S)}g===-1&&(g=_),_!==-1&&(h+=` & others ${g}-${_}`)}return h}};var Xl=Ns(Ac(),1);var Tg=`\xA9 ${ff.License} LINZ`,Pc=new Map,Eg=new Map,zc=class{constructor(o){this._raf=0;this.attributionHtml="";this.bounds=new Xl.LngLatBounds([0,0,0,0]);this.zoom=-1;this.filteredRecords=[];this.resetAttribution=()=>{this.attributionHtml="",this.updateAttribution()};this.updateAttribution=()=>{if(It.map.isVector)return this.vectorAttribution();let o=It.map.layerKeyTms,h=Pc.get(o);h==null&&(h=$s.load(It.map.toTileUrl("attribution")).catch(()=>null),Pc.set(o,h),h.then(g=>{g!=null&&(g.isIgnored=this.isIgnored,Eg.set(o,g),this.scheduleRender())})),this.scheduleRender()};this.isIgnored=o=>{let h=o.collection.title.toLowerCase();return h.startsWith("geographx")||h.includes(" dem ")};this.renderAttribution=()=>{this._raf=0;let o=Eg.get(It.map.layerKeyTms);if(o==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,It.map.tileMatrix),g=o.filter(h,this.zoom),_=o.renderList(g);if(_===""?_=Tg:_=Tg+" - "+_,_!==this.attributionHtml){let a=this.attributionHtml=_;this.removeAttribution(),this.attributionControl=new Xl.default.AttributionControl({compact:!1,customAttribution:a}),this.map.addControl(this.attributionControl,"bottom-right")}this.filteredRecords=g};this.map=o,Ws(o,this.resetAttribution),o.on("move",this.updateAttribution),It.map.on("tileMatrix",this.resetAttribution),It.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(o,h){let g={lon:o.getWest(),lat:o.getSouth(),zoom:this.zoom},_={lon:o.getEast(),lat:o.getNorth(),zoom:this.zoom},a=Dn(g,Ye,h),M=Dn(_,Ye,h);return[a.lon,a.lat,M.lon,M.lat]}vectorAttribution(){this.removeAttribution(),this.attributionControl=new Xl.default.AttributionControl({compact:!1}),this.map.addControl(this.attributionControl,"bottom-right")}};W();Qr();W();var ms=class{static getTileSet(o){let h=fi.toConfigUrl(o),g=this.tileSets.get(h);return g||(g=fetch(h).then(_=>_.ok?_.json():null),this.tileSets.set(h,g),g)}static getImagery(o,h){let g=fi.toConfigImageryUrl(o,h),_=this.imagery.get(g);return _||(_=fetch(g).then(a=>a.ok?a.json():null),this.imagery.set(g,_),_)}static getGeoJson(o){let h=ns.find(o.tileMatrix);if(h!=null)return Ln.get(h).toGeoJson(o.files)}};ms.tileSets=new Map,ms.imagery=new Map;W();var kc=class{constructor(){this._layerLoading=new Map;this._source=new Map;this._styleJson=null;this.adjustTopographic=o=>{let h=o.target;It.map.setDebug("debug.layer.linz-topographic",Number(h.value))};this.adjustOsm=o=>{It.map.setDebug("debug.layer.osm",Number(o.target.value))};this.adjustLinzAerial=o=>{It.map.setDebug("debug.layer.linz-aerial",Number(o.target.value))};this.togglePurple=o=>{let h=o.target;this.setPurple(h.checked)}}loadSourceLayer(o,h,g,_){let a=`${h}-${_}`,M=this._layerLoading.get(a);return M==null&&(M=this._loadSourceLayer(o,h,g,_),this._layerLoading.set(a,M)),M}async _loadSourceLayer(o,h,g,_){let a=`${h}_${_}`,M=`${a}_fill`;if(o.getLayer(M)!=null)return;let S=await this.fetchSourceLayer(g.id,_);if(S==null&&_==="source"&&(S=ms.getGeoJson(g)),S==null)return;It.map.tileMatrix.projection!==Ye.projection&&yg(S,It.map.tileMatrix);let D=0;for(let N of S.features)N.id=D++;o.addSource(a,{type:"geojson",data:S})}async fetchSourceLayer(o,h){let g=`${o}_${h}`,_=this._source.get(g);if(_==null){let a=fi.toImageryUrl(o,h==="source"?"source.geojson":"covering.geojson"),M=await fetch(a);if(!M.ok)return;_=await M.json()}return _}get styleJson(){return this._styleJson==null&&(this._styleJson=fetch(fi.toTileUrl("style",It.map.tileMatrix,"topographic","topographic",null)).then(o=>o.json())),this._styleJson}async adjustVector(o,h){let g=await this.styleJson;if(o.getSource("LINZ Basemaps")==null){if(h===0)return;let M=g.sources?.["LINZ Basemaps"];if(M==null)return;o.addSource("LINZ Basemaps",M),o.setStyle({...o.getStyle(),glyphs:g.glyphs,sprite:g.sprite}),o.once("style.load",()=>this.adjustVector(o,h));return}let a=g.layers?.filter(M=>M.type!=="background"&&M.source==="LINZ Basemaps")??[];if(It.map.layerId!=="topographic"){for(let M of a){let S=M.paint??{};M.type==="symbol"?(S["icon-opacity"]=0,S["text-opacity"]=0):S[`${M.type}-opacity`]=0,M.paint=S}if(h===0){for(let M of a)o.getLayer(M.id)!=null&&o.removeLayer(M.id);return}if(o.getLayer(a[0].id)==null){if(h===0)return;for(let M of a)o.addLayer(M)}for(let M of a)o.getLayer(M.id)!=null&&(M.type==="symbol"?(o.setPaintProperty(M.id,"icon-opacity",h),o.setPaintProperty(M.id,"text-opacity",h)):o.setPaintProperty(M.id,`${M.type}-opacity`,h))}}adjustRaster(o,h,g){o.getSource(h)==null&&o.addSource(h,{type:"raster",tiles:[this.getTileServerUrl(h)],tileSize:256});let _=o.getLayer(h)==null;if(g===0){_||o.removeLayer(h);return}if(_){o.addLayer({id:h,type:"raster",source:h,minzoom:0,maxzoom:24,paint:{"raster-opacity":0}});let a=`${It.map.layerId}_source_fill`;o.getLayer(a)!=null&&o.moveLayer(h,a)}o.setPaintProperty(h,"raster-opacity",g)}setPurple(o){It.map.setDebug("debug.background",o?"magenta":!1),o?document.body.style.backgroundColor="magenta":document.body.style.backgroundColor=""}getTileServerUrl(o){if(o==="osm")return"https://tile.openstreetmap.org/{z}/{x}/{y}.png";if(o==="linz-aerial")return fi.toTileUrl("raster",It.map.tileMatrix,"aerial",void 0,null);throw new Error("Unknown tile server")}};function Lc(n,o){return At("input",{className:"debug__slider",type:"range",min:"0",max:"1",step:"0.05",value:String(It.map.debug[`debug.layer.${n}`]),onInput:o})}var Dc=class extends Ii{constructor(){super(...arguments);this.debugMap=new kc;this.waitForMap=()=>{let h=this.props.map;if(h==null){setTimeout(this.waitForMap,20);return}window.MaplibreMap=h,h.resize(),Ws(h,()=>{It.map.on("change",()=>{if(this.props.map==null)return;let g=fi.toHash(It.map.getLocation(this.props.map)),_="?"+en.toUrl(It.map);window.history.replaceState(null,"",_+g),this.updateFromConfig()}),this.updateFromConfig(),It.map.debug["debug.screenshot"]&&h.once("idle",async()=>{await Promise.all([...Pc.values()]),await new Promise(_=>setTimeout(_,250));let g=document.createElement("div");g.id="map-loaded",g.style.width="1px",g.style.height="1px",document.body.appendChild(g)})})};this.toggleCogs=h=>{let g=h.target;It.map.setDebug("debug.cog",g.checked),this.setVectorShown(g.checked,"cog")};this.toggleSource=h=>{let g=h.target;It.map.setDebug("debug.source",g.checked),this.setVectorShown(g.checked,"source")};this._loadingConfig=Promise.resolve()}componentDidMount(){this.waitForMap()}updateFromConfig(){(this.state.tileSet?.id!==It.map.layerId||this.state.config!==It.map.config)&&(this._loadingConfig=this._loadingConfig.then(()=>this.loadConfig())),this.debugMap.setPurple(It.map.debug["debug.background"]==="magenta"),this.debugMap.adjustRaster(this.props.map,"osm",It.map.debug["debug.layer.osm"]),this.debugMap.adjustRaster(this.props.map,"linz-aerial",It.map.debug["debug.layer.linz-aerial"]),this.debugMap.adjustVector(this.props.map,It.map.debug["debug.layer.linz-topographic"]),this.setVectorShown(It.map.debug["debug.source"],"source"),this.setVectorShown(It.map.debug["debug.cog"],"cog")}async loadConfig(){let h=It.map.layerId;if(this.state.tileSet?.id!==h)return ms.getTileSet(h).then(g=>{if(this.setState({...this.state,tileSet:g,config:It.map.config}),g==null||g.layers.length!==1)return;let _=It.map.tileMatrix.projection.code,a=g.layers[0][_];if(a!=null)return this.debugMap.fetchSourceLayer(a,"cog").then(M=>{M!=null?this.setState({...this.state,isCog:!0}):this.setState({...this.state,isCog:!1})}),ms.getImagery(h,a).then(M=>{this.setState({...this.state,imagery:M,config:It.map.config})})})}render(){return It.map.debug["debug.screenshot"]?null:At("div",{className:"debug",children:[At("div",{className:"debug__info",children:[At("label",{className:"debug__label",children:"ImageId"}),At("div",{className:"debug__value",children:It.map.layerId})]}),At("div",{className:"debug__info",children:[At("label",{className:"debug__label",children:"Projection "}),At("div",{className:"debug__value",children:It.map.tileMatrix.projection.toEpsgString()})]}),At("div",{className:"debug__info",children:[At("label",{className:"debug__label",children:"TileMatrix "}),At("div",{className:"debug__value",children:It.map.tileMatrix.identifier})]}),this.renderSliders(),this.renderPurple(),this.renderCogToggle(),this.renderSourceToggle()]})}renderPurple(){if(!It.map.debug["debug.screenshot"])return At("div",{className:"debug__info",children:[At("label",{className:"debug__label",children:"Purple"}),At("input",{type:"checkbox",onClick:this.debugMap.togglePurple,checked:It.map.debug["debug.background"]==="magenta"})]})}renderCogToggle(){if(this.state.imagery==null)return null;let h=fi.toImageryUrl(this.state.imagery.id,"covering.geojson");if(!!this.state.isCog)return At(yt,{children:[At("div",{className:"debug__info",children:[At("label",{className:"debug__label",children:At("a",{href:h,title:"Source geojson",children:"Cogs"})}),At("input",{type:"checkbox",onClick:this.toggleCogs,checked:It.map.debug["debug.cog"]})]}),this.state.featureSourceId==null?null:At("div",{className:"debug__info",title:String(this.state.featureCogName),children:[At("label",{className:"debug__label",children:"CogId"}),String(this.state.featureCogName).split("/").pop()]})]})}renderSourceToggle(){if(this.state.imagery==null)return null;let h=fi.toImageryUrl(this.state.imagery.id,"source.geojson");return At(yt,{children:[At("div",{className:"debug__info",children:[At("label",{className:"debug__label",children:At("a",{href:h,title:"Source geojson",children:"Source"})}),At("input",{type:"checkbox",onClick:this.toggleSource,checked:It.map.debug["debug.source"]})]}),this.state.featureSourceId==null?null:At("div",{className:"debug__info",title:String(this.state.featureSourceName),children:[At("label",{className:"debug__label",children:"SourceId"}),String(this.state.featureSourceName).split("/").pop()]})]})}renderSliders(){if(!It.map.debug["debug.screenshot"])return It.map.tileMatrix.identifier!==Ye.identifier?At("div",{className:"debug__info",children:[At("label",{className:"debug__label",children:"LINZ Aerial"}),Lc("linz-aerial",this.debugMap.adjustLinzAerial)]}):At(yt,{children:[At("div",{className:"debug__info",children:[At("label",{className:"debug__label",children:"OSM"}),Lc("osm",this.debugMap.adjustOsm)]}),At("div",{className:"debug__info",children:[At("label",{className:"debug__label",children:"Topographic"}),Lc("linz-topographic",this.debugMap.adjustTopographic)]}),At("div",{className:"debug__info",children:[At("label",{className:"debug__label",children:"LINZ Aerial"}),Lc("linz-aerial",this.debugMap.adjustLinzAerial)]})]})}trackMouseMove(h,g){let _=`${h}_${g}`,a=`${_}_fill`,M=this.props.map,S,D=g==="source"?"featureSource":"featureCog";M.on("mousemove",a,N=>{let L=N.features;if(L==null||L.length===0)return;let Q=L[0];Q.id!==S&&(S!=null&&M.setFeatureState({source:_,id:S},{hover:!1}),S=Q.id,this.setState({...this.state,[`${D}Id`]:S,[`${D}Name`]:Q.properties?.name}),M.setFeatureState({source:_,id:S},{hover:!0}))}),M.on("mouseleave",a,()=>{S!=null&&(M.setFeatureState({source:_,id:S},{hover:!1}),S=void 0,this.setState({...this.state,[`${D}Id`]:void 0,[`${D}Name`]:void 0}))})}setVectorShown(h,g){let _=this.props.map,a=It.map.layerId,M=`${a}_${g}`,S=`${M}_fill`,D=`${M}_line`;if(h===!1){if(_.getLayer(S)==null)return;_.removeLayer(S),_.removeLayer(D);return}if(_.getLayer(D)!=null)return;let N=g==="source"?"#ff00ff":"#ff0000";this.state.imagery!=null&&this.debugMap.loadSourceLayer(this.props.map,a,this.state.imagery,g).then(()=>{_.getLayer(D)==null&&(_.addLayer({id:S,type:"fill",source:M,paint:{"fill-opacity":["case",["boolean",["feature-state","hover"],!1],.25,0],"fill-color":N}}),this.trackMouseMove(a,g),_.addLayer({id:D,type:"line",source:M,paint:{"line-color":N,"line-opacity":["case",["boolean",["feature-state","hover"],!1],1,.5],"line-width":["case",["boolean",["feature-state","hover"],!1],2,1]}}))})}};W();var Ig=Ns(Ac(),1);Qr();var Rc=class extends Ii{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=It.map.transformedLocation,g=this.getStyleType(),_=`${g.layerId}::${g.style}`;if(this.currentStyle!==_){let M=ko(It.map.tileMatrix.identifier).getStyle(g.layerId,g.style);this.currentStyle=_,this.map.setStyle(M)}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();It.map.setLayerId(h.layerId,h.style),this.updateMap(),window.history.pushState(null,"",`?${en.toUrl(It.map)}`)}}componentDidMount(){if(It.map.updateFromUrl(),this.el=document.getElementById("map-switcher-map"),this.el==null)return;let h=It.map,g=ko(h.tileMatrix.identifier),_=this.getStyleType();this.currentStyle=`${_.layerId}::${_.style}`;let a=g.getStyle(_.layerId,_.style),M=h.transformedLocation;this.map=new Ig.default.Map({container:this.el,style:a,center:[M.lon,M.lat],zoom:M.zoom,attributionControl:!1}),Ws(this.map,()=>{this._events.push(It.map.on("location",this.update),It.map.on("tileMatrix",this.update),It.map.on("layer",this.update),It.map.on("bounds",this.update)),this.updateMap()})}componentWillUnmount(){this.map&&this.map.remove();for(let h of this._events)h()}getStyleType(){return It.map.layerId!=="aerial"?{layerId:"aerial"}:{layerId:"topographic",style:"topographic"}}render(){let h=`Switch map to ${this.getStyleType().layerId}`;return At("div",{id:"map-switcher",class:"map-switcher",onClick:this.switchLayer,title:h,children:At("div",{id:"map-switcher-map",style:{width:"100%",height:"100%",pointerEvents:"none"}})})}};function Ws(n,o){if(n.loaded())return o();setTimeout(()=>Ws(n,o),100)}var Bc=class extends Ii{constructor(){super(...arguments);this.ignoreNextLocationUpdate=!1;this.updateLocation=()=>{if(this.ignoreNextLocationUpdate){this.ignoreNextLocationUpdate=!1;return}let h=It.map.location;this.map.setZoom(h.zoom),this.map.setCenter([h.lon,h.lat])};this.updateBounds=h=>{if(It.map.tileMatrix!==Ye){let g=Lo.default.LngLatBounds.convert(h),_=g.getNorthEast(),a=g.getSouthWest(),M=this.map.getZoom(),S=Dn({lat:_.lat,lon:_.lng,zoom:M},It.map.tileMatrix,Ye),D=Dn({lat:a.lat,lon:a.lng,zoom:M},It.map.tileMatrix,Ye);h=[[S.lon,S.lat],[D.lon,D.lat]]}this.map.fitBounds(h)};this.updateStyle=()=>{this.ensureGeoControl();let g=ko(It.map.tileMatrix.identifier).getStyle(It.map.layerId,It.map.style);this.map.setStyle(g),It.map.tileMatrix!==Ye?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(!It.map.debug["debug.screenshot"])if(It.map.tileMatrix===Ye){if(this.controlGeo!=null)return;this.controlGeo=new Lo.default.GeolocateControl({}),this.map.addControl(this.controlGeo,"top-left")}else{if(this.controlGeo==null)return;this.map.removeControl(this.controlGeo)}}componentDidMount(){if(It.map.updateFromUrl(),this.el=document.getElementById("map"),this.el==null)throw new Error("Unable to find #map element");let h=It.map,_=ko(h.tileMatrix.identifier).getStyle(h.layerId,h.style),a=Dn(h.location,h.tileMatrix,Ye);if(this.map=new Lo.default.Map({container:this.el,style:_,center:[a.lon,a.lat],zoom:a.zoom,attributionControl:!1}),this.mapAttr=new zc(this.map),It.map.debug["debug.screenshot"]!==!0){let M=new Lo.default.NavigationControl({visualizePitch:!0});this.map.addControl(M,"top-left"),It.map.isDebug||this.map.addControl(new Lo.default.FullscreenControl({container:this.el}))}this.map.on("render",this.onRender),Ws(this.map,()=>{this._events.push(It.map.on("location",this.updateLocation),It.map.on("tileMatrix",this.updateStyle),It.map.on("layer",this.updateStyle),It.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=It.map.tileMatrix===Ye&&!It.map.isDebug;return At("div",{style:{flex:1,position:"relative"},children:[At("div",{id:"map",style:{width:"100%",height:"100%"}}),It.map.isDebug?At(Dc,{map:this.map}):void 0,h?At(Rc,{}):void 0]})}setLocationUrl(){this.updateUrlTimer=null;let h=It.map.getLocation(this.map);this.ignoreNextLocationUpdate=!0,It.map.setLocation(h);let g=fi.toHash(h);window.history.replaceState(null,"",g)}};W();var G1="data:image/webp;base64,UklGRiQAAABXRUJQVlA4IBgAAAAwAQCdASoBAAEAAwA0JaQAA3AA/vuUAAA=";function q1(){let n=document.createElement("canvas");return n.getContext&&n.getContext("2d")?n.toDataURL("image/webp").indexOf("data:image/webp")===0:!1}function j1(){let n=new Image,o=new Promise(h=>{n.onload=()=>h(!0),n.onerror=()=>h(!1)});return n.src=G1,o}function Cg(){return new Promise(n=>{if(q1())return n(!0);j1().then(n)})}var xp=class extends Ii{render(){return At(yt,{children:[At(Cc,{}),At(Bc,{}),At(Tc,{})]})}};document.addEventListener("DOMContentLoaded",async()=>{await await Cg()&&(fi.ImageFormat="webp"),It.map.updateFromUrl();let o=document.getElementById("main");if(o==null)throw new Error("Missing #main");sf(At(xp,{}),o)});
560
560
  /**
561
561
  * splaytree v3.1.0
562
562
  * Fast Splay tree for Node and browser