>3}if(v--,d===1||d===2)(S+=c.readSVarint())R&&(R=S),(k+=c.readSVarint())J&&(J=k);else if(d!==7)throw new Error("unknown command "+d)}return[P,Q,R,J]},ld.prototype.toGeoJSON=function(c,l,d){var v,S,k=this.extent*Math.pow(2,d),P=this.extent*c,R=this.extent*l,Q=this.loadGeometry(),J=ld.types[this.type];function de(Se){for(var Be=0;Be>3;S=P===1?v.readString():P===2?v.readFloat():P===3?v.readDouble():P===4?v.readVarint64():P===5?v.readVarint():P===6?v.readSVarint():P===7?v.readBoolean():null}return S}(d))}ud.prototype.feature=function(c){if(c<0||c>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[c];var l=this._pbf.readVarint()+this._pbf.pos;return new kp(this._pbf,l,this.extent,this._keys,this._values)};var If=e0;function t0(c,l,d){if(c===3){var v=new If(d,d.readVarint()+d.pos);v.length&&(l[v.name]=v)}}LA.VectorTile=function(c,l){this.layers=c.readFields(t0,{},l)},LA.VectorTileFeature=Of,LA.VectorTileLayer=e0;const Ny=LA.VectorTileFeature.types,Tp=Math.pow(2,13);function eo(c,l,d,v,S,k,P,R){c.emplaceBack(l,d,2*Math.floor(v*Tp)+P,S*Tp*2,k*Tp*2,Math.round(R))}class Kp{constructor(l){this.zoom=l.zoom,this.overscaling=l.overscaling,this.layers=l.layers,this.layerIds=this.layers.map(d=>d.id),this.index=l.index,this.hasPattern=!1,this.layoutVertexArray=new Ri,this.centroidVertexArray=new cr,this.indexArray=new hl,this.programConfigurations=new Vl(l.layers,l.zoom),this.segments=new li,this.stateDependentLayerIds=this.layers.filter(d=>d.isStateDependent()).map(d=>d.id)}populate(l,d,v){this.features=[],this.hasPattern=ju("fill-extrusion",this.layers,d);for(const{feature:S,id:k,index:P,sourceLayerIndex:R}of l){const Q=this.layers[0]._featureFilter.needGeometry,J=Ru(S,Q);if(!this.layers[0]._featureFilter.filter(new wo(this.zoom),J,v))continue;const de={id:k,sourceLayerIndex:R,index:P,geometry:Q?J.geometry:Lu(S),properties:S.properties,type:S.type,patterns:{}};this.hasPattern?this.features.push(sd("fill-extrusion",this.layers,de,this.zoom,d)):this.addFeature(de,de.geometry,P,v,{}),d.featureIndex.insert(S,de.geometry,P,R,this.index,!0)}}addFeatures(l,d,v){for(const S of this.features){const{geometry:k}=S;this.addFeature(S,k,S.index,d,v)}}update(l,d,v){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(l,d,this.stateDependentLayers,v)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(l){this.uploaded||(this.layoutVertexBuffer=l.createVertexBuffer(this.layoutVertexArray,Wy),this.centroidVertexBuffer=l.createVertexBuffer(this.centroidVertexArray,Ef.members,!0),this.indexBuffer=l.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(l),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(l,d,v,S,k){const P={x:0,y:0,vertexCount:0};for(const R of Jm(d,500)){let Q=0;for(const Be of R)Q+=Be.length;let J=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const Be of R){if(Be.length===0||kf(Be))continue;let nt=0;for(let He=0;He=1){const zt=Be[He-1];if(!Pp(xt,zt)){J.vertexLength+4>li.MAX_VERTEX_ARRAY_LENGTH&&(J=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const vt=xt.sub(zt)._perp()._unit(),Ut=zt.dist(xt);nt+Ut>32768&&(nt=0),eo(this.layoutVertexArray,xt.x,xt.y,vt.x,vt.y,0,0,nt),eo(this.layoutVertexArray,xt.x,xt.y,vt.x,vt.y,0,1,nt),P.x+=2*xt.x,P.y+=2*xt.y,P.vertexCount+=2,nt+=Ut,eo(this.layoutVertexArray,zt.x,zt.y,vt.x,vt.y,0,0,nt),eo(this.layoutVertexArray,zt.x,zt.y,vt.x,vt.y,0,1,nt),P.x+=2*zt.x,P.y+=2*zt.y,P.vertexCount+=2;const ln=J.vertexLength;this.indexArray.emplaceBack(ln,ln+2,ln+1),this.indexArray.emplaceBack(ln+1,ln+2,ln+3),J.vertexLength+=4,J.primitiveLength+=2}}}}if(J.vertexLength+Q>li.MAX_VERTEX_ARRAY_LENGTH&&(J=this.segments.prepareSegment(Q,this.layoutVertexArray,this.indexArray)),Ny[l.type]!=="Polygon")continue;const de=[],pe=[],we=J.vertexLength;for(const Be of R)if(Be.length!==0){Be!==R[0]&&pe.push(de.length/2);for(let nt=0;ntpa)||c.y===l.y&&(c.y<0||c.y>pa)}function kf(c){return c.every(l=>l.x<0)||c.every(l=>l.x>pa)||c.every(l=>l.y<0)||c.every(l=>l.y>pa)}Gn("FillExtrusionBucket",Kp,{omit:["layers","features"]});var Wu={paint:new Do({"fill-extrusion-opacity":new mr(z["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Br(z["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new mr(z["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new mr(z["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new TA(z["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Br(z["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Br(z["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new mr(z["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})};function Ad(c,l){return c.x*l.x+c.y*l.y}function Up(c,l){if(c.length===1){let d=0;const v=l[d++];let S;for(;!S||v.equals(S);)if(S=l[d++],!S)return 1/0;for(;dd.id),this.index=l.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(d=>{this.gradients[d.id]={}}),this.layoutVertexArray=new Tr,this.layoutVertexArray2=new Sr,this.indexArray=new hl,this.programConfigurations=new Vl(l.layers,l.zoom),this.segments=new li,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(d=>d.isStateDependent()).map(d=>d.id)}populate(l,d,v){this.hasPattern=ju("line",this.layers,d);const S=this.layers[0].layout.get("line-sort-key"),k=!S.isConstant(),P=[];for(const{feature:R,id:Q,index:J,sourceLayerIndex:de}of l){const pe=this.layers[0]._featureFilter.needGeometry,we=Ru(R,pe);if(!this.layers[0]._featureFilter.filter(new wo(this.zoom),we,v))continue;const Se=k?S.evaluate(we,{},v):void 0,Be={id:Q,properties:R.properties,type:R.type,sourceLayerIndex:de,index:J,geometry:pe?we.geometry:Lu(R),patterns:{},sortKey:Se};P.push(Be)}k&&P.sort((R,Q)=>R.sortKey-Q.sortKey);for(const R of P){const{geometry:Q,index:J,sourceLayerIndex:de}=R;if(this.hasPattern){const pe=sd("line",this.layers,R,this.zoom,d);this.patternFeatures.push(pe)}else this.addFeature(R,Q,J,v,{});d.featureIndex.insert(l[J].feature,Q,J,de,this.index)}}update(l,d,v){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(l,d,this.stateDependentLayers,v)}addFeatures(l,d,v){for(const S of this.patternFeatures)this.addFeature(S,S.geometry,S.index,d,v)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(l){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=l.createVertexBuffer(this.layoutVertexArray2,Tf)),this.layoutVertexBuffer=l.createVertexBuffer(this.layoutVertexArray,Dp),this.indexBuffer=l.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(l),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(l){if(l.properties&&Object.prototype.hasOwnProperty.call(l.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(l.properties,"mapbox_clip_end"))return{start:+l.properties.mapbox_clip_start,end:+l.properties.mapbox_clip_end}}addFeature(l,d,v,S,k){const P=this.layers[0].layout,R=P.get("line-join").evaluate(l,{}),Q=P.get("line-cap"),J=P.get("line-miter-limit"),de=P.get("line-round-limit");this.lineClips=this.lineFeatureClips(l);for(const pe of d)this.addLine(pe,l,R,Q,J,de);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,l,v,k,S)}addLine(l,d,v,S,k,P){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let xt=0;xt=2&&l[Q-1].equals(l[Q-2]);)Q--;let J=0;for(;J0;if(tr&&xt>J){const En=we.dist(Se);if(En>2*de){const Nn=we.sub(we.sub(Se)._mult(de/En)._round());this.updateDistance(Se,Nn),this.addCurrentVertex(Nn,nt,0,0,pe),Se=Nn}}const Wn=Se&&Be;let Fn=Wn?v:R?"butt":S;if(Wn&&Fn==="round"&&(lnk&&(Fn="bevel"),Fn==="bevel"&&(ln>2&&(Fn="flipbevel"),ln100)zt=He.mult(-1);else{const En=ln*nt.add(He).mag()/nt.sub(He).mag();zt._perp()._mult(En*(ir?-1:1))}this.addCurrentVertex(we,zt,0,0,pe),this.addCurrentVertex(we,zt.mult(-1),0,0,pe)}else if(Fn==="bevel"||Fn==="fakeround"){const En=-Math.sqrt(ln*ln-1),Nn=ir?En:0,Ln=ir?0:En;if(Se&&this.addCurrentVertex(we,nt,Nn,Ln,pe),Fn==="fakeround"){const yn=Math.round(180*sn/Math.PI/20);for(let Ir=1;Ir2*de){const Nn=we.add(Be.sub(we)._mult(de/En)._round());this.updateDistance(we,Nn),this.addCurrentVertex(Nn,He,0,0,pe),we=Nn}}}}addCurrentVertex(l,d,v,S,k,P=!1){const R=d.y*S-d.x,Q=-d.y-d.x*S;this.addHalfVertex(l,d.x+d.y*v,d.y-d.x*v,P,!1,v,k),this.addHalfVertex(l,R,Q,P,!0,-S,k),this.distance>$r/2&&this.totalDistance===0&&(this.distance=0,this.addCurrentVertex(l,d,v,S,k,P))}addHalfVertex({x:l,y:d},v,S,k,P,R,Q){const J=.5*(this.lineClips?this.scaledDistance*($r-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((l<<1)+(k?1:0),(d<<1)+(P?1:0),Math.round(63*v)+128,Math.round(63*S)+128,1+(R===0?0:R<0?-1:1)|(63&J)<<2,J>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const de=Q.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,de),Q.primitiveLength++),P?this.e2=de:this.e1=de}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(l,d){this.distance+=l.dist(d),this.updateScaledDistance()}}Gn("LineBucket",Nd,{omit:["layers","patternFeatures"]});const Co=new Do({"line-cap":new mr(z.layout_line["line-cap"]),"line-join":new Br(z.layout_line["line-join"]),"line-miter-limit":new mr(z.layout_line["line-miter-limit"]),"line-round-limit":new mr(z.layout_line["line-round-limit"]),"line-sort-key":new Br(z.layout_line["line-sort-key"])});var _c={paint:new Do({"line-opacity":new Br(z.paint_line["line-opacity"]),"line-color":new Br(z.paint_line["line-color"]),"line-translate":new mr(z.paint_line["line-translate"]),"line-translate-anchor":new mr(z.paint_line["line-translate-anchor"]),"line-width":new Br(z.paint_line["line-width"]),"line-gap-width":new Br(z.paint_line["line-gap-width"]),"line-offset":new Br(z.paint_line["line-offset"]),"line-blur":new Br(z.paint_line["line-blur"]),"line-dasharray":new gc(z.paint_line["line-dasharray"]),"line-pattern":new TA(z.paint_line["line-pattern"]),"line-gradient":new du(z.paint_line["line-gradient"])}),layout:Co};const B1=new class extends Br{possiblyEvaluate(c,l){return l=new wo(Math.floor(l.zoom),{now:l.now,fadeDuration:l.fadeDuration,zoomHistory:l.zoomHistory,transition:l.transition}),super.possiblyEvaluate(c,l)}evaluate(c,l,d,v){return l=L({},l,{zoom:Math.floor(l.zoom)}),super.evaluate(c,l,d,v)}}(_c.paint.properties["line-width"].specification);function bc(c,l){return l>0?l+2*c:c}B1.useIntegerZoom=!0;const I1=No([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),ws=No([{name:"a_projected_pos",components:3,type:"Float32"}],4);No([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const Gy=No([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]);No([{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 Sa=No([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),k1=No([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function Qy(c,l,d){return c.sections.forEach(v=>{v.text=function(S,k,P){const R=k.layout.get("text-transform").evaluate(P,{});return R==="uppercase"?S=S.toLocaleUpperCase():R==="lowercase"&&(S=S.toLocaleLowerCase()),Zs.applyArabicShaping&&(S=Zs.applyArabicShaping(S)),S}(v.text,l,d)}),c}No([{name:"triangle",components:3,type:"Uint16"}]),No([{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"}]),No([{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"}]),No([{type:"Float32",name:"offsetX"}]),No([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]);const Sh={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var Fa=24,A=C,h=function(c,l,d,v,S){var k,P,R=8*S-v-1,Q=(1<>1,de=-7,pe=d?S-1:0,we=d?-1:1,Se=c[l+pe];for(pe+=we,k=Se&(1<<-de)-1,Se>>=-de,de+=R;de>0;k=256*k+c[l+pe],pe+=we,de-=8);for(P=k&(1<<-de)-1,k>>=-de,de+=v;de>0;P=256*P+c[l+pe],pe+=we,de-=8);if(k===0)k=1-J;else{if(k===Q)return P?NaN:1/0*(Se?-1:1);P+=Math.pow(2,v),k-=J}return(Se?-1:1)*P*Math.pow(2,k-v)},b=function(c,l,d,v,S,k){var P,R,Q,J=8*k-S-1,de=(1<>1,we=S===23?Math.pow(2,-24)-Math.pow(2,-77):0,Se=v?0:k-1,Be=v?1:-1,nt=l<0||l===0&&1/l<0?1:0;for(l=Math.abs(l),isNaN(l)||l===1/0?(R=isNaN(l)?1:0,P=de):(P=Math.floor(Math.log(l)/Math.LN2),l*(Q=Math.pow(2,-P))<1&&(P--,Q*=2),(l+=P+pe>=1?we/Q:we*Math.pow(2,1-pe))*Q>=2&&(P++,Q/=2),P+pe>=de?(R=0,P=de):P+pe>=1?(R=(l*Q-1)*Math.pow(2,S),P+=pe):(R=l*Math.pow(2,pe-1)*Math.pow(2,S),P=0));S>=8;c[d+Se]=255&R,Se+=Be,R/=256,S-=8);for(P=P<0;c[d+Se]=255&P,Se+=Be,P/=256,J-=8);c[d+Se-Be]|=128*nt};function C(c){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(c)?c:new Uint8Array(c||0),this.pos=0,this.type=0,this.length=this.buf.length}C.Varint=0,C.Fixed64=1,C.Bytes=2,C.Fixed32=5;var O,F=4294967296,Y=1/F,X=typeof TextDecoder>"u"?null:new TextDecoder("utf8");function le(c){return c.type===C.Bytes?c.readVarint()+c.pos:c.pos+1}function fe(c,l,d){return d?4294967296*l+(c>>>0):4294967296*(l>>>0)+(c>>>0)}function Le(c,l,d){var v=l<=16383?1:l<=2097151?2:l<=268435455?3:Math.floor(Math.log(l)/(7*Math.LN2));d.realloc(v);for(var S=d.pos-1;S>=c;S--)d.buf[S+v]=d.buf[S]}function $e(c,l){for(var d=0;d>>8,c[d+2]=l>>>16,c[d+3]=l>>>24}function Er(c,l){return(c[l]|c[l+1]<<8|c[l+2]<<16)+(c[l+3]<<24)}function Ci(c,l,d){c===1&&d.readMessage(Fo,l)}function Fo(c,l,d){if(c===3){const{id:v,bitmap:S,width:k,height:P,left:R,top:Q,advance:J}=d.readMessage(La,{});l.push({id:v,bitmap:new UA({width:k+6,height:P+6},S),metrics:{width:k,height:P,left:R,top:Q,advance:J}})}}function La(c,l,d){c===1?l.id=d.readVarint():c===2?l.bitmap=d.readBytes():c===3?l.width=d.readVarint():c===4?l.height=d.readVarint():c===5?l.left=d.readSVarint():c===6?l.top=d.readSVarint():c===7&&(l.advance=d.readVarint())}function Jo(c){let l=0,d=0;for(const P of c)l+=P.w*P.h,d=Math.max(d,P.w);c.sort((P,R)=>R.h-P.h);const v=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(l/.95)),d),h:1/0}];let S=0,k=0;for(const P of c)for(let R=v.length-1;R>=0;R--){const Q=v[R];if(!(P.w>Q.w||P.h>Q.h)){if(P.x=Q.x,P.y=Q.y,k=Math.max(k,P.y+P.h),S=Math.max(S,P.x+P.w),P.w===Q.w&&P.h===Q.h){const J=v.pop();R>3,k=this.pos;this.type=7&v,c(S,l,this),this.pos===k&&this.skip(v)}return l},readMessage:function(c,l){return this.readFields(c,l,this.readVarint()+this.pos)},readFixed32:function(){var c=er(this.buf,this.pos);return this.pos+=4,c},readSFixed32:function(){var c=Er(this.buf,this.pos);return this.pos+=4,c},readFixed64:function(){var c=er(this.buf,this.pos)+er(this.buf,this.pos+4)*F;return this.pos+=8,c},readSFixed64:function(){var c=er(this.buf,this.pos)+Er(this.buf,this.pos+4)*F;return this.pos+=8,c},readFloat:function(){var c=h(this.buf,this.pos,!0,23,4);return this.pos+=4,c},readDouble:function(){var c=h(this.buf,this.pos,!0,52,8);return this.pos+=8,c},readVarint:function(c){var l,d,v=this.buf;return l=127&(d=v[this.pos++]),d<128?l:(l|=(127&(d=v[this.pos++]))<<7,d<128?l:(l|=(127&(d=v[this.pos++]))<<14,d<128?l:(l|=(127&(d=v[this.pos++]))<<21,d<128?l:function(S,k,P){var R,Q,J=P.buf;if(R=(112&(Q=J[P.pos++]))>>4,Q<128||(R|=(127&(Q=J[P.pos++]))<<3,Q<128)||(R|=(127&(Q=J[P.pos++]))<<10,Q<128)||(R|=(127&(Q=J[P.pos++]))<<17,Q<128)||(R|=(127&(Q=J[P.pos++]))<<24,Q<128)||(R|=(1&(Q=J[P.pos++]))<<31,Q<128))return fe(S,R,k);throw new Error("Expected varint not more than 10 bytes")}(l|=(15&(d=v[this.pos]))<<28,c,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var c=this.readVarint();return c%2==1?(c+1)/-2:c/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var c=this.readVarint()+this.pos,l=this.pos;return this.pos=c,c-l>=12&&X?function(d,v,S){return X.decode(d.subarray(v,S))}(this.buf,l,c):function(d,v,S){for(var k="",P=v;P239?4:de>223?3:de>191?2:1;if(P+we>S)break;we===1?de<128&&(pe=de):we===2?(192&(R=d[P+1]))==128&&(pe=(31&de)<<6|63&R)<=127&&(pe=null):we===3?(Q=d[P+2],(192&(R=d[P+1]))==128&&(192&Q)==128&&((pe=(15&de)<<12|(63&R)<<6|63&Q)<=2047||pe>=55296&&pe<=57343)&&(pe=null)):we===4&&(Q=d[P+2],J=d[P+3],(192&(R=d[P+1]))==128&&(192&Q)==128&&(192&J)==128&&((pe=(15&de)<<18|(63&R)<<12|(63&Q)<<6|63&J)<=65535||pe>=1114112)&&(pe=null)),pe===null?(pe=65533,we=1):pe>65535&&(pe-=65536,k+=String.fromCharCode(pe>>>10&1023|55296),pe=56320|1023&pe),k+=String.fromCharCode(pe),P+=we}return k}(this.buf,l,c)},readBytes:function(){var c=this.readVarint()+this.pos,l=this.buf.subarray(this.pos,c);return this.pos=c,l},readPackedVarint:function(c,l){if(this.type!==C.Bytes)return c.push(this.readVarint(l));var d=le(this);for(c=c||[];this.pos127;);else if(l===C.Bytes)this.pos=this.readVarint()+this.pos;else if(l===C.Fixed32)this.pos+=4;else{if(l!==C.Fixed64)throw new Error("Unimplemented type: "+l);this.pos+=8}},writeTag:function(c,l){this.writeVarint(c<<3|l)},realloc:function(c){for(var l=this.length||16;l268435455||c<0?function(l,d){var v,S;if(l>=0?(v=l%4294967296|0,S=l/4294967296|0):(S=~(-l/4294967296),4294967295^(v=~(-l%4294967296))?v=v+1|0:(v=0,S=S+1|0)),l>=18446744073709552e3||l<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");d.realloc(10),function(k,P,R){R.buf[R.pos++]=127&k|128,k>>>=7,R.buf[R.pos++]=127&k|128,k>>>=7,R.buf[R.pos++]=127&k|128,k>>>=7,R.buf[R.pos++]=127&k|128,R.buf[R.pos]=127&(k>>>=7)}(v,0,d),function(k,P){var R=(7&k)<<4;P.buf[P.pos++]|=R|((k>>>=3)?128:0),k&&(P.buf[P.pos++]=127&k|((k>>>=7)?128:0),k&&(P.buf[P.pos++]=127&k|((k>>>=7)?128:0),k&&(P.buf[P.pos++]=127&k|((k>>>=7)?128:0),k&&(P.buf[P.pos++]=127&k|((k>>>=7)?128:0),k&&(P.buf[P.pos++]=127&k)))))}(S,d)}(c,this):(this.realloc(4),this.buf[this.pos++]=127&c|(c>127?128:0),c<=127||(this.buf[this.pos++]=127&(c>>>=7)|(c>127?128:0),c<=127||(this.buf[this.pos++]=127&(c>>>=7)|(c>127?128:0),c<=127||(this.buf[this.pos++]=c>>>7&127))))},writeSVarint:function(c){this.writeVarint(c<0?2*-c-1:2*c)},writeBoolean:function(c){this.writeVarint(!!c)},writeString:function(c){c=String(c),this.realloc(4*c.length),this.pos++;var l=this.pos;this.pos=function(v,S,k){for(var P,R,Q=0;Q55295&&P<57344){if(!R){P>56319||Q+1===S.length?(v[k++]=239,v[k++]=191,v[k++]=189):R=P;continue}if(P<56320){v[k++]=239,v[k++]=191,v[k++]=189,R=P;continue}P=R-55296<<10|P-56320|65536,R=null}else R&&(v[k++]=239,v[k++]=191,v[k++]=189,R=null);P<128?v[k++]=P:(P<2048?v[k++]=P>>6|192:(P<65536?v[k++]=P>>12|224:(v[k++]=P>>18|240,v[k++]=P>>12&63|128),v[k++]=P>>6&63|128),v[k++]=63&P|128)}return k}(this.buf,c,this.pos);var d=this.pos-l;d>=128&&Le(l,d,this),this.pos=l-1,this.writeVarint(d),this.pos+=d},writeFloat:function(c){this.realloc(4),b(this.buf,c,this.pos,!0,23,4),this.pos+=4},writeDouble:function(c){this.realloc(8),b(this.buf,c,this.pos,!0,52,8),this.pos+=8},writeBytes:function(c){var l=c.length;this.writeVarint(l),this.realloc(l);for(var d=0;d=128&&Le(d,v,this),this.pos=d-1,this.writeVarint(v),this.pos+=v},writeMessage:function(c,l,d){this.writeTag(c,C.Bytes),this.writeRawMessage(l,d)},writePackedVarint:function(c,l){l.length&&this.writeMessage(c,$e,l)},writePackedSVarint:function(c,l){l.length&&this.writeMessage(c,_t,l)},writePackedBoolean:function(c,l){l.length&&this.writeMessage(c,An,l)},writePackedFloat:function(c,l){l.length&&this.writeMessage(c,mt,l)},writePackedDouble:function(c,l){l.length&&this.writeMessage(c,Vt,l)},writePackedFixed32:function(c,l){l.length&&this.writeMessage(c,_n,l)},writePackedSFixed32:function(c,l){l.length&&this.writeMessage(c,Dn,l)},writePackedFixed64:function(c,l){l.length&&this.writeMessage(c,Hn,l)},writePackedSFixed64:function(c,l){l.length&&this.writeMessage(c,Pn,l)},writeBytesField:function(c,l){this.writeTag(c,C.Bytes),this.writeBytes(l)},writeFixed32Field:function(c,l){this.writeTag(c,C.Fixed32),this.writeFixed32(l)},writeSFixed32Field:function(c,l){this.writeTag(c,C.Fixed32),this.writeSFixed32(l)},writeFixed64Field:function(c,l){this.writeTag(c,C.Fixed64),this.writeFixed64(l)},writeSFixed64Field:function(c,l){this.writeTag(c,C.Fixed64),this.writeSFixed64(l)},writeVarintField:function(c,l){this.writeTag(c,C.Varint),this.writeVarint(l)},writeSVarintField:function(c,l){this.writeTag(c,C.Varint),this.writeSVarint(l)},writeStringField:function(c,l){this.writeTag(c,C.Bytes),this.writeString(l)},writeFloatField:function(c,l){this.writeTag(c,C.Fixed32),this.writeFloat(l)},writeDoubleField:function(c,l){this.writeTag(c,C.Fixed64),this.writeDouble(l)},writeBooleanField:function(c,l){this.writeVarintField(c,!!l)}};class ra{constructor(l,{pixelRatio:d,version:v,stretchX:S,stretchY:k,content:P}){this.paddedRect=l,this.pixelRatio=d,this.stretchX=S,this.stretchY=k,this.content=P,this.version=v}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 Ra{constructor(l,d){const v={},S={};this.haveRenderCallbacks=[];const k=[];this.addImages(l,v,k),this.addImages(d,S,k);const{w:P,h:R}=Jo(k),Q=new Hl({width:P||1,height:R||1});for(const J in l){const de=l[J],pe=v[J].paddedRect;Hl.copy(de.data,Q,{x:0,y:0},{x:pe.x+1,y:pe.y+1},de.data)}for(const J in d){const de=d[J],pe=S[J].paddedRect,we=pe.x+1,Se=pe.y+1,Be=de.data.width,nt=de.data.height;Hl.copy(de.data,Q,{x:0,y:0},{x:we,y:Se},de.data),Hl.copy(de.data,Q,{x:0,y:nt-1},{x:we,y:Se-1},{width:Be,height:1}),Hl.copy(de.data,Q,{x:0,y:0},{x:we,y:Se+nt},{width:Be,height:1}),Hl.copy(de.data,Q,{x:Be-1,y:0},{x:we-1,y:Se},{width:1,height:nt}),Hl.copy(de.data,Q,{x:0,y:0},{x:we+Be,y:Se},{width:1,height:nt})}this.image=Q,this.iconPositions=v,this.patternPositions=S}addImages(l,d,v){for(const S in l){const k=l[S],P={x:0,y:0,w:k.data.width+2,h:k.data.height+2};v.push(P),d[S]=new ra(P,k),k.hasRenderCallback&&this.haveRenderCallbacks.push(S)}}patchUpdatedImages(l,d){l.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const v in l.updatedImages)this.patchUpdatedImage(this.iconPositions[v],l.getImage(v),d),this.patchUpdatedImage(this.patternPositions[v],l.getImage(v),d)}patchUpdatedImage(l,d,v){if(!l||!d||l.version===d.version)return;l.version=d.version;const[S,k]=l.tl;v.update(d.data,void 0,{x:S,y:k})}}Gn("ImagePosition",ra),Gn("ImageAtlas",Ra),a.WritingMode=void 0,(O=a.WritingMode||(a.WritingMode={}))[O.none=0]="none",O[O.horizontal=1]="horizontal",O[O.vertical=2]="vertical",O[O.horizontalOnly=3]="horizontalOnly";const ma=-17;class ls{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(l,d){const v=new ls;return v.scale=l||1,v.fontStack=d,v}static forImage(l){const d=new ls;return d.imageName=l,d}}class Ea{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(l,d){const v=new Ea;for(let S=0;S=0&&v>=l&&ga[this.text.charCodeAt(v)];v--)d--;this.text=this.text.substring(l,d),this.sectionIndex=this.sectionIndex.slice(l,d)}substring(l,d){const v=new Ea;return v.text=this.text.substring(l,d),v.sectionIndex=this.sectionIndex.slice(l,d),v.sections=this.sections,v}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((l,d)=>Math.max(l,this.sections[d].scale),0)}addTextSection(l,d){this.text+=l.text,this.sections.push(ls.forText(l.scale,l.fontStack||d));const v=this.sections.length-1;for(let S=0;S=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function Oa(c,l,d,v,S,k,P,R,Q,J,de,pe,we,Se,Be,nt){const He=Ea.fromFeature(c,S);let xt;pe===a.WritingMode.vertical&&He.verticalizePunctuation();const{processBidirectionalText:zt,processStyledBidirectionalText:vt}=Zs;if(zt&&He.sections.length===1){xt=[];const sn=zt(He.toString(),Za(He,J,k,l,v,Se,Be));for(const tr of sn){const ir=new Ea;ir.text=tr,ir.sections=He.sections;for(let Wn=0;Wn0&&Go>go&&(go=Go)}else{const Xl=ir[zi.fontStack],co=Xl&&Xl[gl];if(co&&co.rect)hA=co.rect,WA=co.metrics;else{const Go=tr[zi.fontStack],zp=Go&&Go[gl];if(!zp)continue;WA=zp.metrics}kl=(ja-zi.scale)*Fa}fA?(sn.verticalizable=!0,ta.push({glyph:gl,imageName:wc,x:ea,y:ia+kl,vertical:fA,scale:zi.scale,fontStack:zi.fontStack,sectionIndex:Nu,metrics:WA,rect:hA}),ea+=Tl*zi.scale+Ir):(ta.push({glyph:gl,imageName:wc,x:ea,y:ia+kl,vertical:fA,scale:zi.scale,fontStack:zi.fontStack,sectionIndex:Nu,metrics:WA,rect:hA}),ea+=WA.advance*zi.scale+Ir)}ta.length!==0&&(Ms=Math.max(ea-Ir,Ms),zA(ta,0,ta.length-1,pl,go)),ea=0;const va=En*ja+go;Zl.lineOffset=Math.max(go,Rr),ia+=va,dA=Math.max(va,dA),++us}var Fs;const ml=ia-ma,{horizontalAlign:oa,verticalAlign:yu}=Pf(Nn);(function(As,ja,Rr,Zl,ta,go,va,aa,zi){const Nu=(ja-Rr)*ta;let gl=0;gl=go!==va?-aa*Zl-ma:(-Zl*zi+.5)*va;for(const kl of As)for(const WA of kl.positionedGlyphs)WA.x+=Nu,WA.y+=gl})(sn.positionedLines,pl,oa,yu,Ms,dA,En,ml,Fn.length),sn.top+=-yu*ml,sn.bottom=sn.top+ml,sn.left+=-oa*Ms,sn.right=sn.left+Ms}(ln,l,d,v,xt,P,R,Q,pe,J,we,nt),!function(sn){for(const tr of sn)if(tr.positionedGlyphs.length!==0)return!1;return!0}(Ut)&&ln}const ga={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Ba={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 fl(c,l,d,v,S,k){if(l.imageName){const P=v[l.imageName];return P?P.displaySize[0]*l.scale*Fa/k+S:0}{const P=d[l.fontStack],R=P&&P[c];return R?R.metrics.advance*l.scale+S:0}}function Gd(c,l,d,v){const S=Math.pow(c-l,2);return v?c=0;let de=0;for(let we=0;we-d/2;){if(P--,P<0)return!1;R-=c[P].dist(k),k=c[P]}R+=c[P].dist(c[P+1]),P++;const Q=[];let J=0;for(;R