=0&&(t-o)*(n-s)-(r-o)*(e-s)>=0&&(r-o)*(a-s)-(i-o)*(n-s)>=0}function lo(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&po(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}(t,e)&&(go(t,e)&&go(e,t)&&function(t,e){var r=t,n=!1,i=(t.x+e.x)/2,a=(t.y+e.y)/2;do{r.y>a!=r.next.y>a&&r.next.y!==r.y&&i<(r.next.x-r.x)*(a-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next}while(r!==t);return n}(t,e)&&(ho(t.prev,t,e.prev)||ho(t,e.prev,e))||fo(t,e)&&ho(t.prev,t,t.next)>0&&ho(e.prev,e,e.next)>0)}function ho(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function fo(t,e){return t.x===e.x&&t.y===e.y}function po(t,e,r,n){var i=vo(ho(t,e,r)),a=vo(ho(t,e,n)),o=vo(ho(r,n,t)),s=vo(ho(r,n,e));return i!==a&&o!==s||!(0!==i||!Ao(t,r,e))||!(0!==a||!Ao(t,n,e))||!(0!==o||!Ao(r,t,n))||!(0!==s||!Ao(r,e,n))}function Ao(t,e,r){return e.x<=Math.max(t.x,r.x)&&e.x>=Math.min(t.x,r.x)&&e.y<=Math.max(t.y,r.y)&&e.y>=Math.min(t.y,r.y)}function vo(t){return t>0?1:t<0?-1:0}function go(t,e){return ho(t.prev,t,t.next)<0?ho(t,e,t.next)>=0&&ho(t,t.prev,e)>=0:ho(t,e,t.prev)<0||ho(t,t.next,e)<0}function mo(t,e){var r=new bo(t.i,t.x,t.y),n=new bo(e.i,e.x,e.y),i=t.next,a=e.prev;return t.next=e,e.prev=t,r.next=i,i.prev=r,n.next=r,r.prev=n,a.next=n,n.prev=a,n}function yo(t,e,r,n){var i=new bo(t,e,r);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function _o(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 bo(t,e,r){this.i=t,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function xo(t,e,r,n){for(var i=0,a=e,o=r-n;an;){if(i-n>600){var o=i-n+1,s=r-n+1,u=Math.log(o),c=.5*Math.exp(2*u/3),l=.5*Math.sqrt(u*c*(o-c)/o)*(s-o/2<0?-1:1);t(e,r,Math.max(n,Math.floor(r-s*c/o+l)),Math.min(i,Math.floor(r+(o-s)*c/o+l)),a)}var h=e[r],f=n,p=i;for(Eo(e,n,r),a(e[i],h)>0&&Eo(e,n,i);f0;)p--}0===a(e[n],h)?Eo(e,n,p):Eo(e,++p,i),p<=r&&(n=p+1),r<=p&&(i=p-1)}}(t,e,r||0,n||t.length-1,i||Oo)}function Eo(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function Oo(t,e){return te?1:0}function So(t,e){var r=t.length;if(r<=1)return[t];for(var n,i,a=[],o=0;o1)for(var u=0;u0&&(n+=t[i-1].length,r.holes.push(n))}return r},Za.default=Qa;var Mo=function(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((function(t){return t.id})),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new si,this.indexArray=new wi,this.indexArray2=new Ei,this.programConfigurations=new sa(Xa,t.layers,t.zoom),this.segments=new Ui,this.segments2=new Ui,this.stateDependentLayerIds=this.layers.filter((function(t){return t.isStateDependent()})).map((function(t){return t.id}))};Mo.prototype.populate=function(t,e){this.hasPattern=ko("fill",this.layers,e);for(var r=this.layers[0].layout.get("fill-sort-key"),n=[],i=0,a=t;i>3}if(a--,1===n||2===n)o+=t.readSVarint(),s+=t.readSVarint(),1===n&&(e&&u.push(e),e=[]),e.push(new i(o,s));else{if(7!==n)throw new Error("unknown command "+n);e&&e.push(e[0].clone())}}return e&&u.push(e),u},Do.prototype.bbox=function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,r=1,n=0,i=0,a=0,o=1/0,s=-1/0,u=1/0,c=-1/0;t.pos>3}if(n--,1===r||2===r)(i+=t.readSVarint())s&&(s=i),(a+=t.readSVarint())c&&(c=a);else if(7!==r)throw new Error("unknown command "+r)}return[o,u,s,c]},Do.prototype.toGeoJSON=function(t,e,r){var n,i,a=this.extent*Math.pow(2,r),o=this.extent*t,s=this.extent*e,u=this.loadGeometry(),c=Do.types[this.type];function l(t){for(var e=0;e>3;e=1===n?t.readString():2===n?t.readFloat():3===n?t.readDouble():4===n?t.readVarint64():5===n?t.readVarint():6===n?t.readSVarint():7===n?t.readBoolean():null}return e}(r))}function Vo(t,e,r){if(3===t){var n=new No(r,r.readVarint()+r.pos);n.length&&(e[n.name]=n)}}zo.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 Ro(this._pbf,e,this.extent,this._keys,this._values)};var Go={VectorTile:function(t,e){this.layers=t.readFields(Vo,{},e)},VectorTileFeature:Ro,VectorTileLayer:No},Wo=Go.VectorTileFeature.types,Ho=Math.pow(2,13);function qo(t,e,r,n,i,a,o,s){t.emplaceBack(e,r,2*Math.floor(n*Ho)+o,i*Ho*2,a*Ho*2,Math.round(s))}var Xo=function(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((function(t){return t.id})),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new ci,this.indexArray=new wi,this.programConfigurations=new sa(jo,t.layers,t.zoom),this.segments=new Ui,this.stateDependentLayerIds=this.layers.filter((function(t){return t.isStateDependent()})).map((function(t){return t.id}))};function Zo(t,e){return t.x===e.x&&(t.x<0||t.x>la)||t.y===e.y&&(t.y<0||t.y>la)}function Qo(t){return t.every((function(t){return t.x<0}))||t.every((function(t){return t.x>la}))||t.every((function(t){return t.y<0}))||t.every((function(t){return t.y>la}))}Xo.prototype.populate=function(t,e){this.features=[],this.hasPattern=ko("fill-extrusion",this.layers,e);for(var r=0,n=t;r=1){var g=p[d-1];if(!Zo(v,g)){l.vertexLength+4>Ui.MAX_VERTEX_ARRAY_LENGTH&&(l=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));var m=v.sub(g)._perp()._unit(),y=g.dist(v);A+y>32768&&(A=0),qo(this.layoutVertexArray,v.x,v.y,m.x,m.y,0,0,A),qo(this.layoutVertexArray,v.x,v.y,m.x,m.y,0,1,A),A+=y,qo(this.layoutVertexArray,g.x,g.y,m.x,m.y,0,0,A),qo(this.layoutVertexArray,g.x,g.y,m.x,m.y,0,1,A);var _=l.vertexLength;this.indexArray.emplaceBack(_,_+2,_+1),this.indexArray.emplaceBack(_+1,_+2,_+3),l.vertexLength+=4,l.primitiveLength+=2}}}}if(l.vertexLength+s>Ui.MAX_VERTEX_ARRAY_LENGTH&&(l=this.segments.prepareSegment(s,this.layoutVertexArray,this.indexArray)),"Polygon"===Wo[t.type]){for(var b=[],x=[],w=l.vertexLength,E=0,O=o;E=2&&t[l-1].equals(t[l-2]);)l--;for(var h=0;h0;if(O&&y>h){var T=f.dist(d);if(T>2*p){var k=f.sub(f.sub(d)._mult(p/T)._round());this.updateDistance(d,k),this.addCurrentVertex(k,g,0,0,A),d=k}}var P=d&&v,M=P?r:c?"butt":n;if(P&&"round"===M&&(wi&&(M="bevel"),"bevel"===M&&(w>2&&(M="flipbevel"),w100)_=m.mult(-1);else{var C=w*g.add(m).mag()/g.sub(m).mag();_._perp()._mult(C*(S?-1:1))}this.addCurrentVertex(f,_,0,0,A),this.addCurrentVertex(f,_.mult(-1),0,0,A)}else if("bevel"===M||"fakeround"===M){var I=-Math.sqrt(w*w-1),L=S?I:0,j=S?0:I;if(d&&this.addCurrentVertex(f,g,L,j,A),"fakeround"===M)for(var R=Math.round(180*E/Math.PI/20),D=1;D2*p){var V=f.add(v.sub(f)._mult(p/U)._round());this.updateDistance(f,V),this.addCurrentVertex(V,m,0,0,A),f=V}}}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,o,s)}},is.prototype.addCurrentVertex=function(t,e,r,n,i,a){void 0===a&&(a=!1);var o=e.x+e.y*r,s=e.y-e.x*r,u=-e.x+e.y*n,c=-e.y-e.x*n;this.addHalfVertex(t,o,s,a,!1,r,i),this.addHalfVertex(t,u,c,a,!0,-n,i),this.distance>ns/2&&0===this.totalDistance&&(this.distance=0,this.addCurrentVertex(t,e,r,n,i,a))},is.prototype.addHalfVertex=function(t,e,r,n,i,a,o){var s=t.x,u=t.y,c=.5*this.scaledDistance;this.layoutVertexArray.emplaceBack((s<<1)+(n?1:0),(u<<1)+(i?1:0),Math.round(63*e)+128,Math.round(63*r)+128,1+(0===a?0:a<0?-1:1)|(63&c)<<2,c>>6);var l=o.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,l),o.primitiveLength++),i?this.e2=l:this.e1=l},is.prototype.updateDistance=function(t,e){this.distance+=t.dist(e),this.scaledDistance=this.totalDistance>0?(this.clipStart+(this.clipEnd-this.clipStart)*this.distance/this.totalDistance)*(ns-1):this.distance},An("LineBucket",is,{omit:["layers","patternFeatures"]});var as=new ti({"line-cap":new Qn(Tt.layout_line["line-cap"]),"line-join":new Yn(Tt.layout_line["line-join"]),"line-miter-limit":new Qn(Tt.layout_line["line-miter-limit"]),"line-round-limit":new Qn(Tt.layout_line["line-round-limit"]),"line-sort-key":new Yn(Tt.layout_line["line-sort-key"])}),os={paint:new ti({"line-opacity":new Yn(Tt.paint_line["line-opacity"]),"line-color":new Yn(Tt.paint_line["line-color"]),"line-translate":new Qn(Tt.paint_line["line-translate"]),"line-translate-anchor":new Qn(Tt.paint_line["line-translate-anchor"]),"line-width":new Yn(Tt.paint_line["line-width"]),"line-gap-width":new Yn(Tt.paint_line["line-gap-width"]),"line-offset":new Yn(Tt.paint_line["line-offset"]),"line-blur":new Yn(Tt.paint_line["line-blur"]),"line-dasharray":new Jn(Tt.paint_line["line-dasharray"]),"line-pattern":new Kn(Tt.paint_line["line-pattern"]),"line-gradient":new $n(Tt.paint_line["line-gradient"])}),layout:as},ss=new(function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.possiblyEvaluate=function(e,r){return r=new zn(Math.floor(r.zoom),{now:r.now,fadeDuration:r.fadeDuration,zoomHistory:r.zoomHistory,transition:r.transition}),t.prototype.possiblyEvaluate.call(this,e,r)},e.prototype.evaluate=function(e,r,n,i){return r=h({},r,{zoom:Math.floor(r.zoom)}),t.prototype.evaluate.call(this,e,r,n,i)},e}(Yn))(os.paint.properties["line-width"].specification);ss.useIntegerZoom=!0;var us=function(t){function e(e){t.call(this,e,os)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._handleSpecialPaintPropertyUpdate=function(t){"line-gradient"===t&&this._updateGradient()},e.prototype._updateGradient=function(){var t=this._transitionablePaint._values["line-gradient"].value.expression;this.gradient=Ga(t,"lineProgress"),this.gradientTexture=null},e.prototype.recalculate=function(e,r){t.prototype.recalculate.call(this,e,r),this.paint._values["line-floorwidth"]=ss.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)},e.prototype.createBucket=function(t){return new is(t)},e.prototype.queryRadius=function(t){var e=t,r=cs(Sa("line-width",this,e),Sa("line-gap-width",this,e)),n=Sa("line-offset",this,e);return r/2+Math.abs(n)+Ta(this.paint.get("line-translate"))},e.prototype.queryIntersectsFeature=function(t,e,r,n,a,o,s){var u=ka(t,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),o.angle,s),c=s/2*cs(this.paint.get("line-width").evaluate(e,r),this.paint.get("line-gap-width").evaluate(e,r)),l=this.paint.get("line-offset").evaluate(e,r);return l&&(n=function(t,e){for(var r=[],n=new i(0,0),a=0;a=3)for(var a=0;a0?e+2*t:t}var ls=ai([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),hs=ai([{name:"a_projected_pos",components:3,type:"Float32"}],4),fs=(ai([{name:"a_fade_opacity",components:1,type:"Uint32"}],4),ai([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}])),ps=(ai([{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"},{type:"Int16",name:"radius"},{type:"Int16",name:"signedDistanceFromAnchor"}]),ai([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4)),As=ai([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4);function ds(t,e,r){return t.sections.forEach((function(t){t.text=function(t,e,r){var n=e.layout.get("text-transform").evaluate(r,{});return"uppercase"===n?t=t.toLocaleUpperCase():"lowercase"===n&&(t=t.toLocaleLowerCase()),Nn.applyArabicShaping&&(t=Nn.applyArabicShaping(t)),t}(t.text,e,r)})),t}ai([{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"}]),ai([{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:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",components:2,name:"textOffset"}]),ai([{type:"Float32",name:"offsetX"}]),ai([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]);var vs={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"},gs=function(t,e,r,n,i){var a,o,s=8*i-n-1,u=(1<>1,l=-7,h=r?i-1:0,f=r?-1:1,p=t[e+h];for(h+=f,a=p&(1<<-l)-1,p>>=-l,l+=s;l>0;a=256*a+t[e+h],h+=f,l-=8);for(o=a&(1<<-l)-1,a>>=-l,l+=n;l>0;o=256*o+t[e+h],h+=f,l-=8);if(0===a)a=1-c;else{if(a===u)return o?NaN:1/0*(p?-1:1);o+=Math.pow(2,n),a-=c}return(p?-1:1)*o*Math.pow(2,a-n)},ms=function(t,e,r,n,i,a){var o,s,u,c=8*a-i-1,l=(1<>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:a-1,A=n?1:-1,d=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=l):(o=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-o))<1&&(o--,u*=2),(e+=o+h>=1?f/u:f*Math.pow(2,1-h))*u>=2&&(o++,u/=2),o+h>=l?(s=0,o=l):o+h>=1?(s=(e*u-1)*Math.pow(2,i),o+=h):(s=e*Math.pow(2,h-1)*Math.pow(2,i),o=0));i>=8;t[r+p]=255&s,p+=A,s/=256,i-=8);for(o=o<0;t[r+p]=255&o,p+=A,o/=256,c-=8);t[r+p-A]|=128*d},ys=_s;function _s(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}_s.Varint=0,_s.Fixed64=1,_s.Bytes=2,_s.Fixed32=5;var bs="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function xs(t){return t.type===_s.Bytes?t.readVarint()+t.pos:t.pos+1}function ws(t,e,r){return r?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function Es(t,e,r){var n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));r.realloc(n);for(var i=r.pos-1;i>=t;i--)r.buf[i+n]=r.buf[i]}function Os(t,e){for(var r=0;r>>8,t[r+2]=e>>>16,t[r+3]=e>>>24}function Ds(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}function Bs(t,e,r){1===t&&r.readMessage(Fs,e)}function Fs(t,e,r){if(3===t){var n=r.readMessage(Ns,{}),i=n.id,a=n.bitmap,o=n.width,s=n.height,u=n.left,c=n.top,l=n.advance;e.push({id:i,bitmap:new za({width:o+6,height:s+6},a),metrics:{width:o,height:s,left:u,top:c,advance:l}})}}function Ns(t,e,r){1===t?e.id=r.readVarint():2===t?e.bitmap=r.readBytes():3===t?e.width=r.readVarint():4===t?e.height=r.readVarint():5===t?e.left=r.readSVarint():6===t?e.top=r.readSVarint():7===t&&(e.advance=r.readVarint())}function zs(t){for(var e=0,r=0,n=0,i=t;n=0;f--){var p=o[f];if(!(h.w>p.w||h.h>p.h)){if(h.x=p.x,h.y=p.y,u=Math.max(u,h.y+h.h),s=Math.max(s,h.x+h.w),h.w===p.w&&h.h===p.h){var A=o.pop();f>3,a=this.pos;this.type=7&n,t(i,e,this),this.pos===a&&this.skip(n)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=js(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=Ds(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=js(this.buf,this.pos)+4294967296*js(this.buf,this.pos+4);return this.pos+=8,t},readSFixed64:function(){var t=js(this.buf,this.pos)+4294967296*Ds(this.buf,this.pos+4);return this.pos+=8,t},readFloat:function(){var t=gs(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=gs(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e,r,n=this.buf;return e=127&(r=n[this.pos++]),r<128?e:(e|=(127&(r=n[this.pos++]))<<7,r<128?e:(e|=(127&(r=n[this.pos++]))<<14,r<128?e:(e|=(127&(r=n[this.pos++]))<<21,r<128?e:function(t,e,r){var n,i,a=r.buf;if(n=(112&(i=a[r.pos++]))>>4,i<128)return ws(t,n,e);if(n|=(127&(i=a[r.pos++]))<<3,i<128)return ws(t,n,e);if(n|=(127&(i=a[r.pos++]))<<10,i<128)return ws(t,n,e);if(n|=(127&(i=a[r.pos++]))<<17,i<128)return ws(t,n,e);if(n|=(127&(i=a[r.pos++]))<<24,i<128)return ws(t,n,e);if(n|=(1&(i=a[r.pos++]))<<31,i<128)return ws(t,n,e);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(r=n[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&&bs?function(t,e,r){return bs.decode(t.subarray(e,r))}(this.buf,e,t):function(t,e,r){for(var n="",i=e;i239?4:u>223?3:u>191?2:1;if(i+l>r)break;1===l?u<128&&(c=u):2===l?128==(192&(a=t[i+1]))&&(c=(31&u)<<6|63&a)<=127&&(c=null):3===l?(a=t[i+1],o=t[i+2],128==(192&a)&&128==(192&o)&&((c=(15&u)<<12|(63&a)<<6|63&o)<=2047||c>=55296&&c<=57343)&&(c=null)):4===l&&(a=t[i+1],o=t[i+2],s=t[i+3],128==(192&a)&&128==(192&o)&&128==(192&s)&&((c=(15&u)<<18|(63&a)<<12|(63&o)<<6|63&s)<=65535||c>=1114112)&&(c=null)),null===c?(c=65533,l=1):c>65535&&(c-=65536,n+=String.fromCharCode(c>>>10&1023|55296),c=56320|1023&c),n+=String.fromCharCode(c),i+=l}return n}(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!==_s.Bytes)return t.push(this.readVarint(e));var r=xs(this);for(t=t||[];this.pos127;);else if(e===_s.Bytes)this.pos=this.readVarint()+this.pos;else if(e===_s.Fixed32)this.pos+=4;else{if(e!==_s.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;e268435455||t<0?function(t,e){var r,n;if(t>=0?(r=t%4294967296|0,n=t/4294967296|0):(n=~(-t/4294967296),4294967295^(r=~(-t%4294967296))?r=r+1|0:(r=0,n=n+1|0)),t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),function(t,e,r){r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos]=127&t}(r,0,e),function(t,e){var r=(7&t)<<4;e.buf[e.pos++]|=r|((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)))))}(n,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,r){for(var n,i,a=0;a55295&&n<57344){if(!i){n>56319||a+1===e.length?(t[r++]=239,t[r++]=191,t[r++]=189):i=n;continue}if(n<56320){t[r++]=239,t[r++]=191,t[r++]=189,i=n;continue}n=i-55296<<10|n-56320|65536,i=null}else i&&(t[r++]=239,t[r++]=191,t[r++]=189,i=null);n<128?t[r++]=n:(n<2048?t[r++]=n>>6|192:(n<65536?t[r++]=n>>12|224:(t[r++]=n>>18|240,t[r++]=n>>12&63|128),t[r++]=n>>6&63|128),t[r++]=63&n|128)}return r}(this.buf,t,this.pos);var r=this.pos-e;r>=128&&Es(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(t){this.realloc(4),ms(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),ms(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 r=0;r=128&&Es(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n},writeMessage:function(t,e,r){this.writeTag(t,_s.Bytes),this.writeRawMessage(e,r)},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,Os,e)},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,Ss,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,Ps,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,Ts,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,ks,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,Ms,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,Cs,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,Is,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,Ls,e)},writeBytesField:function(t,e){this.writeTag(t,_s.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,_s.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,_s.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,_s.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,_s.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,_s.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,_s.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,_s.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,_s.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,_s.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}};var Us=function(t,e){var r=e.pixelRatio,n=e.version,i=e.stretchX,a=e.stretchY,o=e.content;this.paddedRect=t,this.pixelRatio=r,this.stretchX=i,this.stretchY=a,this.content=o,this.version=n},Vs={tl:{configurable:!0},br:{configurable:!0},tlbr:{configurable:!0},displaySize:{configurable:!0}};Vs.tl.get=function(){return[this.paddedRect.x+1,this.paddedRect.y+1]},Vs.br.get=function(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]},Vs.tlbr.get=function(){return this.tl.concat(this.br)},Vs.displaySize.get=function(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]},Object.defineProperties(Us.prototype,Vs);var Gs=function(t,e){var r={},n={};this.haveRenderCallbacks=[];var i=[];this.addImages(t,r,i),this.addImages(e,n,i);var a=zs(i),o=a.w,s=a.h,u=new Ua({width:o||1,height:s||1});for(var c in t){var l=t[c],h=r[c].paddedRect;Ua.copy(l.data,u,{x:0,y:0},{x:h.x+1,y:h.y+1},l.data)}for(var f in e){var p=e[f],A=n[f].paddedRect,d=A.x+1,v=A.y+1,g=p.data.width,m=p.data.height;Ua.copy(p.data,u,{x:0,y:0},{x:d,y:v},p.data),Ua.copy(p.data,u,{x:0,y:m-1},{x:d,y:v-1},{width:g,height:1}),Ua.copy(p.data,u,{x:0,y:0},{x:d,y:v+m},{width:g,height:1}),Ua.copy(p.data,u,{x:g-1,y:0},{x:d-1,y:v},{width:1,height:m}),Ua.copy(p.data,u,{x:0,y:0},{x:d+g,y:v},{width:1,height:m})}this.image=u,this.iconPositions=r,this.patternPositions=n};Gs.prototype.addImages=function(t,e,r){for(var n in t){var i=t[n],a={x:0,y:0,w:i.data.width+2,h:i.data.height+2};r.push(a),e[n]=new Us(a,i),i.hasRenderCallback&&this.haveRenderCallbacks.push(n)}},Gs.prototype.patchUpdatedImages=function(t,e){for(var r in t.dispatchRenderCallbacks(this.haveRenderCallbacks),t.updatedImages)this.patchUpdatedImage(this.iconPositions[r],t.getImage(r),e),this.patchUpdatedImage(this.patternPositions[r],t.getImage(r),e)},Gs.prototype.patchUpdatedImage=function(t,e,r){if(t&&e&&t.version!==e.version){t.version=e.version;var n=t.tl,i=n[0],a=n[1];r.update(e.data,void 0,{x:i,y:a})}},An("ImagePosition",Us),An("ImageAtlas",Gs);var Ws={horizontal:1,vertical:2,horizontalOnly:3},Hs=function(){this.scale=1,this.fontStack="",this.imageName=null};Hs.forText=function(t,e){var r=new Hs;return r.scale=t||1,r.fontStack=e,r},Hs.forImage=function(t){var e=new Hs;return e.imageName=t,e};var qs=function(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null};function Xs(t,e,r,n,i,a,o,s,u,c,l,h,f,p,A,d){var v,g=qs.fromFeature(t,i);h===Ws.vertical&&g.verticalizePunctuation();var m=Nn.processBidirectionalText,y=Nn.processStyledBidirectionalText;if(m&&1===g.sections.length){v=[];for(var _=0,b=m(g.toString(),tu(g,c,a,e,n,p,A));_0&&F>O&&(O=F)}else{var N=r[T.fontStack],z=N&&N[P];if(z&&z.rect)I=z.rect,C=z.metrics;else{var U=e[T.fontStack],V=U&&U[P];if(!V)continue;C=V.metrics}M=24*(b-T.scale)}R?(t.verticalizable=!0,E.push({glyph:P,imageName:L,x:f,y:p+M,vertical:R,scale:T.scale,fontStack:T.fontStack,sectionIndex:k,metrics:C,rect:I}),f+=j*T.scale+c):(E.push({glyph:P,imageName:L,x:f,y:p+M,vertical:R,scale:T.scale,fontStack:T.fontStack,sectionIndex:k,metrics:C,rect:I}),f+=C.advance*T.scale+c)}if(0!==E.length){var G=f-c;A=Math.max(G,A),ru(E,0,E.length-1,v,O)}f=0;var W=a*b+O;w.lineOffset=Math.max(O,x),p+=W,d=Math.max(W,d),++g}else p+=a,++g}var H,q=p- -17,X=eu(o),Z=X.horizontalAlign,Q=X.verticalAlign;(function(t,e,r,n,i,a,o,s,u){var c,l=(e-r)*i;c=a!==o?-s*n- -17:(-n*u+.5)*o;for(var h=0,f=t;h=0&&n>=t&&Zs[this.text.charCodeAt(n)];n--)r--;this.text=this.text.substring(t,r),this.sectionIndex=this.sectionIndex.slice(t,r)},qs.prototype.substring=function(t,e){var r=new qs;return r.text=this.text.substring(t,e),r.sectionIndex=this.sectionIndex.slice(t,e),r.sections=this.sections,r},qs.prototype.toString=function(){return this.text},qs.prototype.getMaxScale=function(){var t=this;return this.sectionIndex.reduce((function(e,r){return Math.max(e,t.sections[r].scale)}),0)},qs.prototype.addTextSection=function(t,e){this.text+=t.text,this.sections.push(Hs.forText(t.scale,t.fontStack||e));for(var r=this.sections.length-1,n=0;n=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)};var Zs={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Qs={};function Ys(t,e,r,n,i,a){if(e.imageName){var o=n[e.imageName];return o?o.displaySize[0]*e.scale*24/a+i:0}var s=r[e.fontStack],u=s&&s[t];return u?u.metrics.advance*e.scale+i:0}function Ks(t,e,r,n){var i=Math.pow(t-e,2);return n?t=0,h=0,f=0;f-r/2;){if(--o<0)return!1;s-=t[o].dist(a),a=t[o]}s+=t[o].dist(t[o+1]),o++;for(var u=[],c=0;sn;)c-=u.shift().angleDelta;if(c>i)return!1;o++,s+=h.dist(f)}return!0}function hu(t){for(var e=0,r=0;rc){var A=(c-u)/p,d=we(h.x,f.x,A),v=we(h.y,f.y,A),g=new iu(d,v,f.angleTo(h),l);return g._round(),!o||lu(t,g,s,o,e)?g:void 0}u+=p}}function du(t,e,r,n,i,a,o,s,u){var c=fu(n,a,o),l=pu(n,i),h=l*o,f=0===t[0].x||t[0].x===u||0===t[0].y||t[0].y===u;return e-h=0&&b=0&&x=0&&p+l<=h){var w=new iu(b,x,y,d);w._round(),i&&!lu(e,w,o,i,a)||A.push(w)}}f+=m}return u||A.length||s||(A=t(e,f/2,n,i,a,o,s,!0,c)),A}(t,f?e/2*s%e:(l/2+2*a)*o*s%e,e,c,r,h,f,!1,u)}function vu(t,e,r,n){var a=[],o=t.image,s=o.pixelRatio,u=o.paddedRect.w-2,c=o.paddedRect.h-2,l=t.right-t.left,h=t.bottom-t.top,f=o.stretchX||[[0,u]],p=o.stretchY||[[0,c]],A=function(t,e){return t+e[1]-e[0]},d=f.reduce(A,0),v=p.reduce(A,0),g=u-d,m=c-v,y=0,_=d,b=0,x=v,w=0,E=g,O=0,S=m;if(o.content&&n){var T=o.content;y=gu(f,0,T[0]),b=gu(p,0,T[1]),_=gu(f,T[0],T[2]),x=gu(p,T[1],T[3]),w=T[0]-y,O=T[1]-b,E=T[2]-T[0]-_,S=T[3]-T[1]-x}var k=function(n,a,u,c){var f=yu(n.stretch-y,_,l,t.left),p=_u(n.fixed-w,E,n.stretch,d),A=yu(a.stretch-b,x,h,t.top),g=_u(a.fixed-O,S,a.stretch,v),m=yu(u.stretch-y,_,l,t.left),T=_u(u.fixed-w,E,u.stretch,d),k=yu(c.stretch-b,x,h,t.top),P=_u(c.fixed-O,S,c.stretch,v),M=new i(f,A),C=new i(m,A),I=new i(m,k),L=new i(f,k),j=new i(p/s,g/s),R=new i(T/s,P/s),D=e*Math.PI/180;if(D){var B=Math.sin(D),F=Math.cos(D),N=[F,-B,B,F];M._matMult(N),C._matMult(N),L._matMult(N),I._matMult(N)}var z=n.stretch+n.fixed,U=u.stretch+u.fixed,V=a.stretch+a.fixed,G=c.stretch+c.fixed;return{tl:M,tr:C,bl:L,br:I,tex:{x:o.paddedRect.x+1+z,y:o.paddedRect.y+1+V,w:U-z,h:G-V},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:j,pixelOffsetBR:R,minFontScaleX:E/s/l,minFontScaleY:S/s/h,isSDF:r}};if(n&&(o.stretchX||o.stretchY))for(var P=mu(f,g,d),M=mu(p,m,v),C=0;C0&&(m=Math.max(10*u,m),this._addLineCollisionCircles(t,e,r,r.segment,y,m,n,a,o,h))}else{if(f){var _=new i(d,p),b=new i(v,p),x=new i(d,A),w=new i(v,A),E=f*Math.PI/180;_._rotate(E),b._rotate(E),x._rotate(E),w._rotate(E),d=Math.min(_.x,b.x,x.x,w.x),v=Math.max(_.x,b.x,x.x,w.x),p=Math.min(_.y,b.y,x.y,w.y),A=Math.max(_.y,b.y,x.y,w.y)}t.emplaceBack(r.x,r.y,d,p,v,A,n,a,o,0,0)}this.boxEndIndex=t.length};bu.prototype._addLineCollisionCircles=function(t,e,r,n,i,a,o,s,u,c){var l=a/2,h=Math.floor(i/l)||1,f=1+.4*Math.log(c)/Math.LN2,p=Math.floor(h*f/2),A=-a/2,d=r,v=n+1,g=A,m=-i/2,y=m-i/4;do{if(--v<0){if(g>m)return;v=0;break}g-=e[v].dist(d),d=e[v]}while(g>y);for(var _=e[v].dist(e[v+1]),b=-p;bi&&(w+=x-i),!(w=e.length)return;_=e[v].dist(e[v+1])}var E=w-g,O=e[v],S=e[v+1].sub(O)._unit()._mult(E)._add(O)._round(),T=Math.abs(w-A)0)for(var r=(this.length>>1)-1;r>=0;r--)this._down(r)};function wu(t,e){return te?1:0}function Eu(t,e,r){void 0===e&&(e=1),void 0===r&&(r=!1);for(var n=1/0,a=1/0,o=-1/0,s=-1/0,u=t[0],c=0;co)&&(o=l.x),(!c||l.y>s)&&(s=l.y)}var h=o-n,f=s-a,p=Math.min(h,f),A=p/2,d=new xu([],Ou);if(0===p)return new i(n,a);for(var v=n;vm.d||!m.d)&&(m=_,r&&console.log("found best %d after %d probes",Math.round(1e4*_.d)/1e4,y)),_.max-m.d<=e||(A=_.h/2,d.push(new Su(_.p.x-A,_.p.y-A,A,t)),d.push(new Su(_.p.x+A,_.p.y-A,A,t)),d.push(new Su(_.p.x-A,_.p.y+A,A,t)),d.push(new Su(_.p.x+A,_.p.y+A,A,t)),y+=4)}return r&&(console.log("num probes: "+y),console.log("best distance: "+m.d)),m.p}function Ou(t,e){return e.max-t.max}function Su(t,e,r,n){this.p=new i(t,e),this.h=r,this.d=function(t,e){for(var r=!1,n=1/0,i=0;it.y!=l.y>t.y&&t.x<(l.x-c.x)*(t.y-c.y)/(l.y-c.y)+c.x&&(r=!r),n=Math.min(n,xa(t,c,l))}return(r?1:-1)*Math.sqrt(n)}(this.p,n),this.max=this.d+this.h*Math.SQRT2}xu.prototype.push=function(t){this.data.push(t),this.length++,this._up(this.length-1)},xu.prototype.pop=function(){if(0!==this.length){var t=this.data[0],e=this.data.pop();return this.length--,this.length>0&&(this.data[0]=e,this._down(0)),t}},xu.prototype.peek=function(){return this.data[0]},xu.prototype._up=function(t){for(var e=this.data,r=this.compare,n=e[t];t>0;){var i=t-1>>1,a=e[i];if(r(n,a)>=0)break;e[t]=a,t=i}e[t]=n},xu.prototype._down=function(t){for(var e=this.data,r=this.compare,n=this.length>>1,i=e[t];t=0)break;e[t]=o,t=a}e[t]=i};var Tu=e((function(t){t.exports=function(t,e){var r,n,i,a,o,s,u,c;for(r=3&t.length,n=t.length-r,i=e,o=3432918353,s=461845907,c=0;c>>16)*o&65535)<<16)&4294967295)<<15|u>>>17))*s+(((u>>>16)*s&65535)<<16)&4294967295)<<13|i>>>19))+((5*(i>>>16)&65535)<<16)&4294967295))+((58964+(a>>>16)&65535)<<16);switch(u=0,r){case 3:u^=(255&t.charCodeAt(c+2))<<16;case 2:u^=(255&t.charCodeAt(c+1))<<8;case 1:i^=u=(65535&(u=(u=(65535&(u^=255&t.charCodeAt(c)))*o+(((u>>>16)*o&65535)<<16)&4294967295)<<15|u>>>17))*s+(((u>>>16)*s&65535)<<16)&4294967295}return i^=t.length,i=2246822507*(65535&(i^=i>>>16))+((2246822507*(i>>>16)&65535)<<16)&4294967295,i=3266489909*(65535&(i^=i>>>13))+((3266489909*(i>>>16)&65535)<<16)&4294967295,(i^=i>>>16)>>>0}})),ku=e((function(t){t.exports=function(t,e){for(var r,n=t.length,i=e^n,a=0;n>=4;)r=1540483477*(65535&(r=255&t.charCodeAt(a)|(255&t.charCodeAt(++a))<<8|(255&t.charCodeAt(++a))<<16|(255&t.charCodeAt(++a))<<24))+((1540483477*(r>>>16)&65535)<<16),i=1540483477*(65535&i)+((1540483477*(i>>>16)&65535)<<16)^(r=1540483477*(65535&(r^=r>>>24))+((1540483477*(r>>>16)&65535)<<16)),n-=4,++a;switch(n){case 3:i^=(255&t.charCodeAt(a+2))<<16;case 2:i^=(255&t.charCodeAt(a+1))<<8;case 1:i=1540483477*(65535&(i^=255&t.charCodeAt(a)))+((1540483477*(i>>>16)&65535)<<16)}return i=1540483477*(65535&(i^=i>>>13))+((1540483477*(i>>>16)&65535)<<16),(i^=i>>>15)>>>0}})),Pu=Tu,Mu=Tu,Cu=ku;Pu.murmur3=Mu,Pu.murmur2=Cu;var Iu=Number.POSITIVE_INFINITY;function Lu(t,e){return e[1]!==Iu?function(t,e,r){var n=0,i=0;switch(e=Math.abs(e),r=Math.abs(r),t){case"top-right":case"top-left":case"top":i=r-7;break;case"bottom-right":case"bottom-left":case"bottom":i=7-r}switch(t){case"top-right":case"bottom-right":case"right":n=-e;break;case"top-left":case"bottom-left":case"left":n=e}return[n,i]}(t,e[0],e[1]):function(t,e){var r=0,n=0;e<0&&(e=0);var i=e/Math.sqrt(2);switch(t){case"top-right":case"top-left":n=i-7;break;case"bottom-right":case"bottom-left":n=7-i;break;case"bottom":n=7-e;break;case"top":n=e-7}switch(t){case"top-right":case"bottom-right":r=-i;break;case"top-left":case"bottom-left":r=i;break;case"left":r=e;break;case"right":r=-e}return[r,n]}(t,e[0])}function ju(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"}var Ru=32640;function Du(t,e,r,n,a,o,s,u,c,l,h,f,p,A){var d=function(t,e,r,n,a,o,s,u){for(var c=n.layout.get("text-rotate").evaluate(o,{})*Math.PI/180,l=[],h=0,f=e.positionedLines;hRu&&x(t.layerIds[0]+': Value for "text-size" is >= 255. Reduce your "text-size".'):"composite"===v.kind&&((g=[au*A.compositeTextSizes[0].evaluate(s,{}),au*A.compositeTextSizes[1].evaluate(s,{})])[0]>Ru||g[1]>Ru)&&x(t.layerIds[0]+': Value for "text-size" is >= 255. Reduce your "text-size".'),t.addSymbols(t.text,d,g,u,o,s,l,e,c.lineStartIndex,c.lineLength,p);for(var m=0,y=h;m=0;o--)if(n.dist(a[o])0)&&("constant"!==i.value.kind||i.value.value.length>0),u=("constant"!==o.value.kind||!!o.value.value)&&Object.keys(o.parameters).length>0,c=n.get("symbol-sort-key");if(this.features=[],s||u){for(var l=e.iconDependencies,h=e.glyphDependencies,f=e.availableImages,p=new zn(this.zoom),A=0,d=t;A=0;for(var P=0,M=_.sections;P=0;s--)a[s]={x:e[s].x,y:e[s].y,tileUnitDistanceFromAnchor:i},s>0&&(i+=e[s-1].dist(e[s]));for(var u=0;u0;this.addCollisionDebugVertices(o,s,u,c,l?n?this.textCollisionCircle:this.iconCollisionCircle:n?this.textCollisionBox:this.iconCollisionBox,a.anchorPoint,r,l)}},qu.prototype.generateCollisionDebugBuffers=function(){for(var t=0;t0},qu.prototype.hasIconData=function(){return this.icon.segments.get().length>0},qu.prototype.hasTextCollisionBoxData=function(){return this.textCollisionBox.segments.get().length>0},qu.prototype.hasIconCollisionBoxData=function(){return this.iconCollisionBox.segments.get().length>0},qu.prototype.hasTextCollisionCircleData=function(){return this.textCollisionCircle.segments.get().length>0},qu.prototype.hasIconCollisionCircleData=function(){return this.iconCollisionCircle.segments.get().length>0},qu.prototype.addIndicesForPlacedSymbol=function(t,e){for(var r=t.placedSymbolArray.get(e),n=r.vertexStartIndex+4*r.numGlyphs,i=r.vertexStartIndex;i1||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(var r=0,n=this.symbolInstanceIndexes;r=0&&n.indexOf(t)===r&&e.addIndicesForPlacedSymbol(e.text,t)})),a.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,a.verticalPlacedTextSymbolIndex),a.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,a.placedIconSymbolIndex),a.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,a.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}},An("SymbolBucket",qu,{omit:["layers","collisionBoxArray","features","compareText"]}),qu.MAX_GLYPHS=65535,qu.addDynamicAttributes=Vu;var Xu=new ti({"symbol-placement":new Qn(Tt.layout_symbol["symbol-placement"]),"symbol-spacing":new Qn(Tt.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Qn(Tt.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Yn(Tt.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Qn(Tt.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Qn(Tt.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new Qn(Tt.layout_symbol["icon-ignore-placement"]),"icon-optional":new Qn(Tt.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Qn(Tt.layout_symbol["icon-rotation-alignment"]),"icon-size":new Yn(Tt.layout_symbol["icon-size"]),"icon-text-fit":new Qn(Tt.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Qn(Tt.layout_symbol["icon-text-fit-padding"]),"icon-image":new Yn(Tt.layout_symbol["icon-image"]),"icon-rotate":new Yn(Tt.layout_symbol["icon-rotate"]),"icon-padding":new Qn(Tt.layout_symbol["icon-padding"]),"icon-keep-upright":new Qn(Tt.layout_symbol["icon-keep-upright"]),"icon-offset":new Yn(Tt.layout_symbol["icon-offset"]),"icon-anchor":new Yn(Tt.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Qn(Tt.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Qn(Tt.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Qn(Tt.layout_symbol["text-rotation-alignment"]),"text-field":new Yn(Tt.layout_symbol["text-field"]),"text-font":new Yn(Tt.layout_symbol["text-font"]),"text-size":new Yn(Tt.layout_symbol["text-size"]),"text-max-width":new Yn(Tt.layout_symbol["text-max-width"]),"text-line-height":new Qn(Tt.layout_symbol["text-line-height"]),"text-letter-spacing":new Yn(Tt.layout_symbol["text-letter-spacing"]),"text-justify":new Yn(Tt.layout_symbol["text-justify"]),"text-radial-offset":new Yn(Tt.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Qn(Tt.layout_symbol["text-variable-anchor"]),"text-anchor":new Yn(Tt.layout_symbol["text-anchor"]),"text-max-angle":new Qn(Tt.layout_symbol["text-max-angle"]),"text-writing-mode":new Qn(Tt.layout_symbol["text-writing-mode"]),"text-rotate":new Yn(Tt.layout_symbol["text-rotate"]),"text-padding":new Qn(Tt.layout_symbol["text-padding"]),"text-keep-upright":new Qn(Tt.layout_symbol["text-keep-upright"]),"text-transform":new Yn(Tt.layout_symbol["text-transform"]),"text-offset":new Yn(Tt.layout_symbol["text-offset"]),"text-allow-overlap":new Qn(Tt.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new Qn(Tt.layout_symbol["text-ignore-placement"]),"text-optional":new Qn(Tt.layout_symbol["text-optional"])}),Zu={paint:new ti({"icon-opacity":new Yn(Tt.paint_symbol["icon-opacity"]),"icon-color":new Yn(Tt.paint_symbol["icon-color"]),"icon-halo-color":new Yn(Tt.paint_symbol["icon-halo-color"]),"icon-halo-width":new Yn(Tt.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Yn(Tt.paint_symbol["icon-halo-blur"]),"icon-translate":new Qn(Tt.paint_symbol["icon-translate"]),"icon-translate-anchor":new Qn(Tt.paint_symbol["icon-translate-anchor"]),"text-opacity":new Yn(Tt.paint_symbol["text-opacity"]),"text-color":new Yn(Tt.paint_symbol["text-color"],{runtimeType:Nt,getOverride:function(t){return t.textColor},hasOverride:function(t){return!!t.textColor}}),"text-halo-color":new Yn(Tt.paint_symbol["text-halo-color"]),"text-halo-width":new Yn(Tt.paint_symbol["text-halo-width"]),"text-halo-blur":new Yn(Tt.paint_symbol["text-halo-blur"]),"text-translate":new Qn(Tt.paint_symbol["text-translate"]),"text-translate-anchor":new Qn(Tt.paint_symbol["text-translate-anchor"])}),layout:Xu},Qu=function(t){this.type=t.property.overrides?t.property.overrides.runtimeType:Rt,this.defaultValue=t};Qu.prototype.evaluate=function(t){if(t.formattedSection){var 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},Qu.prototype.eachChild=function(t){this.defaultValue.isConstant()||t(this.defaultValue.value._styleExpression.expression)},Qu.prototype.possibleOutputs=function(){return[void 0]},Qu.prototype.serialize=function(){return null},An("FormatSectionOverride",Qu,{omit:["defaultValue"]});var Yu=function(t){function e(e){t.call(this,e,Zu)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.recalculate=function(e,r){if(t.prototype.recalculate.call(this,e,r),"auto"===this.layout.get("icon-rotation-alignment")&&("point"!==this.layout.get("symbol-placement")?this.layout._values["icon-rotation-alignment"]="map":this.layout._values["icon-rotation-alignment"]="viewport"),"auto"===this.layout.get("text-rotation-alignment")&&("point"!==this.layout.get("symbol-placement")?this.layout._values["text-rotation-alignment"]="map":this.layout._values["text-rotation-alignment"]="viewport"),"auto"===this.layout.get("text-pitch-alignment")&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")),"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")){var n=this.layout.get("text-writing-mode");if(n){for(var i=[],a=0,o=n;a",targetMapId:n,sourceMapId:a.mapId})}}},cc.prototype.receive=function(t){var e=t.data,r=e.id;if(r&&(!e.targetMapId||this.mapId===e.targetMapId))if(""===e.type){delete this.tasks[r];var n=this.cancelCallbacks[r];delete this.cancelCallbacks[r],n&&n()}else O()||e.mustQueue?(this.tasks[r]=e,this.taskQueue.push(r),this.invoker.trigger()):this.processTask(r,e)},cc.prototype.process=function(){if(this.taskQueue.length){var t=this.taskQueue.shift(),e=this.tasks[t];delete this.tasks[t],this.taskQueue.length&&this.invoker.trigger(),e&&this.processTask(t,e)}},cc.prototype.processTask=function(t,e){var r=this;if(""===e.type){var n=this.callbacks[t];delete this.callbacks[t],n&&(e.error?n(mn(e.error)):n(null,mn(e.data)))}else{var i=!1,a=k(this.globalScope)?void 0:[],o=e.hasCallback?function(e,n){i=!0,delete r.cancelCallbacks[t],r.target.postMessage({id:t,type:"",sourceMapId:r.mapId,error:e?gn(e):null,data:gn(n,a)},a)}:function(t){i=!0},s=null,u=mn(e.data);if(this.parent[e.type])s=this.parent[e.type](e.sourceMapId,u,o);else if(this.parent.getWorkerSource){var c=e.type.split(".");s=this.parent.getWorkerSource(e.sourceMapId,c[0],u.source)[c[1]](u,o)}else o(new Error("Could not find function "+e.type));!i&&s&&s.cancel&&(this.cancelCallbacks[t]=s.cancel)}},cc.prototype.remove=function(){this.invoker.remove(),this.target.removeEventListener("message",this.receive,!1)};var hc=function(t,e){t&&(e?this.setSouthWest(t).setNorthEast(e):4===t.length?this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]]):this.setSouthWest(t[0]).setNorthEast(t[1]))};hc.prototype.setNorthEast=function(t){return this._ne=t instanceof fc?new fc(t.lng,t.lat):fc.convert(t),this},hc.prototype.setSouthWest=function(t){return this._sw=t instanceof fc?new fc(t.lng,t.lat):fc.convert(t),this},hc.prototype.extend=function(t){var e,r,n=this._sw,i=this._ne;if(t instanceof fc)e=t,r=t;else{if(!(t instanceof hc))return Array.isArray(t)?t.every(Array.isArray)?this.extend(hc.convert(t)):this.extend(fc.convert(t)):this;if(e=t._sw,r=t._ne,!e||!r)return this}return n||i?(n.lng=Math.min(e.lng,n.lng),n.lat=Math.min(e.lat,n.lat),i.lng=Math.max(r.lng,i.lng),i.lat=Math.max(r.lat,i.lat)):(this._sw=new fc(e.lng,e.lat),this._ne=new fc(r.lng,r.lat)),this},hc.prototype.getCenter=function(){return new fc((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)},hc.prototype.getSouthWest=function(){return this._sw},hc.prototype.getNorthEast=function(){return this._ne},hc.prototype.getNorthWest=function(){return new fc(this.getWest(),this.getNorth())},hc.prototype.getSouthEast=function(){return new fc(this.getEast(),this.getSouth())},hc.prototype.getWest=function(){return this._sw.lng},hc.prototype.getSouth=function(){return this._sw.lat},hc.prototype.getEast=function(){return this._ne.lng},hc.prototype.getNorth=function(){return this._ne.lat},hc.prototype.toArray=function(){return[this._sw.toArray(),this._ne.toArray()]},hc.prototype.toString=function(){return"LngLatBounds("+this._sw.toString()+", "+this._ne.toString()+")"},hc.prototype.isEmpty=function(){return!(this._sw&&this._ne)},hc.prototype.contains=function(t){var e=fc.convert(t),r=e.lng,n=e.lat,i=this._sw.lat<=n&&n<=this._ne.lat,a=this._sw.lng<=r&&r<=this._ne.lng;return this._sw.lng>this._ne.lng&&(a=this._sw.lng>=r&&r>=this._ne.lng),i&&a},hc.convert=function(t){return!t||t instanceof hc?t:new hc(t)};var fc=function(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")};fc.prototype.wrap=function(){return new fc(l(this.lng,-180,180),this.lat)},fc.prototype.toArray=function(){return[this.lng,this.lat]},fc.prototype.toString=function(){return"LngLat("+this.lng+", "+this.lat+")"},fc.prototype.toBounds=function(t){void 0===t&&(t=0);var e=360*t/40075017,r=e/Math.cos(Math.PI/180*this.lat);return new hc(new fc(this.lng-r,this.lat-e),new fc(this.lng+r,this.lat+e))},fc.convert=function(t){if(t instanceof fc)return t;if(Array.isArray(t)&&(2===t.length||3===t.length))return new fc(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&"object"==typeof t&&null!==t)return new fc(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: , lat: }, an object {lon: , lat: }, or an array of [, ]")};var pc=2*Math.PI*6378137;function Ac(t){return pc*Math.cos(t*Math.PI/180)}function dc(t){return(180+t)/360}function vc(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function gc(t,e){return t/Ac(e)}function mc(t){var e=180-360*t;return 360/Math.PI*Math.atan(Math.exp(e*Math.PI/180))-90}var yc=function(t,e,r){void 0===r&&(r=0),this.x=+t,this.y=+e,this.z=+r};yc.fromLngLat=function(t,e){void 0===e&&(e=0);var r=fc.convert(t);return new yc(dc(r.lng),vc(r.lat),gc(e,r.lat))},yc.prototype.toLngLat=function(){return new fc(360*this.x-180,mc(this.y))},yc.prototype.toAltitude=function(){return this.z*Ac(mc(this.y))},yc.prototype.meterInMercatorCoordinateUnits=function(){return 1/pc*(t=mc(this.y),1/Math.cos(t*Math.PI/180));var t};var _c=function(t,e,r){this.z=t,this.x=e,this.y=r,this.key=wc(0,t,e,r)};_c.prototype.equals=function(t){return this.z===t.z&&this.x===t.x&&this.y===t.y},_c.prototype.url=function(t,e){var r,n,i,a,o,s=(r=this.x,n=this.y,i=this.z,a=lc(256*r,256*(n=Math.pow(2,i)-n-1),i),o=lc(256*(r+1),256*(n+1),i),a[0]+","+a[1]+","+o[0]+","+o[1]),u=function(t,e,r){for(var n,i="",a=t;a>0;a--)i+=(e&(n=1<this.canonical.z?new xc(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new xc(t,this.wrap,t,this.canonical.x>>e,this.canonical.y>>e)},xc.prototype.isChildOf=function(t){if(t.wrap!==this.wrap)return!1;var e=this.canonical.z-t.canonical.z;return 0===t.overscaledZ||t.overscaledZ>e&&t.canonical.y===this.canonical.y>>e},xc.prototype.children=function(t){if(this.overscaledZ>=t)return[new xc(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];var e=this.canonical.z+1,r=2*this.canonical.x,n=2*this.canonical.y;return[new xc(e,this.wrap,e,r,n),new xc(e,this.wrap,e,r+1,n),new xc(e,this.wrap,e,r,n+1),new xc(e,this.wrap,e,r+1,n+1)]},xc.prototype.isLessThan=function(t){return this.wrapt.wrap)&&(this.overscaledZt.overscaledZ)&&(this.canonical.xt.canonical.x)&&this.canonical.y=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)},Ec.prototype._unpackMapbox=function(t,e,r){return(256*t*256+256*e+r)/10-1e4},Ec.prototype._unpackTerrarium=function(t,e,r){return 256*t+e+r/256-32768},Ec.prototype.getPixels=function(){return new Ua({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))},Ec.prototype.backfillBorder=function(t,e,r){if(this.dim!==t.dim)throw new Error("dem dimension mismatch");var n=e*this.dim,i=e*this.dim+this.dim,a=r*this.dim,o=r*this.dim+this.dim;switch(e){case-1:n=i-1;break;case 1:i=n+1}switch(r){case-1:a=o-1;break;case 1:o=a+1}for(var s=-e*this.dim,u=-r*this.dim,c=a;c=0)null!==this.deletedStates[t][n]&&(this.deletedStates[t][n]=this.deletedStates[t][n]||{},this.deletedStates[t][n][r]=null);else if(void 0!==e&&e>=0)if(this.stateChanges[t]&&this.stateChanges[t][n])for(r in this.deletedStates[t][n]={},this.stateChanges[t][n])this.deletedStates[t][n][r]=null;else this.deletedStates[t][n]=null;else this.deletedStates[t]=null}},Pc.prototype.getState=function(t,e){var r=String(e),n=this.state[t]||{},i=this.stateChanges[t]||{},a=h({},n[r],i[r]);if(null===this.deletedStates[t])return{};if(this.deletedStates[t]){var o=this.deletedStates[t][e];if(null===o)return{};for(var s in o)delete a[s]}return a},Pc.prototype.initializeTileState=function(t,e){t.setFeatureState(this.state,e)},Pc.prototype.coalesceChanges=function(t,e){var r={};for(var n in this.stateChanges){this.state[n]=this.state[n]||{};var i={};for(var a in this.stateChanges[n])this.state[n][a]||(this.state[n][a]={}),h(this.state[n][a],this.stateChanges[n][a]),i[a]=this.state[n][a];r[n]=i}for(var o in this.deletedStates){this.state[o]=this.state[o]||{};var s={};if(null===this.deletedStates[o])for(var u in this.state[o])s[u]={},this.state[o][u]={};else for(var c in this.deletedStates[o]){if(null===this.deletedStates[o][c])this.state[o][c]={};else for(var l=0,f=Object.keys(this.deletedStates[o][c]);l=0&&l[3]>=0&&s.insert(o,l[0],l[1],l[2],l[3])}},Mc.prototype.loadVTLayers=function(){return this.vtLayers||(this.vtLayers=new Go.VectorTile(new ys(this.rawTileData)).layers,this.sourceLayerCoder=new Sc(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers},Mc.prototype.query=function(t,e,r){var n=this;this.loadVTLayers();for(var a=t.params||{},o=la/t.tileSize/t.scale,s=Br(a.filter),u=t.queryGeometry,c=t.queryPadding*o,l=Cc(u),h=this.grid.query(l.minX-c,l.minY-c,l.maxX+c,l.maxY+c),f=Cc(t.cameraQueryGeometry),p=0,A=this.grid3D.query(f.minX-c,f.minY-c,f.maxX+c,f.maxY+c,(function(e,r,n,a){return function(t,e,r,n,a){for(var o=0,s=t;o=u.x&&a>=u.y)return!0}var c=[new i(e,r),new i(e,a),new i(n,a),new i(n,r)];if(t.length>2)for(var l=0,h=c;l=0)return!0;return!1}(a,u)){var c=this.sourceLayerCoder.decode(r),l=this.vtLayers[c].feature(n);if(i(new zn(this.tileID.overscaledZ),l))for(var h=0;h>u.z,l=new i(u.x*c,u.y*c),h=new i(l.x+c,l.y+c),f=this.segments.prepareSegment(4,r,n);r.emplaceBack(l.x,l.y,l.x,l.y),r.emplaceBack(h.x,l.y,h.x,l.y),r.emplaceBack(l.x,h.y,l.x,h.y),r.emplaceBack(h.x,h.y,h.x,h.y);var p=f.vertexLength;n.emplaceBack(p,p+1,p+2),n.emplaceBack(p+1,p+2,p+3),f.vertexLength+=4,f.primitiveLength+=2}this.maskedBoundsBuffer=e.createVertexBuffer(r,Oc.members),this.maskedIndexBuffer=e.createIndexBuffer(n)}},Lc.prototype.hasData=function(){return"loaded"===this.state||"reloading"===this.state||"expired"===this.state},Lc.prototype.patternsLoaded=function(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length},Lc.prototype.setExpiryData=function(t){var e=this.expirationTime;if(t.cacheControl){var r=S(t.cacheControl);r["max-age"]&&(this.expirationTime=Date.now()+1e3*r["max-age"])}else t.expires&&(this.expirationTime=new Date(t.expires).getTime());if(this.expirationTime){var n=Date.now(),i=!1;if(this.expirationTime>n)i=!1;else if(e)if(this.expirationTimeut&&(t.getActor().send("enforceCacheSizeLimit",st),ht=0)},t.clamp=c,t.clearTileCache=function(t){var e=self.caches.delete(ot);t&&e.catch(t).then((function(){return t()}))},t.clone=function(t){var e=new Ia(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.config=F,t.create=function(){var t=new Ia(16);return Ia!=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.create$1=function(){var t=new Ia(9);return Ia!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t},t.create$2=function(){var t=new Ia(4);return Ia!=Float32Array&&(t[1]=0,t[2]=0),t[0]=1,t[3]=1,t},t.createCommonjsModule=e,t.createExpression=Er,t.createLayout=ai,t.createStyleLayer=function(t){return"custom"===t.type?new ec(t):new rc[t.type](t)},t.deepEqual=o,t.ease=u,t.emitValidationErrors=cn,t.endsWith=g,t.enforceCacheSizeLimit=function(t){ct(),$&&$.then((function(e){e.keys().then((function(r){for(var n=0;n=la||s.y<0||s.y>=la||function(t,e,r,n,i,a,o,s,u,c,l,h,f,p,A,d,v,g,m,y,_,b,w){var E,O,S,T,k,P=t.addToLineVertexArray(e,r),M=0,C=0,I=0,L=0,j=-1,R=-1,D={},B=Pu(""),F=0,N=0;if(void 0===s._unevaluatedLayout.getValue("text-radial-offset")?(F=(E=s.layout.get("text-offset").evaluate(_,{}).map((function(t){return 24*t})))[0],N=E[1]):(F=24*s.layout.get("text-radial-offset").evaluate(_,{}),N=Iu),t.allowVerticalPlacement&&n.vertical){var z=s.layout.get("text-rotate").evaluate(_,{})+90,U=n.vertical;T=new bu(u,r,e,c,l,h,U,f,p,A,t.overscaling,z),o&&(k=new bu(u,r,e,c,l,h,o,v,g,A,t.overscaling,z))}if(i){var V=s.layout.get("icon-rotate").evaluate(_,{}),G="none"!==s.layout.get("icon-text-fit"),W=vu(i,V,w,G),H=o?vu(o,V,w,G):void 0;S=new bu(u,r,e,c,l,h,i,v,g,!1,t.overscaling,V),M=4*W.length;var q=t.iconSizeData,X=null;"source"===q.kind?(X=[au*s.layout.get("icon-size").evaluate(_,{})])[0]>Ru&&x(t.layerIds[0]+': Value for "icon-size" is >= 255. Reduce your "icon-size".'):"composite"===q.kind&&((X=[au*b.compositeIconSizes[0].evaluate(_,{}),au*b.compositeIconSizes[1].evaluate(_,{})])[0]>Ru||X[1]>Ru)&&x(t.layerIds[0]+': Value for "icon-size" is >= 255. Reduce your "icon-size".'),t.addSymbols(t.icon,W,X,y,m,_,!1,e,P.lineStartIndex,P.lineLength,-1),j=t.icon.placedSymbolArray.length-1,H&&(C=4*H.length,t.addSymbols(t.icon,H,X,y,m,_,Ws.vertical,e,P.lineStartIndex,P.lineLength,-1),R=t.icon.placedSymbolArray.length-1)}for(var Z in n.horizontal){var Q=n.horizontal[Z];if(!O){B=Pu(Q.text);var Y=s.layout.get("text-rotate").evaluate(_,{});O=new bu(u,r,e,c,l,h,Q,f,p,A,t.overscaling,Y)}var K=1===Q.positionedLines.length;if(I+=Du(t,e,Q,a,s,A,_,d,P,n.vertical?Ws.horizontal:Ws.horizontalOnly,K?Object.keys(n.horizontal):[Z],D,j,b),K)break}n.vertical&&(L+=Du(t,e,n.vertical,a,s,A,_,d,P,Ws.vertical,["vertical"],D,R,b));var J=O?O.boxStartIndex:t.collisionBoxArray.length,$=O?O.boxEndIndex:t.collisionBoxArray.length,tt=T?T.boxStartIndex:t.collisionBoxArray.length,et=T?T.boxEndIndex:t.collisionBoxArray.length,rt=S?S.boxStartIndex:t.collisionBoxArray.length,nt=S?S.boxEndIndex:t.collisionBoxArray.length,it=k?k.boxStartIndex:t.collisionBoxArray.length,at=k?k.boxEndIndex:t.collisionBoxArray.length;t.glyphOffsetArray.length>=qu.MAX_GLYPHS&&x("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),t.symbolInstances.emplaceBack(e.x,e.y,D.right>=0?D.right:-1,D.center>=0?D.center:-1,D.left>=0?D.left:-1,D.vertical||-1,j,R,B,J,$,tt,et,rt,nt,it,at,c,I,L,M,C,0,f,F,N)}(t,s,i,r,n,a,f,t.layers[0],t.collisionBoxArray,e.index,e.sourceLayerIndex,t.index,g,b,O,c,y,w,S,A,e,o,l)};if("line"===T)for(var C=0,I=function(t,e,r,n,a){for(var o=[],s=0;s=n&&f.x>=n||(h.x>=n?h=new i(n,h.y+(f.y-h.y)*((n-h.x)/(f.x-h.x)))._round():f.x>=n&&(f=new i(n,h.y+(f.y-h.y)*((n-h.x)/(f.x-h.x)))._round()),h.y>=a&&f.y>=a||(h.y>=a?h=new i(h.x+(f.x-h.x)*((a-h.y)/(f.y-h.y)),a)._round():f.y>=a&&(f=new i(h.x+(f.x-h.x)*((a-h.y)/(f.y-h.y)),a)._round()),c&&h.equals(c[c.length-1])||(c=[h],o.push(c)),c.push(f)))))}return o}(e.geometry,0,0,la,la);C1){var z=Au(N,E,r.vertical||d,n,24,m);z&&M(N,z)}}else if("Polygon"===e.type)for(var U=0,V=So(e.geometry,0);U=T.maxzoom||"none"!==T.visibility&&(o(S,this.zoom,n),(d[T.id]=T.createBucket({index:l.bucketLayerIDs.length,layers:S,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:_,sourceID:this.source})).populate(b,v),l.bucketLayerIDs.push(S.map((function(t){return t.id}))))}}}var k=t.mapObject(v.glyphDependencies,(function(t){return Object.keys(t).map(Number)}));Object.keys(k).length?a.send("getGlyphs",{uid:this.uid,stacks:k},(function(t,e){h||(h=t,f=e,C.call(u))})):f={};var P=Object.keys(v.iconDependencies);P.length?a.send("getImages",{icons:P,source:this.source,tileID:this.tileID,type:"icons"},(function(t,e){h||(h=t,p=e,C.call(u))})):p={};var M=Object.keys(v.patternDependencies);function C(){if(h)return s(h);if(f&&p&&A){var e=new i(f),r=new t.ImageAtlas(p,A);for(var a in d){var u=d[a];u instanceof t.SymbolBucket?(o(u.layers,this.zoom,n),t.performSymbolLayout(u,f,e.positions,p,r.iconPositions,this.showCollisionBoxes)):u.hasPattern&&(u instanceof t.LineBucket||u instanceof t.FillBucket||u instanceof t.FillExtrusionBucket)&&(o(u.layers,this.zoom,n),u.addFeatures(v,r.patternPositions))}this.status="done",s(null,{buckets:t.values(d).filter((function(t){return!t.isEmpty()})),featureIndex:l,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:e.image,imageAtlas:r,glyphMap:this.returnDependencies?f:null,iconMap:this.returnDependencies?p:null,glyphPositions:this.returnDependencies?e.positions:null})}}M.length?a.send("getImages",{icons:M,source:this.source,tileID:this.tileID,type:"patterns"},(function(t,e){h||(h=t,A=e,C.call(u))})):A={},C.call(this)};var s="undefined"!=typeof performance,u={getEntriesByName:function(t){return!!(s&&performance&&performance.getEntriesByName)&&performance.getEntriesByName(t)},mark:function(t){return!!(s&&performance&&performance.mark)&&performance.mark(t)},measure:function(t,e,r){return!!(s&&performance&&performance.measure)&&performance.measure(t,e,r)},clearMarks:function(t){return!!(s&&performance&&performance.clearMarks)&&performance.clearMarks(t)},clearMeasures:function(t){return!!(s&&performance&&performance.clearMeasures)&&performance.clearMeasures(t)}},c=function(t){this._marks={start:[t.url,"start"].join("#"),end:[t.url,"end"].join("#"),measure:t.url.toString()},u.mark(this._marks.start)};function l(e,r){var n=t.getArrayBuffer(e.request,(function(e,n,i,a){e?r(e):n&&r(null,{vectorTile:new t.vectorTile.VectorTile(new t.pbf(n)),rawData:n,cacheControl:i,expires:a})}));return function(){n.cancel(),r()}}c.prototype.finish=function(){u.mark(this._marks.end);var t=u.getEntriesByName(this._marks.measure);return 0===t.length&&(u.measure(this._marks.measure,this._marks.start,this._marks.end),t=u.getEntriesByName(this._marks.measure),u.clearMarks(this._marks.start),u.clearMarks(this._marks.end),u.clearMeasures(this._marks.measure)),t},u.Performance=c;var h=function(t,e,r,n){this.actor=t,this.layerIndex=e,this.availableImages=r,this.loadVectorData=n||l,this.loading={},this.loaded={}};h.prototype.loadTile=function(e,r){var n=this,i=e.uid;this.loading||(this.loading={});var o=!!(e&&e.request&&e.request.collectResourceTiming)&&new u.Performance(e.request),s=this.loading[i]=new a(e);s.abort=this.loadVectorData(e,(function(e,a){if(delete n.loading[i],e||!a)return s.status="done",n.loaded[i]=s,r(e);var u=a.rawData,c={};a.expires&&(c.expires=a.expires),a.cacheControl&&(c.cacheControl=a.cacheControl);var l={};if(o){var h=o.finish();h&&(l.resourceTiming=JSON.parse(JSON.stringify(h)))}s.vectorTile=a.vectorTile,s.parse(a.vectorTile,n.layerIndex,n.availableImages,n.actor,(function(e,n){if(e||!n)return r(e);r(null,t.extend({rawTileData:u.slice(0)},n,c,l))})),n.loaded=n.loaded||{},n.loaded[i]=s}))},h.prototype.reloadTile=function(t,e){var r=this,n=this.loaded,i=t.uid,a=this;if(n&&n[i]){var o=n[i];o.showCollisionBoxes=t.showCollisionBoxes;var s=function(t,n){var i=o.reloadCallback;i&&(delete o.reloadCallback,o.parse(o.vectorTile,a.layerIndex,r.availableImages,a.actor,i)),e(t,n)};"parsing"===o.status?o.reloadCallback=s:"done"===o.status&&(o.vectorTile?o.parse(o.vectorTile,this.layerIndex,this.availableImages,this.actor,s):s())}},h.prototype.abortTile=function(t,e){var r=this.loading,n=t.uid;r&&r[n]&&r[n].abort&&(r[n].abort(),delete r[n]),e()},h.prototype.removeTile=function(t,e){var r=this.loaded,n=t.uid;r&&r[n]&&delete r[n],e()};var f=function(){this.loaded={}};f.prototype.loadTile=function(e,r){var n=e.uid,i=e.encoding,a=e.rawImageData,o=new t.DEMData(n,a,i);this.loaded=this.loaded||{},this.loaded[n]=o,r(null,o)},f.prototype.removeTile=function(t){var e=this.loaded,r=t.uid;e&&e[r]&&delete e[r]};var p=6378137;function A(t){var e=0;if(t&&t.length>0){e+=Math.abs(d(t[0]));for(var r=1;r2){for(o=0;o=0}(t)===e?t:t.reverse()}var b=t.vectorTile.VectorTileFeature.prototype.toGeoJSON,x=function(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))};x.prototype.loadGeometry=function(){if(1===this._feature.type){for(var e=[],r=0,n=this._feature.geometry;r>31}function B(t,e){for(var r=t.loadGeometry(),n=t.type,i=0,a=0,o=r.length,s=0;s>1;!function t(e,r,n,i,a,o){for(;a>i;){if(a-i>600){var s=a-i+1,u=n-i+1,c=Math.log(s),l=.5*Math.exp(2*c/3),h=.5*Math.sqrt(c*l*(s-l)/s)*(u-s/2<0?-1:1);t(e,r,n,Math.max(i,Math.floor(n-u*l/s+h)),Math.min(a,Math.floor(n+(s-u)*l/s+h)),o)}var f=r[2*n+o],p=i,A=a;for(N(e,r,i,n),r[2*a+o]>f&&N(e,r,i,a);pf;)A--}r[2*i+o]===f?N(e,r,i,A):N(e,r,++A,a),A<=n&&(i=A+1),n<=A&&(a=A-1)}}(e,r,s,i,a,o%2),t(e,r,n,i,s-1,o+1),t(e,r,n,s+1,a,o+1)}}(o,s,n,0,o.length-1,0)};W.prototype.range=function(t,e,r,n){return function(t,e,r,n,i,a,o){for(var s,u,c=[0,t.length-1,0],l=[];c.length;){var h=c.pop(),f=c.pop(),p=c.pop();if(f-p<=o)for(var A=p;A<=f;A++)s=e[2*A],u=e[2*A+1],s>=r&&s<=i&&u>=n&&u<=a&&l.push(t[A]);else{var d=Math.floor((p+f)/2);s=e[2*d],u=e[2*d+1],s>=r&&s<=i&&u>=n&&u<=a&&l.push(t[d]);var v=(h+1)%2;(0===h?r<=s:n<=u)&&(c.push(p),c.push(d-1),c.push(v)),(0===h?i>=s:a>=u)&&(c.push(d+1),c.push(f),c.push(v))}}return l}(this.ids,this.coords,t,e,r,n,this.nodeSize)},W.prototype.within=function(t,e,r){return function(t,e,r,n,i,a){for(var o=[0,t.length-1,0],s=[],u=i*i;o.length;){var c=o.pop(),l=o.pop(),h=o.pop();if(l-h<=a)for(var f=h;f<=l;f++)U(e[2*f],e[2*f+1],r,n)<=u&&s.push(t[f]);else{var p=Math.floor((h+l)/2),A=e[2*p],d=e[2*p+1];U(A,d,r,n)<=u&&s.push(t[p]);var v=(c+1)%2;(0===c?r-i<=A:n-i<=d)&&(o.push(h),o.push(p-1),o.push(v)),(0===c?r+i>=A:n+i>=d)&&(o.push(p+1),o.push(l),o.push(v))}}return s}(this.ids,this.coords,t,e,r,this.nodeSize)};var H={minZoom:0,maxZoom:16,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:function(t){return t}},q=function(t){this.options=$(Object.create(H),t),this.trees=new Array(this.options.maxZoom+1)};function X(t,e,r,n,i){return{x:t,y:e,zoom:1/0,id:r,parentId:-1,numPoints:n,properties:i}}function Z(t,e){var r=t.geometry.coordinates,n=r[0],i=r[1];return{x:K(n),y:J(i),zoom:1/0,index:e,parentId:-1}}function Q(t){return{type:"Feature",id:t.id,properties:Y(t),geometry:{type:"Point",coordinates:[(n=t.x,360*(n-.5)),(e=t.y,r=(180-360*e)*Math.PI/180,360*Math.atan(Math.exp(r))/Math.PI-90)]}};var e,r,n}function Y(t){var e=t.numPoints,r=e>=1e4?Math.round(e/1e3)+"k":e>=1e3?Math.round(e/100)/10+"k":e;return $($({},t.properties),{cluster:!0,cluster_id:t.id,point_count:e,point_count_abbreviated:r})}function K(t){return t/360+.5}function J(t){var e=Math.sin(t*Math.PI/180),r=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return r<0?0:r>1?1:r}function $(t,e){for(var r in e)t[r]=e[r];return t}function tt(t){return t.x}function et(t){return t.y}function rt(t,e,r,n,i,a){var o=i-r,s=a-n;if(0!==o||0!==s){var u=((t-r)*o+(e-n)*s)/(o*o+s*s);u>1?(r=i,n=a):u>0&&(r+=o*u,n+=s*u)}return(o=t-r)*o+(s=e-n)*s}function nt(t,e,r,n){var i={id:void 0===t?null:t,type:e,geometry:r,tags:n,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(t){var e=t.geometry,r=t.type;if("Point"===r||"MultiPoint"===r||"LineString"===r)it(t,e);else if("Polygon"===r||"MultiLineString"===r)for(var n=0;n0&&(o+=n?(i*c-u*a)/2:Math.sqrt(Math.pow(u-i,2)+Math.pow(c-a,2))),i=u,a=c}var l=e.length-3;e[2]=1,function t(e,r,n,i){for(var a,o=i,s=n-r>>1,u=n-r,c=e[r],l=e[r+1],h=e[n],f=e[n+1],p=r+3;po)a=p,o=A;else if(A===o){var d=Math.abs(p-s);di&&(a-r>3&&t(e,r,a,i),e[a+2]=o,n-a>3&&t(e,a,n,i))}(e,0,l,r),e[l+2]=1,e.size=Math.abs(o),e.start=0,e.end=e.size}function ut(t,e,r,n){for(var i=0;i1?1:r}function ht(t,e,r,n,i,a,o,s){if(n/=e,a>=(r/=e)&&o=n)return null;for(var u=[],c=0;c=r&&A=n)){var d=[];if("Point"===f||"MultiPoint"===f)ft(h,d,r,n,i);else if("LineString"===f)pt(h,d,r,n,i,!1,s.lineMetrics);else if("MultiLineString"===f)dt(h,d,r,n,i,!1);else if("Polygon"===f)dt(h,d,r,n,i,!0);else if("MultiPolygon"===f)for(var v=0;v=r&&o<=n&&(e.push(t[a]),e.push(t[a+1]),e.push(t[a+2]))}}function pt(t,e,r,n,i,a,o){for(var s,u,c=At(t),l=0===i?gt:mt,h=t.start,f=0;fr&&(u=l(c,p,A,v,g,r),o&&(c.start=h+s*u)):m>n?y=r&&(u=l(c,p,A,v,g,r),_=!0),y>n&&m<=n&&(u=l(c,p,A,v,g,n),_=!0),!a&&_&&(o&&(c.end=h+s*u),e.push(c),c=At(t)),o&&(h+=s)}var b=t.length-3;p=t[b],A=t[b+1],d=t[b+2],(m=0===i?p:A)>=r&&m<=n&&vt(c,p,A,d),b=c.length-3,a&&b>=3&&(c[b]!==c[0]||c[b+1]!==c[1])&&vt(c,c[0],c[1],c[2]),c.length&&e.push(c)}function At(t){var e=[];return e.size=t.size,e.start=t.start,e.end=t.end,e}function dt(t,e,r,n,i,a){for(var o=0;oo.maxX&&(o.maxX=l),h>o.maxY&&(o.maxY=h)}return o}function Et(t,e,r,n){var i=e.geometry,a=e.type,o=[];if("Point"===a||"MultiPoint"===a)for(var s=0;s