=I[2])return m}else{for(var P=0,L=0;L=l[c[B]]&&(c.splice(B,0,L),O=!0);O||(c[P]=L),P++}}for(var N=0;N3&&void 0!==arguments[3]&&arguments[3],a=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(d(this,e),this.uid=t,n.height!==n.width)throw new RangeError("DEM tiles must be square");if(r&&"mapbox"!==r&&"terrarium"!==r)return ie('"'.concat(r,'" is not a valid encoding type. Valid types include "mapbox" and "terrarium".'));this.stride=n.height;var o=this.dim=n.height-2,s=new Uint32Array(n.data.buffer);if(this.pixels=new Uint8Array(n.data.buffer),this.encoding=r||"mapbox",this.borderReady=i,!i){for(var l=0;l2&&void 0!==arguments[2]&&arguments[2]&&(e=j(e,-1,this.dim),t=j(t,-1,this.dim));var n=4*this._idx(e,t);return("terrarium"===this.encoding?dm:hm)(this.pixels[n],this.pixels[n+1],this.pixels[n+2])}},{key:"unpackVector",get:function(){return fm[this.encoding]}},{key:"_idx",value:function(e,t){if(e<-1||e>=this.dim+1||t<-1||t>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(t+1)*this.stride+(e+1)}},{key:"getPixels",value:function(){return new Qc({width:this.stride,height:this.stride},this.pixels)}},{key:"backfillBorder",value:function(e,t,n){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");var r=t*this.dim,i=t*this.dim+this.dim,a=n*this.dim,o=n*this.dim+this.dim;switch(t){case-1:r=i-1;break;case 1:i=r+1}switch(n){case-1:a=o-1;break;case 1:o=a+1}for(var s=-t*this.dim,l=-n*this.dim,c=a;cthis.max){var o=this._getAndRemoveByKey(this.order[0]);o&&this.onRemove(o)}return this}},{key:"has",value:function(e){return e.wrapped().key in this.data}},{key:"getAndRemove",value:function(e){return this.has(e)?this._getAndRemoveByKey(e.wrapped().key):null}},{key:"_getAndRemoveByKey",value:function(e){var t=this.data[e].shift();return t.timeout&&clearTimeout(t.timeout),0===this.data[e].length&&delete this.data[e],this.order.splice(this.order.indexOf(e),1),t.value}},{key:"getByKey",value:function(e){var t=this.data[e];return t?t[0].value:null}},{key:"get",value:function(e){return this.has(e)?this.data[e.wrapped().key][0].value:null}},{key:"remove",value:function(e,t){if(!this.has(e))return this;var n=e.wrapped().key,r=void 0===t?0:this.data[n].indexOf(t),i=this.data[n][r];return this.data[n].splice(r,1),i.timeout&&clearTimeout(i.timeout),0===this.data[n].length&&delete this.data[n],this.onRemove(i.value),this.order.splice(this.order.indexOf(n),1),this}},{key:"setMaxSize",value:function(e){for(this.max=e;this.order.length>this.max;){var t=this._getAndRemoveByKey(this.order[0]);t&&this.onRemove(t)}return this}},{key:"filter",value:function(e){var t=[];for(var n in this.data){var r,i=h(this.data[n]);try{for(i.s();!(r=i.n()).done;){var a=r.value;e(a.value)||t.push(a)}}catch(c){i.e(c)}finally{i.f()}}for(var o=0,s=t;o1||(Math.abs(n)>1&&(1===Math.abs(n+i)?n+=i:1===Math.abs(n-i)&&(n-=i)),t.dem&&e.dem&&(e.dem.backfillBorder(t.dem,n,r),e.neighboringTiles&&e.neighboringTiles[a]&&(e.neighboringTiles[a].backfilled=!0)))}}}},{key:"getTile",value:function(e){return this.getTileByID(e.key)}},{key:"getTileByID",value:function(e){return this._tiles[e]}},{key:"_retainLoadedChildren",value:function(e,t,n,r){for(var i in this._tiles){var a=this._tiles[i];if(!(r[i]||!a.hasData()||a.tileID.overscaledZ<=t||a.tileID.overscaledZ>n)){for(var o=a.tileID;a&&a.tileID.overscaledZ>t+1;){var s=a.tileID.scaledTo(a.tileID.overscaledZ-1);(a=this._tiles[s.key])&&a.hasData()&&(o=s)}for(var l=o;l.overscaledZ>t;)if(e[(l=l.scaledTo(l.overscaledZ-1)).key]){r[o.key]=o;break}}}}},{key:"findLoadedParent",value:function(e,t){if(e.key in this._loadedParentTiles){var n=this._loadedParentTiles[e.key];return n&&n.tileID.overscaledZ>=t?n:null}for(var r=e.overscaledZ-1;r>=t;r--){var i=e.scaledTo(r),a=this._getLoadedTile(i);if(a)return a}}},{key:"_getLoadedTile",value:function(e){var t=this._tiles[e.key];return t&&t.hasData()?t:this._cache.getByKey(this._source.reparseOverscaled?e.wrapped().key:e.canonical.key)}},{key:"updateCacheSize",value:function(e,t){t=t||this._source.tileSize;var n=Math.ceil(e.width/t)+1,r=Math.ceil(e.height/t)+1,i=Math.floor(n*r*5),a="number"==typeof this._minTileCacheSize?Math.max(this._minTileCacheSize,i):i,o="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,a):a;this._cache.setMaxSize(o)}},{key:"handleWrapJump",value:function(e){var t=Math.round((e-(void 0===this._prevLng?e:this._prevLng))/360);if(this._prevLng=e,t){var n={};for(var r in this._tiles){var i=this._tiles[r];i.tileID=i.tileID.unwrapTo(i.tileID.wrap+t),n[i.tileID.key]=i}for(var a in this._tiles=n,this._timers)clearTimeout(this._timers[a]),delete this._timers[a];for(var o in this._tiles)this._setTileReloadTimer(+o,this._tiles[o])}}},{key:"update",value:function(e,t,r){var i=this;if(this.transform=e,this._sourceLoaded&&!this._paused&&!this.transform.freezeTileCoverage&&(!this.usedForTerrain||r)){var a;this.updateCacheSize(e,t),"globe"!==this.transform.projection.name&&this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?a=e.getVisibleUnwrappedCoordinates(this._source.tileID).map((function(e){return new Ef(e.canonical.z,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y)})):(a=e.coveringTiles({tileSize:t||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!r,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain}),this._source.hasTile&&(a=a.filter((function(e){return i._source.hasTile(e)})))):a=[];var o=this._updateRetainedTiles(a);if(Mm(this._source.type)&&0!==a.length){for(var s={},l={},c=0,u=Object.keys(o);cv;){_=_.scaledTo(_.overscaledZ-1);var x=this._tiles[_.key];if(x&&x.hasData()&&l[_.key]){o[y]=g.tileID;break}}}for(var b in s)o[b]||(this._coveredTiles[b]=!0,o[b]=s[b])}for(var w in o)this._tiles[w].clearFadeHold();var k,z=function(e,t){var n=[];for(var r in e)r in t||n.push(r);return n}(this._tiles,o),M=h(z);try{for(M.s();!(k=M.n()).done;){var T=k.value,S=this._tiles[T];S.hasSymbolBuckets&&!S.holdingForFade()?S.setHoldDuration(this.map._fadeDuration):S.hasSymbolBuckets&&!S.symbolFadeFinished()||this._removeTile(+T)}}catch(E){M.e(E)}finally{M.f()}this._updateLoadedParentTileCache(),this._onlySymbols&&this._source.afterUpdate&&this._source.afterUpdate()}}},{key:"releaseSymbolFadeTiles",value:function(){for(var e in this._tiles)this._tiles[e].holdingForFade()&&this._removeTile(+e)}},{key:"_updateRetainedTiles",value:function(e){var t={};if(0===e.length)return t;var r,i={},a=e.reduce((function(e,t){return Math.min(e,t.overscaledZ)}),1/0),o=e[0].overscaledZ,s=Math.max(o-n.maxOverzooming,this._source.minzoom),l=Math.max(o+n.maxUnderzooming,this._source.minzoom),c={},u=h(e);try{for(u.s();!(r=u.n()).done;){var f=r.value,d=this._addTile(f);t[f.key]=f,d.hasData()||a=this._source.maxzoom){var g=v.children(this._source.maxzoom)[0],_=this.getTile(g);if(_&&_.hasData()){t[g.key]=g;continue}}else{var x=v.children(this._source.maxzoom);if(t[x[0].key]&&t[x[1].key]&&t[x[2].key]&&t[x[3].key])continue}for(var b=y.wasRequested(),w=v.overscaledZ-1;w>=s;--w){var k=v.scaledTo(w);if(i[k.key])break;if(i[k.key]=!0,!(y=this.getTile(k))&&b&&(y=this._addTile(k)),y&&(t[k.key]=k,b=y.wasRequested(),y.hasData()))break}}}}catch(z){m.e(z)}finally{m.f()}return t}},{key:"_updateLoadedParentTileCache",value:function(){for(var e in this._loadedParentTiles={},this._tiles){for(var t=[],n=void 0,r=this._tiles[e].tileID;r.overscaledZ>0;){if(r.key in this._loadedParentTiles){n=this._loadedParentTiles[r.key];break}t.push(r.key);var i=r.scaledTo(r.overscaledZ-1);if(n=this._getLoadedTile(i))break;r=i}for(var a=0,o=t;a0||(t.hasData()&&"reloading"!==t.state?this._cache.add(t.tileID,t,t.getExpiryTimeout()):(t.aborted=!0,this._abortTile(t),this._unloadTile(t))))}},{key:"clearTiles",value:function(){for(var e in this._shouldReloadOnResume=!1,this._paused=!1,this._tiles)this._removeTile(+e);this._source._clear&&this._source._clear(),this._cache.reset(),this.map&&this.usedForTerrain&&this.map.painter.terrain&&this.map.painter.terrain.resetTileLookupCache(this.id)}},{key:"tilesIn",value:function(e,t,n){var r=[],i=this.transform;if(!i)return r;var a="globe"===i.projection.name,o=ic(i.center.lng);for(var s in this._tiles){var l=this._tiles[s];if(n&&l.clearQueryDebugViz(),!l.holdingForFade()){var c=void 0;if(a){var f=l.tileID.canonical;if(0===f.z){var d=[Math.abs(j.apply(void 0,[o].concat(u(Tm(f,-1))))-o),Math.abs(j.apply(void 0,[o].concat(u(Tm(f,1))))-o)];c=[0,2*d.indexOf(Math.min.apply(Math,d))-1]}else{var p=[Math.abs(j.apply(void 0,[o].concat(u(Tm(f,-1))))-o),Math.abs(j.apply(void 0,[o].concat(u(Tm(f,0))))-o),Math.abs(j.apply(void 0,[o].concat(u(Tm(f,1))))-o)];c=[p.indexOf(Math.min.apply(Math,p))-1]}}else c=[0];var m,v=h(c);try{for(v.s();!(m=v.n()).done;){var y=m.value,g=e.containsTile(l,i,t,y);g&&r.push(g)}}catch(_){v.e(_)}finally{v.f()}}}return r}},{key:"getVisibleCoordinates",value:function(e){var t,n=this,r=this.getRenderableIds(e).map((function(e){return n._tiles[e].tileID})),i=h(r);try{for(i.s();!(t=i.n()).done;){var a=t.value;a.projMatrix=this.transform.calculateProjMatrix(a.toUnwrapped())}}catch(o){i.e(o)}finally{i.f()}return r}},{key:"hasTransition",value:function(){if(this._source.hasTransition())return!0;if(Mm(this._source.type))for(var e in this._tiles){var t=this._tiles[e];if(void 0!==t.fadeEndTime&&t.fadeEndTime>=lt.now())return!0}return!1}},{key:"setFeatureState",value:function(e,t,n){this._state.updateState(e=e||"_geojsonTileLayer",t,n)}},{key:"removeFeatureState",value:function(e,t,n){this._state.removeFeatureState(e=e||"_geojsonTileLayer",t,n)}},{key:"getFeatureState",value:function(e,t){return this._state.getState(e=e||"_geojsonTileLayer",t)}},{key:"setDependencies",value:function(e,t,n){var r=this._tiles[e];r&&r.setDependencies(t,n)}},{key:"reloadTilesForDependencies",value:function(e,t){for(var n in this._tiles)this._tiles[n].hasDependency(e,t)&&this._reloadTile(+n,"reloading");this._cache.filter((function(n){return!n.hasDependency(e,t)}))}},{key:"_preloadTiles",value:function(e,t){var n=this;if(this._sourceLoaded){var r,i=new Map,a=Array.isArray(e)?e:[e],o=this.map.painter.terrain,s=this.usedForTerrain&&o?o.getScaledDemTileSize():this._source.tileSize,l=h(a);try{for(l.s();!(r=l.n()).done;){var c,u=r.value,f=u.coveringTiles({tileSize:s,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!this.usedForTerrain,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain}),d=h(f);try{for(d.s();!(c=d.n()).done;){var p=c.value;i.set(p.key,p)}}catch(v){d.e(v)}finally{d.f()}this.usedForTerrain&&u.updateElevation(!1)}}catch(v){l.e(v)}finally{l.f()}Z(Array.from(i.values()),(function(e,t){var r=new tm(e,n._source.tileSize*e.overscaleFactor(),n.transform.tileZoom,n.map.painter,n._isRaster);n._loadTile(r,(function(e){"raster-dem"===n._source.type&&r.dem&&n._backfillDEM(r),t(e,r)}))}),t)}else{var m=function r(){n._sourceLoaded&&(n._source.off("data",r),n._preloadTiles(e,t))};this._source.on("data",m)}}}]),n}(dt);function zm(e,t){var n=Math.abs(2*e.wrap)-+(e.wrap<0),r=Math.abs(2*t.wrap)-+(t.wrap<0);return e.overscaledZ-t.overscaledZ||r-n||t.canonical.y-e.canonical.y||t.canonical.x-e.canonical.x}function Mm(e){return"raster"===e||"image"===e||"video"===e||"custom"===e}function Tm(e,t){var n=1<5&&void 0!==arguments[5]?arguments[5]:0,o=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(n,r,i,a);for(var s=this.grid,l=0;l=0&&u[3]>=0&&s.insert(o,u[0],u[1],u[2],u[3])}}},{key:"loadVTLayers",value:function(){if(!this.vtLayers)for(var e in this.vtLayers=new of(new Eh(this.rawTileData)).layers,this.sourceLayerCoder=new Pp(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"]),this.vtFeatures={},this.vtLayers)this.vtFeatures[e]=[];return this.vtLayers}},{key:"query",value:function(e,t,n,r){var i=this;this.loadVTLayers();var a=e.params||{},o=Mi(a.filter),s=e.tileResult,l=e.transform,c=s.bufferedTilespaceBounds,u=this.grid.query(c.min.x,c.min.y,c.max.x,c.max.y,(function(e,t,n,r){return Rc(s.bufferedTilespaceGeometry,e,t,n,r)}));u.sort(Am);var f=null;l.elevation&&u.length>0&&(f=Sm.create(l.elevation,this.tileID));for(var h,d={},p=function(){var l=u[m];if(l===h)return 1;h=l;var c=i.featureIndexArray.get(l),p=null;i.loadMatchingFeature(d,c,o,a.layers,a.availableImages,t,n,r,(function(t,n,r){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return p||(p=xc(t,i.tileID.canonical,e.tileTransform)),n.queryIntersectsFeature(s,t,r,p,i.z,e.transform,e.pixelPosMatrix,f,a)}))},m=0;m=0)return!0;return!1}(r,d)){var p=this.sourceLayerCoder.decode(f),m=this.vtLayers[p].feature(c);if(n.needGeometry){var v=bc(m,!0);if(!n.filter(new Oa(this.tileID.overscaledZ),v,this.tileID.canonical))return}else if(!n.filter(new Oa(this.tileID.overscaledZ),m))return;for(var y=this.getId(m,p),g=0;g1&&(s=e[++o]);var c=Math.abs(l-s.left),u=Math.abs(l-s.right),f=Math.min(c,u),h=void 0,d=i/n*(r+1);if(s.isDash){var p=r-Math.abs(d);h=Math.sqrt(f*f+p*p)}else h=r-Math.sqrt(f*f+d*d);this.image.data[a+l]=Math.max(0,Math.min(255,h+128))}}},{key:"addRegularDash",value:function(e,t){for(var n=e.length-1;n>=0;--n){var r=e[n],i=e[n+1];r.zeroLength?e.splice(n,1):i&&i.isDash===r.isDash&&(i.left=r.left,e.splice(n,1))}var a=e[0],o=e[e.length-1];a.isDash===o.isDash&&(a.left=o.left-this.width,o.right=a.right+this.width);for(var s=this.width*this.nextRow,l=0,c=e[l],u=0;u1&&(c=e[++l]);var f=Math.abs(u-c.left),h=Math.abs(u-c.right),d=Math.min(f,h);this.image.data[s+u]=Math.max(0,Math.min(255,(c.isDash?d:-d)+t+128))}}},{key:"addDash",value:function(e,t){var n=this.getKey(e,t);if(this.positions[n])return this.positions[n];var r="round"===t,i=r?7:0,a=2*i+1;if(this.nextRow+a>this.height)return ie("LineAtlas out of space"),null;0===e.length&&e.push(1);for(var o=0,s=0;s=I.maxzoom||"none"!==I.visibility&&(Rm(A,this.zoom,n),(d[I.id]=I.createBucket({index:s.bucketLayerIDs.length,layers:A,zoom:this.zoom,canonical:this.canonical,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:k,sourceID:this.source,enableTerrain:this.enableTerrain,projection:this.projection.spec,availableImages:n})).populate(z,m,this.tileID.canonical,this.tileTransform),s.bucketLayerIDs.push(A.map((function(e){return e.id}))))}}catch(B){C.e(B)}finally{C.f()}}}}p.trim();var P={type:"maybePrepare",isSymbolTile:this.isSymbolTile,zoom:this.zoom},L=function(){if(l)return i(l);if(c&&u&&f){var e=new Lm(c),t=new Bh(u,f);for(var r in d){var o=d[r];o instanceof gp?(Rm(o.layers,a.zoom,n),Id(o,c,e.positions,u,t.iconPositions,a.showCollisionBoxes,n,a.tileID.canonical,a.tileZoom,a.projection)):o.hasPattern&&(o instanceof Nf||o instanceof Vu||o instanceof pf)&&(Rm(o.layers,a.zoom,n),o.addFeatures(m,a.tileID.canonical,t.patternPositions,n,a.tileTransform))}a.status="done",i(null,{buckets:G(d).filter((function(e){return!e.isEmpty()})),featureIndex:s,collisionBoxArray:a.collisionBoxArray,glyphAtlasImage:e.image,lineAtlas:p,imageAtlas:t,glyphMap:a.returnDependencies?c:null,iconMap:a.returnDependencies?u:null,glyphPositions:a.returnDependencies?e.positions:null})}},D=ee(m.glyphDependencies,(function(e){return Object.keys(e).map(Number)}));Object.keys(D).length?r.send("getGlyphs",{uid:this.uid,stacks:D},(function(e,t){l||(l=e,c=t,L())}),void 0,!1,P):c={};var R=Object.keys(m.iconDependencies);R.length?r.send("getImages",{icons:R,source:this.source,tileID:this.tileID,type:"icons"},(function(e,t){l||(l=e,u=t,L())}),void 0,!1,P):u={};var O=Object.keys(m.patternDependencies);O.length?r.send("getImages",{icons:O,source:this.source,tileID:this.tileID,type:"patterns"},(function(e,t){l||(l=e,f=t,L())}),void 0,!1,P):f={},L()}}]),e}();function Rm(e,t,n){var r,i=new Oa(t),a=h(e);try{for(a.s();!(r=a.n()).done;)r.value.recalculate(i,n)}catch(o){a.e(o)}finally{a.f()}}var Om=function(){function e(t){d(this,e),this.entries={},this.scheduler=t}return p(e,[{key:"request",value:function(e,t,n,r){var i=this,a=this.entries[e]=this.entries[e]||{callbacks:[]};if(a.result){var o=f(a.result,2),s=o[0],l=o[1];return this.scheduler?this.scheduler.add((function(){r(s,l)}),t):r(s,l),function(){}}return a.callbacks.push(r),a.cancel||(a.cancel=n((function(n,r){a.result=[n,r];var o,s=h(a.callbacks);try{var l=function(){var e=o.value;i.scheduler?i.scheduler.add((function(){e(n,r)}),t):e(n,r)};for(s.s();!(o=s.n()).done;)l()}catch(c){s.e(c)}finally{s.f()}setTimeout((function(){return delete i.entries[e]}),3e3)}))),function(){a.result||(a.callbacks=a.callbacks.filter((function(e){return e!==r})),a.callbacks.length||(a.cancel(),delete i.entries[e]))}}}]),e}();function Bm(e,t,n){var r=JSON.stringify(e.request);return e.data&&(this.deduped.entries[r]={result:[null,e.data]}),this.deduped.request(r,{type:"parseTile",isSymbolTile:e.isSymbolTile,zoom:e.tileZoom},(function(t){var r=Te(e.request,(function(e,r,i,a){e?t(e):r&&t(null,{vectorTile:n?void 0:new of(new Eh(r)),rawData:r,cacheControl:i,expires:a})}));return function(){r.cancel(),t()}}),t)}var Nm=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],Fm=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:64,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Float64Array,i=arguments.length>3?arguments[3]:void 0;if(d(this,e),isNaN(t)||t<0)throw new Error("Unpexpected numItems value: ".concat(t,"."));this.numItems=+t,this.nodeSize=Math.min(Math.max(+n,2),65535),this.ArrayType=r,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;var a=Nm.indexOf(this.ArrayType),o=2*t*this.ArrayType.BYTES_PER_ELEMENT,s=t*this.IndexArrayType.BYTES_PER_ELEMENT,l=(8-s%8)%8;if(a<0)throw new Error("Unexpected typed array class: ".concat(r,"."));i&&i instanceof ArrayBuffer?(this.data=i,this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+s+l,2*t),this._pos=2*t,this._finished=!0):(this.data=new ArrayBuffer(8+o+s+l),this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+s+l,2*t),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+a]),new Uint16Array(this.data,2,1)[0]=n,new Uint32Array(this.data,4,1)[0]=t)}return p(e,[{key:"add",value:function(e,t){var n=this._pos>>1;return this.ids[n]=n,this.coords[this._pos++]=e,this.coords[this._pos++]=t,n}},{key:"finish",value:function(){var e=this._pos>>1;if(e!==this.numItems)throw new Error("Added ".concat(e," items when expected ").concat(this.numItems,"."));return Vm(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}},{key:"range",value:function(e,t,n,r){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");for(var i=this.ids,a=this.coords,o=this.nodeSize,s=[0,i.length-1,0],l=[];s.length;){var c=s.pop()||0,u=s.pop()||0,f=s.pop()||0;if(u-f<=o)for(var h=f;h<=u;h++){var d=a[2*h],p=a[2*h+1];d>=e&&d<=n&&p>=t&&p<=r&&l.push(i[h])}else{var m=f+u>>1,v=a[2*m],y=a[2*m+1];v>=e&&v<=n&&y>=t&&y<=r&&l.push(i[m]),(0===c?e<=v:t<=y)&&(s.push(f),s.push(m-1),s.push(1-c)),(0===c?n>=v:r>=y)&&(s.push(m+1),s.push(u),s.push(1-c))}}return l}},{key:"within",value:function(e,t,n){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");for(var r=this.ids,i=this.coords,a=this.nodeSize,o=[0,r.length-1,0],s=[],l=n*n;o.length;){var c=o.pop()||0,u=o.pop()||0,f=o.pop()||0;if(u-f<=a)for(var h=f;h<=u;h++)Zm(i[2*h],i[2*h+1],e,t)<=l&&s.push(r[h]);else{var d=f+u>>1,p=i[2*d],m=i[2*d+1];Zm(p,m,e,t)<=l&&s.push(r[d]),(0===c?e-n<=p:t-n<=m)&&(o.push(f),o.push(d-1),o.push(1-c)),(0===c?e+n>=p:t+n>=m)&&(o.push(d+1),o.push(u),o.push(1-c))}}return s}}],[{key:"from",value:function(t){if(!(t instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");var n=new Uint8Array(t,0,2),r=f(n,2),i=r[0],a=r[1];if(219!==i)throw new Error("Data does not appear to be in a KDBush format.");var o=a>>4;if(1!==o)throw new Error("Got v".concat(o," data when expected v1."));var s=Nm[15&a];if(!s)throw new Error("Unrecognized array type.");var l=new Uint16Array(t,2,1),c=f(l,1)[0],u=new Uint32Array(t,4,1);return new e(f(u,1)[0],c,s,t)}}]),e}();function Vm(e,t,n,r,i,a){if(!(i-r<=n)){var o=r+i>>1;jm(e,t,o,r,i,a),Vm(e,t,n,r,o-1,1-a),Vm(e,t,n,o+1,i,1-a)}}function jm(e,t,n,r,i,a){for(;i>r;){if(i-r>600){var o=i-r+1,s=n-r+1,l=Math.log(o),c=.5*Math.exp(2*l/3),u=.5*Math.sqrt(l*c*(o-c)/o)*(s-o/2<0?-1:1);jm(e,t,n,Math.max(r,Math.floor(n-s*c/o+u)),Math.min(i,Math.floor(n+(o-s)*c/o+u)),a)}var f=t[2*n+a],h=r,d=i;for(Um(e,t,r,n),t[2*i+a]>f&&Um(e,t,r,i);hf;)d--}t[2*r+a]===f?Um(e,t,r,d):Um(e,t,++d,i),d<=n&&(r=d+1),n<=d&&(i=d-1)}}function Um(e,t,n,r){Hm(e,n,r),Hm(t,2*n,2*r),Hm(t,2*n+1,2*r+1)}function Hm(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function Zm(e,t,n,r){var i=e-n,a=t-r;return i*i+a*a}e.ARRAY_TYPE=Ms,e.AUTH_ERR_MSG=Pe,e.Aabb=gl,e.Actor=function(){function e(t,n,r){d(this,e),this.target=t,this.parent=n,this.mapId=r,this.callbacks={},this.cancelCallbacks={},J(["receive"],this),this.target.addEventListener("message",this.receive,!1),this.globalScope=se()?t:g,this.scheduler=new Ip}return p(e,[{key:"send",value:function(e,t,n,r){var i=this,a=arguments.length>4&&void 0!==arguments[4]&&arguments[4],o=arguments.length>5?arguments[5]:void 0,s=Math.round(1e18*Math.random()).toString(36).substring(0,10);n&&(n.metadata=o,this.callbacks[s]=n);var l=ue(this.globalScope)?void 0:[];return this.target.postMessage({id:s,type:e,hasCallback:!!n,targetMapId:r,mustQueue:a,sourceMapId:this.mapId,data:da(t,l)},l),{cancel:function(){n&&delete i.callbacks[s],i.target.postMessage({id:s,type:"",targetMapId:r,sourceMapId:i.mapId})}}}},{key:"receive",value:function(e){var t=this,n=e.data,r=n.id;if(r&&(!n.targetMapId||this.mapId===n.targetMapId))if(""===n.type){var i=this.cancelCallbacks[r];delete this.cancelCallbacks[r],i&&i.cancel()}else if(n.mustQueue||se()){var a=this.callbacks[r];this.cancelCallbacks[r]=this.scheduler.add((function(){return t.processTask(r,n)}),a&&a.metadata||{type:"message"})}else this.processTask(r,n)}},{key:"processTask",value:function(e,t){var n=this;if(""===t.type){var r=this.callbacks[e];delete this.callbacks[e],r&&(t.error?r(pa(t.error)):r(null,pa(t.data)))}else{var i=ue(this.globalScope)?void 0:[],a=t.hasCallback?function(t,r){delete n.cancelCallbacks[e],n.target.postMessage({id:e,type:"",sourceMapId:n.mapId,error:t?da(t):null,data:da(r,i)},i)}:function(e){},o=pa(t.data);if(this.parent[t.type])this.parent[t.type](t.sourceMapId,o,a);else if(this.parent.getWorkerSource){var s=t.type.split(".");this.parent.getWorkerSource(t.sourceMapId,s[0],o.source)[s[1]](o,a)}else a(new Error("Could not find function ".concat(t.type)))}}},{key:"remove",value:function(){this.scheduler.remove(),this.target.removeEventListener("message",this.receive,!1)}}]),e}(),e.CanonicalTileID=Tf,e.Color=Gt,e.ColorMode=_m,e.CullFaceMode=wm,e.DEMData=pm,e.DataConstantProperty=Ga,e.DedupedRequest=Om,e.DepthMode=vm,e.EXTENT=ws,e.Elevation=function(){function e(){d(this,e)}return p(e,[{key:"isDataAvailableAtPoint",value:function(e){var t=this._source();if(this.isUsingMockSource()||!t||e.y<0||e.y>1)return!1;var n=t.getSource().maxzoom,r=1<1&&void 0!==arguments[1]?arguments[1]:0;return this.getAtPoint(e,t)||0}},{key:"getAtPoint",value:function(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(this.isUsingMockSource())return null;null==t&&(t=null);var r=this._source();if(!r)return t;if(e.y<0||e.y>1)return t;var i=r.getSource().maxzoom,a=1<this._skuTokenExpiresAt}},{key:"transformRequest",value:function(e,t){return this._transformRequestFn&&this._transformRequestFn(e,t)||{url:e}}},{key:"normalizeStyleURL",value:function(e,t){if(!Le(e))return e;var n=Fe(e);return n.path="/styles/v1".concat(n.path),this._makeAPIURL(n,this._customAccessToken||t)}},{key:"normalizeGlyphsURL",value:function(e,t){if(!Le(e))return e;var n=Fe(e);return n.path="/fonts/v1".concat(n.path),this._makeAPIURL(n,this._customAccessToken||t)}},{key:"normalizeSourceURL",value:function(e,t,n,r){if(!Le(e))return e;var i=Fe(e);return i.path="/v4/".concat(i.authority,".json"),i.params.push("secure"),n&&i.params.push("language=".concat(n)),r&&i.params.push("worldview=".concat(r)),this._makeAPIURL(i,this._customAccessToken||t)}},{key:"normalizeSpriteURL",value:function(e,t,n,r){var i=Fe(e);return Le(e)?(i.path="/styles/v1".concat(i.path,"/sprite").concat(t).concat(n),this._makeAPIURL(i,this._customAccessToken||r)):(i.path+="".concat(t).concat(n),Ve(i))}},{key:"normalizeTileURL",value:function(e,t,n){if(this._isSkuTokenExpired()&&this._createSkuToken(),e&&!Le(e))return e;var r=Fe(e);r.path=r.path.replace(/(\.(png|jpg)\d*)(?=$)/,"".concat(t||n&&"raster"!==r.authority&&512===n?"@2x":"").concat(b.supported?".webp":"$1")),"raster"===r.authority?r.path="/".concat(x.RASTER_URL_PREFIX).concat(r.path):(r.path=r.path.replace(/^.+\/v4\//,"/"),r.path="/".concat(x.TILE_URL_VERSION).concat(r.path));var i=this._customAccessToken||function(e){var t,n=h(e);try{for(n.s();!(t=n.n()).done;){var r=t.value.match(/^access_token=(.*)$/);if(r)return r[1]}}catch(i){n.e(i)}finally{n.f()}return null}(r.params)||x.ACCESS_TOKEN;return x.REQUIRE_ACCESS_TOKEN&&i&&this._skuToken&&r.params.push("sku=".concat(this._skuToken)),this._makeAPIURL(r,i)}},{key:"canonicalizeTileURL",value:function(e,t){var n=Fe(e);if(!n.path.match(/^(\/v4\/|\/raster\/v1\/)/)||!n.path.match(/\.[\w]+$/))return e;var r="mapbox://";n.path.match(/^\/raster\/v1\//)?r+="raster/".concat(n.path.replace("/".concat(x.RASTER_URL_PREFIX,"/"),"")):r+="tiles/".concat(n.path.replace("/".concat(x.TILE_URL_VERSION,"/"),""));var i=n.params;return t&&(i=i.filter((function(e){return!e.match(/^access_token=/)}))),i.length&&(r+="?".concat(i.join("&"))),r}},{key:"canonicalizeTileset",value:function(e,t){var n,r=!!t&&Le(t),i=[],a=h(e.tiles||[]);try{for(a.s();!(n=a.n()).done;){var o=n.value;De(o)?i.push(this.canonicalizeTileURL(o,r)):i.push(o)}}catch(s){a.e(s)}finally{a.f()}return i}},{key:"_makeAPIURL",value:function(e,t){var n="See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes",r=Fe(x.API_URL);if(e.protocol=r.protocol,e.authority=r.authority,"http"===e.protocol){var i=e.params.indexOf("secure");i>=0&&e.params.splice(i,1)}if("/"!==r.path&&(e.path="".concat(r.path).concat(e.path)),!x.REQUIRE_ACCESS_TOKEN)return Ve(e);if(t=t||x.ACCESS_TOKEN,!this._silenceAuthErrors){if(!t)throw new Error("An API access token is required to use Mapbox GL. ".concat(n));if("s"===t[0])throw new Error("Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). ".concat(n))}return e.params=e.params.filter((function(e){return-1===e.indexOf("access_token")})),e.params.push("access_token=".concat(t||"")),Ve(e)}}]),e}(),e.ResourceType=we,e.SegmentVector=bs,e.SourceCache=km,e.StencilMode=gm,e.StructArrayLayout1ui2=Mo,e.StructArrayLayout2f1f2i16=mo,e.StructArrayLayout2i4=to,e.StructArrayLayout2ui4=zo,e.StructArrayLayout3f12=yo,e.StructArrayLayout3ui6=go,e.StructArrayLayout4i8=ro,e.StructArrayLayout5f20=wo,e.Texture=Cp,e.Tile=tm,e.Transitionable=Fa,e.Uniform1f=Jo,e.Uniform1i=function(e){m(n,e);var t=v(n);function n(e){var r;return d(this,n),(r=t.call(this,e)).current=0,r}return p(n,[{key:"set",value:function(e,t,n){this.fetchUniformLocation(e,t)&&this.current!==n&&(this.current=n,this.gl.uniform1i(this.location,n))}}]),n}($o),e.Uniform2f=function(e){m(n,e);var t=v(n);function n(e){var r;return d(this,n),(r=t.call(this,e)).current=[0,0],r}return p(n,[{key:"set",value:function(e,t,n){this.fetchUniformLocation(e,t)&&(n[0]===this.current[0]&&n[1]===this.current[1]||(this.current=n,this.gl.uniform2f(this.location,n[0],n[1])))}}]),n}($o),e.Uniform3f=function(e){m(n,e);var t=v(n);function n(e){var r;return d(this,n),(r=t.call(this,e)).current=[0,0,0],r}return p(n,[{key:"set",value:function(e,t,n){this.fetchUniformLocation(e,t)&&(n[0]===this.current[0]&&n[1]===this.current[1]&&n[2]===this.current[2]||(this.current=n,this.gl.uniform3f(this.location,n[0],n[1],n[2])))}}]),n}($o),e.Uniform4f=Qo,e.UniformColor=es,e.UniformMatrix2f=function(e){m(n,e);var t=v(n);function n(e){var r;return d(this,n),(r=t.call(this,e)).current=rs,r}return p(n,[{key:"set",value:function(e,t,n){if(this.fetchUniformLocation(e,t))for(var r=0;r<4;r++)if(n[r]!==this.current[r]){this.current=n,this.gl.uniformMatrix2fv(this.location,!1,n);break}}}]),n}($o),e.UniformMatrix3f=function(e){m(n,e);var t=v(n);function n(e){var r;return d(this,n),(r=t.call(this,e)).current=ns,r}return p(n,[{key:"set",value:function(e,t,n){if(this.fetchUniformLocation(e,t))for(var r=0;r<9;r++)if(n[r]!==this.current[r]){this.current=n,this.gl.uniformMatrix3fv(this.location,!1,n);break}}}]),n}($o),e.UniformMatrix4f=function(e){m(n,e);var t=v(n);function n(e){var r;return d(this,n),(r=t.call(this,e)).current=ts,r}return p(n,[{key:"set",value:function(e,t,n){if(this.fetchUniformLocation(e,t)){if(n[12]!==this.current[12]||n[0]!==this.current[0])return this.current=n,void this.gl.uniformMatrix4fv(this.location,!1,n);for(var r=1;r<16;r++)if(n[r]!==this.current[r]){this.current=n,this.gl.uniformMatrix4fv(this.location,!1,n);break}}}}]),n}($o),e.UnwrappedTileID=Sf,e.ValidationError=vi,e.VectorTileFeature=sf,e.VectorTileWorkerSource=function(e){m(n,e);var t=v(n);function n(e,r,i,a,o){var s;return d(this,n),(s=t.call(this)).actor=e,s.layerIndex=r,s.availableImages=i,s.loadVectorData=o||Bm,s.loading={},s.loaded={},s.deduped=new Om(e.scheduler),s.isSpriteLoaded=a,s.scheduler=e.scheduler,s}return p(n,[{key:"loadTile",value:function(e,t){var n=this,r=e.uid,i=e&&e.request,a=i&&i.collectResourceTiming,o=this.loading[r]=new Dm(e);o.abort=this.loadVectorData(e,(function(s,l){var c=!n.loading[r];if(delete n.loading[r],c||s||!l)return o.status="done",c||(n.loaded[r]=o),t(s);var u=l.rawData,f={};l.expires&&(f.expires=l.expires),l.cacheControl&&(f.cacheControl=l.cacheControl),o.vectorTile=l.vectorTile||new of(new Eh(u));var h=function(){o.parse(o.vectorTile,n.layerIndex,n.availableImages,n.actor,(function(e,n){if(e||!n)return t(e);var r={};if(a){var o=st(i);o.length>0&&(r.resourceTiming=JSON.parse(JSON.stringify(o)))}t(null,q({rawTileData:u.slice(0)},n,f,r))}))};n.isSpriteLoaded?h():n.once("isSpriteLoaded",(function(){n.scheduler?n.scheduler.add(h,{type:"parseTile",isSymbolTile:e.isSymbolTile,zoom:e.tileZoom}):h()})),n.loaded=n.loaded||{},n.loaded[r]=o}))}},{key:"reloadTile",value:function(e,t){var n=this,r=this.loaded,i=e.uid,a=this;if(r&&r[i]){var o=r[i];o.showCollisionBoxes=e.showCollisionBoxes,o.enableTerrain=!!e.enableTerrain,o.projection=e.projection,o.tileTransform=Ud(e.tileID.canonical,e.projection);var s=function(e,r){var i=o.reloadCallback;i&&(delete o.reloadCallback,o.parse(o.vectorTile,a.layerIndex,n.availableImages,a.actor,i)),t(e,r)};"parsing"===o.status?o.reloadCallback=s:"done"===o.status&&(o.vectorTile?o.parse(o.vectorTile,this.layerIndex,this.availableImages,this.actor,s):s())}}},{key:"abortTile",value:function(e,t){var n=e.uid,r=this.loading[n];r&&(r.abort&&r.abort(),delete this.loading[n]),t()}},{key:"removeTile",value:function(e,t){var n=this.loaded,r=e.uid;n&&n[r]&&delete n[r],t()}}]),n}(dt),e.WritingMode=Nh,e.ZoomDependentExpression=hi,e.add=Us,e.addDynamicAttributes=pp,e.adjoint=function(e,t){var n=t[0],r=t[1],i=t[2],a=t[3],o=t[4],s=t[5],l=t[6],c=t[7],u=t[8];return e[0]=o*u-s*c,e[1]=i*c-r*u,e[2]=r*s-i*o,e[3]=s*l-a*u,e[4]=n*u-i*l,e[5]=i*a-n*s,e[6]=a*c-o*l,e[7]=r*l-n*c,e[8]=n*o-r*a,e},e.asyncAll=Z,e.bezier=F,e.bindAll=J,e.boundsAttributes=Qp,e.bufferConvexPolygon=function(e,t){for(var n=[],r=0;rye&&(e.getActor().send("enforceCacheSizeLimit",ve),be=0)},e.calculateGlobeLabelMatrix=function(e,t){var n=e.point,r=ql(n.x,n.y,e.worldSize/e._pixelsPerMercatorPixel,0,0);return As(r,r,Gl(Pl(t)))},e.calculateGlobeMatrix=function(e){var t=e.point,n=t.x,r=t.y,i=e._center,a=i.lng,o=i.lat;return ql(n,r,e.worldSize,a,o)},e.calculateGlobeMercatorMatrix=function(e){var t=e.pixelsPerMeter,n=t/oc(1,e.center.lat),r=Es(new Float64Array(16));return Is(r,r,[e.point.x,e.point.y,0]),Ps(r,r,[n,n,t]),Float32Array.from(r)},e.circumferenceAtLatitude=rc,e.clamp=j,e.clearTileCache=function(e){if(ge()){var t=g.caches.delete(me);e&&t.catch(e).then((function(){return e()}))}},e.clipLine=ld,e.clone=function(e){var t=new Ms(16);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},e.clone$1=ne,e.collisionCircleLayout=Yf,e.config=x,e.conjugate=function(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e},e.create=function(){var e=new Ms(16);return Ms!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e},e.create$1=Ts,e.createExpression=ui,e.createLayout=Qa,e.createStyleLayer=function(e){return"custom"===e.type?new Mp(e):new Ep[e.type](e)},e.cross=$s,e.degToRad=R,e.distance=function(e,t){return Math.hypot(t[0]-e[0],t[1]-e[1],t[2]-e[2])},e.div=function(e,t,n){return e[0]=t[0]/n[0],e[1]=t[1]/n[1],e[2]=t[2]/n[2],e},e.dot=Ks,e.earthRadius=Ql,e.ease=V,e.easeCubicInOut=N,e.ecefToLatLng=function(e){var t=f(e,3),n=t[0],r=t[1],i=t[2],a=Math.hypot(n,r,i),o=Math.atan2(n,i),s=.5*Math.PI-Math.acos(-r/a);return new nc(O(o),O(s))},e.emitValidationErrors=ra,e.endsWith=Q,e.enforceCacheSizeLimit=function(e){_e(),de&&de.then((function(t){t.keys().then((function(n){for(var r=0;ra&&(r+=(e[i]-a)*(e[i]-a)),t[i]0){var p=180/r;Ss(d,d,[p/c+1,0,0,0,p/u+1,0,-.5*p/f,.5*p/h,1])}return d[2]=l,d[5]=e.x,d[8]=e.y,d},e.getImage=Ie,e.getJSON=function(e,t){return Me(q(e,{type:"json"}),t)},e.getLatitudinalLod=function(e){var t=uc-5;e=j(e,-t,t)/t*90;var n=Math.pow(Math.abs(Math.sin(R(e))),3);return Math.round(n*(zl.length-1))},e.getMapSessionAPI=$e,e.getPerformanceMeasurement=st,e.getProjection=cp,e.getRTLTextPluginStatus=La,e.getReferrer=ze,e.getTilePoint=function(e,t){var n=t.x,r=t.y;return new P(((n-(arguments.length>2&&void 0!==arguments[2]?arguments[2]:0))*e.scale-e.x)*ws,(r*e.scale-e.y)*ws)},e.getTileVec3=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return js(((t.x-n)*e.scale-e.x)*ws,(t.y*e.scale-e.y)*ws,cc(t.z,t.y))},e.getVideo=function(e,t){var n=g.document.createElement("video");n.muted=!0,n.onloadstart=function(){t(null,n)};for(var r=0;r0;return 0===r&&!i&&!o&&a},e.identity=Es,e.identity$1=ll,e.invert=Cs,e.isFullscreen=function(){return!!g.document.fullscreenElement||!!g.document.webkitFullscreenElement},e.isLngLatBehindGlobe=Yl,e.isMapAuthenticated=function(e){return Je.has(e)},e.isMapboxURL=Le,e.isSafariWithAntialiasingBug=function(e){var t=e.navigator?e.navigator.userAgent:null;return!!ue(e)&&t&&(t.match("Version/15.4")||t.match("Version/15.5")||t.match(/CPU (OS|iPhone OS) (15_4|15_5) like Mac OS X/))},e.latFromMercatorY=lc,e.latLngToECEF=Vl,e.len=rl,e.length=Vs,e.length$1=function(e){return Math.hypot(e[0],e[1],e[2],e[3])},e.lngFromMercatorX=sc,e.loadVectorTile=Bm,e.makeRequest=Me,e.mapValue=function(e,t,n,r,i){return j((e-t)/(n-t)*(i-r)+r,r,i)},e.mercatorScale=fc,e.mercatorXfromLng=ic,e.mercatorYfromLat=ac,e.mercatorZfromAltitude=oc,e.mul=Bs,e.mul$1=nl,e.multiply=As,e.multiply$1=Ss,e.multiply$2=Zs,e.nextPowerOfTwo=K,e.normalize=Ys,e.normalize$1=fl,e.normalize$2=al,e.number=qn,e.ortho=function(e,t,n,r,i,a,o){var s=1/(t-n),l=1/(r-i),c=1/(a-o);return e[0]=-2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*c,e[11]=0,e[12]=(t+n)*s,e[13]=(i+r)*l,e[14]=(o+a)*c,e[15]=1,e},e.pbf=oh,e.perspective=function(e,t,n,r,i){var a,o=1/Math.tan(t/2);return e[0]=o/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=o,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=i&&i!==1/0?(e[10]=(i+r)*(a=1/(r-i)),e[14]=2*i*r*a):(e[10]=-1,e[14]=-2*r),e},e.pick=function(e,t){for(var n={},r=0;r0&&n[0]<=e.width&&n[1]>0&&n[1]<=e.height&&!Yl(e,new nc(e.center.lat,90)),r[0]>0&&r[0]<=e.width&&r[1]>0&&r[1]<=e.height&&!Yl(e,new nc(e.center.lat,-90))]},e.polygonContainsPoint=Dc,e.polygonIntersectsBox=Rc,e.polygonIntersectsPolygon=Mc,e.polygonizeBounds=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],i=new P(n,n),a=e.sub(i),o=t.add(i),s=[a,new P(o.x,a.y),o,new P(a.x,o.y)];return r&&s.push(a.clone()),s},e.posAttributes=pl,e.postMapLoadEvent=We,e.postPerformanceEvent=Ye,e.postTurnstileEvent=Ge,e.potpack=Dh,e.prevPowerOfTwo=function(e){return e<=1?1:Math.pow(2,Math.floor(Math.log(e)/Math.LN2))},e.radToDeg=O,e.refProperties=["type","source","source-layer","minzoom","maxzoom","filter","layout"],e.registerForPluginStateChange=function(e){return e({pluginStatus:Ea,pluginURL:Ca}),Pa.on("pluginStateChange",e),e},e.removeAuthState=function(e){Je.delete(e)},e.renderColorRamp=tu,e.resample=pc,e.rotateX=Ls,e.rotateX$1=cl,e.rotateY=Ds,e.rotateY$1=ul,e.rotateZ=function(e,t,n){var r=Math.sin(n),i=Math.cos(n),a=t[0],o=t[1],s=t[2],l=t[3],c=t[4],u=t[5],f=t[6],h=t[7];return t!==e&&(e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=a*i+c*r,e[1]=o*i+u*r,e[2]=s*i+f*r,e[3]=l*i+h*r,e[4]=c*i-a*r,e[5]=u*i-o*r,e[6]=f*i-s*r,e[7]=h*i-l*r,e},e.rotateZ$1=function(e,t,n){n*=.5;var r=t[0],i=t[1],a=t[2],o=t[3],s=Math.sin(n),l=Math.cos(n);return e[0]=r*l+i*s,e[1]=i*l-r*s,e[2]=a*l+o*s,e[3]=o*l-a*s,e},e.scale=Ps,e.scale$1=il,e.scale$2=Ws,e.scaleAndAdd=Xs,e.set=function(e,t,n,r){return e[0]=t,e[1]=n,e[2]=r,e},e.setCacheLimits=function(e,t){ve=e,ye=t},e.setColumn=function(e,t,n){e[4*t+0]=n[0],e[4*t+1]=n[1],e[4*t+2]=n[2],e[4*t+3]=n[3]},e.setRTLTextPlugin=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(Ea===za||Ea===Ma||Ea===Ta)throw new Error("setRTLTextPlugin cannot be called multiple times.");Ca=lt.resolveURL(e),Ea=za,Sa=t,Ia(),n||Da()},e.smoothstep=U,e.spec=pt,e.squaredLength=function(e){var t=e[0],n=e[1],r=e[2];return t*t+n*n+r*r},e.storeAuthState=function(e,t){t?Je.add(e):Je.delete(e)},e.sub=tl,e.subtract=Hs,e.symbolSize=th,e.tileAABB=function(e,t,n,r,i,a,o,s,l){if("globe"===l.name)return Ol(e,t,new Tf(n,r,i));var c=Ud({z:n,x:r,y:i},l);return new gl([(a+c.x/c.scale)*t,t*(c.y/c.scale),o],[(a+c.x2/c.scale)*t,t*(c.y2/c.scale),s])},e.tileCornersToBounds=Bl,e.tileTransform=Ud,e.transformMat3=function(e,t,n){var r=t[0],i=t[1],a=t[2];return e[0]=r*n[0]+i*n[3]+a*n[6],e[1]=r*n[1]+i*n[4]+a*n[7],e[2]=r*n[2]+i*n[5]+a*n[8],e},e.transformMat4=Js,e.transformMat4$1=ol,e.transformQuat=Qs,e.transitionTileAABBinECEF=Dl,e.translate=Is,e.transpose=function(e,t){if(e===t){var n=t[1],r=t[2],i=t[5];e[1]=t[3],e[2]=t[6],e[3]=n,e[5]=t[7],e[6]=r,e[7]=i}else e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8];return e},e.triggerPluginCompletionEvent=Aa,e.uniqueId=X,e.updateGlobeVertexNormal=function(e,t,n,r,i){var a=5*t+2;e.float32[a+0]=n,e.float32[a+1]=r,e.float32[a+2]=i},e.validateCustomStyleLayer=function(e){var t=[],n=e.id;return void 0===n&&t.push({message:"layers.".concat(n,': missing required property "id"')}),void 0===e.render&&t.push({message:"layers.".concat(n,': missing required method "render"')}),e.renderingMode&&"2d"!==e.renderingMode&&"3d"!==e.renderingMode&&t.push({message:"layers.".concat(n,': property "renderingMode" must be either "2d" or "3d"')}),t},e.validateFilter=function(e){return na(Bi(e))},e.validateFog=function(e){return na(Yi(e))},e.validateLayer=function(e){return na(Ui(e))},e.validateLight=function(e){return na(Wi(e))},e.validateSource=function(e){return na(Gi(e))},e.validateStyle=Qi,e.validateTerrain=function(e){return na(Xi(e))},e.values=G,e.vectorTile=Wu,e.version=_,e.warnOnce=ie,e.window=g,e.wrap=H})),g(["./shared"],(function(e){function t(e){if("number"==typeof e||"boolean"==typeof e||"string"==typeof e||null==e)return JSON.stringify(e);if(Array.isArray(e)){var n,r="[",i=h(e);try{for(i.s();!(n=i.n()).done;){var a=n.value;r+="".concat(t(a),",")}}catch(u){i.e(u)}finally{i.f()}return"".concat(r,"]")}var o,s="{",l=h(Object.keys(e).sort());try{for(l.s();!(o=l.n()).done;){var c=o.value;s+="".concat(c,":").concat(t(e[c]),",")}}catch(u){l.e(u)}finally{l.f()}return"".concat(s,"}")}function n(n){var r,i="",a=h(e.refProperties);try{for(a.s();!(r=a.n()).done;){var o=r.value;i+="/".concat(t(n[o]))}}catch(s){a.e(s)}finally{a.f()}return i}var r=function(){function t(e){d(this,t),this.keyCache={},e&&this.replace(e)}return p(t,[{key:"replace",value:function(e){this._layerConfigs={},this._layers={},this.update(e,[])}},{key:"update",value:function(t,r){var i,a=this,o=h(t);try{for(o.s();!(i=o.n()).done;){var s=i.value;this._layerConfigs[s.id]=s,(this._layers[s.id]=e.createStyleLayer(s)).compileFilter(),this.keyCache[s.id]&&delete this.keyCache[s.id]}}catch(b){o.e(b)}finally{o.f()}var l,c=h(r);try{for(c.s();!(l=c.n()).done;){var u=l.value;delete this.keyCache[u],delete this._layerConfigs[u],delete this._layers[u]}}catch(b){c.e(b)}finally{c.f()}this.familiesBySource={};var f,d=function(e,t){for(var r={},i=0;i=Math.abs(s)?n-l+s:s-l+n,n=l}n+r>=0!=!!t&&e.reverse()}var c=e.getDefaultExportFromCjs((function e(t,n){var r,i=t&&t.type;if("FeatureCollection"===i)for(r=0;r>31}function I(e,t){for(var n=e.loadGeometry(),r=e.type,i=0,a=0,o=n.length,s=0;s=r;v--){var y=+Date.now();m=this.trees[v]=this._createTree(this._cluster(m,v)),n&&console.log("z%d: %d clusters in %dms",v,m.numItems,+Date.now()-y)}return n&&console.timeEnd("total time"),this}},{key:"getClusters",value:function(e,t){var n=((e[0]+180)%360+360)%360-180,r=Math.max(-90,Math.min(90,e[1])),i=180===e[2]?180:((e[2]+180)%360+360)%360-180,a=Math.max(-90,Math.min(90,e[3]));if(e[2]-e[0]>=360)n=-180,i=180;else if(n>i){var o=this.getClusters([n,r,180,a],t),s=this.getClusters([-180,r,i,a],t);return o.concat(s)}var l,c=this.trees[this._limitZoom(t)],u=c.range(H(n),Z(a),H(i),Z(r)),f=c.data,d=[],p=h(u);try{for(p.s();!(l=p.n()).done;){var m=l.value,v=this.stride*m;d.push(f[v+N]>1?j(f,v,this.clusterProps):this.points[f[v+B]])}}catch(y){p.e(y)}finally{p.f()}return d}},{key:"getChildren",value:function(e){var t=this._getOriginId(e),n=this._getOriginZoom(e),r="No cluster with the specified id.",i=this.trees[n];if(!i)throw new Error(r);var a=i.data;if(t*this.stride>=a.length)throw new Error(r);var o,s=this.options.radius/(this.options.extent*Math.pow(2,n-1)),l=i.within(a[t*this.stride],a[t*this.stride+1],s),c=[],u=h(l);try{for(u.s();!(o=u.n()).done;){var f=o.value*this.stride;a[f+4]===e&&c.push(a[f+N]>1?j(a,f,this.clusterProps):this.points[a[f+B]])}}catch(d){u.e(d)}finally{u.f()}if(0===c.length)throw new Error(r);return c}},{key:"getLeaves",value:function(e,t,n){var r=[];return this._appendLeaves(r,e,t=t||10,n=n||0,0),r}},{key:"getTile",value:function(e,t,n){var r=this.trees[this._limitZoom(e)],i=Math.pow(2,e),a=this.options,o=a.extent,s=a.radius/o,l=(n-s)/i,c=(n+1+s)/i,u={features:[]};return this._addTileFeatures(r.range((t-s)/i,l,(t+1+s)/i,c),r.data,t,n,i,u),0===t&&this._addTileFeatures(r.range(1-s/i,l,1,c),r.data,i,n,i,u),t===i-1&&this._addTileFeatures(r.range(0,l,s/i,c),r.data,-1,n,i,u),u.features.length?u:null}},{key:"getClusterExpansionZoom",value:function(e){for(var t=this._getOriginZoom(e)-1;t<=this.options.maxZoom;){var n=this.getChildren(e);if(t++,1!==n.length)break;e=n[0].properties.cluster_id}return t}},{key:"_appendLeaves",value:function(e,t,n,r,i){var a,o=this.getChildren(t),s=h(o);try{for(s.s();!(a=s.n()).done;){var l=a.value,c=l.properties;if(c&&c.cluster?i+c.point_count<=r?i+=c.point_count:i=this._appendLeaves(e,c.cluster_id,n,r,i):i1,u=void 0,d=void 0,p=void 0;if(c)u=U(t,l,this.clusterProps),d=t[l],p=t[l+1];else{var m=this.points[t[l+B]];u=m.properties;var v=f(m.geometry.coordinates,2),y=v[0],g=v[1];d=H(y),p=Z(g)}var _={type:1,geometry:[[Math.round(this.options.extent*(d*i-n)),Math.round(this.options.extent*(p*i-r))]],tags:u},x=void 0;void 0!==(x=c||this.options.generateId?t[l+B]:this.points[t[l+B]].id)&&(_.id=x),a.features.push(_)}}catch(b){s.e(b)}finally{s.f()}}},{key:"_limitZoom",value:function(e){return Math.max(this.options.minZoom,Math.min(Math.floor(+e),this.options.maxZoom+1))}},{key:"_cluster",value:function(e,t){for(var n=this.options,r=n.radius,i=n.extent,a=n.reduce,o=n.minPoints,s=r/(i*Math.pow(2,t)),l=e.data,c=[],u=this.stride,f=0;ft&&(g+=l[x+N])}}catch(R){_.e(R)}finally{_.f()}if(g>y&&g>=o){var b,w=void 0,k=p*y,z=m*y,M=-1,T=((f/u|0)<<5)+(t+1)+this.points.length,S=h(v);try{for(S.s();!(b=S.n()).done;){var E=b.value*u;if(!(l[E+2]<=t)){l[E+2]=t;var C=l[E+N];k+=l[E]*C,z+=l[E+1]*C,l[E+4]=T,a&&(w||(w=this._map(l,f,!0),M=this.clusterProps.length,this.clusterProps.push(w)),a(w,this._map(l,E)))}}}catch(R){S.e(R)}finally{S.f()}l[f+4]=T,c.push(k/g,z/g,1/0,T,-1,g),a&&c.push(M)}else{for(var A=0;A1){var I,P=h(v);try{for(P.s();!(I=P.n()).done;){var L=I.value*u;if(!(l[L+2]<=t)){l[L+2]=t;for(var D=0;D>5}},{key:"_getOriginZoom",value:function(e){return(e-this.points.length)%32}},{key:"_map",value:function(e,t,n){if(e[t+N]>1){var r=this.clusterProps[e[t+F]];return n?Object.assign({},r):r}var i=this.points[e[t+B]].properties,a=this.options.map(i);return n&&a===i?Object.assign({},a):a}}]),t}();function j(e,t,n){return{type:"Feature",id:e[t+B],properties:U(e,t,n),geometry:{type:"Point",coordinates:[(r=e[t],360*(r-.5)),G(e[t+1])]}};var r}function U(e,t,n){var r=e[t+N],i=r>=1e4?"".concat(Math.round(r/1e3),"k"):r>=1e3?Math.round(r/100)/10+"k":r,a=e[t+F],o=-1===a?{}:Object.assign({},n[a]);return Object.assign(o,{cluster:!0,cluster_id:e[t+B],point_count:r,point_count_abbreviated:i})}function H(e){return e/360+.5}function Z(e){var t=Math.sin(e*Math.PI/180),n=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return n<0?0:n>1?1:n}function G(e){var t=(180-360*e)*Math.PI/180;return 360*Math.atan(Math.exp(t))/Math.PI-90}function q(e,t,n,r){for(var i,a=r,o=n-t>>1,s=n-t,l=e[t],c=e[t+1],u=e[n],f=e[n+1],h=t+3;ha)i=h,a=d;else if(d===a){var p=Math.abs(h-o);pr&&(i-t>3&&q(e,t,i,r),e[i+2]=a,n-i>3&&q(e,i,n,r))}function W(e,t,n,r,i,a){var o=i-n,s=a-r;if(0!==o||0!==s){var l=((e-n)*o+(t-r)*s)/(o*o+s*s);l>1?(n=i,r=a):l>0&&(n+=o*l,r+=s*l)}return(o=e-n)*o+(s=t-r)*s}function X(e,t,n,r){var i={id:void 0===e?null:e,type:t,geometry:n,tags:r,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(e){var t=e.geometry,n=e.type;if("Point"===n||"MultiPoint"===n||"LineString"===n)Y(e,t);else if("Polygon"===n||"MultiLineString"===n)for(var r=0;r0&&(o+=r?(i*c-l*a)/2:Math.sqrt(Math.pow(l-i,2)+Math.pow(c-a,2))),i=l,a=c}var u=t.length-3;t[2]=1,q(t,0,u,n),t[u+2]=1,t.size=Math.abs(o),t.start=0,t.end=t.size}function Q(e,t,n,r){for(var i=0;i1?1:n}function ne(e,t,n,r,i,a,o,s){if(r/=t,a>=(n/=t)&&o=r)return null;for(var l=[],c=0;c=n&&p=r)){var m=[];if("Point"===h||"MultiPoint"===h)re(f,m,n,r,i);else if("LineString"===h)ie(f,m,n,r,i,!1,s.lineMetrics);else if("MultiLineString"===h)oe(f,m,n,r,i,!1);else if("Polygon"===h)oe(f,m,n,r,i,!0);else if("MultiPolygon"===h)for(var v=0;v=n&&o<=r&&(t.push(e[a]),t.push(e[a+1]),t.push(e[a+2]))}}function ie(e,t,n,r,i,a,o){for(var s,l,c=ae(e),u=0===i?le:ce,f=e.start,h=0;hn&&(l=u(c,d,p,v,y,n),o&&(c.start=f+s*l)):g>r?_=n&&(l=u(c,d,p,v,y,n),x=!0),_>r&&g<=r&&(l=u(c,d,p,v,y,r),x=!0),!a&&x&&(o&&(c.end=f+s*l),t.push(c),c=ae(e)),o&&(f+=s)}var b=e.length-3;d=e[b],p=e[b+1],m=e[b+2],(g=0===i?d:p)>=n&&g<=r&&se(c,d,p,m),b=c.length-3,a&&b>=3&&(c[b]!==c[0]||c[b+1]!==c[1])&&se(c,c[0],c[1],c[2]),c.length&&t.push(c)}function ae(e){var t=[];return t.size=e.size,t.start=e.start,t.end=e.end,t}function oe(e,t,n,r,i,a){for(var o=0;oo.maxX&&(o.maxX=u),f>o.maxY&&(o.maxY=f)}return o}function me(e,t,n,r){var i=t.geometry,a=t.type,o=[];if("Point"===a||"MultiPoint"===a)for(var s=0;s0&&t.size<(i?o:r))n.numPoints+=t.length/3;else{for(var s=[],l=0;lo)&&(n.numSimplified++,s.push(t[l]),s.push(t[l+1])),n.numPoints++;i&&function(e,t){for(var n=0,r=0,i=e.length,a=i-2;r0===t)for(r=0,i=e.length;r24)throw new Error("maxZoom should be in the 0-24 range");if(t.promoteId&&t.generateId)throw new Error("promoteId and generateId cannot be used together.");var r=function(e,t){var n=[];if("FeatureCollection"===e.type)for(var r=0;r1&&console.time("creation"),h=this.tiles[f]=pe(e,t,n,r,l),this.tileCoords.push({z:t,x:n,y:r}),c)){c>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",t,n,r,h.numFeatures,h.numPoints,h.numSimplified),console.timeEnd("creation"));var d="z"+t;this.stats[d]=(this.stats[d]||0)+1,this.total++}if(h.source=e,i){if(t===l.maxZoom||t===i)continue;var p=1<1&&console.time("clipping");var m,v,y,g,_,x,b=.5*l.buffer/l.extent,w=.5-b,k=.5+b,z=1+b;m=v=y=g=null,_=ne(e,u,n-b,n+k,0,h.minX,h.maxX,l),x=ne(e,u,n+w,n+z,0,h.minX,h.maxX,l),e=null,_&&(m=ne(_,u,r-b,r+k,1,h.minY,h.maxY,l),v=ne(_,u,r+w,r+z,1,h.minY,h.maxY,l),_=null),x&&(y=ne(x,u,r-b,r+k,1,h.minY,h.maxY,l),g=ne(x,u,r+w,r+z,1,h.minY,h.maxY,l),x=null),c>1&&console.timeEnd("clipping"),s.push(m||[],t+1,2*n,2*r),s.push(v||[],t+1,2*n,2*r+1),s.push(y||[],t+1,2*n+1,2*r),s.push(g||[],t+1,2*n+1,2*r+1)}}},ye.prototype.getTile=function(e,t,n){var r=this.options,i=r.extent,a=r.debug;if(e<0||e>24)return null;var o=1<1&&console.log("drilling down to z%d-%d-%d",e,t,n);for(var l,c=e,u=t,f=n;!l&&c>0;)c--,u=Math.floor(u/2),f=Math.floor(f/2),l=this.tiles[ge(c,u,f)];return l&&l.source?(a>1&&console.log("found parent tile z%d-%d-%d",c,u,f),a>1&&console.time("drilling down"),this.splitTile(l.source,c,u,f,e,t,n),a>1&&console.timeEnd("drilling down"),this.tiles[s]?he(this.tiles[s],i):null):null};var xe=function(t){m(r,t);var n=v(r);function r(e,t,i,a,o){var s;return d(this,r),s=n.call(this,e,t,i,a,_e),o&&(s.loadGeoJSON=o),s}return p(r,[{key:"loadData",value:function(t,n){var r=this,i=t&&t.request,a=i&&i.collectResourceTiming;this.loadGeoJSON(t,(function(o,s){if(o||!s)return n(o);if("object"!=typeof s)return n(new Error("Input data given to '".concat(t.source,"' is not a valid GeoJSON object.")));c(s,!0);try{if(t.filter){var l=e.createExpression(t.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if("error"===l.result)throw new Error(l.value.map((function(e){return"".concat(e.key,": ").concat(e.message)})).join(", "));var u=s.features.filter((function(e){return l.value.evaluate({zoom:0},e)}));s={type:"FeatureCollection",features:u}}r._geoJSONIndex=t.cluster?new V(function(t){var n=t.superclusterOptions,r=t.clusterProperties;if(!r||!n)return n;for(var i={},a={},o={accumulated:null,zoom:0},s={properties:null},l=Object.keys(r),c=0,u=l;c=0?0:t.button}function A(t,n,r){var i=t.offsetWidth===n.width?1:t.offsetWidth/n.width;return new e.Point((r.clientX-n.left)*i,(r.clientY-n.top)*i)}function I(e,t){var n=t[0],r=t[1],i=t[2],a=t[3],o=n*a-i*r;return o?(e[0]=a*(o=1/o),e[1]=-r*o,e[2]=-i*o,e[3]=n*o,e):null}function P(e){var t=e.userImage;return!!(t&&t.render&&t.render())&&(e.data.replace(new Uint8Array(t.data.buffer)),!0)}var L=function(t){m(r,t);var n=v(r);function r(){var t;return d(this,r),(t=n.call(this)).images={},t.updatedImages={},t.callbackDispatchedThisFrame={},t.loaded=!1,t.requestors=[],t.patterns={},t.atlasImage=new e.RGBAImage({width:1,height:1}),t.dirty=!0,t}return p(r,[{key:"isLoaded",value:function(){return this.loaded}},{key:"setLoaded",value:function(e){if(this.loaded!==e&&(this.loaded=e,e)){var t,n=h(this.requestors);try{for(n.s();!(t=n.n()).done;){var r=t.value,i=r.ids,a=r.callback;this._notify(i,a)}}catch(o){n.e(o)}finally{n.f()}this.requestors=[]}}},{key:"hasImage",value:function(e){return!!this.getImage(e)}},{key:"getImage",value:function(e){return this.images[e]}},{key:"addImage",value:function(e,t){this._validate(e,t)&&(this.images[e]=t)}},{key:"_validate",value:function(t,n){var r=!0;return this._validateStretch(n.stretchX,n.data&&n.data.width)||(this.fire(new e.ErrorEvent(new Error('Image "'.concat(t,'" has invalid "stretchX" value')))),r=!1),this._validateStretch(n.stretchY,n.data&&n.data.height)||(this.fire(new e.ErrorEvent(new Error('Image "'.concat(t,'" has invalid "stretchY" value')))),r=!1),this._validateContent(n.content,n)||(this.fire(new e.ErrorEvent(new Error('Image "'.concat(t,'" has invalid "content" value')))),r=!1),r}},{key:"_validateStretch",value:function(e,t){if(!e)return!0;var n,r=0,i=h(e);try{for(i.s();!(n=i.n()).done;){var a=n.value;if(a[0]1&&void 0!==arguments[1]?arguments[1]:{};if(!this._validate(e.validateLight,t,n))for(var r in t){var i=t[r];e.endsWith(r,"-transition")?this._transitionable.setTransition(r.slice(0,-11),i):this._transitionable.setValue(r,i)}}},{key:"updateTransitions",value:function(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}},{key:"hasTransition",value:function(){return this._transitioning.hasTransition()}},{key:"recalculate",value:function(e){this.properties=this._transitioning.possiblyEvaluate(e)}},{key:"_validate",value:function(t,n,r){return(!r||!1!==r.validate)&&e.emitValidationErrors(this,t.call(e.validateStyle,e.extend({value:n,style:{glyphs:!0,sprite:!0},styleSpec:e.spec})))}}]),r}(e.Evented),O=new e.Properties({source:new e.DataConstantProperty(e.spec.terrain.source),exaggeration:new e.DataConstantProperty(e.spec.terrain.exaggeration)}),B=function(t){m(r,t);var n=v(r);function r(t,i){var a;return d(this,r),(a=n.call(this))._transitionable=new e.Transitionable(O),a.set(t),a._transitioning=a._transitionable.untransitioned(),a.drapeRenderMode=i,a}return p(r,[{key:"get",value:function(){return this._transitionable.serialize()}},{key:"set",value:function(t){for(var n in t){var r=t[n];e.endsWith(n,"-transition")?this._transitionable.setTransition(n.slice(0,-11),r):this._transitionable.setValue(n,r)}}},{key:"updateTransitions",value:function(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}},{key:"hasTransition",value:function(){return this._transitioning.hasTransition()}},{key:"recalculate",value:function(e){this.properties=this._transitioning.possiblyEvaluate(e)}}]),r}(e.Evented);function N(t,n,r,i){var a=e.smoothstep(45,65,r),o=F(t,i),s=f(o,2),l=s[0],c=s[1],u=e.length(n),h=1-Math.min(1,Math.exp((u-l)/(c-l)*-6));return h*=h*h,(h=Math.min(1,1.00747*h))*a*t.alpha}function F(e,t){var n=.5/Math.tan(.5*t);return[e.range[0]+n,e.range[1]+n]}var V=new e.Properties({range:new e.DataConstantProperty(e.spec.fog.range),color:new e.DataConstantProperty(e.spec.fog.color),"high-color":new e.DataConstantProperty(e.spec.fog["high-color"]),"space-color":new e.DataConstantProperty(e.spec.fog["space-color"]),"horizon-blend":new e.DataConstantProperty(e.spec.fog["horizon-blend"]),"star-intensity":new e.DataConstantProperty(e.spec.fog["star-intensity"])}),j=function(t){m(r,t);var n=v(r);function r(t,i){var a;return d(this,r),(a=n.call(this))._transitionable=new e.Transitionable(V),a.set(t),a._transitioning=a._transitionable.untransitioned(),a._transform=i,a}return p(r,[{key:"state",get:function(){var t=this._transform,n="globe"===t.projection.name,r=e.globeToMercatorTransition(t.zoom),i=this.properties.get("range"),a=[.5,3];return{range:n?[e.number(a[0],i[0],r),e.number(a[1],i[1],r)]:i,horizonBlend:this.properties.get("horizon-blend"),alpha:this.properties.get("color").a}}},{key:"get",value:function(){return this._transitionable.serialize()}},{key:"set",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!this._validate(e.validateFog,t,n)){for(var r=0,i=Object.keys(e.spec.fog);rr.y&&(this.cameraPoint.x>n.x&&this.cameraPoint.x=r.x?i[2]=this.cameraPoint:this.cameraPoint.x<=n.x&&(i[3]=this.cameraPoint)),e.bufferConvexPolygon(i,t)}},{key:"bufferedCameraGeometryGlobe",value:function(t){var n=this.screenBounds[0],r=1===this.screenBounds.length?this.screenBounds[0].add(new e.Point(1,1)):this.screenBounds[1],i=e.polygonizeBounds(n,r,t),a=this.cameraPoint.clone();switch(3*((a.y>n.y)+(a.y>r.y))+((a.x>n.x)+(a.x>r.x))){case 0:i[0]=a,i[4]=a.clone();break;case 1:i.splice(1,0,a);break;case 2:i[1]=a;break;case 3:i.splice(4,0,a);break;case 5:i.splice(2,0,a);break;case 6:i[3]=a;break;case 7:i.splice(3,0,a);break;case 8:i[2]=a}return i}},{key:"containsTile",value:function(t,n,r){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,a=t.queryPadding/n._pixelsPerMercatorPixel+1,o=r?this._bufferedCameraMercator(a,n):this._bufferedScreenMercator(a,n),s=t.tileID.wrap+(o.unwrapped?i:0),l=o.polygon.map((function(n){return e.getTilePoint(t.tileTransform,n,s)}));if(e.polygonIntersectsBox(l,0,0,e.EXTENT,e.EXTENT)){s=t.tileID.wrap+(this.screenGeometryMercator.unwrapped?i:0);var c,u=this.screenGeometryMercator.polygon.map((function(n){return e.getTileVec3(t.tileTransform,n,s)})),f=u.map((function(t){return new e.Point(t[0],t[1])})),h=n.getFreeCameraOptions().position||new e.MercatorCoordinate(0,0,0),d=e.getTileVec3(t.tileTransform,h,s),p=u.map((function(t){var n=e.sub(t,t,d);return e.normalize(n,n),new e.Ray(d,n)})),m=H(t,1,n.zoom)*n._pixelsPerMercatorPixel;return{queryGeometry:this,tilespaceGeometry:f,tilespaceRays:p,bufferedTilespaceGeometry:l,bufferedTilespaceBounds:(c=e.getBounds(l),c.min.x=e.clamp(c.min.x,0,e.EXTENT),c.min.y=e.clamp(c.min.y,0,e.EXTENT),c.max.x=e.clamp(c.max.x,0,e.EXTENT),c.max.y=e.clamp(c.max.y,0,e.EXTENT),c),tile:t,tileID:t.tileID,pixelToTileUnitsFactor:m}}}},{key:"_bufferedScreenMercator",value:function(e,t){var n,r=W(e);return this._screenRaycastCache[r]?this._screenRaycastCache[r]:(n="globe"===t.projection.name?this._projectAndResample(this.bufferedScreenGeometry(e),t):{polygon:this.bufferedScreenGeometry(e).map((function(e){return t.pointCoordinate3D(e)})),unwrapped:!0},this._screenRaycastCache[r]=n,n)}},{key:"_bufferedCameraMercator",value:function(e,t){var n,r=W(e);return this._cameraRaycastCache[r]?this._cameraRaycastCache[r]:(n="globe"===t.projection.name?this._projectAndResample(this.bufferedCameraGeometryGlobe(e),t):{polygon:this.bufferedCameraGeometry(e).map((function(e){return t.pointCoordinate3D(e)})),unwrapped:!0},this._cameraRaycastCache[r]=n,n)}},{key:"_projectAndResample",value:function(t,n){var r=function(t,n){var r=e.multiply([],n.pixelMatrix,n.globeMatrix),i=[0,-e.GLOBE_RADIUS,0,1],a=[0,e.GLOBE_RADIUS,0,1],o=[0,0,0,1];e.transformMat4$1(i,i,r),e.transformMat4$1(a,a,r),e.transformMat4$1(o,o,r);var s=new e.Point(i[0]/i[3],i[1]/i[3]),l=new e.Point(a[0]/a[3],a[1]/a[3]),c=e.polygonContainsPoint(t,s)&&i[3]1?G(t.slice(0,d),n):[],v=di&&(i=t[o].x,a=o);for(var s=0;s.5&&(c.x=r&&t.x=i&&t.y1&&void 0!==arguments[1]&&arguments[1];if(d(this,n),this.gl=e,this.isWebGL2=t,this.extVertexArrayObject=this.gl.getExtension("OES_vertex_array_object"),t){var r=e;this.extVertexArrayObject={createVertexArrayOES:r.createVertexArray.bind(e),deleteVertexArrayOES:r.deleteVertexArray.bind(e),bindVertexArrayOES:r.bindVertexArray.bind(e)}}this.clearColor=new te(this),this.clearDepth=new ne(this),this.clearStencil=new re(this),this.colorMask=new ie(this),this.depthMask=new ae(this),this.stencilMask=new oe(this),this.stencilFunc=new se(this),this.stencilOp=new le(this),this.stencilTest=new ce(this),this.depthRange=new ue(this),this.depthTest=new fe(this),this.depthFunc=new he(this),this.blend=new de(this),this.blendFunc=new pe(this),this.blendColor=new me(this),this.blendEquation=new ve(this),this.cullFace=new ye(this),this.cullFaceSide=new ge(this),this.frontFace=new _e(this),this.program=new xe(this),this.activeTexture=new be(this),this.viewport=new we(this),this.bindFramebuffer=new ke(this),this.bindRenderbuffer=new ze(this),this.bindTexture=new Me(this),this.bindVertexBuffer=new Te(this),this.bindElementBuffer=new Se(this),this.bindVertexArrayOES=this.extVertexArrayObject&&new Ee(this),this.pixelStoreUnpack=new Ce(this),this.pixelStoreUnpackPremultiplyAlpha=new Ae(this),this.pixelStoreUnpackFlipY=new Ie(this),this.extTextureFilterAnisotropic=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=e.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.extTextureFilterAnisotropicForceOff=!1,this.extStandardDerivativesForceOff=!1,this.extDebugRendererInfo=e.getExtension("WEBGL_debug_renderer_info"),this.extDebugRendererInfo&&(this.renderer=e.getParameter(this.extDebugRendererInfo.UNMASKED_RENDERER_WEBGL),this.vendor=e.getParameter(this.extDebugRendererInfo.UNMASKED_VENDOR_WEBGL)),t||(this.extTextureHalfFloat=e.getExtension("OES_texture_half_float")),(t||this.extTextureHalfFloat&&e.getExtension("OES_texture_half_float_linear"))&&(this.extRenderToTextureHalfFloat=e.getExtension("EXT_color_buffer_half_float")),this.extStandardDerivatives=t||e.getExtension("OES_standard_derivatives"),this.extTimerQuery=e.getExtension("EXT_disjoint_timer_query"),this.maxTextureSize=e.getParameter(e.MAX_TEXTURE_SIZE)}return p(n,[{key:"setDefault",value:function(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}},{key:"setDirty",value:function(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.extVertexArrayObject&&(this.bindVertexArrayOES.dirty=!0),this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}},{key:"createIndexBuffer",value:function(e,t){return new $(this,e,t)}},{key:"createVertexBuffer",value:function(e,t,n){return new Q(this,e,t,n)}},{key:"createRenderbuffer",value:function(e,t,n){var r=this.gl,i=r.createRenderbuffer();return this.bindRenderbuffer.set(i),r.renderbufferStorage(r.RENDERBUFFER,e,t,n),this.bindRenderbuffer.set(null),i}},{key:"createFramebuffer",value:function(e,t,n){return new Oe(this,e,t,n)}},{key:"clear",value:function(e){var t=e.color,n=e.depth,r=e.stencil,i=this.gl,a=0;t&&(a|=i.COLOR_BUFFER_BIT,this.clearColor.set(t),this.colorMask.set([!0,!0,!0,!0])),void 0!==n&&(a|=i.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(n),this.depthMask.set(!0)),void 0!==r&&(a|=i.STENCIL_BUFFER_BIT,this.clearStencil.set(r),this.stencilMask.set(255)),i.clear(a)}},{key:"setCullFace",value:function(e){!1===e.enable?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(e.mode),this.frontFace.set(e.frontFace))}},{key:"setDepthMode",value:function(e){e.func!==this.gl.ALWAYS||e.mask?(this.depthTest.set(!0),this.depthFunc.set(e.func),this.depthMask.set(e.mask),this.depthRange.set(e.range)):this.depthTest.set(!1)}},{key:"setStencilMode",value:function(e){e.test.func!==this.gl.ALWAYS||e.mask?(this.stencilTest.set(!0),this.stencilMask.set(e.mask),this.stencilOp.set([e.fail,e.depthFail,e.pass]),this.stencilFunc.set({func:e.test.func,ref:e.ref,mask:e.test.mask})):this.stencilTest.set(!1)}},{key:"setColorMode",value:function(n){t(n.blendFunction,e.ColorMode.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(n.blendFunction),this.blendColor.set(n.blendColor)),this.colorMask.set(n.mask)}},{key:"unbindVAO",value:function(){this.extVertexArrayObject&&this.bindVertexArrayOES.set(null)}}]),n}(),Ne=function(t){m(r,t);var n=v(r);function r(t,a,o,s){var c;if(d(this,r),(c=n.call(this)).id=t,c.dispatcher=o,c.type="vector",c.minzoom=0,c.maxzoom=22,c.scheme="xyz",c.tileSize=512,c.reparseOverscaled=!0,c.isTileClipped=!0,c._loaded=!1,e.extend(i(c),e.pick(a,["url","scheme","tileSize","promoteId"])),c._options=e.extend({type:"vector"},a),c._collectResourceTiming=a.collectResourceTiming,512!==c.tileSize)throw new Error("vector tile sources must have a tileSize of 512");return c.setEventedParent(s),c._tileWorkers={},c._deduped=new e.DedupedRequest,l(c)}return p(r,[{key:"load",value:function(t){var n=this;this._loaded=!1,this.fire(new e.Event("dataloading",{dataType:"source"}));var r=Array.isArray(this.map._language)?this.map._language.join():this.map._language,i=this.map._worldview;this._tileJSONRequest=X(this._options,this.map._requestManager,r,i,(function(a,o){n._tileJSONRequest=null,n._loaded=!0,a?(r&&console.warn("Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ".concat(r)),i&&2!==i.length&&console.warn("Requested worldview strings must be a valid ISO alpha-2 code. Found: ".concat(i)),n.fire(new e.ErrorEvent(a))):o&&(e.extend(n,o),o.bounds&&(n.tileBounds=new K(o.bounds,n.minzoom,n.maxzoom)),e.postTurnstileEvent(o.tiles,n.map._requestManager._customAccessToken),n.fire(new e.Event("data",{dataType:"source",sourceDataType:"metadata"})),n.fire(new e.Event("data",{dataType:"source",sourceDataType:"content"}))),t&&t(a)}))}},{key:"loaded",value:function(){return this._loaded}},{key:"hasTile",value:function(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}},{key:"onAdd",value:function(e){this.map=e,this.load()}},{key:"reload",value:function(){var e=this;this.cancelTileJSONRequest(),this.load((function(){return e.map.style._clearSource(e.id)}))}},{key:"setTiles",value:function(e){return this._options.tiles=e,this.reload(),this}},{key:"setUrl",value:function(e){return this.url=e,this._options.url=e,this.reload(),this}},{key:"onRemove",value:function(){this.cancelTileJSONRequest()}},{key:"serialize",value:function(){return e.extend({},this._options)}},{key:"loadTile",value:function(t,n){var r=this,i=this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles,this.scheme)),a={request:this.map._requestManager.transformRequest(i,e.ResourceType.Tile),data:void 0,uid:t.uid,tileID:t.tileID,tileZoom:t.tileZoom,zoom:t.tileID.overscaledZ,tileSize:this.tileSize*t.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:e.exported.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,isSymbolTile:t.isSymbolTile};if(a.request.collectResourceTiming=this._collectResourceTiming,t.actor&&"expired"!==t.state)"loading"===t.state?t.reloadCallback=n:t.request=t.actor.send("reloadTile",a,s.bind(this));else if(t.actor=this._tileWorkers[i]=this._tileWorkers[i]||this.dispatcher.getActor(),this.dispatcher.ready)t.request=t.actor.send("loadTile",a,s.bind(this),void 0,!0);else{var o=e.loadVectorTile.call({deduped:this._deduped},a,(function(e,n){e||!n?s.call(r,e):(a.data={cacheControl:n.cacheControl,expires:n.expires,rawData:n.rawData.slice(0)},t.actor&&t.actor.send("loadTile",a,s.bind(r),void 0,!0))}),!0);t.request={cancel:o}}function s(r,i){return delete t.request,t.aborted?n(null):r&&404!==r.status?n(r):(i&&i.resourceTiming&&(t.resourceTiming=i.resourceTiming),this.map._refreshExpiredTiles&&i&&t.setExpiryData(i),t.loadVectorData(i,this.map.painter),e.cacheEntryPossiblyAdded(this.dispatcher),n(null),void(t.reloadCallback&&(this.loadTile(t,t.reloadCallback),t.reloadCallback=null)))}}},{key:"abortTile",value:function(e){e.request&&(e.request.cancel(),delete e.request),e.actor&&e.actor.send("abortTile",{uid:e.uid,type:this.type,source:this.id})}},{key:"unloadTile",value:function(e){e.unloadVectorData(),e.actor&&e.actor.send("removeTile",{uid:e.uid,type:this.type,source:this.id})}},{key:"hasTransition",value:function(){return!1}},{key:"afterUpdate",value:function(){this._tileWorkers={}}},{key:"cancelTileJSONRequest",value:function(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}]),r}(e.Evented),Fe=function(t){m(r,t);var n=v(r);function r(t,a,o,s){var l;return d(this,r),(l=n.call(this)).id=t,l.dispatcher=o,l.setEventedParent(s),l.type="raster",l.minzoom=0,l.maxzoom=22,l.roundZoom=!0,l.scheme="xyz",l.tileSize=512,l._loaded=!1,l._options=e.extend({type:"raster"},a),e.extend(i(l),e.pick(a,["url","scheme","tileSize"])),l}return p(r,[{key:"load",value:function(t){var n=this;this._loaded=!1,this.fire(new e.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=X(this._options,this.map._requestManager,null,null,(function(r,i){n._tileJSONRequest=null,n._loaded=!0,r?n.fire(new e.ErrorEvent(r)):i&&(e.extend(n,i),i.bounds&&(n.tileBounds=new K(i.bounds,n.minzoom,n.maxzoom)),e.postTurnstileEvent(i.tiles),n.fire(new e.Event("data",{dataType:"source",sourceDataType:"metadata"})),n.fire(new e.Event("data",{dataType:"source",sourceDataType:"content"}))),t&&t(r)}))}},{key:"loaded",value:function(){return this._loaded}},{key:"onAdd",value:function(e){this.map=e,this.load()}},{key:"reload",value:function(){var e=this;this.cancelTileJSONRequest(),this.load((function(){return e.map.style._clearSource(e.id)}))}},{key:"setTiles",value:function(e){return this._options.tiles=e,this.reload(),this}},{key:"setUrl",value:function(e){return this.url=e,this._options.url=e,this.reload(),this}},{key:"onRemove",value:function(){this.cancelTileJSONRequest()}},{key:"serialize",value:function(){return e.extend({},this._options)}},{key:"hasTile",value:function(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}},{key:"loadTile",value:function(t,n){var r=this,i=e.exported.devicePixelRatio>=2,a=this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles,this.scheme),i,this.tileSize);t.request=e.getImage(this.map._requestManager.transformRequest(a,e.ResourceType.Tile),(function(i,a,o,s){return delete t.request,t.aborted?(t.state="unloaded",n(null)):i?(t.state="errored",n(i)):a?(r.map._refreshExpiredTiles&&t.setExpiryData({cacheControl:o,expires:s}),t.setTexture(a,r.map.painter),t.state="loaded",e.cacheEntryPossiblyAdded(r.dispatcher),void n(null)):n(null)}))}},{key:"abortTile",value:function(e,t){e.request&&(e.request.cancel(),delete e.request),t()}},{key:"unloadTile",value:function(e,t){e.texture&&this.map.painter.saveTileTexture(e.texture),t()}},{key:"hasTransition",value:function(){return!1}},{key:"cancelTileJSONRequest",value:function(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}],[{key:"loadTileData",value:function(e,t,n){e.setTexture(t,n)}},{key:"unloadTileData",value:function(e,t){e.texture&&t.saveTileTexture(e.texture)}}]),r}(e.Evented);function Ve(t,n,r,i,a,o,s,l){var c=[t,r,a,n,i,o,1,1,1],u=[s,l,1],h=e.adjoint([],c),d=e.transformMat3(u,u,e.transpose(h,h)),p=f(d,3),m=p[0],v=p[1],y=p[2];return e.multiply$1(c,[m,0,0,0,v,0,0,0,y],c)}var je=function(t){m(r,t);var n=v(r);function r(e,t,i,a){var o;return d(this,r),(o=n.call(this)).id=e,o.dispatcher=i,o.coordinates=t.coordinates,o.type="image",o.minzoom=0,o.maxzoom=22,o.tileSize=512,o.tiles={},o._loaded=!1,o.setEventedParent(a),o.options=t,o._dirty=!1,o}return p(r,[{key:"load",value:function(t,n){var r=this;this._loaded=n||!1,this.fire(new e.Event("dataloading",{dataType:"source"})),this.url=this.options.url,this._imageRequest=e.getImage(this.map._requestManager.transformRequest(this.url,e.ResourceType.Image),(function(n,i){if(r._imageRequest=null,r._loaded=!0,n)r.fire(new e.ErrorEvent(n));else if(i){var a=e.window.HTMLImageElement;r.image=i instanceof a?e.exported.getImageData(i):i,r._dirty=!0,r.width=r.image.width,r.height=r.image.height,t&&(r.coordinates=t),r._finishLoading()}}))}},{key:"loaded",value:function(){return this._loaded}},{key:"updateImage",value:function(e){return this.image&&e.url?(this._imageRequest&&e.url!==this.options.url&&(this._imageRequest.cancel(),this._imageRequest=null),this.options.url=e.url,this.load(e.coordinates,this._loaded),this):this}},{key:"_finishLoading",value:function(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new e.Event("data",{dataType:"source",sourceDataType:"metadata"})))}},{key:"onAdd",value:function(e){this.map=e,this.load()}},{key:"onRemove",value:function(){this._imageRequest&&(this._imageRequest.cancel(),this._imageRequest=null),this.texture&&this.texture.destroy()}},{key:"setCoordinates",value:function(t){this.coordinates=t,this._boundsArray=void 0;var n=t.map(e.MercatorCoordinate.fromLngLat);return this.tileID=function(t){var n,r=1/0,i=1/0,a=-1/0,o=-1/0,s=h(t);try{for(s.s();!(n=s.n()).done;){var l=n.value;r=Math.min(r,l.x),i=Math.min(i,l.y),a=Math.max(a,l.x),o=Math.max(o,l.y)}}catch(d){s.e(d)}finally{s.f()}var c=Math.max(a-r,o-i),u=Math.max(0,Math.floor(-Math.log(c)/Math.LN2)),f=Math.pow(2,u);return new e.CanonicalTileID(u,Math.floor((r+a)/2*f),Math.floor((i+o)/2*f))}(n),this.minzoom=this.maxzoom=this.tileID.z,this.fire(new e.Event("data",{dataType:"source",sourceDataType:"content"})),this}},{key:"_clear",value:function(){this._boundsArray=void 0}},{key:"_prepareData",value:function(t){for(var n in this.tiles){var r=this.tiles[n];"loaded"!==r.state&&(r.state="loaded",r.texture=this.texture)}if(!this._boundsArray){var i=e.tileTransform(this.tileID,this.map.transform.projection),a=this.coordinates.map((function(t){var n=i.projection.project(t[0],t[1]);return e.getTilePoint(i,n)._round()})),o=f(a,4),s=o[0],l=o[1],c=o[2],u=o[3];this.perspectiveTransform=function(t,n,r,i,a,o,s,l,c,u){var f=Ve(0,0,t,0,0,n,t,n),h=Ve(r,i,a,o,s,l,c,u);return e.multiply$1(h,e.adjoint(f,f),h),[h[6]/h[8]*t/e.EXTENT,h[7]/h[8]*n/e.EXTENT]}(this.width,this.height,s.x,s.y,l.x,l.y,u.x,u.y,c.x,c.y);var h=this._boundsArray=new e.StructArrayLayout4i8;h.emplaceBack(s.x,s.y,0,0),h.emplaceBack(l.x,l.y,e.EXTENT,0),h.emplaceBack(u.x,u.y,0,e.EXTENT),h.emplaceBack(c.x,c.y,e.EXTENT,e.EXTENT),this.boundsBuffer&&this.boundsBuffer.destroy(),this.boundsBuffer=t.createVertexBuffer(h,e.boundsAttributes.members),this.boundsSegments=e.SegmentVector.simpleSegment(0,0,4,2)}}},{key:"prepare",value:function(){if(0!==Object.keys(this.tiles).length&&this.image){var t=this.map.painter.context,n=t.gl;this._dirty&&(this.texture?this.texture.update(this.image):(this.texture=new e.Texture(t,this.image,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE)),this._dirty=!1),this._prepareData(t)}}},{key:"loadTile",value:function(e,t){this.tileID&&this.tileID.equals(e.tileID.canonical)?(this.tiles[String(e.tileID.wrap)]=e,e.buckets={},t(null)):(e.state="errored",t(null))}},{key:"serialize",value:function(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}},{key:"hasTransition",value:function(){return!1}}]),r}(e.Evented),Ue={vector:Ne,raster:Fe,"raster-dem":function(t){m(r,t);var n=v(r);function r(t,i,a,o){var s;return d(this,r),(s=n.call(this,t,i,a,o)).type="raster-dem",s.maxzoom=22,s._options=e.extend({type:"raster-dem"},i),s.encoding=i.encoding||"mapbox",s}return p(r,[{key:"loadTile",value:function(t,n){var r=this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize);function i(e,r){e&&(t.state="errored",n(e)),r&&(t.dem=r,t.dem.onDeserialize(),t.needsHillshadePrepare=!0,t.needsDEMTextureUpload=!0,t.state="loaded",n(null))}t.request=e.getImage(this.map._requestManager.transformRequest(r,e.ResourceType.Tile),function(r,a,o,s){if(delete t.request,t.aborted)t.state="unloaded",n(null);else if(r)t.state="errored",n(r);else if(a){this.map._refreshExpiredTiles&&t.setExpiryData({cacheControl:o,expires:s});var l=e.window.ImageBitmap&&a instanceof e.window.ImageBitmap&&(null==Y&&(Y=e.window.OffscreenCanvas&&new e.window.OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof e.window.createImageBitmap),Y),c=1-(a.width-e.prevPowerOfTwo(a.width))/2;c<1||t.neighboringTiles||(t.neighboringTiles=this._getNeighboringTiles(t.tileID));var u=l?a:e.exported.getImageData(a,c),f={uid:t.uid,coord:t.tileID,source:this.id,rawImageData:u,encoding:this.encoding,padding:c};t.actor&&"expired"!==t.state||(t.actor=this.dispatcher.getActor(),t.actor.send("loadDEMTile",f,i.bind(this),void 0,!0))}}.bind(this))}},{key:"_getNeighboringTiles",value:function(t){var n=t.canonical,r=Math.pow(2,n.z),i=(n.x-1+r)%r,a=0===n.x?t.wrap-1:t.wrap,o=(n.x+1+r)%r,s=n.x+1===r?t.wrap+1:t.wrap,l={};return l[new e.OverscaledTileID(t.overscaledZ,a,n.z,i,n.y).key]={backfilled:!1},l[new e.OverscaledTileID(t.overscaledZ,s,n.z,o,n.y).key]={backfilled:!1},n.y>0&&(l[new e.OverscaledTileID(t.overscaledZ,a,n.z,i,n.y-1).key]={backfilled:!1},l[new e.OverscaledTileID(t.overscaledZ,t.wrap,n.z,n.x,n.y-1).key]={backfilled:!1},l[new e.OverscaledTileID(t.overscaledZ,s,n.z,o,n.y-1).key]={backfilled:!1}),n.y+1n.end(0)?this.fire(new e.ErrorEvent(new e.ValidationError("sources.".concat(this.id),null,"Playback for this video can be set only between the ".concat(n.start(0)," and ").concat(n.end(0),"-second mark.")))):this.video.currentTime=t}}},{key:"getVideo",value:function(){return this.video}},{key:"onAdd",value:function(e){this.map||(this.map=e,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}},{key:"prepare",value:function(){if(!(0===Object.keys(this.tiles).length||this.video.readyState<2)){var t=this.map.painter.context,n=t.gl;this.texture?this.video.paused||(this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE),n.texSubImage2D(n.TEXTURE_2D,0,0,0,n.RGBA,n.UNSIGNED_BYTE,this.video)):(this.texture=new e.Texture(t,this.video,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE),this.width=this.video.videoWidth,this.height=this.video.videoHeight),this._prepareData(t)}}},{key:"serialize",value:function(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}},{key:"hasTransition",value:function(){return this.video&&!this.video.paused}}]),r}(je),image:je,canvas:function(t){m(r,t);var n=v(r);function r(t,i,a,o){var s;return d(this,r),s=n.call(this,t,i,a,o),i.coordinates?Array.isArray(i.coordinates)&&4===i.coordinates.length&&!i.coordinates.some((function(e){return!Array.isArray(e)||2!==e.length||e.some((function(e){return"number"!=typeof e}))}))||s.fire(new e.ErrorEvent(new e.ValidationError("sources.".concat(t),null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):s.fire(new e.ErrorEvent(new e.ValidationError("sources.".concat(t),null,'missing required property "coordinates"'))),i.animate&&"boolean"!=typeof i.animate&&s.fire(new e.ErrorEvent(new e.ValidationError("sources.".concat(t),null,'optional "animate" property must be a boolean value'))),i.canvas?"string"==typeof i.canvas||i.canvas instanceof e.window.HTMLCanvasElement||s.fire(new e.ErrorEvent(new e.ValidationError("sources.".concat(t),null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):s.fire(new e.ErrorEvent(new e.ValidationError("sources.".concat(t),null,'missing required property "canvas"'))),s.options=i,s.animate=void 0===i.animate||i.animate,s}return p(r,[{key:"load",value:function(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof e.window.HTMLCanvasElement?this.options.canvas:e.window.document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new e.ErrorEvent(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())}},{key:"getCanvas",value:function(){return this.canvas}},{key:"onAdd",value:function(e){this.map=e,this.load(),this.canvas&&this.animate&&this.play()}},{key:"onRemove",value:function(){this.pause()}},{key:"prepare",value:function(){var t=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,t=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,t=!0),!this._hasInvalidDimensions()&&0!==Object.keys(this.tiles).length){var n=this.map.painter.context;this.texture?(t||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new e.Texture(n,this.canvas,n.gl.RGBA,{premultiply:!0}),this._prepareData(n)}}},{key:"serialize",value:function(){return{type:"canvas",coordinates:this.coordinates}}},{key:"hasTransition",value:function(){return this._playing}},{key:"_hasInvalidDimensions",value:function(){for(var e=0,t=[this.canvas.width,this.canvas.height];e7&&void 0!==arguments[7]&&arguments[7],l=e.tilesIn(r,o,s);l.sort(We);var c,u=[],f=h(l);try{for(f.s();!(c=f.n()).done;){var d=c.value;u.push({wrappedTileID:d.tile.tileID.wrapped().key,queryResults:d.tile.queryRenderedFeatures(t,n,e._state,d,i,a,Ze(e.transform,d.tile.tileID),s)})}}catch(v){f.e(v)}finally{f.f()}var p=function(e){var t,n={},r={},i=h(e);try{for(i.s();!(t=i.n()).done;){var a=t.value,o=a.queryResults,s=a.wrappedTileID,l=r[s]=r[s]||{};for(var c in o){var u,f=o[c],d=l[c]=l[c]||{},p=n[c]=n[c]||[],m=h(f);try{for(m.s();!(u=m.n()).done;){var y=u.value;d[y.featureIndex]||(d[y.featureIndex]=!0,p.push(y))}}catch(v){m.e(v)}finally{m.f()}}}}catch(v){i.e(v)}finally{i.f()}return n}(u);for(var m in p)p[m].forEach((function(t){var n=t.feature,r=n.layer;r&&"background"!==r.type&&"sky"!==r.type&&(n.source=r.source,r["source-layer"]&&(n.sourceLayer=r["source-layer"]),n.state=void 0!==n.id?e.getFeatureState(r["source-layer"],n.id):{})}));return p}function qe(e,t){for(var n=e.getRenderableIds().map((function(t){return e.getTileByID(t)})),r=[],i={},a=0;a0?(i-o)/s:0;return this.points[a].mult(1-l).add(this.points[n].mult(l))}}]),t}(),ut=function(){function e(t,n,r){d(this,e);var i=this.boxCells=[],a=this.circleCells=[];this.xCellCount=Math.ceil(t/r),this.yCellCount=Math.ceil(n/r);for(var o=0;othis.width||r<0||t>this.height)return!i&&[];var o=[];if(e<=0&&t<=0&&this.width<=n&&this.height<=r){if(i)return!0;for(var s=0;s0:o}},{key:"_queryCircle",value:function(e,t,n,r,i){var a=e-n,o=e+n,s=t-n,l=t+n;if(o<0||a>this.width||l<0||s>this.height)return!r&&[];var c=[];return this._forEachCell(a,s,o,l,this._queryCellCircle,c,{hitTest:r,circle:{x:e,y:t,radius:n},seenUids:{box:{},circle:{}}},i),r?c.length>0:c}},{key:"query",value:function(e,t,n,r,i){return this._query(e,t,n,r,!1,i)}},{key:"hitTest",value:function(e,t,n,r,i){return this._query(e,t,n,r,!0,i)}},{key:"hitTestCircle",value:function(e,t,n,r){return this._queryCircle(e,t,n,!0,r)}},{key:"_queryCell",value:function(e,t,n,r,i,a,o,s){var l=o.seenUids,c=this.boxCells[i];if(null!==c){var u,f=this.bboxes,d=h(c);try{for(d.s();!(u=d.n()).done;){var p=u.value;if(!l.box[p]){l.box[p]=!0;var m=4*p;if(e<=f[m+2]&&t<=f[m+3]&&n>=f[m+0]&&r>=f[m+1]&&(!s||s(this.boxKeys[p]))){if(o.hitTest)return a.push(!0),!0;a.push({key:this.boxKeys[p],x1:f[m],y1:f[m+1],x2:f[m+2],y2:f[m+3]})}}}}catch(M){d.e(M)}finally{d.f()}}var v=this.circleCells[i];if(null!==v){var y,g=this.circles,_=h(v);try{for(_.s();!(y=_.n()).done;){var x=y.value;if(!l.circle[x]){l.circle[x]=!0;var b=3*x;if(this._circleAndRectCollide(g[b],g[b+1],g[b+2],e,t,n,r)&&(!s||s(this.circleKeys[x]))){if(o.hitTest)return a.push(!0),!0;var w=g[b],k=g[b+1],z=g[b+2];a.push({key:this.circleKeys[x],x1:w-z,y1:k-z,x2:w+z,y2:k+z})}}}}catch(M){_.e(M)}finally{_.f()}}}},{key:"_queryCellCircle",value:function(e,t,n,r,i,a,o,s){var l=o.circle,c=o.seenUids,u=this.boxCells[i];if(null!==u){var f,d=this.bboxes,p=h(u);try{for(p.s();!(f=p.n()).done;){var m=f.value;if(!c.box[m]){c.box[m]=!0;var v=4*m;if(this._circleAndRectCollide(l.x,l.y,l.radius,d[v+0],d[v+1],d[v+2],d[v+3])&&(!s||s(this.boxKeys[m])))return a.push(!0),!0}}}catch(k){p.e(k)}finally{p.f()}}var y=this.circleCells[i];if(null!==y){var g,_=this.circles,x=h(y);try{for(x.s();!(g=x.n()).done;){var b=g.value;if(!c.circle[b]){c.circle[b]=!0;var w=3*b;if(this._circlesCollide(_[w],_[w+1],_[w+2],l.x,l.y,l.radius)&&(!s||s(this.circleKeys[b])))return a.push(!0),!0}}}catch(k){x.e(k)}finally{x.f()}}}},{key:"_forEachCell",value:function(e,t,n,r,i,a,o,s){for(var l=this._convertToXCellCoord(e),c=this._convertToYCellCoord(t),u=this._convertToXCellCoord(n),f=this._convertToYCellCoord(r),h=l;h<=u;h++)for(var d=c;d<=f;d++)if(i.call(this,e,t,n,r,this.xCellCount*d+h,a,o,s))return}},{key:"_convertToXCellCoord",value:function(e){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(e*this.xScale)))}},{key:"_convertToYCellCoord",value:function(e){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(e*this.yScale)))}},{key:"_circlesCollide",value:function(e,t,n,r,i,a){var o=r-e,s=i-t,l=n+a;return l*l>o*o+s*s}},{key:"_circleAndRectCollide",value:function(e,t,n,r,i,a,o){var s=(a-r)/2,l=Math.abs(e-(r+s));if(l>s+n)return!1;var c=(o-i)/2,u=Math.abs(t-(i+c));if(u>c+n)return!1;if(l<=s||u<=c)return!0;var f=l-s,h=u-c;return f*f+h*h<=n*n}}]),e}(),ft={unknown:0,flipRequired:1,flipNotRequired:2},ht=Math.tan(85*Math.PI/180);function dt(t,n,r,i,a,o,s){var l=e.create();if(r)if("globe"===o.name){var c=e.calculateGlobeLabelMatrix(a,n);e.multiply(l,l,c)}else{var u=I([],s);l[0]=u[0],l[1]=u[1],l[4]=u[2],l[5]=u[3],i||e.rotateZ(l,l,a.angle)}else e.multiply(l,a.labelPlaneMatrix,t);return l}function pt(e,t,n,r,i,a,o){var s=dt(e,t,n,r,i,a,o);return"globe"===a.name&&n||(s[2]=s[6]=s[10]=s[14]=0),s}function mt(t,n,r,i,a,o,s){if(r){if("globe"===o.name){var l=dt(t,n,r,i,a,o,s);return e.invert(l,l),e.multiply(l,t,l),l}var c=e.clone(t),u=e.identity([]);return u[0]=s[0],u[1]=s[1],u[4]=s[2],u[5]=s[3],e.multiply(c,c,u),i||e.rotateZ(c,c,-a.angle),c}return a.glCoordMatrix}function vt(t,n,r,i){var a=[t,n,r,1];r?e.transformMat4$1(a,a,i):St(a,a,i);var o=a[3];return a[0]/=o,a[1]/=o,a[2]/=o,a}function yt(e,t){return Math.min(.5+e/t*.5,1.5)}function gt(e,t){var n=e[0]/e[3],r=e[1]/e[3];return n>=-t[0]&&n<=t[0]&&r>=-t[1]&&r<=t[1]}function _t(t,n,r,i,a,o,s,l,c,u){var h=r.transform,d=i?t.textSizeData:t.iconSizeData,p=e.evaluateSizeForZoom(d,r.transform.zoom),m="globe"===h.projection.name,v=[256/r.width*2+1,256/r.height*2+1],y=i?t.text.dynamicLayoutVertexArray:t.icon.dynamicLayoutVertexArray;y.clear();var g=null;m&&(g=i?t.text.globeExtVertexArray:t.icon.globeExtVertexArray);for(var _,x=t.lineVertexArray,b=i?t.text.placedSymbolArray:t.icon.placedSymbolArray,w=r.transform.width/r.transform.height,k=!1,z=0;zMath.abs(r)?{useVertical:!0}:t===e.WritingMode.vertical?i>0?{needsFlipping:!0}:null:n!==ft.unknown&&function(e,t){return 0===e||Math.abs(t/e)>ht}(r,i)?n===ft.flipRequired?{needsFlipping:!0}:null:r<0?{needsFlipping:!0}:null}function wt(t,n,r,i,a,o,s,l,c,u,h,d,p,m,v,y,g,_,x){var b=n/24,w=t.lineOffsetX*b,k=t.lineOffsetY*b,z=t.lineStartIndex,M=t.glyphStartIndex,T=t.numGlyphs,S=t.segment,E=t.writingMode,C=t.flipState,A=z+t.lineLength,I=function(t){if(h){var n=f(t.up,3),r=n[0],i=n[1],a=n[2],o=u.length;e.updateGlobeVertexNormal(h,o+0,r,i,a),e.updateGlobeVertexNormal(h,o+1,r,i,a),e.updateGlobeVertexNormal(h,o+2,r,i,a),e.updateGlobeVertexNormal(h,o+3,r,i,a)}var s=f(t.point,3),l=s[0],c=s[1],d=s[2];e.addDynamicAttributes(u,l,c,d,t.angle)};if(T>1){var P=xt(b,l,w,k,r,d,p,t,c,o,m,y,!1,g,_,x);if(!P)return{notEnoughRoom:!0};if(i&&!r){var L,D,R,O,B=f(P.first.point,3),N=B[0],F=B[1],V=B[2],j=f(P.last.point,3),U=j[0],H=j[1],Z=j[2];L=vt(N,F,V,s),N=(D=f(L,2))[0],F=D[1],R=vt(U,H,Z,s);var G=bt(E,C,((U=(O=f(R,2))[0])-N)*v,(H=O[1])-F);if(t.flipState=G&&G.needsFlipping?ft.flipRequired:ft.flipNotRequired,G)return G}I(P.first);for(var q=M+1;q0?$:zt(p,K,X,1,a,void 0,g,_.canonical),Q=bt(E,C,(J[0]-X[0])*v,J[1]-X[1]);if(t.flipState=Q&&Q.needsFlipping?ft.flipRequired:ft.flipNotRequired,Q)return Q}var ee=Mt(b*l.getoffsetX(M),w,k,r,d,p,S,z,A,c,o,m,y,!1,!1,g,_,x);if(!ee)return{notEnoughRoom:!0};I(ee)}return{}}function kt(e,t,n,r,i){var a=r.projectTilePoint(e.x,e.y,t),o=a.x,s=a.y,l=a.z;if(!i)return vt(o,s,l,n);var c=i(e),u=f(c,3);return vt(o+u[0],s+u[1],l+u[2],n)}function zt(t,n,r,i,a,o,s,l){var c=kt(t.sub(n)._unit()._add(t),l,a,s,o);return e.sub(c,r,c),e.normalize(c,c),e.scaleAndAdd(c,r,c,i)}function Mt(t,n,r,i,a,o,s,l,c,u,f,h,d,p,m,v,y,g){var _=i?t-n:t+n,x=_>0?1:-1,b=0;i&&(x*=-1,b=Math.PI),x<0&&(b+=Math.PI);for(var w=l+s+(x>0?0:1)|0,k=a,z=a,M=0,T=0,S=Math.abs(_),E=[],C=[],A=o,I=A,P=function(){return zt(I,A,z,S-M+1,f,d,v,y.canonical)};M+T<=S;){if((w+=x)=c)return null;if(z=k,I=A,E.push(z),p&&C.push(I),A=new e.Point(u.getx(w),u.gety(w)),!(k=h[w])){var L=kt(A,y.canonical,f,v,d);k=L[3]>0?h[w]=L:P()}M+=T,T=e.distance(z,k)}m&&d&&(h[w]&&(k=P(),T=e.distance(z,k)),h[w]=k);var D=(S-M)/T,R=A.sub(I)._mult(D)._add(I),O=e.sub([],k,z),B=e.scaleAndAdd([],z,O,D),N=[0,0,1],F=O[0],V=O[1];if(g&&(0!==(N=v.upVector(y.canonical,R.x,R.y))[0]||0!==N[1]||1!==N[2])){var j=[N[2],0,-N[0]],U=e.cross([],N,j);e.normalize(j,j),e.normalize(U,U),F=e.dot(O,j),V=e.dot(O,U)}if(r){var H=e.cross([],N,O);e.normalize(H,H),e.scaleAndAdd(B,B,H,r*x)}var Z=b+Math.atan2(V,F);return E.push(B),p&&C.push(R),{point:B,angle:Z,path:E,tilePath:C,up:N}}function Tt(e,t){var n=t.length,r=n+4*e;t.resize(r),t.float32.fill(-1/0,4*n,4*r)}function St(e,t,n){var r=t[0],i=t[1];return e[0]=n[0]*r+n[4]*i+n[12],e[1]=n[1]*r+n[5]*i+n[13],e[3]=n[3]*r+n[7]*i+n[15],e}var Et=100,Ct=function(){function t(e,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new ut(e.width+200,e.height+200,25),i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:new ut(e.width+200,e.height+200,25);d(this,t),this.transform=e,this.grid=r,this.ignoredGrid=i,this.pitchfactor=Math.cos(e._pitch)*e.cameraToCenterDistance,this.screenRightBoundary=e.width+Et,this.screenBottomBoundary=e.height+Et,this.gridRightBoundary=e.width+200,this.gridBottomBoundary=e.height+200,this.fogState=n}return p(t,[{key:"placeCollisionBox",value:function(e,t,n,r,i,a,o,s){var l=n.projectedAnchorX,c=n.projectedAnchorY,u=n.projectedAnchorZ,h=n.elevation,d=n.tileID,p=e.getProjection();if(h&&d){var m=p.upVector(d.canonical,n.tileAnchorX,n.tileAnchorY),v=f(m,3),y=v[0],g=v[1],_=v[2],x=p.upVectorScale(d.canonical,this.transform.center.lat,this.transform.worldSize).metersToTile;l+=y*h*x,c+=g*h*x,u+=_*h*x}var b=this.projectAndGetPerspectiveRatio(o,l,c,u,n.tileID,"globe"===p.name||!!h||this.transform.pitch>0,p),w=a*b.perspectiveRatio,k=(n.x1*t+r.x-n.padding)*w+b.point.x,z=(n.y1*t+r.y-n.padding)*w+b.point.y,M=(n.x2*t+r.x+n.padding)*w+b.point.x,T=(n.y2*t+r.y+n.padding)*w+b.point.y,S=b.perspectiveRatio<=.55||b.occluded;return!this.isInsideGrid(k,z,M,T)||!i&&this.grid.hitTest(k,z,M,T,s)||S?{box:[],offscreen:!1,occluded:b.occluded}:{box:[k,z,M,T],offscreen:this.isOffscreen(k,z,M,T),occluded:!1}}},{key:"placeCollisionCircles",value:function(t,n,r,i,a,o,s,l,c,u,d,p,m,v,y){var g=[],_=this.transform.elevation,x=t.getProjection(),b=_?_.getAtTileOffsetFunc(y,this.transform.center.lat,this.transform.worldSize,x):null,w=new e.Point(r.tileAnchorX,r.tileAnchorY),k=x.projectTilePoint(w.x,w.y,y.canonical),z=k.x,M=k.y,T=k.z;if(b){var S=b(w),E=f(S,3);z+=E[0],M+=E[1],T+=E[2]}var C="globe"===x.name,A=this.projectAndGetPerspectiveRatio(s,z,M,T,y,C||!!_||this.transform.pitch>0,x),I=A.perspectiveRatio,P=(d?o/I:o*I)/e.ONE_EM,L=vt(z,M,T,l),D=A.signedDistanceFromCamera>0?xt(P,a,r.lineOffsetX*P,r.lineOffsetY*P,!1,L,w,r,i,l,{},_&&!d?b:null,d&&!!_,x,y,d):null,R=!1,O=!1,B=!0;if(D&&!A.occluded){for(var N=.5*m*I+v,F=new e.Point(-100,-100),V=new e.Point(this.screenRightBoundary,this.screenBottomBoundary),j=new ct,U=D.first,H=D.last,Z=U.path.length,G=[],q=Z-1;q>=1;q--)G.push(U.path[q]);for(var W=1;W