h?w=d:A=d,d=0.5*(A-w)+w;return d},solve:function(c,p){return this.sampleCurveY(this.solveCurveX(c,p))}},_}(),N1=b(x1);let V1,q1;function X1(){return V1!=null||(V1=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),V1}function J1(){if(q1==null&&(q1=!1,X1())){let c=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(c){for(let d=0;d<25;d++){let a=4*d;c.fillStyle=`rgb(${a},${a+1},${a+2})`,c.fillRect(d%5,Math.floor(d/5),1,1)}let p=c.getImageData(0,0,5,5).data;for(let d=0;d<100;d++)if(d%4!=3&&p[d]!==d){q1=!0;break}}}return q1||!1}var A1=0.000001,v1=typeof Float32Array4&&arguments[4]!==void 0?arguments[4]:"zyx",h=Math.PI/360;c*=h,d*=h,p*=h;var y=Math.sin(c),w=Math.cos(c),A=Math.sin(p),k=Math.cos(p),W=Math.sin(d),n=Math.cos(d);switch(a){case"xyz":l[0]=y*k*n+w*A*W,l[1]=w*A*n-y*k*W,l[2]=w*k*W+y*A*n,l[3]=w*k*n-y*A*W;break;case"xzy":l[0]=y*k*n-w*A*W,l[1]=w*A*n-y*k*W,l[2]=w*k*W+y*A*n,l[3]=w*k*n+y*A*W;break;case"yxz":l[0]=y*k*n+w*A*W,l[1]=w*A*n-y*k*W,l[2]=w*k*W-y*A*n,l[3]=w*k*n+y*A*W;break;case"yzx":l[0]=y*k*n+w*A*W,l[1]=w*A*n+y*k*W,l[2]=w*k*W-y*A*n,l[3]=w*k*n-y*A*W;break;case"zxy":l[0]=y*k*n-w*A*W,l[1]=w*A*n+y*k*W,l[2]=w*k*W+y*A*n,l[3]=w*k*n-y*A*W;break;case"zyx":l[0]=y*k*n-w*A*W,l[1]=w*A*n+y*k*W,l[2]=w*k*W-y*A*n,l[3]=w*k*n+y*A*W;break;default:throw Error("Unknown angle order "+a)}return l}function ol(){var l=new v1(2);return v1!=Float32Array&&(l[0]=0,l[1]=0),l}function Sl(l,c){var p=new v1(2);return p[0]=l,p[1]=c,p}B1(),P1=new v1(4),v1!=Float32Array&&(P1[0]=0,P1[1]=0,P1[2]=0,P1[3]=0),B1(),J(1,0,0),J(0,1,0),al(),al(),f1(),ol();let ll=8192;function O0(l,c,p){return c*(ll/(l.tileSize*Math.pow(2,p-l.tileID.overscaledZ)))}function l0(l){return l instanceof Error?l:Error(typeof l=="string"?l:String(l))}function O2(l,c){return(l%c+c)%c}function Au(l,c,p){return l*(1-p)+c*p}function Qu(l){if(l=1)return 1;let c=l*l,p=c*l;return 4*(la.solve(h)}let W5=V5(0.25,0.1,0.25,1);function G0(l,c,p){return Math.min(p,Math.max(c,l))}function Tc(l,c,p){let d=p-c,a=((l-c)%d+d)%d+c;return a===c?p:a}function h2(l,...c){for(let p of c)for(let d in p)l[d]=p[d];return l}let y3=1;function ju(l,c,p){let d={};for(let a in l)d[a]=c.call(this,l[a],a,l);return d}function Vl(l,c,p){let d={};for(let a in l)c.call(this,l[a],a,l)&&(d[a]=l[a]);return d}function gl(l){return Array.isArray(l)?l.map(gl):typeof l=="object"&&l?ju(l,gl):l}let L5={};function w0(l){L5[l]||(typeof console(c.y-l.y)*(p.x-l.x)}function W0(l){return typeof WorkerGlobalScope<"u"&&l!==void 0&&l instanceof WorkerGlobalScope}let Vu=null;function H6(l){return typeof ImageBitmap"u")throw Error("VideoFrame not supported");let h=new VideoFrame(l,{timestamp:0});try{let y=h==null?void 0:h.format;if(!y||!y.startsWith("BGR")&&!y.startsWith("RGB"))throw Error(`Unrecognized format ${y}`);let w=y.startsWith("BGR"),A=new Uint8ClampedArray(d*a*4);if(yield h.copyTo(A,function(k,W,n,q,C){let B=4*Math.max(-W,0),M=(Math.max(0,n)-n)*q*4+B,D=4*q,I=Math.max(0,W),O=Math.max(0,n);return{rect:{x:I,y:O,width:Math.min(k.width,W+q)-I,height:Math.min(k.height,n+C)-O},layout:[{offset:M,stride:D}]}}(l,c,p,d,a)),w)for(let k=0;k{l.removeEventListener(c,p,d)}}}function Wu(l){return l*Math.PI/180}function Xu(l){return l/Math.PI*180}let Zc={touchstart:!0,touchmove:!0,touchmoveWindow:!0,touchend:!0,touchcancel:!0},z6={dblclick:!0,click:!0,mouseover:!0,mouseout:!0,mousedown:!0,mousemove:!0,mousemoveWindow:!0,mouseup:!0,mouseupWindow:!0,contextmenu:!0,wheel:!0},bc="AbortError";class s3 extends Error{constructor(l=bc){super(l instanceof Error?l.message:l),this.name=bc,l instanceof Error&&l.stack&&(this.stack=l.stack)}}function O6(l){return l instanceof Error&&l.name===bc}function $c(l){if(l.aborted)throw new s3(l.reason)}let Tu={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function Lu(l){return Tu.REGISTERED_PROTOCOLS[l.substring(0,l.indexOf("://"))]}let N2="global-dispatcher";class Zu extends Error{constructor(l,c,p,d){super(`AJAXError: ${c} (${l}): ${p}`),this.status=l,this.statusText=c,this.url=p,this.body=d}}let _c=()=>{var l;return W0(self)?(l=self.worker)===null||l===void 0?void 0:l.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href},C5=function(l,c){return g(this,void 0,void 0,function*(){var p,d;if(l.url.includes("://")&&!/^https?:|^file:/.test(l.url)){let a=Lu(l.url);if(a){let h=yield a(l,c);return h.data||l.type!=="arrayBuffer"?h:h2(h,{data:new ArrayBuffer(0)})}if(W0(self)&&((p=self.worker)===null||p===void 0?void 0:p.actor))return self.worker.actor.sendAsync({type:"GR",data:l,targetMapId:N2},c)}if(!((a)=>{var h;return a.startsWith("file:")||((h=_c())===null||h===void 0?void 0:h.startsWith("file:"))&&!/^\w+:/.test(a)})(l.url)){if(fetch&&Request&&AbortController&&Object.hasOwn(Request.prototype,"signal"))return function(a,h){return g(this,void 0,void 0,function*(){let y=new Request(a.url,{method:a.method||"GET",body:a.body,credentials:a.credentials,headers:a.headers,cache:a.cache,referrer:_c(),referrerPolicy:a.referrerPolicy,signal:h.signal}),w,A;a.type!=="json"||y.headers.has("Accept")||y.headers.set("Accept","application/json");try{w=yield fetch(y)}catch(W){if(O6(W))throw W;throw new Zu(0,l0(W).message,a.url,new Blob)}if(!w.ok){let W=yield w.blob();throw new Zu(w.status,w.statusText,a.url,W)}A=a.type==="arrayBuffer"||a.type==="image"?w.arrayBuffer():a.type==="json"?w.json():w.text();let k=yield A;return $c(h.signal),{data:k,cacheControl:w.headers.get("Cache-Control"),expires:w.headers.get("Expires"),etag:w.headers.get("ETag")}})}(l,c);if(W0(self)&&((d=self.worker)===null||d===void 0?void 0:d.actor))return self.worker.actor.sendAsync({type:"GR",data:l,mustQueue:!0,targetMapId:N2},c)}return function(a,h){return new Promise((y,w)=>{var A;let k=new XMLHttpRequest;k.open(a.method||"GET",a.url,!0),a.type!=="arrayBuffer"&&a.type!=="image"||(k.responseType="arraybuffer");for(let W in a.headers)k.setRequestHeader(W,a.headers[W]);a.type==="json"&&(k.responseType="text",((A=a.headers)===null||A===void 0?void 0:A.Accept)||k.setRequestHeader("Accept","application/json")),k.withCredentials=a.credentials==="include",k.onerror=()=>{w(Error(k.statusText))},k.onload=()=>{if(!h.signal.aborted)if((k.status>=200&&k.status{k.abort(),w(new s3(h.signal.reason))}),k.send(a.body)})}(l,c)})};function G2(l){if(!l||l.indexOf("://"){this.off(l,c)}}}off(l,c){return x5(l,c,this._listeners),x5(l,c,this._oneTimeListeners),this}once(l,c){return c?(this._oneTimeListeners||(this._oneTimeListeners={}),S3(l,c,this._oneTimeListeners),this):new Promise((p)=>this.once(l,p))}fire(l,c){var p,d;typeof l=="string"&&(l=new k3(l,c||{}));let a=l.type;if(this.listens(a)){l.target=this;let h=((p=this._listeners)===null||p===void 0?void 0:p[a])?this._listeners[a].slice():[];for(let A of h)A.call(this,l);let y=((d=this._oneTimeListeners)===null||d===void 0?void 0:d[a])?this._oneTimeListeners[a].slice():[];for(let A of y)x5(a,A,this._oneTimeListeners),A.call(this,l);let w=this._eventedParent;w&&(h2(l,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),w.fire(l))}else l instanceof N5&&console.error(l.error);return this}listens(l){var c,p,d,a,h;return((p=(c=this._listeners)===null||c===void 0?void 0:c[l])===null||p===void 0?void 0:p.length)>0||((a=(d=this._oneTimeListeners)===null||d===void 0?void 0:d[l])===null||a===void 0?void 0:a.length)>0||((h=this._eventedParent)===null||h===void 0?void 0:h.listens(l))}setEventedParent(l,c){return this._eventedParent=l,this._eventedParentData=c,this}}var E1={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number",length:2},centerAltitude:{type:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},roll:{type:"number",default:0,units:"degrees"},state:{type:"state",default:{}},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},"font-faces":{type:"fontFaces"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},encoding:{type:"enum",values:{mvt:{},mlt:{}},default:"mvt"},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"filter"},tolerance:{type:"number",default:0.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},"color-relief":{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_color-relief","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},"layout_color-relief":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},filter:{type:"boolean",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"{d in c&&(p[d]=c[d])}),p}function nl(l,c){if(Array.isArray(l)){if(!Array.isArray(c)||l.length!==c.length)return!1;for(let p=0;p<l.length;p++)if(!nl(l[p],c[p]))return!1;return!0}if(typeof l=="object"&&l!==null&&c!==null){if(typeof c!="object")return!1;if(Object.keys(l).length!==Object.keys(c).length)return!1;for(let p in l)if(!nl(l[p],c[p]))return!1;return!0}return l===c}function t0(l,c){l.push(c)}function F5(l,c,p){t0(p,{command:"addSource",args:[l,c[l]]})}function yp(l,c,p){t0(c,{command:"removeSource",args:[l]}),p[l]=!0}function wp(l,c,p,d){yp(l,p,d),F5(l,c,p)}function fd(l,c,p){let d;for(d in l[p])if(Object.prototype.hasOwnProperty.call(l[p],d)&&d!=="data"&&!nl(l[p][d],c[p][d]))return!1;for(d in c[p])if(Object.prototype.hasOwnProperty.call(c[p],d)&&d!=="data"&&!nl(l[p][d],c[p][d]))return!1;return!0}function ic(l,c,p,d,a,h){l=l||{},c=c||{};for(let y in l)Object.prototype.hasOwnProperty.call(l,y)&&(nl(l[y],c[y])||p.push({command:h,args:[d,y,c[y],a]}));for(let y in c)Object.prototype.hasOwnProperty.call(c,y)&&!Object.prototype.hasOwnProperty.call(l,y)&&(nl(l[y],c[y])||p.push({command:h,args:[d,y,c[y],a]}))}function j6(l){return l.id}function sp(l,c){return l[c.id]=c,l}class M1{constructor(l,c,p,d){this.message=(l?`${l}: `:"")+p,d&&(this.identifier=d),c!=null&&c.__line__&&(this.line=c.__line__)}}function bu(l,...c){for(let p of c)for(let d in p)l[d]=p[d];return l}class s0 extends Error{constructor(l,c){super(c),this.message=c,this.key=l}}class ec{constructor(l,c=[]){this.parent=l,this.bindings={};for(let[p,d]of c)this.bindings[p]=d}concat(l){return new ec(this,l)}get(l){if(this.bindings[l])return this.bindings[l];if(this.parent)return this.parent.get(l);throw Error(`${l} not found in scope.`)}has(l){return!!this.bindings[l]||!!this.parent&&this.parent.has(l)}}let $u={kind:"null"},H1={kind:"number"},cl={kind:"string"},vl={kind:"boolean"},y2={kind:"color"},tc={kind:"projectionDefinition"},Cu={kind:"object"},pl={kind:"value"},q4={kind:"collator"},P4={kind:"formatted"},lr={kind:"padding"},E3={kind:"colorArray"},M4={kind:"numberArray"},n3={kind:"resolvedImage"},B4={kind:"variableAnchorOffsetCollection"};function L0(l,c){return{kind:"array",itemType:l,N:c}}function Wl(l){if(l.kind==="array"){let c=Wl(l.itemType);return typeof l.N=="number"?`array`:l.itemType.kind==="value"?"array":`array`}return l.kind}let ur=[$u,H1,cl,vl,y2,tc,P4,Cu,L0(pl),lr,M4,E3,n3,B4];function A3(l,c){if(c.kind==="error")return null;if(l.kind==="array"){if(c.kind==="array"&&(c.N===0&&c.itemType.kind==="value"||!A3(l.itemType,c.itemType))&&(typeof l.N!="number"||l.N===c.N))return null}else{if(l.kind===c.kind)return null;if(l.kind==="value"){for(let p of ur)if(!A3(p,c))return null}}return`Expected ${Wl(l)} but found ${Wl(c)} instead.`}function K4(l,c){return c.some((p)=>p.kind===l.kind)}function q5(l,c){return c.some((p)=>p==="null"?l===null:p==="array"?Array.isArray(l):p==="object"?l&&!Array.isArray(l)&&typeof l=="object":p===typeof l)}function Q2(l,c){return l.kind==="array"&&c.kind==="array"?l.itemType.kind===c.itemType.kind&&typeof l.N=="number":l.kind===c.kind}let Sp=0.96422,P5=0.82521,cr=0.13793103448275862,jl=0.20689655172413793,J6=3*jl*jl,X6=jl*jl*jl,V3=Math.PI/180,T6=180/Math.PI;function Z6(l){return(l%=360)<0&&(l+=360),l}function b6([l,c,p,d]){let a,h,y=pr((0.2225045*(l=rr(l))+0.7168786*(c=rr(c))+0.0606169*(p=rr(p)))/1);l===c&&c===p?a=h=y:(a=pr((0.4360747*l+0.3850649*c+0.1430804*p)/Sp),h=pr((0.0139322*l+0.0971045*c+0.7141733*p)/P5));let w=116*y-16;return[w<0?0:w,500*(a-y),200*(y-h),d]}function rr(l){return lX6?Math.pow(l,0.3333333333333333):l/J6+cr}function $6([l,c,p,d]){let a=(l+16)/116,h=isNaN(c)?a:a+c/500,y=isNaN(p)?a:a-p/200;return a=1*i6(a),h=Sp*i6(h),y=P5*i6(y),[_6(3.1338561*h-1.6168667*a-0.4906146*y),_6(-0.9787684*h+1.9161415*a+0.033454*y),_6(0.0719453*h-0.2289914*a+1.4052427*y),d]}function _6(l){return(l=l<=0.00304?12.92*l:1.055*Math.pow(l,0.4166666666666667)-0.055)1?1:l}function i6(l){return l>jl?l*l*l:J6*(l-cr)}let dd=Object.hasOwn||function(l,c){return Object.prototype.hasOwnProperty.call(l,c)};function U4(l,c){return dd(l,c)?l[c]:void 0}function fr(l){return parseInt(l.padEnd(2,l),16)/255}function kp(l,c){return W3(c?l/100:l,0,1)}function W3(l,c,p){return Math.min(Math.max(c,l),p)}function e6(l){return!l.some(Number.isNaN)}let D4={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};function xu(l,c,p){return l+p*(c-l)}function M5(l,c,p){return l.map((d,a)=>xu(d,c[a],p))}class dl{constructor(l,c,p,d=1,a=!0){this.r=l,this.g=c,this.b=p,this.a=d,a||(this.r*=d,this.g*=d,this.b*=d,d||this.overwriteGetter("rgb",[l,c,p,d]))}static parse(l){if(l instanceof dl)return l;if(typeof l!="string")return;let c=function(p){if((p=p.toLowerCase().trim())==="transparent")return[0,0,0,0];let d=U4(D4,p);if(d){let[h,y,w]=d;return[h/255,y/255,w/255,1]}if(p.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(p)){let h=p.lengthMath.round(255*a)).join(",")},${d})`}static interpolate(l,c,p,d="rgb"){switch(d){case"rgb":{let[a,h,y,w]=M5(l.rgb,c.rgb,p);return new dl(a,h,y,w,!1)}case"hcl":{let[a,h,y,w]=l.hcl,[A,k,W,n]=c.hcl,q,C;if(isNaN(a)||isNaN(A))isNaN(a)?isNaN(A)?q=NaN:(q=A,y!==1&&y!==0||(C=k)):(q=a,W!==1&&W!==0||(C=h));else{let O=A-a;A>a&&O>180?O-=360:A180&&(O+=360),q=a+p*O}let[B,M,D,I]=function([O,Y,G,j]){return O=isNaN(O)?0:O*V3,$6([G,Math.cos(O)*Y,Math.sin(O)*Y,j])}([q,C!=null?C:xu(h,k,p),xu(y,W,p),xu(w,n,p)]);return new dl(B,M,D,I,!1)}case"lab":{let[a,h,y,w]=$6(M5(l.lab,c.lab,p));return new dl(a,h,y,w,!1)}}}}dl.black=new dl(0,0,0,1),dl.white=new dl(1,1,1,1),dl.transparent=new dl(0,0,0,0),dl.red=new dl(1,0,0,1);class R4{constructor(l,c,p){this.sensitivity=l?c?"variant":"case":c?"accent":"base",this.locale=p,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(l,c){return this.collator.compare(l,c)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}let Ep=["bottom","center","top"];class H4{constructor(l,c,p,d,a,h){this.text=l,this.image=c,this.scale=p,this.fontStack=d,this.textColor=a,this.verticalAlign=h}}class Q0{constructor(l){this.sections=l}static fromString(l){return new Q0([new H4(l,null,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some((l)=>l.text.length!==0||l.image&&l.image.name.length!==0)}static factory(l){return l instanceof Q0?l:Q0.fromString(l)}toString(){return this.sections.length===0?"":this.sections.map((l)=>l.text).join("")}}class P0{constructor(l){this.values=l.slice()}static parse(l){if(l instanceof P0)return l;if(typeof l=="number")return new P0([l,l,l,l]);if(Array.isArray(l)&&!(l.length4)){for(let c of l)if(typeof c!="number")return;switch(l.length){case 1:l=[l[0],l[0],l[0],l[0]];break;case 2:l=[l[0],l[1],l[0],l[1]];break;case 3:l=[l[0],l[1],l[2],l[1]]}return new P0(l)}}toString(){return JSON.stringify(this.values)}static interpolate(l,c,p){return new P0(M5(l.values,c.values,p))}}class Yl{constructor(l){this.values=l.slice()}static parse(l){if(l instanceof Yl)return l;if(typeof l=="number")return new Yl([l]);if(Array.isArray(l)){for(let c of l)if(typeof c!="number")return;return new Yl(l)}}toString(){return JSON.stringify(this.values)}static interpolate(l,c,p){return new Yl(M5(l.values,c.values,p))}}class e1{constructor(l){this.values=l.slice()}static parse(l){if(l instanceof e1)return l;if(typeof l=="string"){let p=dl.parse(l);if(!p)return;return new e1([p])}if(!Array.isArray(l))return;let c=[];for(let p of l){if(typeof p!="string")return;let d=dl.parse(p);if(!d)return;c.push(d)}return new e1(c)}toString(){return JSON.stringify(this.values)}static interpolate(l,c,p,d="rgb"){let a=[];if(l.values.length!=c.values.length)throw Error(`colorArray: Arrays have mismatched length (${l.values.length} vs. ${c.values.length}), cannot interpolate.`);for(let h=0;h<l.values.length;h++)a.push(dl.interpolate(l.values[h],c.values[h],p,d));return new e1(a)}}class Ll extends Error{constructor(l){super(l),this.name="RuntimeError"}toJSON(){return this.message}}let _u=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class j0{constructor(l){this.values=l.slice()}static parse(l){if(l instanceof j0)return l;if(Array.isArray(l)&&!(l.length<1)&&l.length%2==0){for(let c=0;c<l.length;c+=2){let p=l[c],d=l[c+1];if(typeof p!="string"||!_u.has(p))return;if(!Array.isArray(d)||d.length!==2||typeof d[0]!="number"||typeof d[1]!="number")return}return new j0(l)}}toString(){return JSON.stringify(this.values)}static interpolate(l,c,p){let d=l.values,a=c.values;if(d.length!==a.length)throw new Ll(`Cannot interpolate values of different length. from: ${l.toString()}, to: ${c.toString()}`);let h=[];for(let y=0;y=0&&l=0&&c=0&&p=0&&d<=1?null:`Invalid rgba value [${[l,c,p,d].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof d=="number"?[l,c,p,d]:[l,c,p]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function iu(l){if(l===null||typeof l=="string"||typeof l=="boolean"||typeof l=="number"||l instanceof M0||l instanceof dl||l instanceof R4||l instanceof Q0||l instanceof P0||l instanceof Yl||l instanceof e1||l instanceof j0||l instanceof w2)return!0;if(Array.isArray(l)){for(let c of l)if(!iu(c))return!1;return!0}if(typeof l=="object"){for(let c in l)if(!iu(l[c]))return!1;return!0}return!1}function _l(l){if(l===null)return $u;if(typeof l=="string")return cl;if(typeof l=="boolean")return vl;if(typeof l=="number")return H1;if(l instanceof dl)return y2;if(l instanceof M0)return tc;if(l instanceof R4)return q4;if(l instanceof Q0)return P4;if(l instanceof P0)return lr;if(l instanceof Yl)return M4;if(l instanceof e1)return E3;if(l instanceof j0)return B4;if(l instanceof w2)return n3;if(Array.isArray(l)){let c=l.length,p;for(let d of l){let a=_l(d);if(p){if(p===a)continue;p=pl;break}p=a}return L0(p||pl,c)}return Cu}function eu(l){let c=typeof l;return l===null?"":c==="string"||c==="number"||c==="boolean"?String(l):l instanceof dl||l instanceof M0||l instanceof Q0||l instanceof P0||l instanceof Yl||l instanceof e1||l instanceof j0||l instanceof w2?l.toString():JSON.stringify(l)}class t2{constructor(l,c){this.type=l,this.value=c}static parse(l,c){if(l.length!==2)return c.error(`'literal' expression requires exactly one argument, but found ${l.length-1} instead.`);if(!iu(l[1]))return c.error("invalid value");let p=l[1],d=_l(p),a=c.expectedType;return d.kind!=="array"||d.N!==0||!a||a.kind!=="array"||typeof a.N=="number"&&a.N!==0||(d=a),new t2(d,p)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}let I4={string:cl,number:H1,boolean:vl,object:Cu};class l2{constructor(l,c){this.type=l,this.args=c}static parse(l,c){if(l.length2){let A=l[1];if(typeof A!="string"||!(A in I4)||A==="object")return c.error('The item type argument of "array" must be one of string, number, boolean',1);y=I4[A],d++}else y=pl;if(l.length>3){if(l[2]!==null&&(typeof l[2]!="number"||l[2]<0||l[2]!==Math.floor(l[2])))return c.error('The length argument to "array" must be a positive integer literal',2);w=l[2],d++}p=L0(y,w)}else{if(!I4[a])throw Error(`Types doesn't contain name = ${a}`);p=I4[a]}let h=[];for(;d<l.length;d++){let y=c.parse(l[d],d,pl);if(!y)return null;h.push(y)}return new l2(p,h)}evaluate(l){for(let c=0;cl.outputDefined())}}let B5={"to-boolean":vl,"to-color":y2,"to-number":H1,"to-string":cl};class Nu{constructor(l,c){this.type=l,this.args=c}static parse(l,c){if(l.length<2)return c.error("Expected at least one argument.");let p=l[0];if(!B5[p])throw Error(`Can't parse ${p} as it is not part of the known types`);if((p==="to-boolean"||p==="to-string")&&l.length!==2)return c.error("Expected one argument.");let d=B5[p],a=[];for(let h=1;h<l.length;h++){let y=c.parse(l[h],h,pl);if(!y)return null;a.push(y)}return new Nu(d,a)}evaluate(l){switch(this.type.kind){case"boolean":return Boolean(this.args[0].evaluate(l));case"color":{let c,p;for(let d of this.args){if(c=d.evaluate(l),p=null,c instanceof dl)return c;if(typeof c=="string"){let a=l.parseColor(c);if(a)return a}else if(Array.isArray(c)&&(p=c.length4?`Invalid rgba value ${JSON.stringify(c)}: expected an array containing either three or four numeric values.`:L3(c[0],c[1],c[2],c[3]),!p))return new dl(c[0]/255,c[1]/255,c[2]/255,c[3])}throw new Ll(p||`Could not parse color from value '${typeof c=="string"?c:JSON.stringify(c)}'`)}case"padding":{let c;for(let p of this.args){c=p.evaluate(l);let d=P0.parse(c);if(d)return d}throw new Ll(`Could not parse padding from value '${typeof c=="string"?c:JSON.stringify(c)}'`)}case"numberArray":{let c;for(let p of this.args){c=p.evaluate(l);let d=Yl.parse(c);if(d)return d}throw new Ll(`Could not parse numberArray from value '${typeof c=="string"?c:JSON.stringify(c)}'`)}case"colorArray":{let c;for(let p of this.args){c=p.evaluate(l);let d=e1.parse(c);if(d)return d}throw new Ll(`Could not parse colorArray from value '${typeof c=="string"?c:JSON.stringify(c)}'`)}case"variableAnchorOffsetCollection":{let c;for(let p of this.args){c=p.evaluate(l);let d=j0.parse(c);if(d)return d}throw new Ll(`Could not parse variableAnchorOffsetCollection from value '${typeof c=="string"?c:JSON.stringify(c)}'`)}case"number":{let c=null;for(let p of this.args){if(c=p.evaluate(l),c===null)return 0;let d=Number(c);if(!isNaN(d))return d}throw new Ll(`Could not convert ${JSON.stringify(c)} to number.`)}case"formatted":return Q0.fromString(eu(this.args[0].evaluate(l)));case"resolvedImage":return w2.fromString(eu(this.args[0].evaluate(l)));case"projectionDefinition":return this.args[0].evaluate(l);default:return eu(this.args[0].evaluate(l))}}eachChild(l){this.args.forEach(l)}outputDefined(){return this.args.every((l)=>l.outputDefined())}}let np=["Unknown","Point","LineString","Polygon"];class dr{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache=new Map,this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?np[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(l){let c=this._parseColorCache.get(l);return c||(c=dl.parse(l),this._parseColorCache.set(l,c)),c}}class tu{constructor(l,c,p=[],d,a=new ec,h=[]){this.registry=l,this.path=p,this.key=p.map((y)=>`[${y}]`).join(""),this.scope=a,this.errors=h,this.expectedType=d,this._isConstant=c}parse(l,c,p,d,a={}){return c?this.concat(c,p,d)._parse(l,a):this._parse(l,a)}_parse(l,c){function p(d,a,h){return h==="assert"?new l2(a,[d]):h==="coerce"?new Nu(a,[d]):d}if(l!==null&&typeof l!="string"&&typeof l!="boolean"&&typeof l!="number"||(l=["literal",l]),Array.isArray(l)){if(l.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');let d=l[0];if(typeof d!="string")return this.error(`Expression name must be a string, but found ${typeof d} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;let a=this.registry[d];if(a){let h=a.parse(l,this);if(!h)return null;if(this.expectedType){let y=this.expectedType,w=h.type;if(y.kind!=="string"&&y.kind!=="number"&&y.kind!=="boolean"&&y.kind!=="object"&&y.kind!=="array"||w.kind!=="value"){if(y.kind==="projectionDefinition"&&["string","array"].includes(w.kind)||["color","formatted","resolvedImage"].includes(y.kind)&&["value","string"].includes(w.kind)||["padding","numberArray"].includes(y.kind)&&["value","number","array"].includes(w.kind)||y.kind==="colorArray"&&["value","string","array"].includes(w.kind)||y.kind==="variableAnchorOffsetCollection"&&["value","array"].includes(w.kind))h=p(h,y,c.typeAnnotation||"coerce");else if(this.checkSubtype(y,w))return null}else h=p(h,y,c.typeAnnotation||"assert")}if(!(h instanceof t2)&&h.type.kind!=="resolvedImage"&&this._isConstant(h)){let y=new dr;try{h=new t2(h.type,h.evaluate(y))}catch(w){return this.error(w.message),null}}return h}return this.error(`Unknown expression "${d}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(l===void 0?"'undefined' value invalid. Use null instead.":typeof l=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof l} instead.`)}concat(l,c,p){let d=typeof l=="number"?this.path.concat(l):this.path,a=p?this.scope.concat(p):this.scope;return new tu(this.registry,this._isConstant,d,c||null,a,this.errors)}error(l,...c){let p=`${this.key}${c.map((d)=>`[${d}]`).join("")}`;this.errors.push(new s0(p,l))}checkSubtype(l,c){let p=A3(l,c);return p&&this.error(p),p}}class xl{constructor(l,c){this.type=c.type,this.bindings=[].concat(l),this.result=c}evaluate(l){return this.result.evaluate(l)}eachChild(l){for(let c of this.bindings)l(c[1]);l(this.result)}static parse(l,c){if(l.length<4)return c.error(`Expected at least 3 arguments, but found ${l.length-1} instead.`);let p=[];for(let a=1;a<l.length-1;a+=2){let h=l[a];if(typeof h!="string")return c.error(`Expected string, but found ${typeof h} instead.`,a);if(/[^a-zA-Z0-9_]/.test(h))return c.error("Variable names must contain only alphanumeric characters or '_'.",a);let y=c.parse(l[a+1],a+1);if(!y)return null;p.push([h,y])}let d=c.parse(l[l.length-1],l.length-1,c.expectedType,p);return d?new xl(p,d):null}outputDefined(){return this.result.outputDefined()}}class C3{constructor(l,c){this.type=c.type,this.name=l,this.boundExpression=c}static parse(l,c){if(l.length!==2||typeof l[1]!="string")return c.error("'var' expression requires exactly one string literal argument.");let p=l[1];return c.scope.has(p)?new C3(p,c.scope.get(p)):c.error(`Unknown variable "${p}". Make sure "${p}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(l){return this.boundExpression.evaluate(l)}eachChild(){}outputDefined(){return!1}}class yl{constructor(l,c,p){this.type=l,this.index=c,this.input=p}static parse(l,c){if(l.length!==3)return c.error(`Expected 2 arguments, but found ${l.length-1} instead.`);let p=c.parse(l[1],1,H1),d=c.parse(l[2],2,L0(c.expectedType||pl));return p&&d?new yl(d.type.itemType,p,d):null}evaluate(l){let c=this.index.evaluate(l),p=this.input.evaluate(l);if(c<0)throw new Ll(`Array index out of bounds: ${c} =p.length)throw new Ll(`Array index out of bounds: ${c} > ${p.length-1}.`);if(c!==Math.floor(c))throw new Ll(`Array index must be an integer, but found ${c} instead.`);return p[c]}eachChild(l){l(this.index),l(this.input)}outputDefined(){return!1}}class rl{constructor(l,c){this.type=vl,this.needle=l,this.haystack=c}static parse(l,c){if(l.length!==3)return c.error(`Expected 2 arguments, but found ${l.length-1} instead.`);let p=c.parse(l[1],1,pl),d=c.parse(l[2],2,pl);return p&&d?K4(p.type,[vl,cl,H1,$u,pl])?new rl(p,d):c.error(`Expected first argument to be of type boolean, string, number or null, but found ${Wl(p.type)} instead`):null}evaluate(l){let c=this.needle.evaluate(l),p=this.haystack.evaluate(l);if(!p)return!1;if(!q5(c,["boolean","string","number","null"]))throw new Ll(`Expected first argument to be of type boolean, string, number or null, but found ${Wl(_l(c))} instead.`);if(!q5(p,["string","array"]))throw new Ll(`Expected second argument to be of type array or string, but found ${Wl(_l(p))} instead.`);return p.indexOf(c)>=0}eachChild(l){l(this.needle),l(this.haystack)}outputDefined(){return!0}}class x3{constructor(l,c,p){this.type=H1,this.needle=l,this.haystack=c,this.fromIndex=p}static parse(l,c){if(l.length=5)return c.error(`Expected 2 or 3 arguments, but found ${l.length-1} instead.`);let p=c.parse(l[1],1,pl),d=c.parse(l[2],2,pl);if(!p||!d)return null;if(!K4(p.type,[vl,cl,H1,$u,pl]))return c.error(`Expected first argument to be of type boolean, string, number or null, but found ${Wl(p.type)} instead`);if(l.length===4){let a=c.parse(l[3],3,H1);return a?new x3(p,d,a):null}return new x3(p,d)}evaluate(l){let c=this.needle.evaluate(l),p=this.haystack.evaluate(l);if(!q5(c,["boolean","string","number","null"]))throw new Ll(`Expected first argument to be of type boolean, string, number or null, but found ${Wl(_l(c))} instead.`);let d;if(this.fromIndex&&(d=this.fromIndex.evaluate(l)),q5(p,["string"])){let a=p.indexOf(c,d);return a===-1?-1:[...p.slice(0,a)].length}if(q5(p,["array"]))return p.indexOf(c,d);throw new Ll(`Expected second argument to be of type array or string, but found ${Wl(_l(p))} instead.`)}eachChild(l){l(this.needle),l(this.haystack),this.fromIndex&&l(this.fromIndex)}outputDefined(){return!1}}class wl{constructor(l,c,p,d,a,h){this.inputType=l,this.type=c,this.input=p,this.cases=d,this.outputs=a,this.otherwise=h}static parse(l,c){if(l.length<5)return c.error(`Expected at least 4 arguments, but found only ${l.length-1}.`);if(l.length%2!=1)return c.error("Expected an even number of arguments.");let p,d;c.expectedType&&c.expectedType.kind!=="value"&&(d=c.expectedType);let a={},h=[];for(let A=2;ANumber.MAX_SAFE_INTEGER)return n.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof C=="number"&&Math.floor(C)!==C)return n.error("Numeric branch labels must be integer values.");if(p){if(n.checkSubtype(p,_l(C)))return null}else p=_l(C);if(a[String(C)]!==void 0)return n.error("Branch labels must be unique.");a[String(C)]=h.length}let q=c.parse(W,A,d);if(!q)return null;d=d||q.type,h.push(q)}let y=c.parse(l[1],1,pl);if(!y)return null;let w=c.parse(l[l.length-1],l.length-1,d);return w?y.type.kind!=="value"&&c.concat(1).checkSubtype(p,y.type)?null:new wl(p,d,y,a,h,w):null}evaluate(l){let c=this.input.evaluate(l);return(_l(c)===this.inputType&&this.outputs[this.cases[c]]||this.otherwise).evaluate(l)}eachChild(l){l(this.input),this.outputs.forEach(l),l(this.otherwise)}outputDefined(){return this.outputs.every((l)=>l.outputDefined())&&this.otherwise.outputDefined()}}class j2{constructor(l,c,p){this.type=l,this.branches=c,this.otherwise=p}static parse(l,c){if(l.length<4)return c.error(`Expected at least 3 arguments, but found only ${l.length-1}.`);if(l.length%2!=0)return c.error("Expected an odd number of arguments.");let p;c.expectedType&&c.expectedType.kind!=="value"&&(p=c.expectedType);let d=[];for(let h=1;hc.outputDefined())&&this.otherwise.outputDefined()}}class N3{constructor(l,c,p,d){this.type=l,this.input=c,this.beginIndex=p,this.endIndex=d}static parse(l,c){if(l.length=5)return c.error(`Expected 2 or 3 arguments, but found ${l.length-1} instead.`);let p=c.parse(l[1],1,pl),d=c.parse(l[2],2,H1);if(!p||!d)return null;if(!K4(p.type,[L0(pl),cl,pl]))return c.error(`Expected first argument to be of type array or string, but found ${Wl(p.type)} instead`);if(l.length===4){let a=c.parse(l[3],3,H1);return a?new N3(p.type,p,d,a):null}return new N3(p.type,p,d)}evaluate(l){let c=this.input.evaluate(l),p=this.beginIndex.evaluate(l),d;if(this.endIndex&&(d=this.endIndex.evaluate(l)),q5(c,["string"]))return[...c].slice(p,d).join("");if(q5(c,["array"]))return c.slice(p,d);throw new Ll(`Expected first argument to be of type array or string, but found ${Wl(_l(c))} instead.`)}eachChild(l){l(this.input),l(this.beginIndex),this.endIndex&&l(this.endIndex)}outputDefined(){return!1}}function K5(l,c){let p=l.length-1,d,a,h=0,y=p,w=0;for(;h<=y;)if(w=Math.floor((h+y)/2),d=l[w],a=l[w+1],d<=c){if(w===p||cc))throw new Ll("Input is not a number.");y=w-1}return 0}class F3{constructor(l,c,p){this.type=l,this.input=c,this.labels=[],this.outputs=[];for(let[d,a]of p)this.labels.push(d),this.outputs.push(a)}static parse(l,c){if(l.length-1<4)return c.error(`Expected at least 4 arguments, but found only ${l.length-1}.`);if((l.length-1)%2!=0)return c.error("Expected an even number of arguments.");let p=c.parse(l[1],1,H1);if(!p)return null;let d=[],a=null;c.expectedType&&c.expectedType.kind!=="value"&&(a=c.expectedType);for(let h=1;h=y)return c.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',A);let W=c.parse(w,k,a);if(!W)return null;a=a||W.type,d.push([y,W])}return new F3(a,p,d)}evaluate(l){let c=this.labels,p=this.outputs;if(c.length===1)return p[0].evaluate(l);let d=this.input.evaluate(l);if(d=c[a-1]?p[a-1].evaluate(l):p[K5(c,d)].evaluate(l)}eachChild(l){l(this.input);for(let c of this.outputs)l(c)}outputDefined(){return this.outputs.every((l)=>l.outputDefined())}}function t6(l){return l&&l.__esModule&&Object.prototype.hasOwnProperty.call(l,"default")?l.default:l}var Y4,Ap,l7=function(){if(Ap)return Y4;function l(c,p,d,a){this.cx=3*c,this.bx=3*(d-c)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*p,this.by=3*(a-p)-this.cy,this.ay=1-this.cy-this.by,this.p1x=c,this.p1y=p,this.p2x=d,this.p2y=a}return Ap=1,Y4=l,l.prototype={sampleCurveX:function(c){return((this.ax*c+this.bx)*c+this.cx)*c},sampleCurveY:function(c){return((this.ay*c+this.by)*c+this.cy)*c},sampleCurveDerivativeX:function(c){return(3*this.ax*c+2*this.bx)*c+this.cx},solveCurveX:function(c,p){if(p===void 0&&(p=0.000001),c1)return 1;for(var d=c,a=0;a<8;a++){var h=this.sampleCurveX(d)-c;if(Math.abs(h)<p)return d;var y=this.sampleCurveDerivativeX(d);if(Math.abs(y)<0.000001)break;d-=h/y}var w=0,A=1;for(d=c,a=0;a<20&&(h=this.sampleCurveX(d),!(Math.abs(h-c) h?w=d:A=d,d=0.5*(A-w)+w;return d},solve:function(c,p){return this.sampleCurveY(this.solveCurveX(c,p))}},Y4}(),Vp=t6(l7);class c0{constructor(l,c,p,d,a){this.type=l,this.operator=c,this.interpolation=p,this.input=d,this.labels=[],this.outputs=[];for(let[h,y]of a)this.labels.push(h),this.outputs.push(y)}static interpolationFactor(l,c,p,d){let a=0;if(l.name==="exponential")a=S0(c,l.base,p,d);else if(l.name==="linear")a=S0(c,1,p,d);else if(l.name==="cubic-bezier"){let h=l.controlPoints;a=new Vp(h[0],h[1],h[2],h[3]).solve(S0(c,1,p,d))}return a}static parse(l,c){let[p,d,a,...h]=l;if(!Array.isArray(d)||d.length===0)return c.error("Expected an interpolation type expression.",1);if(d[0]==="linear")d={name:"linear"};else if(d[0]==="exponential"){let A=d[1];if(typeof A!="number")return c.error("Exponential interpolation requires a numeric base.",1,1);d={name:"exponential",base:A}}else{if(d[0]!=="cubic-bezier")return c.error(`Unknown interpolation type ${String(d[0])}`,1,0);{let A=d.slice(1);if(A.length!==4||A.some((k)=>typeof k!="number"||k1))return c.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);d={name:"cubic-bezier",controlPoints:A}}}if(l.length-1<4)return c.error(`Expected at least 4 arguments, but found only ${l.length-1}.`);if((l.length-1)%2!=0)return c.error("Expected an even number of arguments.");if(a=c.parse(a,2,H1),!a)return null;let y=[],w=null;p!=="interpolate-hcl"&&p!=="interpolate-lab"||c.expectedType==E3?c.expectedType&&c.expectedType.kind!=="value"&&(w=c.expectedType):w=y2;for(let A=0;A=k)return c.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',n);let C=c.parse(W,q,w);if(!C)return null;w=w||C.type,y.push([k,C])}return Q2(w,H1)||Q2(w,tc)||Q2(w,y2)||Q2(w,lr)||Q2(w,M4)||Q2(w,E3)||Q2(w,B4)||Q2(w,L0(H1))?new c0(w,p,d,a,y):c.error(`Type ${Wl(w)} is not interpolatable.`)}evaluate(l){let c=this.labels,p=this.outputs;if(c.length===1)return p[0].evaluate(l);let d=this.input.evaluate(l);if(d=c[a-1])return p[a-1].evaluate(l);let h=K5(c,d),y=c0.interpolationFactor(this.interpolation,d,c[h],c[h+1]),w=p[h].evaluate(l),A=p[h+1].evaluate(l);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return xu(w,A,y);case"color":return dl.interpolate(w,A,y);case"padding":return P0.interpolate(w,A,y);case"colorArray":return e1.interpolate(w,A,y);case"numberArray":return Yl.interpolate(w,A,y);case"variableAnchorOffsetCollection":return j0.interpolate(w,A,y);case"array":return M5(w,A,y);case"projectionDefinition":return M0.interpolate(w,A,y)}case"interpolate-hcl":switch(this.type.kind){case"color":return dl.interpolate(w,A,y,"hcl");case"colorArray":return e1.interpolate(w,A,y,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return dl.interpolate(w,A,y,"lab");case"colorArray":return e1.interpolate(w,A,y,"lab")}}}eachChild(l){l(this.input);for(let c of this.outputs)l(c)}outputDefined(){return this.outputs.every((l)=>l.outputDefined())}}function S0(l,c,p,d){let a=d-p,h=l-p;return a===0?0:c===1?h/a:(Math.pow(c,h)-1)/(Math.pow(c,a)-1)}let s2={color:dl.interpolate,number:xu,padding:P0.interpolate,numberArray:Yl.interpolate,colorArray:e1.interpolate,variableAnchorOffsetCollection:j0.interpolate,array:M5};class z4{constructor(l,c){this.type=l,this.args=c}static parse(l,c){if(l.lengthA3(d,y.type));return new z4(h?pl:p,a)}evaluate(l){let c,p=null,d=0;for(let a of this.args)if(d++,p=a.evaluate(l),p&&p instanceof w2&&!p.available&&(c||(c=p.name),p=null,d===this.args.length&&(p=c)),p!==null)break;return p}eachChild(l){this.args.forEach(l)}outputDefined(){return this.args.every((l)=>l.outputDefined())}}function O4(l,c){return l==="=="||l==="!="?c.kind==="boolean"||c.kind==="string"||c.kind==="number"||c.kind==="null"||c.kind==="value":c.kind==="string"||c.kind==="number"||c.kind==="value"}function h0(l,c,p,d){return d.compare(c,p)===0}function U5(l,c,p){let d=l!=="=="&&l!=="!=";return class a{constructor(h,y,w){this.type=vl,this.lhs=h,this.rhs=y,this.collator=w,this.hasUntypedArgument=h.type.kind==="value"||y.type.kind==="value"}static parse(h,y){if(h.length!==3&&h.length!==4)return y.error("Expected two or three arguments.");let w=h[0],A=y.parse(h[1],1,pl);if(!A)return null;if(!O4(w,A.type))return y.concat(1).error(`"${w}" comparisons are not supported for type '${Wl(A.type)}'.`);let k=y.parse(h[2],2,pl);if(!k)return null;if(!O4(w,k.type))return y.concat(2).error(`"${w}" comparisons are not supported for type '${Wl(k.type)}'.`);if(A.type.kind!==k.type.kind&&A.type.kind!=="value"&&k.type.kind!=="value")return y.error(`Cannot compare types '${Wl(A.type)}' and '${Wl(k.type)}'.`);d&&(A.type.kind==="value"&&k.type.kind!=="value"?A=new l2(k.type,[A]):A.type.kind!=="value"&&k.type.kind==="value"&&(k=new l2(A.type,[k])));let W=null;if(h.length===4){if(A.type.kind!=="string"&&k.type.kind!=="string"&&A.type.kind!=="value"&&k.type.kind!=="value")return y.error("Cannot use collator to compare non-string types.");if(W=y.parse(h[3],3,q4),!W)return null}return new a(A,k,W)}evaluate(h){let y=this.lhs.evaluate(h),w=this.rhs.evaluate(h);if(d&&this.hasUntypedArgument){let A=_l(y),k=_l(w);if(A.kind!==k.kind||A.kind!=="string"&&A.kind!=="number")throw new Ll(`Expected arguments for "${l}" to be (string, string) or (number, number), but found (${A.kind}, ${k.kind}) instead.`)}if(this.collator&&!d&&this.hasUntypedArgument){let A=_l(y),k=_l(w);if(A.kind!=="string"||k.kind!=="string")return c(h,y,w)}return this.collator?p(h,y,w,this.collator.evaluate(h)):c(h,y,w)}eachChild(h){h(this.lhs),h(this.rhs),this.collator&&h(this.collator)}outputDefined(){return!0}}}let u7=U5("==",function(l,c,p){return c===p},h0),Wp=U5("!=",function(l,c,p){return c!==p},function(l,c,p,d){return!h0(0,c,p,d)}),Lp=U5("<",function(l,c,p){return c<p},function(l,c,p,d){return d.compare(c,p)",function(l,c,p){return c>p},function(l,c,p,d){return d.compare(c,p)>0}),mr=U5("<=",function(l,c,p){return c<=p},function(l,c,p,d){return d.compare(c,p)=",function(l,c,p){return c>=p},function(l,c,p,d){return d.compare(c,p)>=0});class G4{constructor(l,c,p){this.type=q4,this.locale=p,this.caseSensitive=l,this.diacriticSensitive=c}static parse(l,c){if(l.length!==2)return c.error("Expected one argument.");let p=l[1];if(typeof p!="object"||Array.isArray(p))return c.error("Collator options argument must be an object.");let d=c.parse(p["case-sensitive"]!==void 0&&p["case-sensitive"],1,vl);if(!d)return null;let a=c.parse(p["diacritic-sensitive"]!==void 0&&p["diacritic-sensitive"],1,vl);if(!a)return null;let h=null;return p.locale&&(h=c.parse(p.locale,1,cl),!h)?null:new G4(d,a,h)}evaluate(l){return new R4(this.caseSensitive.evaluate(l),this.diacriticSensitive.evaluate(l),this.locale?this.locale.evaluate(l):null)}eachChild(l){l(this.caseSensitive),l(this.diacriticSensitive),this.locale&&l(this.locale)}outputDefined(){return!1}}class gr{constructor(l,c,p,d,a,h){this.type=cl,this.number=l,this.locale=c,this.currency=p,this.unit=d,this.minFractionDigits=a,this.maxFractionDigits=h}static parse(l,c){if(l.length!==3)return c.error("Expected two arguments.");let p=c.parse(l[1],1,H1);if(!p)return null;let d=l[2];if(typeof d!="object"||Array.isArray(d))return c.error("NumberFormat options argument must be an object.");let a=null;if(d.locale&&(a=c.parse(d.locale,1,cl),!a))return null;let h=null;if(d.currency&&(h=c.parse(d.currency,1,cl),!h))return null;let y=null;if(d.unit&&(y=c.parse(d.unit,1,cl),!y))return null;if(h&&y)return c.error("NumberFormat options `currency` and `unit` are mutually exclusive");let w=null;if(d["min-fraction-digits"]&&(w=c.parse(d["min-fraction-digits"],1,H1),!w))return null;let A=null;return d["max-fraction-digits"]&&(A=c.parse(d["max-fraction-digits"],1,H1),!A)?null:new gr(p,a,h,y,w,A)}evaluate(l){return new Intl.NumberFormat(this.locale?this.locale.evaluate(l):[],{style:this.currency?"currency":this.unit?"unit":"decimal",currency:this.currency?this.currency.evaluate(l):void 0,unit:this.unit?this.unit.evaluate(l):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(l):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(l):void 0}).format(this.number.evaluate(l))}eachChild(l){l(this.number),this.locale&&l(this.locale),this.currency&&l(this.currency),this.unit&&l(this.unit),this.minFractionDigits&&l(this.minFractionDigits),this.maxFractionDigits&&l(this.maxFractionDigits)}outputDefined(){return!1}}class D5{constructor(l){this.type=P4,this.sections=l}static parse(l,c){if(l.length<2)return c.error("Expected at least one argument.");let p=l[1];if(!Array.isArray(p)&&typeof p=="object")return c.error("First argument must be an image or text section.");let d=[],a=!1;for(let h=1;h{let p=c.content.evaluate(l);return _l(p)===n3?new H4("",p,null,null,null,c.verticalAlign?c.verticalAlign.evaluate(l):null):new H4(eu(p),null,c.scale?c.scale.evaluate(l):null,c.font?c.font.evaluate(l).join(","):null,c.textColor?c.textColor.evaluate(l):null,c.verticalAlign?c.verticalAlign.evaluate(l):null)}))}eachChild(l){for(let c of this.sections)l(c.content),c.scale&&l(c.scale),c.font&&l(c.font),c.textColor&&l(c.textColor),c.verticalAlign&&l(c.verticalAlign)}outputDefined(){return!1}}class P3{constructor(l){this.type=n3,this.input=l}static parse(l,c){if(l.length!==2)return c.error("Expected two arguments.");let p=c.parse(l[1],1,cl);return p?new P3(p):c.error("No image name provided.")}evaluate(l){let c=this.input.evaluate(l),p=w2.fromString(c);return p&&l.availableImages&&(p.available=l.availableImages.indexOf(c)>-1),p}eachChild(l){l(this.input)}outputDefined(){return!1}}class S2{constructor(l){this.type=H1,this.input=l}static parse(l,c){if(l.length!==2)return c.error(`Expected 1 argument, but found ${l.length-1} instead.`);let p=c.parse(l[1],1);return p?p.type.kind!=="array"&&p.type.kind!=="string"&&p.type.kind!=="value"?c.error(`Expected argument of type string or array, but found ${Wl(p.type)} instead.`):new S2(p):null}evaluate(l){let c=this.input.evaluate(l);if(typeof c=="string")return[...c].length;if(Array.isArray(c))return c.length;throw new Ll(`Expected value to be of type string or array, but found ${Wl(_l(c))} instead.`)}eachChild(l){l(this.input)}outputDefined(){return!1}}let F2=8192;function vr(l,c){let p=(180+l[0])/360,d=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+l[1]*Math.PI/360)))/360,a=Math.pow(2,c.z);return[Math.round(p*a*F2),Math.round(d*a*F2)]}function r7(l,c){let p=Math.pow(2,c.z);return[(a=(l[0]/F2+c.x)/p,360*a-180),(d=(l[1]/F2+c.y)/p,360/Math.PI*Math.atan(Math.exp((180-360*d)*Math.PI/180))-90)];var d,a}function l5(l,c){l[0]=Math.min(l[0],c[0]),l[1]=Math.min(l[1],c[1]),l[2]=Math.max(l[2],c[0]),l[3]=Math.max(l[3],c[1])}function Q4(l,c){return!(l[0]=c[2]||l[1]=c[3])}function Cp(l,c,p){let d=l[0]-c[0],a=l[1]-c[1],h=l[0]-p[0],y=l[1]-p[1];return d*y-h*a==0&&d*h<=0&&a*y<=0}function ar(l,c,p,d){return(a=[d[0]-p[0],d[1]-p[1]])[0]*(h=[c[0]-l[0],c[1]-l[1]])[1]-a[1]*h[0]!=0&&!(!Fp(l,c,p,d)||!Fp(p,d,l,c));var a,h}function md(l,c,p){for(let d of p)for(let a=0;a<d.length-1;++a)if(ar(l,c,d[a],d[a+1]))return!0;return!1}function Fu(l,c,p=!1){let d=!1;for(let w of c)for(let A=0;A(a=l)[1]!=(y=w[A+1])[1]>a[1]&&a[0]<(y[0]-h[0])*(a[1]-h[1])/(y[1]-h[1])+h[0]&&(d=!d)}var a,h,y;return d}function xp(l,c){for(let p of c)if(Fu(l,p))return!0;return!1}function p7(l,c){for(let p of l)if(!Fu(p,c))return!1;for(let p=0;p0&&w<0||y0}function or(l,c,p){let d=[];for(let a=0;a<l.length;a++){let h=[];for(let y=0;y<l[a].length;y++){let w=vr(l[a][y],p);l5(c,w),h.push(w)}d.push(h)}return d}function qp(l,c,p){let d=[];for(let a=0;a<l.length;a++){let h=or(l[a],c,p);d.push(h)}return d}function Pp(l,c,p,d){if(l[0] p[2]){let a=0.5*d,h=l[0]-p[0]>a?-d:p[0]-l[0]>a?d:0;h===0&&(h=l[0]-p[2]>a?-d:p[2]-l[0]>a?d:0),l[0]+=h}l5(c,l)}function Mp(l,c,p,d){let a=Math.pow(2,d.z)*F2,h=[d.x*F2,d.y*F2],y=[];for(let w of l)for(let A of w){let k=[A.x+h[0],A.y+h[1]];Pp(k,c,p,a),y.push(k)}return y}function Bp(l,c,p,d){let a=Math.pow(2,d.z)*F2,h=[d.x*F2,d.y*F2],y=[];for(let A of l){let k=[];for(let W of A){let n=[W.x+h[0],W.y+h[1]];l5(c,n),k.push(n)}y.push(k)}if(c[2]-c[0]pd?1:0){if(this.data=l,this.length=this.data.length,this.compare=c,this.length>0)for(let p=(this.length>>1)-1;p>=0;p--)this._down(p)}push(l){this.data.push(l),this._up(this.length++)}pop(){if(this.length===0)return;let l=this.data[0],c=this.data.pop();return--this.length>0&&(this.data[0]=c,this._down(0)),l}peek(){return this.data[0]}_up(l){let{data:c,compare:p}=this,d=c[l];for(;l>0;){let a=l-1>>1,h=c[a];if(p(d,h)>=0)break;c[l]=h,l=a}c[l]=d}_down(l){let{data:c,compare:p}=this,d=this.length>>1,a=c[l];for(;l<d;){let h=1+(l<<1),y=h+1;if(y<this.length&&p(c[y],c[h])=0)break;c[l]=c[h],l=h}c[l]=a}};function d7(l,c,p=0,d=l.length-1,a=gd){for(;d>p;){if(d-p>600){let A=d-p+1,k=c-p+1,W=Math.log(A),n=0.5*Math.exp(2*W/3),q=0.5*Math.sqrt(W*n*(A-n)/A)*(k-A/20&&M3(l,p,d);y<w;){for(M3(l,y,w),y++,w--;a(l[y],h)0;)w--}a(l[p],h)===0?M3(l,p,w):(w++,M3(l,w,d)),w<=c&&(p=w+1),c<=w&&(d=w-1)}}function M3(l,c,p){let d=l[c];l[c]=l[p],l[p]=d}function gd(l,c){return lc?1:0}function hr(l,c){if(l.length<=1)return[l];let p=[],d,a;for(let h of l){let y=ad(h);y!==0&&(h.area=Math.abs(y),a===void 0&&(a=y<0),a===y1)for(let h=0;h<p.length;h++)p[h].length<=c||(d7(p[h],c,1,p[h].length-1,vd),p[h]=p[h].slice(0,c));return p}function vd(l,c){return c.area-l.area}function ad(l){let c=0;for(let p,d,a=0,h=l.length,y=h-1;a<h;y=a++)p=l[a],d=l[y],c+=(d.x-p.x)*(p.y+d.y);return c}let j4=0.0033528106647474805,Kp=j4*(2-j4),Up=Math.PI/180;class yr{constructor(l){let c=6378.137*Up*1000,p=Math.cos(l*Up),d=1/(1-Kp*(1-p*p)),a=Math.sqrt(d);this.kx=c*a*p,this.ky=c*a*d*(1-Kp)}distance(l,c){let p=this.wrap(l[0]-c[0])*this.kx,d=(l[1]-c[1])*this.ky;return Math.sqrt(p*p+d*d)}pointOnLine(l,c){let p,d,a,h,y=1/0;for(let w=0;w1?(A=l[w+1][0],k=l[w+1][1]):q>0&&(A+=W/this.kx*q,k+=n/this.ky*q)),W=this.wrap(c[0]-A)*this.kx,n=(c[1]-k)*this.ky;let C=W*W+n*n;C<y&&(y=C,p=A,d=k,a=w,h=q)}return{point:[p,d],index:a,t:Math.max(0,Math.min(1,h))}}wrap(l){for(;l180;)l-=360;return l}}function Dp(l,c){return c[0]-l[0]}function B3(l){return l[1]-l[0]+1}function lu(l,c){return l[1]>=l[0]&&l[1]l[1])return[null,null];let p=B3(l);if(c){if(p===2)return[l,null];let a=Math.floor(p/2);return[[l[0],l[0]+a],[l[0]+a,l[1]]]}if(p===1)return[l,null];let d=Math.floor(p/2)-1;return[[l[0],l[0]+d],[l[0]+d+1,l[1]]]}function g7(l,c){if(!lu(c,l.length))return[1/0,1/0,-1/0,-1/0];let p=[1/0,1/0,-1/0,-1/0];for(let d=c[0];d<=c[1];++d)l5(p,l[d]);return p}function wr(l){let c=[1/0,1/0,-1/0,-1/0];for(let p of l)for(let d of p)l5(c,d);return c}function v7(l){return l[0]!==-1/0&&l[1]!==-1/0&&l[2]!==1/0&&l[3]!==1/0}function a7(l,c,p){if(!v7(l)||!v7(c))return NaN;let d=0,a=0;return l[2]c[2]&&(d=l[0]-c[2]),l[1]>c[3]&&(a=l[1]-c[3]),l[3]<c[1]&&(a=c[1]-l[3]),p.distance([0,0],[d,a])}function H5(l,c,p){let d=p.pointOnLine(c,l);return p.distance(l,d.point)}function o7(l,c,p,d,a){let h=Math.min(H5(l,[p,d],a),H5(c,[p,d],a)),y=Math.min(H5(p,[l,c],a),H5(d,[l,c],a));return Math.min(h,y)}function Rp(l,c,p,d,a){if(!lu(c,l.length)||!lu(d,p.length))return 1/0;let h=1/0;for(let y=c[0];y<c[1];++y){let w=l[y],A=l[y+1];for(let k=d[0];k<d[1];++k){let W=p[k],n=p[k+1];if(ar(w,A,W,n))return 0;h=Math.min(h,o7(w,A,W,n,a))}}return h}function od(l,c,p,d,a){if(!lu(c,l.length)||!lu(d,p.length))return NaN;let h=1/0;for(let y=c[0];y<=c[1];++y)for(let w=d[0];w<=d[1];++w)if(h=Math.min(h,a.distance(l[y],p[w])),h===0)return h;return h}function Hp(l,c,p){if(Fu(l,c,!0))return 0;let d=1/0;for(let a of c){let h=a[0],y=a[a.length-1];if(h!==y&&(d=Math.min(d,H5(l,[y,h],p)),d===0))return d;let w=p.pointOnLine(a,l);if(d=Math.min(d,p.distance(l,w.point)),d===0)return d}return d}function hd(l,c,p,d){if(!lu(c,l.length))return NaN;for(let h=c[0];h<=c[1];++h)if(Fu(l[h],p,!0))return 0;let a=1/0;for(let h=c[0];h<c[1];++h){let y=l[h],w=l[h+1];for(let A of p)for(let k=0,W=A.length,n=W-1;k=d)return d;if(Q4(a,h)){if(h7(l,c))return 0}else if(h7(c,l))return 0;let y=1/0;for(let w of l)for(let A=0,k=w.length,W=k-1;A<k;W=A++){let n=w[W],q=w[A];for(let C of c)for(let B=0,M=C.length,D=M-1;B<M;D=B++){let I=C[D],O=C[B];if(ar(n,q,I,O))return 0;y=Math.min(y,o7(n,q,I,O,p))}}return y}function y7(l,c,p,d,a,h){if(!h)return;let y=a7(g7(d,h),a,p);y<c&&l.push([y,h,[0,0]])}function J4(l,c,p,d,a,h,y){if(!h||!y)return;let w=a7(g7(d,h),g7(a,y),p);w0;){let A=y.pop();if(A[0]>=h)continue;let k=A[1],W=c?50:100;if(B3(k)<=W){if(!lu(k,l.length))return NaN;if(c){let n=hd(l,k,p,d);if(isNaN(n)||n===0)return n;h=Math.min(h,n)}else for(let n=k[0];n0;){let A=w.pop();if(A[0]>=y)continue;let k=A[1],W=A[2],n=c?50:100,q=d?50:100;if(B3(k)<=n&&B3(W)<=q){if(!lu(k,l.length)&&lu(W,p.length))return NaN;let C;if(c&&d)C=Rp(l,k,p,W,a),y=Math.min(y,C);else if(c&&!d){let B=l.slice(k[0],k[1]+1);for(let M=W[0];M<=W[1];++M)if(C=H5(p[M],B,a),y=Math.min(y,C),y===0)return y}else if(!c&&d){let B=p.slice(W[0],W[1]+1);for(let M=k[0];M({type:"Polygon",coordinates:c})):l.type==="MultiLineString"?l.coordinates.map((c)=>({type:"LineString",coordinates:c})):l.type==="MultiPoint"?l.coordinates.map((c)=>({type:"Point",coordinates:c})):[l]}class u5{constructor(l,c){this.type=H1,this.geojson=l,this.geometries=c}static parse(l,c){if(l.length!==2)return c.error(`'distance' expression requires exactly one argument, but found ${l.length-1} instead.`);if(iu(l[1])){let p=l[1];if(p.type==="FeatureCollection")return new u5(p,p.features.map((d)=>sr(d.geometry)).flat());if(p.type==="Feature")return new u5(p,sr(p.geometry));if("type"in p&&"coordinates"in p)return new u5(p,sr(p))}return c.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(l){if(l.geometry()!=null&&l.canonicalID()!=null){if(l.geometryType()==="Point")return function(c,p){let d=c.geometry(),a=d.flat().map((w)=>r7([w.x,w.y],c.canonical));if(d.length===0)return NaN;let h=new yr(a[0][1]),y=1/0;for(let w of p){switch(w.type){case"Point":y=Math.min(y,T4(a,!1,[w.coordinates],!1,h,y));break;case"LineString":y=Math.min(y,T4(a,!1,w.coordinates,!0,h,y));break;case"Polygon":y=Math.min(y,X4(a,!1,w.coordinates,h,y))}if(y===0)return y}return y}(l,this.geometries);if(l.geometryType()==="LineString")return function(c,p){let d=c.geometry(),a=d.flat().map((w)=>r7([w.x,w.y],c.canonical));if(d.length===0)return NaN;let h=new yr(a[0][1]),y=1/0;for(let w of p){switch(w.type){case"Point":y=Math.min(y,T4(a,!0,[w.coordinates],!1,h,y));break;case"LineString":y=Math.min(y,T4(a,!0,w.coordinates,!0,h,y));break;case"Polygon":y=Math.min(y,X4(a,!0,w.coordinates,h,y))}if(y===0)return y}return y}(l,this.geometries);if(l.geometryType()==="Polygon")return function(c,p){let d=c.geometry();if(d.length===0||d[0].length===0)return NaN;let a=hr(d,0).map((w)=>w.map((A)=>A.map((k)=>r7([k.x,k.y],c.canonical)))),h=new yr(a[0][0][0][1]),y=1/0;for(let w of p)for(let A of a){switch(w.type){case"Point":y=Math.min(y,X4([w.coordinates],!1,A,h,y));break;case"LineString":y=Math.min(y,X4(w.coordinates,!0,A,h,y));break;case"Polygon":y=Math.min(y,kl(A,w.coordinates,h,y))}if(y===0)return y}return y}(l,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}class K3{constructor(l){this.type=pl,this.key=l}static parse(l,c){if(l.length!==2)return c.error(`Expected 1 argument, but found ${l.length-1} instead.`);let p=l[1];return p==null?c.error("Global state property must be defined."):typeof p!="string"?c.error(`Global state property must be string, but found ${typeof l[1]} instead.`):new K3(p)}evaluate(l){var c;let p=(c=l.globals)===null||c===void 0?void 0:c.globalState;return p&&Object.keys(p).length!==0?U4(p,this.key):null}eachChild(){}outputDefined(){return!1}}let I5={"==":u7,"!=":Wp,">":q3,"=":c7,"!Array.isArray(A)||A.length===l.length-1),w=null;for(let[A,k]of y){w=new tu(c.registry,Z4,c.path,null,c.scope);let W=[],n=!1;for(let q=1;q<l.length;q++){let C=l[q],B=Array.isArray(A)?A[q-1]:A.type,M=w.parse(C,1+W.length,B);if(!M){n=!0;break}W.push(M)}if(!n)if(Array.isArray(A)&&A.length!==W.length)w.error(`Expected ${A.length} arguments, but found ${W.length} instead.`);else{for(let q=0;q{return n=W,Array.isArray(n)?`(${n.map(Wl).join(", ")})`:`(${Wl(n.type)}...)`;var n}).join(" | "),k=[];for(let W=1;W{p=c?p&&Z4(d):p&&d instanceof t2}),!!p&&b4(l)&&$4(l,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"])}function b4(l){if(l instanceof k2){if(l.name==="get"&&l.args.length===1)return!1;if(l.name==="feature-state")return!1;if(l.name==="has"&&l.args.length===1)return!1;if(l.name==="properties"||l.name==="geometry-type"||l.name==="id")return!1;if(/^filter-/.test(l.name))return!1}if(l instanceof R5)return!1;if(l instanceof u5)return!1;let c=!0;return l.eachChild((p)=>{c&&!b4(p)&&(c=!1)}),c}function U3(l){if(l instanceof k2&&l.name==="feature-state")return!1;let c=!0;return l.eachChild((p)=>{c&&!U3(p)&&(c=!1)}),c}function $4(l,c){if(l instanceof k2&&c.indexOf(l.name)>=0)return!1;let p=!0;return l.eachChild((d)=>{p&&!$4(d,c)&&(p=!1)}),p}function S7(l){return{result:"success",value:l}}function Y5(l){return{result:"error",value:l}}function z5(l){return l["property-type"]==="data-driven"||l["property-type"]==="cross-faded-data-driven"}function k7(l){return!!l.expression&&l.expression.parameters.indexOf("zoom")>-1}function kr(l){return!!l.expression&&l.expression.interpolated}function ml(l){return l instanceof Number?"number":l instanceof String?"string":l instanceof Boolean?"boolean":Array.isArray(l)?"array":l===null?"null":typeof l}function _4(l){return typeof l=="object"&&l!==null&&!Array.isArray(l)&&_l(l)===Cu}function Ip(l){return l}function E7(l,c){let p=l.stops&&typeof l.stops[0][0]=="object",d=p||!(p||l.property!==void 0),a=l.type||(kr(c)?"exponential":"interval"),h=function(W){switch(W.type){case"color":return dl.parse;case"padding":return P0.parse;case"numberArray":return Yl.parse;case"colorArray":return e1.parse;default:return null}}(c);if(h&&((l=bu({},l)).stops&&(l.stops=l.stops.map((W)=>[W[0],h(W[1])])),l.default=h(l.default?l.default:c.default)),l.colorSpace&&(y=l.colorSpace)!=="rgb"&&y!=="hcl"&&y!=="lab")throw Error(`Unknown color space: "${l.colorSpace}"`);var y;let w=function(W){switch(W){case"exponential":return n7;case"interval":return zp;case"categorical":return Yp;case"identity":return Op;default:throw Error(`Unknown function type "${W}"`)}}(a),A,k;if(a==="categorical"){A=Object.create(null);for(let W of l.stops)A[W[0]]=W[1];k=typeof l.stops[0][0]}if(p){let W={},n=[];for(let B=0;BB[0]),evaluate:({zoom:B},M)=>n7({stops:q,base:l.base},c,B).evaluate(B,M)}}if(d){let W=a==="exponential"?{name:"exponential",base:l.base!==void 0?l.base:1}:null;return{kind:"camera",interpolationType:W,interpolationFactor:c0.interpolationFactor.bind(void 0,W),zoomStops:l.stops.map((n)=>n[0]),evaluate:({zoom:n})=>w(l,c,n,A,k)}}return{kind:"source",evaluate(W,n){let q=n&&n.properties?n.properties[l.property]:void 0;return q===void 0?D3(l.default,c.default):w(l,c,q,A,k)}}}function D3(l,c,p){return l!==void 0?l:c!==void 0?c:p!==void 0?p:void 0}function Yp(l,c,p,d,a){return D3(typeof p===a?d[p]:void 0,l.default,c.default)}function zp(l,c,p){if(ml(p)!=="number")return D3(l.default,c.default);let d=l.stops.length;if(d===1)return l.stops[0][1];if(p=l.stops[d-1][0])return l.stops[d-1][1];let a=K5(l.stops.map((h)=>h[0]),p);return l.stops[a][1]}function n7(l,c,p){let d=l.base!==void 0?l.base:1;if(ml(p)!=="number")return D3(l.default,c.default);let a=l.stops.length;if(a===1)return l.stops[0][1];if(p=l.stops[a-1][0])return l.stops[a-1][1];let h=K5(l.stops.map((W)=>W[0]),p),y=function(W,n,q,C){let B=C-q,M=W-q;return B===0?0:n===1?M/B:(Math.pow(n,M)-1)/(Math.pow(n,B)-1)}(p,d,l.stops[h][0],l.stops[h+1][0]),w=l.stops[h][1],A=l.stops[h+1][1],k=s2[c.type]||Ip;return typeof w.evaluate=="function"?{evaluate(...W){let n=w.evaluate.apply(void 0,W),q=A.evaluate.apply(void 0,W);if(n!==void 0&&q!==void 0)return k(n,q,y,l.colorSpace)}}:k(w,A,y,l.colorSpace)}function Op(l,c,p){switch(c.type){case"color":p=dl.parse(p);break;case"formatted":p=Q0.fromString(p.toString());break;case"resolvedImage":p=w2.fromString(p.toString());break;case"padding":p=P0.parse(p);break;case"colorArray":p=e1.parse(p);break;case"numberArray":p=Yl.parse(p);break;default:ml(p)===c.type||c.type==="enum"&&c.values[p]||(p=void 0)}return D3(p,l.default,c.default)}k2.register(I5,{error:[{kind:"error"},[cl],(l,[c])=>{throw new Ll(c.evaluate(l))}],typeof:[cl,[pl],(l,[c])=>Wl(_l(c.evaluate(l)))],"to-rgba":[L0(H1,4),[y2],(l,[c])=>{let[p,d,a,h]=c.evaluate(l).rgb;return[255*p,255*d,255*a,h]}],rgb:[y2,[H1,H1,H1],w7],rgba:[y2,[H1,H1,H1,H1],w7],has:{type:vl,overloads:[[[cl],(l,[c])=>s7(c.evaluate(l),l.properties())],[[cl,Cu],(l,[c,p])=>s7(c.evaluate(l),p.evaluate(l))]]},get:{type:pl,overloads:[[[cl],(l,[c])=>Sr(c.evaluate(l),l.properties())],[[cl,Cu],(l,[c,p])=>Sr(c.evaluate(l),p.evaluate(l))]]},"feature-state":[pl,[cl],(l,[c])=>Sr(c.evaluate(l),l.featureState||{})],properties:[Cu,[],(l)=>l.properties()],"geometry-type":[cl,[],(l)=>l.geometryType()],id:[pl,[],(l)=>l.id()],zoom:[H1,[],(l)=>l.globals.zoom],"heatmap-density":[H1,[],(l)=>l.globals.heatmapDensity||0],elevation:[H1,[],(l)=>l.globals.elevation||0],"line-progress":[H1,[],(l)=>l.globals.lineProgress||0],accumulated:[pl,[],(l)=>l.globals.accumulated===void 0?null:l.globals.accumulated],"+":[H1,c5(H1),(l,c)=>{let p=0;for(let d of c)p+=d.evaluate(l);return p}],"*":[H1,c5(H1),(l,c)=>{let p=1;for(let d of c)p*=d.evaluate(l);return p}],"-":{type:H1,overloads:[[[H1,H1],(l,[c,p])=>c.evaluate(l)-p.evaluate(l)],[[H1],(l,[c])=>-c.evaluate(l)]]},"/":[H1,[H1,H1],(l,[c,p])=>c.evaluate(l)/p.evaluate(l)],"%":[H1,[H1,H1],(l,[c,p])=>c.evaluate(l)%p.evaluate(l)],ln2:[H1,[],()=>Math.LN2],pi:[H1,[],()=>Math.PI],e:[H1,[],()=>Math.E],"^":[H1,[H1,H1],(l,[c,p])=>Math.pow(c.evaluate(l),p.evaluate(l))],sqrt:[H1,[H1],(l,[c])=>Math.sqrt(c.evaluate(l))],log10:[H1,[H1],(l,[c])=>Math.log(c.evaluate(l))/Math.LN10],ln:[H1,[H1],(l,[c])=>Math.log(c.evaluate(l))],log2:[H1,[H1],(l,[c])=>Math.log(c.evaluate(l))/Math.LN2],sin:[H1,[H1],(l,[c])=>Math.sin(c.evaluate(l))],cos:[H1,[H1],(l,[c])=>Math.cos(c.evaluate(l))],tan:[H1,[H1],(l,[c])=>Math.tan(c.evaluate(l))],asin:[H1,[H1],(l,[c])=>Math.asin(c.evaluate(l))],acos:[H1,[H1],(l,[c])=>Math.acos(c.evaluate(l))],atan:[H1,[H1],(l,[c])=>Math.atan(c.evaluate(l))],min:[H1,c5(H1),(l,c)=>Math.min(...c.map((p)=>p.evaluate(l)))],max:[H1,c5(H1),(l,c)=>Math.max(...c.map((p)=>p.evaluate(l)))],abs:[H1,[H1],(l,[c])=>Math.abs(c.evaluate(l))],round:[H1,[H1],(l,[c])=>{let p=c.evaluate(l);return pMath.floor(c.evaluate(l))],ceil:[H1,[H1],(l,[c])=>Math.ceil(c.evaluate(l))],"filter-==":[vl,[cl,pl],(l,[c,p])=>l.properties()[c.value]===p.value],"filter-id-==":[vl,[pl],(l,[c])=>l.id()===c.value],"filter-type-==":[vl,[cl],(l,[c])=>l.geometryType()===c.value],"filter-{let d=l.properties()[c.value],a=p.value;return typeof d==typeof a&&d<a}],"filter-id-{let p=l.id(),d=c.value;return typeof p==typeof d&&p":[vl,[cl,pl],(l,[c,p])=>{let d=l.properties()[c.value],a=p.value;return typeof d==typeof a&&d>a}],"filter-id->":[vl,[pl],(l,[c])=>{let p=l.id(),d=c.value;return typeof p==typeof d&&p>d}],"filter-{let d=l.properties()[c.value],a=p.value;return typeof d==typeof a&&d<=a}],"filter-id-{let p=l.id(),d=c.value;return typeof p==typeof d&&p=":[vl,[cl,pl],(l,[c,p])=>{let d=l.properties()[c.value],a=p.value;return typeof d==typeof a&&d>=a}],"filter-id->=":[vl,[pl],(l,[c])=>{let p=l.id(),d=c.value;return typeof p==typeof d&&p>=d}],"filter-has":[vl,[pl],(l,[c])=>(c.value in l.properties())],"filter-has-id":[vl,[],(l)=>l.id()!==null&&l.id()!==void 0],"filter-type-in":[vl,[L0(cl)],(l,[c])=>c.value.indexOf(l.geometryType())>=0],"filter-id-in":[vl,[L0(pl)],(l,[c])=>c.value.indexOf(l.id())>=0],"filter-in-small":[vl,[cl,L0(pl)],(l,[c,p])=>p.value.indexOf(l.properties()[c.value])>=0],"filter-in-large":[vl,[cl,L0(pl)],(l,[c,p])=>function(d,a,h,y){for(;h>1;if(a[w]===d)return!0;a[w]>d?y=w-1:h=w+1}return!1}(l.properties()[c.value],p.value,0,p.value.length-1)],all:{type:vl,overloads:[[[vl,vl],(l,[c,p])=>c.evaluate(l)&&p.evaluate(l)],[c5(vl),(l,c)=>{for(let p of c)if(!p.evaluate(l))return!1;return!0}]]},any:{type:vl,overloads:[[[vl,vl],(l,[c,p])=>c.evaluate(l)||p.evaluate(l)],[c5(vl),(l,c)=>{for(let p of c)if(p.evaluate(l))return!0;return!1}]]},"!":[vl,[vl],(l,[c])=>!c.evaluate(l)],"is-supported-script":[vl,[cl],(l,[c])=>{let p=l.globals&&l.globals.isSupportedScript;return!p||p(c.evaluate(l))}],upcase:[cl,[cl],(l,[c])=>c.evaluate(l).toUpperCase()],downcase:[cl,[cl],(l,[c])=>c.evaluate(l).toLowerCase()],concat:[cl,c5(pl),(l,c)=>c.map((p)=>eu(p.evaluate(l))).join("")],split:[L0(cl),[cl,cl],(l,[c,p])=>c.evaluate(l).split(p.evaluate(l))],join:[cl,[L0(cl),cl],(l,[c,p])=>c.evaluate(l).join(p.evaluate(l))],"resolved-locale":[cl,[q4],(l,[c])=>c.evaluate(l).resolvedLocale()]});class O5{constructor(l,c,p){this.expression=l,this._warningHistory={},this._evaluator=new dr,this._defaultValue=c?function(d){if(d.type==="color"&&_4(d.default))return new dl(0,0,0,0);switch(d.type){case"color":return dl.parse(d.default)||null;case"padding":return P0.parse(d.default)||null;case"numberArray":return Yl.parse(d.default)||null;case"colorArray":return e1.parse(d.default)||null;case"variableAnchorOffsetCollection":return j0.parse(d.default)||null;case"projectionDefinition":return M0.parse(d.default)||null;default:return d.default===void 0?null:d.default}}(c):null,this._enumValues=c&&c.type==="enum"?c.values:null,this._globalState=p}evaluateWithoutErrorHandling(l,c,p,d,a,h){return this._globalState&&(l=Y3(l,this._globalState)),this._evaluator.globals=l,this._evaluator.feature=c,this._evaluator.featureState=p,this._evaluator.canonical=d,this._evaluator.availableImages=a||null,this._evaluator.formattedSection=h,this.expression.evaluate(this._evaluator)}evaluate(l,c,p,d,a,h){this._globalState&&(l=Y3(l,this._globalState)),this._evaluator.globals=l,this._evaluator.feature=c||null,this._evaluator.featureState=p||null,this._evaluator.canonical=d,this._evaluator.availableImages=a||null,this._evaluator.formattedSection=h||null;try{let y=this.expression.evaluate(this._evaluator);if(y==null||typeof y=="number"&&y!=y)return this._defaultValue;if(this._enumValues&&!(y in this._enumValues))throw new Ll(`Expected value to be one of ${Object.keys(this._enumValues).map((w)=>JSON.stringify(w)).join(", ")}, but found ${JSON.stringify(y)} instead.`);return y}catch(y){return this._warningHistory[y.message]||(this._warningHistory[y.message]=!0,typeof console0&&typeof l[0]=="string"&&l[0]in I5}function R3(l,c,p){let d=new tu(I5,Z4,[],c?function(h){let y={color:y2,string:cl,number:H1,enum:cl,boolean:vl,formatted:P4,padding:lr,numberArray:M4,colorArray:E3,projectionDefinition:tc,resolvedImage:n3,variableAnchorOffsetCollection:B4};return h.type==="array"?L0(y[h.value]||pl,h.length):y[h.type]}(c):void 0),a=d.parse(l,void 0,void 0,void 0,c&&c.type==="string"?{typeAnnotation:"coerce"}:void 0);return a?S7(new O5(a,c,p)):Y5(d.errors)}class H3{constructor(l,c,p){this.kind=l,this._styleExpression=c,this.isStateDependent=l!=="constant"&&!U3(c.expression),this.globalStateRefs=I3(c.expression),this._globalState=p}evaluateWithoutErrorHandling(l,c,p,d,a,h){return this._globalState&&(l=Y3(l,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(l,c,p,d,a,h)}evaluate(l,c,p,d,a,h){return this._globalState&&(l=Y3(l,this._globalState)),this._styleExpression.evaluate(l,c,p,d,a,h)}}class e4{constructor(l,c,p,d,a){this.kind=l,this.zoomStops=p,this._styleExpression=c,this.isStateDependent=l!=="camera"&&!U3(c.expression),this.globalStateRefs=I3(c.expression),this.interpolationType=d,this._globalState=a}evaluateWithoutErrorHandling(l,c,p,d,a,h){return this._globalState&&(l=Y3(l,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(l,c,p,d,a,h)}evaluate(l,c,p,d,a,h){return this._globalState&&(l=Y3(l,this._globalState)),this._styleExpression.evaluate(l,c,p,d,a,h)}interpolationFactor(l,c,p){return this.interpolationType?c0.interpolationFactor(this.interpolationType,l,c,p):0}}function A7(l,c,p){let d=R3(l,c,p);if(d.result==="error")return d;let a=d.value.expression,h=b4(a);if(!h&&!z5(c))return Y5([new s0("","data expressions not supported")]);let y=$4(a,["zoom"]);if(!y&&!k7(c))return Y5([new s0("","zoom expressions not supported")]);let w=G5(a);return w||y?w instanceof s0?Y5([w]):w instanceof c0&&!kr(c)?Y5([new s0("",'"interpolate" expressions cannot be used with this property')]):S7(w?new e4(h?"camera":"composite",d.value,w.labels,w instanceof c0?w.interpolation:void 0,p):new H3(h?"constant":"source",d.value,p)):Y5([new s0("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class t4{constructor(l,c){this._parameters=l,this._specification=c,bu(this,E7(this._parameters,this._specification))}static deserialize(l){return new t4(l._parameters,l._specification)}static serialize(l){return{_parameters:l._parameters,_specification:l._specification}}}function G5(l){let c=null;if(l instanceof xl)c=G5(l.result);else if(l instanceof z4){for(let p of l.args)if(c=G5(p),c)break}else(l instanceof F3||l instanceof c0)&&l.input instanceof k2&&l.input.name==="zoom"&&(c=l);return c instanceof s0||l.eachChild((p)=>{let d=G5(p);d instanceof s0?c=d:!c&&d?c=new s0("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):c&&d&&c!==d&&(c=new s0("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),c}function I3(l,c=new Set){return l instanceof K3&&c.add(l.key),l.eachChild((p)=>{I3(p,c)}),c}function Y3(l,c){let{zoom:p,heatmapDensity:d,elevation:a,lineProgress:h,isSupportedScript:y,accumulated:w}=l!=null?l:{};return{zoom:p,heatmapDensity:d,elevation:a,lineProgress:h,isSupportedScript:y,accumulated:w,globalState:c}}function V7(l){if(l===!0||l===!1)return!0;if(!Array.isArray(l)||l.length===0)return!1;switch(l[0]){case"has":return l.length>=2&&l[1]!=="$id"&&l[1]!=="$type";case"in":return l.length>=3&&(typeof l[1]!="string"||Array.isArray(l[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};V7(l)||(l=uc(l));let p=R3(l,yd,c);if(p.result==="error")throw Error(p.value.map((d)=>`${d.key}: ${d.message}`).join(", "));return{filter:(d,a,h)=>p.value.evaluate(d,a,{},h),needGeometry:W7(l),getGlobalStateRefs:()=>I3(p.value.expression)}}function wd(l,c){return lc?1:0}function W7(l){if(!Array.isArray(l))return!1;if(l[0]==="within"||l[0]==="distance")return!0;for(let c=1;c<l.length;c++)if(W7(l[c]))return!0;return!1}function uc(l){if(!l)return!0;let c=l[0];return l.length<=1?c!=="any":c==="=="?L7(l[1],l[2],"=="):c==="!="?cc(L7(l[1],l[2],"==")):c===""||c==="="?L7(l[1],l[2],c):c==="any"?(p=l.slice(1),["any"].concat(p.map(uc))):c==="all"?["all"].concat(l.slice(1).map(uc)):c==="none"?["all"].concat(l.slice(1).map(uc).map(cc)):c==="in"?Gp(l[1],l.slice(2)):c==="!in"?cc(Gp(l[1],l.slice(2))):c==="has"?C7(l[1]):c!=="!has"||cc(C7(l[1]));var p}function L7(l,c,p){switch(l){case"$type":return[`filter-type-${p}`,c];case"$id":return[`filter-id-${p}`,c];default:return[`filter-${p}`,l,c]}}function Gp(l,c){if(c.length===0)return!1;switch(l){case"$type":return["filter-type-in",["literal",c]];case"$id":return["filter-id-in",["literal",c]];default:return c.length>200&&!c.some((p)=>typeof p!=typeof c[0])?["filter-in-large",l,["literal",c.sort(wd)]]:["filter-in-small",l,["literal",c]]}}function C7(l){switch(l){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",l]}}function cc(l){return["!",l]}function Er(l){let c=typeof l;if(c==="number"||c==="boolean"||c==="string"||l==null)return JSON.stringify(l);if(Array.isArray(l)){let a="[";for(let h of l)a+=`${Er(h)},`;return`${a}]`}let p=Object.keys(l).sort(),d="{";for(let a=0;a<p.length;a++)d+=`${JSON.stringify(p[a])}:${Er(l[p[a]])},`;return`${d}}`}function sd(l){let c="";for(let p of G6)c+=`/${Er(l[p])}`;return c}function Qp(l){let c=l.value;return c?[new M1(l.key,c,"constants have been deprecated as of v8")]:[]}function il(l){return l instanceof Number||l instanceof String||l instanceof Boolean?l.valueOf():l}function Q5(l){if(Array.isArray(l))return l.map(Q5);if(l instanceof Object&&!(l instanceof Number||l instanceof String||l instanceof Boolean)){let c={};for(let p in l)c[p]=Q5(l[p]);return c}return il(l)}function u2(l){let{key:c,value:p}=l,d=l.valueSpec||{},a=l.objectElementValidators||{},h=l.style,y=l.styleSpec,w=l.validateSpec,A=[],k=ml(p);if(k!=="object")return[new M1(c,p,`object expected, ${k} found`)];for(let W in p){let n=W.split(".")[0],q=U4(d,n)||d["*"],C;if(U4(a,n))C=a[n];else if(U4(d,n)){if(p[W]===void 0)continue;C=w}else if(a["*"])C=a["*"];else{if(!d["*"]){A.push(new M1(c,p[W],`unknown property "${W}"`));continue}C=w}A=A.concat(C({key:(c?`${c}.`:c)+W,value:p[W],valueSpec:q,style:h,styleSpec:y,object:p,objectKey:W,validateSpec:w},p))}for(let W in d)a[W]||d[W].required&&d[W].default===void 0&&p[W]===void 0&&A.push(new M1(c,p,`missing required property "${W}"`));return A}function nr(l){let{value:c,valueSpec:p,style:d,styleSpec:a,key:h}=l,y=l.arrayElementValidator||l.validateSpec;if(ml(c)!=="array")return[new M1(h,c,`array expected, ${ml(c)} found`)];if(p.length&&c.length!==p.length)return[new M1(h,c,`array length ${p.length} expected, length ${c.length} found`)];let w={type:p.value,values:p.values};a.$version<7&&(w.function=p.function),ml(p.value)==="object"&&(w=p.value);let A=[];for(let k=0;k<c.length;k++)A=A.concat(y({array:c,arrayIndex:k,value:c[k],valueSpec:w,validateSpec:l.validateSpec,style:d,styleSpec:a,key:`${h}[${k}]`}));return A}function z3(l){let{key:c,value:p,valueSpec:d}=l,a=ml(p);return a==="number"&&p!=p&&(a="NaN"),a!=="number"?[new M1(c,p,`number expected, ${a} found`)]:("minimum"in d)&&pd.maximum?[new M1(c,p,`${p} is greater than the maximum value ${d.maximum}`)]:[]}function Ar(l){let c=l.valueSpec,p=il(l.value.type),d,a,h,y={},w=p!=="categorical"&&l.value.property===void 0,A=!w,k=ml(l.value.stops)==="array"&&ml(l.value.stops[0])==="array"&&ml(l.value.stops[0][0])==="object",W=u2({key:l.key,value:l.value,valueSpec:l.styleSpec.function,validateSpec:l.validateSpec,style:l.style,styleSpec:l.styleSpec,objectElementValidators:{stops:function(C){if(p==="identity")return[new M1(C.key,C.value,'identity function may not have a "stops" property')];let B=[],M=C.value;return B=B.concat(nr({key:C.key,value:M,valueSpec:C.valueSpec,validateSpec:C.validateSpec,style:C.style,styleSpec:C.styleSpec,arrayElementValidator:n})),ml(M)==="array"&&M.length===0&&B.push(new M1(C.key,M,"array must have at least one stop")),B},default:function(C){return C.validateSpec({key:C.key,value:C.value,valueSpec:c,validateSpec:C.validateSpec,style:C.style,styleSpec:C.styleSpec})}}});return p==="identity"&&w&&W.push(new M1(l.key,l.value,'missing required property "property"')),p==="identity"||l.value.stops||W.push(new M1(l.key,l.value,'missing required property "stops"')),p==="exponential"&&l.valueSpec.expression&&!kr(l.valueSpec)&&W.push(new M1(l.key,l.value,"exponential functions not supported")),l.styleSpec.$version>=8&&(A&&!z5(l.valueSpec)?W.push(new M1(l.key,l.value,"property functions not supported")):w&&!k7(l.valueSpec)&&W.push(new M1(l.key,l.value,"zoom functions not supported"))),p!=="categorical"&&!k||l.value.property!==void 0||W.push(new M1(l.key,l.value,'"property" property is required')),W;function n(C){let B=[],M=C.value,D=C.key;if(ml(M)!=="array")return[new M1(D,M,`array expected, ${ml(M)} found`)];if(M.length!==2)return[new M1(D,M,`array length 2 expected, length ${M.length} found`)];if(k){if(ml(M[0])!=="object")return[new M1(D,M,`object expected, ${ml(M[0])} found`)];if(M[0].zoom===void 0)return[new M1(D,M,"object stop key must have zoom")];if(M[0].value===void 0)return[new M1(D,M,"object stop key must have value")];if(h&&h>il(M[0].zoom))return[new M1(D,M[0].zoom,"stop zoom values must appear in ascending order")];il(M[0].zoom)!==h&&(h=il(M[0].zoom),a=void 0,y={}),B=B.concat(u2({key:`${D}[0]`,value:M[0],valueSpec:{zoom:{}},validateSpec:C.validateSpec,style:C.style,styleSpec:C.styleSpec,objectElementValidators:{zoom:z3,value:q}}))}else B=B.concat(q({key:`${D}[0]`,value:M[0],validateSpec:C.validateSpec,style:C.style,styleSpec:C.styleSpec},M));return i4(Q5(M[1]))?B.concat([new M1(`${D}[1]`,M[1],"expressions are not allowed in function stops.")]):B.concat(C.validateSpec({key:`${D}[1]`,value:M[1],valueSpec:c,validateSpec:C.validateSpec,style:C.style,styleSpec:C.styleSpec}))}function q(C,B){let M=ml(C.value),D=il(C.value),I=C.value!==null?C.value:B;if(d){if(M!==d)return[new M1(C.key,I,`${M} stop domain type must match previous stop domain type ${d}`)]}else d=M;if(M!=="number"&&M!=="string"&&M!=="boolean")return[new M1(C.key,I,"stop domain value must be a number, string, or boolean")];if(M!=="number"&&p!=="categorical"){let O=`number expected, ${M} found`;return z5(c)&&p===void 0&&(O+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new M1(C.key,I,O)]}return p!=="categorical"||M!=="number"||isFinite(D)&&Math.floor(D)===D?p!=="categorical"&&M==="number"&&a!==void 0&&Dnew M1(`${l.key}${d.key}`,l.value,d.message));let p=c.value.expression||c.value._styleExpression.expression;if(l.expressionContext==="property"&&l.propertyKey==="text-font"&&!p.outputDefined())return[new M1(l.key,l.value,`Invalid data expression for "${l.propertyKey}". Output values must be contained as literals within the expression.`)];if(l.expressionContext==="property"&&l.propertyType==="layout"&&!U3(p))return[new M1(l.key,l.value,'"feature-state" data expressions are not supported with layout properties.')];if(l.expressionContext==="filter"&&!U3(p))return[new M1(l.key,l.value,'"feature-state" data expressions are not supported with filters.')];if(l.expressionContext&&l.expressionContext.indexOf("cluster")===0){if(!$4(p,["zoom","feature-state"]))return[new M1(l.key,l.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(l.expressionContext==="cluster-initial"&&!b4(p))return[new M1(l.key,l.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function rc(l){let{key:c,value:p}=l,d=ml(p);return d!=="string"?[new M1(c,p,`color expected, ${d} found`)]:dl.parse(String(p))?[]:[new M1(c,p,`color expected, "${p}" found`)]}function j5(l){let{key:c,value:p,valueSpec:d}=l,a=[];return Array.isArray(d.values)?d.values.indexOf(il(p))===-1&&a.push(new M1(c,p,`expected one of [${d.values.join(", ")}], ${JSON.stringify(p)} found`)):Object.keys(d.values).indexOf(il(p))===-1&&a.push(new M1(c,p,`expected one of [${Object.keys(d.values).join(", ")}], ${JSON.stringify(p)} found`)),a}function O3(l){return V7(Q5(l.value))?r5(bu({},l,{expressionContext:"filter",valueSpec:{value:"boolean"}})):jp(l)}function jp(l){let{value:c,key:p}=l;if(ml(c)!=="array")return[new M1(p,c,`array expected, ${ml(c)} found`)];let d=l.styleSpec,a,h=[];if(c.length<1)return[new M1(p,c,"filter array must have at least 1 element")];switch(h=h.concat(j5({key:`${p}[0]`,value:c[0],valueSpec:d.filter_operator,style:l.style,styleSpec:l.styleSpec})),il(c[0])){case"<":case"":case">=":c.length>=2&&il(c[1])==="$type"&&h.push(new M1(p,c,`"$type" cannot be use with operator "${c[0]}"`));case"==":case"!=":c.length!==3&&h.push(new M1(p,c,`filter array for operator "${c[0]}" must have 3 elements`));case"in":case"!in":c.length>=2&&(a=ml(c[1]),a!=="string"&&h.push(new M1(`${p}[1]`,c[1],`string expected, ${a} found`)));for(let y=2;y<c.length;y++)a=ml(c[y]),il(c[1])==="$type"?h=h.concat(j5({key:`${p}[${y}]`,value:c[y],valueSpec:d.geometry_type,style:l.style,styleSpec:l.styleSpec})):a!=="string"&&a!=="number"&&a!=="boolean"&&h.push(new M1(`${p}[${y}]`,c[y],`string, number, or boolean expected, ${a} found`));break;case"any":case"all":case"none":for(let y=1;y<c.length;y++)h=h.concat(jp({key:`${p}[${y}]`,value:c[y],style:l.style,styleSpec:l.styleSpec}));break;case"has":case"!has":a=ml(c[1]),c.length!==2?h.push(new M1(p,c,`filter array for "${c[0]}" operator must have 2 elements`)):a!=="string"&&h.push(new M1(`${p}[1]`,c[1],`string expected, ${a} found`))}return h}function Jp(l,c){let{key:p,validateSpec:d,style:a,styleSpec:h,value:y,objectKey:w}=l,A=h[`${c}_${l.layerType}`];if(!A)return[];let k=w.match(/^(.*)-transition$/);if(c==="paint"&&k&&A[k[1]]&&A[k[1]].transition)return d({key:p,value:y,valueSpec:h.transition,style:a,styleSpec:h});let W=l.valueSpec||A[w];if(!W)return[new M1(p,y,`unknown property "${w}"`)];let n;if(ml(y)==="string"&&z5(W)&&!W.tokens&&(n=/^{([^}]+)}$/.exec(y)))return[new M1(p,y,`"${w}" does not support interpolation syntax
Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(n[1])} }\`.`)];let q=[];return l.layerType==="symbol"&&w==="text-font"&&_4(Q5(y))&&il(y.type)==="identity"&&q.push(new M1(p,y,'"text-font" does not support identity functions')),q.concat(d({key:l.key,value:y,valueSpec:W,style:a,styleSpec:h,expressionContext:"property",propertyType:c,propertyKey:w}))}function Xp(l){return Jp(l,"paint")}function Tp(l){return Jp(l,"layout")}function Zp(l){var c,p;let d=[],a=l.value,h=l.key,y=l.style,w=l.styleSpec;if(ml(a)!=="object")return[new M1(h,a,`object expected, ${ml(a)} found`)];a.type||a.ref||d.push(new M1(h,a,'either "type" or "ref" is required'));let A=il(a.type),k=il(a.ref);if(a.id){let W=il(a.id);for(let n=0;n{n in a&&d.push(new M1(h,a[n],`"${n}" is prohibited for ref layers`))}),y.layers.forEach((n)=>{il(n.id)===k&&(W=n)}),W?W.ref?d.push(new M1(h,a.ref,"ref cannot reference another ref layer")):A=il(W.type):d.push(new M1(h,a.ref,`ref layer "${k}" not found`))}else if(A!=="background")if(a.source){let W=y.sources&&y.sources[a.source],n=W&&il(W.type);W?n==="vector"&&A==="raster"?d.push(new M1(h,a.source,`layer "${a.id}" requires a raster source`)):n!=="raster-dem"&&A==="hillshade"||n!=="raster-dem"&&A==="color-relief"?d.push(new M1(h,a.source,`layer "${a.id}" requires a raster-dem source`)):n==="raster"&&A!=="raster"?d.push(new M1(h,a.source,`layer "${a.id}" requires a vector source`)):n!=="vector"||a["source-layer"]?n==="raster-dem"&&A!=="hillshade"&&A!=="color-relief"?d.push(new M1(h,a.source,"raster-dem source can only be used with layer type 'hillshade' or 'color-relief'.")):A!=="line"||!a.paint||!a.paint["line-gradient"]||n==="geojson"&&W.lineMetrics||d.push(new M1(h,a,`layer "${a.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):d.push(new M1(h,a,`layer "${a.id}" must specify a "source-layer"`)):d.push(new M1(h,a.source,`source "${a.source}" not found`))}else d.push(new M1(h,a,'missing required property "source"'));return A==="raster"&&((c=a.paint)===null||c===void 0?void 0:c.resampling)&&((p=a.paint)===null||p===void 0?void 0:p["raster-resampling"])&&d.push(new M1(h,a.paint,`layer "${a.id}" redundantly specifies "resampling" and "raster-resampling" paint properties, but only one is allowed. It is advised to use "resampling".`)),d=d.concat(u2({key:h,value:a,valueSpec:w.layer,style:l.style,styleSpec:l.styleSpec,validateSpec:l.validateSpec,objectElementValidators:{"*":()=>[],type:()=>l.validateSpec({key:`${h}.type`,value:a.type,valueSpec:w.layer.type,style:l.style,styleSpec:l.styleSpec,validateSpec:l.validateSpec,object:a,objectKey:"type"}),filter:O3,layout:(W)=>u2({layer:a,key:W.key,value:W.value,style:W.style,styleSpec:W.styleSpec,validateSpec:W.validateSpec,objectElementValidators:{"*":(n)=>Tp(bu({layerType:A},n))}}),paint:(W)=>u2({layer:a,key:W.key,value:W.value,style:W.style,styleSpec:W.styleSpec,validateSpec:W.validateSpec,objectElementValidators:{"*":(n)=>Xp(bu({layerType:A},n))}})}})),d}function p5(l){let{value:c,key:p}=l,d=ml(c);return d!=="string"?[new M1(p,c,`string expected, ${d} found`)]:[]}let x7={promoteId:function({key:l,value:c}){if(ml(c)==="string")return p5({key:l,value:c});{let p=[];for(let d in c)p.push(...p5({key:`${l}.${d}`,value:c[d]}));return p}}};function N7(l){let{value:c,key:p,styleSpec:d,style:a,validateSpec:h}=l;if(!c.type)return[new M1(p,c,'"type" is required')];let y=il(c.type),w;switch(y){case"vector":case"raster":return w=u2({key:p,value:c,valueSpec:d[`source_${y.replace("-","_")}`],style:l.style,styleSpec:d,objectElementValidators:x7,validateSpec:h}),w;case"raster-dem":return w=function(A){var k;let W=(k=A.sourceName)!==null&&k!==void 0?k:"",n=A.value,q=A.styleSpec,C=q.source_raster_dem,B=A.style,M=[],D=ml(n);if(n===void 0)return M;if(D!=="object")return M.push(new M1("source_raster_dem",n,`object expected, ${D} found`)),M;let I=il(n.encoding)==="custom",O=["redFactor","greenFactor","blueFactor","baseShift"],Y=A.value.encoding?`"${A.value.encoding}"`:"Default";for(let G in n)!I&&O.includes(G)?M.push(new M1(G,n[G],`In "${W}": "${G}" is only valid when "encoding" is set to "custom". ${Y} encoding found`)):C[G]?M=M.concat(A.validateSpec({key:G,value:n[G],valueSpec:C[G],validateSpec:A.validateSpec,style:B,styleSpec:q})):M.push(new M1(G,n[G],`unknown property "${G}"`));return M}({sourceName:p,value:c,style:l.style,styleSpec:d,validateSpec:h}),w;case"geojson":if(w=u2({key:p,value:c,valueSpec:d.source_geojson,style:a,styleSpec:d,validateSpec:h,objectElementValidators:x7}),c.cluster)for(let A in c.clusterProperties){let[k,W]=c.clusterProperties[A],n=typeof k=="string"?[k,["accumulated"],["get",A]]:k;w.push(...r5({key:`${p}.${A}.map`,value:W,expressionContext:"cluster-map"})),w.push(...r5({key:`${p}.${A}.reduce`,value:n,expressionContext:"cluster-reduce"}))}return w;case"video":return u2({key:p,value:c,valueSpec:d.source_video,style:a,validateSpec:h,styleSpec:d});case"image":return u2({key:p,value:c,valueSpec:d.source_image,style:a,validateSpec:h,styleSpec:d});case"canvas":return[new M1(p,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return j5({key:`${p}.type`,value:c.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]}})}}function pc(l){let{value:c,styleSpec:p}=l,d=p.light,a=l.style,h=[],y=ml(c);if(c===void 0)return h;if(y!=="object")return h=h.concat([new M1("light",c,`object expected, ${y} found`)]),h;for(let w in c){let A=w.match(/^(.*)-transition$/);h=h.concat(A&&d[A[1]]&&d[A[1]].transition?l.validateSpec({key:w,value:c[w],valueSpec:p.transition,validateSpec:l.validateSpec,style:a,styleSpec:p}):d[w]?l.validateSpec({key:w,value:c[w],valueSpec:d[w],validateSpec:l.validateSpec,style:a,styleSpec:p}):[new M1(w,c[w],`unknown property "${w}"`)])}return h}function bp(l){let{value:c,styleSpec:p}=l,d=p.sky,a=l.style,h=ml(c);if(c===void 0)return[];if(h!=="object")return[new M1("sky",c,`object expected, ${h} found`)];let y=[];for(let w in c)y=y.concat(d[w]?l.validateSpec({key:w,value:c[w],valueSpec:d[w],style:a,styleSpec:p}):[new M1(w,c[w],`unknown property "${w}"`)]);return y}function F7(l){let{value:c,styleSpec:p}=l,d=p.terrain,a=l.style,h=[],y=ml(c);if(c===void 0)return h;if(y!=="object")return h=h.concat([new M1("terrain",c,`object expected, ${y} found`)]),h;for(let w in c)h=h.concat(d[w]?l.validateSpec({key:w,value:c[w],valueSpec:d[w],validateSpec:l.validateSpec,style:a,styleSpec:p}):[new M1(w,c[w],`unknown property "${w}"`)]);return h}function q7(l){let c=[],p=l.value,d=l.key;if(Array.isArray(p)){let a=[],h=[];for(let y in p)p[y].id&&a.includes(p[y].id)&&c.push(new M1(d,p,`all the sprites' ids must be unique, but ${p[y].id} is duplicated`)),a.push(p[y].id),p[y].url&&h.includes(p[y].url)&&c.push(new M1(d,p,`all the sprites' URLs must be unique, but ${p[y].url} is duplicated`)),h.push(p[y].url),c=c.concat(u2({key:`${d}[${y}]`,value:p[y],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:l.validateSpec}));return c}return p5({key:d,value:p})}function $p(l){return Boolean(l)&&l.constructor===Object}function fc(l){return $p(l.value)?[]:[new M1(l.key,l.value,`object expected, ${ml(l.value)} found`)]}let P7={"*":()=>[],array:nr,boolean:function(l){let{value:c,key:p}=l,d=ml(c);return d!=="boolean"?[new M1(p,c,`boolean expected, ${d} found`)]:[]},number:z3,color:rc,constants:Qp,enum:j5,filter:O3,function:Ar,layer:Zp,object:u2,source:N7,light:pc,sky:bp,terrain:F7,projection:function(l){let{value:c,styleSpec:p}=l,d=p.projection,a=l.style,h=ml(c);if(c===void 0)return[];if(h!=="object")return[new M1("projection",c,`object expected, ${h} found`)];let y=[];for(let w in c)y=y.concat(d[w]?l.validateSpec({key:w,value:c[w],valueSpec:d[w],style:a,styleSpec:p}):[new M1(w,c[w],`unknown property "${w}"`)]);return y},projectionDefinition:function(l){let{key:c,value:p}=l;p=p instanceof String?p.valueOf():p;let d=ml(p);return d!=="array"||function(a){return Array.isArray(a)&&a.length===3&&typeof a[0]=="string"&&typeof a[1]=="string"&&typeof a[2]=="number"}(p)||function(a){return!!["interpolate","step","literal"].includes(a[0])}(p)?["array","string"].includes(d)?[]:[new M1(c,p,`projection expected, invalid type "${d}" found`)]:[new M1(c,p,`projection expected, invalid array ${JSON.stringify(p)} found`)]},string:p5,formatted:function(l){return p5(l).length===0?[]:r5(l)},resolvedImage:function(l){return p5(l).length===0?[]:r5(l)},padding:function(l){let{key:c,value:p}=l;if(ml(p)==="array"){if(p.length4)return[new M1(c,p,`padding requires 1 to 4 values; ${p.length} values found`)];let d={type:"number"},a=[];for(let h=0;h<p.length;h++)a=a.concat(l.validateSpec({key:`${c}[${h}]`,value:p[h],validateSpec:l.validateSpec,valueSpec:d}));return a}return z3({key:c,value:p,valueSpec:{}})},numberArray:function(l){let{key:c,value:p}=l;if(ml(p)==="array"){let d={type:"number"};if(p.length<1)return[new M1(c,p,"array length at least 1 expected, length 0 found")];let a=[];for(let h=0;h<p.length;h++)a=a.concat(l.validateSpec({key:`${c}[${h}]`,value:p[h],validateSpec:l.validateSpec,valueSpec:d}));return a}return z3({key:c,value:p,valueSpec:{}})},colorArray:function(l){let{key:c,value:p}=l;if(ml(p)==="array"){if(p.length<1)return[new M1(c,p,"array length at least 1 expected, length 0 found")];let d=[];for(let a=0;a<p.length;a++)d=d.concat(rc({key:`${c}[${a}]`,value:p[a]}));return d}return rc({key:c,value:p})},variableAnchorOffsetCollection:function(l){let{key:c,value:p}=l,d=ml(p),a=l.styleSpec;if(d!=="array"||p.length<1||p.length%2!=0)return[new M1(c,p,"variableAnchorOffsetCollection requires a non-empty array of even length")];let h=[];for(let y=0;y []}})),l.constants&&(p=p.concat(Qp({key:"constants",value:l.constants}))),_p(p)}function J2(l){return function(c){return l(Object.assign({},c,{validateSpec:G3}))}}function _p(l){return[].concat(l).sort((c,p)=>c.line-p.line)}function X2(l){return function(...c){return _p(l.apply(this,c))}}q2.source=X2(J2(N7)),q2.sprite=X2(J2(q7)),q2.glyphs=X2(J2(Q3)),q2.light=X2(J2(pc)),q2.sky=X2(J2(bp)),q2.terrain=X2(J2(F7)),q2.state=X2(J2(fc)),q2.layer=X2(J2(Zp)),q2.filter=X2(J2(O3)),q2.paintProperty=X2(J2(Xp)),q2.layoutProperty=X2(J2(Tp));let Sd={type:"enum","property-type":"data-constant",expression:{interpolated:!1,parameters:["global-state"]},values:{visible:{},none:{}},transition:!1,default:"visible"};class M7{constructor(l,c){this._globalState=c,this.setValue(l)}evaluate(){var l;return(l=this._literalValue)!==null&&l!==void 0?l:this._compiledValue.evaluate({})}setValue(l){if(l==null||l==="visible"||l==="none")return this._literalValue=l==="none"?"none":"visible",this._compiledValue=void 0,void(this._globalStateRefs=new Set);let c=R3(l,Sd,this._globalState);if(c.result==="error")throw this._literalValue="visible",this._compiledValue=void 0,Error(c.value.map((p)=>`${p.key}: ${p.message}`).join(", "));this._literalValue=void 0,this._compiledValue=c.value,this._globalStateRefs=I3(c.value.expression)}getGlobalStateRefs(){return this._globalStateRefs}}let dc=E1,uu=q2,c2=uu.light,j3=uu.sky,B7=uu.paintProperty,ip=uu.layoutProperty;function K7(l,c){let p=!1;if(c==null?void 0:c.length)for(let d of c)l.fire(new N5(Error(d.message))),p=!0;return p}class cu{constructor(l,c,p){let d=this.cells=[];if(l instanceof ArrayBuffer){this.arrayBuffer=l;let h=new Int32Array(this.arrayBuffer);l=h[0],this.d=(c=h[1])+2*(p=h[2]);for(let w=0;w<this.d*this.d;w++){let A=h[3+w],k=h[3+w+1];d.push(A===k?null:h.subarray(A,k))}let y=h[3+d.length+1];this.keys=h.subarray(h[3+d.length],y),this.bboxes=h.subarray(y),this.insert=this._insertReadonly}else{this.d=c+2*p;for(let h=0;h<this.d*this.d;h++)d.push([]);this.keys=[],this.bboxes=[]}this.n=c,this.extent=l,this.padding=p,this.scale=c/l,this.uid=0;let a=p/c*l;this.min=-a,this.max=l+a}insert(l,c,p,d,a){this._forEachCell(c,p,d,a,this._insertCell,this.uid++,void 0,void 0),this.keys.push(l),this.bboxes.push(c),this.bboxes.push(p),this.bboxes.push(d),this.bboxes.push(a)}_insertReadonly(){throw Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(l,c,p,d,a,h){this.cells[a].push(h)}query(l,c,p,d,a){let h=this.min,y=this.max;if(l<=h&&c<=h&&y<=p&&y<=d&&!a)return[...this.keys];{let w=[];return this._forEachCell(l,c,p,d,this._queryCell,w,{},a),w}}_queryCell(l,c,p,d,a,h,y,w){let A=this.cells[a];if(A!==null){let k=this.keys,W=this.bboxes;for(let n of A)if(y[n]===void 0){let q=4*n;(w?w(W[q+0],W[q+1],W[q+2],W[q+3]):l<=W[q+2]&&c=W[q+0]&&d>=W[q+1])?(y[n]=!0,h.push(k[n])):y[n]=!1}}}_forEachCell(l,c,p,d,a,h,y,w){let A=this._convertToCellCoord(l),k=this._convertToCellCoord(c),W=this._convertToCellCoord(p),n=this._convertToCellCoord(d);for(let q=A;q<=W;q++)for(let C=k;C<=n;C++){let B=this.d*C+q;if((!w||w(this._convertFromCellCoord(q),this._convertFromCellCoord(C),this._convertFromCellCoord(q+1),this._convertFromCellCoord(C+1)))&&a.call(this,l,c,p,d,B,h,y,w))return}}_convertFromCellCoord(l){return(l-this.padding)/this.scale}_convertToCellCoord(l){return Math.max(0,Math.min(this.d-1,Math.floor(l*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;let l=this.cells,c=3+this.cells.length+1+1,p=0;for(let h of this.cells)p+=h.length;let d=new Int32Array(c+p+this.keys.length+this.bboxes.length);d[0]=this.extent,d[1]=this.n,d[2]=this.padding;let a=c;for(let h=0;h<l.length;h++){let y=l[h];d[3+h]=a,d.set(y,a),a+=y.length}return d[3+l.length]=a,d.set(this.keys,a),a+=this.keys.length,d[3+l.length+1]=a,d.set(this.bboxes,a),a+=this.bboxes.length,d.buffer}static serialize(l,c){let p=l.toArrayBuffer();return c&&c.push(p),{buffer:p}}static deserialize(l){return new cu(l.buffer)}}let T2={};function z1(l,c,p={}){if(T2[l])throw Error(`${l} is already registered.`);Object.defineProperty(c,"_classRegistryKey",{value:l,writeable:!1}),T2[l]={klass:c,omit:p.omit||[],shallow:p.shallow||[]}}z1("Object",Object),z1("Set",Set),z1("TransferableGridIndex",cu),z1("Color",dl),z1("Error",Error),z1("AJAXError",Zu),z1("ResolvedImage",w2),z1("StylePropertyFunction",t4),z1("StyleExpression",O5,{omit:["_evaluator"]}),z1("ZoomDependentExpression",e4),z1("ZoomConstantExpression",H3),z1("CompoundExpression",k2,{omit:["_evaluate"]});for(let l in I5)I5[l]._classRegistryKey||z1(`Expression_${l}`,I5[l]);function U7(l){var c;return l&&typeof ArrayBufferp?(this.lastIntegerZoom=p+1,this.lastIntegerZoomTime=c):this.lastFloorZoom {try{return new RegExp(`\\p{sc=${p}}`,"u").source}catch(d){return null}}).filter((p)=>p);return new RegExp(c.join("|"),"u")}let Cr=H7(["Arab","Dupl","Mong","Ougr","Syrc"]);function xr(l){return!Cr.test(String.fromCodePoint(l))}function I7(l){return!(f5(l)||(c=l,/[\xA7\xA9\xAE\xB1\xBC-\xBE\xD7\xF7\u2016\u2020\u2021\u2030\u2031\u203B\u203C\u2042\u2047-\u2049\u2051\u2100-\u218F\u221E\u2234\u2235\u2300-\u2307\u230C-\u231F\u2324-\u2328\u232B\u237D-\u239A\u23BE-\u23CD\u23CF\u23D1-\u23DB\u23E2-\u2422\u2424-\u24FF\u25A0-\u2619\u2620-\u2767\u2776-\u2793\u2B12-\u2B2F\u2B50-\u2B59\u2BB8-\u2BEB\u3000-\u303F\u30A0-\u30FF\uE000-\uF8FF\uFE30-\uFE6F\uFF00-\uFFEF\uFFFC\uFFFD]|[\uDB80-\uDBFF][\uDC00-\uDFFF]/gim.test(String.fromCodePoint(c))));var c}let Y7=H7(["Adlm","Arab","Armi","Avst","Chrs","Cprt","Egyp","Elym","Gara","Hatr","Hebr","Hung","Khar","Lydi","Mand","Mani","Mend","Merc","Mero","Narb","Nbat","Nkoo","Orkh","Palm","Phli","Phlp","Phnx","Prti","Rohg","Samr","Sarb","Sogo","Syrc","Thaa","Todr","Yezi"]);function z7(l){return Y7.test(String.fromCodePoint(l))}function O7(l,c){return!(!c&&z7(l)||/[\u0900-\u0DFF\u0F00-\u109F\u1780-\u17FF]/gim.test(String.fromCodePoint(l)))}function G7(l){for(let c of l)if(z7(c.codePointAt(0)))return!0;return!1}let pu=new class{constructor(){this.TIMEOUT=5000,this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null,this.loadScriptResolve=()=>{}}setState(l){this.pluginStatus=l.pluginStatus,this.pluginURL=l.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(l){if(pu.isParsed())throw Error("RTL text plugin already registered.");this.applyArabicShaping=l.applyArabicShaping,this.processBidirectionalText=l.processBidirectionalText,this.processStyledBidirectionalText=l.processStyledBidirectionalText,this.loadScriptResolve()}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getRTLTextPluginStatus(){return this.pluginStatus}syncState(l,c){return g(this,void 0,void 0,function*(){if(this.isParsed())return this.getState();if(l.pluginStatus!=="loading")return this.setState(l),l;let p=l.pluginURL,d=new Promise((h)=>{this.loadScriptResolve=h});c(p);let a=new Promise((h)=>setTimeout(()=>h(),this.TIMEOUT));if(yield Promise.race([d,a]),this.isParsed()){let h={pluginStatus:"loaded",pluginURL:p};return this.setState(h),h}throw this.setState({pluginStatus:"error",pluginURL:""}),Error(`RTL Text Plugin failed to import scripts from ${p}`)})}};class Nl{constructor(l,c){this.isSupportedScript=Q7,this.zoom=l,c?(this.now=c.now||0,this.fadeDuration=c.fadeDuration||0,this.zoomHistory=c.zoomHistory||new Vr,this.transition=c.transition||{}):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Vr,this.transition={})}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){let l=this.zoom,c=l-Math.floor(l),p=this.crossFadingFactor();return l>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:c+(1-c)*p}:{fromScale:0.5,toScale:1,t:1-(1-p)*c}}}function Q7(l){return function(c,p){for(let d of c)if(!O7(d.codePointAt(0),p))return!1;return!0}(l,pu.getRTLTextPluginStatus()==="loaded")}let Nr="-transition";class X3{constructor(l,c,p){this.property=l,this.value=c,this.expression=function(d,a,h){if(_4(d))return new t4(d,a);if(i4(d)){let y=A7(d,a,h);if(y.result==="error")throw Error(y.value.map((w)=>`${w.key}: ${w.message}`).join(", "));return y.value}{let y=d;return a.type==="color"&&typeof d=="string"?y=dl.parse(d):a.type!=="padding"||typeof d!="number"&&!Array.isArray(d)?a.type!=="numberArray"||typeof d!="number"&&!Array.isArray(d)?a.type!=="colorArray"||typeof d!="string"&&!Array.isArray(d)?a.type==="variableAnchorOffsetCollection"&&Array.isArray(d)?y=j0.parse(d):a.type==="projectionDefinition"&&typeof d=="string"&&(y=M0.parse(d)):y=e1.parse(d):y=Yl.parse(d):y=P0.parse(d),{globalStateRefs:new Set,_globalState:null,kind:"constant",evaluate:()=>y}}}(c===void 0?l.specification.default:c,l.specification,p)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}getGlobalStateRefs(){return this.expression.globalStateRefs||new Set}possiblyEvaluate(l,c,p){return this.property.possiblyEvaluate(this,l,c,p)}}class Fr{constructor(l,c){this.property=l,this.value=new X3(l,void 0,c)}transitioned(l,c){return new vc(this.property,this.value,c,h2({},l.transition,this.transition),l.now)}untransitioned(){return new vc(this.property,this.value,null,{},0)}}class gc{constructor(l,c){this._properties=l,this._values=Object.create(l.defaultTransitionablePropertyValues),this._globalState=c}hasProperty(l){return l in this._properties.defaultTransitionablePropertyValues}getValue(l){return gl(this._values[l].value.value)}setValue(l,c){Object.hasOwn(this._values,l)||(this._values[l]=new Fr(this._values[l].property,this._globalState)),this._values[l].value=new X3(this._values[l].property,c===null?void 0:gl(c),this._globalState)}getTransition(l){return gl(this._values[l].transition)}setTransition(l,c){Object.hasOwn(this._values,l)||(this._values[l]=new Fr(this._values[l].property,this._globalState)),this._values[l].transition=gl(c)||void 0}serialize(){let l={};for(let c of Object.keys(this._values)){let p=this.getValue(c);p!==void 0&&(l[c]=p);let d=this.getTransition(c);d!==void 0&&(l[`${c}${Nr}`]=d)}return l}transitioned(l,c){let p=new qr(this._properties);for(let d of Object.keys(this._values))p._values[d]=this._values[d].transitioned(l,c._values[d]);return p}untransitioned(){let l=new qr(this._properties);for(let c of Object.keys(this._values))l._values[c]=this._values[c].untransitioned();return l}}class vc{constructor(l,c,p,d,a){this.property=l,this.value=c,this.begin=a+d.delay||0,this.end=this.begin+d.duration||0,l.specification.transition&&(d.delay||d.duration)&&(this.prior=p)}possiblyEvaluate(l,c,p){let d=l.now||0,a=this.value.possiblyEvaluate(l,c,p),h=this.prior;if(h){if(d>this.end)return this.prior=null,a;if(this.value.isDataDriven())return this.prior=null,a;if(dd.zoomHistory.lastIntegerZoom?{from:l,to:c}:{from:p,to:c}}interpolate(l){return l}}class Pr{constructor(l){this.specification=l}possiblyEvaluate(l,c,p,d){if(l.value!==void 0){if(l.expression.kind==="constant"){let a=l.expression.evaluate(c,null,{},p,d);return this._calculate(a,a,a,c)}return this._calculate(l.expression.evaluate(new Nl(Math.floor(c.zoom-1),c)),l.expression.evaluate(new Nl(Math.floor(c.zoom),c)),l.expression.evaluate(new Nl(Math.floor(c.zoom+1),c)),c)}}_calculate(l,c,p,d){return d.zoom>d.zoomHistory.lastIntegerZoom?{from:l,to:c}:{from:p,to:c}}interpolate(l){return l}}class X5{constructor(l){this.specification=l}possiblyEvaluate(l,c,p,d){return!!l.expression.evaluate(c,null,{},p,d)}interpolate(){return!1}}class C0{constructor(l){this.properties=l,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(let c in l){let p=l[c];p.specification.overridable&&this.overridableProperties.push(c);let d=this.defaultPropertyValues[c]=new X3(p,void 0,void 0),a=this.defaultTransitionablePropertyValues[c]=new Fr(p,void 0);this.defaultTransitioningPropertyValues[c]=a.untransitioned(),this.defaultPossiblyEvaluatedValues[c]=d.possiblyEvaluate({})}}}z1("DataDrivenProperty",$1),z1("DataConstantProperty",T1),z1("CrossFadedDataDrivenProperty",qu),z1("CrossFadedProperty",Pr),z1("ColorRampProperty",X5);let J7=" is a PAINT property not a LAYOUT property. Use get/setPaintProperty instead?",Mr=" is a LAYOUT property not a PAINT property. Use get/setLayoutProperty instead?";class r2 extends F4{constructor(l,c,p){if(super(),this.id=l.id,this.type=l.type,this._globalState=p,this._featureFilter={filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set},this._visibilityExpression=function(d,a){return new M7(d,a)}(this.visibility,p),l.type!=="custom"&&(this.metadata=l.metadata,this.minzoom=l.minzoom,this.maxzoom=l.maxzoom,l.type!=="background"&&(this.source=l.source,this.sourceLayer=l["source-layer"],this.filter=l.filter,this._featureFilter=lc(l.filter,p)),c.layout&&(this._unevaluatedLayout=new j7(c.layout,p)),c.paint)){this._transitionablePaint=new gc(c.paint,p);for(let d in l.paint)this.setPaintProperty(d,l.paint[d],{validate:!1});for(let d in l.layout)this.setLayoutProperty(d,l.layout[d],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new J5(c.paint)}}setFilter(l){this.filter=l,this._featureFilter=lc(l,this._globalState)}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(l){var c;if(l==="visibility")return this.visibility;if((c=this._transitionablePaint)===null||c===void 0?void 0:c.hasProperty(l))throw Error(l+J7);if(!this._unevaluatedLayout)throw Error(`Cannot get layout property "${l}" on layer type "${this.type}" which has no layout properties.`);return this._unevaluatedLayout.getValue(l)}getLayoutAffectingGlobalStateRefs(){let l=new Set;for(let c of this._visibilityExpression.getGlobalStateRefs())l.add(c);if(this._unevaluatedLayout)for(let c in this._unevaluatedLayout._values){let p=this._unevaluatedLayout._values[c];for(let d of p.getGlobalStateRefs())l.add(d)}for(let c of this._featureFilter.getGlobalStateRefs())l.add(c);return l}getPaintAffectingGlobalStateRefs(){var l;let c=new globalThis.Map;if(this._transitionablePaint)for(let p in this._transitionablePaint._values){let d=this._transitionablePaint._values[p].value;for(let a of d.getGlobalStateRefs()){let h=(l=c.get(a))!==null&&l!==void 0?l:[];h.push({name:p,value:d.value}),c.set(a,h)}}return c}getVisibilityAffectingGlobalStateRefs(){return this._visibilityExpression.getGlobalStateRefs()}setLayoutProperty(l,c,p={}){var d;if(l==="visibility")return this.visibility=c,this._visibilityExpression.setValue(c),void this.recalculateVisibility();((d=this._transitionablePaint)===null||d===void 0?void 0:d.hasProperty(l))?this.fire(new N5(Error(l+J7))):c!=null&&this._validate(ip,`layers.${this.id}.layout.${l}`,l,c,p)||this._unevaluatedLayout.setValue(l,c)}getPaintProperty(l){var c,p;if(l.endsWith(Nr)){let d=l.slice(0,-11);if(d==="visibility"||((c=this._unevaluatedLayout)===null||c===void 0?void 0:c.hasProperty(d)))throw Error(l+Mr);return this._transitionablePaint.getTransition(d)}if(l==="visibility"||((p=this._unevaluatedLayout)===null||p===void 0?void 0:p.hasProperty(l)))throw Error(l+Mr);return this._transitionablePaint.getValue(l)}setPaintProperty(l,c,p={}){var d;if(l==="visibility"||((d=this._unevaluatedLayout)===null||d===void 0?void 0:d.hasProperty(l)))return this.fire(new N5(Error(l+Mr))),!1;if(c!=null&&this._validate(B7,`layers.${this.id}.paint.${l}`,l,c,p))return!1;if(l.endsWith(Nr))return this._transitionablePaint.setTransition(l.slice(0,-11),c||void 0),!1;{let a=this._transitionablePaint._values[l],h=a.property.specification["property-type"]==="cross-faded-data-driven",y=a.value.isDataDriven(),w=a.value;this._transitionablePaint.setValue(l,c),this._handleSpecialPaintPropertyUpdate(l);let A=this._transitionablePaint._values[l].value;return A.isDataDriven()||y||h||this._handleOverridablePaintPropertyUpdate(l,w,A)}}_handleSpecialPaintPropertyUpdate(l){}_handleOverridablePaintPropertyUpdate(l,c,p){return!1}isHidden(l=this.minzoom,c=!1){return!!(this.minzoom&&l=this.maxzoom)||this._evaluatedVisibility==="none"}updateTransitions(l){this._transitioningPaint=this._transitionablePaint.transitioned(l,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculateVisibility(){this._evaluatedVisibility=this._visibilityExpression.evaluate()}recalculate(l,c){l.getCrossfadeParameters&&(this._crossfadeParameters=l.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(l,void 0,c)),this.paint=this._transitioningPaint.possiblyEvaluate(l,void 0,c)}serialize(){var l,c;let p={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:(l=this._unevaluatedLayout)===null||l===void 0?void 0:l.serialize(),paint:(c=this._transitionablePaint)===null||c===void 0?void 0:c.serialize()};return this.visibility&&(p.layout||(p.layout={}),p.layout.visibility=this.visibility),Vl(p,(d,a)=>!(d===void 0||a==="layout"&&!Object.keys(d).length||a==="paint"&&!Object.keys(d).length))}_validate(l,c,p,d,a={}){return(a==null?void 0:a.validate)!==!1&&K7(this,l.call(uu,{key:c,layerType:this.type,objectKey:p,value:d,styleSpec:E1,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(let l in this.paint._values){let c=this.paint.get(l);if(c instanceof E2&&z5(c.property.specification)&&(c.value.kind==="source"||c.value.kind==="composite")&&c.value.isStateDependent)return!0}return!1}}let Br;var ep={get paint(){return Br=Br||new C0({"raster-opacity":new T1(E1.paint_raster["raster-opacity"]),"raster-hue-rotate":new T1(E1.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new T1(E1.paint_raster["raster-brightness-min"]),"raster-brightness-max":new T1(E1.paint_raster["raster-brightness-max"]),"raster-saturation":new T1(E1.paint_raster["raster-saturation"]),"raster-contrast":new T1(E1.paint_raster["raster-contrast"]),resampling:new T1(E1.paint_raster.resampling),"raster-resampling":new T1(E1.paint_raster["raster-resampling"]),"raster-fade-duration":new T1(E1.paint_raster["raster-fade-duration"])})}};class tp extends r2{constructor(l,c){super(l,ep,c)}}let l9={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class T5{constructor(l,c){this._structArray=l,this._pos1=c*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class Ul{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(l,c){return l._trim(),c&&(l.isTransferred=!0,c.push(l.arrayBuffer)),{length:l.length,arrayBuffer:l.arrayBuffer}}static deserialize(l){let c=Object.create(this.prototype);return c.arrayBuffer=l.arrayBuffer,c.length=l.length,c.capacity=l.arrayBuffer.byteLength/c.bytesPerElement,c._refreshViews(),c}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(l){this.reserve(l),this.length=l}reserve(l){if(l>this.capacity){this.capacity=Math.max(l,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);let c=this.uint8;this._refreshViews(),c&&this.uint8.set(c)}}_refreshViews(){throw Error("_refreshViews() must be implemented by each concrete StructArray layout")}freeBufferAfterUpload(){this.arrayBuffer=new ArrayBuffer(0),this._refreshViews()}}function Pl(l,c=1){let p=0,d=0;return{members:l.map((a)=>{let h=l9[a.type].BYTES_PER_ELEMENT,y=p=X7(p,Math.max(c,h)),w=a.components||1;return d=Math.max(d,h),p+=h*w,{name:a.name,type:a.type,components:w,offset:y}}),size:X7(p,Math.max(d,c)),alignment:c}}function X7(l,c){return Math.ceil(l/c)*c}class T3 extends Ul{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(l,c){let p=this.length;return this.resize(p+1),this.emplace(p,l,c)}emplace(l,c,p){let d=2*l;return this.int16[d+0]=c,this.int16[d+1]=p,l}}T3.prototype.bytesPerElement=4,z1("StructArrayLayout2i4",T3);class ac extends Ul{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(l,c,p){let d=this.length;return this.resize(d+1),this.emplace(d,l,c,p)}emplace(l,c,p,d){let a=3*l;return this.int16[a+0]=c,this.int16[a+1]=p,this.int16[a+2]=d,l}}ac.prototype.bytesPerElement=6,z1("StructArrayLayout3i6",ac);class oc extends Ul{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(l,c,p,d){let a=this.length;return this.resize(a+1),this.emplace(a,l,c,p,d)}emplace(l,c,p,d,a){let h=4*l;return this.int16[h+0]=c,this.int16[h+1]=p,this.int16[h+2]=d,this.int16[h+3]=a,l}}oc.prototype.bytesPerElement=8,z1("StructArrayLayout4i8",oc);class hc extends Ul{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(l,c,p,d,a,h){let y=this.length;return this.resize(y+1),this.emplace(y,l,c,p,d,a,h)}emplace(l,c,p,d,a,h,y){let w=6*l;return this.int16[w+0]=c,this.int16[w+1]=p,this.int16[w+2]=d,this.int16[w+3]=a,this.int16[w+4]=h,this.int16[w+5]=y,l}}hc.prototype.bytesPerElement=12,z1("StructArrayLayout2i4i12",hc);class Kr extends Ul{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(l,c,p,d,a,h){let y=this.length;return this.resize(y+1),this.emplace(y,l,c,p,d,a,h)}emplace(l,c,p,d,a,h,y){let w=4*l,A=8*l;return this.int16[w+0]=c,this.int16[w+1]=p,this.uint8[A+4]=d,this.uint8[A+5]=a,this.uint8[A+6]=h,this.uint8[A+7]=y,l}}Kr.prototype.bytesPerElement=8,z1("StructArrayLayout2i4ub8",Kr);class Z5 extends Ul{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(l,c){let p=this.length;return this.resize(p+1),this.emplace(p,l,c)}emplace(l,c,p){let d=2*l;return this.float32[d+0]=c,this.float32[d+1]=p,l}}Z5.prototype.bytesPerElement=8,z1("StructArrayLayout2f8",Z5);class fu extends Ul{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(l,c,p,d,a,h,y,w,A,k){let W=this.length;return this.resize(W+1),this.emplace(W,l,c,p,d,a,h,y,w,A,k)}emplace(l,c,p,d,a,h,y,w,A,k,W){let n=10*l;return this.uint16[n+0]=c,this.uint16[n+1]=p,this.uint16[n+2]=d,this.uint16[n+3]=a,this.uint16[n+4]=h,this.uint16[n+5]=y,this.uint16[n+6]=w,this.uint16[n+7]=A,this.uint16[n+8]=k,this.uint16[n+9]=W,l}}fu.prototype.bytesPerElement=20,z1("StructArrayLayout10ui20",fu);class yc extends Ul{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(l,c,p,d,a,h,y,w){let A=this.length;return this.resize(A+1),this.emplace(A,l,c,p,d,a,h,y,w)}emplace(l,c,p,d,a,h,y,w,A){let k=8*l;return this.uint16[k+0]=c,this.uint16[k+1]=p,this.uint16[k+2]=d,this.uint16[k+3]=a,this.uint16[k+4]=h,this.uint16[k+5]=y,this.uint16[k+6]=w,this.uint16[k+7]=A,l}}yc.prototype.bytesPerElement=16,z1("StructArrayLayout8ui16",yc);class Z3 extends Ul{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(l,c,p,d,a,h,y,w,A,k,W,n){let q=this.length;return this.resize(q+1),this.emplace(q,l,c,p,d,a,h,y,w,A,k,W,n)}emplace(l,c,p,d,a,h,y,w,A,k,W,n,q){let C=12*l;return this.int16[C+0]=c,this.int16[C+1]=p,this.int16[C+2]=d,this.int16[C+3]=a,this.uint16[C+4]=h,this.uint16[C+5]=y,this.uint16[C+6]=w,this.uint16[C+7]=A,this.int16[C+8]=k,this.int16[C+9]=W,this.int16[C+10]=n,this.int16[C+11]=q,l}}Z3.prototype.bytesPerElement=24,z1("StructArrayLayout4i4ui4i24",Z3);class wc extends Ul{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(l,c,p){let d=this.length;return this.resize(d+1),this.emplace(d,l,c,p)}emplace(l,c,p,d){let a=3*l;return this.float32[a+0]=c,this.float32[a+1]=p,this.float32[a+2]=d,l}}wc.prototype.bytesPerElement=12,z1("StructArrayLayout3f12",wc);class b5 extends Ul{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(l){let c=this.length;return this.resize(c+1),this.emplace(c,l)}emplace(l,c){return this.uint32[1*l+0]=c,l}}b5.prototype.bytesPerElement=4,z1("StructArrayLayout1ul4",b5);class Ur extends Ul{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(l,c,p,d,a,h,y,w,A){let k=this.length;return this.resize(k+1),this.emplace(k,l,c,p,d,a,h,y,w,A)}emplace(l,c,p,d,a,h,y,w,A,k){let W=10*l,n=5*l;return this.int16[W+0]=c,this.int16[W+1]=p,this.int16[W+2]=d,this.int16[W+3]=a,this.int16[W+4]=h,this.int16[W+5]=y,this.uint32[n+3]=w,this.uint16[W+8]=A,this.uint16[W+9]=k,l}}Ur.prototype.bytesPerElement=20,z1("StructArrayLayout6i1ul2ui20",Ur);class $5 extends Ul{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(l,c,p,d,a,h){let y=this.length;return this.resize(y+1),this.emplace(y,l,c,p,d,a,h)}emplace(l,c,p,d,a,h,y){let w=6*l;return this.int16[w+0]=c,this.int16[w+1]=p,this.int16[w+2]=d,this.int16[w+3]=a,this.int16[w+4]=h,this.int16[w+5]=y,l}}$5.prototype.bytesPerElement=12,z1("StructArrayLayout2i2i2i12",$5);class d5 extends Ul{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(l,c,p,d,a){let h=this.length;return this.resize(h+1),this.emplace(h,l,c,p,d,a)}emplace(l,c,p,d,a,h){let y=4*l,w=8*l;return this.float32[y+0]=c,this.float32[y+1]=p,this.float32[y+2]=d,this.int16[w+6]=a,this.int16[w+7]=h,l}}d5.prototype.bytesPerElement=16,z1("StructArrayLayout2f1f2i16",d5);class Dr extends Ul{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(l,c,p,d,a,h){let y=this.length;return this.resize(y+1),this.emplace(y,l,c,p,d,a,h)}emplace(l,c,p,d,a,h,y){let w=16*l,A=4*l,k=8*l;return this.uint8[w+0]=c,this.uint8[w+1]=p,this.float32[A+1]=d,this.float32[A+2]=a,this.int16[k+6]=h,this.int16[k+7]=y,l}}Dr.prototype.bytesPerElement=16,z1("StructArrayLayout2ub2f2i16",Dr);class b3 extends Ul{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(l,c,p){let d=this.length;return this.resize(d+1),this.emplace(d,l,c,p)}emplace(l,c,p,d){let a=3*l;return this.uint16[a+0]=c,this.uint16[a+1]=p,this.uint16[a+2]=d,l}}b3.prototype.bytesPerElement=6,z1("StructArrayLayout3ui6",b3);class m5 extends Ul{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(l,c,p,d,a,h,y,w,A,k,W,n,q,C,B,M,D){let I=this.length;return this.resize(I+1),this.emplace(I,l,c,p,d,a,h,y,w,A,k,W,n,q,C,B,M,D)}emplace(l,c,p,d,a,h,y,w,A,k,W,n,q,C,B,M,D,I){let O=24*l,Y=12*l,G=48*l;return this.int16[O+0]=c,this.int16[O+1]=p,this.uint16[O+2]=d,this.uint16[O+3]=a,this.uint32[Y+2]=h,this.uint32[Y+3]=y,this.uint32[Y+4]=w,this.uint16[O+10]=A,this.uint16[O+11]=k,this.uint16[O+12]=W,this.float32[Y+7]=n,this.float32[Y+8]=q,this.uint8[G+36]=C,this.uint8[G+37]=B,this.uint8[G+38]=M,this.uint32[Y+10]=D,this.int16[O+22]=I,l}}m5.prototype.bytesPerElement=48,z1("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",m5);class Rr extends Ul{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(l,c,p,d,a,h,y,w,A,k,W,n,q,C,B,M,D,I,O,Y,G,j,Z,d1,m1,a1,s1,w1){let k1=this.length;return this.resize(k1+1),this.emplace(k1,l,c,p,d,a,h,y,w,A,k,W,n,q,C,B,M,D,I,O,Y,G,j,Z,d1,m1,a1,s1,w1)}emplace(l,c,p,d,a,h,y,w,A,k,W,n,q,C,B,M,D,I,O,Y,G,j,Z,d1,m1,a1,s1,w1,k1){let y1=32*l,n1=16*l;return this.int16[y1+0]=c,this.int16[y1+1]=p,this.int16[y1+2]=d,this.int16[y1+3]=a,this.int16[y1+4]=h,this.int16[y1+5]=y,this.int16[y1+6]=w,this.int16[y1+7]=A,this.uint16[y1+8]=k,this.uint16[y1+9]=W,this.uint16[y1+10]=n,this.uint16[y1+11]=q,this.uint16[y1+12]=C,this.uint16[y1+13]=B,this.uint16[y1+14]=M,this.uint16[y1+15]=D,this.uint16[y1+16]=I,this.uint16[y1+17]=O,this.uint16[y1+18]=Y,this.uint16[y1+19]=G,this.uint16[y1+20]=j,this.uint16[y1+21]=Z,this.uint16[y1+22]=d1,this.uint32[n1+12]=m1,this.float32[n1+13]=a1,this.float32[n1+14]=s1,this.uint16[y1+30]=w1,this.uint16[y1+31]=k1,l}}Rr.prototype.bytesPerElement=64,z1("StructArrayLayout8i15ui1ul2f2ui64",Rr);class sc extends Ul{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(l){let c=this.length;return this.resize(c+1),this.emplace(c,l)}emplace(l,c){return this.float32[1*l+0]=c,l}}sc.prototype.bytesPerElement=4,z1("StructArrayLayout1f4",sc);class Sc extends Ul{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(l,c,p){let d=this.length;return this.resize(d+1),this.emplace(d,l,c,p)}emplace(l,c,p,d){let a=3*l;return this.uint16[6*l+0]=c,this.float32[a+1]=p,this.float32[a+2]=d,l}}Sc.prototype.bytesPerElement=12,z1("StructArrayLayout1ui2f12",Sc);class Hr extends Ul{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(l,c,p){let d=this.length;return this.resize(d+1),this.emplace(d,l,c,p)}emplace(l,c,p,d){let a=4*l;return this.uint32[2*l+0]=c,this.uint16[a+2]=p,this.uint16[a+3]=d,l}}Hr.prototype.bytesPerElement=8,z1("StructArrayLayout1ul2ui8",Hr);class u extends Ul{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(l,c){let p=this.length;return this.resize(p+1),this.emplace(p,l,c)}emplace(l,c,p){let d=2*l;return this.uint16[d+0]=c,this.uint16[d+1]=p,l}}u.prototype.bytesPerElement=4,z1("StructArrayLayout2ui4",u);class r extends Ul{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(l){let c=this.length;return this.resize(c+1),this.emplace(c,l)}emplace(l,c){return this.uint16[1*l+0]=c,l}}r.prototype.bytesPerElement=2,z1("StructArrayLayout1ui2",r);class m extends Ul{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(l,c,p,d){let a=this.length;return this.resize(a+1),this.emplace(a,l,c,p,d)}emplace(l,c,p,d,a){let h=4*l;return this.float32[h+0]=c,this.float32[h+1]=p,this.float32[h+2]=d,this.float32[h+3]=a,l}}m.prototype.bytesPerElement=16,z1("StructArrayLayout4f16",m);class o extends T5{get anchorPointX(){return this._structArray.int16[this._pos2+0]}get anchorPointY(){return this._structArray.int16[this._pos2+1]}get x1(){return this._structArray.int16[this._pos2+2]}get y1(){return this._structArray.int16[this._pos2+3]}get x2(){return this._structArray.int16[this._pos2+4]}get y2(){return this._structArray.int16[this._pos2+5]}get featureIndex(){return this._structArray.uint32[this._pos4+3]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+8]}get bucketIndex(){return this._structArray.uint16[this._pos2+9]}get anchorPoint(){return new H(this.anchorPointX,this.anchorPointY)}}o.prototype.size=20;class s extends Ur{get(l){return new o(this,l)}}z1("CollisionBoxArray",s);class E extends T5{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(l){this._structArray.uint8[this._pos1+37]=l}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(l){this._structArray.uint8[this._pos1+38]=l}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(l){this._structArray.uint32[this._pos4+10]=l}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}E.prototype.size=48;class L extends m5{get(l){return new E(this,l)}}z1("PlacedSymbolArray",L);class N extends T5{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(l){this._structArray.uint32[this._pos4+12]=l}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+14]}get textAnchorOffsetStartIndex(){return this._structArray.uint16[this._pos2+30]}get textAnchorOffsetEndIndex(){return this._structArray.uint16[this._pos2+31]}}N.prototype.size=64;class F extends Rr{get(l){return new N(this,l)}}z1("SymbolInstanceArray",F);class P extends sc{getoffsetX(l){return this.float32[1*l+0]}}z1("GlyphOffsetArray",P);class K extends ac{getx(l){return this.int16[3*l+0]}gety(l){return this.int16[3*l+1]}gettileUnitDistanceFromAnchor(l){return this.int16[3*l+2]}}z1("SymbolLineVertexArray",K);class R extends T5{get textAnchor(){return this._structArray.uint16[this._pos2+0]}get textOffset0(){return this._structArray.float32[this._pos4+1]}get textOffset1(){return this._structArray.float32[this._pos4+2]}}R.prototype.size=12;class U extends Sc{get(l){return new R(this,l)}}z1("TextAnchorOffsetArray",U);class z extends T5{get featureIndex(){return this._structArray.uint32[this._pos4+0]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+2]}get bucketIndex(){return this._structArray.uint16[this._pos2+3]}}z.prototype.size=8;class Q extends Hr{get(l){return new z(this,l)}}z1("FeatureIndexArray",Q);class t extends T3{}class i extends T3{}class X extends T3{}class c1 extends hc{}class $ extends Kr{}class e extends Z5{}class u1 extends fu{}class T extends yc{}class p1 extends Z3{}class S1 extends wc{}class h1 extends b5{}class W1 extends $5{}class L1 extends Dr{}class Q1 extends b3{}class j1 extends u{}let C1=Pl([{name:"a_pos",components:2,type:"Int16"}],4),{members:O1}=C1;class I1{constructor(l=[]){this._forceNewSegmentOnNextPrepare=!1,this.segments=l}prepareSegment(l,c,p,d){let a=this.segments[this.segments.length-1];return l>I1.MAX_VERTEX_ARRAY_LENGTH&&w0(`Max vertices per segment is ${I1.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${l}. Consider using the \`fillLargeMeshArrays\` function if you require meshes with more than ${I1.MAX_VERTEX_ARRAY_LENGTH} vertices.`),this._forceNewSegmentOnNextPrepare||!a||a.vertexLength+l>I1.MAX_VERTEX_ARRAY_LENGTH||a.sortKey!==d?this.createNewSegment(c,p,d):a}createNewSegment(l,c,p){let d={vertexOffset:l.length,primitiveOffset:c.length,vertexLength:0,primitiveLength:0,vaos:{}};return p!==void 0&&(d.sortKey=p),this._forceNewSegmentOnNextPrepare=!1,this.segments.push(d),d}getOrCreateLatestSegment(l,c,p){return this.prepareSegment(0,l,c,p)}forceNewSegmentOnNextPrepare(){this._forceNewSegmentOnNextPrepare=!0}get(){return this.segments}destroy(){for(let l of this.segments)for(let c in l.vaos)l.vaos[c].destroy()}static simpleSegment(l,c,p,d){return new I1([{vertexOffset:l,primitiveOffset:c,vertexLength:p,primitiveLength:d,vaos:{},sortKey:0}])}}function i1(l,c){return 256*(l=G0(Math.floor(l),0,255))+G0(Math.floor(c),0,255)}I1.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,z1("SegmentVector",I1);let Jl=Pl([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]),Xl=Pl([{name:"a_dasharray_from",components:4,type:"Uint16"},{name:"a_dasharray_to",components:4,type:"Uint16"}]);var Dl,r0,B0,Ml={exports:{}},P2={exports:{}},v0={exports:{}},K0=function(){if(B0)return Ml.exports;B0=1;var l=(Dl||(Dl=1,P2.exports=function(p,d){var a,h,y,w,A,k,W,n;for(h=p.length-(a=3&p.length),y=d,A=3432918353,k=461845907,n=0;n<h;)W=255&p.charCodeAt(n)|(255&p.charCodeAt(++n))<<8|(255&p.charCodeAt(++n))<<16|(255&p.charCodeAt(++n))<>>16)*A&65535)<<16)&4294967295)<>>17))*k+(((W>>>16)*k&65535)<<16)&4294967295)<>>19))+((5*(y>>>16)&65535)<>>16)&65535)<<16);switch(W=0,a){case 3:W^=(255&p.charCodeAt(n+2))<<16;case 2:W^=(255&p.charCodeAt(n+1))<>>16)*A&65535)<<16)&4294967295)<>>17))*k+(((W>>>16)*k&65535)<>>16))+((2246822507*(y>>>16)&65535)<>>13))+((3266489909*(y>>>16)&65535)<>>16)>>>0}),P2.exports),c=(r0||(r0=1,v0.exports=function(p,d){for(var a,h=p.length,y=d^h,w=0;h>=4;)a=1540483477*(65535&(a=255&p.charCodeAt(w)|(255&p.charCodeAt(++w))<<8|(255&p.charCodeAt(++w))<<16|(255&p.charCodeAt(++w))<>>16)&65535)<>>16)&65535)<>>24))+((1540483477*(a>>>16)&65535)<<16)),h-=4,++w;switch(h){case 3:y^=(255&p.charCodeAt(w+2))<<16;case 2:y^=(255&p.charCodeAt(w+1))<>>16)&65535)<>>13))+((1540483477*(y>>>16)&65535)<>>15)>>>0}),v0.exports);return Ml.exports=l,Ml.exports.murmur3=l,Ml.exports.murmur2=c,Ml.exports}(),U0=b(K0);class du{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(l,c,p,d){this.ids.push(_5(l)),this.positions.push(c,p,d)}getPositions(l){if(!this.indexed)throw Error("Trying to get index, but feature positions are not indexed");let c=_5(l),p=0,d=this.ids.length-1;for(;p>1;this.ids[h]>=c?d=h:p=h+1}let a=[];for(;this.ids[p]===c;)a.push({index:this.positions[3*p],start:this.positions[3*p+1],end:this.positions[3*p+2]}),p++;return a}static serialize(l,c){let p=new Float64Array(l.ids),d=new Uint32Array(l.positions);return i5(p,d,0,p.length-1),c&&c.push(p.buffer,d.buffer),{ids:p,positions:d}}static deserialize(l){let c=new du;return c.ids=l.ids,c.positions=l.positions,c.indexed=!0,c}}function _5(l){let c=+l;return!isNaN(c)&&c<=Number.MAX_SAFE_INTEGER?c:U0(String(l))}function i5(l,c,p,d){for(;p>1],h=p-1,y=d+1;for(;;){do h++;while(l[h]a);if(h>=y)break;mu(l,h,y),mu(c,3*h,3*y),mu(c,3*h+1,3*y+1),mu(c,3*h+2,3*y+2)}y-p`u_${d}`),this.type=p}setUniform(l,c,p){l.set(p.constantOr(this.value))}getBinding(l,c,p){return this.type==="color"?new M2(l,c):new gu(l,c)}}class zl{constructor(l,c){this.uniformNames=c.map((p)=>`u_${p}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(l,c){this.pixelRatioFrom=c.pixelRatio,this.pixelRatioTo=l.pixelRatio,this.patternFrom=c.tlbr,this.patternTo=l.tlbr}setConstantDashPositions(l,c){this.dashTo=[0,l.y,l.height,l.width],this.dashFrom=[0,c.y,c.height,c.width]}setUniform(l,c,p,d){let a=null;d==="u_pattern_to"?a=this.patternTo:d==="u_pattern_from"?a=this.patternFrom:d==="u_dasharray_to"?a=this.dashTo:d==="u_dasharray_from"?a=this.dashFrom:d==="u_pixel_ratio_to"?a=this.pixelRatioTo:d==="u_pixel_ratio_from"&&(a=this.pixelRatioFrom),a!==null&&l.set(a)}getBinding(l,c,p){return p.startsWith("u_pattern")||p.startsWith("u_dasharray_")?new g5(l,c):new gu(l,c)}}class Rl{constructor(l,c,p,d){this.expression=l,this.type=p,this.maxValue=0,this.paintVertexAttributes=c.map((a)=>({name:`a_${a}`,type:"Float32",components:p==="color"?2:1,offset:0})),this.paintVertexArray=new d}populatePaintArray(l,c,p){let d=this.paintVertexArray.length,a=this.expression.evaluate(new Nl(0,p),c,{},p.canonical,[],p.formattedSection);this.paintVertexArray.resize(l),this._setPaintValue(d,l,a)}updatePaintArray(l,c,p,d,a){let h=this.expression.evaluate(new Nl(0,a),p,d);this._setPaintValue(l,c,h)}_setPaintValue(l,c,p){if(this.type==="color"){let d=a5(p);for(let a=l;a<c;a++)this.paintVertexArray.emplace(a,d[0],d[1])}else{for(let d=l;d`u_${y}_t`),this.type=p,this.useIntegerZoom=d,this.zoom=a,this.maxValue=0,this.paintVertexAttributes=c.map((y)=>({name:`a_${y}`,type:"Float32",components:p==="color"?4:2,offset:0})),this.paintVertexArray=new h}populatePaintArray(l,c,p){let d=this.expression.evaluate(new Nl(this.zoom,p),c,{},p.canonical,[],p.formattedSection),a=this.expression.evaluate(new Nl(this.zoom+1,p),c,{},p.canonical,[],p.formattedSection),h=this.paintVertexArray.length;this.paintVertexArray.resize(l),this._setPaintValue(h,l,d,a)}updatePaintArray(l,c,p,d,a){let h=this.expression.evaluate(new Nl(this.zoom,a),p,d),y=this.expression.evaluate(new Nl(this.zoom+1,a),p,d);this._setPaintValue(l,c,h,y)}_setPaintValue(l,c,p,d){if(this.type==="color"){let a=a5(p),h=a5(d);for(let y=l;y<c;y++)this.paintVertexArray.emplace(y,a[0],a[1],h[0],h[1])}else{for(let a=l;a<c;a++)this.paintVertexArray.emplace(a,p,d);this.maxValue=Math.max(this.maxValue,Math.abs(p),Math.abs(d))}}upload(l){var c,p;((c=this.paintVertexArray)===null||c===void 0?void 0:c.arrayBuffer.byteLength)&&(((p=this.paintVertexBuffer)===null||p===void 0?void 0:p.buffer)?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=l.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(l,c){let p=this.useIntegerZoom?Math.floor(c.zoom):c.zoom,d=G0(this.expression.interpolationFactor(p,this.zoom,this.zoom+1),0,1);l.set(d)}getBinding(l,c,p){return new gu(l,c)}}class Bl{constructor(l,c,p,d,a,h){this.expression=l,this.type=c,this.useIntegerZoom=p,this.zoom=d,this.layerId=h,this.zoomInPaintVertexArray=new a,this.zoomOutPaintVertexArray=new a}populatePaintArray(l,c,p){let d=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(l),this.zoomOutPaintVertexArray.resize(l),this._setPaintValues(d,l,this.getPositionIds(c),p)}updatePaintArray(l,c,p,d,a){this._setPaintValues(l,c,this.getPositionIds(p),a)}_setPaintValues(l,c,p,d){let a=this.getPositions(d);if(!a||!p)return;let h=a[p.min],y=a[p.mid],w=a[p.max];if(h&&y&&w)for(let A=l;A`#define HAS_UNIFORM_${d}`))}return l}getBinderAttributes(){let l=[];for(let c in this.binders){let p=this.binders[c];if(p instanceof Rl||p instanceof Ol)for(let d of p.paintVertexAttributes)l.push(d.name);else if(p instanceof Bl){let d=p.getVertexAttributes();for(let a of d)l.push(a.name)}}return l}getBinderUniforms(){let l=[];for(let c in this.binders){let p=this.binders[c];if(p instanceof B2||p instanceof zl||p instanceof Ol)for(let d of p.uniformNames)l.push(d)}return l}getPaintVertexBuffers(){return this._buffers}getUniforms(l,c){let p=[];for(let d in this.binders){let a=this.binders[d];if(a instanceof B2||a instanceof zl||a instanceof Ol){for(let h of a.uniformNames)if(c[h]){let y=a.getBinding(l,c[h],h);p.push({name:h,property:d,binding:y})}}}return p}setUniforms(l,c,p,d){for(let{name:a,property:h,binding:y}of c)this.binders[h].setUniform(y,d,p.get(h),a)}updatePaintBuffers(l){this._buffers=[];for(let c in this.binders){let p=this.binders[c];if(l&&p instanceof Bl){let d=l.fromScale===2?p.zoomInPaintVertexBuffer:p.zoomOutPaintVertexBuffer;d&&this._buffers.push(d)}else(p instanceof Rl||p instanceof Ol)&&p.paintVertexBuffer&&this._buffers.push(p.paintVertexBuffer)}}upload(l){for(let c in this.binders){let p=this.binders[c];(p instanceof Rl||p instanceof Ol||p instanceof Bl)&&p.upload(l)}this.updatePaintBuffers()}destroy(){for(let l in this.binders){let c=this.binders[l];(c instanceof Rl||c instanceof Ol||c instanceof Bl)&&c.destroy()}}}class au{constructor(l,c,p=()=>!0){this.programConfigurations={};for(let d of l)this.programConfigurations[d.id]=new kc(d,c,p);this.needsUpload=!1,this._featureMap=new du,this._bufferOffset=0}populatePaintArrays(l,c,p,d){for(let a in this.programConfigurations)this.programConfigurations[a].populatePaintArrays(l,c,d);c.id!==void 0&&this._featureMap.add(c.id,p,this._bufferOffset,l),this._bufferOffset=l,this.needsUpload=!0}updatePaintArrays(l,c,p,d){for(let a of p)this.needsUpload=this.programConfigurations[a.id].updatePaintArrays(l,this._featureMap,c,a,d)||this.needsUpload}get(l){return this.programConfigurations[l]}upload(l){if(this.needsUpload){for(let c in this.programConfigurations)this.programConfigurations[c].upload(l);this.needsUpload=!1}}destroy(){for(let l in this.programConfigurations)this.programConfigurations[l].destroy()}}function T7(l,c){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-dasharray":["dasharray_to","dasharray_from"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[l]||[l.replace(`${c}-`,"").replace(/-/g,"_")]}function u9(l,c,p){let d={color:{source:Z5,composite:m},number:{source:sc,composite:Z5}},a=function(h){return{"line-pattern":{source:u1,composite:u1},"fill-pattern":{source:u1,composite:u1},"fill-extrusion-pattern":{source:u1,composite:u1},"line-dasharray":{source:T,composite:T}}[h]}(l);return(a==null?void 0:a[p])||d[c][p]}z1("ConstantBinder",B2),z1("CrossFadedConstantBinder",zl),z1("SourceExpressionBinder",Rl),z1("CrossFadedPatternBinder",vu),z1("CrossFadedDasharrayBinder",o5),z1("CompositeExpressionBinder",Ol),z1("ProgramConfiguration",kc,{omit:["_buffers"]}),z1("ProgramConfigurationSet",au);let Pu=Math.pow(2,14)-1,Z7=-Pu-1;function h5(l){let c=ll/l.extent,p=l.loadGeometry();for(let d of p)for(let a of d){let h=Math.round(a.x*c),y=Math.round(a.y*c);a.x=G0(h,Z7,Pu),a.y=G0(y,Z7,Pu),(ha.x+1||ya.y+1)&&w0("Geometry exceeds allowed extent, reduce your vector tile buffer size")}return p}function y5(l,c){return{type:l.type,id:l.id,properties:l.properties,geometry:c?h5(l):[]}}let Ir=-32768;function c9(l,c,p,d,a){l.emplaceBack(Ir+8*c+d,Ir+8*p+a)}class $3{constructor(l){this.zoom=l.zoom,this.overscaling=l.overscaling,this.layers=l.layers,this.layerIds=this.layers.map((c)=>c.id),this.index=l.index,this.hasDependencies=!1,this.layoutVertexArray=new i,this.indexArray=new Q1,this.segments=new I1,this.programConfigurations=new au(l.layers,l.zoom),this.stateDependentLayerIds=this.layers.filter((c)=>c.isStateDependent()).map((c)=>c.id)}populate(l,c,p){let d=this.layers[0],a=[],h=null,y=!1,w=d.type==="heatmap";if(d.type==="circle"){let k=d;h=k.layout.get("circle-sort-key"),y=!h.isConstant(),w||(w=k.paint.get("circle-pitch-alignment")==="map")}let A=w?c.subdivisionGranularity.circle:1;for(let{feature:k,id:W,index:n,sourceLayerIndex:q}of l){let C=this.layers[0]._featureFilter.needGeometry,B=y5(k,C);if(!this.layers[0]._featureFilter.filter(new Nl(this.zoom),B,p))continue;let M=y?h.evaluate(B,{},p):void 0,D={id:W,properties:k.properties,type:k.type,sourceLayerIndex:q,index:n,geometry:C?B.geometry:h5(k),patterns:{},sortKey:M};a.push(D)}y&&a.sort((k,W)=>k.sortKey-W.sortKey);for(let k of a){let{geometry:W,index:n,sourceLayerIndex:q}=k,C=l[n].feature;this.addFeature(k,W,n,p,A),c.featureIndex.insert(C,W,n,q,this.index)}}update(l,c,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(l,c,this.stateDependentLayers,{imagePositions:p})}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(l){this.uploaded||(this.layoutVertexBuffer=l.createVertexBuffer(this.layoutVertexArray,O1),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())}addFeature(l,c,p,d,a=1){let h;switch(a){case 1:h=[0,7];break;case 3:h=[0,2,5,7];break;case 5:h=[0,1,3,4,6,7];break;case 7:h=[0,1,2,3,4,5,6,7];break;default:throw Error(`Invalid circle bucket granularity: ${a}; valid values are 1, 3, 5, 7.`)}let y=h.length;for(let w of c)for(let A of w){let{x:k,y:W}=A;if(k=ll||W=ll)continue;let n=this.segments.prepareSegment(y*y,this.layoutVertexArray,this.indexArray,l.sortKey),q=n.vertexLength;for(let C=0;C<y;C++)for(let B=0;B<y;B++)c9(this.layoutVertexArray,k,W,h[B],h[C]);for(let C=0;C<y-1;C++)for(let B=0;B1){if(Ed(l,c))return!0;for(let d of c)if(nd(d,l,p))return!0}for(let d of l)if(nd(d,c,p))return!0;return!1}function Ed(l,c){if(l.length===0||c.length===0)return!1;for(let p=0;p<l.length-1;p++){let d=l[p],a=l[p+1];for(let h=0;h<c.length-1;h++)if(NS(d,a,c[h],c[h+1]))return!0}return!1}function NS(l,c,p,d){return u0(l,p,d)!==u0(c,p,d)&&u0(l,c,p)!==u0(l,c,d)}function nd(l,c,p){let d=p*p;if(c.length===1)return l.distSqr(c[0])<d;for(let a=1;a<c.length;a++)if(ga(l,c[a-1],c[a])<d)return!0;return!1}function ga(l,c,p){let d=c.distSqr(p);if(d===0)return l.distSqr(c);let a=((l.x-c.x)*(p.x-c.x)+(l.y-c.y)*(p.y-c.y))/d;return l.distSqr(a1?p:p.sub(c)._mult(a)._add(c))}function va(l,c){let p,d,a,h=!1;for(let y of l){p=y;for(let w=0,A=p.length-1;w c.y!=a.y>c.y&&c.x<(a.x-d.x)*(c.y-d.y)/(a.y-d.y)+d.x&&(h=!h)}return h}function Yr(l,c){let p=!1;for(let d=0,a=l.length-1;dc.y!=y.y>c.y&&c.x<(y.x-h.x)*(c.y-h.y)/(y.y-h.y)+h.x&&(p=!p)}return p}function FS(l,c,p){let d=p[0],a=p[2];if(l.x<d.x&&c.xa.x&&c.x>a.x||l.y<d.y&&c.ya.y&&c.y>a.y)return!1;let h=u0(l,c,p[0]);return h!==u0(l,c,p[1])||h!==u0(l,c,p[2])||h!==u0(l,c,p[3])}function zr(l,c,p){let d=c.paint.get(l).value;return d.kind==="constant"?d.value:p.programConfigurations.get(c.id).getMaxValue(l)}function p9(l){return Math.sqrt(l[0]*l[0]+l[1]*l[1])}function f9(l,c,p,d,a){if(!c[0]&&!c[1])return l;let h=H.convert(c)._mult(a);p==="viewport"&&h._rotate(-d);let y=[];for(let w of l)y.push(w.sub(h));return y}function qS(l){let c=[];for(let p=0;pAd(O,M,D,I))}(A,a,y,w),C=k),aa({queryGeometry:q,size:C,transform:a,unwrappedTileID:y,getElevation:w,pitchAlignment:n,pitchScale:W},d)}}class Vd extends $3{}let wa;z1("HeatmapBucket",Vd,{omit:["layers"]});var DS={get paint(){return wa=wa||new C0({"heatmap-radius":new $1(E1.paint_heatmap["heatmap-radius"]),"heatmap-weight":new $1(E1.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new T1(E1.paint_heatmap["heatmap-intensity"]),"heatmap-color":new X5(E1.paint_heatmap["heatmap-color"]),"heatmap-opacity":new T1(E1.paint_heatmap["heatmap-opacity"])})}};function Wd(l,{width:c,height:p},d,a){if(a){if(a instanceof Uint8ClampedArray)a=new Uint8Array(a.buffer);else if(a.length!==c*p*d)throw RangeError(`mismatched image size. expected: ${a.length} but got: ${c*p*d}`)}else a=new Uint8Array(c*p*d);return l.width=c,l.height=p,l.data=a,l}function sa(l,{width:c,height:p},d){if(c===l.width&&p===l.height)return;let a=Wd({},{width:c,height:p},d);Ld(l,a,{x:0,y:0},{x:0,y:0},{width:Math.min(l.width,c),height:Math.min(l.height,p)},d),l.width=c,l.height=p,l.data=a.data}function Ld(l,c,p,d,a,h){if(a.width===0||a.height===0)return c;if(a.width>l.width||a.height>l.height||p.x>l.width-a.width||p.y>l.height-a.height)throw RangeError("out of range source coordinates for image copy");if(a.width>c.width||a.height>c.height||d.x>c.width-a.width||d.y>c.height-a.height)throw RangeError("out of range destination coordinates for image copy");let y=l.data,w=c.data;if(y===w)throw Error("srcData equals dstData, so image is already copied");for(let A=0;A<a.height;A++){let k=((p.y+A)*l.width+p.x)*h,W=((d.y+A)*c.width+d.x)*h;for(let n=0;n<a.width*h;n++)w[W+n]=y[k+n]}return c}class b7{constructor(l,c){Wd(this,l,1,c)}resize(l){sa(this,l,1)}clone(){return new b7({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(l,c,p,d,a){Ld(l,c,p,d,a,1)}}class n2{constructor(l,c){Wd(this,l,4,c)}resize(l){sa(this,l,4)}replace(l,c){c?this.data.set(l):this.data=l instanceof Uint8ClampedArray?new Uint8Array(l.buffer):l}clone(){return new n2({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(l,c,p,d,a){Ld(l,c,p,d,a,4)}setPixel(l,c,p){let d=4*(l*this.width+c);this.data[d+0]=Math.round(255*p.r/p.a),this.data[d+1]=Math.round(255*p.g/p.a),this.data[d+2]=Math.round(255*p.b/p.a),this.data[d+3]=Math.round(255*p.a)}}function Sa(l){let c=new Uint8Array(l.length);for(let p=0;p{c[l.evaluationKey]=A;let k=l.expression.evaluate(c);a.setPixel(y/4/p,w/4,k)};if(l.clips)for(let y=0,w=0;y<d;++y,w+=4*p)for(let A=0,k=0;A<p;A++,k+=4){let W=A/(p-1),{start:n,end:q}=l.clips[y];h(w,k,n*(1-W)+q*W)}else for(let y=0,w=0;y<p;y++,w+=4)h(0,w,y/(p-1));return a}z1("AlphaImage",b7),z1("RGBAImage",n2);let Cd="big-fb";class Ea extends r2{createBucket(l){return new Vd(l)}constructor(l,c){super(l,DS,c),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(l){l==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=ka({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has(Cd)&&this.heatmapFbos.delete(Cd)}queryRadius(l){return zr("heatmap-radius",this,l)}queryIntersectsFeature({queryGeometry:l,feature:c,featureState:p,geometry:d,transform:a,pixelsToTileUnits:h,unwrappedTileID:y,getElevation:w}){return aa({queryGeometry:l,size:this.paint.get("heatmap-radius").evaluate(c,p)*h,transform:a,unwrappedTileID:y,getElevation:w},d)}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&!this.isHidden()}}let na;var RS={get paint(){return na=na||new C0({"hillshade-illumination-direction":new T1(E1.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-altitude":new T1(E1.paint_hillshade["hillshade-illumination-altitude"]),"hillshade-illumination-anchor":new T1(E1.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new T1(E1.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new T1(E1.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new T1(E1.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new T1(E1.paint_hillshade["hillshade-accent-color"]),"hillshade-method":new T1(E1.paint_hillshade["hillshade-method"]),resampling:new T1(E1.paint_hillshade.resampling)})}};class Aa extends r2{constructor(l,c){super(l,RS,c),this.recalculate({zoom:0,zoomHistory:{}},void 0)}getIlluminationProperties(){let l=this.paint.get("hillshade-illumination-direction").values,c=this.paint.get("hillshade-illumination-altitude").values,p=this.paint.get("hillshade-highlight-color").values,d=this.paint.get("hillshade-shadow-color").values,a=Math.max(l.length,c.length,p.length,d.length);l=l.concat(Array(a-l.length).fill(l.at(-1))),c=c.concat(Array(a-c.length).fill(c.at(-1))),p=p.concat(Array(a-p.length).fill(p.at(-1))),d=d.concat(Array(a-d.length).fill(d.at(-1)));let h=c.map(Wu);return{directionRadians:l.map(Wu),altitudeRadians:h,shadowColor:d,highlightColor:p}}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&!this.isHidden()}}let Va;var HS={get paint(){return Va=Va||new C0({"color-relief-opacity":new T1(E1["paint_color-relief"]["color-relief-opacity"]),"color-relief-color":new X5(E1["paint_color-relief"]["color-relief-color"]),resampling:new T1(E1["paint_color-relief"].resampling)})}};function Wa(l){return"data"in l}class d9{constructor(l,c,p,d){this.context=l,this.format=p,this.texture=l.gl.createTexture(),this._ownedHandle=this.texture,this.update(c,d)}update(l,c,p){var d;let{width:a,height:h}=l,y=(((d=this.size)===null||d===void 0?void 0:d[0])!==a||this.size[1]!==h)&&!p,{context:w}=this,{gl:A}=w;this.useMipmap=Boolean(c==null?void 0:c.useMipmap),A.bindTexture(A.TEXTURE_2D,this.texture),w.pixelStoreUnpackFlipY.set(!1),w.pixelStoreUnpack.set(1);let k=this.format===A.RGBA&&(c==null?void 0:c.premultiply)!==!1;if(y)this.size=[a,h],Wa(l)?(w.pixelStoreUnpackPremultiplyAlpha.set(!1),this._uploadRawData(l,k,a,h,A)):(w.pixelStoreUnpackPremultiplyAlpha.set(k),this._uploadDomImage(l,A));else{let{x:W,y:n}=p||{x:0,y:0};Wa(l)?(w.pixelStoreUnpackPremultiplyAlpha.set(!1),this._updateRawData(l,k,W,n,a,h,A)):(w.pixelStoreUnpackPremultiplyAlpha.set(k),this._updateDomImage(l,W,n,A))}this.useMipmap&&this.isSizePowerOfTwo()&&A.generateMipmap(A.TEXTURE_2D),w.pixelStoreUnpackFlipY.setDefault(),w.pixelStoreUnpack.setDefault(),w.pixelStoreUnpackPremultiplyAlpha.setDefault()}_uploadDomImage(l,c){c.texImage2D(c.TEXTURE_2D,0,this.format,this.format,c.UNSIGNED_BYTE,l)}_uploadRawData(l,c,p,d,a){let{data:h}=l;c&&h&&(h=Sa(h)),a.texImage2D(a.TEXTURE_2D,0,this.format,p,d,0,this.format,a.UNSIGNED_BYTE,h)}_updateDomImage(l,c,p,d){d.texSubImage2D(d.TEXTURE_2D,0,c,p,d.RGBA,d.UNSIGNED_BYTE,l)}_updateRawData(l,c,p,d,a,h,y){let{data:w}=l;c&&w&&(w=Sa(w)),y.texSubImage2D(y.TEXTURE_2D,0,p,d,a,h,y.RGBA,y.UNSIGNED_BYTE,w)}bind(l,c,p){let{context:d}=this,{gl:a}=d;this.texture!==this._ownedHandle&&(this.texture=this._ownedHandle),a.bindTexture(a.TEXTURE_2D,this.texture),p!==a.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(p=a.LINEAR),l!==this.filter&&(a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,l),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,p||l),this.filter=l),c!==this.wrap&&(a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,c),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,c),this.wrap=c)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){let{gl:l}=this.context;l.deleteTexture(this.texture),this.texture=null,this._ownedHandle=null}}class xd{constructor(l,c,p,d=1,a=1,h=1,y=0){if(this.uid=l,c.height!==c.width)throw RangeError("DEM tiles must be square");if(p&&!["mapbox","terrarium","custom"].includes(p))return void w0(`"${p}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);this.stride=c.height;let w=this.dim=c.height-2;switch(this.data=new Uint32Array(c.data.buffer),p){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=0.00390625,this.baseShift=32768;break;case"custom":this.redFactor=d,this.greenFactor=a,this.blueFactor=h,this.baseShift=y;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=0.1,this.baseShift=1e4}for(let A=0;A<w;A++)this.data[this._idx(-1,A)]=this.data[this._idx(0,A)],this.data[this._idx(w,A)]=this.data[this._idx(w-1,A)],this.data[this._idx(A,-1)]=this.data[this._idx(A,0)],this.data[this._idx(A,w)]=this.data[this._idx(A,w-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(w,-1)]=this.data[this._idx(w-1,0)],this.data[this._idx(-1,w)]=this.data[this._idx(0,w-1)],this.data[this._idx(w,w)]=this.data[this._idx(w-1,w-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let A=0;A<w;A++)for(let k=0;kthis.max&&(this.max=W),W<this.min&&(this.min=W)}}get(l,c){let p=new Uint8Array(this.data.buffer),d=4*this._idx(l,c);return this.unpack(p[d],p[d+1],p[d+2])}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(l,c){if(l=this.dim+1||c=this.dim+1)throw RangeError(`Out of range source coordinates for DEM data. x: ${l}, y: ${c}, dim: ${this.dim}`);return(c+1)*this.stride+(l+1)}unpack(l,c,p){return l*this.redFactor+c*this.greenFactor+p*this.blueFactor-this.baseShift}pack(l){return La(l,this.getUnpackVector())}getPixels(){return new n2({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(l,c,p){if(this.dim!==l.dim)throw Error("dem dimension mismatch");let d=c*this.dim,a=c*this.dim+this.dim,h=p*this.dim,y=p*this.dim+this.dim;switch(c){case-1:d=a-1;break;case 1:a=d+1}switch(p){case-1:h=y-1;break;case 1:y=h+1}let w=-c*this.dim,A=-p*this.dim;for(let k=h;k<y;k++)for(let W=d;W<a;W++)this.data[this._idx(W,k)]=l.data[this._idx(W+w,k+A)]}}function La(l,c){let p=c[0],d=c[1],a=c[2],h=c[3],y=Math.min(p,d,a),w=Math.round((l+h)/y);return{r:Math.floor(w*y/p)%256,g:Math.floor(w*y/d)%256,b:Math.floor(w*y/a)%256}}z1("DEMData",xd);class Ca extends r2{constructor(l,c){super(l,HS,c)}_createColorRamp(l){let c={elevationStops:[],colorStops:[]},p=this._transitionablePaint._values["color-relief-color"].value.expression;if(p instanceof H3&&p._styleExpression.expression instanceof c0){this.colorRampExpression=p;let h=p._styleExpression.expression;c.elevationStops=h.labels,c.colorStops=[];for(let y of c.elevationStops)c.colorStops.push(h.evaluate({globals:{elevation:y}}))}if(c.elevationStops.length<1&&(c.elevationStops=[0],c.colorStops=[dl.transparent]),c.elevationStops.length<2&&(c.elevationStops.push(c.elevationStops[0]+1),c.colorStops.push(c.colorStops[0])),c.elevationStops.length<=l)return c;let d={elevationStops:[],colorStops:[]},a=(c.elevationStops.length-1)/(l-1);for(let h=0;h<c.elevationStops.length-0.5;h+=a)d.elevationStops.push(c.elevationStops[Math.round(h)]),d.colorStops.push(c.colorStops[Math.round(h)]);return w0(`Too many colors in specification of ${this.id} color-relief layer, may not render properly. Max possible colors: ${l}, provided: ${c.elevationStops.length}`),d}_colorRampChanged(){return this.colorRampExpression!=this._transitionablePaint._values["color-relief-color"].value.expression}getColorRampTextures(l,c,p){if(this.colorRampTextures&&!this._colorRampChanged())return this.colorRampTextures;let d=this._createColorRamp(c),a=new n2({width:d.colorStops.length,height:1}),h=new n2({width:d.colorStops.length,height:1});for(let y=0;y<d.elevationStops.length;y++){let w=La(d.elevationStops[y],p);h.setPixel(0,y,new dl(w.r/255,w.g/255,w.b/255,1)),a.setPixel(0,y,d.colorStops[y])}return this.colorRampTextures={elevationTexture:new d9(l,h,l.gl.RGBA),colorTexture:new d9(l,a,l.gl.RGBA)},this.colorRampTextures}hasOffscreenPass(){return!this.isHidden()&&!!this.colorRampTextures}}let IS=Pl([{name:"a_pos",components:2,type:"Int16"}],4),{members:YS}=IS;function m9(l,c,p){let d=p.patternDependencies,a=!1;for(let h of c){let y=h.paint.get(`${l}-pattern`);y.isConstant()||(a=!0);let w=y.constantOr(null);w&&(a=!0,d[w.to]=!0,d[w.from]=!0)}return a}function Nd(l,c,p,d,a){let{zoom:h}=d,y=a.patternDependencies;for(let w of c){let A=w.paint.get(`${l}-pattern`).value;if(A.kind!=="constant"){let k=A.evaluate({zoom:h-1},p,{},a.availableImages),W=A.evaluate({zoom:h},p,{},a.availableImages),n=A.evaluate({zoom:h+1},p,{},a.availableImages);k=(k==null?void 0:k.name)?k.name:k,W=(W==null?void 0:W.name)?W.name:W,n=(n==null?void 0:n.name)?n.name:n,y[k]=!0,y[W]=!0,y[n]=!0,p.patterns[w.id]={min:k,mid:W,max:n}}}return p}function xa(l,c,p,d,a){let h;if(a===function(y,w,A,k){let W=0;for(let n=w,q=A-k;n0)for(let y=c;y =c;y-=d)h=Pa(y/d|0,l[y],l[y+1],h);return h&&Or(h,h.next)&&(e7(h),h=h.next),h}function Ec(l,c){if(!l)return l;c||(c=l);let p,d=l;do if(p=!1,d.steiner||!Or(d,d.next)&&p0(d.prev,d,d.next)!==0)d=d.next;else{if(e7(d),d=c=d.prev,d===d.next)break;p=!0}while(p||d!==c);return c}function $7(l,c,p,d,a,h,y){if(!l)return;!y&&h&&function(A,k,W,n){let q=A;do q.z===0&&(q.z=Fd(q.x,q.y,k,W,n)),q.prevZ=q.prev,q.nextZ=q.next,q=q.next;while(q!==A);q.prevZ.nextZ=null,q.prevZ=null,function(C){let B,M=1;do{let D,I=C;C=null;let O=null;for(B=0;I;){B++;let Y=I,G=0;for(let Z=0;Z0||j>0&&Y;)G!==0&&(j===0||!Y||I.z1)}(q)}(l,d,a,h);let w=l;for(;l.prev!==l.next;){let{prev:A,next:k}=l;if(h?OS(l,d,a,h):zS(l))c.push(A.i,l.i,k.i),e7(l),l=k.next,w=k.next;else if((l=k)===w){y?y===1?$7(l=GS(Ec(l),c),c,p,d,a,h,2):y===2&&QS(l,c,p,d,a,h):$7(Ec(l),c,p,d,a,h,1);break}}}function zS(l){let c=l.prev,p=l,d=l.next;if(p0(c,p,d)>=0)return!1;let a=c.x,h=p.x,y=d.x,w=c.y,A=p.y,k=d.y,W=Math.min(a,h,y),n=Math.min(w,A,k),q=Math.max(a,h,y),C=Math.max(w,A,k),B=d.next;for(;B!==c;){if(B.x>=W&&B.x=n&&B.y=0)return!1;B=B.next}return!0}function OS(l,c,p,d){let a=l.prev,h=l,y=l.next;if(p0(a,h,y)>=0)return!1;let w=a.x,A=h.x,k=y.x,W=a.y,n=h.y,q=y.y,C=Math.min(w,A,k),B=Math.min(W,n,q),M=Math.max(w,A,k),D=Math.max(W,n,q),I=Fd(C,B,c,p,d),O=Fd(M,D,c,p,d),Y=l.prevZ,G=l.nextZ;for(;Y&&Y.z>=I&&G&&G.z=C&&Y.x=B&&Y.y=0)return!1;if(Y=Y.prevZ,G.x>=C&&G.x=B&&G.y=0)return!1;G=G.nextZ}for(;Y&&Y.z>=I;){if(Y.x>=C&&Y.x=B&&Y.y=0)return!1;Y=Y.prevZ}for(;G&&G.z=C&&G.x=B&&G.y=0)return!1;G=G.nextZ}return!0}function GS(l,c){let p=l;do{let d=p.prev,a=p.next.next;!Or(d,a)&&Fa(d,p,p.next,a)&&i7(d,a)&&i7(a,d)&&(c.push(d.i,p.i,a.i),e7(p),e7(p.next),p=l=a),p=p.next}while(p!==l);return Ec(p)}function QS(l,c,p,d,a,h){let y=l;do{let w=y.next.next;for(;w!==y.prev;){if(y.i!==w.i&&ZS(y,w)){let A=qa(y,w);return y=Ec(y,y.next),A=Ec(A,A.next),$7(y,c,p,d,a,h,0),void $7(A,c,p,d,a,h,0)}w=w.next}y=y.next}while(y!==l)}function jS(l,c){let p=l.x-c.x;return p===0&&(p=l.y-c.y,p===0)&&(p=(l.next.y-l.y)/(l.next.x-l.x)-(c.next.y-c.y)/(c.next.x-c.x)),p}function JS(l,c){let p=function(a,h){let y=h,w=a.x,A=a.y,k,W=-1/0;if(Or(a,y))return y;do{if(Or(a,y.next))return y.next;if(A=y.next.y&&y.next.y!==y.y){let M=y.x+(A-y.y)*(y.next.x-y.x)/(y.next.y-y.y);if(MW&&(W=M,k=y.x=y.x&&y.x>=q&&w!==y.x&&Na(A<C?w:W,A,q,C,A<C?W:w,A,y.x,y.y)){let M=Math.abs(A-y.y)/(w-y.x);i7(y,a)&&(Mk.x||y.x===k.x&&XS(k,y)))&&(k=y,B=M)}y=y.next}while(y!==n);return k}(l,c);if(!p)return c;let d=qa(p,l);return Ec(d,d.next),Ec(p,p.next)}function XS(l,c){return p0(l.prev,l,c.prev)<0&&p0(c.next,l,l.next)<0}function Fd(l,c,p,d,a){return(l=1431655765&((l=858993459&((l=252645135&((l=16711935&((l=(l-p)*a|0)|l<<8))|l<<4))|l<<2))|l<<1))|(c=1431655765&((c=858993459&((c=252645135&((c=16711935&((c=(c-d)*a|0)|c<<8))|c<<4))|c<<2))|c<<1))<<1}function TS(l){let c=l,p=l;do(c.x<p.x||c.x===p.x&&c.y =(l-y)*(h-w)&&(l-y)*(d-w)>=(p-y)*(c-w)&&(p-y)*(h-w)>=(a-y)*(d-w)}function _7(l,c,p,d,a,h,y,w){return!(l===y&&c===w)&&Na(l,c,p,d,a,h,y,w)}function ZS(l,c){return l.next.i!==c.i&&l.prev.i!==c.i&&!function(p,d){let a=p;do{if(a.i!==p.i&&a.next.i!==p.i&&a.i!==d.i&&a.next.i!==d.i&&Fa(a,a.next,p,d))return!0;a=a.next}while(a!==p);return!1}(l,c)&&(i7(l,c)&&i7(c,l)&&function(p,d){let a=p,h=!1,y=(p.x+d.x)/2,w=(p.y+d.y)/2;do a.y>w!=a.next.y>w&&a.next.y!==a.y&&y0&&p0(c.prev,c,c.next)>0)}function p0(l,c,p){return(c.y-l.y)*(p.x-c.x)-(c.x-l.x)*(p.y-c.y)}function Or(l,c){return l.x===c.x&&l.y===c.y}function Fa(l,c,p,d){let a=v9(p0(l,c,p)),h=v9(p0(l,c,d)),y=v9(p0(p,d,l)),w=v9(p0(p,d,c));return a!==h&&y!==w||!(a!==0||!g9(l,p,c))||!(h!==0||!g9(l,d,c))||!(y!==0||!g9(p,l,d))||!(w!==0||!g9(p,c,d))}function g9(l,c,p){return c.x=Math.min(l.x,p.x)&&c.y=Math.min(l.y,p.y)}function v9(l){return l>0?1:l<0?-1:0}function i7(l,c){return p0(l.prev,l,l.next)=0&&p0(l,l.prev,c)>=0:p0(l,c,l.prev)<0||p0(l,l.next,c)l)throw Error("Min granularity must not be greater than base granularity.");this._baseZoomGranularity=l,this._minGranularity=c}getGranularityForZoomLevel(l){return Math.max(Math.floor(this._baseZoomGranularity/(1<<l)),this._minGranularity,1)}}class t7{constructor(l){this.fill=l.fill,this.line=l.line,this.tile=l.tile,this.stencil=l.stencil,this.circle=l.circle}}t7.noSubdivision=new t7({fill:new nc(0,0),line:new nc(0,0),tile:new nc(0,0),stencil:new nc(0,0),circle:1}),z1("SubdivisionGranularityExpression",nc),z1("SubdivisionGranularitySetting",t7);let Gr=-32768,l8=32767;class Ma{constructor(l,c){this._vertexBuffer=[],this._vertexDictionary=new Map,this._used=!1,this._granularity=l,this._granularityCellSize=ll/l,this._canonical=c}_getKey(l,c){return(l+=32768)<<16|c+32768}_vertexToIndex(l,c){if(l<-32768||c32767||c>32767)throw Error("Vertex coordinates are out of signed 16 bit integer range.");let p=0|Math.round(l),d=0|Math.round(c),a=this._getKey(p,d);if(this._vertexDictionary.has(a))return this._vertexDictionary.get(a);let h=this._vertexBuffer.length/2;return this._vertexDictionary.set(a,h),this._vertexBuffer.push(p,d),h}_subdivideTrianglesScanline(l){if(this._granularity<2)return function(d,a){let h=[];for(let y=0;y0?(h.push(w),h.push(k),h.push(A)):(h.push(w),h.push(A),h.push(k))}return h}(this._vertexBuffer,l);let c=[],p=l.length;for(let d=0;d<p;d+=3){let a=[l[d+0],l[d+1],l[d+2]],h=[this._vertexBuffer[2*l[d+0]+0],this._vertexBuffer[2*l[d+0]+1],this._vertexBuffer[2*l[d+1]+0],this._vertexBuffer[2*l[d+1]+1],this._vertexBuffer[2*l[d+2]+0],this._vertexBuffer[2*l[d+2]+1]],y=1/0,w=1/0,A=-1/0,k=-1/0;for(let B=0;B<3;B++){let M=h[2*B],D=h[2*B+1];y=Math.min(y,M),A=Math.max(A,M),w=Math.min(w,D),k=Math.max(k,D)}if(y===A||w===k)continue;let W=Math.floor(y/this._granularityCellSize),n=Math.ceil(A/this._granularityCellSize),q=Math.floor(w/this._granularityCellSize),C=Math.ceil(k/this._granularityCellSize);if(W!==n||q!==C)for(let B=q;B<C;B++){let M=this._scanlineGenerateVertexRingForCellRow(B,h,a);bS(this._vertexBuffer,M,c)}else c.push(...a)}return c}_scanlineGenerateVertexRingForCellRow(l,c,p){let d=l*this._granularityCellSize,a=d+this._granularityCellSize,h=[];for(let y=0;y=1||G<=0)||D&&(Aa)){W>=d&&W0&&h.push(this._vertexToIndex(w+C*Y,A+B*Y));let j=w+C*Math.max(Y,0),Z=w+C*Math.min(G,1);M||this._generateIntraEdgeVertices(h,w,A,k,W,j,Z),!D&&G=d&&W<=a)&&h.push(p[(y+1)%3]),!D&&(W=a)&&this._generateInterEdgeVertices(h,w,A,k,W,n,q,Z,d,a)}return h}_generateIntraEdgeVertices(l,c,p,d,a,h,y){let w=d-c,A=a-p,k=A===0,W=k?Math.min(c,d):Math.min(h,y),n=k?Math.max(c,d):Math.max(h,y),q=Math.floor(W/this._granularityCellSize)+1,C=Math.ceil(n/this._granularityCellSize)-1;if(k?c<d:h<y)for(let B=q;B=q;B--){let M=B*this._granularityCellSize;l.push(this._vertexToIndex(M,p+A*(M-c)/w))}}_generateInterEdgeVertices(l,c,p,d,a,h,y,w,A,k){let W=a-p,n=h-d,q=y-a,C=(A-a)/q,B=(k-a)/q,M=Math.min(C,B),D=Math.max(C,B),I=d+n*M,O=Math.floor(Math.min(I,w)/this._granularityCellSize)+1,Y=Math.ceil(Math.max(I,w)/this._granularityCellSize)-1,G=w=1||D<=0){let d1=p-y,m1=h+(c-h)*Math.min((A-y)/d1,(k-y)/d1);O=Math.floor(Math.min(m1,w)/this._granularityCellSize)+1,Y=Math.ceil(Math.max(m1,w)/this._granularityCellSize)-1,G=w0?k:A;if(G)for(let d1=O;d1=O;d1--)l.push(this._vertexToIndex(d1*this._granularityCellSize,Z))}_generateOutline(l){let c=[];for(let p of l){let d=Ac(p,this._granularity,!0),a=this._pointArrayToIndices(d),h=[];for(let y=1;y<a.length;y++)h.push(a[y-1]),h.push(a[y]);c.push(h)}return c}_handlePoles(l){let c=!1,p=!1;this._canonical&&(this._canonical.y===0&&(c=!0),this._canonical.y===(1<<this._canonical.z)-1&&(p=!0)),(c||p)&&this._fillPoles(l,c,p)}_ensureNoPoleVertices(){let l=this._vertexBuffer;for(let c=0;ca!=(h===Gr)?(l.push(c),l.push(p),l.push(this._vertexToIndex(d,h)),l.push(p),l.push(this._vertexToIndex(a,h)),l.push(this._vertexToIndex(d,h))):(l.push(p),l.push(c),l.push(this._vertexToIndex(d,h)),l.push(this._vertexToIndex(a,h)),l.push(p),l.push(this._vertexToIndex(d,h)))}_fillPoles(l,c,p){let d=this._vertexBuffer,a=ll,h=l.length;for(let y=2;y<h;y+=3){let w=l[y-2],A=l[y-1],k=l[y],W=d[2*w],n=d[2*w+1],q=d[2*A],C=d[2*A+1],B=d[2*k],M=d[2*k+1];c&&(n===0&&C===0&&this._generatePoleQuad(l,w,A,W,q,Gr),C===0&&M===0&&this._generatePoleQuad(l,A,k,q,B,Gr),M===0&&n===0&&this._generatePoleQuad(l,k,w,B,W,Gr)),p&&(n===a&&C===a&&this._generatePoleQuad(l,w,A,W,q,l8),C===a&&M===a&&this._generatePoleQuad(l,A,k,q,B,l8),M===a&&n===a&&this._generatePoleQuad(l,k,w,B,W,l8))}}_initializeVertices(l){for(let c=0;c<l.length;c+=2)this._vertexToIndex(l[c],l[c+1])}subdividePolygonInternal(l,c){if(this._used)throw Error("Subdivision: multiple use not allowed.");this._used=!0;let{flattened:p,holeIndices:d}=function(y){let w=[],A=[];for(let k of y)if(k.length!==0){k!==y[0]&&w.push(A.length/2);for(let W of k)A.push(W.x),A.push(W.y)}return{flattened:A,holeIndices:w}}(l),a;this._initializeVertices(p);try{let y=function(A,k,W=2){let n=k&&k.length,q=n?k[0]*W:A.length,C=xa(A,0,q,W,!0),B=[];if(!C||C.next===C.prev)return B;let M,D,I;if(n&&(C=function(O,Y,G,j){let Z=[];for(let d1=0,m1=Y.length;d1<m1;d1++){let a1=xa(O,Y[d1]*j,d1<m1-1?Y[d1+1]*j:O.length,j,!1);a1===a1.next&&(a1.steiner=!0),Z.push(TS(a1))}Z.sort(jS);for(let d1=0;d180*W){M=A[0],D=A[1];let O=M,Y=D;for(let G=W;G<q;G+=W){let j=A[G],Z=A[G+1];j<M&&(M=j),ZO&&(O=j),Z>Y&&(Y=Z)}I=Math.max(O-M,Y-D),I=I!==0?32767/I:0}return $7(C,B,W,M,D,I,0),B}(p,d),w=this._convertIndices(p,y);a=this._subdivideTrianglesScanline(w)}catch(y){console.error(y)}let h=[];return c&&(h=this._generateOutline(l)),this._ensureNoPoleVertices(),this._handlePoles(a),{verticesFlattened:this._vertexBuffer,indicesTriangles:a,indicesLineList:h}}_convertIndices(l,c){let p=[];for(let d of c)p.push(this._vertexToIndex(l[2*d],l[2*d+1]));return p}_pointArrayToIndices(l){let c=[];for(let p of l)c.push(this._vertexToIndex(p.x,p.y));return c}}function Ba(l,c,p,d=!0){return new Ma(p,c).subdividePolygonInternal(l,d)}function Ac(l,c,p=!1){if(!l||l.length<1)return[];if(l.length<2)return[];let d=l[0],a=l[l.length-1],h=p&&(d.x!==a.x||d.y!==a.y);if(c<2)return h?[...l,l[0]]:[...l];let y=Math.floor(ll/c),w=[];w.push(new H(l[0].x,l[0].y));let A=l.length,k=h?A:A-1;for(let W=0;W<k;W++){let n=l[W],q=W0?(Math.floor(d1/y)+1)*y:(Math.ceil(d1/y)-1)*y,w1=G>0?(Math.floor(m1/y)+1)*y:(Math.ceil(m1/y)-1)*y,k1=Math.abs(d1-s1),y1=Math.abs(m1-w1),n1=Math.abs(d1-M),Y1=Math.abs(m1-D),U1=I?k1/j:Number.POSITIVE_INFINITY,K1=O?y1/Z:Number.POSITIVE_INFINITY;if((n1<=k1||!I)&&(Y1<=y1||!O))break;if(U1<K1&&I||!O){d1=s1,m1+=G*U1;let R1=new H(d1,Math.round(m1));w[w.length-1].x===R1.x&&w[w.length-1].y===R1.y||w.push(R1)}else{d1+=Y*K1,m1=w1;let R1=new H(Math.round(d1),m1);w[w.length-1].x===R1.x&&w[w.length-1].y===R1.y||w.push(R1)}}let a1=new H(M,D);w[w.length-1].x===a1.x&&w[w.length-1].y===a1.y||w.push(a1)}return w}function bS(l,c,p){if(c.length===0)throw Error("Subdivision vertex ring is empty.");let d=0,a=l[2*c[0]];for(let A=1;A<c.length;A++){let k=l[2*c[A]];k=0?y-1:h-1,k=(w+1)%h,W=l[2*c[A]],n=l[2*c[k]],q=l[2*c[y]],C=l[2*c[y]+1],B=l[2*c[w]+1],M=!1;if(Wn)M=!1;else{let D=B-C,I=-(l[2*c[w]]-q),O=C((n-q)*D+(l[2*c[k]+1]-C)*I)*O&&(M=!0)}if(M){let D=c[A],I=c[y],O=c[w];D!==I&&D!==O&&I!==O&&p.push(O,I,D),y--,y=h&&(w=0)}if(A===k)break}}function Ka(l,c,p,d,a,h,y,w,A){let k=a.length/2,W=y&&w&&A;if(k<I1.MAX_VERTEX_ARRAY_LENGTH){let n=c.prepareSegment(k,p,d),q=n.vertexLength;for(let M=0;M<h.length;M+=3)d.emplaceBack(q+h[M],q+h[M+1],q+h[M+2]);let C,B;n.vertexLength+=k,n.primitiveLength+=h.length/3,W&&(B=y.prepareSegment(k,p,w),C=B.vertexLength,B.vertexLength+=k);for(let M=0;M<a.length;M+=2)l(a[M],a[M+1]);if(W)for(let M of A){for(let D=1;D<M.length;D+=2)w.emplaceBack(C+M[D-1],C+M[D]);B.primitiveLength+=M.length/2}}else(function(n,q,C,B,M,D){let I=[];for(let Z=0;Z<B.length/2;Z++)I.push(-1);let O={count:0},Y=0,G=n.getOrCreateLatestSegment(q,C),j=G.vertexLength;for(let Z=2;Z<M.length;Z+=3){let d1=M[Z-2],m1=M[Z-1],a1=M[Z],s1=I[d1]<Y,w1=I[m1]<Y,k1=I[a1]I1.MAX_VERTEX_ARRAY_LENGTH&&(G=n.createNewSegment(q,C),Y=O.count,s1=!0,w1=!0,k1=!0,j=0);let y1=u8(I,B,D,O,d1,s1,G),n1=u8(I,B,D,O,m1,w1,G),Y1=u8(I,B,D,O,a1,k1,G);C.emplaceBack(j+y1-Y,j+n1-Y,j+Y1-Y),G.primitiveLength++}})(c,p,d,a,h,l),W&&function(n,q,C,B,M,D){let I=[];for(let Z=0;Z<B.length/2;Z++)I.push(-1);let O={count:0},Y=0,G=n.getOrCreateLatestSegment(q,C),j=G.vertexLength;for(let Z of M)for(let d1=1;d1<Z.length;d1+=2){let m1=Z[d1-1],a1=Z[d1],s1=I[m1]<Y,w1=I[a1]I1.MAX_VERTEX_ARRAY_LENGTH&&(G=n.createNewSegment(q,C),Y=O.count,s1=!0,w1=!0,j=0);let k1=u8(I,B,D,O,m1,s1,G),y1=u8(I,B,D,O,a1,w1,G);C.emplaceBack(j+k1-Y,j+y1-Y),G.primitiveLength++}}(y,p,w,a,A,l),c.forceNewSegmentOnNextPrepare(),y==null||y.forceNewSegmentOnNextPrepare()}function u8(l,c,p,d,a,h,y){if(h){let w=d.count;return p(c[2*a],c[2*a+1]),l[a]=d.count,d.count++,y.vertexLength++,w}return l[a]}class a9{constructor(l){this.zoom=l.zoom,this.overscaling=l.overscaling,this.layers=l.layers,this.layerIds=this.layers.map((c)=>c.id),this.index=l.index,this.hasDependencies=!1,this.patternFeatures=[],this.layoutVertexArray=new X,this.indexArray=new Q1,this.indexArray2=new j1,this.programConfigurations=new au(l.layers,l.zoom),this.segments=new I1,this.segments2=new I1,this.stateDependentLayerIds=this.layers.filter((c)=>c.isStateDependent()).map((c)=>c.id)}populate(l,c,p){this.hasDependencies=m9("fill",this.layers,c);let d=this.layers[0].layout.get("fill-sort-key"),a=!d.isConstant(),h=[];for(let{feature:y,id:w,index:A,sourceLayerIndex:k}of l){let W=this.layers[0]._featureFilter.needGeometry,n=y5(y,W);if(!this.layers[0]._featureFilter.filter(new Nl(this.zoom),n,p))continue;let q=a?d.evaluate(n,{},p,c.availableImages):void 0,C={id:w,properties:y.properties,type:y.type,sourceLayerIndex:k,index:A,geometry:W?n.geometry:h5(y),patterns:{},sortKey:q};h.push(C)}a&&h.sort((y,w)=>y.sortKey-w.sortKey);for(let y of h){let{geometry:w,index:A,sourceLayerIndex:k}=y;if(this.hasDependencies){let W=Nd("fill",this.layers,y,{zoom:this.zoom},c);this.patternFeatures.push(W)}else this.addFeature(y,w,A,p,{},c.subdivisionGranularity);c.featureIndex.insert(l[A].feature,w,A,k,this.index)}}update(l,c,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(l,c,this.stateDependentLayers,{imagePositions:p})}addFeatures(l,c,p){for(let d of this.patternFeatures)this.addFeature(d,d.geometry,d.index,c,p,l.subdivisionGranularity)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(l){this.uploaded||(this.layoutVertexBuffer=l.createVertexBuffer(this.layoutVertexArray,YS),this.indexBuffer=l.createIndexBuffer(this.indexArray),this.indexBuffer2=l.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(l),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(l,c,p,d,a,h){for(let y of hr(c,500)){let w=Ba(y,d,h.fill.getGranularityForZoomLevel(d.z)),A=this.layoutVertexArray;Ka((k,W)=>{A.emplaceBack(k,W)},this.segments,this.layoutVertexArray,this.indexArray,w.verticesFlattened,w.indicesTriangles,this.segments2,this.indexArray2,w.indicesLineList)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,l,p,{imagePositions:a,canonical:d})}}let Ua,Da;z1("FillBucket",a9,{omit:["layers","patternFeatures"]});var $S={get paint(){return Da=Da||new C0({"fill-antialias":new T1(E1.paint_fill["fill-antialias"]),"fill-opacity":new $1(E1.paint_fill["fill-opacity"]),"fill-color":new $1(E1.paint_fill["fill-color"]),"fill-outline-color":new $1(E1.paint_fill["fill-outline-color"]),"fill-translate":new T1(E1.paint_fill["fill-translate"]),"fill-translate-anchor":new T1(E1.paint_fill["fill-translate-anchor"]),"fill-pattern":new qu(E1.paint_fill["fill-pattern"])})},get layout(){return Ua=Ua||new C0({"fill-sort-key":new $1(E1.layout_fill["fill-sort-key"])})}};class Ra extends r2{constructor(l,c){super(l,$S,c)}recalculate(l,c){super.recalculate(l,c);let p=this.paint._values["fill-outline-color"];p.value.kind==="constant"&&p.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(l){return new a9(l)}queryRadius(){return p9(this.paint.get("fill-translate"))}queryIntersectsFeature({queryGeometry:l,geometry:c,transform:p,pixelsToTileUnits:d}){return ma(f9(l,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),-p.bearingInRadians,d),c)}isTileClipped(){return!0}}let _S=Pl([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),iS=Pl([{name:"a_centroid",components:2,type:"Int16"}],4),{members:eS}=_S;class Qr{constructor(l,c,p,d,a){this.properties={},this.extent=p,this.type=0,this.id=void 0,this._pbf=l,this._geometry=-1,this._keys=d,this._values=a,l.readFields(tS,this,c)}loadGeometry(){let l=this._pbf;l.pos=this._geometry;let c=l.readVarint()+l.pos,p=[],d,a=1,h=0,y=0,w=0;for(;l.pos<c;){if(h>3}if(h--,a===1||a===2)y+=l.readSVarint(),w+=l.readSVarint(),a===1&&(d&&p.push(d),d=[]),d&&d.push(new H(y,w));else{if(a!==7)throw Error(`unknown command ${a}`);d&&d.push(d[0].clone())}}return d&&p.push(d),p}bbox(){let l=this._pbf;l.pos=this._geometry;let c=l.readVarint()+l.pos,p=1,d=0,a=0,h=0,y=1/0,w=-1/0,A=1/0,k=-1/0;for(;l.pos<c;){if(d>3}if(d--,p===1||p===2)a+=l.readSVarint(),h+=l.readSVarint(),aw&&(w=a),hk&&(k=h);else if(p!==7)throw Error(`unknown command ${p}`)}return[y,A,w,k]}toGeoJSON(l,c,p){let d=this.extent*Math.pow(2,p),a=this.extent*l,h=this.extent*c,y=this.loadGeometry();function w(n){return[360*(n.x+a)/d-180,360/Math.PI*Math.atan(Math.exp((1-2*(n.y+h)/d)*Math.PI))-90]}function A(n){return n.map(w)}let k;if(this.type===1){let n=[];for(let C of y)n.push(C[0]);let q=A(n);k=n.length===1?{type:"Point",coordinates:q[0]}:{type:"MultiPoint",coordinates:q}}else if(this.type===2){let n=y.map(A);k=n.length===1?{type:"LineString",coordinates:n[0]}:{type:"MultiLineString",coordinates:n}}else{if(this.type!==3)throw Error("unknown feature type");{let n=Ha(y),q=[];for(let C of n)q.push(C.map(A));k=q.length===1?{type:"Polygon",coordinates:q[0]}:{type:"MultiPolygon",coordinates:q}}}let W={type:"Feature",geometry:k,properties:this.properties};return this.id!=null&&(W.id=this.id),W}}function tS(l,c,p){l===1?c.id=p.readVarint():l===2?function(d,a){let h=d.readVarint()+d.pos;for(;d.pos<h;){let y=a._keys[d.readVarint()],w=a._values[d.readVarint()];a.properties[y]=w}}(p,c):l===3?c.type=p.readVarint():l===4&&(c._geometry=p.pos)}function Ha(l){let c=l.length;if(c<=1)return[l];let p=[],d,a;for(let h=0;h<c;h++){let y=lk(l[h]);y!==0&&(a===void 0&&(a=y<0),a===y<0?(d&&p.push(d),d=[l[h]]):d&&d.push(l[h]))}return d&&p.push(d),p}function lk(l){let c=0;for(let p,d,a=0,h=l.length,y=h-1;a<h;y=a++)p=l[a],d=l[y],c+=(d.x-p.x)*(p.y+d.y);return c}Qr.types=["Unknown","Point","LineString","Polygon"];class Ia{constructor(l,c){this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=l,this._keys=[],this._values=[],this._features=[],l.readFields(uk,this,c),this.length=this._features.length}feature(l){if(l=this._features.length)throw Error("feature index out of bounds");this._pbf.pos=this._features[l];let c=this._pbf.readVarint()+this._pbf.pos;return new Qr(this._pbf,c,this.extent,this._keys,this._values)}}function uk(l,c,p){l===15?c.version=p.readVarint():l===1?c.name=p.readString():l===5?c.extent=p.readVarint():l===2?c._features.push(p.pos):l===3?c._keys.push(p.readString()):l===4&&c._values.push(function(d){let a=null,h=d.readVarint()+d.pos;for(;d.pos>3;a=y===1?d.readString():y===2?d.readFloat():y===3?d.readDouble():y===4?d.readVarint64():y===5?d.readVarint():y===6?d.readSVarint():y===7?d.readBoolean():null}if(a==null)throw Error("unknown feature value");return a}(p))}class Pd{constructor(l,c){this.layers=l.readFields(ck,{},c)}}function ck(l,c,p){if(l===3){let d=new Ia(p,p.readVarint()+p.pos);d.length&&(c[d.name]=d)}}let Md=Math.pow(2,13);function c8(l,c,p,d,a,h,y,w){l.emplaceBack(c,p,2*Math.floor(d*Md)+y,a*Md*2,h*Md*2,Math.round(w))}class o9{constructor(l){this.zoom=l.zoom,this.overscaling=l.overscaling,this.layers=l.layers,this.layerIds=this.layers.map((c)=>c.id),this.index=l.index,this.hasDependencies=!1,this.layoutVertexArray=new c1,this.centroidVertexArray=new t,this.indexArray=new Q1,this.programConfigurations=new au(l.layers,l.zoom),this.segments=new I1,this.stateDependentLayerIds=this.layers.filter((c)=>c.isStateDependent()).map((c)=>c.id)}populate(l,c,p){this.features=[],this.hasDependencies=m9("fill-extrusion",this.layers,c);for(let{feature:d,id:a,index:h,sourceLayerIndex:y}of l){let w=this.layers[0]._featureFilter.needGeometry,A=y5(d,w);if(!this.layers[0]._featureFilter.filter(new Nl(this.zoom),A,p))continue;let k={id:a,sourceLayerIndex:y,index:h,geometry:w?A.geometry:h5(d),properties:d.properties,type:d.type,patterns:{}};this.hasDependencies?this.features.push(Nd("fill-extrusion",this.layers,k,{zoom:this.zoom},c)):this.addFeature(k,k.geometry,h,p,{},c.subdivisionGranularity),c.featureIndex.insert(d,k.geometry,h,y,this.index,!0)}}addFeatures(l,c,p){for(let d of this.features){let{geometry:a}=d;this.addFeature(d,a,d.index,c,p,l.subdivisionGranularity)}}update(l,c,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(l,c,this.stateDependentLayers,{imagePositions:p})}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,eS),this.centroidVertexBuffer=l.createVertexBuffer(this.centroidVertexArray,iS.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,c,p,d,a,h){for(let y of hr(c,500)){let w={x:0,y:0,sampleCount:0},A=this.layoutVertexArray.length;this.processPolygon(w,d,l,y,h);let k=this.layoutVertexArray.length-A,W=Math.floor(w.x/w.sampleCount),n=Math.floor(w.y/w.sampleCount);for(let q=0;q<k;q++)this.centroidVertexArray.emplaceBack(W,n)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,l,p,{imagePositions:a,canonical:d})}processPolygon(l,c,p,d,a){if(d.length{c8(k,W,n,0,0,1,1,0)},this.segments,this.layoutVertexArray,this.indexArray,A.verticesFlattened,A.indicesTriangles)}_generateSideFaces(l,c){let p=0;for(let d=1;dI1.MAX_VERTEX_ARRAY_LENGTH&&(c.segment=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));let y=a.sub(h)._perp()._unit(),w=h.dist(a);p+w>32768&&(p=0),c8(this.layoutVertexArray,a.x,a.y,y.x,y.y,0,0,p),c8(this.layoutVertexArray,a.x,a.y,y.x,y.y,0,1,p),p+=w,c8(this.layoutVertexArray,h.x,h.y,y.x,y.y,0,0,p),c8(this.layoutVertexArray,h.x,h.y,y.x,y.y,0,1,p);let A=c.segment.vertexLength;this.indexArray.emplaceBack(A,A+2,A+1),this.indexArray.emplaceBack(A+1,A+2,A+3),c.segment.vertexLength+=4,c.segment.primitiveLength+=2}}}function rk(l,c){for(let p=0;p<c.length;p++){let d=c[p];p===c.length-1&&c[0].x===d.x&&c[0].y===d.y||(l.x+=d.x,l.y+=d.y,l.sampleCount++)}}function pk(l,c){return l.x===c.x&&(l.xll)||l.y===c.y&&(l.yll)}function Ya(l){return l.every((c)=>c.xc.x>ll)||l.every((c)=>c.yc.y>ll)}let za;z1("FillExtrusionBucket",o9,{omit:["layers","features"]});var fk={get paint(){return za=za||new C0({"fill-extrusion-opacity":new T1(E1["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new $1(E1["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new T1(E1["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new T1(E1["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new qu(E1["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new $1(E1["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new $1(E1["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new T1(E1["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class Oa extends r2{constructor(l,c){super(l,fk,c)}createBucket(l){return new o9(l)}queryRadius(){return p9(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature({queryGeometry:l,feature:c,featureState:p,geometry:d,transform:a,pixelsToTileUnits:h,pixelPosMatrix:y}){let w=f9(l,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),-a.bearingInRadians,h),A=this.paint.get("fill-extrusion-height").evaluate(c,p),k=this.paint.get("fill-extrusion-base").evaluate(c,p),W=function(q,C){let B=[];for(let M of q){let D=[M.x,M.y,0,1];ul(D,D,C),B.push(new H(D[0]/D[3],D[1]/D[3]))}return B}(w,y),n=function(q,C,B,M){let D=[],I=[],O=M[8]*C,Y=M[9]*C,G=M[10]*C,j=M[11]*C,Z=M[8]*B,d1=M[9]*B,m1=M[10]*B,a1=M[11]*B;for(let s1 of q){let w1=[],k1=[];for(let y1 of s1){let{x:n1,y:Y1}=y1,U1=M[0]*n1+M[4]*Y1+M[12],K1=M[1]*n1+M[5]*Y1+M[13],R1=M[2]*n1+M[6]*Y1+M[14],_1=M[3]*n1+M[7]*Y1+M[15],Cl=R1+G,sl=_1+j,ql=U1+Z,H0=K1+d1,Tl=R1+m1,f0=_1+a1,N0=new H((U1+O)/sl,(K1+Y)/sl);N0.z=Cl/sl,w1.push(N0);let Il=new H(ql/f0,H0/f0);Il.z=Tl/f0,k1.push(Il)}D.push(w1),I.push(k1)}return[D,I]}(d,k,A,y);return function(q,C,B){let M=1/0;ma(B,C)&&(M=Ga(B,C[0]));for(let D=0;D<C.length;D++){let I=C[D],O=q[D];for(let Y=0;Y<I.length-1;Y++){let G=I[Y],j=[G,I[Y+1],O[Y+1],O[Y],G];da(B,j)&&(M=Math.min(M,Ga(B,j)))}}return M!==1/0&&M}(n[0],n[1],W)}}function r8(l,c){return l.x*c.x+l.y*c.y}function Ga(l,c){if(l.length===1){let p=0,d=c[p++],a;for(;!a||d.equals(a);)if(a=c[p++],!a)return 1/0;for(;p>4;if(d!==1)throw Error(`Got v${d} data when expected v1.`);let a=Qa[15&p];if(!a)throw Error("Unrecognized array type.");let[h]=new Uint16Array(l,2,1),[y]=new Uint32Array(l,4,1);return new h9(y,h,a,l)}constructor(l,c=64,p=Float64Array,d){if(isNaN(l)||l<0)throw Error(`Unpexpected numItems value: ${l}.`);this.numItems=+l,this.nodeSize=Math.min(Math.max(+c,2),65535),this.ArrayType=p,this.IndexArrayType=l<65536?Uint16Array:Uint32Array;let a=Qa.indexOf(this.ArrayType),h=2*l*this.ArrayType.BYTES_PER_ELEMENT,y=l*this.IndexArrayType.BYTES_PER_ELEMENT,w=(8-y%8)%8;if(a>1;return this.ids[p]=p,this.coords[this._pos++]=l,this.coords[this._pos++]=c,p}finish(){let l=this._pos>>1;if(l!==this.numItems)throw Error(`Added ${l} items when expected ${this.numItems}.`);return Bd(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(l,c,p,d){if(!this._finished)throw Error("Data not yet indexed - call index.finish().");let{ids:a,coords:h,nodeSize:y}=this,w=[0,a.length-1,0],A=[];for(;w.length;){let k=w.pop()||0,W=w.pop()||0,n=w.pop()||0;if(W-n<=y){for(let M=n;M=l&&D=c&&I>1,C=h[2*q],B=h[2*q+1];C>=l&&C=c&&B<=d&&A.push(a[q]),(k===0?l<=C:c=C:d>=B)&&(w.push(q+1),w.push(W),w.push(1-k))}return A}within(l,c,p){if(!this._finished)throw Error("Data not yet indexed - call index.finish().");let{ids:d,coords:a,nodeSize:h}=this,y=[0,d.length-1,0],w=[],A=p*p;for(;y.length;){let k=y.pop()||0,W=y.pop()||0,n=y.pop()||0;if(W-n<=h){for(let M=n;M<=W;M++)Ja(a[2*M],a[2*M+1],l,c)>1,C=a[2*q],B=a[2*q+1];Ja(C,B,l,c)<=A&&w.push(d[q]),(k===0?l-p<=C:c-p=C:c+p>=B)&&(y.push(q+1),y.push(W),y.push(1-k))}return w}}function Bd(l,c,p,d,a,h){if(a-d>1;ja(l,c,y,d,a,h),Bd(l,c,p,d,y-1,1-h),Bd(l,c,p,y+1,a,1-h)}function ja(l,c,p,d,a,h){for(;a>d;){if(a-d>600){let k=a-d+1,W=p-d+1,n=Math.log(k),q=0.5*Math.exp(2*n/3),C=0.5*Math.sqrt(n*q*(k-q)/k)*(W-k/2y&&p8(l,c,d,a);w<A;){for(p8(l,c,w,A),w++,A--;c[2*w+h]y;)A--}c[2*d+h]===y?p8(l,c,d,A):(A++,p8(l,c,A,a)),A<=p&&(d=A+1),p>1),y,w=p-c,A=l[c],k=l[c+1],W=l[p],n=l[p+1];for(let q=c+3;q a)y=q,a=C;else if(C===a){let B=Math.abs(q-h);Bd&&(y-c>3&&Ud(l,c,y,d),l[y+2]=a,p-y>3&&Ud(l,y,p,d))}function dk(l,c,p,d,a,h){let y=a-p,w=h-d;if(y!==0||w!==0){let A=((l-p)*y+(c-d)*w)/(y*y+w*w);A>1?(p=a,d=h):A>0&&(p+=y*A,d+=w*A)}return y=l-p,w=c-d,y*y+w*w}function x0(l,c,p,d){let a={type:c,geom:p},h={id:l==null?null:l,type:a.type,geometry:a.geom,tags:d,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};switch(a.type){case"Point":case"MultiPoint":f8(h,a.geom);break;case"LineString":f8(h,a.geom.points);break;case"Polygon":f8(h,a.geom[0].points);break;case"MultiLineString":for(let y of a.geom)f8(h,y.points);break;case"MultiPolygon":for(let y of a.geom)f8(h,y[0].points)}return h}function Dd(l){l.points.length>64&&(l.points=new Float64Array(l.points))}function f8(l,c){for(let p=0;p<c.length;p+=3)l.minX=Math.min(l.minX,c[p]),l.minY=Math.min(l.minY,c[p+1]),l.maxX=Math.max(l.maxX,c[p]),l.maxY=Math.max(l.maxY,c[p+1])}function Rd(l,c){let p=[];switch(l.type){case"FeatureCollection":for(let d=0;d<l.features.length;d++)y9(p,l.features[d],c,d);break;case"Feature":y9(p,l,c);break;default:y9(p,{geometry:l,properties:void 0},c)}return p}function y9(l,c,p,d){if(!c.geometry)return;if(c.geometry.type==="GeometryCollection")return void function(w,A,k,W,n){for(let q of k.geometries)y9(w,{id:A.id,geometry:q,properties:A.properties},W,n)}(l,c,c.geometry,p,d);if(!c.geometry.coordinates?.length)return;let h=function(w,A,k){return A.promoteId?w.properties?.[A.promoteId]:A.generateId?k||0:w.id}(c,p,d),y=Math.pow(p.tolerance/((1<<p.maxZoom)*p.extent),2);switch(c.geometry.type){case"Point":return void function(w,A,k,W){let n=[];n.push(jr(k.coordinates[0]),Jr(k.coordinates[1]),0),w.push(x0(A,"Point",n,W))}(l,h,c.geometry,c.properties);case"MultiPoint":return void function(w,A,k,W){let n=[];for(let q of k.coordinates)n.push(jr(q[0]),Jr(q[1]),0);w.push(x0(A,"MultiPoint",n,W))}(l,h,c.geometry,c.properties);case"LineString":return void function(w,A,k,W,n){let q={points:[]};Hd(k.coordinates,q,W,!1),w.push(x0(A,"LineString",q,n))}(l,h,c.geometry,y,c.properties);case"MultiLineString":return void function(w,A,k,W,n,q){if(n.lineMetrics)for(let C of k.coordinates){let B={points:[]};Hd(C,B,W,!1),w.push(x0(A,"LineString",B,q))}else{let C=[];Id(k.coordinates,C,W,!1),w.push(x0(A,"MultiLineString",C,q))}}(l,h,c.geometry,y,p,c.properties);case"Polygon":return void function(w,A,k,W,n){let q=[];Id(k.coordinates,q,W,!0),w.push(x0(A,"Polygon",q,n))}(l,h,c.geometry,y,c.properties);case"MultiPolygon":return void function(w,A,k,W,n){let q=[];for(let C of k.coordinates){let B=[];Id(C,B,W,!0),q.push(B)}w.push(x0(A,"MultiPolygon",q,n))}(l,h,c.geometry,y,c.properties);default:throw Error("Input data is not a valid GeoJSON object.")}}function Hd(l,c,p,d){let a,h,y=0;for(let A=0;A0&&(y+=d?(a*W-k*h)/2:Math.sqrt(Math.pow(k-a,2)+Math.pow(W-h,2))),a=k,h=W}let w=c.points.length-3;c.points[2]=1,p>0&&Ud(c.points,0,w,p),c.points[w+2]=1,Dd(c),c.size=Math.abs(y),c.start=0,c.end=c.size}function Id(l,c,p,d){for(let a=0;a<l.length;a++){let h={points:[]};Hd(l[a],h,p,d),c.push(h)}}function jr(l){return l/360+0.5}function Jr(l){let c=Math.sin(l*Math.PI/180),p=0.5-0.25*Math.log((1+c)/(1-c))/Math.PI;return p1?1:p}function w9(l){let c={type:"Feature",geometry:mk(l),properties:l.tags};return l.id!=null&&(c.id=l.id),c}function mk(l){let{type:c,geometry:p}=l;switch(c){case"Point":return{type:c,coordinates:Xa(p[0],p[1])};case"MultiPoint":return{type:c,coordinates:s9(p)};case"LineString":return{type:c,coordinates:s9(p.points)};case"MultiLineString":case"Polygon":return{type:c,coordinates:p.map((d)=>s9(d.points))};case"MultiPolygon":return{type:c,coordinates:p.map((d)=>d.map((a)=>s9(a.points)))}}}function s9(l){let c=[];for(let p=0;p=(p/=c)&&y<d)return l;if(y =d)return null;let A=[];for(let k of l){let W=a===X0.X?k.minX:k.minY,n=a===X0.X?k.maxX:k.maxY;if(W>=p&&n<d)A.push(k);else if(!(n =d))switch(k.type){case"Point":case"MultiPoint":gk(k,A,p,d,a);continue;case"LineString":vk(k,A,p,d,a,w);continue;case"MultiLineString":ak(k,A,p,d,a);continue;case"Polygon":ok(k,A,p,d,a);continue;case"MultiPolygon":hk(k,A,p,d,a);continue}}return A.length?A:null}function gk(l,c,p,d,a){let h=[];(function(y,w,A,k,W){for(let n=0;n=A&&q1?x0(l.id,"MultiLineString",y,l.tags):x0(l.id,"LineString",y[0],l.tags))}function ak(l,c,p,d,a){let h=[];Yd(l.geometry,h,p,d,a,!1),h.length&&c.push(h.length!==1?x0(l.id,"MultiLineString",h,l.tags):x0(l.id,"LineString",h[0],l.tags))}function ok(l,c,p,d,a){let h=[];Yd(l.geometry,h,p,d,a,!0),h.length&&c.push(x0(l.id,"Polygon",h,l.tags))}function hk(l,c,p,d,a){let h=[];for(let y of l.geometry){let w=[];Yd(y,w,p,d,a,!0),w.length&&h.push(w)}h.length&&c.push(x0(l.id,"MultiPolygon",h,l.tags))}function ba(l,c,p,d,a,h,y){let w=$a(l),A=a===X0.X?yk:wk,k,W,n=l.start;for(let D=0;D<l.points.length-3;D+=3){let I=l.points[D],O=l.points[D+1],Y=l.points[D+2],G=l.points[D+3],j=l.points[D+4],Z=a===X0.X?I:O,d1=a===X0.X?G:j,m1=!1;y&&(k=Math.sqrt(Math.pow(I-G,2)+Math.pow(O-j,2))),Z p&&(W=A(w,I,O,G,j,p),y&&(w.start=n+k*W)):Z>d?d1<d&&(W=A(w,I,O,G,j,d),y&&(w.start=n+k*W)):Xr(w.points,I,O,Y),d1 =p&&(W=A(w,I,O,G,j,p),m1=!0),d1>d&&Z=p&&M=3&&(w.points[q]!==w.points[0]||w.points[q+1]!==w.points[1])&&Xr(w.points,w.points[0],w.points[1],w.points[2]),w.points.length&&(Dd(w),c.push(w))}function $a(l){return{points:[],size:l.size,start:l.start,end:l.end}}function Yd(l,c,p,d,a,h){for(let y of l)ba(y,c,p,d,a,h,!1)}function Xr(l,c,p,d){l.push(c,p,d)}function yk(l,c,p,d,a,h){let y=(h-c)/(d-c);return Xr(l.points,h,p+(a-p)*y,1),y}function wk(l,c,p,d,a,h){let y=(h-p)/(a-p);return Xr(l.points,c+(d-c)*y,h,1),y}function zd(l,c){let p=c.buffer/c.extent,d=l,a=e5(l,1,-1-p,p,X0.X,-1,2,c),h=e5(l,1,1-p,2+p,X0.X,-1,2,c);return a||h?(d=e5(l,1,-p,1+p,X0.X,-1,2,c)||[],a&&(d=_a(a,1).concat(d)),h&&(d=d.concat(_a(h,-1))),d):d}function _a(l,c){let p=[];for(let d of l)switch(d.type){case"Point":case"MultiPoint":{let a=sk(d.geometry,c);p.push(x0(d.id,d.type,a,d.tags));continue}case"LineString":{let a=Od(d.geometry,c);p.push(x0(d.id,d.type,a,d.tags));continue}case"MultiLineString":case"Polygon":{let a=[];for(let h of d.geometry)a.push(Od(h,c));p.push(x0(d.id,d.type,a,d.tags));continue}case"MultiPolygon":{let a=[];for(let h of d.geometry){let y=[];for(let w of h)y.push(Od(w,c));a.push(y)}p.push(x0(d.id,d.type,a,d.tags));continue}}return p}function sk(l,c){let p=[];for(let d=0;d<l.length;d+=3)p.push(l[d]+c,l[d+1],l[d+2]);return p}function Od(l,c){let p={points:[],size:l.size};l.start!==void 0&&(p.start=l.start,p.end=l.end);for(let d=0;d0||c.addOrUpdateProperties?.length>0;if(d){let h=l[0],y=Rd({type:"FeatureCollection",features:[{type:"Feature",id:h.id,geometry:c.newGeometry,properties:a?ia(h.tags,c):h.tags}]},p);return y=zd(y,p),y}if(a){let h=[];for(let y of l){let w={...y};w.tags=ia(w.tags,c),h.push(w)}return h}return l}function ia(l,c){if(c.removeAllProperties)return{};let p={...l||{}};if(c.removeProperties)for(let d of c.removeProperties)delete p[d];if(c.addOrUpdateProperties)for(let{key:d,value:a}of c.addOrUpdateProperties)p[d]=a;return p}(function(l){l[l.X=0]="X",l[l.Y=1]="Y"})(X0||(X0={}));let Gd={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:(l)=>l};class ea{constructor(l){this.options=Object.assign(Object.create(Gd),l),this.trees=Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[],this.points=[]}load(l){let c=[];for(let p of l){if(!p.geometry)continue;let[d,a]=p.geometry.coordinates,[h,y]=[jr(d),Jr(a)];c.push({id:p.id,type:"Point",geometry:[h,y],tags:p.properties})}this.createIndex(c)}initialize(l){let c=[];for(let p of l)p.type==="Point"&&c.push(p);this.createIndex(c)}updateIndex(l,c,p){this.options=Object.assign(Object.create(Gd),p.clusterOptions),this.initialize(l)}createIndex(l){let{log:c,minZoom:p,maxZoom:d}=this.options;c&&console.time("total time");let a=`prepare ${l.length} points`;c&&console.time(a),this.points=l;let h=[];for(let w=0;w=p;w--){let A=Date.now();y=this.trees[w]=this.createTree(this.cluster(y,w)),c&&console.log("z%d: %d clusters in %dms",w,y.numItems,Date.now()-A)}c&&console.timeEnd("total time")}getClusters(l,c){return this.getClustersInternal(l,c).map((p)=>w9(p))}getClustersInternal(l,c){let p=((l[0]+180)%360+360)%360-180,d=Math.max(-90,Math.min(90,l[1])),a=l[2]===180?180:((l[2]+180)%360+360)%360-180,h=Math.max(-90,Math.min(90,l[3]));if(l[2]-l[0]>=360)p=-180,a=180;else if(p>a){let W=this.getClustersInternal([p,d,180,h],c),n=this.getClustersInternal([-180,d,a,h],c);return W.concat(n)}let y=this.trees[this.limitZoom(c)],w=y.range(jr(p),Jr(h),jr(a),Jr(d)),A=y.flatData,k=[];for(let W of w){let n=this.stride*W;k.push(A[n+5]>1?kk(A,n,this.clusterProps):this.points[A[n+3]])}return k}getChildren(l){let c=this.getOriginId(l),p=this.getOriginZoom(l),d=Error("No cluster with the specified id: "+l),a=this.trees[p];if(!a)throw d;let h=a.flatData;if(c*this.stride>=h.length)throw d;let y=this.options.radius/(this.options.extent*Math.pow(2,p-1)),w=a.within(h[c*this.stride],h[c*this.stride+1],y),A=[];for(let k of w){let W=k*this.stride;h[W+4]===l&&A.push(h[W+5]>1?Ek(h,W,this.clusterProps):w9(this.points[h[W+3]]))}if(A.length===0)throw d;return A}getLeaves(l,c,p){let d=[];return this.appendLeaves(d,l,c=c||10,p=p||0,0),d}getTile(l,c,p){let d=this.trees[this.limitZoom(l)];if(!d)return null;let a=Math.pow(2,l),{extent:h,radius:y}=this.options,w=y/h,A=(p-w)/a,k=(p+1+w)/a,W={transformed:!0,features:[],source:null,x:c,y:p,z:l};return this.addTileFeatures(d.range((c-w)/a,A,(c+1+w)/a,k),d.flatData,c,p,a,W),c===0&&this.addTileFeatures(d.range(1-w/a,A,1,k),d.flatData,a,p,a,W),c===a-1&&this.addTileFeatures(d.range(0,A,w/a,k),d.flatData,-1,p,a,W),W}getClusterExpansionZoom(l){return this.getOriginZoom(l)}appendLeaves(l,c,p,d,a){let h=this.getChildren(c);for(let y of h){let w=y.properties;if(w?.cluster?a+w.point_count<=d?a+=w.point_count:a=this.appendLeaves(l,w.cluster_id,p,d,a):a<d?a++:l.push(y),l.length===p)break}return a}createTree(l){let c=new h9(l.length/this.stride|0,this.options.nodeSize,Float32Array);for(let p=0;p1,k,W,n;if(A)k=Qd(c,w,this.clusterProps),W=c[w],n=c[w+1];else{let B=this.points[c[w+3]];k=B.tags,[W,n]=B.geometry}let q={type:1,geometry:[[Math.round(this.options.extent*(W*a-p)),Math.round(this.options.extent*(n*a-d))]],tags:k},C;C=A||this.options.generateId?c[w+3]:this.points[c[w+3]].id,C!==void 0&&(q.id=C),h.features.push(q)}}limitZoom(l){return Math.max(this.options.minZoom,Math.min(Math.floor(+l),this.options.maxZoom+1))}cluster(l,c){let{radius:p,extent:d,reduce:a,minPoints:h}=this.options,y=p/(d*Math.pow(2,c)),w=l.flatData,A=[],k=this.stride;for(let W=0;W<w.length;W+=k){if(w[W+2]c&&(M+=w[I+5])}if(M>B&&M>=h){let D,I=n*B,O=q*B,Y=-1,G=(W/k<<5)+(c+1)+this.points.length;for(let j of C){let Z=j*k;if(w[Z+2]<=c)continue;w[Z+2]=c;let d1=w[Z+5];I+=w[Z]*d1,O+=w[Z+1]*d1,w[Z+4]=G,a&&(D||(D=this.map(w,W,!0),Y=this.clusterProps.length,this.clusterProps.push(D)),a(D,this.map(w,Z)))}w[W+4]=G,A.push(I/M,O/M,1/0,G,-1,M),a&&A.push(Y)}else{for(let D=0;D1)for(let D of C){let I=D*k;if(!(w[I+2]<=c)){w[I+2]=c;for(let O=0;O>5}getOriginZoom(l){return(l-this.points.length)%32}map(l,c,p){if(l[c+5]>1){let h=this.clusterProps[l[c+6]];return p?Object.assign({},h):h}let d=this.points[l[c+3]].tags,a=this.options.map(d);return p&&a===d?Object.assign({},a):a}}function kk(l,c,p){return{id:l[c+3],type:"Point",tags:Qd(l,c,p),geometry:[l[c],l[c+1]]}}function Ek(l,c,p){return{type:"Feature",id:l[c+3],properties:Qd(l,c,p),geometry:{type:"Point",coordinates:[Ta(l[c]),Za(l[c+1])]}}}function Qd(l,c,p){let d=l[c+5],a=d>=1e4?`${Math.round(d/1000)}k`:d>=1000?Math.round(d/100)/10+"k":d,h=l[c+6],y=h===-1?{}:Object.assign({},p[h]);return Object.assign(y,{cluster:!0,cluster_id:l[c+3],point_count:d,point_count_abbreviated:a})}let jd="geojsonvt_clip_start",Jd="geojsonvt_clip_end";function ta(l,c,p,d,a){let h=c===a.maxZoom?0:a.tolerance/((1<<c)*a.extent),y={transformed:!1,features:[],source:null,x:p,y:d,z:c,minX:2,minY:1,maxX:-1,maxY:0,numPoints:0,numSimplified:0,numFeatures:l.length};for(let w of l)nk(y,w,h,a);return y}function nk(l,c,p,d){switch(l.minX=Math.min(l.minX,c.minX),l.minY=Math.min(l.minY,c.minY),l.maxX=Math.max(l.maxX,c.maxX),l.maxY=Math.max(l.maxY,c.maxY),c.type){case"Point":case"MultiPoint":return void function(a,h){let y=[];for(let A=0;A<h.geometry.length;A+=3)y.push(h.geometry[A],h.geometry[A+1]),a.numPoints++,a.numSimplified++;if(!y.length)return;let w={type:1,tags:h.tags||null,geometry:y};h.id!==null&&(w.id=h.id),a.features.push(w)}(l,c);case"LineString":return void function(a,h,y,w){let A=[];if(Xd(A,h.geometry,a,y,!1,!1),!A.length)return;let k=h.tags||null;if(w.lineMetrics){k={};for(let n in h.tags)k[n]=h.tags[n];k[jd]=h.geometry.start/h.geometry.size,k[Jd]=h.geometry.end/h.geometry.size}let W={type:2,tags:k,geometry:A};h.id!==null&&(W.id=h.id),a.features.push(W)}(l,c,p,d);case"MultiLineString":case"Polygon":return void function(a,h,y){let w=[];for(let k=0;k<h.geometry.length;k++)Xd(w,h.geometry[k],a,y,h.type==="Polygon",k===0);if(!w.length)return;let A={type:h.type==="Polygon"?3:2,tags:h.tags||null,geometry:w};h.id!==null&&(A.id=h.id),a.features.push(A)}(l,c,p);case"MultiPolygon":return void function(a,h,y){let w=[];for(let k=0;k<h.geometry.length;k++){let W=h.geometry[k];for(let n=0;n0&&c.size<(a?y:d))return void(p.numPoints+=c.points.length/3);let w=[];for(let A=0;Ay)&&(p.numSimplified++,w.push(c.points[A],c.points[A+1])),p.numPoints++;a&&function(A,k){let W=0;for(let n=0,q=A.length,C=q-2;n >3,h=this.pos;this.type=7&d,l(a,c,this),this.pos===h&&this.skip(d)}return c}readMessage(l,c){return this.readFields(l,c,this.readVarint()+this.pos)}readFixed32(){let l=this.dataView.getUint32(this.pos,!0);return this.pos+=4,l}readSFixed32(){let l=this.dataView.getInt32(this.pos,!0);return this.pos+=4,l}readFixed64(){let l=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*Td;return this.pos+=8,l}readSFixed64(){let l=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*Td;return this.pos+=8,l}readFloat(){let l=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,l}readDouble(){let l=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,l}readVarint(l){let c=this.buf,p,d;return d=c[this.pos++],p=127&d,d<128?p:(d=c[this.pos++],p|=(127&d)<<7,d<128?p:(d=c[this.pos++],p|=(127&d)<<14,d<128?p:(d=c[this.pos++],p|=(127&d)<<21,d<128?p:(d=c[this.pos],p|=(15&d)<>4,k<128)return Zr(a,A,h);if(k=w[y.pos++],A|=(127&k)<<3,k<128)return Zr(a,A,h);if(k=w[y.pos++],A|=(127&k)<<10,k<128)return Zr(a,A,h);if(k=w[y.pos++],A|=(127&k)<<17,k<128)return Zr(a,A,h);if(k=w[y.pos++],A|=(127&k)<<24,k<128)return Zr(a,A,h);if(k=w[y.pos++],A|=(1&k)<<31,k=12&&ko?ko.decode(this.buf.subarray(c,l)):function(p,d,a){let h="",y=d;for(;y239?4:w>223?3:w>191?2:1;if(y+q>a)break;q===1?w<128&&(n=w):q===2?(A=p[y+1],(192&A)==128&&(n=(31&w)<<6|63&A,n<=127&&(n=null))):q===3?(A=p[y+1],k=p[y+2],(192&A)==128&&(192&k)==128&&(n=(15&w)<<12|(63&A)<<6|63&k,(n=55296&&n<=57343)&&(n=null))):q===4&&(A=p[y+1],k=p[y+2],W=p[y+3],(192&A)==128&&(192&k)==128&&(192&W)==128&&(n=(15&w)<<18|(63&A)<<12|(63&k)<<6|63&W,(n=1114112)&&(n=null))),n===null?(n=65533,q=1):n>65535&&(n-=65536,h+=String.fromCharCode(n>>>10&1023|55296),n=56320|1023&n),h+=String.fromCharCode(n),y+=q}return h}(this.buf,c,l)}readBytes(){let l=this.readVarint()+this.pos,c=this.buf.subarray(this.pos,l);return this.pos=l,c}readPackedVarint(l=[],c){let p=this.readPackedEnd();for(;this.pos<p;)l.push(this.readVarint(c));return l}readPackedSVarint(l=[]){let c=this.readPackedEnd();for(;this.pos<c;)l.push(this.readSVarint());return l}readPackedBoolean(l=[]){let c=this.readPackedEnd();for(;this.pos<c;)l.push(this.readBoolean());return l}readPackedFloat(l=[]){let c=this.readPackedEnd();for(;this.pos<c;)l.push(this.readFloat());return l}readPackedDouble(l=[]){let c=this.readPackedEnd();for(;this.pos<c;)l.push(this.readDouble());return l}readPackedFixed32(l=[]){let c=this.readPackedEnd();for(;this.pos<c;)l.push(this.readFixed32());return l}readPackedSFixed32(l=[]){let c=this.readPackedEnd();for(;this.pos<c;)l.push(this.readSFixed32());return l}readPackedFixed64(l=[]){let c=this.readPackedEnd();for(;this.pos<c;)l.push(this.readFixed64());return l}readPackedSFixed64(l=[]){let c=this.readPackedEnd();for(;this.pos127;);else if(c===2)this.pos=this.readVarint()+this.pos;else if(c===5)this.pos+=4;else{if(c!==1)throw Error(`Unimplemented type: ${c}`);this.pos+=8}}writeTag(l,c){this.writeVarint(l<<3|c)}realloc(l){let c=this.length||16;for(;c268435455||l=0?(d=c%4294967296|0,a=c/4294967296|0):(d=~(-c%4294967296),a=~(-c/4294967296),4294967295^d?d=d+1|0:(d=0,a=a+1|0)),c>=18446744073709552000||c>>=7,w.buf[w.pos++]=127&h|128,h>>>=7,w.buf[w.pos++]=127&h|128,h>>>=7,w.buf[w.pos++]=127&h|128,w.buf[w.pos]=127&(h>>>=7)}(d,0,p),function(h,y){let w=(7&h)<>>=3)?128:0),h&&(y.buf[y.pos++]=127&h|((h>>>=7)?128:0),h&&(y.buf[y.pos++]=127&h|((h>>>=7)?128:0),h&&(y.buf[y.pos++]=127&h|((h>>>=7)?128:0),h&&(y.buf[y.pos++]=127&h|((h>>>=7)?128:0),h&&(y.buf[y.pos++]=127&h)))))}(a,p)}(l,this):(this.realloc(4),this.buf[this.pos++]=127&l|(l>127?128:0),l>>=7)|(l>127?128:0),l>>=7)|(l>127?128:0),l>>7&127))))}writeSVarint(l){this.writeVarint(l<0?2*-l-1:2*l)}writeBoolean(l){this.writeVarint(+l)}writeString(l){l=String(l),this.realloc(4*l.length),this.pos++;let c=this.pos;this.pos=function(d,a,h){for(let y,w,A=0;A55295&&y56319||A+1===a.length?(d[h++]=239,d[h++]=191,d[h++]=189):w=y;continue}if(y<56320){d[h++]=239,d[h++]=191,d[h++]=189,w=y;continue}y=w-55296<<10|y-56320|65536,w=null}else w&&(d[h++]=239,d[h++]=191,d[h++]=189,w=null);y<128?d[h++]=y:(y>6|192:(y>12|224:(d[h++]=y>>18|240,d[h++]=y>>12&63|128),d[h++]=y>>6&63|128),d[h++]=63&y|128)}return h}(this.buf,l,this.pos);let p=this.pos-c;p>=128&&Eo(c,p,this),this.pos=c-1,this.writeVarint(p),this.pos+=p}writeFloat(l){this.realloc(4),this.dataView.setFloat32(this.pos,l,!0),this.pos+=4}writeDouble(l){this.realloc(8),this.dataView.setFloat64(this.pos,l,!0),this.pos+=8}writeBytes(l){let c=l.length;this.writeVarint(c),this.realloc(c);for(let p=0;p=128&&Eo(p,d,this),this.pos=p-1,this.writeVarint(d),this.pos+=d}writeMessage(l,c,p){this.writeTag(l,2),this.writeRawMessage(c,p)}writePackedVarint(l,c){c.length&&this.writeMessage(l,Ik,c)}writePackedSVarint(l,c){c.length&&this.writeMessage(l,Yk,c)}writePackedBoolean(l,c){c.length&&this.writeMessage(l,Gk,c)}writePackedFloat(l,c){c.length&&this.writeMessage(l,zk,c)}writePackedDouble(l,c){c.length&&this.writeMessage(l,Ok,c)}writePackedFixed32(l,c){c.length&&this.writeMessage(l,Qk,c)}writePackedSFixed32(l,c){c.length&&this.writeMessage(l,jk,c)}writePackedFixed64(l,c){c.length&&this.writeMessage(l,Jk,c)}writePackedSFixed64(l,c){c.length&&this.writeMessage(l,Xk,c)}writeBytesField(l,c){this.writeTag(l,2),this.writeBytes(c)}writeFixed32Field(l,c){this.writeTag(l,5),this.writeFixed32(c)}writeSFixed32Field(l,c){this.writeTag(l,5),this.writeSFixed32(c)}writeFixed64Field(l,c){this.writeTag(l,1),this.writeFixed64(c)}writeSFixed64Field(l,c){this.writeTag(l,1),this.writeSFixed64(c)}writeVarintField(l,c){this.writeTag(l,0),this.writeVarint(c)}writeSVarintField(l,c){this.writeTag(l,0),this.writeSVarint(c)}writeStringField(l,c){this.writeTag(l,2),this.writeString(c)}writeFloatField(l,c){this.writeTag(l,5),this.writeFloat(c)}writeDoubleField(l,c){this.writeTag(l,1),this.writeDouble(c)}writeBooleanField(l,c){this.writeVarintField(l,+c)}}function Zr(l,c,p){return p?4294967296*c+(l>>>0):4294967296*(c>>>0)+(l>>>0)}function Eo(l,c,p){let d=c<=16383?1:c<=2097151?2:c=l;a--)p.buf[a+d]=p.buf[a]}function Ik(l,c){for(let p=0;p<l.length;p++)c.writeVarint(l[p])}function Yk(l,c){for(let p=0;p<l.length;p++)c.writeSVarint(l[p])}function zk(l,c){for(let p=0;p<l.length;p++)c.writeFloat(l[p])}function Ok(l,c){for(let p=0;p<l.length;p++)c.writeDouble(l[p])}function Gk(l,c){for(let p=0;p<l.length;p++)c.writeBoolean(l[p])}function Qk(l,c){for(let p=0;p<l.length;p++)c.writeFixed32(l[p])}function jk(l,c){for(let p=0;p<l.length;p++)c.writeSFixed32(l[p])}function Jk(l,c){for(let p=0;p<l.length;p++)c.writeFixed64(l[p])}function Xk(l,c){for(let p=0;pw.h-y.h);let d=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(c/0.95)),p),h:1/0}],a=0,h=0;for(let y of l)for(let w=d.length-1;w>=0;w--){let A=d[w];if(!(y.w>A.w||y.h>A.h)){if(y.x=A.x,y.y=A.y,h=Math.max(h,y.y+y.h),a=Math.max(a,y.x+y.w),y.w===A.w&&y.h===A.h){let k=d.pop();k&&wM.toCodeUnitIndex(d1));let Z=O(M.toString(),I);for(let d1 of Z){let m1=[...d1].map(()=>0);D.push(new Tr(d1,M.sections,m1))}}else if(Y){D=[],I=I.map((a1)=>M.toCodeUnitIndex(a1));let Z=0,d1=[];for(let a1 of M.text)d1.push(...Array(a1.length).fill(M.sectionIndex[Z])),Z++;let m1=Y(M.text,d1,I);for(let a1 of m1){let s1=[],w1="";for(let k1 of a1[0])s1.push(a1[1][w1.length]),w1+=k1;D.push(new Tr(a1[0],M.sections,s1))}}else D=function(Z,d1){let m1=[],a1=0;for(let s1 of d1)m1.push(Z.substring(a1,s1)),a1=s1;return a1<Z.length()&&m1.push(Z.substring(a1,Z.length())),m1}(M,I);let G=[],j={positionedLines:G,text:M.toString(),top:W[1],bottom:W[1],left:W[0],right:W[0],writingMode:n,iconsInText:!1,verticalizable:!1};return function(Z,d1,m1,a1,s1,w1,k1,y1,n1,Y1,U1,K1){let R1=0,_1=0,Cl=0,sl=0,ql=y1==="right"?1:y1==="left"?0:0.5,H0=k0/K1,Tl=0;for(let Il of s1){Il.trim();let d2=Il.getMaxScale(),Z0={positionedGlyphs:[],lineOffset:0};Z.positionedLines[Tl]=Z0;let b0=Z0.positionedGlyphs,A2=0;if(!Il.length()){_1+=w1,++Tl;continue}let I0=$k(a1,Il,H0),V2=0;for(let n0 of Il.text){let Gl=Il.getSection(V2),a0=n0.codePointAt(0),Zl=_k(n1,U1,a0),A0={glyph:a0,imageName:null,x:R1,y:_1+-17,vertical:Zl,scale:1,fontStack:"",sectionIndex:Il.getSectionIndex(V2),metrics:null,rect:null},u3;if("fontStack"in Gl){if(u3=ik(Gl,a0,Zl,I0,d1,m1),!u3)continue;A0.fontStack=Gl.fontStack}else{if(Z.iconsInText=!0,Gl.scale*=H0,u3=ek(Gl,Zl,d2,I0,a1),!u3)continue;A2=Math.max(A2,u3.imageOffset),A0.imageName=Gl.imageName}let{rect:Bu,metrics:w8,baselineOffset:r4}=u3;A0.y+=r4,A0.scale=Gl.scale,A0.metrics=w8,A0.rect=Bu,b0.push(A0),Zl?(Z.verticalizable=!0,R1+=("imageName"in Gl?w8.advance:k0)*Gl.scale+Y1):R1+=w8.advance*Gl.scale+Y1,V2++}b0.length!==0&&(Cl=Math.max(R1-Y1,Cl),tk(b0,0,b0.length-1,ql)),R1=0,Z0.lineOffset=Math.max(A2,(d2-1)*k0);let hu=w1*d2+A2;_1+=hu,sl=Math.max(hu,sl),++Tl}let{horizontalAlign:f0,verticalAlign:N0}=bd(k1);(function(Il,d2,Z0,b0,A2,I0,V2,hu,n0){let Gl=(d2-Z0)*A2,a0=0;a0=I0!==V2?-hu*b0- -17:-b0*n0*V2+0.5*V2;for(let Zl of Il)for(let A0 of Zl.positionedGlyphs)A0.x+=Gl,A0.y+=a0})(Z.positionedLines,ql,f0,N0,Cl,sl,w1,_1,s1.length),Z.top+=-N0*_1,Z.bottom=Z.top+_1,Z.left+=-f0*Cl,Z.right=Z.left+Cl}(j,c,p,d,D,y,w,A,n,k,q,B),!function(Z){for(let d1 of Z)if(d1.positionedGlyphs.length!==0)return!1;return!0}(G)&&j}function bd(l){let c=0.5,p=0.5;switch(l){case"right":case"top-right":case"bottom-right":c=1;break;case"left":case"top-left":case"bottom-left":c=0}switch(l){case"bottom":case"bottom-right":case"bottom-left":p=1;break;case"top":case"top-right":case"top-left":p=0}return{horizontalAlign:c,verticalAlign:p}}function $k(l,c,p){let d=c.getMaxScale()*k0,{maxImageWidth:a,maxImageHeight:h}=c.getMaxImageSize(l),y=Math.max(d,h*p);return{verticalLineContentWidth:Math.max(d,a*p),horizontalLineContentHeight:y}}function Ao(l){switch(l){case"top":return 0;case"center":return 0.5;default:return 1}}function _k(l,c,p){return!(l===V.ax.horizontal||!c&&!f5(p)||c&&(R7(p)||(d=p,/\p{sc=Arab}/u.test(String.fromCodePoint(d)))));var d}function ik(l,c,p,d,a,h){let y=h[l.fontStack],w=function(k,W,n,q){if(k==null?void 0:k.rect)return k;let C=W[n.fontStack],B=C==null?void 0:C[q];return B?{rect:null,metrics:B.metrics}:null}(y==null?void 0:y[c],a,l,c);if(w===null)return null;let A;if(p)A=d.verticalLineContentWidth-l.scale*k0;else{let k=Ao(l.verticalAlign);A=(d.horizontalLineContentHeight-l.scale*k0)*k}return{rect:w.rect,metrics:w.metrics,baselineOffset:A}}function ek(l,c,p,d,a){let h=a[l.imageName];if(!h)return null;let{paddedRect:y,displaySize:w}=h,A={width:w[0],height:w[1],left:1,top:-3,advance:c?w[1]:w[0]},k;if(c)k=d.verticalLineContentWidth-w[1]*l.scale;else{let W=Ao(l.verticalAlign);k=(d.horizontalLineContentHeight-w[1]*l.scale)*W}return{rect:y,metrics:A,baselineOffset:k,imageOffset:(c?w[0]:w[1])*l.scale-k0*p}}function tk(l,c,p,d){if(d===0)return;let a=l[p],h=(l[p].x+a.metrics.advance*a.scale)*d;for(let y=c;y<=p;y++)l[y].x-=h}function lE(l,c,p){let{horizontalAlign:d,verticalAlign:a}=bd(p),h=c[0]-l.displaySize[0]*d,y=c[1]-l.displaySize[1]*a;return{image:l,top:y,bottom:y+l.displaySize[1],left:h,right:h+l.displaySize[0]}}function Vo(l){var c,p;let{left:d,top:a}=l,h=l.right-d,y=l.bottom-a,w=(c=l.image.textFitWidth)!==null&&c!==void 0?c:"stretchOrShrink",A=(p=l.image.textFitHeight)!==null&&p!==void 0?p:"stretchOrShrink",k=(l.image.content[2]-l.image.content[0])/(l.image.content[3]-l.image.content[1]);if(A==="proportional"){if(w==="stretchOnly"&&h/yk){let W=Math.ceil(h/k);a*=W/y,y=W}return{x1:d,y1:a,x2:d+h,y2:a+y}}function Wo(l,c,p,d,a,h){let y=l.image,w;if(y.content){let D=y.content,I=y.pixelRatio||1;w=[D[0]/I,D[1]/I,y.displaySize[0]-D[2]/I,y.displaySize[1]-D[3]/I]}let A=c.left*h,k=c.right*h,W,n,q,C;p==="width"||p==="both"?(C=a[0]+A-d[3],n=a[0]+k+d[1]):(C=a[0]+(A+k-y.displaySize[0])/2,n=C+y.displaySize[0]);let B=c.top*h,M=c.bottom*h;return p==="height"||p==="both"?(W=a[1]+B-d[0],q=a[1]+M+d[2]):(W=a[1]+(B+M-y.displaySize[1])/2,q=W+y.displaySize[1]),{image:y,top:W,right:n,bottom:q,left:C,collisionPadding:w}}z1("ImagePosition",n9),z1("ImageAtlas",Zd),V.ax=void 0,(_3=V.ax||(V.ax={}))[_3.none=0]="none",_3[_3.horizontal=1]="horizontal",_3[_3.vertical=2]="vertical",_3[_3.horizontalOnly=3]="horizontalOnly";let t5=128,i3=32640;function Lo(l,c){let{expression:p}=c;if(p.kind==="constant")return{kind:"constant",layoutSize:p.evaluate(new Nl(l+1))};if(p.kind==="source")return{kind:"source"};{let{zoomStops:d,interpolationType:a}=p,h=0;for(;h<d.length&&d[h]<=l;)h++;h=Math.max(0,h-1);let y=h;for(;y<d.length&&d[y]<l+1;)y++;y=Math.min(d.length-1,y);let w=d[h],A=d[y];return p.kind==="composite"?{kind:"composite",minZoom:w,maxZoom:A,interpolationType:a}:{kind:"camera",minZoom:w,maxZoom:A,minSize:p.evaluate(new Nl(w)),maxSize:p.evaluate(new Nl(A)),interpolationType:a}}}function $d(l,c,p){let d="never",a=l.get(c);return a?d=a:l.get(p)&&(d="always"),d}let uE=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function V9(l,c,p,d,a,h,y,w,A,k,W,n,q){let C=w?Math.min(i3,Math.round(w[0])):0,B=w?Math.min(i3,Math.round(w[1])):0;l.emplaceBack(c,p,Math.round(32*d),Math.round(32*a),h,y,(C<h.id),this.index=l.index,this.pixelRatio=l.pixelRatio,this.sourceLayerIndex=l.sourceLayerIndex,this.hasDependencies=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[];let c=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Lo(this.zoom,c["text-size"]),this.iconSizeData=Lo(this.zoom,c["icon-size"]);let p=this.layers[0].layout,d=p.get("symbol-sort-key"),a=p.get("symbol-z-order");this.canOverlap=$d(p,"text-overlap","text-allow-overlap")!=="never"||$d(p,"icon-overlap","icon-allow-overlap")!=="never"||p.get("text-ignore-placement")||p.get("icon-ignore-placement"),this.sortFeaturesByKey=a!=="viewport-y"&&!d.isConstant(),this.sortFeaturesByY=(a==="viewport-y"||a==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,p.get("symbol-placement")==="point"&&(this.writingModes=p.get("text-writing-mode").map((h)=>V.ax[h])),this.stateDependentLayerIds=this.layers.filter((h)=>h.isStateDependent()).map((h)=>h.id),this.sourceID=l.sourceID}createArrays(){this.text=new W9(new au(this.layers,this.zoom,(l)=>l.startsWith("text"))),this.icon=new W9(new au(this.layers,this.zoom,(l)=>l.startsWith("icon"))),this.glyphOffsetArray=new P,this.lineVertexArray=new K,this.symbolInstances=new F,this.textAnchorOffsets=new U}calculateGlyphDependencies(l,c,p,d,a){for(let h of l)if(c[h.codePointAt(0)]=!0,(p||d)&&a){let y=d8[h];y&&(c[y.codePointAt(0)]=!0)}}populate(l,c,p){var d;let a=this.layers[0],h=a.layout,y=h.get("text-font"),w=h.get("text-field"),A=h.get("icon-image"),k=(w.value.kind!=="constant"||w.value.value instanceof Q0&&!w.value.value.isEmpty()||w.value.value.toString().length>0)&&(y.value.kind!=="constant"||y.value.value.length>0),W=A.value.kind!=="constant"||!!A.value.value||Object.keys(A.parameters).length>0,n=h.get("symbol-sort-key");if(this.features=[],!k&&!W)return;let{iconDependencies:q,glyphDependencies:C,availableImages:B}=c,M=new Nl(this.zoom);for(let{feature:D,id:I,index:O,sourceLayerIndex:Y}of l){let G=a._featureFilter.needGeometry,j=y5(D,G);if(!a._featureFilter.filter(M,j,p))continue;let Z,d1;if(G||(j.geometry=h5(D)),k){let a1=a.getValueAndResolveTokens("text-field",j,p,B),s1=Q0.factory(a1);this.hasRTLText||(this.hasRTLText=cE(s1)),(!this.hasRTLText||pu.getRTLTextPluginStatus()==="unavailable"||this.hasRTLText&&pu.isParsed())&&(Z=Uk(s1,a,j))}if(W){let a1=a.getValueAndResolveTokens("icon-image",j,p,B);d1=a1 instanceof w2?a1:w2.fromString(a1)}if(!Z&&!d1)continue;let m1=this.sortFeaturesByKey?n.evaluate(j,{},p):void 0;if(this.features.push({id:I,text:Z,icon:d1,index:O,sourceLayerIndex:Y,geometry:j.geometry,properties:D.properties,type:Qr.types[D.type],sortKey:m1}),d1&&(q[d1.name]=!0),Z){let a1=y.evaluate(j,{},p).join(","),s1=h.get("text-rotation-alignment")!=="viewport"&&h.get("symbol-placement")!=="point";this.allowVerticalPlacement=(d=this.writingModes)===null||d===void 0?void 0:d.includes(V.ax.vertical);for(let w1 of Z.sections)if(w1.image)q[w1.image.name]=!0;else{let k1=Wr(Z.toString()),y1=w1.fontStack||a1;C[y1]||(C[y1]={}),this.calculateGlyphDependencies(w1.text,C[y1],s1,this.allowVerticalPlacement,k1)}}}h.get("symbol-placement")==="line"&&(this.features=function(D){let I={},O={},Y=[],G=0;function j(a1){Y.push(D[a1]),G++}function Z(a1,s1,w1){let k1=O[a1];return delete O[a1],O[s1]=k1,Y[k1].geometry[0].pop(),Y[k1].geometry[0]=Y[k1].geometry[0].concat(w1[0]),k1}function d1(a1,s1,w1){let k1=I[s1];return delete I[s1],I[a1]=k1,Y[k1].geometry[0].shift(),Y[k1].geometry[0]=w1[0].concat(Y[k1].geometry[0]),k1}function m1(a1,s1,w1){let k1=w1?s1[0][s1[0].length-1]:s1[0][0];return`${a1}:${k1.x}:${k1.y}`}for(let a1=0;a1a1.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((D,I)=>D.sortKey-I.sortKey)}update(l,c,p){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(l,c,this.layers,{imagePositions:p}),this.icon.programConfigurations.updatePaintArrays(l,c,this.layers,{imagePositions:p}))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(l){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(l),this.iconCollisionBox.upload(l)),this.text.upload(l,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(l,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(l,c){let p=this.lineVertexArray.length;if(l.segment!==void 0){let d=l.dist(c[l.segment+1]),a=l.dist(c[l.segment]),h={};for(let y=l.segment+1;y<c.length;y++)h[y]={x:c[y].x,y:c[y].y,tileUnitDistanceFromAnchor:d},y=0;y--)h[y]={x:c[y].x,y:c[y].y,tileUnitDistanceFromAnchor:a},y>0&&(a+=c[y-1].dist(c[y]));for(let y=0;y<c.length;y++){let w=h[y];this.lineVertexArray.emplaceBack(w.x,w.y,w.tileUnitDistanceFromAnchor)}}return{lineStartIndex:p,lineLength:this.lineVertexArray.length-p}}addSymbols(l,c,p,d,a,h,y,w,A,k,W,n){let{indexArray:q,layoutVertexArray:C}=l,B=l.segments.prepareSegment(4*c.length,C,q,this.canOverlap?h.sortKey:void 0),M=this.glyphOffsetArray.length,D=B.vertexLength,I=this.allowVerticalPlacement&&y===V.ax.vertical?Math.PI/2:0,O=h.text&&h.text.sections;for(let Y=0;Y<c.length;Y++){let{tl:G,tr:j,bl:Z,br:d1,tex:m1,pixelOffsetTL:a1,pixelOffsetBR:s1,minFontScaleX:w1,minFontScaleY:k1,glyphOffset:y1,isSDF:n1,sectionIndex:Y1}=c[Y],U1=B.vertexLength,K1=y1[1];V9(C,w.x,w.y,G.x,K1+G.y,m1.x,m1.y,p,n1,a1.x,a1.y,w1,k1),V9(C,w.x,w.y,j.x,K1+j.y,m1.x+m1.w,m1.y,p,n1,s1.x,a1.y,w1,k1),V9(C,w.x,w.y,Z.x,K1+Z.y,m1.x,m1.y+m1.h,p,n1,a1.x,s1.y,w1,k1),V9(C,w.x,w.y,d1.x,K1+d1.y,m1.x+m1.w,m1.y+m1.h,p,n1,s1.x,s1.y,w1,k1),_d(l.dynamicLayoutVertexArray,w,I),q.emplaceBack(U1,U1+2,U1+1),q.emplaceBack(U1+1,U1+2,U1+3),B.vertexLength+=4,B.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(y1[0]),Y!==c.length-1&&Y1===c[Y+1].sectionIndex||l.programConfigurations.populatePaintArrays(C.length,h,h.index,{imagePositions:{},canonical:n,formattedSection:O==null?void 0:O[Y1]})}l.placedSymbolArray.emplaceBack(w.x,w.y,M,this.glyphOffsetArray.length-M,D,A,k,w.segment,p?p[0]:0,p?p[1]:0,d[0],d[1],y,0,!1,0,W)}_addCollisionDebugVertex(l,c,p,d,a,h){return c.emplaceBack(0,0),l.emplaceBack(p.x,p.y,d,a,Math.round(h.x),Math.round(h.y))}addCollisionDebugVertices(l,c,p,d,a,h,y){let w=a.segments.prepareSegment(4,a.layoutVertexArray,a.indexArray),A=w.vertexLength,k=a.layoutVertexArray,W=a.collisionVertexArray,n=y.anchorX,q=y.anchorY;this._addCollisionDebugVertex(k,W,h,n,q,new H(l,c)),this._addCollisionDebugVertex(k,W,h,n,q,new H(p,c)),this._addCollisionDebugVertex(k,W,h,n,q,new H(p,d)),this._addCollisionDebugVertex(k,W,h,n,q,new H(l,d)),w.vertexLength+=4;let C=a.indexArray;C.emplaceBack(A,A+1),C.emplaceBack(A+1,A+2),C.emplaceBack(A+2,A+3),C.emplaceBack(A+3,A),w.primitiveLength+=4}addDebugCollisionBoxes(l,c,p,d){for(let a=l;a<c;a++){let h=this.collisionBoxArray.get(a);this.addCollisionDebugVertices(h.x1,h.y1,h.x2,h.y2,d?this.textCollisionBox:this.iconCollisionBox,h.anchorPoint,p)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new L9(W1,oo.members,j1),this.iconCollisionBox=new L9(W1,oo.members,j1);for(let l=0;l<this.symbolInstances.length;l++){let c=this.symbolInstances.get(l);this.addDebugCollisionBoxes(c.textBoxStartIndex,c.textBoxEndIndex,c,!0),this.addDebugCollisionBoxes(c.verticalTextBoxStartIndex,c.verticalTextBoxEndIndex,c,!0),this.addDebugCollisionBoxes(c.iconBoxStartIndex,c.iconBoxEndIndex,c,!1),this.addDebugCollisionBoxes(c.verticalIconBoxStartIndex,c.verticalIconBoxEndIndex,c,!1)}}_deserializeCollisionBoxesForSymbol(l,c,p,d,a,h,y,w,A){let k={};for(let W=c;W<p;W++){let n=l.get(W);k.textBox={x1:n.x1,y1:n.y1,x2:n.x2,y2:n.y2,anchorPointX:n.anchorPointX,anchorPointY:n.anchorPointY},k.textFeatureIndex=n.featureIndex;break}for(let W=d;W<a;W++){let n=l.get(W);k.verticalTextBox={x1:n.x1,y1:n.y1,x2:n.x2,y2:n.y2,anchorPointX:n.anchorPointX,anchorPointY:n.anchorPointY},k.verticalTextFeatureIndex=n.featureIndex;break}for(let W=h;W<y;W++){let n=l.get(W);k.iconBox={x1:n.x1,y1:n.y1,x2:n.x2,y2:n.y2,anchorPointX:n.anchorPointX,anchorPointY:n.anchorPointY},k.iconFeatureIndex=n.featureIndex;break}for(let W=w;W<A;W++){let n=l.get(W);k.verticalIconBox={x1:n.x1,y1:n.y1,x2:n.x2,y2:n.y2,anchorPointX:n.anchorPointX,anchorPointY:n.anchorPointY},k.verticalIconFeatureIndex=n.featureIndex;break}return k}deserializeCollisionBoxes(l){this.collisionArrays=[];for(let c=0;c0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(l,c){let p=l.placedSymbolArray.get(c),d=p.vertexStartIndex+4*p.numGlyphs;for(let a=p.vertexStartIndex;a<d;a+=4)l.indexArray.emplaceBack(a,a+2,a+1),l.indexArray.emplaceBack(a+1,a+2,a+3)}getSortedSymbolIndexes(l){if(this.sortedAngle===l&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;let c=Math.sin(l),p=Math.cos(l),d=[],a=[],h=[];for(let y=0;yd[y]-d[w]||a[w]-a[y]),h}addToSortKeyRanges(l,c){let p=this.sortKeyRanges[this.sortKeyRanges.length-1];(p==null?void 0:p.sortKey)===c?p.symbolInstanceEnd=l+1:this.sortKeyRanges.push({sortKey:c,symbolInstanceStart:l,symbolInstanceEnd:l+1})}sortFeatures(l){if(this.sortFeaturesByY&&this.sortedAngle!==l&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(l),this.sortedAngle=l,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(let c of this.symbolInstanceIndexes){let p=this.symbolInstances.get(c);this.featureSortOrder.push(p.featureIndex);let d=[p.rightJustifiedTextSymbolIndex,p.centerJustifiedTextSymbolIndex,p.leftJustifiedTextSymbolIndex];for(let a=0;a=0&&d.indexOf(h)===a&&this.addIndicesForPlacedSymbol(this.text,h)}p.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,p.verticalPlacedTextSymbolIndex),p.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,p.placedIconSymbolIndex),p.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,p.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let Co,xo;z1("SymbolBucket",Vc,{omit:["layers","collisionBoxArray","features","compareText"]}),Vc.MAX_GLYPHS=65535,Vc.addDynamicAttributes=_d;var id={get paint(){return xo=xo||new C0({"icon-opacity":new $1(E1.paint_symbol["icon-opacity"]),"icon-color":new $1(E1.paint_symbol["icon-color"]),"icon-halo-color":new $1(E1.paint_symbol["icon-halo-color"]),"icon-halo-width":new $1(E1.paint_symbol["icon-halo-width"]),"icon-halo-blur":new $1(E1.paint_symbol["icon-halo-blur"]),"icon-translate":new T1(E1.paint_symbol["icon-translate"]),"icon-translate-anchor":new T1(E1.paint_symbol["icon-translate-anchor"]),"text-opacity":new $1(E1.paint_symbol["text-opacity"]),"text-color":new $1(E1.paint_symbol["text-color"],{runtimeType:y2,getOverride:(l)=>l.textColor,hasOverride:(l)=>!!l.textColor}),"text-halo-color":new $1(E1.paint_symbol["text-halo-color"]),"text-halo-width":new $1(E1.paint_symbol["text-halo-width"]),"text-halo-blur":new $1(E1.paint_symbol["text-halo-blur"]),"text-translate":new T1(E1.paint_symbol["text-translate"]),"text-translate-anchor":new T1(E1.paint_symbol["text-translate-anchor"])})},get layout(){return Co=Co||new C0({"symbol-placement":new T1(E1.layout_symbol["symbol-placement"]),"symbol-spacing":new T1(E1.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new T1(E1.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new $1(E1.layout_symbol["symbol-sort-key"]),"symbol-z-order":new T1(E1.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new T1(E1.layout_symbol["icon-allow-overlap"]),"icon-overlap":new T1(E1.layout_symbol["icon-overlap"]),"icon-ignore-placement":new T1(E1.layout_symbol["icon-ignore-placement"]),"icon-optional":new T1(E1.layout_symbol["icon-optional"]),"icon-rotation-alignment":new T1(E1.layout_symbol["icon-rotation-alignment"]),"icon-size":new $1(E1.layout_symbol["icon-size"]),"icon-text-fit":new T1(E1.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new T1(E1.layout_symbol["icon-text-fit-padding"]),"icon-image":new $1(E1.layout_symbol["icon-image"]),"icon-rotate":new $1(E1.layout_symbol["icon-rotate"]),"icon-padding":new $1(E1.layout_symbol["icon-padding"]),"icon-keep-upright":new T1(E1.layout_symbol["icon-keep-upright"]),"icon-offset":new $1(E1.layout_symbol["icon-offset"]),"icon-anchor":new $1(E1.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new T1(E1.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new T1(E1.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new T1(E1.layout_symbol["text-rotation-alignment"]),"text-field":new $1(E1.layout_symbol["text-field"]),"text-font":new $1(E1.layout_symbol["text-font"]),"text-size":new $1(E1.layout_symbol["text-size"]),"text-max-width":new $1(E1.layout_symbol["text-max-width"]),"text-line-height":new T1(E1.layout_symbol["text-line-height"]),"text-letter-spacing":new $1(E1.layout_symbol["text-letter-spacing"]),"text-justify":new $1(E1.layout_symbol["text-justify"]),"text-radial-offset":new $1(E1.layout_symbol["text-radial-offset"]),"text-variable-anchor":new T1(E1.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new $1(E1.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new $1(E1.layout_symbol["text-anchor"]),"text-max-angle":new T1(E1.layout_symbol["text-max-angle"]),"text-writing-mode":new T1(E1.layout_symbol["text-writing-mode"]),"text-rotate":new $1(E1.layout_symbol["text-rotate"]),"text-padding":new T1(E1.layout_symbol["text-padding"]),"text-keep-upright":new T1(E1.layout_symbol["text-keep-upright"]),"text-transform":new $1(E1.layout_symbol["text-transform"]),"text-offset":new $1(E1.layout_symbol["text-offset"]),"text-allow-overlap":new T1(E1.layout_symbol["text-allow-overlap"]),"text-overlap":new T1(E1.layout_symbol["text-overlap"]),"text-ignore-placement":new T1(E1.layout_symbol["text-ignore-placement"]),"text-optional":new T1(E1.layout_symbol["text-optional"])})}};class ed{constructor(l){if(l.property.overrides===void 0)throw Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=l.property.overrides?l.property.overrides.runtimeType:$u,this.defaultValue=l}evaluate(l){if(l.formattedSection){let c=this.defaultValue.property.overrides;if(c==null?void 0:c.hasOverride(l.formattedSection))return c.getOverride(l.formattedSection)}return l.feature&&l.featureState?this.defaultValue.evaluate(l.feature,l.featureState):this.defaultValue.property.specification.default}eachChild(l){this.defaultValue.isConstant()||l(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}z1("FormatSectionOverride",ed,{omit:["defaultValue"]});class C9 extends r2{constructor(l,c){super(l,id,c)}recalculate(l,c){if(super.recalculate(l,c),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout._values["icon-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout._values["text-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")==="map"?"map":"viewport"),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),this.layout.get("symbol-placement")==="point"){let p=this.layout.get("text-writing-mode");if(p){let d=[];for(let a of p)d.includes(a)||d.push(a);this.layout._values["text-writing-mode"]=d}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(l,c,p,d){let a=this.layout.get(l).evaluate(c,{},p,d),h=this._unevaluatedLayout._values[l];return h.isDataDriven()||i4(h.value)||!a?a:function(y,w){return w.replace(/{([^{}]+)}/g,(A,k)=>y&&(k in y)?String(y[k]):"")}(c.properties,a)}createBucket(l){return new Vc(l)}queryRadius(){return 0}queryIntersectsFeature(){throw Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(let l of id.paint.overridableProperties){if(!C9.hasPaintOverride(this.layout,l))continue;let c=this.paint.get(l),p=new ed(c),d=new O5(p,c.property.specification),a=null;a=c.value.kind==="constant"||c.value.kind==="source"?new H3("source",d):new e4("composite",d,c.value.zoomStops),this.paint._values[l]=new E2(c.property,a,c.parameters)}}_handleOverridablePaintPropertyUpdate(l,c,p){return!(!this.layout||c.isDataDriven()||p.isDataDriven())&&C9.hasPaintOverride(this.layout,l)}static hasPaintOverride(l,c){let p=l.get("text-field"),d=id.paint.properties[c],a=!1,h=(y)=>{var w;for(let A of y)if((w=d.overrides)===null||w===void 0?void 0:w.hasOverride(A))return void(a=!0)};if(p.value.kind==="constant"&&p.value.value instanceof Q0)h(p.value.value.sections);else if(p.value.kind==="source"||p.value.kind==="composite"){let y=(A)=>{a||(A instanceof t2&&_l(A.value)===P4?h(A.value.sections):A instanceof D5?h(A.sections):A.eachChild(y))},w=p.value;w._styleExpression&&y(w._styleExpression.expression)}return a}}let No;var rE={get paint(){return No=No||new C0({"background-color":new T1(E1.paint_background["background-color"]),"background-pattern":new Pr(E1.paint_background["background-pattern"]),"background-opacity":new T1(E1.paint_background["background-opacity"])})}};class Fo extends r2{constructor(l,c){super(l,rE,c)}}class qo extends r2{constructor(l,c){super(l,{},c),this.onAdd=(p)=>{this.implementation.onAdd&&this.implementation.onAdd(p,p.painter.context.gl)},this.onRemove=(p)=>{this.implementation.onRemove&&this.implementation.onRemove(p,p.painter.context.gl)},this.implementation=l}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw Error("Custom layers cannot be serialized")}}class Po{constructor(l){this._methodToThrottle=l,this._triggered=!1,this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()}}trigger(){var l;this._triggered||(this._triggered=!0,(l=this._channel)===null||l===void 0||l.port1.postMessage(!0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}}let pE={once:!0},td=6371008.8;class e3{constructor(l,c){if(isNaN(l)||isNaN(c))throw Error(`Invalid LngLat object: (${l}, ${c})`);if(this.lng=+l,this.lat=+c,this.lat>90||this.lat<-90)throw Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new e3(Tc(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(l){let c=Math.PI/180,p=this.lat*c,d=l.lat*c,a=Math.sin(p)*Math.sin(d)+Math.cos(p)*Math.cos(d)*Math.cos((l.lng-this.lng)*c);return td*Math.acos(Math.min(a,1))}static convert(l){if(l instanceof e3)return l;if(Array.isArray(l)&&(l.length===2||l.length===3))return new e3(Number(l[0]),Number(l[1]));if(!Array.isArray(l)&&typeof l=="object"&&l!==null)return new e3(Number("lng"in l?l.lng:l.lon),Number(l.lat));throw Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, an object {lon: , lat: }, or an array of [, ]")}}let Mo=2*Math.PI*td;function Bo(l){return Mo*Math.cos(l*Math.PI/180)}function Ko(l){return(180+l)/360}function Uo(l){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+l*Math.PI/360)))/360}function Do(l,c){return l/Bo(c)}function Ro(l){return 360*l-180}function x9(l){return 360/Math.PI*Math.atan(Math.exp((180-360*l)*Math.PI/180))-90}function Ho(l,c){return l*Bo(x9(c))}class g8{constructor(l,c,p=0){this.x=+l,this.y=+c,this.z=+p}static fromLngLat(l,c=0){let p=e3.convert(l);return new g8(Ko(p.lng),Uo(p.lat),Do(c,p.lat))}toLngLat(){return new e3(Ro(this.x),x9(this.y))}toAltitude(){return Ho(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/Mo*(l=x9(this.y),1/Math.cos(l*Math.PI/180));var l}}function Io(l,c,p){var d=2*Math.PI*6378137/256/Math.pow(2,p);return[l*d-2*Math.PI*6378137/2,c*d-2*Math.PI*6378137/2]}class N9{constructor(l,c,p){if(!function(d,a,h){return!(d25||h=Math.pow(2,d)||a=Math.pow(2,d))}(l,c,p))throw Error(`x=${c}, y=${p}, z=${l} outside of bounds. 0<=x<${Math.pow(2,l)}, 0<=y<${Math.pow(2,l)} 0<=z0;B--){let M=1<1?"@2x":"").replace(/{quadkey}/g,k).replace(/{bbox-epsg-3857}/g,d)}isChildOf(l){let c=this.z-l.z;return c>0&&l.x===this.x>>c&&l.y===this.y>>c}getTilePoint(l){let c=Math.pow(2,this.z);return new H((l.x*c-this.x)*ll,(l.y*c-this.y)*ll)}toString(){return`${this.z}/${this.x}/${this.y}`}}class lm{constructor(l,c){this.wrap=l,this.canonical=c,this.key=br(l,c.z,c.z,c.x,c.y)}}class K2{constructor(l,c,p,d,a){if(this.terrainRttPosMatrix32f=null,l = z; overscaledZ = ${l}; z = ${p}`);this.overscaledZ=l,this.wrap=c,this.canonical=new N9(p,+d,+a),this.key=br(c,l,p,d,a)}clone(){return new K2(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(l){return this.overscaledZ===l.overscaledZ&&this.wrap===l.wrap&&this.canonical.equals(l.canonical)}scaledTo(l){if(l>this.overscaledZ)throw Error(`targetZ > this.overscaledZ; targetZ = ${l}; overscaledZ = ${this.overscaledZ}`);let c=this.canonical.z-l;return l>this.canonical.z?new K2(l,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new K2(l,this.wrap,l,this.canonical.x>>c,this.canonical.y>>c)}isOverscaled(){return this.overscaledZ>this.canonical.z}calculateScaledKey(l,c){if(l>this.overscaledZ)throw Error(`targetZ > this.overscaledZ; targetZ = ${l}; overscaledZ = ${this.overscaledZ}`);let p=this.canonical.z-l;return l>this.canonical.z?br(this.wrap*+c,l,this.canonical.z,this.canonical.x,this.canonical.y):br(this.wrap*+c,l,l,this.canonical.x>>p,this.canonical.y>>p)}isChildOf(l){if(l.wrap!==this.wrap)return!1;if(this.overscaledZ-l.overscaledZ0;let c=this.canonical.z-l.canonical.z;return!(c>c&&l.canonical.y===this.canonical.y>>c}children(l){if(this.overscaledZ>=l)return[new K2(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];let c=this.canonical.z+1,p=2*this.canonical.x,d=2*this.canonical.y;return[new K2(c,this.wrap,c,p,d),new K2(c,this.wrap,c,p+1,d),new K2(c,this.wrap,c,p,d+1),new K2(c,this.wrap,c,p+1,d+1)]}isLessThan(l){return this.wrapl.wrap)&&(this.overscaledZl.overscaledZ)&&(this.canonical.xl.canonical.x)&&this.canonical.y=0&&l =0&&c<p)return{tileID:this,x:l,y:c};let d=Math.floor(l/p),a=Math.floor(c/p),h=l-d*p,y=c-a*p,w=this.canonical.z,A=1<<w,k=this.canonical.y+a;if(k=A)return null;let W=this.canonical.x+d,n=this.wrap;return W=A&&(n+=Math.floor(W/A),W%=A),{tileID:new K2(this.overscaledZ,n,w,W,k),x:h,y}}}function br(l,c,p,d,a){(l*=2)<0&&(l=-1*l-1);let h=1< this.maxX||this.minY>this.maxY)&&(this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0),this}shrinkBy(l){return this.expandBy(-l)}map(l){let c=new Wc;return c.extend(l(new H(this.minX,this.minY))),c.extend(l(new H(this.maxX,this.minY))),c.extend(l(new H(this.minX,this.maxY))),c.extend(l(new H(this.maxX,this.maxY))),c}static fromPoints(l){let c=new Wc;for(let p of l)c.extend(p);return c}contains(l){return l.x>=this.minX&&l.x=this.minY&&l.ythis.maxX}width(){return this.maxX-this.minX}height(){return this.maxY-this.minY}covers(l){return!this.empty()&&!l.empty()&&l.minX>=this.minX&&l.maxX=this.minY&&l.maxY<=this.maxY}intersects(l){return!this.empty()&&!l.empty()&&l.minX=this.minX&&l.minY=this.minY}}class um{constructor(l){this._stringToNumber={},this._numberToString=[];for(let c=0;c=this._numberToString.length)throw Error(`Out of bounds. Index requested n=${l} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[l]}}class cm{constructor(l,c,p,d,a){this.type="Feature",this._vectorTileFeature=l,this._x=p,this._y=d,this._z=c,this.properties=l.properties,this.id=a}projectPoint(l,c,p,d){return[360*(l.x+c)/d-180,360/Math.PI*Math.atan(Math.exp((1-2*(l.y+p)/d)*Math.PI))-90]}projectLine(l,c,p,d){return l.map((a)=>this.projectPoint(a,c,p,d))}get geometry(){if(this._geometry)return this._geometry;let l=this._vectorTileFeature,c=l.extent*Math.pow(2,this._z),p=l.extent*this._x,d=l.extent*this._y,a=l.loadGeometry();switch(l.type){case 1:{let h=[];for(let w of a)h.push(w[0]);let y=this.projectLine(h,p,d,c);this._geometry=h.length===1?{type:"Point",coordinates:y[0]}:{type:"MultiPoint",coordinates:y};break}case 2:{let h=a.map((y)=>this.projectLine(y,p,d,c));this._geometry=h.length===1?{type:"LineString",coordinates:h[0]}:{type:"MultiLineString",coordinates:h};break}case 3:{let h=Ha(a),y=[];for(let w of h)y.push(w.map((A)=>this.projectLine(A,p,d,c)));this._geometry=y.length===1?{type:"Polygon",coordinates:y[0]}:{type:"MultiPolygon",coordinates:y};break}default:throw Error(`unknown feature type: ${l.type}`)}return this._geometry}set geometry(l){this._geometry=l}toJSON(){let l={geometry:this.geometry};for(let c in this)c!=="_geometry"&&c!=="_vectorTileFeature"&&c!=="_x"&&c!=="_y"&&c!=="_z"&&(l[c]=this[c]);return l}}class Lc{constructor(l,c,p){this._name=l,this.dataBuffer=c,typeof p=="number"?this._size=p:(this.nullabilityBuffer=p,this._size=p.size())}getValue(l){return this.nullabilityBuffer&&!this.nullabilityBuffer.get(l)?null:this.getValueFromBuffer(l)}has(l){return this.nullabilityBuffer?.get(l)||!this.nullabilityBuffer}get name(){return this._name}get size(){return this._size}}class v8 extends Lc{}class F9 extends v8{getValueFromBuffer(l){return this.dataBuffer[l]}}class q9 extends v8{getValueFromBuffer(l){return this.dataBuffer[l]}}class rm extends Lc{constructor(l,c,p,d){super(l,c,d),this.delta=p}}class P9 extends rm{constructor(l,c,p,d){super(l,Int32Array.of(c),p,d)}getValueFromBuffer(l){return this.dataBuffer[0]+l*this.delta}}class M9 extends Lc{constructor(l,c,p,d){super(l,d?Int32Array.of(c):Uint32Array.of(c),p)}getValueFromBuffer(l){return this.dataBuffer[0]}}class Yo{constructor(l,c,p,d,a=4096){this._name=l,this._geometryVector=c,this._idVector=p,this._propertyVectors=d,this._extent=a}get name(){return this._name}get idVector(){return this._idVector}get geometryVector(){return this._geometryVector}get propertyVectors(){return this._propertyVectors}getPropertyVector(l){return this.propertyVectorsMap||(this.propertyVectorsMap=new Map(this._propertyVectors.map((c)=>[c.name,c]))),this.propertyVectorsMap.get(l)}get numFeatures(){return this.geometryVector.numGeometries}get extent(){return this._extent}getFeatures(){let l=[],c=this.geometryVector.getGeometries();for(let p=0;p<this.numFeatures;p++){let d;if(this.idVector){let y=this.idVector.getValue(p);d=this.containsMaxSafeIntegerValues(this.idVector)&&y!==null?Number(y):y}let a={coordinates:c[p],type:this.geometryVector.geometryType(p)},h={};for(let y of this.propertyVectors){if(!y)continue;let w=y.name,A=y.getValue(p);A!==null&&(h[w]=A)}l.push({id:d,geometry:a,properties:h})}return l}containsMaxSafeIntegerValues(l){return l instanceof F9||l instanceof M9||l instanceof P9||l instanceof q9}}class pm{constructor(l){this.value=l}get(){return this.value}set(l){this.value=l}increment(){return this.value++}add(l){this.value+=l}}var hl,t3;(function(l){l.NONE="NONE",l.DELTA="DELTA",l.COMPONENTWISE_DELTA="COMPONENTWISE_DELTA",l.RLE="RLE",l.MORTON="MORTON",l.PDE="PDE"})(hl||(hl={})),function(l){l.NONE="NONE",l.FAST_PFOR="FAST_PFOR",l.VARINT="VARINT",l.ALP="ALP"}(t3||(t3={}));let fm=new Uint32Array(33);fm[0]=0;for(let l=1;l>>32-l;let dm=fm,l3=256;function mm(l,c){return l-l%c}function fE(l){let c=l>>>0;return((255&c)<<24|(65280&c)<>>8&65280|c>>>24&255)>>>0}let gm=function(){if(!Number.isFinite(65536))return 65536;let l=mm(Math.floor(65536),l3);return l===0?l3:l}(),dE=3*gm/l3+gm|0;function zo(){let l=new Uint8Array(dE);return{dataToBePacked:Array(33),dataPointers:new Int32Array(33),byteContainer:l,byteContainerI32:new Int32Array(l.buffer,l.byteOffset,l.byteLength>>>2),exceptionSizes:new Int32Array(33)}}function mE(l,c,p,d,a){switch(a){case 1:(function(h,y,w,A){let k=A,W=y;for(let n=0;n>>0;w[k++]=q>>>0&1,w[k++]=q>>>1&1,w[k++]=q>>>2&1,w[k++]=q>>>3&1,w[k++]=q>>>4&1,w[k++]=q>>>5&1,w[k++]=q>>>6&1,w[k++]=q>>>7&1,w[k++]=q>>>8&1,w[k++]=q>>>9&1,w[k++]=q>>>10&1,w[k++]=q>>>11&1,w[k++]=q>>>12&1,w[k++]=q>>>13&1,w[k++]=q>>>14&1,w[k++]=q>>>15&1,w[k++]=q>>>16&1,w[k++]=q>>>17&1,w[k++]=q>>>18&1,w[k++]=q>>>19&1,w[k++]=q>>>20&1,w[k++]=q>>>21&1,w[k++]=q>>>22&1,w[k++]=q>>>23&1,w[k++]=q>>>24&1,w[k++]=q>>>25&1,w[k++]=q>>>26&1,w[k++]=q>>>27&1,w[k++]=q>>>28&1,w[k++]=q>>>29&1,w[k++]=q>>>30&1,w[k++]=q>>>31&1}})(l,c,p,d);break;case 2:(function(h,y,w,A){let k=A,W=y;for(let n=0;n>>0,C=h[W++]>>>0;w[k++]=q>>>0&3,w[k++]=q>>>2&3,w[k++]=q>>>4&3,w[k++]=q>>>6&3,w[k++]=q>>>8&3,w[k++]=q>>>10&3,w[k++]=q>>>12&3,w[k++]=q>>>14&3,w[k++]=q>>>16&3,w[k++]=q>>>18&3,w[k++]=q>>>20&3,w[k++]=q>>>22&3,w[k++]=q>>>24&3,w[k++]=q>>>26&3,w[k++]=q>>>28&3,w[k++]=q>>>30&3,w[k++]=C>>>0&3,w[k++]=C>>>2&3,w[k++]=C>>>4&3,w[k++]=C>>>6&3,w[k++]=C>>>8&3,w[k++]=C>>>10&3,w[k++]=C>>>12&3,w[k++]=C>>>14&3,w[k++]=C>>>16&3,w[k++]=C>>>18&3,w[k++]=C>>>20&3,w[k++]=C>>>22&3,w[k++]=C>>>24&3,w[k++]=C>>>26&3,w[k++]=C>>>28&3,w[k++]=C>>>30&3}})(l,c,p,d);break;case 3:(function(h,y,w,A){let k=A,W=y;for(let n=0;n>>0,C=h[W++]>>>0,B=h[W++]>>>0;w[k++]=q>>>0&7,w[k++]=q>>>3&7,w[k++]=q>>>6&7,w[k++]=q>>>9&7,w[k++]=q>>>12&7,w[k++]=q>>>15&7,w[k++]=q>>>18&7,w[k++]=q>>>21&7,w[k++]=q>>>24&7,w[k++]=q>>>27&7,w[k++]=7&(q>>>30|(1&C)<>>1&7,w[k++]=C>>>4&7,w[k++]=C>>>7&7,w[k++]=C>>>10&7,w[k++]=C>>>13&7,w[k++]=C>>>16&7,w[k++]=C>>>19&7,w[k++]=C>>>22&7,w[k++]=C>>>25&7,w[k++]=C>>>28&7,w[k++]=7&(C>>>31|(3&B)<>>2&7,w[k++]=B>>>5&7,w[k++]=B>>>8&7,w[k++]=B>>>11&7,w[k++]=B>>>14&7,w[k++]=B>>>17&7,w[k++]=B>>>20&7,w[k++]=B>>>23&7,w[k++]=B>>>26&7,w[k++]=B>>>29&7}})(l,c,p,d);break;case 4:(function(h,y,w,A){let k=A,W=y;for(let n=0;n>>0,C=h[W++]>>>0,B=h[W++]>>>0,M=h[W++]>>>0;w[k++]=q>>>0&15,w[k++]=q>>>4&15,w[k++]=q>>>8&15,w[k++]=q>>>12&15,w[k++]=q>>>16&15,w[k++]=q>>>20&15,w[k++]=q>>>24&15,w[k++]=q>>>28&15,w[k++]=C>>>0&15,w[k++]=C>>>4&15,w[k++]=C>>>8&15,w[k++]=C>>>12&15,w[k++]=C>>>16&15,w[k++]=C>>>20&15,w[k++]=C>>>24&15,w[k++]=C>>>28&15,w[k++]=B>>>0&15,w[k++]=B>>>4&15,w[k++]=B>>>8&15,w[k++]=B>>>12&15,w[k++]=B>>>16&15,w[k++]=B>>>20&15,w[k++]=B>>>24&15,w[k++]=B>>>28&15,w[k++]=M>>>0&15,w[k++]=M>>>4&15,w[k++]=M>>>8&15,w[k++]=M>>>12&15,w[k++]=M>>>16&15,w[k++]=M>>>20&15,w[k++]=M>>>24&15,w[k++]=M>>>28&15}})(l,c,p,d);break;case 5:(function(h,y,w,A){let k=A,W=y;for(let n=0;n>>0,C=h[W++]>>>0,B=h[W++]>>>0,M=h[W++]>>>0,D=h[W++]>>>0;w[k++]=q>>>0&31,w[k++]=q>>>5&31,w[k++]=q>>>10&31,w[k++]=q>>>15&31,w[k++]=q>>>20&31,w[k++]=q>>>25&31,w[k++]=31&(q>>>30|(7&C)<>>3&31,w[k++]=C>>>8&31,w[k++]=C>>>13&31,w[k++]=C>>>18&31,w[k++]=C>>>23&31,w[k++]=31&(C>>>28|(1&B)<>>1&31,w[k++]=B>>>6&31,w[k++]=B>>>11&31,w[k++]=B>>>16&31,w[k++]=B>>>21&31,w[k++]=B>>>26&31,w[k++]=31&(B>>>31|(15&M)<>>4&31,w[k++]=M>>>9&31,w[k++]=M>>>14&31,w[k++]=M>>>19&31,w[k++]=M>>>24&31,w[k++]=31&(M>>>29|(3&D)<>>2&31,w[k++]=D>>>7&31,w[k++]=D>>>12&31,w[k++]=D>>>17&31,w[k++]=D>>>22&31,w[k++]=D>>>27&31}})(l,c,p,d);break;case 6:(function(h,y,w,A){let k=A,W=y;for(let n=0;n>>0,C=h[W++]>>>0,B=h[W++]>>>0,M=h[W++]>>>0,D=h[W++]>>>0,I=h[W++]>>>0;w[k++]=q>>>0&63,w[k++]=q>>>6&63,w[k++]=q>>>12&63,w[k++]=q>>>18&63,w[k++]=q>>>24&63,w[k++]=63&(q>>>30|(15&C)<>>4&63,w[k++]=C>>>10&63,w[k++]=C>>>16&63,w[k++]=C>>>22&63,w[k++]=63&(C>>>28|(3&B)<>>2&63,w[k++]=B>>>8&63,w[k++]=B>>>14&63,w[k++]=B>>>20&63,w[k++]=B>>>26&63,w[k++]=M>>>0&63,w[k++]=M>>>6&63,w[k++]=M>>>12&63,w[k++]=M>>>18&63,w[k++]=M>>>24&63,w[k++]=63&(M>>>30|(15&D)<>>4&63,w[k++]=D>>>10&63,w[k++]=D>>>16&63,w[k++]=D>>>22&63,w[k++]=63&(D>>>28|(3&I)<>>2&63,w[k++]=I>>>8&63,w[k++]=I>>>14&63,w[k++]=I>>>20&63,w[k++]=I>>>26&63}})(l,c,p,d);break;case 7:(function(h,y,w,A){let k=A,W=y;for(let n=0;n>>0,C=h[W++]>>>0,B=h[W++]>>>0,M=h[W++]>>>0,D=h[W++]>>>0,I=h[W++]>>>0,O=h[W++]>>>0;w[k++]=q>>>0&127,w[k++]=q>>>7&127,w[k++]=q>>>14&127,w[k++]=q>>>21&127,w[k++]=127&(q>>>28|(7&C)<>>3&127,w[k++]=C>>>10&127,w[k++]=C>>>17&127,w[k++]=C>>>24&127,w[k++]=127&(C>>>31|(63&B)<>>6&127,w[k++]=B>>>13&127,w[k++]=B>>>20&127,w[k++]=127&(B>>>27|(3&M)<>>2&127,w[k++]=M>>>9&127,w[k++]=M>>>16&127,w[k++]=M>>>23&127,w[k++]=127&(M>>>30|(31&D)<>>5&127,w[k++]=D>>>12&127,w[k++]=D>>>19&127,w[k++]=127&(D>>>26|(1&I)<>>1&127,w[k++]=I>>>8&127,w[k++]=I>>>15&127,w[k++]=I>>>22&127,w[k++]=127&(I>>>29|(15&O)<>>4&127,w[k++]=O>>>11&127,w[k++]=O>>>18&127,w[k++]=O>>>25&127}})(l,c,p,d);break;case 8:(function(h,y,w,A){let k=A,W=y;for(let n=0;n>>0,C=h[W++]>>>0,B=h[W++]>>>0,M=h[W++]>>>0,D=h[W++]>>>0,I=h[W++]>>>0,O=h[W++]>>>0,Y=h[W++]>>>0;w[k++]=q>>>0&255,w[k++]=q>>>8&255,w[k++]=q>>>16&255,w[k++]=q>>>24&255,w[k++]=C>>>0&255,w[k++]=C>>>8&255,w[k++]=C>>>16&255,w[k++]=C>>>24&255,w[k++]=B>>>0&255,w[k++]=B>>>8&255,w[k++]=B>>>16&255,w[k++]=B>>>24&255,w[k++]=M>>>0&255,w[k++]=M>>>8&255,w[k++]=M>>>16&255,w[k++]=M>>>24&255,w[k++]=D>>>0&255,w[k++]=D>>>8&255,w[k++]=D>>>16&255,w[k++]=D>>>24&255,w[k++]=I>>>0&255,w[k++]=I>>>8&255,w[k++]=I>>>16&255,w[k++]=I>>>24&255,w[k++]=O>>>0&255,w[k++]=O>>>8&255,w[k++]=O>>>16&255,w[k++]=O>>>24&255,w[k++]=Y>>>0&255,w[k++]=Y>>>8&255,w[k++]=Y>>>16&255,w[k++]=Y>>>24&255}})(l,c,p,d);break;case 16:(function(h,y,w,A){let k=A,W=y;for(let n=0;n>>0;w[k++]=65535&q,w[k++]=q>>>16&65535}})(l,c,p,d);break;default:(function(h,y,w,A,k){let W=dm[k]>>>0,n=y,q=0,C=h[n]>>>0,B=A;for(let M=0;M<8;M++){for(let D=0;D<32;D++)if(q+k>>q&W,q+=k,q===32&&(q=0,n++,D!==31&&(C=h[n]>>>0));else{let I=32-q,O=C>>>q;n++,C=h[n]>>>0;let Y=k-I;w[B+D]=(O|(C&-1>>>32-Y>>>0)<<I)&W,q=Y}B+=32,q=0,M>>0)}})(l,c,p,d,a)}return c+(a<c)throw Error(`FastPFOR decode: byteContainer underflow at block=${d} (need 2 bytes for [bitWidth, exceptionCount], bytePos=${p}, byteSize=${c})`);let a=l[p++],h=l[p++];if(a>32)throw Error(`FastPFOR decode: invalid bitWidth=${a} at block=${d} (expected 0..32). This likely indicates corrupted or truncated input.`);return{bitWidth:a,exceptionCount:h,bytePosIn:p}}function vE(l,c,p,d,a,h,y,w,A){let{maxBits:k,exceptionBitWidth:W,bytePosIn:n}=function(D,I,O,Y,G,j){if(O+1>I)throw Error(`FastPFOR decode: exception header underflow at block=${j} (need 1 byte for maxBits, bytePos=${O}, byteSize=${I})`);let Z=D[O++];if(Z32)throw Error(`FastPFOR decode: invalid maxBits=${Z} at block=${j} (bitWidth=${Y}, expected ${Y}..32)`);let d1=Z-Y|0;if(d132)throw Error(`FastPFOR decode: invalid exceptionBitWidth=${d1} at block=${j} (bitWidth=${Y}, maxBits=${Z})`);if(O+G>I)throw Error(`FastPFOR decode: exception positions underflow at block=${j} (need=${G}, have=${I-O})`);return{maxBits:Z,exceptionBitWidth:d1,bytePosIn:O}}(a,h,y,p,d,A);if(y=n,W===1){let D=1<<p;for(let I=0;IM)throw Error(`FastPFOR decode: exception stream overflow for exceptionBitWidth=${W} (ptr=${B}, need ${d}, size=${M}) at block ${A}`);for(let D=0;D<d;D=D+1|0){let I=a[y++],O=0|q[B++];l[I+c|0]|=O<<p}return C[W]=B,y}function aE(l,c,p,d,a,h){let y=0|p,w=0|l[y];if(wl.length-1)throw Error(`FastPFOR decode: invalid whereMeta=${w} at pageStart=${y} (expected > 0 and pageStart+whereMeta >>0,n=W+3>>>2,q=k+1,C=q+n;if(C>=l.length)throw Error(`FastPFOR decode: invalid byteSize=${W} (metaInts=${n}, pageStart=${y}, packedEnd=${k}, byteContainerStart=${q}) causes bitmapPos=${C} out of bounds (encoded.length=${l.length})`);let B=function(I,O,Y,G){G.byteContainer.length>>2;if(3&j.byteOffset)for(let m1=0;m1<Z;m1=m1+1|0){let a1=0|I[O+m1|0],s1=m1<>>8&255,j[s1+2|0]=a1>>>16&255,j[s1+3|0]=a1>>>24&255}else{let m1=G.byteContainerI32;(!m1||m1.buffer!==j.buffer||m1.byteOffset!==j.byteOffset||m1.length>>2)),m1.set(I.subarray(O,O+Z))}let d1=3&Y;if(d1>0){let m1=0|I[O+Z|0],a1=Z<<2;for(let s1=0;s1>>(s1<<3)&255}return j}(l,q,W,h),M=W,D=function(I,O,Y){let G=0|I[O++],j=Y.dataToBePacked;for(let Z=2;Z>>Z-1&1))continue;if(O>=I.length)throw Error(`FastPFOR decode: truncated exception stream header (bitWidth=${Z}, streamWordIndex=${O}, needWords=1, availableWords=${I.length-O}, encodedWords=${I.length})`);let d1=I[O++]>>>0,m1=mm(d1+31,32),a1=d1*Z+31>>>5;if(O+a1>I.length)throw Error(`FastPFOR decode: truncated exception stream (bitWidth=${Z}, size=${d1}, streamWordIndex=${O}, needWords=${a1}, availableWords=${I.length-O}, encodedWords=${I.length})`);let s1=j[Z];(!s1||s1.length<m1)&&(s1=j[Z]=new Uint32Array(m1));let w1=0;for(;w1>>5)|0,Y.exceptionSizes[Z]=d1}return O}(l,C,h);return h.dataPointers.fill(0),function(I,O,Y,G,j,Z,d1,m1,a1,s1){let w1=0|Y,k1=0;for(let y1=0;y1<d1;y1=y1+1|0){let n1=gE(m1,a1,k1,y1);k1=n1.bytePosIn;let{bitWidth:Y1,exceptionCount:U1}=n1,K1=Z+y1*l3|0;switch(Y1){case 0:j.fill(0,K1,K1+l3);break;case 32:for(let R1=0;R10&&(k1=vE(j,K1,Y1,U1,m1,a1,k1,s1,y1))}if(w1!==G)throw Error(`FastPFOR decode: packed region mismatch (pageStart=${O}, packedStart=${Y}, consumedPackedEnd=${w1}, expectedPackedEnd=${G}, packedWords=${G-Y}, encoded.length=${I.length})`)}(l,y,A,k,c,0|d,a/l3|0,B,M,h),D}function oE(l,c,p,d,a){switch(a){case 2:return void function(k,W,n,q){let C=q,B=k[W]>>>0,M=k[W+1]>>>0;n[C++]=B>>>0&3,n[C++]=B>>>2&3,n[C++]=B>>>4&3,n[C++]=B>>>6&3,n[C++]=B>>>8&3,n[C++]=B>>>10&3,n[C++]=B>>>12&3,n[C++]=B>>>14&3,n[C++]=B>>>16&3,n[C++]=B>>>18&3,n[C++]=B>>>20&3,n[C++]=B>>>22&3,n[C++]=B>>>24&3,n[C++]=B>>>26&3,n[C++]=B>>>28&3,n[C++]=B>>>30&3,n[C++]=M>>>0&3,n[C++]=M>>>2&3,n[C++]=M>>>4&3,n[C++]=M>>>6&3,n[C++]=M>>>8&3,n[C++]=M>>>10&3,n[C++]=M>>>12&3,n[C++]=M>>>14&3,n[C++]=M>>>16&3,n[C++]=M>>>18&3,n[C++]=M>>>20&3,n[C++]=M>>>22&3,n[C++]=M>>>24&3,n[C++]=M>>>26&3,n[C++]=M>>>28&3,n[C]=M>>>30&3}(l,c,p,d);case 3:return void function(k,W,n,q){let C=q,B=k[W]>>>0,M=k[W+1]>>>0,D=k[W+2]>>>0;n[C++]=B>>>0&7,n[C++]=B>>>3&7,n[C++]=B>>>6&7,n[C++]=B>>>9&7,n[C++]=B>>>12&7,n[C++]=B>>>15&7,n[C++]=B>>>18&7,n[C++]=B>>>21&7,n[C++]=B>>>24&7,n[C++]=B>>>27&7,n[C++]=7&(B>>>30|(1&M)<>>1&7,n[C++]=M>>>4&7,n[C++]=M>>>7&7,n[C++]=M>>>10&7,n[C++]=M>>>13&7,n[C++]=M>>>16&7,n[C++]=M>>>19&7,n[C++]=M>>>22&7,n[C++]=M>>>25&7,n[C++]=M>>>28&7,n[C++]=7&(M>>>31|(3&D)<>>2&7,n[C++]=D>>>5&7,n[C++]=D>>>8&7,n[C++]=D>>>11&7,n[C++]=D>>>14&7,n[C++]=D>>>17&7,n[C++]=D>>>20&7,n[C++]=D>>>23&7,n[C++]=D>>>26&7,n[C]=D>>>29&7}(l,c,p,d);case 4:return void function(k,W,n,q){let C=q,B=k[W]>>>0,M=k[W+1]>>>0,D=k[W+2]>>>0,I=k[W+3]>>>0;n[C++]=B>>>0&15,n[C++]=B>>>4&15,n[C++]=B>>>8&15,n[C++]=B>>>12&15,n[C++]=B>>>16&15,n[C++]=B>>>20&15,n[C++]=B>>>24&15,n[C++]=B>>>28&15,n[C++]=M>>>0&15,n[C++]=M>>>4&15,n[C++]=M>>>8&15,n[C++]=M>>>12&15,n[C++]=M>>>16&15,n[C++]=M>>>20&15,n[C++]=M>>>24&15,n[C++]=M>>>28&15,n[C++]=D>>>0&15,n[C++]=D>>>4&15,n[C++]=D>>>8&15,n[C++]=D>>>12&15,n[C++]=D>>>16&15,n[C++]=D>>>20&15,n[C++]=D>>>24&15,n[C++]=D>>>28&15,n[C++]=I>>>0&15,n[C++]=I>>>4&15,n[C++]=I>>>8&15,n[C++]=I>>>12&15,n[C++]=I>>>16&15,n[C++]=I>>>20&15,n[C++]=I>>>24&15,n[C]=I>>>28&15}(l,c,p,d);case 5:return void function(k,W,n,q){let C=q,B=k[W]>>>0,M=k[W+1]>>>0,D=k[W+2]>>>0,I=k[W+3]>>>0,O=k[W+4]>>>0;n[C++]=B>>>0&31,n[C++]=B>>>5&31,n[C++]=B>>>10&31,n[C++]=B>>>15&31,n[C++]=B>>>20&31,n[C++]=B>>>25&31,n[C++]=31&(B>>>30|(7&M)<>>3&31,n[C++]=M>>>8&31,n[C++]=M>>>13&31,n[C++]=M>>>18&31,n[C++]=M>>>23&31,n[C++]=31&(M>>>28|(1&D)<>>1&31,n[C++]=D>>>6&31,n[C++]=D>>>11&31,n[C++]=D>>>16&31,n[C++]=D>>>21&31,n[C++]=D>>>26&31,n[C++]=31&(D>>>31|(15&I)<>>4&31,n[C++]=I>>>9&31,n[C++]=I>>>14&31,n[C++]=I>>>19&31,n[C++]=I>>>24&31,n[C++]=31&(I>>>29|(3&O)<>>2&31,n[C++]=O>>>7&31,n[C++]=O>>>12&31,n[C++]=O>>>17&31,n[C++]=O>>>22&31,n[C]=O>>>27&31}(l,c,p,d);case 6:return void function(k,W,n,q){let C=q,B=k[W]>>>0,M=k[W+1]>>>0,D=k[W+2]>>>0,I=k[W+3]>>>0,O=k[W+4]>>>0,Y=k[W+5]>>>0;n[C++]=B>>>0&63,n[C++]=B>>>6&63,n[C++]=B>>>12&63,n[C++]=B>>>18&63,n[C++]=B>>>24&63,n[C++]=63&(B>>>30|(15&M)<>>4&63,n[C++]=M>>>10&63,n[C++]=M>>>16&63,n[C++]=M>>>22&63,n[C++]=63&(M>>>28|(3&D)<>>2&63,n[C++]=D>>>8&63,n[C++]=D>>>14&63,n[C++]=D>>>20&63,n[C++]=D>>>26&63,n[C++]=I>>>0&63,n[C++]=I>>>6&63,n[C++]=I>>>12&63,n[C++]=I>>>18&63,n[C++]=I>>>24&63,n[C++]=63&(I>>>30|(15&O)<>>4&63,n[C++]=O>>>10&63,n[C++]=O>>>16&63,n[C++]=O>>>22&63,n[C++]=63&(O>>>28|(3&Y)<>>2&63,n[C++]=Y>>>8&63,n[C++]=Y>>>14&63,n[C++]=Y>>>20&63,n[C]=Y>>>26&63}(l,c,p,d);case 7:return void function(k,W,n,q){let C=q,B=k[W]>>>0,M=k[W+1]>>>0,D=k[W+2]>>>0,I=k[W+3]>>>0,O=k[W+4]>>>0,Y=k[W+5]>>>0,G=k[W+6]>>>0;n[C++]=B>>>0&127,n[C++]=B>>>7&127,n[C++]=B>>>14&127,n[C++]=B>>>21&127,n[C++]=127&(B>>>28|(7&M)<>>3&127,n[C++]=M>>>10&127,n[C++]=M>>>17&127,n[C++]=M>>>24&127,n[C++]=127&(M>>>31|(63&D)<>>6&127,n[C++]=D>>>13&127,n[C++]=D>>>20&127,n[C++]=127&(D>>>27|(3&I)<>>2&127,n[C++]=I>>>9&127,n[C++]=I>>>16&127,n[C++]=I>>>23&127,n[C++]=127&(I>>>30|(31&O)<>>5&127,n[C++]=O>>>12&127,n[C++]=O>>>19&127,n[C++]=127&(O>>>26|(1&Y)<>>1&127,n[C++]=Y>>>8&127,n[C++]=Y>>>15&127,n[C++]=Y>>>22&127,n[C++]=127&(Y>>>29|(15&G)<>>4&127,n[C++]=G>>>11&127,n[C++]=G>>>18&127,n[C]=G>>>25&127}(l,c,p,d);case 8:return void function(k,W,n,q){let C=q,B=k[W]>>>0,M=k[W+1]>>>0,D=k[W+2]>>>0,I=k[W+3]>>>0,O=k[W+4]>>>0,Y=k[W+5]>>>0,G=k[W+6]>>>0,j=k[W+7]>>>0;n[C++]=B>>>0&255,n[C++]=B>>>8&255,n[C++]=B>>>16&255,n[C++]=B>>>24&255,n[C++]=M>>>0&255,n[C++]=M>>>8&255,n[C++]=M>>>16&255,n[C++]=M>>>24&255,n[C++]=D>>>0&255,n[C++]=D>>>8&255,n[C++]=D>>>16&255,n[C++]=D>>>24&255,n[C++]=I>>>0&255,n[C++]=I>>>8&255,n[C++]=I>>>16&255,n[C++]=I>>>24&255,n[C++]=O>>>0&255,n[C++]=O>>>8&255,n[C++]=O>>>16&255,n[C++]=O>>>24&255,n[C++]=Y>>>0&255,n[C++]=Y>>>8&255,n[C++]=Y>>>16&255,n[C++]=Y>>>24&255,n[C++]=G>>>0&255,n[C++]=G>>>8&255,n[C++]=G>>>16&255,n[C++]=G>>>24&255,n[C++]=j>>>0&255,n[C++]=j>>>8&255,n[C++]=j>>>16&255,n[C]=j>>>24&255}(l,c,p,d);case 9:return void function(k,W,n,q){let C=q,B=k[W]>>>0,M=k[W+1]>>>0,D=k[W+2]>>>0,I=k[W+3]>>>0,O=k[W+4]>>>0,Y=k[W+5]>>>0,G=k[W+6]>>>0,j=k[W+7]>>>0,Z=k[W+8]>>>0;n[C++]=B>>>0&511,n[C++]=B>>>9&511,n[C++]=B>>>18&511,n[C++]=511&(B>>>27|(15&M)<>>4&511,n[C++]=M>>>13&511,n[C++]=M>>>22&511,n[C++]=511&(M>>>31|(255&D)<>>8&511,n[C++]=D>>>17&511,n[C++]=511&(D>>>26|(7&I)<>>3&511,n[C++]=I>>>12&511,n[C++]=I>>>21&511,n[C++]=511&(I>>>30|(127&O)<>>7&511,n[C++]=O>>>16&511,n[C++]=511&(O>>>25|(3&Y)<>>2&511,n[C++]=Y>>>11&511,n[C++]=Y>>>20&511,n[C++]=511&(Y>>>29|(63&G)<>>6&511,n[C++]=G>>>15&511,n[C++]=511&(G>>>24|(1&j)<>>1&511,n[C++]=j>>>10&511,n[C++]=j>>>19&511,n[C++]=511&(j>>>28|(31&Z)<>>5&511,n[C++]=Z>>>14&511,n[C]=Z>>>23&511}(l,c,p,d);case 10:return void function(k,W,n,q){let C=q,B=k[W]>>>0,M=k[W+1]>>>0,D=k[W+2]>>>0,I=k[W+3]>>>0,O=k[W+4]>>>0,Y=k[W+5]>>>0,G=k[W+6]>>>0,j=k[W+7]>>>0,Z=k[W+8]>>>0,d1=k[W+9]>>>0;n[C++]=B>>>0&1023,n[C++]=B>>>10&1023,n[C++]=B>>>20&1023,n[C++]=1023&(B>>>30|(255&M)<>>8&1023,n[C++]=M>>>18&1023,n[C++]=1023&(M>>>28|(63&D)<>>6&1023,n[C++]=D>>>16&1023,n[C++]=1023&(D>>>26|(15&I)<>>4&1023,n[C++]=I>>>14&1023,n[C++]=1023&(I>>>24|(3&O)<>>2&1023,n[C++]=O>>>12&1023,n[C++]=O>>>22&1023,n[C++]=Y>>>0&1023,n[C++]=Y>>>10&1023,n[C++]=Y>>>20&1023,n[C++]=1023&(Y>>>30|(255&G)<>>8&1023,n[C++]=G>>>18&1023,n[C++]=1023&(G>>>28|(63&j)<>>6&1023,n[C++]=j>>>16&1023,n[C++]=1023&(j>>>26|(15&Z)<>>4&1023,n[C++]=Z>>>14&1023,n[C++]=1023&(Z>>>24|(3&d1)<>>2&1023,n[C++]=d1>>>12&1023,n[C]=d1>>>22&1023}(l,c,p,d);case 11:return void function(k,W,n,q){let C=q,B=k[W]>>>0,M=k[W+1]>>>0,D=k[W+2]>>>0,I=k[W+3]>>>0,O=k[W+4]>>>0,Y=k[W+5]>>>0,G=k[W+6]>>>0,j=k[W+7]>>>0,Z=k[W+8]>>>0,d1=k[W+9]>>>0,m1=k[W+10]>>>0;n[C++]=B>>>0&2047,n[C++]=B>>>11&2047,n[C++]=2047&(B>>>22|(1&M)<>>1&2047,n[C++]=M>>>12&2047,n[C++]=2047&(M>>>23|(3&D)<>>2&2047,n[C++]=D>>>13&2047,n[C++]=2047&(D>>>24|(7&I)<>>3&2047,n[C++]=I>>>14&2047,n[C++]=2047&(I>>>25|(15&O)<>>4&2047,n[C++]=O>>>15&2047,n[C++]=2047&(O>>>26|(31&Y)<>>5&2047,n[C++]=Y>>>16&2047,n[C++]=2047&(Y>>>27|(63&G)<>>6&2047,n[C++]=G>>>17&2047,n[C++]=2047&(G>>>28|(127&j)<>>7&2047,n[C++]=j>>>18&2047,n[C++]=2047&(j>>>29|(255&Z)<>>8&2047,n[C++]=Z>>>19&2047,n[C++]=2047&(Z>>>30|(511&d1)<>>9&2047,n[C++]=d1>>>20&2047,n[C++]=2047&(d1>>>31|(1023&m1)<>>10&2047,n[C]=m1>>>21&2047}(l,c,p,d);case 12:return void function(k,W,n,q){let C=q,B=k[W]>>>0,M=k[W+1]>>>0,D=k[W+2]>>>0,I=k[W+3]>>>0,O=k[W+4]>>>0,Y=k[W+5]>>>0,G=k[W+6]>>>0,j=k[W+7]>>>0,Z=k[W+8]>>>0,d1=k[W+9]>>>0,m1=k[W+10]>>>0,a1=k[W+11]>>>0;n[C++]=B>>>0&4095,n[C++]=B>>>12&4095,n[C++]=4095&(B>>>24|(15&M)<>>4&4095,n[C++]=M>>>16&4095,n[C++]=4095&(M>>>28|(255&D)<>>8&4095,n[C++]=D>>>20&4095,n[C++]=I>>>0&4095,n[C++]=I>>>12&4095,n[C++]=4095&(I>>>24|(15&O)<>>4&4095,n[C++]=O>>>16&4095,n[C++]=4095&(O>>>28|(255&Y)<>>8&4095,n[C++]=Y>>>20&4095,n[C++]=G>>>0&4095,n[C++]=G>>>12&4095,n[C++]=4095&(G>>>24|(15&j)<>>4&4095,n[C++]=j>>>16&4095,n[C++]=4095&(j>>>28|(255&Z)<>>8&4095,n[C++]=Z>>>20&4095,n[C++]=d1>>>0&4095,n[C++]=d1>>>12&4095,n[C++]=4095&(d1>>>24|(15&m1)<>>4&4095,n[C++]=m1>>>16&4095,n[C++]=4095&(m1>>>28|(255&a1)<>>8&4095,n[C]=a1>>>20&4095}(l,c,p,d);case 16:return void function(k,W,n,q){let C=q,B=k[W]>>>0,M=k[W+1]>>>0,D=k[W+2]>>>0,I=k[W+3]>>>0,O=k[W+4]>>>0,Y=k[W+5]>>>0,G=k[W+6]>>>0,j=k[W+7]>>>0,Z=k[W+8]>>>0,d1=k[W+9]>>>0,m1=k[W+10]>>>0,a1=k[W+11]>>>0,s1=k[W+12]>>>0,w1=k[W+13]>>>0,k1=k[W+14]>>>0,y1=k[W+15]>>>0;n[C++]=B>>>0&65535,n[C++]=B>>>16&65535,n[C++]=M>>>0&65535,n[C++]=M>>>16&65535,n[C++]=D>>>0&65535,n[C++]=D>>>16&65535,n[C++]=I>>>0&65535,n[C++]=I>>>16&65535,n[C++]=O>>>0&65535,n[C++]=O>>>16&65535,n[C++]=Y>>>0&65535,n[C++]=Y>>>16&65535,n[C++]=G>>>0&65535,n[C++]=G>>>16&65535,n[C++]=j>>>0&65535,n[C++]=j>>>16&65535,n[C++]=Z>>>0&65535,n[C++]=Z>>>16&65535,n[C++]=d1>>>0&65535,n[C++]=d1>>>16&65535,n[C++]=m1>>>0&65535,n[C++]=m1>>>16&65535,n[C++]=a1>>>0&65535,n[C++]=a1>>>16&65535,n[C++]=s1>>>0&65535,n[C++]=s1>>>16&65535,n[C++]=w1>>>0&65535,n[C++]=w1>>>16&65535,n[C++]=k1>>>0&65535,n[C++]=k1>>>16&65535,n[C++]=y1>>>0&65535,n[C]=y1>>>16&65535}(l,c,p,d);case 32:for(let k=0;k>>0,y=c,w=0,A=l[y]>>>0;for(let k=0;k<32;k++)if(w+a>>w&h,w+=a,w===32&&(w=0,y++,k!==31&&(A=l[y]>>>0));else{let W=32-w,n=A>>>w;y++,A=l[y]>>>0,p[d+k]=(n|(A&dm[a-W]>>>0)<<W)&h,w=a-W}}function T0(l,c,p){let d=new Uint32Array(p),a=0,h=c.get();for(let y=0;y<d.length;y++){let w=l[h++],A=127&w;w<128||(w=l[h++],A|=(127&w)<<7,w<128||(w=l[h++],A|=(127&w)<<14,w<128||(w=l[h++],A|=(127&w)<<21,w<128||(w=l[h++],A|=(15&w)<<28)))),d[a++]=A}return c.set(h),d}function $r(l,c,p){let d=new BigUint64Array(p);for(let a=0;a<d.length;a++)d[a]=hE(l,c);return d}function hE(l,c){let p=0n,d=0,a=c.get();for(;a<l.length;){let h=l[a++];if(p|=BigInt(127&h)<=64)throw Error("Varint too long")}return c.set(a),p}function yE(l,c){let p,d;return d=l[c.get()],c.increment(),p=127&d,d<128?p:(d=l[c.get()],c.increment(),p|=(127&d)<<7,d<128?p:(d=l[c.get()],c.increment(),p|=(127&d)<<14,d<128?p:(d=l[c.get()],c.increment(),p|=(127&d)<<21,d<128?p:(d=l[c.get()],p|=(15&d)<>4,A>>0);if(A=h[y.get()],y.increment(),w|=(127&A)<<3,A>>0);if(A=h[y.get()],y.increment(),w|=(127&A)<<10,A>>0);if(A=h[y.get()],y.increment(),w|=(127&A)<<17,A>>0);if(A=h[y.get()],y.increment(),w|=(127&A)<<24,A>>0);if(A=h[y.get()],y.increment(),w|=(1&A)<<31,A>>0);throw Error("Expected varint not more than 10 bytes")}(p,l,c)))))}function Fl(l){return l>>>1^-(1&l)}function p2(l){return l>>1n^-(1n&l)}function _r(l){return l%2==1?(l+1)/-2:l/2}function vm(l,c,p){if(p===void 0){p=0;for(let h=0;h<c;h++)p+=l[h]}let d=new Uint32Array(p),a=0;for(let h=0;h<c;h++){let y=l[h];d.fill(l[h+c],a,a+y),a+=y}return d}function am(l,c,p){if(p===void 0){p=0;for(let h=0;h<c;h++)p+=Number(l[h])}let d=new BigUint64Array(p),a=0;for(let h=0;h<c;h++){let y=Number(l[h]);d.fill(l[h+c],a,a+y),a+=y}return d}function Oo(l,c,p){let d=new Float64Array(p),a=0;for(let h=0;h=4)for(;d=4)for(;d=4)for(let d=l[0];p>4],w=null;switch(y){case D0.DATA:w={dictionaryType:Object.values(Mu)[15&h]};break;case D0.OFFSET:w={offsetType:Object.values(Cc)[15&h]};break;case D0.LENGTH:w={lengthType:Object.values(U2)[15&h]}}a.increment();let A=d[a.get()],k=Object.values(hl)[A>>5],W=Object.values(hl)[A>>2&7],n=Object.values(t3)[3&A];a.increment();let q=T0(d,a,2),C=q[0];return{physicalStreamType:y,logicalStreamType:w,logicalLevelTechnique1:k,logicalLevelTechnique2:W,physicalLevelTechnique:n,numValues:C,byteLength:q[1],decompressedCount:C}}(l,c);return p.logicalLevelTechnique1===hl.MORTON?function(d,a,h){let y=T0(a,h,2);return{physicalStreamType:d.physicalStreamType,logicalStreamType:d.logicalStreamType,logicalLevelTechnique1:d.logicalLevelTechnique1,logicalLevelTechnique2:d.logicalLevelTechnique2,physicalLevelTechnique:d.physicalLevelTechnique,numValues:d.numValues,byteLength:d.byteLength,decompressedCount:d.decompressedCount,numBits:y[0],coordinateShift:y[1]}}(p,l,c):hl.RLE!==p.logicalLevelTechnique1&&hl.RLE!==p.logicalLevelTechnique2||t3.NONE===p.physicalLevelTechnique?p:function(d,a,h){let y=T0(a,h,2);return{physicalStreamType:d.physicalStreamType,logicalStreamType:d.logicalStreamType,logicalLevelTechnique1:d.logicalLevelTechnique1,logicalLevelTechnique2:d.logicalLevelTechnique2,physicalLevelTechnique:d.physicalLevelTechnique,numValues:d.numValues,byteLength:d.byteLength,decompressedCount:y[1],runs:y[0],numRleValues:y[1]}}(p,l,c)}(function(l){l.PRESENT="PRESENT",l.DATA="DATA",l.OFFSET="OFFSET",l.LENGTH="LENGTH"})(D0||(D0={})),function(l){l.NONE="NONE",l.SINGLE="SINGLE",l.SHARED="SHARED",l.VERTEX="VERTEX",l.MORTON="MORTON",l.FSST="FSST"}(Mu||(Mu={})),function(l){l.VERTEX="VERTEX",l.INDEX="INDEX",l.STRING="STRING",l.KEY="KEY"}(Cc||(Cc={})),function(l){l.VAR_BINARY="VAR_BINARY",l.GEOMETRIES="GEOMETRIES",l.PARTS="PARTS",l.RINGS="RINGS",l.TRIANGLES="TRIANGLES",l.SYMBOL="SYMBOL",l.DICTIONARY="DICTIONARY"}(U2||(U2={})),function(l){l[l.FLAT=0]="FLAT",l[l.CONST=1]="CONST",l[l.SEQUENCE=2]="SEQUENCE",l[l.DICTIONARY=3]="DICTIONARY",l[l.FSST_DICTIONARY=4]="FSST_DICTIONARY"}(Hl||(Hl={}));class ou{constructor(l,c){this.values=l,this._size=c}get(l){let c=Math.floor(l/8);return(this.values[c]>>l%8&1)==1}set(l,c){let p=Math.floor(l/8);this.values[p]=this.values[p]|(c?1:0)<>l%8&1}size(){return this._size}getBuffer(){return this.values}}function ir(l,c,p){if(!c)return l;let d=c.size(),a=new l.constructor(d),h=0;for(let y=0;y<d;y++)a[y]=c.get(y)?l[h++]:p;return a}function hm(l,c,p,d,a){return function(h,y,w,A){let k;switch(y.logicalLevelTechnique1){case hl.DELTA:if(y.logicalLevelTechnique2===hl.RLE){let W=y;if(!A)return function(n,q,C){let B=new Int32Array(C),M=0,D=0;for(let I=0;I<q;I++){let O=n[I],Y=Fl(n[I+q]);for(let G=0;G<O;G++)D+=Y,B[M++]=D}return B}(h,W.runs,W.numRleValues);k=Go(h=vm(h,W.runs,W.numRleValues))}else k=Go(h);break;case hl.RLE:k=function(W,n,q){if(q===void 0){q=0;for(let M=0;M<n;M++)q+=W[M]}let C=new Int32Array(q),B=0;for(let M=0;M<n;M++){let D=W[M],I=W[M+n];I=Fl(I),C.fill(I,B,B+D),B+=D}return C}(h,y.runs,y.numRleValues);break;case hl.MORTON:om(h),k=new Int32Array(h);break;case hl.COMPONENTWISE_DELTA:k=function(W){if(W.length=4)for(;C<q-4;C+=4){let B=W[C+1],M=W[C+2],D=W[C+3];n[C]=Fl(W[C])+n[C-2],n[C+1]=Fl(B)+n[C-1],n[C+2]=Fl(M)+n[C],n[C+3]=Fl(D)+n[C+1]}for(;C!==W.length;C+=2)n[C]=Fl(W[C])+n[C-2],n[C+1]=Fl(W[C+1])+n[C-1];return n}(h);break;case hl.NONE:k=function(W){let n=new Int32Array(W.length);for(let q=0;q>>0;for(let q=1;q>>0;return n}(y.logicalLevelTechnique2===hl.RLE?vm(h,y.runs,y.numRleValues):h);break;case hl.RLE:k=vm(h,y.runs,y.numRleValues);break;case hl.MORTON:om(h),k=h;break;case hl.COMPONENTWISE_DELTA:k=function(W){if(W.length>>0,n[1]=Fl(W[1])>>>0;for(let q=2;q>>0,n[q+1]=n[q-1]+Fl(W[q+1])>>>0;return n}(h);break;case hl.NONE:k=h;break;default:throw Error(`The specified Logical level technique is not supported: ${y.logicalLevelTechnique1}`)}return A?ir(k,A,0):k}(er(l,c,p),p,0,a)}function u4(l,c,p){return function(d,a){if(a.logicalLevelTechnique1===hl.DELTA&&a.logicalLevelTechnique2===hl.NONE)return function(h){let y=new Int32Array(h.length+1);y[0]=0,y[1]=Fl(h[0]);let w=y[1];for(let A=2;A!==y.length;++A)w+=Fl(h[A-1]),y[A]=y[A-1]+w;return new Uint32Array(y)}(d);if(a.logicalLevelTechnique1===hl.RLE&&a.logicalLevelTechnique2===hl.NONE)return function(h,y,w){let A=new Uint32Array(w+1);A[0]=0;let k=1,W=A[0];for(let n=0;n<y;n++){let q=h[n],C=h[n+y];for(let B=k;B<k+q;B++)A[B]=C+W,W=A[B];k+=q}return A}(d,a.runs,a.numRleValues);if(a.logicalLevelTechnique1===hl.NONE&&a.logicalLevelTechnique2===hl.NONE){(function(y){let w=0;for(let A=0;A<y.length;A++)y[A]+=w,w=y[A]})(d);let h=new Uint32Array(a.numValues+1);return h[0]=0,h.set(d,1),h}if(a.logicalLevelTechnique1===hl.DELTA&&a.logicalLevelTechnique2===hl.RLE){let h=function(y,w,A){let k=new Int32Array(A+1);k[0]=0;let W=1,n=k[0];for(let q=0;q<w;q++){let C=y[q],B=y[q+w];B=Fl(B);for(let M=W;M>>2,M=function(I,O){if(O<=I.encodedWords.length)return I.encodedWords;let Y=new Uint32Array(Math.max(16,2*O));return I.encodedWords=Y,Y}(q,B);(function(I,O,Y,G){if(O<0||YI.length)throw RangeError(`decodeBigEndianInt32sInto: out of bounds (offset=${O}, byteLength=${Y}, bytes.length=${I.length})`);let j=Math.floor(Y/4),Z=Y%4!=0,d1=Z?j+1:j;if(G.length<d1)throw RangeError(`decodeBigEndianInt32sInto: out.length=${G.length} 0){let m1=I.byteOffset+O;if(3&m1)for(let a1=0;a1<j;a1++){let s1=O+4*a1;G[a1]=I[s1]<<24|I[s1+1]<<16|I[s1+2]<<8|I[s1+3]}else{let a1=new Uint32Array(I.buffer,m1,j);for(let s1=0;s1<j;s1++)G[s1]=0|fE(a1[s1])}}if(Z){let m1=O+4*j,a1=Y-4*j,s1=0;for(let w1=0;w1<a1;w1++)s1|=I[m1+w1]<0){let m1=0|I[G];if(G=G+1|0,255&m1)throw Error(`FastPFOR decode: invalid alignedLength=${m1} (expected multiple of 256)`);if(j+m1>Z.length)throw Error(`FastPFOR decode: output buffer too small (outPos=${j}, alignedLength=${m1}, out.length=${Z.length})`);G=function(a1,s1,w1,k1,y1,n1){let Y1=k1+mm(y1,l3),U1=k1,K1=w1;for(;U1!==Y1;){let R1=Math.min(gm,Y1-U1);K1=aE(a1,s1,K1,U1,R1,n1),U1=U1+R1|0}return K1}(I,Z,G,j,m1,d1),j=j+m1|0}return function(m1,a1,s1,w1,k1,y1){if(y1===0)return a1;let n1=0,Y1=a1,U1=a1+s1,K1=k1,R1=k1,_1=k1+y1,Cl=0,sl=0;for(;Y1<U1&&R1>>n1&255;if(n1+=8,Y1+=n1>>>5,n1&=31,Cl|=(127&ql)<28)throw Error(`FastPFOR VByte: unterminated value (expected MSB=1 terminator within 5 bytes; shift=${sl}, partial=${Cl}, decoded=${R1-K1}/${y1}, inPos=${Y1}, inEnd=${U1})`)}if(R1!==_1)throw Error(`FastPFOR VByte: truncated stream (decoded=${R1-K1}, expected=${y1}, consumedWords=${Y1-a1}/${s1}, vbyteStart=${a1}, vbyteEnd=${U1})`)}(I,G,I.length-G|0,Z,j,O-j|0),Z}(M.subarray(0,B),k,q.decoderWorkspace);return n.add(W),D}(a,h,y,w,function(A=16){if(A= 0, got ${A}`);let k=Math.max(16,0|A);return{encodedWords:new Uint32Array(k),decoderWorkspace:zo()}}(y>>>2))}(l,p.numValues,p.byteLength,c);case t3.VARINT:return T0(l,c,p.numValues);case t3.NONE:{let a=c.get();c.add(p.byteLength);let h=l.subarray(a,c.get());return new Uint32Array(h)}default:throw Error(`Specified physicalLevelTechnique ${d} is not supported (yet).`)}}function ym(l,c,p){let d=er(l,c,p);return d.length===1?d[0]:function(a){return a[1]}(d)}function Jo(l,c,p){return function(d){if(d.length===2){let a=Fl(d[1]);return[a,a]}return[Fl(d[2]),Fl(d[3])]}(er(l,c,p))}function Xo(l,c,p){return function(d){if(d.length===2){let a=p2(d[1]);return[a,a]}return[p2(d[2]),p2(d[3])]}($r(l,c,p.numValues))}function To(l,c,p,d){return function(a,h,y){let w;switch(h.logicalLevelTechnique1){case hl.DELTA:w=function(A){let k=new BigUint64Array(A.length);k[0]=BigInt.asUintN(64,p2(A[0]));for(let W=1;W>1,c)-p}}function bo(l,c){let p=0;for(let d=0;d<c;d++)p|=(l&1<>d;return p}function tr(l,c,p,d,a,h,y){return l===l4.MORTON?function(w,A,k,W,n,q){let C=Array(n?W+1:W);for(let B=0;B<W;B++){let M=Sm(w[A[k+B]],q.numBits,q.coordinateShift);C[B]=new H(M.x,M.y)}return n&&(C[C.length-1]=C[0]),C}(c,p,d,a,h,y):function(w,A,k,W,n){let q=Array(n?W+1:W);for(let C=0;C<2*W;C+=2){let B=2*A[k+C/2];q[C/2]=new H(w[B],w[B+1])}return n&&(q[q.length-1]=q[0]),q}(c,p,d,a,h)}function l6(l,c,p,d){let a=Array(d?p+1:p);for(let h=0;h<2*p;h+=2)a[h/2]=new H(l[c+h],l[c+h+1]);return d&&(a[a.length-1]=a[0]),a}(function(l){l[l.POINT=0]="POINT",l[l.LINESTRING=1]="LINESTRING",l[l.POLYGON=2]="POLYGON",l[l.MULTIPOINT=3]="MULTIPOINT",l[l.MULTILINESTRING=4]="MULTILINESTRING",l[l.MULTIPOLYGON=5]="MULTIPOLYGON"})(E0||(E0={})),function(l){l[l.POINT=0]="POINT",l[l.LINESTRING=1]="LINESTRING",l[l.POLYGON=2]="POLYGON"}(jo||(jo={})),function(l){l[l.MORTON=0]="MORTON",l[l.VEC_2=1]="VEC_2",l[l.VEC_3=2]="VEC_3"}(l4||(l4={}));class km{constructor(l,c,p,d,a){this._vertexBufferType=l,this._topologyVector=c,this._vertexOffsets=p,this._vertexBuffer=d,this._mortonSettings=a}get vertexBufferType(){return this._vertexBufferType}get topologyVector(){return this._topologyVector}get vertexOffsets(){return this._vertexOffsets}get vertexBuffer(){return this._vertexBuffer}getSimpleEncodedVertex(l){let c=this.vertexOffsets?2*this.vertexOffsets[l]:2*l;return[this.vertexBuffer[c],this.vertexBuffer[c+1]]}getVertex(l){if(this.vertexOffsets&&this.mortonSettings){let p=Sm(this.vertexBuffer[this.vertexOffsets[l]],this.mortonSettings.numBits,this.mortonSettings.coordinateShift);return[p.x,p.y]}let c=this.vertexOffsets?2*this.vertexOffsets[l]:2*l;return[this.vertexBuffer[c],this.vertexBuffer[c+1]]}getGeometries(){return function(l){let c=Array(l.numGeometries),p=1,d=1,a=1,h=0,y=0,w=0,A=l.mortonSettings,k=l.topologyVector,W=k.geometryOffsets,n=k.partOffsets,q=k.ringOffsets,C=l.vertexOffsets,B=!C||C.length===0,M=l.containsPolygonGeometry(),D=l.vertexBuffer;for(let I=0;I<l.numGeometries;I++)switch(l.geometryType(I)){case E0.POINT:{let O,Y;if(B)O=D[y++],Y=D[y++];else if(l.vertexBufferType===l4.MORTON){let G=Sm(D[C[w++]],A.numBits,A.coordinateShift);O=G.x,Y=G.y}else{let G=2*C[w++];O=D[G],Y=D[G+1]}c[h++]=[[new H(O,Y)]],W&&a++,n&&p++,q&&d++}break;case E0.MULTIPOINT:{let O=W[a]-W[a-1];a++;let Y=Array(O);if(B)for(let G=0;G<O;G++){let j=D[y++],Z=D[y++];Y[G]=new H(j,Z)}else for(let G=0;G[G]),p+=O,d+=O}break;case E0.LINESTRING:{let O,Y;M?(O=q[d]-q[d-1],d++):O=n[p]-n[p-1],p++,B?(Y=l6(D,y,O,!1),y+=2*O):(Y=tr(l.vertexBufferType,D,C,w,O,!1,A),w+=O),c[h++]=[Y],W&&a++}break;case E0.POLYGON:{let O=n[p]-n[p-1];p++;let Y=Array(O-1),G,j=q[d]-q[d-1];if(d++,B){G=l6(D,y,j,!0),y+=2*j;for(let Z=0;Z<Y.length;Z++)j=q[d]-q[d-1],d++,Y[Z]=l6(D,y,j,!0),y+=2*j}else{G=tr(l.vertexBufferType,D,C,w,j,!0,A),w+=j;for(let Z=0;Z<Y.length;Z++)j=q[d]-q[d-1],d++,Y[Z]=tr(l.vertexBufferType,D,C,w,j,!0,A),w+=j}c[h++]=[G].concat(Y),W&&a++}break;case E0.MULTILINESTRING:{let O=W[a]-W[a-1];a++;let Y=Array(O);for(let G=0;G<O;G++){let j;if(M?(j=q[d]-q[d-1],d++):j=n[p]-n[p-1],p++,B)Y[G]=l6(D,y,j,!1),y+=2*j;else{let Z=tr(l.vertexBufferType,D,C,w,j,!1,A);Y[G]=Z,w+=j}}c[h++]=Y}break;case E0.MULTIPOLYGON:{let O=W[a]-W[a-1];a++;let Y=Array(O);for(let G=0;G<O;G++){let j=n[p]-n[p-1],Z;p++;let d1=Array(j-1),m1=q[d]-q[d-1];d++,B?(Z=l6(D,y,m1,!0),y+=2*m1):(Z=tr(l.vertexBufferType,D,C,w,m1,!0,A),w+=m1);for(let a1=0;a1<d1.length;a1++){let s1=q[d]-q[d-1];d++,B?(d1[a1]=l6(D,y,s1,!0),y+=2*s1):(d1[a1]=tr(l.vertexBufferType,D,C,w,s1,!0,A),w+=s1)}Y[G]=[Z].concat(d1)}c[h++]=Y.flat()}break;default:throw Error("The specified geometry type is currently not supported.")}return c}(this)}get mortonSettings(){return this._mortonSettings}}class Em extends km{constructor(l,c,p,d,a,h,y){super(p,d,a,h,y),this._numGeometries=l,this._geometryType=c}geometryType(l){return this._geometryType}get numGeometries(){return this._numGeometries}containsPolygonGeometry(){return this._geometryType===E0.POLYGON||this._geometryType===E0.MULTIPOLYGON}containsSingleGeometryType(){return!0}}class nm extends km{constructor(l,c,p,d,a,h){super(l,p,d,a,h),this._geometryTypes=c}geometryType(l){return this._geometryTypes[l]}get numGeometries(){return this._geometryTypes.length}containsPolygonGeometry(){for(let l=0;l<this.numGeometries;l++)if(this.geometryType(l)===E0.POLYGON||this.geometryType(l)===E0.MULTIPOLYGON)return!0;return!1}containsSingleGeometryType(){return!1}}class Am{constructor(l,c,p,d){this._triangleOffsets=l,this._indexBuffer=c,this._vertexBuffer=p,this._topologyVector=d}get triangleOffsets(){return this._triangleOffsets}get indexBuffer(){return this._indexBuffer}get vertexBuffer(){return this._vertexBuffer}get topologyVector(){return this._topologyVector}getGeometries(){if(!this._topologyVector)throw Error("Cannot convert GpuVector to coordinates without topology information");let l=Array(this.numGeometries),c=this._topologyVector,p=c.partOffsets,d=c.ringOffsets,a=c.geometryOffsets,h=0,y=1,w=1,A=1;for(let k=0;k<this.numGeometries;k++)switch(this.geometryType(k)){case E0.POLYGON:{let W=p[y]-p[y-1];y++;let n=[];for(let q=0;q<W;q++){let C=d[w]-d[w-1];w++;let B=[];for(let M=0;M0&&B.push(B[0]),n.push(B)}l[k]=n,a&&A++}break;case E0.MULTIPOLYGON:{let W=a[A]-a[A-1];A++;let n=[];for(let q=0;q<W;q++){let C=p[y]-p[y-1];y++;for(let B=0;B<C;B++){let M=d[w]-d[w-1];w++;let D=[];for(let I=0;I0&&D.push(D[0]),n.push(D)}}l[k]=n}}return l}[Symbol.iterator](){return null}}function $o(l,c,p,d,a,h){return new _o(l,c,p,d,a,h)}class _o extends Am{constructor(l,c,p,d,a,h){super(p,d,a,h),this._numGeometries=l,this._geometryType=c}geometryType(l){return this._geometryType}get numGeometries(){return this._numGeometries}containsSingleGeometryType(){return!0}}function io(l,c,p,d,a){return new eo(l,c,p,d,a)}class eo extends Am{constructor(l,c,p,d,a){super(c,p,d,a),this._geometryTypes=l}geometryType(l){return this._geometryTypes[l]}get numGeometries(){return this._geometryTypes.length}containsSingleGeometryType(){return!1}}function wE(l,c,p,d,a){let h=f2(l,p),y,w,A,k;if(B9(h,d,l,p)===Hl.CONST){let O=ym(l,p,h),Y,G,j,Z;for(let d1=0;d1<c-1;d1++){let m1=f2(l,p);switch(m1.physicalStreamType){case D0.LENGTH:switch(m1.logicalStreamType.lengthType){case U2.GEOMETRIES:Y=u4(l,p,m1);break;case U2.PARTS:G=u4(l,p,m1);break;case U2.RINGS:j=u4(l,p,m1);break;case U2.TRIANGLES:Z=u4(l,p,m1)}break;case D0.OFFSET:switch(m1.logicalStreamType.offsetType){case Cc.VERTEX:y=D2(l,p,m1);break;case Cc.INDEX:k=D2(l,p,m1)}break;case D0.DATA:Mu.VERTEX===m1.logicalStreamType.dictionaryType?w=hm(l,p,m1):(A={numBits:m1.numBits,coordinateShift:m1.coordinateShift},w=D2(l,p,m1))}}return k?Y!==void 0||G!==void 0?$o(d,O,Z,k,w,{geometryOffsets:Y,partOffsets:G,ringOffsets:j}):$o(d,O,Z,k,w):A===void 0?function(d1,m1,a1,s1,w1){return new Em(d1,m1,l4.VEC_2,a1,s1,w1)}(d,O,{geometryOffsets:Y,partOffsets:G,ringOffsets:j},y,w):function(d1,m1,a1,s1,w1,k1){return new Em(d1,m1,l4.MORTON,a1,s1,w1,k1)}(d,O,{geometryOffsets:Y,partOffsets:G,ringOffsets:j},y,w,A)}let W=D2(l,p,h),n,q,C,B,M,D,I;for(let O=0;O<c-1;O++){let Y=f2(l,p);switch(Y.physicalStreamType){case D0.LENGTH:switch(Y.logicalStreamType.lengthType){case U2.GEOMETRIES:n=D2(l,p,Y);break;case U2.PARTS:q=D2(l,p,Y);break;case U2.RINGS:C=D2(l,p,Y);break;case U2.TRIANGLES:B=u4(l,p,Y)}break;case D0.OFFSET:switch(Y.logicalStreamType.offsetType){case Cc.VERTEX:y=D2(l,p,Y);break;case Cc.INDEX:k=D2(l,p,Y)}break;case D0.DATA:Mu.VERTEX===Y.logicalStreamType.dictionaryType?w=hm(l,p,Y):(A={numBits:Y.numBits,coordinateShift:Y.coordinateShift},w=D2(l,p,Y))}}return n?(M=Vm(W,n,2),q&&C?(D=to(W,M,q,!1),I=function(O,Y,G,j){let Z=new Uint32Array(G[G.length-1]+1),d1=0;Z[0]=d1;let m1=1,a1=1,s1=0;for(let w1=0;w1<O.length;w1++){let k1=O[w1],y1=Y[w1+1]-Y[w1];if(k1!==0&&k1!==3)for(let n1=0;n1<y1;n1++){let Y1=G[m1]-G[m1-1];m1++;for(let U1=0;U1<Y1;U1++)d1=Z[a1++]=d1+j[s1++]}else for(let n1=0;n1<y1;n1++)Z[a1++]=++d1,m1++}return Z}(W,M,D,C)):q&&(D=function(O,Y,G){let j=new Uint32Array(Y[Y.length-1]+1),Z=0;j[0]=Z;let d1=1,m1=0;for(let a1=0;a1<O.length;a1++){let s1=O[a1],w1=Y[a1+1]-Y[a1];if(s1===4||s1===1)for(let k1=0;k1<w1;k1++)Z=j[d1++]=Z+G[m1++];else for(let k1=0;k1<w1;k1++)j[d1++]=++Z}return j}(W,M,q))):q&&C?(D=Vm(W,q,1),I=to(W,D,C,!0)):q&&(D=Vm(W,q,0)),k&&!D?io(W,B,k,w):k?io(W,B,k,w,{geometryOffsets:M,partOffsets:D,ringOffsets:I}):A===void 0?function(O,Y,G,j){return new nm(l4.VEC_2,O,Y,G,j)}(W,{geometryOffsets:M,partOffsets:D,ringOffsets:I},y,w):function(O,Y,G,j,Z){return new nm(l4.MORTON,O,Y,G,j,Z)}(W,{geometryOffsets:M,partOffsets:D,ringOffsets:I},y,w,A)}function Vm(l,c,p){let d=new Uint32Array(l.length+1),a=0;d[0]=a;let h=0;for(let y=0;yp?c[h++]:1);return d}function to(l,c,p,d){let a=new Uint32Array(c[c.length-1]+1),h=0;a[0]=h;let y=1,w=0;for(let A=0;A<l.length;A++){let k=l[A],W=c[A+1]-c[A];if(k===5||k===2||d&&(k===4||k===1))for(let n=0;n<W;n++)h=a[y++]=h+p[w++];else for(let n=0;n<W;n++)a[y++]=++h}return a}class lh extends Lc{constructor(l,c,p){super(l,c.getBuffer(),p),this.dataVector=c}getValueFromBuffer(l){return this.dataVector.get(l)}}class uh extends v8{getValueFromBuffer(l){return this.dataBuffer[l]}}class Wm extends Lc{constructor(l,c,p,d){super(l,d?BigInt64Array.of(c):BigUint64Array.of(c),p)}getValueFromBuffer(l){return this.dataBuffer[0]}}function a8(l,c,p,d,a){let h=function(y,w,A,k){let W=new Uint8Array(w),n=0,q=k.get()+A;for(;n=q);){let C=y[k.increment()];if(C<=127){let B=C+3,M=y[k.increment()],D=Math.min(n+B,w);W.fill(M,n,D),n=D}else{let B=256-C;for(let M=0;M<B&&n<w;M++)W[n++]=y[k.increment()]}}return k.set(q),W}(l,Math.ceil(c/8),p,d);return a?function(y,w,A){if(!A)return y;let k=A.size(),W=new ou(y,w),n=new ou(new Uint8Array(Math.ceil(k/8)),k),q=0;for(let C=0;C=12?sE.decode(l.subarray(c,p)):function(d,a,h){let y="",w=a;for(;w239?4:A>223?3:A>191?2:1;if(w+C>h)break;C===1?A<128&&(q=A):C===2?(k=d[w+1],(192&k)==128&&(q=(31&A)<<6|63&k,q<=127&&(q=null))):C===3?(k=d[w+1],W=d[w+2],(192&k)==128&&(192&W)==128&&(q=(15&A)<<12|(63&k)<<6|63&W,(q=55296&&q<=57343)&&(q=null))):C===4&&(k=d[w+1],W=d[w+2],n=d[w+3],(192&k)==128&&(192&W)==128&&(192&n)==128&&(q=(15&A)<<18|(63&k)<<12|(63&W)<<6|63&n,(q=1114112)&&(q=null))),q===null?(q=65533,C=1):q>65535&&(q-=65536,y+=String.fromCharCode(q>>>10&1023|55296),q=56320|1023&q),y+=String.fromCharCode(q),w+=C}return y}(l,c,p)}class K9 extends Lc{constructor(l,c,p,d){super(l,p,d),this.offsetBuffer=c}}class Cm extends K9{constructor(l,c,p,d){super(l,c,p,d??c.length-1)}getValueFromBuffer(l){return Lm(this.dataBuffer,this.offsetBuffer[l],this.offsetBuffer[l+1])}}class xc extends K9{constructor(l,c,p,d,a){super(l,p,d,a??c.length),this.indexBuffer=c,this.indexBuffer=c}getValueFromBuffer(l){let c=this.indexBuffer[l];return Lm(this.dataBuffer,this.offsetBuffer[c],this.offsetBuffer[c+1])}}class xm extends K9{constructor(l,c,p,d,a,h,y){super(l,p,d,y),this.indexBuffer=c,this.symbolOffsetBuffer=a,this.symbolTableBuffer=h}getValueFromBuffer(l){this.decodedDictionary==null&&(this.symbolLengthBuffer==null&&(this.symbolLengthBuffer=this.offsetToLengthBuffer(this.symbolOffsetBuffer)),this.decodedDictionary=function(p,d,a){let h=[],y=Array(d.length).fill(0);for(let w=1;w<d.length;w++)y[w]=y[w-1]+d[w-1];for(let w=0;w<a.length;w++)if(a[w]===255)h.push(a[++w]);else{let A=d[a[w]],k=y[a[w]];for(let W=0;W<A;W++)h.push(p[k+W])}return new Uint8Array(h)}(this.symbolTableBuffer,this.symbolLengthBuffer,this.dataBuffer));let c=this.indexBuffer[l];return Lm(this.decodedDictionary,this.offsetBuffer[c],this.offsetBuffer[c+1])}offsetToLengthBuffer(l){let c=new Uint32Array(l.length-1),p=l[0];for(let d=1;d<l.length;d++){let a=l[d];c[d-1]=a-p,p=a}return c}}function SE(l,c,p,d,a,h){return p.type==="scalarType"?function(y,w,A,k,W,n){let q=null;if(y===0)return null;if(n.nullable){let B=f2(w,A),M=B.numValues,D=A.get(),I=a8(w,M,B.byteLength,A);A.set(D+B.byteLength),q=new ou(I,B.numValues)}let C=q??k;switch(W.physicalType){case 4:case 3:return function(B,M,D,I,O){let Y=f2(B,M),G=B9(Y,O,B,M),j=I.physicalType===3;if(G===Hl.FLAT){let d1=o8(O)?O:void 0,m1=j?hm(B,M,Y,0,d1):D2(B,M,Y,0,d1);return new F9(D.name,m1,O)}if(G===Hl.SEQUENCE){let d1=Jo(B,M,Y);return new P9(D.name,d1[0],d1[1],Y.numRleValues)}let Z=j?function(d1,m1,a1){let s1=er(d1,m1,a1);return s1.length===1?Fl(s1[0]):function(w1){return Fl(w1[1])}(s1)}(B,M,Y):ym(B,M,Y);return new M9(D.name,Z,O,j)}(w,A,n,W,C);case 9:return function(B,M,D,I,O){let Y=null,G=null,j=null,Z=null,d1=null,m1=O??null,a1=null,s1=null;for(let w1=0;w1<I;w1++){let k1=f2(M,D);switch(k1.physicalStreamType){case D0.PRESENT:{let y1=a8(M,k1.numValues,k1.byteLength,D),n1=new ou(y1,k1.numValues);m1=O??n1;break}case D0.OFFSET:G=D2(M,D,k1,0,m1);break;case D0.LENGTH:{let y1=u4(M,D,k1);U2.DICTIONARY===k1.logicalStreamType.lengthType?Y=y1:U2.SYMBOL===k1.logicalStreamType.lengthType?Z=y1:a1=y1;break}case D0.DATA:{let y1=M.subarray(D.get(),D.get()+k1.byteLength);D.add(k1.byteLength);let n1=k1.logicalStreamType.dictionaryType;Mu.FSST===n1?d1=y1:Mu.SINGLE===n1||Mu.SHARED===n1?j=y1:Mu.NONE===n1&&(s1=y1);break}}}return function(w1,k1,y1,n1,Y1,U1,K1){return k1?new xm(w1,y1,n1,Y1,U1,k1,K1):null}(B,d1,G,Y,j,Z,m1)??function(w1,k1,y1,n1,Y1){return k1?Y1?new xc(w1,y1,n1,k1,Y1):new xc(w1,y1,n1,k1):null}(B,j,G,Y,m1)??function(w1,k1,y1,n1,Y1){if(!k1||!y1)return null;if(n1)return Y1?new xc(w1,n1,k1,y1,Y1):new xc(w1,n1,k1,y1);if(Y1&&Y1.size()!==k1.length-1){let U1=new Uint32Array(Y1.size()),K1=0;for(let R1=0;R1<Y1.size();R1++)U1[R1]=Y1.get(R1)?K1++:0;return new xc(w1,U1,k1,y1,Y1)}return Y1?new Cm(w1,k1,y1,Y1):new Cm(w1,k1,y1)}(B,a1,s1,G,m1)}(n.name,w,A,n.nullable?y-1:y,q);case 0:return function(B,M,D,I,O){let Y=f2(B,M),G=Y.numValues,j=M.get(),Z=o8(O)?O:void 0,d1=a8(B,G,Y.byteLength,M,Z);M.set(j+Y.byteLength);let m1=new ou(d1,G);return new lh(D.name,m1,O)}(w,A,n,0,C);case 6:case 5:return function(B,M,D,I,O){let Y=f2(B,M),G=B9(Y,I,B,M,"int64"),j=O.physicalType===5;if(G===Hl.FLAT){let d1=o8(I)?I:void 0,m1=j?function(a1,s1,w1,k1){return function(y1,n1,Y1){let U1;switch(n1.logicalLevelTechnique1){case hl.DELTA:if(n1.logicalLevelTechnique2===hl.RLE){let K1=n1;if(!Y1)return function(R1,_1,Cl){let sl=new BigInt64Array(Cl),ql=0,H0=0n;for(let Tl=0;Tl<_1;Tl++){let f0=Number(R1[Tl]),N0=p2(R1[Tl+_1]);for(let Il=0;Il<f0;Il++)H0+=N0,sl[ql++]=H0}return sl}(y1,K1.runs,K1.numRleValues);U1=Qo(y1=am(y1,K1.runs,K1.numRleValues))}else U1=Qo(y1);break;case hl.RLE:U1=function(K1,R1,_1){if(_1===void 0){_1=0;for(let ql=0;ql<R1;ql++)_1+=Number(K1[ql])}let Cl=new BigInt64Array(_1),sl=0;for(let ql=0;ql<R1;ql++){let H0=Number(K1[ql]),Tl=K1[ql+R1];Tl=p2(Tl),Cl.fill(Tl,sl,sl+H0),sl+=H0}return Cl}(y1,n1.runs,n1.numRleValues);break;case hl.NONE:U1=function(K1){let R1=new BigInt64Array(K1.length);for(let _1=0;_1=10}function ph(l){return l===30}function kE(l){if(l.type==="scalarType"){let c=l.scalarType;if(c.type==="physicalType")switch(c.physicalType){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:default:return!1;case 9:return!0}if(c.type==="logicalType")return!1}else if(l.type==="complexType"){let c=l.complexType;if(c.type==="physicalType")switch(c.physicalType){case 0:case 1:return!0;default:return!1}}return console.warn("Unexpected column type in hasStreamCount",l),!1}function EE(l){return l.type==="complexType"&&l.complexType?.type==="physicalType"&&l.complexType.physicalType===0}let nE=new TextDecoder;function Nm(l,c){let p=T0(l,c,1)[0];if(p===0)return"";let d=c.get(),a=l.subarray(d,d+p);return c.add(p),nE.decode(a)}function fh(l,c){let p=T0(l,c,1)[0]>>>0;if(p30)throw Error(`Unsupported field type code ${p}. Supported: 10-29(scalars), 30(STRUCT)`);let d=ch(p);if(rh(p)&&(d.name=Nm(l,c)),ph(p)){let a=T0(l,c,1)[0]>>>0;d.complexType.children=Array(a);for(let h=0;h>>0,d=ch(p);if(!d)throw Error(`Unsupported column type code ${p}. Supported: 0-3(ID), 4(GEOMETRY), 10-29(scalars), 30(STRUCT)`);if(rh(p)?d.name=Nm(l,c):p>=0&&p>>0,h=d.complexType;h.children=Array(a);for(let y=0;y>>0,h=T0(l,c,1)[0]>>>0;d.columns=Array(h);for(let y=0;y<h;y++)d.columns[y]=AE(l,c);return p.featureTables.push(d),[p,a]}function WE(l,c,p,d,a,h,y=!1){let w=c.scalarType;if(!w||w.type!=="logicalType"||w.logicalType!==0)throw Error(`ID column must be a logical ID scalar type: ${d}`);let A=w.longID?6:4,k=typeof h=="number"?void 0:h,W=B9(a,h,l,p,A===6?"int64":"int32");if(A===4)switch(W){case Hl.FLAT:{let n=D2(l,p,a,0,k);return new F9(d,n,h)}case Hl.SEQUENCE:{let n=Jo(l,p,a);return new P9(d,n[0],n[1],a.numRleValues)}case Hl.CONST:{let n=ym(l,p,a);return new M9(d,n,h,!1)}}switch(W){case Hl.FLAT:{if(y){let q=function(C,B,M){let D=function(I,O,Y){let G=new Float64Array(Y);for(let j=0;j=4)for(;j<G-4;j+=4){let Z=Y[j+1],d1=Y[j+2],m1=Y[j+3];Y[j]=_r(Y[j])+Y[j-1],Y[j+1]=_r(Z)+Y[j],Y[j+2]=_r(d1)+Y[j+1],Y[j+3]=_r(m1)+Y[j+2]}for(;j!==Y.length;++j)Y[j]=_r(Y[j])+Y[j-1]}(I),I;case hl.RLE:return function(Y,G){return Oo(Y,G.runs,G.numRleValues)}(I,O);case hl.NONE:return I;default:throw Error(`The specified Logical level technique is not supported: ${O.logicalLevelTechnique1}`)}}(D,M)}(l,p,a);return new q9(d,q,h)}let n=To(l,p,a,k);return new wm(d,n,h)}case Hl.SEQUENCE:{let n=Xo(l,p,a);return new sm(d,n[0],n[1],a.numRleValues)}case Hl.CONST:{let n=Zo(l,p,a);return new Wm(d,n,h,!1)}}throw Error("Vector type not supported for id column.")}class dh{constructor(l,c){var p;switch(this._featureData=l,this.properties=this._featureData.properties||{},(p=this._featureData.geometry)===null||p===void 0?void 0:p.type){case E0.POINT:case E0.MULTIPOINT:this.type=1;break;case E0.LINESTRING:case E0.MULTILINESTRING:this.type=2;break;case E0.POLYGON:case E0.MULTIPOLYGON:this.type=3;break;default:this.type=0}this.extent=c,this.id=Number(this._featureData.id)}loadGeometry(){let l=[];for(let c of this._featureData.geometry.coordinates){let p=[];for(let d of c)p.push(new H(d.x,d.y));l.push(p)}return l}}class mh{constructor(l){this.features=[],this.featureTable=l,this.name=l.name,this.extent=l.extent,this.version=2,this.features=l.getFeatures(),this.length=this.features.length}feature(l){return new dh(this.features[l],this.extent)}}class Fm{constructor(l){this.layers={};let c=function(p,d,a=!0){let h=new pm(0),y=[];for(;h.get() >>0,k=h.get()+A;if(k>p.length)throw Error(`Block overruns tile: ${k} > ${p.length}`);if(T0(p,h,1)[0]>>>0!=1){h.set(k);continue}let[W,n]=VE(p,h),q=W.featureTables[0],C=null,B=null,M=[],D=0;for(let O of q.columns){let Y=O.name;if((w=O).type==="scalarType"&&w.scalarType?.type==="logicalType"&&w.scalarType.logicalType===0){let G=null;if(O.nullable){let Z=f2(p,h),d1=h.get(),m1=a8(p,Z.numValues,Z.byteLength,h);h.set(d1+Z.byteLength),G=new ou(m1,Z.numValues)}let j=f2(p,h);D=G?G.size():j.decompressedCount,C=WE(p,O,h,Y,j,G??D,a)}else if(EE(O)){let G=T0(p,h,1)[0];if(D===0){let j=h.get();D=f2(p,h).decompressedCount,h.set(j)}B=wE(p,G,h,D)}else{let G=kE(O)?T0(p,h,1)[0]:1;if(G===0)continue;let j=SE(p,h,O,G,D);if(j)if(Array.isArray(j))for(let Z of j)M.push(Z);else M.push(j)}}let I=new Yo(q.name,B,C,M,n);y.push(I),h.set(k)}var w;return y}(new Uint8Array(l));this.layers=c.reduce((p,d)=>Object.assign(Object.assign({},p),{[d.name]:new mh(d)}),{})}}class gh{constructor(l,c){this.feature=l,this.type=l.type,this.properties=l.tags?l.tags:{},this.extent=c,"id"in l&&(typeof l.id=="string"?this.id=parseInt(l.id,10):typeof l.id!="number"||isNaN(l.id)||(this.id=l.id))}loadGeometry(){let l=[],c=this.feature.type===1?[this.feature.geometry]:this.feature.geometry;for(let p of c){let d=[];for(let a of p)d.push(new H(a[0],a[1]));l.push(d)}return l}}let h8="_geojsonTileLayer";function LE(l,c,p=""){c.writeVarintField(15,l.version||1),c.writeStringField(1,l.name||""),c.writeVarintField(5,l.extent||4096);let d={jsonPrefix:p,keys:[],values:[],keycache:{},valuecache:{}};for(let y=0;y<l.length;y++)d.feature=l.feature(y),c.writeMessage(2,CE,d);let a=d.keys;for(let y of a)c.writeStringField(3,y);let h=d.values;for(let y of h)c.writeMessage(4,FE,y)}function CE(l,c){if(!l.feature)return;let p=l.feature;p.id!==void 0&&c.writeVarintField(1,p.id),c.writeMessage(2,xE,l),c.writeVarintField(3,p.type),c.writeMessage(4,NE,p)}function xE(l,c){for(let p in l.feature?.properties){let d=l.feature.properties[p],a=l.keycache[p];if(d==null)continue;a===void 0&&(l.keys.push(p),a=l.keys.length-1,l.keycache[p]=a),c.writeVarint(a),typeof d!="string"&&typeof d!="boolean"&&typeof d!="number"&&(d=l.jsonPrefix+JSON.stringify(d));let h=typeof d+":"+d,y=l.valuecache[h];y===void 0&&(l.values.push(d),y=l.values.length-1,l.valuecache[h]=y),c.writeVarint(y)}}function qm(l,c){return(c<<3)+(7&l)}function vh(l){return l<>31}function NE(l,c){let p=l.loadGeometry(),d=l.type,a=0,h=0;for(let y of p){let w=1;d===1&&(w=y.length),c.writeVarint(qm(1,w));let A=d===3?y.length-1:y.length;for(let k=0;k<A;k++){k===1&&d!==1&&c.writeVarint(qm(2,A-1));let W=y[k].x-a,n=y[k].y-h;c.writeVarint(vh(W)),c.writeVarint(vh(n)),a+=W,h+=n}l.type===3&&c.writeVarint(qm(7,1))}}function FE(l,c){let p=typeof l;p==="string"?c.writeStringField(1,l):p==="boolean"?c.writeBooleanField(7,l):p==="number"&&(l%1!=0?c.writeDoubleField(3,l):l<0?c.writeSVarintField(6,l):c.writeVarintField(5,l))}class Pm{constructor(l,c){this.tileID=l,this.x=l.canonical.x,this.y=l.canonical.y,this.z=l.canonical.z,this.grid=new cu(ll,16,0),this.grid3D=new cu(ll,16,0),this.featureIndexArray=new Q,this.promoteId=c}insert(l,c,p,d,a,h){let y=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(p,d,a);let w=h?this.grid3D:this.grid;for(let A of c){let k=[1/0,1/0,-1/0,-1/0];for(let W of A)k[0]=Math.min(k[0],W.x),k[1]=Math.min(k[1],W.y),k[2]=Math.max(k[2],W.x),k[3]=Math.max(k[3],W.y);k[0]<ll&&k[1]=0&&k[3]>=0&&w.insert(y,k[0],k[1],k[2],k[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=this.encoding!=="mlt"?new Pd(new m8(this.rawTileData)).layers:new Fm(this.rawTileData).layers,this.sourceLayerCoder=new um(this.vtLayers?Object.keys(this.vtLayers).sort():[h8])),this.vtLayers}query(l,c,p,d){this.loadVTLayers();let a=l.params,h=ll/l.tileSize/l.scale,y=lc(a.filter,a.globalState),w=l.queryGeometry,A=l.queryPadding*h,k=Wc.fromPoints(w),W=this.grid.query(k.minX-A,k.minY-A,k.maxX+A,k.maxY+A),n=Wc.fromPoints(l.cameraQueryGeometry).expandBy(A),q=this.grid3D.query(n.minX,n.minY,n.maxX,n.maxY,(M,D,I,O)=>function(Y,G,j,Z,d1){for(let a1 of Y)if(G<=a1.x&&j=a1.x&&d1>=a1.y)return!0;let m1=[new H(G,j),new H(G,d1),new H(Z,d1),new H(Z,j)];if(Y.length>2){for(let a1 of m1)if(Yr(Y,a1))return!0}for(let a1=0;a1(I||(I=h5(O)),Y.queryIntersectsFeature({queryGeometry:w,feature:O,featureState:G,geometry:I,zoom:this.z,transform:l.transform,pixelsToTileUnits:h,pixelPosMatrix:l.pixelPosMatrix,unwrappedTileID:this.tileID.toUnwrapped(),getElevation:l.getElevation})))}return C}loadMatchingFeature(l,c,p,d,a,h,y,w,A,k,W){let n=this.bucketLayerIDs[c];if(h&&!n.some((M)=>h.has(M)))return;let q=this.sourceLayerCoder.decode(p),C=this.vtLayers[q].feature(d);if(a.needGeometry){let M=y5(C,!0);if(!a.filter(new Nl(this.tileID.overscaledZ),M,this.tileID.canonical))return}else if(!a.filter(new Nl(this.tileID.overscaledZ),C))return;let B=this.getId(C,q);for(let M of n){if(h&&!h.has(M))continue;let D=w[M];if(!D)continue;let I={};B&&k&&(I=k.getState(D.sourceLayer||h8,B));let O=h2({},A[M]);O.paint=ah(O.paint,D.paint,C,I,y),O.layout=ah(O.layout,D.layout,C,I,y);let Y=!W||W(C,D,I);if(!Y)continue;let G=new cm(C,this.z,this.x,this.y,B);G.layer=O;let j=l[M];j===void 0&&(j=l[M]=[]),j.push({featureIndex:d,feature:G,intersectionZ:Y})}}lookupSymbolFeatures(l,c,p,d,a,h,y,w){let A={};this.loadVTLayers();let k=lc(a.filterSpec,a.globalState);for(let W of l)this.loadMatchingFeature(A,p,d,W,k,h,y,w,c);return A}hasLayer(l){for(let c of this.bucketLayerIDs)for(let p of c)if(l===p)return!0;return!1}getId(l,c){var p;let d=l.id;return this.promoteId&&(d=l.properties[typeof this.promoteId=="string"?this.promoteId:this.promoteId[c]],typeof d=="boolean"&&(d=Number(d)),d===void 0&&((p=l.properties)===null||p===void 0?void 0:p.cluster)&&this.promoteId&&(d=Number(l.properties.cluster_id))),d}}function ah(l,c,p,d,a){return ju(l,(h,y)=>{let w=c instanceof J5?c.get(y):null;return(w==null?void 0:w.evaluate)?w.evaluate(p,d,a):w})}function qE(l,c){return c-l}function oh(l,c,p,d,a){let h=[];for(let y of l){let w;for(let A=0;A<y.length-1;A++){let k=y[A],W=y[A+1];k.x<c&&W.x<c||(k.x<c?k=new H(c,k.y+(c-k.x)/(W.x-k.x)*(W.y-k.y))._round():W.x<c&&(W=new H(c,k.y+(c-k.x)/(W.x-k.x)*(W.y-k.y))._round()),k.y<p&&W.y<p||(k.y<p?k=new H(k.x+(p-k.y)/(W.y-k.y)*(W.x-k.x),p)._round():W.y =d&&W.x>=d||(k.x>=d?k=new H(d,k.y+(d-k.x)/(W.x-k.x)*(W.y-k.y))._round():W.x>=d&&(W=new H(d,k.y+(d-k.x)/(W.x-k.x)*(W.y-k.y))._round()),k.y>=a&&W.y>=a||(k.y>=a?k=new H(k.x+(a-k.y)/(W.y-k.y)*(W.x-k.x),a)._round():W.y>=a&&(W=new H(k.x+(a-k.y)/(W.y-k.y)*(W.x-k.x),a)._round()),w&&k.equals(w[w.length-1])||(w=[k],h.push(w)),w.push(W)))))}}return h}function hh(l,c,p,d,a){switch(c){case 1:return function(h,y,w,A){let k=[];for(let W of h)for(let n of W){let q=A===0?n.x:n.y;q>=y&&q<=w&&k.push([n])}return k}(l,p,d,a);case 2:return yh(l,p,d,a,!1);case 3:return yh(l,p,d,a,!0)}return[]}function PE(l,c,p,d,a){let h=d===0?ME:BE,y=[],w=[];for(let W=0;W<l.length-1;W++){let n=l[W],q=l[W+1],C=d===0?n.x:n.y,B=d===0?q.x:q.y,M=!1;Cc&&y.push(h(n,q,c)):C>p?B<p&&y.push(h(n,q,p)):y.push(n),B=c&&(y.push(h(n,q,c)),M=!0),B>p&&C=c&&k0&&!y[0].equals(y[y.length-1])&&y.push(new H(y[0].x,y[0].y)),y.length>0&&w.push(y),w}function yh(l,c,p,d,a){let h=[];for(let y of l){let w=PE(y,c,p,d,a);w.length>0&&h.push(...w)}return h}function ME(l,c,p){return new H(p,l.y+(p-l.x)/(c.x-l.x)*(c.y-l.y))}function BE(l,c,p){return new H(l.x+(p-l.y)/(c.y-l.y)*(c.x-l.x),p)}z1("FeatureIndex",Pm,{omit:["rawTileData","sourceLayerCoder"]});class c4 extends H{constructor(l,c,p,d){super(l,c),this.angle=p,d!==void 0&&(this.segment=d)}clone(){return new c4(this.x,this.y,this.angle,this.segment)}}function wh(l,c,p,d,a){if(c.segment===void 0||p===0)return!0;let h=c,y=c.segment+1,w=0;for(;w>-p/2;){if(y--,y<0)return!1;w-=l[y].dist(h),h=l[y]}w+=l[y].dist(l[y+1]),y++;let A=[],k=0;for(;w d;)k-=A.shift().angleDelta;if(k>a)return!1;y++,w+=W.dist(n)}return!0}function sh(l){let c=0;for(let p=0;p<l.length-1;p++)c+=l[p].dist(l[p+1]);return c}function Sh(l,c,p){return l?0.6*c*p:0}function kh(l,c){return Math.max(l?l.right-l.left:0,c?c.right-c.left:0)}function KE(l,c,p,d,a,h){let y=Sh(p,a,h),w=kh(p,d)*h,A=0,k=sh(l)/2;for(let W=0;Wk){let B=(k-A)/C,M=s2.number(n.x,q.x,B),D=s2.number(n.y,q.y,B),I=new c4(M,D,q.angleTo(n),W);return I._round(),!y||wh(l,I,w,y,c)?I:void 0}A+=C}}function UE(l,c,p,d,a,h,y,w,A){let k=Sh(d,h,y),W=kh(d,a),n=W*y,q=l[0].x===0||l[0].x===A||l[0].y===0||l[0].y===A;return c-n<c/4&&(c=n+c/4),Eh(l,q?c/2*w%c:(W/2+2*h)*y*w%c,c,k,p,n,q,!1,A)}function Eh(l,c,p,d,a,h,y,w,A){let k=h/2,W=sh(l),n=0,q=c-p,C=[];for(let B=0;B<l.length-1;B++){let M=l[B],D=l[B+1],I=M.dist(D),O=D.angleTo(M);for(;q+p=0&&G=0&&j=0&&q+kn1+Y1[1]-Y1[0],C=W.reduce(q,0),B=n.reduce(q,0),M=w-C,D=A-B,I=0,O=C,Y=0,G=B,j=0,Z=M,d1=0,m1=D;if(h.content&&d){let n1=h.content,Y1=n1[2]-n1[0],U1=n1[3]-n1[1];(h.textFitWidth||h.textFitHeight)&&(k=Vo(l)),I=U9(W,0,n1[0]),Y=U9(n,0,n1[1]),O=U9(W,n1[0],n1[2]),G=U9(n,n1[1],n1[3]),j=n1[0]-I,d1=n1[1]-Y,Z=Y1-O,m1=U1-G}let{x1:a1,y1:s1}=k,w1=k.x2-a1,k1=k.y2-s1,y1=(n1,Y1,U1,K1)=>{let R1=D9(n1.stretch-I,O,w1,a1),_1=R9(n1.fixed-j,Z,n1.stretch,C),Cl=D9(Y1.stretch-Y,G,k1,s1),sl=R9(Y1.fixed-d1,m1,Y1.stretch,B),ql=D9(U1.stretch-I,O,w1,a1),H0=R9(U1.fixed-j,Z,U1.stretch,C),Tl=D9(K1.stretch-Y,G,k1,s1),f0=R9(K1.fixed-d1,m1,K1.stretch,B),N0=new H(R1,Cl),Il=new H(ql,Cl),d2=new H(ql,Tl),Z0=new H(R1,Tl),b0=new H(_1/y,sl/y),A2=new H(H0/y,f0/y),I0=c*Math.PI/180;if(I0){let n0=Math.sin(I0),Gl=Math.cos(I0),a0=[Gl,-n0,n0,Gl];N0._matMult(a0),Il._matMult(a0),Z0._matMult(a0),d2._matMult(a0)}let V2=n1.stretch+n1.fixed,hu=Y1.stretch+Y1.fixed;return{tl:N0,tr:Il,bl:Z0,br:d2,tex:{x:h.paddedRect.x+1+V2,y:h.paddedRect.y+1+hu,w:U1.stretch+U1.fixed-V2,h:K1.stretch+K1.fixed-hu},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:b0,pixelOffsetBR:A2,minFontScaleX:Z/y/w1,minFontScaleY:m1/y/k1,isSDF:p}};if(d&&(h.stretchX||h.stretchY)){let n1=Ah(W,M,C),Y1=Ah(n,D,B);for(let U1=0;U1<n1.length-1;U1++){let K1=n1[U1],R1=n1[U1+1];for(let _1=0;_10&&(B=Math.max(10,B),this.circleDiameter=B)}else{let n=((W=h.image)===null||W===void 0?void 0:W.content)&&(h.image.textFitWidth||h.image.textFitHeight)?Vo(h):{x1:h.left,y1:h.top,x2:h.right,y2:h.bottom};n.y1=n.y1*y-w[0],n.y2=n.y2*y+w[2],n.x1=n.x1*y-w[3],n.x2=n.x2*y+w[1];let q=h.collisionPadding;if(q&&(n.x1-=q[0]*y,n.y1-=q[1]*y,n.x2+=q[2]*y,n.y2+=q[3]*y),k){let C=new H(n.x1,n.y1),B=new H(n.x2,n.y1),M=new H(n.x1,n.y2),D=new H(n.x2,n.y2),I=k*Math.PI/180;C._rotate(I),B._rotate(I),M._rotate(I),D._rotate(I),n.x1=Math.min(C.x,B.x,M.x,D.x),n.x2=Math.max(C.x,B.x,M.x,D.x),n.y1=Math.min(C.y,B.y,M.y,D.y),n.y2=Math.max(C.y,B.y,M.y,D.y)}l.emplaceBack(c.x,c.y,n.x1,n.y1,n.x2,n.y2,p,d,a)}this.boxEndIndex=l.length}}class Vh{constructor(l=[],c=(p,d)=>pd?1:0){if(this.data=l,this.length=this.data.length,this.compare=c,this.length>0)for(let p=(this.length>>1)-1;p>=0;p--)this._down(p)}push(l){this.data.push(l),this._up(this.length++)}pop(){if(this.length===0)return;let l=this.data[0],c=this.data.pop();return--this.length>0&&(this.data[0]=c,this._down(0)),l}peek(){return this.data[0]}_up(l){let{data:c,compare:p}=this,d=c[l];for(;l>0;){let a=l-1>>1,h=c[a];if(p(d,h)>=0)break;c[l]=h,l=a}c[l]=d}_down(l){let{data:c,compare:p}=this,d=this.length>>1,a=c[l];for(;l<d;){let h=1+(l<<1),y=h+1;if(y<this.length&&p(c[y],c[h])=0)break;c[l]=c[h],l=h}c[l]=a}}function DE(l,c=1){let p=Wc.fromPoints(l[0]),d=Math.min(p.width(),p.height()),a=d/2,h=new Vh([],RE),{minX:y,minY:w,maxX:A,maxY:k}=p;if(d===0)return new H(y,w);for(let q=y;q<A;q+=d)for(let C=w;C<k;C+=d)h.push(new Nc(q+a,C+a,a,l));let W=function(q){let C=0,B=0,M=0,D=q[0];for(let I=0,O=D.length,Y=O-1;In.d||!n.d)&&(n=q),q.max-n.d0&&n.d-W.d<=c?W.p:n.p}function RE(l,c){return c.max-l.max}class Nc{constructor(l,c,p,d){this.p=new H(l,c),this.h=p,this.d=function(a,h){let y=!1,w=1/0;for(let A of h)for(let k=0,W=A.length,n=W-1;ka.y!=C.y>a.y&&a.x<(C.x-q.x)*(a.y-q.y)/(C.y-q.y)+q.x&&(y=!y),w=Math.min(w,ga(a,q,C))}return(y?1:-1)*Math.sqrt(w)}(this.p,d),this.max=this.d+this.h*Math.SQRT2}}var R0;V.aM=void 0,(R0=V.aM||(V.aM={}))[R0.center=1]="center",R0[R0.left=2]="left",R0[R0.right=3]="right",R0[R0.top=4]="top",R0[R0.bottom=5]="bottom",R0[R0["top-left"]=6]="top-left",R0[R0["top-right"]=7]="top-right",R0[R0["bottom-left"]=8]="bottom-left",R0[R0["bottom-right"]=9]="bottom-right";let Mm=Number.POSITIVE_INFINITY;function Wh(l,c){return c[1]!==Mm?function(p,d,a){let h=0,y=0;switch(d=Math.abs(d),a=Math.abs(a),p){case"top-right":case"top-left":case"top":y=a-7;break;case"bottom-right":case"bottom-left":case"bottom":y=7-a}switch(p){case"top-right":case"bottom-right":case"right":h=-d;break;case"top-left":case"bottom-left":case"left":h=d}return[h,y]}(l,c[0],c[1]):function(p,d){let a=0,h=0;d<0&&(d=0);let y=d/Math.SQRT2;switch(p){case"top-right":case"top-left":h=y-7;break;case"bottom-right":case"bottom-left":h=7-y;break;case"bottom":h=7-d;break;case"top":h=d-7}switch(p){case"top-right":case"bottom-right":a=-y;break;case"top-left":case"bottom-left":a=y;break;case"left":a=d;break;case"right":a=-d}return[a,h]}(l,c[0])}function Lh(l,c,p){var d;let a=l.layout,h=(d=a.get("text-variable-anchor-offset"))===null||d===void 0?void 0:d.evaluate(c,{},p);if(h){let w=h.values,A=[];for(let k=0;kq*k0);W.startsWith("top")?n[1]-=7:W.startsWith("bottom")&&(n[1]+=7),A[k+1]=n}return new j0(A)}let y=a.get("text-variable-anchor");if(y){let w;w=l._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[a.get("text-radial-offset").evaluate(c,{},p)*k0,Mm]:a.get("text-offset").evaluate(c,{},p).map((k)=>k*k0);let A=[];for(let k of y)A.push(k,Wh(k,w));return new j0(A)}return null}function Bm(l){switch(l){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function HE(l,c,p,d,a,h,y,w,A,k,W,n){let q=h.textMaxSize.evaluate(c,{});q===void 0&&(q=y);let C=l.layers[0].layout,B=C.get("icon-offset").evaluate(c,{},W),M=xh(p.horizontal),D=y/24,I=l.tilePixelRatio*D,O=l.tilePixelRatio*q/24,Y=l.tilePixelRatio*w,G=l.tilePixelRatio*C.get("symbol-spacing"),j=C.get("text-padding")*l.tilePixelRatio,Z=function(U1,K1,R1,_1=1){let Cl=U1.get("icon-padding").evaluate(K1,{},R1),sl=Cl==null?void 0:Cl.values;return[sl[0]*_1,sl[1]*_1,sl[2]*_1,sl[3]*_1]}(C,c,W,l.tilePixelRatio),d1=C.get("text-max-angle")/180*Math.PI,m1=C.get("text-rotation-alignment")!=="viewport"&&C.get("symbol-placement")!=="point",a1=C.get("icon-rotation-alignment")==="map"&&C.get("symbol-placement")!=="point",s1=C.get("symbol-placement"),w1=G/2,k1=C.get("icon-text-fit"),y1;d&&k1!=="none"&&(l.allowVerticalPlacement&&p.vertical&&(y1=Wo(d,p.vertical,k1,C.get("icon-text-fit-padding"),B,D)),M&&(d=Wo(d,M,k1,C.get("icon-text-fit-padding"),B,D)));let n1=W?n.line.getGranularityForZoomLevel(W.z):1,Y1=(U1,K1)=>{K1.x=ll||K1.y=ll||function(R1,_1,Cl,sl,ql,H0,Tl,f0,N0,Il,d2,Z0,b0,A2,I0,V2,hu,n0,Gl,a0,Zl,A0,u3,Bu,w8){let r4=R1.addToLineVertexArray(_1,Cl),Fc,u6,c6,r6,Nh=0,Fh=0,qh=0,Ph=0,Km=-1,Um=-1,c3={},Mh=U0("");if(R1.allowVerticalPlacement&&sl.vertical){let $0=f0.layout.get("text-rotate").evaluate(Zl,{},Bu)+90;c6=new y8(N0,_1,Il,d2,Z0,sl.vertical,b0,A2,I0,$0),Tl&&(r6=new y8(N0,_1,Il,d2,Z0,Tl,hu,n0,I0,$0))}if(ql){let $0=f0.layout.get("icon-rotate").evaluate(Zl,{}),Z2=f0.layout.get("icon-text-fit")!=="none",qc=nh(ql,$0,u3,Z2),Uu=Tl?nh(Tl,$0,u3,Z2):void 0;u6=new y8(N0,_1,Il,d2,Z0,ql,hu,n0,!1,$0),Nh=4*qc.length;let Pc=R1.iconSizeData,w5=null;Pc.kind==="source"?(w5=[t5*f0.layout.get("icon-size").evaluate(Zl,{})],w5[0]>i3&&w0(`${R1.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)):Pc.kind==="composite"&&(w5=[t5*A0.compositeIconSizes[0].evaluate(Zl,{},Bu),t5*A0.compositeIconSizes[1].evaluate(Zl,{},Bu)],(w5[0]>i3||w5[1]>i3)&&w0(`${R1.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)),R1.addSymbols(R1.icon,qc,w5,a0,Gl,Zl,V.ax.none,_1,r4.lineStartIndex,r4.lineLength,-1,Bu),Km=R1.icon.placedSymbolArray.length-1,Uu&&(Fh=4*Uu.length,R1.addSymbols(R1.icon,Uu,w5,a0,Gl,Zl,V.ax.vertical,_1,r4.lineStartIndex,r4.lineLength,-1,Bu),Um=R1.icon.placedSymbolArray.length-1)}let Bh=Object.keys(sl.horizontal);for(let $0 of Bh){let Z2=sl.horizontal[$0];if(!Fc){Mh=U0(Z2.text);let Uu=f0.layout.get("text-rotate").evaluate(Zl,{},Bu);Fc=new y8(N0,_1,Il,d2,Z0,Z2,b0,A2,I0,Uu)}let qc=Z2.positionedLines.length===1;if(qh+=Ch(R1,_1,Z2,H0,f0,I0,Zl,V2,r4,sl.vertical?V.ax.horizontal:V.ax.horizontalOnly,qc?Bh:[$0],c3,Km,A0,Bu),qc)break}sl.vertical&&(Ph+=Ch(R1,_1,sl.vertical,H0,f0,I0,Zl,V2,r4,V.ax.vertical,["vertical"],c3,Um,A0,Bu));let YE=Fc?Fc.boxStartIndex:R1.collisionBoxArray.length,zE=Fc?Fc.boxEndIndex:R1.collisionBoxArray.length,OE=c6?c6.boxStartIndex:R1.collisionBoxArray.length,GE=c6?c6.boxEndIndex:R1.collisionBoxArray.length,QE=u6?u6.boxStartIndex:R1.collisionBoxArray.length,jE=u6?u6.boxEndIndex:R1.collisionBoxArray.length,JE=r6?r6.boxStartIndex:R1.collisionBoxArray.length,XE=r6?r6.boxEndIndex:R1.collisionBoxArray.length,Ku=-1,H9=($0,Z2)=>($0==null?void 0:$0.circleDiameter)?Math.max($0.circleDiameter,Z2):Z2;Ku=H9(Fc,Ku),Ku=H9(c6,Ku),Ku=H9(u6,Ku),Ku=H9(r6,Ku);let Kh=Ku>-1?1:0;Kh&&(Ku*=w8/k0),R1.glyphOffsetArray.length>=Vc.MAX_GLYPHS&&w0("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),Zl.sortKey!==void 0&&R1.addToSortKeyRanges(R1.symbolInstances.length,Zl.sortKey);let TE=Lh(f0,Zl,Bu),[ZE,bE]=function($0,Z2){let qc=$0.length,Uu=Z2==null?void 0:Z2.values;if((Uu==null?void 0:Uu.length)>0)for(let Pc=0;Pc=0?c3.right:-1,c3.center>=0?c3.center:-1,c3.left>=0?c3.left:-1,c3.vertical||-1,Km,Um,Mh,YE,zE,OE,GE,QE,jE,JE,XE,Il,qh,Ph,Nh,Fh,Kh,0,b0,Ku,ZE,bE)}(l,K1,U1,p,d,a,y1,l.layers[0],l.collisionBoxArray,c.index,c.sourceLayerIndex,l.index,I,[j,j,j,j],m1,A,Y,Z,a1,B,c,h,k,W,y)};if(s1==="line")for(let U1 of oh(c.geometry,0,0,ll,ll)){let K1=Ac(U1,n1),R1=UE(K1,G,d1,p.vertical||M,d,24,O,l.overscaling,ll);for(let _1 of R1)M&&IE(l,M.text,w1,_1)||Y1(K1,_1)}else if(s1==="line-center"){for(let U1 of c.geometry)if(U1.length>1){let K1=Ac(U1,n1),R1=KE(K1,d1,p.vertical||M,d,24,O);R1&&Y1(K1,R1)}}else if(c.type==="Polygon")for(let U1 of hr(c.geometry,0)){let K1=DE(U1,16);Y1(Ac(U1[0],n1,!0),new c4(K1.x,K1.y,0))}else if(c.type==="LineString")for(let U1 of c.geometry){let K1=Ac(U1,n1);Y1(K1,new c4(K1[0].x,K1[0].y,0))}else if(c.type==="Point")for(let U1 of c.geometry)for(let K1 of U1)Y1([K1],new c4(K1.x,K1.y,0))}function Ch(l,c,p,d,a,h,y,w,A,k,W,n,q,C,B){let M=function(O,Y,G,j,Z,d1,m1,a1){let s1=j.layout.get("text-rotate").evaluate(d1,{})*Math.PI/180,w1=[];for(let k1 of Y.positionedLines)for(let y1 of k1.positionedGlyphs){if(!y1.rect)continue;let n1=y1.rect||{},Y1=4,U1=!0,K1=1,R1=0,_1=(Z||a1)&&y1.vertical,Cl=y1.metrics.advance*y1.scale/2;if(a1&&Y.verticalizable&&(R1=k1.lineOffset/2-(y1.imageName?-(k0-y1.metrics.width*y1.scale)/2:(y1.scale-1)*k0)),y1.imageName){let n0=m1[y1.imageName];U1=n0.sdf,K1=n0.pixelRatio,Y1=1/K1}let sl=Z?[y1.x+Cl,y1.y]:[0,0],ql=Z?[0,0]:[y1.x+Cl+G[0],y1.y+G[1]-R1],H0=[0,0];_1&&(H0=ql,ql=[0,0]);let Tl=y1.metrics.isDoubleResolution?2:1,f0=(y1.metrics.left-Y1)*y1.scale-Cl+ql[0],N0=(-y1.metrics.top-Y1)*y1.scale+ql[1],Il=f0+n1.w/Tl*y1.scale/K1,d2=N0+n1.h/Tl*y1.scale/K1,Z0=new H(f0,N0),b0=new H(Il,N0),A2=new H(f0,d2),I0=new H(Il,d2);if(_1){let n0=new H(-Cl,Cl- -17),Gl=-Math.PI/2,a0=12-Cl,Zl=new H(22-a0,-(y1.imageName?a0:0)),A0=new H(...H0);Z0._rotateAround(Gl,n0)._add(Zl)._add(A0),b0._rotateAround(Gl,n0)._add(Zl)._add(A0),A2._rotateAround(Gl,n0)._add(Zl)._add(A0),I0._rotateAround(Gl,n0)._add(Zl)._add(A0)}if(s1){let n0=Math.sin(s1),Gl=Math.cos(s1),a0=[Gl,-n0,n0,Gl];Z0._matMult(a0),b0._matMult(a0),A2._matMult(a0),I0._matMult(a0)}let V2=new H(0,0),hu=new H(0,0);w1.push({tl:Z0,tr:b0,bl:A2,br:I0,tex:n1,writingMode:Y.writingMode,glyphOffset:sl,sectionIndex:y1.sectionIndex,isSDF:U1,pixelOffsetTL:V2,pixelOffsetBR:hu,minFontScaleX:0,minFontScaleY:0})}return w1}(0,p,w,a,h,y,d,l.allowVerticalPlacement),D=l.textSizeData,I=null;D.kind==="source"?(I=[t5*a.layout.get("text-size").evaluate(y,{})],I[0]>i3&&w0(`${l.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)):D.kind==="composite"&&(I=[t5*C.compositeTextSizes[0].evaluate(y,{},B),t5*C.compositeTextSizes[1].evaluate(y,{},B)],(I[0]>i3||I[1]>i3)&&w0(`${l.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)),l.addSymbols(l.text,M,I,w,h,y,k,c,A.lineStartIndex,A.lineLength,q,B);for(let O of W)n[O]=l.text.placedSymbolArray.length-1;return 4*M.length}function xh(l){for(let c in l)return l[c];return null}function IE(l,c,p,d){let a=l.compareText;if(c in a){let h=a[c];for(let y=h.length-1;y>=0;y--)if(d.dist(h[y]) this.process()),this.subscription=N4(this.target,"message",(p)=>this.receive(p),!1),this.globalScope=W0(self)?l:window}registerMessageHandler(l,c){this.messageHandlers[l]=c}unregisterMessageHandler(l){delete this.messageHandlers[l]}sendAsync(l,c){return new Promise((p,d)=>{let a=Math.round(1000000000000000000*Math.random()).toString(36).substring(0,10),h=c?N4(c.signal,"abort",()=>{h==null||h.unsubscribe(),delete this.resolveRejects[a];let A={id:a,type:"",origin:location.origin,targetMapId:l.targetMapId,sourceMapId:this.mapId};this.target.postMessage(A)},pE):null;this.resolveRejects[a]={resolve:(A)=>{h==null||h.unsubscribe(),p(A)},reject:(A)=>{h==null||h.unsubscribe(),d(A)}};let y=[],w=Object.assign(Object.assign({},l),{id:a,sourceMapId:this.mapId,origin:location.origin,data:ru(l.data,y)});this.target.postMessage(w,{transfer:y})})}receive(l){let c=l.data,p=c.id,d=["file://","resource://android","null"],a=[c.origin,location.origin],h=c.origin===location.origin,y=a.some((w)=>d.includes(w));if((h||y)&&(!c.targetMapId||this.mapId===c.targetMapId)){if(c.type===""){delete this.tasks[p];let w=this.abortControllers[p];return delete this.abortControllers[p],void(w&&w.abort())}if(W0(self)||c.mustQueue)return this.tasks[p]=c,this.taskQueue.push(p),void this.invoker.trigger();this.processTask(p,c)}}process(){if(this.taskQueue.length===0)return;let l=this.taskQueue.shift(),c=this.tasks[l];delete this.tasks[l],this.taskQueue.length>0&&this.invoker.trigger(),c&&this.processTask(l,c)}processTask(l,c){return g(this,void 0,void 0,function*(){if(c.type===""){let a=this.resolveRejects[l];if(delete this.resolveRejects[l],!a)return;return void(c.error?a.reject(l0(mc(c.error))):a.resolve(mc(c.data)))}if(!this.messageHandlers[c.type])return void this.completeTask(l,Error(`Could not find a registered handler for ${c.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));let p=mc(c.data),d=new AbortController;this.abortControllers[l]=d;try{let a=yield this.messageHandlers[c.type](c.sourceMapId,p,d);this.completeTask(l,null,a)}catch(a){this.completeTask(l,l0(a))}})}completeTask(l,c,p){let d=[];delete this.abortControllers[l];let a={id:l,type:"",sourceMapId:this.mapId,origin:location.origin,error:c?ru(c):null,data:ru(p,d)};this.target.postMessage(a,{transfer:d})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},V.O=function(){var l=new v1(16);return v1!=Float32Array&&(l[1]=0,l[2]=0,l[3]=0,l[4]=0,l[6]=0,l[7]=0,l[8]=0,l[9]=0,l[11]=0,l[12]=0,l[13]=0,l[14]=0),l[0]=1,l[5]=1,l[10]=1,l[15]=1,l},V.P=H,V.Q=function(l,c,p){var d,a,h,y,w,A,k,W,n,q,C,B,M=p[0],D=p[1],I=p[2];return c===l?(l[12]=c[0]*M+c[4]*D+c[8]*I+c[12],l[13]=c[1]*M+c[5]*D+c[9]*I+c[13],l[14]=c[2]*M+c[6]*D+c[10]*I+c[14],l[15]=c[3]*M+c[7]*D+c[11]*I+c[15]):(a=c[1],h=c[2],y=c[3],w=c[4],A=c[5],k=c[6],W=c[7],n=c[8],q=c[9],C=c[10],B=c[11],l[0]=d=c[0],l[1]=a,l[2]=h,l[3]=y,l[4]=w,l[5]=A,l[6]=k,l[7]=W,l[8]=n,l[9]=q,l[10]=C,l[11]=B,l[12]=d*M+w*D+n*I+c[12],l[13]=a*M+A*D+q*I+c[13],l[14]=h*M+k*D+C*I+c[14],l[15]=y*M+W*D+B*I+c[15]),l},V.R=n2,V.S=function(l,c,p){var d=p[0],a=p[1],h=p[2];return l[0]=c[0]*d,l[1]=c[1]*d,l[2]=c[2]*d,l[3]=c[3]*d,l[4]=c[4]*a,l[5]=c[5]*a,l[6]=c[6]*a,l[7]=c[7]*a,l[8]=c[8]*h,l[9]=c[9]*h,l[10]=c[10]*h,l[11]=c[11]*h,l[12]=c[12],l[13]=c[13],l[14]=c[14],l[15]=c[15],l},V.T=d9,V.U=function(l,c,p){var d=c[0],a=c[1],h=c[2],y=c[3],w=c[4],A=c[5],k=c[6],W=c[7],n=c[8],q=c[9],C=c[10],B=c[11],M=c[12],D=c[13],I=c[14],O=c[15],Y=p[0],G=p[1],j=p[2],Z=p[3];return l[0]=Y*d+G*w+j*n+Z*M,l[1]=Y*a+G*A+j*q+Z*D,l[2]=Y*h+G*k+j*C+Z*I,l[3]=Y*y+G*W+j*B+Z*O,l[4]=(Y=p[4])*d+(G=p[5])*w+(j=p[6])*n+(Z=p[7])*M,l[5]=Y*a+G*A+j*q+Z*D,l[6]=Y*h+G*k+j*C+Z*I,l[7]=Y*y+G*W+j*B+Z*O,l[8]=(Y=p[8])*d+(G=p[9])*w+(j=p[10])*n+(Z=p[11])*M,l[9]=Y*a+G*A+j*q+Z*D,l[10]=Y*h+G*k+j*C+Z*I,l[11]=Y*y+G*W+j*B+Z*O,l[12]=(Y=p[12])*d+(G=p[13])*w+(j=p[14])*n+(Z=p[15])*M,l[13]=Y*a+G*A+j*q+Z*D,l[14]=Y*h+G*k+j*C+Z*I,l[15]=Y*y+G*W+j*B+Z*O,l},V.V=function(l,c){let p={};for(let d of c)d in l&&(p[d]=l[d]);return p},V.W=e3,V.X=Tc,V.Y=Uo,V.Z=Ko,V._=g,V.a=s3,V.a$=function(l){var c=new v1(3);return c[0]=l[0],c[1]=l[1],c[2]=l[2],c},V.a0=X1,V.a1=J1,V.a2=Y6,V.a3=K2,V.a4=Ro,V.a5=x9,V.a6=ll,V.a7=g8,V.a8=Wc,V.a9=25,V.aA=function(l){var c=l[0],p=l[1];return Math.sqrt(c*c+p*p)},V.aB=function(l){return l[0]=0,l[1]=0,l},V.aC=function(l,c,p){return l[0]=c[0]*p,l[1]=c[1]*p,l},V.aD=_d,V.aE=ul,V.aF=function(l,c,p,d){let a=c.y-l.y,h=c.x-l.x,y=d.y-p.y,w=d.x-p.x,A=y*h-w*a;if(A===0)return null;let k=(w*(l.y-p.y)-y*(l.x-p.x))/A;return new H(l.x+k*h,l.y+k*a)},V.aG=oh,V.aH=da,V.aI=function(l){let c=1/0,p=1/0,d=-1/0,a=-1/0;for(let h of l)c=Math.min(c,h.x),p=Math.min(p,h.y),d=Math.max(d,h.x),a=Math.max(a,h.y);return[c,p,d,a]},V.aJ=k0,V.aK=O0,V.aL=function(l,c,p,d,a=!1){if(!p[0]&&!p[1])return[0,0];let h=a?d==="map"?-l.bearingInRadians:0:d==="viewport"?l.bearingInRadians:0;if(h){let y=Math.sin(h),w=Math.cos(h);p=[p[0]*w-p[1]*y,p[0]*y+p[1]*w]}return[a?p[0]:O0(c,p[0],l.zoom),a?p[1]:O0(c,p[1],l.zoom)]},V.aN=$d,V.aO=Bm,V.aP=bd,V.aQ=(l)=>l.type==="symbol",V.aR=h9,V.aS=Pl,V.aT=t7,V.aU=t,V.aV=I1,V.aW=Q1,V.aX=Xu,V.aY=Ho,V.aZ=r1,V.a_=l1,V.aa=N9,V.ab=(l)=>{let c=window.document.createElement("video");return c.muted=!0,new Promise((p)=>{c.onloadstart=()=>{p(c)};for(let d of l){let a=window.document.createElement("source");G2(d)||(c.crossOrigin="Anonymous"),a.src=d,c.appendChild(a)}})},V.ac=M1,V.ad=function(){return y3++},V.ae=s,V.af=Vc,V.ag=h8,V.ah=lc,V.ai=y5,V.aj=cm,V.ak=function(l){let c={};if(l.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(p,d,a,h)=>{let y=a||h;return c[d]=!y||y.toLowerCase(),""}),c["max-age"]){let p=parseInt(c["max-age"],10);isNaN(p)?delete c["max-age"]:c["max-age"]=p}return c},V.al=G0,V.am=85.051129,V.an=Wu,V.ao=function(l){return Math.pow(2,l)},V.ap=o1,V.aq=Do,V.ar=function(l){return Math.log(l)/Math.LN2},V.as=function(l){var c=l[0],p=l[1];return c*c+p*p},V.at=function(l){if(!l.length)return new Set;let c=Math.max(...l.map((A)=>A.canonical.z)),p=1/0,d=-1/0,a=1/0,h=-1/0,y=[];for(let A of l){let{x:k,y:W,z:n}=A.canonical,q=Math.pow(2,c-n),C=k*q,B=W*q;y.push({id:A,x:C,y:B}),C0===k)for(let n=0,q=A.length;n<q/2;n+=2){let C=A[n],B=A[n+1];A[n]=A[q-2-n],A[n+1]=A[q-1-n],A[q-2-n]=C,A[q-1-n]=B}}(w,h),l.push(w)}function lo(l,c){if(l.transformed)return l;let p=1<<l.z,d=l.x,a=l.y;for(let h of l.features)h.type===1?Ak(h,c,p,d,a):Vk(h,c,p,d,a);return l.transformed=!0,l}function Ak(l,c,p,d,a){let h=l,y=l.geometry,w=[];for(let A=0;A<y.length;A+=2)w.push(uo(y[A],y[A+1],c,p,d,a));return h.geometry=w,h}function Vk(l,c,p,d,a){let h=l,y=l.geometry,w=[];for(let A of y){let k=[];for(let W=0;W1&&(console.log("invalidating tiles"),console.time("invalidating")),this.invalidateTiles(c),p.debug>1&&console.timeEnd("invalidating");let[d,a,h]=[0,0,0],y=ta(l,d,a,h,p);y.source=l;let w=S9(d,a,h);if(this.tiles[w]=y,this.tileCoords.push({z:d,x:a,y:h,id:w}),p.debug){let A=`z${d}`;this.stats[A]=(this.stats[A]||0)+1,this.total++}}getClusterExpansionZoom(l){return null}getChildren(l){return null}getLeaves(l,c,p){return null}getTile(l,c,p){let{extent:d,debug:a}=this.options,h=1<1&&console.log("drilling down to z%d-%d-%d",l,c,p);let w,A=l,k=c,W=p;for(;!w&&A>0;)A--,k>>=1,W>>=1,w=this.tiles[S9(A,k,W)];return w?.source?(a>1&&(console.log("found parent tile z%d-%d-%d",A,k,W),console.time("drilling down")),this.splitTile(w.source,A,k,W,l,c,p),a>1&&console.timeEnd("drilling down"),this.tiles[y]?lo(this.tiles[y],d):null):null}splitTile(l,c,p,d,a,h,y){let w=[l,c,p,d],A=this.options,k=A.debug;for(;w.length;){d=w.pop(),p=w.pop(),c=w.pop(),l=w.pop();let W=1<1&&console.time("creation"),q=this.tiles[n]=ta(l,c,p,d,A),this.tileCoords.push({z:c,x:p,y:d,id:n}),k)){k>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",c,p,d,q.numFeatures,q.numPoints,q.numSimplified),console.timeEnd("creation"));let d1=`z${c}`;this.stats[d1]=(this.stats[d1]||0)+1,this.total++}if(q.source=l,a==null){if(c===A.indexMaxZoom||q.numPoints>d1||d!==y>>d1)continue}}if(q.source=null,!l.length)continue;k>1&&console.time("clipping");let C=0.5*A.buffer/A.extent,B=0.5-C,M=0.5+C,D=1+C,I=null,O=null,Y=null,G=null,j=e5(l,W,p-C,p+M,X0.X,q.minX,q.maxX,A),Z=e5(l,W,p+B,p+D,X0.X,q.minX,q.maxX,A);j&&(I=e5(j,W,d-C,d+M,X0.Y,q.minY,q.maxY,A),O=e5(j,W,d+B,d+D,X0.Y,q.minY,q.maxY,A)),Z&&(Y=e5(Z,W,d-C,d+M,X0.Y,q.minY,q.maxY,A),G=e5(Z,W,d+B,d+D,X0.Y,q.minY,q.maxY,A)),k>1&&console.timeEnd("clipping"),w.push(I||[],c+1,2*p,2*d),w.push(O||[],c+1,2*p,2*d+1),w.push(Y||[],c+1,2*p+1,2*d),w.push(G||[],c+1,2*p+1,2*d+1)}}invalidateTiles(l){if(!l.length)return;let c=this.options,{debug:p}=c,d=1/0,a=-1/0,h=1/0,y=-1/0;for(let k of l)d=Math.min(d,k.minX),a=Math.max(a,k.maxX),h=Math.min(h,k.minY),y=Math.max(y,k.maxY);let w=c.buffer/c.extent,A=new Set;for(let k in this.tiles){let W=this.tiles[k],n=1<<W.z,q=(W.x-w)/n,C=(W.x+1+w)/n,B=(W.y-w)/n,M=(W.y+1+w)/n;if(a
=C||y=M)continue;let D=!1;for(let I of l)if(I.maxX>=q&&I.minX=B&&I.minY1&&console.log("invalidate tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",W.z,W.x,W.y,W.numFeatures,W.numPoints,W.numSimplified);let I=`z${W.z}`;this.stats[I]=(this.stats[I]||0)-1,this.total--}delete this.tiles[k],A.add(k)}}A.size&&(this.tileCoords=this.tileCoords.filter((k)=>!A.has(k.id)))}}function S9(l,c,p){return 32*((1<c.id),this.index=l.index,this.hasDependencies=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={};for(let c of this.layers)this.gradients[c.id]={};this.layoutVertexArray=new $,this.layoutVertexArray2=new e,this.indexArray=new Q1,this.programConfigurations=new au(l.layers,l.zoom),this.segments=new I1,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter((c)=>c.isStateDependent()).map((c)=>c.id)}populate(l,c,p){this.hasDependencies=m9("line",this.layers,c)||this.hasLineDasharray(this.layers);let d=this.layers[0].layout.get("line-sort-key"),a=!d.isConstant(),h=[];for(let{feature:y,id:w,index:A,sourceLayerIndex:k}of l){let W=this.layers[0]._featureFilter.needGeometry,n=y5(y,W);if(!this.layers[0]._featureFilter.filter(new Nl(this.zoom),n,p))continue;let q=a?d.evaluate(n,{},p):void 0,C={id:w,properties:y.properties,type:y.type,sourceLayerIndex:k,index:A,geometry:W?n.geometry:h5(y),patterns:{},dashes:{},sortKey:q};h.push(C)}a&&h.sort((y,w)=>y.sortKey-w.sortKey);for(let y of h){let{geometry:w,index:A,sourceLayerIndex:k}=y;this.hasDependencies?(m9("line",this.layers,c)?Nd("line",this.layers,y,{zoom:this.zoom},c):this.hasLineDasharray(this.layers)&&this.addLineDashDependencies(this.layers,y,this.zoom,c),this.patternFeatures.push(y)):this.addFeature(y,w,A,p,{},{},c.subdivisionGranularity),c.featureIndex.insert(l[A].feature,w,A,k,this.index)}}update(l,c,p,d){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(l,c,this.stateDependentLayers,{imagePositions:p,dashPositions:d})}addFeatures(l,c,p,d){for(let a of this.patternFeatures)this.addFeature(a,a.geometry,a.index,c,p,d,l.subdivisionGranularity)}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,Nk)),this.layoutVertexBuffer=l.createVertexBuffer(this.layoutVertexArray,Ck),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.hasOwn(l.properties,jd)&&Object.hasOwn(l.properties,Jd))return{start:+l.properties[jd],end:+l.properties[Jd]}}addFeature(l,c,p,d,a,h,y){let w=this.layers[0].layout,A=w.get("line-join").evaluate(l,{}),k=w.get("line-cap").evaluate(l,{}),W=w.get("line-miter-limit").evaluate(l,{}),n=w.get("line-round-limit").evaluate(l,{});this.lineClips=this.lineFeatureClips(l);for(let q of c)this.addLine(q,l,A,k,W,n,d,y);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,l,p,{imagePositions:a,dashPositions:h,canonical:d})}addLine(l,c,p,d,a,h,y,w){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,l=Ac(l,y?w.line.getGranularityForZoomLevel(y.z):1),this.lineClips){this.lineClipsArray.push(this.lineClips);for(let O=0;O=2&&l[k-1].equals(l[k-2]);)k--;let W=0;for(;W<k-1&&l[W].equals(l[W+1]);)W++;if(k<(A?3:2))return;p==="bevel"&&(a=1.05);let n=this.overscaling<=16?122880/(512*this.overscaling):0,q=this.segments.prepareSegment(10*k,this.layoutVertexArray,this.indexArray),C,B,M,D,I;this.e1=this.e2=-1,A&&(C=l[k-2],I=l[W].sub(C)._unit()._perp());for(let O=W;O<k;O++){if(M=O===k-1?A?l[W+1]:void 0:l[O+1],M&&l[O].equals(M))continue;I&&(D=I),C&&(B=C),C=l[O],I=M?M.sub(C)._unit()._perp():D,D||(D=I);let Y=D.add(I);Y.x===0&&Y.y===0||Y._unit();let G=D.x*I.x+D.y*I.y,j=Y.x*I.x+Y.y*I.y,Z=j!==0?1/j:1/0,d1=2*Math.sqrt(2-2*j),m1=j0;if(m1&&O>W){let k1=C.dist(B);if(k1>2*n){let y1=C.sub(C.sub(B)._mult(n/k1)._round());this.updateDistance(B,y1),this.addCurrentVertex(y1,D,0,0,q),B=y1}}let s1=B&&M,w1=s1?p:A?"butt":d;if(s1&&w1==="round"&&(Z<h?w1="miter":Za&&(w1="bevel"),w1==="bevel"&&(Z>2&&(w1="flipbevel"),Z100)Y=I.mult(-1);else{let k1=Z*D.add(I).mag()/D.sub(I).mag();Y._perp()._mult(k1*(a1?-1:1))}this.addCurrentVertex(C,Y,0,0,q),this.addCurrentVertex(C,Y.mult(-1),0,0,q)}else if(w1==="bevel"||w1==="fakeround"){let k1=-Math.sqrt(Z*Z-1),y1=a1?k1:0,n1=a1?0:k1;if(B&&this.addCurrentVertex(C,D,y1,n1,q),w1==="fakeround"){let Y1=Math.round(180*d1/Math.PI/20);for(let U1=1;U1<Y1;U1++){let K1=U1/Y1;if(K1!==0.5){let _1=K1-0.5;K1+=K1*_1*(K1-1)*((1.0904+G*(G*(3.55645-1.43519*G)-3.2452))*_1*_1+(0.848013+G*(0.215638*G-1.06021)))}let R1=I.sub(D)._mult(K1)._add(D)._unit()._mult(a1?-1:1);this.addHalfVertex(C,R1.x,R1.y,!1,a1,0,q)}}M&&this.addCurrentVertex(C,I,-y1,-n1,q)}else if(w1==="butt")this.addCurrentVertex(C,Y,0,0,q);else if(w1==="square"){let k1=B?1:-1;this.addCurrentVertex(C,Y,k1,k1,q)}else w1==="round"&&(B&&(this.addCurrentVertex(C,D,0,0,q),this.addCurrentVertex(C,D,1,1,q,!0)),M&&(this.addCurrentVertex(C,I,-1,-1,q,!0),this.addCurrentVertex(C,I,0,0,q)));if(m1&&O2*n){let y1=C.add(M.sub(C)._mult(n/k1)._round());this.updateDistance(C,y1),this.addCurrentVertex(y1,I,0,0,q),C=y1}}}}addCurrentVertex(l,c,p,d,a,h=!1){let y=c.y*d-c.x,w=-c.y-c.x*d;this.addHalfVertex(l,c.x+c.y*p,c.y-c.x*p,h,!1,p,a),this.addHalfVertex(l,y,w,h,!0,-d,a),this.distance>ro/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(l,c,p,d,a,h))}addHalfVertex({x:l,y:c},p,d,a,h,y,w){let A=0.5*(this.lineClips?this.scaledDistance*(ro-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((l<<1)+(a?1:0),(c<<1)+(h?1:0),Math.round(63*p)+128,Math.round(63*d)+128,1+(y===0?0:y<0?-1:1)|(63&A)<>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);let k=w.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,k,this.e2),w.primitiveLength++),h?this.e2=k:this.e1=k}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(l,c){this.distance+=l.dist(c),this.updateScaledDistance()}hasLineDasharray(l){for(let c of l){let p=c.paint.get("line-dasharray");if(p&&!p.isConstant())return!0}return!1}addLineDashDependencies(l,c,p,d){for(let a of l){let h=a.paint.get("line-dasharray");if(!h||h.value.kind==="constant")continue;let y=a.layout.get("line-cap").evaluate(c,{})==="round",w={dasharray:h.value.evaluate({zoom:p-1},c,{}),round:y},A={dasharray:h.value.evaluate({zoom:p},c,{}),round:y},k={dasharray:h.value.evaluate({zoom:p+1},c,{}),round:y},W=`${w.dasharray.join(",")},${w.round}`,n=`${A.dasharray.join(",")},${A.round}`,q=`${k.dasharray.join(",")},${k.round}`;d.dashDependencies[W]=w,d.dashDependencies[n]=A,d.dashDependencies[q]=k,c.dashes[a.id]={min:W,mid:n,max:q}}}}let po,fo;z1("LineBucket",k9,{omit:["layers","patternFeatures"]});var mo={get paint(){return fo=fo||new C0({"line-opacity":new $1(E1.paint_line["line-opacity"]),"line-color":new $1(E1.paint_line["line-color"]),"line-translate":new T1(E1.paint_line["line-translate"]),"line-translate-anchor":new T1(E1.paint_line["line-translate-anchor"]),"line-width":new $1(E1.paint_line["line-width"]),"line-gap-width":new $1(E1.paint_line["line-gap-width"]),"line-offset":new $1(E1.paint_line["line-offset"]),"line-blur":new $1(E1.paint_line["line-blur"]),"line-dasharray":new qu(E1.paint_line["line-dasharray"]),"line-pattern":new qu(E1.paint_line["line-pattern"]),"line-gradient":new X5(E1.paint_line["line-gradient"])})},get layout(){return po=po||new C0({"line-cap":new $1(E1.layout_line["line-cap"]),"line-join":new $1(E1.layout_line["line-join"]),"line-miter-limit":new $1(E1.layout_line["line-miter-limit"]),"line-round-limit":new $1(E1.layout_line["line-round-limit"]),"line-sort-key":new $1(E1.layout_line["line-sort-key"])})}};class go extends $1{possiblyEvaluate(l,c){return c=new Nl(Math.floor(c.zoom),{now:c.now,fadeDuration:c.fadeDuration,zoomHistory:c.zoomHistory,transition:c.transition}),super.possiblyEvaluate(l,c)}evaluate(l,c,p,d){return c=h2({},c,{zoom:Math.floor(c.zoom)}),super.evaluate(l,c,p,d)}}let E9;class vo extends r2{constructor(l,c){super(l,mo,c),this.gradientVersion=0,E9||(E9=new go(mo.paint.properties["line-width"].specification),E9.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(l){if(l==="line-gradient"){let c=this.gradientExpression();this.stepInterpolant=!!function(p){return p._styleExpression!==void 0}(c)&&c._styleExpression.expression instanceof F3,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(l,c){super.recalculate(l,c),this.paint._values["line-floorwidth"]=E9.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,l)}createBucket(l){return new k9(l)}queryRadius(l){let c=l,p=ao(zr("line-width",this,c),zr("line-gap-width",this,c)),d=zr("line-offset",this,c);return p/2+Math.abs(d)+p9(this.paint.get("line-translate"))}queryIntersectsFeature({queryGeometry:l,feature:c,featureState:p,geometry:d,transform:a,pixelsToTileUnits:h}){let y=f9(l,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),-a.bearingInRadians,h),w=h/2*ao(this.paint.get("line-width").evaluate(c,p),this.paint.get("line-gap-width").evaluate(c,p)),A=this.paint.get("line-offset").evaluate(c,p);return A&&(d=function(k,W){let n=[];for(let q of k){let C=qS(q),B=[];for(let M=0;M=3){for(let C of q)if(Yr(k,C))return!0}if(xS(k,q,n))return!0}return!1}(y,d,w)}isTileClipped(){return!0}}function ao(l,c){return c>0?c+2*l:l}let qk=Pl([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Pk=Pl([{name:"a_projected_pos",components:3,type:"Float32"}],4);Pl([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);let Mk=Pl([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);Pl([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);let oo=Pl([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),Bk=Pl([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function Kk(l,c,p){let d=c.layout.get("text-transform").evaluate(p,{});return d==="uppercase"?l=l.toLocaleUpperCase():d==="lowercase"&&(l=l.toLocaleLowerCase()),pu.applyArabicShaping&&(l=pu.applyArabicShaping(l)),l}function Uk(l,c,p){for(let d of l.sections)d.text=Kk(d.text,c,p);return l}Pl([{name:"triangle",components:3,type:"Uint16"}]),Pl([{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"}]),Pl([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Uint16",name:"textAnchorOffsetStartIndex"},{type:"Uint16",name:"textAnchorOffsetEndIndex"}]),Pl([{type:"Float32",name:"offsetX"}]),Pl([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),Pl([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);var k0=24;let d8={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","⋯":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"},Dk={10:!0,32:!0,38:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0},Rk={40:!0};function ho(l,c,p,d,a,h){if("fontStack"in c){let y=p[c.fontStack],w=y==null?void 0:y[l];return w?w.metrics.advance*c.scale+a:0}{let y=d[c.imageName];return y?y.displaySize[0]*c.scale*k0/h+a:0}}function yo(l,c,p,d){let a=Math.pow(l-c,2);return d?l<c?a/2:2*a:a+Math.abs(p)*p}function Hk(l,c,p){let d=0;return l===10&&(d-=1e4),p&&(d+=150),l!==40&&l!==65288||(d+=50),c!==41&&c!==65289||(d+=50),d}function wo(l,c,p,d,a,h){let y=null,w=yo(c,p,a,h);for(let A of d){let k=yo(c-A.x,p,a,h)+A.badness;kMath.max(l,this.sections[c].scale),0)}getMaxImageSize(l){let c=0,p=0;for(let d=0;dp))}addImageSection(l){let c=l.image?l.image.name:"";if(c.length===0)return void w0("Can't add FormattedSection with an empty image.");let p=this.getNextImageSectionCharCode();p?(this.text+=String.fromCharCode(p),this.sections.push({scale:1,verticalAlign:l.verticalAlign||"bottom",imageName:c}),this.sectionIndex.push(this.sections.length-1)):w0("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}determineLineBreaks(l,c,p,d,a){let h=[],y=this.determineAverageLineWidth(l,c,p,d,a),w=this.hasZeroWidthSpaces(),A=0,k=0,W=this.text[Symbol.iterator](),n=W.next(),q=this.text[Symbol.iterator]();q.next();let C=q.next(),B=this.text[Symbol.iterator]();B.next(),B.next();let M=B.next();for(;!n.done;){let D=this.getSection(k),I=n.value.codePointAt(0);if(R7(I)||(A+=ho(I,D,p,d,l,a)),!C.done){let O=kd(I),Y=C.value.codePointAt(0);(Dk[I]||O||("imageName"in D)||!M.done&&Rk[Y])&&h.push(wo(k+1,A,y,h,Hk(I,Y,O&&w),!1))}k++,n=W.next(),C=q.next(),M=B.next()}return so(wo(this.length(),A,y,h,0,!0))}determineAverageLineWidth(l,c,p,d,a){let h=0,y=0;for(let w of this.text){let A=this.getSection(y);h+=ho(w.codePointAt(0),A,p,d,l,a),y++}return h/Math.max(1,Math.ceil(h/c))}}let Td=4294967296,So=1/Td,ko=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");class m8{constructor(l=new Uint8Array(16)){this.buf=ArrayBuffer.isView(l)?l:new Uint8Array(l),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this.length=this.buf.length}readFields(l,c,p=this.length){for(;this.pos
Ti preghiamo di compilare il modulo sottostante e ti ricontatteremo il prima possibile
Ti piacerà anche






