@geolonia/embed 4.2.0 → 4.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/embed CHANGED
@@ -1 +1 @@
1
- !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.geoloniaEmbed=e():t.geoloniaEmbed=e()}(self,(()=>(()=>{var t,e,i,r,n={6613:t=>{function e(t){if(!(this instanceof e))return new e(t);this._bbox=t||[1/0,1/0,-1/0,-1/0],this._valid=!!t}t.exports=e,e.prototype.include=function(t){return this._valid=!0,this._bbox[0]=Math.min(this._bbox[0],t[0]),this._bbox[1]=Math.min(this._bbox[1],t[1]),this._bbox[2]=Math.max(this._bbox[2],t[0]),this._bbox[3]=Math.max(this._bbox[3],t[1]),this},e.prototype.equals=function(t){var i;return i=t instanceof e?t.bbox():t,this._bbox[0]==i[0]&&this._bbox[1]==i[1]&&this._bbox[2]==i[2]&&this._bbox[3]==i[3]},e.prototype.center=function(t){return this._valid?[(this._bbox[0]+this._bbox[2])/2,(this._bbox[1]+this._bbox[3])/2]:null},e.prototype.union=function(t){var i;return this._valid=!0,i=t instanceof e?t.bbox():t,this._bbox[0]=Math.min(this._bbox[0],i[0]),this._bbox[1]=Math.min(this._bbox[1],i[1]),this._bbox[2]=Math.max(this._bbox[2],i[2]),this._bbox[3]=Math.max(this._bbox[3],i[3]),this},e.prototype.bbox=function(){return this._valid?this._bbox:null},e.prototype.contains=function(t){if(!t)return this._fastContains();if(!this._valid)return null;var e=t[0],i=t[1];return this._bbox[0]<=e&&this._bbox[1]<=i&&this._bbox[2]>=e&&this._bbox[3]>=i},e.prototype.intersect=function(t){return this._valid?(i=t instanceof e?t.bbox():t,!(this._bbox[0]>i[2]||this._bbox[2]<i[0]||this._bbox[3]<i[1]||this._bbox[1]>i[3])):null;var i},e.prototype._fastContains=function(){if(!this._valid)return new Function("return null;");var t="return "+this._bbox[0]+"<= ll[0] &&"+this._bbox[1]+"<= ll[1] &&"+this._bbox[2]+">= ll[0] &&"+this._bbox[3]+">= ll[1]";return new Function("ll",t)},e.prototype.polygon=function(){return this._valid?{type:"Polygon",coordinates:[[[this._bbox[0],this._bbox[1]],[this._bbox[2],this._bbox[1]],[this._bbox[2],this._bbox[3]],[this._bbox[0],this._bbox[3]],[this._bbox[0],this._bbox[1]]]]}:null}},7829:t=>{t.exports=function(t){return function t(e){return Array.isArray(e)&&e.length&&"number"==typeof e[0]?[e]:e.reduce((function(e,i){return Array.isArray(i)&&Array.isArray(i[0])?e.concat(t(i)):(e.push(i),e)}),[])}(t)}},4506:(t,e,i)=>{var r=i(9340),n=i(63),o=i(7829);n instanceof Function||(n=n.default),t.exports=function(t){if(!t)return[];var e=n(r(t)),i=[];return e.features.forEach((function(t){t.geometry&&(i=i.concat(o(t.geometry.coordinates)))})),i}},9319:(t,e,i)=>{var r=i(4506),n=i(3692),o=i(6613),a={features:["FeatureCollection"],coordinates:["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],geometry:["Feature"],geometries:["GeometryCollection"]},s=Object.keys(a);function l(t){for(var e=o(),i=r(t),n=0;n<i.length;n++)e.include(i[n]);return e}t.exports=function(t){return l(t).bbox()},t.exports.polygon=function(t){return l(t).polygon()},t.exports.bboxify=function(t){return n(t).map((function(t){t&&s.some((function(e){return!!t[e]&&-1!==a[e].indexOf(t.type)}))&&(t.bbox=l(t).bbox(),this.update(t))}))}},9340:t=>{t.exports=function(t){if(!t||!t.type)return null;var i=e[t.type];return i?"geometry"===i?{type:"FeatureCollection",features:[{type:"Feature",properties:{},geometry:t}]}:"feature"===i?{type:"FeatureCollection",features:[t]}:"featurecollection"===i?t:void 0:null};var e={Point:"geometry",MultiPoint:"geometry",LineString:"geometry",MultiLineString:"geometry",Polygon:"geometry",MultiPolygon:"geometry",GeometryCollection:"geometry",Feature:"feature",FeatureCollection:"featurecollection"}},5550:t=>{"use strict";function e(t,e){this.x=t,this.y=e}t.exports=e,e.prototype={clone:function(){return new e(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},multByPoint:function(t){return this.clone()._multByPoint(t)},divByPoint:function(t){return this.clone()._divByPoint(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},rotateAround:function(t,e){return this.clone()._rotateAround(t,e)},matMult:function(t){return this.clone()._matMult(t)},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(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var e=t.x-this.x,i=t.y-this.y;return e*e+i*i},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult:function(t){var e=t[0]*this.x+t[1]*this.y,i=t[2]*this.x+t[3]*this.y;return this.x=e,this.y=i,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_multByPoint:function(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint:function(t){return this.x/=t.x,this.y/=t.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var e=Math.cos(t),i=Math.sin(t),r=e*this.x-i*this.y,n=i*this.x+e*this.y;return this.x=r,this.y=n,this},_rotateAround:function(t,e){var i=Math.cos(t),r=Math.sin(t),n=e.x+i*(this.x-e.x)-r*(this.y-e.y),o=e.y+r*(this.x-e.x)+i*(this.y-e.y);return this.x=n,this.y=o,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},e.convert=function(t){return t instanceof e?t:Array.isArray(t)?new e(t[0],t[1]):t}},7274:(t,e,i)=>{"use strict";i.d(e,{Z:()=>mt});var r=i(8081),n=i.n(r),o=i(3645),a=i.n(o),s=i(1667),l=i.n(s),c=new URL(i(1683),i.b),h=new URL(i(8202),i.b),u=new URL(i(883),i.b),p=new URL(i(2672),i.b),d=new URL(i(1880),i.b),m=new URL(i(8866),i.b),f=new URL(i(7164),i.b),g=new URL(i(1319),i.b),_=new URL(i(2398),i.b),y=new URL(i(2052),i.b),x=new URL(i(9594),i.b),v=new URL(i(5404),i.b),b=new URL(i(4891),i.b),w=new URL(i(3083),i.b),E=new URL(i(8634),i.b),T=new URL(i(7260),i.b),S=new URL(i(7118),i.b),C=new URL(i(1427),i.b),I=new URL(i(4750),i.b),A=new URL(i(9490),i.b),M=new URL(i(4178),i.b),k=new URL(i(8622),i.b),z=new URL(i(6703),i.b),P=new URL(i(5654),i.b),L=new URL(i(7151),i.b),D=new URL(i(9837),i.b),R=new URL(i(3224),i.b),B=new URL(i(5032),i.b),F=new URL(i(3667),i.b),O=a()(n()),U=l()(c),V=l()(h),N=l()(u),$=l()(p),j=l()(d),q=l()(m),Z=l()(f),G=l()(g),H=l()(_),X=l()(y),W=l()(x),K=l()(v),Y=l()(b),J=l()(w),Q=l()(E),tt=l()(T),et=l()(S),it=l()(C),rt=l()(I),nt=l()(A),ot=l()(M),at=l()(k),st=l()(z),lt=l()(P),ct=l()(L),ht=l()(D),ut=l()(R),pt=l()(B),dt=l()(F);O.push([t.id,`.maplibregl-map{-webkit-tap-highlight-color:rgb(0 0 0/0);font:12px/20px Helvetica Neue,Arial,Helvetica,sans-serif;overflow:hidden;position:relative}.maplibregl-canvas{left:0;position:absolute;top:0}.maplibregl-map:fullscreen{height:100%;width:100%}.maplibregl-ctrl-group button.maplibregl-ctrl-compass{touch-action:none}.maplibregl-canvas-container.maplibregl-interactive,.maplibregl-ctrl-group button.maplibregl-ctrl-compass{cursor:grab;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none;user-select:none}.maplibregl-canvas-container.maplibregl-interactive.maplibregl-track-pointer{cursor:pointer}.maplibregl-canvas-container.maplibregl-interactive:active,.maplibregl-ctrl-group button.maplibregl-ctrl-compass:active{cursor:grabbing}.maplibregl-canvas-container.maplibregl-touch-zoom-rotate,.maplibregl-canvas-container.maplibregl-touch-zoom-rotate .maplibregl-canvas{touch-action:pan-x pan-y}.maplibregl-canvas-container.maplibregl-touch-drag-pan,.maplibregl-canvas-container.maplibregl-touch-drag-pan .maplibregl-canvas{touch-action:pinch-zoom}.maplibregl-canvas-container.maplibregl-touch-zoom-rotate.maplibregl-touch-drag-pan,.maplibregl-canvas-container.maplibregl-touch-zoom-rotate.maplibregl-touch-drag-pan .maplibregl-canvas{touch-action:none}.maplibregl-canvas-container.maplibregl-touch-drag-pan.maplibregl-cooperative-gestures,.maplibregl-canvas-container.maplibregl-touch-drag-pan.maplibregl-cooperative-gestures .maplibregl-canvas{touch-action:pan-x pan-y}.maplibregl-ctrl-bottom-left,.maplibregl-ctrl-bottom-right,.maplibregl-ctrl-top-left,.maplibregl-ctrl-top-right{pointer-events:none;position:absolute;z-index:2}.maplibregl-ctrl-top-left{left:0;top:0}.maplibregl-ctrl-top-right{right:0;top:0}.maplibregl-ctrl-bottom-left{bottom:0;left:0}.maplibregl-ctrl-bottom-right{bottom:0;right:0}.maplibregl-ctrl{clear:both;pointer-events:auto;transform:translate(0)}.maplibregl-ctrl-top-left .maplibregl-ctrl{float:left;margin:10px 0 0 10px}.maplibregl-ctrl-top-right .maplibregl-ctrl{float:right;margin:10px 10px 0 0}.maplibregl-ctrl-bottom-left .maplibregl-ctrl{float:left;margin:0 0 10px 10px}.maplibregl-ctrl-bottom-right .maplibregl-ctrl{float:right;margin:0 10px 10px 0}.maplibregl-ctrl-group{background:#fff;border-radius:4px}.maplibregl-ctrl-group:not(:empty){box-shadow:0 0 0 2px rgba(0,0,0,.1)}@media (-ms-high-contrast:active){.maplibregl-ctrl-group:not(:empty){box-shadow:0 0 0 2px ButtonText}}.maplibregl-ctrl-group button{background-color:transparent;border:0;box-sizing:border-box;cursor:pointer;display:block;height:29px;outline:none;padding:0;width:29px}.maplibregl-ctrl-group button+button{border-top:1px solid #ddd}.maplibregl-ctrl button .maplibregl-ctrl-icon{background-position:50%;background-repeat:no-repeat;display:block;height:100%;width:100%}@media (-ms-high-contrast:active){.maplibregl-ctrl-icon{background-color:transparent}.maplibregl-ctrl-group button+button{border-top:1px solid ButtonText}}.maplibregl-ctrl button::-moz-focus-inner{border:0;padding:0}.maplibregl-ctrl-attrib-button:focus,.maplibregl-ctrl-group button:focus{box-shadow:0 0 2px 2px #0096ff}.maplibregl-ctrl button:disabled{cursor:not-allowed}.maplibregl-ctrl button:disabled .maplibregl-ctrl-icon{opacity:.25}.maplibregl-ctrl button:not(:disabled):hover{background-color:rgb(0 0 0/5%)}.maplibregl-ctrl-group button:focus:focus-visible{box-shadow:0 0 2px 2px #0096ff}.maplibregl-ctrl-group button:focus:not(:focus-visible){box-shadow:none}.maplibregl-ctrl-group button:focus:first-child{border-radius:4px 4px 0 0}.maplibregl-ctrl-group button:focus:last-child{border-radius:0 0 4px 4px}.maplibregl-ctrl-group button:focus:only-child{border-radius:inherit}.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url(${U})}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url(${V})}@media (-ms-high-contrast:active){.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url(${N})}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url(${$})}}@media (-ms-high-contrast:black-on-white){.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url(${j})}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url(${q})}}.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url(${Z})}.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url(${G})}@media (-ms-high-contrast:active){.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url(${H})}.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url(${X})}}@media (-ms-high-contrast:black-on-white){.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url(${W})}.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url(${G})}}.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url(${K})}@media (-ms-high-contrast:active){.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url(${Y})}}@media (-ms-high-contrast:black-on-white){.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url(${J})}}.maplibregl-ctrl button.maplibregl-ctrl-terrain .maplibregl-ctrl-icon{background-image:url(${Q})}.maplibregl-ctrl button.maplibregl-ctrl-terrain-enabled .maplibregl-ctrl-icon{background-image:url(${tt})}.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url(${et})}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url(${it})}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active .maplibregl-ctrl-icon{background-image:url(${rt})}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active-error .maplibregl-ctrl-icon{background-image:url(${nt})}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background .maplibregl-ctrl-icon{background-image:url(${ot})}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background-error .maplibregl-ctrl-icon{background-image:url(${at})}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-waiting .maplibregl-ctrl-icon{animation:maplibregl-spin 2s linear infinite}@media (-ms-high-contrast:active){.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url(${st})}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url(${lt})}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active .maplibregl-ctrl-icon{background-image:url(${rt})}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active-error .maplibregl-ctrl-icon{background-image:url(${nt})}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background .maplibregl-ctrl-icon{background-image:url(${ot})}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background-error .maplibregl-ctrl-icon{background-image:url(${at})}}@media (-ms-high-contrast:black-on-white){.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url(${ct})}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url(${ht})}}@keyframes maplibregl-spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}a.maplibregl-ctrl-logo{background-image:url(${ut});background-repeat:no-repeat;cursor:pointer;display:block;height:23px;margin:0 0 -4px -4px;overflow:hidden;width:88px}a.maplibregl-ctrl-logo.maplibregl-compact{width:14px}@media (-ms-high-contrast:active){a.maplibregl-ctrl-logo{background-color:transparent;background-image:url(${ut})}}@media (-ms-high-contrast:black-on-white){a.maplibregl-ctrl-logo{background-image:url(${ut})}}.maplibregl-ctrl.maplibregl-ctrl-attrib{background-color:hsla(0,0%,100%,.5);margin:0;padding:0 5px}@media screen{.maplibregl-ctrl-attrib.maplibregl-compact{background-color:#fff;border-radius:12px;box-sizing:content-box;margin:10px;min-height:20px;padding:2px 24px 2px 0;position:relative}.maplibregl-ctrl-attrib.maplibregl-compact-show{padding:2px 28px 2px 8px;visibility:visible}.maplibregl-ctrl-bottom-left>.maplibregl-ctrl-attrib.maplibregl-compact-show,.maplibregl-ctrl-top-left>.maplibregl-ctrl-attrib.maplibregl-compact-show{border-radius:12px;padding:2px 8px 2px 28px}.maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-inner{display:none}.maplibregl-ctrl-attrib-button{background-color:hsla(0,0%,100%,.5);background-image:url(${pt});border:0;border-radius:12px;box-sizing:border-box;cursor:pointer;display:none;height:24px;outline:none;position:absolute;right:0;top:0;width:24px}.maplibregl-ctrl-attrib summary.maplibregl-ctrl-attrib-button{appearance:none;list-style:none}.maplibregl-ctrl-attrib summary.maplibregl-ctrl-attrib-button::-webkit-details-marker{display:none}.maplibregl-ctrl-bottom-left .maplibregl-ctrl-attrib-button,.maplibregl-ctrl-top-left .maplibregl-ctrl-attrib-button{left:0}.maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-button,.maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-inner{display:block}.maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-button{background-color:rgb(0 0 0/5%)}.maplibregl-ctrl-bottom-right>.maplibregl-ctrl-attrib.maplibregl-compact:after{bottom:0;right:0}.maplibregl-ctrl-top-right>.maplibregl-ctrl-attrib.maplibregl-compact:after{right:0;top:0}.maplibregl-ctrl-top-left>.maplibregl-ctrl-attrib.maplibregl-compact:after{left:0;top:0}.maplibregl-ctrl-bottom-left>.maplibregl-ctrl-attrib.maplibregl-compact:after{bottom:0;left:0}}@media screen and (-ms-high-contrast:active){.maplibregl-ctrl-attrib.maplibregl-compact:after{background-image:url(${dt})}}@media screen and (-ms-high-contrast:black-on-white){.maplibregl-ctrl-attrib.maplibregl-compact:after{background-image:url(${pt})}}.maplibregl-ctrl-attrib a{color:rgba(0,0,0,.75);text-decoration:none}.maplibregl-ctrl-attrib a:hover{color:inherit;text-decoration:underline}.maplibregl-attrib-empty{display:none}.maplibregl-ctrl-scale{background-color:hsla(0,0%,100%,.75);border:2px solid #333;border-top:#333;box-sizing:border-box;color:#333;font-size:10px;padding:0 5px}.maplibregl-popup{display:flex;left:0;pointer-events:none;position:absolute;top:0;will-change:transform}.maplibregl-popup-anchor-top,.maplibregl-popup-anchor-top-left,.maplibregl-popup-anchor-top-right{flex-direction:column}.maplibregl-popup-anchor-bottom,.maplibregl-popup-anchor-bottom-left,.maplibregl-popup-anchor-bottom-right{flex-direction:column-reverse}.maplibregl-popup-anchor-left{flex-direction:row}.maplibregl-popup-anchor-right{flex-direction:row-reverse}.maplibregl-popup-tip{border:10px solid transparent;height:0;width:0;z-index:1}.maplibregl-popup-anchor-top .maplibregl-popup-tip{align-self:center;border-bottom-color:#fff;border-top:none}.maplibregl-popup-anchor-top-left .maplibregl-popup-tip{align-self:flex-start;border-bottom-color:#fff;border-left:none;border-top:none}.maplibregl-popup-anchor-top-right .maplibregl-popup-tip{align-self:flex-end;border-bottom-color:#fff;border-right:none;border-top:none}.maplibregl-popup-anchor-bottom .maplibregl-popup-tip{align-self:center;border-bottom:none;border-top-color:#fff}.maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip{align-self:flex-start;border-bottom:none;border-left:none;border-top-color:#fff}.maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip{align-self:flex-end;border-bottom:none;border-right:none;border-top-color:#fff}.maplibregl-popup-anchor-left .maplibregl-popup-tip{align-self:center;border-left:none;border-right-color:#fff}.maplibregl-popup-anchor-right .maplibregl-popup-tip{align-self:center;border-left-color:#fff;border-right:none}.maplibregl-popup-close-button{background-color:transparent;border:0;border-radius:0 3px 0 0;cursor:pointer;position:absolute;right:0;top:0}.maplibregl-popup-close-button:hover{background-color:rgb(0 0 0/5%)}.maplibregl-popup-content{background:#fff;border-radius:3px;box-shadow:0 1px 2px rgba(0,0,0,.1);padding:15px 10px;pointer-events:auto;position:relative}.maplibregl-popup-anchor-top-left .maplibregl-popup-content{border-top-left-radius:0}.maplibregl-popup-anchor-top-right .maplibregl-popup-content{border-top-right-radius:0}.maplibregl-popup-anchor-bottom-left .maplibregl-popup-content{border-bottom-left-radius:0}.maplibregl-popup-anchor-bottom-right .maplibregl-popup-content{border-bottom-right-radius:0}.maplibregl-popup-track-pointer{display:none}.maplibregl-popup-track-pointer *{pointer-events:none;user-select:none}.maplibregl-map:hover .maplibregl-popup-track-pointer{display:flex}.maplibregl-map:active .maplibregl-popup-track-pointer{display:none}.maplibregl-marker{left:0;position:absolute;top:0;will-change:transform}.maplibregl-user-location-dot,.maplibregl-user-location-dot:before{background-color:#1da1f2;border-radius:50%;height:15px;width:15px}.maplibregl-user-location-dot:before{animation:maplibregl-user-location-dot-pulse 2s infinite;content:"";position:absolute}.maplibregl-user-location-dot:after{border:2px solid #fff;border-radius:50%;box-shadow:0 0 3px rgba(0,0,0,.35);box-sizing:border-box;content:"";height:19px;left:-2px;position:absolute;top:-2px;width:19px}@keyframes maplibregl-user-location-dot-pulse{0%{opacity:1;transform:scale(1)}70%{opacity:0;transform:scale(3)}to{opacity:0;transform:scale(1)}}.maplibregl-user-location-dot-stale{background-color:#aaa}.maplibregl-user-location-dot-stale:after{display:none}.maplibregl-user-location-accuracy-circle{background-color:#1da1f233;border-radius:100%;height:1px;width:1px}.maplibregl-crosshair,.maplibregl-crosshair .maplibregl-interactive,.maplibregl-crosshair .maplibregl-interactive:active{cursor:crosshair}.maplibregl-boxzoom{background:#fff;border:2px dotted #202020;height:0;left:0;opacity:.5;position:absolute;top:0;width:0}.maplibregl-cooperative-gesture-screen{align-items:center;background:rgba(0,0,0,.4);color:#fff;display:flex;font-size:1.4em;inset:0;justify-content:center;line-height:1.2;opacity:0;padding:1rem;pointer-events:none;position:absolute;transition:opacity 1s ease 1s;z-index:99999}.maplibregl-cooperative-gesture-screen.maplibregl-show{opacity:1;transition:opacity .05s}.maplibregl-cooperative-gesture-screen .maplibregl-mobile-message{display:none}@media (hover:none),(width <= 480px){.maplibregl-cooperative-gesture-screen .maplibregl-desktop-message{display:none}.maplibregl-cooperative-gesture-screen .maplibregl-mobile-message{display:block}}.maplibregl-pseudo-fullscreen{height:100%!important;left:0!important;position:fixed!important;top:0!important;width:100%!important;z-index:99999}`,""]);const mt=O},5426:(t,e,i)=>{"use strict";i.d(e,{Z:()=>s});var r=i(8081),n=i.n(r),o=i(3645),a=i.n(o)()(n());a.push([t.id,'.geolonia-clickable-marker {\n cursor: pointer;\n}\n\n/* Make fullscreen mode works with ie11 */\n.geolonia:-ms-fullscreen {\n width: 100%;\n height: 100%;\n}\n\n/**\n * Styles for loading effect.\n */\n.loading-geolonia-map {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background-color: rgba(255, 255, 255, 0.5);\n z-index: 9999;\n justify-content: center;\n align-items: center;\n display: flex;\n}\n\n.loading-geolonia-map .lds-grid {\n display: inline-block;\n position: relative;\n width: 80px;\n height: 80px;\n}\n\n.loading-geolonia-map .lds-grid div {\n position: absolute;\n width: 16px;\n height: 16px;\n border-radius: 50%;\n background: #999999;\n animation: lds-grid 1.2s linear infinite;\n}\n\n.loading-geolonia-map .lds-grid div:nth-child(1) {\n top: 8px;\n left: 8px;\n animation-delay: 0s;\n}\n\n.loading-geolonia-map .lds-grid div:nth-child(2) {\n top: 8px;\n left: 32px;\n animation-delay: -0.4s;\n}\n\n.loading-geolonia-map .lds-grid div:nth-child(3) {\n top: 8px;\n left: 56px;\n animation-delay: -0.8s;\n}\n\n.loading-geolonia-map .lds-grid div:nth-child(4) {\n top: 32px;\n left: 8px;\n animation-delay: -0.4s;\n}\n\n.loading-geolonia-map .lds-grid div:nth-child(5) {\n top: 32px;\n left: 32px;\n animation-delay: -0.8s;\n}\n\n.loading-geolonia-map .lds-grid div:nth-child(6) {\n top: 32px;\n left: 56px;\n animation-delay: -1.2s;\n}\n\n.loading-geolonia-map .lds-grid div:nth-child(7) {\n top: 56px;\n left: 8px;\n animation-delay: -0.8s;\n}\n\n.loading-geolonia-map .lds-grid div:nth-child(8) {\n top: 56px;\n left: 32px;\n animation-delay: -1.2s;\n}\n\n.loading-geolonia-map .lds-grid div:nth-child(9) {\n top: 56px;\n left: 56px;\n animation-delay: -1.6s;\n}\n\n@keyframes lds-grid {\n 0%, 100% {\n opacity: 1;\n }\n 50% {\n opacity: 0.5;\n }\n}\n\n/* Style for restricted mode */\n.geolonia__restricted-mode-image-container {\n background-image: url("https://geolonia.github.io/embed/restricted.jpg");\n background-position: center center;\n background-size: cover;\n}\n\n/* CSS for Attribution */\n/* Fix: https://github.com/geolonia/embed/issues/291 */\n.maplibregl-map {\n display: block!important;\n}\n\n.maplibregl-ctrl-attrib-inner {\n display: block!important;\n}\n\n.maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-inner {\n display: none!important;\n}\n\n.maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-inner,\n.maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-button {\n display: block!important;\n}\n/* End: CSS for Attribution */\n',""]);const s=a},3645:t=>{"use strict";t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var i="",r=void 0!==e[5];return e[4]&&(i+="@supports (".concat(e[4],") {")),e[2]&&(i+="@media ".concat(e[2]," {")),r&&(i+="@layer".concat(e[5].length>0?" ".concat(e[5]):""," {")),i+=t(e),r&&(i+="}"),e[2]&&(i+="}"),e[4]&&(i+="}"),i})).join("")},e.i=function(t,i,r,n,o){"string"==typeof t&&(t=[[null,t,void 0]]);var a={};if(r)for(var s=0;s<this.length;s++){var l=this[s][0];null!=l&&(a[l]=!0)}for(var c=0;c<t.length;c++){var h=[].concat(t[c]);r&&a[h[0]]||(void 0!==o&&(void 0===h[5]||(h[1]="@layer".concat(h[5].length>0?" ".concat(h[5]):""," {").concat(h[1],"}")),h[5]=o),i&&(h[2]?(h[1]="@media ".concat(h[2]," {").concat(h[1],"}"),h[2]=i):h[2]=i),n&&(h[4]?(h[1]="@supports (".concat(h[4],") {").concat(h[1],"}"),h[4]=n):h[4]="".concat(n)),e.push(h))}},e}},1667:t=>{"use strict";t.exports=function(t,e){return e||(e={}),t?(t=String(t.__esModule?t.default:t),/^['"].*['"]$/.test(t)&&(t=t.slice(1,-1)),e.hash&&(t+=e.hash),/["'() \t\n]|(%20)/.test(t)||e.needQuotes?'"'.concat(t.replace(/"/g,'\\"').replace(/\n/g,"\\n"),'"'):t):t}},8081:t=>{"use strict";t.exports=function(t){return t[1]}},63:(t,e,i)=>{"use strict";function r(t){switch(t&&t.type||null){case"FeatureCollection":return t.features=t.features.reduce((function(t,e){return t.concat(r(e))}),[]),t;case"Feature":return t.geometry?r(t.geometry).map((function(e){var i={type:"Feature",properties:JSON.parse(JSON.stringify(t.properties)),geometry:e};return void 0!==t.id&&(i.id=t.id),i})):[t];case"MultiPoint":return t.coordinates.map((function(t){return{type:"Point",coordinates:t}}));case"MultiPolygon":return t.coordinates.map((function(t){return{type:"Polygon",coordinates:t}}));case"MultiLineString":return t.coordinates.map((function(t){return{type:"LineString",coordinates:t}}));case"GeometryCollection":return t.geometries.map(r).reduce((function(t,e){return t.concat(e)}),[]);case"Point":case"Polygon":case"LineString":return[t]}}i.r(e),i.d(e,{default:()=>r})},3379:t=>{"use strict";var e=[];function i(t){for(var i=-1,r=0;r<e.length;r++)if(e[r].identifier===t){i=r;break}return i}function r(t,r){for(var o={},a=[],s=0;s<t.length;s++){var l=t[s],c=r.base?l[0]+r.base:l[0],h=o[c]||0,u="".concat(c," ").concat(h);o[c]=h+1;var p=i(u),d={css:l[1],media:l[2],sourceMap:l[3],supports:l[4],layer:l[5]};if(-1!==p)e[p].references++,e[p].updater(d);else{var m=n(d,r);r.byIndex=s,e.splice(s,0,{identifier:u,updater:m,references:1})}a.push(u)}return a}function n(t,e){var i=e.domAPI(e);return i.update(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap&&e.supports===t.supports&&e.layer===t.layer)return;i.update(t=e)}else i.remove()}}t.exports=function(t,n){var o=r(t=t||[],n=n||{});return function(t){t=t||[];for(var a=0;a<o.length;a++){var s=i(o[a]);e[s].references--}for(var l=r(t,n),c=0;c<o.length;c++){var h=i(o[c]);0===e[h].references&&(e[h].updater(),e.splice(h,1))}o=l}}},569:t=>{"use strict";var e={};t.exports=function(t,i){var r=function(t){if(void 0===e[t]){var i=document.querySelector(t);if(window.HTMLIFrameElement&&i instanceof window.HTMLIFrameElement)try{i=i.contentDocument.head}catch(t){i=null}e[t]=i}return e[t]}(t);if(!r)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");r.appendChild(i)}},9216:t=>{"use strict";t.exports=function(t){var e=document.createElement("style");return t.setAttributes(e,t.attributes),t.insert(e,t.options),e}},3565:(t,e,i)=>{"use strict";t.exports=function(t){var e=i.nc;e&&t.setAttribute("nonce",e)}},7795:t=>{"use strict";t.exports=function(t){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var e=t.insertStyleElement(t);return{update:function(i){!function(t,e,i){var r="";i.supports&&(r+="@supports (".concat(i.supports,") {")),i.media&&(r+="@media ".concat(i.media," {"));var n=void 0!==i.layer;n&&(r+="@layer".concat(i.layer.length>0?" ".concat(i.layer):""," {")),r+=i.css,n&&(r+="}"),i.media&&(r+="}"),i.supports&&(r+="}");var o=i.sourceMap;o&&"undefined"!=typeof btoa&&(r+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(o))))," */")),e.styleTagTransform(r,t,e.options)}(e,t,i)},remove:function(){!function(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t)}(e)}}}},4589:t=>{"use strict";t.exports=function(t,e){if(e.styleSheet)e.styleSheet.cssText=t;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(t))}}},4055:t=>{t.exports='<svg viewBox="0 0 28 38" xmlns="http://www.w3.org/2000/svg"><g fill="none" fill-rule="evenodd"><ellipse fill-opacity=".3" fill="#000" cx="14" cy="36.5" rx="3" ry="1.5"></ellipse><g transform="translate(1 1)"><path d="M26.495 13.018l.002.05c.011.32-.006.775-.068 1.295-.003.062-.003.062-.005.076l.001-.008a16.517 16.517 0 01-.247 1.5c-1.208 5.775-5.112 12.154-12.865 18.457l-.344.28-.319-.309-.537-.518-.621-.603c-.511-.498-.978-.96-1.445-1.434a68.208 68.208 0 01-3.37-3.656C2.894 23.714.411 19.456-.288 15.414A12.974 12.974 0 01-.48 13.43a2.981 2.981 0 00-.007-.132v-.013a3.206 3.206 0 01-.012-.252c0-.055 0-.055.003-.09v-.002l.002-.028-.002-.048a1.288 1.288 0 01-.003-.157l.024-.475h.01C-.05 5.12 5.827-.5 12.998-.5c7.45 0 13.49 6.05 13.497 13.518zm-.07 1.413v.003z" stroke="#FFF" fill="#666" fill-rule="nonzero" class="left"></path><path d="M13 0c7.176 0 12.995 5.834 12.995 13.033 0 0 .031.472-.066 1.33v.011a15.863 15.863 0 01-.24 1.455c-.777 3.71-3.463 10.668-12.689 18.17V0z" fill="#2D2D2D" fill-rule="nonzero" class="right"></path><circle fill="#FFF" cx="13" cy="13" r="6"></circle></g></g></svg>'},3692:t=>{"use strict";function e(t){return Object.prototype.toString.call(t)}var i=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function r(t,e){if(t.forEach)return t.forEach(e);for(var i=0;i<t.length;i++)e(t[i],i,t)}var n=Object.keys||function(t){var e=[];for(var i in t)e.push(i);return e},o=Object.prototype.hasOwnProperty||function(t,e){return e in t};function a(t){if("object"==typeof t&&null!==t){var o;if(i(t))o=[];else if("[object Date]"===e(t))o=new Date(t.getTime?t.getTime():t);else if("[object RegExp]"===e(t))o=new RegExp(t);else if(function(t){return"[object Error]"===e(t)}(t))o={message:t.message};else if(function(t){return"[object Boolean]"===e(t)}(t)||function(t){return"[object Number]"===e(t)}(t)||function(t){return"[object String]"===e(t)}(t))o=Object(t);else if(Object.create&&Object.getPrototypeOf)o=Object.create(Object.getPrototypeOf(t));else if(t.constructor===Object)o={};else{var a=t.constructor&&t.constructor.prototype||t.__proto__||{},s=function(){};s.prototype=a,o=new s}return r(n(t),(function(e){o[e]=t[e]})),o}return t}function s(t,e,s){var l=[],c=[],h=!0;return function t(u){var p=s?a(u):u,d={},m=!0,f={node:p,node_:u,path:[].concat(l),parent:c[c.length-1],parents:c,key:l[l.length-1],isRoot:0===l.length,level:l.length,circular:null,update:function(t,e){f.isRoot||(f.parent.node[f.key]=t),f.node=t,e&&(m=!1)},delete:function(t){delete f.parent.node[f.key],t&&(m=!1)},remove:function(t){i(f.parent.node)?f.parent.node.splice(f.key,1):delete f.parent.node[f.key],t&&(m=!1)},keys:null,before:function(t){d.before=t},after:function(t){d.after=t},pre:function(t){d.pre=t},post:function(t){d.post=t},stop:function(){h=!1},block:function(){m=!1}};if(!h)return f;function g(){if("object"==typeof f.node&&null!==f.node){f.keys&&f.node_===f.node||(f.keys=n(f.node)),f.isLeaf=0===f.keys.length;for(var t=0;t<c.length;t++)if(c[t].node_===u){f.circular=c[t];break}}else f.isLeaf=!0,f.keys=null;f.notLeaf=!f.isLeaf,f.notRoot=!f.isRoot}g();var _=e.call(f,f.node);return void 0!==_&&f.update&&f.update(_),d.before&&d.before.call(f,f.node),m?("object"!=typeof f.node||null===f.node||f.circular||(c.push(f),g(),r(f.keys,(function(e,i){l.push(e),d.pre&&d.pre.call(f,f.node[e],e);var r=t(f.node[e]);s&&o.call(f.node,e)&&(f.node[e]=r.node),r.isLast=i===f.keys.length-1,r.isFirst=0===i,d.post&&d.post.call(f,r),l.pop()})),c.pop()),d.after&&d.after.call(f,f.node),f):f}(t).node}function l(t){this.value=t}function c(t){return new l(t)}l.prototype.get=function(t){for(var e=this.value,i=0;i<t.length;i++){var r=t[i];if(!e||!o.call(e,r))return;e=e[r]}return e},l.prototype.has=function(t){for(var e=this.value,i=0;i<t.length;i++){var r=t[i];if(!e||!o.call(e,r))return!1;e=e[r]}return!0},l.prototype.set=function(t,e){for(var i=this.value,r=0;r<t.length-1;r++){var n=t[r];o.call(i,n)||(i[n]={}),i=i[n]}return i[t[r]]=e,e},l.prototype.map=function(t){return s(this.value,t,!0)},l.prototype.forEach=function(t){return this.value=s(this.value,t,!1),this.value},l.prototype.reduce=function(t,e){var i=1===arguments.length,r=i?this.value:e;return this.forEach((function(e){this.isRoot&&i||(r=t.call(this,r,e))})),r},l.prototype.paths=function(){var t=[];return this.forEach((function(){t.push(this.path)})),t},l.prototype.nodes=function(){var t=[];return this.forEach((function(){t.push(this.node)})),t},l.prototype.clone=function(){var t=[],e=[];return function i(o){for(var s=0;s<t.length;s++)if(t[s]===o)return e[s];if("object"==typeof o&&null!==o){var l=a(o);return t.push(o),e.push(l),r(n(o),(function(t){l[t]=i(o[t])})),t.pop(),e.pop(),l}return o}(this.value)},r(n(l.prototype),(function(t){c[t]=function(e){var i=[].slice.call(arguments,1),r=new l(e);return r[t].apply(r,i)}})),t.exports=c},8634:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2722%27 height=%2722%27 fill=%27%23333%27 viewBox=%270 0 22 22%27%3E%3Cpath d=%27m1.754 13.406 4.453-4.851 3.09 3.09 3.281 3.277.969-.969-3.309-3.312 3.844-4.121 6.148 6.886h1.082v-.855l-7.207-8.07-4.84 5.187L6.169 6.57l-5.48 5.965v.871ZM.688 16.844h20.625v1.375H.688Zm0 0%27/%3E%3C/svg%3E"},7260:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2722%27 height=%2722%27 fill=%27%2333b5e5%27 viewBox=%270 0 22 22%27%3E%3Cpath d=%27m1.754 13.406 4.453-4.851 3.09 3.09 3.281 3.277.969-.969-3.309-3.312 3.844-4.121 6.148 6.886h1.082v-.855l-7.207-8.07-4.84 5.187L6.169 6.57l-5.48 5.965v.871ZM.688 16.844h20.625v1.375H.688Zm0 0%27/%3E%3C/svg%3E"},5032:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2724%27 height=%2724%27 fill-rule=%27evenodd%27 viewBox=%270 0 20 20%27%3E%3Cpath d=%27M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0%27/%3E%3C/svg%3E"},3667:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2724%27 height=%2724%27 fill=%27%23fff%27 fill-rule=%27evenodd%27 viewBox=%270 0 20 20%27%3E%3Cpath d=%27M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0%27/%3E%3C/svg%3E"},7118:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 fill=%27%23333%27 viewBox=%270 0 20 20%27%3E%3Cpath d=%27M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z%27/%3E%3Ccircle cx=%2710%27 cy=%2710%27 r=%272%27/%3E%3C/svg%3E"},1683:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 fill=%27%23333%27 viewBox=%270 0 29 29%27%3E%3Cpath d=%27M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-9z%27/%3E%3C/svg%3E"},8202:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 fill=%27%23333%27 viewBox=%270 0 29 29%27%3E%3Cpath d=%27M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5z%27/%3E%3C/svg%3E"},7164:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 fill=%27%23333%27 viewBox=%270 0 29 29%27%3E%3Cpath d=%27M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3h1zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16h1zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5H13zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1V7.5z%27/%3E%3C/svg%3E"},5404:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 fill=%27%23333%27 viewBox=%270 0 29 29%27%3E%3Cpath d=%27m10.5 14 4-8 4 8h-8z%27/%3E%3Cpath fill=%27%23ccc%27 d=%27m10.5 16 4 8 4-8h-8z%27/%3E%3C/svg%3E"},4178:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 fill=%27%2333b5e5%27 viewBox=%270 0 20 20%27%3E%3Cpath d=%27M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z%27/%3E%3C/svg%3E"},4750:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 fill=%27%2333b5e5%27 viewBox=%270 0 20 20%27%3E%3Cpath d=%27M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z%27/%3E%3Ccircle cx=%2710%27 cy=%2710%27 r=%272%27/%3E%3C/svg%3E"},9837:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 fill=%27%23666%27 viewBox=%270 0 20 20%27%3E%3Cpath d=%27M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z%27/%3E%3Ccircle cx=%2710%27 cy=%2710%27 r=%272%27/%3E%3Cpath fill=%27red%27 d=%27m14 5 1 1-9 9-1-1 9-9z%27/%3E%3C/svg%3E"},5654:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 fill=%27%23999%27 viewBox=%270 0 20 20%27%3E%3Cpath d=%27M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z%27/%3E%3Ccircle cx=%2710%27 cy=%2710%27 r=%272%27/%3E%3Cpath fill=%27red%27 d=%27m14 5 1 1-9 9-1-1 9-9z%27/%3E%3C/svg%3E"},1427:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 fill=%27%23aaa%27 viewBox=%270 0 20 20%27%3E%3Cpath d=%27M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z%27/%3E%3Ccircle cx=%2710%27 cy=%2710%27 r=%272%27/%3E%3Cpath fill=%27red%27 d=%27m14 5 1 1-9 9-1-1 9-9z%27/%3E%3C/svg%3E"},8622:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 fill=%27%23e54e33%27 viewBox=%270 0 20 20%27%3E%3Cpath d=%27M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z%27/%3E%3C/svg%3E"},9490:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 fill=%27%23e58978%27 viewBox=%270 0 20 20%27%3E%3Cpath d=%27M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z%27/%3E%3Ccircle cx=%2710%27 cy=%2710%27 r=%272%27/%3E%3C/svg%3E"},6703:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 fill=%27%23fff%27 viewBox=%270 0 20 20%27%3E%3Cpath d=%27M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z%27/%3E%3Ccircle cx=%2710%27 cy=%2710%27 r=%272%27/%3E%3C/svg%3E"},883:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 fill=%27%23fff%27 viewBox=%270 0 29 29%27%3E%3Cpath d=%27M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-9z%27/%3E%3C/svg%3E"},2672:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 fill=%27%23fff%27 viewBox=%270 0 29 29%27%3E%3Cpath d=%27M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5z%27/%3E%3C/svg%3E"},2052:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 fill=%27%23fff%27 viewBox=%270 0 29 29%27%3E%3Cpath d=%27M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1h-5.5zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1v-5.5zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1v5.5zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1h5.5z%27/%3E%3C/svg%3E"},2398:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 fill=%27%23fff%27 viewBox=%270 0 29 29%27%3E%3Cpath d=%27M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3h1zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16h1zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5H13zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1V7.5z%27/%3E%3C/svg%3E"},4891:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 fill=%27%23fff%27 viewBox=%270 0 29 29%27%3E%3Cpath d=%27m10.5 14 4-8 4 8h-8z%27/%3E%3Cpath fill=%27%23999%27 d=%27m10.5 16 4 8 4-8h-8z%27/%3E%3C/svg%3E"},7151:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 viewBox=%270 0 20 20%27%3E%3Cpath d=%27M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z%27/%3E%3Ccircle cx=%2710%27 cy=%2710%27 r=%272%27/%3E%3C/svg%3E"},1880:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 viewBox=%270 0 29 29%27%3E%3Cpath d=%27M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-9z%27/%3E%3C/svg%3E"},8866:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 viewBox=%270 0 29 29%27%3E%3Cpath d=%27M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5z%27/%3E%3C/svg%3E"},1319:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 viewBox=%270 0 29 29%27%3E%3Cpath d=%27M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1h-5.5zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1v-5.5zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1v5.5zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1h5.5z%27/%3E%3C/svg%3E"},9594:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 viewBox=%270 0 29 29%27%3E%3Cpath d=%27M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3h1zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16h1zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5H13zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1V7.5z%27/%3E%3C/svg%3E"},3083:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 viewBox=%270 0 29 29%27%3E%3Cpath d=%27m10.5 14 4-8 4 8h-8z%27/%3E%3Cpath fill=%27%23ccc%27 d=%27m10.5 16 4 8 4-8h-8z%27/%3E%3C/svg%3E"},3224:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2788%27 height=%2723%27 fill=%27none%27%3E%3Cpath fill=%27%23000%27 fill-opacity=%27.4%27 fill-rule=%27evenodd%27 d=%27M17.408 16.796h-1.827l2.501-12.095h.198l3.324 6.533.988 2.19.988-2.19 3.258-6.533h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.929 5.644h-.098l-2.914-5.644-.757-1.71-.345 1.71zm1.958-3.42-.726 3.663a1.255 1.255 0 0 1-1.232 1.011h-1.827a1.255 1.255 0 0 1-1.229-1.509l2.501-12.095a1.255 1.255 0 0 1 1.23-1.001h.197a1.255 1.255 0 0 1 1.12.685l3.19 6.273 3.125-6.263a1.255 1.255 0 0 1 1.123-.695h.181a1.255 1.255 0 0 1 1.227.991l1.443 6.71a5.11 5.11 0 0 1 .314-.787l.009-.016a4.623 4.623 0 0 1 1.777-1.887c.782-.46 1.668-.667 2.611-.667a4.548 4.548 0 0 1 1.7.32l.306.134c.21-.16.474-.256.759-.256h1.694a1.255 1.255 0 0 1 1.212.925 1.255 1.255 0 0 1 1.212-.925h1.711c.284 0 .545.094.755.252.613-.3 1.312-.45 2.075-.45 1.356 0 2.557.445 3.482 1.4.314.319.566.676.763 1.064V4.701a1.255 1.255 0 0 1 1.255-1.255h1.86A1.255 1.255 0 0 1 54.44 4.7v9.194h2.217c.19 0 .37.043.532.118v-4.77c0-.356.147-.678.385-.906a2.416 2.416 0 0 1-.682-1.71c0-.665.267-1.253.735-1.7a2.448 2.448 0 0 1 1.722-.674 2.43 2.43 0 0 1 1.705.675c.211.2.381.43.504.683V4.7a1.255 1.255 0 0 1 1.255-1.255h1.744A1.255 1.255 0 0 1 65.812 4.7v3.335a4.76 4.76 0 0 1 1.526-.246c.938 0 1.817.214 2.59.69a4.47 4.47 0 0 1 1.67 1.743v-.98a1.255 1.255 0 0 1 1.256-1.256h1.777c.233 0 .451.064.639.174a3.407 3.407 0 0 1 1.567-.372c.346 0 .861.02 1.285.232a1.255 1.255 0 0 1 .689 1.004 4.73 4.73 0 0 1 .853-.588c.795-.44 1.675-.647 2.61-.647 1.385 0 2.65.39 3.525 1.396.836.938 1.168 2.173 1.168 3.528 0 .343-.02.694-.056 1.051a1.255 1.255 0 0 1-.947 1.09l.408.952a1.255 1.255 0 0 1-.477 1.552c-.418.268-.92.463-1.458.612-.613.171-1.304.244-2.049.244-1.06 0-2.043-.207-2.886-.698l-.015-.008c-.798-.48-1.419-1.135-1.818-1.963l-.004-.008a5.815 5.815 0 0 1-.548-2.512c0-.286.017-.567.053-.843a1.255 1.255 0 0 1-.333-.086l-.166-.004c-.223 0-.426.062-.643.228-.03.024-.142.139-.142.59v3.883a1.255 1.255 0 0 1-1.256 1.256h-1.777a1.255 1.255 0 0 1-1.256-1.256V15.69l-.032.057a4.778 4.778 0 0 1-1.86 1.833 5.04 5.04 0 0 1-2.484.634 4.47 4.47 0 0 1-1.935-.424 1.252 1.252 0 0 1-.764.258h-1.71a1.255 1.255 0 0 1-1.256-1.255V7.687a2.402 2.402 0 0 1-.428.625c.253.23.412.561.412.93v7.553a1.255 1.255 0 0 1-1.256 1.255h-1.843a1.25 1.25 0 0 1-.894-.373c-.228.23-.544.373-.894.373H51.32a1.255 1.255 0 0 1-1.256-1.255v-1.251l-.061.117a4.703 4.703 0 0 1-1.782 1.884 4.767 4.767 0 0 1-2.485.67 5.6 5.6 0 0 1-1.485-.188l.009 2.764a1.255 1.255 0 0 1-1.255 1.259h-1.729a1.255 1.255 0 0 1-1.255-1.255v-3.537a1.255 1.255 0 0 1-1.167.793h-1.679a1.25 1.25 0 0 1-.77-.263 4.47 4.47 0 0 1-1.945.429c-.885 0-1.724-.21-2.495-.632l-.017-.01a4.983 4.983 0 0 1-1.081-.836 1.255 1.255 0 0 1-1.254 1.312h-1.81a1.255 1.255 0 0 1-1.228-.99l-.782-3.625-2.044 3.939a1.255 1.255 0 0 1-1.115.676h-.098a1.255 1.255 0 0 1-1.116-.68l-2.061-3.994zM35.92 16.63l.207-.114.223-.15c.329-.237.574-.499.735-.785l.061-.118.033 1.332h1.678V9.242h-1.694l-.033 1.267c-.088-.22-.264-.438-.526-.658l-.032-.028a3.16 3.16 0 0 0-.668-.428l-.27-.12a3.293 3.293 0 0 0-1.235-.23c-.757 0-1.415.163-1.974.493a3.36 3.36 0 0 0-1.3 1.382c-.297.593-.444 1.284-.444 2.074 0 .8.17 1.503.51 2.107a3.795 3.795 0 0 0 1.382 1.381 3.883 3.883 0 0 0 1.893.477c.53 0 1.015-.11 1.455-.33zm-2.789-5.38c-.384.45-.575 1.038-.575 1.762 0 .735.186 1.332.559 1.794.384.45.933.675 1.645.675a2.25 2.25 0 0 0 .934-.19 2.17 2.17 0 0 0 .468-.29l.178-.161a2.163 2.163 0 0 0 .397-.561c.163-.333.244-.717.244-1.15v-.115c0-.472-.098-.894-.296-1.267l-.043-.077a2.211 2.211 0 0 0-.633-.709l-.13-.086-.047-.028a2.099 2.099 0 0 0-1.073-.285c-.702 0-1.244.231-1.629.692zm2.316 2.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.958.958 0 0 0-.353-.389.851.851 0 0 0-.464-.127c-.4 0-.56.114-.664.239l-.01.012c-.148.174-.275.45-.275.945 0 .506.122.801.27.99.097.11.266.224.68.224.303 0 .504-.09.687-.269zm7.545 1.705a2.626 2.626 0 0 0 .331.423c.213.22.464.402.755.548l.173.074c.433.17.93.255 1.49.255.68 0 1.295-.165 1.844-.493a3.447 3.447 0 0 0 1.316-1.4c.329-.603.493-1.299.493-2.089 0-1.273-.33-2.243-.988-2.913-.658-.68-1.52-1.02-2.584-1.02-.598 0-1.124.115-1.575.347a2.807 2.807 0 0 0-.415.262l-.199.166a3.35 3.35 0 0 0-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138c.137.193.297.36.48.5l.155.11.053.034c.34.197.713.297 1.119.297.714 0 1.262-.225 1.645-.675.385-.46.576-1.048.576-1.762 0-.746-.192-1.338-.576-1.777-.372-.45-.92-.675-1.645-.675-.29 0-.569.053-.835.16a2.366 2.366 0 0 0-.284.136 1.99 1.99 0 0 0-.363.254 2.237 2.237 0 0 0-.46.569l-.082.162a2.56 2.56 0 0 0-.213 1.072v.115c0 .471.098.894.296 1.267l.135.211zm.964-.818a1.11 1.11 0 0 0 .367.385.937.937 0 0 0 .476.118c.423 0 .59-.117.687-.23.159-.194.28-.478.28-.95 0-.53-.133-.8-.266-.952l-.021-.025c-.078-.094-.231-.221-.68-.221a.995.995 0 0 0-.503.135l-.012.007a.859.859 0 0 0-.335.343c-.073.133-.132.324-.132.614v.115a1.43 1.43 0 0 0 .14.66zm15.7-6.222c.232-.23.346-.516.346-.856a1.053 1.053 0 0 0-.345-.79 1.175 1.175 0 0 0-.84-.329c-.34 0-.625.11-.855.33a1.053 1.053 0 0 0-.346.79c0 .34.115.625.346.855.23.23.516.346.856.346.34 0 .62-.115.839-.346zm4.337 9.314.033-1.332c.128.269.324.518.59.747l.098.081a3.727 3.727 0 0 0 .316.224l.223.122a3.21 3.21 0 0 0 1.44.322 3.785 3.785 0 0 0 1.875-.477 3.52 3.52 0 0 0 1.382-1.366c.352-.593.526-1.29.526-2.09 0-.79-.147-1.48-.444-2.073a3.235 3.235 0 0 0-1.283-1.399c-.549-.34-1.195-.51-1.942-.51a3.476 3.476 0 0 0-1.527.344l-.086.043-.165.09a3.412 3.412 0 0 0-.33.214c-.288.21-.507.446-.656.707a1.893 1.893 0 0 0-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.482 2.482 0 0 0 .566.7c.078.065.159.125.245.18l.144.08a2.105 2.105 0 0 0 .975.232c.713 0 1.262-.225 1.645-.675.384-.46.576-1.053.576-1.778 0-.734-.192-1.327-.576-1.777-.373-.46-.921-.692-1.645-.692a2.18 2.18 0 0 0-1.015.235c-.147.075-.285.17-.415.282l-.15.142a2.086 2.086 0 0 0-.42.594c-.149.32-.223.685-.223 1.1v.115c0 .47.097.89.293 1.26zm2.616-.293c.157-.191.28-.479.28-.967 0-.51-.13-.79-.276-.961l-.021-.026c-.082-.1-.232-.225-.67-.225a.868.868 0 0 0-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0 .285.057.499.144.669a1.13 1.13 0 0 0 .367.405c.137.082.28.123.455.123.423 0 .59-.118.686-.23zm8.266-3.013c.23-.087.472-.134.724-.14l.069-.002c.329 0 .542.033.642.099l.247-1.794c-.13-.066-.37-.099-.717-.099a2.3 2.3 0 0 0-.545.063 2.086 2.086 0 0 0-.411.148 2.18 2.18 0 0 0-.4.249 2.482 2.482 0 0 0-.485.499 2.659 2.659 0 0 0-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884c0-.364.053-.678.159-.943a1.49 1.49 0 0 1 .466-.636 2.52 2.52 0 0 1 .399-.253 2.19 2.19 0 0 1 .224-.099zm9.784 2.656.05-.922c0-1.162-.285-2.062-.856-2.698-.559-.647-1.42-.97-2.584-.97-.746 0-1.415.163-2.007.493a3.462 3.462 0 0 0-1.4 1.382c-.329.604-.493 1.306-.493 2.106 0 .714.143 1.371.428 1.975.285.593.73 1.07 1.332 1.432.604.351 1.355.526 2.255.526.649 0 1.204-.062 1.668-.185l.044-.012.135-.04c.409-.122.736-.263.984-.421l-.542-1.267c-.2.108-.415.199-.642.274l-.297.087c-.34.088-.773.131-1.3.131-.636 0-1.135-.147-1.497-.444a1.573 1.573 0 0 1-.192-.193c-.244-.294-.415-.705-.512-1.234l-.004-.021h5.43zm-5.427-1.256-.003.022h3.752v-.138c-.007-.485-.104-.857-.288-1.118a1.056 1.056 0 0 0-.156-.176c-.307-.285-.746-.428-1.316-.428-.657 0-1.155.202-1.494.604-.253.3-.417.712-.494 1.234zm-27.053 2.77V4.7h-1.86v12.095h5.333V15.15zm7.103-5.908v7.553h-1.843V9.242h1.843z%27/%3E%3Cpath fill=%27%23fff%27 d=%27m19.63 11.151-.757-1.71-.345 1.71-1.12 5.644h-1.827L18.083 4.7h.197l3.325 6.533.988 2.19.988-2.19L26.839 4.7h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.93 5.644h-.098l-2.913-5.644zm14.836 5.81c-.68 0-1.311-.16-1.893-.478a3.795 3.795 0 0 1-1.381-1.382c-.34-.604-.51-1.306-.51-2.106 0-.79.147-1.482.444-2.074a3.364 3.364 0 0 1 1.3-1.382c.559-.33 1.217-.494 1.974-.494a3.293 3.293 0 0 1 1.234.231 3.341 3.341 0 0 1 .97.575c.264.22.44.439.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332c-.186.395-.526.746-1.02 1.053a3.167 3.167 0 0 1-1.662.444zm.296-1.482c.626 0 1.152-.214 1.58-.642.428-.44.642-1.01.642-1.711v-.115c0-.472-.098-.894-.296-1.267a2.211 2.211 0 0 0-.807-.872 2.098 2.098 0 0 0-1.119-.313c-.702 0-1.245.231-1.629.692-.384.45-.575 1.037-.575 1.76 0 .736.186 1.333.559 1.795.384.45.933.675 1.645.675zm6.521-6.237h1.711v1.4c.604-1.065 1.547-1.597 2.83-1.597 1.064 0 1.926.34 2.584 1.02.659.67.988 1.641.988 2.914 0 .79-.164 1.487-.493 2.09a3.456 3.456 0 0 1-1.316 1.399 3.51 3.51 0 0 1-1.844.493c-.636 0-1.19-.11-1.662-.329a2.665 2.665 0 0 1-1.086-.97l.017 5.134h-1.728V9.242zm4.048 6.22c.714 0 1.262-.224 1.645-.674.385-.46.576-1.048.576-1.762 0-.746-.192-1.338-.576-1.777-.372-.45-.92-.675-1.645-.675-.395 0-.768.098-1.12.296-.34.187-.613.46-.822.823-.197.351-.296.763-.296 1.234v.115c0 .472.098.894.296 1.267.209.362.483.647.823.855.34.197.713.297 1.119.297z%27/%3E%3Cpath fill=%27%23e1e3e9%27 d=%27M51.325 4.7h1.86v10.45h3.473v1.646h-5.333zm7.12 4.542h1.843v7.553h-1.843zm.905-1.415a1.159 1.159 0 0 1-.856-.346 1.165 1.165 0 0 1-.346-.856 1.053 1.053 0 0 1 .346-.79c.23-.219.516-.329.856-.329.329 0 .609.11.839.33a1.053 1.053 0 0 1 .345.79 1.159 1.159 0 0 1-.345.855c-.22.23-.5.346-.84.346zm7.875 9.133a3.167 3.167 0 0 1-1.662-.444c-.482-.307-.817-.658-1.004-1.053l-.033 1.332h-1.71V4.701h1.743v4.657l-.082 1.283c.186-.438.548-.812 1.086-1.119a3.486 3.486 0 0 1 1.778-.477c.746 0 1.393.17 1.942.51a3.235 3.235 0 0 1 1.283 1.4c.297.592.444 1.282.444 2.072 0 .8-.175 1.498-.526 2.09a3.52 3.52 0 0 1-1.382 1.366 3.785 3.785 0 0 1-1.876.477zm-.296-1.481c.713 0 1.26-.225 1.645-.675.384-.46.577-1.053.577-1.778 0-.734-.193-1.327-.577-1.776-.373-.46-.921-.692-1.645-.692a2.115 2.115 0 0 0-1.58.659c-.428.428-.642.992-.642 1.694v.115c0 .473.098.895.296 1.267a2.385 2.385 0 0 0 .807.872 2.1 2.1 0 0 0 1.119.313zm5.927-6.237h1.777v1.481c.176-.505.46-.91.856-1.217a2.14 2.14 0 0 1 1.349-.46c.351 0 .593.032.724.098l-.247 1.794c-.099-.066-.313-.099-.642-.099-.516 0-.988.164-1.416.494-.417.329-.626.855-.626 1.58v3.883h-1.777V9.242zm9.534 7.718c-.9 0-1.651-.175-2.255-.526-.603-.362-1.047-.84-1.332-1.432a4.567 4.567 0 0 1-.428-1.975c0-.8.164-1.502.493-2.106a3.462 3.462 0 0 1 1.4-1.382c.592-.33 1.262-.494 2.007-.494 1.163 0 2.024.324 2.584.97.57.637.856 1.537.856 2.7 0 .296-.017.603-.05.92h-5.43c.12.67.356 1.153.708 1.45.362.296.86.443 1.497.443.526 0 .96-.044 1.3-.131a4.123 4.123 0 0 0 .938-.362l.542 1.267c-.274.175-.647.329-1.119.46-.472.132-1.042.197-1.711.197zm1.596-4.558c.01-.68-.137-1.158-.444-1.432-.307-.285-.746-.428-1.316-.428-1.152 0-1.815.62-1.991 1.86h3.752z%27/%3E%3Cg fill-rule=%27evenodd%27 stroke-width=%271.036%27%3E%3Cpath fill=%27%23000%27 fill-opacity=%27.4%27 d=%27m8.166 16.146-.002.002a1.54 1.54 0 0 1-2.009 0l-.002-.002-.043-.034-.002-.002-.199-.162H4.377a.657.657 0 0 0-.659.659v1.84a.657.657 0 0 0 .659.659h5.565a.657.657 0 0 0 .659-.659v-1.84a.657.657 0 0 0-.659-.659H8.411l-.202.164zm-1.121-.905a.29.29 0 0 0 .113.023.286.286 0 0 0 .189-.07l.077-.063c.634-.508 4.672-3.743 4.672-7.575 0-2.55-2.215-4.625-4.938-4.625S2.221 5.006 2.221 7.556c0 3.225 2.86 6.027 4.144 7.137h.004l.04.038.484.4.077.063a.628.628 0 0 0 .074.047zm-2.52-.548a16.898 16.898 0 0 1-1.183-1.315C2.187 11.942.967 9.897.967 7.555c0-3.319 2.855-5.88 6.192-5.88 3.338 0 6.193 2.561 6.193 5.881 0 2.34-1.22 4.387-2.376 5.822a16.898 16.898 0 0 1-1.182 1.315h.15a1.912 1.912 0 0 1 1.914 1.914v1.84a1.912 1.912 0 0 1-1.914 1.914H4.377a1.912 1.912 0 0 1-1.914-1.914v-1.84a1.912 1.912 0 0 1 1.914-1.914zm3.82-6.935c0 .692-.55 1.222-1.187 1.222s-1.185-.529-1.185-1.222.548-1.222 1.185-1.222c.638 0 1.186.529 1.186 1.222zm-1.186 2.477c1.348 0 2.442-1.11 2.442-2.478S8.507 5.28 7.159 5.28 4.72 6.39 4.72 7.758s1.092 2.477 2.44 2.477zm2.048 7.71H5.114v-.838h4.093z%27/%3E%3Cpath fill=%27%23e1e3e9%27 d=%27M2.222 7.555c0-2.55 2.214-4.625 4.937-4.625 2.723 0 4.938 2.075 4.938 4.625 0 3.832-4.038 7.068-4.672 7.575l-.077.063a.286.286 0 0 1-.189.07.286.286 0 0 1-.188-.07l-.077-.063c-.634-.507-4.672-3.743-4.672-7.575zm4.937 2.68c1.348 0 2.442-1.11 2.442-2.478S8.507 5.28 7.159 5.28 4.72 6.39 4.72 7.758s1.092 2.477 2.44 2.477z%27/%3E%3Cpath fill=%27%23fff%27 d=%27M4.377 15.948a.657.657 0 0 0-.659.659v1.84a.657.657 0 0 0 .659.659h5.565a.657.657 0 0 0 .659-.659v-1.84a.657.657 0 0 0-.659-.659zm4.83 1.16H5.114v.838h4.093z%27/%3E%3C/g%3E%3C/svg%3E"},4613:function(t){t.exports=function(){"use strict";var t,e,i;function r(r,n){if(t)if(e){var o="var sharedChunk = {}; ("+t+")(sharedChunk); ("+e+")(sharedChunk);",a={};t(a),i=n(a),"undefined"!=typeof window&&(i.workerUrl=window.URL.createObjectURL(new Blob([o],{type:"text/javascript"})))}else e=n;else t=n}return r(0,(function(t){function e(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var i=r;function r(t,e){this.x=t,this.y=e}r.prototype={clone:function(){return new r(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},multByPoint:function(t){return this.clone()._multByPoint(t)},divByPoint:function(t){return this.clone()._divByPoint(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},rotateAround:function(t,e){return this.clone()._rotateAround(t,e)},matMult:function(t){return this.clone()._matMult(t)},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(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var e=t.x-this.x,i=t.y-this.y;return e*e+i*i},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult:function(t){var e=t[2]*this.x+t[3]*this.y;return this.x=t[0]*this.x+t[1]*this.y,this.y=e,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_multByPoint:function(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint:function(t){return this.x/=t.x,this.y/=t.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var e=Math.cos(t),i=Math.sin(t),r=i*this.x+e*this.y;return this.x=e*this.x-i*this.y,this.y=r,this},_rotateAround:function(t,e){var i=Math.cos(t),r=Math.sin(t),n=e.y+r*(this.x-e.x)+i*(this.y-e.y);return this.x=e.x+i*(this.x-e.x)-r*(this.y-e.y),this.y=n,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},r.convert=function(t){return t instanceof r?t:Array.isArray(t)?new r(t[0],t[1]):t};var n=e(i),o=a;function a(t,e,i,r){this.cx=3*t,this.bx=3*(i-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(r-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=e,this.p2x=i,this.p2y=r}a.prototype={sampleCurveX:function(t){return((this.ax*t+this.bx)*t+this.cx)*t},sampleCurveY:function(t){return((this.ay*t+this.by)*t+this.cy)*t},sampleCurveDerivativeX:function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},solveCurveX:function(t,e){if(void 0===e&&(e=1e-6),t<0)return 0;if(t>1)return 1;for(var i=t,r=0;r<8;r++){var n=this.sampleCurveX(i)-t;if(Math.abs(n)<e)return i;var o=this.sampleCurveDerivativeX(i);if(Math.abs(o)<1e-6)break;i-=n/o}var a=0,s=1;for(i=t,r=0;r<20&&(n=this.sampleCurveX(i),!(Math.abs(n-t)<e));r++)t>n?a=i:s=i,i=.5*(s-a)+a;return i},solve:function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))}};var s=e(o);function l(t,e,i,r){const n=new s(t,e,i,r);return function(t){return n.solve(t)}}const c=l(.25,.1,.25,1);function h(t,e,i){return Math.min(i,Math.max(e,t))}function u(t,e,i){const r=i-e,n=((t-e)%r+r)%r+e;return n===e?i:n}function p(t,...e){for(const i of e)for(const e in i)t[e]=i[e];return t}let d=1;function m(t,e){t.forEach((t=>{e[t]&&(e[t]=e[t].bind(e))}))}function f(t,e,i){const r={};for(const n in t)r[n]=e.call(i||this,t[n],n,t);return r}function g(t,e,i){const r={};for(const n in t)e.call(i||this,t[n],n,t)&&(r[n]=t[n]);return r}function _(t){return Array.isArray(t)?t.map(_):"object"==typeof t&&t?f(t,_):t}const y={};function x(t){y[t]||("undefined"!=typeof console&&console.warn(t),y[t]=!0)}function v(t,e,i){return(i.y-t.y)*(e.x-t.x)>(e.y-t.y)*(i.x-t.x)}function b(t){let e=0;for(let i,r,n=0,o=t.length,a=o-1;n<o;a=n++)i=t[n],r=t[a],e+=(r.x-i.x)*(i.y+r.y);return e}function w(){return"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope}let E=null;function T(t){if(null==E){const e=t.navigator?t.navigator.userAgent:null;E=!!t.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return E}function S(t){return"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap}const C="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let I,A;const M={now:"undefined"!=typeof performance&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frame(t){const e=requestAnimationFrame(t);return{cancel:()=>cancelAnimationFrame(e)}},getImageData(t,e=0){return this.getImageCanvasContext(t).getImageData(-e,-e,t.width+2*e,t.height+2*e)},getImageCanvasContext(t){const e=window.document.createElement("canvas"),i=e.getContext("2d",{willReadFrequently:!0});if(!i)throw new Error("failed to create canvas 2d context");return e.width=t.width,e.height=t.height,i.drawImage(t,0,0,t.width,t.height),i},resolveURL:t=>(I||(I=document.createElement("a")),I.href=t,I.href),hardwareConcurrency:"undefined"!=typeof navigator&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(null==A&&(A=matchMedia("(prefers-reduced-motion: reduce)")),A.matches)}},k={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,REGISTERED_PROTOCOLS:{},WORKER_URL:""};class z extends Error{constructor(t,e,i,r){super(`AJAXError: ${e} (${t}): ${i}`),this.status=t,this.statusText=e,this.url=i,this.body=r}}const P=w()?()=>self.worker&&self.worker.referrer:()=>("blob:"===window.location.protocol?window.parent:window).location.href,L=t=>k.REGISTERED_PROTOCOLS[t.substring(0,t.indexOf("://"))];function D(t,e){const i=new AbortController,r=new Request(t.url,{method:t.method||"GET",body:t.body,credentials:t.credentials,headers:t.headers,referrer:P(),signal:i.signal});let n=!1,o=!1;return"json"===t.type&&r.headers.set("Accept","application/json"),o||fetch(r).then((i=>i.ok?(i=>{("arrayBuffer"===t.type||"image"===t.type?i.arrayBuffer():"json"===t.type?i.json():i.text()).then((t=>{o||(n=!0,e(null,t,i.headers.get("Cache-Control"),i.headers.get("Expires")))})).catch((t=>{o||e(new Error(t.message))}))})(i):i.blob().then((r=>e(new z(i.status,i.statusText,t.url,r)))))).catch((t=>{20!==t.code&&e(new Error(t.message))})),{cancel:()=>{o=!0,n||i.abort()}}}const R=function(t,e){if(/:\/\//.test(t.url)&&!/^https?:|^file:/.test(t.url)){if(w()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",t,e);if(!w())return(L(t.url)||D)(t,e)}if(!(/^file:/.test(i=t.url)||/^file:/.test(P())&&!/^\w+:/.test(i))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return D(t,e);if(w()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",t,e,void 0,!0)}var i;return function(t,e){const i=new XMLHttpRequest;i.open(t.method||"GET",t.url,!0),"arrayBuffer"!==t.type&&"image"!==t.type||(i.responseType="arraybuffer");for(const e in t.headers)i.setRequestHeader(e,t.headers[e]);return"json"===t.type&&(i.responseType="text",i.setRequestHeader("Accept","application/json")),i.withCredentials="include"===t.credentials,i.onerror=()=>{e(new Error(i.statusText))},i.onload=()=>{if((i.status>=200&&i.status<300||0===i.status)&&null!==i.response){let r=i.response;if("json"===t.type)try{r=JSON.parse(i.response)}catch(t){return e(t)}e(null,r,i.getResponseHeader("Cache-Control"),i.getResponseHeader("Expires"))}else{const r=new Blob([i.response],{type:i.getResponseHeader("Content-Type")});e(new z(i.status,i.statusText,t.url,r))}},i.send(t.body),{cancel:()=>i.abort()}}(t,e)},B=function(t,e){return R(p(t,{type:"arrayBuffer"}),e)};function F(t){if(!t||t.indexOf("://")<=0||0===t.indexOf("data:image/")||0===t.indexOf("blob:"))return!0;const e=new URL(t),i=window.location;return e.protocol===i.protocol&&e.host===i.host}function O(t,e,i){i[t]&&-1!==i[t].indexOf(e)||(i[t]=i[t]||[],i[t].push(e))}function U(t,e,i){if(i&&i[t]){const r=i[t].indexOf(e);-1!==r&&i[t].splice(r,1)}}class V{constructor(t,e={}){p(this,e),this.type=t}}class N extends V{constructor(t,e={}){super("error",p({error:t},e))}}class ${on(t,e){return this._listeners=this._listeners||{},O(t,e,this._listeners),this}off(t,e){return U(t,e,this._listeners),U(t,e,this._oneTimeListeners),this}once(t,e){return e?(this._oneTimeListeners=this._oneTimeListeners||{},O(t,e,this._oneTimeListeners),this):new Promise((e=>this.once(t,e)))}fire(t,e){"string"==typeof t&&(t=new V(t,e||{}));const i=t.type;if(this.listens(i)){t.target=this;const e=this._listeners&&this._listeners[i]?this._listeners[i].slice():[];for(const i of e)i.call(this,t);const r=this._oneTimeListeners&&this._oneTimeListeners[i]?this._oneTimeListeners[i].slice():[];for(const e of r)U(i,e,this._oneTimeListeners),e.call(this,t);const n=this._eventedParent;n&&(p(t,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),n.fire(t))}else t instanceof N&&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,e){return this._eventedParent=t,this._eventedParentData=e,this}}var j={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{}},default:"mapbox"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{},within:{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}}};const q=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function Z(t,e){const i={};for(const e in t)"ref"!==e&&(i[e]=t[e]);return q.forEach((t=>{t in e&&(i[t]=e[t])})),i}function G(t,e){if(Array.isArray(t)){if(!Array.isArray(e)||t.length!==e.length)return!1;for(let i=0;i<t.length;i++)if(!G(t[i],e[i]))return!1;return!0}if("object"==typeof t&&null!==t&&null!==e){if("object"!=typeof e)return!1;if(Object.keys(t).length!==Object.keys(e).length)return!1;for(const i in t)if(!G(t[i],e[i]))return!1;return!0}return t===e}const H={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 X(t,e,i){i.push({command:H.addSource,args:[t,e[t]]})}function W(t,e,i){e.push({command:H.removeSource,args:[t]}),i[t]=!0}function K(t,e,i,r){W(t,i,r),X(t,e,i)}function Y(t,e,i){let r;for(r in t[i])if(Object.prototype.hasOwnProperty.call(t[i],r)&&"data"!==r&&!G(t[i][r],e[i][r]))return!1;for(r in e[i])if(Object.prototype.hasOwnProperty.call(e[i],r)&&"data"!==r&&!G(t[i][r],e[i][r]))return!1;return!0}function J(t,e,i,r,n,o){let a;for(a in e=e||{},t=t||{})Object.prototype.hasOwnProperty.call(t,a)&&(G(t[a],e[a])||i.push({command:o,args:[r,a,e[a],n]}));for(a in e)Object.prototype.hasOwnProperty.call(e,a)&&!Object.prototype.hasOwnProperty.call(t,a)&&(G(t[a],e[a])||i.push({command:o,args:[r,a,e[a],n]}))}function Q(t){return t.id}function tt(t,e){return t[e.id]=e,t}class et{constructor(t,e,i,r){this.message=(t?`${t}: `:"")+i,r&&(this.identifier=r),null!=e&&e.__line__&&(this.line=e.__line__)}}function it(t,...e){for(const i of e)for(const e in i)t[e]=i[e];return t}class rt extends Error{constructor(t,e){super(e),this.message=e,this.key=t}}class nt{constructor(t,e=[]){this.parent=t,this.bindings={};for(const[t,i]of e)this.bindings[t]=i}concat(t){return new nt(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)}}const ot={kind:"null"},at={kind:"number"},st={kind:"string"},lt={kind:"boolean"},ct={kind:"color"},ht={kind:"object"},ut={kind:"value"},pt={kind:"collator"},dt={kind:"formatted"},mt={kind:"padding"},ft={kind:"resolvedImage"};function gt(t,e){return{kind:"array",itemType:t,N:e}}function _t(t){if("array"===t.kind){const e=_t(t.itemType);return"number"==typeof t.N?`array<${e}, ${t.N}>`:"value"===t.itemType.kind?"array":`array<${e}>`}return t.kind}const yt=[ot,at,st,lt,ct,dt,ht,gt(ut),mt,ft];function xt(t,e){if("error"===e.kind)return null;if("array"===t.kind){if("array"===e.kind&&(0===e.N&&"value"===e.itemType.kind||!xt(t.itemType,e.itemType))&&("number"!=typeof t.N||t.N===e.N))return null}else{if(t.kind===e.kind)return null;if("value"===t.kind)for(const t of yt)if(!xt(t,e))return null}return`Expected ${_t(t)} but found ${_t(e)} instead.`}function vt(t,e){return e.some((e=>e.kind===t.kind))}function bt(t,e){return e.some((e=>"null"===e?null===t:"array"===e?Array.isArray(t):"object"===e?t&&!Array.isArray(t)&&"object"==typeof t:e===typeof t))}function wt(t,e){return"array"===t.kind&&"array"===e.kind?t.itemType.kind===e.itemType.kind&&"number"==typeof t.N:t.kind===e.kind}const Et=.96422,Tt=.82521,St=4/29,Ct=6/29,It=3*Ct*Ct,At=Math.PI/180,Mt=180/Math.PI;function kt(t){return(t%=360)<0&&(t+=360),t}function zt([t,e,i,r]){let n,o;const a=Lt((.2225045*(t=Pt(t))+.7168786*(e=Pt(e))+.0606169*(i=Pt(i)))/1);t===e&&e===i?n=o=a:(n=Lt((.4360747*t+.3850649*e+.1430804*i)/Et),o=Lt((.0139322*t+.0971045*e+.7141733*i)/Tt));const s=116*a-16;return[s<0?0:s,500*(n-a),200*(a-o),r]}function Pt(t){return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Lt(t){return t>.008856451679035631?Math.pow(t,1/3):t/It+St}function Dt([t,e,i,r]){let n=(t+16)/116,o=isNaN(e)?n:n+e/500,a=isNaN(i)?n:n-i/200;return n=1*Bt(n),o=Et*Bt(o),a=Tt*Bt(a),[Rt(3.1338561*o-1.6168667*n-.4906146*a),Rt(-.9787684*o+1.9161415*n+.033454*a),Rt(.0719453*o-.2289914*n+1.4052427*a),r]}function Rt(t){return(t=t<=.00304?12.92*t:1.055*Math.pow(t,1/2.4)-.055)<0?0:t>1?1:t}function Bt(t){return t>Ct?t*t*t:It*(t-St)}function Ft(t){return parseInt(t.padEnd(2,t),16)/255}function Ot(t,e){return Ut(e?t/100:t,0,1)}function Ut(t,e,i){return Math.min(Math.max(e,t),i)}function Vt(t){return!t.some(Number.isNaN)}const Nt={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};class $t{constructor(t,e,i,r=1,n=!0){this.r=t,this.g=e,this.b=i,this.a=r,n||(this.r*=r,this.g*=r,this.b*=r,r||this.overwriteGetter("rgb",[t,e,i,r]))}static parse(t){if(t instanceof $t)return t;if("string"!=typeof t)return;const e=function(t){if("transparent"===(t=t.toLowerCase()))return[0,0,0,0];const e=Nt[t];if(e){const[t,i,r]=e;return[t/255,i/255,r/255,1]}if(t.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(t)){const e=t.length<6?1:2;let i=1;return[Ft(t.slice(i,i+=e)),Ft(t.slice(i,i+=e)),Ft(t.slice(i,i+=e)),Ft(t.slice(i,i+e)||"ff")]}if(t.startsWith("rgb")){const e=t.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(e){const[t,i,r,n,o,a,s,l,c,h,u,p]=e,d=[n||" ",s||" ",h].join("");if(" "===d||" /"===d||",,"===d||",,,"===d){const t=[r,a,c].join(""),e="%%%"===t?100:""===t?255:0;if(e){const t=[Ut(+i/e,0,1),Ut(+o/e,0,1),Ut(+l/e,0,1),u?Ot(+u,p):1];if(Vt(t))return t}}return}}const i=t.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(i){const[t,e,r,n,o,a,s,l,c]=i,h=[r||" ",o||" ",s].join("");if(" "===h||" /"===h||",,"===h||",,,"===h){const t=[+e,Ut(+n,0,100),Ut(+a,0,100),l?Ot(+l,c):1];if(Vt(t))return function([t,e,i,r]){function n(r){const n=(r+t/30)%12,o=e*Math.min(i,1-i);return i-o*Math.max(-1,Math.min(n-3,9-n,1))}return t=kt(t),e/=100,i/=100,[n(0),n(8),n(4),r]}(t)}}}(t);return e?new $t(...e,!1):void 0}get rgb(){const{r:t,g:e,b:i,a:r}=this,n=r||1/0;return this.overwriteGetter("rgb",[t/n,e/n,i/n,r])}get hcl(){return this.overwriteGetter("hcl",function(t){const[e,i,r,n]=zt(t),o=Math.sqrt(i*i+r*r);return[Math.round(1e4*o)?kt(Math.atan2(r,i)*Mt):NaN,o,e,n]}(this.rgb))}get lab(){return this.overwriteGetter("lab",zt(this.rgb))}overwriteGetter(t,e){return Object.defineProperty(this,t,{value:e}),e}toString(){const[t,e,i,r]=this.rgb;return`rgba(${[t,e,i].map((t=>Math.round(255*t))).join(",")},${r})`}}$t.black=new $t(0,0,0,1),$t.white=new $t(1,1,1,1),$t.transparent=new $t(0,0,0,0),$t.red=new $t(1,0,0,1);class jt{constructor(t,e,i){this.sensitivity=t?e?"variant":"case":e?"accent":"base",this.locale=i,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(t,e){return this.collator.compare(t,e)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class qt{constructor(t,e,i,r,n){this.text=t,this.image=e,this.scale=i,this.fontStack=r,this.textColor=n}}class Zt{constructor(t){this.sections=t}static fromString(t){return new Zt([new qt(t,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some((t=>0!==t.text.length||t.image&&0!==t.image.name.length))}static factory(t){return t instanceof Zt?t:Zt.fromString(t)}toString(){return 0===this.sections.length?"":this.sections.map((t=>t.text)).join("")}}class Gt{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof Gt)return t;if("number"==typeof t)return new Gt([t,t,t,t]);if(Array.isArray(t)&&!(t.length<1||t.length>4)){for(const e of t)if("number"!=typeof e)return;switch(t.length){case 1:t=[t[0],t[0],t[0],t[0]];break;case 2:t=[t[0],t[1],t[0],t[1]];break;case 3:t=[t[0],t[1],t[2],t[1]]}return new Gt(t)}}toString(){return JSON.stringify(this.values)}}class Ht{constructor(t){this.name=t.name,this.available=t.available}toString(){return this.name}static fromString(t){return t?new Ht({name:t,available:!1}):null}}function Xt(t,e,i,r){return"number"==typeof t&&t>=0&&t<=255&&"number"==typeof e&&e>=0&&e<=255&&"number"==typeof i&&i>=0&&i<=255?void 0===r||"number"==typeof r&&r>=0&&r<=1?null:`Invalid rgba value [${[t,e,i,r].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${("number"==typeof r?[t,e,i,r]:[t,e,i]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Wt(t){if(null===t)return!0;if("string"==typeof t)return!0;if("boolean"==typeof t)return!0;if("number"==typeof t)return!0;if(t instanceof $t)return!0;if(t instanceof jt)return!0;if(t instanceof Zt)return!0;if(t instanceof Gt)return!0;if(t instanceof Ht)return!0;if(Array.isArray(t)){for(const e of t)if(!Wt(e))return!1;return!0}if("object"==typeof t){for(const e in t)if(!Wt(t[e]))return!1;return!0}return!1}function Kt(t){if(null===t)return ot;if("string"==typeof t)return st;if("boolean"==typeof t)return lt;if("number"==typeof t)return at;if(t instanceof $t)return ct;if(t instanceof jt)return pt;if(t instanceof Zt)return dt;if(t instanceof Gt)return mt;if(t instanceof Ht)return ft;if(Array.isArray(t)){const e=t.length;let i;for(const e of t){const t=Kt(e);if(i){if(i===t)continue;i=ut;break}i=t}return gt(i||ut,e)}return ht}function Yt(t){const e=typeof t;return null===t?"":"string"===e||"number"===e||"boolean"===e?String(t):t instanceof $t||t instanceof Zt||t instanceof Gt||t instanceof Ht?t.toString():JSON.stringify(t)}class Jt{constructor(t,e){this.type=t,this.value=e}static parse(t,e){if(2!==t.length)return e.error(`'literal' expression requires exactly one argument, but found ${t.length-1} instead.`);if(!Wt(t[1]))return e.error("invalid value");const i=t[1];let r=Kt(i);const n=e.expectedType;return"array"!==r.kind||0!==r.N||!n||"array"!==n.kind||"number"==typeof n.N&&0!==n.N||(r=n),new Jt(r,i)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class Qt{constructor(t){this.name="ExpressionEvaluationError",this.message=t}toJSON(){return this.message}}const te={string:st,number:at,boolean:lt,object:ht};class ee{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");let i,r=1;const n=t[0];if("array"===n){let n,o;if(t.length>2){const i=t[1];if("string"!=typeof i||!(i in te)||"object"===i)return e.error('The item type argument of "array" must be one of string, number, boolean',1);n=te[i],r++}else n=ut;if(t.length>3){if(null!==t[2]&&("number"!=typeof t[2]||t[2]<0||t[2]!==Math.floor(t[2])))return e.error('The length argument to "array" must be a positive integer literal',2);o=t[2],r++}i=gt(n,o)}else{if(!te[n])throw new Error(`Types doesn't contain name = ${n}`);i=te[n]}const o=[];for(;r<t.length;r++){const i=e.parse(t[r],r,ut);if(!i)return null;o.push(i)}return new ee(i,o)}evaluate(t){for(let e=0;e<this.args.length;e++){const i=this.args[e].evaluate(t);if(!xt(this.type,Kt(i)))return i;if(e===this.args.length-1)throw new Qt(`Expected value to be of type ${_t(this.type)}, but found ${_t(Kt(i))} instead.`)}throw new Error}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}}const ie={"to-boolean":lt,"to-color":ct,"to-number":at,"to-string":st};class re{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");const i=t[0];if(!ie[i])throw new Error(`Can't parse ${i} as it is not part of the known types`);if(("to-boolean"===i||"to-string"===i)&&2!==t.length)return e.error("Expected one argument.");const r=ie[i],n=[];for(let i=1;i<t.length;i++){const r=e.parse(t[i],i,ut);if(!r)return null;n.push(r)}return new re(r,n)}evaluate(t){if("boolean"===this.type.kind)return Boolean(this.args[0].evaluate(t));if("color"===this.type.kind){let e,i;for(const r of this.args){if(e=r.evaluate(t),i=null,e instanceof $t)return e;if("string"==typeof e){const i=t.parseColor(e);if(i)return i}else if(Array.isArray(e)&&(i=e.length<3||e.length>4?`Invalid rbga value ${JSON.stringify(e)}: expected an array containing either three or four numeric values.`:Xt(e[0],e[1],e[2],e[3]),!i))return new $t(e[0]/255,e[1]/255,e[2]/255,e[3])}throw new Qt(i||`Could not parse color from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}if("padding"===this.type.kind){let e;for(const i of this.args){e=i.evaluate(t);const r=Gt.parse(e);if(r)return r}throw new Qt(`Could not parse padding from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}if("number"===this.type.kind){let e=null;for(const i of this.args){if(e=i.evaluate(t),null===e)return 0;const r=Number(e);if(!isNaN(r))return r}throw new Qt(`Could not convert ${JSON.stringify(e)} to number.`)}return"formatted"===this.type.kind?Zt.fromString(Yt(this.args[0].evaluate(t))):"resolvedImage"===this.type.kind?Ht.fromString(Yt(this.args[0].evaluate(t))):Yt(this.args[0].evaluate(t))}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}}const ne=["Unknown","Point","LineString","Polygon"];class oe{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?"number"==typeof this.feature.type?ne[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 e=this._parseColorCache[t];return e||(e=this._parseColorCache[t]=$t.parse(t)),e}}class ae{constructor(t,e,i=[],r,n=new nt,o=[]){this.registry=t,this.path=i,this.key=i.map((t=>`[${t}]`)).join(""),this.scope=n,this.errors=o,this.expectedType=r,this._isConstant=e}parse(t,e,i,r,n={}){return e?this.concat(e,i,r)._parse(t,n):this._parse(t,n)}_parse(t,e){function i(t,e,i){return"assert"===i?new ee(e,[t]):"coerce"===i?new re(e,[t]):t}if(null!==t&&"string"!=typeof t&&"boolean"!=typeof t&&"number"!=typeof t||(t=["literal",t]),Array.isArray(t)){if(0===t.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const r=t[0];if("string"!=typeof r)return this.error(`Expression name must be a string, but found ${typeof r} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const n=this.registry[r];if(n){let r=n.parse(t,this);if(!r)return null;if(this.expectedType){const t=this.expectedType,n=r.type;if("string"!==t.kind&&"number"!==t.kind&&"boolean"!==t.kind&&"object"!==t.kind&&"array"!==t.kind||"value"!==n.kind)if("color"!==t.kind&&"formatted"!==t.kind&&"resolvedImage"!==t.kind||"value"!==n.kind&&"string"!==n.kind)if("padding"!==t.kind||"value"!==n.kind&&"number"!==n.kind&&"array"!==n.kind){if(this.checkSubtype(t,n))return null}else r=i(r,t,e.typeAnnotation||"coerce");else r=i(r,t,e.typeAnnotation||"coerce");else r=i(r,t,e.typeAnnotation||"assert")}if(!(r instanceof Jt)&&"resolvedImage"!==r.type.kind&&this._isConstant(r)){const e=new oe;try{r=new Jt(r.type,r.evaluate(e))}catch(t){return this.error(t.message),null}}return r}return this.error(`Unknown expression "${r}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(void 0===t?"'undefined' value invalid. Use null instead.":"object"==typeof t?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof t} instead.`)}concat(t,e,i){const r="number"==typeof t?this.path.concat(t):this.path,n=i?this.scope.concat(i):this.scope;return new ae(this.registry,this._isConstant,r,e||null,n,this.errors)}error(t,...e){const i=`${this.key}${e.map((t=>`[${t}]`)).join("")}`;this.errors.push(new rt(i,t))}checkSubtype(t,e){const i=xt(t,e);return i&&this.error(i),i}}class se{constructor(t,e,i){this.type=pt,this.locale=i,this.caseSensitive=t,this.diacriticSensitive=e}static parse(t,e){if(2!==t.length)return e.error("Expected one argument.");const i=t[1];if("object"!=typeof i||Array.isArray(i))return e.error("Collator options argument must be an object.");const r=e.parse(void 0!==i["case-sensitive"]&&i["case-sensitive"],1,lt);if(!r)return null;const n=e.parse(void 0!==i["diacritic-sensitive"]&&i["diacritic-sensitive"],1,lt);if(!n)return null;let o=null;return i.locale&&(o=e.parse(i.locale,1,st),!o)?null:new se(r,n,o)}evaluate(t){return new jt(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}}const le=8192;function ce(t,e){t[0]=Math.min(t[0],e[0]),t[1]=Math.min(t[1],e[1]),t[2]=Math.max(t[2],e[0]),t[3]=Math.max(t[3],e[1])}function he(t,e){return!(t[0]<=e[0]||t[2]>=e[2]||t[1]<=e[1]||t[3]>=e[3])}function ue(t,e){const i=(180+t[0])/360,r=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t[1]*Math.PI/360)))/360,n=Math.pow(2,e.z);return[Math.round(i*n*le),Math.round(r*n*le)]}function pe(t,e,i){const r=t[0]-e[0],n=t[1]-e[1],o=t[0]-i[0],a=t[1]-i[1];return r*a-o*n==0&&r*o<=0&&n*a<=0}function de(t,e){let i=!1;for(let a=0,s=e.length;a<s;a++){const s=e[a];for(let e=0,a=s.length;e<a-1;e++){if(pe(t,s[e],s[e+1]))return!1;(n=s[e])[1]>(r=t)[1]!=(o=s[e+1])[1]>r[1]&&r[0]<(o[0]-n[0])*(r[1]-n[1])/(o[1]-n[1])+n[0]&&(i=!i)}}var r,n,o;return i}function me(t,e){for(let i=0;i<e.length;i++)if(de(t,e[i]))return!0;return!1}function fe(t,e,i,r){const n=r[0]-i[0],o=r[1]-i[1],a=(t[0]-i[0])*o-n*(t[1]-i[1]),s=(e[0]-i[0])*o-n*(e[1]-i[1]);return a>0&&s<0||a<0&&s>0}function ge(t,e,i){for(const c of i)for(let i=0;i<c.length-1;++i)if(0!=(s=[(a=c[i+1])[0]-(o=c[i])[0],a[1]-o[1]])[0]*(l=[(n=e)[0]-(r=t)[0],n[1]-r[1]])[1]-s[1]*l[0]&&fe(r,n,o,a)&&fe(o,a,r,n))return!0;var r,n,o,a,s,l;return!1}function _e(t,e){for(let i=0;i<t.length;++i)if(!de(t[i],e))return!1;for(let i=0;i<t.length-1;++i)if(ge(t[i],t[i+1],e))return!1;return!0}function ye(t,e){for(let i=0;i<e.length;i++)if(_e(t,e[i]))return!0;return!1}function xe(t,e,i){const r=[];for(let n=0;n<t.length;n++){const o=[];for(let r=0;r<t[n].length;r++){const a=ue(t[n][r],i);ce(e,a),o.push(a)}r.push(o)}return r}function ve(t,e,i){const r=[];for(let n=0;n<t.length;n++){const o=xe(t[n],e,i);r.push(o)}return r}function be(t,e,i,r){if(t[0]<i[0]||t[0]>i[2]){const e=.5*r;let n=t[0]-i[0]>e?-r:i[0]-t[0]>e?r:0;0===n&&(n=t[0]-i[2]>e?-r:i[2]-t[0]>e?r:0),t[0]+=n}ce(e,t)}function we(t,e,i,r){const n=Math.pow(2,r.z)*le,o=[r.x*le,r.y*le],a=[];for(const r of t)for(const t of r){const r=[t.x+o[0],t.y+o[1]];be(r,e,i,n),a.push(r)}return a}function Ee(t,e,i,r){const n=Math.pow(2,r.z)*le,o=[r.x*le,r.y*le],a=[];for(const i of t){const t=[];for(const r of i){const i=[r.x+o[0],r.y+o[1]];ce(e,i),t.push(i)}a.push(t)}if(e[2]-e[0]<=n/2){(s=e)[0]=s[1]=1/0,s[2]=s[3]=-1/0;for(const t of a)for(const r of t)be(r,e,i,n)}var s;return a}class Te{constructor(t,e){this.type=lt,this.geojson=t,this.geometries=e}static parse(t,e){if(2!==t.length)return e.error(`'within' expression requires exactly one argument, but found ${t.length-1} instead.`);if(Wt(t[1])){const e=t[1];if("FeatureCollection"===e.type)for(let t=0;t<e.features.length;++t){const i=e.features[t].geometry.type;if("Polygon"===i||"MultiPolygon"===i)return new Te(e,e.features[t].geometry)}else if("Feature"===e.type){const t=e.geometry.type;if("Polygon"===t||"MultiPolygon"===t)return new Te(e,e.geometry)}else if("Polygon"===e.type||"MultiPolygon"===e.type)return new Te(e,e)}return e.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(null!=t.geometry()&&null!=t.canonicalID()){if("Point"===t.geometryType())return function(t,e){const i=[1/0,1/0,-1/0,-1/0],r=[1/0,1/0,-1/0,-1/0],n=t.canonicalID();if("Polygon"===e.type){const o=xe(e.coordinates,r,n),a=we(t.geometry(),i,r,n);if(!he(i,r))return!1;for(const t of a)if(!de(t,o))return!1}if("MultiPolygon"===e.type){const o=ve(e.coordinates,r,n),a=we(t.geometry(),i,r,n);if(!he(i,r))return!1;for(const t of a)if(!me(t,o))return!1}return!0}(t,this.geometries);if("LineString"===t.geometryType())return function(t,e){const i=[1/0,1/0,-1/0,-1/0],r=[1/0,1/0,-1/0,-1/0],n=t.canonicalID();if("Polygon"===e.type){const o=xe(e.coordinates,r,n),a=Ee(t.geometry(),i,r,n);if(!he(i,r))return!1;for(const t of a)if(!_e(t,o))return!1}if("MultiPolygon"===e.type){const o=ve(e.coordinates,r,n),a=Ee(t.geometry(),i,r,n);if(!he(i,r))return!1;for(const t of a)if(!ye(t,o))return!1}return!0}(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}class Se{constructor(t,e){this.type=e.type,this.name=t,this.boundExpression=e}static parse(t,e){if(2!==t.length||"string"!=typeof t[1])return e.error("'var' expression requires exactly one string literal argument.");const i=t[1];return e.scope.has(i)?new Se(i,e.scope.get(i)):e.error(`Unknown variable "${i}". Make sure "${i}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(t){return this.boundExpression.evaluate(t)}eachChild(){}outputDefined(){return!1}}class Ce{constructor(t,e,i,r){this.name=t,this.type=e,this._evaluate=i,this.args=r}evaluate(t){return this._evaluate(t,this.args)}eachChild(t){this.args.forEach(t)}outputDefined(){return!1}static parse(t,e){const i=t[0],r=Ce.definitions[i];if(!r)return e.error(`Unknown expression "${i}". If you wanted a literal array, use ["literal", [...]].`,0);const n=Array.isArray(r)?r[0]:r.type,o=Array.isArray(r)?[[r[1],r[2]]]:r.overloads,a=o.filter((([e])=>!Array.isArray(e)||e.length===t.length-1));let s=null;for(const[r,o]of a){s=new ae(e.registry,Ie,e.path,null,e.scope);const a=[];let l=!1;for(let e=1;e<t.length;e++){const i=t[e],n=Array.isArray(r)?r[e-1]:r.type,o=s.parse(i,1+a.length,n);if(!o){l=!0;break}a.push(o)}if(!l)if(Array.isArray(r)&&r.length!==a.length)s.error(`Expected ${r.length} arguments, but found ${a.length} instead.`);else{for(let t=0;t<a.length;t++){const e=Array.isArray(r)?r[t]:r.type,i=a[t];s.concat(t+1).checkSubtype(e,i.type)}if(0===s.errors.length)return new Ce(i,n,o,a)}}if(1===a.length)e.errors.push(...s.errors);else{const i=(a.length?a:o).map((([t])=>{return e=t,Array.isArray(e)?`(${e.map(_t).join(", ")})`:`(${_t(e.type)}...)`;var e})).join(" | "),r=[];for(let i=1;i<t.length;i++){const n=e.parse(t[i],1+r.length);if(!n)return null;r.push(_t(n.type))}e.error(`Expected arguments of type ${i}, but found (${r.join(", ")}) instead.`)}return null}static register(t,e){Ce.definitions=e;for(const i in e)t[i]=Ce}}function Ie(t){if(t instanceof Se)return Ie(t.boundExpression);if(t instanceof Ce&&"error"===t.name)return!1;if(t instanceof se)return!1;if(t instanceof Te)return!1;const e=t instanceof re||t instanceof ee;let i=!0;return t.eachChild((t=>{i=e?i&&Ie(t):i&&t instanceof Jt})),!!i&&Ae(t)&&ke(t,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function Ae(t){if(t instanceof Ce){if("get"===t.name&&1===t.args.length)return!1;if("feature-state"===t.name)return!1;if("has"===t.name&&1===t.args.length)return!1;if("properties"===t.name||"geometry-type"===t.name||"id"===t.name)return!1;if(/^filter-/.test(t.name))return!1}if(t instanceof Te)return!1;let e=!0;return t.eachChild((t=>{e&&!Ae(t)&&(e=!1)})),e}function Me(t){if(t instanceof Ce&&"feature-state"===t.name)return!1;let e=!0;return t.eachChild((t=>{e&&!Me(t)&&(e=!1)})),e}function ke(t,e){if(t instanceof Ce&&e.indexOf(t.name)>=0)return!1;let i=!0;return t.eachChild((t=>{i&&!ke(t,e)&&(i=!1)})),i}function ze(t,e){const i=t.length-1;let r,n,o=0,a=i,s=0;for(;o<=a;)if(s=Math.floor((o+a)/2),r=t[s],n=t[s+1],r<=e){if(s===i||e<n)return s;o=s+1}else{if(!(r>e))throw new Qt("Input is not a number.");a=s-1}return 0}class Pe{constructor(t,e,i){this.type=t,this.input=e,this.labels=[],this.outputs=[];for(const[t,e]of i)this.labels.push(t),this.outputs.push(e)}static parse(t,e){if(t.length-1<4)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");const i=e.parse(t[1],1,at);if(!i)return null;const r=[];let n=null;e.expectedType&&"value"!==e.expectedType.kind&&(n=e.expectedType);for(let i=1;i<t.length;i+=2){const o=1===i?-1/0:t[i],a=t[i+1],s=i,l=i+1;if("number"!=typeof o)return e.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',s);if(r.length&&r[r.length-1][0]>=o)return e.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',s);const c=e.parse(a,l,n);if(!c)return null;n=n||c.type,r.push([o,c])}return new Pe(n,i,r)}evaluate(t){const e=this.labels,i=this.outputs;if(1===e.length)return i[0].evaluate(t);const r=this.input.evaluate(t);if(r<=e[0])return i[0].evaluate(t);const n=e.length;return r>=e[n-1]?i[n-1].evaluate(t):i[ze(e,r)].evaluate(t)}eachChild(t){t(this.input);for(const e of this.outputs)t(e)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))}}function Le(t,e,i){return t+i*(e-t)}function De(t,e,i){return t.map(((t,r)=>Le(t,e[r],i)))}const Re={number:Le,color:function(t,e,i,r="rgb"){switch(r){case"rgb":{const[r,n,o,a]=De(t.rgb,e.rgb,i);return new $t(r,n,o,a,!1)}case"hcl":{const[r,n,o,a]=t.hcl,[s,l,c,h]=e.hcl;let u,p;if(isNaN(r)||isNaN(s))isNaN(r)?isNaN(s)?u=NaN:(u=s,1!==o&&0!==o||(p=l)):(u=r,1!==c&&0!==c||(p=n));else{let t=s-r;s>r&&t>180?t-=360:s<r&&r-s>180&&(t+=360),u=r+i*t}const[d,m,f,g]=function([t,e,i,r]){return t=isNaN(t)?0:t*At,Dt([i,Math.cos(t)*e,Math.sin(t)*e,r])}([u,null!=p?p:Le(n,l,i),Le(o,c,i),Le(a,h,i)]);return new $t(d,m,f,g,!1)}case"lab":{const[r,n,o,a]=Dt(De(t.lab,e.lab,i));return new $t(r,n,o,a,!1)}}},array:De,padding:function(t,e,i){return new Gt(De(t.values,e.values,i))}};class Be{constructor(t,e,i,r,n){this.type=t,this.operator=e,this.interpolation=i,this.input=r,this.labels=[],this.outputs=[];for(const[t,e]of n)this.labels.push(t),this.outputs.push(e)}static interpolationFactor(t,e,i,r){let n=0;if("exponential"===t.name)n=Fe(e,t.base,i,r);else if("linear"===t.name)n=Fe(e,1,i,r);else if("cubic-bezier"===t.name){const o=t.controlPoints;n=new s(o[0],o[1],o[2],o[3]).solve(Fe(e,1,i,r))}return n}static parse(t,e){let[i,r,n,...o]=t;if(!Array.isArray(r)||0===r.length)return e.error("Expected an interpolation type expression.",1);if("linear"===r[0])r={name:"linear"};else if("exponential"===r[0]){const t=r[1];if("number"!=typeof t)return e.error("Exponential interpolation requires a numeric base.",1,1);r={name:"exponential",base:t}}else{if("cubic-bezier"!==r[0])return e.error(`Unknown interpolation type ${String(r[0])}`,1,0);{const t=r.slice(1);if(4!==t.length||t.some((t=>"number"!=typeof t||t<0||t>1)))return e.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);r={name:"cubic-bezier",controlPoints:t}}}if(t.length-1<4)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");if(n=e.parse(n,2,at),!n)return null;const a=[];let s=null;"interpolate-hcl"===i||"interpolate-lab"===i?s=ct:e.expectedType&&"value"!==e.expectedType.kind&&(s=e.expectedType);for(let t=0;t<o.length;t+=2){const i=o[t],r=o[t+1],n=t+3,l=t+4;if("number"!=typeof i)return e.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',n);if(a.length&&a[a.length-1][0]>=i)return e.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',n);const c=e.parse(r,l,s);if(!c)return null;s=s||c.type,a.push([i,c])}return wt(s,at)||wt(s,ct)||wt(s,mt)||wt(s,gt(at))?new Be(s,i,r,n,a):e.error(`Type ${_t(s)} is not interpolatable.`)}evaluate(t){const e=this.labels,i=this.outputs;if(1===e.length)return i[0].evaluate(t);const r=this.input.evaluate(t);if(r<=e[0])return i[0].evaluate(t);const n=e.length;if(r>=e[n-1])return i[n-1].evaluate(t);const o=ze(e,r),a=Be.interpolationFactor(this.interpolation,r,e[o],e[o+1]),s=i[o].evaluate(t),l=i[o+1].evaluate(t);switch(this.operator){case"interpolate":return Re[this.type.kind](s,l,a);case"interpolate-hcl":return Re.color(s,l,a,"hcl");case"interpolate-lab":return Re.color(s,l,a,"lab")}}eachChild(t){t(this.input);for(const e of this.outputs)t(e)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))}}function Fe(t,e,i,r){const n=r-i,o=t-i;return 0===n?0:1===e?o/n:(Math.pow(e,o)-1)/(Math.pow(e,n)-1)}class Oe{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expectected at least one argument.");let i=null;const r=e.expectedType;r&&"value"!==r.kind&&(i=r);const n=[];for(const r of t.slice(1)){const t=e.parse(r,1+n.length,i,void 0,{typeAnnotation:"omit"});if(!t)return null;i=i||t.type,n.push(t)}if(!i)throw new Error("No output type");const o=r&&n.some((t=>xt(r,t.type)));return new Oe(o?ut:i,n)}evaluate(t){let e,i=null,r=0;for(const n of this.args)if(r++,i=n.evaluate(t),i&&i instanceof Ht&&!i.available&&(e||(e=i.name),i=null,r===this.args.length&&(i=e)),null!==i)break;return i}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}}class Ue{constructor(t,e){this.type=e.type,this.bindings=[].concat(t),this.result=e}evaluate(t){return this.result.evaluate(t)}eachChild(t){for(const e of this.bindings)t(e[1]);t(this.result)}static parse(t,e){if(t.length<4)return e.error(`Expected at least 3 arguments, but found ${t.length-1} instead.`);const i=[];for(let r=1;r<t.length-1;r+=2){const n=t[r];if("string"!=typeof n)return e.error(`Expected string, but found ${typeof n} instead.`,r);if(/[^a-zA-Z0-9_]/.test(n))return e.error("Variable names must contain only alphanumeric characters or '_'.",r);const o=e.parse(t[r+1],r+1);if(!o)return null;i.push([n,o])}const r=e.parse(t[t.length-1],t.length-1,e.expectedType,i);return r?new Ue(i,r):null}outputDefined(){return this.result.outputDefined()}}class Ve{constructor(t,e,i){this.type=t,this.index=e,this.input=i}static parse(t,e){if(3!==t.length)return e.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const i=e.parse(t[1],1,at),r=e.parse(t[2],2,gt(e.expectedType||ut));return i&&r?new Ve(r.type.itemType,i,r):null}evaluate(t){const e=this.index.evaluate(t),i=this.input.evaluate(t);if(e<0)throw new Qt(`Array index out of bounds: ${e} < 0.`);if(e>=i.length)throw new Qt(`Array index out of bounds: ${e} > ${i.length-1}.`);if(e!==Math.floor(e))throw new Qt(`Array index must be an integer, but found ${e} instead.`);return i[e]}eachChild(t){t(this.index),t(this.input)}outputDefined(){return!1}}class Ne{constructor(t,e){this.type=lt,this.needle=t,this.haystack=e}static parse(t,e){if(3!==t.length)return e.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const i=e.parse(t[1],1,ut),r=e.parse(t[2],2,ut);return i&&r?vt(i.type,[lt,st,at,ot,ut])?new Ne(i,r):e.error(`Expected first argument to be of type boolean, string, number or null, but found ${_t(i.type)} instead`):null}evaluate(t){const e=this.needle.evaluate(t),i=this.haystack.evaluate(t);if(!i)return!1;if(!bt(e,["boolean","string","number","null"]))throw new Qt(`Expected first argument to be of type boolean, string, number or null, but found ${_t(Kt(e))} instead.`);if(!bt(i,["string","array"]))throw new Qt(`Expected second argument to be of type array or string, but found ${_t(Kt(i))} instead.`);return i.indexOf(e)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}}class $e{constructor(t,e,i){this.type=at,this.needle=t,this.haystack=e,this.fromIndex=i}static parse(t,e){if(t.length<=2||t.length>=5)return e.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const i=e.parse(t[1],1,ut),r=e.parse(t[2],2,ut);if(!i||!r)return null;if(!vt(i.type,[lt,st,at,ot,ut]))return e.error(`Expected first argument to be of type boolean, string, number or null, but found ${_t(i.type)} instead`);if(4===t.length){const n=e.parse(t[3],3,at);return n?new $e(i,r,n):null}return new $e(i,r)}evaluate(t){const e=this.needle.evaluate(t),i=this.haystack.evaluate(t);if(!bt(e,["boolean","string","number","null"]))throw new Qt(`Expected first argument to be of type boolean, string, number or null, but found ${_t(Kt(e))} instead.`);if(!bt(i,["string","array"]))throw new Qt(`Expected second argument to be of type array or string, but found ${_t(Kt(i))} instead.`);if(this.fromIndex){const r=this.fromIndex.evaluate(t);return i.indexOf(e,r)}return i.indexOf(e)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}}class je{constructor(t,e,i,r,n,o){this.inputType=t,this.type=e,this.input=i,this.cases=r,this.outputs=n,this.otherwise=o}static parse(t,e){if(t.length<5)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if(t.length%2!=1)return e.error("Expected an even number of arguments.");let i,r;e.expectedType&&"value"!==e.expectedType.kind&&(r=e.expectedType);const n={},o=[];for(let a=2;a<t.length-1;a+=2){let s=t[a];const l=t[a+1];Array.isArray(s)||(s=[s]);const c=e.concat(a);if(0===s.length)return c.error("Expected at least one branch label.");for(const t of s){if("number"!=typeof t&&"string"!=typeof t)return c.error("Branch labels must be numbers or strings.");if("number"==typeof t&&Math.abs(t)>Number.MAX_SAFE_INTEGER)return c.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if("number"==typeof t&&Math.floor(t)!==t)return c.error("Numeric branch labels must be integer values.");if(i){if(c.checkSubtype(i,Kt(t)))return null}else i=Kt(t);if(void 0!==n[String(t)])return c.error("Branch labels must be unique.");n[String(t)]=o.length}const h=e.parse(l,a,r);if(!h)return null;r=r||h.type,o.push(h)}const a=e.parse(t[1],1,ut);if(!a)return null;const s=e.parse(t[t.length-1],t.length-1,r);return s?"value"!==a.type.kind&&e.concat(1).checkSubtype(i,a.type)?null:new je(i,r,a,n,o,s):null}evaluate(t){const e=this.input.evaluate(t);return(Kt(e)===this.inputType&&this.outputs[this.cases[e]]||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()}}class qe{constructor(t,e,i){this.type=t,this.branches=e,this.otherwise=i}static parse(t,e){if(t.length<4)return e.error(`Expected at least 3 arguments, but found only ${t.length-1}.`);if(t.length%2!=0)return e.error("Expected an odd number of arguments.");let i;e.expectedType&&"value"!==e.expectedType.kind&&(i=e.expectedType);const r=[];for(let n=1;n<t.length-1;n+=2){const o=e.parse(t[n],n,lt);if(!o)return null;const a=e.parse(t[n+1],n+1,i);if(!a)return null;r.push([o,a]),i=i||a.type}const n=e.parse(t[t.length-1],t.length-1,i);if(!n)return null;if(!i)throw new Error("Can't infer output type");return new qe(i,r,n)}evaluate(t){for(const[e,i]of this.branches)if(e.evaluate(t))return i.evaluate(t);return this.otherwise.evaluate(t)}eachChild(t){for(const[e,i]of this.branches)t(e),t(i);t(this.otherwise)}outputDefined(){return this.branches.every((([t,e])=>e.outputDefined()))&&this.otherwise.outputDefined()}}class Ze{constructor(t,e,i,r){this.type=t,this.input=e,this.beginIndex=i,this.endIndex=r}static parse(t,e){if(t.length<=2||t.length>=5)return e.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const i=e.parse(t[1],1,ut),r=e.parse(t[2],2,at);if(!i||!r)return null;if(!vt(i.type,[gt(ut),st,ut]))return e.error(`Expected first argument to be of type array or string, but found ${_t(i.type)} instead`);if(4===t.length){const n=e.parse(t[3],3,at);return n?new Ze(i.type,i,r,n):null}return new Ze(i.type,i,r)}evaluate(t){const e=this.input.evaluate(t),i=this.beginIndex.evaluate(t);if(!bt(e,["string","array"]))throw new Qt(`Expected first argument to be of type array or string, but found ${_t(Kt(e))} instead.`);if(this.endIndex){const r=this.endIndex.evaluate(t);return e.slice(i,r)}return e.slice(i)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}}function Ge(t,e){return"=="===t||"!="===t?"boolean"===e.kind||"string"===e.kind||"number"===e.kind||"null"===e.kind||"value"===e.kind:"string"===e.kind||"number"===e.kind||"value"===e.kind}function He(t,e,i,r){return 0===r.compare(e,i)}function Xe(t,e,i){const r="=="!==t&&"!="!==t;return class n{constructor(t,e,i){this.type=lt,this.lhs=t,this.rhs=e,this.collator=i,this.hasUntypedArgument="value"===t.type.kind||"value"===e.type.kind}static parse(t,e){if(3!==t.length&&4!==t.length)return e.error("Expected two or three arguments.");const i=t[0];let o=e.parse(t[1],1,ut);if(!o)return null;if(!Ge(i,o.type))return e.concat(1).error(`"${i}" comparisons are not supported for type '${_t(o.type)}'.`);let a=e.parse(t[2],2,ut);if(!a)return null;if(!Ge(i,a.type))return e.concat(2).error(`"${i}" comparisons are not supported for type '${_t(a.type)}'.`);if(o.type.kind!==a.type.kind&&"value"!==o.type.kind&&"value"!==a.type.kind)return e.error(`Cannot compare types '${_t(o.type)}' and '${_t(a.type)}'.`);r&&("value"===o.type.kind&&"value"!==a.type.kind?o=new ee(a.type,[o]):"value"!==o.type.kind&&"value"===a.type.kind&&(a=new ee(o.type,[a])));let s=null;if(4===t.length){if("string"!==o.type.kind&&"string"!==a.type.kind&&"value"!==o.type.kind&&"value"!==a.type.kind)return e.error("Cannot use collator to compare non-string types.");if(s=e.parse(t[3],3,pt),!s)return null}return new n(o,a,s)}evaluate(n){const o=this.lhs.evaluate(n),a=this.rhs.evaluate(n);if(r&&this.hasUntypedArgument){const e=Kt(o),i=Kt(a);if(e.kind!==i.kind||"string"!==e.kind&&"number"!==e.kind)throw new Qt(`Expected arguments for "${t}" to be (string, string) or (number, number), but found (${e.kind}, ${i.kind}) instead.`)}if(this.collator&&!r&&this.hasUntypedArgument){const t=Kt(o),i=Kt(a);if("string"!==t.kind||"string"!==i.kind)return e(n,o,a)}return this.collator?i(n,o,a,this.collator.evaluate(n)):e(n,o,a)}eachChild(t){t(this.lhs),t(this.rhs),this.collator&&t(this.collator)}outputDefined(){return!0}}}const We=Xe("==",(function(t,e,i){return e===i}),He),Ke=Xe("!=",(function(t,e,i){return e!==i}),(function(t,e,i,r){return!He(0,e,i,r)})),Ye=Xe("<",(function(t,e,i){return e<i}),(function(t,e,i,r){return r.compare(e,i)<0})),Je=Xe(">",(function(t,e,i){return e>i}),(function(t,e,i,r){return r.compare(e,i)>0})),Qe=Xe("<=",(function(t,e,i){return e<=i}),(function(t,e,i,r){return r.compare(e,i)<=0})),ti=Xe(">=",(function(t,e,i){return e>=i}),(function(t,e,i,r){return r.compare(e,i)>=0}));class ei{constructor(t,e,i,r,n){this.type=st,this.number=t,this.locale=e,this.currency=i,this.minFractionDigits=r,this.maxFractionDigits=n}static parse(t,e){if(3!==t.length)return e.error("Expected two arguments.");const i=e.parse(t[1],1,at);if(!i)return null;const r=t[2];if("object"!=typeof r||Array.isArray(r))return e.error("NumberFormat options argument must be an object.");let n=null;if(r.locale&&(n=e.parse(r.locale,1,st),!n))return null;let o=null;if(r.currency&&(o=e.parse(r.currency,1,st),!o))return null;let a=null;if(r["min-fraction-digits"]&&(a=e.parse(r["min-fraction-digits"],1,at),!a))return null;let s=null;return r["max-fraction-digits"]&&(s=e.parse(r["max-fraction-digits"],1,at),!s)?null:new ei(i,n,o,a,s)}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}}class ii{constructor(t){this.type=dt,this.sections=t}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");const i=t[1];if(!Array.isArray(i)&&"object"==typeof i)return e.error("First argument must be an image or text section.");const r=[];let n=!1;for(let i=1;i<=t.length-1;++i){const o=t[i];if(n&&"object"==typeof o&&!Array.isArray(o)){n=!1;let t=null;if(o["font-scale"]&&(t=e.parse(o["font-scale"],1,at),!t))return null;let i=null;if(o["text-font"]&&(i=e.parse(o["text-font"],1,gt(st)),!i))return null;let a=null;if(o["text-color"]&&(a=e.parse(o["text-color"],1,ct),!a))return null;const s=r[r.length-1];s.scale=t,s.font=i,s.textColor=a}else{const o=e.parse(t[i],1,ut);if(!o)return null;const a=o.type.kind;if("string"!==a&&"value"!==a&&"null"!==a&&"resolvedImage"!==a)return e.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");n=!0,r.push({content:o,scale:null,font:null,textColor:null})}}return new ii(r)}evaluate(t){return new Zt(this.sections.map((e=>{const i=e.content.evaluate(t);return Kt(i)===ft?new qt("",i,null,null,null):new qt(Yt(i),null,e.scale?e.scale.evaluate(t):null,e.font?e.font.evaluate(t).join(","):null,e.textColor?e.textColor.evaluate(t):null)})))}eachChild(t){for(const e of this.sections)t(e.content),e.scale&&t(e.scale),e.font&&t(e.font),e.textColor&&t(e.textColor)}outputDefined(){return!1}}class ri{constructor(t){this.type=ft,this.input=t}static parse(t,e){if(2!==t.length)return e.error("Expected two arguments.");const i=e.parse(t[1],1,st);return i?new ri(i):e.error("No image name provided.")}evaluate(t){const e=this.input.evaluate(t),i=Ht.fromString(e);return i&&t.availableImages&&(i.available=t.availableImages.indexOf(e)>-1),i}eachChild(t){t(this.input)}outputDefined(){return!1}}class ni{constructor(t){this.type=at,this.input=t}static parse(t,e){if(2!==t.length)return e.error(`Expected 1 argument, but found ${t.length-1} instead.`);const i=e.parse(t[1],1);return i?"array"!==i.type.kind&&"string"!==i.type.kind&&"value"!==i.type.kind?e.error(`Expected argument of type string or array, but found ${_t(i.type)} instead.`):new ni(i):null}evaluate(t){const e=this.input.evaluate(t);if("string"==typeof e)return e.length;if(Array.isArray(e))return e.length;throw new Qt(`Expected value to be of type string or array, but found ${_t(Kt(e))} instead.`)}eachChild(t){t(this.input)}outputDefined(){return!1}}const oi={"==":We,"!=":Ke,">":Je,"<":Ye,">=":ti,"<=":Qe,array:ee,at:Ve,boolean:ee,case:qe,coalesce:Oe,collator:se,format:ii,image:ri,in:Ne,"index-of":$e,interpolate:Be,"interpolate-hcl":Be,"interpolate-lab":Be,length:ni,let:Ue,literal:Jt,match:je,number:ee,"number-format":ei,object:ee,slice:Ze,step:Pe,string:ee,"to-boolean":re,"to-color":re,"to-number":re,"to-string":re,var:Se,within:Te};function ai(t,[e,i,r,n]){e=e.evaluate(t),i=i.evaluate(t),r=r.evaluate(t);const o=n?n.evaluate(t):1,a=Xt(e,i,r,o);if(a)throw new Qt(a);return new $t(e/255,i/255,r/255,o,!1)}function si(t,e){return t in e}function li(t,e){const i=e[t];return void 0===i?null:i}function ci(t){return{type:t}}function hi(t){return{result:"success",value:t}}function ui(t){return{result:"error",value:t}}function pi(t){return"data-driven"===t["property-type"]||"cross-faded-data-driven"===t["property-type"]}function di(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}function mi(t){return!!t.expression&&t.expression.interpolated}function fi(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":null===t?"null":typeof t}function gi(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}function _i(t){return t}function yi(t,e){const i="color"===e.type,r=t.stops&&"object"==typeof t.stops[0][0],n=r||!(r||void 0!==t.property),o=t.type||(mi(e)?"exponential":"interval");if(i||"padding"===e.type){const r=i?$t.parse:Gt.parse;(t=it({},t)).stops&&(t.stops=t.stops.map((t=>[t[0],r(t[1])]))),t.default=r(t.default?t.default:e.default)}if(t.colorSpace&&"rgb"!==(a=t.colorSpace)&&"hcl"!==a&&"lab"!==a)throw new Error(`Unknown color space: "${t.colorSpace}"`);var a;let s,l,c;if("exponential"===o)s=wi;else if("interval"===o)s=bi;else if("categorical"===o){s=vi,l=Object.create(null);for(const e of t.stops)l[e[0]]=e[1];c=typeof t.stops[0][0]}else{if("identity"!==o)throw new Error(`Unknown function type "${o}"`);s=Ei}if(r){const i={},r=[];for(let e=0;e<t.stops.length;e++){const n=t.stops[e],o=n[0].zoom;void 0===i[o]&&(i[o]={zoom:o,type:t.type,property:t.property,default:t.default,stops:[]},r.push(o)),i[o].stops.push([n[0].value,n[1]])}const n=[];for(const t of r)n.push([i[t].zoom,yi(i[t],e)]);const o={name:"linear"};return{kind:"composite",interpolationType:o,interpolationFactor:Be.interpolationFactor.bind(void 0,o),zoomStops:n.map((t=>t[0])),evaluate:({zoom:i},r)=>wi({stops:n,base:t.base},e,i).evaluate(i,r)}}if(n){const i="exponential"===o?{name:"exponential",base:void 0!==t.base?t.base:1}:null;return{kind:"camera",interpolationType:i,interpolationFactor:Be.interpolationFactor.bind(void 0,i),zoomStops:t.stops.map((t=>t[0])),evaluate:({zoom:i})=>s(t,e,i,l,c)}}return{kind:"source",evaluate(i,r){const n=r&&r.properties?r.properties[t.property]:void 0;return void 0===n?xi(t.default,e.default):s(t,e,n,l,c)}}}function xi(t,e,i){return void 0!==t?t:void 0!==e?e:void 0!==i?i:void 0}function vi(t,e,i,r,n){return xi(typeof i===n?r[i]:void 0,t.default,e.default)}function bi(t,e,i){if("number"!==fi(i))return xi(t.default,e.default);const r=t.stops.length;if(1===r)return t.stops[0][1];if(i<=t.stops[0][0])return t.stops[0][1];if(i>=t.stops[r-1][0])return t.stops[r-1][1];const n=ze(t.stops.map((t=>t[0])),i);return t.stops[n][1]}function wi(t,e,i){const r=void 0!==t.base?t.base:1;if("number"!==fi(i))return xi(t.default,e.default);const n=t.stops.length;if(1===n)return t.stops[0][1];if(i<=t.stops[0][0])return t.stops[0][1];if(i>=t.stops[n-1][0])return t.stops[n-1][1];const o=ze(t.stops.map((t=>t[0])),i),a=function(t,e,i,r){const n=r-i,o=t-i;return 0===n?0:1===e?o/n:(Math.pow(e,o)-1)/(Math.pow(e,n)-1)}(i,r,t.stops[o][0],t.stops[o+1][0]),s=t.stops[o][1],l=t.stops[o+1][1],c=Re[e.type]||_i;return"function"==typeof s.evaluate?{evaluate(...e){const i=s.evaluate.apply(void 0,e),r=l.evaluate.apply(void 0,e);if(void 0!==i&&void 0!==r)return c(i,r,a,t.colorSpace)}}:c(s,l,a,t.colorSpace)}function Ei(t,e,i){switch(e.type){case"color":i=$t.parse(i);break;case"formatted":i=Zt.fromString(i.toString());break;case"resolvedImage":i=Ht.fromString(i.toString());break;case"padding":i=Gt.parse(i);break;default:fi(i)===e.type||"enum"===e.type&&e.values[i]||(i=void 0)}return xi(i,t.default,e.default)}Ce.register(oi,{error:[{kind:"error"},[st],(t,[e])=>{throw new Qt(e.evaluate(t))}],typeof:[st,[ut],(t,[e])=>_t(Kt(e.evaluate(t)))],"to-rgba":[gt(at,4),[ct],(t,[e])=>{const[i,r,n,o]=e.evaluate(t).rgb;return[255*i,255*r,255*n,o]}],rgb:[ct,[at,at,at],ai],rgba:[ct,[at,at,at,at],ai],has:{type:lt,overloads:[[[st],(t,[e])=>si(e.evaluate(t),t.properties())],[[st,ht],(t,[e,i])=>si(e.evaluate(t),i.evaluate(t))]]},get:{type:ut,overloads:[[[st],(t,[e])=>li(e.evaluate(t),t.properties())],[[st,ht],(t,[e,i])=>li(e.evaluate(t),i.evaluate(t))]]},"feature-state":[ut,[st],(t,[e])=>li(e.evaluate(t),t.featureState||{})],properties:[ht,[],t=>t.properties()],"geometry-type":[st,[],t=>t.geometryType()],id:[ut,[],t=>t.id()],zoom:[at,[],t=>t.globals.zoom],"heatmap-density":[at,[],t=>t.globals.heatmapDensity||0],"line-progress":[at,[],t=>t.globals.lineProgress||0],accumulated:[ut,[],t=>void 0===t.globals.accumulated?null:t.globals.accumulated],"+":[at,ci(at),(t,e)=>{let i=0;for(const r of e)i+=r.evaluate(t);return i}],"*":[at,ci(at),(t,e)=>{let i=1;for(const r of e)i*=r.evaluate(t);return i}],"-":{type:at,overloads:[[[at,at],(t,[e,i])=>e.evaluate(t)-i.evaluate(t)],[[at],(t,[e])=>-e.evaluate(t)]]},"/":[at,[at,at],(t,[e,i])=>e.evaluate(t)/i.evaluate(t)],"%":[at,[at,at],(t,[e,i])=>e.evaluate(t)%i.evaluate(t)],ln2:[at,[],()=>Math.LN2],pi:[at,[],()=>Math.PI],e:[at,[],()=>Math.E],"^":[at,[at,at],(t,[e,i])=>Math.pow(e.evaluate(t),i.evaluate(t))],sqrt:[at,[at],(t,[e])=>Math.sqrt(e.evaluate(t))],log10:[at,[at],(t,[e])=>Math.log(e.evaluate(t))/Math.LN10],ln:[at,[at],(t,[e])=>Math.log(e.evaluate(t))],log2:[at,[at],(t,[e])=>Math.log(e.evaluate(t))/Math.LN2],sin:[at,[at],(t,[e])=>Math.sin(e.evaluate(t))],cos:[at,[at],(t,[e])=>Math.cos(e.evaluate(t))],tan:[at,[at],(t,[e])=>Math.tan(e.evaluate(t))],asin:[at,[at],(t,[e])=>Math.asin(e.evaluate(t))],acos:[at,[at],(t,[e])=>Math.acos(e.evaluate(t))],atan:[at,[at],(t,[e])=>Math.atan(e.evaluate(t))],min:[at,ci(at),(t,e)=>Math.min(...e.map((e=>e.evaluate(t))))],max:[at,ci(at),(t,e)=>Math.max(...e.map((e=>e.evaluate(t))))],abs:[at,[at],(t,[e])=>Math.abs(e.evaluate(t))],round:[at,[at],(t,[e])=>{const i=e.evaluate(t);return i<0?-Math.round(-i):Math.round(i)}],floor:[at,[at],(t,[e])=>Math.floor(e.evaluate(t))],ceil:[at,[at],(t,[e])=>Math.ceil(e.evaluate(t))],"filter-==":[lt,[st,ut],(t,[e,i])=>t.properties()[e.value]===i.value],"filter-id-==":[lt,[ut],(t,[e])=>t.id()===e.value],"filter-type-==":[lt,[st],(t,[e])=>t.geometryType()===e.value],"filter-<":[lt,[st,ut],(t,[e,i])=>{const r=t.properties()[e.value],n=i.value;return typeof r==typeof n&&r<n}],"filter-id-<":[lt,[ut],(t,[e])=>{const i=t.id(),r=e.value;return typeof i==typeof r&&i<r}],"filter->":[lt,[st,ut],(t,[e,i])=>{const r=t.properties()[e.value],n=i.value;return typeof r==typeof n&&r>n}],"filter-id->":[lt,[ut],(t,[e])=>{const i=t.id(),r=e.value;return typeof i==typeof r&&i>r}],"filter-<=":[lt,[st,ut],(t,[e,i])=>{const r=t.properties()[e.value],n=i.value;return typeof r==typeof n&&r<=n}],"filter-id-<=":[lt,[ut],(t,[e])=>{const i=t.id(),r=e.value;return typeof i==typeof r&&i<=r}],"filter->=":[lt,[st,ut],(t,[e,i])=>{const r=t.properties()[e.value],n=i.value;return typeof r==typeof n&&r>=n}],"filter-id->=":[lt,[ut],(t,[e])=>{const i=t.id(),r=e.value;return typeof i==typeof r&&i>=r}],"filter-has":[lt,[ut],(t,[e])=>e.value in t.properties()],"filter-has-id":[lt,[],t=>null!==t.id()&&void 0!==t.id()],"filter-type-in":[lt,[gt(st)],(t,[e])=>e.value.indexOf(t.geometryType())>=0],"filter-id-in":[lt,[gt(ut)],(t,[e])=>e.value.indexOf(t.id())>=0],"filter-in-small":[lt,[st,gt(ut)],(t,[e,i])=>i.value.indexOf(t.properties()[e.value])>=0],"filter-in-large":[lt,[st,gt(ut)],(t,[e,i])=>function(t,e,i,r){for(;i<=r;){const n=i+r>>1;if(e[n]===t)return!0;e[n]>t?r=n-1:i=n+1}return!1}(t.properties()[e.value],i.value,0,i.value.length-1)],all:{type:lt,overloads:[[[lt,lt],(t,[e,i])=>e.evaluate(t)&&i.evaluate(t)],[ci(lt),(t,e)=>{for(const i of e)if(!i.evaluate(t))return!1;return!0}]]},any:{type:lt,overloads:[[[lt,lt],(t,[e,i])=>e.evaluate(t)||i.evaluate(t)],[ci(lt),(t,e)=>{for(const i of e)if(i.evaluate(t))return!0;return!1}]]},"!":[lt,[lt],(t,[e])=>!e.evaluate(t)],"is-supported-script":[lt,[st],(t,[e])=>{const i=t.globals&&t.globals.isSupportedScript;return!i||i(e.evaluate(t))}],upcase:[st,[st],(t,[e])=>e.evaluate(t).toUpperCase()],downcase:[st,[st],(t,[e])=>e.evaluate(t).toLowerCase()],concat:[st,ci(ut),(t,e)=>e.map((e=>Yt(e.evaluate(t)))).join("")],"resolved-locale":[st,[pt],(t,[e])=>e.evaluate(t).resolvedLocale()]});class Ti{constructor(t,e){var i;this.expression=t,this._warningHistory={},this._evaluator=new oe,this._defaultValue=e?"color"===(i=e).type&&gi(i.default)?new $t(0,0,0,0):"color"===i.type?$t.parse(i.default)||null:"padding"===i.type?Gt.parse(i.default)||null:void 0===i.default?null:i.default:null,this._enumValues=e&&"enum"===e.type?e.values:null}evaluateWithoutErrorHandling(t,e,i,r,n,o){return this._evaluator.globals=t,this._evaluator.feature=e,this._evaluator.featureState=i,this._evaluator.canonical=r,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=o,this.expression.evaluate(this._evaluator)}evaluate(t,e,i,r,n,o){this._evaluator.globals=t,this._evaluator.feature=e||null,this._evaluator.featureState=i||null,this._evaluator.canonical=r,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=o||null;try{const t=this.expression.evaluate(this._evaluator);if(null==t||"number"==typeof t&&t!=t)return this._defaultValue;if(this._enumValues&&!(t in this._enumValues))throw new Qt(`Expected value to be one of ${Object.keys(this._enumValues).map((t=>JSON.stringify(t))).join(", ")}, but found ${JSON.stringify(t)} instead.`);return t}catch(t){return this._warningHistory[t.message]||(this._warningHistory[t.message]=!0,"undefined"!=typeof console&&console.warn(t.message)),this._defaultValue}}}function Si(t){return Array.isArray(t)&&t.length>0&&"string"==typeof t[0]&&t[0]in oi}function Ci(t,e){const i=new ae(oi,Ie,[],e?function(t){const e={color:ct,string:st,number:at,enum:st,boolean:lt,formatted:dt,padding:mt,resolvedImage:ft};return"array"===t.type?gt(e[t.value]||ut,t.length):e[t.type]}(e):void 0),r=i.parse(t,void 0,void 0,void 0,e&&"string"===e.type?{typeAnnotation:"coerce"}:void 0);return r?hi(new Ti(r,e)):ui(i.errors)}class Ii{constructor(t,e){this.kind=t,this._styleExpression=e,this.isStateDependent="constant"!==t&&!Me(e.expression)}evaluateWithoutErrorHandling(t,e,i,r,n,o){return this._styleExpression.evaluateWithoutErrorHandling(t,e,i,r,n,o)}evaluate(t,e,i,r,n,o){return this._styleExpression.evaluate(t,e,i,r,n,o)}}class Ai{constructor(t,e,i,r){this.kind=t,this.zoomStops=i,this._styleExpression=e,this.isStateDependent="camera"!==t&&!Me(e.expression),this.interpolationType=r}evaluateWithoutErrorHandling(t,e,i,r,n,o){return this._styleExpression.evaluateWithoutErrorHandling(t,e,i,r,n,o)}evaluate(t,e,i,r,n,o){return this._styleExpression.evaluate(t,e,i,r,n,o)}interpolationFactor(t,e,i){return this.interpolationType?Be.interpolationFactor(this.interpolationType,t,e,i):0}}function Mi(t,e){const i=Ci(t,e);if("error"===i.result)return i;const r=i.value.expression,n=Ae(r);if(!n&&!pi(e))return ui([new rt("","data expressions not supported")]);const o=ke(r,["zoom"]);if(!o&&!di(e))return ui([new rt("","zoom expressions not supported")]);const a=zi(r);return a||o?a instanceof rt?ui([a]):a instanceof Be&&!mi(e)?ui([new rt("",'"interpolate" expressions cannot be used with this property')]):hi(a?new Ai(n?"camera":"composite",i.value,a.labels,a instanceof Be?a.interpolation:void 0):new Ii(n?"constant":"source",i.value)):ui([new rt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class ki{constructor(t,e){this._parameters=t,this._specification=e,it(this,yi(this._parameters,this._specification))}static deserialize(t){return new ki(t._parameters,t._specification)}static serialize(t){return{_parameters:t._parameters,_specification:t._specification}}}function zi(t){let e=null;if(t instanceof Ue)e=zi(t.result);else if(t instanceof Oe){for(const i of t.args)if(e=zi(i),e)break}else(t instanceof Pe||t instanceof Be)&&t.input instanceof Ce&&"zoom"===t.input.name&&(e=t);return e instanceof rt||t.eachChild((t=>{const i=zi(t);i instanceof rt?e=i:!e&&i?e=new rt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&i&&e!==i&&(e=new rt("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))})),e}function Pi(t){if(!0===t||!1===t)return!0;if(!Array.isArray(t)||0===t.length)return!1;switch(t[0]){case"has":return t.length>=2&&"$id"!==t[1]&&"$type"!==t[1];case"in":return t.length>=3&&("string"!=typeof t[1]||Array.isArray(t[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==t.length||Array.isArray(t[1])||Array.isArray(t[2]);case"any":case"all":for(const e of t.slice(1))if(!Pi(e)&&"boolean"!=typeof e)return!1;return!0;default:return!0}}const Li={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Di(t){if(null==t)return{filter:()=>!0,needGeometry:!1};Pi(t)||(t=Fi(t));const e=Ci(t,Li);if("error"===e.result)throw new Error(e.value.map((t=>`${t.key}: ${t.message}`)).join(", "));return{filter:(t,i,r)=>e.value.evaluate(t,i,{},r),needGeometry:Bi(t)}}function Ri(t,e){return t<e?-1:t>e?1:0}function Bi(t){if(!Array.isArray(t))return!1;if("within"===t[0])return!0;for(let e=1;e<t.length;e++)if(Bi(t[e]))return!0;return!1}function Fi(t){if(!t)return!0;const e=t[0];return t.length<=1?"any"!==e:"=="===e?Oi(t[1],t[2],"=="):"!="===e?Ni(Oi(t[1],t[2],"==")):"<"===e||">"===e||"<="===e||">="===e?Oi(t[1],t[2],e):"any"===e?(i=t.slice(1),["any"].concat(i.map(Fi))):"all"===e?["all"].concat(t.slice(1).map(Fi)):"none"===e?["all"].concat(t.slice(1).map(Fi).map(Ni)):"in"===e?Ui(t[1],t.slice(2)):"!in"===e?Ni(Ui(t[1],t.slice(2))):"has"===e?Vi(t[1]):"!has"===e?Ni(Vi(t[1])):"within"!==e||t;var i}function Oi(t,e,i){switch(t){case"$type":return[`filter-type-${i}`,e];case"$id":return[`filter-id-${i}`,e];default:return[`filter-${i}`,t,e]}}function Ui(t,e){if(0===e.length)return!1;switch(t){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some((t=>typeof t!=typeof e[0]))?["filter-in-large",t,["literal",e.sort(Ri)]]:["filter-in-small",t,["literal",e]]}}function Vi(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function Ni(t){return["!",t]}function $i(t){const e=typeof t;if("number"===e||"boolean"===e||"string"===e||null==t)return JSON.stringify(t);if(Array.isArray(t)){let e="[";for(const i of t)e+=`${$i(i)},`;return`${e}]`}const i=Object.keys(t).sort();let r="{";for(let e=0;e<i.length;e++)r+=`${JSON.stringify(i[e])}:${$i(t[i[e]])},`;return`${r}}`}function ji(t){let e="";for(const i of q)e+=`/${$i(t[i])}`;return e}function qi(t){const e=t.value;return e?[new et(t.key,e,"constants have been deprecated as of v8")]:[]}function Zi(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}function Gi(t){if(Array.isArray(t))return t.map(Gi);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){const e={};for(const i in t)e[i]=Gi(t[i]);return e}return Zi(t)}function Hi(t){const e=t.key,i=t.value,r=t.valueSpec||{},n=t.objectElementValidators||{},o=t.style,a=t.styleSpec,s=t.validateSpec;let l=[];const c=fi(i);if("object"!==c)return[new et(e,i,`object expected, ${c} found`)];for(const t in i){const c=t.split(".")[0],h=r[c]||r["*"];let u;if(n[c])u=n[c];else if(r[c])u=s;else if(n["*"])u=n["*"];else{if(!r["*"]){l.push(new et(e,i[t],`unknown property "${t}"`));continue}u=s}l=l.concat(u({key:(e?`${e}.`:e)+t,value:i[t],valueSpec:h,style:o,styleSpec:a,object:i,objectKey:t,validateSpec:s},i))}for(const t in r)n[t]||r[t].required&&void 0===r[t].default&&void 0===i[t]&&l.push(new et(e,i,`missing required property "${t}"`));return l}function Xi(t){const e=t.value,i=t.valueSpec,r=t.style,n=t.styleSpec,o=t.key,a=t.arrayElementValidator||t.validateSpec;if("array"!==fi(e))return[new et(o,e,`array expected, ${fi(e)} found`)];if(i.length&&e.length!==i.length)return[new et(o,e,`array length ${i.length} expected, length ${e.length} found`)];if(i["min-length"]&&e.length<i["min-length"])return[new et(o,e,`array length at least ${i["min-length"]} expected, length ${e.length} found`)];let s={type:i.value,values:i.values};n.$version<7&&(s.function=i.function),"object"===fi(i.value)&&(s=i.value);let l=[];for(let i=0;i<e.length;i++)l=l.concat(a({array:e,arrayIndex:i,value:e[i],valueSpec:s,validateSpec:t.validateSpec,style:r,styleSpec:n,key:`${o}[${i}]`}));return l}function Wi(t){const e=t.key,i=t.value,r=t.valueSpec;let n=fi(i);return"number"===n&&i!=i&&(n="NaN"),"number"!==n?[new et(e,i,`number expected, ${n} found`)]:"minimum"in r&&i<r.minimum?[new et(e,i,`${i} is less than the minimum value ${r.minimum}`)]:"maximum"in r&&i>r.maximum?[new et(e,i,`${i} is greater than the maximum value ${r.maximum}`)]:[]}function Ki(t){const e=t.valueSpec,i=Zi(t.value.type);let r,n,o,a={};const s="categorical"!==i&&void 0===t.value.property,l=!s,c="array"===fi(t.value.stops)&&"array"===fi(t.value.stops[0])&&"object"===fi(t.value.stops[0][0]),h=Hi({key:t.key,value:t.value,valueSpec:t.styleSpec.function,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{stops:function(t){if("identity"===i)return[new et(t.key,t.value,'identity function may not have a "stops" property')];let e=[];const r=t.value;return e=e.concat(Xi({key:t.key,value:r,valueSpec:t.valueSpec,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,arrayElementValidator:u})),"array"===fi(r)&&0===r.length&&e.push(new et(t.key,r,"array must have at least one stop")),e},default:function(t){return t.validateSpec({key:t.key,value:t.value,valueSpec:e,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec})}}});return"identity"===i&&s&&h.push(new et(t.key,t.value,'missing required property "property"')),"identity"===i||t.value.stops||h.push(new et(t.key,t.value,'missing required property "stops"')),"exponential"===i&&t.valueSpec.expression&&!mi(t.valueSpec)&&h.push(new et(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(l&&!pi(t.valueSpec)?h.push(new et(t.key,t.value,"property functions not supported")):s&&!di(t.valueSpec)&&h.push(new et(t.key,t.value,"zoom functions not supported"))),"categorical"!==i&&!c||void 0!==t.value.property||h.push(new et(t.key,t.value,'"property" property is required')),h;function u(t){let i=[];const r=t.value,s=t.key;if("array"!==fi(r))return[new et(s,r,`array expected, ${fi(r)} found`)];if(2!==r.length)return[new et(s,r,`array length 2 expected, length ${r.length} found`)];if(c){if("object"!==fi(r[0]))return[new et(s,r,`object expected, ${fi(r[0])} found`)];if(void 0===r[0].zoom)return[new et(s,r,"object stop key must have zoom")];if(void 0===r[0].value)return[new et(s,r,"object stop key must have value")];if(o&&o>Zi(r[0].zoom))return[new et(s,r[0].zoom,"stop zoom values must appear in ascending order")];Zi(r[0].zoom)!==o&&(o=Zi(r[0].zoom),n=void 0,a={}),i=i.concat(Hi({key:`${s}[0]`,value:r[0],valueSpec:{zoom:{}},validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{zoom:Wi,value:p}}))}else i=i.concat(p({key:`${s}[0]`,value:r[0],valueSpec:{},validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec},r));return Si(Gi(r[1]))?i.concat([new et(`${s}[1]`,r[1],"expressions are not allowed in function stops.")]):i.concat(t.validateSpec({key:`${s}[1]`,value:r[1],valueSpec:e,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec}))}function p(t,o){const s=fi(t.value),l=Zi(t.value),c=null!==t.value?t.value:o;if(r){if(s!==r)return[new et(t.key,c,`${s} stop domain type must match previous stop domain type ${r}`)]}else r=s;if("number"!==s&&"string"!==s&&"boolean"!==s)return[new et(t.key,c,"stop domain value must be a number, string, or boolean")];if("number"!==s&&"categorical"!==i){let r=`number expected, ${s} found`;return pi(e)&&void 0===i&&(r+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new et(t.key,c,r)]}return"categorical"!==i||"number"!==s||isFinite(l)&&Math.floor(l)===l?"categorical"!==i&&"number"===s&&void 0!==n&&l<n?[new et(t.key,c,"stop domain values must appear in ascending order")]:(n=l,"categorical"===i&&l in a?[new et(t.key,c,"stop domain values must be unique")]:(a[l]=!0,[])):[new et(t.key,c,`integer expected, found ${l}`)]}}function Yi(t){const e=("property"===t.expressionContext?Mi:Ci)(Gi(t.value),t.valueSpec);if("error"===e.result)return e.value.map((e=>new et(`${t.key}${e.key}`,t.value,e.message)));const i=e.value.expression||e.value._styleExpression.expression;if("property"===t.expressionContext&&"text-font"===t.propertyKey&&!i.outputDefined())return[new et(t.key,t.value,`Invalid data expression for "${t.propertyKey}". Output values must be contained as literals within the expression.`)];if("property"===t.expressionContext&&"layout"===t.propertyType&&!Me(i))return[new et(t.key,t.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===t.expressionContext&&!Me(i))return[new et(t.key,t.value,'"feature-state" data expressions are not supported with filters.')];if(t.expressionContext&&0===t.expressionContext.indexOf("cluster")){if(!ke(i,["zoom","feature-state"]))return[new et(t.key,t.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===t.expressionContext&&!Ae(i))return[new et(t.key,t.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Ji(t){const e=t.key,i=t.value,r=t.valueSpec,n=[];return Array.isArray(r.values)?-1===r.values.indexOf(Zi(i))&&n.push(new et(e,i,`expected one of [${r.values.join(", ")}], ${JSON.stringify(i)} found`)):-1===Object.keys(r.values).indexOf(Zi(i))&&n.push(new et(e,i,`expected one of [${Object.keys(r.values).join(", ")}], ${JSON.stringify(i)} found`)),n}function Qi(t){return Pi(Gi(t.value))?Yi(it({},t,{expressionContext:"filter",valueSpec:{value:"boolean"}})):tr(t)}function tr(t){const e=t.value,i=t.key;if("array"!==fi(e))return[new et(i,e,`array expected, ${fi(e)} found`)];const r=t.styleSpec;let n,o=[];if(e.length<1)return[new et(i,e,"filter array must have at least 1 element")];switch(o=o.concat(Ji({key:`${i}[0]`,value:e[0],valueSpec:r.filter_operator,style:t.style,styleSpec:t.styleSpec})),Zi(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&"$type"===Zi(e[1])&&o.push(new et(i,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":3!==e.length&&o.push(new et(i,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(n=fi(e[1]),"string"!==n&&o.push(new et(`${i}[1]`,e[1],`string expected, ${n} found`)));for(let a=2;a<e.length;a++)n=fi(e[a]),"$type"===Zi(e[1])?o=o.concat(Ji({key:`${i}[${a}]`,value:e[a],valueSpec:r.geometry_type,style:t.style,styleSpec:t.styleSpec})):"string"!==n&&"number"!==n&&"boolean"!==n&&o.push(new et(`${i}[${a}]`,e[a],`string, number, or boolean expected, ${n} found`));break;case"any":case"all":case"none":for(let r=1;r<e.length;r++)o=o.concat(tr({key:`${i}[${r}]`,value:e[r],style:t.style,styleSpec:t.styleSpec}));break;case"has":case"!has":n=fi(e[1]),2!==e.length?o.push(new et(i,e,`filter array for "${e[0]}" operator must have 2 elements`)):"string"!==n&&o.push(new et(`${i}[1]`,e[1],`string expected, ${n} found`));break;case"within":n=fi(e[1]),2!==e.length?o.push(new et(i,e,`filter array for "${e[0]}" operator must have 2 elements`)):"object"!==n&&o.push(new et(`${i}[1]`,e[1],`object expected, ${n} found`))}return o}function er(t,e){const i=t.key,r=t.validateSpec,n=t.style,o=t.styleSpec,a=t.value,s=t.objectKey,l=o[`${e}_${t.layerType}`];if(!l)return[];const c=s.match(/^(.*)-transition$/);if("paint"===e&&c&&l[c[1]]&&l[c[1]].transition)return r({key:i,value:a,valueSpec:o.transition,style:n,styleSpec:o});const h=t.valueSpec||l[s];if(!h)return[new et(i,a,`unknown property "${s}"`)];let u;if("string"===fi(a)&&pi(h)&&!h.tokens&&(u=/^{([^}]+)}$/.exec(a)))return[new et(i,a,`"${s}" does not support interpolation syntax\nUse an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(u[1])} }\`.`)];const p=[];return"symbol"===t.layerType&&("text-field"===s&&n&&!n.glyphs&&p.push(new et(i,a,'use of "text-field" requires a style "glyphs" property')),"text-font"===s&&gi(Gi(a))&&"identity"===Zi(a.type)&&p.push(new et(i,a,'"text-font" does not support identity functions'))),p.concat(r({key:t.key,value:a,valueSpec:h,style:n,styleSpec:o,expressionContext:"property",propertyType:e,propertyKey:s}))}function ir(t){return er(t,"paint")}function rr(t){return er(t,"layout")}function nr(t){let e=[];const i=t.value,r=t.key,n=t.style,o=t.styleSpec;i.type||i.ref||e.push(new et(r,i,'either "type" or "ref" is required'));let a=Zi(i.type);const s=Zi(i.ref);if(i.id){const o=Zi(i.id);for(let a=0;a<t.arrayIndex;a++){const t=n.layers[a];Zi(t.id)===o&&e.push(new et(r,i.id,`duplicate layer id "${i.id}", previously used at line ${t.id.__line__}`))}}if("ref"in i){let t;["type","source","source-layer","filter","layout"].forEach((t=>{t in i&&e.push(new et(r,i[t],`"${t}" is prohibited for ref layers`))})),n.layers.forEach((e=>{Zi(e.id)===s&&(t=e)})),t?t.ref?e.push(new et(r,i.ref,"ref cannot reference another ref layer")):a=Zi(t.type):e.push(new et(r,i.ref,`ref layer "${s}" not found`))}else if("background"!==a)if(i.source){const t=n.sources&&n.sources[i.source],o=t&&Zi(t.type);t?"vector"===o&&"raster"===a?e.push(new et(r,i.source,`layer "${i.id}" requires a raster source`)):"raster"===o&&"raster"!==a?e.push(new et(r,i.source,`layer "${i.id}" requires a vector source`)):"vector"!==o||i["source-layer"]?"raster-dem"===o&&"hillshade"!==a?e.push(new et(r,i.source,"raster-dem source can only be used with layer type 'hillshade'.")):"line"!==a||!i.paint||!i.paint["line-gradient"]||"geojson"===o&&t.lineMetrics||e.push(new et(r,i,`layer "${i.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):e.push(new et(r,i,`layer "${i.id}" must specify a "source-layer"`)):e.push(new et(r,i.source,`source "${i.source}" not found`))}else e.push(new et(r,i,'missing required property "source"'));return e=e.concat(Hi({key:r,value:i,valueSpec:o.layer,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*":()=>[],type:()=>t.validateSpec({key:`${r}.type`,value:i.type,valueSpec:o.layer.type,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,object:i,objectKey:"type"}),filter:Qi,layout:t=>Hi({layer:i,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*":t=>rr(it({layerType:a},t))}}),paint:t=>Hi({layer:i,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*":t=>ir(it({layerType:a},t))}})}})),e}function or(t){const e=t.value,i=t.key,r=fi(e);return"string"!==r?[new et(i,e,`string expected, ${r} found`)]:[]}const ar={promoteId:function({key:t,value:e}){if("string"===fi(e))return or({key:t,value:e});{const i=[];for(const r in e)i.push(...or({key:`${t}.${r}`,value:e[r]}));return i}}};function sr(t){const e=t.value,i=t.key,r=t.styleSpec,n=t.style,o=t.validateSpec;if(!e.type)return[new et(i,e,'"type" is required')];const a=Zi(e.type);let s;switch(a){case"vector":case"raster":case"raster-dem":return s=Hi({key:i,value:e,valueSpec:r[`source_${a.replace("-","_")}`],style:t.style,styleSpec:r,objectElementValidators:ar,validateSpec:o}),s;case"geojson":if(s=Hi({key:i,value:e,valueSpec:r.source_geojson,style:n,styleSpec:r,validateSpec:o,objectElementValidators:ar}),e.cluster)for(const t in e.clusterProperties){const[r,n]=e.clusterProperties[t],a="string"==typeof r?[r,["accumulated"],["get",t]]:r;s.push(...Yi({key:`${i}.${t}.map`,value:n,validateSpec:o,expressionContext:"cluster-map"})),s.push(...Yi({key:`${i}.${t}.reduce`,value:a,validateSpec:o,expressionContext:"cluster-reduce"}))}return s;case"video":return Hi({key:i,value:e,valueSpec:r.source_video,style:n,validateSpec:o,styleSpec:r});case"image":return Hi({key:i,value:e,valueSpec:r.source_image,style:n,validateSpec:o,styleSpec:r});case"canvas":return[new et(i,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Ji({key:`${i}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:n,validateSpec:o,styleSpec:r})}}function lr(t){const e=t.value,i=t.styleSpec,r=i.light,n=t.style;let o=[];const a=fi(e);if(void 0===e)return o;if("object"!==a)return o=o.concat([new et("light",e,`object expected, ${a} found`)]),o;for(const a in e){const s=a.match(/^(.*)-transition$/);o=o.concat(s&&r[s[1]]&&r[s[1]].transition?t.validateSpec({key:a,value:e[a],valueSpec:i.transition,validateSpec:t.validateSpec,style:n,styleSpec:i}):r[a]?t.validateSpec({key:a,value:e[a],valueSpec:r[a],validateSpec:t.validateSpec,style:n,styleSpec:i}):[new et(a,e[a],`unknown property "${a}"`)])}return o}function cr(t){const e=t.value,i=t.styleSpec,r=i.terrain,n=t.style;let o=[];const a=fi(e);if(void 0===e)return o;if("object"!==a)return o=o.concat([new et("terrain",e,`object expected, ${a} found`)]),o;for(const a in e)o=o.concat(r[a]?t.validateSpec({key:a,value:e[a],valueSpec:r[a],validateSpec:t.validateSpec,style:n,styleSpec:i}):[new et(a,e[a],`unknown property "${a}"`)]);return o}function hr(t){let e=[];const i=t.value,r=t.key;if(Array.isArray(i)){const n=[],o=[];for(const a in i)i[a].id&&n.includes(i[a].id)&&e.push(new et(r,i,`all the sprites' ids must be unique, but ${i[a].id} is duplicated`)),n.push(i[a].id),i[a].url&&o.includes(i[a].url)&&e.push(new et(r,i,`all the sprites' URLs must be unique, but ${i[a].url} is duplicated`)),o.push(i[a].url),e=e.concat(Hi({key:`${r}[${a}]`,value:i[a],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:t.validateSpec}));return e}return or({key:r,value:i})}const ur={"*":()=>[],array:Xi,boolean:function(t){const e=t.value,i=t.key,r=fi(e);return"boolean"!==r?[new et(i,e,`boolean expected, ${r} found`)]:[]},number:Wi,color:function(t){const e=t.key,i=t.value,r=fi(i);return"string"!==r?[new et(e,i,`color expected, ${r} found`)]:$t.parse(String(i))?[]:[new et(e,i,`color expected, "${i}" found`)]},constants:qi,enum:Ji,filter:Qi,function:Ki,layer:nr,object:Hi,source:sr,light:lr,terrain:cr,string:or,formatted:function(t){return 0===or(t).length?[]:Yi(t)},resolvedImage:function(t){return 0===or(t).length?[]:Yi(t)},padding:function(t){const e=t.key,i=t.value;if("array"===fi(i)){if(i.length<1||i.length>4)return[new et(e,i,`padding requires 1 to 4 values; ${i.length} values found`)];const r={type:"number"};let n=[];for(let o=0;o<i.length;o++)n=n.concat(t.validateSpec({key:`${e}[${o}]`,value:i[o],validateSpec:t.validateSpec,valueSpec:r}));return n}return Wi({key:e,value:i,valueSpec:{}})},sprite:hr};function pr(t){const e=t.value,i=t.valueSpec,r=t.styleSpec;return t.validateSpec=pr,i.expression&&gi(Zi(e))?Ki(t):i.expression&&Si(Gi(e))?Yi(t):i.type&&ur[i.type]?ur[i.type](t):Hi(it({},t,{valueSpec:i.type?r[i.type]:i}))}function dr(t){const e=t.value,i=t.key,r=or(t);return r.length||(-1===e.indexOf("{fontstack}")&&r.push(new et(i,e,'"glyphs" url must include a "{fontstack}" token')),-1===e.indexOf("{range}")&&r.push(new et(i,e,'"glyphs" url must include a "{range}" token'))),r}function mr(t,e=j){let i=[];return i=i.concat(pr({key:"",value:t,valueSpec:e.$root,styleSpec:e,style:t,validateSpec:pr,objectElementValidators:{glyphs:dr,"*":()=>[]}})),t.constants&&(i=i.concat(qi({key:"constants",value:t.constants,style:t,styleSpec:e,validateSpec:pr}))),gr(i)}function fr(t){return function(e){return t({...e,validateSpec:pr})}}function gr(t){return[].concat(t).sort(((t,e)=>t.line-e.line))}function _r(t){return function(...e){return gr(t.apply(this,e))}}mr.source=_r(fr(sr)),mr.sprite=_r(fr(hr)),mr.glyphs=_r(fr(dr)),mr.light=_r(fr(lr)),mr.terrain=_r(fr(cr)),mr.layer=_r(fr(nr)),mr.filter=_r(fr(Qi)),mr.paintProperty=_r(fr(ir)),mr.layoutProperty=_r(fr(rr));const yr=mr,xr=yr.light,vr=yr.paintProperty,br=yr.layoutProperty;function wr(t,e){let i=!1;if(e&&e.length)for(const r of e)t.fire(new N(new Error(r.message))),i=!0;return i}class Er{constructor(t,e,i){const r=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;const n=new Int32Array(this.arrayBuffer);t=n[0],this.d=(e=n[1])+2*(i=n[2]);for(let t=0;t<this.d*this.d;t++){const e=n[3+t],i=n[3+t+1];r.push(e===i?null:n.subarray(e,i))}const o=n[3+r.length+1];this.keys=n.subarray(n[3+r.length],o),this.bboxes=n.subarray(o),this.insert=this._insertReadonly}else{this.d=e+2*i;for(let t=0;t<this.d*this.d;t++)r.push([]);this.keys=[],this.bboxes=[]}this.n=e,this.extent=t,this.padding=i,this.scale=e/t,this.uid=0;const n=i/e*t;this.min=-n,this.max=t+n}insert(t,e,i,r,n){this._forEachCell(e,i,r,n,this._insertCell,this.uid++,void 0,void 0),this.keys.push(t),this.bboxes.push(e),this.bboxes.push(i),this.bboxes.push(r),this.bboxes.push(n)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(t,e,i,r,n,o){this.cells[n].push(o)}query(t,e,i,r,n){const o=this.min,a=this.max;if(t<=o&&e<=o&&a<=i&&a<=r&&!n)return Array.prototype.slice.call(this.keys);{const o=[];return this._forEachCell(t,e,i,r,this._queryCell,o,{},n),o}}_queryCell(t,e,i,r,n,o,a,s){const l=this.cells[n];if(null!==l){const n=this.keys,c=this.bboxes;for(let h=0;h<l.length;h++){const u=l[h];if(void 0===a[u]){const l=4*u;(s?s(c[l+0],c[l+1],c[l+2],c[l+3]):t<=c[l+2]&&e<=c[l+3]&&i>=c[l+0]&&r>=c[l+1])?(a[u]=!0,o.push(n[u])):a[u]=!1}}}}_forEachCell(t,e,i,r,n,o,a,s){const l=this._convertToCellCoord(t),c=this._convertToCellCoord(e),h=this._convertToCellCoord(i),u=this._convertToCellCoord(r);for(let p=l;p<=h;p++)for(let l=c;l<=u;l++){const c=this.d*l+p;if((!s||s(this._convertFromCellCoord(p),this._convertFromCellCoord(l),this._convertFromCellCoord(p+1),this._convertFromCellCoord(l+1)))&&n.call(this,t,e,i,r,c,o,a,s))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;const t=this.cells,e=3+this.cells.length+1+1;let i=0;for(let t=0;t<this.cells.length;t++)i+=this.cells[t].length;const r=new Int32Array(e+i+this.keys.length+this.bboxes.length);r[0]=this.extent,r[1]=this.n,r[2]=this.padding;let n=e;for(let e=0;e<t.length;e++){const i=t[e];r[3+e]=n,r.set(i,n),n+=i.length}return r[3+t.length]=n,r.set(this.keys,n),n+=this.keys.length,r[3+t.length+1]=n,r.set(this.bboxes,n),n+=this.bboxes.length,r.buffer}static serialize(t,e){const i=t.toArrayBuffer();return e&&e.push(i),{buffer:i}}static deserialize(t){return new Er(t.buffer)}}const Tr={};function Sr(t,e,i={}){if(Tr[t])throw new Error(`${t} is already registered.`);Object.defineProperty(e,"_classRegistryKey",{value:t,writeable:!1}),Tr[t]={klass:e,omit:i.omit||[],shallow:i.shallow||[]}}Sr("Object",Object),Sr("TransferableGridIndex",Er),Sr("Color",$t),Sr("Error",Error),Sr("AJAXError",z),Sr("ResolvedImage",Ht),Sr("StylePropertyFunction",ki),Sr("StyleExpression",Ti,{omit:["_evaluator"]}),Sr("ZoomDependentExpression",Ai),Sr("ZoomConstantExpression",Ii),Sr("CompoundExpression",Ce,{omit:["_evaluate"]});for(const t in oi)oi[t]._classRegistryKey||Sr(`Expression_${t}`,oi[t]);function Cr(t){return t&&"undefined"!=typeof ArrayBuffer&&(t instanceof ArrayBuffer||t.constructor&&"ArrayBuffer"===t.constructor.name)}function Ir(t,e){if(null==t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp||t instanceof Blob)return t;if(Cr(t))return e&&e.push(t),t;if(S(t))return e&&e.push(t),t;if(ArrayBuffer.isView(t)){const i=t;return e&&e.push(i.buffer),i}if(t instanceof ImageData)return e&&e.push(t.data.buffer),t;if(Array.isArray(t)){const i=[];for(const r of t)i.push(Ir(r,e));return i}if("object"==typeof t){const i=t.constructor,r=i._classRegistryKey;if(!r)throw new Error("can't serialize object of unregistered class");if(!Tr[r])throw new Error(`${r} is not registered.`);const n=i.serialize?i.serialize(t,e):{};if(i.serialize){if(e&&n===e[e.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(const i in t){if(!t.hasOwnProperty(i))continue;if(Tr[r].omit.indexOf(i)>=0)continue;const o=t[i];n[i]=Tr[r].shallow.indexOf(i)>=0?o:Ir(o,e)}t instanceof Error&&(n.message=t.message)}if(n.$name)throw new Error("$name property is reserved for worker serialization logic.");return"Object"!==r&&(n.$name=r),n}throw new Error("can't serialize object of type "+typeof t)}function Ar(t){if(null==t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp||t instanceof Blob||Cr(t)||S(t)||ArrayBuffer.isView(t)||t instanceof ImageData)return t;if(Array.isArray(t))return t.map(Ar);if("object"==typeof t){const e=t.$name||"Object";if(!Tr[e])throw new Error(`can't deserialize unregistered class ${e}`);const{klass:i}=Tr[e];if(!i)throw new Error(`can't deserialize unregistered class ${e}`);if(i.deserialize)return i.deserialize(t);const r=Object.create(i.prototype);for(const i of Object.keys(t)){if("$name"===i)continue;const n=t[i];r[i]=Tr[e].shallow.indexOf(i)>=0?n:Ar(n)}return r}throw new Error("can't deserialize object of type "+typeof t)}class Mr{constructor(){this.first=!0}update(t,e){const i=Math.floor(t);return this.first?(this.first=!1,this.lastIntegerZoom=i,this.lastIntegerZoomTime=0,this.lastZoom=t,this.lastFloorZoom=i,!0):(this.lastFloorZoom>i?(this.lastIntegerZoom=i+1,this.lastIntegerZoomTime=e):this.lastFloorZoom<i&&(this.lastIntegerZoom=i,this.lastIntegerZoomTime=e),t!==this.lastZoom&&(this.lastZoom=t,this.lastFloorZoom=i,!0))}}const kr={"Latin-1 Supplement":t=>t>=128&&t<=255,Arabic:t=>t>=1536&&t<=1791,"Arabic Supplement":t=>t>=1872&&t<=1919,"Arabic Extended-A":t=>t>=2208&&t<=2303,"Hangul Jamo":t=>t>=4352&&t<=4607,"Unified Canadian Aboriginal Syllabics":t=>t>=5120&&t<=5759,Khmer:t=>t>=6016&&t<=6143,"Unified Canadian Aboriginal Syllabics Extended":t=>t>=6320&&t<=6399,"General Punctuation":t=>t>=8192&&t<=8303,"Letterlike Symbols":t=>t>=8448&&t<=8527,"Number Forms":t=>t>=8528&&t<=8591,"Miscellaneous Technical":t=>t>=8960&&t<=9215,"Control Pictures":t=>t>=9216&&t<=9279,"Optical Character Recognition":t=>t>=9280&&t<=9311,"Enclosed Alphanumerics":t=>t>=9312&&t<=9471,"Geometric Shapes":t=>t>=9632&&t<=9727,"Miscellaneous Symbols":t=>t>=9728&&t<=9983,"Miscellaneous Symbols and Arrows":t=>t>=11008&&t<=11263,"CJK Radicals Supplement":t=>t>=11904&&t<=12031,"Kangxi Radicals":t=>t>=12032&&t<=12255,"Ideographic Description Characters":t=>t>=12272&&t<=12287,"CJK Symbols and Punctuation":t=>t>=12288&&t<=12351,Hiragana:t=>t>=12352&&t<=12447,Katakana:t=>t>=12448&&t<=12543,Bopomofo:t=>t>=12544&&t<=12591,"Hangul Compatibility Jamo":t=>t>=12592&&t<=12687,Kanbun:t=>t>=12688&&t<=12703,"Bopomofo Extended":t=>t>=12704&&t<=12735,"CJK Strokes":t=>t>=12736&&t<=12783,"Katakana Phonetic Extensions":t=>t>=12784&&t<=12799,"Enclosed CJK Letters and Months":t=>t>=12800&&t<=13055,"CJK Compatibility":t=>t>=13056&&t<=13311,"CJK Unified Ideographs Extension A":t=>t>=13312&&t<=19903,"Yijing Hexagram Symbols":t=>t>=19904&&t<=19967,"CJK Unified Ideographs":t=>t>=19968&&t<=40959,"Yi Syllables":t=>t>=40960&&t<=42127,"Yi Radicals":t=>t>=42128&&t<=42191,"Hangul Jamo Extended-A":t=>t>=43360&&t<=43391,"Hangul Syllables":t=>t>=44032&&t<=55215,"Hangul Jamo Extended-B":t=>t>=55216&&t<=55295,"Private Use Area":t=>t>=57344&&t<=63743,"CJK Compatibility Ideographs":t=>t>=63744&&t<=64255,"Arabic Presentation Forms-A":t=>t>=64336&&t<=65023,"Vertical Forms":t=>t>=65040&&t<=65055,"CJK Compatibility Forms":t=>t>=65072&&t<=65103,"Small Form Variants":t=>t>=65104&&t<=65135,"Arabic Presentation Forms-B":t=>t>=65136&&t<=65279,"Halfwidth and Fullwidth Forms":t=>t>=65280&&t<=65519};function zr(t){for(const e of t)if(Dr(e.charCodeAt(0)))return!0;return!1}function Pr(t){for(const e of t)if(!Lr(e.charCodeAt(0)))return!1;return!0}function Lr(t){return!(kr.Arabic(t)||kr["Arabic Supplement"](t)||kr["Arabic Extended-A"](t)||kr["Arabic Presentation Forms-A"](t)||kr["Arabic Presentation Forms-B"](t))}function Dr(t){return!(746!==t&&747!==t&&(t<4352||!(kr["Bopomofo Extended"](t)||kr.Bopomofo(t)||kr["CJK Compatibility Forms"](t)&&!(t>=65097&&t<=65103)||kr["CJK Compatibility Ideographs"](t)||kr["CJK Compatibility"](t)||kr["CJK Radicals Supplement"](t)||kr["CJK Strokes"](t)||!(!kr["CJK Symbols and Punctuation"](t)||t>=12296&&t<=12305||t>=12308&&t<=12319||12336===t)||kr["CJK Unified Ideographs Extension A"](t)||kr["CJK Unified Ideographs"](t)||kr["Enclosed CJK Letters and Months"](t)||kr["Hangul Compatibility Jamo"](t)||kr["Hangul Jamo Extended-A"](t)||kr["Hangul Jamo Extended-B"](t)||kr["Hangul Jamo"](t)||kr["Hangul Syllables"](t)||kr.Hiragana(t)||kr["Ideographic Description Characters"](t)||kr.Kanbun(t)||kr["Kangxi Radicals"](t)||kr["Katakana Phonetic Extensions"](t)||kr.Katakana(t)&&12540!==t||!(!kr["Halfwidth and Fullwidth Forms"](t)||65288===t||65289===t||65293===t||t>=65306&&t<=65310||65339===t||65341===t||65343===t||t>=65371&&t<=65503||65507===t||t>=65512&&t<=65519)||!(!kr["Small Form Variants"](t)||t>=65112&&t<=65118||t>=65123&&t<=65126)||kr["Unified Canadian Aboriginal Syllabics"](t)||kr["Unified Canadian Aboriginal Syllabics Extended"](t)||kr["Vertical Forms"](t)||kr["Yijing Hexagram Symbols"](t)||kr["Yi Syllables"](t)||kr["Yi Radicals"](t))))}function Rr(t){return!(Dr(t)||function(t){return!!(kr["Latin-1 Supplement"](t)&&(167===t||169===t||174===t||177===t||188===t||189===t||190===t||215===t||247===t)||kr["General Punctuation"](t)&&(8214===t||8224===t||8225===t||8240===t||8241===t||8251===t||8252===t||8258===t||8263===t||8264===t||8265===t||8273===t)||kr["Letterlike Symbols"](t)||kr["Number Forms"](t)||kr["Miscellaneous Technical"](t)&&(t>=8960&&t<=8967||t>=8972&&t<=8991||t>=8996&&t<=9e3||9003===t||t>=9085&&t<=9114||t>=9150&&t<=9165||9167===t||t>=9169&&t<=9179||t>=9186&&t<=9215)||kr["Control Pictures"](t)&&9251!==t||kr["Optical Character Recognition"](t)||kr["Enclosed Alphanumerics"](t)||kr["Geometric Shapes"](t)||kr["Miscellaneous Symbols"](t)&&!(t>=9754&&t<=9759)||kr["Miscellaneous Symbols and Arrows"](t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||kr["CJK Symbols and Punctuation"](t)||kr.Katakana(t)||kr["Private Use Area"](t)||kr["CJK Compatibility Forms"](t)||kr["Small Form Variants"](t)||kr["Halfwidth and Fullwidth Forms"](t)||8734===t||8756===t||8757===t||t>=9984&&t<=10087||t>=10102&&t<=10131||65532===t||65533===t)}(t))}function Br(t){return t>=1424&&t<=2303||kr["Arabic Presentation Forms-A"](t)||kr["Arabic Presentation Forms-B"](t)}function Fr(t,e){return!(!e&&Br(t)||t>=2304&&t<=3583||t>=3840&&t<=4255||kr.Khmer(t))}function Or(t){for(const e of t)if(Br(e.charCodeAt(0)))return!0;return!1}const Ur="deferred",Vr="loading",Nr="loaded";let $r=null,jr="unavailable",qr=null;const Zr=function(t){t&&"string"==typeof t&&t.indexOf("NetworkError")>-1&&(jr="error"),$r&&$r(t)};function Gr(){Hr.fire(new V("pluginStateChange",{pluginStatus:jr,pluginURL:qr}))}const Hr=new $,Xr=function(){return jr},Wr=function(){if(jr!==Ur||!qr)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");jr=Vr,Gr(),qr&&B({url:qr},(t=>{t?Zr(t):(jr=Nr,Gr())}))},Kr={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>jr===Nr||null!=Kr.applyArabicShaping,isLoading:()=>jr===Vr,setState(t){if(!w())throw new Error("Cannot set the state of the rtl-text-plugin when not in the web-worker context");jr=t.pluginStatus,qr=t.pluginURL},isParsed(){if(!w())throw new Error("rtl-text-plugin is only parsed on the worker-threads");return null!=Kr.applyArabicShaping&&null!=Kr.processBidirectionalText&&null!=Kr.processStyledBidirectionalText},getPluginURL(){if(!w())throw new Error("rtl-text-plugin url can only be queried from the worker threads");return qr}};class Yr{constructor(t,e){this.zoom=t,e?(this.now=e.now,this.fadeDuration=e.fadeDuration,this.zoomHistory=e.zoomHistory,this.transition=e.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Mr,this.transition={})}isSupportedScript(t){return function(t,e){for(const i of t)if(!Fr(i.charCodeAt(0),e))return!1;return!0}(t,Kr.isLoaded())}crossFadingFactor(){return 0===this.fadeDuration?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const t=this.zoom,e=t-Math.floor(t),i=this.crossFadingFactor();return t>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:e+(1-e)*i}:{fromScale:.5,toScale:1,t:1-(1-i)*e}}}class Jr{constructor(t,e){this.property=t,this.value=e,this.expression=function(t,e){if(gi(t))return new ki(t,e);if(Si(t)){const i=Mi(t,e);if("error"===i.result)throw new Error(i.value.map((t=>`${t.key}: ${t.message}`)).join(", "));return i.value}{let i=t;return"color"===e.type&&"string"==typeof t?i=$t.parse(t):"padding"!==e.type||"number"!=typeof t&&!Array.isArray(t)||(i=Gt.parse(t)),{kind:"constant",evaluate:()=>i}}}(void 0===e?t.specification.default:e,t.specification)}isDataDriven(){return"source"===this.expression.kind||"composite"===this.expression.kind}possiblyEvaluate(t,e,i){return this.property.possiblyEvaluate(this,t,e,i)}}class Qr{constructor(t){this.property=t,this.value=new Jr(t,void 0)}transitioned(t,e){return new en(this.property,this.value,e,p({},t.transition,this.transition),t.now)}untransitioned(){return new en(this.property,this.value,null,{},0)}}class tn{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues)}getValue(t){return _(this._values[t].value.value)}setValue(t,e){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new Qr(this._values[t].property)),this._values[t].value=new Jr(this._values[t].property,null===e?void 0:_(e))}getTransition(t){return _(this._values[t].transition)}setTransition(t,e){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new Qr(this._values[t].property)),this._values[t].transition=_(e)||void 0}serialize(){const t={};for(const e of Object.keys(this._values)){const i=this.getValue(e);void 0!==i&&(t[e]=i);const r=this.getTransition(e);void 0!==r&&(t[`${e}-transition`]=r)}return t}transitioned(t,e){const i=new rn(this._properties);for(const r of Object.keys(this._values))i._values[r]=this._values[r].transitioned(t,e._values[r]);return i}untransitioned(){const t=new rn(this._properties);for(const e of Object.keys(this._values))t._values[e]=this._values[e].untransitioned();return t}}class en{constructor(t,e,i,r,n){this.property=t,this.value=e,this.begin=n+r.delay||0,this.end=this.begin+r.duration||0,t.specification.transition&&(r.delay||r.duration)&&(this.prior=i)}possiblyEvaluate(t,e,i){const r=t.now||0,n=this.value.possiblyEvaluate(t,e,i),o=this.prior;if(o){if(r>this.end)return this.prior=null,n;if(this.value.isDataDriven())return this.prior=null,n;if(r<this.begin)return o.possiblyEvaluate(t,e,i);{const a=(r-this.begin)/(this.end-this.begin);return this.property.interpolate(o.possiblyEvaluate(t,e,i),n,function(t){if(t<=0)return 0;if(t>=1)return 1;const e=t*t,i=e*t;return 4*(t<.5?i:3*(t-e)+i-.75)}(a))}}return n}}class rn{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)}possiblyEvaluate(t,e,i){const r=new an(this._properties);for(const n of Object.keys(this._values))r._values[n]=this._values[n].possiblyEvaluate(t,e,i);return r}hasTransition(){for(const t of Object.keys(this._values))if(this._values[t].prior)return!0;return!1}}class nn{constructor(t){this._properties=t,this._values=Object.create(t.defaultPropertyValues)}getValue(t){return _(this._values[t].value)}setValue(t,e){this._values[t]=new Jr(this._values[t].property,null===e?void 0:_(e))}serialize(){const t={};for(const e of Object.keys(this._values)){const i=this.getValue(e);void 0!==i&&(t[e]=i)}return t}possiblyEvaluate(t,e,i){const r=new an(this._properties);for(const n of Object.keys(this._values))r._values[n]=this._values[n].possiblyEvaluate(t,e,i);return r}}class on{constructor(t,e,i){this.property=t,this.value=e,this.parameters=i}isConstant(){return"constant"===this.value.kind}constantOr(t){return"constant"===this.value.kind?this.value.value:t}evaluate(t,e,i,r){return this.property.evaluate(this.value,this.parameters,t,e,i,r)}}class an{constructor(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues)}get(t){return this._values[t]}}class sn{constructor(t){this.specification=t}possiblyEvaluate(t,e){if(t.isDataDriven())throw new Error("Value should not be data driven");return t.expression.evaluate(e)}interpolate(t,e,i){const r=Re[this.specification.type];return r?r(t,e,i):t}}class ln{constructor(t,e){this.specification=t,this.overrides=e}possiblyEvaluate(t,e,i,r){return new on(this,"constant"===t.expression.kind||"camera"===t.expression.kind?{kind:"constant",value:t.expression.evaluate(e,null,{},i,r)}:t.expression,e)}interpolate(t,e,i){if("constant"!==t.value.kind||"constant"!==e.value.kind)return t;if(void 0===t.value.value||void 0===e.value.value)return new on(this,{kind:"constant",value:void 0},t.parameters);const r=Re[this.specification.type];if(r){const n=r(t.value.value,e.value.value,i);return new on(this,{kind:"constant",value:n},t.parameters)}return t}evaluate(t,e,i,r,n,o){return"constant"===t.kind?t.value:t.evaluate(e,i,r,n,o)}}class cn extends ln{possiblyEvaluate(t,e,i,r){if(void 0===t.value)return new on(this,{kind:"constant",value:void 0},e);if("constant"===t.expression.kind){const n=t.expression.evaluate(e,null,{},i,r),o="resolvedImage"===t.property.specification.type&&"string"!=typeof n?n.name:n,a=this._calculate(o,o,o,e);return new on(this,{kind:"constant",value:a},e)}if("camera"===t.expression.kind){const i=this._calculate(t.expression.evaluate({zoom:e.zoom-1}),t.expression.evaluate({zoom:e.zoom}),t.expression.evaluate({zoom:e.zoom+1}),e);return new on(this,{kind:"constant",value:i},e)}return new on(this,t.expression,e)}evaluate(t,e,i,r,n,o){if("source"===t.kind){const a=t.evaluate(e,i,r,n,o);return this._calculate(a,a,a,e)}return"composite"===t.kind?this._calculate(t.evaluate({zoom:Math.floor(e.zoom)-1},i,r),t.evaluate({zoom:Math.floor(e.zoom)},i,r),t.evaluate({zoom:Math.floor(e.zoom)+1},i,r),e):t.value}_calculate(t,e,i,r){return r.zoom>r.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:i,to:e}}interpolate(t){return t}}class hn{constructor(t){this.specification=t}possiblyEvaluate(t,e,i,r){if(void 0!==t.value){if("constant"===t.expression.kind){const n=t.expression.evaluate(e,null,{},i,r);return this._calculate(n,n,n,e)}return this._calculate(t.expression.evaluate(new Yr(Math.floor(e.zoom-1),e)),t.expression.evaluate(new Yr(Math.floor(e.zoom),e)),t.expression.evaluate(new Yr(Math.floor(e.zoom+1),e)),e)}}_calculate(t,e,i,r){return r.zoom>r.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:i,to:e}}interpolate(t){return t}}class un{constructor(t){this.specification=t}possiblyEvaluate(t,e,i,r){return!!t.expression.evaluate(e,null,{},i,r)}interpolate(){return!1}}class pn{constructor(t){this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const e in t){const i=t[e];i.specification.overridable&&this.overridableProperties.push(e);const r=this.defaultPropertyValues[e]=new Jr(i,void 0),n=this.defaultTransitionablePropertyValues[e]=new Qr(i);this.defaultTransitioningPropertyValues[e]=n.untransitioned(),this.defaultPossiblyEvaluatedValues[e]=r.possiblyEvaluate({})}}}Sr("DataDrivenProperty",ln),Sr("DataConstantProperty",sn),Sr("CrossFadedDataDrivenProperty",cn),Sr("CrossFadedProperty",hn),Sr("ColorRampProperty",un);const dn="-transition";class mn extends ${constructor(t,e){if(super(),this.id=t.id,this.type=t.type,this._featureFilter={filter:()=>!0,needGeometry:!1},"custom"!==t.type&&(this.metadata=t.metadata,this.minzoom=t.minzoom,this.maxzoom=t.maxzoom,"background"!==t.type&&(this.source=t.source,this.sourceLayer=t["source-layer"],this.filter=t.filter),e.layout&&(this._unevaluatedLayout=new nn(e.layout)),e.paint)){this._transitionablePaint=new tn(e.paint);for(const e in t.paint)this.setPaintProperty(e,t.paint[e],{validate:!1});for(const e in t.layout)this.setLayoutProperty(e,t.layout[e],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new an(e.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(t){return"visibility"===t?this.visibility:this._unevaluatedLayout.getValue(t)}setLayoutProperty(t,e,i={}){null!=e&&this._validate(br,`layers.${this.id}.layout.${t}`,t,e,i)||("visibility"!==t?this._unevaluatedLayout.setValue(t,e):this.visibility=e)}getPaintProperty(t){return t.endsWith(dn)?this._transitionablePaint.getTransition(t.slice(0,-11)):this._transitionablePaint.getValue(t)}setPaintProperty(t,e,i={}){if(null!=e&&this._validate(vr,`layers.${this.id}.paint.${t}`,t,e,i))return!1;if(t.endsWith(dn))return this._transitionablePaint.setTransition(t.slice(0,-11),e||void 0),!1;{const i=this._transitionablePaint._values[t],r="cross-faded-data-driven"===i.property.specification["property-type"],n=i.value.isDataDriven(),o=i.value;this._transitionablePaint.setValue(t,e),this._handleSpecialPaintPropertyUpdate(t);const a=this._transitionablePaint._values[t].value;return a.isDataDriven()||n||r||this._handleOverridablePaintPropertyUpdate(t,o,a)}}_handleSpecialPaintPropertyUpdate(t){}_handleOverridablePaintPropertyUpdate(t,e,i){return!1}isHidden(t){return!!(this.minzoom&&t<this.minzoom)||!!(this.maxzoom&&t>=this.maxzoom)||"none"===this.visibility}updateTransitions(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(t,e){t.getCrossfadeParameters&&(this._crossfadeParameters=t.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t,void 0,e)),this.paint=this._transitioningPaint.possiblyEvaluate(t,void 0,e)}serialize(){const 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),g(t,((t,e)=>!(void 0===t||"layout"===e&&!Object.keys(t).length||"paint"===e&&!Object.keys(t).length)))}_validate(t,e,i,r,n={}){return(!n||!1!==n.validate)&&wr(this,t.call(yr,{key:e,layerType:this.type,objectKey:i,value:r,styleSpec:j,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const t in this.paint._values){const e=this.paint.get(t);if(e instanceof on&&pi(e.property.specification)&&("source"===e.value.kind||"composite"===e.value.kind)&&e.value.isStateDependent)return!0}return!1}}const fn={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class gn{constructor(t,e){this._structArray=t,this._pos1=e*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class _n{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(t,e){return t._trim(),e&&(t.isTransferred=!0,e.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}}static deserialize(t){const e=Object.create(this.prototype);return e.arrayBuffer=t.arrayBuffer,e.length=t.length,e.capacity=t.arrayBuffer.byteLength/e.bytesPerElement,e._refreshViews(),e}_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);const e=this.uint8;this._refreshViews(),e&&this.uint8.set(e)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function yn(t,e=1){let i=0,r=0;return{members:t.map((t=>{const n=fn[t.type].BYTES_PER_ELEMENT,o=i=xn(i,Math.max(e,n)),a=t.components||1;return r=Math.max(r,n),i+=n*a,{name:t.name,type:t.type,components:a,offset:o}})),size:xn(i,Math.max(r,e)),alignment:e}}function xn(t,e){return Math.ceil(t/e)*e}class vn extends _n{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e){const i=this.length;return this.resize(i+1),this.emplace(i,t,e)}emplace(t,e,i){const r=2*t;return this.int16[r+0]=e,this.int16[r+1]=i,t}}vn.prototype.bytesPerElement=4,Sr("StructArrayLayout2i4",vn);class bn extends _n{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i){const r=this.length;return this.resize(r+1),this.emplace(r,t,e,i)}emplace(t,e,i,r){const n=3*t;return this.int16[n+0]=e,this.int16[n+1]=i,this.int16[n+2]=r,t}}bn.prototype.bytesPerElement=6,Sr("StructArrayLayout3i6",bn);class wn extends _n{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i,r){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,i,r)}emplace(t,e,i,r,n){const o=4*t;return this.int16[o+0]=e,this.int16[o+1]=i,this.int16[o+2]=r,this.int16[o+3]=n,t}}wn.prototype.bytesPerElement=8,Sr("StructArrayLayout4i8",wn);class En extends _n{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i,r,n,o){const a=this.length;return this.resize(a+1),this.emplace(a,t,e,i,r,n,o)}emplace(t,e,i,r,n,o,a){const s=6*t;return this.int16[s+0]=e,this.int16[s+1]=i,this.int16[s+2]=r,this.int16[s+3]=n,this.int16[s+4]=o,this.int16[s+5]=a,t}}En.prototype.bytesPerElement=12,Sr("StructArrayLayout2i4i12",En);class Tn extends _n{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i,r,n,o){const a=this.length;return this.resize(a+1),this.emplace(a,t,e,i,r,n,o)}emplace(t,e,i,r,n,o,a){const s=4*t,l=8*t;return this.int16[s+0]=e,this.int16[s+1]=i,this.uint8[l+4]=r,this.uint8[l+5]=n,this.uint8[l+6]=o,this.uint8[l+7]=a,t}}Tn.prototype.bytesPerElement=8,Sr("StructArrayLayout2i4ub8",Tn);class Sn extends _n{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e){const i=this.length;return this.resize(i+1),this.emplace(i,t,e)}emplace(t,e,i){const r=2*t;return this.float32[r+0]=e,this.float32[r+1]=i,t}}Sn.prototype.bytesPerElement=8,Sr("StructArrayLayout2f8",Sn);class Cn extends _n{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,i,r,n,o,a,s,l,c){const h=this.length;return this.resize(h+1),this.emplace(h,t,e,i,r,n,o,a,s,l,c)}emplace(t,e,i,r,n,o,a,s,l,c,h){const u=10*t;return this.uint16[u+0]=e,this.uint16[u+1]=i,this.uint16[u+2]=r,this.uint16[u+3]=n,this.uint16[u+4]=o,this.uint16[u+5]=a,this.uint16[u+6]=s,this.uint16[u+7]=l,this.uint16[u+8]=c,this.uint16[u+9]=h,t}}Cn.prototype.bytesPerElement=20,Sr("StructArrayLayout10ui20",Cn);class In extends _n{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,i,r,n,o,a,s,l,c,h,u){const p=this.length;return this.resize(p+1),this.emplace(p,t,e,i,r,n,o,a,s,l,c,h,u)}emplace(t,e,i,r,n,o,a,s,l,c,h,u,p){const d=12*t;return this.int16[d+0]=e,this.int16[d+1]=i,this.int16[d+2]=r,this.int16[d+3]=n,this.uint16[d+4]=o,this.uint16[d+5]=a,this.uint16[d+6]=s,this.uint16[d+7]=l,this.int16[d+8]=c,this.int16[d+9]=h,this.int16[d+10]=u,this.int16[d+11]=p,t}}In.prototype.bytesPerElement=24,Sr("StructArrayLayout4i4ui4i24",In);class An extends _n{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,i){const r=this.length;return this.resize(r+1),this.emplace(r,t,e,i)}emplace(t,e,i,r){const n=3*t;return this.float32[n+0]=e,this.float32[n+1]=i,this.float32[n+2]=r,t}}An.prototype.bytesPerElement=12,Sr("StructArrayLayout3f12",An);class Mn extends _n{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.uint32[1*t+0]=e,t}}Mn.prototype.bytesPerElement=4,Sr("StructArrayLayout1ul4",Mn);class kn extends _n{_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,e,i,r,n,o,a,s,l){const c=this.length;return this.resize(c+1),this.emplace(c,t,e,i,r,n,o,a,s,l)}emplace(t,e,i,r,n,o,a,s,l,c){const h=10*t,u=5*t;return this.int16[h+0]=e,this.int16[h+1]=i,this.int16[h+2]=r,this.int16[h+3]=n,this.int16[h+4]=o,this.int16[h+5]=a,this.uint32[u+3]=s,this.uint16[h+8]=l,this.uint16[h+9]=c,t}}kn.prototype.bytesPerElement=20,Sr("StructArrayLayout6i1ul2ui20",kn);class zn extends _n{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i,r,n,o){const a=this.length;return this.resize(a+1),this.emplace(a,t,e,i,r,n,o)}emplace(t,e,i,r,n,o,a){const s=6*t;return this.int16[s+0]=e,this.int16[s+1]=i,this.int16[s+2]=r,this.int16[s+3]=n,this.int16[s+4]=o,this.int16[s+5]=a,t}}zn.prototype.bytesPerElement=12,Sr("StructArrayLayout2i2i2i12",zn);class Pn extends _n{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i,r,n){const o=this.length;return this.resize(o+1),this.emplace(o,t,e,i,r,n)}emplace(t,e,i,r,n,o){const a=4*t,s=8*t;return this.float32[a+0]=e,this.float32[a+1]=i,this.float32[a+2]=r,this.int16[s+6]=n,this.int16[s+7]=o,t}}Pn.prototype.bytesPerElement=16,Sr("StructArrayLayout2f1f2i16",Pn);class Ln extends _n{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,i,r){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,i,r)}emplace(t,e,i,r,n){const o=12*t,a=3*t;return this.uint8[o+0]=e,this.uint8[o+1]=i,this.float32[a+1]=r,this.float32[a+2]=n,t}}Ln.prototype.bytesPerElement=12,Sr("StructArrayLayout2ub2f12",Ln);class Dn extends _n{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,i){const r=this.length;return this.resize(r+1),this.emplace(r,t,e,i)}emplace(t,e,i,r){const n=3*t;return this.uint16[n+0]=e,this.uint16[n+1]=i,this.uint16[n+2]=r,t}}Dn.prototype.bytesPerElement=6,Sr("StructArrayLayout3ui6",Dn);class Rn extends _n{_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,e,i,r,n,o,a,s,l,c,h,u,p,d,m,f,g){const _=this.length;return this.resize(_+1),this.emplace(_,t,e,i,r,n,o,a,s,l,c,h,u,p,d,m,f,g)}emplace(t,e,i,r,n,o,a,s,l,c,h,u,p,d,m,f,g,_){const y=24*t,x=12*t,v=48*t;return this.int16[y+0]=e,this.int16[y+1]=i,this.uint16[y+2]=r,this.uint16[y+3]=n,this.uint32[x+2]=o,this.uint32[x+3]=a,this.uint32[x+4]=s,this.uint16[y+10]=l,this.uint16[y+11]=c,this.uint16[y+12]=h,this.float32[x+7]=u,this.float32[x+8]=p,this.uint8[v+36]=d,this.uint8[v+37]=m,this.uint8[v+38]=f,this.uint32[x+10]=g,this.int16[y+22]=_,t}}Rn.prototype.bytesPerElement=48,Sr("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",Rn);class Bn extends _n{_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,e,i,r,n,o,a,s,l,c,h,u,p,d,m,f,g,_,y,x,v,b,w,E,T,S,C,I){const A=this.length;return this.resize(A+1),this.emplace(A,t,e,i,r,n,o,a,s,l,c,h,u,p,d,m,f,g,_,y,x,v,b,w,E,T,S,C,I)}emplace(t,e,i,r,n,o,a,s,l,c,h,u,p,d,m,f,g,_,y,x,v,b,w,E,T,S,C,I,A){const M=34*t,k=17*t;return this.int16[M+0]=e,this.int16[M+1]=i,this.int16[M+2]=r,this.int16[M+3]=n,this.int16[M+4]=o,this.int16[M+5]=a,this.int16[M+6]=s,this.int16[M+7]=l,this.uint16[M+8]=c,this.uint16[M+9]=h,this.uint16[M+10]=u,this.uint16[M+11]=p,this.uint16[M+12]=d,this.uint16[M+13]=m,this.uint16[M+14]=f,this.uint16[M+15]=g,this.uint16[M+16]=_,this.uint16[M+17]=y,this.uint16[M+18]=x,this.uint16[M+19]=v,this.uint16[M+20]=b,this.uint16[M+21]=w,this.uint16[M+22]=E,this.uint32[k+12]=T,this.float32[k+13]=S,this.float32[k+14]=C,this.float32[k+15]=I,this.float32[k+16]=A,t}}Bn.prototype.bytesPerElement=68,Sr("StructArrayLayout8i15ui1ul4f68",Bn);class Fn extends _n{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.float32[1*t+0]=e,t}}Fn.prototype.bytesPerElement=4,Sr("StructArrayLayout1f4",Fn);class On extends _n{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,i){const r=this.length;return this.resize(r+1),this.emplace(r,t,e,i)}emplace(t,e,i,r){const n=4*t;return this.uint32[2*t+0]=e,this.uint16[n+2]=i,this.uint16[n+3]=r,t}}On.prototype.bytesPerElement=8,Sr("StructArrayLayout1ul2ui8",On);class Un extends _n{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e){const i=this.length;return this.resize(i+1),this.emplace(i,t,e)}emplace(t,e,i){const r=2*t;return this.uint16[r+0]=e,this.uint16[r+1]=i,t}}Un.prototype.bytesPerElement=4,Sr("StructArrayLayout2ui4",Un);class Vn extends _n{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.uint16[1*t+0]=e,t}}Vn.prototype.bytesPerElement=2,Sr("StructArrayLayout1ui2",Vn);class Nn extends _n{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,i,r){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,i,r)}emplace(t,e,i,r,n){const o=4*t;return this.float32[o+0]=e,this.float32[o+1]=i,this.float32[o+2]=r,this.float32[o+3]=n,t}}Nn.prototype.bytesPerElement=16,Sr("StructArrayLayout4f16",Nn);class $n extends gn{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 n(this.anchorPointX,this.anchorPointY)}}$n.prototype.size=20;class jn extends kn{get(t){return new $n(this,t)}}Sr("CollisionBoxArray",jn);class qn extends gn{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]}}qn.prototype.size=48;class Zn extends Rn{get(t){return new qn(this,t)}}Sr("PlacedSymbolArray",Zn);class Gn extends gn{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]}}Gn.prototype.size=68;class Hn extends Bn{get(t){return new Gn(this,t)}}Sr("SymbolInstanceArray",Hn);class Xn extends Fn{getoffsetX(t){return this.float32[1*t+0]}}Sr("GlyphOffsetArray",Xn);class Wn extends bn{getx(t){return this.int16[3*t+0]}gety(t){return this.int16[3*t+1]}gettileUnitDistanceFromAnchor(t){return this.int16[3*t+2]}}Sr("SymbolLineVertexArray",Wn);class Kn extends gn{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]}}Kn.prototype.size=8;class Yn extends On{get(t){return new Kn(this,t)}}Sr("FeatureIndexArray",Yn);class Jn extends vn{}class Qn extends vn{}class to extends vn{}class eo extends En{}class io extends Tn{}class ro extends Sn{}class no extends Cn{}class oo extends In{}class ao extends An{}class so extends Mn{}class lo extends zn{}class co extends Ln{}class ho extends Dn{}class uo extends Un{}const po=yn([{name:"a_pos",components:2,type:"Int16"}],4),{members:mo}=po;class fo{constructor(t=[]){this.segments=t}prepareSegment(t,e,i,r){let n=this.segments[this.segments.length-1];return t>fo.MAX_VERTEX_ARRAY_LENGTH&&x(`Max vertices per segment is ${fo.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${t}`),(!n||n.vertexLength+t>fo.MAX_VERTEX_ARRAY_LENGTH||n.sortKey!==r)&&(n={vertexOffset:e.length,primitiveOffset:i.length,vertexLength:0,primitiveLength:0},void 0!==r&&(n.sortKey=r),this.segments.push(n)),n}get(){return this.segments}destroy(){for(const t of this.segments)for(const e in t.vaos)t.vaos[e].destroy()}static simpleSegment(t,e,i,r){return new fo([{vertexOffset:t,primitiveOffset:e,vertexLength:i,primitiveLength:r,vaos:{},sortKey:0}])}}function go(t,e){return 256*(t=h(Math.floor(t),0,255))+h(Math.floor(e),0,255)}fo.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Sr("SegmentVector",fo);const _o=yn([{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 yo={exports:{}},xo=function(t,e){var i,r,n,o,a,s,l,c;for(r=t.length-(i=3&t.length),n=e,a=3432918353,s=461845907,c=0;c<r;)l=255&t.charCodeAt(c)|(255&t.charCodeAt(++c))<<8|(255&t.charCodeAt(++c))<<16|(255&t.charCodeAt(++c))<<24,++c,n=27492+(65535&(o=5*(65535&(n=(n^=l=(65535&(l=(l=(65535&l)*a+(((l>>>16)*a&65535)<<16)&4294967295)<<15|l>>>17))*s+(((l>>>16)*s&65535)<<16)&4294967295)<<13|n>>>19))+((5*(n>>>16)&65535)<<16)&4294967295))+((58964+(o>>>16)&65535)<<16);switch(l=0,i){case 3:l^=(255&t.charCodeAt(c+2))<<16;case 2:l^=(255&t.charCodeAt(c+1))<<8;case 1:n^=l=(65535&(l=(l=(65535&(l^=255&t.charCodeAt(c)))*a+(((l>>>16)*a&65535)<<16)&4294967295)<<15|l>>>17))*s+(((l>>>16)*s&65535)<<16)&4294967295}return n^=t.length,n=2246822507*(65535&(n^=n>>>16))+((2246822507*(n>>>16)&65535)<<16)&4294967295,n=3266489909*(65535&(n^=n>>>13))+((3266489909*(n>>>16)&65535)<<16)&4294967295,(n^=n>>>16)>>>0},vo=function(t,e){for(var i,r=t.length,n=e^r,o=0;r>=4;)i=1540483477*(65535&(i=255&t.charCodeAt(o)|(255&t.charCodeAt(++o))<<8|(255&t.charCodeAt(++o))<<16|(255&t.charCodeAt(++o))<<24))+((1540483477*(i>>>16)&65535)<<16),n=1540483477*(65535&n)+((1540483477*(n>>>16)&65535)<<16)^(i=1540483477*(65535&(i^=i>>>24))+((1540483477*(i>>>16)&65535)<<16)),r-=4,++o;switch(r){case 3:n^=(255&t.charCodeAt(o+2))<<16;case 2:n^=(255&t.charCodeAt(o+1))<<8;case 1:n=1540483477*(65535&(n^=255&t.charCodeAt(o)))+((1540483477*(n>>>16)&65535)<<16)}return n=1540483477*(65535&(n^=n>>>13))+((1540483477*(n>>>16)&65535)<<16),(n^=n>>>15)>>>0};yo.exports=xo,yo.exports.murmur3=xo,yo.exports.murmur2=vo;var bo=e(yo.exports);class wo{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(t,e,i,r){this.ids.push(Eo(t)),this.positions.push(e,i,r)}getPositions(t){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const e=Eo(t);let i=0,r=this.ids.length-1;for(;i<r;){const t=i+r>>1;this.ids[t]>=e?r=t:i=t+1}const n=[];for(;this.ids[i]===e;)n.push({index:this.positions[3*i],start:this.positions[3*i+1],end:this.positions[3*i+2]}),i++;return n}static serialize(t,e){const i=new Float64Array(t.ids),r=new Uint32Array(t.positions);return To(i,r,0,i.length-1),e&&e.push(i.buffer,r.buffer),{ids:i,positions:r}}static deserialize(t){const e=new wo;return e.ids=t.ids,e.positions=t.positions,e.indexed=!0,e}}function Eo(t){const e=+t;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:bo(String(t))}function To(t,e,i,r){for(;i<r;){const n=t[i+r>>1];let o=i-1,a=r+1;for(;;){do{o++}while(t[o]<n);do{a--}while(t[a]>n);if(o>=a)break;So(t,o,a),So(e,3*o,3*a),So(e,3*o+1,3*a+1),So(e,3*o+2,3*a+2)}a-i<r-a?(To(t,e,i,a),i=a+1):(To(t,e,a+1,r),r=a)}}function So(t,e,i){const r=t[e];t[e]=t[i],t[i]=r}Sr("FeaturePositionMap",wo);class Co{constructor(t,e){this.gl=t.gl,this.location=e}}class Io extends Co{constructor(t,e){super(t,e),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1f(this.location,t))}}class Ao extends Co{constructor(t,e){super(t,e),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 Mo extends Co{constructor(t,e){super(t,e),this.current=$t.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))}}const ko=new Float32Array(16);function zo(t){return[go(255*t.r,255*t.g),go(255*t.b,255*t.a)]}class Po{constructor(t,e,i){this.value=t,this.uniformNames=e.map((t=>`u_${t}`)),this.type=i}setUniform(t,e,i){t.set(i.constantOr(this.value))}getBinding(t,e,i){return"color"===this.type?new Mo(t,e):new Io(t,e)}}class Lo{constructor(t,e){this.uniformNames=e.map((t=>`u_${t}`)),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(t,e){this.pixelRatioFrom=e.pixelRatio,this.pixelRatioTo=t.pixelRatio,this.patternFrom=e.tlbr,this.patternTo=t.tlbr}setUniform(t,e,i,r){const n="u_pattern_to"===r?this.patternTo:"u_pattern_from"===r?this.patternFrom:"u_pixel_ratio_to"===r?this.pixelRatioTo:"u_pixel_ratio_from"===r?this.pixelRatioFrom:null;n&&t.set(n)}getBinding(t,e,i){return"u_pattern"===i.substr(0,9)?new Ao(t,e):new Io(t,e)}}class Do{constructor(t,e,i,r){this.expression=t,this.type=i,this.maxValue=0,this.paintVertexAttributes=e.map((t=>({name:`a_${t}`,type:"Float32",components:"color"===i?2:1,offset:0}))),this.paintVertexArray=new r}populatePaintArray(t,e,i,r,n){const o=this.paintVertexArray.length,a=this.expression.evaluate(new Yr(0),e,{},r,[],n);this.paintVertexArray.resize(t),this._setPaintValue(o,t,a)}updatePaintArray(t,e,i,r){const n=this.expression.evaluate({zoom:0},i,r);this._setPaintValue(t,e,n)}_setPaintValue(t,e,i){if("color"===this.type){const r=zo(i);for(let i=t;i<e;i++)this.paintVertexArray.emplace(i,r[0],r[1])}else{for(let r=t;r<e;r++)this.paintVertexArray.emplace(r,i);this.maxValue=Math.max(this.maxValue,Math.abs(i))}}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 Ro{constructor(t,e,i,r,n,o){this.expression=t,this.uniformNames=e.map((t=>`u_${t}_t`)),this.type=i,this.useIntegerZoom=r,this.zoom=n,this.maxValue=0,this.paintVertexAttributes=e.map((t=>({name:`a_${t}`,type:"Float32",components:"color"===i?4:2,offset:0}))),this.paintVertexArray=new o}populatePaintArray(t,e,i,r,n){const o=this.expression.evaluate(new Yr(this.zoom),e,{},r,[],n),a=this.expression.evaluate(new Yr(this.zoom+1),e,{},r,[],n),s=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(s,t,o,a)}updatePaintArray(t,e,i,r){const n=this.expression.evaluate({zoom:this.zoom},i,r),o=this.expression.evaluate({zoom:this.zoom+1},i,r);this._setPaintValue(t,e,n,o)}_setPaintValue(t,e,i,r){if("color"===this.type){const n=zo(i),o=zo(r);for(let i=t;i<e;i++)this.paintVertexArray.emplace(i,n[0],n[1],o[0],o[1])}else{for(let n=t;n<e;n++)this.paintVertexArray.emplace(n,i,r);this.maxValue=Math.max(this.maxValue,Math.abs(i),Math.abs(r))}}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,e){const i=this.useIntegerZoom?Math.floor(e.zoom):e.zoom,r=h(this.expression.interpolationFactor(i,this.zoom,this.zoom+1),0,1);t.set(r)}getBinding(t,e,i){return new Io(t,e)}}class Bo{constructor(t,e,i,r,n,o){this.expression=t,this.type=e,this.useIntegerZoom=i,this.zoom=r,this.layerId=o,this.zoomInPaintVertexArray=new n,this.zoomOutPaintVertexArray=new n}populatePaintArray(t,e,i){const r=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(t),this.zoomOutPaintVertexArray.resize(t),this._setPaintValues(r,t,e.patterns&&e.patterns[this.layerId],i)}updatePaintArray(t,e,i,r,n){this._setPaintValues(t,e,i.patterns&&i.patterns[this.layerId],n)}_setPaintValues(t,e,i,r){if(!r||!i)return;const{min:n,mid:o,max:a}=i,s=r[n],l=r[o],c=r[a];if(s&&l&&c)for(let i=t;i<e;i++)this.zoomInPaintVertexArray.emplace(i,l.tl[0],l.tl[1],l.br[0],l.br[1],s.tl[0],s.tl[1],s.br[0],s.br[1],l.pixelRatio,s.pixelRatio),this.zoomOutPaintVertexArray.emplace(i,l.tl[0],l.tl[1],l.br[0],l.br[1],c.tl[0],c.tl[1],c.br[0],c.br[1],l.pixelRatio,c.pixelRatio)}upload(t){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=t.createVertexBuffer(this.zoomInPaintVertexArray,_o.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=t.createVertexBuffer(this.zoomOutPaintVertexArray,_o.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class Fo{constructor(t,e,i){this.binders={},this._buffers=[];const r=[];for(const n in t.paint._values){if(!i(n))continue;const o=t.paint.get(n);if(!(o instanceof on&&pi(o.property.specification)))continue;const a=Uo(n,t.type),s=o.value,l=o.property.specification.type,c=o.property.useIntegerZoom,h=o.property.specification["property-type"],u="cross-faded"===h||"cross-faded-data-driven"===h;if("constant"===s.kind)this.binders[n]=u?new Lo(s.value,a):new Po(s.value,a,l),r.push(`/u_${n}`);else if("source"===s.kind||u){const i=Vo(n,l,"source");this.binders[n]=u?new Bo(s,l,c,e,i,t.id):new Do(s,a,l,i),r.push(`/a_${n}`)}else{const t=Vo(n,l,"composite");this.binders[n]=new Ro(s,a,l,c,e,t),r.push(`/z_${n}`)}}this.cacheKey=r.sort().join("")}getMaxValue(t){const e=this.binders[t];return e instanceof Do||e instanceof Ro?e.maxValue:0}populatePaintArrays(t,e,i,r,n){for(const o in this.binders){const a=this.binders[o];(a instanceof Do||a instanceof Ro||a instanceof Bo)&&a.populatePaintArray(t,e,i,r,n)}}setConstantPatternPositions(t,e){for(const i in this.binders){const r=this.binders[i];r instanceof Lo&&r.setConstantPatternPositions(t,e)}}updatePaintArrays(t,e,i,r,n){let o=!1;for(const a in t){const s=e.getPositions(a);for(const e of s){const s=i.feature(e.index);for(const i in this.binders){const l=this.binders[i];if((l instanceof Do||l instanceof Ro||l instanceof Bo)&&!0===l.expression.isStateDependent){const c=r.paint.get(i);l.expression=c.value,l.updatePaintArray(e.start,e.end,s,t[a],n),o=!0}}}}return o}defines(){const t=[];for(const e in this.binders){const i=this.binders[e];(i instanceof Po||i instanceof Lo)&&t.push(...i.uniformNames.map((t=>`#define HAS_UNIFORM_${t}`)))}return t}getBinderAttributes(){const t=[];for(const e in this.binders){const i=this.binders[e];if(i instanceof Do||i instanceof Ro)for(let e=0;e<i.paintVertexAttributes.length;e++)t.push(i.paintVertexAttributes[e].name);else if(i instanceof Bo)for(let e=0;e<_o.members.length;e++)t.push(_o.members[e].name)}return t}getBinderUniforms(){const t=[];for(const e in this.binders){const i=this.binders[e];if(i instanceof Po||i instanceof Lo||i instanceof Ro)for(const e of i.uniformNames)t.push(e)}return t}getPaintVertexBuffers(){return this._buffers}getUniforms(t,e){const i=[];for(const r in this.binders){const n=this.binders[r];if(n instanceof Po||n instanceof Lo||n instanceof Ro)for(const o of n.uniformNames)if(e[o]){const a=n.getBinding(t,e[o],o);i.push({name:o,property:r,binding:a})}}return i}setUniforms(t,e,i,r){for(const{name:t,property:n,binding:o}of e)this.binders[n].setUniform(o,r,i.get(n),t)}updatePaintBuffers(t){this._buffers=[];for(const e in this.binders){const i=this.binders[e];if(t&&i instanceof Bo){const e=2===t.fromScale?i.zoomInPaintVertexBuffer:i.zoomOutPaintVertexBuffer;e&&this._buffers.push(e)}else(i instanceof Do||i instanceof Ro)&&i.paintVertexBuffer&&this._buffers.push(i.paintVertexBuffer)}}upload(t){for(const e in this.binders){const i=this.binders[e];(i instanceof Do||i instanceof Ro||i instanceof Bo)&&i.upload(t)}this.updatePaintBuffers()}destroy(){for(const t in this.binders){const e=this.binders[t];(e instanceof Do||e instanceof Ro||e instanceof Bo)&&e.destroy()}}}class Oo{constructor(t,e,i=(()=>!0)){this.programConfigurations={};for(const r of t)this.programConfigurations[r.id]=new Fo(r,e,i);this.needsUpload=!1,this._featureMap=new wo,this._bufferOffset=0}populatePaintArrays(t,e,i,r,n,o){for(const i in this.programConfigurations)this.programConfigurations[i].populatePaintArrays(t,e,r,n,o);void 0!==e.id&&this._featureMap.add(e.id,i,this._bufferOffset,t),this._bufferOffset=t,this.needsUpload=!0}updatePaintArrays(t,e,i,r){for(const n of i)this.needsUpload=this.programConfigurations[n.id].updatePaintArrays(t,this._featureMap,e,n,r)||this.needsUpload}get(t){return this.programConfigurations[t]}upload(t){if(this.needsUpload){for(const e in this.programConfigurations)this.programConfigurations[e].upload(t);this.needsUpload=!1}}destroy(){for(const t in this.programConfigurations)this.programConfigurations[t].destroy()}}function Uo(t,e){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[t]||[t.replace(`${e}-`,"").replace(/-/g,"_")]}function Vo(t,e,i){const r={color:{source:Sn,composite:Nn},number:{source:Fn,composite:Sn}},n=function(t){return{"line-pattern":{source:no,composite:no},"fill-pattern":{source:no,composite:no},"fill-extrusion-pattern":{source:no,composite:no}}[t]}(t);return n&&n[i]||r[e][i]}Sr("ConstantBinder",Po),Sr("CrossFadedConstantBinder",Lo),Sr("SourceExpressionBinder",Do),Sr("CrossFadedCompositeBinder",Bo),Sr("CompositeExpressionBinder",Ro),Sr("ProgramConfiguration",Fo,{omit:["_buffers"]}),Sr("ProgramConfigurationSet",Oo);var No=8192;const $o=Math.pow(2,14)-1,jo=-$o-1;function qo(t){const e=No/t.extent,i=t.loadGeometry();for(let t=0;t<i.length;t++){const r=i[t];for(let t=0;t<r.length;t++){const i=r[t],n=Math.round(i.x*e),o=Math.round(i.y*e);i.x=h(n,jo,$o),i.y=h(o,jo,$o),(n<i.x||n>i.x+1||o<i.y||o>i.y+1)&&x("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return i}function Zo(t,e){return{type:t.type,id:t.id,properties:t.properties,geometry:e?qo(t):[]}}function Go(t,e,i,r,n){t.emplaceBack(2*e+(r+1)/2,2*i+(n+1)/2)}class Ho{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new Qn,this.indexArray=new ho,this.segments=new fo,this.programConfigurations=new Oo(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id))}populate(t,e,i){const r=this.layers[0],n=[];let o=null,a=!1;"circle"===r.type&&(o=r.layout.get("circle-sort-key"),a=!o.isConstant());for(const{feature:e,id:r,index:s,sourceLayerIndex:l}of t){const t=this.layers[0]._featureFilter.needGeometry,c=Zo(e,t);if(!this.layers[0]._featureFilter.filter(new Yr(this.zoom),c,i))continue;const h=a?o.evaluate(c,{},i):void 0,u={id:r,properties:e.properties,type:e.type,sourceLayerIndex:l,index:s,geometry:t?c.geometry:qo(e),patterns:{},sortKey:h};n.push(u)}a&&n.sort(((t,e)=>t.sortKey-e.sortKey));for(const r of n){const{geometry:n,index:o,sourceLayerIndex:a}=r,s=t[o].feature;this.addFeature(r,n,o,i),e.featureIndex.insert(s,n,o,a,this.index)}}update(t,e,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,i)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,mo),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,e,i,r){for(const i of e)for(const e of i){const i=e.x,r=e.y;if(i<0||i>=No||r<0||r>=No)continue;const n=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,t.sortKey),o=n.vertexLength;Go(this.layoutVertexArray,i,r,-1,-1),Go(this.layoutVertexArray,i,r,1,-1),Go(this.layoutVertexArray,i,r,1,1),Go(this.layoutVertexArray,i,r,-1,1),this.indexArray.emplaceBack(o,o+1,o+2),this.indexArray.emplaceBack(o,o+3,o+2),n.vertexLength+=4,n.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,i,{},r)}}function Xo(t,e){for(let i=0;i<t.length;i++)if(ra(e,t[i]))return!0;for(let i=0;i<e.length;i++)if(ra(t,e[i]))return!0;return!!Jo(t,e)}function Wo(t,e,i){return!!ra(t,e)||!!ta(e,t,i)}function Ko(t,e){if(1===t.length)return ia(e,t[0]);for(let i=0;i<e.length;i++){const r=e[i];for(let e=0;e<r.length;e++)if(ra(t,r[e]))return!0}for(let i=0;i<t.length;i++)if(ia(e,t[i]))return!0;for(let i=0;i<e.length;i++)if(Jo(t,e[i]))return!0;return!1}function Yo(t,e,i){if(t.length>1){if(Jo(t,e))return!0;for(let r=0;r<e.length;r++)if(ta(e[r],t,i))return!0}for(let r=0;r<t.length;r++)if(ta(t[r],e,i))return!0;return!1}function Jo(t,e){if(0===t.length||0===e.length)return!1;for(let i=0;i<t.length-1;i++){const r=t[i],n=t[i+1];for(let t=0;t<e.length-1;t++)if(Qo(r,n,e[t],e[t+1]))return!0}return!1}function Qo(t,e,i,r){return v(t,i,r)!==v(e,i,r)&&v(t,e,i)!==v(t,e,r)}function ta(t,e,i){const r=i*i;if(1===e.length)return t.distSqr(e[0])<r;for(let i=1;i<e.length;i++)if(ea(t,e[i-1],e[i])<r)return!0;return!1}function ea(t,e,i){const r=e.distSqr(i);if(0===r)return t.distSqr(e);const n=((t.x-e.x)*(i.x-e.x)+(t.y-e.y)*(i.y-e.y))/r;return t.distSqr(n<0?e:n>1?i:i.sub(e)._mult(n)._add(e))}function ia(t,e){let i,r,n,o=!1;for(let a=0;a<t.length;a++){i=t[a];for(let t=0,a=i.length-1;t<i.length;a=t++)r=i[t],n=i[a],r.y>e.y!=n.y>e.y&&e.x<(n.x-r.x)*(e.y-r.y)/(n.y-r.y)+r.x&&(o=!o)}return o}function ra(t,e){let i=!1;for(let r=0,n=t.length-1;r<t.length;n=r++){const o=t[r],a=t[n];o.y>e.y!=a.y>e.y&&e.x<(a.x-o.x)*(e.y-o.y)/(a.y-o.y)+o.x&&(i=!i)}return i}function na(t,e,i){const r=i[0],n=i[2];if(t.x<r.x&&e.x<r.x||t.x>n.x&&e.x>n.x||t.y<r.y&&e.y<r.y||t.y>n.y&&e.y>n.y)return!1;const o=v(t,e,i[0]);return o!==v(t,e,i[1])||o!==v(t,e,i[2])||o!==v(t,e,i[3])}function oa(t,e,i){const r=e.paint.get(t).value;return"constant"===r.kind?r.value:i.programConfigurations.get(e.id).getMaxValue(t)}function aa(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function sa(t,e,i,r,o){if(!e[0]&&!e[1])return t;const a=n.convert(e)._mult(o);"viewport"===i&&a._rotate(-r);const s=[];for(let e=0;e<t.length;e++)s.push(t[e].sub(a));return s}let la,ca;Sr("CircleBucket",Ho,{omit:["layers"]});var ha={get paint(){return ca=ca||new pn({"circle-radius":new ln(j.paint_circle["circle-radius"]),"circle-color":new ln(j.paint_circle["circle-color"]),"circle-blur":new ln(j.paint_circle["circle-blur"]),"circle-opacity":new ln(j.paint_circle["circle-opacity"]),"circle-translate":new sn(j.paint_circle["circle-translate"]),"circle-translate-anchor":new sn(j.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new sn(j.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new sn(j.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new ln(j.paint_circle["circle-stroke-width"]),"circle-stroke-color":new ln(j.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new ln(j.paint_circle["circle-stroke-opacity"])})},get layout(){return la=la||new pn({"circle-sort-key":new ln(j.layout_circle["circle-sort-key"])})}},ua=1e-6,pa="undefined"!=typeof Float32Array?Float32Array:Array;function da(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function ma(t,e,i){var r=e[0],n=e[1],o=e[2],a=e[3],s=e[4],l=e[5],c=e[6],h=e[7],u=e[8],p=e[9],d=e[10],m=e[11],f=e[12],g=e[13],_=e[14],y=e[15],x=i[0],v=i[1],b=i[2],w=i[3];return t[0]=x*r+v*s+b*u+w*f,t[1]=x*n+v*l+b*p+w*g,t[2]=x*o+v*c+b*d+w*_,t[3]=x*a+v*h+b*m+w*y,t[4]=(x=i[4])*r+(v=i[5])*s+(b=i[6])*u+(w=i[7])*f,t[5]=x*n+v*l+b*p+w*g,t[6]=x*o+v*c+b*d+w*_,t[7]=x*a+v*h+b*m+w*y,t[8]=(x=i[8])*r+(v=i[9])*s+(b=i[10])*u+(w=i[11])*f,t[9]=x*n+v*l+b*p+w*g,t[10]=x*o+v*c+b*d+w*_,t[11]=x*a+v*h+b*m+w*y,t[12]=(x=i[12])*r+(v=i[13])*s+(b=i[14])*u+(w=i[15])*f,t[13]=x*n+v*l+b*p+w*g,t[14]=x*o+v*c+b*d+w*_,t[15]=x*a+v*h+b*m+w*y,t}Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)});var fa,ga=ma;function _a(t,e,i){var r=e[0],n=e[1],o=e[2],a=e[3];return t[0]=i[0]*r+i[4]*n+i[8]*o+i[12]*a,t[1]=i[1]*r+i[5]*n+i[9]*o+i[13]*a,t[2]=i[2]*r+i[6]*n+i[10]*o+i[14]*a,t[3]=i[3]*r+i[7]*n+i[11]*o+i[15]*a,t}function ya(t,e){const i=_a([],[t.x,t.y,0,1],e);return new n(i[0]/i[3],i[1]/i[3])}fa=new pa(4),pa!=Float32Array&&(fa[0]=0,fa[1]=0,fa[2]=0,fa[3]=0);class xa extends Ho{}let va;Sr("HeatmapBucket",xa,{omit:["layers"]});var ba={get paint(){return va=va||new pn({"heatmap-radius":new ln(j.paint_heatmap["heatmap-radius"]),"heatmap-weight":new ln(j.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new sn(j.paint_heatmap["heatmap-intensity"]),"heatmap-color":new un(j.paint_heatmap["heatmap-color"]),"heatmap-opacity":new sn(j.paint_heatmap["heatmap-opacity"])})}};function wa(t,{width:e,height:i},r,n){if(n){if(n instanceof Uint8ClampedArray)n=new Uint8Array(n.buffer);else if(n.length!==e*i*r)throw new RangeError(`mismatched image size. expected: ${n.length} but got: ${e*i*r}`)}else n=new Uint8Array(e*i*r);return t.width=e,t.height=i,t.data=n,t}function Ea(t,{width:e,height:i},r){if(e===t.width&&i===t.height)return;const n=wa({},{width:e,height:i},r);Ta(t,n,{x:0,y:0},{x:0,y:0},{width:Math.min(t.width,e),height:Math.min(t.height,i)},r),t.width=e,t.height=i,t.data=n.data}function Ta(t,e,i,r,n,o){if(0===n.width||0===n.height)return e;if(n.width>t.width||n.height>t.height||i.x>t.width-n.width||i.y>t.height-n.height)throw new RangeError("out of range source coordinates for image copy");if(n.width>e.width||n.height>e.height||r.x>e.width-n.width||r.y>e.height-n.height)throw new RangeError("out of range destination coordinates for image copy");const a=t.data,s=e.data;if(a===s)throw new Error("srcData equals dstData, so image is already copied");for(let l=0;l<n.height;l++){const c=((i.y+l)*t.width+i.x)*o,h=((r.y+l)*e.width+r.x)*o;for(let t=0;t<n.width*o;t++)s[h+t]=a[c+t]}return e}class Sa{constructor(t,e){wa(this,t,1,e)}resize(t){Ea(this,t,1)}clone(){return new Sa({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,e,i,r,n){Ta(t,e,i,r,n,1)}}class Ca{constructor(t,e){wa(this,t,4,e)}resize(t){Ea(this,t,4)}replace(t,e){e?this.data.set(t):this.data=t instanceof Uint8ClampedArray?new Uint8Array(t.buffer):t}clone(){return new Ca({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,e,i,r,n){Ta(t,e,i,r,n,4)}}function Ia(t){const e={},i=t.resolution||256,r=t.clips?t.clips.length:1,n=t.image||new Ca({width:i,height:r});if(Math.log(i)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${i}`);const o=(i,r,o)=>{e[t.evaluationKey]=o;const a=t.expression.evaluate(e);n.data[i+r+0]=Math.floor(255*a.r/a.a),n.data[i+r+1]=Math.floor(255*a.g/a.a),n.data[i+r+2]=Math.floor(255*a.b/a.a),n.data[i+r+3]=Math.floor(255*a.a)};if(t.clips)for(let e=0,n=0;e<r;++e,n+=4*i)for(let r=0,a=0;r<i;r++,a+=4){const s=r/(i-1),{start:l,end:c}=t.clips[e];o(n,a,l*(1-s)+c*s)}else for(let t=0,e=0;t<i;t++,e+=4)o(0,e,t/(i-1));return n}let Aa;Sr("AlphaImage",Sa),Sr("RGBAImage",Ca);var Ma={get paint(){return Aa=Aa||new pn({"hillshade-illumination-direction":new sn(j.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new sn(j.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new sn(j.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new sn(j.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new sn(j.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new sn(j.paint_hillshade["hillshade-accent-color"])})}};const ka=yn([{name:"a_pos",components:2,type:"Int16"}],4),{members:za}=ka;var Pa={exports:{}};function La(t,e,i){i=i||2;var r,n,o,a,s,l,c,h=e&&e.length,u=h?e[0]*i:t.length,p=Da(t,0,u,i,!0),d=[];if(!p||p.next===p.prev)return d;if(h&&(p=function(t,e,i,r){var n,o,a,s=[];for(n=0,o=e.length;n<o;n++)(a=Da(t,e[n]*r,n<o-1?e[n+1]*r:t.length,r,!1))===a.next&&(a.steiner=!0),s.push(Za(a));for(s.sort(Na),n=0;n<s.length;n++)i=$a(s[n],i);return i}(t,e,p,i)),t.length>80*i){r=o=t[0],n=a=t[1];for(var m=i;m<u;m+=i)(s=t[m])<r&&(r=s),(l=t[m+1])<n&&(n=l),s>o&&(o=s),l>a&&(a=l);c=0!==(c=Math.max(o-r,a-n))?32767/c:0}return Ba(p,d,i,r,n,c,0),d}function Da(t,e,i,r,n){var o,a;if(n===ns(t,e,i,r)>0)for(o=e;o<i;o+=r)a=es(o,t[o],t[o+1],a);else for(o=i-r;o>=e;o-=r)a=es(o,t[o],t[o+1],a);return a&&Wa(a,a.next)&&(is(a),a=a.next),a}function Ra(t,e){if(!t)return t;e||(e=t);var i,r=t;do{if(i=!1,r.steiner||!Wa(r,r.next)&&0!==Xa(r.prev,r,r.next))r=r.next;else{if(is(r),(r=e=r.prev)===r.next)break;i=!0}}while(i||r!==e);return e}function Ba(t,e,i,r,n,o,a){if(t){!a&&o&&function(t,e,i,r){var n=t;do{0===n.z&&(n.z=qa(n.x,n.y,e,i,r)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next}while(n!==t);n.prevZ.nextZ=null,n.prevZ=null,function(t){var e,i,r,n,o,a,s,l,c=1;do{for(i=t,t=null,o=null,a=0;i;){for(a++,r=i,s=0,e=0;e<c&&(s++,r=r.nextZ);e++);for(l=c;s>0||l>0&&r;)0!==s&&(0===l||!r||i.z<=r.z)?(n=i,i=i.nextZ,s--):(n=r,r=r.nextZ,l--),o?o.nextZ=n:t=n,n.prevZ=o,o=n;i=r}o.nextZ=null,c*=2}while(a>1)}(n)}(t,r,n,o);for(var s,l,c=t;t.prev!==t.next;)if(s=t.prev,l=t.next,o?Oa(t,r,n,o):Fa(t))e.push(s.i/i|0),e.push(t.i/i|0),e.push(l.i/i|0),is(t),t=l.next,c=l.next;else if((t=l)===c){a?1===a?Ba(t=Ua(Ra(t),e,i),e,i,r,n,o,2):2===a&&Va(t,e,i,r,n,o):Ba(Ra(t),e,i,r,n,o,1);break}}}function Fa(t){var e=t.prev,i=t,r=t.next;if(Xa(e,i,r)>=0)return!1;for(var n=e.x,o=i.x,a=r.x,s=e.y,l=i.y,c=r.y,h=n<o?n<a?n:a:o<a?o:a,u=s<l?s<c?s:c:l<c?l:c,p=n>o?n>a?n:a:o>a?o:a,d=s>l?s>c?s:c:l>c?l:c,m=r.next;m!==e;){if(m.x>=h&&m.x<=p&&m.y>=u&&m.y<=d&&Ga(n,s,o,l,a,c,m.x,m.y)&&Xa(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function Oa(t,e,i,r){var n=t.prev,o=t,a=t.next;if(Xa(n,o,a)>=0)return!1;for(var s=n.x,l=o.x,c=a.x,h=n.y,u=o.y,p=a.y,d=s<l?s<c?s:c:l<c?l:c,m=h<u?h<p?h:p:u<p?u:p,f=s>l?s>c?s:c:l>c?l:c,g=h>u?h>p?h:p:u>p?u:p,_=qa(d,m,e,i,r),y=qa(f,g,e,i,r),x=t.prevZ,v=t.nextZ;x&&x.z>=_&&v&&v.z<=y;){if(x.x>=d&&x.x<=f&&x.y>=m&&x.y<=g&&x!==n&&x!==a&&Ga(s,h,l,u,c,p,x.x,x.y)&&Xa(x.prev,x,x.next)>=0)return!1;if(x=x.prevZ,v.x>=d&&v.x<=f&&v.y>=m&&v.y<=g&&v!==n&&v!==a&&Ga(s,h,l,u,c,p,v.x,v.y)&&Xa(v.prev,v,v.next)>=0)return!1;v=v.nextZ}for(;x&&x.z>=_;){if(x.x>=d&&x.x<=f&&x.y>=m&&x.y<=g&&x!==n&&x!==a&&Ga(s,h,l,u,c,p,x.x,x.y)&&Xa(x.prev,x,x.next)>=0)return!1;x=x.prevZ}for(;v&&v.z<=y;){if(v.x>=d&&v.x<=f&&v.y>=m&&v.y<=g&&v!==n&&v!==a&&Ga(s,h,l,u,c,p,v.x,v.y)&&Xa(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}function Ua(t,e,i){var r=t;do{var n=r.prev,o=r.next.next;!Wa(n,o)&&Ka(n,r,r.next,o)&&Qa(n,o)&&Qa(o,n)&&(e.push(n.i/i|0),e.push(r.i/i|0),e.push(o.i/i|0),is(r),is(r.next),r=t=o),r=r.next}while(r!==t);return Ra(r)}function Va(t,e,i,r,n,o){var a=t;do{for(var s=a.next.next;s!==a.prev;){if(a.i!==s.i&&Ha(a,s)){var l=ts(a,s);return a=Ra(a,a.next),l=Ra(l,l.next),Ba(a,e,i,r,n,o,0),void Ba(l,e,i,r,n,o,0)}s=s.next}a=a.next}while(a!==t)}function Na(t,e){return t.x-e.x}function $a(t,e){var i=function(t,e){var i,r=e,n=t.x,o=t.y,a=-1/0;do{if(o<=r.y&&o>=r.next.y&&r.next.y!==r.y){var s=r.x+(o-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(s<=n&&s>a&&(a=s,i=r.x<r.next.x?r:r.next,s===n))return i}r=r.next}while(r!==e);if(!i)return null;var l,c=i,h=i.x,u=i.y,p=1/0;r=i;do{n>=r.x&&r.x>=h&&n!==r.x&&Ga(o<u?n:a,o,h,u,o<u?a:n,o,r.x,r.y)&&(l=Math.abs(o-r.y)/(n-r.x),Qa(r,t)&&(l<p||l===p&&(r.x>i.x||r.x===i.x&&ja(i,r)))&&(i=r,p=l)),r=r.next}while(r!==c);return i}(t,e);if(!i)return e;var r=ts(i,t);return Ra(r,r.next),Ra(i,i.next)}function ja(t,e){return Xa(t.prev,t,e.prev)<0&&Xa(e.next,t,t.next)<0}function qa(t,e,i,r,n){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-i)*n|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-r)*n|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Za(t){var e=t,i=t;do{(e.x<i.x||e.x===i.x&&e.y<i.y)&&(i=e),e=e.next}while(e!==t);return i}function Ga(t,e,i,r,n,o,a,s){return(n-a)*(e-s)>=(t-a)*(o-s)&&(t-a)*(r-s)>=(i-a)*(e-s)&&(i-a)*(o-s)>=(n-a)*(r-s)}function Ha(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&Ka(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&(Qa(t,e)&&Qa(e,t)&&function(t,e){var i=t,r=!1,n=(t.x+e.x)/2,o=(t.y+e.y)/2;do{i.y>o!=i.next.y>o&&i.next.y!==i.y&&n<(i.next.x-i.x)*(o-i.y)/(i.next.y-i.y)+i.x&&(r=!r),i=i.next}while(i!==t);return r}(t,e)&&(Xa(t.prev,t,e.prev)||Xa(t,e.prev,e))||Wa(t,e)&&Xa(t.prev,t,t.next)>0&&Xa(e.prev,e,e.next)>0)}function Xa(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function Wa(t,e){return t.x===e.x&&t.y===e.y}function Ka(t,e,i,r){var n=Ja(Xa(t,e,i)),o=Ja(Xa(t,e,r)),a=Ja(Xa(i,r,t)),s=Ja(Xa(i,r,e));return n!==o&&a!==s||!(0!==n||!Ya(t,i,e))||!(0!==o||!Ya(t,r,e))||!(0!==a||!Ya(i,t,r))||!(0!==s||!Ya(i,e,r))}function Ya(t,e,i){return e.x<=Math.max(t.x,i.x)&&e.x>=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function Ja(t){return t>0?1:t<0?-1:0}function Qa(t,e){return Xa(t.prev,t,t.next)<0?Xa(t,e,t.next)>=0&&Xa(t,t.prev,e)>=0:Xa(t,e,t.prev)<0||Xa(t,t.next,e)<0}function ts(t,e){var i=new rs(t.i,t.x,t.y),r=new rs(e.i,e.x,e.y),n=t.next,o=e.prev;return t.next=e,e.prev=t,i.next=n,n.prev=i,r.next=i,i.prev=r,o.next=r,r.prev=o,r}function es(t,e,i,r){var n=new rs(t,e,i);return r?(n.next=r.next,n.prev=r,r.next.prev=n,r.next=n):(n.prev=n,n.next=n),n}function is(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function rs(t,e,i){this.i=t,this.x=e,this.y=i,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function ns(t,e,i,r){for(var n=0,o=e,a=i-r;o<i;o+=r)n+=(t[a]-t[o])*(t[o+1]+t[a+1]),a=o;return n}Pa.exports=La,Pa.exports.default=La,La.deviation=function(t,e,i,r){var n=e&&e.length,o=Math.abs(ns(t,0,n?e[0]*i:t.length,i));if(n)for(var a=0,s=e.length;a<s;a++)o-=Math.abs(ns(t,e[a]*i,a<s-1?e[a+1]*i:t.length,i));var l=0;for(a=0;a<r.length;a+=3){var c=r[a]*i,h=r[a+1]*i,u=r[a+2]*i;l+=Math.abs((t[c]-t[u])*(t[h+1]-t[c+1])-(t[c]-t[h])*(t[u+1]-t[c+1]))}return 0===o&&0===l?0:Math.abs((l-o)/o)},La.flatten=function(t){for(var e=t[0][0].length,i={vertices:[],holes:[],dimensions:e},r=0,n=0;n<t.length;n++){for(var o=0;o<t[n].length;o++)for(var a=0;a<e;a++)i.vertices.push(t[n][o][a]);n>0&&i.holes.push(r+=t[n-1].length)}return i};var os=e(Pa.exports);function as(t,e,i,r,n){ss(t,e,i||0,r||t.length-1,n||cs)}function ss(t,e,i,r,n){for(;r>i;){if(r-i>600){var o=r-i+1,a=e-i+1,s=Math.log(o),l=.5*Math.exp(2*s/3),c=.5*Math.sqrt(s*l*(o-l)/o)*(a-o/2<0?-1:1);ss(t,e,Math.max(i,Math.floor(e-a*l/o+c)),Math.min(r,Math.floor(e+(o-a)*l/o+c)),n)}var h=t[e],u=i,p=r;for(ls(t,i,e),n(t[r],h)>0&&ls(t,i,r);u<p;){for(ls(t,u,p),u++,p--;n(t[u],h)<0;)u++;for(;n(t[p],h)>0;)p--}0===n(t[i],h)?ls(t,i,p):ls(t,++p,r),p<=e&&(i=p+1),e<=p&&(r=p-1)}}function ls(t,e,i){var r=t[e];t[e]=t[i],t[i]=r}function cs(t,e){return t<e?-1:t>e?1:0}function hs(t,e){const i=t.length;if(i<=1)return[t];const r=[];let n,o;for(let e=0;e<i;e++){const i=b(t[e]);0!==i&&(t[e].area=Math.abs(i),void 0===o&&(o=i<0),o===i<0?(n&&r.push(n),n=[t[e]]):n.push(t[e]))}if(n&&r.push(n),e>1)for(let t=0;t<r.length;t++)r[t].length<=e||(as(r[t],e,1,r[t].length-1,us),r[t]=r[t].slice(0,e));return r}function us(t,e){return e.area-t.area}function ps(t,e,i){const r=i.patternDependencies;let n=!1;for(const i of e){const e=i.paint.get(`${t}-pattern`);e.isConstant()||(n=!0);const o=e.constantOr(null);o&&(n=!0,r[o.to]=!0,r[o.from]=!0)}return n}function ds(t,e,i,r,n){const o=n.patternDependencies;for(const a of e){const e=a.paint.get(`${t}-pattern`).value;if("constant"!==e.kind){let t=e.evaluate({zoom:r-1},i,{},n.availableImages),s=e.evaluate({zoom:r},i,{},n.availableImages),l=e.evaluate({zoom:r+1},i,{},n.availableImages);t=t&&t.name?t.name:t,s=s&&s.name?s.name:s,l=l&&l.name?l.name:l,o[t]=!0,o[s]=!0,o[l]=!0,i.patterns[a.id]={min:t,mid:s,max:l}}}return i}class ms{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new to,this.indexArray=new ho,this.indexArray2=new uo,this.programConfigurations=new Oo(t.layers,t.zoom),this.segments=new fo,this.segments2=new fo,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id))}populate(t,e,i){this.hasPattern=ps("fill",this.layers,e);const r=this.layers[0].layout.get("fill-sort-key"),n=!r.isConstant(),o=[];for(const{feature:a,id:s,index:l,sourceLayerIndex:c}of t){const t=this.layers[0]._featureFilter.needGeometry,h=Zo(a,t);if(!this.layers[0]._featureFilter.filter(new Yr(this.zoom),h,i))continue;const u=n?r.evaluate(h,{},i,e.availableImages):void 0,p={id:s,properties:a.properties,type:a.type,sourceLayerIndex:c,index:l,geometry:t?h.geometry:qo(a),patterns:{},sortKey:u};o.push(p)}n&&o.sort(((t,e)=>t.sortKey-e.sortKey));for(const r of o){const{geometry:n,index:o,sourceLayerIndex:a}=r;if(this.hasPattern){const t=ds("fill",this.layers,r,this.zoom,e);this.patternFeatures.push(t)}else this.addFeature(r,n,o,i,{});e.featureIndex.insert(t[o].feature,n,o,a,this.index)}}update(t,e,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,i)}addFeatures(t,e,i){for(const t of this.patternFeatures)this.addFeature(t,t.geometry,t.index,e,i)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,za),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,e,i,r,n){for(const t of hs(e,500)){let e=0;for(const i of t)e+=i.length;const i=this.segments.prepareSegment(e,this.layoutVertexArray,this.indexArray),r=i.vertexLength,n=[],o=[];for(const e of t){if(0===e.length)continue;e!==t[0]&&o.push(n.length/2);const i=this.segments2.prepareSegment(e.length,this.layoutVertexArray,this.indexArray2),r=i.vertexLength;this.layoutVertexArray.emplaceBack(e[0].x,e[0].y),this.indexArray2.emplaceBack(r+e.length-1,r),n.push(e[0].x),n.push(e[0].y);for(let t=1;t<e.length;t++)this.layoutVertexArray.emplaceBack(e[t].x,e[t].y),this.indexArray2.emplaceBack(r+t-1,r+t),n.push(e[t].x),n.push(e[t].y);i.vertexLength+=e.length,i.primitiveLength+=e.length}const a=os(n,o);for(let t=0;t<a.length;t+=3)this.indexArray.emplaceBack(r+a[t],r+a[t+1],r+a[t+2]);i.vertexLength+=e,i.primitiveLength+=a.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,i,n,r)}}let fs,gs;Sr("FillBucket",ms,{omit:["layers","patternFeatures"]});var _s={get paint(){return gs=gs||new pn({"fill-antialias":new sn(j.paint_fill["fill-antialias"]),"fill-opacity":new ln(j.paint_fill["fill-opacity"]),"fill-color":new ln(j.paint_fill["fill-color"]),"fill-outline-color":new ln(j.paint_fill["fill-outline-color"]),"fill-translate":new sn(j.paint_fill["fill-translate"]),"fill-translate-anchor":new sn(j.paint_fill["fill-translate-anchor"]),"fill-pattern":new cn(j.paint_fill["fill-pattern"])})},get layout(){return fs=fs||new pn({"fill-sort-key":new ln(j.layout_fill["fill-sort-key"])})}};const ys=yn([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),xs=yn([{name:"a_centroid",components:2,type:"Int16"}],4),{members:vs}=ys;var bs={},ws=i,Es=Ts;function Ts(t,e,i,r,n){this.properties={},this.extent=i,this.type=0,this._pbf=t,this._geometry=-1,this._keys=r,this._values=n,t.readFields(Ss,this,e)}function Ss(t,e,i){1==t?e.id=i.readVarint():2==t?function(t,e){for(var i=t.readVarint()+t.pos;t.pos<i;){var r=e._keys[t.readVarint()],n=e._values[t.readVarint()];e.properties[r]=n}}(i,e):3==t?e.type=i.readVarint():4==t&&(e._geometry=i.pos)}function Cs(t){for(var e,i,r=0,n=0,o=t.length,a=o-1;n<o;a=n++)r+=((i=t[a]).x-(e=t[n]).x)*(e.y+i.y);return r}Ts.types=["Unknown","Point","LineString","Polygon"],Ts.prototype.loadGeometry=function(){var t=this._pbf;t.pos=this._geometry;for(var e,i=t.readVarint()+t.pos,r=1,n=0,o=0,a=0,s=[];t.pos<i;){if(n<=0){var l=t.readVarint();r=7&l,n=l>>3}if(n--,1===r||2===r)o+=t.readSVarint(),a+=t.readSVarint(),1===r&&(e&&s.push(e),e=[]),e.push(new ws(o,a));else{if(7!==r)throw new Error("unknown command "+r);e&&e.push(e[0].clone())}}return e&&s.push(e),s},Ts.prototype.bbox=function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,i=1,r=0,n=0,o=0,a=1/0,s=-1/0,l=1/0,c=-1/0;t.pos<e;){if(r<=0){var h=t.readVarint();i=7&h,r=h>>3}if(r--,1===i||2===i)(n+=t.readSVarint())<a&&(a=n),n>s&&(s=n),(o+=t.readSVarint())<l&&(l=o),o>c&&(c=o);else if(7!==i)throw new Error("unknown command "+i)}return[a,l,s,c]},Ts.prototype.toGeoJSON=function(t,e,i){var r,n,o=this.extent*Math.pow(2,i),a=this.extent*t,s=this.extent*e,l=this.loadGeometry(),c=Ts.types[this.type];function h(t){for(var e=0;e<t.length;e++){var i=t[e];t[e]=[360*(i.x+a)/o-180,360/Math.PI*Math.atan(Math.exp((180-360*(i.y+s)/o)*Math.PI/180))-90]}}switch(this.type){case 1:var u=[];for(r=0;r<l.length;r++)u[r]=l[r][0];h(l=u);break;case 2:for(r=0;r<l.length;r++)h(l[r]);break;case 3:for(l=function(t){var e=t.length;if(e<=1)return[t];for(var i,r,n=[],o=0;o<e;o++){var a=Cs(t[o]);0!==a&&(void 0===r&&(r=a<0),r===a<0?(i&&n.push(i),i=[t[o]]):i.push(t[o]))}return i&&n.push(i),n}(l),r=0;r<l.length;r++)for(n=0;n<l[r].length;n++)h(l[r][n])}1===l.length?l=l[0]:c="Multi"+c;var p={type:"Feature",geometry:{type:c,coordinates:l},properties:this.properties};return"id"in this&&(p.id=this.id),p};var Is=Es,As=Ms;function Ms(t,e){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(ks,this,e),this.length=this._features.length}function ks(t,e,i){15===t?e.version=i.readVarint():1===t?e.name=i.readString():5===t?e.extent=i.readVarint():2===t?e._features.push(i.pos):3===t?e._keys.push(i.readString()):4===t&&e._values.push(function(t){for(var e=null,i=t.readVarint()+t.pos;t.pos<i;){var r=t.readVarint()>>3;e=1===r?t.readString():2===r?t.readFloat():3===r?t.readDouble():4===r?t.readVarint64():5===r?t.readVarint():6===r?t.readSVarint():7===r?t.readBoolean():null}return e}(i))}Ms.prototype.feature=function(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];var e=this._pbf.readVarint()+this._pbf.pos;return new Is(this._pbf,e,this.extent,this._keys,this._values)};var zs=As;function Ps(t,e,i){if(3===t){var r=new zs(i,i.readVarint()+i.pos);r.length&&(e[r.name]=r)}}bs.VectorTile=function(t,e){this.layers=t.readFields(Ps,{},e)},bs.VectorTileFeature=Es,bs.VectorTileLayer=As;const Ls=bs.VectorTileFeature.types,Ds=Math.pow(2,13);function Rs(t,e,i,r,n,o,a,s){t.emplaceBack(e,i,2*Math.floor(r*Ds)+a,n*Ds*2,o*Ds*2,Math.round(s))}class Bs{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new eo,this.centroidVertexArray=new Jn,this.indexArray=new ho,this.programConfigurations=new Oo(t.layers,t.zoom),this.segments=new fo,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id))}populate(t,e,i){this.features=[],this.hasPattern=ps("fill-extrusion",this.layers,e);for(const{feature:r,id:n,index:o,sourceLayerIndex:a}of t){const t=this.layers[0]._featureFilter.needGeometry,s=Zo(r,t);if(!this.layers[0]._featureFilter.filter(new Yr(this.zoom),s,i))continue;const l={id:n,sourceLayerIndex:a,index:o,geometry:t?s.geometry:qo(r),properties:r.properties,type:r.type,patterns:{}};this.hasPattern?this.features.push(ds("fill-extrusion",this.layers,l,this.zoom,e)):this.addFeature(l,l.geometry,o,i,{}),e.featureIndex.insert(r,l.geometry,o,a,this.index,!0)}}addFeatures(t,e,i){for(const t of this.features){const{geometry:r}=t;this.addFeature(t,r,t.index,e,i)}}update(t,e,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,i)}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.centroidVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,vs),this.centroidVertexBuffer=t.createVertexBuffer(this.centroidVertexArray,xs.members,!0),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(),this.centroidVertexBuffer.destroy())}addFeature(t,e,i,r,n){const o={x:0,y:0,vertexCount:0};for(const i of hs(e,500)){let e=0;for(const t of i)e+=t.length;let r=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const t of i){if(0===t.length)continue;if(Os(t))continue;let e=0;for(let i=0;i<t.length;i++){const n=t[i];if(i>=1){const a=t[i-1];if(!Fs(n,a)){r.vertexLength+4>fo.MAX_VERTEX_ARRAY_LENGTH&&(r=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const t=n.sub(a)._perp()._unit(),i=a.dist(n);e+i>32768&&(e=0),Rs(this.layoutVertexArray,n.x,n.y,t.x,t.y,0,0,e),Rs(this.layoutVertexArray,n.x,n.y,t.x,t.y,0,1,e),o.x+=2*n.x,o.y+=2*n.y,o.vertexCount+=2,e+=i,Rs(this.layoutVertexArray,a.x,a.y,t.x,t.y,0,0,e),Rs(this.layoutVertexArray,a.x,a.y,t.x,t.y,0,1,e),o.x+=2*a.x,o.y+=2*a.y,o.vertexCount+=2;const s=r.vertexLength;this.indexArray.emplaceBack(s,s+2,s+1),this.indexArray.emplaceBack(s+1,s+2,s+3),r.vertexLength+=4,r.primitiveLength+=2}}}}if(r.vertexLength+e>fo.MAX_VERTEX_ARRAY_LENGTH&&(r=this.segments.prepareSegment(e,this.layoutVertexArray,this.indexArray)),"Polygon"!==Ls[t.type])continue;const n=[],a=[],s=r.vertexLength;for(const t of i)if(0!==t.length){t!==i[0]&&a.push(n.length/2);for(let e=0;e<t.length;e++){const i=t[e];Rs(this.layoutVertexArray,i.x,i.y,0,0,1,1,0),o.x+=i.x,o.y+=i.y,o.vertexCount+=1,n.push(i.x),n.push(i.y)}}const l=os(n,a);for(let t=0;t<l.length;t+=3)this.indexArray.emplaceBack(s+l[t],s+l[t+2],s+l[t+1]);r.primitiveLength+=l.length/3,r.vertexLength+=e}for(let t=0;t<o.vertexCount;t++)this.centroidVertexArray.emplaceBack(Math.floor(o.x/o.vertexCount),Math.floor(o.y/o.vertexCount));this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,i,n,r)}}function Fs(t,e){return t.x===e.x&&(t.x<0||t.x>No)||t.y===e.y&&(t.y<0||t.y>No)}function Os(t){return t.every((t=>t.x<0))||t.every((t=>t.x>No))||t.every((t=>t.y<0))||t.every((t=>t.y>No))}let Us;Sr("FillExtrusionBucket",Bs,{omit:["layers","features"]});var Vs={get paint(){return Us=Us||new pn({"fill-extrusion-opacity":new sn(j["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new ln(j["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new sn(j["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new sn(j["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new cn(j["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new ln(j["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new ln(j["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new sn(j["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};function Ns(t,e){return t.x*e.x+t.y*e.y}function $s(t,e){if(1===t.length){let i=0;const r=e[i++];let n;for(;!n||r.equals(n);)if(n=e[i++],!n)return 1/0;for(;i<e.length;i++){const o=e[i],a=t[0],s=n.sub(r),l=o.sub(r),c=a.sub(r),h=Ns(s,s),u=Ns(s,l),p=Ns(l,l),d=Ns(c,s),m=Ns(c,l),f=h*p-u*u,g=(p*d-u*m)/f,_=(h*m-u*d)/f,y=r.z*(1-g-_)+n.z*g+o.z*_;if(isFinite(y))return y}return 1/0}{let t=1/0;for(const i of e)t=Math.min(t,i.z);return t}}const js=yn([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:qs}=js,Zs=yn([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:Gs}=Zs,Hs=bs.VectorTileFeature.types,Xs=Math.cos(Math.PI/180*37.5),Ws=Math.pow(2,14)/.5;class Ks{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach((t=>{this.gradients[t.id]={}})),this.layoutVertexArray=new io,this.layoutVertexArray2=new ro,this.indexArray=new ho,this.programConfigurations=new Oo(t.layers,t.zoom),this.segments=new fo,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id))}populate(t,e,i){this.hasPattern=ps("line",this.layers,e);const r=this.layers[0].layout.get("line-sort-key"),n=!r.isConstant(),o=[];for(const{feature:e,id:a,index:s,sourceLayerIndex:l}of t){const t=this.layers[0]._featureFilter.needGeometry,c=Zo(e,t);if(!this.layers[0]._featureFilter.filter(new Yr(this.zoom),c,i))continue;const h=n?r.evaluate(c,{},i):void 0,u={id:a,properties:e.properties,type:e.type,sourceLayerIndex:l,index:s,geometry:t?c.geometry:qo(e),patterns:{},sortKey:h};o.push(u)}n&&o.sort(((t,e)=>t.sortKey-e.sortKey));for(const r of o){const{geometry:n,index:o,sourceLayerIndex:a}=r;if(this.hasPattern){const t=ds("line",this.layers,r,this.zoom,e);this.patternFeatures.push(t)}else this.addFeature(r,n,o,i,{});e.featureIndex.insert(t[o].feature,n,o,a,this.index)}}update(t,e,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,i)}addFeatures(t,e,i){for(const t of this.patternFeatures)this.addFeature(t,t.geometry,t.index,e,i)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(0!==this.layoutVertexArray2.length&&(this.layoutVertexBuffer2=t.createVertexBuffer(this.layoutVertexArray2,Gs)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,qs),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,e,i,r,n){const o=this.layers[0].layout,a=o.get("line-join").evaluate(t,{}),s=o.get("line-cap"),l=o.get("line-miter-limit"),c=o.get("line-round-limit");this.lineClips=this.lineFeatureClips(t);for(const i of e)this.addLine(i,t,a,s,l,c);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,i,n,r)}addLine(t,e,i,r,n,o){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let e=0;e<t.length-1;e++)this.totalDistance+=t[e].dist(t[e+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const a="Polygon"===Hs[e.type];let s=t.length;for(;s>=2&&t[s-1].equals(t[s-2]);)s--;let l=0;for(;l<s-1&&t[l].equals(t[l+1]);)l++;if(s<(a?3:2))return;"bevel"===i&&(n=1.05);const c=this.overscaling<=16?122880/(512*this.overscaling):0,h=this.segments.prepareSegment(10*s,this.layoutVertexArray,this.indexArray);let u,p,d,m,f;this.e1=this.e2=-1,a&&(u=t[s-2],f=t[l].sub(u)._unit()._perp());for(let e=l;e<s;e++){if(d=e===s-1?a?t[l+1]:void 0:t[e+1],d&&t[e].equals(d))continue;f&&(m=f),u&&(p=u),u=t[e],f=d?d.sub(u)._unit()._perp():m,m=m||f;let g=m.add(f);0===g.x&&0===g.y||g._unit();const _=m.x*f.x+m.y*f.y,y=g.x*f.x+g.y*f.y,x=0!==y?1/y:1/0,v=2*Math.sqrt(2-2*y),b=y<Xs&&p&&d,w=m.x*f.y-m.y*f.x>0;if(b&&e>l){const t=u.dist(p);if(t>2*c){const e=u.sub(u.sub(p)._mult(c/t)._round());this.updateDistance(p,e),this.addCurrentVertex(e,m,0,0,h),p=e}}const E=p&&d;let T=E?i:a?"butt":r;if(E&&"round"===T&&(x<o?T="miter":x<=2&&(T="fakeround")),"miter"===T&&x>n&&(T="bevel"),"bevel"===T&&(x>2&&(T="flipbevel"),x<n&&(T="miter")),p&&this.updateDistance(p,u),"miter"===T)g._mult(x),this.addCurrentVertex(u,g,0,0,h);else if("flipbevel"===T){if(x>100)g=f.mult(-1);else{const t=x*m.add(f).mag()/m.sub(f).mag();g._perp()._mult(t*(w?-1:1))}this.addCurrentVertex(u,g,0,0,h),this.addCurrentVertex(u,g.mult(-1),0,0,h)}else if("bevel"===T||"fakeround"===T){const t=-Math.sqrt(x*x-1),e=w?t:0,i=w?0:t;if(p&&this.addCurrentVertex(u,m,e,i,h),"fakeround"===T){const t=Math.round(180*v/Math.PI/20);for(let e=1;e<t;e++){let i=e/t;if(.5!==i){const t=i-.5;i+=i*t*(i-1)*((1.0904+_*(_*(3.55645-1.43519*_)-3.2452))*t*t+(.848013+_*(.215638*_-1.06021)))}const r=f.sub(m)._mult(i)._add(m)._unit()._mult(w?-1:1);this.addHalfVertex(u,r.x,r.y,!1,w,0,h)}}d&&this.addCurrentVertex(u,f,-e,-i,h)}else if("butt"===T)this.addCurrentVertex(u,g,0,0,h);else if("square"===T){const t=p?1:-1;this.addCurrentVertex(u,g,t,t,h)}else"round"===T&&(p&&(this.addCurrentVertex(u,m,0,0,h),this.addCurrentVertex(u,m,1,1,h,!0)),d&&(this.addCurrentVertex(u,f,-1,-1,h,!0),this.addCurrentVertex(u,f,0,0,h)));if(b&&e<s-1){const t=u.dist(d);if(t>2*c){const e=u.add(d.sub(u)._mult(c/t)._round());this.updateDistance(u,e),this.addCurrentVertex(e,f,0,0,h),u=e}}}}addCurrentVertex(t,e,i,r,n,o=!1){const a=e.y*r-e.x,s=-e.y-e.x*r;this.addHalfVertex(t,e.x+e.y*i,e.y-e.x*i,o,!1,i,n),this.addHalfVertex(t,a,s,o,!0,-r,n),this.distance>Ws/2&&0===this.totalDistance&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(t,e,i,r,n,o))}addHalfVertex({x:t,y:e},i,r,n,o,a,s){const l=.5*(this.lineClips?this.scaledDistance*(Ws-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((t<<1)+(n?1:0),(e<<1)+(o?1:0),Math.round(63*i)+128,Math.round(63*r)+128,1+(0===a?0:a<0?-1:1)|(63&l)<<2,l>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const c=s.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,c),s.primitiveLength++),o?this.e2=c:this.e1=c}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(t,e){this.distance+=t.dist(e),this.updateScaledDistance()}}let Ys,Js;Sr("LineBucket",Ks,{omit:["layers","patternFeatures"]});var Qs={get paint(){return Js=Js||new pn({"line-opacity":new ln(j.paint_line["line-opacity"]),"line-color":new ln(j.paint_line["line-color"]),"line-translate":new sn(j.paint_line["line-translate"]),"line-translate-anchor":new sn(j.paint_line["line-translate-anchor"]),"line-width":new ln(j.paint_line["line-width"]),"line-gap-width":new ln(j.paint_line["line-gap-width"]),"line-offset":new ln(j.paint_line["line-offset"]),"line-blur":new ln(j.paint_line["line-blur"]),"line-dasharray":new hn(j.paint_line["line-dasharray"]),"line-pattern":new cn(j.paint_line["line-pattern"]),"line-gradient":new un(j.paint_line["line-gradient"])})},get layout(){return Ys=Ys||new pn({"line-cap":new sn(j.layout_line["line-cap"]),"line-join":new ln(j.layout_line["line-join"]),"line-miter-limit":new sn(j.layout_line["line-miter-limit"]),"line-round-limit":new sn(j.layout_line["line-round-limit"]),"line-sort-key":new ln(j.layout_line["line-sort-key"])})}};class tl extends ln{possiblyEvaluate(t,e){return e=new Yr(Math.floor(e.zoom),{now:e.now,fadeDuration:e.fadeDuration,zoomHistory:e.zoomHistory,transition:e.transition}),super.possiblyEvaluate(t,e)}evaluate(t,e,i,r){return e=p({},e,{zoom:Math.floor(e.zoom)}),super.evaluate(t,e,i,r)}}let el;function il(t,e){return e>0?e+2*t:t}const rl=yn([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),nl=yn([{name:"a_projected_pos",components:3,type:"Float32"}],4);yn([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const ol=yn([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]);yn([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);const al=yn([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),sl=yn([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function ll(t,e,i){return t.sections.forEach((t=>{t.text=function(t,e,i){const r=e.layout.get("text-transform").evaluate(i,{});return"uppercase"===r?t=t.toLocaleUpperCase():"lowercase"===r&&(t=t.toLocaleLowerCase()),Kr.applyArabicShaping&&(t=Kr.applyArabicShaping(t)),t}(t.text,e,i)})),t}yn([{name:"triangle",components:3,type:"Uint16"}]),yn([{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"}]),yn([{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"}]),yn([{type:"Float32",name:"offsetX"}]),yn([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]);const cl={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var hl=24,ul=ml,pl=function(t,e,i,r,n){var o,a,s=8*n-r-1,l=(1<<s)-1,c=l>>1,h=-7,u=i?n-1:0,p=i?-1:1,d=t[e+u];for(u+=p,o=d&(1<<-h)-1,d>>=-h,h+=s;h>0;o=256*o+t[e+u],u+=p,h-=8);for(a=o&(1<<-h)-1,o>>=-h,h+=r;h>0;a=256*a+t[e+u],u+=p,h-=8);if(0===o)o=1-c;else{if(o===l)return a?NaN:1/0*(d?-1:1);a+=Math.pow(2,r),o-=c}return(d?-1:1)*a*Math.pow(2,o-r)},dl=function(t,e,i,r,n,o){var a,s,l,c=8*o-n-1,h=(1<<c)-1,u=h>>1,p=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:o-1,m=r?1:-1,f=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=h):(a=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-a))<1&&(a--,l*=2),(e+=a+u>=1?p/l:p*Math.pow(2,1-u))*l>=2&&(a++,l/=2),a+u>=h?(s=0,a=h):a+u>=1?(s=(e*l-1)*Math.pow(2,n),a+=u):(s=e*Math.pow(2,u-1)*Math.pow(2,n),a=0));n>=8;t[i+d]=255&s,d+=m,s/=256,n-=8);for(a=a<<n|s,c+=n;c>0;t[i+d]=255&a,d+=m,a/=256,c-=8);t[i+d-m]|=128*f};function ml(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}ml.Varint=0,ml.Fixed64=1,ml.Bytes=2,ml.Fixed32=5;var fl=4294967296,gl=1/fl,_l="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function yl(t){return t.type===ml.Bytes?t.readVarint()+t.pos:t.pos+1}function xl(t,e,i){return i?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function vl(t,e,i){var r=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));i.realloc(r);for(var n=i.pos-1;n>=t;n--)i.buf[n+r]=i.buf[n]}function bl(t,e){for(var i=0;i<t.length;i++)e.writeVarint(t[i])}function wl(t,e){for(var i=0;i<t.length;i++)e.writeSVarint(t[i])}function El(t,e){for(var i=0;i<t.length;i++)e.writeFloat(t[i])}function Tl(t,e){for(var i=0;i<t.length;i++)e.writeDouble(t[i])}function Sl(t,e){for(var i=0;i<t.length;i++)e.writeBoolean(t[i])}function Cl(t,e){for(var i=0;i<t.length;i++)e.writeFixed32(t[i])}function Il(t,e){for(var i=0;i<t.length;i++)e.writeSFixed32(t[i])}function Al(t,e){for(var i=0;i<t.length;i++)e.writeFixed64(t[i])}function Ml(t,e){for(var i=0;i<t.length;i++)e.writeSFixed64(t[i])}function kl(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+16777216*t[e+3]}function zl(t,e,i){t[i]=e,t[i+1]=e>>>8,t[i+2]=e>>>16,t[i+3]=e>>>24}function Pl(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}ml.prototype={destroy:function(){this.buf=null},readFields:function(t,e,i){for(i=i||this.length;this.pos<i;){var r=this.readVarint(),n=r>>3,o=this.pos;this.type=7&r,t(n,e,this),this.pos===o&&this.skip(r)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=kl(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=Pl(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=kl(this.buf,this.pos)+kl(this.buf,this.pos+4)*fl;return this.pos+=8,t},readSFixed64:function(){var t=kl(this.buf,this.pos)+Pl(this.buf,this.pos+4)*fl;return this.pos+=8,t},readFloat:function(){var t=pl(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=pl(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e,i,r=this.buf;return e=127&(i=r[this.pos++]),i<128?e:(e|=(127&(i=r[this.pos++]))<<7,i<128?e:(e|=(127&(i=r[this.pos++]))<<14,i<128?e:(e|=(127&(i=r[this.pos++]))<<21,i<128?e:function(t,e,i){var r,n,o=i.buf;if(r=(112&(n=o[i.pos++]))>>4,n<128)return xl(t,r,e);if(r|=(127&(n=o[i.pos++]))<<3,n<128)return xl(t,r,e);if(r|=(127&(n=o[i.pos++]))<<10,n<128)return xl(t,r,e);if(r|=(127&(n=o[i.pos++]))<<17,n<128)return xl(t,r,e);if(r|=(127&(n=o[i.pos++]))<<24,n<128)return xl(t,r,e);if(r|=(1&(n=o[i.pos++]))<<31,n<128)return xl(t,r,e);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(i=r[this.pos]))<<28,t,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2==1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&_l?function(t,e,i){return _l.decode(t.subarray(e,i))}(this.buf,e,t):function(t,e,i){for(var r="",n=e;n<i;){var o,a,s,l=t[n],c=null,h=l>239?4:l>223?3:l>191?2:1;if(n+h>i)break;1===h?l<128&&(c=l):2===h?128==(192&(o=t[n+1]))&&(c=(31&l)<<6|63&o)<=127&&(c=null):3===h?(a=t[n+2],128==(192&(o=t[n+1]))&&128==(192&a)&&((c=(15&l)<<12|(63&o)<<6|63&a)<=2047||c>=55296&&c<=57343)&&(c=null)):4===h&&(a=t[n+2],s=t[n+3],128==(192&(o=t[n+1]))&&128==(192&a)&&128==(192&s)&&((c=(15&l)<<18|(63&o)<<12|(63&a)<<6|63&s)<=65535||c>=1114112)&&(c=null)),null===c?(c=65533,h=1):c>65535&&(c-=65536,r+=String.fromCharCode(c>>>10&1023|55296),c=56320|1023&c),r+=String.fromCharCode(c),n+=h}return r}(this.buf,e,t)},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,e){if(this.type!==ml.Bytes)return t.push(this.readVarint(e));var i=yl(this);for(t=t||[];this.pos<i;)t.push(this.readVarint(e));return t},readPackedSVarint:function(t){if(this.type!==ml.Bytes)return t.push(this.readSVarint());var e=yl(this);for(t=t||[];this.pos<e;)t.push(this.readSVarint());return t},readPackedBoolean:function(t){if(this.type!==ml.Bytes)return t.push(this.readBoolean());var e=yl(this);for(t=t||[];this.pos<e;)t.push(this.readBoolean());return t},readPackedFloat:function(t){if(this.type!==ml.Bytes)return t.push(this.readFloat());var e=yl(this);for(t=t||[];this.pos<e;)t.push(this.readFloat());return t},readPackedDouble:function(t){if(this.type!==ml.Bytes)return t.push(this.readDouble());var e=yl(this);for(t=t||[];this.pos<e;)t.push(this.readDouble());return t},readPackedFixed32:function(t){if(this.type!==ml.Bytes)return t.push(this.readFixed32());var e=yl(this);for(t=t||[];this.pos<e;)t.push(this.readFixed32());return t},readPackedSFixed32:function(t){if(this.type!==ml.Bytes)return t.push(this.readSFixed32());var e=yl(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed32());return t},readPackedFixed64:function(t){if(this.type!==ml.Bytes)return t.push(this.readFixed64());var e=yl(this);for(t=t||[];this.pos<e;)t.push(this.readFixed64());return t},readPackedSFixed64:function(t){if(this.type!==ml.Bytes)return t.push(this.readSFixed64());var e=yl(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed64());return t},skip:function(t){var e=7&t;if(e===ml.Varint)for(;this.buf[this.pos++]>127;);else if(e===ml.Bytes)this.pos=this.readVarint()+this.pos;else if(e===ml.Fixed32)this.pos+=4;else{if(e!==ml.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e<this.pos+t;)e*=2;if(e!==this.length){var i=new Uint8Array(e);i.set(this.buf),this.buf=i,this.length=e}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(t){this.realloc(4),zl(this.buf,t,this.pos),this.pos+=4},writeSFixed32:function(t){this.realloc(4),zl(this.buf,t,this.pos),this.pos+=4},writeFixed64:function(t){this.realloc(8),zl(this.buf,-1&t,this.pos),zl(this.buf,Math.floor(t*gl),this.pos+4),this.pos+=8},writeSFixed64:function(t){this.realloc(8),zl(this.buf,-1&t,this.pos),zl(this.buf,Math.floor(t*gl),this.pos+4),this.pos+=8},writeVarint:function(t){(t=+t||0)>268435455||t<0?function(t,e){var i,r;if(t>=0?(i=t%4294967296|0,r=t/4294967296|0):(r=~(-t/4294967296),4294967295^(i=~(-t%4294967296))?i=i+1|0:(i=0,r=r+1|0)),t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),function(t,e,i){i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,i.buf[i.pos]=127&(t>>>=7)}(i,0,e),function(t,e){var i=(7&t)<<4;e.buf[e.pos++]|=i|((t>>>=3)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t)))))}(r,e)}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))},writeSVarint:function(t){this.writeVarint(t<0?2*-t-1:2*t)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t),this.realloc(4*t.length),this.pos++;var e=this.pos;this.pos=function(t,e,i){for(var r,n,o=0;o<e.length;o++){if((r=e.charCodeAt(o))>55295&&r<57344){if(!n){r>56319||o+1===e.length?(t[i++]=239,t[i++]=191,t[i++]=189):n=r;continue}if(r<56320){t[i++]=239,t[i++]=191,t[i++]=189,n=r;continue}r=n-55296<<10|r-56320|65536,n=null}else n&&(t[i++]=239,t[i++]=191,t[i++]=189,n=null);r<128?t[i++]=r:(r<2048?t[i++]=r>>6|192:(r<65536?t[i++]=r>>12|224:(t[i++]=r>>18|240,t[i++]=r>>12&63|128),t[i++]=r>>6&63|128),t[i++]=63&r|128)}return i}(this.buf,t,this.pos);var i=this.pos-e;i>=128&&vl(e,i,this),this.pos=e-1,this.writeVarint(i),this.pos+=i},writeFloat:function(t){this.realloc(4),dl(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),dl(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var i=0;i<e;i++)this.buf[this.pos++]=t[i]},writeRawMessage:function(t,e){this.pos++;var i=this.pos;t(e,this);var r=this.pos-i;r>=128&&vl(i,r,this),this.pos=i-1,this.writeVarint(r),this.pos+=r},writeMessage:function(t,e,i){this.writeTag(t,ml.Bytes),this.writeRawMessage(e,i)},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,bl,e)},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,wl,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,Sl,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,El,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,Tl,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,Cl,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,Il,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,Al,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,Ml,e)},writeBytesField:function(t,e){this.writeTag(t,ml.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,ml.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,ml.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,ml.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,ml.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,ml.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,ml.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,ml.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,ml.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,ml.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}};var Ll,Dl=e(ul);function Rl(t,e,i){1===t&&i.readMessage(Bl,e)}function Bl(t,e,i){if(3===t){const{id:t,bitmap:r,width:n,height:o,left:a,top:s,advance:l}=i.readMessage(Fl,{});e.push({id:t,bitmap:new Sa({width:n+6,height:o+6},r),metrics:{width:n,height:o,left:a,top:s,advance:l}})}}function Fl(t,e,i){1===t?e.id=i.readVarint():2===t?e.bitmap=i.readBytes():3===t?e.width=i.readVarint():4===t?e.height=i.readVarint():5===t?e.left=i.readSVarint():6===t?e.top=i.readSVarint():7===t&&(e.advance=i.readVarint())}function Ol(t){let e=0,i=0;for(const r of t)e+=r.w*r.h,i=Math.max(i,r.w);t.sort(((t,e)=>e.h-t.h));const r=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),i),h:1/0}];let n=0,o=0;for(const e of t)for(let t=r.length-1;t>=0;t--){const i=r[t];if(!(e.w>i.w||e.h>i.h)){if(e.x=i.x,e.y=i.y,o=Math.max(o,e.y+e.h),n=Math.max(n,e.x+e.w),e.w===i.w&&e.h===i.h){const e=r.pop();t<r.length&&(r[t]=e)}else e.h===i.h?(i.x+=e.w,i.w-=e.w):e.w===i.w?(i.y+=e.h,i.h-=e.h):(r.push({x:i.x+e.w,y:i.y,w:i.w-e.w,h:e.h}),i.y+=e.h,i.h-=e.h);break}}return{w:n,h:o,fill:e/(n*o)||0}}class Ul{constructor(t,{pixelRatio:e,version:i,stretchX:r,stretchY:n,content:o}){this.paddedRect=t,this.pixelRatio=e,this.stretchX=r,this.stretchY=n,this.content=o,this.version=i}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 Vl{constructor(t,e){const i={},r={};this.haveRenderCallbacks=[];const n=[];this.addImages(t,i,n),this.addImages(e,r,n);const{w:o,h:a}=Ol(n),s=new Ca({width:o||1,height:a||1});for(const e in t){const r=t[e],n=i[e].paddedRect;Ca.copy(r.data,s,{x:0,y:0},{x:n.x+1,y:n.y+1},r.data)}for(const t in e){const i=e[t],n=r[t].paddedRect,o=n.x+1,a=n.y+1,l=i.data.width,c=i.data.height;Ca.copy(i.data,s,{x:0,y:0},{x:o,y:a},i.data),Ca.copy(i.data,s,{x:0,y:c-1},{x:o,y:a-1},{width:l,height:1}),Ca.copy(i.data,s,{x:0,y:0},{x:o,y:a+c},{width:l,height:1}),Ca.copy(i.data,s,{x:l-1,y:0},{x:o-1,y:a},{width:1,height:c}),Ca.copy(i.data,s,{x:0,y:0},{x:o+l,y:a},{width:1,height:c})}this.image=s,this.iconPositions=i,this.patternPositions=r}addImages(t,e,i){for(const r in t){const n=t[r],o={x:0,y:0,w:n.data.width+2,h:n.data.height+2};i.push(o),e[r]=new Ul(o,n),n.hasRenderCallback&&this.haveRenderCallbacks.push(r)}}patchUpdatedImages(t,e){t.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const i in t.updatedImages)this.patchUpdatedImage(this.iconPositions[i],t.getImage(i),e),this.patchUpdatedImage(this.patternPositions[i],t.getImage(i),e)}patchUpdatedImage(t,e,i){if(!t||!e)return;if(t.version===e.version)return;t.version=e.version;const[r,n]=t.tl;i.update(e.data,void 0,{x:r,y:n})}}Sr("ImagePosition",Ul),Sr("ImageAtlas",Vl),t.WritingMode=void 0,(Ll=t.WritingMode||(t.WritingMode={}))[Ll.none=0]="none",Ll[Ll.horizontal=1]="horizontal",Ll[Ll.vertical=2]="vertical",Ll[Ll.horizontalOnly=3]="horizontalOnly";const Nl=-17;class $l{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(t,e){const i=new $l;return i.scale=t||1,i.fontStack=e,i}static forImage(t){const e=new $l;return e.imageName=t,e}}class jl{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(t,e){const i=new jl;for(let r=0;r<t.sections.length;r++){const n=t.sections[r];n.image?i.addImageSection(n):i.addTextSection(n,e)}return i}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 e="";for(let i=0;i<t.length;i++){const r=t.charCodeAt(i+1)||null,n=t.charCodeAt(i-1)||null;e+=r&&Rr(r)&&!cl[t[i+1]]||n&&Rr(n)&&!cl[t[i-1]]||!cl[t[i]]?t[i]:cl[t[i]]}return e}(this.text)}trim(){let t=0;for(let e=0;e<this.text.length&&Zl[this.text.charCodeAt(e)];e++)t++;let e=this.text.length;for(let i=this.text.length-1;i>=0&&i>=t&&Zl[this.text.charCodeAt(i)];i--)e--;this.text=this.text.substring(t,e),this.sectionIndex=this.sectionIndex.slice(t,e)}substring(t,e){const i=new jl;return i.text=this.text.substring(t,e),i.sectionIndex=this.sectionIndex.slice(t,e),i.sections=this.sections,i}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce(((t,e)=>Math.max(t,this.sections[e].scale)),0)}addTextSection(t,e){this.text+=t.text,this.sections.push($l.forText(t.scale,t.fontStack||e));const i=this.sections.length-1;for(let e=0;e<t.text.length;++e)this.sectionIndex.push(i)}addImageSection(t){const e=t.image?t.image.name:"";if(0===e.length)return void x("Can't add FormattedSection with an empty image.");const i=this.getNextImageSectionCharCode();i?(this.text+=String.fromCharCode(i),this.sections.push($l.forImage(e)),this.sectionIndex.push(this.sections.length-1)):x("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function ql(e,i,r,n,o,a,s,l,c,h,u,p,d,m,f,g){const _=jl.fromFeature(e,o);let y;p===t.WritingMode.vertical&&_.verticalizePunctuation();const{processBidirectionalText:x,processStyledBidirectionalText:v}=Kr;if(x&&1===_.sections.length){y=[];const t=x(_.toString(),Jl(_,h,a,i,n,m,f));for(const e of t){const t=new jl;t.text=e,t.sections=_.sections;for(let i=0;i<e.length;i++)t.sectionIndex.push(0);y.push(t)}}else if(v){y=[];const t=v(_.text,_.sectionIndex,Jl(_,h,a,i,n,m,f));for(const e of t){const t=new jl;t.text=e[0],t.sectionIndex=e[1],t.sections=_.sections,y.push(t)}}else y=function(t,e){const i=[],r=t.text;let n=0;for(const r of e)i.push(t.substring(n,r)),n=r;return n<r.length&&i.push(t.substring(n,r.length)),i}(_,Jl(_,h,a,i,n,m,f));const b=[],w={positionedLines:b,text:_.toString(),top:u[1],bottom:u[1],left:u[0],right:u[0],writingMode:p,iconsInText:!1,verticalizable:!1};return function(e,i,r,n,o,a,s,l,c,h,u,p){let d=0,m=Nl,f=0,g=0;const _="right"===l?1:"left"===l?0:.5;let y=0;for(const s of o){s.trim();const o=s.getMaxScale(),l=(o-1)*hl,v={positionedGlyphs:[],lineOffset:0};e.positionedLines[y]=v;const b=v.positionedGlyphs;let w=0;if(!s.length()){m+=a,++y;continue}for(let a=0;a<s.length();a++){const f=s.getSection(a),g=s.getSectionIndex(a),_=s.getCharCode(a);let y=0,v=null,E=null,T=null,S=hl;const C=!(c===t.WritingMode.horizontal||!u&&!Dr(_)||u&&(Zl[_]||(x=_,kr.Arabic(x)||kr["Arabic Supplement"](x)||kr["Arabic Extended-A"](x)||kr["Arabic Presentation Forms-A"](x)||kr["Arabic Presentation Forms-B"](x))));if(f.imageName){const t=n[f.imageName];if(!t)continue;T=f.imageName,e.iconsInText=e.iconsInText||!0,E=t.paddedRect;const i=t.displaySize;f.scale=f.scale*hl/p,v={width:i[0],height:i[1],left:1,top:-3,advance:C?i[1]:i[0]},y=l+(hl-i[1]*f.scale),S=v.advance;const r=C?i[0]*f.scale-hl*o:i[1]*f.scale-hl*o;r>0&&r>w&&(w=r)}else{const t=r[f.fontStack],e=t&&t[_];if(e&&e.rect)E=e.rect,v=e.metrics;else{const t=i[f.fontStack],e=t&&t[_];if(!e)continue;v=e.metrics}y=(o-f.scale)*hl}C?(e.verticalizable=!0,b.push({glyph:_,imageName:T,x:d,y:m+y,vertical:C,scale:f.scale,fontStack:f.fontStack,sectionIndex:g,metrics:v,rect:E}),d+=S*f.scale+h):(b.push({glyph:_,imageName:T,x:d,y:m+y,vertical:C,scale:f.scale,fontStack:f.fontStack,sectionIndex:g,metrics:v,rect:E}),d+=v.advance*f.scale+h)}0!==b.length&&(f=Math.max(d-h,f),tc(b,0,b.length-1,_,w)),d=0;const E=a*o+w;v.lineOffset=Math.max(w,l),m+=E,g=Math.max(E,g),++y}var x;const v=m-Nl,{horizontalAlign:b,verticalAlign:w}=Ql(s);(function(t,e,i,r,n,o,a,s,l){const c=(e-i)*n;let h=0;h=o!==a?-s*r-Nl:(-r*l+.5)*a;for(const e of t)for(const t of e.positionedGlyphs)t.x+=c,t.y+=h})(e.positionedLines,_,b,w,f,g,a,v,o.length),e.top+=-w*v,e.bottom=e.top+v,e.left+=-b*f,e.right=e.left+f}(w,i,r,n,y,s,l,c,p,h,d,g),!function(t){for(const e of t)if(0!==e.positionedGlyphs.length)return!1;return!0}(b)&&w}const Zl={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Gl={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 Hl(t,e,i,r,n,o){if(e.imageName){const t=r[e.imageName];return t?t.displaySize[0]*e.scale*hl/o+n:0}{const r=i[e.fontStack],o=r&&r[t];return o?o.metrics.advance*e.scale+n:0}}function Xl(t,e,i,r){const n=Math.pow(t-e,2);return r?t<e?n/2:2*n:n+Math.abs(i)*i}function Wl(t,e,i){let r=0;return 10===t&&(r-=1e4),i&&(r+=150),40!==t&&65288!==t||(r+=50),41!==e&&65289!==e||(r+=50),r}function Kl(t,e,i,r,n,o){let a=null,s=Xl(e,i,n,o);for(const t of r){const r=Xl(e-t.x,i,n,o)+t.badness;r<=s&&(a=t,s=r)}return{index:t,x:e,priorBreak:a,badness:s}}function Yl(t){return t?Yl(t.priorBreak).concat(t.index):[]}function Jl(t,e,i,r,n,o,a){if("point"!==o)return[];if(!t)return[];const s=[],l=function(t,e,i,r,n,o){let a=0;for(let i=0;i<t.length();i++){const s=t.getSection(i);a+=Hl(t.getCharCode(i),s,r,n,e,o)}return a/Math.max(1,Math.ceil(a/i))}(t,e,i,r,n,a),c=t.text.indexOf("​")>=0;let h=0;for(let i=0;i<t.length();i++){const o=t.getSection(i),p=t.getCharCode(i);if(Zl[p]||(h+=Hl(p,o,r,n,e,a)),i<t.length()-1){const e=!((u=p)<11904||!(kr["Bopomofo Extended"](u)||kr.Bopomofo(u)||kr["CJK Compatibility Forms"](u)||kr["CJK Compatibility Ideographs"](u)||kr["CJK Compatibility"](u)||kr["CJK Radicals Supplement"](u)||kr["CJK Strokes"](u)||kr["CJK Symbols and Punctuation"](u)||kr["CJK Unified Ideographs Extension A"](u)||kr["CJK Unified Ideographs"](u)||kr["Enclosed CJK Letters and Months"](u)||kr["Halfwidth and Fullwidth Forms"](u)||kr.Hiragana(u)||kr["Ideographic Description Characters"](u)||kr["Kangxi Radicals"](u)||kr["Katakana Phonetic Extensions"](u)||kr.Katakana(u)||kr["Vertical Forms"](u)||kr["Yi Radicals"](u)||kr["Yi Syllables"](u)));(Gl[p]||e||o.imageName)&&s.push(Kl(i+1,h,l,s,Wl(p,t.getCharCode(i+1),e&&c),!1))}}var u;return Yl(Kl(t.length(),h,l,s,0,!0))}function Ql(t){let e=.5,i=.5;switch(t){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0}switch(t){case"bottom":case"bottom-right":case"bottom-left":i=1;break;case"top":case"top-right":case"top-left":i=0}return{horizontalAlign:e,verticalAlign:i}}function tc(t,e,i,r,n){if(!r&&!n)return;const o=t[i],a=(t[i].x+o.metrics.advance*o.scale)*r;for(let r=e;r<=i;r++)t[r].x-=a,t[r].y+=n}function ec(t,e,i){const{horizontalAlign:r,verticalAlign:n}=Ql(i),o=e[0]-t.displaySize[0]*r,a=e[1]-t.displaySize[1]*n;return{image:t,top:a,bottom:a+t.displaySize[1],left:o,right:o+t.displaySize[0]}}function ic(t,e,i,r,n,o){const a=t.image;let s;if(a.content){const t=a.content,e=a.pixelRatio||1;s=[t[0]/e,t[1]/e,a.displaySize[0]-t[2]/e,a.displaySize[1]-t[3]/e]}const l=e.left*o,c=e.right*o;let h,u,p,d;"width"===i||"both"===i?(d=n[0]+l-r[3],u=n[0]+c+r[1]):(d=n[0]+(l+c-a.displaySize[0])/2,u=d+a.displaySize[0]);const m=e.top*o,f=e.bottom*o;return"height"===i||"both"===i?(h=n[1]+m-r[0],p=n[1]+f+r[2]):(h=n[1]+(m+f-a.displaySize[1])/2,p=h+a.displaySize[1]),{image:a,top:h,right:u,bottom:p,left:d,collisionPadding:s}}const rc=128,nc=32640;function oc(t,e){const{expression:i}=e;if("constant"===i.kind)return{kind:"constant",layoutSize:i.evaluate(new Yr(t+1))};if("source"===i.kind)return{kind:"source"};{const{zoomStops:e,interpolationType:r}=i;let n=0;for(;n<e.length&&e[n]<=t;)n++;n=Math.max(0,n-1);let o=n;for(;o<e.length&&e[o]<t+1;)o++;o=Math.min(e.length-1,o);const a=e[n],s=e[o];return"composite"===i.kind?{kind:"composite",minZoom:a,maxZoom:s,interpolationType:r}:{kind:"camera",minZoom:a,maxZoom:s,minSize:i.evaluate(new Yr(a)),maxSize:i.evaluate(new Yr(s)),interpolationType:r}}}function ac(t,e,i){let r="never";const n=t.get(e);return n?r=n:t.get(i)&&(r="always"),r}const sc=bs.VectorTileFeature.types,lc=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function cc(t,e,i,r,n,o,a,s,l,c,h,u,p){const d=s?Math.min(nc,Math.round(s[0])):0,m=s?Math.min(nc,Math.round(s[1])):0;t.emplaceBack(e,i,Math.round(32*r),Math.round(32*n),o,a,(d<<1)+(l?1:0),m,16*c,16*h,256*u,256*p)}function hc(t,e,i){t.emplaceBack(e.x,e.y,i),t.emplaceBack(e.x,e.y,i),t.emplaceBack(e.x,e.y,i),t.emplaceBack(e.x,e.y,i)}function uc(t){for(const e of t.sections)if(Or(e.text))return!0;return!1}class pc{constructor(t){this.layoutVertexArray=new oo,this.indexArray=new ho,this.programConfigurations=t,this.segments=new fo,this.dynamicLayoutVertexArray=new ao,this.opacityVertexArray=new so,this.hasVisibleVertices=!1,this.placedSymbolArray=new Zn}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.indexArray.length&&0===this.dynamicLayoutVertexArray.length&&0===this.opacityVertexArray.length}upload(t,e,i,r){this.isEmpty()||(i&&(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,rl.members),this.indexBuffer=t.createIndexBuffer(this.indexArray,e),this.dynamicLayoutVertexBuffer=t.createVertexBuffer(this.dynamicLayoutVertexArray,nl.members,!0),this.opacityVertexBuffer=t.createVertexBuffer(this.opacityVertexArray,lc,!0),this.opacityVertexBuffer.itemSize=1),(i||r)&&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())}}Sr("SymbolBuffers",pc);class dc{constructor(t,e,i){this.layoutVertexArray=new t,this.layoutAttributes=e,this.indexArray=new i,this.segments=new fo,this.collisionVertexArray=new co}upload(t){this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=t.createVertexBuffer(this.collisionVertexArray,ol.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}Sr("CollisionBuffers",dc);class mc{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=da([]),this.placementViewportMatrix=da([]);const i=this.layers[0]._unevaluatedLayout._values;this.textSizeData=oc(this.zoom,i["text-size"]),this.iconSizeData=oc(this.zoom,i["icon-size"]);const r=this.layers[0].layout,n=r.get("symbol-sort-key"),o=r.get("symbol-z-order");this.canOverlap="never"!==ac(r,"text-overlap","text-allow-overlap")||"never"!==ac(r,"icon-overlap","icon-allow-overlap")||r.get("text-ignore-placement")||r.get("icon-ignore-placement"),this.sortFeaturesByKey="viewport-y"!==o&&!n.isConstant(),this.sortFeaturesByY=("viewport-y"===o||"auto"===o&&!this.sortFeaturesByKey)&&this.canOverlap,"point"===r.get("symbol-placement")&&(this.writingModes=r.get("text-writing-mode").map((e=>t.WritingMode[e]))),this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id)),this.sourceID=e.sourceID}createArrays(){this.text=new pc(new Oo(this.layers,this.zoom,(t=>/^text/.test(t)))),this.icon=new pc(new Oo(this.layers,this.zoom,(t=>/^icon/.test(t)))),this.glyphOffsetArray=new Xn,this.lineVertexArray=new Wn,this.symbolInstances=new Hn}calculateGlyphDependencies(t,e,i,r,n){for(let o=0;o<t.length;o++)if(e[t.charCodeAt(o)]=!0,(i||r)&&n){const i=cl[t.charAt(o)];i&&(e[i.charCodeAt(0)]=!0)}}populate(e,i,r){const n=this.layers[0],o=n.layout,a=o.get("text-font"),s=o.get("text-field"),l=o.get("icon-image"),c=("constant"!==s.value.kind||s.value.value instanceof Zt&&!s.value.value.isEmpty()||s.value.value.toString().length>0)&&("constant"!==a.value.kind||a.value.value.length>0),h="constant"!==l.value.kind||!!l.value.value||Object.keys(l.parameters).length>0,u=o.get("symbol-sort-key");if(this.features=[],!c&&!h)return;const p=i.iconDependencies,d=i.glyphDependencies,m=i.availableImages,f=new Yr(this.zoom);for(const{feature:i,id:s,index:l,sourceLayerIndex:g}of e){const e=n._featureFilter.needGeometry,_=Zo(i,e);if(!n._featureFilter.filter(f,_,r))continue;let y,x;if(e||(_.geometry=qo(i)),c){const t=n.getValueAndResolveTokens("text-field",_,r,m),e=Zt.factory(t);uc(e)&&(this.hasRTLText=!0),(!this.hasRTLText||"unavailable"===Xr()||this.hasRTLText&&Kr.isParsed())&&(y=ll(e,n,_))}if(h){const t=n.getValueAndResolveTokens("icon-image",_,r,m);x=t instanceof Ht?t:Ht.fromString(t)}if(!y&&!x)continue;const v=this.sortFeaturesByKey?u.evaluate(_,{},r):void 0;if(this.features.push({id:s,text:y,icon:x,index:l,sourceLayerIndex:g,geometry:_.geometry,properties:i.properties,type:sc[i.type],sortKey:v}),x&&(p[x.name]=!0),y){const e=a.evaluate(_,{},r).join(","),i="viewport"!==o.get("text-rotation-alignment")&&"point"!==o.get("symbol-placement");this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(t.WritingMode.vertical)>=0;for(const t of y.sections)if(t.image)p[t.image.name]=!0;else{const r=zr(y.toString()),n=t.fontStack||e,o=d[n]=d[n]||{};this.calculateGlyphDependencies(t.text,o,i,this.allowVerticalPlacement,r)}}}"line"===o.get("symbol-placement")&&(this.features=function(t){const e={},i={},r=[];let n=0;function o(e){r.push(t[e]),n++}function a(t,e,n){const o=i[t];return delete i[t],i[e]=o,r[o].geometry[0].pop(),r[o].geometry[0]=r[o].geometry[0].concat(n[0]),o}function s(t,i,n){const o=e[i];return delete e[i],e[t]=o,r[o].geometry[0].shift(),r[o].geometry[0]=n[0].concat(r[o].geometry[0]),o}function l(t,e,i){const r=i?e[0][e[0].length-1]:e[0][0];return`${t}:${r.x}:${r.y}`}for(let c=0;c<t.length;c++){const h=t[c],u=h.geometry,p=h.text?h.text.toString():null;if(!p){o(c);continue}const d=l(p,u),m=l(p,u,!0);if(d in i&&m in e&&i[d]!==e[m]){const t=s(d,m,u),n=a(d,m,r[t].geometry);delete e[d],delete i[m],i[l(p,r[n].geometry,!0)]=n,r[t].geometry=null}else d in i?a(d,m,u):m in e?s(d,m,u):(o(c),e[d]=n-1,i[m]=n-1)}return r.filter((t=>t.geometry))}(this.features)),this.sortFeaturesByKey&&this.features.sort(((t,e)=>t.sortKey-e.sortKey))}update(t,e,i){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(t,e,this.layers,i),this.icon.programConfigurations.updatePaintArrays(t,e,this.layers,i))}isEmpty(){return 0===this.symbolInstances.length&&!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,e){const i=this.lineVertexArray.length;if(void 0!==t.segment){let i=t.dist(e[t.segment+1]),r=t.dist(e[t.segment]);const n={};for(let r=t.segment+1;r<e.length;r++)n[r]={x:e[r].x,y:e[r].y,tileUnitDistanceFromAnchor:i},r<e.length-1&&(i+=e[r+1].dist(e[r]));for(let i=t.segment||0;i>=0;i--)n[i]={x:e[i].x,y:e[i].y,tileUnitDistanceFromAnchor:r},i>0&&(r+=e[i-1].dist(e[i]));for(let t=0;t<e.length;t++){const e=n[t];this.lineVertexArray.emplaceBack(e.x,e.y,e.tileUnitDistanceFromAnchor)}}return{lineStartIndex:i,lineLength:this.lineVertexArray.length-i}}addSymbols(e,i,r,n,o,a,s,l,c,h,u,p){const d=e.indexArray,m=e.layoutVertexArray,f=e.segments.prepareSegment(4*i.length,m,d,this.canOverlap?a.sortKey:void 0),g=this.glyphOffsetArray.length,_=f.vertexLength,y=this.allowVerticalPlacement&&s===t.WritingMode.vertical?Math.PI/2:0,x=a.text&&a.text.sections;for(let t=0;t<i.length;t++){const{tl:n,tr:o,bl:s,br:c,tex:h,pixelOffsetTL:u,pixelOffsetBR:g,minFontScaleX:_,minFontScaleY:v,glyphOffset:b,isSDF:w,sectionIndex:E}=i[t],T=f.vertexLength,S=b[1];cc(m,l.x,l.y,n.x,S+n.y,h.x,h.y,r,w,u.x,u.y,_,v),cc(m,l.x,l.y,o.x,S+o.y,h.x+h.w,h.y,r,w,g.x,u.y,_,v),cc(m,l.x,l.y,s.x,S+s.y,h.x,h.y+h.h,r,w,u.x,g.y,_,v),cc(m,l.x,l.y,c.x,S+c.y,h.x+h.w,h.y+h.h,r,w,g.x,g.y,_,v),hc(e.dynamicLayoutVertexArray,l,y),d.emplaceBack(T,T+1,T+2),d.emplaceBack(T+1,T+2,T+3),f.vertexLength+=4,f.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(b[0]),t!==i.length-1&&E===i[t+1].sectionIndex||e.programConfigurations.populatePaintArrays(m.length,a,a.index,{},p,x&&x[E])}e.placedSymbolArray.emplaceBack(l.x,l.y,g,this.glyphOffsetArray.length-g,_,c,h,l.segment,r?r[0]:0,r?r[1]:0,n[0],n[1],s,0,!1,0,u)}_addCollisionDebugVertex(t,e,i,r,n,o){return e.emplaceBack(0,0),t.emplaceBack(i.x,i.y,r,n,Math.round(o.x),Math.round(o.y))}addCollisionDebugVertices(t,e,i,r,o,a,s){const l=o.segments.prepareSegment(4,o.layoutVertexArray,o.indexArray),c=l.vertexLength,h=o.layoutVertexArray,u=o.collisionVertexArray,p=s.anchorX,d=s.anchorY;this._addCollisionDebugVertex(h,u,a,p,d,new n(t,e)),this._addCollisionDebugVertex(h,u,a,p,d,new n(i,e)),this._addCollisionDebugVertex(h,u,a,p,d,new n(i,r)),this._addCollisionDebugVertex(h,u,a,p,d,new n(t,r)),l.vertexLength+=4;const m=o.indexArray;m.emplaceBack(c,c+1),m.emplaceBack(c+1,c+2),m.emplaceBack(c+2,c+3),m.emplaceBack(c+3,c),l.primitiveLength+=4}addDebugCollisionBoxes(t,e,i,r){for(let n=t;n<e;n++){const t=this.collisionBoxArray.get(n);this.addCollisionDebugVertices(t.x1,t.y1,t.x2,t.y2,r?this.textCollisionBox:this.iconCollisionBox,t.anchorPoint,i)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new dc(lo,al.members,uo),this.iconCollisionBox=new dc(lo,al.members,uo);for(let t=0;t<this.symbolInstances.length;t++){const e=this.symbolInstances.get(t);this.addDebugCollisionBoxes(e.textBoxStartIndex,e.textBoxEndIndex,e,!0),this.addDebugCollisionBoxes(e.verticalTextBoxStartIndex,e.verticalTextBoxEndIndex,e,!0),this.addDebugCollisionBoxes(e.iconBoxStartIndex,e.iconBoxEndIndex,e,!1),this.addDebugCollisionBoxes(e.verticalIconBoxStartIndex,e.verticalIconBoxEndIndex,e,!1)}}_deserializeCollisionBoxesForSymbol(t,e,i,r,n,o,a,s,l){const c={};for(let r=e;r<i;r++){const e=t.get(r);c.textBox={x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,anchorPointX:e.anchorPointX,anchorPointY:e.anchorPointY},c.textFeatureIndex=e.featureIndex;break}for(let e=r;e<n;e++){const i=t.get(e);c.verticalTextBox={x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2,anchorPointX:i.anchorPointX,anchorPointY:i.anchorPointY},c.verticalTextFeatureIndex=i.featureIndex;break}for(let e=o;e<a;e++){const i=t.get(e);c.iconBox={x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2,anchorPointX:i.anchorPointX,anchorPointY:i.anchorPointY},c.iconFeatureIndex=i.featureIndex;break}for(let e=s;e<l;e++){const i=t.get(e);c.verticalIconBox={x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2,anchorPointX:i.anchorPointX,anchorPointY:i.anchorPointY},c.verticalIconFeatureIndex=i.featureIndex;break}return c}deserializeCollisionBoxes(t){this.collisionArrays=[];for(let e=0;e<this.symbolInstances.length;e++){const i=this.symbolInstances.get(e);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(t,i.textBoxStartIndex,i.textBoxEndIndex,i.verticalTextBoxStartIndex,i.verticalTextBoxEndIndex,i.iconBoxStartIndex,i.iconBoxEndIndex,i.verticalIconBoxStartIndex,i.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,e){const i=t.placedSymbolArray.get(e),r=i.vertexStartIndex+4*i.numGlyphs;for(let e=i.vertexStartIndex;e<r;e+=4)t.indexArray.emplaceBack(e,e+1,e+2),t.indexArray.emplaceBack(e+1,e+2,e+3)}getSortedSymbolIndexes(t){if(this.sortedAngle===t&&void 0!==this.symbolInstanceIndexes)return this.symbolInstanceIndexes;const e=Math.sin(t),i=Math.cos(t),r=[],n=[],o=[];for(let t=0;t<this.symbolInstances.length;++t){o.push(t);const a=this.symbolInstances.get(t);r.push(0|Math.round(e*a.anchorX+i*a.anchorY)),n.push(a.featureIndex)}return o.sort(((t,e)=>r[t]-r[e]||n[e]-n[t])),o}addToSortKeyRanges(t,e){const i=this.sortKeyRanges[this.sortKeyRanges.length-1];i&&i.sortKey===e?i.symbolInstanceEnd=t+1:this.sortKeyRanges.push({sortKey:e,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(const t of this.symbolInstanceIndexes){const e=this.symbolInstances.get(t);this.featureSortOrder.push(e.featureIndex),[e.rightJustifiedTextSymbolIndex,e.centerJustifiedTextSymbolIndex,e.leftJustifiedTextSymbolIndex].forEach(((t,e,i)=>{t>=0&&i.indexOf(t)===e&&this.addIndicesForPlacedSymbol(this.text,t)})),e.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,e.verticalPlacedTextSymbolIndex),e.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,e.placedIconSymbolIndex),e.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,e.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let fc,gc;Sr("SymbolBucket",mc,{omit:["layers","collisionBoxArray","features","compareText"]}),mc.MAX_GLYPHS=65535,mc.addDynamicAttributes=hc;var _c={get paint(){return gc=gc||new pn({"icon-opacity":new ln(j.paint_symbol["icon-opacity"]),"icon-color":new ln(j.paint_symbol["icon-color"]),"icon-halo-color":new ln(j.paint_symbol["icon-halo-color"]),"icon-halo-width":new ln(j.paint_symbol["icon-halo-width"]),"icon-halo-blur":new ln(j.paint_symbol["icon-halo-blur"]),"icon-translate":new sn(j.paint_symbol["icon-translate"]),"icon-translate-anchor":new sn(j.paint_symbol["icon-translate-anchor"]),"text-opacity":new ln(j.paint_symbol["text-opacity"]),"text-color":new ln(j.paint_symbol["text-color"],{runtimeType:ct,getOverride:t=>t.textColor,hasOverride:t=>!!t.textColor}),"text-halo-color":new ln(j.paint_symbol["text-halo-color"]),"text-halo-width":new ln(j.paint_symbol["text-halo-width"]),"text-halo-blur":new ln(j.paint_symbol["text-halo-blur"]),"text-translate":new sn(j.paint_symbol["text-translate"]),"text-translate-anchor":new sn(j.paint_symbol["text-translate-anchor"])})},get layout(){return fc=fc||new pn({"symbol-placement":new sn(j.layout_symbol["symbol-placement"]),"symbol-spacing":new sn(j.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new sn(j.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new ln(j.layout_symbol["symbol-sort-key"]),"symbol-z-order":new sn(j.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new sn(j.layout_symbol["icon-allow-overlap"]),"icon-overlap":new sn(j.layout_symbol["icon-overlap"]),"icon-ignore-placement":new sn(j.layout_symbol["icon-ignore-placement"]),"icon-optional":new sn(j.layout_symbol["icon-optional"]),"icon-rotation-alignment":new sn(j.layout_symbol["icon-rotation-alignment"]),"icon-size":new ln(j.layout_symbol["icon-size"]),"icon-text-fit":new sn(j.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new sn(j.layout_symbol["icon-text-fit-padding"]),"icon-image":new ln(j.layout_symbol["icon-image"]),"icon-rotate":new ln(j.layout_symbol["icon-rotate"]),"icon-padding":new ln(j.layout_symbol["icon-padding"]),"icon-keep-upright":new sn(j.layout_symbol["icon-keep-upright"]),"icon-offset":new ln(j.layout_symbol["icon-offset"]),"icon-anchor":new ln(j.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new sn(j.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new sn(j.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new sn(j.layout_symbol["text-rotation-alignment"]),"text-field":new ln(j.layout_symbol["text-field"]),"text-font":new ln(j.layout_symbol["text-font"]),"text-size":new ln(j.layout_symbol["text-size"]),"text-max-width":new ln(j.layout_symbol["text-max-width"]),"text-line-height":new sn(j.layout_symbol["text-line-height"]),"text-letter-spacing":new ln(j.layout_symbol["text-letter-spacing"]),"text-justify":new ln(j.layout_symbol["text-justify"]),"text-radial-offset":new ln(j.layout_symbol["text-radial-offset"]),"text-variable-anchor":new sn(j.layout_symbol["text-variable-anchor"]),"text-anchor":new ln(j.layout_symbol["text-anchor"]),"text-max-angle":new sn(j.layout_symbol["text-max-angle"]),"text-writing-mode":new sn(j.layout_symbol["text-writing-mode"]),"text-rotate":new ln(j.layout_symbol["text-rotate"]),"text-padding":new sn(j.layout_symbol["text-padding"]),"text-keep-upright":new sn(j.layout_symbol["text-keep-upright"]),"text-transform":new ln(j.layout_symbol["text-transform"]),"text-offset":new ln(j.layout_symbol["text-offset"]),"text-allow-overlap":new sn(j.layout_symbol["text-allow-overlap"]),"text-overlap":new sn(j.layout_symbol["text-overlap"]),"text-ignore-placement":new sn(j.layout_symbol["text-ignore-placement"]),"text-optional":new sn(j.layout_symbol["text-optional"])})}};class yc{constructor(t){if(void 0===t.property.overrides)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=t.property.overrides?t.property.overrides.runtimeType:ot,this.defaultValue=t}evaluate(t){if(t.formattedSection){const e=this.defaultValue.property.overrides;if(e&&e.hasOverride(t.formattedSection))return e.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}}Sr("FormatSectionOverride",yc,{omit:["defaultValue"]});class xc extends mn{constructor(t){super(t,_c)}recalculate(t,e){if(super.recalculate(t,e),"auto"===this.layout.get("icon-rotation-alignment")&&(this.layout._values["icon-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-rotation-alignment")&&(this.layout._values["text-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-pitch-alignment")&&(this.layout._values["text-pitch-alignment"]="map"===this.layout.get("text-rotation-alignment")?"map":"viewport"),"auto"===this.layout.get("icon-pitch-alignment")&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),"point"===this.layout.get("symbol-placement")){const t=this.layout.get("text-writing-mode");if(t){const e=[];for(const i of t)e.indexOf(i)<0&&e.push(i);this.layout._values["text-writing-mode"]=e}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(t,e,i,r){const n=this.layout.get(t).evaluate(e,{},i,r),o=this._unevaluatedLayout._values[t];return o.isDataDriven()||Si(o.value)||!n?n:function(t,e){return e.replace(/{([^{}]+)}/g,((e,i)=>i in t?String(t[i]):""))}(e.properties,n)}createBucket(t){return new mc(t)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const t of _c.paint.overridableProperties){if(!xc.hasPaintOverride(this.layout,t))continue;const e=this.paint.get(t),i=new yc(e),r=new Ti(i,e.property.specification);let n=null;n="constant"===e.value.kind||"source"===e.value.kind?new Ii("source",r):new Ai("composite",r,e.value.zoomStops),this.paint._values[t]=new on(e.property,n,e.parameters)}}_handleOverridablePaintPropertyUpdate(t,e,i){return!(!this.layout||e.isDataDriven()||i.isDataDriven())&&xc.hasPaintOverride(this.layout,t)}static hasPaintOverride(t,e){const i=t.get("text-field"),r=_c.paint.properties[e];let n=!1;const o=t=>{for(const e of t)if(r.overrides&&r.overrides.hasOverride(e))return void(n=!0)};if("constant"===i.value.kind&&i.value.value instanceof Zt)o(i.value.value.sections);else if("source"===i.value.kind){const t=e=>{n||(e instanceof Jt&&Kt(e.value)===dt?o(e.value.sections):e instanceof ii?o(e.sections):e.eachChild(t))},e=i.value;e._styleExpression&&t(e._styleExpression.expression)}return n}}let vc;var bc={get paint(){return vc=vc||new pn({"background-color":new sn(j.paint_background["background-color"]),"background-pattern":new hn(j.paint_background["background-pattern"]),"background-opacity":new sn(j.paint_background["background-opacity"])})}};let wc;var Ec={get paint(){return wc=wc||new pn({"raster-opacity":new sn(j.paint_raster["raster-opacity"]),"raster-hue-rotate":new sn(j.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new sn(j.paint_raster["raster-brightness-min"]),"raster-brightness-max":new sn(j.paint_raster["raster-brightness-max"]),"raster-saturation":new sn(j.paint_raster["raster-saturation"]),"raster-contrast":new sn(j.paint_raster["raster-contrast"]),"raster-resampling":new sn(j.paint_raster["raster-resampling"]),"raster-fade-duration":new sn(j.paint_raster["raster-fade-duration"])})}};class Tc extends mn{constructor(t){super(t,{}),this.onAdd=t=>{this.implementation.onAdd&&this.implementation.onAdd(t,t.painter.context.gl)},this.onRemove=t=>{this.implementation.onRemove&&this.implementation.onRemove(t,t.painter.context.gl)},this.implementation=t}is3D(){return"3d"===this.implementation.renderingMode}hasOffscreenPass(){return void 0!==this.implementation.prerender}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}}const Sc={circle:class extends mn{constructor(t){super(t,ha)}createBucket(t){return new Ho(t)}queryRadius(t){const e=t;return oa("circle-radius",this,e)+oa("circle-stroke-width",this,e)+aa(this.paint.get("circle-translate"))}queryIntersectsFeature(t,e,i,r,n,o,a,s){const l=sa(t,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),o.angle,a),c=this.paint.get("circle-radius").evaluate(e,i)+this.paint.get("circle-stroke-width").evaluate(e,i),h="map"===this.paint.get("circle-pitch-alignment"),u=h?l:function(t,e){return t.map((t=>ya(t,e)))}(l,s),p=h?c*a:c;for(const t of r)for(const e of t){const t=h?e:ya(e,s);let i=p;const r=_a([],[e.x,e.y,0,1],s);if("viewport"===this.paint.get("circle-pitch-scale")&&"map"===this.paint.get("circle-pitch-alignment")?i*=r[3]/o.cameraToCenterDistance:"map"===this.paint.get("circle-pitch-scale")&&"viewport"===this.paint.get("circle-pitch-alignment")&&(i*=o.cameraToCenterDistance/r[3]),Wo(u,t,i))return!0}return!1}},heatmap:class extends mn{createBucket(t){return new xa(t)}constructor(t){super(t,ba),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(t){"heatmap-color"===t&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=Ia({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 0!==this.paint.get("heatmap-opacity")&&"none"!==this.visibility}},hillshade:class extends mn{constructor(t){super(t,Ma)}hasOffscreenPass(){return 0!==this.paint.get("hillshade-exaggeration")&&"none"!==this.visibility}},fill:class extends mn{constructor(t){super(t,_s)}recalculate(t,e){super.recalculate(t,e);const i=this.paint._values["fill-outline-color"];"constant"===i.value.kind&&void 0===i.value.value&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(t){return new ms(t)}queryRadius(){return aa(this.paint.get("fill-translate"))}queryIntersectsFeature(t,e,i,r,n,o,a){return Ko(sa(t,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),o.angle,a),r)}isTileClipped(){return!0}},"fill-extrusion":class extends mn{constructor(t){super(t,Vs)}createBucket(t){return new Bs(t)}queryRadius(){return aa(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(t,e,i,r,o,a,s,l){const c=sa(t,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),a.angle,s),h=this.paint.get("fill-extrusion-height").evaluate(e,i),u=this.paint.get("fill-extrusion-base").evaluate(e,i),p=function(t,e,i,r){const o=[];for(const i of t){const t=[i.x,i.y,0,1];_a(t,t,e),o.push(new n(t[0]/t[3],t[1]/t[3]))}return o}(c,l),d=function(t,e,i,r){const o=[],a=[],s=r[8]*e,l=r[9]*e,c=r[10]*e,h=r[11]*e,u=r[8]*i,p=r[9]*i,d=r[10]*i,m=r[11]*i;for(const e of t){const t=[],i=[];for(const o of e){const e=o.x,a=o.y,f=r[0]*e+r[4]*a+r[12],g=r[1]*e+r[5]*a+r[13],_=r[2]*e+r[6]*a+r[14],y=r[3]*e+r[7]*a+r[15],x=_+c,v=y+h,b=f+u,w=g+p,E=_+d,T=y+m,S=new n((f+s)/v,(g+l)/v);S.z=x/v,t.push(S);const C=new n(b/T,w/T);C.z=E/T,i.push(C)}o.push(t),a.push(i)}return[o,a]}(r,u,h,l);return function(t,e,i){let r=1/0;Ko(i,e)&&(r=$s(i,e[0]));for(let n=0;n<e.length;n++){const o=e[n],a=t[n];for(let t=0;t<o.length-1;t++){const e=o[t],n=[e,o[t+1],a[t+1],a[t],e];Xo(i,n)&&(r=Math.min(r,$s(i,n)))}}return r!==1/0&&r}(d[0],d[1],p)}},line:class extends mn{constructor(t){super(t,Qs),this.gradientVersion=0,el||(el=new tl(Qs.paint.properties["line-width"].specification),el.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(t){"line-gradient"===t&&(this.stepInterpolant=this._transitionablePaint._values["line-gradient"].value.expression._styleExpression.expression instanceof Pe,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER)}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(t,e){super.recalculate(t,e),this.paint._values["line-floorwidth"]=el.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,t)}createBucket(t){return new Ks(t)}queryRadius(t){const e=t,i=il(oa("line-width",this,e),oa("line-gap-width",this,e)),r=oa("line-offset",this,e);return i/2+Math.abs(r)+aa(this.paint.get("line-translate"))}queryIntersectsFeature(t,e,i,r,o,a,s){const l=sa(t,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),a.angle,s),c=s/2*il(this.paint.get("line-width").evaluate(e,i),this.paint.get("line-gap-width").evaluate(e,i)),h=this.paint.get("line-offset").evaluate(e,i);return h&&(r=function(t,e){const i=[];for(let r=0;r<t.length;r++){const o=t[r],a=[];for(let t=0;t<o.length;t++){const i=o[t-1],r=o[t],s=o[t+1],l=0===t?new n(0,0):r.sub(i)._unit()._perp(),c=t===o.length-1?new n(0,0):s.sub(r)._unit()._perp(),h=l._add(c)._unit(),u=h.x*c.x+h.y*c.y;0!==u&&h._mult(1/u),a.push(h._mult(e)._add(r))}i.push(a)}return i}(r,h*s)),function(t,e,i){for(let r=0;r<e.length;r++){const n=e[r];if(t.length>=3)for(let e=0;e<n.length;e++)if(ra(t,n[e]))return!0;if(Yo(t,n,i))return!0}return!1}(l,r,c)}isTileClipped(){return!0}},symbol:xc,background:class extends mn{constructor(t){super(t,bc)}},raster:class extends mn{constructor(t){super(t,Ec)}}};class Cc{constructor(t){this._callback=t,this._triggered=!1,"undefined"!=typeof MessageChannel&&(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=()=>{}}}const Ic=6371008.8;class Ac{constructor(t,e){if(isNaN(t)||isNaN(e))throw new Error(`Invalid LngLat object: (${t}, ${e})`);if(this.lng=+t,this.lat=+e,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new Ac(u(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(t){const e=Math.PI/180,i=this.lat*e,r=t.lat*e,n=Math.sin(i)*Math.sin(r)+Math.cos(i)*Math.cos(r)*Math.cos((t.lng-this.lng)*e);return Ic*Math.acos(Math.min(n,1))}static convert(t){if(t instanceof Ac)return t;if(Array.isArray(t)&&(2===t.length||3===t.length))return new Ac(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&"object"==typeof t&&null!==t)return new Ac(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>]")}}const Mc=2*Math.PI*Ic;function kc(t){return Mc*Math.cos(t*Math.PI/180)}function zc(t){return(180+t)/360}function Pc(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function Lc(t,e){return t/kc(e)}function Dc(t){return 360/Math.PI*Math.atan(Math.exp((180-360*t)*Math.PI/180))-90}class Rc{constructor(t,e,i=0){this.x=+t,this.y=+e,this.z=+i}static fromLngLat(t,e=0){const i=Ac.convert(t);return new Rc(zc(i.lng),Pc(i.lat),Lc(e,i.lat))}toLngLat(){return new Ac(360*this.x-180,Dc(this.y))}toAltitude(){return this.z*kc(Dc(this.y))}meterInMercatorCoordinateUnits(){return 1/Mc*(t=Dc(this.y),1/Math.cos(t*Math.PI/180));var t}}function Bc(t,e,i){var r=2*Math.PI*6378137/256/Math.pow(2,i);return[t*r-2*Math.PI*6378137/2,e*r-2*Math.PI*6378137/2]}class Fc{constructor(t,e,i){if(t<0||t>25||i<0||i>=Math.pow(2,t)||e<0||e>=Math.pow(2,t))throw new Error(`x=${e}, y=${i}, z=${t} outside of bounds. 0<=x<${Math.pow(2,t)}, 0<=y<${Math.pow(2,t)} 0<=z<=25 `);this.z=t,this.x=e,this.y=i,this.key=Vc(0,t,t,e,i)}equals(t){return this.z===t.z&&this.x===t.x&&this.y===t.y}url(t,e,i){const r=(o=this.y,a=this.z,s=Bc(256*(n=this.x),256*(o=Math.pow(2,a)-o-1),a),l=Bc(256*(n+1),256*(o+1),a),s[0]+","+s[1]+","+l[0]+","+l[1]);var n,o,a,s,l;const c=function(t,e,i){let r,n="";for(let o=t;o>0;o--)r=1<<o-1,n+=(e&r?1:0)+(i&r?2:0);return n}(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("tms"===i?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,e>1?"@2x":"").replace(/{quadkey}/g,c).replace(/{bbox-epsg-3857}/g,r)}isChildOf(t){const e=this.z-t.z;return e>0&&t.x===this.x>>e&&t.y===this.y>>e}getTilePoint(t){const e=Math.pow(2,this.z);return new n((t.x*e-this.x)*No,(t.y*e-this.y)*No)}toString(){return`${this.z}/${this.x}/${this.y}`}}class Oc{constructor(t,e){this.wrap=t,this.canonical=e,this.key=Vc(t,e.z,e.z,e.x,e.y)}}class Uc{constructor(t,e,i,r,n){if(t<i)throw new Error(`overscaledZ should be >= z; overscaledZ = ${t}; z = ${i}`);this.overscaledZ=t,this.wrap=e,this.canonical=new Fc(i,+r,+n),this.key=Vc(e,t,i,r,n)}clone(){return new Uc(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(t){return this.overscaledZ===t.overscaledZ&&this.wrap===t.wrap&&this.canonical.equals(t.canonical)}scaledTo(t){if(t>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);const e=this.canonical.z-t;return t>this.canonical.z?new Uc(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Uc(t,this.wrap,t,this.canonical.x>>e,this.canonical.y>>e)}calculateScaledKey(t,e){if(t>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);const i=this.canonical.z-t;return t>this.canonical.z?Vc(this.wrap*+e,t,this.canonical.z,this.canonical.x,this.canonical.y):Vc(this.wrap*+e,t,t,this.canonical.x>>i,this.canonical.y>>i)}isChildOf(t){if(t.wrap!==this.wrap)return!1;const e=this.canonical.z-t.canonical.z;return 0===t.overscaledZ||t.overscaledZ<this.overscaledZ&&t.canonical.x===this.canonical.x>>e&&t.canonical.y===this.canonical.y>>e}children(t){if(this.overscaledZ>=t)return[new Uc(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const e=this.canonical.z+1,i=2*this.canonical.x,r=2*this.canonical.y;return[new Uc(e,this.wrap,e,i,r),new Uc(e,this.wrap,e,i+1,r),new Uc(e,this.wrap,e,i,r+1),new Uc(e,this.wrap,e,i+1,r+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 Uc(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(t){return new Uc(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 Oc(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(t){return this.canonical.getTilePoint(new Rc(t.x-this.wrap,t.y))}}function Vc(t,e,i,r,n){(t*=2)<0&&(t=-1*t-1);const o=1<<i;return(o*o*t+o*n+r).toString(36)+i.toString(36)+e.toString(36)}Sr("CanonicalTileID",Fc),Sr("OverscaledTileID",Uc,{omit:["posMatrix"]});class Nc{constructor(t,e,i){if(this.uid=t,e.height!==e.width)throw new RangeError("DEM tiles must be square");if(i&&"mapbox"!==i&&"terrarium"!==i)return void x(`"${i}" is not a valid encoding type. Valid types include "mapbox" and "terrarium".`);this.stride=e.height;const r=this.dim=e.height-2;this.data=new Uint32Array(e.data.buffer),this.encoding=i||"mapbox";for(let t=0;t<r;t++)this.data[this._idx(-1,t)]=this.data[this._idx(0,t)],this.data[this._idx(r,t)]=this.data[this._idx(r-1,t)],this.data[this._idx(t,-1)]=this.data[this._idx(t,0)],this.data[this._idx(t,r)]=this.data[this._idx(t,r-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(r,-1)]=this.data[this._idx(r-1,0)],this.data[this._idx(-1,r)]=this.data[this._idx(0,r-1)],this.data[this._idx(r,r)]=this.data[this._idx(r-1,r-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let t=0;t<r;t++)for(let e=0;e<r;e++){const i=this.get(t,e);i>this.max&&(this.max=i),i<this.min&&(this.min=i)}}get(t,e){const i=new Uint8Array(this.data.buffer),r=4*this._idx(t,e);return("terrarium"===this.encoding?this._unpackTerrarium:this._unpackMapbox)(i[r],i[r+1],i[r+2])}getUnpackVector(){return"terrarium"===this.encoding?[256,1,1/256,32768]:[6553.6,25.6,.1,1e4]}_idx(t,e){if(t<-1||t>=this.dim+1||e<-1||e>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(e+1)*this.stride+(t+1)}_unpackMapbox(t,e,i){return(256*t*256+256*e+i)/10-1e4}_unpackTerrarium(t,e,i){return 256*t+e+i/256-32768}getPixels(){return new Ca({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(t,e,i){if(this.dim!==t.dim)throw new Error("dem dimension mismatch");let r=e*this.dim,n=e*this.dim+this.dim,o=i*this.dim,a=i*this.dim+this.dim;switch(e){case-1:r=n-1;break;case 1:n=r+1}switch(i){case-1:o=a-1;break;case 1:a=o+1}const s=-e*this.dim,l=-i*this.dim;for(let e=o;e<a;e++)for(let i=r;i<n;i++)this.data[this._idx(i,e)]=t.data[this._idx(i+s,e+l)]}}Sr("DEMData",Nc);class $c{constructor(t){this._stringToNumber={},this._numberToString=[];for(let e=0;e<t.length;e++){const i=t[e];this._stringToNumber[i]=e,this._numberToString[e]=i}}encode(t){return this._stringToNumber[t]}decode(t){if(t>=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${t} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[t]}}class jc{constructor(t,e,i,r,n){this.type="Feature",this._vectorTileFeature=t,t._z=e,t._x=i,t._y=r,this.properties=t.properties,this.id=n}get geometry(){return void 0===this._geometry&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(t){this._geometry=t}toJSON(){const t={geometry:this.geometry};for(const e in this)"_geometry"!==e&&"_vectorTileFeature"!==e&&(t[e]=this[e]);return t}}class qc{constructor(t,e){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new Er(No,16,0),this.grid3D=new Er(No,16,0),this.featureIndexArray=new Yn,this.promoteId=e}insert(t,e,i,r,n,o){const a=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(i,r,n);const s=o?this.grid3D:this.grid;for(let t=0;t<e.length;t++){const i=e[t],r=[1/0,1/0,-1/0,-1/0];for(let t=0;t<i.length;t++){const e=i[t];r[0]=Math.min(r[0],e.x),r[1]=Math.min(r[1],e.y),r[2]=Math.max(r[2],e.x),r[3]=Math.max(r[3],e.y)}r[0]<No&&r[1]<No&&r[2]>=0&&r[3]>=0&&s.insert(a,r[0],r[1],r[2],r[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new bs.VectorTile(new Dl(this.rawTileData)).layers,this.sourceLayerCoder=new $c(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(t,e,i,r){this.loadVTLayers();const o=t.params||{},a=No/t.tileSize/t.scale,s=Di(o.filter),l=t.queryGeometry,c=t.queryPadding*a,h=Gc(l),u=this.grid.query(h.minX-c,h.minY-c,h.maxX+c,h.maxY+c),p=Gc(t.cameraQueryGeometry),d=this.grid3D.query(p.minX-c,p.minY-c,p.maxX+c,p.maxY+c,((e,i,r,o)=>function(t,e,i,r,o){for(const n of t)if(e<=n.x&&i<=n.y&&r>=n.x&&o>=n.y)return!0;const a=[new n(e,i),new n(e,o),new n(r,o),new n(r,i)];if(t.length>2)for(const e of a)if(ra(t,e))return!0;for(let e=0;e<t.length-1;e++)if(na(t[e],t[e+1],a))return!0;return!1}(t.cameraQueryGeometry,e-c,i-c,r+c,o+c)));for(const t of d)u.push(t);u.sort(Hc);const m={};let f;for(let n=0;n<u.length;n++){const c=u[n];if(c===f)continue;f=c;const h=this.featureIndexArray.get(c);let p=null;this.loadMatchingFeature(m,h.bucketIndex,h.sourceLayerIndex,h.featureIndex,s,o.layers,o.availableImages,e,i,r,((e,i,r)=>(p||(p=qo(e)),i.queryIntersectsFeature(l,e,r,p,this.z,t.transform,a,t.pixelPosMatrix))))}return m}loadMatchingFeature(t,e,i,r,n,o,a,s,l,c,h){const u=this.bucketLayerIDs[e];if(o&&!function(t,e){for(let i=0;i<t.length;i++)if(e.indexOf(t[i])>=0)return!0;return!1}(o,u))return;const d=this.sourceLayerCoder.decode(i),m=this.vtLayers[d].feature(r);if(n.needGeometry){const t=Zo(m,!0);if(!n.filter(new Yr(this.tileID.overscaledZ),t,this.tileID.canonical))return}else if(!n.filter(new Yr(this.tileID.overscaledZ),m))return;const f=this.getId(m,d);for(let e=0;e<u.length;e++){const i=u[e];if(o&&o.indexOf(i)<0)continue;const n=s[i];if(!n)continue;let d={};f&&c&&(d=c.getState(n.sourceLayer||"_geojsonTileLayer",f));const g=p({},l[i]);g.paint=Zc(g.paint,n.paint,m,d,a),g.layout=Zc(g.layout,n.layout,m,d,a);const _=!h||h(m,n,d);if(!_)continue;const y=new jc(m,this.z,this.x,this.y,f);y.layer=g;let x=t[i];void 0===x&&(x=t[i]=[]),x.push({featureIndex:r,feature:y,intersectionZ:_})}}lookupSymbolFeatures(t,e,i,r,n,o,a,s){const l={};this.loadVTLayers();const c=Di(n);for(const n of t)this.loadMatchingFeature(l,i,r,n,c,o,a,s,e);return l}hasLayer(t){for(const e of this.bucketLayerIDs)for(const i of e)if(t===i)return!0;return!1}getId(t,e){let i=t.id;return this.promoteId&&(i=t.properties["string"==typeof this.promoteId?this.promoteId:this.promoteId[e]],"boolean"==typeof i&&(i=Number(i))),i}}function Zc(t,e,i,r,n){return f(t,((t,o)=>{const a=e instanceof an?e.get(o):null;return a&&a.evaluate?a.evaluate(i,r,n):a}))}function Gc(t){let e=1/0,i=1/0,r=-1/0,n=-1/0;for(const o of t)e=Math.min(e,o.x),i=Math.min(i,o.y),r=Math.max(r,o.x),n=Math.max(n,o.y);return{minX:e,minY:i,maxX:r,maxY:n}}function Hc(t,e){return e-t}function Xc(t,e,i,r,o){const a=[];for(let s=0;s<t.length;s++){const l=t[s];let c;for(let t=0;t<l.length-1;t++){let s=l[t],h=l[t+1];s.x<e&&h.x<e||(s.x<e?s=new n(e,s.y+(e-s.x)/(h.x-s.x)*(h.y-s.y))._round():h.x<e&&(h=new n(e,s.y+(e-s.x)/(h.x-s.x)*(h.y-s.y))._round()),s.y<i&&h.y<i||(s.y<i?s=new n(s.x+(i-s.y)/(h.y-s.y)*(h.x-s.x),i)._round():h.y<i&&(h=new n(s.x+(i-s.y)/(h.y-s.y)*(h.x-s.x),i)._round()),s.x>=r&&h.x>=r||(s.x>=r?s=new n(r,s.y+(r-s.x)/(h.x-s.x)*(h.y-s.y))._round():h.x>=r&&(h=new n(r,s.y+(r-s.x)/(h.x-s.x)*(h.y-s.y))._round()),s.y>=o&&h.y>=o||(s.y>=o?s=new n(s.x+(o-s.y)/(h.y-s.y)*(h.x-s.x),o)._round():h.y>=o&&(h=new n(s.x+(o-s.y)/(h.y-s.y)*(h.x-s.x),o)._round()),c&&s.equals(c[c.length-1])||(c=[s],a.push(c)),c.push(h)))))}}return a}Sr("FeatureIndex",qc,{omit:["rawTileData","sourceLayerCoder"]});class Wc extends n{constructor(t,e,i,r){super(t,e),this.angle=i,void 0!==r&&(this.segment=r)}clone(){return new Wc(this.x,this.y,this.angle,this.segment)}}function Kc(t,e,i,r,n){if(void 0===e.segment)return!0;let o=e,a=e.segment+1,s=0;for(;s>-i/2;){if(a--,a<0)return!1;s-=t[a].dist(o),o=t[a]}s+=t[a].dist(t[a+1]),a++;const l=[];let c=0;for(;s<i/2;){const e=t[a],i=t[a+1];if(!i)return!1;let o=t[a-1].angleTo(e)-e.angleTo(i);for(o=Math.abs((o+3*Math.PI)%(2*Math.PI)-Math.PI),l.push({distance:s,angleDelta:o}),c+=o;s-l[0].distance>r;)c-=l.shift().angleDelta;if(c>n)return!1;a++,s+=e.dist(i)}return!0}function Yc(t){let e=0;for(let i=0;i<t.length-1;i++)e+=t[i].dist(t[i+1]);return e}function Jc(t,e,i){return t?.6*e*i:0}function Qc(t,e){return Math.max(t?t.right-t.left:0,e?e.right-e.left:0)}function th(t,e,i,r,n,o){const a=Jc(i,n,o),s=Qc(i,r)*o;let l=0;const c=Yc(t)/2;for(let i=0;i<t.length-1;i++){const r=t[i],n=t[i+1],o=r.dist(n);if(l+o>c){const h=(c-l)/o,u=Re.number(r.x,n.x,h),p=Re.number(r.y,n.y,h),d=new Wc(u,p,n.angleTo(r),i);return d._round(),!a||Kc(t,d,s,a,e)?d:void 0}l+=o}}function eh(t,e,i,r,n,o,a,s,l){const c=Jc(r,o,a),h=Qc(r,n),u=h*a,p=0===t[0].x||t[0].x===l||0===t[0].y||t[0].y===l;return e-u<e/4&&(e=u+e/4),ih(t,p?e/2*s%e:(h/2+2*o)*a*s%e,e,c,i,u,p,!1,l)}function ih(t,e,i,r,n,o,a,s,l){const c=o/2,h=Yc(t);let u=0,p=e-i,d=[];for(let e=0;e<t.length-1;e++){const a=t[e],s=t[e+1],m=a.dist(s),f=s.angleTo(a);for(;p+i<u+m;){p+=i;const g=(p-u)/m,_=Re.number(a.x,s.x,g),y=Re.number(a.y,s.y,g);if(_>=0&&_<l&&y>=0&&y<l&&p-c>=0&&p+c<=h){const i=new Wc(_,y,f,e);i._round(),r&&!Kc(t,i,o,r,n)||d.push(i)}}u+=m}return s||d.length||a||(d=ih(t,u/2,i,r,n,o,a,!0,l)),d}function rh(t,e,i,r){const o=[],a=t.image,s=a.pixelRatio,l=a.paddedRect.w-2,c=a.paddedRect.h-2,h=t.right-t.left,u=t.bottom-t.top,p=a.stretchX||[[0,l]],d=a.stretchY||[[0,c]],m=(t,e)=>t+e[1]-e[0],f=p.reduce(m,0),g=d.reduce(m,0),_=l-f,y=c-g;let x=0,v=f,b=0,w=g,E=0,T=_,S=0,C=y;if(a.content&&r){const t=a.content;x=nh(p,0,t[0]),b=nh(d,0,t[1]),v=nh(p,t[0],t[2]),w=nh(d,t[1],t[3]),E=t[0]-x,S=t[1]-b,T=t[2]-t[0]-v,C=t[3]-t[1]-w}const I=(r,o,l,c)=>{const p=ah(r.stretch-x,v,h,t.left),d=sh(r.fixed-E,T,r.stretch,f),m=ah(o.stretch-b,w,u,t.top),_=sh(o.fixed-S,C,o.stretch,g),y=ah(l.stretch-x,v,h,t.left),I=sh(l.fixed-E,T,l.stretch,f),A=ah(c.stretch-b,w,u,t.top),M=sh(c.fixed-S,C,c.stretch,g),k=new n(p,m),z=new n(y,m),P=new n(y,A),L=new n(p,A),D=new n(d/s,_/s),R=new n(I/s,M/s),B=e*Math.PI/180;if(B){const t=Math.sin(B),e=Math.cos(B),i=[e,-t,t,e];k._matMult(i),z._matMult(i),L._matMult(i),P._matMult(i)}const F=r.stretch+r.fixed,O=o.stretch+o.fixed;return{tl:k,tr:z,bl:L,br:P,tex:{x:a.paddedRect.x+1+F,y:a.paddedRect.y+1+O,w:l.stretch+l.fixed-F,h:c.stretch+c.fixed-O},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:D,pixelOffsetBR:R,minFontScaleX:T/s/h,minFontScaleY:C/s/u,isSDF:i}};if(r&&(a.stretchX||a.stretchY)){const t=oh(p,_,f),e=oh(d,y,g);for(let i=0;i<t.length-1;i++){const r=t[i],n=t[i+1];for(let t=0;t<e.length-1;t++)o.push(I(r,e[t],n,e[t+1]))}}else o.push(I({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:l+1},{fixed:0,stretch:c+1}));return o}function nh(t,e,i){let r=0;for(const n of t)r+=Math.max(e,Math.min(i,n[1]))-Math.max(e,Math.min(i,n[0]));return r}function oh(t,e,i){const r=[{fixed:-1,stretch:0}];for(const[e,i]of t){const t=r[r.length-1];r.push({fixed:e-t.stretch,stretch:t.stretch}),r.push({fixed:e-t.stretch,stretch:t.stretch+(i-e)})}return r.push({fixed:e+1,stretch:i}),r}function ah(t,e,i,r){return t/e*i+r}function sh(t,e,i,r){return t-e*i/r}Sr("Anchor",Wc);class lh{constructor(t,e,i,r,o,a,s,l,c,h){if(this.boxStartIndex=t.length,c){let t=a.top,e=a.bottom;const i=a.collisionPadding;i&&(t-=i[1],e+=i[3]);let r=e-t;r>0&&(r=Math.max(10,r),this.circleDiameter=r)}else{let c=a.top*s-l[0],u=a.bottom*s+l[2],p=a.left*s-l[3],d=a.right*s+l[1];const m=a.collisionPadding;if(m&&(p-=m[0]*s,c-=m[1]*s,d+=m[2]*s,u+=m[3]*s),h){const t=new n(p,c),e=new n(d,c),i=new n(p,u),r=new n(d,u),o=h*Math.PI/180;t._rotate(o),e._rotate(o),i._rotate(o),r._rotate(o),p=Math.min(t.x,e.x,i.x,r.x),d=Math.max(t.x,e.x,i.x,r.x),c=Math.min(t.y,e.y,i.y,r.y),u=Math.max(t.y,e.y,i.y,r.y)}t.emplaceBack(e.x,e.y,p,c,d,u,i,r,o)}this.boxEndIndex=t.length}}class ch{constructor(t=[],e=hh){if(this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(let t=(this.length>>1)-1;t>=0;t--)this._down(t)}push(t){this.data.push(t),this.length++,this._up(this.length-1)}pop(){if(0===this.length)return;const t=this.data[0],e=this.data.pop();return this.length--,this.length>0&&(this.data[0]=e,this._down(0)),t}peek(){return this.data[0]}_up(t){const{data:e,compare:i}=this,r=e[t];for(;t>0;){const n=t-1>>1,o=e[n];if(i(r,o)>=0)break;e[t]=o,t=n}e[t]=r}_down(t){const{data:e,compare:i}=this,r=this.length>>1,n=e[t];for(;t<r;){let r=1+(t<<1),o=e[r];const a=r+1;if(a<this.length&&i(e[a],o)<0&&(r=a,o=e[a]),i(o,n)>=0)break;e[t]=o,t=r}e[t]=n}}function hh(t,e){return t<e?-1:t>e?1:0}function uh(t,e=1,i=!1){let r=1/0,o=1/0,a=-1/0,s=-1/0;const l=t[0];for(let t=0;t<l.length;t++){const e=l[t];(!t||e.x<r)&&(r=e.x),(!t||e.y<o)&&(o=e.y),(!t||e.x>a)&&(a=e.x),(!t||e.y>s)&&(s=e.y)}const c=Math.min(a-r,s-o);let h=c/2;const u=new ch([],ph);if(0===c)return new n(r,o);for(let e=r;e<a;e+=c)for(let i=o;i<s;i+=c)u.push(new dh(e+h,i+h,h,t));let p=function(t){let e=0,i=0,r=0;const n=t[0];for(let t=0,o=n.length,a=o-1;t<o;a=t++){const o=n[t],s=n[a],l=o.x*s.y-s.x*o.y;i+=(o.x+s.x)*l,r+=(o.y+s.y)*l,e+=3*l}return new dh(i/e,r/e,0,t)}(t),d=u.length;for(;u.length;){const r=u.pop();(r.d>p.d||!p.d)&&(p=r,i&&console.log("found best %d after %d probes",Math.round(1e4*r.d)/1e4,d)),r.max-p.d<=e||(h=r.h/2,u.push(new dh(r.p.x-h,r.p.y-h,h,t)),u.push(new dh(r.p.x+h,r.p.y-h,h,t)),u.push(new dh(r.p.x-h,r.p.y+h,h,t)),u.push(new dh(r.p.x+h,r.p.y+h,h,t)),d+=4)}return i&&(console.log(`num probes: ${d}`),console.log(`best distance: ${p.d}`)),p.p}function ph(t,e){return e.max-t.max}function dh(t,e,i,r){this.p=new n(t,e),this.h=i,this.d=function(t,e){let i=!1,r=1/0;for(let n=0;n<e.length;n++){const o=e[n];for(let e=0,n=o.length,a=n-1;e<n;a=e++){const n=o[e],s=o[a];n.y>t.y!=s.y>t.y&&t.x<(s.x-n.x)*(t.y-n.y)/(s.y-n.y)+n.x&&(i=!i),r=Math.min(r,ea(t,n,s))}}return(i?1:-1)*Math.sqrt(r)}(this.p,r),this.max=this.d+this.h*Math.SQRT2}const mh=Number.POSITIVE_INFINITY;function fh(t,e){return e[1]!==mh?function(t,e,i){let r=0,n=0;switch(e=Math.abs(e),i=Math.abs(i),t){case"top-right":case"top-left":case"top":n=i-7;break;case"bottom-right":case"bottom-left":case"bottom":n=7-i}switch(t){case"top-right":case"bottom-right":case"right":r=-e;break;case"top-left":case"bottom-left":case"left":r=e}return[r,n]}(t,e[0],e[1]):function(t,e){let i=0,r=0;e<0&&(e=0);const n=e/Math.sqrt(2);switch(t){case"top-right":case"top-left":r=n-7;break;case"bottom-right":case"bottom-left":r=7-n;break;case"bottom":r=7-e;break;case"top":r=e-7}switch(t){case"top-right":case"bottom-right":i=-n;break;case"top-left":case"bottom-left":i=n;break;case"left":i=e;break;case"right":i=-e}return[i,r]}(t,e[0])}function gh(t){switch(t){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function _h(e,i,r,n,o,a,s,l,c,h,u){let p=a.textMaxSize.evaluate(i,{});void 0===p&&(p=s);const d=e.layers[0].layout,m=d.get("icon-offset").evaluate(i,{},u),f=xh(r.horizontal),g=s/24,_=e.tilePixelRatio*g,y=e.tilePixelRatio*p/24,v=e.tilePixelRatio*l,b=e.tilePixelRatio*d.get("symbol-spacing"),w=d.get("text-padding")*e.tilePixelRatio,E=function(t,e,i,r=1){const n=t.get("icon-padding").evaluate(e,{},i),o=n&&n.values;return[o[0]*r,o[1]*r,o[2]*r,o[3]*r]}(d,i,u,e.tilePixelRatio),T=d.get("text-max-angle")/180*Math.PI,S="viewport"!==d.get("text-rotation-alignment")&&"point"!==d.get("symbol-placement"),C="map"===d.get("icon-rotation-alignment")&&"point"!==d.get("symbol-placement"),I=d.get("symbol-placement"),A=b/2,M=d.get("icon-text-fit");let k;n&&"none"!==M&&(e.allowVerticalPlacement&&r.vertical&&(k=ic(n,r.vertical,M,d.get("icon-text-fit-padding"),m,g)),f&&(n=ic(n,f,M,d.get("icon-text-fit-padding"),m,g)));const z=(l,p)=>{p.x<0||p.x>=No||p.y<0||p.y>=No||function(e,i,r,n,o,a,s,l,c,h,u,p,d,m,f,g,_,y,v,b,w,E,T,S,C){const I=e.addToLineVertexArray(i,r);let A,M,k,z,P=0,L=0,D=0,R=0,B=-1,F=-1;const O={};let U=bo(""),V=0,N=0;if(void 0===l._unevaluatedLayout.getValue("text-radial-offset")?[V,N]=l.layout.get("text-offset").evaluate(w,{},S).map((t=>t*hl)):(V=l.layout.get("text-radial-offset").evaluate(w,{},S)*hl,N=mh),e.allowVerticalPlacement&&n.vertical){const t=l.layout.get("text-rotate").evaluate(w,{},S)+90;k=new lh(c,i,h,u,p,n.vertical,d,m,f,t),s&&(z=new lh(c,i,h,u,p,s,_,y,f,t))}if(o){const r=l.layout.get("icon-rotate").evaluate(w,{}),n="none"!==l.layout.get("icon-text-fit"),a=rh(o,r,T,n),d=s?rh(s,r,T,n):void 0;M=new lh(c,i,h,u,p,o,_,y,!1,r),P=4*a.length;const m=e.iconSizeData;let f=null;"source"===m.kind?(f=[rc*l.layout.get("icon-size").evaluate(w,{})],f[0]>nc&&x(`${e.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)):"composite"===m.kind&&(f=[rc*E.compositeIconSizes[0].evaluate(w,{},S),rc*E.compositeIconSizes[1].evaluate(w,{},S)],(f[0]>nc||f[1]>nc)&&x(`${e.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)),e.addSymbols(e.icon,a,f,b,v,w,t.WritingMode.none,i,I.lineStartIndex,I.lineLength,-1,S),B=e.icon.placedSymbolArray.length-1,d&&(L=4*d.length,e.addSymbols(e.icon,d,f,b,v,w,t.WritingMode.vertical,i,I.lineStartIndex,I.lineLength,-1,S),F=e.icon.placedSymbolArray.length-1)}const $=Object.keys(n.horizontal);for(const r of $){const o=n.horizontal[r];if(!A){U=bo(o.text);const t=l.layout.get("text-rotate").evaluate(w,{},S);A=new lh(c,i,h,u,p,o,d,m,f,t)}const s=1===o.positionedLines.length;if(D+=yh(e,i,o,a,l,f,w,g,I,n.vertical?t.WritingMode.horizontal:t.WritingMode.horizontalOnly,s?$:[r],O,B,E,S),s)break}n.vertical&&(R+=yh(e,i,n.vertical,a,l,f,w,g,I,t.WritingMode.vertical,["vertical"],O,F,E,S));const j=A?A.boxStartIndex:e.collisionBoxArray.length,q=A?A.boxEndIndex:e.collisionBoxArray.length,Z=k?k.boxStartIndex:e.collisionBoxArray.length,G=k?k.boxEndIndex:e.collisionBoxArray.length,H=M?M.boxStartIndex:e.collisionBoxArray.length,X=M?M.boxEndIndex:e.collisionBoxArray.length,W=z?z.boxStartIndex:e.collisionBoxArray.length,K=z?z.boxEndIndex:e.collisionBoxArray.length;let Y=-1;const J=(t,e)=>t&&t.circleDiameter?Math.max(t.circleDiameter,e):e;Y=J(A,Y),Y=J(k,Y),Y=J(M,Y),Y=J(z,Y);const Q=Y>-1?1:0;Q&&(Y*=C/hl),e.glyphOffsetArray.length>=mc.MAX_GLYPHS&&x("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==w.sortKey&&e.addToSortKeyRanges(e.symbolInstances.length,w.sortKey),e.symbolInstances.emplaceBack(i.x,i.y,O.right>=0?O.right:-1,O.center>=0?O.center:-1,O.left>=0?O.left:-1,O.vertical||-1,B,F,U,j,q,Z,G,H,X,W,K,h,D,R,P,L,Q,0,d,V,N,Y)}(e,p,l,r,n,o,k,e.layers[0],e.collisionBoxArray,i.index,i.sourceLayerIndex,e.index,_,[w,w,w,w],S,c,v,E,C,m,i,a,h,u,s)};if("line"===I)for(const t of Xc(i.geometry,0,0,No,No)){const i=eh(t,b,T,r.vertical||f,n,24,y,e.overscaling,No);for(const r of i)f&&vh(e,f.text,A,r)||z(t,r)}else if("line-center"===I){for(const t of i.geometry)if(t.length>1){const e=th(t,T,r.vertical||f,n,24,y);e&&z(t,e)}}else if("Polygon"===i.type)for(const t of hs(i.geometry,0)){const e=uh(t,16);z(t[0],new Wc(e.x,e.y,0))}else if("LineString"===i.type)for(const t of i.geometry)z(t,new Wc(t[0].x,t[0].y,0));else if("Point"===i.type)for(const t of i.geometry)for(const e of t)z([e],new Wc(e.x,e.y,0))}function yh(t,e,i,r,o,a,s,l,c,h,u,p,d,m,f){const g=function(t,e,i,r,o,a,s,l){const c=r.layout.get("text-rotate").evaluate(a,{})*Math.PI/180,h=[];for(const t of e.positionedLines)for(const r of t.positionedGlyphs){if(!r.rect)continue;const a=r.rect||{};let u=4,p=!0,d=1,m=0;const f=(o||l)&&r.vertical,g=r.metrics.advance*r.scale/2;if(l&&e.verticalizable&&(m=t.lineOffset/2-(r.imageName?-(hl-r.metrics.width*r.scale)/2:(r.scale-1)*hl)),r.imageName){const t=s[r.imageName];p=t.sdf,d=t.pixelRatio,u=1/d}const _=o?[r.x+g,r.y]:[0,0];let y=o?[0,0]:[r.x+g+i[0],r.y+i[1]-m],x=[0,0];f&&(x=y,y=[0,0]);const v=(r.metrics.left-u)*r.scale-g+y[0],b=(-r.metrics.top-u)*r.scale+y[1],w=v+a.w*r.scale/d,E=b+a.h*r.scale/d,T=new n(v,b),S=new n(w,b),C=new n(v,E),I=new n(w,E);if(f){const t=new n(-g,g-Nl),e=-Math.PI/2,i=12-g,o=new n(22-i,-(r.imageName?i:0)),a=new n(...x);T._rotateAround(e,t)._add(o)._add(a),S._rotateAround(e,t)._add(o)._add(a),C._rotateAround(e,t)._add(o)._add(a),I._rotateAround(e,t)._add(o)._add(a)}if(c){const t=Math.sin(c),e=Math.cos(c),i=[e,-t,t,e];T._matMult(i),S._matMult(i),C._matMult(i),I._matMult(i)}const A=new n(0,0),M=new n(0,0);h.push({tl:T,tr:S,bl:C,br:I,tex:a,writingMode:e.writingMode,glyphOffset:_,sectionIndex:r.sectionIndex,isSDF:p,pixelOffsetTL:A,pixelOffsetBR:M,minFontScaleX:0,minFontScaleY:0})}return h}(0,i,l,o,a,s,r,t.allowVerticalPlacement),_=t.textSizeData;let y=null;"source"===_.kind?(y=[rc*o.layout.get("text-size").evaluate(s,{})],y[0]>nc&&x(`${t.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)):"composite"===_.kind&&(y=[rc*m.compositeTextSizes[0].evaluate(s,{},f),rc*m.compositeTextSizes[1].evaluate(s,{},f)],(y[0]>nc||y[1]>nc)&&x(`${t.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)),t.addSymbols(t.text,g,y,l,a,s,h,e,c.lineStartIndex,c.lineLength,d,f);for(const e of u)p[e]=t.text.placedSymbolArray.length-1;return 4*g.length}function xh(t){for(const e in t)return t[e];return null}function vh(t,e,i,r){const n=t.compareText;if(e in n){const t=n[e];for(let e=t.length-1;e>=0;e--)if(r.dist(t[e])<i)return!0}else n[e]=[];return n[e].push(r),!1}const bh=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class wh{static from(t){if(!(t instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[e,i]=new Uint8Array(t,0,2);if(219!==e)throw new Error("Data does not appear to be in a KDBush format.");const r=i>>4;if(1!==r)throw new Error(`Got v${r} data when expected v1.`);const n=bh[15&i];if(!n)throw new Error("Unrecognized array type.");const[o]=new Uint16Array(t,2,1),[a]=new Uint32Array(t,4,1);return new wh(a,o,n,t)}constructor(t,e=64,i=Float64Array,r){if(isNaN(t)||t<0)throw new Error(`Unpexpected numItems value: ${t}.`);this.numItems=+t,this.nodeSize=Math.min(Math.max(+e,2),65535),this.ArrayType=i,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;const n=bh.indexOf(this.ArrayType),o=2*t*this.ArrayType.BYTES_PER_ELEMENT,a=t*this.IndexArrayType.BYTES_PER_ELEMENT,s=(8-a%8)%8;if(n<0)throw new Error(`Unexpected typed array class: ${i}.`);r&&r instanceof ArrayBuffer?(this.data=r,this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+a+s,2*t),this._pos=2*t,this._finished=!0):(this.data=new ArrayBuffer(8+o+a+s),this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+a+s,2*t),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+n]),new Uint16Array(this.data,2,1)[0]=e,new Uint32Array(this.data,4,1)[0]=t)}add(t,e){const i=this._pos>>1;return this.ids[i]=i,this.coords[this._pos++]=t,this.coords[this._pos++]=e,i}finish(){const t=this._pos>>1;if(t!==this.numItems)throw new Error(`Added ${t} items when expected ${this.numItems}.`);return Eh(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,e,i,r){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:n,coords:o,nodeSize:a}=this,s=[0,n.length-1,0],l=[];for(;s.length;){const c=s.pop()||0,h=s.pop()||0,u=s.pop()||0;if(h-u<=a){for(let a=u;a<=h;a++){const s=o[2*a],c=o[2*a+1];s>=t&&s<=i&&c>=e&&c<=r&&l.push(n[a])}continue}const p=u+h>>1,d=o[2*p],m=o[2*p+1];d>=t&&d<=i&&m>=e&&m<=r&&l.push(n[p]),(0===c?t<=d:e<=m)&&(s.push(u),s.push(p-1),s.push(1-c)),(0===c?i>=d:r>=m)&&(s.push(p+1),s.push(h),s.push(1-c))}return l}within(t,e,i){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:r,coords:n,nodeSize:o}=this,a=[0,r.length-1,0],s=[],l=i*i;for(;a.length;){const c=a.pop()||0,h=a.pop()||0,u=a.pop()||0;if(h-u<=o){for(let i=u;i<=h;i++)Ih(n[2*i],n[2*i+1],t,e)<=l&&s.push(r[i]);continue}const p=u+h>>1,d=n[2*p],m=n[2*p+1];Ih(d,m,t,e)<=l&&s.push(r[p]),(0===c?t-i<=d:e-i<=m)&&(a.push(u),a.push(p-1),a.push(1-c)),(0===c?t+i>=d:e+i>=m)&&(a.push(p+1),a.push(h),a.push(1-c))}return s}}function Eh(t,e,i,r,n,o){if(n-r<=i)return;const a=r+n>>1;Th(t,e,a,r,n,o),Eh(t,e,i,r,a-1,1-o),Eh(t,e,i,a+1,n,1-o)}function Th(t,e,i,r,n,o){for(;n>r;){if(n-r>600){const a=n-r+1,s=i-r+1,l=Math.log(a),c=.5*Math.exp(2*l/3),h=.5*Math.sqrt(l*c*(a-c)/a)*(s-a/2<0?-1:1);Th(t,e,i,Math.max(r,Math.floor(i-s*c/a+h)),Math.min(n,Math.floor(i+(a-s)*c/a+h)),o)}const a=e[2*i+o];let s=r,l=n;for(Sh(t,e,r,i),e[2*n+o]>a&&Sh(t,e,r,n);s<l;){for(Sh(t,e,s,l),s++,l--;e[2*s+o]<a;)s++;for(;e[2*l+o]>a;)l--}e[2*r+o]===a?Sh(t,e,r,l):(l++,Sh(t,e,l,n)),l<=i&&(r=l+1),i<=l&&(n=l-1)}}function Sh(t,e,i,r){Ch(t,i,r),Ch(e,2*i,2*r),Ch(e,2*i+1,2*r+1)}function Ch(t,e,i){const r=t[e];t[e]=t[i],t[i]=r}function Ih(t,e,i,r){const n=t-i,o=e-r;return n*n+o*o}var Ah;t.PerformanceMarkers=void 0,(Ah=t.PerformanceMarkers||(t.PerformanceMarkers={})).create="create",Ah.load="load",Ah.fullLoad="fullLoad";let Mh=null,kh=[];const zh=1e3/60,Ph="loadTime",Lh="fullLoadTime",Dh={mark(t){performance.mark(t)},frame(t){const e=t;null!=Mh&&kh.push(e-Mh),Mh=e},clearMetrics(){Mh=null,kh=[],performance.clearMeasures(Ph),performance.clearMeasures(Lh);for(const e in t.PerformanceMarkers)performance.clearMarks(t.PerformanceMarkers[e])},getPerformanceMetrics(){performance.measure(Ph,t.PerformanceMarkers.create,t.PerformanceMarkers.load),performance.measure(Lh,t.PerformanceMarkers.create,t.PerformanceMarkers.fullLoad);const e=performance.getEntriesByName(Ph)[0].duration,i=performance.getEntriesByName(Lh)[0].duration,r=kh.length,n=1/(kh.reduce(((t,e)=>t+e),0)/r/1e3),o=kh.filter((t=>t>zh)).reduce(((t,e)=>t+(e-zh)/zh),0);return{loadTime:e,fullLoadTime:i,fps:n,percentDroppedFrames:o/(r+o)*100,totalFrames:r}}};t.AJAXError=z,t.ARRAY_TYPE=pa,t.Actor=class{constructor(t,e,i){this.target=t,this.parent=e,this.mapId=i,this.callbacks={},this.tasks={},this.taskQueue=[],this.cancelCallbacks={},m(["receive","process"],this),this.invoker=new Cc(this.process),this.target.addEventListener("message",this.receive,!1),this.globalScope=w()?t:window}send(t,e,i,r,n=!1){const o=Math.round(1e18*Math.random()).toString(36).substring(0,10);i&&(this.callbacks[o]=i);const a=T(this.globalScope)?void 0:[];return this.target.postMessage({id:o,type:t,hasCallback:!!i,targetMapId:r,mustQueue:n,sourceMapId:this.mapId,data:Ir(e,a)},a),{cancel:()=>{i&&delete this.callbacks[o],this.target.postMessage({id:o,type:"<cancel>",targetMapId:r,sourceMapId:this.mapId})}}}receive(t){const e=t.data,i=e.id;if(i&&(!e.targetMapId||this.mapId===e.targetMapId))if("<cancel>"===e.type){delete this.tasks[i];const t=this.cancelCallbacks[i];delete this.cancelCallbacks[i],t&&t()}else w()||e.mustQueue?(this.tasks[i]=e,this.taskQueue.push(i),this.invoker.trigger()):this.processTask(i,e)}process(){if(!this.taskQueue.length)return;const t=this.taskQueue.shift(),e=this.tasks[t];delete this.tasks[t],this.taskQueue.length&&this.invoker.trigger(),e&&this.processTask(t,e)}processTask(t,e){if("<response>"===e.type){const i=this.callbacks[t];delete this.callbacks[t],i&&(e.error?i(Ar(e.error)):i(null,Ar(e.data)))}else{let i=!1;const r=T(this.globalScope)?void 0:[],n=e.hasCallback?(e,n)=>{i=!0,delete this.cancelCallbacks[t],this.target.postMessage({id:t,type:"<response>",sourceMapId:this.mapId,error:e?Ir(e):null,data:Ir(n,r)},r)}:t=>{i=!0};let o=null;const a=Ar(e.data);if(this.parent[e.type])o=this.parent[e.type](e.sourceMapId,a,n);else if(this.parent.getWorkerSource){const t=e.type.split(".");o=this.parent.getWorkerSource(e.sourceMapId,t[0],a.source)[t[1]](a,n)}else n(new Error(`Could not find function ${e.type}`));!i&&o&&o.cancel&&(this.cancelCallbacks[t]=o.cancel)}}remove(){this.invoker.remove(),this.target.removeEventListener("message",this.receive,!1)}},t.AlphaImage=Sa,t.CanonicalTileID=Fc,t.CollisionBoxArray=jn,t.CollisionCircleLayoutArray=class extends Pn{},t.Color=$t,t.DEMData=Nc,t.DataConstantProperty=sn,t.DictionaryCoder=$c,t.EXTENT=No,t.ErrorEvent=N,t.EvaluationParameters=Yr,t.Event=V,t.Evented=$,t.FeatureIndex=qc,t.FillBucket=ms,t.FillExtrusionBucket=Bs,t.GeoJSONFeature=jc,t.ImageAtlas=Vl,t.ImagePosition=Ul,t.KDBush=wh,t.LineBucket=Ks,t.LineStripIndexArray=class extends Vn{},t.LngLat=Ac,t.MercatorCoordinate=Rc,t.ONE_EM=hl,t.OverscaledTileID=Uc,t.PerformanceUtils=Dh,t.Point=n,t.Pos3dArray=class extends bn{},t.PosArray=Jn,t.Properties=pn,t.Protobuf=Dl,t.QuadTriangleArray=class extends Dn{},t.RGBAImage=Ca,t.RasterBoundsArray=class extends wn{},t.RequestPerformance=class{constructor(t){this._marks={start:[t.url,"start"].join("#"),end:[t.url,"end"].join("#"),measure:t.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let t=performance.getEntriesByName(this._marks.measure);return 0===t.length&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),t=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),t}},t.SegmentVector=fo,t.SymbolBucket=mc,t.Transitionable=tn,t.TriangleIndexArray=ho,t.Uniform1f=Io,t.Uniform1i=class extends Co{constructor(t,e){super(t,e),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1i(this.location,t))}},t.Uniform2f=class extends Co{constructor(t,e){super(t,e),this.current=[0,0]}set(t){t[0]===this.current[0]&&t[1]===this.current[1]||(this.current=t,this.gl.uniform2f(this.location,t[0],t[1]))}},t.Uniform3f=class extends Co{constructor(t,e){super(t,e),this.current=[0,0,0]}set(t){t[0]===this.current[0]&&t[1]===this.current[1]&&t[2]===this.current[2]||(this.current=t,this.gl.uniform3f(this.location,t[0],t[1],t[2]))}},t.Uniform4f=Ao,t.UniformColor=Mo,t.UniformMatrix4f=class extends Co{constructor(t,e){super(t,e),this.current=ko}set(t){if(t[12]!==this.current[12]||t[0]!==this.current[0])return this.current=t,void this.gl.uniformMatrix4fv(this.location,!1,t);for(let e=1;e<16;e++)if(t[e]!==this.current[e]){this.current=t,this.gl.uniformMatrix4fv(this.location,!1,t);break}}},t.UnwrappedTileID=Oc,t.ValidationError=et,t.ZoomHistory=Mr,t.addDynamicAttributes=hc,t.arrayBufferToImage=function(t,e){const i=new Image;i.onload=()=>{e(null,i),URL.revokeObjectURL(i.src),i.onload=null,window.requestAnimationFrame((()=>{i.src=C}))},i.onerror=()=>e(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const r=new Blob([new Uint8Array(t)],{type:"image/png"});i.src=t.byteLength?URL.createObjectURL(r):C},t.arrayBufferToImageBitmap=function(t,e){const i=new Blob([new Uint8Array(t)],{type:"image/png"});createImageBitmap(i).then((t=>{e(null,t)})).catch((t=>{e(new Error(`Could not load image because of ${t.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))}))},t.asyncAll=function(t,e,i){if(!t.length)return i(null,[]);let r=t.length;const n=new Array(t.length);let o=null;t.forEach(((t,a)=>{e(t,((t,e)=>{t&&(o=t),n[a]=e,0==--r&&i(o,n)}))}))},t.bezier=l,t.bindAll=m,t.clamp=h,t.clipLine=Xc,t.clone=function(t){var e=new pa(16);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},t.clone$1=_,t.collisionCircleLayout=sl,t.config=k,t.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},t.create=function(){var t=new pa(16);return pa!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t},t.createExpression=Ci,t.createFilter=Di,t.createLayout=yn,t.createStyleLayer=function(t){return"custom"===t.type?new Tc(t):new Sc[t.type](t)},t.deepEqual=function t(e,i){if(Array.isArray(e)){if(!Array.isArray(i)||e.length!==i.length)return!1;for(let r=0;r<e.length;r++)if(!t(e[r],i[r]))return!1;return!0}if("object"==typeof e&&null!==e&&null!==i){if("object"!=typeof i)return!1;if(Object.keys(e).length!==Object.keys(i).length)return!1;for(const r in e)if(!t(e[r],i[r]))return!1;return!0}return e===i},t.derefLayers=function(t){t=t.slice();const e=Object.create(null);for(let i=0;i<t.length;i++)e[t[i].id]=t[i];for(let i=0;i<t.length;i++)"ref"in t[i]&&(t[i]=Z(t[i],e[t[i].ref]));return t},t.diffStyles=function(t,e){if(!t)return[{command:H.setStyle,args:[e]}];let i=[];try{if(!G(t.version,e.version))return[{command:H.setStyle,args:[e]}];G(t.center,e.center)||i.push({command:H.setCenter,args:[e.center]}),G(t.zoom,e.zoom)||i.push({command:H.setZoom,args:[e.zoom]}),G(t.bearing,e.bearing)||i.push({command:H.setBearing,args:[e.bearing]}),G(t.pitch,e.pitch)||i.push({command:H.setPitch,args:[e.pitch]}),G(t.sprite,e.sprite)||i.push({command:H.setSprite,args:[e.sprite]}),G(t.glyphs,e.glyphs)||i.push({command:H.setGlyphs,args:[e.glyphs]}),G(t.transition,e.transition)||i.push({command:H.setTransition,args:[e.transition]}),G(t.light,e.light)||i.push({command:H.setLight,args:[e.light]});const r={},n=[];!function(t,e,i,r){let n;for(n in e=e||{},t=t||{})Object.prototype.hasOwnProperty.call(t,n)&&(Object.prototype.hasOwnProperty.call(e,n)||W(n,i,r));for(n in e)Object.prototype.hasOwnProperty.call(e,n)&&(Object.prototype.hasOwnProperty.call(t,n)?G(t[n],e[n])||("geojson"===t[n].type&&"geojson"===e[n].type&&Y(t,e,n)?i.push({command:H.setGeoJSONSourceData,args:[n,e[n].data]}):K(n,e,i,r)):X(n,e,i))}(t.sources,e.sources,n,r);const o=[];t.layers&&t.layers.forEach((t=>{r[t.source]?i.push({command:H.removeLayer,args:[t.id]}):o.push(t)})),i=i.concat(n),function(t,e,i){e=e||[];const r=(t=t||[]).map(Q),n=e.map(Q),o=t.reduce(tt,{}),a=e.reduce(tt,{}),s=r.slice(),l=Object.create(null);let c,h,u,p,d,m,f;for(c=0,h=0;c<r.length;c++)u=r[c],Object.prototype.hasOwnProperty.call(a,u)?h++:(i.push({command:H.removeLayer,args:[u]}),s.splice(s.indexOf(u,h),1));for(c=0,h=0;c<n.length;c++)u=n[n.length-1-c],s[s.length-1-c]!==u&&(Object.prototype.hasOwnProperty.call(o,u)?(i.push({command:H.removeLayer,args:[u]}),s.splice(s.lastIndexOf(u,s.length-h),1)):h++,m=s[s.length-c],i.push({command:H.addLayer,args:[a[u],m]}),s.splice(s.length-c,0,u),l[u]=!0);for(c=0;c<n.length;c++)if(u=n[c],p=o[u],d=a[u],!l[u]&&!G(p,d))if(G(p.source,d.source)&&G(p["source-layer"],d["source-layer"])&&G(p.type,d.type)){for(f in J(p.layout,d.layout,i,u,null,H.setLayoutProperty),J(p.paint,d.paint,i,u,null,H.setPaintProperty),G(p.filter,d.filter)||i.push({command:H.setFilter,args:[u,d.filter]}),G(p.minzoom,d.minzoom)&&G(p.maxzoom,d.maxzoom)||i.push({command:H.setLayerZoomRange,args:[u,d.minzoom,d.maxzoom]}),p)Object.prototype.hasOwnProperty.call(p,f)&&"layout"!==f&&"paint"!==f&&"filter"!==f&&"metadata"!==f&&"minzoom"!==f&&"maxzoom"!==f&&(0===f.indexOf("paint.")?J(p[f],d[f],i,u,f.slice(6),H.setPaintProperty):G(p[f],d[f])||i.push({command:H.setLayerProperty,args:[u,f,d[f]]}));for(f in d)Object.prototype.hasOwnProperty.call(d,f)&&!Object.prototype.hasOwnProperty.call(p,f)&&"layout"!==f&&"paint"!==f&&"filter"!==f&&"metadata"!==f&&"minzoom"!==f&&"maxzoom"!==f&&(0===f.indexOf("paint.")?J(p[f],d[f],i,u,f.slice(6),H.setPaintProperty):G(p[f],d[f])||i.push({command:H.setLayerProperty,args:[u,f,d[f]]}))}else i.push({command:H.removeLayer,args:[u]}),m=s[s.lastIndexOf(u)+1],i.push({command:H.addLayer,args:[d,m]})}(o,e.layers,i)}catch(t){console.warn("Unable to compute style diff:",t),i=[{command:H.setStyle,args:[e]}]}return i},t.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]},t.earthRadius=Ic,t.ease=c,t.emitValidationErrors=wr,t.emptyStyle=function(){const t={},e=j.$version;for(const i in j.$root){const r=j.$root[i];if(r.required){let n=null;n="version"===i?e:"array"===r.type?[]:{},null!=n&&(t[i]=n)}}return t},t.equals=function(t,e){var i=t[0],r=t[1],n=t[2],o=t[3],a=t[4],s=t[5],l=t[6],c=t[7],h=t[8],u=t[9],p=t[10],d=t[11],m=t[12],f=t[13],g=t[14],_=t[15],y=e[0],x=e[1],v=e[2],b=e[3],w=e[4],E=e[5],T=e[6],S=e[7],C=e[8],I=e[9],A=e[10],M=e[11],k=e[12],z=e[13],P=e[14],L=e[15];return Math.abs(i-y)<=ua*Math.max(1,Math.abs(i),Math.abs(y))&&Math.abs(r-x)<=ua*Math.max(1,Math.abs(r),Math.abs(x))&&Math.abs(n-v)<=ua*Math.max(1,Math.abs(n),Math.abs(v))&&Math.abs(o-b)<=ua*Math.max(1,Math.abs(o),Math.abs(b))&&Math.abs(a-w)<=ua*Math.max(1,Math.abs(a),Math.abs(w))&&Math.abs(s-E)<=ua*Math.max(1,Math.abs(s),Math.abs(E))&&Math.abs(l-T)<=ua*Math.max(1,Math.abs(l),Math.abs(T))&&Math.abs(c-S)<=ua*Math.max(1,Math.abs(c),Math.abs(S))&&Math.abs(h-C)<=ua*Math.max(1,Math.abs(h),Math.abs(C))&&Math.abs(u-I)<=ua*Math.max(1,Math.abs(u),Math.abs(I))&&Math.abs(p-A)<=ua*Math.max(1,Math.abs(p),Math.abs(A))&&Math.abs(d-M)<=ua*Math.max(1,Math.abs(d),Math.abs(M))&&Math.abs(m-k)<=ua*Math.max(1,Math.abs(m),Math.abs(k))&&Math.abs(f-z)<=ua*Math.max(1,Math.abs(f),Math.abs(z))&&Math.abs(g-P)<=ua*Math.max(1,Math.abs(g),Math.abs(P))&&Math.abs(_-L)<=ua*Math.max(1,Math.abs(_),Math.abs(L))},t.evaluateSizeForFeature=function(t,{uSize:e,uSizeT:i},{lowerSize:r,upperSize:n}){return"source"===t.kind?r/rc:"composite"===t.kind?Re.number(r/rc,n/rc,i):e},t.evaluateSizeForZoom=function(t,e){let i=0,r=0;if("constant"===t.kind)r=t.layoutSize;else if("source"!==t.kind){const{interpolationType:n,minZoom:o,maxZoom:a}=t,s=n?h(Be.interpolationFactor(n,e,o,a),0,1):0;"camera"===t.kind?r=Re.number(t.minSize,t.maxSize,s):i=s}return{uSizeT:i,uSize:r}},t.evaluateVariableOffset=fh,t.evented=Hr,t.exported=M,t.extend=p,t.filterObject=g,t.findLineIntersection=function(t,e,i,r){const o=e.y-t.y,a=e.x-t.x,s=r.y-i.y,l=r.x-i.x,c=s*a-l*o;if(0===c)return null;const h=(l*(t.y-i.y)-s*(t.x-i.x))/c;return new n(t.x+h*a,t.y+h*o)},t.fromScaling=function(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e[1],t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e[2],t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},t.getAnchorAlignment=Ql,t.getAnchorJustification=gh,t.getArrayBuffer=B,t.getDefaultExportFromCjs=e,t.getJSON=function(t,e){return R(p(t,{type:"json"}),e)},t.getOverlapMode=ac,t.getProtocolAction=L,t.getRTLTextPluginStatus=Xr,t.getReferrer=P,t.getVideo=function(t,e){const i=window.document.createElement("video");i.muted=!0,i.onloadstart=function(){e(null,i)};for(let e=0;e<t.length;e++){const r=window.document.createElement("source");F(t[e])||(i.crossOrigin="Anonymous"),r.src=t[e],i.appendChild(r)}return{cancel:()=>{}}},t.groupByLayout=function(t,e){const i={};for(let r=0;r<t.length;r++){const n=e&&e[t[r].id]||ji(t[r]);e&&(e[t[r].id]=n);let o=i[n];o||(o=i[n]=[]),o.push(t[r])}const r=[];for(const t in i)r.push(i[t]);return r},t.identity=da,t.interpolate=Re,t.invert=function(t,e){var i=e[0],r=e[1],n=e[2],o=e[3],a=e[4],s=e[5],l=e[6],c=e[7],h=e[8],u=e[9],p=e[10],d=e[11],m=e[12],f=e[13],g=e[14],_=e[15],y=i*s-r*a,x=i*l-n*a,v=i*c-o*a,b=r*l-n*s,w=r*c-o*s,E=n*c-o*l,T=h*f-u*m,S=h*g-p*m,C=h*_-d*m,I=u*g-p*f,A=u*_-d*f,M=p*_-d*g,k=y*M-x*A+v*I+b*C-w*S+E*T;return k?(t[0]=(s*M-l*A+c*I)*(k=1/k),t[1]=(n*A-r*M-o*I)*k,t[2]=(f*E-g*w+_*b)*k,t[3]=(p*w-u*E-d*b)*k,t[4]=(l*C-a*M-c*S)*k,t[5]=(i*M-n*C+o*S)*k,t[6]=(g*v-m*E-_*x)*k,t[7]=(h*E-p*v+d*x)*k,t[8]=(a*A-s*C+c*T)*k,t[9]=(r*C-i*A-o*T)*k,t[10]=(m*w-f*v+_*y)*k,t[11]=(u*v-h*w-d*y)*k,t[12]=(s*S-a*I-l*T)*k,t[13]=(i*I-r*S+n*T)*k,t[14]=(f*x-m*b-g*y)*k,t[15]=(h*b-u*x+p*y)*k,t):null},t.isImageBitmap=S,t.isSafari=T,t.isWorker=w,t.keysDifference=function(t,e){const i=[];for(const r in t)r in e||i.push(r);return i},t.lazyLoadRTLTextPlugin=function(){Kr.isLoading()||Kr.isLoaded()||"deferred"!==Xr()||Wr()},t.makeRequest=R,t.mapObject=f,t.mercatorXfromLng=zc,t.mercatorYfromLat=Pc,t.mercatorZfromAltitude=Lc,t.mul=ga,t.mul$1=function(t,e,i){return t[0]=e[0]*i[0],t[1]=e[1]*i[1],t[2]=e[2]*i[2],t[3]=e[3]*i[3],t},t.multiply=ma,t.nextPowerOfTwo=function(t){return t<=1?1:Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))},t.operations=H,t.ortho=function(t,e,i,r,n,o,a){var s=1/(e-i),l=1/(r-n),c=1/(o-a);return t[0]=-2*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*l,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*c,t[11]=0,t[12]=(e+i)*s,t[13]=(n+r)*l,t[14]=(a+o)*c,t[15]=1,t},t.parseCacheControl=function(t){const e={};if(t.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,((t,i,r,n)=>{const o=r||n;return e[i]=!o||o.toLowerCase(),""})),e["max-age"]){const t=parseInt(e["max-age"],10);isNaN(t)?delete e["max-age"]:e["max-age"]=t}return e},t.parseGlyphPbf=function(t){return new Dl(t).readFields(Rl,[])},t.pbf=ul,t.performSymbolLayout=function(e){e.bucket.createArrays(),e.bucket.tilePixelRatio=No/(512*e.bucket.overscaling),e.bucket.compareText={},e.bucket.iconsNeedLinear=!1;const i=e.bucket.layers[0].layout,r=e.bucket.layers[0]._unevaluatedLayout._values,n={layoutIconSize:r["icon-size"].possiblyEvaluate(new Yr(e.bucket.zoom+1),e.canonical),layoutTextSize:r["text-size"].possiblyEvaluate(new Yr(e.bucket.zoom+1),e.canonical),textMaxSize:r["text-size"].possiblyEvaluate(new Yr(18))};if("composite"===e.bucket.textSizeData.kind){const{minZoom:t,maxZoom:i}=e.bucket.textSizeData;n.compositeTextSizes=[r["text-size"].possiblyEvaluate(new Yr(t),e.canonical),r["text-size"].possiblyEvaluate(new Yr(i),e.canonical)]}if("composite"===e.bucket.iconSizeData.kind){const{minZoom:t,maxZoom:i}=e.bucket.iconSizeData;n.compositeIconSizes=[r["icon-size"].possiblyEvaluate(new Yr(t),e.canonical),r["icon-size"].possiblyEvaluate(new Yr(i),e.canonical)]}const o=i.get("text-line-height")*hl,a="viewport"!==i.get("text-rotation-alignment")&&"point"!==i.get("symbol-placement"),s=i.get("text-keep-upright"),l=i.get("text-size");for(const r of e.bucket.features){const c=i.get("text-font").evaluate(r,{},e.canonical).join(","),h=l.evaluate(r,{},e.canonical),u=n.layoutTextSize.evaluate(r,{},e.canonical),p=n.layoutIconSize.evaluate(r,{},e.canonical),d={horizontal:{},vertical:void 0},m=r.text;let f,g=[0,0];if(m){const n=m.toString(),l=i.get("text-letter-spacing").evaluate(r,{},e.canonical)*hl,p=Pr(n)?l:0,f=i.get("text-anchor").evaluate(r,{},e.canonical),_=i.get("text-variable-anchor");if(!_){const t=i.get("text-radial-offset").evaluate(r,{},e.canonical);g=t?fh(f,[t*hl,mh]):i.get("text-offset").evaluate(r,{},e.canonical).map((t=>t*hl))}let y=a?"center":i.get("text-justify").evaluate(r,{},e.canonical);const x=i.get("symbol-placement"),v="point"===x?i.get("text-max-width").evaluate(r,{},e.canonical)*hl:0,b=()=>{e.bucket.allowVerticalPlacement&&zr(n)&&(d.vertical=ql(m,e.glyphMap,e.glyphPositions,e.imagePositions,c,v,o,f,"left",p,g,t.WritingMode.vertical,!0,x,u,h))};if(!a&&_){const i="auto"===y?_.map((t=>gh(t))):[y];let r=!1;for(let n=0;n<i.length;n++){const a=i[n];if(!d.horizontal[a])if(r)d.horizontal[a]=d.horizontal[0];else{const i=ql(m,e.glyphMap,e.glyphPositions,e.imagePositions,c,v,o,"center",a,p,g,t.WritingMode.horizontal,!1,x,u,h);i&&(d.horizontal[a]=i,r=1===i.positionedLines.length)}}b()}else{"auto"===y&&(y=gh(f));const i=ql(m,e.glyphMap,e.glyphPositions,e.imagePositions,c,v,o,f,y,p,g,t.WritingMode.horizontal,!1,x,u,h);i&&(d.horizontal[y]=i),b(),zr(n)&&a&&s&&(d.vertical=ql(m,e.glyphMap,e.glyphPositions,e.imagePositions,c,v,o,f,y,p,g,t.WritingMode.vertical,!1,x,u,h))}}let _=!1;if(r.icon&&r.icon.name){const t=e.imageMap[r.icon.name];t&&(f=ec(e.imagePositions[r.icon.name],i.get("icon-offset").evaluate(r,{},e.canonical),i.get("icon-anchor").evaluate(r,{},e.canonical)),_=!!t.sdf,void 0===e.bucket.sdfIcons?e.bucket.sdfIcons=_:e.bucket.sdfIcons!==_&&x("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(t.pixelRatio!==e.bucket.pixelRatio||0!==i.get("icon-rotate").constantOr(1))&&(e.bucket.iconsNeedLinear=!0))}const y=xh(d.horizontal)||d.vertical;e.bucket.iconsInText=!!y&&y.iconsInText,(y||f)&&_h(e.bucket,r,d,f,e.imageMap,n,u,p,g,_,e.canonical)}e.showCollisionBoxes&&e.bucket.generateCollisionDebugBuffers()},t.perspective=function(t,e,i,r,n){var o,a=1/Math.tan(e/2);return t[0]=a/i,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=a,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,null!=n&&n!==1/0?(t[10]=(n+r)*(o=1/(r-n)),t[14]=2*n*r*o):(t[10]=-1,t[14]=-2*r),t},t.pick=function(t,e){const i={};for(let r=0;r<e.length;r++){const n=e[r];n in t&&(i[n]=t[n])}return i},t.plugin=Kr,t.pointGeometry=i,t.polygonIntersectsPolygon=Xo,t.potpack=Ol,t.register=Sr,t.registerForPluginStateChange=function(t){return t({pluginStatus:jr,pluginURL:qr}),Hr.on("pluginStateChange",t),t},t.renderColorRamp=Ia,t.rotateX=function(t,e,i){var r=Math.sin(i),n=Math.cos(i),o=e[4],a=e[5],s=e[6],l=e[7],c=e[8],h=e[9],u=e[10],p=e[11];return e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=o*n+c*r,t[5]=a*n+h*r,t[6]=s*n+u*r,t[7]=l*n+p*r,t[8]=c*n-o*r,t[9]=h*n-a*r,t[10]=u*n-s*r,t[11]=p*n-l*r,t},t.rotateZ=function(t,e,i){var r=Math.sin(i),n=Math.cos(i),o=e[0],a=e[1],s=e[2],l=e[3],c=e[4],h=e[5],u=e[6],p=e[7];return e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=o*n+c*r,t[1]=a*n+h*r,t[2]=s*n+u*r,t[3]=l*n+p*r,t[4]=c*n-o*r,t[5]=h*n-a*r,t[6]=u*n-s*r,t[7]=p*n-l*r,t},t.sameOrigin=F,t.scale=function(t,e,i){var r=i[0],n=i[1],o=i[2];return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*o,t[9]=e[9]*o,t[10]=e[10]*o,t[11]=e[11]*o,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},t.setRTLTextPlugin=function(t,e,i=!1){if(jr===Ur||jr===Vr||jr===Nr)throw new Error("setRTLTextPlugin cannot be called multiple times.");qr=M.resolveURL(t),jr=Ur,$r=e,Gr(),i||Wr()},t.sphericalToCartesian=function([t,e,i]){return e+=90,e*=Math.PI/180,i*=Math.PI/180,{x:t*Math.cos(e)*Math.sin(i),y:t*Math.sin(e)*Math.sin(i),z:t*Math.cos(i)}},t.toEvaluationFeature=Zo,t.transformMat4=_a,t.translate=function(t,e,i){var r,n,o,a,s,l,c,h,u,p,d,m,f=i[0],g=i[1],_=i[2];return e===t?(t[12]=e[0]*f+e[4]*g+e[8]*_+e[12],t[13]=e[1]*f+e[5]*g+e[9]*_+e[13],t[14]=e[2]*f+e[6]*g+e[10]*_+e[14],t[15]=e[3]*f+e[7]*g+e[11]*_+e[15]):(n=e[1],o=e[2],a=e[3],s=e[4],l=e[5],c=e[6],h=e[7],u=e[8],p=e[9],d=e[10],m=e[11],t[0]=r=e[0],t[1]=n,t[2]=o,t[3]=a,t[4]=s,t[5]=l,t[6]=c,t[7]=h,t[8]=u,t[9]=p,t[10]=d,t[11]=m,t[12]=r*f+s*g+u*_+e[12],t[13]=n*f+l*g+p*_+e[13],t[14]=o*f+c*g+d*_+e[14],t[15]=a*f+h*g+m*_+e[15]),t},t.triggerPluginCompletionEvent=Zr,t.unicodeBlockLookup=kr,t.uniqueId=function(){return d++},t.v8Spec=j,t.validateCustomStyleLayer=function(t){const e=[],i=t.id;return void 0===i&&e.push({message:`layers.${i}: missing required property "id"`}),void 0===t.render&&e.push({message:`layers.${i}: missing required method "render"`}),t.renderingMode&&"2d"!==t.renderingMode&&"3d"!==t.renderingMode&&e.push({message:`layers.${i}: property "renderingMode" must be either "2d" or "3d"`}),e},t.validateLight=xr,t.validateStyle=yr,t.vectorTile=bs,t.warnOnce=x,t.wrap=u})),r(0,(function(t){class e{constructor(t){this.keyCache={},t&&this.replace(t)}replace(t){this._layerConfigs={},this._layers={},this.update(t,[])}update(e,i){for(const i of e){this._layerConfigs[i.id]=i;const e=this._layers[i.id]=t.createStyleLayer(i);e._featureFilter=t.createFilter(e.filter),this.keyCache[i.id]&&delete this.keyCache[i.id]}for(const t of i)delete this.keyCache[t],delete this._layerConfigs[t],delete this._layers[t];this.familiesBySource={};const r=t.groupByLayout(Object.values(this._layerConfigs),this.keyCache);for(const t of r){const e=t.map((t=>this._layers[t.id])),i=e[0];if("none"===i.visibility)continue;const r=i.source||"";let n=this.familiesBySource[r];n||(n=this.familiesBySource[r]={});const o=i.sourceLayer||"_geojsonTileLayer";let a=n[o];a||(a=n[o]=[]),a.push(e)}}}class i{constructor(e){const i={},r=[];for(const t in e){const n=e[t],o=i[t]={};for(const t in n){const e=n[+t];if(!e||0===e.bitmap.width||0===e.bitmap.height)continue;const i={x:0,y:0,w:e.bitmap.width+2,h:e.bitmap.height+2};r.push(i),o[t]={rect:i,metrics:e.metrics}}}const{w:n,h:o}=t.potpack(r),a=new t.AlphaImage({width:n||1,height:o||1});for(const r in e){const n=e[r];for(const e in n){const o=n[+e];if(!o||0===o.bitmap.width||0===o.bitmap.height)continue;const s=i[r][e].rect;t.AlphaImage.copy(o.bitmap,a,{x:0,y:0},{x:s.x+1,y:s.y+1},o.bitmap)}}this.image=a,this.positions=i}}t.register("GlyphAtlas",i);class r{constructor(e){this.tileID=new t.OverscaledTileID(e.tileID.overscaledZ,e.tileID.wrap,e.tileID.canonical.z,e.tileID.canonical.x,e.tileID.canonical.y),this.uid=e.uid,this.zoom=e.zoom,this.pixelRatio=e.pixelRatio,this.tileSize=e.tileSize,this.source=e.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=e.showCollisionBoxes,this.collectResourceTiming=!!e.collectResourceTiming,this.returnDependencies=!!e.returnDependencies,this.promoteId=e.promoteId}parse(e,r,o,a,s){this.status="parsing",this.data=e,this.collisionBoxArray=new t.CollisionBoxArray;const l=new t.DictionaryCoder(Object.keys(e.layers).sort()),c=new t.FeatureIndex(this.tileID,this.promoteId);c.bucketLayerIDs=[];const h={},u={featureIndex:c,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:o},p=r.familiesBySource[this.source];for(const i in p){const r=e.layers[i];if(!r)continue;1===r.version&&t.warnOnce(`Vector tile source "${this.source}" layer "${i}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const a=l.encode(i),s=[];for(let t=0;t<r.length;t++){const e=r.feature(t),n=c.getId(e,i);s.push({feature:e,id:n,index:t,sourceLayerIndex:a})}for(const e of p[i]){const i=e[0];i.source!==this.source&&t.warnOnce(`layer.source = ${i.source} does not equal this.source = ${this.source}`),i.minzoom&&this.zoom<Math.floor(i.minzoom)||i.maxzoom&&this.zoom>=i.maxzoom||"none"!==i.visibility&&(n(e,this.zoom,o),(h[i.id]=i.createBucket({index:c.bucketLayerIDs.length,layers:e,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:a,sourceID:this.source})).populate(s,u,this.tileID.canonical),c.bucketLayerIDs.push(e.map((t=>t.id))))}}let d,m,f,g;const _=t.mapObject(u.glyphDependencies,(t=>Object.keys(t).map(Number)));Object.keys(_).length?a.send("getGlyphs",{uid:this.uid,stacks:_,source:this.source,tileID:this.tileID,type:"glyphs"},((t,e)=>{d||(d=t,m=e,v.call(this))})):m={};const y=Object.keys(u.iconDependencies);y.length?a.send("getImages",{icons:y,source:this.source,tileID:this.tileID,type:"icons"},((t,e)=>{d||(d=t,f=e,v.call(this))})):f={};const x=Object.keys(u.patternDependencies);function v(){if(d)return s(d);if(m&&f&&g){const e=new i(m),r=new t.ImageAtlas(f,g);for(const i in h){const a=h[i];a instanceof t.SymbolBucket?(n(a.layers,this.zoom,o),t.performSymbolLayout({bucket:a,glyphMap:m,glyphPositions:e.positions,imageMap:f,imagePositions:r.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):a.hasPattern&&(a instanceof t.LineBucket||a instanceof t.FillBucket||a instanceof t.FillExtrusionBucket)&&(n(a.layers,this.zoom,o),a.addFeatures(u,this.tileID.canonical,r.patternPositions))}this.status="done",s(null,{buckets:Object.values(h).filter((t=>!t.isEmpty())),featureIndex:c,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:e.image,imageAtlas:r,glyphMap:this.returnDependencies?m:null,iconMap:this.returnDependencies?f:null,glyphPositions:this.returnDependencies?e.positions:null})}}x.length?a.send("getImages",{icons:x,source:this.source,tileID:this.tileID,type:"patterns"},((t,e)=>{d||(d=t,g=e,v.call(this))})):g={},v.call(this)}}function n(e,i,r){const n=new t.EvaluationParameters(i);for(const t of e)t.recalculate(n,r)}function o(e,i){const r=t.getArrayBuffer(e.request,((e,r,n,o)=>{e?i(e):r&&i(null,{vectorTile:new t.vectorTile.VectorTile(new t.Protobuf(r)),rawData:r,cacheControl:n,expires:o})}));return()=>{r.cancel(),i()}}class a{constructor(t,e,i,r){this.actor=t,this.layerIndex=e,this.availableImages=i,this.loadVectorData=r||o,this.loading={},this.loaded={}}loadTile(e,i){const n=e.uid;this.loading||(this.loading={});const o=!!(e&&e.request&&e.request.collectResourceTiming)&&new t.RequestPerformance(e.request),a=this.loading[n]=new r(e);a.abort=this.loadVectorData(e,((e,r)=>{if(delete this.loading[n],e||!r)return a.status="done",this.loaded[n]=a,i(e);const s=r.rawData,l={};r.expires&&(l.expires=r.expires),r.cacheControl&&(l.cacheControl=r.cacheControl);const c={};if(o){const t=o.finish();t&&(c.resourceTiming=JSON.parse(JSON.stringify(t)))}a.vectorTile=r.vectorTile,a.parse(r.vectorTile,this.layerIndex,this.availableImages,this.actor,((e,r)=>{if(e||!r)return i(e);i(null,t.extend({rawTileData:s.slice(0)},r,l,c))})),this.loaded=this.loaded||{},this.loaded[n]=a}))}reloadTile(t,e){const i=this.loaded,r=t.uid,n=this;if(i&&i[r]){const o=i[r];o.showCollisionBoxes=t.showCollisionBoxes;const a=(t,i)=>{const r=o.reloadCallback;r&&(delete o.reloadCallback,o.parse(o.vectorTile,n.layerIndex,this.availableImages,n.actor,r)),e(t,i)};"parsing"===o.status?o.reloadCallback=a:"done"===o.status&&(o.vectorTile?o.parse(o.vectorTile,this.layerIndex,this.availableImages,this.actor,a):a())}}abortTile(t,e){const i=this.loading,r=t.uid;i&&i[r]&&i[r].abort&&(i[r].abort(),delete i[r]),e()}removeTile(t,e){const i=this.loaded,r=t.uid;i&&i[r]&&delete i[r],e()}}class s{constructor(){this.loaded={}}loadTile(e,i){const{uid:r,encoding:n,rawImageData:o}=e,a=t.isImageBitmap(o)?this.getImageData(o):o,s=new t.DEMData(r,a,n);this.loaded=this.loaded||{},this.loaded[r]=s,i(null,s)}getImageData(e){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(e.width,e.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d",{willReadFrequently:!0})),this.offscreenCanvas.width=e.width,this.offscreenCanvas.height=e.height,this.offscreenCanvasContext.drawImage(e,0,0,e.width,e.height);const i=this.offscreenCanvasContext.getImageData(-1,-1,e.width+2,e.height+2);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),new t.RGBAImage({width:i.width,height:i.height},i.data)}removeTile(t){const e=this.loaded,i=t.uid;e&&e[i]&&delete e[i]}}function l(t,e){if(0!==t.length){c(t[0],e);for(var i=1;i<t.length;i++)c(t[i],!e)}}function c(t,e){for(var i=0,r=0,n=0,o=t.length,a=o-1;n<o;a=n++){var s=(t[n][0]-t[a][0])*(t[a][1]+t[n][1]),l=i+s;r+=Math.abs(i)>=Math.abs(s)?i-l+s:s-l+i,i=l}i+r>=0!=!!e&&t.reverse()}var h=t.getDefaultExportFromCjs((function t(e,i){var r,n=e&&e.type;if("FeatureCollection"===n)for(r=0;r<e.features.length;r++)t(e.features[r],i);else if("GeometryCollection"===n)for(r=0;r<e.geometries.length;r++)t(e.geometries[r],i);else if("Feature"===n)t(e.geometry,i);else if("Polygon"===n)l(e.coordinates,i);else if("MultiPolygon"===n)for(r=0;r<e.coordinates.length;r++)l(e.coordinates[r],i);return e}));const u=t.vectorTile.VectorTileFeature.prototype.toGeoJSON;var p={exports:{}},d=t.pointGeometry,m=t.vectorTile.VectorTileFeature,f=g;function g(t,e){this.options=e||{},this.features=t,this.length=t.length}function _(t,e){this.id="number"==typeof t.id?t.id:void 0,this.type=t.type,this.rawGeometry=1===t.type?[t.geometry]:t.geometry,this.properties=t.tags,this.extent=e||4096}g.prototype.feature=function(t){return new _(this.features[t],this.options.extent)},_.prototype.loadGeometry=function(){var t=this.rawGeometry;this.geometry=[];for(var e=0;e<t.length;e++){for(var i=t[e],r=[],n=0;n<i.length;n++)r.push(new d(i[n][0],i[n][1]));this.geometry.push(r)}return this.geometry},_.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var t=this.geometry,e=1/0,i=-1/0,r=1/0,n=-1/0,o=0;o<t.length;o++)for(var a=t[o],s=0;s<a.length;s++){var l=a[s];e=Math.min(e,l.x),i=Math.max(i,l.x),r=Math.min(r,l.y),n=Math.max(n,l.y)}return[e,r,i,n]},_.prototype.toGeoJSON=m.prototype.toGeoJSON;var y=t.pbf,x=f;function v(t){var e=new y;return function(t,e){for(var i in t.layers)e.writeMessage(3,b,t.layers[i])}(t,e),e.finish()}function b(t,e){var i;e.writeVarintField(15,t.version||1),e.writeStringField(1,t.name||""),e.writeVarintField(5,t.extent||4096);var r={keys:[],values:[],keycache:{},valuecache:{}};for(i=0;i<t.length;i++)r.feature=t.feature(i),e.writeMessage(2,w,r);var n=r.keys;for(i=0;i<n.length;i++)e.writeStringField(3,n[i]);var o=r.values;for(i=0;i<o.length;i++)e.writeMessage(4,I,o[i])}function w(t,e){var i=t.feature;void 0!==i.id&&e.writeVarintField(1,i.id),e.writeMessage(2,E,t),e.writeVarintField(3,i.type),e.writeMessage(4,C,i)}function E(t,e){var i=t.feature,r=t.keys,n=t.values,o=t.keycache,a=t.valuecache;for(var s in i.properties){var l=i.properties[s],c=o[s];if(null!==l){void 0===c&&(r.push(s),o[s]=c=r.length-1),e.writeVarint(c);var h=typeof l;"string"!==h&&"boolean"!==h&&"number"!==h&&(l=JSON.stringify(l));var u=h+":"+l,p=a[u];void 0===p&&(n.push(l),a[u]=p=n.length-1),e.writeVarint(p)}}}function T(t,e){return(e<<3)+(7&t)}function S(t){return t<<1^t>>31}function C(t,e){for(var i=t.loadGeometry(),r=t.type,n=0,o=0,a=i.length,s=0;s<a;s++){var l=i[s],c=1;1===r&&(c=l.length),e.writeVarint(T(1,c));for(var h=3===r?l.length-1:l.length,u=0;u<h;u++){1===u&&1!==r&&e.writeVarint(T(2,h-1));var p=l[u].x-n,d=l[u].y-o;e.writeVarint(S(p)),e.writeVarint(S(d)),n+=p,o+=d}3===r&&e.writeVarint(T(7,1))}}function I(t,e){var i=typeof t;"string"===i?e.writeStringField(1,t):"boolean"===i?e.writeBooleanField(7,t):"number"===i&&(t%1!=0?e.writeDoubleField(3,t):t<0?e.writeSVarintField(6,t):e.writeVarintField(5,t))}p.exports=v,p.exports.fromVectorTileJs=v,p.exports.fromGeojsonVt=function(t,e){e=e||{};var i={};for(var r in t)i[r]=new x(t[r].features,e),i[r].name=r,i[r].version=e.version,i[r].extent=e.extent;return v({layers:i})},p.exports.GeoJSONWrapper=x;var A=t.getDefaultExportFromCjs(p.exports);const M={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:t=>t},k=Math.fround||(z=new Float32Array(1),t=>(z[0]=+t,z[0]));var z;class P{constructor(t){this.options=Object.assign(Object.create(M),t),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(t){const{log:e,minZoom:i,maxZoom:r}=this.options;e&&console.time("total time");const n=`prepare ${t.length} points`;e&&console.time(n),this.points=t;const o=[];for(let e=0;e<t.length;e++){const i=t[e];if(!i.geometry)continue;const[r,n]=i.geometry.coordinates,a=k(R(r)),s=k(B(n));o.push(a,s,1/0,e,-1,1),this.options.reduce&&o.push(0)}let a=this.trees[r+1]=this._createTree(o);e&&console.timeEnd(n);for(let t=r;t>=i;t--){const i=+Date.now();a=this.trees[t]=this._createTree(this._cluster(a,t)),e&&console.log("z%d: %d clusters in %dms",t,a.numItems,+Date.now()-i)}return e&&console.timeEnd("total time"),this}getClusters(t,e){let i=((t[0]+180)%360+360)%360-180;const r=Math.max(-90,Math.min(90,t[1]));let n=180===t[2]?180:((t[2]+180)%360+360)%360-180;const o=Math.max(-90,Math.min(90,t[3]));if(t[2]-t[0]>=360)i=-180,n=180;else if(i>n){const t=this.getClusters([i,r,180,o],e),a=this.getClusters([-180,r,n,o],e);return t.concat(a)}const a=this.trees[this._limitZoom(e)],s=a.range(R(i),B(o),R(n),B(r)),l=a.data,c=[];for(const t of s){const e=this.stride*t;c.push(l[e+5]>1?L(l,e,this.clusterProps):this.points[l[e+3]])}return c}getChildren(t){const e=this._getOriginId(t),i=this._getOriginZoom(t),r="No cluster with the specified id.",n=this.trees[i];if(!n)throw new Error(r);const o=n.data;if(e*this.stride>=o.length)throw new Error(r);const a=this.options.radius/(this.options.extent*Math.pow(2,i-1)),s=n.within(o[e*this.stride],o[e*this.stride+1],a),l=[];for(const e of s){const i=e*this.stride;o[i+4]===t&&l.push(o[i+5]>1?L(o,i,this.clusterProps):this.points[o[i+3]])}if(0===l.length)throw new Error(r);return l}getLeaves(t,e,i){const r=[];return this._appendLeaves(r,t,e=e||10,i=i||0,0),r}getTile(t,e,i){const r=this.trees[this._limitZoom(t)],n=Math.pow(2,t),{extent:o,radius:a}=this.options,s=a/o,l=(i-s)/n,c=(i+1+s)/n,h={features:[]};return this._addTileFeatures(r.range((e-s)/n,l,(e+1+s)/n,c),r.data,e,i,n,h),0===e&&this._addTileFeatures(r.range(1-s/n,l,1,c),r.data,n,i,n,h),e===n-1&&this._addTileFeatures(r.range(0,l,s/n,c),r.data,-1,i,n,h),h.features.length?h:null}getClusterExpansionZoom(t){let e=this._getOriginZoom(t)-1;for(;e<=this.options.maxZoom;){const i=this.getChildren(t);if(e++,1!==i.length)break;t=i[0].properties.cluster_id}return e}_appendLeaves(t,e,i,r,n){const o=this.getChildren(e);for(const e of o){const o=e.properties;if(o&&o.cluster?n+o.point_count<=r?n+=o.point_count:n=this._appendLeaves(t,o.cluster_id,i,r,n):n<r?n++:t.push(e),t.length===i)break}return n}_createTree(e){const i=new t.KDBush(e.length/this.stride|0,this.options.nodeSize,Float32Array);for(let t=0;t<e.length;t+=this.stride)i.add(e[t],e[t+1]);return i.finish(),i.data=e,i}_addTileFeatures(t,e,i,r,n,o){for(const a of t){const t=a*this.stride,s=e[t+5]>1;let l,c,h;if(s)l=D(e,t,this.clusterProps),c=e[t],h=e[t+1];else{const i=this.points[e[t+3]];l=i.properties;const[r,n]=i.geometry.coordinates;c=R(r),h=B(n)}const u={type:1,geometry:[[Math.round(this.options.extent*(c*n-i)),Math.round(this.options.extent*(h*n-r))]],tags:l};let p;p=s||this.options.generateId?e[t+3]:this.points[e[t+3]].id,void 0!==p&&(u.id=p),o.features.push(u)}}_limitZoom(t){return Math.max(this.options.minZoom,Math.min(Math.floor(+t),this.options.maxZoom+1))}_cluster(t,e){const{radius:i,extent:r,reduce:n,minPoints:o}=this.options,a=i/(r*Math.pow(2,e)),s=t.data,l=[],c=this.stride;for(let i=0;i<s.length;i+=c){if(s[i+2]<=e)continue;s[i+2]=e;const r=s[i],h=s[i+1],u=t.within(s[i],s[i+1],a),p=s[i+5];let d=p;for(const t of u){const i=t*c;s[i+2]>e&&(d+=s[i+5])}if(d>p&&d>=o){let t,o=r*p,a=h*p,m=-1;const f=((i/c|0)<<5)+(e+1)+this.points.length;for(const r of u){const l=r*c;if(s[l+2]<=e)continue;s[l+2]=e;const h=s[l+5];o+=s[l]*h,a+=s[l+1]*h,s[l+4]=f,n&&(t||(t=this._map(s,i,!0),m=this.clusterProps.length,this.clusterProps.push(t)),n(t,this._map(s,l)))}s[i+4]=f,l.push(o/d,a/d,1/0,f,-1,d),n&&l.push(m)}else{for(let t=0;t<c;t++)l.push(s[i+t]);if(d>1)for(const t of u){const i=t*c;if(!(s[i+2]<=e)){s[i+2]=e;for(let t=0;t<c;t++)l.push(s[i+t])}}}}return l}_getOriginId(t){return t-this.points.length>>5}_getOriginZoom(t){return(t-this.points.length)%32}_map(t,e,i){if(t[e+5]>1){const r=this.clusterProps[t[e+6]];return i?Object.assign({},r):r}const r=this.points[t[e+3]].properties,n=this.options.map(r);return i&&n===r?Object.assign({},n):n}}function L(t,e,i){return{type:"Feature",id:t[e+3],properties:D(t,e,i),geometry:{type:"Point",coordinates:[(r=t[e],360*(r-.5)),F(t[e+1])]}};var r}function D(t,e,i){const r=t[e+5],n=r>=1e4?`${Math.round(r/1e3)}k`:r>=1e3?Math.round(r/100)/10+"k":r,o=t[e+6],a=-1===o?{}:Object.assign({},i[o]);return Object.assign(a,{cluster:!0,cluster_id:t[e+3],point_count:r,point_count_abbreviated:n})}function R(t){return t/360+.5}function B(t){const e=Math.sin(t*Math.PI/180),i=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return i<0?0:i>1?1:i}function F(t){const e=(180-360*t)*Math.PI/180;return 360*Math.atan(Math.exp(e))/Math.PI-90}function O(t,e,i,r){for(var n,o=r,a=i-e>>1,s=i-e,l=t[e],c=t[e+1],h=t[i],u=t[i+1],p=e+3;p<i;p+=3){var d=U(t[p],t[p+1],l,c,h,u);if(d>o)n=p,o=d;else if(d===o){var m=Math.abs(p-a);m<s&&(n=p,s=m)}}o>r&&(n-e>3&&O(t,e,n,r),t[n+2]=o,i-n>3&&O(t,n,i,r))}function U(t,e,i,r,n,o){var a=n-i,s=o-r;if(0!==a||0!==s){var l=((t-i)*a+(e-r)*s)/(a*a+s*s);l>1?(i=n,r=o):l>0&&(i+=a*l,r+=s*l)}return(a=t-i)*a+(s=e-r)*s}function V(t,e,i,r){var n={id:void 0===t?null:t,type:e,geometry:i,tags:r,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(t){var e=t.geometry,i=t.type;if("Point"===i||"MultiPoint"===i||"LineString"===i)N(t,e);else if("Polygon"===i||"MultiLineString"===i)for(var r=0;r<e.length;r++)N(t,e[r]);else if("MultiPolygon"===i)for(r=0;r<e.length;r++)for(var n=0;n<e[r].length;n++)N(t,e[r][n])}(n),n}function N(t,e){for(var i=0;i<e.length;i+=3)t.minX=Math.min(t.minX,e[i]),t.minY=Math.min(t.minY,e[i+1]),t.maxX=Math.max(t.maxX,e[i]),t.maxY=Math.max(t.maxY,e[i+1])}function $(t,e,i,r){if(e.geometry){var n=e.geometry.coordinates,o=e.geometry.type,a=Math.pow(i.tolerance/((1<<i.maxZoom)*i.extent),2),s=[],l=e.id;if(i.promoteId?l=e.properties[i.promoteId]:i.generateId&&(l=r||0),"Point"===o)j(n,s);else if("MultiPoint"===o)for(var c=0;c<n.length;c++)j(n[c],s);else if("LineString"===o)q(n,s,a,!1);else if("MultiLineString"===o){if(i.lineMetrics){for(c=0;c<n.length;c++)q(n[c],s=[],a,!1),t.push(V(l,"LineString",s,e.properties));return}Z(n,s,a,!1)}else if("Polygon"===o)Z(n,s,a,!0);else{if("MultiPolygon"!==o){if("GeometryCollection"===o){for(c=0;c<e.geometry.geometries.length;c++)$(t,{id:l,geometry:e.geometry.geometries[c],properties:e.properties},i,r);return}throw new Error("Input data is not a valid GeoJSON object.")}for(c=0;c<n.length;c++){var h=[];Z(n[c],h,a,!0),s.push(h)}}t.push(V(l,o,s,e.properties))}}function j(t,e){e.push(G(t[0])),e.push(H(t[1])),e.push(0)}function q(t,e,i,r){for(var n,o,a=0,s=0;s<t.length;s++){var l=G(t[s][0]),c=H(t[s][1]);e.push(l),e.push(c),e.push(0),s>0&&(a+=r?(n*c-l*o)/2:Math.sqrt(Math.pow(l-n,2)+Math.pow(c-o,2))),n=l,o=c}var h=e.length-3;e[2]=1,O(e,0,h,i),e[h+2]=1,e.size=Math.abs(a),e.start=0,e.end=e.size}function Z(t,e,i,r){for(var n=0;n<t.length;n++){var o=[];q(t[n],o,i,r),e.push(o)}}function G(t){return t/360+.5}function H(t){var e=Math.sin(t*Math.PI/180),i=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return i<0?0:i>1?1:i}function X(t,e,i,r,n,o,a,s){if(r/=e,o>=(i/=e)&&a<r)return t;if(a<i||o>=r)return null;for(var l=[],c=0;c<t.length;c++){var h=t[c],u=h.geometry,p=h.type,d=0===n?h.minX:h.minY,m=0===n?h.maxX:h.maxY;if(d>=i&&m<r)l.push(h);else if(!(m<i||d>=r)){var f=[];if("Point"===p||"MultiPoint"===p)W(u,f,i,r,n);else if("LineString"===p)K(u,f,i,r,n,!1,s.lineMetrics);else if("MultiLineString"===p)J(u,f,i,r,n,!1);else if("Polygon"===p)J(u,f,i,r,n,!0);else if("MultiPolygon"===p)for(var g=0;g<u.length;g++){var _=[];J(u[g],_,i,r,n,!0),_.length&&f.push(_)}if(f.length){if(s.lineMetrics&&"LineString"===p){for(g=0;g<f.length;g++)l.push(V(h.id,p,f[g],h.tags));continue}"LineString"!==p&&"MultiLineString"!==p||(1===f.length?(p="LineString",f=f[0]):p="MultiLineString"),"Point"!==p&&"MultiPoint"!==p||(p=3===f.length?"Point":"MultiPoint"),l.push(V(h.id,p,f,h.tags))}}}return l.length?l:null}function W(t,e,i,r,n){for(var o=0;o<t.length;o+=3){var a=t[o+n];a>=i&&a<=r&&(e.push(t[o]),e.push(t[o+1]),e.push(t[o+2]))}}function K(t,e,i,r,n,o,a){for(var s,l,c=Y(t),h=0===n?tt:et,u=t.start,p=0;p<t.length-3;p+=3){var d=t[p],m=t[p+1],f=t[p+2],g=t[p+3],_=t[p+4],y=0===n?d:m,x=0===n?g:_,v=!1;a&&(s=Math.sqrt(Math.pow(d-g,2)+Math.pow(m-_,2))),y<i?x>i&&(l=h(c,d,m,g,_,i),a&&(c.start=u+s*l)):y>r?x<r&&(l=h(c,d,m,g,_,r),a&&(c.start=u+s*l)):Q(c,d,m,f),x<i&&y>=i&&(l=h(c,d,m,g,_,i),v=!0),x>r&&y<=r&&(l=h(c,d,m,g,_,r),v=!0),!o&&v&&(a&&(c.end=u+s*l),e.push(c),c=Y(t)),a&&(u+=s)}var b=t.length-3;d=t[b],m=t[b+1],f=t[b+2],(y=0===n?d:m)>=i&&y<=r&&Q(c,d,m,f),b=c.length-3,o&&b>=3&&(c[b]!==c[0]||c[b+1]!==c[1])&&Q(c,c[0],c[1],c[2]),c.length&&e.push(c)}function Y(t){var e=[];return e.size=t.size,e.start=t.start,e.end=t.end,e}function J(t,e,i,r,n,o){for(var a=0;a<t.length;a++)K(t[a],e,i,r,n,o,!1)}function Q(t,e,i,r){t.push(e),t.push(i),t.push(r)}function tt(t,e,i,r,n,o){var a=(o-e)/(r-e);return t.push(o),t.push(i+(n-i)*a),t.push(1),a}function et(t,e,i,r,n,o){var a=(o-i)/(n-i);return t.push(e+(r-e)*a),t.push(o),t.push(1),a}function it(t,e){for(var i=[],r=0;r<t.length;r++){var n,o=t[r],a=o.type;if("Point"===a||"MultiPoint"===a||"LineString"===a)n=rt(o.geometry,e);else if("MultiLineString"===a||"Polygon"===a){n=[];for(var s=0;s<o.geometry.length;s++)n.push(rt(o.geometry[s],e))}else if("MultiPolygon"===a)for(n=[],s=0;s<o.geometry.length;s++){for(var l=[],c=0;c<o.geometry[s].length;c++)l.push(rt(o.geometry[s][c],e));n.push(l)}i.push(V(o.id,a,n,o.tags))}return i}function rt(t,e){var i=[];i.size=t.size,void 0!==t.start&&(i.start=t.start,i.end=t.end);for(var r=0;r<t.length;r+=3)i.push(t[r]+e,t[r+1],t[r+2]);return i}function nt(t,e){if(t.transformed)return t;var i,r,n,o=1<<t.z,a=t.x,s=t.y;for(i=0;i<t.features.length;i++){var l=t.features[i],c=l.geometry,h=l.type;if(l.geometry=[],1===h)for(r=0;r<c.length;r+=2)l.geometry.push(ot(c[r],c[r+1],e,o,a,s));else for(r=0;r<c.length;r++){var u=[];for(n=0;n<c[r].length;n+=2)u.push(ot(c[r][n],c[r][n+1],e,o,a,s));l.geometry.push(u)}}return t.transformed=!0,t}function ot(t,e,i,r,n,o){return[Math.round(i*(t*r-n)),Math.round(i*(e*r-o))]}function at(t,e,i,r,n){for(var o=e===n.maxZoom?0:n.tolerance/((1<<e)*n.extent),a={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:i,y:r,z:e,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0},s=0;s<t.length;s++){a.numFeatures++,st(a,t[s],o,n);var l=t[s].minX,c=t[s].minY,h=t[s].maxX,u=t[s].maxY;l<a.minX&&(a.minX=l),c<a.minY&&(a.minY=c),h>a.maxX&&(a.maxX=h),u>a.maxY&&(a.maxY=u)}return a}function st(t,e,i,r){var n=e.geometry,o=e.type,a=[];if("Point"===o||"MultiPoint"===o)for(var s=0;s<n.length;s+=3)a.push(n[s]),a.push(n[s+1]),t.numPoints++,t.numSimplified++;else if("LineString"===o)lt(a,n,t,i,!1,!1);else if("MultiLineString"===o||"Polygon"===o)for(s=0;s<n.length;s++)lt(a,n[s],t,i,"Polygon"===o,0===s);else if("MultiPolygon"===o)for(var l=0;l<n.length;l++){var c=n[l];for(s=0;s<c.length;s++)lt(a,c[s],t,i,!0,0===s)}if(a.length){var h=e.tags||null;if("LineString"===o&&r.lineMetrics){for(var u in h={},e.tags)h[u]=e.tags[u];h.mapbox_clip_start=n.start/n.size,h.mapbox_clip_end=n.end/n.size}var p={geometry:a,type:"Polygon"===o||"MultiPolygon"===o?3:"LineString"===o||"MultiLineString"===o?2:1,tags:h};null!==e.id&&(p.id=e.id),t.features.push(p)}}function lt(t,e,i,r,n,o){var a=r*r;if(r>0&&e.size<(n?a:r))i.numPoints+=e.length/3;else{for(var s=[],l=0;l<e.length;l+=3)(0===r||e[l+2]>a)&&(i.numSimplified++,s.push(e[l]),s.push(e[l+1])),i.numPoints++;n&&function(t,e){for(var i=0,r=0,n=t.length,o=n-2;r<n;o=r,r+=2)i+=(t[r]-t[o])*(t[r+1]+t[o+1]);if(i>0===e)for(r=0,n=t.length;r<n/2;r+=2){var a=t[r],s=t[r+1];t[r]=t[n-2-r],t[r+1]=t[n-1-r],t[n-2-r]=a,t[n-1-r]=s}}(s,o),t.push(s)}}function ct(t,e){var i=(e=this.options=function(t,e){for(var i in e)t[i]=e[i];return t}(Object.create(this.options),e)).debug;if(i&&console.time("preprocess data"),e.maxZoom<0||e.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(e.promoteId&&e.generateId)throw new Error("promoteId and generateId cannot be used together.");var r=function(t,e){var i=[];if("FeatureCollection"===t.type)for(var r=0;r<t.features.length;r++)$(i,t.features[r],e,r);else $(i,"Feature"===t.type?t:{geometry:t},e);return i}(t,e);this.tiles={},this.tileCoords=[],i&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",e.indexMaxZoom,e.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),r=function(t,e){var i=e.buffer/e.extent,r=t,n=X(t,1,-1-i,i,0,-1,2,e),o=X(t,1,1-i,2+i,0,-1,2,e);return(n||o)&&(r=X(t,1,-i,1+i,0,-1,2,e)||[],n&&(r=it(n,1).concat(r)),o&&(r=r.concat(it(o,-1)))),r}(r,e),r.length&&this.splitTile(r,0,0,0),i&&(r.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 ht(t,e,i){return 32*((1<<t)*i+e)+t}function ut(t,e){return e?t.properties[e]:t.id}function pt(t,e){if(null==t)return!0;if("Feature"===t.type)return null!=ut(t,e);if("FeatureCollection"===t.type){const i=new Set;for(const r of t.features){const t=ut(r,e);if(null==t)return!1;if(i.has(t))return!1;i.add(t)}return!0}return!1}function dt(t,e){const i=new Map;if(null==t);else if("Feature"===t.type)i.set(ut(t,e),t);else for(const r of t.features)i.set(ut(r,e),r);return i}function mt(e,i){const r=e.tileID.canonical;if(!this._geoJSONIndex)return i(null,null);const n=this._geoJSONIndex.getTile(r.z,r.x,r.y);if(!n)return i(null,null);const o=new class{constructor(e){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=t.EXTENT,this.length=e.length,this._features=e}feature(e){return new class{constructor(e){this._feature=e,this.extent=t.EXTENT,this.type=e.type,this.properties=e.tags,"id"in e&&!isNaN(e.id)&&(this.id=parseInt(e.id,10))}loadGeometry(){if(1===this._feature.type){const e=[];for(const i of this._feature.geometry)e.push([new t.Point(i[0],i[1])]);return e}{const e=[];for(const i of this._feature.geometry){const r=[];for(const e of i)r.push(new t.Point(e[0],e[1]));e.push(r)}return e}}toGeoJSON(t,e,i){return u.call(this,t,e,i)}}(this._features[e])}}(n.features);let a=A(o);0===a.byteOffset&&a.byteLength===a.buffer.byteLength||(a=new Uint8Array(a)),i(null,{vectorTile:o,rawData:a.buffer})}ct.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},ct.prototype.splitTile=function(t,e,i,r,n,o,a){for(var s=[t,e,i,r],l=this.options,c=l.debug;s.length;){r=s.pop(),i=s.pop(),e=s.pop(),t=s.pop();var h=1<<e,u=ht(e,i,r),p=this.tiles[u];if(!p&&(c>1&&console.time("creation"),p=this.tiles[u]=at(t,e,i,r,l),this.tileCoords.push({z:e,x:i,y:r}),c)){c>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",e,i,r,p.numFeatures,p.numPoints,p.numSimplified),console.timeEnd("creation"));var d="z"+e;this.stats[d]=(this.stats[d]||0)+1,this.total++}if(p.source=t,n){if(e===l.maxZoom||e===n)continue;var m=1<<n-e;if(i!==Math.floor(o/m)||r!==Math.floor(a/m))continue}else if(e===l.indexMaxZoom||p.numPoints<=l.indexMaxPoints)continue;if(p.source=null,0!==t.length){c>1&&console.time("clipping");var f,g,_,y,x,v,b=.5*l.buffer/l.extent,w=.5-b,E=.5+b,T=1+b;f=g=_=y=null,x=X(t,h,i-b,i+E,0,p.minX,p.maxX,l),v=X(t,h,i+w,i+T,0,p.minX,p.maxX,l),t=null,x&&(f=X(x,h,r-b,r+E,1,p.minY,p.maxY,l),g=X(x,h,r+w,r+T,1,p.minY,p.maxY,l),x=null),v&&(_=X(v,h,r-b,r+E,1,p.minY,p.maxY,l),y=X(v,h,r+w,r+T,1,p.minY,p.maxY,l),v=null),c>1&&console.timeEnd("clipping"),s.push(f||[],e+1,2*i,2*r),s.push(g||[],e+1,2*i,2*r+1),s.push(_||[],e+1,2*i+1,2*r),s.push(y||[],e+1,2*i+1,2*r+1)}}},ct.prototype.getTile=function(t,e,i){var r=this.options,n=r.extent,o=r.debug;if(t<0||t>24)return null;var a=1<<t,s=ht(t,e=(e%a+a)%a,i);if(this.tiles[s])return nt(this.tiles[s],n);o>1&&console.log("drilling down to z%d-%d-%d",t,e,i);for(var l,c=t,h=e,u=i;!l&&c>0;)c--,h=Math.floor(h/2),u=Math.floor(u/2),l=this.tiles[ht(c,h,u)];return l&&l.source?(o>1&&console.log("found parent tile z%d-%d-%d",c,h,u),o>1&&console.time("drilling down"),this.splitTile(l.source,c,h,u,t,e,i),o>1&&console.timeEnd("drilling down"),this.tiles[s]?nt(this.tiles[s],n):null):null};class ft extends a{constructor(e,i,r,n){super(e,i,r,mt),this._dataUpdateable=new Map,this.loadGeoJSON=(e,i)=>{const{promoteId:r}=e;if(e.request)return t.getJSON(e.request,((t,e,n,o)=>{this._dataUpdateable=pt(e,r)?dt(e,r):void 0,i(t,e,n,o)}));if("string"==typeof e.data)try{const t=JSON.parse(e.data);this._dataUpdateable=pt(t,r)?dt(t,r):void 0,i(null,t)}catch(t){i(new Error(`Input data given to '${e.source}' is not a valid GeoJSON object.`))}else e.dataDiff?this._dataUpdateable?(function(t,e,i){var r,n,o,a;if(e.removeAll&&t.clear(),e.remove)for(const i of e.remove)t.delete(i);if(e.add)for(const r of e.add){const e=ut(r,i);null!=e&&t.set(e,r)}if(e.update)for(const i of e.update){let e=t.get(i.id);if(null==e)continue;const s=!i.removeAllProperties&&((null===(r=i.removeProperties)||void 0===r?void 0:r.length)>0||(null===(n=i.addOrUpdateProperties)||void 0===n?void 0:n.length)>0);if((i.newGeometry||i.removeAllProperties||s)&&(e={...e},t.set(i.id,e),s&&(e.properties={...e.properties})),i.newGeometry&&(e.geometry=i.newGeometry),i.removeAllProperties)e.properties={};else if((null===(o=i.removeProperties)||void 0===o?void 0:o.length)>0)for(const t of i.removeProperties)Object.prototype.hasOwnProperty.call(e.properties,t)&&delete e.properties[t];if((null===(a=i.addOrUpdateProperties)||void 0===a?void 0:a.length)>0)for(const{key:t,value:r}of i.addOrUpdateProperties)e.properties[t]=r}}(this._dataUpdateable,e.dataDiff,r),i(null,{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())})):i(new Error(`Cannot update existing geojson data in ${e.source}`)):i(new Error(`Input data given to '${e.source}' is not a valid GeoJSON object.`));return{cancel:()=>{}}},n&&(this.loadGeoJSON=n)}loadData(e,i){var r;null===(r=this._pendingRequest)||void 0===r||r.cancel(),this._pendingCallback&&this._pendingCallback(null,{abandoned:!0});const n=!!(e&&e.request&&e.request.collectResourceTiming)&&new t.RequestPerformance(e.request);this._pendingCallback=i,this._pendingRequest=this.loadGeoJSON(e,((r,o)=>{if(delete this._pendingCallback,delete this._pendingRequest,r||!o)return i(r);if("object"!=typeof o)return i(new Error(`Input data given to '${e.source}' is not a valid GeoJSON object.`));{h(o,!0);try{if(e.filter){const i=t.createExpression(e.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if("error"===i.result)throw new Error(i.value.map((t=>`${t.key}: ${t.message}`)).join(", "));const r=o.features.filter((t=>i.value.evaluate({zoom:0},t)));o={type:"FeatureCollection",features:r}}this._geoJSONIndex=e.cluster?new P(function({superclusterOptions:e,clusterProperties:i}){if(!i||!e)return e;const r={},n={},o={accumulated:null,zoom:0},a={properties:null},s=Object.keys(i);for(const e of s){const[o,a]=i[e],s=t.createExpression(a),l=t.createExpression("string"==typeof o?[o,["accumulated"],["get",e]]:o);r[e]=s.value,n[e]=l.value}return e.map=t=>{a.properties=t;const e={};for(const t of s)e[t]=r[t].evaluate(o,a);return e},e.reduce=(t,e)=>{a.properties=e;for(const e of s)o.accumulated=t[e],t[e]=n[e].evaluate(o,a)},e}(e)).load(o.features):function(t,e){return new ct(t,e)}(o,e.geojsonVtOptions)}catch(r){return i(r)}this.loaded={};const a={};if(n){const t=n.finish();t&&(a.resourceTiming={},a.resourceTiming[e.source]=JSON.parse(JSON.stringify(t)))}i(null,a)}}))}reloadTile(t,e){const i=this.loaded;return i&&i[t.uid]?super.reloadTile(t,e):this.loadTile(t,e)}removeSource(t,e){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),e()}getClusterExpansionZoom(t,e){try{e(null,this._geoJSONIndex.getClusterExpansionZoom(t.clusterId))}catch(t){e(t)}}getClusterChildren(t,e){try{e(null,this._geoJSONIndex.getChildren(t.clusterId))}catch(t){e(t)}}getClusterLeaves(t,e){try{e(null,this._geoJSONIndex.getLeaves(t.clusterId,t.limit,t.offset))}catch(t){e(t)}}}class gt{constructor(e){this.self=e,this.actor=new t.Actor(e,this),this.layerIndexes={},this.availableImages={},this.workerSourceTypes={vector:a,geojson:ft},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(t,e)=>{if(this.workerSourceTypes[t])throw new Error(`Worker source with name "${t}" already registered.`);this.workerSourceTypes[t]=e},this.self.registerRTLTextPlugin=e=>{if(t.plugin.isParsed())throw new Error("RTL text plugin already registered.");t.plugin.applyArabicShaping=e.applyArabicShaping,t.plugin.processBidirectionalText=e.processBidirectionalText,t.plugin.processStyledBidirectionalText=e.processStyledBidirectionalText}}setReferrer(t,e){this.referrer=e}setImages(t,e,i){this.availableImages[t]=e;for(const i in this.workerSources[t]){const r=this.workerSources[t][i];for(const t in r)r[t].availableImages=e}i()}setLayers(t,e,i){this.getLayerIndex(t).replace(e),i()}updateLayers(t,e,i){this.getLayerIndex(t).update(e.layers,e.removedIds),i()}loadTile(t,e,i){this.getWorkerSource(t,e.type,e.source).loadTile(e,i)}loadDEMTile(t,e,i){this.getDEMWorkerSource(t,e.source).loadTile(e,i)}reloadTile(t,e,i){this.getWorkerSource(t,e.type,e.source).reloadTile(e,i)}abortTile(t,e,i){this.getWorkerSource(t,e.type,e.source).abortTile(e,i)}removeTile(t,e,i){this.getWorkerSource(t,e.type,e.source).removeTile(e,i)}removeDEMTile(t,e){this.getDEMWorkerSource(t,e.source).removeTile(e)}removeSource(t,e,i){if(!this.workerSources[t]||!this.workerSources[t][e.type]||!this.workerSources[t][e.type][e.source])return;const r=this.workerSources[t][e.type][e.source];delete this.workerSources[t][e.type][e.source],void 0!==r.removeSource?r.removeSource(e,i):i()}loadWorkerSource(t,e,i){try{this.self.importScripts(e.url),i()}catch(t){i(t.toString())}}syncRTLPluginState(e,i,r){try{t.plugin.setState(i);const e=t.plugin.getPluginURL();if(t.plugin.isLoaded()&&!t.plugin.isParsed()&&null!=e){this.self.importScripts(e);const i=t.plugin.isParsed();r(i?void 0:new Error(`RTL Text Plugin failed to import scripts from ${e}`),i)}}catch(t){r(t.toString())}}getAvailableImages(t){let e=this.availableImages[t];return e||(e=[]),e}getLayerIndex(t){let i=this.layerIndexes[t];return i||(i=this.layerIndexes[t]=new e),i}getWorkerSource(t,e,i){if(this.workerSources[t]||(this.workerSources[t]={}),this.workerSources[t][e]||(this.workerSources[t][e]={}),!this.workerSources[t][e][i]){const r={send:(e,i,r)=>{this.actor.send(e,i,r,t)}};this.workerSources[t][e][i]=new this.workerSourceTypes[e](r,this.getLayerIndex(t),this.getAvailableImages(t))}return this.workerSources[t][e][i]}getDEMWorkerSource(t,e){return this.demWorkerSources[t]||(this.demWorkerSources[t]={}),this.demWorkerSources[t][e]||(this.demWorkerSources[t][e]=new s),this.demWorkerSources[t][e]}}return t.isWorker()&&(self.worker=new gt(self)),gt})),r(0,(function(t){var e="3.0.1";class i{static testProp(t){if(!i.docStyle)return t[0];for(let e=0;e<t.length;e++)if(t[e]in i.docStyle)return t[e];return t[0]}static create(t,e,i){const r=window.document.createElement(t);return void 0!==e&&(r.className=e),i&&i.appendChild(r),r}static createNS(t,e){return window.document.createElementNS(t,e)}static disableDrag(){i.docStyle&&i.selectProp&&(i.userSelect=i.docStyle[i.selectProp],i.docStyle[i.selectProp]="none")}static enableDrag(){i.docStyle&&i.selectProp&&(i.docStyle[i.selectProp]=i.userSelect)}static setTransform(t,e){t.style[i.transformProp]=e}static addEventListener(t,e,i,r={}){t.addEventListener(e,i,"passive"in r?r:r.capture)}static removeEventListener(t,e,i,r={}){t.removeEventListener(e,i,"passive"in r?r:r.capture)}static suppressClickInternal(t){t.preventDefault(),t.stopPropagation(),window.removeEventListener("click",i.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",i.suppressClickInternal,!0),window.setTimeout((()=>{window.removeEventListener("click",i.suppressClickInternal,!0)}),0)}static mousePos(e,i){const r=e.getBoundingClientRect();return new t.Point(i.clientX-r.left-e.clientLeft,i.clientY-r.top-e.clientTop)}static touchPos(e,i){const r=e.getBoundingClientRect(),n=[];for(let o=0;o<i.length;o++)n.push(new t.Point(i[o].clientX-r.left-e.clientLeft,i[o].clientY-r.top-e.clientTop));return n}static mouseButton(t){return t.button}static remove(t){t.parentNode&&t.parentNode.removeChild(t)}}i.docStyle="undefined"!=typeof window&&window.document&&window.document.documentElement.style,i.selectProp=i.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),i.transformProp=i.testProp(["transform","WebkitTransform"]);const r={supported:!1,testSupport:function(t){!a&&o&&(s?l(t):n=t)}};let n,o,a=!1,s=!1;function l(t){const e=t.createTexture();t.bindTexture(t.TEXTURE_2D,e);try{if(t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,o),t.isContextLost())return;r.supported=!0}catch(t){}t.deleteTexture(e),a=!0}var c;"undefined"!=typeof document&&(o=document.createElement("img"),o.onload=function(){n&&l(n),n=null,s=!0},o.onerror=function(){a=!0,n=null},o.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),function(e){let i,n,o,a;e.resetRequestQueue=()=>{i=[],n=0,o=0,a={}},e.addThrottleControl=t=>{const e=o++;return a[e]=t,e},e.removeThrottleControl=t=>{delete a[t],c()},e.getImage=(t,e,o=!0)=>{r.supported&&(t.headers||(t.headers={}),t.headers.accept="image/webp,*/*");const a={requestParameters:t,supportImageRefresh:o,callback:e,cancelled:!1,completed:!1,cancel:()=>{a.completed||a.cancelled||(a.cancelled=!0,a.innerRequest&&(a.innerRequest.cancel(),n--),c())}};return i.push(a),c(),a};const s=e=>{const{requestParameters:i,supportImageRefresh:r,callback:n}=e;return t.extend(i,{type:"image"}),(!1!==r||t.isWorker()||t.getProtocolAction(i.url)||i.headers&&!Object.keys(i.headers).reduce(((t,e)=>t&&"accept"===e),!0)?t.makeRequest:h)(i,((t,i,r,o)=>{l(e,n,t,i,r,o)}))},l=(e,i,r,o,a,s)=>{r?i(r):o instanceof HTMLImageElement||o instanceof ImageBitmap?i(null,o):o&&((e,i)=>{"function"==typeof createImageBitmap?t.arrayBufferToImageBitmap(e,i):t.arrayBufferToImage(e,i)})(o,((t,e)=>{null!=t?i(t):null!=e&&i(null,e,{cacheControl:a,expires:s})})),e.cancelled||(e.completed=!0,n--,c())},c=()=>{const e=(()=>{const t=Object.keys(a);let e=!1;if(t.length>0)for(const i of t)if(e=a[i](),e)break;return e})()?t.config.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:t.config.MAX_PARALLEL_IMAGE_REQUESTS;for(let t=n;t<e&&i.length>0;t++){const e=i.shift();if(e.cancelled){t--;continue}const r=s(e);n++,e.innerRequest=r}},h=(e,i)=>{const r=new Image,n=e.url;let o=!1;const a=e.credentials;return a&&"include"===a?r.crossOrigin="use-credentials":(a&&"same-origin"===a||!t.sameOrigin(n))&&(r.crossOrigin="anonymous"),r.fetchPriority="high",r.onload=()=>{i(null,r),r.onerror=r.onload=null},r.onerror=()=>{o||i(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.")),r.onerror=r.onload=null},r.src=n,{cancel:()=>{o=!0,r.src=""}}}}(c||(c={})),c.resetRequestQueue();var h,u=c;!function(t){t.Glyphs="Glyphs",t.Image="Image",t.Source="Source",t.SpriteImage="SpriteImage",t.SpriteJSON="SpriteJSON",t.Style="Style",t.Tile="Tile",t.Unknown="Unknown"}(h||(h={}));class p{constructor(t){this._transformRequestFn=t}transformRequest(t,e){return this._transformRequestFn&&this._transformRequestFn(t,e)||{url:t}}normalizeSpriteURL(t,e,i){const r=function(t){const e=t.match(d);if(!e)throw new Error(`Unable to parse URL "${t}"`);return{protocol:e[1],authority:e[2],path:e[3]||"/",params:e[4]?e[4].split("&"):[]}}(t);return r.path+=`${e}${i}`,function(t){const e=t.params.length?`?${t.params.join("&")}`:"";return`${t.protocol}://${t.authority}${t.path}${e}`}(r)}setTransformRequest(t){this._transformRequestFn=t}}const d=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function m(e){var i=new t.ARRAY_TYPE(3);return i[0]=e[0],i[1]=e[1],i[2]=e[2],i}var f,g=function(t,e,i){return t[0]=e[0]-i[0],t[1]=e[1]-i[1],t[2]=e[2]-i[2],t};f=new t.ARRAY_TYPE(3),t.ARRAY_TYPE!=Float32Array&&(f[0]=0,f[1]=0,f[2]=0);var _=function(t){var e=t[0],i=t[1];return e*e+i*i};function y(t){const e=[];if("string"==typeof t)e.push({id:"default",url:t});else if(t&&t.length>0){const i=[];for(const{id:r,url:n}of t){const t=`${r}${n}`;-1===i.indexOf(t)&&(i.push(t),e.push({id:r,url:n}))}}return e}function x(e,i,r,n,o){if(n)return void e(n);if(o!==Object.values(i).length||o!==Object.values(r).length)return;const a={};for(const e in i){a[e]={};const n=t.exported.getImageCanvasContext(r[e]),o=i[e];for(const t in o){const{width:i,height:r,x:s,y:l,sdf:c,pixelRatio:h,stretchX:u,stretchY:p,content:d}=o[t];a[e][t]={data:null,pixelRatio:h,sdf:c,stretchX:u,stretchY:p,content:d,spriteData:{width:i,height:r,x:s,y:l,context:n}}}}e(null,a)}!function(){var e=new t.ARRAY_TYPE(2);t.ARRAY_TYPE!=Float32Array&&(e[0]=0,e[1]=0)}();class v{constructor(t,e,i,r){this.context=t,this.format=i,this.texture=t.gl.createTexture(),this.update(e,r)}update(e,i,r){const{width:n,height:o}=e,a=!(this.size&&this.size[0]===n&&this.size[1]===o||r),{context:s}=this,{gl:l}=s;if(this.useMipmap=Boolean(i&&i.useMipmap),l.bindTexture(l.TEXTURE_2D,this.texture),s.pixelStoreUnpackFlipY.set(!1),s.pixelStoreUnpack.set(1),s.pixelStoreUnpackPremultiplyAlpha.set(this.format===l.RGBA&&(!i||!1!==i.premultiply)),a)this.size=[n,o],e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||t.isImageBitmap(e)?l.texImage2D(l.TEXTURE_2D,0,this.format,this.format,l.UNSIGNED_BYTE,e):l.texImage2D(l.TEXTURE_2D,0,this.format,n,o,0,this.format,l.UNSIGNED_BYTE,e.data);else{const{x:i,y:a}=r||{x:0,y:0};e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||t.isImageBitmap(e)?l.texSubImage2D(l.TEXTURE_2D,0,i,a,l.RGBA,l.UNSIGNED_BYTE,e):l.texSubImage2D(l.TEXTURE_2D,0,i,a,n,o,l.RGBA,l.UNSIGNED_BYTE,e.data)}this.useMipmap&&this.isSizePowerOfTwo()&&l.generateMipmap(l.TEXTURE_2D)}bind(t,e,i){const{context:r}=this,{gl:n}=r;n.bindTexture(n.TEXTURE_2D,this.texture),i!==n.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(i=n.LINEAR),t!==this.filter&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,t),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,i||t),this.filter=t),e!==this.wrap&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,e),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,e),this.wrap=e)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:t}=this.context;t.deleteTexture(this.texture),this.texture=null}}function b(t){const{userImage:e}=t;return!!(e&&e.render&&e.render())&&(t.data.replace(new Uint8Array(e.data.buffer)),!0)}class w extends t.Evented{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new t.RGBAImage({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(t){if(this.loaded!==t&&(this.loaded=t,t)){for(const{ids:t,callback:e}of this.requestors)this._notify(t,e);this.requestors=[]}}getImage(e){const i=this.images[e];if(i&&!i.data&&i.spriteData){const e=i.spriteData;i.data=new t.RGBAImage({width:e.width,height:e.height},e.context.getImageData(e.x,e.y,e.width,e.height).data),i.spriteData=null}return i}addImage(t,e){if(this.images[t])throw new Error(`Image id ${t} already exist, use updateImage instead`);this._validate(t,e)&&(this.images[t]=e)}_validate(e,i){let r=!0;const n=i.data||i.spriteData;return this._validateStretch(i.stretchX,n&&n.width)||(this.fire(new t.ErrorEvent(new Error(`Image "${e}" has invalid "stretchX" value`))),r=!1),this._validateStretch(i.stretchY,n&&n.height)||(this.fire(new t.ErrorEvent(new Error(`Image "${e}" has invalid "stretchY" value`))),r=!1),this._validateContent(i.content,i)||(this.fire(new t.ErrorEvent(new Error(`Image "${e}" has invalid "content" value`))),r=!1),r}_validateStretch(t,e){if(!t)return!0;let i=0;for(const r of t){if(r[0]<i||r[1]<r[0]||e<r[1])return!1;i=r[1]}return!0}_validateContent(t,e){if(!t)return!0;if(4!==t.length)return!1;const i=e.spriteData,r=i&&i.width||e.data.width,n=i&&i.height||e.data.height;return!(t[0]<0||r<t[0]||t[1]<0||n<t[1]||t[2]<0||r<t[2]||t[3]<0||n<t[3]||t[2]<t[0]||t[3]<t[1])}updateImage(t,e,i=!0){const r=this.getImage(t);if(i&&(r.data.width!==e.data.width||r.data.height!==e.data.height))throw new Error(`size mismatch between old image (${r.data.width}x${r.data.height}) and new image (${e.data.width}x${e.data.height}).`);e.version=r.version+1,this.images[t]=e,this.updatedImages[t]=!0}removeImage(t){const e=this.images[t];delete this.images[t],delete this.patterns[t],e.userImage&&e.userImage.onRemove&&e.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(t,e){let i=!0;if(!this.isLoaded())for(const e of t)this.images[e]||(i=!1);this.isLoaded()||i?this._notify(t,e):this.requestors.push({ids:t,callback:e})}_notify(e,i){const r={};for(const i of e){let e=this.getImage(i);e||(this.fire(new t.Event("styleimagemissing",{id:i})),e=this.getImage(i)),e?r[i]={data:e.data.clone(),pixelRatio:e.pixelRatio,sdf:e.sdf,version:e.version,stretchX:e.stretchX,stretchY:e.stretchY,content:e.content,hasRenderCallback:Boolean(e.userImage&&e.userImage.render)}:t.warnOnce(`Image "${i}" 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.`)}i(null,r)}getPixelSize(){const{width:t,height:e}=this.atlasImage;return{width:t,height:e}}getPattern(e){const i=this.patterns[e],r=this.getImage(e);if(!r)return null;if(i&&i.position.version===r.version)return i.position;if(i)i.position.version=r.version;else{const i={w:r.data.width+2,h:r.data.height+2,x:0,y:0},n=new t.ImagePosition(i,r);this.patterns[e]={bin:i,position:n}}return this._updatePatternAtlas(),this.patterns[e].position}bind(t){const e=t.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new v(t,this.atlasImage,e.RGBA),this.atlasTexture.bind(e.LINEAR,e.CLAMP_TO_EDGE)}_updatePatternAtlas(){const e=[];for(const t in this.patterns)e.push(this.patterns[t].bin);const{w:i,h:r}=t.potpack(e),n=this.atlasImage;n.resize({width:i||1,height:r||1});for(const e in this.patterns){const{bin:i}=this.patterns[e],r=i.x+1,o=i.y+1,a=this.getImage(e).data,s=a.width,l=a.height;t.RGBAImage.copy(a,n,{x:0,y:0},{x:r,y:o},{width:s,height:l}),t.RGBAImage.copy(a,n,{x:0,y:l-1},{x:r,y:o-1},{width:s,height:1}),t.RGBAImage.copy(a,n,{x:0,y:0},{x:r,y:o+l},{width:s,height:1}),t.RGBAImage.copy(a,n,{x:s-1,y:0},{x:r-1,y:o},{width:1,height:l}),t.RGBAImage.copy(a,n,{x:0,y:0},{x:r+s,y:o},{width:1,height:l})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(e){for(const i of e){if(this.callbackDispatchedThisFrame[i])continue;this.callbackDispatchedThisFrame[i]=!0;const e=this.getImage(i);e||t.warnOnce(`Image with ID: "${i}" was not found`),b(e)&&this.updateImage(i,e)}}}const E=1e20;function T(t,e,i,r,n,o,a,s,l){for(let c=e;c<e+r;c++)S(t,i*o+c,o,n,a,s,l);for(let c=i;c<i+n;c++)S(t,c*o+e,1,r,a,s,l)}function S(t,e,i,r,n,o,a){o[0]=0,a[0]=-E,a[1]=E,n[0]=t[e];for(let s=1,l=0,c=0;s<r;s++){n[s]=t[e+s*i];const r=s*s;do{const t=o[l];c=(n[s]-n[t]+r-t*t)/(s-t)/2}while(c<=a[l]&&--l>-1);l++,o[l]=s,a[l]=c,a[l+1]=E}for(let s=0,l=0;s<r;s++){for(;a[l+1]<s;)l++;const r=o[l],c=s-r;t[e+s*i]=n[r]+c*c}}class C{constructor(t,e){this.requestManager=t,this.localIdeographFontFamily=e,this.entries={}}setURL(t){this.url=t}getGlyphs(e,i){const r=[];for(const t in e)for(const i of e[t])r.push({stack:t,id:i});t.asyncAll(r,(({stack:t,id:e},i)=>{let r=this.entries[t];r||(r=this.entries[t]={glyphs:{},requests:{},ranges:{}});let n=r.glyphs[e];if(void 0!==n)return void i(null,{stack:t,id:e,glyph:n});if(n=this._tinySDF(r,t,e),n)return r.glyphs[e]=n,void i(null,{stack:t,id:e,glyph:n});const o=Math.floor(e/256);if(256*o>65535)return void i(new Error("glyphs > 65535 not supported"));if(r.ranges[o])return void i(null,{stack:t,id:e,glyph:n});if(!this.url)return void i(new Error("glyphsUrl is not set"));let a=r.requests[o];a||(a=r.requests[o]=[],C.loadGlyphRange(t,o,this.url,this.requestManager,((t,e)=>{if(e){for(const t in e)this._doesCharSupportLocalGlyph(+t)||(r.glyphs[+t]=e[+t]);r.ranges[o]=!0}for(const i of a)i(t,e);delete r.requests[o]}))),a.push(((r,n)=>{r?i(r):n&&i(null,{stack:t,id:e,glyph:n[e]||null})}))}),((t,e)=>{if(t)i(t);else if(e){const t={};for(const{stack:i,id:r,glyph:n}of e)(t[i]||(t[i]={}))[r]=n&&{id:n.id,bitmap:n.bitmap.clone(),metrics:n.metrics};i(null,t)}}))}_doesCharSupportLocalGlyph(e){return!!this.localIdeographFontFamily&&(t.unicodeBlockLookup["CJK Unified Ideographs"](e)||t.unicodeBlockLookup["Hangul Syllables"](e)||t.unicodeBlockLookup.Hiragana(e)||t.unicodeBlockLookup.Katakana(e))}_tinySDF(e,i,r){const n=this.localIdeographFontFamily;if(!n)return;if(!this._doesCharSupportLocalGlyph(r))return;let o=e.tinySDF;if(!o){let t="400";/bold/i.test(i)?t="900":/medium/i.test(i)?t="500":/light/i.test(i)&&(t="200"),o=e.tinySDF=new C.TinySDF({fontSize:24,buffer:3,radius:8,cutoff:.25,fontFamily:n,fontWeight:t})}const a=o.draw(String.fromCharCode(r));return{id:r,bitmap:new t.AlphaImage({width:a.width||30,height:a.height||30},a.data),metrics:{width:a.glyphWidth||24,height:a.glyphHeight||24,left:a.glyphLeft||0,top:a.glyphTop-27||-8,advance:a.glyphAdvance||24}}}}C.loadGlyphRange=function(e,i,r,n,o){const a=256*i,s=a+255,l=n.transformRequest(r.replace("{fontstack}",e).replace("{range}",`${a}-${s}`),h.Glyphs);t.getArrayBuffer(l,((e,i)=>{if(e)o(e);else if(i){const e={};for(const r of t.parseGlyphPbf(i))e[r.id]=r;o(null,e)}}))},C.TinySDF=class{constructor({fontSize:t=24,buffer:e=3,radius:i=8,cutoff:r=.25,fontFamily:n="sans-serif",fontWeight:o="normal",fontStyle:a="normal"}={}){this.buffer=e,this.cutoff=r,this.radius=i;const s=this.size=t+4*e,l=this._createCanvas(s),c=this.ctx=l.getContext("2d",{willReadFrequently:!0});c.font=`${a} ${o} ${t}px ${n}`,c.textBaseline="alphabetic",c.textAlign="left",c.fillStyle="black",this.gridOuter=new Float64Array(s*s),this.gridInner=new Float64Array(s*s),this.f=new Float64Array(s),this.z=new Float64Array(s+1),this.v=new Uint16Array(s)}_createCanvas(t){const e=document.createElement("canvas");return e.width=e.height=t,e}draw(t){const{width:e,actualBoundingBoxAscent:i,actualBoundingBoxDescent:r,actualBoundingBoxLeft:n,actualBoundingBoxRight:o}=this.ctx.measureText(t),a=Math.ceil(i),s=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(o-n))),l=Math.min(this.size-this.buffer,a+Math.ceil(r)),c=s+2*this.buffer,h=l+2*this.buffer,u=Math.max(c*h,0),p=new Uint8ClampedArray(u),d={data:p,width:c,height:h,glyphWidth:s,glyphHeight:l,glyphTop:a,glyphLeft:0,glyphAdvance:e};if(0===s||0===l)return d;const{ctx:m,buffer:f,gridInner:g,gridOuter:_}=this;m.clearRect(f,f,s,l),m.fillText(t,f,f+a);const y=m.getImageData(f,f,s,l);_.fill(E,0,u),g.fill(0,0,u);for(let t=0;t<l;t++)for(let e=0;e<s;e++){const i=y.data[4*(t*s+e)+3]/255;if(0===i)continue;const r=(t+f)*c+e+f;if(1===i)_[r]=0,g[r]=E;else{const t=.5-i;_[r]=t>0?t*t:0,g[r]=t<0?t*t:0}}T(_,0,0,c,h,c,this.f,this.v,this.z),T(g,f,f,s,l,c,this.f,this.v,this.z);for(let t=0;t<u;t++){const e=Math.sqrt(_[t])-Math.sqrt(g[t]);p[t]=Math.round(255-255*(e/this.radius+this.cutoff))}return d}};class I{constructor(){this.specification=t.v8Spec.light.position}possiblyEvaluate(e,i){return t.sphericalToCartesian(e.expression.evaluate(i))}interpolate(e,i,r){return{x:t.interpolate.number(e.x,i.x,r),y:t.interpolate.number(e.y,i.y,r),z:t.interpolate.number(e.z,i.z,r)}}}const A="-transition";let M,k;class z extends t.Evented{constructor(e){super(),M=M||new t.Properties({anchor:new t.DataConstantProperty(t.v8Spec.light.anchor),position:new I,color:new t.DataConstantProperty(t.v8Spec.light.color),intensity:new t.DataConstantProperty(t.v8Spec.light.intensity)}),this._transitionable=new t.Transitionable(M),this.setLight(e),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(e,i={}){if(!this._validate(t.validateLight,e,i))for(const t in e){const i=e[t];t.endsWith(A)?this._transitionable.setTransition(t.slice(0,-11),i):this._transitionable.setValue(t,i)}}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}_validate(e,i,r){return(!r||!1!==r.validate)&&t.emitValidationErrors(this,e.call(t.validateStyle,t.extend({value:i,style:{glyphs:!0,sprite:!0},styleSpec:t.v8Spec})))}}class P{constructor(t,e){this.width=t,this.height=e,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(t,e){const i=t.join(",")+String(e);return this.dashEntry[i]||(this.dashEntry[i]=this.addDash(t,e)),this.dashEntry[i]}getDashRanges(t,e,i){const r=[];let n=t.length%2==1?-t[t.length-1]*i:0,o=t[0]*i,a=!0;r.push({left:n,right:o,isDash:a,zeroLength:0===t[0]});let s=t[0];for(let e=1;e<t.length;e++){a=!a;const l=t[e];n=s*i,s+=l,o=s*i,r.push({left:n,right:o,isDash:a,zeroLength:0===l})}return r}addRoundDash(t,e,i){const r=e/2;for(let e=-i;e<=i;e++){const n=this.width*(this.nextRow+i+e);let o=0,a=t[o];for(let s=0;s<this.width;s++){s/a.right>1&&(a=t[++o]);const l=Math.abs(s-a.left),c=Math.abs(s-a.right),h=Math.min(l,c);let u;const p=e/i*(r+1);if(a.isDash){const t=r-Math.abs(p);u=Math.sqrt(h*h+t*t)}else u=r-Math.sqrt(h*h+p*p);this.data[n+s]=Math.max(0,Math.min(255,u+128))}}}addRegularDash(t){for(let e=t.length-1;e>=0;--e){const i=t[e],r=t[e+1];i.zeroLength?t.splice(e,1):r&&r.isDash===i.isDash&&(r.left=i.left,t.splice(e,1))}const e=t[0],i=t[t.length-1];e.isDash===i.isDash&&(e.left=i.left-this.width,i.right=e.right+this.width);const r=this.width*this.nextRow;let n=0,o=t[n];for(let e=0;e<this.width;e++){e/o.right>1&&(o=t[++n]);const i=Math.abs(e-o.left),a=Math.abs(e-o.right),s=Math.min(i,a);this.data[r+e]=Math.max(0,Math.min(255,(o.isDash?s:-s)+128))}}addDash(e,i){const r=i?7:0,n=2*r+1;if(this.nextRow+n>this.height)return t.warnOnce("LineAtlas out of space"),null;let o=0;for(let t=0;t<e.length;t++)o+=e[t];if(0!==o){const t=this.width/o,n=this.getDashRanges(e,this.width,t);i?this.addRoundDash(n,t,r):this.addRegularDash(n)}const a={y:(this.nextRow+r+.5)/this.height,height:2*r/this.height,width:o};return this.nextRow+=n,this.dirty=!0,a}bind(t){const e=t.gl;this.texture?(e.bindTexture(e.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,e.texSubImage2D(e.TEXTURE_2D,0,0,0,this.width,this.height,e.ALPHA,e.UNSIGNED_BYTE,this.data))):(this.texture=e.createTexture(),e.bindTexture(e.TEXTURE_2D,this.texture),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.REPEAT),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.REPEAT),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texImage2D(e.TEXTURE_2D,0,e.ALPHA,this.width,this.height,0,e.ALPHA,e.UNSIGNED_BYTE,this.data))}}class L{constructor(t,e,i){this.workerPool=t,this.actors=[],this.currentActor=0,this.id=i;const r=this.workerPool.acquire(i);for(let t=0;t<r.length;t++){const n=new L.Actor(r[t],e,i);n.name=`Worker ${t}`,this.actors.push(n)}if(!this.actors.length)throw new Error("No actors found")}broadcast(e,i,r){t.asyncAll(this.actors,((t,r)=>{t.send(e,i,r)}),r=r||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(t=!0){this.actors.forEach((t=>{t.remove()})),this.actors=[],t&&this.workerPool.release(this.id)}}function D(e,i,r){const n=function(i,n){if(i)return r(i);if(n){const i=t.pick(t.extend(n,e),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);n.vector_layers&&(i.vectorLayers=n.vector_layers,i.vectorLayerIds=i.vectorLayers.map((t=>t.id))),r(null,i)}};return e.url?t.getJSON(i.transformRequest(e.url,h.Source),n):t.exported.frame((()=>n(null,e)))}L.Actor=t.Actor;class R{constructor(t,e){t&&(e?this.setSouthWest(t).setNorthEast(e):Array.isArray(t)&&(4===t.length?this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]]):this.setSouthWest(t[0]).setNorthEast(t[1])))}setNorthEast(e){return this._ne=e instanceof t.LngLat?new t.LngLat(e.lng,e.lat):t.LngLat.convert(e),this}setSouthWest(e){return this._sw=e instanceof t.LngLat?new t.LngLat(e.lng,e.lat):t.LngLat.convert(e),this}extend(e){const i=this._sw,r=this._ne;let n,o;if(e instanceof t.LngLat)n=e,o=e;else{if(!(e instanceof R))return Array.isArray(e)?4===e.length||e.every(Array.isArray)?this.extend(R.convert(e)):this.extend(t.LngLat.convert(e)):e&&("lng"in e||"lon"in e)&&"lat"in e?this.extend(t.LngLat.convert(e)):this;if(n=e._sw,o=e._ne,!n||!o)return this}return i||r?(i.lng=Math.min(n.lng,i.lng),i.lat=Math.min(n.lat,i.lat),r.lng=Math.max(o.lng,r.lng),r.lat=Math.max(o.lat,r.lat)):(this._sw=new t.LngLat(n.lng,n.lat),this._ne=new t.LngLat(o.lng,o.lat)),this}getCenter(){return new t.LngLat((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 t.LngLat(this.getWest(),this.getNorth())}getSouthEast(){return new t.LngLat(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(e){const{lng:i,lat:r}=t.LngLat.convert(e);let n=this._sw.lng<=i&&i<=this._ne.lng;return this._sw.lng>this._ne.lng&&(n=this._sw.lng>=i&&i>=this._ne.lng),this._sw.lat<=r&&r<=this._ne.lat&&n}static convert(t){return t instanceof R?t:t?new R(t):t}static fromLngLat(e,i=0){const r=360*i/40075017,n=r/Math.cos(Math.PI/180*e.lat);return new R(new t.LngLat(e.lng-n,e.lat-r),new t.LngLat(e.lng+n,e.lat+r))}}class B{constructor(t,e,i){this.bounds=R.convert(this.validateBounds(t)),this.minzoom=e||0,this.maxzoom=i||24}validateBounds(t){return Array.isArray(t)&&4===t.length?[Math.max(-180,t[0]),Math.max(-90,t[1]),Math.min(180,t[2]),Math.min(90,t[3])]:[-180,-90,180,90]}contains(e){const i=Math.pow(2,e.z),r=Math.floor(t.mercatorXfromLng(this.bounds.getWest())*i),n=Math.floor(t.mercatorYfromLat(this.bounds.getNorth())*i),o=Math.ceil(t.mercatorXfromLng(this.bounds.getEast())*i),a=Math.ceil(t.mercatorYfromLat(this.bounds.getSouth())*i);return e.x>=r&&e.x<o&&e.y>=n&&e.y<a}}class F extends t.Evented{constructor(e,i,r,n){if(super(),this.id=e,this.dispatcher=r,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,t.extend(this,t.pick(i,["url","scheme","tileSize","promoteId"])),this._options=t.extend({type:"vector"},i),this._collectResourceTiming=i.collectResourceTiming,512!==this.tileSize)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(n)}load(){this._loaded=!1,this.fire(new t.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=D(this._options,this.map._requestManager,((e,i)=>{this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),e?this.fire(new t.ErrorEvent(e)):i&&(t.extend(this,i),i.bounds&&(this.tileBounds=new B(i.bounds,this.minzoom,this.maxzoom)),this.fire(new t.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new t.Event("data",{dataType:"source",sourceDataType:"content"})))}))}loaded(){return this._loaded}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}onAdd(t){this.map=t,this.load()}setSourceProperty(t){this._tileJSONRequest&&this._tileJSONRequest.cancel(),t(),this.load()}setTiles(t){return this.setSourceProperty((()=>{this._options.tiles=t})),this}setUrl(t){return this.setSourceProperty((()=>{this.url=t,this._options.url=t})),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return t.extend({},this._options)}loadTile(t,e){const i=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),r={request:this.map._requestManager.transformRequest(i,h.Tile),uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,tileSize:this.tileSize*t.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};function n(i,r){return delete t.request,t.aborted?e(null):i&&404!==i.status?e(i):(r&&r.resourceTiming&&(t.resourceTiming=r.resourceTiming),this.map._refreshExpiredTiles&&r&&t.setExpiryData(r),t.loadVectorData(r,this.map.painter),e(null),void(t.reloadCallback&&(this.loadTile(t,t.reloadCallback),t.reloadCallback=null)))}r.request.collectResourceTiming=this._collectResourceTiming,t.actor&&"expired"!==t.state?"loading"===t.state?t.reloadCallback=e:t.request=t.actor.send("reloadTile",r,n.bind(this)):(t.actor=this.dispatcher.getActor(),t.request=t.actor.send("loadTile",r,n.bind(this)))}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.actor&&t.actor.send("abortTile",{uid:t.uid,type:this.type,source:this.id},void 0)}unloadTile(t){t.unloadVectorData(),t.actor&&t.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id},void 0)}hasTransition(){return!1}}class O extends t.Evented{constructor(e,i,r,n){super(),this.id=e,this.dispatcher=r,this.setEventedParent(n),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=t.extend({type:"raster"},i),t.extend(this,t.pick(i,["url","scheme","tileSize"]))}load(){this._loaded=!1,this.fire(new t.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=D(this._options,this.map._requestManager,((e,i)=>{this._tileJSONRequest=null,this._loaded=!0,e?this.fire(new t.ErrorEvent(e)):i&&(t.extend(this,i),i.bounds&&(this.tileBounds=new B(i.bounds,this.minzoom,this.maxzoom)),this.fire(new t.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new t.Event("data",{dataType:"source",sourceDataType:"content"})))}))}loaded(){return this._loaded}onAdd(t){this.map=t,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return t.extend({},this._options)}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}loadTile(t,e){const i=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);t.request=u.getImage(this.map._requestManager.transformRequest(i,h.Tile),((i,r,n)=>{if(delete t.request,t.aborted)t.state="unloaded",e(null);else if(i)t.state="errored",e(i);else if(r){this.map._refreshExpiredTiles&&n&&t.setExpiryData(n);const i=this.map.painter.context,o=i.gl;t.texture=this.map.painter.getTileTexture(r.width),t.texture?t.texture.update(r,{useMipmap:!0}):(t.texture=new v(i,r,o.RGBA,{useMipmap:!0}),t.texture.bind(o.LINEAR,o.CLAMP_TO_EDGE,o.LINEAR_MIPMAP_NEAREST),i.extTextureFilterAnisotropic&&o.texParameterf(o.TEXTURE_2D,i.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,i.extTextureFilterAnisotropicMax)),t.state="loaded",e(null)}}),this.map._refreshExpiredTiles)}abortTile(t,e){t.request&&(t.request.cancel(),delete t.request),e()}unloadTile(t,e){t.texture&&this.map.painter.saveTileTexture(t.texture),e()}hasTransition(){return!1}}class U extends O{constructor(e,i,r,n){super(e,i,r,n),this.type="raster-dem",this.maxzoom=22,this._options=t.extend({type:"raster-dem"},i),this.encoding=i.encoding||"mapbox"}serialize(){return{type:"raster-dem",url:this.url,tileSize:this.tileSize,tiles:this.tiles,bounds:this.bounds,encoding:this.encoding}}loadTile(e,i){const r=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);function n(t,r){t&&(e.state="errored",i(t)),r&&(e.dem=r,e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0,e.state="loaded",i(null))}e.request=u.getImage(this.map._requestManager.transformRequest(r,h.Tile),function(r,o){if(delete e.request,e.aborted)e.state="unloaded",i(null);else if(r)e.state="errored",i(r);else if(o){this.map._refreshExpiredTiles&&e.setExpiryData(o),delete o.cacheControl,delete o.expires;const i=t.isImageBitmap(o)&&(null==k&&(k="undefined"!=typeof OffscreenCanvas&&new OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof createImageBitmap),k)?o:t.exported.getImageData(o,1),r={uid:e.uid,coord:e.tileID,source:this.id,rawImageData:i,encoding:this.encoding};e.actor&&"expired"!==e.state||(e.actor=this.dispatcher.getActor(),e.actor.send("loadDEMTile",r,n.bind(this)))}}.bind(this),this.map._refreshExpiredTiles),e.neighboringTiles=this._getNeighboringTiles(e.tileID)}_getNeighboringTiles(e){const i=e.canonical,r=Math.pow(2,i.z),n=(i.x-1+r)%r,o=0===i.x?e.wrap-1:e.wrap,a=(i.x+1+r)%r,s=i.x+1===r?e.wrap+1:e.wrap,l={};return l[new t.OverscaledTileID(e.overscaledZ,o,i.z,n,i.y).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,s,i.z,a,i.y).key]={backfilled:!1},i.y>0&&(l[new t.OverscaledTileID(e.overscaledZ,o,i.z,n,i.y-1).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,e.wrap,i.z,i.x,i.y-1).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,s,i.z,a,i.y-1).key]={backfilled:!1}),i.y+1<r&&(l[new t.OverscaledTileID(e.overscaledZ,o,i.z,n,i.y+1).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,e.wrap,i.z,i.x,i.y+1).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,s,i.z,a,i.y+1).key]={backfilled:!1}),l}unloadTile(t){t.demTexture&&this.map.painter.saveTileTexture(t.demTexture),t.fbo&&(t.fbo.destroy(),delete t.fbo),t.dem&&delete t.dem,delete t.neighboringTiles,t.state="unloaded",t.actor&&t.actor.send("removeDEMTile",{uid:t.uid,source:this.id})}}class V extends t.Evented{constructor(e,i,r,n){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=r.getActor(),this.setEventedParent(n),this._data=i.data,this._options=t.extend({},i),this._collectResourceTiming=i.collectResourceTiming,void 0!==i.maxzoom&&(this.maxzoom=i.maxzoom),i.type&&(this.type=i.type),i.attribution&&(this.attribution=i.attribution),this.promoteId=i.promoteId;const o=t.EXTENT/this.tileSize;this.workerOptions=t.extend({source:this.id,cluster:i.cluster||!1,geojsonVtOptions:{buffer:(void 0!==i.buffer?i.buffer:128)*o,tolerance:(void 0!==i.tolerance?i.tolerance:.375)*o,extent:t.EXTENT,maxZoom:this.maxzoom,lineMetrics:i.lineMetrics||!1,generateId:i.generateId||!1},superclusterOptions:{maxZoom:void 0!==i.clusterMaxZoom?i.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,i.clusterMinPoints||2),extent:t.EXTENT,radius:(i.clusterRadius||50)*o,log:!1,generateId:i.generateId||!1},clusterProperties:i.clusterProperties,filter:i.filter},i.workerOptions),"string"==typeof this.promoteId&&(this.workerOptions.promoteId=this.promoteId)}load(){this._updateWorkerData()}onAdd(t){this.map=t,this.load()}setData(t){return this._data=t,this._updateWorkerData(),this}updateData(t){return this._updateWorkerData(t),this}setClusterOptions(t){return this.workerOptions.cluster=t.cluster,t&&(void 0!==t.clusterRadius&&(this.workerOptions.superclusterOptions.radius=t.clusterRadius),void 0!==t.clusterMaxZoom&&(this.workerOptions.superclusterOptions.maxZoom=t.clusterMaxZoom)),this._updateWorkerData(),this}getClusterExpansionZoom(t,e){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:t,source:this.id},e),this}getClusterChildren(t,e){return this.actor.send("geojson.getClusterChildren",{clusterId:t,source:this.id},e),this}getClusterLeaves(t,e,i,r){return this.actor.send("geojson.getClusterLeaves",{source:this.id,clusterId:t,limit:e,offset:i},r),this}_updateWorkerData(e){const i=t.extend({},this.workerOptions);e?i.dataDiff=e:"string"==typeof this._data?(i.request=this.map._requestManager.transformRequest(t.exported.resolveURL(this._data),h.Source),i.request.collectResourceTiming=this._collectResourceTiming):i.data=JSON.stringify(this._data),this._pendingLoads++,this.fire(new t.Event("dataloading",{dataType:"source"})),this.actor.send(`${this.type}.loadData`,i,((e,i)=>{if(this._pendingLoads--,this._removed||i&&i.abandoned)return void this.fire(new t.Event("dataabort",{dataType:"source"}));let r=null;if(i&&i.resourceTiming&&i.resourceTiming[this.id]&&(r=i.resourceTiming[this.id].slice(0)),e)return void this.fire(new t.ErrorEvent(e));const n={dataType:"source"};this._collectResourceTiming&&r&&r.length>0&&t.extend(n,{resourceTiming:r}),this.fire(new t.Event("data",{...n,sourceDataType:"metadata"})),this.fire(new t.Event("data",{...n,sourceDataType:"content"}))}))}loaded(){return 0===this._pendingLoads}loadTile(t,e){const i=t.actor?"reloadTile":"loadTile";t.actor=this.actor;const r={type:this.type,uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};t.request=this.actor.send(i,r,((r,n)=>(delete t.request,t.unloadVectorData(),t.aborted?e(null):r?e(r):(t.loadVectorData(n,this.map.painter,"reloadTile"===i),e(null)))))}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.aborted=!0}unloadTile(t){t.unloadVectorData(),this.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id})}onRemove(){this._removed=!0,this.actor.send("removeSource",{type:this.type,source:this.id})}serialize(){return t.extend({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var N=t.createLayout([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class $ extends t.Evented{constructor(t,e,i,r){super(),this.id=t,this.dispatcher=i,this.coordinates=e.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(r),this.options=e}load(e,i){this._loaded=!1,this.fire(new t.Event("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=u.getImage(this.map._requestManager.transformRequest(this.url,h.Image),((r,n)=>{this._request=null,this._loaded=!0,r?this.fire(new t.ErrorEvent(r)):n&&(this.image=n,e&&(this.coordinates=e),i&&i(),this._finishLoading())}))}loaded(){return this._loaded}updateImage(t){return t.url?(this._request&&(this._request.cancel(),this._request=null),this.options.url=t.url,this.load(t.coordinates,(()=>{this.texture=null})),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new t.Event("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(t){this.map=t,this.load()}onRemove(){this._request&&(this._request.cancel(),this._request=null)}setCoordinates(e){this.coordinates=e;const i=e.map(t.MercatorCoordinate.fromLngLat);this.tileID=function(e){let i=1/0,r=1/0,n=-1/0,o=-1/0;for(const t of e)i=Math.min(i,t.x),r=Math.min(r,t.y),n=Math.max(n,t.x),o=Math.max(o,t.y);const a=Math.max(n-i,o-r),s=Math.max(0,Math.floor(-Math.log(a)/Math.LN2)),l=Math.pow(2,s);return new t.CanonicalTileID(s,Math.floor((i+n)/2*l),Math.floor((r+o)/2*l))}(i),this.minzoom=this.maxzoom=this.tileID.z;const r=i.map((t=>this.tileID.getTilePoint(t)._round()));return this._boundsArray=new t.RasterBoundsArray,this._boundsArray.emplaceBack(r[0].x,r[0].y,0,0),this._boundsArray.emplaceBack(r[1].x,r[1].y,t.EXTENT,0),this._boundsArray.emplaceBack(r[3].x,r[3].y,0,t.EXTENT),this._boundsArray.emplaceBack(r[2].x,r[2].y,t.EXTENT,t.EXTENT),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new t.Event("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(0===Object.keys(this.tiles).length||!this.image)return;const e=this.map.painter.context,i=e.gl;this.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,N.members)),this.boundsSegments||(this.boundsSegments=t.SegmentVector.simpleSegment(0,0,4,2)),this.texture||(this.texture=new v(e,this.image,i.RGBA),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE));let r=!1;for(const t in this.tiles){const e=this.tiles[t];"loaded"!==e.state&&(e.state="loaded",e.texture=this.texture,r=!0)}r&&this.fire(new t.Event("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(t,e){this.tileID&&this.tileID.equals(t.tileID.canonical)?(this.tiles[String(t.tileID.wrap)]=t,t.buckets={},e(null)):(t.state="errored",e(null))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class j extends ${constructor(t,e,i,r){super(t,e,i,r),this.roundZoom=!0,this.type="video",this.options=e}load(){this._loaded=!1;const e=this.options;this.urls=[];for(const t of e.urls)this.urls.push(this.map._requestManager.transformRequest(t,h.Source).url);t.getVideo(this.urls,((e,i)=>{this._loaded=!0,e?this.fire(new t.ErrorEvent(e)):i&&(this.video=i,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){const i=this.video.seekable;e<i.start(0)||e>i.end(0)?this.fire(new t.ErrorEvent(new t.ValidationError(`sources.${this.id}`,null,`Playback for this video can be set only between the ${i.start(0)} and ${i.end(0)}-second mark.`))):this.video.currentTime=e}}getVideo(){return this.video}onAdd(t){this.map||(this.map=t,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(0===Object.keys(this.tiles).length||this.video.readyState<2)return;const e=this.map.painter.context,i=e.gl;this.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,N.members)),this.boundsSegments||(this.boundsSegments=t.SegmentVector.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE),i.texSubImage2D(i.TEXTURE_2D,0,0,0,i.RGBA,i.UNSIGNED_BYTE,this.video)):(this.texture=new v(e,this.video,i.RGBA),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE));let r=!1;for(const t in this.tiles){const e=this.tiles[t];"loaded"!==e.state&&(e.state="loaded",e.texture=this.texture,r=!0)}r&&this.fire(new t.Event("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class q extends ${constructor(e,i,r,n){super(e,i,r,n),i.coordinates?Array.isArray(i.coordinates)&&4===i.coordinates.length&&!i.coordinates.some((t=>!Array.isArray(t)||2!==t.length||t.some((t=>"number"!=typeof t))))||this.fire(new t.ErrorEvent(new t.ValidationError(`sources.${e}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new t.ErrorEvent(new t.ValidationError(`sources.${e}`,null,'missing required property "coordinates"'))),i.animate&&"boolean"!=typeof i.animate&&this.fire(new t.ErrorEvent(new t.ValidationError(`sources.${e}`,null,'optional "animate" property must be a boolean value'))),i.canvas?"string"==typeof i.canvas||i.canvas instanceof HTMLCanvasElement||this.fire(new t.ErrorEvent(new t.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 t.ErrorEvent(new t.ValidationError(`sources.${e}`,null,'missing required property "canvas"'))),this.options=i,this.animate=void 0===i.animate||i.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 t.ErrorEvent(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())}getCanvas(){return this.canvas}onAdd(t){this.map=t,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let 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())return;if(0===Object.keys(this.tiles).length)return;const i=this.map.painter.context,r=i.gl;this.boundsBuffer||(this.boundsBuffer=i.createVertexBuffer(this._boundsArray,N.members)),this.boundsSegments||(this.boundsSegments=t.SegmentVector.simpleSegment(0,0,4,2)),this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new v(i,this.canvas,r.RGBA,{premultiply:!0});let n=!1;for(const t in this.tiles){const e=this.tiles[t];"loaded"!==e.state&&(e.state="loaded",e.texture=this.texture,n=!0)}n&&this.fire(new t.Event("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const t of[this.canvas.width,this.canvas.height])if(isNaN(t)||t<=0)return!0;return!1}}const Z={vector:F,raster:O,"raster-dem":U,geojson:V,video:j,image:$,canvas:q};function G(e,i){const r=t.create();return t.translate(r,r,[1,1,0]),t.scale(r,r,[.5*e.width,.5*e.height,1]),t.multiply(r,r,e.calculatePosMatrix(i.toUnwrapped()))}function H(t,e,i,r,n,o){const a=function(t,e,i){if(t)for(const r of t){const t=e[r];if(t&&t.source===i&&"fill-extrusion"===t.type)return!0}else for(const t in e){const r=e[t];if(r.source===i&&"fill-extrusion"===r.type)return!0}return!1}(n&&n.layers,e,t.id),s=o.maxPitchScaleFactor(),l=t.tilesIn(r,s,a);l.sort(X);const c=[];for(const r of l)c.push({wrappedTileID:r.tileID.wrapped().key,queryResults:r.tile.queryRenderedFeatures(e,i,t._state,r.queryGeometry,r.cameraQueryGeometry,r.scale,n,o,s,G(t.transform,r.tileID))});const h=function(t){const e={},i={};for(const r of t){const t=r.queryResults,n=r.wrappedTileID,o=i[n]=i[n]||{};for(const i in t){const r=t[i],n=o[i]=o[i]||{},a=e[i]=e[i]||[];for(const t of r)n[t.featureIndex]||(n[t.featureIndex]=!0,a.push(t))}}return e}(c);for(const e in h)h[e].forEach((e=>{const i=e.feature,r=t.getFeatureState(i.layer["source-layer"],i.id);i.source=i.layer.source,i.layer["source-layer"]&&(i.sourceLayer=i.layer["source-layer"]),i.state=r}));return h}function X(t,e){const i=t.tileID,r=e.tileID;return i.overscaledZ-r.overscaledZ||i.canonical.y-r.canonical.y||i.wrap-r.wrap||i.canonical.x-r.canonical.x}class W{constructor(e,i){this.timeAdded=0,this.fadeEndTime=0,this.tileID=e,this.uid=t.uniqueId(),this.uses=0,this.tileSize=i,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttCoords={},this.expiredRequestCount=0,this.state="loading"}registerFadeDuration(t){const e=t+this.timeAdded;e<this.fadeEndTime||(this.fadeEndTime=e)}wasRequested(){return"errored"===this.state||"loaded"===this.state||"reloading"===this.state}clearTextures(t){this.demTexture&&t.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(e,i,r){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(t,e){const i={};if(!e)return i;for(const r of t){const t=r.layerIds.map((t=>e.getLayer(t))).filter(Boolean);if(0!==t.length){r.layers=t,r.stateDependentLayerIds&&(r.stateDependentLayers=r.stateDependentLayerIds.map((e=>t.filter((t=>t.id===e))[0])));for(const e of t)i[e.id]=r}}return i}(e.buckets,i.style),this.hasSymbolBuckets=!1;for(const e in this.buckets){const i=this.buckets[e];if(i instanceof t.SymbolBucket){if(this.hasSymbolBuckets=!0,!r)break;i.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const e in this.buckets){const i=this.buckets[e];if(i instanceof t.SymbolBucket&&i.hasRTLText){this.hasRTLText=!0,t.lazyLoadRTLTextPlugin();break}}this.queryPadding=0;for(const t in this.buckets){const e=this.buckets[t];this.queryPadding=Math.max(this.queryPadding,i.style.getLayer(t).queryRadius(e))}e.imageAtlas&&(this.imageAtlas=e.imageAtlas),e.glyphAtlasImage&&(this.glyphAtlasImage=e.glyphAtlasImage)}else this.collisionBoxArray=new t.CollisionBoxArray}unloadVectorData(){for(const t in this.buckets)this.buckets[t].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(t){return this.buckets[t.id]}upload(t){for(const e in this.buckets){const i=this.buckets[e];i.uploadPending()&&i.upload(t)}const e=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new v(t,this.imageAtlas.image,e.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new v(t,this.glyphAtlasImage,e.ALPHA),this.glyphAtlasImage=null)}prepare(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture)}queryRenderedFeatures(t,e,i,r,n,o,a,s,l,c){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:r,cameraQueryGeometry:n,scale:o,tileSize:this.tileSize,pixelPosMatrix:c,transform:s,params:a,queryPadding:this.queryPadding*l},t,e,i):{}}querySourceFeatures(e,i){const r=this.latestFeatureIndex;if(!r||!r.rawTileData)return;const n=r.loadVTLayers(),o=i&&i.sourceLayer?i.sourceLayer:"",a=n._geojsonTileLayer||n[o];if(!a)return;const s=t.createFilter(i&&i.filter),{z:l,x:c,y:h}=this.tileID.canonical,u={z:l,x:c,y:h};for(let i=0;i<a.length;i++){const n=a.feature(i);if(s.needGeometry){const e=t.toEvaluationFeature(n,!0);if(!s.filter(new t.EvaluationParameters(this.tileID.overscaledZ),e,this.tileID.canonical))continue}else if(!s.filter(new t.EvaluationParameters(this.tileID.overscaledZ),n))continue;const p=r.getId(n,o),d=new t.GeoJSONFeature(n,l,c,h,p);d.tile=u,e.push(d)}}hasData(){return"loaded"===this.state||"reloading"===this.state||"expired"===this.state}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(e){const i=this.expirationTime;if(e.cacheControl){const i=t.parseCacheControl(e.cacheControl);i["max-age"]&&(this.expirationTime=Date.now()+1e3*i["max-age"])}else e.expires&&(this.expirationTime=new Date(e.expires).getTime());if(this.expirationTime){const t=Date.now();let e=!1;if(this.expirationTime>t)e=!1;else if(i)if(this.expirationTime<i)e=!0;else{const r=this.expirationTime-i;r?this.expirationTime=t+Math.max(r,3e4):e=!0}else e=!0;e?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-(new Date).getTime(),Math.pow(2,31)-1)}setFeatureState(t,e){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||0===Object.keys(t).length)return;const i=this.latestFeatureIndex.loadVTLayers();for(const r in this.buckets){if(!e.style.hasLayer(r))continue;const n=this.buckets[r],o=n.layers[0].sourceLayer||"_geojsonTileLayer",a=i[o],s=t[o];if(!a||!s||0===Object.keys(s).length)continue;n.update(s,a,this.imageAtlas&&this.imageAtlas.patternPositions||{});const l=e&&e.style&&e.style.getLayer(r);l&&(this.queryPadding=Math.max(this.queryPadding,l.queryRadius(n)))}}holdingForFade(){return void 0!==this.symbolFadeHoldUntil}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<t.exported.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(e){this.symbolFadeHoldUntil=t.exported.now()+e}setDependencies(t,e){const i={};for(const t of e)i[t]=!0;this.dependencies[t]=i}hasDependency(t,e){for(const i of t){const t=this.dependencies[i];if(t)for(const i of e)if(t[i])return!0}return!1}}class K{constructor(t,e){this.max=t,this.onRemove=e,this.reset()}reset(){for(const t in this.data)for(const e of this.data[t])e.timeout&&clearTimeout(e.timeout),this.onRemove(e.value);return this.data={},this.order=[],this}add(t,e,i){const r=t.wrapped().key;void 0===this.data[r]&&(this.data[r]=[]);const n={value:e,timeout:void 0};if(void 0!==i&&(n.timeout=setTimeout((()=>{this.remove(t,n)}),i)),this.data[r].push(n),this.order.push(r),this.order.length>this.max){const t=this._getAndRemoveByKey(this.order[0]);t&&this.onRemove(t)}return this}has(t){return t.wrapped().key in this.data}getAndRemove(t){return this.has(t)?this._getAndRemoveByKey(t.wrapped().key):null}_getAndRemoveByKey(t){const e=this.data[t].shift();return e.timeout&&clearTimeout(e.timeout),0===this.data[t].length&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),e.value}getByKey(t){const e=this.data[t];return e?e[0].value:null}get(t){return this.has(t)?this.data[t.wrapped().key][0].value:null}remove(t,e){if(!this.has(t))return this;const i=t.wrapped().key,r=void 0===e?0:this.data[i].indexOf(e),n=this.data[i][r];return this.data[i].splice(r,1),n.timeout&&clearTimeout(n.timeout),0===this.data[i].length&&delete this.data[i],this.onRemove(n.value),this.order.splice(this.order.indexOf(i),1),this}setMaxSize(t){for(this.max=t;this.order.length>this.max;){const t=this._getAndRemoveByKey(this.order[0]);t&&this.onRemove(t)}return this}filter(t){const e=[];for(const i in this.data)for(const r of this.data[i])t(r.value)||e.push(r);for(const t of e)this.remove(t.value.tileID,t)}}class Y{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(e,i,r){const n=String(i);if(this.stateChanges[e]=this.stateChanges[e]||{},this.stateChanges[e][n]=this.stateChanges[e][n]||{},t.extend(this.stateChanges[e][n],r),null===this.deletedStates[e]){this.deletedStates[e]={};for(const t in this.state[e])t!==n&&(this.deletedStates[e][t]=null)}else if(this.deletedStates[e]&&null===this.deletedStates[e][n]){this.deletedStates[e][n]={};for(const t in this.state[e][n])r[t]||(this.deletedStates[e][n][t]=null)}else for(const t in r)this.deletedStates[e]&&this.deletedStates[e][n]&&null===this.deletedStates[e][n][t]&&delete this.deletedStates[e][n][t]}removeFeatureState(t,e,i){if(null===this.deletedStates[t])return;const r=String(e);if(this.deletedStates[t]=this.deletedStates[t]||{},i&&void 0!==e)null!==this.deletedStates[t][r]&&(this.deletedStates[t][r]=this.deletedStates[t][r]||{},this.deletedStates[t][r][i]=null);else if(void 0!==e)if(this.stateChanges[t]&&this.stateChanges[t][r])for(i in this.deletedStates[t][r]={},this.stateChanges[t][r])this.deletedStates[t][r][i]=null;else this.deletedStates[t][r]=null;else this.deletedStates[t]=null}getState(e,i){const r=String(i),n=t.extend({},(this.state[e]||{})[r],(this.stateChanges[e]||{})[r]);if(null===this.deletedStates[e])return{};if(this.deletedStates[e]){const t=this.deletedStates[e][i];if(null===t)return{};for(const e in t)delete n[e]}return n}initializeTileState(t,e){t.setFeatureState(this.state,e)}coalesceChanges(e,i){const r={};for(const e in this.stateChanges){this.state[e]=this.state[e]||{};const i={};for(const r in this.stateChanges[e])this.state[e][r]||(this.state[e][r]={}),t.extend(this.state[e][r],this.stateChanges[e][r]),i[r]=this.state[e][r];r[e]=i}for(const e in this.deletedStates){this.state[e]=this.state[e]||{};const i={};if(null===this.deletedStates[e])for(const t in this.state[e])i[t]={},this.state[e][t]={};else for(const t in this.deletedStates[e]){if(null===this.deletedStates[e][t])this.state[e][t]={};else for(const i of Object.keys(this.deletedStates[e][t]))delete this.state[e][t][i];i[t]=this.state[e][t]}r[e]=r[e]||{},t.extend(r[e],i)}if(this.stateChanges={},this.deletedStates={},0!==Object.keys(r).length)for(const t in e)e[t].setFeatureState(r,i)}}class J extends t.Evented{constructor(e,i,r){super(),this.id=e,this.dispatcher=r,this.on("data",(t=>{"source"===t.dataType&&"metadata"===t.sourceDataType&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&"source"===t.dataType&&"content"===t.sourceDataType&&(this.reload(),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)})),this.on("dataloading",(()=>{this._sourceErrored=!1})),this.on("error",(()=>{this._sourceErrored=this._source.loaded()})),this._source=function(e,i,r,n){const o=new Z[i.type](e,i,r,n);if(o.id!==e)throw new Error(`Expected Source id to be ${e} instead of ${o.id}`);return t.bindAll(["load","abort","unload","serialize","prepare"],o),o}(e,i,r,this),this._tiles={},this._cache=new K(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new Y,this._didEmitContent=!1,this._updated=!1}onAdd(t){this.map=t,this._maxTileCacheSize=t?t._maxTileCacheSize:null,this._source&&this._source.onAdd&&this._source.onAdd(t)}onRemove(t){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(t)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded)return!1;if(!this._source.loaded())return!1;if(!(void 0===this.used&&void 0===this.usedForTerrain||this.used||this.usedForTerrain))return!0;if(!this._updated)return!1;for(const t in this._tiles){const e=this._tiles[t];if("loaded"!==e.state&&"errored"!==e.state)return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const t=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,t&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(t,e){return this._source.loadTile(t,e)}_unloadTile(t){if(this._source.unloadTile)return this._source.unloadTile(t,(()=>{}))}_abortTile(e){this._source.abortTile&&this._source.abortTile(e,(()=>{})),this._source.fire(new t.Event("dataabort",{tile:e,coord:e.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(t){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const e in this._tiles){const i=this._tiles[e];i.upload(t),i.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map((t=>t.tileID)).sort(Q).map((t=>t.key))}getRenderableIds(e){const i=[];for(const t in this._tiles)this._isIdRenderable(t,e)&&i.push(this._tiles[t]);return e?i.sort(((e,i)=>{const r=e.tileID,n=i.tileID,o=new t.Point(r.canonical.x,r.canonical.y)._rotate(this.transform.angle),a=new t.Point(n.canonical.x,n.canonical.y)._rotate(this.transform.angle);return r.overscaledZ-n.overscaledZ||a.y-o.y||a.x-o.x})).map((t=>t.tileID.key)):i.map((t=>t.tileID)).sort(Q).map((t=>t.key))}hasRenderableParent(t){const e=this.findLoadedParent(t,0);return!!e&&this._isIdRenderable(e.tileID.key)}_isIdRenderable(t,e){return this._tiles[t]&&this._tiles[t].hasData()&&!this._coveredTiles[t]&&(e||!this._tiles[t].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const t in this._tiles)"errored"!==this._tiles[t].state&&this._reloadTile(t,"reloading")}}_reloadTile(t,e){const i=this._tiles[t];i&&("loading"!==i.state&&(i.state=e),this._loadTile(i,this._tileLoaded.bind(this,i,t,e)))}_tileLoaded(e,i,r,n){if(n)return e.state="errored",void(404!==n.status?this._source.fire(new t.ErrorEvent(n,{tile:e})):this.update(this.transform,this.terrain));e.timeAdded=t.exported.now(),"expired"===r&&(e.refreshedUponExpiration=!0),this._setTileReloadTimer(i,e),"raster-dem"===this.getSource().type&&e.dem&&this._backfillDEM(e),this._state.initializeTileState(e,this.map?this.map.painter:null),e.aborted||this._source.fire(new t.Event("data",{dataType:"source",tile:e,coord:e.tileID}))}_backfillDEM(t){const e=this.getRenderableIds();for(let r=0;r<e.length;r++){const n=e[r];if(t.neighboringTiles&&t.neighboringTiles[n]){const e=this.getTileByID(n);i(t,e),i(e,t)}}function i(t,e){t.needsHillshadePrepare=!0,t.needsTerrainPrepare=!0;let i=e.tileID.canonical.x-t.tileID.canonical.x;const r=e.tileID.canonical.y-t.tileID.canonical.y,n=Math.pow(2,t.tileID.canonical.z),o=e.tileID.key;0===i&&0===r||Math.abs(r)>1||(Math.abs(i)>1&&(1===Math.abs(i+n)?i+=n:1===Math.abs(i-n)&&(i-=n)),e.dem&&t.dem&&(t.dem.backfillBorder(e.dem,i,r),t.neighboringTiles&&t.neighboringTiles[o]&&(t.neighboringTiles[o].backfilled=!0)))}}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._tiles[t]}_retainLoadedChildren(t,e,i,r){for(const n in this._tiles){let o=this._tiles[n];if(r[n]||!o.hasData()||o.tileID.overscaledZ<=e||o.tileID.overscaledZ>i)continue;let a=o.tileID;for(;o&&o.tileID.overscaledZ>e+1;){const t=o.tileID.scaledTo(o.tileID.overscaledZ-1);o=this._tiles[t.key],o&&o.hasData()&&(a=t)}let s=a;for(;s.overscaledZ>e;)if(s=s.scaledTo(s.overscaledZ-1),t[s.key]){r[a.key]=a;break}}}findLoadedParent(t,e){if(t.key in this._loadedParentTiles){const i=this._loadedParentTiles[t.key];return i&&i.tileID.overscaledZ>=e?i:null}for(let i=t.overscaledZ-1;i>=e;i--){const e=t.scaledTo(i),r=this._getLoadedTile(e);if(r)return r}}_getLoadedTile(t){const e=this._tiles[t.key];return e&&e.hasData()?e:this._cache.getByKey(t.wrapped().key)}updateCacheSize(t){const e=Math.ceil(t.width/this._source.tileSize)+1,i=Math.ceil(t.height/this._source.tileSize)+1,r=Math.floor(e*i*5),n="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,r):r;this._cache.setMaxSize(n)}handleWrapJump(t){const e=Math.round((t-(void 0===this._prevLng?t:this._prevLng))/360);if(this._prevLng=t,e){const t={};for(const i in this._tiles){const r=this._tiles[i];r.tileID=r.tileID.unwrapTo(r.tileID.wrap+e),t[r.tileID.key]=r}this._tiles=t;for(const t in this._timers)clearTimeout(this._timers[t]),delete this._timers[t];for(const t in this._tiles)this._setTileReloadTimer(t,this._tiles[t])}}update(e,i){if(this.transform=e,this.terrain=i,!this._sourceLoaded||this._paused)return;let r;this.updateCacheSize(e),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?r=e.getVisibleUnwrappedCoordinates(this._source.tileID).map((e=>new t.OverscaledTileID(e.canonical.z,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y))):(r=e.coveringTiles({tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:i}),this._source.hasTile&&(r=r.filter((t=>this._source.hasTile(t))))):r=[];const n=e.coveringZoomLevel(this._source),o=Math.max(n-J.maxOverzooming,this._source.minzoom),a=Math.max(n+J.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const t={};for(const e of r)if(e.canonical.z>this._source.minzoom){const i=e.scaledTo(e.canonical.z-1);t[i.key]=i;const r=e.scaledTo(Math.max(this._source.minzoom,Math.min(e.canonical.z,5)));t[r.key]=r}r=r.concat(Object.values(t))}const s=0===r.length&&!this._updated&&this._didEmitContent;this._updated=!0,s&&this.fire(new t.Event("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const l=this._updateRetainedTiles(r,n);if(tt(this._source.type)){const e={},s={},c=Object.keys(l),h=t.exported.now();for(const t of c){const i=l[t],r=this._tiles[t];if(!r||0!==r.fadeEndTime&&r.fadeEndTime<=h)continue;const n=this.findLoadedParent(i,o);n&&(this._addTile(n.tileID),e[n.tileID.key]=n.tileID),s[t]=i}this._retainLoadedChildren(s,n,a,l);for(const t in e)l[t]||(this._coveredTiles[t]=!0,l[t]=e[t]);if(i){const t={},e={};for(const i of r)this._tiles[i.key].hasData()?t[i.key]=i:e[i.key]=i;for(const i in e){const r=e[i].children(this._source.maxzoom);this._tiles[r[0].key]&&this._tiles[r[1].key]&&this._tiles[r[2].key]&&this._tiles[r[3].key]&&(t[r[0].key]=l[r[0].key]=r[0],t[r[1].key]=l[r[1].key]=r[1],t[r[2].key]=l[r[2].key]=r[2],t[r[3].key]=l[r[3].key]=r[3],delete e[i])}for(const i in e){const r=this.findLoadedParent(e[i],this._source.minzoom);if(r){t[r.tileID.key]=l[r.tileID.key]=r.tileID;for(const e in t)t[e].isChildOf(r.tileID)&&delete t[e]}}for(const e in this._tiles)t[e]||(this._coveredTiles[e]=!0)}}for(const t in l)this._tiles[t].clearFadeHold();const c=t.keysDifference(this._tiles,l);for(const t of c){const e=this._tiles[t];e.hasSymbolBuckets&&!e.holdingForFade()?e.setHoldDuration(this.map._fadeDuration):e.hasSymbolBuckets&&!e.symbolFadeFinished()||this._removeTile(t)}this._updateLoadedParentTileCache()}releaseSymbolFadeTiles(){for(const t in this._tiles)this._tiles[t].holdingForFade()&&this._removeTile(t)}_updateRetainedTiles(t,e){const i={},r={},n=Math.max(e-J.maxOverzooming,this._source.minzoom),o=Math.max(e+J.maxUnderzooming,this._source.minzoom),a={};for(const r of t){const t=this._addTile(r);i[r.key]=r,t.hasData()||e<this._source.maxzoom&&(a[r.key]=r)}this._retainLoadedChildren(a,e,o,i);for(const o of t){let t=this._tiles[o.key];if(t.hasData())continue;if(e+1>this._source.maxzoom){const t=o.children(this._source.maxzoom)[0],e=this.getTile(t);if(e&&e.hasData()){i[t.key]=t;continue}}else{const t=o.children(this._source.maxzoom);if(i[t[0].key]&&i[t[1].key]&&i[t[2].key]&&i[t[3].key])continue}let a=t.wasRequested();for(let e=o.overscaledZ-1;e>=n;--e){const n=o.scaledTo(e);if(r[n.key])break;if(r[n.key]=!0,t=this.getTile(n),!t&&a&&(t=this._addTile(n)),t){const e=t.hasData();if((a||e)&&(i[n.key]=n),a=t.wasRequested(),e)break}}}return i}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const t in this._tiles){const e=[];let i,r=this._tiles[t].tileID;for(;r.overscaledZ>0;){if(r.key in this._loadedParentTiles){i=this._loadedParentTiles[r.key];break}e.push(r.key);const t=r.scaledTo(r.overscaledZ-1);if(i=this._getLoadedTile(t),i)break;r=t}for(const t of e)this._loadedParentTiles[t]=i}}_addTile(e){let i=this._tiles[e.key];if(i)return i;i=this._cache.getAndRemove(e),i&&(this._setTileReloadTimer(e.key,i),i.tileID=e,this._state.initializeTileState(i,this.map?this.map.painter:null),this._cacheTimers[e.key]&&(clearTimeout(this._cacheTimers[e.key]),delete this._cacheTimers[e.key],this._setTileReloadTimer(e.key,i)));const r=i;return i||(i=new W(e,this._source.tileSize*e.overscaleFactor()),this._loadTile(i,this._tileLoaded.bind(this,i,e.key,i.state))),i.uses++,this._tiles[e.key]=i,r||this._source.fire(new t.Event("dataloading",{tile:i,coord:i.tileID,dataType:"source"})),i}_setTileReloadTimer(t,e){t in this._timers&&(clearTimeout(this._timers[t]),delete this._timers[t]);const i=e.getExpiryTimeout();i&&(this._timers[t]=setTimeout((()=>{this._reloadTile(t,"expired"),delete this._timers[t]}),i))}_removeTile(t){const e=this._tiles[t];e&&(e.uses--,delete this._tiles[t],this._timers[t]&&(clearTimeout(this._timers[t]),delete this._timers[t]),e.uses>0||(e.hasData()&&"reloading"!==e.state?this._cache.add(e.tileID,e,e.getExpiryTimeout()):(e.aborted=!0,this._abortTile(e),this._unloadTile(e))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const t in this._tiles)this._removeTile(t);this._cache.reset()}tilesIn(e,i,r){const n=[],o=this.transform;if(!o)return n;const a=r?o.getCameraQueryGeometry(e):e,s=e.map((t=>o.pointCoordinate(t,this.terrain))),l=a.map((t=>o.pointCoordinate(t,this.terrain))),c=this.getIds();let h=1/0,u=1/0,p=-1/0,d=-1/0;for(const t of l)h=Math.min(h,t.x),u=Math.min(u,t.y),p=Math.max(p,t.x),d=Math.max(d,t.y);for(let e=0;e<c.length;e++){const r=this._tiles[c[e]];if(r.holdingForFade())continue;const a=r.tileID,m=Math.pow(2,o.zoom-r.tileID.overscaledZ),f=i*r.queryPadding*t.EXTENT/r.tileSize/m,g=[a.getTilePoint(new t.MercatorCoordinate(h,u)),a.getTilePoint(new t.MercatorCoordinate(p,d))];if(g[0].x-f<t.EXTENT&&g[0].y-f<t.EXTENT&&g[1].x+f>=0&&g[1].y+f>=0){const t=s.map((t=>a.getTilePoint(t))),e=l.map((t=>a.getTilePoint(t)));n.push({tile:r,tileID:a,queryGeometry:t,cameraQueryGeometry:e,scale:m})}}return n}getVisibleCoordinates(t){const e=this.getRenderableIds(t).map((t=>this._tiles[t].tileID));for(const t of e)t.posMatrix=this.transform.calculatePosMatrix(t.toUnwrapped());return e}hasTransition(){if(this._source.hasTransition())return!0;if(tt(this._source.type)){const e=t.exported.now();for(const t in this._tiles)if(this._tiles[t].fadeEndTime>=e)return!0}return!1}setFeatureState(t,e,i){this._state.updateState(t=t||"_geojsonTileLayer",e,i)}removeFeatureState(t,e,i){this._state.removeFeatureState(t=t||"_geojsonTileLayer",e,i)}getFeatureState(t,e){return this._state.getState(t=t||"_geojsonTileLayer",e)}setDependencies(t,e,i){const r=this._tiles[t];r&&r.setDependencies(e,i)}reloadTilesForDependencies(t,e){for(const i in this._tiles)this._tiles[i].hasDependency(t,e)&&this._reloadTile(i,"reloading");this._cache.filter((i=>!i.hasDependency(t,e)))}}function Q(t,e){const i=Math.abs(2*t.wrap)-+(t.wrap<0),r=Math.abs(2*e.wrap)-+(e.wrap<0);return t.overscaledZ-e.overscaledZ||r-i||e.canonical.y-t.canonical.y||e.canonical.x-t.canonical.x}function tt(t){return"raster"===t||"image"===t||"video"===t}J.maxOverzooming=10,J.maxUnderzooming=3;const et="mapboxgl_preloaded_worker_pool";class it{constructor(){this.active={}}acquire(e){if(!this.workers)for(this.workers=[];this.workers.length<it.workerCount;)this.workers.push(new Worker(t.config.WORKER_URL));return this.active[e]=!0,this.workers.slice()}release(t){delete this.active[t],0===this.numActive()&&(this.workers.forEach((t=>{t.terminate()})),this.workers=null)}isPreloaded(){return!!this.active[et]}numActive(){return Object.keys(this.active).length}}const rt=Math.floor(t.exported.hardwareConcurrency/2);let nt;function ot(){return nt||(nt=new it),nt}it.workerCount=t.isSafari(globalThis)?Math.max(Math.min(rt,3),1):1;class at{constructor(t,e){this.reset(t,e)}reset(t,e){this.points=t||[],this._distances=[0];for(let t=1;t<this.points.length;t++)this._distances[t]=this._distances[t-1]+this.points[t].dist(this.points[t-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(e||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(e){if(1===this.points.length)return this.points[0];e=t.clamp(e,0,1);let i=1,r=this._distances[i];const n=e*this.paddedLength+this.padding;for(;r<n&&i<this._distances.length;)r=this._distances[++i];const o=i-1,a=this._distances[o],s=r-a,l=s>0?(n-a)/s:0;return this.points[o].mult(1-l).add(this.points[i].mult(l))}}function st(t,e){let i=!0;return"always"===t||"never"!==t&&"never"!==e||(i=!1),i}class lt{constructor(t,e,i){const r=this.boxCells=[],n=this.circleCells=[];this.xCellCount=Math.ceil(t/i),this.yCellCount=Math.ceil(e/i);for(let t=0;t<this.xCellCount*this.yCellCount;t++)r.push([]),n.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=t,this.height=e,this.xScale=this.xCellCount/t,this.yScale=this.yCellCount/e,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(t,e,i,r,n){this._forEachCell(e,i,r,n,this._insertBoxCell,this.boxUid++),this.boxKeys.push(t),this.bboxes.push(e),this.bboxes.push(i),this.bboxes.push(r),this.bboxes.push(n)}insertCircle(t,e,i,r){this._forEachCell(e-r,i-r,e+r,i+r,this._insertCircleCell,this.circleUid++),this.circleKeys.push(t),this.circles.push(e),this.circles.push(i),this.circles.push(r)}_insertBoxCell(t,e,i,r,n,o){this.boxCells[n].push(o)}_insertCircleCell(t,e,i,r,n,o){this.circleCells[n].push(o)}_query(t,e,i,r,n,o,a){if(i<0||t>this.width||r<0||e>this.height)return[];const s=[];if(t<=0&&e<=0&&this.width<=i&&this.height<=r){if(n)return[{key:null,x1:t,y1:e,x2:i,y2:r}];for(let t=0;t<this.boxKeys.length;t++)s.push({key:this.boxKeys[t],x1:this.bboxes[4*t],y1:this.bboxes[4*t+1],x2:this.bboxes[4*t+2],y2:this.bboxes[4*t+3]});for(let t=0;t<this.circleKeys.length;t++){const e=this.circles[3*t],i=this.circles[3*t+1],r=this.circles[3*t+2];s.push({key:this.circleKeys[t],x1:e-r,y1:i-r,x2:e+r,y2:i+r})}}else this._forEachCell(t,e,i,r,this._queryCell,s,{hitTest:n,overlapMode:o,seenUids:{box:{},circle:{}}},a);return s}query(t,e,i,r){return this._query(t,e,i,r,!1,null)}hitTest(t,e,i,r,n,o){return this._query(t,e,i,r,!0,n,o).length>0}hitTestCircle(t,e,i,r,n){const o=t-i,a=t+i,s=e-i,l=e+i;if(a<0||o>this.width||l<0||s>this.height)return!1;const c=[];return this._forEachCell(o,s,a,l,this._queryCellCircle,c,{hitTest:!0,overlapMode:r,circle:{x:t,y:e,radius:i},seenUids:{box:{},circle:{}}},n),c.length>0}_queryCell(t,e,i,r,n,o,a,s){const{seenUids:l,hitTest:c,overlapMode:h}=a,u=this.boxCells[n];if(null!==u){const n=this.bboxes;for(const a of u)if(!l.box[a]){l.box[a]=!0;const u=4*a,p=this.boxKeys[a];if(t<=n[u+2]&&e<=n[u+3]&&i>=n[u+0]&&r>=n[u+1]&&(!s||s(p))&&(!c||!st(h,p.overlapMode))&&(o.push({key:p,x1:n[u],y1:n[u+1],x2:n[u+2],y2:n[u+3]}),c))return!0}}const p=this.circleCells[n];if(null!==p){const n=this.circles;for(const a of p)if(!l.circle[a]){l.circle[a]=!0;const u=3*a,p=this.circleKeys[a];if(this._circleAndRectCollide(n[u],n[u+1],n[u+2],t,e,i,r)&&(!s||s(p))&&(!c||!st(h,p.overlapMode))){const t=n[u],e=n[u+1],i=n[u+2];if(o.push({key:p,x1:t-i,y1:e-i,x2:t+i,y2:e+i}),c)return!0}}}return!1}_queryCellCircle(t,e,i,r,n,o,a,s){const{circle:l,seenUids:c,overlapMode:h}=a,u=this.boxCells[n];if(null!==u){const t=this.bboxes;for(const e of u)if(!c.box[e]){c.box[e]=!0;const i=4*e,r=this.boxKeys[e];if(this._circleAndRectCollide(l.x,l.y,l.radius,t[i+0],t[i+1],t[i+2],t[i+3])&&(!s||s(r))&&!st(h,r.overlapMode))return o.push(!0),!0}}const p=this.circleCells[n];if(null!==p){const t=this.circles;for(const e of p)if(!c.circle[e]){c.circle[e]=!0;const i=3*e,r=this.circleKeys[e];if(this._circlesCollide(t[i],t[i+1],t[i+2],l.x,l.y,l.radius)&&(!s||s(r))&&!st(h,r.overlapMode))return o.push(!0),!0}}}_forEachCell(t,e,i,r,n,o,a,s){const l=this._convertToXCellCoord(t),c=this._convertToYCellCoord(e),h=this._convertToXCellCoord(i),u=this._convertToYCellCoord(r);for(let p=l;p<=h;p++)for(let l=c;l<=u;l++)if(n.call(this,t,e,i,r,this.xCellCount*l+p,o,a,s))return}_convertToXCellCoord(t){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(t*this.xScale)))}_convertToYCellCoord(t){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(t*this.yScale)))}_circlesCollide(t,e,i,r,n,o){const a=r-t,s=n-e,l=i+o;return l*l>a*a+s*s}_circleAndRectCollide(t,e,i,r,n,o,a){const s=(o-r)/2,l=Math.abs(t-(r+s));if(l>s+i)return!1;const c=(a-n)/2,h=Math.abs(e-(n+c));if(h>c+i)return!1;if(l<=s||h<=c)return!0;const u=l-s,p=h-c;return u*u+p*p<=i*i}}function ct(e,i,r,n,o){const a=t.create();return i?(t.scale(a,a,[1/o,1/o,1]),r||t.rotateZ(a,a,n.angle)):t.multiply(a,n.labelPlaneMatrix,e),a}function ht(e,i,r,n,o){if(i){const i=t.clone(e);return t.scale(i,i,[o,o,1]),r||t.rotateZ(i,i,-n.angle),i}return n.glCoordMatrix}function ut(e,i,r){let n;r?(n=[e.x,e.y,r(e.x,e.y),1],t.transformMat4(n,n,i)):(n=[e.x,e.y,0,1],St(n,n,i));const o=n[3];return{point:new t.Point(n[0]/o,n[1]/o),signedDistanceFromCamera:o}}function pt(t,e){return.5+t/e*.5}function dt(t,e){const i=t[0]/t[3],r=t[1]/t[3];return i>=-e[0]&&i<=e[0]&&r>=-e[1]&&r<=e[1]}function mt(e,i,r,n,o,a,s,l,c,h){const u=n?e.textSizeData:e.iconSizeData,p=t.evaluateSizeForZoom(u,r.transform.zoom),d=[256/r.width*2+1,256/r.height*2+1],m=n?e.text.dynamicLayoutVertexArray:e.icon.dynamicLayoutVertexArray;m.clear();const f=e.lineVertexArray,g=n?e.text.placedSymbolArray:e.icon.placedSymbolArray,_=r.transform.width/r.transform.height;let y=!1;for(let n=0;n<g.length;n++){const x=g.get(n);if(x.hidden||x.writingMode===t.WritingMode.vertical&&!y){Tt(x.numGlyphs,m);continue}let v;if(y=!1,h?(v=[x.anchorX,x.anchorY,h(x.anchorX,x.anchorY),1],t.transformMat4(v,v,i)):(v=[x.anchorX,x.anchorY,0,1],St(v,v,i)),!dt(v,d)){Tt(x.numGlyphs,m);continue}const b=pt(r.transform.cameraToCenterDistance,v[3]),w=t.evaluateSizeForFeature(u,p,x),E=s?w/b:w*b,T=new t.Point(x.anchorX,x.anchorY),S=ut(T,o,h).point,C={projections:{},offsets:{}},I=_t(x,E,!1,l,i,o,a,e.glyphOffsetArray,f,m,S,T,C,_,c,h);y=I.useVertical,(I.notEnoughRoom||y||I.needsFlipping&&_t(x,E,!0,l,i,o,a,e.glyphOffsetArray,f,m,S,T,C,_,c,h).notEnoughRoom)&&Tt(x.numGlyphs,m)}n?e.text.dynamicLayoutVertexBuffer.updateData(m):e.icon.dynamicLayoutVertexBuffer.updateData(m)}function ft(t,e,i,r,n,o,a,s,l,c,h,u,p){const d=s.glyphStartIndex+s.numGlyphs,m=s.lineStartIndex,f=s.lineStartIndex+s.lineLength,g=e.getoffsetX(s.glyphStartIndex),_=e.getoffsetX(d-1),y=wt(t*g,i,r,n,o,a,s.segment,m,f,l,c,h,u,p);if(!y)return null;const x=wt(t*_,i,r,n,o,a,s.segment,m,f,l,c,h,u,p);return x?{first:y,last:x}:null}function gt(e,i,r,n){return e===t.WritingMode.horizontal&&Math.abs(r.y-i.y)>Math.abs(r.x-i.x)*n?{useVertical:!0}:(e===t.WritingMode.vertical?i.y<r.y:i.x>r.x)?{needsFlipping:!0}:null}function _t(e,i,r,n,o,a,s,l,c,h,u,p,d,m,f,g){const _=i/24,y=e.lineOffsetX*_,x=e.lineOffsetY*_;let v;if(e.numGlyphs>1){const t=e.glyphStartIndex+e.numGlyphs,i=e.lineStartIndex,o=e.lineStartIndex+e.lineLength,h=ft(_,l,y,x,r,u,p,e,c,a,d,f,g);if(!h)return{notEnoughRoom:!0};const b=ut(h.first.point,s,g).point,w=ut(h.last.point,s,g).point;if(n&&!r){const t=gt(e.writingMode,b,w,m);if(t)return t}v=[h.first];for(let n=e.glyphStartIndex+1;n<t-1;n++)v.push(wt(_*l.getoffsetX(n),y,x,r,u,p,e.segment,i,o,c,a,d,f,g));v.push(h.last)}else{if(n&&!r){const i=ut(p,o,g).point,r=e.lineStartIndex+e.segment+1,n=new t.Point(c.getx(r),c.gety(r)),a=ut(n,o,g),s=a.signedDistanceFromCamera>0?a.point:yt(p,n,i,1,o,g),l=gt(e.writingMode,i,s,m);if(l)return l}const i=wt(_*l.getoffsetX(e.glyphStartIndex),y,x,r,u,p,e.segment,e.lineStartIndex,e.lineStartIndex+e.lineLength,c,a,d,f,g);if(!i)return{notEnoughRoom:!0};v=[i]}for(const e of v)t.addDynamicAttributes(h,e.point,e.angle);return{}}function yt(t,e,i,r,n,o){const a=ut(t.add(t.sub(e)._unit()),n,o).point,s=i.sub(a);return i.add(s._mult(r/s.mag()))}function xt(e,i){const{projectionCache:r,lineVertexArray:n,labelPlaneMatrix:o,tileAnchorPoint:a,distanceFromAnchor:s,getElevation:l,previousVertex:c,direction:h,absOffsetX:u}=i;if(r.projections[e])return r.projections[e];const p=new t.Point(n.getx(e),n.gety(e)),d=ut(p,o,l);if(d.signedDistanceFromCamera>0)return r.projections[e]=d.point,d.point;const m=e-h;return yt(0===s?a:new t.Point(n.getx(m),n.gety(m)),p,c,u-s+1,o,l)}function vt(t,e,i){return t._unit()._perp()._mult(e*i)}function bt(e,i,r,n,o,a,s,l){const{projectionCache:c,direction:h}=l;if(c.offsets[e])return c.offsets[e];const u=r.add(i);if(e+h<n||e+h>=o)return c.offsets[e]=u,u;const p=xt(e+h,l),d=vt(p.sub(r),s,h),m=r.add(d),f=p.add(d);return c.offsets[e]=t.findLineIntersection(a,u,m,f)||u,c.offsets[e]}function wt(t,e,i,r,n,o,a,s,l,c,h,u,p,d){const m=r?t-e:t+e;let f=m>0?1:-1,g=0;r&&(f*=-1,g=Math.PI),f<0&&(g+=Math.PI);let _,y,x=f>0?s+a:s+a+1,v=n,b=n,w=0,E=0;const T=Math.abs(m),S=[];let C;for(;w+E<=T;){if(x+=f,x<s||x>=l)return null;w+=E,b=v,y=_;const t={projectionCache:u,lineVertexArray:c,labelPlaneMatrix:h,tileAnchorPoint:o,distanceFromAnchor:w,getElevation:d,previousVertex:b,direction:f,absOffsetX:T};if(v=xt(x,t),0===i)S.push(b),C=v.sub(b);else{let e;const r=v.sub(b);e=0===r.mag()?vt(xt(x+f,t).sub(v),i,f):vt(r,i,f),y||(y=b.add(e)),_=bt(x,e,v,s,l,y,i,t),S.push(y),C=_.sub(y)}E=C.mag()}const I=C._mult((T-w)/E)._add(y||b),A=g+Math.atan2(v.y-b.y,v.x-b.x);return S.push(I),{point:I,angle:p?A:0,path:S}}const Et=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function Tt(t,e){for(let i=0;i<t;i++){const t=e.length;e.resize(t+4),e.float32.set(Et,3*t)}}function St(t,e,i){const r=e[0],n=e[1];return t[0]=i[0]*r+i[4]*n+i[12],t[1]=i[1]*r+i[5]*n+i[13],t[3]=i[3]*r+i[7]*n+i[15],t}const Ct=100;class It{constructor(t,e=new lt(t.width+200,t.height+200,25),i=new lt(t.width+200,t.height+200,25)){this.transform=t,this.grid=e,this.ignoredGrid=i,this.pitchfactor=Math.cos(t._pitch)*t.cameraToCenterDistance,this.screenRightBoundary=t.width+Ct,this.screenBottomBoundary=t.height+Ct,this.gridRightBoundary=t.width+200,this.gridBottomBoundary=t.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(t,e,i,r,n,o){const a=this.projectAndGetPerspectiveRatio(r,t.anchorPointX,t.anchorPointY,o),s=i*a.perspectiveRatio,l=t.x1*s+a.point.x,c=t.y1*s+a.point.y,h=t.x2*s+a.point.x,u=t.y2*s+a.point.y;return!this.isInsideGrid(l,c,h,u)||"always"!==e&&this.grid.hitTest(l,c,h,u,e,n)||a.perspectiveRatio<this.perspectiveRatioCutoff?{box:[],offscreen:!1}:{box:[l,c,h,u],offscreen:this.isOffscreen(l,c,h,u)}}placeCollisionCircles(e,i,r,n,o,a,s,l,c,h,u,p,d,m){const f=[],g=new t.Point(i.anchorX,i.anchorY),_=ut(g,a,m),y=pt(this.transform.cameraToCenterDistance,_.signedDistanceFromCamera),x=(h?o/y:o*y)/t.ONE_EM,v=ut(g,s,m).point,b=ft(x,n,i.lineOffsetX*x,i.lineOffsetY*x,!1,v,g,i,r,s,{projections:{},offsets:{}},!1,m);let w=!1,E=!1,T=!0;if(b){const i=.5*p*y+d,r=new t.Point(-100,-100),n=new t.Point(this.screenRightBoundary,this.screenBottomBoundary),o=new at,a=b.first,s=b.last;let h=[];for(let t=a.path.length-1;t>=1;t--)h.push(a.path[t]);for(let t=1;t<s.path.length;t++)h.push(s.path[t]);const g=2.5*i;if(l){const t=h.map((t=>ut(t,l,m)));h=t.some((t=>t.signedDistanceFromCamera<=0))?[]:t.map((t=>t.point))}let _=[];if(h.length>0){const e=h[0].clone(),i=h[0].clone();for(let t=1;t<h.length;t++)e.x=Math.min(e.x,h[t].x),e.y=Math.min(e.y,h[t].y),i.x=Math.max(i.x,h[t].x),i.y=Math.max(i.y,h[t].y);_=e.x>=r.x&&i.x<=n.x&&e.y>=r.y&&i.y<=n.y?[h]:i.x<r.x||e.x>n.x||i.y<r.y||e.y>n.y?[]:t.clipLine([h],r.x,r.y,n.x,n.y)}for(const t of _){o.reset(t,.25*i);let r=0;r=o.length<=.5*i?1:Math.ceil(o.paddedLength/g)+1;for(let t=0;t<r;t++){const n=t/Math.max(r-1,1),a=o.lerp(n),s=a.x+Ct,l=a.y+Ct;f.push(s,l,i,0);const h=s-i,p=l-i,d=s+i,m=l+i;if(T=T&&this.isOffscreen(h,p,d,m),E=E||this.isInsideGrid(h,p,d,m),"always"!==e&&this.grid.hitTestCircle(s,l,i,e,u)&&(w=!0,!c))return{circles:[],offscreen:!1,collisionDetected:w}}}}return{circles:!c&&w||!E||y<this.perspectiveRatioCutoff?[]:f,offscreen:T,collisionDetected:w}}queryRenderedSymbols(e){if(0===e.length||0===this.grid.keysLength()&&0===this.ignoredGrid.keysLength())return{};const i=[];let r=1/0,n=1/0,o=-1/0,a=-1/0;for(const s of e){const e=new t.Point(s.x+Ct,s.y+Ct);r=Math.min(r,e.x),n=Math.min(n,e.y),o=Math.max(o,e.x),a=Math.max(a,e.y),i.push(e)}const s=this.grid.query(r,n,o,a).concat(this.ignoredGrid.query(r,n,o,a)),l={},c={};for(const e of s){const r=e.key;if(void 0===l[r.bucketInstanceId]&&(l[r.bucketInstanceId]={}),l[r.bucketInstanceId][r.featureIndex])continue;const n=[new t.Point(e.x1,e.y1),new t.Point(e.x2,e.y1),new t.Point(e.x2,e.y2),new t.Point(e.x1,e.y2)];t.polygonIntersectsPolygon(i,n)&&(l[r.bucketInstanceId][r.featureIndex]=!0,void 0===c[r.bucketInstanceId]&&(c[r.bucketInstanceId]=[]),c[r.bucketInstanceId].push(r.featureIndex))}return c}insertCollisionBox(t,e,i,r,n,o){(i?this.ignoredGrid:this.grid).insert({bucketInstanceId:r,featureIndex:n,collisionGroupID:o,overlapMode:e},t[0],t[1],t[2],t[3])}insertCollisionCircles(t,e,i,r,n,o){const a=i?this.ignoredGrid:this.grid,s={bucketInstanceId:r,featureIndex:n,collisionGroupID:o,overlapMode:e};for(let e=0;e<t.length;e+=4)a.insertCircle(s,t[e],t[e+1],t[e+2])}projectAndGetPerspectiveRatio(e,i,r,n){let o;return n?(o=[i,r,n(i,r),1],t.transformMat4(o,o,e)):(o=[i,r,0,1],St(o,o,e)),{point:new t.Point((o[0]/o[3]+1)/2*this.transform.width+Ct,(-o[1]/o[3]+1)/2*this.transform.height+Ct),perspectiveRatio:.5+this.transform.cameraToCenterDistance/o[3]*.5}}isOffscreen(t,e,i,r){return i<Ct||t>=this.screenRightBoundary||r<Ct||e>this.screenBottomBoundary}isInsideGrid(t,e,i,r){return i>=0&&t<this.gridRightBoundary&&r>=0&&e<this.gridBottomBoundary}getViewportMatrix(){const e=t.identity([]);return t.translate(e,e,[-100,-100,0]),e}}function At(e,i,r){return i*(t.EXTENT/(e.tileSize*Math.pow(2,r-e.tileID.overscaledZ)))}class Mt{constructor(t,e,i,r){this.opacity=t?Math.max(0,Math.min(1,t.opacity+(t.placed?e:-e))):r&&i?1:0,this.placed=i}isHidden(){return 0===this.opacity&&!this.placed}}class kt{constructor(t,e,i,r,n){this.text=new Mt(t?t.text:null,e,i,n),this.icon=new Mt(t?t.icon:null,e,r,n)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class zt{constructor(t,e,i){this.text=t,this.icon=e,this.skipFade=i}}class Pt{constructor(){this.invProjMatrix=t.create(),this.viewportMatrix=t.create(),this.circles=[]}}class Lt{constructor(t,e,i,r,n){this.bucketInstanceId=t,this.featureIndex=e,this.sourceLayerIndex=i,this.bucketIndex=r,this.tileID=n}}class Dt{constructor(t){this.crossSourceCollisions=t,this.maxGroupID=0,this.collisionGroups={}}get(t){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[t]){const e=++this.maxGroupID;this.collisionGroups[t]={ID:e,predicate:t=>t.collisionGroupID===e}}return this.collisionGroups[t]}}function Rt(e,i,r,n,o){const{horizontalAlign:a,verticalAlign:s}=t.getAnchorAlignment(e),l=-(a-.5)*i,c=-(s-.5)*r,h=t.evaluateVariableOffset(e,n);return new t.Point(l+h[0]*o,c+h[1]*o)}function Bt(e,i,r,n,o,a){const{x1:s,x2:l,y1:c,y2:h,anchorPointX:u,anchorPointY:p}=e,d=new t.Point(i,r);return n&&d._rotate(o?a:-a),{x1:s+d.x,y1:c+d.y,x2:l+d.x,y2:h+d.y,anchorPointX:u,anchorPointY:p}}class Ft{constructor(t,e,i,r,n){this.transform=t.clone(),this.terrain=e,this.collisionIndex=new It(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=i,this.retainedQueryData={},this.collisionGroups=new Dt(r),this.collisionCircleArrays={},this.prevPlacement=n,n&&(n.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(e,i,r,n){const o=r.getBucket(i),a=r.latestFeatureIndex;if(!o||!a||i.id!==o.layerIds[0])return;const s=r.collisionBoxArray,l=o.layers[0].layout,c=Math.pow(2,this.transform.zoom-r.tileID.overscaledZ),h=r.tileSize/t.EXTENT,u=this.transform.calculatePosMatrix(r.tileID.toUnwrapped()),p="map"===l.get("text-pitch-alignment"),d="map"===l.get("text-rotation-alignment"),m=At(r,1,this.transform.zoom),f=ct(u,p,d,this.transform,m);let g=null;if(p){const e=ht(u,p,d,this.transform,m);g=t.multiply([],this.transform.labelPlaneMatrix,e)}this.retainedQueryData[o.bucketInstanceId]=new Lt(o.bucketInstanceId,a,o.sourceLayerIndex,o.index,r.tileID);const _={bucket:o,layout:l,posMatrix:u,textLabelPlaneMatrix:f,labelToScreenMatrix:g,scale:c,textPixelRatio:h,holdingForFade:r.holdingForFade(),collisionBoxArray:s,partiallyEvaluatedTextSize:t.evaluateSizeForZoom(o.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(o.sourceID)};if(n)for(const t of o.sortKeyRanges){const{sortKey:i,symbolInstanceStart:r,symbolInstanceEnd:n}=t;e.push({sortKey:i,symbolInstanceStart:r,symbolInstanceEnd:n,parameters:_})}else e.push({symbolInstanceStart:0,symbolInstanceEnd:o.symbolInstances.length,parameters:_})}attemptAnchorPlacement(t,e,i,r,n,o,a,s,l,c,h,u,p,d,m,f){const g=[u.textOffset0,u.textOffset1],_=Rt(t,i,r,g,n),y=this.collisionIndex.placeCollisionBox(Bt(e,_.x,_.y,o,a,this.transform.angle),h,s,l,c.predicate,f);if((!m||0!==this.collisionIndex.placeCollisionBox(Bt(m,_.x,_.y,o,a,this.transform.angle),h,s,l,c.predicate,f).box.length)&&y.box.length>0){let e;if(this.prevPlacement&&this.prevPlacement.variableOffsets[u.crossTileID]&&this.prevPlacement.placements[u.crossTileID]&&this.prevPlacement.placements[u.crossTileID].text&&(e=this.prevPlacement.variableOffsets[u.crossTileID].anchor),0===u.crossTileID)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[u.crossTileID]={textOffset:g,width:i,height:r,anchor:t,textBoxScale:n,prevAnchor:e},this.markUsedJustification(p,t,u,d),p.allowVerticalPlacement&&(this.markUsedOrientation(p,d,u),this.placedOrientations[u.crossTileID]=d),{shift:_,placedGlyphBoxes:y}}}placeLayerBucketPart(e,i,r){const{bucket:n,layout:o,posMatrix:a,textLabelPlaneMatrix:s,labelToScreenMatrix:l,textPixelRatio:c,holdingForFade:h,collisionBoxArray:u,partiallyEvaluatedTextSize:p,collisionGroup:d}=e.parameters,m=o.get("text-optional"),f=o.get("icon-optional"),g=t.getOverlapMode(o,"text-overlap","text-allow-overlap"),_="always"===g,y=t.getOverlapMode(o,"icon-overlap","icon-allow-overlap"),x="always"===y,v="map"===o.get("text-rotation-alignment"),b="map"===o.get("text-pitch-alignment"),w="none"!==o.get("icon-text-fit"),E="viewport-y"===o.get("symbol-z-order"),T=_&&(x||!n.hasIconData()||f),S=x&&(_||!n.hasTextData()||m);!n.collisionArrays&&u&&n.deserializeCollisionBoxes(u);const C=this.retainedQueryData[n.bucketInstanceId].tileID,I=this.terrain?(t,e)=>this.terrain.getElevation(C,t,e):null,A=(e,u)=>{if(i[e.crossTileID])return;if(h)return void(this.placements[e.crossTileID]=new zt(!1,!1,!1));let x=!1,E=!1,C=!0,A=null,M={box:null,offscreen:null},k={box:null,offscreen:null},z=null,P=null,L=null,D=0,R=0,B=0;u.textFeatureIndex?D=u.textFeatureIndex:e.useRuntimeCollisionCircles&&(D=e.featureIndex),u.verticalTextFeatureIndex&&(R=u.verticalTextFeatureIndex);const F=u.textBox;if(F){const i=i=>{let r=t.WritingMode.horizontal;if(n.allowVerticalPlacement&&!i&&this.prevPlacement){const t=this.prevPlacement.placedOrientations[e.crossTileID];t&&(this.placedOrientations[e.crossTileID]=t,r=t,this.markUsedOrientation(n,r,e))}return r},r=(i,r)=>{if(n.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&u.verticalTextBox){for(const e of n.writingModes)if(e===t.WritingMode.vertical?(M=r(),k=M):M=i(),M&&M.box&&M.box.length)break}else M=i()};if(o.get("text-variable-anchor")){let s=o.get("text-variable-anchor");if(this.prevPlacement&&this.prevPlacement.variableOffsets[e.crossTileID]){const t=this.prevPlacement.variableOffsets[e.crossTileID];s.indexOf(t.anchor)>0&&(s=s.filter((e=>e!==t.anchor)),s.unshift(t.anchor))}const l=(t,i,r)=>{const o=t.x2-t.x1,l=t.y2-t.y1,h=e.textBoxScale,u=w&&"never"===y?i:null;let p={box:[],offscreen:!1};const m="never"!==g?2*s.length:s.length;for(let i=0;i<m;++i){const m=this.attemptAnchorPlacement(s[i%s.length],t,o,l,h,v,b,c,a,d,i>=s.length?g:"never",e,n,r,u,I);if(m&&(p=m.placedGlyphBoxes,p&&p.box&&p.box.length)){x=!0,A=m.shift;break}}return p};r((()=>l(F,u.iconBox,t.WritingMode.horizontal)),(()=>{const i=u.verticalTextBox;return n.allowVerticalPlacement&&!(M&&M.box&&M.box.length)&&e.numVerticalGlyphVertices>0&&i?l(i,u.verticalIconBox,t.WritingMode.vertical):{box:null,offscreen:null}})),M&&(x=M.box,C=M.offscreen);const h=i(M&&M.box);if(!x&&this.prevPlacement){const t=this.prevPlacement.variableOffsets[e.crossTileID];t&&(this.variableOffsets[e.crossTileID]=t,this.markUsedJustification(n,t.anchor,e,h))}}else{const o=(t,i)=>{const r=this.collisionIndex.placeCollisionBox(t,g,c,a,d.predicate,I);return r&&r.box&&r.box.length&&(this.markUsedOrientation(n,i,e),this.placedOrientations[e.crossTileID]=i),r};r((()=>o(F,t.WritingMode.horizontal)),(()=>{const i=u.verticalTextBox;return n.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&i?o(i,t.WritingMode.vertical):{box:null,offscreen:null}})),i(M&&M.box&&M.box.length)}}if(z=M,x=z&&z.box&&z.box.length>0,C=z&&z.offscreen,e.useRuntimeCollisionCircles){const i=n.text.placedSymbolArray.get(e.centerJustifiedTextSymbolIndex),c=t.evaluateSizeForFeature(n.textSizeData,p,i),h=o.get("text-padding");P=this.collisionIndex.placeCollisionCircles(g,i,n.lineVertexArray,n.glyphOffsetArray,c,a,s,l,r,b,d.predicate,e.collisionCircleDiameter,h,I),P.circles.length&&P.collisionDetected&&!r&&t.warnOnce("Collisions detected, but collision boxes are not shown"),x=_||P.circles.length>0&&!P.collisionDetected,C=C&&P.offscreen}if(u.iconFeatureIndex&&(B=u.iconFeatureIndex),u.iconBox){const t=t=>{const e=w&&A?Bt(t,A.x,A.y,v,b,this.transform.angle):t;return this.collisionIndex.placeCollisionBox(e,y,c,a,d.predicate,I)};k&&k.box&&k.box.length&&u.verticalIconBox?(L=t(u.verticalIconBox),E=L.box.length>0):(L=t(u.iconBox),E=L.box.length>0),C=C&&L.offscreen}const O=m||0===e.numHorizontalGlyphVertices&&0===e.numVerticalGlyphVertices,U=f||0===e.numIconVertices;if(O||U?U?O||(E=E&&x):x=E&&x:E=x=E&&x,x&&z&&z.box&&this.collisionIndex.insertCollisionBox(z.box,g,o.get("text-ignore-placement"),n.bucketInstanceId,k&&k.box&&R?R:D,d.ID),E&&L&&this.collisionIndex.insertCollisionBox(L.box,y,o.get("icon-ignore-placement"),n.bucketInstanceId,B,d.ID),P&&(x&&this.collisionIndex.insertCollisionCircles(P.circles,g,o.get("text-ignore-placement"),n.bucketInstanceId,D,d.ID),r)){const t=n.bucketInstanceId;let e=this.collisionCircleArrays[t];void 0===e&&(e=this.collisionCircleArrays[t]=new Pt);for(let t=0;t<P.circles.length;t+=4)e.circles.push(P.circles[t+0]),e.circles.push(P.circles[t+1]),e.circles.push(P.circles[t+2]),e.circles.push(P.collisionDetected?1:0)}if(0===e.crossTileID)throw new Error("symbolInstance.crossTileID can't be 0");if(0===n.bucketInstanceId)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[e.crossTileID]=new zt(x||T,E||S,C||n.justReloaded),i[e.crossTileID]=!0};if(E){if(0!==e.symbolInstanceStart)throw new Error("bucket.bucketInstanceId should be 0");const t=n.getSortedSymbolIndexes(this.transform.angle);for(let e=t.length-1;e>=0;--e){const i=t[e];A(n.symbolInstances.get(i),n.collisionArrays[i])}}else for(let t=e.symbolInstanceStart;t<e.symbolInstanceEnd;t++)A(n.symbolInstances.get(t),n.collisionArrays[t]);if(r&&n.bucketInstanceId in this.collisionCircleArrays){const e=this.collisionCircleArrays[n.bucketInstanceId];t.invert(e.invProjMatrix,a),e.viewportMatrix=this.collisionIndex.getViewportMatrix()}n.justReloaded=!1}markUsedJustification(e,i,r,n){let o;o=n===t.WritingMode.vertical?r.verticalPlacedTextSymbolIndex:{left:r.leftJustifiedTextSymbolIndex,center:r.centerJustifiedTextSymbolIndex,right:r.rightJustifiedTextSymbolIndex}[t.getAnchorJustification(i)];const a=[r.leftJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.rightJustifiedTextSymbolIndex,r.verticalPlacedTextSymbolIndex];for(const t of a)t>=0&&(e.text.placedSymbolArray.get(t).crossTileID=o>=0&&t!==o?0:r.crossTileID)}markUsedOrientation(e,i,r){const n=i===t.WritingMode.horizontal||i===t.WritingMode.horizontalOnly?i:0,o=i===t.WritingMode.vertical?i:0,a=[r.leftJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.rightJustifiedTextSymbolIndex];for(const t of a)e.text.placedSymbolArray.get(t).placedOrientation=n;r.verticalPlacedTextSymbolIndex&&(e.text.placedSymbolArray.get(r.verticalPlacedTextSymbolIndex).placedOrientation=o)}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;const e=this.prevPlacement;let i=!1;this.prevZoomAdjustment=e?e.zoomAdjustment(this.transform.zoom):0;const r=e?e.symbolFadeChange(t):1,n=e?e.opacities:{},o=e?e.variableOffsets:{},a=e?e.placedOrientations:{};for(const t in this.placements){const e=this.placements[t],o=n[t];o?(this.opacities[t]=new kt(o,r,e.text,e.icon),i=i||e.text!==o.text.placed||e.icon!==o.icon.placed):(this.opacities[t]=new kt(null,r,e.text,e.icon,e.skipFade),i=i||e.text||e.icon)}for(const t in n){const e=n[t];if(!this.opacities[t]){const n=new kt(e,r,!1,!1);n.isHidden()||(this.opacities[t]=n,i=i||e.text.placed||e.icon.placed)}}for(const t in o)this.variableOffsets[t]||!this.opacities[t]||this.opacities[t].isHidden()||(this.variableOffsets[t]=o[t]);for(const t in a)this.placedOrientations[t]||!this.opacities[t]||this.opacities[t].isHidden()||(this.placedOrientations[t]=a[t]);if(e&&void 0===e.lastPlacementChangeTime)throw new Error("Last placement time for previous placement is not defined");i?this.lastPlacementChangeTime=t:"number"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=e?e.lastPlacementChangeTime:t)}updateLayerOpacities(t,e){const i={};for(const r of e){const e=r.getBucket(t);e&&r.latestFeatureIndex&&t.id===e.layerIds[0]&&this.updateBucketOpacities(e,i,r.collisionBoxArray)}}updateBucketOpacities(e,i,r){e.hasTextData()&&(e.text.opacityVertexArray.clear(),e.text.hasVisibleVertices=!1),e.hasIconData()&&(e.icon.opacityVertexArray.clear(),e.icon.hasVisibleVertices=!1),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexArray.clear(),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexArray.clear();const n=e.layers[0].layout,o=new kt(null,0,!1,!1,!0),a=n.get("text-allow-overlap"),s=n.get("icon-allow-overlap"),l=n.get("text-variable-anchor"),c="map"===n.get("text-rotation-alignment"),h="map"===n.get("text-pitch-alignment"),u="none"!==n.get("icon-text-fit"),p=new kt(null,0,a&&(s||!e.hasIconData()||n.get("icon-optional")),s&&(a||!e.hasTextData()||n.get("text-optional")),!0);!e.collisionArrays&&r&&(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData())&&e.deserializeCollisionBoxes(r);const d=(t,e,i)=>{for(let r=0;r<e/4;r++)t.opacityVertexArray.emplaceBack(i);t.hasVisibleVertices=t.hasVisibleVertices||i!==Ht};for(let r=0;r<e.symbolInstances.length;r++){const n=e.symbolInstances.get(r),{numHorizontalGlyphVertices:a,numVerticalGlyphVertices:s,crossTileID:m}=n;let f=this.opacities[m];i[m]?f=o:f||(f=p,this.opacities[m]=f),i[m]=!0;const g=n.numIconVertices>0,_=this.placedOrientations[n.crossTileID],y=_===t.WritingMode.vertical,x=_===t.WritingMode.horizontal||_===t.WritingMode.horizontalOnly;if(a>0||s>0){const t=Gt(f.text);d(e.text,a,y?Ht:t),d(e.text,s,x?Ht:t);const i=f.text.isHidden();[n.rightJustifiedTextSymbolIndex,n.centerJustifiedTextSymbolIndex,n.leftJustifiedTextSymbolIndex].forEach((t=>{t>=0&&(e.text.placedSymbolArray.get(t).hidden=i||y?1:0)})),n.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(n.verticalPlacedTextSymbolIndex).hidden=i||x?1:0);const r=this.variableOffsets[n.crossTileID];r&&this.markUsedJustification(e,r.anchor,n,_);const o=this.placedOrientations[n.crossTileID];o&&(this.markUsedJustification(e,"left",n,o),this.markUsedOrientation(e,o,n))}if(g){const t=Gt(f.icon),i=!(u&&n.verticalPlacedIconSymbolIndex&&y);n.placedIconSymbolIndex>=0&&(d(e.icon,n.numIconVertices,i?t:Ht),e.icon.placedSymbolArray.get(n.placedIconSymbolIndex).hidden=f.icon.isHidden()),n.verticalPlacedIconSymbolIndex>=0&&(d(e.icon,n.numVerticalIconVertices,i?Ht:t),e.icon.placedSymbolArray.get(n.verticalPlacedIconSymbolIndex).hidden=f.icon.isHidden())}if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){const i=e.collisionArrays[r];if(i){let r=new t.Point(0,0);if(i.textBox||i.verticalTextBox){let t=!0;if(l){const e=this.variableOffsets[m];e?(r=Rt(e.anchor,e.width,e.height,e.textOffset,e.textBoxScale),c&&r._rotate(h?this.transform.angle:-this.transform.angle)):t=!1}i.textBox&&Ot(e.textCollisionBox.collisionVertexArray,f.text.placed,!t||y,r.x,r.y),i.verticalTextBox&&Ot(e.textCollisionBox.collisionVertexArray,f.text.placed,!t||x,r.x,r.y)}const n=Boolean(!x&&i.verticalIconBox);i.iconBox&&Ot(e.iconCollisionBox.collisionVertexArray,f.icon.placed,n,u?r.x:0,u?r.y:0),i.verticalIconBox&&Ot(e.iconCollisionBox.collisionVertexArray,f.icon.placed,!n,u?r.x:0,u?r.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.text.opacityVertexArray.length!==e.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${e.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${e.text.layoutVertexArray.length}) / 4`);if(e.icon.opacityVertexArray.length!==e.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${e.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${e.icon.layoutVertexArray.length}) / 4`);if(e.bucketInstanceId in this.collisionCircleArrays){const t=this.collisionCircleArrays[e.bucketInstanceId];e.placementInvProjMatrix=t.invProjMatrix,e.placementViewportMatrix=t.viewportMatrix,e.collisionCircleArray=t.circles,delete this.collisionCircleArrays[e.bucketInstanceId]}}symbolFadeChange(t){return 0===this.fadeDuration?1:(t-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(t){return Math.max(0,(this.transform.zoom-t)/1.5)}hasTransitions(t){return this.stale||t-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(t,e){const i=this.zoomAtLastRecencyCheck===e?1-this.zoomAdjustment(e):1;return this.zoomAtLastRecencyCheck=e,this.commitTime+this.fadeDuration*i>t}setStale(){this.stale=!0}}function Ot(t,e,i,r,n){t.emplaceBack(e?1:0,i?1:0,r||0,n||0),t.emplaceBack(e?1:0,i?1:0,r||0,n||0),t.emplaceBack(e?1:0,i?1:0,r||0,n||0),t.emplaceBack(e?1:0,i?1:0,r||0,n||0)}const Ut=Math.pow(2,25),Vt=Math.pow(2,24),Nt=Math.pow(2,17),$t=Math.pow(2,16),jt=Math.pow(2,9),qt=Math.pow(2,8),Zt=Math.pow(2,1);function Gt(t){if(0===t.opacity&&!t.placed)return 0;if(1===t.opacity&&t.placed)return 4294967295;const e=t.placed?1:0,i=Math.floor(127*t.opacity);return i*Ut+e*Vt+i*Nt+e*$t+i*jt+e*qt+i*Zt+e}const Ht=0;class Xt{constructor(t){this._sortAcrossTiles="viewport-y"!==t.layout.get("symbol-z-order")&&!t.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(t,e,i,r,n){const o=this._bucketParts;for(;this._currentTileIndex<t.length;)if(e.getBucketParts(o,r,t[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,n())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,o.sort(((t,e)=>t.sortKey-e.sortKey)));this._currentPartIndex<o.length;)if(e.placeLayerBucketPart(o[this._currentPartIndex],this._seenCrossTileIDs,i),this._currentPartIndex++,n())return!0;return!1}}class Wt{constructor(t,e,i,r,n,o,a,s){this.placement=new Ft(t,e,o,a,s),this._currentPlacementIndex=i.length-1,this._forceFullPlacement=r,this._showCollisionBoxes=n,this._done=!1}isDone(){return this._done}continuePlacement(e,i,r){const n=t.exported.now(),o=()=>!this._forceFullPlacement&&t.exported.now()-n>2;for(;this._currentPlacementIndex>=0;){const t=i[e[this._currentPlacementIndex]],n=this.placement.collisionIndex.transform.zoom;if("symbol"===t.type&&(!t.minzoom||t.minzoom<=n)&&(!t.maxzoom||t.maxzoom>n)){if(this._inProgressLayer||(this._inProgressLayer=new Xt(t)),this._inProgressLayer.continuePlacement(r[t.source],this.placement,this._showCollisionBoxes,t,o))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(t){return this.placement.commit(t),this.placement}}const Kt=512/t.EXTENT/2;class Yt{constructor(e,i,r){this.tileID=e,this.bucketInstanceId=r,this._symbolsByKey={};const n=new Map;for(let t=0;t<i.length;t++){const e=i.get(t),r=e.key,o=n.get(r);o?o.push(e):n.set(r,[e])}for(const[e,i]of n){const r={positions:i.map((t=>({x:Math.floor(t.anchorX*Kt),y:Math.floor(t.anchorY*Kt)}))),crossTileIDs:i.map((t=>t.crossTileID))};if(r.positions.length>128){const e=new t.KDBush(r.positions.length,16,Uint16Array);for(const{x:t,y:i}of r.positions)e.add(t,i);e.finish(),delete r.positions,r.index=e}this._symbolsByKey[e]=r}}getScaledCoordinates(e,i){const{x:r,y:n,z:o}=this.tileID.canonical,{x:a,y:s,z:l}=i.canonical,c=Kt/Math.pow(2,l-o),h=(s*t.EXTENT+e.anchorY)*c,u=n*t.EXTENT*Kt;return{x:Math.floor((a*t.EXTENT+e.anchorX)*c-r*t.EXTENT*Kt),y:Math.floor(h-u)}}findMatches(t,e,i){const r=this.tileID.canonical.z<e.canonical.z?1:Math.pow(2,this.tileID.canonical.z-e.canonical.z);for(let n=0;n<t.length;n++){const o=t.get(n);if(o.crossTileID)continue;const a=this._symbolsByKey[o.key];if(!a)continue;const s=this.getScaledCoordinates(o,e);if(a.index){const t=a.index.range(s.x-r,s.y-r,s.x+r,s.y+r).sort();for(const e of t){const t=a.crossTileIDs[e];if(!i[t]){i[t]=!0,o.crossTileID=t;break}}}else if(a.positions)for(let t=0;t<a.positions.length;t++){const e=a.positions[t],n=a.crossTileIDs[t];if(Math.abs(e.x-s.x)<=r&&Math.abs(e.y-s.y)<=r&&!i[n]){i[n]=!0,o.crossTileID=n;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map((({crossTileIDs:t})=>t))}}class Jt{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Qt{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(t){const e=Math.round((t-this.lng)/360);if(0!==e)for(const t in this.indexes){const i=this.indexes[t],r={};for(const t in i){const n=i[t];n.tileID=n.tileID.unwrapTo(n.tileID.wrap+e),r[n.tileID.key]=n}this.indexes[t]=r}this.lng=t}addBucket(t,e,i){if(this.indexes[t.overscaledZ]&&this.indexes[t.overscaledZ][t.key]){if(this.indexes[t.overscaledZ][t.key].bucketInstanceId===e.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(t.overscaledZ,this.indexes[t.overscaledZ][t.key])}for(let t=0;t<e.symbolInstances.length;t++)e.symbolInstances.get(t).crossTileID=0;this.usedCrossTileIDs[t.overscaledZ]||(this.usedCrossTileIDs[t.overscaledZ]={});const r=this.usedCrossTileIDs[t.overscaledZ];for(const i in this.indexes){const n=this.indexes[i];if(Number(i)>t.overscaledZ)for(const i in n){const o=n[i];o.tileID.isChildOf(t)&&o.findMatches(e.symbolInstances,t,r)}else{const o=n[t.scaledTo(Number(i)).key];o&&o.findMatches(e.symbolInstances,t,r)}}for(let t=0;t<e.symbolInstances.length;t++){const n=e.symbolInstances.get(t);n.crossTileID||(n.crossTileID=i.generate(),r[n.crossTileID]=!0)}return void 0===this.indexes[t.overscaledZ]&&(this.indexes[t.overscaledZ]={}),this.indexes[t.overscaledZ][t.key]=new Yt(t,e.symbolInstances,e.bucketInstanceId),!0}removeBucketCrossTileIDs(t,e){for(const i of e.getCrossTileIDsLists())for(const e of i)delete this.usedCrossTileIDs[t][e]}removeStaleBuckets(t){let e=!1;for(const i in this.indexes){const r=this.indexes[i];for(const n in r)t[r[n].bucketInstanceId]||(this.removeBucketCrossTileIDs(i,r[n]),delete r[n],e=!0)}return e}}class te{constructor(){this.layerIndexes={},this.crossTileIDs=new Jt,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(t,e,i){let r=this.layerIndexes[t.id];void 0===r&&(r=this.layerIndexes[t.id]=new Qt);let n=!1;const o={};r.handleWrapJump(i);for(const i of e){const e=i.getBucket(t);e&&t.id===e.layerIds[0]&&(e.bucketInstanceId||(e.bucketInstanceId=++this.maxBucketInstanceId),r.addBucket(i.tileID,e,this.crossTileIDs)&&(n=!0),o[e.bucketInstanceId]=!0)}return r.removeStaleBuckets(o)&&(n=!0),n}pruneUnusedLayers(t){const e={};t.forEach((t=>{e[t]=!0}));for(const t in this.layerIndexes)e[t]||delete this.layerIndexes[t]}}const ee=(e,i)=>t.emitValidationErrors(e,i&&i.filter((t=>"source.canvas"!==t.identifier))),ie=t.pick(t.operations,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setGlyphs","setSprite"]),re=t.pick(t.operations,["setCenter","setZoom","setBearing","setPitch"]),ne=t.emptyStyle();class oe extends t.Evented{constructor(e,i={}){super(),this.map=e,this.dispatcher=new L(ot(),this,e._getMapId()),this.imageManager=new w,this.imageManager.setEventedParent(this),this.glyphManager=new C(e._requestManager,i.localIdeographFontFamily),this.lineAtlas=new P(256,512),this.crossTileSymbolIndex=new te,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new t.ZoomHistory,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("setReferrer",t.getReferrer());const r=this;this._rtlTextPluginCallback=oe.registerForPluginStateChange((e=>{r.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:e.pluginStatus,pluginURL:e.pluginURL},((e,i)=>{if(t.triggerPluginCompletionEvent(e),i&&i.every((t=>t)))for(const t in r.sourceCaches){const e=r.sourceCaches[t].getSource().type;"vector"!==e&&"geojson"!==e||r.sourceCaches[t].reload()}}))})),this.on("data",(t=>{if("source"!==t.dataType||"metadata"!==t.sourceDataType)return;const e=this.sourceCaches[t.sourceId];if(!e)return;const i=e.getSource();if(i&&i.vectorLayerIds)for(const t in this._layers){const e=this._layers[t];e.source===i.id&&this._validateLayer(e)}}))}loadURL(e,i={},r){this.fire(new t.Event("dataloading",{dataType:"style"})),i.validate="boolean"!=typeof i.validate||i.validate;const n=this.map._requestManager.transformRequest(e,h.Style);this._request=t.getJSON(n,((e,n)=>{this._request=null,e?this.fire(new t.ErrorEvent(e)):n&&this._load(n,i,r)}))}loadJSON(e,i={},r){this.fire(new t.Event("dataloading",{dataType:"style"})),this._request=t.exported.frame((()=>{this._request=null,i.validate=!1!==i.validate,this._load(e,i,r)}))}loadEmpty(){this.fire(new t.Event("dataloading",{dataType:"style"})),this._load(ne,{validate:!1})}_load(e,i,r){const n=i.transformStyle?i.transformStyle(r,e):e;if(!i.validate||!ee(this,t.validateStyle(n))){this._loaded=!0,this.stylesheet=n;for(const t in n.sources)this.addSource(t,n.sources[t],{validate:!1});n.sprite?this._loadSprite(n.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(n.glyphs),this._createLayers(),this.light=new z(this.stylesheet.light),this.map.setTerrain(this.stylesheet.terrain),this.fire(new t.Event("data",{dataType:"style"})),this.fire(new t.Event("style.load"))}}_createLayers(){const e=t.derefLayers(this.stylesheet.layers);this.dispatcher.broadcast("setLayers",e),this._order=e.map((t=>t.id)),this._layers={},this._serializedLayers=null;for(const i of e){const e=t.createStyleLayer(i);e.setEventedParent(this,{layer:{id:i.id}}),this._layers[i.id]=e}}_loadSprite(e,i=!1,r){this.imageManager.setLoaded(!1),this._spriteRequest=function(e,i,r,n){const o=y(e),a=o.length,s=r>1?"@2x":"",l={},c={},p={};for(const{id:e,url:r}of o){const o=i.transformRequest(i.normalizeSpriteURL(r,s,".json"),h.SpriteJSON),d=`${e}_${o.url}`;l[d]=t.getJSON(o,((t,i)=>{delete l[d],c[e]=i,x(n,c,p,t,a)}));const m=i.transformRequest(i.normalizeSpriteURL(r,s,".png"),h.SpriteImage),f=`${e}_${m.url}`;l[f]=u.getImage(m,((t,i)=>{delete l[f],p[e]=i,x(n,c,p,t,a)}))}return{cancel(){for(const t of Object.values(l))t.cancel()}}}(e,this.map._requestManager,this.map.getPixelRatio(),((e,n)=>{if(this._spriteRequest=null,e)this.fire(new t.ErrorEvent(e));else if(n)for(const t in n){this._spritesImagesIds[t]=[];const e=this._spritesImagesIds[t]?this._spritesImagesIds[t].filter((t=>!(t in n))):[];for(const t of e)this.imageManager.removeImage(t),this._changedImages[t]=!0;for(const e in n[t]){const r="default"===t?e:`${t}:${e}`;this._spritesImagesIds[t].push(r),r in this.imageManager.images?this.imageManager.updateImage(r,n[t][e],!1):this.imageManager.addImage(r,n[t][e]),i&&(this._changedImages[r]=!0)}}this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),i&&(this._changed=!0),this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new t.Event("data",{dataType:"style"})),r&&r(e)}))}_unloadSprite(){for(const t of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(t),this._changedImages[t]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new t.Event("data",{dataType:"style"}))}_validateLayer(e){const i=this.sourceCaches[e.source];if(!i)return;const r=e.sourceLayer;if(!r)return;const n=i.getSource();("geojson"===n.type||n.vectorLayerIds&&-1===n.vectorLayerIds.indexOf(r))&&this.fire(new t.ErrorEvent(new Error(`Source layer "${r}" does not exist on source "${n.id}" as specified by style layer "${e.id}".`)))}loaded(){if(!this._loaded)return!1;if(Object.keys(this._updatedSources).length)return!1;for(const t in this.sourceCaches)if(!this.sourceCaches[t].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(t){const e=this._serializedAllLayers();if(!t||0===t.length)return Object.values(e);const i=[];for(const r of t)e[r]&&i.push(e[r]);return i}_serializedAllLayers(){let t=this._serializedLayers;if(t)return t;t=this._serializedLayers={};const e=Object.keys(this._layers);for(const i of e){const e=this._layers[i];"custom"!==e.type&&(t[i]=e.serialize())}return t}hasTransitions(){if(this.light&&this.light.hasTransition())return!0;for(const t in this.sourceCaches)if(this.sourceCaches[t].hasTransition())return!0;for(const t in this._layers)if(this._layers[t].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(e){if(!this._loaded)return;const i=this._changed;if(this._changed){const t=Object.keys(this._updatedLayers),i=Object.keys(this._removedLayers);(t.length||i.length)&&this._updateWorkerLayers(t,i);for(const t in this._updatedSources){const e=this._updatedSources[t];if("reload"===e)this._reloadSource(t);else{if("clear"!==e)throw new Error(`Invalid action ${e}`);this._clearSource(t)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const t in this._updatedPaintProps)this._layers[t].updateTransitions(e);this.light.updateTransitions(e),this._resetUpdates()}const r={};for(const t in this.sourceCaches){const e=this.sourceCaches[t];r[t]=e.used,e.used=!1}for(const t of this._order){const i=this._layers[t];i.recalculate(e,this._availableImages),!i.isHidden(e.zoom)&&i.source&&(this.sourceCaches[i.source].used=!0)}for(const e in r){const i=this.sourceCaches[e];r[e]!==i.used&&i.fire(new t.Event("data",{sourceDataType:"visibility",dataType:"source",sourceId:e}))}this.light.recalculate(e),this.z=e.zoom,i&&this.fire(new t.Event("data",{dataType:"style"}))}_updateTilesForChangedImages(){const t=Object.keys(this._changedImages);if(t.length){for(const e in this.sourceCaches)this.sourceCaches[e].reloadTilesForDependencies(["icons","patterns"],t);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const t in this.sourceCaches)this.sourceCaches[t].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(t,e){this.dispatcher.broadcast("updateLayers",{layers:this._serializeByIds(t),removedIds:e})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(e,i={}){this._checkLoaded();const r=this.serialize();if(e=i.transformStyle?i.transformStyle(r,e):e,ee(this,t.validateStyle(e)))return!1;(e=t.clone$1(e)).layers=t.derefLayers(e.layers);const n=t.diffStyles(r,e).filter((t=>!(t.command in re)));if(0===n.length)return!1;const o=n.filter((t=>!(t.command in ie)));if(o.length>0)throw new Error(`Unimplemented: ${o.map((t=>t.command)).join(", ")}.`);for(const t of n)"setTransition"!==t.command&&this[t.command].apply(this,t.args);return this.stylesheet=e,!0}addImage(e,i){if(this.getImage(e))return this.fire(new t.ErrorEvent(new Error(`An image named "${e}" already exists.`)));this.imageManager.addImage(e,i),this._afterImageUpdated(e)}updateImage(t,e){this.imageManager.updateImage(t,e)}getImage(t){return this.imageManager.getImage(t)}removeImage(e){if(!this.getImage(e))return this.fire(new t.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 t.Event("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(e,i,r={}){if(this._checkLoaded(),void 0!==this.sourceCaches[e])throw new Error(`Source "${e}" already exists.`);if(!i.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(i).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(i.type)>=0&&this._validate(t.validateStyle.source,`sources.${e}`,i,null,r))return;this.map&&this.map._collectResourceTiming&&(i.collectResourceTiming=!0);const n=this.sourceCaches[e]=new J(e,i,this.dispatcher);n.style=this,n.setEventedParent(this,(()=>({isSourceLoaded:n.loaded(),source:n.serialize(),sourceId:e}))),n.onAdd(this.map),this._changed=!0}removeSource(e){if(this._checkLoaded(),void 0===this.sourceCaches[e])throw new Error("There is no source with this ID");for(const i in this._layers)if(this._layers[i].source===e)return this.fire(new t.ErrorEvent(new Error(`Source "${e}" cannot be removed while layer "${i}" is using it.`)));const i=this.sourceCaches[e];delete this.sourceCaches[e],delete this._updatedSources[e],i.fire(new t.Event("data",{sourceDataType:"metadata",dataType:"source",sourceId:e})),i.setEventedParent(null),i.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(t,e){if(this._checkLoaded(),void 0===this.sourceCaches[t])throw new Error(`There is no source with this ID=${t}`);const i=this.sourceCaches[t].getSource();if("geojson"!==i.type)throw new Error(`geojsonSource.type is ${i.type}, which is !== 'geojson`);i.setData(e),this._changed=!0}getSource(t){return this.sourceCaches[t]&&this.sourceCaches[t].getSource()}addLayer(e,i,r={}){this._checkLoaded();const n=e.id;if(this.getLayer(n))return void this.fire(new t.ErrorEvent(new Error(`Layer "${n}" already exists on this map.`)));let o;if("custom"===e.type){if(ee(this,t.validateCustomStyleLayer(e)))return;o=t.createStyleLayer(e)}else{if("object"==typeof e.source&&(this.addSource(n,e.source),e=t.clone$1(e),e=t.extend(e,{source:n})),this._validate(t.validateStyle.layer,`layers.${n}`,e,{arrayIndex:-1},r))return;o=t.createStyleLayer(e),this._validateLayer(o),o.setEventedParent(this,{layer:{id:n}})}const a=i?this._order.indexOf(i):this._order.length;if(i&&-1===a)this.fire(new t.ErrorEvent(new Error(`Cannot add layer "${n}" before non-existing layer "${i}".`)));else{if(this._order.splice(a,0,n),this._layerOrderChanged=!0,this._layers[n]=o,this._removedLayers[n]&&o.source&&"custom"!==o.type){const t=this._removedLayers[n];delete this._removedLayers[n],t.type!==o.type?this._updatedSources[o.source]="clear":(this._updatedSources[o.source]="reload",this.sourceCaches[o.source].pause())}this._updateLayer(o),o.onAdd&&o.onAdd(this.map)}}moveLayer(e,i){if(this._checkLoaded(),this._changed=!0,!this._layers[e])return void this.fire(new t.ErrorEvent(new Error(`The layer '${e}' does not exist in the map's style and cannot be moved.`)));if(e===i)return;const r=this._order.indexOf(e);this._order.splice(r,1);const n=i?this._order.indexOf(i):this._order.length;i&&-1===n?this.fire(new t.ErrorEvent(new Error(`Cannot move layer "${e}" before non-existing layer "${i}".`))):(this._order.splice(n,0,e),this._layerOrderChanged=!0)}removeLayer(e){this._checkLoaded();const i=this._layers[e];if(!i)return void this.fire(new t.ErrorEvent(new Error(`Cannot remove non-existing layer "${e}".`)));i.setEventedParent(null);const r=this._order.indexOf(e);this._order.splice(r,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[e]=i,delete this._layers[e],this._serializedLayers&&delete this._serializedLayers[e],delete this._updatedLayers[e],delete this._updatedPaintProps[e],i.onRemove&&i.onRemove(this.map)}getLayer(t){return this._layers[t]}hasLayer(t){return t in this._layers}setLayerZoomRange(e,i,r){this._checkLoaded();const n=this.getLayer(e);n?n.minzoom===i&&n.maxzoom===r||(null!=i&&(n.minzoom=i),null!=r&&(n.maxzoom=r),this._updateLayer(n)):this.fire(new t.ErrorEvent(new Error(`Cannot set the zoom range of non-existing layer "${e}".`)))}setFilter(e,i,r={}){this._checkLoaded();const n=this.getLayer(e);if(n){if(!t.deepEqual(n.filter,i))return null==i?(n.filter=void 0,void this._updateLayer(n)):void(this._validate(t.validateStyle.filter,`layers.${n.id}.filter`,i,null,r)||(n.filter=t.clone$1(i),this._updateLayer(n)))}else this.fire(new t.ErrorEvent(new Error(`Cannot filter non-existing layer "${e}".`)))}getFilter(e){return t.clone$1(this.getLayer(e).filter)}setLayoutProperty(e,i,r,n={}){this._checkLoaded();const o=this.getLayer(e);o?t.deepEqual(o.getLayoutProperty(i),r)||(o.setLayoutProperty(i,r,n),this._updateLayer(o)):this.fire(new t.ErrorEvent(new Error(`Cannot style non-existing layer "${e}".`)))}getLayoutProperty(e,i){const r=this.getLayer(e);if(r)return r.getLayoutProperty(i);this.fire(new t.ErrorEvent(new Error(`Cannot get style of non-existing layer "${e}".`)))}setPaintProperty(e,i,r,n={}){this._checkLoaded();const o=this.getLayer(e);o?t.deepEqual(o.getPaintProperty(i),r)||(o.setPaintProperty(i,r,n)&&this._updateLayer(o),this._changed=!0,this._updatedPaintProps[e]=!0):this.fire(new t.ErrorEvent(new Error(`Cannot style non-existing layer "${e}".`)))}getPaintProperty(t,e){return this.getLayer(t).getPaintProperty(e)}setFeatureState(e,i){this._checkLoaded();const r=e.source,n=e.sourceLayer,o=this.sourceCaches[r];if(void 0===o)return void this.fire(new t.ErrorEvent(new Error(`The source '${r}' does not exist in the map's style.`)));const a=o.getSource().type;"geojson"===a&&n?this.fire(new t.ErrorEvent(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):"vector"!==a||n?(void 0===e.id&&this.fire(new t.ErrorEvent(new Error("The feature id parameter must be provided."))),o.setFeatureState(n,e.id,i)):this.fire(new t.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(e,i){this._checkLoaded();const r=e.source,n=this.sourceCaches[r];if(void 0===n)return void this.fire(new t.ErrorEvent(new Error(`The source '${r}' does not exist in the map's style.`)));const o=n.getSource().type,a="vector"===o?e.sourceLayer:void 0;"vector"!==o||a?i&&"string"!=typeof e.id&&"number"!=typeof e.id?this.fire(new t.ErrorEvent(new Error("A feature id is required to remove its specific state property."))):n.removeFeatureState(a,e.id,i):this.fire(new t.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(e){this._checkLoaded();const i=e.source,r=e.sourceLayer,n=this.sourceCaches[i];if(void 0!==n)return"vector"!==n.getSource().type||r?(void 0===e.id&&this.fire(new t.ErrorEvent(new Error("The feature id parameter must be provided."))),n.getFeatureState(r,e.id)):void this.fire(new t.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new t.ErrorEvent(new Error(`The source '${i}' does not exist in the map's style.`)))}getTransition(){return t.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){const e=t.mapObject(this.sourceCaches,(t=>t.serialize())),i=this._serializeByIds(this._order),r=this.stylesheet;return t.filterObject({version:r.version,name:r.name,metadata:r.metadata,light:r.light,center:r.center,zoom:r.zoom,bearing:r.bearing,pitch:r.pitch,sprite:r.sprite,glyphs:r.glyphs,transition:r.transition,sources:e,layers:i},(t=>void 0!==t))}_updateLayer(t){this._updatedLayers[t.id]=!0,t.source&&!this._updatedSources[t.source]&&"raster"!==this.sourceCaches[t.source].getSource().type&&(this._updatedSources[t.source]="reload",this.sourceCaches[t.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(t){const e=t=>"fill-extrusion"===this._layers[t].type,i={},r=[];for(let n=this._order.length-1;n>=0;n--){const o=this._order[n];if(e(o)){i[o]=n;for(const e of t){const t=e[o];if(t)for(const e of t)r.push(e)}}}r.sort(((t,e)=>e.intersectionZ-t.intersectionZ));const n=[];for(let o=this._order.length-1;o>=0;o--){const a=this._order[o];if(e(a))for(let t=r.length-1;t>=0;t--){const e=r[t].feature;if(i[e.layer.id]<o)break;n.push(e),r.pop()}else for(const e of t){const t=e[a];if(t)for(const e of t)n.push(e.feature)}}return n}queryRenderedFeatures(e,i,r){i&&i.filter&&this._validate(t.validateStyle.filter,"queryRenderedFeatures.filter",i.filter,null,i);const n={};if(i&&i.layers){if(!Array.isArray(i.layers))return this.fire(new t.ErrorEvent(new Error("parameters.layers must be an Array."))),[];for(const e of i.layers){const i=this._layers[e];if(!i)return this.fire(new t.ErrorEvent(new Error(`The layer '${e}' does not exist in the map's style and cannot be queried for features.`))),[];n[i.source]=!0}}const o=[];i.availableImages=this._availableImages;const a=this._serializedAllLayers();for(const t in this.sourceCaches)i.layers&&!n[t]||o.push(H(this.sourceCaches[t],this._layers,a,e,i,r));return this.placement&&o.push(function(t,e,i,r,n,o,a){const s={},l=o.queryRenderedSymbols(r),c=[];for(const t of Object.keys(l).map(Number))c.push(a[t]);c.sort(X);for(const i of c){const r=i.featureIndex.lookupSymbolFeatures(l[i.bucketInstanceId],e,i.bucketIndex,i.sourceLayerIndex,n.filter,n.layers,n.availableImages,t);for(const t in r){const e=s[t]=s[t]||[],n=r[t];n.sort(((t,e)=>{const r=i.featureSortOrder;if(r){const i=r.indexOf(t.featureIndex);return r.indexOf(e.featureIndex)-i}return e.featureIndex-t.featureIndex}));for(const t of n)e.push(t)}}for(const e in s)s[e].forEach((r=>{const n=r.feature,o=i[t[e].source].getFeatureState(n.layer["source-layer"],n.id);n.source=n.layer.source,n.layer["source-layer"]&&(n.sourceLayer=n.layer["source-layer"]),n.state=o}));return s}(this._layers,a,this.sourceCaches,e,i,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(o)}querySourceFeatures(e,i){i&&i.filter&&this._validate(t.validateStyle.filter,"querySourceFeatures.filter",i.filter,null,i);const r=this.sourceCaches[e];return r?function(t,e){const i=t.getRenderableIds().map((e=>t.getTileByID(e))),r=[],n={};for(let t=0;t<i.length;t++){const o=i[t],a=o.tileID.canonical.key;n[a]||(n[a]=!0,o.querySourceFeatures(r,e))}return r}(r,i):[]}addSourceType(t,e,i){return oe.getSourceType(t)?i(new Error(`A source type called "${t}" already exists.`)):(oe.setSourceType(t,e),e.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:t,url:e.workerSourceURL},i):i(null,null))}getLight(){return this.light.getLight()}setLight(e,i={}){this._checkLoaded();const r=this.light.getLight();let n=!1;for(const i in e)if(!t.deepEqual(e[i],r[i])){n=!0;break}if(!n)return;const o={now:t.exported.now(),transition:t.extend({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(e,i),this.light.updateTransitions(o)}_validate(e,i,r,n,o={}){return(!o||!1!==o.validate)&&ee(this,e.call(t.validateStyle,t.extend({key:i,style:this.serialize(),value:r,styleSpec:t.v8Spec},n)))}_remove(e=!0){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),t.evented.off("pluginStateChange",this._rtlTextPluginCallback);for(const t in this._layers)this._layers[t].setEventedParent(null);for(const t in this.sourceCaches){const e=this.sourceCaches[t];e.setEventedParent(null),e.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),this.dispatcher.remove(e)}_clearSource(t){this.sourceCaches[t].clearTiles()}_reloadSource(t){this.sourceCaches[t].resume(),this.sourceCaches[t].reload()}_updateSources(t){for(const e in this.sourceCaches)this.sourceCaches[e].update(t,this.map.terrain)}_generateCollisionBoxes(){for(const t in this.sourceCaches)this._reloadSource(t)}_updatePlacement(e,i,r,n,o=!1){let a=!1,s=!1;const l={};for(const t of this._order){const i=this._layers[t];if("symbol"!==i.type)continue;if(!l[i.source]){const t=this.sourceCaches[i.source];l[i.source]=t.getRenderableIds(!0).map((e=>t.getTileByID(e))).sort(((t,e)=>e.tileID.overscaledZ-t.tileID.overscaledZ||(t.tileID.isLessThan(e.tileID)?-1:1)))}const r=this.crossTileSymbolIndex.addLayer(i,l[i.source],e.center.lng);a=a||r}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((o=o||this._layerOrderChanged||0===r)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(t.exported.now(),e.zoom))&&(this.pauseablePlacement=new Wt(e,this.map.terrain,this._order,o,i,r,n,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,l),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(t.exported.now()),s=!0),a&&this.pauseablePlacement.placement.setStale()),s||a)for(const t of this._order){const e=this._layers[t];"symbol"===e.type&&this.placement.updateLayerOpacities(e,l[e.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(t.exported.now())}_releaseSymbolFadeTiles(){for(const t in this.sourceCaches)this.sourceCaches[t].releaseSymbolFadeTiles()}getImages(t,e,i){this.imageManager.getImages(e.icons,i),this._updateTilesForChangedImages();const r=this.sourceCaches[e.source];r&&r.setDependencies(e.tileID.key,e.type,e.icons)}getGlyphs(t,e,i){this.glyphManager.getGlyphs(e.stacks,i);const r=this.sourceCaches[e.source];r&&r.setDependencies(e.tileID.key,e.type,[""])}getResource(e,i,r){return t.makeRequest(i,r)}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(e,i={}){this._checkLoaded(),e&&this._validate(t.validateStyle.glyphs,"glyphs",e,null,i)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=e,this.glyphManager.entries={},this.glyphManager.setURL(e))}addSprite(e,i,r={},n){this._checkLoaded();const o=[{id:e,url:i}],a=[...y(this.stylesheet.sprite),...o];this._validate(t.validateStyle.sprite,"sprite",a,null,r)||(this.stylesheet.sprite=a,this._loadSprite(o,!0,n))}removeSprite(e){this._checkLoaded();const i=y(this.stylesheet.sprite);if(i.find((t=>t.id===e))){if(this._spritesImagesIds[e])for(const t of this._spritesImagesIds[e])this.imageManager.removeImage(t),this._changedImages[t]=!0;i.splice(i.findIndex((t=>t.id===e)),1),this.stylesheet.sprite=i.length>0?i:void 0,delete this._spritesImagesIds[e],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new t.Event("data",{dataType:"style"}))}else this.fire(new t.ErrorEvent(new Error(`Sprite "${e}" doesn't exists on this map.`)))}getSprite(){return y(this.stylesheet.sprite)}setSprite(e,i={},r){this._checkLoaded(),e&&this._validate(t.validateStyle.sprite,"sprite",e,null,i)||(this.stylesheet.sprite=e,e?this._loadSprite(e,!0,r):(this._unloadSprite(),r&&r(null)))}}oe.getSourceType=function(t){return Z[t]},oe.setSourceType=function(t,e){Z[t]=e},oe.registerForPluginStateChange=t.registerForPluginStateChange;var ae=t.createLayout([{name:"a_pos",type:"Int16",components:2}]),se="in vec3 a_pos3d;uniform mat4 u_matrix;uniform float u_ele_delta;out vec2 v_texture_pos;out float v_depth;void main() {float extent=8192.0;float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/extent;gl_Position=u_matrix*vec4(a_pos3d.xy,get_elevation(a_pos3d.xy)-ele_delta,1.0);v_depth=gl_Position.z/gl_Position.w;}";const le={prelude:ce("#ifdef GL_ES\nprecision mediump float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif\nout highp vec4 fragColor;","#ifdef GL_ES\nprecision highp float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif\nvec2 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\n);}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;}\n#ifdef TERRAIN3D\nuniform sampler2D u_terrain;uniform float u_terrain_dim;uniform mat4 u_terrain_matrix;uniform vec4 u_terrain_unpack;uniform float u_terrain_exaggeration;uniform highp sampler2D u_depth;\n#endif\nconst highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitShifts=vec4(1.)/bitSh;highp float unpack(highp vec4 color) {return dot(color,bitShifts);}highp float depthOpacity(vec3 frag) {\n#ifdef TERRAIN3D\nhighp float d=unpack(texture(u_depth,frag.xy*0.5+0.5))+0.0001-frag.z;return 1.0-max(0.0,min(1.0,-d*500.0));\n#else\nreturn 1.0;\n#endif\n}float calculate_visibility(vec4 pos) {\n#ifdef TERRAIN3D\nvec3 frag=pos.xyz/pos.w;highp float d=depthOpacity(frag);if (d > 0.95) return 1.0;return (d+depthOpacity(frag+vec3(0.0,0.01,0.0)))/2.0;\n#else\nreturn 1.0;\n#endif\n}float ele(vec2 pos) {\n#ifdef TERRAIN3D\nvec4 rgb=(texture(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a;\n#else\nreturn 0.0;\n#endif\n}float get_elevation(vec2 pos) {\n#ifdef TERRAIN3D\nvec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.0;vec2 f=fract(coord);vec2 c=(floor(coord)+0.5)/(u_terrain_dim+2.0);float d=1.0/(u_terrain_dim+2.0);float tl=ele(c);float tr=ele(c+vec2(d,0.0));float bl=ele(c+vec2(0.0,d));float br=ele(c+vec2(d,d));float elevation=mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);return elevation*u_terrain_exaggeration;\n#else\nreturn 0.0;\n#endif\n}"),background:ce("uniform vec4 u_color;uniform float u_opacity;void main() {fragColor=u_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","in vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),backgroundPattern:ce("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;in vec2 v_pos_a;in 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=texture(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=texture(u_image,pos2);fragColor=mix(color1,color2,u_mix)*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","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;in vec2 a_pos;out vec2 v_pos_a;out 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:ce("in vec3 v_data;in float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=v_data.xy;float extrude_length=length(extrude);lowp float antialiasblur=v_data.z;float antialiased_blur=-max(blur,antialiasblur);float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));fragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;in vec2 a_pos;out vec3 v_data;out float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main(void) {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);float ele=get_elevation(circle_center);v_visibility=calculate_visibility(u_matrix*vec4(circle_center,ele,1.0));if (u_pitch_with_map) {vec2 corner_position=circle_center;if (u_scale_with_map) {corner_position+=extrude*(radius+stroke_width)*u_extrude_scale;} else {vec4 projected_center=u_matrix*vec4(circle_center,0,1);corner_position+=extrude*(radius+stroke_width)*u_extrude_scale*(projected_center.w/u_camera_to_center_distance);}gl_Position=u_matrix*vec4(corner_position,ele,1);} else {gl_Position=u_matrix*vec4(circle_center,ele,1);if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);}"),clippingMask:ce("void main() {fragColor=vec4(1.0);}","in vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),heatmap:ce("uniform highp float u_intensity;in vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#define GAUSS_COEF 0.3989422804014327\nvoid main() {\n#pragma mapbox: initialize highp float weight\nfloat d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);fragColor=vec4(val,1.0,1.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;in vec2 a_pos;out vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#pragma mapbox: define mediump float radius\nconst highp float ZERO=1.0/255.0/16.0;\n#define GAUSS_COEF 0.3989422804014327\nvoid main(void) {\n#pragma mapbox: initialize highp float weight\n#pragma mapbox: initialize mediump float radius\nvec2 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:ce("uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;in vec2 v_pos;void main() {float t=texture(u_image,v_pos).r;vec4 color=texture(u_color_ramp,vec2(t,0.5));fragColor=color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(0.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_world;in vec2 a_pos;out 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:ce("in float v_placed;in float v_notUsed;void main() {float alpha=0.5;fragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {fragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {fragColor*=.1;}}","in vec2 a_pos;in vec2 a_anchor_pos;in vec2 a_extrude;in vec2 a_placed;in vec2 a_shift;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;out float v_placed;out 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,get_elevation(a_pos),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:ce("in float v_radius;in vec2 v_extrude;in float v_perspective_ratio;in 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);fragColor=color*alpha*opacity_t;}","in vec2 a_pos;in float a_radius;in vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;out float v_radius;out vec2 v_extrude;out float v_perspective_ratio;out 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:ce("uniform highp vec4 u_color;uniform sampler2D u_overlay;in vec2 v_uv;void main() {vec4 overlay_color=texture(u_overlay,v_uv);fragColor=mix(u_color,overlay_color,overlay_color.a);}","in vec2 a_pos;out vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,get_elevation(a_pos),1);}"),fill:ce("#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\nfragColor=color*opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","in vec2 a_pos;uniform mat4 u_matrix;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);}"),fillOutline:ce("in vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);fragColor=outline_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","in vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;out vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}"),fillOutlinePattern:ce("uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;in vec2 v_pos_a;in vec2 v_pos_b;in vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);fragColor=mix(color1,color2,u_fade)*alpha*opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;out vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 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:ce("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);fragColor=mix(color1,color2,u_fade)*opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 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:ce("in vec4 v_color;void main() {fragColor=v_color;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;in vec2 a_pos;in vec4 a_normal_ed;\n#ifdef TERRAIN3D\nin vec2 a_centroid;\n#endif\nout vec4 v_color;\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\nvec3 normal=a_normal_ed.xyz;\n#ifdef TERRAIN3D\nfloat height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);\n#else\nfloat height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;\n#endif\nbase=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);gl_Position=u_matrix*vec4(a_pos,t > 0.0 ? height : base,1);float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;float directional=clamp(dot(normal/16384.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}"),fillExtrusionPattern:ce("uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;in vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);fragColor=mixedColor*v_lighting;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;in vec2 a_pos;in vec4 a_normal_ed;\n#ifdef TERRAIN3D\nin vec2 a_centroid;\n#endif\nout vec2 v_pos_a;out vec2 v_pos_b;out vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 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;\n#ifdef TERRAIN3D\nfloat height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);\n#else\nfloat height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;\n#endif\nbase=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float z=t > 0.0 ? height : base;gl_Position=u_matrix*vec4(a_pos,z,1);vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0\n? a_pos\n: 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:ce("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture(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));fragColor=clamp(vec4(deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_dimension;in vec2 a_pos;in vec2 a_texture_pos;out 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:ce("uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;\n#define PI 3.141592653589793\nvoid main() {vec4 pixel=texture(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);fragColor=accent_color*(1.0-shade_color.a)+shade_color;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;}"),line:ce("uniform lowp float u_device_pixel_ratio;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);fragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nin vec2 a_pos_normal;in vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp float v_linesofar;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat 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;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat 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;\n#endif\nv_width2=vec2(outset,inset);}"),lineGradient:ce("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;in highp vec2 v_uv;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture(u_image,v_uv);fragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nin vec2 a_pos_normal;in vec4 a_data;in float a_uv_x;in float a_split_index;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec2 v_uv;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat 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;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat 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;\n#endif\nv_width2=vec2(outset,inset);}"),linePattern:ce("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;in vec2 v_normal;in vec2 v_width2;in float v_linesofar;in float v_gamma_scale;in float v_width;\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture(u_image,pos_a),texture(u_image,pos_b),u_fade);fragColor=color*alpha*opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nin vec2 a_pos_normal;in vec4 a_data;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;out vec2 v_normal;out vec2 v_width2;out float v_linesofar;out float v_gamma_scale;out float v_width;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nfloat 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;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat 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;\n#endif\nv_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}"),lineSDF:ce("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;in vec2 v_normal;in vec2 v_width2;in vec2 v_tex_a;in vec2 v_tex_b;in float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture(u_image,v_tex_a).a;float sdfdist_b=texture(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);alpha*=smoothstep(0.5-u_sdfgamma/floorwidth,0.5+u_sdfgamma/floorwidth,sdfdist);fragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nin vec2 a_pos_normal;in vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_patternscale_a;uniform float u_tex_y_a;uniform vec2 u_patternscale_b;uniform float u_tex_y_b;uniform vec2 u_units_to_pixels;out vec2 v_normal;out vec2 v_width2;out vec2 v_tex_a;out vec2 v_tex_b;out float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\nfloat 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;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat 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;\n#endif\nv_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:ce("uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;in vec2 v_pos0;in 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=texture(u_image0,v_pos0);vec4 color1=texture(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);fragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos0;out 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:ce("uniform sampler2D u_texture;in vec2 v_tex;in float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nlowp float alpha=opacity*v_fade_opacity;fragColor=texture(u_texture,v_tex)*alpha;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","const float PI=3.141592653589793;in vec4 a_pos_offset;in vec4 a_data;in vec4 a_pixeloffset;in vec3 a_projected_pos;in float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;out vec2 v_tex;out float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_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),ele,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,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;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),z,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;float visibility=calculate_visibility(projectedPoint);v_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));}"),symbolSDF:ce("#define SDF_PX 8.0\nuniform 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;in vec2 v_data0;in vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);fragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","const float PI=3.141592653589793;in vec4 a_pos_offset;in vec4 a_data;in vec4 a_pixeloffset;in vec3 a_projected_pos;in float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;out vec2 v_data0;out vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_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),ele,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,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset),z,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}"),symbolTextAndIcon:ce("#define SDF_PX 8.0\n#define SDF 1.0\n#define ICON 0.0\nuniform 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;in vec4 v_data0;in vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;fragColor=texture(u_texture_icon,tex_icon)*alpha;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\nreturn;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);fragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","const float PI=3.141592653589793;in vec4 a_pos_offset;in vec4 a_data;in vec3 a_projected_pos;in float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;out vec4 v_data0;out vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_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),ele,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,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale),z,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}"),terrain:ce("uniform sampler2D u_texture;in vec2 v_texture_pos;void main() {fragColor=texture(u_texture,v_texture_pos);}",se),terrainDepth:ce("in float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {fragColor=pack(v_depth);}",se),terrainCoords:ce("precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;in vec2 v_texture_pos;void main() {vec4 rgba=texture(u_texture,v_texture_pos);fragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}",se)};function ce(t,e){const i=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,r=e.match(/(attribute|in) ([\w]+) ([\w]+)/g),n=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),o=e.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),a=o?o.concat(n):n,s={};return{fragmentSource:t=t.replace(i,((t,e,i,r,n)=>(s[n]=!0,"define"===e?`\n#ifndef HAS_UNIFORM_u_${n}\nin ${i} ${r} ${n};\n#else\nuniform ${i} ${r} u_${n};\n#endif\n`:`\n#ifdef HAS_UNIFORM_u_${n}\n ${i} ${r} ${n} = u_${n};\n#endif\n`))),vertexSource:e=e.replace(i,((t,e,i,r,n)=>{const o="float"===r?"vec2":"vec4",a=n.match(/color/)?"color":o;return s[n]?"define"===e?`\n#ifndef HAS_UNIFORM_u_${n}\nuniform lowp float u_${n}_t;\nin ${i} ${o} a_${n};\nout ${i} ${r} ${n};\n#else\nuniform ${i} ${r} u_${n};\n#endif\n`:"vec4"===a?`\n#ifndef HAS_UNIFORM_u_${n}\n ${n} = a_${n};\n#else\n ${i} ${r} ${n} = u_${n};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${n}\n ${n} = unpack_mix_${a}(a_${n}, u_${n}_t);\n#else\n ${i} ${r} ${n} = u_${n};\n#endif\n`:"define"===e?`\n#ifndef HAS_UNIFORM_u_${n}\nuniform lowp float u_${n}_t;\nin ${i} ${o} a_${n};\n#else\nuniform ${i} ${r} u_${n};\n#endif\n`:"vec4"===a?`\n#ifndef HAS_UNIFORM_u_${n}\n ${i} ${r} ${n} = a_${n};\n#else\n ${i} ${r} ${n} = u_${n};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${n}\n ${i} ${r} ${n} = unpack_mix_${a}(a_${n}, u_${n}_t);\n#else\n ${i} ${r} ${n} = u_${n};\n#endif\n`})),staticAttributes:r,staticUniforms:a}}class he{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(t,e,i,r,n,o,a,s,l){this.context=t;let c=this.boundPaintVertexBuffers.length!==r.length;for(let t=0;!c&&t<r.length;t++)this.boundPaintVertexBuffers[t]!==r[t]&&(c=!0);!this.vao||this.boundProgram!==e||this.boundLayoutVertexBuffer!==i||c||this.boundIndexBuffer!==n||this.boundVertexOffset!==o||this.boundDynamicVertexBuffer!==a||this.boundDynamicVertexBuffer2!==s||this.boundDynamicVertexBuffer3!==l?this.freshBind(e,i,r,n,o,a,s,l):(t.bindVertexArray.set(this.vao),a&&a.bind(),n&&n.dynamicDraw&&n.bind(),s&&s.bind(),l&&l.bind())}freshBind(t,e,i,r,n,o,a,s){const l=t.numAttributes,c=this.context,h=c.gl;this.vao&&this.destroy(),this.vao=c.createVertexArray(),c.bindVertexArray.set(this.vao),this.boundProgram=t,this.boundLayoutVertexBuffer=e,this.boundPaintVertexBuffers=i,this.boundIndexBuffer=r,this.boundVertexOffset=n,this.boundDynamicVertexBuffer=o,this.boundDynamicVertexBuffer2=a,this.boundDynamicVertexBuffer3=s,e.enableAttributes(h,t);for(const e of i)e.enableAttributes(h,t);o&&o.enableAttributes(h,t),a&&a.enableAttributes(h,t),s&&s.enableAttributes(h,t),e.bind(),e.setVertexAttribPointers(h,t,n);for(const e of i)e.bind(),e.setVertexAttribPointers(h,t,n);o&&(o.bind(),o.setVertexAttribPointers(h,t,n)),r&&r.bind(),a&&(a.bind(),a.setVertexAttribPointers(h,t,n)),s&&(s.bind(),s.setVertexAttribPointers(h,t,n)),c.currentNumAttributes=l}destroy(){this.vao&&(this.context.deleteVertexArray(this.vao),this.vao=null)}}function ue(t){const e=[];for(let i=0;i<t.length;i++){if(null===t[i])continue;const r=t[i].split(" ");e.push(r.pop())}return e}class pe{constructor(e,i,r,n,o,a,s){const l=e.gl;this.program=l.createProgram();const c=ue(r.staticAttributes),h=n?n.getBinderAttributes():[],u=c.concat(h),p=le.prelude.staticUniforms?ue(le.prelude.staticUniforms):[],d=r.staticUniforms?ue(r.staticUniforms):[],m=n?n.getBinderUniforms():[],f=p.concat(d).concat(m),g=[];for(const t of f)g.indexOf(t)<0&&g.push(t);const _=n?n.defines():[];a&&_.push("#define OVERDRAW_INSPECTOR;"),s&&_.push("#define TERRAIN3D;"),_.unshift("#version 300 es");const y=_.concat(le.prelude.fragmentSource,r.fragmentSource).join("\n"),x=_.concat(le.prelude.vertexSource,r.vertexSource).join("\n"),v=l.createShader(l.FRAGMENT_SHADER);if(l.isContextLost())return void(this.failedToCreate=!0);l.shaderSource(v,y),l.compileShader(v),l.attachShader(this.program,v);const b=l.createShader(l.VERTEX_SHADER);if(l.isContextLost())return void(this.failedToCreate=!0);l.shaderSource(b,x),l.compileShader(b),l.attachShader(this.program,b),this.attributes={};const w={};this.numAttributes=u.length;for(let t=0;t<this.numAttributes;t++)u[t]&&(l.bindAttribLocation(this.program,t,u[t]),this.attributes[u[t]]=t);l.linkProgram(this.program),l.deleteShader(b),l.deleteShader(v);for(let t=0;t<g.length;t++){const e=g[t];if(e&&!w[e]){const t=l.getUniformLocation(this.program,e);t&&(w[e]=t)}}this.fixedUniforms=o(e,w),this.terrainUniforms=((e,i)=>({u_depth:new t.Uniform1i(e,i.u_depth),u_terrain:new t.Uniform1i(e,i.u_terrain),u_terrain_dim:new t.Uniform1f(e,i.u_terrain_dim),u_terrain_matrix:new t.UniformMatrix4f(e,i.u_terrain_matrix),u_terrain_unpack:new t.Uniform4f(e,i.u_terrain_unpack),u_terrain_exaggeration:new t.Uniform1f(e,i.u_terrain_exaggeration)}))(e,w),this.binderUniforms=n?n.getUniforms(e,w):[]}draw(t,e,i,r,n,o,a,s,l,c,h,u,p,d,m,f,g,_){const y=t.gl;if(this.failedToCreate)return;if(t.program.set(this.program),t.setDepthMode(i),t.setStencilMode(r),t.setColorMode(n),t.setCullFace(o),s){t.activeTexture.set(y.TEXTURE2),y.bindTexture(y.TEXTURE_2D,s.depthTexture),t.activeTexture.set(y.TEXTURE3),y.bindTexture(y.TEXTURE_2D,s.texture);for(const t in this.terrainUniforms)this.terrainUniforms[t].set(s[t])}for(const t in this.fixedUniforms)this.fixedUniforms[t].set(a[t]);m&&m.setUniforms(t,this.binderUniforms,p,{zoom:d});let x=0;switch(e){case y.LINES:x=2;break;case y.TRIANGLES:x=3;break;case y.LINE_STRIP:x=1}for(const i of u.get()){const r=i.vaos||(i.vaos={});(r[l]||(r[l]=new he)).bind(t,this,c,m?m.getPaintVertexBuffers():[],h,i.vertexOffset,f,g,_),y.drawElements(e,i.primitiveLength*x,y.UNSIGNED_SHORT,i.primitiveOffset*x*2)}}}function de(t,e,i){const r=1/At(i,1,e.transform.tileZoom),n=Math.pow(2,i.tileID.overscaledZ),o=i.tileSize*Math.pow(2,e.transform.tileZoom)/n,a=o*(i.tileID.canonical.x+i.tileID.wrap*n),s=o*i.tileID.canonical.y;return{u_image:0,u_texsize:i.imageAtlasTexture.size,u_scale:[r,t.fromScale,t.toScale],u_fade:t.t,u_pixel_coord_upper:[a>>16,s>>16],u_pixel_coord_lower:[65535&a,65535&s]}}const me=(e,i,r,n)=>{const o=i.style.light,a=o.properties.get("position"),s=[a.x,a.y,a.z],l=function(){var e=new t.ARRAY_TYPE(9);return t.ARRAY_TYPE!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1,e}();"viewport"===o.properties.get("anchor")&&function(t,e){var i=Math.sin(e),r=Math.cos(e);t[0]=r,t[1]=i,t[2]=0,t[3]=-i,t[4]=r,t[5]=0,t[6]=0,t[7]=0,t[8]=1}(l,-i.transform.angle),function(t,e,i){var r=e[0],n=e[1],o=e[2];t[0]=r*i[0]+n*i[3]+o*i[6],t[1]=r*i[1]+n*i[4]+o*i[7],t[2]=r*i[2]+n*i[5]+o*i[8]}(s,s,l);const c=o.properties.get("color");return{u_matrix:e,u_lightpos:s,u_lightintensity:o.properties.get("intensity"),u_lightcolor:[c.r,c.g,c.b],u_vertical_gradient:+r,u_opacity:n}},fe=(e,i,r,n,o,a,s)=>t.extend(me(e,i,r,n),de(a,i,s),{u_height_factor:-Math.pow(2,o.overscaledZ)/s.tileSize/8}),ge=t=>({u_matrix:t}),_e=(e,i,r,n)=>t.extend(ge(e),de(r,i,n)),ye=(t,e)=>({u_matrix:t,u_world:e}),xe=(e,i,r,n,o)=>t.extend(_e(e,i,r,n),{u_world:o}),ve=(t,e,i,r)=>{const n=t.transform;let o,a;if("map"===r.paint.get("circle-pitch-alignment")){const t=At(i,1,n.zoom);o=!0,a=[t,t]}else o=!1,a=n.pixelsToGLUnits;return{u_camera_to_center_distance:n.cameraToCenterDistance,u_scale_with_map:+("map"===r.paint.get("circle-pitch-scale")),u_matrix:t.translatePosMatrix(e.posMatrix,i,r.paint.get("circle-translate"),r.paint.get("circle-translate-anchor")),u_pitch_with_map:+o,u_device_pixel_ratio:t.pixelRatio,u_extrude_scale:a}},be=(t,e,i)=>{const r=At(i,1,e.zoom),n=Math.pow(2,e.zoom-i.tileID.overscaledZ),o=i.tileID.overscaleFactor();return{u_matrix:t,u_camera_to_center_distance:e.cameraToCenterDistance,u_pixels_to_tile_units:r,u_extrude_scale:[e.pixelsToGLUnits[0]/(r*n),e.pixelsToGLUnits[1]/(r*n)],u_overscale_factor:o}},we=(t,e,i=1)=>({u_matrix:t,u_color:e,u_overlay:0,u_overlay_scale:i}),Ee=t=>({u_matrix:t}),Te=(t,e,i,r)=>({u_matrix:t,u_extrude_scale:At(e,1,i),u_intensity:r});function Se(e,i){const r=Math.pow(2,i.canonical.z),n=i.canonical.y;return[new t.MercatorCoordinate(0,n/r).toLngLat().lat,new t.MercatorCoordinate(0,(n+1)/r).toLngLat().lat]}const Ce=(t,e,i,r)=>{const n=t.transform;return{u_matrix:ze(t,e,i,r),u_ratio:1/At(e,1,n.zoom),u_device_pixel_ratio:t.pixelRatio,u_units_to_pixels:[1/n.pixelsToGLUnits[0],1/n.pixelsToGLUnits[1]]}},Ie=(e,i,r,n,o)=>t.extend(Ce(e,i,r,o),{u_image:0,u_image_height:n}),Ae=(t,e,i,r,n)=>{const o=t.transform,a=ke(e,o);return{u_matrix:ze(t,e,i,n),u_texsize:e.imageAtlasTexture.size,u_ratio:1/At(e,1,o.zoom),u_device_pixel_ratio:t.pixelRatio,u_image:0,u_scale:[a,r.fromScale,r.toScale],u_fade:r.t,u_units_to_pixels:[1/o.pixelsToGLUnits[0],1/o.pixelsToGLUnits[1]]}},Me=(e,i,r,n,o,a)=>{const s=e.lineAtlas,l=ke(i,e.transform),c="round"===r.layout.get("line-cap"),h=s.getDash(n.from,c),u=s.getDash(n.to,c),p=h.width*o.fromScale,d=u.width*o.toScale;return t.extend(Ce(e,i,r,a),{u_patternscale_a:[l/p,-h.height/2],u_patternscale_b:[l/d,-u.height/2],u_sdfgamma:s.width/(256*Math.min(p,d)*e.pixelRatio)/2,u_image:0,u_tex_y_a:h.y,u_tex_y_b:u.y,u_mix:o.t})};function ke(t,e){return 1/At(t,1,e.tileZoom)}function ze(t,e,i,r){return t.translatePosMatrix(r?r.posMatrix:e.tileID.posMatrix,e,i.paint.get("line-translate"),i.paint.get("line-translate-anchor"))}const Pe=(t,e,i,r,n)=>{return{u_matrix:t,u_tl_parent:e,u_scale_parent:i,u_buffer_scale:1,u_fade_t:r.mix,u_opacity:r.opacity*n.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:n.paint.get("raster-brightness-min"),u_brightness_high:n.paint.get("raster-brightness-max"),u_saturation_factor:(a=n.paint.get("raster-saturation"),a>0?1-1/(1.001-a):-a),u_contrast_factor:(o=n.paint.get("raster-contrast"),o>0?1/(1-o):1+o),u_spin_weights:Le(n.paint.get("raster-hue-rotate"))};var o,a};function Le(t){t*=Math.PI/180;const e=Math.sin(t),i=Math.cos(t);return[(2*i+1)/3,(-Math.sqrt(3)*e-i+1)/3,(Math.sqrt(3)*e-i+1)/3]}const De=(t,e,i,r,n,o,a,s,l,c)=>{const h=n.transform;return{u_is_size_zoom_constant:+("constant"===t||"source"===t),u_is_size_feature_constant:+("constant"===t||"camera"===t),u_size_t:e?e.uSizeT:0,u_size:e?e.uSize:0,u_camera_to_center_distance:h.cameraToCenterDistance,u_pitch:h.pitch/360*2*Math.PI,u_rotate_symbol:+i,u_aspect_ratio:h.width/h.height,u_fade_change:n.options.fadeDuration?n.symbolFadeChange:1,u_matrix:o,u_label_plane_matrix:a,u_coord_matrix:s,u_is_text:+l,u_pitch_with_map:+r,u_texsize:c,u_texture:0}},Re=(e,i,r,n,o,a,s,l,c,h,u)=>{const p=o.transform;return t.extend(De(e,i,r,n,o,a,s,l,c,h),{u_gamma_scale:n?Math.cos(p._pitch)*p.cameraToCenterDistance:1,u_device_pixel_ratio:o.pixelRatio,u_is_halo:+u})},Be=(e,i,r,n,o,a,s,l,c,h)=>t.extend(Re(e,i,r,n,o,a,s,l,!0,c,!0),{u_texsize_icon:h,u_texture_icon:1}),Fe=(t,e,i)=>({u_matrix:t,u_opacity:e,u_color:i}),Oe=(e,i,r,n,o,a)=>t.extend(function(t,e,i,r){const n=i.imageManager.getPattern(t.from.toString()),o=i.imageManager.getPattern(t.to.toString()),{width:a,height:s}=i.imageManager.getPixelSize(),l=Math.pow(2,r.tileID.overscaledZ),c=r.tileSize*Math.pow(2,i.transform.tileZoom)/l,h=c*(r.tileID.canonical.x+r.tileID.wrap*l),u=c*r.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:n.tl,u_pattern_br_a:n.br,u_pattern_tl_b:o.tl,u_pattern_br_b:o.br,u_texsize:[a,s],u_mix:e.t,u_pattern_size_a:n.displaySize,u_pattern_size_b:o.displaySize,u_scale_a:e.fromScale,u_scale_b:e.toScale,u_tile_units_to_pixels:1/At(r,1,i.transform.tileZoom),u_pixel_coord_upper:[h>>16,u>>16],u_pixel_coord_lower:[65535&h,65535&u]}}(n,a,r,o),{u_matrix:e,u_opacity:i}),Ue={fillExtrusion:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_lightpos:new t.Uniform3f(e,i.u_lightpos),u_lightintensity:new t.Uniform1f(e,i.u_lightintensity),u_lightcolor:new t.Uniform3f(e,i.u_lightcolor),u_vertical_gradient:new t.Uniform1f(e,i.u_vertical_gradient),u_opacity:new t.Uniform1f(e,i.u_opacity)}),fillExtrusionPattern:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_lightpos:new t.Uniform3f(e,i.u_lightpos),u_lightintensity:new t.Uniform1f(e,i.u_lightintensity),u_lightcolor:new t.Uniform3f(e,i.u_lightcolor),u_vertical_gradient:new t.Uniform1f(e,i.u_vertical_gradient),u_height_factor:new t.Uniform1f(e,i.u_height_factor),u_image:new t.Uniform1i(e,i.u_image),u_texsize:new t.Uniform2f(e,i.u_texsize),u_pixel_coord_upper:new t.Uniform2f(e,i.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,i.u_pixel_coord_lower),u_scale:new t.Uniform3f(e,i.u_scale),u_fade:new t.Uniform1f(e,i.u_fade),u_opacity:new t.Uniform1f(e,i.u_opacity)}),fill:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix)}),fillPattern:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_image:new t.Uniform1i(e,i.u_image),u_texsize:new t.Uniform2f(e,i.u_texsize),u_pixel_coord_upper:new t.Uniform2f(e,i.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,i.u_pixel_coord_lower),u_scale:new t.Uniform3f(e,i.u_scale),u_fade:new t.Uniform1f(e,i.u_fade)}),fillOutline:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_world:new t.Uniform2f(e,i.u_world)}),fillOutlinePattern:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_world:new t.Uniform2f(e,i.u_world),u_image:new t.Uniform1i(e,i.u_image),u_texsize:new t.Uniform2f(e,i.u_texsize),u_pixel_coord_upper:new t.Uniform2f(e,i.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,i.u_pixel_coord_lower),u_scale:new t.Uniform3f(e,i.u_scale),u_fade:new t.Uniform1f(e,i.u_fade)}),circle:(e,i)=>({u_camera_to_center_distance:new t.Uniform1f(e,i.u_camera_to_center_distance),u_scale_with_map:new t.Uniform1i(e,i.u_scale_with_map),u_pitch_with_map:new t.Uniform1i(e,i.u_pitch_with_map),u_extrude_scale:new t.Uniform2f(e,i.u_extrude_scale),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_matrix:new t.UniformMatrix4f(e,i.u_matrix)}),collisionBox:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_camera_to_center_distance:new t.Uniform1f(e,i.u_camera_to_center_distance),u_pixels_to_tile_units:new t.Uniform1f(e,i.u_pixels_to_tile_units),u_extrude_scale:new t.Uniform2f(e,i.u_extrude_scale),u_overscale_factor:new t.Uniform1f(e,i.u_overscale_factor)}),collisionCircle:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_inv_matrix:new t.UniformMatrix4f(e,i.u_inv_matrix),u_camera_to_center_distance:new t.Uniform1f(e,i.u_camera_to_center_distance),u_viewport_size:new t.Uniform2f(e,i.u_viewport_size)}),debug:(e,i)=>({u_color:new t.UniformColor(e,i.u_color),u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_overlay:new t.Uniform1i(e,i.u_overlay),u_overlay_scale:new t.Uniform1f(e,i.u_overlay_scale)}),clippingMask:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix)}),heatmap:(e,i)=>({u_extrude_scale:new t.Uniform1f(e,i.u_extrude_scale),u_intensity:new t.Uniform1f(e,i.u_intensity),u_matrix:new t.UniformMatrix4f(e,i.u_matrix)}),heatmapTexture:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_world:new t.Uniform2f(e,i.u_world),u_image:new t.Uniform1i(e,i.u_image),u_color_ramp:new t.Uniform1i(e,i.u_color_ramp),u_opacity:new t.Uniform1f(e,i.u_opacity)}),hillshade:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_image:new t.Uniform1i(e,i.u_image),u_latrange:new t.Uniform2f(e,i.u_latrange),u_light:new t.Uniform2f(e,i.u_light),u_shadow:new t.UniformColor(e,i.u_shadow),u_highlight:new t.UniformColor(e,i.u_highlight),u_accent:new t.UniformColor(e,i.u_accent)}),hillshadePrepare:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_image:new t.Uniform1i(e,i.u_image),u_dimension:new t.Uniform2f(e,i.u_dimension),u_zoom:new t.Uniform1f(e,i.u_zoom),u_unpack:new t.Uniform4f(e,i.u_unpack)}),line:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_ratio:new t.Uniform1f(e,i.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_units_to_pixels:new t.Uniform2f(e,i.u_units_to_pixels)}),lineGradient:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_ratio:new t.Uniform1f(e,i.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_units_to_pixels:new t.Uniform2f(e,i.u_units_to_pixels),u_image:new t.Uniform1i(e,i.u_image),u_image_height:new t.Uniform1f(e,i.u_image_height)}),linePattern:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_texsize:new t.Uniform2f(e,i.u_texsize),u_ratio:new t.Uniform1f(e,i.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_image:new t.Uniform1i(e,i.u_image),u_units_to_pixels:new t.Uniform2f(e,i.u_units_to_pixels),u_scale:new t.Uniform3f(e,i.u_scale),u_fade:new t.Uniform1f(e,i.u_fade)}),lineSDF:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_ratio:new t.Uniform1f(e,i.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_units_to_pixels:new t.Uniform2f(e,i.u_units_to_pixels),u_patternscale_a:new t.Uniform2f(e,i.u_patternscale_a),u_patternscale_b:new t.Uniform2f(e,i.u_patternscale_b),u_sdfgamma:new t.Uniform1f(e,i.u_sdfgamma),u_image:new t.Uniform1i(e,i.u_image),u_tex_y_a:new t.Uniform1f(e,i.u_tex_y_a),u_tex_y_b:new t.Uniform1f(e,i.u_tex_y_b),u_mix:new t.Uniform1f(e,i.u_mix)}),raster:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_tl_parent:new t.Uniform2f(e,i.u_tl_parent),u_scale_parent:new t.Uniform1f(e,i.u_scale_parent),u_buffer_scale:new t.Uniform1f(e,i.u_buffer_scale),u_fade_t:new t.Uniform1f(e,i.u_fade_t),u_opacity:new t.Uniform1f(e,i.u_opacity),u_image0:new t.Uniform1i(e,i.u_image0),u_image1:new t.Uniform1i(e,i.u_image1),u_brightness_low:new t.Uniform1f(e,i.u_brightness_low),u_brightness_high:new t.Uniform1f(e,i.u_brightness_high),u_saturation_factor:new t.Uniform1f(e,i.u_saturation_factor),u_contrast_factor:new t.Uniform1f(e,i.u_contrast_factor),u_spin_weights:new t.Uniform3f(e,i.u_spin_weights)}),symbolIcon:(e,i)=>({u_is_size_zoom_constant:new t.Uniform1i(e,i.u_is_size_zoom_constant),u_is_size_feature_constant:new t.Uniform1i(e,i.u_is_size_feature_constant),u_size_t:new t.Uniform1f(e,i.u_size_t),u_size:new t.Uniform1f(e,i.u_size),u_camera_to_center_distance:new t.Uniform1f(e,i.u_camera_to_center_distance),u_pitch:new t.Uniform1f(e,i.u_pitch),u_rotate_symbol:new t.Uniform1i(e,i.u_rotate_symbol),u_aspect_ratio:new t.Uniform1f(e,i.u_aspect_ratio),u_fade_change:new t.Uniform1f(e,i.u_fade_change),u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_label_plane_matrix:new t.UniformMatrix4f(e,i.u_label_plane_matrix),u_coord_matrix:new t.UniformMatrix4f(e,i.u_coord_matrix),u_is_text:new t.Uniform1i(e,i.u_is_text),u_pitch_with_map:new t.Uniform1i(e,i.u_pitch_with_map),u_texsize:new t.Uniform2f(e,i.u_texsize),u_texture:new t.Uniform1i(e,i.u_texture)}),symbolSDF:(e,i)=>({u_is_size_zoom_constant:new t.Uniform1i(e,i.u_is_size_zoom_constant),u_is_size_feature_constant:new t.Uniform1i(e,i.u_is_size_feature_constant),u_size_t:new t.Uniform1f(e,i.u_size_t),u_size:new t.Uniform1f(e,i.u_size),u_camera_to_center_distance:new t.Uniform1f(e,i.u_camera_to_center_distance),u_pitch:new t.Uniform1f(e,i.u_pitch),u_rotate_symbol:new t.Uniform1i(e,i.u_rotate_symbol),u_aspect_ratio:new t.Uniform1f(e,i.u_aspect_ratio),u_fade_change:new t.Uniform1f(e,i.u_fade_change),u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_label_plane_matrix:new t.UniformMatrix4f(e,i.u_label_plane_matrix),u_coord_matrix:new t.UniformMatrix4f(e,i.u_coord_matrix),u_is_text:new t.Uniform1i(e,i.u_is_text),u_pitch_with_map:new t.Uniform1i(e,i.u_pitch_with_map),u_texsize:new t.Uniform2f(e,i.u_texsize),u_texture:new t.Uniform1i(e,i.u_texture),u_gamma_scale:new t.Uniform1f(e,i.u_gamma_scale),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_is_halo:new t.Uniform1i(e,i.u_is_halo)}),symbolTextAndIcon:(e,i)=>({u_is_size_zoom_constant:new t.Uniform1i(e,i.u_is_size_zoom_constant),u_is_size_feature_constant:new t.Uniform1i(e,i.u_is_size_feature_constant),u_size_t:new t.Uniform1f(e,i.u_size_t),u_size:new t.Uniform1f(e,i.u_size),u_camera_to_center_distance:new t.Uniform1f(e,i.u_camera_to_center_distance),u_pitch:new t.Uniform1f(e,i.u_pitch),u_rotate_symbol:new t.Uniform1i(e,i.u_rotate_symbol),u_aspect_ratio:new t.Uniform1f(e,i.u_aspect_ratio),u_fade_change:new t.Uniform1f(e,i.u_fade_change),u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_label_plane_matrix:new t.UniformMatrix4f(e,i.u_label_plane_matrix),u_coord_matrix:new t.UniformMatrix4f(e,i.u_coord_matrix),u_is_text:new t.Uniform1i(e,i.u_is_text),u_pitch_with_map:new t.Uniform1i(e,i.u_pitch_with_map),u_texsize:new t.Uniform2f(e,i.u_texsize),u_texsize_icon:new t.Uniform2f(e,i.u_texsize_icon),u_texture:new t.Uniform1i(e,i.u_texture),u_texture_icon:new t.Uniform1i(e,i.u_texture_icon),u_gamma_scale:new t.Uniform1f(e,i.u_gamma_scale),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_is_halo:new t.Uniform1i(e,i.u_is_halo)}),background:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_opacity:new t.Uniform1f(e,i.u_opacity),u_color:new t.UniformColor(e,i.u_color)}),backgroundPattern:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_opacity:new t.Uniform1f(e,i.u_opacity),u_image:new t.Uniform1i(e,i.u_image),u_pattern_tl_a:new t.Uniform2f(e,i.u_pattern_tl_a),u_pattern_br_a:new t.Uniform2f(e,i.u_pattern_br_a),u_pattern_tl_b:new t.Uniform2f(e,i.u_pattern_tl_b),u_pattern_br_b:new t.Uniform2f(e,i.u_pattern_br_b),u_texsize:new t.Uniform2f(e,i.u_texsize),u_mix:new t.Uniform1f(e,i.u_mix),u_pattern_size_a:new t.Uniform2f(e,i.u_pattern_size_a),u_pattern_size_b:new t.Uniform2f(e,i.u_pattern_size_b),u_scale_a:new t.Uniform1f(e,i.u_scale_a),u_scale_b:new t.Uniform1f(e,i.u_scale_b),u_pixel_coord_upper:new t.Uniform2f(e,i.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,i.u_pixel_coord_lower),u_tile_units_to_pixels:new t.Uniform1f(e,i.u_tile_units_to_pixels)}),terrain:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_texture:new t.Uniform1i(e,i.u_texture),u_ele_delta:new t.Uniform1f(e,i.u_ele_delta)}),terrainDepth:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_ele_delta:new t.Uniform1f(e,i.u_ele_delta)}),terrainCoords:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_texture:new t.Uniform1i(e,i.u_texture),u_terrain_coords_id:new t.Uniform1f(e,i.u_terrain_coords_id),u_ele_delta:new t.Uniform1f(e,i.u_ele_delta)})};class Ve{constructor(t,e,i){this.context=t;const r=t.gl;this.buffer=r.createBuffer(),this.dynamicDraw=Boolean(i),this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),r.bufferData(r.ELEMENT_ARRAY_BUFFER,e.arrayBuffer,this.dynamicDraw?r.DYNAMIC_DRAW:r.STATIC_DRAW),this.dynamicDraw||delete e.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(t){const e=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),e.bufferSubData(e.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const Ne={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class $e{constructor(t,e,i,r){this.length=e.length,this.attributes=i,this.itemSize=e.bytesPerElement,this.dynamicDraw=r,this.context=t;const n=t.gl;this.buffer=n.createBuffer(),t.bindVertexBuffer.set(this.buffer),n.bufferData(n.ARRAY_BUFFER,e.arrayBuffer,this.dynamicDraw?n.DYNAMIC_DRAW:n.STATIC_DRAW),this.dynamicDraw||delete e.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(t){if(t.length!==this.length)throw new Error(`Length of new data is ${t.length}, which doesn't match current length of ${this.length}`);const e=this.context.gl;this.bind(),e.bufferSubData(e.ARRAY_BUFFER,0,t.arrayBuffer)}enableAttributes(t,e){for(let i=0;i<this.attributes.length;i++){const r=e.attributes[this.attributes[i].name];void 0!==r&&t.enableVertexAttribArray(r)}}setVertexAttribPointers(t,e,i){for(let r=0;r<this.attributes.length;r++){const n=this.attributes[r],o=e.attributes[n.name];void 0!==o&&t.vertexAttribPointer(o,n.components,t[Ne[n.type]],!1,this.itemSize,n.offset+this.itemSize*(i||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class je{constructor(t){this.gl=t.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(t){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class qe extends je{getDefault(){return t.Color.transparent}set(t){const e=this.current;(t.r!==e.r||t.g!==e.g||t.b!==e.b||t.a!==e.a||this.dirty)&&(this.gl.clearColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class Ze extends je{getDefault(){return 1}set(t){(t!==this.current||this.dirty)&&(this.gl.clearDepth(t),this.current=t,this.dirty=!1)}}class Ge extends je{getDefault(){return 0}set(t){(t!==this.current||this.dirty)&&(this.gl.clearStencil(t),this.current=t,this.dirty=!1)}}class He extends je{getDefault(){return[!0,!0,!0,!0]}set(t){const e=this.current;(t[0]!==e[0]||t[1]!==e[1]||t[2]!==e[2]||t[3]!==e[3]||this.dirty)&&(this.gl.colorMask(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class Xe extends je{getDefault(){return!0}set(t){(t!==this.current||this.dirty)&&(this.gl.depthMask(t),this.current=t,this.dirty=!1)}}class We extends je{getDefault(){return 255}set(t){(t!==this.current||this.dirty)&&(this.gl.stencilMask(t),this.current=t,this.dirty=!1)}}class Ke extends je{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(t){const e=this.current;(t.func!==e.func||t.ref!==e.ref||t.mask!==e.mask||this.dirty)&&(this.gl.stencilFunc(t.func,t.ref,t.mask),this.current=t,this.dirty=!1)}}class Ye extends je{getDefault(){const t=this.gl;return[t.KEEP,t.KEEP,t.KEEP]}set(t){const e=this.current;(t[0]!==e[0]||t[1]!==e[1]||t[2]!==e[2]||this.dirty)&&(this.gl.stencilOp(t[0],t[1],t[2]),this.current=t,this.dirty=!1)}}class Je extends je{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;t?e.enable(e.STENCIL_TEST):e.disable(e.STENCIL_TEST),this.current=t,this.dirty=!1}}class Qe extends je{getDefault(){return[0,1]}set(t){const e=this.current;(t[0]!==e[0]||t[1]!==e[1]||this.dirty)&&(this.gl.depthRange(t[0],t[1]),this.current=t,this.dirty=!1)}}class ti extends je{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;t?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST),this.current=t,this.dirty=!1}}class ei extends je{getDefault(){return this.gl.LESS}set(t){(t!==this.current||this.dirty)&&(this.gl.depthFunc(t),this.current=t,this.dirty=!1)}}class ii extends je{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;t?e.enable(e.BLEND):e.disable(e.BLEND),this.current=t,this.dirty=!1}}class ri extends je{getDefault(){const t=this.gl;return[t.ONE,t.ZERO]}set(t){const e=this.current;(t[0]!==e[0]||t[1]!==e[1]||this.dirty)&&(this.gl.blendFunc(t[0],t[1]),this.current=t,this.dirty=!1)}}class ni extends je{getDefault(){return t.Color.transparent}set(t){const e=this.current;(t.r!==e.r||t.g!==e.g||t.b!==e.b||t.a!==e.a||this.dirty)&&(this.gl.blendColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class oi extends je{getDefault(){return this.gl.FUNC_ADD}set(t){(t!==this.current||this.dirty)&&(this.gl.blendEquation(t),this.current=t,this.dirty=!1)}}class ai extends je{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;t?e.enable(e.CULL_FACE):e.disable(e.CULL_FACE),this.current=t,this.dirty=!1}}class si extends je{getDefault(){return this.gl.BACK}set(t){(t!==this.current||this.dirty)&&(this.gl.cullFace(t),this.current=t,this.dirty=!1)}}class li extends je{getDefault(){return this.gl.CCW}set(t){(t!==this.current||this.dirty)&&(this.gl.frontFace(t),this.current=t,this.dirty=!1)}}class ci extends je{getDefault(){return null}set(t){(t!==this.current||this.dirty)&&(this.gl.useProgram(t),this.current=t,this.dirty=!1)}}class hi extends je{getDefault(){return this.gl.TEXTURE0}set(t){(t!==this.current||this.dirty)&&(this.gl.activeTexture(t),this.current=t,this.dirty=!1)}}class ui extends je{getDefault(){const t=this.gl;return[0,0,t.drawingBufferWidth,t.drawingBufferHeight]}set(t){const e=this.current;(t[0]!==e[0]||t[1]!==e[1]||t[2]!==e[2]||t[3]!==e[3]||this.dirty)&&(this.gl.viewport(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class pi extends je{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.bindFramebuffer(e.FRAMEBUFFER,t),this.current=t,this.dirty=!1}}class di extends je{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.bindRenderbuffer(e.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class mi extends je{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.bindTexture(e.TEXTURE_2D,t),this.current=t,this.dirty=!1}}class fi extends je{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.bindBuffer(e.ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class gi extends je{getDefault(){return null}set(t){const e=this.gl;e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class _i extends je{getDefault(){return null}set(t){(t!==this.current||this.dirty)&&(this.gl.bindVertexArray(t),this.current=t,this.dirty=!1)}}class yi extends je{getDefault(){return 4}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.pixelStorei(e.UNPACK_ALIGNMENT,t),this.current=t,this.dirty=!1}}class xi extends je{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t),this.current=t,this.dirty=!1}}class vi extends je{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,t),this.current=t,this.dirty=!1}}class bi extends je{constructor(t,e){super(t),this.context=t,this.parent=e}getDefault(){return null}}class wi extends bi{setDirty(){this.dirty=!0}set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const e=this.gl;e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t,0),this.current=t,this.dirty=!1}}class Ei extends bi{set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const e=this.gl;e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class Ti extends bi{set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const e=this.gl;e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class Si{constructor(t,e,i,r,n){this.context=t,this.width=e,this.height=i;const o=t.gl,a=this.framebuffer=o.createFramebuffer();if(this.colorAttachment=new wi(t,a),r)this.depthAttachment=n?new Ti(t,a):new Ei(t,a);else if(n)throw new Error("Stencil cannot be setted without depth");if(o.checkFramebufferStatus(o.FRAMEBUFFER)!==o.FRAMEBUFFER_COMPLETE)throw new Error("Framebuffer is not complete")}destroy(){const t=this.context.gl,e=this.colorAttachment.get();if(e&&t.deleteTexture(e),this.depthAttachment){const e=this.depthAttachment.get();e&&t.deleteRenderbuffer(e)}t.deleteFramebuffer(this.framebuffer)}}class Ci{constructor(t,e,i){this.blendFunction=t,this.blendColor=e,this.mask=i}}Ci.Replace=[1,0],Ci.disabled=new Ci(Ci.Replace,t.Color.transparent,[!1,!1,!1,!1]),Ci.unblended=new Ci(Ci.Replace,t.Color.transparent,[!0,!0,!0,!0]),Ci.alphaBlended=new Ci([1,771],t.Color.transparent,[!0,!0,!0,!0]);class Ii{constructor(t){this.gl=t,this.clearColor=new qe(this),this.clearDepth=new Ze(this),this.clearStencil=new Ge(this),this.colorMask=new He(this),this.depthMask=new Xe(this),this.stencilMask=new We(this),this.stencilFunc=new Ke(this),this.stencilOp=new Ye(this),this.stencilTest=new Je(this),this.depthRange=new Qe(this),this.depthTest=new ti(this),this.depthFunc=new ei(this),this.blend=new ii(this),this.blendFunc=new ri(this),this.blendColor=new ni(this),this.blendEquation=new oi(this),this.cullFace=new ai(this),this.cullFaceSide=new si(this),this.frontFace=new li(this),this.program=new ci(this),this.activeTexture=new hi(this),this.viewport=new ui(this),this.bindFramebuffer=new pi(this),this.bindRenderbuffer=new di(this),this.bindTexture=new mi(this),this.bindVertexBuffer=new fi(this),this.bindElementBuffer=new gi(this),this.bindVertexArray=new _i(this),this.pixelStoreUnpack=new yi(this),this.pixelStoreUnpackPremultiplyAlpha=new xi(this),this.pixelStoreUnpackFlipY=new vi(this),this.extTextureFilterAnisotropic=t.getExtension("EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=t.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=t.getParameter(t.MAX_TEXTURE_SIZE),this.HALF_FLOAT=t.HALF_FLOAT,t.getExtension("EXT_color_buffer_half_float"),t.getExtension("EXT_color_buffer_float"),this.RGBA16F=t.RGBA16F,this.RGB16F=t.RGB16F}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.bindVertexArray.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(t,e){return new Ve(this,t,e)}createVertexBuffer(t,e,i){return new $e(this,t,e,i)}createRenderbuffer(t,e,i){const r=this.gl,n=r.createRenderbuffer();return this.bindRenderbuffer.set(n),r.renderbufferStorage(r.RENDERBUFFER,t,e,i),this.bindRenderbuffer.set(null),n}createFramebuffer(t,e,i,r){return new Si(this,t,e,i,r)}clear({color:t,depth:e,stencil:i}){const r=this.gl;let n=0;t&&(n|=r.COLOR_BUFFER_BIT,this.clearColor.set(t),this.colorMask.set([!0,!0,!0,!0])),void 0!==e&&(n|=r.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(e),this.depthMask.set(!0)),void 0!==i&&(n|=r.STENCIL_BUFFER_BIT,this.clearStencil.set(i),this.stencilMask.set(255)),r.clear(n)}setCullFace(t){!1===t.enable?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(t.mode),this.frontFace.set(t.frontFace))}setDepthMode(t){t.func!==this.gl.ALWAYS||t.mask?(this.depthTest.set(!0),this.depthFunc.set(t.func),this.depthMask.set(t.mask),this.depthRange.set(t.range)):this.depthTest.set(!1)}setStencilMode(t){t.test.func!==this.gl.ALWAYS||t.mask?(this.stencilTest.set(!0),this.stencilMask.set(t.mask),this.stencilOp.set([t.fail,t.depthFail,t.pass]),this.stencilFunc.set({func:t.test.func,ref:t.ref,mask:t.test.mask})):this.stencilTest.set(!1)}setColorMode(e){t.deepEqual(e.blendFunction,Ci.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(e.blendFunction),this.blendColor.set(e.blendColor)),this.colorMask.set(e.mask)}createVertexArray(){return this.gl.createVertexArray()}deleteVertexArray(t){return this.gl.deleteVertexArray(t)}unbindVAO(){this.bindVertexArray.set(null)}}class Ai{constructor(t,e,i){this.func=t,this.mask=e,this.range=i}}Ai.ReadOnly=!1,Ai.ReadWrite=!0,Ai.disabled=new Ai(519,Ai.ReadOnly,[0,1]);const Mi=7680;class ki{constructor(t,e,i,r,n,o){this.test=t,this.ref=e,this.mask=i,this.fail=r,this.depthFail=n,this.pass=o}}ki.disabled=new ki({func:519,mask:0},0,0,Mi,Mi,Mi);class zi{constructor(t,e,i){this.enable=t,this.mode=e,this.frontFace=i}}let Pi;function Li(e,i,r,n,o,a,s){const l=e.context,c=l.gl,h=e.useProgram("collisionBox"),u=[];let p=0,d=0;for(let m=0;m<n.length;m++){const f=n[m],g=i.getTile(f),_=g.getBucket(r);if(!_)continue;let y=f.posMatrix;0===o[0]&&0===o[1]||(y=e.translatePosMatrix(f.posMatrix,g,o,a));const x=s?_.textCollisionBox:_.iconCollisionBox,v=_.collisionCircleArray;if(v.length>0){const i=t.create(),r=y;t.mul(i,_.placementInvProjMatrix,e.transform.glCoordMatrix),t.mul(i,i,_.placementViewportMatrix),u.push({circleArray:v,circleOffset:d,transform:r,invTransform:i,coord:f}),p+=v.length/4,d=p}x&&h.draw(l,c.LINES,Ai.disabled,ki.disabled,e.colorModeForRenderPass(),zi.disabled,be(y,e.transform,g),e.style.map.terrain&&e.style.map.terrain.getTerrainData(f),r.id,x.layoutVertexBuffer,x.indexBuffer,x.segments,null,e.transform.zoom,null,null,x.collisionVertexBuffer)}if(!s||!u.length)return;const m=e.useProgram("collisionCircle"),f=new t.CollisionCircleLayoutArray;f.resize(4*p),f._trim();let g=0;for(const t of u)for(let e=0;e<t.circleArray.length/4;e++){const i=4*e,r=t.circleArray[i+0],n=t.circleArray[i+1],o=t.circleArray[i+2],a=t.circleArray[i+3];f.emplace(g++,r,n,o,a,0),f.emplace(g++,r,n,o,a,1),f.emplace(g++,r,n,o,a,2),f.emplace(g++,r,n,o,a,3)}(!Pi||Pi.length<2*p)&&(Pi=function(e){const i=2*e,r=new t.QuadTriangleArray;r.resize(i),r._trim();for(let t=0;t<i;t++){const e=6*t;r.uint16[e+0]=4*t+0,r.uint16[e+1]=4*t+1,r.uint16[e+2]=4*t+2,r.uint16[e+3]=4*t+2,r.uint16[e+4]=4*t+3,r.uint16[e+5]=4*t+0}return r}(p));const _=l.createIndexBuffer(Pi,!0),y=l.createVertexBuffer(f,t.collisionCircleLayout.members,!0);for(const i of u){const n={u_matrix:i.transform,u_inv_matrix:i.invTransform,u_camera_to_center_distance:(x=e.transform).cameraToCenterDistance,u_viewport_size:[x.width,x.height]};m.draw(l,c.TRIANGLES,Ai.disabled,ki.disabled,e.colorModeForRenderPass(),zi.disabled,n,e.style.map.terrain&&e.style.map.terrain.getTerrainData(i.coord),r.id,y,_,t.SegmentVector.simpleSegment(0,2*i.circleOffset,i.circleArray.length,i.circleArray.length/2),null,e.transform.zoom,null,null,null)}var x;y.destroy(),_.destroy()}zi.disabled=new zi(!1,1029,2305),zi.backCCW=new zi(!0,1029,2305);const Di=t.identity(new Float32Array(16));function Ri(e,i,r,n,o,a){const{horizontalAlign:s,verticalAlign:l}=t.getAnchorAlignment(e),c=-(s-.5)*i,h=-(l-.5)*r,u=t.evaluateVariableOffset(e,n);return new t.Point((c/o+u[0])*a,(h/o+u[1])*a)}function Bi(e,i,r,n,o,a,s,l,c,h,u){const p=e.text.placedSymbolArray,d=e.text.dynamicLayoutVertexArray,m=e.icon.dynamicLayoutVertexArray,f={};d.clear();for(let m=0;m<p.length;m++){const g=p.get(m),_=g.hidden||!g.crossTileID||e.allowVerticalPlacement&&!g.placedOrientation?null:n[g.crossTileID];if(_){const n=new t.Point(g.anchorX,g.anchorY),p=ut(n,r?s:a,u),m=pt(o.cameraToCenterDistance,p.signedDistanceFromCamera);let y=t.evaluateSizeForFeature(e.textSizeData,c,g)*m/t.ONE_EM;r&&(y*=e.tilePixelRatio/l);const{width:x,height:v,anchor:b,textOffset:w,textBoxScale:E}=_,T=Ri(b,x,v,w,E,y),S=r?ut(n.add(T),a,u).point:p.point.add(i?T.rotate(-o.angle):T),C=e.allowVerticalPlacement&&g.placedOrientation===t.WritingMode.vertical?Math.PI/2:0;for(let e=0;e<g.numGlyphs;e++)t.addDynamicAttributes(d,S,C);h&&g.associatedIconIndex>=0&&(f[g.associatedIconIndex]={shiftedAnchor:S,angle:C})}else Tt(g.numGlyphs,d)}if(h){m.clear();const i=e.icon.placedSymbolArray;for(let e=0;e<i.length;e++){const r=i.get(e);if(r.hidden)Tt(r.numGlyphs,m);else{const i=f[e];if(i)for(let e=0;e<r.numGlyphs;e++)t.addDynamicAttributes(m,i.shiftedAnchor,i.angle);else Tt(r.numGlyphs,m)}}e.icon.dynamicLayoutVertexBuffer.updateData(m)}e.text.dynamicLayoutVertexBuffer.updateData(d)}function Fi(t,e,i){return i.iconsInText&&e?"symbolTextAndIcon":t?"symbolSDF":"symbolIcon"}function Oi(e,i,r,n,o,a,s,l,c,h,u,p){const d=e.context,m=d.gl,f=e.transform,g="map"===l,_="map"===c,y="viewport"!==l&&"point"!==r.layout.get("symbol-placement"),x=g&&!_&&!y,v=!r.layout.get("symbol-sort-key").isConstant();let b=!1;const w=e.depthModeForSublayer(0,Ai.ReadOnly),E=r.layout.get("text-variable-anchor"),T=[];for(const l of n){const n=i.getTile(l),c=n.getBucket(r);if(!c)continue;const u=o?c.text:c.icon;if(!u||!u.segments.get().length||!u.hasVisibleVertices)continue;const p=u.programConfigurations.get(r.id),d=o||c.sdfIcons,w=o?c.textSizeData:c.iconSizeData,S=_||0!==f.pitch,C=e.useProgram(Fi(d,o,c),p),I=t.evaluateSizeForZoom(w,f.zoom),A=e.style.map.terrain&&e.style.map.terrain.getTerrainData(l);let M,k,z,P,L=[0,0],D=null;if(o)k=n.glyphAtlasTexture,z=m.LINEAR,M=n.glyphAtlasTexture.size,c.iconsInText&&(L=n.imageAtlasTexture.size,D=n.imageAtlasTexture,P=S||e.options.rotating||e.options.zooming||"composite"===w.kind||"camera"===w.kind?m.LINEAR:m.NEAREST);else{const t=1!==r.layout.get("icon-size").constantOr(0)||c.iconsNeedLinear;k=n.imageAtlasTexture,z=d||e.options.rotating||e.options.zooming||t||S?m.LINEAR:m.NEAREST,M=n.imageAtlasTexture.size}const R=At(n,1,e.transform.zoom),B=ct(l.posMatrix,_,g,e.transform,R),F=ht(l.posMatrix,_,g,e.transform,R),O=E&&c.hasTextData(),U="none"!==r.layout.get("icon-text-fit")&&O&&c.hasIconData();if(y){const t=e.style.map.terrain?(t,i)=>e.style.map.terrain.getElevation(l,t,i):null,i="map"===r.layout.get("text-rotation-alignment");mt(c,l.posMatrix,e,o,B,F,_,h,i,t)}const V=e.translatePosMatrix(l.posMatrix,n,a,s),N=y||o&&E||U?Di:B,$=e.translatePosMatrix(F,n,a,s,!0),j=d&&0!==r.paint.get(o?"text-halo-width":"icon-halo-width").constantOr(1);let q;q=d?c.iconsInText?Be(w.kind,I,x,_,e,V,N,$,M,L):Re(w.kind,I,x,_,e,V,N,$,o,M,!0):De(w.kind,I,x,_,e,V,N,$,o,M);const Z={program:C,buffers:u,uniformValues:q,atlasTexture:k,atlasTextureIcon:D,atlasInterpolation:z,atlasInterpolationIcon:P,isSDF:d,hasHalo:j};if(v&&c.canOverlap){b=!0;const e=u.segments.get();for(const i of e)T.push({segments:new t.SegmentVector([i]),sortKey:i.sortKey,state:Z,terrainData:A})}else T.push({segments:u.segments,sortKey:0,state:Z,terrainData:A})}b&&T.sort(((t,e)=>t.sortKey-e.sortKey));for(const t of T){const i=t.state;if(d.activeTexture.set(m.TEXTURE0),i.atlasTexture.bind(i.atlasInterpolation,m.CLAMP_TO_EDGE),i.atlasTextureIcon&&(d.activeTexture.set(m.TEXTURE1),i.atlasTextureIcon&&i.atlasTextureIcon.bind(i.atlasInterpolationIcon,m.CLAMP_TO_EDGE)),i.isSDF){const n=i.uniformValues;i.hasHalo&&(n.u_is_halo=1,Ui(i.buffers,t.segments,r,e,i.program,w,u,p,n,t.terrainData)),n.u_is_halo=0}Ui(i.buffers,t.segments,r,e,i.program,w,u,p,i.uniformValues,t.terrainData)}}function Ui(t,e,i,r,n,o,a,s,l,c){const h=r.context;n.draw(h,h.gl.TRIANGLES,o,a,s,zi.disabled,l,c,i.id,t.layoutVertexBuffer,t.indexBuffer,e,i.paint,r.transform.zoom,t.programConfigurations.get(i.id),t.dynamicLayoutVertexBuffer,t.opacityVertexBuffer)}function Vi(t,e,i,r,n){if(!i||!r||!r.imageAtlas)return;const o=r.imageAtlas.patternPositions;let a=o[i.to.toString()],s=o[i.from.toString()];if(!a||!s){const t=n.getPaintProperty(e);a=o[t],s=o[t]}a&&s&&t.setConstantPatternPositions(a,s)}function Ni(t,e,i,r,n,o,a){const s=t.context.gl,l="fill-pattern",c=i.paint.get(l),h=c&&c.constantOr(1),u=i.getCrossfadeParameters();let p,d,m,f,g;a?(d=h&&!i.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",p=s.LINES):(d=h?"fillPattern":"fill",p=s.TRIANGLES);const _=c.constantOr(null);for(const c of r){const r=e.getTile(c);if(h&&!r.patternsLoaded())continue;const y=r.getBucket(i);if(!y)continue;const x=y.programConfigurations.get(i.id),v=t.useProgram(d,x),b=t.style.map.terrain&&t.style.map.terrain.getTerrainData(c);h&&(t.context.activeTexture.set(s.TEXTURE0),r.imageAtlasTexture.bind(s.LINEAR,s.CLAMP_TO_EDGE),x.updatePaintBuffers(u)),Vi(x,l,_,r,i);const w=b?c:null,E=t.translatePosMatrix(w?w.posMatrix:c.posMatrix,r,i.paint.get("fill-translate"),i.paint.get("fill-translate-anchor"));if(a){f=y.indexBuffer2,g=y.segments2;const e=[s.drawingBufferWidth,s.drawingBufferHeight];m="fillOutlinePattern"===d&&h?xe(E,t,u,r,e):ye(E,e)}else f=y.indexBuffer,g=y.segments,m=h?_e(E,t,u,r):ge(E);v.draw(t.context,p,n,t.stencilModeForClipping(c),o,zi.disabled,m,b,i.id,y.layoutVertexBuffer,f,g,i.paint,t.transform.zoom,x)}}function $i(t,e,i,r,n,o,a){const s=t.context,l=s.gl,c="fill-extrusion-pattern",h=i.paint.get(c),u=h.constantOr(1),p=i.getCrossfadeParameters(),d=i.paint.get("fill-extrusion-opacity"),m=h.constantOr(null);for(const h of r){const r=e.getTile(h),f=r.getBucket(i);if(!f)continue;const g=t.style.map.terrain&&t.style.map.terrain.getTerrainData(h),_=f.programConfigurations.get(i.id),y=t.useProgram(u?"fillExtrusionPattern":"fillExtrusion",_);u&&(t.context.activeTexture.set(l.TEXTURE0),r.imageAtlasTexture.bind(l.LINEAR,l.CLAMP_TO_EDGE),_.updatePaintBuffers(p)),Vi(_,c,m,r,i);const x=t.translatePosMatrix(h.posMatrix,r,i.paint.get("fill-extrusion-translate"),i.paint.get("fill-extrusion-translate-anchor")),v=i.paint.get("fill-extrusion-vertical-gradient"),b=u?fe(x,t,v,d,h,p,r):me(x,t,v,d);y.draw(s,s.gl.TRIANGLES,n,o,a,zi.backCCW,b,g,i.id,f.layoutVertexBuffer,f.indexBuffer,f.segments,i.paint,t.transform.zoom,_,t.style.map.terrain&&f.centroidVertexBuffer)}}function ji(t,e,i,r,n,o,a){const s=t.context,l=s.gl,c=i.fbo;if(!c)return;const h=t.useProgram("hillshade"),u=t.style.map.terrain&&t.style.map.terrain.getTerrainData(e);s.activeTexture.set(l.TEXTURE0),l.bindTexture(l.TEXTURE_2D,c.colorAttachment.get()),h.draw(s,l.TRIANGLES,n,o,a,zi.disabled,((t,e,i,r)=>{const n=i.paint.get("hillshade-shadow-color"),o=i.paint.get("hillshade-highlight-color"),a=i.paint.get("hillshade-accent-color");let s=i.paint.get("hillshade-illumination-direction")*(Math.PI/180);"viewport"===i.paint.get("hillshade-illumination-anchor")&&(s-=t.transform.angle);const l=!t.options.moving;return{u_matrix:r?r.posMatrix:t.transform.calculatePosMatrix(e.tileID.toUnwrapped(),l),u_image:0,u_latrange:Se(0,e.tileID),u_light:[i.paint.get("hillshade-exaggeration"),s],u_shadow:n,u_highlight:o,u_accent:a}})(t,i,r,u?e:null),u,r.id,t.rasterBoundsBuffer,t.quadTriangleIndexBuffer,t.rasterBoundsSegments)}function qi(e,i,r,n,o,a){const s=e.context,l=s.gl,c=i.dem;if(c&&c.data){const h=c.dim,u=c.stride,p=c.getPixels();if(s.activeTexture.set(l.TEXTURE1),s.pixelStoreUnpackPremultiplyAlpha.set(!1),i.demTexture=i.demTexture||e.getTileTexture(u),i.demTexture){const t=i.demTexture;t.update(p,{premultiply:!1}),t.bind(l.NEAREST,l.CLAMP_TO_EDGE)}else i.demTexture=new v(s,p,l.RGBA,{premultiply:!1}),i.demTexture.bind(l.NEAREST,l.CLAMP_TO_EDGE);s.activeTexture.set(l.TEXTURE0);let d=i.fbo;if(!d){const t=new v(s,{width:h,height:h,data:null},l.RGBA);t.bind(l.LINEAR,l.CLAMP_TO_EDGE),d=i.fbo=s.createFramebuffer(h,h,!0,!1),d.colorAttachment.set(t.texture)}s.bindFramebuffer.set(d.framebuffer),s.viewport.set([0,0,h,h]),e.useProgram("hillshadePrepare").draw(s,l.TRIANGLES,n,o,a,zi.disabled,((e,i)=>{const r=i.stride,n=t.create();return t.ortho(n,0,t.EXTENT,-t.EXTENT,0,0,1),t.translate(n,n,[0,-t.EXTENT,0]),{u_matrix:n,u_image:1,u_dimension:[r,r],u_zoom:e.overscaledZ,u_unpack:i.getUnpackVector()}})(i.tileID,c),null,r.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments),i.needsHillshadePrepare=!1}}function Zi(e,i,r,n,o,a){const s=n.paint.get("raster-fade-duration");if(!a&&s>0){const n=t.exported.now(),a=(n-e.timeAdded)/s,l=i?(n-i.timeAdded)/s:-1,c=r.getSource(),h=o.coveringZoomLevel({tileSize:c.tileSize,roundZoom:c.roundZoom}),u=!i||Math.abs(i.tileID.overscaledZ-h)>Math.abs(e.tileID.overscaledZ-h),p=u&&e.refreshedUponExpiration?1:t.clamp(u?a:1-l,0,1);return e.refreshedUponExpiration&&a>=1&&(e.refreshedUponExpiration=!1),i?{opacity:1,mix:1-p}:{opacity:p,mix:0}}return{opacity:1,mix:0}}const Gi=new t.Color(1,0,0,1),Hi=new t.Color(0,1,0,1),Xi=new t.Color(0,0,1,1),Wi=new t.Color(1,0,1,1),Ki=new t.Color(0,1,1,1);function Yi(t,e,i,r){Qi(t,0,e+i/2,t.transform.width,i,r)}function Ji(t,e,i,r){Qi(t,e-i/2,0,i,t.transform.height,r)}function Qi(t,e,i,r,n,o){const a=t.context,s=a.gl;s.enable(s.SCISSOR_TEST),s.scissor(e*t.pixelRatio,i*t.pixelRatio,r*t.pixelRatio,n*t.pixelRatio),a.clear({color:o}),s.disable(s.SCISSOR_TEST)}function tr(e,i,r){const n=e.context,o=n.gl,a=r.posMatrix,s=e.useProgram("debug"),l=Ai.disabled,c=ki.disabled,h=e.colorModeForRenderPass(),u="$debug",p=e.style.map.terrain&&e.style.map.terrain.getTerrainData(r);n.activeTexture.set(o.TEXTURE0);const d=i.getTileByID(r.key).latestRawTileData,m=Math.floor((d&&d.byteLength||0)/1024),f=i.getTile(r).tileSize,g=512/Math.min(f,512)*(r.overscaledZ/e.transform.zoom)*.5;let _=r.canonical.toString();r.overscaledZ!==r.canonical.z&&(_+=` => ${r.overscaledZ}`),function(t,e){t.initDebugOverlayCanvas();const i=t.debugOverlayCanvas,r=t.context.gl,n=t.debugOverlayCanvas.getContext("2d");n.clearRect(0,0,i.width,i.height),n.shadowColor="white",n.shadowBlur=2,n.lineWidth=1.5,n.strokeStyle="white",n.textBaseline="top",n.font="bold 36px Open Sans, sans-serif",n.fillText(e,5,5),n.strokeText(e,5,5),t.debugOverlayTexture.update(i),t.debugOverlayTexture.bind(r.LINEAR,r.CLAMP_TO_EDGE)}(e,`${_} ${m}kB`),s.draw(n,o.TRIANGLES,l,c,Ci.alphaBlended,zi.disabled,we(a,t.Color.transparent,g),null,u,e.debugBuffer,e.quadTriangleIndexBuffer,e.debugSegments),s.draw(n,o.LINE_STRIP,l,c,h,zi.disabled,we(a,t.Color.red),p,u,e.debugBuffer,e.tileBorderIndexBuffer,e.debugSegments)}function er(t,e,i){const r=t.context,n=r.gl,o=t.colorModeForRenderPass(),a=new Ai(n.LEQUAL,Ai.ReadWrite,t.depthRangeFor3D),s=t.useProgram("terrain"),l=e.getTerrainMesh();r.bindFramebuffer.set(null),r.viewport.set([0,0,t.width,t.height]);for(const c of i){const i=t.renderToTexture.getTexture(c),h=e.getTerrainData(c.tileID);r.activeTexture.set(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,i.texture);const u={u_matrix:t.transform.calculatePosMatrix(c.tileID.toUnwrapped()),u_texture:0,u_ele_delta:e.getMeshFrameDelta(t.transform.zoom)};s.draw(r,n.TRIANGLES,a,ki.disabled,o,zi.backCCW,u,h,"terrain",l.vertexBuffer,l.indexBuffer,l.segments)}}const ir={symbol:function(e,i,r,n,o){if("translucent"!==e.renderPass)return;const a=ki.disabled,s=e.colorModeForRenderPass();r.layout.get("text-variable-anchor")&&function(e,i,r,n,o,a,s){const l=i.transform,c="map"===o,h="map"===a;for(const o of e){const e=n.getTile(o),a=e.getBucket(r);if(!a||!a.text||!a.text.segments.get().length)continue;const u=t.evaluateSizeForZoom(a.textSizeData,l.zoom),p=At(e,1,i.transform.zoom),d=ct(o.posMatrix,h,c,i.transform,p),m="none"!==r.layout.get("icon-text-fit")&&a.hasIconData();if(u){const t=Math.pow(2,l.zoom-e.tileID.overscaledZ);Bi(a,c,h,s,l,d,o.posMatrix,t,u,m,i.style.map.terrain?(t,e)=>i.style.map.terrain.getElevation(o,t,e):null)}}}(n,e,r,i,r.layout.get("text-rotation-alignment"),r.layout.get("text-pitch-alignment"),o),0!==r.paint.get("icon-opacity").constantOr(1)&&Oi(e,i,r,n,!1,r.paint.get("icon-translate"),r.paint.get("icon-translate-anchor"),r.layout.get("icon-rotation-alignment"),r.layout.get("icon-pitch-alignment"),r.layout.get("icon-keep-upright"),a,s),0!==r.paint.get("text-opacity").constantOr(1)&&Oi(e,i,r,n,!0,r.paint.get("text-translate"),r.paint.get("text-translate-anchor"),r.layout.get("text-rotation-alignment"),r.layout.get("text-pitch-alignment"),r.layout.get("text-keep-upright"),a,s),i.map.showCollisionBoxes&&(Li(e,i,r,n,r.paint.get("text-translate"),r.paint.get("text-translate-anchor"),!0),Li(e,i,r,n,r.paint.get("icon-translate"),r.paint.get("icon-translate-anchor"),!1))},circle:function(e,i,r,n){if("translucent"!==e.renderPass)return;const o=r.paint.get("circle-opacity"),a=r.paint.get("circle-stroke-width"),s=r.paint.get("circle-stroke-opacity"),l=!r.layout.get("circle-sort-key").isConstant();if(0===o.constantOr(1)&&(0===a.constantOr(1)||0===s.constantOr(1)))return;const c=e.context,h=c.gl,u=e.depthModeForSublayer(0,Ai.ReadOnly),p=ki.disabled,d=e.colorModeForRenderPass(),m=[];for(let o=0;o<n.length;o++){const a=n[o],s=i.getTile(a),c=s.getBucket(r);if(!c)continue;const h=c.programConfigurations.get(r.id),u=e.useProgram("circle",h),p=c.layoutVertexBuffer,d=c.indexBuffer,f=e.style.map.terrain&&e.style.map.terrain.getTerrainData(a),g={programConfiguration:h,program:u,layoutVertexBuffer:p,indexBuffer:d,uniformValues:ve(e,a,s,r),terrainData:f};if(l){const e=c.segments.get();for(const i of e)m.push({segments:new t.SegmentVector([i]),sortKey:i.sortKey,state:g})}else m.push({segments:c.segments,sortKey:0,state:g})}l&&m.sort(((t,e)=>t.sortKey-e.sortKey));for(const t of m){const{programConfiguration:i,program:n,layoutVertexBuffer:o,indexBuffer:a,uniformValues:s,terrainData:l}=t.state;n.draw(c,h.TRIANGLES,u,p,d,zi.disabled,s,l,r.id,o,a,t.segments,r.paint,e.transform.zoom,i)}},heatmap:function(e,i,r,n){if(0!==r.paint.get("heatmap-opacity"))if("offscreen"===e.renderPass){const o=e.context,a=o.gl,s=ki.disabled,l=new Ci([a.ONE,a.ONE],t.Color.transparent,[!0,!0,!0,!0]);!function(t,e,i){const r=t.gl;t.activeTexture.set(r.TEXTURE1),t.viewport.set([0,0,e.width/4,e.height/4]);let n=i.heatmapFbo;if(n)r.bindTexture(r.TEXTURE_2D,n.colorAttachment.get()),t.bindFramebuffer.set(n.framebuffer);else{const o=r.createTexture();r.bindTexture(r.TEXTURE_2D,o),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.LINEAR),n=i.heatmapFbo=t.createFramebuffer(e.width/4,e.height/4,!1,!1),function(t,e,i,r){var n,o;const a=t.gl,s=null!==(n=t.HALF_FLOAT)&&void 0!==n?n:a.UNSIGNED_BYTE,l=null!==(o=t.RGBA16F)&&void 0!==o?o:a.RGBA;a.texImage2D(a.TEXTURE_2D,0,l,e.width/4,e.height/4,0,a.RGBA,s,null),r.colorAttachment.set(i)}(t,e,o,n)}}(o,e,r),o.clear({color:t.Color.transparent});for(let t=0;t<n.length;t++){const c=n[t];if(i.hasRenderableParent(c))continue;const h=i.getTile(c),u=h.getBucket(r);if(!u)continue;const p=u.programConfigurations.get(r.id),d=e.useProgram("heatmap",p),{zoom:m}=e.transform;d.draw(o,a.TRIANGLES,Ai.disabled,s,l,zi.disabled,Te(c.posMatrix,h,m,r.paint.get("heatmap-intensity")),null,r.id,u.layoutVertexBuffer,u.indexBuffer,u.segments,r.paint,e.transform.zoom,p)}o.viewport.set([0,0,e.width,e.height])}else"translucent"===e.renderPass&&(e.context.setColorMode(e.colorModeForRenderPass()),function(e,i){const r=e.context,n=r.gl,o=i.heatmapFbo;if(!o)return;r.activeTexture.set(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,o.colorAttachment.get()),r.activeTexture.set(n.TEXTURE1);let a=i.colorRampTexture;a||(a=i.colorRampTexture=new v(r,i.colorRamp,n.RGBA)),a.bind(n.LINEAR,n.CLAMP_TO_EDGE),e.useProgram("heatmapTexture").draw(r,n.TRIANGLES,Ai.disabled,ki.disabled,e.colorModeForRenderPass(),zi.disabled,((e,i,r,n)=>{const o=t.create();t.ortho(o,0,e.width,e.height,0,0,1);const a=e.context.gl;return{u_matrix:o,u_world:[a.drawingBufferWidth,a.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:i.paint.get("heatmap-opacity")}})(e,i),null,i.id,e.viewportBuffer,e.quadTriangleIndexBuffer,e.viewportSegments,i.paint,e.transform.zoom)}(e,r))},line:function(e,i,r,n){if("translucent"!==e.renderPass)return;const o=r.paint.get("line-opacity"),a=r.paint.get("line-width");if(0===o.constantOr(1)||0===a.constantOr(1))return;const s=e.depthModeForSublayer(0,Ai.ReadOnly),l=e.colorModeForRenderPass(),c=r.paint.get("line-dasharray"),h=r.paint.get("line-pattern"),u=h.constantOr(1),p=r.paint.get("line-gradient"),d=r.getCrossfadeParameters(),m=u?"linePattern":c?"lineSDF":p?"lineGradient":"line",f=e.context,g=f.gl;let _=!0;for(const o of n){const n=i.getTile(o);if(u&&!n.patternsLoaded())continue;const a=n.getBucket(r);if(!a)continue;const y=a.programConfigurations.get(r.id),x=e.context.program.get(),b=e.useProgram(m,y),w=_||b.program!==x,E=e.style.map.terrain&&e.style.map.terrain.getTerrainData(o),T=h.constantOr(null);if(T&&n.imageAtlas){const t=n.imageAtlas,e=t.patternPositions[T.to.toString()],i=t.patternPositions[T.from.toString()];e&&i&&y.setConstantPatternPositions(e,i)}const S=E?o:null,C=u?Ae(e,n,r,d,S):c?Me(e,n,r,c,d,S):p?Ie(e,n,r,a.lineClipsArray.length,S):Ce(e,n,r,S);if(u)f.activeTexture.set(g.TEXTURE0),n.imageAtlasTexture.bind(g.LINEAR,g.CLAMP_TO_EDGE),y.updatePaintBuffers(d);else if(c&&(w||e.lineAtlas.dirty))f.activeTexture.set(g.TEXTURE0),e.lineAtlas.bind(f);else if(p){const n=a.gradients[r.id];let s=n.texture;if(r.gradientVersion!==n.version){let l=256;if(r.stepInterpolant){const r=i.getSource().maxzoom,n=o.canonical.z===r?Math.ceil(1<<e.transform.maxZoom-o.canonical.z):1;l=t.clamp(t.nextPowerOfTwo(a.maxLineLength/t.EXTENT*1024*n),256,f.maxTextureSize)}n.gradient=t.renderColorRamp({expression:r.gradientExpression(),evaluationKey:"lineProgress",resolution:l,image:n.gradient||void 0,clips:a.lineClipsArray}),n.texture?n.texture.update(n.gradient):n.texture=new v(f,n.gradient,g.RGBA),n.version=r.gradientVersion,s=n.texture}f.activeTexture.set(g.TEXTURE0),s.bind(r.stepInterpolant?g.NEAREST:g.LINEAR,g.CLAMP_TO_EDGE)}b.draw(f,g.TRIANGLES,s,e.stencilModeForClipping(o),l,zi.disabled,C,E,r.id,a.layoutVertexBuffer,a.indexBuffer,a.segments,r.paint,e.transform.zoom,y,a.layoutVertexBuffer2),_=!1}},fill:function(e,i,r,n){const o=r.paint.get("fill-color"),a=r.paint.get("fill-opacity");if(0===a.constantOr(1))return;const s=e.colorModeForRenderPass(),l=r.paint.get("fill-pattern"),c=e.opaquePassEnabledForLayer()&&!l.constantOr(1)&&1===o.constantOr(t.Color.transparent).a&&1===a.constantOr(0)?"opaque":"translucent";if(e.renderPass===c){const t=e.depthModeForSublayer(1,"opaque"===e.renderPass?Ai.ReadWrite:Ai.ReadOnly);Ni(e,i,r,n,t,s,!1)}if("translucent"===e.renderPass&&r.paint.get("fill-antialias")){const t=e.depthModeForSublayer(r.getPaintProperty("fill-outline-color")?2:0,Ai.ReadOnly);Ni(e,i,r,n,t,s,!0)}},"fill-extrusion":function(t,e,i,r){const n=i.paint.get("fill-extrusion-opacity");if(0!==n&&"translucent"===t.renderPass){const o=new Ai(t.context.gl.LEQUAL,Ai.ReadWrite,t.depthRangeFor3D);if(1!==n||i.paint.get("fill-extrusion-pattern").constantOr(1))$i(t,e,i,r,o,ki.disabled,Ci.disabled),$i(t,e,i,r,o,t.stencilModeFor3D(),t.colorModeForRenderPass());else{const n=t.colorModeForRenderPass();$i(t,e,i,r,o,ki.disabled,n)}}},hillshade:function(t,e,i,r){if("offscreen"!==t.renderPass&&"translucent"!==t.renderPass)return;const n=t.context,o=t.depthModeForSublayer(0,Ai.ReadOnly),a=t.colorModeForRenderPass(),[s,l]="translucent"===t.renderPass?t.stencilConfigForOverlap(r):[{},r];for(const r of l){const n=e.getTile(r);void 0!==n.needsHillshadePrepare&&n.needsHillshadePrepare&&"offscreen"===t.renderPass?qi(t,n,i,o,ki.disabled,a):"translucent"===t.renderPass&&ji(t,r,n,i,o,s[r.overscaledZ],a)}n.viewport.set([0,0,t.width,t.height])},raster:function(t,e,i,r){if("translucent"!==t.renderPass)return;if(0===i.paint.get("raster-opacity"))return;if(!r.length)return;const n=t.context,o=n.gl,a=e.getSource(),s=t.useProgram("raster"),l=t.colorModeForRenderPass(),[c,h]=a instanceof $?[{},r]:t.stencilConfigForOverlap(r),u=h[h.length-1].overscaledZ,p=!t.options.moving;for(const r of h){const h=t.depthModeForSublayer(r.overscaledZ-u,1===i.paint.get("raster-opacity")?Ai.ReadWrite:Ai.ReadOnly,o.LESS),d=e.getTile(r);d.registerFadeDuration(i.paint.get("raster-fade-duration"));const m=e.findLoadedParent(r,0),f=Zi(d,m,e,i,t.transform,t.style.map.terrain);let g,_;const y="nearest"===i.paint.get("raster-resampling")?o.NEAREST:o.LINEAR;n.activeTexture.set(o.TEXTURE0),d.texture.bind(y,o.CLAMP_TO_EDGE,o.LINEAR_MIPMAP_NEAREST),n.activeTexture.set(o.TEXTURE1),m?(m.texture.bind(y,o.CLAMP_TO_EDGE,o.LINEAR_MIPMAP_NEAREST),g=Math.pow(2,m.tileID.overscaledZ-d.tileID.overscaledZ),_=[d.tileID.canonical.x*g%1,d.tileID.canonical.y*g%1]):d.texture.bind(y,o.CLAMP_TO_EDGE,o.LINEAR_MIPMAP_NEAREST);const x=t.style.map.terrain&&t.style.map.terrain.getTerrainData(r),v=x?r:null,b=v?v.posMatrix:t.transform.calculatePosMatrix(r.toUnwrapped(),p),w=Pe(b,_||[0,0],g||1,f,i);a instanceof $?s.draw(n,o.TRIANGLES,h,ki.disabled,l,zi.disabled,w,x,i.id,a.boundsBuffer,t.quadTriangleIndexBuffer,a.boundsSegments):s.draw(n,o.TRIANGLES,h,c[r.overscaledZ],l,zi.disabled,w,x,i.id,t.rasterBoundsBuffer,t.quadTriangleIndexBuffer,t.rasterBoundsSegments)}},background:function(t,e,i,r){const n=i.paint.get("background-color"),o=i.paint.get("background-opacity");if(0===o)return;const a=t.context,s=a.gl,l=t.transform,c=l.tileSize,h=i.paint.get("background-pattern");if(t.isPatternMissing(h))return;const u=!h&&1===n.a&&1===o&&t.opaquePassEnabledForLayer()?"opaque":"translucent";if(t.renderPass!==u)return;const p=ki.disabled,d=t.depthModeForSublayer(0,"opaque"===u?Ai.ReadWrite:Ai.ReadOnly),m=t.colorModeForRenderPass(),f=t.useProgram(h?"backgroundPattern":"background"),g=r||l.coveringTiles({tileSize:c,terrain:t.style.map.terrain});h&&(a.activeTexture.set(s.TEXTURE0),t.imageManager.bind(t.context));const _=i.getCrossfadeParameters();for(const e of g){const l=r?e.posMatrix:t.transform.calculatePosMatrix(e.toUnwrapped()),u=h?Oe(l,o,t,h,{tileID:e,tileSize:c},_):Fe(l,o,n),g=t.style.map.terrain&&t.style.map.terrain.getTerrainData(e);f.draw(a,s.TRIANGLES,d,p,m,zi.disabled,u,g,i.id,t.tileExtentBuffer,t.quadTriangleIndexBuffer,t.tileExtentSegments)}},debug:function(t,e,i){for(let r=0;r<i.length;r++)tr(t,e,i[r])},custom:function(t,e,i){const r=t.context,n=i.implementation;if("offscreen"===t.renderPass){const e=n.prerender;e&&(t.setCustomLayerDefaults(),r.setColorMode(t.colorModeForRenderPass()),e.call(n,r.gl,t.transform.customLayerMatrix()),r.setDirty(),t.setBaseState())}else if("translucent"===t.renderPass){t.setCustomLayerDefaults(),r.setColorMode(t.colorModeForRenderPass()),r.setStencilMode(ki.disabled);const e="3d"===n.renderingMode?new Ai(t.context.gl.LEQUAL,Ai.ReadWrite,t.depthRangeFor3D):t.depthModeForSublayer(0,Ai.ReadOnly);r.setDepthMode(e),n.render(r.gl,t.transform.customLayerMatrix()),r.setDirty(),t.setBaseState(),r.bindFramebuffer.set(null)}}};class rr{constructor(e,i){this.context=new Ii(e),this.transform=i,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:t.create(),renderTime:0},this.setup(),this.numSublayers=J.maxUnderzooming+J.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new te}resize(t,e,i){if(this.width=t*i,this.height=e*i,this.pixelRatio=i,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const t of this.style._order)this.style._layers[t].resize()}setup(){const e=this.context,i=new t.PosArray;i.emplaceBack(0,0),i.emplaceBack(t.EXTENT,0),i.emplaceBack(0,t.EXTENT),i.emplaceBack(t.EXTENT,t.EXTENT),this.tileExtentBuffer=e.createVertexBuffer(i,ae.members),this.tileExtentSegments=t.SegmentVector.simpleSegment(0,0,4,2);const r=new t.PosArray;r.emplaceBack(0,0),r.emplaceBack(t.EXTENT,0),r.emplaceBack(0,t.EXTENT),r.emplaceBack(t.EXTENT,t.EXTENT),this.debugBuffer=e.createVertexBuffer(r,ae.members),this.debugSegments=t.SegmentVector.simpleSegment(0,0,4,5);const n=new t.RasterBoundsArray;n.emplaceBack(0,0,0,0),n.emplaceBack(t.EXTENT,0,t.EXTENT,0),n.emplaceBack(0,t.EXTENT,0,t.EXTENT),n.emplaceBack(t.EXTENT,t.EXTENT,t.EXTENT,t.EXTENT),this.rasterBoundsBuffer=e.createVertexBuffer(n,N.members),this.rasterBoundsSegments=t.SegmentVector.simpleSegment(0,0,4,2);const o=new t.PosArray;o.emplaceBack(0,0),o.emplaceBack(1,0),o.emplaceBack(0,1),o.emplaceBack(1,1),this.viewportBuffer=e.createVertexBuffer(o,ae.members),this.viewportSegments=t.SegmentVector.simpleSegment(0,0,4,2);const a=new t.LineStripIndexArray;a.emplaceBack(0),a.emplaceBack(1),a.emplaceBack(3),a.emplaceBack(2),a.emplaceBack(0),this.tileBorderIndexBuffer=e.createIndexBuffer(a);const s=new t.TriangleIndexArray;s.emplaceBack(0,1,2),s.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=e.createIndexBuffer(s);const l=this.context.gl;this.stencilClearMode=new ki({func:l.ALWAYS,mask:0},0,255,l.ZERO,l.ZERO,l.ZERO)}clearStencil(){const e=this.context,i=e.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const r=t.create();t.ortho(r,0,this.width,this.height,0,0,1),t.scale(r,r,[i.drawingBufferWidth,i.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(e,i.TRIANGLES,Ai.disabled,this.stencilClearMode,Ci.disabled,zi.disabled,Ee(r),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(t,e){if(this.currentStencilSource===t.source||!t.isTileClipped()||!e||!e.length)return;this.currentStencilSource=t.source;const i=this.context,r=i.gl;this.nextStencilID+e.length>256&&this.clearStencil(),i.setColorMode(Ci.disabled),i.setDepthMode(Ai.disabled);const n=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const t of e){const e=this._tileClippingMaskIDs[t.key]=this.nextStencilID++,o=this.style.map.terrain&&this.style.map.terrain.getTerrainData(t);n.draw(i,r.TRIANGLES,Ai.disabled,new ki({func:r.ALWAYS,mask:0},e,255,r.KEEP,r.KEEP,r.REPLACE),Ci.disabled,zi.disabled,Ee(t.posMatrix),o,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const t=this.nextStencilID++,e=this.context.gl;return new ki({func:e.NOTEQUAL,mask:255},t,255,e.KEEP,e.KEEP,e.REPLACE)}stencilModeForClipping(t){const e=this.context.gl;return new ki({func:e.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,e.KEEP,e.KEEP,e.REPLACE)}stencilConfigForOverlap(t){const e=this.context.gl,i=t.sort(((t,e)=>e.overscaledZ-t.overscaledZ)),r=i[i.length-1].overscaledZ,n=i[0].overscaledZ-r+1;if(n>1){this.currentStencilSource=void 0,this.nextStencilID+n>256&&this.clearStencil();const t={};for(let i=0;i<n;i++)t[i+r]=new ki({func:e.GEQUAL,mask:255},i+this.nextStencilID,255,e.KEEP,e.KEEP,e.REPLACE);return this.nextStencilID+=n,[t,i]}return[{[r]:ki.disabled},i]}colorModeForRenderPass(){const e=this.context.gl;if(this._showOverdrawInspector){const i=1/8;return new Ci([e.CONSTANT_COLOR,e.ONE],new t.Color(i,i,i,0),[!0,!0,!0,!0])}return"opaque"===this.renderPass?Ci.unblended:Ci.alphaBlended}depthModeForSublayer(t,e,i){if(!this.opaquePassEnabledForLayer())return Ai.disabled;const r=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new Ai(i||this.context.gl.LEQUAL,e,[r,r])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(e,i){this.style=e,this.options=i,this.lineAtlas=e.lineAtlas,this.imageManager=e.imageManager,this.glyphManager=e.glyphManager,this.symbolFadeChange=e.placement.symbolFadeChange(t.exported.now()),this.imageManager.beginFrame();const r=this.style._order,n=this.style.sourceCaches,o={},a={},s={};for(const t in n){const e=n[t];e.used&&e.prepare(this.context),o[t]=e.getVisibleCoordinates(),a[t]=o[t].slice().reverse(),s[t]=e.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let t=0;t<r.length;t++)if(this.style._layers[r[t]].is3D()){this.opaquePassCutoff=t;break}if(this.renderToTexture){this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0;const e=this.style.map.terrain.sourceCache.tilesAfterTime(this.terrainFacilitator.renderTime);(this.terrainFacilitator.dirty||!t.equals(this.terrainFacilitator.matrix,this.transform.projMatrix)||e.length)&&(t.copy(this.terrainFacilitator.matrix,this.transform.projMatrix),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(e,i){const r=e.context,n=r.gl,o=Ci.unblended,a=new Ai(n.LEQUAL,Ai.ReadWrite,[0,1]),s=i.getTerrainMesh(),l=i.sourceCache.getRenderableTiles(),c=e.useProgram("terrainDepth");r.bindFramebuffer.set(i.getFramebuffer("depth").framebuffer),r.viewport.set([0,0,e.width/devicePixelRatio,e.height/devicePixelRatio]),r.clear({color:t.Color.transparent,depth:1});for(const t of l){const l=i.getTerrainData(t.tileID),h={u_matrix:e.transform.calculatePosMatrix(t.tileID.toUnwrapped()),u_ele_delta:i.getMeshFrameDelta(e.transform.zoom)};c.draw(r,n.TRIANGLES,a,ki.disabled,o,zi.backCCW,h,l,"terrain",s.vertexBuffer,s.indexBuffer,s.segments)}r.bindFramebuffer.set(null),r.viewport.set([0,0,e.width,e.height])}(this,this.style.map.terrain),function(e,i){const r=e.context,n=r.gl,o=Ci.unblended,a=new Ai(n.LEQUAL,Ai.ReadWrite,[0,1]),s=i.getTerrainMesh(),l=i.getCoordsTexture(),c=i.sourceCache.getRenderableTiles(),h=e.useProgram("terrainCoords");r.bindFramebuffer.set(i.getFramebuffer("coords").framebuffer),r.viewport.set([0,0,e.width/devicePixelRatio,e.height/devicePixelRatio]),r.clear({color:t.Color.transparent,depth:1}),i.coordsIndex=[];for(const t of c){const c=i.getTerrainData(t.tileID);r.activeTexture.set(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,l.texture);const u={u_matrix:e.transform.calculatePosMatrix(t.tileID.toUnwrapped()),u_terrain_coords_id:(255-i.coordsIndex.length)/255,u_texture:0,u_ele_delta:i.getMeshFrameDelta(e.transform.zoom)};h.draw(r,n.TRIANGLES,a,ki.disabled,o,zi.backCCW,u,c,"terrain",s.vertexBuffer,s.indexBuffer,s.segments),i.coordsIndex.push(t.tileID.key)}r.bindFramebuffer.set(null),r.viewport.set([0,0,e.width,e.height])}(this,this.style.map.terrain))}this.renderPass="offscreen";for(const t of r){const e=this.style._layers[t];if(!e.hasOffscreenPass()||e.isHidden(this.transform.zoom))continue;const i=a[e.source];("custom"===e.type||i.length)&&this.renderLayer(this,n[e.source],e,i)}if(this.context.bindFramebuffer.set(null),this.context.clear({color:i.showOverdrawInspector?t.Color.black:t.Color.transparent,depth:1}),this.clearStencil(),this._showOverdrawInspector=i.showOverdrawInspector,this.depthRangeFor3D=[0,1-(e._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=r.length-1;this.currentLayer>=0;this.currentLayer--){const t=this.style._layers[r[this.currentLayer]],e=n[t.source],i=o[t.source];this._renderTileClippingMasks(t,i),this.renderLayer(this,e,t,i)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<r.length;this.currentLayer++){const t=this.style._layers[r[this.currentLayer]],e=n[t.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(t))continue;const i=("symbol"===t.type?s:a)[t.source];this._renderTileClippingMasks(t,o[t.source]),this.renderLayer(this,e,t,i)}if(this.options.showTileBoundaries){const t=function(t,e){let i=null;const r=Object.values(t._layers).flatMap((i=>i.source&&!i.isHidden(e)?[t.sourceCaches[i.source]]:[])),n=r.filter((t=>"vector"===t.getSource().type)),o=r.filter((t=>"vector"!==t.getSource().type)),a=t=>{(!i||i.getSource().maxzoom<t.getSource().maxzoom)&&(i=t)};return n.forEach((t=>a(t))),i||o.forEach((t=>a(t))),i}(this.style,this.transform.zoom);t&&ir.debug(this,t,t.getVisibleCoordinates())}this.options.showPadding&&function(t){const e=t.transform.padding;Yi(t,t.transform.height-(e.top||0),3,Gi),Yi(t,e.bottom||0,3,Hi),Ji(t,e.left||0,3,Xi),Ji(t,t.transform.width-(e.right||0),3,Wi);const i=t.transform.centerPoint;!function(t,e,i,r){Qi(t,e-1,i-10,2,20,r),Qi(t,e-10,i-1,20,2,r)}(t,i.x,t.transform.height-i.y,Ki)}(this),this.context.setDefault()}renderLayer(t,e,i,r){i.isHidden(this.transform.zoom)||("background"===i.type||"custom"===i.type||(r||[]).length)&&(this.id=i.id,ir[i.type](t,e,i,r,this.style.placement.variableOffsets))}translatePosMatrix(e,i,r,n,o){if(!r[0]&&!r[1])return e;const a=o?"map"===n?this.transform.angle:0:"viewport"===n?-this.transform.angle:0;if(a){const t=Math.sin(a),e=Math.cos(a);r=[r[0]*e-r[1]*t,r[0]*t+r[1]*e]}const s=[o?r[0]:At(i,r[0],this.transform.zoom),o?r[1]:At(i,r[1],this.transform.zoom),0],l=new Float32Array(16);return t.translate(l,e,s),l}saveTileTexture(t){const e=this._tileTextures[t.size[0]];e?e.push(t):this._tileTextures[t.size[0]]=[t]}getTileTexture(t){const e=this._tileTextures[t];return e&&e.length>0?e.pop():null}isPatternMissing(t){if(!t)return!1;if(!t.from||!t.to)return!0;const e=this.imageManager.getPattern(t.from.toString()),i=this.imageManager.getPattern(t.to.toString());return!e||!i}useProgram(t,e){this.cache=this.cache||{};const i=t+(e?e.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[i]||(this.cache[i]=new pe(this.context,t,le[t],e,Ue[t],this._showOverdrawInspector,this.style.map.terrain)),this.cache[i]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const t=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(t.FUNC_ADD)}initDebugOverlayCanvas(){null==this.debugOverlayCanvas&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new v(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}}class nr{constructor(t,e){this.points=t,this.planes=e}static fromInvProjectionMatrix(e,i,r){const n=Math.pow(2,r),o=[[-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((r=>{const o=1/(r=t.transformMat4([],r,e))[3]/i*n;return t.mul$1(r,r,[o,o,1/r[3],o])})),a=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map((t=>{const e=function(t,e){var i=e[0],r=e[1],n=e[2],o=i*i+r*r+n*n;return o>0&&(o=1/Math.sqrt(o)),t[0]=e[0]*o,t[1]=e[1]*o,t[2]=e[2]*o,t}([],function(t,e,i){var r=e[0],n=e[1],o=e[2],a=i[0],s=i[1],l=i[2];return t[0]=n*l-o*s,t[1]=o*a-r*l,t[2]=r*s-n*a,t}([],g([],o[t[0]],o[t[1]]),g([],o[t[2]],o[t[1]]))),i=-((r=e)[0]*(n=o[t[1]])[0]+r[1]*n[1]+r[2]*n[2]);var r,n;return e.concat(i)}));return new nr(o,a)}}class or{constructor(t,e){this.min=t,this.max=e,this.center=function(t,e,i){return t[0]=.5*e[0],t[1]=.5*e[1],t[2]=.5*e[2],t}([],function(t,e,i){return t[0]=e[0]+i[0],t[1]=e[1]+i[1],t[2]=e[2]+i[2],t}([],this.min,this.max))}quadrant(t){const e=[t%2==0,t<2],i=m(this.min),r=m(this.max);for(let t=0;t<e.length;t++)i[t]=e[t]?this.min[t]:this.center[t],r[t]=e[t]?this.center[t]:this.max[t];return r[2]=this.max[2],new or(i,r)}distanceX(t){return Math.max(Math.min(this.max[0],t[0]),this.min[0])-t[0]}distanceY(t){return Math.max(Math.min(this.max[1],t[1]),this.min[1])-t[1]}intersects(e){const i=[[this.min[0],this.min[1],this.min[2],1],[this.max[0],this.min[1],this.min[2],1],[this.max[0],this.max[1],this.min[2],1],[this.min[0],this.max[1],this.min[2],1],[this.min[0],this.min[1],this.max[2],1],[this.max[0],this.min[1],this.max[2],1],[this.max[0],this.max[1],this.max[2],1],[this.min[0],this.max[1],this.max[2],1]];let r=!0;for(let n=0;n<e.planes.length;n++){const o=e.planes[n];let a=0;for(let e=0;e<i.length;e++)t.dot(o,i[e])>=0&&a++;if(0===a)return 0;a!==i.length&&(r=!1)}if(r)return 2;for(let t=0;t<3;t++){let i=Number.MAX_VALUE,r=-Number.MAX_VALUE;for(let n=0;n<e.points.length;n++){const o=e.points[n][t]-this.min[t];i=Math.min(i,o),r=Math.max(r,o)}if(r<0||i>this.max[t]-this.min[t])return 0}return 1}}class ar{constructor(t=0,e=0,i=0,r=0){if(isNaN(t)||t<0||isNaN(e)||e<0||isNaN(i)||i<0||isNaN(r)||r<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=e,this.left=i,this.right=r}interpolate(e,i,r){return null!=i.top&&null!=e.top&&(this.top=t.interpolate.number(e.top,i.top,r)),null!=i.bottom&&null!=e.bottom&&(this.bottom=t.interpolate.number(e.bottom,i.bottom,r)),null!=i.left&&null!=e.left&&(this.left=t.interpolate.number(e.left,i.left,r)),null!=i.right&&null!=e.right&&(this.right=t.interpolate.number(e.right,i.right,r)),this}getCenter(e,i){const r=t.clamp((this.left+e-this.right)/2,0,e),n=t.clamp((this.top+i-this.bottom)/2,0,i);return new t.Point(r,n)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new ar(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}class sr{constructor(e,i,r,n,o){this.tileSize=512,this.maxValidLatitude=85.051129,this.freezeElevation=!1,this._renderWorldCopies=void 0===o||!!o,this._minZoom=e||0,this._maxZoom=i||22,this._minPitch=null==r?0:r,this._maxPitch=null==n?60:n,this.setMaxBounds(),this.width=0,this.height=0,this._center=new t.LngLat(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new ar,this._posMatrixCache={},this._alignedPosMatrixCache={}}clone(){const t=new sr(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return t.apply(this),t}apply(t){this.tileSize=t.tileSize,this.latRange=t.latRange,this.width=t.width,this.height=t.height,this._center=t._center,this._elevation=t._elevation,this.zoom=t.zoom,this.angle=t.angle,this._fov=t._fov,this._pitch=t._pitch,this._unmodified=t._unmodified,this._edgeInsets=t._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))}get maxZoom(){return this._maxZoom}set maxZoom(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))}get minPitch(){return this._minPitch}set minPitch(t){this._minPitch!==t&&(this._minPitch=t,this.pitch=Math.max(this.pitch,t))}get maxPitch(){return this._maxPitch}set maxPitch(t){this._maxPitch!==t&&(this._maxPitch=t,this.pitch=Math.min(this.pitch,t))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(t){void 0===t?t=!0:null===t&&(t=!1),this._renderWorldCopies=t}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new t.Point(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(e){const i=-t.wrap(e,-180,180)*Math.PI/180;this.angle!==i&&(this._unmodified=!1,this.angle=i,this._calcMatrices(),this.rotationMatrix=function(){var e=new t.ARRAY_TYPE(4);return t.ARRAY_TYPE!=Float32Array&&(e[1]=0,e[2]=0),e[0]=1,e[3]=1,e}(),function(t,e,i){var r=e[0],n=e[1],o=e[2],a=e[3],s=Math.sin(i),l=Math.cos(i);t[0]=r*l+o*s,t[1]=n*l+a*s,t[2]=r*-s+o*l,t[3]=n*-s+a*l}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(e){const i=t.clamp(e,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==i&&(this._unmodified=!1,this._pitch=i,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(t){t=Math.max(.01,Math.min(60,t)),this._fov!==t&&(this._unmodified=!1,this._fov=t/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(t){const e=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==e&&(this._unmodified=!1,this._zoom=e,this.tileZoom=Math.max(0,Math.floor(e)),this.scale=this.zoomScale(e),this._constrain(),this._calcMatrices())}get center(){return this._center}set center(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(t){t!==this._elevation&&(this._elevation=t,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(t){this._edgeInsets.equals(t)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,t,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(t){return this._edgeInsets.equals(t)}interpolatePadding(t,e,i){this._unmodified=!1,this._edgeInsets.interpolate(t,e,i),this._constrain(),this._calcMatrices()}coveringZoomLevel(t){const e=(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize));return Math.max(0,e)}getVisibleUnwrappedCoordinates(e){const i=[new t.UnwrappedTileID(0,e)];if(this._renderWorldCopies){const r=this.pointCoordinate(new t.Point(0,0)),n=this.pointCoordinate(new t.Point(this.width,0)),o=this.pointCoordinate(new t.Point(this.width,this.height)),a=this.pointCoordinate(new t.Point(0,this.height)),s=Math.floor(Math.min(r.x,n.x,o.x,a.x)),l=Math.floor(Math.max(r.x,n.x,o.x,a.x)),c=1;for(let r=s-c;r<=l+c;r++)0!==r&&i.push(new t.UnwrappedTileID(r,e))}return i}coveringTiles(e){var i,r;let n=this.coveringZoomLevel(e);const o=n;if(void 0!==e.minzoom&&n<e.minzoom)return[];void 0!==e.maxzoom&&n>e.maxzoom&&(n=e.maxzoom);const a=this.pointCoordinate(this.getCameraPoint()),s=t.MercatorCoordinate.fromLngLat(this.center),l=Math.pow(2,n),c=[l*a.x,l*a.y,0],h=[l*s.x,l*s.y,0],u=nr.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,n);let p=e.minzoom||0;!e.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(p=n);const d=e.terrain?2/Math.min(this.tileSize,e.tileSize)*this.tileSize:3,m=t=>({aabb:new or([t*l,0,0],[(t+1)*l,l,0]),zoom:0,x:0,y:0,wrap:t,fullyVisible:!1}),f=[],g=[],y=n,x=e.reparseOverscaled?o:n;if(this._renderWorldCopies)for(let t=1;t<=3;t++)f.push(m(-t)),f.push(m(t));for(f.push(m(0));f.length>0;){const n=f.pop(),o=n.x,a=n.y;let s=n.fullyVisible;if(!s){const t=n.aabb.intersects(u);if(0===t)continue;s=2===t}const l=e.terrain?c:h,m=n.aabb.distanceX(l),v=n.aabb.distanceY(l),b=Math.max(Math.abs(m),Math.abs(v));if(n.zoom===y||b>d+(1<<y-n.zoom)-2&&n.zoom>=p){const e=y-n.zoom,i=c[0]-.5-(o<<e),r=c[1]-.5-(a<<e);g.push({tileID:new t.OverscaledTileID(n.zoom===y?x:n.zoom,n.wrap,n.zoom,o,a),distanceSq:_([h[0]-.5-o,h[1]-.5-a]),tileDistanceToCamera:Math.sqrt(i*i+r*r)})}else for(let l=0;l<4;l++){const c=(o<<1)+l%2,h=(a<<1)+(l>>1),u=n.zoom+1;let p=n.aabb.quadrant(l);if(e.terrain){const o=new t.OverscaledTileID(u,n.wrap,u,c,h),a=e.terrain.getMinMaxElevation(o),s=null!==(i=a.minElevation)&&void 0!==i?i:this.elevation,l=null!==(r=a.maxElevation)&&void 0!==r?r:this.elevation;p=new or([p.min[0],p.min[1],s],[p.max[0],p.max[1],l])}f.push({aabb:p,zoom:u,x:c,y:h,wrap:n.wrap,fullyVisible:s})}}return g.sort(((t,e)=>t.distanceSq-e.distanceSq)).map((t=>t.tileID))}resize(t,e){this.width=t,this.height=e,this.pixelsToGLUnits=[2/t,-2/e],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(t){return Math.pow(2,t)}scaleZoom(t){return Math.log(t)/Math.LN2}project(e){const i=t.clamp(e.lat,-this.maxValidLatitude,this.maxValidLatitude);return new t.Point(t.mercatorXfromLng(e.lng)*this.worldSize,t.mercatorYfromLat(i)*this.worldSize)}unproject(e){return new t.MercatorCoordinate(e.x/this.worldSize,e.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}updateElevation(t){this.freezeElevation||(this.elevation=t?this.getElevation(this._center,t):0)}getElevation(e,i){const r=t.MercatorCoordinate.fromLngLat(e.wrap()),n=(1<<this.tileZoom)*t.EXTENT,o=r.x*n,a=r.y*n,s=Math.floor(o/t.EXTENT),l=Math.floor(a/t.EXTENT),c=new t.OverscaledTileID(this.tileZoom,0,this.tileZoom,s,l);return i.getElevation(c,o%t.EXTENT,a%t.EXTENT,t.EXTENT)}getCameraPosition(){return{lngLat:this.pointLocation(this.getCameraPoint()),altitude:Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter+this.elevation}}recalculateZoom(e){const i=this.pointLocation(this.centerPoint,e),r=this.getElevation(i,e);if(!(this.elevation-r))return;const n=this.getCameraPosition(),o=t.MercatorCoordinate.fromLngLat(n.lngLat,n.altitude),a=t.MercatorCoordinate.fromLngLat(i,r),s=o.x-a.x,l=o.y-a.y,c=o.z-a.z,h=Math.sqrt(s*s+l*l+c*c),u=this.scaleZoom(this.cameraToCenterDistance/h/this.tileSize);this._elevation=r,this._center=i,this.zoom=u}setLocationAtPoint(e,i){const r=this.pointCoordinate(i),n=this.pointCoordinate(this.centerPoint),o=this.locationCoordinate(e),a=new t.MercatorCoordinate(o.x-(r.x-n.x),o.y-(r.y-n.y));this.center=this.coordinateLocation(a),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(t,e){return e?this.coordinatePoint(this.locationCoordinate(t),this.getElevation(t,e),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(t))}pointLocation(t,e){return this.coordinateLocation(this.pointCoordinate(t,e))}locationCoordinate(e){return t.MercatorCoordinate.fromLngLat(e)}coordinateLocation(t){return t&&t.toLngLat()}pointCoordinate(e,i){if(i){const t=i.pointCoordinate(e);if(null!=t)return t}const r=[e.x,e.y,0,1],n=[e.x,e.y,1,1];t.transformMat4(r,r,this.pixelMatrixInverse),t.transformMat4(n,n,this.pixelMatrixInverse);const o=r[3],a=n[3],s=r[1]/o,l=n[1]/a,c=r[2]/o,h=n[2]/a,u=c===h?0:(0-c)/(h-c);return new t.MercatorCoordinate(t.interpolate.number(r[0]/o,n[0]/a,u)/this.worldSize,t.interpolate.number(s,l,u)/this.worldSize)}coordinatePoint(e,i=0,r=this.pixelMatrix){const n=[e.x*this.worldSize,e.y*this.worldSize,i,1];return t.transformMat4(n,n,r),new t.Point(n[0]/n[3],n[1]/n[3])}getBounds(){const e=Math.max(0,this.height/2-this.getHorizon());return(new R).extend(this.pointLocation(new t.Point(0,e))).extend(this.pointLocation(new t.Point(this.width,e))).extend(this.pointLocation(new t.Point(this.width,this.height))).extend(this.pointLocation(new t.Point(0,this.height)))}getMaxBounds(){return this.latRange&&2===this.latRange.length&&this.lngRange&&2===this.lngRange.length?new R([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null}getHorizon(){return Math.tan(Math.PI/2-this._pitch)*this.cameraToCenterDistance*.85}setMaxBounds(t){t?(this.lngRange=[t.getWest(),t.getEast()],this.latRange=[t.getSouth(),t.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-this.maxValidLatitude,this.maxValidLatitude])}calculatePosMatrix(e,i=!1){const r=e.key,n=i?this._alignedPosMatrixCache:this._posMatrixCache;if(n[r])return n[r];const o=e.canonical,a=this.worldSize/this.zoomScale(o.z),s=o.x+Math.pow(2,o.z)*e.wrap,l=t.identity(new Float64Array(16));return t.translate(l,l,[s*a,o.y*a,0]),t.scale(l,l,[a/t.EXTENT,a/t.EXTENT,1]),t.multiply(l,i?this.alignedProjMatrix:this.projMatrix,l),n[r]=new Float32Array(l),n[r]}customLayerMatrix(){return this.mercatorMatrix.slice()}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;let e,i,r,n,o=-90,a=90,s=-180,l=180;const c=this.size,h=this._unmodified;if(this.latRange){const i=this.latRange;o=t.mercatorYfromLat(i[1])*this.worldSize,a=t.mercatorYfromLat(i[0])*this.worldSize,e=a-o<c.y?c.y/(a-o):0}if(this.lngRange){const e=this.lngRange;s=t.wrap(t.mercatorXfromLng(e[0])*this.worldSize,0,this.worldSize),l=t.wrap(t.mercatorXfromLng(e[1])*this.worldSize,0,this.worldSize),l<s&&(l+=this.worldSize),i=l-s<c.x?c.x/(l-s):0}const u=this.point,p=Math.max(i||0,e||0);if(p)return this.center=this.unproject(new t.Point(i?(l+s)/2:u.x,e?(a+o)/2:u.y)),this.zoom+=this.scaleZoom(p),this._unmodified=h,void(this._constraining=!1);if(this.latRange){const t=u.y,e=c.y/2;t-e<o&&(n=o+e),t+e>a&&(n=a-e)}if(this.lngRange){const e=(s+l)/2,i=t.wrap(u.x,e-this.worldSize/2,e+this.worldSize/2),n=c.x/2;i-n<s&&(r=s+n),i+n>l&&(r=l-n)}void 0===r&&void 0===n||(this.center=this.unproject(new t.Point(void 0!==r?r:u.x,void 0!==n?n:u.y)).wrap()),this._unmodified=h,this._constraining=!1}_calcMatrices(){if(!this.height)return;const e=this.centerOffset,i=this.point.x,r=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=t.mercatorZfromAltitude(1,this.center.lat)*this.worldSize;let n=t.identity(new Float64Array(16));t.scale(n,n,[this.width/2,-this.height/2,1]),t.translate(n,n,[1,-1,0]),this.labelPlaneMatrix=n,n=t.identity(new Float64Array(16)),t.scale(n,n,[1,-1,1]),t.translate(n,n,[-1,-1,0]),t.scale(n,n,[2/this.width,2/this.height,1]),this.glCoordMatrix=n,this.cameraToSeaLevelDistance=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch);const o=this._elevation<0?this.cameraToCenterDistance:this.cameraToSeaLevelDistance,a=Math.PI/2+this._pitch,s=this._fov*(.5+e.y/this.height),l=Math.sin(s)*o/Math.sin(t.clamp(Math.PI-a-s,.01,Math.PI-.01)),c=this.getHorizon(),h=2*Math.atan(c/this.cameraToCenterDistance)*(.5+e.y/(2*c)),u=Math.sin(h)*o/Math.sin(t.clamp(Math.PI-a-h,.01,Math.PI-.01)),p=Math.min(l,u),d=1.01*(Math.cos(Math.PI/2-this._pitch)*p+o),m=this.height/50;n=new Float64Array(16),t.perspective(n,this._fov,this.width/this.height,m,d),n[8]=2*-e.x/this.width,n[9]=2*e.y/this.height,t.scale(n,n,[1,-1,1]),t.translate(n,n,[0,0,-this.cameraToCenterDistance]),t.rotateX(n,n,this._pitch),t.rotateZ(n,n,this.angle),t.translate(n,n,[-i,-r,0]),this.mercatorMatrix=t.scale([],n,[this.worldSize,this.worldSize,this.worldSize]),t.scale(n,n,[1,1,this._pixelPerMeter]),this.pixelMatrix=t.multiply(new Float64Array(16),this.labelPlaneMatrix,n),t.translate(n,n,[0,0,-this.elevation]),this.projMatrix=n,this.invProjMatrix=t.invert([],n),this.pixelMatrix3D=t.multiply(new Float64Array(16),this.labelPlaneMatrix,n);const f=this.width%2/2,g=this.height%2/2,_=Math.cos(this.angle),y=Math.sin(this.angle),x=i-Math.round(i)+_*f+y*g,v=r-Math.round(r)+_*g+y*f,b=new Float64Array(n);if(t.translate(b,b,[x>.5?x-1:x,v>.5?v-1:v,0]),this.alignedProjMatrix=b,n=t.invert(new Float64Array(16),this.pixelMatrix),!n)throw new Error("failed to invert matrix");this.pixelMatrixInverse=n,this._posMatrixCache={},this._alignedPosMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const e=this.pointCoordinate(new t.Point(0,0)),i=[e.x*this.worldSize,e.y*this.worldSize,0,1];return t.transformMat4(i,i,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const e=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new t.Point(0,e))}getCameraQueryGeometry(e){const i=this.getCameraPoint();if(1===e.length)return[e[0],i];{let r=i.x,n=i.y,o=i.x,a=i.y;for(const t of e)r=Math.min(r,t.x),n=Math.min(n,t.y),o=Math.max(o,t.x),a=Math.max(a,t.y);return[new t.Point(r,n),new t.Point(o,n),new t.Point(o,a),new t.Point(r,a),new t.Point(r,n)]}}}class lr{constructor(e){this._hashName=e&&encodeURIComponent(e),t.bindAll(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=function(t,e){let i=!1,r=null;const n=()=>{r=null,i&&(t(),r=setTimeout(n,300),i=!1)};return()=>(i=!0,r||n(),r)}(this._updateHashUnthrottled.bind(this))}addTo(t){return this._map=t,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),delete this._map,this}getHashString(t){const e=this._map.getCenter(),i=Math.round(100*this._map.getZoom())/100,r=Math.ceil((i*Math.LN2+Math.log(512/360/.5))/Math.LN10),n=Math.pow(10,r),o=Math.round(e.lng*n)/n,a=Math.round(e.lat*n)/n,s=this._map.getBearing(),l=this._map.getPitch();let c="";if(c+=t?`/${o}/${a}/${i}`:`${i}/${a}/${o}`,(s||l)&&(c+="/"+Math.round(10*s)/10),l&&(c+=`/${Math.round(l)}`),this._hashName){const t=this._hashName;let e=!1;const i=window.location.hash.slice(1).split("&").map((i=>{const r=i.split("=")[0];return r===t?(e=!0,`${r}=${c}`):i})).filter((t=>t));return e||i.push(`${t}=${c}`),`#${i.join("&")}`}return`#${c}`}_getCurrentHash(){const t=window.location.hash.replace("#","");if(this._hashName){let e;return t.split("&").map((t=>t.split("="))).forEach((t=>{t[0]===this._hashName&&(e=t)})),(e&&e[1]||"").split("/")}return t.split("/")}_onHashChange(){const t=this._getCurrentHash();if(t.length>=3&&!t.some((t=>isNaN(t)))){const e=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(t[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:e,pitch:+(t[4]||0)}),!0}return!1}_updateHashUnthrottled(){const t=window.location.href.replace(/(#.+)?$/,this.getHashString());try{window.history.replaceState(window.history.state,null,t)}catch(t){}}}const cr={linearity:.3,easing:t.bezier(0,0,.3,1)},hr=t.extend({deceleration:2500,maxSpeed:1400},cr),ur=t.extend({deceleration:20,maxSpeed:1400},cr),pr=t.extend({deceleration:1e3,maxSpeed:360},cr),dr=t.extend({deceleration:1e3,maxSpeed:90},cr);class mr{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:t.exported.now(),settings:e})}_drainInertiaBuffer(){const e=this._inertiaBuffer,i=t.exported.now();for(;e.length>0&&i-e[0].time>160;)e.shift()}_onMoveEnd(e){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const i={zoom:0,bearing:0,pitch:0,pan:new t.Point(0,0),pinchAround:void 0,around:void 0};for(const{settings:t}of this._inertiaBuffer)i.zoom+=t.zoomDelta||0,i.bearing+=t.bearingDelta||0,i.pitch+=t.pitchDelta||0,t.panDelta&&i.pan._add(t.panDelta),t.around&&(i.around=t.around),t.pinchAround&&(i.pinchAround=t.pinchAround);const r=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,n={};if(i.pan.mag()){const o=gr(i.pan.mag(),r,t.extend({},hr,e||{}));n.offset=i.pan.mult(o.amount/i.pan.mag()),n.center=this._map.transform.center,fr(n,o)}if(i.zoom){const t=gr(i.zoom,r,ur);n.zoom=this._map.transform.zoom+t.amount,fr(n,t)}if(i.bearing){const e=gr(i.bearing,r,pr);n.bearing=this._map.transform.bearing+t.clamp(e.amount,-179,179),fr(n,e)}if(i.pitch){const t=gr(i.pitch,r,dr);n.pitch=this._map.transform.pitch+t.amount,fr(n,t)}if(n.zoom||n.bearing){const t=void 0===i.pinchAround?i.around:i.pinchAround;n.around=t?this._map.unproject(t):this._map.getCenter()}return this.clear(),t.extend(n,{noMoveStart:!0})}}function fr(t,e){(!t.duration||t.duration<e.duration)&&(t.duration=e.duration,t.easing=e.easing)}function gr(e,i,r){const{maxSpeed:n,linearity:o,deceleration:a}=r,s=t.clamp(e*o/(i/1e3),-n,n),l=Math.abs(s)/(a*o);return{easing:r.easing,duration:1e3*l,amount:s*(l/2)}}class _r extends t.Event{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,r,n,o={}){const a=i.mousePos(r.getCanvasContainer(),n),s=r.unproject(a);super(e,t.extend({point:a,lngLat:s,originalEvent:n},o)),this._defaultPrevented=!1,this.target=r}}class yr extends t.Event{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,r,n){const o="touchend"===e?n.changedTouches:n.touches,a=i.touchPos(r.getCanvasContainer(),o),s=a.map((t=>r.unproject(t))),l=a.reduce(((t,e,i,r)=>t.add(e.div(r.length))),new t.Point(0,0));super(e,{points:a,point:l,lngLats:s,lngLat:r.unproject(l),originalEvent:n}),this._defaultPrevented=!1}}class xr extends t.Event{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,e,i){super(t,{originalEvent:i}),this._defaultPrevented=!1}}class vr{constructor(t,e){this._map=t,this._clickTolerance=e.clickTolerance}reset(){delete this._mousedownPos}wheel(t){return this._firePreventable(new xr(t.type,this._map,t))}mousedown(t,e){return this._mousedownPos=e,this._firePreventable(new _r(t.type,this._map,t))}mouseup(t){this._map.fire(new _r(t.type,this._map,t))}click(t,e){this._mousedownPos&&this._mousedownPos.dist(e)>=this._clickTolerance||this._map.fire(new _r(t.type,this._map,t))}dblclick(t){return this._firePreventable(new _r(t.type,this._map,t))}mouseover(t){this._map.fire(new _r(t.type,this._map,t))}mouseout(t){this._map.fire(new _r(t.type,this._map,t))}touchstart(t){return this._firePreventable(new yr(t.type,this._map,t))}touchmove(t){this._map.fire(new yr(t.type,this._map,t))}touchend(t){this._map.fire(new yr(t.type,this._map,t))}touchcancel(t){this._map.fire(new yr(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class br{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(t){this._map.fire(new _r(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new _r("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._ignoreContextMenu||this._map.fire(new _r(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class wr{constructor(t){this._map=t}get transform(){return this._map._requestedCameraState||this._map.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(e){return this.transform.pointLocation(t.Point.convert(e),this._map.terrain)}}class Er{constructor(t,e){this._map=t,this._tr=new wr(t),this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=e.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(t,e){this.isEnabled()&&t.shiftKey&&0===t.button&&(i.disableDrag(),this._startPos=this._lastPos=e,this._active=!0)}mousemoveWindow(t,e){if(!this._active)return;const r=e;if(this._lastPos.equals(r)||!this._box&&r.dist(this._startPos)<this._clickTolerance)return;const n=this._startPos;this._lastPos=r,this._box||(this._box=i.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",t));const o=Math.min(n.x,r.x),a=Math.max(n.x,r.x),s=Math.min(n.y,r.y),l=Math.max(n.y,r.y);i.setTransform(this._box,`translate(${o}px,${s}px)`),this._box.style.width=a-o+"px",this._box.style.height=l-s+"px"}mouseupWindow(e,r){if(!this._active)return;if(0!==e.button)return;const n=this._startPos,o=r;if(this.reset(),i.suppressClick(),n.x!==o.x||n.y!==o.y)return this._map.fire(new t.Event("boxzoomend",{originalEvent:e})),{cameraAnimation:t=>t.fitScreenCoordinates(n,o,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",e)}keydown(t){this._active&&27===t.keyCode&&(this.reset(),this._fireEvent("boxzoomcancel",t))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(i.remove(this._box),this._box=null),i.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(e,i){return this._map.fire(new t.Event(e,{originalEvent:i}))}}function Tr(t,e){if(t.length!==e.length)throw new Error(`The number of touches and points are not equal - touches ${t.length}, points ${e.length}`);const i={};for(let r=0;r<t.length;r++)i[t[r].identifier]=e[r];return i}class Sr{constructor(t){this.reset(),this.numTouches=t.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(e,i,r){(this.centroid||r.length>this.numTouches)&&(this.aborted=!0),this.aborted||(void 0===this.startTime&&(this.startTime=e.timeStamp),r.length===this.numTouches&&(this.centroid=function(e){const i=new t.Point(0,0);for(const t of e)i._add(t);return i.div(e.length)}(i),this.touches=Tr(r,i)))}touchmove(t,e,i){if(this.aborted||!this.centroid)return;const r=Tr(i,e);for(const t in this.touches){const e=r[t];(!e||e.dist(this.touches[t])>30)&&(this.aborted=!0)}}touchend(t,e,i){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),0===i.length){const t=!this.aborted&&this.centroid;if(this.reset(),t)return t}}}class Cr{constructor(t){this.singleTap=new Sr(t),this.numTaps=t.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(t,e,i){this.singleTap.touchstart(t,e,i)}touchmove(t,e,i){this.singleTap.touchmove(t,e,i)}touchend(t,e,i){const r=this.singleTap.touchend(t,e,i);if(r){const e=t.timeStamp-this.lastTime<500,i=!this.lastTap||this.lastTap.dist(r)<30;if(e&&i||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=r,this.count===this.numTaps)return this.reset(),r}}}class Ir{constructor(t){this._tr=new wr(t),this._zoomIn=new Cr({numTouches:1,numTaps:2}),this._zoomOut=new Cr({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(t,e,i){this._zoomIn.touchstart(t,e,i),this._zoomOut.touchstart(t,e,i)}touchmove(t,e,i){this._zoomIn.touchmove(t,e,i),this._zoomOut.touchmove(t,e,i)}touchend(t,e,i){const r=this._zoomIn.touchend(t,e,i),n=this._zoomOut.touchend(t,e,i),o=this._tr;return r?(this._active=!0,t.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:e=>e.easeTo({duration:300,zoom:o.zoom+1,around:o.unproject(r)},{originalEvent:t})}):n?(this._active=!0,t.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:e=>e.easeTo({duration:300,zoom:o.zoom-1,around:o.unproject(n)},{originalEvent:t})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Ar{constructor(t){this._enabled=!!t.enable,this._moveStateManager=t.moveStateManager,this._clickTolerance=t.clickTolerance||1,this._moveFunction=t.move,this._activateOnStart=!!t.activateOnStart,t.assignEvents(this),this.reset()}reset(t){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(t)}_move(...t){const e=this._moveFunction(...t);if(e.bearingDelta||e.pitchDelta||e.around||e.panDelta)return this._active=!0,e}dragStart(t,e){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(t)&&(this._moveStateManager.startMove(t),this._lastPoint=e.length?e[0]:e,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(t,e){if(!this.isEnabled())return;const i=this._lastPoint;if(!i)return;if(t.preventDefault(),!this._moveStateManager.isValidMoveEvent(t))return void this.reset(t);const r=e.length?e[0]:e;return!this._moved&&r.dist(i)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=r,this._move(i,r))}dragEnd(t){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(t)&&(this._moved&&i.suppressClick(),this.reset(t))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}}const Mr={0:1,2:2};class kr{constructor(t){this._correctEvent=t.checkCorrectEvent}startMove(t){const e=i.mouseButton(t);this._eventButton=e}endMove(t){delete this._eventButton}isValidStartEvent(t){return this._correctEvent(t)}isValidMoveEvent(t){return!function(t,e){const i=Mr[e];return void 0===t.buttons||(t.buttons&i)!==i}(t,this._eventButton)}isValidEndEvent(t){return i.mouseButton(t)===this._eventButton}}class zr{constructor(){this._firstTouch=void 0}_isOneFingerTouch(t){return 1===t.targetTouches.length}_isSameTouchEvent(t){return t.targetTouches[0].identifier===this._firstTouch}startMove(t){this._firstTouch=t.targetTouches[0].identifier}endMove(t){delete this._firstTouch}isValidStartEvent(t){return this._isOneFingerTouch(t)}isValidMoveEvent(t){return this._isOneFingerTouch(t)&&this._isSameTouchEvent(t)}isValidEndEvent(t){return this._isOneFingerTouch(t)&&this._isSameTouchEvent(t)}}const Pr=t=>{t.mousedown=t.dragStart,t.mousemoveWindow=t.dragMove,t.mouseup=t.dragEnd,t.contextmenu=function(t){t.preventDefault()}},Lr=({enable:t,clickTolerance:e,bearingDegreesPerPixelMoved:r=.8})=>{const n=new kr({checkCorrectEvent:t=>0===i.mouseButton(t)&&t.ctrlKey||2===i.mouseButton(t)});return new Ar({clickTolerance:e,move:(t,e)=>({bearingDelta:(e.x-t.x)*r}),moveStateManager:n,enable:t,assignEvents:Pr})},Dr=({enable:t,clickTolerance:e,pitchDegreesPerPixelMoved:r=-.5})=>{const n=new kr({checkCorrectEvent:t=>0===i.mouseButton(t)&&t.ctrlKey||2===i.mouseButton(t)});return new Ar({clickTolerance:e,move:(t,e)=>({pitchDelta:(e.y-t.y)*r}),moveStateManager:n,enable:t,assignEvents:Pr})};class Rr{constructor(t,e){this._minTouches=t.cooperativeGestures?2:1,this._clickTolerance=t.clickTolerance||1,this._map=e,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new t.Point(0,0),setTimeout((()=>{this._cancelCooperativeMessage=!1}),200)}touchstart(t,e,i){return this._calculateTransform(t,e,i)}touchmove(t,e,i){if(this._map._cooperativeGestures&&(2===this._minTouches&&i.length<2&&!this._cancelCooperativeMessage?this._map._onCooperativeGesture(t,!1,i.length):this._cancelCooperativeMessage||(this._cancelCooperativeMessage=!0)),this._active&&!(i.length<this._minTouches))return t.preventDefault(),this._calculateTransform(t,e,i)}touchend(t,e,i){this._calculateTransform(t,e,i),this._active&&i.length<this._minTouches&&this.reset()}touchcancel(){this.reset()}_calculateTransform(e,i,r){r.length>0&&(this._active=!0);const n=Tr(r,i),o=new t.Point(0,0),a=new t.Point(0,0);let s=0;for(const t in n){const e=n[t],i=this._touches[t];i&&(o._add(e),a._add(e.sub(i)),s++,n[t]=e)}if(this._touches=n,s<this._minTouches||!a.mag())return;const l=a.div(s);return this._sum._add(l),this._sum.mag()<this._clickTolerance?void 0:{around:o.div(s),panDelta:l}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Br{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}_start(t){}_move(t,e,i){return{}}touchstart(t,e,i){this._firstTwoTouches||i.length<2||(this._firstTwoTouches=[i[0].identifier,i[1].identifier],this._start([e[0],e[1]]))}touchmove(t,e,i){if(!this._firstTwoTouches)return;t.preventDefault();const[r,n]=this._firstTwoTouches,o=Fr(i,e,r),a=Fr(i,e,n);if(!o||!a)return;const s=this._aroundCenter?null:o.add(a).div(2);return this._move([o,a],s,t)}touchend(t,e,r){if(!this._firstTwoTouches)return;const[n,o]=this._firstTwoTouches,a=Fr(r,e,n),s=Fr(r,e,o);a&&s||(this._active&&i.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(t){this._enabled=!0,this._aroundCenter=!!t&&"center"===t.around}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}function Fr(t,e,i){for(let r=0;r<t.length;r++)if(t[r].identifier===i)return e[r]}function Or(t,e){return Math.log(t/e)/Math.LN2}class Ur extends Br{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(t){this._startDistance=this._distance=t[0].dist(t[1])}_move(t,e){const i=this._distance;if(this._distance=t[0].dist(t[1]),this._active||!(Math.abs(Or(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:Or(this._distance,i),pinchAround:e}}}function Vr(t,e){return 180*t.angleWith(e)/Math.PI}class Nr extends Br{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(t){this._startVector=this._vector=t[0].sub(t[1]),this._minDiameter=t[0].dist(t[1])}_move(t,e){const i=this._vector;if(this._vector=t[0].sub(t[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:Vr(this._vector,i),pinchAround:e}}_isBelowThreshold(t){this._minDiameter=Math.min(this._minDiameter,t.mag());const e=25/(Math.PI*this._minDiameter)*360,i=Vr(t,this._startVector);return Math.abs(i)<e}}function $r(t){return Math.abs(t.y)>Math.abs(t.x)}class jr extends Br{constructor(t){super(),this._map=t}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(t,e,i){super.touchstart(t,e,i),this._currentTouchCount=i.length}_start(t){this._lastPoints=t,$r(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,e,i){if(this._map._cooperativeGestures&&this._currentTouchCount<3)return;const r=t[0].sub(this._lastPoints[0]),n=t[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(r,n,i.timeStamp),this._valid?(this._lastPoints=t,this._active=!0,{pitchDelta:(r.y+n.y)/2*-.5}):void 0}gestureBeginsVertically(t,e,i){if(void 0!==this._valid)return this._valid;const r=t.mag()>=2,n=e.mag()>=2;if(!r&&!n)return;if(!r||!n)return void 0===this._firstMove&&(this._firstMove=i),i-this._firstMove<100&&void 0;const o=t.y>0==e.y>0;return $r(t)&&$r(e)&&o}}const qr={panStep:100,bearingStep:15,pitchStep:10};class Zr{constructor(t){this._tr=new wr(t);const e=qr;this._panStep=e.panStep,this._bearingStep=e.bearingStep,this._pitchStep=e.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(t){if(t.altKey||t.ctrlKey||t.metaKey)return;let e=0,i=0,r=0,n=0,o=0;switch(t.keyCode){case 61:case 107:case 171:case 187:e=1;break;case 189:case 109:case 173:e=-1;break;case 37:t.shiftKey?i=-1:(t.preventDefault(),n=-1);break;case 39:t.shiftKey?i=1:(t.preventDefault(),n=1);break;case 38:t.shiftKey?r=1:(t.preventDefault(),o=-1);break;case 40:t.shiftKey?r=-1:(t.preventDefault(),o=1);break;default:return}return this._rotationDisabled&&(i=0,r=0),{cameraAnimation:a=>{const s=this._tr;a.easeTo({duration:300,easeId:"keyboardHandler",easing:Gr,zoom:e?Math.round(s.zoom)+e*(t.shiftKey?2:1):s.zoom,bearing:s.bearing+i*this._bearingStep,pitch:s.pitch+r*this._pitchStep,offset:[-n*this._panStep,-o*this._panStep],center:s.center},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function Gr(t){return t*(2-t)}const Hr=4.000244140625;class Xr{constructor(e,i){this._map=e,this._tr=new wr(e),this._el=e.getCanvasContainer(),this._handler=i,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222,t.bindAll(["_onTimeout"],this)}setZoomRate(t){this._defaultZoomRate=t}setWheelZoomRate(t){this._wheelZoomRate=t}isEnabled(){return!!this._enabled}isActive(){return!!this._active||void 0!==this._finishTimeout}isZooming(){return!!this._zooming}enable(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=t&&"center"===t.around)}disable(){this.isEnabled()&&(this._enabled=!1)}wheel(e){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!e[this._map._metaKey])return;e.preventDefault()}let i=e.deltaMode===WheelEvent.DOM_DELTA_LINE?40*e.deltaY:e.deltaY;const r=t.exported.now(),n=r-(this._lastWheelEventTime||0);this._lastWheelEventTime=r,0!==i&&i%Hr==0?this._type="wheel":0!==i&&Math.abs(i)<4?this._type="trackpad":n>400?(this._type=null,this._lastValue=i,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(n*i)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,i+=this._lastValue)),e.shiftKey&&i&&(i/=4),this._type&&(this._lastWheelEvent=e,this._delta-=i,this._active||this._start(e)),e.preventDefault()}_onTimeout(t){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(t)}_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);const r=i.mousePos(this._el,e),n=this._tr;this._around=t.LngLat.convert(this._aroundCenter?n.center:n.unproject(r)),this._aroundPoint=n.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame())}renderFrame(){if(!this._frameId)return;if(this._frameId=null,!this.isActive())return;const e=this._tr.transform;if(0!==this._delta){const t="wheel"===this._type&&Math.abs(this._delta)>Hr?this._wheelZoomRate:this._defaultZoomRate;let i=2/(1+Math.exp(-Math.abs(this._delta*t)));this._delta<0&&0!==i&&(i=1/i);const r="number"==typeof this._targetZoom?e.zoomScale(this._targetZoom):e.scale;this._targetZoom=Math.min(e.maxZoom,Math.max(e.minZoom,e.scaleZoom(r*i))),"wheel"===this._type&&(this._startZoom=e.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const i="number"==typeof this._targetZoom?this._targetZoom:e.zoom,r=this._startZoom,n=this._easing;let o,a=!1;if("wheel"===this._type&&r&&n){const e=Math.min((t.exported.now()-this._lastWheelEventTime)/200,1),s=n(e);o=t.interpolate.number(r,i,s),e<1?this._frameId||(this._frameId=!0):a=!0}else o=i,a=!0;return this._active=!0,a&&(this._active=!1,this._finishTimeout=setTimeout((()=>{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout}),200)),{noInertia:!0,needsRenderFrame:!a,zoomDelta:o-e.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(e){let i=t.ease;if(this._prevEase){const e=this._prevEase,r=(t.exported.now()-e.start)/e.duration,n=e.easing(r+.01)-e.easing(r),o=.27/Math.sqrt(n*n+1e-4)*.01,a=Math.sqrt(.0729-o*o);i=t.bezier(o,a,.25,1)}return this._prevEase={start:t.exported.now(),duration:e,easing:i},i}reset(){this._active=!1}}class Wr{constructor(t,e){this._clickZoom=t,this._tapZoom=e}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 Kr{constructor(t){this._tr=new wr(t),this.reset()}reset(){this._active=!1}dblclick(t,e){return t.preventDefault(),{cameraAnimation:i=>{i.easeTo({duration:300,zoom:this._tr.zoom+(t.shiftKey?-1:1),around:this._tr.unproject(e)},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Yr{constructor(){this._tap=new Cr({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,this._tap.reset()}touchstart(t,e,i){this._swipePoint||(this._tapTime&&t.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?i.length>0&&(this._swipePoint=e[0],this._swipeTouch=i[0].identifier):this._tap.touchstart(t,e,i))}touchmove(t,e,i){if(this._tapTime){if(this._swipePoint){if(i[0].identifier!==this._swipeTouch)return;const r=e[0],n=r.y-this._swipePoint.y;return this._swipePoint=r,t.preventDefault(),this._active=!0,{zoomDelta:n/128}}}else this._tap.touchmove(t,e,i)}touchend(t,e,i){this._tapTime?this._swipePoint&&0===i.length&&this.reset():this._tap.touchend(t,e,i)&&(this._tapTime=t.timeStamp)}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Jr{constructor(t,e,i){this._el=t,this._mousePan=e,this._touchPan=i}enable(t){this._inertiaOptions=t||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class Qr{constructor(t,e,i){this._pitchWithRotate=t.pitchWithRotate,this._mouseRotate=e,this._mousePitch=i}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 tn{constructor(t,e,i,r){this._el=t,this._touchZoom=e,this._touchRotate=i,this._tapDragZoom=r,this._rotationDisabled=!1,this._enabled=!0}enable(t){this._touchZoom.enable(t),this._rotationDisabled||this._touchRotate.enable(t),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}const en=t=>t.zoom||t.drag||t.pitch||t.rotate;class rn extends t.Event{}function nn(t){return t.panDelta&&t.panDelta.mag()||t.zoomDelta||t.bearingDelta||t.pitchDelta}class on{constructor(e,r){this._map=e,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new mr(e),this._bearingSnap=r.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(r),t.bindAll(["handleEvent","handleWindowEvent"],this);const n=this._el;this._listeners=[[n,"touchstart",{passive:!0}],[n,"touchmove",{passive:!1}],[n,"touchend",void 0],[n,"touchcancel",void 0],[n,"mousedown",void 0],[n,"mousemove",void 0],[n,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[n,"mouseover",void 0],[n,"mouseout",void 0],[n,"dblclick",void 0],[n,"click",void 0],[n,"keydown",{capture:!1}],[n,"keyup",void 0],[n,"wheel",{passive:!1}],[n,"contextmenu",void 0],[window,"blur",void 0]];for(const[t,e,r]of this._listeners)i.addEventListener(t,e,t===document?this.handleWindowEvent:this.handleEvent,r)}destroy(){for(const[t,e,r]of this._listeners)i.removeEventListener(t,e,t===document?this.handleWindowEvent:this.handleEvent,r)}_addDefaultHandlers(t){const e=this._map,r=e.getCanvasContainer();this._add("mapEvent",new vr(e,t));const n=e.boxZoom=new Er(e,t);this._add("boxZoom",n);const o=new Ir(e),a=new Kr(e);e.doubleClickZoom=new Wr(a,o),this._add("tapZoom",o),this._add("clickZoom",a);const s=new Yr;this._add("tapDragZoom",s);const l=e.touchPitch=new jr(e);this._add("touchPitch",l);const c=Lr(t),h=Dr(t);e.dragRotate=new Qr(t,c,h),this._add("mouseRotate",c,["mousePitch"]),this._add("mousePitch",h,["mouseRotate"]);const u=(({enable:t,clickTolerance:e})=>{const r=new kr({checkCorrectEvent:t=>0===i.mouseButton(t)&&!t.ctrlKey});return new Ar({clickTolerance:e,move:(t,e)=>({around:e,panDelta:e.sub(t)}),activateOnStart:!0,moveStateManager:r,enable:t,assignEvents:Pr})})(t),p=new Rr(t,e);e.dragPan=new Jr(r,u,p),this._add("mousePan",u),this._add("touchPan",p,["touchZoom","touchRotate"]);const d=new Nr,m=new Ur;e.touchZoomRotate=new tn(r,m,d,s),this._add("touchRotate",d,["touchPan","touchZoom"]),this._add("touchZoom",m,["touchPan","touchRotate"]);const f=e.scrollZoom=new Xr(e,this);this._add("scrollZoom",f,["mousePan"]);const g=e.keyboard=new Zr(e);this._add("keyboard",g),this._add("blockableMapEvent",new br(e));for(const i of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])t.interactive&&t[i]&&e[i].enable(t[i])}_add(t,e,i){this._handlers.push({handlerName:t,handler:e,allowed:i}),this._handlersById[t]=e}stop(t){if(!this._updatingCamera){for(const{handler:t}of this._handlers)t.reset();this._inertia.clear(),this._fireEvents({},{},t),this._changes=[]}}isActive(){for(const{handler:t}of this._handlers)if(t.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return Boolean(en(this._eventsInProgress))||this.isZooming()}_blockedByActive(t,e,i){for(const r in t)if(r!==i&&(!e||e.indexOf(r)<0))return!0;return!1}handleWindowEvent(t){this.handleEvent(t,`${t.type}Window`)}_getMapTouches(t){const e=[];for(const i of t)this._el.contains(i.target)&&e.push(i);return e}handleEvent(t,e){if("blur"===t.type)return void this.stop(!0);this._updatingCamera=!0;const r="renderFrame"===t.type?void 0:t,n={needsRenderFrame:!1},o={},a={},s=t.touches,l=s?this._getMapTouches(s):void 0,c=l?i.touchPos(this._el,l):i.mousePos(this._el,t);for(const{handlerName:i,handler:s,allowed:h}of this._handlers){if(!s.isEnabled())continue;let u;this._blockedByActive(a,h,i)?s.reset():s[e||t.type]&&(u=s[e||t.type](t,c,l),this.mergeHandlerResult(n,o,u,i,r),u&&u.needsRenderFrame&&this._triggerRenderFrame()),(u||s.isActive())&&(a[i]=s)}const h={};for(const t in this._previousActiveHandlers)a[t]||(h[t]=r);this._previousActiveHandlers=a,(Object.keys(h).length||nn(n))&&(this._changes.push([n,o,h]),this._triggerRenderFrame()),(Object.keys(a).length||nn(n))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:u}=n;u&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],u(this._map))}mergeHandlerResult(e,i,r,n,o){if(!r)return;t.extend(e,r);const a={handlerName:n,originalEvent:r.originalEvent||o};void 0!==r.zoomDelta&&(i.zoom=a),void 0!==r.panDelta&&(i.drag=a),void 0!==r.pitchDelta&&(i.pitch=a),void 0!==r.bearingDelta&&(i.rotate=a)}_applyChanges(){const e={},i={},r={};for(const[n,o,a]of this._changes)n.panDelta&&(e.panDelta=(e.panDelta||new t.Point(0,0))._add(n.panDelta)),n.zoomDelta&&(e.zoomDelta=(e.zoomDelta||0)+n.zoomDelta),n.bearingDelta&&(e.bearingDelta=(e.bearingDelta||0)+n.bearingDelta),n.pitchDelta&&(e.pitchDelta=(e.pitchDelta||0)+n.pitchDelta),void 0!==n.around&&(e.around=n.around),void 0!==n.pinchAround&&(e.pinchAround=n.pinchAround),n.noInertia&&(e.noInertia=n.noInertia),t.extend(i,o),t.extend(r,a);this._updateMapTransform(e,i,r),this._changes=[]}_updateMapTransform(t,e,i){const r=this._map,n=r._getTransformForUpdate(),o=r.terrain;if(!(nn(t)||o&&this._terrainMovement))return this._fireEvents(e,i,!0);let{panDelta:a,zoomDelta:s,bearingDelta:l,pitchDelta:c,around:h,pinchAround:u}=t;void 0!==u&&(h=u),r._stop(!0),h=h||r.transform.centerPoint;const p=n.pointLocation(a?h.sub(a):h);l&&(n.bearing+=l),c&&(n.pitch+=c),s&&(n.zoom+=s),o?this._terrainMovement||!e.drag&&!e.zoom?e.drag&&this._terrainMovement?n.center=n.pointLocation(n.centerPoint.sub(a)):n.setLocationAtPoint(p,h):(this._terrainMovement=!0,n.freezeElevation=!0,n.setLocationAtPoint(p,h),this._map.once("moveend",(()=>{n.freezeElevation=!1,this._terrainMovement=!1,n.recalculateZoom(r.terrain)}))):n.setLocationAtPoint(p,h),r._applyUpdatedTransform(n),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(e,i,!0)}_fireEvents(e,i,r){const n=en(this._eventsInProgress),o=en(e),a={};for(const t in e){const{originalEvent:i}=e[t];this._eventsInProgress[t]||(a[`${t}start`]=i),this._eventsInProgress[t]=e[t]}!n&&o&&this._fireEvent("movestart",o.originalEvent);for(const t in a)this._fireEvent(t,a[t]);o&&this._fireEvent("move",o.originalEvent);for(const t in e){const{originalEvent:i}=e[t];this._fireEvent(t,i)}const s={};let l;for(const t in this._eventsInProgress){const{handlerName:e,originalEvent:r}=this._eventsInProgress[t];this._handlersById[e].isActive()||(delete this._eventsInProgress[t],l=i[e]||r,s[`${t}end`]=l)}for(const t in s)this._fireEvent(t,s[t]);const c=en(this._eventsInProgress);if(r&&(n||o)&&!c){this._updatingCamera=!0;const e=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),i=t=>0!==t&&-this._bearingSnap<t&&t<this._bearingSnap;e?(i(e.bearing||this._map.getBearing())&&(e.bearing=0),e.freezeElevation=!0,this._map.easeTo(e,{originalEvent:l})):(this._map.fire(new t.Event("moveend",{originalEvent:l})),i(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(e,i){this._map.fire(new t.Event(e,i?{originalEvent:i}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add((t=>{delete this._frameId,this.handleEvent(new rn("renderFrame",{timeStamp:t})),this._applyChanges()}))}_triggerRenderFrame(){void 0===this._frameId&&(this._frameId=this._requestFrame())}}const an={extend:(e,...i)=>t.extend(e,...i),run(t){t()},logToElement(t,e=!1,i="log"){const r=window.document.getElementById(i);r&&(e&&(r.innerHTML=""),r.innerHTML+=`<br>${t}`)}};class sn extends t.Evented{constructor(e,i){super(),this._moving=!1,this._zooming=!1,this.transform=e,this._bearingSnap=i.bearingSnap,t.bindAll(["_renderFrameCallback"],this),this.on("moveend",(()=>{delete this._requestedCameraState}))}getCenter(){return new t.LngLat(this.transform.center.lng,this.transform.center.lat)}setCenter(t,e){return this.jumpTo({center:t},e)}panBy(e,i,r){return e=t.Point.convert(e).mult(-1),this.panTo(this.transform.center,t.extend({offset:e},i),r)}panTo(e,i,r){return this.easeTo(t.extend({center:e},i),r)}getZoom(){return this.transform.zoom}setZoom(t,e){return this.jumpTo({zoom:t},e),this}zoomTo(e,i,r){return this.easeTo(t.extend({zoom:e},i),r)}zoomIn(t,e){return this.zoomTo(this.getZoom()+1,t,e),this}zoomOut(t,e){return this.zoomTo(this.getZoom()-1,t,e),this}getBearing(){return this.transform.bearing}setBearing(t,e){return this.jumpTo({bearing:t},e),this}getPadding(){return this.transform.padding}setPadding(t,e){return this.jumpTo({padding:t},e),this}rotateTo(e,i,r){return this.easeTo(t.extend({bearing:e},i),r)}resetNorth(e,i){return this.rotateTo(0,t.extend({duration:1e3},e),i),this}resetNorthPitch(e,i){return this.easeTo(t.extend({bearing:0,pitch:0,duration:1e3},e),i),this}snapToNorth(t,e){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(t,e):this}getPitch(){return this.transform.pitch}setPitch(t,e){return this.jumpTo({pitch:t},e),this}cameraForBounds(t,e){t=R.convert(t);const i=e&&e.bearing||0;return this._cameraForBoxAndBearing(t.getNorthWest(),t.getSouthEast(),i,e)}_cameraForBoxAndBearing(e,i,r,n){const o={top:0,bottom:0,right:0,left:0};if("number"==typeof(n=t.extend({padding:o,offset:[0,0],maxZoom:this.transform.maxZoom},n)).padding){const t=n.padding;n.padding={top:t,bottom:t,right:t,left:t}}n.padding=t.extend(o,n.padding);const a=this.transform,s=a.padding,l=a.project(t.LngLat.convert(e)),c=a.project(t.LngLat.convert(i)),h=l.rotate(-r*Math.PI/180),u=c.rotate(-r*Math.PI/180),p=new t.Point(Math.max(h.x,u.x),Math.max(h.y,u.y)),d=new t.Point(Math.min(h.x,u.x),Math.min(h.y,u.y)),m=p.sub(d),f=(a.width-(s.left+s.right+n.padding.left+n.padding.right))/m.x,g=(a.height-(s.top+s.bottom+n.padding.top+n.padding.bottom))/m.y;if(g<0||f<0)return void t.warnOnce("Map cannot fit within canvas with the given bounds, padding, and/or offset.");const _=Math.min(a.scaleZoom(a.scale*Math.min(f,g)),n.maxZoom),y=t.Point.convert(n.offset),x=new t.Point((n.padding.left-n.padding.right)/2,(n.padding.top-n.padding.bottom)/2).rotate(r*Math.PI/180),v=y.add(x).mult(a.scale/a.zoomScale(_));return{center:a.unproject(l.add(c).div(2).sub(v)),zoom:_,bearing:r}}fitBounds(t,e,i){return this._fitInternal(this.cameraForBounds(t,e),e,i)}fitScreenCoordinates(e,i,r,n,o){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(t.Point.convert(e)),this.transform.pointLocation(t.Point.convert(i)),r,n),n,o)}_fitInternal(e,i,r){return e?(delete(i=t.extend(e,i)).padding,i.linear?this.easeTo(i,r):this.flyTo(i,r)):this}jumpTo(e,i){this.stop();const r=this._getTransformForUpdate();let n=!1,o=!1,a=!1;return"zoom"in e&&r.zoom!==+e.zoom&&(n=!0,r.zoom=+e.zoom),void 0!==e.center&&(r.center=t.LngLat.convert(e.center)),"bearing"in e&&r.bearing!==+e.bearing&&(o=!0,r.bearing=+e.bearing),"pitch"in e&&r.pitch!==+e.pitch&&(a=!0,r.pitch=+e.pitch),null==e.padding||r.isPaddingEqual(e.padding)||(r.padding=e.padding),this._applyUpdatedTransform(r),this.fire(new t.Event("movestart",i)).fire(new t.Event("move",i)),n&&this.fire(new t.Event("zoomstart",i)).fire(new t.Event("zoom",i)).fire(new t.Event("zoomend",i)),o&&this.fire(new t.Event("rotatestart",i)).fire(new t.Event("rotate",i)).fire(new t.Event("rotateend",i)),a&&this.fire(new t.Event("pitchstart",i)).fire(new t.Event("pitch",i)).fire(new t.Event("pitchend",i)),this.fire(new t.Event("moveend",i))}calculateCameraOptionsFromTo(e,i,r,n=0){const o=t.MercatorCoordinate.fromLngLat(e,i),a=t.MercatorCoordinate.fromLngLat(r,n),s=a.x-o.x,l=a.y-o.y,c=a.z-o.z,h=Math.hypot(s,l,c);if(0===h)throw new Error("Can't calculate camera options with same From and To");const u=Math.hypot(s,l),p=this.transform.scaleZoom(this.transform.cameraToCenterDistance/h/this.transform.tileSize),d=180*Math.atan2(s,-l)/Math.PI;let m=180*Math.acos(u/h)/Math.PI;return m=c<0?90-m:90+m,{center:a.toLngLat(),zoom:p,pitch:m,bearing:d}}easeTo(e,i){this._stop(!1,e.easeId),(!1===(e=t.extend({offset:[0,0],duration:500,easing:t.ease},e)).animate||!e.essential&&t.exported.prefersReducedMotion)&&(e.duration=0);const r=this._getTransformForUpdate(),n=this.getZoom(),o=this.getBearing(),a=this.getPitch(),s=this.getPadding(),l="zoom"in e?+e.zoom:n,c="bearing"in e?this._normalizeBearing(e.bearing,o):o,h="pitch"in e?+e.pitch:a,u="padding"in e?e.padding:r.padding,p=t.Point.convert(e.offset);let d=r.centerPoint.add(p);const m=r.pointLocation(d),f=t.LngLat.convert(e.center||m);this._normalizeCenter(f);const g=r.project(m),_=r.project(f).sub(g),y=r.zoomScale(l-n);let x,v;e.around&&(x=t.LngLat.convert(e.around),v=r.locationPoint(x));const b={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||l!==n,this._rotating=this._rotating||o!==c,this._pitching=this._pitching||h!==a,this._padding=!r.isPaddingEqual(u),this._easeId=e.easeId,this._prepareEase(i,e.noMoveStart,b),this.terrain&&this._prepareElevation(f),this._ease((m=>{if(this._zooming&&(r.zoom=t.interpolate.number(n,l,m)),this._rotating&&(r.bearing=t.interpolate.number(o,c,m)),this._pitching&&(r.pitch=t.interpolate.number(a,h,m)),this._padding&&(r.interpolatePadding(s,u,m),d=r.centerPoint.add(p)),this.terrain&&!e.freezeElevation&&this._updateElevation(m),x)r.setLocationAtPoint(x,v);else{const t=r.zoomScale(r.zoom-n),e=l>n?Math.min(2,y):Math.max(.5,y),i=Math.pow(e,1-m),o=r.unproject(g.add(_.mult(m*i)).mult(t));r.setLocationAtPoint(r.renderWorldCopies?o.wrap():o,d)}this._applyUpdatedTransform(r),this._fireMoveEvents(i)}),(t=>{this.terrain&&this._finalizeElevation(),this._afterEase(i,t)}),e),this}_prepareEase(e,i,r={}){this._moving=!0,i||r.moving||this.fire(new t.Event("movestart",e)),this._zooming&&!r.zooming&&this.fire(new t.Event("zoomstart",e)),this._rotating&&!r.rotating&&this.fire(new t.Event("rotatestart",e)),this._pitching&&!r.pitching&&this.fire(new t.Event("pitchstart",e))}_prepareElevation(t){this._elevationCenter=t,this._elevationStart=this.transform.elevation,this._elevationTarget=this.transform.getElevation(t,this.terrain),this.transform.freezeElevation=!0}_updateElevation(e){const i=this.transform.getElevation(this._elevationCenter,this.terrain);if(e<1&&i!==this._elevationTarget){const t=this._elevationTarget-this._elevationStart;this._elevationStart+=e*(t-(i-(t*e+this._elevationStart))/(1-e)),this._elevationTarget=i}this.transform.elevation=t.interpolate.number(this._elevationStart,this._elevationTarget,e)}_finalizeElevation(){this.transform.freezeElevation=!1,this.transform.recalculateZoom(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_applyUpdatedTransform(t){if(!this.transformCameraUpdate)return;const e=t.clone(),{center:i,zoom:r,pitch:n,bearing:o,elevation:a}=this.transformCameraUpdate(e);i&&(e.center=i),void 0!==r&&(e.zoom=r),void 0!==n&&(e.pitch=n),void 0!==o&&(e.bearing=o),void 0!==a&&(e.elevation=a),this.transform.apply(e)}_fireMoveEvents(e){this.fire(new t.Event("move",e)),this._zooming&&this.fire(new t.Event("zoom",e)),this._rotating&&this.fire(new t.Event("rotate",e)),this._pitching&&this.fire(new t.Event("pitch",e))}_afterEase(e,i){if(this._easeId&&i&&this._easeId===i)return;delete this._easeId;const r=this._zooming,n=this._rotating,o=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,r&&this.fire(new t.Event("zoomend",e)),n&&this.fire(new t.Event("rotateend",e)),o&&this.fire(new t.Event("pitchend",e)),this.fire(new t.Event("moveend",e))}flyTo(e,i){if(!e.essential&&t.exported.prefersReducedMotion){const r=t.pick(e,["center","zoom","bearing","pitch","around"]);return this.jumpTo(r,i)}this.stop(),e=t.extend({offset:[0,0],speed:1.2,curve:1.42,easing:t.ease},e);const r=this._getTransformForUpdate(),n=this.getZoom(),o=this.getBearing(),a=this.getPitch(),s=this.getPadding(),l="zoom"in e?t.clamp(+e.zoom,r.minZoom,r.maxZoom):n,c="bearing"in e?this._normalizeBearing(e.bearing,o):o,h="pitch"in e?+e.pitch:a,u="padding"in e?e.padding:r.padding,p=r.zoomScale(l-n),d=t.Point.convert(e.offset);let m=r.centerPoint.add(d);const f=r.pointLocation(m),g=t.LngLat.convert(e.center||f);this._normalizeCenter(g);const _=r.project(f),y=r.project(g).sub(_);let x=e.curve;const v=Math.max(r.width,r.height),b=v/p,w=y.mag();if("minZoom"in e){const i=t.clamp(Math.min(e.minZoom,n,l),r.minZoom,r.maxZoom),o=v/r.zoomScale(i-n);x=Math.sqrt(o/w*2)}const E=x*x;function T(t){const e=(b*b-v*v+(t?-1:1)*E*E*w*w)/(2*(t?b:v)*E*w);return Math.log(Math.sqrt(e*e+1)-e)}function S(t){return(Math.exp(t)-Math.exp(-t))/2}function C(t){return(Math.exp(t)+Math.exp(-t))/2}const I=T(0);let A=function(t){return C(I)/C(I+x*t)},M=function(t){return v*((C(I)*(S(e=I+x*t)/C(e))-S(I))/E)/w;var e},k=(T(1)-I)/x;if(Math.abs(w)<1e-6||!isFinite(k)){if(Math.abs(v-b)<1e-6)return this.easeTo(e,i);const t=b<v?-1:1;k=Math.abs(Math.log(b/v))/x,M=function(){return 0},A=function(e){return Math.exp(t*x*e)}}return e.duration="duration"in e?+e.duration:1e3*k/("screenSpeed"in e?+e.screenSpeed/x:+e.speed),e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=o!==c,this._pitching=h!==a,this._padding=!r.isPaddingEqual(u),this._prepareEase(i,!1),this.terrain&&this._prepareElevation(g),this._ease((p=>{const f=p*k,x=1/A(f);r.zoom=1===p?l:n+r.scaleZoom(x),this._rotating&&(r.bearing=t.interpolate.number(o,c,p)),this._pitching&&(r.pitch=t.interpolate.number(a,h,p)),this._padding&&(r.interpolatePadding(s,u,p),m=r.centerPoint.add(d)),this.terrain&&!e.freezeElevation&&this._updateElevation(p);const v=1===p?g:r.unproject(_.add(y.mult(M(f))).mult(x));r.setLocationAtPoint(r.renderWorldCopies?v.wrap():v,m),this._applyUpdatedTransform(r),this._fireMoveEvents(i)}),(()=>{this.terrain&&this._finalizeElevation(),this._afterEase(i)}),e),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(t,e){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const t=this._onEaseEnd;delete this._onEaseEnd,t.call(this,e)}if(!t){const t=this.handlers;t&&t.stop(!1)}return this}_ease(e,i,r){!1===r.animate||0===r.duration?(e(1),i()):(this._easeStart=t.exported.now(),this._easeOptions=r,this._onEaseFrame=e,this._onEaseEnd=i,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){const e=Math.min((t.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,i){e=t.wrap(e,-180,180);const r=Math.abs(e-i);return Math.abs(e-360-i)<r&&(e-=360),Math.abs(e+360-i)<r&&(e+=360),e}_normalizeCenter(t){const e=this.transform;if(!e.renderWorldCopies||e.lngRange)return;const i=t.lng-e.center.lng;t.lng+=i>180?-360:i<-180?360:0}queryTerrainElevation(e){return this.terrain?this.transform.getElevation(t.LngLat.convert(e),this.terrain)-this.transform.elevation:null}}class ln{constructor(e={}){this.options=e,t.bindAll(["_toggleAttribution","_updateData","_updateCompact","_updateCompactMinimize"],this)}getDefaultPosition(){return"bottom-right"}onAdd(t){return this._map=t,this._compact=this.options&&this.options.compact,this._container=i.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=i.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=i.create("div","maplibregl-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("terrain",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._container}onRemove(){i.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(t,e){const i=this._map._getUIString(`AttributionControl.${e}`);t.title=i,t.setAttribute("aria-label",i)}_toggleAttribution(){this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")))}_updateData(t){!t||"metadata"!==t.sourceDataType&&"visibility"!==t.sourceDataType&&"style"!==t.dataType&&"terrain"!==t.type||this._updateAttributions()}_updateAttributions(){if(!this._map.style)return;let t=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=t.concat(this.options.customAttribution.map((t=>"string"!=typeof t?"":t))):"string"==typeof this.options.customAttribution&&t.push(this.options.customAttribution)),this._map.style.stylesheet){const t=this._map.style.stylesheet;this.styleOwner=t.owner,this.styleId=t.id}const e=this._map.style.sourceCaches;for(const i in e){const r=e[i];if(r.used||r.usedForTerrain){const e=r.getSource();e.attribution&&t.indexOf(e.attribution)<0&&t.push(e.attribution)}}t=t.filter((t=>String(t).trim())),t.sort(((t,e)=>t.length-e.length)),t=t.filter(((e,i)=>{for(let r=i+1;r<t.length;r++)if(t[r].indexOf(e)>=0)return!1;return!0}));const i=t.join(" | ");i!==this._attribHTML&&(this._attribHTML=i,t.length?(this._innerContainer.innerHTML=i,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}_updateCompact(){this._map.getCanvasContainer().offsetWidth<=640||this._compact?!1===this._compact?this._container.setAttribute("open",""):this._container.classList.contains("maplibregl-compact")||this._container.classList.contains("maplibregl-attrib-empty")||(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","maplibregl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show"))}_updateCompactMinimize(){this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")}}class cn{constructor(e={}){this.options=e,t.bindAll(["_updateCompact"],this)}getDefaultPosition(){return"bottom-left"}onAdd(t){this._map=t,this._compact=this.options&&this.options.compact,this._container=i.create("div","maplibregl-ctrl");const e=i.create("a","maplibregl-ctrl-logo");return e.target="_blank",e.rel="noopener nofollow",e.href="https://maplibre.org/",e.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),e.setAttribute("rel","noopener nofollow"),this._container.appendChild(e),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){i.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}_updateCompact(){const t=this._container.children;if(t.length){const e=t[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?!1!==this._compact&&e.classList.add("maplibregl-compact"):e.classList.remove("maplibregl-compact")}}}class hn{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(t){const e=++this._id;return this._queue.push({callback:t,id:e,cancelled:!1}),e}remove(t){const e=this._currentlyRunning,i=e?this._queue.concat(e):this._queue;for(const e of i)if(e.id===t)return void(e.cancelled=!0)}run(t=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const e=this._currentlyRunning=this._queue;this._queue=[];for(const i of e)if(!i.cancelled&&(i.callback(t),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}const un={"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","TerrainControl.enableTerrain":"Enable terrain","TerrainControl.disableTerrain":"Disable terrain"};var pn=t.createLayout([{name:"a_pos3d",type:"Int16",components:3}]);class dn extends t.Evented{constructor(t){super(),this.sourceCache=t,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,t.usedForTerrain=!0,t.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(e,i){this.sourceCache.update(e,i),this._renderableTilesKeys=[];const r={};for(const n of e.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:i}))r[n.key]=!0,this._renderableTilesKeys.push(n.key),this._tiles[n.key]||(n.posMatrix=new Float64Array(16),t.ortho(n.posMatrix,0,t.EXTENT,0,t.EXTENT,0,1),this._tiles[n.key]=new W(n,this.tileSize));for(const t in this._tiles)r[t]||delete this._tiles[t]}freeRtt(t){for(const e in this._tiles){const i=this._tiles[e];(!t||i.tileID.equals(t)||i.tileID.isChildOf(t)||t.isChildOf(i.tileID))&&(i.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map((t=>this.getTileByID(t)))}getTileByID(t){return this._tiles[t]}getTerrainCoords(e){const i={};for(const r of this._renderableTilesKeys){const n=this._tiles[r].tileID;if(n.canonical.equals(e.canonical)){const n=e.clone();n.posMatrix=new Float64Array(16),t.ortho(n.posMatrix,0,t.EXTENT,0,t.EXTENT,0,1),i[r]=n}else if(n.canonical.isChildOf(e.canonical)){const o=e.clone();o.posMatrix=new Float64Array(16);const a=n.canonical.z-e.canonical.z,s=n.canonical.x-(n.canonical.x>>a<<a),l=n.canonical.y-(n.canonical.y>>a<<a),c=t.EXTENT>>a;t.ortho(o.posMatrix,0,c,0,c,0,1),t.translate(o.posMatrix,o.posMatrix,[-s*c,-l*c,0]),i[r]=o}else if(e.canonical.isChildOf(n.canonical)){const o=e.clone();o.posMatrix=new Float64Array(16);const a=e.canonical.z-n.canonical.z,s=e.canonical.x-(e.canonical.x>>a<<a),l=e.canonical.y-(e.canonical.y>>a<<a),c=t.EXTENT>>a;t.ortho(o.posMatrix,0,t.EXTENT,0,t.EXTENT,0,1),t.translate(o.posMatrix,o.posMatrix,[s*c,l*c,0]),t.scale(o.posMatrix,o.posMatrix,[1/2**a,1/2**a,0]),i[r]=o}}return i}getSourceTile(t,e){const i=this.sourceCache._source;let r=t.overscaledZ-this.deltaZoom;if(r>i.maxzoom&&(r=i.maxzoom),r<i.minzoom)return null;this._sourceTileCache[t.key]||(this._sourceTileCache[t.key]=t.scaledTo(r).key);let n=this.sourceCache.getTileByID(this._sourceTileCache[t.key]);if((!n||!n.dem)&&e)for(;r>=i.minzoom&&(!n||!n.dem);)n=this.sourceCache.getTileByID(t.scaledTo(r--).key);return n}tilesAfterTime(t=Date.now()){return Object.values(this._tiles).filter((e=>e.timeAdded>=t))}}class mn{constructor(t,e,i){this.painter=t,this.sourceCache=new dn(e),this.options=i,this.exaggeration="number"==typeof i.exaggeration?i.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(e,i,r,n=t.EXTENT){if(!(i>=0&&i<n&&r>=0&&r<n))return 0;let o=0;const a=this.getTerrainData(e);if(a.tile&&a.tile.dem){const e=function(t,e,i){var r=e[0],n=e[1];return t[0]=i[0]*r+i[4]*n+i[12],t[1]=i[1]*r+i[5]*n+i[13],t}([],[i/n*t.EXTENT,r/n*t.EXTENT],a.u_terrain_matrix),s=[e[0]*a.tile.dem.dim,e[1]*a.tile.dem.dim],l=[Math.floor(s[0]),Math.floor(s[1])],c=a.tile.dem.get(l[0],l[1]),h=a.tile.dem.get(l[0],l[1]+1),u=a.tile.dem.get(l[0]+1,l[1]),p=a.tile.dem.get(l[0]+1,l[1]+1);o=t.interpolate.number(t.interpolate.number(c,h,s[0]-l[0]),t.interpolate.number(u,p,s[0]-l[0]),s[1]-l[1])}return o}getElevation(e,i,r,n=t.EXTENT){return this.getDEMElevation(e,i,r,n)*this.exaggeration}getTerrainData(e){if(!this._emptyDemTexture){const e=this.painter.context,i=new t.RGBAImage({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new v(e,i,e.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new v(e,new t.RGBAImage({width:1,height:1}),e.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=t.identity([])}const i=this.sourceCache.getSourceTile(e,!0);if(i&&i.dem&&(!i.demTexture||i.needsTerrainPrepare)){const t=this.painter.context;i.demTexture=this.painter.getTileTexture(i.dem.stride),i.demTexture?i.demTexture.update(i.dem.getPixels(),{premultiply:!1}):i.demTexture=new v(t,i.dem.getPixels(),t.gl.RGBA,{premultiply:!1}),i.demTexture.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),i.needsTerrainPrepare=!1}const r=i&&i+i.tileID.key+e.key;if(r&&!this._demMatrixCache[r]){const r=this.sourceCache.sourceCache._source.maxzoom;let n=e.canonical.z-i.tileID.canonical.z;e.overscaledZ>e.canonical.z&&(e.canonical.z>=r?n=e.canonical.z-r:t.warnOnce("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const o=e.canonical.x-(e.canonical.x>>n<<n),a=e.canonical.y-(e.canonical.y>>n<<n),s=t.fromScaling(new Float64Array(16),[1/(t.EXTENT<<n),1/(t.EXTENT<<n),0]);t.translate(s,s,[o*t.EXTENT,a*t.EXTENT,0]),this._demMatrixCache[e.key]={matrix:s,coord:e}}return{u_depth:2,u_terrain:3,u_terrain_dim:i&&i.dem&&i.dem.dim||1,u_terrain_matrix:r?this._demMatrixCache[e.key].matrix:this._emptyDemMatrix,u_terrain_unpack:i&&i.dem&&i.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(i&&i.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:i}}getFramebuffer(t){const e=this.painter,i=e.width/devicePixelRatio,r=e.height/devicePixelRatio;return!this._fbo||this._fbo.width===i&&this._fbo.height===r||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new v(e.context,{width:i,height:r,data:null},e.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(e.context.gl.NEAREST,e.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new v(e.context,{width:i,height:r,data:null},e.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(e.context.gl.NEAREST,e.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=e.context.createFramebuffer(i,r,!0,!1),this._fbo.depthAttachment.set(e.context.createRenderbuffer(e.context.gl.DEPTH_COMPONENT16,i,r))),this._fbo.colorAttachment.set("coords"===t?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){const e=this.painter.context;if(this._coordsTexture)return this._coordsTexture;const i=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let t=0,e=0;t<this._coordsTextureSize;t++)for(let r=0;r<this._coordsTextureSize;r++,e+=4)i[e+0]=255&r,i[e+1]=255&t,i[e+2]=r>>8<<4|t>>8,i[e+3]=0;const r=new t.RGBAImage({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(i.buffer)),n=new v(e,r,e.gl.RGBA,{premultiply:!1});return n.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),this._coordsTexture=n,n}pointCoordinate(e){const i=new Uint8Array(4),r=this.painter.context,n=r.gl;r.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),n.readPixels(e.x,this.painter.height/devicePixelRatio-e.y-1,1,1,n.RGBA,n.UNSIGNED_BYTE,i),r.bindFramebuffer.set(null);const o=i[0]+(i[2]>>4<<8),a=i[1]+((15&i[2])<<8),s=this.coordsIndex[255-i[3]],l=s&&this.sourceCache.getTileByID(s);if(!l)return null;const c=this._coordsTextureSize,h=(1<<l.tileID.canonical.z)*c;return new t.MercatorCoordinate((l.tileID.canonical.x*c+o)/h,(l.tileID.canonical.y*c+a)/h,this.getElevation(l.tileID,o,a,c))}getTerrainMesh(){if(this._mesh)return this._mesh;const e=this.painter.context,i=new t.Pos3dArray,r=new t.TriangleIndexArray,n=this.meshSize,o=t.EXTENT/n,a=n*n;for(let t=0;t<=n;t++)for(let e=0;e<=n;e++)i.emplaceBack(e*o,t*o,0);for(let t=0;t<a;t+=n+1)for(let e=0;e<n;e++)r.emplaceBack(e+t,n+e+t+1,n+e+t+2),r.emplaceBack(e+t,n+e+t+2,e+t+1);const s=i.length,l=s+2*(n+1);for(const e of[0,1])for(let r=0;r<=n;r++)for(const n of[0,1])i.emplaceBack(r*o,e*t.EXTENT,n);for(let t=0;t<2*n;t+=2)r.emplaceBack(l+t,l+t+1,l+t+3),r.emplaceBack(l+t,l+t+3,l+t+2),r.emplaceBack(s+t,s+t+3,s+t+1),r.emplaceBack(s+t,s+t+2,s+t+3);const c=i.length,h=c+2*(n+1);for(const e of[0,1])for(let r=0;r<=n;r++)for(const n of[0,1])i.emplaceBack(e*t.EXTENT,r*o,n);for(let t=0;t<2*n;t+=2)r.emplaceBack(c+t,c+t+1,c+t+3),r.emplaceBack(c+t,c+t+3,c+t+2),r.emplaceBack(h+t,h+t+3,h+t+1),r.emplaceBack(h+t,h+t+2,h+t+3);return this._mesh={indexBuffer:e.createIndexBuffer(r),vertexBuffer:e.createVertexBuffer(i,pn.members),segments:t.SegmentVector.simpleSegment(0,0,i.length,r.length)},this._mesh}getMeshFrameDelta(e){return 2*Math.PI*t.earthRadius/Math.pow(2,e)/5}getMinMaxElevation(t){const e=this.getTerrainData(t).tile,i={minElevation:null,maxElevation:null};return e&&e.dem&&(i.minElevation=e.dem.min*this.exaggeration,i.maxElevation=e.dem.max*this.exaggeration),i}}class fn{constructor(t,e,i){this._context=t,this._size=e,this._tileSize=i,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(const t of this._objects)t.texture.destroy(),t.fbo.destroy()}_createObject(t){const e=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),i=new v(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return i.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),e.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),e.colorAttachment.set(i.texture),{id:t,fbo:e,texture:i,stamp:-1,inUse:!1}}getObjectForId(t){return this._objects[t]}useObject(t){t.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter((e=>t.id!==e)),this._recentlyUsed.push(t.id)}stampObject(t){t.stamp=++this._stamp}getOrCreateFreeObject(){for(const t of this._recentlyUsed)if(!this._objects[t].inUse)return this._objects[t];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const t=this._createObject(this._objects.length);return this._objects.push(t),t}freeObject(t){t.inUse=!1}freeAllObjects(){for(const t of this._objects)this.freeObject(t)}isFull(){return!(this._objects.length<this._size)&&!1===this._objects.some((t=>!t.inUse))}}const gn={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class _n{constructor(t,e){this.painter=t,this.terrain=e,this.pool=new fn(t.context,30,e.sourceCache.tileSize*e.qualityFactor)}destruct(){this.pool.destruct()}getTexture(t){return this.pool.getObjectForId(t.rtt[this._stacks.length-1].id).texture}prepareForRender(t,e){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=t._order.filter((i=>!t._layers[i].isHidden(e))),this._coordsDescendingInv={};for(const e in t.sourceCaches){this._coordsDescendingInv[e]={};const i=t.sourceCaches[e].getVisibleCoordinates();for(const t of i){const i=this.terrain.sourceCache.getTerrainCoords(t);for(const t in i)this._coordsDescendingInv[e][t]||(this._coordsDescendingInv[e][t]=[]),this._coordsDescendingInv[e][t].push(i[t])}}this._coordsDescendingInvStr={};for(const e of t._order){const i=t._layers[e],r=i.source;if(gn[i.type]&&!this._coordsDescendingInvStr[r]){this._coordsDescendingInvStr[r]={};for(const t in this._coordsDescendingInv[r])this._coordsDescendingInvStr[r][t]=this._coordsDescendingInv[r][t].map((t=>t.key)).sort().join()}}for(const t of this._renderableTiles)for(const e in this._coordsDescendingInvStr){const i=this._coordsDescendingInvStr[e][t.tileID.key];i&&i!==t.rttCoords[e]&&(t.rtt=[])}}renderLayer(e){if(e.isHidden(this.painter.transform.zoom))return!1;const i=e.type,r=this.painter,n=this._renderableLayerIds[this._renderableLayerIds.length-1]===e.id;if(gn[i]&&(this._prevType&&gn[this._prevType]||this._stacks.push([]),this._prevType=i,this._stacks[this._stacks.length-1].push(e.id),!n))return!0;if(gn[this._prevType]||gn[i]&&n){this._prevType=i;const e=this._stacks.length-1,n=this._stacks[e]||[];for(const i of this._renderableTiles){if(this.pool.isFull()&&(er(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(i),i.rtt[e]){const t=this.pool.getObjectForId(i.rtt[e].id);if(t.stamp===i.rtt[e].stamp){this.pool.useObject(t);continue}}const o=this.pool.getOrCreateFreeObject();this.pool.useObject(o),this.pool.stampObject(o),i.rtt[e]={id:o.id,stamp:o.stamp},r.context.bindFramebuffer.set(o.fbo.framebuffer),r.context.clear({color:t.Color.transparent,stencil:0}),r.currentStencilSource=void 0;for(let t=0;t<n.length;t++){const e=r.style._layers[n[t]],a=e.source?this._coordsDescendingInv[e.source][i.tileID.key]:[i.tileID];r.context.viewport.set([0,0,o.fbo.width,o.fbo.height]),r._renderTileClippingMasks(e,a),r.renderLayer(r,r.style.sourceCaches[e.source],e,a),e.source&&(i.rttCoords[e.source]=this._coordsDescendingInvStr[e.source][i.tileID.key])}}return er(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects(),gn[i]}return!1}}const yn=e,xn={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,cooperativeGestures:void 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,transformCameraUpdate:null,fadeDuration:300,crossSourceCollisions:!0,validateStyle:!0},vn=t=>{t.touchstart=t.dragStart,t.touchmoveWindow=t.dragMove,t.touchend=t.dragEnd},bn={showCompass:!0,showZoom:!0,visualizePitch:!1};class wn{constructor(e,r,n=!1){this._clickTolerance=10;const o=e.dragRotate._mouseRotate.getClickTolerance(),a=e.dragRotate._mousePitch.getClickTolerance();this.element=r,this.mouseRotate=Lr({clickTolerance:o,enable:!0}),this.touchRotate=(({enable:t,clickTolerance:e,bearingDegreesPerPixelMoved:i=.8})=>{const r=new zr;return new Ar({clickTolerance:e,move:(t,e)=>({bearingDelta:(e.x-t.x)*i}),moveStateManager:r,enable:t,assignEvents:vn})})({clickTolerance:o,enable:!0}),this.map=e,n&&(this.mousePitch=Dr({clickTolerance:a,enable:!0}),this.touchPitch=(({enable:t,clickTolerance:e,pitchDegreesPerPixelMoved:i=-.5})=>{const r=new zr;return new Ar({clickTolerance:e,move:(t,e)=>({pitchDelta:(e.y-t.y)*i}),moveStateManager:r,enable:t,assignEvents:vn})})({clickTolerance:a,enable:!0})),t.bindAll(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),i.addEventListener(r,"mousedown",this.mousedown),i.addEventListener(r,"touchstart",this.touchstart,{passive:!1}),i.addEventListener(r,"touchcancel",this.reset)}startMouse(t,e){this.mouseRotate.dragStart(t,e),this.mousePitch&&this.mousePitch.dragStart(t,e),i.disableDrag()}startTouch(t,e){this.touchRotate.dragStart(t,e),this.touchPitch&&this.touchPitch.dragStart(t,e),i.disableDrag()}moveMouse(t,e){const i=this.map,{bearingDelta:r}=this.mouseRotate.dragMove(t,e)||{};if(r&&i.setBearing(i.getBearing()+r),this.mousePitch){const{pitchDelta:r}=this.mousePitch.dragMove(t,e)||{};r&&i.setPitch(i.getPitch()+r)}}moveTouch(t,e){const i=this.map,{bearingDelta:r}=this.touchRotate.dragMove(t,e)||{};if(r&&i.setBearing(i.getBearing()+r),this.touchPitch){const{pitchDelta:r}=this.touchPitch.dragMove(t,e)||{};r&&i.setPitch(i.getPitch()+r)}}off(){const t=this.element;i.removeEventListener(t,"mousedown",this.mousedown),i.removeEventListener(t,"touchstart",this.touchstart,{passive:!1}),i.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),i.removeEventListener(window,"touchend",this.touchend),i.removeEventListener(t,"touchcancel",this.reset),this.offTemp()}offTemp(){i.enableDrag(),i.removeEventListener(window,"mousemove",this.mousemove),i.removeEventListener(window,"mouseup",this.mouseup),i.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),i.removeEventListener(window,"touchend",this.touchend)}mousedown(e){this.startMouse(t.extend({},e,{ctrlKey:!0,preventDefault:()=>e.preventDefault()}),i.mousePos(this.element,e)),i.addEventListener(window,"mousemove",this.mousemove),i.addEventListener(window,"mouseup",this.mouseup)}mousemove(t){this.moveMouse(t,i.mousePos(this.element,t))}mouseup(t){this.mouseRotate.dragEnd(t),this.mousePitch&&this.mousePitch.dragEnd(t),this.offTemp()}touchstart(t){1!==t.targetTouches.length?this.reset():(this._startPos=this._lastPos=i.touchPos(this.element,t.targetTouches)[0],this.startTouch(t,this._startPos),i.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),i.addEventListener(window,"touchend",this.touchend))}touchmove(t){1!==t.targetTouches.length?this.reset():(this._lastPos=i.touchPos(this.element,t.targetTouches)[0],this.moveTouch(t,this._lastPos))}touchend(t){0===t.targetTouches.length&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),delete this._startPos,delete this._lastPos,this.offTemp()}reset(){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),this.touchRotate.reset(),this.touchPitch&&this.touchPitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()}}let En;function Tn(e,i,r){if(e=new t.LngLat(e.lng,e.lat),i){const n=new t.LngLat(e.lng-360,e.lat),o=new t.LngLat(e.lng+360,e.lat),a=r.locationPoint(e).distSqr(i);r.locationPoint(n).distSqr(i)<a?e=n:r.locationPoint(o).distSqr(i)<a&&(e=o)}for(;Math.abs(e.lng-r.center.lng)>180;){const t=r.locationPoint(e);if(t.x>=0&&t.y>=0&&t.x<=r.width&&t.y<=r.height)break;e.lng>r.center.lng?e.lng-=360:e.lng+=360}return e}const Sn={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 Cn(t,e,i){const r=t.classList;for(const t in Sn)r.remove(`maplibregl-${i}-anchor-${t}`);r.add(`maplibregl-${i}-anchor-${e}`)}class In extends t.Evented{constructor(e,r){if(super(),(e instanceof HTMLElement||r)&&(e=t.extend({element:e},r)),t.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&&"auto"!==e.pitchAlignment?e.pitchAlignment:this._rotationAlignment,e&&e.element)this._element=e.element,this._offset=t.Point.convert(e&&e.offset||[0,0]);else{this._defaultMarker=!0,this._element=i.create("div"),this._element.setAttribute("aria-label","Map marker");const r=i.createNS("http://www.w3.org/2000/svg","svg"),n=41,o=27;r.setAttributeNS(null,"display","block"),r.setAttributeNS(null,"height",`${n}px`),r.setAttributeNS(null,"width",`${o}px`),r.setAttributeNS(null,"viewBox",`0 0 ${o} ${n}`);const a=i.createNS("http://www.w3.org/2000/svg","g");a.setAttributeNS(null,"stroke","none"),a.setAttributeNS(null,"stroke-width","1"),a.setAttributeNS(null,"fill","none"),a.setAttributeNS(null,"fill-rule","evenodd");const s=i.createNS("http://www.w3.org/2000/svg","g");s.setAttributeNS(null,"fill-rule","nonzero");const l=i.createNS("http://www.w3.org/2000/svg","g");l.setAttributeNS(null,"transform","translate(3.0, 29.0)"),l.setAttributeNS(null,"fill","#000000");const 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(const t of c){const e=i.createNS("http://www.w3.org/2000/svg","ellipse");e.setAttributeNS(null,"opacity","0.04"),e.setAttributeNS(null,"cx","10.5"),e.setAttributeNS(null,"cy","5.80029008"),e.setAttributeNS(null,"rx",t.rx),e.setAttributeNS(null,"ry",t.ry),l.appendChild(e)}const h=i.createNS("http://www.w3.org/2000/svg","g");h.setAttributeNS(null,"fill",this._color);const u=i.createNS("http://www.w3.org/2000/svg","path");u.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"),h.appendChild(u);const p=i.createNS("http://www.w3.org/2000/svg","g");p.setAttributeNS(null,"opacity","0.25"),p.setAttributeNS(null,"fill","#000000");const d=i.createNS("http://www.w3.org/2000/svg","path");d.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"),p.appendChild(d);const m=i.createNS("http://www.w3.org/2000/svg","g");m.setAttributeNS(null,"transform","translate(6.0, 7.0)"),m.setAttributeNS(null,"fill","#FFFFFF");const f=i.createNS("http://www.w3.org/2000/svg","g");f.setAttributeNS(null,"transform","translate(8.0, 8.0)");const g=i.createNS("http://www.w3.org/2000/svg","circle");g.setAttributeNS(null,"fill","#000000"),g.setAttributeNS(null,"opacity","0.25"),g.setAttributeNS(null,"cx","5.5"),g.setAttributeNS(null,"cy","5.5"),g.setAttributeNS(null,"r","5.4999962");const _=i.createNS("http://www.w3.org/2000/svg","circle");_.setAttributeNS(null,"fill","#FFFFFF"),_.setAttributeNS(null,"cx","5.5"),_.setAttributeNS(null,"cy","5.5"),_.setAttributeNS(null,"r","5.4999962"),f.appendChild(g),f.appendChild(_),s.appendChild(l),s.appendChild(h),s.appendChild(p),s.appendChild(m),s.appendChild(f),r.appendChild(s),r.setAttributeNS(null,"height",n*this._scale+"px"),r.setAttributeNS(null,"width",o*this._scale+"px"),this._element.appendChild(r),this._offset=t.Point.convert(e&&e.offset||[0,-14])}this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",(t=>{t.preventDefault()})),this._element.addEventListener("mousedown",(t=>{t.preventDefault()})),Cn(this._element,this._anchor,"marker"),this._popup=null}addTo(t){return this.remove(),this._map=t,t.getCanvasContainer().appendChild(this._element),t.on("move",this._update),t.on("moveend",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("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),i.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=t.LngLat.convert(e),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(t){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),t){if(!("offset"in t.options)){const e=38.1,i=13.5,r=Math.sqrt(Math.pow(i,2)/2);t.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-e],"bottom-left":[r,-1*(e-i+r)],"bottom-right":[-r,-1*(e-i+r)],left:[i,-1*(e-i)],right:[-i,-1*(e-i)]}:this._offset}this._popup=t,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(t){const e=t.code,i=t.charCode||t.keyCode;"Space"!==e&&"Enter"!==e&&32!==i&&13!==i||this.togglePopup()}_onMapClick(t){const e=t.originalEvent.target,i=this._element;this._popup&&(e===i||i.contains(e))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){const t=this._popup;return t?(t.isOpen()?t.remove():t.addTo(this._map),this):this}_update(t){if(!this._map)return;this._map.transform.renderWorldCopies&&(this._lngLat=Tn(this._lngLat,this._pos,this._map.transform)),this._pos=this._map.project(this._lngLat)._add(this._offset);let e="";"viewport"===this._rotationAlignment||"auto"===this._rotationAlignment?e=`rotateZ(${this._rotation}deg)`:"map"===this._rotationAlignment&&(e=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let r="";"viewport"===this._pitchAlignment||"auto"===this._pitchAlignment?r="rotateX(0deg)":"map"===this._pitchAlignment&&(r=`rotateX(${this._map.getPitch()}deg)`),t&&"moveend"!==t.type||(this._pos=this._pos.round()),i.setTransform(this._element,`${Sn[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${r} ${e}`),this._map.terrain&&!this._opacityTimeout&&(this._opacityTimeout=setTimeout((()=>{const t=this._map.unproject(this._pos),e=40075016.686*Math.abs(Math.cos(this._lngLat.lat*Math.PI/180))/Math.pow(2,this._map.transform.tileZoom+8);this._element.style.opacity=t.distanceTo(this._lngLat)>20*e?"0.2":"1.0",this._opacityTimeout=null}),100))}getOffset(){return this._offset}setOffset(e){return this._offset=t.Point.convert(e),this._update(),this}_onMove(e){if(!this._isDragging){const t=this._clickTolerance||this._map._clickTolerance;this._isDragging=e.point.dist(this._pointerdownPos)>=t}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","pending"===this._state&&(this._state="active",this.fire(new t.Event("dragstart"))),this.fire(new t.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),"active"===this._state&&this.fire(new t.Event("dragend")),this._state="inactive"}_addDragHandler(t){this._element.contains(t.originalEvent.target)&&(t.preventDefault(),this._positionDelta=t.point.sub(this._pos).add(this._offset),this._pointerdownPos=t.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(t){return this._draggable=!!t,this._map&&(t?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(t){return this._rotation=t||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(t){return this._rotationAlignment=t||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(t){return this._pitchAlignment=t&&"auto"!==t?t:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}}const An={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let Mn=0,kn=!1;const zn={maxWidth:100,unit:"metric"};function Pn(t,e,i){const r=i&&i.maxWidth||100,n=t._container.clientHeight/2,o=t.unproject([0,n]),a=t.unproject([r,n]),s=o.distanceTo(a);if(i&&"imperial"===i.unit){const i=3.2808*s;i>5280?Ln(e,r,i/5280,t._getUIString("ScaleControl.Miles")):Ln(e,r,i,t._getUIString("ScaleControl.Feet"))}else i&&"nautical"===i.unit?Ln(e,r,s/1852,t._getUIString("ScaleControl.NauticalMiles")):s>=1e3?Ln(e,r,s/1e3,t._getUIString("ScaleControl.Kilometers")):Ln(e,r,s,t._getUIString("ScaleControl.Meters"))}function Ln(t,e,i,r){const n=function(t){const e=Math.pow(10,`${Math.floor(t)}`.length-1);let i=t/e;return i=i>=10?10:i>=5?5:i>=3?3:i>=2?2:i>=1?1:function(t){const e=Math.pow(10,Math.ceil(-Math.log(t)/Math.LN10));return Math.round(t*e)/e}(i),e*i}(i);t.style.width=e*(n/i)+"px",t.innerHTML=`${n}&nbsp;${r}`}const Dn={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},Rn=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Bn(e){if(e){if("number"==typeof e){const i=Math.round(Math.sqrt(.5*Math.pow(e,2)));return{center:new t.Point(0,0),top:new t.Point(0,e),"top-left":new t.Point(i,i),"top-right":new t.Point(-i,i),bottom:new t.Point(0,-e),"bottom-left":new t.Point(i,-i),"bottom-right":new t.Point(-i,-i),left:new t.Point(e,0),right:new t.Point(-e,0)}}if(e instanceof t.Point||Array.isArray(e)){const i=t.Point.convert(e);return{center:i,top:i,"top-left":i,"top-right":i,bottom:i,"bottom-left":i,"bottom-right":i,left:i,right:i}}return{center:t.Point.convert(e.center||[0,0]),top:t.Point.convert(e.top||[0,0]),"top-left":t.Point.convert(e["top-left"]||[0,0]),"top-right":t.Point.convert(e["top-right"]||[0,0]),bottom:t.Point.convert(e.bottom||[0,0]),"bottom-left":t.Point.convert(e["bottom-left"]||[0,0]),"bottom-right":t.Point.convert(e["bottom-right"]||[0,0]),left:t.Point.convert(e.left||[0,0]),right:t.Point.convert(e.right||[0,0])}}return Bn(new t.Point(0,0))}const Fn=e,On={setRTLTextPlugin:t.setRTLTextPlugin,getRTLTextPluginStatus:t.getRTLTextPluginStatus,Map:class extends sn{constructor(e){var i;if(t.PerformanceUtils.mark(t.PerformanceMarkers.create),null!=(e=t.extend({},xn,e)).minZoom&&null!=e.maxZoom&&e.minZoom>e.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(null!=e.minPitch&&null!=e.maxPitch&&e.minPitch>e.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(null!=e.minPitch&&e.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(null!=e.maxPitch&&e.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new sr(e.minZoom,e.maxZoom,e.minPitch,e.maxPitch,e.renderWorldCopies),{bearingSnap:e.bearingSnap}),this._interactive=e.interactive,this._cooperativeGestures=e.cooperativeGestures,this._metaKey=0===navigator.platform.indexOf("Mac")?"metaKey":"ctrlKey",this._maxTileCacheSize=e.maxTileCacheSize,this._failIfMajorPerformanceCaveat=e.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=e.preserveDrawingBuffer,this._antialias=e.antialias,this._trackResize=e.trackResize,this._bearingSnap=e.bearingSnap,this._refreshExpiredTiles=e.refreshExpiredTiles,this._fadeDuration=e.fadeDuration,this._crossSourceCollisions=e.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=e.collectResourceTiming,this._renderTaskQueue=new hn,this._controls=[],this._mapId=t.uniqueId(),this._locale=t.extend({},un,e.locale),this._clickTolerance=e.clickTolerance,this._pixelRatio=null!==(i=e.pixelRatio)&&void 0!==i?i:devicePixelRatio,this.transformCameraUpdate=e.transformCameraUpdate,this._imageQueueHandle=u.addThrottleControl((()=>this.isMoving())),this._requestManager=new p(e.transformRequest),"string"==typeof e.container){if(this._container=document.getElementById(e.container),!this._container)throw new Error(`Container '${e.container}' not found.`)}else{if(!(e.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=e.container}if(e.maxBounds&&this.setMaxBounds(e.maxBounds),t.bindAll(["_onWindowOnline","_onMapScroll","_cooperativeGesturesOnWheel","_contextLost","_contextRestored"],this),this._setupContainer(),this._setupPainter(),this.on("move",(()=>this._update(!1))),this.on("moveend",(()=>this._update(!1))),this.on("zoom",(()=>this._update(!0))),this.on("terrain",(()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)})),this.once("idle",(()=>{this._idleTriggered=!0})),"undefined"!=typeof window){addEventListener("online",this._onWindowOnline,!1);let t=!1;this._resizeObserver=new ResizeObserver((e=>{t?this._trackResize&&this.resize(e)._update():t=!0})),this._resizeObserver.observe(this._container)}this.handlers=new on(this,e),this._cooperativeGestures&&this._setupCooperativeGestures(),this._hash=e.hash&&new lr("string"==typeof e.hash&&e.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:e.center,zoom:e.zoom,bearing:e.bearing,pitch:e.pitch}),e.bounds&&(this.resize(),this.fitBounds(e.bounds,t.extend({},e.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=e.localIdeographFontFamily,this._validateStyle=e.validateStyle,e.style&&this.setStyle(e.style,{localIdeographFontFamily:e.localIdeographFontFamily}),e.attributionControl&&this.addControl(new ln({customAttribution:e.customAttribution})),e.maplibreLogo&&this.addControl(new cn,e.logoPosition),this.on("style.load",(()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)})),this.on("data",(e=>{this._update("style"===e.dataType),this.fire(new t.Event(`${e.dataType}data`,e))})),this.on("dataloading",(e=>{this.fire(new t.Event(`${e.dataType}dataloading`,e))})),this.on("dataabort",(e=>{this.fire(new t.Event("sourcedataabort",e))}))}_getMapId(){return this._mapId}addControl(e,i){if(void 0===i&&(i=e.getDefaultPosition?e.getDefaultPosition():"top-right"),!e||!e.onAdd)return this.fire(new t.ErrorEvent(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const r=e.onAdd(this);this._controls.push(e);const n=this._controlPositions[i];return-1!==i.indexOf("bottom")?n.insertBefore(r,n.firstChild):n.appendChild(r),this}removeControl(e){if(!e||!e.onRemove)return this.fire(new t.ErrorEvent(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const i=this._controls.indexOf(e);return i>-1&&this._controls.splice(i,1),e.onRemove(this),this}hasControl(t){return this._controls.indexOf(t)>-1}calculateCameraOptionsFromTo(t,e,i,r){return null==r&&this.terrain&&(r=this.transform.getElevation(i,this.terrain)),super.calculateCameraOptionsFromTo(t,e,i,r)}resize(e){var i;const r=this._containerDimensions(),n=r[0],o=r[1];this._resizeCanvas(n,o,this.getPixelRatio()),this.transform.resize(n,o),null===(i=this._requestedCameraState)||void 0===i||i.resize(n,o),this.painter.resize(n,o,this.getPixelRatio());const a=!this._moving;return a&&(this.stop(),this.fire(new t.Event("movestart",e)).fire(new t.Event("move",e))),this.fire(new t.Event("resize",e)),a&&this.fire(new t.Event("moveend",e)),this}getPixelRatio(){return this._pixelRatio}setPixelRatio(t){const[e,i]=this._containerDimensions();this._pixelRatio=t,this._resizeCanvas(e,i,t),this.painter.resize(e,i,t)}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(t){return this.transform.setMaxBounds(R.convert(t)),this._update()}setMinZoom(t){if((t=null==t?-2:t)>=-2&&t<=this.transform.maxZoom)return this.transform.minZoom=t,this._update(),this.getZoom()<t&&this.setZoom(t),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(t){if((t=null==t?22:t)>=this.transform.minZoom)return this.transform.maxZoom=t,this._update(),this.getZoom()>t&&this.setZoom(t),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(t){if((t=null==t?0:t)<0)throw new Error("minPitch must be greater than or equal to 0");if(t>=0&&t<=this.transform.maxPitch)return this.transform.minPitch=t,this._update(),this.getPitch()<t&&this.setPitch(t),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(t){if((t=null==t?60:t)>85)throw new Error("maxPitch must be less than or equal to 85");if(t>=this.transform.minPitch)return this.transform.maxPitch=t,this._update(),this.getPitch()>t&&this.setPitch(t),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(t){return this.transform.renderWorldCopies=t,this._update()}getCooperativeGestures(){return this._cooperativeGestures}setCooperativeGestures(t){return this._cooperativeGestures=t,this._cooperativeGestures?this._setupCooperativeGestures():this._destroyCooperativeGestures(),this}project(e){return this.transform.locationPoint(t.LngLat.convert(e),this.style&&this.terrain)}unproject(e){return this.transform.pointLocation(t.Point.convert(e),this.terrain)}isMoving(){var t;return this._moving||(null===(t=this.handlers)||void 0===t?void 0:t.isMoving())}isZooming(){var t;return this._zooming||(null===(t=this.handlers)||void 0===t?void 0:t.isZooming())}isRotating(){var t;return this._rotating||(null===(t=this.handlers)||void 0===t?void 0:t.isRotating())}_createDelegatedListener(t,e,i){if("mouseenter"===t||"mouseover"===t){let r=!1;const n=n=>{const o=this.getLayer(e)?this.queryRenderedFeatures(n.point,{layers:[e]}):[];o.length?r||(r=!0,i.call(this,new _r(t,this,n.originalEvent,{features:o}))):r=!1};return{layer:e,listener:i,delegates:{mousemove:n,mouseout:()=>{r=!1}}}}if("mouseleave"===t||"mouseout"===t){let r=!1;const n=n=>{(this.getLayer(e)?this.queryRenderedFeatures(n.point,{layers:[e]}):[]).length?r=!0:r&&(r=!1,i.call(this,new _r(t,this,n.originalEvent)))},o=e=>{r&&(r=!1,i.call(this,new _r(t,this,e.originalEvent)))};return{layer:e,listener:i,delegates:{mousemove:n,mouseout:o}}}{const r=t=>{const r=this.getLayer(e)?this.queryRenderedFeatures(t.point,{layers:[e]}):[];r.length&&(t.features=r,i.call(this,t),delete t.features)};return{layer:e,listener:i,delegates:{[t]:r}}}}on(t,e,i){if(void 0===i)return super.on(t,e);const r=this._createDelegatedListener(t,e,i);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[t]=this._delegatedListeners[t]||[],this._delegatedListeners[t].push(r);for(const t in r.delegates)this.on(t,r.delegates[t]);return this}once(t,e,i){if(void 0===i)return super.once(t,e);const r=this._createDelegatedListener(t,e,i);for(const t in r.delegates)this.once(t,r.delegates[t]);return this}off(t,e,i){return void 0===i?super.off(t,e):(this._delegatedListeners&&this._delegatedListeners[t]&&(r=>{const n=this._delegatedListeners[t];for(let t=0;t<n.length;t++){const r=n[t];if(r.layer===e&&r.listener===i){for(const t in r.delegates)this.off(t,r.delegates[t]);return n.splice(t,1),this}}})(),this)}queryRenderedFeatures(e,i){if(!this.style)return[];let r;const n=e instanceof t.Point||Array.isArray(e),o=n?e:[[0,0],[this.transform.width,this.transform.height]];if(i=i||(n?{}:e)||{},o instanceof t.Point||"number"==typeof o[0])r=[t.Point.convert(o)];else{const e=t.Point.convert(o[0]),i=t.Point.convert(o[1]);r=[e,new t.Point(i.x,e.y),i,new t.Point(e.x,i.y),e]}return this.style.queryRenderedFeatures(r,i,this.transform)}querySourceFeatures(t,e){return this.style.querySourceFeatures(t,e)}setStyle(e,i){return!1!==(i=t.extend({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},i)).diff&&i.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&e?(this._diffStyle(e,i),this):(this._localIdeographFontFamily=i.localIdeographFontFamily,this._updateStyle(e,i))}setTransformRequest(t){return this._requestManager.setTransformRequest(t),this}_getUIString(t){const e=this._locale[t];if(null==e)throw new Error(`Missing UI string '${t}'`);return e}_updateStyle(t,e){if(e.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",(()=>this._updateStyle(t,e)));const i=this.style&&e.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!t)),t?(this.style=new oe(this,e||{}),this.style.setEventedParent(this,{style:this.style}),"string"==typeof t?this.style.loadURL(t,e,i):this.style.loadJSON(t,e,i),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new oe(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(e,i){if("string"==typeof e){const r=this._requestManager.transformRequest(e,h.Style);t.getJSON(r,((e,r)=>{e?this.fire(new t.ErrorEvent(e)):r&&this._updateDiff(r,i)}))}else"object"==typeof e&&this._updateDiff(e,i)}_updateDiff(e,i){try{this.style.setState(e,i)&&this._update(!0)}catch(r){t.warnOnce(`Unable to perform style diff: ${r.message||r.error||r}. Rebuilding the style from scratch.`),this._updateStyle(e,i)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():t.warnOnce("There is no style added to the map.")}addSource(t,e){return this._lazyInitEmptyStyle(),this.style.addSource(t,e),this._update(!0)}isSourceLoaded(e){const i=this.style&&this.style.sourceCaches[e];if(void 0!==i)return i.loaded();this.fire(new t.ErrorEvent(new Error(`There is no source with ID '${e}'`)))}setTerrain(e){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),e){const i=this.style.sourceCaches[e.source];if(!i)throw new Error(`cannot load terrain, because there exists no source with ID: ${e.source}`);for(const i in this.style._layers){const r=this.style._layers[i];"hillshade"===r.type&&r.source===e.source&&t.warnOnce("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain=new mn(this.painter,i,e),this.painter.renderToTexture=new _n(this.painter,this.terrain),this.transform.updateElevation(this.terrain),this._terrainDataCallback=t=>{"style"===t.dataType?this.terrain.sourceCache.freeRtt():"source"===t.dataType&&t.tile&&(t.sourceId===e.source&&this.transform.updateElevation(this.terrain),this.terrain.sourceCache.freeRtt(t.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform.updateElevation(this.terrain);return this.fire(new t.Event("terrain",{terrain:e})),this}getTerrain(){return this.terrain&&this.terrain.options}areTilesLoaded(){const t=this.style&&this.style.sourceCaches;for(const e in t){const i=t[e]._tiles;for(const t in i){const e=i[t];if("loaded"!==e.state&&"errored"!==e.state)return!1}}return!0}addSourceType(t,e,i){return this._lazyInitEmptyStyle(),this.style.addSourceType(t,e,i)}removeSource(t){return this.style.removeSource(t),this._update(!0)}getSource(t){return this.style.getSource(t)}addImage(e,i,{pixelRatio:r=1,sdf:n=!1,stretchX:o,stretchY:a,content:s}={}){if(this._lazyInitEmptyStyle(),i instanceof HTMLImageElement||t.isImageBitmap(i)){const{width:l,height:c,data:h}=t.exported.getImageData(i);this.style.addImage(e,{data:new t.RGBAImage({width:l,height:c},h),pixelRatio:r,stretchX:o,stretchY:a,content:s,sdf:n,version:0})}else{if(void 0===i.width||void 0===i.height)return this.fire(new t.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`")));{const{width:l,height:c,data:h}=i,u=i;this.style.addImage(e,{data:new t.RGBAImage({width:l,height:c},new Uint8Array(h)),pixelRatio:r,stretchX:o,stretchY:a,content:s,sdf:n,version:0,userImage:u}),u.onAdd&&u.onAdd(this,e)}}}updateImage(e,i){const r=this.style.getImage(e);if(!r)return this.fire(new t.ErrorEvent(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const n=i instanceof HTMLImageElement||t.isImageBitmap(i)?t.exported.getImageData(i):i,{width:o,height:a,data:s}=n;if(void 0===o||void 0===a)return this.fire(new t.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(o!==r.data.width||a!==r.data.height)return this.fire(new t.ErrorEvent(new Error("The width and height of the updated image must be that same as the previous version of the image")));const l=!(i instanceof HTMLImageElement||t.isImageBitmap(i));r.data.replace(s,l),this.style.updateImage(e,r)}getImage(t){return this.style.getImage(t)}hasImage(e){return e?!!this.style.getImage(e):(this.fire(new t.ErrorEvent(new Error("Missing required image id"))),!1)}removeImage(t){this.style.removeImage(t)}loadImage(t,e){u.getImage(this._requestManager.transformRequest(t,h.Image),e)}listImages(){return this.style.listImages()}addLayer(t,e){return this._lazyInitEmptyStyle(),this.style.addLayer(t,e),this._update(!0)}moveLayer(t,e){return this.style.moveLayer(t,e),this._update(!0)}removeLayer(t){return this.style.removeLayer(t),this._update(!0)}getLayer(t){return this.style.getLayer(t)}setLayerZoomRange(t,e,i){return this.style.setLayerZoomRange(t,e,i),this._update(!0)}setFilter(t,e,i={}){return this.style.setFilter(t,e,i),this._update(!0)}getFilter(t){return this.style.getFilter(t)}setPaintProperty(t,e,i,r={}){return this.style.setPaintProperty(t,e,i,r),this._update(!0)}getPaintProperty(t,e){return this.style.getPaintProperty(t,e)}setLayoutProperty(t,e,i,r={}){return this.style.setLayoutProperty(t,e,i,r),this._update(!0)}getLayoutProperty(t,e){return this.style.getLayoutProperty(t,e)}setGlyphs(t,e={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(t,e),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(t,e,i={}){return this._lazyInitEmptyStyle(),this.style.addSprite(t,e,i,(t=>{t||this._update(!0)})),this}removeSprite(t){return this._lazyInitEmptyStyle(),this.style.removeSprite(t),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(t,e={}){return this._lazyInitEmptyStyle(),this.style.setSprite(t,e,(t=>{t||this._update(!0)})),this}setLight(t,e={}){return this._lazyInitEmptyStyle(),this.style.setLight(t,e),this._update(!0)}getLight(){return this.style.getLight()}setFeatureState(t,e){return this.style.setFeatureState(t,e),this._update()}removeFeatureState(t,e){return this.style.removeFeatureState(t,e),this._update()}getFeatureState(t){return this.style.getFeatureState(t)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let t=0,e=0;return this._container&&(t=this._container.clientWidth||400,e=this._container.clientHeight||300),[t,e]}_setupContainer(){const t=this._container;t.classList.add("maplibregl-map");const e=this._canvasContainer=i.create("div","maplibregl-canvas-container",t);this._interactive&&e.classList.add("maplibregl-interactive"),this._canvas=i.create("canvas","maplibregl-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");const r=this._containerDimensions();this._resizeCanvas(r[0],r[1],this.getPixelRatio());const n=this._controlContainer=i.create("div","maplibregl-control-container",t),o=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach((t=>{o[t]=i.create("div",`maplibregl-ctrl-${t} `,n)})),this._container.addEventListener("scroll",this._onMapScroll,!1)}_cooperativeGesturesOnWheel(t){this._onCooperativeGesture(t,t[this._metaKey],1)}_setupCooperativeGestures(){this._cooperativeGesturesScreen=i.create("div","maplibregl-cooperative-gesture-screen",this._container);let t="boolean"!=typeof this._cooperativeGestures&&this._cooperativeGestures.windowsHelpText?this._cooperativeGestures.windowsHelpText:"Use Ctrl + scroll to zoom the map";0===navigator.platform.indexOf("Mac")&&(t="boolean"!=typeof this._cooperativeGestures&&this._cooperativeGestures.macHelpText?this._cooperativeGestures.macHelpText:"Use ⌘ + scroll to zoom the map"),this._cooperativeGesturesScreen.innerHTML=`\n <div class="maplibregl-desktop-message">${t}</div>\n <div class="maplibregl-mobile-message">${"boolean"!=typeof this._cooperativeGestures&&this._cooperativeGestures.mobileHelpText?this._cooperativeGestures.mobileHelpText:"Use two fingers to move the map"}</div>\n `,this._canvasContainer.addEventListener("wheel",this._cooperativeGesturesOnWheel,!1),this._canvasContainer.classList.add("maplibregl-cooperative-gestures")}_destroyCooperativeGestures(){i.remove(this._cooperativeGesturesScreen),this._canvasContainer.removeEventListener("wheel",this._cooperativeGesturesOnWheel,!1),this._canvasContainer.classList.remove("maplibregl-cooperative-gestures")}_resizeCanvas(t,e,i){this._canvas.width=i*t,this._canvas.height=i*e,this._canvas.style.width=`${t}px`,this._canvas.style.height=`${e}px`}_setupPainter(){const t={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1};let e=null;this._canvas.addEventListener("webglcontextcreationerror",(i=>{e={requestedAttributes:t},i&&(e.statusMessage=i.statusMessage,e.type=i.type)}),{once:!0});const i=this._canvas.getContext("webgl2",t);if(!i){const t="Failed to initialize WebGL";throw e?(e.message=t,new Error(JSON.stringify(e))):new Error(t)}this.painter=new rr(i,this.transform),r.testSupport(i)}_contextLost(e){e.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new t.Event("webglcontextlost",{originalEvent:e}))}_contextRestored(e){this._setupPainter(),this.resize(),this._update(),this.fire(new t.Event("webglcontextrestored",{originalEvent:e}))}_onMapScroll(t){if(t.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}_onCooperativeGesture(t,e,i){return!e&&i<2&&(this._cooperativeGesturesScreen.classList.add("maplibregl-show"),setTimeout((()=>{this._cooperativeGesturesScreen.classList.remove("maplibregl-show")}),100)),!1}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(t){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||t,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(t){return this._update(),this._renderTaskQueue.add(t)}_cancelRenderFrame(t){this._renderTaskQueue.remove(t)}_render(e){const i=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(e),this._removed)return;let r=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const e=this.transform.zoom,n=t.exported.now();this.style.zoomHistory.update(e,n);const o=new t.EvaluationParameters(e,{now:n,fadeDuration:i,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),a=o.crossFadingFactor();1===a&&a===this._crossFadingFactor||(r=!0,this._crossFadingFactor=a),this.style.update(o)}this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain&&this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.updateElevation(this.terrain),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,i,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:i,showPadding:this.showPadding}),this.fire(new t.Event("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,t.PerformanceUtils.mark(t.PerformanceMarkers.load),this.fire(new t.Event("load"))),this.style&&(this.style.hasTransitions()||r)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const n=this._sourcesDirty||this._styleDirty||this._placementDirty;return n||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new t.Event("idle")),!this._loaded||this._fullyLoaded||n||(this._fullyLoaded=!0,t.PerformanceUtils.mark(t.PerformanceMarkers.fullLoad)),this}redraw(){return this.style&&(this._frame&&(this._frame.cancel(),this._frame=null),this._render(0)),this}remove(){var e;this._hash&&this._hash.remove();for(const t of this._controls)t.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),"undefined"!=typeof window&&removeEventListener("online",this._onWindowOnline,!1),u.removeThrottleControl(this._imageQueueHandle),null===(e=this._resizeObserver)||void 0===e||e.disconnect();const r=this.painter.context.gl.getExtension("WEBGL_lose_context");r&&r.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),i.remove(this._canvasContainer),i.remove(this._controlContainer),this._cooperativeGestures&&this._destroyCooperativeGestures(),this._container.classList.remove("maplibregl-map"),t.PerformanceUtils.clearMetrics(),this._removed=!0,this.fire(new t.Event("remove"))}triggerRepaint(){this.style&&!this._frame&&(this._frame=t.exported.frame((e=>{t.PerformanceUtils.frame(e),this._frame=null,this._render(e)})))}_onWindowOnline(){this._update()}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(t){this._showTileBoundaries!==t&&(this._showTileBoundaries=t,this._update())}get showPadding(){return!!this._showPadding}set showPadding(t){this._showPadding!==t&&(this._showPadding=t,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(t){this._showCollisionBoxes!==t&&(this._showCollisionBoxes=t,t?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(t){this._showOverdrawInspector!==t&&(this._showOverdrawInspector=t,this._update())}get repaint(){return!!this._repaint}set repaint(t){this._repaint!==t&&(this._repaint=t,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(t){this._vertices=t,this._update()}get version(){return yn}getCameraTargetElevation(){return this.transform.elevation}},NavigationControl:class{constructor(e){this.options=t.extend({},bn,e),this._container=i.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",(t=>t.preventDefault())),this.options.showZoom&&(t.bindAll(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",(t=>this._map.zoomIn({},{originalEvent:t}))),i.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",(t=>this._map.zoomOut({},{originalEvent:t}))),i.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(t.bindAll(["_rotateCompassArrow"],this),this._compass=this._createButton("maplibregl-ctrl-compass",(t=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:t}):this._map.resetNorth({},{originalEvent:t})})),this._compassIcon=i.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){const t=this._map.getZoom(),e=t===this._map.getMaxZoom(),i=t===this._map.getMinZoom();this._zoomInButton.disabled=e,this._zoomOutButton.disabled=i,this._zoomInButton.setAttribute("aria-disabled",e.toString()),this._zoomOutButton.setAttribute("aria-disabled",i.toString())}_rotateCompassArrow(){const t=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=t}onAdd(t){return this._map=t,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 wn(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){i.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(t,e){const r=i.create("button",t,this._container);return r.type="button",r.addEventListener("click",e),r}_setButtonTitle(t,e){const i=this._map._getUIString(`NavigationControl.${e}`);t.title=i,t.setAttribute("aria-label",i)}},GeolocateControl:class extends t.Evented{constructor(e){super(),this.options=t.extend({},An,e),t.bindAll(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker"],this)}onAdd(t){return this._map=t,this._container=i.create("div","maplibregl-ctrl maplibregl-ctrl-group"),function(t,e=!1){void 0===En||e?void 0!==window.navigator.permissions?window.navigator.permissions.query({name:"geolocation"}).then((e=>{En="denied"!==e.state,t(En)})).catch((()=>{En=!!window.navigator.geolocation,t(En)})):(En=!!window.navigator.geolocation,t(En)):t(En)}(this._setupUI),this._container}onRemove(){void 0!==this._geolocationWatchID&&(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(),i.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,Mn=0,kn=!1}_isOutOfMapMaxBounds(t){const e=this._map.getMaxBounds(),i=t.coords;return e&&(i.longitude<e.getWest()||i.longitude>e.getEast()||i.latitude<e.getSouth()||i.latitude>e.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_onSuccess(e){if(this._map){if(this._isOutOfMapMaxBounds(e))return this._setErrorState(),this.fire(new t.Event("outofmaxbounds",e)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=e,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&"OFF"!==this._watchState&&this._updateMarker(e),this.options.trackUserLocation&&"ACTIVE_LOCK"!==this._watchState||this._updateCamera(e),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new t.Event("geolocate",e)),this._finish()}}_updateCamera(e){const i=new t.LngLat(e.coords.longitude,e.coords.latitude),r=e.coords.accuracy,n=this._map.getBearing(),o=t.extend({bearing:n},this.options.fitBoundsOptions),a=R.fromLngLat(i,r);this._map.fitBounds(a,o,{geolocateSource:!0})}_updateMarker(e){if(e){const i=new t.LngLat(e.coords.longitude,e.coords.latitude);this._accuracyCircleMarker.setLngLat(i).addTo(this._map),this._userLocationDotMarker.setLngLat(i).addTo(this._map),this._accuracy=e.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){const t=this._map.getBounds(),e=t.getSouthEast(),i=t.getNorthEast(),r=e.distanceTo(i),n=Math.ceil(this._accuracy/(r/this._map._container.clientHeight)*2);this._circleElement.style.width=`${n}px`,this._circleElement.style.height=`${n}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}_onError(e){if(this._map){if(this.options.trackUserLocation)if(1===e.code){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t),void 0!==this._geolocationWatchID&&this._clearWatch()}else{if(3===e.code&&kn)return;this._setErrorState()}"OFF"!==this._watchState&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new t.Event("error",e)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(e){if(this._map){if(this._container.addEventListener("contextmenu",(t=>t.preventDefault())),this._geolocateButton=i.create("button","maplibregl-ctrl-geolocate",this._container),i.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",!1===e){t.warnOnce("Geolocation support is not available so the GeolocateControl will be disabled.");const e=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=e,this._geolocateButton.setAttribute("aria-label",e)}else{const t=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=i.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new In(this._dotElement),this._circleElement=i.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new In({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||"ACTIVE_LOCK"!==this._watchState||e.originalEvent&&"resize"===e.originalEvent.type||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new t.Event("trackuserlocationend")))}))}}trigger(){if(!this._setup)return t.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 t.Event("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":Mn--,kn=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this.fire(new t.Event("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new t.Event("trackuserlocationstart"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if("OFF"===this._watchState&&void 0!==this._geolocationWatchID)this._clearWatch();else if(void 0===this._geolocationWatchID){let t;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),Mn++,Mn>1?(t={maximumAge:6e5,timeout:0},kn=!0):(t=this.options.positionOptions,kn=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,t)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},AttributionControl:ln,LogoControl:cn,ScaleControl:class{constructor(e){this.options=t.extend({},zn,e),t.bindAll(["_onMove","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_onMove(){Pn(this._map,this._container,this.options)}onAdd(t){return this._map=t,this._container=i.create("div","maplibregl-ctrl maplibregl-ctrl-scale",t.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){i.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}setUnit(t){this.options.unit=t,Pn(this._map,this._container,this.options)}},FullscreenControl:class extends t.Evented{constructor(e={}){super(),this._onFullscreenChange=()=>{(window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement)===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,e&&e.container&&(e.container instanceof HTMLElement?this._container=e.container:t.warnOnce("Full screen control 'container' must be a DOM element.")),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(t){return this._map=t,this._container||(this._container=this._map.getContainer()),this._controlContainer=i.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){i.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const t=this._fullscreenButton=i.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);i.create("span","maplibregl-ctrl-icon",t).setAttribute("aria-hidden","true"),t.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const t=this._getTitle();this._fullscreenButton.setAttribute("aria-label",t),this._fullscreenButton.title=t}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new t.Event("fullscreenstart")),this._map._cooperativeGestures&&(this._prevCooperativeGestures=this._map._cooperativeGestures,this._map.setCooperativeGestures())):(this.fire(new t.Event("fullscreenend")),this._prevCooperativeGestures&&(this._map.setCooperativeGestures(this._prevCooperativeGestures),delete this._prevCooperativeGestures))}_exitFullscreen(){window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}},TerrainControl:class{constructor(e){this.options=e,t.bindAll(["_toggleTerrain","_updateTerrainIcon"],this)}onAdd(t){return this._map=t,this._container=i.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=i.create("button","maplibregl-ctrl-terrain",this._container),i.create("span","maplibregl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){i.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}_toggleTerrain(){this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()}_updateTerrainIcon(){this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.disableTerrain")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.enableTerrain"))}},Popup:class extends t.Evented{constructor(e){super(),this.options=t.extend(Object.create(Dn),e),t.bindAll(["_update","_onClose","remove","_onMouseMove","_onMouseUp","_onDrag"],this)}addTo(e){return this._map&&this.remove(),this._map=e,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new t.Event("open")),this}isOpen(){return!!this._map}remove(){return this._content&&i.remove(this._content),this._container&&(i.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 t.Event("close")),this}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=t.LngLat.convert(e),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"),this._map._canvasContainer.classList.remove("maplibregl-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"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(t){return this.setDOMContent(document.createTextNode(t))}setHTML(t){const e=document.createDocumentFragment(),i=document.createElement("body");let r;for(i.innerHTML=t;r=i.firstChild,r;)e.appendChild(r);return this.setDOMContent(e)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(t){return this.options.maxWidth=t,this._update(),this}setDOMContent(t){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=i.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(t),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(t){this._container&&this._container.classList.add(t)}removeClassName(t){this._container&&this._container.classList.remove(t)}setOffset(t){return this.options.offset=t,this._update(),this}toggleClassName(t){if(this._container)return this._container.classList.toggle(t)}_createCloseButton(){this.options.closeButton&&(this._closeButton=i.create("button","maplibregl-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(t){this._update(t.point)}_onMouseMove(t){this._update(t.point)}_onDrag(t){this._update(t.point)}_update(t){if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(this._container||(this._container=i.create("div","maplibregl-popup",this._map.getContainer()),this._tip=i.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className&&this.options.className.split(" ").forEach((t=>this._container.classList.add(t))),this._trackPointer&&this._container.classList.add("maplibregl-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=Tn(this._lngLat,this._pos,this._map.transform)),this._trackPointer&&!t)return;const e=this._pos=this._trackPointer&&t?t:this._map.project(this._lngLat);let r=this.options.anchor;const n=Bn(this.options.offset);if(!r){const t=this._container.offsetWidth,i=this._container.offsetHeight;let o;o=e.y+n.bottom.y<i?["top"]:e.y>this._map.transform.height-i?["bottom"]:[],e.x<t/2?o.push("left"):e.x>this._map.transform.width-t/2&&o.push("right"),r=0===o.length?"bottom":o.join("-")}const o=e.add(n[r]).round();i.setTransform(this._container,`${Sn[r]} translate(${o.x}px,${o.y}px)`),Cn(this._container,r,"popup")}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const t=this._container.querySelector(Rn);t&&t.focus()}_onClose(){this.remove()}},Marker:In,Style:oe,LngLat:t.LngLat,LngLatBounds:R,Point:t.Point,MercatorCoordinate:t.MercatorCoordinate,Evented:t.Evented,AJAXError:t.AJAXError,config:t.config,CanvasSource:q,GeoJSONSource:V,ImageSource:$,RasterDEMTileSource:U,RasterTileSource:O,VectorTileSource:F,VideoSource:j,prewarm:function(){ot().acquire(et)},clearPrewarmedResources:function(){const t=nt;t&&(t.isPreloaded()&&1===t.numActive()?(t.release(et),nt=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 version(){return Fn},get workerCount(){return it.workerCount},set workerCount(t){it.workerCount=t},get maxParallelImageRequests(){return t.config.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(e){t.config.MAX_PARALLEL_IMAGE_REQUESTS=e},get workerUrl(){return t.config.WORKER_URL},set workerUrl(e){t.config.WORKER_URL=e},addProtocol(e,i){t.config.REGISTERED_PROTOCOLS[e]=i},removeProtocol(e){delete t.config.REGISTERED_PROTOCOLS[e]}};return an.extend(On,{isSafari:t.isSafari,getPerformanceMetrics:t.PerformanceUtils.getPerformanceMetrics}),On})),i}()}},o={};function a(t){var e=o[t];if(void 0!==e)return e.exports;var i=o[t]={id:t,exports:{}};return n[t].call(i.exports,i,i.exports,a),i.exports}a.m=n,a.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return a.d(e,{a:e}),e},e=Object.getPrototypeOf?t=>Object.getPrototypeOf(t):t=>t.__proto__,a.t=function(i,r){if(1&r&&(i=this(i)),8&r)return i;if("object"==typeof i&&i){if(4&r&&i.__esModule)return i;if(16&r&&"function"==typeof i.then)return i}var n=Object.create(null);a.r(n);var o={};t=t||[null,e({}),e([]),e(e)];for(var s=2&r&&i;"object"==typeof s&&!~t.indexOf(s);s=e(s))Object.getOwnPropertyNames(s).forEach((t=>o[t]=()=>i[t]));return o.default=()=>i,a.d(n,o),n},a.d=(t,e)=>{for(var i in e)a.o(e,i)&&!a.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},a.f={},a.e=t=>Promise.all(Object.keys(a.f).reduce(((e,i)=>(a.f[i](t,e),e)),[])),a.u=t=>"embed-chunks/"+{36:"b52b89229e47dc93c64b",730:"d0f087405f7ae2fcf1c1"}[t]+".js",a.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),a.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),i={},r="geoloniaEmbed:",a.l=(t,e,n,o)=>{if(i[t])i[t].push(e);else{var s,l;if(void 0!==n)for(var c=document.getElementsByTagName("script"),h=0;h<c.length;h++){var u=c[h];if(u.getAttribute("src")==t||u.getAttribute("data-webpack")==r+n){s=u;break}}s||(l=!0,(s=document.createElement("script")).charset="utf-8",s.timeout=120,a.nc&&s.setAttribute("nonce",a.nc),s.setAttribute("data-webpack",r+n),s.src=t),i[t]=[e];var p=(e,r)=>{s.onerror=s.onload=null,clearTimeout(d);var n=i[t];if(delete i[t],s.parentNode&&s.parentNode.removeChild(s),n&&n.forEach((t=>t(r))),e)return e(r)},d=setTimeout(p.bind(null,void 0,{type:"timeout",target:s}),12e4);s.onerror=p.bind(null,s.onerror),s.onload=p.bind(null,s.onload),l&&document.head.appendChild(s)}},a.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},(()=>{var t;a.g.importScripts&&(t=a.g.location+"");var e=a.g.document;if(!t&&e&&(e.currentScript&&(t=e.currentScript.src),!t)){var i=e.getElementsByTagName("script");if(i.length)for(var r=i.length-1;r>-1&&!t;)t=i[r--].src}if(!t)throw new Error("Automatic publicPath is not supported in this browser");t=t.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),a.p=t})(),(()=>{a.b=document.baseURI||self.location.href;var t={179:0};a.f.j=(e,i)=>{var r=a.o(t,e)?t[e]:void 0;if(0!==r)if(r)i.push(r[2]);else{var n=new Promise(((i,n)=>r=t[e]=[i,n]));i.push(r[2]=n);var o=a.p+a.u(e),s=new Error;a.l(o,(i=>{if(a.o(t,e)&&(0!==(r=t[e])&&(t[e]=void 0),r)){var n=i&&("load"===i.type?"missing":i.type),o=i&&i.target&&i.target.src;s.message="Loading chunk "+e+" failed.\n("+n+": "+o+")",s.name="ChunkLoadError",s.type=n,s.request=o,r[1](s)}}),"chunk-"+e,e)}};var e=(e,i)=>{var r,n,[o,s,l]=i,c=0;if(o.some((e=>0!==t[e]))){for(r in s)a.o(s,r)&&(a.m[r]=s[r]);l&&l(a)}for(e&&e(i);c<o.length;c++)n=o[c],a.o(t,n)&&t[n]&&t[n][0](),t[n]=0},i=self.webpackChunkgeoloniaEmbed=self.webpackChunkgeoloniaEmbed||[];i.forEach(e.bind(null,0)),i.push=e.bind(null,i.push.bind(i))})(),a.nc=void 0;var s={};return(()=>{"use strict";a.r(s),a.d(s,{Map:()=>Tt,Marker:()=>Q,SimpleStyle:()=>xt,embedVersion:()=>St,geolonia:()=>qe});var t=a(4613),e=a.n(t);function i(t){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i(t)}var r=/^\s+/,n=/\s+$/;function o(t,e){if(e=e||{},(t=t||"")instanceof o)return t;if(!(this instanceof o))return new o(t,e);var a=function(t){var e,o,a,s={r:0,g:0,b:0},l=1,c=null,h=null,u=null,p=!1,d=!1;return"string"==typeof t&&(t=function(t){t=t.replace(r,"").replace(n,"").toLowerCase();var e,i=!1;if(T[t])t=T[t],i=!0;else if("transparent"==t)return{r:0,g:0,b:0,a:0,format:"name"};return(e=F.rgb.exec(t))?{r:e[1],g:e[2],b:e[3]}:(e=F.rgba.exec(t))?{r:e[1],g:e[2],b:e[3],a:e[4]}:(e=F.hsl.exec(t))?{h:e[1],s:e[2],l:e[3]}:(e=F.hsla.exec(t))?{h:e[1],s:e[2],l:e[3],a:e[4]}:(e=F.hsv.exec(t))?{h:e[1],s:e[2],v:e[3]}:(e=F.hsva.exec(t))?{h:e[1],s:e[2],v:e[3],a:e[4]}:(e=F.hex8.exec(t))?{r:M(e[1]),g:M(e[2]),b:M(e[3]),a:L(e[4]),format:i?"name":"hex8"}:(e=F.hex6.exec(t))?{r:M(e[1]),g:M(e[2]),b:M(e[3]),format:i?"name":"hex"}:(e=F.hex4.exec(t))?{r:M(e[1]+""+e[1]),g:M(e[2]+""+e[2]),b:M(e[3]+""+e[3]),a:L(e[4]+""+e[4]),format:i?"name":"hex8"}:!!(e=F.hex3.exec(t))&&{r:M(e[1]+""+e[1]),g:M(e[2]+""+e[2]),b:M(e[3]+""+e[3]),format:i?"name":"hex"}}(t)),"object"==i(t)&&(O(t.r)&&O(t.g)&&O(t.b)?(e=t.r,o=t.g,a=t.b,s={r:255*I(e,255),g:255*I(o,255),b:255*I(a,255)},p=!0,d="%"===String(t.r).substr(-1)?"prgb":"rgb"):O(t.h)&&O(t.s)&&O(t.v)?(c=z(t.s),h=z(t.v),s=function(t,e,i){t=6*I(t,360),e=I(e,100),i=I(i,100);var r=Math.floor(t),n=t-r,o=i*(1-e),a=i*(1-n*e),s=i*(1-(1-n)*e),l=r%6;return{r:255*[i,a,o,o,s,i][l],g:255*[s,i,i,a,o,o][l],b:255*[o,o,s,i,i,a][l]}}(t.h,c,h),p=!0,d="hsv"):O(t.h)&&O(t.s)&&O(t.l)&&(c=z(t.s),u=z(t.l),s=function(t,e,i){var r,n,o;function a(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+(e-t)*(2/3-i)*6:t}if(t=I(t,360),e=I(e,100),i=I(i,100),0===e)r=n=o=i;else{var s=i<.5?i*(1+e):i+e-i*e,l=2*i-s;r=a(l,s,t+1/3),n=a(l,s,t),o=a(l,s,t-1/3)}return{r:255*r,g:255*n,b:255*o}}(t.h,c,u),p=!0,d="hsl"),t.hasOwnProperty("a")&&(l=t.a)),l=C(l),{ok:p,format:t.format||d,r:Math.min(255,Math.max(s.r,0)),g:Math.min(255,Math.max(s.g,0)),b:Math.min(255,Math.max(s.b,0)),a:l}}(t);this._originalInput=t,this._r=a.r,this._g=a.g,this._b=a.b,this._a=a.a,this._roundA=Math.round(100*this._a)/100,this._format=e.format||a.format,this._gradientType=e.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=a.ok}function l(t,e,i){t=I(t,255),e=I(e,255),i=I(i,255);var r,n,o=Math.max(t,e,i),a=Math.min(t,e,i),s=(o+a)/2;if(o==a)r=n=0;else{var l=o-a;switch(n=s>.5?l/(2-o-a):l/(o+a),o){case t:r=(e-i)/l+(e<i?6:0);break;case e:r=(i-t)/l+2;break;case i:r=(t-e)/l+4}r/=6}return{h:r,s:n,l:s}}function c(t,e,i){t=I(t,255),e=I(e,255),i=I(i,255);var r,n,o=Math.max(t,e,i),a=Math.min(t,e,i),s=o,l=o-a;if(n=0===o?0:l/o,o==a)r=0;else{switch(o){case t:r=(e-i)/l+(e<i?6:0);break;case e:r=(i-t)/l+2;break;case i:r=(t-e)/l+4}r/=6}return{h:r,s:n,v:s}}function h(t,e,i,r){var n=[k(Math.round(t).toString(16)),k(Math.round(e).toString(16)),k(Math.round(i).toString(16))];return r&&n[0].charAt(0)==n[0].charAt(1)&&n[1].charAt(0)==n[1].charAt(1)&&n[2].charAt(0)==n[2].charAt(1)?n[0].charAt(0)+n[1].charAt(0)+n[2].charAt(0):n.join("")}function u(t,e,i,r){return[k(P(r)),k(Math.round(t).toString(16)),k(Math.round(e).toString(16)),k(Math.round(i).toString(16))].join("")}function p(t,e){e=0===e?0:e||10;var i=o(t).toHsl();return i.s-=e/100,i.s=A(i.s),o(i)}function d(t,e){e=0===e?0:e||10;var i=o(t).toHsl();return i.s+=e/100,i.s=A(i.s),o(i)}function m(t){return o(t).desaturate(100)}function f(t,e){e=0===e?0:e||10;var i=o(t).toHsl();return i.l+=e/100,i.l=A(i.l),o(i)}function g(t,e){e=0===e?0:e||10;var i=o(t).toRgb();return i.r=Math.max(0,Math.min(255,i.r-Math.round(-e/100*255))),i.g=Math.max(0,Math.min(255,i.g-Math.round(-e/100*255))),i.b=Math.max(0,Math.min(255,i.b-Math.round(-e/100*255))),o(i)}function _(t,e){e=0===e?0:e||10;var i=o(t).toHsl();return i.l-=e/100,i.l=A(i.l),o(i)}function y(t,e){var i=o(t).toHsl(),r=(i.h+e)%360;return i.h=r<0?360+r:r,o(i)}function x(t){var e=o(t).toHsl();return e.h=(e.h+180)%360,o(e)}function v(t,e){if(isNaN(e)||e<=0)throw new Error("Argument to polyad must be a positive number");for(var i=o(t).toHsl(),r=[o(t)],n=360/e,a=1;a<e;a++)r.push(o({h:(i.h+a*n)%360,s:i.s,l:i.l}));return r}function b(t){var e=o(t).toHsl(),i=e.h;return[o(t),o({h:(i+72)%360,s:e.s,l:e.l}),o({h:(i+216)%360,s:e.s,l:e.l})]}function w(t,e,i){e=e||6,i=i||30;var r=o(t).toHsl(),n=360/i,a=[o(t)];for(r.h=(r.h-(n*e>>1)+720)%360;--e;)r.h=(r.h+n)%360,a.push(o(r));return a}function E(t,e){e=e||6;for(var i=o(t).toHsv(),r=i.h,n=i.s,a=i.v,s=[],l=1/e;e--;)s.push(o({h:r,s:n,v:a})),a=(a+l)%1;return s}o.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(299*t.r+587*t.g+114*t.b)/1e3},getLuminance:function(){var t,e,i,r=this.toRgb();return t=r.r/255,e=r.g/255,i=r.b/255,.2126*(t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4))+.7152*(e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4))+.0722*(i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4))},setAlpha:function(t){return this._a=C(t),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var t=c(this._r,this._g,this._b);return{h:360*t.h,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=c(this._r,this._g,this._b),e=Math.round(360*t.h),i=Math.round(100*t.s),r=Math.round(100*t.v);return 1==this._a?"hsv("+e+", "+i+"%, "+r+"%)":"hsva("+e+", "+i+"%, "+r+"%, "+this._roundA+")"},toHsl:function(){var t=l(this._r,this._g,this._b);return{h:360*t.h,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=l(this._r,this._g,this._b),e=Math.round(360*t.h),i=Math.round(100*t.s),r=Math.round(100*t.l);return 1==this._a?"hsl("+e+", "+i+"%, "+r+"%)":"hsla("+e+", "+i+"%, "+r+"%, "+this._roundA+")"},toHex:function(t){return h(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return function(t,e,i,r,n){var o=[k(Math.round(t).toString(16)),k(Math.round(e).toString(16)),k(Math.round(i).toString(16)),k(P(r))];return n&&o[0].charAt(0)==o[0].charAt(1)&&o[1].charAt(0)==o[1].charAt(1)&&o[2].charAt(0)==o[2].charAt(1)&&o[3].charAt(0)==o[3].charAt(1)?o[0].charAt(0)+o[1].charAt(0)+o[2].charAt(0)+o[3].charAt(0):o.join("")}(this._r,this._g,this._b,this._a,t)},toHex8String:function(t){return"#"+this.toHex8(t)},toRgb:function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:Math.round(100*I(this._r,255))+"%",g:Math.round(100*I(this._g,255))+"%",b:Math.round(100*I(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+Math.round(100*I(this._r,255))+"%, "+Math.round(100*I(this._g,255))+"%, "+Math.round(100*I(this._b,255))+"%)":"rgba("+Math.round(100*I(this._r,255))+"%, "+Math.round(100*I(this._g,255))+"%, "+Math.round(100*I(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(S[h(this._r,this._g,this._b,!0)]||!1)},toFilter:function(t){var e="#"+u(this._r,this._g,this._b,this._a),i=e,r=this._gradientType?"GradientType = 1, ":"";if(t){var n=o(t);i="#"+u(n._r,n._g,n._b,n._a)}return"progid:DXImageTransform.Microsoft.gradient("+r+"startColorstr="+e+",endColorstr="+i+")"},toString:function(t){var e=!!t;t=t||this._format;var i=!1,r=this._a<1&&this._a>=0;return e||!r||"hex"!==t&&"hex6"!==t&&"hex3"!==t&&"hex4"!==t&&"hex8"!==t&&"name"!==t?("rgb"===t&&(i=this.toRgbString()),"prgb"===t&&(i=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(i=this.toHexString()),"hex3"===t&&(i=this.toHexString(!0)),"hex4"===t&&(i=this.toHex8String(!0)),"hex8"===t&&(i=this.toHex8String()),"name"===t&&(i=this.toName()),"hsl"===t&&(i=this.toHslString()),"hsv"===t&&(i=this.toHsvString()),i||this.toHexString()):"name"===t&&0===this._a?this.toName():this.toRgbString()},clone:function(){return o(this.toString())},_applyModification:function(t,e){var i=t.apply(null,[this].concat([].slice.call(e)));return this._r=i._r,this._g=i._g,this._b=i._b,this.setAlpha(i._a),this},lighten:function(){return this._applyModification(f,arguments)},brighten:function(){return this._applyModification(g,arguments)},darken:function(){return this._applyModification(_,arguments)},desaturate:function(){return this._applyModification(p,arguments)},saturate:function(){return this._applyModification(d,arguments)},greyscale:function(){return this._applyModification(m,arguments)},spin:function(){return this._applyModification(y,arguments)},_applyCombination:function(t,e){return t.apply(null,[this].concat([].slice.call(e)))},analogous:function(){return this._applyCombination(w,arguments)},complement:function(){return this._applyCombination(x,arguments)},monochromatic:function(){return this._applyCombination(E,arguments)},splitcomplement:function(){return this._applyCombination(b,arguments)},triad:function(){return this._applyCombination(v,[3])},tetrad:function(){return this._applyCombination(v,[4])}},o.fromRatio=function(t,e){if("object"==i(t)){var r={};for(var n in t)t.hasOwnProperty(n)&&(r[n]="a"===n?t[n]:z(t[n]));t=r}return o(t,e)},o.equals=function(t,e){return!(!t||!e)&&o(t).toRgbString()==o(e).toRgbString()},o.random=function(){return o.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})},o.mix=function(t,e,i){i=0===i?0:i||50;var r=o(t).toRgb(),n=o(e).toRgb(),a=i/100;return o({r:(n.r-r.r)*a+r.r,g:(n.g-r.g)*a+r.g,b:(n.b-r.b)*a+r.b,a:(n.a-r.a)*a+r.a})},o.readability=function(t,e){var i=o(t),r=o(e);return(Math.max(i.getLuminance(),r.getLuminance())+.05)/(Math.min(i.getLuminance(),r.getLuminance())+.05)},o.isReadable=function(t,e,i){var r,n,a,s,l,c=o.readability(t,e);switch(n=!1,(a=i,"AA"!==(s=((a=a||{level:"AA",size:"small"}).level||"AA").toUpperCase())&&"AAA"!==s&&(s="AA"),"small"!==(l=(a.size||"small").toLowerCase())&&"large"!==l&&(l="small"),r={level:s,size:l}).level+r.size){case"AAsmall":case"AAAlarge":n=c>=4.5;break;case"AAlarge":n=c>=3;break;case"AAAsmall":n=c>=7}return n},o.mostReadable=function(t,e,i){var r,n,a,s,l=null,c=0;n=(i=i||{}).includeFallbackColors,a=i.level,s=i.size;for(var h=0;h<e.length;h++)(r=o.readability(t,e[h]))>c&&(c=r,l=o(e[h]));return o.isReadable(t,l,{level:a,size:s})||!n?l:(i.includeFallbackColors=!1,o.mostReadable(t,["#fff","#000"],i))};var T=o.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},S=o.hexNames=function(t){var e={};for(var i in t)t.hasOwnProperty(i)&&(e[t[i]]=i);return e}(T);function C(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function I(t,e){(function(t){return"string"==typeof t&&-1!=t.indexOf(".")&&1===parseFloat(t)})(t)&&(t="100%");var i=function(t){return"string"==typeof t&&-1!=t.indexOf("%")}(t);return t=Math.min(e,Math.max(0,parseFloat(t))),i&&(t=parseInt(t*e,10)/100),Math.abs(t-e)<1e-6?1:t%e/parseFloat(e)}function A(t){return Math.min(1,Math.max(0,t))}function M(t){return parseInt(t,16)}function k(t){return 1==t.length?"0"+t:""+t}function z(t){return t<=1&&(t=100*t+"%"),t}function P(t){return Math.round(255*parseFloat(t)).toString(16)}function L(t){return M(t)/255}var D,R,B,F=(R="[\\s|\\(]+("+(D="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)")+")[,|\\s]+("+D+")[,|\\s]+("+D+")\\s*\\)?",B="[\\s|\\(]+("+D+")[,|\\s]+("+D+")[,|\\s]+("+D+")[,|\\s]+("+D+")\\s*\\)?",{CSS_UNIT:new RegExp(D),rgb:new RegExp("rgb"+R),rgba:new RegExp("rgba"+B),hsl:new RegExp("hsl"+R),hsla:new RegExp("hsla"+B),hsv:new RegExp("hsv"+R),hsva:new RegExp("hsva"+B),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/});function O(t){return!!F.CSS_UNIT.exec(t)}var U,V,N=a(4055),$=a.n(N),j=function(t,e,i,r){if("a"===i&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?r:"a"===i?r.call(t):r?r.value:e.get(t)},q=function(t,e,i,r,n){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!n:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?n.call(t,i):n?n.value=i:e.set(t,i),i};U=new WeakMap,V=new WeakMap;const Z=new class{constructor(){U.set(this,void 0),V.set(this,void 0)}get apiKey(){return j(this,U,"f")||this.parse(),j(this,U,"f")}set apiKey(t){q(this,U,t,"f")}get stage(){return j(this,V,"f")||this.parse(),j(this,V,"f")}set stage(t){q(this,V,t,"f")}parse(t=document){const e=t.currentScript?[t.currentScript]:t.getElementsByTagName("script");for(const t of e){const e=new URL(t.src.startsWith("https://")||t.src.startsWith("http://")||t.src.startsWith("//")?t.src:`https://${location.host}/${t.src}`),i=e.searchParams.get("geolonia-api-key");if(i){q(this,U,i,"f");const t=e.pathname.match(/^\/(v[0-9.]+)\/embed/);t&&t[1]&&q(this,V,t[1],"f");break}}if(j(this,V,"f")||q(this,V,"dev","f"),!j(this,U,"f"))throw new Error("Cannot load API key.")}reset(){q(this,U,void 0,"f"),q(this,V,void 0,"f")}};function G(t){if(t.match(/^https?:\/\//))return t;if(t.match(/^\//)||t.match(/^\.\.?/))try{return new URL(t,location.href).href}catch(t){return console.error("[Geolonia]",t),!1}return!1}function H(){const t=window.navigator.languages&&window.navigator.languages[0]&&window.navigator.languages[0].toLowerCase()||window.navigator.language.toLowerCase();return"ja"===t||"ja-jp"===t?"ja":"en"}function X(t){return"object"==typeof HTMLElement?t instanceof HTMLElement:t&&"object"==typeof t&&null!==t&&1===t.nodeType&&"string"==typeof t.nodeName}function W(t){const e=t.toLowerCase();return["top-right","bottom-right","bottom-left","top-left"].includes(e)?{enabled:!0,position:e}:["on","off"].includes(e)?{enabled:"on"===e,position:void 0}:{enabled:!1,position:void 0}}let K="";const Y=t=>{if(K)return K;{const e=new Uint8Array(t/2);window.crypto.getRandomValues(e);const i=Array.from(e,(t=>t.toString(16).padStart(2,"0"))).join("");return K=i,i}},J=async t=>{const{default:e}=await Promise.all([a.e(36),a.e(730)]).then(a.t.bind(a,1036,23));return e(t,{allowedTags:e.defaults.allowedTags.concat(["img"]),allowedAttributes:{...e.defaults.allowedAttributes,"*":["class"]}})};class Q extends e().Marker{constructor(t={},e={}){if(t=function(t,e){return t&&X(t)?t={element:t,...e}:t||(t=e),t}(t,e),!t||!t.element){const e=document.createElement("div");e.className="geolonia-default-marker",e.innerHTML=$(),e.style.margin="0",e.style.padding="0",e.style.width="26px",e.style.height="34px";const i=e.querySelector("svg");if(i.style.width="100%",i.style.height="100%",t.element=e,t.color)e.querySelector(".left").style.fill=t.color,e.querySelector(".right").style.fill=o(t.color).darken().toString();else{const t="#E4402F";e.querySelector(".left").style.fill=t,e.querySelector(".right").style.fill=o(t).darken().toString()}t.offset=[0,-15]}return super(t),this}}class tt{onAdd(){this.container=document.createElement("div"),this.container.className="maplibregl-ctrl";const t=document.createElement("img");t.src="https://cdn.geolonia.com/logo/geolonia-symbol_1.png",t.style.width="16px",t.style.height="16px",t.style.display="block",t.style.cursor="pointer",t.style.padding="0",t.style.margin="0",t.style.border="none",t.alt="Geolonia";const e=document.createElement("a");return e.href="https://geolonia.com/",e.appendChild(t),e.title="Powered by Geolonia",this.container.appendChild(e),this.container}onRemove(){this.container.parentNode.removeChild(this.container)}getDefaultPosition(){return"bottom-left"}}var et=a(5550),it=a.n(et);class rt{static testProp(t){if(!rt["#docStyle"])return t[0];for(let e=0;e<t.length;e++)if(t[e]in rt["#docStyle"])return t[e];return t[0]}static create(t,e,i){const r=window.document.createElement(t);return void 0!==e&&(r.className=e),i&&i.appendChild(r),r}static createNS(t,e){return window.document.createElementNS(t,e)}static disableDrag(){rt["#docStyle"]&&rt["#selectProp"]&&(rt["#userSelect"]=rt["#docStyle"][rt["#selectProp"]],rt["#docStyle"][rt["#selectProp"]]="none")}static enableDrag(){rt["#docStyle"]&&rt["#selectProp"]&&(rt["#docStyle"][rt["#selectProp"]]=rt["#userSelect"])}static setTransform(t,e){t.style[rt["#transformProp"]]=e}static addEventListener(t,e,i,r){"passive"in r?t.addEventListener(e,i,r):t.addEventListener(e,i,r.capture)}static removeEventListener(t,e,i,r){"passive"in r?t.removeEventListener(e,i,r):t.removeEventListener(e,i,r.capture)}static suppressClick(){window.addEventListener("click",rt["#transformProp"],!0),window.setTimeout((()=>{window.removeEventListener("click",rt["#transformProp"],!0)}),0)}static mousePos(t,e){const i=t.getBoundingClientRect();return new(it())(e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop)}static touchPos(t,e){const i=t.getBoundingClientRect(),r=[];for(let n=0;n<e.length;n++)r.push(new(it())(e[n].clientX-i.left-t.clientLeft,e[n].clientY-i.top-t.clientTop));return r}static mouseButton(t){return t.button}static remove(t){t.parentNode&&t.parentNode.removeChild(t)}}"undefined"!=typeof window&&window.document&&window.document.documentElement.style,rt.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),rt.testProp(["transform","WebkitTransform"]);class nt{constructor(t={}){this.fullscreen=!1,this.id=`mbgl-gesture-handling-help-container-${nt.count}`,nt.count++,this.timer=null;const e="ctrl"!==t.modifierKey;let i=`Use ${e?"alt":"ctrl"} + scroll to zoom the map.`,r="Use two fingers to move the map.";if("ja"===("auto"!==t.lang&&t.lang?t.lang:function(){const t=window.navigator.languages&&window.navigator.languages[0]&&window.navigator.languages[0].toLowerCase()||window.navigator.language.toLowerCase();return"ja"===t||"ja-jp"===t?"ja":"en"}())&&(i=(e?"Alt":"Ctrl")+" キーを押しながらスクロールしてください。",r="2本指を使って操作してください。"),this.settings={backgroundColor:"rgba(0, 0, 0, 0.8)",textColor:"#ffffff",textMessage:i,textMessageMobile:r,timeout:2e3,...t,modifierKey:e?"altKey":"ctrlKey"},this.helpElement=document.querySelector(`#${this.id}`),null===this.helpElement){this.helpElement=document.createElement("div"),this.helpElement.id=this.id,this.helpElement.style.backgroundColor=this.settings.backgroundColor,this.helpElement.style.position="absolute",this.helpElement.style.display="none",this.helpElement.style.zIndex=9999,this.helpElement.style.justifyContent="center",this.helpElement.style.alignItems="center";const t=document.createElement("div");t.style.textAlign="center",t.style.color=this.settings.textColor,t.innerText="",this.helpElement.appendChild(t)}}showHelp(t,e){this.helpElement.style.top=0,this.helpElement.style.left=0,this.helpElement.style.width="100%",this.helpElement.style.height="100%",this.helpElement.style.display="flex",this.helpElement.querySelector("div").innerText=e,t.getContainer().appendChild(this.helpElement)}hideHelp(t){try{t.getContainer().removeChild(this.helpElement)}catch(t){}}addTo(t){t.scrollZoom.disable(),this.helpElement.addEventListener("wheel",(e=>{e[this.settings.modifierKey]||!0===this.fullscreen?(e.preventDefault(),this.hideHelp(t)):(clearTimeout(this.timer),this.timer=setTimeout((()=>{this.hideHelp(t)}),this.settings.timeout))})),t.getContainer().addEventListener("wheel",(e=>{e[this.settings.modifierKey]||!0===this.fullscreen?(e.preventDefault(),t.scrollZoom.isEnabled()||(t.scrollZoom.reset(),t.scrollZoom.enable())):(t.scrollZoom.disable(),this.showHelp(t,this.settings.textMessage),this.timer=setTimeout((()=>{this.hideHelp(t)}),this.settings.timeout))})),this.helpElement.addEventListener("touchstart",(e=>{e.touches&&(2<=e.touches.length||!0===this.fullscreen)&&(clearTimeout(this.timer),this.hideHelp(t),t.dragPan.enable(),e.preventDefault())})),t.on("movestart",(e=>{e.originalEvent&&"touches"in e.originalEvent&&2>e.originalEvent.touches.length&&!1===this.fullscreen&&(this.showHelp(t,this.settings.textMessageMobile),t.dragPan.disable(),this.timer=setTimeout((()=>{t.dragPan.enable(),this.hideHelp(t)}),this.settings.timeout))})),document.addEventListener("fullscreenchange",(()=>{document.fullscreenElement?this.fullscreen=!0:this.fullscreen=!1}))}}nt.count=0;const ot=nt,at=(t,e={})=>{t.dataset||(t.dataset={});let i="auto";return i=t.dataset.lang&&"auto"===t.dataset.lang?H():t.dataset.lang&&"ja"===t.dataset.lang?"ja":t.dataset.lang&&"ja"!==t.dataset.lang?"en":H(),Z.parse(t),{lat:0,lng:0,zoom:0,bearing:0,pitch:0,hash:"off",marker:"on",markerColor:"#E4402F",openPopup:"off",customMarker:"",customMarkerOffset:"0, 0",gestureHandling:!1===e.interactive?"off":"on",navigationControl:!1===e.interactive?"off":"on",geolocateControl:"off",fullscreenControl:"off",scaleControl:"off",geoloniaControl:"on",geojson:"",simpleVector:"",cluster:"on",clusterColor:"#ff0000",style:"geolonia/basic-v1",lang:i,plugin:"off",key:Z.apiKey,apiUrl:`https://api.geolonia.com/${Z.stage}`,stage:Z.stage,loader:"on",minZoom:"",maxZoom:20,"3d":"",...t.dataset}};var st=a(9319),lt=a.n(st);function ct(t){return!isNaN(t)&&null!==t&&!Array.isArray(t)}function ht(t,e,i){if(null!==t)for(var r,n,o,a,s,l,c,h,u=0,p=0,d=t.type,m="FeatureCollection"===d,f="Feature"===d,g=m?t.features.length:1,_=0;_<g;_++){s=(h=!!(c=m?t.features[_].geometry:f?t.geometry:t)&&"GeometryCollection"===c.type)?c.geometries.length:1;for(var y=0;y<s;y++){var x=0,v=0;if(null!==(a=h?c.geometries[y]:c)){l=a.coordinates;var b=a.type;switch(u=!i||"Polygon"!==b&&"MultiPolygon"!==b?0:1,b){case null:break;case"Point":if(!1===e(l,p,_,x,v))return!1;p++,x++;break;case"LineString":case"MultiPoint":for(r=0;r<l.length;r++){if(!1===e(l[r],p,_,x,v))return!1;p++,"MultiPoint"===b&&x++}"LineString"===b&&x++;break;case"Polygon":case"MultiLineString":for(r=0;r<l.length;r++){for(n=0;n<l[r].length-u;n++){if(!1===e(l[r][n],p,_,x,v))return!1;p++}"MultiLineString"===b&&x++,"Polygon"===b&&v++}"Polygon"===b&&x++;break;case"MultiPolygon":for(r=0;r<l.length;r++){for(v=0,n=0;n<l[r].length;n++){for(o=0;o<l[r][n].length-u;o++){if(!1===e(l[r][n][o],p,_,x,v))return!1;p++}v++}x++}break;case"GeometryCollection":for(r=0;r<a.geometries.length;r++)if(!1===ht(a.geometries[r],e,i))return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function ut(t){var e=[1/0,1/0,-1/0,-1/0];return ht(t,(function(t){e[0]>t[0]&&(e[0]=t[0]),e[1]>t[1]&&(e[1]=t[1]),e[2]<t[0]&&(e[2]=t[0]),e[3]<t[1]&&(e[3]=t[1])})),e}ut.default=ut;const pt=ut,dt=function(t,e){void 0===e&&(e={});var i=pt(t);return function(t,e,i){if(void 0===i&&(i={}),!t)throw new Error("coordinates is required");if(!Array.isArray(t))throw new Error("coordinates must be an Array");if(t.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!ct(t[0])||!ct(t[1]))throw new Error("coordinates must contain numbers");return function(t,e,i){void 0===i&&(i={});var r={type:"Feature"};return(0===i.id||i.id)&&(r.id=i.id),i.bbox&&(r.bbox=i.bbox),r.properties=e||{},r.geometry=t,r}({type:"Point",coordinates:t},e,i)}([(i[0]+i[2])/2,(i[1]+i[3])/2],e.properties,e)},mt="#000000",ft="#FFFFFF",gt="rgba(255, 0, 0, 0.4)",_t="#FFFFFF",yt={type:"FeatureCollection",features:[]};class xt{constructor(t,e){this.callFitBounds=!1,this.setGeoJSON(t),this.options={id:"geolonia-simple-style",cluster:!0,heatmap:!1,clusterColor:"#ff0000",...e}}updateData(t){this.setGeoJSON(t);const e=this.geojson.features,i=e.filter((t=>"point"!==t.geometry.type.toLowerCase())),r=e.filter((t=>"point"===t.geometry.type.toLowerCase()));return this.map.getSource(this.options.id).setData({type:"FeatureCollection",features:i}),this.map.getSource(`${this.options.id}-points`).setData({type:"FeatureCollection",features:r}),this}addTo(t){this.map=t;const e=this.geojson.features,i=e.filter((t=>"point"!==t.geometry.type.toLowerCase())),r=e.filter((t=>"point"===t.geometry.type.toLowerCase()));return this.map.addSource(this.options.id,{type:"geojson",data:{type:"FeatureCollection",features:i}}),this.setPolygonGeometries(),this.setLineGeometries(),this.map.addSource(`${this.options.id}-points`,{type:"geojson",data:{type:"FeatureCollection",features:r},cluster:this.options.cluster,clusterMaxZoom:14,clusterRadius:50}),this.map.addLayer({id:`${this.options.id}-polygon-symbol`,type:"symbol",source:this.options.id,filter:["==","$type","Polygon"],paint:{"text-color":["string",["get","text-color"],mt],"text-halo-color":["string",["get","text-halo-color"],ft],"text-halo-width":1},layout:{"text-field":["get","title"],"text-font":["Noto Sans Regular"],"text-size":12,"text-max-width":12,"text-allow-overlap":!1}}),this.map.addLayer({id:`${this.options.id}-linestring-symbol`,type:"symbol",source:this.options.id,filter:["==","$type","LineString"],paint:{"text-color":["string",["get","text-color"],mt],"text-halo-color":["string",["get","text-halo-color"],ft],"text-halo-width":1},layout:{"symbol-placement":"line","text-field":["get","title"],"text-font":["Noto Sans Regular"],"text-size":12,"text-max-width":12,"text-allow-overlap":!1}}),this.setPointGeometries(),this.setCluster(),this}fitBounds(t={}){this.callFitBounds=!0;const e={duration:3e3,padding:30,...t},i=lt()(this.geojson);return i&&window.requestAnimationFrame((()=>{this.map.fitBounds(i,e)})),this}setPolygonGeometries(){this.map.addLayer({id:`${this.options.id}-polygon`,type:"fill",source:this.options.id,filter:["==","$type","Polygon"],paint:{"fill-color":["string",["get","fill"],gt],"fill-opacity":["number",["get","fill-opacity"],1],"fill-outline-color":["string",["get","stroke"],_t]}}),this.setPopup(this.map,`${this.options.id}-polygon`)}setLineGeometries(){this.map.addLayer({id:`${this.options.id}-linestring`,type:"line",source:this.options.id,filter:["==","$type","LineString"],paint:{"line-width":["number",["get","stroke-width"],2],"line-color":["string",["get","stroke"],gt],"line-opacity":["number",["get","stroke-opacity"],1]},layout:{"line-cap":"round","line-join":"round"}}),this.setPopup(this.map,`${this.options.id}-linestring`)}setPointGeometries(){this.map.addLayer({id:`${this.options.id}-circle-points`,type:"circle",source:`${this.options.id}-points`,filter:["all",["!has","point_count"],["!has","marker-symbol"]],paint:{"circle-radius":["case",["==","small",["get","marker-size"]],7,["==","large",["get","marker-size"]],13,9],"circle-color":["string",["get","marker-color"],gt],"circle-opacity":["number",["get","fill-opacity"],1],"circle-stroke-width":["number",["get","stroke-width"],1],"circle-stroke-color":["string",["get","stroke"],_t],"circle-stroke-opacity":["number",["get","stroke-opacity"],1]}}),this.map.addLayer({id:`${this.options.id}-symbol-points`,type:"symbol",source:`${this.options.id}-points`,filter:["!",["has","point_count"]],paint:{"text-color":["string",["get","text-color"],mt],"text-halo-color":["string",["get","text-halo-color"],ft],"text-halo-width":1},layout:{"icon-image":["get","marker-symbol"],"text-field":["get","title"],"text-font":["Noto Sans Regular"],"text-size":12,"text-anchor":"top","text-max-width":12,"text-offset":["case",["==","small",["get","marker-size"]],["literal",[0,.6]],["==","large",["get","marker-size"]],["literal",[0,1.2]],["literal",[0,.8]]],"text-allow-overlap":!0,"icon-allow-overlap":!0,"text-variable-anchor":["top","bottom","left","right"],"text-radial-offset":["case",["==","small",["get","marker-size"]],.6,["==","large",["get","marker-size"]],1.3,.8]}}),this.setPopup(this.map,`${this.options.id}-circle-points`),this.setPopup(this.map,`${this.options.id}-symbol-points`)}async setPopup(t,i){t.on("click",i,(async i=>{const r=dt(i.features[0]).geometry.coordinates,n=i.features[0].properties.description;if(n){const i=await J(n);(new(e().Popup)).setLngLat(r).setHTML(i).addTo(t)}})),t.on("mouseenter",i,(e=>{e.features[0].properties.description&&(t.getCanvas().style.cursor="pointer")})),t.on("mouseleave",i,(()=>{t.getCanvas().style.cursor=""}))}setCluster(){this.map.addLayer({id:`${this.options.id}-clusters`,type:"circle",source:`${this.options.id}-points`,filter:["has","point_count"],paint:{"circle-radius":20,"circle-color":this.options.clusterColor,"circle-opacity":1}}),this.map.addLayer({id:`${this.options.id}-cluster-count`,type:"symbol",source:`${this.options.id}-points`,filter:["has","point_count"],layout:{"text-field":"{point_count_abbreviated}","text-size":14,"text-font":["Noto Sans Regular"]}}),this.map.on("click",`${this.options.id}-clusters`,(t=>{const e=this.map.queryRenderedFeatures(t.point,{layers:[`${this.options.id}-clusters`]}),i=e[0].properties.cluster_id;this.map.getSource(`${this.options.id}-points`).getClusterExpansionZoom(i,((t,i)=>{t||this.map.easeTo({center:e[0].geometry.coordinates,zoom:i})}))})),this.map.on("mouseenter",`${this.options.id}-clusters`,(()=>{this.map.getCanvas().style.cursor="pointer"})),this.map.on("mouseleave",`${this.options.id}-clusters`,(()=>{this.map.getCanvas().style.cursor=""}))}setGeoJSON(t){if("string"==typeof t&&G(t)){this.geojson=yt;const e=async()=>{try{const e=await window.fetch(t),i=await e.json();this.geojson=i,this.updateData(i),this.callFitBounds&&(this.fitBounds(),this.callFitBounds=!1)}catch(t){console.error("[Geolonia] Failed to load GeoJSON:",t)}};this._loadingPromise=e()}else this.geojson=t}}const vt="#000000",bt="#FFFFFF",wt="rgba(255, 0, 0, 0.4)",Et="#FFFFFF";class Tt extends e().Map{constructor(i){const r=function(t){if(X(t))return t;if("string"==typeof t)return document.querySelector(t)||document.getElementById(t)||!1;if(t.container){if(X(t.container))return t.container;if("string"==typeof t.container)return document.querySelector(t.container)||document.getElementById(t.container)||!1}return!1}(i);if(!r)throw"string"==typeof i?new Error(`[Geolonia] No HTML elements found matching \`${i}\`. Please ensure the map container element exists.`):new Error("[Geolonia] No HTML elements found. Please ensure the map container element exists.");if(r.geoloniaMap)return r.geoloniaMap;0===r.clientHeight&&console.warn("[Geolonia] Embed API failed to render the map because the container has no height. Please set the CSS property `height` to the container.");const n=at(r,{interactive:"object"!=typeof i||i.interactive}),o=function(t,e,i){e.container&&delete e.container,e===t&&(e={});const r={style:i.style||e.style,container:t,center:[parseFloat(i.lng),parseFloat(i.lat)],bearing:parseFloat(i.bearing),pitch:parseFloat(i.pitch),zoom:parseFloat(i.zoom),hash:"on"===i.hash,localIdeographFontFamily:"sans-serif",attributionControl:!1};return""===i.minZoom||0!==Number(i.minZoom)&&!Number(i.minZoom)||(r.minZoom=Number(i.minZoom)),""!==i.maxZoom&&Number(i.maxZoom)&&(r.maxZoom=Number(i.maxZoom)),Object.assign(r,e),r}(r,i,n),a=r.innerHTML.trim();let s;r.innerHTML="","off"!==n.loader&&(s=document.createElement("div"),s.addEventListener("touchmove",(t=>{t.touches&&t.touches.length>1&&t.preventDefault()})),s.className="loading-geolonia-map",s.innerHTML='<div class="lds-grid"><div></div><div></div><div></div>\n <div></div><div></div><div></div><div></div><div></div><div></div></div>',r.appendChild(s));const l=Y(40),c=new URL(`${n.apiUrl}/sources`);c.searchParams.set("key",n.key),c.searchParams.set("sessionId",l);const h=o.transformRequest;o.transformRequest=(t,e)=>{if("Source"===e&&t.startsWith("https://api.geolonia.com"))return{url:c.toString()};let i=t;if(t.startsWith("geolonia://")){const e=t.match(/^geolonia:\/\/tiles\/(?<username>.+)\/(?<customtileId>.+)/);e&&(i=`https://tileserver.geolonia.com/customtiles/${e.groups.customtileId}/tiles.json`)}const r=new URL(i);if("Source"===e&&i.startsWith("https://tileserver.geolonia.com"))return"v1"!==n.stage&&(r.hostname=`tileserver-${n.stage}.geolonia.com`),r.searchParams.set("sessionId",l),r.searchParams.set("key",n.key),{url:r.toString()};if(("SpriteJSON"===e||"SpriteImage"===e)&&i.match(/^https:\/\/api\.geolonia\.com\/(dev|v1)\/sprites\//)){const t=r.pathname.split("/");return t[1]=n.stage,r.pathname=t.join("/"),r.searchParams.set("key",n.key),{url:r.toString()}}let o;return"function"==typeof h&&(o=h(i,e)),o},super(o);const u=this;this.geoloniaSourcesUrl=c,this.__styleExtensionLoadRequired=!0;const{position:p}=W(n.geoloniaControl);u.addControl(new tt,p),u.addControl(new class{constructor(t={}){var e;this.options=t,this._map,this._compact,this._container,this._shadowContainer,this._innerContainer,this._compactButton,this._editLink,this._attribHTML,this.styleId,this.styleOwner,e=this,["_toggleAttribution","_updateData","_updateCompact","_updateCompactMinimize"].forEach((t=>{e[t]&&(e[t]=e[t].bind(e))}))}getDefaultPosition(){return"bottom-right"}onAdd(t){this._map=t,this._compact=this.options&&this.options.compact,this._container=rt.create("div");const e=this._container.attachShadow({mode:"open"});this._shadowContainer=rt.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=rt.create("summary","maplibregl-ctrl-attrib-button",this._shadowContainer),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=rt.create("div","maplibregl-ctrl-attrib-inner",this._shadowContainer);const i=document.createElement("style");return i.textContent="\n .maplibregl-ctrl {\n font: 12px/20px Helvetica Neue,Arial,Helvetica,sans-serif;\n clear: both;\n pointer-events: auto;\n transform: translate(0);\n }\n\n .maplibregl-ctrl-attrib-button:focus,.maplibregl-ctrl-group button:focus {\n box-shadow: 0 0 2px 2px #0096ff\n }\n\n .maplibregl-ctrl.maplibregl-ctrl-attrib {\n background-color: hsla(0,0%,100%,.5);\n margin: 0;\n padding: 0 5px\n }\n\n @media screen {\n .maplibregl-ctrl-attrib.maplibregl-compact {\n background-color: #fff;\n border-radius: 12px;\n box-sizing: content-box;\n min-height: 20px;\n padding: 2px 24px 2px 0;\n position: relative;\n margin: 10px 10px 10px auto;\n width: 0;\n }\n\n .maplibregl-ctrl-attrib.maplibregl-compact-show {\n padding: 2px 28px 2px 8px;\n visibility: visible;\n width: auto;\n }\n\n .maplibregl-ctrl-bottom-left>.maplibregl-ctrl-attrib.maplibregl-compact-show,.maplibregl-ctrl-top-left>.maplibregl-ctrl-attrib.maplibregl-compact-show {\n border-radius: 12px;\n padding: 2px 8px 2px 28px\n }\n\n .maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-inner {\n display: none\n }\n\n .maplibregl-ctrl-attrib-button {\n background-color: hsla(0,0%,100%,.5);\n background-image: url(\"data:image/svg+xml;charset=utf-8,%3Csvg width='24' height='24' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill-rule='evenodd'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E\");\n border: 0;\n border-radius: 12px;\n box-sizing: border-box;\n cursor: pointer;\n display: none;\n height: 24px;\n outline: none;\n position: absolute;\n right: 0;\n top: 0;\n width: 24px\n }\n\n .maplibregl-ctrl-attrib summary.maplibregl-ctrl-attrib-button {\n appearance: none;\n list-style: none\n }\n\n .maplibregl-ctrl-attrib summary.maplibregl-ctrl-attrib-button::-webkit-details-marker {\n display: none\n }\n\n .maplibregl-ctrl-bottom-left .maplibregl-ctrl-attrib-button,.maplibregl-ctrl-top-left .maplibregl-ctrl-attrib-button {\n left: 0\n }\n\n .maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-button,.maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-inner {\n display: block\n }\n\n .maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-button {\n background-color: rgb(0 0 0/5%)\n }\n\n .maplibregl-ctrl-bottom-right>.maplibregl-ctrl-attrib.maplibregl-compact:after {\n bottom: 0;\n right: 0\n }\n\n .maplibregl-ctrl-top-right>.maplibregl-ctrl-attrib.maplibregl-compact:after {\n right: 0;\n top: 0\n }\n\n .maplibregl-ctrl-top-left>.maplibregl-ctrl-attrib.maplibregl-compact:after {\n left: 0;\n top: 0\n }\n\n .maplibregl-ctrl-bottom-left>.maplibregl-ctrl-attrib.maplibregl-compact:after {\n bottom: 0;\n left: 0\n }\n }\n\n @media screen and (-ms-high-contrast:active) {\n .maplibregl-ctrl-attrib.maplibregl-compact:after {\n background-image: url(\"data:image/svg+xml;charset=utf-8,%3Csvg width='24' height='24' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill-rule='evenodd' fill='%23fff'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E\")\n }\n }\n\n @media screen and (-ms-high-contrast:black-on-white) {\n .maplibregl-ctrl-attrib.maplibregl-compact:after {\n background-image: url(\"data:image/svg+xml;charset=utf-8,%3Csvg width='24' height='24' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill-rule='evenodd'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E\")\n }\n }\n\n .maplibregl-ctrl-attrib a {\n color: rgba(0,0,0,.75);\n text-decoration: none;\n white-space: nowrap;\n }\n\n .maplibregl-ctrl-attrib a:hover {\n color: inherit;\n text-decoration: underline\n }\n\n .maplibregl-attrib-empty {\n display: none\n }\n ",this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("terrain",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),e.appendChild(i),e.appendChild(this._shadowContainer),this._container}onRemove(){rt.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(t,e){const i=this._map._getUIString(`AttributionControl.${e}`);t.title=i,t.setAttribute("aria-label",i)}_toggleAttribution(){this._shadowContainer.classList.contains("maplibregl-compact")&&(this._shadowContainer.classList.contains("maplibregl-compact-show")?(this._shadowContainer.setAttribute("open",""),this._shadowContainer.classList.remove("maplibregl-compact-show")):(this._shadowContainer.classList.add("maplibregl-compact-show"),this._shadowContainer.removeAttribute("open")))}_updateData(t){!t||"metadata"!==t.sourceDataType&&"visibility"!==t.sourceDataType&&"style"!==t.dataType&&"terrain"!==t.type||this._updateAttributions()}_updateAttributions(){if(!this._map.style)return;let t=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=t.concat(this.options.customAttribution.map((t=>"string"!=typeof t?"":t))):"string"==typeof this.options.customAttribution&&t.push(this.options.customAttribution)),this._map.style.stylesheet){const t=this._map.style.stylesheet;this.styleOwner=t.owner,this.styleId=t.id}const e=this._map.style.sourceCaches;for(const i in e){const r=e[i];if(r.used||r.usedForTerrain){const e=r.getSource();e.attribution&&t.indexOf(e.attribution)<0&&t.push(e.attribution)}}t=t.filter((t=>String(t).trim())),t.sort(((t,e)=>t.length-e.length)),t=t.filter(((e,i)=>{for(let r=i+1;r<t.length;r++)if(t[r].indexOf(e)>=0)return!1;return!0}));const i=t.join(" | ");i!==this._attribHTML&&(this._attribHTML=i,t.length?(this._innerContainer.innerHTML=i,this._shadowContainer.classList.remove("maplibregl-attrib-empty")):this._shadowContainer.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}_updateCompact(){this._map.getCanvasContainer().offsetWidth<=640||this._compact?!1===this._compact?this._shadowContainer.setAttribute("open",""):this._shadowContainer.classList.contains("maplibregl-compact")||this._shadowContainer.classList.contains("maplibregl-attrib-empty")||(this._shadowContainer.setAttribute("open",""),this._shadowContainer.classList.add("maplibregl-compact","maplibregl-compact-show")):(this._shadowContainer.setAttribute("open",""),this._shadowContainer.classList.contains("maplibregl-compact")&&this._shadowContainer.classList.remove("maplibregl-compact","maplibregl-compact-show"))}_updateCompactMinimize(){this._shadowContainer.classList.contains("maplibregl-compact")&&this._shadowContainer.classList.contains("maplibregl-compact-show")&&this._shadowContainer.classList.remove("maplibregl-compact-show")}},"bottom-right");const{enabled:d,position:m}=W(n.fullscreenControl);d&&u.addControl(new t.FullscreenControl,m);const{enabled:f,position:g}=W(n.navigationControl);f&&u.addControl(new t.NavigationControl,g);const{enabled:_,position:y}=W(n.geolocateControl);_&&u.addControl(new t.GeolocateControl({}),y);const{enabled:x,position:v}=W(n.scaleControl);return x&&u.addControl(new t.ScaleControl({}),v),u.on("load",(e=>{const i=e.target;if("off"!==n.loader)try{r.removeChild(s)}catch(t){}if("off"!==n.gestureHandling&&function(){const t=document.body,e=document.documentElement;return t.scrollHeight>t.clientHeight||e.scrollHeight>e.clientHeight}()&&new ot({lang:n.lang}).addTo(i),n.lat&&n.lng&&"on"===n.marker)if(a){const e=new t.Popup({offset:[0,-25]}).setHTML(a);let r;if(n.customMarker){const t=n.customMarkerOffset.split(/,/).map((t=>Number(t.trim()))),a=document.querySelector(n.customMarker);a.style.display="block",r=new Q({element:a,offset:t}).setLngLat(o.center).addTo(i).setPopup(e)}else r=new Q({color:n.markerColor}).setLngLat(o.center).addTo(i).setPopup(e);"on"===n.openPopup&&r.togglePopup(),r.getElement().classList.add("geolonia-clickable-marker")}else new Q({color:n.markerColor}).setLngLat(o.center).addTo(i)})),u.on("styledata",(async t=>{const i=t.target;if(this.__styleExtensionLoadRequired){if(this.__styleExtensionLoadRequired=!1,n.simpleVector){const t=(o=n.simpleVector,/^(https?|geolonia):\/\//.test(o)?o:`geolonia://tiles/custom/${o}`);new class{constructor(t){this.url=t,this.sourceName="vt-geolonia-simple-style"}addTo(t){const e=t.getContainer();if(!e.dataset||!e.dataset.lng&&!e.dataset.lat){let e=!1;t.on("sourcedata",(i=>{if(i.sourceId!==this.sourceName)return;const r=t.getSource(i.sourceId);!0===(r&&r.loaded())&&(e||(e=!0,t.fitBounds(r.bounds,{duration:0,padding:30})))}))}t.addSource(this.sourceName,{type:"vector",url:this.url}),this.setPolygonGeometries(t),this.setLineGeometries(t),t.addLayer({id:"vt-geolonia-simple-style-polygon-symbol",type:"symbol",source:this.sourceName,"source-layer":"g-simplestyle-v1",filter:["==","$type","Polygon"],paint:{"text-color":["string",["get","text-color"],vt],"text-halo-color":["string",["get","text-halo-color"],bt],"text-halo-width":1},layout:{"text-field":["get","title"],"text-font":["Noto Sans Regular"],"text-size":12,"text-max-width":12,"text-allow-overlap":!1}}),t.addLayer({id:"vt-geolonia-simple-style-linestring-symbol",type:"symbol",source:this.sourceName,"source-layer":"g-simplestyle-v1",filter:["==","$type","LineString"],paint:{"text-color":["string",["get","text-color"],vt],"text-halo-color":["string",["get","text-halo-color"],bt],"text-halo-width":1},layout:{"symbol-placement":"line","text-field":["get","title"],"text-font":["Noto Sans Regular"],"text-size":12,"text-max-width":12,"text-allow-overlap":!1}}),this.setPointGeometries(t)}setPolygonGeometries(t){t.addLayer({id:"vt-geolonia-simple-style-polygon",type:"fill",source:this.sourceName,"source-layer":"g-simplestyle-v1",filter:["==","$type","Polygon"],paint:{"fill-color":["string",["get","fill"],wt],"fill-opacity":["number",["get","fill-opacity"],1],"fill-outline-color":["string",["get","stroke"],Et]}}),this.setPopup(t,"vt-geolonia-simple-style-polygon")}setLineGeometries(t){t.addLayer({id:"vt-geolonia-simple-style-linestring",type:"line",source:this.sourceName,"source-layer":"g-simplestyle-v1",filter:["==","$type","LineString"],paint:{"line-width":["number",["get","stroke-width"],2],"line-color":["string",["get","stroke"],wt],"line-opacity":["number",["get","stroke-opacity"],1]},layout:{"line-cap":"round","line-join":"round"}}),this.setPopup(t,"vt-geolonia-simple-style-linestring")}setPointGeometries(t){t.addLayer({id:"vt-circle-simple-style-points",type:"circle",source:this.sourceName,"source-layer":"g-simplestyle-v1",filter:["all",["==","$type","Point"],["!has","marker-symbol"]],paint:{"circle-radius":["case",["==","small",["get","marker-size"]],7,["==","large",["get","marker-size"]],13,9],"circle-color":["string",["get","marker-color"],wt],"circle-opacity":["number",["get","fill-opacity"],1],"circle-stroke-width":["number",["get","stroke-width"],1],"circle-stroke-color":["string",["get","stroke"],Et],"circle-stroke-opacity":["number",["get","stroke-opacity"],1]}}),t.addLayer({id:"vt-geolonia-simple-style-points",type:"symbol",source:this.sourceName,"source-layer":"g-simplestyle-v1",filter:["==","$type","Point"],paint:{"text-color":["string",["get","text-color"],vt],"text-halo-color":["string",["get","text-halo-color"],bt],"text-halo-width":1},layout:{"icon-image":["get","marker-symbol"],"text-field":["get","title"],"text-font":["Noto Sans Regular"],"text-size":12,"text-anchor":"top","text-max-width":12,"text-offset":["case",["==","small",["get","marker-size"]],["literal",[0,.6]],["==","large",["get","marker-size"]],["literal",[0,1.2]],["literal",[0,.8]]],"text-allow-overlap":!1}}),this.setPopup(t,"vt-circle-simple-style-points"),this.setPopup(t,"vt-geolonia-simple-style-points")}async setPopup(t,i){t.on("click",i,(async i=>{const r=dt(i.features[0]).geometry.coordinates,n=i.features[0].properties.description;if(n){const i=await J(n);(new(e().Popup)).setLngLat(r).setHTML(i).addTo(t)}})),t.on("mouseenter",i,(e=>{e.features[0].properties.description&&(t.getCanvas().style.cursor="pointer")})),t.on("mouseleave",i,(()=>{t.getCanvas().style.cursor=""}))}}(t).addTo(i)}var o;if(n.geojson){const t=(t=>{if(/^https?:\/\//.test(t))return!1;if(/^\//.test(t))return!1;if(/^\.\//.test(t))return!1;if(/^\.\.\//.test(t))return!1;try{return document.querySelector(t)}catch(t){return!1}})(n.geojson);let e;e=t?JSON.parse(t.textContent):n.geojson;const o=new xt(e,{cluster:"on"===n.cluster,clusterColor:n.clusterColor});o.addTo(i),r.dataset&&(r.dataset.lng||r.dataset.lat)||o.fitBounds()}n["3d"]&&i.getStyle().layers.forEach((t=>{"on"===n["3d"]&&t.metadata&&!0===t.metadata["visible-on-3d"]?i.setLayoutProperty(t.id,"visibility","visible"):"off"===n["3d"]&&t.metadata&&!0===t.metadata["visible-on-3d"]||"on"===n["3d"]&&t.metadata&&!0===t.metadata["hide-on-3d"]?i.setLayoutProperty(t.id,"visibility","none"):"off"===n["3d"]&&t.metadata&&!0===t.metadata["hide-on-3d"]&&i.setLayoutProperty(t.id,"visibility","visible")}))}})),u.on("error",(async t=>{t.error&&402===t.error.status&&(t=>{if(!t._geolonia_restricted_mode_handled){t._geolonia_restricted_mode_handled=!0;const e=t.getContainer();t.remove(),e.innerHTML="",e.classList.add("geolonia__restricted-mode-image-container")}})(u)})),r.geoloniaMap=u,u}setStyle(t,e={}){if(null!==t){const e=at(this.getContainer());"string"==typeof t&&(t=function(t,e){return G(t)||("ja"===e.lang?`https://cdn.geolonia.com/style/${t}/ja.json`:`https://cdn.geolonia.com/style/${t}/en.json`)}(t,e))}return this.__styleExtensionLoadRequired=!0,super.setStyle.call(this,t,e),this}remove(){const t=this.getContainer();super.remove.call(this),delete t.geoloniaMap}}const St="4.2.0";var Ct=a(3379),It=a.n(Ct),At=a(7795),Mt=a.n(At),kt=a(569),zt=a.n(kt),Pt=a(3565),Lt=a.n(Pt),Dt=a(9216),Rt=a.n(Dt),Bt=a(4589),Ft=a.n(Bt),Ot=a(7274),Ut={};Ut.styleTagTransform=Ft(),Ut.setAttributes=Lt(),Ut.insert=zt().bind(null,"head"),Ut.domAPI=Mt(),Ut.insertStyleElement=Rt(),It()(Ot.Z,Ut),Ot.Z&&Ot.Z.locals&&Ot.Z.locals;var Vt=a(5426),Nt={};Nt.styleTagTransform=Ft(),Nt.setAttributes=Lt(),Nt.insert=zt().bind(null,"head"),Nt.domAPI=Mt(),Nt.insertStyleElement=Rt(),It()(Vt.Z,Nt),Vt.Z&&Vt.Z.locals&&Vt.Z.locals;var $t=(t,e,i)=>new Promise(((r,n)=>{var o=t=>{try{s(i.next(t))}catch(t){n(t)}},a=t=>{try{s(i.throw(t))}catch(t){n(t)}},s=t=>t.done?r(t.value):Promise.resolve(t.value).then(o,a);s((i=i.apply(t,e)).next())})),jt=Uint8Array,qt=Uint16Array,Zt=Int32Array,Gt=new jt([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Ht=new jt([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Xt=new jt([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Wt=function(t,e){for(var i=new qt(31),r=0;r<31;++r)i[r]=e+=1<<t[r-1];var n=new Zt(i[30]);for(r=1;r<30;++r)for(var o=i[r];o<i[r+1];++o)n[o]=o-i[r]<<5|r;return{b:i,r:n}},Kt=Wt(Gt,2),Yt=Kt.b,Jt=Kt.r;Yt[28]=258,Jt[258]=28;var Qt,te=Wt(Ht,0),ee=te.b,ie=(te.r,new qt(32768));for(oe=0;oe<32768;++oe)Qt=(61680&(Qt=(52428&(Qt=(43690&oe)>>1|(21845&oe)<<1))>>2|(13107&Qt)<<2))>>4|(3855&Qt)<<4,ie[oe]=((65280&Qt)>>8|(255&Qt)<<8)>>1;var re=function(t,e,i){for(var r=t.length,n=0,o=new qt(e);n<r;++n)t[n]&&++o[t[n]-1];var a,s=new qt(e);for(n=1;n<e;++n)s[n]=s[n-1]+o[n-1]<<1;if(i){a=new qt(1<<e);var l=15-e;for(n=0;n<r;++n)if(t[n])for(var c=n<<4|t[n],h=e-t[n],u=s[t[n]-1]++<<h,p=u|(1<<h)-1;u<=p;++u)a[ie[u]>>l]=c}else for(a=new qt(r),n=0;n<r;++n)t[n]&&(a[n]=ie[s[t[n]-1]++]>>15-t[n]);return a},ne=new jt(288);for(oe=0;oe<144;++oe)ne[oe]=8;for(oe=144;oe<256;++oe)ne[oe]=9;for(oe=256;oe<280;++oe)ne[oe]=7;for(oe=280;oe<288;++oe)ne[oe]=8;var oe,ae=new jt(32);for(oe=0;oe<32;++oe)ae[oe]=5;var se=re(ne,9,1),le=re(ae,5,1),ce=function(t){for(var e=t[0],i=1;i<t.length;++i)t[i]>e&&(e=t[i]);return e},he=function(t,e,i){var r=e/8|0;return(t[r]|t[r+1]<<8)>>(7&e)&i},ue=function(t,e){var i=e/8|0;return(t[i]|t[i+1]<<8|t[i+2]<<16)>>(7&e)},pe=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],de=function(t,e,i){var r=new Error(e||pe[t]);if(r.code=t,Error.captureStackTrace&&Error.captureStackTrace(r,de),!i)throw r;return r},me=function(t,e,i,r){var n=t.length,o=r?r.length:0;if(!n||e.f&&!e.l)return i||new jt(0);var a=!i||2!=e.i,s=e.i;i||(i=new jt(3*n));var l=function(t){var e=i.length;if(t>e){var r=new jt(Math.max(2*e,t));r.set(i),i=r}},c=e.f||0,h=e.p||0,u=e.b||0,p=e.l,d=e.d,m=e.m,f=e.n,g=8*n;do{if(!p){c=he(t,h,1);var _=he(t,h+1,3);if(h+=3,!_){var y=t[(M=4+((h+7)/8|0))-4]|t[M-3]<<8,x=M+y;if(x>n){s&&de(0);break}a&&l(u+y),i.set(t.subarray(M,x),u),e.b=u+=y,e.p=h=8*x,e.f=c;continue}if(1==_)p=se,d=le,m=9,f=5;else if(2==_){var v=he(t,h,31)+257,b=he(t,h+10,15)+4,w=v+he(t,h+5,31)+1;h+=14;for(var E=new jt(w),T=new jt(19),S=0;S<b;++S)T[Xt[S]]=he(t,h+3*S,7);h+=3*b;var C=ce(T),I=(1<<C)-1,A=re(T,C,1);for(S=0;S<w;){var M,k=A[he(t,h,I)];if(h+=15&k,(M=k>>4)<16)E[S++]=M;else{var z=0,P=0;for(16==M?(P=3+he(t,h,3),h+=2,z=E[S-1]):17==M?(P=3+he(t,h,7),h+=3):18==M&&(P=11+he(t,h,127),h+=7);P--;)E[S++]=z}}var L=E.subarray(0,v),D=E.subarray(v);m=ce(L),f=ce(D),p=re(L,m,1),d=re(D,f,1)}else de(1);if(h>g){s&&de(0);break}}a&&l(u+131072);for(var R=(1<<m)-1,B=(1<<f)-1,F=h;;F=h){var O=(z=p[ue(t,h)&R])>>4;if((h+=15&z)>g){s&&de(0);break}if(z||de(2),O<256)i[u++]=O;else{if(256==O){F=h,p=null;break}var U=O-254;if(O>264){var V=Gt[S=O-257];U=he(t,h,(1<<V)-1)+Yt[S],h+=V}var N=d[ue(t,h)&B],$=N>>4;if(N||de(3),h+=15&N,D=ee[$],$>3&&(V=Ht[$],D+=ue(t,h)&(1<<V)-1,h+=V),h>g){s&&de(0);break}a&&l(u+131072);var j=u+U;if(u<D){var q=o-D,Z=Math.min(D,j);for(q+u<0&&de(3);u<Z;++u)i[u]=r[q+u]}for(;u<j;u+=4)i[u]=i[u-D],i[u+1]=i[u+1-D],i[u+2]=i[u+2-D],i[u+3]=i[u+3-D];u=j}}e.l=p,e.p=F,e.b=u,e.f=c,p&&(c=1,e.m=m,e.d=d,e.n=f)}while(!c);return u==i.length?i:function(t,e,i){(null==e||e<0)&&(e=0),(null==i||i>t.length)&&(i=t.length);var r=new jt(i-e);return r.set(t.subarray(e,i)),r}(i,0,u)},fe=new jt(0),ge=function(t){31==t[0]&&139==t[1]&&8==t[2]||de(6,"invalid gzip data");var e=t[3],i=10;4&e&&(i+=2+(t[10]|t[11]<<8));for(var r=(e>>3&1)+(e>>4&1);r>0;r-=!t[i++]);return i+(2&e)},_e=function(t){var e=t.length;return(t[e-4]|t[e-3]<<8|t[e-2]<<16|t[e-1]<<24)>>>0},ye=function(t,e){return(8!=(15&t[0])||t[0]>>4>7||(t[0]<<8|t[1])%31)&&de(6,"invalid zlib data"),(t[1]>>5&1)==+!e&&de(6,"invalid zlib data: "+(32&t[1]?"need":"unexpected")+" dictionary"),2+(t[1]>>3&4)};function xe(t,e){return 31==t[0]&&139==t[1]&&8==t[2]?function(t,e){var i=ge(t);return i+8>t.length&&de(6,"invalid gzip data"),me(t.subarray(i,-8),{i:2},e&&e.out||new jt(_e(t)),e&&e.dictionary)}(t,e):8!=(15&t[0])||t[0]>>4>7||(t[0]<<8|t[1])%31?function(t,e){return me(t,{i:2},e&&e.out,e&&e.dictionary)}(t,e):function(t,e){return me(t.subarray(ye(t,e&&e.dictionary),-4),{i:2},e&&e.out,e&&e.dictionary)}(t,e)}var ve="undefined"!=typeof TextDecoder&&new TextDecoder;try{ve.decode(fe,{stream:!0})}catch(t){}var be=(t,e)=>t*Math.pow(2,e),we=(t,e)=>Math.floor(t/Math.pow(2,e)),Ee=(t,e)=>be(t.getUint16(e+1,!0),8)+t.getUint8(e),Te=(t,e)=>be(t.getUint32(e+2,!0),16)+t.getUint16(e,!0),Se=(t,e,i,r,n)=>{if(t!=r.getUint8(n))return t-r.getUint8(n);const o=Ee(r,n+1);if(e!=o)return e-o;const a=Ee(r,n+4);return i!=a?i-a:0},Ce=(t,e,i,r)=>{const n=Ie(t,e,i,r);return n?{z:e,x:i,y:r,offset:n[0],length:n[1],is_dir:!1}:null},Ie=(t,e,i,r)=>{let n=0,o=t.byteLength/17-1;for(;n<=o;){const a=o+n>>1,s=Se(e,i,r,t,17*a);if(s>0)n=a+1;else{if(!(s<0))return[Te(t,17*a+7),t.getUint32(17*a+13,!0)];o=a-1}}return null},Ae=(t,e)=>t.is_dir&&!e.is_dir?1:!t.is_dir&&e.is_dir?-1:t.z!==e.z?t.z-e.z:t.x!==e.x?t.x-e.x:t.y-e.y,Me=(t,e)=>{const i=t.getUint8(17*e);return{z:127&i,x:Ee(t,17*e+1),y:Ee(t,17*e+4),offset:Te(t,17*e+7),length:t.getUint32(17*e+13,!0),is_dir:i>>7==1}},ke=t=>{const e=[],i=new DataView(t);for(let t=0;t<i.byteLength/17;t++)e.push(Me(i,t));return ze(e)},ze=t=>{t.sort(Ae);const e=new ArrayBuffer(17*t.length),i=new Uint8Array(e);for(let e=0;e<t.length;e++){const r=t[e];let n=r.z;r.is_dir&&(n|=128),i[17*e]=n,i[17*e+1]=255&r.x,i[17*e+2]=r.x>>8&255,i[17*e+3]=r.x>>16&255,i[17*e+4]=255&r.y,i[17*e+5]=r.y>>8&255,i[17*e+6]=r.y>>16&255,i[17*e+7]=255&r.offset,i[17*e+8]=255&we(r.offset,8),i[17*e+9]=255&we(r.offset,16),i[17*e+10]=255&we(r.offset,24),i[17*e+11]=255&we(r.offset,32),i[17*e+12]=255&we(r.offset,48),i[17*e+13]=255&r.length,i[17*e+14]=r.length>>8&255,i[17*e+15]=r.length>>16&255,i[17*e+16]=r.length>>24&255}return e},Pe={getHeader:function(t){return $t(this,null,(function*(){const e=yield t.getBytes(0,512e3),i=new DataView(e.data),r=i.getUint32(4,!0),n=i.getUint16(8,!0),o=new TextDecoder("utf-8"),a=JSON.parse(o.decode(new DataView(e.data,10,r)));let s=0;"gzip"===a.compression&&(s=2);let l=0;"minzoom"in a&&(l=+a.minzoom);let c=0;"maxzoom"in a&&(c=+a.maxzoom);let h=0,u=0,p=0,d=-180,m=-85,f=180,g=85;if(a.bounds){const t=a.bounds.split(",");d=+t[0],m=+t[1],f=+t[2],g=+t[3]}if(a.center){const t=a.center.split(",");h=+t[0],u=+t[1],p=+t[2]}return{specVersion:i.getUint16(2,!0),rootDirectoryOffset:10+r,rootDirectoryLength:17*n,jsonMetadataOffset:10,jsonMetadataLength:r,leafDirectoryOffset:0,leafDirectoryLength:void 0,tileDataOffset:0,tileDataLength:void 0,numAddressedTiles:0,numTileEntries:0,numTileContents:0,clustered:!1,internalCompression:1,tileCompression:s,tileType:1,minZoom:l,maxZoom:c,minLon:d,minLat:m,maxLon:f,maxLat:g,centerZoom:p,centerLon:h,centerLat:u,etag:e.etag}}))},getZxy:function(t,e,i,r,n,o,a){return $t(this,null,(function*(){let s=yield i.getArrayBuffer(e,t.rootDirectoryOffset,t.rootDirectoryLength,t);1===t.specVersion&&(s=ke(s));const l=Ce(new DataView(s),r,n,o);if(l){let t=(yield e.getBytes(l.offset,l.length,a)).data;const i=new DataView(t);return 31==i.getUint8(0)&&139==i.getUint8(1)&&(t=xe(new Uint8Array(t))),{data:t}}const c=((t,e)=>{if(t.byteLength<17)return null;const i=t.byteLength/17,r=Me(t,i-1);if(r.is_dir){const t=r.z,i=e.z-t;return{z:t,x:Math.trunc(e.x/(1<<i)),y:Math.trunc(e.y/(1<<i))}}return null})(new DataView(s),{z:r,x:n,y:o});if(c){const l=((t,e,i,r)=>{const n=Ie(t,128|e,i,r);return n?{z:e,x:i,y:r,offset:n[0],length:n[1],is_dir:!0}:null})(new DataView(s),c.z,c.x,c.y);if(l){let s=yield i.getArrayBuffer(e,l.offset,l.length,t);1===t.specVersion&&(s=ke(s));const c=Ce(new DataView(s),r,n,o);if(c){let t=(yield e.getBytes(c.offset,c.length,a)).data;const i=new DataView(t);return 31==i.getUint8(0)&&139==i.getUint8(1)&&(t=xe(new Uint8Array(t))),{data:t}}}}}))}};function Le(t,e){return 4294967296*(e>>>0)+(t>>>0)}function De(t){const e=t.buf;let i,r;return r=e[t.pos++],i=127&r,r<128?i:(r=e[t.pos++],i|=(127&r)<<7,r<128?i:(r=e[t.pos++],i|=(127&r)<<14,r<128?i:(r=e[t.pos++],i|=(127&r)<<21,r<128?i:(r=e[t.pos],i|=(15&r)<<28,function(t,e){const i=e.buf;let r,n;if(n=i[e.pos++],r=(112&n)>>4,n<128)return Le(t,r);if(n=i[e.pos++],r|=(127&n)<<3,n<128)return Le(t,r);if(n=i[e.pos++],r|=(127&n)<<10,n<128)return Le(t,r);if(n=i[e.pos++],r|=(127&n)<<17,n<128)return Le(t,r);if(n=i[e.pos++],r|=(127&n)<<24,n<128)return Le(t,r);if(n=i[e.pos++],r|=(1&n)<<31,n<128)return Le(t,r);throw new Error("Expected varint not more than 10 bytes")}(i,t)))))}function Re(t,e,i,r){if(0==r){1==i&&(e[0]=t-1-e[0],e[1]=t-1-e[1]);const r=e[0];e[0]=e[1],e[1]=r}}var Be=[0,1,5,21,85,341,1365,5461,21845,87381,349525,1398101,5592405,22369621,89478485,357913941,1431655765,5726623061,22906492245,91625968981,366503875925,1466015503701,5864062014805,23456248059221,93824992236885,375299968947541,0x5555555555555];function Fe(t,e){return $t(this,null,(function*(){if(1===e||0===e)return t;if(2===e){if(void 0===globalThis.DecompressionStream)return xe(new Uint8Array(t));{let e=new Response(t).body.pipeThrough(new globalThis.DecompressionStream("gzip"));return new Response(e).arrayBuffer()}}throw Error("Compression method not supported")}))}function Oe(t,e){let i=0,r=t.length-1;for(;i<=r;){const n=r+i>>1,o=e-t[n].tileId;if(o>0)i=n+1;else{if(!(o<0))return t[n];r=n-1}}if(r>=0){if(0===t[r].runLength)return t[r];if(e-t[r].tileId<t[r].runLength)return t[r]}return null}function Ue(t,e){const i=t.getUint32(e+4,!0),r=t.getUint32(e+0,!0);return i*Math.pow(2,32)+r}function Ve(t){const e={buf:new Uint8Array(t),pos:0},i=De(e),r=[];let n=0;for(let t=0;t<i;t++){const t=De(e);r.push({tileId:n+t,offset:0,length:0,runLength:1}),n+=t}for(let t=0;t<i;t++)r[t].runLength=De(e);for(let t=0;t<i;t++)r[t].length=De(e);for(let t=0;t<i;t++){const i=De(e);r[t].offset=0===i&&t>0?r[t-1].offset+r[t-1].length:i-1}return r}var Ne=class extends Error{};var $e=class{constructor(t,e,i){this.source="string"==typeof t?new class{constructor(t){this.url=t}getKey(){return this.url}getBytes(t,e,i){return $t(this,null,(function*(){let r;i||(r=new AbortController,i=r.signal);let n=yield fetch(this.url,{signal:i,headers:{Range:"bytes="+t+"-"+(t+e-1)}});if(416===n.status&&0===t){const t=n.headers.get("Content-Range");if(!t||!t.startsWith("bytes */"))throw Error("Missing content-length on 416 response");const e=+t.substr(8);n=yield fetch(this.url,{signal:i,headers:{Range:"bytes=0-"+(e-1)}})}if(n.status>=300)throw Error("Bad response code: "+n.status);const o=n.headers.get("Content-Length");if(200===n.status&&(!o||+o>e))throw r&&r.abort(),Error("Server returned no content-length header or content-length exceeding request. Check that your storage backend supports HTTP Byte Serving.");return{data:yield n.arrayBuffer(),etag:n.headers.get("ETag")||void 0,cacheControl:n.headers.get("Cache-Control")||void 0,expires:n.headers.get("Expires")||void 0}}))}}(t):t,this.decompress=i||Fe,this.cache=e||new class{constructor(t=100,e=!0,i=Fe){this.cache=new Map,this.maxCacheEntries=t,this.counter=1,this.prefetch=e,this.decompress=i}getHeader(t,e){return $t(this,null,(function*(){const i=t.getKey();if(this.cache.has(i))return this.cache.get(i).lastUsed=this.counter++,yield this.cache.get(i).data;const r=new Promise(((i,r)=>{(function(t,e,i,r){return $t(this,null,(function*(){const n=yield t.getBytes(0,16384);if(19792!==new DataView(n.data).getUint16(0,!0))throw new Error("Wrong magic number for PMTiles archive");if(function(t){const e=new DataView(t);return 2===e.getUint16(2,!0)?(console.warn("PMTiles spec version 2 has been deprecated; please see github.com/protomaps/PMTiles for tools to upgrade"),2):1===e.getUint16(2,!0)?(console.warn("PMTiles spec version 1 has been deprecated; please see github.com/protomaps/PMTiles for tools to upgrade"),1):3}(n.data)<3)return[yield Pe.getHeader(t)];const o=n.data.slice(0,127);let a=n.etag;r&&n.etag!=r&&(console.warn("ETag conflict detected; your HTTP server might not support content-based ETag headers. ETags disabled for "+t.getKey()),a=void 0);const s=function(t,e){const i=new DataView(t),r=i.getUint8(7);if(r>3)throw Error(`Archive is spec version ${r} but this library supports up to spec version 3`);return{specVersion:r,rootDirectoryOffset:Ue(i,8),rootDirectoryLength:Ue(i,16),jsonMetadataOffset:Ue(i,24),jsonMetadataLength:Ue(i,32),leafDirectoryOffset:Ue(i,40),leafDirectoryLength:Ue(i,48),tileDataOffset:Ue(i,56),tileDataLength:Ue(i,64),numAddressedTiles:Ue(i,72),numTileEntries:Ue(i,80),numTileContents:Ue(i,88),clustered:1===i.getUint8(96),internalCompression:i.getUint8(97),tileCompression:i.getUint8(98),tileType:i.getUint8(99),minZoom:i.getUint8(100),maxZoom:i.getUint8(101),minLon:i.getInt32(102,!0)/1e7,minLat:i.getInt32(106,!0)/1e7,maxLon:i.getInt32(110,!0)/1e7,maxLat:i.getInt32(114,!0)/1e7,centerZoom:i.getUint8(118),centerLon:i.getInt32(119,!0)/1e7,centerLat:i.getInt32(123,!0)/1e7,etag:e}}(o,a);if(i){const i=n.data.slice(s.rootDirectoryOffset,s.rootDirectoryOffset+s.rootDirectoryLength),r=t.getKey()+"|"+(s.etag||"")+"|"+s.rootDirectoryOffset+"|"+s.rootDirectoryLength,o=Ve(yield e(i,s.internalCompression));return[s,[r,o.length,o]]}return[s,void 0]}))})(t,this.decompress,this.prefetch,e).then((t=>{t[1]&&this.cache.set(t[1][0],{lastUsed:this.counter++,data:Promise.resolve(t[1][2])}),i(t[0]),this.prune()})).catch((t=>{r(t)}))}));return this.cache.set(i,{lastUsed:this.counter++,data:r}),r}))}getDirectory(t,e,i,r){return $t(this,null,(function*(){const n=t.getKey()+"|"+(r.etag||"")+"|"+e+"|"+i;if(this.cache.has(n))return this.cache.get(n).lastUsed=this.counter++,yield this.cache.get(n).data;const o=new Promise(((n,o)=>{(function(t,e,i,r,n){return $t(this,null,(function*(){const o=yield t.getBytes(i,r);if(n.etag&&n.etag!==o.etag)throw new Ne(o.etag);const a=Ve(yield e(o.data,n.internalCompression));if(0===a.length)throw new Error("Empty directory is invalid");return a}))})(t,this.decompress,e,i,r).then((t=>{n(t),this.prune()})).catch((t=>{o(t)}))}));return this.cache.set(n,{lastUsed:this.counter++,data:o}),o}))}getArrayBuffer(t,e,i,r){return $t(this,null,(function*(){const n=t.getKey()+"|"+(r.etag||"")+"|"+e+"|"+i;if(this.cache.has(n))return this.cache.get(n).lastUsed=this.counter++,yield this.cache.get(n).data;const o=new Promise(((o,a)=>{t.getBytes(e,i).then((t=>{if(r.etag&&r.etag!==t.etag)throw new Ne(t.etag);o(t.data),this.cache.has(n),this.prune()})).catch((t=>{a(t)}))}));return this.cache.set(n,{lastUsed:this.counter++,data:o}),o}))}prune(){if(this.cache.size>=this.maxCacheEntries){let t,e=1/0;this.cache.forEach(((i,r)=>{i.lastUsed<e&&(e=i.lastUsed,t=r)})),t&&this.cache.delete(t)}}invalidate(t,e){return $t(this,null,(function*(){this.cache.delete(t.getKey()),yield this.getHeader(t,e)}))}}}getHeader(){return $t(this,null,(function*(){return yield this.cache.getHeader(this.source)}))}getZxyAttempt(t,e,i,r){return $t(this,null,(function*(){const n=function(t,e,i){if(t>26)throw Error("Tile zoom level exceeds max safe number limit (26)");if(e>Math.pow(2,t)-1||i>Math.pow(2,t)-1)throw Error("tile x/y outside zoom level bounds");const r=Be[t];let n=0,o=0,a=0;const s=[e,i];let l=Math.pow(2,t)/2;for(;l>0;)n=(s[0]&l)>0?1:0,o=(s[1]&l)>0?1:0,a+=l*l*(3*n^o),Re(l,s,n,o),l/=2;return r+a}(t,e,i),o=yield this.cache.getHeader(this.source);if(o.specVersion<3)return Pe.getZxy(o,this.source,this.cache,t,e,i,r);if(t<o.minZoom||t>o.maxZoom)return;let a=o.rootDirectoryOffset,s=o.rootDirectoryLength;for(let t=0;t<=3;t++){const t=Oe(yield this.cache.getDirectory(this.source,a,s,o),n);if(!t)return;if(t.runLength>0){const e=yield this.source.getBytes(o.tileDataOffset+t.offset,t.length,r);if(o.etag&&o.etag!==e.etag)throw new Ne(e.etag);return{data:yield this.decompress(e.data,o.tileCompression),cacheControl:e.cacheControl,expires:e.expires}}a=o.leafDirectoryOffset+t.offset,s=t.length}throw Error("Maximum directory depth exceeded")}))}getZxy(t,e,i,r){return $t(this,null,(function*(){try{return yield this.getZxyAttempt(t,e,i,r)}catch(n){if(n instanceof Ne)return this.cache.invalidate(this.source,n.message),yield this.getZxyAttempt(t,e,i,r);throw n}}))}getMetadataAttempt(){return $t(this,null,(function*(){const t=yield this.cache.getHeader(this.source),e=yield this.source.getBytes(t.jsonMetadataOffset,t.jsonMetadataLength);if(t.etag&&t.etag!==e.etag)throw new Ne(e.etag);const i=yield this.decompress(e.data,t.internalCompression),r=new TextDecoder("utf-8");return JSON.parse(r.decode(i))}))}getMetadata(){return $t(this,null,(function*(){try{return yield this.getMetadataAttempt()}catch(t){if(t instanceof Ne)return this.cache.invalidate(this.source,t.message),yield this.getMetadataAttempt();throw t}}))}};const je=[],qe=Object.assign(window.geolonia||{},t,{Map:Tt,Marker:Q,SimpleStyle:xt,simpleStyle:xt,embedVersion:St,registerPlugin:t=>{je.push(t)}});window.geolonia=window.maplibregl=window.mapboxgl=qe,(()=>{const t=new class{constructor(){this.tile=(t,e)=>{if("json"==t.type){const i=t.url.substr(10);let r=this.tiles.get(i);return r||(r=new $e(i),this.tiles.set(i,r)),r.getHeader().then((i=>{const r={tiles:[t.url+"/{z}/{x}/{y}"],minzoom:i.minZoom,maxzoom:i.maxZoom,bounds:[i.minLon,i.minLat,i.maxLon,i.maxLat]};e(null,r,null,null)})).catch((t=>{e(t,null,null,null)})),{cancel:()=>{}}}{const i=new RegExp(/pmtiles:\/\/(.+)\/(\d+)\/(\d+)\/(\d+)/),r=t.url.match(i);if(!r)throw new Error("Invalid PMTiles protocol URL");const n=r[1];let o=this.tiles.get(n);o||(o=new $e(n),this.tiles.set(n,o));const a=r[2],s=r[3],l=r[4],c=new AbortController,h=c.signal;let u=()=>{c.abort()};return o.getHeader().then((t=>{o.getZxy(+a,+s,+l,h).then((i=>{i?e(null,new Uint8Array(i.data),i.cacheControl,i.expires):1==t.tileType?e(null,new Uint8Array,null,null):e(null,null,null,null)})).catch((t=>{"AbortError"!==t.name&&e(t,null,null,null)}))})),{cancel:u}}},this.tiles=new Map}add(t){this.tiles.set(t.source.getKey(),t)}get(t){return this.tiles.get(t)}};if(e().addProtocol("pmtiles",t.tile),function(){if(window.self===window.parent)return!0;if(Z.apiKey)return!0;if(("https://cdpn.io"===window.self.location.origin||"https://codepen.io"===window.self.location.origin)&&window.self!==window.parent&&0===window.document.referrer.indexOf("https://codepen.io"))return!0;if("https://fiddle.jshell.net"===window.self.location.origin&&window.self!==window.parent&&0===window.document.referrer.indexOf("https://jsfiddle.net"))return!0;if(window.self.location.origin.match(/csb\.app$/)&&window.self!==window.parent&&0===window.document.referrer.indexOf("https://codesandbox.io"))return!0;try{if(window.self.location.origin===window.top.location.origin)return!0}catch(t){return!1}return!1}()){let t=!1;const e=[],i=Symbol("map-is-removed");Z.parse();const r=r=>{const n=new Tt(r);n.on("remove",(()=>{n[i]=!0})),new MutationObserver((t=>{t.some((t=>[...t.removedNodes].some((t=>t===r))))&&!n[i]&&n.remove()})).observe(r.parentNode,{childList:!0});const o=at(r);t&&!n[i]?je.forEach((t=>t(n,r,o))):e.push({map:n,target:r,atts:o})};document.addEventListener("DOMContentLoaded",(()=>{t=!0,e.forEach((({map:t,target:e,atts:r})=>{t[i]||je.forEach((i=>i(t,e,r)))})),e.splice(0,e.length)}));const n=new IntersectionObserver((t=>{t.forEach((t=>{t.isIntersecting&&(r(t.target),n.unobserve(t.target))}))})),o=document.querySelectorAll('.geolonia[data-lazy-loading="off"]'),a=document.querySelectorAll('.geolonia:not([data-lazy-loading="off"])');Z.apiKey||console.error("[Geolonia] Missing API key.");for(let t=0;t<o.length;t++)r(o[t]);for(let t=0;t<a.length;t++)n.observe(a[t])}else console.error("[Geolonia] We are very sorry, but we can't display our map in iframe.")})()})(),s})()));
1
+ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.geoloniaEmbed=e():t.geoloniaEmbed=e()}(self,(()=>(()=>{var t,e,i,r,n={6613:t=>{function e(t){if(!(this instanceof e))return new e(t);this._bbox=t||[1/0,1/0,-1/0,-1/0],this._valid=!!t}t.exports=e,e.prototype.include=function(t){return this._valid=!0,this._bbox[0]=Math.min(this._bbox[0],t[0]),this._bbox[1]=Math.min(this._bbox[1],t[1]),this._bbox[2]=Math.max(this._bbox[2],t[0]),this._bbox[3]=Math.max(this._bbox[3],t[1]),this},e.prototype.equals=function(t){var i;return i=t instanceof e?t.bbox():t,this._bbox[0]==i[0]&&this._bbox[1]==i[1]&&this._bbox[2]==i[2]&&this._bbox[3]==i[3]},e.prototype.center=function(t){return this._valid?[(this._bbox[0]+this._bbox[2])/2,(this._bbox[1]+this._bbox[3])/2]:null},e.prototype.union=function(t){var i;return this._valid=!0,i=t instanceof e?t.bbox():t,this._bbox[0]=Math.min(this._bbox[0],i[0]),this._bbox[1]=Math.min(this._bbox[1],i[1]),this._bbox[2]=Math.max(this._bbox[2],i[2]),this._bbox[3]=Math.max(this._bbox[3],i[3]),this},e.prototype.bbox=function(){return this._valid?this._bbox:null},e.prototype.contains=function(t){if(!t)return this._fastContains();if(!this._valid)return null;var e=t[0],i=t[1];return this._bbox[0]<=e&&this._bbox[1]<=i&&this._bbox[2]>=e&&this._bbox[3]>=i},e.prototype.intersect=function(t){return this._valid?(i=t instanceof e?t.bbox():t,!(this._bbox[0]>i[2]||this._bbox[2]<i[0]||this._bbox[3]<i[1]||this._bbox[1]>i[3])):null;var i},e.prototype._fastContains=function(){if(!this._valid)return new Function("return null;");var t="return "+this._bbox[0]+"<= ll[0] &&"+this._bbox[1]+"<= ll[1] &&"+this._bbox[2]+">= ll[0] &&"+this._bbox[3]+">= ll[1]";return new Function("ll",t)},e.prototype.polygon=function(){return this._valid?{type:"Polygon",coordinates:[[[this._bbox[0],this._bbox[1]],[this._bbox[2],this._bbox[1]],[this._bbox[2],this._bbox[3]],[this._bbox[0],this._bbox[3]],[this._bbox[0],this._bbox[1]]]]}:null}},7829:t=>{t.exports=function(t){return function t(e){return Array.isArray(e)&&e.length&&"number"==typeof e[0]?[e]:e.reduce((function(e,i){return Array.isArray(i)&&Array.isArray(i[0])?e.concat(t(i)):(e.push(i),e)}),[])}(t)}},4506:(t,e,i)=>{var r=i(9340),n=i(63),a=i(7829);n instanceof Function||(n=n.default),t.exports=function(t){if(!t)return[];var e=n(r(t)),i=[];return e.features.forEach((function(t){t.geometry&&(i=i.concat(a(t.geometry.coordinates)))})),i}},9319:(t,e,i)=>{var r=i(4506),n=i(3692),a=i(6613),o={features:["FeatureCollection"],coordinates:["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],geometry:["Feature"],geometries:["GeometryCollection"]},s=Object.keys(o);function l(t){for(var e=a(),i=r(t),n=0;n<i.length;n++)e.include(i[n]);return e}t.exports=function(t){return l(t).bbox()},t.exports.polygon=function(t){return l(t).polygon()},t.exports.bboxify=function(t){return n(t).map((function(t){t&&s.some((function(e){return!!t[e]&&-1!==o[e].indexOf(t.type)}))&&(t.bbox=l(t).bbox(),this.update(t))}))}},9340:t=>{t.exports=function(t){if(!t||!t.type)return null;var i=e[t.type];return i?"geometry"===i?{type:"FeatureCollection",features:[{type:"Feature",properties:{},geometry:t}]}:"feature"===i?{type:"FeatureCollection",features:[t]}:"featurecollection"===i?t:void 0:null};var e={Point:"geometry",MultiPoint:"geometry",LineString:"geometry",MultiLineString:"geometry",Polygon:"geometry",MultiPolygon:"geometry",GeometryCollection:"geometry",Feature:"feature",FeatureCollection:"featurecollection"}},5550:t=>{"use strict";function e(t,e){this.x=t,this.y=e}t.exports=e,e.prototype={clone:function(){return new e(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},multByPoint:function(t){return this.clone()._multByPoint(t)},divByPoint:function(t){return this.clone()._divByPoint(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},rotateAround:function(t,e){return this.clone()._rotateAround(t,e)},matMult:function(t){return this.clone()._matMult(t)},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(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var e=t.x-this.x,i=t.y-this.y;return e*e+i*i},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult:function(t){var e=t[0]*this.x+t[1]*this.y,i=t[2]*this.x+t[3]*this.y;return this.x=e,this.y=i,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_multByPoint:function(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint:function(t){return this.x/=t.x,this.y/=t.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var e=Math.cos(t),i=Math.sin(t),r=e*this.x-i*this.y,n=i*this.x+e*this.y;return this.x=r,this.y=n,this},_rotateAround:function(t,e){var i=Math.cos(t),r=Math.sin(t),n=e.x+i*(this.x-e.x)-r*(this.y-e.y),a=e.y+r*(this.x-e.x)+i*(this.y-e.y);return this.x=n,this.y=a,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},e.convert=function(t){return t instanceof e?t:Array.isArray(t)?new e(t[0],t[1]):t}},7274:(t,e,i)=>{"use strict";i.d(e,{Z:()=>mt});var r=i(8081),n=i.n(r),a=i(3645),o=i.n(a),s=i(1667),l=i.n(s),c=new URL(i(1683),i.b),h=new URL(i(8202),i.b),u=new URL(i(883),i.b),p=new URL(i(2672),i.b),d=new URL(i(1880),i.b),m=new URL(i(8866),i.b),f=new URL(i(7164),i.b),g=new URL(i(1319),i.b),_=new URL(i(2398),i.b),y=new URL(i(2052),i.b),x=new URL(i(9594),i.b),v=new URL(i(5404),i.b),b=new URL(i(4891),i.b),w=new URL(i(3083),i.b),E=new URL(i(8634),i.b),T=new URL(i(7260),i.b),S=new URL(i(7118),i.b),C=new URL(i(1427),i.b),I=new URL(i(4750),i.b),A=new URL(i(9490),i.b),M=new URL(i(4178),i.b),k=new URL(i(8622),i.b),P=new URL(i(6703),i.b),z=new URL(i(5654),i.b),L=new URL(i(7151),i.b),D=new URL(i(9837),i.b),R=new URL(i(3224),i.b),B=new URL(i(5032),i.b),F=new URL(i(3667),i.b),O=o()(n()),U=l()(c),V=l()(h),N=l()(u),$=l()(p),j=l()(d),q=l()(m),Z=l()(f),G=l()(g),H=l()(_),X=l()(y),W=l()(x),K=l()(v),Y=l()(b),J=l()(w),Q=l()(E),tt=l()(T),et=l()(S),it=l()(C),rt=l()(I),nt=l()(A),at=l()(M),ot=l()(k),st=l()(P),lt=l()(z),ct=l()(L),ht=l()(D),ut=l()(R),pt=l()(B),dt=l()(F);O.push([t.id,`.maplibregl-map{-webkit-tap-highlight-color:rgb(0 0 0/0);font:12px/20px Helvetica Neue,Arial,Helvetica,sans-serif;overflow:hidden;position:relative}.maplibregl-canvas{left:0;position:absolute;top:0}.maplibregl-map:fullscreen{height:100%;width:100%}.maplibregl-ctrl-group button.maplibregl-ctrl-compass{touch-action:none}.maplibregl-canvas-container.maplibregl-interactive,.maplibregl-ctrl-group button.maplibregl-ctrl-compass{cursor:grab;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none;user-select:none}.maplibregl-canvas-container.maplibregl-interactive.maplibregl-track-pointer{cursor:pointer}.maplibregl-canvas-container.maplibregl-interactive:active,.maplibregl-ctrl-group button.maplibregl-ctrl-compass:active{cursor:grabbing}.maplibregl-canvas-container.maplibregl-touch-zoom-rotate,.maplibregl-canvas-container.maplibregl-touch-zoom-rotate .maplibregl-canvas{touch-action:pan-x pan-y}.maplibregl-canvas-container.maplibregl-touch-drag-pan,.maplibregl-canvas-container.maplibregl-touch-drag-pan .maplibregl-canvas{touch-action:pinch-zoom}.maplibregl-canvas-container.maplibregl-touch-zoom-rotate.maplibregl-touch-drag-pan,.maplibregl-canvas-container.maplibregl-touch-zoom-rotate.maplibregl-touch-drag-pan .maplibregl-canvas{touch-action:none}.maplibregl-canvas-container.maplibregl-touch-drag-pan.maplibregl-cooperative-gestures,.maplibregl-canvas-container.maplibregl-touch-drag-pan.maplibregl-cooperative-gestures .maplibregl-canvas{touch-action:pan-x pan-y}.maplibregl-ctrl-bottom-left,.maplibregl-ctrl-bottom-right,.maplibregl-ctrl-top-left,.maplibregl-ctrl-top-right{pointer-events:none;position:absolute;z-index:2}.maplibregl-ctrl-top-left{left:0;top:0}.maplibregl-ctrl-top-right{right:0;top:0}.maplibregl-ctrl-bottom-left{bottom:0;left:0}.maplibregl-ctrl-bottom-right{bottom:0;right:0}.maplibregl-ctrl{clear:both;pointer-events:auto;transform:translate(0)}.maplibregl-ctrl-top-left .maplibregl-ctrl{float:left;margin:10px 0 0 10px}.maplibregl-ctrl-top-right .maplibregl-ctrl{float:right;margin:10px 10px 0 0}.maplibregl-ctrl-bottom-left .maplibregl-ctrl{float:left;margin:0 0 10px 10px}.maplibregl-ctrl-bottom-right .maplibregl-ctrl{float:right;margin:0 10px 10px 0}.maplibregl-ctrl-group{background:#fff;border-radius:4px}.maplibregl-ctrl-group:not(:empty){box-shadow:0 0 0 2px rgba(0,0,0,.1)}@media (-ms-high-contrast:active){.maplibregl-ctrl-group:not(:empty){box-shadow:0 0 0 2px ButtonText}}.maplibregl-ctrl-group button{background-color:transparent;border:0;box-sizing:border-box;cursor:pointer;display:block;height:29px;outline:none;padding:0;width:29px}.maplibregl-ctrl-group button+button{border-top:1px solid #ddd}.maplibregl-ctrl button .maplibregl-ctrl-icon{background-position:50%;background-repeat:no-repeat;display:block;height:100%;width:100%}@media (-ms-high-contrast:active){.maplibregl-ctrl-icon{background-color:transparent}.maplibregl-ctrl-group button+button{border-top:1px solid ButtonText}}.maplibregl-ctrl button::-moz-focus-inner{border:0;padding:0}.maplibregl-ctrl-attrib-button:focus,.maplibregl-ctrl-group button:focus{box-shadow:0 0 2px 2px #0096ff}.maplibregl-ctrl button:disabled{cursor:not-allowed}.maplibregl-ctrl button:disabled .maplibregl-ctrl-icon{opacity:.25}.maplibregl-ctrl button:not(:disabled):hover{background-color:rgb(0 0 0/5%)}.maplibregl-ctrl-group button:focus:focus-visible{box-shadow:0 0 2px 2px #0096ff}.maplibregl-ctrl-group button:focus:not(:focus-visible){box-shadow:none}.maplibregl-ctrl-group button:focus:first-child{border-radius:4px 4px 0 0}.maplibregl-ctrl-group button:focus:last-child{border-radius:0 0 4px 4px}.maplibregl-ctrl-group button:focus:only-child{border-radius:inherit}.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url(${U})}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url(${V})}@media (-ms-high-contrast:active){.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url(${N})}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url(${$})}}@media (-ms-high-contrast:black-on-white){.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url(${j})}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url(${q})}}.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url(${Z})}.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url(${G})}@media (-ms-high-contrast:active){.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url(${H})}.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url(${X})}}@media (-ms-high-contrast:black-on-white){.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url(${W})}.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url(${G})}}.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url(${K})}@media (-ms-high-contrast:active){.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url(${Y})}}@media (-ms-high-contrast:black-on-white){.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url(${J})}}.maplibregl-ctrl button.maplibregl-ctrl-terrain .maplibregl-ctrl-icon{background-image:url(${Q})}.maplibregl-ctrl button.maplibregl-ctrl-terrain-enabled .maplibregl-ctrl-icon{background-image:url(${tt})}.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url(${et})}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url(${it})}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active .maplibregl-ctrl-icon{background-image:url(${rt})}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active-error .maplibregl-ctrl-icon{background-image:url(${nt})}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background .maplibregl-ctrl-icon{background-image:url(${at})}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background-error .maplibregl-ctrl-icon{background-image:url(${ot})}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-waiting .maplibregl-ctrl-icon{animation:maplibregl-spin 2s linear infinite}@media (-ms-high-contrast:active){.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url(${st})}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url(${lt})}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active .maplibregl-ctrl-icon{background-image:url(${rt})}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active-error .maplibregl-ctrl-icon{background-image:url(${nt})}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background .maplibregl-ctrl-icon{background-image:url(${at})}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background-error .maplibregl-ctrl-icon{background-image:url(${ot})}}@media (-ms-high-contrast:black-on-white){.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url(${ct})}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url(${ht})}}@keyframes maplibregl-spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}a.maplibregl-ctrl-logo{background-image:url(${ut});background-repeat:no-repeat;cursor:pointer;display:block;height:23px;margin:0 0 -4px -4px;overflow:hidden;width:88px}a.maplibregl-ctrl-logo.maplibregl-compact{width:14px}@media (-ms-high-contrast:active){a.maplibregl-ctrl-logo{background-color:transparent;background-image:url(${ut})}}@media (-ms-high-contrast:black-on-white){a.maplibregl-ctrl-logo{background-image:url(${ut})}}.maplibregl-ctrl.maplibregl-ctrl-attrib{background-color:hsla(0,0%,100%,.5);margin:0;padding:0 5px}@media screen{.maplibregl-ctrl-attrib.maplibregl-compact{background-color:#fff;border-radius:12px;box-sizing:content-box;margin:10px;min-height:20px;padding:2px 24px 2px 0;position:relative}.maplibregl-ctrl-attrib.maplibregl-compact-show{padding:2px 28px 2px 8px;visibility:visible}.maplibregl-ctrl-bottom-left>.maplibregl-ctrl-attrib.maplibregl-compact-show,.maplibregl-ctrl-top-left>.maplibregl-ctrl-attrib.maplibregl-compact-show{border-radius:12px;padding:2px 8px 2px 28px}.maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-inner{display:none}.maplibregl-ctrl-attrib-button{background-color:hsla(0,0%,100%,.5);background-image:url(${pt});border:0;border-radius:12px;box-sizing:border-box;cursor:pointer;display:none;height:24px;outline:none;position:absolute;right:0;top:0;width:24px}.maplibregl-ctrl-attrib summary.maplibregl-ctrl-attrib-button{appearance:none;list-style:none}.maplibregl-ctrl-attrib summary.maplibregl-ctrl-attrib-button::-webkit-details-marker{display:none}.maplibregl-ctrl-bottom-left .maplibregl-ctrl-attrib-button,.maplibregl-ctrl-top-left .maplibregl-ctrl-attrib-button{left:0}.maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-button,.maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-inner{display:block}.maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-button{background-color:rgb(0 0 0/5%)}.maplibregl-ctrl-bottom-right>.maplibregl-ctrl-attrib.maplibregl-compact:after{bottom:0;right:0}.maplibregl-ctrl-top-right>.maplibregl-ctrl-attrib.maplibregl-compact:after{right:0;top:0}.maplibregl-ctrl-top-left>.maplibregl-ctrl-attrib.maplibregl-compact:after{left:0;top:0}.maplibregl-ctrl-bottom-left>.maplibregl-ctrl-attrib.maplibregl-compact:after{bottom:0;left:0}}@media screen and (-ms-high-contrast:active){.maplibregl-ctrl-attrib.maplibregl-compact:after{background-image:url(${dt})}}@media screen and (-ms-high-contrast:black-on-white){.maplibregl-ctrl-attrib.maplibregl-compact:after{background-image:url(${pt})}}.maplibregl-ctrl-attrib a{color:rgba(0,0,0,.75);text-decoration:none}.maplibregl-ctrl-attrib a:hover{color:inherit;text-decoration:underline}.maplibregl-attrib-empty{display:none}.maplibregl-ctrl-scale{background-color:hsla(0,0%,100%,.75);border:2px solid #333;border-top:#333;box-sizing:border-box;color:#333;font-size:10px;padding:0 5px}.maplibregl-popup{display:flex;left:0;pointer-events:none;position:absolute;top:0;will-change:transform}.maplibregl-popup-anchor-top,.maplibregl-popup-anchor-top-left,.maplibregl-popup-anchor-top-right{flex-direction:column}.maplibregl-popup-anchor-bottom,.maplibregl-popup-anchor-bottom-left,.maplibregl-popup-anchor-bottom-right{flex-direction:column-reverse}.maplibregl-popup-anchor-left{flex-direction:row}.maplibregl-popup-anchor-right{flex-direction:row-reverse}.maplibregl-popup-tip{border:10px solid transparent;height:0;width:0;z-index:1}.maplibregl-popup-anchor-top .maplibregl-popup-tip{align-self:center;border-bottom-color:#fff;border-top:none}.maplibregl-popup-anchor-top-left .maplibregl-popup-tip{align-self:flex-start;border-bottom-color:#fff;border-left:none;border-top:none}.maplibregl-popup-anchor-top-right .maplibregl-popup-tip{align-self:flex-end;border-bottom-color:#fff;border-right:none;border-top:none}.maplibregl-popup-anchor-bottom .maplibregl-popup-tip{align-self:center;border-bottom:none;border-top-color:#fff}.maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip{align-self:flex-start;border-bottom:none;border-left:none;border-top-color:#fff}.maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip{align-self:flex-end;border-bottom:none;border-right:none;border-top-color:#fff}.maplibregl-popup-anchor-left .maplibregl-popup-tip{align-self:center;border-left:none;border-right-color:#fff}.maplibregl-popup-anchor-right .maplibregl-popup-tip{align-self:center;border-left-color:#fff;border-right:none}.maplibregl-popup-close-button{background-color:transparent;border:0;border-radius:0 3px 0 0;cursor:pointer;position:absolute;right:0;top:0}.maplibregl-popup-close-button:hover{background-color:rgb(0 0 0/5%)}.maplibregl-popup-content{background:#fff;border-radius:3px;box-shadow:0 1px 2px rgba(0,0,0,.1);padding:15px 10px;pointer-events:auto;position:relative}.maplibregl-popup-anchor-top-left .maplibregl-popup-content{border-top-left-radius:0}.maplibregl-popup-anchor-top-right .maplibregl-popup-content{border-top-right-radius:0}.maplibregl-popup-anchor-bottom-left .maplibregl-popup-content{border-bottom-left-radius:0}.maplibregl-popup-anchor-bottom-right .maplibregl-popup-content{border-bottom-right-radius:0}.maplibregl-popup-track-pointer{display:none}.maplibregl-popup-track-pointer *{pointer-events:none;user-select:none}.maplibregl-map:hover .maplibregl-popup-track-pointer{display:flex}.maplibregl-map:active .maplibregl-popup-track-pointer{display:none}.maplibregl-marker{left:0;position:absolute;top:0;will-change:transform}.maplibregl-user-location-dot,.maplibregl-user-location-dot:before{background-color:#1da1f2;border-radius:50%;height:15px;width:15px}.maplibregl-user-location-dot:before{animation:maplibregl-user-location-dot-pulse 2s infinite;content:"";position:absolute}.maplibregl-user-location-dot:after{border:2px solid #fff;border-radius:50%;box-shadow:0 0 3px rgba(0,0,0,.35);box-sizing:border-box;content:"";height:19px;left:-2px;position:absolute;top:-2px;width:19px}@keyframes maplibregl-user-location-dot-pulse{0%{opacity:1;transform:scale(1)}70%{opacity:0;transform:scale(3)}to{opacity:0;transform:scale(1)}}.maplibregl-user-location-dot-stale{background-color:#aaa}.maplibregl-user-location-dot-stale:after{display:none}.maplibregl-user-location-accuracy-circle{background-color:#1da1f233;border-radius:100%;height:1px;width:1px}.maplibregl-crosshair,.maplibregl-crosshair .maplibregl-interactive,.maplibregl-crosshair .maplibregl-interactive:active{cursor:crosshair}.maplibregl-boxzoom{background:#fff;border:2px dotted #202020;height:0;left:0;opacity:.5;position:absolute;top:0;width:0}.maplibregl-cooperative-gesture-screen{align-items:center;background:rgba(0,0,0,.4);color:#fff;display:flex;font-size:1.4em;inset:0;justify-content:center;line-height:1.2;opacity:0;padding:1rem;pointer-events:none;position:absolute;transition:opacity 1s ease 1s;z-index:99999}.maplibregl-cooperative-gesture-screen.maplibregl-show{opacity:1;transition:opacity .05s}.maplibregl-cooperative-gesture-screen .maplibregl-mobile-message{display:none}@media (hover:none),(width <= 480px){.maplibregl-cooperative-gesture-screen .maplibregl-desktop-message{display:none}.maplibregl-cooperative-gesture-screen .maplibregl-mobile-message{display:block}}.maplibregl-pseudo-fullscreen{height:100%!important;left:0!important;position:fixed!important;top:0!important;width:100%!important;z-index:99999}`,""]);const mt=O},5426:(t,e,i)=>{"use strict";i.d(e,{Z:()=>s});var r=i(8081),n=i.n(r),a=i(3645),o=i.n(a)()(n());o.push([t.id,'.geolonia-clickable-marker {\n cursor: pointer;\n}\n\n/* Make fullscreen mode works with ie11 */\n.geolonia:-ms-fullscreen {\n width: 100%;\n height: 100%;\n}\n\n/**\n * Styles for loading effect.\n */\n.loading-geolonia-map {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background-color: rgba(255, 255, 255, 0.5);\n z-index: 9999;\n justify-content: center;\n align-items: center;\n display: flex;\n}\n\n.loading-geolonia-map .lds-grid {\n display: inline-block;\n position: relative;\n width: 80px;\n height: 80px;\n}\n\n.loading-geolonia-map .lds-grid div {\n position: absolute;\n width: 16px;\n height: 16px;\n border-radius: 50%;\n background: #999999;\n animation: lds-grid 1.2s linear infinite;\n}\n\n.loading-geolonia-map .lds-grid div:nth-child(1) {\n top: 8px;\n left: 8px;\n animation-delay: 0s;\n}\n\n.loading-geolonia-map .lds-grid div:nth-child(2) {\n top: 8px;\n left: 32px;\n animation-delay: -0.4s;\n}\n\n.loading-geolonia-map .lds-grid div:nth-child(3) {\n top: 8px;\n left: 56px;\n animation-delay: -0.8s;\n}\n\n.loading-geolonia-map .lds-grid div:nth-child(4) {\n top: 32px;\n left: 8px;\n animation-delay: -0.4s;\n}\n\n.loading-geolonia-map .lds-grid div:nth-child(5) {\n top: 32px;\n left: 32px;\n animation-delay: -0.8s;\n}\n\n.loading-geolonia-map .lds-grid div:nth-child(6) {\n top: 32px;\n left: 56px;\n animation-delay: -1.2s;\n}\n\n.loading-geolonia-map .lds-grid div:nth-child(7) {\n top: 56px;\n left: 8px;\n animation-delay: -0.8s;\n}\n\n.loading-geolonia-map .lds-grid div:nth-child(8) {\n top: 56px;\n left: 32px;\n animation-delay: -1.2s;\n}\n\n.loading-geolonia-map .lds-grid div:nth-child(9) {\n top: 56px;\n left: 56px;\n animation-delay: -1.6s;\n}\n\n@keyframes lds-grid {\n 0%, 100% {\n opacity: 1;\n }\n 50% {\n opacity: 0.5;\n }\n}\n\n/* Style for restricted mode */\n.geolonia__restricted-mode-image-container {\n background-image: url("https://geolonia.github.io/embed/restricted.jpg");\n background-position: center center;\n background-size: cover;\n}\n\n/* CSS for Attribution */\n/* Fix: https://github.com/geolonia/embed/issues/291 */\n.maplibregl-map {\n display: block!important;\n}\n\n.maplibregl-ctrl-attrib-inner {\n display: block!important;\n}\n\n.maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-inner {\n display: none!important;\n}\n\n.maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-inner,\n.maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-button {\n display: block!important;\n}\n/* End: CSS for Attribution */\n\n@media print {\n .maplibregl-control-container button {\n display: none;\n }\n}\n',""]);const s=o},3645:t=>{"use strict";t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var i="",r=void 0!==e[5];return e[4]&&(i+="@supports (".concat(e[4],") {")),e[2]&&(i+="@media ".concat(e[2]," {")),r&&(i+="@layer".concat(e[5].length>0?" ".concat(e[5]):""," {")),i+=t(e),r&&(i+="}"),e[2]&&(i+="}"),e[4]&&(i+="}"),i})).join("")},e.i=function(t,i,r,n,a){"string"==typeof t&&(t=[[null,t,void 0]]);var o={};if(r)for(var s=0;s<this.length;s++){var l=this[s][0];null!=l&&(o[l]=!0)}for(var c=0;c<t.length;c++){var h=[].concat(t[c]);r&&o[h[0]]||(void 0!==a&&(void 0===h[5]||(h[1]="@layer".concat(h[5].length>0?" ".concat(h[5]):""," {").concat(h[1],"}")),h[5]=a),i&&(h[2]?(h[1]="@media ".concat(h[2]," {").concat(h[1],"}"),h[2]=i):h[2]=i),n&&(h[4]?(h[1]="@supports (".concat(h[4],") {").concat(h[1],"}"),h[4]=n):h[4]="".concat(n)),e.push(h))}},e}},1667:t=>{"use strict";t.exports=function(t,e){return e||(e={}),t?(t=String(t.__esModule?t.default:t),/^['"].*['"]$/.test(t)&&(t=t.slice(1,-1)),e.hash&&(t+=e.hash),/["'() \t\n]|(%20)/.test(t)||e.needQuotes?'"'.concat(t.replace(/"/g,'\\"').replace(/\n/g,"\\n"),'"'):t):t}},8081:t=>{"use strict";t.exports=function(t){return t[1]}},63:(t,e,i)=>{"use strict";function r(t){switch(t&&t.type||null){case"FeatureCollection":return t.features=t.features.reduce((function(t,e){return t.concat(r(e))}),[]),t;case"Feature":return t.geometry?r(t.geometry).map((function(e){var i={type:"Feature",properties:JSON.parse(JSON.stringify(t.properties)),geometry:e};return void 0!==t.id&&(i.id=t.id),i})):[t];case"MultiPoint":return t.coordinates.map((function(t){return{type:"Point",coordinates:t}}));case"MultiPolygon":return t.coordinates.map((function(t){return{type:"Polygon",coordinates:t}}));case"MultiLineString":return t.coordinates.map((function(t){return{type:"LineString",coordinates:t}}));case"GeometryCollection":return t.geometries.map(r).reduce((function(t,e){return t.concat(e)}),[]);case"Point":case"Polygon":case"LineString":return[t]}}i.r(e),i.d(e,{default:()=>r})},3379:t=>{"use strict";var e=[];function i(t){for(var i=-1,r=0;r<e.length;r++)if(e[r].identifier===t){i=r;break}return i}function r(t,r){for(var a={},o=[],s=0;s<t.length;s++){var l=t[s],c=r.base?l[0]+r.base:l[0],h=a[c]||0,u="".concat(c," ").concat(h);a[c]=h+1;var p=i(u),d={css:l[1],media:l[2],sourceMap:l[3],supports:l[4],layer:l[5]};if(-1!==p)e[p].references++,e[p].updater(d);else{var m=n(d,r);r.byIndex=s,e.splice(s,0,{identifier:u,updater:m,references:1})}o.push(u)}return o}function n(t,e){var i=e.domAPI(e);return i.update(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap&&e.supports===t.supports&&e.layer===t.layer)return;i.update(t=e)}else i.remove()}}t.exports=function(t,n){var a=r(t=t||[],n=n||{});return function(t){t=t||[];for(var o=0;o<a.length;o++){var s=i(a[o]);e[s].references--}for(var l=r(t,n),c=0;c<a.length;c++){var h=i(a[c]);0===e[h].references&&(e[h].updater(),e.splice(h,1))}a=l}}},569:t=>{"use strict";var e={};t.exports=function(t,i){var r=function(t){if(void 0===e[t]){var i=document.querySelector(t);if(window.HTMLIFrameElement&&i instanceof window.HTMLIFrameElement)try{i=i.contentDocument.head}catch(t){i=null}e[t]=i}return e[t]}(t);if(!r)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");r.appendChild(i)}},9216:t=>{"use strict";t.exports=function(t){var e=document.createElement("style");return t.setAttributes(e,t.attributes),t.insert(e,t.options),e}},3565:(t,e,i)=>{"use strict";t.exports=function(t){var e=i.nc;e&&t.setAttribute("nonce",e)}},7795:t=>{"use strict";t.exports=function(t){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var e=t.insertStyleElement(t);return{update:function(i){!function(t,e,i){var r="";i.supports&&(r+="@supports (".concat(i.supports,") {")),i.media&&(r+="@media ".concat(i.media," {"));var n=void 0!==i.layer;n&&(r+="@layer".concat(i.layer.length>0?" ".concat(i.layer):""," {")),r+=i.css,n&&(r+="}"),i.media&&(r+="}"),i.supports&&(r+="}");var a=i.sourceMap;a&&"undefined"!=typeof btoa&&(r+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(a))))," */")),e.styleTagTransform(r,t,e.options)}(e,t,i)},remove:function(){!function(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t)}(e)}}}},4589:t=>{"use strict";t.exports=function(t,e){if(e.styleSheet)e.styleSheet.cssText=t;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(t))}}},4055:t=>{t.exports='<svg viewBox="0 0 28 38" xmlns="http://www.w3.org/2000/svg"><g fill="none" fill-rule="evenodd"><ellipse fill-opacity=".3" fill="#000" cx="14" cy="36.5" rx="3" ry="1.5"></ellipse><g transform="translate(1 1)"><path d="M26.495 13.018l.002.05c.011.32-.006.775-.068 1.295-.003.062-.003.062-.005.076l.001-.008a16.517 16.517 0 01-.247 1.5c-1.208 5.775-5.112 12.154-12.865 18.457l-.344.28-.319-.309-.537-.518-.621-.603c-.511-.498-.978-.96-1.445-1.434a68.208 68.208 0 01-3.37-3.656C2.894 23.714.411 19.456-.288 15.414A12.974 12.974 0 01-.48 13.43a2.981 2.981 0 00-.007-.132v-.013a3.206 3.206 0 01-.012-.252c0-.055 0-.055.003-.09v-.002l.002-.028-.002-.048a1.288 1.288 0 01-.003-.157l.024-.475h.01C-.05 5.12 5.827-.5 12.998-.5c7.45 0 13.49 6.05 13.497 13.518zm-.07 1.413v.003z" stroke="#FFF" fill="#666" fill-rule="nonzero" class="left"></path><path d="M13 0c7.176 0 12.995 5.834 12.995 13.033 0 0 .031.472-.066 1.33v.011a15.863 15.863 0 01-.24 1.455c-.777 3.71-3.463 10.668-12.689 18.17V0z" fill="#2D2D2D" fill-rule="nonzero" class="right"></path><circle fill="#FFF" cx="13" cy="13" r="6"></circle></g></g></svg>'},3692:t=>{"use strict";function e(t){return Object.prototype.toString.call(t)}var i=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function r(t,e){if(t.forEach)return t.forEach(e);for(var i=0;i<t.length;i++)e(t[i],i,t)}var n=Object.keys||function(t){var e=[];for(var i in t)e.push(i);return e},a=Object.prototype.hasOwnProperty||function(t,e){return e in t};function o(t){if("object"==typeof t&&null!==t){var a;if(i(t))a=[];else if("[object Date]"===e(t))a=new Date(t.getTime?t.getTime():t);else if("[object RegExp]"===e(t))a=new RegExp(t);else if(function(t){return"[object Error]"===e(t)}(t))a={message:t.message};else if(function(t){return"[object Boolean]"===e(t)}(t)||function(t){return"[object Number]"===e(t)}(t)||function(t){return"[object String]"===e(t)}(t))a=Object(t);else if(Object.create&&Object.getPrototypeOf)a=Object.create(Object.getPrototypeOf(t));else if(t.constructor===Object)a={};else{var o=t.constructor&&t.constructor.prototype||t.__proto__||{},s=function(){};s.prototype=o,a=new s}return r(n(t),(function(e){a[e]=t[e]})),a}return t}function s(t,e,s){var l=[],c=[],h=!0;return function t(u){var p=s?o(u):u,d={},m=!0,f={node:p,node_:u,path:[].concat(l),parent:c[c.length-1],parents:c,key:l[l.length-1],isRoot:0===l.length,level:l.length,circular:null,update:function(t,e){f.isRoot||(f.parent.node[f.key]=t),f.node=t,e&&(m=!1)},delete:function(t){delete f.parent.node[f.key],t&&(m=!1)},remove:function(t){i(f.parent.node)?f.parent.node.splice(f.key,1):delete f.parent.node[f.key],t&&(m=!1)},keys:null,before:function(t){d.before=t},after:function(t){d.after=t},pre:function(t){d.pre=t},post:function(t){d.post=t},stop:function(){h=!1},block:function(){m=!1}};if(!h)return f;function g(){if("object"==typeof f.node&&null!==f.node){f.keys&&f.node_===f.node||(f.keys=n(f.node)),f.isLeaf=0===f.keys.length;for(var t=0;t<c.length;t++)if(c[t].node_===u){f.circular=c[t];break}}else f.isLeaf=!0,f.keys=null;f.notLeaf=!f.isLeaf,f.notRoot=!f.isRoot}g();var _=e.call(f,f.node);return void 0!==_&&f.update&&f.update(_),d.before&&d.before.call(f,f.node),m?("object"!=typeof f.node||null===f.node||f.circular||(c.push(f),g(),r(f.keys,(function(e,i){l.push(e),d.pre&&d.pre.call(f,f.node[e],e);var r=t(f.node[e]);s&&a.call(f.node,e)&&(f.node[e]=r.node),r.isLast=i===f.keys.length-1,r.isFirst=0===i,d.post&&d.post.call(f,r),l.pop()})),c.pop()),d.after&&d.after.call(f,f.node),f):f}(t).node}function l(t){this.value=t}function c(t){return new l(t)}l.prototype.get=function(t){for(var e=this.value,i=0;i<t.length;i++){var r=t[i];if(!e||!a.call(e,r))return;e=e[r]}return e},l.prototype.has=function(t){for(var e=this.value,i=0;i<t.length;i++){var r=t[i];if(!e||!a.call(e,r))return!1;e=e[r]}return!0},l.prototype.set=function(t,e){for(var i=this.value,r=0;r<t.length-1;r++){var n=t[r];a.call(i,n)||(i[n]={}),i=i[n]}return i[t[r]]=e,e},l.prototype.map=function(t){return s(this.value,t,!0)},l.prototype.forEach=function(t){return this.value=s(this.value,t,!1),this.value},l.prototype.reduce=function(t,e){var i=1===arguments.length,r=i?this.value:e;return this.forEach((function(e){this.isRoot&&i||(r=t.call(this,r,e))})),r},l.prototype.paths=function(){var t=[];return this.forEach((function(){t.push(this.path)})),t},l.prototype.nodes=function(){var t=[];return this.forEach((function(){t.push(this.node)})),t},l.prototype.clone=function(){var t=[],e=[];return function i(a){for(var s=0;s<t.length;s++)if(t[s]===a)return e[s];if("object"==typeof a&&null!==a){var l=o(a);return t.push(a),e.push(l),r(n(a),(function(t){l[t]=i(a[t])})),t.pop(),e.pop(),l}return a}(this.value)},r(n(l.prototype),(function(t){c[t]=function(e){var i=[].slice.call(arguments,1),r=new l(e);return r[t].apply(r,i)}})),t.exports=c},8634:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2722%27 height=%2722%27 fill=%27%23333%27 viewBox=%270 0 22 22%27%3E%3Cpath d=%27m1.754 13.406 4.453-4.851 3.09 3.09 3.281 3.277.969-.969-3.309-3.312 3.844-4.121 6.148 6.886h1.082v-.855l-7.207-8.07-4.84 5.187L6.169 6.57l-5.48 5.965v.871ZM.688 16.844h20.625v1.375H.688Zm0 0%27/%3E%3C/svg%3E"},7260:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2722%27 height=%2722%27 fill=%27%2333b5e5%27 viewBox=%270 0 22 22%27%3E%3Cpath d=%27m1.754 13.406 4.453-4.851 3.09 3.09 3.281 3.277.969-.969-3.309-3.312 3.844-4.121 6.148 6.886h1.082v-.855l-7.207-8.07-4.84 5.187L6.169 6.57l-5.48 5.965v.871ZM.688 16.844h20.625v1.375H.688Zm0 0%27/%3E%3C/svg%3E"},5032:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2724%27 height=%2724%27 fill-rule=%27evenodd%27 viewBox=%270 0 20 20%27%3E%3Cpath d=%27M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0%27/%3E%3C/svg%3E"},3667:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2724%27 height=%2724%27 fill=%27%23fff%27 fill-rule=%27evenodd%27 viewBox=%270 0 20 20%27%3E%3Cpath d=%27M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0%27/%3E%3C/svg%3E"},7118:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 fill=%27%23333%27 viewBox=%270 0 20 20%27%3E%3Cpath d=%27M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z%27/%3E%3Ccircle cx=%2710%27 cy=%2710%27 r=%272%27/%3E%3C/svg%3E"},1683:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 fill=%27%23333%27 viewBox=%270 0 29 29%27%3E%3Cpath d=%27M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-9z%27/%3E%3C/svg%3E"},8202:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 fill=%27%23333%27 viewBox=%270 0 29 29%27%3E%3Cpath d=%27M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5z%27/%3E%3C/svg%3E"},7164:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 fill=%27%23333%27 viewBox=%270 0 29 29%27%3E%3Cpath d=%27M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3h1zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16h1zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5H13zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1V7.5z%27/%3E%3C/svg%3E"},5404:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 fill=%27%23333%27 viewBox=%270 0 29 29%27%3E%3Cpath d=%27m10.5 14 4-8 4 8h-8z%27/%3E%3Cpath fill=%27%23ccc%27 d=%27m10.5 16 4 8 4-8h-8z%27/%3E%3C/svg%3E"},4178:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 fill=%27%2333b5e5%27 viewBox=%270 0 20 20%27%3E%3Cpath d=%27M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z%27/%3E%3C/svg%3E"},4750:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 fill=%27%2333b5e5%27 viewBox=%270 0 20 20%27%3E%3Cpath d=%27M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z%27/%3E%3Ccircle cx=%2710%27 cy=%2710%27 r=%272%27/%3E%3C/svg%3E"},9837:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 fill=%27%23666%27 viewBox=%270 0 20 20%27%3E%3Cpath d=%27M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z%27/%3E%3Ccircle cx=%2710%27 cy=%2710%27 r=%272%27/%3E%3Cpath fill=%27red%27 d=%27m14 5 1 1-9 9-1-1 9-9z%27/%3E%3C/svg%3E"},5654:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 fill=%27%23999%27 viewBox=%270 0 20 20%27%3E%3Cpath d=%27M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z%27/%3E%3Ccircle cx=%2710%27 cy=%2710%27 r=%272%27/%3E%3Cpath fill=%27red%27 d=%27m14 5 1 1-9 9-1-1 9-9z%27/%3E%3C/svg%3E"},1427:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 fill=%27%23aaa%27 viewBox=%270 0 20 20%27%3E%3Cpath d=%27M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z%27/%3E%3Ccircle cx=%2710%27 cy=%2710%27 r=%272%27/%3E%3Cpath fill=%27red%27 d=%27m14 5 1 1-9 9-1-1 9-9z%27/%3E%3C/svg%3E"},8622:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 fill=%27%23e54e33%27 viewBox=%270 0 20 20%27%3E%3Cpath d=%27M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z%27/%3E%3C/svg%3E"},9490:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 fill=%27%23e58978%27 viewBox=%270 0 20 20%27%3E%3Cpath d=%27M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z%27/%3E%3Ccircle cx=%2710%27 cy=%2710%27 r=%272%27/%3E%3C/svg%3E"},6703:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 fill=%27%23fff%27 viewBox=%270 0 20 20%27%3E%3Cpath d=%27M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z%27/%3E%3Ccircle cx=%2710%27 cy=%2710%27 r=%272%27/%3E%3C/svg%3E"},883:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 fill=%27%23fff%27 viewBox=%270 0 29 29%27%3E%3Cpath d=%27M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-9z%27/%3E%3C/svg%3E"},2672:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 fill=%27%23fff%27 viewBox=%270 0 29 29%27%3E%3Cpath d=%27M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5z%27/%3E%3C/svg%3E"},2052:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 fill=%27%23fff%27 viewBox=%270 0 29 29%27%3E%3Cpath d=%27M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1h-5.5zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1v-5.5zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1v5.5zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1h5.5z%27/%3E%3C/svg%3E"},2398:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 fill=%27%23fff%27 viewBox=%270 0 29 29%27%3E%3Cpath d=%27M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3h1zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16h1zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5H13zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1V7.5z%27/%3E%3C/svg%3E"},4891:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 fill=%27%23fff%27 viewBox=%270 0 29 29%27%3E%3Cpath d=%27m10.5 14 4-8 4 8h-8z%27/%3E%3Cpath fill=%27%23999%27 d=%27m10.5 16 4 8 4-8h-8z%27/%3E%3C/svg%3E"},7151:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 viewBox=%270 0 20 20%27%3E%3Cpath d=%27M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z%27/%3E%3Ccircle cx=%2710%27 cy=%2710%27 r=%272%27/%3E%3C/svg%3E"},1880:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 viewBox=%270 0 29 29%27%3E%3Cpath d=%27M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-9z%27/%3E%3C/svg%3E"},8866:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 viewBox=%270 0 29 29%27%3E%3Cpath d=%27M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5z%27/%3E%3C/svg%3E"},1319:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 viewBox=%270 0 29 29%27%3E%3Cpath d=%27M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1h-5.5zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1v-5.5zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1v5.5zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1h5.5z%27/%3E%3C/svg%3E"},9594:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 viewBox=%270 0 29 29%27%3E%3Cpath d=%27M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3h1zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16h1zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5H13zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1V7.5z%27/%3E%3C/svg%3E"},3083:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 viewBox=%270 0 29 29%27%3E%3Cpath d=%27m10.5 14 4-8 4 8h-8z%27/%3E%3Cpath fill=%27%23ccc%27 d=%27m10.5 16 4 8 4-8h-8z%27/%3E%3C/svg%3E"},3224:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2788%27 height=%2723%27 fill=%27none%27%3E%3Cpath fill=%27%23000%27 fill-opacity=%27.4%27 fill-rule=%27evenodd%27 d=%27M17.408 16.796h-1.827l2.501-12.095h.198l3.324 6.533.988 2.19.988-2.19 3.258-6.533h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.929 5.644h-.098l-2.914-5.644-.757-1.71-.345 1.71zm1.958-3.42-.726 3.663a1.255 1.255 0 0 1-1.232 1.011h-1.827a1.255 1.255 0 0 1-1.229-1.509l2.501-12.095a1.255 1.255 0 0 1 1.23-1.001h.197a1.255 1.255 0 0 1 1.12.685l3.19 6.273 3.125-6.263a1.255 1.255 0 0 1 1.123-.695h.181a1.255 1.255 0 0 1 1.227.991l1.443 6.71a5.11 5.11 0 0 1 .314-.787l.009-.016a4.623 4.623 0 0 1 1.777-1.887c.782-.46 1.668-.667 2.611-.667a4.548 4.548 0 0 1 1.7.32l.306.134c.21-.16.474-.256.759-.256h1.694a1.255 1.255 0 0 1 1.212.925 1.255 1.255 0 0 1 1.212-.925h1.711c.284 0 .545.094.755.252.613-.3 1.312-.45 2.075-.45 1.356 0 2.557.445 3.482 1.4.314.319.566.676.763 1.064V4.701a1.255 1.255 0 0 1 1.255-1.255h1.86A1.255 1.255 0 0 1 54.44 4.7v9.194h2.217c.19 0 .37.043.532.118v-4.77c0-.356.147-.678.385-.906a2.416 2.416 0 0 1-.682-1.71c0-.665.267-1.253.735-1.7a2.448 2.448 0 0 1 1.722-.674 2.43 2.43 0 0 1 1.705.675c.211.2.381.43.504.683V4.7a1.255 1.255 0 0 1 1.255-1.255h1.744A1.255 1.255 0 0 1 65.812 4.7v3.335a4.76 4.76 0 0 1 1.526-.246c.938 0 1.817.214 2.59.69a4.47 4.47 0 0 1 1.67 1.743v-.98a1.255 1.255 0 0 1 1.256-1.256h1.777c.233 0 .451.064.639.174a3.407 3.407 0 0 1 1.567-.372c.346 0 .861.02 1.285.232a1.255 1.255 0 0 1 .689 1.004 4.73 4.73 0 0 1 .853-.588c.795-.44 1.675-.647 2.61-.647 1.385 0 2.65.39 3.525 1.396.836.938 1.168 2.173 1.168 3.528 0 .343-.02.694-.056 1.051a1.255 1.255 0 0 1-.947 1.09l.408.952a1.255 1.255 0 0 1-.477 1.552c-.418.268-.92.463-1.458.612-.613.171-1.304.244-2.049.244-1.06 0-2.043-.207-2.886-.698l-.015-.008c-.798-.48-1.419-1.135-1.818-1.963l-.004-.008a5.815 5.815 0 0 1-.548-2.512c0-.286.017-.567.053-.843a1.255 1.255 0 0 1-.333-.086l-.166-.004c-.223 0-.426.062-.643.228-.03.024-.142.139-.142.59v3.883a1.255 1.255 0 0 1-1.256 1.256h-1.777a1.255 1.255 0 0 1-1.256-1.256V15.69l-.032.057a4.778 4.778 0 0 1-1.86 1.833 5.04 5.04 0 0 1-2.484.634 4.47 4.47 0 0 1-1.935-.424 1.252 1.252 0 0 1-.764.258h-1.71a1.255 1.255 0 0 1-1.256-1.255V7.687a2.402 2.402 0 0 1-.428.625c.253.23.412.561.412.93v7.553a1.255 1.255 0 0 1-1.256 1.255h-1.843a1.25 1.25 0 0 1-.894-.373c-.228.23-.544.373-.894.373H51.32a1.255 1.255 0 0 1-1.256-1.255v-1.251l-.061.117a4.703 4.703 0 0 1-1.782 1.884 4.767 4.767 0 0 1-2.485.67 5.6 5.6 0 0 1-1.485-.188l.009 2.764a1.255 1.255 0 0 1-1.255 1.259h-1.729a1.255 1.255 0 0 1-1.255-1.255v-3.537a1.255 1.255 0 0 1-1.167.793h-1.679a1.25 1.25 0 0 1-.77-.263 4.47 4.47 0 0 1-1.945.429c-.885 0-1.724-.21-2.495-.632l-.017-.01a4.983 4.983 0 0 1-1.081-.836 1.255 1.255 0 0 1-1.254 1.312h-1.81a1.255 1.255 0 0 1-1.228-.99l-.782-3.625-2.044 3.939a1.255 1.255 0 0 1-1.115.676h-.098a1.255 1.255 0 0 1-1.116-.68l-2.061-3.994zM35.92 16.63l.207-.114.223-.15c.329-.237.574-.499.735-.785l.061-.118.033 1.332h1.678V9.242h-1.694l-.033 1.267c-.088-.22-.264-.438-.526-.658l-.032-.028a3.16 3.16 0 0 0-.668-.428l-.27-.12a3.293 3.293 0 0 0-1.235-.23c-.757 0-1.415.163-1.974.493a3.36 3.36 0 0 0-1.3 1.382c-.297.593-.444 1.284-.444 2.074 0 .8.17 1.503.51 2.107a3.795 3.795 0 0 0 1.382 1.381 3.883 3.883 0 0 0 1.893.477c.53 0 1.015-.11 1.455-.33zm-2.789-5.38c-.384.45-.575 1.038-.575 1.762 0 .735.186 1.332.559 1.794.384.45.933.675 1.645.675a2.25 2.25 0 0 0 .934-.19 2.17 2.17 0 0 0 .468-.29l.178-.161a2.163 2.163 0 0 0 .397-.561c.163-.333.244-.717.244-1.15v-.115c0-.472-.098-.894-.296-1.267l-.043-.077a2.211 2.211 0 0 0-.633-.709l-.13-.086-.047-.028a2.099 2.099 0 0 0-1.073-.285c-.702 0-1.244.231-1.629.692zm2.316 2.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.958.958 0 0 0-.353-.389.851.851 0 0 0-.464-.127c-.4 0-.56.114-.664.239l-.01.012c-.148.174-.275.45-.275.945 0 .506.122.801.27.99.097.11.266.224.68.224.303 0 .504-.09.687-.269zm7.545 1.705a2.626 2.626 0 0 0 .331.423c.213.22.464.402.755.548l.173.074c.433.17.93.255 1.49.255.68 0 1.295-.165 1.844-.493a3.447 3.447 0 0 0 1.316-1.4c.329-.603.493-1.299.493-2.089 0-1.273-.33-2.243-.988-2.913-.658-.68-1.52-1.02-2.584-1.02-.598 0-1.124.115-1.575.347a2.807 2.807 0 0 0-.415.262l-.199.166a3.35 3.35 0 0 0-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138c.137.193.297.36.48.5l.155.11.053.034c.34.197.713.297 1.119.297.714 0 1.262-.225 1.645-.675.385-.46.576-1.048.576-1.762 0-.746-.192-1.338-.576-1.777-.372-.45-.92-.675-1.645-.675-.29 0-.569.053-.835.16a2.366 2.366 0 0 0-.284.136 1.99 1.99 0 0 0-.363.254 2.237 2.237 0 0 0-.46.569l-.082.162a2.56 2.56 0 0 0-.213 1.072v.115c0 .471.098.894.296 1.267l.135.211zm.964-.818a1.11 1.11 0 0 0 .367.385.937.937 0 0 0 .476.118c.423 0 .59-.117.687-.23.159-.194.28-.478.28-.95 0-.53-.133-.8-.266-.952l-.021-.025c-.078-.094-.231-.221-.68-.221a.995.995 0 0 0-.503.135l-.012.007a.859.859 0 0 0-.335.343c-.073.133-.132.324-.132.614v.115a1.43 1.43 0 0 0 .14.66zm15.7-6.222c.232-.23.346-.516.346-.856a1.053 1.053 0 0 0-.345-.79 1.175 1.175 0 0 0-.84-.329c-.34 0-.625.11-.855.33a1.053 1.053 0 0 0-.346.79c0 .34.115.625.346.855.23.23.516.346.856.346.34 0 .62-.115.839-.346zm4.337 9.314.033-1.332c.128.269.324.518.59.747l.098.081a3.727 3.727 0 0 0 .316.224l.223.122a3.21 3.21 0 0 0 1.44.322 3.785 3.785 0 0 0 1.875-.477 3.52 3.52 0 0 0 1.382-1.366c.352-.593.526-1.29.526-2.09 0-.79-.147-1.48-.444-2.073a3.235 3.235 0 0 0-1.283-1.399c-.549-.34-1.195-.51-1.942-.51a3.476 3.476 0 0 0-1.527.344l-.086.043-.165.09a3.412 3.412 0 0 0-.33.214c-.288.21-.507.446-.656.707a1.893 1.893 0 0 0-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.482 2.482 0 0 0 .566.7c.078.065.159.125.245.18l.144.08a2.105 2.105 0 0 0 .975.232c.713 0 1.262-.225 1.645-.675.384-.46.576-1.053.576-1.778 0-.734-.192-1.327-.576-1.777-.373-.46-.921-.692-1.645-.692a2.18 2.18 0 0 0-1.015.235c-.147.075-.285.17-.415.282l-.15.142a2.086 2.086 0 0 0-.42.594c-.149.32-.223.685-.223 1.1v.115c0 .47.097.89.293 1.26zm2.616-.293c.157-.191.28-.479.28-.967 0-.51-.13-.79-.276-.961l-.021-.026c-.082-.1-.232-.225-.67-.225a.868.868 0 0 0-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0 .285.057.499.144.669a1.13 1.13 0 0 0 .367.405c.137.082.28.123.455.123.423 0 .59-.118.686-.23zm8.266-3.013c.23-.087.472-.134.724-.14l.069-.002c.329 0 .542.033.642.099l.247-1.794c-.13-.066-.37-.099-.717-.099a2.3 2.3 0 0 0-.545.063 2.086 2.086 0 0 0-.411.148 2.18 2.18 0 0 0-.4.249 2.482 2.482 0 0 0-.485.499 2.659 2.659 0 0 0-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884c0-.364.053-.678.159-.943a1.49 1.49 0 0 1 .466-.636 2.52 2.52 0 0 1 .399-.253 2.19 2.19 0 0 1 .224-.099zm9.784 2.656.05-.922c0-1.162-.285-2.062-.856-2.698-.559-.647-1.42-.97-2.584-.97-.746 0-1.415.163-2.007.493a3.462 3.462 0 0 0-1.4 1.382c-.329.604-.493 1.306-.493 2.106 0 .714.143 1.371.428 1.975.285.593.73 1.07 1.332 1.432.604.351 1.355.526 2.255.526.649 0 1.204-.062 1.668-.185l.044-.012.135-.04c.409-.122.736-.263.984-.421l-.542-1.267c-.2.108-.415.199-.642.274l-.297.087c-.34.088-.773.131-1.3.131-.636 0-1.135-.147-1.497-.444a1.573 1.573 0 0 1-.192-.193c-.244-.294-.415-.705-.512-1.234l-.004-.021h5.43zm-5.427-1.256-.003.022h3.752v-.138c-.007-.485-.104-.857-.288-1.118a1.056 1.056 0 0 0-.156-.176c-.307-.285-.746-.428-1.316-.428-.657 0-1.155.202-1.494.604-.253.3-.417.712-.494 1.234zm-27.053 2.77V4.7h-1.86v12.095h5.333V15.15zm7.103-5.908v7.553h-1.843V9.242h1.843z%27/%3E%3Cpath fill=%27%23fff%27 d=%27m19.63 11.151-.757-1.71-.345 1.71-1.12 5.644h-1.827L18.083 4.7h.197l3.325 6.533.988 2.19.988-2.19L26.839 4.7h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.93 5.644h-.098l-2.913-5.644zm14.836 5.81c-.68 0-1.311-.16-1.893-.478a3.795 3.795 0 0 1-1.381-1.382c-.34-.604-.51-1.306-.51-2.106 0-.79.147-1.482.444-2.074a3.364 3.364 0 0 1 1.3-1.382c.559-.33 1.217-.494 1.974-.494a3.293 3.293 0 0 1 1.234.231 3.341 3.341 0 0 1 .97.575c.264.22.44.439.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332c-.186.395-.526.746-1.02 1.053a3.167 3.167 0 0 1-1.662.444zm.296-1.482c.626 0 1.152-.214 1.58-.642.428-.44.642-1.01.642-1.711v-.115c0-.472-.098-.894-.296-1.267a2.211 2.211 0 0 0-.807-.872 2.098 2.098 0 0 0-1.119-.313c-.702 0-1.245.231-1.629.692-.384.45-.575 1.037-.575 1.76 0 .736.186 1.333.559 1.795.384.45.933.675 1.645.675zm6.521-6.237h1.711v1.4c.604-1.065 1.547-1.597 2.83-1.597 1.064 0 1.926.34 2.584 1.02.659.67.988 1.641.988 2.914 0 .79-.164 1.487-.493 2.09a3.456 3.456 0 0 1-1.316 1.399 3.51 3.51 0 0 1-1.844.493c-.636 0-1.19-.11-1.662-.329a2.665 2.665 0 0 1-1.086-.97l.017 5.134h-1.728V9.242zm4.048 6.22c.714 0 1.262-.224 1.645-.674.385-.46.576-1.048.576-1.762 0-.746-.192-1.338-.576-1.777-.372-.45-.92-.675-1.645-.675-.395 0-.768.098-1.12.296-.34.187-.613.46-.822.823-.197.351-.296.763-.296 1.234v.115c0 .472.098.894.296 1.267.209.362.483.647.823.855.34.197.713.297 1.119.297z%27/%3E%3Cpath fill=%27%23e1e3e9%27 d=%27M51.325 4.7h1.86v10.45h3.473v1.646h-5.333zm7.12 4.542h1.843v7.553h-1.843zm.905-1.415a1.159 1.159 0 0 1-.856-.346 1.165 1.165 0 0 1-.346-.856 1.053 1.053 0 0 1 .346-.79c.23-.219.516-.329.856-.329.329 0 .609.11.839.33a1.053 1.053 0 0 1 .345.79 1.159 1.159 0 0 1-.345.855c-.22.23-.5.346-.84.346zm7.875 9.133a3.167 3.167 0 0 1-1.662-.444c-.482-.307-.817-.658-1.004-1.053l-.033 1.332h-1.71V4.701h1.743v4.657l-.082 1.283c.186-.438.548-.812 1.086-1.119a3.486 3.486 0 0 1 1.778-.477c.746 0 1.393.17 1.942.51a3.235 3.235 0 0 1 1.283 1.4c.297.592.444 1.282.444 2.072 0 .8-.175 1.498-.526 2.09a3.52 3.52 0 0 1-1.382 1.366 3.785 3.785 0 0 1-1.876.477zm-.296-1.481c.713 0 1.26-.225 1.645-.675.384-.46.577-1.053.577-1.778 0-.734-.193-1.327-.577-1.776-.373-.46-.921-.692-1.645-.692a2.115 2.115 0 0 0-1.58.659c-.428.428-.642.992-.642 1.694v.115c0 .473.098.895.296 1.267a2.385 2.385 0 0 0 .807.872 2.1 2.1 0 0 0 1.119.313zm5.927-6.237h1.777v1.481c.176-.505.46-.91.856-1.217a2.14 2.14 0 0 1 1.349-.46c.351 0 .593.032.724.098l-.247 1.794c-.099-.066-.313-.099-.642-.099-.516 0-.988.164-1.416.494-.417.329-.626.855-.626 1.58v3.883h-1.777V9.242zm9.534 7.718c-.9 0-1.651-.175-2.255-.526-.603-.362-1.047-.84-1.332-1.432a4.567 4.567 0 0 1-.428-1.975c0-.8.164-1.502.493-2.106a3.462 3.462 0 0 1 1.4-1.382c.592-.33 1.262-.494 2.007-.494 1.163 0 2.024.324 2.584.97.57.637.856 1.537.856 2.7 0 .296-.017.603-.05.92h-5.43c.12.67.356 1.153.708 1.45.362.296.86.443 1.497.443.526 0 .96-.044 1.3-.131a4.123 4.123 0 0 0 .938-.362l.542 1.267c-.274.175-.647.329-1.119.46-.472.132-1.042.197-1.711.197zm1.596-4.558c.01-.68-.137-1.158-.444-1.432-.307-.285-.746-.428-1.316-.428-1.152 0-1.815.62-1.991 1.86h3.752z%27/%3E%3Cg fill-rule=%27evenodd%27 stroke-width=%271.036%27%3E%3Cpath fill=%27%23000%27 fill-opacity=%27.4%27 d=%27m8.166 16.146-.002.002a1.54 1.54 0 0 1-2.009 0l-.002-.002-.043-.034-.002-.002-.199-.162H4.377a.657.657 0 0 0-.659.659v1.84a.657.657 0 0 0 .659.659h5.565a.657.657 0 0 0 .659-.659v-1.84a.657.657 0 0 0-.659-.659H8.411l-.202.164zm-1.121-.905a.29.29 0 0 0 .113.023.286.286 0 0 0 .189-.07l.077-.063c.634-.508 4.672-3.743 4.672-7.575 0-2.55-2.215-4.625-4.938-4.625S2.221 5.006 2.221 7.556c0 3.225 2.86 6.027 4.144 7.137h.004l.04.038.484.4.077.063a.628.628 0 0 0 .074.047zm-2.52-.548a16.898 16.898 0 0 1-1.183-1.315C2.187 11.942.967 9.897.967 7.555c0-3.319 2.855-5.88 6.192-5.88 3.338 0 6.193 2.561 6.193 5.881 0 2.34-1.22 4.387-2.376 5.822a16.898 16.898 0 0 1-1.182 1.315h.15a1.912 1.912 0 0 1 1.914 1.914v1.84a1.912 1.912 0 0 1-1.914 1.914H4.377a1.912 1.912 0 0 1-1.914-1.914v-1.84a1.912 1.912 0 0 1 1.914-1.914zm3.82-6.935c0 .692-.55 1.222-1.187 1.222s-1.185-.529-1.185-1.222.548-1.222 1.185-1.222c.638 0 1.186.529 1.186 1.222zm-1.186 2.477c1.348 0 2.442-1.11 2.442-2.478S8.507 5.28 7.159 5.28 4.72 6.39 4.72 7.758s1.092 2.477 2.44 2.477zm2.048 7.71H5.114v-.838h4.093z%27/%3E%3Cpath fill=%27%23e1e3e9%27 d=%27M2.222 7.555c0-2.55 2.214-4.625 4.937-4.625 2.723 0 4.938 2.075 4.938 4.625 0 3.832-4.038 7.068-4.672 7.575l-.077.063a.286.286 0 0 1-.189.07.286.286 0 0 1-.188-.07l-.077-.063c-.634-.507-4.672-3.743-4.672-7.575zm4.937 2.68c1.348 0 2.442-1.11 2.442-2.478S8.507 5.28 7.159 5.28 4.72 6.39 4.72 7.758s1.092 2.477 2.44 2.477z%27/%3E%3Cpath fill=%27%23fff%27 d=%27M4.377 15.948a.657.657 0 0 0-.659.659v1.84a.657.657 0 0 0 .659.659h5.565a.657.657 0 0 0 .659-.659v-1.84a.657.657 0 0 0-.659-.659zm4.83 1.16H5.114v.838h4.093z%27/%3E%3C/g%3E%3C/svg%3E"},4613:function(t){t.exports=function(){"use strict";var t,e,i;function r(r,n){if(t)if(e){var a="var sharedChunk = {}; ("+t+")(sharedChunk); ("+e+")(sharedChunk);",o={};t(o),i=n(o),"undefined"!=typeof window&&(i.workerUrl=window.URL.createObjectURL(new Blob([a],{type:"text/javascript"})))}else e=n;else t=n}return r(0,(function(t){function e(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var i=r;function r(t,e){this.x=t,this.y=e}r.prototype={clone:function(){return new r(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},multByPoint:function(t){return this.clone()._multByPoint(t)},divByPoint:function(t){return this.clone()._divByPoint(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},rotateAround:function(t,e){return this.clone()._rotateAround(t,e)},matMult:function(t){return this.clone()._matMult(t)},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(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var e=t.x-this.x,i=t.y-this.y;return e*e+i*i},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult:function(t){var e=t[2]*this.x+t[3]*this.y;return this.x=t[0]*this.x+t[1]*this.y,this.y=e,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_multByPoint:function(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint:function(t){return this.x/=t.x,this.y/=t.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var e=Math.cos(t),i=Math.sin(t),r=i*this.x+e*this.y;return this.x=e*this.x-i*this.y,this.y=r,this},_rotateAround:function(t,e){var i=Math.cos(t),r=Math.sin(t),n=e.y+r*(this.x-e.x)+i*(this.y-e.y);return this.x=e.x+i*(this.x-e.x)-r*(this.y-e.y),this.y=n,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},r.convert=function(t){return t instanceof r?t:Array.isArray(t)?new r(t[0],t[1]):t};var n=e(i),a=o;function o(t,e,i,r){this.cx=3*t,this.bx=3*(i-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(r-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=e,this.p2x=i,this.p2y=r}o.prototype={sampleCurveX:function(t){return((this.ax*t+this.bx)*t+this.cx)*t},sampleCurveY:function(t){return((this.ay*t+this.by)*t+this.cy)*t},sampleCurveDerivativeX:function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},solveCurveX:function(t,e){if(void 0===e&&(e=1e-6),t<0)return 0;if(t>1)return 1;for(var i=t,r=0;r<8;r++){var n=this.sampleCurveX(i)-t;if(Math.abs(n)<e)return i;var a=this.sampleCurveDerivativeX(i);if(Math.abs(a)<1e-6)break;i-=n/a}var o=0,s=1;for(i=t,r=0;r<20&&(n=this.sampleCurveX(i),!(Math.abs(n-t)<e));r++)t>n?o=i:s=i,i=.5*(s-o)+o;return i},solve:function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))}};var s=e(a);let l,c;function h(){return null==l&&(l="undefined"!=typeof OffscreenCanvas&&new OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof createImageBitmap),l}function u(){if(null==c&&(c=!1,h())){const t=5,e=new OffscreenCanvas(t,t).getContext("2d",{willReadFrequently:!0});if(e){for(let i=0;i<t*t;i++){const r=4*i;e.fillStyle=`rgb(${r},${r+1},${r+2})`,e.fillRect(i%t,Math.floor(i/t),1,1)}const i=e.getImageData(0,0,t,t).data;for(let e=0;e<t*t*4;e++)if(e%4!=3&&i[e]!==e){c=!0;break}}}return c||!1}function p(t,e,i,r){const n=new s(t,e,i,r);return function(t){return n.solve(t)}}const d=p(.25,.1,.25,1);function m(t,e,i){return Math.min(i,Math.max(e,t))}function f(t,e,i){const r=i-e,n=((t-e)%r+r)%r+e;return n===e?i:n}function g(t,...e){for(const i of e)for(const e in i)t[e]=i[e];return t}let _=1;function y(t,e,i){const r={};for(const n in t)r[n]=e.call(i||this,t[n],n,t);return r}function x(t,e,i){const r={};for(const n in t)e.call(i||this,t[n],n,t)&&(r[n]=t[n]);return r}function v(t){return Array.isArray(t)?t.map(v):"object"==typeof t&&t?y(t,v):t}const b={};function w(t){b[t]||("undefined"!=typeof console&&console.warn(t),b[t]=!0)}function E(t,e,i){return(i.y-t.y)*(e.x-t.x)>(e.y-t.y)*(i.x-t.x)}function T(t){let e=0;for(let i,r,n=0,a=t.length,o=a-1;n<a;o=n++)i=t[n],r=t[o],e+=(r.x-i.x)*(i.y+r.y);return e}function S(){return"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope}let C=null;function I(t){if(null==C){const e=t.navigator?t.navigator.userAgent:null;C=!!t.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return C}function A(t){return"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap}const M="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";async function k(t,e,i,r,n){if("undefined"==typeof VideoFrame)throw new Error("VideoFrame not supported");const a=new VideoFrame(t,{timestamp:0});try{const o=null==a?void 0:a.format;if(!o||!o.startsWith("BGR")&&!o.startsWith("RGB"))throw new Error(`Unrecognized format ${o}`);const s=o.startsWith("BGR"),l=new Uint8ClampedArray(r*n*4);if(await a.copyTo(l,function(t,e,i,r,n){const a=4*Math.max(-e,0),o=(Math.max(0,i)-i)*r*4+a,s=4*r,l=Math.max(0,e),c=Math.max(0,i);return{rect:{x:l,y:c,width:Math.min(t.width,e+r)-l,height:Math.min(t.height,i+n)-c},layout:[{offset:o,stride:s}]}}(t,e,i,r,n)),s)for(let t=0;t<l.length;t+=4){const e=l[t];l[t]=l[t+2],l[t+2]=e}return l}finally{a.close()}}let P,z,L,D;const R={now:"undefined"!=typeof performance&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frame(t){const e=requestAnimationFrame(t);return{cancel:()=>cancelAnimationFrame(e)}},getImageData(t,e=0){return this.getImageCanvasContext(t).getImageData(-e,-e,t.width+2*e,t.height+2*e)},getImageCanvasContext(t){const e=window.document.createElement("canvas"),i=e.getContext("2d",{willReadFrequently:!0});if(!i)throw new Error("failed to create canvas 2d context");return e.width=t.width,e.height=t.height,i.drawImage(t,0,0,t.width,t.height),i},resolveURL:t=>(L||(L=document.createElement("a")),L.href=t,L.href),hardwareConcurrency:"undefined"!=typeof navigator&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(null==D&&(D=matchMedia("(prefers-reduced-motion: reduce)")),D.matches)}},B={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};class F extends Error{constructor(t,e,i,r){super(`AJAXError: ${e} (${t}): ${i}`),this.status=t,this.statusText=e,this.url=i,this.body=r}}const O=S()?()=>self.worker&&self.worker.referrer:()=>("blob:"===window.location.protocol?window.parent:window).location.href,U=t=>B.REGISTERED_PROTOCOLS[t.substring(0,t.indexOf("://"))];function V(t,e){const i=new AbortController,r=new Request(t.url,{method:t.method||"GET",body:t.body,credentials:t.credentials,headers:t.headers,cache:t.cache,referrer:O(),signal:i.signal});let n=!1,a=!1;return"json"===t.type&&r.headers.set("Accept","application/json"),a||fetch(r).then((i=>i.ok?(i=>{("arrayBuffer"===t.type||"image"===t.type?i.arrayBuffer():"json"===t.type?i.json():i.text()).then((t=>{a||(n=!0,e(null,t,i.headers.get("Cache-Control"),i.headers.get("Expires")))})).catch((t=>{a||e(new Error(t.message))}))})(i):i.blob().then((r=>e(new F(i.status,i.statusText,t.url,r)))))).catch((t=>{20!==t.code&&e(new Error(t.message))})),{cancel:()=>{a=!0,n||i.abort()}}}const N=function(t,e){if(/:\/\//.test(t.url)&&!/^https?:|^file:/.test(t.url)){if(S()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",t,e);if(!S())return(U(t.url)||V)(t,e)}if(!(/^file:/.test(i=t.url)||/^file:/.test(O())&&!/^\w+:/.test(i))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return V(t,e);if(S()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",t,e,void 0,!0)}var i;return function(t,e){const i=new XMLHttpRequest;i.open(t.method||"GET",t.url,!0),"arrayBuffer"!==t.type&&"image"!==t.type||(i.responseType="arraybuffer");for(const e in t.headers)i.setRequestHeader(e,t.headers[e]);return"json"===t.type&&(i.responseType="text",i.setRequestHeader("Accept","application/json")),i.withCredentials="include"===t.credentials,i.onerror=()=>{e(new Error(i.statusText))},i.onload=()=>{if((i.status>=200&&i.status<300||0===i.status)&&null!==i.response){let r=i.response;if("json"===t.type)try{r=JSON.parse(i.response)}catch(t){return e(t)}e(null,r,i.getResponseHeader("Cache-Control"),i.getResponseHeader("Expires"))}else{const r=new Blob([i.response],{type:i.getResponseHeader("Content-Type")});e(new F(i.status,i.statusText,t.url,r))}},i.send(t.body),{cancel:()=>i.abort()}}(t,e)},$=function(t,e){return N(g(t,{type:"arrayBuffer"}),e)};function j(t){if(!t||t.indexOf("://")<=0||0===t.indexOf("data:image/")||0===t.indexOf("blob:"))return!0;const e=new URL(t),i=window.location;return e.protocol===i.protocol&&e.host===i.host}function q(t,e,i){i[t]&&-1!==i[t].indexOf(e)||(i[t]=i[t]||[],i[t].push(e))}function Z(t,e,i){if(i&&i[t]){const r=i[t].indexOf(e);-1!==r&&i[t].splice(r,1)}}class G{constructor(t,e={}){g(this,e),this.type=t}}class H extends G{constructor(t,e={}){super("error",g({error:t},e))}}class X{on(t,e){return this._listeners=this._listeners||{},q(t,e,this._listeners),this}off(t,e){return Z(t,e,this._listeners),Z(t,e,this._oneTimeListeners),this}once(t,e){return e?(this._oneTimeListeners=this._oneTimeListeners||{},q(t,e,this._oneTimeListeners),this):new Promise((e=>this.once(t,e)))}fire(t,e){"string"==typeof t&&(t=new G(t,e||{}));const i=t.type;if(this.listens(i)){t.target=this;const e=this._listeners&&this._listeners[i]?this._listeners[i].slice():[];for(const i of e)i.call(this,t);const r=this._oneTimeListeners&&this._oneTimeListeners[i]?this._oneTimeListeners[i].slice():[];for(const e of r)Z(i,e,this._oneTimeListeners),e.call(this,t);const n=this._eventedParent;n&&(g(t,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),n.fire(t))}else t instanceof H&&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,e){return this._eventedParent=t,this._eventedParentData=e,this}}var W={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{},within:{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}}};const K=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function Y(t,e){const i={};for(const e in t)"ref"!==e&&(i[e]=t[e]);return K.forEach((t=>{t in e&&(i[t]=e[t])})),i}function J(t,e){if(Array.isArray(t)){if(!Array.isArray(e)||t.length!==e.length)return!1;for(let i=0;i<t.length;i++)if(!J(t[i],e[i]))return!1;return!0}if("object"==typeof t&&null!==t&&null!==e){if("object"!=typeof e)return!1;if(Object.keys(t).length!==Object.keys(e).length)return!1;for(const i in t)if(!J(t[i],e[i]))return!1;return!0}return t===e}const Q={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 tt(t,e,i){i.push({command:Q.addSource,args:[t,e[t]]})}function et(t,e,i){e.push({command:Q.removeSource,args:[t]}),i[t]=!0}function it(t,e,i,r){et(t,i,r),tt(t,e,i)}function rt(t,e,i){let r;for(r in t[i])if(Object.prototype.hasOwnProperty.call(t[i],r)&&"data"!==r&&!J(t[i][r],e[i][r]))return!1;for(r in e[i])if(Object.prototype.hasOwnProperty.call(e[i],r)&&"data"!==r&&!J(t[i][r],e[i][r]))return!1;return!0}function nt(t,e,i,r,n,a){let o;for(o in e=e||{},t=t||{})Object.prototype.hasOwnProperty.call(t,o)&&(J(t[o],e[o])||i.push({command:a,args:[r,o,e[o],n]}));for(o in e)Object.prototype.hasOwnProperty.call(e,o)&&!Object.prototype.hasOwnProperty.call(t,o)&&(J(t[o],e[o])||i.push({command:a,args:[r,o,e[o],n]}))}function at(t){return t.id}function ot(t,e){return t[e.id]=e,t}class st{constructor(t,e,i,r){this.message=(t?`${t}: `:"")+i,r&&(this.identifier=r),null!=e&&e.__line__&&(this.line=e.__line__)}}function lt(t,...e){for(const i of e)for(const e in i)t[e]=i[e];return t}class ct extends Error{constructor(t,e){super(e),this.message=e,this.key=t}}class ht{constructor(t,e=[]){this.parent=t,this.bindings={};for(const[t,i]of e)this.bindings[t]=i}concat(t){return new ht(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)}}const ut={kind:"null"},pt={kind:"number"},dt={kind:"string"},mt={kind:"boolean"},ft={kind:"color"},gt={kind:"object"},_t={kind:"value"},yt={kind:"collator"},xt={kind:"formatted"},vt={kind:"padding"},bt={kind:"resolvedImage"},wt={kind:"variableAnchorOffsetCollection"};function Et(t,e){return{kind:"array",itemType:t,N:e}}function Tt(t){if("array"===t.kind){const e=Tt(t.itemType);return"number"==typeof t.N?`array<${e}, ${t.N}>`:"value"===t.itemType.kind?"array":`array<${e}>`}return t.kind}const St=[ut,pt,dt,mt,ft,xt,gt,Et(_t),vt,bt,wt];function Ct(t,e){if("error"===e.kind)return null;if("array"===t.kind){if("array"===e.kind&&(0===e.N&&"value"===e.itemType.kind||!Ct(t.itemType,e.itemType))&&("number"!=typeof t.N||t.N===e.N))return null}else{if(t.kind===e.kind)return null;if("value"===t.kind)for(const t of St)if(!Ct(t,e))return null}return`Expected ${Tt(t)} but found ${Tt(e)} instead.`}function It(t,e){return e.some((e=>e.kind===t.kind))}function At(t,e){return e.some((e=>"null"===e?null===t:"array"===e?Array.isArray(t):"object"===e?t&&!Array.isArray(t)&&"object"==typeof t:e===typeof t))}function Mt(t,e){return"array"===t.kind&&"array"===e.kind?t.itemType.kind===e.itemType.kind&&"number"==typeof t.N:t.kind===e.kind}const kt=.96422,Pt=.82521,zt=4/29,Lt=6/29,Dt=3*Lt*Lt,Rt=Lt*Lt*Lt,Bt=Math.PI/180,Ft=180/Math.PI;function Ot(t){return(t%=360)<0&&(t+=360),t}function Ut([t,e,i,r]){let n,a;const o=Nt((.2225045*(t=Vt(t))+.7168786*(e=Vt(e))+.0606169*(i=Vt(i)))/1);t===e&&e===i?n=a=o:(n=Nt((.4360747*t+.3850649*e+.1430804*i)/kt),a=Nt((.0139322*t+.0971045*e+.7141733*i)/Pt));const s=116*o-16;return[s<0?0:s,500*(n-o),200*(o-a),r]}function Vt(t){return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Nt(t){return t>Rt?Math.pow(t,1/3):t/Dt+zt}function $t([t,e,i,r]){let n=(t+16)/116,a=isNaN(e)?n:n+e/500,o=isNaN(i)?n:n-i/200;return n=1*qt(n),a=kt*qt(a),o=Pt*qt(o),[jt(3.1338561*a-1.6168667*n-.4906146*o),jt(-.9787684*a+1.9161415*n+.033454*o),jt(.0719453*a-.2289914*n+1.4052427*o),r]}function jt(t){return(t=t<=.00304?12.92*t:1.055*Math.pow(t,1/2.4)-.055)<0?0:t>1?1:t}function qt(t){return t>Lt?t*t*t:Dt*(t-zt)}function Zt(t){return parseInt(t.padEnd(2,t),16)/255}function Gt(t,e){return Ht(e?t/100:t,0,1)}function Ht(t,e,i){return Math.min(Math.max(e,t),i)}function Xt(t){return!t.some(Number.isNaN)}const Wt={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};class Kt{constructor(t,e,i,r=1,n=!0){this.r=t,this.g=e,this.b=i,this.a=r,n||(this.r*=r,this.g*=r,this.b*=r,r||this.overwriteGetter("rgb",[t,e,i,r]))}static parse(t){if(t instanceof Kt)return t;if("string"!=typeof t)return;const e=function(t){if("transparent"===(t=t.toLowerCase().trim()))return[0,0,0,0];const e=Wt[t];if(e){const[t,i,r]=e;return[t/255,i/255,r/255,1]}if(t.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(t)){const e=t.length<6?1:2;let i=1;return[Zt(t.slice(i,i+=e)),Zt(t.slice(i,i+=e)),Zt(t.slice(i,i+=e)),Zt(t.slice(i,i+e)||"ff")]}if(t.startsWith("rgb")){const e=t.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(e){const[t,i,r,n,a,o,s,l,c,h,u,p]=e,d=[n||" ",s||" ",h].join("");if(" "===d||" /"===d||",,"===d||",,,"===d){const t=[r,o,c].join(""),e="%%%"===t?100:""===t?255:0;if(e){const t=[Ht(+i/e,0,1),Ht(+a/e,0,1),Ht(+l/e,0,1),u?Gt(+u,p):1];if(Xt(t))return t}}return}}const i=t.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(i){const[t,e,r,n,a,o,s,l,c]=i,h=[r||" ",a||" ",s].join("");if(" "===h||" /"===h||",,"===h||",,,"===h){const t=[+e,Ht(+n,0,100),Ht(+o,0,100),l?Gt(+l,c):1];if(Xt(t))return function([t,e,i,r]){function n(r){const n=(r+t/30)%12,a=e*Math.min(i,1-i);return i-a*Math.max(-1,Math.min(n-3,9-n,1))}return t=Ot(t),e/=100,i/=100,[n(0),n(8),n(4),r]}(t)}}}(t);return e?new Kt(...e,!1):void 0}get rgb(){const{r:t,g:e,b:i,a:r}=this,n=r||1/0;return this.overwriteGetter("rgb",[t/n,e/n,i/n,r])}get hcl(){return this.overwriteGetter("hcl",function(t){const[e,i,r,n]=Ut(t),a=Math.sqrt(i*i+r*r);return[Math.round(1e4*a)?Ot(Math.atan2(r,i)*Ft):NaN,a,e,n]}(this.rgb))}get lab(){return this.overwriteGetter("lab",Ut(this.rgb))}overwriteGetter(t,e){return Object.defineProperty(this,t,{value:e}),e}toString(){const[t,e,i,r]=this.rgb;return`rgba(${[t,e,i].map((t=>Math.round(255*t))).join(",")},${r})`}}Kt.black=new Kt(0,0,0,1),Kt.white=new Kt(1,1,1,1),Kt.transparent=new Kt(0,0,0,0),Kt.red=new Kt(1,0,0,1);class Yt{constructor(t,e,i){this.sensitivity=t?e?"variant":"case":e?"accent":"base",this.locale=i,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(t,e){return this.collator.compare(t,e)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class Jt{constructor(t,e,i,r,n){this.text=t,this.image=e,this.scale=i,this.fontStack=r,this.textColor=n}}class Qt{constructor(t){this.sections=t}static fromString(t){return new Qt([new Jt(t,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some((t=>0!==t.text.length||t.image&&0!==t.image.name.length))}static factory(t){return t instanceof Qt?t:Qt.fromString(t)}toString(){return 0===this.sections.length?"":this.sections.map((t=>t.text)).join("")}}class te{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof te)return t;if("number"==typeof t)return new te([t,t,t,t]);if(Array.isArray(t)&&!(t.length<1||t.length>4)){for(const e of t)if("number"!=typeof e)return;switch(t.length){case 1:t=[t[0],t[0],t[0],t[0]];break;case 2:t=[t[0],t[1],t[0],t[1]];break;case 3:t=[t[0],t[1],t[2],t[1]]}return new te(t)}}toString(){return JSON.stringify(this.values)}}const ee=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class ie{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof ie)return t;if(Array.isArray(t)&&!(t.length<1)&&t.length%2==0){for(let e=0;e<t.length;e+=2){const i=t[e],r=t[e+1];if("string"!=typeof i||!ee.has(i))return;if(!Array.isArray(r)||2!==r.length||"number"!=typeof r[0]||"number"!=typeof r[1])return}return new ie(t)}}toString(){return JSON.stringify(this.values)}}class re{constructor(t){this.name=t.name,this.available=t.available}toString(){return this.name}static fromString(t){return t?new re({name:t,available:!1}):null}}function ne(t,e,i,r){return"number"==typeof t&&t>=0&&t<=255&&"number"==typeof e&&e>=0&&e<=255&&"number"==typeof i&&i>=0&&i<=255?void 0===r||"number"==typeof r&&r>=0&&r<=1?null:`Invalid rgba value [${[t,e,i,r].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${("number"==typeof r?[t,e,i,r]:[t,e,i]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function ae(t){if(null===t||"string"==typeof t||"boolean"==typeof t||"number"==typeof t||t instanceof Kt||t instanceof Yt||t instanceof Qt||t instanceof te||t instanceof ie||t instanceof re)return!0;if(Array.isArray(t)){for(const e of t)if(!ae(e))return!1;return!0}if("object"==typeof t){for(const e in t)if(!ae(t[e]))return!1;return!0}return!1}function oe(t){if(null===t)return ut;if("string"==typeof t)return dt;if("boolean"==typeof t)return mt;if("number"==typeof t)return pt;if(t instanceof Kt)return ft;if(t instanceof Yt)return yt;if(t instanceof Qt)return xt;if(t instanceof te)return vt;if(t instanceof ie)return wt;if(t instanceof re)return bt;if(Array.isArray(t)){const e=t.length;let i;for(const e of t){const t=oe(e);if(i){if(i===t)continue;i=_t;break}i=t}return Et(i||_t,e)}return gt}function se(t){const e=typeof t;return null===t?"":"string"===e||"number"===e||"boolean"===e?String(t):t instanceof Kt||t instanceof Qt||t instanceof te||t instanceof ie||t instanceof re?t.toString():JSON.stringify(t)}class le{constructor(t,e){this.type=t,this.value=e}static parse(t,e){if(2!==t.length)return e.error(`'literal' expression requires exactly one argument, but found ${t.length-1} instead.`);if(!ae(t[1]))return e.error("invalid value");const i=t[1];let r=oe(i);const n=e.expectedType;return"array"!==r.kind||0!==r.N||!n||"array"!==n.kind||"number"==typeof n.N&&0!==n.N||(r=n),new le(r,i)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class ce{constructor(t){this.name="ExpressionEvaluationError",this.message=t}toJSON(){return this.message}}const he={string:dt,number:pt,boolean:mt,object:gt};class ue{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");let i,r=1;const n=t[0];if("array"===n){let n,a;if(t.length>2){const i=t[1];if("string"!=typeof i||!(i in he)||"object"===i)return e.error('The item type argument of "array" must be one of string, number, boolean',1);n=he[i],r++}else n=_t;if(t.length>3){if(null!==t[2]&&("number"!=typeof t[2]||t[2]<0||t[2]!==Math.floor(t[2])))return e.error('The length argument to "array" must be a positive integer literal',2);a=t[2],r++}i=Et(n,a)}else{if(!he[n])throw new Error(`Types doesn't contain name = ${n}`);i=he[n]}const a=[];for(;r<t.length;r++){const i=e.parse(t[r],r,_t);if(!i)return null;a.push(i)}return new ue(i,a)}evaluate(t){for(let e=0;e<this.args.length;e++){const i=this.args[e].evaluate(t);if(!Ct(this.type,oe(i)))return i;if(e===this.args.length-1)throw new ce(`Expected value to be of type ${Tt(this.type)}, but found ${Tt(oe(i))} instead.`)}throw new Error}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}}const pe={"to-boolean":mt,"to-color":ft,"to-number":pt,"to-string":dt};class de{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");const i=t[0];if(!pe[i])throw new Error(`Can't parse ${i} as it is not part of the known types`);if(("to-boolean"===i||"to-string"===i)&&2!==t.length)return e.error("Expected one argument.");const r=pe[i],n=[];for(let i=1;i<t.length;i++){const r=e.parse(t[i],i,_t);if(!r)return null;n.push(r)}return new de(r,n)}evaluate(t){switch(this.type.kind){case"boolean":return Boolean(this.args[0].evaluate(t));case"color":{let e,i;for(const r of this.args){if(e=r.evaluate(t),i=null,e instanceof Kt)return e;if("string"==typeof e){const i=t.parseColor(e);if(i)return i}else if(Array.isArray(e)&&(i=e.length<3||e.length>4?`Invalid rbga value ${JSON.stringify(e)}: expected an array containing either three or four numeric values.`:ne(e[0],e[1],e[2],e[3]),!i))return new Kt(e[0]/255,e[1]/255,e[2]/255,e[3])}throw new ce(i||`Could not parse color from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}case"padding":{let e;for(const i of this.args){e=i.evaluate(t);const r=te.parse(e);if(r)return r}throw new ce(`Could not parse padding from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}case"variableAnchorOffsetCollection":{let e;for(const i of this.args){e=i.evaluate(t);const r=ie.parse(e);if(r)return r}throw new ce(`Could not parse variableAnchorOffsetCollection from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}case"number":{let e=null;for(const i of this.args){if(e=i.evaluate(t),null===e)return 0;const r=Number(e);if(!isNaN(r))return r}throw new ce(`Could not convert ${JSON.stringify(e)} to number.`)}case"formatted":return Qt.fromString(se(this.args[0].evaluate(t)));case"resolvedImage":return re.fromString(se(this.args[0].evaluate(t)));default:return se(this.args[0].evaluate(t))}}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}}const me=["Unknown","Point","LineString","Polygon"];class fe{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?"number"==typeof this.feature.type?me[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 e=this._parseColorCache[t];return e||(e=this._parseColorCache[t]=Kt.parse(t)),e}}class ge{constructor(t,e,i=[],r,n=new ht,a=[]){this.registry=t,this.path=i,this.key=i.map((t=>`[${t}]`)).join(""),this.scope=n,this.errors=a,this.expectedType=r,this._isConstant=e}parse(t,e,i,r,n={}){return e?this.concat(e,i,r)._parse(t,n):this._parse(t,n)}_parse(t,e){function i(t,e,i){return"assert"===i?new ue(e,[t]):"coerce"===i?new de(e,[t]):t}if(null!==t&&"string"!=typeof t&&"boolean"!=typeof t&&"number"!=typeof t||(t=["literal",t]),Array.isArray(t)){if(0===t.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const r=t[0];if("string"!=typeof r)return this.error(`Expression name must be a string, but found ${typeof r} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const n=this.registry[r];if(n){let r=n.parse(t,this);if(!r)return null;if(this.expectedType){const t=this.expectedType,n=r.type;if("string"!==t.kind&&"number"!==t.kind&&"boolean"!==t.kind&&"object"!==t.kind&&"array"!==t.kind||"value"!==n.kind)if("color"!==t.kind&&"formatted"!==t.kind&&"resolvedImage"!==t.kind||"value"!==n.kind&&"string"!==n.kind)if("padding"!==t.kind||"value"!==n.kind&&"number"!==n.kind&&"array"!==n.kind)if("variableAnchorOffsetCollection"!==t.kind||"value"!==n.kind&&"array"!==n.kind){if(this.checkSubtype(t,n))return null}else r=i(r,t,e.typeAnnotation||"coerce");else r=i(r,t,e.typeAnnotation||"coerce");else r=i(r,t,e.typeAnnotation||"coerce");else r=i(r,t,e.typeAnnotation||"assert")}if(!(r instanceof le)&&"resolvedImage"!==r.type.kind&&this._isConstant(r)){const e=new fe;try{r=new le(r.type,r.evaluate(e))}catch(t){return this.error(t.message),null}}return r}return this.error(`Unknown expression "${r}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(void 0===t?"'undefined' value invalid. Use null instead.":"object"==typeof t?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof t} instead.`)}concat(t,e,i){const r="number"==typeof t?this.path.concat(t):this.path,n=i?this.scope.concat(i):this.scope;return new ge(this.registry,this._isConstant,r,e||null,n,this.errors)}error(t,...e){const i=`${this.key}${e.map((t=>`[${t}]`)).join("")}`;this.errors.push(new ct(i,t))}checkSubtype(t,e){const i=Ct(t,e);return i&&this.error(i),i}}class _e{constructor(t,e,i){this.type=yt,this.locale=i,this.caseSensitive=t,this.diacriticSensitive=e}static parse(t,e){if(2!==t.length)return e.error("Expected one argument.");const i=t[1];if("object"!=typeof i||Array.isArray(i))return e.error("Collator options argument must be an object.");const r=e.parse(void 0!==i["case-sensitive"]&&i["case-sensitive"],1,mt);if(!r)return null;const n=e.parse(void 0!==i["diacritic-sensitive"]&&i["diacritic-sensitive"],1,mt);if(!n)return null;let a=null;return i.locale&&(a=e.parse(i.locale,1,dt),!a)?null:new _e(r,n,a)}evaluate(t){return new Yt(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}}const ye=8192;function xe(t,e){t[0]=Math.min(t[0],e[0]),t[1]=Math.min(t[1],e[1]),t[2]=Math.max(t[2],e[0]),t[3]=Math.max(t[3],e[1])}function ve(t,e){return!(t[0]<=e[0]||t[2]>=e[2]||t[1]<=e[1]||t[3]>=e[3])}function be(t,e){const i=(180+t[0])/360,r=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t[1]*Math.PI/360)))/360,n=Math.pow(2,e.z);return[Math.round(i*n*ye),Math.round(r*n*ye)]}function we(t,e,i){const r=t[0]-e[0],n=t[1]-e[1],a=t[0]-i[0],o=t[1]-i[1];return r*o-a*n==0&&r*a<=0&&n*o<=0}function Ee(t,e){let i=!1;for(let o=0,s=e.length;o<s;o++){const s=e[o];for(let e=0,o=s.length;e<o-1;e++){if(we(t,s[e],s[e+1]))return!1;(n=s[e])[1]>(r=t)[1]!=(a=s[e+1])[1]>r[1]&&r[0]<(a[0]-n[0])*(r[1]-n[1])/(a[1]-n[1])+n[0]&&(i=!i)}}var r,n,a;return i}function Te(t,e){for(let i=0;i<e.length;i++)if(Ee(t,e[i]))return!0;return!1}function Se(t,e,i,r){const n=r[0]-i[0],a=r[1]-i[1],o=(t[0]-i[0])*a-n*(t[1]-i[1]),s=(e[0]-i[0])*a-n*(e[1]-i[1]);return o>0&&s<0||o<0&&s>0}function Ce(t,e,i){for(const c of i)for(let i=0;i<c.length-1;++i)if(0!=(s=[(o=c[i+1])[0]-(a=c[i])[0],o[1]-a[1]])[0]*(l=[(n=e)[0]-(r=t)[0],n[1]-r[1]])[1]-s[1]*l[0]&&Se(r,n,a,o)&&Se(a,o,r,n))return!0;var r,n,a,o,s,l;return!1}function Ie(t,e){for(let i=0;i<t.length;++i)if(!Ee(t[i],e))return!1;for(let i=0;i<t.length-1;++i)if(Ce(t[i],t[i+1],e))return!1;return!0}function Ae(t,e){for(let i=0;i<e.length;i++)if(Ie(t,e[i]))return!0;return!1}function Me(t,e,i){const r=[];for(let n=0;n<t.length;n++){const a=[];for(let r=0;r<t[n].length;r++){const o=be(t[n][r],i);xe(e,o),a.push(o)}r.push(a)}return r}function ke(t,e,i){const r=[];for(let n=0;n<t.length;n++){const a=Me(t[n],e,i);r.push(a)}return r}function Pe(t,e,i,r){if(t[0]<i[0]||t[0]>i[2]){const e=.5*r;let n=t[0]-i[0]>e?-r:i[0]-t[0]>e?r:0;0===n&&(n=t[0]-i[2]>e?-r:i[2]-t[0]>e?r:0),t[0]+=n}xe(e,t)}function ze(t,e,i,r){const n=Math.pow(2,r.z)*ye,a=[r.x*ye,r.y*ye],o=[];for(const r of t)for(const t of r){const r=[t.x+a[0],t.y+a[1]];Pe(r,e,i,n),o.push(r)}return o}function Le(t,e,i,r){const n=Math.pow(2,r.z)*ye,a=[r.x*ye,r.y*ye],o=[];for(const i of t){const t=[];for(const r of i){const i=[r.x+a[0],r.y+a[1]];xe(e,i),t.push(i)}o.push(t)}if(e[2]-e[0]<=n/2){(s=e)[0]=s[1]=1/0,s[2]=s[3]=-1/0;for(const t of o)for(const r of t)Pe(r,e,i,n)}var s;return o}class De{constructor(t,e){this.type=mt,this.geojson=t,this.geometries=e}static parse(t,e){if(2!==t.length)return e.error(`'within' expression requires exactly one argument, but found ${t.length-1} instead.`);if(ae(t[1])){const e=t[1];if("FeatureCollection"===e.type)for(let t=0;t<e.features.length;++t){const i=e.features[t].geometry.type;if("Polygon"===i||"MultiPolygon"===i)return new De(e,e.features[t].geometry)}else if("Feature"===e.type){const t=e.geometry.type;if("Polygon"===t||"MultiPolygon"===t)return new De(e,e.geometry)}else if("Polygon"===e.type||"MultiPolygon"===e.type)return new De(e,e)}return e.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(null!=t.geometry()&&null!=t.canonicalID()){if("Point"===t.geometryType())return function(t,e){const i=[1/0,1/0,-1/0,-1/0],r=[1/0,1/0,-1/0,-1/0],n=t.canonicalID();if("Polygon"===e.type){const a=Me(e.coordinates,r,n),o=ze(t.geometry(),i,r,n);if(!ve(i,r))return!1;for(const t of o)if(!Ee(t,a))return!1}if("MultiPolygon"===e.type){const a=ke(e.coordinates,r,n),o=ze(t.geometry(),i,r,n);if(!ve(i,r))return!1;for(const t of o)if(!Te(t,a))return!1}return!0}(t,this.geometries);if("LineString"===t.geometryType())return function(t,e){const i=[1/0,1/0,-1/0,-1/0],r=[1/0,1/0,-1/0,-1/0],n=t.canonicalID();if("Polygon"===e.type){const a=Me(e.coordinates,r,n),o=Le(t.geometry(),i,r,n);if(!ve(i,r))return!1;for(const t of o)if(!Ie(t,a))return!1}if("MultiPolygon"===e.type){const a=ke(e.coordinates,r,n),o=Le(t.geometry(),i,r,n);if(!ve(i,r))return!1;for(const t of o)if(!Ae(t,a))return!1}return!0}(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}class Re{constructor(t,e){this.type=e.type,this.name=t,this.boundExpression=e}static parse(t,e){if(2!==t.length||"string"!=typeof t[1])return e.error("'var' expression requires exactly one string literal argument.");const i=t[1];return e.scope.has(i)?new Re(i,e.scope.get(i)):e.error(`Unknown variable "${i}". Make sure "${i}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(t){return this.boundExpression.evaluate(t)}eachChild(){}outputDefined(){return!1}}class Be{constructor(t,e,i,r){this.name=t,this.type=e,this._evaluate=i,this.args=r}evaluate(t){return this._evaluate(t,this.args)}eachChild(t){this.args.forEach(t)}outputDefined(){return!1}static parse(t,e){const i=t[0],r=Be.definitions[i];if(!r)return e.error(`Unknown expression "${i}". If you wanted a literal array, use ["literal", [...]].`,0);const n=Array.isArray(r)?r[0]:r.type,a=Array.isArray(r)?[[r[1],r[2]]]:r.overloads,o=a.filter((([e])=>!Array.isArray(e)||e.length===t.length-1));let s=null;for(const[r,a]of o){s=new ge(e.registry,Fe,e.path,null,e.scope);const o=[];let l=!1;for(let e=1;e<t.length;e++){const i=t[e],n=Array.isArray(r)?r[e-1]:r.type,a=s.parse(i,1+o.length,n);if(!a){l=!0;break}o.push(a)}if(!l)if(Array.isArray(r)&&r.length!==o.length)s.error(`Expected ${r.length} arguments, but found ${o.length} instead.`);else{for(let t=0;t<o.length;t++){const e=Array.isArray(r)?r[t]:r.type,i=o[t];s.concat(t+1).checkSubtype(e,i.type)}if(0===s.errors.length)return new Be(i,n,a,o)}}if(1===o.length)e.errors.push(...s.errors);else{const i=(o.length?o:a).map((([t])=>{return e=t,Array.isArray(e)?`(${e.map(Tt).join(", ")})`:`(${Tt(e.type)}...)`;var e})).join(" | "),r=[];for(let i=1;i<t.length;i++){const n=e.parse(t[i],1+r.length);if(!n)return null;r.push(Tt(n.type))}e.error(`Expected arguments of type ${i}, but found (${r.join(", ")}) instead.`)}return null}static register(t,e){Be.definitions=e;for(const i in e)t[i]=Be}}function Fe(t){if(t instanceof Re)return Fe(t.boundExpression);if(t instanceof Be&&"error"===t.name)return!1;if(t instanceof _e)return!1;if(t instanceof De)return!1;const e=t instanceof de||t instanceof ue;let i=!0;return t.eachChild((t=>{i=e?i&&Fe(t):i&&t instanceof le})),!!i&&Oe(t)&&Ve(t,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function Oe(t){if(t instanceof Be){if("get"===t.name&&1===t.args.length)return!1;if("feature-state"===t.name)return!1;if("has"===t.name&&1===t.args.length)return!1;if("properties"===t.name||"geometry-type"===t.name||"id"===t.name)return!1;if(/^filter-/.test(t.name))return!1}if(t instanceof De)return!1;let e=!0;return t.eachChild((t=>{e&&!Oe(t)&&(e=!1)})),e}function Ue(t){if(t instanceof Be&&"feature-state"===t.name)return!1;let e=!0;return t.eachChild((t=>{e&&!Ue(t)&&(e=!1)})),e}function Ve(t,e){if(t instanceof Be&&e.indexOf(t.name)>=0)return!1;let i=!0;return t.eachChild((t=>{i&&!Ve(t,e)&&(i=!1)})),i}function Ne(t,e){const i=t.length-1;let r,n,a=0,o=i,s=0;for(;a<=o;)if(s=Math.floor((a+o)/2),r=t[s],n=t[s+1],r<=e){if(s===i||e<n)return s;a=s+1}else{if(!(r>e))throw new ce("Input is not a number.");o=s-1}return 0}class $e{constructor(t,e,i){this.type=t,this.input=e,this.labels=[],this.outputs=[];for(const[t,e]of i)this.labels.push(t),this.outputs.push(e)}static parse(t,e){if(t.length-1<4)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");const i=e.parse(t[1],1,pt);if(!i)return null;const r=[];let n=null;e.expectedType&&"value"!==e.expectedType.kind&&(n=e.expectedType);for(let i=1;i<t.length;i+=2){const a=1===i?-1/0:t[i],o=t[i+1],s=i,l=i+1;if("number"!=typeof a)return e.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',s);if(r.length&&r[r.length-1][0]>=a)return e.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',s);const c=e.parse(o,l,n);if(!c)return null;n=n||c.type,r.push([a,c])}return new $e(n,i,r)}evaluate(t){const e=this.labels,i=this.outputs;if(1===e.length)return i[0].evaluate(t);const r=this.input.evaluate(t);if(r<=e[0])return i[0].evaluate(t);const n=e.length;return r>=e[n-1]?i[n-1].evaluate(t):i[Ne(e,r)].evaluate(t)}eachChild(t){t(this.input);for(const e of this.outputs)t(e)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))}}function je(t,e,i){return t+i*(e-t)}function qe(t,e,i){return t.map(((t,r)=>je(t,e[r],i)))}const Ze={number:je,color:function(t,e,i,r="rgb"){switch(r){case"rgb":{const[r,n,a,o]=qe(t.rgb,e.rgb,i);return new Kt(r,n,a,o,!1)}case"hcl":{const[r,n,a,o]=t.hcl,[s,l,c,h]=e.hcl;let u,p;if(isNaN(r)||isNaN(s))isNaN(r)?isNaN(s)?u=NaN:(u=s,1!==a&&0!==a||(p=l)):(u=r,1!==c&&0!==c||(p=n));else{let t=s-r;s>r&&t>180?t-=360:s<r&&r-s>180&&(t+=360),u=r+i*t}const[d,m,f,g]=function([t,e,i,r]){return t=isNaN(t)?0:t*Bt,$t([i,Math.cos(t)*e,Math.sin(t)*e,r])}([u,null!=p?p:je(n,l,i),je(a,c,i),je(o,h,i)]);return new Kt(d,m,f,g,!1)}case"lab":{const[r,n,a,o]=$t(qe(t.lab,e.lab,i));return new Kt(r,n,a,o,!1)}}},array:qe,padding:function(t,e,i){return new te(qe(t.values,e.values,i))},variableAnchorOffsetCollection:function(t,e,i){const r=t.values,n=e.values;if(r.length!==n.length)throw new ce(`Cannot interpolate values of different length. from: ${t.toString()}, to: ${e.toString()}`);const a=[];for(let t=0;t<r.length;t+=2){if(r[t]!==n[t])throw new ce(`Cannot interpolate values containing mismatched anchors. from[${t}]: ${r[t]}, to[${t}]: ${n[t]}`);a.push(r[t]);const[e,o]=r[t+1],[s,l]=n[t+1];a.push([je(e,s,i),je(o,l,i)])}return new ie(a)}};class Ge{constructor(t,e,i,r,n){this.type=t,this.operator=e,this.interpolation=i,this.input=r,this.labels=[],this.outputs=[];for(const[t,e]of n)this.labels.push(t),this.outputs.push(e)}static interpolationFactor(t,e,i,r){let n=0;if("exponential"===t.name)n=He(e,t.base,i,r);else if("linear"===t.name)n=He(e,1,i,r);else if("cubic-bezier"===t.name){const a=t.controlPoints;n=new s(a[0],a[1],a[2],a[3]).solve(He(e,1,i,r))}return n}static parse(t,e){let[i,r,n,...a]=t;if(!Array.isArray(r)||0===r.length)return e.error("Expected an interpolation type expression.",1);if("linear"===r[0])r={name:"linear"};else if("exponential"===r[0]){const t=r[1];if("number"!=typeof t)return e.error("Exponential interpolation requires a numeric base.",1,1);r={name:"exponential",base:t}}else{if("cubic-bezier"!==r[0])return e.error(`Unknown interpolation type ${String(r[0])}`,1,0);{const t=r.slice(1);if(4!==t.length||t.some((t=>"number"!=typeof t||t<0||t>1)))return e.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);r={name:"cubic-bezier",controlPoints:t}}}if(t.length-1<4)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");if(n=e.parse(n,2,pt),!n)return null;const o=[];let s=null;"interpolate-hcl"===i||"interpolate-lab"===i?s=ft:e.expectedType&&"value"!==e.expectedType.kind&&(s=e.expectedType);for(let t=0;t<a.length;t+=2){const i=a[t],r=a[t+1],n=t+3,l=t+4;if("number"!=typeof i)return e.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',n);if(o.length&&o[o.length-1][0]>=i)return e.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',n);const c=e.parse(r,l,s);if(!c)return null;s=s||c.type,o.push([i,c])}return Mt(s,pt)||Mt(s,ft)||Mt(s,vt)||Mt(s,wt)||Mt(s,Et(pt))?new Ge(s,i,r,n,o):e.error(`Type ${Tt(s)} is not interpolatable.`)}evaluate(t){const e=this.labels,i=this.outputs;if(1===e.length)return i[0].evaluate(t);const r=this.input.evaluate(t);if(r<=e[0])return i[0].evaluate(t);const n=e.length;if(r>=e[n-1])return i[n-1].evaluate(t);const a=Ne(e,r),o=Ge.interpolationFactor(this.interpolation,r,e[a],e[a+1]),s=i[a].evaluate(t),l=i[a+1].evaluate(t);switch(this.operator){case"interpolate":return Ze[this.type.kind](s,l,o);case"interpolate-hcl":return Ze.color(s,l,o,"hcl");case"interpolate-lab":return Ze.color(s,l,o,"lab")}}eachChild(t){t(this.input);for(const e of this.outputs)t(e)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))}}function He(t,e,i,r){const n=r-i,a=t-i;return 0===n?0:1===e?a/n:(Math.pow(e,a)-1)/(Math.pow(e,n)-1)}class Xe{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expectected at least one argument.");let i=null;const r=e.expectedType;r&&"value"!==r.kind&&(i=r);const n=[];for(const r of t.slice(1)){const t=e.parse(r,1+n.length,i,void 0,{typeAnnotation:"omit"});if(!t)return null;i=i||t.type,n.push(t)}if(!i)throw new Error("No output type");const a=r&&n.some((t=>Ct(r,t.type)));return new Xe(a?_t:i,n)}evaluate(t){let e,i=null,r=0;for(const n of this.args)if(r++,i=n.evaluate(t),i&&i instanceof re&&!i.available&&(e||(e=i.name),i=null,r===this.args.length&&(i=e)),null!==i)break;return i}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}}class We{constructor(t,e){this.type=e.type,this.bindings=[].concat(t),this.result=e}evaluate(t){return this.result.evaluate(t)}eachChild(t){for(const e of this.bindings)t(e[1]);t(this.result)}static parse(t,e){if(t.length<4)return e.error(`Expected at least 3 arguments, but found ${t.length-1} instead.`);const i=[];for(let r=1;r<t.length-1;r+=2){const n=t[r];if("string"!=typeof n)return e.error(`Expected string, but found ${typeof n} instead.`,r);if(/[^a-zA-Z0-9_]/.test(n))return e.error("Variable names must contain only alphanumeric characters or '_'.",r);const a=e.parse(t[r+1],r+1);if(!a)return null;i.push([n,a])}const r=e.parse(t[t.length-1],t.length-1,e.expectedType,i);return r?new We(i,r):null}outputDefined(){return this.result.outputDefined()}}class Ke{constructor(t,e,i){this.type=t,this.index=e,this.input=i}static parse(t,e){if(3!==t.length)return e.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const i=e.parse(t[1],1,pt),r=e.parse(t[2],2,Et(e.expectedType||_t));return i&&r?new Ke(r.type.itemType,i,r):null}evaluate(t){const e=this.index.evaluate(t),i=this.input.evaluate(t);if(e<0)throw new ce(`Array index out of bounds: ${e} < 0.`);if(e>=i.length)throw new ce(`Array index out of bounds: ${e} > ${i.length-1}.`);if(e!==Math.floor(e))throw new ce(`Array index must be an integer, but found ${e} instead.`);return i[e]}eachChild(t){t(this.index),t(this.input)}outputDefined(){return!1}}class Ye{constructor(t,e){this.type=mt,this.needle=t,this.haystack=e}static parse(t,e){if(3!==t.length)return e.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const i=e.parse(t[1],1,_t),r=e.parse(t[2],2,_t);return i&&r?It(i.type,[mt,dt,pt,ut,_t])?new Ye(i,r):e.error(`Expected first argument to be of type boolean, string, number or null, but found ${Tt(i.type)} instead`):null}evaluate(t){const e=this.needle.evaluate(t),i=this.haystack.evaluate(t);if(!i)return!1;if(!At(e,["boolean","string","number","null"]))throw new ce(`Expected first argument to be of type boolean, string, number or null, but found ${Tt(oe(e))} instead.`);if(!At(i,["string","array"]))throw new ce(`Expected second argument to be of type array or string, but found ${Tt(oe(i))} instead.`);return i.indexOf(e)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}}class Je{constructor(t,e,i){this.type=pt,this.needle=t,this.haystack=e,this.fromIndex=i}static parse(t,e){if(t.length<=2||t.length>=5)return e.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const i=e.parse(t[1],1,_t),r=e.parse(t[2],2,_t);if(!i||!r)return null;if(!It(i.type,[mt,dt,pt,ut,_t]))return e.error(`Expected first argument to be of type boolean, string, number or null, but found ${Tt(i.type)} instead`);if(4===t.length){const n=e.parse(t[3],3,pt);return n?new Je(i,r,n):null}return new Je(i,r)}evaluate(t){const e=this.needle.evaluate(t),i=this.haystack.evaluate(t);if(!At(e,["boolean","string","number","null"]))throw new ce(`Expected first argument to be of type boolean, string, number or null, but found ${Tt(oe(e))} instead.`);if(!At(i,["string","array"]))throw new ce(`Expected second argument to be of type array or string, but found ${Tt(oe(i))} instead.`);if(this.fromIndex){const r=this.fromIndex.evaluate(t);return i.indexOf(e,r)}return i.indexOf(e)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}}class Qe{constructor(t,e,i,r,n,a){this.inputType=t,this.type=e,this.input=i,this.cases=r,this.outputs=n,this.otherwise=a}static parse(t,e){if(t.length<5)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if(t.length%2!=1)return e.error("Expected an even number of arguments.");let i,r;e.expectedType&&"value"!==e.expectedType.kind&&(r=e.expectedType);const n={},a=[];for(let o=2;o<t.length-1;o+=2){let s=t[o];const l=t[o+1];Array.isArray(s)||(s=[s]);const c=e.concat(o);if(0===s.length)return c.error("Expected at least one branch label.");for(const t of s){if("number"!=typeof t&&"string"!=typeof t)return c.error("Branch labels must be numbers or strings.");if("number"==typeof t&&Math.abs(t)>Number.MAX_SAFE_INTEGER)return c.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if("number"==typeof t&&Math.floor(t)!==t)return c.error("Numeric branch labels must be integer values.");if(i){if(c.checkSubtype(i,oe(t)))return null}else i=oe(t);if(void 0!==n[String(t)])return c.error("Branch labels must be unique.");n[String(t)]=a.length}const h=e.parse(l,o,r);if(!h)return null;r=r||h.type,a.push(h)}const o=e.parse(t[1],1,_t);if(!o)return null;const s=e.parse(t[t.length-1],t.length-1,r);return s?"value"!==o.type.kind&&e.concat(1).checkSubtype(i,o.type)?null:new Qe(i,r,o,n,a,s):null}evaluate(t){const e=this.input.evaluate(t);return(oe(e)===this.inputType&&this.outputs[this.cases[e]]||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()}}class ti{constructor(t,e,i){this.type=t,this.branches=e,this.otherwise=i}static parse(t,e){if(t.length<4)return e.error(`Expected at least 3 arguments, but found only ${t.length-1}.`);if(t.length%2!=0)return e.error("Expected an odd number of arguments.");let i;e.expectedType&&"value"!==e.expectedType.kind&&(i=e.expectedType);const r=[];for(let n=1;n<t.length-1;n+=2){const a=e.parse(t[n],n,mt);if(!a)return null;const o=e.parse(t[n+1],n+1,i);if(!o)return null;r.push([a,o]),i=i||o.type}const n=e.parse(t[t.length-1],t.length-1,i);if(!n)return null;if(!i)throw new Error("Can't infer output type");return new ti(i,r,n)}evaluate(t){for(const[e,i]of this.branches)if(e.evaluate(t))return i.evaluate(t);return this.otherwise.evaluate(t)}eachChild(t){for(const[e,i]of this.branches)t(e),t(i);t(this.otherwise)}outputDefined(){return this.branches.every((([t,e])=>e.outputDefined()))&&this.otherwise.outputDefined()}}class ei{constructor(t,e,i,r){this.type=t,this.input=e,this.beginIndex=i,this.endIndex=r}static parse(t,e){if(t.length<=2||t.length>=5)return e.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const i=e.parse(t[1],1,_t),r=e.parse(t[2],2,pt);if(!i||!r)return null;if(!It(i.type,[Et(_t),dt,_t]))return e.error(`Expected first argument to be of type array or string, but found ${Tt(i.type)} instead`);if(4===t.length){const n=e.parse(t[3],3,pt);return n?new ei(i.type,i,r,n):null}return new ei(i.type,i,r)}evaluate(t){const e=this.input.evaluate(t),i=this.beginIndex.evaluate(t);if(!At(e,["string","array"]))throw new ce(`Expected first argument to be of type array or string, but found ${Tt(oe(e))} instead.`);if(this.endIndex){const r=this.endIndex.evaluate(t);return e.slice(i,r)}return e.slice(i)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}}function ii(t,e){return"=="===t||"!="===t?"boolean"===e.kind||"string"===e.kind||"number"===e.kind||"null"===e.kind||"value"===e.kind:"string"===e.kind||"number"===e.kind||"value"===e.kind}function ri(t,e,i,r){return 0===r.compare(e,i)}function ni(t,e,i){const r="=="!==t&&"!="!==t;return class n{constructor(t,e,i){this.type=mt,this.lhs=t,this.rhs=e,this.collator=i,this.hasUntypedArgument="value"===t.type.kind||"value"===e.type.kind}static parse(t,e){if(3!==t.length&&4!==t.length)return e.error("Expected two or three arguments.");const i=t[0];let a=e.parse(t[1],1,_t);if(!a)return null;if(!ii(i,a.type))return e.concat(1).error(`"${i}" comparisons are not supported for type '${Tt(a.type)}'.`);let o=e.parse(t[2],2,_t);if(!o)return null;if(!ii(i,o.type))return e.concat(2).error(`"${i}" comparisons are not supported for type '${Tt(o.type)}'.`);if(a.type.kind!==o.type.kind&&"value"!==a.type.kind&&"value"!==o.type.kind)return e.error(`Cannot compare types '${Tt(a.type)}' and '${Tt(o.type)}'.`);r&&("value"===a.type.kind&&"value"!==o.type.kind?a=new ue(o.type,[a]):"value"!==a.type.kind&&"value"===o.type.kind&&(o=new ue(a.type,[o])));let s=null;if(4===t.length){if("string"!==a.type.kind&&"string"!==o.type.kind&&"value"!==a.type.kind&&"value"!==o.type.kind)return e.error("Cannot use collator to compare non-string types.");if(s=e.parse(t[3],3,yt),!s)return null}return new n(a,o,s)}evaluate(n){const a=this.lhs.evaluate(n),o=this.rhs.evaluate(n);if(r&&this.hasUntypedArgument){const e=oe(a),i=oe(o);if(e.kind!==i.kind||"string"!==e.kind&&"number"!==e.kind)throw new ce(`Expected arguments for "${t}" to be (string, string) or (number, number), but found (${e.kind}, ${i.kind}) instead.`)}if(this.collator&&!r&&this.hasUntypedArgument){const t=oe(a),i=oe(o);if("string"!==t.kind||"string"!==i.kind)return e(n,a,o)}return this.collator?i(n,a,o,this.collator.evaluate(n)):e(n,a,o)}eachChild(t){t(this.lhs),t(this.rhs),this.collator&&t(this.collator)}outputDefined(){return!0}}}const ai=ni("==",(function(t,e,i){return e===i}),ri),oi=ni("!=",(function(t,e,i){return e!==i}),(function(t,e,i,r){return!ri(0,e,i,r)})),si=ni("<",(function(t,e,i){return e<i}),(function(t,e,i,r){return r.compare(e,i)<0})),li=ni(">",(function(t,e,i){return e>i}),(function(t,e,i,r){return r.compare(e,i)>0})),ci=ni("<=",(function(t,e,i){return e<=i}),(function(t,e,i,r){return r.compare(e,i)<=0})),hi=ni(">=",(function(t,e,i){return e>=i}),(function(t,e,i,r){return r.compare(e,i)>=0}));class ui{constructor(t,e,i,r,n){this.type=dt,this.number=t,this.locale=e,this.currency=i,this.minFractionDigits=r,this.maxFractionDigits=n}static parse(t,e){if(3!==t.length)return e.error("Expected two arguments.");const i=e.parse(t[1],1,pt);if(!i)return null;const r=t[2];if("object"!=typeof r||Array.isArray(r))return e.error("NumberFormat options argument must be an object.");let n=null;if(r.locale&&(n=e.parse(r.locale,1,dt),!n))return null;let a=null;if(r.currency&&(a=e.parse(r.currency,1,dt),!a))return null;let o=null;if(r["min-fraction-digits"]&&(o=e.parse(r["min-fraction-digits"],1,pt),!o))return null;let s=null;return r["max-fraction-digits"]&&(s=e.parse(r["max-fraction-digits"],1,pt),!s)?null:new ui(i,n,a,o,s)}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}}class pi{constructor(t){this.type=xt,this.sections=t}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");const i=t[1];if(!Array.isArray(i)&&"object"==typeof i)return e.error("First argument must be an image or text section.");const r=[];let n=!1;for(let i=1;i<=t.length-1;++i){const a=t[i];if(n&&"object"==typeof a&&!Array.isArray(a)){n=!1;let t=null;if(a["font-scale"]&&(t=e.parse(a["font-scale"],1,pt),!t))return null;let i=null;if(a["text-font"]&&(i=e.parse(a["text-font"],1,Et(dt)),!i))return null;let o=null;if(a["text-color"]&&(o=e.parse(a["text-color"],1,ft),!o))return null;const s=r[r.length-1];s.scale=t,s.font=i,s.textColor=o}else{const a=e.parse(t[i],1,_t);if(!a)return null;const o=a.type.kind;if("string"!==o&&"value"!==o&&"null"!==o&&"resolvedImage"!==o)return e.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");n=!0,r.push({content:a,scale:null,font:null,textColor:null})}}return new pi(r)}evaluate(t){return new Qt(this.sections.map((e=>{const i=e.content.evaluate(t);return oe(i)===bt?new Jt("",i,null,null,null):new Jt(se(i),null,e.scale?e.scale.evaluate(t):null,e.font?e.font.evaluate(t).join(","):null,e.textColor?e.textColor.evaluate(t):null)})))}eachChild(t){for(const e of this.sections)t(e.content),e.scale&&t(e.scale),e.font&&t(e.font),e.textColor&&t(e.textColor)}outputDefined(){return!1}}class di{constructor(t){this.type=bt,this.input=t}static parse(t,e){if(2!==t.length)return e.error("Expected two arguments.");const i=e.parse(t[1],1,dt);return i?new di(i):e.error("No image name provided.")}evaluate(t){const e=this.input.evaluate(t),i=re.fromString(e);return i&&t.availableImages&&(i.available=t.availableImages.indexOf(e)>-1),i}eachChild(t){t(this.input)}outputDefined(){return!1}}class mi{constructor(t){this.type=pt,this.input=t}static parse(t,e){if(2!==t.length)return e.error(`Expected 1 argument, but found ${t.length-1} instead.`);const i=e.parse(t[1],1);return i?"array"!==i.type.kind&&"string"!==i.type.kind&&"value"!==i.type.kind?e.error(`Expected argument of type string or array, but found ${Tt(i.type)} instead.`):new mi(i):null}evaluate(t){const e=this.input.evaluate(t);if("string"==typeof e)return e.length;if(Array.isArray(e))return e.length;throw new ce(`Expected value to be of type string or array, but found ${Tt(oe(e))} instead.`)}eachChild(t){t(this.input)}outputDefined(){return!1}}const fi={"==":ai,"!=":oi,">":li,"<":si,">=":hi,"<=":ci,array:ue,at:Ke,boolean:ue,case:ti,coalesce:Xe,collator:_e,format:pi,image:di,in:Ye,"index-of":Je,interpolate:Ge,"interpolate-hcl":Ge,"interpolate-lab":Ge,length:mi,let:We,literal:le,match:Qe,number:ue,"number-format":ui,object:ue,slice:ei,step:$e,string:ue,"to-boolean":de,"to-color":de,"to-number":de,"to-string":de,var:Re,within:De};function gi(t,[e,i,r,n]){e=e.evaluate(t),i=i.evaluate(t),r=r.evaluate(t);const a=n?n.evaluate(t):1,o=ne(e,i,r,a);if(o)throw new ce(o);return new Kt(e/255,i/255,r/255,a,!1)}function _i(t,e){return t in e}function yi(t,e){const i=e[t];return void 0===i?null:i}function xi(t){return{type:t}}function vi(t){return{result:"success",value:t}}function bi(t){return{result:"error",value:t}}function wi(t){return"data-driven"===t["property-type"]||"cross-faded-data-driven"===t["property-type"]}function Ei(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}function Ti(t){return!!t.expression&&t.expression.interpolated}function Si(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":null===t?"null":typeof t}function Ci(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}function Ii(t){return t}function Ai(t,e){const i="color"===e.type,r=t.stops&&"object"==typeof t.stops[0][0],n=r||!(r||void 0!==t.property),a=t.type||(Ti(e)?"exponential":"interval");if(i||"padding"===e.type){const r=i?Kt.parse:te.parse;(t=lt({},t)).stops&&(t.stops=t.stops.map((t=>[t[0],r(t[1])]))),t.default=r(t.default?t.default:e.default)}if(t.colorSpace&&"rgb"!==(o=t.colorSpace)&&"hcl"!==o&&"lab"!==o)throw new Error(`Unknown color space: "${t.colorSpace}"`);var o;let s,l,c;if("exponential"===a)s=zi;else if("interval"===a)s=Pi;else if("categorical"===a){s=ki,l=Object.create(null);for(const e of t.stops)l[e[0]]=e[1];c=typeof t.stops[0][0]}else{if("identity"!==a)throw new Error(`Unknown function type "${a}"`);s=Li}if(r){const i={},r=[];for(let e=0;e<t.stops.length;e++){const n=t.stops[e],a=n[0].zoom;void 0===i[a]&&(i[a]={zoom:a,type:t.type,property:t.property,default:t.default,stops:[]},r.push(a)),i[a].stops.push([n[0].value,n[1]])}const n=[];for(const t of r)n.push([i[t].zoom,Ai(i[t],e)]);const a={name:"linear"};return{kind:"composite",interpolationType:a,interpolationFactor:Ge.interpolationFactor.bind(void 0,a),zoomStops:n.map((t=>t[0])),evaluate:({zoom:i},r)=>zi({stops:n,base:t.base},e,i).evaluate(i,r)}}if(n){const i="exponential"===a?{name:"exponential",base:void 0!==t.base?t.base:1}:null;return{kind:"camera",interpolationType:i,interpolationFactor:Ge.interpolationFactor.bind(void 0,i),zoomStops:t.stops.map((t=>t[0])),evaluate:({zoom:i})=>s(t,e,i,l,c)}}return{kind:"source",evaluate(i,r){const n=r&&r.properties?r.properties[t.property]:void 0;return void 0===n?Mi(t.default,e.default):s(t,e,n,l,c)}}}function Mi(t,e,i){return void 0!==t?t:void 0!==e?e:void 0!==i?i:void 0}function ki(t,e,i,r,n){return Mi(typeof i===n?r[i]:void 0,t.default,e.default)}function Pi(t,e,i){if("number"!==Si(i))return Mi(t.default,e.default);const r=t.stops.length;if(1===r)return t.stops[0][1];if(i<=t.stops[0][0])return t.stops[0][1];if(i>=t.stops[r-1][0])return t.stops[r-1][1];const n=Ne(t.stops.map((t=>t[0])),i);return t.stops[n][1]}function zi(t,e,i){const r=void 0!==t.base?t.base:1;if("number"!==Si(i))return Mi(t.default,e.default);const n=t.stops.length;if(1===n)return t.stops[0][1];if(i<=t.stops[0][0])return t.stops[0][1];if(i>=t.stops[n-1][0])return t.stops[n-1][1];const a=Ne(t.stops.map((t=>t[0])),i),o=function(t,e,i,r){const n=r-i,a=t-i;return 0===n?0:1===e?a/n:(Math.pow(e,a)-1)/(Math.pow(e,n)-1)}(i,r,t.stops[a][0],t.stops[a+1][0]),s=t.stops[a][1],l=t.stops[a+1][1],c=Ze[e.type]||Ii;return"function"==typeof s.evaluate?{evaluate(...e){const i=s.evaluate.apply(void 0,e),r=l.evaluate.apply(void 0,e);if(void 0!==i&&void 0!==r)return c(i,r,o,t.colorSpace)}}:c(s,l,o,t.colorSpace)}function Li(t,e,i){switch(e.type){case"color":i=Kt.parse(i);break;case"formatted":i=Qt.fromString(i.toString());break;case"resolvedImage":i=re.fromString(i.toString());break;case"padding":i=te.parse(i);break;default:Si(i)===e.type||"enum"===e.type&&e.values[i]||(i=void 0)}return Mi(i,t.default,e.default)}Be.register(fi,{error:[{kind:"error"},[dt],(t,[e])=>{throw new ce(e.evaluate(t))}],typeof:[dt,[_t],(t,[e])=>Tt(oe(e.evaluate(t)))],"to-rgba":[Et(pt,4),[ft],(t,[e])=>{const[i,r,n,a]=e.evaluate(t).rgb;return[255*i,255*r,255*n,a]}],rgb:[ft,[pt,pt,pt],gi],rgba:[ft,[pt,pt,pt,pt],gi],has:{type:mt,overloads:[[[dt],(t,[e])=>_i(e.evaluate(t),t.properties())],[[dt,gt],(t,[e,i])=>_i(e.evaluate(t),i.evaluate(t))]]},get:{type:_t,overloads:[[[dt],(t,[e])=>yi(e.evaluate(t),t.properties())],[[dt,gt],(t,[e,i])=>yi(e.evaluate(t),i.evaluate(t))]]},"feature-state":[_t,[dt],(t,[e])=>yi(e.evaluate(t),t.featureState||{})],properties:[gt,[],t=>t.properties()],"geometry-type":[dt,[],t=>t.geometryType()],id:[_t,[],t=>t.id()],zoom:[pt,[],t=>t.globals.zoom],"heatmap-density":[pt,[],t=>t.globals.heatmapDensity||0],"line-progress":[pt,[],t=>t.globals.lineProgress||0],accumulated:[_t,[],t=>void 0===t.globals.accumulated?null:t.globals.accumulated],"+":[pt,xi(pt),(t,e)=>{let i=0;for(const r of e)i+=r.evaluate(t);return i}],"*":[pt,xi(pt),(t,e)=>{let i=1;for(const r of e)i*=r.evaluate(t);return i}],"-":{type:pt,overloads:[[[pt,pt],(t,[e,i])=>e.evaluate(t)-i.evaluate(t)],[[pt],(t,[e])=>-e.evaluate(t)]]},"/":[pt,[pt,pt],(t,[e,i])=>e.evaluate(t)/i.evaluate(t)],"%":[pt,[pt,pt],(t,[e,i])=>e.evaluate(t)%i.evaluate(t)],ln2:[pt,[],()=>Math.LN2],pi:[pt,[],()=>Math.PI],e:[pt,[],()=>Math.E],"^":[pt,[pt,pt],(t,[e,i])=>Math.pow(e.evaluate(t),i.evaluate(t))],sqrt:[pt,[pt],(t,[e])=>Math.sqrt(e.evaluate(t))],log10:[pt,[pt],(t,[e])=>Math.log(e.evaluate(t))/Math.LN10],ln:[pt,[pt],(t,[e])=>Math.log(e.evaluate(t))],log2:[pt,[pt],(t,[e])=>Math.log(e.evaluate(t))/Math.LN2],sin:[pt,[pt],(t,[e])=>Math.sin(e.evaluate(t))],cos:[pt,[pt],(t,[e])=>Math.cos(e.evaluate(t))],tan:[pt,[pt],(t,[e])=>Math.tan(e.evaluate(t))],asin:[pt,[pt],(t,[e])=>Math.asin(e.evaluate(t))],acos:[pt,[pt],(t,[e])=>Math.acos(e.evaluate(t))],atan:[pt,[pt],(t,[e])=>Math.atan(e.evaluate(t))],min:[pt,xi(pt),(t,e)=>Math.min(...e.map((e=>e.evaluate(t))))],max:[pt,xi(pt),(t,e)=>Math.max(...e.map((e=>e.evaluate(t))))],abs:[pt,[pt],(t,[e])=>Math.abs(e.evaluate(t))],round:[pt,[pt],(t,[e])=>{const i=e.evaluate(t);return i<0?-Math.round(-i):Math.round(i)}],floor:[pt,[pt],(t,[e])=>Math.floor(e.evaluate(t))],ceil:[pt,[pt],(t,[e])=>Math.ceil(e.evaluate(t))],"filter-==":[mt,[dt,_t],(t,[e,i])=>t.properties()[e.value]===i.value],"filter-id-==":[mt,[_t],(t,[e])=>t.id()===e.value],"filter-type-==":[mt,[dt],(t,[e])=>t.geometryType()===e.value],"filter-<":[mt,[dt,_t],(t,[e,i])=>{const r=t.properties()[e.value],n=i.value;return typeof r==typeof n&&r<n}],"filter-id-<":[mt,[_t],(t,[e])=>{const i=t.id(),r=e.value;return typeof i==typeof r&&i<r}],"filter->":[mt,[dt,_t],(t,[e,i])=>{const r=t.properties()[e.value],n=i.value;return typeof r==typeof n&&r>n}],"filter-id->":[mt,[_t],(t,[e])=>{const i=t.id(),r=e.value;return typeof i==typeof r&&i>r}],"filter-<=":[mt,[dt,_t],(t,[e,i])=>{const r=t.properties()[e.value],n=i.value;return typeof r==typeof n&&r<=n}],"filter-id-<=":[mt,[_t],(t,[e])=>{const i=t.id(),r=e.value;return typeof i==typeof r&&i<=r}],"filter->=":[mt,[dt,_t],(t,[e,i])=>{const r=t.properties()[e.value],n=i.value;return typeof r==typeof n&&r>=n}],"filter-id->=":[mt,[_t],(t,[e])=>{const i=t.id(),r=e.value;return typeof i==typeof r&&i>=r}],"filter-has":[mt,[_t],(t,[e])=>e.value in t.properties()],"filter-has-id":[mt,[],t=>null!==t.id()&&void 0!==t.id()],"filter-type-in":[mt,[Et(dt)],(t,[e])=>e.value.indexOf(t.geometryType())>=0],"filter-id-in":[mt,[Et(_t)],(t,[e])=>e.value.indexOf(t.id())>=0],"filter-in-small":[mt,[dt,Et(_t)],(t,[e,i])=>i.value.indexOf(t.properties()[e.value])>=0],"filter-in-large":[mt,[dt,Et(_t)],(t,[e,i])=>function(t,e,i,r){for(;i<=r;){const n=i+r>>1;if(e[n]===t)return!0;e[n]>t?r=n-1:i=n+1}return!1}(t.properties()[e.value],i.value,0,i.value.length-1)],all:{type:mt,overloads:[[[mt,mt],(t,[e,i])=>e.evaluate(t)&&i.evaluate(t)],[xi(mt),(t,e)=>{for(const i of e)if(!i.evaluate(t))return!1;return!0}]]},any:{type:mt,overloads:[[[mt,mt],(t,[e,i])=>e.evaluate(t)||i.evaluate(t)],[xi(mt),(t,e)=>{for(const i of e)if(i.evaluate(t))return!0;return!1}]]},"!":[mt,[mt],(t,[e])=>!e.evaluate(t)],"is-supported-script":[mt,[dt],(t,[e])=>{const i=t.globals&&t.globals.isSupportedScript;return!i||i(e.evaluate(t))}],upcase:[dt,[dt],(t,[e])=>e.evaluate(t).toUpperCase()],downcase:[dt,[dt],(t,[e])=>e.evaluate(t).toLowerCase()],concat:[dt,xi(_t),(t,e)=>e.map((e=>se(e.evaluate(t)))).join("")],"resolved-locale":[dt,[yt],(t,[e])=>e.evaluate(t).resolvedLocale()]});class Di{constructor(t,e){var i;this.expression=t,this._warningHistory={},this._evaluator=new fe,this._defaultValue=e?"color"===(i=e).type&&Ci(i.default)?new Kt(0,0,0,0):"color"===i.type?Kt.parse(i.default)||null:"padding"===i.type?te.parse(i.default)||null:"variableAnchorOffsetCollection"===i.type?ie.parse(i.default)||null:void 0===i.default?null:i.default:null,this._enumValues=e&&"enum"===e.type?e.values:null}evaluateWithoutErrorHandling(t,e,i,r,n,a){return this._evaluator.globals=t,this._evaluator.feature=e,this._evaluator.featureState=i,this._evaluator.canonical=r,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=a,this.expression.evaluate(this._evaluator)}evaluate(t,e,i,r,n,a){this._evaluator.globals=t,this._evaluator.feature=e||null,this._evaluator.featureState=i||null,this._evaluator.canonical=r,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=a||null;try{const t=this.expression.evaluate(this._evaluator);if(null==t||"number"==typeof t&&t!=t)return this._defaultValue;if(this._enumValues&&!(t in this._enumValues))throw new ce(`Expected value to be one of ${Object.keys(this._enumValues).map((t=>JSON.stringify(t))).join(", ")}, but found ${JSON.stringify(t)} instead.`);return t}catch(t){return this._warningHistory[t.message]||(this._warningHistory[t.message]=!0,"undefined"!=typeof console&&console.warn(t.message)),this._defaultValue}}}function Ri(t){return Array.isArray(t)&&t.length>0&&"string"==typeof t[0]&&t[0]in fi}function Bi(t,e){const i=new ge(fi,Fe,[],e?function(t){const e={color:ft,string:dt,number:pt,enum:dt,boolean:mt,formatted:xt,padding:vt,resolvedImage:bt,variableAnchorOffsetCollection:wt};return"array"===t.type?Et(e[t.value]||_t,t.length):e[t.type]}(e):void 0),r=i.parse(t,void 0,void 0,void 0,e&&"string"===e.type?{typeAnnotation:"coerce"}:void 0);return r?vi(new Di(r,e)):bi(i.errors)}class Fi{constructor(t,e){this.kind=t,this._styleExpression=e,this.isStateDependent="constant"!==t&&!Ue(e.expression)}evaluateWithoutErrorHandling(t,e,i,r,n,a){return this._styleExpression.evaluateWithoutErrorHandling(t,e,i,r,n,a)}evaluate(t,e,i,r,n,a){return this._styleExpression.evaluate(t,e,i,r,n,a)}}class Oi{constructor(t,e,i,r){this.kind=t,this.zoomStops=i,this._styleExpression=e,this.isStateDependent="camera"!==t&&!Ue(e.expression),this.interpolationType=r}evaluateWithoutErrorHandling(t,e,i,r,n,a){return this._styleExpression.evaluateWithoutErrorHandling(t,e,i,r,n,a)}evaluate(t,e,i,r,n,a){return this._styleExpression.evaluate(t,e,i,r,n,a)}interpolationFactor(t,e,i){return this.interpolationType?Ge.interpolationFactor(this.interpolationType,t,e,i):0}}function Ui(t,e){const i=Bi(t,e);if("error"===i.result)return i;const r=i.value.expression,n=Oe(r);if(!n&&!wi(e))return bi([new ct("","data expressions not supported")]);const a=Ve(r,["zoom"]);if(!a&&!Ei(e))return bi([new ct("","zoom expressions not supported")]);const o=Ni(r);return o||a?o instanceof ct?bi([o]):o instanceof Ge&&!Ti(e)?bi([new ct("",'"interpolate" expressions cannot be used with this property')]):vi(o?new Oi(n?"camera":"composite",i.value,o.labels,o instanceof Ge?o.interpolation:void 0):new Fi(n?"constant":"source",i.value)):bi([new ct("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Vi{constructor(t,e){this._parameters=t,this._specification=e,lt(this,Ai(this._parameters,this._specification))}static deserialize(t){return new Vi(t._parameters,t._specification)}static serialize(t){return{_parameters:t._parameters,_specification:t._specification}}}function Ni(t){let e=null;if(t instanceof We)e=Ni(t.result);else if(t instanceof Xe){for(const i of t.args)if(e=Ni(i),e)break}else(t instanceof $e||t instanceof Ge)&&t.input instanceof Be&&"zoom"===t.input.name&&(e=t);return e instanceof ct||t.eachChild((t=>{const i=Ni(t);i instanceof ct?e=i:!e&&i?e=new ct("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&i&&e!==i&&(e=new ct("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))})),e}function $i(t){if(!0===t||!1===t)return!0;if(!Array.isArray(t)||0===t.length)return!1;switch(t[0]){case"has":return t.length>=2&&"$id"!==t[1]&&"$type"!==t[1];case"in":return t.length>=3&&("string"!=typeof t[1]||Array.isArray(t[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==t.length||Array.isArray(t[1])||Array.isArray(t[2]);case"any":case"all":for(const e of t.slice(1))if(!$i(e)&&"boolean"!=typeof e)return!1;return!0;default:return!0}}const ji={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function qi(t){if(null==t)return{filter:()=>!0,needGeometry:!1};$i(t)||(t=Hi(t));const e=Bi(t,ji);if("error"===e.result)throw new Error(e.value.map((t=>`${t.key}: ${t.message}`)).join(", "));return{filter:(t,i,r)=>e.value.evaluate(t,i,{},r),needGeometry:Gi(t)}}function Zi(t,e){return t<e?-1:t>e?1:0}function Gi(t){if(!Array.isArray(t))return!1;if("within"===t[0])return!0;for(let e=1;e<t.length;e++)if(Gi(t[e]))return!0;return!1}function Hi(t){if(!t)return!0;const e=t[0];return t.length<=1?"any"!==e:"=="===e?Xi(t[1],t[2],"=="):"!="===e?Yi(Xi(t[1],t[2],"==")):"<"===e||">"===e||"<="===e||">="===e?Xi(t[1],t[2],e):"any"===e?(i=t.slice(1),["any"].concat(i.map(Hi))):"all"===e?["all"].concat(t.slice(1).map(Hi)):"none"===e?["all"].concat(t.slice(1).map(Hi).map(Yi)):"in"===e?Wi(t[1],t.slice(2)):"!in"===e?Yi(Wi(t[1],t.slice(2))):"has"===e?Ki(t[1]):"!has"===e?Yi(Ki(t[1])):"within"!==e||t;var i}function Xi(t,e,i){switch(t){case"$type":return[`filter-type-${i}`,e];case"$id":return[`filter-id-${i}`,e];default:return[`filter-${i}`,t,e]}}function Wi(t,e){if(0===e.length)return!1;switch(t){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some((t=>typeof t!=typeof e[0]))?["filter-in-large",t,["literal",e.sort(Zi)]]:["filter-in-small",t,["literal",e]]}}function Ki(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function Yi(t){return["!",t]}function Ji(t){const e=typeof t;if("number"===e||"boolean"===e||"string"===e||null==t)return JSON.stringify(t);if(Array.isArray(t)){let e="[";for(const i of t)e+=`${Ji(i)},`;return`${e}]`}const i=Object.keys(t).sort();let r="{";for(let e=0;e<i.length;e++)r+=`${JSON.stringify(i[e])}:${Ji(t[i[e]])},`;return`${r}}`}function Qi(t){let e="";for(const i of K)e+=`/${Ji(t[i])}`;return e}function tr(t){const e=t.value;return e?[new st(t.key,e,"constants have been deprecated as of v8")]:[]}function er(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}function ir(t){if(Array.isArray(t))return t.map(ir);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){const e={};for(const i in t)e[i]=ir(t[i]);return e}return er(t)}function rr(t){const e=t.key,i=t.value,r=t.valueSpec||{},n=t.objectElementValidators||{},a=t.style,o=t.styleSpec,s=t.validateSpec;let l=[];const c=Si(i);if("object"!==c)return[new st(e,i,`object expected, ${c} found`)];for(const t in i){const c=t.split(".")[0],h=r[c]||r["*"];let u;if(n[c])u=n[c];else if(r[c])u=s;else if(n["*"])u=n["*"];else{if(!r["*"]){l.push(new st(e,i[t],`unknown property "${t}"`));continue}u=s}l=l.concat(u({key:(e?`${e}.`:e)+t,value:i[t],valueSpec:h,style:a,styleSpec:o,object:i,objectKey:t,validateSpec:s},i))}for(const t in r)n[t]||r[t].required&&void 0===r[t].default&&void 0===i[t]&&l.push(new st(e,i,`missing required property "${t}"`));return l}function nr(t){const e=t.value,i=t.valueSpec,r=t.style,n=t.styleSpec,a=t.key,o=t.arrayElementValidator||t.validateSpec;if("array"!==Si(e))return[new st(a,e,`array expected, ${Si(e)} found`)];if(i.length&&e.length!==i.length)return[new st(a,e,`array length ${i.length} expected, length ${e.length} found`)];if(i["min-length"]&&e.length<i["min-length"])return[new st(a,e,`array length at least ${i["min-length"]} expected, length ${e.length} found`)];let s={type:i.value,values:i.values};n.$version<7&&(s.function=i.function),"object"===Si(i.value)&&(s=i.value);let l=[];for(let i=0;i<e.length;i++)l=l.concat(o({array:e,arrayIndex:i,value:e[i],valueSpec:s,validateSpec:t.validateSpec,style:r,styleSpec:n,key:`${a}[${i}]`}));return l}function ar(t){const e=t.key,i=t.value,r=t.valueSpec;let n=Si(i);return"number"===n&&i!=i&&(n="NaN"),"number"!==n?[new st(e,i,`number expected, ${n} found`)]:"minimum"in r&&i<r.minimum?[new st(e,i,`${i} is less than the minimum value ${r.minimum}`)]:"maximum"in r&&i>r.maximum?[new st(e,i,`${i} is greater than the maximum value ${r.maximum}`)]:[]}function or(t){const e=t.valueSpec,i=er(t.value.type);let r,n,a,o={};const s="categorical"!==i&&void 0===t.value.property,l=!s,c="array"===Si(t.value.stops)&&"array"===Si(t.value.stops[0])&&"object"===Si(t.value.stops[0][0]),h=rr({key:t.key,value:t.value,valueSpec:t.styleSpec.function,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{stops:function(t){if("identity"===i)return[new st(t.key,t.value,'identity function may not have a "stops" property')];let e=[];const r=t.value;return e=e.concat(nr({key:t.key,value:r,valueSpec:t.valueSpec,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,arrayElementValidator:u})),"array"===Si(r)&&0===r.length&&e.push(new st(t.key,r,"array must have at least one stop")),e},default:function(t){return t.validateSpec({key:t.key,value:t.value,valueSpec:e,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec})}}});return"identity"===i&&s&&h.push(new st(t.key,t.value,'missing required property "property"')),"identity"===i||t.value.stops||h.push(new st(t.key,t.value,'missing required property "stops"')),"exponential"===i&&t.valueSpec.expression&&!Ti(t.valueSpec)&&h.push(new st(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(l&&!wi(t.valueSpec)?h.push(new st(t.key,t.value,"property functions not supported")):s&&!Ei(t.valueSpec)&&h.push(new st(t.key,t.value,"zoom functions not supported"))),"categorical"!==i&&!c||void 0!==t.value.property||h.push(new st(t.key,t.value,'"property" property is required')),h;function u(t){let i=[];const r=t.value,s=t.key;if("array"!==Si(r))return[new st(s,r,`array expected, ${Si(r)} found`)];if(2!==r.length)return[new st(s,r,`array length 2 expected, length ${r.length} found`)];if(c){if("object"!==Si(r[0]))return[new st(s,r,`object expected, ${Si(r[0])} found`)];if(void 0===r[0].zoom)return[new st(s,r,"object stop key must have zoom")];if(void 0===r[0].value)return[new st(s,r,"object stop key must have value")];if(a&&a>er(r[0].zoom))return[new st(s,r[0].zoom,"stop zoom values must appear in ascending order")];er(r[0].zoom)!==a&&(a=er(r[0].zoom),n=void 0,o={}),i=i.concat(rr({key:`${s}[0]`,value:r[0],valueSpec:{zoom:{}},validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{zoom:ar,value:p}}))}else i=i.concat(p({key:`${s}[0]`,value:r[0],valueSpec:{},validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec},r));return Ri(ir(r[1]))?i.concat([new st(`${s}[1]`,r[1],"expressions are not allowed in function stops.")]):i.concat(t.validateSpec({key:`${s}[1]`,value:r[1],valueSpec:e,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec}))}function p(t,a){const s=Si(t.value),l=er(t.value),c=null!==t.value?t.value:a;if(r){if(s!==r)return[new st(t.key,c,`${s} stop domain type must match previous stop domain type ${r}`)]}else r=s;if("number"!==s&&"string"!==s&&"boolean"!==s)return[new st(t.key,c,"stop domain value must be a number, string, or boolean")];if("number"!==s&&"categorical"!==i){let r=`number expected, ${s} found`;return wi(e)&&void 0===i&&(r+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new st(t.key,c,r)]}return"categorical"!==i||"number"!==s||isFinite(l)&&Math.floor(l)===l?"categorical"!==i&&"number"===s&&void 0!==n&&l<n?[new st(t.key,c,"stop domain values must appear in ascending order")]:(n=l,"categorical"===i&&l in o?[new st(t.key,c,"stop domain values must be unique")]:(o[l]=!0,[])):[new st(t.key,c,`integer expected, found ${l}`)]}}function sr(t){const e=("property"===t.expressionContext?Ui:Bi)(ir(t.value),t.valueSpec);if("error"===e.result)return e.value.map((e=>new st(`${t.key}${e.key}`,t.value,e.message)));const i=e.value.expression||e.value._styleExpression.expression;if("property"===t.expressionContext&&"text-font"===t.propertyKey&&!i.outputDefined())return[new st(t.key,t.value,`Invalid data expression for "${t.propertyKey}". Output values must be contained as literals within the expression.`)];if("property"===t.expressionContext&&"layout"===t.propertyType&&!Ue(i))return[new st(t.key,t.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===t.expressionContext&&!Ue(i))return[new st(t.key,t.value,'"feature-state" data expressions are not supported with filters.')];if(t.expressionContext&&0===t.expressionContext.indexOf("cluster")){if(!Ve(i,["zoom","feature-state"]))return[new st(t.key,t.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===t.expressionContext&&!Oe(i))return[new st(t.key,t.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function lr(t){const e=t.key,i=t.value,r=t.valueSpec,n=[];return Array.isArray(r.values)?-1===r.values.indexOf(er(i))&&n.push(new st(e,i,`expected one of [${r.values.join(", ")}], ${JSON.stringify(i)} found`)):-1===Object.keys(r.values).indexOf(er(i))&&n.push(new st(e,i,`expected one of [${Object.keys(r.values).join(", ")}], ${JSON.stringify(i)} found`)),n}function cr(t){return $i(ir(t.value))?sr(lt({},t,{expressionContext:"filter",valueSpec:{value:"boolean"}})):hr(t)}function hr(t){const e=t.value,i=t.key;if("array"!==Si(e))return[new st(i,e,`array expected, ${Si(e)} found`)];const r=t.styleSpec;let n,a=[];if(e.length<1)return[new st(i,e,"filter array must have at least 1 element")];switch(a=a.concat(lr({key:`${i}[0]`,value:e[0],valueSpec:r.filter_operator,style:t.style,styleSpec:t.styleSpec})),er(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&"$type"===er(e[1])&&a.push(new st(i,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":3!==e.length&&a.push(new st(i,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(n=Si(e[1]),"string"!==n&&a.push(new st(`${i}[1]`,e[1],`string expected, ${n} found`)));for(let o=2;o<e.length;o++)n=Si(e[o]),"$type"===er(e[1])?a=a.concat(lr({key:`${i}[${o}]`,value:e[o],valueSpec:r.geometry_type,style:t.style,styleSpec:t.styleSpec})):"string"!==n&&"number"!==n&&"boolean"!==n&&a.push(new st(`${i}[${o}]`,e[o],`string, number, or boolean expected, ${n} found`));break;case"any":case"all":case"none":for(let r=1;r<e.length;r++)a=a.concat(hr({key:`${i}[${r}]`,value:e[r],style:t.style,styleSpec:t.styleSpec}));break;case"has":case"!has":n=Si(e[1]),2!==e.length?a.push(new st(i,e,`filter array for "${e[0]}" operator must have 2 elements`)):"string"!==n&&a.push(new st(`${i}[1]`,e[1],`string expected, ${n} found`));break;case"within":n=Si(e[1]),2!==e.length?a.push(new st(i,e,`filter array for "${e[0]}" operator must have 2 elements`)):"object"!==n&&a.push(new st(`${i}[1]`,e[1],`object expected, ${n} found`))}return a}function ur(t,e){const i=t.key,r=t.validateSpec,n=t.style,a=t.styleSpec,o=t.value,s=t.objectKey,l=a[`${e}_${t.layerType}`];if(!l)return[];const c=s.match(/^(.*)-transition$/);if("paint"===e&&c&&l[c[1]]&&l[c[1]].transition)return r({key:i,value:o,valueSpec:a.transition,style:n,styleSpec:a});const h=t.valueSpec||l[s];if(!h)return[new st(i,o,`unknown property "${s}"`)];let u;if("string"===Si(o)&&wi(h)&&!h.tokens&&(u=/^{([^}]+)}$/.exec(o)))return[new st(i,o,`"${s}" does not support interpolation syntax\nUse an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(u[1])} }\`.`)];const p=[];return"symbol"===t.layerType&&("text-field"===s&&n&&!n.glyphs&&p.push(new st(i,o,'use of "text-field" requires a style "glyphs" property')),"text-font"===s&&Ci(ir(o))&&"identity"===er(o.type)&&p.push(new st(i,o,'"text-font" does not support identity functions'))),p.concat(r({key:t.key,value:o,valueSpec:h,style:n,styleSpec:a,expressionContext:"property",propertyType:e,propertyKey:s}))}function pr(t){return ur(t,"paint")}function dr(t){return ur(t,"layout")}function mr(t){let e=[];const i=t.value,r=t.key,n=t.style,a=t.styleSpec;i.type||i.ref||e.push(new st(r,i,'either "type" or "ref" is required'));let o=er(i.type);const s=er(i.ref);if(i.id){const a=er(i.id);for(let o=0;o<t.arrayIndex;o++){const t=n.layers[o];er(t.id)===a&&e.push(new st(r,i.id,`duplicate layer id "${i.id}", previously used at line ${t.id.__line__}`))}}if("ref"in i){let t;["type","source","source-layer","filter","layout"].forEach((t=>{t in i&&e.push(new st(r,i[t],`"${t}" is prohibited for ref layers`))})),n.layers.forEach((e=>{er(e.id)===s&&(t=e)})),t?t.ref?e.push(new st(r,i.ref,"ref cannot reference another ref layer")):o=er(t.type):e.push(new st(r,i.ref,`ref layer "${s}" not found`))}else if("background"!==o)if(i.source){const t=n.sources&&n.sources[i.source],a=t&&er(t.type);t?"vector"===a&&"raster"===o?e.push(new st(r,i.source,`layer "${i.id}" requires a raster source`)):"raster-dem"!==a&&"hillshade"===o?e.push(new st(r,i.source,`layer "${i.id}" requires a raster-dem source`)):"raster"===a&&"raster"!==o?e.push(new st(r,i.source,`layer "${i.id}" requires a vector source`)):"vector"!==a||i["source-layer"]?"raster-dem"===a&&"hillshade"!==o?e.push(new st(r,i.source,"raster-dem source can only be used with layer type 'hillshade'.")):"line"!==o||!i.paint||!i.paint["line-gradient"]||"geojson"===a&&t.lineMetrics||e.push(new st(r,i,`layer "${i.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):e.push(new st(r,i,`layer "${i.id}" must specify a "source-layer"`)):e.push(new st(r,i.source,`source "${i.source}" not found`))}else e.push(new st(r,i,'missing required property "source"'));return e=e.concat(rr({key:r,value:i,valueSpec:a.layer,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*":()=>[],type:()=>t.validateSpec({key:`${r}.type`,value:i.type,valueSpec:a.layer.type,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,object:i,objectKey:"type"}),filter:cr,layout:t=>rr({layer:i,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*":t=>dr(lt({layerType:o},t))}}),paint:t=>rr({layer:i,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*":t=>pr(lt({layerType:o},t))}})}})),e}function fr(t){const e=t.value,i=t.key,r=Si(e);return"string"!==r?[new st(i,e,`string expected, ${r} found`)]:[]}const gr={promoteId:function({key:t,value:e}){if("string"===Si(e))return fr({key:t,value:e});{const i=[];for(const r in e)i.push(...fr({key:`${t}.${r}`,value:e[r]}));return i}}};function _r(t){const e=t.value,i=t.key,r=t.styleSpec,n=t.style,a=t.validateSpec;if(!e.type)return[new st(i,e,'"type" is required')];const o=er(e.type);let s;switch(o){case"vector":case"raster":return s=rr({key:i,value:e,valueSpec:r[`source_${o.replace("-","_")}`],style:t.style,styleSpec:r,objectElementValidators:gr,validateSpec:a}),s;case"raster-dem":return s=function(t){var e;const i=null!==(e=t.sourceName)&&void 0!==e?e:"",r=t.value,n=t.styleSpec,a=n.source_raster_dem,o=t.style;let s=[];const l=Si(r);if(void 0===r)return s;if("object"!==l)return s.push(new st("source_raster_dem",r,`object expected, ${l} found`)),s;const c="custom"===er(r.encoding),h=["redFactor","greenFactor","blueFactor","baseShift"],u=t.value.encoding?`"${t.value.encoding}"`:"Default";for(const e in r)!c&&h.includes(e)?s.push(new st(e,r[e],`In "${i}": "${e}" is only valid when "encoding" is set to "custom". ${u} encoding found`)):a[e]?s=s.concat(t.validateSpec({key:e,value:r[e],valueSpec:a[e],validateSpec:t.validateSpec,style:o,styleSpec:n})):s.push(new st(e,r[e],`unknown property "${e}"`));return s}({sourceName:i,value:e,style:t.style,styleSpec:r,validateSpec:a}),s;case"geojson":if(s=rr({key:i,value:e,valueSpec:r.source_geojson,style:n,styleSpec:r,validateSpec:a,objectElementValidators:gr}),e.cluster)for(const t in e.clusterProperties){const[r,n]=e.clusterProperties[t],o="string"==typeof r?[r,["accumulated"],["get",t]]:r;s.push(...sr({key:`${i}.${t}.map`,value:n,validateSpec:a,expressionContext:"cluster-map"})),s.push(...sr({key:`${i}.${t}.reduce`,value:o,validateSpec:a,expressionContext:"cluster-reduce"}))}return s;case"video":return rr({key:i,value:e,valueSpec:r.source_video,style:n,validateSpec:a,styleSpec:r});case"image":return rr({key:i,value:e,valueSpec:r.source_image,style:n,validateSpec:a,styleSpec:r});case"canvas":return[new st(i,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return lr({key:`${i}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:n,validateSpec:a,styleSpec:r})}}function yr(t){const e=t.value,i=t.styleSpec,r=i.light,n=t.style;let a=[];const o=Si(e);if(void 0===e)return a;if("object"!==o)return a=a.concat([new st("light",e,`object expected, ${o} found`)]),a;for(const o in e){const s=o.match(/^(.*)-transition$/);a=a.concat(s&&r[s[1]]&&r[s[1]].transition?t.validateSpec({key:o,value:e[o],valueSpec:i.transition,validateSpec:t.validateSpec,style:n,styleSpec:i}):r[o]?t.validateSpec({key:o,value:e[o],valueSpec:r[o],validateSpec:t.validateSpec,style:n,styleSpec:i}):[new st(o,e[o],`unknown property "${o}"`)])}return a}function xr(t){const e=t.value,i=t.styleSpec,r=i.terrain,n=t.style;let a=[];const o=Si(e);if(void 0===e)return a;if("object"!==o)return a=a.concat([new st("terrain",e,`object expected, ${o} found`)]),a;for(const o in e)a=a.concat(r[o]?t.validateSpec({key:o,value:e[o],valueSpec:r[o],validateSpec:t.validateSpec,style:n,styleSpec:i}):[new st(o,e[o],`unknown property "${o}"`)]);return a}function vr(t){let e=[];const i=t.value,r=t.key;if(Array.isArray(i)){const n=[],a=[];for(const o in i)i[o].id&&n.includes(i[o].id)&&e.push(new st(r,i,`all the sprites' ids must be unique, but ${i[o].id} is duplicated`)),n.push(i[o].id),i[o].url&&a.includes(i[o].url)&&e.push(new st(r,i,`all the sprites' URLs must be unique, but ${i[o].url} is duplicated`)),a.push(i[o].url),e=e.concat(rr({key:`${r}[${o}]`,value:i[o],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:t.validateSpec}));return e}return fr({key:r,value:i})}const br={"*":()=>[],array:nr,boolean:function(t){const e=t.value,i=t.key,r=Si(e);return"boolean"!==r?[new st(i,e,`boolean expected, ${r} found`)]:[]},number:ar,color:function(t){const e=t.key,i=t.value,r=Si(i);return"string"!==r?[new st(e,i,`color expected, ${r} found`)]:Kt.parse(String(i))?[]:[new st(e,i,`color expected, "${i}" found`)]},constants:tr,enum:lr,filter:cr,function:or,layer:mr,object:rr,source:_r,light:yr,terrain:xr,string:fr,formatted:function(t){return 0===fr(t).length?[]:sr(t)},resolvedImage:function(t){return 0===fr(t).length?[]:sr(t)},padding:function(t){const e=t.key,i=t.value;if("array"===Si(i)){if(i.length<1||i.length>4)return[new st(e,i,`padding requires 1 to 4 values; ${i.length} values found`)];const r={type:"number"};let n=[];for(let a=0;a<i.length;a++)n=n.concat(t.validateSpec({key:`${e}[${a}]`,value:i[a],validateSpec:t.validateSpec,valueSpec:r}));return n}return ar({key:e,value:i,valueSpec:{}})},variableAnchorOffsetCollection:function(t){const e=t.key,i=t.value,r=Si(i),n=t.styleSpec;if("array"!==r||i.length<1||i.length%2!=0)return[new st(e,i,"variableAnchorOffsetCollection requires a non-empty array of even length")];let a=[];for(let r=0;r<i.length;r+=2)a=a.concat(lr({key:`${e}[${r}]`,value:i[r],valueSpec:n.layout_symbol["text-anchor"]})),a=a.concat(nr({key:`${e}[${r+1}]`,value:i[r+1],valueSpec:{length:2,value:"number"},validateSpec:t.validateSpec,style:t.style,styleSpec:n}));return a},sprite:vr};function wr(t){const e=t.value,i=t.valueSpec,r=t.styleSpec;return t.validateSpec=wr,i.expression&&Ci(er(e))?or(t):i.expression&&Ri(ir(e))?sr(t):i.type&&br[i.type]?br[i.type](t):rr(lt({},t,{valueSpec:i.type?r[i.type]:i}))}function Er(t){const e=t.value,i=t.key,r=fr(t);return r.length||(-1===e.indexOf("{fontstack}")&&r.push(new st(i,e,'"glyphs" url must include a "{fontstack}" token')),-1===e.indexOf("{range}")&&r.push(new st(i,e,'"glyphs" url must include a "{range}" token'))),r}function Tr(t,e=W){let i=[];return i=i.concat(wr({key:"",value:t,valueSpec:e.$root,styleSpec:e,style:t,validateSpec:wr,objectElementValidators:{glyphs:Er,"*":()=>[]}})),t.constants&&(i=i.concat(tr({key:"constants",value:t.constants,style:t,styleSpec:e,validateSpec:wr}))),Cr(i)}function Sr(t){return function(e){return t({...e,validateSpec:wr})}}function Cr(t){return[].concat(t).sort(((t,e)=>t.line-e.line))}function Ir(t){return function(...e){return Cr(t.apply(this,e))}}Tr.source=Ir(Sr(_r)),Tr.sprite=Ir(Sr(vr)),Tr.glyphs=Ir(Sr(Er)),Tr.light=Ir(Sr(yr)),Tr.terrain=Ir(Sr(xr)),Tr.layer=Ir(Sr(mr)),Tr.filter=Ir(Sr(cr)),Tr.paintProperty=Ir(Sr(pr)),Tr.layoutProperty=Ir(Sr(dr));const Ar=Tr,Mr=Ar.light,kr=Ar.paintProperty,Pr=Ar.layoutProperty;function zr(t,e){let i=!1;if(e&&e.length)for(const r of e)t.fire(new H(new Error(r.message))),i=!0;return i}class Lr{constructor(t,e,i){const r=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;const n=new Int32Array(this.arrayBuffer);t=n[0],this.d=(e=n[1])+2*(i=n[2]);for(let t=0;t<this.d*this.d;t++){const e=n[3+t],i=n[3+t+1];r.push(e===i?null:n.subarray(e,i))}const a=n[3+r.length+1];this.keys=n.subarray(n[3+r.length],a),this.bboxes=n.subarray(a),this.insert=this._insertReadonly}else{this.d=e+2*i;for(let t=0;t<this.d*this.d;t++)r.push([]);this.keys=[],this.bboxes=[]}this.n=e,this.extent=t,this.padding=i,this.scale=e/t,this.uid=0;const n=i/e*t;this.min=-n,this.max=t+n}insert(t,e,i,r,n){this._forEachCell(e,i,r,n,this._insertCell,this.uid++,void 0,void 0),this.keys.push(t),this.bboxes.push(e),this.bboxes.push(i),this.bboxes.push(r),this.bboxes.push(n)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(t,e,i,r,n,a){this.cells[n].push(a)}query(t,e,i,r,n){const a=this.min,o=this.max;if(t<=a&&e<=a&&o<=i&&o<=r&&!n)return Array.prototype.slice.call(this.keys);{const a=[];return this._forEachCell(t,e,i,r,this._queryCell,a,{},n),a}}_queryCell(t,e,i,r,n,a,o,s){const l=this.cells[n];if(null!==l){const n=this.keys,c=this.bboxes;for(let h=0;h<l.length;h++){const u=l[h];if(void 0===o[u]){const l=4*u;(s?s(c[l+0],c[l+1],c[l+2],c[l+3]):t<=c[l+2]&&e<=c[l+3]&&i>=c[l+0]&&r>=c[l+1])?(o[u]=!0,a.push(n[u])):o[u]=!1}}}}_forEachCell(t,e,i,r,n,a,o,s){const l=this._convertToCellCoord(t),c=this._convertToCellCoord(e),h=this._convertToCellCoord(i),u=this._convertToCellCoord(r);for(let p=l;p<=h;p++)for(let l=c;l<=u;l++){const c=this.d*l+p;if((!s||s(this._convertFromCellCoord(p),this._convertFromCellCoord(l),this._convertFromCellCoord(p+1),this._convertFromCellCoord(l+1)))&&n.call(this,t,e,i,r,c,a,o,s))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;const t=this.cells,e=3+this.cells.length+1+1;let i=0;for(let t=0;t<this.cells.length;t++)i+=this.cells[t].length;const r=new Int32Array(e+i+this.keys.length+this.bboxes.length);r[0]=this.extent,r[1]=this.n,r[2]=this.padding;let n=e;for(let e=0;e<t.length;e++){const i=t[e];r[3+e]=n,r.set(i,n),n+=i.length}return r[3+t.length]=n,r.set(this.keys,n),n+=this.keys.length,r[3+t.length+1]=n,r.set(this.bboxes,n),n+=this.bboxes.length,r.buffer}static serialize(t,e){const i=t.toArrayBuffer();return e&&e.push(i),{buffer:i}}static deserialize(t){return new Lr(t.buffer)}}const Dr={};function Rr(t,e,i={}){if(Dr[t])throw new Error(`${t} is already registered.`);Object.defineProperty(e,"_classRegistryKey",{value:t,writeable:!1}),Dr[t]={klass:e,omit:i.omit||[],shallow:i.shallow||[]}}Rr("Object",Object),Rr("TransferableGridIndex",Lr),Rr("Color",Kt),Rr("Error",Error),Rr("AJAXError",F),Rr("ResolvedImage",re),Rr("StylePropertyFunction",Vi),Rr("StyleExpression",Di,{omit:["_evaluator"]}),Rr("ZoomDependentExpression",Oi),Rr("ZoomConstantExpression",Fi),Rr("CompoundExpression",Be,{omit:["_evaluate"]});for(const t in fi)fi[t]._classRegistryKey||Rr(`Expression_${t}`,fi[t]);function Br(t){return t&&"undefined"!=typeof ArrayBuffer&&(t instanceof ArrayBuffer||t.constructor&&"ArrayBuffer"===t.constructor.name)}function Fr(t,e){if(null==t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp||t instanceof Blob)return t;if(Br(t))return e&&e.push(t),t;if(A(t))return e&&e.push(t),t;if(ArrayBuffer.isView(t)){const i=t;return e&&e.push(i.buffer),i}if(t instanceof ImageData)return e&&e.push(t.data.buffer),t;if(Array.isArray(t)){const i=[];for(const r of t)i.push(Fr(r,e));return i}if("object"==typeof t){const i=t.constructor,r=i._classRegistryKey;if(!r)throw new Error("can't serialize object of unregistered class");if(!Dr[r])throw new Error(`${r} is not registered.`);const n=i.serialize?i.serialize(t,e):{};if(i.serialize){if(e&&n===e[e.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(const i in t){if(!t.hasOwnProperty(i))continue;if(Dr[r].omit.indexOf(i)>=0)continue;const a=t[i];n[i]=Dr[r].shallow.indexOf(i)>=0?a:Fr(a,e)}t instanceof Error&&(n.message=t.message)}if(n.$name)throw new Error("$name property is reserved for worker serialization logic.");return"Object"!==r&&(n.$name=r),n}throw new Error("can't serialize object of type "+typeof t)}function Or(t){if(null==t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp||t instanceof Blob||Br(t)||A(t)||ArrayBuffer.isView(t)||t instanceof ImageData)return t;if(Array.isArray(t))return t.map(Or);if("object"==typeof t){const e=t.$name||"Object";if(!Dr[e])throw new Error(`can't deserialize unregistered class ${e}`);const{klass:i}=Dr[e];if(!i)throw new Error(`can't deserialize unregistered class ${e}`);if(i.deserialize)return i.deserialize(t);const r=Object.create(i.prototype);for(const i of Object.keys(t)){if("$name"===i)continue;const n=t[i];r[i]=Dr[e].shallow.indexOf(i)>=0?n:Or(n)}return r}throw new Error("can't deserialize object of type "+typeof t)}class Ur{constructor(){this.first=!0}update(t,e){const i=Math.floor(t);return this.first?(this.first=!1,this.lastIntegerZoom=i,this.lastIntegerZoomTime=0,this.lastZoom=t,this.lastFloorZoom=i,!0):(this.lastFloorZoom>i?(this.lastIntegerZoom=i+1,this.lastIntegerZoomTime=e):this.lastFloorZoom<i&&(this.lastIntegerZoom=i,this.lastIntegerZoomTime=e),t!==this.lastZoom&&(this.lastZoom=t,this.lastFloorZoom=i,!0))}}const Vr={"Latin-1 Supplement":t=>t>=128&&t<=255,Arabic:t=>t>=1536&&t<=1791,"Arabic Supplement":t=>t>=1872&&t<=1919,"Arabic Extended-A":t=>t>=2208&&t<=2303,"Hangul Jamo":t=>t>=4352&&t<=4607,"Unified Canadian Aboriginal Syllabics":t=>t>=5120&&t<=5759,Khmer:t=>t>=6016&&t<=6143,"Unified Canadian Aboriginal Syllabics Extended":t=>t>=6320&&t<=6399,"General Punctuation":t=>t>=8192&&t<=8303,"Letterlike Symbols":t=>t>=8448&&t<=8527,"Number Forms":t=>t>=8528&&t<=8591,"Miscellaneous Technical":t=>t>=8960&&t<=9215,"Control Pictures":t=>t>=9216&&t<=9279,"Optical Character Recognition":t=>t>=9280&&t<=9311,"Enclosed Alphanumerics":t=>t>=9312&&t<=9471,"Geometric Shapes":t=>t>=9632&&t<=9727,"Miscellaneous Symbols":t=>t>=9728&&t<=9983,"Miscellaneous Symbols and Arrows":t=>t>=11008&&t<=11263,"CJK Radicals Supplement":t=>t>=11904&&t<=12031,"Kangxi Radicals":t=>t>=12032&&t<=12255,"Ideographic Description Characters":t=>t>=12272&&t<=12287,"CJK Symbols and Punctuation":t=>t>=12288&&t<=12351,Hiragana:t=>t>=12352&&t<=12447,Katakana:t=>t>=12448&&t<=12543,Bopomofo:t=>t>=12544&&t<=12591,"Hangul Compatibility Jamo":t=>t>=12592&&t<=12687,Kanbun:t=>t>=12688&&t<=12703,"Bopomofo Extended":t=>t>=12704&&t<=12735,"CJK Strokes":t=>t>=12736&&t<=12783,"Katakana Phonetic Extensions":t=>t>=12784&&t<=12799,"Enclosed CJK Letters and Months":t=>t>=12800&&t<=13055,"CJK Compatibility":t=>t>=13056&&t<=13311,"CJK Unified Ideographs Extension A":t=>t>=13312&&t<=19903,"Yijing Hexagram Symbols":t=>t>=19904&&t<=19967,"CJK Unified Ideographs":t=>t>=19968&&t<=40959,"Yi Syllables":t=>t>=40960&&t<=42127,"Yi Radicals":t=>t>=42128&&t<=42191,"Hangul Jamo Extended-A":t=>t>=43360&&t<=43391,"Hangul Syllables":t=>t>=44032&&t<=55215,"Hangul Jamo Extended-B":t=>t>=55216&&t<=55295,"Private Use Area":t=>t>=57344&&t<=63743,"CJK Compatibility Ideographs":t=>t>=63744&&t<=64255,"Arabic Presentation Forms-A":t=>t>=64336&&t<=65023,"Vertical Forms":t=>t>=65040&&t<=65055,"CJK Compatibility Forms":t=>t>=65072&&t<=65103,"Small Form Variants":t=>t>=65104&&t<=65135,"Arabic Presentation Forms-B":t=>t>=65136&&t<=65279,"Halfwidth and Fullwidth Forms":t=>t>=65280&&t<=65519};function Nr(t){for(const e of t)if(qr(e.charCodeAt(0)))return!0;return!1}function $r(t){for(const e of t)if(!jr(e.charCodeAt(0)))return!1;return!0}function jr(t){return!(Vr.Arabic(t)||Vr["Arabic Supplement"](t)||Vr["Arabic Extended-A"](t)||Vr["Arabic Presentation Forms-A"](t)||Vr["Arabic Presentation Forms-B"](t))}function qr(t){return!(746!==t&&747!==t&&(t<4352||!(Vr["Bopomofo Extended"](t)||Vr.Bopomofo(t)||Vr["CJK Compatibility Forms"](t)&&!(t>=65097&&t<=65103)||Vr["CJK Compatibility Ideographs"](t)||Vr["CJK Compatibility"](t)||Vr["CJK Radicals Supplement"](t)||Vr["CJK Strokes"](t)||!(!Vr["CJK Symbols and Punctuation"](t)||t>=12296&&t<=12305||t>=12308&&t<=12319||12336===t)||Vr["CJK Unified Ideographs Extension A"](t)||Vr["CJK Unified Ideographs"](t)||Vr["Enclosed CJK Letters and Months"](t)||Vr["Hangul Compatibility Jamo"](t)||Vr["Hangul Jamo Extended-A"](t)||Vr["Hangul Jamo Extended-B"](t)||Vr["Hangul Jamo"](t)||Vr["Hangul Syllables"](t)||Vr.Hiragana(t)||Vr["Ideographic Description Characters"](t)||Vr.Kanbun(t)||Vr["Kangxi Radicals"](t)||Vr["Katakana Phonetic Extensions"](t)||Vr.Katakana(t)&&12540!==t||!(!Vr["Halfwidth and Fullwidth Forms"](t)||65288===t||65289===t||65293===t||t>=65306&&t<=65310||65339===t||65341===t||65343===t||t>=65371&&t<=65503||65507===t||t>=65512&&t<=65519)||!(!Vr["Small Form Variants"](t)||t>=65112&&t<=65118||t>=65123&&t<=65126)||Vr["Unified Canadian Aboriginal Syllabics"](t)||Vr["Unified Canadian Aboriginal Syllabics Extended"](t)||Vr["Vertical Forms"](t)||Vr["Yijing Hexagram Symbols"](t)||Vr["Yi Syllables"](t)||Vr["Yi Radicals"](t))))}function Zr(t){return!(qr(t)||function(t){return!!(Vr["Latin-1 Supplement"](t)&&(167===t||169===t||174===t||177===t||188===t||189===t||190===t||215===t||247===t)||Vr["General Punctuation"](t)&&(8214===t||8224===t||8225===t||8240===t||8241===t||8251===t||8252===t||8258===t||8263===t||8264===t||8265===t||8273===t)||Vr["Letterlike Symbols"](t)||Vr["Number Forms"](t)||Vr["Miscellaneous Technical"](t)&&(t>=8960&&t<=8967||t>=8972&&t<=8991||t>=8996&&t<=9e3||9003===t||t>=9085&&t<=9114||t>=9150&&t<=9165||9167===t||t>=9169&&t<=9179||t>=9186&&t<=9215)||Vr["Control Pictures"](t)&&9251!==t||Vr["Optical Character Recognition"](t)||Vr["Enclosed Alphanumerics"](t)||Vr["Geometric Shapes"](t)||Vr["Miscellaneous Symbols"](t)&&!(t>=9754&&t<=9759)||Vr["Miscellaneous Symbols and Arrows"](t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||Vr["CJK Symbols and Punctuation"](t)||Vr.Katakana(t)||Vr["Private Use Area"](t)||Vr["CJK Compatibility Forms"](t)||Vr["Small Form Variants"](t)||Vr["Halfwidth and Fullwidth Forms"](t)||8734===t||8756===t||8757===t||t>=9984&&t<=10087||t>=10102&&t<=10131||65532===t||65533===t)}(t))}function Gr(t){return t>=1424&&t<=2303||Vr["Arabic Presentation Forms-A"](t)||Vr["Arabic Presentation Forms-B"](t)}function Hr(t,e){return!(!e&&Gr(t)||t>=2304&&t<=3583||t>=3840&&t<=4255||Vr.Khmer(t))}function Xr(t){for(const e of t)if(Gr(e.charCodeAt(0)))return!0;return!1}const Wr="deferred",Kr="loading",Yr="loaded";let Jr=null,Qr="unavailable",tn=null;const en=function(t){t&&"string"==typeof t&&t.indexOf("NetworkError")>-1&&(Qr="error"),Jr&&Jr(t)};function rn(){nn.fire(new G("pluginStateChange",{pluginStatus:Qr,pluginURL:tn}))}const nn=new X,an=function(){return Qr},on=function(){if(Qr!==Wr||!tn)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");Qr=Kr,rn(),tn&&$({url:tn},(t=>{t?en(t):(Qr=Yr,rn())}))},sn={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>Qr===Yr||null!=sn.applyArabicShaping,isLoading:()=>Qr===Kr,setState(t){if(!S())throw new Error("Cannot set the state of the rtl-text-plugin when not in the web-worker context");Qr=t.pluginStatus,tn=t.pluginURL},isParsed(){if(!S())throw new Error("rtl-text-plugin is only parsed on the worker-threads");return null!=sn.applyArabicShaping&&null!=sn.processBidirectionalText&&null!=sn.processStyledBidirectionalText},getPluginURL(){if(!S())throw new Error("rtl-text-plugin url can only be queried from the worker threads");return tn}};class ln{constructor(t,e){this.zoom=t,e?(this.now=e.now,this.fadeDuration=e.fadeDuration,this.zoomHistory=e.zoomHistory,this.transition=e.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Ur,this.transition={})}isSupportedScript(t){return function(t,e){for(const i of t)if(!Hr(i.charCodeAt(0),e))return!1;return!0}(t,sn.isLoaded())}crossFadingFactor(){return 0===this.fadeDuration?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const t=this.zoom,e=t-Math.floor(t),i=this.crossFadingFactor();return t>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:e+(1-e)*i}:{fromScale:.5,toScale:1,t:1-(1-i)*e}}}class cn{constructor(t,e){this.property=t,this.value=e,this.expression=function(t,e){if(Ci(t))return new Vi(t,e);if(Ri(t)){const i=Ui(t,e);if("error"===i.result)throw new Error(i.value.map((t=>`${t.key}: ${t.message}`)).join(", "));return i.value}{let i=t;return"color"===e.type&&"string"==typeof t?i=Kt.parse(t):"padding"!==e.type||"number"!=typeof t&&!Array.isArray(t)?"variableAnchorOffsetCollection"===e.type&&Array.isArray(t)&&(i=ie.parse(t)):i=te.parse(t),{kind:"constant",evaluate:()=>i}}}(void 0===e?t.specification.default:e,t.specification)}isDataDriven(){return"source"===this.expression.kind||"composite"===this.expression.kind}possiblyEvaluate(t,e,i){return this.property.possiblyEvaluate(this,t,e,i)}}class hn{constructor(t){this.property=t,this.value=new cn(t,void 0)}transitioned(t,e){return new pn(this.property,this.value,e,g({},t.transition,this.transition),t.now)}untransitioned(){return new pn(this.property,this.value,null,{},0)}}class un{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues)}getValue(t){return v(this._values[t].value.value)}setValue(t,e){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new hn(this._values[t].property)),this._values[t].value=new cn(this._values[t].property,null===e?void 0:v(e))}getTransition(t){return v(this._values[t].transition)}setTransition(t,e){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new hn(this._values[t].property)),this._values[t].transition=v(e)||void 0}serialize(){const t={};for(const e of Object.keys(this._values)){const i=this.getValue(e);void 0!==i&&(t[e]=i);const r=this.getTransition(e);void 0!==r&&(t[`${e}-transition`]=r)}return t}transitioned(t,e){const i=new dn(this._properties);for(const r of Object.keys(this._values))i._values[r]=this._values[r].transitioned(t,e._values[r]);return i}untransitioned(){const t=new dn(this._properties);for(const e of Object.keys(this._values))t._values[e]=this._values[e].untransitioned();return t}}class pn{constructor(t,e,i,r,n){this.property=t,this.value=e,this.begin=n+r.delay||0,this.end=this.begin+r.duration||0,t.specification.transition&&(r.delay||r.duration)&&(this.prior=i)}possiblyEvaluate(t,e,i){const r=t.now||0,n=this.value.possiblyEvaluate(t,e,i),a=this.prior;if(a){if(r>this.end)return this.prior=null,n;if(this.value.isDataDriven())return this.prior=null,n;if(r<this.begin)return a.possiblyEvaluate(t,e,i);{const o=(r-this.begin)/(this.end-this.begin);return this.property.interpolate(a.possiblyEvaluate(t,e,i),n,function(t){if(t<=0)return 0;if(t>=1)return 1;const e=t*t,i=e*t;return 4*(t<.5?i:3*(t-e)+i-.75)}(o))}}return n}}class dn{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)}possiblyEvaluate(t,e,i){const r=new gn(this._properties);for(const n of Object.keys(this._values))r._values[n]=this._values[n].possiblyEvaluate(t,e,i);return r}hasTransition(){for(const t of Object.keys(this._values))if(this._values[t].prior)return!0;return!1}}class mn{constructor(t){this._properties=t,this._values=Object.create(t.defaultPropertyValues)}hasValue(t){return void 0!==this._values[t].value}getValue(t){return v(this._values[t].value)}setValue(t,e){this._values[t]=new cn(this._values[t].property,null===e?void 0:v(e))}serialize(){const t={};for(const e of Object.keys(this._values)){const i=this.getValue(e);void 0!==i&&(t[e]=i)}return t}possiblyEvaluate(t,e,i){const r=new gn(this._properties);for(const n of Object.keys(this._values))r._values[n]=this._values[n].possiblyEvaluate(t,e,i);return r}}class fn{constructor(t,e,i){this.property=t,this.value=e,this.parameters=i}isConstant(){return"constant"===this.value.kind}constantOr(t){return"constant"===this.value.kind?this.value.value:t}evaluate(t,e,i,r){return this.property.evaluate(this.value,this.parameters,t,e,i,r)}}class gn{constructor(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues)}get(t){return this._values[t]}}class _n{constructor(t){this.specification=t}possiblyEvaluate(t,e){if(t.isDataDriven())throw new Error("Value should not be data driven");return t.expression.evaluate(e)}interpolate(t,e,i){const r=Ze[this.specification.type];return r?r(t,e,i):t}}class yn{constructor(t,e){this.specification=t,this.overrides=e}possiblyEvaluate(t,e,i,r){return new fn(this,"constant"===t.expression.kind||"camera"===t.expression.kind?{kind:"constant",value:t.expression.evaluate(e,null,{},i,r)}:t.expression,e)}interpolate(t,e,i){if("constant"!==t.value.kind||"constant"!==e.value.kind)return t;if(void 0===t.value.value||void 0===e.value.value)return new fn(this,{kind:"constant",value:void 0},t.parameters);const r=Ze[this.specification.type];if(r){const n=r(t.value.value,e.value.value,i);return new fn(this,{kind:"constant",value:n},t.parameters)}return t}evaluate(t,e,i,r,n,a){return"constant"===t.kind?t.value:t.evaluate(e,i,r,n,a)}}class xn extends yn{possiblyEvaluate(t,e,i,r){if(void 0===t.value)return new fn(this,{kind:"constant",value:void 0},e);if("constant"===t.expression.kind){const n=t.expression.evaluate(e,null,{},i,r),a="resolvedImage"===t.property.specification.type&&"string"!=typeof n?n.name:n,o=this._calculate(a,a,a,e);return new fn(this,{kind:"constant",value:o},e)}if("camera"===t.expression.kind){const i=this._calculate(t.expression.evaluate({zoom:e.zoom-1}),t.expression.evaluate({zoom:e.zoom}),t.expression.evaluate({zoom:e.zoom+1}),e);return new fn(this,{kind:"constant",value:i},e)}return new fn(this,t.expression,e)}evaluate(t,e,i,r,n,a){if("source"===t.kind){const o=t.evaluate(e,i,r,n,a);return this._calculate(o,o,o,e)}return"composite"===t.kind?this._calculate(t.evaluate({zoom:Math.floor(e.zoom)-1},i,r),t.evaluate({zoom:Math.floor(e.zoom)},i,r),t.evaluate({zoom:Math.floor(e.zoom)+1},i,r),e):t.value}_calculate(t,e,i,r){return r.zoom>r.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:i,to:e}}interpolate(t){return t}}class vn{constructor(t){this.specification=t}possiblyEvaluate(t,e,i,r){if(void 0!==t.value){if("constant"===t.expression.kind){const n=t.expression.evaluate(e,null,{},i,r);return this._calculate(n,n,n,e)}return this._calculate(t.expression.evaluate(new ln(Math.floor(e.zoom-1),e)),t.expression.evaluate(new ln(Math.floor(e.zoom),e)),t.expression.evaluate(new ln(Math.floor(e.zoom+1),e)),e)}}_calculate(t,e,i,r){return r.zoom>r.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:i,to:e}}interpolate(t){return t}}class bn{constructor(t){this.specification=t}possiblyEvaluate(t,e,i,r){return!!t.expression.evaluate(e,null,{},i,r)}interpolate(){return!1}}class wn{constructor(t){this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const e in t){const i=t[e];i.specification.overridable&&this.overridableProperties.push(e);const r=this.defaultPropertyValues[e]=new cn(i,void 0),n=this.defaultTransitionablePropertyValues[e]=new hn(i);this.defaultTransitioningPropertyValues[e]=n.untransitioned(),this.defaultPossiblyEvaluatedValues[e]=r.possiblyEvaluate({})}}}Rr("DataDrivenProperty",yn),Rr("DataConstantProperty",_n),Rr("CrossFadedDataDrivenProperty",xn),Rr("CrossFadedProperty",vn),Rr("ColorRampProperty",bn);const En="-transition";class Tn extends X{constructor(t,e){if(super(),this.id=t.id,this.type=t.type,this._featureFilter={filter:()=>!0,needGeometry:!1},"custom"!==t.type&&(this.metadata=t.metadata,this.minzoom=t.minzoom,this.maxzoom=t.maxzoom,"background"!==t.type&&(this.source=t.source,this.sourceLayer=t["source-layer"],this.filter=t.filter),e.layout&&(this._unevaluatedLayout=new mn(e.layout)),e.paint)){this._transitionablePaint=new un(e.paint);for(const e in t.paint)this.setPaintProperty(e,t.paint[e],{validate:!1});for(const e in t.layout)this.setLayoutProperty(e,t.layout[e],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new gn(e.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(t){return"visibility"===t?this.visibility:this._unevaluatedLayout.getValue(t)}setLayoutProperty(t,e,i={}){null!=e&&this._validate(Pr,`layers.${this.id}.layout.${t}`,t,e,i)||("visibility"!==t?this._unevaluatedLayout.setValue(t,e):this.visibility=e)}getPaintProperty(t){return t.endsWith(En)?this._transitionablePaint.getTransition(t.slice(0,-11)):this._transitionablePaint.getValue(t)}setPaintProperty(t,e,i={}){if(null!=e&&this._validate(kr,`layers.${this.id}.paint.${t}`,t,e,i))return!1;if(t.endsWith(En))return this._transitionablePaint.setTransition(t.slice(0,-11),e||void 0),!1;{const i=this._transitionablePaint._values[t],r="cross-faded-data-driven"===i.property.specification["property-type"],n=i.value.isDataDriven(),a=i.value;this._transitionablePaint.setValue(t,e),this._handleSpecialPaintPropertyUpdate(t);const o=this._transitionablePaint._values[t].value;return o.isDataDriven()||n||r||this._handleOverridablePaintPropertyUpdate(t,a,o)}}_handleSpecialPaintPropertyUpdate(t){}_handleOverridablePaintPropertyUpdate(t,e,i){return!1}isHidden(t){return!!(this.minzoom&&t<this.minzoom)||!!(this.maxzoom&&t>=this.maxzoom)||"none"===this.visibility}updateTransitions(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(t,e){t.getCrossfadeParameters&&(this._crossfadeParameters=t.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t,void 0,e)),this.paint=this._transitioningPaint.possiblyEvaluate(t,void 0,e)}serialize(){const 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),x(t,((t,e)=>!(void 0===t||"layout"===e&&!Object.keys(t).length||"paint"===e&&!Object.keys(t).length)))}_validate(t,e,i,r,n={}){return(!n||!1!==n.validate)&&zr(this,t.call(Ar,{key:e,layerType:this.type,objectKey:i,value:r,styleSpec:W,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const t in this.paint._values){const e=this.paint.get(t);if(e instanceof fn&&wi(e.property.specification)&&("source"===e.value.kind||"composite"===e.value.kind)&&e.value.isStateDependent)return!0}return!1}}const Sn={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Cn{constructor(t,e){this._structArray=t,this._pos1=e*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class In{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(t,e){return t._trim(),e&&(t.isTransferred=!0,e.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}}static deserialize(t){const e=Object.create(this.prototype);return e.arrayBuffer=t.arrayBuffer,e.length=t.length,e.capacity=t.arrayBuffer.byteLength/e.bytesPerElement,e._refreshViews(),e}_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);const e=this.uint8;this._refreshViews(),e&&this.uint8.set(e)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function An(t,e=1){let i=0,r=0;return{members:t.map((t=>{const n=Sn[t.type].BYTES_PER_ELEMENT,a=i=Mn(i,Math.max(e,n)),o=t.components||1;return r=Math.max(r,n),i+=n*o,{name:t.name,type:t.type,components:o,offset:a}})),size:Mn(i,Math.max(r,e)),alignment:e}}function Mn(t,e){return Math.ceil(t/e)*e}class kn extends In{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e){const i=this.length;return this.resize(i+1),this.emplace(i,t,e)}emplace(t,e,i){const r=2*t;return this.int16[r+0]=e,this.int16[r+1]=i,t}}kn.prototype.bytesPerElement=4,Rr("StructArrayLayout2i4",kn);class Pn extends In{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i){const r=this.length;return this.resize(r+1),this.emplace(r,t,e,i)}emplace(t,e,i,r){const n=3*t;return this.int16[n+0]=e,this.int16[n+1]=i,this.int16[n+2]=r,t}}Pn.prototype.bytesPerElement=6,Rr("StructArrayLayout3i6",Pn);class zn extends In{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i,r){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,i,r)}emplace(t,e,i,r,n){const a=4*t;return this.int16[a+0]=e,this.int16[a+1]=i,this.int16[a+2]=r,this.int16[a+3]=n,t}}zn.prototype.bytesPerElement=8,Rr("StructArrayLayout4i8",zn);class Ln extends In{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i,r,n,a){const o=this.length;return this.resize(o+1),this.emplace(o,t,e,i,r,n,a)}emplace(t,e,i,r,n,a,o){const s=6*t;return this.int16[s+0]=e,this.int16[s+1]=i,this.int16[s+2]=r,this.int16[s+3]=n,this.int16[s+4]=a,this.int16[s+5]=o,t}}Ln.prototype.bytesPerElement=12,Rr("StructArrayLayout2i4i12",Ln);class Dn extends In{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i,r,n,a){const o=this.length;return this.resize(o+1),this.emplace(o,t,e,i,r,n,a)}emplace(t,e,i,r,n,a,o){const s=4*t,l=8*t;return this.int16[s+0]=e,this.int16[s+1]=i,this.uint8[l+4]=r,this.uint8[l+5]=n,this.uint8[l+6]=a,this.uint8[l+7]=o,t}}Dn.prototype.bytesPerElement=8,Rr("StructArrayLayout2i4ub8",Dn);class Rn extends In{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e){const i=this.length;return this.resize(i+1),this.emplace(i,t,e)}emplace(t,e,i){const r=2*t;return this.float32[r+0]=e,this.float32[r+1]=i,t}}Rn.prototype.bytesPerElement=8,Rr("StructArrayLayout2f8",Rn);class Bn extends In{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,i,r,n,a,o,s,l,c){const h=this.length;return this.resize(h+1),this.emplace(h,t,e,i,r,n,a,o,s,l,c)}emplace(t,e,i,r,n,a,o,s,l,c,h){const u=10*t;return this.uint16[u+0]=e,this.uint16[u+1]=i,this.uint16[u+2]=r,this.uint16[u+3]=n,this.uint16[u+4]=a,this.uint16[u+5]=o,this.uint16[u+6]=s,this.uint16[u+7]=l,this.uint16[u+8]=c,this.uint16[u+9]=h,t}}Bn.prototype.bytesPerElement=20,Rr("StructArrayLayout10ui20",Bn);class Fn extends In{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,i,r,n,a,o,s,l,c,h,u){const p=this.length;return this.resize(p+1),this.emplace(p,t,e,i,r,n,a,o,s,l,c,h,u)}emplace(t,e,i,r,n,a,o,s,l,c,h,u,p){const d=12*t;return this.int16[d+0]=e,this.int16[d+1]=i,this.int16[d+2]=r,this.int16[d+3]=n,this.uint16[d+4]=a,this.uint16[d+5]=o,this.uint16[d+6]=s,this.uint16[d+7]=l,this.int16[d+8]=c,this.int16[d+9]=h,this.int16[d+10]=u,this.int16[d+11]=p,t}}Fn.prototype.bytesPerElement=24,Rr("StructArrayLayout4i4ui4i24",Fn);class On extends In{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,i){const r=this.length;return this.resize(r+1),this.emplace(r,t,e,i)}emplace(t,e,i,r){const n=3*t;return this.float32[n+0]=e,this.float32[n+1]=i,this.float32[n+2]=r,t}}On.prototype.bytesPerElement=12,Rr("StructArrayLayout3f12",On);class Un extends In{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.uint32[1*t+0]=e,t}}Un.prototype.bytesPerElement=4,Rr("StructArrayLayout1ul4",Un);class Vn extends In{_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,e,i,r,n,a,o,s,l){const c=this.length;return this.resize(c+1),this.emplace(c,t,e,i,r,n,a,o,s,l)}emplace(t,e,i,r,n,a,o,s,l,c){const h=10*t,u=5*t;return this.int16[h+0]=e,this.int16[h+1]=i,this.int16[h+2]=r,this.int16[h+3]=n,this.int16[h+4]=a,this.int16[h+5]=o,this.uint32[u+3]=s,this.uint16[h+8]=l,this.uint16[h+9]=c,t}}Vn.prototype.bytesPerElement=20,Rr("StructArrayLayout6i1ul2ui20",Vn);class Nn extends In{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i,r,n,a){const o=this.length;return this.resize(o+1),this.emplace(o,t,e,i,r,n,a)}emplace(t,e,i,r,n,a,o){const s=6*t;return this.int16[s+0]=e,this.int16[s+1]=i,this.int16[s+2]=r,this.int16[s+3]=n,this.int16[s+4]=a,this.int16[s+5]=o,t}}Nn.prototype.bytesPerElement=12,Rr("StructArrayLayout2i2i2i12",Nn);class $n extends In{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i,r,n){const a=this.length;return this.resize(a+1),this.emplace(a,t,e,i,r,n)}emplace(t,e,i,r,n,a){const o=4*t,s=8*t;return this.float32[o+0]=e,this.float32[o+1]=i,this.float32[o+2]=r,this.int16[s+6]=n,this.int16[s+7]=a,t}}$n.prototype.bytesPerElement=16,Rr("StructArrayLayout2f1f2i16",$n);class jn extends In{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,i,r){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,i,r)}emplace(t,e,i,r,n){const a=12*t,o=3*t;return this.uint8[a+0]=e,this.uint8[a+1]=i,this.float32[o+1]=r,this.float32[o+2]=n,t}}jn.prototype.bytesPerElement=12,Rr("StructArrayLayout2ub2f12",jn);class qn extends In{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,i){const r=this.length;return this.resize(r+1),this.emplace(r,t,e,i)}emplace(t,e,i,r){const n=3*t;return this.uint16[n+0]=e,this.uint16[n+1]=i,this.uint16[n+2]=r,t}}qn.prototype.bytesPerElement=6,Rr("StructArrayLayout3ui6",qn);class Zn extends In{_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,e,i,r,n,a,o,s,l,c,h,u,p,d,m,f,g){const _=this.length;return this.resize(_+1),this.emplace(_,t,e,i,r,n,a,o,s,l,c,h,u,p,d,m,f,g)}emplace(t,e,i,r,n,a,o,s,l,c,h,u,p,d,m,f,g,_){const y=24*t,x=12*t,v=48*t;return this.int16[y+0]=e,this.int16[y+1]=i,this.uint16[y+2]=r,this.uint16[y+3]=n,this.uint32[x+2]=a,this.uint32[x+3]=o,this.uint32[x+4]=s,this.uint16[y+10]=l,this.uint16[y+11]=c,this.uint16[y+12]=h,this.float32[x+7]=u,this.float32[x+8]=p,this.uint8[v+36]=d,this.uint8[v+37]=m,this.uint8[v+38]=f,this.uint32[x+10]=g,this.int16[y+22]=_,t}}Zn.prototype.bytesPerElement=48,Rr("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",Zn);class Gn extends In{_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,e,i,r,n,a,o,s,l,c,h,u,p,d,m,f,g,_,y,x,v,b,w,E,T,S,C,I){const A=this.length;return this.resize(A+1),this.emplace(A,t,e,i,r,n,a,o,s,l,c,h,u,p,d,m,f,g,_,y,x,v,b,w,E,T,S,C,I)}emplace(t,e,i,r,n,a,o,s,l,c,h,u,p,d,m,f,g,_,y,x,v,b,w,E,T,S,C,I,A){const M=32*t,k=16*t;return this.int16[M+0]=e,this.int16[M+1]=i,this.int16[M+2]=r,this.int16[M+3]=n,this.int16[M+4]=a,this.int16[M+5]=o,this.int16[M+6]=s,this.int16[M+7]=l,this.uint16[M+8]=c,this.uint16[M+9]=h,this.uint16[M+10]=u,this.uint16[M+11]=p,this.uint16[M+12]=d,this.uint16[M+13]=m,this.uint16[M+14]=f,this.uint16[M+15]=g,this.uint16[M+16]=_,this.uint16[M+17]=y,this.uint16[M+18]=x,this.uint16[M+19]=v,this.uint16[M+20]=b,this.uint16[M+21]=w,this.uint16[M+22]=E,this.uint32[k+12]=T,this.float32[k+13]=S,this.float32[k+14]=C,this.uint16[M+30]=I,this.uint16[M+31]=A,t}}Gn.prototype.bytesPerElement=64,Rr("StructArrayLayout8i15ui1ul2f2ui64",Gn);class Hn extends In{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.float32[1*t+0]=e,t}}Hn.prototype.bytesPerElement=4,Rr("StructArrayLayout1f4",Hn);class Xn extends In{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,i){const r=this.length;return this.resize(r+1),this.emplace(r,t,e,i)}emplace(t,e,i,r){const n=3*t;return this.uint16[6*t+0]=e,this.float32[n+1]=i,this.float32[n+2]=r,t}}Xn.prototype.bytesPerElement=12,Rr("StructArrayLayout1ui2f12",Xn);class Wn extends In{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,i){const r=this.length;return this.resize(r+1),this.emplace(r,t,e,i)}emplace(t,e,i,r){const n=4*t;return this.uint32[2*t+0]=e,this.uint16[n+2]=i,this.uint16[n+3]=r,t}}Wn.prototype.bytesPerElement=8,Rr("StructArrayLayout1ul2ui8",Wn);class Kn extends In{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e){const i=this.length;return this.resize(i+1),this.emplace(i,t,e)}emplace(t,e,i){const r=2*t;return this.uint16[r+0]=e,this.uint16[r+1]=i,t}}Kn.prototype.bytesPerElement=4,Rr("StructArrayLayout2ui4",Kn);class Yn extends In{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.uint16[1*t+0]=e,t}}Yn.prototype.bytesPerElement=2,Rr("StructArrayLayout1ui2",Yn);class Jn extends In{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,i,r){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,i,r)}emplace(t,e,i,r,n){const a=4*t;return this.float32[a+0]=e,this.float32[a+1]=i,this.float32[a+2]=r,this.float32[a+3]=n,t}}Jn.prototype.bytesPerElement=16,Rr("StructArrayLayout4f16",Jn);class Qn extends Cn{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 n(this.anchorPointX,this.anchorPointY)}}Qn.prototype.size=20;class ta extends Vn{get(t){return new Qn(this,t)}}Rr("CollisionBoxArray",ta);class ea extends Cn{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]}}ea.prototype.size=48;class ia extends Zn{get(t){return new ea(this,t)}}Rr("PlacedSymbolArray",ia);class ra extends Cn{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 collisionCircleDiameter(){return this._structArray.float32[this._pos4+14]}get textAnchorOffsetStartIndex(){return this._structArray.uint16[this._pos2+30]}get textAnchorOffsetEndIndex(){return this._structArray.uint16[this._pos2+31]}}ra.prototype.size=64;class na extends Gn{get(t){return new ra(this,t)}}Rr("SymbolInstanceArray",na);class aa extends Hn{getoffsetX(t){return this.float32[1*t+0]}}Rr("GlyphOffsetArray",aa);class oa extends Pn{getx(t){return this.int16[3*t+0]}gety(t){return this.int16[3*t+1]}gettileUnitDistanceFromAnchor(t){return this.int16[3*t+2]}}Rr("SymbolLineVertexArray",oa);class sa extends Cn{get textAnchor(){return this._structArray.uint16[this._pos2+0]}get textOffset0(){return this._structArray.float32[this._pos4+1]}get textOffset1(){return this._structArray.float32[this._pos4+2]}}sa.prototype.size=12;class la extends Xn{get(t){return new sa(this,t)}}Rr("TextAnchorOffsetArray",la);class ca extends Cn{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]}}ca.prototype.size=8;class ha extends Wn{get(t){return new ca(this,t)}}Rr("FeatureIndexArray",ha);class ua extends kn{}class pa extends kn{}class da extends kn{}class ma extends Ln{}class fa extends Dn{}class ga extends Rn{}class _a extends Bn{}class ya extends Fn{}class xa extends On{}class va extends Un{}class ba extends Nn{}class wa extends jn{}class Ea extends qn{}class Ta extends Kn{}const Sa=An([{name:"a_pos",components:2,type:"Int16"}],4),{members:Ca}=Sa;class Ia{constructor(t=[]){this.segments=t}prepareSegment(t,e,i,r){let n=this.segments[this.segments.length-1];return t>Ia.MAX_VERTEX_ARRAY_LENGTH&&w(`Max vertices per segment is ${Ia.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${t}`),(!n||n.vertexLength+t>Ia.MAX_VERTEX_ARRAY_LENGTH||n.sortKey!==r)&&(n={vertexOffset:e.length,primitiveOffset:i.length,vertexLength:0,primitiveLength:0},void 0!==r&&(n.sortKey=r),this.segments.push(n)),n}get(){return this.segments}destroy(){for(const t of this.segments)for(const e in t.vaos)t.vaos[e].destroy()}static simpleSegment(t,e,i,r){return new Ia([{vertexOffset:t,primitiveOffset:e,vertexLength:i,primitiveLength:r,vaos:{},sortKey:0}])}}function Aa(t,e){return 256*(t=m(Math.floor(t),0,255))+m(Math.floor(e),0,255)}Ia.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Rr("SegmentVector",Ia);const Ma=An([{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 ka={exports:{}},Pa=function(t,e){var i,r,n,a,o,s,l,c;for(r=t.length-(i=3&t.length),n=e,o=3432918353,s=461845907,c=0;c<r;)l=255&t.charCodeAt(c)|(255&t.charCodeAt(++c))<<8|(255&t.charCodeAt(++c))<<16|(255&t.charCodeAt(++c))<<24,++c,n=27492+(65535&(a=5*(65535&(n=(n^=l=(65535&(l=(l=(65535&l)*o+(((l>>>16)*o&65535)<<16)&4294967295)<<15|l>>>17))*s+(((l>>>16)*s&65535)<<16)&4294967295)<<13|n>>>19))+((5*(n>>>16)&65535)<<16)&4294967295))+((58964+(a>>>16)&65535)<<16);switch(l=0,i){case 3:l^=(255&t.charCodeAt(c+2))<<16;case 2:l^=(255&t.charCodeAt(c+1))<<8;case 1:n^=l=(65535&(l=(l=(65535&(l^=255&t.charCodeAt(c)))*o+(((l>>>16)*o&65535)<<16)&4294967295)<<15|l>>>17))*s+(((l>>>16)*s&65535)<<16)&4294967295}return n^=t.length,n=2246822507*(65535&(n^=n>>>16))+((2246822507*(n>>>16)&65535)<<16)&4294967295,n=3266489909*(65535&(n^=n>>>13))+((3266489909*(n>>>16)&65535)<<16)&4294967295,(n^=n>>>16)>>>0},za=function(t,e){for(var i,r=t.length,n=e^r,a=0;r>=4;)i=1540483477*(65535&(i=255&t.charCodeAt(a)|(255&t.charCodeAt(++a))<<8|(255&t.charCodeAt(++a))<<16|(255&t.charCodeAt(++a))<<24))+((1540483477*(i>>>16)&65535)<<16),n=1540483477*(65535&n)+((1540483477*(n>>>16)&65535)<<16)^(i=1540483477*(65535&(i^=i>>>24))+((1540483477*(i>>>16)&65535)<<16)),r-=4,++a;switch(r){case 3:n^=(255&t.charCodeAt(a+2))<<16;case 2:n^=(255&t.charCodeAt(a+1))<<8;case 1:n=1540483477*(65535&(n^=255&t.charCodeAt(a)))+((1540483477*(n>>>16)&65535)<<16)}return n=1540483477*(65535&(n^=n>>>13))+((1540483477*(n>>>16)&65535)<<16),(n^=n>>>15)>>>0};ka.exports=Pa,ka.exports.murmur3=Pa,ka.exports.murmur2=za;var La=e(ka.exports);class Da{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(t,e,i,r){this.ids.push(Ra(t)),this.positions.push(e,i,r)}getPositions(t){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const e=Ra(t);let i=0,r=this.ids.length-1;for(;i<r;){const t=i+r>>1;this.ids[t]>=e?r=t:i=t+1}const n=[];for(;this.ids[i]===e;)n.push({index:this.positions[3*i],start:this.positions[3*i+1],end:this.positions[3*i+2]}),i++;return n}static serialize(t,e){const i=new Float64Array(t.ids),r=new Uint32Array(t.positions);return Ba(i,r,0,i.length-1),e&&e.push(i.buffer,r.buffer),{ids:i,positions:r}}static deserialize(t){const e=new Da;return e.ids=t.ids,e.positions=t.positions,e.indexed=!0,e}}function Ra(t){const e=+t;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:La(String(t))}function Ba(t,e,i,r){for(;i<r;){const n=t[i+r>>1];let a=i-1,o=r+1;for(;;){do{a++}while(t[a]<n);do{o--}while(t[o]>n);if(a>=o)break;Fa(t,a,o),Fa(e,3*a,3*o),Fa(e,3*a+1,3*o+1),Fa(e,3*a+2,3*o+2)}o-i<r-o?(Ba(t,e,i,o),i=o+1):(Ba(t,e,o+1,r),r=o)}}function Fa(t,e,i){const r=t[e];t[e]=t[i],t[i]=r}Rr("FeaturePositionMap",Da);class Oa{constructor(t,e){this.gl=t.gl,this.location=e}}class Ua extends Oa{constructor(t,e){super(t,e),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1f(this.location,t))}}class Va extends Oa{constructor(t,e){super(t,e),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 Na extends Oa{constructor(t,e){super(t,e),this.current=Kt.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))}}const $a=new Float32Array(16);function ja(t){return[Aa(255*t.r,255*t.g),Aa(255*t.b,255*t.a)]}class qa{constructor(t,e,i){this.value=t,this.uniformNames=e.map((t=>`u_${t}`)),this.type=i}setUniform(t,e,i){t.set(i.constantOr(this.value))}getBinding(t,e,i){return"color"===this.type?new Na(t,e):new Ua(t,e)}}class Za{constructor(t,e){this.uniformNames=e.map((t=>`u_${t}`)),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(t,e){this.pixelRatioFrom=e.pixelRatio,this.pixelRatioTo=t.pixelRatio,this.patternFrom=e.tlbr,this.patternTo=t.tlbr}setUniform(t,e,i,r){const n="u_pattern_to"===r?this.patternTo:"u_pattern_from"===r?this.patternFrom:"u_pixel_ratio_to"===r?this.pixelRatioTo:"u_pixel_ratio_from"===r?this.pixelRatioFrom:null;n&&t.set(n)}getBinding(t,e,i){return"u_pattern"===i.substr(0,9)?new Va(t,e):new Ua(t,e)}}class Ga{constructor(t,e,i,r){this.expression=t,this.type=i,this.maxValue=0,this.paintVertexAttributes=e.map((t=>({name:`a_${t}`,type:"Float32",components:"color"===i?2:1,offset:0}))),this.paintVertexArray=new r}populatePaintArray(t,e,i,r,n){const a=this.paintVertexArray.length,o=this.expression.evaluate(new ln(0),e,{},r,[],n);this.paintVertexArray.resize(t),this._setPaintValue(a,t,o)}updatePaintArray(t,e,i,r){const n=this.expression.evaluate({zoom:0},i,r);this._setPaintValue(t,e,n)}_setPaintValue(t,e,i){if("color"===this.type){const r=ja(i);for(let i=t;i<e;i++)this.paintVertexArray.emplace(i,r[0],r[1])}else{for(let r=t;r<e;r++)this.paintVertexArray.emplace(r,i);this.maxValue=Math.max(this.maxValue,Math.abs(i))}}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 Ha{constructor(t,e,i,r,n,a){this.expression=t,this.uniformNames=e.map((t=>`u_${t}_t`)),this.type=i,this.useIntegerZoom=r,this.zoom=n,this.maxValue=0,this.paintVertexAttributes=e.map((t=>({name:`a_${t}`,type:"Float32",components:"color"===i?4:2,offset:0}))),this.paintVertexArray=new a}populatePaintArray(t,e,i,r,n){const a=this.expression.evaluate(new ln(this.zoom),e,{},r,[],n),o=this.expression.evaluate(new ln(this.zoom+1),e,{},r,[],n),s=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(s,t,a,o)}updatePaintArray(t,e,i,r){const n=this.expression.evaluate({zoom:this.zoom},i,r),a=this.expression.evaluate({zoom:this.zoom+1},i,r);this._setPaintValue(t,e,n,a)}_setPaintValue(t,e,i,r){if("color"===this.type){const n=ja(i),a=ja(r);for(let i=t;i<e;i++)this.paintVertexArray.emplace(i,n[0],n[1],a[0],a[1])}else{for(let n=t;n<e;n++)this.paintVertexArray.emplace(n,i,r);this.maxValue=Math.max(this.maxValue,Math.abs(i),Math.abs(r))}}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,e){const i=this.useIntegerZoom?Math.floor(e.zoom):e.zoom,r=m(this.expression.interpolationFactor(i,this.zoom,this.zoom+1),0,1);t.set(r)}getBinding(t,e,i){return new Ua(t,e)}}class Xa{constructor(t,e,i,r,n,a){this.expression=t,this.type=e,this.useIntegerZoom=i,this.zoom=r,this.layerId=a,this.zoomInPaintVertexArray=new n,this.zoomOutPaintVertexArray=new n}populatePaintArray(t,e,i){const r=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(t),this.zoomOutPaintVertexArray.resize(t),this._setPaintValues(r,t,e.patterns&&e.patterns[this.layerId],i)}updatePaintArray(t,e,i,r,n){this._setPaintValues(t,e,i.patterns&&i.patterns[this.layerId],n)}_setPaintValues(t,e,i,r){if(!r||!i)return;const{min:n,mid:a,max:o}=i,s=r[n],l=r[a],c=r[o];if(s&&l&&c)for(let i=t;i<e;i++)this.zoomInPaintVertexArray.emplace(i,l.tl[0],l.tl[1],l.br[0],l.br[1],s.tl[0],s.tl[1],s.br[0],s.br[1],l.pixelRatio,s.pixelRatio),this.zoomOutPaintVertexArray.emplace(i,l.tl[0],l.tl[1],l.br[0],l.br[1],c.tl[0],c.tl[1],c.br[0],c.br[1],l.pixelRatio,c.pixelRatio)}upload(t){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=t.createVertexBuffer(this.zoomInPaintVertexArray,Ma.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=t.createVertexBuffer(this.zoomOutPaintVertexArray,Ma.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class Wa{constructor(t,e,i){this.binders={},this._buffers=[];const r=[];for(const n in t.paint._values){if(!i(n))continue;const a=t.paint.get(n);if(!(a instanceof fn&&wi(a.property.specification)))continue;const o=Ya(n,t.type),s=a.value,l=a.property.specification.type,c=a.property.useIntegerZoom,h=a.property.specification["property-type"],u="cross-faded"===h||"cross-faded-data-driven"===h;if("constant"===s.kind)this.binders[n]=u?new Za(s.value,o):new qa(s.value,o,l),r.push(`/u_${n}`);else if("source"===s.kind||u){const i=Ja(n,l,"source");this.binders[n]=u?new Xa(s,l,c,e,i,t.id):new Ga(s,o,l,i),r.push(`/a_${n}`)}else{const t=Ja(n,l,"composite");this.binders[n]=new Ha(s,o,l,c,e,t),r.push(`/z_${n}`)}}this.cacheKey=r.sort().join("")}getMaxValue(t){const e=this.binders[t];return e instanceof Ga||e instanceof Ha?e.maxValue:0}populatePaintArrays(t,e,i,r,n){for(const a in this.binders){const o=this.binders[a];(o instanceof Ga||o instanceof Ha||o instanceof Xa)&&o.populatePaintArray(t,e,i,r,n)}}setConstantPatternPositions(t,e){for(const i in this.binders){const r=this.binders[i];r instanceof Za&&r.setConstantPatternPositions(t,e)}}updatePaintArrays(t,e,i,r,n){let a=!1;for(const o in t){const s=e.getPositions(o);for(const e of s){const s=i.feature(e.index);for(const i in this.binders){const l=this.binders[i];if((l instanceof Ga||l instanceof Ha||l instanceof Xa)&&!0===l.expression.isStateDependent){const c=r.paint.get(i);l.expression=c.value,l.updatePaintArray(e.start,e.end,s,t[o],n),a=!0}}}}return a}defines(){const t=[];for(const e in this.binders){const i=this.binders[e];(i instanceof qa||i instanceof Za)&&t.push(...i.uniformNames.map((t=>`#define HAS_UNIFORM_${t}`)))}return t}getBinderAttributes(){const t=[];for(const e in this.binders){const i=this.binders[e];if(i instanceof Ga||i instanceof Ha)for(let e=0;e<i.paintVertexAttributes.length;e++)t.push(i.paintVertexAttributes[e].name);else if(i instanceof Xa)for(let e=0;e<Ma.members.length;e++)t.push(Ma.members[e].name)}return t}getBinderUniforms(){const t=[];for(const e in this.binders){const i=this.binders[e];if(i instanceof qa||i instanceof Za||i instanceof Ha)for(const e of i.uniformNames)t.push(e)}return t}getPaintVertexBuffers(){return this._buffers}getUniforms(t,e){const i=[];for(const r in this.binders){const n=this.binders[r];if(n instanceof qa||n instanceof Za||n instanceof Ha)for(const a of n.uniformNames)if(e[a]){const o=n.getBinding(t,e[a],a);i.push({name:a,property:r,binding:o})}}return i}setUniforms(t,e,i,r){for(const{name:t,property:n,binding:a}of e)this.binders[n].setUniform(a,r,i.get(n),t)}updatePaintBuffers(t){this._buffers=[];for(const e in this.binders){const i=this.binders[e];if(t&&i instanceof Xa){const e=2===t.fromScale?i.zoomInPaintVertexBuffer:i.zoomOutPaintVertexBuffer;e&&this._buffers.push(e)}else(i instanceof Ga||i instanceof Ha)&&i.paintVertexBuffer&&this._buffers.push(i.paintVertexBuffer)}}upload(t){for(const e in this.binders){const i=this.binders[e];(i instanceof Ga||i instanceof Ha||i instanceof Xa)&&i.upload(t)}this.updatePaintBuffers()}destroy(){for(const t in this.binders){const e=this.binders[t];(e instanceof Ga||e instanceof Ha||e instanceof Xa)&&e.destroy()}}}class Ka{constructor(t,e,i=(()=>!0)){this.programConfigurations={};for(const r of t)this.programConfigurations[r.id]=new Wa(r,e,i);this.needsUpload=!1,this._featureMap=new Da,this._bufferOffset=0}populatePaintArrays(t,e,i,r,n,a){for(const i in this.programConfigurations)this.programConfigurations[i].populatePaintArrays(t,e,r,n,a);void 0!==e.id&&this._featureMap.add(e.id,i,this._bufferOffset,t),this._bufferOffset=t,this.needsUpload=!0}updatePaintArrays(t,e,i,r){for(const n of i)this.needsUpload=this.programConfigurations[n.id].updatePaintArrays(t,this._featureMap,e,n,r)||this.needsUpload}get(t){return this.programConfigurations[t]}upload(t){if(this.needsUpload){for(const e in this.programConfigurations)this.programConfigurations[e].upload(t);this.needsUpload=!1}}destroy(){for(const t in this.programConfigurations)this.programConfigurations[t].destroy()}}function Ya(t,e){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[t]||[t.replace(`${e}-`,"").replace(/-/g,"_")]}function Ja(t,e,i){const r={color:{source:Rn,composite:Jn},number:{source:Hn,composite:Rn}},n=function(t){return{"line-pattern":{source:_a,composite:_a},"fill-pattern":{source:_a,composite:_a},"fill-extrusion-pattern":{source:_a,composite:_a}}[t]}(t);return n&&n[i]||r[e][i]}Rr("ConstantBinder",qa),Rr("CrossFadedConstantBinder",Za),Rr("SourceExpressionBinder",Ga),Rr("CrossFadedCompositeBinder",Xa),Rr("CompositeExpressionBinder",Ha),Rr("ProgramConfiguration",Wa,{omit:["_buffers"]}),Rr("ProgramConfigurationSet",Ka);const Qa=8192,to=Math.pow(2,14)-1,eo=-to-1;function io(t){const e=Qa/t.extent,i=t.loadGeometry();for(let t=0;t<i.length;t++){const r=i[t];for(let t=0;t<r.length;t++){const i=r[t],n=Math.round(i.x*e),a=Math.round(i.y*e);i.x=m(n,eo,to),i.y=m(a,eo,to),(n<i.x||n>i.x+1||a<i.y||a>i.y+1)&&w("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return i}function ro(t,e){return{type:t.type,id:t.id,properties:t.properties,geometry:e?io(t):[]}}function no(t,e,i,r,n){t.emplaceBack(2*e+(r+1)/2,2*i+(n+1)/2)}class ao{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new pa,this.indexArray=new Ea,this.segments=new Ia,this.programConfigurations=new Ka(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id))}populate(t,e,i){const r=this.layers[0],n=[];let a=null,o=!1;"circle"===r.type&&(a=r.layout.get("circle-sort-key"),o=!a.isConstant());for(const{feature:e,id:r,index:s,sourceLayerIndex:l}of t){const t=this.layers[0]._featureFilter.needGeometry,c=ro(e,t);if(!this.layers[0]._featureFilter.filter(new ln(this.zoom),c,i))continue;const h=o?a.evaluate(c,{},i):void 0,u={id:r,properties:e.properties,type:e.type,sourceLayerIndex:l,index:s,geometry:t?c.geometry:io(e),patterns:{},sortKey:h};n.push(u)}o&&n.sort(((t,e)=>t.sortKey-e.sortKey));for(const r of n){const{geometry:n,index:a,sourceLayerIndex:o}=r,s=t[a].feature;this.addFeature(r,n,a,i),e.featureIndex.insert(s,n,a,o,this.index)}}update(t,e,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,i)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Ca),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,e,i,r){for(const i of e)for(const e of i){const i=e.x,r=e.y;if(i<0||i>=Qa||r<0||r>=Qa)continue;const n=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,t.sortKey),a=n.vertexLength;no(this.layoutVertexArray,i,r,-1,-1),no(this.layoutVertexArray,i,r,1,-1),no(this.layoutVertexArray,i,r,1,1),no(this.layoutVertexArray,i,r,-1,1),this.indexArray.emplaceBack(a,a+1,a+2),this.indexArray.emplaceBack(a,a+3,a+2),n.vertexLength+=4,n.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,i,{},r)}}function oo(t,e){for(let i=0;i<t.length;i++)if(go(e,t[i]))return!0;for(let i=0;i<e.length;i++)if(go(t,e[i]))return!0;return!!ho(t,e)}function so(t,e,i){return!!go(t,e)||!!po(e,t,i)}function lo(t,e){if(1===t.length)return fo(e,t[0]);for(let i=0;i<e.length;i++){const r=e[i];for(let e=0;e<r.length;e++)if(go(t,r[e]))return!0}for(let i=0;i<t.length;i++)if(fo(e,t[i]))return!0;for(let i=0;i<e.length;i++)if(ho(t,e[i]))return!0;return!1}function co(t,e,i){if(t.length>1){if(ho(t,e))return!0;for(let r=0;r<e.length;r++)if(po(e[r],t,i))return!0}for(let r=0;r<t.length;r++)if(po(t[r],e,i))return!0;return!1}function ho(t,e){if(0===t.length||0===e.length)return!1;for(let i=0;i<t.length-1;i++){const r=t[i],n=t[i+1];for(let t=0;t<e.length-1;t++)if(uo(r,n,e[t],e[t+1]))return!0}return!1}function uo(t,e,i,r){return E(t,i,r)!==E(e,i,r)&&E(t,e,i)!==E(t,e,r)}function po(t,e,i){const r=i*i;if(1===e.length)return t.distSqr(e[0])<r;for(let i=1;i<e.length;i++)if(mo(t,e[i-1],e[i])<r)return!0;return!1}function mo(t,e,i){const r=e.distSqr(i);if(0===r)return t.distSqr(e);const n=((t.x-e.x)*(i.x-e.x)+(t.y-e.y)*(i.y-e.y))/r;return t.distSqr(n<0?e:n>1?i:i.sub(e)._mult(n)._add(e))}function fo(t,e){let i,r,n,a=!1;for(let o=0;o<t.length;o++){i=t[o];for(let t=0,o=i.length-1;t<i.length;o=t++)r=i[t],n=i[o],r.y>e.y!=n.y>e.y&&e.x<(n.x-r.x)*(e.y-r.y)/(n.y-r.y)+r.x&&(a=!a)}return a}function go(t,e){let i=!1;for(let r=0,n=t.length-1;r<t.length;n=r++){const a=t[r],o=t[n];a.y>e.y!=o.y>e.y&&e.x<(o.x-a.x)*(e.y-a.y)/(o.y-a.y)+a.x&&(i=!i)}return i}function _o(t,e,i){const r=i[0],n=i[2];if(t.x<r.x&&e.x<r.x||t.x>n.x&&e.x>n.x||t.y<r.y&&e.y<r.y||t.y>n.y&&e.y>n.y)return!1;const a=E(t,e,i[0]);return a!==E(t,e,i[1])||a!==E(t,e,i[2])||a!==E(t,e,i[3])}function yo(t,e,i){const r=e.paint.get(t).value;return"constant"===r.kind?r.value:i.programConfigurations.get(e.id).getMaxValue(t)}function xo(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function vo(t,e,i,r,a){if(!e[0]&&!e[1])return t;const o=n.convert(e)._mult(a);"viewport"===i&&o._rotate(-r);const s=[];for(let e=0;e<t.length;e++)s.push(t[e].sub(o));return s}let bo,wo;Rr("CircleBucket",ao,{omit:["layers"]});var Eo={get paint(){return wo=wo||new wn({"circle-radius":new yn(W.paint_circle["circle-radius"]),"circle-color":new yn(W.paint_circle["circle-color"]),"circle-blur":new yn(W.paint_circle["circle-blur"]),"circle-opacity":new yn(W.paint_circle["circle-opacity"]),"circle-translate":new _n(W.paint_circle["circle-translate"]),"circle-translate-anchor":new _n(W.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new _n(W.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new _n(W.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new yn(W.paint_circle["circle-stroke-width"]),"circle-stroke-color":new yn(W.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new yn(W.paint_circle["circle-stroke-opacity"])})},get layout(){return bo=bo||new wn({"circle-sort-key":new yn(W.layout_circle["circle-sort-key"])})}},To=1e-6,So="undefined"!=typeof Float32Array?Float32Array:Array;function Co(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function Io(t,e,i){var r=e[0],n=e[1],a=e[2],o=e[3],s=e[4],l=e[5],c=e[6],h=e[7],u=e[8],p=e[9],d=e[10],m=e[11],f=e[12],g=e[13],_=e[14],y=e[15],x=i[0],v=i[1],b=i[2],w=i[3];return t[0]=x*r+v*s+b*u+w*f,t[1]=x*n+v*l+b*p+w*g,t[2]=x*a+v*c+b*d+w*_,t[3]=x*o+v*h+b*m+w*y,t[4]=(x=i[4])*r+(v=i[5])*s+(b=i[6])*u+(w=i[7])*f,t[5]=x*n+v*l+b*p+w*g,t[6]=x*a+v*c+b*d+w*_,t[7]=x*o+v*h+b*m+w*y,t[8]=(x=i[8])*r+(v=i[9])*s+(b=i[10])*u+(w=i[11])*f,t[9]=x*n+v*l+b*p+w*g,t[10]=x*a+v*c+b*d+w*_,t[11]=x*o+v*h+b*m+w*y,t[12]=(x=i[12])*r+(v=i[13])*s+(b=i[14])*u+(w=i[15])*f,t[13]=x*n+v*l+b*p+w*g,t[14]=x*a+v*c+b*d+w*_,t[15]=x*o+v*h+b*m+w*y,t}Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)});var Ao,Mo=Io;function ko(t,e,i){var r=e[0],n=e[1],a=e[2],o=e[3];return t[0]=i[0]*r+i[4]*n+i[8]*a+i[12]*o,t[1]=i[1]*r+i[5]*n+i[9]*a+i[13]*o,t[2]=i[2]*r+i[6]*n+i[10]*a+i[14]*o,t[3]=i[3]*r+i[7]*n+i[11]*a+i[15]*o,t}Ao=new So(4),So!=Float32Array&&(Ao[0]=0,Ao[1]=0,Ao[2]=0,Ao[3]=0);class Po extends Tn{constructor(t){super(t,Eo)}createBucket(t){return new ao(t)}queryRadius(t){const e=t;return yo("circle-radius",this,e)+yo("circle-stroke-width",this,e)+xo(this.paint.get("circle-translate"))}queryIntersectsFeature(t,e,i,r,n,a,o,s){const l=vo(t,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),a.angle,o),c=this.paint.get("circle-radius").evaluate(e,i)+this.paint.get("circle-stroke-width").evaluate(e,i),h="map"===this.paint.get("circle-pitch-alignment"),u=h?l:function(t,e){return t.map((t=>zo(t,e)))}(l,s),p=h?c*o:c;for(const t of r)for(const e of t){const t=h?e:zo(e,s);let i=p;const r=ko([],[e.x,e.y,0,1],s);if("viewport"===this.paint.get("circle-pitch-scale")&&"map"===this.paint.get("circle-pitch-alignment")?i*=r[3]/a.cameraToCenterDistance:"map"===this.paint.get("circle-pitch-scale")&&"viewport"===this.paint.get("circle-pitch-alignment")&&(i*=a.cameraToCenterDistance/r[3]),so(u,t,i))return!0}return!1}}function zo(t,e){const i=ko([],[t.x,t.y,0,1],e);return new n(i[0]/i[3],i[1]/i[3])}class Lo extends ao{}let Do;Rr("HeatmapBucket",Lo,{omit:["layers"]});var Ro={get paint(){return Do=Do||new wn({"heatmap-radius":new yn(W.paint_heatmap["heatmap-radius"]),"heatmap-weight":new yn(W.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new _n(W.paint_heatmap["heatmap-intensity"]),"heatmap-color":new bn(W.paint_heatmap["heatmap-color"]),"heatmap-opacity":new _n(W.paint_heatmap["heatmap-opacity"])})}};function Bo(t,{width:e,height:i},r,n){if(n){if(n instanceof Uint8ClampedArray)n=new Uint8Array(n.buffer);else if(n.length!==e*i*r)throw new RangeError(`mismatched image size. expected: ${n.length} but got: ${e*i*r}`)}else n=new Uint8Array(e*i*r);return t.width=e,t.height=i,t.data=n,t}function Fo(t,{width:e,height:i},r){if(e===t.width&&i===t.height)return;const n=Bo({},{width:e,height:i},r);Oo(t,n,{x:0,y:0},{x:0,y:0},{width:Math.min(t.width,e),height:Math.min(t.height,i)},r),t.width=e,t.height=i,t.data=n.data}function Oo(t,e,i,r,n,a){if(0===n.width||0===n.height)return e;if(n.width>t.width||n.height>t.height||i.x>t.width-n.width||i.y>t.height-n.height)throw new RangeError("out of range source coordinates for image copy");if(n.width>e.width||n.height>e.height||r.x>e.width-n.width||r.y>e.height-n.height)throw new RangeError("out of range destination coordinates for image copy");const o=t.data,s=e.data;if(o===s)throw new Error("srcData equals dstData, so image is already copied");for(let l=0;l<n.height;l++){const c=((i.y+l)*t.width+i.x)*a,h=((r.y+l)*e.width+r.x)*a;for(let t=0;t<n.width*a;t++)s[h+t]=o[c+t]}return e}class Uo{constructor(t,e){Bo(this,t,1,e)}resize(t){Fo(this,t,1)}clone(){return new Uo({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,e,i,r,n){Oo(t,e,i,r,n,1)}}class Vo{constructor(t,e){Bo(this,t,4,e)}resize(t){Fo(this,t,4)}replace(t,e){e?this.data.set(t):this.data=t instanceof Uint8ClampedArray?new Uint8Array(t.buffer):t}clone(){return new Vo({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,e,i,r,n){Oo(t,e,i,r,n,4)}}function No(t){const e={},i=t.resolution||256,r=t.clips?t.clips.length:1,n=t.image||new Vo({width:i,height:r});if(Math.log(i)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${i}`);const a=(i,r,a)=>{e[t.evaluationKey]=a;const o=t.expression.evaluate(e);n.data[i+r+0]=Math.floor(255*o.r/o.a),n.data[i+r+1]=Math.floor(255*o.g/o.a),n.data[i+r+2]=Math.floor(255*o.b/o.a),n.data[i+r+3]=Math.floor(255*o.a)};if(t.clips)for(let e=0,n=0;e<r;++e,n+=4*i)for(let r=0,o=0;r<i;r++,o+=4){const s=r/(i-1),{start:l,end:c}=t.clips[e];a(n,o,l*(1-s)+c*s)}else for(let t=0,e=0;t<i;t++,e+=4)a(0,e,t/(i-1));return n}Rr("AlphaImage",Uo),Rr("RGBAImage",Vo);class $o extends Tn{createBucket(t){return new Lo(t)}constructor(t){super(t,Ro),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(t){"heatmap-color"===t&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=No({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 0!==this.paint.get("heatmap-opacity")&&"none"!==this.visibility}}let jo;var qo={get paint(){return jo=jo||new wn({"hillshade-illumination-direction":new _n(W.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new _n(W.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new _n(W.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new _n(W.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new _n(W.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new _n(W.paint_hillshade["hillshade-accent-color"])})}};class Zo extends Tn{constructor(t){super(t,qo)}hasOffscreenPass(){return 0!==this.paint.get("hillshade-exaggeration")&&"none"!==this.visibility}}const Go=An([{name:"a_pos",components:2,type:"Int16"}],4),{members:Ho}=Go;var Xo={exports:{}};function Wo(t,e,i){i=i||2;var r,n,a,o,s,l,c,h=e&&e.length,u=h?e[0]*i:t.length,p=Ko(t,0,u,i,!0),d=[];if(!p||p.next===p.prev)return d;if(h&&(p=function(t,e,i,r){var n,a,o,s=[];for(n=0,a=e.length;n<a;n++)(o=Ko(t,e[n]*r,n<a-1?e[n+1]*r:t.length,r,!1))===o.next&&(o.steiner=!0),s.push(ss(o));for(s.sort(rs),n=0;n<s.length;n++)i=ns(s[n],i);return i}(t,e,p,i)),t.length>80*i){r=a=t[0],n=o=t[1];for(var m=i;m<u;m+=i)(s=t[m])<r&&(r=s),(l=t[m+1])<n&&(n=l),s>a&&(a=s),l>o&&(o=l);c=0!==(c=Math.max(a-r,o-n))?32767/c:0}return Jo(p,d,i,r,n,c,0),d}function Ko(t,e,i,r,n){var a,o;if(n===vs(t,e,i,r)>0)for(a=e;a<i;a+=r)o=_s(a,t[a],t[a+1],o);else for(a=i-r;a>=e;a-=r)o=_s(a,t[a],t[a+1],o);return o&&us(o,o.next)&&(ys(o),o=o.next),o}function Yo(t,e){if(!t)return t;e||(e=t);var i,r=t;do{if(i=!1,r.steiner||!us(r,r.next)&&0!==hs(r.prev,r,r.next))r=r.next;else{if(ys(r),(r=e=r.prev)===r.next)break;i=!0}}while(i||r!==e);return e}function Jo(t,e,i,r,n,a,o){if(t){!o&&a&&function(t,e,i,r){var n=t;do{0===n.z&&(n.z=os(n.x,n.y,e,i,r)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next}while(n!==t);n.prevZ.nextZ=null,n.prevZ=null,function(t){var e,i,r,n,a,o,s,l,c=1;do{for(i=t,t=null,a=null,o=0;i;){for(o++,r=i,s=0,e=0;e<c&&(s++,r=r.nextZ);e++);for(l=c;s>0||l>0&&r;)0!==s&&(0===l||!r||i.z<=r.z)?(n=i,i=i.nextZ,s--):(n=r,r=r.nextZ,l--),a?a.nextZ=n:t=n,n.prevZ=a,a=n;i=r}a.nextZ=null,c*=2}while(o>1)}(n)}(t,r,n,a);for(var s,l,c=t;t.prev!==t.next;)if(s=t.prev,l=t.next,a?ts(t,r,n,a):Qo(t))e.push(s.i/i|0),e.push(t.i/i|0),e.push(l.i/i|0),ys(t),t=l.next,c=l.next;else if((t=l)===c){o?1===o?Jo(t=es(Yo(t),e,i),e,i,r,n,a,2):2===o&&is(t,e,i,r,n,a):Jo(Yo(t),e,i,r,n,a,1);break}}}function Qo(t){var e=t.prev,i=t,r=t.next;if(hs(e,i,r)>=0)return!1;for(var n=e.x,a=i.x,o=r.x,s=e.y,l=i.y,c=r.y,h=n<a?n<o?n:o:a<o?a:o,u=s<l?s<c?s:c:l<c?l:c,p=n>a?n>o?n:o:a>o?a:o,d=s>l?s>c?s:c:l>c?l:c,m=r.next;m!==e;){if(m.x>=h&&m.x<=p&&m.y>=u&&m.y<=d&&ls(n,s,a,l,o,c,m.x,m.y)&&hs(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function ts(t,e,i,r){var n=t.prev,a=t,o=t.next;if(hs(n,a,o)>=0)return!1;for(var s=n.x,l=a.x,c=o.x,h=n.y,u=a.y,p=o.y,d=s<l?s<c?s:c:l<c?l:c,m=h<u?h<p?h:p:u<p?u:p,f=s>l?s>c?s:c:l>c?l:c,g=h>u?h>p?h:p:u>p?u:p,_=os(d,m,e,i,r),y=os(f,g,e,i,r),x=t.prevZ,v=t.nextZ;x&&x.z>=_&&v&&v.z<=y;){if(x.x>=d&&x.x<=f&&x.y>=m&&x.y<=g&&x!==n&&x!==o&&ls(s,h,l,u,c,p,x.x,x.y)&&hs(x.prev,x,x.next)>=0)return!1;if(x=x.prevZ,v.x>=d&&v.x<=f&&v.y>=m&&v.y<=g&&v!==n&&v!==o&&ls(s,h,l,u,c,p,v.x,v.y)&&hs(v.prev,v,v.next)>=0)return!1;v=v.nextZ}for(;x&&x.z>=_;){if(x.x>=d&&x.x<=f&&x.y>=m&&x.y<=g&&x!==n&&x!==o&&ls(s,h,l,u,c,p,x.x,x.y)&&hs(x.prev,x,x.next)>=0)return!1;x=x.prevZ}for(;v&&v.z<=y;){if(v.x>=d&&v.x<=f&&v.y>=m&&v.y<=g&&v!==n&&v!==o&&ls(s,h,l,u,c,p,v.x,v.y)&&hs(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}function es(t,e,i){var r=t;do{var n=r.prev,a=r.next.next;!us(n,a)&&ps(n,r,r.next,a)&&fs(n,a)&&fs(a,n)&&(e.push(n.i/i|0),e.push(r.i/i|0),e.push(a.i/i|0),ys(r),ys(r.next),r=t=a),r=r.next}while(r!==t);return Yo(r)}function is(t,e,i,r,n,a){var o=t;do{for(var s=o.next.next;s!==o.prev;){if(o.i!==s.i&&cs(o,s)){var l=gs(o,s);return o=Yo(o,o.next),l=Yo(l,l.next),Jo(o,e,i,r,n,a,0),void Jo(l,e,i,r,n,a,0)}s=s.next}o=o.next}while(o!==t)}function rs(t,e){return t.x-e.x}function ns(t,e){var i=function(t,e){var i,r=e,n=t.x,a=t.y,o=-1/0;do{if(a<=r.y&&a>=r.next.y&&r.next.y!==r.y){var s=r.x+(a-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(s<=n&&s>o&&(o=s,i=r.x<r.next.x?r:r.next,s===n))return i}r=r.next}while(r!==e);if(!i)return null;var l,c=i,h=i.x,u=i.y,p=1/0;r=i;do{n>=r.x&&r.x>=h&&n!==r.x&&ls(a<u?n:o,a,h,u,a<u?o:n,a,r.x,r.y)&&(l=Math.abs(a-r.y)/(n-r.x),fs(r,t)&&(l<p||l===p&&(r.x>i.x||r.x===i.x&&as(i,r)))&&(i=r,p=l)),r=r.next}while(r!==c);return i}(t,e);if(!i)return e;var r=gs(i,t);return Yo(r,r.next),Yo(i,i.next)}function as(t,e){return hs(t.prev,t,e.prev)<0&&hs(e.next,t,t.next)<0}function os(t,e,i,r,n){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-i)*n|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-r)*n|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function ss(t){var e=t,i=t;do{(e.x<i.x||e.x===i.x&&e.y<i.y)&&(i=e),e=e.next}while(e!==t);return i}function ls(t,e,i,r,n,a,o,s){return(n-o)*(e-s)>=(t-o)*(a-s)&&(t-o)*(r-s)>=(i-o)*(e-s)&&(i-o)*(a-s)>=(n-o)*(r-s)}function cs(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&ps(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&(fs(t,e)&&fs(e,t)&&function(t,e){var i=t,r=!1,n=(t.x+e.x)/2,a=(t.y+e.y)/2;do{i.y>a!=i.next.y>a&&i.next.y!==i.y&&n<(i.next.x-i.x)*(a-i.y)/(i.next.y-i.y)+i.x&&(r=!r),i=i.next}while(i!==t);return r}(t,e)&&(hs(t.prev,t,e.prev)||hs(t,e.prev,e))||us(t,e)&&hs(t.prev,t,t.next)>0&&hs(e.prev,e,e.next)>0)}function hs(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function us(t,e){return t.x===e.x&&t.y===e.y}function ps(t,e,i,r){var n=ms(hs(t,e,i)),a=ms(hs(t,e,r)),o=ms(hs(i,r,t)),s=ms(hs(i,r,e));return n!==a&&o!==s||!(0!==n||!ds(t,i,e))||!(0!==a||!ds(t,r,e))||!(0!==o||!ds(i,t,r))||!(0!==s||!ds(i,e,r))}function ds(t,e,i){return e.x<=Math.max(t.x,i.x)&&e.x>=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function ms(t){return t>0?1:t<0?-1:0}function fs(t,e){return hs(t.prev,t,t.next)<0?hs(t,e,t.next)>=0&&hs(t,t.prev,e)>=0:hs(t,e,t.prev)<0||hs(t,t.next,e)<0}function gs(t,e){var i=new xs(t.i,t.x,t.y),r=new xs(e.i,e.x,e.y),n=t.next,a=e.prev;return t.next=e,e.prev=t,i.next=n,n.prev=i,r.next=i,i.prev=r,a.next=r,r.prev=a,r}function _s(t,e,i,r){var n=new xs(t,e,i);return r?(n.next=r.next,n.prev=r,r.next.prev=n,r.next=n):(n.prev=n,n.next=n),n}function ys(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function xs(t,e,i){this.i=t,this.x=e,this.y=i,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function vs(t,e,i,r){for(var n=0,a=e,o=i-r;a<i;a+=r)n+=(t[o]-t[a])*(t[a+1]+t[o+1]),o=a;return n}Xo.exports=Wo,Xo.exports.default=Wo,Wo.deviation=function(t,e,i,r){var n=e&&e.length,a=Math.abs(vs(t,0,n?e[0]*i:t.length,i));if(n)for(var o=0,s=e.length;o<s;o++)a-=Math.abs(vs(t,e[o]*i,o<s-1?e[o+1]*i:t.length,i));var l=0;for(o=0;o<r.length;o+=3){var c=r[o]*i,h=r[o+1]*i,u=r[o+2]*i;l+=Math.abs((t[c]-t[u])*(t[h+1]-t[c+1])-(t[c]-t[h])*(t[u+1]-t[c+1]))}return 0===a&&0===l?0:Math.abs((l-a)/a)},Wo.flatten=function(t){for(var e=t[0][0].length,i={vertices:[],holes:[],dimensions:e},r=0,n=0;n<t.length;n++){for(var a=0;a<t[n].length;a++)for(var o=0;o<e;o++)i.vertices.push(t[n][a][o]);n>0&&i.holes.push(r+=t[n-1].length)}return i};var bs=e(Xo.exports);function ws(t,e,i,r,n){Es(t,e,i||0,r||t.length-1,n||Ss)}function Es(t,e,i,r,n){for(;r>i;){if(r-i>600){var a=r-i+1,o=e-i+1,s=Math.log(a),l=.5*Math.exp(2*s/3),c=.5*Math.sqrt(s*l*(a-l)/a)*(o-a/2<0?-1:1);Es(t,e,Math.max(i,Math.floor(e-o*l/a+c)),Math.min(r,Math.floor(e+(a-o)*l/a+c)),n)}var h=t[e],u=i,p=r;for(Ts(t,i,e),n(t[r],h)>0&&Ts(t,i,r);u<p;){for(Ts(t,u,p),u++,p--;n(t[u],h)<0;)u++;for(;n(t[p],h)>0;)p--}0===n(t[i],h)?Ts(t,i,p):Ts(t,++p,r),p<=e&&(i=p+1),e<=p&&(r=p-1)}}function Ts(t,e,i){var r=t[e];t[e]=t[i],t[i]=r}function Ss(t,e){return t<e?-1:t>e?1:0}function Cs(t,e){const i=t.length;if(i<=1)return[t];const r=[];let n,a;for(let e=0;e<i;e++){const i=T(t[e]);0!==i&&(t[e].area=Math.abs(i),void 0===a&&(a=i<0),a===i<0?(n&&r.push(n),n=[t[e]]):n.push(t[e]))}if(n&&r.push(n),e>1)for(let t=0;t<r.length;t++)r[t].length<=e||(ws(r[t],e,1,r[t].length-1,Is),r[t]=r[t].slice(0,e));return r}function Is(t,e){return e.area-t.area}function As(t,e,i){const r=i.patternDependencies;let n=!1;for(const i of e){const e=i.paint.get(`${t}-pattern`);e.isConstant()||(n=!0);const a=e.constantOr(null);a&&(n=!0,r[a.to]=!0,r[a.from]=!0)}return n}function Ms(t,e,i,r,n){const a=n.patternDependencies;for(const o of e){const e=o.paint.get(`${t}-pattern`).value;if("constant"!==e.kind){let t=e.evaluate({zoom:r-1},i,{},n.availableImages),s=e.evaluate({zoom:r},i,{},n.availableImages),l=e.evaluate({zoom:r+1},i,{},n.availableImages);t=t&&t.name?t.name:t,s=s&&s.name?s.name:s,l=l&&l.name?l.name:l,a[t]=!0,a[s]=!0,a[l]=!0,i.patterns[o.id]={min:t,mid:s,max:l}}}return i}class ks{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new da,this.indexArray=new Ea,this.indexArray2=new Ta,this.programConfigurations=new Ka(t.layers,t.zoom),this.segments=new Ia,this.segments2=new Ia,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id))}populate(t,e,i){this.hasPattern=As("fill",this.layers,e);const r=this.layers[0].layout.get("fill-sort-key"),n=!r.isConstant(),a=[];for(const{feature:o,id:s,index:l,sourceLayerIndex:c}of t){const t=this.layers[0]._featureFilter.needGeometry,h=ro(o,t);if(!this.layers[0]._featureFilter.filter(new ln(this.zoom),h,i))continue;const u=n?r.evaluate(h,{},i,e.availableImages):void 0,p={id:s,properties:o.properties,type:o.type,sourceLayerIndex:c,index:l,geometry:t?h.geometry:io(o),patterns:{},sortKey:u};a.push(p)}n&&a.sort(((t,e)=>t.sortKey-e.sortKey));for(const r of a){const{geometry:n,index:a,sourceLayerIndex:o}=r;if(this.hasPattern){const t=Ms("fill",this.layers,r,this.zoom,e);this.patternFeatures.push(t)}else this.addFeature(r,n,a,i,{});e.featureIndex.insert(t[a].feature,n,a,o,this.index)}}update(t,e,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,i)}addFeatures(t,e,i){for(const t of this.patternFeatures)this.addFeature(t,t.geometry,t.index,e,i)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Ho),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,e,i,r,n){for(const t of Cs(e,500)){let e=0;for(const i of t)e+=i.length;const i=this.segments.prepareSegment(e,this.layoutVertexArray,this.indexArray),r=i.vertexLength,n=[],a=[];for(const e of t){if(0===e.length)continue;e!==t[0]&&a.push(n.length/2);const i=this.segments2.prepareSegment(e.length,this.layoutVertexArray,this.indexArray2),r=i.vertexLength;this.layoutVertexArray.emplaceBack(e[0].x,e[0].y),this.indexArray2.emplaceBack(r+e.length-1,r),n.push(e[0].x),n.push(e[0].y);for(let t=1;t<e.length;t++)this.layoutVertexArray.emplaceBack(e[t].x,e[t].y),this.indexArray2.emplaceBack(r+t-1,r+t),n.push(e[t].x),n.push(e[t].y);i.vertexLength+=e.length,i.primitiveLength+=e.length}const o=bs(n,a);for(let t=0;t<o.length;t+=3)this.indexArray.emplaceBack(r+o[t],r+o[t+1],r+o[t+2]);i.vertexLength+=e,i.primitiveLength+=o.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,i,n,r)}}let Ps,zs;Rr("FillBucket",ks,{omit:["layers","patternFeatures"]});var Ls={get paint(){return zs=zs||new wn({"fill-antialias":new _n(W.paint_fill["fill-antialias"]),"fill-opacity":new yn(W.paint_fill["fill-opacity"]),"fill-color":new yn(W.paint_fill["fill-color"]),"fill-outline-color":new yn(W.paint_fill["fill-outline-color"]),"fill-translate":new _n(W.paint_fill["fill-translate"]),"fill-translate-anchor":new _n(W.paint_fill["fill-translate-anchor"]),"fill-pattern":new xn(W.paint_fill["fill-pattern"])})},get layout(){return Ps=Ps||new wn({"fill-sort-key":new yn(W.layout_fill["fill-sort-key"])})}};class Ds extends Tn{constructor(t){super(t,Ls)}recalculate(t,e){super.recalculate(t,e);const i=this.paint._values["fill-outline-color"];"constant"===i.value.kind&&void 0===i.value.value&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(t){return new ks(t)}queryRadius(){return xo(this.paint.get("fill-translate"))}queryIntersectsFeature(t,e,i,r,n,a,o){return lo(vo(t,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),a.angle,o),r)}isTileClipped(){return!0}}const Rs=An([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),Bs=An([{name:"a_centroid",components:2,type:"Int16"}],4),{members:Fs}=Rs;var Os={},Us=i,Vs=Ns;function Ns(t,e,i,r,n){this.properties={},this.extent=i,this.type=0,this._pbf=t,this._geometry=-1,this._keys=r,this._values=n,t.readFields($s,this,e)}function $s(t,e,i){1==t?e.id=i.readVarint():2==t?function(t,e){for(var i=t.readVarint()+t.pos;t.pos<i;){var r=e._keys[t.readVarint()],n=e._values[t.readVarint()];e.properties[r]=n}}(i,e):3==t?e.type=i.readVarint():4==t&&(e._geometry=i.pos)}function js(t){for(var e,i,r=0,n=0,a=t.length,o=a-1;n<a;o=n++)r+=((i=t[o]).x-(e=t[n]).x)*(e.y+i.y);return r}Ns.types=["Unknown","Point","LineString","Polygon"],Ns.prototype.loadGeometry=function(){var t=this._pbf;t.pos=this._geometry;for(var e,i=t.readVarint()+t.pos,r=1,n=0,a=0,o=0,s=[];t.pos<i;){if(n<=0){var l=t.readVarint();r=7&l,n=l>>3}if(n--,1===r||2===r)a+=t.readSVarint(),o+=t.readSVarint(),1===r&&(e&&s.push(e),e=[]),e.push(new Us(a,o));else{if(7!==r)throw new Error("unknown command "+r);e&&e.push(e[0].clone())}}return e&&s.push(e),s},Ns.prototype.bbox=function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,i=1,r=0,n=0,a=0,o=1/0,s=-1/0,l=1/0,c=-1/0;t.pos<e;){if(r<=0){var h=t.readVarint();i=7&h,r=h>>3}if(r--,1===i||2===i)(n+=t.readSVarint())<o&&(o=n),n>s&&(s=n),(a+=t.readSVarint())<l&&(l=a),a>c&&(c=a);else if(7!==i)throw new Error("unknown command "+i)}return[o,l,s,c]},Ns.prototype.toGeoJSON=function(t,e,i){var r,n,a=this.extent*Math.pow(2,i),o=this.extent*t,s=this.extent*e,l=this.loadGeometry(),c=Ns.types[this.type];function h(t){for(var e=0;e<t.length;e++){var i=t[e];t[e]=[360*(i.x+o)/a-180,360/Math.PI*Math.atan(Math.exp((180-360*(i.y+s)/a)*Math.PI/180))-90]}}switch(this.type){case 1:var u=[];for(r=0;r<l.length;r++)u[r]=l[r][0];h(l=u);break;case 2:for(r=0;r<l.length;r++)h(l[r]);break;case 3:for(l=function(t){var e=t.length;if(e<=1)return[t];for(var i,r,n=[],a=0;a<e;a++){var o=js(t[a]);0!==o&&(void 0===r&&(r=o<0),r===o<0?(i&&n.push(i),i=[t[a]]):i.push(t[a]))}return i&&n.push(i),n}(l),r=0;r<l.length;r++)for(n=0;n<l[r].length;n++)h(l[r][n])}1===l.length?l=l[0]:c="Multi"+c;var p={type:"Feature",geometry:{type:c,coordinates:l},properties:this.properties};return"id"in this&&(p.id=this.id),p};var qs=Vs,Zs=Gs;function Gs(t,e){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(Hs,this,e),this.length=this._features.length}function Hs(t,e,i){15===t?e.version=i.readVarint():1===t?e.name=i.readString():5===t?e.extent=i.readVarint():2===t?e._features.push(i.pos):3===t?e._keys.push(i.readString()):4===t&&e._values.push(function(t){for(var e=null,i=t.readVarint()+t.pos;t.pos<i;){var r=t.readVarint()>>3;e=1===r?t.readString():2===r?t.readFloat():3===r?t.readDouble():4===r?t.readVarint64():5===r?t.readVarint():6===r?t.readSVarint():7===r?t.readBoolean():null}return e}(i))}Gs.prototype.feature=function(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];var e=this._pbf.readVarint()+this._pbf.pos;return new qs(this._pbf,e,this.extent,this._keys,this._values)};var Xs=Zs;function Ws(t,e,i){if(3===t){var r=new Xs(i,i.readVarint()+i.pos);r.length&&(e[r.name]=r)}}Os.VectorTile=function(t,e){this.layers=t.readFields(Ws,{},e)},Os.VectorTileFeature=Vs,Os.VectorTileLayer=Zs;const Ks=Os.VectorTileFeature.types,Ys=Math.pow(2,13);function Js(t,e,i,r,n,a,o,s){t.emplaceBack(e,i,2*Math.floor(r*Ys)+o,n*Ys*2,a*Ys*2,Math.round(s))}class Qs{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new ma,this.centroidVertexArray=new ua,this.indexArray=new Ea,this.programConfigurations=new Ka(t.layers,t.zoom),this.segments=new Ia,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id))}populate(t,e,i){this.features=[],this.hasPattern=As("fill-extrusion",this.layers,e);for(const{feature:r,id:n,index:a,sourceLayerIndex:o}of t){const t=this.layers[0]._featureFilter.needGeometry,s=ro(r,t);if(!this.layers[0]._featureFilter.filter(new ln(this.zoom),s,i))continue;const l={id:n,sourceLayerIndex:o,index:a,geometry:t?s.geometry:io(r),properties:r.properties,type:r.type,patterns:{}};this.hasPattern?this.features.push(Ms("fill-extrusion",this.layers,l,this.zoom,e)):this.addFeature(l,l.geometry,a,i,{}),e.featureIndex.insert(r,l.geometry,a,o,this.index,!0)}}addFeatures(t,e,i){for(const t of this.features){const{geometry:r}=t;this.addFeature(t,r,t.index,e,i)}}update(t,e,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,i)}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.centroidVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Fs),this.centroidVertexBuffer=t.createVertexBuffer(this.centroidVertexArray,Bs.members,!0),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(),this.centroidVertexBuffer.destroy())}addFeature(t,e,i,r,n){const a={x:0,y:0,vertexCount:0};for(const i of Cs(e,500)){let e=0;for(const t of i)e+=t.length;let r=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const t of i){if(0===t.length)continue;if(el(t))continue;let e=0;for(let i=0;i<t.length;i++){const n=t[i];if(i>=1){const o=t[i-1];if(!tl(n,o)){r.vertexLength+4>Ia.MAX_VERTEX_ARRAY_LENGTH&&(r=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const t=n.sub(o)._perp()._unit(),i=o.dist(n);e+i>32768&&(e=0),Js(this.layoutVertexArray,n.x,n.y,t.x,t.y,0,0,e),Js(this.layoutVertexArray,n.x,n.y,t.x,t.y,0,1,e),a.x+=2*n.x,a.y+=2*n.y,a.vertexCount+=2,e+=i,Js(this.layoutVertexArray,o.x,o.y,t.x,t.y,0,0,e),Js(this.layoutVertexArray,o.x,o.y,t.x,t.y,0,1,e),a.x+=2*o.x,a.y+=2*o.y,a.vertexCount+=2;const s=r.vertexLength;this.indexArray.emplaceBack(s,s+2,s+1),this.indexArray.emplaceBack(s+1,s+2,s+3),r.vertexLength+=4,r.primitiveLength+=2}}}}if(r.vertexLength+e>Ia.MAX_VERTEX_ARRAY_LENGTH&&(r=this.segments.prepareSegment(e,this.layoutVertexArray,this.indexArray)),"Polygon"!==Ks[t.type])continue;const n=[],o=[],s=r.vertexLength;for(const t of i)if(0!==t.length){t!==i[0]&&o.push(n.length/2);for(let e=0;e<t.length;e++){const i=t[e];Js(this.layoutVertexArray,i.x,i.y,0,0,1,1,0),a.x+=i.x,a.y+=i.y,a.vertexCount+=1,n.push(i.x),n.push(i.y)}}const l=bs(n,o);for(let t=0;t<l.length;t+=3)this.indexArray.emplaceBack(s+l[t],s+l[t+2],s+l[t+1]);r.primitiveLength+=l.length/3,r.vertexLength+=e}for(let t=0;t<a.vertexCount;t++)this.centroidVertexArray.emplaceBack(Math.floor(a.x/a.vertexCount),Math.floor(a.y/a.vertexCount));this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,i,n,r)}}function tl(t,e){return t.x===e.x&&(t.x<0||t.x>Qa)||t.y===e.y&&(t.y<0||t.y>Qa)}function el(t){return t.every((t=>t.x<0))||t.every((t=>t.x>Qa))||t.every((t=>t.y<0))||t.every((t=>t.y>Qa))}let il;Rr("FillExtrusionBucket",Qs,{omit:["layers","features"]});var rl={get paint(){return il=il||new wn({"fill-extrusion-opacity":new _n(W["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new yn(W["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new _n(W["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new _n(W["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new xn(W["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new yn(W["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new yn(W["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new _n(W["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class nl extends Tn{constructor(t){super(t,rl)}createBucket(t){return new Qs(t)}queryRadius(){return xo(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(t,e,i,r,a,o,s,l){const c=vo(t,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),o.angle,s),h=this.paint.get("fill-extrusion-height").evaluate(e,i),u=this.paint.get("fill-extrusion-base").evaluate(e,i),p=function(t,e,i,r){const a=[];for(const i of t){const t=[i.x,i.y,0,1];ko(t,t,e),a.push(new n(t[0]/t[3],t[1]/t[3]))}return a}(c,l),d=function(t,e,i,r){const a=[],o=[],s=r[8]*e,l=r[9]*e,c=r[10]*e,h=r[11]*e,u=r[8]*i,p=r[9]*i,d=r[10]*i,m=r[11]*i;for(const e of t){const t=[],i=[];for(const a of e){const e=a.x,o=a.y,f=r[0]*e+r[4]*o+r[12],g=r[1]*e+r[5]*o+r[13],_=r[2]*e+r[6]*o+r[14],y=r[3]*e+r[7]*o+r[15],x=_+c,v=y+h,b=f+u,w=g+p,E=_+d,T=y+m,S=new n((f+s)/v,(g+l)/v);S.z=x/v,t.push(S);const C=new n(b/T,w/T);C.z=E/T,i.push(C)}a.push(t),o.push(i)}return[a,o]}(r,u,h,l);return function(t,e,i){let r=1/0;lo(i,e)&&(r=ol(i,e[0]));for(let n=0;n<e.length;n++){const a=e[n],o=t[n];for(let t=0;t<a.length-1;t++){const e=a[t],n=[e,a[t+1],o[t+1],o[t],e];oo(i,n)&&(r=Math.min(r,ol(i,n)))}}return r!==1/0&&r}(d[0],d[1],p)}}function al(t,e){return t.x*e.x+t.y*e.y}function ol(t,e){if(1===t.length){let i=0;const r=e[i++];let n;for(;!n||r.equals(n);)if(n=e[i++],!n)return 1/0;for(;i<e.length;i++){const a=e[i],o=t[0],s=n.sub(r),l=a.sub(r),c=o.sub(r),h=al(s,s),u=al(s,l),p=al(l,l),d=al(c,s),m=al(c,l),f=h*p-u*u,g=(p*d-u*m)/f,_=(h*m-u*d)/f,y=r.z*(1-g-_)+n.z*g+a.z*_;if(isFinite(y))return y}return 1/0}{let t=1/0;for(const i of e)t=Math.min(t,i.z);return t}}const sl=An([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:ll}=sl,cl=An([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:hl}=cl,ul=Os.VectorTileFeature.types,pl=Math.cos(Math.PI/180*37.5),dl=Math.pow(2,14)/.5;class ml{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach((t=>{this.gradients[t.id]={}})),this.layoutVertexArray=new fa,this.layoutVertexArray2=new ga,this.indexArray=new Ea,this.programConfigurations=new Ka(t.layers,t.zoom),this.segments=new Ia,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id))}populate(t,e,i){this.hasPattern=As("line",this.layers,e);const r=this.layers[0].layout.get("line-sort-key"),n=!r.isConstant(),a=[];for(const{feature:e,id:o,index:s,sourceLayerIndex:l}of t){const t=this.layers[0]._featureFilter.needGeometry,c=ro(e,t);if(!this.layers[0]._featureFilter.filter(new ln(this.zoom),c,i))continue;const h=n?r.evaluate(c,{},i):void 0,u={id:o,properties:e.properties,type:e.type,sourceLayerIndex:l,index:s,geometry:t?c.geometry:io(e),patterns:{},sortKey:h};a.push(u)}n&&a.sort(((t,e)=>t.sortKey-e.sortKey));for(const r of a){const{geometry:n,index:a,sourceLayerIndex:o}=r;if(this.hasPattern){const t=Ms("line",this.layers,r,this.zoom,e);this.patternFeatures.push(t)}else this.addFeature(r,n,a,i,{});e.featureIndex.insert(t[a].feature,n,a,o,this.index)}}update(t,e,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,i)}addFeatures(t,e,i){for(const t of this.patternFeatures)this.addFeature(t,t.geometry,t.index,e,i)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(0!==this.layoutVertexArray2.length&&(this.layoutVertexBuffer2=t.createVertexBuffer(this.layoutVertexArray2,hl)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,ll),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,e,i,r,n){const a=this.layers[0].layout,o=a.get("line-join").evaluate(t,{}),s=a.get("line-cap"),l=a.get("line-miter-limit"),c=a.get("line-round-limit");this.lineClips=this.lineFeatureClips(t);for(const i of e)this.addLine(i,t,o,s,l,c);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,i,n,r)}addLine(t,e,i,r,n,a){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let e=0;e<t.length-1;e++)this.totalDistance+=t[e].dist(t[e+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const o="Polygon"===ul[e.type];let s=t.length;for(;s>=2&&t[s-1].equals(t[s-2]);)s--;let l=0;for(;l<s-1&&t[l].equals(t[l+1]);)l++;if(s<(o?3:2))return;"bevel"===i&&(n=1.05);const c=this.overscaling<=16?15*Qa/(512*this.overscaling):0,h=this.segments.prepareSegment(10*s,this.layoutVertexArray,this.indexArray);let u,p,d,m,f;this.e1=this.e2=-1,o&&(u=t[s-2],f=t[l].sub(u)._unit()._perp());for(let e=l;e<s;e++){if(d=e===s-1?o?t[l+1]:void 0:t[e+1],d&&t[e].equals(d))continue;f&&(m=f),u&&(p=u),u=t[e],f=d?d.sub(u)._unit()._perp():m,m=m||f;let g=m.add(f);0===g.x&&0===g.y||g._unit();const _=m.x*f.x+m.y*f.y,y=g.x*f.x+g.y*f.y,x=0!==y?1/y:1/0,v=2*Math.sqrt(2-2*y),b=y<pl&&p&&d,w=m.x*f.y-m.y*f.x>0;if(b&&e>l){const t=u.dist(p);if(t>2*c){const e=u.sub(u.sub(p)._mult(c/t)._round());this.updateDistance(p,e),this.addCurrentVertex(e,m,0,0,h),p=e}}const E=p&&d;let T=E?i:o?"butt":r;if(E&&"round"===T&&(x<a?T="miter":x<=2&&(T="fakeround")),"miter"===T&&x>n&&(T="bevel"),"bevel"===T&&(x>2&&(T="flipbevel"),x<n&&(T="miter")),p&&this.updateDistance(p,u),"miter"===T)g._mult(x),this.addCurrentVertex(u,g,0,0,h);else if("flipbevel"===T){if(x>100)g=f.mult(-1);else{const t=x*m.add(f).mag()/m.sub(f).mag();g._perp()._mult(t*(w?-1:1))}this.addCurrentVertex(u,g,0,0,h),this.addCurrentVertex(u,g.mult(-1),0,0,h)}else if("bevel"===T||"fakeround"===T){const t=-Math.sqrt(x*x-1),e=w?t:0,i=w?0:t;if(p&&this.addCurrentVertex(u,m,e,i,h),"fakeround"===T){const t=Math.round(180*v/Math.PI/20);for(let e=1;e<t;e++){let i=e/t;if(.5!==i){const t=i-.5;i+=i*t*(i-1)*((1.0904+_*(_*(3.55645-1.43519*_)-3.2452))*t*t+(.848013+_*(.215638*_-1.06021)))}const r=f.sub(m)._mult(i)._add(m)._unit()._mult(w?-1:1);this.addHalfVertex(u,r.x,r.y,!1,w,0,h)}}d&&this.addCurrentVertex(u,f,-e,-i,h)}else if("butt"===T)this.addCurrentVertex(u,g,0,0,h);else if("square"===T){const t=p?1:-1;this.addCurrentVertex(u,g,t,t,h)}else"round"===T&&(p&&(this.addCurrentVertex(u,m,0,0,h),this.addCurrentVertex(u,m,1,1,h,!0)),d&&(this.addCurrentVertex(u,f,-1,-1,h,!0),this.addCurrentVertex(u,f,0,0,h)));if(b&&e<s-1){const t=u.dist(d);if(t>2*c){const e=u.add(d.sub(u)._mult(c/t)._round());this.updateDistance(u,e),this.addCurrentVertex(e,f,0,0,h),u=e}}}}addCurrentVertex(t,e,i,r,n,a=!1){const o=e.y*r-e.x,s=-e.y-e.x*r;this.addHalfVertex(t,e.x+e.y*i,e.y-e.x*i,a,!1,i,n),this.addHalfVertex(t,o,s,a,!0,-r,n),this.distance>dl/2&&0===this.totalDistance&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(t,e,i,r,n,a))}addHalfVertex({x:t,y:e},i,r,n,a,o,s){const l=.5*(this.lineClips?this.scaledDistance*(dl-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((t<<1)+(n?1:0),(e<<1)+(a?1:0),Math.round(63*i)+128,Math.round(63*r)+128,1+(0===o?0:o<0?-1:1)|(63&l)<<2,l>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const c=s.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,c),s.primitiveLength++),a?this.e2=c:this.e1=c}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(t,e){this.distance+=t.dist(e),this.updateScaledDistance()}}let fl,gl;Rr("LineBucket",ml,{omit:["layers","patternFeatures"]});var _l={get paint(){return gl=gl||new wn({"line-opacity":new yn(W.paint_line["line-opacity"]),"line-color":new yn(W.paint_line["line-color"]),"line-translate":new _n(W.paint_line["line-translate"]),"line-translate-anchor":new _n(W.paint_line["line-translate-anchor"]),"line-width":new yn(W.paint_line["line-width"]),"line-gap-width":new yn(W.paint_line["line-gap-width"]),"line-offset":new yn(W.paint_line["line-offset"]),"line-blur":new yn(W.paint_line["line-blur"]),"line-dasharray":new vn(W.paint_line["line-dasharray"]),"line-pattern":new xn(W.paint_line["line-pattern"]),"line-gradient":new bn(W.paint_line["line-gradient"])})},get layout(){return fl=fl||new wn({"line-cap":new _n(W.layout_line["line-cap"]),"line-join":new yn(W.layout_line["line-join"]),"line-miter-limit":new _n(W.layout_line["line-miter-limit"]),"line-round-limit":new _n(W.layout_line["line-round-limit"]),"line-sort-key":new yn(W.layout_line["line-sort-key"])})}};class yl extends yn{possiblyEvaluate(t,e){return e=new ln(Math.floor(e.zoom),{now:e.now,fadeDuration:e.fadeDuration,zoomHistory:e.zoomHistory,transition:e.transition}),super.possiblyEvaluate(t,e)}evaluate(t,e,i,r){return e=g({},e,{zoom:Math.floor(e.zoom)}),super.evaluate(t,e,i,r)}}let xl;class vl extends Tn{constructor(t){super(t,_l),this.gradientVersion=0,xl||(xl=new yl(_l.paint.properties["line-width"].specification),xl.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(t){if("line-gradient"===t){const t=this.gradientExpression();this.stepInterpolant=!!function(t){return void 0!==t._styleExpression}(t)&&t._styleExpression.expression instanceof $e,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(t,e){super.recalculate(t,e),this.paint._values["line-floorwidth"]=xl.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,t)}createBucket(t){return new ml(t)}queryRadius(t){const e=t,i=bl(yo("line-width",this,e),yo("line-gap-width",this,e)),r=yo("line-offset",this,e);return i/2+Math.abs(r)+xo(this.paint.get("line-translate"))}queryIntersectsFeature(t,e,i,r,a,o,s){const l=vo(t,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),o.angle,s),c=s/2*bl(this.paint.get("line-width").evaluate(e,i),this.paint.get("line-gap-width").evaluate(e,i)),h=this.paint.get("line-offset").evaluate(e,i);return h&&(r=function(t,e){const i=[];for(let r=0;r<t.length;r++){const a=t[r],o=[];for(let t=0;t<a.length;t++){const i=a[t-1],r=a[t],s=a[t+1],l=0===t?new n(0,0):r.sub(i)._unit()._perp(),c=t===a.length-1?new n(0,0):s.sub(r)._unit()._perp(),h=l._add(c)._unit(),u=h.x*c.x+h.y*c.y;0!==u&&h._mult(1/u),o.push(h._mult(e)._add(r))}i.push(o)}return i}(r,h*s)),function(t,e,i){for(let r=0;r<e.length;r++){const n=e[r];if(t.length>=3)for(let e=0;e<n.length;e++)if(go(t,n[e]))return!0;if(co(t,n,i))return!0}return!1}(l,r,c)}isTileClipped(){return!0}}function bl(t,e){return e>0?e+2*t:t}const wl=An([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),El=An([{name:"a_projected_pos",components:3,type:"Float32"}],4);An([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const Tl=An([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]);An([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);const Sl=An([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),Cl=An([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function Il(t,e,i){return t.sections.forEach((t=>{t.text=function(t,e,i){const r=e.layout.get("text-transform").evaluate(i,{});return"uppercase"===r?t=t.toLocaleUpperCase():"lowercase"===r&&(t=t.toLocaleLowerCase()),sn.applyArabicShaping&&(t=sn.applyArabicShaping(t)),t}(t.text,e,i)})),t}An([{name:"triangle",components:3,type:"Uint16"}]),An([{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"}]),An([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Uint16",name:"textAnchorOffsetStartIndex"},{type:"Uint16",name:"textAnchorOffsetEndIndex"}]),An([{type:"Float32",name:"offsetX"}]),An([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),An([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const Al={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var Ml=24,kl=Ll,Pl=function(t,e,i,r,n){var a,o,s=8*n-r-1,l=(1<<s)-1,c=l>>1,h=-7,u=i?n-1:0,p=i?-1:1,d=t[e+u];for(u+=p,a=d&(1<<-h)-1,d>>=-h,h+=s;h>0;a=256*a+t[e+u],u+=p,h-=8);for(o=a&(1<<-h)-1,a>>=-h,h+=r;h>0;o=256*o+t[e+u],u+=p,h-=8);if(0===a)a=1-c;else{if(a===l)return o?NaN:1/0*(d?-1:1);o+=Math.pow(2,r),a-=c}return(d?-1:1)*o*Math.pow(2,a-r)},zl=function(t,e,i,r,n,a){var o,s,l,c=8*a-n-1,h=(1<<c)-1,u=h>>1,p=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:a-1,m=r?1:-1,f=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,o=h):(o=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-o))<1&&(o--,l*=2),(e+=o+u>=1?p/l:p*Math.pow(2,1-u))*l>=2&&(o++,l/=2),o+u>=h?(s=0,o=h):o+u>=1?(s=(e*l-1)*Math.pow(2,n),o+=u):(s=e*Math.pow(2,u-1)*Math.pow(2,n),o=0));n>=8;t[i+d]=255&s,d+=m,s/=256,n-=8);for(o=o<<n|s,c+=n;c>0;t[i+d]=255&o,d+=m,o/=256,c-=8);t[i+d-m]|=128*f};function Ll(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}Ll.Varint=0,Ll.Fixed64=1,Ll.Bytes=2,Ll.Fixed32=5;var Dl=4294967296,Rl=1/Dl,Bl="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function Fl(t){return t.type===Ll.Bytes?t.readVarint()+t.pos:t.pos+1}function Ol(t,e,i){return i?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function Ul(t,e,i){var r=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));i.realloc(r);for(var n=i.pos-1;n>=t;n--)i.buf[n+r]=i.buf[n]}function Vl(t,e){for(var i=0;i<t.length;i++)e.writeVarint(t[i])}function Nl(t,e){for(var i=0;i<t.length;i++)e.writeSVarint(t[i])}function $l(t,e){for(var i=0;i<t.length;i++)e.writeFloat(t[i])}function jl(t,e){for(var i=0;i<t.length;i++)e.writeDouble(t[i])}function ql(t,e){for(var i=0;i<t.length;i++)e.writeBoolean(t[i])}function Zl(t,e){for(var i=0;i<t.length;i++)e.writeFixed32(t[i])}function Gl(t,e){for(var i=0;i<t.length;i++)e.writeSFixed32(t[i])}function Hl(t,e){for(var i=0;i<t.length;i++)e.writeFixed64(t[i])}function Xl(t,e){for(var i=0;i<t.length;i++)e.writeSFixed64(t[i])}function Wl(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+16777216*t[e+3]}function Kl(t,e,i){t[i]=e,t[i+1]=e>>>8,t[i+2]=e>>>16,t[i+3]=e>>>24}function Yl(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}Ll.prototype={destroy:function(){this.buf=null},readFields:function(t,e,i){for(i=i||this.length;this.pos<i;){var r=this.readVarint(),n=r>>3,a=this.pos;this.type=7&r,t(n,e,this),this.pos===a&&this.skip(r)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=Wl(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=Yl(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=Wl(this.buf,this.pos)+Wl(this.buf,this.pos+4)*Dl;return this.pos+=8,t},readSFixed64:function(){var t=Wl(this.buf,this.pos)+Yl(this.buf,this.pos+4)*Dl;return this.pos+=8,t},readFloat:function(){var t=Pl(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=Pl(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e,i,r=this.buf;return e=127&(i=r[this.pos++]),i<128?e:(e|=(127&(i=r[this.pos++]))<<7,i<128?e:(e|=(127&(i=r[this.pos++]))<<14,i<128?e:(e|=(127&(i=r[this.pos++]))<<21,i<128?e:function(t,e,i){var r,n,a=i.buf;if(r=(112&(n=a[i.pos++]))>>4,n<128)return Ol(t,r,e);if(r|=(127&(n=a[i.pos++]))<<3,n<128)return Ol(t,r,e);if(r|=(127&(n=a[i.pos++]))<<10,n<128)return Ol(t,r,e);if(r|=(127&(n=a[i.pos++]))<<17,n<128)return Ol(t,r,e);if(r|=(127&(n=a[i.pos++]))<<24,n<128)return Ol(t,r,e);if(r|=(1&(n=a[i.pos++]))<<31,n<128)return Ol(t,r,e);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(i=r[this.pos]))<<28,t,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2==1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&Bl?function(t,e,i){return Bl.decode(t.subarray(e,i))}(this.buf,e,t):function(t,e,i){for(var r="",n=e;n<i;){var a,o,s,l=t[n],c=null,h=l>239?4:l>223?3:l>191?2:1;if(n+h>i)break;1===h?l<128&&(c=l):2===h?128==(192&(a=t[n+1]))&&(c=(31&l)<<6|63&a)<=127&&(c=null):3===h?(o=t[n+2],128==(192&(a=t[n+1]))&&128==(192&o)&&((c=(15&l)<<12|(63&a)<<6|63&o)<=2047||c>=55296&&c<=57343)&&(c=null)):4===h&&(o=t[n+2],s=t[n+3],128==(192&(a=t[n+1]))&&128==(192&o)&&128==(192&s)&&((c=(15&l)<<18|(63&a)<<12|(63&o)<<6|63&s)<=65535||c>=1114112)&&(c=null)),null===c?(c=65533,h=1):c>65535&&(c-=65536,r+=String.fromCharCode(c>>>10&1023|55296),c=56320|1023&c),r+=String.fromCharCode(c),n+=h}return r}(this.buf,e,t)},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,e){if(this.type!==Ll.Bytes)return t.push(this.readVarint(e));var i=Fl(this);for(t=t||[];this.pos<i;)t.push(this.readVarint(e));return t},readPackedSVarint:function(t){if(this.type!==Ll.Bytes)return t.push(this.readSVarint());var e=Fl(this);for(t=t||[];this.pos<e;)t.push(this.readSVarint());return t},readPackedBoolean:function(t){if(this.type!==Ll.Bytes)return t.push(this.readBoolean());var e=Fl(this);for(t=t||[];this.pos<e;)t.push(this.readBoolean());return t},readPackedFloat:function(t){if(this.type!==Ll.Bytes)return t.push(this.readFloat());var e=Fl(this);for(t=t||[];this.pos<e;)t.push(this.readFloat());return t},readPackedDouble:function(t){if(this.type!==Ll.Bytes)return t.push(this.readDouble());var e=Fl(this);for(t=t||[];this.pos<e;)t.push(this.readDouble());return t},readPackedFixed32:function(t){if(this.type!==Ll.Bytes)return t.push(this.readFixed32());var e=Fl(this);for(t=t||[];this.pos<e;)t.push(this.readFixed32());return t},readPackedSFixed32:function(t){if(this.type!==Ll.Bytes)return t.push(this.readSFixed32());var e=Fl(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed32());return t},readPackedFixed64:function(t){if(this.type!==Ll.Bytes)return t.push(this.readFixed64());var e=Fl(this);for(t=t||[];this.pos<e;)t.push(this.readFixed64());return t},readPackedSFixed64:function(t){if(this.type!==Ll.Bytes)return t.push(this.readSFixed64());var e=Fl(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed64());return t},skip:function(t){var e=7&t;if(e===Ll.Varint)for(;this.buf[this.pos++]>127;);else if(e===Ll.Bytes)this.pos=this.readVarint()+this.pos;else if(e===Ll.Fixed32)this.pos+=4;else{if(e!==Ll.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e<this.pos+t;)e*=2;if(e!==this.length){var i=new Uint8Array(e);i.set(this.buf),this.buf=i,this.length=e}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(t){this.realloc(4),Kl(this.buf,t,this.pos),this.pos+=4},writeSFixed32:function(t){this.realloc(4),Kl(this.buf,t,this.pos),this.pos+=4},writeFixed64:function(t){this.realloc(8),Kl(this.buf,-1&t,this.pos),Kl(this.buf,Math.floor(t*Rl),this.pos+4),this.pos+=8},writeSFixed64:function(t){this.realloc(8),Kl(this.buf,-1&t,this.pos),Kl(this.buf,Math.floor(t*Rl),this.pos+4),this.pos+=8},writeVarint:function(t){(t=+t||0)>268435455||t<0?function(t,e){var i,r;if(t>=0?(i=t%4294967296|0,r=t/4294967296|0):(r=~(-t/4294967296),4294967295^(i=~(-t%4294967296))?i=i+1|0:(i=0,r=r+1|0)),t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),function(t,e,i){i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,i.buf[i.pos]=127&(t>>>=7)}(i,0,e),function(t,e){var i=(7&t)<<4;e.buf[e.pos++]|=i|((t>>>=3)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t)))))}(r,e)}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))},writeSVarint:function(t){this.writeVarint(t<0?2*-t-1:2*t)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t),this.realloc(4*t.length),this.pos++;var e=this.pos;this.pos=function(t,e,i){for(var r,n,a=0;a<e.length;a++){if((r=e.charCodeAt(a))>55295&&r<57344){if(!n){r>56319||a+1===e.length?(t[i++]=239,t[i++]=191,t[i++]=189):n=r;continue}if(r<56320){t[i++]=239,t[i++]=191,t[i++]=189,n=r;continue}r=n-55296<<10|r-56320|65536,n=null}else n&&(t[i++]=239,t[i++]=191,t[i++]=189,n=null);r<128?t[i++]=r:(r<2048?t[i++]=r>>6|192:(r<65536?t[i++]=r>>12|224:(t[i++]=r>>18|240,t[i++]=r>>12&63|128),t[i++]=r>>6&63|128),t[i++]=63&r|128)}return i}(this.buf,t,this.pos);var i=this.pos-e;i>=128&&Ul(e,i,this),this.pos=e-1,this.writeVarint(i),this.pos+=i},writeFloat:function(t){this.realloc(4),zl(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),zl(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var i=0;i<e;i++)this.buf[this.pos++]=t[i]},writeRawMessage:function(t,e){this.pos++;var i=this.pos;t(e,this);var r=this.pos-i;r>=128&&Ul(i,r,this),this.pos=i-1,this.writeVarint(r),this.pos+=r},writeMessage:function(t,e,i){this.writeTag(t,Ll.Bytes),this.writeRawMessage(e,i)},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,Vl,e)},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,Nl,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,ql,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,$l,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,jl,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,Zl,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,Gl,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,Hl,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,Xl,e)},writeBytesField:function(t,e){this.writeTag(t,Ll.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,Ll.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,Ll.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,Ll.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,Ll.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,Ll.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,Ll.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,Ll.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,Ll.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,Ll.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}};var Jl=e(kl);const Ql=3;function tc(t,e,i){1===t&&i.readMessage(ec,e)}function ec(t,e,i){if(3===t){const{id:t,bitmap:r,width:n,height:a,left:o,top:s,advance:l}=i.readMessage(ic,{});e.push({id:t,bitmap:new Uo({width:n+2*Ql,height:a+2*Ql},r),metrics:{width:n,height:a,left:o,top:s,advance:l}})}}function ic(t,e,i){1===t?e.id=i.readVarint():2===t?e.bitmap=i.readBytes():3===t?e.width=i.readVarint():4===t?e.height=i.readVarint():5===t?e.left=i.readSVarint():6===t?e.top=i.readSVarint():7===t&&(e.advance=i.readVarint())}const rc=Ql;function nc(t){let e=0,i=0;for(const r of t)e+=r.w*r.h,i=Math.max(i,r.w);t.sort(((t,e)=>e.h-t.h));const r=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),i),h:1/0}];let n=0,a=0;for(const e of t)for(let t=r.length-1;t>=0;t--){const i=r[t];if(!(e.w>i.w||e.h>i.h)){if(e.x=i.x,e.y=i.y,a=Math.max(a,e.y+e.h),n=Math.max(n,e.x+e.w),e.w===i.w&&e.h===i.h){const e=r.pop();t<r.length&&(r[t]=e)}else e.h===i.h?(i.x+=e.w,i.w-=e.w):e.w===i.w?(i.y+=e.h,i.h-=e.h):(r.push({x:i.x+e.w,y:i.y,w:i.w-e.w,h:e.h}),i.y+=e.h,i.h-=e.h);break}}return{w:n,h:a,fill:e/(n*a)||0}}const ac=1;class oc{constructor(t,{pixelRatio:e,version:i,stretchX:r,stretchY:n,content:a}){this.paddedRect=t,this.pixelRatio=e,this.stretchX=r,this.stretchY=n,this.content=a,this.version=i}get tl(){return[this.paddedRect.x+ac,this.paddedRect.y+ac]}get br(){return[this.paddedRect.x+this.paddedRect.w-ac,this.paddedRect.y+this.paddedRect.h-ac]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2*ac)/this.pixelRatio,(this.paddedRect.h-2*ac)/this.pixelRatio]}}class sc{constructor(t,e){const i={},r={};this.haveRenderCallbacks=[];const n=[];this.addImages(t,i,n),this.addImages(e,r,n);const{w:a,h:o}=nc(n),s=new Vo({width:a||1,height:o||1});for(const e in t){const r=t[e],n=i[e].paddedRect;Vo.copy(r.data,s,{x:0,y:0},{x:n.x+ac,y:n.y+ac},r.data)}for(const t in e){const i=e[t],n=r[t].paddedRect,a=n.x+ac,o=n.y+ac,l=i.data.width,c=i.data.height;Vo.copy(i.data,s,{x:0,y:0},{x:a,y:o},i.data),Vo.copy(i.data,s,{x:0,y:c-1},{x:a,y:o-1},{width:l,height:1}),Vo.copy(i.data,s,{x:0,y:0},{x:a,y:o+c},{width:l,height:1}),Vo.copy(i.data,s,{x:l-1,y:0},{x:a-1,y:o},{width:1,height:c}),Vo.copy(i.data,s,{x:0,y:0},{x:a+l,y:o},{width:1,height:c})}this.image=s,this.iconPositions=i,this.patternPositions=r}addImages(t,e,i){for(const r in t){const n=t[r],a={x:0,y:0,w:n.data.width+2*ac,h:n.data.height+2*ac};i.push(a),e[r]=new oc(a,n),n.hasRenderCallback&&this.haveRenderCallbacks.push(r)}}patchUpdatedImages(t,e){t.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const i in t.updatedImages)this.patchUpdatedImage(this.iconPositions[i],t.getImage(i),e),this.patchUpdatedImage(this.patternPositions[i],t.getImage(i),e)}patchUpdatedImage(t,e,i){if(!t||!e)return;if(t.version===e.version)return;t.version=e.version;const[r,n]=t.tl;i.update(e.data,void 0,{x:r,y:n})}}var lc;Rr("ImagePosition",oc),Rr("ImageAtlas",sc),t.WritingMode=void 0,(lc=t.WritingMode||(t.WritingMode={}))[lc.none=0]="none",lc[lc.horizontal=1]="horizontal",lc[lc.vertical=2]="vertical",lc[lc.horizontalOnly=3]="horizontalOnly";const cc=-17;class hc{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(t,e){const i=new hc;return i.scale=t||1,i.fontStack=e,i}static forImage(t){const e=new hc;return e.imageName=t,e}}class uc{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(t,e){const i=new uc;for(let r=0;r<t.sections.length;r++){const n=t.sections[r];n.image?i.addImageSection(n):i.addTextSection(n,e)}return i}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 e="";for(let i=0;i<t.length;i++){const r=t.charCodeAt(i+1)||null,n=t.charCodeAt(i-1)||null;e+=r&&Zr(r)&&!Al[t[i+1]]||n&&Zr(n)&&!Al[t[i-1]]||!Al[t[i]]?t[i]:Al[t[i]]}return e}(this.text)}trim(){let t=0;for(let e=0;e<this.text.length&&dc[this.text.charCodeAt(e)];e++)t++;let e=this.text.length;for(let i=this.text.length-1;i>=0&&i>=t&&dc[this.text.charCodeAt(i)];i--)e--;this.text=this.text.substring(t,e),this.sectionIndex=this.sectionIndex.slice(t,e)}substring(t,e){const i=new uc;return i.text=this.text.substring(t,e),i.sectionIndex=this.sectionIndex.slice(t,e),i.sections=this.sections,i}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce(((t,e)=>Math.max(t,this.sections[e].scale)),0)}addTextSection(t,e){this.text+=t.text,this.sections.push(hc.forText(t.scale,t.fontStack||e));const i=this.sections.length-1;for(let e=0;e<t.text.length;++e)this.sectionIndex.push(i)}addImageSection(t){const e=t.image?t.image.name:"";if(0===e.length)return void w("Can't add FormattedSection with an empty image.");const i=this.getNextImageSectionCharCode();i?(this.text+=String.fromCharCode(i),this.sections.push(hc.forImage(e)),this.sectionIndex.push(this.sections.length-1)):w("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function pc(e,i,r,n,a,o,s,l,c,h,u,p,d,m,f,g){const _=uc.fromFeature(e,a);let y;p===t.WritingMode.vertical&&_.verticalizePunctuation();const{processBidirectionalText:x,processStyledBidirectionalText:v}=sn;if(x&&1===_.sections.length){y=[];const t=x(_.toString(),vc(_,h,o,i,n,m,f));for(const e of t){const t=new uc;t.text=e,t.sections=_.sections;for(let i=0;i<e.length;i++)t.sectionIndex.push(0);y.push(t)}}else if(v){y=[];const t=v(_.text,_.sectionIndex,vc(_,h,o,i,n,m,f));for(const e of t){const t=new uc;t.text=e[0],t.sectionIndex=e[1],t.sections=_.sections,y.push(t)}}else y=function(t,e){const i=[],r=t.text;let n=0;for(const r of e)i.push(t.substring(n,r)),n=r;return n<r.length&&i.push(t.substring(n,r.length)),i}(_,vc(_,h,o,i,n,m,f));const b=[],w={positionedLines:b,text:_.toString(),top:u[1],bottom:u[1],left:u[0],right:u[0],writingMode:p,iconsInText:!1,verticalizable:!1};return function(e,i,r,n,a,o,s,l,c,h,u,p){let d=0,m=cc,f=0,g=0;const _="right"===l?1:"left"===l?0:.5;let y=0;for(const s of a){s.trim();const a=s.getMaxScale(),l=(a-1)*Ml,v={positionedGlyphs:[],lineOffset:0};e.positionedLines[y]=v;const b=v.positionedGlyphs;let w=0;if(!s.length()){m+=o,++y;continue}for(let o=0;o<s.length();o++){const f=s.getSection(o),g=s.getSectionIndex(o),_=s.getCharCode(o);let y=0,v=null,E=null,T=null,S=Ml;const C=!(c===t.WritingMode.horizontal||!u&&!qr(_)||u&&(dc[_]||(x=_,Vr.Arabic(x)||Vr["Arabic Supplement"](x)||Vr["Arabic Extended-A"](x)||Vr["Arabic Presentation Forms-A"](x)||Vr["Arabic Presentation Forms-B"](x))));if(f.imageName){const t=n[f.imageName];if(!t)continue;T=f.imageName,e.iconsInText=e.iconsInText||!0,E=t.paddedRect;const i=t.displaySize;f.scale=f.scale*Ml/p,v={width:i[0],height:i[1],left:ac,top:-rc,advance:C?i[1]:i[0]},y=l+(Ml-i[1]*f.scale),S=v.advance;const r=C?i[0]*f.scale-Ml*a:i[1]*f.scale-Ml*a;r>0&&r>w&&(w=r)}else{const t=r[f.fontStack],e=t&&t[_];if(e&&e.rect)E=e.rect,v=e.metrics;else{const t=i[f.fontStack],e=t&&t[_];if(!e)continue;v=e.metrics}y=(a-f.scale)*Ml}C?(e.verticalizable=!0,b.push({glyph:_,imageName:T,x:d,y:m+y,vertical:C,scale:f.scale,fontStack:f.fontStack,sectionIndex:g,metrics:v,rect:E}),d+=S*f.scale+h):(b.push({glyph:_,imageName:T,x:d,y:m+y,vertical:C,scale:f.scale,fontStack:f.fontStack,sectionIndex:g,metrics:v,rect:E}),d+=v.advance*f.scale+h)}0!==b.length&&(f=Math.max(d-h,f),wc(b,0,b.length-1,_,w)),d=0;const E=o*a+w;v.lineOffset=Math.max(w,l),m+=E,g=Math.max(E,g),++y}var x;const v=m-cc,{horizontalAlign:b,verticalAlign:w}=bc(s);(function(t,e,i,r,n,a,o,s,l){const c=(e-i)*n;let h=0;h=a!==o?-s*r-cc:(-r*l+.5)*o;for(const e of t)for(const t of e.positionedGlyphs)t.x+=c,t.y+=h})(e.positionedLines,_,b,w,f,g,o,v,a.length),e.top+=-w*v,e.bottom=e.top+v,e.left+=-b*f,e.right=e.left+f}(w,i,r,n,y,s,l,c,p,h,d,g),!function(t){for(const e of t)if(0!==e.positionedGlyphs.length)return!1;return!0}(b)&&w}const dc={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},mc={10:!0,32:!0,38:!0,40:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0};function fc(t,e,i,r,n,a){if(e.imageName){const t=r[e.imageName];return t?t.displaySize[0]*e.scale*Ml/a+n:0}{const r=i[e.fontStack],a=r&&r[t];return a?a.metrics.advance*e.scale+n:0}}function gc(t,e,i,r){const n=Math.pow(t-e,2);return r?t<e?n/2:2*n:n+Math.abs(i)*i}function _c(t,e,i){let r=0;return 10===t&&(r-=1e4),i&&(r+=150),40!==t&&65288!==t||(r+=50),41!==e&&65289!==e||(r+=50),r}function yc(t,e,i,r,n,a){let o=null,s=gc(e,i,n,a);for(const t of r){const r=gc(e-t.x,i,n,a)+t.badness;r<=s&&(o=t,s=r)}return{index:t,x:e,priorBreak:o,badness:s}}function xc(t){return t?xc(t.priorBreak).concat(t.index):[]}function vc(t,e,i,r,n,a,o){if("point"!==a)return[];if(!t)return[];const s=[],l=function(t,e,i,r,n,a){let o=0;for(let i=0;i<t.length();i++){const s=t.getSection(i);o+=fc(t.getCharCode(i),s,r,n,e,a)}return o/Math.max(1,Math.ceil(o/i))}(t,e,i,r,n,o),c=t.text.indexOf("​")>=0;let h=0;for(let i=0;i<t.length();i++){const a=t.getSection(i),p=t.getCharCode(i);if(dc[p]||(h+=fc(p,a,r,n,e,o)),i<t.length()-1){const e=!((u=p)<11904||!(Vr["Bopomofo Extended"](u)||Vr.Bopomofo(u)||Vr["CJK Compatibility Forms"](u)||Vr["CJK Compatibility Ideographs"](u)||Vr["CJK Compatibility"](u)||Vr["CJK Radicals Supplement"](u)||Vr["CJK Strokes"](u)||Vr["CJK Symbols and Punctuation"](u)||Vr["CJK Unified Ideographs Extension A"](u)||Vr["CJK Unified Ideographs"](u)||Vr["Enclosed CJK Letters and Months"](u)||Vr["Halfwidth and Fullwidth Forms"](u)||Vr.Hiragana(u)||Vr["Ideographic Description Characters"](u)||Vr["Kangxi Radicals"](u)||Vr["Katakana Phonetic Extensions"](u)||Vr.Katakana(u)||Vr["Vertical Forms"](u)||Vr["Yi Radicals"](u)||Vr["Yi Syllables"](u)));(mc[p]||e||a.imageName)&&s.push(yc(i+1,h,l,s,_c(p,t.getCharCode(i+1),e&&c),!1))}}var u;return xc(yc(t.length(),h,l,s,0,!0))}function bc(t){let e=.5,i=.5;switch(t){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0}switch(t){case"bottom":case"bottom-right":case"bottom-left":i=1;break;case"top":case"top-right":case"top-left":i=0}return{horizontalAlign:e,verticalAlign:i}}function wc(t,e,i,r,n){if(!r&&!n)return;const a=t[i],o=(t[i].x+a.metrics.advance*a.scale)*r;for(let r=e;r<=i;r++)t[r].x-=o,t[r].y+=n}function Ec(t,e,i){const{horizontalAlign:r,verticalAlign:n}=bc(i),a=e[0]-t.displaySize[0]*r,o=e[1]-t.displaySize[1]*n;return{image:t,top:o,bottom:o+t.displaySize[1],left:a,right:a+t.displaySize[0]}}function Tc(t,e,i,r,n,a){const o=t.image;let s;if(o.content){const t=o.content,e=o.pixelRatio||1;s=[t[0]/e,t[1]/e,o.displaySize[0]-t[2]/e,o.displaySize[1]-t[3]/e]}const l=e.left*a,c=e.right*a;let h,u,p,d;"width"===i||"both"===i?(d=n[0]+l-r[3],u=n[0]+c+r[1]):(d=n[0]+(l+c-o.displaySize[0])/2,u=d+o.displaySize[0]);const m=e.top*a,f=e.bottom*a;return"height"===i||"both"===i?(h=n[1]+m-r[0],p=n[1]+f+r[2]):(h=n[1]+(m+f-o.displaySize[1])/2,p=h+o.displaySize[1]),{image:o,top:h,right:u,bottom:p,left:d,collisionPadding:s}}const Sc=255,Cc=128,Ic=Sc*Cc;function Ac(t,e){const{expression:i}=e;if("constant"===i.kind)return{kind:"constant",layoutSize:i.evaluate(new ln(t+1))};if("source"===i.kind)return{kind:"source"};{const{zoomStops:e,interpolationType:r}=i;let n=0;for(;n<e.length&&e[n]<=t;)n++;n=Math.max(0,n-1);let a=n;for(;a<e.length&&e[a]<t+1;)a++;a=Math.min(e.length-1,a);const o=e[n],s=e[a];return"composite"===i.kind?{kind:"composite",minZoom:o,maxZoom:s,interpolationType:r}:{kind:"camera",minZoom:o,maxZoom:s,minSize:i.evaluate(new ln(o)),maxSize:i.evaluate(new ln(s)),interpolationType:r}}}function Mc(t,e,i){let r="never";const n=t.get(e);return n?r=n:t.get(i)&&(r="always"),r}const kc=Os.VectorTileFeature.types,Pc=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function zc(t,e,i,r,n,a,o,s,l,c,h,u,p){const d=s?Math.min(Ic,Math.round(s[0])):0,m=s?Math.min(Ic,Math.round(s[1])):0;t.emplaceBack(e,i,Math.round(32*r),Math.round(32*n),a,o,(d<<1)+(l?1:0),m,16*c,16*h,256*u,256*p)}function Lc(t,e,i){t.emplaceBack(e.x,e.y,i),t.emplaceBack(e.x,e.y,i),t.emplaceBack(e.x,e.y,i),t.emplaceBack(e.x,e.y,i)}function Dc(t){for(const e of t.sections)if(Xr(e.text))return!0;return!1}class Rc{constructor(t){this.layoutVertexArray=new ya,this.indexArray=new Ea,this.programConfigurations=t,this.segments=new Ia,this.dynamicLayoutVertexArray=new xa,this.opacityVertexArray=new va,this.hasVisibleVertices=!1,this.placedSymbolArray=new ia}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.indexArray.length&&0===this.dynamicLayoutVertexArray.length&&0===this.opacityVertexArray.length}upload(t,e,i,r){this.isEmpty()||(i&&(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,wl.members),this.indexBuffer=t.createIndexBuffer(this.indexArray,e),this.dynamicLayoutVertexBuffer=t.createVertexBuffer(this.dynamicLayoutVertexArray,El.members,!0),this.opacityVertexBuffer=t.createVertexBuffer(this.opacityVertexArray,Pc,!0),this.opacityVertexBuffer.itemSize=1),(i||r)&&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())}}Rr("SymbolBuffers",Rc);class Bc{constructor(t,e,i){this.layoutVertexArray=new t,this.layoutAttributes=e,this.indexArray=new i,this.segments=new Ia,this.collisionVertexArray=new wa}upload(t){this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=t.createVertexBuffer(this.collisionVertexArray,Tl.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}Rr("CollisionBuffers",Bc);class Fc{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=Co([]),this.placementViewportMatrix=Co([]);const i=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Ac(this.zoom,i["text-size"]),this.iconSizeData=Ac(this.zoom,i["icon-size"]);const r=this.layers[0].layout,n=r.get("symbol-sort-key"),a=r.get("symbol-z-order");this.canOverlap="never"!==Mc(r,"text-overlap","text-allow-overlap")||"never"!==Mc(r,"icon-overlap","icon-allow-overlap")||r.get("text-ignore-placement")||r.get("icon-ignore-placement"),this.sortFeaturesByKey="viewport-y"!==a&&!n.isConstant(),this.sortFeaturesByY=("viewport-y"===a||"auto"===a&&!this.sortFeaturesByKey)&&this.canOverlap,"point"===r.get("symbol-placement")&&(this.writingModes=r.get("text-writing-mode").map((e=>t.WritingMode[e]))),this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id)),this.sourceID=e.sourceID}createArrays(){this.text=new Rc(new Ka(this.layers,this.zoom,(t=>/^text/.test(t)))),this.icon=new Rc(new Ka(this.layers,this.zoom,(t=>/^icon/.test(t)))),this.glyphOffsetArray=new aa,this.lineVertexArray=new oa,this.symbolInstances=new na,this.textAnchorOffsets=new la}calculateGlyphDependencies(t,e,i,r,n){for(let a=0;a<t.length;a++)if(e[t.charCodeAt(a)]=!0,(i||r)&&n){const i=Al[t.charAt(a)];i&&(e[i.charCodeAt(0)]=!0)}}populate(e,i,r){const n=this.layers[0],a=n.layout,o=a.get("text-font"),s=a.get("text-field"),l=a.get("icon-image"),c=("constant"!==s.value.kind||s.value.value instanceof Qt&&!s.value.value.isEmpty()||s.value.value.toString().length>0)&&("constant"!==o.value.kind||o.value.value.length>0),h="constant"!==l.value.kind||!!l.value.value||Object.keys(l.parameters).length>0,u=a.get("symbol-sort-key");if(this.features=[],!c&&!h)return;const p=i.iconDependencies,d=i.glyphDependencies,m=i.availableImages,f=new ln(this.zoom);for(const{feature:i,id:s,index:l,sourceLayerIndex:g}of e){const e=n._featureFilter.needGeometry,_=ro(i,e);if(!n._featureFilter.filter(f,_,r))continue;let y,x;if(e||(_.geometry=io(i)),c){const t=n.getValueAndResolveTokens("text-field",_,r,m),e=Qt.factory(t);Dc(e)&&(this.hasRTLText=!0),(!this.hasRTLText||"unavailable"===an()||this.hasRTLText&&sn.isParsed())&&(y=Il(e,n,_))}if(h){const t=n.getValueAndResolveTokens("icon-image",_,r,m);x=t instanceof re?t:re.fromString(t)}if(!y&&!x)continue;const v=this.sortFeaturesByKey?u.evaluate(_,{},r):void 0;if(this.features.push({id:s,text:y,icon:x,index:l,sourceLayerIndex:g,geometry:_.geometry,properties:i.properties,type:kc[i.type],sortKey:v}),x&&(p[x.name]=!0),y){const e=o.evaluate(_,{},r).join(","),i="viewport"!==a.get("text-rotation-alignment")&&"point"!==a.get("symbol-placement");this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(t.WritingMode.vertical)>=0;for(const t of y.sections)if(t.image)p[t.image.name]=!0;else{const r=Nr(y.toString()),n=t.fontStack||e,a=d[n]=d[n]||{};this.calculateGlyphDependencies(t.text,a,i,this.allowVerticalPlacement,r)}}}"line"===a.get("symbol-placement")&&(this.features=function(t){const e={},i={},r=[];let n=0;function a(e){r.push(t[e]),n++}function o(t,e,n){const a=i[t];return delete i[t],i[e]=a,r[a].geometry[0].pop(),r[a].geometry[0]=r[a].geometry[0].concat(n[0]),a}function s(t,i,n){const a=e[i];return delete e[i],e[t]=a,r[a].geometry[0].shift(),r[a].geometry[0]=n[0].concat(r[a].geometry[0]),a}function l(t,e,i){const r=i?e[0][e[0].length-1]:e[0][0];return`${t}:${r.x}:${r.y}`}for(let c=0;c<t.length;c++){const h=t[c],u=h.geometry,p=h.text?h.text.toString():null;if(!p){a(c);continue}const d=l(p,u),m=l(p,u,!0);if(d in i&&m in e&&i[d]!==e[m]){const t=s(d,m,u),n=o(d,m,r[t].geometry);delete e[d],delete i[m],i[l(p,r[n].geometry,!0)]=n,r[t].geometry=null}else d in i?o(d,m,u):m in e?s(d,m,u):(a(c),e[d]=n-1,i[m]=n-1)}return r.filter((t=>t.geometry))}(this.features)),this.sortFeaturesByKey&&this.features.sort(((t,e)=>t.sortKey-e.sortKey))}update(t,e,i){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(t,e,this.layers,i),this.icon.programConfigurations.updatePaintArrays(t,e,this.layers,i))}isEmpty(){return 0===this.symbolInstances.length&&!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,e){const i=this.lineVertexArray.length;if(void 0!==t.segment){let i=t.dist(e[t.segment+1]),r=t.dist(e[t.segment]);const n={};for(let r=t.segment+1;r<e.length;r++)n[r]={x:e[r].x,y:e[r].y,tileUnitDistanceFromAnchor:i},r<e.length-1&&(i+=e[r+1].dist(e[r]));for(let i=t.segment||0;i>=0;i--)n[i]={x:e[i].x,y:e[i].y,tileUnitDistanceFromAnchor:r},i>0&&(r+=e[i-1].dist(e[i]));for(let t=0;t<e.length;t++){const e=n[t];this.lineVertexArray.emplaceBack(e.x,e.y,e.tileUnitDistanceFromAnchor)}}return{lineStartIndex:i,lineLength:this.lineVertexArray.length-i}}addSymbols(e,i,r,n,a,o,s,l,c,h,u,p){const d=e.indexArray,m=e.layoutVertexArray,f=e.segments.prepareSegment(4*i.length,m,d,this.canOverlap?o.sortKey:void 0),g=this.glyphOffsetArray.length,_=f.vertexLength,y=this.allowVerticalPlacement&&s===t.WritingMode.vertical?Math.PI/2:0,x=o.text&&o.text.sections;for(let t=0;t<i.length;t++){const{tl:n,tr:a,bl:s,br:c,tex:h,pixelOffsetTL:u,pixelOffsetBR:g,minFontScaleX:_,minFontScaleY:v,glyphOffset:b,isSDF:w,sectionIndex:E}=i[t],T=f.vertexLength,S=b[1];zc(m,l.x,l.y,n.x,S+n.y,h.x,h.y,r,w,u.x,u.y,_,v),zc(m,l.x,l.y,a.x,S+a.y,h.x+h.w,h.y,r,w,g.x,u.y,_,v),zc(m,l.x,l.y,s.x,S+s.y,h.x,h.y+h.h,r,w,u.x,g.y,_,v),zc(m,l.x,l.y,c.x,S+c.y,h.x+h.w,h.y+h.h,r,w,g.x,g.y,_,v),Lc(e.dynamicLayoutVertexArray,l,y),d.emplaceBack(T,T+1,T+2),d.emplaceBack(T+1,T+2,T+3),f.vertexLength+=4,f.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(b[0]),t!==i.length-1&&E===i[t+1].sectionIndex||e.programConfigurations.populatePaintArrays(m.length,o,o.index,{},p,x&&x[E])}e.placedSymbolArray.emplaceBack(l.x,l.y,g,this.glyphOffsetArray.length-g,_,c,h,l.segment,r?r[0]:0,r?r[1]:0,n[0],n[1],s,0,!1,0,u)}_addCollisionDebugVertex(t,e,i,r,n,a){return e.emplaceBack(0,0),t.emplaceBack(i.x,i.y,r,n,Math.round(a.x),Math.round(a.y))}addCollisionDebugVertices(t,e,i,r,a,o,s){const l=a.segments.prepareSegment(4,a.layoutVertexArray,a.indexArray),c=l.vertexLength,h=a.layoutVertexArray,u=a.collisionVertexArray,p=s.anchorX,d=s.anchorY;this._addCollisionDebugVertex(h,u,o,p,d,new n(t,e)),this._addCollisionDebugVertex(h,u,o,p,d,new n(i,e)),this._addCollisionDebugVertex(h,u,o,p,d,new n(i,r)),this._addCollisionDebugVertex(h,u,o,p,d,new n(t,r)),l.vertexLength+=4;const m=a.indexArray;m.emplaceBack(c,c+1),m.emplaceBack(c+1,c+2),m.emplaceBack(c+2,c+3),m.emplaceBack(c+3,c),l.primitiveLength+=4}addDebugCollisionBoxes(t,e,i,r){for(let n=t;n<e;n++){const t=this.collisionBoxArray.get(n);this.addCollisionDebugVertices(t.x1,t.y1,t.x2,t.y2,r?this.textCollisionBox:this.iconCollisionBox,t.anchorPoint,i)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new Bc(ba,Sl.members,Ta),this.iconCollisionBox=new Bc(ba,Sl.members,Ta);for(let t=0;t<this.symbolInstances.length;t++){const e=this.symbolInstances.get(t);this.addDebugCollisionBoxes(e.textBoxStartIndex,e.textBoxEndIndex,e,!0),this.addDebugCollisionBoxes(e.verticalTextBoxStartIndex,e.verticalTextBoxEndIndex,e,!0),this.addDebugCollisionBoxes(e.iconBoxStartIndex,e.iconBoxEndIndex,e,!1),this.addDebugCollisionBoxes(e.verticalIconBoxStartIndex,e.verticalIconBoxEndIndex,e,!1)}}_deserializeCollisionBoxesForSymbol(t,e,i,r,n,a,o,s,l){const c={};for(let r=e;r<i;r++){const e=t.get(r);c.textBox={x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,anchorPointX:e.anchorPointX,anchorPointY:e.anchorPointY},c.textFeatureIndex=e.featureIndex;break}for(let e=r;e<n;e++){const i=t.get(e);c.verticalTextBox={x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2,anchorPointX:i.anchorPointX,anchorPointY:i.anchorPointY},c.verticalTextFeatureIndex=i.featureIndex;break}for(let e=a;e<o;e++){const i=t.get(e);c.iconBox={x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2,anchorPointX:i.anchorPointX,anchorPointY:i.anchorPointY},c.iconFeatureIndex=i.featureIndex;break}for(let e=s;e<l;e++){const i=t.get(e);c.verticalIconBox={x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2,anchorPointX:i.anchorPointX,anchorPointY:i.anchorPointY},c.verticalIconFeatureIndex=i.featureIndex;break}return c}deserializeCollisionBoxes(t){this.collisionArrays=[];for(let e=0;e<this.symbolInstances.length;e++){const i=this.symbolInstances.get(e);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(t,i.textBoxStartIndex,i.textBoxEndIndex,i.verticalTextBoxStartIndex,i.verticalTextBoxEndIndex,i.iconBoxStartIndex,i.iconBoxEndIndex,i.verticalIconBoxStartIndex,i.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,e){const i=t.placedSymbolArray.get(e),r=i.vertexStartIndex+4*i.numGlyphs;for(let e=i.vertexStartIndex;e<r;e+=4)t.indexArray.emplaceBack(e,e+1,e+2),t.indexArray.emplaceBack(e+1,e+2,e+3)}getSortedSymbolIndexes(t){if(this.sortedAngle===t&&void 0!==this.symbolInstanceIndexes)return this.symbolInstanceIndexes;const e=Math.sin(t),i=Math.cos(t),r=[],n=[],a=[];for(let t=0;t<this.symbolInstances.length;++t){a.push(t);const o=this.symbolInstances.get(t);r.push(0|Math.round(e*o.anchorX+i*o.anchorY)),n.push(o.featureIndex)}return a.sort(((t,e)=>r[t]-r[e]||n[e]-n[t])),a}addToSortKeyRanges(t,e){const i=this.sortKeyRanges[this.sortKeyRanges.length-1];i&&i.sortKey===e?i.symbolInstanceEnd=t+1:this.sortKeyRanges.push({sortKey:e,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(const t of this.symbolInstanceIndexes){const e=this.symbolInstances.get(t);this.featureSortOrder.push(e.featureIndex),[e.rightJustifiedTextSymbolIndex,e.centerJustifiedTextSymbolIndex,e.leftJustifiedTextSymbolIndex].forEach(((t,e,i)=>{t>=0&&i.indexOf(t)===e&&this.addIndicesForPlacedSymbol(this.text,t)})),e.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,e.verticalPlacedTextSymbolIndex),e.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,e.placedIconSymbolIndex),e.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,e.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let Oc,Uc;Rr("SymbolBucket",Fc,{omit:["layers","collisionBoxArray","features","compareText"]}),Fc.MAX_GLYPHS=65535,Fc.addDynamicAttributes=Lc;var Vc={get paint(){return Uc=Uc||new wn({"icon-opacity":new yn(W.paint_symbol["icon-opacity"]),"icon-color":new yn(W.paint_symbol["icon-color"]),"icon-halo-color":new yn(W.paint_symbol["icon-halo-color"]),"icon-halo-width":new yn(W.paint_symbol["icon-halo-width"]),"icon-halo-blur":new yn(W.paint_symbol["icon-halo-blur"]),"icon-translate":new _n(W.paint_symbol["icon-translate"]),"icon-translate-anchor":new _n(W.paint_symbol["icon-translate-anchor"]),"text-opacity":new yn(W.paint_symbol["text-opacity"]),"text-color":new yn(W.paint_symbol["text-color"],{runtimeType:ft,getOverride:t=>t.textColor,hasOverride:t=>!!t.textColor}),"text-halo-color":new yn(W.paint_symbol["text-halo-color"]),"text-halo-width":new yn(W.paint_symbol["text-halo-width"]),"text-halo-blur":new yn(W.paint_symbol["text-halo-blur"]),"text-translate":new _n(W.paint_symbol["text-translate"]),"text-translate-anchor":new _n(W.paint_symbol["text-translate-anchor"])})},get layout(){return Oc=Oc||new wn({"symbol-placement":new _n(W.layout_symbol["symbol-placement"]),"symbol-spacing":new _n(W.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new _n(W.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new yn(W.layout_symbol["symbol-sort-key"]),"symbol-z-order":new _n(W.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new _n(W.layout_symbol["icon-allow-overlap"]),"icon-overlap":new _n(W.layout_symbol["icon-overlap"]),"icon-ignore-placement":new _n(W.layout_symbol["icon-ignore-placement"]),"icon-optional":new _n(W.layout_symbol["icon-optional"]),"icon-rotation-alignment":new _n(W.layout_symbol["icon-rotation-alignment"]),"icon-size":new yn(W.layout_symbol["icon-size"]),"icon-text-fit":new _n(W.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new _n(W.layout_symbol["icon-text-fit-padding"]),"icon-image":new yn(W.layout_symbol["icon-image"]),"icon-rotate":new yn(W.layout_symbol["icon-rotate"]),"icon-padding":new yn(W.layout_symbol["icon-padding"]),"icon-keep-upright":new _n(W.layout_symbol["icon-keep-upright"]),"icon-offset":new yn(W.layout_symbol["icon-offset"]),"icon-anchor":new yn(W.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new _n(W.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new _n(W.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new _n(W.layout_symbol["text-rotation-alignment"]),"text-field":new yn(W.layout_symbol["text-field"]),"text-font":new yn(W.layout_symbol["text-font"]),"text-size":new yn(W.layout_symbol["text-size"]),"text-max-width":new yn(W.layout_symbol["text-max-width"]),"text-line-height":new _n(W.layout_symbol["text-line-height"]),"text-letter-spacing":new yn(W.layout_symbol["text-letter-spacing"]),"text-justify":new yn(W.layout_symbol["text-justify"]),"text-radial-offset":new yn(W.layout_symbol["text-radial-offset"]),"text-variable-anchor":new _n(W.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new yn(W.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new yn(W.layout_symbol["text-anchor"]),"text-max-angle":new _n(W.layout_symbol["text-max-angle"]),"text-writing-mode":new _n(W.layout_symbol["text-writing-mode"]),"text-rotate":new yn(W.layout_symbol["text-rotate"]),"text-padding":new _n(W.layout_symbol["text-padding"]),"text-keep-upright":new _n(W.layout_symbol["text-keep-upright"]),"text-transform":new yn(W.layout_symbol["text-transform"]),"text-offset":new yn(W.layout_symbol["text-offset"]),"text-allow-overlap":new _n(W.layout_symbol["text-allow-overlap"]),"text-overlap":new _n(W.layout_symbol["text-overlap"]),"text-ignore-placement":new _n(W.layout_symbol["text-ignore-placement"]),"text-optional":new _n(W.layout_symbol["text-optional"])})}};class Nc{constructor(t){if(void 0===t.property.overrides)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=t.property.overrides?t.property.overrides.runtimeType:ut,this.defaultValue=t}evaluate(t){if(t.formattedSection){const e=this.defaultValue.property.overrides;if(e&&e.hasOverride(t.formattedSection))return e.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}}Rr("FormatSectionOverride",Nc,{omit:["defaultValue"]});class $c extends Tn{constructor(t){super(t,Vc)}recalculate(t,e){if(super.recalculate(t,e),"auto"===this.layout.get("icon-rotation-alignment")&&(this.layout._values["icon-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-rotation-alignment")&&(this.layout._values["text-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-pitch-alignment")&&(this.layout._values["text-pitch-alignment"]="map"===this.layout.get("text-rotation-alignment")?"map":"viewport"),"auto"===this.layout.get("icon-pitch-alignment")&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),"point"===this.layout.get("symbol-placement")){const t=this.layout.get("text-writing-mode");if(t){const e=[];for(const i of t)e.indexOf(i)<0&&e.push(i);this.layout._values["text-writing-mode"]=e}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(t,e,i,r){const n=this.layout.get(t).evaluate(e,{},i,r),a=this._unevaluatedLayout._values[t];return a.isDataDriven()||Ri(a.value)||!n?n:function(t,e){return e.replace(/{([^{}]+)}/g,((e,i)=>i in t?String(t[i]):""))}(e.properties,n)}createBucket(t){return new Fc(t)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const t of Vc.paint.overridableProperties){if(!$c.hasPaintOverride(this.layout,t))continue;const e=this.paint.get(t),i=new Nc(e),r=new Di(i,e.property.specification);let n=null;n="constant"===e.value.kind||"source"===e.value.kind?new Fi("source",r):new Oi("composite",r,e.value.zoomStops),this.paint._values[t]=new fn(e.property,n,e.parameters)}}_handleOverridablePaintPropertyUpdate(t,e,i){return!(!this.layout||e.isDataDriven()||i.isDataDriven())&&$c.hasPaintOverride(this.layout,t)}static hasPaintOverride(t,e){const i=t.get("text-field"),r=Vc.paint.properties[e];let n=!1;const a=t=>{for(const e of t)if(r.overrides&&r.overrides.hasOverride(e))return void(n=!0)};if("constant"===i.value.kind&&i.value.value instanceof Qt)a(i.value.value.sections);else if("source"===i.value.kind){const t=e=>{n||(e instanceof le&&oe(e.value)===xt?a(e.value.sections):e instanceof pi?a(e.sections):e.eachChild(t))},e=i.value;e._styleExpression&&t(e._styleExpression.expression)}return n}}let jc;var qc={get paint(){return jc=jc||new wn({"background-color":new _n(W.paint_background["background-color"]),"background-pattern":new vn(W.paint_background["background-pattern"]),"background-opacity":new _n(W.paint_background["background-opacity"])})}};class Zc extends Tn{constructor(t){super(t,qc)}}let Gc;var Hc={get paint(){return Gc=Gc||new wn({"raster-opacity":new _n(W.paint_raster["raster-opacity"]),"raster-hue-rotate":new _n(W.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new _n(W.paint_raster["raster-brightness-min"]),"raster-brightness-max":new _n(W.paint_raster["raster-brightness-max"]),"raster-saturation":new _n(W.paint_raster["raster-saturation"]),"raster-contrast":new _n(W.paint_raster["raster-contrast"]),"raster-resampling":new _n(W.paint_raster["raster-resampling"]),"raster-fade-duration":new _n(W.paint_raster["raster-fade-duration"])})}};class Xc extends Tn{constructor(t){super(t,Hc)}}class Wc extends Tn{constructor(t){super(t,{}),this.onAdd=t=>{this.implementation.onAdd&&this.implementation.onAdd(t,t.painter.context.gl)},this.onRemove=t=>{this.implementation.onRemove&&this.implementation.onRemove(t,t.painter.context.gl)},this.implementation=t}is3D(){return"3d"===this.implementation.renderingMode}hasOffscreenPass(){return void 0!==this.implementation.prerender}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}}class Kc{constructor(t){this._callback=t,this._triggered=!1,"undefined"!=typeof MessageChannel&&(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=()=>{}}}const Yc=6371008.8;class Jc{constructor(t,e){if(isNaN(t)||isNaN(e))throw new Error(`Invalid LngLat object: (${t}, ${e})`);if(this.lng=+t,this.lat=+e,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new Jc(f(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(t){const e=Math.PI/180,i=this.lat*e,r=t.lat*e,n=Math.sin(i)*Math.sin(r)+Math.cos(i)*Math.cos(r)*Math.cos((t.lng-this.lng)*e);return Yc*Math.acos(Math.min(n,1))}static convert(t){if(t instanceof Jc)return t;if(Array.isArray(t)&&(2===t.length||3===t.length))return new Jc(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&"object"==typeof t&&null!==t)return new Jc(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>]")}}const Qc=2*Math.PI*Yc;function th(t){return Qc*Math.cos(t*Math.PI/180)}function eh(t){return(180+t)/360}function ih(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function rh(t,e){return t/th(e)}function nh(t){return 360/Math.PI*Math.atan(Math.exp((180-360*t)*Math.PI/180))-90}class ah{constructor(t,e,i=0){this.x=+t,this.y=+e,this.z=+i}static fromLngLat(t,e=0){const i=Jc.convert(t);return new ah(eh(i.lng),ih(i.lat),rh(e,i.lat))}toLngLat(){return new Jc(360*this.x-180,nh(this.y))}toAltitude(){return this.z*th(nh(this.y))}meterInMercatorCoordinateUnits(){return 1/Qc*(t=nh(this.y),1/Math.cos(t*Math.PI/180));var t}}function oh(t,e,i){var r=2*Math.PI*6378137/256/Math.pow(2,i);return[t*r-2*Math.PI*6378137/2,e*r-2*Math.PI*6378137/2]}class sh{constructor(t,e,i){if(t<0||t>25||i<0||i>=Math.pow(2,t)||e<0||e>=Math.pow(2,t))throw new Error(`x=${e}, y=${i}, z=${t} outside of bounds. 0<=x<${Math.pow(2,t)}, 0<=y<${Math.pow(2,t)} 0<=z<=25 `);this.z=t,this.x=e,this.y=i,this.key=hh(0,t,t,e,i)}equals(t){return this.z===t.z&&this.x===t.x&&this.y===t.y}url(t,e,i){const r=(a=this.y,o=this.z,s=oh(256*(n=this.x),256*(a=Math.pow(2,o)-a-1),o),l=oh(256*(n+1),256*(a+1),o),s[0]+","+s[1]+","+l[0]+","+l[1]);var n,a,o,s,l;const c=function(t,e,i){let r,n="";for(let a=t;a>0;a--)r=1<<a-1,n+=(e&r?1:0)+(i&r?2:0);return n}(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("tms"===i?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,e>1?"@2x":"").replace(/{quadkey}/g,c).replace(/{bbox-epsg-3857}/g,r)}isChildOf(t){const e=this.z-t.z;return e>0&&t.x===this.x>>e&&t.y===this.y>>e}getTilePoint(t){const e=Math.pow(2,this.z);return new n((t.x*e-this.x)*Qa,(t.y*e-this.y)*Qa)}toString(){return`${this.z}/${this.x}/${this.y}`}}class lh{constructor(t,e){this.wrap=t,this.canonical=e,this.key=hh(t,e.z,e.z,e.x,e.y)}}class ch{constructor(t,e,i,r,n){if(t<i)throw new Error(`overscaledZ should be >= z; overscaledZ = ${t}; z = ${i}`);this.overscaledZ=t,this.wrap=e,this.canonical=new sh(i,+r,+n),this.key=hh(e,t,i,r,n)}clone(){return new ch(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(t){return this.overscaledZ===t.overscaledZ&&this.wrap===t.wrap&&this.canonical.equals(t.canonical)}scaledTo(t){if(t>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);const e=this.canonical.z-t;return t>this.canonical.z?new ch(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new ch(t,this.wrap,t,this.canonical.x>>e,this.canonical.y>>e)}calculateScaledKey(t,e){if(t>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);const i=this.canonical.z-t;return t>this.canonical.z?hh(this.wrap*+e,t,this.canonical.z,this.canonical.x,this.canonical.y):hh(this.wrap*+e,t,t,this.canonical.x>>i,this.canonical.y>>i)}isChildOf(t){if(t.wrap!==this.wrap)return!1;const e=this.canonical.z-t.canonical.z;return 0===t.overscaledZ||t.overscaledZ<this.overscaledZ&&t.canonical.x===this.canonical.x>>e&&t.canonical.y===this.canonical.y>>e}children(t){if(this.overscaledZ>=t)return[new ch(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const e=this.canonical.z+1,i=2*this.canonical.x,r=2*this.canonical.y;return[new ch(e,this.wrap,e,i,r),new ch(e,this.wrap,e,i+1,r),new ch(e,this.wrap,e,i,r+1),new ch(e,this.wrap,e,i+1,r+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 ch(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(t){return new ch(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 lh(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(t){return this.canonical.getTilePoint(new ah(t.x-this.wrap,t.y))}}function hh(t,e,i,r,n){(t*=2)<0&&(t=-1*t-1);const a=1<<i;return(a*a*t+a*n+r).toString(36)+i.toString(36)+e.toString(36)}Rr("CanonicalTileID",sh),Rr("OverscaledTileID",ch,{omit:["posMatrix"]});class uh{constructor(t,e,i,r=1,n=1,a=1,o=0){if(this.uid=t,e.height!==e.width)throw new RangeError("DEM tiles must be square");if(i&&!["mapbox","terrarium","custom"].includes(i))return void w(`"${i}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);this.stride=e.height;const s=this.dim=e.height-2;switch(this.data=new Uint32Array(e.data.buffer),i){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case"custom":this.redFactor=r,this.greenFactor=n,this.blueFactor=a,this.baseShift=o;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4}for(let t=0;t<s;t++)this.data[this._idx(-1,t)]=this.data[this._idx(0,t)],this.data[this._idx(s,t)]=this.data[this._idx(s-1,t)],this.data[this._idx(t,-1)]=this.data[this._idx(t,0)],this.data[this._idx(t,s)]=this.data[this._idx(t,s-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(s,-1)]=this.data[this._idx(s-1,0)],this.data[this._idx(-1,s)]=this.data[this._idx(0,s-1)],this.data[this._idx(s,s)]=this.data[this._idx(s-1,s-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let t=0;t<s;t++)for(let e=0;e<s;e++){const i=this.get(t,e);i>this.max&&(this.max=i),i<this.min&&(this.min=i)}}get(t,e){const i=new Uint8Array(this.data.buffer),r=4*this._idx(t,e);return this.unpack(i[r],i[r+1],i[r+2])}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(t,e){if(t<-1||t>=this.dim+1||e<-1||e>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(e+1)*this.stride+(t+1)}unpack(t,e,i){return t*this.redFactor+e*this.greenFactor+i*this.blueFactor-this.baseShift}getPixels(){return new Vo({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(t,e,i){if(this.dim!==t.dim)throw new Error("dem dimension mismatch");let r=e*this.dim,n=e*this.dim+this.dim,a=i*this.dim,o=i*this.dim+this.dim;switch(e){case-1:r=n-1;break;case 1:n=r+1}switch(i){case-1:a=o-1;break;case 1:o=a+1}const s=-e*this.dim,l=-i*this.dim;for(let e=a;e<o;e++)for(let i=r;i<n;i++)this.data[this._idx(i,e)]=t.data[this._idx(i+s,e+l)]}}Rr("DEMData",uh);class ph{constructor(t){this._stringToNumber={},this._numberToString=[];for(let e=0;e<t.length;e++){const i=t[e];this._stringToNumber[i]=e,this._numberToString[e]=i}}encode(t){return this._stringToNumber[t]}decode(t){if(t>=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${t} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[t]}}class dh{constructor(t,e,i,r,n){this.type="Feature",this._vectorTileFeature=t,t._z=e,t._x=i,t._y=r,this.properties=t.properties,this.id=n}get geometry(){return void 0===this._geometry&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(t){this._geometry=t}toJSON(){const t={geometry:this.geometry};for(const e in this)"_geometry"!==e&&"_vectorTileFeature"!==e&&(t[e]=this[e]);return t}}class mh{constructor(t,e){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new Lr(Qa,16,0),this.grid3D=new Lr(Qa,16,0),this.featureIndexArray=new ha,this.promoteId=e}insert(t,e,i,r,n,a){const o=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(i,r,n);const s=a?this.grid3D:this.grid;for(let t=0;t<e.length;t++){const i=e[t],r=[1/0,1/0,-1/0,-1/0];for(let t=0;t<i.length;t++){const e=i[t];r[0]=Math.min(r[0],e.x),r[1]=Math.min(r[1],e.y),r[2]=Math.max(r[2],e.x),r[3]=Math.max(r[3],e.y)}r[0]<Qa&&r[1]<Qa&&r[2]>=0&&r[3]>=0&&s.insert(o,r[0],r[1],r[2],r[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new Os.VectorTile(new Jl(this.rawTileData)).layers,this.sourceLayerCoder=new ph(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(t,e,i,r){this.loadVTLayers();const a=t.params||{},o=Qa/t.tileSize/t.scale,s=qi(a.filter),l=t.queryGeometry,c=t.queryPadding*o,h=gh(l),u=this.grid.query(h.minX-c,h.minY-c,h.maxX+c,h.maxY+c),p=gh(t.cameraQueryGeometry),d=this.grid3D.query(p.minX-c,p.minY-c,p.maxX+c,p.maxY+c,((e,i,r,a)=>function(t,e,i,r,a){for(const n of t)if(e<=n.x&&i<=n.y&&r>=n.x&&a>=n.y)return!0;const o=[new n(e,i),new n(e,a),new n(r,a),new n(r,i)];if(t.length>2)for(const e of o)if(go(t,e))return!0;for(let e=0;e<t.length-1;e++)if(_o(t[e],t[e+1],o))return!0;return!1}(t.cameraQueryGeometry,e-c,i-c,r+c,a+c)));for(const t of d)u.push(t);u.sort(_h);const m={};let f;for(let n=0;n<u.length;n++){const c=u[n];if(c===f)continue;f=c;const h=this.featureIndexArray.get(c);let p=null;this.loadMatchingFeature(m,h.bucketIndex,h.sourceLayerIndex,h.featureIndex,s,a.layers,a.availableImages,e,i,r,((e,i,r)=>(p||(p=io(e)),i.queryIntersectsFeature(l,e,r,p,this.z,t.transform,o,t.pixelPosMatrix))))}return m}loadMatchingFeature(t,e,i,r,n,a,o,s,l,c,h){const u=this.bucketLayerIDs[e];if(a&&!function(t,e){for(let i=0;i<t.length;i++)if(e.indexOf(t[i])>=0)return!0;return!1}(a,u))return;const p=this.sourceLayerCoder.decode(i),d=this.vtLayers[p].feature(r);if(n.needGeometry){const t=ro(d,!0);if(!n.filter(new ln(this.tileID.overscaledZ),t,this.tileID.canonical))return}else if(!n.filter(new ln(this.tileID.overscaledZ),d))return;const m=this.getId(d,p);for(let e=0;e<u.length;e++){const i=u[e];if(a&&a.indexOf(i)<0)continue;const n=s[i];if(!n)continue;let p={};m&&c&&(p=c.getState(n.sourceLayer||"_geojsonTileLayer",m));const f=g({},l[i]);f.paint=fh(f.paint,n.paint,d,p,o),f.layout=fh(f.layout,n.layout,d,p,o);const _=!h||h(d,n,p);if(!_)continue;const y=new dh(d,this.z,this.x,this.y,m);y.layer=f;let x=t[i];void 0===x&&(x=t[i]=[]),x.push({featureIndex:r,feature:y,intersectionZ:_})}}lookupSymbolFeatures(t,e,i,r,n,a,o,s){const l={};this.loadVTLayers();const c=qi(n);for(const n of t)this.loadMatchingFeature(l,i,r,n,c,a,o,s,e);return l}hasLayer(t){for(const e of this.bucketLayerIDs)for(const i of e)if(t===i)return!0;return!1}getId(t,e){let i=t.id;return this.promoteId&&(i=t.properties["string"==typeof this.promoteId?this.promoteId:this.promoteId[e]],"boolean"==typeof i&&(i=Number(i))),i}}function fh(t,e,i,r,n){return y(t,((t,a)=>{const o=e instanceof gn?e.get(a):null;return o&&o.evaluate?o.evaluate(i,r,n):o}))}function gh(t){let e=1/0,i=1/0,r=-1/0,n=-1/0;for(const a of t)e=Math.min(e,a.x),i=Math.min(i,a.y),r=Math.max(r,a.x),n=Math.max(n,a.y);return{minX:e,minY:i,maxX:r,maxY:n}}function _h(t,e){return e-t}function yh(t,e,i,r,a){const o=[];for(let s=0;s<t.length;s++){const l=t[s];let c;for(let t=0;t<l.length-1;t++){let s=l[t],h=l[t+1];s.x<e&&h.x<e||(s.x<e?s=new n(e,s.y+(e-s.x)/(h.x-s.x)*(h.y-s.y))._round():h.x<e&&(h=new n(e,s.y+(e-s.x)/(h.x-s.x)*(h.y-s.y))._round()),s.y<i&&h.y<i||(s.y<i?s=new n(s.x+(i-s.y)/(h.y-s.y)*(h.x-s.x),i)._round():h.y<i&&(h=new n(s.x+(i-s.y)/(h.y-s.y)*(h.x-s.x),i)._round()),s.x>=r&&h.x>=r||(s.x>=r?s=new n(r,s.y+(r-s.x)/(h.x-s.x)*(h.y-s.y))._round():h.x>=r&&(h=new n(r,s.y+(r-s.x)/(h.x-s.x)*(h.y-s.y))._round()),s.y>=a&&h.y>=a||(s.y>=a?s=new n(s.x+(a-s.y)/(h.y-s.y)*(h.x-s.x),a)._round():h.y>=a&&(h=new n(s.x+(a-s.y)/(h.y-s.y)*(h.x-s.x),a)._round()),c&&s.equals(c[c.length-1])||(c=[s],o.push(c)),c.push(h)))))}}return o}Rr("FeatureIndex",mh,{omit:["rawTileData","sourceLayerCoder"]});class xh extends n{constructor(t,e,i,r){super(t,e),this.angle=i,void 0!==r&&(this.segment=r)}clone(){return new xh(this.x,this.y,this.angle,this.segment)}}function vh(t,e,i,r,n){if(void 0===e.segment||0===i)return!0;let a=e,o=e.segment+1,s=0;for(;s>-i/2;){if(o--,o<0)return!1;s-=t[o].dist(a),a=t[o]}s+=t[o].dist(t[o+1]),o++;const l=[];let c=0;for(;s<i/2;){const e=t[o],i=t[o+1];if(!i)return!1;let a=t[o-1].angleTo(e)-e.angleTo(i);for(a=Math.abs((a+3*Math.PI)%(2*Math.PI)-Math.PI),l.push({distance:s,angleDelta:a}),c+=a;s-l[0].distance>r;)c-=l.shift().angleDelta;if(c>n)return!1;o++,s+=e.dist(i)}return!0}function bh(t){let e=0;for(let i=0;i<t.length-1;i++)e+=t[i].dist(t[i+1]);return e}function wh(t,e,i){return t?.6*e*i:0}function Eh(t,e){return Math.max(t?t.right-t.left:0,e?e.right-e.left:0)}function Th(t,e,i,r,n,a){const o=wh(i,n,a),s=Eh(i,r)*a;let l=0;const c=bh(t)/2;for(let i=0;i<t.length-1;i++){const r=t[i],n=t[i+1],a=r.dist(n);if(l+a>c){const h=(c-l)/a,u=Ze.number(r.x,n.x,h),p=Ze.number(r.y,n.y,h),d=new xh(u,p,n.angleTo(r),i);return d._round(),!o||vh(t,d,s,o,e)?d:void 0}l+=a}}function Sh(t,e,i,r,n,a,o,s,l){const c=wh(r,a,o),h=Eh(r,n),u=h*o,p=0===t[0].x||t[0].x===l||0===t[0].y||t[0].y===l;return e-u<e/4&&(e=u+e/4),Ch(t,p?e/2*s%e:(h/2+2*a)*o*s%e,e,c,i,u,p,!1,l)}function Ch(t,e,i,r,n,a,o,s,l){const c=a/2,h=bh(t);let u=0,p=e-i,d=[];for(let e=0;e<t.length-1;e++){const o=t[e],s=t[e+1],m=o.dist(s),f=s.angleTo(o);for(;p+i<u+m;){p+=i;const g=(p-u)/m,_=Ze.number(o.x,s.x,g),y=Ze.number(o.y,s.y,g);if(_>=0&&_<l&&y>=0&&y<l&&p-c>=0&&p+c<=h){const i=new xh(_,y,f,e);i._round(),r&&!vh(t,i,a,r,n)||d.push(i)}}u+=m}return s||d.length||o||(d=Ch(t,u/2,i,r,n,a,o,!0,l)),d}Rr("Anchor",xh);const Ih=ac;function Ah(t,e,i,r){const a=[],o=t.image,s=o.pixelRatio,l=o.paddedRect.w-2*Ih,c=o.paddedRect.h-2*Ih,h=t.right-t.left,u=t.bottom-t.top,p=o.stretchX||[[0,l]],d=o.stretchY||[[0,c]],m=(t,e)=>t+e[1]-e[0],f=p.reduce(m,0),g=d.reduce(m,0),_=l-f,y=c-g;let x=0,v=f,b=0,w=g,E=0,T=_,S=0,C=y;if(o.content&&r){const t=o.content;x=Mh(p,0,t[0]),b=Mh(d,0,t[1]),v=Mh(p,t[0],t[2]),w=Mh(d,t[1],t[3]),E=t[0]-x,S=t[1]-b,T=t[2]-t[0]-v,C=t[3]-t[1]-w}const I=(r,a,l,c)=>{const p=Ph(r.stretch-x,v,h,t.left),d=zh(r.fixed-E,T,r.stretch,f),m=Ph(a.stretch-b,w,u,t.top),_=zh(a.fixed-S,C,a.stretch,g),y=Ph(l.stretch-x,v,h,t.left),I=zh(l.fixed-E,T,l.stretch,f),A=Ph(c.stretch-b,w,u,t.top),M=zh(c.fixed-S,C,c.stretch,g),k=new n(p,m),P=new n(y,m),z=new n(y,A),L=new n(p,A),D=new n(d/s,_/s),R=new n(I/s,M/s),B=e*Math.PI/180;if(B){const t=Math.sin(B),e=Math.cos(B),i=[e,-t,t,e];k._matMult(i),P._matMult(i),L._matMult(i),z._matMult(i)}const F=r.stretch+r.fixed,O=a.stretch+a.fixed;return{tl:k,tr:P,bl:L,br:z,tex:{x:o.paddedRect.x+Ih+F,y:o.paddedRect.y+Ih+O,w:l.stretch+l.fixed-F,h:c.stretch+c.fixed-O},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:D,pixelOffsetBR:R,minFontScaleX:T/s/h,minFontScaleY:C/s/u,isSDF:i}};if(r&&(o.stretchX||o.stretchY)){const t=kh(p,_,f),e=kh(d,y,g);for(let i=0;i<t.length-1;i++){const r=t[i],n=t[i+1];for(let t=0;t<e.length-1;t++)a.push(I(r,e[t],n,e[t+1]))}}else a.push(I({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:l+1},{fixed:0,stretch:c+1}));return a}function Mh(t,e,i){let r=0;for(const n of t)r+=Math.max(e,Math.min(i,n[1]))-Math.max(e,Math.min(i,n[0]));return r}function kh(t,e,i){const r=[{fixed:-Ih,stretch:0}];for(const[e,i]of t){const t=r[r.length-1];r.push({fixed:e-t.stretch,stretch:t.stretch}),r.push({fixed:e-t.stretch,stretch:t.stretch+(i-e)})}return r.push({fixed:e+Ih,stretch:i}),r}function Ph(t,e,i,r){return t/e*i+r}function zh(t,e,i,r){return t-e*i/r}class Lh{constructor(t,e,i,r,a,o,s,l,c,h){if(this.boxStartIndex=t.length,c){let t=o.top,e=o.bottom;const i=o.collisionPadding;i&&(t-=i[1],e+=i[3]);let r=e-t;r>0&&(r=Math.max(10,r),this.circleDiameter=r)}else{let c=o.top*s-l[0],u=o.bottom*s+l[2],p=o.left*s-l[3],d=o.right*s+l[1];const m=o.collisionPadding;if(m&&(p-=m[0]*s,c-=m[1]*s,d+=m[2]*s,u+=m[3]*s),h){const t=new n(p,c),e=new n(d,c),i=new n(p,u),r=new n(d,u),a=h*Math.PI/180;t._rotate(a),e._rotate(a),i._rotate(a),r._rotate(a),p=Math.min(t.x,e.x,i.x,r.x),d=Math.max(t.x,e.x,i.x,r.x),c=Math.min(t.y,e.y,i.y,r.y),u=Math.max(t.y,e.y,i.y,r.y)}t.emplaceBack(e.x,e.y,p,c,d,u,i,r,a)}this.boxEndIndex=t.length}}class Dh{constructor(t=[],e=Rh){if(this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(let t=(this.length>>1)-1;t>=0;t--)this._down(t)}push(t){this.data.push(t),this.length++,this._up(this.length-1)}pop(){if(0===this.length)return;const t=this.data[0],e=this.data.pop();return this.length--,this.length>0&&(this.data[0]=e,this._down(0)),t}peek(){return this.data[0]}_up(t){const{data:e,compare:i}=this,r=e[t];for(;t>0;){const n=t-1>>1,a=e[n];if(i(r,a)>=0)break;e[t]=a,t=n}e[t]=r}_down(t){const{data:e,compare:i}=this,r=this.length>>1,n=e[t];for(;t<r;){let r=1+(t<<1),a=e[r];const o=r+1;if(o<this.length&&i(e[o],a)<0&&(r=o,a=e[o]),i(a,n)>=0)break;e[t]=a,t=r}e[t]=n}}function Rh(t,e){return t<e?-1:t>e?1:0}function Bh(t,e=1,i=!1){let r=1/0,a=1/0,o=-1/0,s=-1/0;const l=t[0];for(let t=0;t<l.length;t++){const e=l[t];(!t||e.x<r)&&(r=e.x),(!t||e.y<a)&&(a=e.y),(!t||e.x>o)&&(o=e.x),(!t||e.y>s)&&(s=e.y)}const c=Math.min(o-r,s-a);let h=c/2;const u=new Dh([],Fh);if(0===c)return new n(r,a);for(let e=r;e<o;e+=c)for(let i=a;i<s;i+=c)u.push(new Oh(e+h,i+h,h,t));let p=function(t){let e=0,i=0,r=0;const n=t[0];for(let t=0,a=n.length,o=a-1;t<a;o=t++){const a=n[t],s=n[o],l=a.x*s.y-s.x*a.y;i+=(a.x+s.x)*l,r+=(a.y+s.y)*l,e+=3*l}return new Oh(i/e,r/e,0,t)}(t),d=u.length;for(;u.length;){const r=u.pop();(r.d>p.d||!p.d)&&(p=r,i&&console.log("found best %d after %d probes",Math.round(1e4*r.d)/1e4,d)),r.max-p.d<=e||(h=r.h/2,u.push(new Oh(r.p.x-h,r.p.y-h,h,t)),u.push(new Oh(r.p.x+h,r.p.y-h,h,t)),u.push(new Oh(r.p.x-h,r.p.y+h,h,t)),u.push(new Oh(r.p.x+h,r.p.y+h,h,t)),d+=4)}return i&&(console.log(`num probes: ${d}`),console.log(`best distance: ${p.d}`)),p.p}function Fh(t,e){return e.max-t.max}function Oh(t,e,i,r){this.p=new n(t,e),this.h=i,this.d=function(t,e){let i=!1,r=1/0;for(let n=0;n<e.length;n++){const a=e[n];for(let e=0,n=a.length,o=n-1;e<n;o=e++){const n=a[e],s=a[o];n.y>t.y!=s.y>t.y&&t.x<(s.x-n.x)*(t.y-n.y)/(s.y-n.y)+n.x&&(i=!i),r=Math.min(r,mo(t,n,s))}}return(i?1:-1)*Math.sqrt(r)}(this.p,r),this.max=this.d+this.h*Math.SQRT2}var Uh;t.TextAnchorEnum=void 0,(Uh=t.TextAnchorEnum||(t.TextAnchorEnum={}))[Uh.center=1]="center",Uh[Uh.left=2]="left",Uh[Uh.right=3]="right",Uh[Uh.top=4]="top",Uh[Uh.bottom=5]="bottom",Uh[Uh["top-left"]=6]="top-left",Uh[Uh["top-right"]=7]="top-right",Uh[Uh["bottom-left"]=8]="bottom-left",Uh[Uh["bottom-right"]=9]="bottom-right";const Vh=7,Nh=Number.POSITIVE_INFINITY;function $h(t,e){return e[1]!==Nh?function(t,e,i){let r=0,n=0;switch(e=Math.abs(e),i=Math.abs(i),t){case"top-right":case"top-left":case"top":n=i-Vh;break;case"bottom-right":case"bottom-left":case"bottom":n=-i+Vh}switch(t){case"top-right":case"bottom-right":case"right":r=-e;break;case"top-left":case"bottom-left":case"left":r=e}return[r,n]}(t,e[0],e[1]):function(t,e){let i=0,r=0;e<0&&(e=0);const n=e/Math.SQRT2;switch(t){case"top-right":case"top-left":r=n-Vh;break;case"bottom-right":case"bottom-left":r=-n+Vh;break;case"bottom":r=-e+Vh;break;case"top":r=e-Vh}switch(t){case"top-right":case"bottom-right":i=-n;break;case"top-left":case"bottom-left":i=n;break;case"left":i=e;break;case"right":i=-e}return[i,r]}(t,e[0])}function jh(t,e,i){var r;const n=t.layout,a=null===(r=n.get("text-variable-anchor-offset"))||void 0===r?void 0:r.evaluate(e,{},i);if(a){const t=a.values,e=[];for(let i=0;i<t.length;i+=2){const r=e[i]=t[i],n=t[i+1].map((t=>t*Ml));r.startsWith("top")?n[1]-=Vh:r.startsWith("bottom")&&(n[1]+=Vh),e[i+1]=n}return new ie(e)}const o=n.get("text-variable-anchor");if(o){let r;r=void 0!==t._unevaluatedLayout.getValue("text-radial-offset")?[n.get("text-radial-offset").evaluate(e,{},i)*Ml,Nh]:n.get("text-offset").evaluate(e,{},i).map((t=>t*Ml));const a=[];for(const t of o)a.push(t,$h(t,r));return new ie(a)}return null}function qh(t){switch(t){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function Zh(e,i,r,n,a,o,s,l,c,h,u){let p=o.textMaxSize.evaluate(i,{});void 0===p&&(p=s);const d=e.layers[0].layout,m=d.get("icon-offset").evaluate(i,{},u),f=Hh(r.horizontal),g=s/24,_=e.tilePixelRatio*g,y=e.tilePixelRatio*p/24,x=e.tilePixelRatio*l,v=e.tilePixelRatio*d.get("symbol-spacing"),b=d.get("text-padding")*e.tilePixelRatio,E=function(t,e,i,r=1){const n=t.get("icon-padding").evaluate(e,{},i),a=n&&n.values;return[a[0]*r,a[1]*r,a[2]*r,a[3]*r]}(d,i,u,e.tilePixelRatio),T=d.get("text-max-angle")/180*Math.PI,S="viewport"!==d.get("text-rotation-alignment")&&"point"!==d.get("symbol-placement"),C="map"===d.get("icon-rotation-alignment")&&"point"!==d.get("symbol-placement"),I=d.get("symbol-placement"),A=v/2,M=d.get("icon-text-fit");let k;n&&"none"!==M&&(e.allowVerticalPlacement&&r.vertical&&(k=Tc(n,r.vertical,M,d.get("icon-text-fit-padding"),m,g)),f&&(n=Tc(n,f,M,d.get("icon-text-fit-padding"),m,g)));const P=(l,p)=>{p.x<0||p.x>=Qa||p.y<0||p.y>=Qa||function(e,i,r,n,a,o,s,l,c,h,u,p,d,m,f,g,_,y,x,v,b,E,T,S,C){const I=e.addToLineVertexArray(i,r);let A,M,k,P,z=0,L=0,D=0,R=0,B=-1,F=-1;const O={};let U=La("");if(e.allowVerticalPlacement&&n.vertical){const t=l.layout.get("text-rotate").evaluate(b,{},S)+90;k=new Lh(c,i,h,u,p,n.vertical,d,m,f,t),s&&(P=new Lh(c,i,h,u,p,s,_,y,f,t))}if(a){const r=l.layout.get("icon-rotate").evaluate(b,{}),n="none"!==l.layout.get("icon-text-fit"),o=Ah(a,r,T,n),d=s?Ah(s,r,T,n):void 0;M=new Lh(c,i,h,u,p,a,_,y,!1,r),z=4*o.length;const m=e.iconSizeData;let f=null;"source"===m.kind?(f=[Cc*l.layout.get("icon-size").evaluate(b,{})],f[0]>Ic&&w(`${e.layerIds[0]}: Value for "icon-size" is >= ${Sc}. Reduce your "icon-size".`)):"composite"===m.kind&&(f=[Cc*E.compositeIconSizes[0].evaluate(b,{},S),Cc*E.compositeIconSizes[1].evaluate(b,{},S)],(f[0]>Ic||f[1]>Ic)&&w(`${e.layerIds[0]}: Value for "icon-size" is >= ${Sc}. Reduce your "icon-size".`)),e.addSymbols(e.icon,o,f,v,x,b,t.WritingMode.none,i,I.lineStartIndex,I.lineLength,-1,S),B=e.icon.placedSymbolArray.length-1,d&&(L=4*d.length,e.addSymbols(e.icon,d,f,v,x,b,t.WritingMode.vertical,i,I.lineStartIndex,I.lineLength,-1,S),F=e.icon.placedSymbolArray.length-1)}const V=Object.keys(n.horizontal);for(const r of V){const a=n.horizontal[r];if(!A){U=La(a.text);const t=l.layout.get("text-rotate").evaluate(b,{},S);A=new Lh(c,i,h,u,p,a,d,m,f,t)}const s=1===a.positionedLines.length;if(D+=Gh(e,i,a,o,l,f,b,g,I,n.vertical?t.WritingMode.horizontal:t.WritingMode.horizontalOnly,s?V:[r],O,B,E,S),s)break}n.vertical&&(R+=Gh(e,i,n.vertical,o,l,f,b,g,I,t.WritingMode.vertical,["vertical"],O,F,E,S));const N=A?A.boxStartIndex:e.collisionBoxArray.length,$=A?A.boxEndIndex:e.collisionBoxArray.length,j=k?k.boxStartIndex:e.collisionBoxArray.length,q=k?k.boxEndIndex:e.collisionBoxArray.length,Z=M?M.boxStartIndex:e.collisionBoxArray.length,G=M?M.boxEndIndex:e.collisionBoxArray.length,H=P?P.boxStartIndex:e.collisionBoxArray.length,X=P?P.boxEndIndex:e.collisionBoxArray.length;let W=-1;const K=(t,e)=>t&&t.circleDiameter?Math.max(t.circleDiameter,e):e;W=K(A,W),W=K(k,W),W=K(M,W),W=K(P,W);const Y=W>-1?1:0;Y&&(W*=C/Ml),e.glyphOffsetArray.length>=Fc.MAX_GLYPHS&&w("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==b.sortKey&&e.addToSortKeyRanges(e.symbolInstances.length,b.sortKey);const J=jh(l,b,S),[Q,tt]=function(e,i){const r=e.length,n=null==i?void 0:i.values;if((null==n?void 0:n.length)>0)for(let i=0;i<n.length;i+=2){const r=n[i+1];e.emplaceBack(t.TextAnchorEnum[n[i]],r[0],r[1])}return[r,e.length]}(e.textAnchorOffsets,J);e.symbolInstances.emplaceBack(i.x,i.y,O.right>=0?O.right:-1,O.center>=0?O.center:-1,O.left>=0?O.left:-1,O.vertical||-1,B,F,U,N,$,j,q,Z,G,H,X,h,D,R,z,L,Y,0,d,W,Q,tt)}(e,p,l,r,n,a,k,e.layers[0],e.collisionBoxArray,i.index,i.sourceLayerIndex,e.index,_,[b,b,b,b],S,c,x,E,C,m,i,o,h,u,s)};if("line"===I)for(const t of yh(i.geometry,0,0,Qa,Qa)){const i=Sh(t,v,T,r.vertical||f,n,24,y,e.overscaling,Qa);for(const r of i)f&&Xh(e,f.text,A,r)||P(t,r)}else if("line-center"===I){for(const t of i.geometry)if(t.length>1){const e=Th(t,T,r.vertical||f,n,24,y);e&&P(t,e)}}else if("Polygon"===i.type)for(const t of Cs(i.geometry,0)){const e=Bh(t,16);P(t[0],new xh(e.x,e.y,0))}else if("LineString"===i.type)for(const t of i.geometry)P(t,new xh(t[0].x,t[0].y,0));else if("Point"===i.type)for(const t of i.geometry)for(const e of t)P([e],new xh(e.x,e.y,0))}function Gh(t,e,i,r,a,o,s,l,c,h,u,p,d,m,f){const g=function(t,e,i,r,a,o,s,l){const c=r.layout.get("text-rotate").evaluate(o,{})*Math.PI/180,h=[];for(const t of e.positionedLines)for(const r of t.positionedGlyphs){if(!r.rect)continue;const o=r.rect||{};let u=rc+1,p=!0,d=1,m=0;const f=(a||l)&&r.vertical,g=r.metrics.advance*r.scale/2;if(l&&e.verticalizable&&(m=t.lineOffset/2-(r.imageName?-(Ml-r.metrics.width*r.scale)/2:(r.scale-1)*Ml)),r.imageName){const t=s[r.imageName];p=t.sdf,d=t.pixelRatio,u=ac/d}const _=a?[r.x+g,r.y]:[0,0];let y=a?[0,0]:[r.x+g+i[0],r.y+i[1]-m],x=[0,0];f&&(x=y,y=[0,0]);const v=r.metrics.isDoubleResolution?2:1,b=(r.metrics.left-u)*r.scale-g+y[0],w=(-r.metrics.top-u)*r.scale+y[1],E=b+o.w/v*r.scale/d,T=w+o.h/v*r.scale/d,S=new n(b,w),C=new n(E,w),I=new n(b,T),A=new n(E,T);if(f){const t=new n(-g,g-cc),e=-Math.PI/2,i=Ml/2-g,a=new n(5-cc-i,-(r.imageName?i:0)),o=new n(...x);S._rotateAround(e,t)._add(a)._add(o),C._rotateAround(e,t)._add(a)._add(o),I._rotateAround(e,t)._add(a)._add(o),A._rotateAround(e,t)._add(a)._add(o)}if(c){const t=Math.sin(c),e=Math.cos(c),i=[e,-t,t,e];S._matMult(i),C._matMult(i),I._matMult(i),A._matMult(i)}const M=new n(0,0),k=new n(0,0);h.push({tl:S,tr:C,bl:I,br:A,tex:o,writingMode:e.writingMode,glyphOffset:_,sectionIndex:r.sectionIndex,isSDF:p,pixelOffsetTL:M,pixelOffsetBR:k,minFontScaleX:0,minFontScaleY:0})}return h}(0,i,l,a,o,s,r,t.allowVerticalPlacement),_=t.textSizeData;let y=null;"source"===_.kind?(y=[Cc*a.layout.get("text-size").evaluate(s,{})],y[0]>Ic&&w(`${t.layerIds[0]}: Value for "text-size" is >= ${Sc}. Reduce your "text-size".`)):"composite"===_.kind&&(y=[Cc*m.compositeTextSizes[0].evaluate(s,{},f),Cc*m.compositeTextSizes[1].evaluate(s,{},f)],(y[0]>Ic||y[1]>Ic)&&w(`${t.layerIds[0]}: Value for "text-size" is >= ${Sc}. Reduce your "text-size".`)),t.addSymbols(t.text,g,y,l,o,s,h,e,c.lineStartIndex,c.lineLength,d,f);for(const e of u)p[e]=t.text.placedSymbolArray.length-1;return 4*g.length}function Hh(t){for(const e in t)return t[e];return null}function Xh(t,e,i,r){const n=t.compareText;if(e in n){const t=n[e];for(let e=t.length-1;e>=0;e--)if(r.dist(t[e])<i)return!0}else n[e]=[];return n[e].push(r),!1}const Wh=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class Kh{static from(t){if(!(t instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[e,i]=new Uint8Array(t,0,2);if(219!==e)throw new Error("Data does not appear to be in a KDBush format.");const r=i>>4;if(1!==r)throw new Error(`Got v${r} data when expected v1.`);const n=Wh[15&i];if(!n)throw new Error("Unrecognized array type.");const[a]=new Uint16Array(t,2,1),[o]=new Uint32Array(t,4,1);return new Kh(o,a,n,t)}constructor(t,e=64,i=Float64Array,r){if(isNaN(t)||t<0)throw new Error(`Unpexpected numItems value: ${t}.`);this.numItems=+t,this.nodeSize=Math.min(Math.max(+e,2),65535),this.ArrayType=i,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;const n=Wh.indexOf(this.ArrayType),a=2*t*this.ArrayType.BYTES_PER_ELEMENT,o=t*this.IndexArrayType.BYTES_PER_ELEMENT,s=(8-o%8)%8;if(n<0)throw new Error(`Unexpected typed array class: ${i}.`);r&&r instanceof ArrayBuffer?(this.data=r,this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+o+s,2*t),this._pos=2*t,this._finished=!0):(this.data=new ArrayBuffer(8+a+o+s),this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+o+s,2*t),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+n]),new Uint16Array(this.data,2,1)[0]=e,new Uint32Array(this.data,4,1)[0]=t)}add(t,e){const i=this._pos>>1;return this.ids[i]=i,this.coords[this._pos++]=t,this.coords[this._pos++]=e,i}finish(){const t=this._pos>>1;if(t!==this.numItems)throw new Error(`Added ${t} items when expected ${this.numItems}.`);return Yh(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,e,i,r){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:n,coords:a,nodeSize:o}=this,s=[0,n.length-1,0],l=[];for(;s.length;){const c=s.pop()||0,h=s.pop()||0,u=s.pop()||0;if(h-u<=o){for(let o=u;o<=h;o++){const s=a[2*o],c=a[2*o+1];s>=t&&s<=i&&c>=e&&c<=r&&l.push(n[o])}continue}const p=u+h>>1,d=a[2*p],m=a[2*p+1];d>=t&&d<=i&&m>=e&&m<=r&&l.push(n[p]),(0===c?t<=d:e<=m)&&(s.push(u),s.push(p-1),s.push(1-c)),(0===c?i>=d:r>=m)&&(s.push(p+1),s.push(h),s.push(1-c))}return l}within(t,e,i){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:r,coords:n,nodeSize:a}=this,o=[0,r.length-1,0],s=[],l=i*i;for(;o.length;){const c=o.pop()||0,h=o.pop()||0,u=o.pop()||0;if(h-u<=a){for(let i=u;i<=h;i++)eu(n[2*i],n[2*i+1],t,e)<=l&&s.push(r[i]);continue}const p=u+h>>1,d=n[2*p],m=n[2*p+1];eu(d,m,t,e)<=l&&s.push(r[p]),(0===c?t-i<=d:e-i<=m)&&(o.push(u),o.push(p-1),o.push(1-c)),(0===c?t+i>=d:e+i>=m)&&(o.push(p+1),o.push(h),o.push(1-c))}return s}}function Yh(t,e,i,r,n,a){if(n-r<=i)return;const o=r+n>>1;Jh(t,e,o,r,n,a),Yh(t,e,i,r,o-1,1-a),Yh(t,e,i,o+1,n,1-a)}function Jh(t,e,i,r,n,a){for(;n>r;){if(n-r>600){const o=n-r+1,s=i-r+1,l=Math.log(o),c=.5*Math.exp(2*l/3),h=.5*Math.sqrt(l*c*(o-c)/o)*(s-o/2<0?-1:1);Jh(t,e,i,Math.max(r,Math.floor(i-s*c/o+h)),Math.min(n,Math.floor(i+(o-s)*c/o+h)),a)}const o=e[2*i+a];let s=r,l=n;for(Qh(t,e,r,i),e[2*n+a]>o&&Qh(t,e,r,n);s<l;){for(Qh(t,e,s,l),s++,l--;e[2*s+a]<o;)s++;for(;e[2*l+a]>o;)l--}e[2*r+a]===o?Qh(t,e,r,l):(l++,Qh(t,e,l,n)),l<=i&&(r=l+1),i<=l&&(n=l-1)}}function Qh(t,e,i,r){tu(t,i,r),tu(e,2*i,2*r),tu(e,2*i+1,2*r+1)}function tu(t,e,i){const r=t[e];t[e]=t[i],t[i]=r}function eu(t,e,i,r){const n=t-i,a=e-r;return n*n+a*a}var iu;t.PerformanceMarkers=void 0,(iu=t.PerformanceMarkers||(t.PerformanceMarkers={})).create="create",iu.load="load",iu.fullLoad="fullLoad";let ru=null,nu=[];const au=1e3/60,ou="loadTime",su="fullLoadTime",lu={mark(t){performance.mark(t)},frame(t){const e=t;null!=ru&&nu.push(e-ru),ru=e},clearMetrics(){ru=null,nu=[],performance.clearMeasures(ou),performance.clearMeasures(su);for(const e in t.PerformanceMarkers)performance.clearMarks(t.PerformanceMarkers[e])},getPerformanceMetrics(){performance.measure(ou,t.PerformanceMarkers.create,t.PerformanceMarkers.load),performance.measure(su,t.PerformanceMarkers.create,t.PerformanceMarkers.fullLoad);const e=performance.getEntriesByName(ou)[0].duration,i=performance.getEntriesByName(su)[0].duration,r=nu.length,n=1/(nu.reduce(((t,e)=>t+e),0)/r/1e3),a=nu.filter((t=>t>au)).reduce(((t,e)=>t+(e-au)/au),0);return{loadTime:e,fullLoadTime:i,fps:n,percentDroppedFrames:a/(r+a)*100,totalFrames:r}}};t.AJAXError=F,t.ARRAY_TYPE=So,t.Actor=class{constructor(t,e,i){this.receive=t=>{const e=t.data,i=e.id;if(i&&(!e.targetMapId||this.mapId===e.targetMapId))if("<cancel>"===e.type){delete this.tasks[i];const t=this.cancelCallbacks[i];delete this.cancelCallbacks[i],t&&t()}else S()||e.mustQueue?(this.tasks[i]=e,this.taskQueue.push(i),this.invoker.trigger()):this.processTask(i,e)},this.process=()=>{if(!this.taskQueue.length)return;const t=this.taskQueue.shift(),e=this.tasks[t];delete this.tasks[t],this.taskQueue.length&&this.invoker.trigger(),e&&this.processTask(t,e)},this.target=t,this.parent=e,this.mapId=i,this.callbacks={},this.tasks={},this.taskQueue=[],this.cancelCallbacks={},this.invoker=new Kc(this.process),this.target.addEventListener("message",this.receive,!1),this.globalScope=S()?t:window}send(t,e,i,r,n=!1){const a=Math.round(1e18*Math.random()).toString(36).substring(0,10);i&&(this.callbacks[a]=i);const o=I(this.globalScope)?void 0:[];return this.target.postMessage({id:a,type:t,hasCallback:!!i,targetMapId:r,mustQueue:n,sourceMapId:this.mapId,data:Fr(e,o)},o),{cancel:()=>{i&&delete this.callbacks[a],this.target.postMessage({id:a,type:"<cancel>",targetMapId:r,sourceMapId:this.mapId})}}}processTask(t,e){if("<response>"===e.type){const i=this.callbacks[t];delete this.callbacks[t],i&&(e.error?i(Or(e.error)):i(null,Or(e.data)))}else{let i=!1;const r=I(this.globalScope)?void 0:[],n=e.hasCallback?(e,n)=>{i=!0,delete this.cancelCallbacks[t],this.target.postMessage({id:t,type:"<response>",sourceMapId:this.mapId,error:e?Fr(e):null,data:Fr(n,r)},r)}:t=>{i=!0};let a=null;const o=Or(e.data);if(this.parent[e.type])a=this.parent[e.type](e.sourceMapId,o,n);else if(this.parent.getWorkerSource){const t=e.type.split(".");a=this.parent.getWorkerSource(e.sourceMapId,t[0],o.source)[t[1]](o,n)}else n(new Error(`Could not find function ${e.type}`));!i&&a&&a.cancel&&(this.cancelCallbacks[t]=a.cancel)}}remove(){this.invoker.remove(),this.target.removeEventListener("message",this.receive,!1)}},t.AlphaImage=Uo,t.CanonicalTileID=sh,t.CollisionBoxArray=ta,t.CollisionCircleLayoutArray=class extends $n{},t.Color=Kt,t.DEMData=uh,t.DataConstantProperty=_n,t.DictionaryCoder=ph,t.EXTENT=Qa,t.ErrorEvent=H,t.EvaluationParameters=ln,t.Event=G,t.Evented=X,t.FeatureIndex=mh,t.FillBucket=ks,t.FillExtrusionBucket=Qs,t.GeoJSONFeature=dh,t.ImageAtlas=sc,t.ImagePosition=oc,t.KDBush=Kh,t.LineBucket=ml,t.LineStripIndexArray=class extends Yn{},t.LngLat=Jc,t.MercatorCoordinate=ah,t.ONE_EM=Ml,t.OverscaledTileID=ch,t.PerformanceUtils=lu,t.Point=n,t.Pos3dArray=class extends Pn{},t.PosArray=ua,t.Properties=wn,t.Protobuf=Jl,t.QuadTriangleArray=class extends qn{},t.RGBAImage=Vo,t.RasterBoundsArray=class extends zn{},t.RequestPerformance=class{constructor(t){this._marks={start:[t.url,"start"].join("#"),end:[t.url,"end"].join("#"),measure:t.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let t=performance.getEntriesByName(this._marks.measure);return 0===t.length&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),t=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),t}},t.SegmentVector=Ia,t.SymbolBucket=Fc,t.Transitionable=un,t.TriangleIndexArray=Ea,t.Uniform1f=Ua,t.Uniform1i=class extends Oa{constructor(t,e){super(t,e),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1i(this.location,t))}},t.Uniform2f=class extends Oa{constructor(t,e){super(t,e),this.current=[0,0]}set(t){t[0]===this.current[0]&&t[1]===this.current[1]||(this.current=t,this.gl.uniform2f(this.location,t[0],t[1]))}},t.Uniform3f=class extends Oa{constructor(t,e){super(t,e),this.current=[0,0,0]}set(t){t[0]===this.current[0]&&t[1]===this.current[1]&&t[2]===this.current[2]||(this.current=t,this.gl.uniform3f(this.location,t[0],t[1],t[2]))}},t.Uniform4f=Va,t.UniformColor=Na,t.UniformMatrix4f=class extends Oa{constructor(t,e){super(t,e),this.current=$a}set(t){if(t[12]!==this.current[12]||t[0]!==this.current[0])return this.current=t,void this.gl.uniformMatrix4fv(this.location,!1,t);for(let e=1;e<16;e++)if(t[e]!==this.current[e]){this.current=t,this.gl.uniformMatrix4fv(this.location,!1,t);break}}},t.UnwrappedTileID=lh,t.ValidationError=st,t.ZoomHistory=Ur,t.addDynamicAttributes=Lc,t.arrayBufferToImage=function(t,e){const i=new Image;i.onload=()=>{e(null,i),URL.revokeObjectURL(i.src),i.onload=null,window.requestAnimationFrame((()=>{i.src=M}))},i.onerror=()=>e(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const r=new Blob([new Uint8Array(t)],{type:"image/png"});i.src=t.byteLength?URL.createObjectURL(r):M},t.arrayBufferToImageBitmap=function(t,e){const i=new Blob([new Uint8Array(t)],{type:"image/png"});createImageBitmap(i).then((t=>{e(null,t)})).catch((t=>{e(new Error(`Could not load image because of ${t.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))}))},t.asyncAll=function(t,e,i){if(!t.length)return i(null,[]);let r=t.length;const n=new Array(t.length);let a=null;t.forEach(((t,o)=>{e(t,((t,e)=>{t&&(a=t),n[o]=e,0==--r&&i(a,n)}))}))},t.bezier=p,t.browser=R,t.clamp=m,t.clipLine=yh,t.clone=function(t){var e=new So(16);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},t.clone$1=v,t.collisionCircleLayout=Cl,t.config=B,t.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},t.create=function(){var t=new So(16);return So!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t},t.createExpression=Bi,t.createFilter=qi,t.createLayout=An,t.createStyleLayer=function(t){if("custom"===t.type)return new Wc(t);switch(t.type){case"background":return new Zc(t);case"circle":return new Po(t);case"fill":return new Ds(t);case"fill-extrusion":return new nl(t);case"heatmap":return new $o(t);case"hillshade":return new Zo(t);case"line":return new vl(t);case"raster":return new Xc(t);case"symbol":return new $c(t)}},t.deepEqual=function t(e,i){if(Array.isArray(e)){if(!Array.isArray(i)||e.length!==i.length)return!1;for(let r=0;r<e.length;r++)if(!t(e[r],i[r]))return!1;return!0}if("object"==typeof e&&null!==e&&null!==i){if("object"!=typeof i)return!1;if(Object.keys(e).length!==Object.keys(i).length)return!1;for(const r in e)if(!t(e[r],i[r]))return!1;return!0}return e===i},t.defaultEasing=d,t.derefLayers=function(t){t=t.slice();const e=Object.create(null);for(let i=0;i<t.length;i++)e[t[i].id]=t[i];for(let i=0;i<t.length;i++)"ref"in t[i]&&(t[i]=Y(t[i],e[t[i].ref]));return t},t.diffStyles=function(t,e){if(!t)return[{command:Q.setStyle,args:[e]}];let i=[];try{if(!J(t.version,e.version))return[{command:Q.setStyle,args:[e]}];J(t.center,e.center)||i.push({command:Q.setCenter,args:[e.center]}),J(t.zoom,e.zoom)||i.push({command:Q.setZoom,args:[e.zoom]}),J(t.bearing,e.bearing)||i.push({command:Q.setBearing,args:[e.bearing]}),J(t.pitch,e.pitch)||i.push({command:Q.setPitch,args:[e.pitch]}),J(t.sprite,e.sprite)||i.push({command:Q.setSprite,args:[e.sprite]}),J(t.glyphs,e.glyphs)||i.push({command:Q.setGlyphs,args:[e.glyphs]}),J(t.transition,e.transition)||i.push({command:Q.setTransition,args:[e.transition]}),J(t.light,e.light)||i.push({command:Q.setLight,args:[e.light]});const r={},n=[];!function(t,e,i,r){let n;for(n in e=e||{},t=t||{})Object.prototype.hasOwnProperty.call(t,n)&&(Object.prototype.hasOwnProperty.call(e,n)||et(n,i,r));for(n in e)Object.prototype.hasOwnProperty.call(e,n)&&(Object.prototype.hasOwnProperty.call(t,n)?J(t[n],e[n])||("geojson"===t[n].type&&"geojson"===e[n].type&&rt(t,e,n)?i.push({command:Q.setGeoJSONSourceData,args:[n,e[n].data]}):it(n,e,i,r)):tt(n,e,i))}(t.sources,e.sources,n,r);const a=[];t.layers&&t.layers.forEach((t=>{r[t.source]?i.push({command:Q.removeLayer,args:[t.id]}):a.push(t)})),i=i.concat(n),function(t,e,i){e=e||[];const r=(t=t||[]).map(at),n=e.map(at),a=t.reduce(ot,{}),o=e.reduce(ot,{}),s=r.slice(),l=Object.create(null);let c,h,u,p,d,m,f;for(c=0,h=0;c<r.length;c++)u=r[c],Object.prototype.hasOwnProperty.call(o,u)?h++:(i.push({command:Q.removeLayer,args:[u]}),s.splice(s.indexOf(u,h),1));for(c=0,h=0;c<n.length;c++)u=n[n.length-1-c],s[s.length-1-c]!==u&&(Object.prototype.hasOwnProperty.call(a,u)?(i.push({command:Q.removeLayer,args:[u]}),s.splice(s.lastIndexOf(u,s.length-h),1)):h++,m=s[s.length-c],i.push({command:Q.addLayer,args:[o[u],m]}),s.splice(s.length-c,0,u),l[u]=!0);for(c=0;c<n.length;c++)if(u=n[c],p=a[u],d=o[u],!l[u]&&!J(p,d))if(J(p.source,d.source)&&J(p["source-layer"],d["source-layer"])&&J(p.type,d.type)){for(f in nt(p.layout,d.layout,i,u,null,Q.setLayoutProperty),nt(p.paint,d.paint,i,u,null,Q.setPaintProperty),J(p.filter,d.filter)||i.push({command:Q.setFilter,args:[u,d.filter]}),J(p.minzoom,d.minzoom)&&J(p.maxzoom,d.maxzoom)||i.push({command:Q.setLayerZoomRange,args:[u,d.minzoom,d.maxzoom]}),p)Object.prototype.hasOwnProperty.call(p,f)&&"layout"!==f&&"paint"!==f&&"filter"!==f&&"metadata"!==f&&"minzoom"!==f&&"maxzoom"!==f&&(0===f.indexOf("paint.")?nt(p[f],d[f],i,u,f.slice(6),Q.setPaintProperty):J(p[f],d[f])||i.push({command:Q.setLayerProperty,args:[u,f,d[f]]}));for(f in d)Object.prototype.hasOwnProperty.call(d,f)&&!Object.prototype.hasOwnProperty.call(p,f)&&"layout"!==f&&"paint"!==f&&"filter"!==f&&"metadata"!==f&&"minzoom"!==f&&"maxzoom"!==f&&(0===f.indexOf("paint.")?nt(p[f],d[f],i,u,f.slice(6),Q.setPaintProperty):J(p[f],d[f])||i.push({command:Q.setLayerProperty,args:[u,f,d[f]]}))}else i.push({command:Q.removeLayer,args:[u]}),m=s[s.lastIndexOf(u)+1],i.push({command:Q.addLayer,args:[d,m]})}(a,e.layers,i)}catch(t){console.warn("Unable to compute style diff:",t),i=[{command:Q.setStyle,args:[e]}]}return i},t.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]},t.earthRadius=Yc,t.emitValidationErrors=zr,t.emptyStyle=function(){const t={},e=W.$version;for(const i in W.$root){const r=W.$root[i];if(r.required){let n=null;n="version"===i?e:"array"===r.type?[]:{},null!=n&&(t[i]=n)}}return t},t.equals=function(t,e){var i=t[0],r=t[1],n=t[2],a=t[3],o=t[4],s=t[5],l=t[6],c=t[7],h=t[8],u=t[9],p=t[10],d=t[11],m=t[12],f=t[13],g=t[14],_=t[15],y=e[0],x=e[1],v=e[2],b=e[3],w=e[4],E=e[5],T=e[6],S=e[7],C=e[8],I=e[9],A=e[10],M=e[11],k=e[12],P=e[13],z=e[14],L=e[15];return Math.abs(i-y)<=To*Math.max(1,Math.abs(i),Math.abs(y))&&Math.abs(r-x)<=To*Math.max(1,Math.abs(r),Math.abs(x))&&Math.abs(n-v)<=To*Math.max(1,Math.abs(n),Math.abs(v))&&Math.abs(a-b)<=To*Math.max(1,Math.abs(a),Math.abs(b))&&Math.abs(o-w)<=To*Math.max(1,Math.abs(o),Math.abs(w))&&Math.abs(s-E)<=To*Math.max(1,Math.abs(s),Math.abs(E))&&Math.abs(l-T)<=To*Math.max(1,Math.abs(l),Math.abs(T))&&Math.abs(c-S)<=To*Math.max(1,Math.abs(c),Math.abs(S))&&Math.abs(h-C)<=To*Math.max(1,Math.abs(h),Math.abs(C))&&Math.abs(u-I)<=To*Math.max(1,Math.abs(u),Math.abs(I))&&Math.abs(p-A)<=To*Math.max(1,Math.abs(p),Math.abs(A))&&Math.abs(d-M)<=To*Math.max(1,Math.abs(d),Math.abs(M))&&Math.abs(m-k)<=To*Math.max(1,Math.abs(m),Math.abs(k))&&Math.abs(f-P)<=To*Math.max(1,Math.abs(f),Math.abs(P))&&Math.abs(g-z)<=To*Math.max(1,Math.abs(g),Math.abs(z))&&Math.abs(_-L)<=To*Math.max(1,Math.abs(_),Math.abs(L))},t.evaluateSizeForFeature=function(t,{uSize:e,uSizeT:i},{lowerSize:r,upperSize:n}){return"source"===t.kind?r/Cc:"composite"===t.kind?Ze.number(r/Cc,n/Cc,i):e},t.evaluateSizeForZoom=function(t,e){let i=0,r=0;if("constant"===t.kind)r=t.layoutSize;else if("source"!==t.kind){const{interpolationType:n,minZoom:a,maxZoom:o}=t,s=n?m(Ge.interpolationFactor(n,e,a,o),0,1):0;"camera"===t.kind?r=Ze.number(t.minSize,t.maxSize,s):i=s}return{uSizeT:i,uSize:r}},t.evented=nn,t.extend=g,t.filterObject=x,t.findLineIntersection=function(t,e,i,r){const a=e.y-t.y,o=e.x-t.x,s=r.y-i.y,l=r.x-i.x,c=s*o-l*a;if(0===c)return null;const h=(l*(t.y-i.y)-s*(t.x-i.x))/c;return new n(t.x+h*o,t.y+h*a)},t.fromScaling=function(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e[1],t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e[2],t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},t.getAnchorAlignment=bc,t.getAnchorJustification=qh,t.getArrayBuffer=$,t.getDefaultExportFromCjs=e,t.getImageData=async function(t,e,i,r,n){if(u())try{return await k(t,e,i,r,n)}catch(t){}return function(t,e,i,r,n){const a=t.width,o=t.height;P&&z||(P=new OffscreenCanvas(a,o),z=P.getContext("2d",{willReadFrequently:!0})),P.width=a,P.height=o,z.drawImage(t,0,0,a,o);const s=z.getImageData(e,i,r,n);return z.clearRect(0,0,a,o),s.data}(t,e,i,r,n)},t.getJSON=function(t,e){return N(g(t,{type:"json"}),e)},t.getOverlapMode=Mc,t.getProtocolAction=U,t.getRTLTextPluginStatus=an,t.getReferrer=O,t.getVideo=function(t,e){const i=window.document.createElement("video");i.muted=!0,i.onloadstart=function(){e(null,i)};for(let e=0;e<t.length;e++){const r=window.document.createElement("source");j(t[e])||(i.crossOrigin="Anonymous"),r.src=t[e],i.appendChild(r)}return{cancel:()=>{}}},t.groupByLayout=function(t,e){const i={};for(let r=0;r<t.length;r++){const n=e&&e[t[r].id]||Qi(t[r]);e&&(e[t[r].id]=n);let a=i[n];a||(a=i[n]=[]),a.push(t[r])}const r=[];for(const t in i)r.push(i[t]);return r},t.identity=Co,t.interpolate=Ze,t.invert=function(t,e){var i=e[0],r=e[1],n=e[2],a=e[3],o=e[4],s=e[5],l=e[6],c=e[7],h=e[8],u=e[9],p=e[10],d=e[11],m=e[12],f=e[13],g=e[14],_=e[15],y=i*s-r*o,x=i*l-n*o,v=i*c-a*o,b=r*l-n*s,w=r*c-a*s,E=n*c-a*l,T=h*f-u*m,S=h*g-p*m,C=h*_-d*m,I=u*g-p*f,A=u*_-d*f,M=p*_-d*g,k=y*M-x*A+v*I+b*C-w*S+E*T;return k?(t[0]=(s*M-l*A+c*I)*(k=1/k),t[1]=(n*A-r*M-a*I)*k,t[2]=(f*E-g*w+_*b)*k,t[3]=(p*w-u*E-d*b)*k,t[4]=(l*C-o*M-c*S)*k,t[5]=(i*M-n*C+a*S)*k,t[6]=(g*v-m*E-_*x)*k,t[7]=(h*E-p*v+d*x)*k,t[8]=(o*A-s*C+c*T)*k,t[9]=(r*C-i*A-a*T)*k,t[10]=(m*w-f*v+_*y)*k,t[11]=(u*v-h*w-d*y)*k,t[12]=(s*S-o*I-l*T)*k,t[13]=(i*I-r*S+n*T)*k,t[14]=(f*x-m*b-g*y)*k,t[15]=(h*b-u*x+p*y)*k,t):null},t.isImageBitmap=A,t.isOffscreenCanvasDistorted=u,t.isSafari=I,t.isWorker=S,t.keysDifference=function(t,e){const i=[];for(const r in t)r in e||i.push(r);return i},t.lazyLoadRTLTextPlugin=function(){sn.isLoading()||sn.isLoaded()||"deferred"!==an()||on()},t.makeRequest=N,t.mapObject=y,t.mercatorXfromLng=eh,t.mercatorYfromLat=ih,t.mercatorZfromAltitude=rh,t.mul=Mo,t.mul$1=function(t,e,i){return t[0]=e[0]*i[0],t[1]=e[1]*i[1],t[2]=e[2]*i[2],t[3]=e[3]*i[3],t},t.multiply=Io,t.nextPowerOfTwo=function(t){return t<=1?1:Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))},t.offscreenCanvasSupported=h,t.operations=Q,t.ortho=function(t,e,i,r,n,a,o){var s=1/(e-i),l=1/(r-n),c=1/(a-o);return t[0]=-2*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*l,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*c,t[11]=0,t[12]=(e+i)*s,t[13]=(n+r)*l,t[14]=(o+a)*c,t[15]=1,t},t.parseCacheControl=function(t){const e={};if(t.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,((t,i,r,n)=>{const a=r||n;return e[i]=!a||a.toLowerCase(),""})),e["max-age"]){const t=parseInt(e["max-age"],10);isNaN(t)?delete e["max-age"]:e["max-age"]=t}return e},t.parseGlyphPbf=function(t){return new Jl(t).readFields(tc,[])},t.pbf=kl,t.performSymbolLayout=function(e){e.bucket.createArrays(),e.bucket.tilePixelRatio=Qa/(512*e.bucket.overscaling),e.bucket.compareText={},e.bucket.iconsNeedLinear=!1;const i=e.bucket.layers[0],r=i.layout,n=i._unevaluatedLayout._values,a={layoutIconSize:n["icon-size"].possiblyEvaluate(new ln(e.bucket.zoom+1),e.canonical),layoutTextSize:n["text-size"].possiblyEvaluate(new ln(e.bucket.zoom+1),e.canonical),textMaxSize:n["text-size"].possiblyEvaluate(new ln(18))};if("composite"===e.bucket.textSizeData.kind){const{minZoom:t,maxZoom:i}=e.bucket.textSizeData;a.compositeTextSizes=[n["text-size"].possiblyEvaluate(new ln(t),e.canonical),n["text-size"].possiblyEvaluate(new ln(i),e.canonical)]}if("composite"===e.bucket.iconSizeData.kind){const{minZoom:t,maxZoom:i}=e.bucket.iconSizeData;a.compositeIconSizes=[n["icon-size"].possiblyEvaluate(new ln(t),e.canonical),n["icon-size"].possiblyEvaluate(new ln(i),e.canonical)]}const o=r.get("text-line-height")*Ml,s="viewport"!==r.get("text-rotation-alignment")&&"point"!==r.get("symbol-placement"),l=r.get("text-keep-upright"),c=r.get("text-size");for(const n of e.bucket.features){const h=r.get("text-font").evaluate(n,{},e.canonical).join(","),u=c.evaluate(n,{},e.canonical),p=a.layoutTextSize.evaluate(n,{},e.canonical),d=a.layoutIconSize.evaluate(n,{},e.canonical),m={horizontal:{},vertical:void 0},f=n.text;let g,_=[0,0];if(f){const a=f.toString(),c=r.get("text-letter-spacing").evaluate(n,{},e.canonical)*Ml,d=$r(a)?c:0,g=r.get("text-anchor").evaluate(n,{},e.canonical),y=jh(i,n,e.canonical);if(!y){const t=r.get("text-radial-offset").evaluate(n,{},e.canonical);_=t?$h(g,[t*Ml,Nh]):r.get("text-offset").evaluate(n,{},e.canonical).map((t=>t*Ml))}let x=s?"center":r.get("text-justify").evaluate(n,{},e.canonical);const v=r.get("symbol-placement"),b="point"===v?r.get("text-max-width").evaluate(n,{},e.canonical)*Ml:0,w=()=>{e.bucket.allowVerticalPlacement&&Nr(a)&&(m.vertical=pc(f,e.glyphMap,e.glyphPositions,e.imagePositions,h,b,o,g,"left",d,_,t.WritingMode.vertical,!0,v,p,u))};if(!s&&y){const i=new Set;if("auto"===x)for(let t=0;t<y.values.length;t+=2)i.add(qh(y.values[t]));else i.add(x);let r=!1;for(const n of i)if(!m.horizontal[n])if(r)m.horizontal[n]=m.horizontal[0];else{const i=pc(f,e.glyphMap,e.glyphPositions,e.imagePositions,h,b,o,"center",n,d,_,t.WritingMode.horizontal,!1,v,p,u);i&&(m.horizontal[n]=i,r=1===i.positionedLines.length)}w()}else{"auto"===x&&(x=qh(g));const i=pc(f,e.glyphMap,e.glyphPositions,e.imagePositions,h,b,o,g,x,d,_,t.WritingMode.horizontal,!1,v,p,u);i&&(m.horizontal[x]=i),w(),Nr(a)&&s&&l&&(m.vertical=pc(f,e.glyphMap,e.glyphPositions,e.imagePositions,h,b,o,g,x,d,_,t.WritingMode.vertical,!1,v,p,u))}}let y=!1;if(n.icon&&n.icon.name){const t=e.imageMap[n.icon.name];t&&(g=Ec(e.imagePositions[n.icon.name],r.get("icon-offset").evaluate(n,{},e.canonical),r.get("icon-anchor").evaluate(n,{},e.canonical)),y=!!t.sdf,void 0===e.bucket.sdfIcons?e.bucket.sdfIcons=y:e.bucket.sdfIcons!==y&&w("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(t.pixelRatio!==e.bucket.pixelRatio||0!==r.get("icon-rotate").constantOr(1))&&(e.bucket.iconsNeedLinear=!0))}const x=Hh(m.horizontal)||m.vertical;e.bucket.iconsInText=!!x&&x.iconsInText,(x||g)&&Zh(e.bucket,n,m,g,e.imageMap,a,p,d,_,y,e.canonical)}e.showCollisionBoxes&&e.bucket.generateCollisionDebugBuffers()},t.perspective=function(t,e,i,r,n){var a,o=1/Math.tan(e/2);return t[0]=o/i,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=o,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,null!=n&&n!==1/0?(t[10]=(n+r)*(a=1/(r-n)),t[14]=2*n*r*a):(t[10]=-1,t[14]=-2*r),t},t.pick=function(t,e){const i={};for(let r=0;r<e.length;r++){const n=e[r];n in t&&(i[n]=t[n])}return i},t.plugin=sn,t.pointGeometry=i,t.polygonIntersectsPolygon=oo,t.potpack=nc,t.readImageUsingVideoFrame=k,t.register=Rr,t.registerForPluginStateChange=function(t){return t({pluginStatus:Qr,pluginURL:tn}),nn.on("pluginStateChange",t),t},t.renderColorRamp=No,t.rotateX=function(t,e,i){var r=Math.sin(i),n=Math.cos(i),a=e[4],o=e[5],s=e[6],l=e[7],c=e[8],h=e[9],u=e[10],p=e[11];return e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=a*n+c*r,t[5]=o*n+h*r,t[6]=s*n+u*r,t[7]=l*n+p*r,t[8]=c*n-a*r,t[9]=h*n-o*r,t[10]=u*n-s*r,t[11]=p*n-l*r,t},t.rotateZ=function(t,e,i){var r=Math.sin(i),n=Math.cos(i),a=e[0],o=e[1],s=e[2],l=e[3],c=e[4],h=e[5],u=e[6],p=e[7];return e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=a*n+c*r,t[1]=o*n+h*r,t[2]=s*n+u*r,t[3]=l*n+p*r,t[4]=c*n-a*r,t[5]=h*n-o*r,t[6]=u*n-s*r,t[7]=p*n-l*r,t},t.sameOrigin=j,t.scale=function(t,e,i){var r=i[0],n=i[1],a=i[2];return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*a,t[9]=e[9]*a,t[10]=e[10]*a,t[11]=e[11]*a,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},t.setRTLTextPlugin=function(t,e,i=!1){if(Qr===Wr||Qr===Kr||Qr===Yr)throw new Error("setRTLTextPlugin cannot be called multiple times.");tn=R.resolveURL(t),Qr=Wr,Jr=e,rn(),i||on()},t.sphericalToCartesian=function([t,e,i]){return e+=90,e*=Math.PI/180,i*=Math.PI/180,{x:t*Math.cos(e)*Math.sin(i),y:t*Math.sin(e)*Math.sin(i),z:t*Math.cos(i)}},t.toEvaluationFeature=ro,t.transformMat4=ko,t.translate=function(t,e,i){var r,n,a,o,s,l,c,h,u,p,d,m,f=i[0],g=i[1],_=i[2];return e===t?(t[12]=e[0]*f+e[4]*g+e[8]*_+e[12],t[13]=e[1]*f+e[5]*g+e[9]*_+e[13],t[14]=e[2]*f+e[6]*g+e[10]*_+e[14],t[15]=e[3]*f+e[7]*g+e[11]*_+e[15]):(n=e[1],a=e[2],o=e[3],s=e[4],l=e[5],c=e[6],h=e[7],u=e[8],p=e[9],d=e[10],m=e[11],t[0]=r=e[0],t[1]=n,t[2]=a,t[3]=o,t[4]=s,t[5]=l,t[6]=c,t[7]=h,t[8]=u,t[9]=p,t[10]=d,t[11]=m,t[12]=r*f+s*g+u*_+e[12],t[13]=n*f+l*g+p*_+e[13],t[14]=a*f+c*g+d*_+e[14],t[15]=o*f+h*g+m*_+e[15]),t},t.triggerPluginCompletionEvent=en,t.unicodeBlockLookup=Vr,t.uniqueId=function(){return _++},t.v8Spec=W,t.validateCustomStyleLayer=function(t){const e=[],i=t.id;return void 0===i&&e.push({message:`layers.${i}: missing required property "id"`}),void 0===t.render&&e.push({message:`layers.${i}: missing required method "render"`}),t.renderingMode&&"2d"!==t.renderingMode&&"3d"!==t.renderingMode&&e.push({message:`layers.${i}: property "renderingMode" must be either "2d" or "3d"`}),e},t.validateLight=Mr,t.validateStyle=Ar,t.vectorTile=Os,t.warnOnce=w,t.wrap=f})),r(0,(function(t){class e{constructor(t){this.keyCache={},t&&this.replace(t)}replace(t){this._layerConfigs={},this._layers={},this.update(t,[])}update(e,i){for(const i of e){this._layerConfigs[i.id]=i;const e=this._layers[i.id]=t.createStyleLayer(i);e._featureFilter=t.createFilter(e.filter),this.keyCache[i.id]&&delete this.keyCache[i.id]}for(const t of i)delete this.keyCache[t],delete this._layerConfigs[t],delete this._layers[t];this.familiesBySource={};const r=t.groupByLayout(Object.values(this._layerConfigs),this.keyCache);for(const t of r){const e=t.map((t=>this._layers[t.id])),i=e[0];if("none"===i.visibility)continue;const r=i.source||"";let n=this.familiesBySource[r];n||(n=this.familiesBySource[r]={});const a=i.sourceLayer||"_geojsonTileLayer";let o=n[a];o||(o=n[a]=[]),o.push(e)}}}class i{constructor(e){const i={},r=[];for(const t in e){const n=e[t],a=i[t]={};for(const t in n){const e=n[+t];if(!e||0===e.bitmap.width||0===e.bitmap.height)continue;const i={x:0,y:0,w:e.bitmap.width+2,h:e.bitmap.height+2};r.push(i),a[t]={rect:i,metrics:e.metrics}}}const{w:n,h:a}=t.potpack(r),o=new t.AlphaImage({width:n||1,height:a||1});for(const r in e){const n=e[r];for(const e in n){const a=n[+e];if(!a||0===a.bitmap.width||0===a.bitmap.height)continue;const s=i[r][e].rect;t.AlphaImage.copy(a.bitmap,o,{x:0,y:0},{x:s.x+1,y:s.y+1},a.bitmap)}}this.image=o,this.positions=i}}t.register("GlyphAtlas",i);class r{constructor(e){this.tileID=new t.OverscaledTileID(e.tileID.overscaledZ,e.tileID.wrap,e.tileID.canonical.z,e.tileID.canonical.x,e.tileID.canonical.y),this.uid=e.uid,this.zoom=e.zoom,this.pixelRatio=e.pixelRatio,this.tileSize=e.tileSize,this.source=e.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=e.showCollisionBoxes,this.collectResourceTiming=!!e.collectResourceTiming,this.returnDependencies=!!e.returnDependencies,this.promoteId=e.promoteId,this.inFlightDependencies=[],this.dependencySentinel=-1}parse(e,r,a,o,s){this.status="parsing",this.data=e,this.collisionBoxArray=new t.CollisionBoxArray;const l=new t.DictionaryCoder(Object.keys(e.layers).sort()),c=new t.FeatureIndex(this.tileID,this.promoteId);c.bucketLayerIDs=[];const h={},u={featureIndex:c,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:a},p=r.familiesBySource[this.source];for(const i in p){const r=e.layers[i];if(!r)continue;1===r.version&&t.warnOnce(`Vector tile source "${this.source}" layer "${i}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const o=l.encode(i),s=[];for(let t=0;t<r.length;t++){const e=r.feature(t),n=c.getId(e,i);s.push({feature:e,id:n,index:t,sourceLayerIndex:o})}for(const e of p[i]){const i=e[0];i.source!==this.source&&t.warnOnce(`layer.source = ${i.source} does not equal this.source = ${this.source}`),i.minzoom&&this.zoom<Math.floor(i.minzoom)||i.maxzoom&&this.zoom>=i.maxzoom||"none"!==i.visibility&&(n(e,this.zoom,a),(h[i.id]=i.createBucket({index:c.bucketLayerIDs.length,layers:e,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:o,sourceID:this.source})).populate(s,u,this.tileID.canonical),c.bucketLayerIDs.push(e.map((t=>t.id))))}}let d,m,f,g;const _=t.mapObject(u.glyphDependencies,(t=>Object.keys(t).map(Number)));this.inFlightDependencies.forEach((t=>null==t?void 0:t.cancel())),this.inFlightDependencies=[];const y=++this.dependencySentinel;Object.keys(_).length?this.inFlightDependencies.push(o.send("getGlyphs",{uid:this.uid,stacks:_,source:this.source,tileID:this.tileID,type:"glyphs"},((t,e)=>{y===this.dependencySentinel&&(d||(d=t,m=e,b.call(this)))}))):m={};const x=Object.keys(u.iconDependencies);x.length?this.inFlightDependencies.push(o.send("getImages",{icons:x,source:this.source,tileID:this.tileID,type:"icons"},((t,e)=>{y===this.dependencySentinel&&(d||(d=t,f=e,b.call(this)))}))):f={};const v=Object.keys(u.patternDependencies);function b(){if(d)return s(d);if(m&&f&&g){const e=new i(m),r=new t.ImageAtlas(f,g);for(const i in h){const o=h[i];o instanceof t.SymbolBucket?(n(o.layers,this.zoom,a),t.performSymbolLayout({bucket:o,glyphMap:m,glyphPositions:e.positions,imageMap:f,imagePositions:r.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):o.hasPattern&&(o instanceof t.LineBucket||o instanceof t.FillBucket||o instanceof t.FillExtrusionBucket)&&(n(o.layers,this.zoom,a),o.addFeatures(u,this.tileID.canonical,r.patternPositions))}this.status="done",s(null,{buckets:Object.values(h).filter((t=>!t.isEmpty())),featureIndex:c,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:e.image,imageAtlas:r,glyphMap:this.returnDependencies?m:null,iconMap:this.returnDependencies?f:null,glyphPositions:this.returnDependencies?e.positions:null})}}v.length?this.inFlightDependencies.push(o.send("getImages",{icons:v,source:this.source,tileID:this.tileID,type:"patterns"},((t,e)=>{y===this.dependencySentinel&&(d||(d=t,g=e,b.call(this)))}))):g={},b.call(this)}}function n(e,i,r){const n=new t.EvaluationParameters(i);for(const t of e)t.recalculate(n,r)}function a(e,i){const r=t.getArrayBuffer(e.request,((r,n,a,o)=>{if(r)i(r);else if(n)try{const e=new t.vectorTile.VectorTile(new t.Protobuf(n));i(null,{vectorTile:e,rawData:n,cacheControl:a,expires:o})}catch(t){const r=new Uint8Array(n);let a=`Unable to parse the tile at ${e.request.url}, `;a+=31===r[0]&&139===r[1]?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${t.messge}`,i(new Error(a))}}));return()=>{r.cancel(),i()}}class o{constructor(t,e,i,r){this.actor=t,this.layerIndex=e,this.availableImages=i,this.loadVectorData=r||a,this.fetching={},this.loading={},this.loaded={}}loadTile(e,i){const n=e.uid;this.loading||(this.loading={});const a=!!(e&&e.request&&e.request.collectResourceTiming)&&new t.RequestPerformance(e.request),o=this.loading[n]=new r(e);o.abort=this.loadVectorData(e,((e,r)=>{if(delete this.loading[n],e||!r)return o.status="done",this.loaded[n]=o,i(e);const s=r.rawData,l={};r.expires&&(l.expires=r.expires),r.cacheControl&&(l.cacheControl=r.cacheControl);const c={};if(a){const t=a.finish();t&&(c.resourceTiming=JSON.parse(JSON.stringify(t)))}o.vectorTile=r.vectorTile,o.parse(r.vectorTile,this.layerIndex,this.availableImages,this.actor,((e,r)=>{if(delete this.fetching[n],e||!r)return i(e);i(null,t.extend({rawTileData:s.slice(0)},r,l,c))})),this.loaded=this.loaded||{},this.loaded[n]=o,this.fetching[n]={rawTileData:s,cacheControl:l,resourceTiming:c}}))}reloadTile(e,i){const r=this.loaded,n=e.uid;if(r&&r[n]){const a=r[n];a.showCollisionBoxes=e.showCollisionBoxes,"parsing"===a.status?a.parse(a.vectorTile,this.layerIndex,this.availableImages,this.actor,((e,r)=>{if(e||!r)return i(e,r);let a;if(this.fetching[n]){const{rawTileData:e,cacheControl:i,resourceTiming:o}=this.fetching[n];delete this.fetching[n],a=t.extend({rawTileData:e.slice(0)},r,i,o)}else a=r;i(null,a)})):"done"===a.status&&(a.vectorTile?a.parse(a.vectorTile,this.layerIndex,this.availableImages,this.actor,i):i())}}abortTile(t,e){const i=this.loading,r=t.uid;i&&i[r]&&i[r].abort&&(i[r].abort(),delete i[r]),e()}removeTile(t,e){const i=this.loaded,r=t.uid;i&&i[r]&&delete i[r],e()}}class s{constructor(){this.loaded={}}async loadTile(e,i){const{uid:r,encoding:n,rawImageData:a,redFactor:o,greenFactor:s,blueFactor:l,baseShift:c}=e,h=a.width+2,u=a.height+2,p=t.isImageBitmap(a)?new t.RGBAImage({width:h,height:u},await t.getImageData(a,-1,-1,h,u)):a,d=new t.DEMData(r,p,n,o,s,l,c);this.loaded=this.loaded||{},this.loaded[r]=d,i(null,d)}removeTile(t){const e=this.loaded,i=t.uid;e&&e[i]&&delete e[i]}}function l(t,e){if(0!==t.length){c(t[0],e);for(var i=1;i<t.length;i++)c(t[i],!e)}}function c(t,e){for(var i=0,r=0,n=0,a=t.length,o=a-1;n<a;o=n++){var s=(t[n][0]-t[o][0])*(t[o][1]+t[n][1]),l=i+s;r+=Math.abs(i)>=Math.abs(s)?i-l+s:s-l+i,i=l}i+r>=0!=!!e&&t.reverse()}var h=t.getDefaultExportFromCjs((function t(e,i){var r,n=e&&e.type;if("FeatureCollection"===n)for(r=0;r<e.features.length;r++)t(e.features[r],i);else if("GeometryCollection"===n)for(r=0;r<e.geometries.length;r++)t(e.geometries[r],i);else if("Feature"===n)t(e.geometry,i);else if("Polygon"===n)l(e.coordinates,i);else if("MultiPolygon"===n)for(r=0;r<e.coordinates.length;r++)l(e.coordinates[r],i);return e}));const u=t.vectorTile.VectorTileFeature.prototype.toGeoJSON;var p={exports:{}},d=t.pointGeometry,m=t.vectorTile.VectorTileFeature,f=g;function g(t,e){this.options=e||{},this.features=t,this.length=t.length}function _(t,e){this.id="number"==typeof t.id?t.id:void 0,this.type=t.type,this.rawGeometry=1===t.type?[t.geometry]:t.geometry,this.properties=t.tags,this.extent=e||4096}g.prototype.feature=function(t){return new _(this.features[t],this.options.extent)},_.prototype.loadGeometry=function(){var t=this.rawGeometry;this.geometry=[];for(var e=0;e<t.length;e++){for(var i=t[e],r=[],n=0;n<i.length;n++)r.push(new d(i[n][0],i[n][1]));this.geometry.push(r)}return this.geometry},_.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var t=this.geometry,e=1/0,i=-1/0,r=1/0,n=-1/0,a=0;a<t.length;a++)for(var o=t[a],s=0;s<o.length;s++){var l=o[s];e=Math.min(e,l.x),i=Math.max(i,l.x),r=Math.min(r,l.y),n=Math.max(n,l.y)}return[e,r,i,n]},_.prototype.toGeoJSON=m.prototype.toGeoJSON;var y=t.pbf,x=f;function v(t){var e=new y;return function(t,e){for(var i in t.layers)e.writeMessage(3,b,t.layers[i])}(t,e),e.finish()}function b(t,e){var i;e.writeVarintField(15,t.version||1),e.writeStringField(1,t.name||""),e.writeVarintField(5,t.extent||4096);var r={keys:[],values:[],keycache:{},valuecache:{}};for(i=0;i<t.length;i++)r.feature=t.feature(i),e.writeMessage(2,w,r);var n=r.keys;for(i=0;i<n.length;i++)e.writeStringField(3,n[i]);var a=r.values;for(i=0;i<a.length;i++)e.writeMessage(4,I,a[i])}function w(t,e){var i=t.feature;void 0!==i.id&&e.writeVarintField(1,i.id),e.writeMessage(2,E,t),e.writeVarintField(3,i.type),e.writeMessage(4,C,i)}function E(t,e){var i=t.feature,r=t.keys,n=t.values,a=t.keycache,o=t.valuecache;for(var s in i.properties){var l=i.properties[s],c=a[s];if(null!==l){void 0===c&&(r.push(s),a[s]=c=r.length-1),e.writeVarint(c);var h=typeof l;"string"!==h&&"boolean"!==h&&"number"!==h&&(l=JSON.stringify(l));var u=h+":"+l,p=o[u];void 0===p&&(n.push(l),o[u]=p=n.length-1),e.writeVarint(p)}}}function T(t,e){return(e<<3)+(7&t)}function S(t){return t<<1^t>>31}function C(t,e){for(var i=t.loadGeometry(),r=t.type,n=0,a=0,o=i.length,s=0;s<o;s++){var l=i[s],c=1;1===r&&(c=l.length),e.writeVarint(T(1,c));for(var h=3===r?l.length-1:l.length,u=0;u<h;u++){1===u&&1!==r&&e.writeVarint(T(2,h-1));var p=l[u].x-n,d=l[u].y-a;e.writeVarint(S(p)),e.writeVarint(S(d)),n+=p,a+=d}3===r&&e.writeVarint(T(7,1))}}function I(t,e){var i=typeof t;"string"===i?e.writeStringField(1,t):"boolean"===i?e.writeBooleanField(7,t):"number"===i&&(t%1!=0?e.writeDoubleField(3,t):t<0?e.writeSVarintField(6,t):e.writeVarintField(5,t))}p.exports=v,p.exports.fromVectorTileJs=v,p.exports.fromGeojsonVt=function(t,e){e=e||{};var i={};for(var r in t)i[r]=new x(t[r].features,e),i[r].name=r,i[r].version=e.version,i[r].extent=e.extent;return v({layers:i})},p.exports.GeoJSONWrapper=x;var A=t.getDefaultExportFromCjs(p.exports);const M={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:t=>t},k=Math.fround||(P=new Float32Array(1),t=>(P[0]=+t,P[0]));var P;const z=3,L=5,D=6;class R{constructor(t){this.options=Object.assign(Object.create(M),t),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(t){const{log:e,minZoom:i,maxZoom:r}=this.options;e&&console.time("total time");const n=`prepare ${t.length} points`;e&&console.time(n),this.points=t;const a=[];for(let e=0;e<t.length;e++){const i=t[e];if(!i.geometry)continue;const[r,n]=i.geometry.coordinates,o=k(O(r)),s=k(U(n));a.push(o,s,1/0,e,-1,1),this.options.reduce&&a.push(0)}let o=this.trees[r+1]=this._createTree(a);e&&console.timeEnd(n);for(let t=r;t>=i;t--){const i=+Date.now();o=this.trees[t]=this._createTree(this._cluster(o,t)),e&&console.log("z%d: %d clusters in %dms",t,o.numItems,+Date.now()-i)}return e&&console.timeEnd("total time"),this}getClusters(t,e){let i=((t[0]+180)%360+360)%360-180;const r=Math.max(-90,Math.min(90,t[1]));let n=180===t[2]?180:((t[2]+180)%360+360)%360-180;const a=Math.max(-90,Math.min(90,t[3]));if(t[2]-t[0]>=360)i=-180,n=180;else if(i>n){const t=this.getClusters([i,r,180,a],e),o=this.getClusters([-180,r,n,a],e);return t.concat(o)}const o=this.trees[this._limitZoom(e)],s=o.range(O(i),U(a),O(n),U(r)),l=o.data,c=[];for(const t of s){const e=this.stride*t;c.push(l[e+L]>1?B(l,e,this.clusterProps):this.points[l[e+z]])}return c}getChildren(t){const e=this._getOriginId(t),i=this._getOriginZoom(t),r="No cluster with the specified id.",n=this.trees[i];if(!n)throw new Error(r);const a=n.data;if(e*this.stride>=a.length)throw new Error(r);const o=this.options.radius/(this.options.extent*Math.pow(2,i-1)),s=n.within(a[e*this.stride],a[e*this.stride+1],o),l=[];for(const e of s){const i=e*this.stride;a[i+4]===t&&l.push(a[i+L]>1?B(a,i,this.clusterProps):this.points[a[i+z]])}if(0===l.length)throw new Error(r);return l}getLeaves(t,e,i){const r=[];return this._appendLeaves(r,t,e=e||10,i=i||0,0),r}getTile(t,e,i){const r=this.trees[this._limitZoom(t)],n=Math.pow(2,t),{extent:a,radius:o}=this.options,s=o/a,l=(i-s)/n,c=(i+1+s)/n,h={features:[]};return this._addTileFeatures(r.range((e-s)/n,l,(e+1+s)/n,c),r.data,e,i,n,h),0===e&&this._addTileFeatures(r.range(1-s/n,l,1,c),r.data,n,i,n,h),e===n-1&&this._addTileFeatures(r.range(0,l,s/n,c),r.data,-1,i,n,h),h.features.length?h:null}getClusterExpansionZoom(t){let e=this._getOriginZoom(t)-1;for(;e<=this.options.maxZoom;){const i=this.getChildren(t);if(e++,1!==i.length)break;t=i[0].properties.cluster_id}return e}_appendLeaves(t,e,i,r,n){const a=this.getChildren(e);for(const e of a){const a=e.properties;if(a&&a.cluster?n+a.point_count<=r?n+=a.point_count:n=this._appendLeaves(t,a.cluster_id,i,r,n):n<r?n++:t.push(e),t.length===i)break}return n}_createTree(e){const i=new t.KDBush(e.length/this.stride|0,this.options.nodeSize,Float32Array);for(let t=0;t<e.length;t+=this.stride)i.add(e[t],e[t+1]);return i.finish(),i.data=e,i}_addTileFeatures(t,e,i,r,n,a){for(const o of t){const t=o*this.stride,s=e[t+L]>1;let l,c,h;if(s)l=F(e,t,this.clusterProps),c=e[t],h=e[t+1];else{const i=this.points[e[t+z]];l=i.properties;const[r,n]=i.geometry.coordinates;c=O(r),h=U(n)}const u={type:1,geometry:[[Math.round(this.options.extent*(c*n-i)),Math.round(this.options.extent*(h*n-r))]],tags:l};let p;p=s||this.options.generateId?e[t+z]:this.points[e[t+z]].id,void 0!==p&&(u.id=p),a.features.push(u)}}_limitZoom(t){return Math.max(this.options.minZoom,Math.min(Math.floor(+t),this.options.maxZoom+1))}_cluster(t,e){const{radius:i,extent:r,reduce:n,minPoints:a}=this.options,o=i/(r*Math.pow(2,e)),s=t.data,l=[],c=this.stride;for(let i=0;i<s.length;i+=c){if(s[i+2]<=e)continue;s[i+2]=e;const r=s[i],h=s[i+1],u=t.within(s[i],s[i+1],o),p=s[i+L];let d=p;for(const t of u){const i=t*c;s[i+2]>e&&(d+=s[i+L])}if(d>p&&d>=a){let t,a=r*p,o=h*p,m=-1;const f=((i/c|0)<<5)+(e+1)+this.points.length;for(const r of u){const l=r*c;if(s[l+2]<=e)continue;s[l+2]=e;const h=s[l+L];a+=s[l]*h,o+=s[l+1]*h,s[l+4]=f,n&&(t||(t=this._map(s,i,!0),m=this.clusterProps.length,this.clusterProps.push(t)),n(t,this._map(s,l)))}s[i+4]=f,l.push(a/d,o/d,1/0,f,-1,d),n&&l.push(m)}else{for(let t=0;t<c;t++)l.push(s[i+t]);if(d>1)for(const t of u){const i=t*c;if(!(s[i+2]<=e)){s[i+2]=e;for(let t=0;t<c;t++)l.push(s[i+t])}}}}return l}_getOriginId(t){return t-this.points.length>>5}_getOriginZoom(t){return(t-this.points.length)%32}_map(t,e,i){if(t[e+L]>1){const r=this.clusterProps[t[e+D]];return i?Object.assign({},r):r}const r=this.points[t[e+z]].properties,n=this.options.map(r);return i&&n===r?Object.assign({},n):n}}function B(t,e,i){return{type:"Feature",id:t[e+z],properties:F(t,e,i),geometry:{type:"Point",coordinates:[(r=t[e],360*(r-.5)),V(t[e+1])]}};var r}function F(t,e,i){const r=t[e+L],n=r>=1e4?`${Math.round(r/1e3)}k`:r>=1e3?Math.round(r/100)/10+"k":r,a=t[e+D],o=-1===a?{}:Object.assign({},i[a]);return Object.assign(o,{cluster:!0,cluster_id:t[e+z],point_count:r,point_count_abbreviated:n})}function O(t){return t/360+.5}function U(t){const e=Math.sin(t*Math.PI/180),i=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return i<0?0:i>1?1:i}function V(t){const e=(180-360*t)*Math.PI/180;return 360*Math.atan(Math.exp(e))/Math.PI-90}function N(t,e,i,r){for(var n,a=r,o=i-e>>1,s=i-e,l=t[e],c=t[e+1],h=t[i],u=t[i+1],p=e+3;p<i;p+=3){var d=$(t[p],t[p+1],l,c,h,u);if(d>a)n=p,a=d;else if(d===a){var m=Math.abs(p-o);m<s&&(n=p,s=m)}}a>r&&(n-e>3&&N(t,e,n,r),t[n+2]=a,i-n>3&&N(t,n,i,r))}function $(t,e,i,r,n,a){var o=n-i,s=a-r;if(0!==o||0!==s){var l=((t-i)*o+(e-r)*s)/(o*o+s*s);l>1?(i=n,r=a):l>0&&(i+=o*l,r+=s*l)}return(o=t-i)*o+(s=e-r)*s}function j(t,e,i,r){var n={id:void 0===t?null:t,type:e,geometry:i,tags:r,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(t){var e=t.geometry,i=t.type;if("Point"===i||"MultiPoint"===i||"LineString"===i)q(t,e);else if("Polygon"===i||"MultiLineString"===i)for(var r=0;r<e.length;r++)q(t,e[r]);else if("MultiPolygon"===i)for(r=0;r<e.length;r++)for(var n=0;n<e[r].length;n++)q(t,e[r][n])}(n),n}function q(t,e){for(var i=0;i<e.length;i+=3)t.minX=Math.min(t.minX,e[i]),t.minY=Math.min(t.minY,e[i+1]),t.maxX=Math.max(t.maxX,e[i]),t.maxY=Math.max(t.maxY,e[i+1])}function Z(t,e,i,r){if(e.geometry){var n=e.geometry.coordinates,a=e.geometry.type,o=Math.pow(i.tolerance/((1<<i.maxZoom)*i.extent),2),s=[],l=e.id;if(i.promoteId?l=e.properties[i.promoteId]:i.generateId&&(l=r||0),"Point"===a)G(n,s);else if("MultiPoint"===a)for(var c=0;c<n.length;c++)G(n[c],s);else if("LineString"===a)H(n,s,o,!1);else if("MultiLineString"===a){if(i.lineMetrics){for(c=0;c<n.length;c++)H(n[c],s=[],o,!1),t.push(j(l,"LineString",s,e.properties));return}X(n,s,o,!1)}else if("Polygon"===a)X(n,s,o,!0);else{if("MultiPolygon"!==a){if("GeometryCollection"===a){for(c=0;c<e.geometry.geometries.length;c++)Z(t,{id:l,geometry:e.geometry.geometries[c],properties:e.properties},i,r);return}throw new Error("Input data is not a valid GeoJSON object.")}for(c=0;c<n.length;c++){var h=[];X(n[c],h,o,!0),s.push(h)}}t.push(j(l,a,s,e.properties))}}function G(t,e){e.push(W(t[0])),e.push(K(t[1])),e.push(0)}function H(t,e,i,r){for(var n,a,o=0,s=0;s<t.length;s++){var l=W(t[s][0]),c=K(t[s][1]);e.push(l),e.push(c),e.push(0),s>0&&(o+=r?(n*c-l*a)/2:Math.sqrt(Math.pow(l-n,2)+Math.pow(c-a,2))),n=l,a=c}var h=e.length-3;e[2]=1,N(e,0,h,i),e[h+2]=1,e.size=Math.abs(o),e.start=0,e.end=e.size}function X(t,e,i,r){for(var n=0;n<t.length;n++){var a=[];H(t[n],a,i,r),e.push(a)}}function W(t){return t/360+.5}function K(t){var e=Math.sin(t*Math.PI/180),i=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return i<0?0:i>1?1:i}function Y(t,e,i,r,n,a,o,s){if(r/=e,a>=(i/=e)&&o<r)return t;if(o<i||a>=r)return null;for(var l=[],c=0;c<t.length;c++){var h=t[c],u=h.geometry,p=h.type,d=0===n?h.minX:h.minY,m=0===n?h.maxX:h.maxY;if(d>=i&&m<r)l.push(h);else if(!(m<i||d>=r)){var f=[];if("Point"===p||"MultiPoint"===p)J(u,f,i,r,n);else if("LineString"===p)Q(u,f,i,r,n,!1,s.lineMetrics);else if("MultiLineString"===p)et(u,f,i,r,n,!1);else if("Polygon"===p)et(u,f,i,r,n,!0);else if("MultiPolygon"===p)for(var g=0;g<u.length;g++){var _=[];et(u[g],_,i,r,n,!0),_.length&&f.push(_)}if(f.length){if(s.lineMetrics&&"LineString"===p){for(g=0;g<f.length;g++)l.push(j(h.id,p,f[g],h.tags));continue}"LineString"!==p&&"MultiLineString"!==p||(1===f.length?(p="LineString",f=f[0]):p="MultiLineString"),"Point"!==p&&"MultiPoint"!==p||(p=3===f.length?"Point":"MultiPoint"),l.push(j(h.id,p,f,h.tags))}}}return l.length?l:null}function J(t,e,i,r,n){for(var a=0;a<t.length;a+=3){var o=t[a+n];o>=i&&o<=r&&(e.push(t[a]),e.push(t[a+1]),e.push(t[a+2]))}}function Q(t,e,i,r,n,a,o){for(var s,l,c=tt(t),h=0===n?rt:nt,u=t.start,p=0;p<t.length-3;p+=3){var d=t[p],m=t[p+1],f=t[p+2],g=t[p+3],_=t[p+4],y=0===n?d:m,x=0===n?g:_,v=!1;o&&(s=Math.sqrt(Math.pow(d-g,2)+Math.pow(m-_,2))),y<i?x>i&&(l=h(c,d,m,g,_,i),o&&(c.start=u+s*l)):y>r?x<r&&(l=h(c,d,m,g,_,r),o&&(c.start=u+s*l)):it(c,d,m,f),x<i&&y>=i&&(l=h(c,d,m,g,_,i),v=!0),x>r&&y<=r&&(l=h(c,d,m,g,_,r),v=!0),!a&&v&&(o&&(c.end=u+s*l),e.push(c),c=tt(t)),o&&(u+=s)}var b=t.length-3;d=t[b],m=t[b+1],f=t[b+2],(y=0===n?d:m)>=i&&y<=r&&it(c,d,m,f),b=c.length-3,a&&b>=3&&(c[b]!==c[0]||c[b+1]!==c[1])&&it(c,c[0],c[1],c[2]),c.length&&e.push(c)}function tt(t){var e=[];return e.size=t.size,e.start=t.start,e.end=t.end,e}function et(t,e,i,r,n,a){for(var o=0;o<t.length;o++)Q(t[o],e,i,r,n,a,!1)}function it(t,e,i,r){t.push(e),t.push(i),t.push(r)}function rt(t,e,i,r,n,a){var o=(a-e)/(r-e);return t.push(a),t.push(i+(n-i)*o),t.push(1),o}function nt(t,e,i,r,n,a){var o=(a-i)/(n-i);return t.push(e+(r-e)*o),t.push(a),t.push(1),o}function at(t,e){for(var i=[],r=0;r<t.length;r++){var n,a=t[r],o=a.type;if("Point"===o||"MultiPoint"===o||"LineString"===o)n=ot(a.geometry,e);else if("MultiLineString"===o||"Polygon"===o){n=[];for(var s=0;s<a.geometry.length;s++)n.push(ot(a.geometry[s],e))}else if("MultiPolygon"===o)for(n=[],s=0;s<a.geometry.length;s++){for(var l=[],c=0;c<a.geometry[s].length;c++)l.push(ot(a.geometry[s][c],e));n.push(l)}i.push(j(a.id,o,n,a.tags))}return i}function ot(t,e){var i=[];i.size=t.size,void 0!==t.start&&(i.start=t.start,i.end=t.end);for(var r=0;r<t.length;r+=3)i.push(t[r]+e,t[r+1],t[r+2]);return i}function st(t,e){if(t.transformed)return t;var i,r,n,a=1<<t.z,o=t.x,s=t.y;for(i=0;i<t.features.length;i++){var l=t.features[i],c=l.geometry,h=l.type;if(l.geometry=[],1===h)for(r=0;r<c.length;r+=2)l.geometry.push(lt(c[r],c[r+1],e,a,o,s));else for(r=0;r<c.length;r++){var u=[];for(n=0;n<c[r].length;n+=2)u.push(lt(c[r][n],c[r][n+1],e,a,o,s));l.geometry.push(u)}}return t.transformed=!0,t}function lt(t,e,i,r,n,a){return[Math.round(i*(t*r-n)),Math.round(i*(e*r-a))]}function ct(t,e,i,r,n){for(var a=e===n.maxZoom?0:n.tolerance/((1<<e)*n.extent),o={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:i,y:r,z:e,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0},s=0;s<t.length;s++){o.numFeatures++,ht(o,t[s],a,n);var l=t[s].minX,c=t[s].minY,h=t[s].maxX,u=t[s].maxY;l<o.minX&&(o.minX=l),c<o.minY&&(o.minY=c),h>o.maxX&&(o.maxX=h),u>o.maxY&&(o.maxY=u)}return o}function ht(t,e,i,r){var n=e.geometry,a=e.type,o=[];if("Point"===a||"MultiPoint"===a)for(var s=0;s<n.length;s+=3)o.push(n[s]),o.push(n[s+1]),t.numPoints++,t.numSimplified++;else if("LineString"===a)ut(o,n,t,i,!1,!1);else if("MultiLineString"===a||"Polygon"===a)for(s=0;s<n.length;s++)ut(o,n[s],t,i,"Polygon"===a,0===s);else if("MultiPolygon"===a)for(var l=0;l<n.length;l++){var c=n[l];for(s=0;s<c.length;s++)ut(o,c[s],t,i,!0,0===s)}if(o.length){var h=e.tags||null;if("LineString"===a&&r.lineMetrics){for(var u in h={},e.tags)h[u]=e.tags[u];h.mapbox_clip_start=n.start/n.size,h.mapbox_clip_end=n.end/n.size}var p={geometry:o,type:"Polygon"===a||"MultiPolygon"===a?3:"LineString"===a||"MultiLineString"===a?2:1,tags:h};null!==e.id&&(p.id=e.id),t.features.push(p)}}function ut(t,e,i,r,n,a){var o=r*r;if(r>0&&e.size<(n?o:r))i.numPoints+=e.length/3;else{for(var s=[],l=0;l<e.length;l+=3)(0===r||e[l+2]>o)&&(i.numSimplified++,s.push(e[l]),s.push(e[l+1])),i.numPoints++;n&&function(t,e){for(var i=0,r=0,n=t.length,a=n-2;r<n;a=r,r+=2)i+=(t[r]-t[a])*(t[r+1]+t[a+1]);if(i>0===e)for(r=0,n=t.length;r<n/2;r+=2){var o=t[r],s=t[r+1];t[r]=t[n-2-r],t[r+1]=t[n-1-r],t[n-2-r]=o,t[n-1-r]=s}}(s,a),t.push(s)}}function pt(t,e){var i=(e=this.options=function(t,e){for(var i in e)t[i]=e[i];return t}(Object.create(this.options),e)).debug;if(i&&console.time("preprocess data"),e.maxZoom<0||e.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(e.promoteId&&e.generateId)throw new Error("promoteId and generateId cannot be used together.");var r=function(t,e){var i=[];if("FeatureCollection"===t.type)for(var r=0;r<t.features.length;r++)Z(i,t.features[r],e,r);else Z(i,"Feature"===t.type?t:{geometry:t},e);return i}(t,e);this.tiles={},this.tileCoords=[],i&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",e.indexMaxZoom,e.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),r=function(t,e){var i=e.buffer/e.extent,r=t,n=Y(t,1,-1-i,i,0,-1,2,e),a=Y(t,1,1-i,2+i,0,-1,2,e);return(n||a)&&(r=Y(t,1,-i,1+i,0,-1,2,e)||[],n&&(r=at(n,1).concat(r)),a&&(r=r.concat(at(a,-1)))),r}(r,e),r.length&&this.splitTile(r,0,0,0),i&&(r.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 dt(t,e,i){return 32*((1<<t)*i+e)+t}function mt(t,e){return e?t.properties[e]:t.id}function ft(t,e){if(null==t)return!0;if("Feature"===t.type)return null!=mt(t,e);if("FeatureCollection"===t.type){const i=new Set;for(const r of t.features){const t=mt(r,e);if(null==t)return!1;if(i.has(t))return!1;i.add(t)}return!0}return!1}function gt(t,e){const i=new Map;if(null==t);else if("Feature"===t.type)i.set(mt(t,e),t);else for(const r of t.features)i.set(mt(r,e),r);return i}function _t(e,i){const r=e.tileID.canonical;if(!this._geoJSONIndex)return i(null,null);const n=this._geoJSONIndex.getTile(r.z,r.x,r.y);if(!n)return i(null,null);const a=new class{constructor(e){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=t.EXTENT,this.length=e.length,this._features=e}feature(e){return new class{constructor(e){this._feature=e,this.extent=t.EXTENT,this.type=e.type,this.properties=e.tags,"id"in e&&!isNaN(e.id)&&(this.id=parseInt(e.id,10))}loadGeometry(){if(1===this._feature.type){const e=[];for(const i of this._feature.geometry)e.push([new t.Point(i[0],i[1])]);return e}{const e=[];for(const i of this._feature.geometry){const r=[];for(const e of i)r.push(new t.Point(e[0],e[1]));e.push(r)}return e}}toGeoJSON(t,e,i){return u.call(this,t,e,i)}}(this._features[e])}}(n.features);let o=A(a);0===o.byteOffset&&o.byteLength===o.buffer.byteLength||(o=new Uint8Array(o)),i(null,{vectorTile:a,rawData:o.buffer})}pt.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},pt.prototype.splitTile=function(t,e,i,r,n,a,o){for(var s=[t,e,i,r],l=this.options,c=l.debug;s.length;){r=s.pop(),i=s.pop(),e=s.pop(),t=s.pop();var h=1<<e,u=dt(e,i,r),p=this.tiles[u];if(!p&&(c>1&&console.time("creation"),p=this.tiles[u]=ct(t,e,i,r,l),this.tileCoords.push({z:e,x:i,y:r}),c)){c>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",e,i,r,p.numFeatures,p.numPoints,p.numSimplified),console.timeEnd("creation"));var d="z"+e;this.stats[d]=(this.stats[d]||0)+1,this.total++}if(p.source=t,n){if(e===l.maxZoom||e===n)continue;var m=1<<n-e;if(i!==Math.floor(a/m)||r!==Math.floor(o/m))continue}else if(e===l.indexMaxZoom||p.numPoints<=l.indexMaxPoints)continue;if(p.source=null,0!==t.length){c>1&&console.time("clipping");var f,g,_,y,x,v,b=.5*l.buffer/l.extent,w=.5-b,E=.5+b,T=1+b;f=g=_=y=null,x=Y(t,h,i-b,i+E,0,p.minX,p.maxX,l),v=Y(t,h,i+w,i+T,0,p.minX,p.maxX,l),t=null,x&&(f=Y(x,h,r-b,r+E,1,p.minY,p.maxY,l),g=Y(x,h,r+w,r+T,1,p.minY,p.maxY,l),x=null),v&&(_=Y(v,h,r-b,r+E,1,p.minY,p.maxY,l),y=Y(v,h,r+w,r+T,1,p.minY,p.maxY,l),v=null),c>1&&console.timeEnd("clipping"),s.push(f||[],e+1,2*i,2*r),s.push(g||[],e+1,2*i,2*r+1),s.push(_||[],e+1,2*i+1,2*r),s.push(y||[],e+1,2*i+1,2*r+1)}}},pt.prototype.getTile=function(t,e,i){var r=this.options,n=r.extent,a=r.debug;if(t<0||t>24)return null;var o=1<<t,s=dt(t,e=(e%o+o)%o,i);if(this.tiles[s])return st(this.tiles[s],n);a>1&&console.log("drilling down to z%d-%d-%d",t,e,i);for(var l,c=t,h=e,u=i;!l&&c>0;)c--,h=Math.floor(h/2),u=Math.floor(u/2),l=this.tiles[dt(c,h,u)];return l&&l.source?(a>1&&console.log("found parent tile z%d-%d-%d",c,h,u),a>1&&console.time("drilling down"),this.splitTile(l.source,c,h,u,t,e,i),a>1&&console.timeEnd("drilling down"),this.tiles[s]?st(this.tiles[s],n):null):null};class yt extends o{constructor(e,i,r,n){super(e,i,r,_t),this._dataUpdateable=new Map,this.loadGeoJSON=(e,i)=>{const{promoteId:r}=e;if(e.request)return t.getJSON(e.request,((t,e,n,a)=>{this._dataUpdateable=ft(e,r)?gt(e,r):void 0,i(t,e,n,a)}));if("string"==typeof e.data)try{const t=JSON.parse(e.data);this._dataUpdateable=ft(t,r)?gt(t,r):void 0,i(null,t)}catch(t){i(new Error(`Input data given to '${e.source}' is not a valid GeoJSON object.`))}else e.dataDiff?this._dataUpdateable?(function(t,e,i){var r,n,a,o;if(e.removeAll&&t.clear(),e.remove)for(const i of e.remove)t.delete(i);if(e.add)for(const r of e.add){const e=mt(r,i);null!=e&&t.set(e,r)}if(e.update)for(const i of e.update){let e=t.get(i.id);if(null==e)continue;const s=!i.removeAllProperties&&((null===(r=i.removeProperties)||void 0===r?void 0:r.length)>0||(null===(n=i.addOrUpdateProperties)||void 0===n?void 0:n.length)>0);if((i.newGeometry||i.removeAllProperties||s)&&(e={...e},t.set(i.id,e),s&&(e.properties={...e.properties})),i.newGeometry&&(e.geometry=i.newGeometry),i.removeAllProperties)e.properties={};else if((null===(a=i.removeProperties)||void 0===a?void 0:a.length)>0)for(const t of i.removeProperties)Object.prototype.hasOwnProperty.call(e.properties,t)&&delete e.properties[t];if((null===(o=i.addOrUpdateProperties)||void 0===o?void 0:o.length)>0)for(const{key:t,value:r}of i.addOrUpdateProperties)e.properties[t]=r}}(this._dataUpdateable,e.dataDiff,r),i(null,{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())})):i(new Error(`Cannot update existing geojson data in ${e.source}`)):i(new Error(`Input data given to '${e.source}' is not a valid GeoJSON object.`));return{cancel:()=>{}}},n&&(this.loadGeoJSON=n)}loadData(e,i){var r;null===(r=this._pendingRequest)||void 0===r||r.cancel(),this._pendingCallback&&this._pendingCallback(null,{abandoned:!0});const n=!!(e&&e.request&&e.request.collectResourceTiming)&&new t.RequestPerformance(e.request);this._pendingCallback=i,this._pendingRequest=this.loadGeoJSON(e,((r,a)=>{if(delete this._pendingCallback,delete this._pendingRequest,r||!a)return i(r);if("object"!=typeof a)return i(new Error(`Input data given to '${e.source}' is not a valid GeoJSON object.`));{h(a,!0);try{if(e.filter){const i=t.createExpression(e.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if("error"===i.result)throw new Error(i.value.map((t=>`${t.key}: ${t.message}`)).join(", "));const r=a.features.filter((t=>i.value.evaluate({zoom:0},t)));a={type:"FeatureCollection",features:r}}this._geoJSONIndex=e.cluster?new R(function({superclusterOptions:e,clusterProperties:i}){if(!i||!e)return e;const r={},n={},a={accumulated:null,zoom:0},o={properties:null},s=Object.keys(i);for(const e of s){const[a,o]=i[e],s=t.createExpression(o),l=t.createExpression("string"==typeof a?[a,["accumulated"],["get",e]]:a);r[e]=s.value,n[e]=l.value}return e.map=t=>{o.properties=t;const e={};for(const t of s)e[t]=r[t].evaluate(a,o);return e},e.reduce=(t,e)=>{o.properties=e;for(const e of s)a.accumulated=t[e],t[e]=n[e].evaluate(a,o)},e}(e)).load(a.features):function(t,e){return new pt(t,e)}(a,e.geojsonVtOptions)}catch(r){return i(r)}this.loaded={};const o={};if(n){const t=n.finish();t&&(o.resourceTiming={},o.resourceTiming[e.source]=JSON.parse(JSON.stringify(t)))}i(null,o)}}))}reloadTile(t,e){const i=this.loaded;return i&&i[t.uid]?super.reloadTile(t,e):this.loadTile(t,e)}removeSource(t,e){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),e()}getClusterExpansionZoom(t,e){try{e(null,this._geoJSONIndex.getClusterExpansionZoom(t.clusterId))}catch(t){e(t)}}getClusterChildren(t,e){try{e(null,this._geoJSONIndex.getChildren(t.clusterId))}catch(t){e(t)}}getClusterLeaves(t,e){try{e(null,this._geoJSONIndex.getLeaves(t.clusterId,t.limit,t.offset))}catch(t){e(t)}}}class xt{constructor(e){this.self=e,this.actor=new t.Actor(e,this),this.layerIndexes={},this.availableImages={},this.workerSourceTypes={vector:o,geojson:yt},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(t,e)=>{if(this.workerSourceTypes[t])throw new Error(`Worker source with name "${t}" already registered.`);this.workerSourceTypes[t]=e},this.self.registerRTLTextPlugin=e=>{if(t.plugin.isParsed())throw new Error("RTL text plugin already registered.");t.plugin.applyArabicShaping=e.applyArabicShaping,t.plugin.processBidirectionalText=e.processBidirectionalText,t.plugin.processStyledBidirectionalText=e.processStyledBidirectionalText}}setReferrer(t,e){this.referrer=e}setImages(t,e,i){this.availableImages[t]=e;for(const i in this.workerSources[t]){const r=this.workerSources[t][i];for(const t in r)r[t].availableImages=e}i()}setLayers(t,e,i){this.getLayerIndex(t).replace(e),i()}updateLayers(t,e,i){this.getLayerIndex(t).update(e.layers,e.removedIds),i()}loadTile(t,e,i){this.getWorkerSource(t,e.type,e.source).loadTile(e,i)}loadDEMTile(t,e,i){this.getDEMWorkerSource(t,e.source).loadTile(e,i)}reloadTile(t,e,i){this.getWorkerSource(t,e.type,e.source).reloadTile(e,i)}abortTile(t,e,i){this.getWorkerSource(t,e.type,e.source).abortTile(e,i)}removeTile(t,e,i){this.getWorkerSource(t,e.type,e.source).removeTile(e,i)}removeDEMTile(t,e){this.getDEMWorkerSource(t,e.source).removeTile(e)}removeSource(t,e,i){if(!this.workerSources[t]||!this.workerSources[t][e.type]||!this.workerSources[t][e.type][e.source])return;const r=this.workerSources[t][e.type][e.source];delete this.workerSources[t][e.type][e.source],void 0!==r.removeSource?r.removeSource(e,i):i()}loadWorkerSource(t,e,i){try{this.self.importScripts(e.url),i()}catch(t){i(t.toString())}}syncRTLPluginState(e,i,r){try{t.plugin.setState(i);const e=t.plugin.getPluginURL();if(t.plugin.isLoaded()&&!t.plugin.isParsed()&&null!=e){this.self.importScripts(e);const i=t.plugin.isParsed();r(i?void 0:new Error(`RTL Text Plugin failed to import scripts from ${e}`),i)}}catch(t){r(t.toString())}}getAvailableImages(t){let e=this.availableImages[t];return e||(e=[]),e}getLayerIndex(t){let i=this.layerIndexes[t];return i||(i=this.layerIndexes[t]=new e),i}getWorkerSource(t,e,i){if(this.workerSources[t]||(this.workerSources[t]={}),this.workerSources[t][e]||(this.workerSources[t][e]={}),!this.workerSources[t][e][i]){const r={send:(e,i,r)=>{this.actor.send(e,i,r,t)}};this.workerSources[t][e][i]=new this.workerSourceTypes[e](r,this.getLayerIndex(t),this.getAvailableImages(t))}return this.workerSources[t][e][i]}getDEMWorkerSource(t,e){return this.demWorkerSources[t]||(this.demWorkerSources[t]={}),this.demWorkerSources[t][e]||(this.demWorkerSources[t][e]=new s),this.demWorkerSources[t][e]}}return t.isWorker()&&(self.worker=new xt(self)),xt})),r(0,(function(t){var e="3.4.1";class i{static testProp(t){if(!i.docStyle)return t[0];for(let e=0;e<t.length;e++)if(t[e]in i.docStyle)return t[e];return t[0]}static create(t,e,i){const r=window.document.createElement(t);return void 0!==e&&(r.className=e),i&&i.appendChild(r),r}static createNS(t,e){return window.document.createElementNS(t,e)}static disableDrag(){i.docStyle&&i.selectProp&&(i.userSelect=i.docStyle[i.selectProp],i.docStyle[i.selectProp]="none")}static enableDrag(){i.docStyle&&i.selectProp&&(i.docStyle[i.selectProp]=i.userSelect)}static setTransform(t,e){t.style[i.transformProp]=e}static addEventListener(t,e,i,r={}){t.addEventListener(e,i,"passive"in r?r:r.capture)}static removeEventListener(t,e,i,r={}){t.removeEventListener(e,i,"passive"in r?r:r.capture)}static suppressClickInternal(t){t.preventDefault(),t.stopPropagation(),window.removeEventListener("click",i.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",i.suppressClickInternal,!0),window.setTimeout((()=>{window.removeEventListener("click",i.suppressClickInternal,!0)}),0)}static mousePos(e,i){const r=e.getBoundingClientRect();return new t.Point(i.clientX-r.left-e.clientLeft,i.clientY-r.top-e.clientTop)}static touchPos(e,i){const r=e.getBoundingClientRect(),n=[];for(let a=0;a<i.length;a++)n.push(new t.Point(i[a].clientX-r.left-e.clientLeft,i[a].clientY-r.top-e.clientTop));return n}static mouseButton(t){return t.button}static remove(t){t.parentNode&&t.parentNode.removeChild(t)}}i.docStyle="undefined"!=typeof window&&window.document&&window.document.documentElement.style,i.selectProp=i.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),i.transformProp=i.testProp(["transform","WebkitTransform"]);const r={supported:!1,testSupport:function(t){!o&&a&&(s?l(t):n=t)}};let n,a,o=!1,s=!1;function l(t){const e=t.createTexture();t.bindTexture(t.TEXTURE_2D,e);try{if(t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,a),t.isContextLost())return;r.supported=!0}catch(t){}t.deleteTexture(e),o=!0}var c,h;"undefined"!=typeof document&&(a=document.createElement("img"),a.onload=function(){n&&l(n),n=null,s=!0},a.onerror=function(){o=!0,n=null},a.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),function(e){let i,n,a,o;e.resetRequestQueue=()=>{i=[],n=0,a=0,o={}},e.addThrottleControl=t=>{const e=a++;return o[e]=t,e},e.removeThrottleControl=t=>{delete o[t],c()},e.getImage=(t,e,a=!0)=>{r.supported&&(t.headers||(t.headers={}),t.headers.accept="image/webp,*/*");const o={requestParameters:t,supportImageRefresh:a,callback:e,cancelled:!1,completed:!1,cancel:()=>{o.completed||o.cancelled||(o.cancelled=!0,o.innerRequest&&(o.innerRequest.cancel(),n--),c())}};return i.push(o),c(),o};const s=e=>{const{requestParameters:i,supportImageRefresh:r,callback:n}=e;return t.extend(i,{type:"image"}),(!1!==r||t.isWorker()||t.getProtocolAction(i.url)||i.headers&&!Object.keys(i.headers).reduce(((t,e)=>t&&"accept"===e),!0)?t.makeRequest:h)(i,((t,i,r,a)=>{l(e,n,t,i,r,a)}))},l=(e,i,r,a,o,s)=>{r?i(r):a instanceof HTMLImageElement||t.isImageBitmap(a)?i(null,a):a&&((e,i)=>{"function"==typeof createImageBitmap?t.arrayBufferToImageBitmap(e,i):t.arrayBufferToImage(e,i)})(a,((t,e)=>{null!=t?i(t):null!=e&&i(null,e,{cacheControl:o,expires:s})})),e.cancelled||(e.completed=!0,n--,c())},c=()=>{const e=(()=>{const t=Object.keys(o);let e=!1;if(t.length>0)for(const i of t)if(e=o[i](),e)break;return e})()?t.config.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:t.config.MAX_PARALLEL_IMAGE_REQUESTS;for(let t=n;t<e&&i.length>0;t++){const e=i.shift();if(e.cancelled){t--;continue}const r=s(e);n++,e.innerRequest=r}},h=(e,i)=>{const r=new Image,n=e.url;let a=!1;const o=e.credentials;return o&&"include"===o?r.crossOrigin="use-credentials":(o&&"same-origin"===o||!t.sameOrigin(n))&&(r.crossOrigin="anonymous"),r.fetchPriority="high",r.onload=()=>{i(null,r),r.onerror=r.onload=null},r.onerror=()=>{a||i(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.")),r.onerror=r.onload=null},r.src=n,{cancel:()=>{a=!0,r.src=""}}}}(c||(c={})),c.resetRequestQueue(),function(t){t.Glyphs="Glyphs",t.Image="Image",t.Source="Source",t.SpriteImage="SpriteImage",t.SpriteJSON="SpriteJSON",t.Style="Style",t.Tile="Tile",t.Unknown="Unknown"}(h||(h={}));class u{constructor(t){this._transformRequestFn=t}transformRequest(t,e){return this._transformRequestFn&&this._transformRequestFn(t,e)||{url:t}}normalizeSpriteURL(t,e,i){const r=function(t){const e=t.match(p);if(!e)throw new Error(`Unable to parse URL "${t}"`);return{protocol:e[1],authority:e[2],path:e[3]||"/",params:e[4]?e[4].split("&"):[]}}(t);return r.path+=`${e}${i}`,function(t){const e=t.params.length?`?${t.params.join("&")}`:"";return`${t.protocol}://${t.authority}${t.path}${e}`}(r)}setTransformRequest(t){this._transformRequestFn=t}}const p=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function d(e){var i=new t.ARRAY_TYPE(3);return i[0]=e[0],i[1]=e[1],i[2]=e[2],i}var m,f=function(t,e,i){return t[0]=e[0]-i[0],t[1]=e[1]-i[1],t[2]=e[2]-i[2],t};m=new t.ARRAY_TYPE(3),t.ARRAY_TYPE!=Float32Array&&(m[0]=0,m[1]=0,m[2]=0);var g=function(t){var e=t[0],i=t[1];return e*e+i*i};function _(t){const e=[];if("string"==typeof t)e.push({id:"default",url:t});else if(t&&t.length>0){const i=[];for(const{id:r,url:n}of t){const t=`${r}${n}`;-1===i.indexOf(t)&&(i.push(t),e.push({id:r,url:n}))}}return e}function y(e,i,r,n,a){if(n)return void e(n);if(a!==Object.values(i).length||a!==Object.values(r).length)return;const o={};for(const e in i){o[e]={};const n=t.browser.getImageCanvasContext(r[e]),a=i[e];for(const t in a){const{width:i,height:r,x:s,y:l,sdf:c,pixelRatio:h,stretchX:u,stretchY:p,content:d}=a[t];o[e][t]={data:null,pixelRatio:h,sdf:c,stretchX:u,stretchY:p,content:d,spriteData:{width:i,height:r,x:s,y:l,context:n}}}}e(null,o)}!function(){var e=new t.ARRAY_TYPE(2);t.ARRAY_TYPE!=Float32Array&&(e[0]=0,e[1]=0)}();class x{constructor(t,e,i,r){this.context=t,this.format=i,this.texture=t.gl.createTexture(),this.update(e,r)}update(e,i,r){const{width:n,height:a}=e,o=!(this.size&&this.size[0]===n&&this.size[1]===a||r),{context:s}=this,{gl:l}=s;if(this.useMipmap=Boolean(i&&i.useMipmap),l.bindTexture(l.TEXTURE_2D,this.texture),s.pixelStoreUnpackFlipY.set(!1),s.pixelStoreUnpack.set(1),s.pixelStoreUnpackPremultiplyAlpha.set(this.format===l.RGBA&&(!i||!1!==i.premultiply)),o)this.size=[n,a],e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||t.isImageBitmap(e)?l.texImage2D(l.TEXTURE_2D,0,this.format,this.format,l.UNSIGNED_BYTE,e):l.texImage2D(l.TEXTURE_2D,0,this.format,n,a,0,this.format,l.UNSIGNED_BYTE,e.data);else{const{x:i,y:o}=r||{x:0,y:0};e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||t.isImageBitmap(e)?l.texSubImage2D(l.TEXTURE_2D,0,i,o,l.RGBA,l.UNSIGNED_BYTE,e):l.texSubImage2D(l.TEXTURE_2D,0,i,o,n,a,l.RGBA,l.UNSIGNED_BYTE,e.data)}this.useMipmap&&this.isSizePowerOfTwo()&&l.generateMipmap(l.TEXTURE_2D)}bind(t,e,i){const{context:r}=this,{gl:n}=r;n.bindTexture(n.TEXTURE_2D,this.texture),i!==n.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(i=n.LINEAR),t!==this.filter&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,t),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,i||t),this.filter=t),e!==this.wrap&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,e),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,e),this.wrap=e)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:t}=this.context;t.deleteTexture(this.texture),this.texture=null}}function v(t){const{userImage:e}=t;return!!(e&&e.render&&e.render())&&(t.data.replace(new Uint8Array(e.data.buffer)),!0)}class b extends t.Evented{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new t.RGBAImage({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(t){if(this.loaded!==t&&(this.loaded=t,t)){for(const{ids:t,callback:e}of this.requestors)this._notify(t,e);this.requestors=[]}}getImage(e){const i=this.images[e];if(i&&!i.data&&i.spriteData){const e=i.spriteData;i.data=new t.RGBAImage({width:e.width,height:e.height},e.context.getImageData(e.x,e.y,e.width,e.height).data),i.spriteData=null}return i}addImage(t,e){if(this.images[t])throw new Error(`Image id ${t} already exist, use updateImage instead`);this._validate(t,e)&&(this.images[t]=e)}_validate(e,i){let r=!0;const n=i.data||i.spriteData;return this._validateStretch(i.stretchX,n&&n.width)||(this.fire(new t.ErrorEvent(new Error(`Image "${e}" has invalid "stretchX" value`))),r=!1),this._validateStretch(i.stretchY,n&&n.height)||(this.fire(new t.ErrorEvent(new Error(`Image "${e}" has invalid "stretchY" value`))),r=!1),this._validateContent(i.content,i)||(this.fire(new t.ErrorEvent(new Error(`Image "${e}" has invalid "content" value`))),r=!1),r}_validateStretch(t,e){if(!t)return!0;let i=0;for(const r of t){if(r[0]<i||r[1]<r[0]||e<r[1])return!1;i=r[1]}return!0}_validateContent(t,e){if(!t)return!0;if(4!==t.length)return!1;const i=e.spriteData,r=i&&i.width||e.data.width,n=i&&i.height||e.data.height;return!(t[0]<0||r<t[0]||t[1]<0||n<t[1]||t[2]<0||r<t[2]||t[3]<0||n<t[3]||t[2]<t[0]||t[3]<t[1])}updateImage(t,e,i=!0){const r=this.getImage(t);if(i&&(r.data.width!==e.data.width||r.data.height!==e.data.height))throw new Error(`size mismatch between old image (${r.data.width}x${r.data.height}) and new image (${e.data.width}x${e.data.height}).`);e.version=r.version+1,this.images[t]=e,this.updatedImages[t]=!0}removeImage(t){const e=this.images[t];delete this.images[t],delete this.patterns[t],e.userImage&&e.userImage.onRemove&&e.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(t,e){let i=!0;if(!this.isLoaded())for(const e of t)this.images[e]||(i=!1);this.isLoaded()||i?this._notify(t,e):this.requestors.push({ids:t,callback:e})}_notify(e,i){const r={};for(const i of e){let e=this.getImage(i);e||(this.fire(new t.Event("styleimagemissing",{id:i})),e=this.getImage(i)),e?r[i]={data:e.data.clone(),pixelRatio:e.pixelRatio,sdf:e.sdf,version:e.version,stretchX:e.stretchX,stretchY:e.stretchY,content:e.content,hasRenderCallback:Boolean(e.userImage&&e.userImage.render)}:t.warnOnce(`Image "${i}" 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.`)}i(null,r)}getPixelSize(){const{width:t,height:e}=this.atlasImage;return{width:t,height:e}}getPattern(e){const i=this.patterns[e],r=this.getImage(e);if(!r)return null;if(i&&i.position.version===r.version)return i.position;if(i)i.position.version=r.version;else{const i={w:r.data.width+2,h:r.data.height+2,x:0,y:0},n=new t.ImagePosition(i,r);this.patterns[e]={bin:i,position:n}}return this._updatePatternAtlas(),this.patterns[e].position}bind(t){const e=t.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new x(t,this.atlasImage,e.RGBA),this.atlasTexture.bind(e.LINEAR,e.CLAMP_TO_EDGE)}_updatePatternAtlas(){const e=[];for(const t in this.patterns)e.push(this.patterns[t].bin);const{w:i,h:r}=t.potpack(e),n=this.atlasImage;n.resize({width:i||1,height:r||1});for(const e in this.patterns){const{bin:i}=this.patterns[e],r=i.x+1,a=i.y+1,o=this.getImage(e).data,s=o.width,l=o.height;t.RGBAImage.copy(o,n,{x:0,y:0},{x:r,y:a},{width:s,height:l}),t.RGBAImage.copy(o,n,{x:0,y:l-1},{x:r,y:a-1},{width:s,height:1}),t.RGBAImage.copy(o,n,{x:0,y:0},{x:r,y:a+l},{width:s,height:1}),t.RGBAImage.copy(o,n,{x:s-1,y:0},{x:r-1,y:a},{width:1,height:l}),t.RGBAImage.copy(o,n,{x:0,y:0},{x:r+s,y:a},{width:1,height:l})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(e){for(const i of e){if(this.callbackDispatchedThisFrame[i])continue;this.callbackDispatchedThisFrame[i]=!0;const e=this.getImage(i);e||t.warnOnce(`Image with ID: "${i}" was not found`),v(e)&&this.updateImage(i,e)}}}const w=1e20;function E(t,e,i,r,n,a,o,s,l){for(let c=e;c<e+r;c++)T(t,i*a+c,a,n,o,s,l);for(let c=i;c<i+n;c++)T(t,c*a+e,1,r,o,s,l)}function T(t,e,i,r,n,a,o){a[0]=0,o[0]=-w,o[1]=w,n[0]=t[e];for(let s=1,l=0,c=0;s<r;s++){n[s]=t[e+s*i];const r=s*s;do{const t=a[l];c=(n[s]-n[t]+r-t*t)/(s-t)/2}while(c<=o[l]&&--l>-1);l++,a[l]=s,o[l]=c,o[l+1]=w}for(let s=0,l=0;s<r;s++){for(;o[l+1]<s;)l++;const r=a[l],c=s-r;t[e+s*i]=n[r]+c*c}}class S{constructor(t,e){this.requestManager=t,this.localIdeographFontFamily=e,this.entries={}}setURL(t){this.url=t}getGlyphs(e,i){const r=[];for(const t in e)for(const i of e[t])r.push({stack:t,id:i});t.asyncAll(r,(({stack:t,id:e},i)=>{let r=this.entries[t];r||(r=this.entries[t]={glyphs:{},requests:{},ranges:{}});let n=r.glyphs[e];if(void 0!==n)return void i(null,{stack:t,id:e,glyph:n});if(n=this._tinySDF(r,t,e),n)return r.glyphs[e]=n,void i(null,{stack:t,id:e,glyph:n});const a=Math.floor(e/256);if(256*a>65535)return void i(new Error("glyphs > 65535 not supported"));if(r.ranges[a])return void i(null,{stack:t,id:e,glyph:n});if(!this.url)return void i(new Error("glyphsUrl is not set"));let o=r.requests[a];o||(o=r.requests[a]=[],S.loadGlyphRange(t,a,this.url,this.requestManager,((t,e)=>{if(e){for(const t in e)this._doesCharSupportLocalGlyph(+t)||(r.glyphs[+t]=e[+t]);r.ranges[a]=!0}for(const i of o)i(t,e);delete r.requests[a]}))),o.push(((r,n)=>{r?i(r):n&&i(null,{stack:t,id:e,glyph:n[e]||null})}))}),((t,e)=>{if(t)i(t);else if(e){const t={};for(const{stack:i,id:r,glyph:n}of e)(t[i]||(t[i]={}))[r]=n&&{id:n.id,bitmap:n.bitmap.clone(),metrics:n.metrics};i(null,t)}}))}_doesCharSupportLocalGlyph(e){return!!this.localIdeographFontFamily&&(t.unicodeBlockLookup["CJK Unified Ideographs"](e)||t.unicodeBlockLookup["Hangul Syllables"](e)||t.unicodeBlockLookup.Hiragana(e)||t.unicodeBlockLookup.Katakana(e))}_tinySDF(e,i,r){const n=this.localIdeographFontFamily;if(!n)return;if(!this._doesCharSupportLocalGlyph(r))return;let a=e.tinySDF;if(!a){let t="400";/bold/i.test(i)?t="900":/medium/i.test(i)?t="500":/light/i.test(i)&&(t="200"),a=e.tinySDF=new S.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:n,fontWeight:t})}const o=a.draw(String.fromCharCode(r));return{id:r,bitmap:new t.AlphaImage({width:o.width||60,height:o.height||60},o.data),metrics:{width:o.glyphWidth/2||24,height:o.glyphHeight/2||24,left:o.glyphLeft/2+.5||0,top:o.glyphTop/2-27.5||-8,advance:o.glyphAdvance/2||24,isDoubleResolution:!0}}}}S.loadGlyphRange=function(e,i,r,n,a){const o=256*i,s=o+255,l=n.transformRequest(r.replace("{fontstack}",e).replace("{range}",`${o}-${s}`),h.Glyphs);t.getArrayBuffer(l,((e,i)=>{if(e)a(e);else if(i){const e={};for(const r of t.parseGlyphPbf(i))e[r.id]=r;a(null,e)}}))},S.TinySDF=class{constructor({fontSize:t=24,buffer:e=3,radius:i=8,cutoff:r=.25,fontFamily:n="sans-serif",fontWeight:a="normal",fontStyle:o="normal"}={}){this.buffer=e,this.cutoff=r,this.radius=i;const s=this.size=t+4*e,l=this._createCanvas(s),c=this.ctx=l.getContext("2d",{willReadFrequently:!0});c.font=`${o} ${a} ${t}px ${n}`,c.textBaseline="alphabetic",c.textAlign="left",c.fillStyle="black",this.gridOuter=new Float64Array(s*s),this.gridInner=new Float64Array(s*s),this.f=new Float64Array(s),this.z=new Float64Array(s+1),this.v=new Uint16Array(s)}_createCanvas(t){const e=document.createElement("canvas");return e.width=e.height=t,e}draw(t){const{width:e,actualBoundingBoxAscent:i,actualBoundingBoxDescent:r,actualBoundingBoxLeft:n,actualBoundingBoxRight:a}=this.ctx.measureText(t),o=Math.ceil(i),s=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(a-n))),l=Math.min(this.size-this.buffer,o+Math.ceil(r)),c=s+2*this.buffer,h=l+2*this.buffer,u=Math.max(c*h,0),p=new Uint8ClampedArray(u),d={data:p,width:c,height:h,glyphWidth:s,glyphHeight:l,glyphTop:o,glyphLeft:0,glyphAdvance:e};if(0===s||0===l)return d;const{ctx:m,buffer:f,gridInner:g,gridOuter:_}=this;m.clearRect(f,f,s,l),m.fillText(t,f,f+o);const y=m.getImageData(f,f,s,l);_.fill(w,0,u),g.fill(0,0,u);for(let t=0;t<l;t++)for(let e=0;e<s;e++){const i=y.data[4*(t*s+e)+3]/255;if(0===i)continue;const r=(t+f)*c+e+f;if(1===i)_[r]=0,g[r]=w;else{const t=.5-i;_[r]=t>0?t*t:0,g[r]=t<0?t*t:0}}E(_,0,0,c,h,c,this.f,this.v,this.z),E(g,f,f,s,l,c,this.f,this.v,this.z);for(let t=0;t<u;t++){const e=Math.sqrt(_[t])-Math.sqrt(g[t]);p[t]=Math.round(255-255*(e/this.radius+this.cutoff))}return d}};class C{constructor(){this.specification=t.v8Spec.light.position}possiblyEvaluate(e,i){return t.sphericalToCartesian(e.expression.evaluate(i))}interpolate(e,i,r){return{x:t.interpolate.number(e.x,i.x,r),y:t.interpolate.number(e.y,i.y,r),z:t.interpolate.number(e.z,i.z,r)}}}let I;class A extends t.Evented{constructor(e){super(),I=I||new t.Properties({anchor:new t.DataConstantProperty(t.v8Spec.light.anchor),position:new C,color:new t.DataConstantProperty(t.v8Spec.light.color),intensity:new t.DataConstantProperty(t.v8Spec.light.intensity)}),this._transitionable=new t.Transitionable(I),this.setLight(e),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(e,i={}){if(!this._validate(t.validateLight,e,i))for(const t in e){const i=e[t];t.endsWith("-transition")?this._transitionable.setTransition(t.slice(0,-11),i):this._transitionable.setValue(t,i)}}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}_validate(e,i,r){return(!r||!1!==r.validate)&&t.emitValidationErrors(this,e.call(t.validateStyle,t.extend({value:i,style:{glyphs:!0,sprite:!0},styleSpec:t.v8Spec})))}}class M{constructor(t,e){this.width=t,this.height=e,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(t,e){const i=t.join(",")+String(e);return this.dashEntry[i]||(this.dashEntry[i]=this.addDash(t,e)),this.dashEntry[i]}getDashRanges(t,e,i){const r=[];let n=t.length%2==1?-t[t.length-1]*i:0,a=t[0]*i,o=!0;r.push({left:n,right:a,isDash:o,zeroLength:0===t[0]});let s=t[0];for(let e=1;e<t.length;e++){o=!o;const l=t[e];n=s*i,s+=l,a=s*i,r.push({left:n,right:a,isDash:o,zeroLength:0===l})}return r}addRoundDash(t,e,i){const r=e/2;for(let e=-i;e<=i;e++){const n=this.width*(this.nextRow+i+e);let a=0,o=t[a];for(let s=0;s<this.width;s++){s/o.right>1&&(o=t[++a]);const l=Math.abs(s-o.left),c=Math.abs(s-o.right),h=Math.min(l,c);let u;const p=e/i*(r+1);if(o.isDash){const t=r-Math.abs(p);u=Math.sqrt(h*h+t*t)}else u=r-Math.sqrt(h*h+p*p);this.data[n+s]=Math.max(0,Math.min(255,u+128))}}}addRegularDash(t){for(let e=t.length-1;e>=0;--e){const i=t[e],r=t[e+1];i.zeroLength?t.splice(e,1):r&&r.isDash===i.isDash&&(r.left=i.left,t.splice(e,1))}const e=t[0],i=t[t.length-1];e.isDash===i.isDash&&(e.left=i.left-this.width,i.right=e.right+this.width);const r=this.width*this.nextRow;let n=0,a=t[n];for(let e=0;e<this.width;e++){e/a.right>1&&(a=t[++n]);const i=Math.abs(e-a.left),o=Math.abs(e-a.right),s=Math.min(i,o);this.data[r+e]=Math.max(0,Math.min(255,(a.isDash?s:-s)+128))}}addDash(e,i){const r=i?7:0,n=2*r+1;if(this.nextRow+n>this.height)return t.warnOnce("LineAtlas out of space"),null;let a=0;for(let t=0;t<e.length;t++)a+=e[t];if(0!==a){const t=this.width/a,n=this.getDashRanges(e,this.width,t);i?this.addRoundDash(n,t,r):this.addRegularDash(n)}const o={y:(this.nextRow+r+.5)/this.height,height:2*r/this.height,width:a};return this.nextRow+=n,this.dirty=!0,o}bind(t){const e=t.gl;this.texture?(e.bindTexture(e.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,e.texSubImage2D(e.TEXTURE_2D,0,0,0,this.width,this.height,e.ALPHA,e.UNSIGNED_BYTE,this.data))):(this.texture=e.createTexture(),e.bindTexture(e.TEXTURE_2D,this.texture),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.REPEAT),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.REPEAT),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texImage2D(e.TEXTURE_2D,0,e.ALPHA,this.width,this.height,0,e.ALPHA,e.UNSIGNED_BYTE,this.data))}}class k{constructor(t,e,i){this.workerPool=t,this.actors=[],this.currentActor=0,this.id=i;const r=this.workerPool.acquire(i);for(let t=0;t<r.length;t++){const n=new k.Actor(r[t],e,i);n.name=`Worker ${t}`,this.actors.push(n)}if(!this.actors.length)throw new Error("No actors found")}broadcast(e,i,r){t.asyncAll(this.actors,((t,r)=>{t.send(e,i,r)}),r=r||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(t=!0){this.actors.forEach((t=>{t.remove()})),this.actors=[],t&&this.workerPool.release(this.id)}}function P(e,i,r){const n=function(i,n){if(i)return r(i);if(n){const i=t.pick(t.extend(n,e),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);n.vector_layers&&(i.vectorLayers=n.vector_layers,i.vectorLayerIds=i.vectorLayers.map((t=>t.id))),r(null,i)}};return e.url?t.getJSON(i.transformRequest(e.url,h.Source),n):t.browser.frame((()=>n(null,e)))}k.Actor=t.Actor;class z{constructor(t,e){t&&(e?this.setSouthWest(t).setNorthEast(e):Array.isArray(t)&&(4===t.length?this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]]):this.setSouthWest(t[0]).setNorthEast(t[1])))}setNorthEast(e){return this._ne=e instanceof t.LngLat?new t.LngLat(e.lng,e.lat):t.LngLat.convert(e),this}setSouthWest(e){return this._sw=e instanceof t.LngLat?new t.LngLat(e.lng,e.lat):t.LngLat.convert(e),this}extend(e){const i=this._sw,r=this._ne;let n,a;if(e instanceof t.LngLat)n=e,a=e;else{if(!(e instanceof z))return Array.isArray(e)?4===e.length||e.every(Array.isArray)?this.extend(z.convert(e)):this.extend(t.LngLat.convert(e)):e&&("lng"in e||"lon"in e)&&"lat"in e?this.extend(t.LngLat.convert(e)):this;if(n=e._sw,a=e._ne,!n||!a)return this}return i||r?(i.lng=Math.min(n.lng,i.lng),i.lat=Math.min(n.lat,i.lat),r.lng=Math.max(a.lng,r.lng),r.lat=Math.max(a.lat,r.lat)):(this._sw=new t.LngLat(n.lng,n.lat),this._ne=new t.LngLat(a.lng,a.lat)),this}getCenter(){return new t.LngLat((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 t.LngLat(this.getWest(),this.getNorth())}getSouthEast(){return new t.LngLat(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(e){const{lng:i,lat:r}=t.LngLat.convert(e);let n=this._sw.lng<=i&&i<=this._ne.lng;return this._sw.lng>this._ne.lng&&(n=this._sw.lng>=i&&i>=this._ne.lng),this._sw.lat<=r&&r<=this._ne.lat&&n}static convert(t){return t instanceof z?t:t?new z(t):t}static fromLngLat(e,i=0){const r=360*i/40075017,n=r/Math.cos(Math.PI/180*e.lat);return new z(new t.LngLat(e.lng-n,e.lat-r),new t.LngLat(e.lng+n,e.lat+r))}}class L{constructor(t,e,i){this.bounds=z.convert(this.validateBounds(t)),this.minzoom=e||0,this.maxzoom=i||24}validateBounds(t){return Array.isArray(t)&&4===t.length?[Math.max(-180,t[0]),Math.max(-90,t[1]),Math.min(180,t[2]),Math.min(90,t[3])]:[-180,-90,180,90]}contains(e){const i=Math.pow(2,e.z),r=Math.floor(t.mercatorXfromLng(this.bounds.getWest())*i),n=Math.floor(t.mercatorYfromLat(this.bounds.getNorth())*i),a=Math.ceil(t.mercatorXfromLng(this.bounds.getEast())*i),o=Math.ceil(t.mercatorYfromLat(this.bounds.getSouth())*i);return e.x>=r&&e.x<a&&e.y>=n&&e.y<o}}class D extends t.Evented{constructor(e,i,r,n){if(super(),this.load=()=>{this._loaded=!1,this.fire(new t.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=P(this._options,this.map._requestManager,((e,i)=>{this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),e?this.fire(new t.ErrorEvent(e)):i&&(t.extend(this,i),i.bounds&&(this.tileBounds=new L(i.bounds,this.minzoom,this.maxzoom)),this.fire(new t.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new t.Event("data",{dataType:"source",sourceDataType:"content"})))}))},this.serialize=()=>t.extend({},this._options),this.id=e,this.dispatcher=r,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,t.extend(this,t.pick(i,["url","scheme","tileSize","promoteId"])),this._options=t.extend({type:"vector"},i),this._collectResourceTiming=i.collectResourceTiming,512!==this.tileSize)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(n)}loaded(){return this._loaded}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}onAdd(t){this.map=t,this.load()}setSourceProperty(t){this._tileJSONRequest&&this._tileJSONRequest.cancel(),t(),this.load()}setTiles(t){return this.setSourceProperty((()=>{this._options.tiles=t})),this}setUrl(t){return this.setSourceProperty((()=>{this.url=t,this._options.url=t})),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}loadTile(t,e){const i=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),r={request:this.map._requestManager.transformRequest(i,h.Tile),uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,tileSize:this.tileSize*t.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};function n(i,r){return delete t.request,t.aborted?e(null):i&&404!==i.status?e(i):(r&&r.resourceTiming&&(t.resourceTiming=r.resourceTiming),this.map._refreshExpiredTiles&&r&&t.setExpiryData(r),t.loadVectorData(r,this.map.painter),e(null),void(t.reloadCallback&&(this.loadTile(t,t.reloadCallback),t.reloadCallback=null)))}r.request.collectResourceTiming=this._collectResourceTiming,t.actor&&"expired"!==t.state?"loading"===t.state?t.reloadCallback=e:t.request=t.actor.send("reloadTile",r,n.bind(this)):(t.actor=this.dispatcher.getActor(),t.request=t.actor.send("loadTile",r,n.bind(this)))}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.actor&&t.actor.send("abortTile",{uid:t.uid,type:this.type,source:this.id},void 0)}unloadTile(t){t.unloadVectorData(),t.actor&&t.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id},void 0)}hasTransition(){return!1}}class R extends t.Evented{constructor(e,i,r,n){super(),this.id=e,this.dispatcher=r,this.setEventedParent(n),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=t.extend({type:"raster"},i),t.extend(this,t.pick(i,["url","scheme","tileSize"]))}load(){this._loaded=!1,this.fire(new t.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=P(this._options,this.map._requestManager,((e,i)=>{this._tileJSONRequest=null,this._loaded=!0,e?this.fire(new t.ErrorEvent(e)):i&&(t.extend(this,i),i.bounds&&(this.tileBounds=new L(i.bounds,this.minzoom,this.maxzoom)),this.fire(new t.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new t.Event("data",{dataType:"source",sourceDataType:"content"})))}))}loaded(){return this._loaded}onAdd(t){this.map=t,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return t.extend({},this._options)}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}loadTile(t,e){const i=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);t.request=c.getImage(this.map._requestManager.transformRequest(i,h.Tile),((i,r,n)=>{if(delete t.request,t.aborted)t.state="unloaded",e(null);else if(i)t.state="errored",e(i);else if(r){this.map._refreshExpiredTiles&&n&&t.setExpiryData(n);const i=this.map.painter.context,a=i.gl;t.texture=this.map.painter.getTileTexture(r.width),t.texture?t.texture.update(r,{useMipmap:!0}):(t.texture=new x(i,r,a.RGBA,{useMipmap:!0}),t.texture.bind(a.LINEAR,a.CLAMP_TO_EDGE,a.LINEAR_MIPMAP_NEAREST),i.extTextureFilterAnisotropic&&a.texParameterf(a.TEXTURE_2D,i.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,i.extTextureFilterAnisotropicMax)),t.state="loaded",e(null)}}),this.map._refreshExpiredTiles)}abortTile(t,e){t.request&&(t.request.cancel(),delete t.request),e()}unloadTile(t,e){t.texture&&this.map.painter.saveTileTexture(t.texture),e()}hasTransition(){return!1}}class B extends R{constructor(e,i,r,n){super(e,i,r,n),this.type="raster-dem",this.maxzoom=22,this._options=t.extend({type:"raster-dem"},i),this.encoding=i.encoding||"mapbox",this.redFactor=i.redFactor,this.greenFactor=i.greenFactor,this.blueFactor=i.blueFactor,this.baseShift=i.baseShift}loadTile(e,i){const r=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),n=this.map._requestManager.transformRequest(r,h.Tile);function a(t,r){t&&(e.state="errored",i(t)),r&&(e.dem=r,e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0,e.state="loaded",i(null))}e.neighboringTiles=this._getNeighboringTiles(e.tileID),e.request=c.getImage(n,(async(r,n,o)=>{if(delete e.request,e.aborted)e.state="unloaded",i(null);else if(r)e.state="errored",i(r);else if(n){this.map._refreshExpiredTiles&&e.setExpiryData(o);const i=t.isImageBitmap(n)&&t.offscreenCanvasSupported()?n:await async function(e){if("undefined"!=typeof VideoFrame&&t.isOffscreenCanvasDistorted()){const i=e.width+2,r=e.height+2;try{return new t.RGBAImage({width:i,height:r},await t.readImageUsingVideoFrame(e,-1,-1,i,r))}catch(t){}}return t.browser.getImageData(e,1)}(n),r={uid:e.uid,coord:e.tileID,source:this.id,rawImageData:i,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};e.actor&&"expired"!==e.state||(e.actor=this.dispatcher.getActor(),e.actor.send("loadDEMTile",r,a))}}),this.map._refreshExpiredTiles)}_getNeighboringTiles(e){const i=e.canonical,r=Math.pow(2,i.z),n=(i.x-1+r)%r,a=0===i.x?e.wrap-1:e.wrap,o=(i.x+1+r)%r,s=i.x+1===r?e.wrap+1:e.wrap,l={};return l[new t.OverscaledTileID(e.overscaledZ,a,i.z,n,i.y).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,s,i.z,o,i.y).key]={backfilled:!1},i.y>0&&(l[new t.OverscaledTileID(e.overscaledZ,a,i.z,n,i.y-1).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,e.wrap,i.z,i.x,i.y-1).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,s,i.z,o,i.y-1).key]={backfilled:!1}),i.y+1<r&&(l[new t.OverscaledTileID(e.overscaledZ,a,i.z,n,i.y+1).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,e.wrap,i.z,i.x,i.y+1).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,s,i.z,o,i.y+1).key]={backfilled:!1}),l}unloadTile(t){t.demTexture&&this.map.painter.saveTileTexture(t.demTexture),t.fbo&&(t.fbo.destroy(),delete t.fbo),t.dem&&delete t.dem,delete t.neighboringTiles,t.state="unloaded",t.actor&&t.actor.send("removeDEMTile",{uid:t.uid,source:this.id})}}class F extends t.Evented{constructor(e,i,r,n){super(),this.load=()=>{this._updateWorkerData()},this.serialize=()=>t.extend({},this._options,{type:this.type,data:this._data}),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=r.getActor(),this.setEventedParent(n),this._data=i.data,this._options=t.extend({},i),this._collectResourceTiming=i.collectResourceTiming,void 0!==i.maxzoom&&(this.maxzoom=i.maxzoom),i.type&&(this.type=i.type),i.attribution&&(this.attribution=i.attribution),this.promoteId=i.promoteId;const a=t.EXTENT/this.tileSize;this.workerOptions=t.extend({source:this.id,cluster:i.cluster||!1,geojsonVtOptions:{buffer:(void 0!==i.buffer?i.buffer:128)*a,tolerance:(void 0!==i.tolerance?i.tolerance:.375)*a,extent:t.EXTENT,maxZoom:this.maxzoom,lineMetrics:i.lineMetrics||!1,generateId:i.generateId||!1},superclusterOptions:{maxZoom:void 0!==i.clusterMaxZoom?i.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,i.clusterMinPoints||2),extent:t.EXTENT,radius:(i.clusterRadius||50)*a,log:!1,generateId:i.generateId||!1},clusterProperties:i.clusterProperties,filter:i.filter},i.workerOptions),"string"==typeof this.promoteId&&(this.workerOptions.promoteId=this.promoteId)}onAdd(t){this.map=t,this.load()}setData(t){return this._data=t,this._updateWorkerData(),this}updateData(t){return this._updateWorkerData(t),this}setClusterOptions(t){return this.workerOptions.cluster=t.cluster,t&&(void 0!==t.clusterRadius&&(this.workerOptions.superclusterOptions.radius=t.clusterRadius),void 0!==t.clusterMaxZoom&&(this.workerOptions.superclusterOptions.maxZoom=t.clusterMaxZoom)),this._updateWorkerData(),this}getClusterExpansionZoom(t,e){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:t,source:this.id},e),this}getClusterChildren(t,e){return this.actor.send("geojson.getClusterChildren",{clusterId:t,source:this.id},e),this}getClusterLeaves(t,e,i,r){return this.actor.send("geojson.getClusterLeaves",{source:this.id,clusterId:t,limit:e,offset:i},r),this}_updateWorkerData(e){const i=t.extend({},this.workerOptions);e?i.dataDiff=e:"string"==typeof this._data?(i.request=this.map._requestManager.transformRequest(t.browser.resolveURL(this._data),h.Source),i.request.collectResourceTiming=this._collectResourceTiming):i.data=JSON.stringify(this._data),this._pendingLoads++,this.fire(new t.Event("dataloading",{dataType:"source"})),this.actor.send(`${this.type}.loadData`,i,((e,i)=>{if(this._pendingLoads--,this._removed||i&&i.abandoned)return void this.fire(new t.Event("dataabort",{dataType:"source"}));let r=null;if(i&&i.resourceTiming&&i.resourceTiming[this.id]&&(r=i.resourceTiming[this.id].slice(0)),e)return void this.fire(new t.ErrorEvent(e));const n={dataType:"source"};this._collectResourceTiming&&r&&r.length>0&&t.extend(n,{resourceTiming:r}),this.fire(new t.Event("data",{...n,sourceDataType:"metadata"})),this.fire(new t.Event("data",{...n,sourceDataType:"content"}))}))}loaded(){return 0===this._pendingLoads}loadTile(t,e){const i=t.actor?"reloadTile":"loadTile";t.actor=this.actor;const r={type:this.type,uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};t.request=this.actor.send(i,r,((r,n)=>(delete t.request,t.unloadVectorData(),t.aborted?e(null):r?e(r):(t.loadVectorData(n,this.map.painter,"reloadTile"===i),e(null)))))}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.aborted=!0}unloadTile(t){t.unloadVectorData(),this.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id})}onRemove(){this._removed=!0,this.actor.send("removeSource",{type:this.type,source:this.id})}hasTransition(){return!1}}var O=t.createLayout([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class U extends t.Evented{constructor(e,i,r,n){super(),this.load=(e,i)=>{this._loaded=!1,this.fire(new t.Event("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=c.getImage(this.map._requestManager.transformRequest(this.url,h.Image),((r,n)=>{this._request=null,this._loaded=!0,r?this.fire(new t.ErrorEvent(r)):n&&(this.image=n,e&&(this.coordinates=e),i&&i(),this._finishLoading())}))},this.prepare=()=>{if(0===Object.keys(this.tiles).length||!this.image)return;const e=this.map.painter.context,i=e.gl;this.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,O.members)),this.boundsSegments||(this.boundsSegments=t.SegmentVector.simpleSegment(0,0,4,2)),this.texture||(this.texture=new x(e,this.image,i.RGBA),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE));let r=!1;for(const t in this.tiles){const e=this.tiles[t];"loaded"!==e.state&&(e.state="loaded",e.texture=this.texture,r=!0)}r&&this.fire(new t.Event("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))},this.serialize=()=>({type:"image",url:this.options.url,coordinates:this.coordinates}),this.id=e,this.dispatcher=r,this.coordinates=i.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(n),this.options=i}loaded(){return this._loaded}updateImage(t){return t.url?(this._request&&(this._request.cancel(),this._request=null),this.options.url=t.url,this.load(t.coordinates,(()=>{this.texture=null})),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new t.Event("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(t){this.map=t,this.load()}onRemove(){this._request&&(this._request.cancel(),this._request=null)}setCoordinates(e){this.coordinates=e;const i=e.map(t.MercatorCoordinate.fromLngLat);this.tileID=function(e){let i=1/0,r=1/0,n=-1/0,a=-1/0;for(const t of e)i=Math.min(i,t.x),r=Math.min(r,t.y),n=Math.max(n,t.x),a=Math.max(a,t.y);const o=Math.max(n-i,a-r),s=Math.max(0,Math.floor(-Math.log(o)/Math.LN2)),l=Math.pow(2,s);return new t.CanonicalTileID(s,Math.floor((i+n)/2*l),Math.floor((r+a)/2*l))}(i),this.minzoom=this.maxzoom=this.tileID.z;const r=i.map((t=>this.tileID.getTilePoint(t)._round()));return this._boundsArray=new t.RasterBoundsArray,this._boundsArray.emplaceBack(r[0].x,r[0].y,0,0),this._boundsArray.emplaceBack(r[1].x,r[1].y,t.EXTENT,0),this._boundsArray.emplaceBack(r[3].x,r[3].y,0,t.EXTENT),this._boundsArray.emplaceBack(r[2].x,r[2].y,t.EXTENT,t.EXTENT),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new t.Event("data",{dataType:"source",sourceDataType:"content"})),this}loadTile(t,e){this.tileID&&this.tileID.equals(t.tileID.canonical)?(this.tiles[String(t.tileID.wrap)]=t,t.buckets={},e(null)):(t.state="errored",e(null))}hasTransition(){return!1}}class V extends U{constructor(e,i,r,n){super(e,i,r,n),this.load=()=>{this._loaded=!1;const e=this.options;this.urls=[];for(const t of e.urls)this.urls.push(this.map._requestManager.transformRequest(t,h.Source).url);t.getVideo(this.urls,((e,i)=>{this._loaded=!0,e?this.fire(new t.ErrorEvent(e)):i&&(this.video=i,this.video.loop=!0,this.video.addEventListener("playing",(()=>{this.map.triggerRepaint()})),this.map&&this.video.play(),this._finishLoading())}))},this.prepare=()=>{if(0===Object.keys(this.tiles).length||this.video.readyState<2)return;const e=this.map.painter.context,i=e.gl;this.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,O.members)),this.boundsSegments||(this.boundsSegments=t.SegmentVector.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE),i.texSubImage2D(i.TEXTURE_2D,0,0,0,i.RGBA,i.UNSIGNED_BYTE,this.video)):(this.texture=new x(e,this.video,i.RGBA),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE));let r=!1;for(const t in this.tiles){const e=this.tiles[t];"loaded"!==e.state&&(e.state="loaded",e.texture=this.texture,r=!0)}r&&this.fire(new t.Event("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))},this.serialize=()=>({type:"video",urls:this.urls,coordinates:this.coordinates}),this.roundZoom=!0,this.type="video",this.options=i}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(e){if(this.video){const i=this.video.seekable;e<i.start(0)||e>i.end(0)?this.fire(new t.ErrorEvent(new t.ValidationError(`sources.${this.id}`,null,`Playback for this video can be set only between the ${i.start(0)} and ${i.end(0)}-second mark.`))):this.video.currentTime=e}}getVideo(){return this.video}onAdd(t){this.map||(this.map=t,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}hasTransition(){return this.video&&!this.video.paused}}class N extends U{constructor(e,i,r,n){super(e,i,r,n),this.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 t.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())},this.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())return;if(0===Object.keys(this.tiles).length)return;const i=this.map.painter.context,r=i.gl;this.boundsBuffer||(this.boundsBuffer=i.createVertexBuffer(this._boundsArray,O.members)),this.boundsSegments||(this.boundsSegments=t.SegmentVector.simpleSegment(0,0,4,2)),this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new x(i,this.canvas,r.RGBA,{premultiply:!0});let n=!1;for(const t in this.tiles){const e=this.tiles[t];"loaded"!==e.state&&(e.state="loaded",e.texture=this.texture,n=!0)}n&&this.fire(new t.Event("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))},this.serialize=()=>({type:"canvas",coordinates:this.coordinates}),i.coordinates?Array.isArray(i.coordinates)&&4===i.coordinates.length&&!i.coordinates.some((t=>!Array.isArray(t)||2!==t.length||t.some((t=>"number"!=typeof t))))||this.fire(new t.ErrorEvent(new t.ValidationError(`sources.${e}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new t.ErrorEvent(new t.ValidationError(`sources.${e}`,null,'missing required property "coordinates"'))),i.animate&&"boolean"!=typeof i.animate&&this.fire(new t.ErrorEvent(new t.ValidationError(`sources.${e}`,null,'optional "animate" property must be a boolean value'))),i.canvas?"string"==typeof i.canvas||i.canvas instanceof HTMLCanvasElement||this.fire(new t.ErrorEvent(new t.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 t.ErrorEvent(new t.ValidationError(`sources.${e}`,null,'missing required property "canvas"'))),this.options=i,this.animate=void 0===i.animate||i.animate}getCanvas(){return this.canvas}onAdd(t){this.map=t,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const t of[this.canvas.width,this.canvas.height])if(isNaN(t)||t<=0)return!0;return!1}}const $={},j=t=>{switch(t){case"geojson":return F;case"image":return U;case"raster":return R;case"raster-dem":return B;case"vector":return D;case"video":return V;case"canvas":return N}return $[t]};function q(e,i){const r=t.create();return t.translate(r,r,[1,1,0]),t.scale(r,r,[.5*e.width,.5*e.height,1]),t.multiply(r,r,e.calculatePosMatrix(i.toUnwrapped()))}function Z(t,e,i,r,n,a){const o=function(t,e,i){if(t)for(const r of t){const t=e[r];if(t&&t.source===i&&"fill-extrusion"===t.type)return!0}else for(const t in e){const r=e[t];if(r.source===i&&"fill-extrusion"===r.type)return!0}return!1}(n&&n.layers,e,t.id),s=a.maxPitchScaleFactor(),l=t.tilesIn(r,s,o);l.sort(G);const c=[];for(const r of l)c.push({wrappedTileID:r.tileID.wrapped().key,queryResults:r.tile.queryRenderedFeatures(e,i,t._state,r.queryGeometry,r.cameraQueryGeometry,r.scale,n,a,s,q(t.transform,r.tileID))});const h=function(t){const e={},i={};for(const r of t){const t=r.queryResults,n=r.wrappedTileID,a=i[n]=i[n]||{};for(const i in t){const r=t[i],n=a[i]=a[i]||{},o=e[i]=e[i]||[];for(const t of r)n[t.featureIndex]||(n[t.featureIndex]=!0,o.push(t))}}return e}(c);for(const e in h)h[e].forEach((e=>{const i=e.feature,r=t.getFeatureState(i.layer["source-layer"],i.id);i.source=i.layer.source,i.layer["source-layer"]&&(i.sourceLayer=i.layer["source-layer"]),i.state=r}));return h}function G(t,e){const i=t.tileID,r=e.tileID;return i.overscaledZ-r.overscaledZ||i.canonical.y-r.canonical.y||i.wrap-r.wrap||i.canonical.x-r.canonical.x}class H{constructor(e,i){this.timeAdded=0,this.fadeEndTime=0,this.tileID=e,this.uid=t.uniqueId(),this.uses=0,this.tileSize=i,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttCoords={},this.expiredRequestCount=0,this.state="loading"}registerFadeDuration(t){const e=t+this.timeAdded;e<this.fadeEndTime||(this.fadeEndTime=e)}wasRequested(){return"errored"===this.state||"loaded"===this.state||"reloading"===this.state}clearTextures(t){this.demTexture&&t.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(e,i,r){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(t,e){const i={};if(!e)return i;for(const r of t){const t=r.layerIds.map((t=>e.getLayer(t))).filter(Boolean);if(0!==t.length){r.layers=t,r.stateDependentLayerIds&&(r.stateDependentLayers=r.stateDependentLayerIds.map((e=>t.filter((t=>t.id===e))[0])));for(const e of t)i[e.id]=r}}return i}(e.buckets,i.style),this.hasSymbolBuckets=!1;for(const e in this.buckets){const i=this.buckets[e];if(i instanceof t.SymbolBucket){if(this.hasSymbolBuckets=!0,!r)break;i.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const e in this.buckets){const i=this.buckets[e];if(i instanceof t.SymbolBucket&&i.hasRTLText){this.hasRTLText=!0,t.lazyLoadRTLTextPlugin();break}}this.queryPadding=0;for(const t in this.buckets){const e=this.buckets[t];this.queryPadding=Math.max(this.queryPadding,i.style.getLayer(t).queryRadius(e))}e.imageAtlas&&(this.imageAtlas=e.imageAtlas),e.glyphAtlasImage&&(this.glyphAtlasImage=e.glyphAtlasImage)}else this.collisionBoxArray=new t.CollisionBoxArray}unloadVectorData(){for(const t in this.buckets)this.buckets[t].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(t){return this.buckets[t.id]}upload(t){for(const e in this.buckets){const i=this.buckets[e];i.uploadPending()&&i.upload(t)}const e=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new x(t,this.imageAtlas.image,e.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new x(t,this.glyphAtlasImage,e.ALPHA),this.glyphAtlasImage=null)}prepare(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture)}queryRenderedFeatures(t,e,i,r,n,a,o,s,l,c){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:r,cameraQueryGeometry:n,scale:a,tileSize:this.tileSize,pixelPosMatrix:c,transform:s,params:o,queryPadding:this.queryPadding*l},t,e,i):{}}querySourceFeatures(e,i){const r=this.latestFeatureIndex;if(!r||!r.rawTileData)return;const n=r.loadVTLayers(),a=i&&i.sourceLayer?i.sourceLayer:"",o=n._geojsonTileLayer||n[a];if(!o)return;const s=t.createFilter(i&&i.filter),{z:l,x:c,y:h}=this.tileID.canonical,u={z:l,x:c,y:h};for(let i=0;i<o.length;i++){const n=o.feature(i);if(s.needGeometry){const e=t.toEvaluationFeature(n,!0);if(!s.filter(new t.EvaluationParameters(this.tileID.overscaledZ),e,this.tileID.canonical))continue}else if(!s.filter(new t.EvaluationParameters(this.tileID.overscaledZ),n))continue;const p=r.getId(n,a),d=new t.GeoJSONFeature(n,l,c,h,p);d.tile=u,e.push(d)}}hasData(){return"loaded"===this.state||"reloading"===this.state||"expired"===this.state}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(e){const i=this.expirationTime;if(e.cacheControl){const i=t.parseCacheControl(e.cacheControl);i["max-age"]&&(this.expirationTime=Date.now()+1e3*i["max-age"])}else e.expires&&(this.expirationTime=new Date(e.expires).getTime());if(this.expirationTime){const t=Date.now();let e=!1;if(this.expirationTime>t)e=!1;else if(i)if(this.expirationTime<i)e=!0;else{const r=this.expirationTime-i;r?this.expirationTime=t+Math.max(r,3e4):e=!0}else e=!0;e?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-(new Date).getTime(),Math.pow(2,31)-1)}setFeatureState(t,e){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||0===Object.keys(t).length)return;const i=this.latestFeatureIndex.loadVTLayers();for(const r in this.buckets){if(!e.style.hasLayer(r))continue;const n=this.buckets[r],a=n.layers[0].sourceLayer||"_geojsonTileLayer",o=i[a],s=t[a];if(!o||!s||0===Object.keys(s).length)continue;n.update(s,o,this.imageAtlas&&this.imageAtlas.patternPositions||{});const l=e&&e.style&&e.style.getLayer(r);l&&(this.queryPadding=Math.max(this.queryPadding,l.queryRadius(n)))}}holdingForFade(){return void 0!==this.symbolFadeHoldUntil}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<t.browser.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(e){this.symbolFadeHoldUntil=t.browser.now()+e}setDependencies(t,e){const i={};for(const t of e)i[t]=!0;this.dependencies[t]=i}hasDependency(t,e){for(const i of t){const t=this.dependencies[i];if(t)for(const i of e)if(t[i])return!0}return!1}}class X{constructor(t,e){this.max=t,this.onRemove=e,this.reset()}reset(){for(const t in this.data)for(const e of this.data[t])e.timeout&&clearTimeout(e.timeout),this.onRemove(e.value);return this.data={},this.order=[],this}add(t,e,i){const r=t.wrapped().key;void 0===this.data[r]&&(this.data[r]=[]);const n={value:e,timeout:void 0};if(void 0!==i&&(n.timeout=setTimeout((()=>{this.remove(t,n)}),i)),this.data[r].push(n),this.order.push(r),this.order.length>this.max){const t=this._getAndRemoveByKey(this.order[0]);t&&this.onRemove(t)}return this}has(t){return t.wrapped().key in this.data}getAndRemove(t){return this.has(t)?this._getAndRemoveByKey(t.wrapped().key):null}_getAndRemoveByKey(t){const e=this.data[t].shift();return e.timeout&&clearTimeout(e.timeout),0===this.data[t].length&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),e.value}getByKey(t){const e=this.data[t];return e?e[0].value:null}get(t){return this.has(t)?this.data[t.wrapped().key][0].value:null}remove(t,e){if(!this.has(t))return this;const i=t.wrapped().key,r=void 0===e?0:this.data[i].indexOf(e),n=this.data[i][r];return this.data[i].splice(r,1),n.timeout&&clearTimeout(n.timeout),0===this.data[i].length&&delete this.data[i],this.onRemove(n.value),this.order.splice(this.order.indexOf(i),1),this}setMaxSize(t){for(this.max=t;this.order.length>this.max;){const t=this._getAndRemoveByKey(this.order[0]);t&&this.onRemove(t)}return this}filter(t){const e=[];for(const i in this.data)for(const r of this.data[i])t(r.value)||e.push(r);for(const t of e)this.remove(t.value.tileID,t)}}class W{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(e,i,r){const n=String(i);if(this.stateChanges[e]=this.stateChanges[e]||{},this.stateChanges[e][n]=this.stateChanges[e][n]||{},t.extend(this.stateChanges[e][n],r),null===this.deletedStates[e]){this.deletedStates[e]={};for(const t in this.state[e])t!==n&&(this.deletedStates[e][t]=null)}else if(this.deletedStates[e]&&null===this.deletedStates[e][n]){this.deletedStates[e][n]={};for(const t in this.state[e][n])r[t]||(this.deletedStates[e][n][t]=null)}else for(const t in r)this.deletedStates[e]&&this.deletedStates[e][n]&&null===this.deletedStates[e][n][t]&&delete this.deletedStates[e][n][t]}removeFeatureState(t,e,i){if(null===this.deletedStates[t])return;const r=String(e);if(this.deletedStates[t]=this.deletedStates[t]||{},i&&void 0!==e)null!==this.deletedStates[t][r]&&(this.deletedStates[t][r]=this.deletedStates[t][r]||{},this.deletedStates[t][r][i]=null);else if(void 0!==e)if(this.stateChanges[t]&&this.stateChanges[t][r])for(i in this.deletedStates[t][r]={},this.stateChanges[t][r])this.deletedStates[t][r][i]=null;else this.deletedStates[t][r]=null;else this.deletedStates[t]=null}getState(e,i){const r=String(i),n=t.extend({},(this.state[e]||{})[r],(this.stateChanges[e]||{})[r]);if(null===this.deletedStates[e])return{};if(this.deletedStates[e]){const t=this.deletedStates[e][i];if(null===t)return{};for(const e in t)delete n[e]}return n}initializeTileState(t,e){t.setFeatureState(this.state,e)}coalesceChanges(e,i){const r={};for(const e in this.stateChanges){this.state[e]=this.state[e]||{};const i={};for(const r in this.stateChanges[e])this.state[e][r]||(this.state[e][r]={}),t.extend(this.state[e][r],this.stateChanges[e][r]),i[r]=this.state[e][r];r[e]=i}for(const e in this.deletedStates){this.state[e]=this.state[e]||{};const i={};if(null===this.deletedStates[e])for(const t in this.state[e])i[t]={},this.state[e][t]={};else for(const t in this.deletedStates[e]){if(null===this.deletedStates[e][t])this.state[e][t]={};else for(const i of Object.keys(this.deletedStates[e][t]))delete this.state[e][t][i];i[t]=this.state[e][t]}r[e]=r[e]||{},t.extend(r[e],i)}if(this.stateChanges={},this.deletedStates={},0!==Object.keys(r).length)for(const t in e)e[t].setFeatureState(r,i)}}class K extends t.Evented{constructor(t,e,i){super(),this.id=t,this.dispatcher=i,this.on("data",(t=>{"source"===t.dataType&&"metadata"===t.sourceDataType&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&"source"===t.dataType&&"content"===t.sourceDataType&&(this.reload(),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)})),this.on("dataloading",(()=>{this._sourceErrored=!1})),this.on("error",(()=>{this._sourceErrored=this._source.loaded()})),this._source=((t,e,i,r)=>{const n=new(j(e.type))(t,e,i,r);if(n.id!==t)throw new Error(`Expected Source id to be ${t} instead of ${n.id}`);return n})(t,e,i,this),this._tiles={},this._cache=new X(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new W,this._didEmitContent=!1,this._updated=!1}onAdd(t){this.map=t,this._maxTileCacheSize=t?t._maxTileCacheSize:null,this._maxTileCacheZoomLevels=t?t._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(t)}onRemove(t){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(t)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded)return!1;if(!this._source.loaded())return!1;if(!(void 0===this.used&&void 0===this.usedForTerrain||this.used||this.usedForTerrain))return!0;if(!this._updated)return!1;for(const t in this._tiles){const e=this._tiles[t];if("loaded"!==e.state&&"errored"!==e.state)return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const t=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,t&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(t,e){return this._source.loadTile(t,e)}_unloadTile(t){if(this._source.unloadTile)return this._source.unloadTile(t,(()=>{}))}_abortTile(e){this._source.abortTile&&this._source.abortTile(e,(()=>{})),this._source.fire(new t.Event("dataabort",{tile:e,coord:e.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(t){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const e in this._tiles){const i=this._tiles[e];i.upload(t),i.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map((t=>t.tileID)).sort(Y).map((t=>t.key))}getRenderableIds(e){const i=[];for(const t in this._tiles)this._isIdRenderable(t,e)&&i.push(this._tiles[t]);return e?i.sort(((e,i)=>{const r=e.tileID,n=i.tileID,a=new t.Point(r.canonical.x,r.canonical.y)._rotate(this.transform.angle),o=new t.Point(n.canonical.x,n.canonical.y)._rotate(this.transform.angle);return r.overscaledZ-n.overscaledZ||o.y-a.y||o.x-a.x})).map((t=>t.tileID.key)):i.map((t=>t.tileID)).sort(Y).map((t=>t.key))}hasRenderableParent(t){const e=this.findLoadedParent(t,0);return!!e&&this._isIdRenderable(e.tileID.key)}_isIdRenderable(t,e){return this._tiles[t]&&this._tiles[t].hasData()&&!this._coveredTiles[t]&&(e||!this._tiles[t].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const t in this._tiles)"errored"!==this._tiles[t].state&&this._reloadTile(t,"reloading")}}_reloadTile(t,e){const i=this._tiles[t];i&&("loading"!==i.state&&(i.state=e),this._loadTile(i,this._tileLoaded.bind(this,i,t,e)))}_tileLoaded(e,i,r,n){if(n)return e.state="errored",void(404!==n.status?this._source.fire(new t.ErrorEvent(n,{tile:e})):this.update(this.transform,this.terrain));e.timeAdded=t.browser.now(),"expired"===r&&(e.refreshedUponExpiration=!0),this._setTileReloadTimer(i,e),"raster-dem"===this.getSource().type&&e.dem&&this._backfillDEM(e),this._state.initializeTileState(e,this.map?this.map.painter:null),e.aborted||this._source.fire(new t.Event("data",{dataType:"source",tile:e,coord:e.tileID}))}_backfillDEM(t){const e=this.getRenderableIds();for(let r=0;r<e.length;r++){const n=e[r];if(t.neighboringTiles&&t.neighboringTiles[n]){const e=this.getTileByID(n);i(t,e),i(e,t)}}function i(t,e){t.needsHillshadePrepare=!0,t.needsTerrainPrepare=!0;let i=e.tileID.canonical.x-t.tileID.canonical.x;const r=e.tileID.canonical.y-t.tileID.canonical.y,n=Math.pow(2,t.tileID.canonical.z),a=e.tileID.key;0===i&&0===r||Math.abs(r)>1||(Math.abs(i)>1&&(1===Math.abs(i+n)?i+=n:1===Math.abs(i-n)&&(i-=n)),e.dem&&t.dem&&(t.dem.backfillBorder(e.dem,i,r),t.neighboringTiles&&t.neighboringTiles[a]&&(t.neighboringTiles[a].backfilled=!0)))}}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._tiles[t]}_retainLoadedChildren(t,e,i,r){for(const n in this._tiles){let a=this._tiles[n];if(r[n]||!a.hasData()||a.tileID.overscaledZ<=e||a.tileID.overscaledZ>i)continue;let o=a.tileID;for(;a&&a.tileID.overscaledZ>e+1;){const t=a.tileID.scaledTo(a.tileID.overscaledZ-1);a=this._tiles[t.key],a&&a.hasData()&&(o=t)}let s=o;for(;s.overscaledZ>e;)if(s=s.scaledTo(s.overscaledZ-1),t[s.key]){r[o.key]=o;break}}}findLoadedParent(t,e){if(t.key in this._loadedParentTiles){const i=this._loadedParentTiles[t.key];return i&&i.tileID.overscaledZ>=e?i:null}for(let i=t.overscaledZ-1;i>=e;i--){const e=t.scaledTo(i),r=this._getLoadedTile(e);if(r)return r}}_getLoadedTile(t){const e=this._tiles[t.key];return e&&e.hasData()?e:this._cache.getByKey(t.wrapped().key)}updateCacheSize(e){const i=Math.ceil(e.width/this._source.tileSize)+1,r=Math.ceil(e.height/this._source.tileSize)+1,n=Math.floor(i*r*(null===this._maxTileCacheZoomLevels?t.config.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),a="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,n):n;this._cache.setMaxSize(a)}handleWrapJump(t){const e=Math.round((t-(void 0===this._prevLng?t:this._prevLng))/360);if(this._prevLng=t,e){const t={};for(const i in this._tiles){const r=this._tiles[i];r.tileID=r.tileID.unwrapTo(r.tileID.wrap+e),t[r.tileID.key]=r}this._tiles=t;for(const t in this._timers)clearTimeout(this._timers[t]),delete this._timers[t];for(const t in this._tiles)this._setTileReloadTimer(t,this._tiles[t])}}update(e,i){if(this.transform=e,this.terrain=i,!this._sourceLoaded||this._paused)return;let r;this.updateCacheSize(e),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?r=e.getVisibleUnwrappedCoordinates(this._source.tileID).map((e=>new t.OverscaledTileID(e.canonical.z,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y))):(r=e.coveringTiles({tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:i}),this._source.hasTile&&(r=r.filter((t=>this._source.hasTile(t))))):r=[];const n=e.coveringZoomLevel(this._source),a=Math.max(n-K.maxOverzooming,this._source.minzoom),o=Math.max(n+K.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const t={};for(const e of r)if(e.canonical.z>this._source.minzoom){const i=e.scaledTo(e.canonical.z-1);t[i.key]=i;const r=e.scaledTo(Math.max(this._source.minzoom,Math.min(e.canonical.z,5)));t[r.key]=r}r=r.concat(Object.values(t))}const s=0===r.length&&!this._updated&&this._didEmitContent;this._updated=!0,s&&this.fire(new t.Event("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const l=this._updateRetainedTiles(r,n);if(J(this._source.type)){const e={},s={},c=Object.keys(l),h=t.browser.now();for(const t of c){const i=l[t],r=this._tiles[t];if(!r||0!==r.fadeEndTime&&r.fadeEndTime<=h)continue;const n=this.findLoadedParent(i,a);n&&(this._addTile(n.tileID),e[n.tileID.key]=n.tileID),s[t]=i}this._retainLoadedChildren(s,n,o,l);for(const t in e)l[t]||(this._coveredTiles[t]=!0,l[t]=e[t]);if(i){const t={},e={};for(const i of r)this._tiles[i.key].hasData()?t[i.key]=i:e[i.key]=i;for(const i in e){const r=e[i].children(this._source.maxzoom);this._tiles[r[0].key]&&this._tiles[r[1].key]&&this._tiles[r[2].key]&&this._tiles[r[3].key]&&(t[r[0].key]=l[r[0].key]=r[0],t[r[1].key]=l[r[1].key]=r[1],t[r[2].key]=l[r[2].key]=r[2],t[r[3].key]=l[r[3].key]=r[3],delete e[i])}for(const i in e){const r=this.findLoadedParent(e[i],this._source.minzoom);if(r){t[r.tileID.key]=l[r.tileID.key]=r.tileID;for(const e in t)t[e].isChildOf(r.tileID)&&delete t[e]}}for(const e in this._tiles)t[e]||(this._coveredTiles[e]=!0)}}for(const t in l)this._tiles[t].clearFadeHold();const c=t.keysDifference(this._tiles,l);for(const t of c){const e=this._tiles[t];e.hasSymbolBuckets&&!e.holdingForFade()?e.setHoldDuration(this.map._fadeDuration):e.hasSymbolBuckets&&!e.symbolFadeFinished()||this._removeTile(t)}this._updateLoadedParentTileCache()}releaseSymbolFadeTiles(){for(const t in this._tiles)this._tiles[t].holdingForFade()&&this._removeTile(t)}_updateRetainedTiles(t,e){const i={},r={},n=Math.max(e-K.maxOverzooming,this._source.minzoom),a=Math.max(e+K.maxUnderzooming,this._source.minzoom),o={};for(const r of t){const t=this._addTile(r);i[r.key]=r,t.hasData()||e<this._source.maxzoom&&(o[r.key]=r)}this._retainLoadedChildren(o,e,a,i);for(const a of t){let t=this._tiles[a.key];if(t.hasData())continue;if(e+1>this._source.maxzoom){const t=a.children(this._source.maxzoom)[0],e=this.getTile(t);if(e&&e.hasData()){i[t.key]=t;continue}}else{const t=a.children(this._source.maxzoom);if(i[t[0].key]&&i[t[1].key]&&i[t[2].key]&&i[t[3].key])continue}let o=t.wasRequested();for(let e=a.overscaledZ-1;e>=n;--e){const n=a.scaledTo(e);if(r[n.key])break;if(r[n.key]=!0,t=this.getTile(n),!t&&o&&(t=this._addTile(n)),t){const e=t.hasData();if((o||e)&&(i[n.key]=n),o=t.wasRequested(),e)break}}}return i}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const t in this._tiles){const e=[];let i,r=this._tiles[t].tileID;for(;r.overscaledZ>0;){if(r.key in this._loadedParentTiles){i=this._loadedParentTiles[r.key];break}e.push(r.key);const t=r.scaledTo(r.overscaledZ-1);if(i=this._getLoadedTile(t),i)break;r=t}for(const t of e)this._loadedParentTiles[t]=i}}_addTile(e){let i=this._tiles[e.key];if(i)return i;i=this._cache.getAndRemove(e),i&&(this._setTileReloadTimer(e.key,i),i.tileID=e,this._state.initializeTileState(i,this.map?this.map.painter:null),this._cacheTimers[e.key]&&(clearTimeout(this._cacheTimers[e.key]),delete this._cacheTimers[e.key],this._setTileReloadTimer(e.key,i)));const r=i;return i||(i=new H(e,this._source.tileSize*e.overscaleFactor()),this._loadTile(i,this._tileLoaded.bind(this,i,e.key,i.state))),i.uses++,this._tiles[e.key]=i,r||this._source.fire(new t.Event("dataloading",{tile:i,coord:i.tileID,dataType:"source"})),i}_setTileReloadTimer(t,e){t in this._timers&&(clearTimeout(this._timers[t]),delete this._timers[t]);const i=e.getExpiryTimeout();i&&(this._timers[t]=setTimeout((()=>{this._reloadTile(t,"expired"),delete this._timers[t]}),i))}_removeTile(t){const e=this._tiles[t];e&&(e.uses--,delete this._tiles[t],this._timers[t]&&(clearTimeout(this._timers[t]),delete this._timers[t]),e.uses>0||(e.hasData()&&"reloading"!==e.state?this._cache.add(e.tileID,e,e.getExpiryTimeout()):(e.aborted=!0,this._abortTile(e),this._unloadTile(e))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const t in this._tiles)this._removeTile(t);this._cache.reset()}tilesIn(e,i,r){const n=[],a=this.transform;if(!a)return n;const o=r?a.getCameraQueryGeometry(e):e,s=e.map((t=>a.pointCoordinate(t,this.terrain))),l=o.map((t=>a.pointCoordinate(t,this.terrain))),c=this.getIds();let h=1/0,u=1/0,p=-1/0,d=-1/0;for(const t of l)h=Math.min(h,t.x),u=Math.min(u,t.y),p=Math.max(p,t.x),d=Math.max(d,t.y);for(let e=0;e<c.length;e++){const r=this._tiles[c[e]];if(r.holdingForFade())continue;const o=r.tileID,m=Math.pow(2,a.zoom-r.tileID.overscaledZ),f=i*r.queryPadding*t.EXTENT/r.tileSize/m,g=[o.getTilePoint(new t.MercatorCoordinate(h,u)),o.getTilePoint(new t.MercatorCoordinate(p,d))];if(g[0].x-f<t.EXTENT&&g[0].y-f<t.EXTENT&&g[1].x+f>=0&&g[1].y+f>=0){const t=s.map((t=>o.getTilePoint(t))),e=l.map((t=>o.getTilePoint(t)));n.push({tile:r,tileID:o,queryGeometry:t,cameraQueryGeometry:e,scale:m})}}return n}getVisibleCoordinates(t){const e=this.getRenderableIds(t).map((t=>this._tiles[t].tileID));for(const t of e)t.posMatrix=this.transform.calculatePosMatrix(t.toUnwrapped());return e}hasTransition(){if(this._source.hasTransition())return!0;if(J(this._source.type)){const e=t.browser.now();for(const t in this._tiles)if(this._tiles[t].fadeEndTime>=e)return!0}return!1}setFeatureState(t,e,i){this._state.updateState(t=t||"_geojsonTileLayer",e,i)}removeFeatureState(t,e,i){this._state.removeFeatureState(t=t||"_geojsonTileLayer",e,i)}getFeatureState(t,e){return this._state.getState(t=t||"_geojsonTileLayer",e)}setDependencies(t,e,i){const r=this._tiles[t];r&&r.setDependencies(e,i)}reloadTilesForDependencies(t,e){for(const i in this._tiles)this._tiles[i].hasDependency(t,e)&&this._reloadTile(i,"reloading");this._cache.filter((i=>!i.hasDependency(t,e)))}}function Y(t,e){const i=Math.abs(2*t.wrap)-+(t.wrap<0),r=Math.abs(2*e.wrap)-+(e.wrap<0);return t.overscaledZ-e.overscaledZ||r-i||e.canonical.y-t.canonical.y||e.canonical.x-t.canonical.x}function J(t){return"raster"===t||"image"===t||"video"===t}K.maxOverzooming=10,K.maxUnderzooming=3;const Q="mapboxgl_preloaded_worker_pool";class tt{constructor(){this.active={}}acquire(e){if(!this.workers)for(this.workers=[];this.workers.length<tt.workerCount;)this.workers.push(new Worker(t.config.WORKER_URL));return this.active[e]=!0,this.workers.slice()}release(t){delete this.active[t],0===this.numActive()&&(this.workers.forEach((t=>{t.terminate()})),this.workers=null)}isPreloaded(){return!!this.active[Q]}numActive(){return Object.keys(this.active).length}}const et=Math.floor(t.browser.hardwareConcurrency/2);let it;function rt(){return it||(it=new tt),it}tt.workerCount=t.isSafari(globalThis)?Math.max(Math.min(et,3),1):1;class nt{constructor(t,e){this.reset(t,e)}reset(t,e){this.points=t||[],this._distances=[0];for(let t=1;t<this.points.length;t++)this._distances[t]=this._distances[t-1]+this.points[t].dist(this.points[t-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(e||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(e){if(1===this.points.length)return this.points[0];e=t.clamp(e,0,1);let i=1,r=this._distances[i];const n=e*this.paddedLength+this.padding;for(;r<n&&i<this._distances.length;)r=this._distances[++i];const a=i-1,o=this._distances[a],s=r-o,l=s>0?(n-o)/s:0;return this.points[a].mult(1-l).add(this.points[i].mult(l))}}function at(t,e){let i=!0;return"always"===t||"never"!==t&&"never"!==e||(i=!1),i}class ot{constructor(t,e,i){const r=this.boxCells=[],n=this.circleCells=[];this.xCellCount=Math.ceil(t/i),this.yCellCount=Math.ceil(e/i);for(let t=0;t<this.xCellCount*this.yCellCount;t++)r.push([]),n.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=t,this.height=e,this.xScale=this.xCellCount/t,this.yScale=this.yCellCount/e,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(t,e,i,r,n){this._forEachCell(e,i,r,n,this._insertBoxCell,this.boxUid++),this.boxKeys.push(t),this.bboxes.push(e),this.bboxes.push(i),this.bboxes.push(r),this.bboxes.push(n)}insertCircle(t,e,i,r){this._forEachCell(e-r,i-r,e+r,i+r,this._insertCircleCell,this.circleUid++),this.circleKeys.push(t),this.circles.push(e),this.circles.push(i),this.circles.push(r)}_insertBoxCell(t,e,i,r,n,a){this.boxCells[n].push(a)}_insertCircleCell(t,e,i,r,n,a){this.circleCells[n].push(a)}_query(t,e,i,r,n,a,o){if(i<0||t>this.width||r<0||e>this.height)return[];const s=[];if(t<=0&&e<=0&&this.width<=i&&this.height<=r){if(n)return[{key:null,x1:t,y1:e,x2:i,y2:r}];for(let t=0;t<this.boxKeys.length;t++)s.push({key:this.boxKeys[t],x1:this.bboxes[4*t],y1:this.bboxes[4*t+1],x2:this.bboxes[4*t+2],y2:this.bboxes[4*t+3]});for(let t=0;t<this.circleKeys.length;t++){const e=this.circles[3*t],i=this.circles[3*t+1],r=this.circles[3*t+2];s.push({key:this.circleKeys[t],x1:e-r,y1:i-r,x2:e+r,y2:i+r})}}else this._forEachCell(t,e,i,r,this._queryCell,s,{hitTest:n,overlapMode:a,seenUids:{box:{},circle:{}}},o);return s}query(t,e,i,r){return this._query(t,e,i,r,!1,null)}hitTest(t,e,i,r,n,a){return this._query(t,e,i,r,!0,n,a).length>0}hitTestCircle(t,e,i,r,n){const a=t-i,o=t+i,s=e-i,l=e+i;if(o<0||a>this.width||l<0||s>this.height)return!1;const c=[];return this._forEachCell(a,s,o,l,this._queryCellCircle,c,{hitTest:!0,overlapMode:r,circle:{x:t,y:e,radius:i},seenUids:{box:{},circle:{}}},n),c.length>0}_queryCell(t,e,i,r,n,a,o,s){const{seenUids:l,hitTest:c,overlapMode:h}=o,u=this.boxCells[n];if(null!==u){const n=this.bboxes;for(const o of u)if(!l.box[o]){l.box[o]=!0;const u=4*o,p=this.boxKeys[o];if(t<=n[u+2]&&e<=n[u+3]&&i>=n[u+0]&&r>=n[u+1]&&(!s||s(p))&&(!c||!at(h,p.overlapMode))&&(a.push({key:p,x1:n[u],y1:n[u+1],x2:n[u+2],y2:n[u+3]}),c))return!0}}const p=this.circleCells[n];if(null!==p){const n=this.circles;for(const o of p)if(!l.circle[o]){l.circle[o]=!0;const u=3*o,p=this.circleKeys[o];if(this._circleAndRectCollide(n[u],n[u+1],n[u+2],t,e,i,r)&&(!s||s(p))&&(!c||!at(h,p.overlapMode))){const t=n[u],e=n[u+1],i=n[u+2];if(a.push({key:p,x1:t-i,y1:e-i,x2:t+i,y2:e+i}),c)return!0}}}return!1}_queryCellCircle(t,e,i,r,n,a,o,s){const{circle:l,seenUids:c,overlapMode:h}=o,u=this.boxCells[n];if(null!==u){const t=this.bboxes;for(const e of u)if(!c.box[e]){c.box[e]=!0;const i=4*e,r=this.boxKeys[e];if(this._circleAndRectCollide(l.x,l.y,l.radius,t[i+0],t[i+1],t[i+2],t[i+3])&&(!s||s(r))&&!at(h,r.overlapMode))return a.push(!0),!0}}const p=this.circleCells[n];if(null!==p){const t=this.circles;for(const e of p)if(!c.circle[e]){c.circle[e]=!0;const i=3*e,r=this.circleKeys[e];if(this._circlesCollide(t[i],t[i+1],t[i+2],l.x,l.y,l.radius)&&(!s||s(r))&&!at(h,r.overlapMode))return a.push(!0),!0}}}_forEachCell(t,e,i,r,n,a,o,s){const l=this._convertToXCellCoord(t),c=this._convertToYCellCoord(e),h=this._convertToXCellCoord(i),u=this._convertToYCellCoord(r);for(let p=l;p<=h;p++)for(let l=c;l<=u;l++)if(n.call(this,t,e,i,r,this.xCellCount*l+p,a,o,s))return}_convertToXCellCoord(t){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(t*this.xScale)))}_convertToYCellCoord(t){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(t*this.yScale)))}_circlesCollide(t,e,i,r,n,a){const o=r-t,s=n-e,l=i+a;return l*l>o*o+s*s}_circleAndRectCollide(t,e,i,r,n,a,o){const s=(a-r)/2,l=Math.abs(t-(r+s));if(l>s+i)return!1;const c=(o-n)/2,h=Math.abs(e-(n+c));if(h>c+i)return!1;if(l<=s||h<=c)return!0;const u=l-s,p=h-c;return u*u+p*p<=i*i}}function st(e,i,r,n,a){const o=t.create();return i?(t.scale(o,o,[1/a,1/a,1]),r||t.rotateZ(o,o,n.angle)):t.multiply(o,n.labelPlaneMatrix,e),o}function lt(e,i,r,n,a){if(i){const i=t.clone(e);return t.scale(i,i,[a,a,1]),r||t.rotateZ(i,i,-n.angle),i}return n.glCoordMatrix}function ct(e,i,r){let n;r?(n=[e.x,e.y,r(e.x,e.y),1],t.transformMat4(n,n,i)):(n=[e.x,e.y,0,1],Et(n,n,i));const a=n[3];return{point:new t.Point(n[0]/a,n[1]/a),signedDistanceFromCamera:a}}function ht(t,e){return.5+t/e*.5}function ut(t,e){const i=t[0]/t[3],r=t[1]/t[3];return i>=-e[0]&&i<=e[0]&&r>=-e[1]&&r<=e[1]}function pt(e,i,r,n,a,o,s,l,c,h){const u=n?e.textSizeData:e.iconSizeData,p=t.evaluateSizeForZoom(u,r.transform.zoom),d=[256/r.width*2+1,256/r.height*2+1],m=n?e.text.dynamicLayoutVertexArray:e.icon.dynamicLayoutVertexArray;m.clear();const f=e.lineVertexArray,g=n?e.text.placedSymbolArray:e.icon.placedSymbolArray,_=r.transform.width/r.transform.height;let y=!1;for(let n=0;n<g.length;n++){const x=g.get(n);if(x.hidden||x.writingMode===t.WritingMode.vertical&&!y){wt(x.numGlyphs,m);continue}let v;if(y=!1,h?(v=[x.anchorX,x.anchorY,h(x.anchorX,x.anchorY),1],t.transformMat4(v,v,i)):(v=[x.anchorX,x.anchorY,0,1],Et(v,v,i)),!ut(v,d)){wt(x.numGlyphs,m);continue}const b=ht(r.transform.cameraToCenterDistance,v[3]),w=t.evaluateSizeForFeature(u,p,x),E=s?w/b:w*b,T=new t.Point(x.anchorX,x.anchorY),S=ct(T,a,h).point,C={projections:{},offsets:{}},I=ft(x,E,!1,l,i,a,o,e.glyphOffsetArray,f,m,S,T,C,_,c,h);y=I.useVertical,(I.notEnoughRoom||y||I.needsFlipping&&ft(x,E,!0,l,i,a,o,e.glyphOffsetArray,f,m,S,T,C,_,c,h).notEnoughRoom)&&wt(x.numGlyphs,m)}n?e.text.dynamicLayoutVertexBuffer.updateData(m):e.icon.dynamicLayoutVertexBuffer.updateData(m)}function dt(t,e,i,r,n,a,o,s,l,c,h,u,p){const d=s.glyphStartIndex+s.numGlyphs,m=s.lineStartIndex,f=s.lineStartIndex+s.lineLength,g=e.getoffsetX(s.glyphStartIndex),_=e.getoffsetX(d-1),y=vt(t*g,i,r,n,a,o,s.segment,m,f,l,c,h,u,p);if(!y)return null;const x=vt(t*_,i,r,n,a,o,s.segment,m,f,l,c,h,u,p);return x?{first:y,last:x}:null}function mt(e,i,r,n){return e===t.WritingMode.horizontal&&Math.abs(r.y-i.y)>Math.abs(r.x-i.x)*n?{useVertical:!0}:(e===t.WritingMode.vertical?i.y<r.y:i.x>r.x)?{needsFlipping:!0}:null}function ft(e,i,r,n,a,o,s,l,c,h,u,p,d,m,f,g){const _=i/24,y=e.lineOffsetX*_,x=e.lineOffsetY*_;let v;if(e.numGlyphs>1){const t=e.glyphStartIndex+e.numGlyphs,i=e.lineStartIndex,a=e.lineStartIndex+e.lineLength,h=dt(_,l,y,x,r,u,p,e,c,o,d,f,g);if(!h)return{notEnoughRoom:!0};const b=ct(h.first.point,s,g).point,w=ct(h.last.point,s,g).point;if(n&&!r){const t=mt(e.writingMode,b,w,m);if(t)return t}v=[h.first];for(let n=e.glyphStartIndex+1;n<t-1;n++)v.push(vt(_*l.getoffsetX(n),y,x,r,u,p,e.segment,i,a,c,o,d,f,g));v.push(h.last)}else{if(n&&!r){const i=ct(p,a,g).point,r=e.lineStartIndex+e.segment+1,n=new t.Point(c.getx(r),c.gety(r)),o=ct(n,a,g),s=o.signedDistanceFromCamera>0?o.point:gt(p,n,i,1,a,g),l=mt(e.writingMode,i,s,m);if(l)return l}const i=vt(_*l.getoffsetX(e.glyphStartIndex),y,x,r,u,p,e.segment,e.lineStartIndex,e.lineStartIndex+e.lineLength,c,o,d,f,g);if(!i)return{notEnoughRoom:!0};v=[i]}for(const e of v)t.addDynamicAttributes(h,e.point,e.angle);return{}}function gt(t,e,i,r,n,a){const o=ct(t.add(t.sub(e)._unit()),n,a).point,s=i.sub(o);return i.add(s._mult(r/s.mag()))}function _t(e,i){const{projectionCache:r,lineVertexArray:n,labelPlaneMatrix:a,tileAnchorPoint:o,distanceFromAnchor:s,getElevation:l,previousVertex:c,direction:h,absOffsetX:u}=i;if(r.projections[e])return r.projections[e];const p=new t.Point(n.getx(e),n.gety(e)),d=ct(p,a,l);if(d.signedDistanceFromCamera>0)return r.projections[e]=d.point,d.point;const m=e-h;return gt(0===s?o:new t.Point(n.getx(m),n.gety(m)),p,c,u-s+1,a,l)}function yt(t,e,i){return t._unit()._perp()._mult(e*i)}function xt(e,i,r,n,a,o,s,l){const{projectionCache:c,direction:h}=l;if(c.offsets[e])return c.offsets[e];const u=r.add(i);if(e+h<n||e+h>=a)return c.offsets[e]=u,u;const p=_t(e+h,l),d=yt(p.sub(r),s,h),m=r.add(d),f=p.add(d);return c.offsets[e]=t.findLineIntersection(o,u,m,f)||u,c.offsets[e]}function vt(t,e,i,r,n,a,o,s,l,c,h,u,p,d){const m=r?t-e:t+e;let f=m>0?1:-1,g=0;r&&(f*=-1,g=Math.PI),f<0&&(g+=Math.PI);let _,y,x=f>0?s+o:s+o+1,v=n,b=n,w=0,E=0;const T=Math.abs(m),S=[];let C;for(;w+E<=T;){if(x+=f,x<s||x>=l)return null;w+=E,b=v,y=_;const t={projectionCache:u,lineVertexArray:c,labelPlaneMatrix:h,tileAnchorPoint:a,distanceFromAnchor:w,getElevation:d,previousVertex:b,direction:f,absOffsetX:T};if(v=_t(x,t),0===i)S.push(b),C=v.sub(b);else{let e;const r=v.sub(b);e=0===r.mag()?yt(_t(x+f,t).sub(v),i,f):yt(r,i,f),y||(y=b.add(e)),_=xt(x,e,v,s,l,y,i,t),S.push(y),C=_.sub(y)}E=C.mag()}const I=C._mult((T-w)/E)._add(y||b),A=g+Math.atan2(v.y-b.y,v.x-b.x);return S.push(I),{point:I,angle:p?A:0,path:S}}const bt=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function wt(t,e){for(let i=0;i<t;i++){const t=e.length;e.resize(t+4),e.float32.set(bt,3*t)}}function Et(t,e,i){const r=e[0],n=e[1];return t[0]=i[0]*r+i[4]*n+i[12],t[1]=i[1]*r+i[5]*n+i[13],t[3]=i[3]*r+i[7]*n+i[15],t}const Tt=100;class St{constructor(t,e=new ot(t.width+200,t.height+200,25),i=new ot(t.width+200,t.height+200,25)){this.transform=t,this.grid=e,this.ignoredGrid=i,this.pitchfactor=Math.cos(t._pitch)*t.cameraToCenterDistance,this.screenRightBoundary=t.width+Tt,this.screenBottomBoundary=t.height+Tt,this.gridRightBoundary=t.width+200,this.gridBottomBoundary=t.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(t,e,i,r,n,a){const o=this.projectAndGetPerspectiveRatio(r,t.anchorPointX,t.anchorPointY,a),s=i*o.perspectiveRatio,l=t.x1*s+o.point.x,c=t.y1*s+o.point.y,h=t.x2*s+o.point.x,u=t.y2*s+o.point.y;return!this.isInsideGrid(l,c,h,u)||"always"!==e&&this.grid.hitTest(l,c,h,u,e,n)||o.perspectiveRatio<this.perspectiveRatioCutoff?{box:[],offscreen:!1}:{box:[l,c,h,u],offscreen:this.isOffscreen(l,c,h,u)}}placeCollisionCircles(e,i,r,n,a,o,s,l,c,h,u,p,d,m){const f=[],g=new t.Point(i.anchorX,i.anchorY),_=ct(g,o,m),y=ht(this.transform.cameraToCenterDistance,_.signedDistanceFromCamera),x=(h?a/y:a*y)/t.ONE_EM,v=ct(g,s,m).point,b=dt(x,n,i.lineOffsetX*x,i.lineOffsetY*x,!1,v,g,i,r,s,{projections:{},offsets:{}},!1,m);let w=!1,E=!1,T=!0;if(b){const i=.5*p*y+d,r=new t.Point(-100,-100),n=new t.Point(this.screenRightBoundary,this.screenBottomBoundary),a=new nt,o=b.first,s=b.last;let h=[];for(let t=o.path.length-1;t>=1;t--)h.push(o.path[t]);for(let t=1;t<s.path.length;t++)h.push(s.path[t]);const g=2.5*i;if(l){const t=h.map((t=>ct(t,l,m)));h=t.some((t=>t.signedDistanceFromCamera<=0))?[]:t.map((t=>t.point))}let _=[];if(h.length>0){const e=h[0].clone(),i=h[0].clone();for(let t=1;t<h.length;t++)e.x=Math.min(e.x,h[t].x),e.y=Math.min(e.y,h[t].y),i.x=Math.max(i.x,h[t].x),i.y=Math.max(i.y,h[t].y);_=e.x>=r.x&&i.x<=n.x&&e.y>=r.y&&i.y<=n.y?[h]:i.x<r.x||e.x>n.x||i.y<r.y||e.y>n.y?[]:t.clipLine([h],r.x,r.y,n.x,n.y)}for(const t of _){a.reset(t,.25*i);let r=0;r=a.length<=.5*i?1:Math.ceil(a.paddedLength/g)+1;for(let t=0;t<r;t++){const n=t/Math.max(r-1,1),o=a.lerp(n),s=o.x+Tt,l=o.y+Tt;f.push(s,l,i,0);const h=s-i,p=l-i,d=s+i,m=l+i;if(T=T&&this.isOffscreen(h,p,d,m),E=E||this.isInsideGrid(h,p,d,m),"always"!==e&&this.grid.hitTestCircle(s,l,i,e,u)&&(w=!0,!c))return{circles:[],offscreen:!1,collisionDetected:w}}}}return{circles:!c&&w||!E||y<this.perspectiveRatioCutoff?[]:f,offscreen:T,collisionDetected:w}}queryRenderedSymbols(e){if(0===e.length||0===this.grid.keysLength()&&0===this.ignoredGrid.keysLength())return{};const i=[];let r=1/0,n=1/0,a=-1/0,o=-1/0;for(const s of e){const e=new t.Point(s.x+Tt,s.y+Tt);r=Math.min(r,e.x),n=Math.min(n,e.y),a=Math.max(a,e.x),o=Math.max(o,e.y),i.push(e)}const s=this.grid.query(r,n,a,o).concat(this.ignoredGrid.query(r,n,a,o)),l={},c={};for(const e of s){const r=e.key;if(void 0===l[r.bucketInstanceId]&&(l[r.bucketInstanceId]={}),l[r.bucketInstanceId][r.featureIndex])continue;const n=[new t.Point(e.x1,e.y1),new t.Point(e.x2,e.y1),new t.Point(e.x2,e.y2),new t.Point(e.x1,e.y2)];t.polygonIntersectsPolygon(i,n)&&(l[r.bucketInstanceId][r.featureIndex]=!0,void 0===c[r.bucketInstanceId]&&(c[r.bucketInstanceId]=[]),c[r.bucketInstanceId].push(r.featureIndex))}return c}insertCollisionBox(t,e,i,r,n,a){(i?this.ignoredGrid:this.grid).insert({bucketInstanceId:r,featureIndex:n,collisionGroupID:a,overlapMode:e},t[0],t[1],t[2],t[3])}insertCollisionCircles(t,e,i,r,n,a){const o=i?this.ignoredGrid:this.grid,s={bucketInstanceId:r,featureIndex:n,collisionGroupID:a,overlapMode:e};for(let e=0;e<t.length;e+=4)o.insertCircle(s,t[e],t[e+1],t[e+2])}projectAndGetPerspectiveRatio(e,i,r,n){let a;return n?(a=[i,r,n(i,r),1],t.transformMat4(a,a,e)):(a=[i,r,0,1],Et(a,a,e)),{point:new t.Point((a[0]/a[3]+1)/2*this.transform.width+Tt,(-a[1]/a[3]+1)/2*this.transform.height+Tt),perspectiveRatio:.5+this.transform.cameraToCenterDistance/a[3]*.5}}isOffscreen(t,e,i,r){return i<Tt||t>=this.screenRightBoundary||r<Tt||e>this.screenBottomBoundary}isInsideGrid(t,e,i,r){return i>=0&&t<this.gridRightBoundary&&r>=0&&e<this.gridBottomBoundary}getViewportMatrix(){const e=t.identity([]);return t.translate(e,e,[-100,-100,0]),e}}function Ct(e,i,r){return i*(t.EXTENT/(e.tileSize*Math.pow(2,r-e.tileID.overscaledZ)))}class It{constructor(t,e,i,r){this.opacity=t?Math.max(0,Math.min(1,t.opacity+(t.placed?e:-e))):r&&i?1:0,this.placed=i}isHidden(){return 0===this.opacity&&!this.placed}}class At{constructor(t,e,i,r,n){this.text=new It(t?t.text:null,e,i,n),this.icon=new It(t?t.icon:null,e,r,n)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class Mt{constructor(t,e,i){this.text=t,this.icon=e,this.skipFade=i}}class kt{constructor(){this.invProjMatrix=t.create(),this.viewportMatrix=t.create(),this.circles=[]}}class Pt{constructor(t,e,i,r,n){this.bucketInstanceId=t,this.featureIndex=e,this.sourceLayerIndex=i,this.bucketIndex=r,this.tileID=n}}class zt{constructor(t){this.crossSourceCollisions=t,this.maxGroupID=0,this.collisionGroups={}}get(t){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[t]){const e=++this.maxGroupID;this.collisionGroups[t]={ID:e,predicate:t=>t.collisionGroupID===e}}return this.collisionGroups[t]}}function Lt(e,i,r,n,a){const{horizontalAlign:o,verticalAlign:s}=t.getAnchorAlignment(e);return new t.Point(-(o-.5)*i+n[0]*a,-(s-.5)*r+n[1]*a)}function Dt(e,i,r,n,a,o){const{x1:s,x2:l,y1:c,y2:h,anchorPointX:u,anchorPointY:p}=e,d=new t.Point(i,r);return n&&d._rotate(a?o:-o),{x1:s+d.x,y1:c+d.y,x2:l+d.x,y2:h+d.y,anchorPointX:u,anchorPointY:p}}class Rt{constructor(t,e,i,r,n){this.transform=t.clone(),this.terrain=e,this.collisionIndex=new St(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=i,this.retainedQueryData={},this.collisionGroups=new zt(r),this.collisionCircleArrays={},this.prevPlacement=n,n&&(n.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(e,i,r,n){const a=r.getBucket(i),o=r.latestFeatureIndex;if(!a||!o||i.id!==a.layerIds[0])return;const s=r.collisionBoxArray,l=a.layers[0].layout,c=Math.pow(2,this.transform.zoom-r.tileID.overscaledZ),h=r.tileSize/t.EXTENT,u=this.transform.calculatePosMatrix(r.tileID.toUnwrapped()),p="map"===l.get("text-pitch-alignment"),d="map"===l.get("text-rotation-alignment"),m=Ct(r,1,this.transform.zoom),f=st(u,p,d,this.transform,m);let g=null;if(p){const e=lt(u,p,d,this.transform,m);g=t.multiply([],this.transform.labelPlaneMatrix,e)}this.retainedQueryData[a.bucketInstanceId]=new Pt(a.bucketInstanceId,o,a.sourceLayerIndex,a.index,r.tileID);const _={bucket:a,layout:l,posMatrix:u,textLabelPlaneMatrix:f,labelToScreenMatrix:g,scale:c,textPixelRatio:h,holdingForFade:r.holdingForFade(),collisionBoxArray:s,partiallyEvaluatedTextSize:t.evaluateSizeForZoom(a.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(a.sourceID)};if(n)for(const t of a.sortKeyRanges){const{sortKey:i,symbolInstanceStart:r,symbolInstanceEnd:n}=t;e.push({sortKey:i,symbolInstanceStart:r,symbolInstanceEnd:n,parameters:_})}else e.push({symbolInstanceStart:0,symbolInstanceEnd:a.symbolInstances.length,parameters:_})}attemptAnchorPlacement(e,i,r,n,a,o,s,l,c,h,u,p,d,m,f,g){const _=t.TextAnchorEnum[e.textAnchor],y=[e.textOffset0,e.textOffset1],x=Lt(_,r,n,y,a),v=this.collisionIndex.placeCollisionBox(Dt(i,x.x,x.y,o,s,this.transform.angle),u,l,c,h.predicate,g);if((!f||0!==this.collisionIndex.placeCollisionBox(Dt(f,x.x,x.y,o,s,this.transform.angle),u,l,c,h.predicate,g).box.length)&&v.box.length>0){let t;if(this.prevPlacement&&this.prevPlacement.variableOffsets[p.crossTileID]&&this.prevPlacement.placements[p.crossTileID]&&this.prevPlacement.placements[p.crossTileID].text&&(t=this.prevPlacement.variableOffsets[p.crossTileID].anchor),0===p.crossTileID)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[p.crossTileID]={textOffset:y,width:r,height:n,anchor:_,textBoxScale:a,prevAnchor:t},this.markUsedJustification(d,_,p,m),d.allowVerticalPlacement&&(this.markUsedOrientation(d,m,p),this.placedOrientations[p.crossTileID]=m),{shift:x,placedGlyphBoxes:v}}}placeLayerBucketPart(e,i,r){const{bucket:n,layout:a,posMatrix:o,textLabelPlaneMatrix:s,labelToScreenMatrix:l,textPixelRatio:c,holdingForFade:h,collisionBoxArray:u,partiallyEvaluatedTextSize:p,collisionGroup:d}=e.parameters,m=a.get("text-optional"),f=a.get("icon-optional"),g=t.getOverlapMode(a,"text-overlap","text-allow-overlap"),_="always"===g,y=t.getOverlapMode(a,"icon-overlap","icon-allow-overlap"),x="always"===y,v="map"===a.get("text-rotation-alignment"),b="map"===a.get("text-pitch-alignment"),w="none"!==a.get("icon-text-fit"),E="viewport-y"===a.get("symbol-z-order"),T=_&&(x||!n.hasIconData()||f),S=x&&(_||!n.hasTextData()||m);!n.collisionArrays&&u&&n.deserializeCollisionBoxes(u);const C=this.retainedQueryData[n.bucketInstanceId].tileID,I=this.terrain?(t,e)=>this.terrain.getElevation(C,t,e):null,A=(e,u)=>{var x,E;if(i[e.crossTileID])return;if(h)return void(this.placements[e.crossTileID]=new Mt(!1,!1,!1));let C=!1,A=!1,M=!0,k=null,P={box:null,offscreen:null},z={box:null,offscreen:null},L=null,D=null,R=null,B=0,F=0,O=0;u.textFeatureIndex?B=u.textFeatureIndex:e.useRuntimeCollisionCircles&&(B=e.featureIndex),u.verticalTextFeatureIndex&&(F=u.verticalTextFeatureIndex);const U=u.textBox;if(U){const i=i=>{let r=t.WritingMode.horizontal;if(n.allowVerticalPlacement&&!i&&this.prevPlacement){const t=this.prevPlacement.placedOrientations[e.crossTileID];t&&(this.placedOrientations[e.crossTileID]=t,r=t,this.markUsedOrientation(n,r,e))}return r},r=(i,r)=>{if(n.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&u.verticalTextBox){for(const e of n.writingModes)if(e===t.WritingMode.vertical?(P=r(),z=P):P=i(),P&&P.box&&P.box.length)break}else P=i()},a=e.textAnchorOffsetStartIndex,s=e.textAnchorOffsetEndIndex;if(s===a){const a=(t,i)=>{const r=this.collisionIndex.placeCollisionBox(t,g,c,o,d.predicate,I);return r&&r.box&&r.box.length&&(this.markUsedOrientation(n,i,e),this.placedOrientations[e.crossTileID]=i),r};r((()=>a(U,t.WritingMode.horizontal)),(()=>{const i=u.verticalTextBox;return n.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&i?a(i,t.WritingMode.vertical):{box:null,offscreen:null}})),i(P&&P.box&&P.box.length)}else{let l=t.TextAnchorEnum[null===(E=null===(x=this.prevPlacement)||void 0===x?void 0:x.variableOffsets[e.crossTileID])||void 0===E?void 0:E.anchor];const h=(t,i,r)=>{const h=t.x2-t.x1,u=t.y2-t.y1,p=e.textBoxScale,m=w&&"never"===y?i:null;let f={box:[],offscreen:!1},_="never"===g?1:2,x="never";l&&_++;for(let i=0;i<_;i++){for(let i=a;i<s;i++){const a=n.textAnchorOffsets.get(i);if(l&&a.textAnchor!==l)continue;const s=this.attemptAnchorPlacement(a,t,h,u,p,v,b,c,o,d,x,e,n,r,m,I);if(s&&(f=s.placedGlyphBoxes,f&&f.box&&f.box.length))return C=!0,k=s.shift,f}l?l=null:x=g}return f};r((()=>h(U,u.iconBox,t.WritingMode.horizontal)),(()=>{const i=u.verticalTextBox;return n.allowVerticalPlacement&&!(P&&P.box&&P.box.length)&&e.numVerticalGlyphVertices>0&&i?h(i,u.verticalIconBox,t.WritingMode.vertical):{box:null,offscreen:null}})),P&&(C=P.box,M=P.offscreen);const p=i(P&&P.box);if(!C&&this.prevPlacement){const t=this.prevPlacement.variableOffsets[e.crossTileID];t&&(this.variableOffsets[e.crossTileID]=t,this.markUsedJustification(n,t.anchor,e,p))}}}if(L=P,C=L&&L.box&&L.box.length>0,M=L&&L.offscreen,e.useRuntimeCollisionCircles){const i=n.text.placedSymbolArray.get(e.centerJustifiedTextSymbolIndex),c=t.evaluateSizeForFeature(n.textSizeData,p,i),h=a.get("text-padding");D=this.collisionIndex.placeCollisionCircles(g,i,n.lineVertexArray,n.glyphOffsetArray,c,o,s,l,r,b,d.predicate,e.collisionCircleDiameter,h,I),D.circles.length&&D.collisionDetected&&!r&&t.warnOnce("Collisions detected, but collision boxes are not shown"),C=_||D.circles.length>0&&!D.collisionDetected,M=M&&D.offscreen}if(u.iconFeatureIndex&&(O=u.iconFeatureIndex),u.iconBox){const t=t=>{const e=w&&k?Dt(t,k.x,k.y,v,b,this.transform.angle):t;return this.collisionIndex.placeCollisionBox(e,y,c,o,d.predicate,I)};z&&z.box&&z.box.length&&u.verticalIconBox?(R=t(u.verticalIconBox),A=R.box.length>0):(R=t(u.iconBox),A=R.box.length>0),M=M&&R.offscreen}const V=m||0===e.numHorizontalGlyphVertices&&0===e.numVerticalGlyphVertices,N=f||0===e.numIconVertices;if(V||N?N?V||(A=A&&C):C=A&&C:A=C=A&&C,C&&L&&L.box&&this.collisionIndex.insertCollisionBox(L.box,g,a.get("text-ignore-placement"),n.bucketInstanceId,z&&z.box&&F?F:B,d.ID),A&&R&&this.collisionIndex.insertCollisionBox(R.box,y,a.get("icon-ignore-placement"),n.bucketInstanceId,O,d.ID),D&&(C&&this.collisionIndex.insertCollisionCircles(D.circles,g,a.get("text-ignore-placement"),n.bucketInstanceId,B,d.ID),r)){const t=n.bucketInstanceId;let e=this.collisionCircleArrays[t];void 0===e&&(e=this.collisionCircleArrays[t]=new kt);for(let t=0;t<D.circles.length;t+=4)e.circles.push(D.circles[t+0]),e.circles.push(D.circles[t+1]),e.circles.push(D.circles[t+2]),e.circles.push(D.collisionDetected?1:0)}if(0===e.crossTileID)throw new Error("symbolInstance.crossTileID can't be 0");if(0===n.bucketInstanceId)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[e.crossTileID]=new Mt(C||T,A||S,M||n.justReloaded),i[e.crossTileID]=!0};if(E){if(0!==e.symbolInstanceStart)throw new Error("bucket.bucketInstanceId should be 0");const t=n.getSortedSymbolIndexes(this.transform.angle);for(let e=t.length-1;e>=0;--e){const i=t[e];A(n.symbolInstances.get(i),n.collisionArrays[i])}}else for(let t=e.symbolInstanceStart;t<e.symbolInstanceEnd;t++)A(n.symbolInstances.get(t),n.collisionArrays[t]);if(r&&n.bucketInstanceId in this.collisionCircleArrays){const e=this.collisionCircleArrays[n.bucketInstanceId];t.invert(e.invProjMatrix,o),e.viewportMatrix=this.collisionIndex.getViewportMatrix()}n.justReloaded=!1}markUsedJustification(e,i,r,n){let a;a=n===t.WritingMode.vertical?r.verticalPlacedTextSymbolIndex:{left:r.leftJustifiedTextSymbolIndex,center:r.centerJustifiedTextSymbolIndex,right:r.rightJustifiedTextSymbolIndex}[t.getAnchorJustification(i)];const o=[r.leftJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.rightJustifiedTextSymbolIndex,r.verticalPlacedTextSymbolIndex];for(const t of o)t>=0&&(e.text.placedSymbolArray.get(t).crossTileID=a>=0&&t!==a?0:r.crossTileID)}markUsedOrientation(e,i,r){const n=i===t.WritingMode.horizontal||i===t.WritingMode.horizontalOnly?i:0,a=i===t.WritingMode.vertical?i:0,o=[r.leftJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.rightJustifiedTextSymbolIndex];for(const t of o)e.text.placedSymbolArray.get(t).placedOrientation=n;r.verticalPlacedTextSymbolIndex&&(e.text.placedSymbolArray.get(r.verticalPlacedTextSymbolIndex).placedOrientation=a)}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;const e=this.prevPlacement;let i=!1;this.prevZoomAdjustment=e?e.zoomAdjustment(this.transform.zoom):0;const r=e?e.symbolFadeChange(t):1,n=e?e.opacities:{},a=e?e.variableOffsets:{},o=e?e.placedOrientations:{};for(const t in this.placements){const e=this.placements[t],a=n[t];a?(this.opacities[t]=new At(a,r,e.text,e.icon),i=i||e.text!==a.text.placed||e.icon!==a.icon.placed):(this.opacities[t]=new At(null,r,e.text,e.icon,e.skipFade),i=i||e.text||e.icon)}for(const t in n){const e=n[t];if(!this.opacities[t]){const n=new At(e,r,!1,!1);n.isHidden()||(this.opacities[t]=n,i=i||e.text.placed||e.icon.placed)}}for(const t in a)this.variableOffsets[t]||!this.opacities[t]||this.opacities[t].isHidden()||(this.variableOffsets[t]=a[t]);for(const t in o)this.placedOrientations[t]||!this.opacities[t]||this.opacities[t].isHidden()||(this.placedOrientations[t]=o[t]);if(e&&void 0===e.lastPlacementChangeTime)throw new Error("Last placement time for previous placement is not defined");i?this.lastPlacementChangeTime=t:"number"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=e?e.lastPlacementChangeTime:t)}updateLayerOpacities(t,e){const i={};for(const r of e){const e=r.getBucket(t);e&&r.latestFeatureIndex&&t.id===e.layerIds[0]&&this.updateBucketOpacities(e,i,r.collisionBoxArray)}}updateBucketOpacities(e,i,r){e.hasTextData()&&(e.text.opacityVertexArray.clear(),e.text.hasVisibleVertices=!1),e.hasIconData()&&(e.icon.opacityVertexArray.clear(),e.icon.hasVisibleVertices=!1),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexArray.clear(),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexArray.clear();const n=e.layers[0],a=n.layout,o=new At(null,0,!1,!1,!0),s=a.get("text-allow-overlap"),l=a.get("icon-allow-overlap"),c=n._unevaluatedLayout.hasValue("text-variable-anchor")||n._unevaluatedLayout.hasValue("text-variable-anchor-offset"),h="map"===a.get("text-rotation-alignment"),u="map"===a.get("text-pitch-alignment"),p="none"!==a.get("icon-text-fit"),d=new At(null,0,s&&(l||!e.hasIconData()||a.get("icon-optional")),l&&(s||!e.hasTextData()||a.get("text-optional")),!0);!e.collisionArrays&&r&&(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData())&&e.deserializeCollisionBoxes(r);const m=(t,e,i)=>{for(let r=0;r<e/4;r++)t.opacityVertexArray.emplaceBack(i);t.hasVisibleVertices=t.hasVisibleVertices||i!==Zt};for(let r=0;r<e.symbolInstances.length;r++){const n=e.symbolInstances.get(r),{numHorizontalGlyphVertices:a,numVerticalGlyphVertices:s,crossTileID:l}=n;let f=this.opacities[l];i[l]?f=o:f||(f=d,this.opacities[l]=f),i[l]=!0;const g=n.numIconVertices>0,_=this.placedOrientations[n.crossTileID],y=_===t.WritingMode.vertical,x=_===t.WritingMode.horizontal||_===t.WritingMode.horizontalOnly;if(a>0||s>0){const t=qt(f.text);m(e.text,a,y?Zt:t),m(e.text,s,x?Zt:t);const i=f.text.isHidden();[n.rightJustifiedTextSymbolIndex,n.centerJustifiedTextSymbolIndex,n.leftJustifiedTextSymbolIndex].forEach((t=>{t>=0&&(e.text.placedSymbolArray.get(t).hidden=i||y?1:0)})),n.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(n.verticalPlacedTextSymbolIndex).hidden=i||x?1:0);const r=this.variableOffsets[n.crossTileID];r&&this.markUsedJustification(e,r.anchor,n,_);const o=this.placedOrientations[n.crossTileID];o&&(this.markUsedJustification(e,"left",n,o),this.markUsedOrientation(e,o,n))}if(g){const t=qt(f.icon),i=!(p&&n.verticalPlacedIconSymbolIndex&&y);n.placedIconSymbolIndex>=0&&(m(e.icon,n.numIconVertices,i?t:Zt),e.icon.placedSymbolArray.get(n.placedIconSymbolIndex).hidden=f.icon.isHidden()),n.verticalPlacedIconSymbolIndex>=0&&(m(e.icon,n.numVerticalIconVertices,i?Zt:t),e.icon.placedSymbolArray.get(n.verticalPlacedIconSymbolIndex).hidden=f.icon.isHidden())}if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){const i=e.collisionArrays[r];if(i){let r=new t.Point(0,0);if(i.textBox||i.verticalTextBox){let t=!0;if(c){const e=this.variableOffsets[l];e?(r=Lt(e.anchor,e.width,e.height,e.textOffset,e.textBoxScale),h&&r._rotate(u?this.transform.angle:-this.transform.angle)):t=!1}i.textBox&&Bt(e.textCollisionBox.collisionVertexArray,f.text.placed,!t||y,r.x,r.y),i.verticalTextBox&&Bt(e.textCollisionBox.collisionVertexArray,f.text.placed,!t||x,r.x,r.y)}const n=Boolean(!x&&i.verticalIconBox);i.iconBox&&Bt(e.iconCollisionBox.collisionVertexArray,f.icon.placed,n,p?r.x:0,p?r.y:0),i.verticalIconBox&&Bt(e.iconCollisionBox.collisionVertexArray,f.icon.placed,!n,p?r.x:0,p?r.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.text.opacityVertexArray.length!==e.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${e.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${e.text.layoutVertexArray.length}) / 4`);if(e.icon.opacityVertexArray.length!==e.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${e.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${e.icon.layoutVertexArray.length}) / 4`);if(e.bucketInstanceId in this.collisionCircleArrays){const t=this.collisionCircleArrays[e.bucketInstanceId];e.placementInvProjMatrix=t.invProjMatrix,e.placementViewportMatrix=t.viewportMatrix,e.collisionCircleArray=t.circles,delete this.collisionCircleArrays[e.bucketInstanceId]}}symbolFadeChange(t){return 0===this.fadeDuration?1:(t-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(t){return Math.max(0,(this.transform.zoom-t)/1.5)}hasTransitions(t){return this.stale||t-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(t,e){const i=this.zoomAtLastRecencyCheck===e?1-this.zoomAdjustment(e):1;return this.zoomAtLastRecencyCheck=e,this.commitTime+this.fadeDuration*i>t}setStale(){this.stale=!0}}function Bt(t,e,i,r,n){t.emplaceBack(e?1:0,i?1:0,r||0,n||0),t.emplaceBack(e?1:0,i?1:0,r||0,n||0),t.emplaceBack(e?1:0,i?1:0,r||0,n||0),t.emplaceBack(e?1:0,i?1:0,r||0,n||0)}const Ft=Math.pow(2,25),Ot=Math.pow(2,24),Ut=Math.pow(2,17),Vt=Math.pow(2,16),Nt=Math.pow(2,9),$t=Math.pow(2,8),jt=Math.pow(2,1);function qt(t){if(0===t.opacity&&!t.placed)return 0;if(1===t.opacity&&t.placed)return 4294967295;const e=t.placed?1:0,i=Math.floor(127*t.opacity);return i*Ft+e*Ot+i*Ut+e*Vt+i*Nt+e*$t+i*jt+e}const Zt=0;class Gt{constructor(t){this._sortAcrossTiles="viewport-y"!==t.layout.get("symbol-z-order")&&!t.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(t,e,i,r,n){const a=this._bucketParts;for(;this._currentTileIndex<t.length;)if(e.getBucketParts(a,r,t[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,n())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,a.sort(((t,e)=>t.sortKey-e.sortKey)));this._currentPartIndex<a.length;)if(e.placeLayerBucketPart(a[this._currentPartIndex],this._seenCrossTileIDs,i),this._currentPartIndex++,n())return!0;return!1}}class Ht{constructor(t,e,i,r,n,a,o,s){this.placement=new Rt(t,e,a,o,s),this._currentPlacementIndex=i.length-1,this._forceFullPlacement=r,this._showCollisionBoxes=n,this._done=!1}isDone(){return this._done}continuePlacement(e,i,r){const n=t.browser.now(),a=()=>!this._forceFullPlacement&&t.browser.now()-n>2;for(;this._currentPlacementIndex>=0;){const t=i[e[this._currentPlacementIndex]],n=this.placement.collisionIndex.transform.zoom;if("symbol"===t.type&&(!t.minzoom||t.minzoom<=n)&&(!t.maxzoom||t.maxzoom>n)){if(this._inProgressLayer||(this._inProgressLayer=new Gt(t)),this._inProgressLayer.continuePlacement(r[t.source],this.placement,this._showCollisionBoxes,t,a))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(t){return this.placement.commit(t),this.placement}}const Xt=512/t.EXTENT/2;class Wt{constructor(e,i,r){this.tileID=e,this.bucketInstanceId=r,this._symbolsByKey={};const n=new Map;for(let t=0;t<i.length;t++){const e=i.get(t),r=e.key,a=n.get(r);a?a.push(e):n.set(r,[e])}for(const[e,i]of n){const r={positions:i.map((t=>({x:Math.floor(t.anchorX*Xt),y:Math.floor(t.anchorY*Xt)}))),crossTileIDs:i.map((t=>t.crossTileID))};if(r.positions.length>128){const e=new t.KDBush(r.positions.length,16,Uint16Array);for(const{x:t,y:i}of r.positions)e.add(t,i);e.finish(),delete r.positions,r.index=e}this._symbolsByKey[e]=r}}getScaledCoordinates(e,i){const{x:r,y:n,z:a}=this.tileID.canonical,{x:o,y:s,z:l}=i.canonical,c=Xt/Math.pow(2,l-a),h=(s*t.EXTENT+e.anchorY)*c,u=n*t.EXTENT*Xt;return{x:Math.floor((o*t.EXTENT+e.anchorX)*c-r*t.EXTENT*Xt),y:Math.floor(h-u)}}findMatches(t,e,i){const r=this.tileID.canonical.z<e.canonical.z?1:Math.pow(2,this.tileID.canonical.z-e.canonical.z);for(let n=0;n<t.length;n++){const a=t.get(n);if(a.crossTileID)continue;const o=this._symbolsByKey[a.key];if(!o)continue;const s=this.getScaledCoordinates(a,e);if(o.index){const t=o.index.range(s.x-r,s.y-r,s.x+r,s.y+r).sort();for(const e of t){const t=o.crossTileIDs[e];if(!i[t]){i[t]=!0,a.crossTileID=t;break}}}else if(o.positions)for(let t=0;t<o.positions.length;t++){const e=o.positions[t],n=o.crossTileIDs[t];if(Math.abs(e.x-s.x)<=r&&Math.abs(e.y-s.y)<=r&&!i[n]){i[n]=!0,a.crossTileID=n;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map((({crossTileIDs:t})=>t))}}class Kt{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Yt{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(t){const e=Math.round((t-this.lng)/360);if(0!==e)for(const t in this.indexes){const i=this.indexes[t],r={};for(const t in i){const n=i[t];n.tileID=n.tileID.unwrapTo(n.tileID.wrap+e),r[n.tileID.key]=n}this.indexes[t]=r}this.lng=t}addBucket(t,e,i){if(this.indexes[t.overscaledZ]&&this.indexes[t.overscaledZ][t.key]){if(this.indexes[t.overscaledZ][t.key].bucketInstanceId===e.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(t.overscaledZ,this.indexes[t.overscaledZ][t.key])}for(let t=0;t<e.symbolInstances.length;t++)e.symbolInstances.get(t).crossTileID=0;this.usedCrossTileIDs[t.overscaledZ]||(this.usedCrossTileIDs[t.overscaledZ]={});const r=this.usedCrossTileIDs[t.overscaledZ];for(const i in this.indexes){const n=this.indexes[i];if(Number(i)>t.overscaledZ)for(const i in n){const a=n[i];a.tileID.isChildOf(t)&&a.findMatches(e.symbolInstances,t,r)}else{const a=n[t.scaledTo(Number(i)).key];a&&a.findMatches(e.symbolInstances,t,r)}}for(let t=0;t<e.symbolInstances.length;t++){const n=e.symbolInstances.get(t);n.crossTileID||(n.crossTileID=i.generate(),r[n.crossTileID]=!0)}return void 0===this.indexes[t.overscaledZ]&&(this.indexes[t.overscaledZ]={}),this.indexes[t.overscaledZ][t.key]=new Wt(t,e.symbolInstances,e.bucketInstanceId),!0}removeBucketCrossTileIDs(t,e){for(const i of e.getCrossTileIDsLists())for(const e of i)delete this.usedCrossTileIDs[t][e]}removeStaleBuckets(t){let e=!1;for(const i in this.indexes){const r=this.indexes[i];for(const n in r)t[r[n].bucketInstanceId]||(this.removeBucketCrossTileIDs(i,r[n]),delete r[n],e=!0)}return e}}class Jt{constructor(){this.layerIndexes={},this.crossTileIDs=new Kt,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(t,e,i){let r=this.layerIndexes[t.id];void 0===r&&(r=this.layerIndexes[t.id]=new Yt);let n=!1;const a={};r.handleWrapJump(i);for(const i of e){const e=i.getBucket(t);e&&t.id===e.layerIds[0]&&(e.bucketInstanceId||(e.bucketInstanceId=++this.maxBucketInstanceId),r.addBucket(i.tileID,e,this.crossTileIDs)&&(n=!0),a[e.bucketInstanceId]=!0)}return r.removeStaleBuckets(a)&&(n=!0),n}pruneUnusedLayers(t){const e={};t.forEach((t=>{e[t]=!0}));for(const t in this.layerIndexes)e[t]||delete this.layerIndexes[t]}}const Qt=(e,i)=>t.emitValidationErrors(e,i&&i.filter((t=>"source.canvas"!==t.identifier))),te=t.pick(t.operations,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setGlyphs","setSprite"]),ee=t.pick(t.operations,["setCenter","setZoom","setBearing","setPitch"]),ie=t.emptyStyle();class re extends t.Evented{constructor(e,i={}){super(),this.map=e,this.dispatcher=new k(rt(),this,e._getMapId()),this.imageManager=new b,this.imageManager.setEventedParent(this),this.glyphManager=new S(e._requestManager,i.localIdeographFontFamily),this.lineAtlas=new M(256,512),this.crossTileSymbolIndex=new Jt,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new t.ZoomHistory,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("setReferrer",t.getReferrer());const r=this;this._rtlTextPluginCallback=re.registerForPluginStateChange((e=>{r.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:e.pluginStatus,pluginURL:e.pluginURL},((e,i)=>{if(t.triggerPluginCompletionEvent(e),i&&i.every((t=>t)))for(const t in r.sourceCaches){const e=r.sourceCaches[t].getSource().type;"vector"!==e&&"geojson"!==e||r.sourceCaches[t].reload()}}))})),this.on("data",(t=>{if("source"!==t.dataType||"metadata"!==t.sourceDataType)return;const e=this.sourceCaches[t.sourceId];if(!e)return;const i=e.getSource();if(i&&i.vectorLayerIds)for(const t in this._layers){const e=this._layers[t];e.source===i.id&&this._validateLayer(e)}}))}loadURL(e,i={},r){this.fire(new t.Event("dataloading",{dataType:"style"})),i.validate="boolean"!=typeof i.validate||i.validate;const n=this.map._requestManager.transformRequest(e,h.Style);this._request=t.getJSON(n,((e,n)=>{this._request=null,e?this.fire(new t.ErrorEvent(e)):n&&this._load(n,i,r)}))}loadJSON(e,i={},r){this.fire(new t.Event("dataloading",{dataType:"style"})),this._request=t.browser.frame((()=>{this._request=null,i.validate=!1!==i.validate,this._load(e,i,r)}))}loadEmpty(){this.fire(new t.Event("dataloading",{dataType:"style"})),this._load(ie,{validate:!1})}_load(e,i,r){var n;const a=i.transformStyle?i.transformStyle(r,e):e;if(!i.validate||!Qt(this,t.validateStyle(a))){this._loaded=!0,this.stylesheet=a;for(const t in a.sources)this.addSource(t,a.sources[t],{validate:!1});a.sprite?this._loadSprite(a.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(a.glyphs),this._createLayers(),this.light=new A(this.stylesheet.light),this.map.setTerrain(null!==(n=this.stylesheet.terrain)&&void 0!==n?n:null),this.fire(new t.Event("data",{dataType:"style"})),this.fire(new t.Event("style.load"))}}_createLayers(){const e=t.derefLayers(this.stylesheet.layers);this.dispatcher.broadcast("setLayers",e),this._order=e.map((t=>t.id)),this._layers={},this._serializedLayers=null;for(const i of e){const e=t.createStyleLayer(i);e.setEventedParent(this,{layer:{id:i.id}}),this._layers[i.id]=e}}_loadSprite(e,i=!1,r=void 0){this.imageManager.setLoaded(!1),this._spriteRequest=function(e,i,r,n){const a=_(e),o=a.length,s=r>1?"@2x":"",l={},u={},p={};for(const{id:e,url:r}of a){const a=i.transformRequest(i.normalizeSpriteURL(r,s,".json"),h.SpriteJSON),d=`${e}_${a.url}`;l[d]=t.getJSON(a,((t,i)=>{delete l[d],u[e]=i,y(n,u,p,t,o)}));const m=i.transformRequest(i.normalizeSpriteURL(r,s,".png"),h.SpriteImage),f=`${e}_${m.url}`;l[f]=c.getImage(m,((t,i)=>{delete l[f],p[e]=i,y(n,u,p,t,o)}))}return{cancel(){for(const t of Object.values(l))t.cancel()}}}(e,this.map._requestManager,this.map.getPixelRatio(),((e,n)=>{if(this._spriteRequest=null,e)this.fire(new t.ErrorEvent(e));else if(n)for(const t in n){this._spritesImagesIds[t]=[];const e=this._spritesImagesIds[t]?this._spritesImagesIds[t].filter((t=>!(t in n))):[];for(const t of e)this.imageManager.removeImage(t),this._changedImages[t]=!0;for(const e in n[t]){const r="default"===t?e:`${t}:${e}`;this._spritesImagesIds[t].push(r),r in this.imageManager.images?this.imageManager.updateImage(r,n[t][e],!1):this.imageManager.addImage(r,n[t][e]),i&&(this._changedImages[r]=!0)}}this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),i&&(this._changed=!0),this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new t.Event("data",{dataType:"style"})),r&&r(e)}))}_unloadSprite(){for(const t of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(t),this._changedImages[t]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new t.Event("data",{dataType:"style"}))}_validateLayer(e){const i=this.sourceCaches[e.source];if(!i)return;const r=e.sourceLayer;if(!r)return;const n=i.getSource();("geojson"===n.type||n.vectorLayerIds&&-1===n.vectorLayerIds.indexOf(r))&&this.fire(new t.ErrorEvent(new Error(`Source layer "${r}" does not exist on source "${n.id}" as specified by style layer "${e.id}".`)))}loaded(){if(!this._loaded)return!1;if(Object.keys(this._updatedSources).length)return!1;for(const t in this.sourceCaches)if(!this.sourceCaches[t].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(t){const e=this._serializedAllLayers();if(!t||0===t.length)return Object.values(e);const i=[];for(const r of t)e[r]&&i.push(e[r]);return i}_serializedAllLayers(){let t=this._serializedLayers;if(t)return t;t=this._serializedLayers={};const e=Object.keys(this._layers);for(const i of e){const e=this._layers[i];"custom"!==e.type&&(t[i]=e.serialize())}return t}hasTransitions(){if(this.light&&this.light.hasTransition())return!0;for(const t in this.sourceCaches)if(this.sourceCaches[t].hasTransition())return!0;for(const t in this._layers)if(this._layers[t].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(e){if(!this._loaded)return;const i=this._changed;if(this._changed){const t=Object.keys(this._updatedLayers),i=Object.keys(this._removedLayers);(t.length||i.length)&&this._updateWorkerLayers(t,i);for(const t in this._updatedSources){const e=this._updatedSources[t];if("reload"===e)this._reloadSource(t);else{if("clear"!==e)throw new Error(`Invalid action ${e}`);this._clearSource(t)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const t in this._updatedPaintProps)this._layers[t].updateTransitions(e);this.light.updateTransitions(e),this._resetUpdates()}const r={};for(const t in this.sourceCaches){const e=this.sourceCaches[t];r[t]=e.used,e.used=!1}for(const t of this._order){const i=this._layers[t];i.recalculate(e,this._availableImages),!i.isHidden(e.zoom)&&i.source&&(this.sourceCaches[i.source].used=!0)}for(const e in r){const i=this.sourceCaches[e];r[e]!==i.used&&i.fire(new t.Event("data",{sourceDataType:"visibility",dataType:"source",sourceId:e}))}this.light.recalculate(e),this.z=e.zoom,i&&this.fire(new t.Event("data",{dataType:"style"}))}_updateTilesForChangedImages(){const t=Object.keys(this._changedImages);if(t.length){for(const e in this.sourceCaches)this.sourceCaches[e].reloadTilesForDependencies(["icons","patterns"],t);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const t in this.sourceCaches)this.sourceCaches[t].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(t,e){this.dispatcher.broadcast("updateLayers",{layers:this._serializeByIds(t),removedIds:e})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(e,i={}){this._checkLoaded();const r=this.serialize();if(e=i.transformStyle?i.transformStyle(r,e):e,Qt(this,t.validateStyle(e)))return!1;(e=t.clone$1(e)).layers=t.derefLayers(e.layers);const n=t.diffStyles(r,e).filter((t=>!(t.command in ee)));if(0===n.length)return!1;const a=n.filter((t=>!(t.command in te)));if(a.length>0)throw new Error(`Unimplemented: ${a.map((t=>t.command)).join(", ")}.`);for(const t of n)"setTransition"!==t.command&&this[t.command].apply(this,t.args);return this.stylesheet=e,this._serializedLayers=null,!0}addImage(e,i){if(this.getImage(e))return this.fire(new t.ErrorEvent(new Error(`An image named "${e}" already exists.`)));this.imageManager.addImage(e,i),this._afterImageUpdated(e)}updateImage(t,e){this.imageManager.updateImage(t,e)}getImage(t){return this.imageManager.getImage(t)}removeImage(e){if(!this.getImage(e))return this.fire(new t.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 t.Event("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(e,i,r={}){if(this._checkLoaded(),void 0!==this.sourceCaches[e])throw new Error(`Source "${e}" already exists.`);if(!i.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(i).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(i.type)>=0&&this._validate(t.validateStyle.source,`sources.${e}`,i,null,r))return;this.map&&this.map._collectResourceTiming&&(i.collectResourceTiming=!0);const n=this.sourceCaches[e]=new K(e,i,this.dispatcher);n.style=this,n.setEventedParent(this,(()=>({isSourceLoaded:n.loaded(),source:n.serialize(),sourceId:e}))),n.onAdd(this.map),this._changed=!0}removeSource(e){if(this._checkLoaded(),void 0===this.sourceCaches[e])throw new Error("There is no source with this ID");for(const i in this._layers)if(this._layers[i].source===e)return this.fire(new t.ErrorEvent(new Error(`Source "${e}" cannot be removed while layer "${i}" is using it.`)));const i=this.sourceCaches[e];delete this.sourceCaches[e],delete this._updatedSources[e],i.fire(new t.Event("data",{sourceDataType:"metadata",dataType:"source",sourceId:e})),i.setEventedParent(null),i.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(t,e){if(this._checkLoaded(),void 0===this.sourceCaches[t])throw new Error(`There is no source with this ID=${t}`);const i=this.sourceCaches[t].getSource();if("geojson"!==i.type)throw new Error(`geojsonSource.type is ${i.type}, which is !== 'geojson`);i.setData(e),this._changed=!0}getSource(t){return this.sourceCaches[t]&&this.sourceCaches[t].getSource()}addLayer(e,i,r={}){this._checkLoaded();const n=e.id;if(this.getLayer(n))return void this.fire(new t.ErrorEvent(new Error(`Layer "${n}" already exists on this map.`)));let a;if("custom"===e.type){if(Qt(this,t.validateCustomStyleLayer(e)))return;a=t.createStyleLayer(e)}else{if("source"in e&&"object"==typeof e.source&&(this.addSource(n,e.source),e=t.clone$1(e),e=t.extend(e,{source:n})),this._validate(t.validateStyle.layer,`layers.${n}`,e,{arrayIndex:-1},r))return;a=t.createStyleLayer(e),this._validateLayer(a),a.setEventedParent(this,{layer:{id:n}})}const o=i?this._order.indexOf(i):this._order.length;if(i&&-1===o)this.fire(new t.ErrorEvent(new Error(`Cannot add layer "${n}" before non-existing layer "${i}".`)));else{if(this._order.splice(o,0,n),this._layerOrderChanged=!0,this._layers[n]=a,this._removedLayers[n]&&a.source&&"custom"!==a.type){const t=this._removedLayers[n];delete this._removedLayers[n],t.type!==a.type?this._updatedSources[a.source]="clear":(this._updatedSources[a.source]="reload",this.sourceCaches[a.source].pause())}this._updateLayer(a),a.onAdd&&a.onAdd(this.map)}}moveLayer(e,i){if(this._checkLoaded(),this._changed=!0,!this._layers[e])return void this.fire(new t.ErrorEvent(new Error(`The layer '${e}' does not exist in the map's style and cannot be moved.`)));if(e===i)return;const r=this._order.indexOf(e);this._order.splice(r,1);const n=i?this._order.indexOf(i):this._order.length;i&&-1===n?this.fire(new t.ErrorEvent(new Error(`Cannot move layer "${e}" before non-existing layer "${i}".`))):(this._order.splice(n,0,e),this._layerOrderChanged=!0)}removeLayer(e){this._checkLoaded();const i=this._layers[e];if(!i)return void this.fire(new t.ErrorEvent(new Error(`Cannot remove non-existing layer "${e}".`)));i.setEventedParent(null);const r=this._order.indexOf(e);this._order.splice(r,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[e]=i,delete this._layers[e],this._serializedLayers&&delete this._serializedLayers[e],delete this._updatedLayers[e],delete this._updatedPaintProps[e],i.onRemove&&i.onRemove(this.map)}getLayer(t){return this._layers[t]}hasLayer(t){return t in this._layers}setLayerZoomRange(e,i,r){this._checkLoaded();const n=this.getLayer(e);n?n.minzoom===i&&n.maxzoom===r||(null!=i&&(n.minzoom=i),null!=r&&(n.maxzoom=r),this._updateLayer(n)):this.fire(new t.ErrorEvent(new Error(`Cannot set the zoom range of non-existing layer "${e}".`)))}setFilter(e,i,r={}){this._checkLoaded();const n=this.getLayer(e);if(n){if(!t.deepEqual(n.filter,i))return null==i?(n.filter=void 0,void this._updateLayer(n)):void(this._validate(t.validateStyle.filter,`layers.${n.id}.filter`,i,null,r)||(n.filter=t.clone$1(i),this._updateLayer(n)))}else this.fire(new t.ErrorEvent(new Error(`Cannot filter non-existing layer "${e}".`)))}getFilter(e){return t.clone$1(this.getLayer(e).filter)}setLayoutProperty(e,i,r,n={}){this._checkLoaded();const a=this.getLayer(e);a?t.deepEqual(a.getLayoutProperty(i),r)||(a.setLayoutProperty(i,r,n),this._updateLayer(a)):this.fire(new t.ErrorEvent(new Error(`Cannot style non-existing layer "${e}".`)))}getLayoutProperty(e,i){const r=this.getLayer(e);if(r)return r.getLayoutProperty(i);this.fire(new t.ErrorEvent(new Error(`Cannot get style of non-existing layer "${e}".`)))}setPaintProperty(e,i,r,n={}){this._checkLoaded();const a=this.getLayer(e);a?t.deepEqual(a.getPaintProperty(i),r)||(a.setPaintProperty(i,r,n)&&this._updateLayer(a),this._changed=!0,this._updatedPaintProps[e]=!0):this.fire(new t.ErrorEvent(new Error(`Cannot style non-existing layer "${e}".`)))}getPaintProperty(t,e){return this.getLayer(t).getPaintProperty(e)}setFeatureState(e,i){this._checkLoaded();const r=e.source,n=e.sourceLayer,a=this.sourceCaches[r];if(void 0===a)return void this.fire(new t.ErrorEvent(new Error(`The source '${r}' does not exist in the map's style.`)));const o=a.getSource().type;"geojson"===o&&n?this.fire(new t.ErrorEvent(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):"vector"!==o||n?(void 0===e.id&&this.fire(new t.ErrorEvent(new Error("The feature id parameter must be provided."))),a.setFeatureState(n,e.id,i)):this.fire(new t.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(e,i){this._checkLoaded();const r=e.source,n=this.sourceCaches[r];if(void 0===n)return void this.fire(new t.ErrorEvent(new Error(`The source '${r}' does not exist in the map's style.`)));const a=n.getSource().type,o="vector"===a?e.sourceLayer:void 0;"vector"!==a||o?i&&"string"!=typeof e.id&&"number"!=typeof e.id?this.fire(new t.ErrorEvent(new Error("A feature id is required to remove its specific state property."))):n.removeFeatureState(o,e.id,i):this.fire(new t.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(e){this._checkLoaded();const i=e.source,r=e.sourceLayer,n=this.sourceCaches[i];if(void 0!==n)return"vector"!==n.getSource().type||r?(void 0===e.id&&this.fire(new t.ErrorEvent(new Error("The feature id parameter must be provided."))),n.getFeatureState(r,e.id)):void this.fire(new t.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new t.ErrorEvent(new Error(`The source '${i}' does not exist in the map's style.`)))}getTransition(){return t.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;const e=t.mapObject(this.sourceCaches,(t=>t.serialize())),i=this._serializeByIds(this._order),r=this.stylesheet;return t.filterObject({version:r.version,name:r.name,metadata:r.metadata,light:r.light,center:r.center,zoom:r.zoom,bearing:r.bearing,pitch:r.pitch,sprite:r.sprite,glyphs:r.glyphs,transition:r.transition,sources:e,layers:i},(t=>void 0!==t))}_updateLayer(t){this._updatedLayers[t.id]=!0,t.source&&!this._updatedSources[t.source]&&"raster"!==this.sourceCaches[t.source].getSource().type&&(this._updatedSources[t.source]="reload",this.sourceCaches[t.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(t){const e=t=>"fill-extrusion"===this._layers[t].type,i={},r=[];for(let n=this._order.length-1;n>=0;n--){const a=this._order[n];if(e(a)){i[a]=n;for(const e of t){const t=e[a];if(t)for(const e of t)r.push(e)}}}r.sort(((t,e)=>e.intersectionZ-t.intersectionZ));const n=[];for(let a=this._order.length-1;a>=0;a--){const o=this._order[a];if(e(o))for(let t=r.length-1;t>=0;t--){const e=r[t].feature;if(i[e.layer.id]<a)break;n.push(e),r.pop()}else for(const e of t){const t=e[o];if(t)for(const e of t)n.push(e.feature)}}return n}queryRenderedFeatures(e,i,r){i&&i.filter&&this._validate(t.validateStyle.filter,"queryRenderedFeatures.filter",i.filter,null,i);const n={};if(i&&i.layers){if(!Array.isArray(i.layers))return this.fire(new t.ErrorEvent(new Error("parameters.layers must be an Array."))),[];for(const e of i.layers){const i=this._layers[e];if(!i)return this.fire(new t.ErrorEvent(new Error(`The layer '${e}' does not exist in the map's style and cannot be queried for features.`))),[];n[i.source]=!0}}const a=[];i.availableImages=this._availableImages;const o=this._serializedAllLayers();for(const t in this.sourceCaches)i.layers&&!n[t]||a.push(Z(this.sourceCaches[t],this._layers,o,e,i,r));return this.placement&&a.push(function(t,e,i,r,n,a,o){const s={},l=a.queryRenderedSymbols(r),c=[];for(const t of Object.keys(l).map(Number))c.push(o[t]);c.sort(G);for(const i of c){const r=i.featureIndex.lookupSymbolFeatures(l[i.bucketInstanceId],e,i.bucketIndex,i.sourceLayerIndex,n.filter,n.layers,n.availableImages,t);for(const t in r){const e=s[t]=s[t]||[],n=r[t];n.sort(((t,e)=>{const r=i.featureSortOrder;if(r){const i=r.indexOf(t.featureIndex);return r.indexOf(e.featureIndex)-i}return e.featureIndex-t.featureIndex}));for(const t of n)e.push(t)}}for(const e in s)s[e].forEach((r=>{const n=r.feature,a=i[t[e].source].getFeatureState(n.layer["source-layer"],n.id);n.source=n.layer.source,n.layer["source-layer"]&&(n.sourceLayer=n.layer["source-layer"]),n.state=a}));return s}(this._layers,o,this.sourceCaches,e,i,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(a)}querySourceFeatures(e,i){i&&i.filter&&this._validate(t.validateStyle.filter,"querySourceFeatures.filter",i.filter,null,i);const r=this.sourceCaches[e];return r?function(t,e){const i=t.getRenderableIds().map((e=>t.getTileByID(e))),r=[],n={};for(let t=0;t<i.length;t++){const a=i[t],o=a.tileID.canonical.key;n[o]||(n[o]=!0,a.querySourceFeatures(r,e))}return r}(r,i):[]}addSourceType(t,e,i){return j(t)?i(new Error(`A source type called "${t}" already exists.`)):(((t,e)=>{$[t]=e})(t,e),e.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:t,url:e.workerSourceURL},i):i(null,null))}getLight(){return this.light.getLight()}setLight(e,i={}){this._checkLoaded();const r=this.light.getLight();let n=!1;for(const i in e)if(!t.deepEqual(e[i],r[i])){n=!0;break}if(!n)return;const a={now:t.browser.now(),transition:t.extend({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(e,i),this.light.updateTransitions(a)}_validate(e,i,r,n,a={}){return(!a||!1!==a.validate)&&Qt(this,e.call(t.validateStyle,t.extend({key:i,style:this.serialize(),value:r,styleSpec:t.v8Spec},n)))}_remove(e=!0){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),t.evented.off("pluginStateChange",this._rtlTextPluginCallback);for(const t in this._layers)this._layers[t].setEventedParent(null);for(const t in this.sourceCaches){const e=this.sourceCaches[t];e.setEventedParent(null),e.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),this.dispatcher.remove(e)}_clearSource(t){this.sourceCaches[t].clearTiles()}_reloadSource(t){this.sourceCaches[t].resume(),this.sourceCaches[t].reload()}_updateSources(t){for(const e in this.sourceCaches)this.sourceCaches[e].update(t,this.map.terrain)}_generateCollisionBoxes(){for(const t in this.sourceCaches)this._reloadSource(t)}_updatePlacement(e,i,r,n,a=!1){let o=!1,s=!1;const l={};for(const t of this._order){const i=this._layers[t];if("symbol"!==i.type)continue;if(!l[i.source]){const t=this.sourceCaches[i.source];l[i.source]=t.getRenderableIds(!0).map((e=>t.getTileByID(e))).sort(((t,e)=>e.tileID.overscaledZ-t.tileID.overscaledZ||(t.tileID.isLessThan(e.tileID)?-1:1)))}const r=this.crossTileSymbolIndex.addLayer(i,l[i.source],e.center.lng);o=o||r}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((a=a||this._layerOrderChanged||0===r)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(t.browser.now(),e.zoom))&&(this.pauseablePlacement=new Ht(e,this.map.terrain,this._order,a,i,r,n,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,l),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(t.browser.now()),s=!0),o&&this.pauseablePlacement.placement.setStale()),s||o)for(const t of this._order){const e=this._layers[t];"symbol"===e.type&&this.placement.updateLayerOpacities(e,l[e.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(t.browser.now())}_releaseSymbolFadeTiles(){for(const t in this.sourceCaches)this.sourceCaches[t].releaseSymbolFadeTiles()}getImages(t,e,i){this.imageManager.getImages(e.icons,i),this._updateTilesForChangedImages();const r=this.sourceCaches[e.source];r&&r.setDependencies(e.tileID.key,e.type,e.icons)}getGlyphs(t,e,i){this.glyphManager.getGlyphs(e.stacks,i);const r=this.sourceCaches[e.source];r&&r.setDependencies(e.tileID.key,e.type,[""])}getResource(e,i,r){return t.makeRequest(i,r)}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(e,i={}){this._checkLoaded(),e&&this._validate(t.validateStyle.glyphs,"glyphs",e,null,i)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=e,this.glyphManager.entries={},this.glyphManager.setURL(e))}addSprite(e,i,r={},n){this._checkLoaded();const a=[{id:e,url:i}],o=[..._(this.stylesheet.sprite),...a];this._validate(t.validateStyle.sprite,"sprite",o,null,r)||(this.stylesheet.sprite=o,this._loadSprite(a,!0,n))}removeSprite(e){this._checkLoaded();const i=_(this.stylesheet.sprite);if(i.find((t=>t.id===e))){if(this._spritesImagesIds[e])for(const t of this._spritesImagesIds[e])this.imageManager.removeImage(t),this._changedImages[t]=!0;i.splice(i.findIndex((t=>t.id===e)),1),this.stylesheet.sprite=i.length>0?i:void 0,delete this._spritesImagesIds[e],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new t.Event("data",{dataType:"style"}))}else this.fire(new t.ErrorEvent(new Error(`Sprite "${e}" doesn't exists on this map.`)))}getSprite(){return _(this.stylesheet.sprite)}setSprite(e,i={},r){this._checkLoaded(),e&&this._validate(t.validateStyle.sprite,"sprite",e,null,i)||(this.stylesheet.sprite=e,e?this._loadSprite(e,!0,r):(this._unloadSprite(),r&&r(null)))}}re.registerForPluginStateChange=t.registerForPluginStateChange;var ne=t.createLayout([{name:"a_pos",type:"Int16",components:2}]),ae="attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform float u_ele_delta;varying vec2 v_texture_pos;varying float v_depth;void main() {float extent=8192.0;float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/extent;gl_Position=u_matrix*vec4(a_pos3d.xy,get_elevation(a_pos3d.xy)-ele_delta,1.0);v_depth=gl_Position.z/gl_Position.w;}";const oe={prelude:se("#ifdef GL_ES\nprecision mediump float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif\n","#ifdef GL_ES\nprecision highp float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif\nvec2 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\n);}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;}\n#ifdef TERRAIN3D\nuniform sampler2D u_terrain;uniform float u_terrain_dim;uniform mat4 u_terrain_matrix;uniform vec4 u_terrain_unpack;uniform float u_terrain_exaggeration;uniform highp sampler2D u_depth;\n#endif\nconst highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitShifts=vec4(1.)/bitSh;highp float unpack(highp vec4 color) {return dot(color,bitShifts);}highp float depthOpacity(vec3 frag) {\n#ifdef TERRAIN3D\nhighp float d=unpack(texture2D(u_depth,frag.xy*0.5+0.5))+0.0001-frag.z;return 1.0-max(0.0,min(1.0,-d*500.0));\n#else\nreturn 1.0;\n#endif\n}float calculate_visibility(vec4 pos) {\n#ifdef TERRAIN3D\nvec3 frag=pos.xyz/pos.w;highp float d=depthOpacity(frag);if (d > 0.95) return 1.0;return (d+depthOpacity(frag+vec3(0.0,0.01,0.0)))/2.0;\n#else\nreturn 1.0;\n#endif\n}float ele(vec2 pos) {\n#ifdef TERRAIN3D\nvec4 rgb=(texture2D(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a;\n#else\nreturn 0.0;\n#endif\n}float get_elevation(vec2 pos) {\n#ifdef TERRAIN3D\nvec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.0;vec2 f=fract(coord);vec2 c=(floor(coord)+0.5)/(u_terrain_dim+2.0);float d=1.0/(u_terrain_dim+2.0);float tl=ele(c);float tr=ele(c+vec2(d,0.0));float bl=ele(c+vec2(0.0,d));float br=ele(c+vec2(d,d));float elevation=mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);return elevation*u_terrain_exaggeration;\n#else\nreturn 0.0;\n#endif\n}"),background:se("uniform vec4 u_color;uniform float u_opacity;void main() {gl_FragColor=u_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),backgroundPattern:se("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;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","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:se("varying vec3 v_data;varying float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=v_data.xy;float extrude_length=length(extrude);lowp float antialiasblur=v_data.z;float antialiased_blur=-max(blur,antialiasblur);float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));gl_FragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;attribute vec2 a_pos;varying vec3 v_data;varying float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main(void) {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);float ele=get_elevation(circle_center);v_visibility=calculate_visibility(u_matrix*vec4(circle_center,ele,1.0));if (u_pitch_with_map) {vec2 corner_position=circle_center;if (u_scale_with_map) {corner_position+=extrude*(radius+stroke_width)*u_extrude_scale;} else {vec4 projected_center=u_matrix*vec4(circle_center,0,1);corner_position+=extrude*(radius+stroke_width)*u_extrude_scale*(projected_center.w/u_camera_to_center_distance);}gl_Position=u_matrix*vec4(corner_position,ele,1);} else {gl_Position=u_matrix*vec4(circle_center,ele,1);if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);}"),clippingMask:se("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:se("uniform highp float u_intensity;varying vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#define GAUSS_COEF 0.3989422804014327\nvoid main() {\n#pragma mapbox: initialize highp float weight\nfloat d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);gl_FragColor=vec4(val,1.0,1.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;attribute vec2 a_pos;varying vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#pragma mapbox: define mediump float radius\nconst highp float ZERO=1.0/255.0/16.0;\n#define GAUSS_COEF 0.3989422804014327\nvoid main(void) {\n#pragma mapbox: initialize highp float weight\n#pragma mapbox: initialize mediump float radius\nvec2 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:se("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;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(0.0);\n#endif\n}","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:se("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,get_elevation(a_pos),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:se("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:se("uniform highp vec4 u_color;uniform sampler2D u_overlay;varying vec2 v_uv;void main() {vec4 overlay_color=texture2D(u_overlay,v_uv);gl_FragColor=mix(u_color,overlay_color,overlay_color.a);}","attribute vec2 a_pos;varying vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,get_elevation(a_pos),1);}"),fill:se("#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_FragColor=color*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);}"),fillOutline:se("varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=outline_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}"),fillOutlinePattern:se("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;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=mix(color1,color2,u_fade)*alpha*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 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:se("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_fade)*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 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:se("varying vec4 v_color;void main() {gl_FragColor=v_color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;attribute vec2 a_pos;attribute vec4 a_normal_ed;\n#ifdef TERRAIN3D\nattribute vec2 a_centroid;\n#endif\nvarying vec4 v_color;\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\nvec3 normal=a_normal_ed.xyz;\n#ifdef TERRAIN3D\nfloat height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);\n#else\nfloat height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;\n#endif\nbase=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);gl_Position=u_matrix*vec4(a_pos,t > 0.0 ? height : base,1);float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;float directional=clamp(dot(normal/16384.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}"),fillExtrusionPattern:se("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;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);gl_FragColor=mixedColor*v_lighting;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute vec2 a_pos;attribute vec4 a_normal_ed;\n#ifdef TERRAIN3D\nattribute vec2 a_centroid;\n#endif\nvarying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 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;\n#ifdef TERRAIN3D\nfloat height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);\n#else\nfloat height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;\n#endif\nbase=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float z=t > 0.0 ? height : base;gl_Position=u_matrix*vec4(a_pos,z,1);vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0\n? a_pos\n: 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:se("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform 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);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","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:se("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;\n#define PI 3.141592653589793\nvoid 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;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","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:se("uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp float v_linesofar;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat 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;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat 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;\n#endif\nv_width2=vec2(outset,inset);}"),lineGradient:se("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;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture2D(u_image,v_uv);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;attribute float a_uv_x;attribute float a_split_index;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp vec2 v_uv;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat 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;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat 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;\n#endif\nv_width2=vec2(outset,inset);}"),linePattern:se("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform 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;\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture2D(u_image,pos_a),texture2D(u_image,pos_b),u_fade);gl_FragColor=color*alpha*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nfloat 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;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat 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;\n#endif\nv_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}"),lineSDF:se("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;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture2D(u_image,v_tex_a).a;float sdfdist_b=texture2D(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);alpha*=smoothstep(0.5-u_sdfgamma/floorwidth,0.5+u_sdfgamma/floorwidth,sdfdist);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_patternscale_a;uniform float u_tex_y_a;uniform vec2 u_patternscale_b;uniform float u_tex_y_b;uniform vec2 u_units_to_pixels;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\nfloat 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;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat 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;\n#endif\nv_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:se("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);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","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:se("uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nlowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_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),ele,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,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;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),z,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;float visibility=calculate_visibility(projectedPoint);v_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));}"),symbolSDF:se("#define SDF_PX 8.0\nuniform 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;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float inner_edge=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);inner_edge=inner_edge+gamma*gamma_scale;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(inner_edge-gamma_scaled,inner_edge+gamma_scaled,dist);if (u_is_halo) {lowp float halo_edge=(6.0-halo_width/fontScale)/SDF_PX;alpha=min(smoothstep(halo_edge-gamma_scaled,halo_edge+gamma_scaled,dist),1.0-alpha);}gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_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),ele,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,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset),z,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}"),symbolTextAndIcon:se("#define SDF_PX 8.0\n#define SDF 1.0\n#define ICON 0.0\nuniform 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;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\nreturn;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;varying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_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),ele,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,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale),z,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}"),terrain:se("uniform sampler2D u_texture;varying vec2 v_texture_pos;void main() {gl_FragColor=texture2D(u_texture,v_texture_pos);}",ae),terrainDepth:se("varying float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {gl_FragColor=pack(v_depth);}",ae),terrainCoords:se("precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;varying vec2 v_texture_pos;void main() {vec4 rgba=texture2D(u_texture,v_texture_pos);gl_FragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}",ae)};function se(t,e){const i=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,r=e.match(/attribute ([\w]+) ([\w]+)/g),n=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),a=e.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),o=a?a.concat(n):n,s={};return{fragmentSource:t=t.replace(i,((t,e,i,r,n)=>(s[n]=!0,"define"===e?`\n#ifndef HAS_UNIFORM_u_${n}\nvarying ${i} ${r} ${n};\n#else\nuniform ${i} ${r} u_${n};\n#endif\n`:`\n#ifdef HAS_UNIFORM_u_${n}\n ${i} ${r} ${n} = u_${n};\n#endif\n`))),vertexSource:e=e.replace(i,((t,e,i,r,n)=>{const a="float"===r?"vec2":"vec4",o=n.match(/color/)?"color":a;return s[n]?"define"===e?`\n#ifndef HAS_UNIFORM_u_${n}\nuniform lowp float u_${n}_t;\nattribute ${i} ${a} a_${n};\nvarying ${i} ${r} ${n};\n#else\nuniform ${i} ${r} u_${n};\n#endif\n`:"vec4"===o?`\n#ifndef HAS_UNIFORM_u_${n}\n ${n} = a_${n};\n#else\n ${i} ${r} ${n} = u_${n};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${n}\n ${n} = unpack_mix_${o}(a_${n}, u_${n}_t);\n#else\n ${i} ${r} ${n} = u_${n};\n#endif\n`:"define"===e?`\n#ifndef HAS_UNIFORM_u_${n}\nuniform lowp float u_${n}_t;\nattribute ${i} ${a} a_${n};\n#else\nuniform ${i} ${r} u_${n};\n#endif\n`:"vec4"===o?`\n#ifndef HAS_UNIFORM_u_${n}\n ${i} ${r} ${n} = a_${n};\n#else\n ${i} ${r} ${n} = u_${n};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${n}\n ${i} ${r} ${n} = unpack_mix_${o}(a_${n}, u_${n}_t);\n#else\n ${i} ${r} ${n} = u_${n};\n#endif\n`})),staticAttributes:r,staticUniforms:o}}class le{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(t,e,i,r,n,a,o,s,l){this.context=t;let c=this.boundPaintVertexBuffers.length!==r.length;for(let t=0;!c&&t<r.length;t++)this.boundPaintVertexBuffers[t]!==r[t]&&(c=!0);!this.vao||this.boundProgram!==e||this.boundLayoutVertexBuffer!==i||c||this.boundIndexBuffer!==n||this.boundVertexOffset!==a||this.boundDynamicVertexBuffer!==o||this.boundDynamicVertexBuffer2!==s||this.boundDynamicVertexBuffer3!==l?this.freshBind(e,i,r,n,a,o,s,l):(t.bindVertexArray.set(this.vao),o&&o.bind(),n&&n.dynamicDraw&&n.bind(),s&&s.bind(),l&&l.bind())}freshBind(t,e,i,r,n,a,o,s){const l=t.numAttributes,c=this.context,h=c.gl;this.vao&&this.destroy(),this.vao=c.createVertexArray(),c.bindVertexArray.set(this.vao),this.boundProgram=t,this.boundLayoutVertexBuffer=e,this.boundPaintVertexBuffers=i,this.boundIndexBuffer=r,this.boundVertexOffset=n,this.boundDynamicVertexBuffer=a,this.boundDynamicVertexBuffer2=o,this.boundDynamicVertexBuffer3=s,e.enableAttributes(h,t);for(const e of i)e.enableAttributes(h,t);a&&a.enableAttributes(h,t),o&&o.enableAttributes(h,t),s&&s.enableAttributes(h,t),e.bind(),e.setVertexAttribPointers(h,t,n);for(const e of i)e.bind(),e.setVertexAttribPointers(h,t,n);a&&(a.bind(),a.setVertexAttribPointers(h,t,n)),r&&r.bind(),o&&(o.bind(),o.setVertexAttribPointers(h,t,n)),s&&(s.bind(),s.setVertexAttribPointers(h,t,n)),c.currentNumAttributes=l}destroy(){this.vao&&(this.context.deleteVertexArray(this.vao),this.vao=null)}}function ce(t){const e=[];for(let i=0;i<t.length;i++){if(null===t[i])continue;const r=t[i].split(" ");e.push(r.pop())}return e}class he{constructor(e,i,r,n,a,o){const s=e.gl;this.program=s.createProgram();const l=ce(i.staticAttributes),c=r?r.getBinderAttributes():[],h=l.concat(c),u=oe.prelude.staticUniforms?ce(oe.prelude.staticUniforms):[],p=i.staticUniforms?ce(i.staticUniforms):[],d=r?r.getBinderUniforms():[],m=u.concat(p).concat(d),f=[];for(const t of m)f.indexOf(t)<0&&f.push(t);const g=r?r.defines():[];a&&g.push("#define OVERDRAW_INSPECTOR;"),o&&g.push("#define TERRAIN3D;");const _=g.concat(oe.prelude.fragmentSource,i.fragmentSource).join("\n"),y=g.concat(oe.prelude.vertexSource,i.vertexSource).join("\n"),x=s.createShader(s.FRAGMENT_SHADER);if(s.isContextLost())return void(this.failedToCreate=!0);if(s.shaderSource(x,_),s.compileShader(x),!s.getShaderParameter(x,s.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${s.getShaderInfoLog(x)}`);s.attachShader(this.program,x);const v=s.createShader(s.VERTEX_SHADER);if(s.isContextLost())return void(this.failedToCreate=!0);if(s.shaderSource(v,y),s.compileShader(v),!s.getShaderParameter(v,s.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${s.getShaderInfoLog(v)}`);s.attachShader(this.program,v),this.attributes={};const b={};this.numAttributes=h.length;for(let t=0;t<this.numAttributes;t++)h[t]&&(s.bindAttribLocation(this.program,t,h[t]),this.attributes[h[t]]=t);if(s.linkProgram(this.program),!s.getProgramParameter(this.program,s.LINK_STATUS))throw new Error(`Program failed to link: ${s.getProgramInfoLog(this.program)}`);s.deleteShader(v),s.deleteShader(x);for(let t=0;t<f.length;t++){const e=f[t];if(e&&!b[e]){const t=s.getUniformLocation(this.program,e);t&&(b[e]=t)}}this.fixedUniforms=n(e,b),this.terrainUniforms=((e,i)=>({u_depth:new t.Uniform1i(e,i.u_depth),u_terrain:new t.Uniform1i(e,i.u_terrain),u_terrain_dim:new t.Uniform1f(e,i.u_terrain_dim),u_terrain_matrix:new t.UniformMatrix4f(e,i.u_terrain_matrix),u_terrain_unpack:new t.Uniform4f(e,i.u_terrain_unpack),u_terrain_exaggeration:new t.Uniform1f(e,i.u_terrain_exaggeration)}))(e,b),this.binderUniforms=r?r.getUniforms(e,b):[]}draw(t,e,i,r,n,a,o,s,l,c,h,u,p,d,m,f,g,_){const y=t.gl;if(this.failedToCreate)return;if(t.program.set(this.program),t.setDepthMode(i),t.setStencilMode(r),t.setColorMode(n),t.setCullFace(a),s){t.activeTexture.set(y.TEXTURE2),y.bindTexture(y.TEXTURE_2D,s.depthTexture),t.activeTexture.set(y.TEXTURE3),y.bindTexture(y.TEXTURE_2D,s.texture);for(const t in this.terrainUniforms)this.terrainUniforms[t].set(s[t])}for(const t in this.fixedUniforms)this.fixedUniforms[t].set(o[t]);m&&m.setUniforms(t,this.binderUniforms,p,{zoom:d});let x=0;switch(e){case y.LINES:x=2;break;case y.TRIANGLES:x=3;break;case y.LINE_STRIP:x=1}for(const i of u.get()){const r=i.vaos||(i.vaos={});(r[l]||(r[l]=new le)).bind(t,this,c,m?m.getPaintVertexBuffers():[],h,i.vertexOffset,f,g,_),y.drawElements(e,i.primitiveLength*x,y.UNSIGNED_SHORT,i.primitiveOffset*x*2)}}}function ue(t,e,i){const r=1/Ct(i,1,e.transform.tileZoom),n=Math.pow(2,i.tileID.overscaledZ),a=i.tileSize*Math.pow(2,e.transform.tileZoom)/n,o=a*(i.tileID.canonical.x+i.tileID.wrap*n),s=a*i.tileID.canonical.y;return{u_image:0,u_texsize:i.imageAtlasTexture.size,u_scale:[r,t.fromScale,t.toScale],u_fade:t.t,u_pixel_coord_upper:[o>>16,s>>16],u_pixel_coord_lower:[65535&o,65535&s]}}const pe=(e,i,r,n)=>{const a=i.style.light,o=a.properties.get("position"),s=[o.x,o.y,o.z],l=function(){var e=new t.ARRAY_TYPE(9);return t.ARRAY_TYPE!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1,e}();"viewport"===a.properties.get("anchor")&&function(t,e){var i=Math.sin(e),r=Math.cos(e);t[0]=r,t[1]=i,t[2]=0,t[3]=-i,t[4]=r,t[5]=0,t[6]=0,t[7]=0,t[8]=1}(l,-i.transform.angle),function(t,e,i){var r=e[0],n=e[1],a=e[2];t[0]=r*i[0]+n*i[3]+a*i[6],t[1]=r*i[1]+n*i[4]+a*i[7],t[2]=r*i[2]+n*i[5]+a*i[8]}(s,s,l);const c=a.properties.get("color");return{u_matrix:e,u_lightpos:s,u_lightintensity:a.properties.get("intensity"),u_lightcolor:[c.r,c.g,c.b],u_vertical_gradient:+r,u_opacity:n}},de=(e,i,r,n,a,o,s)=>t.extend(pe(e,i,r,n),ue(o,i,s),{u_height_factor:-Math.pow(2,a.overscaledZ)/s.tileSize/8}),me=t=>({u_matrix:t}),fe=(e,i,r,n)=>t.extend(me(e),ue(r,i,n)),ge=(t,e)=>({u_matrix:t,u_world:e}),_e=(e,i,r,n,a)=>t.extend(fe(e,i,r,n),{u_world:a}),ye=(t,e,i,r)=>{const n=t.transform;let a,o;if("map"===r.paint.get("circle-pitch-alignment")){const t=Ct(i,1,n.zoom);a=!0,o=[t,t]}else a=!1,o=n.pixelsToGLUnits;return{u_camera_to_center_distance:n.cameraToCenterDistance,u_scale_with_map:+("map"===r.paint.get("circle-pitch-scale")),u_matrix:t.translatePosMatrix(e.posMatrix,i,r.paint.get("circle-translate"),r.paint.get("circle-translate-anchor")),u_pitch_with_map:+a,u_device_pixel_ratio:t.pixelRatio,u_extrude_scale:o}},xe=(t,e,i)=>{const r=Ct(i,1,e.zoom),n=Math.pow(2,e.zoom-i.tileID.overscaledZ),a=i.tileID.overscaleFactor();return{u_matrix:t,u_camera_to_center_distance:e.cameraToCenterDistance,u_pixels_to_tile_units:r,u_extrude_scale:[e.pixelsToGLUnits[0]/(r*n),e.pixelsToGLUnits[1]/(r*n)],u_overscale_factor:a}},ve=(t,e,i=1)=>({u_matrix:t,u_color:e,u_overlay:0,u_overlay_scale:i}),be=t=>({u_matrix:t}),we=(t,e,i,r)=>({u_matrix:t,u_extrude_scale:Ct(e,1,i),u_intensity:r});function Ee(e,i){const r=Math.pow(2,i.canonical.z),n=i.canonical.y;return[new t.MercatorCoordinate(0,n/r).toLngLat().lat,new t.MercatorCoordinate(0,(n+1)/r).toLngLat().lat]}const Te=(t,e,i,r)=>{const n=t.transform;return{u_matrix:Me(t,e,i,r),u_ratio:1/Ct(e,1,n.zoom),u_device_pixel_ratio:t.pixelRatio,u_units_to_pixels:[1/n.pixelsToGLUnits[0],1/n.pixelsToGLUnits[1]]}},Se=(e,i,r,n,a)=>t.extend(Te(e,i,r,a),{u_image:0,u_image_height:n}),Ce=(t,e,i,r,n)=>{const a=t.transform,o=Ae(e,a);return{u_matrix:Me(t,e,i,n),u_texsize:e.imageAtlasTexture.size,u_ratio:1/Ct(e,1,a.zoom),u_device_pixel_ratio:t.pixelRatio,u_image:0,u_scale:[o,r.fromScale,r.toScale],u_fade:r.t,u_units_to_pixels:[1/a.pixelsToGLUnits[0],1/a.pixelsToGLUnits[1]]}},Ie=(e,i,r,n,a,o)=>{const s=e.lineAtlas,l=Ae(i,e.transform),c="round"===r.layout.get("line-cap"),h=s.getDash(n.from,c),u=s.getDash(n.to,c),p=h.width*a.fromScale,d=u.width*a.toScale;return t.extend(Te(e,i,r,o),{u_patternscale_a:[l/p,-h.height/2],u_patternscale_b:[l/d,-u.height/2],u_sdfgamma:s.width/(256*Math.min(p,d)*e.pixelRatio)/2,u_image:0,u_tex_y_a:h.y,u_tex_y_b:u.y,u_mix:a.t})};function Ae(t,e){return 1/Ct(t,1,e.tileZoom)}function Me(t,e,i,r){return t.translatePosMatrix(r?r.posMatrix:e.tileID.posMatrix,e,i.paint.get("line-translate"),i.paint.get("line-translate-anchor"))}const ke=(t,e,i,r,n)=>{return{u_matrix:t,u_tl_parent:e,u_scale_parent:i,u_buffer_scale:1,u_fade_t:r.mix,u_opacity:r.opacity*n.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:n.paint.get("raster-brightness-min"),u_brightness_high:n.paint.get("raster-brightness-max"),u_saturation_factor:(o=n.paint.get("raster-saturation"),o>0?1-1/(1.001-o):-o),u_contrast_factor:(a=n.paint.get("raster-contrast"),a>0?1/(1-a):1+a),u_spin_weights:Pe(n.paint.get("raster-hue-rotate"))};var a,o};function Pe(t){t*=Math.PI/180;const e=Math.sin(t),i=Math.cos(t);return[(2*i+1)/3,(-Math.sqrt(3)*e-i+1)/3,(Math.sqrt(3)*e-i+1)/3]}const ze=(t,e,i,r,n,a,o,s,l,c)=>{const h=n.transform;return{u_is_size_zoom_constant:+("constant"===t||"source"===t),u_is_size_feature_constant:+("constant"===t||"camera"===t),u_size_t:e?e.uSizeT:0,u_size:e?e.uSize:0,u_camera_to_center_distance:h.cameraToCenterDistance,u_pitch:h.pitch/360*2*Math.PI,u_rotate_symbol:+i,u_aspect_ratio:h.width/h.height,u_fade_change:n.options.fadeDuration?n.symbolFadeChange:1,u_matrix:a,u_label_plane_matrix:o,u_coord_matrix:s,u_is_text:+l,u_pitch_with_map:+r,u_texsize:c,u_texture:0}},Le=(e,i,r,n,a,o,s,l,c,h,u)=>{const p=a.transform;return t.extend(ze(e,i,r,n,a,o,s,l,c,h),{u_gamma_scale:n?Math.cos(p._pitch)*p.cameraToCenterDistance:1,u_device_pixel_ratio:a.pixelRatio,u_is_halo:+u})},De=(e,i,r,n,a,o,s,l,c,h)=>t.extend(Le(e,i,r,n,a,o,s,l,!0,c,!0),{u_texsize_icon:h,u_texture_icon:1}),Re=(t,e,i)=>({u_matrix:t,u_opacity:e,u_color:i}),Be=(e,i,r,n,a,o)=>t.extend(function(t,e,i,r){const n=i.imageManager.getPattern(t.from.toString()),a=i.imageManager.getPattern(t.to.toString()),{width:o,height:s}=i.imageManager.getPixelSize(),l=Math.pow(2,r.tileID.overscaledZ),c=r.tileSize*Math.pow(2,i.transform.tileZoom)/l,h=c*(r.tileID.canonical.x+r.tileID.wrap*l),u=c*r.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:n.tl,u_pattern_br_a:n.br,u_pattern_tl_b:a.tl,u_pattern_br_b:a.br,u_texsize:[o,s],u_mix:e.t,u_pattern_size_a:n.displaySize,u_pattern_size_b:a.displaySize,u_scale_a:e.fromScale,u_scale_b:e.toScale,u_tile_units_to_pixels:1/Ct(r,1,i.transform.tileZoom),u_pixel_coord_upper:[h>>16,u>>16],u_pixel_coord_lower:[65535&h,65535&u]}}(n,o,r,a),{u_matrix:e,u_opacity:i}),Fe={fillExtrusion:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_lightpos:new t.Uniform3f(e,i.u_lightpos),u_lightintensity:new t.Uniform1f(e,i.u_lightintensity),u_lightcolor:new t.Uniform3f(e,i.u_lightcolor),u_vertical_gradient:new t.Uniform1f(e,i.u_vertical_gradient),u_opacity:new t.Uniform1f(e,i.u_opacity)}),fillExtrusionPattern:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_lightpos:new t.Uniform3f(e,i.u_lightpos),u_lightintensity:new t.Uniform1f(e,i.u_lightintensity),u_lightcolor:new t.Uniform3f(e,i.u_lightcolor),u_vertical_gradient:new t.Uniform1f(e,i.u_vertical_gradient),u_height_factor:new t.Uniform1f(e,i.u_height_factor),u_image:new t.Uniform1i(e,i.u_image),u_texsize:new t.Uniform2f(e,i.u_texsize),u_pixel_coord_upper:new t.Uniform2f(e,i.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,i.u_pixel_coord_lower),u_scale:new t.Uniform3f(e,i.u_scale),u_fade:new t.Uniform1f(e,i.u_fade),u_opacity:new t.Uniform1f(e,i.u_opacity)}),fill:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix)}),fillPattern:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_image:new t.Uniform1i(e,i.u_image),u_texsize:new t.Uniform2f(e,i.u_texsize),u_pixel_coord_upper:new t.Uniform2f(e,i.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,i.u_pixel_coord_lower),u_scale:new t.Uniform3f(e,i.u_scale),u_fade:new t.Uniform1f(e,i.u_fade)}),fillOutline:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_world:new t.Uniform2f(e,i.u_world)}),fillOutlinePattern:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_world:new t.Uniform2f(e,i.u_world),u_image:new t.Uniform1i(e,i.u_image),u_texsize:new t.Uniform2f(e,i.u_texsize),u_pixel_coord_upper:new t.Uniform2f(e,i.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,i.u_pixel_coord_lower),u_scale:new t.Uniform3f(e,i.u_scale),u_fade:new t.Uniform1f(e,i.u_fade)}),circle:(e,i)=>({u_camera_to_center_distance:new t.Uniform1f(e,i.u_camera_to_center_distance),u_scale_with_map:new t.Uniform1i(e,i.u_scale_with_map),u_pitch_with_map:new t.Uniform1i(e,i.u_pitch_with_map),u_extrude_scale:new t.Uniform2f(e,i.u_extrude_scale),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_matrix:new t.UniformMatrix4f(e,i.u_matrix)}),collisionBox:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_camera_to_center_distance:new t.Uniform1f(e,i.u_camera_to_center_distance),u_pixels_to_tile_units:new t.Uniform1f(e,i.u_pixels_to_tile_units),u_extrude_scale:new t.Uniform2f(e,i.u_extrude_scale),u_overscale_factor:new t.Uniform1f(e,i.u_overscale_factor)}),collisionCircle:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_inv_matrix:new t.UniformMatrix4f(e,i.u_inv_matrix),u_camera_to_center_distance:new t.Uniform1f(e,i.u_camera_to_center_distance),u_viewport_size:new t.Uniform2f(e,i.u_viewport_size)}),debug:(e,i)=>({u_color:new t.UniformColor(e,i.u_color),u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_overlay:new t.Uniform1i(e,i.u_overlay),u_overlay_scale:new t.Uniform1f(e,i.u_overlay_scale)}),clippingMask:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix)}),heatmap:(e,i)=>({u_extrude_scale:new t.Uniform1f(e,i.u_extrude_scale),u_intensity:new t.Uniform1f(e,i.u_intensity),u_matrix:new t.UniformMatrix4f(e,i.u_matrix)}),heatmapTexture:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_world:new t.Uniform2f(e,i.u_world),u_image:new t.Uniform1i(e,i.u_image),u_color_ramp:new t.Uniform1i(e,i.u_color_ramp),u_opacity:new t.Uniform1f(e,i.u_opacity)}),hillshade:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_image:new t.Uniform1i(e,i.u_image),u_latrange:new t.Uniform2f(e,i.u_latrange),u_light:new t.Uniform2f(e,i.u_light),u_shadow:new t.UniformColor(e,i.u_shadow),u_highlight:new t.UniformColor(e,i.u_highlight),u_accent:new t.UniformColor(e,i.u_accent)}),hillshadePrepare:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_image:new t.Uniform1i(e,i.u_image),u_dimension:new t.Uniform2f(e,i.u_dimension),u_zoom:new t.Uniform1f(e,i.u_zoom),u_unpack:new t.Uniform4f(e,i.u_unpack)}),line:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_ratio:new t.Uniform1f(e,i.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_units_to_pixels:new t.Uniform2f(e,i.u_units_to_pixels)}),lineGradient:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_ratio:new t.Uniform1f(e,i.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_units_to_pixels:new t.Uniform2f(e,i.u_units_to_pixels),u_image:new t.Uniform1i(e,i.u_image),u_image_height:new t.Uniform1f(e,i.u_image_height)}),linePattern:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_texsize:new t.Uniform2f(e,i.u_texsize),u_ratio:new t.Uniform1f(e,i.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_image:new t.Uniform1i(e,i.u_image),u_units_to_pixels:new t.Uniform2f(e,i.u_units_to_pixels),u_scale:new t.Uniform3f(e,i.u_scale),u_fade:new t.Uniform1f(e,i.u_fade)}),lineSDF:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_ratio:new t.Uniform1f(e,i.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_units_to_pixels:new t.Uniform2f(e,i.u_units_to_pixels),u_patternscale_a:new t.Uniform2f(e,i.u_patternscale_a),u_patternscale_b:new t.Uniform2f(e,i.u_patternscale_b),u_sdfgamma:new t.Uniform1f(e,i.u_sdfgamma),u_image:new t.Uniform1i(e,i.u_image),u_tex_y_a:new t.Uniform1f(e,i.u_tex_y_a),u_tex_y_b:new t.Uniform1f(e,i.u_tex_y_b),u_mix:new t.Uniform1f(e,i.u_mix)}),raster:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_tl_parent:new t.Uniform2f(e,i.u_tl_parent),u_scale_parent:new t.Uniform1f(e,i.u_scale_parent),u_buffer_scale:new t.Uniform1f(e,i.u_buffer_scale),u_fade_t:new t.Uniform1f(e,i.u_fade_t),u_opacity:new t.Uniform1f(e,i.u_opacity),u_image0:new t.Uniform1i(e,i.u_image0),u_image1:new t.Uniform1i(e,i.u_image1),u_brightness_low:new t.Uniform1f(e,i.u_brightness_low),u_brightness_high:new t.Uniform1f(e,i.u_brightness_high),u_saturation_factor:new t.Uniform1f(e,i.u_saturation_factor),u_contrast_factor:new t.Uniform1f(e,i.u_contrast_factor),u_spin_weights:new t.Uniform3f(e,i.u_spin_weights)}),symbolIcon:(e,i)=>({u_is_size_zoom_constant:new t.Uniform1i(e,i.u_is_size_zoom_constant),u_is_size_feature_constant:new t.Uniform1i(e,i.u_is_size_feature_constant),u_size_t:new t.Uniform1f(e,i.u_size_t),u_size:new t.Uniform1f(e,i.u_size),u_camera_to_center_distance:new t.Uniform1f(e,i.u_camera_to_center_distance),u_pitch:new t.Uniform1f(e,i.u_pitch),u_rotate_symbol:new t.Uniform1i(e,i.u_rotate_symbol),u_aspect_ratio:new t.Uniform1f(e,i.u_aspect_ratio),u_fade_change:new t.Uniform1f(e,i.u_fade_change),u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_label_plane_matrix:new t.UniformMatrix4f(e,i.u_label_plane_matrix),u_coord_matrix:new t.UniformMatrix4f(e,i.u_coord_matrix),u_is_text:new t.Uniform1i(e,i.u_is_text),u_pitch_with_map:new t.Uniform1i(e,i.u_pitch_with_map),u_texsize:new t.Uniform2f(e,i.u_texsize),u_texture:new t.Uniform1i(e,i.u_texture)}),symbolSDF:(e,i)=>({u_is_size_zoom_constant:new t.Uniform1i(e,i.u_is_size_zoom_constant),u_is_size_feature_constant:new t.Uniform1i(e,i.u_is_size_feature_constant),u_size_t:new t.Uniform1f(e,i.u_size_t),u_size:new t.Uniform1f(e,i.u_size),u_camera_to_center_distance:new t.Uniform1f(e,i.u_camera_to_center_distance),u_pitch:new t.Uniform1f(e,i.u_pitch),u_rotate_symbol:new t.Uniform1i(e,i.u_rotate_symbol),u_aspect_ratio:new t.Uniform1f(e,i.u_aspect_ratio),u_fade_change:new t.Uniform1f(e,i.u_fade_change),u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_label_plane_matrix:new t.UniformMatrix4f(e,i.u_label_plane_matrix),u_coord_matrix:new t.UniformMatrix4f(e,i.u_coord_matrix),u_is_text:new t.Uniform1i(e,i.u_is_text),u_pitch_with_map:new t.Uniform1i(e,i.u_pitch_with_map),u_texsize:new t.Uniform2f(e,i.u_texsize),u_texture:new t.Uniform1i(e,i.u_texture),u_gamma_scale:new t.Uniform1f(e,i.u_gamma_scale),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_is_halo:new t.Uniform1i(e,i.u_is_halo)}),symbolTextAndIcon:(e,i)=>({u_is_size_zoom_constant:new t.Uniform1i(e,i.u_is_size_zoom_constant),u_is_size_feature_constant:new t.Uniform1i(e,i.u_is_size_feature_constant),u_size_t:new t.Uniform1f(e,i.u_size_t),u_size:new t.Uniform1f(e,i.u_size),u_camera_to_center_distance:new t.Uniform1f(e,i.u_camera_to_center_distance),u_pitch:new t.Uniform1f(e,i.u_pitch),u_rotate_symbol:new t.Uniform1i(e,i.u_rotate_symbol),u_aspect_ratio:new t.Uniform1f(e,i.u_aspect_ratio),u_fade_change:new t.Uniform1f(e,i.u_fade_change),u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_label_plane_matrix:new t.UniformMatrix4f(e,i.u_label_plane_matrix),u_coord_matrix:new t.UniformMatrix4f(e,i.u_coord_matrix),u_is_text:new t.Uniform1i(e,i.u_is_text),u_pitch_with_map:new t.Uniform1i(e,i.u_pitch_with_map),u_texsize:new t.Uniform2f(e,i.u_texsize),u_texsize_icon:new t.Uniform2f(e,i.u_texsize_icon),u_texture:new t.Uniform1i(e,i.u_texture),u_texture_icon:new t.Uniform1i(e,i.u_texture_icon),u_gamma_scale:new t.Uniform1f(e,i.u_gamma_scale),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_is_halo:new t.Uniform1i(e,i.u_is_halo)}),background:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_opacity:new t.Uniform1f(e,i.u_opacity),u_color:new t.UniformColor(e,i.u_color)}),backgroundPattern:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_opacity:new t.Uniform1f(e,i.u_opacity),u_image:new t.Uniform1i(e,i.u_image),u_pattern_tl_a:new t.Uniform2f(e,i.u_pattern_tl_a),u_pattern_br_a:new t.Uniform2f(e,i.u_pattern_br_a),u_pattern_tl_b:new t.Uniform2f(e,i.u_pattern_tl_b),u_pattern_br_b:new t.Uniform2f(e,i.u_pattern_br_b),u_texsize:new t.Uniform2f(e,i.u_texsize),u_mix:new t.Uniform1f(e,i.u_mix),u_pattern_size_a:new t.Uniform2f(e,i.u_pattern_size_a),u_pattern_size_b:new t.Uniform2f(e,i.u_pattern_size_b),u_scale_a:new t.Uniform1f(e,i.u_scale_a),u_scale_b:new t.Uniform1f(e,i.u_scale_b),u_pixel_coord_upper:new t.Uniform2f(e,i.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,i.u_pixel_coord_lower),u_tile_units_to_pixels:new t.Uniform1f(e,i.u_tile_units_to_pixels)}),terrain:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_texture:new t.Uniform1i(e,i.u_texture),u_ele_delta:new t.Uniform1f(e,i.u_ele_delta)}),terrainDepth:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_ele_delta:new t.Uniform1f(e,i.u_ele_delta)}),terrainCoords:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_texture:new t.Uniform1i(e,i.u_texture),u_terrain_coords_id:new t.Uniform1f(e,i.u_terrain_coords_id),u_ele_delta:new t.Uniform1f(e,i.u_ele_delta)})};class Oe{constructor(t,e,i){this.context=t;const r=t.gl;this.buffer=r.createBuffer(),this.dynamicDraw=Boolean(i),this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),r.bufferData(r.ELEMENT_ARRAY_BUFFER,e.arrayBuffer,this.dynamicDraw?r.DYNAMIC_DRAW:r.STATIC_DRAW),this.dynamicDraw||delete e.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(t){const e=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),e.bufferSubData(e.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const Ue={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class Ve{constructor(t,e,i,r){this.length=e.length,this.attributes=i,this.itemSize=e.bytesPerElement,this.dynamicDraw=r,this.context=t;const n=t.gl;this.buffer=n.createBuffer(),t.bindVertexBuffer.set(this.buffer),n.bufferData(n.ARRAY_BUFFER,e.arrayBuffer,this.dynamicDraw?n.DYNAMIC_DRAW:n.STATIC_DRAW),this.dynamicDraw||delete e.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(t){if(t.length!==this.length)throw new Error(`Length of new data is ${t.length}, which doesn't match current length of ${this.length}`);const e=this.context.gl;this.bind(),e.bufferSubData(e.ARRAY_BUFFER,0,t.arrayBuffer)}enableAttributes(t,e){for(let i=0;i<this.attributes.length;i++){const r=e.attributes[this.attributes[i].name];void 0!==r&&t.enableVertexAttribArray(r)}}setVertexAttribPointers(t,e,i){for(let r=0;r<this.attributes.length;r++){const n=this.attributes[r],a=e.attributes[n.name];void 0!==a&&t.vertexAttribPointer(a,n.components,t[Ue[n.type]],!1,this.itemSize,n.offset+this.itemSize*(i||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const Ne=new WeakMap;function $e(t){if(Ne.has(t))return Ne.get(t);{const e=t.getParameter(t.VERSION).startsWith("WebGL 2.0");return Ne.set(t,e),e}}class je{constructor(t){this.gl=t.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(t){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class qe extends je{getDefault(){return t.Color.transparent}set(t){const e=this.current;(t.r!==e.r||t.g!==e.g||t.b!==e.b||t.a!==e.a||this.dirty)&&(this.gl.clearColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class Ze extends je{getDefault(){return 1}set(t){(t!==this.current||this.dirty)&&(this.gl.clearDepth(t),this.current=t,this.dirty=!1)}}class Ge extends je{getDefault(){return 0}set(t){(t!==this.current||this.dirty)&&(this.gl.clearStencil(t),this.current=t,this.dirty=!1)}}class He extends je{getDefault(){return[!0,!0,!0,!0]}set(t){const e=this.current;(t[0]!==e[0]||t[1]!==e[1]||t[2]!==e[2]||t[3]!==e[3]||this.dirty)&&(this.gl.colorMask(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class Xe extends je{getDefault(){return!0}set(t){(t!==this.current||this.dirty)&&(this.gl.depthMask(t),this.current=t,this.dirty=!1)}}class We extends je{getDefault(){return 255}set(t){(t!==this.current||this.dirty)&&(this.gl.stencilMask(t),this.current=t,this.dirty=!1)}}class Ke extends je{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(t){const e=this.current;(t.func!==e.func||t.ref!==e.ref||t.mask!==e.mask||this.dirty)&&(this.gl.stencilFunc(t.func,t.ref,t.mask),this.current=t,this.dirty=!1)}}class Ye extends je{getDefault(){const t=this.gl;return[t.KEEP,t.KEEP,t.KEEP]}set(t){const e=this.current;(t[0]!==e[0]||t[1]!==e[1]||t[2]!==e[2]||this.dirty)&&(this.gl.stencilOp(t[0],t[1],t[2]),this.current=t,this.dirty=!1)}}class Je extends je{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;t?e.enable(e.STENCIL_TEST):e.disable(e.STENCIL_TEST),this.current=t,this.dirty=!1}}class Qe extends je{getDefault(){return[0,1]}set(t){const e=this.current;(t[0]!==e[0]||t[1]!==e[1]||this.dirty)&&(this.gl.depthRange(t[0],t[1]),this.current=t,this.dirty=!1)}}class ti extends je{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;t?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST),this.current=t,this.dirty=!1}}class ei extends je{getDefault(){return this.gl.LESS}set(t){(t!==this.current||this.dirty)&&(this.gl.depthFunc(t),this.current=t,this.dirty=!1)}}class ii extends je{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;t?e.enable(e.BLEND):e.disable(e.BLEND),this.current=t,this.dirty=!1}}class ri extends je{getDefault(){const t=this.gl;return[t.ONE,t.ZERO]}set(t){const e=this.current;(t[0]!==e[0]||t[1]!==e[1]||this.dirty)&&(this.gl.blendFunc(t[0],t[1]),this.current=t,this.dirty=!1)}}class ni extends je{getDefault(){return t.Color.transparent}set(t){const e=this.current;(t.r!==e.r||t.g!==e.g||t.b!==e.b||t.a!==e.a||this.dirty)&&(this.gl.blendColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class ai extends je{getDefault(){return this.gl.FUNC_ADD}set(t){(t!==this.current||this.dirty)&&(this.gl.blendEquation(t),this.current=t,this.dirty=!1)}}class oi extends je{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;t?e.enable(e.CULL_FACE):e.disable(e.CULL_FACE),this.current=t,this.dirty=!1}}class si extends je{getDefault(){return this.gl.BACK}set(t){(t!==this.current||this.dirty)&&(this.gl.cullFace(t),this.current=t,this.dirty=!1)}}class li extends je{getDefault(){return this.gl.CCW}set(t){(t!==this.current||this.dirty)&&(this.gl.frontFace(t),this.current=t,this.dirty=!1)}}class ci extends je{getDefault(){return null}set(t){(t!==this.current||this.dirty)&&(this.gl.useProgram(t),this.current=t,this.dirty=!1)}}class hi extends je{getDefault(){return this.gl.TEXTURE0}set(t){(t!==this.current||this.dirty)&&(this.gl.activeTexture(t),this.current=t,this.dirty=!1)}}class ui extends je{getDefault(){const t=this.gl;return[0,0,t.drawingBufferWidth,t.drawingBufferHeight]}set(t){const e=this.current;(t[0]!==e[0]||t[1]!==e[1]||t[2]!==e[2]||t[3]!==e[3]||this.dirty)&&(this.gl.viewport(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class pi extends je{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.bindFramebuffer(e.FRAMEBUFFER,t),this.current=t,this.dirty=!1}}class di extends je{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.bindRenderbuffer(e.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class mi extends je{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.bindTexture(e.TEXTURE_2D,t),this.current=t,this.dirty=!1}}class fi extends je{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.bindBuffer(e.ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class gi extends je{getDefault(){return null}set(t){const e=this.gl;e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class _i extends je{getDefault(){return null}set(t){var e;if(t===this.current&&!this.dirty)return;const i=this.gl;$e(i)?i.bindVertexArray(t):null===(e=i.getExtension("OES_vertex_array_object"))||void 0===e||e.bindVertexArrayOES(t),this.current=t,this.dirty=!1}}class yi extends je{getDefault(){return 4}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.pixelStorei(e.UNPACK_ALIGNMENT,t),this.current=t,this.dirty=!1}}class xi extends je{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t),this.current=t,this.dirty=!1}}class vi extends je{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,t),this.current=t,this.dirty=!1}}class bi extends je{constructor(t,e){super(t),this.context=t,this.parent=e}getDefault(){return null}}class wi extends bi{setDirty(){this.dirty=!0}set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const e=this.gl;e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t,0),this.current=t,this.dirty=!1}}class Ei extends bi{set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const e=this.gl;e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class Ti extends bi{set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const e=this.gl;e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class Si{constructor(t,e,i,r,n){this.context=t,this.width=e,this.height=i;const a=t.gl,o=this.framebuffer=a.createFramebuffer();if(this.colorAttachment=new wi(t,o),r)this.depthAttachment=n?new Ti(t,o):new Ei(t,o);else if(n)throw new Error("Stencil cannot be setted without depth");if(a.checkFramebufferStatus(a.FRAMEBUFFER)!==a.FRAMEBUFFER_COMPLETE)throw new Error("Framebuffer is not complete")}destroy(){const t=this.context.gl,e=this.colorAttachment.get();if(e&&t.deleteTexture(e),this.depthAttachment){const e=this.depthAttachment.get();e&&t.deleteRenderbuffer(e)}t.deleteFramebuffer(this.framebuffer)}}class Ci{constructor(t,e,i){this.blendFunction=t,this.blendColor=e,this.mask=i}}Ci.Replace=[1,0],Ci.disabled=new Ci(Ci.Replace,t.Color.transparent,[!1,!1,!1,!1]),Ci.unblended=new Ci(Ci.Replace,t.Color.transparent,[!0,!0,!0,!0]),Ci.alphaBlended=new Ci([1,771],t.Color.transparent,[!0,!0,!0,!0]);class Ii{constructor(t){var e,i;if(this.gl=t,this.clearColor=new qe(this),this.clearDepth=new Ze(this),this.clearStencil=new Ge(this),this.colorMask=new He(this),this.depthMask=new Xe(this),this.stencilMask=new We(this),this.stencilFunc=new Ke(this),this.stencilOp=new Ye(this),this.stencilTest=new Je(this),this.depthRange=new Qe(this),this.depthTest=new ti(this),this.depthFunc=new ei(this),this.blend=new ii(this),this.blendFunc=new ri(this),this.blendColor=new ni(this),this.blendEquation=new ai(this),this.cullFace=new oi(this),this.cullFaceSide=new si(this),this.frontFace=new li(this),this.program=new ci(this),this.activeTexture=new hi(this),this.viewport=new ui(this),this.bindFramebuffer=new pi(this),this.bindRenderbuffer=new di(this),this.bindTexture=new mi(this),this.bindVertexBuffer=new fi(this),this.bindElementBuffer=new gi(this),this.bindVertexArray=new _i(this),this.pixelStoreUnpack=new yi(this),this.pixelStoreUnpackPremultiplyAlpha=new xi(this),this.pixelStoreUnpackFlipY=new vi(this),this.extTextureFilterAnisotropic=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=t.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=t.getParameter(t.MAX_TEXTURE_SIZE),$e(t)){this.HALF_FLOAT=t.HALF_FLOAT;const r=t.getExtension("EXT_color_buffer_half_float");this.RGBA16F=null!==(e=t.RGBA16F)&&void 0!==e?e:null==r?void 0:r.RGBA16F_EXT,this.RGB16F=null!==(i=t.RGB16F)&&void 0!==i?i:null==r?void 0:r.RGB16F_EXT,t.getExtension("EXT_color_buffer_float")}else{t.getExtension("EXT_color_buffer_half_float"),t.getExtension("OES_texture_half_float_linear");const e=t.getExtension("OES_texture_half_float");this.HALF_FLOAT=null==e?void 0:e.HALF_FLOAT_OES}}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.bindVertexArray.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(t,e){return new Oe(this,t,e)}createVertexBuffer(t,e,i){return new Ve(this,t,e,i)}createRenderbuffer(t,e,i){const r=this.gl,n=r.createRenderbuffer();return this.bindRenderbuffer.set(n),r.renderbufferStorage(r.RENDERBUFFER,t,e,i),this.bindRenderbuffer.set(null),n}createFramebuffer(t,e,i,r){return new Si(this,t,e,i,r)}clear({color:t,depth:e,stencil:i}){const r=this.gl;let n=0;t&&(n|=r.COLOR_BUFFER_BIT,this.clearColor.set(t),this.colorMask.set([!0,!0,!0,!0])),void 0!==e&&(n|=r.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(e),this.depthMask.set(!0)),void 0!==i&&(n|=r.STENCIL_BUFFER_BIT,this.clearStencil.set(i),this.stencilMask.set(255)),r.clear(n)}setCullFace(t){!1===t.enable?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(t.mode),this.frontFace.set(t.frontFace))}setDepthMode(t){t.func!==this.gl.ALWAYS||t.mask?(this.depthTest.set(!0),this.depthFunc.set(t.func),this.depthMask.set(t.mask),this.depthRange.set(t.range)):this.depthTest.set(!1)}setStencilMode(t){t.test.func!==this.gl.ALWAYS||t.mask?(this.stencilTest.set(!0),this.stencilMask.set(t.mask),this.stencilOp.set([t.fail,t.depthFail,t.pass]),this.stencilFunc.set({func:t.test.func,ref:t.ref,mask:t.test.mask})):this.stencilTest.set(!1)}setColorMode(e){t.deepEqual(e.blendFunction,Ci.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(e.blendFunction),this.blendColor.set(e.blendColor)),this.colorMask.set(e.mask)}createVertexArray(){var t;return $e(this.gl)?this.gl.createVertexArray():null===(t=this.gl.getExtension("OES_vertex_array_object"))||void 0===t?void 0:t.createVertexArrayOES()}deleteVertexArray(t){var e;return $e(this.gl)?this.gl.deleteVertexArray(t):null===(e=this.gl.getExtension("OES_vertex_array_object"))||void 0===e?void 0:e.deleteVertexArrayOES(t)}unbindVAO(){this.bindVertexArray.set(null)}}class Ai{constructor(t,e,i){this.func=t,this.mask=e,this.range=i}}Ai.ReadOnly=!1,Ai.ReadWrite=!0,Ai.disabled=new Ai(519,Ai.ReadOnly,[0,1]);const Mi=7680;class ki{constructor(t,e,i,r,n,a){this.test=t,this.ref=e,this.mask=i,this.fail=r,this.depthFail=n,this.pass=a}}ki.disabled=new ki({func:519,mask:0},0,0,Mi,Mi,Mi);class Pi{constructor(t,e,i){this.enable=t,this.mode=e,this.frontFace=i}}let zi;function Li(e,i,r,n,a,o,s){const l=e.context,c=l.gl,h=e.useProgram("collisionBox"),u=[];let p=0,d=0;for(let m=0;m<n.length;m++){const f=n[m],g=i.getTile(f),_=g.getBucket(r);if(!_)continue;let y=f.posMatrix;0===a[0]&&0===a[1]||(y=e.translatePosMatrix(f.posMatrix,g,a,o));const x=s?_.textCollisionBox:_.iconCollisionBox,v=_.collisionCircleArray;if(v.length>0){const i=t.create(),r=y;t.mul(i,_.placementInvProjMatrix,e.transform.glCoordMatrix),t.mul(i,i,_.placementViewportMatrix),u.push({circleArray:v,circleOffset:d,transform:r,invTransform:i,coord:f}),p+=v.length/4,d=p}x&&h.draw(l,c.LINES,Ai.disabled,ki.disabled,e.colorModeForRenderPass(),Pi.disabled,xe(y,e.transform,g),e.style.map.terrain&&e.style.map.terrain.getTerrainData(f),r.id,x.layoutVertexBuffer,x.indexBuffer,x.segments,null,e.transform.zoom,null,null,x.collisionVertexBuffer)}if(!s||!u.length)return;const m=e.useProgram("collisionCircle"),f=new t.CollisionCircleLayoutArray;f.resize(4*p),f._trim();let g=0;for(const t of u)for(let e=0;e<t.circleArray.length/4;e++){const i=4*e,r=t.circleArray[i+0],n=t.circleArray[i+1],a=t.circleArray[i+2],o=t.circleArray[i+3];f.emplace(g++,r,n,a,o,0),f.emplace(g++,r,n,a,o,1),f.emplace(g++,r,n,a,o,2),f.emplace(g++,r,n,a,o,3)}(!zi||zi.length<2*p)&&(zi=function(e){const i=2*e,r=new t.QuadTriangleArray;r.resize(i),r._trim();for(let t=0;t<i;t++){const e=6*t;r.uint16[e+0]=4*t+0,r.uint16[e+1]=4*t+1,r.uint16[e+2]=4*t+2,r.uint16[e+3]=4*t+2,r.uint16[e+4]=4*t+3,r.uint16[e+5]=4*t+0}return r}(p));const _=l.createIndexBuffer(zi,!0),y=l.createVertexBuffer(f,t.collisionCircleLayout.members,!0);for(const i of u){const n={u_matrix:i.transform,u_inv_matrix:i.invTransform,u_camera_to_center_distance:(x=e.transform).cameraToCenterDistance,u_viewport_size:[x.width,x.height]};m.draw(l,c.TRIANGLES,Ai.disabled,ki.disabled,e.colorModeForRenderPass(),Pi.disabled,n,e.style.map.terrain&&e.style.map.terrain.getTerrainData(i.coord),r.id,y,_,t.SegmentVector.simpleSegment(0,2*i.circleOffset,i.circleArray.length,i.circleArray.length/2),null,e.transform.zoom,null,null,null)}var x;y.destroy(),_.destroy()}Pi.disabled=new Pi(!1,1029,2305),Pi.backCCW=new Pi(!0,1029,2305);const Di=t.identity(new Float32Array(16));function Ri(e,i,r,n,a,o){const{horizontalAlign:s,verticalAlign:l}=t.getAnchorAlignment(e);return new t.Point((-(s-.5)*i/a+n[0])*o,(-(l-.5)*r/a+n[1])*o)}function Bi(e,i,r,n,a,o,s,l,c,h,u){const p=e.text.placedSymbolArray,d=e.text.dynamicLayoutVertexArray,m=e.icon.dynamicLayoutVertexArray,f={};d.clear();for(let m=0;m<p.length;m++){const g=p.get(m),_=g.hidden||!g.crossTileID||e.allowVerticalPlacement&&!g.placedOrientation?null:n[g.crossTileID];if(_){const n=new t.Point(g.anchorX,g.anchorY),p=ct(n,r?s:o,u),m=ht(a.cameraToCenterDistance,p.signedDistanceFromCamera);let y=t.evaluateSizeForFeature(e.textSizeData,c,g)*m/t.ONE_EM;r&&(y*=e.tilePixelRatio/l);const{width:x,height:v,anchor:b,textOffset:w,textBoxScale:E}=_,T=Ri(b,x,v,w,E,y),S=r?ct(n.add(T),o,u).point:p.point.add(i?T.rotate(-a.angle):T),C=e.allowVerticalPlacement&&g.placedOrientation===t.WritingMode.vertical?Math.PI/2:0;for(let e=0;e<g.numGlyphs;e++)t.addDynamicAttributes(d,S,C);h&&g.associatedIconIndex>=0&&(f[g.associatedIconIndex]={shiftedAnchor:S,angle:C})}else wt(g.numGlyphs,d)}if(h){m.clear();const i=e.icon.placedSymbolArray;for(let e=0;e<i.length;e++){const r=i.get(e);if(r.hidden)wt(r.numGlyphs,m);else{const i=f[e];if(i)for(let e=0;e<r.numGlyphs;e++)t.addDynamicAttributes(m,i.shiftedAnchor,i.angle);else wt(r.numGlyphs,m)}}e.icon.dynamicLayoutVertexBuffer.updateData(m)}e.text.dynamicLayoutVertexBuffer.updateData(d)}function Fi(t,e,i){return i.iconsInText&&e?"symbolTextAndIcon":t?"symbolSDF":"symbolIcon"}function Oi(e,i,r,n,a,o,s,l,c,h,u,p){const d=e.context,m=d.gl,f=e.transform,g="map"===l,_="map"===c,y="viewport"!==l&&"point"!==r.layout.get("symbol-placement"),x=g&&!_&&!y,v=!r.layout.get("symbol-sort-key").isConstant();let b=!1;const w=e.depthModeForSublayer(0,Ai.ReadOnly),E=r._unevaluatedLayout.hasValue("text-variable-anchor")||r._unevaluatedLayout.hasValue("text-variable-anchor-offset"),T=[];for(const l of n){const n=i.getTile(l),c=n.getBucket(r);if(!c)continue;const u=a?c.text:c.icon;if(!u||!u.segments.get().length||!u.hasVisibleVertices)continue;const p=u.programConfigurations.get(r.id),d=a||c.sdfIcons,w=a?c.textSizeData:c.iconSizeData,S=_||0!==f.pitch,C=e.useProgram(Fi(d,a,c),p),I=t.evaluateSizeForZoom(w,f.zoom),A=e.style.map.terrain&&e.style.map.terrain.getTerrainData(l);let M,k,P,z,L=[0,0],D=null;if(a)k=n.glyphAtlasTexture,P=m.LINEAR,M=n.glyphAtlasTexture.size,c.iconsInText&&(L=n.imageAtlasTexture.size,D=n.imageAtlasTexture,z=S||e.options.rotating||e.options.zooming||"composite"===w.kind||"camera"===w.kind?m.LINEAR:m.NEAREST);else{const t=1!==r.layout.get("icon-size").constantOr(0)||c.iconsNeedLinear;k=n.imageAtlasTexture,P=d||e.options.rotating||e.options.zooming||t||S?m.LINEAR:m.NEAREST,M=n.imageAtlasTexture.size}const R=Ct(n,1,e.transform.zoom),B=st(l.posMatrix,_,g,e.transform,R),F=lt(l.posMatrix,_,g,e.transform,R),O=E&&c.hasTextData(),U="none"!==r.layout.get("icon-text-fit")&&O&&c.hasIconData();if(y){const t=e.style.map.terrain?(t,i)=>e.style.map.terrain.getElevation(l,t,i):null,i="map"===r.layout.get("text-rotation-alignment");pt(c,l.posMatrix,e,a,B,F,_,h,i,t)}const V=e.translatePosMatrix(l.posMatrix,n,o,s),N=y||a&&E||U?Di:B,$=e.translatePosMatrix(F,n,o,s,!0),j=d&&0!==r.paint.get(a?"text-halo-width":"icon-halo-width").constantOr(1);let q;q=d?c.iconsInText?De(w.kind,I,x,_,e,V,N,$,M,L):Le(w.kind,I,x,_,e,V,N,$,a,M,!0):ze(w.kind,I,x,_,e,V,N,$,a,M);const Z={program:C,buffers:u,uniformValues:q,atlasTexture:k,atlasTextureIcon:D,atlasInterpolation:P,atlasInterpolationIcon:z,isSDF:d,hasHalo:j};if(v&&c.canOverlap){b=!0;const e=u.segments.get();for(const i of e)T.push({segments:new t.SegmentVector([i]),sortKey:i.sortKey,state:Z,terrainData:A})}else T.push({segments:u.segments,sortKey:0,state:Z,terrainData:A})}b&&T.sort(((t,e)=>t.sortKey-e.sortKey));for(const t of T){const i=t.state;if(d.activeTexture.set(m.TEXTURE0),i.atlasTexture.bind(i.atlasInterpolation,m.CLAMP_TO_EDGE),i.atlasTextureIcon&&(d.activeTexture.set(m.TEXTURE1),i.atlasTextureIcon&&i.atlasTextureIcon.bind(i.atlasInterpolationIcon,m.CLAMP_TO_EDGE)),i.isSDF){const n=i.uniformValues;i.hasHalo&&(n.u_is_halo=1,Ui(i.buffers,t.segments,r,e,i.program,w,u,p,n,t.terrainData)),n.u_is_halo=0}Ui(i.buffers,t.segments,r,e,i.program,w,u,p,i.uniformValues,t.terrainData)}}function Ui(t,e,i,r,n,a,o,s,l,c){const h=r.context;n.draw(h,h.gl.TRIANGLES,a,o,s,Pi.disabled,l,c,i.id,t.layoutVertexBuffer,t.indexBuffer,e,i.paint,r.transform.zoom,t.programConfigurations.get(i.id),t.dynamicLayoutVertexBuffer,t.opacityVertexBuffer)}function Vi(t,e,i,r,n){if(!i||!r||!r.imageAtlas)return;const a=r.imageAtlas.patternPositions;let o=a[i.to.toString()],s=a[i.from.toString()];if(!o||!s){const t=n.getPaintProperty(e);o=a[t],s=a[t]}o&&s&&t.setConstantPatternPositions(o,s)}function Ni(t,e,i,r,n,a,o){const s=t.context.gl,l="fill-pattern",c=i.paint.get(l),h=c&&c.constantOr(1),u=i.getCrossfadeParameters();let p,d,m,f,g;o?(d=h&&!i.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",p=s.LINES):(d=h?"fillPattern":"fill",p=s.TRIANGLES);const _=c.constantOr(null);for(const c of r){const r=e.getTile(c);if(h&&!r.patternsLoaded())continue;const y=r.getBucket(i);if(!y)continue;const x=y.programConfigurations.get(i.id),v=t.useProgram(d,x),b=t.style.map.terrain&&t.style.map.terrain.getTerrainData(c);h&&(t.context.activeTexture.set(s.TEXTURE0),r.imageAtlasTexture.bind(s.LINEAR,s.CLAMP_TO_EDGE),x.updatePaintBuffers(u)),Vi(x,l,_,r,i);const w=b?c:null,E=t.translatePosMatrix(w?w.posMatrix:c.posMatrix,r,i.paint.get("fill-translate"),i.paint.get("fill-translate-anchor"));if(o){f=y.indexBuffer2,g=y.segments2;const e=[s.drawingBufferWidth,s.drawingBufferHeight];m="fillOutlinePattern"===d&&h?_e(E,t,u,r,e):ge(E,e)}else f=y.indexBuffer,g=y.segments,m=h?fe(E,t,u,r):me(E);v.draw(t.context,p,n,t.stencilModeForClipping(c),a,Pi.disabled,m,b,i.id,y.layoutVertexBuffer,f,g,i.paint,t.transform.zoom,x)}}function $i(t,e,i,r,n,a,o){const s=t.context,l=s.gl,c="fill-extrusion-pattern",h=i.paint.get(c),u=h.constantOr(1),p=i.getCrossfadeParameters(),d=i.paint.get("fill-extrusion-opacity"),m=h.constantOr(null);for(const h of r){const r=e.getTile(h),f=r.getBucket(i);if(!f)continue;const g=t.style.map.terrain&&t.style.map.terrain.getTerrainData(h),_=f.programConfigurations.get(i.id),y=t.useProgram(u?"fillExtrusionPattern":"fillExtrusion",_);u&&(t.context.activeTexture.set(l.TEXTURE0),r.imageAtlasTexture.bind(l.LINEAR,l.CLAMP_TO_EDGE),_.updatePaintBuffers(p)),Vi(_,c,m,r,i);const x=t.translatePosMatrix(h.posMatrix,r,i.paint.get("fill-extrusion-translate"),i.paint.get("fill-extrusion-translate-anchor")),v=i.paint.get("fill-extrusion-vertical-gradient"),b=u?de(x,t,v,d,h,p,r):pe(x,t,v,d);y.draw(s,s.gl.TRIANGLES,n,a,o,Pi.backCCW,b,g,i.id,f.layoutVertexBuffer,f.indexBuffer,f.segments,i.paint,t.transform.zoom,_,t.style.map.terrain&&f.centroidVertexBuffer)}}function ji(t,e,i,r,n,a,o){const s=t.context,l=s.gl,c=i.fbo;if(!c)return;const h=t.useProgram("hillshade"),u=t.style.map.terrain&&t.style.map.terrain.getTerrainData(e);s.activeTexture.set(l.TEXTURE0),l.bindTexture(l.TEXTURE_2D,c.colorAttachment.get()),h.draw(s,l.TRIANGLES,n,a,o,Pi.disabled,((t,e,i,r)=>{const n=i.paint.get("hillshade-shadow-color"),a=i.paint.get("hillshade-highlight-color"),o=i.paint.get("hillshade-accent-color");let s=i.paint.get("hillshade-illumination-direction")*(Math.PI/180);"viewport"===i.paint.get("hillshade-illumination-anchor")&&(s-=t.transform.angle);const l=!t.options.moving;return{u_matrix:r?r.posMatrix:t.transform.calculatePosMatrix(e.tileID.toUnwrapped(),l),u_image:0,u_latrange:Ee(0,e.tileID),u_light:[i.paint.get("hillshade-exaggeration"),s],u_shadow:n,u_highlight:a,u_accent:o}})(t,i,r,u?e:null),u,r.id,t.rasterBoundsBuffer,t.quadTriangleIndexBuffer,t.rasterBoundsSegments)}function qi(e,i,r,n,a,o){const s=e.context,l=s.gl,c=i.dem;if(c&&c.data){const h=c.dim,u=c.stride,p=c.getPixels();if(s.activeTexture.set(l.TEXTURE1),s.pixelStoreUnpackPremultiplyAlpha.set(!1),i.demTexture=i.demTexture||e.getTileTexture(u),i.demTexture){const t=i.demTexture;t.update(p,{premultiply:!1}),t.bind(l.NEAREST,l.CLAMP_TO_EDGE)}else i.demTexture=new x(s,p,l.RGBA,{premultiply:!1}),i.demTexture.bind(l.NEAREST,l.CLAMP_TO_EDGE);s.activeTexture.set(l.TEXTURE0);let d=i.fbo;if(!d){const t=new x(s,{width:h,height:h,data:null},l.RGBA);t.bind(l.LINEAR,l.CLAMP_TO_EDGE),d=i.fbo=s.createFramebuffer(h,h,!0,!1),d.colorAttachment.set(t.texture)}s.bindFramebuffer.set(d.framebuffer),s.viewport.set([0,0,h,h]),e.useProgram("hillshadePrepare").draw(s,l.TRIANGLES,n,a,o,Pi.disabled,((e,i)=>{const r=i.stride,n=t.create();return t.ortho(n,0,t.EXTENT,-t.EXTENT,0,0,1),t.translate(n,n,[0,-t.EXTENT,0]),{u_matrix:n,u_image:1,u_dimension:[r,r],u_zoom:e.overscaledZ,u_unpack:i.getUnpackVector()}})(i.tileID,c),null,r.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments),i.needsHillshadePrepare=!1}}function Zi(e,i,r,n,a,o){const s=n.paint.get("raster-fade-duration");if(!o&&s>0){const n=t.browser.now(),o=(n-e.timeAdded)/s,l=i?(n-i.timeAdded)/s:-1,c=r.getSource(),h=a.coveringZoomLevel({tileSize:c.tileSize,roundZoom:c.roundZoom}),u=!i||Math.abs(i.tileID.overscaledZ-h)>Math.abs(e.tileID.overscaledZ-h),p=u&&e.refreshedUponExpiration?1:t.clamp(u?o:1-l,0,1);return e.refreshedUponExpiration&&o>=1&&(e.refreshedUponExpiration=!1),i?{opacity:1,mix:1-p}:{opacity:p,mix:0}}return{opacity:1,mix:0}}const Gi=new t.Color(1,0,0,1),Hi=new t.Color(0,1,0,1),Xi=new t.Color(0,0,1,1),Wi=new t.Color(1,0,1,1),Ki=new t.Color(0,1,1,1);function Yi(t,e,i,r){Qi(t,0,e+i/2,t.transform.width,i,r)}function Ji(t,e,i,r){Qi(t,e-i/2,0,i,t.transform.height,r)}function Qi(t,e,i,r,n,a){const o=t.context,s=o.gl;s.enable(s.SCISSOR_TEST),s.scissor(e*t.pixelRatio,i*t.pixelRatio,r*t.pixelRatio,n*t.pixelRatio),o.clear({color:a}),s.disable(s.SCISSOR_TEST)}function tr(e,i,r){const n=e.context,a=n.gl,o=r.posMatrix,s=e.useProgram("debug"),l=Ai.disabled,c=ki.disabled,h=e.colorModeForRenderPass(),u="$debug",p=e.style.map.terrain&&e.style.map.terrain.getTerrainData(r);n.activeTexture.set(a.TEXTURE0);const d=i.getTileByID(r.key).latestRawTileData,m=Math.floor((d&&d.byteLength||0)/1024),f=i.getTile(r).tileSize,g=512/Math.min(f,512)*(r.overscaledZ/e.transform.zoom)*.5;let _=r.canonical.toString();r.overscaledZ!==r.canonical.z&&(_+=` => ${r.overscaledZ}`),function(t,e){t.initDebugOverlayCanvas();const i=t.debugOverlayCanvas,r=t.context.gl,n=t.debugOverlayCanvas.getContext("2d");n.clearRect(0,0,i.width,i.height),n.shadowColor="white",n.shadowBlur=2,n.lineWidth=1.5,n.strokeStyle="white",n.textBaseline="top",n.font="bold 36px Open Sans, sans-serif",n.fillText(e,5,5),n.strokeText(e,5,5),t.debugOverlayTexture.update(i),t.debugOverlayTexture.bind(r.LINEAR,r.CLAMP_TO_EDGE)}(e,`${_} ${m}kB`),s.draw(n,a.TRIANGLES,l,c,Ci.alphaBlended,Pi.disabled,ve(o,t.Color.transparent,g),null,u,e.debugBuffer,e.quadTriangleIndexBuffer,e.debugSegments),s.draw(n,a.LINE_STRIP,l,c,h,Pi.disabled,ve(o,t.Color.red),p,u,e.debugBuffer,e.tileBorderIndexBuffer,e.debugSegments)}function er(t,e,i){const r=t.context,n=r.gl,a=t.colorModeForRenderPass(),o=new Ai(n.LEQUAL,Ai.ReadWrite,t.depthRangeFor3D),s=t.useProgram("terrain"),l=e.getTerrainMesh();r.bindFramebuffer.set(null),r.viewport.set([0,0,t.width,t.height]);for(const c of i){const i=t.renderToTexture.getTexture(c),h=e.getTerrainData(c.tileID);r.activeTexture.set(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,i.texture);const u={u_matrix:t.transform.calculatePosMatrix(c.tileID.toUnwrapped()),u_texture:0,u_ele_delta:e.getMeshFrameDelta(t.transform.zoom)};s.draw(r,n.TRIANGLES,o,ki.disabled,a,Pi.backCCW,u,h,"terrain",l.vertexBuffer,l.indexBuffer,l.segments)}}class ir{constructor(e,i){this.context=new Ii(e),this.transform=i,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:t.create(),renderTime:0},this.setup(),this.numSublayers=K.maxUnderzooming+K.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Jt}resize(t,e,i){if(this.width=Math.floor(t*i),this.height=Math.floor(e*i),this.pixelRatio=i,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const t of this.style._order)this.style._layers[t].resize()}setup(){const e=this.context,i=new t.PosArray;i.emplaceBack(0,0),i.emplaceBack(t.EXTENT,0),i.emplaceBack(0,t.EXTENT),i.emplaceBack(t.EXTENT,t.EXTENT),this.tileExtentBuffer=e.createVertexBuffer(i,ne.members),this.tileExtentSegments=t.SegmentVector.simpleSegment(0,0,4,2);const r=new t.PosArray;r.emplaceBack(0,0),r.emplaceBack(t.EXTENT,0),r.emplaceBack(0,t.EXTENT),r.emplaceBack(t.EXTENT,t.EXTENT),this.debugBuffer=e.createVertexBuffer(r,ne.members),this.debugSegments=t.SegmentVector.simpleSegment(0,0,4,5);const n=new t.RasterBoundsArray;n.emplaceBack(0,0,0,0),n.emplaceBack(t.EXTENT,0,t.EXTENT,0),n.emplaceBack(0,t.EXTENT,0,t.EXTENT),n.emplaceBack(t.EXTENT,t.EXTENT,t.EXTENT,t.EXTENT),this.rasterBoundsBuffer=e.createVertexBuffer(n,O.members),this.rasterBoundsSegments=t.SegmentVector.simpleSegment(0,0,4,2);const a=new t.PosArray;a.emplaceBack(0,0),a.emplaceBack(1,0),a.emplaceBack(0,1),a.emplaceBack(1,1),this.viewportBuffer=e.createVertexBuffer(a,ne.members),this.viewportSegments=t.SegmentVector.simpleSegment(0,0,4,2);const o=new t.LineStripIndexArray;o.emplaceBack(0),o.emplaceBack(1),o.emplaceBack(3),o.emplaceBack(2),o.emplaceBack(0),this.tileBorderIndexBuffer=e.createIndexBuffer(o);const s=new t.TriangleIndexArray;s.emplaceBack(0,1,2),s.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=e.createIndexBuffer(s);const l=this.context.gl;this.stencilClearMode=new ki({func:l.ALWAYS,mask:0},0,255,l.ZERO,l.ZERO,l.ZERO)}clearStencil(){const e=this.context,i=e.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const r=t.create();t.ortho(r,0,this.width,this.height,0,0,1),t.scale(r,r,[i.drawingBufferWidth,i.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(e,i.TRIANGLES,Ai.disabled,this.stencilClearMode,Ci.disabled,Pi.disabled,be(r),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(t,e){if(this.currentStencilSource===t.source||!t.isTileClipped()||!e||!e.length)return;this.currentStencilSource=t.source;const i=this.context,r=i.gl;this.nextStencilID+e.length>256&&this.clearStencil(),i.setColorMode(Ci.disabled),i.setDepthMode(Ai.disabled);const n=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const t of e){const e=this._tileClippingMaskIDs[t.key]=this.nextStencilID++,a=this.style.map.terrain&&this.style.map.terrain.getTerrainData(t);n.draw(i,r.TRIANGLES,Ai.disabled,new ki({func:r.ALWAYS,mask:0},e,255,r.KEEP,r.KEEP,r.REPLACE),Ci.disabled,Pi.disabled,be(t.posMatrix),a,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const t=this.nextStencilID++,e=this.context.gl;return new ki({func:e.NOTEQUAL,mask:255},t,255,e.KEEP,e.KEEP,e.REPLACE)}stencilModeForClipping(t){const e=this.context.gl;return new ki({func:e.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,e.KEEP,e.KEEP,e.REPLACE)}stencilConfigForOverlap(t){const e=this.context.gl,i=t.sort(((t,e)=>e.overscaledZ-t.overscaledZ)),r=i[i.length-1].overscaledZ,n=i[0].overscaledZ-r+1;if(n>1){this.currentStencilSource=void 0,this.nextStencilID+n>256&&this.clearStencil();const t={};for(let i=0;i<n;i++)t[i+r]=new ki({func:e.GEQUAL,mask:255},i+this.nextStencilID,255,e.KEEP,e.KEEP,e.REPLACE);return this.nextStencilID+=n,[t,i]}return[{[r]:ki.disabled},i]}colorModeForRenderPass(){const e=this.context.gl;if(this._showOverdrawInspector){const i=1/8;return new Ci([e.CONSTANT_COLOR,e.ONE],new t.Color(i,i,i,0),[!0,!0,!0,!0])}return"opaque"===this.renderPass?Ci.unblended:Ci.alphaBlended}depthModeForSublayer(t,e,i){if(!this.opaquePassEnabledForLayer())return Ai.disabled;const r=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new Ai(i||this.context.gl.LEQUAL,e,[r,r])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(e,i){this.style=e,this.options=i,this.lineAtlas=e.lineAtlas,this.imageManager=e.imageManager,this.glyphManager=e.glyphManager,this.symbolFadeChange=e.placement.symbolFadeChange(t.browser.now()),this.imageManager.beginFrame();const r=this.style._order,n=this.style.sourceCaches,a={},o={},s={};for(const t in n){const e=n[t];e.used&&e.prepare(this.context),a[t]=e.getVisibleCoordinates(),o[t]=a[t].slice().reverse(),s[t]=e.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let t=0;t<r.length;t++)if(this.style._layers[r[t]].is3D()){this.opaquePassCutoff=t;break}if(this.renderToTexture){this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0;const e=this.style.map.terrain.sourceCache.tilesAfterTime(this.terrainFacilitator.renderTime);(this.terrainFacilitator.dirty||!t.equals(this.terrainFacilitator.matrix,this.transform.projMatrix)||e.length)&&(t.copy(this.terrainFacilitator.matrix,this.transform.projMatrix),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(e,i){const r=e.context,n=r.gl,a=Ci.unblended,o=new Ai(n.LEQUAL,Ai.ReadWrite,[0,1]),s=i.getTerrainMesh(),l=i.sourceCache.getRenderableTiles(),c=e.useProgram("terrainDepth");r.bindFramebuffer.set(i.getFramebuffer("depth").framebuffer),r.viewport.set([0,0,e.width/devicePixelRatio,e.height/devicePixelRatio]),r.clear({color:t.Color.transparent,depth:1});for(const t of l){const l=i.getTerrainData(t.tileID),h={u_matrix:e.transform.calculatePosMatrix(t.tileID.toUnwrapped()),u_ele_delta:i.getMeshFrameDelta(e.transform.zoom)};c.draw(r,n.TRIANGLES,o,ki.disabled,a,Pi.backCCW,h,l,"terrain",s.vertexBuffer,s.indexBuffer,s.segments)}r.bindFramebuffer.set(null),r.viewport.set([0,0,e.width,e.height])}(this,this.style.map.terrain),function(e,i){const r=e.context,n=r.gl,a=Ci.unblended,o=new Ai(n.LEQUAL,Ai.ReadWrite,[0,1]),s=i.getTerrainMesh(),l=i.getCoordsTexture(),c=i.sourceCache.getRenderableTiles(),h=e.useProgram("terrainCoords");r.bindFramebuffer.set(i.getFramebuffer("coords").framebuffer),r.viewport.set([0,0,e.width/devicePixelRatio,e.height/devicePixelRatio]),r.clear({color:t.Color.transparent,depth:1}),i.coordsIndex=[];for(const t of c){const c=i.getTerrainData(t.tileID);r.activeTexture.set(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,l.texture);const u={u_matrix:e.transform.calculatePosMatrix(t.tileID.toUnwrapped()),u_terrain_coords_id:(255-i.coordsIndex.length)/255,u_texture:0,u_ele_delta:i.getMeshFrameDelta(e.transform.zoom)};h.draw(r,n.TRIANGLES,o,ki.disabled,a,Pi.backCCW,u,c,"terrain",s.vertexBuffer,s.indexBuffer,s.segments),i.coordsIndex.push(t.tileID.key)}r.bindFramebuffer.set(null),r.viewport.set([0,0,e.width,e.height])}(this,this.style.map.terrain))}this.renderPass="offscreen";for(const t of r){const e=this.style._layers[t];if(!e.hasOffscreenPass()||e.isHidden(this.transform.zoom))continue;const i=o[e.source];("custom"===e.type||i.length)&&this.renderLayer(this,n[e.source],e,i)}if(this.context.bindFramebuffer.set(null),this.context.clear({color:i.showOverdrawInspector?t.Color.black:t.Color.transparent,depth:1}),this.clearStencil(),this._showOverdrawInspector=i.showOverdrawInspector,this.depthRangeFor3D=[0,1-(e._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=r.length-1;this.currentLayer>=0;this.currentLayer--){const t=this.style._layers[r[this.currentLayer]],e=n[t.source],i=a[t.source];this._renderTileClippingMasks(t,i),this.renderLayer(this,e,t,i)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<r.length;this.currentLayer++){const t=this.style._layers[r[this.currentLayer]],e=n[t.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(t))continue;const i=("symbol"===t.type?s:o)[t.source];this._renderTileClippingMasks(t,a[t.source]),this.renderLayer(this,e,t,i)}if(this.options.showTileBoundaries){const t=function(t,e){let i=null;const r=Object.values(t._layers).flatMap((i=>i.source&&!i.isHidden(e)?[t.sourceCaches[i.source]]:[])),n=r.filter((t=>"vector"===t.getSource().type)),a=r.filter((t=>"vector"!==t.getSource().type)),o=t=>{(!i||i.getSource().maxzoom<t.getSource().maxzoom)&&(i=t)};return n.forEach((t=>o(t))),i||a.forEach((t=>o(t))),i}(this.style,this.transform.zoom);t&&function(t,e,i){for(let r=0;r<i.length;r++)tr(t,e,i[r])}(this,t,t.getVisibleCoordinates())}this.options.showPadding&&function(t){const e=t.transform.padding;Yi(t,t.transform.height-(e.top||0),3,Gi),Yi(t,e.bottom||0,3,Hi),Ji(t,e.left||0,3,Xi),Ji(t,t.transform.width-(e.right||0),3,Wi);const i=t.transform.centerPoint;!function(t,e,i,r){Qi(t,e-1,i-10,2,20,r),Qi(t,e-10,i-1,20,2,r)}(t,i.x,t.transform.height-i.y,Ki)}(this),this.context.setDefault()}renderLayer(e,i,r,n){if(!r.isHidden(this.transform.zoom)&&("background"===r.type||"custom"===r.type||(n||[]).length))switch(this.id=r.id,r.type){case"symbol":!function(e,i,r,n,a){if("translucent"!==e.renderPass)return;const o=ki.disabled,s=e.colorModeForRenderPass();(r._unevaluatedLayout.hasValue("text-variable-anchor")||r._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(e,i,r,n,a,o,s){const l=i.transform,c="map"===a,h="map"===o;for(const a of e){const e=n.getTile(a),o=e.getBucket(r);if(!o||!o.text||!o.text.segments.get().length)continue;const u=t.evaluateSizeForZoom(o.textSizeData,l.zoom),p=Ct(e,1,i.transform.zoom),d=st(a.posMatrix,h,c,i.transform,p),m="none"!==r.layout.get("icon-text-fit")&&o.hasIconData();if(u){const t=Math.pow(2,l.zoom-e.tileID.overscaledZ);Bi(o,c,h,s,l,d,a.posMatrix,t,u,m,i.style.map.terrain?(t,e)=>i.style.map.terrain.getElevation(a,t,e):null)}}}(n,e,r,i,r.layout.get("text-rotation-alignment"),r.layout.get("text-pitch-alignment"),a),0!==r.paint.get("icon-opacity").constantOr(1)&&Oi(e,i,r,n,!1,r.paint.get("icon-translate"),r.paint.get("icon-translate-anchor"),r.layout.get("icon-rotation-alignment"),r.layout.get("icon-pitch-alignment"),r.layout.get("icon-keep-upright"),o,s),0!==r.paint.get("text-opacity").constantOr(1)&&Oi(e,i,r,n,!0,r.paint.get("text-translate"),r.paint.get("text-translate-anchor"),r.layout.get("text-rotation-alignment"),r.layout.get("text-pitch-alignment"),r.layout.get("text-keep-upright"),o,s),i.map.showCollisionBoxes&&(Li(e,i,r,n,r.paint.get("text-translate"),r.paint.get("text-translate-anchor"),!0),Li(e,i,r,n,r.paint.get("icon-translate"),r.paint.get("icon-translate-anchor"),!1))}(e,i,r,n,this.style.placement.variableOffsets);break;case"circle":!function(e,i,r,n){if("translucent"!==e.renderPass)return;const a=r.paint.get("circle-opacity"),o=r.paint.get("circle-stroke-width"),s=r.paint.get("circle-stroke-opacity"),l=!r.layout.get("circle-sort-key").isConstant();if(0===a.constantOr(1)&&(0===o.constantOr(1)||0===s.constantOr(1)))return;const c=e.context,h=c.gl,u=e.depthModeForSublayer(0,Ai.ReadOnly),p=ki.disabled,d=e.colorModeForRenderPass(),m=[];for(let a=0;a<n.length;a++){const o=n[a],s=i.getTile(o),c=s.getBucket(r);if(!c)continue;const h=c.programConfigurations.get(r.id),u=e.useProgram("circle",h),p=c.layoutVertexBuffer,d=c.indexBuffer,f=e.style.map.terrain&&e.style.map.terrain.getTerrainData(o),g={programConfiguration:h,program:u,layoutVertexBuffer:p,indexBuffer:d,uniformValues:ye(e,o,s,r),terrainData:f};if(l){const e=c.segments.get();for(const i of e)m.push({segments:new t.SegmentVector([i]),sortKey:i.sortKey,state:g})}else m.push({segments:c.segments,sortKey:0,state:g})}l&&m.sort(((t,e)=>t.sortKey-e.sortKey));for(const t of m){const{programConfiguration:i,program:n,layoutVertexBuffer:a,indexBuffer:o,uniformValues:s,terrainData:l}=t.state;n.draw(c,h.TRIANGLES,u,p,d,Pi.disabled,s,l,r.id,a,o,t.segments,r.paint,e.transform.zoom,i)}}(e,i,r,n);break;case"heatmap":!function(e,i,r,n){if(0!==r.paint.get("heatmap-opacity"))if("offscreen"===e.renderPass){const a=e.context,o=a.gl,s=ki.disabled,l=new Ci([o.ONE,o.ONE],t.Color.transparent,[!0,!0,!0,!0]);!function(t,e,i){const r=t.gl;t.activeTexture.set(r.TEXTURE1),t.viewport.set([0,0,e.width/4,e.height/4]);let n=i.heatmapFbo;if(n)r.bindTexture(r.TEXTURE_2D,n.colorAttachment.get()),t.bindFramebuffer.set(n.framebuffer);else{const a=r.createTexture();r.bindTexture(r.TEXTURE_2D,a),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.LINEAR),n=i.heatmapFbo=t.createFramebuffer(e.width/4,e.height/4,!1,!1),function(t,e,i,r){var n,a;const o=t.gl,s=null!==(n=t.HALF_FLOAT)&&void 0!==n?n:o.UNSIGNED_BYTE,l=null!==(a=t.RGBA16F)&&void 0!==a?a:o.RGBA;o.texImage2D(o.TEXTURE_2D,0,l,e.width/4,e.height/4,0,o.RGBA,s,null),r.colorAttachment.set(i)}(t,e,a,n)}}(a,e,r),a.clear({color:t.Color.transparent});for(let t=0;t<n.length;t++){const c=n[t];if(i.hasRenderableParent(c))continue;const h=i.getTile(c),u=h.getBucket(r);if(!u)continue;const p=u.programConfigurations.get(r.id),d=e.useProgram("heatmap",p),{zoom:m}=e.transform;d.draw(a,o.TRIANGLES,Ai.disabled,s,l,Pi.disabled,we(c.posMatrix,h,m,r.paint.get("heatmap-intensity")),null,r.id,u.layoutVertexBuffer,u.indexBuffer,u.segments,r.paint,e.transform.zoom,p)}a.viewport.set([0,0,e.width,e.height])}else"translucent"===e.renderPass&&(e.context.setColorMode(e.colorModeForRenderPass()),function(e,i){const r=e.context,n=r.gl,a=i.heatmapFbo;if(!a)return;r.activeTexture.set(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,a.colorAttachment.get()),r.activeTexture.set(n.TEXTURE1);let o=i.colorRampTexture;o||(o=i.colorRampTexture=new x(r,i.colorRamp,n.RGBA)),o.bind(n.LINEAR,n.CLAMP_TO_EDGE),e.useProgram("heatmapTexture").draw(r,n.TRIANGLES,Ai.disabled,ki.disabled,e.colorModeForRenderPass(),Pi.disabled,((e,i,r,n)=>{const a=t.create();t.ortho(a,0,e.width,e.height,0,0,1);const o=e.context.gl;return{u_matrix:a,u_world:[o.drawingBufferWidth,o.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:i.paint.get("heatmap-opacity")}})(e,i),null,i.id,e.viewportBuffer,e.quadTriangleIndexBuffer,e.viewportSegments,i.paint,e.transform.zoom)}(e,r))}(e,i,r,n);break;case"line":!function(e,i,r,n){if("translucent"!==e.renderPass)return;const a=r.paint.get("line-opacity"),o=r.paint.get("line-width");if(0===a.constantOr(1)||0===o.constantOr(1))return;const s=e.depthModeForSublayer(0,Ai.ReadOnly),l=e.colorModeForRenderPass(),c=r.paint.get("line-dasharray"),h=r.paint.get("line-pattern"),u=h.constantOr(1),p=r.paint.get("line-gradient"),d=r.getCrossfadeParameters(),m=u?"linePattern":c?"lineSDF":p?"lineGradient":"line",f=e.context,g=f.gl;let _=!0;for(const a of n){const n=i.getTile(a);if(u&&!n.patternsLoaded())continue;const o=n.getBucket(r);if(!o)continue;const y=o.programConfigurations.get(r.id),v=e.context.program.get(),b=e.useProgram(m,y),w=_||b.program!==v,E=e.style.map.terrain&&e.style.map.terrain.getTerrainData(a),T=h.constantOr(null);if(T&&n.imageAtlas){const t=n.imageAtlas,e=t.patternPositions[T.to.toString()],i=t.patternPositions[T.from.toString()];e&&i&&y.setConstantPatternPositions(e,i)}const S=E?a:null,C=u?Ce(e,n,r,d,S):c?Ie(e,n,r,c,d,S):p?Se(e,n,r,o.lineClipsArray.length,S):Te(e,n,r,S);if(u)f.activeTexture.set(g.TEXTURE0),n.imageAtlasTexture.bind(g.LINEAR,g.CLAMP_TO_EDGE),y.updatePaintBuffers(d);else if(c&&(w||e.lineAtlas.dirty))f.activeTexture.set(g.TEXTURE0),e.lineAtlas.bind(f);else if(p){const n=o.gradients[r.id];let s=n.texture;if(r.gradientVersion!==n.version){let l=256;if(r.stepInterpolant){const r=i.getSource().maxzoom,n=a.canonical.z===r?Math.ceil(1<<e.transform.maxZoom-a.canonical.z):1;l=t.clamp(t.nextPowerOfTwo(o.maxLineLength/t.EXTENT*1024*n),256,f.maxTextureSize)}n.gradient=t.renderColorRamp({expression:r.gradientExpression(),evaluationKey:"lineProgress",resolution:l,image:n.gradient||void 0,clips:o.lineClipsArray}),n.texture?n.texture.update(n.gradient):n.texture=new x(f,n.gradient,g.RGBA),n.version=r.gradientVersion,s=n.texture}f.activeTexture.set(g.TEXTURE0),s.bind(r.stepInterpolant?g.NEAREST:g.LINEAR,g.CLAMP_TO_EDGE)}b.draw(f,g.TRIANGLES,s,e.stencilModeForClipping(a),l,Pi.disabled,C,E,r.id,o.layoutVertexBuffer,o.indexBuffer,o.segments,r.paint,e.transform.zoom,y,o.layoutVertexBuffer2),_=!1}}(e,i,r,n);break;case"fill":!function(e,i,r,n){const a=r.paint.get("fill-color"),o=r.paint.get("fill-opacity");if(0===o.constantOr(1))return;const s=e.colorModeForRenderPass(),l=r.paint.get("fill-pattern"),c=e.opaquePassEnabledForLayer()&&!l.constantOr(1)&&1===a.constantOr(t.Color.transparent).a&&1===o.constantOr(0)?"opaque":"translucent";if(e.renderPass===c){const t=e.depthModeForSublayer(1,"opaque"===e.renderPass?Ai.ReadWrite:Ai.ReadOnly);Ni(e,i,r,n,t,s,!1)}if("translucent"===e.renderPass&&r.paint.get("fill-antialias")){const t=e.depthModeForSublayer(r.getPaintProperty("fill-outline-color")?2:0,Ai.ReadOnly);Ni(e,i,r,n,t,s,!0)}}(e,i,r,n);break;case"fill-extrusion":!function(t,e,i,r){const n=i.paint.get("fill-extrusion-opacity");if(0!==n&&"translucent"===t.renderPass){const a=new Ai(t.context.gl.LEQUAL,Ai.ReadWrite,t.depthRangeFor3D);if(1!==n||i.paint.get("fill-extrusion-pattern").constantOr(1))$i(t,e,i,r,a,ki.disabled,Ci.disabled),$i(t,e,i,r,a,t.stencilModeFor3D(),t.colorModeForRenderPass());else{const n=t.colorModeForRenderPass();$i(t,e,i,r,a,ki.disabled,n)}}}(e,i,r,n);break;case"hillshade":!function(t,e,i,r){if("offscreen"!==t.renderPass&&"translucent"!==t.renderPass)return;const n=t.context,a=t.depthModeForSublayer(0,Ai.ReadOnly),o=t.colorModeForRenderPass(),[s,l]="translucent"===t.renderPass?t.stencilConfigForOverlap(r):[{},r];for(const r of l){const n=e.getTile(r);void 0!==n.needsHillshadePrepare&&n.needsHillshadePrepare&&"offscreen"===t.renderPass?qi(t,n,i,a,ki.disabled,o):"translucent"===t.renderPass&&ji(t,r,n,i,a,s[r.overscaledZ],o)}n.viewport.set([0,0,t.width,t.height])}(e,i,r,n);break;case"raster":!function(t,e,i,r){if("translucent"!==t.renderPass)return;if(0===i.paint.get("raster-opacity"))return;if(!r.length)return;const n=t.context,a=n.gl,o=e.getSource(),s=t.useProgram("raster"),l=t.colorModeForRenderPass(),[c,h]=o instanceof U?[{},r]:t.stencilConfigForOverlap(r),u=h[h.length-1].overscaledZ,p=!t.options.moving;for(const r of h){const h=t.depthModeForSublayer(r.overscaledZ-u,1===i.paint.get("raster-opacity")?Ai.ReadWrite:Ai.ReadOnly,a.LESS),d=e.getTile(r);d.registerFadeDuration(i.paint.get("raster-fade-duration"));const m=e.findLoadedParent(r,0),f=Zi(d,m,e,i,t.transform,t.style.map.terrain);let g,_;const y="nearest"===i.paint.get("raster-resampling")?a.NEAREST:a.LINEAR;n.activeTexture.set(a.TEXTURE0),d.texture.bind(y,a.CLAMP_TO_EDGE,a.LINEAR_MIPMAP_NEAREST),n.activeTexture.set(a.TEXTURE1),m?(m.texture.bind(y,a.CLAMP_TO_EDGE,a.LINEAR_MIPMAP_NEAREST),g=Math.pow(2,m.tileID.overscaledZ-d.tileID.overscaledZ),_=[d.tileID.canonical.x*g%1,d.tileID.canonical.y*g%1]):d.texture.bind(y,a.CLAMP_TO_EDGE,a.LINEAR_MIPMAP_NEAREST);const x=t.style.map.terrain&&t.style.map.terrain.getTerrainData(r),v=x?r:null,b=v?v.posMatrix:t.transform.calculatePosMatrix(r.toUnwrapped(),p),w=ke(b,_||[0,0],g||1,f,i);o instanceof U?s.draw(n,a.TRIANGLES,h,ki.disabled,l,Pi.disabled,w,x,i.id,o.boundsBuffer,t.quadTriangleIndexBuffer,o.boundsSegments):s.draw(n,a.TRIANGLES,h,c[r.overscaledZ],l,Pi.disabled,w,x,i.id,t.rasterBoundsBuffer,t.quadTriangleIndexBuffer,t.rasterBoundsSegments)}}(e,i,r,n);break;case"background":!function(t,e,i,r){const n=i.paint.get("background-color"),a=i.paint.get("background-opacity");if(0===a)return;const o=t.context,s=o.gl,l=t.transform,c=l.tileSize,h=i.paint.get("background-pattern");if(t.isPatternMissing(h))return;const u=!h&&1===n.a&&1===a&&t.opaquePassEnabledForLayer()?"opaque":"translucent";if(t.renderPass!==u)return;const p=ki.disabled,d=t.depthModeForSublayer(0,"opaque"===u?Ai.ReadWrite:Ai.ReadOnly),m=t.colorModeForRenderPass(),f=t.useProgram(h?"backgroundPattern":"background"),g=r||l.coveringTiles({tileSize:c,terrain:t.style.map.terrain});h&&(o.activeTexture.set(s.TEXTURE0),t.imageManager.bind(t.context));const _=i.getCrossfadeParameters();for(const e of g){const l=r?e.posMatrix:t.transform.calculatePosMatrix(e.toUnwrapped()),u=h?Be(l,a,t,h,{tileID:e,tileSize:c},_):Re(l,a,n),g=t.style.map.terrain&&t.style.map.terrain.getTerrainData(e);f.draw(o,s.TRIANGLES,d,p,m,Pi.disabled,u,g,i.id,t.tileExtentBuffer,t.quadTriangleIndexBuffer,t.tileExtentSegments)}}(e,0,r,n);break;case"custom":!function(t,e,i){const r=t.context,n=i.implementation;if("offscreen"===t.renderPass){const e=n.prerender;e&&(t.setCustomLayerDefaults(),r.setColorMode(t.colorModeForRenderPass()),e.call(n,r.gl,t.transform.customLayerMatrix()),r.setDirty(),t.setBaseState())}else if("translucent"===t.renderPass){t.setCustomLayerDefaults(),r.setColorMode(t.colorModeForRenderPass()),r.setStencilMode(ki.disabled);const e="3d"===n.renderingMode?new Ai(t.context.gl.LEQUAL,Ai.ReadWrite,t.depthRangeFor3D):t.depthModeForSublayer(0,Ai.ReadOnly);r.setDepthMode(e),n.render(r.gl,t.transform.customLayerMatrix()),r.setDirty(),t.setBaseState(),r.bindFramebuffer.set(null)}}(e,0,r)}}translatePosMatrix(e,i,r,n,a){if(!r[0]&&!r[1])return e;const o=a?"map"===n?this.transform.angle:0:"viewport"===n?-this.transform.angle:0;if(o){const t=Math.sin(o),e=Math.cos(o);r=[r[0]*e-r[1]*t,r[0]*t+r[1]*e]}const s=[a?r[0]:Ct(i,r[0],this.transform.zoom),a?r[1]:Ct(i,r[1],this.transform.zoom),0],l=new Float32Array(16);return t.translate(l,e,s),l}saveTileTexture(t){const e=this._tileTextures[t.size[0]];e?e.push(t):this._tileTextures[t.size[0]]=[t]}getTileTexture(t){const e=this._tileTextures[t];return e&&e.length>0?e.pop():null}isPatternMissing(t){if(!t)return!1;if(!t.from||!t.to)return!0;const e=this.imageManager.getPattern(t.from.toString()),i=this.imageManager.getPattern(t.to.toString());return!e||!i}useProgram(t,e){this.cache=this.cache||{};const i=t+(e?e.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[i]||(this.cache[i]=new he(this.context,oe[t],e,Fe[t],this._showOverdrawInspector,this.style.map.terrain)),this.cache[i]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const t=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(t.FUNC_ADD)}initDebugOverlayCanvas(){null==this.debugOverlayCanvas&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new x(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:t,drawingBufferHeight:e}=this.context.gl;return this.width!==t||this.height!==e}}class rr{constructor(t,e){this.points=t,this.planes=e}static fromInvProjectionMatrix(e,i,r){const n=Math.pow(2,r),a=[[-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((r=>{const a=1/(r=t.transformMat4([],r,e))[3]/i*n;return t.mul$1(r,r,[a,a,1/r[3],a])})),o=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map((t=>{const e=function(t,e){var i=e[0],r=e[1],n=e[2],a=i*i+r*r+n*n;return a>0&&(a=1/Math.sqrt(a)),t[0]=e[0]*a,t[1]=e[1]*a,t[2]=e[2]*a,t}([],function(t,e,i){var r=e[0],n=e[1],a=e[2],o=i[0],s=i[1],l=i[2];return t[0]=n*l-a*s,t[1]=a*o-r*l,t[2]=r*s-n*o,t}([],f([],a[t[0]],a[t[1]]),f([],a[t[2]],a[t[1]]))),i=-((r=e)[0]*(n=a[t[1]])[0]+r[1]*n[1]+r[2]*n[2]);var r,n;return e.concat(i)}));return new rr(a,o)}}class nr{constructor(t,e){this.min=t,this.max=e,this.center=function(t,e,i){return t[0]=.5*e[0],t[1]=.5*e[1],t[2]=.5*e[2],t}([],function(t,e,i){return t[0]=e[0]+i[0],t[1]=e[1]+i[1],t[2]=e[2]+i[2],t}([],this.min,this.max))}quadrant(t){const e=[t%2==0,t<2],i=d(this.min),r=d(this.max);for(let t=0;t<e.length;t++)i[t]=e[t]?this.min[t]:this.center[t],r[t]=e[t]?this.center[t]:this.max[t];return r[2]=this.max[2],new nr(i,r)}distanceX(t){return Math.max(Math.min(this.max[0],t[0]),this.min[0])-t[0]}distanceY(t){return Math.max(Math.min(this.max[1],t[1]),this.min[1])-t[1]}intersects(e){const i=[[this.min[0],this.min[1],this.min[2],1],[this.max[0],this.min[1],this.min[2],1],[this.max[0],this.max[1],this.min[2],1],[this.min[0],this.max[1],this.min[2],1],[this.min[0],this.min[1],this.max[2],1],[this.max[0],this.min[1],this.max[2],1],[this.max[0],this.max[1],this.max[2],1],[this.min[0],this.max[1],this.max[2],1]];let r=!0;for(let n=0;n<e.planes.length;n++){const a=e.planes[n];let o=0;for(let e=0;e<i.length;e++)t.dot(a,i[e])>=0&&o++;if(0===o)return 0;o!==i.length&&(r=!1)}if(r)return 2;for(let t=0;t<3;t++){let i=Number.MAX_VALUE,r=-Number.MAX_VALUE;for(let n=0;n<e.points.length;n++){const a=e.points[n][t]-this.min[t];i=Math.min(i,a),r=Math.max(r,a)}if(r<0||i>this.max[t]-this.min[t])return 0}return 1}}class ar{constructor(t=0,e=0,i=0,r=0){if(isNaN(t)||t<0||isNaN(e)||e<0||isNaN(i)||i<0||isNaN(r)||r<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=e,this.left=i,this.right=r}interpolate(e,i,r){return null!=i.top&&null!=e.top&&(this.top=t.interpolate.number(e.top,i.top,r)),null!=i.bottom&&null!=e.bottom&&(this.bottom=t.interpolate.number(e.bottom,i.bottom,r)),null!=i.left&&null!=e.left&&(this.left=t.interpolate.number(e.left,i.left,r)),null!=i.right&&null!=e.right&&(this.right=t.interpolate.number(e.right,i.right,r)),this}getCenter(e,i){const r=t.clamp((this.left+e-this.right)/2,0,e),n=t.clamp((this.top+i-this.bottom)/2,0,i);return new t.Point(r,n)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new ar(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}class or{constructor(e,i,r,n,a){this.tileSize=512,this.maxValidLatitude=85.051129,this._renderWorldCopies=void 0===a||!!a,this._minZoom=e||0,this._maxZoom=i||22,this._minPitch=null==r?0:r,this._maxPitch=null==n?60:n,this.setMaxBounds(),this.width=0,this.height=0,this._center=new t.LngLat(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new ar,this._posMatrixCache={},this._alignedPosMatrixCache={},this._minEleveationForCurrentTile=0}clone(){const t=new or(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return t.apply(this),t}apply(t){this.tileSize=t.tileSize,this.latRange=t.latRange,this.width=t.width,this.height=t.height,this._center=t._center,this._elevation=t._elevation,this._minEleveationForCurrentTile=t._minEleveationForCurrentTile,this.zoom=t.zoom,this.angle=t.angle,this._fov=t._fov,this._pitch=t._pitch,this._unmodified=t._unmodified,this._edgeInsets=t._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))}get maxZoom(){return this._maxZoom}set maxZoom(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))}get minPitch(){return this._minPitch}set minPitch(t){this._minPitch!==t&&(this._minPitch=t,this.pitch=Math.max(this.pitch,t))}get maxPitch(){return this._maxPitch}set maxPitch(t){this._maxPitch!==t&&(this._maxPitch=t,this.pitch=Math.min(this.pitch,t))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(t){void 0===t?t=!0:null===t&&(t=!1),this._renderWorldCopies=t}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new t.Point(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(e){const i=-t.wrap(e,-180,180)*Math.PI/180;this.angle!==i&&(this._unmodified=!1,this.angle=i,this._calcMatrices(),this.rotationMatrix=function(){var e=new t.ARRAY_TYPE(4);return t.ARRAY_TYPE!=Float32Array&&(e[1]=0,e[2]=0),e[0]=1,e[3]=1,e}(),function(t,e,i){var r=e[0],n=e[1],a=e[2],o=e[3],s=Math.sin(i),l=Math.cos(i);t[0]=r*l+a*s,t[1]=n*l+o*s,t[2]=r*-s+a*l,t[3]=n*-s+o*l}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(e){const i=t.clamp(e,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==i&&(this._unmodified=!1,this._pitch=i,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(t){t=Math.max(.01,Math.min(60,t)),this._fov!==t&&(this._unmodified=!1,this._fov=t/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(t){const e=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==e&&(this._unmodified=!1,this._zoom=e,this.tileZoom=Math.max(0,Math.floor(e)),this.scale=this.zoomScale(e),this._constrain(),this._calcMatrices())}get center(){return this._center}set center(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(t){t!==this._elevation&&(this._elevation=t,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(t){this._edgeInsets.equals(t)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,t,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(t){return this._edgeInsets.equals(t)}interpolatePadding(t,e,i){this._unmodified=!1,this._edgeInsets.interpolate(t,e,i),this._constrain(),this._calcMatrices()}coveringZoomLevel(t){const e=(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize));return Math.max(0,e)}getVisibleUnwrappedCoordinates(e){const i=[new t.UnwrappedTileID(0,e)];if(this._renderWorldCopies){const r=this.pointCoordinate(new t.Point(0,0)),n=this.pointCoordinate(new t.Point(this.width,0)),a=this.pointCoordinate(new t.Point(this.width,this.height)),o=this.pointCoordinate(new t.Point(0,this.height)),s=Math.floor(Math.min(r.x,n.x,a.x,o.x)),l=Math.floor(Math.max(r.x,n.x,a.x,o.x)),c=1;for(let r=s-c;r<=l+c;r++)0!==r&&i.push(new t.UnwrappedTileID(r,e))}return i}coveringTiles(e){var i,r;let n=this.coveringZoomLevel(e);const a=n;if(void 0!==e.minzoom&&n<e.minzoom)return[];void 0!==e.maxzoom&&n>e.maxzoom&&(n=e.maxzoom);const o=this.pointCoordinate(this.getCameraPoint()),s=t.MercatorCoordinate.fromLngLat(this.center),l=Math.pow(2,n),c=[l*o.x,l*o.y,0],h=[l*s.x,l*s.y,0],u=rr.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,n);let p=e.minzoom||0;!e.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(p=n);const d=e.terrain?2/Math.min(this.tileSize,e.tileSize)*this.tileSize:3,m=t=>({aabb:new nr([t*l,0,0],[(t+1)*l,l,0]),zoom:0,x:0,y:0,wrap:t,fullyVisible:!1}),f=[],_=[],y=n,x=e.reparseOverscaled?a:n;if(this._renderWorldCopies)for(let t=1;t<=3;t++)f.push(m(-t)),f.push(m(t));for(f.push(m(0));f.length>0;){const n=f.pop(),a=n.x,o=n.y;let s=n.fullyVisible;if(!s){const t=n.aabb.intersects(u);if(0===t)continue;s=2===t}const l=e.terrain?c:h,m=n.aabb.distanceX(l),v=n.aabb.distanceY(l),b=Math.max(Math.abs(m),Math.abs(v));if(n.zoom===y||b>d+(1<<y-n.zoom)-2&&n.zoom>=p){const e=y-n.zoom,i=c[0]-.5-(a<<e),r=c[1]-.5-(o<<e);_.push({tileID:new t.OverscaledTileID(n.zoom===y?x:n.zoom,n.wrap,n.zoom,a,o),distanceSq:g([h[0]-.5-a,h[1]-.5-o]),tileDistanceToCamera:Math.sqrt(i*i+r*r)})}else for(let l=0;l<4;l++){const c=(a<<1)+l%2,h=(o<<1)+(l>>1),u=n.zoom+1;let p=n.aabb.quadrant(l);if(e.terrain){const a=new t.OverscaledTileID(u,n.wrap,u,c,h),o=e.terrain.getMinMaxElevation(a),s=null!==(i=o.minElevation)&&void 0!==i?i:this.elevation,l=null!==(r=o.maxElevation)&&void 0!==r?r:this.elevation;p=new nr([p.min[0],p.min[1],s],[p.max[0],p.max[1],l])}f.push({aabb:p,zoom:u,x:c,y:h,wrap:n.wrap,fullyVisible:s})}}return _.sort(((t,e)=>t.distanceSq-e.distanceSq)).map((t=>t.tileID))}resize(t,e){this.width=t,this.height=e,this.pixelsToGLUnits=[2/t,-2/e],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(t){return Math.pow(2,t)}scaleZoom(t){return Math.log(t)/Math.LN2}project(e){const i=t.clamp(e.lat,-this.maxValidLatitude,this.maxValidLatitude);return new t.Point(t.mercatorXfromLng(e.lng)*this.worldSize,t.mercatorYfromLat(i)*this.worldSize)}unproject(e){return new t.MercatorCoordinate(e.x/this.worldSize,e.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}getCameraPosition(){return{lngLat:this.pointLocation(this.getCameraPoint()),altitude:Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter+this.elevation}}recalculateZoom(e){const i=this.pointLocation(this.centerPoint,e),r=e.getElevationForLngLatZoom(i,this.tileZoom);if(!(this.elevation-r))return;const n=this.getCameraPosition(),a=t.MercatorCoordinate.fromLngLat(n.lngLat,n.altitude),o=t.MercatorCoordinate.fromLngLat(i,r),s=a.x-o.x,l=a.y-o.y,c=a.z-o.z,h=Math.sqrt(s*s+l*l+c*c),u=this.scaleZoom(this.cameraToCenterDistance/h/this.tileSize);this._elevation=r,this._center=i,this.zoom=u}setLocationAtPoint(e,i){const r=this.pointCoordinate(i),n=this.pointCoordinate(this.centerPoint),a=this.locationCoordinate(e),o=new t.MercatorCoordinate(a.x-(r.x-n.x),a.y-(r.y-n.y));this.center=this.coordinateLocation(o),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(t,e){return e?this.coordinatePoint(this.locationCoordinate(t),e.getElevationForLngLatZoom(t,this.tileZoom),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(t))}pointLocation(t,e){return this.coordinateLocation(this.pointCoordinate(t,e))}locationCoordinate(e){return t.MercatorCoordinate.fromLngLat(e)}coordinateLocation(t){return t&&t.toLngLat()}pointCoordinate(e,i){if(i){const t=i.pointCoordinate(e);if(null!=t)return t}const r=[e.x,e.y,0,1],n=[e.x,e.y,1,1];t.transformMat4(r,r,this.pixelMatrixInverse),t.transformMat4(n,n,this.pixelMatrixInverse);const a=r[3],o=n[3],s=r[1]/a,l=n[1]/o,c=r[2]/a,h=n[2]/o,u=c===h?0:(0-c)/(h-c);return new t.MercatorCoordinate(t.interpolate.number(r[0]/a,n[0]/o,u)/this.worldSize,t.interpolate.number(s,l,u)/this.worldSize)}coordinatePoint(e,i=0,r=this.pixelMatrix){const n=[e.x*this.worldSize,e.y*this.worldSize,i,1];return t.transformMat4(n,n,r),new t.Point(n[0]/n[3],n[1]/n[3])}getBounds(){const e=Math.max(0,this.height/2-this.getHorizon());return(new z).extend(this.pointLocation(new t.Point(0,e))).extend(this.pointLocation(new t.Point(this.width,e))).extend(this.pointLocation(new t.Point(this.width,this.height))).extend(this.pointLocation(new t.Point(0,this.height)))}getMaxBounds(){return this.latRange&&2===this.latRange.length&&this.lngRange&&2===this.lngRange.length?new z([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null}getHorizon(){return Math.tan(Math.PI/2-this._pitch)*this.cameraToCenterDistance*.85}setMaxBounds(t){t?(this.lngRange=[t.getWest(),t.getEast()],this.latRange=[t.getSouth(),t.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-this.maxValidLatitude,this.maxValidLatitude])}calculatePosMatrix(e,i=!1){const r=e.key,n=i?this._alignedPosMatrixCache:this._posMatrixCache;if(n[r])return n[r];const a=e.canonical,o=this.worldSize/this.zoomScale(a.z),s=a.x+Math.pow(2,a.z)*e.wrap,l=t.identity(new Float64Array(16));return t.translate(l,l,[s*o,a.y*o,0]),t.scale(l,l,[o/t.EXTENT,o/t.EXTENT,1]),t.multiply(l,i?this.alignedProjMatrix:this.projMatrix,l),n[r]=new Float32Array(l),n[r]}customLayerMatrix(){return this.mercatorMatrix.slice()}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;let e,i,r,n,a=-90,o=90,s=-180,l=180;const c=this.size,h=this._unmodified;if(this.latRange){const i=this.latRange;a=t.mercatorYfromLat(i[1])*this.worldSize,o=t.mercatorYfromLat(i[0])*this.worldSize,e=o-a<c.y?c.y/(o-a):0}if(this.lngRange){const e=this.lngRange;s=t.wrap(t.mercatorXfromLng(e[0])*this.worldSize,0,this.worldSize),l=t.wrap(t.mercatorXfromLng(e[1])*this.worldSize,0,this.worldSize),l<s&&(l+=this.worldSize),i=l-s<c.x?c.x/(l-s):0}const u=this.point,p=Math.max(i||0,e||0);if(p)return this.center=this.unproject(new t.Point(i?(l+s)/2:u.x,e?(o+a)/2:u.y)),this.zoom+=this.scaleZoom(p),this._unmodified=h,void(this._constraining=!1);if(this.latRange){const t=u.y,e=c.y/2;t-e<a&&(n=a+e),t+e>o&&(n=o-e)}if(this.lngRange){const e=(s+l)/2,i=t.wrap(u.x,e-this.worldSize/2,e+this.worldSize/2),n=c.x/2;i-n<s&&(r=s+n),i+n>l&&(r=l-n)}void 0===r&&void 0===n||(this.center=this.unproject(new t.Point(void 0!==r?r:u.x,void 0!==n?n:u.y)).wrap()),this._unmodified=h,this._constraining=!1}_calcMatrices(){if(!this.height)return;const e=this.centerOffset,i=this.point.x,r=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=t.mercatorZfromAltitude(1,this.center.lat)*this.worldSize;let n=t.identity(new Float64Array(16));t.scale(n,n,[this.width/2,-this.height/2,1]),t.translate(n,n,[1,-1,0]),this.labelPlaneMatrix=n,n=t.identity(new Float64Array(16)),t.scale(n,n,[1,-1,1]),t.translate(n,n,[-1,-1,0]),t.scale(n,n,[2/this.width,2/this.height,1]),this.glCoordMatrix=n;const a=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch),o=Math.min(this.elevation,this._minEleveationForCurrentTile),s=a-o*this._pixelPerMeter/Math.cos(this._pitch),l=o<0?s:a,c=Math.PI/2+this._pitch,h=this._fov*(.5+e.y/this.height),u=Math.sin(h)*l/Math.sin(t.clamp(Math.PI-c-h,.01,Math.PI-.01)),p=this.getHorizon(),d=2*Math.atan(p/this.cameraToCenterDistance)*(.5+e.y/(2*p)),m=Math.sin(d)*l/Math.sin(t.clamp(Math.PI-c-d,.01,Math.PI-.01)),f=Math.min(u,m),g=1.01*(Math.cos(Math.PI/2-this._pitch)*f+l),_=this.height/50;n=new Float64Array(16),t.perspective(n,this._fov,this.width/this.height,_,g),n[8]=2*-e.x/this.width,n[9]=2*e.y/this.height,t.scale(n,n,[1,-1,1]),t.translate(n,n,[0,0,-this.cameraToCenterDistance]),t.rotateX(n,n,this._pitch),t.rotateZ(n,n,this.angle),t.translate(n,n,[-i,-r,0]),this.mercatorMatrix=t.scale([],n,[this.worldSize,this.worldSize,this.worldSize]),t.scale(n,n,[1,1,this._pixelPerMeter]),this.pixelMatrix=t.multiply(new Float64Array(16),this.labelPlaneMatrix,n),t.translate(n,n,[0,0,-this.elevation]),this.projMatrix=n,this.invProjMatrix=t.invert([],n),this.pixelMatrix3D=t.multiply(new Float64Array(16),this.labelPlaneMatrix,n);const y=this.width%2/2,x=this.height%2/2,v=Math.cos(this.angle),b=Math.sin(this.angle),w=i-Math.round(i)+v*y+b*x,E=r-Math.round(r)+v*x+b*y,T=new Float64Array(n);if(t.translate(T,T,[w>.5?w-1:w,E>.5?E-1:E,0]),this.alignedProjMatrix=T,n=t.invert(new Float64Array(16),this.pixelMatrix),!n)throw new Error("failed to invert matrix");this.pixelMatrixInverse=n,this._posMatrixCache={},this._alignedPosMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const e=this.pointCoordinate(new t.Point(0,0)),i=[e.x*this.worldSize,e.y*this.worldSize,0,1];return t.transformMat4(i,i,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const e=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new t.Point(0,e))}getCameraQueryGeometry(e){const i=this.getCameraPoint();if(1===e.length)return[e[0],i];{let r=i.x,n=i.y,a=i.x,o=i.y;for(const t of e)r=Math.min(r,t.x),n=Math.min(n,t.y),a=Math.max(a,t.x),o=Math.max(o,t.y);return[new t.Point(r,n),new t.Point(a,n),new t.Point(a,o),new t.Point(r,o),new t.Point(r,n)]}}}function sr(t,e){let i,r=!1,n=null,a=null;const o=()=>{n=null,r&&(t.apply(a,i),n=setTimeout(o,e),r=!1)};return(...t)=>(r=!0,a=this,i=t,n||o(),n)}class lr{constructor(t){this._getCurrentHash=()=>{const t=window.location.hash.replace("#","");if(this._hashName){let e;return t.split("&").map((t=>t.split("="))).forEach((t=>{t[0]===this._hashName&&(e=t)})),(e&&e[1]||"").split("/")}return t.split("/")},this._onHashChange=()=>{const t=this._getCurrentHash();if(t.length>=3&&!t.some((t=>isNaN(t)))){const e=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(t[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:e,pitch:+(t[4]||0)}),!0}return!1},this._updateHashUnthrottled=()=>{const t=window.location.href.replace(/(#.+)?$/,this.getHashString());try{window.history.replaceState(window.history.state,null,t)}catch(t){}},this._updateHash=sr(this._updateHashUnthrottled,300),this._hashName=t&&encodeURIComponent(t)}addTo(t){return this._map=t,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),delete this._map,this}getHashString(t){const e=this._map.getCenter(),i=Math.round(100*this._map.getZoom())/100,r=Math.ceil((i*Math.LN2+Math.log(512/360/.5))/Math.LN10),n=Math.pow(10,r),a=Math.round(e.lng*n)/n,o=Math.round(e.lat*n)/n,s=this._map.getBearing(),l=this._map.getPitch();let c="";if(c+=t?`/${a}/${o}/${i}`:`${i}/${o}/${a}`,(s||l)&&(c+="/"+Math.round(10*s)/10),l&&(c+=`/${Math.round(l)}`),this._hashName){const t=this._hashName;let e=!1;const i=window.location.hash.slice(1).split("&").map((i=>{const r=i.split("=")[0];return r===t?(e=!0,`${r}=${c}`):i})).filter((t=>t));return e||i.push(`${t}=${c}`),`#${i.join("&")}`}return`#${c}`}}const cr={linearity:.3,easing:t.bezier(0,0,.3,1)},hr=t.extend({deceleration:2500,maxSpeed:1400},cr),ur=t.extend({deceleration:20,maxSpeed:1400},cr),pr=t.extend({deceleration:1e3,maxSpeed:360},cr),dr=t.extend({deceleration:1e3,maxSpeed:90},cr);class mr{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:t.browser.now(),settings:e})}_drainInertiaBuffer(){const e=this._inertiaBuffer,i=t.browser.now();for(;e.length>0&&i-e[0].time>160;)e.shift()}_onMoveEnd(e){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const i={zoom:0,bearing:0,pitch:0,pan:new t.Point(0,0),pinchAround:void 0,around:void 0};for(const{settings:t}of this._inertiaBuffer)i.zoom+=t.zoomDelta||0,i.bearing+=t.bearingDelta||0,i.pitch+=t.pitchDelta||0,t.panDelta&&i.pan._add(t.panDelta),t.around&&(i.around=t.around),t.pinchAround&&(i.pinchAround=t.pinchAround);const r=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,n={};if(i.pan.mag()){const a=gr(i.pan.mag(),r,t.extend({},hr,e||{}));n.offset=i.pan.mult(a.amount/i.pan.mag()),n.center=this._map.transform.center,fr(n,a)}if(i.zoom){const t=gr(i.zoom,r,ur);n.zoom=this._map.transform.zoom+t.amount,fr(n,t)}if(i.bearing){const e=gr(i.bearing,r,pr);n.bearing=this._map.transform.bearing+t.clamp(e.amount,-179,179),fr(n,e)}if(i.pitch){const t=gr(i.pitch,r,dr);n.pitch=this._map.transform.pitch+t.amount,fr(n,t)}if(n.zoom||n.bearing){const t=void 0===i.pinchAround?i.around:i.pinchAround;n.around=t?this._map.unproject(t):this._map.getCenter()}return this.clear(),t.extend(n,{noMoveStart:!0})}}function fr(t,e){(!t.duration||t.duration<e.duration)&&(t.duration=e.duration,t.easing=e.easing)}function gr(e,i,r){const{maxSpeed:n,linearity:a,deceleration:o}=r,s=t.clamp(e*a/(i/1e3),-n,n),l=Math.abs(s)/(o*a);return{easing:r.easing,duration:1e3*l,amount:s*(l/2)}}class _r extends t.Event{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,r,n,a={}){const o=i.mousePos(r.getCanvasContainer(),n),s=r.unproject(o);super(e,t.extend({point:o,lngLat:s,originalEvent:n},a)),this._defaultPrevented=!1,this.target=r}}class yr extends t.Event{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,r,n){const a="touchend"===e?n.changedTouches:n.touches,o=i.touchPos(r.getCanvasContainer(),a),s=o.map((t=>r.unproject(t))),l=o.reduce(((t,e,i,r)=>t.add(e.div(r.length))),new t.Point(0,0));super(e,{points:o,point:l,lngLats:s,lngLat:r.unproject(l),originalEvent:n}),this._defaultPrevented=!1}}class xr extends t.Event{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,e,i){super(t,{originalEvent:i}),this._defaultPrevented=!1}}class vr{constructor(t,e){this._map=t,this._clickTolerance=e.clickTolerance}reset(){delete this._mousedownPos}wheel(t){return this._firePreventable(new xr(t.type,this._map,t))}mousedown(t,e){return this._mousedownPos=e,this._firePreventable(new _r(t.type,this._map,t))}mouseup(t){this._map.fire(new _r(t.type,this._map,t))}click(t,e){this._mousedownPos&&this._mousedownPos.dist(e)>=this._clickTolerance||this._map.fire(new _r(t.type,this._map,t))}dblclick(t){return this._firePreventable(new _r(t.type,this._map,t))}mouseover(t){this._map.fire(new _r(t.type,this._map,t))}mouseout(t){this._map.fire(new _r(t.type,this._map,t))}touchstart(t){return this._firePreventable(new yr(t.type,this._map,t))}touchmove(t){this._map.fire(new yr(t.type,this._map,t))}touchend(t){this._map.fire(new yr(t.type,this._map,t))}touchcancel(t){this._map.fire(new yr(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class br{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(t){this._map.fire(new _r(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new _r("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._ignoreContextMenu||this._map.fire(new _r(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class wr{constructor(t){this._map=t}get transform(){return this._map._requestedCameraState||this._map.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(e){return this.transform.pointLocation(t.Point.convert(e),this._map.terrain)}}class Er{constructor(t,e){this._map=t,this._tr=new wr(t),this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=e.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(t,e){this.isEnabled()&&t.shiftKey&&0===t.button&&(i.disableDrag(),this._startPos=this._lastPos=e,this._active=!0)}mousemoveWindow(t,e){if(!this._active)return;const r=e;if(this._lastPos.equals(r)||!this._box&&r.dist(this._startPos)<this._clickTolerance)return;const n=this._startPos;this._lastPos=r,this._box||(this._box=i.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",t));const a=Math.min(n.x,r.x),o=Math.max(n.x,r.x),s=Math.min(n.y,r.y),l=Math.max(n.y,r.y);i.setTransform(this._box,`translate(${a}px,${s}px)`),this._box.style.width=o-a+"px",this._box.style.height=l-s+"px"}mouseupWindow(e,r){if(!this._active)return;if(0!==e.button)return;const n=this._startPos,a=r;if(this.reset(),i.suppressClick(),n.x!==a.x||n.y!==a.y)return this._map.fire(new t.Event("boxzoomend",{originalEvent:e})),{cameraAnimation:t=>t.fitScreenCoordinates(n,a,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",e)}keydown(t){this._active&&27===t.keyCode&&(this.reset(),this._fireEvent("boxzoomcancel",t))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(i.remove(this._box),this._box=null),i.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(e,i){return this._map.fire(new t.Event(e,{originalEvent:i}))}}function Tr(t,e){if(t.length!==e.length)throw new Error(`The number of touches and points are not equal - touches ${t.length}, points ${e.length}`);const i={};for(let r=0;r<t.length;r++)i[t[r].identifier]=e[r];return i}class Sr{constructor(t){this.reset(),this.numTouches=t.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(e,i,r){(this.centroid||r.length>this.numTouches)&&(this.aborted=!0),this.aborted||(void 0===this.startTime&&(this.startTime=e.timeStamp),r.length===this.numTouches&&(this.centroid=function(e){const i=new t.Point(0,0);for(const t of e)i._add(t);return i.div(e.length)}(i),this.touches=Tr(r,i)))}touchmove(t,e,i){if(this.aborted||!this.centroid)return;const r=Tr(i,e);for(const t in this.touches){const e=r[t];(!e||e.dist(this.touches[t])>30)&&(this.aborted=!0)}}touchend(t,e,i){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),0===i.length){const t=!this.aborted&&this.centroid;if(this.reset(),t)return t}}}class Cr{constructor(t){this.singleTap=new Sr(t),this.numTaps=t.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(t,e,i){this.singleTap.touchstart(t,e,i)}touchmove(t,e,i){this.singleTap.touchmove(t,e,i)}touchend(t,e,i){const r=this.singleTap.touchend(t,e,i);if(r){const e=t.timeStamp-this.lastTime<500,i=!this.lastTap||this.lastTap.dist(r)<30;if(e&&i||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=r,this.count===this.numTaps)return this.reset(),r}}}class Ir{constructor(t){this._tr=new wr(t),this._zoomIn=new Cr({numTouches:1,numTaps:2}),this._zoomOut=new Cr({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(t,e,i){this._zoomIn.touchstart(t,e,i),this._zoomOut.touchstart(t,e,i)}touchmove(t,e,i){this._zoomIn.touchmove(t,e,i),this._zoomOut.touchmove(t,e,i)}touchend(t,e,i){const r=this._zoomIn.touchend(t,e,i),n=this._zoomOut.touchend(t,e,i),a=this._tr;return r?(this._active=!0,t.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:e=>e.easeTo({duration:300,zoom:a.zoom+1,around:a.unproject(r)},{originalEvent:t})}):n?(this._active=!0,t.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:e=>e.easeTo({duration:300,zoom:a.zoom-1,around:a.unproject(n)},{originalEvent:t})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Ar{constructor(t){this._enabled=!!t.enable,this._moveStateManager=t.moveStateManager,this._clickTolerance=t.clickTolerance||1,this._moveFunction=t.move,this._activateOnStart=!!t.activateOnStart,t.assignEvents(this),this.reset()}reset(t){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(t)}_move(...t){const e=this._moveFunction(...t);if(e.bearingDelta||e.pitchDelta||e.around||e.panDelta)return this._active=!0,e}dragStart(t,e){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(t)&&(this._moveStateManager.startMove(t),this._lastPoint=e.length?e[0]:e,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(t,e){if(!this.isEnabled())return;const i=this._lastPoint;if(!i)return;if(t.preventDefault(),!this._moveStateManager.isValidMoveEvent(t))return void this.reset(t);const r=e.length?e[0]:e;return!this._moved&&r.dist(i)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=r,this._move(i,r))}dragEnd(t){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(t)&&(this._moved&&i.suppressClick(),this.reset(t))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}}const Mr={0:1,2:2};class kr{constructor(t){this._correctEvent=t.checkCorrectEvent}startMove(t){const e=i.mouseButton(t);this._eventButton=e}endMove(t){delete this._eventButton}isValidStartEvent(t){return this._correctEvent(t)}isValidMoveEvent(t){return!function(t,e){const i=Mr[e];return void 0===t.buttons||(t.buttons&i)!==i}(t,this._eventButton)}isValidEndEvent(t){return i.mouseButton(t)===this._eventButton}}class Pr{constructor(){this._firstTouch=void 0}_isOneFingerTouch(t){return 1===t.targetTouches.length}_isSameTouchEvent(t){return t.targetTouches[0].identifier===this._firstTouch}startMove(t){this._firstTouch=t.targetTouches[0].identifier}endMove(t){delete this._firstTouch}isValidStartEvent(t){return this._isOneFingerTouch(t)}isValidMoveEvent(t){return this._isOneFingerTouch(t)&&this._isSameTouchEvent(t)}isValidEndEvent(t){return this._isOneFingerTouch(t)&&this._isSameTouchEvent(t)}}const zr=t=>{t.mousedown=t.dragStart,t.mousemoveWindow=t.dragMove,t.mouseup=t.dragEnd,t.contextmenu=function(t){t.preventDefault()}},Lr=({enable:t,clickTolerance:e,bearingDegreesPerPixelMoved:r=.8})=>{const n=new kr({checkCorrectEvent:t=>0===i.mouseButton(t)&&t.ctrlKey||2===i.mouseButton(t)});return new Ar({clickTolerance:e,move:(t,e)=>({bearingDelta:(e.x-t.x)*r}),moveStateManager:n,enable:t,assignEvents:zr})},Dr=({enable:t,clickTolerance:e,pitchDegreesPerPixelMoved:r=-.5})=>{const n=new kr({checkCorrectEvent:t=>0===i.mouseButton(t)&&t.ctrlKey||2===i.mouseButton(t)});return new Ar({clickTolerance:e,move:(t,e)=>({pitchDelta:(e.y-t.y)*r}),moveStateManager:n,enable:t,assignEvents:zr})};class Rr{constructor(t,e){this._minTouches=t.cooperativeGestures?2:1,this._clickTolerance=t.clickTolerance||1,this._map=e,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new t.Point(0,0),setTimeout((()=>{this._cancelCooperativeMessage=!1}),200)}touchstart(t,e,i){return this._calculateTransform(t,e,i)}touchmove(t,e,i){if(this._map._cooperativeGestures&&(2===this._minTouches&&i.length<2&&!this._cancelCooperativeMessage?this._map._onCooperativeGesture(t,!1,i.length):this._cancelCooperativeMessage||(this._cancelCooperativeMessage=!0)),this._active&&!(i.length<this._minTouches))return t.preventDefault(),this._calculateTransform(t,e,i)}touchend(t,e,i){this._calculateTransform(t,e,i),this._active&&i.length<this._minTouches&&this.reset()}touchcancel(){this.reset()}_calculateTransform(e,i,r){r.length>0&&(this._active=!0);const n=Tr(r,i),a=new t.Point(0,0),o=new t.Point(0,0);let s=0;for(const t in n){const e=n[t],i=this._touches[t];i&&(a._add(e),o._add(e.sub(i)),s++,n[t]=e)}if(this._touches=n,s<this._minTouches||!o.mag())return;const l=o.div(s);return this._sum._add(l),this._sum.mag()<this._clickTolerance?void 0:{around:a.div(s),panDelta:l}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Br{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(t,e,i){this._firstTwoTouches||i.length<2||(this._firstTwoTouches=[i[0].identifier,i[1].identifier],this._start([e[0],e[1]]))}touchmove(t,e,i){if(!this._firstTwoTouches)return;t.preventDefault();const[r,n]=this._firstTwoTouches,a=Fr(i,e,r),o=Fr(i,e,n);if(!a||!o)return;const s=this._aroundCenter?null:a.add(o).div(2);return this._move([a,o],s,t)}touchend(t,e,r){if(!this._firstTwoTouches)return;const[n,a]=this._firstTwoTouches,o=Fr(r,e,n),s=Fr(r,e,a);o&&s||(this._active&&i.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(t){this._enabled=!0,this._aroundCenter=!!t&&"center"===t.around}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}function Fr(t,e,i){for(let r=0;r<t.length;r++)if(t[r].identifier===i)return e[r]}function Or(t,e){return Math.log(t/e)/Math.LN2}class Ur extends Br{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(t){this._startDistance=this._distance=t[0].dist(t[1])}_move(t,e){const i=this._distance;if(this._distance=t[0].dist(t[1]),this._active||!(Math.abs(Or(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:Or(this._distance,i),pinchAround:e}}}function Vr(t,e){return 180*t.angleWith(e)/Math.PI}class Nr extends Br{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(t){this._startVector=this._vector=t[0].sub(t[1]),this._minDiameter=t[0].dist(t[1])}_move(t,e){const i=this._vector;if(this._vector=t[0].sub(t[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:Vr(this._vector,i),pinchAround:e}}_isBelowThreshold(t){this._minDiameter=Math.min(this._minDiameter,t.mag());const e=25/(Math.PI*this._minDiameter)*360,i=Vr(t,this._startVector);return Math.abs(i)<e}}function $r(t){return Math.abs(t.y)>Math.abs(t.x)}class jr extends Br{constructor(t){super(),this._map=t}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(t,e,i){super.touchstart(t,e,i),this._currentTouchCount=i.length}_start(t){this._lastPoints=t,$r(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,e,i){if(this._map._cooperativeGestures&&this._currentTouchCount<3)return;const r=t[0].sub(this._lastPoints[0]),n=t[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(r,n,i.timeStamp),this._valid?(this._lastPoints=t,this._active=!0,{pitchDelta:(r.y+n.y)/2*-.5}):void 0}gestureBeginsVertically(t,e,i){if(void 0!==this._valid)return this._valid;const r=t.mag()>=2,n=e.mag()>=2;if(!r&&!n)return;if(!r||!n)return void 0===this._firstMove&&(this._firstMove=i),i-this._firstMove<100&&void 0;const a=t.y>0==e.y>0;return $r(t)&&$r(e)&&a}}const qr={panStep:100,bearingStep:15,pitchStep:10};class Zr{constructor(t){this._tr=new wr(t);const e=qr;this._panStep=e.panStep,this._bearingStep=e.bearingStep,this._pitchStep=e.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(t){if(t.altKey||t.ctrlKey||t.metaKey)return;let e=0,i=0,r=0,n=0,a=0;switch(t.keyCode){case 61:case 107:case 171:case 187:e=1;break;case 189:case 109:case 173:e=-1;break;case 37:t.shiftKey?i=-1:(t.preventDefault(),n=-1);break;case 39:t.shiftKey?i=1:(t.preventDefault(),n=1);break;case 38:t.shiftKey?r=1:(t.preventDefault(),a=-1);break;case 40:t.shiftKey?r=-1:(t.preventDefault(),a=1);break;default:return}return this._rotationDisabled&&(i=0,r=0),{cameraAnimation:o=>{const s=this._tr;o.easeTo({duration:300,easeId:"keyboardHandler",easing:Gr,zoom:e?Math.round(s.zoom)+e*(t.shiftKey?2:1):s.zoom,bearing:s.bearing+i*this._bearingStep,pitch:s.pitch+r*this._pitchStep,offset:[-n*this._panStep,-a*this._panStep],center:s.center},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function Gr(t){return t*(2-t)}const Hr=4.000244140625;class Xr{constructor(t,e){this._onTimeout=t=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(t)},this._map=t,this._tr=new wr(t),this._el=t.getCanvasContainer(),this._triggerRenderFrame=e,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(t){this._defaultZoomRate=t}setWheelZoomRate(t){this._wheelZoomRate=t}isEnabled(){return!!this._enabled}isActive(){return!!this._active||void 0!==this._finishTimeout}isZooming(){return!!this._zooming}enable(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!t&&"center"===t.around)}disable(){this.isEnabled()&&(this._enabled=!1)}wheel(e){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!e[this._map._metaKey])return;e.preventDefault()}let i=e.deltaMode===WheelEvent.DOM_DELTA_LINE?40*e.deltaY:e.deltaY;const r=t.browser.now(),n=r-(this._lastWheelEventTime||0);this._lastWheelEventTime=r,0!==i&&i%Hr==0?this._type="wheel":0!==i&&Math.abs(i)<4?this._type="trackpad":n>400?(this._type=null,this._lastValue=i,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(n*i)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,i+=this._lastValue)),e.shiftKey&&i&&(i/=4),this._type&&(this._lastWheelEvent=e,this._delta-=i,this._active||this._start(e)),e.preventDefault()}_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);const r=i.mousePos(this._el,e),n=this._tr;this._around=t.LngLat.convert(this._aroundCenter?n.center:n.unproject(r)),this._aroundPoint=n.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId)return;if(this._frameId=null,!this.isActive())return;const e=this._tr.transform;if(0!==this._delta){const t="wheel"===this._type&&Math.abs(this._delta)>Hr?this._wheelZoomRate:this._defaultZoomRate;let i=2/(1+Math.exp(-Math.abs(this._delta*t)));this._delta<0&&0!==i&&(i=1/i);const r="number"==typeof this._targetZoom?e.zoomScale(this._targetZoom):e.scale;this._targetZoom=Math.min(e.maxZoom,Math.max(e.minZoom,e.scaleZoom(r*i))),"wheel"===this._type&&(this._startZoom=e.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const i="number"==typeof this._targetZoom?this._targetZoom:e.zoom,r=this._startZoom,n=this._easing;let a,o=!1;if("wheel"===this._type&&r&&n){const e=Math.min((t.browser.now()-this._lastWheelEventTime)/200,1),s=n(e);a=t.interpolate.number(r,i,s),e<1?this._frameId||(this._frameId=!0):o=!0}else a=i,o=!0;return this._active=!0,o&&(this._active=!1,this._finishTimeout=setTimeout((()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout}),200)),{noInertia:!0,needsRenderFrame:!o,zoomDelta:a-e.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(e){let i=t.defaultEasing;if(this._prevEase){const e=this._prevEase,r=(t.browser.now()-e.start)/e.duration,n=e.easing(r+.01)-e.easing(r),a=.27/Math.sqrt(n*n+1e-4)*.01,o=Math.sqrt(.0729-a*a);i=t.bezier(a,o,.25,1)}return this._prevEase={start:t.browser.now(),duration:e,easing:i},i}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class Wr{constructor(t,e){this._clickZoom=t,this._tapZoom=e}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 Kr{constructor(t){this._tr=new wr(t),this.reset()}reset(){this._active=!1}dblclick(t,e){return t.preventDefault(),{cameraAnimation:i=>{i.easeTo({duration:300,zoom:this._tr.zoom+(t.shiftKey?-1:1),around:this._tr.unproject(e)},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Yr{constructor(){this._tap=new Cr({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(t,e,i){if(!this._swipePoint)if(this._tapTime){const r=e[0],n=t.timeStamp-this._tapTime<500,a=this._tapPoint.dist(r)<30;n&&a?i.length>0&&(this._swipePoint=r,this._swipeTouch=i[0].identifier):this.reset()}else this._tap.touchstart(t,e,i)}touchmove(t,e,i){if(this._tapTime){if(this._swipePoint){if(i[0].identifier!==this._swipeTouch)return;const r=e[0],n=r.y-this._swipePoint.y;return this._swipePoint=r,t.preventDefault(),this._active=!0,{zoomDelta:n/128}}}else this._tap.touchmove(t,e,i)}touchend(t,e,i){if(this._tapTime)this._swipePoint&&0===i.length&&this.reset();else{const r=this._tap.touchend(t,e,i);r&&(this._tapTime=t.timeStamp,this._tapPoint=r)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Jr{constructor(t,e,i){this._el=t,this._mousePan=e,this._touchPan=i}enable(t){this._inertiaOptions=t||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class Qr{constructor(t,e,i){this._pitchWithRotate=t.pitchWithRotate,this._mouseRotate=e,this._mousePitch=i}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 tn{constructor(t,e,i,r){this._el=t,this._touchZoom=e,this._touchRotate=i,this._tapDragZoom=r,this._rotationDisabled=!1,this._enabled=!0}enable(t){this._touchZoom.enable(t),this._rotationDisabled||this._touchRotate.enable(t),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}const en=t=>t.zoom||t.drag||t.pitch||t.rotate;class rn extends t.Event{}function nn(t){return t.panDelta&&t.panDelta.mag()||t.zoomDelta||t.bearingDelta||t.pitchDelta}class an{constructor(t,e){this.handleWindowEvent=t=>{this.handleEvent(t,`${t.type}Window`)},this.handleEvent=(t,e)=>{if("blur"===t.type)return void this.stop(!0);this._updatingCamera=!0;const r="renderFrame"===t.type?void 0:t,n={needsRenderFrame:!1},a={},o={},s=t.touches,l=s?this._getMapTouches(s):void 0,c=l?i.touchPos(this._el,l):i.mousePos(this._el,t);for(const{handlerName:i,handler:s,allowed:h}of this._handlers){if(!s.isEnabled())continue;let u;this._blockedByActive(o,h,i)?s.reset():s[e||t.type]&&(u=s[e||t.type](t,c,l),this.mergeHandlerResult(n,a,u,i,r),u&&u.needsRenderFrame&&this._triggerRenderFrame()),(u||s.isActive())&&(o[i]=s)}const h={};for(const t in this._previousActiveHandlers)o[t]||(h[t]=r);this._previousActiveHandlers=o,(Object.keys(h).length||nn(n))&&(this._changes.push([n,a,h]),this._triggerRenderFrame()),(Object.keys(o).length||nn(n))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:u}=n;u&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],u(this._map))},this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new mr(t),this._bearingSnap=e.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(e);const r=this._el;this._listeners=[[r,"touchstart",{passive:!0}],[r,"touchmove",{passive:!1}],[r,"touchend",void 0],[r,"touchcancel",void 0],[r,"mousedown",void 0],[r,"mousemove",void 0],[r,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[r,"mouseover",void 0],[r,"mouseout",void 0],[r,"dblclick",void 0],[r,"click",void 0],[r,"keydown",{capture:!1}],[r,"keyup",void 0],[r,"wheel",{passive:!1}],[r,"contextmenu",void 0],[window,"blur",void 0]];for(const[t,e,r]of this._listeners)i.addEventListener(t,e,t===document?this.handleWindowEvent:this.handleEvent,r)}destroy(){for(const[t,e,r]of this._listeners)i.removeEventListener(t,e,t===document?this.handleWindowEvent:this.handleEvent,r)}_addDefaultHandlers(t){const e=this._map,r=e.getCanvasContainer();this._add("mapEvent",new vr(e,t));const n=e.boxZoom=new Er(e,t);this._add("boxZoom",n),t.interactive&&t.boxZoom&&n.enable();const a=new Ir(e),o=new Kr(e);e.doubleClickZoom=new Wr(o,a),this._add("tapZoom",a),this._add("clickZoom",o),t.interactive&&t.doubleClickZoom&&e.doubleClickZoom.enable();const s=new Yr;this._add("tapDragZoom",s);const l=e.touchPitch=new jr(e);this._add("touchPitch",l),t.interactive&&t.touchPitch&&e.touchPitch.enable(t.touchPitch);const c=Lr(t),h=Dr(t);e.dragRotate=new Qr(t,c,h),this._add("mouseRotate",c,["mousePitch"]),this._add("mousePitch",h,["mouseRotate"]),t.interactive&&t.dragRotate&&e.dragRotate.enable();const u=(({enable:t,clickTolerance:e})=>{const r=new kr({checkCorrectEvent:t=>0===i.mouseButton(t)&&!t.ctrlKey});return new Ar({clickTolerance:e,move:(t,e)=>({around:e,panDelta:e.sub(t)}),activateOnStart:!0,moveStateManager:r,enable:t,assignEvents:zr})})(t),p=new Rr(t,e);e.dragPan=new Jr(r,u,p),this._add("mousePan",u),this._add("touchPan",p,["touchZoom","touchRotate"]),t.interactive&&t.dragPan&&e.dragPan.enable(t.dragPan);const d=new Nr,m=new Ur;e.touchZoomRotate=new tn(r,m,d,s),this._add("touchRotate",d,["touchPan","touchZoom"]),this._add("touchZoom",m,["touchPan","touchRotate"]),t.interactive&&t.touchZoomRotate&&e.touchZoomRotate.enable(t.touchZoomRotate);const f=e.scrollZoom=new Xr(e,(()=>this._triggerRenderFrame()));this._add("scrollZoom",f,["mousePan"]),t.interactive&&t.scrollZoom&&e.scrollZoom.enable(t.scrollZoom);const g=e.keyboard=new Zr(e);this._add("keyboard",g),t.interactive&&t.keyboard&&e.keyboard.enable(),this._add("blockableMapEvent",new br(e))}_add(t,e,i){this._handlers.push({handlerName:t,handler:e,allowed:i}),this._handlersById[t]=e}stop(t){if(!this._updatingCamera){for(const{handler:t}of this._handlers)t.reset();this._inertia.clear(),this._fireEvents({},{},t),this._changes=[]}}isActive(){for(const{handler:t}of this._handlers)if(t.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return Boolean(en(this._eventsInProgress))||this.isZooming()}_blockedByActive(t,e,i){for(const r in t)if(r!==i&&(!e||e.indexOf(r)<0))return!0;return!1}_getMapTouches(t){const e=[];for(const i of t)this._el.contains(i.target)&&e.push(i);return e}mergeHandlerResult(e,i,r,n,a){if(!r)return;t.extend(e,r);const o={handlerName:n,originalEvent:r.originalEvent||a};void 0!==r.zoomDelta&&(i.zoom=o),void 0!==r.panDelta&&(i.drag=o),void 0!==r.pitchDelta&&(i.pitch=o),void 0!==r.bearingDelta&&(i.rotate=o)}_applyChanges(){const e={},i={},r={};for(const[n,a,o]of this._changes)n.panDelta&&(e.panDelta=(e.panDelta||new t.Point(0,0))._add(n.panDelta)),n.zoomDelta&&(e.zoomDelta=(e.zoomDelta||0)+n.zoomDelta),n.bearingDelta&&(e.bearingDelta=(e.bearingDelta||0)+n.bearingDelta),n.pitchDelta&&(e.pitchDelta=(e.pitchDelta||0)+n.pitchDelta),void 0!==n.around&&(e.around=n.around),void 0!==n.pinchAround&&(e.pinchAround=n.pinchAround),n.noInertia&&(e.noInertia=n.noInertia),t.extend(i,a),t.extend(r,o);this._updateMapTransform(e,i,r),this._changes=[]}_updateMapTransform(t,e,i){const r=this._map,n=r._getTransformForUpdate(),a=r.terrain;if(!(nn(t)||a&&this._terrainMovement))return this._fireEvents(e,i,!0);let{panDelta:o,zoomDelta:s,bearingDelta:l,pitchDelta:c,around:h,pinchAround:u}=t;void 0!==u&&(h=u),r._stop(!0),h=h||r.transform.centerPoint;const p=n.pointLocation(o?h.sub(o):h);l&&(n.bearing+=l),c&&(n.pitch+=c),s&&(n.zoom+=s),a?this._terrainMovement||!e.drag&&!e.zoom?e.drag&&this._terrainMovement?n.center=n.pointLocation(n.centerPoint.sub(o)):n.setLocationAtPoint(p,h):(this._terrainMovement=!0,this._map._elevationFreeze=!0,n.setLocationAtPoint(p,h),this._map.once("moveend",(()=>{this._map._elevationFreeze=!1,this._terrainMovement=!1,n.recalculateZoom(r.terrain)}))):n.setLocationAtPoint(p,h),r._applyUpdatedTransform(n),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(e,i,!0)}_fireEvents(e,i,r){const n=en(this._eventsInProgress),a=en(e),o={};for(const t in e){const{originalEvent:i}=e[t];this._eventsInProgress[t]||(o[`${t}start`]=i),this._eventsInProgress[t]=e[t]}!n&&a&&this._fireEvent("movestart",a.originalEvent);for(const t in o)this._fireEvent(t,o[t]);a&&this._fireEvent("move",a.originalEvent);for(const t in e){const{originalEvent:i}=e[t];this._fireEvent(t,i)}const s={};let l;for(const t in this._eventsInProgress){const{handlerName:e,originalEvent:r}=this._eventsInProgress[t];this._handlersById[e].isActive()||(delete this._eventsInProgress[t],l=i[e]||r,s[`${t}end`]=l)}for(const t in s)this._fireEvent(t,s[t]);const c=en(this._eventsInProgress);if(r&&(n||a)&&!c){this._updatingCamera=!0;const e=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),i=t=>0!==t&&-this._bearingSnap<t&&t<this._bearingSnap;!e||!e.essential&&t.browser.prefersReducedMotion?(this._map.fire(new t.Event("moveend",{originalEvent:l})),i(this._map.getBearing())&&this._map.resetNorth()):(i(e.bearing||this._map.getBearing())&&(e.bearing=0),e.freezeElevation=!0,this._map.easeTo(e,{originalEvent:l})),this._updatingCamera=!1}}_fireEvent(e,i){this._map.fire(new t.Event(e,i?{originalEvent:i}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add((t=>{delete this._frameId,this.handleEvent(new rn("renderFrame",{timeStamp:t})),this._applyChanges()}))}_triggerRenderFrame(){void 0===this._frameId&&(this._frameId=this._requestFrame())}}class on extends t.Evented{constructor(e,i){super(),this._renderFrameCallback=()=>{const e=Math.min((t.browser.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(e)),e<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=e,this._bearingSnap=i.bearingSnap,this.on("moveend",(()=>{delete this._requestedCameraState}))}getCenter(){return new t.LngLat(this.transform.center.lng,this.transform.center.lat)}setCenter(t,e){return this.jumpTo({center:t},e)}panBy(e,i,r){return e=t.Point.convert(e).mult(-1),this.panTo(this.transform.center,t.extend({offset:e},i),r)}panTo(e,i,r){return this.easeTo(t.extend({center:e},i),r)}getZoom(){return this.transform.zoom}setZoom(t,e){return this.jumpTo({zoom:t},e),this}zoomTo(e,i,r){return this.easeTo(t.extend({zoom:e},i),r)}zoomIn(t,e){return this.zoomTo(this.getZoom()+1,t,e),this}zoomOut(t,e){return this.zoomTo(this.getZoom()-1,t,e),this}getBearing(){return this.transform.bearing}setBearing(t,e){return this.jumpTo({bearing:t},e),this}getPadding(){return this.transform.padding}setPadding(t,e){return this.jumpTo({padding:t},e),this}rotateTo(e,i,r){return this.easeTo(t.extend({bearing:e},i),r)}resetNorth(e,i){return this.rotateTo(0,t.extend({duration:1e3},e),i),this}resetNorthPitch(e,i){return this.easeTo(t.extend({bearing:0,pitch:0,duration:1e3},e),i),this}snapToNorth(t,e){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(t,e):this}getPitch(){return this.transform.pitch}setPitch(t,e){return this.jumpTo({pitch:t},e),this}cameraForBounds(t,e){t=z.convert(t);const i=e&&e.bearing||0;return this._cameraForBoxAndBearing(t.getNorthWest(),t.getSouthEast(),i,e)}_cameraForBoxAndBearing(e,i,r,n){const a={top:0,bottom:0,right:0,left:0};if("number"==typeof(n=t.extend({padding:a,offset:[0,0],maxZoom:this.transform.maxZoom},n)).padding){const t=n.padding;n.padding={top:t,bottom:t,right:t,left:t}}n.padding=t.extend(a,n.padding);const o=this.transform,s=o.padding,l=o.project(t.LngLat.convert(e)),c=o.project(t.LngLat.convert(i)),h=l.rotate(-r*Math.PI/180),u=c.rotate(-r*Math.PI/180),p=new t.Point(Math.max(h.x,u.x),Math.max(h.y,u.y)),d=new t.Point(Math.min(h.x,u.x),Math.min(h.y,u.y)),m=p.sub(d),f=(o.width-(s.left+s.right+n.padding.left+n.padding.right))/m.x,g=(o.height-(s.top+s.bottom+n.padding.top+n.padding.bottom))/m.y;if(g<0||f<0)return void t.warnOnce("Map cannot fit within canvas with the given bounds, padding, and/or offset.");const _=Math.min(o.scaleZoom(o.scale*Math.min(f,g)),n.maxZoom),y=t.Point.convert(n.offset),x=new t.Point((n.padding.left-n.padding.right)/2,(n.padding.top-n.padding.bottom)/2).rotate(r*Math.PI/180),v=y.add(x).mult(o.scale/o.zoomScale(_));return{center:o.unproject(l.add(c).div(2).sub(v)),zoom:_,bearing:r}}fitBounds(t,e,i){return this._fitInternal(this.cameraForBounds(t,e),e,i)}fitScreenCoordinates(e,i,r,n,a){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(t.Point.convert(e)),this.transform.pointLocation(t.Point.convert(i)),r,n),n,a)}_fitInternal(e,i,r){return e?(delete(i=t.extend(e,i)).padding,i.linear?this.easeTo(i,r):this.flyTo(i,r)):this}jumpTo(e,i){this.stop();const r=this._getTransformForUpdate();let n=!1,a=!1,o=!1;return"zoom"in e&&r.zoom!==+e.zoom&&(n=!0,r.zoom=+e.zoom),void 0!==e.center&&(r.center=t.LngLat.convert(e.center)),"bearing"in e&&r.bearing!==+e.bearing&&(a=!0,r.bearing=+e.bearing),"pitch"in e&&r.pitch!==+e.pitch&&(o=!0,r.pitch=+e.pitch),null==e.padding||r.isPaddingEqual(e.padding)||(r.padding=e.padding),this._applyUpdatedTransform(r),this.fire(new t.Event("movestart",i)).fire(new t.Event("move",i)),n&&this.fire(new t.Event("zoomstart",i)).fire(new t.Event("zoom",i)).fire(new t.Event("zoomend",i)),a&&this.fire(new t.Event("rotatestart",i)).fire(new t.Event("rotate",i)).fire(new t.Event("rotateend",i)),o&&this.fire(new t.Event("pitchstart",i)).fire(new t.Event("pitch",i)).fire(new t.Event("pitchend",i)),this.fire(new t.Event("moveend",i))}calculateCameraOptionsFromTo(e,i,r,n=0){const a=t.MercatorCoordinate.fromLngLat(e,i),o=t.MercatorCoordinate.fromLngLat(r,n),s=o.x-a.x,l=o.y-a.y,c=o.z-a.z,h=Math.hypot(s,l,c);if(0===h)throw new Error("Can't calculate camera options with same From and To");const u=Math.hypot(s,l),p=this.transform.scaleZoom(this.transform.cameraToCenterDistance/h/this.transform.tileSize),d=180*Math.atan2(s,-l)/Math.PI;let m=180*Math.acos(u/h)/Math.PI;return m=c<0?90-m:90+m,{center:o.toLngLat(),zoom:p,pitch:m,bearing:d}}easeTo(e,i){this._stop(!1,e.easeId),(!1===(e=t.extend({offset:[0,0],duration:500,easing:t.defaultEasing},e)).animate||!e.essential&&t.browser.prefersReducedMotion)&&(e.duration=0);const r=this._getTransformForUpdate(),n=this.getZoom(),a=this.getBearing(),o=this.getPitch(),s=this.getPadding(),l="zoom"in e?+e.zoom:n,c="bearing"in e?this._normalizeBearing(e.bearing,a):a,h="pitch"in e?+e.pitch:o,u="padding"in e?e.padding:r.padding,p=t.Point.convert(e.offset);let d=r.centerPoint.add(p);const m=r.pointLocation(d),f=t.LngLat.convert(e.center||m);this._normalizeCenter(f);const g=r.project(m),_=r.project(f).sub(g),y=r.zoomScale(l-n);let x,v;e.around&&(x=t.LngLat.convert(e.around),v=r.locationPoint(x));const b={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||l!==n,this._rotating=this._rotating||a!==c,this._pitching=this._pitching||h!==o,this._padding=!r.isPaddingEqual(u),this._easeId=e.easeId,this._prepareEase(i,e.noMoveStart,b),this.terrain&&this._prepareElevation(f),this._ease((m=>{if(this._zooming&&(r.zoom=t.interpolate.number(n,l,m)),this._rotating&&(r.bearing=t.interpolate.number(a,c,m)),this._pitching&&(r.pitch=t.interpolate.number(o,h,m)),this._padding&&(r.interpolatePadding(s,u,m),d=r.centerPoint.add(p)),this.terrain&&!e.freezeElevation&&this._updateElevation(m),x)r.setLocationAtPoint(x,v);else{const t=r.zoomScale(r.zoom-n),e=l>n?Math.min(2,y):Math.max(.5,y),i=Math.pow(e,1-m),a=r.unproject(g.add(_.mult(m*i)).mult(t));r.setLocationAtPoint(r.renderWorldCopies?a.wrap():a,d)}this._applyUpdatedTransform(r),this._fireMoveEvents(i)}),(t=>{this.terrain&&this._finalizeElevation(),this._afterEase(i,t)}),e),this}_prepareEase(e,i,r={}){this._moving=!0,i||r.moving||this.fire(new t.Event("movestart",e)),this._zooming&&!r.zooming&&this.fire(new t.Event("zoomstart",e)),this._rotating&&!r.rotating&&this.fire(new t.Event("rotatestart",e)),this._pitching&&!r.pitching&&this.fire(new t.Event("pitchstart",e))}_prepareElevation(t){this._elevationCenter=t,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(t,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(e){this.transform._minEleveationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);const i=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(e<1&&i!==this._elevationTarget){const t=this._elevationTarget-this._elevationStart;this._elevationStart+=e*(t-(i-(t*e+this._elevationStart))/(1-e)),this._elevationTarget=i}this.transform.elevation=t.interpolate.number(this._elevationStart,this._elevationTarget,e)}_finalizeElevation(){this._elevationFreeze=!1,this.transform.recalculateZoom(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_applyUpdatedTransform(t){if(!this.transformCameraUpdate)return;const e=t.clone(),{center:i,zoom:r,pitch:n,bearing:a,elevation:o}=this.transformCameraUpdate(e);i&&(e.center=i),void 0!==r&&(e.zoom=r),void 0!==n&&(e.pitch=n),void 0!==a&&(e.bearing=a),void 0!==o&&(e.elevation=o),this.transform.apply(e)}_fireMoveEvents(e){this.fire(new t.Event("move",e)),this._zooming&&this.fire(new t.Event("zoom",e)),this._rotating&&this.fire(new t.Event("rotate",e)),this._pitching&&this.fire(new t.Event("pitch",e))}_afterEase(e,i){if(this._easeId&&i&&this._easeId===i)return;delete this._easeId;const r=this._zooming,n=this._rotating,a=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,r&&this.fire(new t.Event("zoomend",e)),n&&this.fire(new t.Event("rotateend",e)),a&&this.fire(new t.Event("pitchend",e)),this.fire(new t.Event("moveend",e))}flyTo(e,i){if(!e.essential&&t.browser.prefersReducedMotion){const r=t.pick(e,["center","zoom","bearing","pitch","around"]);return this.jumpTo(r,i)}this.stop(),e=t.extend({offset:[0,0],speed:1.2,curve:1.42,easing:t.defaultEasing},e);const r=this._getTransformForUpdate(),n=this.getZoom(),a=this.getBearing(),o=this.getPitch(),s=this.getPadding(),l="zoom"in e?t.clamp(+e.zoom,r.minZoom,r.maxZoom):n,c="bearing"in e?this._normalizeBearing(e.bearing,a):a,h="pitch"in e?+e.pitch:o,u="padding"in e?e.padding:r.padding,p=r.zoomScale(l-n),d=t.Point.convert(e.offset);let m=r.centerPoint.add(d);const f=r.pointLocation(m),g=t.LngLat.convert(e.center||f);this._normalizeCenter(g);const _=r.project(f),y=r.project(g).sub(_);let x=e.curve;const v=Math.max(r.width,r.height),b=v/p,w=y.mag();if("minZoom"in e){const i=t.clamp(Math.min(e.minZoom,n,l),r.minZoom,r.maxZoom),a=v/r.zoomScale(i-n);x=Math.sqrt(a/w*2)}const E=x*x;function T(t){const e=(b*b-v*v+(t?-1:1)*E*E*w*w)/(2*(t?b:v)*E*w);return Math.log(Math.sqrt(e*e+1)-e)}function S(t){return(Math.exp(t)-Math.exp(-t))/2}function C(t){return(Math.exp(t)+Math.exp(-t))/2}const I=T(!1);let A=function(t){return C(I)/C(I+x*t)},M=function(t){return v*((C(I)*(S(e=I+x*t)/C(e))-S(I))/E)/w;var e},k=(T(!0)-I)/x;if(Math.abs(w)<1e-6||!isFinite(k)){if(Math.abs(v-b)<1e-6)return this.easeTo(e,i);const t=b<v?-1:1;k=Math.abs(Math.log(b/v))/x,M=function(){return 0},A=function(e){return Math.exp(t*x*e)}}return e.duration="duration"in e?+e.duration:1e3*k/("screenSpeed"in e?+e.screenSpeed/x:+e.speed),e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=a!==c,this._pitching=h!==o,this._padding=!r.isPaddingEqual(u),this._prepareEase(i,!1),this.terrain&&this._prepareElevation(g),this._ease((p=>{const f=p*k,x=1/A(f);r.zoom=1===p?l:n+r.scaleZoom(x),this._rotating&&(r.bearing=t.interpolate.number(a,c,p)),this._pitching&&(r.pitch=t.interpolate.number(o,h,p)),this._padding&&(r.interpolatePadding(s,u,p),m=r.centerPoint.add(d)),this.terrain&&!e.freezeElevation&&this._updateElevation(p);const v=1===p?g:r.unproject(_.add(y.mult(M(f))).mult(x));r.setLocationAtPoint(r.renderWorldCopies?v.wrap():v,m),this._applyUpdatedTransform(r),this._fireMoveEvents(i)}),(()=>{this.terrain&&this._finalizeElevation(),this._afterEase(i)}),e),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(t,e){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const t=this._onEaseEnd;delete this._onEaseEnd,t.call(this,e)}if(!t){const t=this.handlers;t&&t.stop(!1)}return this}_ease(e,i,r){!1===r.animate||0===r.duration?(e(1),i()):(this._easeStart=t.browser.now(),this._easeOptions=r,this._onEaseFrame=e,this._onEaseEnd=i,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(e,i){e=t.wrap(e,-180,180);const r=Math.abs(e-i);return Math.abs(e-360-i)<r&&(e-=360),Math.abs(e+360-i)<r&&(e+=360),e}_normalizeCenter(t){const e=this.transform;if(!e.renderWorldCopies||e.lngRange)return;const i=t.lng-e.center.lng;t.lng+=i>180?-360:i<-180?360:0}queryTerrainElevation(e){return this.terrain?this.terrain.getElevationForLngLatZoom(t.LngLat.convert(e),this.transform.tileZoom)-this.transform.elevation:null}}class sn{constructor(t={}){this._toggleAttribution=()=>{this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")))},this._updateData=t=>{!t||"metadata"!==t.sourceDataType&&"visibility"!==t.sourceDataType&&"style"!==t.dataType&&"terrain"!==t.type||this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?!1===this._compact?this._container.setAttribute("open",""):this._container.classList.contains("maplibregl-compact")||this._container.classList.contains("maplibregl-attrib-empty")||(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","maplibregl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show"))},this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")},this.options=t}getDefaultPosition(){return"bottom-right"}onAdd(t){return this._map=t,this._compact=this.options&&this.options.compact,this._container=i.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=i.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=i.create("div","maplibregl-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("terrain",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._container}onRemove(){i.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(t,e){const i=this._map._getUIString(`AttributionControl.${e}`);t.title=i,t.setAttribute("aria-label",i)}_updateAttributions(){if(!this._map.style)return;let t=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=t.concat(this.options.customAttribution.map((t=>"string"!=typeof t?"":t))):"string"==typeof this.options.customAttribution&&t.push(this.options.customAttribution)),this._map.style.stylesheet){const t=this._map.style.stylesheet;this.styleOwner=t.owner,this.styleId=t.id}const e=this._map.style.sourceCaches;for(const i in e){const r=e[i];if(r.used||r.usedForTerrain){const e=r.getSource();e.attribution&&t.indexOf(e.attribution)<0&&t.push(e.attribution)}}t=t.filter((t=>String(t).trim())),t.sort(((t,e)=>t.length-e.length)),t=t.filter(((e,i)=>{for(let r=i+1;r<t.length;r++)if(t[r].indexOf(e)>=0)return!1;return!0}));const i=t.join(" | ");i!==this._attribHTML&&(this._attribHTML=i,t.length?(this._innerContainer.innerHTML=i,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class ln{constructor(t={}){this._updateCompact=()=>{const t=this._container.children;if(t.length){const e=t[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?!1!==this._compact&&e.classList.add("maplibregl-compact"):e.classList.remove("maplibregl-compact")}},this.options=t}getDefaultPosition(){return"bottom-left"}onAdd(t){this._map=t,this._compact=this.options&&this.options.compact,this._container=i.create("div","maplibregl-ctrl");const e=i.create("a","maplibregl-ctrl-logo");return e.target="_blank",e.rel="noopener nofollow",e.href="https://maplibre.org/",e.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),e.setAttribute("rel","noopener nofollow"),this._container.appendChild(e),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){i.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class cn{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(t){const e=++this._id;return this._queue.push({callback:t,id:e,cancelled:!1}),e}remove(t){const e=this._currentlyRunning,i=e?this._queue.concat(e):this._queue;for(const e of i)if(e.id===t)return void(e.cancelled=!0)}run(t=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const e=this._currentlyRunning=this._queue;this._queue=[];for(const i of e)if(!i.cancelled&&(i.callback(t),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}const hn={"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","TerrainControl.enableTerrain":"Enable terrain","TerrainControl.disableTerrain":"Disable terrain"};var un=t.createLayout([{name:"a_pos3d",type:"Int16",components:3}]);class pn extends t.Evented{constructor(t){super(),this.sourceCache=t,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,t.usedForTerrain=!0,t.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(e,i){this.sourceCache.update(e,i),this._renderableTilesKeys=[];const r={};for(const n of e.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:i}))r[n.key]=!0,this._renderableTilesKeys.push(n.key),this._tiles[n.key]||(n.posMatrix=new Float64Array(16),t.ortho(n.posMatrix,0,t.EXTENT,0,t.EXTENT,0,1),this._tiles[n.key]=new H(n,this.tileSize));for(const t in this._tiles)r[t]||delete this._tiles[t]}freeRtt(t){for(const e in this._tiles){const i=this._tiles[e];(!t||i.tileID.equals(t)||i.tileID.isChildOf(t)||t.isChildOf(i.tileID))&&(i.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map((t=>this.getTileByID(t)))}getTileByID(t){return this._tiles[t]}getTerrainCoords(e){const i={};for(const r of this._renderableTilesKeys){const n=this._tiles[r].tileID;if(n.canonical.equals(e.canonical)){const n=e.clone();n.posMatrix=new Float64Array(16),t.ortho(n.posMatrix,0,t.EXTENT,0,t.EXTENT,0,1),i[r]=n}else if(n.canonical.isChildOf(e.canonical)){const a=e.clone();a.posMatrix=new Float64Array(16);const o=n.canonical.z-e.canonical.z,s=n.canonical.x-(n.canonical.x>>o<<o),l=n.canonical.y-(n.canonical.y>>o<<o),c=t.EXTENT>>o;t.ortho(a.posMatrix,0,c,0,c,0,1),t.translate(a.posMatrix,a.posMatrix,[-s*c,-l*c,0]),i[r]=a}else if(e.canonical.isChildOf(n.canonical)){const a=e.clone();a.posMatrix=new Float64Array(16);const o=e.canonical.z-n.canonical.z,s=e.canonical.x-(e.canonical.x>>o<<o),l=e.canonical.y-(e.canonical.y>>o<<o),c=t.EXTENT>>o;t.ortho(a.posMatrix,0,t.EXTENT,0,t.EXTENT,0,1),t.translate(a.posMatrix,a.posMatrix,[s*c,l*c,0]),t.scale(a.posMatrix,a.posMatrix,[1/2**o,1/2**o,0]),i[r]=a}}return i}getSourceTile(t,e){const i=this.sourceCache._source;let r=t.overscaledZ-this.deltaZoom;if(r>i.maxzoom&&(r=i.maxzoom),r<i.minzoom)return null;this._sourceTileCache[t.key]||(this._sourceTileCache[t.key]=t.scaledTo(r).key);let n=this.sourceCache.getTileByID(this._sourceTileCache[t.key]);if((!n||!n.dem)&&e)for(;r>=i.minzoom&&(!n||!n.dem);)n=this.sourceCache.getTileByID(t.scaledTo(r--).key);return n}tilesAfterTime(t=Date.now()){return Object.values(this._tiles).filter((e=>e.timeAdded>=t))}}class dn{constructor(t,e,i){this.painter=t,this.sourceCache=new pn(e),this.options=i,this.exaggeration="number"==typeof i.exaggeration?i.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(e,i,r,n=t.EXTENT){var a;if(!(i>=0&&i<n&&r>=0&&r<n))return 0;const o=this.getTerrainData(e),s=null===(a=o.tile)||void 0===a?void 0:a.dem;if(!s)return 0;const l=function(t,e,i){var r=e[0],n=e[1];return t[0]=i[0]*r+i[4]*n+i[12],t[1]=i[1]*r+i[5]*n+i[13],t}([],[i/n*t.EXTENT,r/n*t.EXTENT],o.u_terrain_matrix),c=[l[0]*s.dim,l[1]*s.dim],h=Math.floor(c[0]),u=Math.floor(c[1]),p=c[0]-h,d=c[1]-u;return s.get(h,u)*(1-p)*(1-d)+s.get(h+1,u)*p*(1-d)+s.get(h,u+1)*(1-p)*d+s.get(h+1,u+1)*p*d}getElevationForLngLatZoom(e,i){const{tileID:r,mercatorX:n,mercatorY:a}=this._getOverscaledTileIDFromLngLatZoom(e,i);return this.getElevation(r,n%t.EXTENT,a%t.EXTENT,t.EXTENT)}getElevation(e,i,r,n=t.EXTENT){return this.getDEMElevation(e,i,r,n)*this.exaggeration}getTerrainData(e){if(!this._emptyDemTexture){const e=this.painter.context,i=new t.RGBAImage({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new x(e,i,e.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new x(e,new t.RGBAImage({width:1,height:1}),e.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=t.identity([])}const i=this.sourceCache.getSourceTile(e,!0);if(i&&i.dem&&(!i.demTexture||i.needsTerrainPrepare)){const t=this.painter.context;i.demTexture=this.painter.getTileTexture(i.dem.stride),i.demTexture?i.demTexture.update(i.dem.getPixels(),{premultiply:!1}):i.demTexture=new x(t,i.dem.getPixels(),t.gl.RGBA,{premultiply:!1}),i.demTexture.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),i.needsTerrainPrepare=!1}const r=i&&i+i.tileID.key+e.key;if(r&&!this._demMatrixCache[r]){const r=this.sourceCache.sourceCache._source.maxzoom;let n=e.canonical.z-i.tileID.canonical.z;e.overscaledZ>e.canonical.z&&(e.canonical.z>=r?n=e.canonical.z-r:t.warnOnce("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const a=e.canonical.x-(e.canonical.x>>n<<n),o=e.canonical.y-(e.canonical.y>>n<<n),s=t.fromScaling(new Float64Array(16),[1/(t.EXTENT<<n),1/(t.EXTENT<<n),0]);t.translate(s,s,[a*t.EXTENT,o*t.EXTENT,0]),this._demMatrixCache[e.key]={matrix:s,coord:e}}return{u_depth:2,u_terrain:3,u_terrain_dim:i&&i.dem&&i.dem.dim||1,u_terrain_matrix:r?this._demMatrixCache[e.key].matrix:this._emptyDemMatrix,u_terrain_unpack:i&&i.dem&&i.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(i&&i.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:i}}getFramebuffer(t){const e=this.painter,i=e.width/devicePixelRatio,r=e.height/devicePixelRatio;return!this._fbo||this._fbo.width===i&&this._fbo.height===r||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new x(e.context,{width:i,height:r,data:null},e.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(e.context.gl.NEAREST,e.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new x(e.context,{width:i,height:r,data:null},e.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(e.context.gl.NEAREST,e.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=e.context.createFramebuffer(i,r,!0,!1),this._fbo.depthAttachment.set(e.context.createRenderbuffer(e.context.gl.DEPTH_COMPONENT16,i,r))),this._fbo.colorAttachment.set("coords"===t?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){const e=this.painter.context;if(this._coordsTexture)return this._coordsTexture;const i=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let t=0,e=0;t<this._coordsTextureSize;t++)for(let r=0;r<this._coordsTextureSize;r++,e+=4)i[e+0]=255&r,i[e+1]=255&t,i[e+2]=r>>8<<4|t>>8,i[e+3]=0;const r=new t.RGBAImage({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(i.buffer)),n=new x(e,r,e.gl.RGBA,{premultiply:!1});return n.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),this._coordsTexture=n,n}pointCoordinate(e){const i=new Uint8Array(4),r=this.painter.context,n=r.gl;r.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),n.readPixels(e.x,this.painter.height/devicePixelRatio-e.y-1,1,1,n.RGBA,n.UNSIGNED_BYTE,i),r.bindFramebuffer.set(null);const a=i[0]+(i[2]>>4<<8),o=i[1]+((15&i[2])<<8),s=this.coordsIndex[255-i[3]],l=s&&this.sourceCache.getTileByID(s);if(!l)return null;const c=this._coordsTextureSize,h=(1<<l.tileID.canonical.z)*c;return new t.MercatorCoordinate((l.tileID.canonical.x*c+a)/h,(l.tileID.canonical.y*c+o)/h,this.getElevation(l.tileID,a,o,c))}getTerrainMesh(){if(this._mesh)return this._mesh;const e=this.painter.context,i=new t.Pos3dArray,r=new t.TriangleIndexArray,n=this.meshSize,a=t.EXTENT/n,o=n*n;for(let t=0;t<=n;t++)for(let e=0;e<=n;e++)i.emplaceBack(e*a,t*a,0);for(let t=0;t<o;t+=n+1)for(let e=0;e<n;e++)r.emplaceBack(e+t,n+e+t+1,n+e+t+2),r.emplaceBack(e+t,n+e+t+2,e+t+1);const s=i.length,l=s+2*(n+1);for(const e of[0,1])for(let r=0;r<=n;r++)for(const n of[0,1])i.emplaceBack(r*a,e*t.EXTENT,n);for(let t=0;t<2*n;t+=2)r.emplaceBack(l+t,l+t+1,l+t+3),r.emplaceBack(l+t,l+t+3,l+t+2),r.emplaceBack(s+t,s+t+3,s+t+1),r.emplaceBack(s+t,s+t+2,s+t+3);const c=i.length,h=c+2*(n+1);for(const e of[0,1])for(let r=0;r<=n;r++)for(const n of[0,1])i.emplaceBack(e*t.EXTENT,r*a,n);for(let t=0;t<2*n;t+=2)r.emplaceBack(c+t,c+t+1,c+t+3),r.emplaceBack(c+t,c+t+3,c+t+2),r.emplaceBack(h+t,h+t+3,h+t+1),r.emplaceBack(h+t,h+t+2,h+t+3);return this._mesh={indexBuffer:e.createIndexBuffer(r),vertexBuffer:e.createVertexBuffer(i,un.members),segments:t.SegmentVector.simpleSegment(0,0,i.length,r.length)},this._mesh}getMeshFrameDelta(e){return 2*Math.PI*t.earthRadius/Math.pow(2,e)/5}getMinTileElevationForLngLatZoom(t,e){var i;const{tileID:r}=this._getOverscaledTileIDFromLngLatZoom(t,e);return null!==(i=this.getMinMaxElevation(r).minElevation)&&void 0!==i?i:0}getMinMaxElevation(t){const e=this.getTerrainData(t).tile,i={minElevation:null,maxElevation:null};return e&&e.dem&&(i.minElevation=e.dem.min*this.exaggeration,i.maxElevation=e.dem.max*this.exaggeration),i}_getOverscaledTileIDFromLngLatZoom(e,i){const r=t.MercatorCoordinate.fromLngLat(e.wrap()),n=(1<<i)*t.EXTENT,a=r.x*n,o=r.y*n,s=Math.floor(a/t.EXTENT),l=Math.floor(o/t.EXTENT);return{tileID:new t.OverscaledTileID(i,0,i,s,l),mercatorX:a,mercatorY:o}}}class mn{constructor(t,e,i){this._context=t,this._size=e,this._tileSize=i,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(const t of this._objects)t.texture.destroy(),t.fbo.destroy()}_createObject(t){const e=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),i=new x(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return i.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),e.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),e.colorAttachment.set(i.texture),{id:t,fbo:e,texture:i,stamp:-1,inUse:!1}}getObjectForId(t){return this._objects[t]}useObject(t){t.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter((e=>t.id!==e)),this._recentlyUsed.push(t.id)}stampObject(t){t.stamp=++this._stamp}getOrCreateFreeObject(){for(const t of this._recentlyUsed)if(!this._objects[t].inUse)return this._objects[t];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const t=this._createObject(this._objects.length);return this._objects.push(t),t}freeObject(t){t.inUse=!1}freeAllObjects(){for(const t of this._objects)this.freeObject(t)}isFull(){return!(this._objects.length<this._size)&&!1===this._objects.some((t=>!t.inUse))}}const fn={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class gn{constructor(t,e){this.painter=t,this.terrain=e,this.pool=new mn(t.context,30,e.sourceCache.tileSize*e.qualityFactor)}destruct(){this.pool.destruct()}getTexture(t){return this.pool.getObjectForId(t.rtt[this._stacks.length-1].id).texture}prepareForRender(t,e){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=t._order.filter((i=>!t._layers[i].isHidden(e))),this._coordsDescendingInv={};for(const e in t.sourceCaches){this._coordsDescendingInv[e]={};const i=t.sourceCaches[e].getVisibleCoordinates();for(const t of i){const i=this.terrain.sourceCache.getTerrainCoords(t);for(const t in i)this._coordsDescendingInv[e][t]||(this._coordsDescendingInv[e][t]=[]),this._coordsDescendingInv[e][t].push(i[t])}}this._coordsDescendingInvStr={};for(const e of t._order){const i=t._layers[e],r=i.source;if(fn[i.type]&&!this._coordsDescendingInvStr[r]){this._coordsDescendingInvStr[r]={};for(const t in this._coordsDescendingInv[r])this._coordsDescendingInvStr[r][t]=this._coordsDescendingInv[r][t].map((t=>t.key)).sort().join()}}for(const t of this._renderableTiles)for(const e in this._coordsDescendingInvStr){const i=this._coordsDescendingInvStr[e][t.tileID.key];i&&i!==t.rttCoords[e]&&(t.rtt=[])}}renderLayer(e){if(e.isHidden(this.painter.transform.zoom))return!1;const i=e.type,r=this.painter,n=this._renderableLayerIds[this._renderableLayerIds.length-1]===e.id;if(fn[i]&&(this._prevType&&fn[this._prevType]||this._stacks.push([]),this._prevType=i,this._stacks[this._stacks.length-1].push(e.id),!n))return!0;if(fn[this._prevType]||fn[i]&&n){this._prevType=i;const e=this._stacks.length-1,n=this._stacks[e]||[];for(const i of this._renderableTiles){if(this.pool.isFull()&&(er(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(i),i.rtt[e]){const t=this.pool.getObjectForId(i.rtt[e].id);if(t.stamp===i.rtt[e].stamp){this.pool.useObject(t);continue}}const a=this.pool.getOrCreateFreeObject();this.pool.useObject(a),this.pool.stampObject(a),i.rtt[e]={id:a.id,stamp:a.stamp},r.context.bindFramebuffer.set(a.fbo.framebuffer),r.context.clear({color:t.Color.transparent,stencil:0}),r.currentStencilSource=void 0;for(let t=0;t<n.length;t++){const e=r.style._layers[n[t]],o=e.source?this._coordsDescendingInv[e.source][i.tileID.key]:[i.tileID];r.context.viewport.set([0,0,a.fbo.width,a.fbo.height]),r._renderTileClippingMasks(e,o),r.renderLayer(r,r.style.sourceCaches[e.source],e,o),e.source&&(i.rttCoords[e.source]=this._coordsDescendingInvStr[e.source][i.tileID.key])}}return er(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects(),fn[i]}return!1}}const _n=e,yn={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,cooperativeGestures:void 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,maxTileCacheZoomLevels:t.config.MAX_TILE_CACHE_ZOOM_LEVELS,localIdeographFontFamily:"sans-serif",transformRequest:null,transformCameraUpdate:null,fadeDuration:300,crossSourceCollisions:!0,validateStyle:!0,maxCanvasSize:[4096,4096]},xn=t=>{t.touchstart=t.dragStart,t.touchmoveWindow=t.dragMove,t.touchend=t.dragEnd},vn={showCompass:!0,showZoom:!0,visualizePitch:!1};class bn{constructor(e,r,n=!1){this.mousedown=e=>{this.startMouse(t.extend({},e,{ctrlKey:!0,preventDefault:()=>e.preventDefault()}),i.mousePos(this.element,e)),i.addEventListener(window,"mousemove",this.mousemove),i.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=t=>{this.moveMouse(t,i.mousePos(this.element,t))},this.mouseup=t=>{this.mouseRotate.dragEnd(t),this.mousePitch&&this.mousePitch.dragEnd(t),this.offTemp()},this.touchstart=t=>{1!==t.targetTouches.length?this.reset():(this._startPos=this._lastPos=i.touchPos(this.element,t.targetTouches)[0],this.startTouch(t,this._startPos),i.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),i.addEventListener(window,"touchend",this.touchend))},this.touchmove=t=>{1!==t.targetTouches.length?this.reset():(this._lastPos=i.touchPos(this.element,t.targetTouches)[0],this.moveTouch(t,this._lastPos))},this.touchend=t=>{0===t.targetTouches.length&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),delete this._startPos,delete this._lastPos,this.offTemp()},this.reset=()=>{this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),this.touchRotate.reset(),this.touchPitch&&this.touchPitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10;const a=e.dragRotate._mouseRotate.getClickTolerance(),o=e.dragRotate._mousePitch.getClickTolerance();this.element=r,this.mouseRotate=Lr({clickTolerance:a,enable:!0}),this.touchRotate=(({enable:t,clickTolerance:e,bearingDegreesPerPixelMoved:i=.8})=>{const r=new Pr;return new Ar({clickTolerance:e,move:(t,e)=>({bearingDelta:(e.x-t.x)*i}),moveStateManager:r,enable:t,assignEvents:xn})})({clickTolerance:a,enable:!0}),this.map=e,n&&(this.mousePitch=Dr({clickTolerance:o,enable:!0}),this.touchPitch=(({enable:t,clickTolerance:e,pitchDegreesPerPixelMoved:i=-.5})=>{const r=new Pr;return new Ar({clickTolerance:e,move:(t,e)=>({pitchDelta:(e.y-t.y)*i}),moveStateManager:r,enable:t,assignEvents:xn})})({clickTolerance:o,enable:!0})),i.addEventListener(r,"mousedown",this.mousedown),i.addEventListener(r,"touchstart",this.touchstart,{passive:!1}),i.addEventListener(r,"touchcancel",this.reset)}startMouse(t,e){this.mouseRotate.dragStart(t,e),this.mousePitch&&this.mousePitch.dragStart(t,e),i.disableDrag()}startTouch(t,e){this.touchRotate.dragStart(t,e),this.touchPitch&&this.touchPitch.dragStart(t,e),i.disableDrag()}moveMouse(t,e){const i=this.map,{bearingDelta:r}=this.mouseRotate.dragMove(t,e)||{};if(r&&i.setBearing(i.getBearing()+r),this.mousePitch){const{pitchDelta:r}=this.mousePitch.dragMove(t,e)||{};r&&i.setPitch(i.getPitch()+r)}}moveTouch(t,e){const i=this.map,{bearingDelta:r}=this.touchRotate.dragMove(t,e)||{};if(r&&i.setBearing(i.getBearing()+r),this.touchPitch){const{pitchDelta:r}=this.touchPitch.dragMove(t,e)||{};r&&i.setPitch(i.getPitch()+r)}}off(){const t=this.element;i.removeEventListener(t,"mousedown",this.mousedown),i.removeEventListener(t,"touchstart",this.touchstart,{passive:!1}),i.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),i.removeEventListener(window,"touchend",this.touchend),i.removeEventListener(t,"touchcancel",this.reset),this.offTemp()}offTemp(){i.enableDrag(),i.removeEventListener(window,"mousemove",this.mousemove),i.removeEventListener(window,"mouseup",this.mouseup),i.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),i.removeEventListener(window,"touchend",this.touchend)}}let wn;function En(e,i,r){if(e=new t.LngLat(e.lng,e.lat),i){const n=new t.LngLat(e.lng-360,e.lat),a=new t.LngLat(e.lng+360,e.lat),o=r.locationPoint(e).distSqr(i);r.locationPoint(n).distSqr(i)<o?e=n:r.locationPoint(a).distSqr(i)<o&&(e=a)}for(;Math.abs(e.lng-r.center.lng)>180;){const t=r.locationPoint(e);if(t.x>=0&&t.y>=0&&t.x<=r.width&&t.y<=r.height)break;e.lng>r.center.lng?e.lng-=360:e.lng+=360}return e}const Tn={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 Sn(t,e,i){const r=t.classList;for(const t in Tn)r.remove(`maplibregl-${i}-anchor-${t}`);r.add(`maplibregl-${i}-anchor-${e}`)}class Cn extends t.Evented{constructor(e){if(super(),this._onKeyPress=t=>{const e=t.code,i=t.charCode||t.keyCode;"Space"!==e&&"Enter"!==e&&32!==i&&13!==i||this.togglePopup()},this._onMapClick=t=>{const e=t.originalEvent.target,i=this._element;this._popup&&(e===i||i.contains(e))&&this.togglePopup()},this._update=t=>{if(!this._map)return;const e=this._map.loaded()&&!this._map.isMoving();("terrain"===(null==t?void 0:t.type)||"render"===(null==t?void 0:t.type)&&!e)&&this._map.once("render",this._update),this._map.transform.renderWorldCopies&&(this._lngLat=En(this._lngLat,this._pos,this._map.transform)),this._pos=this._map.project(this._lngLat)._add(this._offset);let r="";"viewport"===this._rotationAlignment||"auto"===this._rotationAlignment?r=`rotateZ(${this._rotation}deg)`:"map"===this._rotationAlignment&&(r=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let n="";"viewport"===this._pitchAlignment||"auto"===this._pitchAlignment?n="rotateX(0deg)":"map"===this._pitchAlignment&&(n=`rotateX(${this._map.getPitch()}deg)`),t&&"moveend"!==t.type||(this._pos=this._pos.round()),i.setTransform(this._element,`${Tn[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${n} ${r}`),this._map.terrain&&!this._opacityTimeout&&(this._opacityTimeout=setTimeout((()=>{const t=this._map.unproject(this._pos),e=40075016.686*Math.abs(Math.cos(this._lngLat.lat*Math.PI/180))/Math.pow(2,this._map.transform.tileZoom+8);this._element.style.opacity=t.distanceTo(this._lngLat)>20*e?"0.2":"1.0",this._opacityTimeout=null}),100))},this._onMove=e=>{if(!this._isDragging){const t=this._clickTolerance||this._map._clickTolerance;this._isDragging=e.point.dist(this._pointerdownPos)>=t}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","pending"===this._state&&(this._state="active",this.fire(new t.Event("dragstart"))),this.fire(new t.Event("drag")))},this._onUp=()=>{this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),"active"===this._state&&this.fire(new t.Event("dragend")),this._state="inactive"},this._addDragHandler=t=>{this._element.contains(t.originalEvent.target)&&(t.preventDefault(),this._positionDelta=t.point.sub(this._pos).add(this._offset),this._pointerdownPos=t.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},this._anchor=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&&"auto"!==e.pitchAlignment?e.pitchAlignment:this._rotationAlignment,e&&e.element)this._element=e.element,this._offset=t.Point.convert(e&&e.offset||[0,0]);else{this._defaultMarker=!0,this._element=i.create("div"),this._element.setAttribute("aria-label","Map marker");const r=i.createNS("http://www.w3.org/2000/svg","svg"),n=41,a=27;r.setAttributeNS(null,"display","block"),r.setAttributeNS(null,"height",`${n}px`),r.setAttributeNS(null,"width",`${a}px`),r.setAttributeNS(null,"viewBox",`0 0 ${a} ${n}`);const o=i.createNS("http://www.w3.org/2000/svg","g");o.setAttributeNS(null,"stroke","none"),o.setAttributeNS(null,"stroke-width","1"),o.setAttributeNS(null,"fill","none"),o.setAttributeNS(null,"fill-rule","evenodd");const s=i.createNS("http://www.w3.org/2000/svg","g");s.setAttributeNS(null,"fill-rule","nonzero");const l=i.createNS("http://www.w3.org/2000/svg","g");l.setAttributeNS(null,"transform","translate(3.0, 29.0)"),l.setAttributeNS(null,"fill","#000000");const 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(const t of c){const e=i.createNS("http://www.w3.org/2000/svg","ellipse");e.setAttributeNS(null,"opacity","0.04"),e.setAttributeNS(null,"cx","10.5"),e.setAttributeNS(null,"cy","5.80029008"),e.setAttributeNS(null,"rx",t.rx),e.setAttributeNS(null,"ry",t.ry),l.appendChild(e)}const h=i.createNS("http://www.w3.org/2000/svg","g");h.setAttributeNS(null,"fill",this._color);const u=i.createNS("http://www.w3.org/2000/svg","path");u.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"),h.appendChild(u);const p=i.createNS("http://www.w3.org/2000/svg","g");p.setAttributeNS(null,"opacity","0.25"),p.setAttributeNS(null,"fill","#000000");const d=i.createNS("http://www.w3.org/2000/svg","path");d.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"),p.appendChild(d);const m=i.createNS("http://www.w3.org/2000/svg","g");m.setAttributeNS(null,"transform","translate(6.0, 7.0)"),m.setAttributeNS(null,"fill","#FFFFFF");const f=i.createNS("http://www.w3.org/2000/svg","g");f.setAttributeNS(null,"transform","translate(8.0, 8.0)");const g=i.createNS("http://www.w3.org/2000/svg","circle");g.setAttributeNS(null,"fill","#000000"),g.setAttributeNS(null,"opacity","0.25"),g.setAttributeNS(null,"cx","5.5"),g.setAttributeNS(null,"cy","5.5"),g.setAttributeNS(null,"r","5.4999962");const _=i.createNS("http://www.w3.org/2000/svg","circle");_.setAttributeNS(null,"fill","#FFFFFF"),_.setAttributeNS(null,"cx","5.5"),_.setAttributeNS(null,"cy","5.5"),_.setAttributeNS(null,"r","5.4999962"),f.appendChild(g),f.appendChild(_),s.appendChild(l),s.appendChild(h),s.appendChild(p),s.appendChild(m),s.appendChild(f),r.appendChild(s),r.setAttributeNS(null,"height",n*this._scale+"px"),r.setAttributeNS(null,"width",a*this._scale+"px"),this._element.appendChild(r),this._offset=t.Point.convert(e&&e.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",(t=>{t.preventDefault()})),this._element.addEventListener("mousedown",(t=>{t.preventDefault()})),Sn(this._element,this._anchor,"marker"),e&&e.className)for(const t of e.className.split(" "))this._element.classList.add(t);this._popup=null}addTo(t){return this.remove(),this._map=t,t.getCanvasContainer().appendChild(this._element),t.on("move",this._update),t.on("moveend",this._update),t.on("terrain",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("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),i.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=t.LngLat.convert(e),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(t){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),t){if(!("offset"in t.options)){const e=38.1,i=13.5,r=Math.abs(i)/Math.SQRT2;t.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-e],"bottom-left":[r,-1*(e-i+r)],"bottom-right":[-r,-1*(e-i+r)],left:[i,-1*(e-i)],right:[-i,-1*(e-i)]}:this._offset}this._popup=t,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}getPopup(){return this._popup}togglePopup(){const t=this._popup;return t?(t.isOpen()?t.remove():t.addTo(this._map),this):this}getOffset(){return this._offset}setOffset(e){return this._offset=t.Point.convert(e),this._update(),this}addClassName(t){this._element.classList.add(t)}removeClassName(t){this._element.classList.remove(t)}toggleClassName(t){return this._element.classList.toggle(t)}setDraggable(t){return this._draggable=!!t,this._map&&(t?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(t){return this._rotation=t||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(t){return this._rotationAlignment=t||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(t){return this._pitchAlignment=t&&"auto"!==t?t:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}}const In={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let An=0,Mn=!1;const kn={maxWidth:100,unit:"metric"};function Pn(t,e,i){const r=i&&i.maxWidth||100,n=t._container.clientHeight/2,a=t.unproject([0,n]),o=t.unproject([r,n]),s=a.distanceTo(o);if(i&&"imperial"===i.unit){const i=3.2808*s;i>5280?zn(e,r,i/5280,t._getUIString("ScaleControl.Miles")):zn(e,r,i,t._getUIString("ScaleControl.Feet"))}else i&&"nautical"===i.unit?zn(e,r,s/1852,t._getUIString("ScaleControl.NauticalMiles")):s>=1e3?zn(e,r,s/1e3,t._getUIString("ScaleControl.Kilometers")):zn(e,r,s,t._getUIString("ScaleControl.Meters"))}function zn(t,e,i,r){const n=function(t){const e=Math.pow(10,`${Math.floor(t)}`.length-1);let i=t/e;return i=i>=10?10:i>=5?5:i>=3?3:i>=2?2:i>=1?1:function(t){const e=Math.pow(10,Math.ceil(-Math.log(t)/Math.LN10));return Math.round(t*e)/e}(i),e*i}(i);t.style.width=e*(n/i)+"px",t.innerHTML=`${n}&nbsp;${r}`}const Ln={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},Dn=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Rn(e){if(e){if("number"==typeof e){const i=Math.round(Math.abs(e)/Math.SQRT2);return{center:new t.Point(0,0),top:new t.Point(0,e),"top-left":new t.Point(i,i),"top-right":new t.Point(-i,i),bottom:new t.Point(0,-e),"bottom-left":new t.Point(i,-i),"bottom-right":new t.Point(-i,-i),left:new t.Point(e,0),right:new t.Point(-e,0)}}if(e instanceof t.Point||Array.isArray(e)){const i=t.Point.convert(e);return{center:i,top:i,"top-left":i,"top-right":i,bottom:i,"bottom-left":i,"bottom-right":i,left:i,right:i}}return{center:t.Point.convert(e.center||[0,0]),top:t.Point.convert(e.top||[0,0]),"top-left":t.Point.convert(e["top-left"]||[0,0]),"top-right":t.Point.convert(e["top-right"]||[0,0]),bottom:t.Point.convert(e.bottom||[0,0]),"bottom-left":t.Point.convert(e["bottom-left"]||[0,0]),"bottom-right":t.Point.convert(e["bottom-right"]||[0,0]),left:t.Point.convert(e.left||[0,0]),right:t.Point.convert(e.right||[0,0])}}return Rn(new t.Point(0,0))}const Bn={extend:(e,...i)=>t.extend(e,...i),run(t){t()},logToElement(t,e=!1,i="log"){const r=window.document.getElementById(i);r&&(e&&(r.innerHTML=""),r.innerHTML+=`<br>${t}`)}},Fn=e;class On{static get version(){return Fn}static get workerCount(){return tt.workerCount}static set workerCount(t){tt.workerCount=t}static get maxParallelImageRequests(){return t.config.MAX_PARALLEL_IMAGE_REQUESTS}static set maxParallelImageRequests(e){t.config.MAX_PARALLEL_IMAGE_REQUESTS=e}static get workerUrl(){return t.config.WORKER_URL}static set workerUrl(e){t.config.WORKER_URL=e}static addProtocol(e,i){t.config.REGISTERED_PROTOCOLS[e]=i}static removeProtocol(e){delete t.config.REGISTERED_PROTOCOLS[e]}}return On.Map=class extends on{constructor(e){if(t.PerformanceUtils.mark(t.PerformanceMarkers.create),null!=(e=t.extend({},yn,e)).minZoom&&null!=e.maxZoom&&e.minZoom>e.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(null!=e.minPitch&&null!=e.maxPitch&&e.minPitch>e.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(null!=e.minPitch&&e.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(null!=e.maxPitch&&e.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new or(e.minZoom,e.maxZoom,e.minPitch,e.maxPitch,e.renderWorldCopies),{bearingSnap:e.bearingSnap}),this._cooperativeGesturesOnWheel=t=>{this._onCooperativeGesture(t,t[this._metaKey],1)},this._contextLost=e=>{e.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new t.Event("webglcontextlost",{originalEvent:e}))},this._contextRestored=e=>{this._setupPainter(),this.resize(),this._update(),this.fire(new t.Event("webglcontextrestored",{originalEvent:e}))},this._onMapScroll=t=>{if(t.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=e.interactive,this._cooperativeGestures=e.cooperativeGestures,this._metaKey=0===navigator.platform.indexOf("Mac")?"metaKey":"ctrlKey",this._maxTileCacheSize=e.maxTileCacheSize,this._maxTileCacheZoomLevels=e.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=e.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=e.preserveDrawingBuffer,this._antialias=e.antialias,this._trackResize=e.trackResize,this._bearingSnap=e.bearingSnap,this._refreshExpiredTiles=e.refreshExpiredTiles,this._fadeDuration=e.fadeDuration,this._crossSourceCollisions=e.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=e.collectResourceTiming,this._renderTaskQueue=new cn,this._controls=[],this._mapId=t.uniqueId(),this._locale=t.extend({},hn,e.locale),this._clickTolerance=e.clickTolerance,this._overridePixelRatio=e.pixelRatio,this._maxCanvasSize=e.maxCanvasSize,this.transformCameraUpdate=e.transformCameraUpdate,this._imageQueueHandle=c.addThrottleControl((()=>this.isMoving())),this._requestManager=new u(e.transformRequest),"string"==typeof e.container){if(this._container=document.getElementById(e.container),!this._container)throw new Error(`Container '${e.container}' not found.`)}else{if(!(e.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=e.container}if(e.maxBounds&&this.setMaxBounds(e.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",(()=>this._update(!1))),this.on("moveend",(()=>this._update(!1))),this.on("zoom",(()=>this._update(!0))),this.on("terrain",(()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)})),this.once("idle",(()=>{this._idleTriggered=!0})),"undefined"!=typeof window){addEventListener("online",this._onWindowOnline,!1);let t=!1;const e=sr((t=>{this._trackResize&&!this._removed&&this.resize(t)._update()}),50);this._resizeObserver=new ResizeObserver((i=>{t?e(i):t=!0})),this._resizeObserver.observe(this._container)}this.handlers=new an(this,e),this._cooperativeGestures&&this._setupCooperativeGestures(),this._hash=e.hash&&new lr("string"==typeof e.hash&&e.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:e.center,zoom:e.zoom,bearing:e.bearing,pitch:e.pitch}),e.bounds&&(this.resize(),this.fitBounds(e.bounds,t.extend({},e.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=e.localIdeographFontFamily,this._validateStyle=e.validateStyle,e.style&&this.setStyle(e.style,{localIdeographFontFamily:e.localIdeographFontFamily}),e.attributionControl&&this.addControl(new sn({customAttribution:e.customAttribution})),e.maplibreLogo&&this.addControl(new ln,e.logoPosition),this.on("style.load",(()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)})),this.on("data",(e=>{this._update("style"===e.dataType),this.fire(new t.Event(`${e.dataType}data`,e))})),this.on("dataloading",(e=>{this.fire(new t.Event(`${e.dataType}dataloading`,e))})),this.on("dataabort",(e=>{this.fire(new t.Event("sourcedataabort",e))}))}_getMapId(){return this._mapId}addControl(e,i){if(void 0===i&&(i=e.getDefaultPosition?e.getDefaultPosition():"top-right"),!e||!e.onAdd)return this.fire(new t.ErrorEvent(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const r=e.onAdd(this);this._controls.push(e);const n=this._controlPositions[i];return-1!==i.indexOf("bottom")?n.insertBefore(r,n.firstChild):n.appendChild(r),this}removeControl(e){if(!e||!e.onRemove)return this.fire(new t.ErrorEvent(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const i=this._controls.indexOf(e);return i>-1&&this._controls.splice(i,1),e.onRemove(this),this}hasControl(t){return this._controls.indexOf(t)>-1}calculateCameraOptionsFromTo(t,e,i,r){return null==r&&this.terrain&&(r=this.terrain.getElevationForLngLatZoom(i,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(t,e,i,r)}resize(e){var i;const r=this._containerDimensions(),n=r[0],a=r[1],o=this._getClampedPixelRatio(n,a);if(this._resizeCanvas(n,a,o),this.painter.resize(n,a,o),this.painter.overLimit()){const t=this.painter.context.gl;this._maxCanvasSize=[t.drawingBufferWidth,t.drawingBufferHeight];const e=this._getClampedPixelRatio(n,a);this._resizeCanvas(n,a,e),this.painter.resize(n,a,e)}this.transform.resize(n,a),null===(i=this._requestedCameraState)||void 0===i||i.resize(n,a);const s=!this._moving;return s&&(this.stop(),this.fire(new t.Event("movestart",e)).fire(new t.Event("move",e))),this.fire(new t.Event("resize",e)),s&&this.fire(new t.Event("moveend",e)),this}_getClampedPixelRatio(t,e){const{0:i,1:r}=this._maxCanvasSize,n=this.getPixelRatio(),a=t*n,o=e*n;return Math.min(a>i?i/a:1,o>r?r/o:1)*n}getPixelRatio(){var t;return null!==(t=this._overridePixelRatio)&&void 0!==t?t:devicePixelRatio}setPixelRatio(t){this._overridePixelRatio=t,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(t){return this.transform.setMaxBounds(z.convert(t)),this._update()}setMinZoom(t){if((t=null==t?-2:t)>=-2&&t<=this.transform.maxZoom)return this.transform.minZoom=t,this._update(),this.getZoom()<t&&this.setZoom(t),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(t){if((t=null==t?22:t)>=this.transform.minZoom)return this.transform.maxZoom=t,this._update(),this.getZoom()>t&&this.setZoom(t),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(t){if((t=null==t?0:t)<0)throw new Error("minPitch must be greater than or equal to 0");if(t>=0&&t<=this.transform.maxPitch)return this.transform.minPitch=t,this._update(),this.getPitch()<t&&this.setPitch(t),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(t){if((t=null==t?60:t)>85)throw new Error("maxPitch must be less than or equal to 85");if(t>=this.transform.minPitch)return this.transform.maxPitch=t,this._update(),this.getPitch()>t&&this.setPitch(t),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(t){return this.transform.renderWorldCopies=t,this._update()}getCooperativeGestures(){return this._cooperativeGestures}setCooperativeGestures(t){return this._cooperativeGestures=t,this._cooperativeGestures?this._setupCooperativeGestures():this._destroyCooperativeGestures(),this}project(e){return this.transform.locationPoint(t.LngLat.convert(e),this.style&&this.terrain)}unproject(e){return this.transform.pointLocation(t.Point.convert(e),this.terrain)}isMoving(){var t;return this._moving||(null===(t=this.handlers)||void 0===t?void 0:t.isMoving())}isZooming(){var t;return this._zooming||(null===(t=this.handlers)||void 0===t?void 0:t.isZooming())}isRotating(){var t;return this._rotating||(null===(t=this.handlers)||void 0===t?void 0:t.isRotating())}_createDelegatedListener(t,e,i){if("mouseenter"===t||"mouseover"===t){let r=!1;const n=n=>{const a=this.getLayer(e)?this.queryRenderedFeatures(n.point,{layers:[e]}):[];a.length?r||(r=!0,i.call(this,new _r(t,this,n.originalEvent,{features:a}))):r=!1};return{layer:e,listener:i,delegates:{mousemove:n,mouseout:()=>{r=!1}}}}if("mouseleave"===t||"mouseout"===t){let r=!1;const n=n=>{(this.getLayer(e)?this.queryRenderedFeatures(n.point,{layers:[e]}):[]).length?r=!0:r&&(r=!1,i.call(this,new _r(t,this,n.originalEvent)))},a=e=>{r&&(r=!1,i.call(this,new _r(t,this,e.originalEvent)))};return{layer:e,listener:i,delegates:{mousemove:n,mouseout:a}}}{const r=t=>{const r=this.getLayer(e)?this.queryRenderedFeatures(t.point,{layers:[e]}):[];r.length&&(t.features=r,i.call(this,t),delete t.features)};return{layer:e,listener:i,delegates:{[t]:r}}}}on(t,e,i){if(void 0===i)return super.on(t,e);const r=this._createDelegatedListener(t,e,i);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[t]=this._delegatedListeners[t]||[],this._delegatedListeners[t].push(r);for(const t in r.delegates)this.on(t,r.delegates[t]);return this}once(t,e,i){if(void 0===i)return super.once(t,e);const r=this._createDelegatedListener(t,e,i);for(const t in r.delegates)this.once(t,r.delegates[t]);return this}off(t,e,i){return void 0===i?super.off(t,e):(this._delegatedListeners&&this._delegatedListeners[t]&&(r=>{const n=this._delegatedListeners[t];for(let t=0;t<n.length;t++){const r=n[t];if(r.layer===e&&r.listener===i){for(const t in r.delegates)this.off(t,r.delegates[t]);return n.splice(t,1),this}}})(),this)}queryRenderedFeatures(e,i){if(!this.style)return[];let r;const n=e instanceof t.Point||Array.isArray(e),a=n?e:[[0,0],[this.transform.width,this.transform.height]];if(i=i||(n?{}:e)||{},a instanceof t.Point||"number"==typeof a[0])r=[t.Point.convert(a)];else{const e=t.Point.convert(a[0]),i=t.Point.convert(a[1]);r=[e,new t.Point(i.x,e.y),i,new t.Point(e.x,i.y),e]}return this.style.queryRenderedFeatures(r,i,this.transform)}querySourceFeatures(t,e){return this.style.querySourceFeatures(t,e)}setStyle(e,i){return!1!==(i=t.extend({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},i)).diff&&i.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&e?(this._diffStyle(e,i),this):(this._localIdeographFontFamily=i.localIdeographFontFamily,this._updateStyle(e,i))}setTransformRequest(t){return this._requestManager.setTransformRequest(t),this}_getUIString(t){const e=this._locale[t];if(null==e)throw new Error(`Missing UI string '${t}'`);return e}_updateStyle(t,e){if(e.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",(()=>this._updateStyle(t,e)));const i=this.style&&e.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!t)),t?(this.style=new re(this,e||{}),this.style.setEventedParent(this,{style:this.style}),"string"==typeof t?this.style.loadURL(t,e,i):this.style.loadJSON(t,e,i),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new re(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(e,i){if("string"==typeof e){const r=this._requestManager.transformRequest(e,h.Style);t.getJSON(r,((e,r)=>{e?this.fire(new t.ErrorEvent(e)):r&&this._updateDiff(r,i)}))}else"object"==typeof e&&this._updateDiff(e,i)}_updateDiff(e,i){try{this.style.setState(e,i)&&this._update(!0)}catch(r){t.warnOnce(`Unable to perform style diff: ${r.message||r.error||r}. Rebuilding the style from scratch.`),this._updateStyle(e,i)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():t.warnOnce("There is no style added to the map.")}addSource(t,e){return this._lazyInitEmptyStyle(),this.style.addSource(t,e),this._update(!0)}isSourceLoaded(e){const i=this.style&&this.style.sourceCaches[e];if(void 0!==i)return i.loaded();this.fire(new t.ErrorEvent(new Error(`There is no source with ID '${e}'`)))}setTerrain(e){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),e){const i=this.style.sourceCaches[e.source];if(!i)throw new Error(`cannot load terrain, because there exists no source with ID: ${e.source}`);for(const i in this.style._layers){const r=this.style._layers[i];"hillshade"===r.type&&r.source===e.source&&t.warnOnce("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain=new dn(this.painter,i,e),this.painter.renderToTexture=new gn(this.painter,this.terrain),this.transform._minEleveationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._terrainDataCallback=t=>{"style"===t.dataType?this.terrain.sourceCache.freeRtt():"source"===t.dataType&&t.tile&&(t.sourceId!==e.source||this._elevationFreeze||(this.transform._minEleveationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.terrain.sourceCache.freeRtt(t.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform._minEleveationForCurrentTile=0,this.transform.elevation=0;return this.fire(new t.Event("terrain",{terrain:e})),this}getTerrain(){var t,e;return null!==(e=null===(t=this.terrain)||void 0===t?void 0:t.options)&&void 0!==e?e:null}areTilesLoaded(){const t=this.style&&this.style.sourceCaches;for(const e in t){const i=t[e]._tiles;for(const t in i){const e=i[t];if("loaded"!==e.state&&"errored"!==e.state)return!1}}return!0}addSourceType(t,e,i){return this._lazyInitEmptyStyle(),this.style.addSourceType(t,e,i)}removeSource(t){return this.style.removeSource(t),this._update(!0)}getSource(t){return this.style.getSource(t)}addImage(e,i,r={}){const{pixelRatio:n=1,sdf:a=!1,stretchX:o,stretchY:s,content:l}=r;if(this._lazyInitEmptyStyle(),!(i instanceof HTMLImageElement||t.isImageBitmap(i))){if(void 0===i.width||void 0===i.height)return this.fire(new t.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`")));{const{width:r,height:c,data:h}=i,u=i;return this.style.addImage(e,{data:new t.RGBAImage({width:r,height:c},new Uint8Array(h)),pixelRatio:n,stretchX:o,stretchY:s,content:l,sdf:a,version:0,userImage:u}),u.onAdd&&u.onAdd(this,e),this}}{const{width:r,height:c,data:h}=t.browser.getImageData(i);this.style.addImage(e,{data:new t.RGBAImage({width:r,height:c},h),pixelRatio:n,stretchX:o,stretchY:s,content:l,sdf:a,version:0})}}updateImage(e,i){const r=this.style.getImage(e);if(!r)return this.fire(new t.ErrorEvent(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const n=i instanceof HTMLImageElement||t.isImageBitmap(i)?t.browser.getImageData(i):i,{width:a,height:o,data:s}=n;if(void 0===a||void 0===o)return this.fire(new t.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(a!==r.data.width||o!==r.data.height)return this.fire(new t.ErrorEvent(new Error("The width and height of the updated image must be that same as the previous version of the image")));const l=!(i instanceof HTMLImageElement||t.isImageBitmap(i));return r.data.replace(s,l),this.style.updateImage(e,r),this}getImage(t){return this.style.getImage(t)}hasImage(e){return e?!!this.style.getImage(e):(this.fire(new t.ErrorEvent(new Error("Missing required image id"))),!1)}removeImage(t){this.style.removeImage(t)}loadImage(t,e){c.getImage(this._requestManager.transformRequest(t,h.Image),e)}listImages(){return this.style.listImages()}addLayer(t,e){return this._lazyInitEmptyStyle(),this.style.addLayer(t,e),this._update(!0)}moveLayer(t,e){return this.style.moveLayer(t,e),this._update(!0)}removeLayer(t){return this.style.removeLayer(t),this._update(!0)}getLayer(t){return this.style.getLayer(t)}setLayerZoomRange(t,e,i){return this.style.setLayerZoomRange(t,e,i),this._update(!0)}setFilter(t,e,i={}){return this.style.setFilter(t,e,i),this._update(!0)}getFilter(t){return this.style.getFilter(t)}setPaintProperty(t,e,i,r={}){return this.style.setPaintProperty(t,e,i,r),this._update(!0)}getPaintProperty(t,e){return this.style.getPaintProperty(t,e)}setLayoutProperty(t,e,i,r={}){return this.style.setLayoutProperty(t,e,i,r),this._update(!0)}getLayoutProperty(t,e){return this.style.getLayoutProperty(t,e)}setGlyphs(t,e={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(t,e),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(t,e,i={}){return this._lazyInitEmptyStyle(),this.style.addSprite(t,e,i,(t=>{t||this._update(!0)})),this}removeSprite(t){return this._lazyInitEmptyStyle(),this.style.removeSprite(t),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(t,e={}){return this._lazyInitEmptyStyle(),this.style.setSprite(t,e,(t=>{t||this._update(!0)})),this}setLight(t,e={}){return this._lazyInitEmptyStyle(),this.style.setLight(t,e),this._update(!0)}getLight(){return this.style.getLight()}setFeatureState(t,e){return this.style.setFeatureState(t,e),this._update()}removeFeatureState(t,e){return this.style.removeFeatureState(t,e),this._update()}getFeatureState(t){return this.style.getFeatureState(t)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let t=0,e=0;return this._container&&(t=this._container.clientWidth||400,e=this._container.clientHeight||300),[t,e]}_setupContainer(){const t=this._container;t.classList.add("maplibregl-map");const e=this._canvasContainer=i.create("div","maplibregl-canvas-container",t);this._interactive&&e.classList.add("maplibregl-interactive"),this._canvas=i.create("canvas","maplibregl-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");const r=this._containerDimensions(),n=this._getClampedPixelRatio(r[0],r[1]);this._resizeCanvas(r[0],r[1],n);const a=this._controlContainer=i.create("div","maplibregl-control-container",t),o=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach((t=>{o[t]=i.create("div",`maplibregl-ctrl-${t} `,a)})),this._container.addEventListener("scroll",this._onMapScroll,!1)}_setupCooperativeGestures(){this._cooperativeGesturesScreen=i.create("div","maplibregl-cooperative-gesture-screen",this._container);let t="boolean"!=typeof this._cooperativeGestures&&this._cooperativeGestures.windowsHelpText?this._cooperativeGestures.windowsHelpText:"Use Ctrl + scroll to zoom the map";0===navigator.platform.indexOf("Mac")&&(t="boolean"!=typeof this._cooperativeGestures&&this._cooperativeGestures.macHelpText?this._cooperativeGestures.macHelpText:"Use ⌘ + scroll to zoom the map"),this._cooperativeGesturesScreen.innerHTML=`\n <div class="maplibregl-desktop-message">${t}</div>\n <div class="maplibregl-mobile-message">${"boolean"!=typeof this._cooperativeGestures&&this._cooperativeGestures.mobileHelpText?this._cooperativeGestures.mobileHelpText:"Use two fingers to move the map"}</div>\n `,this._cooperativeGesturesScreen.setAttribute("aria-hidden","true"),this._canvasContainer.addEventListener("wheel",this._cooperativeGesturesOnWheel,!1),this._canvasContainer.classList.add("maplibregl-cooperative-gestures")}_destroyCooperativeGestures(){i.remove(this._cooperativeGesturesScreen),this._canvasContainer.removeEventListener("wheel",this._cooperativeGesturesOnWheel,!1),this._canvasContainer.classList.remove("maplibregl-cooperative-gestures")}_resizeCanvas(t,e,i){this._canvas.width=Math.floor(i*t),this._canvas.height=Math.floor(i*e),this._canvas.style.width=`${t}px`,this._canvas.style.height=`${e}px`}_setupPainter(){const t={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1};let e=null;this._canvas.addEventListener("webglcontextcreationerror",(i=>{e={requestedAttributes:t},i&&(e.statusMessage=i.statusMessage,e.type=i.type)}),{once:!0});const i=this._canvas.getContext("webgl2",t)||this._canvas.getContext("webgl",t);if(!i){const t="Failed to initialize WebGL";throw e?(e.message=t,new Error(JSON.stringify(e))):new Error(t)}this.painter=new ir(i,this.transform),r.testSupport(i)}_onCooperativeGesture(t,e,i){return!e&&i<2&&(this._cooperativeGesturesScreen.classList.add("maplibregl-show"),setTimeout((()=>{this._cooperativeGesturesScreen.classList.remove("maplibregl-show")}),100)),!1}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(t){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||t,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(t){return this._update(),this._renderTaskQueue.add(t)}_cancelRenderFrame(t){this._renderTaskQueue.remove(t)}_render(e){const i=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(e),this._removed)return;let r=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const e=this.transform.zoom,n=t.browser.now();this.style.zoomHistory.update(e,n);const a=new t.EvaluationParameters(e,{now:n,fadeDuration:i,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),o=a.crossFadingFactor();1===o&&o===this._crossFadingFactor||(r=!0,this._crossFadingFactor=o),this.style.update(a)}this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform._minEleveationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._elevationFreeze||(this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform._minEleveationForCurrentTile=0,this.transform.elevation=0),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,i,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:i,showPadding:this.showPadding}),this.fire(new t.Event("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,t.PerformanceUtils.mark(t.PerformanceMarkers.load),this.fire(new t.Event("load"))),this.style&&(this.style.hasTransitions()||r)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const n=this._sourcesDirty||this._styleDirty||this._placementDirty;return n||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new t.Event("idle")),!this._loaded||this._fullyLoaded||n||(this._fullyLoaded=!0,t.PerformanceUtils.mark(t.PerformanceMarkers.fullLoad)),this}redraw(){return this.style&&(this._frame&&(this._frame.cancel(),this._frame=null),this._render(0)),this}remove(){var e;this._hash&&this._hash.remove();for(const t of this._controls)t.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),"undefined"!=typeof window&&removeEventListener("online",this._onWindowOnline,!1),c.removeThrottleControl(this._imageQueueHandle),null===(e=this._resizeObserver)||void 0===e||e.disconnect();const r=this.painter.context.gl.getExtension("WEBGL_lose_context");r&&r.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),i.remove(this._canvasContainer),i.remove(this._controlContainer),this._cooperativeGestures&&this._destroyCooperativeGestures(),this._container.classList.remove("maplibregl-map"),t.PerformanceUtils.clearMetrics(),this._removed=!0,this.fire(new t.Event("remove"))}triggerRepaint(){this.style&&!this._frame&&(this._frame=t.browser.frame((e=>{t.PerformanceUtils.frame(e),this._frame=null,this._render(e)})))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(t){this._showTileBoundaries!==t&&(this._showTileBoundaries=t,this._update())}get showPadding(){return!!this._showPadding}set showPadding(t){this._showPadding!==t&&(this._showPadding=t,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(t){this._showCollisionBoxes!==t&&(this._showCollisionBoxes=t,t?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(t){this._showOverdrawInspector!==t&&(this._showOverdrawInspector=t,this._update())}get repaint(){return!!this._repaint}set repaint(t){this._repaint!==t&&(this._repaint=t,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(t){this._vertices=t,this._update()}get version(){return _n}getCameraTargetElevation(){return this.transform.elevation}},On.NavigationControl=class{constructor(e){this._updateZoomButtons=()=>{const t=this._map.getZoom(),e=t===this._map.getMaxZoom(),i=t===this._map.getMinZoom();this._zoomInButton.disabled=e,this._zoomOutButton.disabled=i,this._zoomInButton.setAttribute("aria-disabled",e.toString()),this._zoomOutButton.setAttribute("aria-disabled",i.toString())},this._rotateCompassArrow=()=>{const t=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=t},this._setButtonTitle=(t,e)=>{const i=this._map._getUIString(`NavigationControl.${e}`);t.title=i,t.setAttribute("aria-label",i)},this.options=t.extend({},vn,e),this._container=i.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",(t=>t.preventDefault())),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",(t=>this._map.zoomIn({},{originalEvent:t}))),i.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",(t=>this._map.zoomOut({},{originalEvent:t}))),i.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",(t=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:t}):this._map.resetNorth({},{originalEvent:t})})),this._compassIcon=i.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(t){return this._map=t,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 bn(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){i.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(t,e){const r=i.create("button",t,this._container);return r.type="button",r.addEventListener("click",e),r}},On.GeolocateControl=class extends t.Evented{constructor(e){super(),this._onSuccess=e=>{if(this._map){if(this._isOutOfMapMaxBounds(e))return this._setErrorState(),this.fire(new t.Event("outofmaxbounds",e)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=e,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&"OFF"!==this._watchState&&this._updateMarker(e),this.options.trackUserLocation&&"ACTIVE_LOCK"!==this._watchState||this._updateCamera(e),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new t.Event("geolocate",e)),this._finish()}},this._updateCamera=e=>{const i=new t.LngLat(e.coords.longitude,e.coords.latitude),r=e.coords.accuracy,n=this._map.getBearing(),a=t.extend({bearing:n},this.options.fitBoundsOptions),o=z.fromLngLat(i,r);this._map.fitBounds(o,a,{geolocateSource:!0})},this._updateMarker=e=>{if(e){const i=new t.LngLat(e.coords.longitude,e.coords.latitude);this._accuracyCircleMarker.setLngLat(i).addTo(this._map),this._userLocationDotMarker.setLngLat(i).addTo(this._map),this._accuracy=e.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onZoom=()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},this._onError=e=>{if(this._map){if(this.options.trackUserLocation)if(1===e.code){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t),void 0!==this._geolocationWatchID&&this._clearWatch()}else{if(3===e.code&&Mn)return;this._setErrorState()}"OFF"!==this._watchState&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new t.Event("error",e)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=e=>{if(this._map){if(this._container.addEventListener("contextmenu",(t=>t.preventDefault())),this._geolocateButton=i.create("button","maplibregl-ctrl-geolocate",this._container),i.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",!1===e){t.warnOnce("Geolocation support is not available so the GeolocateControl will be disabled.");const e=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=e,this._geolocateButton.setAttribute("aria-label",e)}else{const t=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=i.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new Cn({element:this._dotElement}),this._circleElement=i.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Cn({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||"ACTIVE_LOCK"!==this._watchState||e.originalEvent&&"resize"===e.originalEvent.type||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new t.Event("trackuserlocationend")))}))}},this.options=t.extend({},In,e)}onAdd(t){return this._map=t,this._container=i.create("div","maplibregl-ctrl maplibregl-ctrl-group"),function(t,e=!1){void 0===wn||e?void 0!==window.navigator.permissions?window.navigator.permissions.query({name:"geolocation"}).then((e=>{wn="denied"!==e.state,t(wn)})).catch((()=>{wn=!!window.navigator.geolocation,t(wn)})):(wn=!!window.navigator.geolocation,t(wn)):t(wn)}(this._setupUI),this._container}onRemove(){void 0!==this._geolocationWatchID&&(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(),i.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,An=0,Mn=!1}_isOutOfMapMaxBounds(t){const e=this._map.getMaxBounds(),i=t.coords;return e&&(i.longitude<e.getWest()||i.longitude>e.getEast()||i.latitude<e.getSouth()||i.latitude>e.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadius(){const t=this._map.getBounds(),e=t.getSouthEast(),i=t.getNorthEast(),r=e.distanceTo(i),n=Math.ceil(this._accuracy/(r/this._map._container.clientHeight)*2);this._circleElement.style.width=`${n}px`,this._circleElement.style.height=`${n}px`}trigger(){if(!this._setup)return t.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 t.Event("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":An--,Mn=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this.fire(new t.Event("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new t.Event("trackuserlocationstart"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if("OFF"===this._watchState&&void 0!==this._geolocationWatchID)this._clearWatch();else if(void 0===this._geolocationWatchID){let t;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),An++,An>1?(t={maximumAge:6e5,timeout:0},Mn=!0):(t=this.options.positionOptions,Mn=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,t)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},On.AttributionControl=sn,On.LogoControl=ln,On.ScaleControl=class{constructor(e){this._onMove=()=>{Pn(this._map,this._container,this.options)},this.setUnit=t=>{this.options.unit=t,Pn(this._map,this._container,this.options)},this.options=t.extend({},kn,e)}getDefaultPosition(){return"bottom-left"}onAdd(t){return this._map=t,this._container=i.create("div","maplibregl-ctrl maplibregl-ctrl-scale",t.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){i.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},On.FullscreenControl=class extends t.Evented{constructor(e={}){super(),this._onFullscreenChange=()=>{(window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement)===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,e&&e.container&&(e.container instanceof HTMLElement?this._container=e.container:t.warnOnce("Full screen control 'container' must be a DOM element.")),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(t){return this._map=t,this._container||(this._container=this._map.getContainer()),this._controlContainer=i.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){i.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const t=this._fullscreenButton=i.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);i.create("span","maplibregl-ctrl-icon",t).setAttribute("aria-hidden","true"),t.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const t=this._getTitle();this._fullscreenButton.setAttribute("aria-label",t),this._fullscreenButton.title=t}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new t.Event("fullscreenstart")),this._map._cooperativeGestures&&(this._prevCooperativeGestures=this._map._cooperativeGestures,this._map.setCooperativeGestures())):(this.fire(new t.Event("fullscreenend")),this._prevCooperativeGestures&&(this._map.setCooperativeGestures(this._prevCooperativeGestures),delete this._prevCooperativeGestures))}_exitFullscreen(){window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}},On.TerrainControl=class{constructor(t){this._toggleTerrain=()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()},this._updateTerrainIcon=()=>{this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.disableTerrain")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.enableTerrain"))},this.options=t}onAdd(t){return this._map=t,this._container=i.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=i.create("button","maplibregl-ctrl-terrain",this._container),i.create("span","maplibregl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){i.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},On.Popup=class extends t.Evented{constructor(e){super(),this.remove=()=>(this._content&&i.remove(this._content),this._container&&(i.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 t.Event("close")),this),this._onMouseUp=t=>{this._update(t.point)},this._onMouseMove=t=>{this._update(t.point)},this._onDrag=t=>{this._update(t.point)},this._update=t=>{if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=i.create("div","maplibregl-popup",this._map.getContainer()),this._tip=i.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const t of this.options.className.split(" "))this._container.classList.add(t);this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._map.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=En(this._lngLat,this._pos,this._map.transform)),this._trackPointer&&!t)return;const e=this._pos=this._trackPointer&&t?t:this._map.project(this._lngLat);let r=this.options.anchor;const n=Rn(this.options.offset);if(!r){const t=this._container.offsetWidth,i=this._container.offsetHeight;let a;a=e.y+n.bottom.y<i?["top"]:e.y>this._map.transform.height-i?["bottom"]:[],e.x<t/2?a.push("left"):e.x>this._map.transform.width-t/2&&a.push("right"),r=0===a.length?"bottom":a.join("-")}const a=e.add(n[r]).round();i.setTransform(this._container,`${Tn[r]} translate(${a.x}px,${a.y}px)`),Sn(this._container,r,"popup")},this._onClose=()=>{this.remove()},this.options=t.extend(Object.create(Ln),e)}addTo(e){return this._map&&this.remove(),this._map=e,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new t.Event("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=t.LngLat.convert(e),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"),this._map._canvasContainer.classList.remove("maplibregl-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"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(t){return this.setDOMContent(document.createTextNode(t))}setHTML(t){const e=document.createDocumentFragment(),i=document.createElement("body");let r;for(i.innerHTML=t;r=i.firstChild,r;)e.appendChild(r);return this.setDOMContent(e)}getMaxWidth(){var t;return null===(t=this._container)||void 0===t?void 0:t.style.maxWidth}setMaxWidth(t){return this.options.maxWidth=t,this._update(),this}setDOMContent(t){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=i.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(t),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(t){this._container&&this._container.classList.add(t)}removeClassName(t){this._container&&this._container.classList.remove(t)}setOffset(t){return this.options.offset=t,this._update(),this}toggleClassName(t){if(this._container)return this._container.classList.toggle(t)}_createCloseButton(){this.options.closeButton&&(this._closeButton=i.create("button","maplibregl-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))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const t=this._container.querySelector(Dn);t&&t.focus()}},On.Marker=Cn,On.Style=re,On.LngLat=t.LngLat,On.LngLatBounds=z,On.Point=t.Point,On.MercatorCoordinate=t.MercatorCoordinate,On.Evented=t.Evented,On.AJAXError=t.AJAXError,On.config=t.config,On.CanvasSource=N,On.GeoJSONSource=F,On.ImageSource=U,On.RasterDEMTileSource=B,On.RasterTileSource=R,On.VectorTileSource=D,On.VideoSource=V,On.setRTLTextPlugin=t.setRTLTextPlugin,On.getRTLTextPluginStatus=t.getRTLTextPluginStatus,On.prewarm=function(){rt().acquire(Q)},On.clearPrewarmedResources=function(){const t=it;t&&(t.isPreloaded()&&1===t.numActive()?(t.release(Q),it=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()"))},Bn.extend(On,{isSafari:t.isSafari,getPerformanceMetrics:t.PerformanceUtils.getPerformanceMetrics}),On})),i}()}},a={};function o(t){var e=a[t];if(void 0!==e)return e.exports;var i=a[t]={id:t,exports:{}};return n[t].call(i.exports,i,i.exports,o),i.exports}o.m=n,o.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return o.d(e,{a:e}),e},e=Object.getPrototypeOf?t=>Object.getPrototypeOf(t):t=>t.__proto__,o.t=function(i,r){if(1&r&&(i=this(i)),8&r)return i;if("object"==typeof i&&i){if(4&r&&i.__esModule)return i;if(16&r&&"function"==typeof i.then)return i}var n=Object.create(null);o.r(n);var a={};t=t||[null,e({}),e([]),e(e)];for(var s=2&r&&i;"object"==typeof s&&!~t.indexOf(s);s=e(s))Object.getOwnPropertyNames(s).forEach((t=>a[t]=()=>i[t]));return a.default=()=>i,o.d(n,a),n},o.d=(t,e)=>{for(var i in e)o.o(e,i)&&!o.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},o.f={},o.e=t=>Promise.all(Object.keys(o.f).reduce(((e,i)=>(o.f[i](t,e),e)),[])),o.u=t=>"embed-chunks/"+{36:"b52b89229e47dc93c64b",730:"d0f087405f7ae2fcf1c1"}[t]+".js",o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),o.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),i={},r="geoloniaEmbed:",o.l=(t,e,n,a)=>{if(i[t])i[t].push(e);else{var s,l;if(void 0!==n)for(var c=document.getElementsByTagName("script"),h=0;h<c.length;h++){var u=c[h];if(u.getAttribute("src")==t||u.getAttribute("data-webpack")==r+n){s=u;break}}s||(l=!0,(s=document.createElement("script")).charset="utf-8",s.timeout=120,o.nc&&s.setAttribute("nonce",o.nc),s.setAttribute("data-webpack",r+n),s.src=t),i[t]=[e];var p=(e,r)=>{s.onerror=s.onload=null,clearTimeout(d);var n=i[t];if(delete i[t],s.parentNode&&s.parentNode.removeChild(s),n&&n.forEach((t=>t(r))),e)return e(r)},d=setTimeout(p.bind(null,void 0,{type:"timeout",target:s}),12e4);s.onerror=p.bind(null,s.onerror),s.onload=p.bind(null,s.onload),l&&document.head.appendChild(s)}},o.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},(()=>{var t;o.g.importScripts&&(t=o.g.location+"");var e=o.g.document;if(!t&&e&&(e.currentScript&&(t=e.currentScript.src),!t)){var i=e.getElementsByTagName("script");if(i.length)for(var r=i.length-1;r>-1&&!t;)t=i[r--].src}if(!t)throw new Error("Automatic publicPath is not supported in this browser");t=t.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),o.p=t})(),(()=>{o.b=document.baseURI||self.location.href;var t={179:0};o.f.j=(e,i)=>{var r=o.o(t,e)?t[e]:void 0;if(0!==r)if(r)i.push(r[2]);else{var n=new Promise(((i,n)=>r=t[e]=[i,n]));i.push(r[2]=n);var a=o.p+o.u(e),s=new Error;o.l(a,(i=>{if(o.o(t,e)&&(0!==(r=t[e])&&(t[e]=void 0),r)){var n=i&&("load"===i.type?"missing":i.type),a=i&&i.target&&i.target.src;s.message="Loading chunk "+e+" failed.\n("+n+": "+a+")",s.name="ChunkLoadError",s.type=n,s.request=a,r[1](s)}}),"chunk-"+e,e)}};var e=(e,i)=>{var r,n,[a,s,l]=i,c=0;if(a.some((e=>0!==t[e]))){for(r in s)o.o(s,r)&&(o.m[r]=s[r]);l&&l(o)}for(e&&e(i);c<a.length;c++)n=a[c],o.o(t,n)&&t[n]&&t[n][0](),t[n]=0},i=self.webpackChunkgeoloniaEmbed=self.webpackChunkgeoloniaEmbed||[];i.forEach(e.bind(null,0)),i.push=e.bind(null,i.push.bind(i))})(),o.nc=void 0;var s={};return(()=>{"use strict";o.r(s),o.d(s,{Map:()=>Tt,Marker:()=>Q,SimpleStyle:()=>xt,embedVersion:()=>St,geolonia:()=>qe});var t=o(4613),e=o.n(t);function i(t){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i(t)}var r=/^\s+/,n=/\s+$/;function a(t,e){if(e=e||{},(t=t||"")instanceof a)return t;if(!(this instanceof a))return new a(t,e);var o=function(t){var e,a,o,s={r:0,g:0,b:0},l=1,c=null,h=null,u=null,p=!1,d=!1;return"string"==typeof t&&(t=function(t){t=t.replace(r,"").replace(n,"").toLowerCase();var e,i=!1;if(T[t])t=T[t],i=!0;else if("transparent"==t)return{r:0,g:0,b:0,a:0,format:"name"};return(e=F.rgb.exec(t))?{r:e[1],g:e[2],b:e[3]}:(e=F.rgba.exec(t))?{r:e[1],g:e[2],b:e[3],a:e[4]}:(e=F.hsl.exec(t))?{h:e[1],s:e[2],l:e[3]}:(e=F.hsla.exec(t))?{h:e[1],s:e[2],l:e[3],a:e[4]}:(e=F.hsv.exec(t))?{h:e[1],s:e[2],v:e[3]}:(e=F.hsva.exec(t))?{h:e[1],s:e[2],v:e[3],a:e[4]}:(e=F.hex8.exec(t))?{r:M(e[1]),g:M(e[2]),b:M(e[3]),a:L(e[4]),format:i?"name":"hex8"}:(e=F.hex6.exec(t))?{r:M(e[1]),g:M(e[2]),b:M(e[3]),format:i?"name":"hex"}:(e=F.hex4.exec(t))?{r:M(e[1]+""+e[1]),g:M(e[2]+""+e[2]),b:M(e[3]+""+e[3]),a:L(e[4]+""+e[4]),format:i?"name":"hex8"}:!!(e=F.hex3.exec(t))&&{r:M(e[1]+""+e[1]),g:M(e[2]+""+e[2]),b:M(e[3]+""+e[3]),format:i?"name":"hex"}}(t)),"object"==i(t)&&(O(t.r)&&O(t.g)&&O(t.b)?(e=t.r,a=t.g,o=t.b,s={r:255*I(e,255),g:255*I(a,255),b:255*I(o,255)},p=!0,d="%"===String(t.r).substr(-1)?"prgb":"rgb"):O(t.h)&&O(t.s)&&O(t.v)?(c=P(t.s),h=P(t.v),s=function(t,e,i){t=6*I(t,360),e=I(e,100),i=I(i,100);var r=Math.floor(t),n=t-r,a=i*(1-e),o=i*(1-n*e),s=i*(1-(1-n)*e),l=r%6;return{r:255*[i,o,a,a,s,i][l],g:255*[s,i,i,o,a,a][l],b:255*[a,a,s,i,i,o][l]}}(t.h,c,h),p=!0,d="hsv"):O(t.h)&&O(t.s)&&O(t.l)&&(c=P(t.s),u=P(t.l),s=function(t,e,i){var r,n,a;function o(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+(e-t)*(2/3-i)*6:t}if(t=I(t,360),e=I(e,100),i=I(i,100),0===e)r=n=a=i;else{var s=i<.5?i*(1+e):i+e-i*e,l=2*i-s;r=o(l,s,t+1/3),n=o(l,s,t),a=o(l,s,t-1/3)}return{r:255*r,g:255*n,b:255*a}}(t.h,c,u),p=!0,d="hsl"),t.hasOwnProperty("a")&&(l=t.a)),l=C(l),{ok:p,format:t.format||d,r:Math.min(255,Math.max(s.r,0)),g:Math.min(255,Math.max(s.g,0)),b:Math.min(255,Math.max(s.b,0)),a:l}}(t);this._originalInput=t,this._r=o.r,this._g=o.g,this._b=o.b,this._a=o.a,this._roundA=Math.round(100*this._a)/100,this._format=e.format||o.format,this._gradientType=e.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=o.ok}function l(t,e,i){t=I(t,255),e=I(e,255),i=I(i,255);var r,n,a=Math.max(t,e,i),o=Math.min(t,e,i),s=(a+o)/2;if(a==o)r=n=0;else{var l=a-o;switch(n=s>.5?l/(2-a-o):l/(a+o),a){case t:r=(e-i)/l+(e<i?6:0);break;case e:r=(i-t)/l+2;break;case i:r=(t-e)/l+4}r/=6}return{h:r,s:n,l:s}}function c(t,e,i){t=I(t,255),e=I(e,255),i=I(i,255);var r,n,a=Math.max(t,e,i),o=Math.min(t,e,i),s=a,l=a-o;if(n=0===a?0:l/a,a==o)r=0;else{switch(a){case t:r=(e-i)/l+(e<i?6:0);break;case e:r=(i-t)/l+2;break;case i:r=(t-e)/l+4}r/=6}return{h:r,s:n,v:s}}function h(t,e,i,r){var n=[k(Math.round(t).toString(16)),k(Math.round(e).toString(16)),k(Math.round(i).toString(16))];return r&&n[0].charAt(0)==n[0].charAt(1)&&n[1].charAt(0)==n[1].charAt(1)&&n[2].charAt(0)==n[2].charAt(1)?n[0].charAt(0)+n[1].charAt(0)+n[2].charAt(0):n.join("")}function u(t,e,i,r){return[k(z(r)),k(Math.round(t).toString(16)),k(Math.round(e).toString(16)),k(Math.round(i).toString(16))].join("")}function p(t,e){e=0===e?0:e||10;var i=a(t).toHsl();return i.s-=e/100,i.s=A(i.s),a(i)}function d(t,e){e=0===e?0:e||10;var i=a(t).toHsl();return i.s+=e/100,i.s=A(i.s),a(i)}function m(t){return a(t).desaturate(100)}function f(t,e){e=0===e?0:e||10;var i=a(t).toHsl();return i.l+=e/100,i.l=A(i.l),a(i)}function g(t,e){e=0===e?0:e||10;var i=a(t).toRgb();return i.r=Math.max(0,Math.min(255,i.r-Math.round(-e/100*255))),i.g=Math.max(0,Math.min(255,i.g-Math.round(-e/100*255))),i.b=Math.max(0,Math.min(255,i.b-Math.round(-e/100*255))),a(i)}function _(t,e){e=0===e?0:e||10;var i=a(t).toHsl();return i.l-=e/100,i.l=A(i.l),a(i)}function y(t,e){var i=a(t).toHsl(),r=(i.h+e)%360;return i.h=r<0?360+r:r,a(i)}function x(t){var e=a(t).toHsl();return e.h=(e.h+180)%360,a(e)}function v(t,e){if(isNaN(e)||e<=0)throw new Error("Argument to polyad must be a positive number");for(var i=a(t).toHsl(),r=[a(t)],n=360/e,o=1;o<e;o++)r.push(a({h:(i.h+o*n)%360,s:i.s,l:i.l}));return r}function b(t){var e=a(t).toHsl(),i=e.h;return[a(t),a({h:(i+72)%360,s:e.s,l:e.l}),a({h:(i+216)%360,s:e.s,l:e.l})]}function w(t,e,i){e=e||6,i=i||30;var r=a(t).toHsl(),n=360/i,o=[a(t)];for(r.h=(r.h-(n*e>>1)+720)%360;--e;)r.h=(r.h+n)%360,o.push(a(r));return o}function E(t,e){e=e||6;for(var i=a(t).toHsv(),r=i.h,n=i.s,o=i.v,s=[],l=1/e;e--;)s.push(a({h:r,s:n,v:o})),o=(o+l)%1;return s}a.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(299*t.r+587*t.g+114*t.b)/1e3},getLuminance:function(){var t,e,i,r=this.toRgb();return t=r.r/255,e=r.g/255,i=r.b/255,.2126*(t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4))+.7152*(e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4))+.0722*(i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4))},setAlpha:function(t){return this._a=C(t),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var t=c(this._r,this._g,this._b);return{h:360*t.h,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=c(this._r,this._g,this._b),e=Math.round(360*t.h),i=Math.round(100*t.s),r=Math.round(100*t.v);return 1==this._a?"hsv("+e+", "+i+"%, "+r+"%)":"hsva("+e+", "+i+"%, "+r+"%, "+this._roundA+")"},toHsl:function(){var t=l(this._r,this._g,this._b);return{h:360*t.h,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=l(this._r,this._g,this._b),e=Math.round(360*t.h),i=Math.round(100*t.s),r=Math.round(100*t.l);return 1==this._a?"hsl("+e+", "+i+"%, "+r+"%)":"hsla("+e+", "+i+"%, "+r+"%, "+this._roundA+")"},toHex:function(t){return h(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return function(t,e,i,r,n){var a=[k(Math.round(t).toString(16)),k(Math.round(e).toString(16)),k(Math.round(i).toString(16)),k(z(r))];return n&&a[0].charAt(0)==a[0].charAt(1)&&a[1].charAt(0)==a[1].charAt(1)&&a[2].charAt(0)==a[2].charAt(1)&&a[3].charAt(0)==a[3].charAt(1)?a[0].charAt(0)+a[1].charAt(0)+a[2].charAt(0)+a[3].charAt(0):a.join("")}(this._r,this._g,this._b,this._a,t)},toHex8String:function(t){return"#"+this.toHex8(t)},toRgb:function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:Math.round(100*I(this._r,255))+"%",g:Math.round(100*I(this._g,255))+"%",b:Math.round(100*I(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+Math.round(100*I(this._r,255))+"%, "+Math.round(100*I(this._g,255))+"%, "+Math.round(100*I(this._b,255))+"%)":"rgba("+Math.round(100*I(this._r,255))+"%, "+Math.round(100*I(this._g,255))+"%, "+Math.round(100*I(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(S[h(this._r,this._g,this._b,!0)]||!1)},toFilter:function(t){var e="#"+u(this._r,this._g,this._b,this._a),i=e,r=this._gradientType?"GradientType = 1, ":"";if(t){var n=a(t);i="#"+u(n._r,n._g,n._b,n._a)}return"progid:DXImageTransform.Microsoft.gradient("+r+"startColorstr="+e+",endColorstr="+i+")"},toString:function(t){var e=!!t;t=t||this._format;var i=!1,r=this._a<1&&this._a>=0;return e||!r||"hex"!==t&&"hex6"!==t&&"hex3"!==t&&"hex4"!==t&&"hex8"!==t&&"name"!==t?("rgb"===t&&(i=this.toRgbString()),"prgb"===t&&(i=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(i=this.toHexString()),"hex3"===t&&(i=this.toHexString(!0)),"hex4"===t&&(i=this.toHex8String(!0)),"hex8"===t&&(i=this.toHex8String()),"name"===t&&(i=this.toName()),"hsl"===t&&(i=this.toHslString()),"hsv"===t&&(i=this.toHsvString()),i||this.toHexString()):"name"===t&&0===this._a?this.toName():this.toRgbString()},clone:function(){return a(this.toString())},_applyModification:function(t,e){var i=t.apply(null,[this].concat([].slice.call(e)));return this._r=i._r,this._g=i._g,this._b=i._b,this.setAlpha(i._a),this},lighten:function(){return this._applyModification(f,arguments)},brighten:function(){return this._applyModification(g,arguments)},darken:function(){return this._applyModification(_,arguments)},desaturate:function(){return this._applyModification(p,arguments)},saturate:function(){return this._applyModification(d,arguments)},greyscale:function(){return this._applyModification(m,arguments)},spin:function(){return this._applyModification(y,arguments)},_applyCombination:function(t,e){return t.apply(null,[this].concat([].slice.call(e)))},analogous:function(){return this._applyCombination(w,arguments)},complement:function(){return this._applyCombination(x,arguments)},monochromatic:function(){return this._applyCombination(E,arguments)},splitcomplement:function(){return this._applyCombination(b,arguments)},triad:function(){return this._applyCombination(v,[3])},tetrad:function(){return this._applyCombination(v,[4])}},a.fromRatio=function(t,e){if("object"==i(t)){var r={};for(var n in t)t.hasOwnProperty(n)&&(r[n]="a"===n?t[n]:P(t[n]));t=r}return a(t,e)},a.equals=function(t,e){return!(!t||!e)&&a(t).toRgbString()==a(e).toRgbString()},a.random=function(){return a.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})},a.mix=function(t,e,i){i=0===i?0:i||50;var r=a(t).toRgb(),n=a(e).toRgb(),o=i/100;return a({r:(n.r-r.r)*o+r.r,g:(n.g-r.g)*o+r.g,b:(n.b-r.b)*o+r.b,a:(n.a-r.a)*o+r.a})},a.readability=function(t,e){var i=a(t),r=a(e);return(Math.max(i.getLuminance(),r.getLuminance())+.05)/(Math.min(i.getLuminance(),r.getLuminance())+.05)},a.isReadable=function(t,e,i){var r,n,o,s,l,c=a.readability(t,e);switch(n=!1,(o=i,"AA"!==(s=((o=o||{level:"AA",size:"small"}).level||"AA").toUpperCase())&&"AAA"!==s&&(s="AA"),"small"!==(l=(o.size||"small").toLowerCase())&&"large"!==l&&(l="small"),r={level:s,size:l}).level+r.size){case"AAsmall":case"AAAlarge":n=c>=4.5;break;case"AAlarge":n=c>=3;break;case"AAAsmall":n=c>=7}return n},a.mostReadable=function(t,e,i){var r,n,o,s,l=null,c=0;n=(i=i||{}).includeFallbackColors,o=i.level,s=i.size;for(var h=0;h<e.length;h++)(r=a.readability(t,e[h]))>c&&(c=r,l=a(e[h]));return a.isReadable(t,l,{level:o,size:s})||!n?l:(i.includeFallbackColors=!1,a.mostReadable(t,["#fff","#000"],i))};var T=a.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},S=a.hexNames=function(t){var e={};for(var i in t)t.hasOwnProperty(i)&&(e[t[i]]=i);return e}(T);function C(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function I(t,e){(function(t){return"string"==typeof t&&-1!=t.indexOf(".")&&1===parseFloat(t)})(t)&&(t="100%");var i=function(t){return"string"==typeof t&&-1!=t.indexOf("%")}(t);return t=Math.min(e,Math.max(0,parseFloat(t))),i&&(t=parseInt(t*e,10)/100),Math.abs(t-e)<1e-6?1:t%e/parseFloat(e)}function A(t){return Math.min(1,Math.max(0,t))}function M(t){return parseInt(t,16)}function k(t){return 1==t.length?"0"+t:""+t}function P(t){return t<=1&&(t=100*t+"%"),t}function z(t){return Math.round(255*parseFloat(t)).toString(16)}function L(t){return M(t)/255}var D,R,B,F=(R="[\\s|\\(]+("+(D="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)")+")[,|\\s]+("+D+")[,|\\s]+("+D+")\\s*\\)?",B="[\\s|\\(]+("+D+")[,|\\s]+("+D+")[,|\\s]+("+D+")[,|\\s]+("+D+")\\s*\\)?",{CSS_UNIT:new RegExp(D),rgb:new RegExp("rgb"+R),rgba:new RegExp("rgba"+B),hsl:new RegExp("hsl"+R),hsla:new RegExp("hsla"+B),hsv:new RegExp("hsv"+R),hsva:new RegExp("hsva"+B),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/});function O(t){return!!F.CSS_UNIT.exec(t)}var U,V,N=o(4055),$=o.n(N),j=function(t,e,i,r){if("a"===i&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?r:"a"===i?r.call(t):r?r.value:e.get(t)},q=function(t,e,i,r,n){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!n:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?n.call(t,i):n?n.value=i:e.set(t,i),i};U=new WeakMap,V=new WeakMap;const Z=new class{constructor(){U.set(this,void 0),V.set(this,void 0)}get apiKey(){return j(this,U,"f")||this.parse(),j(this,U,"f")}set apiKey(t){q(this,U,t,"f")}get stage(){return j(this,V,"f")||this.parse(),j(this,V,"f")}set stage(t){q(this,V,t,"f")}parse(t=document){const e=t.currentScript?[t.currentScript]:t.getElementsByTagName("script");for(const t of e){const e=new URL(t.src.startsWith("https://")||t.src.startsWith("http://")||t.src.startsWith("//")?t.src:`https://${location.host}/${t.src}`),i=e.searchParams.get("geolonia-api-key");if(i){q(this,U,i,"f");const t=e.pathname.match(/^\/(v[0-9.]+)\/embed/);t&&t[1]&&q(this,V,t[1],"f");break}}if(j(this,V,"f")||q(this,V,"dev","f"),!j(this,U,"f"))throw new Error("Cannot load API key.")}reset(){q(this,U,void 0,"f"),q(this,V,void 0,"f")}};function G(t){if(t.match(/^https?:\/\//))return t;if(t.match(/^\//)||t.match(/^\.\.?/))try{return new URL(t,location.href).href}catch(t){return console.error("[Geolonia]",t),!1}return!1}function H(){const t=window.navigator.languages&&window.navigator.languages[0]&&window.navigator.languages[0].toLowerCase()||window.navigator.language.toLowerCase();return"ja"===t||"ja-jp"===t?"ja":"en"}function X(t){return"object"==typeof HTMLElement?t instanceof HTMLElement:t&&"object"==typeof t&&null!==t&&1===t.nodeType&&"string"==typeof t.nodeName}function W(t){const e=t.toLowerCase();return["top-right","bottom-right","bottom-left","top-left"].includes(e)?{enabled:!0,position:e}:["on","off"].includes(e)?{enabled:"on"===e,position:void 0}:{enabled:!1,position:void 0}}let K="";const Y=t=>{if(K)return K;{const e=new Uint8Array(t/2);window.crypto.getRandomValues(e);const i=Array.from(e,(t=>t.toString(16).padStart(2,"0"))).join("");return K=i,i}},J=async t=>{const{default:e}=await Promise.all([o.e(36),o.e(730)]).then(o.t.bind(o,1036,23));return e(t,{allowedTags:e.defaults.allowedTags.concat(["img"]),allowedAttributes:{...e.defaults.allowedAttributes,"*":["class"]}})};class Q extends e().Marker{constructor(t={},e={}){if(t=function(t,e){return t&&X(t)?t={element:t,...e}:t||(t=e),t}(t,e),!t||!t.element){const e=document.createElement("div");e.className="geolonia-default-marker",e.innerHTML=$(),e.style.margin="0",e.style.padding="0",e.style.width="26px",e.style.height="34px";const i=e.querySelector("svg");if(i.style.width="100%",i.style.height="100%",t.element=e,t.color)e.querySelector(".left").style.fill=t.color,e.querySelector(".right").style.fill=a(t.color).darken().toString();else{const t="#E4402F";e.querySelector(".left").style.fill=t,e.querySelector(".right").style.fill=a(t).darken().toString()}t.offset=[0,-15]}return super(t),this}}class tt{onAdd(){this.container=document.createElement("div"),this.container.className="maplibregl-ctrl";const t=document.createElement("img");t.src="https://cdn.geolonia.com/logo/geolonia-symbol_1.png",t.style.width="16px",t.style.height="16px",t.style.display="block",t.style.cursor="pointer",t.style.padding="0",t.style.margin="0",t.style.border="none",t.alt="Geolonia";const e=document.createElement("a");return e.href="https://geolonia.com/",e.appendChild(t),e.title="Powered by Geolonia",this.container.appendChild(e),this.container}onRemove(){this.container.parentNode.removeChild(this.container)}getDefaultPosition(){return"bottom-left"}}var et=o(5550),it=o.n(et);class rt{static testProp(t){if(!rt["#docStyle"])return t[0];for(let e=0;e<t.length;e++)if(t[e]in rt["#docStyle"])return t[e];return t[0]}static create(t,e,i){const r=window.document.createElement(t);return void 0!==e&&(r.className=e),i&&i.appendChild(r),r}static createNS(t,e){return window.document.createElementNS(t,e)}static disableDrag(){rt["#docStyle"]&&rt["#selectProp"]&&(rt["#userSelect"]=rt["#docStyle"][rt["#selectProp"]],rt["#docStyle"][rt["#selectProp"]]="none")}static enableDrag(){rt["#docStyle"]&&rt["#selectProp"]&&(rt["#docStyle"][rt["#selectProp"]]=rt["#userSelect"])}static setTransform(t,e){t.style[rt["#transformProp"]]=e}static addEventListener(t,e,i,r){"passive"in r?t.addEventListener(e,i,r):t.addEventListener(e,i,r.capture)}static removeEventListener(t,e,i,r){"passive"in r?t.removeEventListener(e,i,r):t.removeEventListener(e,i,r.capture)}static suppressClick(){window.addEventListener("click",rt["#transformProp"],!0),window.setTimeout((()=>{window.removeEventListener("click",rt["#transformProp"],!0)}),0)}static mousePos(t,e){const i=t.getBoundingClientRect();return new(it())(e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop)}static touchPos(t,e){const i=t.getBoundingClientRect(),r=[];for(let n=0;n<e.length;n++)r.push(new(it())(e[n].clientX-i.left-t.clientLeft,e[n].clientY-i.top-t.clientTop));return r}static mouseButton(t){return t.button}static remove(t){t.parentNode&&t.parentNode.removeChild(t)}}"undefined"!=typeof window&&window.document&&window.document.documentElement.style,rt.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),rt.testProp(["transform","WebkitTransform"]);class nt{constructor(t={}){this.fullscreen=!1,this.id=`mbgl-gesture-handling-help-container-${nt.count}`,nt.count++,this.timer=null;const e="ctrl"!==t.modifierKey;let i=`Use ${e?"alt":"ctrl"} + scroll to zoom the map.`,r="Use two fingers to move the map.";if("ja"===("auto"!==t.lang&&t.lang?t.lang:function(){const t=window.navigator.languages&&window.navigator.languages[0]&&window.navigator.languages[0].toLowerCase()||window.navigator.language.toLowerCase();return"ja"===t||"ja-jp"===t?"ja":"en"}())&&(i=(e?"Alt":"Ctrl")+" キーを押しながらスクロールしてください。",r="2本指を使って操作してください。"),this.settings={backgroundColor:"rgba(0, 0, 0, 0.8)",textColor:"#ffffff",textMessage:i,textMessageMobile:r,timeout:2e3,...t,modifierKey:e?"altKey":"ctrlKey"},this.helpElement=document.querySelector(`#${this.id}`),null===this.helpElement){this.helpElement=document.createElement("div"),this.helpElement.id=this.id,this.helpElement.style.backgroundColor=this.settings.backgroundColor,this.helpElement.style.position="absolute",this.helpElement.style.display="none",this.helpElement.style.zIndex=9999,this.helpElement.style.justifyContent="center",this.helpElement.style.alignItems="center";const t=document.createElement("div");t.style.textAlign="center",t.style.color=this.settings.textColor,t.innerText="",this.helpElement.appendChild(t)}}showHelp(t,e){this.helpElement.style.top=0,this.helpElement.style.left=0,this.helpElement.style.width="100%",this.helpElement.style.height="100%",this.helpElement.style.display="flex",this.helpElement.querySelector("div").innerText=e,t.getContainer().appendChild(this.helpElement)}hideHelp(t){try{t.getContainer().removeChild(this.helpElement)}catch(t){}}addTo(t){t.scrollZoom.disable(),this.helpElement.addEventListener("wheel",(e=>{e[this.settings.modifierKey]||!0===this.fullscreen?(e.preventDefault(),this.hideHelp(t)):(clearTimeout(this.timer),this.timer=setTimeout((()=>{this.hideHelp(t)}),this.settings.timeout))})),t.getContainer().addEventListener("wheel",(e=>{e[this.settings.modifierKey]||!0===this.fullscreen?(e.preventDefault(),t.scrollZoom.isEnabled()||(t.scrollZoom.reset(),t.scrollZoom.enable())):(t.scrollZoom.disable(),this.showHelp(t,this.settings.textMessage),this.timer=setTimeout((()=>{this.hideHelp(t)}),this.settings.timeout))})),this.helpElement.addEventListener("touchstart",(e=>{e.touches&&(2<=e.touches.length||!0===this.fullscreen)&&(clearTimeout(this.timer),this.hideHelp(t),t.dragPan.enable(),e.preventDefault())})),t.on("movestart",(e=>{e.originalEvent&&"touches"in e.originalEvent&&2>e.originalEvent.touches.length&&!1===this.fullscreen&&(this.showHelp(t,this.settings.textMessageMobile),t.dragPan.disable(),this.timer=setTimeout((()=>{t.dragPan.enable(),this.hideHelp(t)}),this.settings.timeout))})),document.addEventListener("fullscreenchange",(()=>{document.fullscreenElement?this.fullscreen=!0:this.fullscreen=!1}))}}nt.count=0;const at=nt,ot=(t,e={})=>{t.dataset||(t.dataset={});let i="auto";return i=t.dataset.lang&&"auto"===t.dataset.lang?H():t.dataset.lang&&"ja"===t.dataset.lang?"ja":t.dataset.lang&&"ja"!==t.dataset.lang?"en":H(),Z.parse(t),{lat:0,lng:0,zoom:0,bearing:0,pitch:0,hash:"off",marker:"on",markerColor:"#E4402F",openPopup:"off",customMarker:"",customMarkerOffset:"0, 0",gestureHandling:!1===e.interactive?"off":"on",navigationControl:!1===e.interactive?"off":"on",geolocateControl:"off",fullscreenControl:"off",scaleControl:"off",geoloniaControl:"on",geojson:"",simpleVector:"",cluster:"on",clusterColor:"#ff0000",style:"geolonia/basic-v1",lang:i,plugin:"off",key:Z.apiKey,apiUrl:`https://api.geolonia.com/${Z.stage}`,stage:Z.stage,loader:"on",minZoom:"",maxZoom:20,"3d":"",...t.dataset}};var st=o(9319),lt=o.n(st);function ct(t){return!isNaN(t)&&null!==t&&!Array.isArray(t)}function ht(t,e,i){if(null!==t)for(var r,n,a,o,s,l,c,h,u=0,p=0,d=t.type,m="FeatureCollection"===d,f="Feature"===d,g=m?t.features.length:1,_=0;_<g;_++){s=(h=!!(c=m?t.features[_].geometry:f?t.geometry:t)&&"GeometryCollection"===c.type)?c.geometries.length:1;for(var y=0;y<s;y++){var x=0,v=0;if(null!==(o=h?c.geometries[y]:c)){l=o.coordinates;var b=o.type;switch(u=!i||"Polygon"!==b&&"MultiPolygon"!==b?0:1,b){case null:break;case"Point":if(!1===e(l,p,_,x,v))return!1;p++,x++;break;case"LineString":case"MultiPoint":for(r=0;r<l.length;r++){if(!1===e(l[r],p,_,x,v))return!1;p++,"MultiPoint"===b&&x++}"LineString"===b&&x++;break;case"Polygon":case"MultiLineString":for(r=0;r<l.length;r++){for(n=0;n<l[r].length-u;n++){if(!1===e(l[r][n],p,_,x,v))return!1;p++}"MultiLineString"===b&&x++,"Polygon"===b&&v++}"Polygon"===b&&x++;break;case"MultiPolygon":for(r=0;r<l.length;r++){for(v=0,n=0;n<l[r].length;n++){for(a=0;a<l[r][n].length-u;a++){if(!1===e(l[r][n][a],p,_,x,v))return!1;p++}v++}x++}break;case"GeometryCollection":for(r=0;r<o.geometries.length;r++)if(!1===ht(o.geometries[r],e,i))return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function ut(t){var e=[1/0,1/0,-1/0,-1/0];return ht(t,(function(t){e[0]>t[0]&&(e[0]=t[0]),e[1]>t[1]&&(e[1]=t[1]),e[2]<t[0]&&(e[2]=t[0]),e[3]<t[1]&&(e[3]=t[1])})),e}ut.default=ut;const pt=ut,dt=function(t,e){void 0===e&&(e={});var i=pt(t);return function(t,e,i){if(void 0===i&&(i={}),!t)throw new Error("coordinates is required");if(!Array.isArray(t))throw new Error("coordinates must be an Array");if(t.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!ct(t[0])||!ct(t[1]))throw new Error("coordinates must contain numbers");return function(t,e,i){void 0===i&&(i={});var r={type:"Feature"};return(0===i.id||i.id)&&(r.id=i.id),i.bbox&&(r.bbox=i.bbox),r.properties=e||{},r.geometry=t,r}({type:"Point",coordinates:t},e,i)}([(i[0]+i[2])/2,(i[1]+i[3])/2],e.properties,e)},mt="#000000",ft="#FFFFFF",gt="rgba(255, 0, 0, 0.4)",_t="#FFFFFF",yt={type:"FeatureCollection",features:[]};class xt{constructor(t,e){this.callFitBounds=!1,this.setGeoJSON(t),this.options={id:"geolonia-simple-style",cluster:!0,heatmap:!1,clusterColor:"#ff0000",...e}}updateData(t){this.setGeoJSON(t);const e=this.geojson.features,i=e.filter((t=>"point"!==t.geometry.type.toLowerCase())),r=e.filter((t=>"point"===t.geometry.type.toLowerCase()));return this.map.getSource(this.options.id).setData({type:"FeatureCollection",features:i}),this.map.getSource(`${this.options.id}-points`).setData({type:"FeatureCollection",features:r}),this}addTo(t){this.map=t;const e=this.geojson.features,i=e.filter((t=>"point"!==t.geometry.type.toLowerCase())),r=e.filter((t=>"point"===t.geometry.type.toLowerCase()));return this.map.addSource(this.options.id,{type:"geojson",data:{type:"FeatureCollection",features:i}}),this.setPolygonGeometries(),this.setLineGeometries(),this.map.addSource(`${this.options.id}-points`,{type:"geojson",data:{type:"FeatureCollection",features:r},cluster:this.options.cluster,clusterMaxZoom:14,clusterRadius:50}),this.map.addLayer({id:`${this.options.id}-polygon-symbol`,type:"symbol",source:this.options.id,filter:["==","$type","Polygon"],paint:{"text-color":["string",["get","text-color"],mt],"text-halo-color":["string",["get","text-halo-color"],ft],"text-halo-width":1},layout:{"text-field":["get","title"],"text-font":["Noto Sans Regular"],"text-size":12,"text-max-width":12,"text-allow-overlap":!1}}),this.map.addLayer({id:`${this.options.id}-linestring-symbol`,type:"symbol",source:this.options.id,filter:["==","$type","LineString"],paint:{"text-color":["string",["get","text-color"],mt],"text-halo-color":["string",["get","text-halo-color"],ft],"text-halo-width":1},layout:{"symbol-placement":"line","text-field":["get","title"],"text-font":["Noto Sans Regular"],"text-size":12,"text-max-width":12,"text-allow-overlap":!1}}),this.setPointGeometries(),this.setCluster(),this}fitBounds(t={}){this.callFitBounds=!0;const e={duration:3e3,padding:30,...t},i=lt()(this.geojson);return i&&window.requestAnimationFrame((()=>{this.map.fitBounds(i,e)})),this}setPolygonGeometries(){this.map.addLayer({id:`${this.options.id}-polygon`,type:"fill",source:this.options.id,filter:["==","$type","Polygon"],paint:{"fill-color":["string",["get","fill"],gt],"fill-opacity":["number",["get","fill-opacity"],1],"fill-outline-color":["string",["get","stroke"],_t]}}),this.setPopup(this.map,`${this.options.id}-polygon`)}setLineGeometries(){this.map.addLayer({id:`${this.options.id}-linestring`,type:"line",source:this.options.id,filter:["==","$type","LineString"],paint:{"line-width":["number",["get","stroke-width"],2],"line-color":["string",["get","stroke"],gt],"line-opacity":["number",["get","stroke-opacity"],1]},layout:{"line-cap":"round","line-join":"round"}}),this.setPopup(this.map,`${this.options.id}-linestring`)}setPointGeometries(){this.map.addLayer({id:`${this.options.id}-circle-points`,type:"circle",source:`${this.options.id}-points`,filter:["all",["!has","point_count"],["!has","marker-symbol"]],paint:{"circle-radius":["case",["==","small",["get","marker-size"]],7,["==","large",["get","marker-size"]],13,9],"circle-color":["string",["get","marker-color"],gt],"circle-opacity":["number",["get","fill-opacity"],1],"circle-stroke-width":["number",["get","stroke-width"],1],"circle-stroke-color":["string",["get","stroke"],_t],"circle-stroke-opacity":["number",["get","stroke-opacity"],1]}}),this.map.addLayer({id:`${this.options.id}-symbol-points`,type:"symbol",source:`${this.options.id}-points`,filter:["!",["has","point_count"]],paint:{"text-color":["string",["get","text-color"],mt],"text-halo-color":["string",["get","text-halo-color"],ft],"text-halo-width":1},layout:{"icon-image":["get","marker-symbol"],"text-field":["get","title"],"text-font":["Noto Sans Regular"],"text-size":12,"text-anchor":"top","text-max-width":12,"text-offset":["case",["==","small",["get","marker-size"]],["literal",[0,.6]],["==","large",["get","marker-size"]],["literal",[0,1.2]],["literal",[0,.8]]],"text-allow-overlap":!0,"icon-allow-overlap":!0,"text-variable-anchor":["top","bottom","left","right"],"text-radial-offset":["case",["==","small",["get","marker-size"]],.6,["==","large",["get","marker-size"]],1.3,.8]}}),this.setPopup(this.map,`${this.options.id}-circle-points`),this.setPopup(this.map,`${this.options.id}-symbol-points`)}async setPopup(t,i){t.on("click",i,(async i=>{const r=dt(i.features[0]).geometry.coordinates,n=i.features[0].properties.description;if(n){const i=await J(n);(new(e().Popup)).setLngLat(r).setHTML(i).addTo(t)}})),t.on("mouseenter",i,(e=>{e.features[0].properties.description&&(t.getCanvas().style.cursor="pointer")})),t.on("mouseleave",i,(()=>{t.getCanvas().style.cursor=""}))}setCluster(){this.map.addLayer({id:`${this.options.id}-clusters`,type:"circle",source:`${this.options.id}-points`,filter:["has","point_count"],paint:{"circle-radius":20,"circle-color":this.options.clusterColor,"circle-opacity":1}}),this.map.addLayer({id:`${this.options.id}-cluster-count`,type:"symbol",source:`${this.options.id}-points`,filter:["has","point_count"],layout:{"text-field":"{point_count_abbreviated}","text-size":14,"text-font":["Noto Sans Regular"]}}),this.map.on("click",`${this.options.id}-clusters`,(t=>{const e=this.map.queryRenderedFeatures(t.point,{layers:[`${this.options.id}-clusters`]}),i=e[0].properties.cluster_id;this.map.getSource(`${this.options.id}-points`).getClusterExpansionZoom(i,((t,i)=>{t||this.map.easeTo({center:e[0].geometry.coordinates,zoom:i})}))})),this.map.on("mouseenter",`${this.options.id}-clusters`,(()=>{this.map.getCanvas().style.cursor="pointer"})),this.map.on("mouseleave",`${this.options.id}-clusters`,(()=>{this.map.getCanvas().style.cursor=""}))}setGeoJSON(t){if("string"==typeof t&&G(t)){this.geojson=yt;const e=async()=>{try{const e=await window.fetch(t),i=await e.json();this.geojson=i,this.updateData(i),this.callFitBounds&&(this.fitBounds(),this.callFitBounds=!1)}catch(t){console.error("[Geolonia] Failed to load GeoJSON:",t)}};this._loadingPromise=e()}else this.geojson=t}}const vt="#000000",bt="#FFFFFF",wt="rgba(255, 0, 0, 0.4)",Et="#FFFFFF";class Tt extends e().Map{constructor(i){const r=function(t){if(X(t))return t;if("string"==typeof t)return document.querySelector(t)||document.getElementById(t)||!1;if(t.container){if(X(t.container))return t.container;if("string"==typeof t.container)return document.querySelector(t.container)||document.getElementById(t.container)||!1}return!1}(i);if(!r)throw"string"==typeof i?new Error(`[Geolonia] No HTML elements found matching \`${i}\`. Please ensure the map container element exists.`):new Error("[Geolonia] No HTML elements found. Please ensure the map container element exists.");if(r.geoloniaMap)return r.geoloniaMap;0===r.clientHeight&&console.warn("[Geolonia] Embed API failed to render the map because the container has no height. Please set the CSS property `height` to the container.");const n=ot(r,{interactive:"object"!=typeof i||i.interactive}),a=function(t,e,i){e.container&&delete e.container,e===t&&(e={});const r={style:i.style||e.style,container:t,center:[parseFloat(i.lng),parseFloat(i.lat)],bearing:parseFloat(i.bearing),pitch:parseFloat(i.pitch),zoom:parseFloat(i.zoom),hash:"on"===i.hash,localIdeographFontFamily:"sans-serif",attributionControl:!1};return""===i.minZoom||0!==Number(i.minZoom)&&!Number(i.minZoom)||(r.minZoom=Number(i.minZoom)),""!==i.maxZoom&&Number(i.maxZoom)&&(r.maxZoom=Number(i.maxZoom)),Object.assign(r,e),r}(r,i,n),o=r.innerHTML.trim();let s;r.innerHTML="","off"!==n.loader&&(s=document.createElement("div"),s.addEventListener("touchmove",(t=>{t.touches&&t.touches.length>1&&t.preventDefault()})),s.className="loading-geolonia-map",s.innerHTML='<div class="lds-grid"><div></div><div></div><div></div>\n <div></div><div></div><div></div><div></div><div></div><div></div></div>',r.appendChild(s));const l=Y(40),c=new URL(`${n.apiUrl}/sources`);c.searchParams.set("key",n.key),c.searchParams.set("sessionId",l);const h=a.transformRequest;a.transformRequest=(t,e)=>{if("Source"===e&&t.startsWith("https://api.geolonia.com"))return{url:c.toString()};let i=t;if(t.startsWith("geolonia://")){const e=t.match(/^geolonia:\/\/tiles\/(?<username>.+)\/(?<customtileId>.+)/);e&&(i=`https://tileserver.geolonia.com/customtiles/${e.groups.customtileId}/tiles.json`)}const r=new URL(i);if("Source"===e&&i.startsWith("https://tileserver.geolonia.com"))return"v1"!==n.stage&&(r.hostname=`tileserver-${n.stage}.geolonia.com`),r.searchParams.set("sessionId",l),r.searchParams.set("key",n.key),{url:r.toString()};if(("SpriteJSON"===e||"SpriteImage"===e)&&i.match(/^https:\/\/api\.geolonia\.com\/(dev|v1)\/sprites\//)){const t=r.pathname.split("/");return t[1]=n.stage,r.pathname=t.join("/"),r.searchParams.set("key",n.key),{url:r.toString()}}let a;return"function"==typeof h&&(a=h(i,e)),a},super(a);const u=this;this.geoloniaSourcesUrl=c,this.__styleExtensionLoadRequired=!0;const{position:p}=W(n.geoloniaControl);u.addControl(new tt,p),u.addControl(new class{constructor(t={}){var e;this.options=t,this._map,this._compact,this._container,this._shadowContainer,this._innerContainer,this._compactButton,this._editLink,this._attribHTML,this.styleId,this.styleOwner,e=this,["_toggleAttribution","_updateData","_updateCompact","_updateCompactMinimize"].forEach((t=>{e[t]&&(e[t]=e[t].bind(e))}))}getDefaultPosition(){return"bottom-right"}onAdd(t){this._map=t,this._compact=this.options&&this.options.compact,this._container=rt.create("div");const e=this._container.attachShadow({mode:"open"});this._shadowContainer=rt.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=rt.create("summary","maplibregl-ctrl-attrib-button",this._shadowContainer),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=rt.create("div","maplibregl-ctrl-attrib-inner",this._shadowContainer);const i=document.createElement("style");return i.textContent="\n .maplibregl-ctrl {\n font: 12px/20px Helvetica Neue,Arial,Helvetica,sans-serif;\n clear: both;\n pointer-events: auto;\n transform: translate(0);\n }\n\n .maplibregl-ctrl-attrib-button:focus,.maplibregl-ctrl-group button:focus {\n box-shadow: 0 0 2px 2px #0096ff\n }\n\n .maplibregl-ctrl.maplibregl-ctrl-attrib {\n background-color: hsla(0,0%,100%,.5);\n margin: 0;\n padding: 0 5px\n }\n\n @media screen {\n .maplibregl-ctrl-attrib.maplibregl-compact {\n background-color: #fff;\n border-radius: 12px;\n box-sizing: content-box;\n min-height: 20px;\n padding: 2px 24px 2px 0;\n position: relative;\n margin: 10px 10px 10px auto;\n width: 0;\n }\n\n .maplibregl-ctrl-attrib.maplibregl-compact-show {\n padding: 2px 28px 2px 8px;\n visibility: visible;\n width: auto;\n }\n\n .maplibregl-ctrl-bottom-left>.maplibregl-ctrl-attrib.maplibregl-compact-show,.maplibregl-ctrl-top-left>.maplibregl-ctrl-attrib.maplibregl-compact-show {\n border-radius: 12px;\n padding: 2px 8px 2px 28px\n }\n\n .maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-inner {\n display: none\n }\n\n .maplibregl-ctrl-attrib-button {\n background-color: hsla(0,0%,100%,.5);\n background-image: url(\"data:image/svg+xml;charset=utf-8,%3Csvg width='24' height='24' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill-rule='evenodd'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E\");\n border: 0;\n border-radius: 12px;\n box-sizing: border-box;\n cursor: pointer;\n display: none;\n height: 24px;\n outline: none;\n position: absolute;\n right: 0;\n top: 0;\n width: 24px\n }\n\n .maplibregl-ctrl-attrib summary.maplibregl-ctrl-attrib-button {\n appearance: none;\n list-style: none\n }\n\n .maplibregl-ctrl-attrib summary.maplibregl-ctrl-attrib-button::-webkit-details-marker {\n display: none\n }\n\n .maplibregl-ctrl-bottom-left .maplibregl-ctrl-attrib-button,.maplibregl-ctrl-top-left .maplibregl-ctrl-attrib-button {\n left: 0\n }\n\n .maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-button,.maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-inner {\n display: block\n }\n\n .maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-button {\n background-color: rgb(0 0 0/5%)\n }\n\n .maplibregl-ctrl-bottom-right>.maplibregl-ctrl-attrib.maplibregl-compact:after {\n bottom: 0;\n right: 0\n }\n\n .maplibregl-ctrl-top-right>.maplibregl-ctrl-attrib.maplibregl-compact:after {\n right: 0;\n top: 0\n }\n\n .maplibregl-ctrl-top-left>.maplibregl-ctrl-attrib.maplibregl-compact:after {\n left: 0;\n top: 0\n }\n\n .maplibregl-ctrl-bottom-left>.maplibregl-ctrl-attrib.maplibregl-compact:after {\n bottom: 0;\n left: 0\n }\n }\n\n @media screen and (-ms-high-contrast:active) {\n .maplibregl-ctrl-attrib.maplibregl-compact:after {\n background-image: url(\"data:image/svg+xml;charset=utf-8,%3Csvg width='24' height='24' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill-rule='evenodd' fill='%23fff'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E\")\n }\n }\n\n @media screen and (-ms-high-contrast:black-on-white) {\n .maplibregl-ctrl-attrib.maplibregl-compact:after {\n background-image: url(\"data:image/svg+xml;charset=utf-8,%3Csvg width='24' height='24' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill-rule='evenodd'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E\")\n }\n }\n\n @media print {\n .maplibregl-ctrl-attrib-button {\n display: none!important;\n }\n }\n\n .maplibregl-ctrl-attrib a {\n color: rgba(0,0,0,.75);\n text-decoration: none;\n white-space: nowrap;\n }\n\n .maplibregl-ctrl-attrib a:hover {\n color: inherit;\n text-decoration: underline\n }\n\n .maplibregl-attrib-empty {\n display: none\n }\n ",this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("terrain",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),e.appendChild(i),e.appendChild(this._shadowContainer),this.printQuery=window.matchMedia("print"),this.onMediaPrintChange=t=>{t.matches&&(this._shadowContainer.setAttribute("open",""),this._shadowContainer.classList.remove("maplibregl-compact-show"))},this.printQuery.addEventListener("change",this.onMediaPrintChange),this._container}onRemove(){rt.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0,this.printQuery.removeEventListener("change",this.onMediaPrintChange)}_setElementTitle(t,e){const i=this._map._getUIString(`AttributionControl.${e}`);t.title=i,t.setAttribute("aria-label",i)}_toggleAttribution(){this._shadowContainer.classList.contains("maplibregl-compact")&&(this._shadowContainer.classList.contains("maplibregl-compact-show")?(this._shadowContainer.setAttribute("open",""),this._shadowContainer.classList.remove("maplibregl-compact-show")):(this._shadowContainer.classList.add("maplibregl-compact-show"),this._shadowContainer.removeAttribute("open")))}_updateData(t){!t||"metadata"!==t.sourceDataType&&"visibility"!==t.sourceDataType&&"style"!==t.dataType&&"terrain"!==t.type||this._updateAttributions()}_updateAttributions(){if(!this._map.style)return;let t=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=t.concat(this.options.customAttribution.map((t=>"string"!=typeof t?"":t))):"string"==typeof this.options.customAttribution&&t.push(this.options.customAttribution)),this._map.style.stylesheet){const t=this._map.style.stylesheet;this.styleOwner=t.owner,this.styleId=t.id}const e=this._map.style.sourceCaches;for(const i in e){const r=e[i];if(r.used||r.usedForTerrain){const e=r.getSource();e.attribution&&t.indexOf(e.attribution)<0&&t.push(e.attribution)}}t=t.filter((t=>String(t).trim())),t.sort(((t,e)=>t.length-e.length)),t=t.filter(((e,i)=>{for(let r=i+1;r<t.length;r++)if(t[r].indexOf(e)>=0)return!1;return!0}));const i=t.join(" | ");i!==this._attribHTML&&(this._attribHTML=i,t.length?(this._innerContainer.innerHTML=i,this._shadowContainer.classList.remove("maplibregl-attrib-empty")):this._shadowContainer.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}_updateCompact(){this._map.getCanvasContainer().offsetWidth<=640||this._compact?!1===this._compact?this._shadowContainer.setAttribute("open",""):this._shadowContainer.classList.contains("maplibregl-compact")||this._shadowContainer.classList.contains("maplibregl-attrib-empty")||(this._shadowContainer.setAttribute("open",""),this._shadowContainer.classList.add("maplibregl-compact","maplibregl-compact-show")):(this._shadowContainer.setAttribute("open",""),this._shadowContainer.classList.contains("maplibregl-compact")&&this._shadowContainer.classList.remove("maplibregl-compact","maplibregl-compact-show"))}_updateCompactMinimize(){this._shadowContainer.classList.contains("maplibregl-compact")&&this._shadowContainer.classList.contains("maplibregl-compact-show")&&this._shadowContainer.classList.remove("maplibregl-compact-show")}},"bottom-right");const{enabled:d,position:m}=W(n.fullscreenControl);d&&u.addControl(new t.FullscreenControl,m);const{enabled:f,position:g}=W(n.navigationControl);f&&u.addControl(new t.NavigationControl,g);const{enabled:_,position:y}=W(n.geolocateControl);_&&u.addControl(new t.GeolocateControl({}),y);const{enabled:x,position:v}=W(n.scaleControl);return x&&u.addControl(new t.ScaleControl({}),v),u.on("load",(e=>{const i=e.target;if("off"!==n.loader)try{r.removeChild(s)}catch(t){}if("off"!==n.gestureHandling&&function(){const t=document.body,e=document.documentElement;return t.scrollHeight>t.clientHeight||e.scrollHeight>e.clientHeight}()&&new at({lang:n.lang}).addTo(i),n.lat&&n.lng&&"on"===n.marker)if(o){const e=new t.Popup({offset:[0,-25]}).setHTML(o);let r;if(n.customMarker){const t=n.customMarkerOffset.split(/,/).map((t=>Number(t.trim()))),o=document.querySelector(n.customMarker);o.style.display="block",r=new Q({element:o,offset:t}).setLngLat(a.center).addTo(i).setPopup(e)}else r=new Q({color:n.markerColor}).setLngLat(a.center).addTo(i).setPopup(e);"on"===n.openPopup&&r.togglePopup(),r.getElement().classList.add("geolonia-clickable-marker")}else new Q({color:n.markerColor}).setLngLat(a.center).addTo(i)})),u.on("styledata",(async t=>{const i=t.target;if(this.__styleExtensionLoadRequired){if(this.__styleExtensionLoadRequired=!1,n.simpleVector){const t=(a=n.simpleVector,/^(https?|geolonia):\/\//.test(a)?a:`geolonia://tiles/custom/${a}`);new class{constructor(t){this.url=t,this.sourceName="vt-geolonia-simple-style"}addTo(t){const e=t.getContainer();if(!e.dataset||!e.dataset.lng&&!e.dataset.lat){let e=!1;t.on("sourcedata",(i=>{if(i.sourceId!==this.sourceName)return;const r=t.getSource(i.sourceId);!0===(r&&r.loaded())&&(e||(e=!0,t.fitBounds(r.bounds,{duration:0,padding:30})))}))}t.addSource(this.sourceName,{type:"vector",url:this.url}),this.setPolygonGeometries(t),this.setLineGeometries(t),t.addLayer({id:"vt-geolonia-simple-style-polygon-symbol",type:"symbol",source:this.sourceName,"source-layer":"g-simplestyle-v1",filter:["==","$type","Polygon"],paint:{"text-color":["string",["get","text-color"],vt],"text-halo-color":["string",["get","text-halo-color"],bt],"text-halo-width":1},layout:{"text-field":["get","title"],"text-font":["Noto Sans Regular"],"text-size":12,"text-max-width":12,"text-allow-overlap":!1}}),t.addLayer({id:"vt-geolonia-simple-style-linestring-symbol",type:"symbol",source:this.sourceName,"source-layer":"g-simplestyle-v1",filter:["==","$type","LineString"],paint:{"text-color":["string",["get","text-color"],vt],"text-halo-color":["string",["get","text-halo-color"],bt],"text-halo-width":1},layout:{"symbol-placement":"line","text-field":["get","title"],"text-font":["Noto Sans Regular"],"text-size":12,"text-max-width":12,"text-allow-overlap":!1}}),this.setPointGeometries(t)}setPolygonGeometries(t){t.addLayer({id:"vt-geolonia-simple-style-polygon",type:"fill",source:this.sourceName,"source-layer":"g-simplestyle-v1",filter:["==","$type","Polygon"],paint:{"fill-color":["string",["get","fill"],wt],"fill-opacity":["number",["get","fill-opacity"],1],"fill-outline-color":["string",["get","stroke"],Et]}}),this.setPopup(t,"vt-geolonia-simple-style-polygon")}setLineGeometries(t){t.addLayer({id:"vt-geolonia-simple-style-linestring",type:"line",source:this.sourceName,"source-layer":"g-simplestyle-v1",filter:["==","$type","LineString"],paint:{"line-width":["number",["get","stroke-width"],2],"line-color":["string",["get","stroke"],wt],"line-opacity":["number",["get","stroke-opacity"],1]},layout:{"line-cap":"round","line-join":"round"}}),this.setPopup(t,"vt-geolonia-simple-style-linestring")}setPointGeometries(t){t.addLayer({id:"vt-circle-simple-style-points",type:"circle",source:this.sourceName,"source-layer":"g-simplestyle-v1",filter:["all",["==","$type","Point"],["!has","marker-symbol"]],paint:{"circle-radius":["case",["==","small",["get","marker-size"]],7,["==","large",["get","marker-size"]],13,9],"circle-color":["string",["get","marker-color"],wt],"circle-opacity":["number",["get","fill-opacity"],1],"circle-stroke-width":["number",["get","stroke-width"],1],"circle-stroke-color":["string",["get","stroke"],Et],"circle-stroke-opacity":["number",["get","stroke-opacity"],1]}}),t.addLayer({id:"vt-geolonia-simple-style-points",type:"symbol",source:this.sourceName,"source-layer":"g-simplestyle-v1",filter:["==","$type","Point"],paint:{"text-color":["string",["get","text-color"],vt],"text-halo-color":["string",["get","text-halo-color"],bt],"text-halo-width":1},layout:{"icon-image":["get","marker-symbol"],"text-field":["get","title"],"text-font":["Noto Sans Regular"],"text-size":12,"text-anchor":"top","text-max-width":12,"text-offset":["case",["==","small",["get","marker-size"]],["literal",[0,.6]],["==","large",["get","marker-size"]],["literal",[0,1.2]],["literal",[0,.8]]],"text-allow-overlap":!1}}),this.setPopup(t,"vt-circle-simple-style-points"),this.setPopup(t,"vt-geolonia-simple-style-points")}async setPopup(t,i){t.on("click",i,(async i=>{const r=dt(i.features[0]).geometry.coordinates,n=i.features[0].properties.description;if(n){const i=await J(n);(new(e().Popup)).setLngLat(r).setHTML(i).addTo(t)}})),t.on("mouseenter",i,(e=>{e.features[0].properties.description&&(t.getCanvas().style.cursor="pointer")})),t.on("mouseleave",i,(()=>{t.getCanvas().style.cursor=""}))}}(t).addTo(i)}var a;if(n.geojson){const t=(t=>{if(/^https?:\/\//.test(t))return!1;if(/^\//.test(t))return!1;if(/^\.\//.test(t))return!1;if(/^\.\.\//.test(t))return!1;try{return document.querySelector(t)}catch(t){return!1}})(n.geojson);let e;e=t?JSON.parse(t.textContent):n.geojson;const a=new xt(e,{cluster:"on"===n.cluster,clusterColor:n.clusterColor});a.addTo(i),r.dataset&&(r.dataset.lng||r.dataset.lat)||a.fitBounds()}n["3d"]&&i.getStyle().layers.forEach((t=>{"on"===n["3d"]&&t.metadata&&!0===t.metadata["visible-on-3d"]?i.setLayoutProperty(t.id,"visibility","visible"):"off"===n["3d"]&&t.metadata&&!0===t.metadata["visible-on-3d"]||"on"===n["3d"]&&t.metadata&&!0===t.metadata["hide-on-3d"]?i.setLayoutProperty(t.id,"visibility","none"):"off"===n["3d"]&&t.metadata&&!0===t.metadata["hide-on-3d"]&&i.setLayoutProperty(t.id,"visibility","visible")}))}})),u.on("error",(async t=>{t.error&&402===t.error.status&&(t=>{if(!t._geolonia_restricted_mode_handled){t._geolonia_restricted_mode_handled=!0;const e=t.getContainer();t.remove(),e.innerHTML="",e.classList.add("geolonia__restricted-mode-image-container")}})(u)})),r.geoloniaMap=u,u}setStyle(t,e={}){if(null!==t){const e=ot(this.getContainer());"string"==typeof t&&(t=function(t,e){return G(t)||("ja"===e.lang?`https://cdn.geolonia.com/style/${t}/ja.json`:`https://cdn.geolonia.com/style/${t}/en.json`)}(t,e))}return this.__styleExtensionLoadRequired=!0,super.setStyle.call(this,t,e),this}remove(){const t=this.getContainer();super.remove.call(this),delete t.geoloniaMap}}const St="4.2.2";var Ct=o(3379),It=o.n(Ct),At=o(7795),Mt=o.n(At),kt=o(569),Pt=o.n(kt),zt=o(3565),Lt=o.n(zt),Dt=o(9216),Rt=o.n(Dt),Bt=o(4589),Ft=o.n(Bt),Ot=o(7274),Ut={};Ut.styleTagTransform=Ft(),Ut.setAttributes=Lt(),Ut.insert=Pt().bind(null,"head"),Ut.domAPI=Mt(),Ut.insertStyleElement=Rt(),It()(Ot.Z,Ut),Ot.Z&&Ot.Z.locals&&Ot.Z.locals;var Vt=o(5426),Nt={};Nt.styleTagTransform=Ft(),Nt.setAttributes=Lt(),Nt.insert=Pt().bind(null,"head"),Nt.domAPI=Mt(),Nt.insertStyleElement=Rt(),It()(Vt.Z,Nt),Vt.Z&&Vt.Z.locals&&Vt.Z.locals;var $t=(t,e,i)=>new Promise(((r,n)=>{var a=t=>{try{s(i.next(t))}catch(t){n(t)}},o=t=>{try{s(i.throw(t))}catch(t){n(t)}},s=t=>t.done?r(t.value):Promise.resolve(t.value).then(a,o);s((i=i.apply(t,e)).next())})),jt=Uint8Array,qt=Uint16Array,Zt=Int32Array,Gt=new jt([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Ht=new jt([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Xt=new jt([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Wt=function(t,e){for(var i=new qt(31),r=0;r<31;++r)i[r]=e+=1<<t[r-1];var n=new Zt(i[30]);for(r=1;r<30;++r)for(var a=i[r];a<i[r+1];++a)n[a]=a-i[r]<<5|r;return{b:i,r:n}},Kt=Wt(Gt,2),Yt=Kt.b,Jt=Kt.r;Yt[28]=258,Jt[258]=28;var Qt,te=Wt(Ht,0),ee=te.b,ie=(te.r,new qt(32768));for(ae=0;ae<32768;++ae)Qt=(61680&(Qt=(52428&(Qt=(43690&ae)>>1|(21845&ae)<<1))>>2|(13107&Qt)<<2))>>4|(3855&Qt)<<4,ie[ae]=((65280&Qt)>>8|(255&Qt)<<8)>>1;var re=function(t,e,i){for(var r=t.length,n=0,a=new qt(e);n<r;++n)t[n]&&++a[t[n]-1];var o,s=new qt(e);for(n=1;n<e;++n)s[n]=s[n-1]+a[n-1]<<1;if(i){o=new qt(1<<e);var l=15-e;for(n=0;n<r;++n)if(t[n])for(var c=n<<4|t[n],h=e-t[n],u=s[t[n]-1]++<<h,p=u|(1<<h)-1;u<=p;++u)o[ie[u]>>l]=c}else for(o=new qt(r),n=0;n<r;++n)t[n]&&(o[n]=ie[s[t[n]-1]++]>>15-t[n]);return o},ne=new jt(288);for(ae=0;ae<144;++ae)ne[ae]=8;for(ae=144;ae<256;++ae)ne[ae]=9;for(ae=256;ae<280;++ae)ne[ae]=7;for(ae=280;ae<288;++ae)ne[ae]=8;var ae,oe=new jt(32);for(ae=0;ae<32;++ae)oe[ae]=5;var se=re(ne,9,1),le=re(oe,5,1),ce=function(t){for(var e=t[0],i=1;i<t.length;++i)t[i]>e&&(e=t[i]);return e},he=function(t,e,i){var r=e/8|0;return(t[r]|t[r+1]<<8)>>(7&e)&i},ue=function(t,e){var i=e/8|0;return(t[i]|t[i+1]<<8|t[i+2]<<16)>>(7&e)},pe=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],de=function(t,e,i){var r=new Error(e||pe[t]);if(r.code=t,Error.captureStackTrace&&Error.captureStackTrace(r,de),!i)throw r;return r},me=function(t,e,i,r){var n=t.length,a=r?r.length:0;if(!n||e.f&&!e.l)return i||new jt(0);var o=!i||2!=e.i,s=e.i;i||(i=new jt(3*n));var l=function(t){var e=i.length;if(t>e){var r=new jt(Math.max(2*e,t));r.set(i),i=r}},c=e.f||0,h=e.p||0,u=e.b||0,p=e.l,d=e.d,m=e.m,f=e.n,g=8*n;do{if(!p){c=he(t,h,1);var _=he(t,h+1,3);if(h+=3,!_){var y=t[(M=4+((h+7)/8|0))-4]|t[M-3]<<8,x=M+y;if(x>n){s&&de(0);break}o&&l(u+y),i.set(t.subarray(M,x),u),e.b=u+=y,e.p=h=8*x,e.f=c;continue}if(1==_)p=se,d=le,m=9,f=5;else if(2==_){var v=he(t,h,31)+257,b=he(t,h+10,15)+4,w=v+he(t,h+5,31)+1;h+=14;for(var E=new jt(w),T=new jt(19),S=0;S<b;++S)T[Xt[S]]=he(t,h+3*S,7);h+=3*b;var C=ce(T),I=(1<<C)-1,A=re(T,C,1);for(S=0;S<w;){var M,k=A[he(t,h,I)];if(h+=15&k,(M=k>>4)<16)E[S++]=M;else{var P=0,z=0;for(16==M?(z=3+he(t,h,3),h+=2,P=E[S-1]):17==M?(z=3+he(t,h,7),h+=3):18==M&&(z=11+he(t,h,127),h+=7);z--;)E[S++]=P}}var L=E.subarray(0,v),D=E.subarray(v);m=ce(L),f=ce(D),p=re(L,m,1),d=re(D,f,1)}else de(1);if(h>g){s&&de(0);break}}o&&l(u+131072);for(var R=(1<<m)-1,B=(1<<f)-1,F=h;;F=h){var O=(P=p[ue(t,h)&R])>>4;if((h+=15&P)>g){s&&de(0);break}if(P||de(2),O<256)i[u++]=O;else{if(256==O){F=h,p=null;break}var U=O-254;if(O>264){var V=Gt[S=O-257];U=he(t,h,(1<<V)-1)+Yt[S],h+=V}var N=d[ue(t,h)&B],$=N>>4;if(N||de(3),h+=15&N,D=ee[$],$>3&&(V=Ht[$],D+=ue(t,h)&(1<<V)-1,h+=V),h>g){s&&de(0);break}o&&l(u+131072);var j=u+U;if(u<D){var q=a-D,Z=Math.min(D,j);for(q+u<0&&de(3);u<Z;++u)i[u]=r[q+u]}for(;u<j;u+=4)i[u]=i[u-D],i[u+1]=i[u+1-D],i[u+2]=i[u+2-D],i[u+3]=i[u+3-D];u=j}}e.l=p,e.p=F,e.b=u,e.f=c,p&&(c=1,e.m=m,e.d=d,e.n=f)}while(!c);return u==i.length?i:function(t,e,i){(null==e||e<0)&&(e=0),(null==i||i>t.length)&&(i=t.length);var r=new jt(i-e);return r.set(t.subarray(e,i)),r}(i,0,u)},fe=new jt(0),ge=function(t){31==t[0]&&139==t[1]&&8==t[2]||de(6,"invalid gzip data");var e=t[3],i=10;4&e&&(i+=2+(t[10]|t[11]<<8));for(var r=(e>>3&1)+(e>>4&1);r>0;r-=!t[i++]);return i+(2&e)},_e=function(t){var e=t.length;return(t[e-4]|t[e-3]<<8|t[e-2]<<16|t[e-1]<<24)>>>0},ye=function(t,e){return(8!=(15&t[0])||t[0]>>4>7||(t[0]<<8|t[1])%31)&&de(6,"invalid zlib data"),(t[1]>>5&1)==+!e&&de(6,"invalid zlib data: "+(32&t[1]?"need":"unexpected")+" dictionary"),2+(t[1]>>3&4)};function xe(t,e){return 31==t[0]&&139==t[1]&&8==t[2]?function(t,e){var i=ge(t);return i+8>t.length&&de(6,"invalid gzip data"),me(t.subarray(i,-8),{i:2},e&&e.out||new jt(_e(t)),e&&e.dictionary)}(t,e):8!=(15&t[0])||t[0]>>4>7||(t[0]<<8|t[1])%31?function(t,e){return me(t,{i:2},e&&e.out,e&&e.dictionary)}(t,e):function(t,e){return me(t.subarray(ye(t,e&&e.dictionary),-4),{i:2},e&&e.out,e&&e.dictionary)}(t,e)}var ve="undefined"!=typeof TextDecoder&&new TextDecoder;try{ve.decode(fe,{stream:!0})}catch(t){}var be=(t,e)=>t*Math.pow(2,e),we=(t,e)=>Math.floor(t/Math.pow(2,e)),Ee=(t,e)=>be(t.getUint16(e+1,!0),8)+t.getUint8(e),Te=(t,e)=>be(t.getUint32(e+2,!0),16)+t.getUint16(e,!0),Se=(t,e,i,r,n)=>{if(t!=r.getUint8(n))return t-r.getUint8(n);const a=Ee(r,n+1);if(e!=a)return e-a;const o=Ee(r,n+4);return i!=o?i-o:0},Ce=(t,e,i,r)=>{const n=Ie(t,e,i,r);return n?{z:e,x:i,y:r,offset:n[0],length:n[1],is_dir:!1}:null},Ie=(t,e,i,r)=>{let n=0,a=t.byteLength/17-1;for(;n<=a;){const o=a+n>>1,s=Se(e,i,r,t,17*o);if(s>0)n=o+1;else{if(!(s<0))return[Te(t,17*o+7),t.getUint32(17*o+13,!0)];a=o-1}}return null},Ae=(t,e)=>t.is_dir&&!e.is_dir?1:!t.is_dir&&e.is_dir?-1:t.z!==e.z?t.z-e.z:t.x!==e.x?t.x-e.x:t.y-e.y,Me=(t,e)=>{const i=t.getUint8(17*e);return{z:127&i,x:Ee(t,17*e+1),y:Ee(t,17*e+4),offset:Te(t,17*e+7),length:t.getUint32(17*e+13,!0),is_dir:i>>7==1}},ke=t=>{const e=[],i=new DataView(t);for(let t=0;t<i.byteLength/17;t++)e.push(Me(i,t));return Pe(e)},Pe=t=>{t.sort(Ae);const e=new ArrayBuffer(17*t.length),i=new Uint8Array(e);for(let e=0;e<t.length;e++){const r=t[e];let n=r.z;r.is_dir&&(n|=128),i[17*e]=n,i[17*e+1]=255&r.x,i[17*e+2]=r.x>>8&255,i[17*e+3]=r.x>>16&255,i[17*e+4]=255&r.y,i[17*e+5]=r.y>>8&255,i[17*e+6]=r.y>>16&255,i[17*e+7]=255&r.offset,i[17*e+8]=255&we(r.offset,8),i[17*e+9]=255&we(r.offset,16),i[17*e+10]=255&we(r.offset,24),i[17*e+11]=255&we(r.offset,32),i[17*e+12]=255&we(r.offset,48),i[17*e+13]=255&r.length,i[17*e+14]=r.length>>8&255,i[17*e+15]=r.length>>16&255,i[17*e+16]=r.length>>24&255}return e},ze={getHeader:function(t){return $t(this,null,(function*(){const e=yield t.getBytes(0,512e3),i=new DataView(e.data),r=i.getUint32(4,!0),n=i.getUint16(8,!0),a=new TextDecoder("utf-8"),o=JSON.parse(a.decode(new DataView(e.data,10,r)));let s=0;"gzip"===o.compression&&(s=2);let l=0;"minzoom"in o&&(l=+o.minzoom);let c=0;"maxzoom"in o&&(c=+o.maxzoom);let h=0,u=0,p=0,d=-180,m=-85,f=180,g=85;if(o.bounds){const t=o.bounds.split(",");d=+t[0],m=+t[1],f=+t[2],g=+t[3]}if(o.center){const t=o.center.split(",");h=+t[0],u=+t[1],p=+t[2]}return{specVersion:i.getUint16(2,!0),rootDirectoryOffset:10+r,rootDirectoryLength:17*n,jsonMetadataOffset:10,jsonMetadataLength:r,leafDirectoryOffset:0,leafDirectoryLength:void 0,tileDataOffset:0,tileDataLength:void 0,numAddressedTiles:0,numTileEntries:0,numTileContents:0,clustered:!1,internalCompression:1,tileCompression:s,tileType:1,minZoom:l,maxZoom:c,minLon:d,minLat:m,maxLon:f,maxLat:g,centerZoom:p,centerLon:h,centerLat:u,etag:e.etag}}))},getZxy:function(t,e,i,r,n,a,o){return $t(this,null,(function*(){let s=yield i.getArrayBuffer(e,t.rootDirectoryOffset,t.rootDirectoryLength,t);1===t.specVersion&&(s=ke(s));const l=Ce(new DataView(s),r,n,a);if(l){let t=(yield e.getBytes(l.offset,l.length,o)).data;const i=new DataView(t);return 31==i.getUint8(0)&&139==i.getUint8(1)&&(t=xe(new Uint8Array(t))),{data:t}}const c=((t,e)=>{if(t.byteLength<17)return null;const i=t.byteLength/17,r=Me(t,i-1);if(r.is_dir){const t=r.z,i=e.z-t;return{z:t,x:Math.trunc(e.x/(1<<i)),y:Math.trunc(e.y/(1<<i))}}return null})(new DataView(s),{z:r,x:n,y:a});if(c){const l=((t,e,i,r)=>{const n=Ie(t,128|e,i,r);return n?{z:e,x:i,y:r,offset:n[0],length:n[1],is_dir:!0}:null})(new DataView(s),c.z,c.x,c.y);if(l){let s=yield i.getArrayBuffer(e,l.offset,l.length,t);1===t.specVersion&&(s=ke(s));const c=Ce(new DataView(s),r,n,a);if(c){let t=(yield e.getBytes(c.offset,c.length,o)).data;const i=new DataView(t);return 31==i.getUint8(0)&&139==i.getUint8(1)&&(t=xe(new Uint8Array(t))),{data:t}}}}}))}};function Le(t,e){return 4294967296*(e>>>0)+(t>>>0)}function De(t){const e=t.buf;let i,r;return r=e[t.pos++],i=127&r,r<128?i:(r=e[t.pos++],i|=(127&r)<<7,r<128?i:(r=e[t.pos++],i|=(127&r)<<14,r<128?i:(r=e[t.pos++],i|=(127&r)<<21,r<128?i:(r=e[t.pos],i|=(15&r)<<28,function(t,e){const i=e.buf;let r,n;if(n=i[e.pos++],r=(112&n)>>4,n<128)return Le(t,r);if(n=i[e.pos++],r|=(127&n)<<3,n<128)return Le(t,r);if(n=i[e.pos++],r|=(127&n)<<10,n<128)return Le(t,r);if(n=i[e.pos++],r|=(127&n)<<17,n<128)return Le(t,r);if(n=i[e.pos++],r|=(127&n)<<24,n<128)return Le(t,r);if(n=i[e.pos++],r|=(1&n)<<31,n<128)return Le(t,r);throw new Error("Expected varint not more than 10 bytes")}(i,t)))))}function Re(t,e,i,r){if(0==r){1==i&&(e[0]=t-1-e[0],e[1]=t-1-e[1]);const r=e[0];e[0]=e[1],e[1]=r}}var Be=[0,1,5,21,85,341,1365,5461,21845,87381,349525,1398101,5592405,22369621,89478485,357913941,1431655765,5726623061,22906492245,91625968981,366503875925,1466015503701,5864062014805,23456248059221,93824992236885,375299968947541,0x5555555555555];function Fe(t,e){return $t(this,null,(function*(){if(1===e||0===e)return t;if(2===e){if(void 0===globalThis.DecompressionStream)return xe(new Uint8Array(t));{let e=new Response(t).body.pipeThrough(new globalThis.DecompressionStream("gzip"));return new Response(e).arrayBuffer()}}throw Error("Compression method not supported")}))}function Oe(t,e){let i=0,r=t.length-1;for(;i<=r;){const n=r+i>>1,a=e-t[n].tileId;if(a>0)i=n+1;else{if(!(a<0))return t[n];r=n-1}}if(r>=0){if(0===t[r].runLength)return t[r];if(e-t[r].tileId<t[r].runLength)return t[r]}return null}function Ue(t,e){const i=t.getUint32(e+4,!0),r=t.getUint32(e+0,!0);return i*Math.pow(2,32)+r}function Ve(t){const e={buf:new Uint8Array(t),pos:0},i=De(e),r=[];let n=0;for(let t=0;t<i;t++){const t=De(e);r.push({tileId:n+t,offset:0,length:0,runLength:1}),n+=t}for(let t=0;t<i;t++)r[t].runLength=De(e);for(let t=0;t<i;t++)r[t].length=De(e);for(let t=0;t<i;t++){const i=De(e);r[t].offset=0===i&&t>0?r[t-1].offset+r[t-1].length:i-1}return r}var Ne=class extends Error{};var $e=class{constructor(t,e,i){this.source="string"==typeof t?new class{constructor(t,e=new Headers){this.url=t,this.customHeaders=e}getKey(){return this.url}setHeaders(t){this.customHeaders=t}getBytes(t,e,i){return $t(this,null,(function*(){let r;i||(r=new AbortController,i=r.signal);const n=new Headers(this.customHeaders);n.set("Range","bytes="+t+"-"+(t+e-1));let a=yield fetch(this.url,{signal:i,headers:n});if(416===a.status&&0===t){const t=a.headers.get("Content-Range");if(!t||!t.startsWith("bytes */"))throw Error("Missing content-length on 416 response");const e=+t.substr(8);a=yield fetch(this.url,{signal:i,headers:{Range:"bytes=0-"+(e-1)}})}if(a.status>=300)throw Error("Bad response code: "+a.status);const o=a.headers.get("Content-Length");if(200===a.status&&(!o||+o>e))throw r&&r.abort(),Error("Server returned no content-length header or content-length exceeding request. Check that your storage backend supports HTTP Byte Serving.");return{data:yield a.arrayBuffer(),etag:a.headers.get("ETag")||void 0,cacheControl:a.headers.get("Cache-Control")||void 0,expires:a.headers.get("Expires")||void 0}}))}}(t):t,this.decompress=i||Fe,this.cache=e||new class{constructor(t=100,e=!0,i=Fe){this.cache=new Map,this.maxCacheEntries=t,this.counter=1,this.prefetch=e,this.decompress=i}getHeader(t,e){return $t(this,null,(function*(){const i=t.getKey();if(this.cache.has(i))return this.cache.get(i).lastUsed=this.counter++,yield this.cache.get(i).data;const r=new Promise(((i,r)=>{(function(t,e,i,r){return $t(this,null,(function*(){const n=yield t.getBytes(0,16384);if(19792!==new DataView(n.data).getUint16(0,!0))throw new Error("Wrong magic number for PMTiles archive");if(function(t){const e=new DataView(t);return 2===e.getUint16(2,!0)?(console.warn("PMTiles spec version 2 has been deprecated; please see github.com/protomaps/PMTiles for tools to upgrade"),2):1===e.getUint16(2,!0)?(console.warn("PMTiles spec version 1 has been deprecated; please see github.com/protomaps/PMTiles for tools to upgrade"),1):3}(n.data)<3)return[yield ze.getHeader(t)];const a=n.data.slice(0,127);let o=n.etag;r&&n.etag!=r&&(console.warn("ETag conflict detected; your HTTP server might not support content-based ETag headers. ETags disabled for "+t.getKey()),o=void 0);const s=function(t,e){const i=new DataView(t),r=i.getUint8(7);if(r>3)throw Error(`Archive is spec version ${r} but this library supports up to spec version 3`);return{specVersion:r,rootDirectoryOffset:Ue(i,8),rootDirectoryLength:Ue(i,16),jsonMetadataOffset:Ue(i,24),jsonMetadataLength:Ue(i,32),leafDirectoryOffset:Ue(i,40),leafDirectoryLength:Ue(i,48),tileDataOffset:Ue(i,56),tileDataLength:Ue(i,64),numAddressedTiles:Ue(i,72),numTileEntries:Ue(i,80),numTileContents:Ue(i,88),clustered:1===i.getUint8(96),internalCompression:i.getUint8(97),tileCompression:i.getUint8(98),tileType:i.getUint8(99),minZoom:i.getUint8(100),maxZoom:i.getUint8(101),minLon:i.getInt32(102,!0)/1e7,minLat:i.getInt32(106,!0)/1e7,maxLon:i.getInt32(110,!0)/1e7,maxLat:i.getInt32(114,!0)/1e7,centerZoom:i.getUint8(118),centerLon:i.getInt32(119,!0)/1e7,centerLat:i.getInt32(123,!0)/1e7,etag:e}}(a,o);if(i){const i=n.data.slice(s.rootDirectoryOffset,s.rootDirectoryOffset+s.rootDirectoryLength),r=t.getKey()+"|"+(s.etag||"")+"|"+s.rootDirectoryOffset+"|"+s.rootDirectoryLength,a=Ve(yield e(i,s.internalCompression));return[s,[r,a.length,a]]}return[s,void 0]}))})(t,this.decompress,this.prefetch,e).then((t=>{t[1]&&this.cache.set(t[1][0],{lastUsed:this.counter++,data:Promise.resolve(t[1][2])}),i(t[0]),this.prune()})).catch((t=>{r(t)}))}));return this.cache.set(i,{lastUsed:this.counter++,data:r}),r}))}getDirectory(t,e,i,r){return $t(this,null,(function*(){const n=t.getKey()+"|"+(r.etag||"")+"|"+e+"|"+i;if(this.cache.has(n))return this.cache.get(n).lastUsed=this.counter++,yield this.cache.get(n).data;const a=new Promise(((n,a)=>{(function(t,e,i,r,n){return $t(this,null,(function*(){const a=yield t.getBytes(i,r);if(n.etag&&n.etag!==a.etag)throw new Ne(a.etag);const o=Ve(yield e(a.data,n.internalCompression));if(0===o.length)throw new Error("Empty directory is invalid");return o}))})(t,this.decompress,e,i,r).then((t=>{n(t),this.prune()})).catch((t=>{a(t)}))}));return this.cache.set(n,{lastUsed:this.counter++,data:a}),a}))}getArrayBuffer(t,e,i,r){return $t(this,null,(function*(){const n=t.getKey()+"|"+(r.etag||"")+"|"+e+"|"+i;if(this.cache.has(n))return this.cache.get(n).lastUsed=this.counter++,yield this.cache.get(n).data;const a=new Promise(((a,o)=>{t.getBytes(e,i).then((t=>{if(r.etag&&r.etag!==t.etag)throw new Ne(t.etag);a(t.data),this.cache.has(n),this.prune()})).catch((t=>{o(t)}))}));return this.cache.set(n,{lastUsed:this.counter++,data:a}),a}))}prune(){if(this.cache.size>=this.maxCacheEntries){let t,e=1/0;this.cache.forEach(((i,r)=>{i.lastUsed<e&&(e=i.lastUsed,t=r)})),t&&this.cache.delete(t)}}invalidate(t,e){return $t(this,null,(function*(){this.cache.delete(t.getKey()),yield this.getHeader(t,e)}))}}}getHeader(){return $t(this,null,(function*(){return yield this.cache.getHeader(this.source)}))}getZxyAttempt(t,e,i,r){return $t(this,null,(function*(){const n=function(t,e,i){if(t>26)throw Error("Tile zoom level exceeds max safe number limit (26)");if(e>Math.pow(2,t)-1||i>Math.pow(2,t)-1)throw Error("tile x/y outside zoom level bounds");const r=Be[t];let n=0,a=0,o=0;const s=[e,i];let l=Math.pow(2,t)/2;for(;l>0;)n=(s[0]&l)>0?1:0,a=(s[1]&l)>0?1:0,o+=l*l*(3*n^a),Re(l,s,n,a),l/=2;return r+o}(t,e,i),a=yield this.cache.getHeader(this.source);if(a.specVersion<3)return ze.getZxy(a,this.source,this.cache,t,e,i,r);if(t<a.minZoom||t>a.maxZoom)return;let o=a.rootDirectoryOffset,s=a.rootDirectoryLength;for(let t=0;t<=3;t++){const t=Oe(yield this.cache.getDirectory(this.source,o,s,a),n);if(!t)return;if(t.runLength>0){const e=yield this.source.getBytes(a.tileDataOffset+t.offset,t.length,r);if(a.etag&&a.etag!==e.etag)throw new Ne(e.etag);return{data:yield this.decompress(e.data,a.tileCompression),cacheControl:e.cacheControl,expires:e.expires}}o=a.leafDirectoryOffset+t.offset,s=t.length}throw Error("Maximum directory depth exceeded")}))}getZxy(t,e,i,r){return $t(this,null,(function*(){try{return yield this.getZxyAttempt(t,e,i,r)}catch(n){if(n instanceof Ne)return this.cache.invalidate(this.source,n.message),yield this.getZxyAttempt(t,e,i,r);throw n}}))}getMetadataAttempt(){return $t(this,null,(function*(){const t=yield this.cache.getHeader(this.source),e=yield this.source.getBytes(t.jsonMetadataOffset,t.jsonMetadataLength);if(t.etag&&t.etag!==e.etag)throw new Ne(e.etag);const i=yield this.decompress(e.data,t.internalCompression),r=new TextDecoder("utf-8");return JSON.parse(r.decode(i))}))}getMetadata(){return $t(this,null,(function*(){try{return yield this.getMetadataAttempt()}catch(t){if(t instanceof Ne)return this.cache.invalidate(this.source,t.message),yield this.getMetadataAttempt();throw t}}))}};const je=[],qe=Object.assign(window.geolonia||{},t,{Map:Tt,Marker:Q,SimpleStyle:xt,simpleStyle:xt,embedVersion:St,registerPlugin:t=>{je.push(t)}});window.geolonia=window.maplibregl=window.mapboxgl=qe,(()=>{const t=new class{constructor(){this.tile=(t,e)=>{if("json"==t.type){const i=t.url.substr(10);let r=this.tiles.get(i);return r||(r=new $e(i),this.tiles.set(i,r)),r.getHeader().then((i=>{const r={tiles:[t.url+"/{z}/{x}/{y}"],minzoom:i.minZoom,maxzoom:i.maxZoom,bounds:[i.minLon,i.minLat,i.maxLon,i.maxLat]};e(null,r,null,null)})).catch((t=>{e(t,null,null,null)})),{cancel:()=>{}}}{const i=new RegExp(/pmtiles:\/\/(.+)\/(\d+)\/(\d+)\/(\d+)/),r=t.url.match(i);if(!r)throw new Error("Invalid PMTiles protocol URL");const n=r[1];let a=this.tiles.get(n);a||(a=new $e(n),this.tiles.set(n,a));const o=r[2],s=r[3],l=r[4],c=new AbortController,h=c.signal;let u=()=>{c.abort()};return a.getHeader().then((t=>{a.getZxy(+o,+s,+l,h).then((i=>{i?e(null,new Uint8Array(i.data),i.cacheControl,i.expires):1==t.tileType?e(null,new Uint8Array,null,null):e(null,null,null,null)})).catch((t=>{"AbortError"!==t.name&&e(t,null,null,null)}))})),{cancel:u}}},this.tiles=new Map}add(t){this.tiles.set(t.source.getKey(),t)}get(t){return this.tiles.get(t)}};if(e().addProtocol("pmtiles",t.tile),function(){if(window.self===window.parent)return!0;if(Z.apiKey)return!0;if(("https://cdpn.io"===window.self.location.origin||"https://codepen.io"===window.self.location.origin)&&window.self!==window.parent&&0===window.document.referrer.indexOf("https://codepen.io"))return!0;if("https://fiddle.jshell.net"===window.self.location.origin&&window.self!==window.parent&&0===window.document.referrer.indexOf("https://jsfiddle.net"))return!0;if(window.self.location.origin.match(/csb\.app$/)&&window.self!==window.parent&&0===window.document.referrer.indexOf("https://codesandbox.io"))return!0;try{if(window.self.location.origin===window.top.location.origin)return!0}catch(t){return!1}return!1}()){let t=!1;const e=[],i=Symbol("map-is-removed");Z.parse();const r=r=>{const n=new Tt(r);n.on("remove",(()=>{n[i]=!0})),new MutationObserver((t=>{t.some((t=>[...t.removedNodes].some((t=>t===r))))&&!n[i]&&n.remove()})).observe(r.parentNode,{childList:!0});const a=ot(r);t&&!n[i]?je.forEach((t=>t(n,r,a))):e.push({map:n,target:r,atts:a})};document.addEventListener("DOMContentLoaded",(()=>{t=!0,e.forEach((({map:t,target:e,atts:r})=>{t[i]||je.forEach((i=>i(t,e,r)))})),e.splice(0,e.length)}));const n=new IntersectionObserver((t=>{t.forEach((t=>{t.isIntersecting&&(r(t.target),n.unobserve(t.target))}))})),a=document.querySelectorAll('.geolonia[data-lazy-loading="off"]'),o=document.querySelectorAll('.geolonia:not([data-lazy-loading="off"])');Z.apiKey||console.error("[Geolonia] Missing API key.");for(let t=0;t<a.length;t++)r(a[t]);for(let t=0;t<o.length;t++)n.observe(o[t])}else console.error("[Geolonia] We are very sorry, but we can't display our map in iframe.")})()})(),s})()));