PageSourceSearch

https://www.benchmarkresortsandhotels.com/site/templates/assets/dist/mapbox-gl.js

js benchmarkresortsandhotels.com collected 2026-09-30 16:11:28 UTC 1,365,124 bytes, 2,115 lines download raw bytes

1import{g as f1,c as m1}from"./uikitjs.js";function _1(yc,lp){for(var qa=0;qa<lp.length;qa++){const Mn=lp[qa];if(typeof Mn!="string"&&!Array.isArray(Mn)){for(const An in Mn)if(An!=="default"&&!(An in yc)){const Oo=Object.getOwnPropertyDescriptor(Mn,An);Oo&&Object.defineProperty(yc,An,Oo.get?Oo:{enumerable:!0,get:()=>Mn[An]})}}}return Object.freeze(Object.defineProperty(yc,Symbol.toStringTag,{value:"Module"}))}var Cy={exports:{}};(function(yc,lp){var qa={};(function(Mn,An){yc.exports=An()})(m1,function(){var Mn,An,Oo;function cp(o,At){if(!Mn)Mn=At;else if(!An)An=At;else{var Xr="self.onerror = function() { console.error('An error occurred while parsing the WebWorker bundle. This is most likely due to improper transpilation by Babel; please see https://docs.mapbox.com/mapbox-gl-js/guides/install/#transpiling'); }; var sharedChunk = {}; ("+Mn+")(sharedChunk); ("+An+")(sharedChunk); self.onerror = null;",Tt={};Mn(Tt),Oo=At(Tt),typeof window<"u"&&window&&window.URL&&window.URL.createObjectURL&&(Oo.workerUrl=window.URL.createObjectURL(new Blob([Xr],{type:"text/javascript"})))}}cp(["exports"],function(o){var At="3.4.0";let Xr;const Tt={API_URL:"https://api.mapbox.com",get API_URL_REGEX(){if(Xr==null){const t=/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/|\?|$)/i;try{Xr=qa.API_URL_REGEX!=null?new RegExp(qa.API_URL_REGEX):t}catch{Xr=t}}return Xr},get API_TILEJSON_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/v[0-9]*\/.*\.json.*$)/i},get API_SPRITE_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*\/sprite.*\..*$)/i},get API_FONTS_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/fonts\/v[0-9]*\/)(.*\.pbf.*$)/i},get API_STYLE_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*$)/i},get API_CDN_URL_REGEX(){return/^((https?:)?\/\/)?api\.mapbox\.c(n|om)(\/mapbox-gl-js\/)(.*$)/i},get EVENTS_URL(){if(!Tt.API_URL)return null;try{const t=new URL(Tt.API_URL);return t.hostname==="api.mapbox.cn"?"https://events.mapbox.cn/events/v2":t.hostname==="api.mapbox.com"?"https://events.mapbox.com/events/v2":null}catch{return null}},SESSION_PATH:"/map-sessions/v1",FEEDBACK_URL:"https://apps.mapbox.com/feedback",TILE_URL_VERSION:"v4",RASTER_URL_PREFIX:"raster/v1",RASTERARRAYS_URL_PREFIX:"rasterarrays/v1",REQUIRE_ACCESS_TOKEN:!0,ACCESS_TOKEN:null,DEFAULT_STYLE:"mapbox://styles/mapbox/standard",MAX_PARALLEL_IMAGE_REQUESTS:16,DRACO_URL:"https://api.mapbox.com/mapbox-gl-js/draco_decoder_gltf_v1.5.6.wasm",MESHOPT_URL:"https://api.mapbox.com/mapbox-gl-js/meshopt_base_v0.20.wasm",MESHOPT_SIMD_URL:"https://api.mapbox.com/mapbox-gl-js/meshopt_simd_v0.20.wasm",GLYPHS_URL:"mapbox://fonts/mapbox/{fontstack}/{range}.pbf"};function Zn(t){return Tt.API_URL_REGEX.test(t)}function Ft(t){return t.indexOf("mapbox:")===0}function Pr(t){return Tt.API_CDN_URL_REGEX.test(t)}function pn(t){return Tt.API_SPRITE_REGEX.test(t)}function fn(t){return Tt.API_STYLE_REGEX.test(t)&&!pn(t)}const cs={create:"create",load:"load",fullLoad:"fullLoad"};function Za(t){const e=t.name.split("?")[0];return Pr(e)&&e.includes("mapbox-gl.js")?"javascript":Pr(e)&&e.includes("mapbox-gl.css")?"css":function(i){return Tt.API_FONTS_REGEX.test(i)}(e)?"fontRange":pn(e)?"sprite":fn(e)?"style":function(i){return Tt.API_TILEJSON_REGEX.test(i)}(e)?"tilejson":"other"}function zr(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Di={},Ri={};Object.defineProperty(Ri,"__esModule",{value:!0}),Ri.setMatrixArrayType=function(t){Ri.ARRAY_TYPE=Yr=t},Ri.toRadian=function(t){return t*Wa},Ri.equals=function(t,e){return Math.abs(t-e)<=$n*Math.max(1,Math.abs(t),Math.abs(e))},Ri.RANDOM=Ri.ARRAY_TYPE=Ri.EPSILON=void 0;var $n=1e-6;Ri.EPSILON=$n;var Yr=typeof Float32Array<"u"?Float32Array:Array;Ri.ARRAY_TYPE=Yr;var $a=Math.random;Ri.RANDOM=$a;var Wa=Math.PI/180;Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)});var mi={};function Ns(t){return Ns=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ns(t)}
1Object.defineProperty(mi,"__esModule",{value:!0}),mi.create=function(){var t=new Dr.ARRAY_TYPE(4);return Dr.ARRAY_TYPE!=Float32Array&&(t[1]=0,t[2]=0),t[0]=1,t[3]=1,t},mi.clone=function(t){var e=new Dr.ARRAY_TYPE(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e},mi.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t},mi.identity=function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t},mi.fromValues=function(t,e,i,n){var a=new Dr.ARRAY_TYPE(4);return a[0]=t,a[1]=e,a[2]=i,a[3]=n,a},mi.set=function(t,e,i,n,a){return t[0]=e,t[1]=i,t[2]=n,t[3]=a,t},mi.transpose=function(t,e){if(t===e){var i=e[1];t[1]=e[2],t[2]=i}else t[0]=e[0],t[1]=e[2],t[2]=e[1],t[3]=e[3];return t},mi.invert=function(t,e){var i=e[0],n=e[1],a=e[2],l=e[3],h=i*l-a*n;return h?(t[0]=l*(h=1/h),t[1]=-n*h,t[2]=-a*h,t[3]=i*h,t):null},mi.adjoint=function(t,e){var i=e[0];return t[0]=e[3],t[1]=-e[1],t[2]=-e[2],t[3]=i,t},mi.determinant=function(t){return t[0]*t[3]-t[2]*t[1]},mi.multiply=Bo,mi.rotate=function(t,e,i){var n=e[0],a=e[1],l=e[2],h=e[3],p=Math.sin(i),m=Math.cos(i);return t[0]=n*m+l*p,t[1]=a*m+h*p,t[2]=n*-p+l*m,t[3]=a*-p+h*m,t},mi.scale=function(t,e,i){var n=e[1],a=e[2],l=e[3],h=i[0],p=i[1];return t[0]=e[0]*h,t[1]=n*h,t[2]=a*p,t[3]=l*p,t},mi.fromRotation=function(t,e){var i=Math.sin(e),n=Math.cos(e);return t[0]=n,t[1]=i,t[2]=-i,t[3]=n,t},mi.fromScaling=function(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=e[1],t},mi.str=function(t){return"mat2("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},mi.frob=function(t){return Math.hypot(t[0],t[1],t[2],t[3])},mi.LDU=function(t,e,i,n){return t[2]=n[2]/n[0],i[0]=n[0],i[1]=n[1],i[3]=n[3]-t[2]*i[1],[t,e,i]},mi.add=function(t,e,i){return t[0]=e[0]+i[0],t[1]=e[1]+i[1],t[2]=e[2]+i[2],t[3]=e[3]+i[3],t},mi.subtract=nr,mi.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]},mi.equals=function(t,e){var i=t[0],n=t[1],a=t[2],l=t[3],h=e[0],p=e[1],m=e[2],g=e[3];return Math.abs(i-h)<=Dr.EPSILON*Math.max(1,Math.abs(i),Math.abs(h))&&Math.abs(n-p)<=Dr.EPSILON*Math.max(1,Math.abs(n),Math.abs(p))&&Math.abs(a-m)<=Dr.EPSILON*Math.max(1,Math.abs(a),Math.abs(m))&&Math.abs(l-g)<=Dr.EPSILON*Math.max(1,Math.abs(l),Math.abs(g))},mi.multiplyScalar=function(t,e,i){return t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t[3]=e[3]*i,t},mi.multiplyScalarAndAdd=function(t,e,i,n){return t[0]=e[0]+i[0]*n,t[1]=e[1]+i[1]*n,t[2]=e[2]+i[2]*n,t[3]=e[3]+i[3]*n,t},mi.sub=mi.mul=void 0;var Dr=function(t,e){if(t&&t.__esModule)return t;if(t===null||Ns(t)!=="object"&&typeof t!="function")return{default:t};var i=Qa(void 0);if(i&&i.has(t))return i.get(t);var n={},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in t)if(l!=="default"&&Object.prototype.hasOwnProperty.call(t,l)){var h=a?Object.getOwnPropertyDescriptor(t,l):null;h&&(h.get||h.set)?Object.defineProperty(n,l,h):n[l]=t[l]}return n.default=t,i&&i.set(t,n),n}(Ri);function Qa(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,i=new WeakMap;return(Qa=function(n){return n?i:e})(t)}function Bo(t,e,i){var n=e[0],a=e[1],l=e[2],h=e[3],p=i[0],m=i[1],g=i[2],x=i[3];return t[0]=n*p+l*m,t[1]=a*p+h*m,t[2]=n*g+l*x,t[3]=a*g+h*x,t}function nr(t,e,i){return t[0]=e[0]-i[0],t[1]=e[1]-i[1],t[2]=e[2]-i[2],t[3]=e[3]-i[3],t}mi.mul=Bo,mi.sub=nr;var _i={};function Vs(t){return Vs=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Vs(t)}Object.defineProperty(_i,"__esModule",{value:!0}),_i.create=function(){var t=new Rr.ARRAY_TYPE(6);return Rr.ARRAY_TYPE!=Float32Array&&(t[1]=0,t[2]=0,t[4]=0,t[5]=0),t[0]=1,t[3]=1,t},_i.clone=function(t){var e=new Rr.ARRAY_TYPE(6);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e},_i.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t},_i.identity=function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t},_i.fromValues=function(t,e,i,n,a,l){var h=new Rr.ARRAY_TYPE(6);return h[0]=t,h[1]=e,h[2]=i,h[3]=n,h[4]=a,h[5]=l,h},_i.set=function(t,e,i,n,a,l,h){return t[0]=e,t[1]=i,t[2]=n,t[3]=a,t[4]=l,t[5]=h,t},_i.invert=function(t,e){var i=e[0],n=e[1],a=e[2],l=e[3],h=e[4],p=e[5],m=i*l-n*a;return m?(t[0]=l*(m=1/m),t[1]=-n*m,t[2]=-a*m,t[3]=i*m,t[4]=(a*p-l*h)*m,t[5]=(n*h-i*p)*m,t):null},_i.determinant=function(t){return t[0]*t[3]-t[1]*t[2]}
1,_i.multiply=Us,_i.rotate=function(t,e,i){var n=e[0],a=e[1],l=e[2],h=e[3],p=e[4],m=e[5],g=Math.sin(i),x=Math.cos(i);return t[0]=n*x+l*g,t[1]=a*x+h*g,t[2]=n*-g+l*x,t[3]=a*-g+h*x,t[4]=p,t[5]=m,t},_i.scale=function(t,e,i){var n=e[1],a=e[2],l=e[3],h=e[4],p=e[5],m=i[0],g=i[1];return t[0]=e[0]*m,t[1]=n*m,t[2]=a*g,t[3]=l*g,t[4]=h,t[5]=p,t},_i.translate=function(t,e,i){var n=e[0],a=e[1],l=e[2],h=e[3],p=e[4],m=e[5],g=i[0],x=i[1];return t[0]=n,t[1]=a,t[2]=l,t[3]=h,t[4]=n*g+l*x+p,t[5]=a*g+h*x+m,t},_i.fromRotation=function(t,e){var i=Math.sin(e),n=Math.cos(e);return t[0]=n,t[1]=i,t[2]=-i,t[3]=n,t[4]=0,t[5]=0,t},_i.fromScaling=function(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=e[1],t[4]=0,t[5]=0,t},_i.fromTranslation=function(t,e){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=e[0],t[5]=e[1],t},_i.str=function(t){return"mat2d("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+")"},_i.frob=function(t){return Math.hypot(t[0],t[1],t[2],t[3],t[4],t[5],1)},_i.add=function(t,e,i){return t[0]=e[0]+i[0],t[1]=e[1]+i[1],t[2]=e[2]+i[2],t[3]=e[3]+i[3],t[4]=e[4]+i[4],t[5]=e[5]+i[5],t},_i.subtract=us,_i.multiplyScalar=function(t,e,i){return t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t[3]=e[3]*i,t[4]=e[4]*i,t[5]=e[5]*i,t},_i.multiplyScalarAndAdd=function(t,e,i,n){return t[0]=e[0]+i[0]*n,t[1]=e[1]+i[1]*n,t[2]=e[2]+i[2]*n,t[3]=e[3]+i[3]*n,t[4]=e[4]+i[4]*n,t[5]=e[5]+i[5]*n,t},_i.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]},_i.equals=function(t,e){var i=t[0],n=t[1],a=t[2],l=t[3],h=t[4],p=t[5],m=e[0],g=e[1],x=e[2],v=e[3],w=e[4],E=e[5];return Math.abs(i-m)<=Rr.EPSILON*Math.max(1,Math.abs(i),Math.abs(m))&&Math.abs(n-g)<=Rr.EPSILON*Math.max(1,Math.abs(n),Math.abs(g))&&Math.abs(a-x)<=Rr.EPSILON*Math.max(1,Math.abs(a),Math.abs(x))&&Math.abs(l-v)<=Rr.EPSILON*Math.max(1,Math.abs(l),Math.abs(v))&&Math.abs(h-w)<=Rr.EPSILON*Math.max(1,Math.abs(h),Math.abs(w))&&Math.abs(p-E)<=Rr.EPSILON*Math.max(1,Math.abs(p),Math.abs(E))},_i.sub=_i.mul=void 0;var Rr=function(t,e){if(t&&t.__esModule)return t;if(t===null||Vs(t)!=="object"&&typeof t!="function")return{default:t};var i=Vr(void 0);if(i&&i.has(t))return i.get(t);var n={},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in t)if(l!=="default"&&Object.prototype.hasOwnProperty.call(t,l)){var h=a?Object.getOwnPropertyDescriptor(t,l):null;h&&(h.get||h.set)?Object.defineProperty(n,l,h):n[l]=t[l]}return n.default=t,i&&i.set(t,n),n}(Ri);function Vr(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,i=new WeakMap;return(Vr=function(n){return n?i:e})(t)}function Us(t,e,i){var n=e[0],a=e[1],l=e[2],h=e[3],p=e[4],m=e[5],g=i[0],x=i[1],v=i[2],w=i[3],E=i[4],M=i[5];return t[0]=n*g+l*x,t[1]=a*g+h*x,t[2]=n*v+l*w,t[3]=a*v+h*w,t[4]=n*E+l*M+p,t[5]=a*E+h*M+m,t}function us(t,e,i){return t[0]=e[0]-i[0],t[1]=e[1]-i[1],t[2]=e[2]-i[2],t[3]=e[3]-i[3],t[4]=e[4]-i[4],t[5]=e[5]-i[5],t}_i.mul=Us,_i.sub=us;var Yt={};function js(t){return js=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},js(t)}Object.defineProperty(Yt,"__esModule",{value:!0}),Yt.create=function(){var t=new hr.ARRAY_TYPE(9);return hr.ARRAY_TYPE!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t},Yt.fromMat4=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[4],t[4]=e[5],t[5]=e[6],t[6]=e[8],t[7]=e[9],t[8]=e[10],t},Yt.clone=function(t){var e=new hr.ARRAY_TYPE(9);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e},Yt.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t},Yt.fromValues=function(t,e,i,n,a,l,h,p,m){var g=new hr.ARRAY_TYPE(9);return g[0]=t,g[1]=e,g[2]=i,g[3]=n,g[4]=a,g[5]=l,g[6]=h,g[7]=p,g[8]=m,g},Yt.set=function(t,e,i,n,a,l,h,p,m,g){return t[0]=e,t[1]=i,t[2]=n,t[3]=a,t[4]=l,t[5]=h,t[6]=p,t[7]=m,t[8]=g,t},Yt.identity=function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},Yt.transpose=function(t,e){if(t===e){var i=e[1],n=e[2],a=e[5];t[1]=e[3],t[2]=e[6],t[3]=i,t[5]=e[7],t[6]=n,t[7]=a}else t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8];return t},Yt.invert=function(t,e){var i=e[0],n=e[1],a=e[2],l=e[3],h=e[4],p=e[5],m=e[6],g=e[7],x=e[8],v=x*h-p*g,w=-x*l+p*m,E=g*l-h*m,M=i*v+n*w+a*E;return M?(t[0]=v*(M=1/M),t[1]=(-x*n+a*g)*M,t[2]=(p*n-a*h)*M,t[3]=w*M,t[4]=(x*i-a*m)*M,t[5]=(-p*i+a*l)*M,t[6]=E*M,t[7]=(-g*i+n*m)*M,t[8]=(h*i-n*l)*M,t):null},Yt.adjoint=function(t,e){var i=e[0],n=e[1],a=e[2],l=e[3],h=e[4],p=e[5],m=e[6],g=e[7],x=e[8];return t[0]=h*x-p*g,t[1]=a*g-n*x,t[2]=n*p-a*h,t[3]=p*m-l*x,t[4]=i*x-a*m,t[5]=a*l-i*p,t[6]=l*g-h*m,t[7]=n*m-i*g,t[8]=i*h-n*l,t},Yt.determinant=function(t){var e=t[3],i=t[4],n=t[5],a=t[6],l=t[7],h=t[8];
1return t[0]*(h*i-n*l)+t[1]*(-h*e+n*a)+t[2]*(l*e-i*a)},Yt.multiply=hs,Yt.translate=function(t,e,i){var n=e[0],a=e[1],l=e[2],h=e[3],p=e[4],m=e[5],g=e[6],x=e[7],v=e[8],w=i[0],E=i[1];return t[0]=n,t[1]=a,t[2]=l,t[3]=h,t[4]=p,t[5]=m,t[6]=w*n+E*h+g,t[7]=w*a+E*p+x,t[8]=w*l+E*m+v,t},Yt.rotate=function(t,e,i){var n=e[0],a=e[1],l=e[2],h=e[3],p=e[4],m=e[5],g=e[6],x=e[7],v=e[8],w=Math.sin(i),E=Math.cos(i);return t[0]=E*n+w*h,t[1]=E*a+w*p,t[2]=E*l+w*m,t[3]=E*h-w*n,t[4]=E*p-w*a,t[5]=E*m-w*l,t[6]=g,t[7]=x,t[8]=v,t},Yt.scale=function(t,e,i){var n=i[0],a=i[1];return t[0]=n*e[0],t[1]=n*e[1],t[2]=n*e[2],t[3]=a*e[3],t[4]=a*e[4],t[5]=a*e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t},Yt.fromTranslation=function(t,e){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=e[0],t[7]=e[1],t[8]=1,t},Yt.fromRotation=function(t,e){var i=Math.sin(e),n=Math.cos(e);return t[0]=n,t[1]=i,t[2]=0,t[3]=-i,t[4]=n,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},Yt.fromScaling=function(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=e[1],t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},Yt.fromMat2d=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=0,t[3]=e[2],t[4]=e[3],t[5]=0,t[6]=e[4],t[7]=e[5],t[8]=1,t},Yt.fromQuat=function(t,e){var i=e[0],n=e[1],a=e[2],l=e[3],h=i+i,p=n+n,m=a+a,g=i*h,x=n*h,v=n*p,w=a*h,E=a*p,M=a*m,I=l*h,z=l*p,D=l*m;return t[0]=1-v-M,t[3]=x-D,t[6]=w+z,t[1]=x+D,t[4]=1-g-M,t[7]=E-I,t[2]=w-z,t[5]=E+I,t[8]=1-g-v,t},Yt.normalFromMat4=function(t,e){var i=e[0],n=e[1],a=e[2],l=e[3],h=e[4],p=e[5],m=e[6],g=e[7],x=e[8],v=e[9],w=e[10],E=e[11],M=e[12],I=e[13],z=e[14],D=e[15],F=i*p-n*h,j=i*m-a*h,V=i*g-l*h,X=n*m-a*p,q=n*g-l*p,J=a*g-l*m,ee=x*I-v*M,oe=x*z-w*M,fe=x*D-E*M,le=v*z-w*I,ge=v*D-E*I,_e=w*D-E*z,me=F*_e-j*ge+V*le+X*fe-q*oe+J*ee;return me?(t[0]=(p*_e-m*ge+g*le)*(me=1/me),t[1]=(m*fe-h*_e-g*oe)*me,t[2]=(h*ge-p*fe+g*ee)*me,t[3]=(a*ge-n*_e-l*le)*me,t[4]=(i*_e-a*fe+l*oe)*me,t[5]=(n*fe-i*ge-l*ee)*me,t[6]=(I*J-z*q+D*X)*me,t[7]=(z*V-M*J-D*j)*me,t[8]=(M*q-I*V+D*F)*me,t):null},Yt.projection=function(t,e,i){return t[0]=2/e,t[1]=0,t[2]=0,t[3]=0,t[4]=-2/i,t[5]=0,t[6]=-1,t[7]=1,t[8]=1,t},Yt.str=function(t){return"mat3("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+")"},Yt.frob=function(t){return Math.hypot(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8])},Yt.add=function(t,e,i){return t[0]=e[0]+i[0],t[1]=e[1]+i[1],t[2]=e[2]+i[2],t[3]=e[3]+i[3],t[4]=e[4]+i[4],t[5]=e[5]+i[5],t[6]=e[6]+i[6],t[7]=e[7]+i[7],t[8]=e[8]+i[8],t},Yt.subtract=Ur,Yt.multiplyScalar=function(t,e,i){return t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t[3]=e[3]*i,t[4]=e[4]*i,t[5]=e[5]*i,t[6]=e[6]*i,t[7]=e[7]*i,t[8]=e[8]*i,t},Yt.multiplyScalarAndAdd=function(t,e,i,n){return t[0]=e[0]+i[0]*n,t[1]=e[1]+i[1]*n,t[2]=e[2]+i[2]*n,t[3]=e[3]+i[3]*n,t[4]=e[4]+i[4]*n,t[5]=e[5]+i[5]*n,t[6]=e[6]+i[6]*n,t[7]=e[7]+i[7]*n,t[8]=e[8]+i[8]*n,t},Yt.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]&&t[8]===e[8]},Yt.equals=function(t,e){var i=t[0],n=t[1],a=t[2],l=t[3],h=t[4],p=t[5],m=t[6],g=t[7],x=t[8],v=e[0],w=e[1],E=e[2],M=e[3],I=e[4],z=e[5],D=e[6],F=e[7],j=e[8];return Math.abs(i-v)<=hr.EPSILON*Math.max(1,Math.abs(i),Math.abs(v))&&Math.abs(n-w)<=hr.EPSILON*Math.max(1,Math.abs(n),Math.abs(w))&&Math.abs(a-E)<=hr.EPSILON*Math.max(1,Math.abs(a),Math.abs(E))&&Math.abs(l-M)<=hr.EPSILON*Math.max(1,Math.abs(l),Math.abs(M))&&Math.abs(h-I)<=hr.EPSILON*Math.max(1,Math.abs(h),Math.abs(I))&&Math.abs(p-z)<=hr.EPSILON*Math.max(1,Math.abs(p),Math.abs(z))&&Math.abs(m-D)<=hr.EPSILON*Math.max(1,Math.abs(m),Math.abs(D))&&Math.abs(g-F)<=hr.EPSILON*Math.max(1,Math.abs(g),Math.abs(F))&&Math.abs(x-j)<=hr.EPSILON*Math.max(1,Math.abs(x),Math.abs(j))},Yt.sub=Yt.mul=void 0;var hr=function(t,e){if(t&&t.__esModule)return t;if(t===null||js(t)!=="object"&&typeof t!="function")return{default:t};var i=Gs(void 0);if(i&&i.has(t))return i.get(t);var n={},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in t)if(l!=="default"&&Object.prototype.hasOwnProperty.call(t,l)){var h=a?Object.getOwnPropertyDescriptor(t,l):null;h&&(h.get||h.set)?Object.defineProperty(n,l,h):n[l]=t[l]}return n.default=t,i&&i.set(t,n),n}(Ri);function Gs(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,i=new WeakMap;return(Gs=function(n){return n?i:e})(t)}function hs(t,e,i){var n=e[0],a=e[1],l=e[2],h=e[3],p=e[4],m=e[5],g=e[6],x=e[7],v=e[8],w=i[0],E=i[1],M=i[2],I=i[3],z=i[4],D=i[5],F=i[6],j=i[7],V=i[8];return t[0]=w*n+E*h+M*g,t[1]=w*a+E*p+M*x,t[2]=w*l+E*m+M*v,t[3]=I*n+z*h+D*g,t[4]=I*a+z*p+D*x,t[5]=I*l+z*m+D*v,t[6]=F*n+j*h+V*g,t[7]=F*a+j*p+V*x,t[8]=F*l+j*m+V*v,t}function Ur(t,e,i){return t[0]=e[0]-i[0],t[1]=e[1]-i[1],t[2]=e[2]-i[2],t[3]=e[3]-i[3],t[4]=e[4]-i[4],t[5]=e[5]-i[5],t[6]=e[6]-i[6],t[7]=e[7]-i[7],t[8]=e[8]-i[8],t}Yt.mul=hs,Yt.sub=Ur;var ut={};function ds(t){return ds=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ds(t)}
vendor: 4,080 bytes, line 1
1Object.defineProperty(ut,"__esModule",{value:!0}),ut.create=function(){var t=new vi.ARRAY_TYPE(16);return vi.ARRAY_TYPE!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t},ut.clone=function(t){var e=new vi.ARRAY_TYPE(16);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},ut.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},ut.fromValues=function(t,e,i,n,a,l,h,p,m,g,x,v,w,E,M,I){var z=new vi.ARRAY_TYPE(16);return z[0]=t,z[1]=e,z[2]=i,z[3]=n,z[4]=a,z[5]=l,z[6]=h,z[7]=p,z[8]=m,z[9]=g,z[10]=x,z[11]=v,z[12]=w,z[13]=E,z[14]=M,z[15]=I,z},ut.set=function(t,e,i,n,a,l,h,p,m,g,x,v,w,E,M,I,z){return t[0]=e,t[1]=i,t[2]=n,t[3]=a,t[4]=l,t[5]=h,t[6]=p,t[7]=m,t[8]=g,t[9]=x,t[10]=v,t[11]=w,t[12]=E,t[13]=M,t[14]=I,t[15]=z,t},ut.identity=qs,ut.transpose=function(t,e){if(t===e){var i=e[1],n=e[2],a=e[3],l=e[6],h=e[7],p=e[11];t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=i,t[6]=e[9],t[7]=e[13],t[8]=n,t[9]=l,t[11]=e[14],t[12]=a,t[13]=h,t[14]=p}else t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15];return t},ut.invert=function(t,e){var i=e[0],n=e[1],a=e[2],l=e[3],h=e[4],p=e[5],m=e[6],g=e[7],x=e[8],v=e[9],w=e[10],E=e[11],M=e[12],I=e[13],z=e[14],D=e[15],F=i*p-n*h,j=i*m-a*h,V=i*g-l*h,X=n*m-a*p,q=n*g-l*p,J=a*g-l*m,ee=x*I-v*M,oe=x*z-w*M,fe=x*D-E*M,le=v*z-w*I,ge=v*D-E*I,_e=w*D-E*z,me=F*_e-j*ge+V*le+X*fe-q*oe+J*ee;return me?(t[0]=(p*_e-m*ge+g*le)*(me=1/me),t[1]=(a*ge-n*_e-l*le)*me,t[2]=(I*J-z*q+D*X)*me,t[3]=(w*q-v*J-E*X)*me,t[4]=(m*fe-h*_e-g*oe)*me,t[5]=(i*_e-a*fe+l*oe)*me,t[6]=(z*V-M*J-D*j)*me,t[7]=(x*J-w*V+E*j)*me,t[8]=(h*ge-p*fe+g*ee)*me,t[9]=(n*fe-i*ge-l*ee)*me,t[10]=(M*q-I*V+D*F)*me,t[11]=(v*V-x*q-E*F)*me,t[12]=(p*oe-h*le-m*ee)*me,t[13]=(i*le-n*oe+a*ee)*me,t[14]=(I*j-M*X-z*F)*me,t[15]=(x*X-v*j+w*F)*me,t):null},ut.adjoint=function(t,e){var i=e[0],n=e[1],a=e[2],l=e[3],h=e[4],p=e[5],m=e[6],g=e[7],x=e[8],v=e[9],w=e[10],E=e[11],M=e[12],I=e[13],z=e[14],D=e[15];return t[0]=p*(w*D-E*z)-v*(m*D-g*z)+I*(m*E-g*w),t[1]=-(n*(w*D-E*z)-v*(a*D-l*z)+I*(a*E-l*w)),t[2]=n*(m*D-g*z)-p*(a*D-l*z)+I*(a*g-l*m),t[3]=-(n*(m*E-g*w)-p*(a*E-l*w)+v*(a*g-l*m)),t[4]=-(h*(w*D-E*z)-x*(m*D-g*z)+M*(m*E-g*w)),t[5]=i*(w*D-E*z)-x*(a*D-l*z)+M*(a*E-l*w),t[6]=-(i*(m*D-g*z)-h*(a*D-l*z)+M*(a*g-l*m)),t[7]=i*(m*E-g*w)-h*(a*E-l*w)+x*(a*g-l*m),t[8]=h*(v*D-E*I)-x*(p*D-g*I)+M*(p*E-g*v),t[9]=-(i*(v*D-E*I)-x*(n*D-l*I)+M*(n*E-l*v)),t[10]=i*(p*D-g*I)-h*(n*D-l*I)+M*(n*g-l*p),t[11]=-(i*(p*E-g*v)-h*(n*E-l*v)+x*(n*g-l*p)),t[12]=-(h*(v*z-w*I)-x*(p*z-m*I)+M*(p*w-m*v)),t[13]=i*(v*z-w*I)-x*(n*z-a*I)+M*(n*w-a*v),t[14]=-(i*(p*z-m*I)-h*(n*z-a*I)+M*(n*m-a*p)),t[15]=i*(p*w-m*v)-h*(n*w-a*v)+x*(n*m-a*p),t},ut.determinant=function(t){var e=t[0],i=t[1],n=t[2],a=t[3],l=t[4],h=t[5],p=t[6],m=t[7],g=t[8],x=t[9],v=t[10],w=t[11],E=t[12],M=t[13],I=t[14],z=t[15];return(e*h-i*l)*(v*z-w*I)-(e*p-n*l)*(x*z-w*M)+(e*m-a*l)*(x*I-v*M)+(i*p-n*h)*(g*z-w*E)-(i*m-a*h)*(g*I-v*E)+(n*m-a*p)*(g*M-x*E)},ut.multiply=Wn,ut.translate=function(t,e,i){var n,a,l,h,p,m,g,x,v,w,E,M,I=i[0],z=i[1],D=i[2];return e===t?(t[12]=e[0]*I+e[4]*z+e[8]*D+e[12],t[13]=e[1]*I+e[5]*z+e[9]*D+e[13],t[14]=e[2]*I+e[6]*z+e[10]*D+e[14],t[15]=e[3]*I+e[7]*z+e[11]*D+e[15]):(a=e[1],l=e[2],h=e[3],p=e[4],m=e[5],g=e[6],x=e[7],v=e[8],w=e[9],E=e[10],M=e[11],t[0]=n=e[0],t[1]=a,t[2]=l,t[3]=h,t[4]=p,t[5]=m,t[6]=g,t[7]=x,t[8]=v,t[9]=w,t[10]=E,t[11]=M,t[12]=n*I+p*z+v*D+e[12],t[13]=a*I+m*z+w*D+e[13],t[14]=l*I+g*z+E*D+e[14],t[15]=h*I+x*z+M*D+e[15]),t},ut.scale=function(t,e,i){var n=i[0],a=i[1],l=i[2];return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*a,t[5]=e[5]*a,t[6]=e[6]*a,t[7]=e[7]*a,t[8]=e[8]*l,t[9]=e[9]*l,t[10]=e[10]*l,t[11]=e[11]*l,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}
1,ut.rotate=function(t,e,i,n){var a,l,h,p,m,g,x,v,w,E,M,I,z,D,F,j,V,X,q,J,ee,oe,fe,le,ge=n[0],_e=n[1],me=n[2],Ee=Math.hypot(ge,_e,me);return Ee<vi.EPSILON?null:(ge*=Ee=1/Ee,_e*=Ee,me*=Ee,a=Math.sin(i),l=Math.cos(i),m=e[1],g=e[2],x=e[3],w=e[5],E=e[6],M=e[7],z=e[9],D=e[10],F=e[11],j=ge*ge*(h=1-l)+l,q=ge*_e*h-me*a,J=_e*_e*h+l,ee=me*_e*h+ge*a,oe=ge*me*h+_e*a,fe=_e*me*h-ge*a,le=me*me*h+l,t[0]=(p=e[0])*j+(v=e[4])*(V=_e*ge*h+me*a)+(I=e[8])*(X=me*ge*h-_e*a),t[1]=m*j+w*V+z*X,t[2]=g*j+E*V+D*X,t[3]=x*j+M*V+F*X,t[4]=p*q+v*J+I*ee,t[5]=m*q+w*J+z*ee,t[6]=g*q+E*J+D*ee,t[7]=x*q+M*J+F*ee,t[8]=p*oe+v*fe+I*le,t[9]=m*oe+w*fe+z*le,t[10]=g*oe+E*fe+D*le,t[11]=x*oe+M*fe+F*le,e!==t&&(t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t)},ut.rotateX=function(t,e,i){var n=Math.sin(i),a=Math.cos(i),l=e[4],h=e[5],p=e[6],m=e[7],g=e[8],x=e[9],v=e[10],w=e[11];return e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=l*a+g*n,t[5]=h*a+x*n,t[6]=p*a+v*n,t[7]=m*a+w*n,t[8]=g*a-l*n,t[9]=x*a-h*n,t[10]=v*a-p*n,t[11]=w*a-m*n,t},ut.rotateY=function(t,e,i){var n=Math.sin(i),a=Math.cos(i),l=e[0],h=e[1],p=e[2],m=e[3],g=e[8],x=e[9],v=e[10],w=e[11];return e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=l*a-g*n,t[1]=h*a-x*n,t[2]=p*a-v*n,t[3]=m*a-w*n,t[8]=l*n+g*a,t[9]=h*n+x*a,t[10]=p*n+v*a,t[11]=m*n+w*a,t},ut.rotateZ=function(t,e,i){var n=Math.sin(i),a=Math.cos(i),l=e[0],h=e[1],p=e[2],m=e[3],g=e[4],x=e[5],v=e[6],w=e[7];return e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=l*a+g*n,t[1]=h*a+x*n,t[2]=p*a+v*n,t[3]=m*a+w*n,t[4]=g*a-l*n,t[5]=x*a-h*n,t[6]=v*a-p*n,t[7]=w*a-m*n,t},ut.fromTranslation=function(t,e){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=e[0],t[13]=e[1],t[14]=e[2],t[15]=1,t},ut.fromScaling=function(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e[1],t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e[2],t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},ut.fromRotation=function(t,e,i){var n,a,l,h=i[0],p=i[1],m=i[2],g=Math.hypot(h,p,m);return g<vi.EPSILON?null:(h*=g=1/g,p*=g,m*=g,n=Math.sin(e),a=Math.cos(e),t[0]=h*h*(l=1-a)+a,t[1]=p*h*l+m*n,t[2]=m*h*l-p*n,t[3]=0,t[4]=h*p*l-m*n,t[5]=p*p*l+a,t[6]=m*p*l+h*n,t[7]=0,t[8]=h*m*l+p*n,t[9]=p*m*l-h*n,t[10]=m*m*l+a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t)},ut.fromXRotation=function(t,e){var i=Math.sin(e),n=Math.cos(e);return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=n,t[6]=i,t[7]=0,t[8]=0,t[9]=-i,t[10]=n,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},ut.fromYRotation=function(t,e){var i=Math.sin(e),n=Math.cos(e);return t[0]=n,t[1]=0,t[2]=-i,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=i,t[9]=0,t[10]=n,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},ut.fromZRotation=function(t,e){var i=Math.sin(e),n=Math.cos(e);return t[0]=n,t[1]=i,t[2]=0,t[3]=0,t[4]=-i,t[5]=n,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},ut.fromRotationTranslation=Qn,ut.fromQuat2=function(t,e){var i=new vi.ARRAY_TYPE(3),n=-e[0],a=-e[1],l=-e[2],h=e[3],p=e[4],m=e[5],g=e[6],x=e[7],v=n*n+a*a+l*l+h*h;return v>0?(i[0]=2*(p*h+x*n+m*l-g*a)/v,i[1]=2*(m*h+x*a+g*n-p*l)/v,i[2]=2*(g*h+x*l+p*a-m*n)/v):(i[0]=2*(p*h+x*n+m*l-g*a),i[1]=2*(m*h+x*a+g*n-p*l),i[2]=2*(g*h+x*l+p*a-m*n)),Qn(t,e,i),t},ut.getTranslation=function(t,e){return t[0]=e[12],t[1]=e[13],t[2]=e[14],t},ut.getScaling=No,ut.getRotation=function(t,e){var i=new vi.ARRAY_TYPE(3);No(i,e);var n=1/i[0],a=1/i[1],l=1/i[2],h=e[0]*n,p=e[1]*a,m=e[2]*l,g=e[4]*n,x=e[5]*a,v=e[6]*l,w=e[8]*n,E=e[9]*a,M=e[10]*l,I=h+x+M,z=0;return I>0?(z=2*Math.sqrt(I+1),t[3]=.25*z,t[0]=(v-E)/z,t[1]=(w-m)/z,t[2]=(p-g)/z):h>x&&h>M?(z=2*Math.sqrt(1+h-x-M),t[3]=(v-E)/z,t[0]=.25*z,t[1]=(p+g)/z,t[2]=(w+m)/z):x>M?(z=2*Math.sqrt(1+x-h-M),t[3]=(w-m)/z,t[0]=(p+g)/z,t[1]=.25*z,t[2]=(v+E)/z):(z=2*Math.sqrt(1+M-h-x),t[3]=(p-g)/z,t[0]=(w+m)/z,t[1]=(v+E)/z,t[2]=.25*z),t},ut.fromRotationTranslationScale=function(t,e,i,n){var a=e[0],l=e[1],h=e[2],p=e[3],m=a+a,g=l+l,x=h+h,v=a*m,w=a*g,E=a*x,M=l*g,I=l*x,z=h*x,D=p*m,F=p*g,j=p*x,V=n[0],X=n[1],q=n[2];return t[0]=(1-(M+z))*V,t[1]=(w+j)*V,t[2]=(E-F)*V,t[3]=0,t[4]=(w-j)*X,t[5]=(1-(v+z))*X,t[6]=(I+D)*X,t[7]=0,t[8]=(E+F)*q,t[9]=(I-D)*q,t[10]=(1-(v+M))*q,t[11]=0,t[12]=i[0],t[13]=i[1],t[14]=i[2],t[15]=1,t}
1,ut.fromRotationTranslationScaleOrigin=function(t,e,i,n,a){var l=e[0],h=e[1],p=e[2],m=e[3],g=l+l,x=h+h,v=p+p,w=l*g,E=l*x,M=l*v,I=h*x,z=h*v,D=p*v,F=m*g,j=m*x,V=m*v,X=n[0],q=n[1],J=n[2],ee=a[0],oe=a[1],fe=a[2],le=(1-(I+D))*X,ge=(E+V)*X,_e=(M-j)*X,me=(E-V)*q,Ee=(1-(w+D))*q,we=(z+F)*q,Ce=(M+j)*J,Ae=(z-F)*J,ye=(1-(w+I))*J;return t[0]=le,t[1]=ge,t[2]=_e,t[3]=0,t[4]=me,t[5]=Ee,t[6]=we,t[7]=0,t[8]=Ce,t[9]=Ae,t[10]=ye,t[11]=0,t[12]=i[0]+ee-(le*ee+me*oe+Ce*fe),t[13]=i[1]+oe-(ge*ee+Ee*oe+Ae*fe),t[14]=i[2]+fe-(_e*ee+we*oe+ye*fe),t[15]=1,t},ut.fromQuat=function(t,e){var i=e[0],n=e[1],a=e[2],l=e[3],h=i+i,p=n+n,m=a+a,g=i*h,x=n*h,v=n*p,w=a*h,E=a*p,M=a*m,I=l*h,z=l*p,D=l*m;return t[0]=1-v-M,t[1]=x+D,t[2]=w-z,t[3]=0,t[4]=x-D,t[5]=1-g-M,t[6]=E+I,t[7]=0,t[8]=w+z,t[9]=E-I,t[10]=1-g-v,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},ut.frustum=function(t,e,i,n,a,l,h){var p=1/(i-e),m=1/(a-n),g=1/(l-h);return t[0]=2*l*p,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=2*l*m,t[6]=0,t[7]=0,t[8]=(i+e)*p,t[9]=(a+n)*m,t[10]=(h+l)*g,t[11]=-1,t[12]=0,t[13]=0,t[14]=h*l*2*g,t[15]=0,t},ut.perspectiveNO=Zs,ut.perspectiveZO=function(t,e,i,n,a){var l,h=1/Math.tan(e/2);return t[0]=h/i,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=h,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,a!=null&&a!==1/0?(t[10]=a*(l=1/(n-a)),t[14]=a*n*l):(t[10]=-1,t[14]=-n),t},ut.perspectiveFromFieldOfView=function(t,e,i,n){var a=Math.tan(e.upDegrees*Math.PI/180),l=Math.tan(e.downDegrees*Math.PI/180),h=Math.tan(e.leftDegrees*Math.PI/180),p=Math.tan(e.rightDegrees*Math.PI/180),m=2/(h+p),g=2/(a+l);return t[0]=m,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=g,t[6]=0,t[7]=0,t[8]=-(h-p)*m*.5,t[9]=(a-l)*g*.5,t[10]=n/(i-n),t[11]=-1,t[12]=0,t[13]=0,t[14]=n*i/(i-n),t[15]=0,t},ut.orthoNO=Ui,ut.orthoZO=function(t,e,i,n,a,l,h){var p=1/(e-i),m=1/(n-a),g=1/(l-h);return t[0]=-2*p,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*m,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=g,t[11]=0,t[12]=(e+i)*p,t[13]=(a+n)*m,t[14]=l*g,t[15]=1,t},ut.lookAt=function(t,e,i,n){var a,l,h,p,m,g,x,v,w,E,M=e[0],I=e[1],z=e[2],D=n[0],F=n[1],j=n[2],V=i[0],X=i[1],q=i[2];return Math.abs(M-V)<vi.EPSILON&&Math.abs(I-X)<vi.EPSILON&&Math.abs(z-q)<vi.EPSILON?qs(t):(x=M-V,v=I-X,w=z-q,a=F*(w*=E=1/Math.hypot(x,v,w))-j*(v*=E),l=j*(x*=E)-D*w,h=D*v-F*x,(E=Math.hypot(a,l,h))?(a*=E=1/E,l*=E,h*=E):(a=0,l=0,h=0),p=v*h-w*l,m=w*a-x*h,g=x*l-v*a,(E=Math.hypot(p,m,g))?(p*=E=1/E,m*=E,g*=E):(p=0,m=0,g=0),t[0]=a,t[1]=p,t[2]=x,t[3]=0,t[4]=l,t[5]=m,t[6]=v,t[7]=0,t[8]=h,t[9]=g,t[10]=w,t[11]=0,t[12]=-(a*M+l*I+h*z),t[13]=-(p*M+m*I+g*z),t[14]=-(x*M+v*I+w*z),t[15]=1,t)},ut.targetTo=function(t,e,i,n){var a=e[0],l=e[1],h=e[2],p=n[0],m=n[1],g=n[2],x=a-i[0],v=l-i[1],w=h-i[2],E=x*x+v*v+w*w;E>0&&(x*=E=1/Math.sqrt(E),v*=E,w*=E);var M=m*w-g*v,I=g*x-p*w,z=p*v-m*x;return(E=M*M+I*I+z*z)>0&&(M*=E=1/Math.sqrt(E),I*=E,z*=E),t[0]=M,t[1]=I,t[2]=z,t[3]=0,t[4]=v*z-w*I,t[5]=w*M-x*z,t[6]=x*I-v*M,t[7]=0,t[8]=x,t[9]=v,t[10]=w,t[11]=0,t[12]=a,t[13]=l,t[14]=h,t[15]=1,t},ut.str=function(t){return"mat4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+", "+t[9]+", "+t[10]+", "+t[11]+", "+t[12]+", "+t[13]+", "+t[14]+", "+t[15]+")"},ut.frob=function(t){return Math.hypot(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8],t[9],t[10],t[11],t[12],t[13],t[14],t[15])},ut.add=function(t,e,i){return t[0]=e[0]+i[0],t[1]=e[1]+i[1],t[2]=e[2]+i[2],t[3]=e[3]+i[3],t[4]=e[4]+i[4],t[5]=e[5]+i[5],t[6]=e[6]+i[6],t[7]=e[7]+i[7],t[8]=e[8]+i[8],t[9]=e[9]+i[9],t[10]=e[10]+i[10],t[11]=e[11]+i[11],t[12]=e[12]+i[12],t[13]=e[13]+i[13],t[14]=e[14]+i[14],t[15]=e[15]+i[15],t},ut.subtract=Ha,ut.multiplyScalar=function(t,e,i){return t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t[3]=e[3]*i,t[4]=e[4]*i,t[5]=e[5]*i,t[6]=e[6]*i,t[7]=e[7]*i,t[8]=e[8]*i,t[9]=e[9]*i,t[10]=e[10]*i,t[11]=e[11]*i,t[12]=e[12]*i,t[13]=e[13]*i,t[14]=e[14]*i,t[15]=e[15]*i,t},ut.multiplyScalarAndAdd=function(t,e,i,n){return t[0]=e[0]+i[0]*n,t[1]=e[1]+i[1]*n,t[2]=e[2]+i[2]*n,t[3]=e[3]+i[3]*n,t[4]=e[4]+i[4]*n,t[5]=e[5]+i[5]*n,t[6]=e[6]+i[6]*n,t[7]=e[7]+i[7]*n,t[8]=e[8]+i[8]*n,t[9]=e[9]+i[9]*n,t[10]=e[10]+i[10]*n,t[11]=e[11]+i[11]*n,t[12]=e[12]+i[12]*n,t[13]=e[13]+i[13]*n,t[14]=e[14]+i[14]*n,t[15]=e[15]+i[15]*n,t},ut.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]&&t[8]===e[8]&&t[9]===e[9]&&t[10]===e[10]&&t[11]===e[11]&&t[12]===e[12]&&t[13]===e[13]&&t[14]===e[14]&&t[15]===e[15]},ut.equals=function(t,e){var i=t[0],n=t[1],a=t[2],l=t[3],h=t[4],p=t[5],m=t[6],g=t[7],x=t[8],v=t[9],w=t[10],E=t[11],M=t[12],I=t[13],z=t[14],D=t[15],F=e[0],j=e[1],V=e[2],X=e[3],q=e[4],J=e[5],ee=e[6],oe=e[7],fe=e[8],le=e[9],ge=e[10],_e=e[11],me=e[12],Ee=e[13],we=e[14],Ce=e[15];return Math.abs(i-F)<=vi.EPSILON*Math.max(1,Math.abs(i),Math.abs(F))&&Math.abs(n-j)<=vi.EPSILON*Math.max(1,Math.abs(n),Math.abs(j))&&Math.abs(a-V)<=vi.EPSILON*Math.max(1,Math.abs(a),Math.abs(V))&&Math.abs(l-X)<=vi.EPSILON*Math.max(1,Math.abs(l),Math.abs(X))&&Math.abs(h-q)<=vi.EPSILON*Math.max(1,Math.abs(h),Math.abs(q))&&Math.abs(p-J)<=vi.EPSILON*Math.max(1,Math.abs(p),Math.abs(J))&&Math.abs(m-ee)<=vi.EPSILON*Math.max(1,Math.abs(m),Math.abs(ee))&&Math.abs(g-oe)<=vi.EPSILON*Math.max(1,Math.abs(g),Math.abs(oe))&&Math.abs(x-fe)<=vi.EPSILON*Math.max(1,Math.abs(x),Math.abs(fe))&&Math.abs(v-le)<=vi.EPSILON*Math.max(1,Math.abs(v),Math.abs(le))&&Math.abs(w-ge)<=vi.EPSILON*Math.max(1,Math.abs(w),Math.abs(ge))&&Math.abs(E-_e)<=vi.EPSILON*Math.max(1,Math.abs(E),Math.abs(_e))&&Math.abs(M-me)<=vi.EPSILON*Math.max(1,Math.abs(M),Math.abs(me))&&Math.abs(I-Ee)<=vi.EPSILON*Math.max(1,Math.abs(I),Math.abs(Ee))&&Math.abs(z-we)<=vi.EPSILON*Math.max(1,Math.abs(z),Math.abs(we))&&Math.abs(D-Ce)<=vi.EPSILON*Math.max(1,Math.abs(D),Math.abs(Ce))},ut.sub=ut.mul=ut.ortho=ut.perspective=void 0;var vi=function(t,e){if(t&&t.__esModule)return t;if(t===null||ds(t)!=="object"&&typeof t!="function")return{default:t};var i=Fo(void 0);if(i&&i.has(t))return i.get(t);var n={},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in t)if(l!=="default"&&Object.prototype.hasOwnProperty.call(t,l)){var h=a?Object.getOwnPropertyDescriptor(t,l):null;h&&(h.get||h.set)?Object.defineProperty(n,l,h):n[l]=t[l]}return n.default=t,i&&i.set(t,n),n}(Ri);function Fo(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,i=new WeakMap;return(Fo=function(n){return n?i:e})(t)}function qs(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function Wn(t,e,i){var n=e[0],a=e[1],l=e[2],h=e[3],p=e[4],m=e[5],g=e[6],x=e[7],v=e[8],w=e[9],E=e[10],M=e[11],I=e[12],z=e[13],D=e[14],F=e[15],j=i[0],V=i[1],X=i[2],q=i[3];return t[0]=j*n+V*p+X*v+q*I,t[1]=j*a+V*m+X*w+q*z,t[2]=j*l+V*g+X*E+q*D,t[3]=j*h+V*x+X*M+q*F,t[4]=(j=i[4])*n+(V=i[5])*p+(X=i[6])*v+(q=i[7])*I,t[5]=j*a+V*m+X*w+q*z,t[6]=j*l+V*g+X*E+q*D,t[7]=j*h+V*x+X*M+q*F,t[8]=(j=i[8])*n+(V=i[9])*p+(X=i[10])*v+(q=i[11])*I,t[9]=j*a+V*m+X*w+q*z,t[10]=j*l+V*g+X*E+q*D,t[11]=j*h+V*x+X*M+q*F,t[12]=(j=i[12])*n+(V=i[13])*p+(X=i[14])*v+(q=i[15])*I,t[13]=j*a+V*m+X*w+q*z,t[14]=j*l+V*g+X*E+q*D,t[15]=j*h+V*x+X*M+q*F,t}function Qn(t,e,i){var n=e[0],a=e[1],l=e[2],h=e[3],p=n+n,m=a+a,g=l+l,x=n*p,v=n*m,w=n*g,E=a*m,M=a*g,I=l*g,z=h*p,D=h*m,F=h*g;return t[0]=1-(E+I),t[1]=v+F,t[2]=w-D,t[3]=0,t[4]=v-F,t[5]=1-(x+I),t[6]=M+z,t[7]=0,t[8]=w+D,t[9]=M-z,t[10]=1-(x+E),t[11]=0,t[12]=i[0],t[13]=i[1],t[14]=i[2],t[15]=1,t}function No(t,e){var i=e[4],n=e[5],a=e[6],l=e[8],h=e[9],p=e[10];return t[0]=Math.hypot(e[0],e[1],e[2]),t[1]=Math.hypot(i,n,a),t[2]=Math.hypot(l,h,p),t}function Zs(t,e,i,n,a){var l,h=1/Math.tan(e/2);return t[0]=h/i,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=h,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,a!=null&&a!==1/0?(t[10]=(a+n)*(l=1/(n-a)),t[14]=2*a*n*l):(t[10]=-1,t[14]=-2*n),t}
vendor: 4,126 bytes, line 1
1function Ui(t,e,i,n,a,l,h){var p=1/(e-i),m=1/(n-a),g=1/(l-h);return t[0]=-2*p,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*m,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*g,t[11]=0,t[12]=(e+i)*p,t[13]=(a+n)*m,t[14]=(h+l)*g,t[15]=1,t}function Ha(t,e,i){return t[0]=e[0]-i[0],t[1]=e[1]-i[1],t[2]=e[2]-i[2],t[3]=e[3]-i[3],t[4]=e[4]-i[4],t[5]=e[5]-i[5],t[6]=e[6]-i[6],t[7]=e[7]-i[7],t[8]=e[8]-i[8],t[9]=e[9]-i[9],t[10]=e[10]-i[10],t[11]=e[11]-i[11],t[12]=e[12]-i[12],t[13]=e[13]-i[13],t[14]=e[14]-i[14],t[15]=e[15]-i[15],t}ut.perspective=Zs,ut.ortho=Ui,ut.mul=Wn,ut.sub=Ha;var mt={},dt={};function Vo(t){return Vo=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Vo(t)}Object.defineProperty(dt,"__esModule",{value:!0}),dt.create=G,dt.clone=function(t){var e=new jr.ARRAY_TYPE(3);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e},dt.length=H,dt.fromValues=function(t,e,i){var n=new jr.ARRAY_TYPE(3);return n[0]=t,n[1]=e,n[2]=i,n},dt.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t},dt.set=function(t,e,i,n){return t[0]=e,t[1]=i,t[2]=n,t},dt.add=function(t,e,i){return t[0]=e[0]+i[0],t[1]=e[1]+i[1],t[2]=e[2]+i[2],t},dt.subtract=ne,dt.multiply=Se,dt.divide=Ie,dt.ceil=function(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t[2]=Math.ceil(e[2]),t},dt.floor=function(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t[2]=Math.floor(e[2]),t},dt.min=function(t,e,i){return t[0]=Math.min(e[0],i[0]),t[1]=Math.min(e[1],i[1]),t[2]=Math.min(e[2],i[2]),t},dt.max=function(t,e,i){return t[0]=Math.max(e[0],i[0]),t[1]=Math.max(e[1],i[1]),t[2]=Math.max(e[2],i[2]),t},dt.round=function(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t[2]=Math.round(e[2]),t},dt.scale=function(t,e,i){return t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t},dt.scaleAndAdd=function(t,e,i,n){return t[0]=e[0]+i[0]*n,t[1]=e[1]+i[1]*n,t[2]=e[2]+i[2]*n,t},dt.distance=Le,dt.squaredDistance=tt,dt.squaredLength=Te,dt.negate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t},dt.inverse=function(t,e){return t[0]=1/e[0],t[1]=1/e[1],t[2]=1/e[2],t},dt.normalize=function(t,e){var i=e[0],n=e[1],a=e[2],l=i*i+n*n+a*a;return l>0&&(l=1/Math.sqrt(l)),t[0]=e[0]*l,t[1]=e[1]*l,t[2]=e[2]*l,t},dt.dot=He,dt.cross=function(t,e,i){var n=e[0],a=e[1],l=e[2],h=i[0],p=i[1],m=i[2];return t[0]=a*m-l*p,t[1]=l*h-n*m,t[2]=n*p-a*h,t},dt.lerp=function(t,e,i,n){var a=e[0],l=e[1],h=e[2];return t[0]=a+n*(i[0]-a),t[1]=l+n*(i[1]-l),t[2]=h+n*(i[2]-h),t},dt.hermite=function(t,e,i,n,a,l){var h=l*l,p=h*(2*l-3)+1,m=h*(l-2)+l,g=h*(l-1),x=h*(3-2*l);return t[0]=e[0]*p+i[0]*m+n[0]*g+a[0]*x,t[1]=e[1]*p+i[1]*m+n[1]*g+a[1]*x,t[2]=e[2]*p+i[2]*m+n[2]*g+a[2]*x,t},dt.bezier=function(t,e,i,n,a,l){var h=1-l,p=h*h,m=l*l,g=p*h,x=3*l*p,v=3*m*h,w=m*l;return t[0]=e[0]*g+i[0]*x+n[0]*v+a[0]*w,t[1]=e[1]*g+i[1]*x+n[1]*v+a[1]*w,t[2]=e[2]*g+i[2]*x+n[2]*v+a[2]*w,t},dt.random=function(t,e){e=e||1;var i=2*jr.RANDOM()*Math.PI,n=2*jr.RANDOM()-1,a=Math.sqrt(1-n*n)*e;return t[0]=Math.cos(i)*a,t[1]=Math.sin(i)*a,t[2]=n*e,t},dt.transformMat4=function(t,e,i){var n=e[0],a=e[1],l=e[2],h=i[3]*n+i[7]*a+i[11]*l+i[15];return t[0]=(i[0]*n+i[4]*a+i[8]*l+i[12])/(h=h||1),t[1]=(i[1]*n+i[5]*a+i[9]*l+i[13])/h,t[2]=(i[2]*n+i[6]*a+i[10]*l+i[14])/h,t},dt.transformMat3=function(t,e,i){var n=e[0],a=e[1],l=e[2];return t[0]=n*i[0]+a*i[3]+l*i[6],t[1]=n*i[1]+a*i[4]+l*i[7],t[2]=n*i[2]+a*i[5]+l*i[8],t},dt.transformQuat=function(t,e,i){var n=i[0],a=i[1],l=i[2],h=e[0],p=e[1],m=e[2],g=a*m-l*p,x=l*h-n*m,v=n*p-a*h,w=a*v-l*x,E=l*g-n*v,M=n*x-a*g,I=2*i[3];return x*=I,v*=I,E*=2,M*=2,t[0]=h+(g*=I)+(w*=2),t[1]=p+x+E,t[2]=m+v+M,t},dt.rotateX=function(t,e,i,n){var a=[],l=[];return a[0]=e[0]-i[0],a[1]=e[1]-i[1],a[2]=e[2]-i[2],l[0]=a[0],l[1]=a[1]*Math.cos(n)-a[2]*Math.sin(n),l[2]=a[1]*Math.sin(n)+a[2]*Math.cos(n),t[0]=l[0]+i[0],t[1]=l[1]+i[1],t[2]=l[2]+i[2],t},dt.rotateY=function(t,e,i,n){var a=[],l=[];return a[0]=e[0]-i[0],a[1]=e[1]-i[1],a[2]=e[2]-i[2],l[0]=a[2]*Math.sin(n)+a[0]*Math.cos(n),l[1]=a[1],l[2]=a[2]*Math.cos(n)-a[0]*Math.sin(n),t[0]=l[0]+i[0],t[1]=l[1]+i[1],t[2]=l[2]+i[2],t}
1,dt.rotateZ=function(t,e,i,n){var a=[],l=[];return a[0]=e[0]-i[0],a[1]=e[1]-i[1],a[2]=e[2]-i[2],l[0]=a[0]*Math.cos(n)-a[1]*Math.sin(n),l[1]=a[0]*Math.sin(n)+a[1]*Math.cos(n),l[2]=a[2],t[0]=l[0]+i[0],t[1]=l[1]+i[1],t[2]=l[2]+i[2],t},dt.angle=function(t,e){var i=t[0],n=t[1],a=t[2],l=e[0],h=e[1],p=e[2],m=Math.sqrt(i*i+n*n+a*a)*Math.sqrt(l*l+h*h+p*p),g=m&&He(t,e)/m;return Math.acos(Math.min(Math.max(g,-1),1))},dt.zero=function(t){return t[0]=0,t[1]=0,t[2]=0,t},dt.str=function(t){return"vec3("+t[0]+", "+t[1]+", "+t[2]+")"},dt.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]},dt.equals=function(t,e){var i=t[0],n=t[1],a=t[2],l=e[0],h=e[1],p=e[2];return Math.abs(i-l)<=jr.EPSILON*Math.max(1,Math.abs(i),Math.abs(l))&&Math.abs(n-h)<=jr.EPSILON*Math.max(1,Math.abs(n),Math.abs(h))&&Math.abs(a-p)<=jr.EPSILON*Math.max(1,Math.abs(a),Math.abs(p))},dt.forEach=dt.sqrLen=dt.len=dt.sqrDist=dt.dist=dt.div=dt.mul=dt.sub=void 0;var jr=function(t,e){if(t&&t.__esModule)return t;if(t===null||Vo(t)!=="object"&&typeof t!="function")return{default:t};var i=Re(void 0);if(i&&i.has(t))return i.get(t);var n={},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in t)if(l!=="default"&&Object.prototype.hasOwnProperty.call(t,l)){var h=a?Object.getOwnPropertyDescriptor(t,l):null;h&&(h.get||h.set)?Object.defineProperty(n,l,h):n[l]=t[l]}return n.default=t,i&&i.set(t,n),n}(Ri);function Re(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,i=new WeakMap;return(Re=function(n){return n?i:e})(t)}function G(){var t=new jr.ARRAY_TYPE(3);return jr.ARRAY_TYPE!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function H(t){return Math.hypot(t[0],t[1],t[2])}function ne(t,e,i){return t[0]=e[0]-i[0],t[1]=e[1]-i[1],t[2]=e[2]-i[2],t}function Se(t,e,i){return t[0]=e[0]*i[0],t[1]=e[1]*i[1],t[2]=e[2]*i[2],t}function Ie(t,e,i){return t[0]=e[0]/i[0],t[1]=e[1]/i[1],t[2]=e[2]/i[2],t}function Le(t,e){return Math.hypot(e[0]-t[0],e[1]-t[1],e[2]-t[2])}function tt(t,e){var i=e[0]-t[0],n=e[1]-t[1],a=e[2]-t[2];return i*i+n*n+a*a}function Te(t){var e=t[0],i=t[1],n=t[2];return e*e+i*i+n*n}function He(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}dt.sub=ne,dt.mul=Se,dt.div=Ie,dt.dist=Le,dt.sqrDist=tt,dt.len=H,dt.sqrLen=Te;var Ke,st=(Ke=G(),function(t,e,i,n,a,l){var h,p;for(e||(e=3),i||(i=0),p=n?Math.min(n*e+i,t.length):t.length,h=i;h<p;h+=e)Ke[0]=t[h],Ke[1]=t[h+1],Ke[2]=t[h+2],a(Ke,Ke,l),t[h]=Ke[0],t[h+1]=Ke[1],t[h+2]=Ke[2];return t});dt.forEach=st;var qe={};function ai(t){return ai=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ai(t)}Object.defineProperty(qe,"__esModule",{value:!0}),qe.create=Kt,qe.clone=function(t){var e=new Jt.ARRAY_TYPE(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e},qe.fromValues=function(t,e,i,n){var a=new Jt.ARRAY_TYPE(4);return a[0]=t,a[1]=e,a[2]=i,a[3]=n,a},qe.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t},qe.set=function(t,e,i,n,a){return t[0]=e,t[1]=i,t[2]=n,t[3]=a,t},qe.add=function(t,e,i){return t[0]=e[0]+i[0],t[1]=e[1]+i[1],t[2]=e[2]+i[2],t[3]=e[3]+i[3],t},qe.subtract=ei,qe.multiply=li,qe.divide=Si,qe.ceil=function(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t[2]=Math.ceil(e[2]),t[3]=Math.ceil(e[3]),t},qe.floor=function(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t[2]=Math.floor(e[2]),t[3]=Math.floor(e[3]),t},qe.min=function(t,e,i){return t[0]=Math.min(e[0],i[0]),t[1]=Math.min(e[1],i[1]),t[2]=Math.min(e[2],i[2]),t[3]=Math.min(e[3],i[3]),t},qe.max=function(t,e,i){return t[0]=Math.max(e[0],i[0]),t[1]=Math.max(e[1],i[1]),t[2]=Math.max(e[2],i[2]),t[3]=Math.max(e[3],i[3]),t},qe.round=function(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t[2]=Math.round(e[2]),t[3]=Math.round(e[3]),t},qe.scale=function(t,e,i){return t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t[3]=e[3]*i,t},qe.scaleAndAdd=function(t,e,i,n){return t[0]=e[0]+i[0]*n,t[1]=e[1]+i[1]*n,t[2]=e[2]+i[2]*n,t[3]=e[3]+i[3]*n,t},qe.distance=Yi,qe.squaredDistance=xi,qe.length=gr,qe.squaredLength=dr,qe.negate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t},qe.inverse=function(t,e){return t[0]=1/e[0],t[1]=1/e[1],t[2]=1/e[2],t[3]=1/e[3],t},qe.normalize=function(t,e){var i=e[0],n=e[1],a=e[2],l=e[3],h=i*i+n*n+a*a+l*l;return h>0&&(h=1/Math.sqrt(h)),t[0]=i*h,t[1]=n*h,t[2]=a*h,t[3]=l*h,t},qe.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]}
1,qe.cross=function(t,e,i,n){var a=i[0]*n[1]-i[1]*n[0],l=i[0]*n[2]-i[2]*n[0],h=i[0]*n[3]-i[3]*n[0],p=i[1]*n[2]-i[2]*n[1],m=i[1]*n[3]-i[3]*n[1],g=i[2]*n[3]-i[3]*n[2],x=e[0],v=e[1],w=e[2],E=e[3];return t[0]=v*g-w*m+E*p,t[1]=-x*g+w*h-E*l,t[2]=x*m-v*h+E*a,t[3]=-x*p+v*l-w*a,t},qe.lerp=function(t,e,i,n){var a=e[0],l=e[1],h=e[2],p=e[3];return t[0]=a+n*(i[0]-a),t[1]=l+n*(i[1]-l),t[2]=h+n*(i[2]-h),t[3]=p+n*(i[3]-p),t},qe.random=function(t,e){var i,n,a,l,h,p;e=e||1;do h=(i=2*Jt.RANDOM()-1)*i+(n=2*Jt.RANDOM()-1)*n;while(h>=1);do p=(a=2*Jt.RANDOM()-1)*a+(l=2*Jt.RANDOM()-1)*l;while(p>=1);var m=Math.sqrt((1-h)/p);return t[0]=e*i,t[1]=e*n,t[2]=e*a*m,t[3]=e*l*m,t},qe.transformMat4=function(t,e,i){var n=e[0],a=e[1],l=e[2],h=e[3];return t[0]=i[0]*n+i[4]*a+i[8]*l+i[12]*h,t[1]=i[1]*n+i[5]*a+i[9]*l+i[13]*h,t[2]=i[2]*n+i[6]*a+i[10]*l+i[14]*h,t[3]=i[3]*n+i[7]*a+i[11]*l+i[15]*h,t},qe.transformQuat=function(t,e,i){var n=e[0],a=e[1],l=e[2],h=i[0],p=i[1],m=i[2],g=i[3],x=g*n+p*l-m*a,v=g*a+m*n-h*l,w=g*l+h*a-p*n,E=-h*n-p*a-m*l;return t[0]=x*g+E*-h+v*-m-w*-p,t[1]=v*g+E*-p+w*-h-x*-m,t[2]=w*g+E*-m+x*-p-v*-h,t[3]=e[3],t},qe.zero=function(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=0,t},qe.str=function(t){return"vec4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},qe.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]},qe.equals=function(t,e){var i=t[0],n=t[1],a=t[2],l=t[3],h=e[0],p=e[1],m=e[2],g=e[3];return Math.abs(i-h)<=Jt.EPSILON*Math.max(1,Math.abs(i),Math.abs(h))&&Math.abs(n-p)<=Jt.EPSILON*Math.max(1,Math.abs(n),Math.abs(p))&&Math.abs(a-m)<=Jt.EPSILON*Math.max(1,Math.abs(a),Math.abs(m))&&Math.abs(l-g)<=Jt.EPSILON*Math.max(1,Math.abs(l),Math.abs(g))},qe.forEach=qe.sqrLen=qe.len=qe.sqrDist=qe.dist=qe.div=qe.mul=qe.sub=void 0;var Jt=function(t,e){if(t&&t.__esModule)return t;if(t===null||ai(t)!=="object"&&typeof t!="function")return{default:t};var i=si(void 0);if(i&&i.has(t))return i.get(t);var n={},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in t)if(l!=="default"&&Object.prototype.hasOwnProperty.call(t,l)){var h=a?Object.getOwnPropertyDescriptor(t,l):null;h&&(h.get||h.set)?Object.defineProperty(n,l,h):n[l]=t[l]}return n.default=t,i&&i.set(t,n),n}(Ri);function si(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,i=new WeakMap;return(si=function(n){return n?i:e})(t)}function Kt(){var t=new Jt.ARRAY_TYPE(4);return Jt.ARRAY_TYPE!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t}function ei(t,e,i){return t[0]=e[0]-i[0],t[1]=e[1]-i[1],t[2]=e[2]-i[2],t[3]=e[3]-i[3],t}function li(t,e,i){return t[0]=e[0]*i[0],t[1]=e[1]*i[1],t[2]=e[2]*i[2],t[3]=e[3]*i[3],t}function Si(t,e,i){return t[0]=e[0]/i[0],t[1]=e[1]/i[1],t[2]=e[2]/i[2],t[3]=e[3]/i[3],t}function Yi(t,e){return Math.hypot(e[0]-t[0],e[1]-t[1],e[2]-t[2],e[3]-t[3])}function xi(t,e){var i=e[0]-t[0],n=e[1]-t[1],a=e[2]-t[2],l=e[3]-t[3];return i*i+n*n+a*a+l*l}function gr(t){return Math.hypot(t[0],t[1],t[2],t[3])}function dr(t){var e=t[0],i=t[1],n=t[2],a=t[3];return e*e+i*i+n*n+a*a}qe.sub=ei,qe.mul=li,qe.div=Si,qe.dist=Yi,qe.sqrDist=xi,qe.len=gr,qe.sqrLen=dr;var Jr=function(){var t=Kt();return function(e,i,n,a,l,h){var p,m;for(i||(i=4),n||(n=0),m=a?Math.min(a*i+n,e.length):e.length,p=n;p<m;p+=i)t[0]=e[p],t[1]=e[p+1],t[2]=e[p+2],t[3]=e[p+3],l(t,t,h),e[p]=t[0],e[p+1]=t[1],e[p+2]=t[2],e[p+3]=t[3];return e}}();function ji(t){return ji=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ji(t)}qe.forEach=Jr,Object.defineProperty(mt,"__esModule",{value:!0}),mt.create=Ue,mt.identity=function(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t},mt.setAxisAngle=je,mt.getAxisAngle=function(t,e){var i=2*Math.acos(e[3]),n=Math.sin(i/2);return n>Ai.EPSILON?(t[0]=e[0]/n,t[1]=e[1]/n,t[2]=e[2]/n):(t[0]=1,t[1]=0,t[2]=0),i},mt.getAngle=function(t,e){var i=ci(t,e);return Math.acos(2*i*i-1)},mt.multiply=Be,mt.rotateX=function(t,e,i){i*=.5;var n=e[0],a=e[1],l=e[2],h=e[3],p=Math.sin(i),m=Math.cos(i);return t[0]=n*m+h*p,t[1]=a*m+l*p,t[2]=l*m-a*p,t[3]=h*m-n*p,t}
1,mt.rotateY=function(t,e,i){i*=.5;var n=e[0],a=e[1],l=e[2],h=e[3],p=Math.sin(i),m=Math.cos(i);return t[0]=n*m-l*p,t[1]=a*m+h*p,t[2]=l*m+n*p,t[3]=h*m-a*p,t},mt.rotateZ=function(t,e,i){i*=.5;var n=e[0],a=e[1],l=e[2],h=e[3],p=Math.sin(i),m=Math.cos(i);return t[0]=n*m+a*p,t[1]=a*m-n*p,t[2]=l*m+h*p,t[3]=h*m-l*p,t},mt.calculateW=function(t,e){var i=e[0],n=e[1],a=e[2];return t[0]=i,t[1]=n,t[2]=a,t[3]=Math.sqrt(Math.abs(1-i*i-n*n-a*a)),t},mt.exp=Ze,mt.ln=Fe,mt.pow=function(t,e,i){return Fe(t,e),rt(t,t,i),Ze(t,t),t},mt.slerp=_t,mt.random=function(t){var e=Ai.RANDOM(),i=Ai.RANDOM(),n=Ai.RANDOM(),a=Math.sqrt(1-e),l=Math.sqrt(e);return t[0]=a*Math.sin(2*Math.PI*i),t[1]=a*Math.cos(2*Math.PI*i),t[2]=l*Math.sin(2*Math.PI*n),t[3]=l*Math.cos(2*Math.PI*n),t},mt.invert=function(t,e){var i=e[0],n=e[1],a=e[2],l=e[3],h=i*i+n*n+a*a+l*l,p=h?1/h:0;return t[0]=-i*p,t[1]=-n*p,t[2]=-a*p,t[3]=l*p,t},mt.conjugate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3],t},mt.fromMat3=Nt,mt.fromEuler=function(t,e,i,n){var a=.5*Math.PI/180;e*=a,i*=a,n*=a;var l=Math.sin(e),h=Math.cos(e),p=Math.sin(i),m=Math.cos(i),g=Math.sin(n),x=Math.cos(n);return t[0]=l*m*x-h*p*g,t[1]=h*p*x+l*m*g,t[2]=h*m*g-l*p*x,t[3]=h*m*x+l*p*g,t},mt.str=function(t){return"quat("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},mt.setAxes=mt.sqlerp=mt.rotationTo=mt.equals=mt.exactEquals=mt.normalize=mt.sqrLen=mt.squaredLength=mt.len=mt.length=mt.lerp=mt.dot=mt.scale=mt.mul=mt.add=mt.set=mt.copy=mt.fromValues=mt.clone=void 0;var Ai=ke(Ri),ve=ke(Yt),be=ke(dt),Pe=ke(qe);function Oe(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,i=new WeakMap;return(Oe=function(n){return n?i:e})(t)}function ke(t,e){if(t&&t.__esModule)return t;if(t===null||ji(t)!=="object"&&typeof t!="function")return{default:t};var i=Oe(e);if(i&&i.has(t))return i.get(t);var n={},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in t)if(l!=="default"&&Object.prototype.hasOwnProperty.call(t,l)){var h=a?Object.getOwnPropertyDescriptor(t,l):null;h&&(h.get||h.set)?Object.defineProperty(n,l,h):n[l]=t[l]}return n.default=t,i&&i.set(t,n),n}function Ue(){var t=new Ai.ARRAY_TYPE(4);return Ai.ARRAY_TYPE!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function je(t,e,i){i*=.5;var n=Math.sin(i);return t[0]=n*e[0],t[1]=n*e[1],t[2]=n*e[2],t[3]=Math.cos(i),t}function Be(t,e,i){var n=e[0],a=e[1],l=e[2],h=e[3],p=i[0],m=i[1],g=i[2],x=i[3];return t[0]=n*x+h*p+a*g-l*m,t[1]=a*x+h*m+l*p-n*g,t[2]=l*x+h*g+n*m-a*p,t[3]=h*x-n*p-a*m-l*g,t}function Ze(t,e){var i=e[0],n=e[1],a=e[2],l=e[3],h=Math.sqrt(i*i+n*n+a*a),p=Math.exp(l),m=h>0?p*Math.sin(h)/h:0;return t[0]=i*m,t[1]=n*m,t[2]=a*m,t[3]=p*Math.cos(h),t}function Fe(t,e){var i=e[0],n=e[1],a=e[2],l=e[3],h=Math.sqrt(i*i+n*n+a*a),p=h>0?Math.atan2(h,l)/h:0;return t[0]=i*p,t[1]=n*p,t[2]=a*p,t[3]=.5*Math.log(i*i+n*n+a*a+l*l),t}function _t(t,e,i,n){var a,l,h,p,m,g=e[0],x=e[1],v=e[2],w=e[3],E=i[0],M=i[1],I=i[2],z=i[3];return(l=g*E+x*M+v*I+w*z)<0&&(l=-l,E=-E,M=-M,I=-I,z=-z),1-l>Ai.EPSILON?(a=Math.acos(l),h=Math.sin(a),p=Math.sin((1-n)*a)/h,m=Math.sin(n*a)/h):(p=1-n,m=n),t[0]=p*g+m*E,t[1]=p*x+m*M,t[2]=p*v+m*I,t[3]=p*w+m*z,t}function Nt(t,e){var i,n=e[0]+e[4]+e[8];if(n>0)i=Math.sqrt(n+1),t[3]=.5*i,t[0]=(e[5]-e[7])*(i=.5/i),t[1]=(e[6]-e[2])*i,t[2]=(e[1]-e[3])*i;else{var a=0;e[4]>e[0]&&(a=1),e[8]>e[3*a+a]&&(a=2);var l=(a+1)%3,h=(a+2)%3;i=Math.sqrt(e[3*a+a]-e[3*l+l]-e[3*h+h]+1),t[a]=.5*i,t[3]=(e[3*l+h]-e[3*h+l])*(i=.5/i),t[l]=(e[3*l+a]+e[3*a+l])*i,t[h]=(e[3*h+a]+e[3*a+h])*i}return t}mt.clone=Pe.clone,mt.fromValues=Pe.fromValues,mt.copy=Pe.copy,mt.set=Pe.set,mt.add=Pe.add,mt.mul=Be;var rt=Pe.scale;mt.scale=rt;var ci=Pe.dot;mt.dot=ci,mt.lerp=Pe.lerp;var Ii=Pe.length;mt.length=Ii,mt.len=Ii;var pi=Pe.squaredLength;mt.squaredLength=pi,mt.sqrLen=pi;var Oi=Pe.normalize;mt.normalize=Oi,mt.exactEquals=Pe.exactEquals,mt.equals=Pe.equals;var zi,qt,Lr,Kr=(zi=be.create(),qt=be.fromValues(1,0,0),Lr=be.fromValues(0,1,0),function(t,e,i){var n=be.dot(e,i);return n<-.999999?(be.cross(zi,qt,e),be.len(zi)<1e-6&&be.cross(zi,Lr,e),be.normalize(zi,zi),je(t,zi,Math.PI),t):n>.999999?(t[0]=0,t[1]=0,t[2]=0,t[3]=1,t):(be.cross(zi,e,i),t[0]=zi[0],t[1]=zi[1],t[2]=zi[2],t[3]=1+n,Oi(t,t))});mt.rotationTo=Kr;
1var Ki,ps,Uo=(Ki=Ue(),ps=Ue(),function(t,e,i,n,a,l){return _t(Ki,e,a,l),_t(ps,i,n,l),_t(t,Ki,ps,2*l*(1-l)),t});mt.sqlerp=Uo;var yr,up=(yr=ve.create(),function(t,e,i,n){return yr[0]=i[0],yr[3]=i[1],yr[6]=i[2],yr[1]=n[0],yr[4]=n[1],yr[7]=n[2],yr[2]=-e[0],yr[5]=-e[1],yr[8]=-e[2],Oi(t,Nt(t,yr))});mt.setAxes=up;var Lt={};function xc(t){return xc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},xc(t)}Object.defineProperty(Lt,"__esModule",{value:!0}),Lt.create=function(){var t=new xr.ARRAY_TYPE(8);return xr.ARRAY_TYPE!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[4]=0,t[5]=0,t[6]=0,t[7]=0),t[3]=1,t},Lt.clone=function(t){var e=new xr.ARRAY_TYPE(8);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e},Lt.fromValues=function(t,e,i,n,a,l,h,p){var m=new xr.ARRAY_TYPE(8);return m[0]=t,m[1]=e,m[2]=i,m[3]=n,m[4]=a,m[5]=l,m[6]=h,m[7]=p,m},Lt.fromRotationTranslationValues=function(t,e,i,n,a,l,h){var p=new xr.ARRAY_TYPE(8);p[0]=t,p[1]=e,p[2]=i,p[3]=n;var m=.5*a,g=.5*l,x=.5*h;return p[4]=m*n+g*i-x*e,p[5]=g*n+x*t-m*i,p[6]=x*n+m*e-g*t,p[7]=-m*t-g*e-x*i,p},Lt.fromRotationTranslation=ih,Lt.fromTranslation=function(t,e){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t[4]=.5*e[0],t[5]=.5*e[1],t[6]=.5*e[2],t[7]=0,t},Lt.fromRotation=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=0,t[5]=0,t[6]=0,t[7]=0,t},Lt.fromMat4=function(t,e){var i=In.create();eh.getRotation(i,e);var n=new xr.ARRAY_TYPE(3);return eh.getTranslation(n,e),ih(t,i,n),t},Lt.copy=rh,Lt.identity=function(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t[6]=0,t[7]=0,t},Lt.set=function(t,e,i,n,a,l,h,p,m){return t[0]=e,t[1]=i,t[2]=n,t[3]=a,t[4]=l,t[5]=h,t[6]=p,t[7]=m,t},Lt.getDual=function(t,e){return t[0]=e[4],t[1]=e[5],t[2]=e[6],t[3]=e[7],t},Lt.setDual=function(t,e){return t[4]=e[0],t[5]=e[1],t[6]=e[2],t[7]=e[3],t},Lt.getTranslation=function(t,e){var i=e[4],n=e[5],a=e[6],l=e[7],h=-e[0],p=-e[1],m=-e[2],g=e[3];return t[0]=2*(i*g+l*h+n*m-a*p),t[1]=2*(n*g+l*p+a*h-i*m),t[2]=2*(a*g+l*m+i*p-n*h),t},Lt.translate=function(t,e,i){var n=e[0],a=e[1],l=e[2],h=e[3],p=.5*i[0],m=.5*i[1],g=.5*i[2],x=e[4],v=e[5],w=e[6],E=e[7];return t[0]=n,t[1]=a,t[2]=l,t[3]=h,t[4]=h*p+a*g-l*m+x,t[5]=h*m+l*p-n*g+v,t[6]=h*g+n*m-a*p+w,t[7]=-n*p-a*m-l*g+E,t},Lt.rotateX=function(t,e,i){var n=-e[0],a=-e[1],l=-e[2],h=e[3],p=e[4],m=e[5],g=e[6],x=e[7],v=p*h+x*n+m*l-g*a,w=m*h+x*a+g*n-p*l,E=g*h+x*l+p*a-m*n,M=x*h-p*n-m*a-g*l;return In.rotateX(t,e,i),t[4]=v*(h=t[3])+M*(n=t[0])+w*(l=t[2])-E*(a=t[1]),t[5]=w*h+M*a+E*n-v*l,t[6]=E*h+M*l+v*a-w*n,t[7]=M*h-v*n-w*a-E*l,t},Lt.rotateY=function(t,e,i){var n=-e[0],a=-e[1],l=-e[2],h=e[3],p=e[4],m=e[5],g=e[6],x=e[7],v=p*h+x*n+m*l-g*a,w=m*h+x*a+g*n-p*l,E=g*h+x*l+p*a-m*n,M=x*h-p*n-m*a-g*l;return In.rotateY(t,e,i),t[4]=v*(h=t[3])+M*(n=t[0])+w*(l=t[2])-E*(a=t[1]),t[5]=w*h+M*a+E*n-v*l,t[6]=E*h+M*l+v*a-w*n,t[7]=M*h-v*n-w*a-E*l,t},Lt.rotateZ=function(t,e,i){var n=-e[0],a=-e[1],l=-e[2],h=e[3],p=e[4],m=e[5],g=e[6],x=e[7],v=p*h+x*n+m*l-g*a,w=m*h+x*a+g*n-p*l,E=g*h+x*l+p*a-m*n,M=x*h-p*n-m*a-g*l;return In.rotateZ(t,e,i),t[4]=v*(h=t[3])+M*(n=t[0])+w*(l=t[2])-E*(a=t[1]),t[5]=w*h+M*a+E*n-v*l,t[6]=E*h+M*l+v*a-w*n,t[7]=M*h-v*n-w*a-E*l,t},Lt.rotateByQuatAppend=function(t,e,i){var n=i[0],a=i[1],l=i[2],h=i[3],p=e[0],m=e[1],g=e[2],x=e[3];return t[0]=p*h+x*n+m*l-g*a,t[1]=m*h+x*a+g*n-p*l,t[2]=g*h+x*l+p*a-m*n,t[3]=x*h-p*n-m*a-g*l,t[4]=(p=e[4])*h+(x=e[7])*n+(m=e[5])*l-(g=e[6])*a,t[5]=m*h+x*a+g*n-p*l,t[6]=g*h+x*l+p*a-m*n,t[7]=x*h-p*n-m*a-g*l,t},Lt.rotateByQuatPrepend=function(t,e,i){var n=e[0],a=e[1],l=e[2],h=e[3],p=i[0],m=i[1],g=i[2],x=i[3];return t[0]=n*x+h*p+a*g-l*m,t[1]=a*x+h*m+l*p-n*g,t[2]=l*x+h*g+n*m-a*p,t[3]=h*x-n*p-a*m-l*g,t[4]=n*(x=i[7])+h*(p=i[4])+a*(g=i[6])-l*(m=i[5]),t[5]=a*x+h*m+l*p-n*g,t[6]=l*x+h*g+n*m-a*p,t[7]=h*x-n*p-a*m-l*g,t},Lt.rotateAroundAxis=function(t,e,i,n){if(Math.abs(n)<xr.EPSILON)return rh(t,e);var a=Math.hypot(i[0],i[1],i[2]);n*=.5;var l=Math.sin(n),h=l*i[0]/a,p=l*i[1]/a,m=l*i[2]/a,g=Math.cos(n),x=e[0],v=e[1],w=e[2],E=e[3];t[0]=x*g+E*h+v*m-w*p,t[1]=v*g+E*p+w*h-x*m,t[2]=w*g+E*m+x*p-v*h,t[3]=E*g-x*h-v*p-w*m;var M=e[4],I=e[5],z=e[6],D=e[7];return t[4]=M*g+D*h+I*m-z*p,t[5]=I*g+D*p+z*h-M*m,t[6]=z*g+D*m+M*p-I*h,t[7]=D*g-M*h-I*p-z*m,t}
1,Lt.add=function(t,e,i){return t[0]=e[0]+i[0],t[1]=e[1]+i[1],t[2]=e[2]+i[2],t[3]=e[3]+i[3],t[4]=e[4]+i[4],t[5]=e[5]+i[5],t[6]=e[6]+i[6],t[7]=e[7]+i[7],t},Lt.multiply=nh,Lt.scale=function(t,e,i){return t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t[3]=e[3]*i,t[4]=e[4]*i,t[5]=e[5]*i,t[6]=e[6]*i,t[7]=e[7]*i,t},Lt.lerp=function(t,e,i,n){var a=1-n;return sh(e,i)<0&&(n=-n),t[0]=e[0]*a+i[0]*n,t[1]=e[1]*a+i[1]*n,t[2]=e[2]*a+i[2]*n,t[3]=e[3]*a+i[3]*n,t[4]=e[4]*a+i[4]*n,t[5]=e[5]*a+i[5]*n,t[6]=e[6]*a+i[6]*n,t[7]=e[7]*a+i[7]*n,t},Lt.invert=function(t,e){var i=Xa(e);return t[0]=-e[0]/i,t[1]=-e[1]/i,t[2]=-e[2]/i,t[3]=e[3]/i,t[4]=-e[4]/i,t[5]=-e[5]/i,t[6]=-e[6]/i,t[7]=e[7]/i,t},Lt.conjugate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3],t[4]=-e[4],t[5]=-e[5],t[6]=-e[6],t[7]=e[7],t},Lt.normalize=function(t,e){var i=Xa(e);if(i>0){i=Math.sqrt(i);var n=e[0]/i,a=e[1]/i,l=e[2]/i,h=e[3]/i,p=e[4],m=e[5],g=e[6],x=e[7],v=n*p+a*m+l*g+h*x;t[0]=n,t[1]=a,t[2]=l,t[3]=h,t[4]=(p-n*v)/i,t[5]=(m-a*v)/i,t[6]=(g-l*v)/i,t[7]=(x-h*v)/i}return t},Lt.str=function(t){return"quat2("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+")"},Lt.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]},Lt.equals=function(t,e){var i=t[0],n=t[1],a=t[2],l=t[3],h=t[4],p=t[5],m=t[6],g=t[7],x=e[0],v=e[1],w=e[2],E=e[3],M=e[4],I=e[5],z=e[6],D=e[7];return Math.abs(i-x)<=xr.EPSILON*Math.max(1,Math.abs(i),Math.abs(x))&&Math.abs(n-v)<=xr.EPSILON*Math.max(1,Math.abs(n),Math.abs(v))&&Math.abs(a-w)<=xr.EPSILON*Math.max(1,Math.abs(a),Math.abs(w))&&Math.abs(l-E)<=xr.EPSILON*Math.max(1,Math.abs(l),Math.abs(E))&&Math.abs(h-M)<=xr.EPSILON*Math.max(1,Math.abs(h),Math.abs(M))&&Math.abs(p-I)<=xr.EPSILON*Math.max(1,Math.abs(p),Math.abs(I))&&Math.abs(m-z)<=xr.EPSILON*Math.max(1,Math.abs(m),Math.abs(z))&&Math.abs(g-D)<=xr.EPSILON*Math.max(1,Math.abs(g),Math.abs(D))},Lt.sqrLen=Lt.squaredLength=Lt.len=Lt.length=Lt.dot=Lt.mul=Lt.setReal=Lt.getReal=void 0;var xr=vc(Ri),In=vc(mt),eh=vc(ut);function th(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,i=new WeakMap;return(th=function(n){return n?i:e})(t)}function vc(t,e){if(t&&t.__esModule)return t;if(t===null||xc(t)!=="object"&&typeof t!="function")return{default:t};var i=th(e);if(i&&i.has(t))return i.get(t);var n={},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in t)if(l!=="default"&&Object.prototype.hasOwnProperty.call(t,l)){var h=a?Object.getOwnPropertyDescriptor(t,l):null;h&&(h.get||h.set)?Object.defineProperty(n,l,h):n[l]=t[l]}return n.default=t,i&&i.set(t,n),n}function ih(t,e,i){var n=.5*i[0],a=.5*i[1],l=.5*i[2],h=e[0],p=e[1],m=e[2],g=e[3];return t[0]=h,t[1]=p,t[2]=m,t[3]=g,t[4]=n*g+a*m-l*p,t[5]=a*g+l*h-n*m,t[6]=l*g+n*p-a*h,t[7]=-n*h-a*p-l*m,t}function rh(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t}function nh(t,e,i){var n=e[0],a=e[1],l=e[2],h=e[3],p=i[4],m=i[5],g=i[6],x=i[7],v=e[4],w=e[5],E=e[6],M=e[7],I=i[0],z=i[1],D=i[2],F=i[3];return t[0]=n*F+h*I+a*D-l*z,t[1]=a*F+h*z+l*I-n*D,t[2]=l*F+h*D+n*z-a*I,t[3]=h*F-n*I-a*z-l*D,t[4]=n*x+h*p+a*g-l*m+v*F+M*I+w*D-E*z,t[5]=a*x+h*m+l*p-n*g+w*F+M*z+E*I-v*D,t[6]=l*x+h*g+n*m-a*p+E*F+M*D+v*z-w*I,t[7]=h*x-n*p-a*m-l*g+M*F-v*I-w*z-E*D,t}Lt.getReal=In.copy,Lt.setReal=In.copy,Lt.mul=nh;var sh=In.dot;Lt.dot=sh;var oh=In.length;Lt.length=oh,Lt.len=oh;var Xa=In.squaredLength;Lt.squaredLength=Xa,Lt.sqrLen=Xa;var Et={};function bc(t){return bc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},bc(t)}Object.defineProperty(Et,"__esModule",{value:!0}),Et.create=lh,Et.clone=function(t){var e=new fs.ARRAY_TYPE(2);return e[0]=t[0],e[1]=t[1],e},Et.fromValues=function(t,e){var i=new fs.ARRAY_TYPE(2);return i[0]=t,i[1]=e,i},Et.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t},Et.set=function(t,e,i){return t[0]=e,t[1]=i,t},Et.add=function(t,e,i){return t[0]=e[0]+i[0],t[1]=e[1]+i[1],t},Et.subtract=ch,Et.multiply=uh,Et.divide=hh,Et.ceil=function(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t},Et.floor=function(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t}
1,Et.min=function(t,e,i){return t[0]=Math.min(e[0],i[0]),t[1]=Math.min(e[1],i[1]),t},Et.max=function(t,e,i){return t[0]=Math.max(e[0],i[0]),t[1]=Math.max(e[1],i[1]),t},Et.round=function(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t},Et.scale=function(t,e,i){return t[0]=e[0]*i,t[1]=e[1]*i,t},Et.scaleAndAdd=function(t,e,i,n){return t[0]=e[0]+i[0]*n,t[1]=e[1]+i[1]*n,t},Et.distance=dh,Et.squaredDistance=ph,Et.length=fh,Et.squaredLength=Ya,Et.negate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t},Et.inverse=function(t,e){return t[0]=1/e[0],t[1]=1/e[1],t},Et.normalize=function(t,e){var i=e[0],n=e[1],a=i*i+n*n;return a>0&&(a=1/Math.sqrt(a)),t[0]=e[0]*a,t[1]=e[1]*a,t},Et.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]},Et.cross=function(t,e,i){var n=e[0]*i[1]-e[1]*i[0];return t[0]=t[1]=0,t[2]=n,t},Et.lerp=function(t,e,i,n){var a=e[0],l=e[1];return t[0]=a+n*(i[0]-a),t[1]=l+n*(i[1]-l),t},Et.random=function(t,e){e=e||1;var i=2*fs.RANDOM()*Math.PI;return t[0]=Math.cos(i)*e,t[1]=Math.sin(i)*e,t},Et.transformMat2=function(t,e,i){var n=e[0],a=e[1];return t[0]=i[0]*n+i[2]*a,t[1]=i[1]*n+i[3]*a,t},Et.transformMat2d=function(t,e,i){var n=e[0],a=e[1];return t[0]=i[0]*n+i[2]*a+i[4],t[1]=i[1]*n+i[3]*a+i[5],t},Et.transformMat3=function(t,e,i){var n=e[0],a=e[1];return t[0]=i[0]*n+i[3]*a+i[6],t[1]=i[1]*n+i[4]*a+i[7],t},Et.transformMat4=function(t,e,i){var n=e[0],a=e[1];return t[0]=i[0]*n+i[4]*a+i[12],t[1]=i[1]*n+i[5]*a+i[13],t},Et.rotate=function(t,e,i,n){var a=e[0]-i[0],l=e[1]-i[1],h=Math.sin(n),p=Math.cos(n);return t[0]=a*p-l*h+i[0],t[1]=a*h+l*p+i[1],t},Et.angle=function(t,e){var i=t[0],n=t[1],a=e[0],l=e[1],h=Math.sqrt(i*i+n*n)*Math.sqrt(a*a+l*l);return Math.acos(Math.min(Math.max(h&&(i*a+n*l)/h,-1),1))},Et.zero=function(t){return t[0]=0,t[1]=0,t},Et.str=function(t){return"vec2("+t[0]+", "+t[1]+")"},Et.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]},Et.equals=function(t,e){var i=t[0],n=t[1],a=e[0],l=e[1];return Math.abs(i-a)<=fs.EPSILON*Math.max(1,Math.abs(i),Math.abs(a))&&Math.abs(n-l)<=fs.EPSILON*Math.max(1,Math.abs(n),Math.abs(l))},Et.forEach=Et.sqrLen=Et.sqrDist=Et.dist=Et.div=Et.mul=Et.sub=Et.len=void 0;var fs=function(t,e){if(t&&t.__esModule)return t;if(t===null||bc(t)!=="object"&&typeof t!="function")return{default:t};var i=ah(void 0);if(i&&i.has(t))return i.get(t);var n={},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in t)if(l!=="default"&&Object.prototype.hasOwnProperty.call(t,l)){var h=a?Object.getOwnPropertyDescriptor(t,l):null;h&&(h.get||h.set)?Object.defineProperty(n,l,h):n[l]=t[l]}return n.default=t,i&&i.set(t,n),n}(Ri);function ah(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,i=new WeakMap;return(ah=function(n){return n?i:e})(t)}function lh(){var t=new fs.ARRAY_TYPE(2);return fs.ARRAY_TYPE!=Float32Array&&(t[0]=0,t[1]=0),t}function ch(t,e,i){return t[0]=e[0]-i[0],t[1]=e[1]-i[1],t}function uh(t,e,i){return t[0]=e[0]*i[0],t[1]=e[1]*i[1],t}function hh(t,e,i){return t[0]=e[0]/i[0],t[1]=e[1]/i[1],t}function dh(t,e){return Math.hypot(e[0]-t[0],e[1]-t[1])}function ph(t,e){var i=e[0]-t[0],n=e[1]-t[1];return i*i+n*n}function fh(t){return Math.hypot(t[0],t[1])}function Ya(t){var e=t[0],i=t[1];return e*e+i*i}Et.len=fh,Et.sub=ch,Et.mul=uh,Et.div=hh,Et.dist=dh,Et.sqrDist=ph,Et.sqrLen=Ya;var hp=function(){var t=lh();return function(e,i,n,a,l,h){var p,m;for(i||(i=2),n||(n=0),m=a?Math.min(a*i+n,e.length):e.length,p=n;p<m;p+=i)t[0]=e[p],t[1]=e[p+1],l(t,t,h),e[p]=t[0],e[p+1]=t[1];return e}}();function Ja(t){return Ja=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ja(t)}Et.forEach=hp,Object.defineProperty(Di,"__esModule",{value:!0}),o.aa=Di.vec4=o.Q=Di.vec3=Di.vec2=Di.quat2=o.bl=Di.quat=o.a9=Di.mat4=o.ct=Di.mat3=Di.mat2d=o.b7=Di.mat2=Di.glMatrix=void 0;var dp=mn(Ri);Di.glMatrix=dp;var pp=mn(mi);o.b7=Di.mat2=pp;var fp=mn(_i);Di.mat2d=fp;var lt=mn(Yt);o.ct=Di.mat3=lt;var wc=mn(ut);o.a9=Di.mat4=wc;var yt=mn(mt);o.bl=Di.quat=yt;var Ka=mn(Lt);Di.quat2=Ka;var Pt=mn(Et);Di.vec2=Pt;var Tc=mn(dt);o.Q=Di.vec3=Tc;var Ec=mn(qe);function ft(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,i=new WeakMap;return(ft=function(n){return n?i:e})(t)}function mn(t,e){if(t&&t.__esModule)return t;if(t===null||Ja(t)!=="object"&&typeof t!="function")return{default:t};var i=ft(e);if(i&&i.has(t))return i.get(t);var n={},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in t)if(l!=="default"&&Object.prototype.hasOwnProperty.call(t,l)){var h=a?Object.getOwnPropertyDescriptor(t,l):null;h&&(h.get||h.set)?Object.defineProperty(n,l,h):n[l]=t[l]}return n.default=t,i&&i.set(t,n),n}o.aa=Di.vec4=Ec;var mp=ms;function ms(t,e,i,n){this.cx=3*t,this.bx=3*(i-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(n-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=e,this.p2x=i,this.p2y=n}ms.prototype={sampleCurveX:function(t){return((this.ax*t+this.bx)*t+this.cx)*t},sampleCurveY:function(t){return((this.ay*t+this.by)*t+this.cy)*t},sampleCurveDerivativeX:function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},solveCurveX:function(t,e){if(e===void 0&&(e=1e-6),t<0)return 0;if(t>1)return 1;for(var i=t,n=0;n<8;n++){var a=this.sampleCurveX(i)-t;if(Math.abs(a)<e)return i;var l=this.sampleCurveDerivativeX(i);
1if(Math.abs(l)<1e-6)break;i-=a/l}var h=0,p=1;for(i=t,n=0;n<20&&(a=this.sampleCurveX(i),!(Math.abs(a-t)<e));n++)t>a?h=i:p=i,i=.5*(p-h)+h;return i},solve:function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))}};var mh=zr(mp),el=en;function en(t,e){this.x=t,this.y=e}en.prototype={clone:function(){return new en(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},multByPoint:function(t){return this.clone()._multByPoint(t)},divByPoint:function(t){return this.clone()._divByPoint(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},rotateAround:function(t,e){return this.clone()._rotateAround(t,e)},matMult:function(t){return this.clone()._matMult(t)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var e=t.x-this.x,i=t.y-this.y;return e*e+i*i},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult:function(t){var e=t[2]*this.x+t[3]*this.y;return this.x=t[0]*this.x+t[1]*this.y,this.y=e,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_multByPoint:function(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint:function(t){return this.x/=t.x,this.y/=t.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var e=Math.cos(t),i=Math.sin(t),n=i*this.x+e*this.y;return this.x=e*this.x-i*this.y,this.y=n,this},_rotateAround:function(t,e){var i=Math.cos(t),n=Math.sin(t),a=e.y+n*(this.x-e.x)+i*(this.y-e.y);return this.x=e.x+i*(this.x-e.x)-n*(this.y-e.y),this.y=a,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},en.convert=function(t){return t instanceof en?t:Array.isArray(t)?new en(t[0],t[1]):t};var Ne=zr(el);const Sc=Math.PI/180,Mc=180/Math.PI;function jt(t){return t*Sc}function vr(t){return t*Mc}const _h=[[0,0],[1,0],[1,1],[0,1]];function tl(t){if(t<=0)return 0;if(t>=1)return 1;const e=t*t,i=e*t;return 4*(t<.5?i:3*(t-e)+i-.75)}function gh(t,e,i,n){const a=new mh(t,e,i,n);return function(l){return a.solve(l)}}const tn=gh(.25,.1,.25,1);function kt(t,e,i){return Math.min(i,Math.max(e,t))}function jo(t,e,i){return(i=kt((i-t)/(e-t),0,1))*i*(3-2*i)}function Cn(t,e,i){const n=i-e,a=((t-e)%n+n)%n+e;return a===e?i:a}function Ac(t,e,i){if(!t.length)return i(null,[]);let n=t.length;const a=new Array(t.length);let l=null;t.forEach((h,p)=>{e(h,(m,g)=>{m&&(l=m),a[p]=g,--n==0&&i(l,a)})})}function Gr(t,...e){for(const i of e)for(const n in i)t[n]=i[n];return t}let yh=1;function Qt(){return yh++}function il(){return function t(e){return e?(e^Math.random()*(16>>e/4)).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,t)}()}function Ic(t){return t<=1?1:Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))}function xh(t){return!!t&&/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(t)}function Cc(t,e){t.forEach(i=>{e[i]&&(e[i]=e[i].bind(e))})}function _s(t,e){return t.indexOf(e,t.length-e.length)!==-1}function $s(t,e,i){const n={};for(const a in t)n[a]=e.call(this,t[a],a,t);return n}function Go(t,e,i){const n={};for(const a in t)e.call(this,t[a],a,t)&&(n[a]=t[a]);return n}function Pn(t){return Array.isArray(t)?t.map(Pn):typeof t=="object"&&t?$s(t,Pn):t}const Pc={};function Ci(t){Pc[t]||(typeof console<"u"&&console.warn(t),Pc[t]=!0)}function Hn(t,e,i){return(i.y-t.y)*(e.x-t.x)>(e.y-t.y)*(i.x-t.x)}function qo(t){let e=0;for(let i,n,a=0,l=t.length,h=l-1;a<l;h=a++)i=t[a],n=t[h],e+=(n.x-i.x)*(i.y+n.y);return e}function Zo([t,e,i]){const n=jt(e+90),a=jt(i);return{x:t*Math.cos(n)*Math.sin(a),y:t*Math.sin(n)*Math.sin(a),z:t*Math.cos(a),azimuthal:e,polar:i}}function zn(){return typeof WorkerGlobalScope<"u"&&typeof self<"u"&&self instanceof WorkerGlobalScope}function kr(t){const e={};if(t.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(i,n,a,l)=>{const h=a||l;return e[n]=!h||h.toLowerCase(),""}),e["max-age"]){const i=parseInt(e["max-age"],10);isNaN(i)?delete e["max-age"]:e["max-age"]=i}return e}let rl,nl,sl,$o,Xn,Ws,ol=null;function zc(t){try{const e=self[t];return e.setItem("_mapbox_test_",1),e.removeItem("_mapbox_test_"),!0}catch{return!1}}function gs(t,e){return[t[4*e],t[4*e+1],t[4*e+2],t[4*e+3]]}
1function ys(t,e,i,n){for(;e<i;){const a=e+i>>1;t[a]<n?e=a+1:i=a}return e}function Dc(t,e,i,n){for(;e<i;){const a=e+i>>1;t[a]<=n?e=a+1:i=a}return e}function rn(t){return t>0?1/(1.001-t):1+t}function vh(t){return t>0?1-1/(1.001-t):-t}function al(){return rl==null&&(rl=self.OffscreenCanvas&&new OffscreenCanvas(1,1).getContext("2d")&&typeof self.createImageBitmap=="function"),rl}const _n={now:()=>$o!==void 0?$o:performance.now(),setNow(t){$o=t},restoreNow(){$o=void 0},frame(t){const e=requestAnimationFrame(t);return{cancel:()=>cancelAnimationFrame(e)}},getImageData(t,e=0){const{width:i,height:n}=t;Xn||(Xn=document.createElement("canvas"));const a=Xn.getContext("2d",{willReadFrequently:!0});if(!a)throw new Error("failed to create canvas 2d context");return(i>Xn.width||n>Xn.height)&&(Xn.width=i,Xn.height=n),a.clearRect(-e,-e,i+2*e,n+2*e),a.drawImage(t,0,0,i,n),a.getImageData(-e,-e,i+2*e,n+2*e)},resolveURL:t=>(nl||(nl=document.createElement("a")),nl.href=t,nl.href),get devicePixelRatio(){return window.devicePixelRatio},get prefersReducedMotion(){return!!window.matchMedia&&(sl==null&&(sl=window.matchMedia("(prefers-reduced-motion: reduce)")),sl.matches)},hasCanvasFingerprintNoise(){if(Ws!==void 0)return Ws;if(!al())return Ws=!1,!1;const t=new OffscreenCanvas(85,1),e=t.getContext("2d",{willReadFrequently:!0});let i=0;for(let a=0;a<t.width;++a)e.fillStyle=`rgba(${i++},${i++},${i++}, 255)`,e.fillRect(a,0,1,1);const n=e.getImageData(0,0,t.width,t.height);i=0;for(let a=0;a<n.data.length;++a)if(a%4!=3&&i++!==n.data[a])return Ws=!0,!0;return Ws=!1,!1}};function ll(t,e){const i=t.indexOf("?");if(i<0)return`${t}?${new URLSearchParams(e).toString()}`;const n=new URLSearchParams(t.slice(i));for(const a in e)n.set(a,e[a]);return`${t.slice(0,i)}?${n.toString()}`}
1function cl(t,e={persistentParams:[]}){const i=t.indexOf("?");if(i<0)return t;const n=new URLSearchParams,a=new URLSearchParams(t.slice(i));for(const h of e.persistentParams){const p=a.get(h);p&&n.set(h,p)}const l=n.toString();return`${t.slice(0,i)}${l.length>0?`?${l}`:""}`}const Qs="mapbox-tiles";let ul=500,bh=50,Dn,hl;function Rc(){try{return caches}catch{}}function Hs(){const t=Rc();t&&!Dn&&(Dn=t.open(Qs))}let Lc=1/0;const xs={supported:!1,testSupport:function(t){!kc&&Xs&&(wh?Eh(t):Wo=t)}};let Wo,Xs,kc=!1,wh=!1;const Th=typeof self<"u"?self:{};function Eh(t){const e=t.createTexture();t.bindTexture(t.TEXTURE_2D,e);try{if(t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,Xs),t.isContextLost())return;xs.supported=!0}catch{}t.deleteTexture(e),kc=!0}Th.document&&(Xs=Th.document.createElement("img"),Xs.onload=function(){Wo&&Eh(Wo),Wo=null,wh=!0},Xs.onerror=function(){kc=!0,Wo=null},Xs.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const dl={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image",Model:"Model"};typeof Object.freeze=="function"&&Object.freeze(dl);class pl extends Error{constructor(e,i,n){i===401&&Zn(n)&&(e+=": you may have provided an invalid Mapbox access token. See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes"),super(e),this.status=i,this.url=n}toString(){return`${this.name}: ${this.message} (${this.status}): ${this.url}`}}const Ys=zn()?()=>self.worker&&self.worker.referrer:()=>(location.protocol==="blob:"?parent:self).location.href,Qo=function(t,e){if(!(/^file:/.test(i=t.url)||/^file:/.test(Ys())&&!/^\w+:/.test(i))){if(self.fetch&&self.Request&&self.AbortController&&Request.prototype.hasOwnProperty("signal"))return function(n,a){const l=new AbortController,h=new Request(n.url,{method:n.method||"GET",body:n.body,credentials:n.credentials,headers:n.headers,referrer:Ys(),referrerPolicy:n.referrerPolicy,signal:l.signal});let p=!1,m=!1;const g=(x=h.url).indexOf("sku=")>0&&Zn(x);var x;n.type==="json"&&h.headers.set("Accept","application/json");const v=(E,M,I)=>{if(m)return;if(E&&E.message!=="SecurityError"&&Ci(E.toString()),M&&I)return w(M);const z=Date.now();fetch(h).then(D=>
1{if(D.ok){const F=g?D.clone():null;return w(D,F,z)}return a(new pl(D.statusText,D.status,n.url))}).catch(D=>{D.name!=="AbortError"&&a(new Error(`${D.message} ${n.url}`))})},w=(E,M,I)=>{(n.type==="arrayBuffer"?E.arrayBuffer():n.type==="json"?E.json():E.text()).then(z=>{m||(M&&I&&function(D,F,j){if(Hs(),!Dn)return;const V=kr(F.headers.get("Cache-Control")||"");if(V["no-store"])return;const X={status:F.status,statusText:F.statusText,headers:new Headers};F.headers.forEach((ee,oe)=>X.headers.set(oe,ee)),V["max-age"]&&X.headers.set("Expires",new Date(j+1e3*V["max-age"]).toUTCString());const q=X.headers.get("Expires");if(!q||new Date(q).getTime()-j<42e4)return;let J=cl(D.url,{persistentParams:["language","worldview"]});if(F.status===206){const ee=D.headers.get("Range");if(!ee)return;X.status=200,J=ll(J,{range:ee})}(function(ee,oe){if(hl===void 0)try{new Response(new ReadableStream),hl=!0}catch{hl=!1}hl?oe(ee.body):ee.blob().then(oe)})(F,ee=>{const oe=new Response(ee,X);Hs(),Dn&&Dn.then(fe=>fe.put(J,oe)).catch(fe=>Ci(fe.message))})}(h,M,I),p=!0,a(null,z,E.headers.get("Cache-Control"),E.headers.get("Expires")))}).catch(z=>{m||a(new Error(z.message))})};return g?function(E,M){if(Hs(),!Dn)return M(null);Dn.then(I=>
1{let z=cl(E.url,{persistentParams:["language","worldview"]});const D=E.headers.get("Range");D&&(z=ll(z,{range:D})),I.match(z).then(F=>{const j=function(V){if(!V)return!1;const X=new Date(V.headers.get("Expires")||0),q=kr(V.headers.get("Cache-Control")||"");return X>Date.now()&&!q["no-cache"]}(F);I.delete(z),j&&I.put(z,F.clone()),M(null,F,j)}).catch(M)}).catch(M)}(h,v):v(null,null),{cancel:()=>{m=!0,p||l.abort()}}}(t,e);if(zn()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",t,e,void 0,!0)}var i;return function(n,a){const l=new XMLHttpRequest;l.open(n.method||"GET",n.url,!0),n.type==="arrayBuffer"&&(l.responseType="arraybuffer");for(const h in n.headers)l.setRequestHeader(h,n.headers[h]);return n.type==="json"&&(l.responseType="text",l.setRequestHeader("Accept","application/json")),l.withCredentials=n.credentials==="include",l.onerror=()=>{a(new Error(l.statusText))},l.onload=()=>{if((l.status>=200&&l.status<300||l.status===0)&&l.response!==null){let h=l.response;if(n.type==="json")try{h=JSON.parse(l.response)}catch(p){return a(p)}a(null,h,l.getResponseHeader("Cache-Control"),l.getResponseHeader("Expires"))}else a(new pl(l.statusText,l.status,n.url))},l.send(n.body),{cancel:()=>l.abort()}}(t,e)},Ho=function(t,e){return Qo(Gr(t,{type:"arrayBuffer"}),e)};function Oc(t){const e=document.createElement("a");return e.href=t,e.protocol===location.protocol&&e.host===location.host}const Sh="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let fl,Xo;fl=[],Xo=0;const Bc=function(t,e){if(xs.supported&&(t.headers||(t.headers={}),t.headers.accept="image/webp,*/*"),Xo>=Tt.MAX_PARALLEL_IMAGE_REQUESTS){const l={requestParameters:t,callback:e,cancelled:!1,cancel(){this.cancelled=!0}};return fl.push(l),l}Xo++;let i=!1;const n=()=>
1{if(!i)for(i=!0,Xo--;fl.length&&Xo<Tt.MAX_PARALLEL_IMAGE_REQUESTS;){const l=fl.shift(),{requestParameters:h,callback:p,cancelled:m}=l;m||(l.cancel=Bc(h,p).cancel)}},a=Ho(t,(l,h,p,m)=>{n(),l?e(l):h&&(self.createImageBitmap?function(g,x){const v=new Blob([new Uint8Array(g)],{type:"image/png"});createImageBitmap(v).then(w=>{x(null,w)}).catch(w=>{x(new Error(`Could not load image because of ${w.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})}(h,(g,x)=>e(g,x,p,m)):function(g,x){const v=new Image;v.onload=()=>{x(null,v),URL.revokeObjectURL(v.src),v.onload=null,requestAnimationFrame(()=>{v.src=Sh})},v.onerror=()=>x(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const w=new Blob([new Uint8Array(g)],{type:"image/png"});v.src=g.byteLength?URL.createObjectURL(w):Sh}(h,(g,x)=>e(g,x,p,m)))});return{cancel:()=>{a.cancel(),n()}}},Yo="01",ml="NO_ACCESS_TOKEN",Fc=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function nn(t){const e=t.match(Fc);if(!e)throw new Error("Unable to parse URL object");return{protocol:e[1],authority:e[2],path:e[3]||"/",params:e[4]?e[4].split("&"):[]}}function Js(t){const e=t.params.length?`?${t.params.join("&")}`:"";return`${t.protocol}://${t.authority}${t.path}${e}`}const Jo="mapbox.eventData";function Nc(t){if(!t)return null;const e=t.split(".");if(!e||e.length!==3)return null;try{return JSON.parse(decodeURIComponent(atob(e[1]).split("").map(i=>"%"+("00"+i.charCodeAt(0).toString(16)).slice(-2)).join("")))}catch{return null}}class Ks{constructor(e){this.type=e,this.anonId=null,this.eventData={},this.queue=[],this.pendingRequest=null}getStorageKey(e){const i=Nc(Tt.ACCESS_TOKEN);let n="";return n=i&&i.u?btoa(encodeURIComponent(i.u).replace(/%([0-9A-F]{2})/g,(a,l)=>String.fromCharCode(+("0x"+l)))):Tt.ACCESS_TOKEN||"",e?`${Jo}.${e}:${n}`:`${Jo}:${n}`}fetchEventData(){const e=zc("localStorage"),i=this.getStorageKey(),n=this.getStorageKey("uuid");if(e)try{const a=localStorage.getItem(i);a&&(this.eventData=JSON.parse(a));const l=localStorage.getItem(n);l&&(this.anonId=l)}catch{Ci("Unable to read from LocalStorage")}}saveEventData(){const e=zc("localStorage"),i=this.getStorageKey(),n=this.getStorageKey("uuid"),a=this.anonId;if(e&&a)try{localStorage.setItem(n,a),Object.keys(this.eventData).length>=1&&localStorage.setItem(i,JSON.stringify(this.eventData))}catch{Ci("Unable to write to LocalStorage")}}processRequests(e){}postEvent(e,i,n,a){if(!Tt.EVENTS_URL)return;const l=nn(Tt.EVENTS_URL);l.params.push(`access_token=${a||Tt.ACCESS_TOKEN||""}`);const h={event:this.type,created:new Date(e).toISOString()},p=i?Gr(h,i):h,m={url:Js(l),headers:{"Content-Type":"text/plain"},body:JSON.stringify([p])};this.pendingRequest=function(g,x){return Qo(Gr(g,{method:"POST"}),x)}(m,g=>{this.pendingRequest=null,n(g),this.saveEventData(),this.processRequests(a)})}queueRequest(e,i){this.queue.push(e),this.processRequests(i)}}const _l=new class extends Ks{constructor(t){super("appUserTurnstile"),this._customAccessToken=t}postTurnstileEvent(t,e){Tt.EVENTS_URL&&Tt.ACCESS_TOKEN&&Array.isArray(t)&&t.some(i=>Ft(i)||Zn(i))&&this.queueRequest(Date.now(),e)}processRequests(t){if(this.pendingRequest||this.queue.length===0)return;this.anonId&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();const e=Nc(Tt.ACCESS_TOKEN),i=e?e.u:Tt.ACCESS_TOKEN;let n=i!==this.eventData.tokenU;xh(this.anonId)||(this.anonId=il(),n=!0);const a=this.queue.shift();if(this.eventData.lastSuccess){const l=new Date(this.eventData.lastSuccess),h=new Date(a),p=(a-this.eventData.lastSuccess)/864e5;n=n||p>=1||p<-1||l.getDate()!==h.getDate()}else n=!0;n?this.postEvent(a,{sdkIdentifier:"mapbox-gl-js",sdkVersion:At,skuId:Yo,"enabled.telemetry":!1,userId:this.anonId},l=>{l||(this.eventData.lastSuccess=a,this.eventData.tokenU=i)},t):this.processRequests()}},Tr=_l.postTurnstileEvent.bind(_l),Yn=new class extends Ks{constructor(){super("map.load"),this.success={},this.skuToken=""}postMapLoadEvent(t,e,i,n){this.skuToken=e,this.errorCb=n,Tt.EVENTS_URL&&(i||Tt.ACCESS_TOKEN?this.queueRequest({id:t,timestamp:Date.now()},i):this.errorCb(new Error(ml)))}processRequests(t){if(this.pendingRequest||this.queue.length===0)return;const{id:e,timestamp:i}=this.queue.shift();e&&this.success[e]||(this.anonId||this.fetchEventData(),xh(this.anonId)||(this.anonId=il()),this.postEvent(i,{sdkIdentifier:"mapbox-gl-js",sdkVersion:At,skuId:Yo,skuToken:this.skuToken,userId:this.anonId},n=>{n?this.errorCb(n):e&&(this.success[e]=!0)},t))}remove(){this.errorCb=null}},Er=Yn.postMapLoadEvent.bind(Yn),Mh=new class extends Ks{constructor(){super("style.load"),this.eventIdPerMapInstanceMap=new Map,this.mapInstanceIdMap=new WeakMap}getMapInstanceId(t){let e=this.mapInstanceIdMap.get(t);return e||(e=il(),this.mapInstanceIdMap.set(t,e)),e}getEventId(t){const e=this.eventIdPerMapInstanceMap.get(t)||0;return this.eventIdPerMapInstanceMap.set(t,e+1),e}postStyleLoadEvent(t,e){const{map:i,style:n,importedStyles:a}=e;if(!Tt.EVENTS_URL||!t&&!Tt.ACCESS_TOKEN)return;const l=this.getMapInstanceId(i),h={mapInstanceId:l,eventId:this.getEventId(l),style:n};a.length&&(h.importedStyles=a),this.queueRequest({timestamp:Date.now(),payload:h},t)}processRequests(t){if(this.pendingRequest||this.queue.length===0)return;const{timestamp:e,payload:i}=this.queue.shift();this.postEvent(e,i,()=>{},t)}},_p=Mh.postStyleLoadEvent.bind(Mh),Ah=new class extends Ks{constructor(){super("gljs.performance")}postPerformanceEvent(t,e){Tt.EVENTS_URL&&(t||Tt.ACCESS_TOKEN)&&this.queueRequest({timestamp:Date.now(),performanceData:e},t)}processRequests(t){if(this.pendingRequest||this.queue.length===0)return;const{timestamp:e,performanceData:i}=this.queue.shift(),n=function(a){const l=performance.getEntriesByType("resource"),h=performance.getEntriesByType("mark"),p=function(E){const M={};if(E){for(const I in E)if(I!=="other")for(const z of E[I]){const D=`${I}ResolveRangeMin`,F=`${I}ResolveRangeMax`,j=`${I}RequestCount`,V=`${I}RequestCachedCount`;M[D]=Math.min(M[D]||1/0,z.startTime),M[F]=Math.max(M[F]||-1/0,z.responseEnd);const X=q=>{M[q]===void 0&&(M[q]=0),++M[q]};z.transferSize!==void 0&&z.transferSize===0&&X(V),X(j)}}return M}(function(E,M){const I={};if(E)for(const z of E){const D=M(z);I[D]===void 0&&(I[D]=[]),I[D].push(z)}return I}(l,Za)),m=window.devicePixelRatio,g=navigator.connection||navigator.mozConnection||navigator.webkitConnection,x=g?g.effectiveType:void 0,v={counters:[],metadata:[],attributes:[]},w=(E,M,I)=>{I!=null&&E.push({name:M,value:I.toString()})};for(const E in p)w(v.counters,E,p[E]);if(a.interactionRange[0]!==1/0&&a.interactionRange[1]!==-1/0&&(w(v.counters,"interactionRangeMin",a.interactionRange[0]),w(v.counters,"interactionRangeMax",a.interactionRange[1])),h)for(const E of Object.keys(cs)){const M=cs[E],I=h.find(z=>z.name===M);I&&w(v.counters,M,I.startTime)}return w(v.counters,"visibilityHidden",a.visibilityHidden),w(v.attributes,"style",function(E){if(E)for(const M of E){const I=M.name.split("?")[0];if(fn(I)){const z=I.split("/").slice(-2);if(z.length===2)return`mapbox://styles/${z[0]}/${z[1]}`}}}(l)),w(v.attributes,"terrainEnabled",a.terrainEnabled?"true":"false"),w(v.attributes,"fogEnabled",a.fogEnabled?"true":"false"),w(v.attributes,"projection",a.projection),w(v.attributes,"zoom",a.zoom),w(v.metadata,"devicePixelRatio",m),w(v.metadata,"connectionEffectiveType",x),w(v.metadata,"navigatorUserAgent",navigator.userAgent),w(v.metadata,"screenWidth",window.screen.width),w(v.metadata,"screenHeight",window.screen.height),w(v.metadata,"windowWidth",window.innerWidth),w(v.metadata,"windowHeight",window.innerHeight),w(v.metadata,"mapWidth",a.width/m),w(v.metadata,"mapHeight",a.height/m),w(v.metadata,"webglRenderer",a.renderer),w(v.metadata,"webglVendor",a.vendor),w(v.metadata,"sdkVersion",At),w(v.metadata,"sdkIdentifier","mapbox-gl-js"),v}(i);for(const a of n.metadata);for(const a of n.counters);for(const a of n.attributes);this.postEvent(e,n,()=>{},t)}},gl=Ah.postPerformanceEvent.bind(Ah),yl=new class extends Ks{constructor(){super("map.auth"),this.success={},this.skuToken=""}
1getSession(t,e,i,n){if(!Tt.API_URL||!Tt.SESSION_PATH)return;const a=nn(Tt.API_URL+Tt.SESSION_PATH);a.params.push(`sku=${e||""}`),a.params.push(`access_token=${n||Tt.ACCESS_TOKEN||""}`);const l={url:Js(a),headers:{"Content-Type":"text/plain"}};this.pendingRequest=function(h,p){return Qo(Gr(h,{method:"GET"}),p)}(l,h=>{this.pendingRequest=null,i(h),this.saveEventData(),this.processRequests(n)})}getSessionAPI(t,e,i,n){this.skuToken=e,this.errorCb=n,Tt.SESSION_PATH&&Tt.API_URL&&(i||Tt.ACCESS_TOKEN?this.queueRequest({id:t,timestamp:Date.now()},i):this.errorCb(new Error(ml)))}processRequests(t){if(this.pendingRequest||this.queue.length===0)return;const{id:e,timestamp:i}=this.queue.shift();e&&this.success[e]||this.getSession(i,this.skuToken,n=>{n?this.errorCb(n):e&&(this.success[e]=!0)},t)}remove(){this.errorCb=null}},Vc=yl.getSessionAPI.bind(yl),xl=new Set;var gn={exports:{}},Ih={exports:{}};Ih.exports=function(t,e){var i,n,a,l,h,p,m,g;for(n=t.length-(i=3&t.length),a=e,h=3432918353,p=461845907,g=0;g<n;)m=255&t.charCodeAt(g)|(255&t.charCodeAt(++g))<<8|(255&t.charCodeAt(++g))<<16|(255&t.charCodeAt(++g))<<24,++g,a=27492+(65535&(l=5*(65535&(a=(a^=m=(65535&(m=(m=(65535&m)*h+(((m>>>16)*h&65535)<<16)&4294967295)<<15|m>>>17))*p+(((m>>>16)*p&65535)<<16)&4294967295)<<13|a>>>19))+((5*(a>>>16)&65535)<<16)&4294967295))+((58964+(l>>>16)&65535)<<16);switch(m=0,i){case 3:m^=(255&t.charCodeAt(g+2))<<16;case 2:m^=(255&t.charCodeAt(g+1))<<8;case 1:a^=m=(65535&(m=(m=(65535&(m^=255&t.charCodeAt(g)))*h+(((m>>>16)*h&65535)<<16)&4294967295)<<15|m>>>17))*p+(((m>>>16)*p&65535)<<16)&4294967295}return a^=t.length,a=2246822507*(65535&(a^=a>>>16))+((2246822507*(a>>>16)&65535)<<16)&4294967295,a=3266489909*(65535&(a^=a>>>13))+((3266489909*(a>>>16)&65535)<<16)&4294967295,(a^=a>>>16)>>>0};var gp=Ih.exports,Uc={exports:{}};Uc.exports=function(t,e){for(var i,n=t.length,a=e^n,l=0;n>=4;)i=1540483477*(65535&(i=255&t.charCodeAt(l)|(255&t.charCodeAt(++l))<<8|(255&t.charCodeAt(++l))<<16|(255&t.charCodeAt(++l))<<24))+((1540483477*(i>>>16)&65535)<<16),a=1540483477*(65535&a)+((1540483477*(a>>>16)&65535)<<16)^(i=1540483477*(65535&(i^=i>>>24))+((1540483477*(i>>>16)&65535)<<16)),n-=4,++l;switch(n){case 3:a^=(255&t.charCodeAt(l+2))<<16;case 2:a^=(255&t.charCodeAt(l+1))<<8;case 1:a=1540483477*(65535&(a^=255&t.charCodeAt(l)))+((1540483477*(a>>>16)&65535)<<16)}return a=1540483477*(65535&(a^=a>>>13))+((1540483477*(a>>>16)&65535)<<16),(a^=a>>>15)>>>0};var jc=gp,sn=Uc.exports;gn.exports=jc,gn.exports.murmur3=jc,gn.exports.murmur2=sn;var Ko=zr(gn.exports);function Gc(t,e,i){i[t]&&i[t].indexOf(e)!==-1||(i[t]=i[t]||[],i[t].push(e))}function vl(t,e,i){if(i&&i[t]){const n=i[t].indexOf(e);n!==-1&&i[t].splice(n,1)}}class Jn{constructor(e,i={}){Gr(this,i),this.type=e}}class bl extends Jn{constructor(e,i={}){super("error",Gr({error:e},i))}}class vs{on(e,i){return this._listeners=this._listeners||{},Gc(e,i,this._listeners),this}off(e,i){return vl(e,i,this._listeners),vl(e,i,this._oneTimeListeners),this}once(e,i){return i?(this._oneTimeListeners=this._oneTimeListeners||{},Gc(e,i,this._oneTimeListeners),this):new Promise(n=>this.once(e,n))}fire(e,i){typeof e=="string"&&(e=new Jn(e,i||{}));const n=e.type;if(this.listens(n)){e.target=this;const a=this._listeners&&this._listeners[n]?this._listeners[n].slice():[];for(const p of a)p.call(this,e);const l=this._oneTimeListeners&&this._oneTimeListeners[n]?this._oneTimeListeners[n].slice():[];for(const p of l)vl(n,p,this._oneTimeListeners),p.call(this,e);const h=this._eventedParent;h&&(Gr(e,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),h.fire(e))}else e instanceof bl&&console.error(e.error);return this}listens(e){return!!(this._listeners&&this._listeners[e]&&this._listeners[e].length>0||this._oneTimeListeners&&this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e))}setEventedParent(e,i){return this._eventedParent=e,this._eventedParentData=i,this}}o.z=void 0;var qc={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function ea(t){return(t=Math.round(t))<0?0:t>255?255:t}function wl(t){return ea(t[t.length-1]==="%"?parseFloat(t)/100*255:parseInt(t))}function ta(t){return(e=t[t.length-1]==="%"?parseFloat(t)/100:parseFloat(t))<0?0:e>1?1:e;var e}function Tl(t,e,i){return i<0?i+=1:i>1&&(i-=1),6*i<1?t+(e-t)*i*6:2*i<1?e:3*i<2?t+(e-t)*(2/3-i)*6:t}try{o.z={}.parseCSSColor=function(t){var e,i=t.replace(/ /g,"").toLowerCase();if(i in qc)return qc[i].slice();if(i[0]==="#")return i.length===4?(e=parseInt(i.substr(1),16))>=0&&e<=4095?[(3840&e)>>4|(3840&e)>>8,240&e|(240&e)>>4,15&e|(15&e)<<4,1]:null:i.length===7&&(e=parseInt(i.substr(1),16))>=0&&e<=16777215?[(16711680&e)>>16,(65280&e)>>8,255&e,1]:null;var n=i.indexOf("("),a=i.indexOf(")");if(n!==-1&&a+1===i.length){var l=i.substr(0,n),h=i.substr(n+1,a-(n+1)).split(","),p=1;switch(l){case"rgba":if(h.length!==4)return null;p=ta(h.pop());case"rgb":return h.length!==3?null:[wl(h[0]),wl(h[1]),wl(h[2]),p];case"hsla":if(h.length!==4)return null;p=ta(h.pop());case"hsl":if(h.length!==3)return null;var m=(parseFloat(h[0])%360+360)%360/360,g=ta(h[1]),x=ta(h[2]),v=x<=.5?x*(g+1):x+g-x*g,w=2*x-v;return[ea(255*Tl(w,v,m+1/3)),ea(255*Tl(w,v,m)),ea(255*Tl(w,v,m-1/3)),p];default:return null}}return null}}catch{}class ti{constructor(e,i,n,a=1){this.r=e,this.g=i,this.b=n,this.a=a}static parse(e){if(!e)return;if(e instanceof ti)return e;if(typeof e!="string")return;const i=o.z(e);return i?new ti(i[0]/255*i[3],i[1]/255*i[3],i[2]/255*i[3],i[3]):void 0}toString(){const[e,i,n,a]=this.toArray();return`rgba(${Math.round(e)},${Math.round(i)},${Math.round(n)},${a})`}toArray(){const{r:e,g:i,b:n,a}=this;return a===0?[0,0,0,0]:[255*e/a,255*i/a,255*n/a,a]}toArray01(){const{r:e,g:i,b:n,a}=this;return a===0?[0,0,0,0]:[e/a,i/a,n/a,a]}
1toArray01Scaled(e){const{r:i,g:n,b:a,a:l}=this;return l===0?[0,0,0]:[i/l*e,n/l*e,a/l*e]}toArray01PremultipliedAlpha(){const{r:e,g:i,b:n,a}=this;return[e,i,n,a]}toArray01Linear(){const{r:e,g:i,b:n,a}=this;return a===0?[0,0,0,0]:[Math.pow(e/a,2.2),Math.pow(i/a,2.2),Math.pow(n/a,2.2),a]}}function Ct(t,e,i){return t*(1-i)+e*i}function ia(t,e,i){return t.map((n,a)=>Ct(n,e[a],i))}ti.black=new ti(0,0,0,1),ti.white=new ti(1,1,1,1),ti.transparent=new ti(0,0,0,0),ti.red=new ti(1,0,0,1),ti.blue=new ti(0,0,1,1);var ra=Object.freeze({__proto__:null,array:ia,color:function(t,e,i){return new ti(Ct(t.r,e.r,i),Ct(t.g,e.g,i),Ct(t.b,e.b,i),Ct(t.a,e.a,i))},number:Ct});function El(t,...e){for(const i of e)for(const n in i)t[n]=i[n];return t}class on extends Error{constructor(e,i){super(i),this.message=i,this.key=e}}class Kn{constructor(e,i=[]){this.parent=e,this.bindings={};for(const[n,a]of i)this.bindings[n]=a}concat(e){return new Kn(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw new Error(`${e} not found in scope.`)}has(e){return!!this.bindings[e]||!!this.parent&&this.parent.has(e)}}const zt={kind:"null"},We={kind:"number"},Ht={kind:"string"},Xt={kind:"boolean"},Or={kind:"color"},eo={kind:"object"},Gt={kind:"value"},na={kind:"collator"},to={kind:"formatted"},io={kind:"resolvedImage"};function Ji(t,e){return{kind:"array",itemType:t,N:e}}function Li(t){if(t.kind==="array"){const e=Li(t.itemType);return typeof t.N=="number"?`array<${e}, ${t.N}>`:t.itemType.kind==="value"?"array":`array<${e}>`}return t.kind}const Ch=[zt,We,Ht,Xt,Or,to,eo,Ji(Gt),io];function sa(t,e){if(e.kind==="error")return null;if(t.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!sa(t.itemType,e.itemType))&&(typeof t.N!="number"||t.N===e.N))return null}else{if(t.kind===e.kind)return null;if(t.kind==="value"){for(const i of Ch)if(!sa(i,e))return null}}return`Expected ${Li(t)} but found ${Li(e)} instead.`}function oa(t,e){return e.some(i=>i.kind===t.kind)}function bs(t,e){return e.some(i=>i==="null"?t===null:i==="array"?Array.isArray(t):i==="object"?t&&!Array.isArray(t)&&typeof t=="object":i===typeof t)}class Zc{constructor(e,i,n){this.sensitivity=e?i?"variant":"case":i?"accent":"base",this.locale=n,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,i){return this.collator.compare(e,i)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class Sl{constructor(e,i,n,a,l){this.text=e.normalize?e.normalize():e,this.image=i,this.scale=n,this.fontStack=a,this.textColor=l}}class sr{constructor(e){this.sections=e}static fromString(e){return new sr([new Sl(e,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(e=>e.text.length!==0||e.image&&e.image.namePrimary.length!==0)}static factory(e){return e instanceof sr?e:sr.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map(e=>e.text).join("")}serialize(){const e=["format"];for(const i of this.sections){if(i.image){e.push(["image",i.image.namePrimary]);continue}e.push(i.text);const n={};i.fontStack&&(n["text-font"]=["literal",i.fontStack.split(",")]),i.scale&&(n["font-scale"]=i.scale),i.textColor&&(n["text-color"]=["rgba"].concat(i.textColor.toArray())),e.push(n)}return e}}class Br{constructor(e){this.namePrimary=e.namePrimary,e.nameSecondary&&(this.nameSecondary=e.nameSecondary),this.available=e.available}toString(){return this.nameSecondary?`[${this.namePrimary},${this.nameSecondary}]`:this.namePrimary}static fromString(e,i){return e?new Br({namePrimary:e,nameSecondary:i,available:!1}):null}serialize(){return this.nameSecondary?["image",this.namePrimary,this.nameSecondary]:["image",this.namePrimary]}}function Ph(t,e,i,n){return typeof t=="number"&&t>=0&&t<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof i=="number"&&i>=0&&i<=255?n===void 0||typeof n=="number"&&n>=0&&n<=1?null:`Invalid rgba value [${[t,e,i,n].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof n=="number"?[t,e,i,n]:[t,e,i]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function ro(t){if(t===null||typeof t=="string"||typeof t=="boolean"||typeof t=="number"||t instanceof ti||t instanceof Zc||t instanceof sr||t instanceof Br)return!0;
vendor: 12,575 bytes, line 1
1if(Array.isArray(t)){for(const e of t)if(!ro(e))return!1;return!0}if(typeof t=="object"){for(const e in t)if(!ro(t[e]))return!1;return!0}return!1}function Gi(t){if(t===null)return zt;if(typeof t=="string")return Ht;if(typeof t=="boolean")return Xt;if(typeof t=="number")return We;if(t instanceof ti)return Or;if(t instanceof Zc)return na;if(t instanceof sr)return to;if(t instanceof Br)return io;if(Array.isArray(t)){const e=t.length;let i;for(const n of t){const a=Gi(n);if(i){if(i===a)continue;i=Gt;break}i=a}return Ji(i||Gt,e)}return eo}function qr(t){const e=typeof t;return t===null?"":e==="string"||e==="number"||e==="boolean"?String(t):t instanceof ti||t instanceof sr||t instanceof Br?t.toString():JSON.stringify(t)}class yn{constructor(e,i){this.type=e,this.value=i}static parse(e,i){if(e.length!==2)return i.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!ro(e[1]))return i.error("invalid value");const n=e[1];let a=Gi(n);const l=i.expectedType;return a.kind!=="array"||a.N!==0||!l||l.kind!=="array"||typeof l.N=="number"&&l.N!==0||(a=l),new yn(a,n)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}serialize(){return this.type.kind==="array"||this.type.kind==="object"?["literal",this.value]:this.value instanceof ti?["rgba"].concat(this.value.toArray()):this.value instanceof sr?this.value.serialize():this.value}}class Wi{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}}const Ml={string:Ht,number:We,boolean:Xt,object:eo};class an{constructor(e,i){this.type=e,this.args=i}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");let n,a=1;const l=e[0];if(l==="array"){let p,m;if(e.length>2){const g=e[1];if(typeof g!="string"||!(g in Ml)||g==="object")return i.error('The item type argument of "array" must be one of string, number, boolean',1);p=Ml[g],a++}else p=Gt;if(e.length>3){if(e[2]!==null&&(typeof e[2]!="number"||e[2]<0||e[2]!==Math.floor(e[2])))return i.error('The length argument to "array" must be a positive integer literal',2);m=e[2],a++}n=Ji(p,m)}else n=Ml[l];const h=[];for(;a<e.length;a++){const p=i.parse(e[a],a,Gt);if(!p)return null;h.push(p)}return new an(n,h)}evaluate(e){for(let i=0;i<this.args.length;i++){const n=this.args[i].evaluate(e);if(!sa(this.type,Gi(n)))return n;if(i===this.args.length-1)throw new Wi(`Expected value to be of type ${Li(this.type)}, but found ${Li(Gi(n))} instead.`)}return null}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}serialize(){const e=this.type,i=[e.kind];if(e.kind==="array"){const n=e.itemType;if(n.kind==="string"||n.kind==="number"||n.kind==="boolean"){i.push(n.kind);const a=e.N;(typeof a=="number"||this.args.length>1)&&i.push(a)}}return i.concat(this.args.map(n=>n.serialize()))}}class aa{constructor(e){this.type=to,this.sections=e}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");const n=e[1];if(!Array.isArray(n)&&typeof n=="object")return i.error("First argument must be an image or text section.");const a=[];let l=!1;for(let h=1;h<=e.length-1;++h){const p=e[h];if(l&&typeof p=="object"&&!Array.isArray(p)){l=!1;let m=null;if(p["font-scale"]&&(m=i.parse(p["font-scale"],1,We),!m))return null;let g=null;if(p["text-font"]&&(g=i.parse(p["text-font"],1,Ji(Ht)),!g))return null;let x=null;if(p["text-color"]&&(x=i.parse(p["text-color"],1,Or),!x))return null;const v=a[a.length-1];v.scale=m,v.font=g,v.textColor=x}else{const m=i.parse(e[h],1,Gt);if(!m)return null;const g=m.type.kind;if(g!=="string"&&g!=="value"&&g!=="null"&&g!=="resolvedImage")return i.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");l=!0,a.push({content:m,scale:null,font:null,textColor:null})}}return new aa(a)}evaluate(e){return new sr(this.sections.map(i=>{const n=i.content.evaluate(e);return Gi(n)===io?new Sl("",n,null,null,null):new Sl(qr(n),null,i.scale?i.scale.evaluate(e):null,i.font?i.font.evaluate(e).join(","):null,i.textColor?i.textColor.evaluate(e):null)}))}eachChild(e){for(const i of this.sections)e(i.content),i.scale&&e(i.scale),i.font&&e(i.font),i.textColor&&e(i.textColor)}outputDefined(){return!1}serialize(){const e=["format"];for(const i of this.sections){e.push(i.content.serialize());const n={};i.scale&&(n["font-scale"]=i.scale.serialize()),i.font&&(n["text-font"]=i.font.serialize()),i.textColor&&(n["text-color"]=i.textColor.serialize()),e.push(n)}return e}}class no{constructor(e,i){this.type=io,this.inputPrimary=e,this.inputSecondary=i}static parse(e,i){if(e.length<2)return i.error("Expected two or more arguments.");const n=i.parse(e[1],1,Ht);if(!n)return i.error("No image name provided.");if(e.length===2)return new no(n);const a=i.parse(e[2],1,Ht);return a?new no(n,a):i.error("Secondary image variant is not a string.")}evaluate(e){const i=Br.fromString(this.inputPrimary.evaluate(e),this.inputSecondary?this.inputSecondary.evaluate(e):void 0);return i&&e.availableImages&&(i.available=e.availableImages.indexOf(i.namePrimary)>-1,i.nameSecondary&&i.available&&e.availableImages&&(i.available=e.availableImages.indexOf(i.nameSecondary)>-1)),i}eachChild(e){e(this.inputPrimary),this.inputSecondary&&e(this.inputSecondary)}outputDefined(){return!1}serialize(){return this.inputSecondary?["image",this.inputPrimary.serialize(),this.inputSecondary.serialize()]:["image",this.inputPrimary.serialize()]}}function es(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":t===null?"null":typeof t}const yp={"to-boolean":Xt,"to-color":Or,"to-number":We,"to-string":Ht};class Rn{constructor(e,i){this.type=e,this.args=i}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");const n=e[0],a=[];let l=zt;if(n==="to-array"){if(!Array.isArray(e[1]))return null;const h=e[1].length;if(i.expectedType){if(i.expectedType.kind!=="array")return i.error(`Expected ${i.expectedType.kind} but found array.`);l=Ji(i.expectedType.itemType,h)}else{if(!(h>0&&ro(e[1][0])))return null;l=Ji(Gi(e[1][0]),h)}for(let p=0;p<h;p++){const m=e[1][p];let g;if(es(m)==="array")g=i.parse(m,void 0,l.itemType);else{const x=es(m);if(x!==l.itemType.kind)return i.error(`Expected ${l.itemType.kind} but found ${x}.`);g=i.registry.literal.parse(["literal",m===void 0?null:m],i)}if(!g)return null;a.push(g)}}else{if((n==="to-boolean"||n==="to-string")&&e.length!==2)return i.error("Expected one argument.");l=yp[n];for(let h=1;h<e.length;h++){const p=i.parse(e[h],h,Gt);if(!p)return null;a.push(p)}}return new Rn(l,a)}evaluate(e){if(this.type.kind==="boolean")return!!this.args[0].evaluate(e);if(this.type.kind==="color"){let i,n;for(const a of this.args){if(i=a.evaluate(e),n=null,i instanceof ti)return i;if(typeof i=="string"){const l=e.parseColor(i);if(l)return l}else if(Array.isArray(i)&&(n=i.length<3||i.length>4?`Invalid rbga value ${JSON.stringify(i)}: expected an array containing either three or four numeric values.`:Ph(i[0],i[1],i[2],i[3]),!n))return new ti(i[0]/255,i[1]/255,i[2]/255,i[3])}throw new Wi(n||`Could not parse color from value '${typeof i=="string"?i:String(JSON.stringify(i))}'`)}if(this.type.kind==="number"){let i=null;for(const n of this.args){if(i=n.evaluate(e),i===null)return 0;const a=Number(i);if(!isNaN(a))return a}throw new Wi(`Could not convert ${JSON.stringify(i)} to number.`)}return this.type.kind==="formatted"?sr.fromString(qr(this.args[0].evaluate(e))):this.type.kind==="resolvedImage"?Br.fromString(qr(this.args[0].evaluate(e))):this.type.kind==="array"?this.args.map(i=>i.evaluate(e)):qr(this.args[0].evaluate(e))}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}serialize(){if(this.type.kind==="formatted")return new aa([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if(this.type.kind==="resolvedImage")return new no(this.args[0]).serialize();const e=this.type.kind==="array"?[]:[`to-${this.type.kind}`];return this.eachChild(i=>{e.push(i.serialize())}),e}}const xp=["Unknown","Point","LineString","Polygon"];class $c{constructor(e,i){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null,this.featureTileCoord=null,this.featureDistanceData=null,this.scope=e,this.options=i}id(){return this.feature&&this.feature.id!==void 0?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?xp[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||{}}measureLight(e){return this.globals.brightness||0}distanceFromCenter(){if(this.featureTileCoord&&this.featureDistanceData){const e=this.featureDistanceData.center,i=this.featureDistanceData.scale,{x:n,y:a}=this.featureTileCoord;return this.featureDistanceData.bearing[0]*(n*i-e[0])+this.featureDistanceData.bearing[1]*(a*i-e[1])}return 0}parseColor(e){let i=this._parseColorCache[e];return i||(i=this._parseColorCache[e]=ti.parse(e)),i}getConfig(e){return this.options?this.options.get(e):null}}class Sr{constructor(e,i,n,a,l){this.name=e,this.type=i,this._evaluate=n,this.args=a,this._overloadIndex=l}evaluate(e){if(!this._evaluate){const i=Sr.definitions[this.name];this._evaluate=Array.isArray(i)?i[2]:i.overloads[this._overloadIndex][1]}return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}serialize(){return[this.name].concat(this.args.map(e=>e.serialize()))}static parse(e,i){const n=e[0],a=Sr.definitions[n];if(!a)return i.error(`Unknown expression "${n}". If you wanted a literal array, use ["literal", [...]].`,0);const l=Array.isArray(a)?a[0]:a.type,h=Array.isArray(a)?[[a[1],a[2]]]:a.overloads,p=[];let m=null,g=-1;for(const[x,v]of h){if(Array.isArray(x)&&x.length!==e.length-1)continue;p.push(x),g++,m=new kl(i.registry,i.path,null,i.scope,void 0,i._scope,i.options);const w=[];let E=!1;for(let M=1;M<e.length;M++){const I=e[M],z=Array.isArray(x)?x[M-1]:x.type,D=m.parse(I,1+w.length,z);if(!D){E=!0;break}w.push(D)}if(!E)if(Array.isArray(x)&&x.length!==w.length)m.error(`Expected ${x.length} arguments, but found ${w.length} instead.`);else{for(let M=0;M<w.length;M++){const I=Array.isArray(x)?x[M]:x.type,z=w[M];m.concat(M+1).checkSubtype(I,z.type)}if(m.errors.length===0)return new Sr(n,l,v,w,g)}}if(p.length===1)i.errors.push(...m.errors);else{const x=(p.length?p:h.map(([w])=>w)).map(vp).join(" | "),v=[];for(let w=1;w<e.length;w++){const E=i.parse(e[w],1+v.length);if(!E)return null;v.push(Li(E.type))}i.error(`Expected arguments of type ${x}, but found (${v.join(", ")}) instead.`)}return null}static register(e,i){Sr.definitions=i;for(const n in i)e[n]=Sr}}function vp(t){return Array.isArray(t)?`(${t.map(Li).join(", ")})`:`(${Li(t.type)}...)`}class la{constructor(e,i,n){this.type=na,this.locale=n,this.caseSensitive=e,this.diacriticSensitive=i}static parse(e,i){if(e.length!==2)return i.error("Expected one argument.");const n=e[1];if(typeof n!="object"||Array.isArray(n))return i.error("Collator options argument must be an object.");const a=i.parse(n["case-sensitive"]!==void 0&&n["case-sensitive"],1,Xt);if(!a)return null;const l=i.parse(n["diacritic-sensitive"]!==void 0&&n["diacritic-sensitive"],1,Xt);if(!l)return null;let h=null;return n.locale&&(h=i.parse(n.locale,1,Ht),!h)?null:new la(a,l,h)}evaluate(e){return new Zc(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}serialize(){const e={};return e["case-sensitive"]=this.caseSensitive.serialize(),e["diacritic-sensitive"]=this.diacriticSensitive.serialize(),this.locale&&(e.locale=this.locale.serialize()),["collator",e]}}var Wc={exports:{}};Wc.exports=function(){function t(n,a,l,h,p){for(;h>l;){if(h-l>600){var m=h-l+1,g=a-l+1,x=Math.log(m),v=.5*Math.exp(2*x/3),w=.5*Math.sqrt(x*v*(m-v)/m)*(g-m/2<0?-1:1);t(n,a,Math.max(l,Math.floor(a-g*v/m+w)),Math.min(h,Math.floor(a+(m-g)*v/m+w)),p)}var E=n[a],M=l,I=h;for(e(n,l,a),p(n[h],E)>0&&e(n,l,h);M<I;){for(e(n,M,I),M++,I--;p(n[M],E)<0;)M++;for(;p(n[I],E)>0;)I--}p(n[l],E)===0?e(n,l,I):e(n,++I,h),I<=a&&(l=I+1),a<=I&&(h=I-1)}}function e(n,a,l){var h=n[a];n[a]=n[l],n[l]=h}function i(n,a){return n<a?-1:n>a?1:0}return function(n,a,l,h,p){t(n,a,l||0,h||n.length-1,p||i)}}();
1var zh=zr(Wc.exports);function bp(t){let e=0;for(let i,n,a=0,l=t.length,h=l-1;a<l;h=a++)i=t[a],n=t[h],e+=(n.x-i.x)*(i.y+n.y);return e}function ca(t,e){t[0]=Math.min(t[0],e[0]),t[1]=Math.min(t[1],e[1]),t[2]=Math.max(t[2],e[0]),t[3]=Math.max(t[3],e[1])}function ua(t,e){return!(t[0]<=e[0]||t[2]>=e[2]||t[1]<=e[1]||t[3]>=e[3])}function wp(t,e,i){const n=t[0]-e[0],a=t[1]-e[1],l=t[0]-i[0],h=t[1]-i[1];return n*h-l*a==0&&n*l<=0&&a*h<=0}function ws(t,e,i=!1){let n=!1;for(let p=0,m=e.length;p<m;p++){const g=e[p];for(let x=0,v=g.length,w=v-1;x<v;w=x++){const E=g[w],M=g[x];if(wp(t,E,M))return i;(l=E)[1]>(a=t)[1]!=(h=M)[1]>a[1]&&a[0]<(h[0]-l[0])*(a[1]-l[1])/(h[1]-l[1])+l[0]&&(n=!n)}}var a,l,h;return n}function Qc(t,e,i,n){const a=n[0]-i[0],l=n[1]-i[1],h=(t[0]-i[0])*l-a*(t[1]-i[1]),p=(e[0]-i[0])*l-a*(e[1]-i[1]);return h>0&&p<0||h<0&&p>0}function so(t,e,i,n){return(a=[n[0]-i[0],n[1]-i[1]])[0]*(l=[e[0]-t[0],e[1]-t[1]])[1]-a[1]*l[0]!=0&&!(!Qc(t,e,i,n)||!Qc(i,n,t,e));var a,l}const ts=8192;function Tp(t,e){const i=(180+t[0])/360,n=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t[1]*Math.PI/360)))/360,a=Math.pow(2,e.z);return[Math.round(i*a*ts),Math.round(n*a*ts)]}function Ep(t,e){for(let i=0;i<e.length;i++)if(ws(t,e[i]))return!0;return!1}function Hc(t,e,i){for(const n of i)for(let a=0,l=n.length,h=l-1;a<l;h=a++)if(so(t,e,n[h],n[a]))return!0;return!1}function Al(t,e){for(let i=0;i<t.length;++i)if(!ws(t[i],e))return!1;for(let i=0;i<t.length-1;++i)if(Hc(t[i],t[i+1],e))return!1;return!0}function Dh(t,e){for(let i=0;i<e.length;i++)if(Al(t,e[i]))return!0;return!1}function Xc(t,e,i){const n=[];for(let a=0;a<t.length;a++){const l=[];for(let h=0;h<t[a].length;h++){const p=Tp(t[a][h],i);ca(e,p),l.push(p)}n.push(l)}return n}function ha(t,e,i){const n=[];for(let a=0;a<t.length;a++){const l=Xc(t[a],e,i);n.push(l)}return n}function Yc(t,e,i,n){if(t[0]<i[0]||t[0]>i[2]){const a=.5*n;let l=t[0]-i[0]>a?-n:i[0]-t[0]>a?n:0;l===0&&(l=t[0]-i[2]>a?-n:i[2]-t[0]>a?n:0),t[0]+=l}ca(e,t)}function da(t,e,i,n){const a=Math.pow(2,n.z)*ts,l=[n.x*ts,n.y*ts],h=[];if(!t)return h;for(const p of t)for(const m of p){const g=[m.x+l[0],m.y+l[1]];Yc(g,e,i,a),h.push(g)}return h}function Jc(t,e,i,n){const a=Math.pow(2,n.z)*ts,l=[n.x*ts,n.y*ts],h=[];if(!t)return h;for(const m of t){const g=[];for(const x of m){const v=[x.x+l[0],x.y+l[1]];ca(e,v),g.push(v)}h.push(g)}if(e[2]-e[0]<=a/2){(p=e)[0]=p[1]=1/0,p[2]=p[3]=-1/0;for(const m of h)for(const g of m)Yc(g,e,i,a)}var p;return h}class Ts{constructor(e,i){this.type=Xt,this.geojson=e,this.geometries=i}static parse(e,i){if(e.length!==2)return i.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(ro(e[1])){const n=e[1];if(n.type==="FeatureCollection")for(let a=0;a<n.features.length;++a){const l=n.features[a].geometry.type;if(l==="Polygon"||l==="MultiPolygon")return new Ts(n,n.features[a].geometry)}else if(n.type==="Feature"){const a=n.geometry.type;if(a==="Polygon"||a==="MultiPolygon")return new Ts(n,n.geometry)}else if(n.type==="Polygon"||n.type==="MultiPolygon")return new Ts(n,n)}return i.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return function(i,n){const a=[1/0,1/0,-1/0,-1/0],l=[1/0,1/0,-1/0,-1/0],h=i.canonicalID();if(!h)return!1;if(n.type==="Polygon"){const p=Xc(n.coordinates,l,h),m=da(i.geometry(),a,l,h);if(!ua(a,l))return!1;for(const g of m)if(!ws(g,p))return!1}if(n.type==="MultiPolygon"){const p=ha(n.coordinates,l,h),m=da(i.geometry(),a,l,h);if(!ua(a,l))return!1;for(const g of m)if(!Ep(g,p))return!1}return!0}(e,this.geometries);if(e.geometryType()==="LineString")return function(i,n){const a=[1/0,1/0,-1/0,-1/0],l=[1/0,1/0,-1/0,-1/0],h=i.canonicalID();if(!h)return!1;if(n.type==="Polygon"){const p=Xc(n.coordinates,l,h),m=Jc(i.geometry(),a,l,h);if(!ua(a,l))return!1;for(const g of m)if(!Al(g,p))return!1}if(n.type==="MultiPolygon"){const p=ha(n.coordinates,l,h),m=Jc(i.geometry(),a,l,h);if(!ua(a,l))return!1;for(const g of m)if(!Dh(g,p))return!1}return!0}(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}serialize(){return["within",this.geojson]}}var Rh={exports:{}};(function(t,e){t.exports=function(){var i={kilometers:1,miles:.621371192237334,nauticalmiles:.5399568034557235,meters:1e3,metres:1e3,yards:1093.6132983377079,feet:3280.839895013123,inches:39370.078740157485},n=1/298.257223563,a=n*(2-n),l=Math.PI/180,h=function(v,w){if(v===void 0)throw new Error("No latitude given.");if(w&&!i[w])throw new Error("Unknown unit "+w+". Use one of: "+Object.keys(i).join(", "));var E=6378.137*l*(w?i[w]:1),M=Math.cos(v*l),I=1/(1-a*(1-M*M)),z=Math.sqrt(I);this.kx=E*z*M,this.ky=E*z*I*(1-a)},p={units:{configurable:!0}};function m(v,w){return v[0]===w[0]&&v[1]===w[1]}function g(v,w,E){var M=x(w[0]-v[0]);return[v[0]+M*E,v[1]+(w[1]-v[1])*E]}function x(v){for(;
1v<-180;)v+=360;for(;v>180;)v-=360;return v}return h.fromTile=function(v,w,E){var M=Math.PI*(1-2*(v+.5)/Math.pow(2,w)),I=Math.atan(.5*(Math.exp(M)-Math.exp(-M)))/l;return new h(I,E)},p.units.get=function(){return i},h.prototype.distance=function(v,w){var E=x(v[0]-w[0])*this.kx,M=(v[1]-w[1])*this.ky;return Math.sqrt(E*E+M*M)},h.prototype.bearing=function(v,w){var E=x(w[0]-v[0])*this.kx;return Math.atan2(E,(w[1]-v[1])*this.ky)/l},h.prototype.destination=function(v,w,E){var M=E*l;return this.offset(v,Math.sin(M)*w,Math.cos(M)*w)},h.prototype.offset=function(v,w,E){return[v[0]+w/this.kx,v[1]+E/this.ky]},h.prototype.lineDistance=function(v){for(var w=0,E=0;E<v.length-1;E++)w+=this.distance(v[E],v[E+1]);return w},h.prototype.area=function(v){for(var w=0,E=0;E<v.length;E++)for(var M=v[E],I=0,z=M.length,D=z-1;I<z;D=I++)w+=x(M[I][0]-M[D][0])*(M[I][1]+M[D][1])*(E?-1:1);return Math.abs(w)/2*this.kx*this.ky},h.prototype.along=function(v,w){var E=0;if(w<=0)return v[0];for(var M=0;M<v.length-1;M++){var I=v[M],z=v[M+1],D=this.distance(I,z);if((E+=D)>w)return g(I,z,(w-(E-D))/D)}return v[v.length-1]},h.prototype.pointToSegmentDistance=function(v,w,E){var M=w[0],I=w[1],z=x(E[0]-M)*this.kx,D=(E[1]-I)*this.ky,F=0;return z===0&&D===0||((F=(x(v[0]-M)*this.kx*z+(v[1]-I)*this.ky*D)/(z*z+D*D))>1?(M=E[0],I=E[1]):F>0&&(M+=z/this.kx*F,I+=D/this.ky*F)),z=x(v[0]-M)*this.kx,D=(v[1]-I)*this.ky,Math.sqrt(z*z+D*D)},h.prototype.pointOnLine=function(v,w){for(var E,M,I,z,D=1/0,F=0;F<v.length-1;F++){var j=v[F][0],V=v[F][1],X=x(v[F+1][0]-j)*this.kx,q=(v[F+1][1]-V)*this.ky,J=0;X===0&&q===0||((J=(x(w[0]-j)*this.kx*X+(w[1]-V)*this.ky*q)/(X*X+q*q))>1?(j=v[F+1][0],V=v[F+1][1]):J>0&&(j+=X/this.kx*J,V+=q/this.ky*J));var ee=(X=x(w[0]-j)*this.kx)*X+(q=(w[1]-V)*this.ky)*q;ee<D&&(D=ee,E=j,M=V,I=F,z=J)}return{point:[E,M],index:I,t:Math.max(0,Math.min(1,z))}},h.prototype.lineSlice=function(v,w,E){var M=this.pointOnLine(E,v),I=this.pointOnLine(E,w);if(M.index>I.index||M.index===I.index&&M.t>I.t){var z=M;M=I,I=z}var D=[M.point],F=M.index+1,j=I.index;!m(E[F],D[0])&&F<=j&&D.push(E[F]);for(var V=F+1;V<=j;V++)D.push(E[V]);return m(E[j],I.point)||D.push(I.point),D},h.prototype.lineSliceAlong=function(v,w,E){for(var M=0,I=[],z=0;z<E.length-1;z++){var D=E[z],F=E[z+1],j=this.distance(D,F);if((M+=j)>v&&I.length===0&&I.push(g(D,F,(v-(M-j))/j)),M>=w)return I.push(g(D,F,(w-(M-j))/j)),I;M>v&&I.push(F)}return I},h.prototype.bufferPoint=function(v,w){var E=w/this.ky,M=w/this.kx;return[v[0]-M,v[1]-E,v[0]+M,v[1]+E]},h.prototype.bufferBBox=function(v,w){var E=w/this.ky,M=w/this.kx;return[v[0]-M,v[1]-E,v[2]+M,v[3]+E]},h.prototype.insideBBox=function(v,w){return x(v[0]-w[0])>=0&&x(v[0]-w[2])<=0&&v[1]>=w[1]&&v[1]<=w[3]},Object.defineProperties(h,p),h}()})(Rh);var pa=zr(Rh.exports),Il={exports:{}};(function(t,e){t.exports=function(){var i=function(a,l){if(a===void 0&&(a=[]),l===void 0&&(l=n),this.data=a,this.length=this.data.length,this.compare=l,this.length>0)for(var h=(this.length>>1)-1;h>=0;h--)this._down(h)};function n(a,l){return a<l?-1:a>l?1:0}return i.prototype.push=function(a){this.data.push(a),this.length++,this._up(this.length-1)},i.prototype.pop=function(){if(this.length!==0){var a=this.data[0],l=this.data.pop();return this.length--,this.length>0&&(this.data[0]=l,this._down(0)),a}},i.prototype.peek=function(){return this.data[0]},i.prototype._up=function(a){for(var l=this.data,h=this.compare,p=l[a];a>0;){var m=a-1>>1,g=l[m];if(h(p,g)>=0)break;l[a]=g,a=m}l[a]=p},i.prototype._down=function(a){for(var l=this.data,h=this.compare,p=this.length>>1,m=l[a];a<p;){var g=1+(a<<1),x=l[g],v=g+1;if(v<this.length&&h(l[v],x)<0&&(g=v,x=l[v]),h(x,m)>=0)break;l[a]=x,a=g}l[a]=m},i}()})(Il);var Cl=zr(Il.exports),Ve=8192;function Es(t,e){return e.dist-t.dist}const Kc=100,eu=50;function Lh(t){const e=[1/0,1/0,-1/0,-1/0];if(e.length!==t.length)return!1;for(let i=0;i<e.length;i++)if(e[i]!==t[i])return!1;return!0}function Pl(t){return t[1]-t[0]+1}function Ln(t,e){const i=t[1]>=t[0]&&t[1]<e;return i||console.warn("Distance Expression: Index is out of range"),i}function zl(t,e){if(t[0]>t[1])return[null,null];const i=Pl(t);if(e){if(i===2)return[t,null];const n=Math.floor(i/2);return[[t[0],t[0]+n],[t[0]+n,t[1]]]}{if(i===1)return[t,null];const n=Math.floor(i/2)-1;return[[t[0],t[0]+n],[t[0]+n+1,t[1]]]}}function kn(t,e){const i=[1/0,1/0,-1/0,-1/0];if(!Ln(e,t.length))return i;for(let n=e[0];n<=e[1];++n)ca(i,t[n]);return i}function Dl(t){const e=[1/0,1/0,-1/0,-1/0];for(let i=0;i<t.length;++i)for(let n=0;n<t[i].length;++n)ca(e,t[i][n]);return e}function oo(t,e,i){if(Lh(t)||Lh(e))return NaN;let n=0,a=0;return t[2]<e[0]&&(n=e[0]-t[2]),t[0]>e[2]&&(n=t[0]-e[2]),t[1]>e[3]&&(a=t[1]-e[3]),t[3]<e[1]&&(a=e[1]-t[3]),i.distance([0,0],[n,a])}function Sp(t){return 360*t-180}function Mp(t){return 360/Math.PI*Math.atan(Math.exp((180-360*t)*Math.PI/180)
1)-90}function tu(t,e){const i=Math.pow(2,e.z),n=(t.y/Ve+e.y)/i;return[Sp((t.x/Ve+e.x)/i),Mp(n)]}function Ap(t,e){const i=[];for(let n=0;n<t.length;++n)i.push(tu(t[n],e));return i}function kh(t,e,i){const n=i.pointOnLine(e,t).point;return i.distance(t,n)}function Oh(t,e,i,n,a){const l=i.slice(n[0],n[1]+1);let h=1/0;for(let p=e[0];p<=e[1];++p)if((h=Math.min(h,kh(t[p],l,a)))===0)return 0;return h}function iu(t,e,i,n,a){const l=Math.min(a.pointToSegmentDistance(t,i,n),a.pointToSegmentDistance(e,i,n)),h=Math.min(a.pointToSegmentDistance(i,t,e),a.pointToSegmentDistance(n,t,e));return Math.min(l,h)}function ao(t,e,i,n,a){if(!Ln(e,t.length)||!Ln(n,i.length))return NaN;let l=1/0;for(let h=e[0];h<e[1];++h)for(let p=n[0];p<n[1];++p){if(so(t[h],t[h+1],i[p],i[p+1]))return 0;l=Math.min(l,iu(t[h],t[h+1],i[p],i[p+1],a))}return l}function Bh(t,e,i,n,a){if(!Ln(e,t.length)||!Ln(n,i.length))return NaN;let l=1/0;for(let h=e[0];h<=e[1];++h)for(let p=n[0];p<=n[1];++p)if((l=Math.min(l,a.distance(t[h],i[p])))===0)return l;return l}function Fh(t,e,i){if(ws(t,e,!0))return 0;let n=1/0;for(const a of e){const l=a.length;if(l<2)return console.warn("Distance Expression: Invalid polygon!"),NaN;if(a[0]!==a[l-1]&&(n=Math.min(n,i.pointToSegmentDistance(t,a[l-1],a[0])))===0||(n=Math.min(n,kh(t,a,i)))===0)return n}return n}function Rl(t,e,i,n){if(!Ln(e,t.length))return NaN;for(let l=e[0];l<=e[1];++l)if(ws(t[l],i,!0))return 0;let a=1/0;for(let l=e[0];l<e[1];++l)for(const h of i)for(let p=0,m=h.length,g=m-1;p<m;g=p++){if(so(t[l],t[l+1],h[g],h[p]))return 0;a=Math.min(a,iu(t[l],t[l+1],h[g],h[p],n))}return a}function Nh(t,e){for(const i of t)for(let n=0;n<=i.length-1;++n)if(ws(i[n],e,!0))return!0;return!1}function Ip(t,e,i,n=1/0){const a=Dl(t),l=Dl(e);if(n!==1/0&&oo(a,l,i)>=n)return n;if(ua(a,l)){if(Nh(t,e))return 0}else if(Nh(e,t))return 0;let h=n;for(const p of t)for(let m=0,g=p.length,x=g-1;m<g;x=m++)for(const v of e)for(let w=0,E=v.length,M=E-1;w<E;M=w++){if(so(p[x],p[m],v[M],v[w]))return 0;h=Math.min(h,iu(p[x],p[m],v[M],v[w],i))}return h}function ln(t,e,i,n,a,l,h){if(l===null||h===null)return;const p=oo(kn(n,l),kn(a,h),i);p<e&&t.push({dist:p,range1:l,range2:h})}function Vh(t,e,i,n,a=1/0){let l=Math.min(n.distance(t[0],i[0][0]),a);if(l===0)return l;const h=new Cl([{dist:0,range1:[0,t.length-1],range2:[0,0]}],Es),p=e?eu:Kc,m=Dl(i);for(;h.length;){const g=h.pop();if(g.dist>=l)continue;const x=g.range1;if(Pl(x)<=p){if(!Ln(x,t.length))return NaN;if(e){const v=Rl(t,x,i,n);if((l=Math.min(l,v))===0)return l}else for(let v=x[0];v<=x[1];++v){const w=Fh(t[v],i,n);if((l=Math.min(l,w))===0)return l}}else{const v=zl(x,e);if(v[0]!==null){const w=oo(kn(t,v[0]),m,n);w<l&&h.push({dist:w,range1:v[0],range2:[0,0]})}if(v[1]!==null){const w=oo(kn(t,v[1]),m,n);w<l&&h.push({dist:w,range1:v[1],range2:[0,0]})}}}return l}function Ss(t,e,i,n,a,l=1/0){let h=Math.min(l,a.distance(t[0],i[0]));if(h===0)return h;const p=new Cl([{dist:0,range1:[0,t.length-1],range2:[0,i.length-1]}],Es),m=e?eu:Kc,g=n?eu:Kc;for(;p.length;){const x=p.pop();if(x.dist>=h)continue;const v=x.range1,w=x.range2;if(Pl(v)<=m&&Pl(w)<=g){if(!Ln(v,t.length)||!Ln(w,i.length))return NaN;if(e&&n?h=Math.min(h,ao(t,v,i,w,a)):e||n?e&&!n?h=Math.min(h,Oh(i,w,t,v,a)):!e&&n&&(h=Math.min(h,Oh(t,v,i,w,a))):h=Math.min(h,Bh(t,v,i,w,a)),h===0)return h}else{const E=zl(v,e),M=zl(w,n);ln(p,h,a,t,i,E[0],M[0]),ln(p,h,a,t,i,E[0],M[1]),ln(p,h,a,t,i,E[1],M[0]),ln(p,h,a,t,i,E[1],M[1])}}return h}function ru(t,e,i,n,a=1/0){let l=a;const h=kn(t,[0,t.length-1]);for(const p of i)if(!(l!==1/0&&oo(h,kn(p,[0,p.length-1]),n)>=l)&&(l=Math.min(l,Ss(t,e,p,!0,n,l)),l===0))return l;return l}function Ll(t,e,i,n,a=1/0){let l=a;const h=kn(t,[0,t.length-1]);for(const p of i){if(l!==1/0&&oo(h,Dl(p),n)>=l)continue;const m=Vh(t,e,p,n,l);if(isNaN(m))return m;if((l=Math.min(l,m))===0)return l}return l}function nu(t){return t==="Point"||t==="MultiPoint"||t==="LineString"||t==="MultiLineString"||t==="Polygon"||t==="MultiPolygon"}class Ms{constructor(e,i){this.type=We,this.geojson=e,this.geometries=i}static parse(e,i){if(e.length!==2)return i.error(`'distance' expression requires either one argument, but found ' ${e.length-1} instead.`);if(ro(e[1])){const n=e[1];if(n.type==="FeatureCollection"){for(let a=0;a<n.features.length;++a)if(nu(n.features[a].geometry.type))return new Ms(n,n.features[a].geometry)}else if(n.type==="Feature"){if(nu(n.geometry.type))return new Ms(n,n.geometry)}else if(nu(n.type))return new Ms(n,n)}return i.error("'distance' expression needs to be an array with format ['Distance', GeoJSONObj].")}evaluate(e){const i=e.geometry(),n=e.canonicalID();if(i!=null&&n!=null){if(e.geometryType()==="Point")return function(a,l,h){const p=[];for(const g of a)for(const x of g)p.push(tu(x,l));
1const m=new pa(p[0][1],"meters");return h.type==="Point"||h.type==="MultiPoint"||h.type==="LineString"?Ss(p,!1,h.type==="Point"?[h.coordinates]:h.coordinates,h.type==="LineString",m):h.type==="MultiLineString"?ru(p,!1,h.coordinates,m):h.type==="Polygon"||h.type==="MultiPolygon"?Ll(p,!1,h.type==="Polygon"?[h.coordinates]:h.coordinates,m):null}(i,n,this.geometries);if(e.geometryType()==="LineString")return function(a,l,h){const p=[];for(const g of a){const x=[];for(const v of g)x.push(tu(v,l));p.push(x)}const m=new pa(p[0][0][1],"meters");if(h.type==="Point"||h.type==="MultiPoint"||h.type==="LineString")return ru(h.type==="Point"?[h.coordinates]:h.coordinates,h.type==="LineString",p,m);if(h.type==="MultiLineString"){let g=1/0;for(let x=0;x<h.coordinates.length;x++){const v=ru(h.coordinates[x],!0,p,m,g);if(isNaN(v))return v;if((g=Math.min(g,v))===0)return g}return g}if(h.type==="Polygon"||h.type==="MultiPolygon"){let g=1/0;for(let x=0;x<p.length;x++){const v=Ll(p[x],!0,h.type==="Polygon"?[h.coordinates]:h.coordinates,m,g);if(isNaN(v))return v;if((g=Math.min(g,v))===0)return g}return g}return null}(i,n,this.geometries);if(e.geometryType()==="Polygon")return function(a,l,h){const p=[];for(const g of function(x,v){const w=x.length;if(w<=1)return[x];const E=[];let M,I;for(let z=0;z<w;z++){const D=bp(x[z]);D!==0&&(x[z].area=Math.abs(D),I===void 0&&(I=D<0),I===D<0?(M&&E.push(M),M=[x[z]]):M.push(x[z]))}return M&&E.push(M),E}(a)){const x=[];for(let v=0;v<g.length;++v)x.push(Ap(g[v],l));p.push(x)}
1const m=new pa(p[0][0][0][1],"meters");if(h.type==="Point"||h.type==="MultiPoint"||h.type==="LineString")return Ll(h.type==="Point"?[h.coordinates]:h.coordinates,h.type==="LineString",p,m);if(h.type==="MultiLineString"){let g=1/0;for(let x=0;x<h.coordinates.length;x++){const v=Ll(h.coordinates[x],!0,p,m,g);if(isNaN(v))return v;if((g=Math.min(g,v))===0)return g}return g}return h.type==="Polygon"||h.type==="MultiPolygon"?function(g,x,v){let w=1/0;for(const E of g)for(const M of x){const I=Ip(E,M,v,w);if(isNaN(I))return I;if((w=Math.min(w,I))===0)return w}return w}(h.type==="Polygon"?[h.coordinates]:h.coordinates,p,m):null}(i,n,this.geometries);console.warn("Distance Expression: currently only evaluates valid Point/LineString/Polygon geometries.")}else console.warn("Distance Expression: requirs valid feature and canonical information.");return null}eachChild(){}outputDefined(){return!0}serialize(){return["distance",this.geojson]}}function su(t,e){switch(t){case"string":return qr(e);case"number":return+e;case"boolean":return!!e;case"color":return ti.parse(e);case"formatted":return sr.fromString(qr(e));case"resolvedImage":return Br.fromString(qr(e))}return e}function ou(t,e,i,n){return n!==void 0&&(t=n*Math.round(t/n)),e!==void 0&&t<e&&(t=e),i!==void 0&&t>i&&(t=i),t}class is{constructor(e,i,n){this.type=e,this.key=i,this.scope=n}static parse(e,i){let n=i.expectedType;if(n==null&&(n=Gt),e.length<2||e.length>3)return i.error("Invalid number of arguments for 'config' expression.");const a=i.parse(e[1],1);if(!(a instanceof yn))return i.error("Key name of 'config' expression must be a string literal.");if(e.length>=3){const l=i.parse(e[2],2);return l instanceof yn?new is(n,qr(a.value),qr(l.value)):i.error("Scope of 'config' expression must be a string literal.")}return new is(n,qr(a.value))}evaluate(e){const i=[this.key,this.scope,e.scope].filter(Boolean).join("�"),n=e.getConfig(i);if(!n)return null;const{type:a,value:l,values:h,minValue:p,maxValue:m,stepValue:g}=n,x=n.default.evaluate(e);let v=x;if(l){const w=e.scope;e.scope=(w||"").split("�").slice(1).join("�"),v=l.evaluate(e),e.scope=w}return a&&(v=su(a,v)),v===void 0||p===void 0&&m===void 0&&g===void 0||(typeof v=="number"?v=ou(v,p,m,g):Array.isArray(v)&&(v=v.map(w=>typeof w=="number"?ou(w,p,m,g):w))),l!==void 0&&v!==void 0&&h&&!h.includes(v)&&(v=x,a&&(v=su(a,v))),(a&&a!==this.type||v!==void 0&&Gi(v)!==this.type)&&(v=su(this.type.kind,v)),v}eachChild(){}outputDefined(){return!1}serialize(){const e=["config",this.key];return this.scope&&e.concat(this.key),e}}function rs(t){if(t instanceof Sr&&(t.name==="get"&&t.args.length===1||t.name==="feature-state"||t.name==="has"&&t.args.length===1||t.name==="properties"||t.name==="geometry-type"||t.name==="id"||/^filter-/.test(t.name))||t instanceof Ts||t instanceof Ms)return!1;let e=!0;return t.eachChild(i=>{e&&!rs(i)&&(e=!1)}),e}function fa(t){if(t instanceof Sr&&t.name==="feature-state")return!1;let e=!0;return t.eachChild(i=>{e&&!fa(i)&&(e=!1)}),e}function ma(t){if(t instanceof is)return!1;let e=!0;return t.eachChild(i=>{e&&!ma(i)&&(e=!1)}),e}function _a(t,e){if(t instanceof Sr&&e.indexOf(t.name)>=0)return!1;let i=!0;return t.eachChild(n=>{i&&!_a(n,e)&&(i=!1)}),i}class Fr{constructor(e,i){this.type=i.type,this.name=e,this.boundExpression=i}static parse(e,i){if(e.length!==2||typeof e[1]!="string")return i.error("'var' expression requires exactly one string literal argument.");const n=e[1];return i.scope.has(n)?new Fr(n,i.scope.get(n)):i.error(`Unknown variable "${n}". Make sure "${n}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}serialize(){return["var",this.name]}}class kl{constructor(e,i=[],n,a=new Kn,l=[],h,p){this.registry=e,this.path=i,this.key=i.map(m=>`[${m}]`).join(""),this.scope=a,this.errors=l,this.expectedType=n,this._scope=h,this.options=p}parse(e,i,n,a,l={}){return i||n?this.concat(i,n,a)._parse(e,l):this._parse(e,l)}_parse(e,i){function n(a,l,h){return h==="assert"?new an(l,[a]):h==="coerce"?new Rn(l,[a]):a}if(e!==null&&typeof e!="string"&&typeof e!="boolean"&&typeof e!="number"||(e=["literal",e]),Array.isArray(e)){if(e.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const a=typeof e[0]=="string"?this.registry[e[0]]:void 0;if(a){let l=a.parse(e,this);if(!l)return null;if(this.expectedType){const h=this.expectedType,p=l.type;if(h.kind!=="string"&&h.kind!=="number"&&h.kind!=="boolean"&&h.kind!=="object"&&h.kind!=="array"||p.kind!=="value")if(h.kind!=="color"&&h.kind!=="formatted"&&h.kind!=="resolvedImage"||p.kind!=="value"&&p.kind!=="string"){if(this.checkSubtype(h,p))return null}else l=n(l,h,i.typeAnnotation||"coerce");else l=n(l,h,i.typeAnnotation||"assert")}if(!(l instanceof yn)&&l.type.kind!=="resolvedImage"&&Ol(l)){const h=new $c(this._scope,this.options);try{l=new yn(l.type,l.evaluate(h))}catch(p){return this.error(p.message),null}}return l}return Rn.parse(["to-array",e],this)}return this.error(e===void 0?"'undefined' value invalid. Use null instead.":typeof e=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof e} instead.`)}concat(e,i,n){const a=typeof e=="number"?this.path.concat(e):this.path,l=n?this.scope.concat(n):this.scope;return new kl(this.registry,a,i||null,l,this.errors,this._scope,this.options)}error(e,...i){const n=`${this.key}${i.map(a=>`[${a}]`).join("")}`;this.errors.push(new on(n,e))}checkSubtype(e,i){const n=sa(e,i);return n&&this.error(n),n}}
vendor: 2,371 bytes, line 1
1function Ol(t){if(t instanceof Fr)return Ol(t.boundExpression);if(t instanceof Sr&&t.name==="error"||t instanceof la||t instanceof Ts||t instanceof Ms||t instanceof is)return!1;const e=t instanceof Rn||t instanceof an;let i=!0;return t.eachChild(n=>{i=e?i&&Ol(n):i&&n instanceof yn}),!!i&&rs(t)&&_a(t,["zoom","heatmap-density","line-progress","raster-value","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center","measure-light","raster-particle-speed"])}function Bl(t,e){const i=t.length-1;let n,a,l=0,h=i,p=0;for(;l<=h;)if(p=Math.floor((l+h)/2),n=t[p],a=t[p+1],n<=e){if(p===i||e<a)return p;l=p+1}else{if(!(n>e))throw new Wi("Input is not a number.");h=p-1}return 0}class ga{constructor(e,i,n){this.type=e,this.input=i,this.labels=[],this.outputs=[];for(const[a,l]of n)this.labels.push(a),this.outputs.push(l)}static parse(e,i){if(e.length-1<4)return i.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return i.error("Expected an even number of arguments.");const n=i.parse(e[1],1,We);if(!n)return null;const a=[];let l=null;i.expectedType&&i.expectedType.kind!=="value"&&(l=i.expectedType);for(let h=1;h<e.length;h+=2){const p=h===1?-1/0:e[h],m=e[h+1],g=h,x=h+1;if(typeof p!="number")return i.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',g);if(a.length&&a[a.length-1][0]>=p)return i.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',g);const v=i.parse(m,x,l);if(!v)return null;l=l||v.type,a.push([p,v])}return new ga(l,n,a)}evaluate(e){const i=this.labels,n=this.outputs;if(i.length===1)return n[0].evaluate(e);const a=this.input.evaluate(e);if(a<=i[0])return n[0].evaluate(e);const l=i.length;return a>=i[l-1]?n[l-1].evaluate(e):n[Bl(i,a)].evaluate(e)}eachChild(e){e(this.input);for(const i of this.outputs)e(i)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}serialize(){const e=["step",this.input.serialize()];for(let i=0;i<this.labels.length;i++)i>0&&e.push(this.labels[i]),e.push(this.outputs[i].serialize());return e}}const Uh=.95047,jh=1.08883,Fl=4/29,As=6/29,Gh=3*As*As,qh=As*As*As,Cp=Math.PI/180,Zh=180/Math.PI;function lo(t){return t>qh?Math.pow(t,1/3):t/Gh+Fl}function au(t){return t>As?t*t*t:Gh*(t-Fl)}
vendor: 1,179 bytes, line 1
1function lu(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function cu(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function $h(t){const e=cu(t.r),i=cu(t.g),n=cu(t.b),a=lo((.4124564*e+.3575761*i+.1804375*n)/Uh),l=lo((.2126729*e+.7151522*i+.072175*n)/1);return{l:116*l-16,a:500*(a-l),b:200*(l-lo((.0193339*e+.119192*i+.9503041*n)/jh)),alpha:t.a}}function Wh(t){let e=(t.l+16)/116,i=isNaN(t.a)?e:e+t.a/500,n=isNaN(t.b)?e:e-t.b/200;return e=1*au(e),i=Uh*au(i),n=jh*au(n),new ti(lu(3.2404542*i-1.5371385*e-.4985314*n),lu(-.969266*i+1.8760108*e+.041556*n),lu(.0556434*i-.2040259*e+1.0572252*n),t.alpha)}function Nl(t,e,i){const n=e-t;return t+i*(n>180||n<-180?n-360*Math.round(n/360):n)}const ns={forward:$h,reverse:Wh,interpolate:function(t,e,i){return{l:Ct(t.l,e.l,i),a:Ct(t.a,e.a,i),b:Ct(t.b,e.b,i),alpha:Ct(t.alpha,e.alpha,i)}}},or={forward:function(t){const{l:e,a:i,b:n}=$h(t),a=Math.atan2(n,i)*Zh;return{h:a<0?a+360:a,c:Math.sqrt(i*i+n*n),l:e,alpha:t.a}},reverse:function(t){const e=t.h*Cp,i=t.c;return Wh({l:t.l,a:Math.cos(e)*i,b:Math.sin(e)*i,alpha:t.alpha})},interpolate:function(t,e,i){return{h:Nl(t.h,e.h,i),c:Ct(t.c,e.c,i),l:Ct(t.l,e.l,
vendor: 4,470 bytes, line 1
1i),alpha:Ct(t.alpha,e.alpha,i)}}};var ya=Object.freeze({__proto__:null,hcl:or,lab:ns});class Nr{constructor(e,i,n,a,l){this.type=e,this.operator=i,this.interpolation=n,this.input=a,this.labels=[],this.outputs=[];for(const[h,p]of l)this.labels.push(h),this.outputs.push(p)}static interpolationFactor(e,i,n,a){let l=0;if(e.name==="exponential")l=uu(i,e.base,n,a);else if(e.name==="linear")l=uu(i,1,n,a);else if(e.name==="cubic-bezier"){const h=e.controlPoints;l=new mh(h[0],h[1],h[2],h[3]).solve(uu(i,1,n,a))}return l}static parse(e,i){let[n,a,l,...h]=e;if(!Array.isArray(a)||a.length===0)return i.error("Expected an interpolation type expression.",1);if(a[0]==="linear")a={name:"linear"};else if(a[0]==="exponential"){const g=a[1];if(typeof g!="number")return i.error("Exponential interpolation requires a numeric base.",1,1);a={name:"exponential",base:g}}else{if(a[0]!=="cubic-bezier")return i.error(`Unknown interpolation type ${String(a[0])}`,1,0);{const g=a.slice(1);if(g.length!==4||g.some(x=>typeof x!="number"||x<0||x>1))return i.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);a={name:"cubic-bezier",controlPoints:g}}}if(e.length-1<4)return i.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return i.error("Expected an even number of arguments.");if(l=i.parse(l,2,We),!l)return null;const p=[];let m=null;n==="interpolate-hcl"||n==="interpolate-lab"?m=Or:i.expectedType&&i.expectedType.kind!=="value"&&(m=i.expectedType);for(let g=0;g<h.length;g+=2){const x=h[g],v=h[g+1],w=g+3,E=g+4;if(typeof x!="number")return i.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',w);if(p.length&&p[p.length-1][0]>=x)return i.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',w);const M=i.parse(v,E,m);if(!M)return null;m=m||M.type,p.push([x,M])}return m.kind==="number"||m.kind==="color"||m.kind==="array"&&m.itemType.kind==="number"&&typeof m.N=="number"?new Nr(m,n,a,l,p):i.error(`Type ${Li(m)} is not interpolatable.`)}evaluate(e){const i=this.labels,n=this.outputs;if(i.length===1)return n[0].evaluate(e);const a=this.input.evaluate(e);if(a<=i[0])return n[0].evaluate(e);const l=i.length;if(a>=i[l-1])return n[l-1].evaluate(e);const h=Bl(i,a),p=Nr.interpolationFactor(this.interpolation,a,i[h],i[h+1]),m=n[h].evaluate(e),g=n[h+1].evaluate(e);return this.operator==="interpolate"?ra[this.type.kind.toLowerCase()](m,g,p):this.operator==="interpolate-hcl"?or.reverse(or.interpolate(or.forward(m),or.forward(g),p)):ns.reverse(ns.interpolate(ns.forward(m),ns.forward(g),p))}eachChild(e){e(this.input);for(const i of this.outputs)e(i)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}serialize(){let e;e=this.interpolation.name==="linear"?["linear"]:this.interpolation.name==="exponential"?this.interpolation.base===1?["linear"]:["exponential",this.interpolation.base]:["cubic-bezier"].concat(this.interpolation.controlPoints);const i=[this.operator,e,this.input.serialize()];for(let n=0;n<this.labels.length;n++)i.push(this.labels[n],this.outputs[n].serialize());return i}}function uu(t,e,i,n){const a=n-i,l=t-i;return a===0?0:e===1?l/a:(Math.pow(e,l)-1)/(Math.pow(e,a)-1)}class Vl{constructor(e,i){this.type=e,this.args=i}static parse(e,i){if(e.length<2)return i.error("Expectected at least one argument.");let n=null;const a=i.expectedType;a&&a.kind!=="value"&&(n=a);const l=[];for(const p of e.slice(1)){const m=i.parse(p,1+l.length,n,void 0,{typeAnnotation:"omit"});if(!m)return null;n=n||m.type,l.push(m)}const h=a&&l.some(p=>sa(a,p.type));return new Vl(h?Gt:n,l)}evaluate(e){let i,n=null,a=0;for(const l of this.args){if(a++,n=l.evaluate(e),n&&n instanceof Br&&!n.available&&(i||(i=n),n=null,a===this.args.length))return i;if(n!==null)break}return n}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}serialize(){const e=["coalesce"];return this.eachChild(i=>{e.push(i.serialize())}),e}}class Ul{constructor(e,i){this.type=i.type,this.bindings=[].concat(e),this.result=i}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const i of this.bindings)e(i[1]);e(this.result)}static parse(e,i){if(e.length<4)return i.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);const n=[];for(let l=1;l<e.length-1;l+=2){const h=e[l];
vendor: 5,027 bytes, line 1
1if(typeof h!="string")return i.error(`Expected string, but found ${typeof h} instead.`,l);if(/[^a-zA-Z0-9_]/.test(h))return i.error("Variable names must contain only alphanumeric characters or '_'.",l);const p=i.parse(e[l+1],l+1);if(!p)return null;n.push([h,p])}const a=i.parse(e[e.length-1],e.length-1,i.expectedType,n);return a?new Ul(n,a):null}outputDefined(){return this.result.outputDefined()}serialize(){const e=["let"];for(const[i,n]of this.bindings)e.push(i,n.serialize());return e.push(this.result.serialize()),e}}class xa{constructor(e,i,n){this.type=e,this.index=i,this.input=n}static parse(e,i){if(e.length!==3)return i.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const n=i.parse(e[1],1,We),a=i.parse(e[2],2,Ji(i.expectedType||Gt));return n&&a?new xa(a.type.itemType,n,a):null}evaluate(e){const i=this.index.evaluate(e),n=this.input.evaluate(e);if(i<0)throw new Wi(`Array index out of bounds: ${i} < 0.`);if(i>=n.length)throw new Wi(`Array index out of bounds: ${i} > ${n.length-1}.`);if(i!==Math.floor(i))throw new Wi(`Array index must be an integer, but found ${i} instead.`);return n[i]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}}class hu{constructor(e,i){this.type=Xt,this.needle=e,this.haystack=i}static parse(e,i){if(e.length!==3)return i.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const n=i.parse(e[1],1,Gt),a=i.parse(e[2],2,Gt);return n&&a?oa(n.type,[Xt,Ht,We,zt,Gt])?new hu(n,a):i.error(`Expected first argument to be of type boolean, string, number or null, but found ${Li(n.type)} instead`):null}evaluate(e){const i=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(n==null)return!1;if(!bs(i,["boolean","string","number","null"]))throw new Wi(`Expected first argument to be of type boolean, string, number or null, but found ${Li(Gi(i))} instead.`);if(!bs(n,["string","array"]))throw new Wi(`Expected second argument to be of type array or string, but found ${Li(Gi(n))} instead.`);return n.indexOf(i)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize()]}}class co{constructor(e,i,n){this.type=We,this.needle=e,this.haystack=i,this.fromIndex=n}static parse(e,i){if(e.length<=2||e.length>=5)return i.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const n=i.parse(e[1],1,Gt),a=i.parse(e[2],2,Gt);if(!n||!a)return null;if(!oa(n.type,[Xt,Ht,We,zt,Gt]))return i.error(`Expected first argument to be of type boolean, string, number or null, but found ${Li(n.type)} instead`);if(e.length===4){const l=i.parse(e[3],3,We);return l?new co(n,a,l):null}return new co(n,a)}evaluate(e){const i=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(!bs(i,["boolean","string","number","null"]))throw new Wi(`Expected first argument to be of type boolean, string, number or null, but found ${Li(Gi(i))} instead.`);if(!bs(n,["string","array"]))throw new Wi(`Expected second argument to be of type array or string, but found ${Li(Gi(n))} instead.`);if(this.fromIndex){const a=this.fromIndex.evaluate(e);return n.indexOf(i,a)}return n.indexOf(i)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}serialize(){if(this.fromIndex!=null&&this.fromIndex!==void 0){const e=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),e]}return["index-of",this.needle.serialize(),this.haystack.serialize()]}}class du{constructor(e,i,n,a,l,h){this.inputType=e,this.type=i,this.input=n,this.cases=a,this.outputs=l,this.otherwise=h}static parse(e,i){if(e.length<5)return i.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return i.error("Expected an even number of arguments.");let n,a;i.expectedType&&i.expectedType.kind!=="value"&&(a=i.expectedType);const l={},h=[];for(let g=2;g<e.length-1;g+=2){let x=e[g];const v=e[g+1];Array.isArray(x)||(x=[x]);const w=i.concat(g);if(x.length===0)return w.error("Expected at least one branch label.");for(const M of x){if(typeof M!="number"&&typeof M!="string")return w.error("Branch labels must be numbers or strings.");if(typeof M=="number"&&Math.abs(M)>Number.MAX_SAFE_INTEGER)return w.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof M=="number"&&Math.floor(M)!==M)return w.error("Numeric branch labels must be integer values.");if(n){if(w.checkSubtype(n,Gi(M)))return null}else n=Gi(M);if(l[String(M)]!==void 0)return w.error("Branch labels must be unique.");l[String(M)]=h.length}const E=i.parse(v,g,a);if(!E)return null;a=a||E.type,h.push(E)}const p=i.parse(e[1],1,Gt);if(!p)return null;const m=i.parse(e[e.length-1],e.length-1,a);return m?p.type.kind!=="value"&&i.concat(1).checkSubtype(n,p.type)?null:new du(n,a,p,l,h,m):null}evaluate(e){const i=this.input.evaluate(e);return(Gi(i)===this.inputType&&this.outputs[this.cases[i]]||this.otherwise).evaluate(e)}
vendor: 17,719 bytes, line 1
1eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every(e=>e.outputDefined())&&this.otherwise.outputDefined()}serialize(){const e=["match",this.input.serialize()],i=Object.keys(this.cases).sort(),n=[],a={};for(const h of i){const p=a[this.cases[h]];p===void 0?(a[this.cases[h]]=n.length,n.push([this.cases[h],[h]])):n[p][1].push(h)}const l=h=>this.inputType.kind==="number"?Number(h):h;for(const[h,p]of n)e.push(p.length===1?l(p[0]):p.map(l)),e.push(this.outputs[h].serialize());return e.push(this.otherwise.serialize()),e}}class pu{constructor(e,i,n){this.type=e,this.branches=i,this.otherwise=n}static parse(e,i){if(e.length<4)return i.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return i.error("Expected an odd number of arguments.");let n;i.expectedType&&i.expectedType.kind!=="value"&&(n=i.expectedType);const a=[];for(let h=1;h<e.length-1;h+=2){const p=i.parse(e[h],h,Xt);if(!p)return null;const m=i.parse(e[h+1],h+1,n);if(!m)return null;a.push([p,m]),n=n||m.type}const l=i.parse(e[e.length-1],e.length-1,n);return l?new pu(n,a,l):null}evaluate(e){for(const[i,n]of this.branches)if(i.evaluate(e))return n.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(const[i,n]of this.branches)e(i),e(n);e(this.otherwise)}outputDefined(){return this.branches.every(([e,i])=>i.outputDefined())&&this.otherwise.outputDefined()}serialize(){const e=["case"];return this.eachChild(i=>{e.push(i.serialize())}),e}}class uo{constructor(e,i,n,a){this.type=e,this.input=i,this.beginIndex=n,this.endIndex=a}static parse(e,i){if(e.length<=2||e.length>=5)return i.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const n=i.parse(e[1],1,Gt),a=i.parse(e[2],2,We);if(!n||!a)return null;if(!oa(n.type,[Ji(Gt),Ht,Gt]))return i.error(`Expected first argument to be of type array or string, but found ${Li(n.type)} instead`);if(e.length===4){const l=i.parse(e[3],3,We);return l?new uo(n.type,n,a,l):null}return new uo(n.type,n,a)}evaluate(e){const i=this.input.evaluate(e),n=this.beginIndex.evaluate(e);if(!bs(i,["string","array"]))throw new Wi(`Expected first argument to be of type array or string, but found ${Li(Gi(i))} instead.`);if(this.endIndex){const a=this.endIndex.evaluate(e);return i.slice(n,a)}return i.slice(n)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}serialize(){if(this.endIndex!=null&&this.endIndex!==void 0){const e=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),e]}return["slice",this.input.serialize(),this.beginIndex.serialize()]}}function Qh(t,e){return t==="=="||t==="!="?e.kind==="boolean"||e.kind==="string"||e.kind==="number"||e.kind==="null"||e.kind==="value":e.kind==="string"||e.kind==="number"||e.kind==="value"}function fu(t,e,i,n){return n.compare(e,i)===0}function Is(t,e,i){const n=t!=="=="&&t!=="!=";return class Py{constructor(l,h,p){this.type=Xt,this.lhs=l,this.rhs=h,this.collator=p,this.hasUntypedArgument=l.type.kind==="value"||h.type.kind==="value"}static parse(l,h){if(l.length!==3&&l.length!==4)return h.error("Expected two or three arguments.");const p=l[0];let m=h.parse(l[1],1,Gt);if(!m)return null;if(!Qh(p,m.type))return h.concat(1).error(`"${p}" comparisons are not supported for type '${Li(m.type)}'.`);let g=h.parse(l[2],2,Gt);if(!g)return null;if(!Qh(p,g.type))return h.concat(2).error(`"${p}" comparisons are not supported for type '${Li(g.type)}'.`);if(m.type.kind!==g.type.kind&&m.type.kind!=="value"&&g.type.kind!=="value")return h.error(`Cannot compare types '${Li(m.type)}' and '${Li(g.type)}'.`);n&&(m.type.kind==="value"&&g.type.kind!=="value"?m=new an(g.type,[m]):m.type.kind!=="value"&&g.type.kind==="value"&&(g=new an(m.type,[g])));let x=null;if(l.length===4){if(m.type.kind!=="string"&&g.type.kind!=="string"&&m.type.kind!=="value"&&g.type.kind!=="value")return h.error("Cannot use collator to compare non-string types.");if(x=h.parse(l[3],3,na),!x)return null}return new Py(m,g,x)}evaluate(l){const h=this.lhs.evaluate(l),p=this.rhs.evaluate(l);if(n&&this.hasUntypedArgument){const m=Gi(h),g=Gi(p);if(m.kind!==g.kind||m.kind!=="string"&&m.kind!=="number")throw new Wi(`Expected arguments for "${t}" to be (string, string) or (number, number), but found (${m.kind}, ${g.kind}) instead.`)}if(this.collator&&!n&&this.hasUntypedArgument){const m=Gi(h),g=Gi(p);if(m.kind!=="string"||g.kind!=="string")return e(l,h,p)}return this.collator?i(l,h,p,this.collator.evaluate(l)):e(l,h,p)}eachChild(l){l(this.lhs),l(this.rhs),this.collator&&l(this.collator)}outputDefined(){return!0}serialize(){const l=[t];return this.eachChild(h=>{l.push(h.serialize())}),l}}}const Pp=Is("==",function(t,e,i){return e===i},fu),mu=Is("!=",function(t,e,i){return e!==i},function(t,e,i,n){return!fu(0,e,i,n)}),jl=Is("<",function(t,e,i){return e<i},function(t,e,i,n){return n.compare(e,i)<0}),Hh=Is(">",function(t,e,i){return e>i},function(t,e,i,n){return n.compare(e,i)>0}),zp=Is("<=",function(t,e,i){return e<=i},function(t,e,i,n){return n.compare(e,i)<=0}),Xh=Is(">=",function(t,e,i){return e>=i},function(t,e,i,n){return n.compare(e,i)>=0});class _u{constructor(e,i,n,a,l,h){this.type=Ht,this.number=e,this.locale=i,this.currency=n,this.unit=a,this.minFractionDigits=l,this.maxFractionDigits=h}static parse(e,i){if(e.length!==3)return i.error("Expected two arguments.");const n=i.parse(e[1],1,We);if(!n)return null;const a=e[2];if(typeof a!="object"||Array.isArray(a))return i.error("NumberFormat options argument must be an object.");let l=null;if(a.locale&&(l=i.parse(a.locale,1,Ht),!l))return null;let h=null;if(a.currency&&(h=i.parse(a.currency,1,Ht),!h))return null;let p=null;if(a.unit&&(p=i.parse(a.unit,1,Ht),!p))return null;let m=null;if(a["min-fraction-digits"]&&(m=i.parse(a["min-fraction-digits"],1,We),!m))return null;let g=null;return a["max-fraction-digits"]&&(g=i.parse(a["max-fraction-digits"],1,We),!g)?null:new _u(n,l,h,p,m,g)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:(this.currency?"currency":this.unit&&"unit")||"decimal",currency:this.currency?this.currency.evaluate(e):void 0,unit:this.unit?this.unit.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.unit&&e(this.unit),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}serialize(){const e={};return this.locale&&(e.locale=this.locale.serialize()),this.currency&&(e.currency=this.currency.serialize()),this.unit&&(e.unit=this.unit.serialize()),this.minFractionDigits&&(e["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(e["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),e]}}class va{constructor(e){this.type=We,this.input=e}static parse(e,i){if(e.length!==2)return i.error(`Expected 1 argument, but found ${e.length-1} instead.`);const n=i.parse(e[1],1);return n?n.type.kind!=="array"&&n.type.kind!=="string"&&n.type.kind!=="value"?i.error(`Expected argument of type string or array, but found ${Li(n.type)} instead.`):new va(n):null}evaluate(e){const i=this.input.evaluate(e);if(typeof i=="string"||Array.isArray(i))return i.length;throw new Wi(`Expected value to be of type string or array, but found ${Li(Gi(i))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}serialize(){const e=["length"];return this.eachChild(i=>{e.push(i.serialize())}),e}}function Yh(t){return function(){t=1831565813+(t|=0)|0;let e=Math.imul(t^t>>>15,1|t);return e=e+Math.imul(e^e>>>7,61|e)^e,((e^e>>>14)>>>0)/4294967296}}const ho={"==":Pp,"!=":mu,">":Hh,"<":jl,">=":Xh,"<=":zp,array:an,at:xa,boolean:an,case:pu,coalesce:Vl,collator:la,format:aa,image:no,in:hu,"index-of":co,interpolate:Nr,"interpolate-hcl":Nr,"interpolate-lab":Nr,length:va,let:Ul,literal:yn,match:du,number:an,"number-format":_u,object:an,slice:uo,step:ga,string:an,"to-boolean":Rn,"to-color":Rn,"to-number":Rn,"to-string":Rn,var:Fr,within:Ts,distance:Ms,config:is};function Jh(t,[e,i,n,a]){e=e.evaluate(t),i=i.evaluate(t),n=n.evaluate(t);const l=a?a.evaluate(t):1,h=Ph(e,i,n,l);if(h)throw new Wi(h);return new ti(e/255*l,i/255*l,n/255*l,l)}function Kh(t,[e,i,n,a]){e=e.evaluate(t),i=i.evaluate(t),n=n.evaluate(t);const l=a?a.evaluate(t):1,h=function(g,x,v,w){return typeof g=="number"&&g>=0&&g<=360?typeof x=="number"&&x>=0&&x<=100&&typeof v=="number"&&v>=0&&v<=100?w===void 0||typeof w=="number"&&w>=0&&w<=1?null:`Invalid hsla value [${[g,x,v,w].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid hsla value [${(typeof w=="number"?[g,x,v,w]:[g,x,v]).join(", ")}]: 's', and 'l' must be between 0 and 100.`:`Invalid hsla value [${(typeof w=="number"?[g,x,v,w]:[g,x,v]).join(", ")}]: 'h' must be between 0 and 360.`}(e,i,n,l);if(h)throw new Wi(h);const p=`hsla(${e}, ${i}%, ${n}%, ${l})`,m=ti.parse(p);if(!m)throw new Wi(`Failed to parse HSLA color: ${p}`);return m}function gu(t,e){return t in e}function yu(t,e){const i=e[t];return i===void 0?null:i}function Cs(t){return{type:t}}function ed(t){return{result:"success",value:t}}function Ps(t){return{result:"error",value:t}}function td(t,e){return!!t&&!!t.parameters&&t.parameters.indexOf(e)>-1}function Gl(t){return t["property-type"]==="data-driven"}function id(t){return td(t.expression,"measure-light")}function rd(t){return td(t.expression,"zoom")}function po(t){return!!t.expression&&t.expression.interpolated}function xu(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function Dp(t){return t}function ba(t,e){const i=e.type==="color",n=t.stops&&typeof t.stops[0][0]=="object",a=n||!(n||t.property!==void 0),l=t.type||(po(e)?"exponential":"interval");if(i&&((t=El({},t)).stops&&(t.stops=t.stops.map(g=>[g[0],ti.parse(g[1])])),t.default=ti.parse(t.default?t.default:e.default)),t.colorSpace&&t.colorSpace!=="rgb"&&!ya[t.colorSpace])throw new Error(`Unknown color space: ${t.colorSpace}`);let h,p,m;if(l==="exponential")h=vu;else if(l==="interval")h=Rp;else if(l==="categorical"){h=nd,p=Object.create(null);for(const g of t.stops)p[g[0]]=g[1];m=typeof t.stops[0][0]}else{if(l!=="identity")throw new Error(`Unknown function type "${l}"`);h=sd}if(n){const g={},x=[];for(let E=0;E<t.stops.length;E++){const M=t.stops[E],I=M[0].zoom;g[I]===void 0&&(g[I]={zoom:I,type:t.type,property:t.property,default:t.default,stops:[]},x.push(I)),g[I].stops.push([M[0].value,M[1]])}const v=[];for(const E of x)v.push([g[E].zoom,ba(g[E],e)]);const w={name:"linear"};return{kind:"composite",interpolationType:w,interpolationFactor:Nr.interpolationFactor.bind(void 0,w),zoomStops:v.map(E=>E[0]),evaluate:({zoom:E},M)=>vu({stops:v,base:t.base},e,E).evaluate(E,M)}}if(a){const g=l==="exponential"?{name:"exponential",base:t.base!==void 0?t.base:1}:null;return{kind:"camera",interpolationType:g,interpolationFactor:Nr.interpolationFactor.bind(void 0,g),zoomStops:t.stops.map(x=>x[0]),evaluate:({zoom:x})=>h(t,e,x,p,m)}}return{kind:"source",evaluate(g,x){const v=x&&x.properties?x.properties[t.property]:void 0;return v===void 0?wa(t.default,e.default):h(t,e,v,p,m)}}}function wa(t,e,i){return t!==void 0?t:e!==void 0?e:i!==void 0?i:void 0}function nd(t,e,i,n,a){return wa(typeof i===a?n[i]:void 0,t.default,e.default)}function Rp(t,e,i){if(es(i)!=="number")return wa(t.default,e.default);const n=t.stops.length;if(n===1||i<=t.stops[0][0])return t.stops[0][1];if(i>=t.stops[n-1][0])return t.stops[n-1][1];const a=Bl(t.stops.map(l=>l[0]),i);return t.stops[a][1]}function vu(t,e,i){const n=t.base!==void 0?t.base:1;if(es(i)!=="number")return wa(t.default,e.default);const a=t.stops.length;if(a===1||i<=t.stops[0][0])return t.stops[0][1];if(i>=t.stops[a-1][0])return t.stops[a-1][1];const l=Bl(t.stops.map(x=>x[0]),i),h=function(x,v,w,E){const M=E-w,I=x-w;return M===0?0:v===1?I/M:(Math.pow(v,I)-1)/(Math.pow(v,M)-1)}(i,n,t.stops[l][0],t.stops[l+1][0]),p=t.stops[l][1],m=t.stops[l+1][1];let g=ra[e.type]||Dp;if(t.colorSpace&&t.colorSpace!=="rgb"){const x=ya[t.colorSpace];g=(v,w)=>x.reverse(x.interpolate(x.forward(v),x.forward(w),h))}return typeof p.evaluate=="function"?{evaluate(...x){const v=p.evaluate.apply(void 0,x),w=m.evaluate.apply(void 0,x);if(v!==void 0&&w!==void 0)return g(v,w,h)}}:g(p,m,h)}function sd(t,e,i){return e.type==="color"?i=ti.parse(i):e.type==="formatted"?i=sr.fromString(i.toString()):e.type==="resolvedImage"?i=Br.fromString(i.toString()):es(i)===e.type||e.type==="enum"&&e.values[i]||(i=void 0),wa(i,t.default,e.default)}Sr.register(ho,{error:[{kind:"error"},[Ht],(t,[e])=>{throw new Wi(e.evaluate(t))}],typeof:[Ht,[Gt],(t,[e])=>Li(Gi(e.evaluate(t)))],"to-rgba":[Ji(We,4),[Or],(t,[e])=>e.evaluate(t).toArray()],rgb:[Or,[We,We,We],Jh],rgba:[Or,[We,We,We,We],Jh],hsl:[Or,[We,We,We],Kh],hsla:[Or,[We,We,We,We],Kh],has:{type:Xt,overloads:[[[Ht],(t,[e])=>gu(e.evaluate(t),t.properties())],[[Ht,eo],(t,[e,i])=>gu(e.evaluate(t),i.evaluate(t))]]},get:{type:Gt,overloads:[[[Ht],(t,[e])=>yu(e.evaluate(t),t.properties())],[[Ht,eo],(t,[e,i])=>yu(e.evaluate(t),i.evaluate(t))]]},"feature-state":[Gt,[Ht],(t,[e])=>yu(e.evaluate(t),t.featureState||{})],properties:[eo,[],t=>t.properties()],"geometry-type":[Ht,[],t=>t.geometryType()],id:[Gt,[],t=>t.id()],zoom:[We,[],t=>t.globals.zoom],pitch:[We,[],t=>t.globals.pitch||0],"distance-from-center":[We,[],t=>t.distanceFromCenter()],"measure-light":[We,[Ht],(t,[e])=>t.measureLight(e.evaluate(t))],"heatmap-density":[We,[],t=>t.globals.heatmapDensity||0],"line-progress":[We,[],t=>t.globals.lineProgress||0],"raster-value":[We,[],t=>t.globals.rasterValue||0],"raster-particle-speed":[We,[],t=>t.globals.rasterParticleSpeed||0],"sky-radial-progress":[We,[],t=>t.globals.skyRadialProgress||0],accumulated:[Gt,[],t=>t.globals.accumulated===void 0?null:t.globals.accumulated],"+":[We,Cs(We),(t,e)=>{let i=0;for(const n of e)i+=n.evaluate(t);return i}],"*":[We,Cs(We),(t,e)=>{let i=1;for(const n of e)i*=n.evaluate(t);return i}],"-":{type:We,overloads:[[[We,We],(t,[e,i])=>e.evaluate(t)-i.evaluate(t)],[[We],(t,[e])=>-e.evaluate(t)]]},"/":[We,[We,We],(t,[e,i])=>e.evaluate(t)/i.evaluate(t)],"%":[We,[We,We],(t,[e,i])=>e.evaluate(t)%i.evaluate(t)],ln2:[We,[],()=>Math.LN2],pi:[We,[],()=>Math.PI],e:[We,[],()=>Math.E],"^":[We,[We,We],(t,[e,i])=>Math.pow(e.evaluate(t),i.evaluate(t))],sqrt:[We,[We],(t,[e])=>Math.sqrt(e.evaluate(t))],log10:[We,[We],(t,[e])=>Math.log(e.evaluate(t))/Math.LN10],ln:[We,[We],(t,[e])=>Math.log(e.evaluate(t))],log2:[We,[We],(t,[e])=>Math.log(e.evaluate(t))/Math.LN2],sin:[We,[We],(t,[e])=>Math.sin(e.evaluate(t))],cos:[We,[We],(t,[e])=>Math.cos(e.evaluate(t))],tan:[We,[We],(t,[e])=>Math.tan(e.evaluate(t))],asin:[We,[We],(t,[e])=>Math.asin(e.evaluate(t))],acos:[We,[We],(t,[e])=>Math.acos(e.evaluate(t))],atan:[We,[We],(t,[e])=>Math.atan(e.evaluate(t))],min:[We,Cs(We),(t,e)=>Math.min(...e.map(i=>i.evaluate(t)))],max:[We,Cs(We),(t,e)=>Math.max(...e.map(i=>i.evaluate(t)))],abs:[We,[We],(t,[e])=>Math.abs(e.evaluate(t))],round:[We,[We],(t,[e])=>{const i=e.evaluate(t);return i<0?-Math.round(-i):Math.round(i)}],floor:[We,[We],(t,[e])=>Math.floor(e.evaluate(t))],ceil:[We,[We],(t,[e])=>Math.ceil(e.evaluate(t))],"filter-==":[Xt,[Ht,Gt],(t,[e,i])=>t.properties()[e.value]===i.value],"filter-id-==":[Xt,[Gt],(t,[e])=>t.id()===e.value],"filter-type-==":[Xt,[Ht],(t,[e])=>t.geometryType()===e.value],"filter-<":[Xt,[Ht,Gt],(t,[e,i])=>{const n=t.properties()[e.value],a=i.value;return typeof n==typeof a&&n<a}],"filter-id-<":[Xt,[Gt],(t,[e])=>{const i=t.id(),n=e.value;return typeof i==typeof n&&i<n}],"filter->":[Xt,[Ht,Gt],(t,[e,i])=>{const n=t.properties()[e.value],a=i.value;return typeof n==typeof a&&n>a}],"filter-id->":[Xt,[Gt],(t,[e])=>{const i=t.id(),n=e.value;return typeof i==typeof n&&i>n}],"filter-<=":[Xt,[Ht,Gt],(t,[e,i])=>{const n=t.properties()[e.value],a=i.value;return typeof n==typeof a&&n<=a}],"filter-id-<=":[Xt,[Gt],(t,[e])=>{const i=t.id(),n=e.value;return typeof i==typeof n&&i<=n}],"filter->=":[Xt,[Ht,Gt],(t,[e,i])=>{const n=t.properties()[e.value],a=i.value;return typeof n==typeof a&&n>=a}],"filter-id->=":[Xt,[Gt],(t,[e])=>{const i=t.id(),n=e.value;return typeof i==typeof n&&i>=n}],"filter-has":[Xt,[Gt],(t,[e])=>e.value in t.properties()],"filter-has-id":[Xt,[],t=>t.id()!==null&&t.id()!==void 0],"filter-type-in":[Xt,[Ji(Ht)],(t,[e])=>e.value.indexOf(t.geometryType())>=0],"filter-id-in":[Xt,[Ji(Gt)],(t,[e])=>e.value.indexOf(t.id())>=0],"filter-in-small":[Xt,[Ht,Ji(Gt)],(t,[e,i])=>i.value.indexOf(t.properties()[e.value])>=0],"filter-in-large":[Xt,[Ht,Ji(Gt)],(t,[e,i])=>function(n,a,l,h){for(;l<=h;){const p=l+h>>1;if(a[p]===n)return!0;a[p]>n?h=p-1:l=p+1}return!1}(t.properties()[e.value],i.value,0,i.value.length-1)],all:{type:Xt,overloads:[[[Xt,Xt],(t,[e,i])=>e.evaluate(t)&&i.evaluate(t)],[Cs(Xt),(t,e)=>{for(const i of e)if(!i.evaluate(t))return!1;return!0}]]},any:{type:Xt,overloads:[[[Xt,Xt],(t,[e,i])=>e.evaluate(t)||i.evaluate(t)],[Cs(Xt),(t,e)=>{for(const i of e)if(i.evaluate(t))return!0;return!1}]]},"!":[Xt,[Xt],(t,[e])=>!e.evaluate(t)],"is-supported-script":[Xt,[Ht],(t,[e])=>{const i=t.globals&&t.globals.isSupportedScript;return!i||i(e.evaluate(t))}],upcase:[Ht,[Ht],(t,[e])=>e.evaluate(t).toUpperCase()],downcase:[Ht,[Ht],(t,[e])=>e.evaluate(t).toLowerCase()],concat:[Ht,Cs(Gt),(t,e)=>e.map(i=>qr(i.evaluate(t))).join("")],"resolved-locale":[Ht,[na],(t,[e])=>e.evaluate(t).resolvedLocale()],random:[We,[We,We,Gt],(t,e)=>{const[i,n,a]=e.map(h=>h.evaluate(t));if(i>n||i===n)return i;let l;
1if(typeof a=="string")l=function(h){let p=0;if(h.length===0)return p;for(let m=0;m<h.length;m++)p=(p<<5)-p+h.charCodeAt(m),p|=0;return p}(a);else{if(typeof a!="number")throw new Wi(`Invalid seed input: ${a}`);l=a}return i+Yh(l)()*(n-i)}]});class ql{constructor(e,i,n,a){this.expression=e,this._warningHistory={},this._evaluator=new $c(n,a),this._defaultValue=i?function(l){return l.type==="color"&&(xu(l.default)||Array.isArray(l.default))?new ti(0,0,0,0):l.type==="color"?ti.parse(l.default)||null:l.default===void 0?null:l.default}(i):null,this._enumValues=i&&i.type==="enum"?i.values:null}evaluateWithoutErrorHandling(e,i,n,a,l,h,p,m){return this._evaluator.globals=e,this._evaluator.feature=i,this._evaluator.featureState=n,this._evaluator.canonical=a||null,this._evaluator.availableImages=l||null,this._evaluator.formattedSection=h,this._evaluator.featureTileCoord=p||null,this._evaluator.featureDistanceData=m||null,this.expression.evaluate(this._evaluator)}evaluate(e,i,n,a,l,h,p,m){this._evaluator.globals=e,this._evaluator.feature=i||null,this._evaluator.featureState=n||null,this._evaluator.canonical=a||null,this._evaluator.availableImages=l||null,this._evaluator.formattedSection=h||null,this._evaluator.featureTileCoord=p||null,this._evaluator.featureDistanceData=m||null;try{const g=this.expression.evaluate(this._evaluator);if(g==null||typeof g=="number"&&g!=g)return this._defaultValue;if(this._enumValues&&!(g in this._enumValues))throw new Wi(`Expected value to be one of ${Object.keys(this._enumValues).map(x=>JSON.stringify(x)).join(", ")}, but found ${JSON.stringify(g)} instead.`);return g}catch(g){return this._warningHistory[g.message]||(this._warningHistory[g.message]=!0,typeof console<"u"&&console.warn(g.message)),this._defaultValue}}}function Zl(t){return Array.isArray(t)&&t.length>0&&typeof t[0]=="string"&&t[0]in ho}function fo(t,e,i,n){const a=new kl(ho,[],e?function(h){const p={color:Or,string:Ht,number:We,enum:Ht,boolean:Xt,formatted:to,resolvedImage:io};return h.type==="array"?Ji(p[h.value]||Gt,h.length):p[h.type]}(e):void 0,void 0,void 0,i,n),l=a.parse(t,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return l?ed(new ql(l,e,i,n)):Ps(a.errors)}class Ta{constructor(e,i,n){this.kind=e,this._styleExpression=i,this.isLightConstant=n,this.isStateDependent=e!=="constant"&&!fa(i.expression),this.isConfigDependent=!ma(i.expression)}evaluateWithoutErrorHandling(e,i,n,a,l,h){return this._styleExpression.evaluateWithoutErrorHandling(e,i,n,a,l,h)}evaluate(e,i,n,a,l,h){return this._styleExpression.evaluate(e,i,n,a,l,h)}}class Ea{constructor(e,i,n,a,l){this.kind=e,this.zoomStops=n,this._styleExpression=i,this.isStateDependent=e!=="camera"&&!fa(i.expression),this.isLightConstant=l,this.isConfigDependent=!ma(i.expression),this.interpolationType=a}evaluateWithoutErrorHandling(e,i,n,a,l,h){return this._styleExpression.evaluateWithoutErrorHandling(e,i,n,a,l,h)}evaluate(e,i,n,a,l,h){return this._styleExpression.evaluate(e,i,n,a,l,h)}interpolationFactor(e,i,n){return this.interpolationType?Nr.interpolationFactor(this.interpolationType,e,i,n):0}}function od(t,e,i,n){if((t=fo(t,e,i,n)).result==="error")return t;const a=t.value.expression,l=rs(a);if(!l&&!Gl(e))return Ps([new on("","data expressions not supported")]);const h=_a(a,["zoom","pitch","distance-from-center"]);if(!h&&!rd(e))return Ps([new on("","zoom expressions not supported")]);const p=_a(a,["measure-light"]);if(!p&&!id(e))return Ps([new on("","measure-light expression not supported")]);const m=e.expression&&e.expression.relaxZoomRestriction,g=$l(a);return g||h||m?g instanceof on?Ps([g]):g instanceof Nr&&!po(e)?Ps([new on("",'"interpolate" expressions cannot be used with this property')]):ed(g?new Ea(l?"camera":"composite",t.value,g.labels,g instanceof Nr?g.interpolation:void 0,p):new Ta(l?"constant":"source",t.value,p)):Ps([new on("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression, or in the properties of atmosphere.')])}class Sa{constructor(e,i){this._parameters=e,this._specification=i,El(this,ba(this._parameters,this._specification))}static deserialize(e){return new Sa(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function $l(t){let e=null;if(t instanceof Ul)e=$l(t.result);else if(t instanceof Vl){for(const i of t.args)if(e=$l(i),e)break}else(t instanceof ga||t instanceof Nr)&&t.input instanceof Sr&&t.input.name==="zoom"&&(e=t);return e instanceof on||t.eachChild(i=>{const n=$l(i);n instanceof on?e=n:e&&n&&e!==n&&(e=new on("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}var ad=xn,ss=3;function xn(t,e,i){var n=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;var a=new Int32Array(this.arrayBuffer);t=a[0],this.d=(e=a[1])+2*(i=a[2]);for(var l=0;l<this.d*this.d;l++){var h=a[ss+l],p=a[ss+l+1];n.push(h===p?null:a.subarray(h,p))}var m=a[ss+n.length+1];this.keys=a.subarray(a[ss+n.length],m),this.bboxes=a.subarray(m),this.insert=this._insertReadonly}else{this.d=e+2*i;for(var g=0;g<this.d*this.d;g++)n.push([]);this.keys=[],this.bboxes=[]}this.n=e,this.extent=t,this.padding=i,this.scale=e/t,this.uid=0;var x=i/e*t;this.min=-x,this.max=t+x}
1xn.prototype.insert=function(t,e,i,n,a){this._forEachCell(e,i,n,a,this._insertCell,this.uid++),this.keys.push(t),this.bboxes.push(e),this.bboxes.push(i),this.bboxes.push(n),this.bboxes.push(a)},xn.prototype._insertReadonly=function(){throw"Cannot insert into a GridIndex created from an ArrayBuffer."},xn.prototype._insertCell=function(t,e,i,n,a,l){this.cells[a].push(l)},xn.prototype.query=function(t,e,i,n,a){var l=this.min,h=this.max;if(t<=l&&e<=l&&h<=i&&h<=n&&!a)return Array.prototype.slice.call(this.keys);var p=[];return this._forEachCell(t,e,i,n,this._queryCell,p,{},a),p},xn.prototype._queryCell=function(t,e,i,n,a,l,h,p){var m=this.cells[a];if(m!==null)for(var g=this.keys,x=this.bboxes,v=0;v<m.length;v++){var w=m[v];if(h[w]===void 0){var E=4*w;(p?p(x[E+0],x[E+1],x[E+2],x[E+3]):t<=x[E+2]&&e<=x[E+3]&&i>=x[E+0]&&n>=x[E+1])?(h[w]=!0,l.push(g[w])):h[w]=!1}}},xn.prototype._forEachCell=function(t,e,i,n,a,l,h,p){for(var m=this._convertToCellCoord(t),g=this._convertToCellCoord(e),x=this._convertToCellCoord(i),v=this._convertToCellCoord(n),w=m;w<=x;w++)for(var E=g;E<=v;E++){var M=this.d*E+w;if((!p||p(this._convertFromCellCoord(w),this._convertFromCellCoord(E),this._convertFromCellCoord(w+1),this._convertFromCellCoord(E+1)))&&a.call(this,t,e,i,n,M,l,h,p))return}},xn.prototype._convertFromCellCoord=function(t){return(t-this.padding)/this.scale},xn.prototype._convertToCellCoord=function(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))},xn.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var t=this.cells,e=ss+this.cells.length+1+1,i=0,n=0;n<this.cells.length;n++)i+=this.cells[n].length;var a=new Int32Array(e+i+this.keys.length+this.bboxes.length);a[0]=this.extent,a[1]=this.n,a[2]=this.padding;for(var l=e,h=0;h<t.length;h++){var p=t[h];a[ss+h]=l,a.set(p,l),l+=p.length}return a[ss+t.length]=l,a.set(this.keys,l),a[ss+t.length+1]=l+=this.keys.length,a.set(this.bboxes,l),l+=this.bboxes.length,a.buffer};var mo=zr(ad);const Wl={};function Qe(t,e,i={}){Object.defineProperty(t,"_classRegistryKey",{value:e,writeable:!1}),Wl[e]={klass:t,omit:i.omit||[]}}Qe(Object,"Object"),mo.serialize=function(t,e){const i=t.toArrayBuffer();return e&&e.add(i),{buffer:i}},mo.deserialize=function(t){return new mo(t.buffer)},Object.defineProperty(mo,"name",{value:"Grid"}),Qe(mo,"Grid"),Qe(ti,"Color"),Qe(Error,"Error"),Qe(sr,"Formatted"),Qe(Sl,"FormattedSection"),Qe(pl,"AJAXError"),Qe(Br,"ResolvedImage"),Qe(Sa,"StylePropertyFunction"),Qe(ql,"StyleExpression",{omit:["_evaluator"]}),Qe(Ea,"ZoomDependentExpression"),Qe(Ta,"ZoomConstantExpression"),Qe(Sr,"CompoundExpression",{omit:["_evaluate"]});for(const t in ho)Wl[ho[t]._classRegistryKey]||Qe(ho[t],`Expression${t}`);function ld(t){return t&&typeof ArrayBuffer<"u"&&(t instanceof ArrayBuffer||t.constructor&&t.constructor.name==="ArrayBuffer")}function cd(t){return self.ImageBitmap&&t instanceof ImageBitmap}function Ma(t,e){if(t==null||typeof t=="boolean"||typeof t=="number"||typeof t=="string"||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp)return t;if(ld(t)||cd(t))return e&&e.add(t),t;if(ArrayBuffer.isView(t)){const i=t;return e&&e.add(i.buffer),i}if(t instanceof ImageData)return e&&e.add(t.data.buffer),t;if(Array.isArray(t)){const i=[];for(const n of t)i.push(Ma(n,e));return i}if(t instanceof Map){const i={$name:"Map"};for(const[n,a]of t.entries())i[n]=Ma(a);return i}if(typeof t=="object"){const i=t.constructor,n=i._classRegistryKey;if(!n)throw new Error(`can't serialize object of unregistered class ${n}`);const a=i.serialize?i.serialize(t,e):{};if(!i.serialize){for(const l in t)t.hasOwnProperty(l)&&(Wl[n].omit.indexOf(l)>=0||(a[l]=Ma(t[l],e)));t instanceof Error&&(a.message=t.message)}if(a.$name)throw new Error("$name property is reserved for worker serialization logic.");return n!=="Object"&&(a.$name=n),a}throw new Error("can't serialize object of type "+typeof t)}function c(t){if(t==null||typeof t=="boolean"||typeof t=="number"||typeof t=="string"||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp||ld(t)||cd(t)||ArrayBuffer.isView(t)||t instanceof ImageData)return t;if(Array.isArray(t))return t.map(c);if(typeof t=="object"){const e=t.$name||"Object";if(e==="Map"){const a=new Map;for(const l of Object.keys(t))l!=="$name"&&a.set(l,c(t[l]));return a}const{klass:i}=Wl[e];if(!i)throw new Error(`can't deserialize unregistered class ${e}`);if(i.deserialize)return i.deserialize(t);const n=Object.create(i.prototype);for(const a of Object.keys(t))a!=="$name"&&(n[a]=c(t[a]));return n}throw new Error("can't deserialize object of type "+typeof t)}const r={"Latin-1 Supplement":t=>t>=128&&t<=255,Arabic:t=>t>=1536&&t<=1791,"Arabic Supplement":t=>t>=1872&&t<=1919,"Arabic Extended-A":t=>t>=2208&&t<=2303,"Hangul Jamo":t=>t>=4352&&t<=4607,"Unified Canadian Aboriginal Syllabics":t=>t>=5120&&t<=5759,Khmer:t=>t>=6016&&t<=6143,"Unified Canadian Aboriginal Syllabics Extended":t=>t>=6320&&t<=6399,"General Punctuation":t=>t>=8192&&t<=8303,"Letterlike Symbols":t=>t>=8448&&t<=8527,"Number Forms":t=>t>=8528&&t<=8591,"Miscellaneous Technical":t=>t>=8960&&t<=9215,"Control Pictures":t=>t>=9216&&t<=9279,"Optical Character Recognition":t=>t>=9280&&t<=9311,"Enclosed Alphanumerics":t=>t>=9312&&t<=9471,"Geometric Shapes":t=>t>=9632&&t<=9727,"Miscellaneous Symbols":t=>t>=9728&&t<=9983,"Miscellaneous Symbols and Arrows":t=>t>=11008&&t<=11263,"CJK Radicals Supplement":t=>t>=11904&&t<=12031,"Kangxi Radicals":t=>t>=12032&&t<=12255,"Ideographic Description Characters":t=>t>=12272&&t<=12287,"CJK Symbols and Punctuation":t=>t>=12288&&t<=12351,Hiragana:t=>t>=12352&&t<=12447,Katakana:t=>t>=12448&&t<=12543,Bopomofo:t=>t>=12544&&t<=12591,"Hangul Compatibility Jamo":t=>t>=12592&&t<=12687,Kanbun:t=>t>=12688&&t<=12703,"Bopomofo Extended":t=>t>=12704&&t<=12735,"CJK Strokes":t=>t>
1=12736&&t<=12783,"Katakana Phonetic Extensions":t=>t>=12784&&t<=12799,"Enclosed CJK Letters and Months":t=>t>=12800&&t<=13055,"CJK Compatibility":t=>t>=13056&&t<=13311,"CJK Unified Ideographs Extension A":t=>t>=13312&&t<=19903,"Yijing Hexagram Symbols":t=>t>=19904&&t<=19967,"CJK Unified Ideographs":t=>t>=19968&&t<=40959,"Yi Syllables":t=>t>=40960&&t<=42127,"Yi Radicals":t=>t>=42128&&t<=42191,"Hangul Jamo Extended-A":t=>t>=43360&&t<=43391,"Hangul Syllables":t=>t>=44032&&t<=55215,"Hangul Jamo Extended-B":t=>t>=55216&&t<=55295,"Private Use Area":t=>t>=57344&&t<=63743,"CJK Compatibility Ideographs":t=>t>=63744&&t<=64255,"Arabic Presentation Forms-A":t=>t>=64336&&t<=65023,"Vertical Forms":t=>t>=65040&&t<=65055,"CJK Compatibility Forms":t=>t>=65072&&t<=65103,"Small Form Variants":t=>t>=65104&&t<=65135,"Arabic Presentation Forms-B":t=>t>=65136&&t<=65279,"Halfwidth and Fullwidth Forms":t=>t>=65280&&t<=65519,"CJK Unified Ideographs Extension B":t=>t>=131072&&t<=173791};function s(t){for(const e of t)if(f(e.charCodeAt(0)))return!0;return!1}function u(t){for(const e of t)if(!d(e.charCodeAt(0)))return!1;return!0}function d(t){return!(r.Arabic(t)||r["Arabic Supplement"](t)||r["Arabic Extended-A"](t)||r["Arabic Presentation Forms-A"](t)||r["Arabic Presentation Forms-B"](t))}function f(t){return!(t!==746&&t!==747&&(t<4352||!(r["Bopomofo Extended"](t)||r.Bopomofo(t)||r["CJK Compatibility Forms"](t)&&!(t>=65097&&t<=65103)||r["CJK Compatibility Ideographs"](t)||r["CJK Compatibility"](t)||r["CJK Radicals Supplement"](t)||r["CJK Strokes"](t)||!(!r["CJK Symbols and Punctuation"](t)||t>=12296&&t<=12305||t>=12308&&t<=12319||t===12336)||r["CJK Unified Ideographs Extension A"](t)||r["CJK Unified Ideographs"](t)||r["Enclosed CJK Letters and Months"](t)||r["Hangul Compatibility Jamo"](t)||r["Hangul Jamo Extended-A"](t)||r["Hangul Jamo Extended-B"](t)||r["Hangul Jamo"](t)||r["Hangul Syllables"](t)||r.Hiragana(t)||r["Ideographic Description Characters"](t)||r.Kanbun(t)||r["Kangxi Radicals"](t)||r["Katakana Phonetic Extensions"](t)||r.Katakana(t)&&t!==12540||!(!r["Halfwidth and Fullwidth Forms"](t)||t===65288||t===65289||t===65293||t>=65306&&t<=65310||t===65339||t===65341||t===65343||t>=65371&&t<=65503||t===65507||t>=65512&&t<=65519)||!(!r["Small Form Variants"](t)||t>=65112&&t<=65118||t>=65123&&t<=65126)||r["Unified Canadian Aboriginal Syllabics"](t)||r["Unified Canadian Aboriginal Syllabics Extended"](t)||r["Vertical Forms"](t)||r["Yijing Hexagram Symbols"](t)||r["Yi Syllables"](t)||r["Yi Radicals"](t))))}function _(t){return!(f(t)||function(e){return!!(r["Latin-1 Supplement"](e)&&(e===167||e===169||e===174||e===177||e===188||e===189||e===190||e===215||e===247)||r["General Punctuation"](e)&&(e===8214||e===8224||e===8225||e===8240||e===8241||e===8251||e===8252||e===8258||e===8263||e===8264||e===8265||e===8273)||r["Letterlike Symbols"](e)||r["Number Forms"](e)||r["Miscellaneous Technical"](e)&&(e>=8960&&e<=8967||e>=8972&&e<=8991||e>=8996&&e<=9e3||e===9003||e>=9085&&e<=9114||e>=9150&&e<=9165||e===9167||e>=9169&&e<=9179||e>=9186&&e<=9215)||r["Control Pictures"](e)&&e!==9251||r["Optical Character Recognition"](e)||r["Enclosed Alphanumerics"](e)||r["Geometric Shapes"](e)||r["Miscellaneous Symbols"](e)&&!(e>=9754&&e<=9759)||r["Miscellaneous Symbols and Arrows"](e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||r["CJK Symbols and Punctuation"](e)||r.Katakana(e)||r["Private Use Area"](e)||r["CJK Compatibility Forms"](e)||r["Small Form Variants"](e)||r["Halfwidth and Fullwidth Forms"](e)||e===8734||e===8756||e===8757||e>=9984&&e<=10087||e>=10102&&e<=10131||e===65532||e===65533)}(t))}function y(t){return t>=1424&&t<=2303||r["Arabic Presentation Forms-A"](t)||r["Arabic Presentation Forms-B"](t)}function b(t,e){return!(!e&&y(t)||t>=2304&&t<=3583||t>=3840&&t<=4255||r.Khmer(t))}function T(t){for(const e of t)if(y(e.charCodeAt(0)))return!0;return!1}const S="deferred",A="loading",C="loaded";let P=null,L="unavailable",R=null;const k=function(t){t&&typeof t=="string"&&t.indexOf("NetworkError")>-1&&(L="error"),P&&P(t)};function O(){N.fire(new Jn("pluginStateChange",{pluginStatus:L,pluginURL:R}))}const N=new vs,$=function(){return L},Z=function(){if(L!==S||!R)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");L=A,O(),R&&Ho({url:R},t=>{t?k(t):(L=C,O())})},Q={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>L===C||Q.applyArabicShaping!=null,isLoading:()=>L===A,setState(t){L=t.pluginStatus,R=t.pluginURL},isParsed:()=>Q.applyArabicShaping!=null&&Q.processBidirectionalText!=null&&Q.processStyledBidirectionalText!=null,getPluginURL:()=>R};class B{constructor(e,i){this.zoom=e,i?(this.now=i.now,this.fadeDuration=i.fadeDuration,this.transition=i.transition,this.pitch=i.pitch,this.brightness=i.brightness):(this.now=0,this.fadeDuration=0,this.transition={},this.pitch=0,this.brightness=0)}isSupportedScript(e){return function(i,n){for(const a of i)if(!b(a.charCo
vendor: 12,721 bytes, line 1
1deAt(0),n))return!1;return!0}(e,Q.isLoaded())}}class U{constructor(e,i,n,a){this.property=e,this.value=i,this.expression=function(l,h,p,m){if(xu(l))return new Sa(l,h);if(Zl(l)||Array.isArray(l)&&l.length>0){const g=od(l,h,p,m);if(g.result==="error")throw new Error(g.value.map(x=>`${x.key}: ${x.message}`).join(", "));return g.value}{let g=l;return typeof l=="string"&&h.type==="color"&&(g=ti.parse(l)),{kind:"constant",isConfigDependent:!1,evaluate:()=>g}}}(i===void 0?e.specification.default:i,e.specification,n,a)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(e,i,n){return this.property.possiblyEvaluate(this,e,i,n)}}class K{constructor(e,i,n){this.property=e,this.value=new U(e,void 0,i,n)}transitioned(e,i){return new re(this.property,this.value,i,Gr({},e.transition,this.transition),e.now)}untransitioned(){return new re(this.property,this.value,null,{},0)}}class Y{constructor(e,i,n){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues),this._scope=i,this._options=n,this.isConfigDependent=!1}getValue(e){return Pn(this._values[e].value.value)}setValue(e,i){this._values.hasOwnProperty(e)||(this._values[e]=new K(this._values[e].property,this._scope,this._options)),this._values[e].value=new U(this._values[e].property,i===null?void 0:Pn(i),this._scope,this._options),this.isConfigDependent=this.isConfigDependent||this._values[e].value.expression.isConfigDependent}setTransitionOrValue(e,i){i&&(this._options=i);const n=this._properties.properties;if(e)for(const a in e){const l=e[a];if(_s(a,"-transition")){const h=a.slice(0,-11);n[h]&&this.setTransition(h,l)}else n[a]&&this.setValue(a,l)}}getTransition(e){return Pn(this._values[e].transition)}setTransition(e,i){this._values.hasOwnProperty(e)||(this._values[e]=new K(this._values[e].property)),this._values[e].transition=Pn(i)||void 0}serialize(){const e={};for(const i of Object.keys(this._values)){const n=this.getValue(i);n!==void 0&&(e[i]=n);const a=this.getTransition(i);a!==void 0&&(e[`${i}-transition`]=a)}return e}transitioned(e,i){const n=new he(this._properties);for(const a of Object.keys(this._values))n._values[a]=this._values[a].transitioned(e,i._values[a]);return n}untransitioned(){const e=new he(this._properties);for(const i of Object.keys(this._values))e._values[i]=this._values[i].untransitioned();return e}}class re{constructor(e,i,n,a,l){const h=a.delay||0,p=a.duration||0;l=l||0,this.property=e,this.value=i,this.begin=l+h,this.end=this.begin+p,e.specification.transition&&(a.delay||a.duration)&&(this.prior=n)}possiblyEvaluate(e,i,n){const a=e.now||0,l=this.value.possiblyEvaluate(e,i,n),h=this.prior;if(h){if(a>this.end)return this.prior=null,l;if(this.value.isDataDriven())return this.prior=null,l;if(a<this.begin)return h.possiblyEvaluate(e,i,n);{const p=(a-this.begin)/(this.end-this.begin);return this.property.interpolate(h.possiblyEvaluate(e,i,n),l,tl(p))}}return l}}class he{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,i,n){const a=new pe(this._properties);for(const l of Object.keys(this._values))a._values[l]=this._values[l].possiblyEvaluate(e,i,n);return a}hasTransition(){for(const e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class ie{constructor(e,i,n){this._properties=e,this._values=Object.create(e.defaultPropertyValues),this._scope=i,this._options=n,this.isConfigDependent=!1}getValue(e){return Pn(this._values[e].value)}setValue(e,i){this._values[e]=new U(this._values[e].property,i===null?void 0:Pn(i),this._scope,this._options),this.isConfigDependent=this.isConfigDependent||this._values[e].expression.isConfigDependent}serialize(){const e={};for(const i of Object.keys(this._values)){const n=this.getValue(i);n!==void 0&&(e[i]=n)}return e}possiblyEvaluate(e,i,n){const a=new pe(this._properties);for(const l of Object.keys(this._values))a._values[l]=this._values[l].possiblyEvaluate(e,i,n);return a}}class ce{constructor(e,i,n){this.property=e,this.value=i,this.parameters=n}isConstant(){return this.value.kind==="constant"}constantOr(e){return this.value.kind==="constant"?this.value.value:e}evaluate(e,i,n,a){return this.property.evaluate(this.value,this.parameters,e,i,n,a)}}class pe{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class te{constructor(e){this.specification=e}possiblyEvaluate(e,i){return e.expression.evaluate(i)}interpolate(e,i,n){const a=ra[this.specification.type];return a?a(e,i,n):e}}class ae{constructor(e,i){this.specification=e,this.overrides=i}possiblyEvaluate(e,i,n,a){return new ce(this,e.expression.kind==="constant"||e.expression.kind==="camera"?{kind:"constant",value:e.expression.evaluate(i,null,{},n,a)}:e.expression,i)}interpolate(e,i,n){if(e.value.kind!=="constant"||i.value.kind!=="constant")return e;if(e.value.value===void 0||i.value.value===void 0)return new ce(this,{kind:"constant",value:void 0},e.parameters);const a=ra[this.specification.type];return a?new ce(this,{kind:"constant",value:a(e.value.value,i.value.value,n)},e.parameters):e}evaluate(e,i,n,a,l,h){return e.kind==="constant"?e.value:e.evaluate(i,n,a,l,h)}}class Me{constructor(e){this.specification=e}possiblyEvaluate(e,i,n,a){return!!e.expression.evaluate(i,null,{},n,a)}interpolate(){return!1}}class se{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];const i=new B(0,{});for(const n in e){const a=e[n];a.specification.overridable&&this.overridableProperties.push(n);const l=this.defaultPropertyValues[n]=new U(a,void 0),h=this.defaultTransitionablePropertyValues[n]=new K(a);this.defaultTransitioningPropertyValues[n]=h.untransitioned(),this.defaultPossiblyEvaluatedValues[n]=l.possiblyEvaluate(i)}}}function ue(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}function de(t){if(Array.isArray(t))return t.map(de);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){const e={};for(const i in t)e[i]=de(t[i]);return e}return ue(t)}Qe(ae,"DataDrivenProperty"),Qe(te,"DataConstantProperty"),Qe(Me,"ColorRampProperty");var W=JSON.parse('{"$version":8,"$root":{"version":{"required":true,"type":"enum","values":[8]},"fragment":{"type":"boolean"},"name":{"type":"string"},"metadata":{"type":"*"},"center":{"type":"array","value":"number"},"zoom":{"type":"number"},"bearing":{"type":"number","default":0,"period":360},"pitch":{"type":"number","default":0},"light":{"type":"light"},"lights":{"required":false,"type":"array","value":"light-3d"},"terrain":{"type":"terrain","optional":true},"fog":{"type":"fog"},"camera":{"type":"camera"},"imports":{"type":"array","value":"import"},"schema":{"type":"schema"},"sources":{"required":true,"type":"sources"},"sprite":{"type":"string"},"glyphs":{"type":"string","default":"mapbox://fonts/mapbox/{fontstack}/{range}.pbf"},"transition":{"type":"transition"},"projection":{"type":"projection"},"layers":{"required":true,"type":"array","value":"layer"},"models":{"type":"models"}},"model":{"type":"string","required":true},"import":{"id":{"type":"string","required":true},"url":{"type":"string","required":true},"config":{"type":"config"},"data":{"type":"$root"}},"config":{"*":{"type":"*"}},"schema":{"*":{"type":"option"}},"option":{"default":{"type":"*","required":true},"type":{"type":"enum","values":{"string":1,"number":1,"boolean":1,"color":1}},"array":{"type":"boolean"},"minValue":{"type":"number"},"maxValue":{"type":"number"},"stepValue":{"type":"number"},"values":{"type":"array","value":"*"},"metadata":{"type":"*"}},"models":{"*":{"type":"model"}},"light-3d":{"id":{"type":"string","required":true},"properties":{"type":"properties"},"type":{"type":"enum","values":{"ambient":{},"directional":{},"flat":{}}}},"properties":["properties_light_directional","properties_light_ambient","properties_light_flat"],"properties_light_directional":{"direction":{"type":"array","default":[210,30],"minimum":[0,0],"maximum":[360,90],"length":2,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"intensity":{"type":"number","property-type":"data-constant","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"cast-shadows":{"type":"boolean","default":false,"expression":{},"property-type":"data-constant"},"shadow-intensity":{"type":"number","property-type":"data-constant","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"properties_light_ambient":{"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"intensity":{"type":"number","property-type":"data-constant","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"properties_light_flat":{"anchor":{"type":"enum","default":"viewport","values":{"map":1,"viewport":1},"property-type":"data-constant","expression":{"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"intensity":{"type":"number","property-type":"data-constant","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"sources":{"*":{"type":"source"}},"source":["source_vector","source_raster","source_raster_dem","source_raster_array","source_geojson","source_video","source_image","source_model"],"source_vector":{"type":{"required":true,"type":"enum","values":{"vector":1}},"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":1,"tms":1},"default":"xyz"},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"attribution":{"type":"string"},"promoteId":{"type":"promoteId"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster":{"type":{"required":true,"type":"enum","values":{"raster":1}},"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},"scheme":{"type":"enum","values":{"xyz":1,"tms":1},"default":"xyz"},"attribution":{"type":"string"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster_dem":{"type":{"required":true,"type":"enum","values":{"raster-dem":1}},"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},"attribution":{"type":"string"},"encoding":{"type":"enum","values":{"terrarium":1,"mapbox":1},"default":"mapbox"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster_array":{"type":{"required":true,"type":"enum","values":{"raster-array":1}},"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},"attribution":{"type":"string"},"rasterLayers":{"type":"*"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_geojson":{"type":{"required":true,"type":"enum","values":{"geojson":1}},"data":{"type":"*"},"maxzoom":{"type":"number","default":18},"minzoom":{"type":"number","default":0},"attribution":{"type":"string"},"buffer":{"type":"number","default":128,"maximum":512,"minimum":0},"filter":{"type":"*"},"tolerance":{"type":"number","default":0.375},"cluster":{"type":"boolean","default":false},"clusterRadius":{"type":"number","default":50,"minimum":0}
1,"clusterMaxZoom":{"type":"number"},"clusterMinPoints":{"type":"number"},"clusterProperties":{"type":"*"},"lineMetrics":{"type":"boolean","default":false},"generateId":{"type":"boolean","default":false},"promoteId":{"type":"promoteId"},"dynamic":{"type":"boolean","default":false}},"source_video":{"type":{"required":true,"type":"enum","values":{"video":1}},"urls":{"required":true,"type":"array","value":"string"},"coordinates":{"required":true,"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"source_image":{"type":{"required":true,"type":"enum","values":{"image":1}},"url":{"required":false,"type":"string"},"coordinates":{"required":true,"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"source_model":{"type":{"required":true,"type":"enum","values":{"model":1,"batched-model":1}},"maxzoom":{"type":"number","default":18},"minzoom":{"type":"number","default":0},"tiles":{"type":"array","value":"string"}},"layer":{"id":{"type":"string","required":true},"type":{"type":"enum","values":{"fill":{},"line":{},"symbol":{},"circle":{},"heatmap":{},"fill-extrusion":{},"raster":{},"raster-particle":{},"hillshade":{},"model":{},"background":{},"sky":{},"slot":{}},"required":true},"metadata":{"type":"*"},"source":{"type":"string"},"source-layer":{"type":"string"},"slot":{"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_raster-particle","layout_hillshade","layout_background","layout_sky","layout_model"],"layout_background":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_sky":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_model":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"},"model-id":{"type":"string","default":"","property-type":"data-driven","expression":{"parameters":["zoom","feature"]}}},"layout_fill":{"fill-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_circle":{"circle-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_heatmap":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_fill-extrusion":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"},"fill-extrusion-edge-radius":{"type":"number","private":true,"default":0,"minimum":0,"maximum":1,"expression":{},"property-type":"constant"}},"layout_line":{"line-cap":{"type":"enum","values":{"butt":1,"round":1,"square":1},"default":"butt","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-join":{"type":"enum","values":{"bevel":1,"round":1,"miter":1,"none":1},"default":"miter","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{"type":"number","default":2,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-round-limit":{"type":"number","default":1.05,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_symbol":{"symbol-placement":{"type":"enum","values":{"point":1,"line":1,"line-center":1},"default":"point","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"symbol-spacing":{"type":"number","default":250,"minimum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{"type":"enum","values":{"auto":1,"viewport-y":1,"source":1},"default":"auto","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"symbol-z-elevate":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-optional":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-size":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{"type":"enum","values":{"none":1,"width":1,"height":1,"both":1},"default":"none","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit-padding":{"type":"array","value":"number","length":4,"default":[0,0,0,0],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-image":{"type":"resolvedImage","tokens":true,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{"type":"number","default":0,"period":360,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{"type":"number","default":2,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"icon-keep-upright":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-offset":{"type":"array","value":"number","length":2,"default":[0,0],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"}
1,"icon-anchor":{"type":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"default":"center","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-field":{"type":"formatted","default":"","tokens":true,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-font":{"type":"array","value":"string","default":["Open Sans Regular","Arial Unicode MS Regular"],"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-size":{"type":"number","default":16,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{"type":"number","default":10,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{"type":"number","default":1.2,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-letter-spacing":{"type":"number","default":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-justify":{"type":"enum","values":{"auto":1,"left":1,"center":1,"right":1},"default":"center","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{"type":"number","default":0,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["zoom","feature"]}},"text-variable-anchor":{"type":"array","value":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-anchor":{"type":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"default":"center","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{"type":"number","default":45,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-writing-mode":{"type":"array","value":"enum","values":{"horizontal":1,"vertical":1},"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-rotate":{"type":"number","default":0,"period":360,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-padding":{"type":"number","default":2,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-keep-upright":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-transform":{"type":"enum","values":{"none":1,"uppercase":1,"lowercase":1},"default":"none","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-offset":{"type":"array","value":"number","length":2,"default":[0,0],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-optional":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_raster":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_raster-particle":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_hillshade":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"filter":{"type":"array","value":"*"},"filter_symbol":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature","pitch","distance-from-center"]}},"filter_fill":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_line":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_circle":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_fill-extrusion":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_heatmap":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_operator":{"type":"enum","values":{"==":1,"!=":1,">":1,">=":1,"<":1,"<=":1,"in":1,"!in":1,"all":1,"any":1,"none":1,"has":1,"!has":1}},"geometry_type":{"type":"enum","values":{"Point":1,"LineString":1,"Polygon":1}},"function":{"expression":{"type":"expression"},"stops":{"type":"array","value":"function_stop"},"base":{"type":"number","default":1,"minimum":0},"property":{"type":"string","default":"$zoom"},"type":{"type":"enum","values":{"identity":1,"exponential":1,"interval":1,"categorical":1},"default":"exponential"},"colorSpace":{"type":"enum","values":{"rgb":1,"lab":1,"hcl":1},"default":"rgb"},"default":{"type":"*","required":false}},"function_stop":{"type":"array","minimum":0,"maximum":24,"value":["number","color"],"length":2},"expression":{"type":"array","value":"*","minimum":1},"fog":{"range":{"type":"array","default":[0.5,10],"minimum":-20,"maximum":20,"length":2,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"high-color":{"type":"color","property-type":"data-constant","default":"#245cdf","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"space-color":{"type":"color","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],4,"#010b19",7,"#367ab9"],"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"horizon-blend":{"type":"number","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],4,0.2,7,0.1],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"star-intensity":{"type":"number","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],5,0.35,6,0],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vertical-range":{"type":"array","default":[0,0],"minimum":0,"length":2,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}}},"camera":{"camera-projection":{"type":"enum","values":{"perspective":1,"orthographic":1},"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"default":"perspective","property-type":"data-constant"}},"light":{"anchor":{"type":"enum","default":"viewport","values":{"map":1,"viewport":1},"property-type":"data-constant","expression":{"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"intensity":{"type":"number","property-type":"data-constant","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"projection":{"name":{"type":"enum","values":{"albers":1,"equalEarth":1,"equirectangular":1,"lambertConformalConic":1,"mercator":1,"naturalEarth":1,"winkelTripel":1,"globe":1},"default":"mercator","required":true},"center":{"type":"array","length":2,"value":"number","property-type":"data-constant","minimum":[-180,-90],"maximum":[180,90]},"parallels":{"type":"array","length":2,"value":"number","property-type":"data-constant","minimum":[-90,-90],"maximum":[90,90]}},"terrain":{"source":{"type":"string","required":true},"exaggeration":{"type":"number","property-type":"data-constant","default":1,"minimum":0,"maximum":1000,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"paint":["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background","paint_sky","paint_model"],"paint_fill":{"fill-antialias":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"fill-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-outline-color":{"type":"color","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"fill-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-extrusion-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-extrusion-height":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-ambient-occlusion-intensity":{"property-type":"data-constant","type":"number","private":true,"default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-radius":{"property-type":"data-constant","type":"number","private":true,"default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-wall-radius":{"property-type":"data-constant","type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-ground-radius":{"property-type":"data-constant","type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-ground-attenuation":{"property-type":"data-constant","type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-flood-light-color":{"property-type":"data-constant","type":"color","default":"#ffffff","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-flood-light-intensity":{"property-type":"data-constant","type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-flood-light-wall-radius":{"property-type":"data-driven","type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"fill-extrusion-flood-light-ground-radius":{"property-type":"data-driven","type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"fill-extrusion-flood-light-ground-attenuation":{"property-type":"data-constant","type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-vertical-scale":{"property-type":"data-constant","type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-rounded-roof":{"property-type":"data-constant","type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"fill-extrusion-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{},"property-type":"data-constant"},"fill-extrusion-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"}},"paint_line":{"line-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"line-width":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-gap-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-offset":{"type":"number","default":0,"transition":true,"expression":{"
1interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-dasharray":{"type":"array","value":"number","minimum":0,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-gradient":{"type":"color","expression":{"interpolated":true,"parameters":["line-progress"]},"property-type":"color-ramp"},"line-trim-offset":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[0,0],"maximum":[1,1],"property-type":"constant"},"line-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"line-border-width":{"type":"number","private":true,"default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-border-color":{"type":"color","private":true,"default":"rgba(0, 0, 0, 0)","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"}},"paint_circle":{"circle-radius":{"type":"number","default":5,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-blur":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1},"default":"viewport","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-stroke-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-stroke-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"}},"paint_heatmap":{"heatmap-radius":{"type":"number","default":30,"minimum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"heatmap-weight":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"heatmap-intensity":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"heatmap-color":{"type":"color","default":["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",0.1,"royalblue",0.3,"cyan",0.5,"lime",0.7,"yellow",1,"red"],"expression":{"interpolated":true,"parameters":["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_symbol":{"icon-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-emissive-strength":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-driven"},"text-emissive-strength":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-driven"},"icon-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-image-cross-fade":{"type":"number","property-type":"data-driven","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"transition":true},"text-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-color":{"type":"color","default":"#000000","transition":true,"overridable":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-color-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":{},"property-type":"data-constant"},"icon-color-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":{},"property-type":"data-constant"},"icon-color-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{},"property-type":"data-constant"},"icon-color-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{},"property-type":"data-constant"}},"paint_raster":{"raster-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-color":{"type":"color","expression":{"interpolated":true,"parameters":["raster-value"]},"property-type":"color-ramp"},"raster-color-mix":{"type":"array","default":[0.2126,0.7152,0.0722,0],"length":4,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-color-range":{"type":"array","length":2,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-hue-rotate":{"type":"number","default":0,"period":360,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-resampling":{"type":"enum","values":{"linear":1,"nearest":1},"default":"linear","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{"type":"number","default":300,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"raster-array-band":{"type":"string","required":false,"property-type":"data-constant"},"raster-elevation":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_raster-particle":{"raster-particle-array-band":{"type":"string","required":false,"property-type":"data-constant"},"raster-particle-count":{"type":"number","default":512,"minimum":1,"property-type":"data-constant"},"raster-particle-color":{"type":"color","expression":{"interpolated":true,"parameters":["raster-particle-speed"]},"property-type":"color-ramp"},"raster-particle-max-speed":{"type":"number","default":1,"minimum":1,"property-type":"data-constant"},"raster-particle-speed-factor":{"type":"number","default":0.2,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-particle-fade-opacity-factor":{"type":"number","default":0.98,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-particle-reset-rate-factor":{"type":"number","default":0.8,"minimum":0,"maximum":1,"property-type":"data-constant"}},"paint_hillshade":{"hillshade-illumination-direction":{"type":"number","default":335,"minimum":0,"maximum":359,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"viewport","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{"type":"number","default":0.5,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"hillshade-highlight-color":{"type":"color","default":"#FFFFFF","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"hillshade-accent-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"hillshade-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"}},"paint_background":{"background-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"background-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"background-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"background-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"}},"paint_sky":{"sky-type":{"type":"enum","values":{"gradient":1,"atmosphere":1},"default":"atmosphere","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"sky-atmosphere-sun":{"type":"array","value":"number","length":2,"minimum":[0,0],"maximum":[360,180],"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"sky-atmosphere-sun-intensity":{"type":"number","default":10,"minimum":0,"maximum":100,"property-type":"data-constant"},"sky-gradient-center":{"type":"array","value":"number","default":[0,0],"length":2,"minimum":[0,0],"maximum":[360,180],"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"sky-gradient-radius":{"type":"number","default":90,"minimum":0,"maximum":180,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"sky-gradient":{"type":"color","default":["interpolate",["linear"],["sky-radial-progress"],0.8,"#87ceeb",1,"white"],"expression":{"interpolated":true,"parameters":["sky-radial-progress"]},"property-type":"color-ramp"},"sky-atmosphere-halo-color":{"type":"color","default":"white","property-type":"data-constant"},"sky-atmosphere-color":{"type":"color","default":"white","property-type":"data-constant"},"sky-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_model":{"model-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"model-rotation":{"type":"array","value":"number","length":3,"default":[0,0,0],"period":360,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-scale":{"type":"array","value":"number","length":3,"default":[1,1,1],"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-translation":{"type":"array","value":"number","length":3,"default":[0,0,0],"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-color":{"type":"color","default":"#ffffff","property-type":"data-driven","expression":{"interpolated":true
1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":true},"model-color-mix-intensity":{"type":"number","property-type":"data-driven","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-type":{"type":"enum","values":{"common-3d":1,"location-indicator":1},"default":"common-3d","property-type":"data-constant"},"model-cast-shadows":{"type":"boolean","default":true,"expression":{},"property-type":"data-constant"},"model-receive-shadows":{"type":"boolean","default":true,"expression":{},"property-type":"data-constant"},"model-ambient-occlusion-intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant","transition":true},"model-emissive-strength":{"type":"number","property-type":"data-driven","default":0,"minimum":0,"maximum":5,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-roughness":{"type":"number","default":1,"minimum":0,"maximum":1,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state"]},"transition":true},"model-height-based-emissive-strength-multiplier":{"type":"array","default":[1,1,1,1,0],"length":5,"value":"number","property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{},"property-type":"data-constant"},"model-front-cutoff":{"type":"array","private":true,"value":"number","property-type":"data-constant","expression":{"interpolated":true,"parameters":["zoom"]},"length":3,"default":[0,0,1],"minimum":[0,0,0],"maximum":[1,1,1]}},"transition":{"duration":{"type":"number","default":300,"minimum":0},"delay":{"type":"number","default":0,"minimum":0}},"property-type":{"data-driven":{"type":"property-type"},"color-ramp":{"type":"property-type"},"data-constant":{"type":"property-type"},"constant":{"type":"property-type"}},"promoteId":{"*":{"type":"string"}}}');function xe(t){if(t===!0||t===!1)return!0;if(!Array.isArray(t)||t.length===0)return!1;switch(t[0]){case"has":return t.length>=2&&t[1]!=="$id"&&t[1]!=="$type";case"in":return t.length>=3&&(typeof t[1]!="string"||Array.isArray(t[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return t.length!==3||Array.isArray(t[1])||Array.isArray(t[2]);case"any":case"all":for(const e of t.slice(1))if(!xe(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}function Ge(t,e="fill"){if(t==null)return{filter:()=>!0,needGeometry:!1,needFeature:!1};xe(t)||(t=Vt(t));const i=t;let n=!0;try{n=function(g){if(!et(g))return g;let x=de(g);return nt(x),x=Xe(x),x}(i)}catch{console.warn(`Failed to extract static filter. Filter will continue working, but at higher memory usage and slower framerate.
2This is most likely a bug, please report this via https://github.com/mapbox/mapbox-gl-js/issues/new?assignees=&labels=&template=Bug_report.md
3and paste the contents of this message in the report.
4Thank you!
5Filter Expression:
6${JSON.stringify(i,null,2)}
7        `)}const a=W[`filter_${e}`],l=fo(n,a);let h=null;if(l.result==="error")throw new Error(l.value.map(g=>`${g.key}: ${g.message}`).join(", "));h=(g,x,v)=>l.value.evaluate(g,x,{},v);let p=null,m=null;if(n!==i){const g=fo(i,a);if(g.result==="error")throw new Error(g.value.map(x=>`${x.key}: ${x.message}`).join(", "));p=(x,v,w,E,M)=>g.value.evaluate(x,v,{},w,void 0,void 0,E,M),m=!rs(g.value.expression)}return{filter:h,dynamicFilter:p||void 0,needGeometry:gt(n),needFeature:!!m}}function Xe(t){if(!Array.isArray(t))return t;const e=function(i){if(at.has(i[0])){for(let n=1;n<i.length;n++)if(et(i[n]))return!0}return i}(t);return e===!0?e:e.map(i=>Xe(i))}function nt(t){let e=!1;const i=[];if(t[0]==="case"){for(let n=1;n<t.length-1;n+=2)e=e||et(t[n]),i.push(t[n+1]);i.push(t[t.length-1])}else if(t[0]==="match"){e=e||et(t[1]);for(let n=2;n<t.length-1;n+=2)i.push(t[n+1]);i.push(t[t.length-1])}else if(t[0]==="step"){e=e||et(t[1]);for(let n=1;n<t.length-1;n+=2)i.push(t[n+1])}e&&(t.length=0,t.push("any",...i));for(let n=1;n<t.length;n++)nt(t[n])}function et(t){if(!Array.isArray(t))return!1;if((e=t[0])==="pitch"||e==="distance-from-center")return!0;var e;
vendor: 4,345 bytes, line 7
7for(let i=1;i<t.length;i++)if(et(t[i]))return!0;return!1}const at=new Set(["in","==","!=",">",">=","<","<=","to-boolean"]);function Ot(t,e){return t<e?-1:t>e?1:0}function gt(t){if(!Array.isArray(t))return!1;if(t[0]==="within"||t[0]==="distance")return!0;for(let e=1;e<t.length;e++)if(gt(t[e]))return!0;return!1}function Vt(t){if(!t)return!0;const e=t[0];return t.length<=1?e!=="any":e==="=="?Bt(t[1],t[2],"=="):e==="!="?qi(Bt(t[1],t[2],"==")):e==="<"||e===">"||e==="<="||e===">="?Bt(t[1],t[2],e):e==="any"?(i=t.slice(1),["any"].concat(i.map(Vt))):e==="all"?["all"].concat(t.slice(1).map(Vt)):e==="none"?["all"].concat(t.slice(1).map(Vt).map(qi)):e==="in"?bi(t[1],t.slice(2)):e==="!in"?qi(bi(t[1],t.slice(2))):e==="has"?ii(t[1]):e!=="!has"||qi(ii(t[1]));var i}function Bt(t,e,i){switch(t){case"$type":return[`filter-type-${i}`,e];case"$id":return[`filter-id-${i}`,e];default:return[`filter-${i}`,t,e]}}function bi(t,e){if(e.length===0)return!1;switch(t){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(i=>typeof i!=typeof e[0])?["filter-in-large",t,["literal",e.sort(Ot)]]:["filter-in-small",t,["literal",e]]}}function ii(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function qi(t){return["!",t]}const Bi="�";function ui(t,e){return e?`${t}${Bi}${e}`:t}const ri="-transition",St=new Set(["fill","line","background","hillshade","raster"]);class It extends vs{constructor(e,i,n,a){if(super(),this.id=e.id,this.fqid=ui(this.id,n),this.type=e.type,this.scope=n,this.options=a,this._featureFilter={filter:()=>!0,needGeometry:!1,needFeature:!1},this._filterCompiled=!1,this.isConfigDependent=!1,e.type!=="custom"&&(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,e.type!=="background"&&e.type!=="sky"&&e.type!=="slot"&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter),e.slot&&(this.slot=e.slot),i.layout&&(this._unevaluatedLayout=new ie(i.layout,this.scope,a),this.isConfigDependent=this.isConfigDependent||this._unevaluatedLayout.isConfigDependent),i.paint)){this._transitionablePaint=new Y(i.paint,this.scope,a);for(const l in e.paint)this.setPaintProperty(l,e.paint[l]);for(const l in e.layout)this.setLayoutProperty(l,e.layout[l]);this.isConfigDependent=this.isConfigDependent||this._transitionablePaint.isConfigDependent,this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new pe(i.paint)}}onAdd(e){}onRemove(e){}isDraped(e){return St.has(this.type)}getLayoutProperty(e){return e==="visibility"?this.visibility:this._unevaluatedLayout.getValue(e)}setLayoutProperty(e,i){if(this.type==="custom"&&e==="visibility")return void(this.visibility=i);const n=this._unevaluatedLayout;n._properties.properties[e]&&(n.setValue(e,i),this.isConfigDependent=this.isConfigDependent||n.isConfigDependent,e==="visibility"&&this.possiblyEvaluateVisibility())}possiblyEvaluateVisibility(){this.visibility=this._unevaluatedLayout._values.visibility.possiblyEvaluate({zoom:0})}getPaintProperty(e){return _s(e,ri)?this._transitionablePaint.getTransition(e.slice(0,-11)):this._transitionablePaint.getValue(e)}setPaintProperty(e,i){const n=this._transitionablePaint,a=n._properties.properties;if(_s(e,ri)){const v=e.slice(0,-11);return a[v]&&n.setTransition(v,i||void 0),!1}if(!a[e])return!1;const l=n._values[e],h=l.value.isDataDriven(),p=l.value;n.setValue(e,i),this.isConfigDependent=this.isConfigDependent||n.isConfigDependent,this._handleSpecialPaintPropertyUpdate(e);const m=n._values[e].value,g=m.isDataDriven(),x=_s(e,"pattern")||e==="line-dasharray";return g||h||x||this._handleOverridablePaintPropertyUpdate(e,p,m)}_handleSpecialPaintPropertyUpdate(e){}getProgramIds(){return null}getDefaultProgramParams(e,i){return null}_handleOverridablePaintPropertyUpdate(e,i,n){return!1}isHidden(e){return!!(this.minzoom&&e<this.minzoom)||!!(this.maxzoom&&e>=this.maxzoom)||this.visibility==="none"}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(e,i){this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,i)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,i)}
vendor: 11,286 bytes, line 7
7serialize(){return Go({id:this.id,type:this.type,slot:this.slot,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()},(e,i)=>!(e===void 0||i==="layout"&&!Object.keys(e).length||i==="paint"&&!Object.keys(e).length))}is3D(){return!1}isSky(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}hasShadowPass(){return!1}canCastShadows(){return!1}hasLightBeamPass(){return!1}cutoffRange(){return 0}tileCoverLift(){return 0}resize(){}isStateDependent(){for(const e in this.paint._values){const i=this.paint.get(e);if(i instanceof ce&&Gl(i.property.specification)&&(i.value.kind==="source"||i.value.kind==="composite")&&i.value.isStateDependent)return!0}return!1}compileFilter(){this._filterCompiled||(this._featureFilter=Ge(this.filter),this._filterCompiled=!0)}invalidateCompiledFilter(){this._filterCompiled=!1}dynamicFilter(){return this._featureFilter.dynamicFilter}dynamicFilterNeedsFeature(){return this._featureFilter.needFeature}getLayerRenderingStats(){return this._stats}resetLayerRenderingStats(e){this._stats&&(e.renderPass==="shadow"?this._stats.numRenderedVerticesInShadowPass=0:this._stats.numRenderedVerticesInTransparentPass=0)}queryRadius(e){}queryIntersectsFeature(e,i,n,a,l,h,p,m,g){}queryIntersectsMatchingFeature(e,i,n,a){}}const gi={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class hi{constructor(e,i){this._structArray=e,this._pos1=i*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class Dt{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(e,i){return e._trim(),i&&(e.isTransferred=!0,i.add(e.arrayBuffer)),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){const i=Object.create(this.prototype);return i.arrayBuffer=e.arrayBuffer,i.length=e.length,i.capacity=e.arrayBuffer.byteLength/i.bytesPerElement,i._refreshViews(),i}_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(e){this.reserve(e),this.length=e}reserve(e){if(e>this.capacity){this.capacity=Math.max(e,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const i=this.uint8;this._refreshViews(),i&&this.uint8.set(i)}}_refreshViews(){throw new Error("StructArray#_refreshViews() must be implemented by each concrete StructArray layout")}emplace(...e){throw new Error("StructArray#emplace() must be implemented by each concrete StructArray layout")}emplaceBack(...e){throw new Error("StructArray#emplaceBack() must be implemented by each concrete StructArray layout")}destroy(){this.int8=this.uint8=this.int16=this.uint16=this.int32=this.uint32=this.float32=null,this.arrayBuffer=null}}function vt(t,e=1){let i=0,n=0;return{members:t.map(a=>{const l=gi[a.type].BYTES_PER_ELEMENT,h=i=br(i,Math.max(e,l)),p=a.components||1;return n=Math.max(n,l),i+=l*p,{name:a.name,type:a.type,components:p,offset:h}}),size:br(i,Math.max(n,e)),alignment:e}}function br(t,e){return Math.ceil(t/e)*e}class ar extends Dt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i){const n=this.length;return this.resize(n+1),this.emplace(n,e,i)}emplace(e,i,n){const a=2*e;return this.int16[a+0]=i,this.int16[a+1]=n,e}}ar.prototype.bytesPerElement=4,Qe(ar,"StructArrayLayout2i4");class Qi extends Dt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,n){const a=this.length;return this.resize(a+1),this.emplace(a,e,i,n)}emplace(e,i,n,a){const l=3*e;return this.int16[l+0]=i,this.int16[l+1]=n,this.int16[l+2]=a,e}}Qi.prototype.bytesPerElement=6,Qe(Qi,"StructArrayLayout3i6");class lr extends Dt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,n,a){const l=this.length;return this.resize(l+1),this.emplace(l,e,i,n,a)}emplace(e,i,n,a,l){const h=4*e;return this.int16[h+0]=i,this.int16[h+1]=n,this.int16[h+2]=a,this.int16[h+3]=l,e}}lr.prototype.bytesPerElement=8,Qe(lr,"StructArrayLayout4i8");class wr extends Dt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,n,a,l){const h=this.length;return this.resize(h+1),this.emplace(h,e,i,n,a,l)}emplace(e,i,n,a,l,h){const p=5*e;return this.int16[p+0]=i,this.int16[p+1]=n,this.int16[p+2]=a,this.int16[p+3]=l,this.int16[p+4]=h,e}}wr.prototype.bytesPerElement=10,Qe(wr,"StructArrayLayout5i10");class pr extends Dt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,n,a,l,h,p){const m=this.length;return this.resize(m+1),this.emplace(m,e,i,n,a,l,h,p)}emplace(e,i,n,a,l,h,p,m){const g=6*e,x=12*e,v=3*e;return this.int16[g+0]=i,this.int16[g+1]=n,this.uint8[x+4]=a,this.uint8[x+5]=l,this.uint8[x+6]=h,this.uint8[x+7]=p,this.float32[v+2]=m,e}}pr.prototype.bytesPerElement=12,Qe(pr,"StructArrayLayout2i4ub1f12");class Hi extends Dt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,n,a){const l=this.length;return this.resize(l+1),this.emplace(l,e,i,n,a)}emplace(e,i,n,a,l){const h=4*e;return this.float32[h+0]=i,this.float32[h+1]=n,this.float32[h+2]=a,this.float32[h+3]=l,e}}Hi.prototype.bytesPerElement=16,Qe(Hi,"StructArrayLayout4f16");class er extends Dt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i){const n=this.length;return this.resize(n+1),this.emplace(n,e,i)}emplace(e,i,n){const a=2*e;return this.float32[a+0]=i,this.float32[a+1]=n,e}}er.prototype.bytesPerElement=8,Qe(er,"StructArrayLayout2f8");class tr extends Dt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,n,a,l){const h=this.length;return this.resize(h+1),this.emplace(h,e,i,n,a,l)}emplace(e,i,n,a,l,h){const p=6*e,m=3*e;return this.uint16[p+0]=i,this.uint16[p+1]=n,this.uint16[p+2]=a,this.uint16[p+3]=l,this.float32[m+2]=h,e}}tr.prototype.bytesPerElement=12,Qe(tr,"StructArrayLayout4ui1f12");class vn extends Dt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,n,a){const l=this.length;return this.resize(l+1),this.emplace(l,e,i,n,a)}emplace(e,i,n,a,l){const h=4*e;return this.uint16[h+0]=i,this.uint16[h+1]=n,this.uint16[h+2]=a,this.uint16[h+3]=l,e}}vn.prototype.bytesPerElement=8,Qe(vn,"StructArrayLayout4ui8");class cn extends Dt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,n,a,l,h){const p=this.length;return this.resize(p+1),this.emplace(p,e,i,n,a,l,h)}emplace(e,i,n,a,l,h,p){const m=6*e;return this.int16[m+0]=i,this.int16[m+1]=n,this.int16[m+2]=a,this.int16[m+3]=l,this.int16[m+4]=h,this.int16[m+5]=p,e}}cn.prototype.bytesPerElement=12,Qe(cn,"StructArrayLayout6i12");class bn extends Dt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,n,a,l,h,p,m,g,x,v,w){const E=this.length;return this.resize(E+1),this.emplace(E,e,i,n,a,l,h,p,m,g,x,v,w)}emplace(e,i,n,a,l,h,p,m,g,x,v,w,E){const M=12*e;return this.int16[M+0]=i,this.int16[M+1]=n,this.int16[M+2]=a,this.int16[M+3]=l,this.uint16[M+4]=h,this.uint16[M+5]=p,this.uint16[M+6]=m,this.uint16[M+7]=g,this.int16[M+8]=x,this.int16[M+9]=v,this.int16[M+10]=w,this.int16[M+11]=E,e}}bn.prototype.bytesPerElement=24,Qe(bn,"StructArrayLayout4i4ui4i24");class wn extends Dt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,n,a,l,h){const p=this.length;return this.resize(p+1),this.emplace(p,e,i,n,a,l,h)}emplace(e,i,n,a,l,h,p){const m=10*e,g=5*e;return this.int16[m+0]=i,this.int16[m+1]=n,this.int16[m+2]=a,this.float32[g+2]=l,this.float32[g+3]=h,this.float32[g+4]=p,e}}wn.prototype.bytesPerElement=20,Qe(wn,"StructArrayLayout3i3f20");class os extends Dt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.uint32[1*e+0]=i,e}}os.prototype.bytesPerElement=4,Qe(os,"StructArrayLayout1ul4");class Zr extends Dt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i){const n=this.length;return this.resize(n+1),this.emplace(n,e,i)}emplace(e,i,n){const a=2*e;return this.uint16[a+0]=i,this.uint16[a+1]=n,e}}Zr.prototype.bytesPerElement=4,Qe(Zr,"StructArrayLayout2ui4");class Aa extends Dt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,n,a,l,h,p,m,g,x,v,w,E){const M=this.length;return this.resize(M+1),this.emplace(M,e,i,n,a,l,h,p,m,g,x,v,w,E)}emplace(e,i,n,a,l,h,p,m,g,x,v,w,E,M){const I=20*e,z=10*e;return this.int16[I+0]=i,this.int16[I+1]=n,this.int16[I+2]=a,this.int16[I+3]=l,this.int16[I+4]=h,this.float32[z+3]=p,this.float32[z+4]=m,this.float32[z+5]=g,this.float32[z+6]=x,this.int16[I+14]=v,this.uint32[z+8]=w,this.uint16[I+18]=E,this.uint16[I+19]=M,e}}Aa.prototype.bytesPerElement=40,Qe(Aa,"StructArrayLayout5i4f1i1ul2ui40");class _o extends Dt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,n,a,l,h,p){const m=this.length;return this.resize(m+1),this.emplace(m,e,i,n,a,l,h,p)}emplace(e,i,n,a,l,h,p,m){const g=8*e;return this.int16[g+0]=i,this.int16[g+1]=n,this.int16[g+2]=a,this.int16[g+4]=l,this.int16[g+5]=h,this.int16[g+6]=p,this.int16[g+7]=m,e}}_o.prototype.bytesPerElement=16,Qe(_o,"StructArrayLayout3i2i2i16");class Ia extends Dt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,n,a,l){const h=this.length;return this.resize(h+1),this.emplace(h,e,i,n,a,l)}emplace(e,i,n,a,l,h){const p=4*e,m=8*e;return this.float32[p+0]=i,this.float32[p+1]=n,this.float32[p+2]=a,this.int16[m+6]=l,this.int16[m+7]=h,e}}Ia.prototype.bytesPerElement=16,Qe(Ia,"StructArrayLayout2f1f2i16");class On extends Dt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,n,a){const l=this.length;return this.resize(l+1),this.emplace(l,e,i,n,a)}emplace(e,i,n,a,l){const h=12*e,p=3*e;return this.uint8[h+0]=i,this.uint8[h+1]=n,this.float32[p+1]=a,this.float32[p+2]=l,e}}
vendor: 10,241 bytes, line 7
7On.prototype.bytesPerElement=12,Qe(On,"StructArrayLayout2ub2f12");class Xi extends Dt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,n){const a=this.length;return this.resize(a+1),this.emplace(a,e,i,n)}emplace(e,i,n,a){const l=3*e;return this.uint16[l+0]=i,this.uint16[l+1]=n,this.uint16[l+2]=a,e}}Xi.prototype.bytesPerElement=6,Qe(Xi,"StructArrayLayout3ui6");class Ca extends Dt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e,i,n,a,l,h,p,m,g,x,v,w,E,M,I,z,D,F,j,V,X){const q=this.length;return this.resize(q+1),this.emplace(q,e,i,n,a,l,h,p,m,g,x,v,w,E,M,I,z,D,F,j,V,X)}emplace(e,i,n,a,l,h,p,m,g,x,v,w,E,M,I,z,D,F,j,V,X,q){const J=30*e,ee=15*e,oe=60*e;return this.int16[J+0]=i,this.int16[J+1]=n,this.int16[J+2]=a,this.float32[ee+2]=l,this.float32[ee+3]=h,this.uint16[J+8]=p,this.uint16[J+9]=m,this.uint32[ee+5]=g,this.uint32[ee+6]=x,this.uint32[ee+7]=v,this.uint16[J+16]=w,this.uint16[J+17]=E,this.uint16[J+18]=M,this.float32[ee+10]=I,this.float32[ee+11]=z,this.uint8[oe+48]=D,this.uint8[oe+49]=F,this.uint8[oe+50]=j,this.uint32[ee+13]=V,this.int16[J+28]=X,this.uint8[oe+58]=q,e}}Ca.prototype.bytesPerElement=60,Qe(Ca,"StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60");class Lp extends Dt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e,i,n,a,l,h,p,m,g,x,v,w,E,M,I,z,D,F,j,V,X,q,J,ee,oe,fe,le,ge,_e,me,Ee,we){const Ce=this.length;return this.resize(Ce+1),this.emplace(Ce,e,i,n,a,l,h,p,m,g,x,v,w,E,M,I,z,D,F,j,V,X,q,J,ee,oe,fe,le,ge,_e,me,Ee,we)}emplace(e,i,n,a,l,h,p,m,g,x,v,w,E,M,I,z,D,F,j,V,X,q,J,ee,oe,fe,le,ge,_e,me,Ee,we,Ce){const Ae=20*e,ye=40*e,Ye=80*e;return this.float32[Ae+0]=i,this.float32[Ae+1]=n,this.int16[ye+4]=a,this.int16[ye+5]=l,this.int16[ye+6]=h,this.int16[ye+7]=p,this.int16[ye+8]=m,this.int16[ye+9]=g,this.int16[ye+10]=x,this.int16[ye+11]=v,this.int16[ye+12]=w,this.uint16[ye+13]=E,this.uint16[ye+14]=M,this.uint16[ye+15]=I,this.uint16[ye+16]=z,this.uint16[ye+17]=D,this.uint16[ye+18]=F,this.uint16[ye+19]=j,this.uint16[ye+20]=V,this.uint16[ye+21]=X,this.uint16[ye+22]=q,this.uint16[ye+23]=J,this.uint16[ye+24]=ee,this.uint16[ye+25]=oe,this.uint16[ye+26]=fe,this.uint16[ye+27]=le,this.uint32[Ae+14]=ge,this.float32[Ae+15]=_e,this.float32[Ae+16]=me,this.float32[Ae+17]=Ee,this.float32[Ae+18]=we,this.uint8[Ye+76]=Ce,e}}Lp.prototype.bytesPerElement=80,Qe(Lp,"StructArrayLayout2f9i15ui1ul4f1ub80");class bu extends Dt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.float32[1*e+0]=i,e}}bu.prototype.bytesPerElement=4,Qe(bu,"StructArrayLayout1f4");class Pa extends Dt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,n,a,l){const h=this.length;return this.resize(h+1),this.emplace(h,e,i,n,a,l)}emplace(e,i,n,a,l,h){const p=5*e;return this.float32[p+0]=i,this.float32[p+1]=n,this.float32[p+2]=a,this.float32[p+3]=l,this.float32[p+4]=h,e}}Pa.prototype.bytesPerElement=20,Qe(Pa,"StructArrayLayout5f20");class kp extends Dt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,n,a,l,h,p){const m=this.length;return this.resize(m+1),this.emplace(m,e,i,n,a,l,h,p)}emplace(e,i,n,a,l,h,p,m){const g=7*e;return this.float32[g+0]=i,this.float32[g+1]=n,this.float32[g+2]=a,this.float32[g+3]=l,this.float32[g+4]=h,this.float32[g+5]=p,this.float32[g+6]=m,e}}kp.prototype.bytesPerElement=28,Qe(kp,"StructArrayLayout7f28");class Op extends Dt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,n,a){const l=this.length;return this.resize(l+1),this.emplace(l,e,i,n,a)}emplace(e,i,n,a,l){const h=6*e;return this.uint32[3*e+0]=i,this.uint16[h+2]=n,this.uint16[h+3]=a,this.uint16[h+4]=l,e}}Op.prototype.bytesPerElement=12,Qe(Op,"StructArrayLayout1ul3ui12");class Bp extends Dt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.uint16[1*e+0]=i,e}}Bp.prototype.bytesPerElement=2,Qe(Bp,"StructArrayLayout1ui2");class za extends Dt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,n){const a=this.length;return this.resize(a+1),this.emplace(a,e,i,n)}emplace(e,i,n,a){const l=3*e;return this.float32[l+0]=i,this.float32[l+1]=n,this.float32[l+2]=a,e}}za.prototype.bytesPerElement=12,Qe(za,"StructArrayLayout3f12");class Fp extends Dt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,n,a,l,h,p,m,g,x,v,w,E,M,I,z){const D=this.length;return this.resize(D+1),this.emplace(D,e,i,n,a,l,h,p,m,g,x,v,w,E,M,I,z)}emplace(e,i,n,a,l,h,p,m,g,x,v,w,E,M,I,z,D){const F=16*e;return this.float32[F+0]=i,this.float32[F+1]=n,this.float32[F+2]=a,this.float32[F+3]=l,this.float32[F+4]=h,this.float32[F+5]=p,this.float32[F+6]=m,this.float32[F+7]=g,this.float32[F+8]=x,this.float32[F+9]=v,this.float32[F+10]=w,this.float32[F+11]=E,this.float32[F+12]=M,this.float32[F+13]=I,this.float32[F+14]=z,this.float32[F+15]=D,e}}Fp.prototype.bytesPerElement=64,Qe(Fp,"StructArrayLayout16f64");class ud extends Dt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,n,a,l,h,p){const m=this.length;return this.resize(m+1),this.emplace(m,e,i,n,a,l,h,p)}emplace(e,i,n,a,l,h,p,m){const g=10*e,x=5*e;return this.uint16[g+0]=i,this.uint16[g+1]=n,this.uint16[g+2]=a,this.uint16[g+3]=l,this.float32[x+2]=h,this.float32[x+3]=p,this.float32[x+4]=m,e}}ud.prototype.bytesPerElement=20,Qe(ud,"StructArrayLayout4ui3f20");class Np extends Dt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.int16[1*e+0]=i,e}}Np.prototype.bytesPerElement=2,Qe(Np,"StructArrayLayout1i2");class Vp extends Dt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.uint8[1*e+0]=i,e}}Vp.prototype.bytesPerElement=1,Qe(Vp,"StructArrayLayout1ub1");class am extends hi{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.int16[this._pos2+3]}get tileAnchorY(){return this._structArray.int16[this._pos2+4]}get x1(){return this._structArray.float32[this._pos4+3]}get y1(){return this._structArray.float32[this._pos4+4]}get x2(){return this._structArray.float32[this._pos4+5]}get y2(){return this._structArray.float32[this._pos4+6]}get padding(){return this._structArray.int16[this._pos2+14]}get featureIndex(){return this._structArray.uint32[this._pos4+8]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+18]}get bucketIndex(){return this._structArray.uint16[this._pos2+19]}}am.prototype.size=40;class lm extends Aa{get(e){return new am(this,e)}}Qe(lm,"CollisionBoxArray");class cm extends hi{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.float32[this._pos4+2]}get tileAnchorY(){return this._structArray.float32[this._pos4+3]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+8]}get numGlyphs(){return this._structArray.uint16[this._pos2+9]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+5]}get lineStartIndex(){return this._structArray.uint32[this._pos4+6]}get lineLength(){return this._structArray.uint32[this._pos4+7]}get segment(){return this._structArray.uint16[this._pos2+16]}get lowerSize(){return this._structArray.uint16[this._pos2+17]}get upperSize(){return this._structArray.uint16[this._pos2+18]}get lineOffsetX(){return this._structArray.float32[this._pos4+10]}get lineOffsetY(){return this._structArray.float32[this._pos4+11]}get writingMode(){return this._structArray.uint8[this._pos1+48]}get placedOrientation(){return this._structArray.uint8[this._pos1+49]}set placedOrientation(e){this._structArray.uint8[this._pos1+49]=e}get hidden(){return this._structArray.uint8[this._pos1+50]}set hidden(e){this._structArray.uint8[this._pos1+50]=e}get crossTileID(){return this._structArray.uint32[this._pos4+13]}set crossTileID(e){this._structArray.uint32[this._pos4+13]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+28]}get flipState(){return this._structArray.uint8[this._pos1+58]}set flipState(e){this._structArray.uint8[this._pos1+58]=e}}cm.prototype.size=60;class um extends Ca{get(e){return new cm(this,e)}}Qe(um,"PlacedSymbolArray");class hm extends hi{get tileAnchorX(){return this._structArray.float32[this._pos4+0]}get tileAnchorY(){return this._structArray.float32[this._pos4+1]}get projectedAnchorX(){return this._structArray.int16[this._pos2+4]}get projectedAnchorY(){return this._structArray.int16[this._pos2+5]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+6]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+7]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+8]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+9]}
vendor: 17,631 bytes, line 7
7get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+10]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+11]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+12]}get key(){return this._structArray.uint16[this._pos2+13]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+14]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+15]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+16]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+17]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+18]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+19]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+20]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+21]}get featureIndex(){return this._structArray.uint16[this._pos2+22]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+23]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+24]}get numIconVertices(){return this._structArray.uint16[this._pos2+25]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+26]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+27]}get crossTileID(){return this._structArray.uint32[this._pos4+14]}set crossTileID(e){this._structArray.uint32[this._pos4+14]=e}get textOffset0(){return this._structArray.float32[this._pos4+15]}get textOffset1(){return this._structArray.float32[this._pos4+16]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+17]}get zOffset(){return this._structArray.float32[this._pos4+18]}set zOffset(e){this._structArray.float32[this._pos4+18]=e}get hasIconTextFit(){return this._structArray.uint8[this._pos1+76]}}hm.prototype.size=80;class dm extends Lp{get(e){return new hm(this,e)}}Qe(dm,"SymbolInstanceArray");class pm extends bu{getoffsetX(e){return this.float32[1*e+0]}}Qe(pm,"GlyphOffsetArray");class fm extends ar{getx(e){return this.int16[2*e+0]}gety(e){return this.int16[2*e+1]}}Qe(fm,"SymbolLineVertexArray");class mm extends hi{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]}get layoutVertexArrayOffset(){return this._structArray.uint16[this._pos2+4]}}mm.prototype.size=12;class _m extends Op{get(e){return new mm(this,e)}}Qe(_m,"FeatureIndexArray");class gm extends Zr{geta_centroid_pos0(e){return this.uint16[2*e+0]}geta_centroid_pos1(e){return this.uint16[2*e+1]}}Qe(gm,"FillExtrusionCentroidArray");const Ry=vt([{name:"a_pos",components:2,type:"Int16"}],4),Ly=vt([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]);class Fi{constructor(e=[]){this.segments=e}_prepareSegment(e,i,n,a){let l=this.segments[this.segments.length-1];return e>Fi.MAX_VERTEX_ARRAY_LENGTH&&Ci(`Max vertices per segment is ${Fi.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}`),(!l||l.vertexLength+e>Fi.MAX_VERTEX_ARRAY_LENGTH||l.sortKey!==a)&&(l={vertexOffset:i,primitiveOffset:n,vertexLength:0,primitiveLength:0},a!==void 0&&(l.sortKey=a),this.segments.push(l)),l}prepareSegment(e,i,n,a){return this._prepareSegment(e,i.length,n.length,a)}get(){return this.segments}destroy(){for(const e of this.segments)for(const i in e.vaos)e.vaos[i].destroy()}static simpleSegment(e,i,n,a){return new Fi([{vertexOffset:e,primitiveOffset:i,vertexLength:n,primitiveLength:a,vaos:{},sortKey:0}])}}function ym(t,e){return 256*(t=kt(Math.floor(t),0,255))+kt(Math.floor(e),0,255)}Fi.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Qe(Fi,"SegmentVector");const ky=vt([{name:"a_pattern",components:4,type:"Uint16"},{name:"a_pixel_ratio",components:1,type:"Float32"}]),Oy=vt([{name:"a_dash",components:4,type:"Uint16"}]);class wu{constructor(){this.ids=[],this.uniqueIds=[],this.positions=[],this.indexed=!1}add(e,i,n,a){this.ids.push(xm(e)),this.positions.push(i,n,a)}eachPosition(e,i){const n=xm(e);let a=0,l=this.ids.length-1;for(;a<l;){const h=a+l>>1;this.ids[h]>=n?l=h:a=h+1}for(;this.ids[a]===n;)i(this.positions[3*a],this.positions[3*a+1],this.positions[3*a+2]),a++}static serialize(e,i){const n=new Float64Array(e.ids),a=new Uint32Array(e.positions);return Up(n,a,0,n.length-1),i&&(i.add(n.buffer),i.add(a.buffer)),{ids:n,positions:a}}static deserialize(e){const i=new wu;let n;i.ids=e.ids,i.positions=e.positions;for(const a of i.ids)a!==n&&i.uniqueIds.push(a),n=a;return i.indexed=!0,i}}function xm(t){const e=+t;return!isNaN(e)&&Number.MIN_SAFE_INTEGER<=e&&e<=Number.MAX_SAFE_INTEGER?e:Ko(String(t))}function Up(t,e,i,n){for(;i<n;){const a=t[i+n>>1];let l=i-1,h=n+1;for(;;){do l++;while(t[l]<a);do h--;while(t[h]>a);if(l>=h)break;hd(t,l,h),hd(e,3*l,3*h),hd(e,3*l+1,3*h+1),hd(e,3*l+2,3*h+2)}h-i<n-h?(Up(t,e,i,h),i=h+1):(Up(t,e,h+1,n),n=h)}}function hd(t,e,i){const n=t[e];t[e]=t[i],t[i]=n}Qe(wu,"FeaturePositionMap");class zs{constructor(e){this.gl=e.gl,this.initialized=!1}fetchUniformLocation(e,i){return this.location||this.initialized||(this.location=this.gl.getUniformLocation(e,i),this.initialized=!0),!!this.location}set(e,i,n){throw new Error("Uniform#set() must be implemented by each concrete Uniform")}}class dd extends zs{constructor(e){super(e),this.current=0}set(e,i,n){this.fetchUniformLocation(e,i)&&this.current!==n&&(this.current=n,this.gl.uniform1i(this.location,n))}}class Mr extends zs{constructor(e){super(e),this.current=0}set(e,i,n){this.fetchUniformLocation(e,i)&&this.current!==n&&(this.current=n,this.gl.uniform1f(this.location,n))}}class go extends zs{constructor(e){super(e),this.current=[0,0]}set(e,i,n){this.fetchUniformLocation(e,i)&&(n[0]===this.current[0]&&n[1]===this.current[1]||(this.current=n,this.gl.uniform2f(this.location,n[0],n[1])))}}class jp extends zs{constructor(e){super(e),this.current=[0,0,0]}set(e,i,n){this.fetchUniformLocation(e,i)&&(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])))}}class vm extends zs{constructor(e){super(e),this.current=[0,0,0,0]}set(e,i,n){this.fetchUniformLocation(e,i)&&(n[0]===this.current[0]&&n[1]===this.current[1]&&n[2]===this.current[2]&&n[3]===this.current[3]||(this.current=n,this.gl.uniform4f(this.location,n[0],n[1],n[2],n[3])))}}class bm extends zs{constructor(e){super(e),this.current=ti.transparent}set(e,i,n){this.fetchUniformLocation(e,i)&&(n.r===this.current.r&&n.g===this.current.g&&n.b===this.current.b&&n.a===this.current.a||(this.current=n,this.gl.uniform4f(this.location,n.r,n.g,n.b,n.a)))}}const By=new Float32Array(16);class Tu extends zs{constructor(e){super(e),this.current=By}set(e,i,n){if(this.fetchUniformLocation(e,i)){if(n[12]!==this.current[12]||n[0]!==this.current[0])return this.current=n,void this.gl.uniformMatrix4fv(this.location,!1,n);for(let a=1;a<16;a++)if(n[a]!==this.current[a]){this.current=n,this.gl.uniformMatrix4fv(this.location,!1,n);break}}}}const Fy=new Float32Array(9),Ny=new Float32Array(4);class Gp extends zs{constructor(e){super(e),this.current=Ny}set(e,i,n){if(this.fetchUniformLocation(e,i)){for(let a=0;a<4;a++)if(n[a]!==this.current[a]){this.current=n,this.gl.uniformMatrix2fv(this.location,!1,n);break}}}}function qp(t){return[ym(255*t.r,255*t.g),ym(255*t.b,255*t.a)]}class Eu{constructor(e,i,n){this.value=e,this.uniformNames=i.map(a=>`u_${a}`),this.type=n}setUniform(e,i,n,a,l){i.set(e,l,a.constantOr(this.value))}getBinding(e,i){return this.type==="color"?new bm(e):new Mr(e)}}class Ql{constructor(e,i){this.uniformNames=i.map(n=>`u_${n}`),this.pattern=null,this.pixelRatio=1}setConstantPatternPositions(e){this.pixelRatio=e.pixelRatio||1,this.pattern=e.tl.concat(e.br)}setUniform(e,i,n,a,l){const h=l==="u_pattern"||l==="u_dash"?this.pattern:l==="u_pixel_ratio"?this.pixelRatio:null;h&&i.set(e,l,h)}getBinding(e,i){return i==="u_pattern"||i==="u_dash"?new vm(e):new Mr(e)}}class Ds{constructor(e,i,n,a){this.expression=e,this.type=n,this.maxValue=0,this.paintVertexAttributes=i.map(l=>({name:`a_${l}`,type:"Float32",components:n==="color"?2:1,offset:0})),this.paintVertexArray=new a}populatePaintArray(e,i,n,a,l,h,p){const m=this.paintVertexArray.length,g=this.expression.evaluate(new B(0,{brightness:h}),i,{},l,a,p);this.paintVertexArray.resize(e),this._setPaintValue(m,e,g)}updatePaintArray(e,i,n,a,l,h,p){const m=this.expression.evaluate({zoom:0,brightness:p},n,a,void 0,l);this._setPaintValue(e,i,m)}_setPaintValue(e,i,n){if(this.type==="color"){const a=qp(n);for(let l=e;l<i;l++)this.paintVertexArray.emplace(l,a[0],a[1])}else{for(let a=e;a<i;a++)this.paintVertexArray.emplace(a,n);this.maxValue=Math.max(this.maxValue,Math.abs(n))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent||!this.expression.isLightConstant))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class Bn{constructor(e,i,n,a,l,h){this.expression=e,this.uniformNames=i.map(p=>`u_${p}_t`),this.type=n,this.useIntegerZoom=a,this.zoom=l,this.maxValue=0,this.paintVertexAttributes=i.map(p=>({name:`a_${p}`,type:"Float32",components:n==="color"?4:2,offset:0})),this.paintVertexArray=new h}populatePaintArray(e,i,n,a,l,h,p){const m=this.expression.evaluate(new B(this.zoom,{brightness:h}),i,{},l,a,p),g=this.expression.evaluate(new B(this.zoom+1,{brightness:h}),i,{},l,a,p),x=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(x,e,m,g)}updatePaintArray(e,i,n,a,l,h,p){const m=this.expression.evaluate({zoom:this.zoom,brightness:p},n,a,void 0,l),g=this.expression.evaluate({zoom:this.zoom+1,brightness:p},n,a,void 0,l);this._setPaintValue(e,i,m,g)}_setPaintValue(e,i,n,a){if(this.type==="color"){const l=qp(n),h=qp(a);for(let p=e;p<i;p++)this.paintVertexArray.emplace(p,l[0],l[1],h[0],h[1])}else{for(let l=e;l<i;l++)this.paintVertexArray.emplace(l,n,a);this.maxValue=Math.max(this.maxValue,Math.abs(n),Math.abs(a))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent||!this.expression.isLightConstant))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(e,i,n,a,l){const h=this.useIntegerZoom?Math.floor(n.zoom):n.zoom,p=kt(this.expression.interpolationFactor(h,this.zoom,this.zoom+1),0,1);i.set(e,l,p)}getBinding(e,i){return new Mr(e)}}class yo{constructor(e,i,n,a,l){this.expression=e,this.layerId=l,this.paintVertexAttributes=(n==="array"?Oy:ky).members;for(let h=0;h<i.length;++h);this.paintVertexArray=new a}populatePaintArray(e,i,n){const a=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValues(a,e,i.patterns&&i.patterns[this.layerId],n)}updatePaintArray(e,i,n,a,l,h,p){this._setPaintValues(e,i,n.patterns&&n.patterns[this.layerId],h)}_setPaintValues(e,i,n,a){if(!a||!n)return;const l=a[n];if(!l)return;const{tl:h,br:p,pixelRatio:m}=l;for(let g=e;g<i;g++)this.paintVertexArray.emplace(g,h[0],h[1],p[0],p[1],m)}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent||!this.expression.isLightConstant))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class Da{constructor(e,i,n=()=>!0){this.binders={},this._buffers=[];const a=[];for(const l in e.paint._values){const h=e.paint.get(l);if(!n(l)||!(h instanceof ce&&Gl(h.property.specification)))continue;const p=Uy(l,e.type),m=h.value,g=h.property.specification.type,x=!!h.property.useIntegerZoom,v=l==="line-dasharray"||l.endsWith("pattern"),w=l==="line-dasharray"&&e.layout.get("line-cap").value.kind!=="constant";if(m.kind!=="constant"||w)if(m.kind==="source"||w||v){const E=wm(l,g,"source");this.binders[l]=v?new yo(m,p,g,E,e.id):new Ds(m,p,g,E),a.push(`/a_${l}`)}else{const E=wm(l,g,"composite");this.binders[l]=new Bn(m,p,g,x,i,E),a.push(`/z_${l}`)}else this.binders[l]=v?new Ql(m.value,p):new Eu(m.value,p,g),a.push(`/u_${l}`)}this.cacheKey=a.sort().join("")}getMaxValue(e){const i=this.binders[e];return i instanceof Ds||i instanceof Bn?i.maxValue:0}populatePaintArrays(e,i,n,a,l,h,p){for(const m in this.binders){const g=this.binders[m];(g instanceof Ds||g instanceof Bn||g instanceof yo)&&g.populatePaintArray(e,i,n,a,l,h,p)}}setConstantPatternPositions(e){for(const i in this.binders){const n=this.binders[i];n instanceof Ql&&n.setConstantPatternPositions(e)}}updatePaintArrays(e,i,n,a,l,h,p,m){let g=!1;const x=Object.keys(e),v=x.length!==0,w=v?x:i.uniqueIds;for(const E in this.binders){const M=this.binders[E];if((M instanceof Ds||M instanceof Bn||M instanceof yo)&&(M.expression.isStateDependent===!0||M.expression.isLightConstant===!1)){const I=l.paint.get(E);M.expression=I.value;for(const z of w){const D=e[z.toString()];i.eachPosition(z,(F,j,V)=>{const X=a.feature(F);M.updatePaintArray(j,V,X,D,h,p,m)})}if(!v)for(const z of n.uniqueIds){const D=e[z.toString()];n.eachPosition(z,(F,j,V)=>{const X=a.feature(F);M.updatePaintArray(j,V,X,D,h,p,m)})}g=!0}}return g}defines(){const e=[];for(const i in this.binders){const n=this.binders[i];(n instanceof Eu||n instanceof Ql)&&e.push(...n.uniformNames.map(a=>`#define HAS_UNIFORM_${a}`))}return e}getBinderAttributes(){const e=[];for(const i in this.binders){const n=this.binders[i];if(n instanceof Ds||n instanceof Bn||n instanceof yo)for(let a=0;a<n.paintVertexAttributes.length;a++)e.push(n.paintVertexAttributes[a].name)}return e}getBinderUniforms(){const e=[];for(const i in this.binders){const n=this.binders[i];if(n instanceof Eu||n instanceof Ql||n instanceof Bn)for(const a of n.uniformNames)e.push(a)}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e){const i=[];for(const n in this.binders){const a=this.binders[n];if(a instanceof Eu||a instanceof Ql||a instanceof Bn)for(const l of a.uniformNames)i.push({name:l,property:n,binding:a.getBinding(e,l)})}return i}setUniforms(e,i,n,a,l){for(const{name:h,property:p,binding:m}of n)this.binders[p].setUniform(e,m,l,a.get(p),h)}updatePaintBuffers(){this._buffers=[];for(const e in this.binders){const i=this.binders[e];(i instanceof Ds||i instanceof Bn||i instanceof yo)&&i.paintVertexBuffer&&this._buffers.push(i.paintVertexBuffer)}}upload(e){for(const i in this.binders){const n=this.binders[i];(n instanceof Ds||n instanceof Bn||n instanceof yo)&&n.upload(e)}this.updatePaintBuffers()}destroy(){for(const e in this.binders){const i=this.binders[e];(i instanceof Ds||i instanceof Bn||i instanceof yo)&&i.destroy()}}}class xo{constructor(e,i,n=()=>!0){this.programConfigurations={};for(const a of e)this.programConfigurations[a.id]=new Da(a,i,n);this.needsUpload=!1,this._featureMap=new wu,this._featureMapWithoutIds=new wu,this._bufferOffset=0,this._idlessCounter=0}populatePaintArrays(e,i,n,a,l,h,p,m){for(const g in this.programConfigurations)this.programConfigurations[g].populatePaintArrays(e,i,a,l,h,p,m);i.id!==void 0?this._featureMap.add(i.id,n,this._bufferOffset,e):(this._featureMapWithoutIds.add(this._idlessCounter,n,this._bufferOffset,e),this._idlessCounter+=1),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,i,n,a,l,h){for(const p of n)this.needsUpload=this.programConfigurations[p.id].updatePaintArrays(e,this._featureMap,this._featureMapWithoutIds,i,p,a,l,h||0)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(const i in this.programConfigurations)this.programConfigurations[i].upload(e);this.needsUpload=!1}}destroy(){for(const e in this.programConfigurations)this.programConfigurations[e].destroy()}}const Vy={"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-emissive-strength":["emissive_strength"],"icon-emissive-strength":["emissive_strength"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern","pixel_ratio"],"fill-pattern":["pattern","pixel_ratio"],"fill-extrusion-pattern":["pattern","pixel_ratio"],"line-dasharray":["dash"]};function Uy(t,e){return Vy[t]||[t.replace(`${e}-`,"").replace(/-/g,"_")]}const jy={"line-pattern":{source:tr,composite:tr},"fill-pattern":{source:tr,composite:tr},"fill-extrusion-pattern":{source:tr,composite:tr},"line-dasharray":{source:vn,composite:vn}},Gy={color:{source:er,composite:Hi},number:{source:bu,composite:er}};function wm(t,e,i){const n=jy[t];return n&&n[i]||Gy[e][i]}Qe(Eu,"ConstantBinder"),Qe(Ql,"PatternConstantBinder"),Qe(Ds,"SourceExpressionBinder"),Qe(yo,"PatternCompositeBinder"),Qe(Bn,"CompositeExpressionBinder"),Qe(Da,"ProgramConfiguration",{omit:["_buffers"]}),Qe(xo,"ProgramConfigurationSet");const Ar=Ve/Math.PI/2,Zp=5,Tm=6,qy=16383,Hl=64,$p=[Hl,32,16],Tn=-Ar,En=Ar;function Xl(t,e,i,n=Ar){return i=jt(i),[t*Math.sin(i)*n,-e*n,t*Math.cos(i)*n]}function Ra(t,e,i){return Xl(Math.cos(jt(t)),Math.sin(jt(t)),e,i)}const Yl=63710088e-1,Wp=2*Math.PI*Yl;class Zt{constructor(e,i){if(isNaN(e)||isNaN(i))throw new Error(`Invalid LngLat object: (${e}, ${i})`);
7if(this.lng=+e,this.lat=+i,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new Zt(Cn(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){const i=Math.PI/180,n=this.lat*i,a=e.lat*i,l=Math.sin(n)*Math.sin(a)+Math.cos(n)*Math.cos(a)*Math.cos((e.lng-this.lng)*i);return Yl*Math.acos(Math.min(l,1))}toBounds(e=0){const i=360*e/40075017,n=i/Math.cos(Math.PI/180*this.lat);return new vo({lng:this.lng-n,lat:this.lat-i},{lng:this.lng+n,lat:this.lat+i})}toEcef(e){return Ra(this.lat,this.lng,Ar+e*Ar/Yl)}static convert(e){if(e instanceof Zt)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new Zt(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e!==null)return new Zt(Number("lng"in e?e.lng:e.lon),Number(e.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}}class vo{constructor(e,i){if(e)if(i)this.setSouthWest(e).setNorthEast(i);else if(e.length===4){const n=e;this.setSouthWest([n[0],n[1]]).setNorthEast([n[2],n[3]])}else{const n=e;this.setSouthWest(n[0]).setNorthEast(n[1])}}setNorthEast(e){return this._ne=e instanceof Zt?new Zt(e.lng,e.lat):Zt.convert(e),this}setSouthWest(e){return this._sw=e instanceof Zt?new Zt(e.lng,e.lat):Zt.convert(e),this}extend(e){const i=this._sw,n=this._ne;let a,l;if(e instanceof Zt)a=e,l=e;else{if(!(e instanceof vo))return Array.isArray(e)?e.length===4||e.every(Array.isArray)?this.extend(vo.convert(e)):this.extend(Zt.convert(e)):typeof e=="object"&&e!==null&&e.hasOwnProperty("lat")&&(e.hasOwnProperty("lon")||e.hasOwnProperty("lng"))?this.extend(Zt.convert(e)):this;if(a=e._sw,l=e._ne,!a||!l)return this}return i||n?(i.lng=Math.min(a.lng,i.lng),i.lat=Math.min(a.lat,i.lat),n.lng=Math.max(l.lng,n.lng),n.lat=Math.max(l.lat,n.lat)):(this._sw=new Zt(a.lng,a.lat),this._ne=new Zt(l.lng,l.lat)),this}getCenter(){return new Zt((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new Zt(this.getWest(),this.getNorth())}getSouthEast(){return new Zt(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(e){const{lng:i,lat:n}=Zt.convert(e);let a=this._sw.lng<=i&&i<=this._ne.lng;return this._sw.lng>this._ne.lng&&(a=this._sw.lng>=i&&i>=this._ne.lng),this._sw.lat<=n&&n<=this._ne.lat&&a}static convert(e){return!e||e instanceof vo?e:new vo(e)}}var Em={};(function(t,e){(function(i){function n(l,h,p){var m=a(256*l,256*(h=Math.pow(2,p)-h-1),p),g=a(256*(l+1),256*(h+1),p);return m[0]+","+m[1]+","+g[0]+","+g[1]}function a(l,h,p){var m=2*Math.PI*6378137/256/Math.pow(2,p);return[l*m-2*Math.PI*6378137/2,h*m-2*Math.PI*6378137/2]}i.getURL=function(l,h,p,m,g,x){return x=x||{},l+"?"+["bbox="+n(p,m,g),"format="+(x.format||"image/png"),"service="+(x.service||"WMS"),"version="+(x.version||"1.1.1"),"request="+(x.request||"GetMap"),"srs="+(x.srs||"EPSG:3857"),"width="+(x.width||256),"height="+(x.height||256),"layers="+h].join("&")},i.getTileBBox=n,i.getMercCoords=a,Object.defineProperty(i,"__esModule",{value:!0})})(e)})(0,Em);var Zy=Em;class La{constructor(e,i,n){this.z=e,this.x=i,this.y=n,this.key=Su(0,e,e,i,n)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,i){const n=Zy.getTileBBox(this.x,this.y,this.z),a=function(l,h,p){let m,g="";for(let x=l;x>0;x--)m=1<<x-1,g+=(h&m?1:0)+(p&m?2:0);return g}(this.z,this.x,this.y);return e[(this.x+this.y)%e.length].replace("{prefix}",(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String(i==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace("{quadkey}",a).replace("{bbox-epsg-3857}",n)}toString(){return`${this.z}/${this.x}/${this.y}`}}class Sm{constructor(e,i){this.wrap=e,this.canonical=i,this.key=Su(e,i.z,i.z,i.x,i.y)}}
vendor: 18,192 bytes, line 7
7class fr{constructor(e,i,n,a,l){this.overscaledZ=e,this.wrap=i,this.canonical=new La(n,+a,+l),this.key=i===0&&e===n?this.canonical.key:Su(i,e,n,a,l)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(e){const i=this.canonical.z-e;return e>this.canonical.z?new fr(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new fr(e,this.wrap,e,this.canonical.x>>i,this.canonical.y>>i)}calculateScaledKey(e,i=!0){if(this.overscaledZ===e&&i)return this.key;if(e>this.canonical.z)return Su(this.wrap*+i,e,this.canonical.z,this.canonical.x,this.canonical.y);{const n=this.canonical.z-e;return Su(this.wrap*+i,e,e,this.canonical.x>>n,this.canonical.y>>n)}}isChildOf(e){if(e.wrap!==this.wrap)return!1;const i=this.canonical.z-e.canonical.z;return e.overscaledZ===0||e.overscaledZ<this.overscaledZ&&e.canonical.z<this.canonical.z&&e.canonical.x===this.canonical.x>>i&&e.canonical.y===this.canonical.y>>i}children(e){if(this.overscaledZ>=e)return[new fr(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const i=this.canonical.z+1,n=2*this.canonical.x,a=2*this.canonical.y;return[new fr(i,this.wrap,i,n,a),new fr(i,this.wrap,i,n+1,a),new fr(i,this.wrap,i,n,a+1),new fr(i,this.wrap,i,n+1,a+1)]}isLessThan(e){return this.wrap<e.wrap||!(this.wrap>e.wrap)&&(this.overscaledZ<e.overscaledZ||!(this.overscaledZ>e.overscaledZ)&&(this.canonical.x<e.canonical.x||!(this.canonical.x>e.canonical.x)&&this.canonical.y<e.canonical.y))}wrapped(){return new fr(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new fr(this.overscaledZ,e,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new Sm(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}}function Su(t,e,i,n,a){const l=1<<Math.min(i,22);let h=l*(a%l)+n%l;return t&&i<22&&(h+=l*l*((t<0?-2*t-1:2*t)%(1<<2*(22-i)))),16*(32*h+i)+(e-i)}const $y=[t=>{let e=t.canonical.x-1,i=t.wrap;return e<0&&(e=(1<<t.canonical.z)-1,i--),new fr(t.overscaledZ,i,t.canonical.z,e,t.canonical.y)},t=>{let e=t.canonical.x+1,i=t.wrap;return e===1<<t.canonical.z&&(e=0,i++),new fr(t.overscaledZ,i,t.canonical.z,e,t.canonical.y)},t=>new fr(t.overscaledZ,t.wrap,t.canonical.z,t.canonical.x,(t.canonical.y===0?1<<t.canonical.z:t.canonical.y)-1),t=>new fr(t.overscaledZ,t.wrap,t.canonical.z,t.canonical.x,t.canonical.y===(1<<t.canonical.z)-1?0:t.canonical.y+1)];Qe(La,"CanonicalTileID"),Qe(fr,"OverscaledTileID",{omit:["projMatrix","expandedProjMatrix"]});const Wy=0,Qy=25.5;function Qp(t){return Wp*Math.cos(t*Math.PI/180)}function bo(t){return(180+t)/360}function Rs(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function Ir(t,e){return t/Qp(e)}function $r(t){return 360*t-180}function cr(t){return 360/Math.PI*Math.atan(Math.exp((180-360*t)*Math.PI/180))-90}function Mm(t,e){return t*Qp(cr(e))}const Ni=85.051129;function Am(t){return Math.cos(jt(kt(t,-Ni,Ni)))}function ka(t,e){const i=kt(e,Wy,Qy),n=Math.pow(2,i);return Am(t)*Wp/(512*n)}function Im(t){return 1/Math.cos(t*Math.PI/180)}function pd(t,e=0){const i=Math.exp(Math.PI*(1-(t.y+e/Ve)/(1<<t.z)*2));return 80150034*i/(i*i+1)/Ve/(1<<t.z)}class mr{constructor(e,i,n=0){this.x=+e,this.y=+i,this.z=+n}static fromLngLat(e,i=0){const n=Zt.convert(e);return new mr(bo(n.lng),Rs(n.lat),Ir(i,n.lat))}toLngLat(){return new Zt($r(this.x),cr(this.y))}toAltitude(){return Mm(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/Wp*Im(cr(this.y))}}function Hp(t,e,i,n,a,l,h,p,m){const g=(e+n)/2,x=(i+a)/2,v=new Ne(g,x);p(v),function(w,E,M,I,z,D){const F=M-z,j=I-D;return Math.abs((I-E)*F-(M-w)*j)/Math.hypot(F,j)}(v.x,v.y,l.x,l.y,h.x,h.y)>=m?(Hp(t,e,i,g,x,l,v,p,m),Hp(t,g,x,n,a,v,h,p,m)):t.push(h)}function Cm(t,e,i){let n=t[0],a=n.x,l=n.y;e(n);const h=[n];for(let p=1;p<t.length;p++){const m=t[p],{x:g,y:x}=m;e(m),Hp(h,a,l,g,x,n,m,e,i),a=g,l=x,n=m}return h}function Xp(t,e,i,n){if(n(e,i)){const a=e.add(i)._mult(.5);Xp(t,e,a,n),Xp(t,a,i,n)}else t.push(i)}function Hy(t,e){let i=t[0];const n=[i];for(let a=1;a<t.length;a++){const l=t[a];Xp(n,i,l,e),i=l}return n}const Yp=Math.pow(2,14)-1,Pm=-Yp-1;function Xy(t,e){const i=Math.round(t.x*e),n=Math.round(t.y*e);return t.x=kt(i,Pm,Yp),t.y=kt(n,Pm,Yp),(i<t.x||i>t.x+1||n<t.y||n>t.y+1)&&Ci("Geometry exceeds allowed extent, reduce your vector tile buffer size"),t}function Ls(t,e,i){const n=t.loadGeometry(),a=t.extent,l=Ve/a;if(e&&i&&i.projection.isReprojectedInTileSpace){const h=1<<e.z,{scale:p,x:m,y:g,projection:x}=i,v=w=>{const E=$r((e.x+w.x/a)/h),M=cr((e.y+w.y/a)/h),I=x.project(E,M);w.x=(I.x*p-m)*a,w.y=(I.y*p-g)*a};for(let w=0;w<n.length;w++)if(t.type!==1)n[w]=Cm(n[w],v,1);else{const E=[];for(const M of n[w])M.x<0||M.x>=a||M.y<0||M.y>=a||(v(M),E.push(M));n[w]=E}}for(const h of n)for(const p of h)Xy(p,l);return n}function wo(t,e){return{type:t.type,id:t.id,properties:t.properties,geometry:e?Ls(t):[]}}function fd(t,e,i,n,a){t.emplaceBack(2*e+(n+1)/2,2*i+(a+1)/2)}function md(t,e,i){t.emplaceBack(e.x,e.y,e.z,i[0]*16384,i[1]*16384,i[2]*16384)}class Jp{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(i=>i.fqid),this.index=e.index,this.hasPattern=!1,this.projection=e.projection,this.layoutVertexArray=new ar,this.indexArray=new Xi,this.segments=new Fi,this.programConfigurations=new xo(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id)}populate(e,i,n,a){const l=this.layers[0],h=[];let p=null;l.type==="circle"&&(p=l.layout.get("circle-sort-key"));for(const{feature:g,id:x,index:v,sourceLayerIndex:w}of e){const E=this.layers[0]._featureFilter.needGeometry,M=wo(g,E);if(!this.layers[0]._featureFilter.filter(new B(this.zoom),M,n))continue;const I=p?p.evaluate(M,{},n):void 0,z={id:x,properties:g.properties,type:g.type,sourceLayerIndex:w,index:v,geometry:E?M.geometry:Ls(g,n,a),patterns:{},sortKey:I};h.push(z)}p&&h.sort((g,x)=>g.sortKey-x.sortKey);let m=null;a.projection.name==="globe"&&(this.globeExtVertexArray=new cn,m=a.projection);for(const g of h){const{geometry:x,index:v,sourceLayerIndex:w}=g,E=e[v].feature;this.addFeature(g,x,v,i.availableImages,n,m,i.brightness),i.featureIndex.insert(E,x,v,w,this.index)}}update(e,i,n,a,l){const h=Object.keys(e).length!==0;h&&!this.stateDependentLayers.length||this.programConfigurations.updatePaintArrays(e,i,h?this.stateDependentLayers:this.layers,n,a,l)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Ry.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.globeExtVertexArray&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,Ly.members))),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy())}addFeature(e,i,n,a,l,h,p){for(const m of i)for(const g of m){const x=g.x,v=g.y;if(x<0||x>=Ve||v<0||v>=Ve)continue;if(h){const M=h.projectTilePoint(x,v,l),I=h.upVector(l,x,v),z=this.globeExtVertexArray;md(z,M,I),md(z,M,I),md(z,M,I),md(z,M,I)}const w=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),E=w.vertexLength;fd(this.layoutVertexArray,x,v,-1,-1),fd(this.layoutVertexArray,x,v,1,-1),fd(this.layoutVertexArray,x,v,1,1),fd(this.layoutVertexArray,x,v,-1,1),this.indexArray.emplaceBack(E,E+1,E+2),this.indexArray.emplaceBack(E,E+2,E+3),w.vertexLength+=4,w.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,{},a,l,p)}}function Kp(t,e){for(let i=0;i<t.length;i++)if(Oa(e,t[i]))return!0;for(let i=0;i<e.length;i++)if(Oa(t,e[i]))return!0;return!!ef(t,e)}function Yy(t,e,i){return!!Oa(t,e)||!!tf(e,t,i)}function zm(t,e){if(t.length===1)return Rm(e,t[0]);for(let i=0;i<e.length;i++){const n=e[i];for(let a=0;a<n.length;a++)if(Oa(t,n[a]))return!0}for(let i=0;i<t.length;i++)if(Rm(e,t[i]))return!0;for(let i=0;i<e.length;i++)if(ef(t,e[i]))return!0;return!1}function Jy(t,e,i){if(t.length>1){if(ef(t,e))return!0;for(let n=0;n<e.length;n++)if(tf(e[n],t,i))return!0}for(let n=0;n<t.length;n++)if(tf(t[n],e,i))return!0;return!1}function ef(t,e){if(t.length===0||e.length===0)return!1;for(let i=0;i<t.length-1;i++){const n=t[i],a=t[i+1];for(let l=0;l<e.length-1;l++)if(Ky(n,a,e[l],e[l+1]))return!0}return!1}function Ky(t,e,i,n){return Hn(t,i,n)!==Hn(e,i,n)&&Hn(t,e,i)!==Hn(t,e,n)}function tf(t,e,i){const n=i*i;if(e.length===1)return t.distSqr(e[0])<n;for(let a=1;a<e.length;a++)if(Dm(t,e[a-1],e[a])<n)return!0;return!1}function Dm(t,e,i){const n=e.distSqr(i);if(n===0)return t.distSqr(e);const a=((t.x-e.x)*(i.x-e.x)+(t.y-e.y)*(i.y-e.y))/n;return t.distSqr(a<0?e:a>1?i:i.sub(e)._mult(a)._add(e))}function Rm(t,e){let i,n,a,l=!1;for(let h=0;h<t.length;h++){i=t[h];for(let p=0,m=i.length-1;p<i.length;m=p++)n=i[p],a=i[m],n.y>e.y!=a.y>e.y&&e.x<(a.x-n.x)*(e.y-n.y)/(a.y-n.y)+n.x&&(l=!l)}return l}function Oa(t,e){let i=!1;for(let n=0,a=t.length-1;n<t.length;a=n++){const l=t[n],h=t[a];l.y>e.y!=h.y>e.y&&e.x<(h.x-l.x)*(e.y-l.y)/(h.y-l.y)+l.x&&(i=!i)}return i}function Lm(t,e,i,n,a){for(const h of t)if(e<=h.x&&i<=h.y&&n>=h.x&&a>=h.y)return!0;const l=[new Ne(e,i),new Ne(e,a),new Ne(n,a),new Ne(n,i)];if(t.length>2){for(const h of l)if(Oa(t,h))return!0}for(let h=0;h<t.length-1;h++)if(e0(t[h],t[h+1],l))return!0;return!1}function e0(t,e,i){const n=i[0],a=i[2];if(t.x<n.x&&e.x<n.x||t.x>a.x&&e.x>a.x||t.y<n.y&&e.y<n.y||t.y>a.y&&e.y>a.y)return!1;const l=Hn(t,e,i[0]);return l!==Hn(t,e,i[1])||l!==Hn(t,e,i[2])||l!==Hn(t,e,i[3])}function Jl(t,e,i,n,a,l){let h=e.y-t.y,p=t.x-e.x;if(l=l||0){const m=h*h+p*p;if(m===0)return!0;const g=Math.sqrt(m);h/=g,p/=g}return!((i.x-t.x)*h+(i.y-t.y)*p-l<0||(n.x-t.x)*h+(n.y-t.y)*p-l<0||(a.x-t.x)*h+(a.y-t.y)*p-l<0)}function rf(t,e,i,n,a,l,h){return!(Jl(t,e,n,a,l,h)||Jl(e,i,n,a,l,h)||Jl(i,t,n,a,l,h)||Jl(n,a,t,e,i,h)||Jl(a,l,t,e,i,h)||Jl(l,n,t,e,i,h))}function Kl(t,e,i){const n=e.paint.get(t).value;return n.kind==="constant"?n.value:i.programConfigurations.get(e.id).getMaxValue(t)}function _d(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function km(t,e,i,n,a){if(!e[0]&&!e[1])return t;const l=Ne.convert(e)._mult(a);i==="viewport"&&l._rotate(-n);const h=[];for(let p=0;p<t.length;p++)h.push(t[p].sub(l));return h}function Om(t,e,i,n){const a=Ne.convert(t)._mult(n);return e==="viewport"&&a._rotate(-i),a}Qe(Jp,"CircleBucket",{omit:["layers"]});const t0=new se({"circle-sort-key":new ae(W.layout_circle["circle-sort-key"]),visibility:new te(W.layout_circle.visibility)});var i0={paint:new se({"circle-radius":new ae(W.paint_circle["circle-radius"]),"circle-color":new ae(W.paint_circle["circle-color"]),"circle-blur":new ae(W.paint_circle["circle-blur"]),"circle-opacity":new ae(W.paint_circle["circle-opacity"]),"circle-translate":new te(W.paint_circle["circle-translate"]),"circle-translate-anchor":new te(W.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new te(W.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new te(W.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new ae(W.paint_circle["circle-stroke-width"]),"circle-stroke-color":new ae(W.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new ae(W.paint_circle["circle-stroke-opacity"]),"circle-emissive-strength":new te(W.paint_circle["circle-emissive-strength"])}),layout:t0};class nf{constructor(e,i){this.pos=e,this.dir=i}intersectsPlane(e,i,n){const a=o.Q.dot(i,this.dir);if(Math.abs(a)<1e-6)return!1;const l=((e[0]-this.pos[0])*i[0]+(e[1]-this.pos[1])*i[1]+(e[2]-this.pos[2])*i[2])/a;return n[0]=this.pos[0]+this.dir[0]*l,n[1]=this.pos[1]+this.dir[1]*l,n[2]=this.pos[2]+this.dir[2]*l,!0}closestPointOnSphere(e,i,n){if(o.Q.equals(this.pos,e)||i===0)return n[0]=n[1]=n[2]=0,!1;const[a,l,h]=this.dir,p=this.pos[0]-e[0],m=this.pos[1]-e[1],g=this.pos[2]-e[2],x=a*a+l*l+h*h,v=2*(p*a+m*l+g*h),w=v*v-4*x*(p*p+m*m+g*g-i*i);if(w<0){const E=Math.max(-v/2,0),M=p+a*E,I=m+l*E,z=g+h*E,D=Math.hypot(M,I,z);return n[0]=M*i/D,n[1]=I*i/D,n[2]=z*i/D,!1}{const E=(-v-Math.sqrt(w))/(2*x);if(E<0){const M=Math.hypot(p,m,g);return n[0]=p*i/M,n[1]=m*i/M,n[2]=g*i/M,!1}return n[0]=p+a*E,n[1]=m+l*E,n[2]=g+h*E,!0}}}class sf{constructor(e,i,n,a,l){this.TL=e,this.TR=i,this.BR=n,this.BL=a,this.horizon=l}static fromInvProjectionMatrix(e,i,n){const a=[-1,1,1],l=[1,1,1],h=[1,-1,1],p=[-1,-1,1],m=o.Q.transformMat4(a,a,e),g=o.Q.transformMat4(l,l,e),x=o.Q.transformMat4(h,h,e),v=o.Q.transformMat4(p,p,e);return new sf(m,g,x,v,i/n)}}function Mu(t,e,i){let n=1/0,a=-1/0;const l=[];for(const h of t){o.Q.sub(l,h,e);const p=o.Q.dot(l,i);n=Math.min(n,p),a=Math.max(a,p)}return[n,a]}function Bm(t,e){let i=!0;for(let n=0;n<t.planes.length;n++){const a=t.planes[n];let l=0;for(let h=0;h<e.length;h++)l+=o.Q.dot(a,e[h])+a[3]>=0;if(l===0)return 0;l!==e.length&&(i=!1)}return i?2:1}function Fm(t,e){for(const i of t.projections){const n=Mu(e,t.points[0],i.axis);if(i.projection[1]<n[0]||i.projection[0]>n[1])return 0}return 1}function Nm(t,e){let i=0;const n=[0,0,0,0];for(let a=0;a<t.length;a++)n[0]=t[a][0],n[1]=t[a][1],n[2]=t[a][2],n[3]=1,o.aa.dot(n,e)>=0&&i++;return i}class of{constructor(e,i){this.points=e||new Array(8).fill([0,0,0]),this.planes=i||new Array(6).fill([0,0,0,0]),this.bounds=wi.fromPoints(this.points),this.projections=[],this.frustumEdges=[o.Q.sub([],this.points[2],this.points[3]),o.Q.sub([],this.points[0],this.points[3]),o.Q.sub([],this.points[4],this.points[0]),o.Q.sub([],this.points[5],this.points[1]),o.Q.sub([],this.points[6],this.points[2]),o.Q.sub([],this.points[7],this.points[3])];for(const n of this.frustumEdges){const a=[0,-n[2],n[1]],l=[n[2],0,-n[0]];this.projections.push({axis:a,projection:Mu(this.points,this.points[0],a)}),this.projections.push({axis:l,projection:Mu(this.points,this.points[0],l)})}}static fromInvProjectionMatrix(e,i,n,a){const l=Math.pow(2,n),h=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map(g=>{const x=o.aa.transformMat4([],g,e),v=1/x[3]/i*l;return o.aa.mul(x,x,[v,v,a?1/x[3]:v,v])}),p=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(g=>{const x=o.Q.sub([],h[g[0]],h[g[1]]),v=o.Q.sub([],h[g[2]],h[g[1]]),w=o.Q.normalize([],o.Q.cross([],x,v)),E=-o.Q.dot(w,h[g[1]]);return w.concat(E)}),m=[];for(let g=0;g<h.length;g++)m.push([h[g][0],h[g][1],h[g][2]]);return new of(m,p)}intersectsPrecise(e,i,n){for(let a=0;a<i.length;a++)if(!Nm(e,i[a]))return 0;for(let a=0;a<this.planes.length;a++)if(!Nm(e,this.planes[a]))return 0;for(const a of n)for(const l of this.frustumEdges){const h=o.Q.cross([],a,l),p=o.Q.length(h);if(p===0)continue;o.Q.scale(h,h,1/p);const m=Mu(this.points,this.points[0],h),g=Mu(e,this.points[0],h);if(m[0]>g[1]||g[0]>m[1])return 0}return 1}}class wi{static fromPoints(e){const i=[1/0,1/0,1/0],n=[-1/0,-1/0,-1/0];for(const a of e)o.Q.min(i,i,a),o.Q.max(n,n,a);return new wi(i,n)}static fromTileIdAndHeight(e,i,n){const a=1<<e.canonical.z,l=e.canonical.x,h=e.canonical.y;return new wi([l/a,h/a,i],[(l+1)/a,(h+1)/a,n])}static applyTransform(e,i){const n=e.getCorners();for(let a=0;a<n.length;++a)o.Q.transformMat4(n[a],n[a],i);return wi.fromPoints(n)}static projectAabbCorners(e,i){const n=e.getCorners();for(let a=0;a<n.length;++a)o.Q.transformMat4(n[a],n[a],i);return n}constructor(e,i){this.min=e,this.max=i,this.center=o.Q.scale([],o.Q.add([],this.min,this.max),.5)}quadrant(e){const i=[e%2==0,e<2],n=o.Q.clone(this.min),a=o.Q.clone(this.max);for(let l=0;l<i.length;l++)n[l]=i[l]?this.min[l]:this.center[l],a[l]=i[l]?this.center[l]:this.max[l];return a[2]=this.max[2],new wi(n,a)}distanceX(e){return Math.max(Math.min(this.max[0],e[0]),this.min[0])-e[0]}distanceY(e){return Math.max(Math.min(this.max[1],e[1]),this.min[1])-e[1]}distanceZ(e){return Math.max(Math.min(this.max[2],e[2]),this.min[2])-e[2]}getCorners(){const e=this.min,i=this.max;return[[e[0],e[1],e[2]],[i[0],e[1],e[2]],[i[0],i[1],e[2]],[e[0],i[1],e[2]],[e[0],e[1],i[2]],[i[0],e[1],i[2]],[i[0],i[1],i[2]],[e[0],i[1],i[2]]]}intersects(e){return this.intersectsAabb(e.bounds)?Bm(e,this.getCorners()):0}intersectsFlat(e){return this.intersectsAabb(e.bounds)?Bm(e,[[this.min[0],this.min[1],0],[this.max[0],this.min[1],0],[this.max[0],this.max[1],0],[this.min[0],this.max[1],0]]):0}intersectsPrecise(e,i){return i||this.intersects(e)?Fm(e,this.getCorners()):0}intersectsPreciseFlat(e,i){return i||this.intersectsFlat(e)?Fm(e,[[this.min[0],this.min[1],0],[this.max[0],this.min[1],0],[this.max[0],this.max[1],0],[this.min[0],this.max[1],0]]):0}intersectsAabb(e){for(let i=0;i<3;++i)if(this.min[i]>e.max[i]||e.min[i]>this.max[i])return!1;return!0}intersectsAabbXY(e){return!(this.min[0]>e.max[0]||e.min[0]>this.max[0]||this.min[1]>e.max[1]||e.min[1]>this.max[1])}encapsulate(e){for(let i=0;i<3;i++)this.min[i]=Math.min(this.min[i],e.min[i]),this.max[i]=Math.max(this.max[i],e.max[i])}encapsulatePoint(e){for(let i=0;i<3;i++)this.min[i]=Math.min(this.min[i],e[i]),this.max[i]=Math.max(this.max[i],e[i])}closestPoint(e){return[Math.max(Math.min(this.max[0],e[0]),this.min[0]),Math.max(Math.min(this.max[1],e[1]),this.min[1]),Math.max(Math.min(this.max[2],e[2]),this.min[2])]}}Qe(wi,"Aabb");const r0=vt([{type:"Float32",name:"a_globe_pos",components:3},{type:"Float32",name:"a_uv",components:2}]),{members:gd}=r0,n0=vt([{name:"a_pos_3",components:3,type:"Int16"}]);var Vm=vt([{name:"a_pos",type:"Int16",components:2}]);function yd(t){return t*Ar/Yl}const s0=[new wi([Tn,Tn,Tn],[En,En,En]),new wi([Tn,Tn,Tn],[0,0,En]),new wi([0,Tn,Tn],[En,0,En]),new wi([Tn,0,Tn],[0,En,En]),new wi([0,0,Tn],[En,En,En])];function Um(t,e,i,n=!0){const a=o.Q.scale([],t._camera.position,t.worldSize),l=[e,i,1,1];o.aa.transformMat4(l,l,t.pixelMatrixInverse),o.aa.scale(l,l,1/l[3]);const h=o.Q.sub([],l,a),p=o.Q.normalize([],h),m=t.globeMatrix,g=[m[12],m[13],m[14]],x=o.Q.sub([],g,a),v=o.Q.length(x),w=o.Q.normalize([],x),E=t.
7worldSize/(2*Math.PI),M=o.Q.dot(w,p),I=Math.asin(E/v);if(I<Math.acos(M)){if(!n)return null;const le=[],ge=[];o.Q.scale(le,p,v/M),o.Q.normalize(ge,o.Q.sub(ge,le,x)),o.Q.normalize(p,o.Q.add(p,x,o.Q.scale(p,ge,Math.tan(I)*v)))}const z=[];new nf(a,p).closestPointOnSphere(g,E,z);const D=o.Q.normalize([],gs(m,0)),F=o.Q.normalize([],gs(m,1)),j=o.Q.normalize([],gs(m,2)),V=o.Q.dot(D,z),X=o.Q.dot(F,z),q=o.Q.dot(j,z),J=vr(Math.asin(-X/E));let ee=vr(Math.atan2(V,q));ee=t.center.lng+function(le,ge){const _e=(ge-le+180)%360-180;return _e<-180?_e+360:_e}(t.center.lng,ee);const oe=bo(ee),fe=kt(Rs(J),0,1);return new mr(oe,fe)}class o0{constructor(e,i,n){this.a=o.Q.sub([],e,n),this.b=o.Q.sub([],i,n),this.center=n;const a=o.Q.normalize([],this.a),l=o.Q.normalize([],this.b);this.angle=Math.acos(o.Q.dot(a,l))}}function af(t,e){if(t.angle===0)return null;let i;return i=t.a[e]===0?1/t.angle*.5*Math.PI:1/t.angle*Math.atan(t.b[e]/t.a[e]/Math.sin(t.angle)-1/Math.tan(t.angle)),i<0||i>1?null:function(n,a,l,h){const p=Math.sin(l);return n*(Math.sin((1-h)*l)/p)+a*(Math.sin(h*l)/p)}(t.a[e],t.b[e],t.angle,kt(i,0,1))+t.center[e]}function as(t){if(t.z<=1)return s0[t.z+2*t.y+t.x];const e=lf(xd(t));return wi.fromPoints(e)}function ks(t,e,i){return o.Q.scale(t,t,1-i),o.Q.scaleAndAdd(t,t,e,i)}function jm(t,e,i){for(const n of t)o.Q.transformMat4(n,n,e),o.Q.scale(n,n,i)}function Gm(t,e,i,n){const a=e/t.worldSize,l=t.globeMatrix;if(i.z<=1){const oe=as(i).getCorners();return jm(oe,l,a),wi.fromPoints(oe)}const h=xd(i,n),p=lf(h,Ar+yd(t._tileCoverLift));jm(p,l,a);const m=Number.MAX_VALUE,g=[-m,-m,-m],x=[m,m,m];if(h.contains(t.center)){for(const le of p)o.Q.min(x,x,le),o.Q.max(g,g,le);g[2]=0;const oe=t.point,fe=[oe.x*a,oe.y*a,0];return o.Q.min(x,x,fe),o.Q.max(g,g,fe),new wi(x,g)}if(t._tileCoverLift>0){for(const oe of p)o.Q.min(x,x,oe),o.Q.max(g,g,oe);return new wi(x,g)}const v=[l[12]*a,l[13]*a,l[14]*a],w=h.getCenter(),E=kt(t.center.lat,-Ni,Ni),M=kt(w.lat,-Ni,Ni),I=bo(t.center.lng),z=Rs(E);let D=I-bo(w.lng);const F=z-Rs(M);D>.5?D-=1:D<-.5&&(D+=1);let j=0;if(Math.abs(D)>Math.abs(F))j=D>=0?1:3;else{j=F>=0?0:2;const oe=[l[4]*a,l[5]*a,l[6]*a],fe=-Math.sin(jt(F>=0?h.getSouth():h.getNorth()))*Ar;o.Q.scaleAndAdd(v,v,oe,fe)}const V=p[j],X=p[(j+1)%4],q=new o0(V,X,v),J=[af(q,0)||V[0],af(q,1)||V[1],af(q,2)||V[2]],ee=To(t.zoom);if(ee>0){const oe=function({x:le,y:ge,z:_e},me,Ee,we,Ce){const Ae=1/(1<<_e);let ye=le*Ae,Ye=ye+Ae,$e=ge*Ae,ze=$e+Ae,ct=0;const it=(ye+Ye)/2-we;return it>.5?ct=-1:it<-.5&&(ct=1),ye=((ye+ct)*me-(we*=me))*Ee+we,Ye=((Ye+ct)*me-we)*Ee+we,$e=($e*me-(Ce*=me))*Ee+Ce,ze=(ze*me-Ce)*Ee+Ce,[[ye,ze,0],[Ye,ze,0],[Ye,$e,0],[ye,$e,0]]}(i,e,t._pixelsPerMercatorPixel,I,z);for(let le=0;le<p.length;le++)ks(p[le],oe[le],ee);const fe=o.Q.add([],oe[j],oe[(j+1)%4]);o.Q.scale(fe,fe,.5),ks(J,fe,ee)}for(const oe of p)o.Q.min(x,x,oe),o.Q.max(g,g,oe);return x[2]=Math.min(V[2],X[2]),o.Q.min(x,x,J),o.Q.max(g,g,J),new wi(x,g)}function xd({x:t,y:e,z:i},n=!1){const a=1/(1<<i),l=new Zt($r(t*a),e===(1<<i)-1&&n?-90:cr((e+1)*a)),h=new Zt($r((t+1)*a),e===0&&n?90:cr(e*a));return new vo(l,h)}function lf(t,e=Ar){const i=jt(t.getNorth()),n=jt(t.getSouth()),a=Math.cos(i),l=Math.cos(n),h=Math.sin(i),p=Math.sin(n),m=t.getWest(),g=t.getEast();return[Xl(l,p,m,e),Xl(l,p,g,e),Xl(a,h,g,e),Xl(a,h,m,e)]}function Au(t,e,i,n){const a=1<<i.z,l=(t/Ve+i.x)/a;return Ra(cr((e/Ve+i.y)/a),$r(l),n)}function vd({min:t,max:e}){return qy/Math.max(e[0]-t[0],e[1]-t[1],e[2]-t[2])}const qm=new Float64Array(16);function bd(t){const e=vd(t),i=o.a9.fromScaling(qm,[e,e,e]);return o.a9.translate(i,i,o.Q.negate([],t.min))}function cf(t){const e=o.a9.fromTranslation(qm,t.min),i=1/vd(t);return o.a9.scale(e,e,[i,i,i])}function uf(t){const e=Ve/(2*Math.PI);return t/(2*Math.PI)/e}function Zm(t,e){return Ve/(512*Math.pow(2,t))*vd(as(e))}function $m(t,e,i,n,a){const l=uf(i),h=[t,e,-i/(2*Math.PI)],p=o.a9.identity(new Float64Array(16));return o.a9.translate(p,p,h),o.a9.scale(p,p,[l,l,l]),o.a9.rotateX(p,p,jt(-a)),o.a9.rotateY(p,p,jt(-n)),p}function To(t){return jo(Zp,Tm,t)}function Wm(t,e){const i=Ra(e.lat,e.lng),n=function(l){const h=Ra(l._center.lat,l._center.lng),p=o.Q.fromValues(0,1,0);let m=o.Q.cross([],p,h);const g=o.a9.fromRotation([],-l.angle,h);m=o.Q.transformMat4(m,m,g),o.a9.fromRotation(g,-l._pitch,m);const x=o.Q.normalize([],h);return o.Q.scale(x,x,yd(l.cameraToCenterDistance/l.pixelsPerMeter)),o.Q.transformMat4(x,x,g),o.Q.add([],h,x)}(t),a=o.Q.subtract([],n,i);return o.Q.angle(a,i)}function hf(t,e){return Wm(t,e)>Math.PI/2*1.01}const Qm=jt(85),a0=Math.cos(Qm),l0=Math.sin(Qm),c0=o.a9.create(),Hm=t=>{const e=[];return t.paint.get("circle-pitch-alignment")==="map"&&e.push("PITCH_WITH_MAP"),t.paint.get("circle-pitch-scale")==="map"&&e.push("SCALE_WITH_MAP"),e};function Xm(t,e,i,n,a,l,h,p,m){if(l&&t.queryGeometry.isAboveHorizon)return!1;l&&(m*=t.pixelToTileUnitsFactor);const g=t.tileID.canonical,x=i.projection.upVectorScale(g,i.center.lat,i.worldSize).metersToTile;for(const v of e)for(const w of v){const E=w.add(p),M=a&&i.elevation?i.elevation.exaggeration()*a.getElevationAt(E.x,E.y,!0):0,I=i.projection.projectTilePoint(E.x,E.y,g);if(M>0){const j=i.projection.upVector(g,E.x,E.y);I.x+=j[0]*x*M,I.y+=j[1]*x*M,I.z+=j[2]*x*M}const z=l?E:u0(I.x,I.y,I.z,n),D=l?t.tilespaceRays.map(j=>d0(j,M)):t.queryGeometry.screenGeometry,F=o.aa.transformMat4([],[I.x,I.y,I.z,1],n);if(!h&&l?m*=F[3]/i.cameraToCenterDistance:h&&!l&&(m*=i.cameraToCenterDistance/F[3]),l){const j=cr((w.y/Ve+g.y
7)/(1<<g.z));m/=i.projection.pixelsPerMeter(j,1)/Ir(1,j)}if(Yy(D,z,m))return!0}return!1}function u0(t,e,i,n){const a=o.aa.transformMat4([],[t,e,i,1],n);return new Ne(a[0]/a[3],a[1]/a[3])}const Ym=o.Q.fromValues(0,0,0),h0=o.Q.fromValues(0,0,1);function d0(t,e){const i=o.Q.create();return Ym[2]=e,t.intersectsPlane(Ym,h0,i),new Ne(i[0],i[1])}class Jm extends Jp{}function Km(t,{width:e,height:i},n,a){if(a){if(a instanceof Uint8ClampedArray)a=new Uint8Array(a.buffer);else if(a.length!==e*i*n)throw new RangeError("mismatched image size")}else a=new Uint8Array(e*i*n);return t.width=e,t.height=i,t.data=a,t}function e_(t,e,i){const{width:n,height:a}=e;n===t.width&&a===t.height||(df(t,e,{x:0,y:0},{x:0,y:0},{width:Math.min(t.width,n),height:Math.min(t.height,a)},i),t.width=n,t.height=a,t.data=e.data)}function df(t,e,i,n,a,l,h){if(a.width===0||a.height===0)return e;if(a.width>t.width||a.height>t.height||i.x>t.width-a.width||i.y>t.height-a.height)throw new RangeError("out of range source coordinates for image copy");if(a.width>e.width||a.height>e.height||n.x>e.width-a.width||n.y>e.height-a.height)throw new RangeError("out of range destination coordinates for image copy");const p=t.data,m=e.data,g=l===4&&h;for(let x=0;x<a.height;x++){const v=((i.y+x)*t.width+i.x)*l,w=((n.y+x)*e.width+n.x)*l;if(g)for(let E=0;E<a.width;E++){const M=v+E*l+3,I=w+E*l;m[I+0]=255,m[I+1]=255,m[I+2]=255,m[I+3]=p[M]}else for(let E=0;E<a.width*l;E++)m[w+E]=p[v+E]}return e}Qe(Jm,"HeatmapBucket",{omit:["layers"]});class Eo{constructor(e,i){Km(this,e,1,i)}resize(e){e_(this,new Eo(e),1)}clone(){return new Eo({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,i,n,a,l){df(e,i,n,a,l,1)}}class un{constructor(e,i){Km(this,e,4,i)}resize(e){e_(this,new un(e),4)}replace(e,i){i?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new un({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,i,n,a,l,h){df(e,i,n,a,l,4,h)}}class t_{constructor(e,i){this.width=e.width,this.height=e.height,this.data=i instanceof Uint8Array?new Float32Array(i.buffer):i}}Qe(Eo,"AlphaImage"),Qe(un,"RGBAImage");const p0=new se({visibility:new te(W.layout_heatmap.visibility)});var f0={paint:new se({"heatmap-radius":new ae(W.paint_heatmap["heatmap-radius"]),"heatmap-weight":new ae(W.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new te(W.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Me(W.paint_heatmap["heatmap-color"]),"heatmap-opacity":new te(W.paint_heatmap["heatmap-opacity"])}),layout:p0};function Iu(t){const e={},i=t.resolution||256,n=t.clips?t.clips.length:1,a=t.image||new un({width:i,height:n}),l=(h,p,m)=>{e[t.evaluationKey]=m;const g=t.expression.evaluate(e);g&&(a.data[h+p+0]=Math.floor(255*g.r/g.a),a.data[h+p+1]=Math.floor(255*g.g/g.a),a.data[h+p+2]=Math.floor(255*g.b/g.a),a.data[h+p+3]=Math.floor(255*g.a))};if(t.clips)for(let h=0,p=0;h<n;++h,p+=4*i)for(let m=0,g=0;m<i;m++,g+=4){const x=m/(i-1),{start:v,end:w}=t.clips[h];l(p,g,v*(1-x)+w*x)}else for(let h=0,p=0;h<i;h++,p+=4)l(0,p,h/(i-1));return a}const m0=new se({visibility:new te(W.layout_hillshade.visibility)});var _0={paint:new se({"hillshade-illumination-direction":new te(W.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new te(W.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new te(W.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new te(W.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new te(W.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new te(W.paint_hillshade["hillshade-accent-color"]),"hillshade-emissive-strength":new te(W.paint_hillshade["hillshade-emissive-strength"])}),layout:m0};const g0=vt([{name:"a_pos",components:2,type:"Int16"}],4),{members:y0}=g0;var pf={exports:{}};function wd(t,e,i){i=i||2;var n,a,l,h,p,m,g,x=e&&e.length,v=x?e[0]*i:t.length,w=i_(t,0,v,i,!0),E=[];if(!w||w.next===w.prev)return E;if(x&&(w=function(I,z,D,F){var j,V,X,q=[];for(j=0,V=z.length;j<V;j++)(X=i_(I,z[j]*F,j<V-1?z[j+1]*F:I.length,F,!1))===X.next&&(X.steiner=!0),q.push(M0(X));for(q.sort(T0),j=0;j<q.length;j++)D=E0(q[j],D);return D}(t,e,w,i)),t.length>80*i){n=l=t[0],a=h=t[1];for(var M=i;M<v;M+=i)(p=t[M])<n&&(n=p),(m=t[M+1])<a&&(a=m),p>l&&(l=p),m>h&&(h=m);g=(g=Math.max(l-n,h-a))!==0?32767/g:0}return Cu(w,E,i,n,a,g,0),E}function i_(t,e,i,n,a){var l,h;if(a===_f(t,e,i,n)>0)for(l=e;l<i;l+=n)h=s_(l,t[l],t[l+1],h);else for(l=i-n;l>=e;l-=n)h=s_(l,t[l],t[l+1],h);return h&&Td(h,h.next)&&(zu(h),h=h.next),h}function Ba(t,e){if(!t)return t;e||(e=t);var i,n=t;do if(i=!1,n.steiner||!Td(n,n.next)&&$i(n.prev,n,n.next)!==0)n=n.next;else{if(zu(n),(n=e=n.prev)===n.next)break;
vendor: 4,159 bytes, line 7
7i=!0}while(i||n!==e);return e}function Cu(t,e,i,n,a,l,h){if(t){!h&&l&&function(x,v,w,E){var M=x;do M.z===0&&(M.z=ff(M.x,M.y,v,w,E)),M.prevZ=M.prev,M.nextZ=M.next,M=M.next;while(M!==x);M.prevZ.nextZ=null,M.prevZ=null,function(I){var z,D,F,j,V,X,q,J,ee=1;do{for(D=I,I=null,V=null,X=0;D;){for(X++,F=D,q=0,z=0;z<ee&&(q++,F=F.nextZ);z++);for(J=ee;q>0||J>0&&F;)q!==0&&(J===0||!F||D.z<=F.z)?(j=D,D=D.nextZ,q--):(j=F,F=F.nextZ,J--),V?V.nextZ=j:I=j,j.prevZ=V,V=j;D=F}V.nextZ=null,ee*=2}while(X>1)}(M)}(t,n,a,l);for(var p,m,g=t;t.prev!==t.next;)if(p=t.prev,m=t.next,l?v0(t,n,a,l):x0(t))e.push(p.i/i|0),e.push(t.i/i|0),e.push(m.i/i|0),zu(t),t=m.next,g=m.next;else if((t=m)===g){h?h===1?Cu(t=b0(Ba(t),e,i),e,i,n,a,l,2):h===2&&w0(t,e,i,n,a,l):Cu(Ba(t),e,i,n,a,l,1);break}}}function x0(t){var e=t.prev,i=t,n=t.next;if($i(e,i,n)>=0)return!1;for(var a=e.x,l=i.x,h=n.x,p=e.y,m=i.y,g=n.y,x=a<l?a<h?a:h:l<h?l:h,v=p<m?p<g?p:g:m<g?m:g,w=a>l?a>h?a:h:l>h?l:h,E=p>m?p>g?p:g:m>g?m:g,M=n.next;M!==e;){if(M.x>=x&&M.x<=w&&M.y>=v&&M.y<=E&&ec(a,p,l,m,h,g,M.x,M.y)&&$i(M.prev,M,M.next)>=0)return!1;M=M.next}return!0}function v0(t,e,i,n){var a=t.prev,l=t,h=t.next;if($i(a,l,h)>=0)return!1;for(var p=a.x,m=l.x,g=h.x,x=a.y,v=l.y,w=h.y,E=p<m?p<g?p:g:m<g?m:g,M=x<v?x<w?x:w:v<w?v:w,I=p>m?p>g?p:g:m>g?m:g,z=x>v?x>w?x:w:v>w?v:w,D=ff(E,M,e,i,n),F=ff(I,z,e,i,n),j=t.prevZ,V=t.nextZ;j&&j.z>=D&&V&&V.z<=F;){if(j.x>=E&&j.x<=I&&j.y>=M&&j.y<=z&&j!==a&&j!==h&&ec(p,x,m,v,g,w,j.x,j.y)&&$i(j.prev,j,j.next)>=0||(j=j.prevZ,V.x>=E&&V.x<=I&&V.y>=M&&V.y<=z&&V!==a&&V!==h&&ec(p,x,m,v,g,w,V.x,V.y)&&$i(V.prev,V,V.next)>=0))return!1;V=V.nextZ}for(;j&&j.z>=D;){if(j.x>=E&&j.x<=I&&j.y>=M&&j.y<=z&&j!==a&&j!==h&&ec(p,x,m,v,g,w,j.x,j.y)&&$i(j.prev,j,j.next)>=0)return!1;j=j.prevZ}for(;V&&V.z<=F;){if(V.x>=E&&V.x<=I&&V.y>=M&&V.y<=z&&V!==a&&V!==h&&ec(p,x,m,v,g,w,V.x,V.y)&&$i(V.prev,V,V.next)>=0)return!1;V=V.nextZ}return!0}function b0(t,e,i){var n=t;do{var a=n.prev,l=n.next.next;!Td(a,l)&&r_(a,n,n.next,l)&&Pu(a,l)&&Pu(l,a)&&(e.push(a.i/i|0),e.push(n.i/i|0),e.push(l.i/i|0),zu(n),zu(n.next),n=t=l),n=n.next}while(n!==t);return Ba(n)}function w0(t,e,i,n,a,l){var h=t;do{for(var p=h.next.next;p!==h.prev;){if(h.i!==p.i&&A0(h,p)){var m=n_(h,p);return h=Ba(h,h.next),m=Ba(m,m.next),Cu(h,e,i,n,a,l,0),void Cu(m,e,i,n,a,l,0)}p=p.next}h=h.next}while(h!==t)}function T0(t,e){return t.x-e.x}function E0(t,e){var i=function(a,l){var h,p=l,m=a.x,g=a.y,x=-1/0;do{if(g<=p.y&&g>=p.next.y&&p.next.y!==p.y){var v=p.x+(g-p.y)*(p.next.x-p.x)/(p.next.y-p.y);if(v<=m&&v>x&&(x=v,h=p.x<p.next.x?p:p.next,v===m))return h}p=p.next}while(p!==l);if(!h)return null;var w,E=h,M=h.x,I=h.y,z=1/0;p=h;do m>=p.x&&p.x>=M&&m!==p.x&&ec(g<I?m:x,g,M,I,g<I?x:m,g,p.x,p.y)&&(w=Math.abs(g-p.y)/(m-p.x),Pu(p,a)&&(w<z||w===z&&(p.x>h.x||p.x===h.x&&S0(h,p)))&&(h=p,z=w)),p=p.next;while(p!==E);return h}(t,e);if(!i)return e;var n=n_(i,t);return Ba(n,n.next),Ba(i,i.next)}function S0(t,e){return $i(t.prev,t,e.prev)<0&&$i(e.next,t,t.next)<0}function ff(t,e,i,n,a){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-i)*a|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*a|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function M0(t){var e=t,i=t;do(e.x<i.x||e.x===i.x&&e.y<i.y)&&(i=e),e=e.next;while(e!==t);return i}function ec(t,e,i,n,a,l,h,p){return(a-h)*(e-p)>=(t-h)*(l-p)&&(t-h)*(n-p)>=(i-h)*(e-p)&&(i-h)*(l-p)>=(a-h)*(n-p)}function A0(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(i,n){var a=i;do{if(a.i!==i.i&&a.next.i!==i.i&&a.i!==n.i&&a.next.i!==n.i&&r_(a,a.next,i,n))return!0;a=a.next}while(a!==i);return!1}(t,e)&&(Pu(t,e)&&Pu(e,t)&&function(i,n){var a=i,l=!1,h=(i.x+n.x)/2,p=(i.y+n.y)/2;do a.y>p!=a.next.y>p&&a.next.y!==a.y&&h<(a.next.x-a.x)*(p-a.y)/(a.next.y-a.y)+a.x&&(l=!l),a=a.next;while(a!==i);return l}(t,e)&&($i(t.prev,t,e.prev)||$i(t,e.prev,e))||Td(t,e)&&$i(t.prev,t,t.next)>0&&$i(e.prev,e,e.next)>0)}function $i(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function Td(t,e){return t.x===e.x&&t.y===e.y}function r_(t,e,i,n){var a=Sd($i(t,e,i)),l=Sd($i(t,e,n)),h=Sd($i(i,n,t)),p=Sd($i(i,n,e));return a!==l&&h!==p||!(a!==0||!Ed(t,i,e))||!(l!==0||!Ed(t,n,e))||!(h!==0||!Ed(i,t,n))||!(
vendor: 6,774 bytes, line 7
7p!==0||!Ed(i,e,n))}function Ed(t,e,i){return e.x<=Math.max(t.x,i.x)&&e.x>=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function Sd(t){return t>0?1:t<0?-1:0}function Pu(t,e){return $i(t.prev,t,t.next)<0?$i(t,e,t.next)>=0&&$i(t,t.prev,e)>=0:$i(t,e,t.prev)<0||$i(t,t.next,e)<0}function n_(t,e){var i=new mf(t.i,t.x,t.y),n=new mf(e.i,e.x,e.y),a=t.next,l=e.prev;return t.next=e,e.prev=t,i.next=a,a.prev=i,n.next=i,i.prev=n,l.next=n,n.prev=l,n}function s_(t,e,i,n){var a=new mf(t,e,i);return n?(a.next=n.next,a.prev=n,n.next.prev=a,n.next=a):(a.prev=a,a.next=a),a}function zu(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function mf(t,e,i){this.i=t,this.x=e,this.y=i,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function _f(t,e,i,n){for(var a=0,l=e,h=i-n;l<i;l+=n)a+=(t[h]-t[l])*(t[l+1]+t[h+1]),h=l;return a}pf.exports=wd,pf.exports.default=wd,wd.deviation=function(t,e,i,n){var a=e&&e.length,l=Math.abs(_f(t,0,a?e[0]*i:t.length,i));if(a)for(var h=0,p=e.length;h<p;h++)l-=Math.abs(_f(t,e[h]*i,h<p-1?e[h+1]*i:t.length,i));var m=0;for(h=0;h<n.length;h+=3){var g=n[h]*i,x=n[h+1]*i,v=n[h+2]*i;m+=Math.abs((t[g]-t[v])*(t[x+1]-t[g+1])-(t[g]-t[x])*(t[v+1]-t[g+1]))}return l===0&&m===0?0:Math.abs((m-l)/l)},wd.flatten=function(t){for(var e=t[0][0].length,i={vertices:[],holes:[],dimensions:e},n=0,a=0;a<t.length;a++){for(var l=0;l<t[a].length;l++)for(var h=0;h<e;h++)i.vertices.push(t[a][l][h]);a>0&&i.holes.push(n+=t[a-1].length)}return i};var Md=zr(pf.exports);function gf(t,e){const i=t.length;if(i<=1)return[t];const n=[];let a,l;for(let h=0;h<i;h++){const p=qo(t[h]);p!==0&&(t[h].area=Math.abs(p),l===void 0&&(l=p<0),l===p<0?(a&&n.push(a),a=[t[h]]):a.push(t[h]))}if(a&&n.push(a),e>1)for(let h=0;h<n.length;h++)n[h].length<=e||(zh(n[h],e,1,n[h].length-1,I0),n[h]=n[h].slice(0,e));return n}function I0(t,e){return e.area-t.area}function yf(t,e,i){const n=i.patternDependencies;let a=!1;for(const l of e){const h=l.paint.get(`${t}-pattern`);h.isConstant()||(a=!0);const p=h.constantOr(null);p&&(a=!0,n[p]=!0)}return a}function xf(t,e,i,n,a){const l=a.patternDependencies;for(const h of e){const p=h.paint.get(`${t}-pattern`).value;if(p.kind!=="constant"){let m=p.evaluate({zoom:n},i,{},a.availableImages);m=m&&m.name?m.name:m,l[m]=!0,i.patterns[h.id]=m}}return i}class vf{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(i=>i.fqid),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new ar,this.indexArray=new Xi,this.indexArray2=new Zr,this.programConfigurations=new xo(e.layers,e.zoom),this.segments=new Fi,this.segments2=new Fi,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.projection=e.projection}populate(e,i,n,a){this.hasPattern=yf("fill",this.layers,i);const l=this.layers[0].layout.get("fill-sort-key"),h=[];for(const{feature:p,id:m,index:g,sourceLayerIndex:x}of e){const v=this.layers[0]._featureFilter.needGeometry,w=wo(p,v);if(!this.layers[0]._featureFilter.filter(new B(this.zoom),w,n))continue;const E=l?l.evaluate(w,{},n,i.availableImages):void 0,M={id:m,properties:p.properties,type:p.type,sourceLayerIndex:x,index:g,geometry:v?w.geometry:Ls(p,n,a),patterns:{},sortKey:E};h.push(M)}l&&h.sort((p,m)=>p.sortKey-m.sortKey);for(const p of h){const{geometry:m,index:g,sourceLayerIndex:x}=p;if(this.hasPattern){const v=xf("fill",this.layers,p,this.zoom,i);this.patternFeatures.push(v)}else this.addFeature(p,m,g,n,{},i.availableImages,i.brightness);i.featureIndex.insert(e[g].feature,m,g,x,this.index)}}update(e,i,n,a,l){const h=Object.keys(e).length!==0;h&&!this.stateDependentLayers.length||this.programConfigurations.updatePaintArrays(e,i,h?this.stateDependentLayers:this.layers,n,a,l)}addFeatures(e,i,n,a,l,h){for(const p of this.patternFeatures)this.addFeature(p,p.geometry,p.index,i,n,a,h)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,y0),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.indexBuffer2=e.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(e),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(e,i,n,a,l,h=[],p){for(const m of gf(i,500)){let g=0;for(const I of m)g+=I.length;const x=this.segments.prepareSegment(g,this.layoutVertexArray,this.indexArray),v=x.vertexLength,w=[],E=[];for(const I of m){if(I.length===0)continue;I!==m[0]&&E.push(w.length/2);const z=this.segments2.prepareSegment(I.length,this.layoutVertexArray,this.indexArray2),D=z.vertexLength;this.layoutVertexArray.emplaceBack(I[0].x,I[0].y),this.indexArray2.emplaceBack(D+I.length-1,D),w.push(I[0].x),w.push(I[0].y);for(let F=1;F<I.length;F++)this.layoutVertexArray.emplaceBack(I[F].x,I[F].y),this.indexArray2.emplaceBack(D+F-1,D+F),w.push(I[F].x),w.push(I[F].y);z.vertexLength+=I.length,z.primitiveLength+=I.length}const M=Md(w,E);for(let I=0;I<M.length;I+=3)this.indexArray.emplaceBack(v+M[I],v+M[I+1],v+M[I+2]);x.vertexLength+=g,x.primitiveLength+=M.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,l,h,a,p)}}Qe(vf,"FillBucket",{omit:["layers","patternFeatures"]});const C0=new se({"fill-sort-key":new ae(W.layout_fill["fill-sort-key"]),visibility:new te(W.layout_fill.visibility)});var P0={paint:new se({"fill-antialias":new te(W.paint_fill["fill-antialias"]),"fill-opacity":new ae(W.paint_fill["fill-opacity"]),"fill-color":new ae(W.paint_fill["fill-color"]),"fill-outline-color":new ae(W.paint_fill["fill-outline-color"]),"fill-translate":new te(W.paint_fill["fill-translate"]),"fill-translate-anchor":new te(W.paint_fill["fill-translate-anchor"]),"fill-pattern":new ae(W.paint_fill["fill-pattern"]),"fill-emissive-strength":new te(W.paint_fill["fill-emissive-strength"])}),layout:C0};const z0=vt([{name:"a_pos_normal_ed",components:4,type:"Int16"}]),D0=vt([{name:"a_pos_end",components:4,type:"Int16"},{name:"a_angular_offset_factor",components:1,type:"Int16"}]),R0=vt([{name:"a_centroid_pos",components:2,type:"Uint16"}]),L0=vt([{name:"a_hidden_by_landmark",components:1,type:"Uint8"}]),k0=vt([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]),{members:O0}=z0;var Ad={},B0=el,o_=tc;function tc(t,e,i,n,a){this.properties={},this.extent=i,this.type=0,this._pbf=t,this._geometry=-1,this._keys=n,this._values=a,t.readFields(F0,this,e)}
7function F0(t,e,i){t==1?e.id=i.readVarint():t==2?function(n,a){for(var l=n.readVarint()+n.pos;n.pos<l;){var h=a._keys[n.readVarint()],p=a._values[n.readVarint()];a.properties[h]=p}}(i,e):t==3?e.type=i.readVarint():t==4&&(e._geometry=i.pos)}function N0(t){for(var e,i,n=0,a=0,l=t.length,h=l-1;a<l;h=a++)n+=((i=t[h]).x-(e=t[a]).x)*(e.y+i.y);return n}tc.types=["Unknown","Point","LineString","Polygon"],tc.prototype.loadGeometry=function(){var t=this._pbf;t.pos=this._geometry;for(var e,i=t.readVarint()+t.pos,n=1,a=0,l=0,h=0,p=[];t.pos<i;){if(a<=0){var m=t.readVarint();n=7&m,a=m>>3}if(a--,n===1||n===2)l+=t.readSVarint(),h+=t.readSVarint(),n===1&&(e&&p.push(e),e=[]),e.push(new B0(l,h));else{if(n!==7)throw new Error("unknown command "+n);e&&e.push(e[0].clone())}}return e&&p.push(e),p},tc.prototype.bbox=function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,i=1,n=0,a=0,l=0,h=1/0,p=-1/0,m=1/0,g=-1/0;t.pos<e;){if(n<=0){var x=t.readVarint();i=7&x,n=x>>3}if(n--,i===1||i===2)(a+=t.readSVarint())<h&&(h=a),a>p&&(p=a),(l+=t.readSVarint())<m&&(m=l),l>g&&(g=l);else if(i!==7)throw new Error("unknown command "+i)}return[h,m,p,g]},tc.prototype.toGeoJSON=function(t,e,i){var n,a,l=this.extent*Math.pow(2,i),h=this.extent*t,p=this.extent*e,m=this.loadGeometry(),g=tc.types[this.type];function x(E){for(var M=0;M<E.length;M++){var I=E[M];E[M]=[360*(I.x+h)/l-180,360/Math.PI*Math.atan(Math.exp((180-360*(I.y+p)/l)*Math.PI/180))-90]}}switch(this.type){case 1:var v=[];for(n=0;n<m.length;n++)v[n]=m[n][0];x(m=v);break;case 2:for(n=0;n<m.length;n++)x(m[n]);break;case 3:for(m=function(E){var M=E.length;if(M<=1)return[E];for(var I,z,D=[],F=0;F<M;F++){var j=N0(E[F]);j!==0&&(z===void 0&&(z=j<0),z===j<0?(I&&D.push(I),I=[E[F]]):I.push(E[F]))}return I&&D.push(I),D}(m),n=0;n<m.length;n++)for(a=0;a<m[n].length;a++)x(m[n][a])}m.length===1?m=m[0]:g="Multi"+g;var w={type:"Feature",geometry:{type:g,coordinates:m},properties:this.properties};return"id"in this&&(w.id=this.id),w};var V0=o_,a_=l_;function l_(t,e){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(U0,this,e),this.length=this._features.length}function U0(t,e,i){t===15?e.version=i.readVarint():t===1?e.name=i.readString():t===5?e.extent=i.readVarint():t===2?e._features.push(i.pos):t===3?e._keys.push(i.readString()):t===4&&e._values.push(function(n){for(var a=null,l=n.readVarint()+n.pos;n.pos<l;){var h=n.readVarint()>>3;a=h===1?n.readString():h===2?n.readFloat():h===3?n.readDouble():h===4?n.readVarint64():h===5?n.readVarint():h===6?n.readSVarint():h===7?n.readBoolean():null}return a}(i))}l_.prototype.feature=function(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];var e=this._pbf.readVarint()+this._pbf.pos;return new V0(this._pbf,e,this.extent,this._keys,this._values)};var j0=a_;function G0(t,e,i){if(t===3){var n=new j0(i,i.readVarint()+i.pos);n.length&&(e[n.name]=n)}}var bf=Ad.VectorTile=function(t,e){this.layers=t.readFields(G0,{},e)},Id=Ad.VectorTileFeature=o_;function Cd(t,e,i,n){const a=[],l=n===0?(h,p,m,g,x,v)=>{h.push(new Ne(v,m+(v-p)/(g-p)*(x-m)))}:(h,p,m,g,x,v)=>{h.push(new Ne(p+(v-m)/(x-m)*(g-p),v))};for(const h of t){const p=[];for(const m of h){if(m.length<=2)continue;const g=[];for(let w=0;w<m.length-1;w++){const E=m[w].x,M=m[w].y,I=m[w+1].x,z=m[w+1].y,D=n===0?E:M,F=n===0?I:z;D<e?F>e&&l(g,E,M,I,z,e):D>i?F<i&&l(g,E,M,I,z,i):g.push(m[w]),F<e&&D>=e&&l(g,E,M,I,z,e),F>i&&D<=i&&l(g,E,M,I,z,i)}let x=m[m.length-1];const v=n===0?x.x:x.y;v>=e&&v<=i&&g.push(x),g.length&&(x=g[g.length-1],g[0].x===x.x&&g[0].y===x.y||g.push(g[0]),p.push(g))}p.length&&a.push(p)}return a}function Pd(t,e){return t.x-e.x||t.y-e.y}function c_(t,e){return Pd(t.min,e.min)===0&&Pd(t.max,e.max)===0}function u_(t,e){return!(t.min.x>e.max.x||t.max.x<e.min.x||t.min.y>e.max.y||t.max.y<e.min.y)}function h_(t,e,i){const n=1/Ve,a=1/(1<<i.canonical.z),l=(e.x*n+i.canonical.x)*a+i.wrap,h=(e.y*n+i.canonical.y)*a;return{min:new Ne((t.x*n+i.canonical.x)*a+i.wrap,(t.y*n+i.canonical.y)*a),max:new Ne(l,h)}}function q0(t,e,i){const n=1<<i.canonical.z,a=((e.x-i.wrap)*n-i.canonical.x)*Ve,l=(e.
vendor: 3,468 bytes, line 7
7y*n-i.canonical.y)*Ve;return{min:new Ne(((t.x-i.wrap)*n-i.canonical.x)*Ve,(t.y*n-i.canonical.y)*Ve),max:new Ne(a,l)}}function d_(t,e,i,n,a,l,h){const p=t.indices,m=t.vertices,g=[];for(let x=n;x<n+a;x+=3){const v=e[i[x+0]+l],w=e[i[x+1]+l],E=e[i[x+2]+l],M=Math.min(v.x,w.x,E.x),I=Math.max(v.x,w.x,E.x),z=Math.min(v.y,w.y,E.y),D=Math.max(v.y,w.y,E.y);g.length=0,t.grid.query(new Ne(M,z),new Ne(I,D),g);for(let F=0;F<g.length;F++){const j=g[F];if(rf(m[p[3*j+0]],m[p[3*j+1]],m[p[3*j+2]],v,w,E,h))return!0}}return!1}function p_(t,e,i,n){if(!t||!i)return!1;let a=t.vertices;if(!e.canonical.equals(n.canonical)||e.wrap!==n.wrap){if(i.vertices.length<t.vertices.length)return p_(i,n,t,e);const l=e.canonical,h=n.canonical,p=Math.pow(2,h.z-l.z);a=t.vertices.map(m=>new Ne((m.x+l.x*Ve)*p-h.x*Ve,(m.y+l.y*Ve)*p-h.y*Ve))}return d_(i,a,t.indices,0,t.indices.length,0,0)}Ad.VectorTileLayer=a_;class f_{constructor(e){this.size=e,this.minimums=[],this.maximums=[],this.leaves=[]}getElevation(e,i){const n=this.toIdx(e,i);return{min:this.minimums[n],max:this.maximums[n]}}isLeaf(e,i){return this.leaves[this.toIdx(e,i)]}toIdx(e,i){return i*this.size+e}}function m_(t,e,i,n){let a=0,l=Number.MAX_VALUE;for(let h=0;h<3;h++)if(Math.abs(n[h])<1e-15){if(i[h]<t[h]||i[h]>e[h])return null}else{const p=1/n[h];let m=(t[h]-i[h])*p,g=(e[h]-i[h])*p;if(m>g){const x=m;m=g,g=x}if(m>a&&(a=m),g<l&&(l=g),a>l)return null}return a}function __(t,e,i,n,a,l,h,p,m,g,x){const v=n-t,w=a-e,E=l-i,M=h-t,I=p-e,z=m-i,D=x[1]*z-x[2]*I,F=x[2]*M-x[0]*z,j=x[0]*I-x[1]*M,V=v*D+w*F+E*j;if(Math.abs(V)<1e-15)return null;const X=1/V,q=g[0]-t,J=g[1]-e,ee=g[2]-i,oe=(q*D+J*F+ee*j)*X;if(oe<0||oe>1)return null;const fe=J*E-ee*w,le=ee*v-q*E,ge=q*w-J*v,_e=(x[0]*fe+x[1]*le+x[2]*ge)*X;return _e<0||oe+_e>1?null:(M*fe+I*le+z*ge)*X}function g_(t,e,i){return(t-e)/(i-e)}function y_(t,e,i,n,a,l,h,p,m){const g=1<<i,x=l-n,v=h-a,w=(t+1)/g*x+n,E=(e+0)/g*v+a,M=(e+1)/g*v+a;p[0]=(t+0)/g*x+n,p[1]=E,m[0]=w,m[1]=M}class x_{constructor(e){if(this.maximums=[],this.minimums=[],this.leaves=[],this.childOffsets=[],this.nodeCount=0,this.dem=e,this._siblingOffset=[[0,0],[1,0],[0,1],[1,1]],!this.dem)return;const i=function(l){const h=Math.ceil(Math.log2(l.dim/8)),p=[];let m=Math.ceil(Math.pow(2,h));const g=1/m,x=(E,M,I,z,D)=>{const F=z?1:0,j=(E+1)*I-F,V=M*I,X=(M+1)*I-F;D[0]=E*I,D[1]=V,D[2]=j,D[3]=X};let v=new f_(m);const w=[];for(let E=0;E<m*m;E++){x(E%m,Math.floor(E/m),g,!1,w);const M=So(w[0],w[1],l),I=So(w[2],w[1],l),z=So(w[2],w[3],l),D=So(w[0],w[3],l);v.minimums.push(Math.min(M,I,z,D)),v.maximums.push(Math.max(M,I,z,D)),v.leaves.push(1)}for(p.push(v),m/=2;m>=1;m/=2){const E=p[p.length-1];v=new f_(m);for(let M=0;M<m*m;M++){x(M%m,Math.floor(M/m),2,!0,w);const I=E.getElevation(w[0],w[1]),z=E.getElevation(w[2],w[1]),D=E.getElevation(w[2],w[3]),F=E.getElevation(w[0],w[3]),j=E.isLeaf(w[0],w[1]),V=E.isLeaf(w[2],w[1]),X=E.isLeaf(w[2],w[3]),q=E.isLeaf(w[0],w[3]),J=Math.min(I.min,z.min,D.min,F.min),ee=Math.max(I.max,z.max,D.max,F.max),oe=j&&V&&X&&q;v.maximums.push(ee),v.minimums.push(J),v.leaves.push(ee-J<=5&&oe?1:0)}p.push(v)}return p}(this.dem),n=i.length-1,a=i[n];this._addNode(a.minimums[0],a.maximums[0],a.leaves[0]),this._construct(i,0,0,n,0)}raycastRoot(e,i,n,a,l,h,p=1){return m_([e,i,-100],[n,a,this.maximums[0]*p],l,h)}raycast(e,i,n,a,l,h,p=1){if(!this.nodeCount)return null;const m=this.raycastRoot(e,i,n,a,l,h,p);if(m==null)return null;const g=[],x=[],v=[],w=[],E=[{idx:0,t:m,nodex:0,nodey:0,depth:0}];for(;E.length>0;
vendor: 5,461 bytes, line 7
7){const{idx:M,t:I,nodex:z,nodey:D,depth:F}=E.pop();if(this.leaves[M]){y_(z,D,F,e,i,n,a,v,w);const V=1<<F,X=(z+0)/V,q=(z+1)/V,J=(D+0)/V,ee=(D+1)/V,oe=So(X,J,this.dem)*p,fe=So(q,J,this.dem)*p,le=So(q,ee,this.dem)*p,ge=So(X,ee,this.dem)*p,_e=__(v[0],v[1],oe,w[0],v[1],fe,w[0],w[1],le,l,h),me=__(w[0],w[1],le,v[0],w[1],ge,v[0],v[1],oe,l,h),Ee=Math.min(_e!==null?_e:Number.MAX_VALUE,me!==null?me:Number.MAX_VALUE);if(Ee!==Number.MAX_VALUE)return Ee;{const we=o.Q.scaleAndAdd([],l,h,I);if(v_(oe,fe,ge,le,g_(we[0],v[0],w[0]),g_(we[1],v[1],w[1]))>=we[2])return I}continue}let j=0;for(let V=0;V<this._siblingOffset.length;V++){y_((z<<1)+this._siblingOffset[V][0],(D<<1)+this._siblingOffset[V][1],F+1,e,i,n,a,v,w),v[2]=-100,w[2]=this.maximums[this.childOffsets[M]+V]*p;const X=m_(v,w,l,h);if(X!=null){const q=X;g[V]=q;let J=!1;for(let ee=0;ee<j&&!J;ee++)q>=g[x[ee]]&&(x.splice(ee,0,V),J=!0);J||(x[j]=V),j++}}for(let V=0;V<j;V++){const X=x[V];E.push({idx:this.childOffsets[M]+X,t:g[X],nodex:(z<<1)+this._siblingOffset[X][0],nodey:(D<<1)+this._siblingOffset[X][1],depth:F+1})}}return null}_addNode(e,i,n){return this.minimums.push(e),this.maximums.push(i),this.leaves.push(n),this.childOffsets.push(0),this.nodeCount++}_construct(e,i,n,a,l){if(e[a].isLeaf(i,n)===1)return;this.childOffsets[l]||(this.childOffsets[l]=this.nodeCount);const h=a-1,p=e[h];let m=0,g=0;for(let x=0;x<this._siblingOffset.length;x++){const v=2*i+this._siblingOffset[x][0],w=2*n+this._siblingOffset[x][1],E=p.getElevation(v,w),M=p.isLeaf(v,w),I=this._addNode(E.min,E.max,M);M&&(m|=1<<x),g||(g=I)}for(let x=0;x<this._siblingOffset.length;x++)m&1<<x||this._construct(e,2*i+this._siblingOffset[x][0],2*n+this._siblingOffset[x][1],h,g+x)}}function v_(t,e,i,n,a,l){return Ct(Ct(t,i,l),Ct(e,n,l),a)}function So(t,e,i){const n=i.dim,a=kt(t*n-.5,0,n-1),l=kt(e*n-.5,0,n-1),h=Math.floor(a),p=Math.floor(l),m=Math.min(h+1,n-1),g=Math.min(p+1,n-1);return v_(i.get(h,p),i.get(m,p),i.get(h,g),i.get(m,g),a-h,l-p)}const Z0={mapbox:[6553.6,25.6,.1,1e4],terrarium:[256,1,1/256,32768]};function $0(t,e,i){return(256*t*256+256*e+i)/10-1e4}function W0(t,e,i){return 256*t+e+i/256-32768}class zd{get tree(){return this._tree||this._buildQuadTree(),this._tree}constructor(e,i,n,a=!1){if(this.uid=e,i.height!==i.width)throw new RangeError("DEM tiles must be square");if(n&&n!=="mapbox"&&n!=="terrarium")return Ci(`"${n}" is not a valid encoding type. Valid types include "mapbox" and "terrarium".`);this.stride=i.height;const l=this.dim=i.height-2,h=new Uint32Array(i.data.buffer);if(this.pixels=new Uint8Array(i.data.buffer),this.floatView=new Float32Array(i.data.buffer),this.borderReady=a,this._modifiedForSources={},!a){for(let m=0;m<l;m++)h[this._idx(-1,m)]=h[this._idx(0,m)],h[this._idx(l,m)]=h[this._idx(l-1,m)],h[this._idx(m,-1)]=h[this._idx(m,0)],h[this._idx(m,l)]=h[this._idx(m,l-1)];h[this._idx(-1,-1)]=h[this._idx(0,0)],h[this._idx(l,-1)]=h[this._idx(l-1,0)],h[this._idx(-1,l)]=h[this._idx(0,l-1)],h[this._idx(l,l)]=h[this._idx(l-1,l-1)]}const p=n==="terrarium"?W0:$0;for(let m=0;m<h.length;++m){const g=4*m;this.floatView[m]=p(this.pixels[g],this.pixels[g+1],this.pixels[g+2])}this._timestamp=_n.now()}_buildQuadTree(){this._tree=new x_(this)}get(e,i,n=!1){n&&(e=kt(e,-1,this.dim),i=kt(i,-1,this.dim));const a=this._idx(e,i);return this.floatView[a]}set(e,i,n){const a=this._idx(e,i),l=this.floatView[a];return this.floatView[a]=n,n-l}static getUnpackVector(e){return Z0[e]}_idx(e,i){if(e<-1||e>=this.dim+1||i<-1||i>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(i+1)*this.stride+(e+1)}static pack(e,i){const n=[0,0,0,0],a=zd.getUnpackVector(i);let l=Math.floor((e+a[3])/a[2]);return n[2]=l%256,l=Math.floor(l/256),n[1]=l%256,l=Math.floor(l/256),n[0]=l,n}getPixels(){return new t_({width:this.stride,height:this.stride},this.pixels)}backfillBorder(e,i,n){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let a=i*this.dim,l=i*this.dim+this.dim,h=n*this.dim,p=n*this.dim+this.dim;switch(i){case-1:a=l-1;break;case 1:l=a+1}switch(n){case-1:h=p-1;break;case 1:p=h+1}const m=-i*this.dim,g=-n*this.dim;for(let x=h;x<p;x++)for(let v=a;v<l;v++){const w=4*this._idx(v,x),E=4*this._idx(v+m,x+g);this.pixels[w+0]=e.pixels[E+0],this.pixels[w+1]=e.pixels[E+1],this.pixels[w+2]=e.pixels[E+2],this.pixels[w+3]=e.pixels[E+3]}}onDeserialize(){this._tree&&(this._tree.dem=this)}}Qe(zd,"DEMData"),Qe(x_,"DemMinMaxQuadTree",{omit:["dem"]});class ic{constructor(e,i,n){this._demTile=e,this._dem=this._demTile.dem,this._scale=i,this._offset=n}static create(e,i,n){const a=n||e.findDEMTileFor(i);if(!a||!a.dem)return;const l=a.dem,h=a.tileID,p=1<<i.canonical.z-h.canonical.z;return new ic(a,l.dim/Ve/p,[(i.canonical.x/p-h.canonical.x)*l.dim,(i.canonical.y/p-h.canonical.y)*l.dim])}tileCoordToPixel(e,i){const n=i*this._scale+this._offset[1],a=Math.floor(e*this._scale+this._offset[0]),l=Math.floor(n);return new Ne(a,l)}getElevationAt(e,i,n,a){const l=e*this._scale+this._offset[0],h=i*this._scale+this._offset[1],p=Math.floor(l),m=Math.floor(h),g=this._dem;return a=!!a,n?Ct(Ct(g.get(p,m,a),g.get(p,m+1,a),h-m),Ct(g.get(p+1,m,a),g.get(p+1,m+1,a),h-m),l-p):g.get(p,m,a)}getElevationAtPixel(e,i,n){return this._dem.get(e,i,!!n)}getMeterToDEM(e){return(1<<this._demTile.tileID.canonical.z)*Ir(1,e)*this._dem.stride}}const Q0=Id.types,H0=["fill-extrusion-base","fill-extrusion-height","fill-extrusion-color","fill-extrusion-pattern","fill-extrusion-flood-light-wall-radius"],X0=["f
7ill-extrusion-flood-light-ground-radius"],Y0=Math.pow(2,13),J0=Math.pow(2,15)-1,b_=new Ne(0,1),Mo=2147483648;function Du(t,e,i,n,a,l,h,p){t.emplaceBack((e<<1)+h,(i<<1)+l,(Math.floor(n*Y0)<<1)+a,Math.round(p))}function Dd(t,e,i,n,a,l){t.emplaceBack(e.x,e.y,(i.x<<1)+n,(i.y<<1)+a,l)}function Ru(t,e,i){t.emplaceBack(e.x,e.y,e.z,i[0]*16384,i[1]*16384,i[2]*16384)}class w_{constructor(){this.vertexOffset=0,this.vertexCount=0,this.indexOffset=0,this.indexCount=0}}class T_{constructor(){this.centroidXY=new Ne(0,0),this.vertexArrayOffset=0,this.vertexCount=0,this.groundVertexArrayOffset=0,this.groundVertexCount=0,this.flags=0,this.footprintSegIdx=-1,this.footprintSegLen=0,this.polygonSegIdx=-1,this.polygonSegLen=0,this.min=new Ne(Number.MAX_VALUE,Number.MAX_VALUE),this.max=new Ne(-Number.MAX_VALUE,-Number.MAX_VALUE),this.height=0}span(){return new Ne(this.max.x-this.min.x,this.max.y-this.min.y)}}class E_{constructor(){this.acc=new Ne(0,0),this.accCount=0,this.centroidDataIndex=0}startRing(e,i){e.min.x===Number.MAX_VALUE&&(e.min.x=e.max.x=i.x,e.min.y=e.max.y=i.y)}appendEdge(e,i,n){this.accCount++,this.acc._add(i);let a=!!this.borders;i.x<e.min.x?(e.min.x=i.x,a=!0):i.x>e.max.x&&(e.max.x=i.x,a=!0),i.y<e.min.y?(e.min.y=i.y,a=!0):i.y>e.max.y&&(e.max.y=i.y,a=!0),((i.x===0||i.x===Ve)&&i.x===n.x)!=((i.y===0||i.y===Ve)&&i.y===n.y)&&this.processBorderOverlap(i,n),a&&this.checkBorderIntersection(i,n)}checkBorderIntersection(e,i){i.x<0!=e.x<0&&this.addBorderIntersection(0,Ct(i.y,e.y,(0-i.x)/(e.x-i.x))),i.x>Ve!=e.x>Ve&&this.addBorderIntersection(1,Ct(i.y,e.y,(Ve-i.x)/(e.x-i.x))),i.y<0!=e.y<0&&this.addBorderIntersection(2,Ct(i.x,e.x,(0-i.y)/(e.y-i.y))),i.y>Ve!=e.y>Ve&&this.addBorderIntersection(3,Ct(i.x,e.x,(Ve-i.y)/(e.y-i.y)))}addBorderIntersection(e,i){this.borders||(this.borders=[[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE]]);const n=this.borders[e];i<n[0]&&(n[0]=i),i>n[1]&&(n[1]=i)}processBorderOverlap(e,i){if(e.x===i.x){if(e.y===i.y)return;const n=e.x===0?0:1;this.addBorderIntersection(n,i.y),this.addBorderIntersection(n,e.y)}else{const n=e.y===0?2:3;this.addBorderIntersection(n,i.x),this.addBorderIntersection(n,e.x)}}centroid(){return this.accCount===0?new Ne(0,0):new Ne(Math.floor(Math.max(0,this.acc.x)/this.accCount),Math.floor(Math.max(0,this.acc.y)/this.accCount))}intersectsCount(){return this.borders?this.borders.reduce((e,i)=>e+ +(i[0]!==Number.MAX_VALUE),0):0}}function S_(t,e){const i=t.add(e)._unit(),n=kt(t.x*i.x+t.y*i.y,-1,1);var a,l,h;return a=Math.acos(n),Math.min(4,Math.max(-4,Math.tan(a)))/4*J0*((l=t).x*(h=e).y-l.y*h.x<0?-1:1)}const K0=[t=>t.x<0,t=>t.x>Ve,t=>t.y<0,t=>t.y>Ve];function ex(t,e,i,n){const a=[4];if(n===0)return a;i._mult(n);const l=t.sub(i),h=e.sub(i),p=[t,e,l,h];for(let m=0;m<4;m++)for(const g of p)if(K0[m](g)){a.push(m);break}return a}class M_{constructor(e){this.vertexArray=new wr,this.indexArray=new Xi,this.programConfigurations=new xo(e.layers,e.zoom,i=>X0.includes(i)),this._segments=new Fi,this.hiddenByLandmarkVertexArray=new Vp,this._segmentToGroundQuads={},this._segmentToGroundQuads[0]=[],this._segmentToRegionTriCounts={},this._segmentToRegionTriCounts[0]=[0,0,0,0,0],this.regionSegments={},this.regionSegments[4]=new Fi}getDefaultSegment(){return this.regionSegments[4]}hasData(){return this.vertexArray.length!==0}addData(e,i,n,a=!1){const l=e.length;if(l>2){let h=Math.max(0,this._segments.get().length-1);const p=this._segments._prepareSegment(4*l,this.vertexArray.length,2*this._segmentToGroundQuads[h].length);let m;h!==this._segments.get().length-1&&(h++,this._segmentToGroundQuads[h]=[],this._segmentToRegionTriCounts[h]=[0,0,0,0,0]);{const g=e[0],x=e[1];m=S_(g.sub(e[l-1])._perp()._unit(),x.sub(g)._perp()._unit())}for(let g=0;g<l;g++){const x=g===l-1?0:g+1,v=e[g],w=e[x],E=e[x===l-1?0:x+1],M=w.sub(v)._perp()._unit(),I=S_(M,E.sub(w)._perp()._unit()),z=m,D=I;if(wf(v,w,i)||a&&C_(v,i)&&C_(w,i)){m=I;continue}const F=p.vertexLength;Dd(this.vertexArray,v,w,1,1,z),Dd(this.vertexArray,v,w,1,0,z),Dd(this.vertexArray,v,w,0,1,D),Dd(this.vertexArray,v,w,0,0,D),p.vertexLength+=4;const j=ex(v,w,M,n);for(const V of j)this._segmentToGroundQuads[h].push({id:F,region:V}),this._segmentToRegionTriCounts[h][V]+=2,p.primitiveLength+=2;m=I}}}prepareBorderSegments(){if(!this.hasData())return;const e=this._segments.get(),i=e.length;for(let n=0;n<i;n++)this._segmentToGroundQuads[n].sort((a,l)=>a.region-l.region);for(let n=0;n<i;n++){const a=this._segmentToGroundQuads[n],l=e[n],h=this._segmentToRegionTriCounts[n];h.reduce((m,g)=>m+g,0);let p=0;for(let m=0;m<=4;m++){const g=h[m];if(g!==0){let x=this.regionSegments[m];x||(x=this.regionSegments[m]=new Fi);const v={vertexOffset:l.vertexOffset,primitiveOffset:l.primitiveOffset+p,vertexLength:l.vertexLength,primitiveLength:g};x.get().push(v)}p+=g}for(let m=0;m<a.length;m++){const g=a[m].id;this.indexArray.emplaceBack(g,g+1,g+3),this.indexArray.emplaceBack(g,g+3,g+2)}}this._segmentToGroundQuads=null,this._segmentToRegionTriCounts=null,this._segments.destroy(),this._segments=null}addPaintPropertiesData(e,i,n,a,l,h){this.hasData()&&this.programConfigurations.populatePaintArrays(this.vertexArray.length,e,i,n,a,l,h)}upload(e){this.hasData()&&(this.vertexBuffer=e.createVertexBuffer(this.vertexArray,D0.members),this.indexBuffer=e.createIndexBuffer(this.indexArray))}uploadPaintProperties(e){this.hasData()&&this.programConfigurations.upload(e)}update(e,i,n,a,l,h){this.hasData()&&this.programConfigurations.updatePaintArrays(e,i,n,a,l,h)}updateHiddenByLandmark(e){if(!this.hasData())return;const i=e.groundVertexCount+e.groundVertexArrayOffset;if(e.groundVertexCount===0)return;const n=e.flags&Mo?1:0;for(let a=e.groundVertexArrayOffset;a<i;++a)this.hiddenByLandmarkVertexArray.emplace(a,n);this._needsHiddenByLandmarkUpdate=!0}uploadHiddenByLandmark(e){this.hasData()&&this._needsHiddenByLandmarkUpdate&&(!this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexArray.length>0?this.hiddenByLandmarkVertexBuffer=e.createVertexBuffer(this.hiddenByLandmarkVertexArray,L0.members,!0):this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexBuffer.updateData(this.hiddenByLandmarkVertexArray),this._needsHiddenByLandmarkUpdate=!1)}destroy(){if(this.vertexBuffer){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexBuffer.destroy(),this._segments&&this._segments.destroy(),this.programConfigurations.destroy();for(let e=0;e<=4;e++){const i=this.regionSegments[e];i&&i.destroy()}}}}class Rd{constructor(e){this.zoom=e.zoom,this.canonical=e.canonical,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(i=>i.fqid),this.index=e.index,this.hasPattern=!1,this.edgeRadius=0,this.projection=e.projection,this.activeReplacements=[],this.replacementUpdateTime=0,this.centroidData=[],this.footprintIndices=new Xi,this.footprintVertices=new ar,this.footprintSegments=[],this.layoutVertexArray=new lr,this.centroidVertexArray=new gm,this.indexArray=new Xi,this.programConfigurations=new xo(e.layers,e.zoom,i=>H0.includes(i)),this.segments=new Fi,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.groundEffect=new M_(e),this.maxHeight=0,this.partLookup={},this.triangleSubSegments=[],this.polygonSegments=[]}populate(e,i,n,a){this.features=[],this.hasPattern=yf("fill-extrusion",this.layers,i),this.featuresOnBorder=[],this.borderFeatureIndices=[[],[],[],[]],this.borderDoneWithNeighborZ=[-1,-1,-1,-1],this.tileToMeter=pd(n),this.edgeRadius=this.layers[0].layout.get("fill-extrusion-edge-radius")/this.tileToMeter;for(const{feature:l,id:h,index:p,sourceLayerIndex:m}of e){const g=this.layers[0]._featureFilter.needGeometry,x=wo(l,g);if(!this.layers[0]._featureFilter.filter(new B(this.zoom),x,n))continue;const v={id:h,sourceLayerIndex:m,index:p,geometry:g?x.geometry:Ls(l,n,a),properties:l.properties,type:l.type,patterns:{}},w=this.layoutVertexArray.length;this.hasPattern?this.features.push(xf("fill-extrusion",this.layers,v,this.zoom,i)):this.addFeature(v,v.geometry,p,n,{},i.availableImages,a,i.brightness),i.featureIndex.insert(l,v.geometry,p,m,this.index,w)}this.sortBorders(),this.projection.name==="mercator"&&this.splitToSubtiles(),this.groundEffect.prepareBorderSegments(),this.polygonSegments.length=0}addFeatures(e,i,n,a,l,h){for(const p of this.features){const{geometry:m}=p;this.addFeature(p,m,p.index,i,n,a,l,h)}this.sortBorders(),this.projection.name==="mercator"&&this.splitToSubtiles()}update(e,i,n,a,l){const h=Object.keys(e).length!==0;if(h&&!this.stateDependentLayers.length)return;const p=h?this.stateDependentLayers:this.layers;this.programConfigurations.updatePaintArrays(e,i,p,n,a,l),this.groundEffect.update(e,i,p,n,a,l)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload||this.groundEffect.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,O0),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.layoutVertexExtArray&&(this.layoutVertexExtBuffer=e.createVertexBuffer(this.layoutVertexExtArray,k0.members,!0)),this.groundEffect.upload(e)),this.groundEffect.uploadPaintProperties(e),this.programConfigurations.upload(e),this.uploaded=!0}uploadCentroid(e){this.groundEffect.uploadHiddenByLandmark(e),this.needsCentroidUpdate&&(!this.centroidVertexBuffer&&this.centroidVertexArray.length>0?this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,R0.members,!0):this.centroidVertexBuffer&&this.centroidVertexBuffer.updateData(this.centroidVertexArray),this.needsCentroidUpdate=!1)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.centroidVertexBuffer&&this.centroidVertexBuffer.destroy(),this.layoutVertexExtBuffer&&this.layoutVertexExtBuffer.destroy(),this.groundEffect.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(e,i,n,a,l,h,p,m){const g=this.layers[0].paint.get("fill-extrusion-flood-light-ground-radius").evaluate(e,{})/this.tileToMeter,x=[new Ne(0,0),new Ne(Ve,Ve)],v=p.projection,w=v.name==="globe",E=Q0[e.type]==="Polygon",M=new E_;M.centroidDataIndex=this.centroidData.length;const I=new T_,z=this.layers[0].paint.get("fill-extrusion-base").evaluate(e,{},a)<=0,D=this.layers[0].paint.get("fill-extrusion-height").evaluate(e,{},a);I.height=D,I.vertexArrayOffset=this.layoutVertexArray.length,I.groundVertexArrayOffset=this.groundEffect.vertexArray.length,w&&!this.layoutVertexExtArray&&(this.layoutVertexExtArray=new cn);const F=gf(i,500);for(let ee=F.length-1;ee>=0;ee--){const oe=F[ee];(oe.length===0||(j=oe[0]).every(fe=>fe.x<=0)||j.every(fe=>fe.x>=Ve)||j.every(fe=>fe.y<=0)||j.every(fe=>fe.y>=Ve))&&F.splice(ee,1)}var j;let V;if(w)V=R_(F,x,a);else{V=[];for(const ee of F)V.push({polygon:ee,bounds:x})}const X=E?this.edgeRadius:0,q=X>0&&this.zoom<17,J=(ee,oe)=>{if(ee.length===0)return!1;const fe=ee[ee.length-1];return oe.x===fe.x&&oe.y===fe.y};for(const{polygon:ee,bounds:oe}of V){let fe=0,le=0;for(const Ee of ee)E&&!Ee[0].equals(Ee[Ee.length-1])&&Ee.push(Ee[0]),le+=E?Ee.length-1:Ee.length;const ge=this.segments.prepareSegment((E?5:4)*le,this.layoutVertexArray,this.indexArray);I.footprintSegIdx<0&&(I.footprintSegIdx=this.footprintSegments.length),I.polygonSegIdx<0&&(I.polygonSegIdx=this.polygonSegments.length);const _e={triangleArrayOffset:this.indexArray.length,triangleCount:0,triangleSegIdx:this.segments.segments.length-1},me=new w_;if(me.vertexOffset=this.footprintVertices.length,me.indexOffset=3*this.footprintIndices.length,me.ringIndices=[],E){const Ee=[],we=[];fe=ge.vertexLength;for(let Ae=0;Ae<ee.length;Ae++){const ye=ee[Ae];
vendor: 22,424 bytes, line 7
7ye.length&&Ae!==0&&we.push(Ee.length/2);const Ye=[];let $e,ze;$e=ye[1].sub(ye[0])._perp()._unit(),me.ringIndices.push(ye.length-1);for(let ct=1;ct<ye.length;ct++){const it=ye[ct],Je=ye[ct===ye.length-1?1:ct+1],De=it.clone();if(X){ze=Je.sub(it)._perp()._unit();const ot=$e.add(ze)._unit(),bt=X*Math.min(4,1/($e.x*ot.x+$e.y*ot.y));De.x+=bt*ot.x,De.y+=bt*ot.y,De.x=Math.round(De.x),De.y=Math.round(De.y),$e=ze}!z||X!==0&&!q||J(Ye,De)||Ye.push(De),Du(this.layoutVertexArray,De.x,De.y,0,0,1,1,0),ge.vertexLength++,this.footprintVertices.emplaceBack(it.x,it.y),Ee.push(it.x,it.y),w&&Ru(this.layoutVertexExtArray,v.projectTilePoint(De.x,De.y,a),v.upVector(a,De.x,De.y))}z&&(X===0||q)&&(Ye.length!==0&&J(Ye,Ye[0])&&Ye.pop(),this.groundEffect.addData(Ye,oe,g))}const Ce=Md(Ee,we);for(let Ae=0;Ae<Ce.length;Ae+=3)this.footprintIndices.emplaceBack(me.vertexOffset+Ce[Ae+0],me.vertexOffset+Ce[Ae+1],me.vertexOffset+Ce[Ae+2]),this.indexArray.emplaceBack(fe+Ce[Ae],fe+Ce[Ae+2],fe+Ce[Ae+1]),ge.primitiveLength++;me.indexCount+=Ce.length,me.vertexCount+=this.footprintVertices.length-me.vertexOffset}for(let Ee=0;Ee<ee.length;Ee++){const we=ee[Ee];M.startRing(I,we[0]);let Ce=we.length>4&&P_(we[we.length-2],we[0],we[1]),Ae=X?tx(we[we.length-2],we[0],we[1],X):0;const ye=[];let Ye,$e,ze;$e=we[1].sub(we[0])._perp()._unit();let ct=!0;for(let it=1,Je=0;it<we.length;it++){let De=we[it-1],ot=we[it];const bt=we[it===we.length-1?1:it+1];if(M.appendEdge(I,ot,De),wf(ot,De,oe)){X&&($e=bt.sub(ot)._perp()._unit(),ct=!ct);continue}const pt=ot.sub(De)._perp(),Mt=pt.x/(Math.abs(pt.x)+Math.abs(pt.y)),wt=pt.y>0?1:0,Rt=De.dist(ot);if(Je+Rt>32768&&(Je=0),X){ze=bt.sub(ot)._perp()._unit();let $t=I_(De,ot,bt,A_($e,ze),X);isNaN($t)&&($t=0);const Ut=ot.sub(De)._unit();De=De.add(Ut.mult(Ae))._round(),ot=ot.add(Ut.mult(-$t))._round(),Ae=$t,$e=ze,z&&this.zoom>=17&&(J(ye,De)||ye.push(De),J(ye,ot)||ye.push(ot))}const ht=ge.vertexLength,oi=we.length>4&&P_(De,ot,bt);let ni=z_(Je,Ce,ct);if(Du(this.layoutVertexArray,De.x,De.y,Mt,wt,0,0,ni),Du(this.layoutVertexArray,De.x,De.y,Mt,wt,0,1,ni),Je+=Rt,ni=z_(Je,oi,!ct),Ce=oi,Du(this.layoutVertexArray,ot.x,ot.y,Mt,wt,0,0,ni),Du(this.layoutVertexArray,ot.x,ot.y,Mt,wt,0,1,ni),ge.vertexLength+=4,this.indexArray.emplaceBack(ht+0,ht+1,ht+2),this.indexArray.emplaceBack(ht+1,ht+3,ht+2),ge.primitiveLength+=2,X){const $t=fe+(it===1?we.length-2:it-2),Ut=it===1?fe:$t+1;if(this.indexArray.emplaceBack(ht+1,$t,ht+3),this.indexArray.emplaceBack($t,Ut,ht+3),ge.primitiveLength+=2,Ye===void 0&&(Ye=ht),!wf(bt,we[it],oe)){const Wt=it===we.length-1?Ye:ge.vertexLength;this.indexArray.emplaceBack(ht+2,ht+3,Wt),this.indexArray.emplaceBack(ht+3,Wt+1,Wt),this.indexArray.emplaceBack(ht+3,Ut,Wt+1),ge.primitiveLength+=3}ct=!ct}if(w){const $t=this.layoutVertexExtArray,Ut=v.projectTilePoint(De.x,De.y,a),Wt=v.projectTilePoint(ot.x,ot.y,a),yi=v.upVector(a,De.x,De.y),di=v.upVector(a,ot.x,ot.y);Ru($t,Ut,yi),Ru($t,Ut,yi),Ru($t,Wt,di),Ru($t,Wt,di)}}E&&(fe+=we.length-1),z&&X&&this.zoom>=17&&(ye.length!==0&&J(ye,ye[0])&&ye.pop(),this.groundEffect.addData(ye,oe,g,X>0))}this.footprintSegments.push(me),_e.triangleCount=this.indexArray.length-_e.triangleArrayOffset,this.polygonSegments.push(_e),++I.footprintSegLen,++I.polygonSegLen}if(I.vertexCount=this.layoutVertexArray.length-I.vertexArrayOffset,I.groundVertexCount=this.groundEffect.vertexArray.length-I.groundVertexArrayOffset,I.vertexCount!==0){if(I.centroidXY=M.borders?b_:this.encodeCentroid(M,I),this.centroidData.push(I),M.borders){this.featuresOnBorder.push(M);const ee=this.featuresOnBorder.length-1;for(let oe=0;oe<M.borders.length;oe++)M.borders[oe][0]!==Number.MAX_VALUE&&this.borderFeatureIndices[oe].push(ee)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,l,h,a,m),this.groundEffect.addPaintPropertiesData(e,n,l,h,a,m),this.maxHeight=Math.max(this.maxHeight,D)}}sortBorders(){for(let e=0;e<this.borderFeatureIndices.length;e++)this.borderFeatureIndices[e].sort((i,n)=>this.featuresOnBorder[i].borders[e][0]-this.featuresOnBorder[n].borders[e][0])}splitToSubtiles(){const e=[];for(let p=0;p<this.centroidData.length;p++){const m=this.centroidData[p],g=+(m.min.y+m.max.y>Ve),x=2*g+(+(m.min.x+m.max.x>Ve)^g);for(let v=0;v<m.polygonSegLen;v++){const w=m.polygonSegIdx+v;e.push({centroidIdx:p,subtile:x,polygonSegmentIdx:w,triangleSegmentIdx:this.polygonSegments[w].triangleSegIdx})}}const i=new Xi;e.sort((p,m)=>p.triangleSegmentIdx===m.triangleSegmentIdx?p.subtile-m.subtile:p.triangleSegmentIdx-m.triangleSegmentIdx);let n=0,a=0,l=0;for(const p of e){if(p.triangleSegmentIdx!==n)break;l++}const h=e.length;for(;a!==e.length;){n=e[a].triangleSegmentIdx;let p=0,m=a,g=a;for(let x=m;x<l&&e[x].subtile===p;x++)g++;for(;m!==l;){const x=e[m];p=x.subtile;const v=this.centroidData[x.centroidIdx].min.clone(),w=this.centroidData[x.centroidIdx].max.clone(),E={vertexOffset:this.segments.segments[n].vertexOffset,primitiveOffset:i.length,vertexLength:this.segments.segments[n].vertexLength,primitiveLength:0,sortKey:void 0,vaos:{}};for(let M=m;M<g;M++){const I=e[M],z=this.polygonSegments[I.polygonSegmentIdx],D=this.centroidData[I.centroidIdx].min,F=this.centroidData[I.centroidIdx].max,j=this.indexArray.uint16;for(let V=z.triangleArrayOffset;V<z.triangleArrayOffset+z.triangleCount;V++)i.emplaceBack(j[3*V],j[3*V+1],j[3*V+2]);E.primitiveLength+=z.triangleCount,v.x=Math.min(v.x,D.x),v.y=Math.min(v.y,D.y),w.x=Math.max(w.x,F.x),w.y=Math.max(w.y,F.y)}E.primitiveLength>0&&this.triangleSubSegments.push({segment:E,min:v,max:w}),m=g;for(let M=m;M<l&&e[M].subtile===e[m].subtile;M++)g++}a=l;for(let x=a;x<h&&e[x].triangleSegmentIdx===e[a].triangleSegmentIdx;x++)l++}i._trim(),this.indexArray=i}getVisibleSegments(e,i,n){let a=0,l=0;const h=1<<e.canonical.z;if(i){const I=i.getMinMaxForTile(e);I&&(a=I.min,l=I.max)}l+=this.maxHeight;const p=e.toUnwrapped();let m;const g=[p.canonical.x/h+p.wrap,p.canonical.y/h],x=[(p.canonical.x+1)/h+p.wrap,(p.canonical.y+1)/h],v=new Fi,w=(I,z,D)=>[I[0]*(1-D[0])+z[0]*D[0],I[1]*(1-D[1])+z[1]*D[1]],E=[],M=[];for(const I of this.triangleSubSegments){E[0]=I.min.x/Ve,E[1]=I.min.y/Ve,M[0]=I.max.x/Ve,M[1]=I.max.y/Ve;const z=w(g,x,E),D=w(g,x,M);if(new wi([z[0],z[1],a],[D[0],D[1],l]).intersectsPrecise(n)===0){m&&(v.segments.push(m),m=void 0);continue}const F=I.segment;m&&m.vertexOffset!==F.vertexOffset&&(v.segments.push(m),m=void 0),m?(m.vertexLength+=F.vertexLength,m.primitiveLength+=F.primitiveLength):m={vertexOffset:F.vertexOffset,primitiveLength:F.primitiveLength,vertexLength:F.vertexLength,primitiveOffset:F.primitiveOffset,sortKey:void 0,vaos:{}}}return m&&v.segments.push(m),v}encodeCentroid(e,i){const n=e.centroid(),a=i.span(),l=Math.min(7,Math.round(a.x*this.tileToMeter/10)),h=Math.min(7,Math.round(a.y*this.tileToMeter/10));return new Ne(kt(n.x,1,Ve-1)<<3|l,kt(n.y,1,Ve-1)<<3|h)}encodeBorderCentroid(e){if(!e.borders)return new Ne(0,0);const i=e.borders,n=Number.MAX_VALUE;if(i[0][0]!==n||i[1][0]!==n){const a=i[0][0]!==n?0:1;return new Ne(6|(i[0][0]!==n?0:65528),(i[a][0]+i[a][1])/2<<3|6)}{const a=i[2][0]!==n?2:3;return new Ne((i[a][0]+i[a][1])/2<<3|6,6|(i[2][0]!==n?0:65528))}}showCentroid(e){const i=this.centroidData[e.centroidDataIndex];i.flags&=Mo,i.centroidXY.x=0,i.centroidXY.y=0,this.writeCentroidToBuffer(i)}writeCentroidToBuffer(e){this.groundEffect.updateHiddenByLandmark(e);const i=e.vertexArrayOffset,n=e.vertexCount+e.vertexArrayOffset,a=e.flags&Mo?b_:e.centroidXY,l=this.centroidVertexArray.geta_centroid_pos0(i);if(this.centroidVertexArray.geta_centroid_pos1(i)!==a.y||l!==a.x){for(let h=i;h<n;++h)this.centroidVertexArray.emplace(h,a.x,a.y);this.needsCentroidUpdate=!0}}createCentroidsBuffer(){this.centroidVertexArray.resize(this.layoutVertexArray.length),this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length);for(const e of this.centroidData)this.writeCentroidToBuffer(e)}updateReplacement(e,i){if(i.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=i.updateTime;const n=i.getReplacementRegionsForTile(e.toUnwrapped());if(function(l,h){if(l.length!==h.length)return!1;for(let p=0;p<l.length;p++)if(l[p].sourceId!==h[p].sourceId||!c_(l[p],h[p]))return!1;return!0}(this.activeReplacements,n))return;if(this.activeReplacements=n,this.centroidVertexArray.length===0)this.createCentroidsBuffer();else for(const l of this.centroidData)l.flags&=2147483647;const a=[];for(const l of this.activeReplacements){const h=Math.pow(2,l.footprintTileId.canonical.z-e.canonical.z);for(const p of this.centroidData)if(!(p.flags&Mo||l.min.x>p.max.x||p.min.x>l.max.x||l.min.y>p.max.y||p.min.y>l.max.y))for(let m=0;m<p.footprintSegLen;m++){const g=this.footprintSegments[p.footprintSegIdx+m];if(a.length=0,ix(this.footprintVertices,g.vertexOffset,g.vertexCount,l.footprintTileId.canonical,e.canonical,a),d_(l.footprint,a,this.footprintIndices.uint16,g.indexOffset,g.indexCount,-g.vertexOffset,-h)){p.flags|=Mo;break}}}for(const l of this.centroidData)this.writeCentroidToBuffer(l);this.borderDoneWithNeighborZ=[-1,-1,-1,-1]}footprintContainsPoint(e,i,n){let a=!1;for(let l=0;l<n.footprintSegLen;l++){const h=this.footprintSegments[n.footprintSegIdx+l];let p=0;for(const m of h.ringIndices){for(let g=p,x=m+p-1;g<m+p;x=g++){const v=this.footprintVertices.int16[2*(g+h.vertexOffset)+0],w=this.footprintVertices.int16[2*(g+h.vertexOffset)+1],E=this.footprintVertices.int16[2*(x+h.vertexOffset)+1];w>i!=E>i&&e<(this.footprintVertices.int16[2*(x+h.vertexOffset)+0]-v)*(i-w)/(E-w)+v&&(a=!a)}p=m}}return a}getHeightAtTileCoord(e,i){let n=Number.NEGATIVE_INFINITY,a=!0;const l=4*(e+Ve)*Ve+(i+Ve);if(this.partLookup.hasOwnProperty(l)){const h=this.partLookup[l];return h?{height:h.height,hidden:!!(h.flags&Mo)}:void 0}for(const h of this.centroidData)e>h.max.x||h.min.x>e||i>h.max.y||h.min.y>i||this.footprintContainsPoint(e,i,h)&&h&&h.height>n&&(n=h.height,this.partLookup[l]=h,a=!!(h.flags&Mo));if(n!==Number.NEGATIVE_INFINITY)return{height:n,hidden:a};this.partLookup[l]=void 0}}function A_(t,e){const i=t.add(e)._unit();return t.x*i.x+t.y*i.y}function tx(t,e,i,n){const a=e.sub(t)._perp()._unit(),l=i.sub(e)._perp()._unit();return I_(t,e,i,A_(a,l),n)}function I_(t,e,i,n,a){const l=Math.sqrt(1-n*n);return Math.min(t.dist(e)/3,e.dist(i)/3,a*l/n)}function wf(t,e,i){return t.x<i[0].x&&e.x<i[0].x||t.x>i[1].x&&e.x>i[1].x||t.y<i[0].y&&e.y<i[0].y||t.y>i[1].y&&e.y>i[1].y}function C_(t,e){return t.x<e[0].x||t.x>e[1].x||t.y<e[0].y||t.y>e[1].y}function P_(t,e,i){if(t.x<0||t.x>=Ve||e.x<0||e.x>=Ve||i.x<0||i.x>=Ve)return!1;const n=i.sub(e),a=n.perp(),l=t.sub(e);return(n.x*l.x+n.y*l.y)/Math.sqrt((n.x*n.x+n.y*n.y)*(l.x*l.x+l.y*l.y))>-.866&&a.x*l.x+a.y*l.y<0}function z_(t,e,i){const n=e?2|t:-3&t;return i?1|n:-2&n}function D_(){const t=Math.PI/32,e=Math.tan(t),i=Yl;return i*Math.sqrt(1+2*e*e)-i}function R_(t,e,i){const n=1<<i.z,a=$r(i.x/n),l=$r((i.x+1)/n),h=cr(i.y/n),p=cr((i.y+1)/n);return function(m,g,x,v,w=0,E){const M=[];if(!m.length||!x||!v)return M;const I=(q,J)=>{for(const ee of q)M.push({polygon:ee,bounds:J})},z=Math.ceil(Math.log2(x)),D=Math.ceil(Math.log2(v)),F=z-D,j=[];for(let q=0;q<Math.abs(F);q++)j.push(F>0?0:1);for(let q=0;q<Math.min(z,D);q++)j.push(0),j.push(1);let V=m;if(V=Cd(V,g[0].y-w,g[1].y+w,1),V=Cd(V,g[0].x-w,g[1].x+w,0),!V.length)return M;const X=[];for(j.length?X.push({polygons:V,bounds:g,depth:0}):I(V,g);X.length;){const q=X.pop(),J=q.depth,ee=j[J],oe=q.bounds[0],fe=q.bounds[1],le=ee===0?oe.x:oe.y,ge=ee===0?fe.x:fe.y,_e=E?E(ee,le,ge):.5*(le+ge),me=Cd(q.polygons,le-w,_e+w,ee),Ee=Cd(q.polygons,_e-w,ge+w,ee);if(me.length){const we=[oe,new Ne(ee===0?_e:fe.x,ee===1?_e:fe.y)];j.length>J+1?X.push({polygons:me,bounds:we,depth:J+1}):I(me,we)}if(Ee.length){const we=[new Ne(ee===0?_e:oe.x,ee===1?_e:oe.y),fe];j.length>J+1?X.push({polygons:Ee,bounds:we,depth:J+1}):I(Ee,we)}}return M}(t,e,Math.ceil((l-a)/11.25),Math.ceil((h-p)/11.25),1,(m,g,x)=>{if(m===0)return .5*(g+x);{const v=cr((i.y+g/Ve)/n);return(Rs(.5*(cr((i.y+x/Ve)/n)+v))*n-i.y)*Ve}})}function ix(t,e,i,n,a,l){const h=Math.pow(2,n.z-a.z);for(let p=0;p<i;p++){let m=t.int16[2*(p+e)+0],g=t.int16[2*(p+e)+1];m=(m+a.x*Ve)*h-n.x*Ve,g=(g+a.y*Ve)*h-n.y*Ve,l.push(new Ne(m,g))}}Qe(Rd,"FillExtrusionBucket",{omit:["layers","features"]}),Qe(T_,"PartData"),Qe(w_,"FootprintSegment"),Qe(E_,"BorderCentroidData"),Qe(M_,"GroundEffect");const rx=new se({visibility:new te(W["layout_fill-extrusion"].visibility),"fill-extrusion-edge-radius":new te(W["layout_fill-extrusion"]["fill-extrusion-edge-radius"])});var nx={paint:new se({"fill-extrusion-opacity":new te(W["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new ae(W["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new te(W["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new te(W["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new ae(W["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new ae(W["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new ae(W["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new te(W["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"]),"fill-extrusion-ambient-occlusion-intensity":new te(W["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-intensity"]),"fill-extrusion-ambient-occlusion-radius":new te(W["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-radius"]),"fill-extrusion-ambient-occlusion-wall-radius":new te(W["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-wall-radius"]),"fill-extrusion-ambient-occlusion-ground-radius":new te(W["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-ground-radius"]),"fill-extrusion-ambient-occlusion-ground-attenuation":new te(W["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-ground-attenuation"]),"fill-extrusion-flood-light-color":new te(W["paint_fill-extrusion"]["fill-extrusion-flood-light-color"]),"fill-extrusion-flood-light-intensity":new te(W["paint_fill-extrusion"]["fill-extrusion-flood-light-intensity"]),"fill-extrusion-flood-light-wall-radius":new ae(W["paint_fill-extrusion"]["fill-extrusion-flood-light-wall-radius"]),"fill-extrusion-flood-light-ground-radius":new ae(W["paint_fill-extrusion"]["fill-extrusion-flood-light-ground-radius"]),"fill-extrusion-flood-light-ground-attenuation":new te(W["paint_fill-extrusion"]["fill-extrusion-flood-light-ground-attenuation"]),"fill-extrusion-vertical-scale":new te(W["paint_fill-extrusion"]["fill-extrusion-vertical-scale"]),"fill-extrusion-rounded-roof":new te(W["paint_fill-extrusion"]["fill-extrusion-rounded-roof"]),"fill-extrusion-cutoff-fade-range":new te(W["paint_fill-extrusion"]["fill-extrusion-cutoff-fade-range"]),"fill-extrusion-emissive-strength":new te(W["paint_fill-extrusion"]["fill-extrusion-emissive-strength"])}),layout:rx};class rc extends Ne{constructor(e,i,n){super(e,i),this.z=n}}function Lu(t,e){return t.x*e.x+t.y*e.y}function L_(t,e){if(t.length===1){let i=0;const n=e[i++];let a;for(;!a||n.equals(a);)if(a=e[i++],!a)return 1/0;for(;i<e.length;i++){const l=e[i],h=t[0],p=a.sub(n),m=l.sub(n),g=h.sub(n),x=Lu(p,p),v=Lu(p,m),w=Lu(m,m),E=Lu(g,p),M=Lu(g,m),I=x*w-v*v,z=(w*E-v*M)/I,D=(x*M-v*E)/I,F=n.z*(1-z-D)+a.z*z+l.z*D;if(isFinite(F))return F}return 1/0}{let i=1/0;for(const n of e)i=Math.min(i,n.z);return i}}function k_(t,e,i,n,a,l,h,p){const m=h*a.getElevationAt(t,e,!0,!0),g=l[0]!==0,x=g?l[1]===0?h*(l[0]/7-450):h*function(v,w,E){const M=Math.floor(w[0]/8),I=Math.floor(w[1]/8),z=10*(w[0]-8*M),D=10*(w[1]-8*I),F=v.getElevationAt(M,I,!0,!0),j=v.getMeterToDEM(E),V=Math.floor(.5*(z*j-1)),X=Math.floor(.5*(D*j-1)),q=v.tileCoordToPixel(M,I),J=2*V+1,ee=2*X+1,oe=function(Ee,we,Ce,Ae,ye){return[Ee.getElevationAtPixel(we,Ce,!0),Ee.getElevationAtPixel(we+ye,Ce,!0),Ee.getElevationAtPixel(we,Ce+ye,!0),Ee.getElevationAtPixel(we+Ae,Ce+ye,!0)]}(v,q.x-V,q.y-X,J,ee),fe=Math.abs(oe[0]-oe[1]),le=Math.abs(oe[2]-oe[3]),ge=Math.abs(oe[0]-oe[2])+Math.abs(oe[1]-oe[3]),_e=Math.min(.25,.5*j*(fe+le)/J),me=Math.min(.25,.5*j*ge/ee);return F+Math.max(_e*z,me*D)}(a,l,p):m;return{base:m+(i===0)?-1:i,top:g?Math.max(x+n,m+i+2):m+n}}const sx=vt([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"},{name:"a_linesofar",components:1,type:"Float32"}],4),{members:ox}=sx,ax=vt([{name:"a_packed",components:4,type:"Float32"}]),{members:lx}=ax,cx=vt([{name:"a_pattern_data",components:2,type:"Float32"}]),{members:ux}=cx;class O_{constructor(e,i){this.width=e,this.height=i,this.nextRow=0,this.image=new Eo({width:e,height:i}),this.positions={},this.uploaded=!1}getDash(e,i){const n=this.getKey(e,i);return this.positions[n]}trim(){const e=this.width,i=this.height=Ic(this.nextRow);this.image.resize({width:e,height:i})}getKey(e,i){return e.join(",")+i}getDashRanges(e,i,n){const a=[];let l=e.length%2==1?-e[e.length-1]*n:0,h=e[0]*n,p=!0;a.push({left:l,right:h,isDash:p,zeroLength:e[0]===0});let m=e[0];for(let g=1;g<e.length;g++){p=!p;const x=e[g];l=m*n,m+=x,h=m*n,a.push({left:l,right:h,isDash:p,zeroLength:x===0})}return a}addRoundDash(e,i,n){const a=i/2;for(let l=-n;l<=n;l++){const h=this.width*(this.nextRow+n+l);let p=0,m=e[p];for(let g=0;g<this.width;g++){g/m.right>1&&(m=e[++p]);const x=Math.abs(g-m.left),v=Math.abs(g-m.right),w=Math.min(x,v);let E;const M=l/n*(a+1);if(m.isDash){const I=a-Math.abs(M);E=Math.sqrt(w*w+I*I)}else E=a-Math.sqrt(w*w+M*M);this.image.data[h+g]=Math.max(0,Math.min(255,E+128))}}}addRegularDash(e,i){for(let m=e.length-1;m>=0;--m){const g=e[m],x=e[m+1];g.zeroLength?e.splice(m,1):x&&x.isDash===g.isDash&&(x.left=g.left,e.splice(m,1))}const n=e[0],a=e[e.length-1];n.isDash===a.isDash&&(n.left=a.left-this.width,a.right=n.right+this.width);const l=this.width*this.nextRow;let h=0,p=e[h];for(let m=0;m<this.width;m++){m/p.right>1&&(p=e[++h]);const g=Math.abs(m-p.left),x=Math.abs(m-p.right),v=Math.min(g,x);this.image.data[l+m]=Math.max(0,Math.min(255,(p.isDash?v:-v)+i+128))}}addDash(e,i){const n=this.getKey(e,i);if(this.positions[n])return this.positions[n];const a=i==="round",l=a?7:0,h=2*l+1;if(this.nextRow+h>this.height)return Ci("LineAtlas out of space"),null;e.length===0&&e.push(1);let p=0;for(let x=0;x<e.length;x++)e[x]<0&&(Ci("Negative value is found in line dasharray, replacing values with 0"),e[x]=0),p+=e[x];if(p!==0){const x=this.width/p,v=this.getDashRanges(e,this.width,x);a?this.addRoundDash(v,x,l):this.addRegularDash(v,i==="square"?.5*x:0)}const m=this.nextRow+l;this.nextRow+=h;const g={tl:[m,l],br:[p,0]};return this.positions[n]=g,g}}Qe(O_,"LineAtlas");const hx=Id.types,dx=Math.cos(Math.PI/180*37.5),px=Math.cos(Math.PI/180*5);class Tf{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(i=>i.fqid),this.index=e.index,this.projection=e.projection,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(i=>{this.gradients[i.id]={}}),this.layoutVertexArray=new pr,this.layoutVertexArray2=new Hi,this.patternVertexArray=new er,this.indexArray=new Xi,this.programConfigurations=new xo(e.layers,e.zoom),this.segments=new Fi,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id)}populate(e,i,n,a){this.hasPattern=yf("line",this.layers,i);const l=this.layers[0].layout.get("line-sort-key"),h=[];for(const{feature:x,id:v,index:w,sourceLayerIndex:E}of e){const M=this.layers[0]._featureFilter.needGeometry,I=wo(x,M);if(!this.layers[0]._featureFilter.filter(new B(this.zoom),I,n))continue;const z=l?l.evaluate(I,{},n):void 0,D={id:v,properties:x.properties,type:x.type,sourceLayerIndex:E,index:w,geometry:M?I.geometry:Ls(x,n,a),patterns:{},sortKey:z};h.push(D)}l&&h.sort((x,v)=>x.sortKey-v.sortKey);const{lineAtlas:p,featureIndex:m}=i,g=this.addConstantDashes(p);for(const x of h){const{geometry:v,index:w,sourceLayerIndex:E}=x;if(g&&this.addFeatureDashes(x,p),this.hasPattern){const M=xf("line",this.layers,x,this.zoom,i);this.patternFeatures.push(M)}else this.addFeature(x,v,w,n,p.positions,i.availableImages,i.brightness);m.insert(e[w].feature,v,w,E,this.index)}}addConstantDashes(e){let i=!1;for(const n of this.layers){const a=n.paint.get("line-dasharray").value,l=n.layout.get("line-cap").value;if(a.kind!=="constant"||l.kind!=="constant")i=!0;else{const h=l.value,p=a.value;if(!p)continue;e.addDash(p,h)}}return i}addFeatureDashes(e,i){const n=this.zoom;for(const a of this.layers){const l=a.paint.get("line-dasharray").value,h=a.layout.get("line-cap").value;if(l.kind==="constant"&&h.kind==="constant")continue;let p,m;if(l.kind==="constant"){if(p=l.value,!p)continue}else p=l.evaluate({zoom:n},e);m=h.kind==="constant"?h.value:h.evaluate({zoom:n},e),i.addDash(p,m),e.patterns[a.id]=i.getKey(p,m)}}update(e,i,n,a,l){const h=Object.keys(e).length!==0;h&&!this.stateDependentLayers.length||this.programConfigurations.updatePaintArrays(e,i,h?this.stateDependentLayers:this.layers,n,a,l)}addFeatures(e,i,n,a,l,h){for(const p of this.patternFeatures)this.addFeature(p,p.geometry,p.index,i,n,a,h)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,lx)),this.patternVertexArray.length!==0&&(this.patternVertexBuffer=e.createVertexBuffer(this.patternVertexArray,ux)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,ox),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e){if(e.properties&&e.properties.hasOwnProperty("mapbox_clip_start")&&e.properties.hasOwnProperty("mapbox_clip_end"))return{start:+e.properties.mapbox_clip_start,end:+e.properties.mapbox_clip_end}}addFeature(e,i,n,a,l,h,p){const m=this.layers[0].layout,g=m.get("line-join").evaluate(e,{}),x=m.get("line-cap").evaluate(e,{}),v=m.get("line-miter-limit"),w=m.get("line-round-limit");this.lineClips=this.lineFeatureClips(e);for(const E of i)this.addLine(E,e,g,x,v,w);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,l,h,a,p)}addLine(e,i,n,a,l,h){this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineS
7oFar=0;const p=n==="none";if(this.patternJoinNone=this.hasPattern&&p,this.segmentStart=0,this.segmentPoints=[],this.lineClips){this.lineClipsArray.push(this.lineClips);for(let F=0;F<e.length-1;F++)this.totalDistance+=e[F].dist(e[F+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const m=hx[i.type]==="Polygon";let g=e.length;for(;g>=2&&e[g-1].equals(e[g-2]);)g--;let x=0;for(;x<g-1&&e[x].equals(e[x+1]);)x++;if(g<(m?3:2))return;n==="bevel"&&(l=1.05);const v=this.overscaling<=16?15*Ve/(512*this.overscaling):0,w=this.segments.prepareSegment(10*g,this.layoutVertexArray,this.indexArray);let E,M,I,z,D;this.e1=this.e2=-1,m&&(E=e[g-2],D=e[x].sub(E)._unit()._perp());for(let F=x;F<g;F++){if(I=F===g-1?m?e[x+1]:void 0:e[F+1],I&&e[F].equals(I))continue;D&&(z=D),E&&(M=E),E=e[F],D=I?I.sub(E)._unit()._perp():z,z=z||D;const j=M&&I;let V=j?n:m||p?"butt":a;const X=z.x*D.x+z.y*D.y;if(p){const ge=function(_e){if(_e.patternJoinNone){const me=_e.segmentPoints.length/2,Ee=_e.lineSoFar-_e.segmentStart;for(let we=0;we<me;++we){const Ce=_e.segmentPoints[2*we+1],Ae=Math.round(_e.segmentPoints[2*we])+.5+.25*Ce;_e.patternVertexArray.emplaceBack(Ae,Ee),_e.patternVertexArray.emplaceBack(Ae,Ee)}_e.segmentPoints=[],_e.segmentStart=_e.lineSoFar}_e.e1=_e.e2=-1};if(j&&X<px){this.updateDistance(M,E),this.addCurrentVertex(E,z,1,1,w),ge(this),this.addCurrentVertex(E,D,-1,-1,w);continue}if(M){if(!I){this.updateDistance(M,E),this.addCurrentVertex(E,z,1,1,w),ge(this);continue}V="miter"}}let q=z.add(D);q.x===0&&q.y===0||q._unit();const J=q.x*D.x+q.y*D.y,ee=J!==0?1/J:1/0,oe=2*Math.sqrt(2-2*J),fe=J<dx&&M&&I,le=z.x*D.y-z.y*D.x>0;if(fe&&F>x){const ge=E.dist(M);if(ge>2*v){const _e=E.sub(E.sub(M)._mult(v/ge)._round());this.updateDistance(M,_e),this.addCurrentVertex(_e,z,0,0,w),M=_e}}if(j&&V==="round"&&(ee<h?V="miter":ee<=2&&(V="fakeround")),V==="miter"&&ee>l&&(V="bevel"),V==="bevel"&&(ee>2&&(V="flipbevel"),ee<l&&(V="miter")),M&&this.updateDistance(M,E),V==="miter")q._mult(ee),this.addCurrentVertex(E,q,0,0,w);else if(V==="flipbevel"){if(ee>100)q=D.mult(-1);else{const ge=ee*z.add(D).mag()/z.sub(D).mag();q._perp()._mult(ge*(le?-1:1))}this.addCurrentVertex(E,q,0,0,w),this.addCurrentVertex(E,q.mult(-1),0,0,w)}else if(V==="bevel"||V==="fakeround"){const ge=-Math.sqrt(ee*ee-1),_e=le?ge:0,me=le?0:ge;if(M&&this.addCurrentVertex(E,z,_e,me,w),V==="fakeround"){const Ee=Math.round(180*oe/Math.PI/20);for(let we=1;we<Ee;we++){let Ce=we/Ee;if(Ce!==.5){const ye=Ce-.5;Ce+=Ce*ye*(Ce-1)*((1.0904+X*(X*(3.55645-1.43519*X)-3.2452))*ye*ye+(.848013+X*(.215638*X-1.06021)))}const Ae=D.sub(z)._mult(Ce)._add(z)._unit()._mult(le?-1:1);this.addHalfVertex(E,Ae.x,Ae.y,!1,le,0,w)}}I&&this.addCurrentVertex(E,D,-_e,-me,w)}else V==="butt"?this.addCurrentVertex(E,q,0,0,w):V==="square"?(M||this.addCurrentVertex(E,q,-1,-1,w),this.addCurrentVertex(E,q,0,0,w),M&&this.addCurrentVertex(E,q,1,1,w)):V==="round"&&(M&&(this.addCurrentVertex(E,z,0,0,w),this.addCurrentVertex(E,z,1,1,w,!0)),I&&(this.addCurrentVertex(E,D,-1,-1,w,!0),this.addCurrentVertex(E,D,0,0,w)));if(fe&&F<g-1){const ge=E.dist(I);if(ge>2*v){const _e=E.add(I.sub(E)._mult(v/ge)._round());this.updateDistance(E,_e),this.addCurrentVertex(_e,D,0,0,w),E=_e}}}}addCurrentVertex(e,i,n,a,l,h=!1){const p=i.y*a-i.x,m=-i.y-i.x*a;this.addHalfVertex(e,i.x+i.y*n,i.y-i.x*n,h,!1,n,l),this.addHalfVertex(e,p,m,h,!0,-a,l),this.patternJoinNone&&this.segmentPoints.push(this.lineSoFar-this.segmentStart,n)}addHalfVertex({x:e,y:i},n,a,l,h,p,m){this.layoutVertexArray.emplaceBack((e<<1)+(l?1:0),(i<<1)+(h?1:0),Math.round(63*n)+128,Math.round(63*a)+128,1+(p===0?0:p<0?-1:1),0,this.lineSoFar),this.lineClips&&this.layoutVertexArray2.emplaceBack(this.scaledDistance,this.lineClipsArray.length,this.lineClips.start,this.lineClips.end);const g=m.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,g),m.primitiveLength++),h?this.e2=g:this.e1=g}updateScaledDistance(){if(this.lineClips){const e=this.totalDistance/(this.lineClips.end-this.lineClips.start);
7this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=e*this.lineClips.start+this.distance}else this.lineSoFar=this.distance}updateDistance(e,i){this.distance+=e.dist(i),this.updateScaledDistance()}}Qe(Tf,"LineBucket",{omit:["layers","patternFeatures"]});const fx=new se({"line-cap":new ae(W.layout_line["line-cap"]),"line-join":new ae(W.layout_line["line-join"]),"line-miter-limit":new te(W.layout_line["line-miter-limit"]),"line-round-limit":new te(W.layout_line["line-round-limit"]),"line-sort-key":new ae(W.layout_line["line-sort-key"]),visibility:new te(W.layout_line.visibility)});var B_={paint:new se({"line-opacity":new ae(W.paint_line["line-opacity"]),"line-color":new ae(W.paint_line["line-color"]),"line-translate":new te(W.paint_line["line-translate"]),"line-translate-anchor":new te(W.paint_line["line-translate-anchor"]),"line-width":new ae(W.paint_line["line-width"]),"line-gap-width":new ae(W.paint_line["line-gap-width"]),"line-offset":new ae(W.paint_line["line-offset"]),"line-blur":new ae(W.paint_line["line-blur"]),"line-dasharray":new ae(W.paint_line["line-dasharray"]),"line-pattern":new ae(W.paint_line["line-pattern"]),"line-gradient":new Me(W.paint_line["line-gradient"]),"line-trim-offset":new te(W.paint_line["line-trim-offset"]),"line-emissive-strength":new te(W.paint_line["line-emissive-strength"]),"line-border-width":new ae(W.paint_line["line-border-width"]),"line-border-color":new ae(W.paint_line["line-border-color"])}),layout:fx};function F_(t,e,i){return e*(Ve/(t.tileSize*Math.pow(2,i-t.tileID.overscaledZ)))}function N_(t,e){return 1/F_(t,1,e.tileZoom)}function V_(t,e,i,n){return t.translatePosMatrix(n||e.tileID.projMatrix,e,i.paint.get("line-translate"),i.paint.get("line-translate-anchor"))}const U_=t=>{const e=[];j_(t)&&e.push("RENDER_LINE_DASH"),t.paint.get("line-gradient")&&e.push("RENDER_LINE_GRADIENT");const i=t.paint.get("line-trim-offset");i[0]===0&&i[1]===0||e.push("RENDER_LINE_TRIM_OFFSET"),t.paint.get("line-border-width").constantOr(1)!==0&&e.push("RENDER_LINE_BORDER");const n=t.layout.get("line-join").constantOr("miter")==="none",a=!!t.paint.get("line-pattern").constantOr(1);return n&&a&&e.push("LINE_JOIN_NONE"),e};function j_(t){const e=t.paint.get("line-dasharray").value;return e.value||e.kind!=="constant"}const G_=new class extends ae{possiblyEvaluate(t,e){return e=new B(Math.floor(e.zoom),{now:e.now,fadeDuration:e.fadeDuration,transition:e.transition}),super.possiblyEvaluate(t,e)}evaluate(t,e,i,n){return e=Gr({},e,{zoom:Math.floor(e.zoom)}),super.evaluate(t,e,i,n)}}(B_.paint.properties["line-width"].specification);function q_(t,e){return e>0?e+2*t:t}G_.useIntegerZoom=!0;const mx=vt([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_tex_size",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),_x=vt([{name:"a_globe_anchor",components:3,type:"Int16"},{name:"a_globe_normal",components:3,type:"Float32"}],4),gx=vt([{name:"a_projected_pos",components:4,type:"Float32"}],4);vt([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const yx=vt([{name:"a_z_offset",components:1,type:"Float32"}],4),xx=vt([{name:"a_texb",components:2,type:"Uint16"}]),vx=vt([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]),bx=vt([{name:"a_size_scale",components:1,type:"Float32"},{name:"a_padding",components:2,type:"Float32"},{name:"a_z_offset",components:1,type:"Float32"}]);vt([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Int16",name:"tileAnchorX"},{type:"Int16",name:"tileAnchorY"},{type:"Float32",name:"x1"},{type:"Float32",name:"y1"},{type:"Float32",name:"x2"},{type:"Float32",name:"y2"},{type:"Int16",name:"padding"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);const Z_=vt([{name:"a_pos",components:3,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),wx=vt([{name:"a_pos_2f",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);vt([{name:"triangle",components:3,type:"Uint16"}]),vt([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Float32",name:"tileAnchorX"},{type:"Float32",name:"tileAnchorY"},{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"},{type:"Uint8",name:"flipState"}]),vt([{type:"Float32",name:"tileAnchorX"},{type:"Float32",name:"tileAnchorY"},{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{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",components:2,name:"textOffset"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Float32",name:"zOffset"},{type:"Uint8",name:"hasIconTextFit"}]),vt([{type:"Float32",name:"offsetX"}]),vt([{type:"Int16",name:"x"},{type:"Int16",name:"y"}]);var ur=24;const Fn=128;function Ef(t,e){const{expression:i}=e;if(i.kind==="constant")return{kind:"constant",layoutSize:i.evaluate(new B(t+1))};if(i.kind==="source")return{kind:"source"};{const{zoomStops:n,interpolationType:a}=i;let l=0;for(;l<n.length&&n[l]<=t;)l++;l=Math.max(0,l-1);let h=l;for(;h<n.length&&n[h]<t+1;)h++;h=Math.min(n.length-1,h);const p=n[l],m=n[h];return i.kind==="composite"?{kind:"composite",minZoom:p,maxZoom:m,interpolationType:a}:{kind:"camera",minZoom:p,maxZoom:m,minSize:i.evaluate(new B(p)),maxSize:i.evaluate(new B(m)),interpolationType:a}}}function Ld(t,{uSize:e,uSizeT:i},{lowerSize:n,upperSize:a}){return t.kind==="source"?n/Fn:t.kind==="composite"?Ct(n/Fn,a/Fn,i):e}function nc(t,e){let i=0,n=0;if(t.kind==="constant")n=t.layoutSize;else if(t.kind!=="source"){const{interpolationType:a,minZoom:l,maxZoom:h}=t,p=a?kt(Nr.interpolationFactor(a,e,l,h),0,1):0;t.kind==="camera"?n=Ct(t.minSize,t.maxSize,p):i=p}return{uSizeT:i,uSize:n}}var Tx=Object.freeze({__proto__:null,SIZE_PACK_FACTOR:Fn,evaluateSizeForFeature:Ld,evaluateSizeForZoom:nc,getSizeData:Ef});function Ex(t,e,i){return t.sections.forEach(n=>
vendor: 5,689 bytes, line 7
7{n.text=function(a,l,h){const p=l.layout.get("text-transform").evaluate(h,{});return p==="uppercase"?a=a.toLocaleUpperCase():p==="lowercase"&&(a=a.toLocaleLowerCase()),Q.applyArabicShaping&&(a=Q.applyArabicShaping(a)),a}(n.text,e,i)}),t}const ku={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂","←":"↑","→":"↓"};function Sx(t){return t==="︶"||t==="﹈"||t==="︸"||t==="﹄"||t==="﹂"||t==="︾"||t==="︼"||t==="︺"||t==="︘"||t==="﹀"||t==="︐"||t==="︓"||t==="︔"||t==="`"||t===" ̄"||t==="︑"||t==="︒"}function Mx(t){return t==="︵"||t==="﹇"||t==="︷"||t==="﹃"||t==="﹁"||t==="︽"||t==="︻"||t==="︹"||t==="︗"||t==="︿"}var Ax={read:function(t,e,i,n,a){var l,h,p=8*a-n-1,m=(1<<p)-1,g=m>>1,x=-7,v=i?a-1:0,w=i?-1:1,E=t[e+v];for(v+=w,l=E&(1<<-x)-1,E>>=-x,x+=p;x>0;l=256*l+t[e+v],v+=w,x-=8);for(h=l&(1<<-x)-1,l>>=-x,x+=n;x>0;h=256*h+t[e+v],v+=w,x-=8);if(l===0)l=1-g;else{if(l===m)return h?NaN:1/0*(E?-1:1);h+=Math.pow(2,n),l-=g}return(E?-1:1)*h*Math.pow(2,l-n)},write:function(t,e,i,n,a,l){var h,p,m,g=8*l-a-1,x=(1<<g)-1,v=x>>1,w=a===23?Math.pow(2,-24)-Math.pow(2,-77):0,E=n?0:l-1,M=n?1:-1,I=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(p=isNaN(e)?1:0,h=x):(h=Math.floor(Math.log(e)/Math.LN2),e*(m=Math.pow(2,-h))<1&&(h--,m*=2),(e+=h+v>=1?w/m:w*Math.pow(2,1-v))*m>=2&&(h++,m/=2),h+v>=x?(p=0,h=x):h+v>=1?(p=(e*m-1)*Math.pow(2,a),h+=v):(p=e*Math.pow(2,v-1)*Math.pow(2,a),h=0));a>=8;t[i+E]=255&p,E+=M,p/=256,a-=8);for(h=h<<a|p,g+=a;g>0;t[i+E]=255&h,E+=M,h/=256,g-=8);t[i+E-M]|=128*I}},$_=Ti,kd=Ax;function Ti(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}Ti.Varint=0,Ti.Fixed64=1,Ti.Bytes=2,Ti.Fixed32=5;var Sf=4294967296,W_=1/Sf,Q_=typeof TextDecoder>"u"?null:new TextDecoder("utf8");function Os(t){return t.type===Ti.Bytes?t.readVarint()+t.pos:t.pos+1}function sc(t,e,i){return i?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function H_(t,e,i){var n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));i.realloc(n);for(var a=i.pos-1;a>=t;a--)i.buf[a+n]=i.buf[a]}function Ix(t,e){for(var i=0;i<t.length;i++)e.writeVarint(t[i])}function Cx(t,e){for(var i=0;i<t.length;i++)e.writeSVarint(t[i])}function Px(t,e){for(var i=0;i<t.length;i++)e.writeFloat(t[i])}function zx(t,e){for(var i=0;i<t.length;i++)e.writeDouble(t[i])}function Dx(t,e){for(var i=0;i<t.length;i++)e.writeBoolean(t[i])}function Rx(t,e){for(var i=0;i<t.length;i++)e.writeFixed32(t[i])}function Lx(t,e){for(var i=0;i<t.length;i++)e.writeSFixed32(t[i])}function kx(t,e){for(var i=0;i<t.length;i++)e.writeFixed64(t[i])}function Ox(t,e){for(var i=0;i<t.length;i++)e.writeSFixed64(t[i])}function Od(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+16777216*t[e+3]}function oc(t,e,i){t[i]=e,t[i+1]=e>>>8,t[i+2]=e>>>16,t[i+3]=e>>>24}function X_(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}Ti.prototype={destroy:function(){this.buf=null},readFields:function(t,e,i){for(i=i||this.length;this.pos<i;){var n=this.readVarint(),a=n>>3,l=this.pos;this.type=7&n,t(a,e,this),this.pos===l&&this.skip(n)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=Od(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=X_(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=Od(this.buf,this.pos)+Od(this.buf,this.pos+4)*Sf;return this.pos+=8,t},readSFixed64:function(){var t=Od(this.buf,this.pos)+X_(this.buf,this.pos+4)*Sf;return this.pos+=8,t},readFloat:function(){var t=kd.read(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=kd.read(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e,i,n=this.buf;return e=127&(i=n[this.pos++]),i<128?e:(e|=(127&(i=n[this.pos++]))<<7,i<128?e:(e|=(127&(i=n[this.pos++]))<<14,i<128?e:(e|=(127&(i=n[this.pos++]))<<21,i<128?e:function(a,l,h){var p,m,g=h.buf;if(p=(112&(m=g[h.pos++]))>>4,m<128||(p|=(127&(m=g[h.pos++]))<<3,m<128)||(p|=(127&(m=g[h.pos++]))<<10,m<128)||(p|=(127&(m=g[h.pos++]))<<17,m<128)||(p|=(127&(m=g[h.pos++]))<<24,m<128)||(p|=(1&(m=g[h.pos++]))<<31,m<128))return sc(a,p,l);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(i=n[this.pos]))<<28,t,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2==1?(t+1)/-2:t/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&Q_?function(i,n,a){return Q_.decode(i.subarray(n,a))}(this.buf,e,t):function(i,n,a){for(var l="",h=n;h<a;){var p,m,g,x=i[h],v=null,w=x>239?4:x>223?3:x>191?2:1;if(h+w>a)break;w===1?x<128&&(v=x):w===2?(192&(p=i[h+1]))==128&&(v=(31&x)<<6|63&p)<=127&&(v=null):w===3?
vendor: 14,964 bytes, line 7
7(m=i[h+2],(192&(p=i[h+1]))==128&&(192&m)==128&&((v=(15&x)<<12|(63&p)<<6|63&m)<=2047||v>=55296&&v<=57343)&&(v=null)):w===4&&(m=i[h+2],g=i[h+3],(192&(p=i[h+1]))==128&&(192&m)==128&&(192&g)==128&&((v=(15&x)<<18|(63&p)<<12|(63&m)<<6|63&g)<=65535||v>=1114112)&&(v=null)),v===null?(v=65533,w=1):v>65535&&(v-=65536,l+=String.fromCharCode(v>>>10&1023|55296),v=56320|1023&v),l+=String.fromCharCode(v),h+=w}return l}(this.buf,e,t)},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,e){if(this.type!==Ti.Bytes)return t.push(this.readVarint(e));var i=Os(this);for(t=t||[];this.pos<i;)t.push(this.readVarint(e));return t},readPackedSVarint:function(t){if(this.type!==Ti.Bytes)return t.push(this.readSVarint());var e=Os(this);for(t=t||[];this.pos<e;)t.push(this.readSVarint());return t},readPackedBoolean:function(t){if(this.type!==Ti.Bytes)return t.push(this.readBoolean());var e=Os(this);for(t=t||[];this.pos<e;)t.push(this.readBoolean());return t},readPackedFloat:function(t){if(this.type!==Ti.Bytes)return t.push(this.readFloat());var e=Os(this);for(t=t||[];this.pos<e;)t.push(this.readFloat());return t},readPackedDouble:function(t){if(this.type!==Ti.Bytes)return t.push(this.readDouble());var e=Os(this);for(t=t||[];this.pos<e;)t.push(this.readDouble());return t},readPackedFixed32:function(t){if(this.type!==Ti.Bytes)return t.push(this.readFixed32());var e=Os(this);for(t=t||[];this.pos<e;)t.push(this.readFixed32());return t},readPackedSFixed32:function(t){if(this.type!==Ti.Bytes)return t.push(this.readSFixed32());var e=Os(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed32());return t},readPackedFixed64:function(t){if(this.type!==Ti.Bytes)return t.push(this.readFixed64());var e=Os(this);for(t=t||[];this.pos<e;)t.push(this.readFixed64());return t},readPackedSFixed64:function(t){if(this.type!==Ti.Bytes)return t.push(this.readSFixed64());var e=Os(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed64());return t},skip:function(t){var e=7&t;if(e===Ti.Varint)for(;this.buf[this.pos++]>127;);else if(e===Ti.Bytes)this.pos=this.readVarint()+this.pos;else if(e===Ti.Fixed32)this.pos+=4;else{if(e!==Ti.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e<this.pos+t;)e*=2;if(e!==this.length){var i=new Uint8Array(e);i.set(this.buf),this.buf=i,this.length=e}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(t){this.realloc(4),oc(this.buf,t,this.pos),this.pos+=4},writeSFixed32:function(t){this.realloc(4),oc(this.buf,t,this.pos),this.pos+=4},writeFixed64:function(t){this.realloc(8),oc(this.buf,-1&t,this.pos),oc(this.buf,Math.floor(t*W_),this.pos+4),this.pos+=8},writeSFixed64:function(t){this.realloc(8),oc(this.buf,-1&t,this.pos),oc(this.buf,Math.floor(t*W_),this.pos+4),this.pos+=8},writeVarint:function(t){(t=+t||0)>268435455||t<0?function(e,i){var n,a;if(e>=0?(n=e%4294967296|0,a=e/4294967296|0):(a=~(-e/4294967296),4294967295^(n=~(-e%4294967296))?n=n+1|0:(n=0,a=a+1|0)),e>=18446744073709552e3||e<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");i.realloc(10),function(l,h,p){p.buf[p.pos++]=127&l|128,l>>>=7,p.buf[p.pos++]=127&l|128,l>>>=7,p.buf[p.pos++]=127&l|128,l>>>=7,p.buf[p.pos++]=127&l|128,p.buf[p.pos]=127&(l>>>=7)}(n,0,i),function(l,h){var p=(7&l)<<4;h.buf[h.pos++]|=p|((l>>>=3)?128:0),l&&(h.buf[h.pos++]=127&l|((l>>>=7)?128:0),l&&(h.buf[h.pos++]=127&l|((l>>>=7)?128:0),l&&(h.buf[h.pos++]=127&l|((l>>>=7)?128:0),l&&(h.buf[h.pos++]=127&l|((l>>>=7)?128:0),l&&(h.buf[h.pos++]=127&l)))))}(a,i)}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))},writeSVarint:function(t){this.writeVarint(t<0?2*-t-1:2*t)},writeBoolean:function(t){this.writeVarint(!!t)},writeString:function(t){t=String(t),this.realloc(4*t.length),this.pos++;var e=this.pos;this.pos=function(n,a,l){for(var h,p,m=0;m<a.length;m++){if((h=a.charCodeAt(m))>55295&&h<57344){if(!p){h>56319||m+1===a.length?(n[l++]=239,n[l++]=191,n[l++]=189):p=h;continue}if(h<56320){n[l++]=239,n[l++]=191,n[l++]=189,p=h;continue}h=p-55296<<10|h-56320|65536,p=null}else p&&(n[l++]=239,n[l++]=191,n[l++]=189,p=null);h<128?n[l++]=h:(h<2048?n[l++]=h>>6|192:(h<65536?n[l++]=h>>12|224:(n[l++]=h>>18|240,n[l++]=h>>12&63|128),n[l++]=h>>6&63|128),n[l++]=63&h|128)}return l}(this.buf,t,this.pos);var i=this.pos-e;i>=128&&H_(e,i,this),this.pos=e-1,this.writeVarint(i),this.pos+=i},writeFloat:function(t){this.realloc(4),kd.write(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),kd.write(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var i=0;i<e;i++)this.buf[this.pos++]=t[i]},writeRawMessage:function(t,e){this.pos++;var i=this.pos;t(e,this);var n=this.pos-i;n>=128&&H_(i,n,this),this.pos=i-1,this.writeVarint(n),this.pos+=n},writeMessage:function(t,e,i){this.writeTag(t,Ti.Bytes),this.writeRawMessage(e,i)},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,Ix,e)},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,Cx,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,Dx,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,Px,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,zx,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,Rx,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,Lx,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,kx,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,Ox,e)},writeBytesField:function(t,e){this.writeTag(t,Ti.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,Ti.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,Ti.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,Ti.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,Ti.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,Ti.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,Ti.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,Ti.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,Ti.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,Ti.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,!!e)}};var ac=zr($_);const Mf=3;function Bx(t,e,i){e.glyphs=[],t===1&&i.readMessage(Fx,e)}function Fx(t,e,i){if(t===3){const{id:n,bitmap:a,width:l,height:h,left:p,top:m,advance:g}=i.readMessage(Nx,{});e.glyphs.push({id:n,bitmap:new Eo({width:l+2*Mf,height:h+2*Mf},a),metrics:{width:l,height:h,left:p,top:m,advance:g}})}else t===4?e.ascender=i.readSVarint():t===5&&(e.descender=i.readSVarint())}function Nx(t,e,i){t===1?e.id=i.readVarint():t===2?e.bitmap=i.readBytes():t===3?e.width=i.readVarint():t===4?e.height=i.readVarint():t===5?e.left=i.readSVarint():t===6?e.top=i.readSVarint():t===7&&(e.advance=i.readVarint())}const Y_=Mf,hn={horizontal:1,vertical:2,horizontalOnly:3};class Ou{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(e,i){const n=new Ou;return n.scale=e||1,n.fontStack=i,n}static forImage(e){const i=new Ou;return i.imageName=e,i}}class lc{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(e,i){const n=new lc;for(let a=0;a<e.sections.length;a++){const l=e.sections[a];l.image?n.addImageSection(l):n.addTextSection(l,i)}return n}length(){return this.text.length}getSection(e){return this.sections[this.sectionIndex[e]]}getSections(){return this.sections}getSectionIndex(e){return this.sectionIndex[e]}getCodePoint(e){return this.text.codePointAt(e)}verticalizePunctuation(e){this.text=function(i,n){let a="";for(let l=0;l<i.length;l++){const h=i.charCodeAt(l+1)||null,p=i.charCodeAt(l-1)||null;a+=!n&&(h&&_(h)&&!ku[i[l+1]]||p&&_(p)&&!ku[i[l-1]])||!ku[i[l]]?i[l]:ku[i[l]]}return a}(this.text,e)}trim(){let e=0;for(let n=0;n<this.text.length&&Bd[this.text.charCodeAt(n)];n++)e++;let i=this.text.length;for(let n=this.text.length-1;n>=0&&n>=e&&Bd[this.text.charCodeAt(n)];n--)i--;this.text=this.text.substring(e,i),this.sectionIndex=this.sectionIndex.slice(e,i)}substring(e,i){const n=new lc;return n.text=this.text.substring(e,i),n.sectionIndex=this.sectionIndex.slice(e,i),n.sections=this.sections,n}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((e,i)=>Math.max(e,this.sections[i].scale),0)}addTextSection(e,i){this.text+=e.text,this.sections.push(Ou.forText(e.scale,e.fontStack||i));const n=this.sections.length-1;for(let a=0;a<e.text.length;++a)this.sectionIndex.push(n)}addImageSection(e){const i=e.image?e.image.namePrimary:"";if(i.length===0)return void Ci("Can't add FormattedSection with an empty image.");const n=this.getNextImageSectionCharCode();n?(this.text+=String.fromCodePoint(n),this.sections.push(Ou.forImage(i)),this.sectionIndex.push(this.sections.length-1)):Ci("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function Af(t,e,i,n,a,l,h,p,m,g,x,v,w,E,M){const I=lc.fromFeature(t,a);v===hn.vertical&&I.verticalizePunctuation(w);let z=[];const D=function(q,J,ee,oe,fe,le){if(!q)return[];const ge=[],_e=function(Ce,Ae,ye,Ye,$e,ze){let ct=0;for(let it=0;it<Ce.length();it++){const Je=Ce.getSection(it);ct+=J_(Ce.getCodePoint(it),Je,Ye,$e,Ae,ze)}return ct/Math.max(1,Math.ceil(ct/ye))}(q,J,ee,oe,fe,le),me=q.text.indexOf("​")>=0;let Ee=0;for(let Ce=0;Ce<q.length();Ce++){const Ae=q.getSection(Ce),ye=q.getCodePoint(Ce);if(Bd[ye]||(Ee+=J_(ye,Ae,oe,fe,J,le)),Ce<q.length()-1){const Ye=!((we=ye)<11904||!(r["Bopomofo Extended"](we)||r.Bopomofo(we)||r["CJK Compatibility Forms"](we)||r["CJK Compatibility Ideographs"](we)||r["CJK Compatibility"](we)||r["CJK Radicals Supplement"](we)||r["CJK Strokes"](we)||r["CJK Symbols and Punctuation"](we)||r["CJK Unified Ideographs Extension A"](we)||r["CJK Unified Ideographs"](we)||r["Enclosed CJK Letters and Months"](we)||r["Halfwidth and Fullwidth Forms"](we)||r.Hiragana(we)||r["Ideographic Description Characters"](we)||r["Kangxi Radicals"](we)||r["Katakana Phonetic Extensions"](we)||r.Katakana(we)||r["Vertical Forms"](we)||r["Yi Radicals"](we)||r["Yi Syllables"](we)));(Vx[ye]||Ye||Ae.imageName)&&ge.push(eg(Ce+1,Ee,_e,ge,Ux(ye,q.getCodePoint(Ce+1),Ye&&me),!1))}}var we;return tg(eg(q.length(),Ee,_e,ge,0,!0))}(I,g,l,e,n,E),{processBidirectionalText:F,processStyledBidirectionalText:j}=Q;if(F&&I.sections.length===1){const q=F(I.toString(),D);for(const J of q){const ee=new lc;ee.text=J,ee.sections=I.sections;for(let oe=0;oe<J.length;oe++)ee.sectionIndex.push(0);z.push(ee)}}else if(j){const q=j(I.text,I.sectionIndex,D);for(const J of q){const ee=new lc;ee.text=J[0],ee.sectionIndex=J[1],ee.sections=I.sections,z.push(ee)}}else z=function(q,J){const ee=[],oe=q.text;let fe=0;for(const le of J)ee.push(q.substring(fe,le)),fe=le;return fe<oe.length&&ee.push(q.substring(fe,oe.length)),ee}(I,D);const V=[],X={positionedLines:V,text:I.toString(),top:x[1],bottom:x[1],left:x[0],right:x[0],writingMode:v,iconsInText:!1,verticalizable:!1,hasBaseline:!1};return function(q,J,ee,oe,fe,le,ge,_e,me,Ee,we,Ce){let Ae=0,ye=0,Ye=0;const $e=_e==="right"?1:_e==="left"?0:.5;let ze=!1;for(const bt of fe){const pt=bt.getSections();for(const Mt of pt){if(Mt.imageName)continue;const wt=J[Mt.fontStack];if(wt&&(ze=wt.ascender!==void 0&&wt.descender!==void 0,!ze))break}if(!ze)break}let ct=0;for(const bt of fe){bt.trim();const pt=bt.getMaxScale(),Mt=(pt-1)*ur,wt={positionedGlyphs:[],lineOffset:0};q.positionedLines[ct]=wt;const Rt=wt.positionedGlyphs;let ht=0;if(!bt.length()){ye+=le,++ct;continue}let oi=0,ni=0;for(let Ut=0;Ut<bt.length();Ut++){const Wt=bt.getSection(Ut),yi=bt.getSectionIndex(Ut),di=bt.getCodePoint(Ut);let Pi=Wt.scale,Mi=null,_r=null,ki=null,Ei=ur,Zi=0;const ir=!(me===hn.horizontal||!we&&!f(di)||we&&(Bd[di]||(it=di,r.Arabic(it)||r["Arabic Supplement"](it)||r["Arabic Extended-A"](it)||r["Arabic Presentation Forms-A"](it)||r["Arabic Presentation Forms-B"](it))));if(Wt.imageName){const rr=oe[Wt.imageName];if(!rr)continue;ki=Wt.imageName,q.iconsInText=q.iconsInText||!0,_r=rr.paddedRect;const fi=rr.displaySize;Pi=Pi*ur/Ce,Mi={width:fi[0],height:fi[1],left:0,top:-Y_,advance:ir?fi[1]:fi[0],localGlyph:!1},Zi=ze?-Mi.height*Pi:pt*ur-17-fi[1]*Pi,Ei=Mi.advance;const Cr=(ir?fi[0]:fi[1])*Pi-ur*pt;Cr>0&&Cr>ht&&(ht=Cr)}else{const rr=ee[Wt.fontStack];if(!rr)continue;rr[di]&&(_r=rr[di]);const fi=J[Wt.fontStack];if(!fi)continue;const Cr=fi.glyphs[di];if(!Cr)continue;if(Mi=Cr.metrics,Ei=di!==8203?ur:0,ze){const Fs=fi.ascender!==void 0?Math.abs(fi.ascender):0,Sn=fi.descender!==void 0?Math.abs(fi.descender):0,qn=(Fs+Sn)*Pi;oi<qn&&(oi=qn,ni=(Fs-Sn)/2*Pi),Zi=-Fs*Pi}else Zi=(pt-Pi)*ur-17}ir?(q.verticalizable=!0,Rt.push({glyph:di,imageName:ki,x:Ae,y:ye+Zi,vertical:ir,scale:Pi,localGlyph:Mi.localGlyph,fontStack:Wt.fontStack,sectionIndex:yi,metrics:Mi,rect:_r}),Ae+=Ei*Pi+Ee):(Rt.push({glyph:di,imageName:ki,x:Ae,y:ye+Zi,vertical:ir,scale:Pi,localGlyph:Mi.localGlyph,fontStack:Wt.fontStack,sectionIndex:yi,metrics:Mi,rect:_r}),Ae+=Mi.advance*Pi+Ee)}Rt.length!==0&&(Ye=Math.max(Ae-Ee,Ye),ze?ig(Rt,$e,ht,ni,le*pt/2):ig(Rt,$e,ht,0,le/2)),Ae=0;const $t=le*pt+ht;wt.lineOffset=Math.max(ht,Mt),ye+=$t,++ct}var it;const Je=ye,{horizontalAlign:De,verticalAlign:ot}=If(ge);(function(bt,pt,Mt,wt,Rt,ht){const oi=(pt-Mt)*Rt,ni=-ht*wt;for(const $t of bt)for(const Ut of $t.positionedGlyphs)Ut.x+=oi,Ut.y+=ni})(q.positionedLines,$e,De,ot,Ye,Je),q.top+=-ot*Je,q.bottom=q.top+Je,q.left+=-De*Ye,q.right=q.left+Ye,q.hasBaseline=ze}(X,e,i,n,z,h,p,m,v,g,w,M),!function(q){for(const J of q)if(J.positionedGlyphs.length!==0)return!1;return!0}(V)&&X}const Bd={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Vx={10:!0,32:!0,38:!0,40:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0};function J_(t,e,i,n,a,l){if(e.imageName){const h=n[e.imageName];return h?h.displaySize[0]*e.scale*ur/l+a:0}{const h=i[e.fontStack],p=h&&h.glyphs[t];return p?p.metrics.advance*e.scale+a:0}}function K_(t,e,i,n){const a=Math.pow(t-e,2);return n?t<e?a/2:2*a:a+Math.abs(i)*i}function Ux(t,e,i){let n=0;return t===10&&(n-=1e4),i&&(n+=150),t!==40&&t!==65288||(n+=50),e!==41&&e!==65289||(n+=50),n}function eg(t,e,i,n,a,l){let h=null,p=K_(e,i,a,l);for(const m of n){const g=K_(e-m.x,i,a,l)+m.badness;g<=p&&(h=m,p=g)}return{index:t,x:e,priorBreak:h,badness:p}}function tg(t){return t?tg(t.priorBreak).concat(t.index):[]}function If(t){let e=.5,i=.5;
vendor: 2,282 bytes, line 7
7switch(t){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0}switch(t){case"bottom":case"bottom-right":case"bottom-left":i=1;break;case"top":case"top-right":case"top-left":i=0}return{horizontalAlign:e,verticalAlign:i}}function ig(t,e,i,n,a){if(!(e||i||n||a))return;const l=t.length-1,h=t[l],p=(h.x+h.metrics.advance*h.scale)*e;for(let m=0;m<=l;m++)t[m].x-=p,t[m].y+=i+n+a}function jx(t,e,i,n){const{horizontalAlign:a,verticalAlign:l}=If(n),h=i[0]-t.displaySize[0]*a,p=i[1]-t.displaySize[1]*l;return{imagePrimary:t,imageSecondary:e,top:p,bottom:p+t.displaySize[1],left:h,right:h+t.displaySize[0]}}function rg(t,e,i,n,a,l){const h=t.imagePrimary;let p;if(h.content){const z=h.content,D=h.pixelRatio||1;p=[z[0]/D,z[1]/D,h.displaySize[0]-z[2]/D,h.displaySize[1]-z[3]/D]}const m=e.left*l,g=e.right*l;let x,v,w,E;i==="width"||i==="both"?(E=a[0]+m-n[3],v=a[0]+g+n[1]):(E=a[0]+(m+g-h.displaySize[0])/2,v=E+h.displaySize[0]);const M=e.top*l,I=e.bottom*l;return i==="height"||i==="both"?(x=a[1]+M-n[0],w=a[1]+I+n[2]):(x=a[1]+(M+I-h.displaySize[1])/2,w=x+h.displaySize[1]),{imagePrimary:h,imageSecondary:void 0,top:x,right:v,bottom:w,left:E,collisionPadding:p}}class Bs extends Ne{constructor(e,i,n,a,l){super(e,i),this.angle=a,this.z=n,l!==void 0&&(this.segment=l)}clone(){return new Bs(this.x,this.y,this.z,this.angle,this.segment)}}function ng(t,e,i,n,a){if(e.segment===void 0)return!0;let l=e,h=e.segment+1,p=0;for(;p>-i/2;){if(h--,h<0)return!1;p-=t[h].dist(l),l=t[h]}p+=t[h].dist(t[h+1]),h++;const m=[];let g=0;for(;p<i/2;){const x=t[h],v=t[h+1];if(!v)return!1;let w=t[h-1].angleTo(x)-x.angleTo(v);for(w=Math.abs((w+3*Math.PI)%(2*Math.PI)-Math.PI),m.push({distance:p,angleDelta:w}),g+=w;p-m[0].distance>n;)g-=m.shift().angleDelta;if(g>a)return!1;h++,p+=x.dist(v)}return!0}function sg(t){let e=0;for(let i=0;i<t.length-1;i++)e+=t[i].dist(t[i+1]);return e}function og(t,e,i){return t?.6*e*i:0}function ag(t,e){return Math.max(t?t.right-t.left:0,e?e.right-e.left:0)}function Gx(t,e,i,n,a,l){const h=og(i,a,l),p=ag(i,n)*l;let m=0;const g=sg(t)/2;for(let x=0;x<t.length-1;x++){const v=t[x],w=t[x+1],E=v.dist(w);if(m+E>g){const M=(g-m)/E,I=Ct(v.x,w.x,M),z=Ct(v.y,w.y,M),D=new Bs(I,z,0,w.angleTo(v),x);return!h||ng(t,D,p,h,e)?D:void 0}m+=E}}
vendor: 4,527 bytes, line 7
7function qx(t,e,i,n,a,l,h,p,m){const g=og(n,l,h),x=ag(n,a),v=x*h,w=t[0].x===0||t[0].x===m||t[0].y===0||t[0].y===m;return e-v<e/4&&(e=v+e/4),lg(t,w?e/2*p%e:(x/2+2*l)*h*p%e,e,g,i,v,w,!1,m)}function lg(t,e,i,n,a,l,h,p,m){const g=l/2,x=sg(t);let v=0,w=e-i,E=[];for(let M=0;M<t.length-1;M++){const I=t[M],z=t[M+1],D=I.dist(z),F=z.angleTo(I);for(;w+i<v+D;){w+=i;const j=(w-v)/D,V=Ct(I.x,z.x,j),X=Ct(I.y,z.y,j);if(V>=0&&V<m&&X>=0&&X<m&&w-g>=0&&w+g<=x){const q=new Bs(V,X,0,F,M);n&&!ng(t,q,l,n,a)||E.push(q)}}v+=D}return p||E.length||h||(E=lg(t,v/2,i,n,a,l,h,!0,m)),E}function cg(t,e,i,n,a){const l=[];for(let h=0;h<t.length;h++){const p=t[h];let m;for(let g=0;g<p.length-1;g++){let x=p[g],v=p[g+1];x.x<e&&v.x<e||(x.x<e?x=new Ne(e,x.y+(e-x.x)/(v.x-x.x)*(v.y-x.y))._round():v.x<e&&(v=new Ne(e,x.y+(e-x.x)/(v.x-x.x)*(v.y-x.y))._round()),x.y<i&&v.y<i||(x.y<i?x=new Ne(x.x+(i-x.y)/(v.y-x.y)*(v.x-x.x),i)._round():v.y<i&&(v=new Ne(x.x+(i-x.y)/(v.y-x.y)*(v.x-x.x),i)._round()),x.x>=n&&v.x>=n||(x.x>=n?x=new Ne(n,x.y+(n-x.x)/(v.x-x.x)*(v.y-x.y))._round():v.x>=n&&(v=new Ne(n,x.y+(n-x.x)/(v.x-x.x)*(v.y-x.y))._round()),x.y>=a&&v.y>=a||(x.y>=a?x=new Ne(x.x+(a-x.y)/(v.y-x.y)*(v.x-x.x),a)._round():v.y>=a&&(v=new Ne(x.x+(a-x.y)/(v.y-x.y)*(v.x-x.x),a)._round()),m&&x.equals(m[m.length-1])||(m=[x],l.push(m)),m.push(v)))))}}return l}function ug(t){let e=0,i=0;for(const h of t)e+=h.w*h.h,i=Math.max(i,h.w);t.sort((h,p)=>p.h-h.h);const n=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),i),h:1/0}];let a=0,l=0;for(const h of t)for(let p=n.length-1;p>=0;p--){const m=n[p];if(!(h.w>m.w||h.h>m.h)){if(h.x=m.x,h.y=m.y,l=Math.max(l,h.y+h.h),a=Math.max(a,h.x+h.w),h.w===m.w&&h.h===m.h){const g=n.pop();p<n.length&&(n[p]=g)}else h.h===m.h?(m.x+=h.w,m.w-=h.w):h.w===m.w?(m.y+=h.h,m.h-=h.h):(n.push({x:m.x+h.w,y:m.y,w:m.w-h.w,h:h.h}),m.y+=h.h,m.h-=h.h);break}}return{w:a,h:l,fill:e/(a*l)||0}}Qe(Bs,"Anchor");const Wr=1;class Cf{constructor(e,{pixelRatio:i,version:n,stretchX:a,stretchY:l,content:h}){this.paddedRect=e,this.pixelRatio=i,this.stretchX=a,this.stretchY=l,this.content=h,this.version=n}get tl(){return[this.paddedRect.x+Wr,this.paddedRect.y+Wr]}get br(){return[this.paddedRect.x+this.paddedRect.w-Wr,this.paddedRect.y+this.paddedRect.h-Wr]}get displaySize(){return[(this.paddedRect.w-2*Wr)/this.pixelRatio,(this.paddedRect.h-2*Wr)/this.pixelRatio]}}class hg{constructor(e,i){const n={},a={};this.haveRenderCallbacks=[];const l=[];this.addImages(e,n,l),this.addImages(i,a,l);const{w:h,h:p}=ug(l),m=new un({width:h||1,height:p||1});for(const g in e){const x=e[g],v=n[g].paddedRect;un.copy(x.data,m,{x:0,y:0},{x:v.x+Wr,y:v.y+Wr},x.data,x.sdf)}for(const g in i){const x=i[g],v=a[g].paddedRect,w=v.x+Wr,E=v.y+Wr,M=x.data.width,I=x.data.height;un.copy(x.data,m,{x:0,y:0},{x:w,y:E},x.data),un.copy(x.data,m,{x:0,y:I-1},{x:w,y:E-1},{width:M,height:1}),un.copy(x.data,m,{x:0,y:0},{x:w,y:E+I},{width:M,height:1}),un.copy(x.data,m,{x:M-1,y:0},{x:w-1,y:E},{width:1,height:I}),un.copy(x.data,m,{x:0,y:0},{x:w+M,y:E},{width:1,height:I})}this.image=m,this.iconPositions=n,this.patternPositions=a}addImages(e,i,n){for(const a in e){const l=e[a],h={x:0,y:0,w:l.data.width+2*Wr,h:l.data.height+2*Wr};n.push(h),i[a]=new Cf(h,l),l.hasRenderCallback&&this.haveRenderCallbacks.push(a)}}patchUpdatedImages(e,i,n){this.haveRenderCallbacks=this.haveRenderCallbacks.filter(a=>e.hasImage(a,n)),e.dispatchRenderCallbacks(this.haveRenderCallbacks,n);for(const a in e.getUpdatedImages(n))this.patchUpdatedImage(this.iconPositions[a],e.getImage(a,n),i),this.patchUpdatedImage(this.patternPositions[a],e.getImage(a,n),i)}patchUpdatedImage(e,i,n){if(!e||!i||e.version===i.version)return;e.version=i.version;const[a,l]=e.tl,h=!!Object.keys(this.patternPositions).length;n.update(i.data,{useMipmap:h},{x:a,y:l})}}Qe(Cf,"ImagePosition"),Qe(hg,"ImageAtlas");const Bu=1e20;function dg(t,e,i,n,a,l,h,p,m){for(let g=e;g<e+n;g++)pg(t,i*l+g,l,a,h,p,m);for(let g=i;g<i+a;g++)pg(t,g*l+e,1,n,h,p,m)}function pg(t,e,i,n,a,l,h){l[0]=0,h[0]=-Bu,h[1]=Bu,a[0]=t[e];for(let p=1,m=0,g=0;p<n;p++){a[p]=t[e+p*i];const x=p*p;do{const v=l[m];g=(a[p]-a[v]+x-v*v)/(p-v)/2}while(g<=h[m]&&--m>-1);m++,l[m]=p,h[m]=g,h[m+1]=Bu}for(let p=0,m=0;p<n;p++){for(;h[m+1]<p;)m++;const g=l[m],x=p-g;t[e+p*i]=a[g]+x*x}}const Nn=2,Pf={none:0,ideographs:1,all:2};class cc{constructor(e,i,n){this.requestManager=e,this.localGlyphMode=i,this.localFontFamily=n,this.urls={},this.entries={},this.localGlyphs={200:{},400:{},500:{},900:{}}}setURL(e,i){this.urls[i]=e}getGlyphs(e,i,n){const a=[],l=this.urls[i]||Tt.GLYPHS_URL;
7for(const h in e)for(const p of e[h])a.push({stack:h,id:p});Ac(a,({stack:h,id:p},m)=>{let g=this.entries[h];g||(g=this.entries[h]={glyphs:{},requests:{},ranges:{},ascender:void 0,descender:void 0});let x=g.glyphs[p];if(x!==void 0)return void m(null,{stack:h,id:p,glyph:x});if(x=this._tinySDF(g,h,p),x)return g.glyphs[p]=x,void m(null,{stack:h,id:p,glyph:x});const v=Math.floor(p/256);if(256*v>65535)return void m(new Error("glyphs > 65535 not supported"));if(g.ranges[v])return void m(null,{stack:h,id:p,glyph:x});let w=g.requests[v];w||(w=g.requests[v]=[],cc.loadGlyphRange(h,v,l,this.requestManager,(E,M)=>{if(M){g.ascender=M.ascender,g.descender=M.descender;for(const I in M.glyphs)this._doesCharSupportLocalGlyph(+I)||(g.glyphs[+I]=M.glyphs[+I]);g.ranges[v]=!0}for(const I of w)I(E,M);delete g.requests[v]})),w.push((E,M)=>{E?m(E):M&&m(null,{stack:h,id:p,glyph:M.glyphs[p]||null})})},(h,p)=>{if(h)n(h);else if(p){const m={};for(const{stack:g,id:x,glyph:v}of p)m[g]===void 0&&(m[g]={}),m[g].glyphs===void 0&&(m[g].glyphs={}),m[g].glyphs[x]=v&&{id:v.id,bitmap:v.bitmap.clone(),metrics:v.metrics},m[g].ascender=this.entries[g].ascender,m[g].descender=this.entries[g].descender;n(null,m)}})}_doesCharSupportLocalGlyph(e){return this.localGlyphMode!==Pf.none&&(this.localGlyphMode===Pf.all?!!this.localFontFamily:!!this.localFontFamily&&(r["CJK Unified Ideographs"](e)||r["Hangul Syllables"](e)||r.Hiragana(e)||r.Katakana(e)||r["CJK Symbols and Punctuation"](e)||r["CJK Unified Ideographs Extension A"](e)||r["CJK Unified Ideographs Extension B"](e)))}_tinySDF(e,i,n){const a=this.localFontFamily;if(!a||!this._doesCharSupportLocalGlyph(n))return;let l=e.tinySDF;if(!l){let I="400";/bold/i.test(i)?I="900":/medium/i.test(i)?I="500":/light/i.test(i)&&(I="200"),l=e.tinySDF=new cc.TinySDF({fontFamily:a,fontWeight:I,fontSize:24*Nn,buffer:3*Nn,radius:8*Nn}),l.fontWeight=I}if(this.localGlyphs[l.fontWeight][n])return this.localGlyphs[l.fontWeight][n];const h=String.fromCodePoint(n),{data:p,width:m,height:g,glyphWidth:x,glyphHeight:v,glyphLeft:w,glyphTop:E,glyphAdvance:M}=l.draw(h);return this.localGlyphs[l.fontWeight][n]={id:n,bitmap:new Eo({width:m,height:g},p),metrics:{width:x/Nn,height:v/Nn,left:w/Nn,top:E/Nn-27,advance:M/Nn,localGlyph:!0}}}}cc.loadGlyphRange=function(t,e,i,n,a){const l=256*e,h=l+255,p=n.transformRequest(n.normalizeGlyphsURL(i).replace("{fontstack}",t).replace("{range}",`${l}-${h}`),dl.Glyphs);Ho(p,(m,g)=>{if(m)a(m);else if(g){const x={},v=function(w){return new ac(w).readFields(Bx,{})}(g);for(const w of v.glyphs)x[w.id]=w;a(null,{glyphs:x,ascender:v.ascender,descender:v.descender})}})},cc.TinySDF=class{constructor({fontSize:t=24,buffer:e=3,radius:i=8,cutoff:n=.25,fontFamily:a="sans-serif",fontWeight:l="normal",fontStyle:h="normal"}={}){this.buffer=e,this.cutoff=n,this.radius=i;const p=this.size=t+4*e,m=this._createCanvas(p),g=this.ctx=m.getContext("2d",{willReadFrequently:!0});g.font=`${h} ${l} ${t}px ${a}`,g.textBaseline="alphabetic",g.textAlign="left",g.fillStyle="black",this.gridOuter=new Float64Array(p*p),this.gridInner=new Float64Array(p*p),this.f=new Float64Array(p),this.z=new Float64Array(p+1),this.v=new Uint16Array(p)}_createCanvas(t){const e=document.createElement("canvas");return e.width=e.height=t,e}draw(t){const{width:e,actualBoundingBoxAscent:i,actualBoundingBoxDescent:n,actualBoundingBoxLeft:a,actualBoundingBoxRight:l}=this.ctx.measureText(t),h=Math.ceil(i),p=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(l-a))),m=Math.min(this.size-this.buffer,h+Math.ceil(n)),g=p+2*this.buffer,x=m+2*this.buffer,v=Math.max(g*x,0),w=new Uint8ClampedArray(v),E={data:w,width:g,height:x,glyphWidth:p,glyphHeight:m,glyphTop:h,glyphLeft:0,glyphAdvance:e};if(p===0||m===0)return E;const{ctx:M,buffer:I,gridInner:z,gridOuter:D}=this;M.clearRect(I,I,p,m),M.fillText(t,I,I+h);const F=M.getImageData(I,I,p,m);D.fill(Bu,0,v),z.fill(0,0,v);for(let j=0;j<m;j++)for(let V=0;V<p;V++){const X=F.data[4*(j*p+V)+3]/255;if(X===0)continue;const q=(j+I)*g+V+I;if(X===1)D[q]=0,z[q]=Bu;else{const J=.5-X;D[q]=J>0?J*J:0,z[q]=J<0?J*J:0}}dg(D,0,0,g,x,g,this.f,this.v,this.z),dg(z,I,I,p,m,g,this.f,this.v,this.z);for(let j=0;j<v;j++){const V=Math.sqrt(D[j])-Math.sqrt(z[j]);w[j]=Math.round(255-255*(V/this.radius+this.cutoff))}return E}};const Ao=Wr;function fg(t,e,i,n){const a=[],l=t.imagePrimary,h=l.pixelRatio,p=l.paddedRect.w-2*Ao,m=l.paddedRect.h-2*Ao,g=t.right-t.left,x=t.bottom-t.top,v=l.stretchX||[[0,p]],w=l.stretchY||[[0,m]],E=(le,ge)=>le+ge[1]-ge[0],M=v.reduce(E,0),I=w.reduce(E,0),z=p-M,D=m-I;let F=0,j=M,V=0,X=I,q=0,J=z,ee=0,oe=D;if(l.content&&n){const le=l.content;F=Fd(v,0,le[0]),V=Fd(w,0,le[1]),j=Fd(v,le[0],le[2]),X=Fd(w,le[1],le[3]),q=le[0]-F,ee=le[1]-V,J=le[2]-le[0]-j,oe=le[3]-le[1]-X}const fe=(le,ge,_e,me)=>{const Ee=Nd(le.stretch-F,j,g,t.left),we=Vd(le.fixed-q,J,le.stretch,M),Ce=Nd(ge.stretch-V,X,x,t.top),Ae=Vd(ge.fixed-ee,oe,ge.stretch,I),ye=Nd(_e.stretch-F,j,g,t.left),Ye=Vd(_e.fixed-q,J,_e.stretch,M),$e=Nd(me.stretch-V,X,x,t.top),ze=Vd(me.fixed-ee,oe,me.stretch,I),ct=new Ne(Ee,Ce),it=ne
7w Ne(ye,Ce),Je=new Ne(ye,$e),De=new Ne(Ee,$e),ot=new Ne(we/h,Ae/h),bt=new Ne(Ye/h,ze/h),pt=e*Math.PI/180;if(pt){const ni=Math.sin(pt),$t=Math.cos(pt),Ut=[$t,-ni,ni,$t];ct._matMult(Ut),it._matMult(Ut),De._matMult(Ut),Je._matMult(Ut)}const Mt=le.stretch+le.fixed,wt=_e.stretch+_e.fixed,Rt=ge.stretch+ge.fixed,ht=me.stretch+me.fixed,oi=t.imageSecondary;return{tl:ct,tr:it,bl:De,br:Je,texPrimary:{x:l.paddedRect.x+Ao+Mt,y:l.paddedRect.y+Ao+Rt,w:wt-Mt,h:ht-Rt},texSecondary:oi?{x:oi.paddedRect.x+Ao+Mt,y:oi.paddedRect.y+Ao+Rt,w:wt-Mt,h:ht-Rt}:void 0,writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:ot,pixelOffsetBR:bt,minFontScaleX:J/h/g,minFontScaleY:oe/h/x,isSDF:i}};if(n&&(l.stretchX||l.stretchY)){const le=mg(v,z,M),ge=mg(w,D,I);for(let _e=0;_e<le.length-1;_e++){const me=le[_e],Ee=le[_e+1];for(let we=0;we<ge.length-1;we++)a.push(fe(me,ge[we],Ee,ge[we+1]))}}else a.push(fe({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:p+1},{fixed:0,stretch:m+1}));return a}function Fd(t,e,i){let n=0;for(const a of t)n+=Math.max(e,Math.min(i,a[1]))-Math.max(e,Math.min(i,a[0]));return n}function mg(t,e,i){const n=[{fixed:-Ao,stretch:0}];for(const[a,l]of t){const h=n[n.length-1];n.push({fixed:a-h.stretch,stretch:h.stretch}),n.push({fixed:a-h.stretch,stretch:h.stretch+(l-a)})}return n.push({fixed:e+Ao,stretch:i}),n}function Nd(t,e,i,n){return t/e*i+n}function Vd(t,e,i,n){return t-e*i/n}function Zx(t,e,i,n){const a=e+t.positionedLines[n].lineOffset;return n===0?i+a/2:i+(a+(e+t.positionedLines[n-1].lineOffset))/2}function $x(t,e=1,i=!1){let n=1/0,a=1/0,l=-1/0,h=-1/0;const p=t[0];for(let E=0;E<p.length;E++){const M=p[E];(!E||M.x<n)&&(n=M.x),(!E||M.y<a)&&(a=M.y),(!E||M.x>l)&&(l=M.x),(!E||M.y>h)&&(h=M.y)}const m=Math.min(l-n,h-a);let g=m/2;const x=new Cl([],Wx);if(m===0)return new Ne(n,a);for(let E=n;E<l;E+=m)for(let M=a;M<h;M+=m)x.push(new uc(E+g,M+g,g,t));let v=function(E){let M=0,I=0,z=0;const D=E[0];for(let F=0,j=D.length,V=j-1;F<j;V=F++){const X=D[F],q=D[V],J=X.x*q.y-q.x*X.y;I+=(X.x+q.x)*J,z+=(X.y+q.y)*J,M+=3*J}return new uc(I/M,z/M,0,E)}(t),w=x.length;for(;x.length;){const E=x.pop();(E.d>v.d||!v.d)&&(v=E,i&&console.log("found best %d after %d probes",Math.round(1e4*E.d)/1e4,w)),E.max-v.d<=e||(g=E.h/2,x.push(new uc(E.p.x-g,E.p.y-g,g,t)),x.push(new uc(E.p.x+g,E.p.y-g,g,t)),x.push(new uc(E.p.x-g,E.p.y+g,g,t)),x.push(new uc(E.p.x+g,E.p.y+g,g,t)),w+=4)}return i&&(console.log(`num probes: ${w}`),console.log(`best distance: ${v.d}`)),v.p}function Wx(t,e){return e.max-t.max}class uc{constructor(e,i,n,a){this.p=new Ne(e,i),this.h=n,this.d=function(l,h){let p=!1,m=1/0;for(let g=0;g<h.length;g++){const x=h[g];for(let v=0,w=x.length,E=w-1;v<w;E=v++){const M=x[v],I=x[E];M.y>l.y!=I.y>l.y&&l.x<(I.x-M.x)*(l.y-M.y)/(I.y-M.y)+M.x&&(p=!p),m=Math.min(m,Dm(l,M,I))}}return(p?1:-1)*Math.sqrt(m)}(this.p,a),this.max=this.d+this.h*Math.SQRT2}}const zf=Number.POSITIVE_INFINITY,Qx=Math.sqrt(2);function _g(t,[e,i]){let n=0,a=0;if(i===zf){e<0&&(e=0);const l=e/Qx;switch(t){case"top-right":case"top-left":a=l-7;break;case"bottom-right":case"bottom-left":a=7-l;break;case"bottom":a=7-e;break;case"top":a=e-7}switch(t){case"top-right":case"bottom-right":n=-l;break;case"top-left":case"bottom-left":n=l;break;case"left":n=e;break;case"right":n=-e}}else{switch(e=Math.abs(e),i=Math.abs(i),t){case"top-right":case"top-left":case"top":a=i-7;break;case"bottom-right":case"bottom-left":case"bottom":a=7-i}switch(t){case"top-right":case"bottom-right":case"right":n=-e;break;case"top-left":case"bottom-left":case"left":n=e}}return[n,a]}function Df(t){switch(t){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function Hx(t,e,i,n,a,l,h,p,m,g,x,v,w,E,M){let I=l.textMaxSize.evaluate(e,{},v);I===void 0&&(I=h);const z=t.layers[0].layout,D=z.get("icon-offset").evaluate(e,{},v),F=yg(i.horizontal)||i.vertical,j=w.name==="globe",V=ur,X=h/V,q=t.tilePixelRatio*I/V,J=(Ee=t.overscaling,t.zoom>18&&Ee>2&&(Ee>>=1),Math.max(Ve/(512*Ee),1)*z.get("symbol-spacing")),ee=z.get("text-padding")*t.tilePixelRatio,oe=z.get("icon-padding")*t.tilePixelRatio,fe=jt(z.get("text-max-angle")),le=z.get("text-rotation-alignment")==="map"&&z.get("symbol-placement")!=="point",ge=z.get("icon-rotation-alignment")==="map"&&z.get("symbol-placement")!=="point",_e=z.get("symbol-placement"),me=J/2;var Ee;const we=z.get("icon-text-fit").evaluate(e,{},v),Ce=z.get("icon-text-fit-padding").evaluate(e,{},v),Ae=we!=="none";let ye;t.hasAnyIconTextFit===!1&&Ae&&(t.hasAnyIconTextFit=!0),n&&Ae&&(t.allowVerticalPlacement&&i.vertical&&(ye=rg(n,i.vertical,we,Ce,D,X)),F&&(n=rg(n,F,we,Ce,D,X)));const Ye=($e,ze,ct)=>{if(ze.x<0||ze.x>=Ve||ze.y<0||ze.y>=Ve)return;let it=null;if(j){const{x:Je,y:De,z:ot}=w.projectTilePoint(ze.x,ze.y,ct);
7it={anchor:new Bs(Je,De,ot,0,void 0),up:w.upVector(ct,ze.x,ze.y)}}(function(Je,De,ot,bt,pt,Mt,wt,Rt,ht,oi,ni,$t,Ut,Wt,yi,di,Pi,Mi,_r,ki,Ei,Zi,ir,rr,fi,Cr,Fs){const Sn=Je.addToLineVertexArray(De,bt);let qn,Ro,Lo,Ua,vy,by,wy,Ty=0,Ey=0,Sy=0,My=0,tm=-1,im=-1;const ls={};let Ay=Ko("");const ja=ot?ot.anchor:De,rm=ht.layout.get("icon-text-fit").evaluate(Ei,{},fi)!=="none";let nm=0,sm=0;if(ht._unevaluatedLayout.getValue("text-radial-offset")===void 0?[nm,sm]=ht.layout.get("text-offset").evaluate(Ei,{},fi).map(Qr=>Qr*ur):(nm=ht.layout.get("text-radial-offset").evaluate(Ei,{},fi)*ur,sm=zf),Je.allowVerticalPlacement&&pt.vertical){const Qr=pt.vertical;if(yi)by=Rf(Qr),Rt&&(wy=Rf(Rt));else{const Hr=ht.layout.get("text-rotate").evaluate(Ei,{},fi)+90;Lo=Ud(oi,ja,De,ni,$t,Ut,Qr,Wt,Hr,di),Rt&&(Ua=Ud(oi,ja,De,ni,$t,Ut,Rt,Mi,Hr))}}if(Mt){const Qr=ht.layout.get("icon-rotate").evaluate(Ei,{},fi),Hr=fg(Mt,Qr,ir,rm),gc=Rt?fg(Rt,Qr,ir,rm):void 0;Ro=Ud(oi,ja,De,ni,$t,Ut,Mt,Mi,Qr),Ty=4*Hr.length;const Iy=Je.iconSizeData;let Ga=null;Iy.kind==="source"?(Ga=[Fn*ht.layout.get("icon-size").evaluate(Ei,{},fi)],Ga[0]>Io&&Ci(`${Je.layerIds[0]}: Value for "icon-size" is >= ${Fu}. Reduce your "icon-size".`)):Iy.kind==="composite"&&(Ga=[Fn*Zi.compositeIconSizes[0].evaluate(Ei,{},fi),Fn*Zi.compositeIconSizes[1].evaluate(Ei,{},fi)],(Ga[0]>Io||Ga[1]>Io)&&Ci(`${Je.layerIds[0]}: Value for "icon-size" is >= ${Fu}. Reduce your "icon-size".`)),Je.addSymbols(Je.icon,Hr,Ga,ki,_r,Ei,!1,ot,De,Sn.lineStartIndex,Sn.lineLength,-1,rr,fi,Cr,Fs),tm=Je.icon.placedSymbolArray.length-1,gc&&(Ey=4*gc.length,Je.addSymbols(Je.icon,gc,Ga,ki,_r,Ei,hn.vertical,ot,De,Sn.lineStartIndex,Sn.lineLength,-1,rr,fi,Cr,Fs),im=Je.icon.placedSymbolArray.length-1)}for(const Qr in pt.horizontal){const Hr=pt.horizontal[Qr];qn||(Ay=Ko(Hr.text),yi?vy=Rf(Hr):qn=Ud(oi,ja,De,ni,$t,Ut,Hr,Wt,ht.layout.get("text-rotate").evaluate(Ei,{},fi),di));const gc=Hr.positionedLines.length===1;if(Sy+=gg(Je,ot,De,Hr,wt,ht,yi,Ei,di,Sn,pt.vertical?hn.horizontal:hn.horizontalOnly,gc?Object.keys(pt.horizontal):[Qr],ls,tm,Zi,rr,fi,Cr),gc)break}pt.vertical&&(My+=gg(Je,ot,De,pt.vertical,wt,ht,yi,Ei,di,Sn,hn.vertical,["vertical"],ls,im,Zi,rr,fi,Cr));let ko=-1;const om=(Qr,Hr)=>Qr?Math.max(Qr,Hr):Hr;ko=om(vy,ko),ko=om(by,ko),ko=om(wy,ko);const p1=ko>-1?1:0;Je.glyphOffsetArray.length>=65535&&Ci("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),Ei.sortKey!==void 0&&Je.addToSortKeyRanges(Je.symbolInstances.length,Ei.sortKey),Je.symbolInstances.emplaceBack(De.x,De.y,ja.x,ja.y,ja.z,ls.right>=0?ls.right:-1,ls.center>=0?ls.center:-1,ls.left>=0?ls.left:-1,ls.vertical>=0?ls.vertical:-1,tm,im,Ay,qn!==void 0?qn:Je.collisionBoxArray.length,qn!==void 0?qn+1:Je.collisionBoxArray.length,Lo!==void 0?Lo:Je.collisionBoxArray.length,Lo!==void 0?Lo+1:Je.collisionBoxArray.length,Ro!==void 0?Ro:Je.collisionBoxArray.length,Ro!==void 0?Ro+1:Je.collisionBoxArray.length,Ua||Je.collisionBoxArray.length,Ua?Ua+1:Je.collisionBoxArray.length,ni,Sy,My,Ty,Ey,p1,0,nm,sm,ko,0,rm?1:0)})(t,ze,it,$e,i,n,a,ye,t.layers[0],t.collisionBoxArray,e.index,e.sourceLayerIndex,t.index,ee,le,m,0,oe,ge,D,e,l,g,x,v,E,M)};if(_e==="line")for(const $e of cg(e.geometry,0,0,Ve,Ve)){const ze=qx($e,J,fe,i.vertical||F,n,V,q,t.overscaling,Ve);for(const ct of ze)F&&Xx(t,F.text,me,ct)||Ye($e,ct,v)}else if(_e==="line-center"){for(const $e of e.geometry)if($e.length>1){const ze=Gx($e,fe,i.vertical||F,n,V,q);ze&&Ye($e,ze,v)}}else if(e.type==="Polygon")for(const $e of gf(e.geometry,0)){const ze=$x($e,16);Ye($e[0],new Bs(ze.x,ze.y,0,0,void 0),v)}else if(e.type==="LineString")for(const $e of e.geometry)Ye($e,new Bs($e[0].x,$e[0].y,0,0,void 0),v);else if(e.type==="Point")for(const $e of e.geometry)for(const ze of $e)Ye([ze],new Bs(ze.x,ze.y,0,0,void 0),v)}const Fu=255,Io=Fu*Fn;function gg(t,e,i,n,a,l,h,p,m,g,x,v,w,E,M,I,z,D){const F=function(X,q,J,ee,oe,fe,le,ge){const _e=[];if(q.positionedLines.length===0)return _e;const me=ee.layout.get("text-rotate").evaluate(fe,{})*Math.PI/180,Ee=function(Ye){const $e=Ye[0],ze=Ye[1],ct=$e*ze;return ct>0?[$e,-ze]:ct<0?[-$e,ze]:$e===0?[ze,$e]:[ze,-$e]}(J);let we=Math.abs(q.top-q.bottom);for(const Ye of q.positionedLines)we-=Ye.lineOffset;const Ce=q.positionedLines.length,Ae=we/Ce;let ye=q.top-J[1];for(let Ye=0;Ye<Ce;++Ye){const $e=q.positionedLines[Ye];ye=Zx(q,Ae,ye,Ye);for(const ze of $e.positionedGlyphs){if(!ze.rect)continue;const ct=ze.rect||{};let it=Y_+1,Je=!0,De=1,ot=0;if(ze.imageName){const ki=le[ze.imageName];if(!ki)continue;if(ki.sdf){Ci("SDF images are not supported in formatted text and will be ignored.");continue}Je=!1,De=ki.pixelRatio,it=Wr/De}const bt=(oe||ge)&&ze.vertical,pt=ze.metrics.advance*ze.scale/2,Mt=ze.metrics,wt=ze.rect;if(wt===null)continue;ge&&q.verticalizable&&(ot=ze.imageName?pt-ze.metrics.width*ze.scale/2:0);const Rt=oe?[ze.x+pt,ze.y]:[0,0];let ht=[0,0],oi=[0,0],ni=!1;oe||(bt?(oi=[ze.x+pt+Ee[0],ze.y+Ee[1]-ot],ni=!0):ht=[ze.x+pt+J[0],ze.y+J[1]-ot]);const $t=wt.w*ze.scale/(De*(ze.localGlyph?Nn:1)),Ut=wt.h*ze.scale/(De*(ze.localGlyph?Nn:1));let Wt,yi,di,Pi;if(bt){const ki=ze.y-ye,Ei=new Ne(-pt,pt-ki),Zi=-Math.PI/2,ir=new Ne(...oi);
vendor: 5,610 bytes, line 7
7Wt=new Ne(-pt+ht[0],ht[1]),Wt._rotateAround(Zi,Ei)._add(ir),Wt.x+=-ki+pt,Wt.y-=(Mt.left-it)*ze.scale;const rr=ze.imageName?Mt.advance*ze.scale:ur*ze.scale,fi=String.fromCodePoint(ze.glyph);Sx(fi)?Wt.x+=(1-it)*ze.scale:Mx(fi)?Wt.x+=rr-Mt.height*ze.scale+(-it-1)*ze.scale:Wt.x+=ze.imageName||Mt.width+2*it===wt.w&&Mt.height+2*it===wt.h?(rr-Ut)/2:(rr-(Mt.height+2*it)*ze.scale)/2,yi=new Ne(Wt.x,Wt.y-$t),di=new Ne(Wt.x+Ut,Wt.y),Pi=new Ne(Wt.x+Ut,Wt.y-$t)}else{const ki=(Mt.left-it)*ze.scale-pt+ht[0],Ei=(-Mt.top-it)*ze.scale+ht[1],Zi=ki+$t,ir=Ei+Ut;Wt=new Ne(ki,Ei),yi=new Ne(Zi,Ei),di=new Ne(ki,ir),Pi=new Ne(Zi,ir)}if(me){let ki;ki=oe?new Ne(0,0):ni?new Ne(Ee[0],Ee[1]):new Ne(J[0],J[1]),Wt._rotateAround(me,ki),yi._rotateAround(me,ki),di._rotateAround(me,ki),Pi._rotateAround(me,ki)}const Mi=new Ne(0,0),_r=new Ne(0,0);_e.push({tl:Wt,tr:yi,bl:di,br:Pi,texPrimary:ct,texSecondary:void 0,writingMode:q.writingMode,glyphOffset:Rt,sectionIndex:ze.sectionIndex,isSDF:Je,pixelOffsetTL:Mi,pixelOffsetBR:_r,minFontScaleX:0,minFontScaleY:0})}}return _e}(0,n,m,l,h,p,a,t.allowVerticalPlacement),j=t.textSizeData;let V=null;j.kind==="source"?(V=[Fn*l.layout.get("text-size").evaluate(p,{},z)],V[0]>Io&&Ci(`${t.layerIds[0]}: Value for "text-size" is >= ${Fu}. Reduce your "text-size".`)):j.kind==="composite"&&(V=[Fn*M.compositeTextSizes[0].evaluate(p,{},z),Fn*M.compositeTextSizes[1].evaluate(p,{},z)],(V[0]>Io||V[1]>Io)&&Ci(`${t.layerIds[0]}: Value for "text-size" is >= ${Fu}. Reduce your "text-size".`)),t.addSymbols(t.text,F,V,m,h,p,x,e,i,g.lineStartIndex,g.lineLength,E,I,z,D,!1);for(const X of v)w[X]=t.text.placedSymbolArray.length-1;return 4*F.length}function yg(t){for(const e in t)return t[e];return null}function Ud(t,e,i,n,a,l,h,p,m,g){let x=h.top,v=h.bottom,w=h.left,E=h.right;const M=h.collisionPadding;if(M&&(w-=M[0],x-=M[1],E+=M[2],v+=M[3]),m){const I=new Ne(w,x),z=new Ne(E,x),D=new Ne(w,v),F=new Ne(E,v),j=jt(m);let V=new Ne(0,0);g&&(V=new Ne(g[0],g[1])),I._rotateAround(j,V),z._rotateAround(j,V),D._rotateAround(j,V),F._rotateAround(j,V),w=Math.min(I.x,z.x,D.x,F.x),E=Math.max(I.x,z.x,D.x,F.x),x=Math.min(I.y,z.y,D.y,F.y),v=Math.max(I.y,z.y,D.y,F.y)}return t.emplaceBack(e.x,e.y,e.z,i.x,i.y,w,x,E,v,p,n,a,l),t.length-1}function Rf(t){t.collisionPadding&&(t.top-=t.collisionPadding[1],t.bottom+=t.collisionPadding[3]);const e=t.bottom-t.top;return e>0?Math.max(10,e):null}function Xx(t,e,i,n){const a=t.compareText;if(e in a){const l=a[e];for(let h=l.length-1;h>=0;h--)if(n.dist(l[h])<i)return!0}else a[e]=[];return a[e].push(n),!1}function xg(t,e){const i=t.fovAboveCenter,n=t.elevation?t.elevation.getMinElevationBelowMSL()*e:0,a=(t._camera.position[2]*t.worldSize-n)/Math.cos(t._pitch),l=Math.sin(i)*a/Math.sin(Math.max(Math.PI/2-t._pitch-i,.01)),h=Math.sin(t._pitch)*l+a;return Math.min(1.01*h,a*(1/t._horizonShift))}function Nu(t,e){if(!e.isReprojectedInTileSpace)return{scale:1<<t.z,x:t.x,y:t.y,x2:t.x+1,y2:t.y+1,projection:e};const i=Math.pow(2,-t.z),n=t.x*i,a=(t.x+1)*i,l=t.y*i,h=(t.y+1)*i,p=$r(n),m=$r(a),g=cr(l),x=cr(h),v=e.project(p,g),w=e.project(m,g),E=e.project(m,x),M=e.project(p,x);let I=Math.min(v.x,w.x,E.x,M.x),z=Math.min(v.y,w.y,E.y,M.y),D=Math.max(v.x,w.x,E.x,M.x),F=Math.max(v.y,w.y,E.y,M.y);const j=i/16;function V(q,J,ee,oe,fe,le){const ge=(ee+fe)/2,_e=(oe+le)/2,me=e.project($r(ge),cr(_e)),Ee=Math.max(0,I-me.x,z-me.y,me.x-D,me.y-F);I=Math.min(I,me.x),D=Math.max(D,me.x),z=Math.min(z,me.y),F=Math.max(F,me.y),Ee>j&&(V(q,me,ee,oe,ge,_e),V(me,J,ge,_e,fe,le))}V(v,w,n,l,a,l),V(w,E,a,l,a,h),V(E,M,a,h,n,h),V(M,v,n,h,n,l),I-=j,z-=j,D+=j,F+=j;const X=1/Math.max(D-I,F-z);return{scale:X,x:I*X,y:z*X,x2:D*X,y2:F*X,projection:e}}function vg(t,{x:e,y:i},n=0){return new Ne(((e-n)*t.scale-t.x)*Ve,(i*t.scale-t.y)*Ve)}const Yx=o.a9.identity(new Float32Array(16));class Co{constructor(e){this.spec=e,this.name=e.name,this.wrap=!1,this.requiresDraping=!1,this.supportsWorldCopies=!1,this.supportsTerrain=!1,this.supportsFog=!1,this.supportsFreeCamera=!1,this.zAxisUnit="meters",this.isReprojectedInTileSpace=!0,this.unsupportedLayers=["custom"],this.center=[0,0],this.range=[3.5,7]}project(e,i){return{x:0,y:0,z:0}}unproject(e,i){return new Zt(0,0)}projectTilePoint(e,i,n){return{x:e,y:i,z:0}}locationPoint(e,i,n=!0){return e._coordinatePoint(e.locationCoordinate(i),n)}pixelsPerMeter(e,i){return Ir(1,e)*i}pixelSpaceConversion(e,i,n){return 1}farthestPixelDistance(e){return xg(e,e.pixelsPerMeter)}pointCoordinate(e,i,n,a){const l=e.horizonLineFromTop(!1),h=new Ne(i,Math.max(l,n));return e.rayIntersectionCoordinate(e.pointRayIntersection(h,a))}pointCoordinate3D(e,i,n){const a=new Ne(i,n);if(e.elevation)return e.elevation.pointCoordinate(a);{const l=this.pointCoordinate(e,a.x,a.y,0);return[l.x,l.y,l.z]}}isPointAboveHorizon(e,i){if(e.elevation)return!this.pointCoordinate3D(e,i.x,i.y);const n=e.horizonLineFromTop();return i.y<n}createInversionMatrix(e,i){return Yx}createTileMatrix(e,i,n){let a,l,h;const p=n.canonical,m=o.a9.identity(new Float64Array(16));if(this.isReprojectedInTileSpace){const g=Nu(p,this);a=1,l=g.x+n.wrap*g.scale,h=g.y,o.a9.scale(m,m,[a/g.scale,a/g.scale,e.pixelsPerMeter/i])}else a=i/e.zoomScale(p.z),l=(p.x+Math.pow(2,p.z)*n.wrap)*a,h=p.y*a;return o.a9.translate(m,m,[l,h,0]),o.a9.scale(m,m,[a/Ve,a/Ve,1]),m}upVector(e,i,n){return[0,0,1]}upVectorScale(e,i,n){return{metersToTile:1}}}class Jx extends Co{constructor(e){super(e),this.range=[4,7],this.center=e.center||[-96,37.5];const[i,n]=this.parallels=e.parallels||[29.5,45.5],a=Math.sin(jt(i));this.n=(a+Math.sin(jt(n)))/2,this.c=1+a*(2*this.n-a),this.r0=Math.sqrt(this.c)/this.n}project(e,i){const{n,c:a,r0:l}
vendor: 18,927 bytes, line 7
7=this,h=jt(e-this.center[0]),p=jt(i),m=Math.sqrt(a-2*n*Math.sin(p))/n;return{x:m*Math.sin(h*n),y:m*Math.cos(h*n)-l,z:0}}unproject(e,i){const{n,c:a,r0:l}=this,h=l+i;let p=Math.atan2(e,Math.abs(h))*Math.sign(h);h*n<0&&(p-=Math.PI*Math.sign(e)*Math.sign(h));const m=jt(this.center[0])*n;p=Cn(p,-Math.PI-m,Math.PI-m);const g=kt(vr(p/n)+this.center[0],-180,180),x=Math.asin(kt((a-(e*e+h*h)*n*n)/(2*n),-1,1)),v=kt(vr(x),-Ni,Ni);return new Zt(g,v)}}const Vu=1.340264,Uu=-.081106,ju=893e-6,Gu=.003796,jd=Math.sqrt(3)/2;class Kx extends Co{project(e,i){i=i/180*Math.PI,e=e/180*Math.PI;const n=Math.asin(jd*Math.sin(i)),a=n*n,l=a*a*a;return{x:.5*(e*Math.cos(n)/(jd*(Vu+3*Uu*a+l*(7*ju+9*Gu*a)))/Math.PI+.5),y:1-.5*(n*(Vu+Uu*a+l*(ju+Gu*a))/Math.PI+1),z:0}}unproject(e,i){e=(2*e-.5)*Math.PI;let n=i=(2*(1-i)-1)*Math.PI,a=n*n,l=a*a*a;for(let x,v,w,E=0;E<12&&(v=n*(Vu+Uu*a+l*(ju+Gu*a))-i,w=Vu+3*Uu*a+l*(7*ju+9*Gu*a),x=v/w,n=kt(n-x,-Math.PI/3,Math.PI/3),a=n*n,l=a*a*a,!(Math.abs(x)<1e-12));++E);const h=jd*e*(Vu+3*Uu*a+l*(7*ju+9*Gu*a))/Math.cos(n),p=Math.asin(Math.sin(n)/jd),m=kt(180*h/Math.PI,-180,180),g=kt(180*p/Math.PI,-Ni,Ni);return new Zt(m,g)}}class ev extends Co{constructor(e){super(e),this.wrap=!0,this.supportsWorldCopies=!0}project(e,i){return{x:.5+e/360,y:.5-i/360,z:0}}unproject(e,i){const n=360*(e-.5),a=kt(360*(.5-i),-Ni,Ni);return new Zt(n,a)}}const hc=Math.PI/2;function Gd(t){return Math.tan((hc+t)/2)}class tv extends Co{constructor(e){super(e),this.center=e.center||[0,30];const[i,n]=this.parallels=e.parallels||[30,30];let a=jt(i),l=jt(n);this.southernCenter=a+l<0,this.southernCenter&&(a=-a,l=-l);const h=Math.cos(a),p=Gd(a);this.n=a===l?Math.sin(a):Math.log(h/Math.cos(l))/Math.log(Gd(l)/p),this.f=h*Math.pow(Gd(a),this.n)/this.n}project(e,i){i=jt(i),this.southernCenter&&(i=-i),e=jt(e-this.center[0]);const n=1e-6,{n:a,f:l}=this;l>0?i<-hc+n&&(i=-hc+n):i>hc-n&&(i=hc-n);const h=l/Math.pow(Gd(i),a);let p=h*Math.sin(a*e),m=l-h*Math.cos(a*e);return p=.5*(p/Math.PI+.5),m=.5*(m/Math.PI+.5),{x:p,y:this.southernCenter?m:1-m,z:0}}unproject(e,i){e=(2*e-.5)*Math.PI,this.southernCenter&&(i=1-i),i=(2*(1-i)-.5)*Math.PI;const{n,f:a}=this,l=a-i,h=Math.sign(l),p=Math.sign(n)*Math.sqrt(e*e+l*l);let m=Math.atan2(e,Math.abs(l))*h;l*n<0&&(m-=Math.PI*Math.sign(e)*h);const g=kt(vr(m/n)+this.center[0],-180,180),x=kt(vr(2*Math.atan(Math.pow(a/p,1/n))-hc),-Ni,Ni);return new Zt(g,this.southernCenter?-x:x)}}class bg extends Co{constructor(e){super(e),this.wrap=!0,this.supportsWorldCopies=!0,this.supportsTerrain=!0,this.supportsFog=!0,this.supportsFreeCamera=!0,this.isReprojectedInTileSpace=!1,this.unsupportedLayers=[],this.range=null}project(e,i){return{x:bo(e),y:Rs(i),z:0}}unproject(e,i){const n=$r(e),a=cr(i);return new Zt(n,a)}}const wg=jt(Ni);class iv extends Co{project(e,i){const n=(i=jt(i))*i,a=n*n;return{x:.5*((e=jt(e))*(.8707-.131979*n+a*(a*(.003971*n-.001529*a)-.013791))/Math.PI+.5),y:1-.5*(i*(1.007226+n*(.015085+a*(.028874*n-.044475-.005916*a)))/Math.PI+1),z:0}}unproject(e,i){e=(2*e-.5)*Math.PI;let n=i=(2*(1-i)-1)*Math.PI,a=25,l=0,h=n*n;do{h=n*n;const g=h*h;l=(n*(1.007226+h*(.015085+g*(.028874*h-.044475-.005916*g)))-i)/(1.007226+h*(.045255+g*(.259866*h-.311325-.005916*11*g))),n=kt(n-l,-wg,wg)}while(Math.abs(l)>1e-6&&--a>0);h=n*n;const p=kt(vr(e/(.8707+h*(h*(h*h*h*(.003971-.001529*h)-.013791)-.131979))),-180,180),m=vr(n);return new Zt(p,m)}}const Tg=jt(Ni);class rv extends Co{project(e,i){i=jt(i),e=jt(e);const n=Math.cos(i),a=2/Math.PI,l=Math.acos(n*Math.cos(e/2)),h=Math.sin(l)/l,p=.5*(e*a+2*n*Math.sin(e/2)/h)||0,m=.5*(i+Math.sin(i)/h)||0;return{x:.5*(p/Math.PI+.5),y:1-.5*(m/Math.PI+1),z:0}}unproject(e,i){let n=e=(2*e-.5)*Math.PI,a=i=(2*(1-i)-1)*Math.PI,l=25;const h=1e-6;let p=0,m=0;do{const g=Math.cos(a),x=Math.sin(a),v=2*x*g,w=x*x,E=g*g,M=Math.cos(n/2),I=Math.sin(n/2),z=2*M*I,D=I*I,F=1-E*M*M,j=F?1/F:0,V=F?Math.acos(g*M)*Math.sqrt(1/F):0,X=.5*(2*V*g*I+2*n/Math.PI)-e,q=.5*(V*x+a)-i,J=.5*j*(E*D+V*g*M*w)+1/Math.PI,ee=j*(z*v/4-V*x*I),oe=.125*j*(v*I-V*x*E*z),fe=.5*j*(w*M+V*D*g)+.5,le=ee*oe-fe*J;p=(q*ee-X*fe)/le,m=(X*oe-q*J)/le,n=kt(n-p,-Math.PI,Math.PI),a=kt(a-m,-Tg,Tg)}while((Math.abs(p)>h||Math.abs(m)>h)&&--l>0);return new Zt(vr(n),vr(a))}}class Eg extends Co{constructor(e){super(e),this.center=e.center||[0,0],this.parallels=e.parallels||[0,0],this.cosPhi=Math.max(.01,Math.cos(jt(this.parallels[0]))),this.scale=1/(2*Math.max(Math.PI*this.cosPhi,1/this.cosPhi)),this.wrap=!0,this.supportsWorldCopies=!0}project(e,i){const{scale:n,cosPhi:a}=this;return{x:jt(e)*a*n+.5,y:-Math.sin(jt(i))/a*n+.5,z:0}}unproject(e,i){const{scale:n,cosPhi:a}=this,l=-(i-.5)/n,h=kt(vr((e-.5)/n)/a,-180,180),p=Math.asin(kt(l*a,-1,1)),m=kt(vr(p),-Ni,Ni);return new Zt(h,m)}}class nv extends bg{constructor(e){super(e),this.requiresDraping=!0,this.supportsWorldCopies=!1,this.supportsFog=!0,this.zAxisUnit="pixels",this.unsupportedLayers=["debug"],this.range=[3,5]}projectTilePoint(e,i,n){const a=Au(e,i,n),l=bd(as(n));return o.Q.transformMat4(a,a,l),{x:a[0],y:a[1],z:a[2]}}locationPoint(e,i){const n=Ra(i.lat,i.lng),a=o.Q.normalize([],n),l=e.elevation?e.elevation.getAtPointOrZero(e.locationCoordinate(i),e._centerAltitude):e._centerAltitude,h=Ir(1,0)*Ve*l;o.Q.scaleAndAdd(n,n,a,h);const p=o.a9.identity(new Float64Array(16));return o.a9.multiply(p,e.pixelMatrix,e.globeMatrix),o.Q.transformMat4(n,n,p),new Ne(n[0],n[1])}pixelsPerMeter(e,i){return Ir(1,0)*i}pixelSpaceConversion(e,i,n){const a=Ir(1,e)*i,l=Ct(Ir(1,45)*i,a,n);return this.pixelsPerMeter(e,i)/l}createTileMatrix(e,i,n){const a=cf(as(n.canonical));return o.a9.multiply(new Float64Array(16),e.globeMatrix,a)}createInversionMatrix(e,i){const{center:n}=e,a=bd(as(i));return o.a9.rotateY(a,a,jt(n.lng)),o.a9.rotateX(a,a,jt(n.lat)),o.a9.scale(a,a,[e._pixelsPerMercatorPixel,e._pixelsPerMercatorPixel,1]),Float32Array.from(a)}pointCoordinate(e,i,n,a){return Um(e,i,n,!0)||new mr(0,0)}pointCoordinate3D(e,i,n){const a=this.pointCoordinate(e,i,n,0);return[a.x,a.y,a.z]}isPointAboveHorizon(e,i){return!Um(e,i.x,i.y,!1)}farthestPixelDistance(e){const i=function(a,l){const h=a.cameraToCenterDistance,p=a._centerAltitude*l,m=a._camera,g=a._camera.forward(),x=o.Q.add([],o.Q.scale([],g,-h),[0,0,p]),v=a.worldSize/(2*Math.PI),w=[0,0,-v],E=a.width/a.height,M=Math.tan(a.fovAboveCenter),I=o.Q.scale([],m.up(),M),z=o.Q.scale([],m.right(),M*E),D=o.Q.normalize([],o.Q.add([],o.Q.add([],g,I),z)),F=[];let j;if(new nf(x,D).closestPointOnSphere(w,v,F)){const V=o.Q.add([],F,w),X=o.Q.sub([],V,x);j=Math.cos(a.fovAboveCenter)*o.Q.length(X)}else{const V=o.Q.sub([],x,w),X=o.Q.sub([],w,x);o.Q.normalize(X,X);const q=o.Q.length(V)-v;j=Math.sqrt(q*(q+2*v));const J=Math.acos(j/(v+q))-Math.acos(o.Q.dot(g,X));j*=Math.cos(J)}return 1.01*j}(e,this.pixelsPerMeter(e.center.lat,e.worldSize)),n=To(e.zoom);if(n>0){const a=xg(e,Ir(1,e.center.lat)*e.worldSize),l=e.worldSize/(2*Math.PI),h=Math.max(e.width,e.height)/e.worldSize*Math.PI;return Ct(i,a+l*(1-Math.cos(h)),Math.pow(n,10))}return i}upVector(e,i,n){return Au(i,n,e,1)}upVectorScale(e){return{metersToTile:yd(vd(as(e)))}}}function Sg(t){const e=t.parallels,i=!!e&&Math.abs(e[0]+e[1])<.01;switch(t.name){case"mercator":return new bg(t);case"equirectangular":return new ev(t);case"naturalEarth":return new iv(t);case"equalEarth":return new Kx(t);case"winkelTripel":return new rv(t);case"albers":return i?new Eg(t):new Jx(t);case"lambertConformalConic":return i?new Eg(t):new tv(t);case"globe":return new nv(t)}throw new Error(`Invalid projection name: ${t.name}`)}const sv=Id.types,ov=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function qd(t,e,i,n,a,l,h,p,m,g,x,v,w){const E=p?Math.min(Io,Math.round(p[0])):0,M=p?Math.min(Io,Math.round(p[1])):0;t.emplaceBack(e,i,Math.round(32*n),Math.round(32*a),l,h,(E<<1)+(m?1:0),M,16*g,16*x,256*v,256*w)}function Zd(t,e,i){t.emplaceBack(e,i)}function $d(t,e,i,n,a,l,h){t.emplaceBack(e,i,n,a,l,h)}function Wd(t,e,i,n,a){t.emplaceBack(e,i,n,a),t.emplaceBack(e,i,n,a),t.emplaceBack(e,i,n,a),t.emplaceBack(e,i,n,a)}function av(t){for(const e of t.sections)if(T(e.text))return!0;return!1}class Lf{constructor(e){this.layoutVertexArray=new bn,this.indexArray=new Xi,this.programConfigurations=e,this.segments=new Fi,this.dynamicLayoutVertexArray=new Hi,this.opacityVertexArray=new os,this.placedSymbolArray=new um,this.iconTransitioningVertexArray=new Zr,this.globeExtVertexArray=new wn,this.zOffsetVertexArray=new bu}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0&&this.iconTransitioningVertexArray.length===0}upload(e,i,n,a,l){this.isEmpty()||(n&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,mx.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,i),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,gx.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,ov,!0),this.iconTransitioningVertexArray.length>0&&(this.iconTransitioningVertexBuffer=e.createVertexBuffer(this.iconTransitioningVertexArray,xx.members,!0)),this.globeExtVertexArray.length>0&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,_x.members,!0)),!this.zOffsetVertexBuffer&&(this.zOffsetVertexArray.length>0||l)&&(this.zOffsetVertexBuffer=e.createVertexBuffer(this.zOffsetVertexArray,yx.members,!0)),this.opacityVertexBuffer.itemSize=1),(n||a)&&this.programConfigurations.upload(e))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy(),this.iconTransitioningVertexBuffer&&this.iconTransitioningVertexBuffer.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy(),this.zOffsetVertexBuffer&&this.zOffsetVertexBuffer.destroy())}}Qe(Lf,"SymbolBuffers");class kf{constructor(e,i,n){this.layoutVertexArray=new e,this.layoutAttributes=i,this.indexArray=new n,this.segments=new Fi,this.collisionVertexArray=new On,this.collisionVertexArrayExt=new Hi}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,vx.members,!0),this.collisionVertexBufferExt=e.createVertexBuffer(this.collisionVertexArrayExt,bx.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy(),this.collisionVertexBufferExt.destroy())}}Qe(kf,"CollisionBuffers");class Qd{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(h=>h.fqid),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.fullyClipped=!1,this.hasAnyIconTextFit=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=o.a9.identity([]),this.placementViewportMatrix=o.a9.identity([]);const i=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Ef(this.zoom,i["text-size"]),this.iconSizeData=Ef(this.zoom,i["icon-size"]);const n=this.layers[0].layout,a=n.get("symbol-sort-key"),l=n.get("symbol-z-order");this.canOverlap=n.get("text-allow-overlap")||n.get("icon-allow-overlap")||n.get("text-ignore-placement")||n.get("icon-ignore-placement"),this.sortFeaturesByKey=l!=="viewport-y"&&a.constantOr(1)!==void 0,this.sortFeaturesByY=(l==="viewport-y"||l==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,this.writingModes=n.get("text-writing-mode").map(h=>hn[h]),this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id),this.sourceID=e.sourceID,this.projection=e.projection,this.hasAnyZOffset=!1,this.zOffsetSortDirty=!1,this.zOffsetBuffersNeedUpload=n.get("symbol-z-elevate")}createArrays(){this.text=new Lf(new xo(this.layers,this.zoom,e=>/^text/.test(e))),this.icon=new Lf(new xo(this.layers,this.zoom,e=>/^icon/.test(e))),this.glyphOffsetArray=new pm,this.lineVertexArray=new fm,this.symbolInstances=new dm}calculateGlyphDependencies(e,i,n,a,l){for(let h=0;h<e.length;h++){const p=e.codePointAt(h);if(p===void 0)break;if(i[p]=!0,a&&l&&p<=65535){const m=ku[e.charAt(h)];m&&(i[m.charCodeAt(0)]=!0)}}}populate(e,i,n,a){const l=this.layers[0],h=l.layout,p=this.projection.name==="globe",m=h.get("text-font"),g=h.get("text-field"),x=h.get("icon-image"),v=(g.value.kind!=="constant"||g.value.value instanceof sr&&!g.value.value.isEmpty()||g.value.value.toString().length>0)&&(m.value.kind!=="constant"||m.value.value.length>0),w=x.value.kind!=="constant"||!!x.value.value||Object.keys(x.parameters).length>0,E=h.get("symbol-sort-key");if(this.features=[],!v&&!w)return;const M=i.iconDependencies,I=i.glyphDependencies,z=i.availableImages,D=new B(this.zoom);for(const{feature:F,id:j,index:V,sourceLayerIndex:X}of e){const q=l._featureFilter.needGeometry,J=wo(F,q);if(!l._featureFilter.filter(D,J,n))continue;if(q||(J.geometry=Ls(F,n,a)),p&&F.type!==1&&n.z<=5){const le=J.geometry,ge=.98078528056,_e=(me,Ee)=>{const we=Au(me.x,me.y,n,1),Ce=Au(Ee.x,Ee.y,n,1);return o.Q.dot(we,Ce)<ge};for(let me=0;me<le.length;me++)le[me]=Hy(le[me],_e)}let ee,oe;if(v){const le=l.getValueAndResolveTokens("text-field",J,n,z),ge=sr.factory(le);av(ge)&&(this.hasRTLText=!0),(!this.hasRTLText||$()==="unavailable"||this.hasRTLText&&Q.isParsed())&&(ee=Ex(ge,l,J))}if(w){const le=l.getValueAndResolveTokens("icon-image",J,n,z);oe=le instanceof Br?le:Br.fromString(le)}if(!ee&&!oe)continue;const fe=this.sortFeaturesByKey?E.evaluate(J,{},n):void 0;if(this.features.push({id:j,text:ee,icon:oe,index:V,sourceLayerIndex:X,geometry:J.geometry,properties:F.properties,type:sv[F.type],sortKey:fe}),oe&&(M[oe.namePrimary]=!0,oe.nameSecondary&&(M[oe.nameSecondary]=!0)),ee){const le=m.evaluate(J,{},n).join(","),ge=h.get("text-rotation-alignment")==="map"&&h.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(hn.vertical)>=0;for(const _e of ee.sections)if(_e.image)M[_e.image.namePrimary]=!0;else{const me=s(ee.toString()),Ee=_e.fontStack||le,we=I[Ee]=I[Ee]||{};this.calculateGlyphDependencies(_e.text,we,ge,this.allowVerticalPlacement,me)}}}h.get("symbol-placement")==="line"&&(this.features=function(F){const j={},V={},X=[];let q=0;function J(le){X.push(F[le]),q++}function ee(le,ge,_e){const me=V[le];return delete V[le],V[ge]=me,X[me].geometry[0].pop(),X[me].geometry[0]=X[me].geometry[0].concat(_e[0]),me}function oe(le,ge,_e){const me=j[ge];return delete j[ge],j[le]=me,X[me].geometry[0].shift(),X[me].geometry[0]=_e[0].concat(X[me].geometry[0]),me}function fe(le,ge,_e){const me=_e?ge[0][ge[0].length-1]:ge[0][0];return`${le}:${me.x}:${me.y}`}for(let le=0;le<F.length;le++){const ge=F[le],_e=ge.geometry,me=ge.text?ge.text.toString():null;if(!me){J(le);continue}const Ee=fe(me,_e),we=fe(me,_e,!0);if(Ee in V&&we in j&&V[Ee]!==j[we]){const Ce=oe(Ee,we,_e),Ae=ee(Ee,we,X[Ce].geometry);delete j[Ee],delete V[we],V[fe(me,X[Ae].geometry,!0)]=Ae,X[Ce].geometry=null}else Ee in V?ee(Ee,we,_e):we in j?oe(Ee,we,_e):(J(le),j[Ee]=q-1,V[we]=q-1)}return X.filter(le=>le.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((F,j)=>F.sortKey-j.sortKey)}update(e,i,n,a,l){const h=Object.keys(e).length!==0;if(h&&!this.stateDependentLayers.length)return;const p=h?this.stateDependentLayers:this.layers;this.text.programConfigurations.updatePaintArrays(e,i,p,n,a,l),this.icon.programConfigurations.updatePaintArrays(e,i,p,n,a,l)}updateZOffset(){const e=(l,h,p)=>{n+=h,n>l.length&&l.resize(n);for(let m=-h;m<0;m++)l.emplace(m+n,p)},i=(l,h,p)=>{a+=h,a>l.length&&l.resize(a);for(let m=-h;m<0;m++)l.emplace(m+a,p)};if(!this.zOffsetBuffersNeedUpload)return;this.zOffsetBuffersNeedUpload=!1;let n=0,a=0;for(let l=0;l<this.symbolInstances.length;l++){const h=this.symbolInstances.get(l),{numHorizontalGlyphVertices:p,numVerticalGlyphVertices:m,numIconVertices:g}=h,x=h.zOffset,v=g>0;if((p>0||m>0)&&(e(this.text.zOffsetVertexArray,p,x),e(this.text.zOffsetVertexArray,m,x)),v){const{placedIconSymbolIndex:w,verticalPlacedIconSymbolIndex:E}=h;w>=0&&i(this.icon.zOffsetVertexArray,g,x),E>=0&&i(this.icon.zOffsetVertexArray,h.numVerticalIconVertices,x)}}this.text.zOffsetVertexBuffer&&this.text.zOffsetVertexBuffer.updateData(this.text.zOffsetVertexArray),this.icon.zOffsetVertexBuffer&&this.icon.zOffsetVertexBuffer.updateData(this.icon.zOffsetVertexArray)}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(e){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload),this.icon.upload(e,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}getProjection(){return this.projectionInstance||(this.projectionInstance=Sg(this.projection)),this.projectionInstance}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(e,i){const n=this.lineVertexArray.length;if(e.segment!==void 0)for(const{x:a,y:l}of i)this.lineVertexArray.emplaceBack(a,l);return{lineStartIndex:n,lineLength:this.lineVertexArray.length-n}}addSymbols(e,i,n,a,l,h,p,m,g,x,v,w,E,M,I,z){const D=e.indexArray,F=e.layoutVertexArray,j=e.globeExtVertexArray,V=e.segments.prepareSegment(4*i.length,F,D,this.canOverlap?h.sortKey:void 0),X=this.glyphOffsetArray.length,q=V.vertexLength,J=this.allowVerticalPlacement&&p===hn.vertical?Math.PI/2:0,ee=h.text&&h.text.sections;for(let fe=0;fe<i.length;fe++){const{tl:le,tr:ge,bl:_e,br:me,texPrimary:Ee,texSecondary:we,pixelOffsetTL:Ce,pixelOffsetBR:Ae,minFontScaleX:ye,minFontScaleY:Ye,glyphOffset:$e,isSDF:ze,sectionIndex:ct}=i[fe],it=V.vertexLength,Je=$e[1];if(qd(F,g.x,g.y,le.x,Je+le.y,Ee.x,Ee.y,n,ze,Ce.x,Ce.y,ye,Ye),qd(F,g.x,g.y,ge.x,Je+ge.y,Ee.x+Ee.w,Ee.y,n,ze,Ae.x,Ce.y,ye,Ye),qd(F,g.x,g.y,_e.x,Je+_e.y,Ee.x,Ee.y+Ee.h,n,ze,Ce.x,Ae.y,ye,Ye),qd(F,g.x,g.y,me.x,Je+me.y,Ee.x+Ee.w,Ee.y+Ee.h,n,ze,Ae.x,Ae.y,ye,Ye),m){const{x:De,y:ot,z:bt}=m.anchor,[pt,Mt,wt]=m.up;$d(j,De,ot,bt,pt,Mt,wt),$d(j,De,ot,bt,pt,Mt,wt),$d(j,De,ot,bt,pt,Mt,wt),$d(j,De,ot,bt,pt,Mt,wt),Wd(e.dynamicLayoutVertexArray,De,ot,bt,J)}else Wd(e.dynamicLayoutVertexArray,g.x,g.y,g.z,J);if(z){const De=we||Ee;Zd(e.iconTransitioningVertexArray,De.x,De.y),Zd(e.iconTransitioningVertexArray,De.x+De.w,De.y),Zd(e.iconTransitioningVertexArray,De.x,De.y+De.h),Zd(e.iconTransitioningVertexArray,De.x+De.w,De.y+De.h)}
vendor: 7,070 bytes, line 7
7D.emplaceBack(it,it+1,it+2),D.emplaceBack(it+1,it+2,it+3),V.vertexLength+=4,V.primitiveLength+=2,this.glyphOffsetArray.emplaceBack($e[0]),fe!==i.length-1&&ct===i[fe+1].sectionIndex||e.programConfigurations.populatePaintArrays(F.length,h,h.index,{},E,M,I,ee&&ee[ct])}const oe=m?m.anchor:g;e.placedSymbolArray.emplaceBack(oe.x,oe.y,oe.z,g.x,g.y,X,this.glyphOffsetArray.length-X,q,x,v,g.segment,n?n[0]:0,n?n[1]:0,a[0],a[1],p,0,!1,0,w,0)}_commitLayoutVertex(e,i,n,a,l,h,p){e.emplaceBack(i,n,a,l,h,Math.round(p.x),Math.round(p.y))}_addCollisionDebugVertices(e,i,n,a,l,h,p){const m=n.segments.prepareSegment(4,n.layoutVertexArray,n.indexArray),g=m.vertexLength,x=p.tileAnchorX,v=p.tileAnchorY;for(let E=0;E<4;E++)n.collisionVertexArray.emplaceBack(0,0,0,0);this._commitDebugCollisionVertexUpdate(n.collisionVertexArrayExt,i,e.padding,p.zOffset),this._commitLayoutVertex(n.layoutVertexArray,a,l,h,x,v,new Ne(e.x1,e.y1)),this._commitLayoutVertex(n.layoutVertexArray,a,l,h,x,v,new Ne(e.x2,e.y1)),this._commitLayoutVertex(n.layoutVertexArray,a,l,h,x,v,new Ne(e.x2,e.y2)),this._commitLayoutVertex(n.layoutVertexArray,a,l,h,x,v,new Ne(e.x1,e.y2)),m.vertexLength+=4;const w=n.indexArray;w.emplaceBack(g,g+1),w.emplaceBack(g+1,g+2),w.emplaceBack(g+2,g+3),w.emplaceBack(g+3,g),m.primitiveLength+=4}_addTextDebugCollisionBoxes(e,i,n,a,l,h){for(let p=a;p<l;p++){const m=n.get(p),g=this.getSymbolInstanceTextSize(e,h,i,p);this._addCollisionDebugVertices(m,g,this.textCollisionBox,m.projectedAnchorX,m.projectedAnchorY,m.projectedAnchorZ,h)}}_addIconDebugCollisionBoxes(e,i,n,a,l,h){for(let p=a;p<l;p++){const m=n.get(p),g=this.getSymbolInstanceIconSize(e,i,h.placedIconSymbolIndex);this._addCollisionDebugVertices(m,g,this.iconCollisionBox,m.projectedAnchorX,m.projectedAnchorY,m.projectedAnchorZ,h)}}generateCollisionDebugBuffers(e,i){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new kf(_o,Z_.members,Zr),this.iconCollisionBox=new kf(_o,Z_.members,Zr);const n=nc(this.iconSizeData,e),a=nc(this.textSizeData,e);for(let l=0;l<this.symbolInstances.length;l++){const h=this.symbolInstances.get(l);this._addTextDebugCollisionBoxes(a,e,i,h.textBoxStartIndex,h.textBoxEndIndex,h),this._addTextDebugCollisionBoxes(a,e,i,h.verticalTextBoxStartIndex,h.verticalTextBoxEndIndex,h),this._addIconDebugCollisionBoxes(n,e,i,h.iconBoxStartIndex,h.iconBoxEndIndex,h),this._addIconDebugCollisionBoxes(n,e,i,h.verticalIconBoxStartIndex,h.verticalIconBoxEndIndex,h)}}getSymbolInstanceTextSize(e,i,n,a){const l=this.text.placedSymbolArray.get(i.rightJustifiedTextSymbolIndex>=0?i.rightJustifiedTextSymbolIndex:i.centerJustifiedTextSymbolIndex>=0?i.centerJustifiedTextSymbolIndex:i.leftJustifiedTextSymbolIndex>=0?i.leftJustifiedTextSymbolIndex:i.verticalPlacedTextSymbolIndex>=0?i.verticalPlacedTextSymbolIndex:a),h=Ld(this.textSizeData,e,l)/ur;return this.tilePixelRatio*h}getSymbolInstanceIconSize(e,i,n){const a=this.icon.placedSymbolArray.get(n),l=Ld(this.iconSizeData,e,a);return this.tilePixelRatio*l}_commitDebugCollisionVertexUpdate(e,i,n,a){e.emplaceBack(i,-n,-n,a),e.emplaceBack(i,n,-n,a),e.emplaceBack(i,n,n,a),e.emplaceBack(i,-n,n,a)}_updateTextDebugCollisionBoxes(e,i,n,a,l,h){for(let p=a;p<l;p++){const m=n.get(p),g=this.getSymbolInstanceTextSize(e,h,i,p);this._commitDebugCollisionVertexUpdate(this.textCollisionBox.collisionVertexArrayExt,g,m.padding,h.zOffset)}}_updateIconDebugCollisionBoxes(e,i,n,a,l,h){for(let p=a;p<l;p++){const m=n.get(p),g=this.getSymbolInstanceIconSize(e,i,h.placedIconSymbolIndex);this._commitDebugCollisionVertexUpdate(this.iconCollisionBox.collisionVertexArrayExt,g,m.padding,h.zOffset)}}updateCollisionDebugBuffers(e,i){if(!this.hasDebugData())return;this.hasTextCollisionBoxData()&&this.textCollisionBox.collisionVertexArrayExt.clear(),this.hasIconCollisionBoxData()&&this.iconCollisionBox.collisionVertexArrayExt.clear();const n=nc(this.iconSizeData,e),a=nc(this.textSizeData,e);for(let l=0;l<this.symbolInstances.length;l++){const h=this.symbolInstances.get(l);this._updateTextDebugCollisionBoxes(a,e,i,h.textBoxStartIndex,h.textBoxEndIndex,h),this._updateTextDebugCollisionBoxes(a,e,i,h.verticalTextBoxStartIndex,h.verticalTextBoxEndIndex,h),this._updateIconDebugCollisionBoxes(n,e,i,h.iconBoxStartIndex,h.iconBoxEndIndex,h),this._updateIconDebugCollisionBoxes(n,e,i,h.verticalIconBoxStartIndex,h.verticalIconBoxEndIndex,h)}this.hasTextCollisionBoxData()&&this.textCollisionBox.collisionVertexBufferExt&&this.textCollisionBox.collisionVertexBufferExt.updateData(this.textCollisionBox.collisionVertexArrayExt),this.hasIconCollisionBoxData()&&this.iconCollisionBox.collisionVertexBufferExt&&this.iconCollisionBox.collisionVertexBufferExt.updateData(this.iconCollisionBox.collisionVertexArrayExt)}_deserializeCollisionBoxesForSymbol(e,i,n,a,l,h,p,m,g){const x={};if(i<n){const{x1:v,y1:w,x2:E,y2:M,padding:I,projectedAnchorX:z,projectedAnchorY:D,projectedAnchorZ:F,tileAnchorX:j,tileAnchorY:V,featureIndex:X}=e.get(i);x.textBox={x1:v,y1:w,x2:E,y2:M,padding:I,projectedAnchorX:z,projectedAnchorY:D,projectedAnchorZ:F,tileAnchorX:j,tileAnchorY:V},x.textFeatureIndex=X}if(a<l){const{x1:v,y1:w,x2:E,y2:M,padding:I,projectedAnchorX:z,projectedAnchorY:D,projectedAnchorZ:F,tileAnchorX:j,tileAnchorY:V,featureIndex:X}=e.get(a);x.verticalTextBox={x1:v,y1:w,x2:E,y2:M,padding:I,projectedAnchorX:z,projectedAnchorY:D,projectedAnchorZ:F,tileAnchorX:j,tileAnchorY:V},x.verticalTextFeatureIndex=X}if(h<p){const{x1:v,y1:w,x2:E,y2:M,padding:I,projectedAnchorX:z,projectedAnchorY:D,projectedAnchorZ:F,tileAnchorX:j,tileAnchorY:V,featureIndex:X}=e.get(h);x.iconBox={x1:v,y1:w,x2:E,y2:M,padding:I,projectedAnchorX:z,projectedAnchorY:D,projectedAnchorZ:F,tileAnchorX:j,tileAnchorY:V},x.iconFeatureIndex=X}if(m<g){const{x1:v,y1:w,x2:E,y2:M,padding:I,projectedAnchorX:z,projectedAnchorY:D,projectedAnchorZ:F,tileAnchorX:j,tileAnchorY:V,featureIndex:X}=e.get(m);x.verticalIconBox={x1:v,y1:w,x2:E,y2:M,padding:I,projectedAnchorX:z,projectedAnchorY:D,projectedAnchorZ:F,tileAnchorX:j,tileAnchorY:V},x.verticalIconFeatureIndex=X}return x}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let i=0;i<this.symbolInstances.length;i++){const n=this.symbolInstances.get(i);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,n.textBoxStartIndex,n.textBoxEndIndex,n.verticalTextBoxStartIndex,n.verticalTextBoxEndIndex,n.iconBoxStartIndex,n.iconBoxEndIndex,n.verticalIconBoxStartIndex,n.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}hasIconTextFit(){return this.hasAnyIconTextFit}addIndicesForPlacedSymbol(e,i){const n=e.placedSymbolArray.get(i),a=n.vertexStartIndex+4*n.numGlyphs;for(let l=n.vertexStartIndex;l<a;l+=4)e.indexArray.emplaceBack(l,l+1,l+2),e.indexArray.emplaceBack(l+1,l+2,l+3)}
vendor: 7,025 bytes, line 7
7getSortedSymbolIndexes(e){if(this.sortedAngle===e&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const i=Math.sin(e),n=Math.cos(e),a=[],l=[],h=[];for(let p=0;p<this.symbolInstances.length;++p){h.push(p);const m=this.symbolInstances.get(p);a.push(0|Math.round(i*m.tileAnchorX+n*m.tileAnchorY)),l.push(m.featureIndex)}return h.sort((p,m)=>a[p]-a[m]||l[m]-l[p]),h}getSortedIndexesByZOffset(){if(!this.zOffsetSortDirty)return this.symbolInstanceIndexesSortedZOffset;if(!this.symbolInstanceIndexesSortedZOffset){this.symbolInstanceIndexesSortedZOffset=[];for(let e=0;e<this.symbolInstances.length;++e)this.symbolInstanceIndexesSortedZOffset.push(e)}return this.zOffsetSortDirty=!1,this.symbolInstanceIndexesSortedZOffset.sort((e,i)=>this.symbolInstances.get(i).zOffset-this.symbolInstances.get(e).zOffset)}addToSortKeyRanges(e,i){const n=this.sortKeyRanges[this.sortKeyRanges.length-1];n&&n.sortKey===i?n.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:i,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(this.sortFeaturesByY&&this.sortedAngle!==e&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const i of this.symbolInstanceIndexes){const n=this.symbolInstances.get(i);this.featureSortOrder.push(n.featureIndex);const{rightJustifiedTextSymbolIndex:a,centerJustifiedTextSymbolIndex:l,leftJustifiedTextSymbolIndex:h,verticalPlacedTextSymbolIndex:p,placedIconSymbolIndex:m,verticalPlacedIconSymbolIndex:g}=n;a>=0&&this.addIndicesForPlacedSymbol(this.text,a),l>=0&&l!==a&&this.addIndicesForPlacedSymbol(this.text,l),h>=0&&h!==l&&h!==a&&this.addIndicesForPlacedSymbol(this.text,h),p>=0&&this.addIndicesForPlacedSymbol(this.text,p),m>=0&&this.addIndicesForPlacedSymbol(this.icon,m),g>=0&&this.addIndicesForPlacedSymbol(this.icon,g)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}Qe(Qd,"SymbolBucket",{omit:["layers","collisionBoxArray","features","compareText"]}),Qd.addDynamicAttributes=Wd;const lv=new se({"symbol-placement":new te(W.layout_symbol["symbol-placement"]),"symbol-spacing":new te(W.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new te(W.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new ae(W.layout_symbol["symbol-sort-key"]),"symbol-z-order":new te(W.layout_symbol["symbol-z-order"]),"symbol-z-elevate":new te(W.layout_symbol["symbol-z-elevate"]),"icon-allow-overlap":new te(W.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new te(W.layout_symbol["icon-ignore-placement"]),"icon-optional":new te(W.layout_symbol["icon-optional"]),"icon-rotation-alignment":new te(W.layout_symbol["icon-rotation-alignment"]),"icon-size":new ae(W.layout_symbol["icon-size"]),"icon-text-fit":new ae(W.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new ae(W.layout_symbol["icon-text-fit-padding"]),"icon-image":new ae(W.layout_symbol["icon-image"]),"icon-rotate":new ae(W.layout_symbol["icon-rotate"]),"icon-padding":new te(W.layout_symbol["icon-padding"]),"icon-keep-upright":new te(W.layout_symbol["icon-keep-upright"]),"icon-offset":new ae(W.layout_symbol["icon-offset"]),"icon-anchor":new ae(W.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new te(W.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new te(W.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new te(W.layout_symbol["text-rotation-alignment"]),"text-field":new ae(W.layout_symbol["text-field"]),"text-font":new ae(W.layout_symbol["text-font"]),"text-size":new ae(W.layout_symbol["text-size"]),"text-max-width":new ae(W.layout_symbol["text-max-width"]),"text-line-height":new ae(W.layout_symbol["text-line-height"]),"text-letter-spacing":new ae(W.layout_symbol["text-letter-spacing"]),"text-justify":new ae(W.layout_symbol["text-justify"]),"text-radial-offset":new ae(W.layout_symbol["text-radial-offset"]),"text-variable-anchor":new te(W.layout_symbol["text-variable-anchor"]),"text-anchor":new ae(W.layout_symbol["text-anchor"]),"text-max-angle":new te(W.layout_symbol["text-max-angle"]),"text-writing-mode":new te(W.layout_symbol["text-writing-mode"]),"text-rotate":new ae(W.layout_symbol["text-rotate"]),"text-padding":new te(W.layout_symbol["text-padding"]),"text-keep-upright":new te(W.layout_symbol["text-keep-upright"]),"text-transform":new ae(W.layout_symbol["text-transform"]),"text-offset":new ae(W.layout_symbol["text-offset"]),"text-allow-overlap":new te(W.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new te(W.layout_symbol["text-ignore-placement"]),"text-optional":new te(W.layout_symbol["text-optional"]),visibility:new te(W.layout_symbol.visibility)});var Of={paint:new se({"icon-opacity":new ae(W.paint_symbol["icon-opacity"]),"icon-emissive-strength":new ae(W.paint_symbol["icon-emissive-strength"]),"text-emissive-strength":new ae(W.paint_symbol["text-emissive-strength"]),"icon-color":new ae(W.paint_symbol["icon-color"]),"icon-halo-color":new ae(W.paint_symbol["icon-halo-color"]),"icon-halo-width":new ae(W.paint_symbol["icon-halo-width"]),"icon-halo-blur":new ae(W.paint_symbol["icon-halo-blur"]),"icon-translate":new te(W.paint_symbol["icon-translate"]),"icon-translate-anchor":new te(W.paint_symbol["icon-translate-anchor"]),"icon-image-cross-fade":new ae(W.paint_symbol["icon-image-cross-fade"]),"text-opacity":new ae(W.paint_symbol["text-opacity"]),"text-color":new ae(W.paint_symbol["text-color"],{runtimeType:Or,getOverride:t=>t.textColor,hasOverride:t=>!!t.textColor}),"text-halo-color":new ae(W.paint_symbol["text-halo-color"]),"text-halo-width":new ae(W.paint_symbol["text-halo-width"]),"text-halo-blur":new ae(W.paint_symbol["text-halo-blur"]),"text-translate":new te(W.paint_symbol["text-translate"]),"text-translate-anchor":new te(W.paint_symbol["text-translate-anchor"]),"icon-color-saturation":new te(W.paint_symbol["icon-color-saturation"]),"icon-color-contrast":new te(W.paint_symbol["icon-color-contrast"]),"icon-color-brightness-min":new te(W.paint_symbol["icon-color-brightness-min"]),"icon-color-brightness-max":new te(W.paint_symbol["icon-color-brightness-max"])}),layout:lv};class Mg{constructor(e){this.type=e.property.overrides?e.property.overrides.runtimeType:zt,this.defaultValue=e}evaluate(e){if(e.formattedSection){const i=this.defaultValue.property.overrides;if(i&&i.hasOverride(e.formattedSection))return i.getOverride(e.formattedSection)}return e.feature&&e.featureState?this.defaultValue.evaluate(e.feature,e.featureState):this.defaultValue.property.specification.default}eachChild(e){this.defaultValue.isConstant()||e(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}Qe(Mg,"FormatSectionOverride",{omit:["defaultValue"]});class Hd extends It{constructor(e,i,n){super(e,Of,i,n),this._colorAdjustmentMatrix=o.a9.identity([])}
vendor: 12,817 bytes, line 7
7recalculate(e,i){super.recalculate(e,i),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")),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment"));const n=this.layout.get("text-writing-mode");if(n){const a=[];for(const l of n)a.indexOf(l)<0&&a.push(l);this.layout._values["text-writing-mode"]=a}else this.layout._values["text-writing-mode"]=this.layout.get("symbol-placement")==="point"?["horizontal"]:["horizontal","vertical"];this._setPaintOverrides()}getColorAdjustmentMatrix(e,i,n,a){return this._saturation===e&&this._contrast===i&&this._brightnessMin===n&&this._brightnessMax===a||(this._colorAdjustmentMatrix=function(l,h,p,m){l=vh(l),h=rn(h);const g=o.a9.create(),x=l/3,v=1-2*x,w=[v,x,x,0,x,v,x,0,x,x,v,0,0,0,0,1],E=.5-.5*h,M=m-p;return o.a9.multiply(g,[M,0,0,0,0,M,0,0,0,0,M,0,p,p,p,1],[h,0,0,0,0,h,0,0,0,0,h,0,E,E,E,1]),o.a9.multiply(g,g,w),g}(e,i,n,a),this._saturation=e,this._contrast=i,this._brightnessMin=n,this._brightnessMax=a),this._colorAdjustmentMatrix}getValueAndResolveTokens(e,i,n,a){const l=this.layout.get(e).evaluate(i,{},n,a),h=this._unevaluatedLayout._values[e];return h.isDataDriven()||Zl(h.value)||!l?l:function(p,m){return m.replace(/{([^{}]+)}/g,(g,x)=>x in p?String(p[x]):"")}(i.properties,l)}createBucket(e){return new Qd(e)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(const e of Of.paint.overridableProperties){if(!Hd.hasPaintOverride(this.layout,e))continue;const i=this.paint.get(e),n=new Mg(i),a=new ql(n,i.property.specification,this.scope,this.options);let l=null;l=i.value.kind==="constant"||i.value.kind==="source"?new Ta("source",a):new Ea("composite",a,i.value.zoomStops,i.value._interpolationType),this.paint._values[e]=new ce(i.property,l,i.parameters)}}_handleOverridablePaintPropertyUpdate(e,i,n){return!(!this.layout||i.isDataDriven()||n.isDataDriven())&&Hd.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,i){const n=e.get("text-field"),a=Of.paint.properties[i];let l=!1;const h=p=>{for(const m of p)if(a.overrides&&a.overrides.hasOverride(m))return void(l=!0)};if(n.value.kind==="constant"&&n.value.value instanceof sr)h(n.value.value.sections);else if(n.value.kind==="source"){const p=g=>{l||(g instanceof yn&&Gi(g.value)===to?h(g.value.sections):g instanceof aa?h(g.sections):g.eachChild(p))},m=n.value;m._styleExpression&&p(m._styleExpression.expression)}return l}getProgramIds(){const e=this.paint.get("icon-opacity").constantOr(1)!==0,i=this.paint.get("text-opacity").constantOr(1)!==0,n=[];return e&&n.push("symbolIcon"),i&&n.push("symbolSDF"),n}getDefaultProgramParams(e,i){return{config:new Da(this,i),overrideFog:!1}}}const cv=new se({visibility:new te(W.layout_background.visibility)});var uv={paint:new se({"background-color":new te(W.paint_background["background-color"]),"background-pattern":new te(W.paint_background["background-pattern"]),"background-opacity":new te(W.paint_background["background-opacity"]),"background-emissive-strength":new te(W.paint_background["background-emissive-strength"])}),layout:cv};const hv=new se({visibility:new te(W.layout_raster.visibility)});var dv={paint:new se({"raster-opacity":new te(W.paint_raster["raster-opacity"]),"raster-color":new Me(W.paint_raster["raster-color"]),"raster-color-mix":new te(W.paint_raster["raster-color-mix"]),"raster-color-range":new te(W.paint_raster["raster-color-range"]),"raster-hue-rotate":new te(W.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new te(W.paint_raster["raster-brightness-min"]),"raster-brightness-max":new te(W.paint_raster["raster-brightness-max"]),"raster-saturation":new te(W.paint_raster["raster-saturation"]),"raster-contrast":new te(W.paint_raster["raster-contrast"]),"raster-resampling":new te(W.paint_raster["raster-resampling"]),"raster-fade-duration":new te(W.paint_raster["raster-fade-duration"]),"raster-emissive-strength":new te(W.paint_raster["raster-emissive-strength"]),"raster-array-band":new te(W.paint_raster["raster-array-band"]),"raster-elevation":new te(W.paint_raster["raster-elevation"])}),layout:hv},Bf=vt([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class Ff{constructor(e,i,n,a){this.context=e,this.format=n,this.texture=e.gl.createTexture(),this.update(i,a)}update(e,i,n){const{width:a,height:l}=e,{context:h}=this,{gl:p}=h;if(p.bindTexture(p.TEXTURE_2D,this.texture),h.pixelStoreUnpackFlipY.set(!1),h.pixelStoreUnpack.set(1),h.pixelStoreUnpackPremultiplyAlpha.set(this.format===p.RGBA&&(!i||i.premultiply!==!1)),n||this.size&&this.size[0]===a&&this.size[1]===l){const{x:m,y:g}=n||{x:0,y:0};if(e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||ImageBitmap&&e instanceof ImageBitmap)p.texSubImage2D(p.TEXTURE_2D,0,m,g,p.RGBA,p.UNSIGNED_BYTE,e);else{let x=this.format,v=p.UNSIGNED_BYTE;this.format===p.R32F&&(x=p.RED,v=p.FLOAT),p.texSubImage2D(p.TEXTURE_2D,0,m,g,a,l,x,v,e.data)}}else if(this.size=[a,l],e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||ImageBitmap&&e instanceof ImageBitmap){let m=this.format;this.format===p.R8&&(m=p.RED),p.texImage2D(p.TEXTURE_2D,0,this.format,m,p.UNSIGNED_BYTE,e)}else{let m=this.format,g=this.format,x=p.UNSIGNED_BYTE;this.format===p.DEPTH_COMPONENT&&(m=p.DEPTH_COMPONENT16,x=p.UNSIGNED_SHORT),this.format===p.R8&&(g=p.RED),this.format===p.R32F&&(x=p.FLOAT,g=p.RED),p.texImage2D(p.TEXTURE_2D,0,m,a,l,0,g,x,e.data)}this.useMipmap=!!(i&&i.useMipmap),this.useMipmap&&p.generateMipmap(p.TEXTURE_2D)}bind(e,i,n=!1){const{context:a}=this,{gl:l}=a;l.bindTexture(l.TEXTURE_2D,this.texture),e!==this.minFilter&&(l.texParameteri(l.TEXTURE_2D,l.TEXTURE_MAG_FILTER,e),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_MIN_FILTER,this.useMipmap&&!n?e===l.NEAREST?l.NEAREST_MIPMAP_NEAREST:l.LINEAR_MIPMAP_LINEAR:e),this.minFilter=e),i!==this.wrapS&&(l.texParameteri(l.TEXTURE_2D,l.TEXTURE_WRAP_S,i),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_WRAP_T,i),this.wrapS=i)}bindExtraParam(e,i,n,a){const{context:l}=this,{gl:h}=l;h.bindTexture(h.TEXTURE_2D,this.texture),i!==this.magFilter&&(h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MAG_FILTER,i),this.magFilter=i),e!==this.minFilter&&(h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MIN_FILTER,this.useMipmap?e===h.NEAREST?h.NEAREST_MIPMAP_NEAREST:h.LINEAR_MIPMAP_LINEAR:e),this.minFilter=e),n!==this.wrapS&&(h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_S,n),this.wrapS=n),a!==this.wrapT&&(h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_T,a),this.wrapT=a)}destroy(){const{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}}class Xd{constructor(e,i){this.context=e,this.texture=i}bind(e,i){const{context:n}=this,{gl:a}=n;a.bindTexture(a.TEXTURE_2D,this.texture),e!==this.minFilter&&(a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,e),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,e),this.minFilter=e),i!==this.wrapS&&(a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,i),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,i),this.wrapS=i)}}function Yd(t,e,i,n,a,l,h,p){const m=[t,e,1,i,n,1,a,l,1],g=[h,p,1],x=o.ct.adjoint([],m),[v,w,E]=o.Q.transformMat3(g,g,x);return o.ct.multiply(m,m,[v,0,0,0,w,0,0,0,E])}function Ag(t,e,i,n,a,l,h,p){const m=function(g,x,v,w,E,M,I,z){const D=Yd(0,0,1,0,1,1,0,1),F=Yd(g,x,v,w,E,M,I,z),j=o.ct.adjoint([],D);return o.ct.multiply(F,F,j)}(t,e,i,n,a,l,h,p);return[m[2]/m[8]/Ve,m[5]/m[8]/Ve]}function Jd(t){return[t[0],Math.min(Math.max(t[1],-Ni),Ni)]}class Ig extends vs{constructor(e,i,n,a){super(),this.id=e,this.dispatcher=n,this.coordinates=i.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.onNorthPole=!1,this.onSouthPole=!1,this.setEventedParent(a),this.options=i,this._dirty=!1}load(e,i){if(this._loaded=i||!1,this.fire(new Jn("dataloading",{dataType:"source"})),this.url=this.options.url,!this.url)return e&&(this.coordinates=e),this._loaded=!0,void this._finishLoading();this._imageRequest=Bc(this.map._requestManager.transformRequest(this.url,dl.Image),(n,a)=>{this._imageRequest=null,this._loaded=!0,n?this.fire(new bl(n)):a&&(this.image=a instanceof HTMLImageElement?_n.getImageData(a):a,this._dirty=!0,this.width=this.image.width,this.height=this.image.height,e&&(this.coordinates=e),this._finishLoading())})}loaded(){return this._loaded}updateImage(e){return 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}setTexture(e){if(!(e.handle instanceof WebGLTexture))throw new Error("The provided handle is not a WebGLTexture instance");return this.texture=new Xd(this.map.painter.context,e.handle),this.width=e.dimensions[0],this.height=e.dimensions[1],this._dirty=!1,this._loaded=!0,this._finishLoading(),this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new Jn("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(e){this.map=e,this.load()}onRemove(){this._imageRequest&&(this._imageRequest.cancel(),this._imageRequest=null),!this.texture||this.texture instanceof Xd||this.texture.destroy(),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy())}setCoordinates(e){if(this.coordinates=e,this._boundsArray=void 0,this._unsupportedCoords=!1,!e.length)return this;this.onNorthPole=!1,this.onSouthPole=!1;let i=e[0][1],n=e[0][1];for(const l of e)l[1]>n&&(n=l[1]),l[1]<i&&(i=l[1]);const a=(n+i)/2;if(a>Ni?this.onNorthPole=!0:a<-Ni&&(this.onSouthPole=!0),!this.onNorthPole&&!this.onSouthPole){const l=e.map(mr.fromLngLat);this.tileID=function(h){let p=1/0,m=1/0,g=-1/0,x=-1/0;for(const I of h)p=Math.min(p,I.x),m=Math.min(m,I.y),g=Math.max(g,I.x),x=Math.max(x,I.y);const v=Math.max(g-p,x-m),w=Math.max(0,Math.floor(-Math.log(v)/Math.LN2)),E=Math.pow(2,w);let M=Math.floor((p+g)/2*E);return M>1&&(M-=1),new La(w,M,Math.floor((m+x)/2*E))}(l),this.minzoom=this.maxzoom=this.tileID.z}return this.fire(new Jn("data",{dataType:"source",sourceDataType:"content"})),this}_clear(){this._boundsArray=void 0,this._unsupportedCoords=!1}_prepareData(e){for(const D in this.tiles){const F=this.tiles[D];F.state!=="loaded"&&(F.state="loaded",F.texture=this.texture)}if(this._boundsArray||this.onNorthPole||this.onSouthPole||this._unsupportedCoords)return;const i=Nu(new La(0,0,0),this.map.transform.projection),n=[i.projection.project(this.coordinates[0][0],this.coordinates[0][1]),i.projection.project(this.coordinates[1][0],this.coordinates[1][1]),i.projection.project(this.coordinates[2][0],this.coordinates[2][1]),i.projection.project(this.coordinates[3][0],this.coordinates[3][1])];if(!function(D){const F=D[1].x-D[0].x,j=D[1].y-D[0].y,V=D[2].x-D[1].x,X=D[2].y-D[1].y,q=D[3].x-D[2].x,J=D[3].y-D[2].y,ee=D[0].x-D[3].x,oe=D[0].y-D[3].y,fe=F*X-V*j,le=V*J-q*X,ge=q*oe-ee*J,_e=ee*j-F*oe;return fe>0&&le>0&&ge>0&&_e>0||fe<0&&le<0&&ge<0&&_e<0}(n))return console.warn("Image source coordinates are defining non-convex area in the Mercator projection"),void(this._unsupportedCoords=!0);const a=Nu(this.tileID,this.map.transform.projection),[l,h,p,m]=this.coordinates.map(D=>{const F=a.projection.project(D[0],D[1]);return vg(a,F)._round()});this.perspectiveTransform=Ag(l.x,l.y,h.x,h.y,p.x,p.y,m.x,m.y);const g=this._boundsArray=new lr;g.emplaceBack(l.x,l.y,0,0),g.emplaceBack(h.x,h.y,Ve,0),g.emplaceBack(m.x,m.y,0,Ve),g.emplaceBack(p.x,p.y,Ve,Ve),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy()),this.boundsBuffer=e.createVertexBuffer(g,Bf.members),this.boundsSegments=Fi.simpleSegment(0,0,4,2);const x=[],v=[Jd((w=this.coordinates)[0]),Jd(w[1]),Jd(w[2]),Jd(w[3])];var w;const[E,M,I,z]=function(D){let F=D[0][0],j=F,V=D[0][1],X=V;for(let q=1;q<D.length;q++)D[q][0]<F?F=D[q][0]:D[q][0]>j&&(j=D[q][0]),D[q][1]<V?V=D[q][1]:D[q][1]>X&&(X=D[q][1]);return[F,V,j-F,X-V]}(v);{const D=new lr,[F,j,V,X]=function(Ce){let Ae=Ce[0].x,ye=Ae,Ye=Ce[0].y,$e=Ye;for(let ze=1;ze<Ce.length;ze++)Ce[ze].x<Ae?Ae=Ce[ze].x:Ce[ze].x>ye&&(ye=Ce[ze].x),Ce[ze].y<Ye?Ye=Ce[ze].y:Ce[ze].y>$e&&($e=Ce[ze].y);return[Ae,Ye,ye-Ae,$e-Ye]}(n),q=Ce=>
7[(Ce.x-F)/V,(Ce.y-j)/X],[J,ee,oe,fe]=n.map(q),le=function(Ce,Ae,ye,Ye,$e,ze,ct,it){const Je=Yd(0,0,1,0,1,1,0,1),De=Yd(Ce,Ae,ye,Ye,$e,ze,ct,it),ot=o.ct.adjoint([],De);return o.ct.multiply(Je,Je,ot)}(J[0],J[1],ee[0],ee[1],oe[0],oe[1],fe[0],fe[1]);this.elevatedGlobePerspectiveTransform=Ag(J[0],J[1],ee[0],ee[1],oe[0],oe[1],fe[0],fe[1]);const ge=(Ce,Ae)=>{x.push(Ce.lng);const ye=Math.round((Ce.lng-E)/I*Ve),Ye=Math.round((Ce.lat-M)/z*Ve),$e=q(Ae),ze=o.Q.transformMat3([],[$e[0],$e[1],1],le),ct=Math.round(ze[0]/ze[2]*Ve),it=Math.round(ze[1]/ze[2]*Ve);D.emplaceBack(ye,Ye,ct,it)},_e=n[3].x-n[0].x,me=n[3].y-n[0].y,Ee=n[2].x-n[1].x,we=n[2].y-n[1].y;for(let Ce=0;Ce<65;Ce++){const Ae=Ce/64,ye=[n[0].x+Ae*_e,n[0].y+Ae*me],Ye=[n[1].x+Ae*Ee,n[1].y+Ae*we],$e=Ye[0]-ye[0],ze=Ye[1]-ye[1];for(let ct=0;ct<65;ct++){const it=ct/64,Je={x:ye[0]+$e*it,y:ye[1]+ze*it,z:0};ge(i.projection.unproject(Je.x,Je.y),Je)}}this.elevatedGlobeVertexBuffer=e.createVertexBuffer(D,Bf.members)}{this.maxLongitudeTriangleSize=0;let D=[],F=new Xi;const j=(V,X,q)=>{F.emplaceBack(V,X,q);const J=x[V],ee=x[X],oe=x[q],fe=Math.min(Math.min(J,ee),oe),le=Math.max(Math.max(J,ee),oe)-fe;le>this.maxLongitudeTriangleSize&&(this.maxLongitudeTriangleSize=le),D.push(fe+le/2)};for(let V=0;V<64;V++)for(let X=0;X<64;X++){const q=65*V+X,J=q+1,ee=q+65,oe=ee+1;j(q,ee,J),j(J,ee,oe)}[D,F]=function(V,X){const q=Array.from({length:V.length},(oe,fe)=>fe);q.sort((oe,fe)=>V[oe]-V[fe]);const J=[],ee=new Xi;for(let oe=0;oe<q.length;oe++){const fe=q[oe];J.push(V[fe]);const le=3*fe,ge=le+1;ee.emplaceBack(X.uint16[le],X.uint16[ge],X.uint16[ge+1])}return[J,ee]}(D,F),this.elevatedGlobeTrianglesCenterLongitudes=D,this.elevatedGlobeIndexBuffer=e.createIndexBuffer(F)}this.elevatedGlobeSegments=Fi.simpleSegment(0,0,4225,8192),this.elevatedGlobeGridMatrix=new Float32Array([0,I/Ve,0,z/Ve,0,0,M,E,0])}prepare(){const e=Object.keys(this.tiles).length!==0;if(this.tileID&&!e)return;const i=this.map.painter.context,n=i.gl;!this._dirty||this.texture instanceof Xd||(this.texture?this.texture.update(this.image):(this.texture=new Ff(i,this.image,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE)),this._dirty=!1),e&&this._prepareData(i)}loadTile(e,i){this.tileID&&this.tileID.equals(e.tileID.canonical)?(this.tiles[String(e.tileID.wrap)]=e,e.buckets={},i(null)):(e.state="errored",i(null))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}getSegmentsForLongitude(e){const i=this.elevatedGlobeSegments;if(!this.elevatedGlobeTrianglesCenterLongitudes||!i)return null;const n=this.elevatedGlobeTrianglesCenterLongitudes;let a=((x,v)=>x+360*Math.round((v-x)/360))(e+180,n[0]);const l=new Fi,h=(x,v)=>{l.segments.push({vertexOffset:0,primitiveOffset:x,vertexLength:i.segments[0].vertexLength,primitiveLength:v,sortKey:void 0,vaos:{}})},p=.51*this.maxLongitudeTriangleSize;if(Math.abs(n[0]-a)<=p){const x=Dc(n,0,n.length,a+p);return x===n.length||h(x,ys(n,x+1,n.length,a+360-p)-x),l}a<n[0]&&(a+=360);const m=ys(n,0,n.length,a-p);if(m===n.length)return h(0,n.length),l;h(0,m-0);const g=Dc(n,m+1,n.length,a+p);return g!==n.length&&h(g,n.length-g),l}}const pv=(Math.pow(256,2)-1)/16907520;class Cg extends It{constructor(e,i,n){super(e,dv,i,n),this.updateColorRamp(),this._curRampRange=[NaN,NaN]}getProgramIds(){return["raster"]}hasColorMap(){return!!this._transitionablePaint._values["raster-color"].value.value}tileCoverLift(){return this.paint.get("raster-elevation")}isDraped(e){return!(e&&e._source instanceof Ig&&(e._source.onNorthPole||e._source.onSouthPole))&&this.paint.get("raster-elevation")===0}_handleSpecialPaintPropertyUpdate(e){e!=="raster-color"&&e!=="raster-color-range"||(this._curRampRange=[NaN,NaN],this.updateColorRamp())}updateColorRamp(e){if(!this.hasColorMap()||!this._curRampRange)return;const i=this._transitionablePaint._values["raster-color"].value.expression,[n,a]=e||this._transitionablePaint._values["raster-color-range"].value.expression.evaluate({zoom:0})||[NaN,NaN];isNaN(n)&&isNaN(a)||n===this._curRampRange[0]&&a===this._curRampRange[1]||(this.colorRamp=Iu({expression:i,evaluationKey:"rasterValue",image:this.colorRamp,clips:[{start:n,end:a}],resolution:256}),this.colorRampTexture=null,this._curRampRange=[n,a])}}const fv=new se({visibility:new te(W["layout_raster-particle"].visibility)});var mv={paint:new se({"raster-particle-array-band":new te(W["paint_raster-particle"]["raster-particle-array-band"]),"raster-particle-count":new te(W["paint_raster-particle"]["raster-particle-count"]),"raster-particle-color":new Me(W["paint_raster-particle"]["raster-particle-color"]),"raster-particle-max-speed":new te(W["paint_raster-particle"]["raster-particle-max-speed"]),"raster-particle-speed-factor":new te(W["paint_raster-particle"]["raster-particle-speed-factor"]),"raster-particle-fade-opacity-factor":new te(W["paint_raster-particle"]["raster-particle-fade-opacity-factor"]),"raster-particle-reset-rate-factor":new te(W["paint_raster-particle"]["raster-particle-reset-rate-factor"])}),layout:fv};class Pg extends It{constructor(e,i,n){super(e,mv,i,n),this._updateColorRamp(),this.lastInvalidatedAt=_n.now()}onRemove(e){this.colorRampTexture&&this.colorRampTexture.destroy(),this.tileFramebuffer&&this.tileFramebuffer.destroy(),this.particleFramebuffer&&this.particleFramebuffer.destroy()}hasColorMap(){return!!this._transitionablePaint._values["raster-particle-color"].value.value}getProgramIds(){return["rasterParticle"]}hasOffscreenPass(){return this.visibility!=="none"}isDraped(e){return!1}_handleSpecialPaintPropertyUpdate(e){e!=="raster-particle-color"&&e!=="raster-particle-max-speed"||(this._updateColorRamp(),this._invalidateAnimationState()),e==="raster-particle-count"&&this._invalidateAnimationState()}_updateColorRamp(){if(!this.hasColorMap())return;const e=this._transitionablePaint._values["raster-particle-color"].value.expression,i=this._transitionablePaint._values["raster-particle-max-speed"].value.expression.evaluate({zoom:0});this.colorRamp=Iu({expression:e,evaluationKey:"rasterParticleSpeed",image:this.colorRamp,clips:[{start:0,end:i}],resolution:256}),this.colorRampTexture=null}
7_invalidateAnimationState(){this.lastInvalidatedAt=_n.now()}}class _v extends It{constructor(e,i){super(e,{},i),this.implementation=e,e.slot&&(this.slot=e.slot)}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}isDraped(e){return this.implementation.renderToTile!==void 0}shouldRedrape(){return!!this.implementation.shouldRerenderTiles&&this.implementation.shouldRerenderTiles()}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){}onAdd(e){this.implementation.onAdd&&this.implementation.onAdd(e,e.painter.context.gl)}onRemove(e){this.implementation.onRemove&&this.implementation.onRemove(e,e.painter.context.gl)}}const gv=new se({visibility:new te(W.layout_sky.visibility)});var yv={paint:new se({"sky-type":new te(W.paint_sky["sky-type"]),"sky-atmosphere-sun":new te(W.paint_sky["sky-atmosphere-sun"]),"sky-atmosphere-sun-intensity":new te(W.paint_sky["sky-atmosphere-sun-intensity"]),"sky-gradient-center":new te(W.paint_sky["sky-gradient-center"]),"sky-gradient-radius":new te(W.paint_sky["sky-gradient-radius"]),"sky-gradient":new Me(W.paint_sky["sky-gradient"]),"sky-atmosphere-halo-color":new te(W.paint_sky["sky-atmosphere-halo-color"]),"sky-atmosphere-color":new te(W.paint_sky["sky-atmosphere-color"]),"sky-opacity":new te(W.paint_sky["sky-opacity"])}),layout:gv};function Nf(t,e,i){const n=[0,0,1],a=o.bl.identity([]);return o.bl.rotateY(a,a,i?-jt(t)+Math.PI:jt(t)),o.bl.rotateX(a,a,-jt(e)),o.Q.transformQuat(n,n,a),o.Q.normalize(n,n)}var xv={paint:new se({})};function zg(t,e){const i=Kd(t.projection,t.zoom,t.width,t.height),n=function(l,h,p,m,g){const x=new Zt(p.lng-180*Po,p.lat),v=new Zt(p.lng+180*Po,p.lat),w=l.project(x.lng,x.lat),E=l.project(v.lng,v.lat),M=-Math.atan2(E.y-w.y,E.x-w.x),I=mr.fromLngLat(p);I.y=kt(I.y,-1+Po,1-Po);const z=I.toLngLat(),D=l.project(z.lng,z.lat),F=mr.fromLngLat(z);F.x+=Po;const j=F.toLngLat(),V=l.project(j.lng,j.lat),X=Lg(V.x-D.x,V.y-D.y,M),q=mr.fromLngLat(z);q.y+=Po;const J=q.toLngLat(),ee=l.project(J.lng,J.lat),oe=Lg(ee.x-D.x,ee.y-D.y,M),fe=Math.abs(X.x)/Math.abs(oe.y),le=o.a9.identity([]);o.a9.rotateZ(le,le,-M*(1-(g?0:m)));const ge=o.a9.identity([]);return o.a9.scale(ge,ge,[1,1-(1-fe)*m,1]),ge[4]=-oe.x/oe.y*m,o.a9.rotateZ(ge,ge,M),o.a9.multiply(ge,le,ge),ge}(t.projection,0,t.center,i,e),a=Dg(t);return o.a9.scale(n,n,[a,a,1]),n}function Dg(t){const e=t.projection,i=Kd(t.projection,t.zoom,t.width,t.height),n=Rg(e,t.center),a=Rg(e,Zt.convert(e.center));return Math.pow(2,n*i+(1-i)*a)}function Kd(t,e,i,n,a=1/0){const l=t.range;if(!l)return 0;const h=Math.min(a,Math.max(i,n)),p=Math.log(h/1024)/Math.LN2;return jo(l[0]+p,l[1]+p,e)}const Po=1/4e4;function Rg(t,e){const i=kt(e.lat,-Ni,Ni),n=new Zt(e.lng-180*Po,i),a=new Zt(e.lng+180*Po,i),l=t.project(n.lng,i),h=t.project(a.lng,i),p=mr.fromLngLat(n),m=mr.fromLngLat(a),g=h.x-l.x,x=h.y-l.y,v=m.x-p.x,w=m.y-p.y,E=Math.sqrt((v*v+w*w)/(g*g+x*x));return Math.log(E)/Math.LN2}function Lg(t,e,i){const n=Math.cos(i),a=Math.sin(i);return{x:t*n-e*a,y:t*a+e*n}}function kg(t,e,i){o.a9.identity(t),o.a9.rotateZ(t,t,jt(e[2])),o.a9.rotateX(t,t,jt(e[0])),o.a9.rotateY(t,t,jt(e[1])),o.a9.scale(t,t,i),o.a9.multiply(t,t,[1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,1])}function ep(t,e,i,n,a,l,h,p){const m=[i[0]-e[0],i[1]-e[1],0],g=[n[0]-e[0],n[1]-e[1],0];if(o.Q.length(m)<1e-12||o.Q.length(g)<1e-12)return o.bl.identity(t);const x=o.Q.cross([],m,g);o.Q.normalize(x,x),o.Q.subtract(g,n,e),m[2]=(l-a)*p,g[2]=(h-a)*p;const v=m;return o.Q.cross(v,m,g),o.Q.normalize(v,v),o.bl.rotationTo(t,x,v)}function Vf(t,e,i=!1){const n=To(e.zoom),a=function(l,h,p){const m=h.worldSize,g=[l[12],l[13],l[14]],x=cr(g[1]/m),v=$r(g[0]/m),w=o.a9.identity([]),E=Ir(1,x)*m,M=Ir(1,0)*m*ka(x,h.zoom),I=1/uf(m);let z=M*I;if(p){const V=Kd(h.projection,h.zoom,h.width,h.height,1024);z=I*h.projection.pixelSpaceConversion(h.center.lat,m,V)}const D=Ra(x,v);o.Q.add(D,D,o.Q.scale([],o.Q.normalize([],D),E*z*g[2]));const F=function(V){const X=[V[0],V[1],V[2]];let q=[0,1,0];const J=o.Q.cross([],q,X);return o.Q.cross(q,X,J),o.Q.squaredLength(q)===0&&(q=[0,1,0],o.Q.cross(J,X,q)),o.Q.normalize(J,J),o.Q.normalize(q,q),o.Q.normalize(X,X),[J[0],J[1],J[2],0,q[0],q[1],q[2],0,X[0],X[1],X[2],0,V[0],V[1],V[2],1]}(D);o.a9.scale(w,w,[z,z,z*E]),o.a9.translate(w,w,[-g[0],-g[1],-g[2]]);const j=o.a9.multiply([],h.globeMatrix,F);return o.a9.multiply(j,j,w),o.a9.multiply(j,j,l),j}(t,e,i);if(n>0){const l=function(h,p){const m=p.worldSize,g=Ir(1,0)*m*ka(p.center.lat,p.zoom)/uf(m),x=Ir(1,p.center.lat)*m,v=o.a9.identity([]);return o.a9.rotateY(v,v,jt(p.center.lng)),o.a9.rotateX(v,v,jt(p.center.lat)),o.a9.translate(v,v,[0,0,Ar]),o.a9.scale(v,v,[g,g,g*x]),o.a9.translate(v,v,[p.point.x-.5*m,p.point.y-.5*m,0]),o.a9.multiply(v,v,h),o.a9.multiply(v,p.globeMatrix,v)}(t,e);return function(h,p,m){const g=(M,I,z)=>{const D=o.Q.length(M),F=o.Q.length(I),j=ks(M,I,z);return o.Q.scale(j,j,1/o.Q.length(j)*Ct(D,F,z))},x=g([h[0],h[1],h[2]],[p[0],p[1],p[2]],m),v=g([h[4],h[5],h[6]],[p[4],p[5],p[6]],m),w=g([h[8],h[9],h[10]],[p[8],p[9],p[10]],m),E=ks([h[12],h[13],h[14]],[p[12],p[13],p[14]],m);return[x[0],x[1],x[2],0,v[0],v[1],v[2],0,w[0],w[1],w[2],0,E[0],E[1],E[2],1]}(a,l,n)}return a}function Og(t,e,i,n){const a=wi.projectAabbCorners(n,i);let l=Number.MAX_VALUE,h=-1;for(let g=0;g<a.length;++g){const x=a[g];x[0]=(.5*x[0]+.5)*e.width,x[1]=(.5-.5*x[1])*e.height,x[2]<l&&(h=g,l=x[2])}const p=g=>new Ne(a[g][0],a[g][1]);let m;
7switch(h){case 0:case 6:m=[p(1),p(5),p(4),p(7),p(3),p(2),p(1)];break;case 1:case 7:m=[p(0),p(4),p(5),p(6),p(2),p(3),p(0)];break;case 3:case 5:m=[p(1),p(0),p(4),p(7),p(6),p(2),p(1)];break;default:m=[p(1),p(5),p(6),p(7),p(3),p(0),p(1)]}if(Kp(t,m))return l}const vv=vt([{name:"a_pos_3f",components:3,type:"Float32"}]),bv=vt([{name:"a_color_3f",components:3,type:"Float32"}]),wv=vt([{name:"a_color_4f",components:4,type:"Float32"}]),Tv=vt([{name:"a_uv_2f",components:2,type:"Float32"}]),Ev=vt([{name:"a_normal_3f",components:3,type:"Float32"}]),Sv=vt([{name:"a_normal_matrix0",components:4,type:"Float32"},{name:"a_normal_matrix1",components:4,type:"Float32"},{name:"a_normal_matrix2",components:4,type:"Float32"},{name:"a_normal_matrix3",components:4,type:"Float32"}]),Mv=vt([{name:"a_pbr",components:4,type:"Uint16"},{name:"a_heightBasedEmissiveStrength",components:3,type:"Float32"}]);class tp{constructor(e,i,n,a){this.message=(e?`${e}: `:"")+n,a&&(this.identifier=a),i!=null&&i.__line__&&(this.line=i.__line__)}}function Bg(t,e){const i=t.indexOf("://")===-1;try{return new URL(t,i&&e?"http://example.com":void 0),!0}catch{return!1}}class Fg{constructor(e,i){this.feature=e,this.instancedDataOffset=i,this.instancedDataCount=0,this.rotation=[0,0,0],this.scale=[1,1,1],this.translation=[0,0,0]}}class Ng{constructor(){this.instancedDataArray=new Fp,this.instancesEvaluatedElevation=[],this.features=[],this.idToFeaturesIndex={}}}class Uf{constructor(e){this.zoom=e.zoom,this.canonical=e.canonical,this.layers=e.layers,this.layerIds=this.layers.map(i=>i.fqid),this.projection=e.projection,this.index=e.index,this.hasZoomDependentProperties=this.layers[0].isZoomDependent(),this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.hasPattern=!1,this.instancesPerModel={},this.validForExaggeration=0,this.maxVerticalOffset=0,this.maxScale=0,this.maxHeight=0,this.lookupDim=this.zoom>this.canonical.z?256:this.zoom>15?75:100,this.instanceCount=0,this.terrainElevationMin=0,this.terrainElevationMax=0,this.validForDEMTile={id:null,timestamp:0},this.modelUris=[],this.modelsRequested=!1}populate(e,i,n,a){this.tileToMeter=pd(n);const l=this.layers[0]._featureFilter.needGeometry;this.lookup=new Uint8Array(this.lookupDim*this.lookupDim);for(const{feature:h,id:p,index:m,sourceLayerIndex:g}of e){const x=p??(h.properties&&h.properties.hasOwnProperty("id")?h.properties.id:void 0),v=wo(h,l);if(!this.layers[0]._featureFilter.filter(new B(this.zoom),v,n))continue;const w={id:x,sourceLayerIndex:g,index:m,geometry:l?v.geometry:Ls(h,n,a),properties:h.properties,type:h.type,patterns:{}},E=this.addFeature(w,w.geometry,v);E&&i.featureIndex.insert(h,w.geometry,m,g,this.index,this.instancesPerModel[E].instancedDataArray.length,Ve/32)}this.lookup=null}update(e,i,n,a){for(const l in this.instancesPerModel){const h=this.instancesPerModel[l];for(const p in e)h.idToFeaturesIndex.hasOwnProperty(p)&&(this.evaluate(h.features[h.idToFeaturesIndex[p]],e[p],h,!0),this.uploaded=!1)}this.maxHeight=0}updateZoomBasedPaintProperties(){if(!this.hasZoomDependentProperties)return!1;let e=!1;for(const i in this.instancesPerModel){const n=this.instancesPerModel[i];for(const a of n.features){const l=this.layers[0],h=a.feature,p=this.canonical,m=l.paint.get("model-rotation").evaluate(h,{},p),g=l.paint.get("model-scale").evaluate(h,{},p),x=l.paint.get("model-translation").evaluate(h,{},p);o.Q.exactEquals(a.rotation,m)&&o.Q.exactEquals(a.scale,g)&&o.Q.exactEquals(a.translation,x)||(this.evaluate(a,a.featureStates,n,!0),e=!0)}}return e}isEmpty(){for(const e in this.instancesPerModel)if(this.instancesPerModel[e].instancedDataArray.length!==0)return!1;return!0}uploadPending(){return!this.uploaded}upload(e){if(!this.uploaded)for(const i in this.instancesPerModel){const n=this.instancesPerModel[i];n.instancedDataArray.length<0||n.instancedDataArray.length===0||(n.instancedDataBuffer?n.instancedDataBuffer.updateData(n.instancedDataArray):n.instancedDataBuffer=e.createVertexBuffer(n.instancedDataArray,Sv.members,!0,void 0,this.instanceCount))}this.uploaded=!0}destroy(){for(const i in this.instancesPerModel){const n=this.instancesPerModel[i];n.instancedDataArray.length!==0&&n.instancedDataBuffer&&n.instancedDataBuffer.destroy()}const e=this.layers[0].modelManager;if(e&&this.modelUris)for(const i of this.modelUris)e.removeModel(i,"")}addFeature(e,i,n){const a=this.layers[0],l=a.layout.get("model-id").evaluate(n,{},this.canonical);if(!l)return Ci(`modelId is not evaluated for layer ${a.id} and it is not going to get rendered.`),l;Bg(l,!1)&&(this.modelUris.includes(l)||this.modelUris.push(l)),this.instancesPerModel[l]||(this.instancesPerModel[l]=new Ng);const h=this.instancesPerModel[l],p=h.instancedDataArray,m=new Fg(n,p.length);for(const g of i)for(const x of g){if(x.x<0||x.x>=Ve||x.y<0||x.y>=Ve)continue;const v=(this.lookupDim-1)/Ve,w=this.lookupDim*(x.y*v|0)+x.x*v|0;if(this.lookup){if(this.lookup[w]!==0)continue;this.lookup[w]=1}this.instanceCount++;const E=p.length;p.resize(E+1),h.instancesEvaluatedElevation.push(0),p.float32[16*E]=x.x,p.float32[16*E+1]=x.y}return m.instancedDataCount=h.instancedDataArray.length-m.instancedDataOffset,m.instancedDataCount>0&&(e.id&&(h.idToFeaturesIndex[e.id]=h.features.length),h.features.push(m),this.evaluate(m,{},h,!1)),l}getModelUris(){return this.modelUris}evaluate(e,i,n,a){const l=this.layers[0],h=e.feature,p=this.canonical,m=e.rotation=l.paint.get("model-rotation").evaluate(h,i,p),g=e.scale=l.paint.get("model-scale").evaluate(h,i,p),x=e.translation=l.paint.get("model-translation").evaluate(h,i,p),v=l.paint.get("model-color").evaluate(h,i,p);v.a=l.paint.get("model-color-mix-intensity").evaluate(h,i,p);const w=[];this.maxVerticalOffset<x[2]&&(this.maxVerticalOffset=x[2]),this.maxScale=Math.max(Math.max(this.maxScale,g[0]),Math.max(g[1],g[2])),kg(w,m,g);const E=Math.round(100*v.a)+v.b/1.05;for(let M=0;M<e.instancedDataCount;++M){const I=e.instancedDataOffset+M,z=16*I,D=n.instancedDataArray.float32;let F=0;a&&(F=D[z+6]-n.instancesEvaluatedElevation[I]);const j=0|D[z+1];D[z]=(0|D[z])+v.r/1.05,D[z+1]=j+v.g/1.05,D[z+2]=E,D[z+3]=1/(p.z>10?this.tileToMeter:pd(p,j)),D[z+4]=x[0],D[z+5]=x[1],D[z+6]=x[2]+F,D[z+7]=w[0],D[z+8]=w[1],D[z+9]=w[2],D[z+10]=w[4],D[z+11]=w[5],D[z+12]=w[6],D[z+13]=w[8],D[z+14]=w[9],D[z+15]=w[10],n.instancesEvaluatedElevation[I]=x[2]}}}Qe(Uf,"ModelBucket",{omit:["layers"]}),Qe(Ng,"PerModelAttributes"),Qe(Fg,"ModelFeature");const Av=new se({visibility:new te(W.layout_model.visibility),"model-id":new ae(W.layout_model["model-id"])});var Iv={paint:new se({"model-opacity":new te(W.paint_model["model-opacity"]),"model-rotation":new ae(W.paint_model["model-rotation"]),"model-scale":new ae(W.paint_model["model-scale"]),"model-translation":new ae(W.paint_model["model-translation"]),"model-color":new ae(W.paint_model["model-color"]),"model-color-mix-intensity":new ae(W.paint_model["model-color-mix-intensity"]),"model-type":new te(W.paint_model["model-type"]),"model-cast-shadows":new te(W.paint_model["model-cast-shadows"]),"model-receive-shadows":new te(W.paint_model["model-receive-shadows"]),"model-ambient-occlusion-intensity":new te(W.paint_model["model-ambient-occlusion-intensity"]),"model-emissive-strength":new ae(W.paint_model["model-emissive-strength"]),"model-roughness":new ae(W.paint_model["model-roughness"]),"model-height-based-emissive-strength-multiplier":new ae(W.paint_model["model-height-based-emissive-strength-multiplier"]),"model-cutoff-fade-range":new te(W.paint_model["model-cutoff-fade-range"]),"model-front-cutoff":new te(W.paint_model["model-front-cutoff"])}),layout:Av};const Fa=64,dc={CoordinateSpaceTile:1,CoordinateSpaceYUp:2,HasMapbox
7MeshFeatures:4,HasMeshoptCompression:8};function Vg(t,e,i,n,a,l,h,p,m,g=!1){const x=i.zoom,v=i.project(n),w=ka(n.lat,x),E=1/w;o.a9.identity(t),o.a9.translate(t,t,[v.x+h[0]*E,v.y+h[1]*E,h[2]]);let M=1,I=1;const z=i.worldSize;if(g){if(i.projection.name==="mercator"){let V=0;i.elevation&&(V=i.elevation.getAtPointOrZero(new mr(v.x/z,v.y/z),0));const X=o.aa.transformMat4([],[v.x,v.y,V,1],i.projMatrix)[3]/i.cameraToCenterDistance;M=X,I=X*ka(i.center.lat,x)}else if(i.projection.name==="globe"){const V=Vf(t,i),X=o.a9.multiply([],i.projMatrix,V),q=[0,0,0,1];o.aa.transformMat4(q,q,X);const J=q[3]/i.cameraToCenterDistance,ee=To(x),oe=i.projection.pixelsPerMeter(n.lat,z)*ka(n.lat,x),fe=i.projection.pixelsPerMeter(i.center.lat,z)*ka(i.center.lat,x);M=J/Ct(oe,Am(i.center.lat),ee),I=J*w/oe,M*=fe,I*=fe}}else M=E;o.a9.scale(t,t,[M,M,I]);const D=[...t],F=e.orientation,j=[];if(kg(j,[F[0]+a[0],F[1]+a[1],F[2]+a[2]],l),o.a9.multiply(t,D,j),p&&i.elevation){let V=0;const X=[];if(m&&i.elevation){V=function(ee,oe,fe,le,ge){const _e=oe.elevation;if(!_e)return 0;const me=wi.projectAabbCorners(fe,le),Ee=Ir(1,ge.lat)*oe.worldSize,we=function(ot,bt){const pt=[0,0,1],Mt=[{corners:[0,1,3,2],dotProductWithUp:0},{corners:[1,5,2,6],dotProductWithUp:0},{corners:[0,4,1,5],dotProductWithUp:0},{corners:[2,6,3,7],dotProductWithUp:0},{corners:[4,7,5,6],dotProductWithUp:0},{corners:[0,3,4,7],dotProductWithUp:0}];for(const wt of Mt){const Rt=ot[wt.corners[0]],ht=ot[wt.corners[1]],oi=ot[wt.corners[2]],ni=[ht[0]-Rt[0],ht[1]-Rt[1],bt*(ht[2]-Rt[2])],$t=o.Q.cross(ni,ni,[oi[0]-Rt[0],oi[1]-Rt[1],bt*(oi[2]-Rt[2])]);o.Q.normalize($t,$t),wt.dotProductWithUp=o.Q.dot($t,pt)}return Mt.sort((wt,Rt)=>wt.dotProductWithUp-Rt.dotProductWithUp),Mt[0].corners}(me,Ee),Ce=me[we[0]],Ae=me[we[1]],ye=me[we[2]],Ye=me[we[3]],$e=_e.getAtPointOrZero(new mr(Ce[0]/oe.worldSize,Ce[1]/oe.worldSize),0),ze=_e.getAtPointOrZero(new mr(Ae[0]/oe.worldSize,Ae[1]/oe.worldSize),0),ct=_e.getAtPointOrZero(new mr(ye[0]/oe.worldSize,ye[1]/oe.worldSize),0),it=_e.getAtPointOrZero(new mr(Ye[0]/oe.worldSize,Ye[1]/oe.worldSize),0),Je=($e+it)/2,De=(ze+ct)/2;return Je>De?ze<ct?ep(ee,Ae,Ye,Ce,ze,it,$e,Ee):ep(ee,ye,Ce,Ye,ct,$e,it,Ee):$e<it?ep(ee,Ce,Ae,ye,$e,ze,ct,Ee):ep(ee,Ye,ye,Ae,it,ct,ze,Ee),Math.max(Je,De)}(X,i,e.aabb,t,n);const q=o.a9.fromQuat([],X),J=o.a9.multiply([],q,j);o.a9.multiply(t,D,J)}else V=i.elevation.getAtPointOrZero(new mr(v.x/z,v.y/z),0);V!==0&&(t[14]+=V)}}function qu(t,e,i=!1){t.uploaded||(t.gfxTexture=new Ff(e,t.image,i?e.gl.R8:e.gl.RGBA,{useMipmap:t.sampler.minFilter>=e.gl.NEAREST_MIPMAP_NEAREST}),t.uploaded=!0,t.image=null)}function Cv(t,e,i){t.indexBuffer=e.createIndexBuffer(t.indexArray,!1,!0),t.vertexBuffer=e.createVertexBuffer(t.vertexArray,vv.members,!1,!0),t.normalArray&&(t.normalBuffer=e.createVertexBuffer(t.normalArray,Ev.members,!1,!0)),t.texcoordArray&&(t.texcoordBuffer=e.createVertexBuffer(t.texcoordArray,Tv.members,!1,!0)),t.colorArray&&(t.colorBuffer=e.createVertexBuffer(t.colorArray,(t.colorArray.bytesPerElement===12?bv:wv).members,!1,!0)),t.featureArray&&(t.pbrBuffer=e.createVertexBuffer(t.featureArray,Mv.members,!0)),t.segments=Fi.simpleSegment(0,0,t.vertexArray.length,t.indexArray.length);const n=t.material;n.pbrMetallicRoughness.baseColorTexture&&qu(n.pbrMetallicRoughness.baseColorTexture,e),n.pbrMetallicRoughness.metallicRoughnessTexture&&qu(n.pbrMetallicRoughness.metallicRoughnessTexture,e),n.normalTexture&&qu(n.normalTexture,e),n.occlusionTexture&&qu(n.occlusionTexture,e,i),n.emissionTexture&&qu(n.emissionTexture,e)}function jf(t,e,i){if(t.meshes)for(const n of t.meshes)Cv(n,e,i);if(t.children)for(const n of t.children)jf(n,e,i)}function ip(t){if(t.meshes)for(const e of t.meshes)e.indexArray.destroy(),e.vertexArray.destroy(),e.colorArray&&e.colorArray.destroy(),e.normalArray&&e.normalArray.destroy(),e.texcoordArray&&e.texcoordArray.destroy(),e.featureArray&&e.featureArray.destroy();if(t.children)for(const e of t.children)ip(e)}function Gf(t){if(t.meshes)for(const i of t.meshes)i.vertexBuffer&&(i.vertexBuffer.destroy(),i.indexBuffer.destroy(),i.normalBuffer&&i.normalBuffer.destroy(),i.texcoordBuffer&&i.texcoordBuffer.destroy(),i.colorBuffer&&i.colorBuffer.destroy(),i.pbrBuffer&&i.pbrBuffer.destroy(),i.segments.destroy(),i.material&&((e=i.material).pbrMetallicRoughness.baseColorTexture&&e.pbrMetallicRoughness.baseColorTexture.gfxTexture&&e.pbrMetallicRoughness.baseColorTexture.gfxTexture.destroy(),e.pbrMetallicRoughness.metallicRoughnessTexture&&e.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture&&e.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture.destroy(),e.normalTexture&&e.normalTexture.gfxTexture&&e.normalTexture.gfxTexture.destroy(),e.emissionTexture&&e.emissionTexture.gfxTexture&&e.emissionTexture.gfxTexture.destroy(),e.occlusionTexture&&e.occlusionTexture.gfxTexture&&e.occlusionTexture.gfxTexture.destroy()));var e;if(t.children)for(const i of t.children)Gf(i)}class Pv{constructor(e){this._callback=e,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._callback()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._callback()},0))}remove(){this._channel=void 0,this._callback=()=>{}}}class zv{constructor(){this.tasks={},this.taskQueue=[],Cc(["process"],this),this.invoker=new Pv(this.process),this.nextId=0}add(e,i){const n=this.nextId++,a=function({type:l,isSymbolTile:h,zoom:p}){return p=p||0,l==="message"?0:l!=="maybePrepare"||h?l!=="parseTile"||h?l==="parseTile"&&h?300-p:l==="maybePrepare"&&h?400-p:500:200-p:100-p}(i);if(a===0){zn();try{e()}finally{}return null}return this.tasks[n]={fn:e,metadata:i,priority:a,id:n},this.taskQueue.push(n),this.invoker.trigger(),{cancel:()=>{delete this.tasks[n]}}}process(){zn();try{if(this.taskQueue=this.taskQueue.filter(n=>!!this.tasks[n]),!this.taskQueue.length)return;const e=this.pick();if(e===null)return;const i=this.tasks[e];if(delete this.tasks[e],this.taskQueue.length&&this.invoker.trigger(),!i)return;i.fn()}finally{}}pick(){let e=null,i=1/0;for(let a=0;a<this.taskQueue.length;a++){const l=this.tasks[this.taskQueue[a]];l.priority<i&&(i=l.priority,e=a)}if(e===null)return null;const n=this.taskQueue[e];return this.taskQueue.splice(e,1),n}remove(){this.invoker.remove()}}class Ug{constructor(e,i,n){this.target=e,this.parent=i,this.mapId=n,this.callbacks={},this.cancelCallbacks={},Cc(["receive"],this),this.target.addEventListener("message",this.receive,!1),this.scheduler
7=new zv}send(e,i,n,a,l=!1,h){const p=Math.round(1e18*Math.random()).toString(36).substring(0,10);n&&(n.metadata=h,this.callbacks[p]=n);const m=new Set;return this.target.postMessage({id:p,type:e,hasCallback:!!n,targetMapId:a,mustQueue:l,sourceMapId:this.mapId,data:Ma(i,m)},m),{cancel:()=>{n&&delete this.callbacks[p],this.target.postMessage({id:p,type:"<cancel>",targetMapId:a,sourceMapId:this.mapId})}}}receive(e){const i=e.data,n=i.id;if(n&&(!i.targetMapId||this.mapId===i.targetMapId))if(i.type==="<cancel>"){const a=this.cancelCallbacks[n];delete this.cancelCallbacks[n],a&&a.cancel()}else if(i.mustQueue||zn()){const a=this.callbacks[n],l=this.scheduler.add(()=>this.processTask(n,i),a&&a.metadata||{type:"message"});l&&(this.cancelCallbacks[n]=l)}else this.processTask(n,i)}processTask(e,i){if(delete this.cancelCallbacks[e],i.type==="<response>"){const n=this.callbacks[e];delete this.callbacks[e],n&&(i.error?n(c(i.error)):n(null,c(i.data)))}else{const n=new Set,a=i.hasCallback?(h,p)=>{this.target.postMessage({id:e,type:"<response>",sourceMapId:this.mapId,error:h?Ma(h):null,data:Ma(p,n)},n)}:h=>{},l=c(i.data);if(this.parent[i.type])this.parent[i.type](i.sourceMapId,l,a);else if(this.parent.getWorkerSource){const h=i.type.split(".");this.parent.getWorkerSource(i.sourceMapId,h[0],l.source,l.scope)[h[1]](l,a)}else a(new Error(`Could not find function ${i.type}`))}}remove(){this.scheduler.remove(),this.target.removeEventListener("message",this.receive,!1)}}class pc{constructor(e,i){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=Qt();const n=this.workerPool.acquire(this.id);for(let a=0;a<n.length;a++){const l=new pc.Actor(n[a],i,this.id);l.name=`Worker ${a}`,this.actors.push(l)}this.ready=!1,this.broadcast("checkIfReady",null,()=>{this.ready=!0})}broadcast(e,i,n){Ac(this.actors,(a,l)=>{a.send(e,i,l)},n=n||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(){this.actors.forEach(e=>{e.remove()}),this.actors=[],this.workerPool.release(this.id)}}pc.Actor=Ug;var Zu={workerUrl:"",workerClass:null,workerParams:void 0};function Dv(){return Zu.workerClass!=null?new Zu.workerClass:new self.Worker(Zu.workerUrl,Zu.workerParams)}const qf="mapboxgl_preloaded_worker_pool";class $u{constructor(){this.active={}}acquire(e){if(!this.workers)for(this.workers=[];this.workers.length<$u.workerCount;)this.workers.push(new Dv);return this.active[e]=!0,this.workers.slice()}release(e){delete this.active[e],this.workers&&this.numActive()===0&&(this.workers.forEach(i=>{i.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[qf]}numActive(){return Object.keys(this.active).length}}let Wu;function rp(){return Wu||(Wu=new $u),Wu}$u.workerCount=2;let np,Zf,Vn,fc,$f,mc=null;function jg(){return zn()&&self.worker&&self.worker.dracoUrl?self.worker.dracoUrl:Zf||Tt.DRACO_URL}function Gg(){if(zn()&&self.worker&&self.worker.meshoptUrl)return self.worker.meshoptUrl;if(fc)return fc;const t=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]);if(typeof WebAssembly!="object")throw new Error("WebAssembly not supported, cannot instantiate meshoptimizer");return fc=WebAssembly.validate(t)?Tt.MESHOPT_SIMD_URL:Tt.MESHOPT_URL,fc}const sp={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},Rv={5120:"DT_INT8",5121:"DT_UINT8",5122:"DT_INT16",5123:"DT_UINT16",5125:"DT_UINT32",5126:"DT_FLOAT32"},Qu={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16};function qg(t,e,i){const n=i.json.bufferViews.length,a=i.buffers.length;e.bufferView=n,i.json.bufferViews[n]={buffer:a,byteLength:t.byteLength},i.buffers[a]=t}const Wf="KHR_draco_mesh_compression";function Lv(t,e){const i=t.extensions&&t.extensions[Wf];if(!i)return;const n=new Vn.Decoder,a=Qg(e,i.bufferView),l=new Vn.Mesh;if(!n.DecodeArrayToMesh(a,a.byteLength,l))throw new Error("Failed to decode Draco mesh");const h=e.json.accessors[t.indices],p=sp[h.componentType],m=h.count*p.BYTES_PER_ELEMENT,g=Vn._malloc(m);p===Uint16Array?n.GetTrianglesUInt16Array(l,m,g):n.GetTrianglesUInt32Array(l,m,g),qg(Vn.memory.buffer.slice(g,g+m),h,e),Vn._free(g);for(const x of Object.keys(i.attributes)){const v=n.GetAttributeByUniqueId(l,i.attributes[x]),w=e.json.accessors[t.attributes[x]],E=Rv[w.componentType],M=w.count*Qu[w.type]*sp[w.componentType].BYTES_PER_ELEMENT,I=Vn._malloc(M);n.GetAttributeDataArrayForAllPoints(l,v,Vn[E],M,I),qg(Vn.memory.buffer.slice(I,I+M),w,e),Vn._free(I)}n.destroy(),l.destroy(),delete t.extensions[Wf]}const op="EXT_meshopt_compression";function kv(t,e){if(!t.extensions||!t.extensions[op])return;const i=t.extensions[op],n=new Uint8Array(e.buffers[i.buffer],i.byteOffset||0,i.byteLength||0),a=new Uint8Array(i.count*i.byteStride);$f.decodeGltfBuffer(a,i.count,i.byteStride,n,i.mode,i.filter),t.buffer=e.buffers.length,t.byteOffset=0,e.buffers[t.buffer]=a.buffer,delete t.extensions[op]}const Zg=1179937895,$g=new TextDecoder("utf8");function Wg(t,e){return new URL(t,e).href}function Ov(t,e,i,n){return fetch(Wg(t.uri,n)).then(a=>a.arrayBuffer()).then(a=>{e.buffers[i]=a})}function Qg(t,e){const i=t.json.bufferViews[e];return new Uint8Array(t.buffers[i.buffer],i.byteOffset||0,i.byteLength)}function Bv(t,e,i,n){if(t.uri){const a=Wg(t.uri,n);return fetch(a).then(l=>l.blob()).then(l=>createImageBitmap(l)).then(l=>{e.images[i]=l})}if(t.bufferView!==void 0){const a=Qg(e,t.bufferView),l=new Blob([a],{type:t.mimeType});
7return createImageBitmap(l).then(h=>{e.images[i]=h})}}function Hg(t,e=0,i){const n={json:null,images:[],buffers:[]};if(new Uint32Array(t,e,1)[0]===Zg){const x=new Uint32Array(t,e);let v=2;const w=(x[v++]>>2)-3,E=x[v++]>>2;if(v++,n.json=JSON.parse($g.decode(x.subarray(v,v+E))),v+=E,v<w){const M=x[v++];v++;const I=e+(v<<2);n.buffers[0]=t.slice(I,I+M)}}else n.json=JSON.parse($g.decode(new Uint8Array(t,e)));const{buffers:a,images:l,meshes:h,extensionsUsed:p,bufferViews:m}=n.json;let g=Promise.resolve();if(a){const x=[];for(let v=0;v<a.length;v++){const w=a[v];w.uri?x.push(Ov(w,n,v,i)):n.buffers[v]||(n.buffers[v]=null)}g=Promise.all(x)}return g.then(()=>{const x=[],v=p&&p.includes(Wf),w=p&&p.includes(op);if(v&&x.push(function(){if(!Vn)return np||(np=function(E){let M,I=null;function z(){M=new Uint8Array(I.buffer)}function D(){throw new Error("Unexpected Draco error.")}const F={a:{a:D,d:function(j,V,X){return M.copyWithin(j,V,V+X)},c:function(j){const V=M.length,X=Math.max(j>>>0,Math.ceil(1.2*V)),q=Math.ceil((X-V)/65536);try{return I.grow(q),z(),!0}catch{return!1}},b:D}};return(WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(E,F):E.then(j=>j.arrayBuffer()).then(j=>WebAssembly.instantiate(j,F))).then(j=>{const{Rb:V,Qb:X,P:q,T:J,X:ee,Ja:oe,La:fe,Qa:le,Va:ge,Wa:_e,eb:me,jb:Ee,f:we,e:Ce,yb:Ae,zb:ye,Ab:Ye,Bb:$e,Db:ze,Gb:ct}=j.instance.exports;I=Ce;const it=(()=>{let Je=0,De=0,ot=0,bt=0;return pt=>{ot&&(V(bt),V(Je),De+=ot,ot=Je=0),Je||(De+=128,Je=X(De));const Mt=pt.length+7&-8;let wt=Je;Mt>=De&&(ot=Mt,wt=bt=X(Mt));for(let Rt=0;Rt<pt.length;Rt++)M[wt+Rt]=pt[Rt];return wt}})();return z(),we(),{memory:Ce,_free:V,_malloc:X,Mesh:class{constructor(){this.ptr=q()}destroy(){J(this.ptr)}},Decoder:class{constructor(){this.ptr=oe()}destroy(){Ee(this.ptr)}DecodeArrayToMesh(Je,De,ot){const bt=it(Je),pt=fe(this.ptr,bt,De,ot.ptr);return!!ee(pt)}GetAttributeByUniqueId(Je,De){return{ptr:le(this.ptr,Je.ptr,De)}}GetTrianglesUInt16Array(Je,De,ot){ge(this.ptr,Je.ptr,De,ot)}GetTrianglesUInt32Array(Je,De,ot){_e(this.ptr,Je.ptr,De,ot)}GetAttributeDataArrayForAllPoints(Je,De,ot,bt,pt){me(this.ptr,Je.ptr,De.ptr,ot,bt,pt)}},DT_INT8:Ae(),DT_UINT8:ye(),DT_INT16:Ye(),DT_UINT16:$e(),DT_UINT32:ze(),DT_FLOAT32:ct()}})}(fetch(jg())),np.then(E=>{Vn=E,np=void 0}))}()),w&&x.push(function(){if($f)return;const E=function(M){let I;const z=WebAssembly.instantiateStreaming(M,{}).then(j=>{I=j.instance,I.exports.__wasm_call_ctors()}),D={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},F={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};return{ready:z,supported:!0,decodeGltfBuffer(j,V,X,q,J,ee){(function(oe,fe,le,ge,_e,me,Ee){const we=oe.exports.sbrk,Ce=ge+3&-4,Ae=we(Ce*_e),ye=we(me.length),Ye=new Uint8Array(oe.exports.memory.buffer);Ye.set(me,ye);const $e=fe(Ae,ge,_e,ye,me.length);if($e===0&&Ee&&Ee(Ae,Ce,_e),le.set(Ye.subarray(Ae,Ae+ge*_e)),we(Ae-we(0)),$e!==0)throw new Error(`Malformed buffer data: ${$e}`)})(I,I.exports[F[J]],j,V,X,q,I.exports[D[ee]])}}}(fetch(Gg()));return E.ready.then(()=>{$f=E})}()),l)for(let E=0;E<l.length;E++)x.push(Bv(l[E],n,E,i));return(x.length?Promise.all(x):Promise.resolve()).then(()=>{if(v&&h)for(const{primitives:E}of h)for(const M of E)Lv(M,n);if(w&&h&&m)for(const E of m)kv(E,n);return n})})}class Xg{constructor(e,i,n,a){if(this.triangleCount=i.length/3,this.min=new Ne(0,0),this.max=new Ne(0,0),this.xScale=0,this.yScale=0,this.cellsX=0,this.cellsY=0,this.cells=[],this.payload=[],this.triangleCount===0||e.length===0)return;const[l,h]=[e[0].clone(),e[0].clone()];for(let v=1;v<e.length;++v){const w=e[v];l.x=Math.min(l.x,w.x),l.y=Math.min(l.y,w.y),h.x=Math.max(h.x,w.x),h.y=Math.max(h.y,w.y)}if(a){const v=Math.ceil(Math.max(h.x-l.x,h.y-l.y)/a);n=Math.max(n,v)}if(n===0)return;this.min=l,this.max=h;const p=this.max.sub(this.min);p.x=Math.max(p.x,1),p.y=Math.max(p.y,1);const m=Math.max(p.x,p.y)/n;this.cellsX=Math.max(1,Math.ceil(p.x/m)),this.cellsY=Math.max(1,Math.ceil(p.y/m)),this.xScale=1/m,this.yScale=1/m;const g=[];for(let v=0;v<this.triangleCount;v++){const w=e[i[3*v+0]].sub(this.min),E=e[i[3*v+1]].sub(this.min),M=e[i[3*v+2]].sub(this.min),I=zo(Math.floor(Math.min(w.x,E.x,M.x)),this.xScale,this.cellsX),z=zo(Math.floor(Math.max(w.x,E.x,M.x)),this.xScale,this.cellsX),D=zo(Math.floor(Math.min(w.y,E.y,M.y)),this.yScale,this.cellsY),F=zo(Math.floor(Math.max(w.y,E.y,M.y)),this.yScale,this.cellsY),j=new Ne(0,0),V=new Ne(0,0),X=new Ne(0,0),q=new Ne(0,0);for(let J=D;J<=F;++J){j.y=V.y=J*m,X.y=q.y=(J+1)*m;for(let ee=I;ee<=z;++ee)j.x=X.x=ee*m,V.x=q.x=(ee+1)*m,(rf(w,E,M,j,V,q)||rf(w,E,M,j,q,X))&&g.push({cellIdx:J*this.cellsX+ee,triIdx:v})}}if(g.length===0)return;g.sort((v,w)=>v.cellIdx-w.cellIdx||v.triIdx-w.triIdx);let x=0;for(;x<g.length;){const v=g[x].cellIdx,w={start:this.payload.length,len:0};for(;x<g.length&&g[x].cellIdx===v;)++w.len,this.payload.push(g[x++].triIdx);this.cells[v]=w}}query(e,i,n){if(this.triangleCount===0||this.cells.length===0||e.x>this.max.x||this.min.x>i.x||e.y>this.max.y||this.min.y>i.y)return;this.lookup||(this.lookup=new Uint8Array(Math.ceil(this.triangleCount/8)));for(let m=0;m<this.lookup.length;m++)this.lookup[m]=0;const a=zo(e.x-this.min.x,this.xScale,this.cellsX),l=zo(i.x-this.min.x,this.xScale,this.cellsX),h=zo(e.y-this.min.y,this.yScale,this.cellsY),p=zo(i.y-this.min.y,this.yScale,this.cellsY);for(let m=h;m<=p;m++)for(let g=a;g<=l;g++){const x=this.cells[m*this.cellsX+g];if(x)for(let v=0;v<x.len;v++){const w=this.payload[x.start+v],E=Math.floor(w/8),M=1<<w%8;if(!(this.lookup[E]&M)&&(this.lookup[E]|=M,n.push(w),n.length===this.triangleCount))return}}}}function zo(t,e,i){return Math.max(0,Math.min(i-1,Math.floor(t*e)))}function Na(t,e){const i=t.json.bufferViews[e.bufferView],n=sp[e.componentType];return new n(t.buffers[i.buffer],(e.byteOffset||0)+(i.byteOffset||0),e.count*(i.byteStride&&i.byteStride!==Qu[e.type]*n.BYTES_PER_ELEMENT?i.byteStride/n.BYTES_PER_ELEMENT:Qu[e.type]))}function Qf(t,e,i,n){const a=sp[e.componentType],l=function(x){switch(x){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:return 1}}(a),h=t.json.bufferViews[e.bufferView],p=h.byteStride?h.byteStride/a.BYTES_PER_ELEMENT:Qu[e.type],m=i.float32,g=m.length/i.capacity;for(let x=0,v=0;x<e.count*p;x+=p,v+=g)for(let w=0;w<g;w++)m[v+w]=n[x+w]*l;i._trim()}function Fv(t,e,i){const n=t.indices,a=t.attributes,l={};l.indexArray=new Xi;const h=e.json.accessors[n],p=h.count/3;l.indexArray.reserve(p);const m=Na(e,h);for(let w=0;w<p;w++)l.indexArray.emplaceBack(m[3*w],m[3*w+1],m[3*w+2]);l.indexArray._trim(),l.vertexArray=new za;const g=e.json.accessors[a.POSITION];l.vertexArray.reserve(g.count);const x=Na(e,g);for(let w=0;w<g.count;w++)l.vertexArray.emplaceBack(x[3*w],x[3*w+1],x[3*w+2]);if(l.vertexArray._trim(),l.aabb=new wi(g.min,g.max),l.centroid=function(w,E){const M=[0,0,0],I=w.length;if(I>0){for(let z=0;z<I;z++){const D=3*w[z];M[0]+=E[D],M[1]+=E[D+1],M[2]+=E[D+2]}M[0]/=I,M[1]/=I,M[2]/=I}return M}(m,x),a.COLOR_0!==void 0){const w=e.json.accessors[a.COLOR_0],E=Qu[w.type],M=Na(e,w);l.colorArray=E===3?new za:new Hi,l.colorArray.resize(w.count),Qf(e,w,l.colorArray,M)}if(a.NORMAL!==void 0){l.normalArray=new za;const w=e.json.accessors[a.NORMAL];l.normalArray.resize(w.count);const E=Na(e,w);Qf(e,w,l.normalArray,E)}if(a.TEXCOORD_0!==void 0&&i.length>0){l.texcoordArray=new er;const w=e.json.accessors[a.TEXCOORD_0];l.texcoordArray.resize(w.count);const E=Na(e,w);Qf(e,w,l.texcoordArray,E)}if(a._FEATURE_ID_RGBA4444!==void 0){const w=e.json.accessors[a._FEATURE_ID_RGBA4444];e.json.extensionsUsed&&e.json.extensionsUsed.includes("EXT_meshopt_compression")&&(l.featureData=Na(e,w))}a._FEATURE_RGBA4444!==void 0&&(l.featureData=new Uint32Array(Na(e,e.json.accessors[a._FEATURE_RGBA4444]).buffer));const v=t.material;return l.material=function(w,E){const{emissiveFactor:M=[0,0,0],alphaMode:I="OPAQUE",alphaCutoff:z=.5,normalTexture:D,occlusionTexture:F,emissiveTexture:j,doubleSided:V}=w,{baseColorFactor:X=[1,1,1,1],metallicFactor:q=1,roughnessFactor:J=1,baseColorTexture:ee,metallicRoughnessTexture:oe}=w.pbrMetallicRoughness||{},fe=F?E[F.index]:void 0;if(F&&F.extensions&&F.extensions.KHR_texture_transform&&fe){const le=F.extensions.KHR_texture_transform;fe.offsetScale=[le.offset[0],le.offset[1],le.scale[0],le.scale[1]]}return{pbrMetallicRoughness:{baseColorFactor:new ti(...X),metallicFactor:q,roughnessFactor:J,baseColorTexture:ee?E[ee.index]:void 0,metallicRoughnessTexture:oe?E[oe.index]:void 0},doubleSided:V,emissiveFactor:M,alphaMode:I,alphaCutoff:z,normalTexture:D?E[D.index]:void 0,occlusionTexture:fe,emissionTexture:j?E[j.index]:void 0,defined:w.defined===void 0}}(v!==void 0?e.json.materials[v]:{defined:!1},i),l}function Yg(t,e,i){const{matrix:n,rotation:a,translation:l,scale:h,mesh:p,extras:m,children:g}=t,x={};if(x.matrix=n||o.a9.fromRotationTranslationScale([],a||[0,0,0,1],l||[0,0,0],h||[1,1,1]),p!==void 0){x.meshes=i[p];
vendor: 7,787 bytes, line 7
7const v=x.anchor=[0,0];for(const w of x.meshes){const{min:E,max:M}=w.aabb;v[0]+=E[0]+M[0],v[1]+=E[1]+M[1]}v[0]=Math.floor(v[0]/x.meshes.length/2),v[1]=Math.floor(v[1]/x.meshes.length/2)}if(m&&(m.id&&(x.id=m.id),m.lights&&(x.lights=function(v){if(!v.length)return[];const w=function(D){const F=atob(D),j=new Uint8Array(F.length);for(let V=0;V<F.length;V++)j[V]=F.codePointAt(V);return j}(v),E=[],M=w.length/24,I=new Uint16Array(w.buffer),z=new Float32Array(w.buffer);for(let D=0;D<M;D++){const F=I[2*D*6]/30,j=I[2*D*6+1]/30,V=I[2*D*6+10]/100,X=z[6*D+1],q=z[6*D+2],J=z[6*D+3],ee=z[6*D+4],oe=J-X,fe=ee-q,le=Math.hypot(oe,fe);E.push({pos:[X+.5*oe,q+.5*fe,j],normal:[fe/le,-oe/le,0],width:le,height:F,depth:V,points:[X,q,J,ee]})}return E}(m.lights))),g){const v=[];for(const w of g)v.push(Yg(e.json.nodes[w],e,i));x.children=v}return x}function Nv(t){if(t.vertices.length===0||t.indices.length===0)return null;const e=new Xg(t.vertices,t.indices,8,256),[i,n]=[e.min.clone(),e.max.clone()];return{vertices:t.vertices,indices:t.indices,grid:e,min:i,max:n}}function Vv(t){if(!t.extras||!t.extras.ground)return null;const e=t.extras.ground;if(!e||!Array.isArray(e)||e.length===0)return null;const i=e[0];if(!i||!Array.isArray(i)||i.length===0)return null;const n=[];for(const h of i){if(!Array.isArray(h)||h.length!==2)continue;const p=h[0],m=h[1];typeof p=="number"&&typeof m=="number"&&n.push(new Ne(p,m))}if(n.length<3)return null;n.length>1&&n[n.length-1].equals(n[0])&&n.pop();let a=0;for(let h=0;h<n.length;h++){const p=n[h],m=n[(h+1)%n.length],g=n[(h+2)%n.length];a+=(p.x-m.x)*(g.y-m.y)-(g.x-m.x)*(p.y-m.y)}a>0&&n.reverse();const l=Md(n.flatMap(h=>[h.x,h.y]),[]);return l.length===0?null:{vertices:n,indices:l}}function Uv(t,e){const i=[],n=[];let a=0;const l=[];for(const h of t){a=i.length;const p=h.vertexArray.float32,m=h.indexArray.uint16;for(let g=0;g<h.vertexArray.length;g++)l[0]=p[3*g+0],l[1]=p[3*g+1],l[2]=p[3*g+2],o.Q.transformMat4(l,l,e),i.push(new Ne(l[0],l[1]));for(let g=0;g<3*h.indexArray.length;g++)n.push(m[g]+a)}if(n.length%3!=0)return null;for(let h=0;h<n.length;h+=3){const p=i[n[h+0]],m=i[n[h+1]],g=i[n[h+2]];(p.x-m.x)*(g.y-m.y)-(g.x-m.x)*(p.y-m.y)>0&&([n[h+1],n[h+2]]=[n[h+2],n[h+1]])}return{vertices:i,indices:n}}function Jg(t){const e=function(m,g){const x=[],v=WebGL2RenderingContext;if(m.json.textures)for(const w of m.json.textures){const E={magFilter:v.LINEAR,minFilter:v.NEAREST,wrapS:v.REPEAT,wrapT:v.REPEAT};w.sampler!==void 0&&Object.assign(E,m.json.samplers[w.sampler]),x.push({image:g[w.source],sampler:E,uploaded:!1})}return x}(t,t.images),i=function(m,g){const x=[];for(const v of m.json.meshes){const w=[];for(const E of v.primitives)w.push(Fv(E,m,g));x.push(w)}return x}(t,e),{scenes:n,scene:a,nodes:l}=t.json,h=n?n[a||0].nodes:l,p=[];for(const m of h)p.push(Yg(l[m],t,i));return function(m,g,x){const v={},w=new Set;for(let E=0;E<m.length;E++){const M=x[g[E]];if(!M.extras)continue;const I=M.extras["mapbox:footprint:version"],z=M.extras["mapbox:footprint:id"];(I||z)&&w.add(E),I==="1.0.0"&&z&&(v[z]=E)}for(let E=0;E<m.length;E++){if(w.has(E))continue;const M=m[E],I=x[g[E]];if(!I.extras)continue;let z=null;M.id in v&&(z=Uv(m[v[M.id]].meshes,M.matrix)),z||(z=Vv(I)),z&&(M.footprint=Nv(z))}if(w.size>0){const E=Array.from(w.values()).sort((M,I)=>M-I);for(let M=E.length-1;M>=0;M--)m.splice(E[M],1)}}(p,h,t.json.nodes),p}function jv(t){t.heightmap=new Float32Array(4096),t.heightmap.fill(-1);const e=t.vertexArray.float32,i=t.aabb.min[0]-1,n=t.aabb.min[1]-1,a=Fa/(t.aabb.max[0]-i+2),l=Fa/(t.aabb.max[1]-n+2);for(let h=0;h<e.length;h+=3){const p=e[h+2],m=(e[h+0]-i)*a|0,g=(e[h+1]-n)*l|0;p>t.heightmap[g*Fa+m]&&(t.heightmap[g*Fa+m]=p)}}function Gv(t,e){const i={};i.indexArray=new Xi,i.indexArray.reserve(4*t.length),i.vertexArray=new za,i.vertexArray.reserve(10*t.length),i.colorArray=new Hi,i.vertexArray.reserve(10*t.length);let n=0;for(const h of t){const p=Math.min(10,Math.max(4,1.3*h.height))*e,m=[-h.normal[1],h.normal[0],0],g=Math.min(.29,.1*h.width/h.depth),x=h.width-2*h.depth*e*(g+.01),v=o.Q.scaleAndAdd([],h.pos,m,x/2),w=o.Q.scaleAndAdd([],h.pos,m,-x/2),E=[v[0],v[1],v[2]+h.height],M=[w[0],w[1],w[2]+h.height],I=o.Q.scaleAndAdd([],h.normal,m,g);o.Q.scale(I,I,p);const z=o.Q.scaleAndAdd([],h.normal,m,-g);o.Q.scale(z,z,p),o.Q.add(I,v,I),o.Q.add(z,w,z),v[2]+=.1,w[2]+=.1,i.vertexArray.emplaceBack(I[0],I[1],I[2]),i.vertexArray.emplaceBack(z[0],z[1],z[2]),i.vertexArray.emplaceBack(v[0],v[1],v[2]),i.vertexArray.emplaceBack(w[0],w[1],w[2]),i.vertexArray.emplaceBack(E[0],E[1],E[2]),i.vertexArray.emplaceBack(M[0],M[1],M[2]),i.vertexArray.emplaceBack(v[0],v[1],v[2]),i.vertexArray.emplaceBack(w[0],w[1],w[2]),i.vertexArray.emplaceBack(I[0],I[1],I[2]),i.vertexArray.emplaceBack(z[0],z[1],z[2]);const D=x/p/2;i.colorArray.emplaceBack(-D-g,-1,D,.8),i.colorArray.emplaceBack(D+g,-1,D,.8),i.colorArray.emplaceBack(-D,0,D,1.3),i.colorArray.emplaceBack(D,0,D,1.3),i.colorArray.emplaceBack(D+g,-.8,D,.7),i.colorArray.emplaceBack(D+g,-.8,D,.7),i.colorArray.emplaceBack(0,0,D,1.3),i.colorArray.emplaceBack(0,0,D,1.3),i.colorArray.emplaceBack(D+g,-1.2,D,.8),i.colorArray.emplaceBack(D+g,-1.2,D,.8),i.indexArray.emplaceBack(6+n,4+n,8+n),i.indexArray.emplaceBack(7+n,9+n,5+n),i.indexArray.emplaceBack(0+n,1+n,2+n),i.indexArray.emplaceBack(1+n,3+n,2+n),n+=10}const a={defined:!0,emissiveFactor:[0,0,0]},l={};return l.baseColorFactor=ti.white,a.pbrMetallicRoughness=l,i.material=a,i.aabb=new wi([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),i}Qe(Xg,"TriangleGridIndex");class Kg{constructor(e){this._stringToNumber={},this._numberToString=[];for(let i=0;i<e.length;i++){const n=e[i];this._stringToNumber[n]=i,this._numberToString[i]=n}}encode(e){return this._stringToNumber[e]}decode(e){return this._numberToString[e]}}const qv=["tile","layer","source","sourceLayer","state"];class ey{constructor(e,i,n,a,l){this.type="Feature",this._vectorTileFeature=e,this._z=i,this._x=n,this._y=a,this.properties=e.properties,this.id=l}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._x,this._y,this._z).geometry),this._geometry}set geometry(e){this._geometry=e}toJSON(){const e={type:"Feature",state:void 0,geometry:this.geometry,properties:this.properties};this.id!==void 0&&(e.id=this.id);for(const i of qv)this[i]!==void 0&&(e[i]=this[i]);return e}}class ty{constructor(e,i){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new mo(Ve,16,0),this.featureIndexArray=new _m,this.promoteId=i,this.is3DTile=!1}insert(e,i,n,a,l,h=0,p=0){const m=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(n,a,l,h);const g=this.grid;for(let x=0;x<i.length;x++){const v=i[x],w=[1/0,1/0,-1/0,-1/0];for(let E=0;E<v.length;E++){const M=v[E];w[0]=Math.min(w[0],M.x),w[1]=Math.min(w[1],M.y),w[2]=Math.max(w[2],M.x),w[3]=Math.max(w[3],M.y)}p!==0&&(w[0]-=p,w[1]-=p,w[2]+=p,w[3]+=p),w[0]<Ve&&w[1]<Ve&&w[2]>=0&&w[3]>=0&&g.insert(m,w[0],w[1],w[2],w[3])}}loadVTLayers(){if(!this.vtLayers){this.vtLayers=new bf(new ac(this.rawTileData)).layers,this.sourceLayerCoder=new Kg(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"]),this.vtFeatures={};for(const e in this.vtLayers)this.vtFeatures[e]=[]}return this.vtLayers}query(e,i,n,a){this.loadVTLayers();const l=e.params||{},h=Ge(l.filter),p=e.tileResult,m=e.transform,g=p.bufferedTilespaceBounds,x=this.grid.query(g.min.x,g.min.y,g.max.x,g.max.y,(M,I,z,D)=>Lm(p.bufferedTilespaceGeometry,M,I,z,D));x.sort(Zv);let v=null;m.elevation&&x.length>0&&(v=ic.create(m.elevation,this.tileID));const w={};let E;for(let M=0;M<x.length;M++){const I=x[M];if(I===E)continue;E=I;const z=this.featureIndexArray.get(I);let D=null;if(this.is3DTile){const F=this.bucketLayerIDs[0][0],j=i[F];if(j.type!=="model")continue;const{queryFeature:V,intersectionZ:X}
7=j.queryIntersectsMatchingFeature(p,z.featureIndex,h,m);V&&this.appendToResult(w,F,z.featureIndex,V,X)}else this.loadMatchingFeature(w,z,h,l.layers,l.availableImages,i,n,a,(F,j,V,X=0)=>(D||(D=Ls(F,this.tileID.canonical,e.tileTransform)),j.queryIntersectsFeature(p,F,V,D,this.z,e.transform,e.pixelPosMatrix,v,X)))}return w}loadMatchingFeature(e,i,n,a,l,h,p,m,g){const{featureIndex:x,bucketIndex:v,sourceLayerIndex:w,layoutVertexArrayOffset:E}=i,M=this.bucketLayerIDs[v];if(a&&!function(F,j){for(let V=0;V<F.length;V++)if(j.indexOf(F[V])>=0)return!0;return!1}(a,M))return;const I=this.sourceLayerCoder.decode(w),z=this.vtLayers[I].feature(x);if(n.needGeometry){const F=wo(z,!0);if(!n.filter(new B(this.tileID.overscaledZ),F,this.tileID.canonical))return}else if(!n.filter(new B(this.tileID.overscaledZ),z))return;const D=this.getId(z,I);for(let F=0;F<M.length;F++){const j=M[F];if(a&&a.indexOf(j)<0)continue;const V=h[j];if(!V)continue;let X={};D!==void 0&&m&&(X=m.getState(V.sourceLayer||"_geojsonTileLayer",D));const q=!g||g(z,V,X,E);if(!q)continue;const J=new ey(z,this.z,this.x,this.y,D),ee=Gr({},p[j]);ee.paint=iy(ee.paint,V.paint,z,X,l),ee.layout=iy(ee.layout,V.layout,z,X,l),J.layer=ee,this.appendToResult(e,j,x,J,q)}}appendToResult(e,i,n,a,l){let h=e[i];h===void 0&&(h=e[i]=[]),h.push({featureIndex:n,feature:a,intersectionZ:l})}lookupSymbolFeatures(e,i,n,a,l,h,p,m){const g={};this.loadVTLayers();const x=Ge(l);for(const v of e)this.loadMatchingFeature(g,{bucketIndex:n,sourceLayerIndex:a,featureIndex:v,layoutVertexArrayOffset:0},x,h,p,m,i);return g}loadFeature(e){const{featureIndex:i,sourceLayerIndex:n}=e;this.loadVTLayers();const a=this.sourceLayerCoder.decode(n),l=this.vtFeatures[a];if(l[i])return l[i];const h=this.vtLayers[a].feature(i);return l[i]=h,h}hasLayer(e){for(const i of this.bucketLayerIDs)for(const n of i)if(e===n)return!0;return!1}getId(e,i){let n=e.id;if(this.promoteId){const a=typeof this.promoteId=="string"?this.promoteId:this.promoteId[i];a!=null&&(n=e.properties[a]),typeof n=="boolean"&&(n=Number(n))}return n}}function iy(t,e,i,n,a){return $s(t,(l,h)=>{const p=e instanceof pe?e.get(h):null;return p&&p.evaluate?p.evaluate(i,n,a):p})}function Zv(t,e){return e-t}Qe(ty,"FeatureIndex",{omit:["rawTileData","sourceLayerCoder"]});const Hf=new Float32Array(262144),Va=new Uint8Array(262144);function ry(t){let e=0;if(t.meshes)for(const i of t.meshes)e=Math.max(e,i.aabb.max[2]);if(t.children)for(const i of t.children)e=Math.max(e,ry(i));return e}function ny(t,e,i){if(t.meshes)for(const n of t.meshes)n.aabb.min[0]!==1/0&&i.insert(e,n.aabb.min[0],n.aabb.min[1],n.aabb.max[0],n.aabb.max[1]);if(t.children)for(const n of t.children)ny(n,e,i)}const sy=["","wall","door","roof","window","lamp","logo"];class oy{constructor(e){this.node=e,this.evaluatedRMEA=[[1,0,0,1],[1,0,0,1],[1,0,0,1],[1,0,0,1],[.4,1,0,1],[1,0,0,1],[1,0,0,1]],this.hiddenByReplacement=!1,this.evaluatedScale=[1,1,1],this.evaluatedColor=[],this.emissionHeightBasedParams=[],this.feature={type:"Point",id:e.id,geometry:[],properties:{height:ry(e)}}}getLocalBounds(){if(!this.node.meshes)return new wi([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);if(!this.aabb){let e=0;const i=new wi([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);for(const n of this.node.meshes)this.node.lightMeshIndex!==e&&i.encapsulate(n.aabb),e++;this.aabb=wi.applyTransform(i,this.node.matrix)}return this.aabb}}class ap{constructor(e,i,n,a,l,h){this.id=i,this.modelTraits|=dc.CoordinateSpaceTile,this.uploaded=!1,this.hasPattern=!1,n&&(this.modelTraits|=dc.HasMapboxMeshFeatures),a&&(this.modelTraits|=dc.HasMeshoptCompression),this.zoom=-1,this.terrainExaggeration=1,this.projection={name:"mercator"},this.replacementUpdateTime=0,this.elevationReadFromZ=255,this.brightness=l,this.dirty=!0,this.needsUpload=!1,this.nodesInfo=[];for(const p of e)this.nodesInfo.push(new oy(p)),ny(p,h.featureIndexArray.length,h.grid),h.featureIndexArray.emplaceBack(this.nodesInfo.length-1,0,h.bucketLayerIDs.length-1,0)}update(){console.log("Update 3D model bucket")}populate(){console.log("populate 3D model bucket")}uploadPending(){return!this.uploaded||this.needsUpload}upload(e){if(!this.needsUpload)return;const i=this.getNodesInfo();for(const n of i){const a=n.node;this.uploaded?this.updatePbrBuffer(a):jf(a,e,!0)}for(const n of i)ip(n.node);this.uploaded=!0,this.needsUpload=!1}updatePbrBuffer(e){let i=!1;if(!e.meshes)return i;for(const n of e.meshes)n.pbrBuffer&&(n.pbrBuffer.updateData(n.featureArray),i=!0);return i}needsReEvaluation(e,i,n){const a=e.transform.projectionOptions,l=e.style.getBrightness(),h=this.brightness!==l;return!!(!this.uploaded||this.dirty||a.name!==this.projection.name||Hu(n.paint.get("model-color").value,h)||Hu(n.paint.get("model-color-mix-intensity").value,h)||Hu(n.paint.get("model-roughness").value,h)||Hu(n.paint.get("model-emissive-strength").value,h)||Hu(n.paint.get("model-height-based-emissive-strength-multiplier").value,h))&&(this.projection=a,this.brightness=l,!0)}evaluateScale(e,i){if(e.transform.zoom===this.zoom)return;this.zoom=e.transform.zoom;const n=this.getNodesInfo(),a=this.id.canonical;for(const l of n){const h=l.feature;l.evaluatedScale=i.paint.get("model-scale").evaluate(h,{},a)}}evaluate(e){const i=this.getNodesInfo();for(const n of i){if(!n.node.meshes)continue;const a=n.feature,l=n.node.meshes&&n.node.meshes[0].featureData,h=n.evaluatedColor[2],p=n.evaluatedRMEA[2],m=this.id.canonical;if(n.hasTranslucentParts=!1,l){for(let g=0;g<sy.length;g++){const x=sy[g];x.length&&(a.properties.part=x);const v=e.paint.get("model-color").evaluate(a,{},m),w=e.paint.get("model-color-mix-intensity").evaluate(a,{},m);n.evaluatedColor[g]=[v.r,v.g,v.b,w],n.evaluatedRMEA[g][0]=e.paint.get("model-roughness").evaluate(a,{},m),n.evaluatedRMEA[g][2]=e.paint.get("model-emissive-strength").evaluate(a,{},m),n.evaluatedRMEA[g][3]=v.a,n.emissionHeightBasedParams[g]=e.paint.get("model-height-based-emissive-strength-multiplier").evaluate(a,{},m),!n.hasTranslucentParts&&v.a<1&&(n.hasTranslucentParts=!0)}delete a.properties.part,Wv(n,h!==n.evaluatedColor[2]||p!==n.evaluatedRMEA[2],this.modelTraits)}else n.evaluatedRMEA[0][2]=e.paint.get("model-emissive-strength").evaluate(a,{},m);n.evaluatedScale=e.paint.get("model-scale").evaluate(a,{},m),this.updatePbrBuffer(n.node)||(this.needsUpload=!0)}this.dirty=!1}elevationUpdate(e,i,n,a){const l=e.findDEMTileFor(n);if(l&&(l.tileID.canonical!==this.terrainTile||i!==this.terrainExaggeration)){if
7(l.dem&&l.tileID.overscaledZ!==this.elevationReadFromZ){this.elevationReadFromZ=l.tileID.overscaledZ;const h=ic.create(e,n,l);if(!h)return;this.modelTraits&dc.HasMapboxMeshFeatures&&this.updateDEM(e,h,n,a);for(const p of this.getNodesInfo()){const m=p.node;if(!m.footprint||!m.footprint.vertices||!m.footprint.vertices.length)continue;const g=m.footprint.vertices;let x=h.getElevationAt(g[0].x,g[0].y,!0,!0);for(let v=1;v<g.length;v++)x=Math.min(x,h.getElevationAt(g[v].x,g[v].y,!0,!0));m.elevation=x}}this.terrainTile=l.tileID.canonical,this.terrainExaggeration=i}}updateDEM(e,i,n,a){let l=i._dem._modifiedForSources[a];if(l===void 0&&(i._dem._modifiedForSources[a]=[],l=i._dem._modifiedForSources[a]),l.includes(n.canonical))return;const h=i._dem.dim;l.push(n.canonical);let p=!1;for(const m of this.getNodesInfo()){const g=m.node;if(!g.footprint||!g.footprint.grid)continue;const x=g.footprint.grid,v=i.tileCoordToPixel(x.min.x,x.min.y),w=i.tileCoordToPixel(x.max.x,x.max.y),E=Math.min(Math.min(h-w.y,v.x),Math.min(v.y,h-w.x));if(E<0)continue;const M=kt(E,2,5);let I=Math.max(0,v.x-M),z=Math.max(0,v.y-M),D=Math.min(w.x+M,h-1),F=Math.min(w.y+M,h-1);for(let q=z;q<=F;++q)for(let J=I;J<=D;++J)Va[q*h+J]=255;let j=0,V=0;for(let q=0;q<x.cellsY;++q)for(let J=0;J<x.cellsX;++J){if(!x.cells[q*x.cellsX+J])continue;const ee=i.tileCoordToPixel(x.min.x+J/x.xScale,x.min.y+q/x.yScale),oe=i.tileCoordToPixel(x.min.x+(J+1)/x.xScale,x.min.y+(q+1)/x.yScale);for(let fe=ee.y;fe<=Math.min(oe.y+1,h-1);++fe)for(let le=ee.x;le<=Math.min(oe.x+1,h-1);++le)Va[fe*h+le]===255&&(Va[fe*h+le]=0,j+=i.getElevationAtPixel(le,fe),V++)}const X=j/V;I=Math.max(1,v.x-M),z=Math.max(1,v.y-M),D=Math.min(w.x+M,h-2),F=Math.min(w.y+M,h-2),p=!0;for(let q=z;q<=F;++q)for(let J=I;J<=D;++J)Va[q*h+J]===0&&(Hf[q*h+J]=i._dem.set(J,q,X));for(let q=1;q<M;++q){I=Math.max(1,v.x-q),z=Math.max(1,v.y-q),D=Math.min(w.x+q,h-2),F=Math.min(w.y+q,h-2);for(let J=z;J<=F;++J)for(let ee=I;ee<=D;++ee){const oe=J*h+ee;if(Va[oe]===255){let fe=0,le=0,ge=-1,_e=-1;for(let me=-1;me<=1;++me)for(let Ee=-1;Ee<=1;++Ee){const we=(J+me)*h+ee+Ee;if(Va[we]>=q)continue;const Ce=Hf[we],Ae=Math.abs(Ce);Ae>le&&(fe=Ce,le=Ae,ge=Ee,_e=me)}if(le>.1){const me=1-(q+.5*Math.abs(ge*_e))/M;let Ee=i._dem.get(ee,J)+fe*me;const we=i._dem.get(ee+ge,J+_e),Ce=i._dem.get(ee-ge,J-_e,!0);(Ee-we)*(Ee-Ce)>0&&(Ee=(we+Ce)/2),Hf[oe]=i._dem.set(ee,J,Ee),Va[oe]=q}}}}}p&&(i._demTile.needsDEMTextureUpload=!0,i._dem._timestamp=_n.now())}getNodesInfo(){return this.nodesInfo}destroy(){const e=this.getNodesInfo();for(const i of e)ip(i.node),Gf(i.node)}isEmpty(){return!this.nodesInfo.length}updateReplacement(e,i){if(i.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=i.updateTime;const n=i.getReplacementRegionsForTile(e.toUnwrapped()),a=this.getNodesInfo();for(let l=0;l<this.nodesInfo.length;l++){const h=a[l].node;a[l].hiddenByReplacement=!!h.footprint&&!n.find(p=>p.footprint===h.footprint)}}getHeightAtTileCoord(e,i){const n=this.getNodesInfo(),a=[],l=[0,0,0];for(let h=0;h<this.nodesInfo.length;h++){const p=n[h],m=p.node.meshes[0],g=wi.applyTransform(m.aabb,p.node.matrix);if(e<g.min[0]||i<g.min[1]||e>g.max[0]||i>g.max[1])continue;const x=(e-m.aabb.min[0])/(m.aabb.max[0]-m.aabb.min[0])*Fa|0,v=Math.min(63,(i-m.aabb.min[1])/(m.aabb.max[1]-m.aabb.min[1])*Fa|0)*Fa+Math.min(63,x);if(l[2]=m.heightmap[v],o.Q.transformMat4(l,l,p.node.matrix),!(m.heightmap[v]<0&&p.node.footprint))return p.hiddenByReplacement?void 0:{height:l[2],maxHeight:p.feature.properties.height,hidden:!1,verticalScale:p.evaluatedScale[2]};if(p.node.footprint.grid.query(new Ne(e,i),new Ne(e,i),a),a.length>0)return{height:void 0,maxHeight:p.feature.properties.height,hidden:p.hiddenByReplacement,verticalScale:p.evaluatedScale[2]}}}}function Hu(t,e){return!t.isLightConstant&&e}function $v(t,e,i,n,a,l,h,p){let m=(61440&e|(61440&e)>>4)>>8,g=(3840&e|(3840&e)>>4)>>4,x=240&e|(240&e)>>4;i[3]>0&&(m=Ct(m,255*i[0],i[3]),g=Ct(g,255*i[1],i[3]),x=Ct(x,255*i[2],i[3]));const v=m<<8|g,w=x<<8|Math.floor(255*n[3]),E=function(q){const J=kt(q,0,2);return Math.min(Math.round(.5*J*255),255)}(n[2])<<8|15*n[0]<<4|15*n[1],M=kt(a[0],0,1),I=kt(a[1],0,1),z=kt(a[2],0,1),D=kt(a[3],0,1);let F,j,V,X;if(M!==I&&h!==l&&I!==M){const q=h-l;j=1/(q*(I-M)),V=-(l+q*M)/(q*(I-M));const J=kt(a[4],-1,1);X=Math.pow(10,J),F=255*z<<8|255*D}else F=65535,j=0,V=1,X=1;if(t.emplaceBack(v,w,E,F,j,V,X),p){const q=p.length;p.clear();for(let J=0;J<q;J++)p.emplaceBack(v,w,E,F,j,V,X)}}function Wv(t,e,i){const n=t.node;let a=0;const l=i&dc.HasMeshoptCompression;for(const h of n.meshes){if(n.lights&&n.lightMeshIndex===a||!h.featureData)continue;h.featureArray=new ud,h.featureArray.reserve(h.featureData.length);let p=e;for(const m of h.featureData){const g=l?65535&m:m>>16&65535,x=l?m>>16&65535:65535&m,v=(15&x)<8?15&x:0,w=t.evaluatedRMEA[v],E=t.evaluatedColor[v],M=t.emissionHeightBasedParams[v];let I;if(p&&v===2&&n.lights&&(I=new ud,I.resize(10*n.lights.length)),$v(h.featureArray,g,E,w,M,h.aabb.min[2],h.aabb.max[2],I),I&&p){p=!1;const z=n.meshes[n.lightMeshIndex];z.featureArray=I,z.featureArray._trim()}}h.featureArray._trim(),a++}}function ay(t,e,i,n){const a=1<<t.z;e.lat=cr((n/Ve+t.y)/a),e.lng=$r((i/Ve+t.x)/a)}Qe(ap,"Tiled3dModelBucket",{omit:["layers"]}),Qe(oy,"Tiled3dModelFeature");const Qv={circle:class extends It{constructor(t,e,i){super(t,i0,e,i)}createBucket(t){return new Jp(t)}queryRadius(t){const e=t;return Kl("circle-radius",this,e)+Kl("circle-stroke-width",this,e)+_d(this.paint.get("circle-translate"))}queryIntersectsFeature(t,e,i,n,a,l,h,p){const m=Om(this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),l.angle,t.pixelToTileUnitsFactor),g=this.paint.get("circle-radius").evaluate(e,i)+this.paint.get("circle-stroke-width").evaluate(e,i);return Xm(t,n,l,h,p,this.paint.get("circle-pitch-alignment")==="map",this.paint.get("circle-pitch-scale")==="map",m,g)}getProgramIds(){return["circle"]}getDefaultProgramParams(t,e){const i=Hm(this);return{config:new Da(this,e),defines:i,overrideFog:!1}}},heatmap:class extends It{createBucket(t){return new Jm(t)}constructor(t,e,i){super(t,f0,e,i),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(t){t==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=Iu({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)}queryRadius(t){return Kl("heatmap-radius",this,t)}queryIntersectsFeature(t,e,i,n,a,l,h,p){const m=this.paint.get("heatmap-radius").evaluate(e,i);return Xm(t,n,l,h,p,!0,!0,new Ne(0,0),m)}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}getProgramIds(){return["heatmap","heatmapTexture"]}getDefaultProgramParams(t,e){return t==="heatmap"?{config:new Da(this,e),overrideFog:!1}:{}}},hillshade:class extends It{constructor(t,e,i){super(t,_0,e,i)}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}getProgramIds(){return["hillshade","hillshadePrepare"]}getDefaultProgramParams(t,e){return{overrideFog:!1}}},fill:class extends It{constructor(t,e,i){super(t,P0,e,i)}getProgramIds(){const t=this.paint.get("fill-pattern"),e=t&&t.constantOr(1),i=[e?"fillPattern":"fill"];return this.paint.get("fill-antialias")&&i.push(e&&!this.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline"),i}getDefaultProgramParams(t,e){return{config:new Da(this,e),overrideFog:!1}}recalculate(t,e){super.recalculate(t,e);const i=this.paint._values["fill-outline-color"];i.value.kind==="constant"&&i.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(t){return new vf(t)}queryRadius(){return _d(this.paint.get("fill-translate"))}queryIntersectsFeature(t,e,i,n,a,l){return!t.queryGeometry.isAboveHorizon&&zm(km(t.tilespaceGeometry,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),l.angle,t.pixelToTileUnitsFactor),n)}isTileClipped(){return!0}},"fill-extrusion":class extends It{constructor(t,e,i){super(t,nx,e,i),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(t){return new Rd(t)}queryRadius(){return _d(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}hasShadowPass(){return!0}cutoffRange(){return this.paint.get("fill-extrusion-cutoff-fade-range")}canCastShadows(){return!0}getProgramIds(){return[this.paint.get("fill-extrusion-pattern").constantOr(1)?"fillExtrusionPattern":"fillExtrusion"]}queryIntersectsFeature(t,e,i,n,a,l,h,p,m){const g=Om(this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),l.angle,t.pixelToTileUnitsFactor),x=this.paint.get("fill-extrusion-height").evaluate(e,i),v=this.paint.get("fill-extrusion-base").evaluate(e,i),w=[0,0],E=p&&l.elevation,M=l.elevation?l.elevation.exaggeration():1,I=t.tile.getBucket(this);if(E&&I instanceof Rd){const V=I.centroidVertexArray,X=m+1;X<V.length&&(w[0]=V.geta_centroid_pos0(X),w[1]=V.geta_centroid_pos1(X))}if(w[0]===0&&w[1]===1)return!1;l.projection.name==="globe"&&(n=R_([n],[new Ne(0,0),new Ne(Ve,Ve)],t.tileID.canonical).map(V=>V.polygon).flat());const z=E?p:null,[D,F]=function(V,X,q,J,ee,oe,fe,le,ge,_e,me){return V.projection.name==="globe"?function(Ee,we,Ce,Ae,ye,Ye,$e,ze,ct,it,Je){const De=[],ot=[],bt=Ee.projection.upVectorScale(Je,Ee.center.lat,Ee.worldSize).metersToTile,pt=[0,0,0,1],Mt=[0,0,0,1],wt=(ht,oi,ni,$t)=>{ht[0]=oi,ht[1]=ni,ht[2]=$t,ht[3]=1},Rt=D_();Ce>0&&(Ce+=Rt),Ae+=Rt;for(const ht of we){const oi=[],ni=[];for(const $t of ht){const Ut=$t.x+ye.x,Wt=$t.y+ye.y,yi=Ee.projection.projectTilePoint(Ut,Wt,Je),di=Ee.projection.upVector(Je,$t.x,$t.y);let Pi=Ce,Mi=Ae;if($e){const _r=k_(Ut,Wt,Ce,Ae,$e,ze,ct,it);Pi+=_r.base,Mi+=_r.top}Ce!==0?wt(pt,yi.x+di[0]*bt*Pi,yi.y+di[1]*bt*Pi,yi.z+di[2]*bt*Pi):wt(pt,yi.x,yi.y,yi.z),wt(Mt,yi.x+di[0]*bt*Mi,yi.y+di[1]*bt*Mi,yi.z+di[2]*bt*Mi),o.Q.transformMat4(pt,pt,Ye),o.Q.transformMat4(Mt,Mt,Ye),oi.push(new rc(pt[0],pt[1],pt[2])),ni.push(new rc(Mt[0],Mt[1],Mt[2]))}De.push(oi),ot.push(ni)}return[De,ot]}(V,X,q,J,ee,oe,fe,le,ge,_e,me):fe?function(Ee,we,Ce,Ae,ye,Ye,$e,ze,ct){const it=[],Je=[],De=[0,0,0,1];for(const ot of Ee){const bt=[],pt=[];for(const Mt of ot){const wt=Mt.x+Ae.x,Rt=Mt.y+Ae.y,ht=k_(wt,Rt,we,Ce,Ye,$e,ze,ct);De[0]=wt,De[1]=Rt,De[2]=ht.base,De[3]=1,o.aa.transformMat4(De,De,ye),De[3]=Math.max(De[3],1e-5);const oi=new rc(De[0]/De[3],De[1]/De[3],De[2]/De[3]);De[0]=wt,De[1]=Rt,De[2]=ht.top,De[3]=1,o.aa.transformMat4(De,De,ye),De[3]=Math.max(De[3],1e-5);const ni=new rc(De[0]/De[3],De[1]/De[3],De[2]/De[3]);bt.push(oi),pt.push(ni)}it.push(bt),Je.push(pt)}return[it,Je]}(X,q,J,ee,oe,fe,le,ge,_e):function(Ee,we,Ce,Ae,ye){const Ye=[],$e=[],ze=ye[8]*we,ct=ye[9]*we,it=ye[10]*we,Je=ye[11]*we,De=ye[8]*Ce,ot=ye[9]*Ce,bt=ye[10]*Ce,pt=ye[11]*Ce;for(const Mt of Ee){const wt=[],Rt=[];for(const ht of Mt){const oi=ht.x+Ae.x,ni=ht.y+Ae.y,$t=ye[0]*oi+ye[4]*ni+ye[12],Ut=ye[1]*oi+ye[5]*ni+ye[13],Wt=ye[2]*oi+ye[6]*ni+ye[14],yi=ye[3]*oi+ye[7]*ni+ye[15],di=$t+ze,Pi=Ut+ct,Mi=Wt+it,_r=Math.max(yi+Je,1e-5),ki=$t+De,Ei=Ut+ot,Zi=Wt+bt,ir=Math.max(yi+pt,1e-5);wt.push(new rc(di/_r,Pi/_r,Mi/_r)),Rt.push(new rc(ki/ir,Ei/ir,Zi/ir))}Ye.push(wt),$e.push(Rt)}return[Ye,$e]}(X,q,J,ee,oe)}(l,n,v,x,g,h,z,w,M,l.center.lat,t.tileID.canonical),j=t.queryGeometry;return function(V,X,q){let J=1/0;zm(q,X)&&(J=L_(q,X[0]));for(let ee=0;ee<X.length;ee++){const oe=X[ee],fe=V[ee];for(let le=0;
7le<oe.length-1;le++){const ge=oe[le],_e=[ge,oe[le+1],fe[le+1],fe[le],ge];Kp(q,_e)&&(J=Math.min(J,L_(q,_e)))}}return J!==1/0&&J}(D,F,j.isPointQuery()?j.screenBounds:j.screenGeometry)}},line:class extends It{constructor(t,e,i){super(t,B_,e,i),this.gradientVersion=0}_handleSpecialPaintPropertyUpdate(t){if(t==="line-gradient"){const e=this._transitionablePaint._values["line-gradient"].value.expression;this.stepInterpolant=e._styleExpression&&e._styleExpression.expression instanceof ga,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}widthExpression(){return this._transitionablePaint._values["line-width"].value.expression}recalculate(t,e){super.recalculate(t,e),this.paint._values["line-floorwidth"]=G_.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,t)}createBucket(t){return new Tf(t)}getProgramIds(){return[this.paint.get("line-pattern").constantOr(1)?"linePattern":"line"]}getDefaultProgramParams(t,e){const i=U_(this);return{config:new Da(this,e),defines:i,overrideFog:!1}}queryRadius(t){const e=t,i=q_(Kl("line-width",this,e),Kl("line-gap-width",this,e)),n=Kl("line-offset",this,e);return i/2+Math.abs(n)+_d(this.paint.get("line-translate"))}queryIntersectsFeature(t,e,i,n,a,l){if(t.queryGeometry.isAboveHorizon)return!1;const h=km(t.tilespaceGeometry,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),l.angle,t.pixelToTileUnitsFactor),p=t.pixelToTileUnitsFactor/2*q_(this.paint.get("line-width").evaluate(e,i),this.paint.get("line-gap-width").evaluate(e,i)),m=this.paint.get("line-offset").evaluate(e,i);return m&&(n=function(g,x){const v=[],w=new Ne(0,0);for(let E=0;E<g.length;E++){const M=g[E],I=[];for(let z=0;z<M.length;z++){const D=M[z],F=M[z+1],j=z===0?w:D.sub(M[z-1])._unit()._perp(),V=z===M.length-1?w:F.sub(D)._unit()._perp(),X=j._add(V)._unit();X._mult(1/(X.x*V.x+X.y*V.y)),I.push(X._mult(x)._add(D))}v.push(I)}return v}(n,m*t.pixelToTileUnitsFactor)),function(g,x,v){for(let w=0;w<x.length;w++){const E=x[w];if(g.length>=3){for(let M=0;M<E.length;M++)if(Oa(g,E[M]))return!0}if(Jy(g,E,v))return!0}return!1}(h,n,p)}isTileClipped(){return!0}},symbol:Hd,background:class extends It{constructor(t,e,i){super(t,uv,e,i)}getProgramIds(){return[this.paint.get("background-pattern")?"backgroundPattern":"background"]}getDefaultProgramParams(t,e){return{overrideFog:!1}}},raster:Cg,"raster-particle":Pg,sky:class extends It{constructor(t,e,i){super(t,yv,e,i),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(t){t==="sky-gradient"?this._updateColorRamp():t!=="sky-atmosphere-sun"&&t!=="sky-atmosphere-halo-color"&&t!=="sky-atmosphere-color"&&t!=="sky-atmosphere-sun-intensity"||(this._skyboxInvalidated=!0)}_updateColorRamp(){this.colorRamp=Iu({expression:this._transitionablePaint._values["sky-gradient"].value.expression,evaluationKey:"skyRadialProgress"}),this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null)}needsSkyboxCapture(t){if(this._skyboxInvalidated||!this.skyboxTexture||!this.skyboxGeometry)return!0;if(!this.paint.get("sky-atmosphere-sun")){const e=t.style.light.properties.get("position");return this._lightPosition.azimuthal!==e.azimuthal||this._lightPosition.polar!==e.polar}return!1}getCenter(t,e){if(this.paint.get("sky-type")==="atmosphere"){const n=this.paint.get("sky-atmosphere-sun"),a=!n,l=t.style.light,h=l.properties.get("position");return a&&l.properties.get("anchor")==="viewport"&&Ci("The sun direction is attached to a light with viewport anchor, lighting may behave unexpectedly."),a?Nf(h.azimuthal,90-h.polar,e):Nf(n[0],90-n[1],e)}const i=this.paint.get("sky-gradient-center");return Nf(i[0],90-i[1],e)}isSky(){return!0}markSkyboxValid(t){this._skyboxInvalidated=!1,this._lightPosition=t.style.light.properties.get("position")}hasOffscreenPass(){return!0}getProgramIds(){const t=this.paint.get("sky-type");return t==="atmosphere"?["skyboxCapture","skybox"]:t==="gradient"?["skyboxGradient"]:null}},slot:class extends It{constructor(t,e,i){super(t,xv,e)}},model:class extends It{constructor(t,e,i){super(t,Iv,e,i),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(t){return new Uf(t)}getProgramIds(){return["model"]}is3D(){return!0}hasShadowPass(){return!0}canCastShadows(){return!0}hasLightBeamPass(){return!0}cutoffRange(){return this.paint.get("model-cutoff-fade-range")}queryRadius(t){return t instanceof ap?Ve-1:0}queryIntersectsFeature(t,e,i,n,a,l){if(!this.modelManager)return!1;const h=this.modelManager,p=t.tile.getBucket(this);if(!(p&&p instanceof Uf))return!1;const m=p;for(const g in m.instancesPerModel){const x=m.instancesPerModel[g],v=e.id!==void 0?e.id:e.properties&&e.properties.hasOwnProperty("id")?e.properties.id:void 0;if(x.idToFeaturesIndex.hasOwnProperty(v)){const w=x.features[x.idToFeaturesIndex[v]],E=h.getModel(g,this.scope);if(!E)return!1;let M=o.a9.create();const I=new Zt(0,0),z=m.canonical;let D=Number.MAX_VALUE;for(let F=0;F<w.instancedDataCount;++F){const j=16*(w.instancedDataOffset+F),V=x.instancedDataArray.float32,X=[V[j+4],V[j+5],V[j+6]];
7ay(z,I,V[j],0|V[j+1]),Vg(M,E,l,I,w.rotation,w.scale,X,!1,!1,!1),l.projection.name==="globe"&&(M=Vf(M,l));const q=o.a9.multiply([],l.projMatrix,M),J=t.queryGeometry,ee=Og(J.isPointQuery()?J.screenBounds:J.screenGeometry,l,q,E.aabb);ee!=null&&(D=Math.min(ee,D))}return D!==Number.MAX_VALUE&&D}}return!1}_handleOverridablePaintPropertyUpdate(t,e,i){return!(!this.layout||e.isDataDriven()||i.isDataDriven()||t!=="model-color"&&t!=="model-color-mix-intensity"&&t!=="model-rotation"&&t!=="model-scale"&&t!=="model-translation"&&t!=="model-emissive-strength")}_isPropertyZoomDependent(t){const e=this._transitionablePaint._values[t];return e!=null&&e.value!=null&&e.value.expression!=null&&e.value.expression instanceof Ea}isZoomDependent(){return this._isPropertyZoomDependent("model-scale")||this._isPropertyZoomDependent("model-rotation")||this._isPropertyZoomDependent("model-translation")}queryIntersectsMatchingFeature(t,e,i,n){const a=t.tile,l=a.getBucket(this);let h=null,p=Number.MAX_VALUE;if(!(l&&l instanceof ap))return{queryFeature:h,intersectionZ:p};const m=l.getNodesInfo()[e];if(m.hiddenByReplacement||!m.node.meshes||!i.filter(new B(a.tileID.overscaledZ),m.feature,a.tileID.canonical))return{queryFeature:h,intersectionZ:p};const g=m.node,x=n.calculatePosMatrix(a.tileID.toUnwrapped(),n.worldSize),v=m.evaluatedScale;let w=0;n.elevation&&g.elevation&&(w=g.elevation*n.elevation.exaggeration()),o.a9.translate(x,x,[(g.anchor?g.anchor[0]:0)*(v[0]-1),(g.anchor?g.anchor[1]:0)*(v[1]-1),w]),o.a9.scale(x,x,v),o.a9.multiply(x,x,g.matrix);const E=t.queryGeometry,M=E.isPointQuery()?E.screenBounds:E.screenGeometry,I=function(D){const F=o.a9.multiply([],x,D.matrix),j=o.a9.multiply(F,n.expandedFarZProjMatrix,F);for(let V=0;V<D.meshes.length;++V){const X=D.meshes[V];if(V===D.lightMeshIndex)continue;const q=Og(M,n,j,X.aabb);q!=null&&(p=Math.min(q,p))}if(D.children)for(const V of D.children)I(V)};if(I(g),p===Number.MAX_VALUE)return{queryFeature:h,intersectionZ:p};const z=new Zt(0,0);return ay(a.tileID.canonical,z,m.node.anchor[0],m.node.anchor[1]),h={type:"Feature",geometry:{type:"Point",coordinates:[z.lng,z.lat]},properties:m.feature.properties,id:m.feature.id,state:{},layer:this.serialize()},{queryFeature:h,intersectionZ:p}}}},xt={read:function(t,e){return t.readFields(xt._readField,{header_length:0,x:0,y:0,z:0,layers:[]},e)},_readField:function(t,e,i){t===1?e.header_length=i.readFixed32():t===2?e.x=i.readVarint():t===3?e.y=i.readVarint():t===4?e.z=i.readVarint():t===5&&e.layers.push(xt.Layer.read(i,i.readVarint()+i.pos))},PixelFormat:{PIXEL_FORMAT_UNKNOWN:{value:0,options:{}},PIXEL_FORMAT_UINT32:{value:1,options:{}},PIXEL_FORMAT_UINT16:{value:2,options:{}},PIXEL_FORMAT_UINT8:{value:3,options:{}}},Filter:{}};xt.Filter.read=function(t,e){return t.readFields(xt.Filter._readField,{delta_filter:null,filter:null,zigzag_filter:null,bitshuffle_filter:null,byteshuffle_filter:null},e)},xt.Filter._readField=function(t,e,i){t===1?(e.delta_filter=xt.Filter.Delta.read(i,i.readVarint()+i.pos),e.filter="delta_filter"):t===2?(e.zigzag_filter=xt.Filter.Zigzag.read(i,i.readVarint()+i.pos),e.filter="zigzag_filter"):t===3?(e.bitshuffle_filter=xt.Filter.BitShuffle.read(i,i.readVarint()+i.pos),e.filter="bitshuffle_filter"):t===4&&(e.byteshuffle_filter=xt.Filter.ByteShuffle.read(i,i.readVarint()+i.pos),e.filter="byteshuffle_filter")},xt.Filter.Delta={},xt.Filter.Delta.read=function(t,e){return t.readFields(xt.Filter.Delta._readField,{block_size:0},e)},xt.Filter.Delta._readField=function(t,e,i){t===1&&(e.block_size=i.readVarint())},xt.Filter.Zigzag={},xt.Filter.Zigzag.read=function(t,e){return t.readFields(xt.Filter.Zigzag._readField,{},e)},xt.Filter.Zigzag._readField=function(t,e,i){},xt.Filter.BitShuffle={},xt.Filter.BitShuffle.read=function(t,e){return t.readFields(xt.Filter.BitShuffle._readField,{},e)},xt.Filter.BitShuffle._readField=function(t,e,i){},xt.Filter.ByteShuffle={},xt.Filter.ByteShuffle.read=function(t,e){return t.readFields(xt.Filter.ByteShuffle._readField,{},e)},xt.Filter.ByteShuffle._readField=function(t,e,i){},xt.Codec={},xt.Codec.read=function(t,e){return t.readFields(xt.Codec._readField,{gzip_data:null,codec:null,jpeg_image:null,webp_image:null,png_image:null},e)}
7,xt.Codec._readField=function(t,e,i){t===1?(e.gzip_data=xt.Codec.GzipData.read(i,i.readVarint()+i.pos),e.codec="gzip_data"):t===2?(e.jpeg_image=xt.Codec.JpegImage.read(i,i.readVarint()+i.pos),e.codec="jpeg_image"):t===3?(e.webp_image=xt.Codec.WebpImage.read(i,i.readVarint()+i.pos),e.codec="webp_image"):t===4&&(e.png_image=xt.Codec.PngImage.read(i,i.readVarint()+i.pos),e.codec="png_image")},xt.Codec.GzipData={},xt.Codec.GzipData.read=function(t,e){return t.readFields(xt.Codec.GzipData._readField,{},e)},xt.Codec.GzipData._readField=function(t,e,i){},xt.Codec.JpegImage={},xt.Codec.JpegImage.read=function(t,e){return t.readFields(xt.Codec.JpegImage._readField,{},e)},xt.Codec.JpegImage._readField=function(t,e,i){},xt.Codec.WebpImage={},xt.Codec.WebpImage.read=function(t,e){return t.readFields(xt.Codec.WebpImage._readField,{},e)},xt.Codec.WebpImage._readField=function(t,e,i){},xt.Codec.PngImage={},xt.Codec.PngImage.read=function(t,e){return t.readFields(xt.Codec.PngImage._readField,{},e)},xt.Codec.PngImage._readField=function(t,e,i){},xt.DataIndexEntry={},xt.DataIndexEntry.read=function(t,e){return t.readFields(xt.DataIndexEntry._readField,{first_byte:0,last_byte:0,filters:[],codec:null,offset:0,scale:0,bands:[]},e)},xt.DataIndexEntry._readField=function(t,e,i){t===1?e.first_byte=i.readFixed64():t===2?e.last_byte=i.readFixed64():t===3?e.filters.push(xt.Filter.read(i,i.readVarint()+i.pos)):t===4?e.codec=xt.Codec.read(i,i.readVarint()+i.pos):t===5?e.offset=i.readFloat():t===6?e.scale=i.readFloat():t===7&&e.bands.push(i.readString())},xt.Layer={},xt.Layer.read=function(t,e){return t.readFields(xt.Layer._readField,{version:0,name:"",units:"",tilesize:0,buffer:0,pixel_format:0,data_index:[]},e)},xt.Layer._readField=function(t,e,i){t===1?e.version=i.readVarint():t===2?e.name=i.readString():t===3?e.units=i.readString():t===4?e.tilesize=i.readVarint():t===5?e.buffer=i.readVarint():t===6?e.pixel_format=i.readVarint():t===7&&e.data_index.push(xt.DataIndexEntry.read(i,i.readVarint()+i.pos))};const Un={read:function(t,e){return t.readFields(Un._readField,{uint32_values:null,values:null,fixed32_values:null},e)},_readField:function(t,e,i){t===2?(e.uint32_values=Un.Uint32Values.read(i,i.readVarint()+i.pos),e.values="uint32_values"):t===3&&(e.fixed32_values=Un.Fixed32Values.read(i,i.readVarint()+i.pos),e.values="fixed32_values")},Uint32Values:{}};Un.Uint32Values.read=function(t,e){return t.readFields(Un.Uint32Values._readField,{values:[]},e)},Un.Uint32Values._readField=function(t,e,i){t===1&&(e.readValuesInto=function(n){if(n.type!==2)throw new Error(`Unsupported pbf type "${n.type}"`);const a=function(h){return h.type===2?h.readVarint()+h.pos:h.pos+1}(n),l=n.pos;return n.pos=a,function(h){n.pos=l;let p=0;for(;n.pos<a;){const m=n.readVarint();h[p++]=m}return h}}(i))},Un.Fixed32Values={},Un.Fixed32Values.read=function(t,e){return t.readFields(Un.Fixed32Values._readField,{values:[]},e)},Un.Fixed32Values._readField=function(t,e,i){throw new Error("Not implemented")};/**
8 * tiny-lru
9 *
10 * @copyright 2024 Jason Mulligan <[email protected]>
11 * @license BSD-3-Clause
12 * @version 11.2.6
13 */class Hv{constructor(e=0,i=0,n=!1){this.first=null,this.items=Object.create(null),this.last=null,this.max=e,this.resetTtl=n,this.size=0,this.ttl=i}clear(){return this.first=null,this.items=Object.create(null),this.last=null,this.size=0,this}delete(e){if(this.has(e)){const i=this.items[e];delete this.items[e],this.size--,i.prev!==null&&(i.prev.next=i.next),i.next!==null&&(i.next.prev=i.prev),this.first===i&&(this.first=i.next),this.last===i&&(this.last=i.prev)}return this}entries(e=this.keys()){return e.map(i=>[i,this.get(i)])}evict(e=!1){if(e||this.size>0){const i=this.first;delete this.items[i.key],--this.size==0?(this.first=null,this.last=null):(this.first=i.next,this.first.prev=null)}return this}expiresAt(e){let i;return this.has(e)&&(i=this.items[e].expiry),i}get(e){let i;if(this.has(e)){const n=this.items[e];this.ttl>0&&n.expiry<=Date.now()?this.delete(e):(i=n.value,this.set(e,i,!0))}return i}has(e){return e in this.items}keys(){const e=[];let i=this.first;for(;i!==null;)e.push(i.key),i=i.next;return e}set(e,i,n=!1,a=this.resetTtl){let l;
13if(n||this.has(e)){if(l=this.items[e],l.value=i,n===!1&&a&&(l.expiry=this.ttl>0?Date.now()+this.ttl:this.ttl),this.last!==l){const h=this.last,p=l.next,m=l.prev;this.first===l&&(this.first=l.next),l.next=null,l.prev=this.last,h.next=l,m!==null&&(m.next=p),p!==null&&(p.prev=m)}}else this.max>0&&this.size===this.max&&this.evict(!0),l=this.items[e]={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:e,prev:this.last,next:null,value:i},++this.size==1?this.first=l:this.last.next=l;return this.last=l,this}values(e=this.keys()){return e.map(i=>this.get(i))}}function Xv(t,e){if(e.length!==4)throw new Error(`Expected data of dimension 4 but got ${e.length}.`);let i=e[3];for(let n=2;n>=1;n--){const a=n===1?1:0,l=n===2?1:0;for(let h=0;h<e[0];h++){const p=e[1]*h;for(let m=a;m<e[1];m++){const g=e[2]*(m+p);for(let x=l;x<e[2];x++){const v=e[3]*(x+g);for(let w=0;w<e[3];w++){const E=v+w;t[E]+=t[E-i]}}}}i*=e[n]}return t}function Yv(t){for(let e=0,i=t.length;e<i;e++)t[e]=t[e]>>>1^-(1&t[e]);return t}function Jv(t,e){switch(e){case"uint32":return t;case"uint16":for(let i=0;i<t.length;i+=2){const n=t[i],a=t[i+1];t[i]=(240&n)>>4|(61440&n)>>8|(240&a)<<4|61440&a,t[i+1]=15&n|(3840&n)>>4|(15&a)<<8|(3840&a)<<4}return t;case"uint8":for(let i=0;i<t.length;i+=4){const n=t[i],a=t[i+1],l=t[i+2],h=t[i+3];t[i+0]=(192&n)>>6|(192&a)>>4|(192&l)>>2|192&h,t[i+1]=(48&n)>>4|(48&a)>>2|48&l|(48&h)<<2,t[i+2]=(12&n)>>2|12&a|(12&l)<<2|(12&h)<<4,t[i+3]=3&n|(3&a)<<2|(3&l)<<4|(3&h)<<6}return t;default:throw new Error(`Invalid pixel format, "${e}"`)}}class Do extends Error{constructor(e){super(e),this.name="MRTError"}}var dn=Uint8Array,Xu=Uint16Array,Kv=Int32Array,ly=new dn([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),cy=new dn([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),e1=new dn([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),uy=function(t,e){for(var i=new Xu(31),n=0;n<31;++n)i[n]=e+=1<<t[n-1];var a=new Kv(i[30]);for(n=1;n<30;++n)for(var l=i[n];l<i[n+1];++l)a[l]=l-i[n]<<5|n;return{b:i,r:a}},hy=uy(ly,2),dy=hy.b,t1=hy.r;dy[28]=258,t1[258]=28;for(var i1=uy(cy,0).b,py=new Xu(32768),Vi=0;Vi<32768;++Vi){var _c=(43690&Vi)>>1|(21845&Vi)<<1;py[Vi]=((65280&(_c=(61680&(_c=(52428&_c)>>2|(13107&_c)<<2))>>4|(3855&_c)<<4))>>8|(255&_c)<<8)>>1}var Yu=function(t,e,i){for(var n=t.length,a=0,l=new Xu(e);a<n;++a)t[a]&&++l[t[a]-1];var h,p=new Xu(e);for(a=1;a<e;++a)p[a]=p[a-1]+l[a-1]<<1;{h=new Xu(1<<e);var m=15-e;for(a=0;a<n;++a)if(t[a])for(var g=a<<4|t[a],x=e-t[a],v=p[t[a]-1]++<<x,w=v|(1<<x)-1;v<=w;++v)h[py[v]>>m]=g}return h},Ju=new dn(288);for(Vi=0;Vi<144;++Vi)Ju[Vi]=8;for(Vi=144;Vi<256;++Vi)Ju[Vi]=9;for(Vi=256;Vi<280;++Vi)Ju[Vi]=7;for(Vi=280;Vi<288;++Vi)Ju[Vi]=8;var fy=new dn(32);for(Vi=0;Vi<32;++Vi)fy[Vi]=5;var r1=Yu(Ju,9),n1=Yu(fy,5),Xf=function(t){for(var e=t[0],i=1;i<t.length;++i)t[i]>e&&(e=t[i]);return e},jn=function(t,e,i){var n=e/8|0;return(t[n]|t[n+1]<<8)>>(7&e)&i},Yf=function(t,e){var i=e/8|0;return(t[i]|t[i+1]<<8|t[i+2]<<16)>>(7&e)}
vendor: 13,300 bytes, line 13
13,s1=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],Gn=function(t,e,i){var n=new Error(e||s1[t]);if(n.code=t,Error.captureStackTrace&&Error.captureStackTrace(n,Gn),!i)throw n;return n},o1=new dn(0),a1=typeof TextDecoder<"u"&&new TextDecoder;try{a1.decode(o1,{stream:!0})}catch{}const l1={gzip_data:"gzip"},c1={0:"uint32",1:"uint32",2:"uint16",3:"uint8"},u1={uint32:1,uint16:2,uint8:4},h1={uint32:Uint32Array,uint16:Uint16Array,uint8:Uint8Array};class my{constructor(e=1){this.x=NaN,this.y=NaN,this.z=NaN,this.layers={},this._cacheSize=e}getLayer(e){return this.layers[e]}getHeaderLength(e){const i=new Uint8Array(e),n=new DataView(e);if(i[0]!==13)throw new Do("File is not a valid MRT.");return n.getUint32(1,!0)}parseHeader(e){const i=new Uint8Array(e),n=this.getHeaderLength(e);if(i.length<n)throw new Do(`Expected header with length >= ${n} but got buffer of length ${i.length}`);const a=new ac(i.subarray(0,n)),l=xt.read(a);if(!isNaN(this.x)&&(this.x!==l.x||this.y!==l.y||this.z!==l.z))throw new Do(`Invalid attempt to parse header ${l.z}/${l.x}/${l.y} for tile ${this.z}/${this.x}/${this.y}`);this.x=l.x,this.y=l.y,this.z=l.z;for(const h of l.layers)this.layers[h.name]=new d1(h,{cacheSize:this._cacheSize});return this}createDecodingTask(e){const i=[],n=this.getLayer(e.layerName);for(let a=0;a<n.dataIndex.length;a++){const l=n.dataIndex[a],h=l.first_byte-e.firstByte,p=l.last_byte+1-e.firstByte;if(a<e.firstBlock||a>e.lastBlock||n._blocksInProgress.has(a))continue;const m={layerName:n.name,firstByte:h,lastByte:p,pixelFormat:n.pixelFormat,blockIndex:a,blockShape:[l.bands.length].concat(n.bandShape),buffer:n.buffer,codec:l.codec.codec,filters:l.filters.map(g=>g.filter)};n._blocksInProgress.add(a),i.push(m)}return new _y(i,()=>{i.forEach(a=>n._blocksInProgress.delete(a.blockIndex))},(a,l)=>{if(i.forEach(h=>n._blocksInProgress.delete(h.blockIndex)),a)throw a;l.forEach(h=>{this.getLayer(h.layerName).processDecodedData(h)})})}}class d1{constructor({version:e,name:i,units:n,tilesize:a,pixel_format:l,buffer:h,data_index:p},m){if(this.version=e,this.version!==1)throw new Do(`Cannot parse raster layer encoded with MRT version ${e}`);this.name=i,this.units=n,this.tileSize=a,this.buffer=h,this.pixelFormat=c1[l],this.dataIndex=p,this.bandShape=[a+2*h,a+2*h,u1[this.pixelFormat]],this._decodedBlocks=function(g=1e3,x=0,v=!1){if(isNaN(g)||g<0)throw new TypeError("Invalid max value");if(isNaN(x)||x<0)throw new TypeError("Invalid ttl value");if(typeof v!="boolean")throw new TypeError("Invalid resetTtl value");return new Hv(g,x,v)}(m?m.cacheSize:5),this._blocksInProgress=new Set}processDecodedData(e){const i=e.blockIndex.toString();this._decodedBlocks.get(i)||this._decodedBlocks.set(i,e.data)}getBlockForBand(e){let i=0;switch(typeof e){case"string":for(const[n,a]of this.dataIndex.entries()){for(const[l,h]of a.bands.entries())if(h===e)return{bandIndex:i+l,blockIndex:n,blockBandIndex:l};i+=a.bands.length}break;case"number":for(const[n,a]of this.dataIndex.entries()){if(e>=i&&e<i+a.bands.length)return{bandIndex:e,blockIndex:n,blockBandIndex:e-i};i+=a.bands.length}break;default:throw new Do(`Invalid band \`${JSON.stringify(e)}\`. Expected string or integer.`)}throw new Do(`Band not found: ${JSON.stringify(e)}`)}getDataRange(e){let i=1/0,n=-1/0,a=1/0,l=-1/0;for(const h of e){const{blockIndex:p}=this.getBlockForBand(h);if(p<0)throw new Do(`Invalid band: ${JSON.stringify(h)}`);const m=this.dataIndex[p];a=Math.min(a,p),l=Math.max(l,p),i=Math.min(i,m.first_byte),n=Math.max(n,m.last_byte)}return{layerName:this.name,firstByte:i,lastByte:n,firstBlock:a,lastBlock:l}}hasBand(e){const{blockIndex:i}=this.getBlockForBand(e);return i>=0}hasDataForBand(e){const{blockIndex:i}=this.getBlockForBand(e);return i>=0&&!!this._decodedBlocks.get(i.toString())}getBandView(e){const{blockIndex:i,blockBandIndex:n}=this.getBlockForBand(e),a=this._decodedBlocks.get(i.toString());if(!a)throw new Do(`Data for band ${JSON.stringify(e)} of layer "${this.name}" not decoded.`);const l=this.dataIndex[i],h=this.bandShape.reduce((g,x)=>g*x,1),p=n*h,m=a.subarray(p,p+h);return{data:m,bytes:new Uint8Array(m.buffer).subarray(m.byteOffset,m.byteOffset+m.byteLength),tileSize:this.tileSize,buffer:this.buffer,offset:l.offset,scale:l.scale}}}class _y{constructor(e,i,n){this.tasks=e,this._onCancel=i,this._onComplete=n,this._finalized=!1}cancel(){this._finalized||(this._onCancel(),this._finalized=!0)}complete(e,i){this._finalized||(this._onComplete(e,i),this._finalized=!0)}}my.performDecoding=function(t,e){return Promise.all(e.tasks.map(i=>{const{layerName:n,firstByte:a,lastByte:l,pixelFormat:h,blockShape:p,blockIndex:m,filters:g,codec:x}=i,v=new Uint8Array(t).subarray(a,l+1),w=new Uint32Array(p[0]*p[1]*p[2]);let E;if(x!=="gzip_data")throw new Error(`Unhandled codec: ${x}`);return E=function(M,I){if(!globalThis.DecompressionStream&&I==="gzip_data")return Promise.resolve(((j=function(q){q[0]==31&&q[1]==139&&q[2]==8||Gn(6,"invalid gzip data");var J=q[3],ee=10;4&J&&(ee+=2+(q[10]|q[11]<<8));for(var oe=(J>>3&1)+(J>>4&1);oe>0;oe-=!q[ee++]);return ee+(2&J)}(F=M))+8>F.length&&Gn(6,"invalid gzip data"),function(q,J,ee,oe){var fe=q.length;if(!fe||J.f&&!J.l)return ee||new dn(0);var le=!ee,ge=le||J.i!=2,_e=J.i;le&&(ee=new dn(3*fe));var me,Ee,we=function(Ro){var Lo=ee.length;if(Ro>Lo){var Ua=new dn(Math.max(2*Lo,Ro));Ua.set(ee),ee=Ua}},Ce=J.f||0,Ae=J.p||0,ye=J.b||0,Ye=J.l,$e=J.d,ze=J.m,ct=J.n,it=8*fe;do{if(!Ye){Ce=jn(q,Ae,1);var Je=jn(q,Ae+1,3);if(Ae+=3,!Je){var De=q[(Ut=4+((Ae+7)/8|0))-4]|q[Ut-3]<<8,ot=Ut+De;if(ot>fe){_e&&Gn(0);break}ge&&we(ye+De),ee.set(q.subarray(Ut,ot),ye),J.b=ye+=De,J.p=Ae=8*ot,J.f=Ce;continue}if(Je==1)Ye=r1,$e=n1,ze=9,ct=5;else if(Je==2){var bt=jn(q,Ae,31)+257,pt=jn(q,Ae+10,15)+4,Mt=bt+jn(q,Ae+5,31)+1;Ae+=14;for(var wt=new dn(Mt),Rt=new dn(19),ht=0;ht<pt;++ht)Rt[e1[ht]]=jn(q,Ae+3*ht,7);Ae+=3*pt;var oi=Xf(Rt),ni=(1<<oi)-1,$t=Yu(Rt,oi);for(ht=0;ht<Mt;){var Ut,Wt=$t[jn(q,Ae,ni)];if(Ae+=15&Wt,(Ut=Wt>>4)<16)wt[ht++]=Ut;else{var yi=0,di=0;for(Ut==16?(di=3+jn(q,Ae,3),Ae+=2,yi=wt[ht-1]):Ut==17?(di=3+jn(q,Ae,7),Ae+=3):Ut==18&&(di=11+jn(q,Ae,127),Ae+=7);di--;)wt[ht++]=yi}}var Pi=wt.subarray(0,bt),Mi=wt.subarray(bt);ze=Xf(Pi),ct=Xf(Mi),Ye=Yu(Pi,ze),$e=Yu(Mi,ct)}else Gn(1);if(Ae>it){_e&&Gn(0);break}}ge&&we(ye+131072);for(var _r=(1<<ze)-1,ki=(1<<ct)-1,Ei=Ae;;Ei=Ae){var Zi=(yi=Ye[Yf(q,Ae)&_r])>>4;if((Ae+=15&yi)>it){_e&&Gn(0);break}if(yi||Gn(2),Zi<256)ee[ye++]=Zi;else{if(Zi==256){Ei=Ae,Ye=null;break}var ir=Zi-254;Zi>264&&(ir=jn(q,Ae,(1<<(Cr=ly[ht=Zi-257]))-1)+dy[ht],Ae+=Cr);var rr=$e[Yf(q,Ae)&ki],fi=rr>>4;if(rr||Gn(3),Ae+=15&rr,Mi=i1[fi],fi>3){var Cr=cy[fi];Mi+=Yf(q,Ae)&(1<<Cr)-1,Ae+=Cr}if(Ae>it){_e&&Gn(0);break}ge&&we(ye+131072);var Fs=ye+ir;if(ye<Mi){var Sn=0-Mi,qn=Math.min(Mi,Fs);for(Sn+ye<0&&Gn(3);ye<qn;++ye)ee[ye]=(void 0)[Sn+ye]}for(;ye<Fs;++ye)ee[ye]=ee[ye-Mi]}}J.l=Ye,J.p=Ei,J.b=ye,J.f=Ce,Ye&&(Ce=1,J.m=ze,J.d=$e,J.n=ct)}while(!Ce);return ye!=ee.length&&le?(me=ee,((Ee=ye)==null||Ee>me.length)&&(Ee=me.length),new dn(me.subarray(0,Ee))):ee.subarray(0,ye)}(F.subarray(j,-8),{i:2},new dn(((z=F)[(D=z.length)-4]|z[D-3]<<8|z[D-2]<<16|z[D-1]<<24)>>>0))));var z,D,F,j;const V=l1[I];if(!V)throw new Error(`Unhandled codec: ${I}`);const X=new globalThis.DecompressionStream(V);return new Response(new Blob([M]).stream().pipeThrough(X)).arrayBuffer().then(q=>new Uint8Array(q))}(v,x).then(M=>{const I=Un.read(new ac(M));if(I.values==="uint32_values")return I.uint32_values.readValuesInto(w),new h1[h](w.buffer);throw new Error(`Unhandled numeric data "${I.values}"`)}),E.then(M=>{for(let I=g.length-1;I>=0;I--)switch(g[I]){case"delta_filter":Xv(M,p);break;case"zigzag_filter":Yv(M);break;case"bitshuffle_filter":Jv(M,h);break;default:throw new Error(`Unhandled filter "${g[I]}"`)}return{layerName:n,blockIndex:m,data:M}}).catch(M=>{throw M})}))},Qe(_y,"MRTDecodingBatch",{omit:["_onCancel","_onComplete"]});const gy=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class Jf{static from(e){if(!(e instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[i,n]=new Uint8Array(e,0,2);if(i!==219)throw new Error("Data does not appear to be in a KDBush format.");const a=n>>4;if(a!==1)throw new Error(`Got v${a} data when expected v1.`);const l=gy[15&n];if(!l)throw new Error("Unrecognized array type.");const[h]=new Uint16Array(e,2,1),[p]=new Uint32Array(e,4,1);return new Jf(p,h,l,e)}constructor(e,i=64,n=Float64Array,a){if(isNaN(e)||e<0)throw new Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+i,2),65535),this.ArrayType=n,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;const l=gy.indexOf(this.ArrayType),h=2*e*this.ArrayType.BYTES_PER_ELEMENT,p=e*this.IndexArrayType.BYTES_PER_ELEMENT,m=(8-p%8)%8;if(l<0)throw new Error(`Unexpected typed array class: ${n}.`);a&&a instanceof ArrayBuffer?(this.data=a,this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+p+m,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+h+p+m),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+p+m,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+l]),new Uint16Array(this.data,2,1)[0]=i,new Uint32Array(this.data,4,1)[0]=e)}add(e,i){const n=this._pos>>1;return this.ids[n]=n,this.coords[this._pos++]=e,this.coords[this._pos++]=i,n}finish(){const e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return Kf(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,i,n,a){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:l,coords:h,nodeSize:p}=this,m=[0,l.length-1,0],g=[];for(;m.length;){const x=m.pop()||0,v=m.pop()||0,w=m.pop()||0;if(v-w<=p){for(let z=w;z<=v;z++){const D=h[2*z],F=h[2*z+1];D>=e&&D<=n&&F>=i&&F<=a&&g.push(l[z])}continue}const E=w+v>>1,M=h[2*E],I=h[2*E+1];M>=e&&M<=n&&I>=i&&I<=a&&g.push(l[E]),(x===0?e<=M:i<=I)&&(m.push(w),m.push(E-1),m.push(1-x)),(x===0?n>=M:a>=I)&&(m.push(E+1),m.push(v),m.push(1-x))}return g}within(e,i,n){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:a,coords:l,nodeSize:h}=this,p=[0,a.length-1,0],m=[],g=n*n;for(;p.length;){const x=p.pop()||0,v=p.pop()||0,w=p.pop()||0;if(v-w<=h){for(let z=w;z<=v;z++)xy(l[2*z],l[2*z+1],e,i)<=g&&m.push(a[z]);continue}const E=w+v>>1,M=l[2*E],I=l[2*E+1];xy(M,I,e,i)<=g&&m.push(a[E]),(x===0?e-n<=M:i-n<=I)&&(p.push(w),p.push(E-1),p.push(1-x)),(x===0?e+n>=M:i+n>=I)&&(p.push(E+1),p.push(v),p.push(1-x))}return m}}function Kf(t,e,i,n,a,l){if(a-n<=i)return;const h=n+a>>1;yy(t,e,h,n,a,l),Kf(t,e,i,n,h-1,1-l),Kf(t,e,i,h+1,a,1-l)}function yy(t,e,i,n,a,l){for(;a>n;){if(a-n>600){const g=a-n+1,x=i-n+1,v=Math.log(g),w=.5*Math.exp(2*v/3),E=.5*Math.sqrt(v*w*(g-w)/g)*(x-g/2<0?-1:1);yy(t,e,i,Math.max(n,Math.floor(i-x*w/g+E)),Math.min(a,Math.floor(i+(g-x)*w/g+E)),l)}const h=e[2*i+l];let p=n,m=a;for(Ku(t,e,n,i),e[2*a+l]>h&&Ku(t,e,n,a);p<m;){for(Ku(t,e,p,m),p++,m--;e[2*p+l]<h;)p++;for(;e[2*m+l]>h;)m--}e[2*n+l]===h?Ku(t,e,n,m):(m++,Ku(t,e,m,a)),m<=i&&(n=m+1),i<=m&&(a=m-1)}}function Ku(t,e,i,n){em(t,i,n),em(e,2*i,2*n),em(e,2*i+1,2*n+1)}function em(t,e,i){const n=t[e];t[e]=t[i],t[i]=n}function xy(t,e,i,n){const a=t-i,l=e-n;return a*a+l*l}o.$=class{constructor(t){this.specification=t}possiblyEvaluate(t,e){return function([i,n]){const a=Zo([1,i,n]);return{x:a.x,y:a.y,z:a.z}}(t.expression.evaluate(e))}interpolate(t,e,i){return{x:Ct(t.x,e.x,i),y:Ct(t.y,e.y,i),z:Ct(t.z,e.z,i)}}},o.A=xe,o.B=xu,o.C=Sr,o.D=id,o.E=vs,o.F=function(t){const e=t.value;let i=[];if(!e)return i;const n=es(e);return n!=="string"?(i=i.concat([new tp(t.key,e,`string expected, "${n}" found`)]),i):(Bg(e,!0)||(i=i.concat([new tp(t.key,e,`invalid url "${e}"`)])),i)},o.G=W,o.H=se,o.I=Cf,o.J=te,o.K=class{constructor(t){this.specification=t}possiblyEvaluate(t,e){return Zo(t.expression.evaluate(e))}interpolate(t,e,i){return{x:Ct(t.x,e.x,i),y:Ct(t.y,e.y,i),z:Ct(t.z,e.z,i),azimuthal:Ct(t.azimuthal,e.azimuthal,i),polar:Ct(t.polar,e.polar,i)}}},o.L=Y,o.M=class{constructor(t,e,i,n){this.id=t,this.position=e!=null?new Zt(e[0],e[1]):new Zt(0,0),this.orientation=i??[0,0,0],this.nodes=n,this.uploaded=!1,this.aabb=new wi([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),this.matrix=[]}_applyTransformations(t,e){if(o.a9.multiply(t.matrix,e,t.matrix),t.meshes)for(const i of t.meshes){const n=wi.applyTransform(i.aabb,t.matrix);this.aabb.encapsulate(n)}if(t.children)for(const i of t.children)this._applyTransformations(i,t.matrix)}computeBoundsAndApplyParent(){const t=o.a9.identity([]);for(const e of this.nodes)this._applyTransformations(e,t)}computeModelMatrix(t,e,i,n,a,l,h=!1){Vg(this.matrix,this,t.transform,this.position,e,i,n,a,l,h)}upload(t){if(!this.uploaded){for(const e of this.nodes)jf(e,t);for(const e of this.nodes)ip(e);this.uploaded=!0}}destroy(){for(const t of this.nodes)Gf(t)}},o.N=B,o.O=mr,o.P=Ne,o.R=dl,o.S=jo,o.T=Ff,o.U=pe,o.V=tp,o.W=To,o.X=Ct,o.Y=Ve,o.Z=Ea,o._=ia,o.a=bl,o.a$=Cc,o.a0=function(t,e,
13i=0,n=!0){const a=new Ne(i,i),l=t.sub(a),h=e.add(a),p=[l,new Ne(h.x,l.y),h,new Ne(l.x,h.y)];return n&&p.push(l.clone()),p},o.a1=function(t,e){const i=[];for(let n=0;n<t.length;n++){const a=Cn(n-1,-1,t.length-1),l=Cn(n+1,-1,t.length-1),h=t[n],p=t[l],m=t[a].sub(h).unit(),g=p.sub(h).unit(),x=g.angleWithSep(m.x,m.y),v=m.add(g).unit().mult(-1*e/Math.sin(x/2));i.push(h.add(v))}return i},o.a2=vg,o.a3=Lm,o.a4=function(t,e,i=0){return o.Q.fromValues(((e.x-i)*t.scale-t.x)*Ve,(e.y*t.scale-t.y)*Ve,Mm(e.z,e.y))},o.a5=nf,o.a6=F_,o.a7=function(t){let e=1/0,i=1/0,n=-1/0,a=-1/0;for(const l of t)e=Math.min(e,l.x),i=Math.min(i,l.y),n=Math.max(n,l.x),a=Math.max(a,l.y);return{min:new Ne(e,i),max:new Ne(n,a)}},o.a8=bo,o.aA=ti,o.aB=vt,o.aC=Yh,o.aD=Np,o.aE=Fi,o.aF=Qt,o.aG=lm,o.aH=Qd,o.aI=function(){Q.isLoading()||Q.isLoaded()||$()!=="deferred"||Z()},o.aJ=Ge,o.aK=wo,o.aL=ey,o.aM=kr,o.aN=Tf,o.aO=vf,o.aP=Ls,o.aQ=ar,o.aR=Bp,o.aS=Vm,o.aT=Md,o.aU=Bf,o.aV=function(t,e){const i=To(e.zoom);if(i===0)return as(t);const n=xd(t),a=lf(n),l=bo(n.getWest())*e.worldSize,h=bo(n.getEast())*e.worldSize,p=Rs(n.getNorth())*e.worldSize,m=Rs(n.getSouth())*e.worldSize,g=[l,p,0],x=[h,p,0],v=[l,m,0],w=[h,m,0],E=o.a9.invert([],e.globeMatrix);return o.Q.transformMat4(g,g,E),o.Q.transformMat4(x,x,E),o.Q.transformMat4(v,v,E),o.Q.transformMat4(w,w,E),a[0]=ks(a[0],v,i),a[1]=ks(a[1],w,i),a[2]=ks(a[2],x,i),a[3]=ks(a[3],g,i),wi.fromPoints(a)},o.aW=bd,o.aX=Au,o.aY=ks,o.aZ=Qi,o.a_=n0,o.ab=Oa,o.ac=Cm,o.ad=kt,o.ae=Ar,o.af=function(t,e){const i={};for(let n=0;n<e.length;n++){const a=e[n];a in t&&(i[a]=t[a])}return i},o.ag=vo,o.ah=Rs,o.ai=class{constructor(t){this.entries={},this.scheduler=t}request(t,e,i,n){const a=this.entries[t]=this.entries[t]||{callbacks:[]};if(a.result){const[l,h]=a.result;return this.scheduler?this.scheduler.add(()=>{n(l,h)},e):n(l,h),()=>{}}return a.callbacks.push(n),a.cancel||(a.cancel=i((l,h)=>{a.result=[l,h];for(const p of a.callbacks)this.scheduler?this.scheduler.add(()=>{p(l,h)},e):p(l,h);setTimeout(()=>delete this.entries[t],3e3)})),()=>{a.result||(a.callbacks=a.callbacks.filter(l=>l!==n),a.callbacks.length||(a.cancel(),delete this.entries[t]))}}},o.aj=ui,o.ak=function(t,e,i){const n=JSON.stringify(t.request);return t.data&&(this.deduped.entries[n]={result:[null,t.data]}),this.deduped.request(n,{type:"parseTile",isSymbolTile:t.isSymbolTile,zoom:t.tileZoom},a=>{const l=Ho(t.request,(h,p,m,g)=>{h?a(h):p&&a(null,{vectorTile:i?void 0:new bf(new ac(p)),rawData:p,cacheControl:m,expires:g})});return()=>{l.cancel(),a()}},e)},o.al=function(t){Lc++,Lc>bh&&(t.getActor().send("enforceCacheSizeLimit",ul),Lc=0)},o.am=Tr,o.an=al,o.ao=function(t){return t<=1?1:Math.pow(2,Math.floor(Math.log(t)/Math.LN2))},o.ap=fr,o.aq=Cg,o.ar=Pg,o.as=Ig,o.at=function(t,e){const i=document.createElement("video");i.muted=!0,i.onloadstart=function(){e(null,i)};for(let n=0;n<t.length;n++){const a=document.createElement("source");Oc(t[n])||(i.crossOrigin="Anonymous"),a.src=t[n],i.appendChild(a)}return{cancel:()=>{}}},o.au=Xd,o.av=Nu,o.aw=$r,o.ax=cr,o.ay=lr,o.az=Xi,o.b=Jn,o.b$=cc,o.b0=my,o.b1=Ho,o.b2=function(t){const e=[];for(const i in t)e.push(t[i]);return e},o.b3=function(t,e){const i=[];for(const n in t)n in e||i.push(n);return i},o.b4=Ac,o.b5=["type","source","source-layer","minzoom","maxzoom","filter","layout"],o.b6=function(t,e){const{x:i,y:n}=t.point,a=$m(i,n,t.worldSize/t._pixelsPerMercatorPixel,0,0);return o.a9.multiply(a,a,cf(as(e)))},o.b8=nc,o.b9=hn,o.bA=Tm,o.bB=function(t){const e=o.a9.identity(new Float64Array(16));o.a9.multiply(e,t.pixelMatrix,t.globeMatrix);const i=[0,Tn,0],n=[0,En,0];return o.Q.transformMat4(i,i,e),o.Q.transformMat4(n,n,e),[i[0]>0&&i[0]<=t.width&&i[1]>0&&i[1]<=t.height&&!hf(t,new Zt(t.center.lat,90)),n[0]>0&&n[0]<=t.width&&n[1]>0&&n[1]<=t.height&&!hf(t,new Zt(t.center.lat,-90))]},o.bC=function(t,e){const{scale:i}=t.tileTransform,n=i*Ve/(t.tileSize*Math.pow(2,e.zoom-t.tileID.overscaledZ+t.tileID.canonical.z));return o.b7.scale(new Float32Array(4),e.inverseAdjustmentMatrix,[n,n])},o.bD=Kd,o.bE=zg,o.bF=function(t){const e=zg(t,!0);return o.b7.invert([],[e[0],e[1],e[4],e[5]])},o.bG=sf,o.bH=function(t){const{x:e,y:i}=t.point,{lng:n,lat:a}=t._center;return $m(e,i,t.worldSize,n,a)},o.bI=vr,o.bJ=Zp,o.bK=function(t){const e=Math.round((t+45+360)%360/90)%4;return _h[e]},o.bL=45,o.bM=Qp,o.bN=Tu,o.bO=go,o.bP=jp,o.bQ=Mr,o.bR=dd,o.bS=vm,o.bT=function(t,e,
vendor: 14,319 bytes, line 13
13i){const n=Math.sqrt(t*t+e*e+i*i),a=n>0?Math.acos(i/n)*Mc:0;let l=t!==0||e!==0?Math.atan2(-e,-t)*Mc+90:0;return l<0&&(l+=360),[n,l,a]},o.bU=pd,o.bV=wi,o.bW=Zo,o.bX=function(t){return[Math.pow(t[0],1/2.2),Math.pow(t[1],1/2.2),Math.pow(t[2],1/2.2)]},o.bY=function(t){return t({pluginStatus:L,pluginURL:R}),N.on("pluginStateChange",t),t},o.bZ=pc,o.b_=rp,o.ba=Ld,o.bb=function(t,e,i,n,a){const l=5*e+2;t.float32[l+0]=i,t.float32[l+1]=n,t.float32[l+2]=a},o.bc=Wd,o.bd=cg,o.be=Kp,o.bf=ur,o.bg=Df,o.bh=_g,o.bi=If,o.bj=Jf,o.bk=Cn,o.bm=jt,o.bn=gs,o.bo=Ir,o.bp=function(t,e,i){t[4*e+0]=i[0],t[4*e+1]=i[1],t[4*e+2]=i[2],t[4*e+3]=i[3]},o.bq=Zt,o.br=Sg,o.bs=Sm,o.bt=of,o.bu=Dg,o.bv=La,o.bw=Gm,o.bx=function(t,e,i,n,a,l,h,p,m){if(m.name==="globe")return Gm(t,e,new La(i,n,a),!1);const g=Nu({z:i,x:n,y:a},m);return new wi([(l+g.x/g.scale)*e,e*(g.y/g.scale),h],[(l+g.x2/g.scale)*e,e*(g.y2/g.scale),p])},o.by=function(t,e,i){let n=0;for(let a=0;a<2;++a)t[a]>0&&(n+=(t[a]-0)*(t[a]-0)),e[a]<0&&(n+=(0-e[a])*(0-e[a]));return n},o.bz=Ni,o.c=Jg,o.c$=[1,1,1],o.c0=Pf,o.c1=Ys,o.c2=k,o.c3=Ft,o.c4=cl,o.c5=Ko,o.c6=Pn,o.c7=function(t,e,i){return t.type==="custom"?new _v(t,e):new Qv[t.type](t,e,i)},o.c8=function(t){const e=t.indexOf(Bi);return e>=0?t.slice(0,e):t},o.c9=function(t){return t.indexOf(Bi)>=0},o.cA=t=>({u_matrix:new Tu(t),u_pixels_to_tile_units:new Gp(t),u_device_pixel_ratio:new Mr(t),u_units_to_pixels:new go(t),u_dash_image:new dd(t),u_gradient_image:new dd(t),u_image_height:new Mr(t),u_texsize:new go(t),u_tile_units_to_pixels:new Mr(t),u_alpha_discard_threshold:new Mr(t),u_trim_offset:new go(t),u_emissive_strength:new Mr(t)}),o.cB=t=>({u_matrix:new Tu(t),u_texsize:new go(t),u_pixels_to_tile_units:new Gp(t),u_device_pixel_ratio:new Mr(t),u_image:new dd(t),u_units_to_pixels:new go(t),u_tile_units_to_pixels:new Mr(t),u_alpha_discard_threshold:new Mr(t),u_trim_offset:new go(t)}),o.cC=Ia,o.cD=wx,o.cE=Tx,o.cF=Hm,o.cG=(t,e,i,n,a,l)=>{const h=t.transform,p=h.projection.name==="globe";let m;if(l.paint.get("circle-pitch-alignment")==="map")if(p){const x=Zm(h.zoom,e.canonical)*h._pixelsPerMercatorPixel;m=Float32Array.from([x,0,0,x])}else m=h.calculatePixelsToTileUnitsMatrix(i);else m=new Float32Array([h.pixelsToGLUnits[0],0,0,h.pixelsToGLUnits[1]]);const g={u_camera_to_center_distance:t.transform.getCameraToCenterDistance(h.projection),u_matrix:t.translatePosMatrix(e.projMatrix,i,l.paint.get("circle-translate"),l.paint.get("circle-translate-anchor")),u_device_pixel_ratio:_n.devicePixelRatio,u_extrude_scale:m,u_inv_rot_matrix:c0,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0],u_emissive_strength:l.paint.get("circle-emissive-strength")};if(p){g.u_inv_rot_matrix=n,g.u_merc_center=a,g.u_tile_id=[e.canonical.x,e.canonical.y,1<<e.canonical.z],g.u_zoom_transition=To(h.zoom);const x=a[0]*Ve,v=a[1]*Ve;g.u_up_dir=h.projection.upVector(new La(0,0,0),x,v)}return g},o.cH=U_,o.cI=(t,e,i,n,a,l)=>{const h=t.transform;return{u_matrix:V_(t,e,i,n),u_texsize:e.imageAtlasTexture?e.imageAtlasTexture.size:[0,0],u_pixels_to_tile_units:h.calculatePixelsToTileUnitsMatrix(e),u_device_pixel_ratio:a,u_image:0,u_tile_units_to_pixels:N_(e,h),u_units_to_pixels:[1/h.pixelsToGLUnits[0],1/h.pixelsToGLUnits[1]],u_alpha_discard_threshold:0,u_trim_offset:l}},o.cJ=(t,e,i,n,a,l,h)=>{const p=t.transform,m=p.calculatePixelsToTileUnitsMatrix(e);return{u_matrix:V_(t,e,i,n),u_pixels_to_tile_units:m,u_device_pixel_ratio:l,u_units_to_pixels:[1/p.pixelsToGLUnits[0],1/p.pixelsToGLUnits[1]],u_dash_image:0,u_gradient_image:1,u_image_height:a,u_texsize:j_(i)&&e.lineAtlasTexture?e.lineAtlasTexture.size:[0,0],u_tile_units_to_pixels:N_(e,t.transform),u_alpha_discard_threshold:0,u_trim_offset:h,u_emissive_strength:i.paint.get("line-emissive-strength")}},o.cK=Ic,o.cL=Iu,o.cM=D_,o.cN=$y,o.cO=Rd,o.cP=Mo,o.cQ=450,o.cR=7,o.cS=pv,o.cT=256,o.cU=cf,o.cV=za,o.cW=Pa,o.cX=kp,o.cY=function(t,e,i,n,a){return kt((t-e)/(i-e)*(a-n)+n,n,a)},o.cZ=ka,o.c_=Vf,o.ca=function(t){const e=t.indexOf(Bi);return e>=0?t.slice(e+1):""},o.cb=function(t){const e=[],i=t.id;return i===void 0&&e.push({message:`layers.${i}: missing required property "id"`}),t.render===void 0&&e.push({message:`layers.${i}: missing required method "render"`}),t.renderingMode&&t.renderingMode!=="2d"&&t.renderingMode!=="3d"&&e.push({message:`layers.${i}: property "renderingMode" must be either "2d" or "3d"`}),e},o.cc=Go,o.cd=N,o.ce=Qo,o.cf=bm,o.cg=class extends zs{constructor(t){super(t),this.current=Fy}set(t,e,i){if(this.fetchUniformLocation(t,e)){for(let n=0;n<9;n++)if(i[n]!==this.current[n]){this.current=i,this.gl.uniformMatrix3fv(this.location,!1,i);break}}}},o.ch=tl,o.ci=function(t,e,i){const n=To(i.zoom),a=t.style.map._antialias,l=e.options.extStandardDerivativesForceOff||t.terrain&&t.terrain.exaggeration()>0;return n===0&&!a&&!l},o.cj=function(t){const e=t.pixelsPerMeter,i=e/Ir(1,t.center.lat),n=o.a9.identity(new Float64Array(16));return o.a9.translate(n,n,[t.point.x,t.point.y,0]),o.a9.scale(n,n,[i,i,e]),Float32Array.from(n)},o.ck=xd,o.cl=function(t){const e=Ni-5;t=kt(t,-e,e)/e*90;const i=Math.pow(Math.abs(Math.sin(jt(t))),3);return Math.round(i*($p.length-1))},o.cm=function(t,e,i,n){const a=e.getNorth(),l=e.getSouth(),h=e.getWest(),p=e.getEast(),m=1<<t.z,g=p-h,x=a-l,v=g/Hl,w=-x/$p[i],E=[0,v,0,w,0,0,a,h,0];if(t.z>0){const M=180/n;o.ct.multiply(E,E,[M/g+1,0,0,0,M/x+1,0,-.5*M/v,.5*M/w,1])}return E[2]=m,E[5]=t.x,E[8]=t.y,E},o.cn=as,o.co=function(t,e,i){const n=o.a9.identity(new Float64Array(16)),a=(e/(1<<t)-.5)*Math.PI*2;return o.a9.rotateY(n,i.globeMatrix,a),Float32Array.from(n)},o.cp=class{isDataAvailableAtPoint(t){const e=this._source();if(this.isUsingMockSource()||!e||t.y<0||t.y>1)return!1;const i=e.getSource().maxzoom,n=1<<i,a=Math.floor(t.x),l=Math.floor((t.x-a)*n),h=Math.floor(t.y*n),p=this.findDEMTileFor(new fr(i,a,i,l,h));return!(!p||!p.dem)}getAtPointOrZero(t,e=0){return this.getAtPoint(t,e)||0}getAtPoint(t,e,i=!0){if(this.isUsingMockSource())return null;e==null&&(e=null);const n=this._source();if(!n||t.y<0||t.y>1)return e;const a=n.getSource().maxzoom,l=1<<a,h=Math.floor(t.x),p=t.x-h,m=new fr(a,h,a,Math.floor(p*l),Math.floor(t.y*l)),g=this.findDEMTileFor(m);if(!g||!g.dem)return e;const x=g.dem,v=1<<g.tileID.canonical.z,w=(p*v-g.tileID.canonical.x)*x.dim,E=(t.y*v-g.tileID.canonical.y)*x.dim,M=Math.floor(w),I=Math.floor(E);return(i?this.exaggeration():1)*Ct(Ct(x.get(M,I),x.get(M,I+1),E-I),Ct(x.get(M+1,I),x.get(M+1,I+1),E-I),w-M)}getAtTileOffset(t,e,i){const n=1<<t.canonical.z;return this.getAtPointOrZero(new mr(t.wrap+(t.canonical.x+e/Ve)/n,(t.canonical.y+i/Ve)/n))}getAtTileOffsetFunc(t,e,i,n){return a=>{const l=this.getAtTileOffset(t,a.x,a.y),h=n.upVector(t.canonical,a.x,a.y),p=n.upVectorScale(t.canonical,e,i).metersToTile;return o.Q.scale(h,h,l*p),h}}getForTilePoints(t,e,i,n){if(this.isUsingMockSource())return!1;const a=ic.create(this,t,n);return!!a&&(e.forEach(l=>{l[2]=this.exaggeration()*a.getElevationAt(l[0],l[1],i)}),!0)}getMinMaxForTile(t){if(this.isUsingMockSource())return null;const e=this.findDEMTileFor(t);if(!e||!e.dem)return null;const i=e.dem.tree,n=e.tileID,a=1<<t.canonical.z-n.canonical.z;let l=t.canonical.x/a-n.canonical.x,h=t.canonical.y/a-n.canonical.y,p=0;for(let m=0;m<t.canonical.z-n.canonical.z&&!i.leaves[p];m++){l*=2,h*=2;const g=2*Math.floor(h)+Math.floor(l);p=i.childOffsets[p]+g,l%=1,h%=1}return{min:this.exaggeration()*i.minimums[p],max:this.exaggeration()*i.maximums[p]}}getMinElevationBelowMSL(){throw new Error("Pure virtual method called.")}raycast(t,e,i){throw new Error("Pure virtual method called.")}pointCoordinate(t){throw new Error("Pure virtual method called.")}_source(){throw new Error("Pure virtual method called.")}isUsingMockSource(){throw new Error("Pure virtual method called.")}exaggeration(){throw new Error("Pure virtual method called.")}findDEMTileFor(t){throw new Error("Pure virtual method called.")}get visibleDemTiles(){throw new Error("Getter must be implemented in subclass.")}getMinMaxForVisibleTiles(){const t=this.visibleDemTiles;if(t.length===0)return null;let e=!1,i=Number.MAX_VALUE,n=Number.MIN_VALUE;for(const a of t){const l=this.getMinMaxForTile(a.tileID);l&&(i=Math.min(i,l.min),n=Math.max(n,l.max),e=!0)}return e?{min:i,max:n}:null}},o.cq=yd,o.cr=t_,o.cs=function(t,e){return[Math.pow(t[0],2.2)*e,Math.pow(t[1],2.2)*e,Math.pow(t[2],2.2)*e]},o.cu=Zm,o.cv=vh,o.cw=rn,o.cx=256,o.cy=function(t,e){const i=[0,0,0],n=bd(as(e.canonical));return o.Q.transformMat4(i,i,n),o.Q.transformMat4(i,i,t),i},o.cz=t=>({u_camera_to_center_distance:new Mr(t),u_extrude_scale:new Gp(t),u_device_pixel_ratio:new Mr(t),u_matrix:new Tu(t),u_inv_rot_matrix:new Tu(t),u_merc_center:new go(t),u_tile_id:new jp(t),u_zoom_transition:new Mr(t),u_up_dir:new jp(t),u_emissive_strength:new Mr(t)}),o.d=Bc,o.d$=Ug,o.d0=ic,o.d1=dc,o.d2=Zr,o.d3=class{constructor(){this._updateTime=0,this._sourceIds=[],this._activeRegions=[],this._prevRegions=[]}clear(){this._activeRegions.length>0&&++this._updateTime,this._activeRegions=[],this._prevRegions=[]}get updateTime(){return this._updateTime}getReplacementRegionsForTile(t){const e=h_(new Ne(0,0),new Ne(Ve,Ve),t),i=[];for(const n of this._activeRegions){if(n.hiddenByOverlap||!u_(e,n))continue;const a=q0(n.min,n.max,t);i.push({min:a.min,max:a.max,sourceId:this._sourceIds[n.priority],footprint:n.footprint,footprintTileId:n.tileId})}return i}setSources(t){this._setSources(t.map(e=>({getSourceId:()=>e.cache.id,getFootprints:()=>{const i=[];for(const n of e.cache.getVisibleCoordinates()){const a=e.cache.getTile(n).buckets[e.layer];if(a)for(const l of a.getNodesInfo()){const h=l.node;h.footprint&&i.push({footprint:h.footprint,id:n.toUnwrapped()})}}return i}})))}_addSource(t){const e=t.getFootprints();if(e.length!==0){for(const i of e){if(!i.footprint)continue;const n=h_(i.footprint.min,i.footprint.max,i.id);this._activeRegions.push({min:n.min,max:n.max,hiddenByOverlap:!1,priority:this._sourceIds.length,tileId:i.id,footprint:i.footprint})}this._sourceIds.push(t.getSourceId())}}_computeReplacement(){this._activeRegions.sort((e,i)=>e.priority-i.priority||Pd(e.min,i.min)||Pd(e.max,i.max));let t=this._activeRegions.length!==this._prevRegions.length;if(!t){let e=0,i=0;for(;!t&&e!==this._activeRegions.length;){const n=this._activeRegions[e],a=this._prevRegions[i];t=n.priority!==a.priority||!c_(n,a),++e,++i}}if(t){++this._updateTime;const e=i=>{const n=this._activeRegions;if(i>=n.length)return i;const a=n[i].priority;for(;i<n.length&&n[i].priority===a;)++i;return i};if(this._sourceIds.length>1){let i=0,n=e(i);for(;i!==n;){let a=i;const l=i;for(;a!==n;){const h=this._activeRegions[a];h.hiddenByOverlap=!1;for(let p=0;p<l;p++){const m=this._activeRegions[p];if(!m.hiddenByOverlap&&u_(h,m)&&(h.hiddenByOverlap=p_(h.footprint,h.tileId,m.footprint,m.tileId),h.hiddenByOverlap))break}++a}i=n,n=e(i)}}}}_setSources(t){[this._prevRegions,this._activeRegions]=[this._activeRegions,[]],this._sourceIds=[];for(let e=t.length-1;e>=0;e--)this._addSource(t[e]);this._computeReplacement()}},o.d4=class{constructor(t){this._createGrid(t),this._createPoles(t)}destroy(){this._poleIndexBuffer.destroy(),this._gridBuffer.destroy(),this._gridIndexBuffer.destroy(),this._poleNorthVertexBuffer.destroy(),this._poleSouthVertexBuffer.destroy();for(const t of this._poleSegments)t.destroy();for(const t of this._gridSegments)t.withSkirts.destroy(),t.withoutSkirts.destroy()}_fillGridMeshWithLods(t,e){const i=new ar,n=new Xi,a=[],l=t+1+2,h=e[0]+1,p=e[0]+1+(1+e.length),m=(g,x,v)=>{let w=g===l-1?g-2:g===0?g:g-1;return w+=v?24575:0,[w,x]};for(let g=0;g<l;++g)i.emplaceBack(...m(g,0,!0));for(let g=0;g<h;++g)for(let x=0;x<l;++x)i.emplaceBack(...m(x,g,(x===0||x===l-1)&&!0));for(let g=0;g<e.length;++g){const x=e[g];for(let v=0;v<l;++v)i.emplaceBack(...m(v,x,!0))}for(let g=0;g<e.length;++g){const x=n.length,v=e[g]+1+2,w=new Xi;for(let I=0;I<v-1;I++){const z=I===v-2,D=z?l*(p-e.length+g-I):l;for(let F=0;F<l-1;F++){const j=I*l+F;I===0||z||F===0||F===l-2?(w.emplaceBack(j+1,j,j+D),w.emplaceBack(j+D,j+D+1,j+1)):(n.emplaceBack(j+1,j,j+D),n.emplaceBack(j+D,j+D+1,j+1))}}const E=Fi.simpleSegment(0,x,i.length,n.length-x);for(let I=0;I<w.uint16.length;I+=3)n.emplaceBack(w.uint16[I],w.uint16[I+1],w.uint16[I+2]);const M=Fi.simpleSegment(0,x,i.length,n.length-x);a.push({withoutSkirts:E,withSkirts:M})}return{vertices:i,indices:n,segments:a}}_createGrid(t){const e=this._fillGridMeshWithLods(Hl,$p);this._gridSegments=e.segments,this._gridBuffer=t.createVertexBuffer(e.vertices,Vm.members),this._gridIndexBuffer=t.createIndexBuffer(e.indices,!0)}_createPoles(t){const e=new Xi;for(let h=0;h<=Hl;h++)e.emplaceBack(0,h+1,h+2);this._poleIndexBuffer=t.createIndexBuffer(e,!0);const i=new Pa,n=new Pa,a=new Pa,l=new Pa;this._poleSegments=[];for(let h=0,p=0;h<Zp;h++){const m=360/(1<<h);i.emplaceBack(0,-Ar,0,.5,0),n.emplaceBack(0,-Ar,0,.5,1),a.emplaceBack(0,-Ar,0,.5,.5),l.emplaceBack(0,-Ar,0,.5,.5);for(let g=0;g<=Hl;g++){let x=g/Hl,v=0;const w=Ct(0,m,x),[E,M,I]=Xl(a0,l0,w,Ar);i.emplaceBack(E,M,I,x,v),n.emplaceBack(E,M,I,x,1-v);const z=jt(w);x=.5+.5*Math.sin(z),v=.5+.5*Math.cos(z),a.emplaceBack(E,M,I,x,v),l.emplaceBack(E,M,I,x,1-v)}this._poleSegments.push(Fi.simpleSegment(p,0,66,64)),p+=66}this._poleNorthVertexBuffer=t.createVertexBuffer(i,gd,!1),this._poleSouthVertexBuffer=t.createVertexBuffer(n,gd,!1),this._texturedPoleNorthVertexBuffer=t.createVertexBuffer(a,gd,!1),this._texturedPoleSouthVertexBuffer=t.createVertexBuffer(l,gd,!1)}getGridBuffers(t,e){return[this._gridBuffer,this._gridIndexBuffer,e?this._gridSegments[t].withSkirts:this._gridSegments[t].withoutSkirts]}getPoleBuffers(t,e){return[e?this._texturedPoleNorthVertexBuffer:this._poleNorthVertexBuffer,e?this._texturedPoleSouthVertexBuffer:this._poleSouthVertexBuffer,this._poleIndexBuffer,this._poleSegments[t]]}},o.d5=function(t){return xl.has(t)},o.d6=gh,o.d7=function(){return!!document.fullscreenElement||!!document.webkitFullscreenElement},o.d8=tn,o.d9=Im,o.dA=$u,o.dB=function(t){const e=Rc();if(!e)return;const i=e.delete(Qs);t&&i.catch(t).then(()=>t())},o.dC=Zu,o.dD=jg,o.dE=function(t){Zf=_n.resolveURL(t),mc||(mc=new pc(rp(),new vs)),mc.broadcast("setDracoUrl",Zf)},o.dF=Gg,o.dG=function(t){fc=_n.resolveURL(t),mc||(mc=new pc(rp(),new vs)),mc.broadcast("setMeshoptUrl",fc)},o.dH=Qe,o.dI=Eo,o.dJ=Nn,o.dK=Kg,o.dL=ty,o.dM=O_,o.dN=$s,o.dO=hg,o.dP=function(t,e,
13i,n,a,l,h,p,m,g,x){t.createArrays(),t.tilePixelRatio=Ve/(512*t.overscaling),t.compareText={},t.iconsNeedLinear=!1;const v=t.layers[0].layout,w=t.layers[0]._unevaluatedLayout._values,E={};if(t.textSizeData.kind==="composite"){const{minZoom:D,maxZoom:F}=t.textSizeData;E.compositeTextSizes=[w["text-size"].possiblyEvaluate(new B(D),p),w["text-size"].possiblyEvaluate(new B(F),p)]}if(t.iconSizeData.kind==="composite"){const{minZoom:D,maxZoom:F}=t.iconSizeData;E.compositeIconSizes=[w["icon-size"].possiblyEvaluate(new B(D),p),w["icon-size"].possiblyEvaluate(new B(F),p)]}E.layoutTextSize=w["text-size"].possiblyEvaluate(new B(m+1),p),E.layoutIconSize=w["icon-size"].possiblyEvaluate(new B(m+1),p),E.textMaxSize=w["text-size"].possiblyEvaluate(new B(18),p);const M=v.get("text-rotation-alignment")==="map"&&v.get("symbol-placement")!=="point",I=v.get("text-size");let z=!1;for(const D of t.features)if(D.icon&&D.icon.nameSecondary){z=!0;break}for(const D of t.features){const F=v.get("text-font").evaluate(D,{},p).join(","),j=I.evaluate(D,{},p),V=E.layoutTextSize.evaluate(D,{},p),X=(E.layoutIconSize.evaluate(D,{},p),{horizontal:{},vertical:void 0}),q=D.text;let J,ee=[0,0];if(q){const le=q.toString(),ge=v.get("text-letter-spacing").evaluate(D,{},p)*ur,_e=v.get("text-line-height").evaluate(D,{},p)*ur,me=u(le)?ge:0,Ee=v.get("text-anchor").evaluate(D,{},p),we=v.get("text-variable-anchor");if(!we){const $e=v.get("text-radial-offset").evaluate(D,{},p);ee=$e?_g(Ee,[$e*ur,zf]):v.get("text-offset").evaluate(D,{},p).map(ze=>ze*ur)}let Ce=M?"center":v.get("text-justify").evaluate(D,{},p);const Ae=v.get("symbol-placement")==="point",ye=Ae?v.get("text-max-width").evaluate(D,{},p)*ur:1/0,Ye=$e=>{t.allowVerticalPlacement&&s(le)&&(X.vertical=Af(q,e,i,a,F,ye,_e,Ee,$e,me,ee,hn.vertical,!0,V,j))};if(!M&&we){const $e=Ce==="auto"?we.map(ct=>Df(ct)):[Ce];let ze=!1;for(let ct=0;ct<$e.length;ct++){const it=$e[ct];if(!X.horizontal[it])if(ze)X.horizontal[it]=X.horizontal[0];else{const Je=Af(q,e,i,a,F,ye,_e,"center",it,me,ee,hn.horizontal,!1,V,j);Je&&(X.horizontal[it]=Je,ze=Je.positionedLines.length===1)}}Ye("left")}else{if(Ce==="auto"&&(Ce=Df(Ee)),Ae||v.get("text-writing-mode").indexOf("horizontal")>=0||!s(le)){const $e=Af(q,e,i,a,F,ye,_e,Ee,Ce,me,ee,hn.horizontal,!1,V,j);$e&&(X.horizontal[Ce]=$e)}Ye(Ae?"left":Ce)}}let oe=!1;if(D.icon&&D.icon.namePrimary){const le=n[D.icon.namePrimary];le&&(J=jx(a[D.icon.namePrimary],D.icon.nameSecondary?a[D.icon.nameSecondary]:void 0,v.get("icon-offset").evaluate(D,{},p),v.get("icon-anchor").evaluate(D,{},p)),oe=le.sdf,t.sdfIcons===void 0?t.sdfIcons=le.sdf:t.sdfIcons!==le.sdf&&Ci("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(le.pixelRatio!==t.pixelRatio||v.get("icon-rotate").constantOr(1)!==0)&&(t.iconsNeedLinear=!0))}const fe=yg(X.horizontal)||X.vertical;t.iconsInText||(t.iconsInText=!!fe&&fe.iconsInText),(fe||J)&&Hx(t,D,X,J,n,E,V,0,ee,oe,h,p,g,x,z)}l&&t.generateCollisionDebugBuffers(m,t.collisionBoxArray)},o.dQ=bf,o.dR=ac,o.dS=zd,o.dT=Id,o.dU=Ad,o.dV=el,o.dW=$_,o.dX=zr,o.dY=function(t){let e=0;if(new Uint32Array(t,0,1)[0]!==Zg){const i=new Uint32Array(t,0,7),[,,n,a,l,h]=i;e=i.byteLength+a+l+h+l,(n!==t.byteLength||e>=t.byteLength)&&Ci("Invalid b3dm header information.")}return Hg(t,e)},o.dZ=function(t,e){const i=Jg(t);for(const n of i){for(const a of n.meshes)jv(a);n.lights&&(n.lightMeshIndex=n.meshes.length,n.meshes.push(Gv(n.lights,e)))}return i},o.d_=ap,o.da=Ra,o.db=function([t,e,i]){const n=Math.hypot(t,e,i),a=Math.atan2(t,i),l=.5*Math.PI-Math.acos(-e/n);return new Zt(vr(a),vr(l))},o.dc=Yl,o.dd=Tt,o.de=hf,o.df=Wm,o.dg=function(t){const e=[0,0,0],i=o.a9.identity(new Float64Array(16));return o.a9.multiply(i,t.pixelMatrix,t.globeMatrix),o.Q.transformMat4(e,e,i),new Ne(e[0],e[1])},o.dh=function(t){const e=t.navigator?t.navigator.userAgent:null;return!!function(i){if(ol==null){const n=i.navigator?i.navigator.userAgent:null;ol=!!i.safari||!(!n||!(/\b(iPad|iPhone|iPod)\b/.test(n)||n.match("Safari")&&!n.match("Chrome")))}return ol}(t)&&e&&(e.match("Version/15.4")||e.match("Version/15.5")||e.match(/CPU (OS|iPhone OS) (15_4|15_5) like Mac OS X/))},o.di=class{constructor(t,e,i){this._transformRequestFn=t,this._customAccessToken=e,this._silenceAuthErrors=!!i,this._createSkuToken()}_createSkuToken(){const t=function(){let e="";for(let i=0;i<10;i++)e+="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[Math.floor(62*Math.random())];return{token:["1",Yo,e].join(""),tokenExpiresAt:Date.now()+432e5}}();this._skuToken=t.token,this._skuTokenExpiresAt=t.tokenExpiresAt}_isSkuTokenExpired(){return Date.now()>this._skuTokenExpiresAt}transformRequest(t,e){return this._transformRequestFn&&this._transformRequestFn(t,e)||{url:t}}normalizeStyleURL(t,e){if(!Ft(t))return t;const i=nn(t);return i.params.push(`sdk=js-${At}`),i.path=`/styles/v1${i.path}`,this._makeAPIURL(i,this._customAccessToken||e)}normalizeGlyphsURL(t,e){if(!Ft(t))return t;const i=nn(t);return i.path=`/fonts/v1${i.path}`,this._makeAPIURL(i,this._customAccessToken||e)}normalizeModelURL(t,e){if(!Ft(t))return t;const i=nn(t);return i.path=`/models/v1${i.path}`,this._makeAPIURL(i,this._customAccessToken||e)}
13normalizeSourceURL(t,e,i,n){if(!Ft(t))return t;const a=nn(t);return a.path=`/v4/${a.authority}.json`,a.params.push("secure"),i&&a.params.push(`language=${i}`),n&&a.params.push(`worldview=${n}`),this._makeAPIURL(a,this._customAccessToken||e)}normalizeSpriteURL(t,e,i,n){const a=nn(t);return Ft(t)?(a.path=`/styles/v1${a.path}/sprite${e}${i}`,this._makeAPIURL(a,this._customAccessToken||n)):(a.path+=`${e}${i}`,Js(a))}normalizeTileURL(t,e,i){if(this._isSkuTokenExpired()&&this._createSkuToken(),t&&!Ft(t))return t;const n=nn(t);n.path=n.path.replace(/(\.(png|jpg)\d*)(?=$)/,`${e||i&&n.authority!=="raster"&&i===512?"@2x":""}${xs.supported?".webp":"$1"}`),n.authority==="raster"?n.path=`/${Tt.RASTER_URL_PREFIX}${n.path}`:n.authority==="rasterarrays"?n.path=`/${Tt.RASTERARRAYS_URL_PREFIX}${n.path}`:(n.path=n.path.replace(/^.+\/v4\//,"/"),n.path=`/${Tt.TILE_URL_VERSION}${n.path}`);const a=this._customAccessToken||function(l){for(const h of l){const p=h.match(/^access_token=(.*)$/);if(p)return p[1]}return null}(n.params)||Tt.ACCESS_TOKEN;return Tt.REQUIRE_ACCESS_TOKEN&&a&&this._skuToken&&n.params.push(`sku=${this._skuToken}`),this._makeAPIURL(n,a)}canonicalizeTileURL(t,e){const i=nn(t);if(!i.path.match(/^(\/v4\/|\/(raster|rasterarrays)\/v1\/)/)||!i.path.match(/\.[\w]+$/))return t;let n="mapbox://";i.path.match(/^\/raster\/v1\//)?n+=`raster/${i.path.replace(`/${Tt.RASTER_URL_PREFIX}/`,"")}`:i.path.match(/^\/rasterarrays\/v1\//)?n+=`rasterarrays/${i.path.replace(`/${Tt.RASTERARRAYS_URL_PREFIX}/`,"")}`:n+=`tiles/${i.path.replace(`/${Tt.TILE_URL_VERSION}/`,"")}`;let a=i.params;return e&&(a=a.filter(l=>!l.match(/^access_token=/))),a.length&&(n+=`?${a.join("&")}`),n}canonicalizeTileset(t,e){const i=!!e&&Ft(e),n=[];for(const a of t.tiles||[])Zn(a)?n.push(this.canonicalizeTileURL(a,i)):n.push(a);return n}_makeAPIURL(t,e){const i="See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes",n=nn(Tt.API_URL);if(t.protocol=n.protocol,t.authority=n.authority,t.protocol==="http"){const a=t.params.indexOf("secure");a>=0&&t.params.splice(a,1)}if(n.path!=="/"&&(t.path=`${n.path}${t.path}`),!Tt.REQUIRE_ACCESS_TOKEN)return Js(t);if(e=e||Tt.ACCESS_TOKEN,!this._silenceAuthErrors){if(!e)throw new Error(`An API access token is required to use Mapbox GL. ${i}`);if(e[0]==="s")throw new Error(`Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). ${i}`)}return t.params=t.params.filter(a=>a.indexOf("access_token")===-1),t.params.push(`access_token=${e||""}`),Js(t)}},o.dj=function(t,e){e?xl.add(t):xl.delete(t)},o.dk=xs,o.dl=gl,o.dm=Vc,o.dn=ml,o.dp=Er,o.dq=_p,o.dr=function(t){xl.delete(t)},o.ds=yl,o.dt=Yn,o.du=At,o.dv=function(t,e){ul=t,bh=e},o.dw=function(t,e,i=!1){if(L===S||L===A||L===C)throw new Error("setRTLTextPlugin cannot be called multiple times.");R=_n.resolveURL(t),L=S,P=e,O(),i||Z()},o.dx=$,o.dy=function(){rp().acquire(qf)},o.dz=function(){const t=Wu;t&&(t.isPreloaded()&&t.numActive()===1?(t.release(qf),Wu=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},o.e=Gr,o.e0=Q,o.e1=function(t){Hs(),Dn&&Dn.then(e=>{e.keys().then(i=>{for(let n=0;n<i.length-t;n++)e.delete(i[n])})})},o.f=_n,o.g=function(t,e){return Qo(Gr(t,{type:"json"}),e)},o.h=un,o.i=class extends tp{},o.j=es,o.k=El,o.l=function(t){return fetch(t).then(e=>e.arrayBuffer()).then(e=>Hg(e,0,t))},o.m=Gl,o.n=rd,o.o=Zl,o.p=ug,o.q=de,o.r=od,o.s=po,o.t=fo,o.u=ue,o.v=fa,o.w=Ci,o.x=_a,o.y=rs}),cp(["./shared"],function(o){function At(Re){const G=Re?Re.url.toString():void 0;return G?performance.getEntriesByName(G):[]}function Xr(Re){if(typeof Re=="number"||typeof Re=="boolean"||typeof Re=="string"||Re==null)return JSON.stringify(Re);if(Array.isArray(Re)){let H="[";for(const ne of Re)H+=`${Xr(ne)},`;return`${H}]`}let G="{";for(const H of Object.keys(Re).sort())G+=`${H}:${Xr(Re[H])},`;return`${G}}`}function Tt(Re){let G="";for(const H of o.b5)G+=`/${Xr(Re[H])}`;return G}class Zn{constructor(G){this.keyCache={},this._layers={},this._layerConfigs={},G&&this.replace(G)}replace(G,H){this._layerConfigs={},this._layers={},this.update(G,[],H)}update(G,H,ne){this._options=ne;for(const Ie of G)this._layerConfigs[Ie.id]=Ie,(this._layers[Ie.id]=o.c7(Ie,this.scope,this._options)).compileFilter(),this.keyCache[Ie.id]&&delete this.keyCache[Ie.id];for(const Ie of H)delete this.keyCache[Ie],delete this._layerConfigs[Ie],delete this._layers[Ie];this.familiesBySource={};const Se=function(Ie,Le){const tt={};for(let He=0;He<Ie.length;He++){const Ke=Le&&Le[Ie[He].id]||Tt(Ie[He]);Le&&(Le[Ie[He].id]=Ke);let st=tt[Ke];st||(st=tt[Ke]=[]),st.push(Ie[He])}const Te=[];for(const He in tt)Te.push(tt[He]);return Te}(o.b2(this._layerConfigs),this.keyCache);for(const Ie of Se){const Le=Ie.map(qe=>this._layers[qe.id]),tt=Le[0];if(tt.visibility==="none")continue;const Te=tt.source||"";let He=this.familiesBySource[Te];He||(He=this.familiesBySource[Te]={});const Ke=tt.sourceLayer||"_geojsonTileLayer";let st=He[Ke];st||(st=He[Ke]=[]),st.push(Le)}}}const Ft=1*o.dJ;class Pr{constructor(G){const H={},ne=[];for(const tt in G){const Te=G[tt],He=H[tt]={};for(const Ke in Te.glyphs){const st=Te.glyphs[+Ke];if(!st||st.bitmap.width===0||st.bitmap.height===0)continue;const qe=st.metrics.localGlyph?Ft:1,ai={x:0,y:0,w:st.bitmap.width+2*qe,h:st.bitmap.height+2*qe};ne.push(ai),He[Ke]=ai}}const{w:Se,h:Ie}=o.p(ne),Le=new o.dI({width:Se||1,height:Ie||1});for(const tt in G){const Te=G[tt];for(const He in Te.glyphs){const Ke=Te.glyphs[+He];if(!Ke||Ke.bitmap.width===0||Ke.bitmap.height===0)continue;const st=H[tt][He],qe=Ke.metrics.localGlyph?Ft:1;o.dI.copy(Ke.bitmap,Le,{x:0,y:0},{x:st.x+qe,y:st.y+qe},Ke.bitmap)}}this.image=Le,this.positions=H}}o.dH(Pr,"GlyphAtlas");class pn{constructor(G){this.tileID=new o.ap(G.tileID.overscaledZ,G.tileID.wrap,G.tileID.canonical.z,G.tileID.canonical.x,G.tileID.canonical.y),this.tileZoom=G.tileZoom,this.uid=G.uid,this.zoom=G.zoom,this.canonical=G.tileID.canonical,this.pixelRatio=G.pixelRatio,this.tileSize=G.tileSize,this.source=G.source,this.scope=G.scope,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=G.showCollisionBoxes,this.collectResourceTiming=!!G.collectResourceTiming,this.promoteId=G.promoteId,this.isSymbolTile=G.isSymbolTile,this.tileTransform=o.av(G.tileID.canonical,G.projection),this.projection=G.projection,this.brightness=G.brightness,this.extraShadowCaster=!!G.extraShadowCaster}parse(G,H,ne,Se,Ie){this.status="parsing",this.data=G,this.collisionBoxArray=new o.aG;const Le=new o.dK(Object.keys(G.layers).sort()),tt=new o.dL(this.tileID,this.promoteId);tt.bucketLayerIDs=[];const Te={},He=new o.dM(256,256),Ke={featureIndex:tt,iconDependencies:{},patternDependencies:{},glyphDependencies:{},lineAtlas:He,availableImages:ne,brightness:this.brightness},st=H.familiesBySource[this.source];for(const li in st){const Si=G.layers[li];if(!Si)continue;let Yi=!1,xi=!1,gr=!1;for(const ji of st[li])ji[0].type==="symbol"?Yi=!0:xi=!0,ji[0].is3D()&&ji[0].type!=="model"&&(gr=!0);if(this.extraShadowCaster&&!gr||this.isSymbolTile===!0&&!Yi||this.isSymbolTile===!1&&!xi)continue;Si.version===1&&o.w(`Vector tile source "${this.source}" layer "${li}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const dr=Le.encode(li),Jr=[];for(let ji=0;ji<Si.length;ji++){const Ai=Si.feature(ji),ve=tt.getId(Ai,li);Jr.push({feature:Ai,id:ve,index:ji,sourceLayerIndex:dr})}for(const ji of st[li]){const Ai=ji[0];(!this.extraShadowCaster||Ai.is3D()&&Ai.type!=="model")&&(this.isSymbolTile!==void 0&&Ai.type==="symbol"!==this.isSymbolTile||Ai.minzoom&&this.zoom<Math.floor(Ai.minzoom)||Ai.maxzoom&&this.zoom>=Ai.maxzoom||Ai.visibility!=="none"&&(fn(ji,this.zoom,Ke.brightness,ne),(Te[Ai.id]=Ai.createBucket({index:tt.bucketLayerIDs.length,layers:ji,zoom:this.zoom,canonical:this.canonical,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:dr,sourceID:this.source,projection:this.projection.spec})).populate(Jr,Ke,this.tileID.canonical,this.tileTransform),tt.bucketLayerIDs.push(ji.map(ve=>ve.id))))}}let qe,ai,Jt,si;He.trim();const Kt={type:"maybePrepare",isSymbolTile:this.isSymbolTile,zoom:this.zoom},ei=()=>
13{if(qe)return this.status="done",Ie(qe);if(this.extraShadowCaster)this.status="done",Ie(null,{buckets:o.b2(Te).filter(li=>!li.isEmpty()),featureIndex:tt,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:Ke.brightness,glyphMap:null,iconMap:null,glyphPositions:null});else if(ai&&Jt&&si){const li=new Pr(ai),Si=new o.dO(Jt,si);for(const Yi in Te){const xi=Te[Yi];xi instanceof o.aH?(fn(xi.layers,this.zoom,Ke.brightness,ne),o.dP(xi,ai,li.positions,Jt,Si.iconPositions,this.showCollisionBoxes,ne,this.tileID.canonical,this.tileZoom,this.projection,this.brightness)):xi.hasPattern&&(xi instanceof o.aN||xi instanceof o.aO||xi instanceof o.cO)&&(fn(xi.layers,this.zoom,Ke.brightness,ne),xi.addFeatures(Ke,this.tileID.canonical,Si.patternPositions,ne,this.tileTransform,this.brightness))}this.status="done",Ie(null,{buckets:o.b2(Te).filter(Yi=>!Yi.isEmpty()),featureIndex:tt,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:li.image,lineAtlas:He,imageAtlas:Si,brightness:Ke.brightness})}};if(!this.extraShadowCaster){const li=o.dN(Ke.glyphDependencies,xi=>Object.keys(xi).map(Number));Object.keys(li).length?Se.send("getGlyphs",{uid:this.uid,stacks:li,scope:this.scope},(xi,gr)=>{qe||(qe=xi,ai=gr,ei())},void 0,!1,Kt):ai={};const Si=Object.keys(Ke.iconDependencies);Si.length?Se.send("getImages",{icons:Si,source:this.source,scope:this.scope,tileID:this.tileID,type:"icons"},(xi,gr)=>{qe||(qe=xi,Jt=gr,ei())},void 0,!1,Kt):Jt={};const Yi=Object.keys(Ke.patternDependencies);Yi.length?Se.send("getImages",{icons:Yi,source:this.source,scope:this.scope,tileID:this.tileID,type:"patterns"},(xi,gr)=>{qe||(qe=xi,si=gr,ei())},void 0,!1,Kt):si={}}ei()}}function fn(Re,G,H,ne){const Se=new o.N(G,{brightness:H});for(const Ie of Re)Ie.recalculate(Se,ne)}class cs extends o.E{constructor(G,H,ne,Se,Ie,Le){super(),this.actor=G,this.layerIndex=H,this.availableImages=ne,this.loadVectorData=Ie||o.ak,this.loading={},this.loaded={},this.deduped=new o.ai(G.scheduler),this.isSpriteLoaded=Se,this.scheduler=G.scheduler,this.brightness=Le}loadTile(G,H){const ne=G.uid,Se=G&&G.request,Ie=Se&&Se.collectResourceTiming,Le=this.loading[ne]=new pn(G);Le.abort=this.loadVectorData(G,(tt,Te)=>{const He=!this.loading[ne];if(delete this.loading[ne],He||tt||!Te)return Le.status="done",He||(this.loaded[ne]=Le),H(tt);const Ke=Te.rawData,st={};Te.expires&&(st.expires=Te.expires),Te.cacheControl&&(st.cacheControl=Te.cacheControl),Le.vectorTile=Te.vectorTile||new o.dQ(new o.dR(Ke));const qe=()=>{Le.parse(Le.vectorTile,this.layerIndex,this.availableImages,this.actor,(ai,Jt)=>{if(ai||!Jt)return H(ai);const si={};if(Ie){const Kt=At(Se);Kt.length>0&&(si.resourceTiming=JSON.parse(JSON.stringify(Kt)))}H(null,o.e({rawTileData:Ke.slice(0)},Jt,st,si))})};this.isSpriteLoaded?qe():this.once("isSpriteLoaded",()=>{this.scheduler?this.scheduler.add(qe,{type:"parseTile",isSymbolTile:G.isSymbolTile,zoom:G.tileZoom}):qe()}),this.loaded=this.loaded||{},this.loaded[ne]=Le})}reloadTile(G,H){const ne=this.loaded,Se=G.uid,Ie=this;if(ne&&ne[Se]){const Le=ne[Se];Le.showCollisionBoxes=G.showCollisionBoxes,Le.projection=G.projection,Le.brightness=G.brightness,Le.tileTransform=o.av(G.tileID.canonical,G.projection),Le.extraShadowCaster=G.extraShadowCaster;const tt=(Te,He)=>{const Ke=Le.reloadCallback;Ke&&(delete Le.reloadCallback,Le.parse(Le.vectorTile,Ie.layerIndex,this.availableImages,Ie.actor,Ke)),H(Te,He)};Le.status==="parsing"?Le.reloadCallback=tt:Le.status==="done"&&(Le.vectorTile?Le.parse(Le.vectorTile,this.layerIndex,this.availableImages,this.actor,tt):tt())}else H(null,void 0)}abortTile(G,H){const ne=G.uid,Se=this.loading[ne];Se&&(Se.abort&&Se.abort(),delete this.loading[ne]),H()}removeTile(G,H){const ne=this.loaded,Se=G.uid;ne&&ne[Se]&&delete ne[Se],H()}}class Za{loadTile(G,H){const{uid:ne,encoding:Se,rawImageData:Ie,padding:Le}=G,tt=ImageBitmap&&Ie instanceof ImageBitmap?this.getImageData(Ie,Le):Ie;H(null,new o.dS(ne,tt,Se,Le<1))}getImageData(G,H){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(G.width,G.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d",{willReadFrequently:!0})),this.offscreenCanvas.width=G.width,this.offscreenCanvas.height=G.height,this.offscreenCanvasContext.drawImage(G,0,0,G.width,G.height);const ne=this.offscreenCanvasContext.getImageData(-H,-H,G.width+2*H,G.height+2*H);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),ne}}class zr{decodeRasterArray({task:G,buffer:H},ne){o.b0.performDecoding(H,G).then(Se=>{ne(null,Se)},Se=>{ne(Se)})}}const Di=o.dT.prototype.toGeoJSON;let Ri=class{constructor(Re){this._feature=Re,this.extent=o.Y,this.type=Re.type,this.properties=Re.tags,"id"in Re&&!isNaN(Re.id)&&(this.id=p
vendor: 5,875 bytes, line 13
13arseInt(Re.id,10))}loadGeometry(){if(this._feature.type===1){const Re=[];for(const G of this._feature.geometry)Re.push([new o.P(G[0],G[1])]);return Re}{const Re=[];for(const G of this._feature.geometry){const H=[];for(const ne of G)H.push(new o.P(ne[0],ne[1]));Re.push(H)}return Re}}toGeoJSON(Re,G,H){return Di.call(this,Re,G,H)}},$n=class{constructor(Re){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=o.Y,this.length=Re.length,this._features=Re}feature(Re){return new Ri(this._features[Re])}};var Yr={exports:{}},$a=o.dV,Wa=o.dU.VectorTileFeature,mi=Ns;function Ns(Re,G){this.options=G||{},this.features=Re,this.length=Re.length}function Dr(Re,G){this.id=typeof Re.id=="number"?Re.id:void 0,this.type=Re.type,this.rawGeometry=Re.type===1?[Re.geometry]:Re.geometry,this.properties=Re.tags,this.extent=G||4096}Ns.prototype.feature=function(Re){return new Dr(this.features[Re],this.options.extent)},Dr.prototype.loadGeometry=function(){var Re=this.rawGeometry;this.geometry=[];for(var G=0;G<Re.length;G++){for(var H=Re[G],ne=[],Se=0;Se<H.length;Se++)ne.push(new $a(H[Se][0],H[Se][1]));this.geometry.push(ne)}return this.geometry},Dr.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var Re=this.geometry,G=1/0,H=-1/0,ne=1/0,Se=-1/0,Ie=0;Ie<Re.length;Ie++)for(var Le=Re[Ie],tt=0;tt<Le.length;tt++){var Te=Le[tt];G=Math.min(G,Te.x),H=Math.max(H,Te.x),ne=Math.min(ne,Te.y),Se=Math.max(Se,Te.y)}return[G,ne,H,Se]},Dr.prototype.toGeoJSON=Wa.prototype.toGeoJSON;var Qa=o.dW,Bo=mi;function nr(Re){var G=new Qa;return function(H,ne){for(var Se in H.layers)ne.writeMessage(3,_i,H.layers[Se])}(Re,G),G.finish()}function _i(Re,G){var H;G.writeVarintField(15,Re.version||1),G.writeStringField(1,Re.name||""),G.writeVarintField(5,Re.extent||4096);var ne={keys:[],values:[],keycache:{},valuecache:{}};for(H=0;H<Re.length;H++)ne.feature=Re.feature(H),G.writeMessage(2,Vs,ne);var Se=ne.keys;for(H=0;H<Se.length;H++)G.writeStringField(3,Se[H]);var Ie=ne.values;for(H=0;H<Ie.length;H++)G.writeMessage(4,Yt,Ie[H])}function Vs(Re,G){var H=Re.feature;H.id!==void 0&&G.writeVarintField(1,H.id),G.writeMessage(2,Rr,Re),G.writeVarintField(3,H.type),G.writeMessage(4,us,H)}function Rr(Re,G){var H=Re.feature,ne=Re.keys,Se=Re.values,Ie=Re.keycache,Le=Re.valuecache;for(var tt in H.properties){var Te=H.properties[tt],He=Ie[tt];if(Te!==null){He===void 0&&(ne.push(tt),Ie[tt]=He=ne.length-1),G.writeVarint(He);var Ke=typeof Te;Ke!=="string"&&Ke!=="boolean"&&Ke!=="number"&&(Te=JSON.stringify(Te));var st=Ke+":"+Te,qe=Le[st];qe===void 0&&(Se.push(Te),Le[st]=qe=Se.length-1),G.writeVarint(qe)}}}function Vr(Re,G){return(G<<3)+(7&Re)}function Us(Re){return Re<<1^Re>>31}function us(Re,G){for(var H=Re.loadGeometry(),ne=Re.type,Se=0,Ie=0,Le=H.length,tt=0;tt<Le;tt++){var Te=H[tt],He=1;ne===1&&(He=Te.length),G.writeVarint(Vr(1,He));for(var Ke=ne===3?Te.length-1:Te.length,st=0;st<Ke;st++){st===1&&ne!==1&&G.writeVarint(Vr(2,Ke-1));var qe=Te[st].x-Se,ai=Te[st].y-Ie;G.writeVarint(Us(qe)),G.writeVarint(Us(ai)),Se+=qe,Ie+=ai}ne===3&&G.writeVarint(Vr(7,1))}}function Yt(Re,G){var H=typeof Re;H==="string"?G.writeStringField(1,Re):H==="boolean"?G.writeBooleanField(7,Re):H==="number"&&(Re%1!=0?G.writeDoubleField(3,Re):Re<0?G.writeSVarintField(6,Re):G.writeVarintField(5,Re))}Yr.exports=nr,Yr.exports.fromVectorTileJs=nr,Yr.exports.fromGeojsonVt=function(Re,G){G=G||{};var H={};for(var ne in Re)H[ne]=new Bo(Re[ne].features,G),H[ne].name=ne,H[ne].version=G.version,H[ne].extent=G.extent;return nr({layers:H})},Yr.exports.GeoJSONWrapper=Bo;var js=o.dX(Yr.exports);const hr={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:Re=>Re},Gs=Math.fround||(hs=new Float32Array(1),Re=>(hs[0]=+Re,hs[0]));var hs;const Ur=3,ut=5,ds=6;class vi{constructor(G){this.options=Object.assign(Object.create(hr),G),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(G){const{log:H,minZoom:ne,maxZoom:Se}=this.options;H&&console.time("total time");const Ie=`prepare ${G.length} points`;H&&console.time(Ie),this.points=G;const Le=[];for(let Te=0;Te<G.length;Te++){const He=G[Te];if(!He.geometry)continue;const[Ke,st]=He.geometry.coordinates,qe=Gs(Wn(Ke)),ai=Gs(Qn(st));Le.push(qe,ai,1/0,Te,-1,1),this.options.reduce&&Le.push(0)}let tt=this.trees[Se+1]=this._createTree(Le);H&&console.timeEnd(Ie);for(let Te=Se;Te>=ne;Te--){const He=+Date.now();tt=this.trees[Te]=this._createTree(this._cluster(tt,Te)),H&&console.log("z%d: %d clusters in %dms",Te,tt.numItems,+Date.now()-He)}return H&&console.timeEnd("total time"),this}getClusters(G,H){let ne=((G[0]+180)%360+360)%360-180;const Se=Math.max(-90,Math.min(90,G[1]));let Ie=G[2]===180?180:((G[2]+180)%360+360)%360-180;const Le=Math.max(-90,Math.min(90,G[3]));if(G[2]-G[0]>=360)ne=-180,Ie=180;else if(ne>Ie){const st=this.getClusters([ne,Se,180,Le],H),qe=this.getClusters([-180,Se,Ie,Le],H);return st.concat(qe)}const tt=this.trees[this._limitZoom(H)],Te=tt.range(Wn(ne),Qn(Le),Wn(Ie),Qn(Se)),He=tt.data,Ke=[];for(const st of Te){const qe=this.stride*st;Ke.push(He[qe+ut]>1?Fo(He,qe,this.clusterProps):this.points[He[qe+Ur]])}return Ke}getChildren(G){const H=this._getOriginId(G),ne=this._getOriginZoom(G),Se="No cluster with the specified id.",Ie=this.trees[ne];if(!Ie)throw new Error(Se);const Le=Ie.data;if(H*this.stride>=Le.length)throw new Error(Se);const tt=this.options.radius/(this.options.extent*Math.pow(2,ne-1)),Te=Ie.within(Le[H*this.stride],Le[H*this.stride+1],tt),He=[];for(const Ke of Te){const st=Ke*this.stride;Le[st+4]===G&&He.push(Le[st+ut]>1?Fo(Le,st,this.clusterProps):this.points[Le[st+Ur]])}if(He.length===0)throw new Error(Se);return He}getLeaves(G,H,ne){const Se=[];return this._appendLeaves(Se,G,H=H||10,ne=ne||0,0),Se}getTile(G,H,ne){const Se=this.trees[this._limitZoom(G)],Ie=Math.pow(2,G),{extent:Le,radiu
13s:tt}=this.options,Te=tt/Le,He=(ne-Te)/Ie,Ke=(ne+1+Te)/Ie,st={features:[]};return this._addTileFeatures(Se.range((H-Te)/Ie,He,(H+1+Te)/Ie,Ke),Se.data,H,ne,Ie,st),H===0&&this._addTileFeatures(Se.range(1-Te/Ie,He,1,Ke),Se.data,Ie,ne,Ie,st),H===Ie-1&&this._addTileFeatures(Se.range(0,He,Te/Ie,Ke),Se.data,-1,ne,Ie,st),st.features.length?st:null}getClusterExpansionZoom(G){let H=this._getOriginZoom(G)-1;for(;H<=this.options.maxZoom;){const ne=this.getChildren(G);if(H++,ne.length!==1)break;G=ne[0].properties.cluster_id}return H}_appendLeaves(G,H,ne,Se,Ie){const Le=this.getChildren(H);for(const tt of Le){const Te=tt.properties;if(Te&&Te.cluster?Ie+Te.point_count<=Se?Ie+=Te.point_count:Ie=this._appendLeaves(G,Te.cluster_id,ne,Se,Ie):Ie<Se?Ie++:G.push(tt),G.length===ne)break}return Ie}_createTree(G){const H=new o.bj(G.length/this.stride|0,this.options.nodeSize,Float32Array);for(let ne=0;ne<G.length;ne+=this.stride)H.add(G[ne],G[ne+1]);return H.finish(),H.data=G,H}_addTileFeatures(G,H,ne,Se,Ie,Le){for(const tt of G){const Te=tt*this.stride,He=H[Te+ut]>1;let Ke,st,qe;if(He)Ke=qs(H,Te,this.clusterProps),st=H[Te],qe=H[Te+1];else{const si=this.points[H[Te+Ur]];Ke=si.properties;const[Kt,ei]=si.geometry.coordinates;st=Wn(Kt),qe=Qn(ei)}const ai={type:1,geometry:[[Math.round(this.options.extent*(st*Ie-ne)),Math.round(this.options.extent*(qe*Ie-Se))]],tags:Ke};let Jt;Jt=He||this.options.generateId?H[Te+Ur]:this.points[H[Te+Ur]].id,Jt!==void 0&&(ai.id=Jt),Le.features.push(ai)}}_limitZoom(G){return Math.max(this.options.minZoom,Math.min(Math.floor(+G),this.options.maxZoom+1))}_cluster(G,H){const{radius:ne,extent:Se,reduce:Ie,minPoints:Le}=this.options,tt=ne/(Se*Math.pow(2,H)),Te=G.data,He=[],Ke=this.stride;for(let st=0;st<Te.length;st+=Ke){if(Te[st+2]<=H)continue;Te[st+2]=H;const qe=Te[st],ai=Te[st+1],Jt=G.within(Te[st],Te[st+1],tt),si=Te[st+ut];let Kt=si;for(const ei of Jt){const li=ei*Ke;Te[li+2]>H&&(Kt+=Te[li+ut])}if(Kt>si&&Kt>=Le){let ei,li=qe*si,Si=ai*si,Yi=-1;const xi=(st/Ke<<5)+(H+1)+this.points.length;for(const gr of Jt){const dr=gr*Ke;if(Te[dr+2]<=H)continue;Te[dr+2]=H;const Jr=Te[dr+ut];li+=Te[dr]*Jr,Si+=Te[dr+1]*Jr,Te[dr+4]=xi,Ie&&(ei||(ei=this._map(Te,st,!0),Yi=this.clusterProps.length,this.clusterProps.push(ei)),Ie(ei,this._map(Te,dr)))}Te[st+4]=xi,He.push(li/Kt,Si/Kt,1/0,xi,-1,Kt),Ie&&He.push(Yi)}else{for(let ei=0;ei<Ke;ei++)He.push(Te[st+ei]);if(Kt>1)for(const ei of Jt){const li=ei*Ke;if(!(Te[li+2]<=H)){Te[li+2]=H;for(let Si=0;Si<Ke;Si++)He.push(Te[li+Si])}}}}return He}_getOriginId(G){return G-this.points.length>>5}_getOriginZoom(G){return(G-this.points.length)%32}_map(G,H,ne){if(G[H+ut]>1){const Le=this.clusterProps[G[H+ds]];return ne?Object.assign({},Le):Le}const Se=this.points[G[H+Ur]].properties,Ie=this.options.map(Se);return ne&&Ie===Se?Object.assign({},Ie):Ie}}function Fo(Re,G,H){return{type:"Feature",id:Re[G+Ur],properties:qs(Re,G,H),geometry:{type:"Point",coordinates:[(ne=Re[G],360*(ne-.5)),No(Re[G+1])]}};var ne}function qs(Re,G,H){const ne=Re[G+ut],Se=ne>=1e4?`${Math.round(ne/1e3)}k`:ne>=1e3?Math.round(ne/100)/10+"k":ne,Ie=Re[G+ds],Le=Ie===-1?{}:Object.assign({},H[Ie]);return Object.assign(Le,{cluster:!0,cluster_id:Re[G+Ur],point_count:ne,point_count_abbreviated:Se})}function Wn(Re){return Re/360+.5}function Qn(Re){const G=Math.sin(Re*Math.PI/180),H=.5-.25*Math.log((1+G)/(1-G))/Math.PI;return H<0?0:H>1?1:H}function No(Re){const G=(180-360*Re)*Math.PI/180;return 360*Math.atan(Math.exp(G))/Math.PI-90}var Zs={exports:{}};Zs.exports=function(){function Re(ve,be,Pe,Oe){for(var ke,Ue=Oe,je=Pe-be>>1,Be=Pe-be,Ze=ve[be],Fe=ve[be+1],_t=ve[Pe],Nt=ve[Pe+1],rt=be+3;rt<Pe;rt+=3){var ci=G(ve[rt],ve[rt+1],Ze,Fe,_t,Nt);if(ci>Ue)ke=rt,Ue=ci;else if(ci===Ue){var Ii=Math.abs(rt-je);Ii<Be&&(ke=rt,Be=Ii)}}Ue>Oe&&(ke-be>3&&Re(ve,be,ke,Oe),ve[ke+2]=Ue,Pe-ke>3&&Re(ve,ke,Pe,Oe))}function G(ve,be,Pe,Oe,ke,Ue){var je=ke-Pe,Be=Ue-Oe;if(je!==0||Be!==0){var Ze=((ve-Pe)*je+(be-Oe)*Be)/(je*je+Be*Be);Ze>1?(Pe=ke,Oe=Ue):Ze>0&&(Pe+=je*Ze,Oe+=Be*Ze)}return(je=ve-Pe)*je+(Be=be-Oe)*Be}function H(ve,be,Pe,Oe){var ke={id:ve===void 0?null:ve,type:be,geometry:Pe,tags:Oe,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(Ue){var je=Ue.geometry,Be=Ue.type;if(Be==="Point"||Be==="MultiPoint"||Be==="LineString")ne(Ue,je);else if(Be==="Polygon"||Be==="MultiLineString")for(var Ze=0;Ze<je.length;Ze++)ne(Ue,je[Ze]);else if(Be==="MultiPolygon")for(Ze=0;Ze<je.length;Ze++)for(var Fe=0;Fe<je[Ze].length;Fe++)ne(Ue,je[Ze][Fe])}(ke),ke}function ne(ve,be){for(var Pe=0;Pe<be.length;Pe+=3)ve.minX=Math.min(ve.minX,be[Pe]),ve.minY=Math.min(ve.minY,be[Pe+1]),ve.maxX=Math.max(ve.maxX,be[Pe]),ve.maxY=Math.max(ve.maxY,be[Pe+1])}function Se(ve,be,Pe,Oe){if(be.geometry){var ke=be.geometry.coordinates,Ue=be.geometry.type,je=Math.pow(Pe.tolerance/((1<<Pe.maxZoom)*Pe.extent),2),Be=[],Ze=be.id;if(Pe.promoteId?Ze=be.properties[Pe.promoteId]:Pe.generateId&&(Ze=Oe||0),Ue==="Point")Ie(ke,Be);else if(Ue==="MultiPoint")for(var Fe=0;Fe<ke.length;Fe++)Ie(ke[Fe],Be);else if(Ue==="LineString")Le(ke,Be,je,!1);else if(Ue==="MultiLineString"){if(Pe.lineMetrics){for(Fe=0;Fe<ke.length;Fe++)Le(ke[Fe],Be=[],je,!1),ve.push(H(Ze,"LineString",Be,be.properties));return}tt(ke,Be,je,!1)}else if(Ue==="Polygon")tt(ke,Be,je,!0);else{if(Ue!=="MultiPolygon"){if(Ue==="GeometryCollection"){for(Fe=0;Fe<be.geometry.geometries.length;Fe++)Se(ve,{id:Ze,geometry:be.geometry.geometries[Fe],properties:be.properties},Pe,Oe);return}throw new Error("Input data is not a valid GeoJSON object.")}for(Fe=0;Fe<ke.length;Fe++){var _t=[];tt(ke[Fe],_t,je,!0),Be.push(_t)}}ve.push(H(Ze,Ue,Be,be.properties))}}function Ie(ve,be){be.push(Te(ve[0])),be.push(He(ve[1])),be.push(0)}function Le(ve,be,Pe,Oe){for(var ke,Ue,je=0,Be=0;Be<ve.length;Be++){var Ze=Te(ve[Be][0]),Fe=He(ve[Be][1]);be.push(Ze),be.push(Fe),be.push(0),Be>0&&(je+=Oe?(ke*Fe-Ze*Ue)/2:Math.sqrt(Math.pow(Ze-ke,2)+Math.pow(Fe-Ue,2))),ke=Ze,Ue=Fe}var _t=be.length-3;be[2]=1,Re(be,0,_t,Pe),be[_t+2]=1,be.size=Math.abs(je),be.start=0,be.end=be.size}function tt(ve,be,Pe,Oe){for(var ke=0;ke<ve.length;ke++){var Ue=[];Le(ve[ke],Ue,Pe,Oe),be.push(Ue)}}function Te(ve){return ve/360+.5}function He(ve){var be=Math.sin(ve*Math.PI/180),Pe=.5-.25*Math.log((1+be)/(1-be))/Math.PI;return Pe<0?0:Pe>1?1:Pe}function Ke(ve,be,Pe,Oe,ke,Ue,je,Be){if(Oe/=be,Ue>=(Pe/=be)&&je<Oe)return ve;if(je<Pe||Ue>=Oe)return null;for(var Ze=[],Fe=0;Fe<ve.length;Fe++){var _t=ve[Fe],Nt=_t.geometry,rt=_t.type,ci=ke===0?_t.minX:_t.minY,Ii=ke===0?_t.maxX:_t.maxY;if(ci>=Pe&&Ii<Oe)Ze.push(_t);else if(!(Ii<Pe||ci>=Oe)){var pi=[];if(rt==="Point"||rt==="MultiPoint")st(Nt,pi,Pe,Oe,ke);else if(rt==="LineString")qe(Nt,pi,Pe,Oe,ke,!1,Be.lineMetrics);else if(rt==="MultiLineString")Jt(Nt,pi,Pe,Oe,ke,!1);else if(rt==="Polygon")Jt(Nt,pi,Pe,Oe,ke,!0);else if(rt==="MultiPolygon")for(var Oi=0;Oi<Nt.length;Oi++){var zi=[];Jt(Nt[Oi],zi,Pe,Oe,ke,!0),zi.length&&pi.push(zi)}if(pi.length){if(Be.lineMetrics&&rt==="LineString"){for(Oi=0;Oi<pi.length;Oi++)Ze.push(H(_t.id,rt,pi[Oi],_t.tags));continue}rt!=="LineString"&&rt!=="MultiLineString"||(pi.length===1?(rt="LineString",pi=pi[0]):rt="MultiLineString"),rt!=="Point"&&rt!=="MultiPoint"||(rt=pi.length===3?"Point":"MultiPoint"),Ze.push(H(_t.id,rt,pi,_t.tags))}}}return Ze.length?Ze:null}function st(ve,be,Pe,Oe,ke){for(var Ue=0;Ue<ve.length;Ue+=3){var je=ve[Ue+ke];je>=Pe&&je<=Oe&&(be.push(ve[Ue]),be.push(ve[Ue+1]),be.push(ve[Ue+2]))}}function qe(ve,be,Pe,Oe,ke,Ue,je){for(var Be,Ze,Fe=ai(ve),_t=ke===0?Kt:ei,Nt=ve.start,rt=0;rt<ve.length-3;rt+=3){var ci=ve[rt],Ii=ve[rt+1],pi=ve[rt+2],Oi=ve[rt+3],zi=ve[rt+4],qt=ke===0?ci:Ii,Lr=ke===0?Oi:zi,Kr=!1;je&&(Be=Math.sqrt(Math.pow(ci-Oi,2)+Math.pow(Ii-zi,2))),qt<Pe?Lr>Pe&&(Ze=_t(Fe,ci,Ii,Oi,zi,Pe),je&&(Fe.start=Nt+Be*Ze)):qt>Oe?Lr<Oe&&(Ze=_t(Fe,ci,Ii,Oi,zi,Oe),je&&(Fe.start=Nt+Be*Ze)):si(Fe,ci,Ii,pi),Lr<Pe&&qt>=Pe&&(Ze=_t(Fe,ci,Ii,Oi,zi,Pe),Kr=!0),Lr>Oe&&qt<=Oe&&(Ze=_t(Fe,ci,Ii,Oi,zi,Oe),Kr=!0),!Ue&&Kr&&(je&&(Fe.end=Nt+Be*Ze),be.push(Fe),Fe=ai(ve)),je&&(Nt+=Be)}var Ki=ve.length-3;ci=ve[Ki],Ii=ve[Ki+1],pi=ve[Ki+2],(qt=ke===0?ci:Ii)>=Pe&&qt<=Oe&&si(Fe,ci,Ii,pi),Ki=Fe.length-3,Ue&&Ki>=3&&(Fe[Ki]!==Fe[0]||Fe[Ki+1]!==Fe[1])&&si(Fe,Fe[0],Fe[1],Fe[2]),Fe.length&&be.push(Fe)}function ai(ve){var be=[];return be.size=ve.size,be.start=ve.start,be.end=ve.end,be}function Jt(ve,be,Pe,Oe,ke,Ue){for(var je=0;je<ve.length;je++)qe(ve[je],be,Pe,Oe,ke,Ue,!1)}function si(ve,be,Pe,Oe){ve.push(be),ve.push(Pe),ve.push(Oe)}function Kt(ve,be,Pe,Oe,ke,Ue){var je=(Ue-be)/(Oe-be);return ve.push(Ue),ve.push(Pe+(ke-Pe)*je),ve.push(1),je}function ei(ve,be,Pe,Oe,ke,Ue){var je=(Ue-Pe)/(ke-Pe);return ve.push(be+(Oe-be)*je),ve.push(Ue),ve.push(1),je}function li(ve,be){for(var Pe=[],Oe=0;Oe<ve.length;Oe++){var ke,Ue=ve[Oe],je=Ue.type;if(je==="Point"||je==="MultiPoint"||je==="LineString")ke=Si(Ue.geometry,be);else if(je==="MultiLineString"||je==="Polygon"){ke=[];for(var Be=0;Be<Ue.geometry.length;Be++)ke.push(Si(Ue.geometry[Be],be))}else if(je==="MultiPolygon")for(ke=[],Be=0;Be<Ue.geometry.length;Be++){for(var Ze=[],Fe=0;Fe<Ue.geometry[Be].length;Fe++)Ze.push(Si(Ue.geometry[Be][Fe],be));ke.push(Ze)}Pe.push(H(Ue.id,je,ke,Ue.tags))}return Pe}function Si(ve,be){var Pe=[];Pe.size=ve.size,ve.start!==void 0&&(Pe.start=ve.start,Pe.end=ve.end);for(var Oe=0;Oe<ve.length;Oe+=3)Pe.push(ve[Oe]+be,ve[Oe+1],ve[Oe+2]);return Pe}function Yi(ve,be){if(ve.transformed)return ve;var Pe,Oe,ke,Ue=1<<ve.z,je=ve.x,Be=ve.y;for(Pe=0;Pe<ve.features.length;Pe++){var Ze=ve.features[Pe],Fe=Ze.geometry,_t=Ze.type;if(Ze.geometry=[],_t===1)for(Oe=0;Oe<Fe.length;Oe+=2)Ze.geometry.push(xi(Fe[Oe],Fe[Oe+1],be,Ue,je,Be));else for(Oe=0;Oe<Fe.length;Oe++){var Nt=[];for(ke=0;ke<Fe[Oe].length;ke+=2)Nt.push(xi(Fe[Oe][ke],Fe[Oe][ke+1],be,Ue,je,Be));Ze.geometry.push(Nt)}}return ve.transformed=!0,ve}function xi(ve,be,Pe,Oe,ke,Ue){return[Math.round(Pe*(ve*Oe-ke)),Math.round(Pe*(be*Oe-Ue))]}function gr(ve,be,Pe,Oe,ke){for(var Ue=be===ke.maxZoom?0:ke.tolerance/((1<<be)*ke.extent),je={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:Pe,y:Oe,z:be,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0},Be=0;Be<ve.length;Be++){je.numFeatures++,dr(je,ve[Be],Ue,ke);var Ze=ve[Be].minX,Fe=ve[Be].minY,_t=ve[Be].maxX,Nt=ve[Be].maxY;Ze<je.minX&&(je.minX=Ze),Fe<je.minY&&(je.minY=Fe),_t>je.maxX&&(je.maxX=_t),Nt>je.maxY&&(je.maxY=Nt)}return je}function dr(ve,be,Pe,Oe){var ke=be.geometry,Ue=be.type,je=[];if(Ue==="Point"||Ue==="MultiPoint")for(var Be=0;Be<ke.length;Be+=3)je.push(ke[Be]),je.push(ke[Be+1]),ve.numPoints++,ve.numSimplified++;else if(Ue==="LineString")Jr(je,ke,ve,Pe,!1,!1);else if(Ue==="MultiLineString"||Ue==="Polygon")for(Be=0;Be<ke.length;Be++)Jr(je,ke[Be],ve,Pe,Ue==="Polygon",Be===0);else if(Ue==="MultiPolygon")for(var Ze=0;Ze<ke.length;Ze++){var Fe=ke[Ze];for(Be=0;Be<Fe.length;Be++)Jr(je,Fe[Be],ve,Pe,!0,Be===0)}if(je.length){var _t=be.tags||null;if(Ue==="LineString"&&Oe.lineMetrics){for(var Nt in _t={},be.tags)_t[Nt]=be.tags[Nt];_t.mapbox_clip_start=ke.start/ke.size,_t.mapbox_clip_end=ke.end/ke.size}var rt={geometry:je,type:Ue==="Polygon"||Ue==="MultiPolygon"?3:Ue==="LineString"||Ue==="MultiLineString"?2:1,tags:_t};be.id!==null&&(rt.id=be.id),ve.features.push(rt)}}function Jr(ve,be,Pe,Oe,ke,Ue){var je=Oe*Oe;if(Oe>0&&be.size<(ke?je:Oe))Pe.numPoints+=be.length/3;else{for(var Be=[],Ze=0;Ze<be.length;Ze+=3)(Oe===0||be[Ze+2]>je)&&(Pe.numSimplified++,Be.push(be[Ze]),Be.push(be[Ze+1])),Pe.numPoints++;ke&&function(Fe,_t){for(var Nt=0,rt=0,ci=Fe.length,Ii=ci-2;rt<ci;Ii=rt,rt+=2)Nt+=(Fe[rt]-Fe[Ii])*(Fe[rt+1]+Fe[Ii+1]);if(Nt>0===_t)for(rt=0,ci=Fe.length;rt<ci/2;rt+=2){var pi=Fe[rt],Oi=Fe[rt+1];Fe[rt]=Fe[ci-2-rt],Fe[rt+1]=Fe[ci-1-rt],Fe[ci-2-rt]=pi,Fe[ci-1-rt]=Oi}}(Be,Ue),ve.push(Be)}}function ji(ve,be){var Pe=(be=this.options=function(ke,Ue){for(var je in Ue)ke[je]=Ue[je];return ke}(Object.create(this.options),be)).debug;if(Pe&&console.time("preprocess data"),be.maxZoom<0||be.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(be.promoteId&&be.generateId)throw new Error("promoteId and generateId cannot be used together.");var Oe=function(ke,Ue){var je=[];if(ke.type==="FeatureCollection")for(var Be=0;Be<ke.features.length;Be++)Se(je,ke.features[Be],Ue,Be);else Se(je,ke.type==="Feature"?ke:{geometry:ke},Ue);return je}(ve,be);this.tiles={},this.tileCoords=[],Pe&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",be.indexMaxZoom,be.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),(Oe=function(ke,Ue){var je=Ue.buffer/Ue.extent,Be=ke,Ze=Ke(ke,1,-1-je,je,0,-1,2,Ue),Fe
13=Ke(ke,1,1-je,2+je,0,-1,2,Ue);return(Ze||Fe)&&(Be=Ke(ke,1,-je,1+je,0,-1,2,Ue)||[],Ze&&(Be=li(Ze,1).concat(Be)),Fe&&(Be=Be.concat(li(Fe,-1)))),Be}(Oe,be)).length&&this.splitTile(Oe,0,0,0),Pe&&(Oe.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}function Ai(ve,be,Pe){return 32*((1<<ve)*Pe+be)+ve}return ji.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},ji.prototype.splitTile=function(ve,be,Pe,Oe,ke,Ue,je){for(var Be=[ve,be,Pe,Oe],Ze=this.options,Fe=Ze.debug;Be.length;){Oe=Be.pop(),Pe=Be.pop(),be=Be.pop(),ve=Be.pop();var _t=1<<be,Nt=Ai(be,Pe,Oe),rt=this.tiles[Nt];if(!rt&&(Fe>1&&console.time("creation"),rt=this.tiles[Nt]=gr(ve,be,Pe,Oe,Ze),this.tileCoords.push({z:be,x:Pe,y:Oe}),Fe)){Fe>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",be,Pe,Oe,rt.numFeatures,rt.numPoints,rt.numSimplified),console.timeEnd("creation"));var ci="z"+be;this.stats[ci]=(this.stats[ci]||0)+1,this.total++}if(rt.source=ve,ke){if(be===Ze.maxZoom||be===ke)continue;var Ii=1<<ke-be;if(Pe!==Math.floor(Ue/Ii)||Oe!==Math.floor(je/Ii))continue}else if(be===Ze.indexMaxZoom||rt.numPoints<=Ze.indexMaxPoints)continue;if(rt.source=null,ve.length!==0){Fe>1&&console.time("clipping");var pi,Oi,zi,qt,Lr,Kr,Ki=.5*Ze.buffer/Ze.extent,ps=.5-Ki,Uo=.5+Ki,yr=1+Ki;pi=Oi=zi=qt=null,Lr=Ke(ve,_t,Pe-Ki,Pe+Uo,0,rt.minX,rt.maxX,Ze),Kr=Ke(ve,_t,Pe+ps,Pe+yr,0,rt.minX,rt.maxX,Ze),ve=null,Lr&&(pi=Ke(Lr,_t,Oe-Ki,Oe+Uo,1,rt.minY,rt.maxY,Ze),Oi=Ke(Lr,_t,Oe+ps,Oe+yr,1,rt.minY,rt.maxY,Ze),Lr=null),Kr&&(zi=Ke(Kr,_t,Oe-Ki,Oe+Uo,1,rt.minY,rt.maxY,Ze),qt=Ke(Kr,_t,Oe+ps,Oe+yr,1,rt.minY,rt.maxY,Ze),Kr=null),Fe>1&&console.timeEnd("clipping"),Be.push(pi||[],be+1,2*Pe,2*Oe),Be.push(Oi||[],be+1,2*Pe,2*Oe+1),Be.push(zi||[],be+1,2*Pe+1,2*Oe),Be.push(qt||[],be+1,2*Pe+1,2*Oe+1)}}},ji.prototype.getTile=function(ve,be,Pe){var Oe=this.options,ke=Oe.extent,Ue=Oe.debug;if(ve<0||ve>24)return null;var je=1<<ve,Be=Ai(ve,be=(be%je+je)%je,Pe);if(this.tiles[Be])return Yi(this.tiles[Be],ke);Ue>1&&console.log("drilling down to z%d-%d-%d",ve,be,Pe);for(var Ze,Fe=ve,_t=be,Nt=Pe;!Ze&&Fe>0;)Fe--,_t=Math.floor(_t/2),Nt=Math.floor(Nt/2),Ze=this.tiles[Ai(Fe,_t,Nt)];return Ze&&Ze.source?(Ue>1&&console.log("found parent tile z%d-%d-%d",Fe,_t,Nt),Ue>1&&console.time("drilling down"),this.splitTile(Ze.source,Fe,_t,Nt,ve,be,Pe),Ue>1&&console.timeEnd("drilling down"),this.tiles[Be]?Yi(this.tiles[Be],ke):null):null},function(ve,be){return new ji(ve,be)}}();var Ui=o.dX(Zs.exports);function Ha(Re,G){const H=Re.tileID.canonical;if(!this._geoJSONIndex)return G(null,null);const ne=this._geoJSONIndex.getTile(H.z,H.x,H.y);if(!ne)return G(null,null);const Se=new $n(ne.features);let Ie=js(Se);Ie.byteOffset===0&&Ie.byteLength===Ie.buffer.byteLength||(Ie=new Uint8Array(Ie)),G(null,{vectorTile:Se,rawData:Ie.buffer})}class mt extends cs{constructor(G,H,ne,Se,Ie,Le){super(G,H,ne,Se,Ha,Le),Ie&&(this.loadGeoJSON=Ie),this._featureMap=new Map}loadData(G,H){const ne=G&&G.request,Se=ne&&ne.collectResourceTiming;this.loadGeoJSON(G,(Ie,Le)=>{if(Ie||!Le)return H(Ie);if(typeof Le!="object")return H(new Error(`Input data given to '${G.source}' is not a valid GeoJSON object.`));{try{if(G.filter){const Te=o.t(G.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(Te.result==="error")throw new Error(Te.value.map(He=>`${He.key}: ${He.message}`).join(", "));Le.features=Le.features.filter(He=>Te.value.evaluate({zoom:0},He))}if(G.dynamic){Le.type==="Feature"&&(Le={type:"FeatureCollection",features:[Le]}),G.append||this._featureMap.clear();for(const Te of Le.features||[]){const He=Te.id;He!==void 0&&(Te.geometry?this._featureMap.set(He,Te):this._featureMap.delete(He))}Le.features=[...this._featureMap.values()]}this._geoJSONIndex=G.cluster?new vi(function({superclusterOptions:Te,clusterProperties:He}){if(!He||!Te)return Te;const Ke={},st={},qe={accumulated:null,zoom:0},ai={properties:null},Jt=Object.keys(He);for(const si of Jt){const[Kt,ei]=He[si],li=o.t(ei),Si=o.t(typeof Kt=="string"?[Kt,["accumulated"],["get",si]]:Kt);Ke[si]=li.value,st[si]=Si.value}return Te.map=si=>{ai.properties=si;const Kt={};for(const ei of Jt)Kt[ei]=Ke[ei].evaluate(qe,ai);return Kt},Te.reduce=(si,Kt)=>{ai.properties=Kt;for(const ei of Jt)qe.accumulated=si[ei],si[ei]=st[ei].evaluate(qe,ai)},Te}(G)).load(Le.features):Ui(Le,G.geojsonVtOptions)}catch(Te){return H(Te)}this.loaded={};const tt={};if(Se){const Te=At(ne);Te&&(tt.resourceTiming={},tt.resourceTiming[G.source]=JSON.parse(JSON.stringify(Te)))}H(null,tt)}})}reloadTile(G,H){const ne=this.loaded;return ne&&ne[G.uid]?super.reloadTile(G,H):this.loadTile(G,H)}loadGeoJSON(G,H){if(G.request)o.g(G.request,H);else{if(typeof G.data!="string")return H(new Error(`Input data given to '${G.source}' is not a valid GeoJSON object.`));try{return H(null,JSON.parse(G.data))}catch{return H(new Error(`Input data given to '${G.source}' is not a valid GeoJSON object.`))}}}getClusterExpansionZoom(G,H){try{H(null,this._geoJSONIndex.getClusterExpansionZoom(G.clusterId))}catch(ne){H(ne)}}getClusterChildren(G,H){try{H(null,this._geoJSONIndex.getChildren(G.clusterId))}catch(ne){H(ne)}}getClusterLeaves(G,H){try{H(null,this._geoJSONIndex.getLeaves(G.clusterId,G.limit,G.offset))}catch(ne){H(ne)}}}class dt{constructor(G,H){this.tileID=new o.ap(G.tileID.overscaledZ,G.tileID.wrap,G.tileID.canonical.z,G.tileID.canonical.x,G.tileID.canonical.y),this.tileZoom=G.tileZoom,this.uid=G.uid,this.zoom=G.zoom,this.canonical=G.tileID.canonical,this.pixelRatio=G.pixelRatio,this.tileSize=G.tileSize,this.source=G.source,this.overscaling=this.tileID.overscaleFactor(),this.projection=G.projection,this.brightness=H}parse(G,H,ne,Se){this.status="parsing";const Ie=new o.ap(ne.tileID.overscaledZ,ne.tileID.wrap,ne.tileID.canonical.z,ne.tileID.canonical.x,ne.tileID.canonical.y),Le={},tt=H.familiesBySource[ne.source],Te=new o.dL(Ie,ne.promoteId);return Te.bucketLayerIDs=[],Te.is3DTile=!0,o.dY(G).then(He=>{if(!He)return Se(new Error("Could not parse tile"));const Ke=o.dZ(He,1/o.bU(ne.tileID.canonical)),st=He.json.extensionsUsed&&He.json.extensionsUsed.includes("MAPBOX_mesh_features")||He.json.asset.extras&&He.json.asset.extras.MAPBOX_mesh_features,qe=He.json.extensionsUsed&&He.json.extensionsUsed.includes("EXT_meshopt_compression"),ai=new o.N(this.zoom,{brightness:this.brightness});for(const Jt in tt)for(const si of tt[Jt]){const Kt=si[0];Te.bucketLayerIDs.push(si.map(li=>li.id)),Kt.recalculate(ai,[]);const ei=new o.d_(Ke,Ie,st,qe,this.brightness,Te);st||(ei.needsUpload=!0),Le[Kt.fqid]=ei,ei.evaluate(Kt)}this.status="done",Se(null,{buckets:Le,featureIndex:Te})}).catch(He=>Se(new Error(He.message)))}}class Vo{constructor(G,H,ne,Se,Ie,Le){this.actor=G,this.layerIndex=H,this.brightness=Le,this.loading={},this.loaded={}}loadTile(G,H){const ne=G.uid,Se=this.loading[ne]=new dt(G,this.brightness);o.b1(G.request,(Ie,Le)=>{const tt=!this.loading[ne];return delete this.loading[ne],tt||Ie?(Se.status="done",tt||(this.loaded[ne]=Se),H(Ie)):Le&&Le.byteLength!==0?void Se.parse(Le,this.layerIndex,G,(Te,He)=>{Se.status="done",this.loaded=this.loaded||{},this.loaded[ne]=Se,Te||!He?H(Te):H(null,He)}):(Se.status="done",this.loaded[ne]=Se,H())})}reloadTile(G,H){const ne=this.loaded,Se=G.uid;if(ne&&ne[Se]){const Ie=ne[Se];Ie.projection=G.projection,Ie.brightness=G.brightness;const Le=(tt,Te)=>{Ie.reloadCallback&&(delete Ie.reloadCallback,this.loadTile(G,H)),H(tt,Te)};Ie.status==="parsing"?Ie.reloadCallback=Le:Ie.status==="done"&&this.loadTile(G,H)}}abortTile(G,H){const ne=G.uid;this.loading[ne]&&delete this.loading[ne],H()}removeTile(G,H){const ne=this.loaded,Se=G.uid;ne&&ne[Se]&&delete ne[Se],H()}}class jr{constructor(G){this.self=G,this.actor=new o.d$(G,this),this.layerIndexes={},this.availableImages={},this.isSpriteLoaded={},this.projections={},this.defaultProjection=o.br({name:"mercator"}),this.workerSourceTypes={vector:cs,geojson:mt,"batched-model":Vo},this.workerSources={},this.demWorkerSources={}
13,this.self.registerWorkerSource=(H,ne)=>{if(this.workerSourceTypes[H])throw new Error(`Worker source with name "${H}" already registered.`);this.workerSourceTypes[H]=ne},this.self.registerRTLTextPlugin=H=>{if(o.e0.isParsed())throw new Error("RTL text plugin already registered.");o.e0.applyArabicShaping=H.applyArabicShaping,o.e0.processBidirectionalText=H.processBidirectionalText,o.e0.processStyledBidirectionalText=H.processStyledBidirectionalText}}clearCaches(G,H,ne){delete this.layerIndexes[G],delete this.availableImages[G],delete this.workerSources[G],delete this.demWorkerSources[G],delete this.rasterArrayWorkerSource,ne()}checkIfReady(G,H,ne){ne()}setReferrer(G,H){this.referrer=H}spriteLoaded(G,{scope:H,isLoaded:ne}){if(this.isSpriteLoaded[G]||(this.isSpriteLoaded[G]={}),this.isSpriteLoaded[G][H]=ne,this.workerSources[G]&&this.workerSources[G][H])for(const Se in this.workerSources[G][H]){const Ie=this.workerSources[G][H][Se];for(const Le in Ie)Ie[Le]instanceof cs&&(Ie[Le].isSpriteLoaded=ne,Ie[Le].fire(new o.b("isSpriteLoaded")))}}setImages(G,{scope:H,images:ne},Se){if(this.availableImages[G]||(this.availableImages[G]={}),this.availableImages[G][H]=ne,this.workerSources[G]&&this.workerSources[G][H]){for(const Ie in this.workerSources[G][H]){const Le=this.workerSources[G][H][Ie];for(const tt in Le)Le[tt].availableImages=ne}Se()}else Se()}setProjection(G,H){this.projections[G]=o.br(H)}setBrightness(G,H,ne){this.brightness=H,ne()}setLayers(G,H,ne){this.getLayerIndex(G,H.scope).replace(H.layers,H.options),ne()}updateLayers(G,H,ne){this.getLayerIndex(G,H.scope).update(H.layers,H.removedIds,H.options),ne()}loadTile(G,H,ne){H.projection=this.projections[G]||this.defaultProjection,this.getWorkerSource(G,H.type,H.source,H.scope).loadTile(H,ne)}loadDEMTile(G,H,ne){this.getDEMWorkerSource(G,H.source,H.scope).loadTile(H,ne)}decodeRasterArray(G,H,ne){this.getRasterArrayWorkerSource().decodeRasterArray(H,ne)}reloadTile(G,H,ne){H.projection=this.projections[G]||this.defaultProjection,this.getWorkerSource(G,H.type,H.source,H.scope).reloadTile(H,ne)}abortTile(G,H,ne){this.getWorkerSource(G,H.type,H.source,H.scope).abortTile(H,ne)}removeTile(G,H,ne){this.getWorkerSource(G,H.type,H.source,H.scope).removeTile(H,ne)}removeSource(G,H,ne){if(!(this.workerSources[G]&&this.workerSources[G][H.scope]&&this.workerSources[G][H.scope][H.type]&&this.workerSources[G][H.scope][H.type][H.source]))return;const Se=this.workerSources[G][H.scope][H.type][H.source];delete this.workerSources[G][H.scope][H.type][H.source],Se.removeSource!==void 0?Se.removeSource(H,ne):ne()}loadWorkerSource(G,H,ne){try{this.self.importScripts(H.url),ne()}catch(Se){ne(Se.toString())}}syncRTLPluginState(G,H,ne){try{o.e0.setState(H);const Se=o.e0.getPluginURL();if(o.e0.isLoaded()&&!o.e0.isParsed()&&Se!=null){this.self.importScripts(Se);const Ie=o.e0.isParsed();ne(Ie?void 0:new Error(`RTL Text Plugin failed to import scripts from ${Se}`),Ie)}}catch(Se){ne(Se.toString())}}setDracoUrl(G,H){this.dracoUrl=H}getAvailableImages(G,H){this.availableImages[G]||(this.availableImages[G]={});let ne=this.availableImages[G][H];return ne||(ne=[]),ne}getLayerIndex(G,H){this.layerIndexes[G]||(this.layerIndexes[G]={});let ne=this.layerIndexes[G][H];return ne||(ne=this.layerIndexes[G][H]=new Zn,ne.scope=H),ne}getWorkerSource(G,H,ne,Se){if(this.workerSources[G]||(this.workerSources[G]={}),this.workerSources[G][Se]||(this.workerSources[G][Se]={}),this.workerSources[G][Se][H]||(this.workerSources[G][Se][H]={}),this.isSpriteLoaded[G]||(this.isSpriteLoaded[G]={}),!this.workerSources[G][Se][H][ne]){const Ie={send:(Le,tt,Te,He,Ke,st)=>{this.actor.send(Le,tt,Te,G,Ke,st)},scheduler:this.actor.scheduler};this.workerSources[G][Se][H][ne]=new this.workerSourceTypes[H](Ie,this.getLayerIndex(G,Se),this.getAvailableImages(G,Se),this.isSpriteLoaded[G][Se],void 0,this.brightness)}return this.workerSources[G][Se][H][ne]}getDEMWorkerSource(G,H,ne){return this.demWorkerSources[G]||(this.demWorkerSources[G]={}),this.demWorkerSources[G][ne]||(this.demWorkerSources[G][ne]={}),this.demWorkerSources[G][ne][H]||(this.demWorkerSources[G][ne][H]=new Za),this.demWorkerSources[G][ne][H]}getRasterArrayWorkerSource(){return this.rasterArrayWorkerSource||(this.rasterArrayWorkerSource=new zr),this.rasterArrayWorkerSource}enforceCacheSizeLimit(G,H){o.e1(H)}getWorkerPerformanceMetrics(G,H,ne){ne(void 0,void 0)}}return typeof WorkerGlobalScope<"u"&&typeof self<"u"&&self instanceof WorkerGlobalScope&&(self.worker=new jr(self)),jr}),cp(["./shared"],function(o){function At(c,r){if(Array.isArray(c)){if
13(!Array.isArray(r)||c.length!==r.length)return!1;for(let s=0;s<c.length;s++)if(!At(c[s],r[s]))return!1;return!0}if(typeof c=="object"&&c!==null&&r!==null){if(typeof r!="object"||Object.keys(c).length!==Object.keys(r).length)return!1;for(const s in c)if(!At(c[s],r[s]))return!1;return!0}return c===r}var Xr=Tt;function Tt(c){return!function(r){return typeof window>"u"||typeof document>"u"?"not a browser":function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var u,d,f=new Blob([""],{type:"text/javascript"}),_=URL.createObjectURL(f);try{d=new Worker(_),u=!0}catch{u=!1}return d&&d.terminate(),URL.revokeObjectURL(_),u}()?function(){var u=document.createElement("canvas");u.width=u.height=1;var d=u.getContext("2d");if(!d)return!1;var f=d.getImageData(0,0,1,1);return f&&f.width===u.width}()?(Zn[s=r&&r.failIfMajorPerformanceCaveat]===void 0&&(Zn[s]=function(u){var d,f=function(_){var y=document.createElement("canvas"),b=Object.create(Tt.webGLContextAttributes);return b.failIfMajorPerformanceCaveat=_,y.getContext("webgl2",b)}(u);if(!f)return!1;try{d=f.createShader(f.VERTEX_SHADER)}catch{return!1}return!(!d||f.isContextLost())&&(f.shaderSource(d,"void main() {}"),f.compileShader(d),f.getShaderParameter(d,f.COMPILE_STATUS)===!0)}(s)),Zn[s]?document.documentMode?"insufficient ECMAScript 6 support":void 0:"insufficient WebGL2 support"):"insufficient Canvas/getImageData support":"insufficient worker support";var s}(c)}var Zn={};function Ft(c,r,s){const u=document.createElement(c);return r!=null&&(u.className=r),s&&s.appendChild(u),u}function Pr(c,r,s){const u=document.createElementNS("http://www.w3.org/2000/svg",c);for(const d of Object.keys(r))u.setAttributeNS(null,d,String(r[d]));return s&&s.appendChild(u),u}Tt.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0};const pn=typeof document<"u"?document.documentElement&&document.documentElement.style:null,fn=pn&&pn.userSelect!==void 0?"userSelect":"WebkitUserSelect";let cs;function Za(){pn&&fn&&(cs=pn[fn],pn[fn]="none")}function zr(){pn&&fn&&(pn[fn]=cs)}function Di(c){c.preventDefault(),c.stopPropagation(),window.removeEventListener("click",Di,!0)}function Ri(){window.addEventListener("click",Di,!0),window.setTimeout(()=>{window.removeEventListener("click",Di,!0)},0)}function $n(c,r){const s=c.getBoundingClientRect();return Wa(c,s,r)}function Yr(c,r){const s=c.getBoundingClientRect(),u=[];for(let d=0;d<r.length;d++)u.push(Wa(c,s,r[d]));return u}function $a(c){return window.InstallTrigger!==void 0&&c.button===2&&c.ctrlKey&&window.navigator.platform.toUpperCase().indexOf("MAC")>=0?0:c.button}function Wa(c,r,s){const u=c.offsetWidth===r.width?1:c.offsetWidth/r.width;return new o.P((s.clientX-r.left)*u,(s.clientY-r.top)*u)}class mi{constructor(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSourceCaches={},this._updatedPaintProps=new Set,this._updatedImages=new Set}isDirty(){return this._changed}setDirty(){this._changed=!0}getUpdatedSourceCaches(){return this._updatedSourceCaches}updateSourceCache(r,s){this._updatedSourceCaches[r]=s,this.setDirty()}discardSourceCacheUpdate(r){delete this._updatedSourceCaches[r]}updateLayer(r){const s=r.scope;this._updatedLayers[s]=this._updatedLayers[s]||new Set,this._updatedLayers[s].add(r.id),this.setDirty()}removeLayer(r){const s=r.scope;this._removedLayers[s]=this._removedLayers[s]||{},this._updatedLayers[s]=this._updatedLayers[s]||new Set,this._removedLayers[s][r.id]=r,this._updatedLayers[s].delete(r.id),this._updatedPaintProps.delete(r.fqid),this.setDirty()}getRemovedLayer(r){return this._removedLayers[r.scope]?this._removedLayers[r.scope][r.id]:null}discardLayerRemoval(r){this._removedLayers[r.scope]&&delete this._removedLayers[r.scope][r.id]}getLayerUpdatesByScope(){const r={};for(const s in this._updatedLayers)r[s]=r[s]||{},r[s].updatedIds=Array.from(this._updatedLayers[s].values());for(const s in this._removedLayers)r[s]=r[s]||{},r[s].removedIds=Object.keys(this._removedLayers[s]);return r}getUpdatedPaintProperties(){return this._updatedPaintProps}updatePaintProperties(r){this._updatedPaintProps.add(r.fqid),this.setDirty()}getUpdatedImages(){return Array.from(this._updatedImages.values())}updateImage(r){this._updatedImages.add(r),this.setDirty()}resetUpdatedImages(){this._updatedImages.clear()}reset(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSourceCaches={},this._updatedPaintProps.clear(),this._updatedImages.clear()}}class Ns extends o.E{constructor(r){super(),this.requestManager=r,this.models={"":{}},this.numModelsLoading={}}loadModel(r,s){return o.l(this.requestManager.transformRequest(s,o.R.Model).url).then(u=>{if(!u)return;const d=o.c(u),f=new o.M(r,void 0,void 0,d);return f.computeBoundsAndApplyParent(),f}).catch(u=>{if(u&&u.status===404)return null;this.fire(new o.a(new Error(`Could not load model ${r} from ${s}: ${u.message}`)))})}load(r,s){this.models[s]||(this.models[s]={});const u=Object.keys(r);this.numModelsLoading[s]=(this.numModelsLoading[s]||0)+u.length;const d=[];for(const f of u)d.push(this.loadModel(f,r[f]));Promise.allSettled(d).then(f=>{for(let _=0;_<f.length;_++){const{status:y,value:b}=f[_];y==="fulfilled"&&b&&(this.models[s][u[_]]={model:b,numReferences:1})}this.numModelsLoading[s]-=u.length,this.fire(new o.b("data",{dataType:"style"}))}).catch(f=>{this.fire(new o.a(new Error(`Could not load models: ${f.message}`)))})}isLoaded(){for(const r in this.numModelsLoading)if(this.numModelsLoading[r]>0)return!1;return!0}hasModel(r,s){return!!this.getModel(r,s)}getModel(r,s){return this.models[s]||(this.models[s]={}),this.models[s][r]?this.models[s][r].model:void 0}
13addModel(r,s,u){this.models[u]||(this.models[u]={}),this.hasModel(r,u)&&this.models[u][r].numReferences++,this.load({[r]:this.requestManager.normalizeModelURL(s)},u)}addModels(r,s){this.models[s]||(this.models[s]={});const u={};for(const d in r)this.models[s][d]={},u[d]=this.requestManager.normalizeModelURL(r[d]);this.load(u,s)}addModelsFromBucket(r,s){this.models[s]||(this.models[s]={});const u={};for(const d of r)this.hasModel(d,s)?this.models[s][d].numReferences++:u[d]=this.requestManager.normalizeModelURL(d);this.load(u,s)}removeModel(r,s){if(this.models[s]&&this.models[s][r]&&(this.models[s][r].numReferences--,this.models[s][r].numReferences===0)){const u=this.models[s][r].model;delete this.models[s][r],u.destroy()}}listModels(r){return this.models[r]||(this.models[r]={}),Object.keys(this.models[r])}upload(r,s){this.models[s]||(this.models[s]={});for(const u in this.models[s])this.models[s][u].model&&this.models[s][u].model.upload(r.context)}}class Dr{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(r,s,u){const d=String(s);if(this.stateChanges[r]=this.stateChanges[r]||{},this.stateChanges[r][d]=this.stateChanges[r][d]||{},o.e(this.stateChanges[r][d],u),this.deletedStates[r]===null){this.deletedStates[r]={};for(const f in this.state[r])f!==d&&(this.deletedStates[r][f]=null)}else if(this.deletedStates[r]&&this.deletedStates[r][d]===null){this.deletedStates[r][d]={};for(const f in this.state[r][d])u[f]||(this.deletedStates[r][d][f]=null)}else for(const f in u)this.deletedStates[r]&&this.deletedStates[r][d]&&this.deletedStates[r][d][f]===null&&delete this.deletedStates[r][d][f]}removeFeatureState(r,s,u){if(this.deletedStates[r]===null)return;const d=String(s);if(this.deletedStates[r]=this.deletedStates[r]||{},u&&s!==void 0)this.deletedStates[r][d]!==null&&(this.deletedStates[r][d]=this.deletedStates[r][d]||{},this.deletedStates[r][d][u]=null);else if(s!==void 0)if(this.stateChanges[r]&&this.stateChanges[r][d])for(u in this.deletedStates[r][d]={},this.stateChanges[r][d])this.deletedStates[r][d][u]=null;else this.deletedStates[r][d]=null;else this.deletedStates[r]=null}getState(r,s){const u=String(s),d=o.e({},(this.state[r]||{})[u],(this.stateChanges[r]||{})[u]);if(this.deletedStates[r]===null)return{};if(this.deletedStates[r]){const f=this.deletedStates[r][s];if(f===null)return{};for(const _ in f)delete d[_]}return d}initializeTileState(r,s){r.setFeatureState(this.state,s)}coalesceChanges(r,s){const u={};for(const d in this.stateChanges){this.state[d]=this.state[d]||{};const f={};for(const _ in this.stateChanges[d])this.state[d][_]||(this.state[d][_]={}),o.e(this.state[d][_],this.stateChanges[d][_]),f[_]=this.state[d][_];u[d]=f}for(const d in this.deletedStates){this.state[d]=this.state[d]||{};const f={};if(this.deletedStates[d]===null)for(const _ in this.state[d])f[_]={},this.state[d][_]={};else for(const _ in this.deletedStates[d]){if(this.deletedStates[d][_]===null)this.state[d][_]={};else if(this.state[d][_])for(const y of Object.keys(this.deletedStates[d][_]))delete this.state[d][_][y];f[_]=this.state[d][_]}u[d]=u[d]||{},o.e(u[d],f)}if(this.stateChanges={},this.deletedStates={},Object.keys(u).length!==0)for(const d in r)r[d].setFeatureState(u,s)}}function Qa(c){const{userImage:r}=c;return!!(r&&r.render&&r.render())&&(c.data.replace(new Uint8Array(r.data.buffer)),!0)}class Bo extends o.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded={},this.requestors=[],this.patterns={},this.atlasImage={},this.atlasTexture={},this.dirty=!0}createScope(r){this.images[r]={},this.loaded[r]=!1,this.updatedImages[r]={},this.patterns[r]={},this.callbackDispatchedThisFrame[r]={},this.atlasImage[r]=new o.h({width:1,height:1})}isLoaded(){for(const r in this.loaded)if(!this.loaded[r])return!1;return!0}setLoaded(r,s){if(this.loaded[s]!==r&&(this.loaded[s]=r,r)){for(const{ids:u,callback:d}of this.requestors)this._notify(u,s,d);this.requestors=[]}}hasImage(r,s){return!!this.getImage(r,s)}getImage(r,s){return this.images[s][r]}
13addImage(r,s,u){this._validate(r,u)&&(this.images[s][r]=u)}_validate(r,s){let u=!0;return this._validateStretch(s.stretchX,s.data&&s.data.width)||(this.fire(new o.a(new Error(`Image "${r}" has invalid "stretchX" value`))),u=!1),this._validateStretch(s.stretchY,s.data&&s.data.height)||(this.fire(new o.a(new Error(`Image "${r}" has invalid "stretchY" value`))),u=!1),this._validateContent(s.content,s)||(this.fire(new o.a(new Error(`Image "${r}" has invalid "content" value`))),u=!1),u}_validateStretch(r,s){if(!r)return!0;let u=0;for(const d of r){if(d[0]<u||d[1]<d[0]||s<d[1])return!1;u=d[1]}return!0}_validateContent(r,s){return!(r&&(r.length!==4||r[0]<0||s.data.width<r[0]||r[1]<0||s.data.height<r[1]||r[2]<0||s.data.width<r[2]||r[3]<0||s.data.height<r[3]||r[2]<r[0]||r[3]<r[1]))}updateImage(r,s,u){u.version=this.images[s][r].version+1,this.images[s][r]=u,this.updatedImages[s][r]=!0}removeImage(r,s){const u=this.images[s][r];delete this.images[s][r],delete this.patterns[s][r],u.userImage&&u.userImage.onRemove&&u.userImage.onRemove()}listImages(r){return Object.keys(this.images[r])}getImages(r,s,u){let d=!0;const f=!!this.loaded[s];if(!f)for(const _ of r)this.images[s][_]||(d=!1);f||d?this._notify(r,s,u):this.requestors.push({ids:r,scope:s,callback:u})}getUpdatedImages(r){return this.updatedImages[r]}_notify(r,s,u){const d={};for(const f of r){this.images[s][f]||this.fire(new o.b("styleimagemissing",{id:f}));const _=this.images[s][f];_?d[f]={data:_.data.clone(),pixelRatio:_.pixelRatio,sdf:_.sdf,version:_.version,stretchX:_.stretchX,stretchY:_.stretchY,content:_.content,hasRenderCallback:!!(_.userImage&&_.userImage.render)}:o.w(`Image "${f}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`)}u(null,d)}getPixelSize(r){const{width:s,height:u}=this.atlasImage[r];return{width:s,height:u}}getPattern(r,s){const u=this.patterns[s][r],d=this.getImage(r,s);if(!d)return null;if(u&&u.position.version===d.version)return u.position;if(u)u.position.version=d.version;else{const f={w:d.data.width+2,h:d.data.height+2,x:0,y:0},_=new o.I(f,d);this.patterns[s][r]={bin:f,position:_}}return this._updatePatternAtlas(s),this.patterns[s][r].position}bind(r,s){const u=r.gl;let d=this.atlasTexture[s];d?this.dirty&&(d.update(this.atlasImage[s]),this.dirty=!1):(d=new o.T(r,this.atlasImage[s],u.RGBA),this.atlasTexture[s]=d),d.bind(u.LINEAR,u.CLAMP_TO_EDGE)}_updatePatternAtlas(r){const s=[];for(const _ in this.patterns[r])s.push(this.patterns[r][_].bin);const{w:u,h:d}=o.p(s),f=this.atlasImage[r];f.resize({width:u||1,height:d||1});for(const _ in this.patterns[r]){const{bin:y}=this.patterns[r][_],b=y.x+1,T=y.y+1,S=this.images[r][_].data,A=S.width,C=S.height;o.h.copy(S,f,{x:0,y:0},{x:b,y:T},{width:A,height:C}),o.h.copy(S,f,{x:0,y:C-1},{x:b,y:T-1},{width:A,height:1}),o.h.copy(S,f,{x:0,y:0},{x:b,y:T+C},{width:A,height:1}),o.h.copy(S,f,{x:A-1,y:0},{x:b-1,y:T},{width:1,height:C}),o.h.copy(S,f,{x:0,y:0},{x:b+A,y:T},{width:1,height:C})}this.dirty=!0}beginFrame(){for(const r in this.images)this.callbackDispatchedThisFrame[r]={}}dispatchRenderCallbacks(r,s){for(const u of r){if(this.callbackDispatchedThisFrame[s][u])continue;this.callbackDispatchedThisFrame[s][u]=!0;const d=this.images[s][u];Qa(d)&&this.updateImage(u,s,d)}}}function nr(c){const r=c.key,s=c.value,u=c.valueSpec||{},d=c.objectElementValidators||{},f=c.style,_=c.styleSpec;let y=[];const b=o.j(s);if(b!=="object")return[new o.V(r,s,`object expected, ${b} found`)];for(const T in s){const S=T.split(".")[0];let A;d[S]?A=d[S]:u[S]?A=Ui:d["*"]?A=d["*"]:u["*"]&&(A=Ui),A?y=y.concat(A({key:(r&&`${r}.`)+T,value:s[T],valueSpec:u[S]||u["*"],style:f,styleSpec:_,object:s,objectKey:T},s)):y.push(new o.i(r,s[T],`unknown property "${T}"`))}for(const T in u)d[T]||u[T].required&&u[T].default===void 0&&s[T]===void 0&&y.push(new o.V(r,s,`missing required property "${T}"`));return y}function _i(c){const r=c.value,s=c.valueSpec,u=c.style,d=c.styleSpec,f=c.key,_=c.arrayElementValidator||Ui;if(o.j(r)!=="array")return[new o.V(f,r,`array expected, ${o.j(r)} found`)];if(s.length&&r.length!==s.length)return[new o.V(f,r,`array length ${s.length} expected, length ${r.length} found`)];if(s["min-length"]&&r.length<s["min-length"])return[new o.V(f,r,`array length at least ${s["min-length"]} expected, length ${r.length} found`)];let y={type:s.value,values:s.values,minimum:s.minimum,maximum:s.maximum,function:void 0};d.$version<7&&(y.function=s.function),o.j(s.value)==="object"&&(y=s.value);let b=[];for(let T=0;T<r.length;T++)b=b.concat(_({array:r,arrayIndex:T,value:r[T],valueSpec:y,style:u,styleSpec:d,key:`${f}[${T}]`},!0));return b}function Vs(c){const r=c.key,s=c.value,u=c.valueSpec;let d=o.j(s);if(d==="number"&&s!=s&&(d="NaN"),d!=="number")return[new o.V(r,s,`number expected, ${d} found`)];if("minimum"in u){let f=u.minimum;if(o.j(u.minimum)==="array"&&(f=u.minimum[c.arrayIndex]),s<f)return[new o.V(r,s,`${s} is less than the minimum value ${f}`)]}if("maximum"in u){let f=u.maximum;if(o.j(u.maximum)==="array"&&(f=u.maximum[c.arrayIndex]),s>f)return[new o.V(r,s,`${s} is greater than the maximum value ${f}`)]}return[]}function Rr(c){const r=c.valueSpec,s=o.u(c.value.type);let u,d,f,_={};const y=s!=="categorical"&&c.value.property===void 0,b=!y,T=o.j(c.value.stops)==="array"&&o.j(c.value.stops[0])==="array"&&o.j(c.value.stops[0][0])==="object",S=nr
13({key:c.key,value:c.value,valueSpec:c.styleSpec.function,style:c.style,styleSpec:c.styleSpec,objectElementValidators:{stops:function(P){if(s==="identity")return[new o.V(P.key,P.value,'identity function may not have a "stops" property')];let L=[];const R=P.value;return L=L.concat(_i({key:P.key,value:R,valueSpec:P.valueSpec,style:P.style,styleSpec:P.styleSpec,arrayElementValidator:A})),o.j(R)==="array"&&R.length===0&&L.push(new o.V(P.key,R,"array must have at least one stop")),L},default:function(P){return Ui({key:P.key,value:P.value,valueSpec:r,style:P.style,styleSpec:P.styleSpec})}}});return s==="identity"&&y&&S.push(new o.V(c.key,c.value,'missing required property "property"')),s==="identity"||c.value.stops||S.push(new o.V(c.key,c.value,'missing required property "stops"')),s==="exponential"&&c.valueSpec.expression&&!o.s(c.valueSpec)&&S.push(new o.V(c.key,c.value,"exponential functions not supported")),c.styleSpec.$version>=8&&(b&&!o.m(c.valueSpec)?S.push(new o.V(c.key,c.value,"property functions not supported")):y&&!o.n(c.valueSpec)&&S.push(new o.V(c.key,c.value,"zoom functions not supported"))),s!=="categorical"&&!T||c.value.property!==void 0||S.push(new o.V(c.key,c.value,'"property" property is required')),S;function A(P){let L=[];const R=P.value,k=P.key;if(o.j(R)!=="array")return[new o.V(k,R,`array expected, ${o.j(R)} found`)];if(R.length!==2)return[new o.V(k,R,`array length 2 expected, length ${R.length} found`)];if(T){if(o.j(R[0])!=="object")return[new o.V(k,R,`object expected, ${o.j(R[0])} found`)];if(R[0].zoom===void 0)return[new o.V(k,R,"object stop key must have zoom")];if(R[0].value===void 0)return[new o.V(k,R,"object stop key must have value")];const O=o.u(R[0].zoom);if(typeof O!="number")return[new o.V(k,R[0].zoom,"stop zoom values must be numbers")];if(f&&f>O)return[new o.V(k,R[0].zoom,"stop zoom values must appear in ascending order")];O!==f&&(f=O,d=void 0,_={}),L=L.concat(nr({key:`${k}[0]`,value:R[0],valueSpec:{zoom:{}},style:P.style,styleSpec:P.styleSpec,objectElementValidators:{zoom:Vs,value:C}}))}else L=L.concat(C({key:`${k}[0]`,value:R[0],valueSpec:{},style:P.style,styleSpec:P.styleSpec},R));return o.o(o.q(R[1]))?L.concat([new o.V(`${k}[1]`,R[1],"expressions are not allowed in function stops.")]):L.concat(Ui({key:`${k}[1]`,value:R[1],valueSpec:r,style:P.style,styleSpec:P.styleSpec}))}function C(P,L){const R=o.j(P.value),k=o.u(P.value),O=P.value!==null?P.value:L;if(u){if(R!==u)return[new o.V(P.key,O,`${R} stop domain type must match previous stop domain type ${u}`)]}else u=R;if(R!=="number"&&R!=="string"&&R!=="boolean"&&typeof k!="number"&&typeof k!="string"&&typeof k!="boolean")return[new o.V(P.key,O,"stop domain value must be a number, string, or boolean")];if(R!=="number"&&s!=="categorical"){let N=`number expected, ${R} found`;return o.m(r)&&s===void 0&&(N+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new o.V(P.key,O,N)]}return s!=="categorical"||R!=="number"||typeof k=="number"&&isFinite(k)&&Math.floor(k)===k?s!=="categorical"&&R==="number"&&typeof k=="number"&&typeof d=="number"&&d!==void 0&&k<d?[new o.V(P.key,O,"stop domain values must appear in ascending order")]:(d=k,s==="categorical"&&k in _?[new o.V(P.key,O,"stop domain values must be unique")]:(_[k]=!0,[])):[new o.V(P.key,O,`integer expected, found ${String(k)}`)]}}function Vr(c){const r=(c.expressionContext==="property"?o.r:o.t)(o.q(c.value),c.valueSpec);if(r.result==="error")return r.value.map(u=>new o.V(`${c.key}${u.key}`,c.value,u.message));const s=r.value.expression||r.value._styleExpression.expression;if(c.expressionContext==="property"&&c.propertyKey==="text-font"&&!s.outputDefined())return[new o.V(c.key,c.value,`Invalid data expression for "${c.propertyKey}". Output values must be contained as literals within the expression.`)];if(c.expressionContext==="property"&&c.propertyType==="layout"&&!o.v(s))return[new o.V(c.key,c.value,'"feature-state" data expressions are not supported with layout properties.')];if(c.expressionContext==="filter")return Us(s,c);if(c.expressionContext&&c.expressionContext.indexOf("cluster")===0){if(!o.x(s,["zoom","feature-state"]))return[new o.V(c.key,c.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(c.expressionContext==="cluster-initial"&&!o.y(s))return[new o.V(c.key,c.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Us(c,r){const s=new Set(["zoom","feature-state","pitch","distance-from-center"]);if(r.valueSpec&&r.valueSpec.expression)for(const d of r.valueSpec.expression.parameters)s.delete(
13d);if(s.size===0)return[];const u=[];return c instanceof o.C&&s.has(c.name)?[new o.V(r.key,r.value,`["${c.name}"] expression is not supported in a filter for a ${r.object.type} layer with id: ${r.object.id}`)]:(c.eachChild(d=>{u.push(...Us(d,r))}),u)}function us(c){const r=c.key,s=c.value,u=c.valueSpec,d=[];return Array.isArray(u.values)?u.values.indexOf(o.u(s))===-1&&d.push(new o.V(r,s,`expected one of [${u.values.join(", ")}], ${JSON.stringify(s)} found`)):Object.keys(u.values).indexOf(o.u(s))===-1&&d.push(new o.V(r,s,`expected one of [${Object.keys(u.values).join(", ")}], ${JSON.stringify(s)} found`)),d}function Yt(c){return o.A(o.q(c.value))?Vr(o.k({},c,{expressionContext:"filter",valueSpec:c.styleSpec[`filter_${c.layerType||"fill"}`]})):js(c)}function js(c){const r=c.value,s=c.key;if(o.j(r)!=="array")return[new o.V(s,r,`array expected, ${o.j(r)} found`)];const u=c.styleSpec;let d,f=[];if(r.length<1)return[new o.V(s,r,"filter array must have at least 1 element")];switch(f=f.concat(us({key:`${s}[0]`,value:r[0],valueSpec:u.filter_operator,style:c.style,styleSpec:c.styleSpec})),o.u(r[0])){case"<":case"<=":case">":case">=":r.length>=2&&o.u(r[1])==="$type"&&f.push(new o.V(s,r,`"$type" cannot be use with operator "${r[0]}"`));case"==":case"!=":r.length!==3&&f.push(new o.V(s,r,`filter array for operator "${r[0]}" must have 3 elements`));case"in":case"!in":r.length>=2&&(d=o.j(r[1]),d!=="string"&&f.push(new o.V(`${s}[1]`,r[1],`string expected, ${d} found`)));for(let _=2;_<r.length;_++)d=o.j(r[_]),o.u(r[1])==="$type"?f=f.concat(us({key:`${s}[${_}]`,value:r[_],valueSpec:u.geometry_type,style:c.style,styleSpec:c.styleSpec})):d!=="string"&&d!=="number"&&d!=="boolean"&&f.push(new o.V(`${s}[${_}]`,r[_],`string, number, or boolean expected, ${d} found`));break;case"any":case"all":case"none":for(let _=1;_<r.length;_++)f=f.concat(js({key:`${s}[${_}]`,value:r[_],style:c.style,styleSpec:c.styleSpec}));break;case"has":case"!has":d=o.j(r[1]),r.length!==2?f.push(new o.V(s,r,`filter array for "${r[0]}" operator must have 2 elements`)):d!=="string"&&f.push(new o.V(`${s}[1]`,r[1],`string expected, ${d} found`))}return f}function hr(c,r){const s=c.key,u=c.style,d=c.layer,f=c.styleSpec,_=c.value,y=c.objectKey,b=f[`${r}_${c.layerType}`];if(!b)return[];const T=y.match(/^(.*)-transition$/);if(r==="paint"&&T&&b[T[1]]&&b[T[1]].transition)return Ui({key:s,value:_,valueSpec:f.transition,style:u,styleSpec:f});const S=c.valueSpec||b[y];if(!S)return[new o.i(s,_,`unknown property "${y}"`)];let A;if(o.j(_)==="string"&&o.m(S)&&!S.tokens&&(A=/^{([^}]+)}$/.exec(_))){const P=`\`{ "type": "identity", "property": ${A?JSON.stringify(A[1]):'"_"'} }\``;return[new o.V(s,_,`"${y}" does not support interpolation syntax
14Use an identity property function instead: ${P}.`)]}const C=[];if(c.layerType==="symbol")y!=="text-field"||!u||u.glyphs||u.imports||C.push(new o.V(s,_,'use of "text-field" requires a style "glyphs" property')),y==="text-font"&&o.B(o.q(_))&&o.u(_.type)==="identity"&&C.push(new o.V(s,_,'"text-font" does not support identity functions'));else if(c.layerType==="model"&&r==="paint"&&d&&d.layout&&d.layout.hasOwnProperty("model-id")&&o.m(S)&&(o.D(S)||o.n(S))){const P=o.r(o.q(_),S),L=P.value.expression||P.value._styleExpression.expression;L&&!o.x(L,["measure-light"])&&(y==="model-emissive-strength"&&o.y(L)&&o.v(L)||C.push(new o.V(s,_,`${y} does not support measure-light expressions when the model layer source is vector tile or GeoJSON.`)))}return C.concat(Ui({key:c.key,value:_,valueSpec:S,style:u,styleSpec:f,expressionContext:"property",propertyType:r,propertyKey:y}))}function Gs(c){return hr(c,"paint")}function hs(c){return hr(c,"layout")}function Ur(c){let r=[];const s=c.value,u=c.key,d=c.style,f=c.styleSpec;s.type||s.ref||r.push(new o.V(u,s,'either "type" or "ref" is required'));let _=o.u(s.type);const y=o.u(s.ref);if(s.id){const b=o.u(s.id);for(let T=0;T<c.arrayIndex;T++){const S=d.layers[T];o.u(S.id)===b&&r.push(new o.V(u,s.id,`duplicate layer id "${s.id}", previously used at line ${S.id.__line__}`))}}if("ref"in s){let b;["type","source","source-layer","filter","layout"].forEach(T=>{T in s&&r.push(new o.V(u,s[T],`"${T}" is prohibited for ref layers`))}
14),d.layers.forEach(T=>{o.u(T.id)===y&&(b=T)}),b?b.ref?r.push(new o.V(u,s.ref,"ref cannot reference another ref layer")):_=o.u(b.type):typeof y=="string"&&r.push(new o.V(u,s.ref,`ref layer "${y}" not found`))}else if(_!=="background"&&_!=="sky"&&_!=="slot")if(s.source){const b=d.sources&&d.sources[s.source],T=b&&o.u(b.type);b?T==="vector"&&_==="raster"?r.push(new o.V(u,s.source,`layer "${s.id}" requires a raster source`)):T==="raster"&&_!=="raster"?r.push(new o.V(u,s.source,`layer "${s.id}" requires a vector source`)):T!=="vector"||s["source-layer"]?T==="raster-dem"&&_!=="hillshade"?r.push(new o.V(u,s.source,"raster-dem source can only be used with layer type 'hillshade'.")):T!=="raster-array"||["raster","raster-particle"].includes(_)?_!=="line"||!s.paint||!s.paint["line-gradient"]&&!s.paint["line-trim-offset"]||T==="geojson"&&b.lineMetrics?_==="raster-particle"&&T!=="raster-array"&&r.push(new o.V(u,s.source,`layer "${s.id}" requires a 'raster-array' source.`)):r.push(new o.V(u,s,`layer "${s.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):r.push(new o.V(u,s.source,"raster-array source can only be used with layer type 'raster'.")):r.push(new o.V(u,s,`layer "${s.id}" must specify a "source-layer"`)):r.push(new o.V(u,s.source,`source "${s.source}" not found`))}else r.push(new o.V(u,s,'missing required property "source"'));return r=r.concat(nr({key:u,value:s,valueSpec:f.layer,style:c.style,styleSpec:c.styleSpec,objectElementValidators:{"*":()=>[],type:()=>Ui({key:`${u}.type`,value:s.type,valueSpec:f.layer.type,style:c.style,styleSpec:c.styleSpec,object:s,objectKey:"type"}),filter:b=>Yt(o.k({layerType:_},b)),layout:b=>nr({layer:s,key:b.key,value:b.value,valueSpec:{},style:b.style,styleSpec:b.styleSpec,objectElementValidators:{"*":T=>hs(o.k({layerType:_},T))}}),paint:b=>nr({layer:s,key:b.key,value:b.value,valueSpec:{},style:b.style,styleSpec:b.styleSpec,objectElementValidators:{"*":T=>Gs(o.k({layerType:_,layer:s},T))}})}})),r}function ut(c){const r=c.value,s=c.key,u=o.j(r);return u!=="string"?[new o.V(s,r,`string expected, ${u} found`)]:[]}const ds={promoteId:function({key:c,value:r}){if(o.j(r)==="string")return ut({key:c,value:r});{const s=[];for(const u in r)s.push(...ut({key:`${c}.${u}`,value:r[u]}));return s}}};function vi(c){const r=c.value,s=c.key,u=c.styleSpec,d=c.style;if(!r.type)return[new o.V(s,r,'"type" is required')];const f=o.u(r.type);let _=[];switch(["vector","raster","raster-dem","raster-array"].includes(f)&&(r.url||r.tiles||_.push(new o.i(s,r,'Either "url" or "tiles" is required.'))),f){case"vector":case"raster":case"raster-dem":case"raster-array":return _=_.concat(nr({key:s,value:r,valueSpec:u[`source_${f.replace("-","_")}`],style:c.style,styleSpec:u,objectElementValidators:ds})),_;case"geojson":if(_=nr({key:s,value:r,valueSpec:u.source_geojson,style:d,styleSpec:u,objectElementValidators:ds}),r.cluster)for(const y in r.clusterProperties){const[b,T]=r.clusterProperties[y],S=typeof b=="string"?[b,["accumulated"],["get",y]]:b;_.push(...Vr({key:`${s}.${y}.map`,value:T,expressionContext:"cluster-map"})),_.push(...Vr({key:`${s}.${y}.reduce`,value:S,expressionContext:"cluster-reduce"}))}return _;case"video":return nr({key:s,value:r,valueSpec:u.source_video,style:d,styleSpec:u});case"image":return nr({key:s,value:r,valueSpec:u.source_image,style:d,styleSpec:u});case"canvas":return[new o.V(s,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return us({key:`${s}.type`,value:r.type,valueSpec:{values:Fo(u)},style:d,styleSpec:u})}}function Fo(c){return c.source.reduce((r,s)=>{const u=c[s];return u.type.type==="enum"&&(r=r.concat(Object.keys(u.type.values))),r},[])}function qs(c){const r=c.value,s=c.styleSpec,u=s.light,d=c.style;let f=[];const _=o.j(r);if(r===void 0)return f;if(_!=="object")return f=f.concat([new o.V("light",r,`object expected, ${_} found`)]),f;for(const y in r){const b=y.match(/^(.*)-transition$/);f=f.concat(b&&u[b[1]]&&u[b[1]].transition?Ui({key:y,value:r[y],valueSpec:s.transition,style:d,styleSpec:s}
14):u[y]?Ui({key:y,value:r[y],valueSpec:u[y],style:d,styleSpec:s}):[new o.V(y,r[y],`unknown property "${y}"`)])}return f}function Wn(c){const r=c.value;let s=[];if(!r)return s;const u=o.j(r);if(u!=="object")return s=s.concat([new o.V("light-3d",r,`object expected, ${u} found`)]),s;const d=c.styleSpec,f=d["light-3d"],_=c.key,y=c.style,b=c.style.lights;for(const A of["type","id"])if(!(A in r))return s=s.concat([new o.V("light-3d",r,`missing property ${A} on light`)]),s;if(r.type&&b)for(let A=0;A<c.arrayIndex;A++){const C=o.u(r.type),P=b[A];o.u(P.type)===C&&s.push(new o.V(_,r.id,`duplicate light type "${r.type}", previously defined at line ${P.id.__line__}`))}const T=`properties_light_${r.type}`;if(!(T in d))return s=s.concat([new o.V("light-3d",r,`Invalid light type ${r.type}`)]),s;const S=d[T];for(const A in r)if(A==="properties"){const C=r[A],P=o.j(C);if(P!=="object")return s=s.concat([new o.V("properties",C,`object expected, ${P} found`)]),s;for(const L in C)s=s.concat(S[L]?Ui({key:L,value:C[L],valueSpec:S[L],style:y,styleSpec:d}):[new o.i(c.key,C[L],`unknown property "${L}"`)])}else{const C=A.match(/^(.*)-transition$/);s=s.concat(C&&f[C[1]]&&f[C[1]].transition?Ui({key:A,value:r[A],valueSpec:d.transition,style:y,styleSpec:d}):f[A]?Ui({key:A,value:r[A],valueSpec:f[A],style:y,styleSpec:d}):[new o.i(A,r[A],`unknown property "${A}"`)])}return s}function Qn(c){const r=c.value,s=c.key,u=c.style,d=c.styleSpec,f=d.terrain;let _=[];const y=o.j(r);if(r===void 0||y==="null")return _;if(y!=="object")return _=_.concat([new o.V("terrain",r,`object expected, ${y} found`)]),_;for(const b in r){const T=b.match(/^(.*)-transition$/);_=_.concat(T&&f[T[1]]&&f[T[1]].transition?Ui({key:b,value:r[b],valueSpec:d.transition,style:u,styleSpec:d}):f[b]?Ui({key:b,value:r[b],valueSpec:f[b],style:u,styleSpec:d}):[new o.i(b,r[b],`unknown property "${b}"`)])}if(r.source){const b=u.sources&&u.sources[r.source],T=b&&o.u(b.type);b?T!=="raster-dem"&&_.push(new o.V(s,r.source,`terrain cannot be used with a source of type ${String(T)}, it only be used with a "raster-dem" source type`)):_.push(new o.V(s,r.source,`source "${r.source}" not found`))}else _.push(new o.V(s,r,'terrain is missing required property "source"'));return _}function No(c){const r=c.value,s=c.style,u=c.styleSpec,d=u.fog;let f=[];const _=o.j(r);if(r===void 0)return f;if(_!=="object")return f=f.concat([new o.V("fog",r,`object expected, ${_} found`)]),f;for(const y in r){const b=y.match(/^(.*)-transition$/);f=f.concat(b&&d[b[1]]&&d[b[1]].transition?Ui({key:y,value:r[y],valueSpec:u.transition,style:s,styleSpec:u}):d[y]?Ui({key:y,value:r[y],valueSpec:d[y],style:s,styleSpec:u}):[new o.i(y,r[y],`unknown property "${y}"`)])}return f}const Zs={"*":()=>[],array:_i,boolean:function(c){const r=c.value,s=c.key,u=o.j(r);return u!=="boolean"?[new o.V(s,r,`boolean expected, ${u} found`)]:[]},number:Vs,color:function(c){const r=c.key,s=c.value,u=o.j(s);return u!=="string"?[new o.V(r,s,`color expected, ${u} found`)]:o.z(s)===null?[new o.V(r,s,`color expected, "${s}" found`)]:[]},enum:us,filter:Yt,function:Rr,layer:Ur,object:nr,source:vi,model:o.F,light:qs,"light-3d":Wn,terrain:Qn,fog:No,string:ut,formatted:function(c){return ut(c).length===0?[]:Vr(c)},resolvedImage:function(c){return ut(c).length===0?[]:Vr(c)},projection:function(c){const r=c.value,s=c.styleSpec,u=s.projection,d=c.style;let f=[];const _=o.j(r);if(_==="object")for(const y in r)f=f.concat(Ui({key:y,value:r[y],valueSpec:u[y],style:d,styleSpec:s}));else _!=="string"&&(f=f.concat([new o.V("projection",r,`object or string expected, ${_} found`)]));return f},import:function(c){const{value:r,styleSpec:s}=c,{data:u,...d}=r;Object.defineProperty(d,"__line__",{value:r.__line__,enumerable:!1});let f=nr(o.k({},c,{value:d,valueSpec:s.import}));return o.u(d.id)===""&&f.push(new o.V(`${c.key}.id`,d,"import id can't be an empty string")),u&&(f=f.concat(mt(u,s,{key:`${c.key}.data`}))),f}};function Ui(c,r=!1){const s=c.value,u=c.valueSpec,d=c.styleSpec;if(u.expression&&o.B(o.u(s)))return Rr(c);if(u.expression&&o.o(o.q(s)))return Vr(c);if(u.type&&Zs[u.type]){const f=Zs[u.type](c);return r===!0&&f.length>0&&o.j(c.value)==="array"?Vr(c):f}return nr(o.k({},c,{valueSpec:u.type?d[u.type]:u}))}function Ha(c){const r=c.value,s=c.key,u=ut(c);return u.length||(r.indexOf("{fontstack}")===-1&&u.push(new o.V(s,r,'"glyphs" url must include a "{fontstack}" token')),r.indexOf("{range}")===-1&&u.push(new o.V(s,r,'"glyphs" url must include a "{range}" token'))),u}function mt(c,r=o.G,s={}){return Ui({key:s.key||"",value:c,valueSpec:r.$root,styleSpec:r,style:c,objectElementValidators:{glyphs:Ha,"*":()=>[]}})}function dt(c,r=o.G){return Te(mt(c,r))}const Vo=c=>Te(vi(c)),jr=c=>Te(qs(c)),Re=c=>Te(Wn(c)),G=c=>Te(Qn(c)),H=c=>Te(No(c)),ne=c=>Te(Ur(c)),Se=c=>Te(Yt(c)),Ie=c=>Te(Gs(c)),Le=c=>Te(hs(c)),tt=c=>Te(o.F(c));function Te(c){return c.slice().sort((r,s)=>r.line&&s.line?r.line-s.line:0)}function He(c,r){let s=!1;if(r&&r.length)for(const u of r)u instanceof o.i?o.w(u.message):(c.fire(new o.a(new Error(u.message))),s=!0);return s}const Ke=new o.H({anchor:new o.J(o.G.light.anchor),position:new o.K(o.G.light.position),color:new o.J(o.G.light.color),intensity:new o.J(o.G.light.intensity)});class st extends o.E{constructor(r,s="flat"){super(),this._transitionable=new o.L(Ke),this.setLight(r,
vendor: 14,245 bytes, line 14
14s),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(r,s,u={}){this._validate(jr,r,u)||(this._transitionable.setTransitionOrValue(r),this.id=s)}updateTransitions(r){this._transitioning=this._transitionable.transitioned(r,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(r){this.properties=this._transitioning.possiblyEvaluate(r)}_validate(r,s,u){return(!u||u.validate!==!1)&&He(this,r.call(dt,o.e({value:s,style:{glyphs:!0,sprite:!0},styleSpec:o.G})))}}const qe=new o.H({source:new o.J(o.G.terrain.source),exaggeration:new o.J(o.G.terrain.exaggeration)});let ai=class extends o.E{constructor(c,r,s,u){super(),this.scope=s,this._transitionable=new o.L(qe,s,u),this._transitionable.setTransitionOrValue(c,u),this._transitioning=this._transitionable.untransitioned(),this.drapeRenderMode=r}get(){return this._transitionable.serialize()}set(c,r){this._transitionable.setTransitionOrValue(c,r)}updateTransitions(c){this._transitioning=this._transitionable.transitioned(c,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(c){this.properties=this._transitioning.possiblyEvaluate(c)}getExaggeration(c){return this._transitioning.possiblyEvaluate(new o.N(c)).get("exaggeration")}isZoomDependent(){const c=this._transitionable._values.exaggeration;return c!=null&&c.value!=null&&c.value.expression!=null&&c.value.expression instanceof o.Z}};const Jt=45,si=65,Kt=.05;function ei(c,r,s,u){const d=o.S(Jt,si,s),[f,_]=li(c,u);let y=1-Math.min(1,Math.exp((r-f)/(_-f)*-6));return y*=y*y,y=Math.min(1,1.00747*y),y*d*c.alpha}function li(c,r){const s=.5/Math.tan(.5*r);return[c.range[0]+s,c.range[1]+s]}function Si(c,r,s,u,d){const f=o.Q.transformMat4([],[r,s,u],d.mercatorFogMatrix);return ei(c,o.Q.length(f),d.pitch,d._fov)}function Yi(c,r,s,u,d,f,_){const y=[[s,u,0],[d,u,0],[d,f,0],[s,f,0]];let b=Number.MAX_VALUE,T=-Number.MAX_VALUE;for(const S of y){const A=o.Q.transformMat4([],S,r),C=o.Q.length(A);b=Math.min(b,C),T=Math.max(T,C)}return[ei(c,b,_.pitch,_._fov),ei(c,T,_.pitch,_._fov)]}const xi=new o.H({range:new o.J(o.G.fog.range),color:new o.J(o.G.fog.color),"high-color":new o.J(o.G.fog["high-color"]),"space-color":new o.J(o.G.fog["space-color"]),"horizon-blend":new o.J(o.G.fog["horizon-blend"]),"star-intensity":new o.J(o.G.fog["star-intensity"]),"vertical-range":new o.J(o.G.fog["vertical-range"])});class gr extends o.E{constructor(r,s,u,d){super(),this._transitionable=new o.L(xi,u,new Map(d)),this.set(r,d),this._transitioning=this._transitionable.untransitioned(),this._transform=s,this.properties=new o.U(xi)}get state(){const r=this._transform,s=r.projection.name==="globe",u=o.W(r.zoom),d=this.properties.get("range"),f=[.5,3];return{range:s?[o.X(f[0],d[0],u),o.X(f[1],d[1],u)]:d,horizonBlend:this.properties.get("horizon-blend"),alpha:this.properties.get("color").a}}get(){return this._transitionable.serialize()}set(r,s,u={}){if(this._validate(H,r,u))return;const d=o.e({},r);for(const f of Object.keys(o.G.fog))d[f]===void 0&&(d[f]=o.G.fog[f].default);this._options=d,this._transitionable.setTransitionOrValue(this._options,s)}getOpacity(r){if(!this._transform.projection.supportsFog)return 0;const s=this.properties&&this.properties.get("color")||1;return(this._transform.projection.name==="globe"?1:o.S(Jt,si,r))*s.a}getOpacityAtLatLng(r,s){return this._transform.projection.supportsFog?function(u,d,f){const _=o.O.fromLngLat(d),y=f.elevation?f.elevation.getAtPointOrZero(_):0;return Si(u,_.x,_.y,y,f)}(this.state,r,s):0}getOpacityForTile(r){if(!this._transform.projection.supportsFog)return[1,1];const s=this._transform.calculateFogTileMatrix(r.toUnwrapped());return Yi(this.state,s,0,0,o.Y,o.Y,this._transform)}getOpacityForBounds(r,s,u,d,f){return this._transform.projection.supportsFog?Yi(this.state,r,s,u,d,f,this._transform):[1,1]}getFovAdjustedRange(r){return this._transform.projection.supportsFog?li(this.state,r):[0,1]}isVisibleOnFrustum(r){if(!this._transform.projection.supportsFog)return!1;const s=[4,5,6,7];for(const u of s){const d=r.points[u];let f;if(d[2]>=0)f=d;else{const _=r.points[u-4];f=o._(_,d,_[2]/(_[2]-d[2]))}if(Si(this.state,f[0],f[1],0,this._transform)>=Kt)return!0}return!1}updateConfig(r){this._transitionable.setTransitionOrValue(this._options,new Map(r))}updateTransitions(r){this._transitioning=this._transitionable.transitioned(r,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(r){this.properties=this._transitioning.possiblyEvaluate(r)}_validate(r,s,u){return(!u||u.validate!==!1)&&He(this,r.call(dt,o.e({value:s,style:{glyphs:!0,sprite:!0},styleSpec:o.G})))}}class dr extends o.E{constructor(r,s,u,d){super(),this.scope=u,this._options=r,this.properties=new o.U(s),this._transitionable=new o.L(s,u,new Map(d)),this._transitionable.setTransitionOrValue(r.properties),this._transitioning=this._transitionable.untransitioned()}updateConfig(r){this._transitionable.setTransitionOrValue(this._options.properties,new Map(r))}updateTransitions(r){this._transitioning=this._transitionable.transitioned(r,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(r){this.properties=this._transitioning.possiblyEvaluate(r)}get(){return this._options.properties=this._transitionable.serialize(),this._options}set(r,s){this._options=r,this._transitionable.setTransitionOrValue(r.properties,s)}shadowsEnabled(){return!!this.properties&&this.properties.get("cast-shadows")===!0}}const Jr=new o.H({color:new o.J(o.G.properties_light_ambient.color),intensity:new o.J(o.G.properties_light_ambient.intensity)}),ji=new o.H({direction:new o.$(o.G.properties_light_directional.direction),color:new o.J(o.G.properties_light_directional.color),intensity:new o.J(o.G.properties_light_directional.intensity),"cast-shadows":new o.J(o.G.properties_light_directional["cast-shadows"]),"shadow-intensity":new o.J(o.G.properties_light_directional["shadow-intensity"])});class Ai{constructor(r,s,u,d){this.screenBounds=r,this.cameraPoint=s,this._screenRaycastCache={},this._cameraRaycastCache={},this.isAboveHorizon=u,this.screenGeometry=this.bufferedScreenGeometry(0),this.screenGeometryMercator=this._bufferedScreenMercator(0,d)}static createFromScreenPoints(r,s){let u,d;if(r instanceof o.P||typeof r[0]=="number"){const f=o.P.convert(r);u=[f],d=s.isPointAboveHorizon(f)}else{const f=o.P.convert(r[0]),_=o.P.convert(r[1]);u=[f,_],d=o.a0(f,_).every(y=>s.isPointAboveHorizon(y))}return new Ai(u,s.getCameraPoint(),d,s)}isPointQuery(){return this.screenBounds.length===1}bufferedScreenGeometry(r){return o.a0(this.screenBounds[0],this.screenBounds.length===1?this.screenBounds[0]:this.screenBounds[1],r)}bufferedCameraGeometry(r){const s=this.screenBounds[0],u=this.screenBounds.length===1?this.screenBounds[0].add(new o.P(1,1)):this.screenBounds[1],d=o.a0(s,u,0,!1);return this.cameraPoint.y>u.y&&(this.cameraPoint.x>s.x&&this.cameraPoint.x<u.x?d.splice(3,0,this.cameraPoint):this.cameraPoint.x>=u.x?d[2]=this.cameraPoint:this.cameraPoint.x<=s.x&&(d[3]=this.cameraPoint)),o.a1(d,r)}bufferedCameraGeometryGlobe(r){const s=this.screenBounds[0],u=this.screenBounds.length===1?this.screenBounds[0].add(new o.P(1,1)):this.screenBounds[1],d=o.a0(s,u,r),f=this.cameraPoint.clone();switch(3*((f.y>s.y)+(f.y>u.y))+((f.x>s.x)+(f.x>u.x))){case 0:d[0]=f,d[4]=f.clone();break;case 1:d.splice(1,0,f);break;case 2:d[1]=f;break;case 3:d.splice(4,0,f);break;case 5:d.splice(2,0,f);break;case 6:d[3]=f;break;case 7:d.splice(3,0,f);break;case 8:d[2]=f}return d}containsTile(r,s,u,d=0){const f=r.queryPadding/s._pixelsPerMercatorPixel+1,_=u?this._bufferedCameraMercator(f,s):this._bufferedScreenMercator(f,s);let y=r.tileID.wrap+(_.unwrapped?d:0);const b=_.polygon.map(k=>o.a2(r.tileTransform,k,y));if(!o.a3(b,0,0,o.Y,o.Y))return;y=r.tileID.wrap+(this.screenGeometryMercator.unwrapped?d:0);const T=this.screenGeometryMercator.polygon.map(k=>o.a4(r.tileTransform,k,y)),S=T.map(k=>new o.P(k[0],k[1])),A=s.getFreeCameraOptions().position||new o.O(0,0,0),C=o.a4(r.tileTransform,A,y),P=T.map(k=>{const O=o.Q.sub(k,k,C);return o.Q.normalize(O,O),new o.a5(C,O)}),L=o.a6(r,1,s.zoom)*s._pixelsPerMercatorPixel;return{queryGeometry:this,tilespaceGeometry:S,tilespaceRays:P,bufferedTilespaceGeometry:b,bufferedTilespaceBounds:(R=o.a7(b),R.min.x=o.ad(R.min.x,0,o.Y),R.min.y=o.ad(R.min.y,0,o.Y),R.max.x=o.ad(R.max.x,0,o.Y),R.max.y=o.ad(R.max.y,0,o.Y),R),tile:r,tileID:r.tileID,pixelToTileUnitsFactor:L};var R}_bufferedScreenMercator(r,s){const u=Pe(r);if(this._screenRaycastCache[u])return this._screenRaycastCache[u];{let d;return d=s.projection.name==="globe"?this._projectAndResample(this.bufferedScreenGeometry(r),s):{polygon:this.bufferedScreenGeometry(r).map(f=>s.pointCoordinate3D(f)),unwrapped:!0},this._screenRaycastCache[u]=d,d}}_bufferedCameraMercator(r,s){const u=Pe(r);if(this._cameraRaycastCache[u])return this._cameraRaycastCache[u];{let d;return d=s.projection.name==="globe"?this._projectAndResample(this.bufferedCameraGeometryGlobe(r),s):{polygon:this.bufferedCameraGeometry(r).map(f=>s.pointCoordinate3D(f)),unwrapped:!0},this._cameraRaycastCache[u]=d,d}}_projectAndResample(r,s){const u=function(f,_){const y=o.a9.multiply([],_.pixelMatrix,_.globeMatrix),b=[0,-o.ae,0,1],T=[0,o.ae,0,1],S=[0,0,0,1];o.aa.transformMat4(b,b,y),o.aa.transformMat4(T,T,y),o.aa.transformMat4(S,S,y);const A=new o.P(b[0]/b[3],b[1]/b[3]),C=new o.P(T[0]/T[3],T[1]/T[3]),P=o.ab(f,A)&&b[3]<S[3],L=o.ab(f,C)&&T[3]<S[3];if(!P&&!L)return null;const R=function(U,K,Y){for(let re=1;re<U.length;re++){const he=be(K.pointCoordinate3D(U[re-1]).x),ie=be(K.pointCoordinate3D(U[re]).x);if(Y<0){if(he<ie)return{idx:re,t:-he/(ie-1-he)}}else if(ie<he)return{idx:re,t:(1-he)/(ie+1-he)}}return null}(f,_,P?-1:1);if(!R)return null;const{idx:k,t:O}=R;let N=k>1?ve(f.slice(0,k),_):[],$=k<f.length?ve(f.slice(k),_):[];N=N.map(U=>new o.P(be(U.x),U.y)),$=$.map(U=>new o.P(be(U.x),U.y));const Z=[...N];Z.length===0&&Z.push($[$.length-1]);const Q=o.X(Z[Z.length-1].y,($.length===0?N[0]:$[0]).y,O);let B;return B=P?[new o.P(0,Q),new o.P(0,0),new o.P(1,0),new o.P(1,Q)]:[new o.P(1,Q),new o.P(1,1),new o.P(0,1),new o.P(0,Q)],Z.push(...B),$.length===0?Z.push(N[0]):Z.push(...$),{polygon:Z.map(U=>new o.O(U.x,U.y)),unwrapped:!1}}(r,s);if(u)return u;const d=function(f,_){let y=!1,b=-1/0,T=0;for(let A=0;A<f.length-1;A++)f[A].x>b&&(b=f[A].x,T=A);for(let A=0;A<f.length-1;A++){const C=(T+A)%(f.length-1),P=f[C],L=f[C+1];Math.abs(P.x-L.x)>.5&&(P.x<L.x?(P.x+=1,C===0&&(f[f.length-1].x+=1)):(L.x+=1,C+1===f.length-1&&(f[0].x+=1)),y=!0)}const S=o.a8(_.center.lng);return y&&S<Math.abs(S-1)&&f.forEach(A=>{A.x-=1}),{polygon:f,unwrapped:y}}(ve(r,s).map(f=>new o.P(be(f.x),f.y)),s);return{polygon:d.polygon.map(f=>new o.O(f.x,f.y)),unwrapped:d.unwrapped}}}function ve(c,r){return o.ac(c,s=>{const u=r.pointCoordinate3D(s);s.x=u.x,s.y=u.y},1/256)}function be(c){return c<0?1+c%1:c%1}function Pe(c){return 100*c|0}function Oe(c,r,s,u,d){const f=function(_,y){if(_)return d(_);if(y){c.url&&y.tiles&&c.tiles&&delete c.tiles;const b=o.af(o.e(y,c),["tiles","minzoom","maxzoom","attribution","mapbox_logo","bounds","scheme","tileSize","encoding"]);y.vector_layers&&(b.vectorLayers=y.vector_layers,b.vectorLayerIds=b.vectorLayers.map(T=>T.id)),y.raster_layers&&(b.rasterLayers=y.raster_layers,b.rasterLayerIds=b.rasterLayers.map(T=>T.id)),b.tiles=r.canonicalizeTileset(b,c.url),d(null,b)}};return c.url?o.g(r.transformRequest(r.normalizeSourceURL(c.url,null,s,u),o.R.Source),f):o.f.frame(()=>f(null,c))}class ke{constructor(r,s,u){this.bounds=o.ag.convert(this.validateBounds(r)),this.minzoom=s||0,this.maxzoom=u||24}validateBounds(r){return Array.isArray(r)&&r.length===4?[Math.max(-180,r[0]),Math.max(-90,r[1]),Math.min(180,r[2]),Math.min(90,r[3])]:[-180,-90,180,90]}contains(r){const s=Math.pow(2,r.z),u=Math.floor(o.a8(this.bounds.getWest())*s),d=Math.floor(o.ah(this.bounds.getNorth())*s),f=Math.ceil(o.a8(this.bounds.getEast())*s),_=Math.ceil(o.ah(this.bounds.getSouth())*s);return r.x>=u&&r.x<f&&r.y>=d&&r.y<_}}class Ue extends o.E{constructor(r,s,u,d){if(super(),this.id=r,this.dispatcher=u,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,o.e(this,o.af(s,["url","scheme","tileSize","promoteId"])),this._options=o.e({type:"vector"},s),this._collectResourceTiming=!!s.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(d),this._tileWorkers={},this._deduped=new o.ai}load(r){this._loaded=!1,this.fire(new o.b("dataloading",{dataType:"source"}));const s=Array.isArray(this.map._language)?this.map._language.join():this.map._language,u=this.map._worldview;this._tileJSONRequest=Oe(this._options,this.map._requestManager,s,u,(d,f)=>{this._tileJSONRequest=null,this._loaded=!0,d?(s&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${s}`),u&&u.length!==2&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${u}`),this.fire(new o.a(d))):f&&(o.e(this,f),f.bounds&&(this.tileBounds=new ke(f.bounds,this.minzoom,this.maxzoom)),o.am(f.tiles,this.map._requestManager._customAccessToken),this.fire(new o.b("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new o.b("data",{dataType:"source",sourceDataType:"content"}))),r&&r(d)})}loaded(){return this._loaded}hasTile(r){return!this.tileBounds||this.tileBounds.contains(r.canonical)}onAdd(r){this.map=r,this.load()}reload(){this.cancelTileJSONRequest();const r=o.aj(this.id,this.scope);this.load(()=>this.map.style.clearSource(r))}setTiles(r){return this._options.tiles=r,this.reload(),this}setUrl(r){return this.url=r,this._options.url=r,this.reload(),this}onRemove(){this.cancelTileJSONRequest()}serialize(){return o.e({},this._options)}loadTile(r,s){const u=this.map._requestManager.normalizeTileURL(r.tileID.canonical.url(this.tiles,this.scheme)),d={request:this.map._requestManager.transformRequest(u,o.R.Tile),data:void 0,uid:r.uid,tileID:r.tileID,tileZoom:r.tileZoom,zoom:r.tileID.overscaledZ,tileSize:this.tileSize*r.tileID.overscaleFactor(),type:this.t
14ype,source:this.id,scope:this.scope,pixelRatio:o.f.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,isSymbolTile:r.isSymbolTile,brightness:this.map.style&&this.map.style.getBrightness()||0,extraShadowCaster:r.isExtraShadowCaster};if(d.request.collectResourceTiming=this._collectResourceTiming,r.actor&&r.state!=="expired")r.state==="loading"?r.reloadCallback=s:r.request=r.actor.send("reloadTile",d,f.bind(this));else if(r.actor=this._tileWorkers[u]=this._tileWorkers[u]||this.dispatcher.getActor(),this.dispatcher.ready)r.request=r.actor.send("loadTile",d,f.bind(this),void 0,!0);else{const _=o.ak.call({deduped:this._deduped},d,(y,b)=>{y||!b?f.call(this,y):(d.data={cacheControl:b.cacheControl,expires:b.expires,rawData:b.rawData.slice(0)},r.actor&&r.actor.send("loadTile",d,f.bind(this),void 0,!0))},!0);r.request={cancel:_}}function f(_,y){return delete r.request,r.aborted?s(null):_&&_.status!==404?s(_):(y&&y.resourceTiming&&(r.resourceTiming=y.resourceTiming),this.map._refreshExpiredTiles&&y&&r.setExpiryData(y),r.loadVectorData(y,this.map.painter),o.al(this.dispatcher),s(null),void(r.reloadCallback&&(this.loadTile(r,r.reloadCallback),r.reloadCallback=null)))}}abortTile(r){r.request&&(r.request.cancel(),delete r.request),r.actor&&r.actor.send("abortTile",{uid:r.uid,type:this.t
14ype,source:this.id,scope:this.scope})}unloadTile(r){r.actor&&r.actor.send("removeTile",{uid:r.uid,type:this.type,source:this.id,scope:this.scope}),r.destroy()}hasTransition(){return!1}afterUpdate(){this._tileWorkers={}}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}class je extends o.E{constructor(r,s,u,d){super(),this.id=r,this.dispatcher=u,this.setEventedParent(d),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=o.e({type:"raster"},s),o.e(this,o.af(s,["url","scheme","tileSize"]))}load(r){this._loaded=!1,this.fire(new o.b("dataloading",{dataType:"source"})),this._tileJSONRequest=Oe(this._options,this.map._requestManager,null,null,(s,u)=>{this._tileJSONRequest=null,this._loaded=!0,s?this.fire(new o.a(s)):u&&(o.e(this,u),u.bounds&&(this.tileBounds=new ke(u.bounds,this.minzoom,this.maxzoom)),o.am(u.tiles),this.fire(new o.b("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new o.b("data",{dataType:"source",sourceDataType:"content"}))),r&&r(s)})}loaded(){return this._loaded}onAdd(r){this.map=r,this.load()}reload(){this.cancelTileJSONRequest();const r=o.aj(this.id,this.scope);this.load(()=>this.map.style.clearSource(r))}setTiles(r){return this._options.tiles=r,this.reload(),this}setUrl(r){return this.url=r,this._options.url=r,this.reload(),this}onRemove(){this.cancelTileJSONRequest()}serialize(){return o.e({},this._options)}hasTile(r){return!this.tileBounds||this.tileBounds.contains(r.canonical)}loadTile(r,s){const u=o.f.devicePixelRatio>=2,d=this.map._requestManager.normalizeTileURL(r.tileID.canonical.url(this.tiles,this.scheme),u,this.tileSize);r.request=o.d(this.map._requestManager.transformRequest(d,o.R.Tile),(f,_,y,b)=>(delete r.request,r.aborted?(r.state="unloaded",s(null)):f?(r.state="errored",s(f)):_?(this.map._refreshExpiredTiles&&r.setExpiryData({cacheControl:y,expires:b}),r.setTexture(_,this.map.painter),r.state="loaded",o.al(this.dispatcher),void s(null)):s(null)))}abortTile(r,s){r.request&&(r.request.cancel(),delete r.request),s()}unloadTile(r,s){r.texture&&r.texture instanceof o.T?(r.destroy(!0),r.texture&&r.texture instanceof o.T&&this.map.painter.saveTileTexture(r.texture)):r.destroy(),s()}hasTransition(){return!1}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}class Be extends je{constructor(r,s,u,d){super(r,s,u,d),this.type="raster-array",this.maxzoom=22,this._options=o.e({type:"raster-array"},s)}triggerRepaint(r){const s=this.map.painter._terrain,u=this.map.style.getSourceCache(this.id);s&&s.enabled&&u&&s._clearRenderCacheForTile(u.id,r.tileID),this.map.triggerRepaint()}loadTile(r,s){const u=this.map._requestManager.normalizeTileURL(r.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize),d=this.map._requestManager.transformRequest(u,o.R.Tile);r.requestParams=d,r.actor||(r.actor=this.dispatcher.getActor()),r.request=r.fetchHeader(void 0,(f,_,y,b)=>{if(delete r.request,r.aborted)return r.state="unloaded",s(null);if(f)return f.code===20?void 0:(r.state="errored",s(f));this.map._refreshExpiredTiles&&r.setExpiryData({cacheControl:y,expires:b}),r.state="empty",s(null)})}unloadTile(r){const s=r.texture;s&&s instanceof o.T?(r.destroy(!0),this.map.painter.saveTileTexture(s)):(r.destroy(),r.flushQueues(),r._isHeaderLoaded=!1,delete r._mrt,delete r.textureDescriptor),r.fbo&&(r.fbo.destroy(),delete r.fbo),delete r.request,delete r.requestParams,delete r.neighboringTiles,r.state="unloaded"}prepareTile(r,s,u){r._isHeaderLoaded&&(r.state!=="empty"&&(r.state="reloading"),r.fetchBand(s,u,(d,f)=>{if(d)return r.state="errored",this.fire(new o.a(d)),void this.triggerRepaint(r);f&&(r.setTexture(f,this.map.painter),r.state="loaded",this.triggerRepaint(r))}))}getInitialBand(r){if(!this.rasterLayers)return 0;const s=this.rasterLayers.find(({id:f})=>f===r),u=s&&s.fields,d=u&&u.bands&&u.bands;return d?d[0]:0}getTextureDescriptor(r,s,u){if(!r)return;const d=s.sourceLayer||this.rasterLayerIds&&this.rasterLayerIds[0];if(!d)return;let f=null;s instanceof o.aq?f=s.paint.get("raster-array-band"):s instanceof o.ar&&(f=s.paint.get("raster-particle-array-band"));const _=f||this.getInitialBand(d);if(_!=null)if(r.textureDescriptor){if(!r.updateNeeded(d,_)||u)return Object.assign({},r.textureDescriptor,{texture:r.texture})}else this.prepareTile(r,d,_)}}const Ze=32,Fe=33,_t=new Uint16Array(8184);for(let c=0;c<2046;c++){let r=c+2,s=0,u=0,d=0,f=0,_=0,y=0;for(1&r?d=f=_=Ze:s=u=y=Ze;(r>>=1)>1;){const T=s+d>>1,S=u+f>>1;1&r?(d=s,f=u,s=_,u=y):(s=d,u=f,d=_,f=y),_=T,y=S}const b=4*c;_t[b+0]=s,_t[b+1]=u,_t[b+2]=d,_t[b+3]=f}
vendor: 16,495 bytes, line 14
14const Nt=new Uint16Array(2178),rt=new Uint8Array(1089),ci=new Uint16Array(1089);function Ii(c){return c===0?-.03125:c===32?.03125:0}class pi{constructor(r,s,u,d){this.id=pi.uniqueIdxCounter,pi.uniqueIdxCounter++,this.context=r;const f=r.gl;this.buffer=f.createBuffer(),this.dynamicDraw=!!u,this.context.unbindVAO(),r.bindElementBuffer.set(this.buffer),f.bufferData(f.ELEMENT_ARRAY_BUFFER,s.arrayBuffer,this.dynamicDraw?f.DYNAMIC_DRAW:f.STATIC_DRAW),this.dynamicDraw||d||s.destroy()}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(r){this.id=pi.uniqueIdxCounter,pi.uniqueIdxCounter++;const s=this.context.gl;this.context.unbindVAO(),this.bind(),s.bufferSubData(s.ELEMENT_ARRAY_BUFFER,0,r.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}pi.uniqueIdxCounter=0;const Oi={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class zi{constructor(r,s,u,d,f,_){this.length=s.length,this.attributes=u,this.itemSize=s.bytesPerElement,this.dynamicDraw=d,this.instanceCount=_,this.context=r;const y=r.gl;this.buffer=y.createBuffer(),r.bindVertexBuffer.set(this.buffer),y.bufferData(y.ARRAY_BUFFER,s.arrayBuffer,this.dynamicDraw?y.DYNAMIC_DRAW:y.STATIC_DRAW),this.dynamicDraw||f||s.destroy()}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(r){const s=this.context.gl;this.bind(),s.bufferSubData(s.ARRAY_BUFFER,0,r.arrayBuffer)}enableAttributes(r,s){for(let u=0;u<this.attributes.length;u++){const d=s.attributes[this.attributes[u].name];d!==void 0&&r.enableVertexAttribArray(d)}}setVertexAttribPointers(r,s,u){for(let d=0;d<this.attributes.length;d++){const f=this.attributes[d],_=s.attributes[f.name];_!==void 0&&r.vertexAttribPointer(_,f.components,r[Oi[f.type]],!1,this.itemSize,f.offset+this.itemSize*(u||0))}}setVertexAttribDivisor(r,s,u){for(let d=0;d<this.attributes.length;d++){const f=s.attributes[this.attributes[d].name];f!==void 0&&this.instanceCount&&this.instanceCount>0&&r.vertexAttribDivisor(f,u)}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class qt{constructor(r){this.gl=r.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(r){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class Lr extends qt{getDefault(){return o.aA.transparent}set(r){const s=this.current;(r.r!==s.r||r.g!==s.g||r.b!==s.b||r.a!==s.a||this.dirty)&&(this.gl.clearColor(r.r,r.g,r.b,r.a),this.current=r,this.dirty=!1)}}class Kr extends qt{getDefault(){return 1}set(r){(r!==this.current||this.dirty)&&(this.gl.clearDepth(r),this.current=r,this.dirty=!1)}}class Ki extends qt{getDefault(){return 0}set(r){(r!==this.current||this.dirty)&&(this.gl.clearStencil(r),this.current=r,this.dirty=!1)}}class ps extends qt{getDefault(){return[!0,!0,!0,!0]}set(r){const s=this.current;(r[0]!==s[0]||r[1]!==s[1]||r[2]!==s[2]||r[3]!==s[3]||this.dirty)&&(this.gl.colorMask(r[0],r[1],r[2],r[3]),this.current=r,this.dirty=!1)}}class Uo extends qt{getDefault(){return!0}set(r){(r!==this.current||this.dirty)&&(this.gl.depthMask(r),this.current=r,this.dirty=!1)}}class yr extends qt{getDefault(){return 255}set(r){(r!==this.current||this.dirty)&&(this.gl.stencilMask(r),this.current=r,this.dirty=!1)}}class up extends qt{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(r){const s=this.current;(r.func!==s.func||r.ref!==s.ref||r.mask!==s.mask||this.dirty)&&(this.gl.stencilFunc(r.func,r.ref,r.mask),this.current=r,this.dirty=!1)}}class Lt extends qt{getDefault(){const r=this.gl;return[r.KEEP,r.KEEP,r.KEEP]}set(r){const s=this.current;(r[0]!==s[0]||r[1]!==s[1]||r[2]!==s[2]||this.dirty)&&(this.gl.stencilOp(r[0],r[1],r[2]),this.current=r,this.dirty=!1)}}class xc extends qt{getDefault(){return!1}set(r){if(r===this.current&&!this.dirty)return;const s=this.gl;r?s.enable(s.STENCIL_TEST):s.disable(s.STENCIL_TEST),this.current=r,this.dirty=!1}}class xr extends qt{getDefault(){return[0,1]}set(r){const s=this.current;(r[0]!==s[0]||r[1]!==s[1]||this.dirty)&&(this.gl.depthRange(r[0],r[1]),this.current=r,this.dirty=!1)}}class In extends qt{getDefault(){return!1}set(r){if(r===this.current&&!this.dirty)return;const s=this.gl;r?s.enable(s.DEPTH_TEST):s.disable(s.DEPTH_TEST),this.current=r,this.dirty=!1}}class eh extends qt{getDefault(){return this.gl.LESS}set(r){(r!==this.current||this.dirty)&&(this.gl.depthFunc(r),this.current=r,this.dirty=!1)}}class th extends qt{getDefault(){return!1}set(r){if(r===this.current&&!this.dirty)return;const s=this.gl;r?s.enable(s.BLEND):s.disable(s.BLEND),this.current=r,this.dirty=!1}}class vc extends qt{getDefault(){const r=this.gl;return[r.ONE,r.ZERO,r.ONE,r.ZERO]}set(r){const s=this.current;(r[0]!==s[0]||r[1]!==s[1]||r[2]!==s[2]||r[3]!==s[3]||this.dirty)&&(this.gl.blendFuncSeparate(r[0],r[1],r[2],r[3]),this.current=r,this.dirty=!1)}}class ih extends qt{getDefault(){return o.aA.transparent}set(r){const s=this.current;(r.r!==s.r||r.g!==s.g||r.b!==s.b||r.a!==s.a||this.dirty)&&(this.gl.blendColor(r.r,r.g,r.b,r.a),this.current=r,this.dirty=!1)}}class rh extends qt{getDefault(){return this.gl.FUNC_ADD}set(r){(r!==this.current||this.dirty)&&(this.gl.blendEquationSeparate(r,r),this.current=r,this.dirty=!1)}}class nh extends qt{getDefault(){return!1}set(r){if(r===this.current&&!this.dirty)return;const s=this.gl;r?s.enable(s.CULL_FACE):s.disable(s.CULL_FACE),this.current=r,this.dirty=!1}}class sh extends qt{getDefault(){return this.gl.BACK}set(r){(r!==this.current||this.dirty)&&(this.gl.cullFace(r),this.current=r,this.dirty=!1)}}class oh extends qt{getDefault(){return this.gl.CCW}set(r){(r!==this.current||this.dirty)&&(this.gl.frontFace(r),this.current=r,this.dirty=!1)}}let Xa=class extends qt{getDefault(){return null}set(c){(c!==this.current||this.dirty)&&(this.gl.useProgram(c),this.current=c,this.dirty=!1)}};class Et extends qt{getDefault(){return this.gl.TEXTURE0}set(r){(r!==this.current||this.dirty)&&(this.gl.activeTexture(r),this.current=r,this.dirty=!1)}}class bc extends qt{getDefault(){const r=this.gl;return[0,0,r.drawingBufferWidth,r.drawingBufferHeight]}set(r){const s=this.current;(r[0]!==s[0]||r[1]!==s[1]||r[2]!==s[2]||r[3]!==s[3]||this.dirty)&&(this.gl.viewport(r[0],r[1],r[2],r[3]),this.current=r,this.dirty=!1)}}class fs extends qt{getDefault(){return null}set(r){if(r===this.current&&!this.dirty)return;const s=this.gl;s.bindFramebuffer(s.FRAMEBUFFER,r),this.current=r,this.dirty=!1}}class ah extends qt{getDefault(){return null}set(r){if(r===this.current&&!this.dirty)return;const s=this.gl;s.bindRenderbuffer(s.RENDERBUFFER,r),this.current=r,this.dirty=!1}}class lh extends qt{getDefault(){return null}set(r){if(r===this.current&&!this.dirty)return;const s=this.gl;s.bindTexture(s.TEXTURE_2D,r),this.current=r,this.dirty=!1}}class ch extends qt{getDefault(){return null}set(r){if(r===this.current&&!this.dirty)return;const s=this.gl;s.bindBuffer(s.ARRAY_BUFFER,r),this.current=r,this.dirty=!1}}class uh extends qt{getDefault(){return null}set(r){const s=this.gl;s.bindBuffer(s.ELEMENT_ARRAY_BUFFER,r),this.current=r,this.dirty=!1}}class hh extends qt{getDefault(){return null}set(r){this.gl&&(r!==this.current||this.dirty)&&(this.gl.bindVertexArray(r),this.current=r,this.dirty=!1)}}class dh extends qt{getDefault(){return 4}set(r){if(r===this.current&&!this.dirty)return;const s=this.gl;s.pixelStorei(s.UNPACK_ALIGNMENT,r),this.current=r,this.dirty=!1}}class ph extends qt{getDefault(){return!1}set(r){if(r===this.current&&!this.dirty)return;const s=this.gl;s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r),this.current=r,this.dirty=!1}}class fh extends qt{getDefault(){return!1}set(r){if(r===this.current&&!this.dirty)return;const s=this.gl;s.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,r),this.current=r,this.dirty=!1}}class Ya extends qt{constructor(r,s){super(r),this.context=r,this.parent=s}getDefault(){return null}}class hp extends Ya{setDirty(){this.dirty=!0}set(r){if(r===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const s=this.gl;s.framebufferTexture2D(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0,s.TEXTURE_2D,r,0),this.current=r,this.dirty=!1}}class Ja extends Ya{attachment(){return this.gl.DEPTH_ATTACHMENT}set(r){if(r===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const s=this.gl;s.framebufferRenderbuffer(s.FRAMEBUFFER,this.attachment(),s.RENDERBUFFER,r),this.current=r,this.dirty=!1}}class dp extends Ya{attachment(){return this.gl.DEPTH_ATTACHMENT}set(r){if(r===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const s=this.gl;s.framebufferTexture2D(s.FRAMEBUFFER,this.attachment(),s.TEXTURE_2D,r,0),this.current=r,this.dirty=!1}}class pp extends Ja{attachment(){return this.gl.DEPTH_STENCIL_ATTACHMENT}}class fp{constructor(r,s,u,d,f){this.context=r,this.width=s,this.height=u;const _=this.framebuffer=r.gl.createFramebuffer();d&&(this.colorAttachment=new hp(r,_)),f&&(this.depthAttachmentType=f,this.depthAttachment=f==="renderbuffer"?new Ja(r,_):new dp(r,_))}destroy(){const r=this.context.gl;if(this.colorAttachment){const s=this.colorAttachment.get();s&&r.deleteTexture(s)}if(this.depthAttachment&&this.depthAttachmentType)if(this.depthAttachmentType==="renderbuffer"){const s=this.depthAttachment.get();s&&r.deleteRenderbuffer(s)}else{const s=this.depthAttachment.get();s&&r.deleteTexture(s)}r.deleteFramebuffer(this.framebuffer)}}class lt{constructor(r,s,u){this.func=r,this.mask=s,this.range=u}}lt.ReadOnly=!1,lt.ReadWrite=!0,lt.disabled=new lt(519,lt.ReadOnly,[0,1]);const wc=7680;class yt{constructor(r,s,u,d,f,_){this.test=r,this.ref=s,this.mask=u,this.fail=d,this.depthFail=f,this.pass=_}}yt.disabled=new yt({func:519,mask:0},0,0,wc,wc,wc);const Ka=771;class Pt{constructor(r,s,u,d){this.blendFunction=r,this.blendColor=s,this.mask=u,this.blendEquation=d}}Pt.Replace=[1,0,1,0],Pt.disabled=new Pt(Pt.Replace,o.aA.transparent,[!1,!1,!1,!1]),Pt.unblended=new Pt(Pt.Replace,o.aA.transparent,[!0,!0,!0,!0]),Pt.alphaBlended=new Pt([1,Ka,1,Ka],o.aA.transparent,[!0,!0,!0,!0]),Pt.multiply=new Pt([774,0,774,0],o.aA.transparent,[!0,!0,!0,!0]);const Tc=1029,Ec=2305;class ft{constructor(r,s,u){this.enable=r,this.mode=s,this.frontFace=u}}ft.disabled=new ft(!1,Tc,Ec),ft.backCCW=new ft(!0,Tc,Ec),ft.backCW=new ft(!0,Tc,2304),ft.frontCW=new ft(!0,1028,2304),ft.frontCCW=new ft(!0,1028,Ec);class mn{constructor(r,s){this.gl=r,this.clearColor=new Lr(this),this.clearDepth=new Kr(this),this.clearStencil=new Ki(this),this.colorMask=new ps(this),this.depthMask=new Uo(this),this.stencilMask=new yr(this),this.stencilFunc=new up(this),this.stencilOp=new Lt(this),this.stencilTest=new xc(this),this.depthRange=new xr(this),this.depthTest=new In(this),this.depthFunc=new eh(this),this.blend=new th(this),this.blendFunc=new vc(this),this.blendColor=new ih(this),this.blendEquation=new rh(this),this.cullFace=new nh(this),this.cullFaceSide=new sh(this),this.frontFace=new oh(this),this.program=new Xa(this),this.activeTexture=new Et(this),this.viewport=new bc(this),this.bindFramebuffer=new fs(this),this.bindRenderbuffer=new ah(this),this.bindTexture=new lh(this),this.bindVertexBuffer=new ch(this),this.bindElementBuffer=new uh(this),this.bindVertexArrayOES=new hh(this),this.pixelStoreUnpack=new dh(this),this.pixelStoreUnpackPremultiplyAlpha=new ph(this),this.pixelStoreUnpackFlipY=new fh(this),this.options=s?{...s}:{},this.options.extTextureFilterAnisotropicForceOff||(this.extTextureFilterAnisotropic=r.getExtension("EXT_texture_filter_anisotropic")||r.getExtension("MOZ_EXT_texture_filter_anisotropic")||r.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=r.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT))),this.extDebugRendererInfo=r.getExtension("WEBGL_debug_renderer_info"),this.extDebugRendererInfo&&(this.renderer=r.getParameter(this.extDebugRendererInfo.UNMASKED_RENDERER_WEBGL),this.vendor=r.getParameter(this.extDebugRendererInfo.UNMASKED_VENDOR_WEBGL)),this.options.extTextureFloatLinearForceOff||(this.extTextureFloatLinear=r.getExtension("OES_texture_float_linear")),this.extRenderToTextureHalfFloat=r.getExtension("EXT_color_buffer_half_float"),this.extTimerQuery=r.getExtension("EXT_disjoint_timer_query_webgl2"),this.maxTextureSize=r.getParameter(r.MAX_TEXTURE_SIZE),this.maxPointSize=r.getParameter(r.ALIASED_POINT_SIZE_RANGE)[1]}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.bindVertexArrayOES.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(r,s,u){return new pi(this,r,s,u)}createVertexBuffer(r,s,u,d,f){return new zi(this,r,s,u,d,f)}createRenderbuffer(r,s,u){const d=this.gl,f=d.createRenderbuffer();return this.bindRenderbuffer.set(f),d.renderbufferStorage(d.RENDERBUFFER,r,s,u),this.bindRenderbuffer.set(null),f}createFramebuffer(r,s,u,d){return new fp(this,r,s,u,d)}clear({color:r,depth:s,stencil:u,colorMask:d}){const f=this.gl;let _=0;r&&(_|=f.COLOR_BUFFER_BIT,this.clearColor.set(r),this.colorMask.set(d||[!0,!0,!0,!0])),s!==void 0&&(_|=f.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(s),this.depthMask.set(!0)),u!==void 0&&(_|=f.STENCIL_BUFFER_BIT,this.clearStencil.set(u),this.stencilMask.set(255)),f.clear(_)}setCullFace(r){r.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(r.mode),this.frontFace.set(r.frontFace))}setDepthMode(r){r.func!==this.gl.ALWAYS||r.mask?(this.depthTest.set(!0),this.depthFunc.set(r.func),this.depthMask.set(r.mask),this.depthRange.set(r.range)):this.depthTest.set(!1)}setStencilMode(r){r.test.func!==this.gl.ALWAYS||r.mask?(this.stencilTest.set(!0),this.stencilMask.set(r.mask),this.stencilOp.set([r.fail,r.depthFail,r.pass]),this.stencilFunc.set({func:r.test.func,ref:r.ref,mask:r.test.mask})):this.stencilTest.set(!1)}setColorMode(r){At(r.blendFunction,Pt.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(r.blendFunction),this.blendColor.set(r.blendColor),r.blendEquation?this.blendEquation.set(r.blendEquation):this.blendEquation.setDefault()),this.colorMask.set(r.mask)}unbindVAO(){this.bindVertexArrayOES.set(null)}}var mp=o.aB([{name:"a_index",type:"Int16",components:1}]);const ms=.15000000000000002;class mh{constructor(r,s,u,d){const f={width:u[0],height:u[1],data:null},_=r.gl;this.targetColorTexture=new o.T(r,f,_.RGBA,{useMipmap:!1}),this.backgroundColorTexture=new o.T(r,f,_.RGBA,{useMipmap:!1}),this.context=r,this.setParticleTextureDimension(s,d),this.lastInvalidatedAt=0}setParticleTextureDimension(r,s){if(this.particleTextureDimension===s)return;(this.particleTexture0||this.particleTexture1||this.particleIndexBuffer||this.particleSegment)&&(this.particleTexture0.destroy(),this.particleTexture1.destroy(),this.particleIndexBuffer.destroy(),this.particleSegment.destroy());const u=this.context.gl,d=s*s,f=new Uint8Array(4*d),_=.7692307692307692,y=o.aC(r.key);for(let S=0;S<f.length;
14S+=4){const A=_*(y()+ms),C=_*(y()+ms),P=255*A%1,L=255*C%1,R=P,k=C-L/255,O=L;f[S+0]=Math.floor(255*(A-P/255)),f[S+1]=Math.floor(255*R),f[S+2]=Math.floor(255*k),f[S+3]=Math.floor(255*O)}const b=new o.h({width:s,height:s},f);this.particleTexture0=new o.T(this.context,b,u.RGBA,{premultiply:!1,useMipmap:!1}),this.particleTexture1=new o.T(this.context,b,u.RGBA,{premultiply:!1,useMipmap:!1});const T=new o.aD;T.reserve(d);for(let S=0;S<d;S++)T.emplaceBack(S);this.particleIndexBuffer=this.context.createVertexBuffer(T,mp.members,!0),this.particleSegment=o.aE.simpleSegment(0,0,this.particleIndexBuffer.length,0),this.particleTextureDimension=s}update(r){return!(this.lastInvalidatedAt<r&&(this.lastInvalidatedAt=o.f.now(),1))}destroy(){this.targetColorTexture.destroy(),this.backgroundColorTexture.destroy(),this.particleIndexBuffer.destroy(),this.particleTexture0.destroy(),this.particleTexture1.destroy(),this.particleSegment.destroy()}}const el={type:2,extent:o.Y,loadGeometry:()=>[[new o.P(0,0),new o.P(o.Y+1,0),new o.P(o.Y+1,o.Y+1),new o.P(0,o.Y+1),new o.P(0,0)]]};class en{constructor(r,s,u,d,f){this.tileID=r,this.uid=o.aF(),this.uses=0,this.tileSize=s,this.tileZoom=u,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.isRaster=f,d&&d.style&&(this._lastUpdatedBrightness=d.style.getBrightness()),this.expiredRequestCount=0,this.state="loading",d&&d.transform&&(this.projection=d.transform.projection)}registerFadeDuration(r){const s=r+this.timeAdded;s<o.f.now()||this.fadeEndTime&&s<this.fadeEndTime||(this.fadeEndTime=s)}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}get tileTransform(){return this._tileTransform||(this._tileTransform=o.av(this.tileID.canonical,this.projection)),this._tileTransform}loadVectorData(r,s,u){if(this.unloadVectorData(),this.state="loaded",r){r.featureIndex&&(this.latestFeatureIndex=r.featureIndex,r.rawTileData?(this.latestRawTileData=r.rawTileData,this.latestFeatureIndex.rawTileData=r.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=r.collisionBoxArray,this.buckets=function(d,f){const _={};if(!f)return _;for(const y of d){const b=y.layerIds.map(T=>f.getLayer(T)).filter(Boolean);if(b.length!==0){y.layers=b,y.stateDependentLayerIds&&(y.stateDependentLayers=y.stateDependentLayerIds.map(T=>b.filter(S=>S.id===T)[0]));for(const T of b)_[T.fqid]=y}}return _}(r.buckets,s.style),this.hasSymbolBuckets=!1;for(const d in this.buckets){const f=this.buckets[d];if(f instanceof o.aH){if(this.hasSymbolBuckets=!0,!u)break;f.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const d in this.buckets){const f=this.buckets[d];if(f instanceof o.aH&&f.hasRTLText){this.hasRTLText=!0,o.aI();break}}this.queryPadding=0;for(const d in this.buckets){const f=this.buckets[d],_=s.style.getOwnLayer(d);if(!_)continue;const y=_.queryRadius(f);this.queryPadding=Math.max(this.queryPadding,y)}r.imageAtlas&&(this.imageAtlas=r.imageAtlas),r.glyphAtlasImage&&(this.glyphAtlasImage=r.glyphAtlasImage),r.lineAtlas&&(this.lineAtlas=r.lineAtlas),this._lastUpdatedBrightness=r.brightness}else this.collisionBoxArray=new o.aG}unloadVectorData(){if(this.hasData()){for(const r in this.buckets)this.buckets[r].destroy();this.buckets={},this.imageAtlas&&(this.imageAtlas=null),this.lineAtlas&&(this.lineAtlas=null),this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.lineAtlasTexture&&this.lineAtlasTexture.destroy(),this._tileBoundsBuffer&&(this._tileBoundsBuffer.destroy(),this._tileBoundsIndexBuffer.destroy(),this._tileBoundsSegments.destroy(),this._tileBoundsBuffer=null),this._tileDebugBuffer&&(this._tileDebugBuffer.destroy(),this._tileDebugSegments.destroy(),this._tileDebugBuffer=null),this._tileDebugIndexBuffer&&(this._tileDebugIndexBuffer.destroy(),this._tileDebugIndexBuffer=null),this._globeTileDebugBorderBuffer&&(this._globeTileDebugBorderBuffer.destroy(),this._globeTileDebugBorderBuffer=null),this._tileDebugTextBuffer&&(this._tileDebugTextBuffer.destroy(),this._tileDebugTextSegments.destroy(),this._tileDebugTextIndexBuffer.destroy(),this._tileDebugTextBuffer=null),this._globeTileDebugTextBuffer&&(this._globeTileDebugTextBuffer.destroy(),this._globeTileDebugTextBuffer=null),this.latestFeatureIndex=null,this.state="unloaded"}}getBucket(r){return this.buckets[r.fqid]}upload(r){for(const d in this.buckets){const f=this.buckets[d];f.uploadPending()&&f.upload(r)}const s=r.gl,u=this.imageAtlas;if(u&&!u.uploaded){const d=!!Object.keys(u.patternPositions).length;this.imageAtlasTexture=new o.T(r,u.image,s.RGBA,{useMipmap:d}),this.imageAtlas.uploaded=!0}this.glyphAtlasImage&&(this.glyphAtlasTexture=new o.T(r,this.glyphAtlasImage,s.R8),this.glyphAtlasImage=null),this.lineAtlas&&!this.lineAtlas.uploaded&&(this.lineAtlasTexture=new o.T(r,this.lineAtlas.image,s.R8),this.lineAtlas.uploaded=!0)}prepare(r,s,u){if(this.imageAtlas&&this.imageAtlasTexture&&this.imageAtlas.patchUpdatedImages(r,this.imageAtlasTexture,u),!s||!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData)return;const d=s.style.getBrightness();(this._lastUpdatedBrightness||d)&&(this._lastUpdatedBrightness&&d&&Math.abs(this._lastUpdatedBrightness-d)<.001||(this._lastUpdatedBrightness=d,this.updateBuckets(void 0,s)))}queryRenderedFeatures(r,s,u,d,f,_,y,b){return this.latestFeatureIndex&&(this.latestFeatureIndex.rawTileData||this.latestFeatureIndex.is3DTile)?this.latestFeatureIndex.query({tileResult:d,pixelPosMatrix:y,transform:_,params:f,tileTransform:this.tileTransform},r,s,u):{}}querySourceFeatures(r,s){const u=this.latestFeatureIndex;if(!u||!u.rawTileData)return;const d=u.loadVTLayers(),f=s?s.sourceLayer:"",_=d._geojsonTileLayer||d[f];if(!_)return;const y=o.aJ(s&&s.filter),{z:b,x:T,y:S}=this.tileID.canonical,A={z:b,x:T,y:S};for(let C=0;C<_.length;C++){const P=_.feature(C);if(y.needGeometry){const k=o.aK(P,!0);
vendor: 5,419 bytes, line 14
14if(!y.filter(new o.N(this.tileID.overscaledZ),k,this.tileID.canonical))continue}else if(!y.filter(new o.N(this.tileID.overscaledZ),P))continue;const L=u.getId(P,f),R=new o.aL(P,b,T,S,L);R.tile=A,r.push(R)}}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}bucketsLoaded(){for(const r in this.buckets)if(this.buckets[r].uploadPending())return!1;return!0}patternsLoaded(){return!!this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(r){const s=this.expirationTime;if(r.cacheControl){const u=o.aM(r.cacheControl);u["max-age"]&&(this.expirationTime=Date.now()+1e3*u["max-age"])}else r.expires&&(this.expirationTime=new Date(r.expires).getTime());if(this.expirationTime){const u=Date.now();let d=!1;if(this.expirationTime>u)d=!1;else if(s)if(this.expirationTime<s)d=!0;else{const f=this.expirationTime-s;f?this.expirationTime=u+Math.max(f,3e4):d=!0}else d=!0;d?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-new Date().getTime(),Math.pow(2,31)-1)}setFeatureState(r,s){this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData&&Object.keys(r).length!==0&&s&&this.updateBuckets(r,s)}updateBuckets(r,s){if(!this.latestFeatureIndex)return;const u=this.latestFeatureIndex.loadVTLayers(),d=s.style.listImages(),f=s.style.getBrightness();for(const _ in this.buckets){if(!s.style.hasLayer(_))continue;const y=this.buckets[_],b=y.layers[0].sourceLayer||"_geojsonTileLayer",T=u[b];let S={};if(r&&(S=r[b],!T||!S||Object.keys(S).length===0))continue;if(y.update(S,T,d,this.imageAtlas&&this.imageAtlas.patternPositions||{},f),y instanceof o.aN||y instanceof o.aO){const C=s.style.getOwnSourceCache(y.layers[0].source);s._terrain&&s._terrain.enabled&&C&&y.programConfigurations.needsUpload&&s._terrain._clearRenderCacheForTile(C.id,this.tileID)}const A=s&&s.style&&s.style.getOwnLayer(_);A&&(this.queryPadding=Math.max(this.queryPadding,A.queryRadius(y)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<o.f.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(r){this.symbolFadeHoldUntil=o.f.now()+r}setTexture(r,s){const u=s.context,d=u.gl;this.texture=this.texture||s.getTileTexture(r.width),this.texture&&this.texture instanceof o.T?this.texture.update(r,{useMipmap:!0}):(this.texture=new o.T(u,r,d.RGBA,{useMipmap:!0}),this.texture.bind(d.LINEAR,d.CLAMP_TO_EDGE))}setDependencies(r,s){const u={};for(const d of s)u[d]=!0;this.dependencies[r]=u}hasDependency(r,s){for(const u of r){const d=this.dependencies[u];if(d){for(const f of s)if(d[f])return!0}}return!1}clearQueryDebugViz(){}_makeDebugTileBoundsBuffers(r,s){if(!s||s.name==="mercator"||this._tileDebugBuffer)return;const u=o.aP(el,this.tileID.canonical,this.tileTransform)[0],d=new o.aQ,f=new o.aR;for(let _=0;_<u.length;_++){const{x:y,y:b}=u[_];d.emplaceBack(y,b),f.emplaceBack(_)}f.emplaceBack(0),this._tileDebugIndexBuffer=r.createIndexBuffer(f),this._tileDebugBuffer=r.createVertexBuffer(d,o.aS.members),this._tileDebugSegments=o.aE.simpleSegment(0,0,d.length,f.length)}_makeTileBoundsBuffers(r,s){if(this._tileBoundsBuffer||!s||s.name==="mercator")return;const u=o.aP(el,this.tileID.canonical,this.tileTransform)[0];let d,f;if(this.isRaster){const _=function(y,b){const T=o.av(y,b),S=Math.pow(2,y.z);for(let k=0;k<Fe;k++)for(let O=0;O<Fe;O++){const N=o.aw((y.x+(O+Ii(O))/Ze)/S),$=o.ax((y.y+(k+Ii(k))/Ze)/S),Z=b.project(N,$),Q=k*Fe+O;Nt[2*Q+0]=Math.round((Z.x*T.scale-T.x)*o.Y),Nt[2*Q+1]=Math.round((Z.y*T.scale-T.y)*o.Y)}rt.fill(0),ci.fill(0);for(let k=2045;k>=0;k--){const O=4*k,N=_t[O+0],$=_t[O+1],Z=_t[O+2],Q=_t[O+3],B=N+Z>>1,U=$+Q>>1,K=B+U-$,Y=U+N-B,re=$*Fe+N,he=Q*Fe+Z,ie=U*Fe+B,ce=Math.hypot((Nt[2*re+0]+Nt[2*he+0])/2-Nt[2*ie+0],(Nt[2*re+1]+Nt[2*he+1])/2-Nt[2*ie+1])>=16;rt[ie]=rt[ie]||(ce?1:0),k<1022&&(rt[ie]=rt[ie]||rt[($+Y>>1)*Fe+(N+K>>1)]||rt[(Q+Y>>1)*Fe+(Z+K>>1)])}const A=new o.ay,C=new o.az;let P=0;function L(k,O){const N=O*Fe+k;return ci[N]===0&&(A.emplaceBack(Nt[2*N+0],Nt[2*N+1],k*o.Y/Ze,O*o.Y/Ze),ci[N]=++P),ci[N]-1}function R(k,O,N,$,Z,Q){const B=k+N>>1,U=O+$>>1;if(Math.abs(k-Z)+Math.abs(O-Q)>1&&rt[U*Fe+B])R(Z,Q,k,O,B,U),R(N,$,Z,Q,B,U);else{const K=L(k,O),Y=L(N,$),re=L(Z,Q);C.emplaceBack(K,Y,re)}}return R(0,0,Ze,Ze,Ze,0),R(Ze,Ze,0,0,0,Ze),{vertices:A,indices:C}}(this.tileID.canonical,s);d=_.vertices,f=_.indices}else{d=new o.ay,f=new o.az;for(const{x:y,y:b}of u)d.emplaceBack(y,b,0,0);const _=o.aT(d.int16,void 0,4);for(let y=0;y<_.length;y+=3)f.emplaceBack(_[y],_[y+1],_[y+2])}this._tileBoundsBuffer=r.createVertexBuffer(d,o.aU.members),this._tileBoundsIndexBuffer=r.createIndexBuffer(f),this._tileBoundsSegments=o.aE.simpleSegment(0,0,d.length,f.length)}_makeGlobeTileDebugBuffers(r,s){const u=s.projection;if(!u||u.name!=="globe"||s.freezeTileCoverage)return;const d=this.tileID.canonical,f=o.aV(d,s),_=o.aW(f),y=o.W(s.zoom);let b;y>0&&(b=o.a9.invert(new Float64Array(16),s.globeMatrix)),this._makeGlobeTileDebugBorderBuffer(r,d,s,_,b,y),this._makeGlobeTileDebugTextBuffer(r,d,s,_,b,y)}_globePoint(r,s,u,d,f,_,y){let b=o.aX(r,s,u);if(_){const T=1<<u.z,S=o.a8(d.center.lng),A=o.ah(d.center.lat),C=(u.x+.5)/T-S;let P=0;C>.5?P=-1:C<-.5&&(P=1);let L=(r/o.Y+u.x)/T+P,R=(s/o.Y+u.y)/T;
14L=(L-S)*d._pixelsPerMercatorPixel+S,R=(R-A)*d._pixelsPerMercatorPixel+A;const k=[L*d.worldSize,R*d.worldSize,0];o.Q.transformMat4(k,k,_),b=o.aY(b,k,y)}return o.Q.transformMat4(b,b,f)}_makeGlobeTileDebugBorderBuffer(r,s,u,d,f,_){const y=new o.aQ,b=new o.aR,T=new o.aZ,S=(C,P,L,R,k)=>{const O=(L-C)/(k-1),N=(R-P)/(k-1),$=y.length;for(let Z=0;Z<k;Z++){const Q=C+Z*O,B=P+Z*N;y.emplaceBack(Q,B);const U=this._globePoint(Q,B,s,u,d,f,_);T.emplaceBack(U[0],U[1],U[2]),b.emplaceBack($+Z)}},A=o.Y;S(0,0,A,0,16),S(A,0,A,A,16),S(A,A,0,A,16),S(0,A,0,0,16),this._tileDebugIndexBuffer=r.createIndexBuffer(b),this._tileDebugBuffer=r.createVertexBuffer(y,o.aS.members),this._globeTileDebugBorderBuffer=r.createVertexBuffer(T,o.a_.members),this._tileDebugSegments=o.aE.simpleSegment(0,0,y.length,b.length)}_makeGlobeTileDebugTextBuffer(r,s,u,d,f,_){const y=o.Y/4,b=new o.aQ,T=new o.az,S=new o.aZ,A=25;T.reserve(32),b.reserve(A),S.reserve(A);const C=(P,L)=>A*P+L;for(let P=0;P<A;P++){const L=P*y;for(let R=0;R<A;R++){const k=R*y;b.emplaceBack(k,L);const O=this._globePoint(k,L,s,u,d,f,_);S.emplaceBack(O[0],O[1],O[2])}}for(let P=0;P<4;P++)for(let L=0;L<4;L++){const R=C(P,L),k=C(P,L+1),O=C(P+1,L),N=C(P+1,L+1);T.emplaceBack(R,k,O),T.emplaceBack(O,k,N)}this._tileDebugTextIndexBuffer=r.createIndexBuffer(T),this._tileDebugTextBuffer=r.createVertexBuffer(b,o.aS.members),this._globeTileDebugTextBuffer=r.createVertexBuffer(S,o.a_.members),this._tileDebugTextSegments=o.aE.simpleSegment(0,0,A,32)}destroy(r=!1){for(const s in this.buckets)this.buckets[s].destroy();this.buckets={},this.imageAtlas&&(this.imageAtlas=null),this.lineAtlas&&(this.lineAtlas=null),this.imageAtlasTexture&&(this.imageAtlasTexture.destroy(),delete this.imageAtlasTexture),this.glyphAtlasTexture&&(this.glyphAtlasTexture.destroy(),delete this.glyphAtlasTexture),this.lineAtlasTexture&&(this.lineAtlasTexture.destroy(),delete this.lineAtlasTexture),this._tileBoundsBuffer&&(this._tileBoundsBuffer.destroy(),this._tileBoundsIndexBuffer.destroy(),this._tileBoundsSegments.destroy(),this._tileBoundsBuffer=null),this._tileDebugBuffer&&(this._tileDebugBuffer.destroy(),this._tileDebugSegments.destroy(),this._tileDebugBuffer=null),this._tileDebugIndexBuffer&&(this._tileDebugIndexBuffer.destroy(),this._tileDebugIndexBuffer=null),this._globeTileDebugBorderBuffer&&(this._globeTileDebugBorderBuffer.destroy(),this._globeTileDebugBorderBuffer=null),this._tileDebugTextBuffer&&(this._tileDebugTextBuffer.destroy(),this._tileDebugTextSegments.destroy(),this._tileDebugTextIndexBuffer.destroy(),this._tileDebugTextBuffer=null),this._globeTileDebugTextBuffer&&(this._globeTileDebugTextBuffer.destroy(),this._globeTileDebugTextBuffer=null),!r&&this.texture&&this.texture instanceof o.T&&(this.texture.destroy(),delete this.texture),this.hillshadeFBO&&(this.hillshadeFBO.destroy(),delete this.hillshadeFBO),this.dem&&delete this.dem,this.neighboringTiles&&delete this.neighboringTiles,this.demTexture&&(this.demTexture.destroy(),delete this.demTexture),this.rasterParticleState&&(this.rasterParticleState.destroy(),delete this.rasterParticleState),this.latestFeatureIndex=null,this.state="unloaded"}}const Ne={vector:Ue,raster:je,"raster-dem":class extends je{constructor(c,r,s,u){super(c,r,s,u),this.type="raster-dem",this.maxzoom=22,this._options=o.e({type:"raster-dem"},r),this.encoding=r.encoding||"mapbox"}loadTile(c,r){const s=this.map._requestManager.normalizeTileURL(c.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize);function u(d,f){d&&(c.state="errored",r(d)),f&&(c.dem=f,c.dem.onDeserialize(),c.needsHillshadePrepare=!0,c.needsDEMTextureUpload=!0,c.state="loaded",r(null))}c.request=o.d(this.map._requestManager.transformRequest(s,o.R.Tile),(function(d,f,_,y){if(delete c.request,c.aborted)c.state="unloaded",r(null);else if(d)c.state="errored",r(d);else if(f){this.map._refreshExpiredTiles&&c.setExpiryData({cacheControl:_,expires:y});const b=ImageBitmap&&f instanceof ImageBitmap&&o.an(),T=1-(f.width-o.ao(f.width))/2;T<1||c.neighboringTiles||(c.neighboringTiles=this._getNeighboringTiles(c.tileID));const S=b?f:o.f.getImageData(f,T),A={uid:c.uid,coord:c.tileID,source:this.id,scope:this.scope,rawImageData:S,encoding:this.encoding,padding:T};c.actor&&c.state!=="expired"||(c.actor=this.dispatcher.getActor(),c.actor.send("loadDEMTile",A,u.bind(this),void 0,!0))}}).bind(this))}_getNeighboringTiles(c){const r=c.canonical,s=Math.pow(2,r.z),u=(r.x-1+s)%s,d=r.x===0?c.wrap-1:c.wrap,f=(r.x+1+s)%s,_=r.x+1===s?c.wrap+1:c.wrap,y={};return y[new o.ap(c.overscaledZ,d,r.z,u,r.y).key]={backfilled:!1},y[new o.ap(c.overscaledZ,_,r.z,f,r.y).key]={backfilled:!1},r.y>0&&(y[new o.ap(c.overscaledZ,d,r.z,u,r.y-1).key]={backfilled:!1},y[new o.ap(c.overscaledZ,c.wrap,r.z,r.x,r.y-1).key]={backfilled:!1},y[new o.ap(c.overscaledZ,_,r.z,f,r.y-1).key]={backfilled:!1}),r.y+1<s&&(y[new o.ap(c.overscaledZ,d,r.z,u,r.y+1).key]={backfilled:!1},y[new o.ap(c.overscaledZ,c.wrap,r.z,r.x,r.y+1).key]={backfilled:!1},y[new o.ap(c.overscaledZ,_,r.z,f,r.y+1).key]={backfilled:!1}),y}},"raster-array":Be,geojson:class extends o.E{constructor(c,r,s,u){super(),this.id=c,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._loaded=!1,this.actor=s.getActor(),this.setEventedParent(u),this._data=r.data,this._options=o.e({},r),this._collectResourceTiming=r.collectResourceTiming,r.maxzoom!==void 0&&(this.maxzoom=r.maxzoom),r.minzoom!==void 0&&(this.minzoom=r.minzoom),r.type&&(this.t
14ype=r.type),r.attribution&&(this.attribution=r.attribution),this.promoteId=r.promoteId;const d=o.Y/this.tileSize;this.workerOptions=o.e({source:this.id,scope:this.scope,cluster:r.cluster||!1,geojsonVtOptions:{buffer:(r.buffer!==void 0?r.buffer:128)*d,tolerance:(r.tolerance!==void 0?r.tolerance:.375)*d,extent:o.Y,maxZoom:this.maxzoom,lineMetrics:r.lineMetrics||!1,generateId:r.generateId||!1},superclusterOptions:{maxZoom:r.clusterMaxZoom!==void 0?r.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,r.clusterMinPoints||2),extent:o.Y,radius:(r.clusterRadius!==void 0?r.clusterRadius:50)*d,log:!1,generateId:r.generateId||!1},clusterProperties:r.clusterProperties,filter:r.filter,dynamic:r.dynamic},r.workerOptions)}onAdd(c){this.map=c,this.setData(this._data)}setData(c){return this._data=c,this._updateWorkerData(),this}updateData(c){return this._options.dynamic?(this._data=c,this._updateWorkerData(!0),this):this.fire(new o.a(new Error("Can't call updateData on a GeoJSON source with dynamic set to false.")))}getClusterExpansionZoom(c,r){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:c,source:this.id,scope:this.scope},r),this}getClusterChildren(c,r){return this.actor.send("geojson.getClusterChildren",{clusterId:c,source:this.id,scope:this.scope},r),this}getClusterLeaves(c,r,s,u){return this.actor.send("geojson.getClusterLeaves",{source:this.id,scope:this.scope,clusterId:c,limit:r,offset:s},u),this}_updateWorkerData(c=!1){if(this._pendingLoad)return void(this._coalesce=!0);this.fire(new o.b("dataloading",{dataType:"source"})),this._loaded=!1;const r=o.e({append:c},this.workerOptions);r.scope=this.scope;const s=this._data;typeof s=="string"?(r.request=this.map._requestManager.transformRequest(o.f.resolveURL(s),o.R.Source),r.request.collectResourceTiming=this._collectResourceTiming):r.data=JSON.stringify(s),this._pendingLoad=this.actor.send(`${this.type}.loadData`,r,(u,d)=>{if(this._loaded=!0,this._pendingLoad=null,u)this.fire(new o.a(u));else{const f={dataType:"source",sourceDataType:this._metadataFired?"content":"metadata"};this._collectResourceTiming&&d&&d.resourceTiming&&d.resourceTiming[this.id]&&(f.resourceTiming=d.resourceTiming[this.id]),this.fire(new o.b("data",f)),this._metadataFired=!0}this._coalesce&&(this._updateWorkerData(c),this._coalesce=!1)})}loaded(){return this._loaded}loadTile(c,r){const s=c.actor?"reloadTile":"loadTile";c.actor=this.actor;const u={type:this.type,uid:c.uid,tileID:c.tileID,tileZoom:c.tileZoom,zoom:c.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,scope:this.scope,pixelRatio:o.f.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,brightness:this.map.style&&this.map.style.getBrightness()||0};c.request=this.actor.send(s,u,(d,f)=>(delete c.request,c.destroy(),c.aborted?r(null):d?r(d):(c.loadVectorData(f,this.map.painter,s==="reloadTile"),r(null))),void 0,s==="loadTile")}abortTile(c){c.request&&(c.request.cancel(),delete c.request),c.aborted=!0}unloadTile(c){this.actor.send("removeTile",{uid:c.uid,type:this.t
14ype,source:this.id,scope:this.scope}),c.destroy()}onRemove(){this._pendingLoad&&this._pendingLoad.cancel()}serialize(){return o.e({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}},video:class extends o.as{constructor(c,r,s,u){super(c,r,s,u),this.roundZoom=!0,this.type="video",this.options=r}load(){this._loaded=!1;const c=this.options;this.urls=[];for(const r of c.urls)this.urls.push(this.map._requestManager.transformRequest(r,o.R.Source).url);o.at(this.urls,(r,s)=>{this._loaded=!0,r?this.fire(new o.a(r)):s&&(this.video=s,this.video.loop=!0,this.video.setAttribute("playsinline",""),this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading())})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(c){if(this.video){const r=this.video.seekable;c<r.start(0)||c>r.end(0)?this.fire(new o.a(new o.V(`sources.${this.id}`,null,`Playback for this video can be set only between the ${r.start(0)} and ${r.end(0)}-second mark.`))):this.video.currentTime=c}}getVideo(){return this.video}
14onAdd(c){this.map||(this.map=c,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const c=this.map.painter.context,r=c.gl;this.texture?this.video.paused||(this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE),r.texSubImage2D(r.TEXTURE_2D,0,0,0,r.RGBA,r.UNSIGNED_BYTE,this.video)):(this.texture=new o.T(c,this.video,r.RGBA),this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE),this.width=this.video.videoWidth,this.height=this.video.videoHeight),this._prepareData(c)}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}},image:o.as,model:class extends o.E{constructor(c,r,s,u){super(),this.id=c,this.type="model",this.models=[],this._loaded=!1,this._options=r}load(){const c=[];for(const r in this._options.models){const s=this._options.models[r],u=o.l(this.map._requestManager.transformRequest(s.uri,o.R.Model).url).then(d=>{if(!d)return;const f=o.c(d),_=new o.M(r,s.position,s.orientation,f);_.computeBoundsAndApplyParent(),this.models.push(_)}).catch(d=>{this.fire(new o.a(new Error(`Could not load model ${r} from ${s.uri}: ${d.message}`)))});c.push(u)}return Promise.allSettled(c).then(()=>{this._loaded=!0,this.fire(new o.b("data",{dataType:"source",sourceDataType:"metadata"}))}).catch(r=>{this.fire(new o.a(new Error(`Could not load models: ${r.message}`)))})}onAdd(c){this.map=c,this.load()}hasTransition(){return!1}loaded(){return this._loaded}getModels(){return this.models}loadTile(c,r){}serialize(){return{type:"model"}}},"batched-model":class extends o.E{constructor(c,r,s,u){super(),this.type="batched-model",this.id=c,this.tileSize=512,this._options=r,this.tiles=this._options.tiles,this.maxzoom=r.maxzoom||19,this.minzoom=r.minzoom||0,this.roundZoom=!0,this.usedInConflation=!0,this.dispatcher=s,this.reparseOverscaled=!1,this.scheme="xyz",this._loaded=!1,this.setEventedParent(u)}onAdd(c){this.map=c,this.load()}load(c){this._loaded=!1,this.fire(new o.b("dataloading",{dataType:"source"}));const r=Array.isArray(this.map._language)?this.map._language.join():this.map._language,s=this.map._worldview;this._tileJSONRequest=Oe(this._options,this.map._requestManager,r,s,(u,d)=>{this._tileJSONRequest=null,this._loaded=!0,u?(r&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${r}`),s&&s.length!==2&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${s}`),this.fire(new o.a(u))):d&&(o.e(this,d),d.bounds&&(this.tileBounds=new ke(d.bounds,this.minzoom,this.maxzoom)),o.am(d.tiles,this.map._requestManager._customAccessToken),this.fire(new o.b("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new o.b("data",{dataType:"source",sourceDataType:"content"}))),c&&c(u)})}hasTransition(){return!1}hasTile(c){return!this.tileBounds||this.tileBounds.contains(c.canonical)}loaded(){return this._loaded}loadTile(c,r){const s=this.map._requestManager.normalizeTileURL(c.tileID.canonical.url(this.tiles,this.scheme)),u={request:this.map._requestManager.transformRequest(s,o.R.Tile),data:void 0,uid:c.uid,tileID:c.tileID,tileZoom:c.tileZoom,zoom:c.tileID.overscaledZ,tileSize:this.tileSize*c.tileID.overscaleFactor(),type:this.t
14ype,source:this.id,scope:this.scope,showCollisionBoxes:this.map.showCollisionBoxes,isSymbolTile:c.isSymbolTile,brightness:this.map.style&&this.map.style.getBrightness()||0};if(c.actor&&c.state!=="expired")if(c.state==="loading")c.reloadCallback=r;else{if(c.buckets){const f=Object.values(c.buckets);for(const _ of f)_.dirty=!0;return void(c.state="loaded")}c.request=c.actor.send("reloadTile",u,d.bind(this))}else c.actor=this.dispatcher.getActor(),c.request=c.actor.send("loadTile",u,d.bind(this),void 0,!0);function d(f,_){return c.aborted?r(null):f&&f.status!==404?r(f):(_&&(_.resourceTiming&&(c.resourceTiming=_.resourceTiming),this.map._refreshExpiredTiles&&c.setExpiryData(_),c.buckets={...c.buckets,..._.buckets},_.featureIndex&&(c.latestFeatureIndex=_.featureIndex)),c.state="loaded",void r(null))}}serialize(){return o.e({},this._options)}},canvas:class extends o.as{constructor(c,r,s,u){super(c,r,s,u),r.coordinates?Array.isArray(r.coordinates)&&r.coordinates.length===4&&!r.coordinates.some(d=>!Array.isArray(d)||d.length!==2||d.some(f=>typeof f!="number"))||this.fire(new o.a(new o.V(`sources.${c}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new o.a(new o.V(`sources.${c}`,null,'missing required property "coordinates"'))),r.animate&&typeof r.animate!="boolean"&&this.fire(new o.a(new o.V(`sources.${c}`,null,'optional "animate" property must be a boolean value'))),r.canvas?typeof r.canvas=="string"||r.canvas instanceof HTMLCanvasElement||this.fire(new o.a(new o.V(`sources.${c}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new o.a(new o.V(`sources.${c}`,null,'missing required property "canvas"'))),this.options=r,this.animate=r.animate===void 0||r.animate}load(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new o.a(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())}getCanvas(){return this.canvas}onAdd(c){this.map=c,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let c=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,c=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,c=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const r=this.map.painter.context;this.texture?!c&&!this._playing||this.texture instanceof o.au||this.texture.update(this.canvas,{premultiply:!0}):this.texture=new o.T(r,this.canvas,r.gl.RGBA,{premultiply:!0}),this._prepareData(r)}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const c of[this.canvas.width,this.canvas.height])if(isNaN(c)||c<=0)return!0;return!1}},custom:class extends o.E{constructor(c,r,s,u){super(),this.id=c,this.type="custom",this._dataType="raster",this._dispatcher=s,this._implementation=r,this.setEventedParent(u),this.scheme="xyz",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this._loaded=!1,this.roundZoom=!0,this._implementation||this.fire(new o.a(new Error(`Missing implementation for ${this.id} custom source`))),this._implementation.loadTile||this.fire(new o.a(new Error(`Missing loadTile implementation for ${this.id} custom source`))),this._implementation.bounds&&(this.tileBounds=new ke(this._implementation.bounds,this.minzoom,this.maxzoom)),r.update=this._update.bind(this),r.clearTiles=this._clearTiles.bind(this),r.coveringTiles=this._coveringTiles.bind(this),o.e(this,o.af(r,["dataType","scheme","minzoom","maxzoom","tileSize","attribution","minTileCacheSize","maxTileCacheSize"]))}serialize(){return o.af(this,["type","scheme","minzoom","maxzoom","tileSize","attribution"])}load(){this._loaded=!0,this.fire(new o.b("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new o.b("data",{dataType:"source",sourceDataType:"content"}))}loaded(){return this._loaded}onAdd(c){this._map=c,this._loaded=!1,this.fire(new o.b("dataloading",{dataType:"source"})),this._implementation.onAdd&&this._implementation.onAdd(c),this.load()}onRemove(c){this._implementation.onRemove&&this._implementation.onRemove(c)}hasTile(c){if(this._implementation.hasTile){const{x:r,y:s,z:u}=c.canonical;return this._implementation.hasTile({x:r,y:s,z:u})}return!this.tileBounds||this.tileBounds.contains(c.canonical)}loadTile(c,r){const{x:s,y:u,z:d}=c.tileID.canonical,f=new AbortController;c.request=Promise.resolve(this._implementation.loadTile({x:s,y:u,z:d}
14,{signal:f.signal})).then((function(_){return delete c.request,c.aborted?(c.state="unloaded",r(null)):_===void 0?(c.state="errored",r(null)):_===null?(this.loadTileData(c,{width:this.tileSize,height:this.tileSize,data:null}),c.state="loaded",r(null)):function(y){return y instanceof ImageData||y instanceof HTMLCanvasElement||y instanceof ImageBitmap||y instanceof HTMLImageElement}(_)?(this.loadTileData(c,_),c.state="loaded",void r(null)):(c.state="errored",r(new Error(`Can't infer data type for ${this.id}, only raster data supported at the moment`)))}).bind(this)).catch(_=>{_.code!==20&&(c.state="errored",r(_))}),c.request.cancel=()=>f.abort()}loadTileData(c,r){c.setTexture(r,this._map.painter)}unloadTile(c,r){if(c.texture&&c.texture instanceof o.T?(c.destroy(!0),c.texture&&c.texture instanceof o.T&&this._map.painter.saveTileTexture(c.texture)):c.destroy(),this._implementation.unloadTile){const{x:s,y:u,z:d}=c.tileID.canonical;this._implementation.unloadTile({x:s,y:u,z:d})}r()}abortTile(c,r){c.request&&c.request.cancel&&(c.request.cancel(),delete c.request),r()}hasTransition(){return!1}_coveringTiles(){return this._map.transform.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,roundZoom:this.roundZoom}).map(c=>({x:c.canonical.x,y:c.canonical.y,z:c.canonical.z}))}_clearTiles(){const c=o.aj(this.id,this.scope);this._map.style.clearSource(c)}
14_update(){this.fire(new o.b("data",{dataType:"source",sourceDataType:"content"}))}}},Sc=function(c,r,s,u){const d=new Ne[r.type](c,r,s,u);if(d.id!==c)throw new Error(`Expected Source id to be ${c} instead of ${d.id}`);return o.a$(["load","abort","unload","serialize","prepare"],d),d};function Mc(c,r){const s=o.a9.identity([]);return o.a9.scale(s,s,[.5*c.width,.5*-c.height,1]),o.a9.translate(s,s,[1,-1,0]),o.a9.multiply(s,s,c.calculateProjMatrix(r.toUnwrapped())),Float32Array.from(s)}function jt(c,r,s,u,d,f,_,y=!1){const b=c.tilesIn(u,_,y);b.sort(_h);const T=[];for(const A of b)T.push({wrappedTileID:A.tile.tileID.wrapped().key,queryResults:A.tile.queryRenderedFeatures(r,s,c._state,A,d,f,Mc(c.transform,A.tile.tileID),y)});const S=function(A){const C={},P={};for(const L of A){const R=L.queryResults,k=L.wrappedTileID,O=P[k]=P[k]||{};for(const N in R){const $=R[N],Z=O[N]=O[N]||{},Q=C[N]=C[N]||[];for(const B of $)Z[B.featureIndex]||(Z[B.featureIndex]=!0,Q.push(B))}}return C}(T);for(const A in S)S[A].forEach(C=>{const P=C.feature,L=P.layer;L&&L.type!=="background"&&L.type!=="sky"&&L.type!=="slot"&&(P.source=L.source,L["source-layer"]&&(P.sourceLayer=L["source-layer"]),P.state=P.id!==void 0?c.getFeatureState(L["source-layer"],P.id):{})});return S}function vr(c,r){const s=c.getRenderableIds().map(f=>c.getTileByID(f)),u=[],d={};for(let f=0;f<s.length;f++){const _=s[f],y=_.tileID.canonical.key;d[y]||(d[y]=!0,_.querySourceFeatures(u,r))}return u}function _h(c,r){const s=c.tileID,u=r.tileID;return s.overscaledZ-u.overscaledZ||s.canonical.y-u.canonical.y||s.wrap-u.wrap||s.canonical.x-u.canonical.x}class tl extends en{constructor(r,s,u,d,f){super(r,s,u,d,f),this._workQueue=[],this._fetchQueue=[],this._isHeaderLoaded=!1}setTexture(r,s){const u=s.context,d=u.gl;this.texture=this.texture||s.getTileTexture(r.width),this.texture&&this.texture instanceof o.T?this.texture.update(r,{useMipmap:!1,premultiply:!1}):this.texture=new o.T(u,r,d.RGBA,{useMipmap:!1,premultiply:!1})}flushQueues(){for(;this._workQueue.length;)this._workQueue.pop()();for(;this._fetchQueue.length;)this._fetchQueue.pop()()}fetchHeader(r=16384,s){const u=this._mrt=new o.b0(30),d=Object.assign({},this.requestParams,{headers:{Range:"bytes=0-"+(r-1)}});return this.entireBuffer=null,this.request=o.b1(d,(f,_,y,b)=>{if(f)s(f);else try{const T=u.getHeaderLength(_);if(T>r)return void(this.request=this.fetchHeader(T,s));u.parseHeader(_),this._isHeaderLoaded=!0;let S=0;for(const A of Object.values(u.layers))S=Math.max(S,A.dataIndex[A.dataIndex.length-1].last_byte);_.byteLength>=S&&(this.entireBuffer=_),s(null,this.entireBuffer||_,y,b)}catch(T){s(T)}}),this.request}fetchBand(r,s,u){const d=this._mrt;if(!this._isHeaderLoaded||!d)return void u(new Error("Tile header is not ready"));const f=this.actor;if(!f)return void u(new Error("Can't fetch tile band without an actor"));let _;const y=(A,C)=>{_.complete(A,C),A?u(A):(this.updateTextureDescriptor(r,s),u(null,this.textureDescriptor&&this.textureDescriptor.img))},b=(A,C)=>{if(A)return u(A);const P=f.send("decodeRasterArray",{buffer:C,task:_},y,void 0,!0);this._workQueue.push(()=>{P&&P.cancel(),_.cancel()})},T=d.getLayer(r);if(!T)return void u(new Error(`Unknown sourceLayer "${r}"`));if(T.hasDataForBand(s))return this.updateTextureDescriptor(r,s),void u(null,this.textureDescriptor?this.textureDescriptor.img:null);const S=T.getDataRange([s]);if(_=d.createDecodingTask(S),!_||_.tasks.length)if(this.flushQueues(),this.entireBuffer)b(null,this.entireBuffer.slice(S.firstByte,S.lastByte+1));else{const A=Object.assign({},this.requestParams,{headers:{Range:`bytes=${S.firstByte}-${S.lastByte}`}}),C=o.b1(A,b);this._fetchQueue.push(()=>{C.cancel(),_.cancel()})}else u(null)}updateNeeded(r,s){return(!this.textureDescriptor||this.textureDescriptor.band!==s||this.textureDescriptor.layer!==r)&&this.state!=="errored"}updateTextureDescriptor(r,s){if(!this._mrt)return;const u=this._mrt.getLayer(r);if(!u||!u.hasBand(s)||!u.hasDataForBand(s))return;const{bytes:d,tileSize:f,buffer:_,offset:y,scale:b}=u.getBandView(s),T=f+2*_,S={data:d,width:T,height:T},A=this.texture;A&&A instanceof o.T&&A.update(S,{useMipmap:!1,premultiply:!1}),this.textureDescriptor={layer:r,band:s,img:S,buffer:_,offset:y,tileSize:f,format:u.pixelFormat,mix:[b,256*b,65536*b,16777216*b]}}}class gh{constructor(r,s){this.max=r,this.onRemove=s,this.reset()}reset(){for(const r in this.data)for(const s of this.data[r])s.timeout&&clearTimeout(s.timeout),this.onRemove(s.value);return this.data={},this.order=[],this}add(r,s,u){const d=r.wrapped().key;this.data[d]===void 0&&(this.data[d]=[]);const f={value:s,timeout:void 0};if(u!==void 0&&(f.timeout=setTimeout(()=>{this.remove(r,f)},u)),this.data[d].push(f),this.order.push(d),this.order.length>this.max){const _=this._getAndRemoveByKey(this.order[0]);_&&this.onRemove(_)}return this}has(r){return r.wrapped().key in this.data}getAndRemove(r){return this.has(r)?this._getAndRemoveByKey(r.wrapped().key):null}_getAndRemoveByKey(r){const s=this.data[r].shift();return s.timeout&&clearTimeout(s.timeout),this.data[r].length===0&&delete this.data[r],this.order.splice(this.order.indexOf(r),1),s.value}getByKey(r){const s=this.data[r];return s?s[0].value:null}get(r){return this.has(r)?this.data[r.wrapped().key][0].value:null}remove(r,s){if(!this.has(r))return this;const u=r.wrapped().key,d=s===void 0?0:this.data[u].indexOf(s),f=this.data[u][d];return this.data[u].splice(d,1),f.timeout&&clearTimeout(f.timeout),this.data[u].length===0&&delete this.data[u],this.onRemove(f.value),this.order.splice(this.order.indexOf(u),1),this}setMaxSize(r){for(this.max=r;this.order.length>this.max;){const s=this._getAndRemoveByKey(this.order[0]);s&&this.onRemove(s)}return this}filter(r){const s=[];for(const u in this.data)for(const d of this.data[u])r(d.value)||s.push(d);for(const u of s)this.remove(u.value.tileID,u)}}class tn extends o.E{constructor(r,s,u){super(),this.id=r,this._onlySymbols=u,s.on("data",d=>{d.dataType==="source"&&d.sourceDataType==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&d.dataType==="source"&&d.sourceDataType==="content"&&(this.reload(),this.transform&&this.update(this.transform))}),s.on("error",()=>{this._sourceErrored=!0}),this._source=s,this._tiles={},this._cache=new gh(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={}
vendor: 16,803 bytes, line 14
14,this._minTileCacheSize=s.minTileCacheSize,this._maxTileCacheSize=s.maxTileCacheSize,this._loadedParentTiles={},this.castsShadows=!1,this.tileCoverLift=0,this._coveredTiles={},this._shadowCasterTiles={},this._state=new Dr,this._isRaster=this._source.type==="raster"||this._source.type==="raster-dem"||this._source.type==="raster-array"||this._source.type==="custom"&&this._source._dataType==="raster"}onAdd(r){this.map=r,this._minTileCacheSize=this._minTileCacheSize===void 0&&r?r._minTileCacheSize:this._minTileCacheSize,this._maxTileCacheSize=this._maxTileCacheSize===void 0&&r?r._maxTileCacheSize:this._maxTileCacheSize}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;for(const r in this._tiles){const s=this._tiles[r];if(s.state!=="errored"&&(s.state!=="loaded"||!s.bucketsLoaded()))return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const r=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,r&&this.reload(),this.transform&&this.update(this.transform)}_loadTile(r,s){return r.isSymbolTile=this._onlySymbols,r.isExtraShadowCaster=this._shadowCasterTiles[r.tileID.key],this._source.loadTile(r,s)}_unloadTile(r){if(this._source.unloadTile)return this._source.unloadTile(r,()=>{})}_abortTile(r){if(this._source.abortTile)return this._source.abortTile(r,()=>{})}serialize(){return this._source.serialize()}prepare(r){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const s in this._tiles){const u=this._tiles[s];u.upload(r),u.prepare(this.map.style.imageManager,this.map?this.map.painter:null,this._source.scope)}}getIds(){return o.b2(this._tiles).map(r=>r.tileID).sort(kt).map(r=>r.key)}getRenderableIds(r,s){const u=[];for(const d in this._tiles)this._isIdRenderable(+d,r,s)&&u.push(this._tiles[d]);return r?u.sort((d,f)=>{const _=d.tileID,y=f.tileID,b=new o.P(_.canonical.x,_.canonical.y)._rotate(this.transform.angle),T=new o.P(y.canonical.x,y.canonical.y)._rotate(this.transform.angle);return _.overscaledZ-y.overscaledZ||T.y-b.y||T.x-b.x}).map(d=>d.tileID.key):u.map(d=>d.tileID).sort(kt).map(d=>d.key)}hasRenderableParent(r){const s=this.findLoadedParent(r,0);return!!s&&this._isIdRenderable(s.tileID.key)}_isIdRenderable(r,s,u){return this._tiles[r]&&this._tiles[r].hasData()&&!this._coveredTiles[r]&&(s||!this._tiles[r].holdingForFade())&&(u||!this._shadowCasterTiles[r])}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const r in this._tiles)this._tiles[r].state!=="errored"&&this._reloadTile(+r,"reloading")}}_reloadTile(r,s){const u=this._tiles[r];u&&(u.state!=="loading"&&(u.state=s),this._loadTile(u,this._tileLoaded.bind(this,u,r,s)))}_tileLoaded(r,s,u,d){if(d)if(r.state="errored",d.status!==404)this._source.fire(new o.a(d,{tile:r}));else{if(!(r.tileID.key in this._loadedParentTiles))return void this._source.fire(new o.b("data",{dataType:"source",sourceDataType:"error",sourceId:this._source.id}));if(this._source.type==="raster-dem"&&this.usedForTerrain&&this.map.painter.terrain){const f=this.map.painter.terrain;this.update(this.transform,f.getScaledDemTileSize(),!0),f.resetTileLookupCache(this.id)}else this.update(this.transform)}else r.timeAdded=o.f.now(),u==="expired"&&(r.refreshedUponExpiration=!0),this._setTileReloadTimer(s,r),this._source.type==="raster-dem"&&r.dem&&this._backfillDEM(r),this._state.initializeTileState(r,this.map?this.map.painter:null),this._source.fire(new o.b("data",{dataType:"source",tile:r,coord:r.tileID,sourceCacheId:this.id}))}_backfillDEM(r){const s=this.getRenderableIds();for(let d=0;d<s.length;d++){const f=s[d];if(r.neighboringTiles&&r.neighboringTiles[f]){const _=this.getTileByID(f);u(r,_),u(_,r)}}function u(d,f){if(!d.dem||d.dem.borderReady)return;d.needsHillshadePrepare=!0,d.needsDEMTextureUpload=!0;let _=f.tileID.canonical.x-d.tileID.canonical.x;const y=f.tileID.canonical.y-d.tileID.canonical.y,b=Math.pow(2,d.tileID.canonical.z),T=f.tileID.key;_===0&&y===0||Math.abs(y)>1||(Math.abs(_)>1&&(Math.abs(_+b)===1?_+=b:Math.abs(_-b)===1&&(_-=b)),f.dem&&d.dem&&(d.dem.backfillBorder(f.dem,_,y),d.neighboringTiles&&d.neighboringTiles[T]&&(d.neighboringTiles[T].backfilled=!0)))}}getTile(r){return this.getTileByID(r.key)}getTileByID(r){return this._tiles[r]}_retainLoadedChildren(r,s,u,d){for(const f in this._tiles){let _=this._tiles[f];if(d[f]||!_.hasData()||_.tileID.overscaledZ<=s||_.tileID.overscaledZ>u)continue;let y=_.tileID;for(;_&&_.tileID.overscaledZ>s+1;){const T=_.tileID.scaledTo(_.tileID.overscaledZ-1);_=this._tiles[T.key],_&&_.hasData()&&(y=T)}let b=y;for(;b.overscaledZ>s;)if(b=b.scaledTo(b.overscaledZ-1),r[b.key]){d[y.key]=y;break}}}findLoadedParent(r,s){if(r.key in this._loadedParentTiles){const u=this._loadedParentTiles[r.key];return u&&u.tileID.overscaledZ>=s?u:null}for(let u=r.overscaledZ-1;u>=s;u--){const d=r.scaledTo(u),f=this._getLoadedTile(d);if(f)return f}}_getLoadedTile(r){const s=this._tiles[r.key];return s&&s.hasData()?s:this._cache.getByKey(this._source.reparseOverscaled?r.wrapped().key:r.canonical.key)}updateCacheSize(r,s){s=s||this._source.tileSize;const u=Math.ceil(r.width/s)+1,d=Math.ceil(r.height/s)+1,f=Math.floor(u*d*5),_=typeof this._minTileCacheSize=="number"?Math.max(this._minTileCacheSize,f):f,y=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,_):_;this._cache.setMaxSize(y)}handleWrapJump(r){const s=Math.round((r-(this._prevLng===void 0?r:this._prevLng))/360);if(this._prevLng=r,s){const u={};for(const d in this._tiles){const f=this._tiles[d];f.tileID=f.tileID.unwrapTo(f.tileID.wrap+s),u[f.tileID.key]=f}this._tiles=u;for(const d in this._timers)clearTimeout(this._timers[d]),delete this._timers[d];for(const d in this._tiles)this._setTileReloadTimer(+d,this._tiles[d])}}update(r,s,u,d){if(this.transform=r,!this._sourceLoaded||this._paused||this.transform.freezeTileCoverage||this.usedForTerrain&&!u)return;let f;if(this.updateCacheSize(r,s),this.transform.projection.name!=="globe"&&this.handleWrapJump(this.transform.center.lng),this._shadowCasterTiles={},this._coveredTiles={},this.used||this.usedForTerrain)if(this._source.tileID)f=r.getVisibleUnwrappedCoordinates(this._source.tileID).map(b=>new o.ap(b.canonical.z,b.wrap,b.canonical.z,b.canonical.x,b.canonical.y));else if(this.tileCoverLift!==0){const b=r.clone();b.tileCoverLift=this.tileCoverLift,f=b.coveringTiles({tileSize:s||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!u,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain}),this._source.minzoom<=1&&r.projection.name==="globe"&&(f.push(new o.ap(1,0,1,0,0)),f.push(new o.ap(1,0,1,1,0)),f.push(new o.ap(1,0,1,0,1)),f.push(new o.ap(1,0,1,1,1)))}else f=r.coveringTiles({tileSize:s||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!u,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain}),this._source.hasTile&&(f=f.filter(b=>this._source.hasTile(b)));else f=[];if(f.length>0&&this.castsShadows&&d&&this.transform.projection.name!=="globe"&&!this.usedForTerrain&&!jo(this._source.type)){const b=r.coveringZoomLevel({tileSize:s||this._source.tileSize,roundZoom:this._source.roundZoom&&!u}),T=Math.min(b,this._source.maxzoom),S=r.extendTileCoverForShadows(f,d,T);for(const A of S)this._shadowCasterTiles[A.key]=!0,f.push(A)}const _=this._updateRetainedTiles(f);if(jo(this._source.type)&&f.length!==0){const b={},T={},S=Object.keys(_);for(const C of S){const P=_[C],L=this._tiles[C];if(!L||L.fadeEndTime&&L.fadeEndTime<=o.f.now())continue;const R=this.findLoadedParent(P,Math.max(P.overscaledZ-tn.maxOverzooming,this._source.minzoom));R&&(this._addTile(R.tileID),b[R.tileID.key]=R.tileID),T[C]=P}const A=f[f.length-1].overscaledZ;for(const C in this._tiles){const P=this._tiles[C];if(_[C]||!P.hasData())continue;let L=P.tileID;for(;L.overscaledZ>A;){L=L.scaledTo(L.overscaledZ-1);const R=this._tiles[L.key];if(R&&R.hasData()&&T[L.key]){_[C]=P.tileID;break}}}for(const C in b)_[C]||(this._coveredTiles[C]=!0,_[C]=b[C])}for(const b in _)this._tiles[b].clearFadeHold();const y=o.b3(this._tiles,_);for(const b of y){const T=this._tiles[b];T.hasSymbolBuckets&&!T.holdingForFade()?T.setHoldDuration(this.map._fadeDuration):T.hasSymbolBuckets&&!T.symbolFadeFinished()||this._removeTile(+b)}this._updateLoadedParentTileCache(),this._onlySymbols&&this._source.afterUpdate&&this._source.afterUpdate()}releaseSymbolFadeTiles(){for(const r in this._tiles)this._tiles[r].holdingForFade()&&this._removeTile(+r)}_updateRetainedTiles(r){const s={};if(r.length===0)return s;const u={},d=r.reduce((T,S)=>Math.min(T,S.overscaledZ),1/0),f=r[0].overscaledZ,_=Math.max(f-tn.maxOverzooming,this._source.minzoom),y=Math.max(f+tn.maxUnderzooming,this._source.minzoom),b={};for(const T of r){const S=this._addTile(T);s[T.key]=T,S.hasData()||d<this._source.maxzoom&&(b[T.key]=T)}this._retainLoadedChildren(b,d,y,s);for(const T of r){let S=this._tiles[T.key];if(S.hasData())continue;if(T.canonical.z>=this._source.maxzoom){const C=T.children(this._source.maxzoom)[0],P=this.getTile(C);if(P&&P.hasData()){s[C.key]=C;continue}}else{const C=T.children(this._source.maxzoom);if(s[C[0].key]&&s[C[1].key]&&s[C[2].key]&&s[C[3].key])continue}let A=S.wasRequested();for(let C=T.overscaledZ-1;C>=_;--C){const P=T.scaledTo(C);if(u[P.key]||(u[P.key]=!0,S=this.getTile(P),!S&&A&&(S=this._addTile(P)),S&&(s[P.key]=P,A=S.wasRequested(),S.hasData())))break}}return s}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const r in this._tiles){const s=[];let u,d=this._tiles[r].tileID;for(;d.overscaledZ>0;){if(d.key in this._loadedParentTiles){u=this._loadedParentTiles[d.key];break}s.push(d.key);const f=d.scaledTo(d.overscaledZ-1);if(u=this._getLoadedTile(f),u)break;d=f}for(const f of s)this._loadedParentTiles[f]=u}}_addTile(r){let s=this._tiles[r.key];if(s)return s.isExtraShadowCaster!==!0||this._shadowCasterTiles[r.key]||this._reloadTile(r.key,"reloading"),s;s=this._cache.getAndRemove(r),s&&(this._setTileReloadTimer(r.key,s),s.tileID=r,this._state.initializeTileState(s,this.map?this.map.painter:null),this._cacheTimers[r.key]&&(clearTimeout(this._cacheTimers[r.key]),delete this._cacheTimers[r.key],this._setTileReloadTimer(r.key,s)));const u=!!s;if(!u){const d=this.map?this.map.painter:null,f=this._source.tileSize*r.overscaleFactor();s=this._source.type==="raster-array"?new tl(r,f,this.transform.tileZoom,d,this._isRaster):new en(r,f,this.transform.tileZoom,d,this._isRaster),this._loadTile(s,this._tileLoaded.bind(this,s,r.key,s.state))}return s?(s.uses++,this._tiles[r.key]=s,u||this._source.fire(new o.b("dataloading",{tile:s,coord:s.tileID,dataType:"source"})),s):null}_setTileReloadTimer(r,s){r in this._timers&&(clearTimeout(this._timers[r]),delete this._timers[r]);const u=s.getExpiryTimeout();u&&(this._timers[r]=setTimeout(()=>{this._reloadTile(r,"expired"),delete this._timers[r]},u))}_removeTile(r){const s=this._tiles[r];s&&(s.uses--,delete this._tiles[r],this._timers[r]&&(clearTimeout(this._timers[r]),delete this._timers[r]),s.uses>0||(s.hasData()&&s.state!=="reloading"||s.state==="empty"?this._cache.add(s.tileID,s,s.getExpiryTimeout()):(s.aborted=!0,this._abortTile(s),this._unloadTile(s))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const r in this._tiles)this._removeTile(+r);this._source._clear&&this._source._clear(),this._cache.reset(),this.map&&this.usedForTerrain&&this.map.painter.terrain&&this.map.painter.terrain.resetTileLookupCache(this.id)}tilesIn(r,s,u){const d=[],f=this.transform;if(!f)return d;const _=f.projection.name==="globe",y=o.a8(f.center.lng);for(const b in this._tiles){const T=this._tiles[b];if(u&&T.clearQueryDebugViz(),T.holdingForFade())continue;let S;if(_){const A=T.tileID.canonical;if(A.z===0){const C=[Math.abs(o.ad(y,...Cn(A,-1))-y),Math.abs(o.ad(y,...Cn(A,1))-y)];S=[0,2*C.indexOf(Math.min(...C))-1]}else{const C=[Math.abs(o.ad(y,...Cn(A,-1))-y),Math.abs(o.ad(y,...Cn(A,0))-y),Math.abs(o.ad(y,...Cn(A,1))-y)];S=[C.indexOf(Math.min(...C))-1]}}else S=[0];for(const A of S){const C=r.containsTile(T,f,s,A);C&&d.push(C)}}return d}getShadowCasterCoordinates(){return this._getRenderableCoordinates(!1,!0)}getVisibleCoordinates(r){return this._getRenderableCoordinates(r)}_getRenderableCoordinates(r,s){const u=this.getRenderableIds(r,s).map(f=>this._tiles[f].tileID),d=this.transform.projection.name==="globe";for(const f of u)f.projMatrix=this.transform.calculateProjMatrix(f.toUnwrapped()),f.expandedProjMatrix=d?this.transform.calculateProjMatrix(f.toUnwrapped(),!1,!0):f.projMatrix;return u}sortCoordinatesByDistance(r){const s=r.slice(),u=this.transform._camera.position,d=this.transform._camera.forward(),f={};for(const _ of s){const y=1/(1<<_.canonical.z);f[_.key]=((_.canonical.x+.5)*y+_.wrap-u[0])*d[0]+((_.canonical.y+.5)*y-u[1])*d[1]-u[2]*d[2]}return s.sort((_,y)=>f[_.key]-f[y.key]),s}hasTransition(){if(this._source.hasTransition())return!0;if(jo(this._source.type))for(const r in this._tiles){const s=this._tiles[r];if(s.fadeEndTime!==void 0&&s.fadeEndTime>=o.f.now())return!0}return!1}setFeatureState(r,s,u){this._state.updateState(r=r||"_geojsonTileLayer",s,u)}removeFeatureState(r,s,u){this._state.removeFeatureState(r=r||"_geojsonTileLayer",s,u)}getFeatureState(r,s){return this._state.getState(r=r||"_geojsonTileLayer",s)}setDependencies(r,s,u){const d=this._tiles[r];d&&d.setDependencies(s,u)}reloadTilesForDependencies(r,s){for(const u in this._tiles)this._tiles[u].hasDependency(r,s)&&this._reloadTile(+u,"reloading");this._cache.filter(u=>!u.hasDependency(r,s))}_preloadTiles(r,s){if(!this._sourceLoaded){const b=()=>{this._sourceLoaded&&(this._source.off("data",b),this._preloadTiles(r,s))};return void this._source.on("data",b)}const u=new Map,d=Array.isArray(r)?r:[r],f=this.map.painter.terrain,_=this.usedForTerrain&&f?f.getScaledDemTileSize():this._source.tileSize;for(const b of d){const T=b.coveringTiles({tileSize:_,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!this.usedForTerrain,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain});for(const S of T)u.set(S.key,S);this.usedForTerrain&&b.updateElevation(!1)}const y=Array.from(u.values());o.b4(y,(b,T)=>{const S=new en(b,this._source.tileSize*b.overscaleFactor(),this.transform.tileZoom,this.map.painter,this._isRaster);this._loadTile(S,A=>{this._source.type==="raster-dem"&&S.dem&&this._backfillDEM(S),T(A,S)})},s)}}function kt(c,r){const s=Math.abs(2*c.wrap)-+(c.wrap<0),u=Math.abs(2*r.wrap)-+(r.wrap<0);return c.overscaledZ-r.overscaledZ||u-s||r.canonical.y-c.canonical.y||r.canonical.x-c.canonical.x}function jo(c){return c==="raster"||c==="image"||c==="video"||c==="custom"}function Cn(c,r){const s=1<<c.z;return[c.x/s+r,(c.x+1)/s+r]}tn.maxOverzooming=10,tn.maxUnderzooming=3;class Ac{constructor(r){this.style=r,this.layersGotHidden=!1,this.layers=[]}processLayersChanged(){this.layers=[];const r=!1,s=!1;for(const u in this.style._mergedLayers){const d=this.style._mergedLayers[u];if(d.type==="fill-extrusion")this.layers.push({layer:d,visible:r,visibilityChanged:s});else if(d.type==="model"){const f=this.style.getLayerSource(d);f&&f.type==="batched-model"&&this.layers.push({layer:d,visible:r,visibilityChanged:s})}}}onNewFrame(r){this.layersGotHidden=!1;for(const s of this.layers){const u=s.layer;let d=!1;u.type==="fill-extrusion"?d=!u.isHidden(r)&&u.paint.get("fill-extrusion-opacity")>0:u.type==="model"&&(d=!u.isHidden(r)&&u.paint.get("model-opacity")>0),this.layersGotHidden=this.layersGotHidden||!d&&s.visible,s.visible=d}}updateZOffset(r,s){this.currentBuildingBuckets=[];for(const d of this.layers){const f=d.layer,_=this.style.getLayerSourceCache(f);let y=1;f.type==="fill-extrusion"&&(y=d.visible?f.paint.get("fill-extrusion-vertical-scale"):0);let b=_?_.getTile(s):null;if(!b&&_&&s.canonical.z>_.getSource().minzoom){let T=s.scaledTo(Math.min(_.getSource().maxzoom,s.overscaledZ-1));for(;T.overscaledZ>=_.getSource().minzoom&&(b=_.getTile(T),!b&&T.overscaledZ!==0);)T=T.scaledTo(T.overscaledZ-1)}this.currentBuildingBuckets.push({bucket:b?b.getBucket(f):null,tileID:b?b.tileID:s,verticalScale:y})}r.hasAnyZOffset=!1;let u=!1;for(let d=0;d<r.symbolInstances.length;d++){const f=r.symbolInstances.get(d),_=f.zOffset,y=this._getHeightAtTileOffset(s,f.tileAnchorX,f.tileAnchorY);f.zOffset=y!==Number.NEGATIVE_INFINITY?y:_,u||_===f.zOffset||(u=!0),r.hasAnyZOffset||f.zOffset===0||(r.hasAnyZOffset=!0)}u&&(r.zOffsetBuffersNeedUpload=!0,r.zOffsetSortDirty=!0)}_mapCoordToOverlappingTile(r,s,u,d){let f=s,_=u;if(r.canonical.z!==d.canonical.z){const y=d.canonical,b=1/(1<<r.canonical.z-y.z);
14f=(s+r.canonical.x*o.Y)*b-y.x*o.Y|0,_=(u+r.canonical.y*o.Y)*b-y.y*o.Y|0}return{tileX:f,tileY:_}}_getHeightAtTileOffset(r,s,u){let d,f;for(let _=0;_<this.layers.length;++_){if(this.layers[_].layer.type!=="fill-extrusion")continue;const{bucket:y,tileID:b,verticalScale:T}=this.currentBuildingBuckets[_];if(!y)continue;const{tileX:S,tileY:A}=this._mapCoordToOverlappingTile(r,s,u,b),C=y.getHeightAtTileCoord(S,A);C&&C.height!==void 0&&(C.hidden?d=C.height:f=Math.max(C.height*T,f||0))}if(f!==void 0)return f;for(let _=0;_<this.layers.length;++_){const y=this.layers[_];if(y.layer.type!=="model"||!y.visible)continue;const{bucket:b,tileID:T}=this.currentBuildingBuckets[_];if(!b)continue;const{tileX:S,tileY:A}=this._mapCoordToOverlappingTile(r,s,u,T),C=b.getHeightAtTileCoord(S,A);if(C&&!C.hidden)return C.height===void 0&&d!==void 0?Math.min(C.maxHeight,d)*C.verticalScale:C.height?C.height*C.verticalScale:Number.NEGATIVE_INFINITY}return this.layersGotHidden?0:Number.NEGATIVE_INFINITY}}function Gr(c,r){const s={};for(const u in c)u!=="ref"&&(s[u]=c[u]);return o.b5.forEach(u=>{u in r&&(s[u]=r[u])}),s}function yh(c){c=c.slice();const r=Object.create(null);for(let s=0;s<c.length;s++)r[c[s].id]=c[s];for(let s=0;s<c.length;s++)"ref"in c[s]&&(c[s]=Gr(c[s],r[c[s].ref]));return c}const Qt={setStyle:"setStyle",addLayer:"addLayer",removeLayer:"removeLayer",setPaintProperty:"setPaintProperty",setLayoutProperty:"setLayoutProperty",setSlot:"setSlot",setFilter:"setFilter",addSource:"addSource",removeSource:"removeSource",setGeoJSONSourceData:"setGeoJSONSourceData",setLayerZoomRange:"setLayerZoomRange",setLayerProperty:"setLayerProperty",setCenter:"setCenter",setZoom:"setZoom",setBearing:"setBearing",setPitch:"setPitch",setSprite:"setSprite",setGlyphs:"setGlyphs",setTransition:"setTransition",setLight:"setLight",setTerrain:"setTerrain",setFog:"setFog",setCamera:"setCamera",setLights:"setLights",setProjection:"setProjection",addImport:"addImport",removeImport:"removeImport",updateImport:"updateImport"};function il(c,r,s){s.push({command:Qt.addSource,args:[c,r[c]]})}function Ic(c,r,s){r.push({command:Qt.removeSource,args:[c]}),s[c]=!0}function xh(c,r,s,u){Ic(c,s,u),il(c,r,s)}function Cc(c,r,s){let u;for(u in c[s])if(c[s].hasOwnProperty(u)&&u!=="data"&&!At(c[s][u],r[s][u]))return!1;for(u in r[s])if(r[s].hasOwnProperty(u)&&u!=="data"&&!At(c[s][u],r[s][u]))return!1;return!0}function _s(c,r,s,u,d,f){let _;for(_ in r=r||{},c=c||{})c.hasOwnProperty(_)&&(At(c[_],r[_])||s.push({command:f,args:[u,_,r[_],d]}));for(_ in r)r.hasOwnProperty(_)&&!c.hasOwnProperty(_)&&(At(c[_],r[_])||s.push({command:f,args:[u,_,r[_],d]}))}function $s(c){return c.id}function Go(c,r){return c[r.id]=r,c}class Pn{constructor(r,s){this.reset(r,s)}reset(r,s){this.points=r||[],this._distances=[0];for(let u=1;u<this.points.length;u++)this._distances[u]=this._distances[u-1]+this.points[u].dist(this.points[u-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(s||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(r){if(this.points.length===1)return this.points[0];r=o.ad(r,0,1);let s=1,u=this._distances[s];const d=r*this.paddedLength+this.padding;for(;u<d&&s<this._distances.length;)u=this._distances[++s];const f=s-1,_=this._distances[f],y=u-_,b=y>0?(d-_)/y:0;return this.points[f].mult(1-b).add(this.points[s].mult(b))}}class Pc{constructor(r,s,u){const d=this.boxCells=[],f=this.circleCells=[];this.xCellCount=Math.ceil(r/u),this.yCellCount=Math.ceil(s/u);for(let _=0;_<this.xCellCount*this.yCellCount;_++)d.push([]),f.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=r,this.height=s,this.xScale=this.xCellCount/r,this.yScale=this.yCellCount/s,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(r,s,u,d,f){this._forEachCell(s,u,d,f,this._insertBoxCell,this.boxUid++),this.boxKeys.push(r),this.bboxes.push(s),this.bboxes.push(u),this.bboxes.push(d),this.bboxes.push(f)}
vendor: 1,322 bytes, line 14
14insertCircle(r,s,u,d){this._forEachCell(s-d,u-d,s+d,u+d,this._insertCircleCell,this.circleUid++),this.circleKeys.push(r),this.circles.push(s),this.circles.push(u),this.circles.push(d)}_insertBoxCell(r,s,u,d,f,_){this.boxCells[f].push(_)}_insertCircleCell(r,s,u,d,f,_){this.circleCells[f].push(_)}_query(r,s,u,d,f,_){if(u<0||r>this.width||d<0||s>this.height)return!f&&[];const y=[];if(r<=0&&s<=0&&this.width<=u&&this.height<=d){if(f)return!0;for(let b=0;b<this.boxKeys.length;b++)y.push({key:this.boxKeys[b],x1:this.bboxes[4*b],y1:this.bboxes[4*b+1],x2:this.bboxes[4*b+2],y2:this.bboxes[4*b+3]});for(let b=0;b<this.circleKeys.length;b++){const T=this.circles[3*b],S=this.circles[3*b+1],A=this.circles[3*b+2];y.push({key:this.circleKeys[b],x1:T-A,y1:S-A,x2:T+A,y2:S+A})}return _?y.filter(_):y}return this._forEachCell(r,s,u,d,this._queryCell,y,{hitTest:f,seenUids:{box:{},circle:{}}},_),f?y.length>0:y}_queryCircle(r,s,u,d,f){const _=r-u,y=r+u,b=s-u,T=s+u;if(y<0||_>this.width||T<0||b>this.height)return!d&&[];const S=[];return this._forEachCell(_,b,y,T,this._queryCellCircle,S,{hitTest:d,circle:{x:r,y:s,radius:u},seenUids:{box:{},circle:{}}},f),d?S.length>0:S}query(r,s,u,d,f){return this._query(r,s,u,d,!1,f)}hitTest(r,s,u,d,f){return this._query(r,s,u,d,!0,f)}hitTestCircle(r,s,u,d){return this._queryCircle(r,s,u,!0,d)}
14_queryCell(r,s,u,d,f,_,y,b){const T=y.seenUids,S=this.boxCells[f];if(S!==null){const C=this.bboxes;for(const P of S)if(!T.box[P]){T.box[P]=!0;const L=4*P;if(r<=C[L+2]&&s<=C[L+3]&&u>=C[L+0]&&d>=C[L+1]&&(!b||b(this.boxKeys[P]))){if(y.hitTest)return _.push(!0),!0;_.push({key:this.boxKeys[P],x1:C[L],y1:C[L+1],x2:C[L+2],y2:C[L+3]})}}}const A=this.circleCells[f];if(A!==null){const C=this.circles;for(const P of A)if(!T.circle[P]){T.circle[P]=!0;const L=3*P;if(this._circleAndRectCollide(C[L],C[L+1],C[L+2],r,s,u,d)&&(!b||b(this.circleKeys[P]))){if(y.hitTest)return _.push(!0),!0;{const R=C[L],k=C[L+1],O=C[L+2];_.push({key:this.circleKeys[P],x1:R-O,y1:k-O,x2:R+O,y2:k+O})}}}}}_queryCellCircle(r,s,u,d,f,_,y,b){const T=y.circle,S=y.seenUids,A=this.boxCells[f];if(A!==null){const P=this.bboxes;for(const L of A)if(!S.box[L]){S.box[L]=!0;const R=4*L;if(this._circleAndRectCollide(T.x,T.y,T.radius,P[R+0],P[R+1],P[R+2],P[R+3])&&(!b||b(this.boxKeys[L])))return _.push(!0),!0}}const C=this.circleCells[f];if(C!==null){const P=this.circles;for(const L of C)if(!S.circle[L]){S.circle[L]=!0;const R=3*L;if(this._circlesCollide(P[R],P[R+1],P[R+2],T.x,T.y,T.radius)&&(!b||b(this.circleKeys[L])))return _.push(!0),!0}}}_forEachCell(r,s,u,d,f,_,y,b){const T=this._convertToXCellCoord(r),S=this._convertToYCellCoord(s),A=this._convertToXCellCoord(u),C=this._convertToYCellCoord(d);for(let P=T;P<=A;P++)for(let L=S;L<=C;L++)if(f.call(this,r,s,u,d,this.xCellCount*L+P,_,y,b))return}_convertToXCellCoord(r){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(r*this.xScale)))}_convertToYCellCoord(r){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(r*this.yScale)))}_circlesCollide(r,s,u,d,f,_){const y=d-r,b=f-s,T=u+_;return T*T>y*y+b*b}_circleAndRectCollide(r,s,u,d,f,_,y){const b=(_-d)/2,T=Math.abs(r-(d+b));if(T>b+u)return!1;const S=(y-f)/2,A=Math.abs(s-(f+S));if(A>S+u)return!1;if(T<=b||A<=S)return!0;const C=T-b,P=A-S;return C*C+P*P<=u*u}}const Ci={unknown:0,flipRequired:1,flipNotRequired:2},Hn=Math.tan(85*Math.PI/180);function qo(c,r,s,u,d,f,_){const y=o.a9.create();if(s)if(f.name==="globe"){const b=o.b6(d,r);o.a9.multiply(y,y,b)}else{const b=o.b7.invert([],_);y[0]=b[0],y[1]=b[1],y[4]=b[2],y[5]=b[3],u||o.a9.rotateZ(y,y,d.angle)}else o.a9.multiply(y,d.labelPlaneMatrix,c);return y}function Zo(c,r,s,u,d,f,_){const y=qo(c,r,s,u,d,f,_);return f.name==="globe"&&s||(y[2]=y[6]=y[10]=y[14]=0),y}function zn(c,r,s,u,d,f,_){if(s){if(f.name==="globe"){const y=qo(c,r,s,u,d,f,_);return o.a9.invert(y,y),o.a9.multiply(y,c,y),y}{const y=o.a9.clone(c),b=o.a9.identity([]);return b[0]=_[0],b[1]=_[1],b[4]=_[2],b[5]=_[3],o.a9.multiply(y,y,b),u||o.a9.rotateZ(y,y,-d.angle),y}}return d.glCoordMatrix}function kr(c,r,s,u){const d=[c,r,s,1];s?o.aa.transformMat4(d,d,u):Dc(d,d,u);const f=d[3];return d[0]/=f,d[1]/=f,d[2]/=f,d}function rl(c,r){return Math.min(.5+c/r*.5,1.5)}function nl(c,r){const s=c[0]/c[3],u=c[1]/c[3];return s>=-r[0]&&s<=r[0]&&u>=-r[1]&&u<=r[1]}function sl(c,r,s,u,d,f,_,y,b,T){const S=s.transform,A=u?c.textSizeData:c.iconSizeData,C=o.b8(A,s.transform.zoom),P=S.projection.name==="globe",L=[256/s.width*2+1,256/s.height*2+1],R=u?c.text.dynamicLayoutVertexArray:c.icon.dynamicLayoutVertexArray;R.clear();let k=null;P&&(k=u?c.text.globeExtVertexArray:c.icon.globeExtVertexArray);const O=c.lineVertexArray,N=u?c.text.placedSymbolArray:c.icon.placedSymbolArray,$=s.transform.width/s.transform.height;let Z,Q=!1;for(let B=0;B<N.length;B++){const U=N.get(B),{numGlyphs:K,writingMode:Y}=U;if(Y!==o.b9.vertical||Q||Z===o.b9.horizontal||(Q=!0),Z=Y,(U.hidden||Y===o.b9.vertical)&&!Q){ys(K,R);continue}Q=!1;const re=new o.P(U.tileAnchorX,U.tileAnchorY);let{x:he,y:ie,z:ce}=S.projection.projectTilePoint(re.x,re.y,T.canonical);if(b){const[Ge,Xe,nt]=b(re);he+=Ge,ie+=Xe,ce+=nt}const pe=[he,ie,ce,1];if(o.aa.transformMat4(pe,pe,r),!nl(pe,L)){ys(K,R);continue}const te=pe[3],ae=rl(s.transform.getCameraToCenterDistance(S.projection),te),Me=o.ba(A,C,U),se=_?Me/ae:Me*ae,ue=kr(he,ie,ce,d);if(ue[3]<=0){ys(K,R);continue}let de={};const W=_?null:b,xe=Ws(U,se,!1,y,r,d,f,c.glyphOffsetArray,O,R,k,ue,re,de,$,W,S.projection,T,_);Q=xe.useVertical,W&&xe.needsFlipping&&(de={}),(xe.notEnoughRoom||Q||xe.needsFlipping&&Ws(U,se,!0,y,r,d,f,c.glyphOffsetArray,O,R,k,ue,re,de,$,W,S.projection,T,_).notEnoughRoom)&&ys(K,R)}u?(c.text.dynamicLayoutVertexBuffer.updateData(R),k&&c.text.globeExtVertexBuffer&&c.text.globeExtVertexBuffer.updateData(k)):(c.icon.dynamicLayoutVertexBuffer.updateData(R),k&&c.icon.globeExtVertexBuffer&&c.icon.globeExtVertexBuffer.updateData(k))}function $o(c,r,s,u,d,f,_,y,b,T,S,A,C,P,L,R){const{lineStartIndex:k,glyphStartIndex:O,segment:N}=y,$=O+y.numGlyphs,Z=k+y.lineLength,Q=r.getoffsetX(O),B=r.getoffsetX($-1),U=gs(c*Q,s,u,d,f,_,N,k,Z,b,T,S,A,C,!0,P,L,R);if(!U)return null;const K=gs(c*B,s,u,d,f,_,N,k,Z,b,T,S,A,C,!0,P,L,R);return K?{first:U,last:K}:null}function Xn(c,r,s,u){return c===o.b9.horizontal&&Math.abs(u)>Math.abs(s)?{useVertical:!0}:c===o.b9.vertical?u>0?{needsFlipping:!0}:null:r!==Ci.unknown&&function(d,f){return d===0||Math.abs(f/d)>Hn}(s,u)?r===Ci.flipRequired?{needsFlipping:!0}:null:s<0?{needsFlipping:!0}:null}function Ws(c,r,s,u,d,f,_,y,b,T,S,A,C,P,L,R,k,O,N){const $=r/24,Z=c.lineOffsetX*$,Q=c.lineOffsetY*$,{lineStartIndex:B,glyphStartIndex:U,numGlyphs:K,segment:Y,writingMode:re,flipState:he}
14=c,ie=B+c.lineLength,ce=pe=>{if(S){const[se,ue,de]=pe.up,W=T.length;o.bb(S,W+0,se,ue,de),o.bb(S,W+1,se,ue,de),o.bb(S,W+2,se,ue,de),o.bb(S,W+3,se,ue,de)}const[te,ae,Me]=pe.point;o.bc(T,te,ae,Me,pe.angle)};if(K>1){const pe=$o($,y,Z,Q,s,A,C,c,b,f,P,R,!1,k,O,N);if(!pe)return{notEnoughRoom:!0};if(u&&!s){let[te,ae,Me]=pe.first.point,[se,ue,de]=pe.last.point;[te,ae]=kr(te,ae,Me,_),[se,ue]=kr(se,ue,de,_);const W=Xn(re,he,(se-te)*L,ue-ae);if(c.flipState=W&&W.needsFlipping?Ci.flipRequired:Ci.flipNotRequired,W)return W}ce(pe.first);for(let te=U+1;te<U+K-1;te++){const ae=gs($*y.getoffsetX(te),Z,Q,s,A,C,Y,B,ie,b,f,P,R,!1,!1,k,O,N);if(!ae)return T.length-=4*(te-U),{notEnoughRoom:!0};ce(ae)}ce(pe.last)}else{if(u&&!s){const te=kr(C.x,C.y,0,d),ae=B+Y+1,Me=new o.P(b.getx(ae),b.gety(ae)),se=kr(Me.x,Me.y,0,d),ue=se[3]>0?se:zc(C,Me,te,1,d,void 0,k,O.canonical),de=Xn(re,he,(ue[0]-te[0])*L,ue[1]-te[1]);if(c.flipState=de&&de.needsFlipping?Ci.flipRequired:Ci.flipNotRequired,de)return de}const pe=gs($*y.getoffsetX(U),Z,Q,s,A,C,Y,B,ie,b,f,P,R,!1,!1,k,O,N);if(!pe)return{notEnoughRoom:!0};ce(pe)}return{}}function ol(c,r,s,u,d){const{x:f,y:_,z:y}=u.projectTilePoint(c.x,c.y,r);if(!d)return kr(f,_,y,s);const[b,T,S]=d(c);return kr(f+b,_+T,y+S,s)}function zc(c,r,s,u,d,f,_,y){const b=ol(c.sub(r)._unit()._add(c),y,d,_,f);return o.Q.sub(b,s,b),o.Q.normalize(b,b),o.Q.scaleAndAdd(b,s,b,u)}function gs(c,r,s,u,d,f,_,y,b,T,S,A,C,P,L,R,k,O){const N=u?c-r:c+r;let $=N>0?1:-1,Z=0;u&&($*=-1,Z=Math.PI),$<0&&(Z+=Math.PI);let Q=y+_+($>0?0:1)|0,B=d,U=d,K=0,Y=0;const re=Math.abs(N),he=[],ie=[];let ce=f,pe=ce;const te=()=>zc(pe,ce,U,re-K+1,S,C,R,k.canonical);for(;K+Y<=re;){if(Q+=$,Q<y||Q>=b)return null;if(U=B,pe=ce,he.push(U),P&&ie.push(pe),ce=new o.P(T.getx(Q),T.gety(Q)),B=A[Q],!B){const Xe=ol(ce,k.canonical,S,R,C);B=Xe[3]>0?A[Q]=Xe:te()}K+=Y,Y=o.Q.distance(U,B)}L&&C&&(A[Q]&&(B=te(),Y=o.Q.distance(U,B)),A[Q]=B);const ae=(re-K)/Y,Me=ce.sub(pe)._mult(ae)._add(pe),se=o.Q.sub([],B,U),ue=o.Q.scaleAndAdd([],U,se,ae);let de=[0,0,1],W=se[0],xe=se[1];if(O&&(de=R.upVector(k.canonical,Me.x,Me.y),de[0]!==0||de[1]!==0||de[2]!==1)){const Xe=[de[2],0,-de[0]],nt=o.Q.cross([],de,Xe);o.Q.normalize(Xe,Xe),o.Q.normalize(nt,nt),W=o.Q.dot(se,Xe),xe=o.Q.dot(se,nt)}if(s){const Xe=o.Q.cross([],de,se);o.Q.normalize(Xe,Xe),o.Q.scaleAndAdd(ue,ue,Xe,s*$)}const Ge=Z+Math.atan2(xe,W);return he.push(ue),P&&ie.push(Me),{point:ue,angle:Ge,path:he,tilePath:ie,up:de}}function ys(c,r){const s=r.length,u=s+4*c;r.resize(u),r.float32.fill(-1/0,4*s,4*u)}function Dc(c,r,s){const u=r[0],d=r[1];return c[0]=s[0]*u+s[4]*d+s[12],c[1]=s[1]*u+s[5]*d+s[13],c[3]=s[3]*u+s[7]*d+s[15],c}const rn=100;class vh{constructor(r,s,u=new Pc(r.width+200,r.height+200,25),d=new Pc(r.width+200,r.height+200,25)){this.transform=r,this.grid=u,this.ignoredGrid=d,this.pitchfactor=Math.cos(r._pitch)*r.cameraToCenterDistance,this.screenRightBoundary=r.width+rn,this.screenBottomBoundary=r.height+rn,this.gridRightBoundary=r.width+200,this.gridBottomBoundary=r.height+200,this.fogState=s}placeCollisionBox(r,s,u,d,f,_,y,b){let T=u.projectedAnchorX,S=u.projectedAnchorY,A=u.projectedAnchorZ;const C=u.elevation,P=u.tileID,L=r.getProjection();if(C&&P){const[B,U,K]=L.upVector(P.canonical,u.tileAnchorX,u.tileAnchorY),Y=L.upVectorScale(P.canonical,this.transform.center.lat,this.transform.worldSize).metersToTile;T+=B*C*Y,S+=U*C*Y,A+=K*C*Y}const R=this.projectAndGetPerspectiveRatio(y,T,S,A,u.tileID,L.name==="globe"||!!C||this.transform.pitch>0,L),k=_*R.perspectiveRatio,O=(u.x1*s+d.x-u.padding)*k+R.point.x,N=(u.y1*s+d.y-u.padding)*k+R.point.y,$=(u.x2*s+d.x+u.padding)*k+R.point.x,Z=(u.y2*s+d.y+u.padding)*k+R.point.y,Q=R.perspectiveRatio<=.55||R.occluded;return!this.isInsideGrid(O,N,$,Z)||!f&&this.grid.hitTest(O,N,$,Z,b)||Q?{box:[],offscreen:!1,occluded:R.occluded}:{box:[O,N,$,Z],offscreen:this.isOffscreen(O,N,$,Z),occluded:!1}}placeCollisionCircles(r,s,u,d,f,_,y,b,T,S,A,C,P,L,R){const k=[],O=this.transform.elevation,N=r.getProjection(),$=O?O.getAtTileOffsetFunc(R,this.transform.center.lat,this.transform.worldSize,N):null,Z=new o.P(u.tileAnchorX,u.tileAnchorY);let{x:Q,y:B,z:U}=N.projectTilePoint(Z.x,Z.y,R.canonical);if($){const[Me,se,ue]=$(Z);Q+=Me,B+=se,U+=ue}const K=N.name==="globe",Y=this.projectAndGetPerspectiveRatio(y,Q,B,U,R,K||!!O||this.transform.pitch>0,N),{perspectiveRatio:re}=Y,he=(A?_/re:_*re)/o.bf,ie=kr(Q,B,U,b),ce=Y.signedDistanceFromCamera>0?$o(he,f,u.lineOffsetX*he,u.lineOffsetY*he,!1,ie,Z,u,d,b,{},O&&!A?$:null,A&&!!O,N,R,A):null;let pe=!1,te=!1,ae=!0;if(ce&&!Y.occluded){const Me=.5*P*re+L,se=new o.P(-100,-100),ue=new o.P(this.screenRightBoundary,this.screenBottomBoundary),de=new P
vendor: 5,401 bytes, line 14
14n,{first:W,last:xe}=ce,Ge=W.path.length;let Xe=[];for(let at=Ge-1;at>=1;at--)Xe.push(W.path[at]);for(let at=1;at<xe.path.length;at++)Xe.push(xe.path[at]);const nt=2.5*Me;T&&(Xe=Xe.map(([at,Ot,gt],Vt)=>($&&!K&&(gt=$(Vt<Ge-1?W.tilePath[Ge-1-Vt]:xe.tilePath[Vt-Ge+2])[2]),kr(at,Ot,gt,T))),Xe.some(at=>at[3]<=0)&&(Xe=[]));let et=[];if(Xe.length>0){let at=1/0,Ot=-1/0,gt=1/0,Vt=-1/0;for(const Bt of Xe)at=Math.min(at,Bt[0]),gt=Math.min(gt,Bt[1]),Ot=Math.max(Ot,Bt[0]),Vt=Math.max(Vt,Bt[1]);Ot>=se.x&&at<=ue.x&&Vt>=se.y&&gt<=ue.y&&(et=[Xe.map(Bt=>new o.P(Bt[0],Bt[1]))],(at<se.x||Ot>ue.x||gt<se.y||Vt>ue.y)&&(et=o.bd(et,se.x,se.y,ue.x,ue.y)))}for(const at of et){de.reset(at,.25*Me);let Ot=0;Ot=de.length<=.5*Me?1:Math.ceil(de.paddedLength/nt)+1;for(let gt=0;gt<Ot;gt++){const Vt=gt/Math.max(Ot-1,1),Bt=de.lerp(Vt),bi=Bt.x+rn,ii=Bt.y+rn;k.push(bi,ii,Me,0);const qi=bi-Me,Bi=ii-Me,ui=bi+Me,ri=ii+Me;if(ae=ae&&this.isOffscreen(qi,Bi,ui,ri),te=te||this.isInsideGrid(qi,Bi,ui,ri),!s&&this.grid.hitTestCircle(bi,ii,Me,C)&&(pe=!0,!S))return{circles:[],offscreen:!1,collisionDetected:pe,occluded:!1}}}}return{circles:!S&&pe||!te?[]:k,offscreen:ae,collisionDetected:pe,occluded:Y.occluded}}queryRenderedSymbols(r){if(r.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const s=[];let u=1/0,d=1/0,f=-1/0,_=-1/0;for(const S of r){const A=new o.P(S.x+rn,S.y+rn);u=Math.min(u,A.x),d=Math.min(d,A.y),f=Math.max(f,A.x),_=Math.max(_,A.y),s.push(A)}const y=this.grid.query(u,d,f,_).concat(this.ignoredGrid.query(u,d,f,_)),b={},T={};for(const S of y){const A=S.key;if(b[A.bucketInstanceId]===void 0&&(b[A.bucketInstanceId]={}),b[A.bucketInstanceId][A.featureIndex])continue;const C=[new o.P(S.x1,S.y1),new o.P(S.x2,S.y1),new o.P(S.x2,S.y2),new o.P(S.x1,S.y2)];o.be(s,C)&&(b[A.bucketInstanceId][A.featureIndex]=!0,T[A.bucketInstanceId]===void 0&&(T[A.bucketInstanceId]=[]),T[A.bucketInstanceId].push(A.featureIndex))}return T}insertCollisionBox(r,s,u,d,f){(s?this.ignoredGrid:this.grid).insert({bucketInstanceId:u,featureIndex:d,collisionGroupID:f},r[0],r[1],r[2],r[3])}insertCollisionCircles(r,s,u,d,f){const _=s?this.ignoredGrid:this.grid,y={bucketInstanceId:u,featureIndex:d,collisionGroupID:f};for(let b=0;b<r.length;b+=4)_.insertCircle(y,r[b],r[b+1],r[b+2])}projectAndGetPerspectiveRatio(r,s,u,d,f,_,y){const b=[s,u,d,1];let T=!1;d||this.transform.pitch>0?(o.aa.transformMat4(b,b,r),this.fogState&&f&&y.name!=="globe"&&(T=function(C,P,L,R,k,O){const N=O.calculateFogTileMatrix(k),$=[P,L,R];return o.Q.transformMat4($,$,N),ei(C,o.Q.length($),O.pitch,O._fov)}(this.fogState,s,u,d,f.toUnwrapped(),this.transform)>.9)):Dc(b,b,r);const S=b[3];return{point:new o.P((b[0]/S+1)/2*this.transform.width+rn,(-b[1]/S+1)/2*this.transform.height+rn),perspectiveRatio:Math.min(.5+this.transform.getCameraToCenterDistance(y)/S*.5,1.5),signedDistanceFromCamera:S,occluded:_&&b[2]>S||T}}isOffscreen(r,s,u,d){return u<rn||r>=this.screenRightBoundary||d<rn||s>this.screenBottomBoundary}isInsideGrid(r,s,u,d){return u>=0&&r<this.gridRightBoundary&&d>=0&&s<this.gridBottomBoundary}getViewportMatrix(){const r=o.a9.identity([]);return o.a9.translate(r,r,[-100,-100,0]),r}}function al(c,r,s){const u=r.createTileMatrix(c,c.worldSize,s.toUnwrapped());return o.a9.multiply(new Float32Array(16),c.projMatrix,u)}function _n(c,r,s){if(r.projection.name===s.projection.name)return c.projMatrix;const u=s.clone();return u.setProjection(r.projection),al(u,r.getProjection(),c)}function ll(c,r,s){return r.name===s.projection.name?c.projMatrix:al(s,r,c)}class cl{constructor(r,s,u,d){this.opacity=r?Math.max(0,Math.min(1,r.opacity+(r.placed?s:-s))):d&&u?1:0,this.placed=u}isHidden(){return this.opacity===0&&!this.placed}}class Qs{constructor(r,s,u,d,f,_=!1){this.text=new cl(r?r.text:null,s,u,f),this.icon=new cl(r?r.icon:null,s,d,f),this.clipped=_}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class ul{constructor(r,s,u,d=!1){this.text=r,this.icon=s,this.skipFade=u,this.clipped=d}}class bh{constructor(){this.invProjMatrix=o.a9.create(),this.viewportMatrix=o.a9.create(),this.circles=[]}}class Dn{constructor(r,s,u,d,f){this.bucketInstanceId=r,this.featureIndex=s,this.sourceLayerIndex=u,this.bucketIndex=d,this.tileID=f}}class hl{constructor(r){this.crossSourceCollisions=r,this.maxGroupID=0,this.collisionGroups={}}get(r){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[r]){const s=++this.maxGroupID;this.collisionGroups[r]={ID:s,predicate:u=>u.collisionGroupID===s}}return this.collisionGroups[r]}}function Rc(c,r,s,u,d){const{horizontalAlign:f,verticalAlign:_}=o.bi(c),y=-(f-.5)*r,b=-(_-.5)*s,T=o.bh(c,u);return new o.P(y+T[0]*d,b+T[1]*d)}function Hs(c,r,s,u,d){const f=new o.P(c,r);return s&&f._rotate(u?d:-d),f}class Lc{constructor(r,s,u,d,f,_){this.transform=r.clone(),this.projection=r.projection.name,this.collisionIndex=new vh(this.transform,f),this.buildingIndex=_,this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=s,this.retainedQueryData={},this.collisionGroups=new hl(u),this.collisionCircleArrays={},this.prevPlacement=d,d&&(d.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(r,s,u,d){const f=u.getBucket(s),_=u.latestFeatureIndex;if(!f||!_||s.fqid!==f.layerIds[0])return;const y=f.layers[0].layout,b=u.collisionBoxArray,T=Math.pow(2,this.transform.zoom-u.tileID.overscaledZ
14),S=u.tileSize/o.Y,A=u.tileID.toUnwrapped();this.transform.setProjection(f.projection);const C=(P=u.tileID,L=f.getProjection(),R=this.transform,L.name===this.projection?R.calculateProjMatrix(P.toUnwrapped()):al(R,L,P));var P,L,R;const k=y.get("text-pitch-alignment")==="map",O=y.get("text-rotation-alignment")==="map";s.compileFilter();const N=s.dynamicFilter(),$=s.dynamicFilterNeedsFeature(),Z=this.transform.calculatePixelsToTileUnitsMatrix(u),Q=Zo(C,u.tileID.canonical,k,O,this.transform,f.getProjection(),Z);let B=null;if(k){const Y=zn(C,u.tileID.canonical,k,O,this.transform,f.getProjection(),Z);B=o.a9.multiply([],this.transform.labelPlaneMatrix,Y)}let U=null;N&&u.latestFeatureIndex&&(U={unwrappedTileID:A,dynamicFilter:N,dynamicFilterNeedsFeature:$,featureIndex:u.latestFeatureIndex}),this.retainedQueryData[f.bucketInstanceId]=new Dn(f.bucketInstanceId,_,f.sourceLayerIndex,f.index,u.tileID);const K={bucket:f,layout:y,posMatrix:C,textLabelPlaneMatrix:Q,labelToScreenMatrix:B,clippingData:U,scale:T,textPixelRatio:S,holdingForFade:u.holdingForFade(),collisionBoxArray:b,partiallyEvaluatedTextSize:o.b8(f.textSizeData,this.transform.zoom),partiallyEvaluatedIconSize:o.b8(f.iconSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(f.sourceID)};if(d)for(const Y of f.sortKeyRanges){const{sortKey:re,symbolInstanceStart:he,symbolInstanceEnd:ie}=Y;r.push({sortKey:re,symbolInstanceStart:he,symbolInstanceEnd:ie,parameters:K})}else r.push({symbolInstanceStart:0,symbolInstanceEnd:f.symbolInstances.length,parameters:K})}attemptAnchorPlacement(r,s,u,d,f,_,y,b,T,S,A,C,P,L,R,k,O,N){const{textOffset0:$,textOffset1:Z,crossTileID:Q}=C,B=[$,Z],U=Rc(r,u,d,B,f),K=this.collisionIndex.placeCollisionBox(L,f,s,Hs(U.x,U.y,_,y,this.transform.angle),A,b,T,S.predicate);if(k){const Y=L.getSymbolInstanceIconSize(N,this.transform.zoom,C.placedIconSymbolIndex);if(this.collisionIndex.placeCollisionBox(L,Y,k,Hs(U.x,U.y,_,y,this.transform.angle),A,b,T,S.predicate).box.length===0)return}if(K.box.length>0){let Y;return this.prevPlacement&&this.prevPlacement.variableOffsets[Q]&&this.prevPlacement.placements[Q]&&this.prevPlacement.placements[Q].text&&(Y=this.prevPlacement.variableOffsets[Q].anchor),this.variableOffsets[Q]={textOffset:B,width:u,height:d,anchor:r,textScale:f,prevAnchor:Y},this.markUsedJustification(L,r,C,R),L.allowVerticalPlacement&&(this.markUsedOrientation(L,R,C),this.placedOrientations[Q]=R),{shift:U,placedGlyphBoxes:K}}}placeLayerBucketPart(r,s,u,d){const{bucket:f,layout:_,posMatrix:y,textLabelPlaneMatrix:b,labelToScreenMatrix:T,clippingData:S,textPixelRatio:A,holdingForFade:C,collisionBoxArray:P,partiallyEvaluatedTextSize:L,partiallyEvaluatedIconSize:R,collisionGroup:k}=r.parameters,O=_.get("text-optional"),N=_.get("icon-optional"),$=_.get("text-allow-overlap"),Z=_.get("icon-allow-overlap"),Q=_.get("text-rotation-alignment")==="map",B=_.get("text-pitch-alignment")==="map",U=_.get("symbol-z-order")==="viewport-y",K=_.get("symbol-z-elevate");this.transform.setProjection(f.projection);let Y=$&&(Z||!f.hasIconData()||N),re=Z&&($||!f.hasTextData()||O);!f.collisionArrays&&P&&f.deserializeCollisionBoxes(P),u&&d&&f.updateCollisionDebugBuffers(this.transform.zoom,P);const he=(ie,ce,pe)=>{const{crossTileID:te,numVerticalGlyphVertices:ae}=ie;if(S){const ui={zoom:this.transform.zoom,pitch:this.transform.pitch};let ri=null;if(S.dynamicFilterNeedsFeature){const St=this.retainedQueryData[f.bucketInstanceId];ri=S.featureIndex.loadFeature({featureIndex:ie.featureIndex,bucketIndex:St.bucketIndex,sourceLayerIndex:St.sourceLayerIndex,layoutVertexArrayOffset:0})}if(!(0,S.dynamicFilter)(ui,ri,this.retainedQueryData[f.bucketInstanceId].tileID.canonical,new o.P(ie.tileAnchorX,ie.tileAnchorY),this.transform.calculateDistanceTileData(S.unwrappedTileID)))return this.placements[te]=new ul(!1,!1,!1,!0),void s.add(te)}if(s.has(te))return;if(C)return void(this.placements[te]=new ul(!1,!1,!1));let Me=!1,se=!1,ue=!0,de=!1,W=!1,xe=null,Ge={box:null,offscreen:null,occluded:null},Xe={box:null,offscreen:null,occluded:null},nt=null,et=null,at=null,Ot=0,gt=0,Vt=0;pe.textFeatureIndex?Ot=pe.textFeatureIndex:ie.useRuntimeCollisionCircles&&(Ot=ie.featureIndex),pe.verticalTextFeatureIndex&&(gt=pe.verticalTextFeatureIndex);const Bt=ui=>{ui.tileID=this.retainedQueryData[f.bucketInstanceId].tileID;const ri=this.transform.elevation;ui.elevation=ie.zOffset+(ri?ri.getAtTileOffset(ui.tileID,ui.tileAnchorX,ui.tileAnchorY):0)},bi=pe.textBox;if(bi){Bt(bi);const ui=St=>{let It=o.b9.horizontal;if(f.allowVerticalPlacement&&!St&&this.prevPlacement){const gi=this.prevPlacement.placedOrientations[te];gi&&(this.placedOrientations[te]=gi,It=gi,this.markUsedOrientation(f,It,ie))}return It}
vendor: 18,651 bytes, line 14
14,ri=(St,It)=>{if(f.allowVerticalPlacement&&ae>0&&pe.verticalTextBox){for(const gi of f.writingModes)if(gi===o.b9.vertical?(Ge=It(),Xe=Ge):Ge=St(),Ge&&Ge.box&&Ge.box.length)break}else Ge=St()};if(_.get("text-variable-anchor")){let St=_.get("text-variable-anchor");if(this.prevPlacement&&this.prevPlacement.variableOffsets[te]){const hi=this.prevPlacement.variableOffsets[te];St.indexOf(hi.anchor)>0&&(St=St.filter(Dt=>Dt!==hi.anchor),St.unshift(hi.anchor))}const It=(hi,Dt,vt)=>{const br=f.getSymbolInstanceTextSize(L,ie,this.transform.zoom,ce),ar=(hi.x2-hi.x1)*br+2*hi.padding,Qi=(hi.y2-hi.y1)*br+2*hi.padding,lr=ie.hasIconTextFit&&!Z?Dt:null;lr&&Bt(lr);let wr={box:[],offscreen:!1,occluded:!1};const pr=$?2*St.length:St.length;for(let Hi=0;Hi<pr;++Hi){const er=this.attemptAnchorPlacement(St[Hi%St.length],hi,ar,Qi,br,Q,B,A,y,k,Hi>=St.length,ie,ce,f,vt,lr,L,R);if(er&&(wr=er.placedGlyphBoxes,wr&&wr.box&&wr.box.length)){Me=!0,xe=er.shift;break}}return wr};ri(()=>It(bi,pe.iconBox,o.b9.horizontal),()=>{const hi=pe.verticalTextBox;return hi&&Bt(hi),f.allowVerticalPlacement&&!(Ge&&Ge.box&&Ge.box.length)&&ae>0&&hi?It(hi,pe.verticalIconBox,o.b9.vertical):{box:null,offscreen:null,occluded:null}}),Ge&&(Me=Ge.box,ue=Ge.offscreen,de=Ge.occluded);const gi=ui(!(!Ge||!Ge.box));if(!Me&&this.prevPlacement){const hi=this.prevPlacement.variableOffsets[te];hi&&(this.variableOffsets[te]=hi,this.markUsedJustification(f,hi.anchor,ie,gi))}}else{const St=(It,gi)=>{const hi=f.getSymbolInstanceTextSize(L,ie,this.transform.zoom,ce),Dt=this.collisionIndex.placeCollisionBox(f,hi,It,new o.P(0,0),$,A,y,k.predicate);return Dt&&Dt.box&&Dt.box.length&&(this.markUsedOrientation(f,gi,ie),this.placedOrientations[te]=gi),Dt};ri(()=>St(bi,o.b9.horizontal),()=>{const It=pe.verticalTextBox;return f.allowVerticalPlacement&&ae>0&&It?(Bt(It),St(It,o.b9.vertical)):{box:null,offscreen:null,occluded:null}}),ui(!!(Ge&&Ge.box&&Ge.box.length))}}if(nt=Ge,Me=nt&&nt.box&&nt.box.length>0,ue=nt&&nt.offscreen,de=nt&&nt.occluded,ie.useRuntimeCollisionCircles){const ui=f.text.placedSymbolArray.get(ie.centerJustifiedTextSymbolIndex>=0?ie.centerJustifiedTextSymbolIndex:ie.verticalPlacedTextSymbolIndex),ri=o.ba(f.textSizeData,L,ui),St=_.get("text-padding");et=this.collisionIndex.placeCollisionCircles(f,$,ui,f.lineVertexArray,f.glyphOffsetArray,ri,y,b,T,u,B,k.predicate,ie.collisionCircleDiameter*ri/o.bf,St,this.retainedQueryData[f.bucketInstanceId].tileID),Me=$||et.circles.length>0&&!et.collisionDetected,ue=ue&&et.offscreen,de=et.occluded}if(pe.iconFeatureIndex&&(Vt=pe.iconFeatureIndex),pe.iconBox){const ui=ri=>{Bt(ri);const St=ie.hasIconTextFit&&xe?Hs(xe.x,xe.y,Q,B,this.transform.angle):new o.P(0,0),It=f.getSymbolInstanceIconSize(R,this.transform.zoom,ie.placedIconSymbolIndex);return this.collisionIndex.placeCollisionBox(f,It,ri,St,Z,A,y,k.predicate)};Xe&&Xe.box&&Xe.box.length&&pe.verticalIconBox?(at=ui(pe.verticalIconBox),se=at.box.length>0):(at=ui(pe.iconBox),se=at.box.length>0),ue=ue&&at.offscreen,W=at.occluded}const ii=O||ie.numHorizontalGlyphVertices===0&&ae===0,qi=N||ie.numIconVertices===0;if(ii||qi?qi?ii||(se=se&&Me):Me=se&&Me:se=Me=se&&Me,Me&&nt&&nt.box&&this.collisionIndex.insertCollisionBox(nt.box,_.get("text-ignore-placement"),f.bucketInstanceId,Xe&&Xe.box&&gt?gt:Ot,k.ID),se&&at&&this.collisionIndex.insertCollisionBox(at.box,_.get("icon-ignore-placement"),f.bucketInstanceId,Vt,k.ID),et&&(Me&&this.collisionIndex.insertCollisionCircles(et.circles,_.get("text-ignore-placement"),f.bucketInstanceId,Ot,k.ID),u)){const ui=f.bucketInstanceId;let ri=this.collisionCircleArrays[ui];ri===void 0&&(ri=this.collisionCircleArrays[ui]=new bh);for(let St=0;St<et.circles.length;St+=4)ri.circles.push(et.circles[St+0]),ri.circles.push(et.circles[St+1]),ri.circles.push(et.circles[St+2]),ri.circles.push(et.collisionDetected?1:0)}const Bi=f.projection.name!=="globe";Y=Y&&(Bi||!de),re=re&&(Bi||!W),this.placements[te]=new ul(Me||Y,se||re,ue||f.justReloaded),s.add(te)};if(K&&this.buildingIndex&&(this.buildingIndex.updateZOffset(f,this.retainedQueryData[f.bucketInstanceId].tileID),f.updateZOffset()),U){const ie=f.getSortedSymbolIndexes(this.transform.angle);for(let ce=ie.length-1;ce>=0;--ce){const pe=ie[ce];he(f.symbolInstances.get(pe),pe,f.collisionArrays[pe])}f.hasAnyZOffset&&o.w(`${f.layerIds[0]} layer symbol-z-elevate: symbols are not sorted by elevation if symbol-z-order is evaluated to viewport-y`)}else if(f.hasAnyZOffset){const ie=f.getSortedIndexesByZOffset();for(let ce=0;ce<ie.length;++ce){const pe=ie[ce];he(f.symbolInstances.get(pe),pe,f.collisionArrays[pe])}}else for(let ie=r.symbolInstanceStart;ie<r.symbolInstanceEnd;ie++)he(f.symbolInstances.get(ie),ie,f.collisionArrays[ie]);if(u&&f.bucketInstanceId in this.collisionCircleArrays){const ie=this.collisionCircleArrays[f.bucketInstanceId];o.a9.invert(ie.invProjMatrix,y),ie.viewportMatrix=this.collisionIndex.getViewportMatrix()}f.justReloaded=!1}markUsedJustification(r,s,u,d){const{leftJustifiedTextSymbolIndex:f,centerJustifiedTextSymbolIndex:_,rightJustifiedTextSymbolIndex:y,verticalPlacedTextSymbolIndex:b,crossTileID:T}=u,S=o.bg(s),A=d===o.b9.vertical?b:S==="left"?f:S==="center"?_:S==="right"?y:-1;f>=0&&(r.text.placedSymbolArray.get(f).crossTileID=A>=0&&f!==A?0:T),_>=0&&(r.text.placedSymbolArray.get(_).crossTileID=A>=0&&_!==A?0:T),y>=0&&(r.text.placedSymbolArray.get(y).crossTileID=A>=0&&y!==A?0:T),b>=0&&(r.text.placedSymbolArray.get(b).crossTileID=A>=0&&b!==A?0:T)}markUsedOrientation(r,s,u){const d=s===o.b9.horizontal||s===o.b9.horizontalOnly?s:0,f=s===o.b9.vertical?s:0,{leftJustifiedTextSymbolIndex:_,centerJustifiedTextSymbolIndex:y,rightJustifiedTextSymbolIndex:b,verticalPlacedTextSymbolIndex:T}=u,S=r.text.placedSymbolArray;_>=0&&(S.get(_).placedOrientation=d),y>=0&&(S.get(y).placedOrientation=d),b>=0&&(S.get(b).placedOrientation=d),T>=0&&(S.get(T).placedOrientation=f)}commit(r){this.commitTime=r,this.zoomAtLastRecencyCheck=this.transform.zoom;const s=this.prevPlacement;let u=!1;this.prevZoomAdjustment=s?s.zoomAdjustment(this.transform.zoom):0;const d=s?s.symbolFadeChange(r):1,f=s?s.opacities:{},_=s?s.variableOffsets:{},y=s?s.placedOrientations:{};for(const b in this.placements){const T=this.placements[b],S=f[b];S?(this.opacities[b]=new Qs(S,d,T.text,T.icon,null,T.clipped),u=u||T.text!==S.text.placed||T.icon!==S.icon.placed):(this.opacities[b]=new Qs(null,d,T.text,T.icon,T.skipFade,T.clipped),u=u||T.text||T.icon)}for(const b in f){const T=f[b];if(!this.opacities[b]){const S=new Qs(T,d,!1,!1);S.isHidden()||(this.opacities[b]=S,u=u||T.text.placed||T.icon.placed)}}for(const b in _)this.variableOffsets[b]||!this.opacities[b]||this.opacities[b].isHidden()||(this.variableOffsets[b]=_[b]);for(const b in y)this.placedOrientations[b]||!this.opacities[b]||this.opacities[b].isHidden()||(this.placedOrientations[b]=y[b]);u?this.lastPlacementChangeTime=r:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=s?s.lastPlacementChangeTime:r)}updateLayerOpacities(r,s){const u=new Set;for(const d of s){const f=d.getBucket(r);f&&d.latestFeatureIndex&&r.fqid===f.layerIds[0]&&(this.updateBucketOpacities(f,u,d.collisionBoxArray),f.layers[0].layout.get("symbol-z-elevate")&&this.buildingIndex&&(this.buildingIndex.updateZOffset(f,d.tileID),f.updateZOffset()))}}updateBucketOpacities(r,s,u){r.hasTextData()&&r.text.opacityVertexArray.clear(),r.hasIconData()&&r.icon.opacityVertexArray.clear(),r.hasIconCollisionBoxData()&&r.iconCollisionBox.collisionVertexArray.clear(),r.hasTextCollisionBoxData()&&r.textCollisionBox.collisionVertexArray.clear();const d=r.layers[0].layout,f=!!r.layers[0].dynamicFilter(),_=new Qs(null,0,!1,!1,!0),y=d.get("text-allow-overlap"),b=d.get("icon-allow-overlap"),T=d.get("text-variable-anchor"),S=d.get("text-rotation-alignment")==="map",A=d.get("text-pitch-alignment")==="map",C=new Qs(null,0,y&&(b||!r.hasIconData()||d.get("icon-optional")),b&&(y||!r.hasTextData()||d.get("text-optional")),!0);!r.collisionArrays&&u&&(r.hasIconCollisionBoxData()||r.hasTextCollisionBoxData())&&r.deserializeCollisionBoxes(u);const P=(R,k,O)=>{for(let N=0;N<k/4;N++)R.opacityVertexArray.emplaceBack(O)};let L=0;for(let R=0;R<r.symbolInstances.length;R++){const k=r.symbolInstances.get(R),{numHorizontalGlyphVertices:O,numVerticalGlyphVertices:N,crossTileID:$,numIconVertices:Z}=k,Q=s.has($);let B=this.opacities[$];Q?B=_:B||(B=C,this.opacities[$]=B),s.add($);const U=O>0||N>0,K=Z>0,Y=this.placedOrientations[$],re=Y===o.b9.vertical,he=Y===o.b9.horizontal||Y===o.b9.horizontalOnly;if(!U&&!K||B.isHidden()||L++,U){const ie=pl(B.text);P(r.text,O,re?Ys:ie),P(r.text,N,he?Ys:ie);const ce=B.text.isHidden(),{leftJustifiedTextSymbolIndex:pe,centerJustifiedTextSymbolIndex:te,rightJustifiedTextSymbolIndex:ae,verticalPlacedTextSymbolIndex:Me}=k,se=r.text.placedSymbolArray,ue=ce||re?1:0;pe>=0&&(se.get(pe).hidden=ue),te>=0&&(se.get(te).hidden=ue),ae>=0&&(se.get(ae).hidden=ue),Me>=0&&(se.get(Me).hidden=ce||he?1:0);const de=this.variableOffsets[$];de&&this.markUsedJustification(r,de.anchor,k,Y);const W=this.placedOrientations[$];W&&(this.markUsedJustification(r,"left",k,W),this.markUsedOrientation(r,W,k))}if(K){const ie=pl(B.icon),{placedIconSymbolIndex:ce,verticalPlacedIconSymbolIndex:pe}=k,te=r.icon.placedSymbolArray,ae=B.icon.isHidden()?1:0;ce>=0&&(P(r.icon,Z,re?Ys:ie),te.get(ce).hidden=ae),pe>=0&&(P(r.icon,k.numVerticalIconVertices,he?Ys:ie),te.get(pe).hidden=ae)}if(r.hasIconCollisionBoxData()||r.hasTextCollisionBoxData()){const ie=r.collisionArrays[R];if(ie){let ce=new o.P(0,0),pe=!0;if(ie.textBox||ie.verticalTextBox){if(T){const ae=this.variableOffsets[$];ae?(ce=Rc(ae.anchor,ae.width,ae.height,ae.textOffset,ae.textScale),S&&ce._rotate(A?this.transform.angle:-this.transform.angle)):pe=!1}f&&(pe=!B.clipped),ie.textBox&&xs(r.textCollisionBox.collisionVertexArray,B.text.placed,!pe||re,ce.x,ce.y),ie.verticalTextBox&&xs(r.textCollisionBox.collisionVertexArray,B.text.placed,!pe||he,ce.x,ce.y)}const te=pe&&!!(!he&&ie.verticalIconBox);ie.iconBox&&xs(r.iconCollisionBox.collisionVertexArray,B.icon.placed,te,k.hasIconTextFit?ce.x:0,k.hasIconTextFit?ce.y:0),ie.verticalIconBox&&xs(r.iconCollisionBox.collisionVertexArray,B.icon.placed,!te,k.hasIconTextFit?ce.x:0,k.hasIconTextFit?ce.y:0)}}}if(r.fullyClipped=L===0,r.sortFeatures(this.transform.angle),this.retainedQueryData[r.bucketInstanceId]&&(this.retainedQueryData[r.bucketInstanceId].featureSortOrder=r.featureSortOrder),r.hasTextData()&&r.text.opacityVertexBuffer&&r.text.opacityVertexBuffer.updateData(r.text.opacityVertexArray),r.hasIconData()&&r.icon.opacityVertexBuffer&&r.icon.opacityVertexBuffer.updateData(r.icon.opacityVertexArray),r.hasIconCollisionBoxData()&&r.iconCollisionBox.collisionVertexBuffer&&r.iconCollisionBox.collisionVertexBuffer.updateData(r.iconCollisionBox.collisionVertexArray),r.hasTextCollisionBoxData()&&r.textCollisionBox.collisionVertexBuffer&&r.textCollisionBox.collisionVertexBuffer.updateData(r.textCollisionBox.collisionVertexArray),r.bucketInstanceId in this.collisionCircleArrays){const R=this.collisionCircleArrays[r.bucketInstanceId];r.placementInvProjMatrix=R.invProjMatrix,r.placementViewportMatrix=R.viewportMatrix,r.collisionCircleArray=R.circles,delete this.collisionCircleArrays[r.bucketInstanceId]}}symbolFadeChange(r){return this.fadeDuration===0?1:(r-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(r){return Math.max(0,(this.transform.zoom-r)/1.5)}hasTransitions(r){return this.stale||r-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(r,s){const u=this.zoomAtLastRecencyCheck===s?1-this.zoomAdjustment(s):1;return this.zoomAtLastRecencyCheck=s,this.commitTime+this.fadeDuration*u>r}setStale(){this.stale=!0}}function xs(c,r,s,u,d){c.emplaceBack(r?1:0,s?1:0,u||0,d||0),c.emplaceBack(r?1:0,s?1:0,u||0,d||0),c.emplaceBack(r?1:0,s?1:0,u||0,d||0),c.emplaceBack(r?1:0,s?1:0,u||0,d||0)}const Wo=Math.pow(2,25),Xs=Math.pow(2,24),kc=Math.pow(2,17),wh=Math.pow(2,16),Th=Math.pow(2,9),Eh=Math.pow(2,8),dl=Math.pow(2,1);function pl(c){if(c.opacity===0&&!c.placed)return 0;if(c.opacity===1&&c.placed)return 4294967295;const r=c.placed?1:0,s=Math.floor(127*c.opacity);return s*Wo+r*Xs+s*kc+r*wh+s*Th+r*Eh+s*dl+r}const Ys=0;class Qo{constructor(r){this._sortAcrossTiles=r.layout.get("symbol-z-order")!=="viewport-y"&&r.layout.get("symbol-sort-key").constantOr(1)!==void 0,this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs=new Set,this._bucketParts=[]}continuePlacement(r,s,u,d,f){const _=this._bucketParts;for(;this._currentTileIndex<r.length;)if(s.getBucketParts(_,d,r[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,f())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,_.sort((y,b)=>y.sortKey-b.sortKey));this._currentPartIndex<_.length;){const y=_[this._currentPartIndex];if(s.placeLayerBucketPart(y,this._seenCrossTileIDs,u,y.symbolInstanceStart===0),this._currentPartIndex++,f())return!0}return!1}}class Ho{constructor(r,s,u,d,f,_,y,b,T){this.placement=new Lc(r,f,_,y,b,T),this._currentPlacementIndex=s.length-1,this._forceFullPlacement=u,this._showCollisionBoxes=d,this._done=!1}isDone(){return this._done}continuePlacement(r,s,u,d){const f=o.f.now(),_=()=>{const y=o.f.now()-f;return!this._forceFullPlacement&&y>2};for(;this._currentPlacementIndex>=0;){const y=s[r[this._currentPlacementIndex]],b=this.placement.collisionIndex.transform.zoom;if(y.type==="symbol"&&(!y.minzoom||y.minzoom<=b)&&(!y.maxzoom||y.maxzoom>b)){const T=y,S=T.layout.get("symbol-z-elevate"),A=this._inProgressLayer=this._inProgressLayer||new Qo(T),C=o.aj(y.source,y.scope);if(A.continuePlacement(S?d[C]:u[C],this.placement,this._showCollisionBoxes,y,_))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(r){return this.placement.commit(r),this.placement}}const Oc=512/o.Y/2;class Sh{constructor(r,s,u){this.tileID=r,this.bucketInstanceId=u,this.index=new o.bj(s.length,16,Int32Array),this.keys=[],this.crossTileIDs=[];const d=r.canonical.x*o.Y,f=r.canonical.y*o.Y;for(let _=0;_<s.length;_++){const{key:y,crossTileID:b,tileAnchorX:T,tileAnchorY:S}=s.get(_),A=Math.floor((d+T)*Oc),C=Math.floor((f+S)*Oc);this.index.add(A,C),this.keys.push(y),this.crossTileIDs.push(b)}this.index.finish()}findMatches(r,s,u){const d=this.tileID.canonical.z<s.canonical.z?1:Math.pow(2,this.tileID.canonical.z-s.canonical.z),f=Oc/Math.pow(2,s.canonical.z-this.tileID.canonical.z),_=s.canonical.x*o.Y,y=s.canonical.y*o.Y;for(let b=0;b<r.length;b++){const T=r.get(b);if(T.crossTileID)continue;const{key:S,tileAnchorX:A,tileAnchorY:C}=T,P=Math.floor((_+A)*f),L=Math.floor((y+C)*f),R=this.index.range(P-d,L-d,P+d,L+d);for(const k of R){const O=this.crossTileIDs[k];if(this.keys[k]===S&&!u.has(O)){u.add(O),T.crossTileID=O;break}}}}}class fl{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Xo{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(r){const s=Math.round((r-this.lng)/360);if(s!==0)for(const u in this.indexes){const d=this.indexes[u],f={};for(const _ in d){const y=d[_];y.tileID=y.tileID.unwrapTo(y.tileID.wrap+s),f[y.tileID.key]=y}this.indexes[u]=f}this.lng=r}addBucket(r,s,u){if(this.indexes[r.overscaledZ]&&this.indexes[r.overscaledZ][r.key]){if(this.indexes[r.overscaledZ][r.key].bucketInstanceId===s.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(r.overscaledZ,this.indexes[r.overscaledZ][r.key])}for(let f=0;f<s.symbolInstances.length;f++)s.symbolInstances.get(f).crossTileID=0;this.usedCrossTileIDs[r.overscaledZ]||(this.usedCrossTileIDs[r.overscaledZ]=new Set);const d=this.usedCrossTileIDs[r.overscaledZ];for(const f in this.indexes){const _=this.indexes[f];if(Number(f)>r.overscaledZ)for(const y in _){const b=_[y];b.tileID.isChildOf(r)&&b.findMatches(s.symbolInstances,r,d)}else{const y=_[r.scaledTo(Number(f)).key];y&&y.findMatches(s.symbolInstances,r,d)}}for(let f=0;f<s.symbolInstances.length;f++){const _=s.symbolInstances.get(f);_.crossTileID||(_.crossTileID=u.generate(),d.add(_.crossTileID))}return this.indexes[r.overscaledZ]===void 0&&(this.indexes[r.overscaledZ]={}),this.indexes[r.overscaledZ][r.key]=new Sh(r,s.symbolInstances,s.bucketInstanceId),!0}removeBucketCrossTileIDs(r,s){for(const u of s.crossTileIDs)this.usedCrossTileIDs[r].delete(u)}removeStaleBuckets(r){let s=!1;for(const u in this.indexes){const d=this.indexes[u];for(const f in d)r[d[f].bucketInstanceId]||(this.removeBucketCrossTileIDs(u,d[f]),delete d[f],s=!0)}return s}}class Bc{constructor(){this.layerIndexes={},this.crossTileIDs=new fl,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(r,s,u,d){let f=this.layerIndexes[r.fqid];f===void 0&&(f=this.layerIndexes[r.fqid]=new Xo);let _=!1;const y={};d.name!=="globe"&&f.handleWrapJump(u);for(const b of s){const T=b.getBucket(r);T&&r.fqid===T.layerIds[0]&&(T.bucketInstanceId||(T.bucketInstanceId=++this.maxBucketInstanceId),f.addBucket(b.tileID,T,this.crossTileIDs)&&(_=!0),y[T.bucketInstanceId]=!0)}return f.removeStaleBuckets(y)&&(_=!0),_}pruneUnusedLayers(r){const s={};r.forEach(u=>{s[u]=!0});for(const u in this.layerIndexes)s[u]||delete this.layerIndexes[u]}}class Yo{constructor(r=0,s=0,u=0,d=0){if(isNaN(r)||r<0||isNaN(s)||s<0||isNaN(u)||u<0||isNaN(d)||d<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=r,this.bottom=s,this.left=u,this.right=d}interpolate(r,s,u){return s.top!=null&&r.top!=null&&(this.top=o.X(r.top,s.top,u)),s.bottom!=null&&r.bottom!=null&&(this.bottom=o.X(r.bottom,s.bottom,u)),s.left!=null&&r.left!=null&&(this.left=o.X(r.left,s.left,u)),s.right!=null&&r.right!=null&&(this.right=o.X(r.right,s.right,u)),this}getCenter(r,s){const u=o.ad((this.left+r-this.right)/2,0,r),d=o.ad((this.top+s-this.bottom)/2,0,s);return new o.P(u,d)}equals(r){return this.top===r.top&&this.bottom===r.bottom&&this.left===r.left&&this.right===r.right}clone(){return new Yo(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}function ml(c,r){const s=o.bn(c,3);o.a9.fromQuat(c,r),o.bp(c,3,s)}function Fc(c,r){const s=o.bl.identity([]);return o.bl.rotateZ(s,s,-r),o.bl.rotateX(s,s,-c),s}function nn(c,r){const s=[c[0],c[1],0],u=[r[0],r[1],0];if(o.Q.length(s)>=1e-15){const _=o.Q.normalize([],s);o.Q.scale(u,_,o.Q.dot(u,_)),r[0]=u[0],r[1]=u[1]}const d=o.Q.cross([],r,c);if(o.Q.len(d)<1e-15)return null;const f=Math.atan2(-d[1],d[0]);return Fc(Math.atan2(Math.sqrt(c[0]*c[0]+c[1]*c[1]),-c[2]),f)}class Js{constructor(r,s){this.position=r,this.orientation=s}get position(){return this._position}set position(r){if(r){const s=r instanceof o.O?r:new o.O(r[0],r[1],r[2]);
14this._renderWorldCopies&&(s.x=o.bk(s.x,0,1)),this._position=s}else this._position=null}lookAtPoint(r,s){if(this.orientation=null,!this.position)return;const u=this.position,d=this._elevation?this._elevation.getAtPointOrZero(o.O.fromLngLat(r)):0,f=o.O.fromLngLat(r,d),_=[f.x-u.x,f.y-u.y,f.z-u.z];s||(s=[0,0,1]),s[2]=Math.abs(s[2]),this.orientation=nn(_,s)}setPitchBearing(r,s){this.orientation=Fc(o.bm(r),o.bm(-s))}}class Jo{constructor(r,s){this._transform=o.a9.identity([]),this.orientation=s,this.position=r}get mercatorPosition(){const r=this.position;return new o.O(r[0],r[1],r[2])}get position(){const r=o.bn(this._transform,3);return[r[0],r[1],r[2]]}set position(r){var s;r&&o.bp(this._transform,3,[(s=r)[0],s[1],s[2],1])}get orientation(){return this._orientation}set orientation(r){this._orientation=r||o.bl.identity([]),r&&ml(this._transform,this._orientation)}getPitchBearing(){const r=this.forward(),s=this.right();return{bearing:Math.atan2(-s[1],s[0]),pitch:Math.atan2(Math.sqrt(r[0]*r[0]+r[1]*r[1]),-r[2])}}setPitchBearing(r,s){this._orientation=Fc(r,s),ml(this._transform,this._orientation)}forward(){const r=o.bn(this._transform,2);return[-r[0],-r[1],-r[2]]}up(){const r=o.bn(this._transform,1);return[-r[0],-r[1],-r[2]]}right(){const r=o.bn(this._transform,0);return[r[0],r[1],r[2]]}getCameraToWorld(r,s){const u=new Float64Array(16);return o.a9.invert(u,this.getWorldToCamera(r,s)),u}getCameraToWorldMercator(){return this._transform}getWorldToCameraPosition(r,s,u){const d=this.position;o.Q.scale(d,d,-r);const f=new Float64Array(16);return o.a9.fromScaling(f,[u,u,u]),o.a9.translate(f,f,d),f[10]*=s,f}getWorldToCamera(r,s){const u=new Float64Array(16),d=new Float64Array(4),f=this.position;return o.bl.conjugate(d,this._orientation),o.Q.scale(f,f,-r),o.a9.fromQuat(u,d),o.a9.translate(u,u,f),u[1]*=-1,u[5]*=-1,u[9]*=-1,u[13]*=-1,u[8]*=s,u[9]*=s,u[10]*=s,u[11]*=s,u}getCameraToClipPerspective(r,s,u,d){const f=new Float64Array(16);return o.a9.perspective(f,r,s,u,d),f}getCameraToClipOrthographic(r,s,u,d,f,_){const y=new Float64Array(16);return o.a9.ortho(y,r,s,u,d,f,_),y}getDistanceToElevation(r,s=!1){const u=r===0?0:o.bo(r,s?o.ax(this.position[1]):this.position[1]),d=this.forward();return(u-this.position[2])/d[2]}clone(){return new Jo([...this.position],[...this.orientation])}}const Nc=(c,r,s)=>(1-s)*c+s*r,Ks=c=>c*c*c*c*c;class _l{constructor(r,s,u,d,f,_,y){this.tileSize=512,this._renderWorldCopies=f===void 0||f,this._minZoom=r||0,this._maxZoom=s||22,this._minPitch=u??0,this._maxPitch=d??60,this.setProjection(_),this.setMaxBounds(y),this.width=0,this.height=0,this._center=new o.bq(0,0),this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._nearZ=0,this._farZ=0,this._unmodified=!0,this._edgeInsets=new Yo,this._projMatrixCache={},this._alignedProjMatrixCache={},this._fogTileMatrixCache={},this._expandedProjMatrixCache={},this._distanceTileDataCache={},this._camera=new Jo,this._centerAltitude=0,this._averageElevation=0,this.cameraElevationReference="ground",this._pixelsPerMercatorPixel=1,this.globeRadius=0,this.globeCenterInViewSpace=[0,0,0],this._tileCoverLift=0,this.freezeTileCoverage=!1,this._horizonShift=.1,this._orthographicProjectionAtLowPitch=!1}clone(){const r=new _l(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies,this.getProjection());return r._elevation=this._elevation,r._centerAltitude=this._centerAltitude,r._centerAltitudeValidForE
14xaggeration=this._centerAltitudeValidForExaggeration,r.tileSize=this.tileSize,r.mercatorFromTransition=this.mercatorFromTransition,r.width=this.width,r.height=this.height,r.cameraElevationReference=this.cameraElevationReference,r._center=this._center,r._setZoom(this.zoom),r._seaLevelZoom=this._seaLevelZoom,r.angle=this.angle,r._fov=this._fov,r._pitch=this._pitch,r._nearZ=this._nearZ,r._farZ=this._farZ,r._averageElevation=this._averageElevation,r._orthographicProjectionAtLowPitch=this._orthographicProjectionAtLowPitch,r._unmodified=this._unmodified,r._edgeInsets=this._edgeInsets.clone(),r._camera=this._camera.clone(),r._calcMatrices(),r.freezeTileCoverage=this.freezeTileCoverage,r.frustumCorners=this.frustumCorners,r}get isOrthographic(){return this.projection.name!=="globe"&&this._orthographicProjectionAtLowPitch&&this.pitch<15}get elevation(){return this._elevation}set elevation(r){this._elevation!==r&&(this._elevation=r,this._updateCameraOnTerrain(),this._calcMatrices())}get depthOcclusionForSymbolsAndCircles(){return this.projection.name!=="globe"&&!this.isOrthographic}updateElevation(r,s=!1){const u=this._elevation&&this._elevation.exaggeration()!==this._centerAltitudeValidForE
vendor: 3,939 bytes, line 14
14xaggeration;(this._seaLevelZoom==null||u)&&this._updateCameraOnTerrain(),(r||u)&&this._constrainCamera(s),this._calcMatrices()}getProjection(){return o.af(this.projection,["name","center","parallels"])}setProjection(r){this.projectionOptions=r||{name:"mercator"};const s=this.projection?this.getProjection():void 0;this.projection=o.br(this.projectionOptions);const u=!At(s,this.getProjection());return u&&this._calcMatrices(),this.mercatorFromTransition=!1,u}setOrthographicProjectionAtLowPitch(r){return this._orthographicProjectionAtLowPitch!==r&&(this._orthographicProjectionAtLowPitch=r,this._calcMatrices(),!0)}setMercatorFromTransition(){const r=this.projection.name;this.mercatorFromTransition=!0,this.projectionOptions={name:"mercator"},this.projection=o.br({name:"mercator"});const s=r!==this.projection.name;return s&&this._calcMatrices(),s}get minZoom(){return this._minZoom}set minZoom(r){this._minZoom!==r&&(this._minZoom=r,this.zoom=Math.max(this.zoom,r))}get maxZoom(){return this._maxZoom}set maxZoom(r){this._maxZoom!==r&&(this._maxZoom=r,this.zoom=Math.min(this.zoom,r))}get minPitch(){return this._minPitch}set minPitch(r){this._minPitch!==r&&(this._minPitch=r,this.pitch=Math.max(this.pitch,r))}get maxPitch(){return this._maxPitch}set maxPitch(r){this._maxPitch!==r&&(this._maxPitch=r,this.pitch=Math.min(this.pitch,r))}get renderWorldCopies(){return this._renderWorldCopies&&this.projection.supportsWorldCopies===!0}set renderWorldCopies(r){r===void 0?r=!0:r===null&&(r=!1),this._renderWorldCopies=r}get worldSize(){return this.tileSize*this.scale}get cameraWorldSizeForFog(){const r=Math.max(this._camera.getDistanceToElevation(this._averageElevation),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(r))}get cameraWorldSize(){const r=Math.max(this._camera.getDistanceToElevation(this._averageElevation,!0),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(r))}get pixelsPerMeter(){return this.projection.pixelsPerMeter(this.center.lat,this.worldSize)}get cameraPixelsPerMeter(){return o.bo(1,this.center.lat)*this.cameraWorldSizeForFog}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new o.P(this.width,this.height)}get bearing(){return o.bk(this.rotation,-180,180)}set bearing(r){this.rotation=r}get rotation(){return-this.angle/Math.PI*180}set rotation(r){const s=-r*Math.PI/180;this.angle!==s&&(this._unmodified=!1,this.angle=s,this._calcMatrices(),this.rotationMatrix=o.b7.create(),o.b7.rotate(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(r){const s=o.ad(r,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==s&&(this._unmodified=!1,this._pitch=s,this._calcMatrices())}get aspect(){return this.width/this.height}get fov(){return this._fov/Math.PI*180}get fovX(){return this._fov}get fovY(){const r=1/Math.tan(.5*this.fovX);return 2*Math.atan(1/this.aspect/r)}set fov(r){r=Math.max(.01,Math.min(60,r)),this._fov!==r&&(this._unmodified=!1,this._fov=o.bm(r),this._calcMatrices())}get averageElevation(){return this._averageElevation}set averageElevation(r){this._averageElevation=r,this._calcFogMatrices(),this._distanceTileDataCache={}}get zoom(){return this._zoom}set zoom(r){const s=Math.min(Math.max(r,this.minZoom),this.maxZoom);this._zoom!==s&&(this._unmodified=!1,this._setZoom(s),this._updateSeaLevelZoom(),this._constrain(),this._calcMatrices())}_setZoom(r){this._zoom=r,this.scale=this.zoomScale(r),this.tileZoom=Math.floor(r),this.zoomFraction=r-this.tileZoom}get tileCoverLift(){return this._tileCoverLift}set tileCoverLift(r){this._tileCoverLift!==r&&(this._tileCoverLift=r)}_updateCameraOnTerrain(){const r=this.elevation?this.elevation.getAtPoint(this.locationCoordinate(this.center),Number.NEGATIVE_INFINITY):Number.NEGATIVE_INFINITY,s=this.elevation&&r===Number.NEGATIVE_INFINITY&&this.elevation.visibleDemTiles.length>0&&this.elevation.exaggeration()>
140&&this._centerAltitudeValidForExaggeration;if(!this._elevation||r===Number.NEGATIVE_INFINITY&&(!s||!this._centerAltitude))return this._centerAltitude=0,this._seaLevelZoom=null,void(this._centerAltitudeValidForExaggeration=void 0);const u=this._elevation;s||this._centerAltitude&&this._centerAltitudeValidForExaggeration&&u.exaggeration()&&this._centerAltitudeValidForExaggeration!==u.exaggeration()?(this._centerAltitude=this._centerAltitude/this._centerAltitudeValidForExaggeration*u.exaggeration(),this._centerAltitudeValidForExaggeration=u.exaggeration()):(this._centerAltitude=r||0,this._centerAltitudeValidForExaggeration=u.exaggeration()),this._updateSeaLevelZoom()}_updateSeaLevelZoom(){this._centerAltitudeValidForExaggeration!==void 0&&(this._seaLevelZoom=this._zoomFromMercatorZ((this.pixelsPerMeter*this._centerAltitude+this.cameraToCenterDistance)/this.worldSize))}sampleAverageElevation(){if(!this._elevation)return 0;const r=this._elevation,s=[[.5,.2],[.3,.5],[.5,.5],[.7,.5],[.5,.8]],u=this.horizonLineFromTop();let d=0,f=0;for(let _=0;_<s.length;_++){const y=new o.P(s[_][0]*this.width,u+s[_][1]*(this.height-u)),b=r.pointCoordinate(y);if(!b)continue;const T=1/Math.hypot(b[0]-this._camera.position[0],b[1]-this._camera.position[1]);d+=b[3]*T,f+=T}return f===0?NaN:d/f}get center(){return this._center}set center(r){r.lat===this._center.lat&&r.lng===this._center.lng||(this._unmodified=!1,this._center=r,this._terrainEnabled()&&(this.cameraElevationReference==="ground"?this._updateCameraOnTerrain():this._updateZoomFromElevation()),this._constrain(),this._calcMatrices())}_updateZoomFromElevation(){if(this._seaLevelZoom==null||!this._elevation)return;const r=this._seaLevelZoom,s=this._elevation.getAtPointOrZero(this.locationCoordinate(this.center)),u=this.pixelsPerMeter/this.worldSize*s,d=this._mercatorZfromZoom(r),f=this._mercatorZfromZoom(this._maxZoom),_=Math.max(d-u,f);this._setZoom(this._zoomFromMercatorZ(_))}get padding(){return this._edgeInsets.toJSON()}set padding(r){this._edgeInsets.equals(r)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,r,1),this._calcMatrices())}computeZoomRelativeTo(r){const s=this.rayIntersectionCoordinate(this.pointRayIntersection(this.centerPoint,r.toAltitude()));let u;u=r.z<this._camera.position[2]?[s.x,s.y,s.z]:[r.x,r.y,r.z];const d=o.Q.length(o.Q.sub([],this._camera.position,u));return o.ad(this._zoomFromMercatorZ(d),this._minZoom,this._maxZoom)}setFreeCameraOptions(r){if(!this.height||!r.position&&!r.orientation)return;this._updateCameraState();let s=!1;if(r.orientation&&!o.bl.exactEquals(r.orientation,this._camera.orientation)&&(s=this._setCameraOrientation(r.orientation)),r.position){const u=[r.position.x,r.position.y,r.position.z];o.Q.exactEquals(u,this._camera.position)||(this._setCameraPosition(u),s=!0)}s&&(this._updateStateFromCamera(),this.recenterOnTerrain())}getFreeCameraOptions(){this._updateCameraState();const r=this._camera.position,s=new Js;return s.position=new o.O(r[0],r[1],r[2]),s.orientation=this._camera.orientation,s._elevation=this.elevation,s._renderWorldCopies=this.renderWorldCopies,s}_setCameraOrientation(r){if(!o.bl.length(r))return!1;o.bl.normalize(r,r);const s=o.Q.transformQuat([],[0,0,-1],r),u=o.Q.transformQuat([],[0,-1,0],r);if(u[2]<0)return!1;const d=nn(s,u);return!!d&&(this._camera.orientation=d,!0)}_setCameraPosition(r){const s=this.zoomScale(this.minZoom)*this.tileSize,u=this.zoomScale(this.maxZoom)*this.tileSize,d=this.cameraToCenterDistance;r[2]=o.ad(r[2],d/u,d/s),this._camera.position=r}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}get fovAboveCenter(){return this._fov*(.5+this.centerOffset.y/this.height)}isPaddingEqual(r){return this._edgeInsets.equals(r)}interpolatePadding(r,s,u){this._unmodified=!1,this._edgeInsets.interpolate(r,s,u),this._constrain(),this._calcMatrices()}coveringZoomLevel(r){const s=(r.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/r.tileSize));return Math.max(0,s)}getVisibleUnwrappedCoordinates(r){const s=[new o.bs(0,r)];if(this.renderWorldCopies){const u=this.pointCoordinate(new o.P(0,0)),d=this.pointCoordinate(new o.P(this.width,0)),f=this.pointCoordinate(new o.P(this.width,this.height)),_=this.pointCoordinate(new o.P(0,this.height)),y=Math.floor(Math.min(u.x,d.x,f.x,_.x)),b=Math.floor(Math.max(u.x,d.x,f.x,_.x)),T=1;for(let S=y-T;S<=b+T;S++)S!==0&&s.push(new o.bs(S,r))}return s}isLODDisabled(r){return(!r||this.pitch<=60)&&this._edgeInsets.top<=this._edgeInsets.bottom&&!this._elevation&&!this.projection.isReprojectedInTileSpace}extendTileCoverForShadows(r,s,u){let d=[];if(s[0]===0&&s[1]===0)return d;for(const _ of r){const y=_.canonical,b=_.overscaledZ,T=_.wrap,S=1<<y.z,A=y.x+1<S,C=y.x>0,P=y.y+1<S,L=y.y>
140,R=_.wrap-(C?0:1),k=_.wrap+(A?0:1),O=C?y.x-1:S-1,N=A?y.x+1:0;s[0]<0?(d.push(new o.ap(b,k,y.z,N,y.y)),s[1]<0&&P&&(d.push(new o.ap(b,T,y.z,y.x,y.y+1)),d.push(new o.ap(b,k,y.z,N,y.y+1))),s[1]>0&&L&&(d.push(new o.ap(b,T,y.z,y.x,y.y-1)),d.push(new o.ap(b,k,y.z,N,y.y-1)))):s[0]>0?(d.push(new o.ap(b,R,y.z,O,y.y)),s[1]<0&&P&&(d.push(new o.ap(b,T,y.z,y.x,y.y+1)),d.push(new o.ap(b,R,y.z,O,y.y+1))),s[1]>0&&L&&(d.push(new o.ap(b,T,y.z,y.x,y.y-1)),d.push(new o.ap(b,R,y.z,O,y.y-1)))):s[1]<0&&P?d.push(new o.ap(b,T,y.z,y.x,y.y+1)):L&&d.push(new o.ap(b,T,y.z,y.x,y.y-1))}if(d.length>1){d.sort((b,T)=>b.overscaledZ-T.overscaledZ||b.wrap-T.wrap||b.canonical.z-T.canonical.z||b.canonical.x-T.canonical.x||b.canonical.y-T.canonical.y);let _=0,y=0;for(;y<d.length;)d[y].equals(d[_])?++y:d[++_]=d[y++];d.length=_+1}const f=[];for(const _ of d)d.some(y=>_.isChildOf(y))||f.push(_);return d=f.filter(_=>!r.some(y=>!!(_.overscaledZ<u&&y.isChildOf(_))||_.equals(y)||_.isChildOf(y))),d}coveringTiles(r){let s=this.coveringZoomLevel(r);const u=s,d=this.elevation&&this.elevation.exaggeration(),f=d&&!r.isTerrainDEM,_=this.projection.name==="mercator";if(r.minzoom!==void 0&&s<r.minzoom)return[];r.maxzoom!==void 0&&s>r.maxzoom&&(s=r.maxzoom);const y=this.locationCoordinate(this.center),b=this.center.lat,T=1<<s,S=[T*y.x,T*y.y,0],A=this.projection.name==="globe",C=!A,P=o.bt.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,s,C),L=A?this._camera.mercatorPosition:this.pointCoordinate(this.getCameraPoint()),R=T*o.bo(1,this.center.lat),k=this._camera.position[2]/o.bo(1,this.center.lat),O=[T*L.x,T*L.y,k*(C?1:R)],N=A||d,$=this.cameraToCenterDistance/r.tileSize*(r.roundZoom?1:.502),Z=this.isLODDisabled(!0)?s:0;let Q;if(this._elevation&&r.isTerrainDEM)Q=1e4*this._elevation.exaggeration();else if(this._elevation){const se=this._elevation.getMinMaxForVisibleTiles();Q=se?se.max:this._centerAltitude}else Q=this._centerAltitude;const B=r.isTerrainDEM?-Q:this._elevation?this._elevation.getMinElevationBelowMSL():0,U=this.projection.isReprojectedInTileSpace?o.bu(this):1,K=se=>{const de=new o.O(se.x+25e-6,se.y,se.z),W=new o.O(se.x,se.y+25e-6,se.z),xe=se.toLngLat(),Ge=de.toLngLat(),Xe=W.toLngLat(),nt=this.locationCoordinate(xe),et=this.locationCoordinate(Ge),at=this.locationCoordinate(Xe),Ot=Math.hypot(et.x-nt.x,et.y-nt.y),gt=Math.hypot(at.x-nt.x,at.y-nt.y);return Math.sqrt(Ot*gt)*U/25e-6},Y=se=>{const ue=Q,de=B;return{aabb:o.bx(this,T,0,0,0,se,de,ue,this.projection),zoom:0,x:0,y:0,minZ:de,maxZ:ue,wrap:se,fullyVisible:!1}},re=[];let he=[];const ie=s,ce=r.reparseOverscaled?u:s,pe=se=>se*se,te=pe((k-this._centerAltitude)*R),ae=se=>{if(!this._elevation||!se.tileID||!_)return;const ue=this._elevation.getMinMaxForTile(se.tileID),de=se.aabb;ue?(de.min[2]=ue.min,de.max[2]=ue.max,de.center[2]=(de.min[2]+de.max[2])/2):(se.shouldSplit=Me(se),se.shouldSplit||(de.min[2]=de.max[2]=de.center[2]=this._centerAltitude))},Me=se=>{if(se.zoom<Z)return!0;if(se.zoom===ie)return!1;if(se.shouldSplit!=null)return se.shouldSplit;const ue=se.aabb.distanceX(O),de=se.aabb.distanceY(O);let W=te,xe=1;if(A){W=pe(se.aabb.distanceZ(O));const nt=Math.pow(2,se.zoom),et=o.ax((se.y+1)/nt),at=o.ax(se.y/nt),Ot=Math.min(Math.max(b,et),at),gt=o.bM(Ot)/o.bM(b);if(xe=Ot===b?1/Math.max(1,this._mercatorScaleRatio-.3):Math.min(1,gt/this._mercatorScaleRatio),this.zoom<=o.bJ&&se.zoom===ie-1&&gt>=.9)return!0}else if(f&&(W=pe(se.aabb.distanceZ(O)*R)),this.projection.isReprojectedInTileSpace&&u<=5){const nt=Math.pow(2,se.zoom),et=K(new o.O((se.x+.5)/nt,(se.y+.5)/nt));xe=et>.85?1:et}const Ge=ue*ue+de*de+W,Xe=pe((1<<ie-se.zoom)*$*xe*((nt,et)=>{if(et*pe(.707)<nt)return 1;const at=Math.sqrt(et/nt);return at/(1.4144271570014144+(Math.pow(1.1,at-1.4144271570014144+1)-1)/(1.1-1)-1)})(Math.max(W,te),Ge));return Ge<Xe};if(this.renderWorldCopies)for(let se=1;se<=3;se++)re.push(Y(-se)),re.push(Y(se));for(re.push(Y(0));re.length>0;){const se=re.pop(),ue=se.x,de=se.y;let W=se.fullyVisible;const xe=()=>this.projection.name==="globe"&&(se.y===0||se.y===(1<<se.zoom)-1);if(!W){let Ge=N?se.aabb.intersects(P):se.aabb.intersectsFlat(P);if(Ge===0&&xe()){const Xe=new o.bv(se.zoom,ue,de);Ge=o.bw(this,T,Xe,!0).intersects(P)}if(Ge===0)continue;W=Ge===2}if(se.zoom!==ie&&Me(se))for(let Ge=0;Ge<4;Ge++){const Xe=(ue<<1)+Ge%2,nt=(de<<1)+(Ge>>1),et={aabb:_?se.aabb.quadrant(Ge):o.bx(this,T,se.zoom+1,Xe,nt,se.wrap,se.minZ,se.maxZ,this.projection),zoom:se.zoom+1,x:Xe,y:nt,wrap:se.wrap,fullyVisible:W,tileID:void 0,shouldSplit:void 0,minZ:se.minZ,maxZ:se.maxZ};f&&!A&&(et.tileID=new o.ap(se.zoom+1===ie?ce:se.zoom+1,se.wrap,se.zoom+1,Xe,nt),ae(et)),re.push(et)}else{const Ge=se.zoom===ie?ce:se.zoom;if(r.minzoom&&r.minzoom>Ge)continue;if(!W){let at=N?se.aabb.intersectsPrecise(P):se.aabb.intersectsPreciseFlat(P);if(at===0&&xe()){const Ot=new o.bv(se.zoom,ue,de);at=o.bw(this,T,Ot,!0).intersectsPrecise(P)}if(at===0)continue}const Xe=S[0]-(.5+ue+(se.wrap<<se.zoom))*(1<<s-se.zoom),nt=S[1]-.5-de,et=se.tileID?se.tileID:new o.ap(Ge,se.wrap,se.zoom,ue,de);he.push({tileID:et,distanceSq:Xe*Xe+nt*nt})}}if(this.fogCullDistSq){const se=this.fogCullDistSq,ue=this.horizonLineFromTop();he=he.filter(de=>{const W=[0,0,0,1],xe=[o.Y,o.Y,0,1],Ge=this.calculateFogTileMatrix(de.tileID.toUnwrapped());o.aa.transformMat4(W,W,Ge),o.aa.transformMat4(xe,xe,Ge);const Xe=o.aa.min([],W,xe),nt=o.aa.max([],W,xe),et=o.by(Xe,nt);if(et===0)return!0;let at=!1;const Ot=this._elevation;if(Ot&&et>se&&ue!==0){const gt=this.calculateProjMatrix(de.tileID.toUnwrapped());let Vt;r.isTerrainDEM||(Vt=Ot.getMinMaxForTile(de.tileID)),Vt||(Vt={min:B,max:Q});const Bt=o.bK(this.rotation),bi=[Bt[0]*o.Y,Bt[1]*o.Y,Vt.max];o.Q.transformMat4(bi,bi,gt),at=(1-bi[1])*this.height*.5<ue}return et<se||at})}return he.sort((se,ue)=>se.distanceSq-ue.distanceSq).map(se=>se.tileID)}resize(r,s){this.width=r,this.height=s,this.pixelsToGLUnits=[2/r,-2/s],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(r){return Math.pow(2,r)}scaleZoom(r){return Math.log(r)/Math.LN2}project(r){const s=o.ad(r.lat,-o.bz,o.bz),u=this.projection.project(r.lng,s);return new o.P(u.x*this.worldSize,u.y*this.worldSize)}unproject(r){return this.projection.unproject(r.x/this.worldSize,r.y/this.worldSize)}get point(){return this.project(this.center)}get pointMerc(){return this.point._div(this.worldSize)}get pixelsPerMeterRatio(){return this.pixelsPerMeter/o.bo(1,this.center.lat)/this.worldSize}setLocationAtPoint(r,s){let u,d;const f=this.centerPoint;if(this.projection.name==="globe"){const y=this.worldSize;u=(s.x-f.x)/y,d=(s.y-f.y)/y}else{const y=this.pointCoordinate(s),b=this.pointCoordinate(f);u=y.x-b.x,d=y.y-b.y}const _=this.locationCoordinate(r);this.setLocation(new o.O(_.x-u,_.y-d))}setLocation(r){this.center=this.coordinateLocation(r),this.projection.wrap&&(this.center=this.center.wrap())}locationPoint(r){return this.projection.locationPoint(this,r)}locationPoint3D(r){return this.projection.locationPoint(this,r,!0)}pointLocation(r){return this.coordinateLocation(this.pointCoordinate(r))}pointLocation3D(r){return this.coordinateLocation(this.pointCoordinate3D(r))}locationCoordinate(r,s){const u=s?o.bo(s,r.lat):void 0,d=this.projection.project(r.lng,r.lat);return new o.O(d.x,d.y,u)}coordinateLocation(r){return this.projection.unproject(r.x,r.y)}pointRayIntersection(r,s){const u=s??this._centerAltitude,d=[r.x,r.y,0,1],f=[r.x,r.y,1,1];o.aa.transformMat4(d,d,this.pixelMatrixInverse),o.aa.transformMat4(f,f,this.pixelMatrixInverse);const _=f[3];o.aa.scale(d,d,1/d[3]),o.aa.scale(f,f,1/_);const y=d[2],b=f[2];return{p0:d,p1:f,t:y===b?0:(u-y)/(b-y)}}screenPointToMercatorRay(r){const s=[r.x,r.y,0,1],u=[r.x,r.y,1,1];return o.aa.transformMat4(s,s,this.pixelMatrixInverse),o.aa.transformMat4(u,u,this.pixelMatrixInverse),o.aa.scale(s,s,1/s[3]),o.aa.scale(u,u,1/u[3]),s[2]=o.bo(s[2],this._center.lat)*this.worldSize,u[2]=o.bo(u[2],this._center.lat)*this.worldSize,o.aa.scale(s,s,1/this.worldSize),o.aa.scale(u,u,1/this.worldSize),new o.a5([s[0],s[1],s[2]],o.Q.normalize([],o.Q.sub([],u,s)))}rayIntersectionCoordinate(r){const{p0:s,p1:u,t:d}=r,f=o.bo(s[2],this._center.lat),_=o.bo(u[2],this._center.lat);return new o.O(o.X(s[0],u[0],d)/this.worldSize,o.X(s[1],u[1],d)/this.worldSize,o.X(f,_,d))}pointCoordinate(r,s=this._centerAltitude){return this.projection.pointCoordinate(this,r.x,r.y,s)}pointCoordinate3D(r){if(!this.elevation)return this.pointCoordinate(r);let s=this.projection.pointCoordinate3D(this,r.x,r.y);if(s)return new o.O(s[0],s[1],s[2]);let u=0,d=this.horizonLineFromTop();if(r.y>d)return this.pointCoordinate(r);const f=.02*d,_=r.clone();for(let y=0;y<10&&d-u>f;y++){_.y=o.X(u,d,.66);const b=this.projection.pointCoordinate3D(this,_.x,_.y);b?(d=_.y,s=b):u=_.y}return s?new o.O(s[0],s[1],s[2]):this.pointCoordinate(r)}isPointAboveHorizon(r){return this.projection.isPointAboveHorizon(this,r)}isPointOnSurface(r){if(r.y<0||r.y>this.height||r.x<0||r.x>this.width)return!1;if(this.elevation||this.zoom>=o.bA)return!this.isPointAboveHorizon(r);const s=this.pointCoordinate(r);return s.y>=0&&s.y<=1}_coordinatePoint(r,s){const u=s&&this.elevation?this.elevation.getAtPointOrZero(r,this._centerAltitude):this._centerAltitude,d=[r.x*this.worldSize,r.y*this.worldSize,u+r.toAltitude(),1];return o.aa.transformMat4(d,d,this.pixelMatrix),d[3]>0?new o.P(d[0]/d[3],d[1]/d[3]):new o.P(Number.MAX_VALUE,Number.MAX_VALUE)}_getBoundsNonRectangular(){const{top:r,left:s}=this._edgeInsets,u=this.height-this._edgeInsets.bottom,d=this.width-this._edgeInsets.right,f=this.pointLocation3D(new o.P(s,r)),_=this.pointLocation3D(new o.P(d,r)),y=this.pointLocation3D(new o.P(d,u)),b=this.pointLocation3D(new o.P(s,u));let T=Math.min(f.lng,_.lng,y.lng,b.lng),S=Math.max(f.lng,_.lng,y.lng,b.lng),A=Math.min(f.lat,_.lat,y.lat,b.lat),C=Math.max(f.lat,_.lat,y.lat,b.lat);const P=Math.pow(2,-this.zoom)/16*270,L=this.projection.name==="globe"?1:4,R=(k,O,N,$,Z)=>{const Q=(k+N)/2,B=(O+$)/2,U=new o.P(Q,B),{lng:K,lat:Y}=this.pointLocation3D(U),re=Math.max(0,T-K,A-Y,K-S,Y-C);T=Math.min(T,K),S=Math.max(S,K),A=Math.min(A,Y),C=Math.max(C,Y),(Z<L||re>P)&&(R(k,O,Q,B,Z+1),R(Q,B,N,$,Z+1))};if(R(s,r,d,r,1),R(d,r,d,u,1),R(d,u,s,u,1),R(s,u,s,r,1),this.projection.name==="globe"){const[k,O]=o.bB(this);k?(C=90,S=180,T=-180):O&&(A=-90,S=180,T=-180)}return new o.ag(new o.bq(T,A),new o.bq(S,C))}_getBoundsRectangular(r,s){const{top:u,left:d}=this._edgeInsets,f=this.height-this._edgeInsets.bottom,_=this.width-this._edgeInsets.right,y=new o.P(d,u),b=new o.P(_,u),T=new o.P(_,f),S=new o.P(d,f);let A=this.pointCoordinate(y,r),C=this.pointCoordinate(b,r);const P=this.pointCoordinate(T,s),L=this.pointCoordinate(S,s),R=(k,O)=>(O.y-k.y)/(O.x-k.x);return A.y>1&&C.y>=0?A=new o.O((1-L.y)/R(L,A)+L.x,1):A.y<0&&C.y<=1&&(A=new o.O(-L.y/R(L,A)+L.x,0)),
vendor: 5,780 bytes, line 14
14C.y>1&&A.y>=0?C=new o.O((1-P.y)/R(P,C)+P.x,1):C.y<0&&A.y<=1&&(C=new o.O(-P.y/R(P,C)+P.x,0)),new o.ag().extend(this.coordinateLocation(A)).extend(this.coordinateLocation(C)).extend(this.coordinateLocation(L)).extend(this.coordinateLocation(P))}_getBoundsRectangularTerrain(){const r=this.elevation;if(!r.visibleDemTiles.length||r.isUsingMockSource())return this._getBoundsRectangular(0,0);const s=r.visibleDemTiles.reduce((u,d)=>{if(d.dem){const f=d.dem.tree;u.min=Math.min(u.min,f.minimums[0]),u.max=Math.max(u.max,f.maximums[0])}return u},{min:Number.MAX_VALUE,max:0});return this._getBoundsRectangular(s.min*r.exaggeration(),s.max*r.exaggeration())}getBounds(){return this.projection.name==="mercator"||this.projection.name==="equirectangular"?this._terrainEnabled()?this._getBoundsRectangularTerrain():this._getBoundsRectangular(0,0):this._getBoundsNonRectangular()}horizonLineFromTop(r=!0){const s=this.height/2/Math.tan(this._fov/2)/Math.tan(Math.max(this._pitch,.1))-this.centerOffset.y,u=this.height/2-s*(1-this._horizonShift);return r?Math.max(0,u):u}getMaxBounds(){return this.maxBounds}setMaxBounds(r){this.maxBounds=r,this.minLat=-o.bz,this.maxLat=o.bz,this.minLng=-180,this.maxLng=180,r&&(this.minLat=r.getSouth(),this.maxLat=r.getNorth(),this.minLng=r.getWest(),this.maxLng=r.getEast(),this.maxLng<this.minLng&&(this.maxLng+=360)),this.worldMinX=o.a8(this.minLng)*this.tileSize,this.worldMaxX=o.a8(this.maxLng)*this.tileSize,this.worldMinY=o.ah(this.maxLat)*this.tileSize,this.worldMaxY=o.ah(this.minLat)*this.tileSize,this._constrain()}calculatePosMatrix(r,s){return this.projection.createTileMatrix(this,s,r)}calculateDistanceTileData(r){const s=r.key,u=this._distanceTileDataCache;if(u[s])return u[s];const d=r.canonical,f=1/this.height,_=this.cameraWorldSize,y=_/this.zoomScale(d.z),b=(d.x+Math.pow(2,d.z)*r.wrap)*y,T=d.y*y,S=this.point;S.x*=_/this.worldSize,S.y*=_/this.worldSize;const A=this.angle,C=Math.sin(-A),P=-Math.cos(-A);return u[s]={bearing:[C,P],center:[(S.x-b)*f,(S.y-T)*f],scale:y/o.Y*f},u[s]}calculateFogTileMatrix(r){const s=r.key,u=this._fogTileMatrixCache;if(u[s])return u[s];const d=this.projection.createTileMatrix(this,this.cameraWorldSizeForFog,r);return o.a9.multiply(d,this.worldToFogMatrix,d),u[s]=new Float32Array(d),u[s]}calculateProjMatrix(r,s=!1,u=!1){const d=r.key;let f;if(f=u?this._expandedProjMatrixCache:s?this._alignedProjMatrixCache:this._projMatrixCache,f[d])return f[d];const _=this.calculatePosMatrix(r,this.worldSize);let y;return y=this.projection.isReprojectedInTileSpace?this.mercatorMatrix:u?this.expandedFarZProjMatrix:s?this.alignedProjMatrix:this.projMatrix,o.a9.multiply(_,y,_),f[d]=new Float32Array(_),f[d]}calculatePixelsToTileUnitsMatrix(r){const s=r.tileID.key,u=this._pixelsToTileUnitsCache;if(u[s])return u[s];const d=o.bC(r,this);return u[s]=d,u[s]}customLayerMatrix(){return this.mercatorMatrix.slice()}globeToMercatorMatrix(){if(this.projection.name==="globe"){const r=1/this.worldSize,s=o.a9.fromScaling([],[r,r,r]);return o.a9.multiply(s,s,this.globeMatrix),s}}recenterOnTerrain(){if(!this._elevation||this.projection.name==="globe")return;const r=this._elevation;this._updateCameraState();const s=o.bo(1,this._center.lat)*this.worldSize,u=this._computeCameraPosition(s),d=this._camera.forward(),f=o.bo(1,this._center.lat);u[2]/=f,d[2]/=f,o.Q.normalize(d,d);const _=r.raycast(u,d,r.exaggeration());if(_){const y=o.Q.scaleAndAdd([],u,d,_),b=new o.O(y[0],y[1],o.bo(y[2],o.ax(y[1]))),T=(b.z+o.Q.length([b.x-u[0],b.y-u[1],b.z-u[2]*f]))*this._pixelsPerMercatorPixel;this._seaLevelZoom=this._zoomFromMercatorZ(T),this._centerAltitude=b.toAltitude(),this._center=this.coordinateLocation(b),this._updateZoomFromElevation(),this._constrain(),this._calcMatrices()}}_constrainCamera(r=!1){if(!this._elevation)return;const s=this._elevation,u=o.bo(1,this._center.lat)*this.worldSize,d=this._computeCameraPosition(u),f=s.getAtPointOrZero(new o.O(...d)),_=this.pixelsPerMeter/this.worldSize*f,y=this._minimumHeightOverTerrain(),b=d[2]-_;if(b<=y)if(b<0||r){const T=this.locationCoordinate(this._center,this._centerAltitude),S=[d[0],d[1],T.z-d[2]],A=o.Q.length(S);S[2]-=(y-b)/this._pixelsPerMercatorPixel;const C=o.Q.length(S);if(C===0)return;o.Q.scale(S,S,A/C*this._pixelsPerMercatorPixel),this._camera.position=[d[0],d[1],T.z*this._pixelsPerMercatorPixel-S[2]],this._updateStateFromCamera()}else this._isCameraConstrained=!0}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;const r=this.projection.name==="globe"||this.mercatorFromTransition;if(this.projection.isReprojectedInTileSpace||r){const C=this.center;return C.lat=o.ad(C.lat,this.minLat,this.maxLat),(this.maxBounds||!this.renderWorldCopies&&!r)&&(C.lng=o.ad(C.lng,this.minLng,this.maxLng)),this.center=C,void(this._constraining=!1)}const s=this._unmodified,{x:u,y:d}=this.point;let f=0,_=u,y=d;const b=this.width/2,T=this.height/2,S=this.worldMinY*this.scale,A=this.worldMaxY*this.scale;if(d-T<S&&(y=S+T),d+T>A&&(y=A-T),A-S<this.height&&(f=Math.max(f,this.height/(A-S)),y=(A+S)/2),this.maxBounds||!this._renderWorldCopies||!this.projection.wrap){const C=this.worldMinX*this.scale,P=this.worldMaxX*this.scale,L=this.worldSize/2-(C+P)/2;_=(u+L+this.worldSize)%this.worldSize-L,_-b<C&&(_=C+b),_+b>P&&(_=P-b),P-C<this.width&&(f=Math.max(f,this.width/(P-C)),_=(P+C)/2)}_===u&&y===d||(this.center=this.unproject(new o.P(_,y))),f&&(this.zoom+=this.scaleZoom(f)),this._constrainCamera(),this._unmodified=s,this._constraining=!1}_minZoomForBounds(){let r=Math.max(0,this.scaleZoom(this.height/(this.worldMaxY-this.worldMinY)));return this.maxBounds&&(r=Math.max(r,this.scaleZoom(this.width/(this.worldMaxX-this.worldMinX)))),r}_maxCameraBoundsDistance(){return this._mercatorZfromZoom(this._minZoomForBounds())}
14_calcMatrices(){if(!this.height)return;const r=this.centerOffset,s=this.projection.name==="globe",u=this.pixelsPerMeter;this.projection.name==="globe"&&(this._mercatorScaleRatio=o.bo(1,this.center.lat)/o.bo(1,o.bL));const d=o.bD(this.projection,this.zoom,this.width,this.height,1024);this._pixelsPerMercatorPixel=this.projection.pixelSpaceConversion(this.center.lat,this.worldSize,d),this.cameraToCenterDistance=.5/Math.tan(.5*this._fov)*this.height*this._pixelsPerMercatorPixel,this._updateCameraState(),this._farZ=this.projection.farthestPixelDistance(this),this._nearZ=this.height/50;const f=this.projection.zAxisUnit==="meters"?u:1,_=this._camera.getWorldToCamera(this.worldSize,f);let y;const b=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,this._farZ);if(b[8]=2*-r.x/this.width,b[9]=2*r.y/this.height,this.isOrthographic){let Y=.5*this.height/Math.tan(this._fov/2)*1*Math.tan(.5*this._fov),re=Y*this.aspect,he=-re,ie=-Y;re-=r.x,he-=r.x,Y+=r.y,ie+=r.y,y=this._camera.getCameraToClipOrthographic(he,re,ie,Y,this._nearZ,this._farZ),((ce,pe,te,ae)=>{for(let Me=0;Me<16;Me++)ce[Me]=Nc(pe[Me],te[Me],ae)})(y,y,b,Ks(this.pitch>=15?1:this.pitch/15))}else y=b;const T=o.a9.mul([],b,_);let S=o.a9.mul([],y,_);if(this.projection.isReprojectedInTileSpace){const Y=this.locationCoordinate(this.center),re=o.a9.identity([]);o.a9.translate(re,re,[Y.x*this.worldSize,Y.y*this.worldSize,0]),o.a9.multiply(re,re,o.bE(this)),o.a9.translate(re,re,[-Y.x*this.worldSize,-Y.y*this.worldSize,0]),o.a9.multiply(S,S,re),o.a9.multiply(T,T,re),this.inverseAdjustmentMatrix=o.bF(this)}else this.inverseAdjustmentMatrix=[1,0,0,1];if(this.mercatorMatrix=o.a9.scale([],S,[this.worldSize,this.worldSize,this.worldSize/f,1]),this.projMatrix=S,this.invProjMatrix=o.a9.invert(new Float64Array(16),this.projMatrix),s){const Y=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,1/0);Y[8]=2*-r.x/this.width,Y[9]=2*r.y/this.height,this.expandedFarZProjMatrix=o.a9.mul([],Y,_)}else this.expandedFarZProjMatrix=this.projMatrix;const A=o.a9.invert([],y);this.frustumCorners=o.bG.fromInvProjectionMatrix(A,this.horizonLineFromTop(),this.height),this.cameraFrustum=o.bt.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,0,!s);const C=new Float32Array(16);o.a9.identity(C),o.a9.scale(C,C,[1,-1,1]),o.a9.rotateX(C,C,this._pitch),o.a9.rotateZ(C,C,this.angle);const P=o.a9.perspective(new Float32Array(16),this._fov,this.width/this.height,this._nearZ,this._farZ);this.starsProjMatrix=o.a9.clone(P);const L=(Math.PI/2-this._pitch)*(this.height/this._fov)*this._horizonShift;P[8]=2*-r.x/this.width,P[9]=2*(r.y+L)/this.height,this.skyboxMatrix=o.a9.multiply(C,P,C);const R=this.point,k=R.x,O=R.y,N=this.width%2/2,$=this.height%2/2,Z=Math.cos(this.angle),Q=Math.sin(this.angle),B=k-Math.round(k)+Z*N+Q*$,U=O-Math.round(O)+Z*$+Q*N,K=new Float64Array(S);if(o.a9.translate(K,K,[B>.5?B-1:B,U>.5?U-1:U,0]),this.alignedProjMatrix=K,S=o.a9.create(),o.a9.scale(S,S,[this.width/2,-this.height/2,1]),o.a9.translate(S,S,[1,-1,0]),this.labelPlaneMatrix=S,S=o.a9.create(),o.a9.scale(S,S,[1,-1,1]),o.a9.translate(S,S,[-1,-1,0]),o.a9.scale(S,S,[2/this.width,2/this.height,1]),this.glCoordMatrix=S,this.pixelMatrix=o.a9.multiply(new Float64Array(16),this.labelPlaneMatrix,T),this._calcFogMatrices(),this._distanceTileDataCache={},S=o.a9.invert(new Float64Array(16),this.pixelMatrix),!S)throw new Error("failed to invert matrix");if(this.pixelMatrixInverse=S,this.projection.name==="globe"||this.mercatorFromTransition){this.globeMatrix=o.bH(this);const Y=[this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]];this.globeCenterInViewSpace=o.Q.transformMat4(Y,Y,_),this.globeRadius=this.worldSize/2/Math.PI-1}else this.globeMatrix=S;this._projMatrixCache={},this._alignedProjMatrixCache={},this._pixelsToTileUnitsCache={},this._expandedProjMatrixCache={}}_calcFogMatrices(){this._fogTileMatrixCache={};const r=this.cameraWorldSizeForFog,s=this.cameraPixelsPerMeter,u=this._camera.position,d=1/this.height/this._pixelsPerMercatorPixel,f=[r,r,s];o.Q.scale(f,f,d),o.Q.scale(u,u,-1),o.Q.multiply(u,u,f);const _=o.a9.create();o.a9.translate(_,_,u),o.a9.scale(_,_,f),this.mercatorFogMatrix=_,this.worldToFogMatrix=this._camera.getWorldToCameraPosition(r,s,d)}_computeCameraPosition(r){const s=(r=r||this.pixelsPerMeter)/this.pixelsPerMeter,u=this._camera.forward(),d=this.point,f=this._mercatorZfromZoom(this._seaLevelZoom?this._seaLevelZoom:this._zoom)*s-r/this.worldSize*this._centerAltitude;return[d.x/this.worldSize-u[0]*f,d.y/this.worldSize-u[1]*f,r/this.worldSize*this._centerAltitude-u[2]*f]}_updateCameraState(){this.height&&(this._camera.setPitchBearing(this._pitch,this.angle),this._camera.position=this._computeCameraPosition())}_translateCameraConstrained(r){const s=this._maxCameraBoundsDistance()*Math.cos(this._pitch),u=this._camera.position[2],d=r[2];let f=1;this.projection.wrap&&(this.center=this.center.wrap()),d>0&&(f=Math.min((s-u)/d,1)),this._camera.position=o.Q.scaleAndAdd([],this._camera.position,r,f),this._updateStateFromCamera()}_updateStateFromCamera(){const r=this._camera.position,s=this._camera.forward(),{pitch:u,bearing:d}=this._camera.getPitchBearing(),f=o.bo(this._centerAltitude,this.center.lat)*this._pixelsPerMercatorPixel,_=this._mercatorZfromZoom(this._maxZoom)*Math.cos(o.bm(this._maxPitch)),y=Math.max((r[2]-f)/Math.cos(u),_),b=this._zoomFromMercatorZ(y);o.Q.scaleAndAdd(r,r,s,y),this._pitch=o.ad(u,o.bm(this.minPitch),o.bm(this.maxPitch)),this.angle=o.bk(d,-Math.PI,Math.PI),this._setZoom(o.ad(b,this._minZoom,this._maxZoom)),this._updateSeaLevelZoom(),this._center=this.coordinateLocation(new o.O(r[0],r[1],r[2])),this._unmodified=!1,this._constrain(),this._calcMatrices()}_worldSizeFromZoom(r){return Math.pow(2,r)*this.tileSize}_mercatorZfromZoom(r){return this.cameraToCenterDistance/this._worldSizeFromZoom(r)}_minimumHeightOverTerrain(){const r=Math.min(this._seaLevelZoom!=null?this._seaLevelZoom:this._zoom,this._maxZoom)+4;return this._mercatorZfromZoom(r)}_zoomFromMercatorZ(r){return this.scaleZoom(this.cameraToCenterDistance/(r*this.tileSize))}zoomFromMercatorZAdjusted(r){let s=0,u=o.bA,d=0,f=1/0;for(;u-s>1e-6&&u>s;){const _=s+.5*(u-s),y=this.tileSize*Math.pow(2,_),b=this.getCameraToCenterDistance(this.projection,_,y),T=this.scaleZoom(b/(r*this.tileSize)),S=Math.abs(_-T);S<f&&(f=S,d=_),_<T?s=_:u=_}return d}_terrainEnabled(){return!(!this._elevation||!this.projection.supportsTerrain&&(o.w("Terrain is not yet supported with alternate projections. Use mercator or globe to enable terrain."),1))}anyCornerOffEdge(r,s){const u=Math.min(r.x,s.x),d=Math.max(r.x,s.x),f=Math.min(r.y,s.y),_=Math.max(r.y,s.y);if(f<this.horizonLineFromTop(!1))return!0;
14if(this.projection.name!=="mercator")return!1;const y=[new o.P(u,f),new o.P(d,_),new o.P(u,_),new o.P(d,f)],b=this.renderWorldCopies?-3:0,T=this.renderWorldCopies?4:1;for(const S of y){const A=this.pointRayIntersection(S);if(A.t<0)return!0;const C=this.rayIntersectionCoordinate(A);if(C.x<b||C.y<0||C.x>T||C.y>1)return!0}return!1}isHorizonVisible(){return this.pitch+o.bI(this.fovAboveCenter)>88||this.anyCornerOffEdge(new o.P(0,0),new o.P(this.width,this.height))}zoomDeltaToMovement(r,s){const u=o.Q.length(o.Q.sub([],this._camera.position,r)),d=this._zoomFromMercatorZ(u)+s;return u-this._mercatorZfromZoom(d)}getCameraPoint(){if(this.projection.name==="globe"){const r=function([s,u,d],f){const _=[s,u,d,1];o.aa.transformMat4(_,_,f);const y=_[3]=Math.max(_[3],1e-6);return _[0]/=y,_[1]/=y,_[2]/=y,_}([this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]],this.pixelMatrix);return new o.P(r[0],r[1])}{const r=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new o.P(0,r))}}getCameraToCenterDistance(r,s=this.zoom,u=this.worldSize){const d=o.bD(r,s,this.width,this.height,1024),f=r.pixelSpaceConversion(this.center.lat,u,d);let _=.5/Math.tan(.5*this._fov)*this.height*f;return this.isOrthographic&&(_=Nc(1,_,Ks(this.pitch>=15?1:this.pitch/15))),_}getWorldToCameraMatrix(){const r=this._camera.getWorldToCamera(this.worldSize,this.projection.zAxisUnit==="meters"?this.pixelsPerMeter:1);return this.projection.name==="globe"&&o.a9.multiply(r,r,this.globeMatrix),r}getFrustum(r){return o.bt.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,r,this.projection.zAxisUnit==="meters")}}const Tr={BaseColor:5,MetallicRoughness:6,Normal:7,Occlusion:8,Emission:9,ShadowMap0:10},Yn=(c,r)=>{if(r>0&&c.terrain&&o.w("Cutoff is currently disabled on terrain"),r<=0||c.terrain)return{shouldRenderCutoff:!1,uniformValues:{u_cutoff_params:[0,0,0,1]}};const s=c.transform,u=Math.max(Math.abs(s._zoom-(c.minCutoffZoom-1)),1),d=s.isLODDisabled(!1)?o.S(60,45,s.pitch):o.S(30,15,s.pitch),f=s._farZ-s._nearZ,_=r*s.height,y=((1-(b=d))*s.cameraToCenterDistance+b*(s._farZ+_))*u;var b;return{shouldRenderCutoff:d<1,uniformValues:{u_cutoff_params:[s._nearZ,s._farZ,(y-s._nearZ)/f,(y-_-s._nearZ)/f]}}},Er={cascadeCount:2,shadowMapResolution:2048};class Mh{constructor(r,s){this.aabb=r,this.lastCascade=s}}class _p{add(r,s){const u=this.receivers[r.key];u!==void 0?(u.aabb.min[0]=Math.min(u.aabb.min[0],s.min[0]),u.aabb.min[1]=Math.min(u.aabb.min[1],s.min[1]),u.aabb.min[2]=Math.min(u.aabb.min[2],s.min[2]),u.aabb.max[0]=Math.max(u.aabb.max[0],s.max[0]),u.aabb.max[1]=Math.max(u.aabb.max[1],s.max[1]),u.aabb.max[2]=Math.max(u.aabb.max[2],s.max[2])):this.receivers[r.key]=new Mh(s,null)}clear(){this.receivers={}}get(r){return this.receivers[r.key]}computeRequiredCascades(r,s,u){const d=o.bV.fromPoints(r.points);let f=0;for(const _ in this.receivers){const y=this.receivers[_];if(!y||!d.intersectsAabb(y.aabb))continue;y.aabb.min=d.closestPoint(y.aabb.min),y.aabb.max=d.closestPoint(y.aabb.max);const b=y.aabb.getCorners();for(let T=0;T<u.length;T++){let S=!0;for(const A of b){const C=[A[0]*s,A[1]*s,A[2]];if(o.Q.transformMat4(C,C,u[T].matrix),C[0]<-1||C[0]>1||C[1]<-1||C[1]>1){S=!1;break}}if(y.lastCascade=T,f=Math.max(f,T),S)break}}return f+1}}class Ah{constructor(r){this.painter=r,this._enabled=!1,this._shadowLayerCount=0,this._numCascadesToRender=0,this._cascades=[],this._groundShadowTiles=[],this._receivers=new _p,this._depthMode=new lt(r.context.gl.LEQUAL,lt.ReadWrite,[0,1]),this._uniformValues={u_light_matrix_0:new Float32Array(16),u_light_matrix_1:new Float32Array(16),u_shadow_intensity:0,u_fade_range:[0,0],u_shadow_normal_offset:[1,1,1],u_shadow_texel_size:1,u_shadow_map_resolution:1,u_shadow_direction:[0,0,1],u_shadow_bias:[36e-5,.0012,.012],u_shadowmap_0:0,u_shadowmap_1:0},this._forceDisable=!1,this.useNormalOffset=!1,r.tp.registerParameter(this,["Shadows"],"_forceDisable",{label:"forceDisable"},()=>{this.painter.style.map.triggerRepaint()}),r.tp.registerParameter(Er,["Shadows"],"cascadeCount",{min:1,max:2,step:1}),r.tp.registerParameter(Er,["Shadows"],"shadowMapResolution",{min:32,max:2048,step:32}),r.tp.registerBinding(this,["Shadows"],"_numCascadesToRender",{readonly:!0,label:"numCascadesToRender"})}destroy(){for(const r of this._cascades)r.texture.destroy(),r.framebuffer.destroy();this._cascades=[]}updateShadowParameters(r,s){const u=this.painter;if(this._enabled=!1,this._shadowLayerCount=0,this._receivers.clear(),!s||!s.properties)return;const d=s.properties.get("shadow-intensity");if(!s.shadowsEnabled()||d<=0||(this._shadowLayerCount=u.style.order.reduce((L,R)=>{const k=u.style._mergedLayers[R];return L+(k.hasShadowPass()&&!k.isHidden(r.zoom)?1:0)},0),this._enabled=this._shadowLayerCount>0,!this.enabled))return;const f=u.context,_=Er.shadowMapResolution,y=Er.shadowMapResolution;if(this._cascades.length===0||Er.shadowMapResolution!==this._cascades[0].texture.size[0]){this._cascades=[];for(let L=0;L<Er.cascadeCount;++L){const R=u._shadowMapDebug,k=f.gl,O=f.createFramebuffer(_,y,R,"texture"),N=new o.T(f,{width:_,height:y,data:null},k.DEPTH_COMPONENT);if(O.depthAttachment.set(N.texture),R){const $=new o.T(f,{width:_,height:y,data:null},k.RGBA);O.colorAttachment.set($.texture)}this._cascades.push({framebuffer:O,texture:N,matrix:[],far:0,boundingSphereRadius:0,frustum:new o.bt,scale:0})}}this.shadowDirection=yl(s);let b=0;if(r.elevation){const L=r.elevation,R=[1e4,-1e4];L.visibleDemTiles.filter(k=>k.dem).forEach(k=>{const O=k.dem.tree;R[0]=Math.min(R[0],O.minimums[0]),R[1]=Math.max(R[1],O.maximums[0])}),R[0]!==1e4&&(b=(R[1]-R[0])*L.exaggeration())}
vendor: 2,077 bytes, line 14
14const T=1.5*r.cameraToCenterDistance,S=3*T,A=new Float64Array(16);for(let L=0;L<this._cascades.length;++L){const R=this._cascades[L];let k=r.height/50,O=1;Er.cascadeCount===1?O=S:L===0?O=T:(k=T,O=S);const[N,$]=xl(r,this.shadowDirection,k,O,Er.shadowMapResolution,b);R.scale=r.scale,R.matrix=N,R.boundingSphereRadius=$,o.a9.invert(A,R.matrix),R.frustum=o.bt.fromInvProjectionMatrix(A,1,0,!0),R.far=O}const C=this._cascades.length-1;this._uniformValues.u_fade_range=[.75*this._cascades[C].far,this._cascades[C].far],this._uniformValues.u_shadow_intensity=d,this._uniformValues.u_shadow_direction=[this.shadowDirection[0],this.shadowDirection[1],this.shadowDirection[2]],this._uniformValues.u_shadow_texel_size=1/Er.shadowMapResolution,this._uniformValues.u_shadow_map_resolution=Er.shadowMapResolution,this._uniformValues.u_shadowmap_0=Tr.ShadowMap0,this._uniformValues.u_shadowmap_1=Tr.ShadowMap0+1,this._groundShadowTiles=u.transform.coveringTiles({tileSize:512,renderWorldCopies:!0});const P=u.transform.elevation;for(const L of this._groundShadowTiles){let R={min:0,max:0};if(P){const k=P.getMinMaxForTile(L);k&&(R=k)}this.addShadowReceiver(L.toUnwrapped(),R.min,R.max)}}get enabled(){return this._enabled&&!this._forceDisable}set enabled(r){this._enabled=r}drawShadowPass(r,s){if(!this.enabled)return;const u=this.painter,d=u.context;this._numCascadesToRender=this._receivers.computeRequiredCascades(u.transform.getFrustum(0),u.transform.worldSize,this._cascades),d.viewport.set([0,0,Er.shadowMapResolution,Er.shadowMapResolution]);for(let f=0;f<this._numCascadesToRender;++f){u.currentShadowCascade=f,d.bindFramebuffer.set(this._cascades[f].framebuffer.framebuffer),d.clear({color:o.aA.white,depth:1});for(const _ of r.order){const y=r._mergedLayers[_];if(!y.hasShadowPass()||y.isHidden(u.transform.zoom))continue;const b=r.getLayerSourceCache(y),T=b?s[b.id]:void 0;(y.type==="model"||T&&T.length)&&u.renderLayer(u,b,y,T)}}u.currentShadowCascade=0}drawGroundShadows(){if(!this.enabled)return;const r=this.painter,s=r.style,u=r.context,d=s.directionalLight,f=s.ambientLight;
14if(!d||!f)return;const _=[],y=Yn(r,r.longestCutoffRange);y.shouldRenderCutoff&&_.push("RENDER_CUTOFF");const b=Vc(d,f),T=new lt(u.gl.LEQUAL,lt.ReadOnly,r.depthRangeFor3D);for(const S of this._groundShadowTiles){const A=S.toUnwrapped(),C=r.isTileAffectedByFog(S),P=r.getOrCreateProgram("groundShadow",{defines:_,overrideFog:C});this.setupShadows(A,P),r.uploadCommonUniforms(u,P,A,null,y);const L={u_matrix:r.transform.calculateProjMatrix(A),u_ground_shadow_factor:b};P.draw(r,u.gl.TRIANGLES,T,yt.disabled,Pt.multiply,ft.disabled,L,"ground_shadow",r.tileExtentBuffer,r.quadTriangleIndexBuffer,r.tileExtentSegments,{},r.transform.zoom,null,null)}}getShadowPassColorMode(){return this.painter._shadowMapDebug?Pt.unblended:Pt.disabled}getShadowPassDepthMode(){return this._depthMode}getShadowCastingLayerCount(){return this._shadowLayerCount}calculateShadowPassMatrixFromTile(r){const s=this.painter.transform,u=s.calculatePosMatrix(r,s.worldSize);return o.a9.multiply(u,this._cascades[this.painter.currentShadowCascade].matrix,u),Float32Array.from(u)}calculateShadowPassMatrixFromMatrix(r){return o.a9.multiply(r,this._cascades[this.painter.currentShadowCascade].matrix,r),Float32Array.from(r)}setupShadows(r,s,u,d=0){if(!this.enabled)return;const f=this.painter.transform,_=this.painter.context,y=_.gl,b=this._uniformValues,T=new Float64Array(16),S=f.calculatePosMatrix(r,f.worldSize);for(let A=0;A<this._cascades.length;A++)o.a9.multiply(T,this._cascades[A].matrix,S),b[A===0?"u_light_matrix_0":"u_light_matrix_1"]=Float32Array.from(T),_.activeTexture.set(y.TEXTURE0+Tr.ShadowMap0+A),this._cascades[A].texture.bind(y.NEAREST,y.CLAMP_TO_EDGE);if(this.useNormalOffset=!!u,this.useNormalOffset){const A=o.bU(r.canonical),C=2/f.tileSize*o.Y/Er.shadowMapResolution,P=C*this._cascades[0].boundingSphereRadius,L=C*this._cascades[this._cascades.length-1].boundingSphereRadius,R=(u==="vector-tile"?1:3)/Math.pow(2,d-r.canonical.z-(1-f.zoom+Math.floor(f.zoom)));b.u_shadow_normal_offset=[A,P*R,L*R],b.u_shadow_bias=[6e-5,.0012,.012]}else b.u_shadow_bias=[36e-5,.0012,.012];s.setShadowUniformValues(_,b)}setupShadowsFromMatrix(r,s,u=!1){if(!this.enabled)return;const d=this.painter.context,f=d.gl,_=this._uniformValues,y=new Float64Array(16);for(let b=0;b<Er.cascadeCount;b++)o.a9.multiply(y,this._cascades[b].matrix,r),_[b===0?"u_light_matrix_0":"u_light_matrix_1"]=Float32Array.from(y),d.activeTexture.set(f.TEXTURE0+Tr.ShadowMap0+b),this._cascades[b].texture.bind(f.NEAREST,f.CLAMP_TO_EDGE);this.useNormalOffset=u,u?(_.u_shadow_normal_offset=[1,5,5],_.u_shadow_bias=[6e-5,.0012,.012]):_.u_shadow_bias=[36e-5,.0012,.012],s.setShadowUniformValues(d,_)}getShadowUniformValues(){return this._uniformValues}getCurrentCascadeFrustum(){return this._cascades[this.painter.currentShadowCascade].frustum}computeSimplifiedTileShadowVolume(r,s,u,d){if(d[2]>=0)return{};const f=function(b,T,S){const A=S/(1<<b.canonical.z);return new o.bV([b.canonical.x*A+b.wrap*S,b.canonical.y*A+b.wrap*S,0],[(b.canonical.x+1)*A+b.wrap*S,(b.canonical.y+1)*A+b.wrap*S,T])}(r,s,u).getCorners(),_=s/-d[2];d[0]<0?(o.Q.add(f[0],f[0],[d[0]*_,0,0]),o.Q.add(f[3],f[3],[d[0]*_,0,0])):d[0]>0&&(o.Q.add(f[1],f[1],[d[0]*_,0,0]),o.Q.add(f[2],f[2],[d[0]*_,0,0])),d[1]<0?(o.Q.add(f[0],f[0],[0,d[1]*_,0]),o.Q.add(f[1],f[1],[0,d[1]*_,0])):d[1]>0&&(o.Q.add(f[2],f[2],[0,d[1]*_,0]),o.Q.add(f[3],f[3],[0,d[1]*_,0]));const y={};return y.vertices=f,y.planes=[gl(f[1],f[0],f[4]),gl(f[2],f[1],f[5]),gl(f[3],f[2],f[6]),gl(f[0],f[3],f[7])],y}addShadowReceiver(r,s,u){this._receivers.add(r,o.bV.fromTileIdAndHeight(r,s,u))}getMaxCascadeForTile(r){const s=this._receivers.get(r);return s&&s.lastCascade?s.lastCascade:0}}function gl(c,r,s){const u=o.Q.sub([],s,r),d=o.Q.sub([],c,r),f=o.Q.cross([],u,d),_=o.Q.length(f);return _===0?[0,0,1,0]:(o.Q.scale(f,f,1/_),[f[0],f[1],f[2],-o.Q.dot(f,r)])}function yl(c){const r=c.properties.get("direction"),s=o.bT(r.x,r.y,r.z);s[2]=o.ad(s[2],0,75);const u=o.bW([s[0],s[1],s[2]]);return o.Q.fromValues(u.x,u.y,u.z)}function Vc(c,r){const s=c.properties.get("color"),u=c.properties.get("intensity"),d=c.properties.get("direction"),f=[d.x,d.y,d.z],_=r.properties.get("color"),y=r.properties.get("intensity"),b=Math.max(o.Q.dot([0,0,1],f),0),T=[0,0,0];o.Q.scale(T,_.toArray01Linear().slice(0,3),y);const S=[0,0,0];return o.Q.scale(S,s.toArray01Linear().slice(0,3),b*u),o.bX([T[0]>0?T[0]/(T[0]+S[0]):0,T[1]>0?T[1]/(T[1]+S[1]):0,T[2]>0?T[2]/(T[2]+S[2]):0])}function xl(c,r,s,u,d,f){const _=c.zoom,y=c.scale,b=c.worldSize,T=1/b,S=c.aspect,A=Math.sqrt(1+S*S)*Math.tan(.5*c.fovX),C=A*A,P=u-s,L=u+s;let R,k;C>P/L?(R=u,k=u*A):(R=.5*L*(1+C),k=.5*Math.sqrt(P*P+2*(u*u+s*s)*C+L*L*C*C));
14const O=c.projection.pixelsPerMeter(c.center.lat,b),N=c._camera.getCameraToWorldMercator(),$=[0,0,-R*T];o.Q.transformMat4($,$,N);let Z=k*T;const Q=c._edgeInsets;if(!(Q.left===0&&Q.top===0&&Q.right===0&&Q.bottom===0||Q.left===Q.right&&Q.top===Q.bottom)){const W=c._camera.getWorldToCamera(c.worldSize,c.projection.zAxisUnit==="meters"?O:1),xe=c._camera.getCameraToClipPerspective(c._fov,c.width/c.height,s,u);xe[8]=2*-c.centerOffset.x/c.width,xe[9]=2*c.centerOffset.y/c.height;const Ge=new Float64Array(16);o.a9.mul(Ge,xe,W);const Xe=new Float64Array(16);o.a9.invert(Xe,Ge);const nt=o.bt.fromInvProjectionMatrix(Xe,b,_,!0);for(const et of nt.points){const at=((B=et)[0]/=y,B[1]/=y,B[2]=o.bo(B[2],c._center.lat),B);Z=Math.max(Z,o.Q.len(o.Q.subtract([],$,at)))}}var B;Z*=d/(d-1);const U=Math.acos(r[2]),K=Math.atan2(-r[0],-r[1]),Y=new Jo;Y.position=$,Y.setPitchBearing(U,K);const re=Y.getWorldToCamera(b,O),he=Z*b,ie=Math.min(c._mercatorZfromZoom(17)*b*-2,-2*he),ce=Y.getCameraToClipOrthographic(-he,he,-he,he,ie,(he+f*O)/r[2]),pe=new Float64Array(16);o.a9.multiply(pe,ce,re);const te=o.Q.fromValues(Math.floor(1e6*$[0])/1e6*b,Math.floor(1e6*$[1])/1e6*b,0),ae=.5*d,Me=[0,0,0];o.Q.transformMat4(Me,te,pe),o.Q.scale(Me,Me,ae);const se=[Math.floor(Me[0]),Math.floor(Me[1]),Math.floor(Me[2])],ue=[0,0,0];o.Q.sub(ue,Me,se),o.Q.scale(ue,ue,-1/ae);const de=new Float64Array(16);return o.a9.identity(de),o.a9.translate(de,de,ue),o.a9.multiply(pe,de,pe),[pe,he]}const gn=(c,r)=>He(c,r&&r.filter(s=>s.identifier!=="source.canvas")),Ih=o.af(Qt,["addLayer","removeLayer","setLights","setPaintProperty","setLayoutProperty","setSlot","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setTerrain","setFog","setProjection","setCamera","addImport","removeImport","updateImport"]),gp=o.af(Qt,["setCenter","setZoom","setBearing","setPitch"]),Uc={version:8,layers:[],sources:{}},jc={duration:300,delay:0};class sn extends o.E{constructor(r,s={}){super(),this.map=r,this.scope=s.scope||"",this.globalId=null,this.fragments=[],this.importDepth=s.importDepth||0,this.importsCache=s.importsCache||new Map,this.resolvedImports=s.resolvedImports||new Set,this.transition=o.e({},jc),this._buildingIndex=new Ac(this),this.crossTileSymbolIndex=new Bc,this._mergedOrder=[],this._drapedFirstOrder=[],this._mergedLayers={},this._mergedSourceCaches={},this._mergedOtherSourceCaches={},this._mergedSymbolSourceCaches={},this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this._changes=s.styleChanges||new mi,this.dispatcher=s.dispatcher?s.dispatcher:new o.bZ(o.b_(),this),s.imageManager?this.imageManager=s.imageManager:(this.imageManager=new Bo,this.imageManager.setEventedParent(this)),this.imageManager.createScope(this.scope),this.glyphManager=s.glyphManager?s.glyphManager:new o.b$(r._requestManager,s.localFontFamily?o.c0.all:s.localIdeographFontFamily?o.c0.ideographs:o.c0.none,s.localFontFamily||s.localIdeographFontFamily),s.modelManager?this.modelManager=s.modelManager:(this.modelManager=new Ns(r._requestManager),this.modelManager.setEventedParent(this)),this._layers={},this._serializedLayers={},this._sourceCaches={},this._otherSourceCaches={},this._symbolSourceCaches={},this._loaded=!1,this._precompileDone=!1,this._shouldPrecompile=!1,this._availableImages=[],this._order=[],this._markersNeedUpdate=!1,this.options=s.configOptions?s.configOptions:new Map,this._configDependentLayers=s.configDependentLayers?s.configDependentLayers:new Set,this._config=s.config,this._initialConfig=s.initialConfig,this.dispatcher.broadcast("setReferrer",o.c1());const u=this;this._rtlTextPluginCallback=sn.registerForPluginStateChange(d=>{u.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:d.pluginStatus,pluginURL:d.pluginURL},(f,_)=>{if(o.c2(f),_&&_.every(y=>y))for(const y in u._sourceCaches){const b=u._sourceCaches[y],T=b.getSource().type;T!=="vector"&&T!=="geojson"||b.reload()}})}),this.on("data",d=>{if(d.dataType!=="source"||d.sourceDataType!=="metadata")return;const f=this.getOwnSource(d.sourceId);if(f&&f.vectorLayerIds)for(const _ in this._layers){const y=this._layers[_];
14y.source===f.id&&this._validateLayer(y)}})}load(r){return r?(typeof r=="string"?this.loadURL(r):this.loadJSON(r),this):this}_getGlobalId(r){if(!r)return null;if(typeof r=="string"){if(o.c3(r))return r;const s=o.c4(r);if(!s.startsWith("http"))try{return new URL(s,location.href).toString()}catch{return s}return s}return`json://${o.c5(JSON.stringify(r))}`}_diffStyle(r,s,u){this.globalId=this._getGlobalId(r);const d=(f,_)=>{try{_(null,this.setState(f,u))}catch(y){_(y,!1)}};if(typeof r=="string"){const f=this.map._requestManager.normalizeStyleURL(r),_=this.map._requestManager.transformRequest(f,o.R.Style);o.g(_,(y,b)=>{y?this.fire(new o.a(y)):b&&d(b,s)})}else typeof r=="object"&&d(r,s)}loadURL(r,s={}){this.fire(new o.b("dataloading",{dataType:"style"}));const u=typeof s.validate=="boolean"?s.validate:!o.c3(r);this.globalId=this._getGlobalId(r),r=this.map._requestManager.normalizeStyleURL(r,s.accessToken),this.resolvedImports.add(r);const d=this.importsCache.get(r);if(d)return this._load(d,u);const f=this.map._requestManager.transformRequest(r,o.R.Style);this._request=o.g(f,(_,y)=>{if(this._request=null,_)this.fire(new o.a(_));else if(y)return this.importsCache.set(r,y),this._load(y,u)})}loadJSON(r,s={}){this.fire(new o.b("dataloading",{dataType:"style"})),this.globalId=this._getGlobalId(r),this._request=o.f.frame(()=>{this._request=null,this._load(r,s.validate!==!1)})}loadEmpty(){this.fire(new o.b("dataloading",{dataType:"style"})),this._load(Uc,!1)}_loadImports(r,s,u){if(this.importDepth>=4)return o.w("Style doesn't support nesting deeper than 5"),Promise.resolve();const d=[];for(const f of r){const _=this._createFragmentStyle(f),y=new Promise(S=>{_.once("style.import.load",S),_.once("error",S)}).then(()=>this.mergeAll());if(d.push(y),this.resolvedImports.has(f.url)){_.loadEmpty();continue}const b=f.data||this.importsCache.get(f.url);b?(_.loadJSON(b,{validate:s}),this._isInternalStyle(b)&&(_.globalId=null)):f.url?_.loadURL(f.url,{validate:s}):_.loadEmpty();const T={style:_,id:f.id,config:f.config};if(u){const S=this.fragments.findIndex(({id:A})=>A===u);this.fragments=this.fragments.slice(0,S).concat(T).concat(this.fragments.slice(S))}else this.fragments.push(T)}return Promise.allSettled(d)}getImportGlobalIds(r=this,s=new Set){for(const u of r.fragments)u.style.globalId&&s.add(u.style.globalId),this.getImportGlobalIds(u.style,s);return[...s.values()]}_createFragmentStyle(r){const s=this.scope?o.aj(r.id,this.scope):r.id;let u;const d=this._initialConfig&&this._initialConfig[s];(r.config||d)&&(u=o.e({},r.config,d));const f=new sn(this.map,{scope:s,styleChanges:this._changes,importDepth:this.importDepth+1,importsCache:this.importsCache,resolvedImports:new Set(this.resolvedImports),dispatcher:this.dispatcher,imageManager:this.imageManager,glyphManager:this.glyphManager,modelManager:this.modelManager,config:u,configOptions:this.options,configDependentLayers:this._configDependentLayers});return f.setEventedParent(this.map,{style:f}),f}_reloadImports(){this.mergeAll(),this._updateMapProjection(),this.updateConfigDependencies(),this.map._triggerCameraUpdate(this.camera),this.dispatcher.broadcast("setLayers",{layers:this._serializeLayers(this._order),scope:this.scope,options:this.options}),this._shouldPrecompile=this.isRootStyle()}_isInternalStyle(r){return this.isRootStyle()&&(r.fragment||!!r.schema&&r.fragment!==!1)}_load(r,s){const u=r.schema;if(this._isInternalStyle(r)){const y=o.e({},Uc,{imports:[{id:"basemap",data:r,url:""}]});return void this._load(y,s)}if(this.updateConfig(this._config,u),s&&gn(this,dt(r)))return;this._loaded=!0,this.stylesheet=o.c6(r);for(const y in r.sources)this.addSource(y,r.sources[y],{validate:!1,isInitialLoad:!0});r.sprite?this._loadSprite(r.sprite):(this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0})),this.glyphManager.setURL(r.glyphs,this.scope);const d=yh(this.stylesheet.layers);if(this._order=d.map(y=>y.id),this.stylesheet.light&&o.w("The `light` root property is deprecated, prefer using `lights` with `flat` light type instead."),this.stylesheet.lights)if(this.stylesheet.lights.length===1&&this.stylesheet.lights[0].type==="flat"){const y=this.stylesheet.lights[0];this.light=new st(y.properties,y.id)}else this.setLights(this.stylesheet.lights);this.light||(this.light=new st(this.stylesheet.light)),this._layers={},this._serializedLayers={};for(const y of d){const b=o.c7(y,this.scope,this.options);b.isConfigDependent&&this._configDependentLayers.add(b.fqid),b.setEventedParent(this,{layer:{id:b.id}}),this._layers[b.id]=b,this._serializedLayers[b.id]=b.serialize();const T=this.getOwnLayerSourceCache(b),S=!!this.directionalLight&&this.directionalLight.shadowsEnabled();T&&b.canCastShadows()&&S&&(T.castsShadows=!0)}this.stylesheet.models&&this.modelManager.addModels(this.stylesheet.models,this.scope);const f=this.stylesheet.terrain;f&&(this.disableElevatedTerrain===void 0&&(this.disableElevatedTerrain=o.f.hasCanvasFingerprintNoise()),this.disableElevatedTerrain?o.w("Terrain and hillshade are disabled because of Canvas2D limitations when fingerprinting protection is enabled (e.g. in private browsing mode)."):this.terrainSetForDrapingOnly()||this._createTerrain(f,1)),this.stylesheet.fog&&this._createFog(this.stylesheet.fog),this.stylesheet.transition&&this.setTransition(this.stylesheet.transition),this.fire(new o.b("data",{dataType:"style"}));const _=this.isRootStyle();r.imports?this._loadImports(r.imports,s).then(()=>{this._reloadImports(),this.fire(new o.b(_?"style.load":"style.import.load"))}):(this._reloadImports(),this.fire(new o.b(_?"style.load":"style.import.load")))}isRootStyle(){return this.importDepth===0}mergeAll(){let r,s,u,d,f,_,y,b;this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle(T=>{if(T.stylesheet){if(T.light!=null&&(r=T.light),T.stylesheet.lights)for(const S of T.stylesheet.lights)S.type==="ambient"&&T.ambientLight!=null&&(s=T.ambientLight),S.type==="directional"&&T.directionalLight!=null&&(u=T.directionalLight);d=this._prioritizeTerrain(d,T.terrain,T.stylesheet.terrain),T.stylesheet.fog&&T.fog!=null&&(f=T.fog),T.stylesheet.camera!=null&&(b=T.stylesheet.camera),T.stylesheet.projection!=null&&(_=T.stylesheet.projection),T.stylesheet.transition!=null&&(y=T.stylesheet.transition)}}),this.light=r,this.ambientLight=s,this.directionalLight=u,this.fog=f,d===null?delete this.terrain:this.terrain=d,this.camera=b||{"camera-projection":"perspective"},this.projection=_||{name:"mercator"},this.transition=o.e({},jc,y),this.mergeSources(),this.mergeLayers()}forEachFragmentStyle(r){const s=u=>{for(const d of u.fragments)s(d.style);r(u)};s(this)}_prioritizeTerrain(r,s,u){const d=r&&r.drapeRenderMode===0;return u===null?s&&s.drapeRenderMode===0?s:d?r:null:s!=null&&(!r||d||s&&s.drapeRenderMode===1)?s:r}mergeTerrain(){let r;this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle(s=>{r=this._prioritizeTerrain(r,s.terrain,s.stylesheet.terrain)}
14),r===null?delete this.terrain:this.terrain=r}mergeProjection(){let r;this.forEachFragmentStyle(s=>{s.stylesheet.projection!=null&&(r=s.stylesheet.projection)}),this.projection=r||{name:"mercator"}}mergeSources(){const r={},s={},u={};this.forEachFragmentStyle(d=>{for(const f in d._sourceCaches){const _=o.aj(f,d.scope);r[_]=d._sourceCaches[f]}for(const f in d._otherSourceCaches){const _=o.aj(f,d.scope);s[_]=d._otherSourceCaches[f]}for(const f in d._symbolSourceCaches){const _=o.aj(f,d.scope);u[_]=d._symbolSourceCaches[f]}}),this._mergedSourceCaches=r,this._mergedOtherSourceCaches=s,this._mergedSymbolSourceCaches=u}mergeLayers(){const r={},s=[],u={};this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this.forEachFragmentStyle(f=>{for(const _ of f._order){const y=f._layers[_];if(y.type==="slot"){const b=o.c8(_);if(r[b])continue;r[b]=[]}y.slot&&r[y.slot]?r[y.slot].push(y):s.push(y)}}),this._mergedOrder=[];const d=(f=[])=>{for(const _ of f)if(_.type==="slot"){const y=o.c8(_.id);r[y]&&d(r[y])}else{const y=o.aj(_.id,_.scope);this._mergedOrder.push(y),u[y]=_,_.is3D()&&(this._has3DLayers=!0),_.type==="circle"&&(this._hasCircleLayers=!0),_.type==="symbol"&&(this._hasSymbolLayers=!0)}};d(s),this._mergedLayers=u,this.updateDrapeFirstLayers(),this._buildingIndex.processLayersChanged()}terrainSetForDrapingOnly(){return!!this.terrain&&this.terrain.drapeRenderMode===0}getCamera(){return this.stylesheet.camera}setCamera(r){return this.stylesheet.camera=o.e({},this.stylesheet.camera,r),this.camera=this.stylesheet.camera,this}setProjection(r){r?this.stylesheet.projection=r:delete this.stylesheet.projection,this.mergeProjection(),this._updateMapProjection()}applyProjectionUpdate(){this._loaded&&(this.dispatcher.broadcast("setProjection",this.map.transform.projectionOptions),this.map.transform.projection.requiresDraping?(this.getTerrain()||this.stylesheet.terrain)&&!this.disableElevatedTerrain||this.setTerrainForDraping():this.terrainSetForDrapingOnly()&&this.setTerrain(null,0))}_updateMapProjection(){this.isRootStyle()&&(this.map._useExplicitProjection?this.applyProjectionUpdate():this.map._prioritizeAndUpdateProjection(null,this.projection))}_loadSprite(r){this._spriteRequest=function(s,u,d){let f,_,y;const b=o.f.devicePixelRatio>1?"@2x":"";let T=o.g(u.transformRequest(u.normalizeSpriteURL(s,b,".json"),o.R.SpriteJSON),(C,P)=>{T=null,y||(y=C,f=P,A())}),S=o.d(u.transformRequest(u.normalizeSpriteURL(s,b,".png"),o.R.SpriteImage),(C,P)=>{S=null,y||(y=C,_=P,A())});function A(){if(y)d(y);else if(f&&_){const C=o.f.getImageData(_),P={};for(const L in f){const{width:R,height:k,x:O,y:N,sdf:$,pixelRatio:Z,stretchX:Q,stretchY:B,content:U}=f[L],K=new o.h({width:R,height:k});o.h.copy(C,K,{x:O,y:N},{x:0,y:0},{width:R,height:k}),P[L]={data:K,pixelRatio:Z,sdf:$,stretchX:Q,stretchY:B,content:U}}d(null,P)}}return{cancel(){T&&(T.cancel(),T=null),S&&(S.cancel(),S=null)}}}(r,this.map._requestManager,(s,u)=>{if(this._spriteRequest=null,s)this.fire(new o.a(s));else if(u)for(const d in u)this.imageManager.addImage(d,this.scope,u[d]);this.imageManager.setLoaded(!0,this.scope),this._availableImages=this.imageManager.listImages(this.scope),this.dispatcher.broadcast("setImages",{scope:this.scope,images:this._availableImages}),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0}),this.fire(new o.b("data",{dataType:"style"}))})}_validateLayer(r){const s=this.getOwnSource(r.source);if(!s)return;const u=r.sourceLayer;u&&(s.type==="geojson"||s.vectorLayerIds&&s.vectorLayerIds.indexOf(u)===-1)&&this.fire(new o.a(new Error(`Source layer "${u}" does not exist on source "${s.id}" as specified by style layer "${r.id}"`)))}loaded(){if(!this._loaded||Object.keys(this._changes.getUpdatedSourceCaches()).length)return!1;for(const r in this._sourceCaches)if(!this._sourceCaches[r].loaded())return!1;if(!this.imageManager.isLoaded()||!this.modelManager.isLoaded())return!1;for(const{style:r}of this.fragments)if(!r.loaded())return!1;return!0}_serializeImports(){if(this.stylesheet.imports)return this.stylesheet.imports.map((r,s)=>{const u=this.fragments[s];return u&&u.style&&(r.data=u.style.serialize()),r})}_serializeSources(){const r={};for(const s in this._sourceCaches){const u=this._sourceCaches[s].getSource();r[u.id]||(r[u.id]=u.serialize())}return r}_serializeLayers(r){const s=[];for(const u of r){const d=this._layers[u];d&&d.type!=="custom"&&s.push(d.serialize())}return s}hasLightTransitions(){return!(!this.light||!this.light.hasTransition())||!(!this.ambientLight||!this.ambientLight.hasTransition())||!(!this.directionalLight||!this.directionalLight.hasTransition())}hasFogTransition(){return!!this.fog&&this.fog.hasTransition()}hasTransitions(){if(this.hasLightTransitions()||this.hasFogTransition())return!0;for(const r in this._sourceCaches)if(this._sourceCaches[r].hasTransition())return!0;for(const r in this._layers)if(this._layers[r].hasTransition())return!0;return!1}get order(){return this.terrain?this._drapedFirstOrder:this._mergedOrder}isLayerDraped(r){return!!this.terrain&&r.isDraped(this.getLayerSourceCache(r))}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading")}_checkLayer(r){const s=this.getOwnLayer(r);if(s)return s;this.fire(new o.a(new Error(`The layer '${r}' does not exist in the map's style.`)))}_checkSource(r){const s=this.getOwnSource(r);if(s)return s;this.fire(new o.a(new Error(`The source '${r}' does not exist in the map's style.`)))}update(r){if(!this._loaded)return;this.ambientLight&&this.ambientLight.recalculate(r),this.directionalLight&&this.directionalLight.recalculate(r);const s=this.calculateLightsBrightness();r.brightness=s||0,s!==this._brightness&&(this._brightness=s,this.dispatcher.broadcast("setBrightness",s));const u=this._changes.isDirty();if(this._changes.isDirty()){const f=this._changes.getLayerUpdatesByScope();for(const _ in f){const{updatedIds:y,removedIds:b}=f[_];(y||b)&&this._updateWorkerLayers(_,y,b)}this.updateSourceCaches(),this._updateTilesForChangedImages(),this.updateLayers(r),this.light&&this.light.updateTransitions(r),this.ambientLight&&this.ambientLight.updateTransitions(r),this.directionalLight&&this.directionalLight.updateTransitions(r),this.fog&&this.fog.updateTransitions(r),this._changes.reset()}const d={};for(const f in this._mergedSourceCaches){const _=this._mergedSourceCaches[f];d[f]=_.used,_.used=!1,_.tileCoverLift=0}for(const f of this._mergedOrder){const _=this._mergedLayers[f];if(_.recalculate(r,this._availableImages),!_.isHidden(r.zoom)){const y=this.getLayerSourceCache(_);y&&(y.used=!0,y.tileCoverLift=Math.max(y.tileCoverLift,_.tileCoverLift()))}if(!this._precompileDone&&this._shouldPrecompile)for(let y=_.minzoom||0;y<(_.maxzoom||25.5);y++){const b=this.map.painter;if(b){const T=_.getProgramIds();if(!T)continue;for(const S of T){const A=_.getDefaultProgramParams(S,r.zoom);
14A&&(b.style=this,this.fog&&(b._fogVisible=!0,A.overrideFog=!0,b.getOrCreateProgram(S,A)),b._fogVisible=!1,A.overrideFog=!1,b.getOrCreateProgram(S,A),(this.stylesheet.terrain||this.stylesheet.projection&&this.stylesheet.projection.name==="globe")&&(A.overrideRtt=!0,b.getOrCreateProgram(S,A)))}}}}this._shouldPrecompile&&(this._precompileDone=!0);for(const f in d){const _=this._mergedSourceCaches[f];d[f]!==_.used&&_.getSource().fire(new o.b("data",{sourceDataType:"visibility",dataType:"source",sourceId:_.getSource().id}))}this.light&&this.light.recalculate(r),this.terrain&&this.terrain.recalculate(r),this.fog&&this.fog.recalculate(r),this.z=r.zoom,this._markersNeedUpdate&&(this._updateMarkersOpacity(),this._markersNeedUpdate=!1),u&&this.fire(new o.b("data",{dataType:"style"}))}_updateTilesForChangedImages(){const r=this._changes.getUpdatedImages();if(r.length){for(const s in this._sourceCaches)this._sourceCaches[s].reloadTilesForDependencies(["icons","patterns"],r);this._changes.resetUpdatedImages()}}_updateWorkerLayers(r,s,u){const d=this.getFragmentStyle(r);d&&this.dispatcher.broadcast("updateLayers",{layers:s?d._serializeLayers(s):[],scope:r,removedIds:u||[],options:d.options})}setState(r,s){if(this._checkLoaded(),gn(this,dt(r)))return!1;(r=o.c6(r)).layers=yh(r.layers);const u=function(_,y){if(!_)return[{command:Qt.setStyle,args:[y]}];let b=[];try{if(!At(_.version,y.version))return[{command:Qt.setStyle,args:[y]}];At(_.center,y.center)||b.push({command:Qt.setCenter,args:[y.center]}),At(_.zoom,y.zoom)||b.push({command:Qt.setZoom,args:[y.zoom]}),At(_.bearing,y.bearing)||b.push({command:Qt.setBearing,args:[y.bearing]}),At(_.pitch,y.pitch)||b.push({command:Qt.setPitch,args:[y.pitch]}),At(_.sprite,y.sprite)||b.push({command:Qt.setSprite,args:[y.sprite]}),At(_.glyphs,y.glyphs)||b.push({command:Qt.setGlyphs,args:[y.glyphs]}),At(_.imports,y.imports)||function(P=[],L=[],R){L=L||[];const k=(P=P||[]).map($s),O=L.map($s),N=P.reduce(Go,{}),$=L.reduce(Go,{}),Z=k.slice();let Q,B,U,K;for(Q=0,B=0;Q<k.length;Q++)U=k[Q],$.hasOwnProperty(U)?B++:(R.push({command:Qt.removeImport,args:[U]}),Z.splice(Z.indexOf(U,B),1));for(Q=0,B=0;Q<O.length;Q++)U=O[O.length-1-Q],Z[Z.length-1-Q]!==U&&(N.hasOwnProperty(U)?(R.push({command:Qt.removeImport,args:[U]}),Z.splice(Z.lastIndexOf(U,Z.length-B),1)):B++,K=Z[Z.length-Q],R.push({command:Qt.addImport,args:[$[U],K]}),Z.splice(Z.length-Q,0,U));for(const Y of L){const re=N[Y.id];re&&!At(re,Y)&&R.push({command:Qt.updateImport,args:[Y.id,Y]})}}(_.imports,y.imports,b),At(_.transition,y.transition)||b.push({command:Qt.setTransition,args:[y.transition]}),At(_.light,y.light)||b.push({command:Qt.setLight,args:[y.light]}),At(_.fog,y.fog)||b.push({command:Qt.setFog,args:[y.fog]}),At(_.projection,y.projection)||b.push({command:Qt.setProjection,args:[y.projection]}),At(_.lights,y.lights)||b.push({command:Qt.setLights,args:[y.lights]}),At(_.camera,y.camera)||b.push({command:Qt.setCamera,args:[y.camera]});const T={},S=[];(function(P,L,R,k){let O;for(O in L=L||{},P=P||{})P.hasOwnProperty(O)&&(L.hasOwnProperty(O)||Ic(O,R,k));for(O in L){if(!L.hasOwnProperty(O))continue;const N=L[O];P.hasOwnProperty(O)?At(P[O],N)||(P[O].type==="geojson"&&N.type==="geojson"&&Cc(P,L,O)?R.push({command:Qt.setGeoJSONSourceData,args:[O,N.data]}):xh(O,L,R,k)):il(O,L,R)}})(_.sources,y.sources,S,T);const A=[];_.layers&&_.layers.forEach(P=>{P.source&&T[P.source]?b.push({command:Qt.removeLayer,args:[P.id]}):A.push(P)});let C=_.terrain;C&&T[C.source]&&(b.push({command:Qt.setTerrain,args:[void 0]}),C=void 0),b=b.concat(S),At(C,y.terrain)||b.push({command:Qt.setTerrain,args:[y.terrain]}),function(P,L,R){L=L||[];const k=(P=P||[]).map($s),O=L.map($s),N=P.reduce(Go,{}),$=L.reduce(Go,{}),Z=k.slice(),Q=Object.create(null);let B,U,K,Y,re,he,ie;for(B=0,U=0;B<k.length;B++)K=k[B],$.hasOwnProperty(K)?U++:(R.push({command:Qt.removeLayer,args:[K]}),Z.splice(Z.indexOf(K,U),1));for(B=0,U=0;B<O.length;B++)K=O[O.length-1-B],Z[Z.length-1-B]!==K&&(N.hasOwnProperty(K)?(R.push({command:Qt.removeLayer,args:[K]}),Z.splice(Z.lastIndexOf(K,Z.length-U),1)):U++,he=Z[Z.length-B],R.push({command:Qt.addLayer,args:[$[K],he]}),Z.splice(Z.length-B,0,K),Q[K]=!0);for(B=0;B<O.length;B++)if(K=O[B],Y=N[K],re=$[K],!Q[K]&&!At(Y,re))if(At(Y.source,re.source)&&At(Y["source-layer"],re["source-layer"])&&At(Y.type,re.type)){for(ie in _s(Y.layout,re.layout,R,K,null,Qt.setLayoutProperty),_s(Y.paint,re.paint,R,K,null,Qt.setPaintProperty),At(Y.slot,re.slot)||R.push({command:Qt.setSlot,args:[K,re.slot]}),At(Y.filter,re.filter)||R.push({command:Qt.setFilter,args:[K,re.filter]}),At(Y.minzoom,re.minzoom)&&At(Y.maxzoom,re.maxzoom)||R.push({command:Qt.setLayerZoomRange,args:[K,re.minzoom,re.maxzoom]}),Y)Y.hasOwnProperty(ie)&&ie!=="layout"&&ie!=="paint"&&ie!=="filter"&&ie!=="metadata"&&ie!=="minzoom"&&ie!=="maxzoom"&&ie!=="slot"&&(ie.indexOf("paint.")===0?_s(Y[ie],re[ie],R,K,ie.slice(6),Qt.setPaintProperty):At(Y[ie],re[ie])||R.push({command:Qt.setLayerProperty,args:[K,ie,re[ie]]}));for(ie in re)re.hasOwnProperty(ie)&&!Y.hasOwnProperty(ie)&&ie!=="layout"&&ie!=="paint"&&ie!=="filter"&&ie!=="metadata"&&ie!=="minzoom"&&ie!=="maxzoom"&&ie!=="slot"&&(ie.indexOf("paint.")===0?_s(Y[ie],re[ie],R,K,ie.slice(6),Qt.setPaintProperty):At(Y[ie],re[ie])||R.push({command:Qt.setLayerProperty,args:[K,ie,re[ie]]}))}else R.push({command:Qt.removeLayer,args:[K]}),he=Z[Z.lastIndexOf(K)+1],R.push({command:Qt.addLayer,args:[re,he]})}(A,y.layers,b)}catch(T){console.warn("Unable to compute style diff:",T),b=[{command:Qt.setStyle,args:[y]}]}return b}(this.serialize(),r).filter(_=>!(_.command in gp));if(u.length===0)return!1;const d=u.filter(_=>!(_.command in Ih));if(d.length>0)throw new Error(`Unimplemented: ${d.map(_=>_.command).join(", ")}.`);const f=[];return u.forEach(_=>{f.push(this[_.command].apply(this,_.args))}),s&&Promise.all(f).then(s),this.stylesheet=r,this.mergeAll(),this.dispatcher.broadcast("setLayers",{layers:this._serializeLayers(this._order),scope:this.scope,options:this.options}),!0}addImage(r,s){return this.getImage(r)?this.fire(new o.a(new Error("An image with this name already exists."))):(this.imageManager.addImage(r,this.scope,s),this._afterImageUpdated(r),this)}updateImage(r,s){this.imageManager.updateImage(r,this.scope,s)}getImage(r){return this.imageManager.getImage(r,this.scope)}removeImage(r){return this.getImage(r)?(this.imageManager.removeImage(r,this.scope),this._afterImageUpdated(r),this):this.fire(new o.a(new Error("No image with this name exists.")))}_afterImageUpdated(r){this._availableImages=this.imageManager.listImages(this.scope),this._changes.updateImage(r),this.dispatcher.broadcast("setImages",{scope:this.scope,images:this._availableImages}),this.fire(new o.b("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this._availableImages.slice()}addModel(r,s,u={}
vendor: 7,232 bytes, line 14
14){return this._checkLoaded(),this._validate(tt,`models.${r}`,s,null,u)||(this.modelManager.addModel(r,s,this.scope),this._changes.setDirty()),this}hasModel(r){return this.modelManager.hasModel(r,this.scope)}removeModel(r){return this.hasModel(r)?(this.modelManager.removeModel(r,this.scope),this):this.fire(new o.a(new Error("No model with this ID exists.")))}listModels(){return this._checkLoaded(),this.modelManager.listModels(this.scope)}addSource(r,s,u={}){if(this._checkLoaded(),this.getOwnSource(r)!==void 0)throw new Error(`There is already a source with ID "${r}".`);if(!s.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(s).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(s.type)>=0&&this._validate(Vo,`sources.${r}`,s,null,u))return;this.map&&this.map._collectResourceTiming&&(s.collectResourceTiming=!0);const d=Sc(r,s,this.dispatcher,this);d.scope=this.scope,d.setEventedParent(this,()=>({isSourceLoaded:this._isSourceCacheLoaded(d.id),source:d.serialize(),sourceId:d.id}));const f=_=>{const y=(_?"symbol:":"other:")+d.id,b=o.aj(y,this.scope),T=this._sourceCaches[y]=new tn(b,d,_);(_?this._symbolSourceCaches:this._otherSourceCaches)[d.id]=T,T.onAdd(this.map)};f(!1),s.type!=="vector"&&s.type!=="geojson"||f(!0),d.onAdd&&d.onAdd(this.map),u.isInitialLoad||(this.mergeSources(),this._changes.setDirty())}removeSource(r){this._checkLoaded();const s=this.getOwnSource(r);if(!s)throw new Error("There is no source with this ID");for(const d in this._layers)if(this._layers[d].source===r)return this.fire(new o.a(new Error(`Source "${r}" cannot be removed while layer "${d}" is using it.`)));if(this.terrain&&this.terrain.scope===this.scope&&this.terrain.get().source===r)return this.fire(new o.a(new Error(`Source "${r}" cannot be removed while terrain is using it.`)));const u=this.getOwnSourceCaches(r);for(const d of u){const f=o.c8(d.id);delete this._sourceCaches[f],this._changes.discardSourceCacheUpdate(d.id),d.fire(new o.b("data",{sourceDataType:"metadata",dataType:"source",sourceId:d.getSource().id})),d.setEventedParent(null),d.clearTiles()}return delete this._otherSourceCaches[r],delete this._symbolSourceCaches[r],this.mergeSources(),s.setEventedParent(null),s.onRemove&&s.onRemove(this.map),this._changes.setDirty(),this}setGeoJSONSourceData(r,s){this._checkLoaded(),this.getOwnSource(r).setData(s),this._changes.setDirty()}getOwnSource(r){const s=this.getOwnSourceCache(r);return s&&s.getSource()}getOwnSources(){const r=[];for(const s in this._otherSourceCaches){const u=this.getOwnSourceCache(s);u&&r.push(u.getSource())}return r}areTilesLoaded(){const r=this._mergedSourceCaches;for(const s in r){const u=r[s]._tiles;for(const d in u){const f=u[d];if(f.state!=="loaded"&&f.state!=="errored")return!1}}return!0}setLights(r){if(this._checkLoaded(),!r)return delete this.ambientLight,void delete this.directionalLight;const s=this._getTransitionParameters();for(const d of r){if(this._validate(Re,"lights",d))return;switch(d.type){case"ambient":if(this.ambientLight){const f=this.ambientLight;f.set(d),f.updateTransitions(s)}else this.ambientLight=new dr(d,Jr,this.scope,this.options);break;case"directional":if(this.directionalLight){const f=this.directionalLight;f.set(d),f.updateTransitions(s)}else this.directionalLight=new dr(d,ji,this.scope,this.options)}}const u=new o.N(this.z||0,s);this.ambientLight&&this.ambientLight.recalculate(u),this.directionalLight&&this.directionalLight.recalculate(u),this._brightness=this.calculateLightsBrightness(),this.dispatcher.broadcast("setBrightness",this._brightness)}calculateLightsBrightness(){const r=this.directionalLight,s=this.ambientLight;if(!r||!s)return;const u=A=>.2126*(A[0]<=.03928?A[0]/12.92:Math.pow((A[0]+.055)/1.055,2.4))+.7152*(A[1]<=.03928?A[1]/12.92:Math.pow((A[1]+.055)/1.055,2.4))+.0722*(A[2]<=.03928?A[2]/12.92:Math.pow((A[2]+.055)/1.055,2.4)),d=r.properties.get("color").toArray01(),f=r.properties.get("intensity"),_=r.properties.get("direction"),y=1-o.bT(_.x,_.y,_.z)[2]/90,b=u(d)*f*y,T=s.properties.get("color").toArray01(),S=s.properties.get("intensity");return(b+u(T)*S)/2}getBrightness(){return this._brightness}getLights(){if(!this.enable3dLights())return null;const r=[];return this.directionalLight&&r.push(this.directionalLight.get()),this.ambientLight&&r.push(this.ambientLight.get()),r}enable3dLights(){return!!this.ambientLight&&!!this.directionalLight}getFragmentStyle(r){if(!r)return this;if(o.c9(r)){const s=o.ca(r),u=this.fragments.find(({id:f})=>f===s);if(!u)throw new Error(`Style import not found: ${r}`);const d=o.c8(r);return u.style.getFragmentStyle(d)}{const s=this.fragments.find(({id:u})=>u===r);if(!s)throw new Error(`Style import not found: ${r}`);return s.style}}getConfigProperty(r,s){const u=this.getFragmentStyle(r);if(!u)return null;const d=o.aj(s,u.scope),f=u.options.get(d),_=f?f.value||f.default:null;return _?_.serialize():null}setConfigProperty(r,s,u){const d=this.getFragmentStyle(r);if(!d)return;const f=d.stylesheet.schema;if(!f||!f[s])return;const _=o.t(u);if(_.result!=="success")return void gn(this,_.value);const y=_.value.expression,b=o.aj(s,d.scope),T=d.options.get(b);if(!T)return;let S;const{minValue:A,maxValue:C,stepValue:P,type:L,values:R}=f[s],k=o.t(f[s].default);k.result==="success"&&(S=k.value.expression),S?(this.options.set(b,{...T,value:y,default:S,minValue:A,maxValue:C,stepValue:P,type:L,values:R}),this.updateConfigDependencies()):this.fire(new o.a(new Error(`No schema defined for the config option "${s}" in the "${r}" fragment.`)))}getConfig(r){const s=this.getFragmentStyle(r);if(!s)return null;const u=s.stylesheet.schema;if(!u)return null;const d={};for(const f in u){const _=o.aj(f,s.scope),y=s.options.get(_),b=y?y.value||y.default:null;d[f]=b?b.serialize():null}return d}setConfig(r,s){const u=this.getFragmentStyle(r);u&&(u.updateConfig(s,u.stylesheet.schema),this.updateConfigDependencies())}getSchema(r){const s=this.getFragmentStyle(r);return s?s.stylesheet.schema:null}setSchema(r,s){const u=this.getFragmentStyle(r);u&&(u.stylesheet.schema=s,u.updateConfig(u._config,s),this.updateConfigDependencies())}updateConfig(r,s){if(this._config=r,r||s)if(s)for(const u in s){let d,f;const _=o.t(s[u].default);if(_.result==="success"&&(d=_.value.expression),r&&r[u]!==void 0){const C=o.t(r[u]);C.result==="success"&&(f=C.value.expression)}const{minValue:y,maxValue:b,stepValue:T,type:S,values:A}=s[u];if(d){const C=o.aj(u,this.scope);this.options.set(C,{default:d,value:f,minValue:y,maxValue:b,stepValue:T,type:S,values:A})}else this.fire(new o.a(new Error(`No schema defined for config option "${u}".`)))}else this.fire(new o.a(new Error("Attempting to set config for a style without schema.")))}updateConfigDependencies(){for(const r of this._configDependentLayers){const s=this.getLayer(r);s&&(s.possiblyEvaluateVisibility(),this._updateLayer(s))}this.ambientLight&&this.ambientLight.updateConfig(this.options),this.directionalLight&&this.directionalLight.updateConfig(this.options),this.fog&&this.fog.updateConfig(this.options),this._changes.setDirty()}addLayer(r,s,u={}){this._checkLoaded();const d=r.id;if(this._layers[d])return void this.fire(new o.a(new Error(`Layer with i
14d "${d}" already exists on this map`)));let f;if(r.type==="custom"){if(gn(this,o.cb(r)))return;f=o.c7(r,this.scope,this.options)}else{if(typeof r.source=="object"&&(this.addSource(d,r.source),r=o.c6(r),r=o.e(r,{source:d})),this._validate(ne,`layers.${d}`,r,{arrayIndex:-1},u))return;f=o.c7(r,this.scope,this.options),this._validateLayer(f),f.setEventedParent(this,{layer:{id:d}}),this._serializedLayers[f.id]=f.serialize()}f.isConfigDependent&&this._configDependentLayers.add(f.fqid);let _=this._order.length;if(s){const S=this._order.indexOf(s);if(S===-1)return void this.fire(new o.a(new Error(`Layer with id "${s}" does not exist on this map.`)));f.slot===this._layers[s].slot?_=S:o.w(`Layer with id "${s}" has a different slot. Layers can only be rearranged within the same slot.`)}this._order.splice(_,0,d),this._layerOrderChanged=!0,this._layers[d]=f;const y=this.getOwnLayerSourceCache(f),b=!!this.directionalLight&&this.directionalLight.shadowsEnabled();y&&f.canCastShadows()&&b&&(y.castsShadows=!0);const T=this._changes.getRemovedLayer(f);if(T&&f.source&&y&&f.type!=="custom"){this._changes.discardLayerRemoval(f);const S=o.aj(f.source,f.scope);T.type!==f.type?this._changes.updateSourceCache(S,"clear"):(this._changes.updateSourceCache(S,"reload"),y.pause())}this._updateLayer(f),f.onAdd&&f.onAdd(this.map),f.scope=this.scope,this.mergeLayers()}moveLayer(r,s){this._checkLoaded();const u=this._checkLayer(r);if(!u||r===s)return;const d=this._order.indexOf(r);this._order.splice(d,1);let f=this._order.length;if(s){const _=this._order.indexOf(s);
14if(_===-1)return void this.fire(new o.a(new Error(`Layer with id "${s}" does not exist on this map.`)));u.slot===this._layers[s].slot?f=_:o.w(`Layer with id "${s}" has a different slot. Layers can only be rearranged within the same slot.`)}this._order.splice(f,0,r),this._changes.setDirty(),this._layerOrderChanged=!0,this.mergeLayers()}removeLayer(r){this._checkLoaded();const s=this._checkLayer(r);if(!s)return;s.setEventedParent(null);const u=this._order.indexOf(r);this._order.splice(u,1),delete this._layers[r],delete this._serializedLayers[r],this._changes.setDirty(),this._layerOrderChanged=!0,this._configDependentLayers.delete(s.fqid),this._changes.removeLayer(s);const d=this.getOwnLayerSourceCache(s);if(d&&d.castsShadows){let f=!1;for(const _ in this._layers)if(this._layers[_].source===s.source&&this._layers[_].canCastShadows()){f=!0;break}d.castsShadows=f}s.onRemove&&s.onRemove(this.map),this.mergeLayers()}getOwnLayer(r){return this._layers[r]}hasLayer(r){return r in this._mergedLayers}hasLayerType(r){for(const s in this._layers)if(this._layers[s].type===r)return!0;return!1}setLayerZoomRange(r,s,u){this._checkLoaded();const d=this._checkLayer(r);d&&(d.minzoom===s&&d.maxzoom===u||(s!=null&&(d.minzoom=s),u!=null&&(d.maxzoom=u),this._updateLayer(d)))}setSlot(r,s){this._checkLoaded();const u=this._checkLayer(r);u&&u.slot!==s&&(u.slot=s,this._updateLayer(u))}setFilter(r,s,u={}){this._checkLoaded();const d=this._checkLayer(r);if(d&&!At(d.filter,s))return s==null?(d.filter=void 0,void this._updateLayer(d)):void(this._validate(Se,`layers.${d.id}.filter`,s,{layerType:d.type},u)||(d.filter=o.c6(s),this._updateLayer(d)))}getFilter(r){const s=this._checkLayer(r);if(s)return o.c6(s.filter)}setLayoutProperty(r,s,u,d={}){this._checkLoaded();const f=this._checkLayer(r);if(f&&!At(f.getLayoutProperty(s),u)){if(u!=null&&(!d||d.validate!==!1)&&gn(f,Le.call(dt,{key:`layers.${r}.layout.${s}`,layerType:f.type,objectKey:s,value:u,styleSpec:o.G,style:{glyphs:!0,sprite:!0}})))return;f.setLayoutProperty(s,u),f.isConfigDependent&&this._configDependentLayers.add(f.fqid),this._updateLayer(f)}}getLayoutProperty(r,s){const u=this._checkLayer(r);if(u)return u.getLayoutProperty(s)}setPaintProperty(r,s,u,d={}){this._checkLoaded();const f=this._checkLayer(r);if(!f||At(f.getPaintProperty(s),u)||u!=null&&(!d||d.validate!==!1)&&gn(f,Ie.call(dt,{key:`layers.${r}.paint.${s}`,layerType:f.type,objectKey:s,value:u,styleSpec:o.G})))return;const _=f.setPaintProperty(s,u);f.isConfigDependent&&this._configDependentLayers.add(f.fqid),_&&this._updateLayer(f),this._changes.updatePaintProperties(f)}getPaintProperty(r,s){const u=this._checkLayer(r);if(u)return u.getPaintProperty(s)}setFeatureState(r,s){this._checkLoaded();const u=r.source,d=r.sourceLayer,f=this._checkSource(u);if(!f)return;const _=f.type;if(_==="geojson"&&d)return void this.fire(new o.a(new Error("GeoJSON sources cannot have a sourceLayer parameter.")));if(_==="vector"&&!d)return void this.fire(new o.a(new Error("The sourceLayer parameter must be provided for vector source types.")));r.id===void 0&&this.fire(new o.a(new Error("The feature id parameter must be provided.")));const y=this.getOwnSourceCaches(u);for(const b of y)b.setFeatureState(d,r.id,s)}removeFeatureState(r,s){this._checkLoaded();const u=r.source,d=this._checkSource(u);if(!d)return;const f=d.type,_=f==="vector"?r.sourceLayer:void 0;if(f==="vector"&&!_)return void this.fire(new o.a(new Error("The sourceLayer parameter must be provided for vector source types.")));if(s&&typeof r.id!="string"&&typeof r.id!="number")return void this.fire(new o.a(new Error("A feature id is required to remove its specific state property.")));const y=this.getOwnSourceCaches(u);for(const b of y)b.removeFeatureState(_,r.id,s)}getFeatureState(r){this._checkLoaded();const s=r.source,u=r.sourceLayer,d=this._checkSource(s);if(d){if(d.type!=="vector"||u)return r.id===void 0&&this.fire(new o.a(new Error("The feature id parameter must be provided."))),this.getOwnSourceCaches(s)[0].getFeatureState(u,r.id);this.fire(new o.a(new Error("The sourceLayer parameter must be provided for vector source types.")))}}setTransition(r){return this.stylesheet.transition=o.e({},this.stylesheet.transition,r),this.transition=this.stylesheet.transition,this}getTransition(){return o.e({},this.stylesheet.transition)}serialize(){this._checkLoaded();const r=this.getTerrain(),s=r&&this.terrain&&this.terrain.scope===this.scope?r:this.stylesheet.terrain;return o.cc({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,fragment:this.stylesheet.fragment,imports:this._serializeImports(),schema:this.stylesheet.schema,camera:this.stylesheet.camera,light:this.stylesheet.light,lights:this.stylesheet.lights,terrain:s,fog:this.stylesheet.fog,center:this.stylesheet.center,zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,projection:this.stylesheet.projection,sources:this._serializeSources(),layers:this._serializeLayers(this._order)},u=>u!==void 0)}_updateLayer(r){this._changes.updateLayer(r);const s=this.getLayerSourceCache(r),u=o.aj(r.source,r.scope),d=this._changes.getUpd
14atedSourceCaches();r.source&&!d[u]&&s&&s.getSource().type!=="raster"&&(this._changes.updateSourceCache(u,"reload"),s.pause()),r.invalidateCompiledFilter()}_flattenAndSortRenderedFeatures(r){const s=y=>this._mergedLayers[y].type==="fill-extrusion"||this._mergedLayers[y].type==="model",u=this.order,d={},f=[];for(let y=u.length-1;y>=0;y--){const b=u[y];if(s(b)){d[b]=y;for(const T of r){const S=T[b];if(S)for(const A of S)f.push(A)}}}f.sort((y,b)=>b.intersectionZ-y.intersectionZ);const _=[];for(let y=u.length-1;y>=0;y--){const b=u[y];if(s(b))for(let T=f.length-1;T>=0;T--){const S=f[T].feature;if(d[S.layer.id]<y)break;_.push(S),f.pop()}else for(const T of r){const S=T[b];if(S)for(const A of S)_.push(A.feature)}}return _}queryRenderedFeatures(r,s,u){s&&s.filter&&this._validate(Se,"queryRenderedFeatures.filter",s.filter,null,s),s.scope=this.scope,s.availableImages=this._availableImages,s.serializedLayers=this._serializedLayers;const d={};if(s&&s.layers){if(!Array.isArray(s.layers))return this.fire(new o.a(new Error("parameters.layers must be an Array."))),[];for(const T of s.layers){const S=this._mergedLayers[T];if(!S)return this.fire(new o.a(new Error(`The layer '${T}' does not exist in the map's style and cannot be queried for features.`))),[];d[S.source]=!0}}const f=[],_=s.serializedLayers||{},y=s&&s.layers?s.layers.some(T=>{const S=this.getLayer(T);return S&&S.is3D()}):this.has3DLayers(),b=Ai.createFromScreenPoints(r,u);for(const T in this._mergedSourceCaches){const S=this._mergedSourceCaches[T].getSource();if(!S||S.scope!==s.scope)continue;const A=this._mergedSourceCaches[T].getSource().id;s.layers&&!d[A]||f.push(jt(this._mergedSourceCaches[T],this._mergedLayers,_,b,s,u,y,!!this.map._showQueryGeometry))}return this.placement&&f.push(function(T,S,A,C,P,L,R){const k={},O=L.queryRenderedSymbols(C),N=[];for(const $ of Object.keys(O).map(Number))N.push(R[$]);N.sort(_h);for(const $ of N){const Z=$.featureIndex.lookupSymbolFeatures(O[$.bucketInstanceId],S,$.bucketIndex,$.sourceLayerIndex,P.filter,P.layers,P.availableImages,T);for(const Q in Z){const B=k[Q]=k[Q]||[],U=Z[Q];U.sort((K,Y)=>{const re=$.featureSortOrder;if(re){const he=re.indexOf(K.featureIndex);return re.indexOf(Y.featureIndex)-he}return Y.featureIndex-K.featureIndex});for(const K of U)B.push(K)}}for(const $ in k)k[$].forEach(Z=>{const Q=Z.feature,B=A(T[$]);if(!B)return;const U=B.getFeatureState(Q.layer["source-layer"],Q.id);Q.source=Q.layer.source,Q.layer["source-layer"]&&(Q.sourceLayer=Q.layer["source-layer"]),Q.state=U});return k}(this._mergedLayers,_,this.getLayerSourceCache.bind(this),b.screenGeometry,s,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(f)}querySourceFeatures(r,s){s&&s.filter&&this._validate(Se,"querySourceFeatures.filter",s.filter,null,s);const u=this.getOwnSourceCaches(r);let d=[];for(const f of u)d=d.concat(vr(f,s));return d}addSourceType(r,s,u){return sn.getSourceType(r)?u(new Error(`A source type called "${r}" already exists.`)):(sn.setSourceType(r,s),s.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:r,url:s.workerSourceURL},u):u(null,null))}getFlatLight(){return this.light.getLight()}setFlatLight(r,s,u={}){this._checkLoaded();const d=this.light.getLight();let f=!1;for(const y in r)if(!At(r[y],d[y])){f=!0;break}if(!f)return;const _=this._getTransitionParameters();this.light.setLight(r,s,u),this.light.updateTransitions(_)}getTerrain(){return this.terrain&&this.terrain.drapeRenderMode===1?this.terrain.get():null}setTerrainForDraping(){this.setTerrain({source:"",exaggeration:0},0)}setTerrain(r,s=1){if(this._checkLoaded(),!r)return this.terrainSetForDrapingOnly()&&s!==0||delete this.terrain,r===null?this.stylesheet.terrain=null:delete this.stylesheet.terrain,this._force3DLayerUpdate(),void(this._markersNeedUpdate=!0);let u=r;const d=r.source==null;if(s===1){if(typeof u.source=="object"){const y="terrain-dem-src";this.addSource(y,u.source),u=o.c6(u),u=o.e(u,{source:y})}const f=o.e({},u),_={};if(this.terrain&&d){f.source=this.terrain.get().source;const y=this.terrain?this.getFragmentStyle(this.terrain.scope):null;
14y&&(_.style=y.serialize())}if(this._validate(G,"terrain",f,_))return}if(!this.terrain||this.terrain.scope!==this.scope&&!d||this.terrain&&s!==this.terrain.drapeRenderMode){if(!u)return;this._createTerrain(u,s),this.fire(new o.b("data",{dataType:"style"}))}else{const f=this.terrain,_=f.get();for(const y of Object.keys(o.G.terrain))!u.hasOwnProperty(y)&&o.G.terrain[y].default&&(u[y]=o.G.terrain[y].default);for(const y in r)if(!At(r[y],_[y])){f.set(r,this.options),this.stylesheet.terrain=r;const b=this._getTransitionParameters({duration:0});f.updateTransitions(b),this.fire(new o.b("data",{dataType:"style"}));break}}this.mergeTerrain(),this.updateDrapeFirstLayers(),this._markersNeedUpdate=!0}_createFog(r){const s=this.fog=new gr(r,this.map.transform,this.scope,this.options);this.stylesheet.fog=s.get();const u=this._getTransitionParameters({duration:0});s.updateTransitions(u)}_updateMarkersOpacity(){this.map._markers.length!==0&&this.map._requestDomTask(()=>{for(const r of this.map._markers)r._evaluateOpacity()})}getFog(){return this.fog?this.fog.get():null}setFog(r){if(this._checkLoaded(),!r)return delete this.fog,delete this.stylesheet.fog,void(this._markersNeedUpdate=!0);if(this.fog){const s=this.fog;if(!At(s.get(),r)){s.set(r,this.options),this.stylesheet.fog=s.get();const u=this._getTransitionParameters({duration:0});s.updateTransitions(u)}}else this._createFog(r);this._markersNeedUpdate=!0}_getTransitionParameters(r){return{now:o.f.now(),transition:o.e(this.transition,r)}}updateDrapeFirstLayers(){if(!this.terrain)return;const r=[],s=[];for(const u in this._mergedLayers)this.isLayerDraped(this._mergedLayers[u])?r.push(u):s.push(u);this._drapedFirstOrder=[],this._drapedFirstOrder.push(...r),this._drapedFirstOrder.push(...s)}_createTerrain(r,s){const u=this.terrain=new ai(r,s,this.scope,this.options);s===1&&(this.stylesheet.terrain=r),this.mergeTerrain(),this.updateDrapeFirstLayers(),this._force3DLayerUpdate();const d=this._getTransitionParameters({duration:0});u.updateTransitions(d)}_force3DLayerUpdate(){for(const r in this._layers){const s=this._layers[r];s.type==="fill-extrusion"&&this._updateLayer(s)}}_forceSymbolLayerUpdate(){for(const r in this._layers){const s=this._layers[r];s.type==="symbol"&&this._updateLayer(s)}}_validate(r,s,u,d,f={}){if(f&&f.validate===!1)return!1;const _=o.e({},this.serialize());return gn(this,r.call(dt,o.e({key:s,style:_,value:u,styleSpec:o.G},d)))}_remove(){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),o.cd.off("pluginStateChange",this._rtlTextPluginCallback);for(const r in this._mergedLayers)this._mergedLayers[r].setEventedParent(null);for(const r in this._mergedSourceCaches)this._mergedSourceCaches[r].clearTiles(),this._mergedSourceCaches[r].setEventedParent(null);this.setEventedParent(null),delete this.fog,delete this.terrain,delete this.ambientLight,delete this.directionalLight,this.isRootStyle()&&(this.imageManager.setEventedParent(null),this.modelManager.setEventedParent(null),this.dispatcher.remove())}clearSource(r){const s=this.getSourceCaches(r);for(const u of s)u.clearTiles()}clearSources(){for(const r in this._mergedSourceCaches)this._mergedSourceCaches[r].clearTiles()}reloadSource(r){const s=this.getSourceCaches(r);for(const u of s)u.resume(),u.reload()}reloadSources(){for(const r of this.getSources())r.reload&&r.reload()}updateSources(r){let s;this.directionalLight&&(s=yl(this.directionalLight));for(const u in this._mergedSourceCaches)this._mergedSourceCaches[u].update(r,void 0,void 0,s)}_generateCollisionBoxes(){for(const r in this._sourceCaches){const s=this._sourceCaches[r];s.resume(),s.reload()}}_updatePlacement(r,s,u,d,f=!1){let _=!1,y=!1;const b={},T={};for(const S of this._mergedOrder){const A=this._mergedLayers[S];if(A.type!=="symbol")continue;const C=o.aj(A.source,A.scope);let P=b[C];if(!P){const R=this.getLayerSourceCache(A);if(!R)continue;const k=R.getRenderableIds(!0).map(O=>R.getTileByID(O));T[C]=k.slice(),P=b[C]=k.sort((O,N)=>N.tileID.overscaledZ-O.tileID.overscaledZ||(O.tileID.isLessThan(N.tileID)?-1:1))}const L=this.crossTileSymbolIndex.addLayer(A,P,r.center.lng,r.projection);_=_||L}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._mergedOrder),f=f||this._layerOrderChanged||u===0,this._layerOrderChanged&&this.fire(new o.b("neworder")),(f||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(o.f.now(),r.zoom))&&(this.pauseablePlacement=new Ho(r,this._mergedOrder,f,s,u,d,this.placement,this.fog&&r.projection.supportsFog?this.fog.state:null,this._buildingIndex),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._mergedOrder,this._mergedLayers,b,T),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(o.f.now()),y=!0),_&&this.pauseablePlacement.placement.setStale()),y||_){this._buildingIndex.onNewFrame(r.zoom);for(const S of this._mergedOrder){const A=this._mergedLayers[S];A.type==="symbol"&&this.placement.updateLayerOpacities(A,b[o.aj(A.source,A.scope)])}}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(o.f.now())}_releaseSymbolFadeTiles(){for(const r in this._sourceCaches)this._sourceCaches[r].releaseSymbolFadeTiles()}addImport(r,s){this._checkLoaded();const u=this.stylesheet.imports=this.stylesheet.imports||[];if(u.findIndex(({id:f})=>f===r.id)!==-1)return void this.fire(new o.a(new Error(`Import with i
14d '${r.id}' already exists in the map's style.`)));if(!s)return u.push(r),this._loadImports([r],!0);const d=u.findIndex(({id:f})=>f===s);return d===-1&&this.fire(new o.a(new Error(`Import with id "${s}" does not exist on this map.`))),this.stylesheet.imports=u.slice(0,d).concat(r).concat(u.slice(d)),this._loadImports([r],!0,s)}updateImport(r,s){this._checkLoaded();const u=this.stylesheet.imports||[],d=this.getImportIndex(r);return d===-1?this:typeof s=="string"?(this.setImportUrl(r,s),this):(s.url&&s.url!==u[d].url&&this.setImportUrl(r,s.url),At(s.config,u[d].config)||this.setImportConfig(r,s.config),At(s.data,u[d].data)||this.setImportData(r,s.data),this)}moveImport(r,s){this._checkLoaded();let u=this.stylesheet.imports||[];const d=this.getImportIndex(r);if(d===-1)return this;const f=this.getImportIndex(s);if(f===-1)return this;const _=u[d],y=this.fragments[d];return u=u.filter(({id:b})=>b!==r),this.fragments=this.fragments.filter(({id:b})=>b!==r),this.stylesheet.imports=u.slice(0,f).concat(_).concat(u.slice(f)),this.fragments=this.fragments.slice(0,f).concat(y).concat(this.fragments.slice(f)),this.mergeLayers(),this}setImportUrl(r,s){this._checkLoaded();const u=this.stylesheet.imports||[],d=this.getImportIndex(r);if(d===-1)return this;u[d].url=s;const f=this.fragments[d];return f.style=this._createFragmentStyle(u[d]),f.style.on("style.import.load",()=>this.mergeAll()),f.style.loadURL(s),this}setImportData(r,s){this._checkLoaded();const u=this.getImportIndex(r),d=this.stylesheet.imports||[];return u===-1?this:s?(this.fragments[u].style.setState(s),this._reloadImports(),this):(delete d[u].data,this.setImportUrl(r,d[u].url))}setImportConfig(r,s){this._checkLoaded();const u=this.getImportIndex(r),d=this.stylesheet.imports||[];if(u===-1)return this;s?d[u].config=s:delete d[u].config;const f=this.fragments[u],_=f.style.stylesheet&&f.style.stylesheet.schema;return f.config=s,f.style.updateConfig(s,_),this.updateConfigDependencies(),this}removeImport(r){this._checkLoaded();const s=this.stylesheet.imports||[],u=this.getImportIndex(r);u!==-1&&(s.splice(u,1),this.fragments[u].style._remove(),this.fragments.splice(u,1),this._reloadImports())}getImportIndex(r){const s=(this.stylesheet.imports||[]).findIndex(u=>u.id===r);return s===-1&&this.fire(new o.a(new Error(`Import '${r}' does not exist in the map's style and cannot be updated.`))),s}getLayer(r){return this._mergedLayers[r]}getSources(){const r=[];for(const s in this._mergedOtherSourceCaches){const u=this._mergedOtherSourceCaches[s];u&&r.push(u.getSource())}return r}getSource(r,s){const u=this.getSourceCache(r,s);return u&&u.getSource()}getLayerSource(r){const s=this.getLayerSourceCache(r);return s&&s.getSource()}getSourceCache(r,s){const u=o.aj(r,s);return this._mergedOtherSourceCaches[u]}getLayerSourceCache(r){const s=o.aj(r.source,r.scope);return r.type==="symbol"?this._mergedSymbolSourceCaches[s]:this._mergedOtherSourceCaches[s]}getSourceCaches(r){if(r==null)return Object.values(this._mergedSourceCaches);const s=[];return this._mergedOtherSourceCaches[r]&&s.push(this._mergedOtherSourceCaches[r]),this._mergedSymbolSourceCaches[r]&&s.push(this._mergedSymbolSourceCaches[r]),s}updateSourceCaches(){const r=this._changes.getUpdatedSourceCaches();for(const s in r){const u=r[s];u==="reload"?this.reloadSource(s):u==="clear"&&this.clearSource(s)}}updateLayers(r){const s=this._changes.getUpdatedPaintProperties();for(const u of s){const d=this.getLayer(u);d&&d.updateTransitions(r)}}getImages(r,s,u){this.imageManager.getImages(s.icons,s.scope,u),this._updateTilesForChangedImages();const d=f=>{f&&f.setDependencies(s.tileID.key,s.type,s.icons)};d(this._otherSourceCaches[s.source]),d(this._symbolSourceCaches[s.source])}getGlyphs(r,s,u){this.glyphManager.getGlyphs(s.stacks,s.scope,u)}getResource(r,s,u){return o.ce(s,u)}getOwnSourceCache(r){return this._otherSourceCaches[r]}getOwnLayerSourceCache(r){return r.type==="symbol"?this._symbolSourceCaches[r.source]:this._otherSourceCaches[r.source]}getOwnSourceCaches(r){const s=[];return this._otherSourceCaches[r]&&s.push(this._otherSourceCaches[r]),this._symbolSourceCaches[r]&&s.push(this._symbolSourceCaches[r]),s}_isSourceCacheLoaded(r){const s=this.getOwnSourceCaches(r);return s.length===0?(this.fire(new o.a(new Error(`There is no source with ID '${r}'`))),!1):s.every(u=>u.loaded())}has3DLayers(){return this._has3DLayers}hasSymbolLayers(){return this._hasSymbolLayers}hasCircleLayers(){return this._hasCircleLayers}_clearWorkerCaches(){this.dispatcher.broadcast("clearCaches")}
14destroy(){this._clearWorkerCaches(),this.fragments.forEach(r=>{r.style._remove()}),this.terrainSetForDrapingOnly()&&(delete this.terrain,delete this.stylesheet.terrain)}}sn.getSourceType=function(c){return Ne[c]},sn.setSourceType=function(c,r){Ne[c]=r},sn.registerForPluginStateChange=o.bY;var Ko=`
15#define EPSILON 0.0000001
16#define PI 3.141592653589793
17#ifdef RENDER_CUTOFF
18float cutoff_opacity(vec4 cutoff_params,float depth) {float near=cutoff_params.x;float far=cutoff_params.y;float cutoffStart=cutoff_params.z;float cutoffEnd=cutoff_params.w;float linearDepth=(depth-near)/(far-near);return clamp((linearDepth-cutoffStart)/(cutoffEnd-cutoffStart),0.0,1.0);}
19#endif`,Gc=`
20out vec4 glFragColor;highp float unpack_depth(highp vec4 rgba_depth)
21{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}highp vec4 pack_depth(highp float ndc_z) {highp float depth=ndc_z*0.5+0.5;const highp vec4 bit_shift=vec4(255.0*255.0*255.0,255.0*255.0,255.0,1.0);const highp vec4 bit_mask =vec4(0.0,1.0/255.0,1.0/255.0,1.0/255.0);highp vec4 res=fract(depth*bit_shift);res-=res.xxyz*bit_mask;return res;}
22#ifdef INDICATOR_CUTOUT
23uniform vec2 u_indicator_cutout_centers;uniform vec4 u_indicator_cutout_params;
24#endif
25vec4 applyCutout(vec4 color) {
26#ifdef INDICATOR_CUTOUT
27float holeMinOpacity=u_indicator_cutout_params.x;float holeRadius=max(u_indicator_cutout_params.y,0.0);float holeAspectRatio=u_indicator_cutout_params.z;float fadeStart=u_indicator_cutout_params.w;float distA=distance(vec2(gl_FragCoord.x,gl_FragCoord.y*holeAspectRatio),vec2(u_indicator_cutout_centers[0],u_indicator_cutout_centers[1]*holeAspectRatio));return color*min(smoothstep(fadeStart,holeRadius,distA)+holeMinOpacity,1.0);
28#else
29return color;
30#endif
31}
32#ifdef DEBUG_WIREFRAME
33#define HANDLE_WIREFRAME_DEBUG \\
34glFragColor=vec4(0.7,0.0,0.0,0.7); \\
35gl_FragDepth=gl_FragCoord.z-0.0001;
36#else
37#define HANDLE_WIREFRAME_DEBUG
38#endif
39#ifdef RENDER_CUTOFF
40uniform highp vec4 u_cutoff_params;in float v_cutoff_opacity;
41#endif
42vec4 textureLodCustom(sampler2D image,vec2 pos,vec2 lod_coord) {vec2 size=vec2(textureSize(image,0));vec2 dx=dFdx(lod_coord.xy*size);vec2 dy=dFdy(lod_coord.xy*size);float delta_max_sqr=max(dot(dx,dx),dot(dy,dy));float lod=0.5*log2(delta_max_sqr);return textureLod(image,pos,lod);}`,vl=`
43#define EXTENT 8192.0
44#define RAD_TO_DEG 180.0/PI
45#define DEG_TO_RAD PI/180.0
46#define GLOBE_RADIUS EXTENT/PI/2.0
47float wrap(float n,float min,float max) {float d=max-min;float w=mod(mod(n-min,d)+d,d)+min;return (w==min) ? max : w;}
48#ifdef PROJECTION_GLOBE_VIEW
49vec3 mercator_tile_position(mat4 matrix,vec2 tile_anchor,vec3 tile_id,vec2 mercator_center) {
50#ifndef PROJECTED_POS_ON_VIEWPORT
51float tiles=tile_id.z;vec2 mercator=(tile_anchor/EXTENT+tile_id.xy)/tiles;mercator-=mercator_center;mercator.x=wrap(mercator.x,-0.5,0.5);vec4 mercator_tile=vec4(mercator.xy*EXTENT,EXTENT/(2.0*PI),1.0);mercator_tile=matrix*mercator_tile;return mercator_tile.xyz;
52#else
53return vec3(0.0);
54#endif
55}vec3 mix_globe_mercator(vec3 globe,vec3 mercator,float t) {return mix(globe,mercator,t);}mat3 globe_mercator_surface_vectors(vec3 pos_normal,vec3 up_dir,float zoom_transition) {vec3 normal=zoom_transition==0.0 ? pos_normal : normalize(mix(pos_normal,up_dir,zoom_transition));vec3 xAxis=normalize(vec3(normal.z,0.0,-normal.x));vec3 yAxis=normalize(cross(normal,xAxis));return mat3(xAxis,yAxis,normal);}
56#endif
57vec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(
58unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0
59);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);
59return (tile_units_to_pixels*pos+offset)/pattern_size;}float mercatorXfromLng(float lng) {return (180.0+lng)/360.0;}float mercatorYfromLat(float lat) {return (180.0-(RAD_TO_DEG*log(tan(PI/4.0+lat/2.0*DEG_TO_RAD))))/360.0;}vec3 latLngToECEF(vec2 latLng) {latLng=DEG_TO_RAD*latLng;float cosLat=cos(latLng[0]);float sinLat=sin(latLng[0]);float cosLng=cos(latLng[1]);float sinLng=sin(latLng[1]);float sx=cosLat*sinLng*GLOBE_RADIUS;float sy=-sinLat*GLOBE_RADIUS;float sz=cosLat*cosLng*GLOBE_RADIUS;return vec3(sx,sy,sz);}
60#ifdef RENDER_CUTOFF
61uniform vec4 u_cutoff_params;out float v_cutoff_opacity;
62#endif
63const vec4 AWAY=vec4(-1000.0,-1000.0,-1000.0,1);const float skirtOffset=24575.0;vec3 decomposeToPosAndSkirt(vec2 posWithComposedSkirt)
64{float skirt=float(posWithComposedSkirt.x >=skirtOffset);vec2 pos=posWithComposedSkirt-vec2(skirt*skirtOffset,0.0);return vec3(pos,skirt);}`,Jn="in highp vec3 a_pos_3f;uniform lowp mat4 u_matrix;out highp vec3 v_uv;void main() {const mat3 half_neg_pi_around_x=mat3(1.0,0.0, 0.0,0.0,0.0,-1.0,0.0,1.0, 0.0);v_uv=half_neg_pi_around_x*a_pos_3f;vec4 pos=u_matrix*vec4(a_pos_3f,1.0);gl_Position=pos.xyww;}",bl=`
65#define ELEVATION_SCALE 7.0
66#define ELEVATION_OFFSET 450.0
67#ifdef PROJECTION_GLOBE_VIEW
68uniform vec3 u_tile_tl_up;uniform vec3 u_tile_tr_up;uniform vec3 u_tile_br_up;uniform vec3 u_tile_bl_up;uniform float u_tile_up_scale;vec3 elevationVector(vec2 pos) {vec2 uv=pos/EXTENT;vec3 up=normalize(mix(
69mix(u_tile_tl_up,u_tile_tr_up,uv.xxx),mix(u_tile_bl_up,u_tile_br_up,uv.xxx),uv.yyy));return up*u_tile_up_scale;}
70#else
71vec3 elevationVector(vec2 pos) { return vec3(0,0,1); }
72#endif
73#ifdef TERRAIN
74uniform highp sampler2D u_dem;uniform highp sampler2D u_dem_prev;uniform vec2 u_dem_tl;uniform vec2 u_dem_tl_prev;uniform float u_dem_scale;uniform float u_dem_scale_prev;uniform float u_dem_size;uniform float u_dem_lerp;uniform float u_exaggeration;uniform float u_meter_to_dem;uniform mat4 u_label_plane_matrix_inv;uniform sampler2D u_depth;uniform vec2 u_depth_size_inv;vec4 tileUvToDemSample(vec2 uv,float dem_size,float dem_scale,vec2 dem_tl) {vec2 pos=dem_size*(uv*dem_scale+dem_tl)+1.0;vec2 f=fract(pos);return vec4((pos-f+0.5)/(dem_size+2.0),f);}float currentElevation(vec2 apos) {
75#ifdef TERRAIN_DEM_FLOAT_FORMAT
76vec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale+u_dem_tl)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture(u_dem,pos).r;
77#else
78float dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale,u_dem_tl);vec2 pos=r.xy;vec2 f=r.zw;float tl=texture(u_dem,pos).r;float tr=texture(u_dem,pos+vec2(dd,0)).r;float bl=texture(u_dem,pos+vec2(0,dd)).r;float br=texture(u_dem,pos+vec2(dd,dd)).r;return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);
79#endif
80}float prevElevation(vec2 apos) {
81#ifdef TERRAIN_DEM_FLOAT_FORMAT
82vec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale_prev+u_dem_tl_prev)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture(u_dem_prev,pos).r;
83#else
84float dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale_prev,u_dem_tl_prev);vec2 pos=r.xy;vec2 f=r.zw;float tl=texture(u_dem_prev,pos).r;float tr=texture(u_dem_prev,pos+vec2(dd,0)).r;float bl=texture(u_dem_prev,pos+vec2(0,dd)).r;float br=texture(u_dem_prev,pos+vec2(dd,dd)).r;return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);
85#endif
86}
87#ifdef TERRAIN_VERTEX_MORPHING
88float elevation(vec2 apos) {
89#ifdef ZERO_EXAGGERATION
90return 0.0;
91#endif
92float nextElevation=currentElevation(apos);float prevElevation=prevElevation(apos);return mix(prevElevation,nextElevation,u_dem_lerp);}
93#else
94float elevation(vec2 apos) {
95#ifdef ZERO_EXAGGERATION
96return 0.0;
97#endif
98return currentElevation(apos);}
99#endif
100highp float unpack_depth(highp vec4 rgba_depth)
101{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}bool isOccluded(vec4 frag) {vec3 coord=frag.xyz/frag.w;float depth=unpack_depth(texture(u_depth,(coord.xy+1.0)*0.5));return coord.z > depth+0.0005;}float occlusionFade(vec4 frag) {vec3 coord=frag.xyz/frag.w;vec3 df=vec3(5.0*u_depth_size_inv,0.0);vec2 uv=0.5*coord.xy+0.5;vec4 depth=vec4(
102unpack_depth(texture(u_depth,uv-df.xz)),unpack_depth(texture(u_depth,uv+df.xz)),unpack_depth(texture(u_depth,uv-df.zy)),unpack_depth(texture(u_depth,uv+df.zy))
103);return dot(vec4(0.25),vec4(1.0)-clamp(300.0*(vec4(coord.z-0.001)-depth),0.0,1.0));}vec4 fourSample(vec2 pos,vec2 off) {float tl=texture(u_dem,pos).r;float tr=texture(u_dem,pos+vec2(off.x,0.0)).r;float bl=texture(u_dem,pos+vec2(0.0,off.y)).r;float br=texture(u_dem,pos+off).r;return vec4(tl,tr,bl,br);}float flatElevation(vec2 pack) {vec2 apos=floor(pack/8.0);vec2 span=10.0*(pack-apos*8.0);vec2 uvTex=(apos-vec2(1.0,1.0))/8190.0;float size=u_dem_size+2.0;float dd=1.0/size;vec2 pos=u_dem_size*(uvTex*u_dem_scale+u_dem_tl)+1.0;vec2 f=fract(pos);pos=(pos-f+0.5)*dd;vec4 h=fourSample(pos,vec2(dd));float z=mix(mix(h.x,h.y,f.x),mix(h.z,h.w,f.x),f.y);vec2 w=floor(0.5*(span*u_meter_to_dem-1.0));vec2 d=dd*w;h=fourSample(pos-d,2.0*d+vec2(dd));vec4 diff=abs(h.xzxy-h.ywzw);vec2 slope=min(vec2(0.25),u_meter_to_dem*0.5*(diff.xz+diff.yw)/(2.0*w+vec2(1.0)));vec2 fix=slope*span;float base=z+max(fix.x,fix.y);return u_exaggeration*base;}float elevationFromUint16(float word) {return u_exaggeration*(word/ELEVATION_SCALE-ELEVATION_OFFSET);}
104#else
105float elevation(vec2 pos) { return 0.0; }bool isOccluded(vec4 frag) { return false; }float occlusionFade(vec4 frag) { return 1.0; }
106#endif`,vs=`#ifdef FOG
107uniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump mat4 u_fog_matrix;out vec3 v_fog_pos;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}vec3 fog_position(vec3 pos) {return (u_fog_matrix*vec4(pos,1.0)).xyz;}vec3 fog_position(vec2 pos) {return fog_position(vec3(pos,0.0));}float fog(vec3 pos) {float depth=length(pos);float opacity=fog_opacity(fog_range(depth));return opacity*fog_horizon_blending(pos/depth);}
108#endif`,qc=`highp vec3 hash(highp vec2 p) {highp vec3 p3=fract(p.xyx*vec3(443.8975,397.2973,491.1871));p3+=dot(p3,p3.yxz+19.19);return fract((p3.xxy+p3.yzz)*p3.zyx);}
108vec3 dither(vec3 color,highp vec2 seed) {vec3 rnd=hash(seed)+hash(seed+0.59374)-0.5;return color+rnd/255.0;}
109#ifdef FOG
110uniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump vec2 u_fog_vertical_limit;uniform mediump float u_fog_temporal_offset;in vec3 v_fog_pos;uniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform highp vec2 u_viewport;uniform float u_globe_transition;uniform int u_is_globe;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}float globe_glow_progress() {highp vec2 uv=gl_FragCoord.xy/u_viewport;highp vec3 ray_dir=mix(
111mix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);highp vec3 dir=normalize(ray_dir);highp vec3 closest_point=dot(u_globe_pos,dir)*dir;highp float sdf=length(closest_point-u_globe_pos)/u_globe_radius;return sdf+PI*0.5;}float fog_opacity(vec3 pos) {float depth=length(pos);return fog_opacity(fog_range(depth));}vec3 fog_apply(vec3 color,vec3 pos,float opacity_limit) {float depth=length(pos);float opacity;if (u_is_globe==1) {float glow_progress=globe_glow_progress();float t=mix(glow_progress,depth,u_globe_transition);opacity=fog_opacity(fog_range(t));} else {opacity=fog_opacity(fog_range(depth));opacity*=fog_horizon_blending(pos/depth);}return mix(color,u_fog_color.rgb,min(opacity,opacity_limit));}vec3 fog_apply(vec3 color,vec3 pos) {return fog_apply(color,pos,1.0);}vec4 fog_apply_from_vert(vec4 color,float fog_opac) {float alpha=EPSILON+color.a;color.rgb=mix(color.rgb/alpha,u_fog_color.rgb,fog_opac)*alpha;return color;}vec3 fog_apply_sky_gradient(vec3 camera_ray,vec3 sky_color) {float horizon_blend=fog_horizon_blending(normalize(camera_ray));return mix(sky_color,u_fog_color.rgb,horizon_blend);}vec4 fog_apply_premultiplied(vec4 color,vec3 pos) {float alpha=EPSILON+color.a;color.rgb=fog_apply(color.rgb/alpha,pos)*alpha;return color;}vec4 fog_apply_premultiplied(vec4 color,vec3 pos,float heightMeters) {float verticalProgress=(u_fog_vertical_limit.x > 0.0 || u_fog_vertical_limit.y > 0.0) ? smoothstep(u_fog_vertical_limit.x,u_fog_vertical_limit.y,heightMeters) : 0.0;float opacityLimit=1.0-smoothstep(0.9,1.0,fog_opacity(pos));return mix(fog_apply_premultiplied(color,pos),color,min(verticalProgress,opacityLimit));}vec3 fog_dither(vec3 color) {
112#ifdef FOG_DITHERING
113vec2 dither_seed=gl_FragCoord.xy+u_fog_temporal_offset;return dither(color,dither_seed);
114#else
115return color;
116#endif
117}vec4 fog_dither(vec4 color) {return vec4(fog_dither(color.rgb),color.a);}
118#endif`,ea=`#ifdef RASTER_ARRAY
119uniform sampler2D u_image0;uniform sampler2D u_image1;const vec4 NODATA=vec4(1);ivec4 _raTexLinearCoord(highp vec2 texCoord,highp vec2 texResolution,out highp vec2 fxy) {texCoord=texCoord*texResolution-0.5;fxy=fract(texCoord);texCoord-=fxy;return ivec4(texCoord.xxyy+vec2(1.5,0.5).xyxy);}vec2 _raTexLinearMix(highp vec2 fxy,highp vec4 colorMix,highp float colorOffset,highp vec4 t00,highp vec4 t10,highp vec4 t01,highp vec4 t11) {vec2 c00=t00==NODATA ? vec2(0) : vec2(colorOffset+dot(t00,colorMix),1);vec2 c10=t10==NODATA ? vec2(0) : vec2(colorOffset+dot(t10,colorMix),1);vec2 c01=t01==NODATA ? vec2(0) : vec2(colorOffset+dot(t01,colorMix),1);vec2 c11=t11==NODATA ? vec2(0) : vec2(colorOffset+dot(t11,colorMix),1);return mix(mix(c01,c11,fxy.x),mix(c00,c10,fxy.x),fxy.y);}vec2 raTexture2D_image0_linear(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec2 fxy;ivec4 c=_raTexLinearCoord(texCoord,texResolution,fxy);return _raTexLinearMix(fxy,colorMix,colorOffset,texelFetch(u_image0,c.yz,0),texelFetch(u_image0,c.xz,0),texelFetch(u_image0,c.yw,0),texelFetch(u_image0,c.xw,0)
120);}
120vec2 raTexture2D_image1_linear(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec2 fxy;ivec4 c=_raTexLinearCoord(texCoord,texResolution,fxy);return _raTexLinearMix(fxy,colorMix,colorOffset,texelFetch(u_image1,c.yz,0),texelFetch(u_image1,c.xz,0),texelFetch(u_image1,c.yw,0),texelFetch(u_image1,c.xw,0)
121);}vec2 raTexture2D_image0_nearest(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec4 t=texelFetch(u_image0,ivec2(texCoord*texResolution),0);return t==NODATA ? vec2(0) : vec2(colorOffset+dot(t,colorMix),1);}vec2 raTexture2D_image1_nearest(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec4 t=texelFetch(u_image1,ivec2(texCoord*texResolution),0);return t==NODATA ? vec2(0) : vec2(colorOffset+dot(t,colorMix),1);}
122#endif`,wl=`#ifdef RASTER_ARRAY
123uniform sampler2D u_velocity;uniform mediump vec2 u_velocity_res;uniform mediump float u_max_speed;const vec4 NO_DATA=vec4(1);const vec2 INVALID_VELOCITY=vec2(-1);uniform highp vec2 u_uv_offset;uniform highp float u_data_offset;uniform highp vec4 u_data_scale;ivec4 rasterArrayLinearCoord(highp vec2 texCoord,highp vec2 texResolution,out highp vec2 fxy) {texCoord=texCoord*texResolution-0.5;fxy=fract(texCoord);texCoord-=fxy;return ivec4(texCoord.xxyy+vec2(1.5,0.5).xyxy);}highp vec2 lookup_velocity(highp vec2 uv) {uv=u_uv_offset.x+u_uv_offset.y*uv;highp vec2 fxy;ivec4 c=rasterArrayLinearCoord(uv,u_velocity_res,fxy);highp vec4 tl=texelFetch(u_velocity,c.yz,0);highp vec4 tr=texelFetch(u_velocity,c.xz,0);highp vec4 bl=texelFetch(u_velocity,c.yw,0);highp vec4 br=texelFetch(u_velocity,c.xw,0);if (tl==NO_DATA) {return INVALID_VELOCITY;}if (tr==NO_DATA) {return INVALID_VELOCITY;}if (bl==NO_DATA) {return INVALID_VELOCITY;}if (br==NO_DATA) {return INVALID_VELOCITY;}highp vec4 t=mix(mix(bl,br,fxy.x),mix(tl,tr,fxy.x),fxy.y);highp vec2 velocity=vec2(u_data_offset+dot(t.rg,u_data_scale.yx),-(u_data_offset+dot(t.ba,u_data_scale.yx)));velocity/=max(u_max_speed,length(velocity));return velocity;}
124#endif
125uniform highp float u_particle_pos_scale;uniform highp vec2 u_particle_pos_offset;highp vec4 pack_pos_to_rgba(highp vec2 p) {highp vec2 v=(p+u_particle_pos_offset)/u_particle_pos_scale;highp vec4 r=vec4(v.x,fract(v.x*255.0),v.y,fract(v.y*255.0));return vec4(r.x-r.y/255.0,r.y,r.z-r.w/255.0,r.w);}highp vec2 unpack_pos_from_rgba(highp vec4 v) {v=floor(v*255.0+0.5)/255.0;highp vec2 p=vec2(v.x+(v.y/255.0),v.z+(v.w/255.0));return u_particle_pos_scale*p-u_particle_pos_offset;}`,ta=`#ifdef RENDER_SHADOWS
126uniform mediump vec3 u_shadow_direction;uniform highp vec3 u_shadow_normal_offset;vec3 shadow_normal_offset(vec3 normal) {float tileInMeters=u_shadow_normal_offset[0];vec3 n=vec3(-normal.xy,tileInMeters*normal.z);float dotScale=min(1.0-dot(normal,u_shadow_direction),1.0)*0.5+0.5;return n*dotScale;}vec3 shadow_normal_offset_model(vec3 normal) {float dotScale=min(1.0-dot(normal,u_shadow_direction),1.0)*0.5+0.5;return normal*dotScale;}float shadow_normal_offset_multiplier0() {return u_shadow_normal_offset[1];}float shadow_normal_offset_multiplier1() {return u_shadow_normal_offset[2];}
127#endif//RENDER_SHADOWS`,Tl=`#ifdef RENDER_SHADOWS
128#ifdef DEPTH_TEXTURE
129uniform highp sampler2D u_shadowmap_0;uniform highp sampler2D u_shadowmap_1;
130#else
131uniform sampler2D u_shadowmap_0;uniform sampler2D u_shadowmap_1;
132#endif
133uniform float u_shadow_intensity;uniform float u_shadow_map_resolution;uniform float u_shadow_texel_size;uniform highp vec3 u_shadow_normal_offset;uniform vec2 u_fade_range;uniform mediump vec3 u_shadow_direction;uniform highp vec3 u_shadow_bias;highp float shadow_sample_1(highp vec2 uv,highp float compare) {highp float shadow_depth;
134#ifdef DEPTH_TEXTURE
135shadow_depth=texture(u_shadowmap_1,uv).r;
136#else
137shadow_depth=unpack_depth(texture(u_shadowmap_1,uv))*0.5+0.5;
138#endif
139return step(shadow_depth,compare);}highp float shadow_sample_0(highp vec2 uv,highp float compare) {highp float shadow_depth;
140#ifdef DEPTH_TEXTURE
141shadow_depth=texture(u_shadowmap_0,uv).r;
142#else
143shadow_depth=unpack_depth(texture(u_shadowmap_0,uv))*0.5+0.5;
144#endif
145return step(shadow_depth,compare);}
145float shadow_occlusion_1(highp vec4 pos,highp float bias) {highp vec2 uv=pos.xy;return shadow_sample_1(uv,pos.z-bias);}float shadow_occlusion_0(highp vec4 pos,highp float bias) {highp float compare0=pos.z-bias;
146#ifdef NATIVE
147highp vec2 uv=pos.xy;highp vec4 samples=textureGather(u_shadowmap_0,uv,0);lowp vec4 stepSamples=step(samples,vec4(compare0));
148#else
149highp vec2 uv00=pos.xy-vec2(0.5*u_shadow_texel_size);highp vec2 uv10=uv00+vec2(u_shadow_texel_size,0.0);highp vec2 uv01=uv00+vec2(0.0,u_shadow_texel_size);highp vec2 uv11=uv01+vec2(u_shadow_texel_size,0.0);lowp vec4 stepSamples=vec4(
150shadow_sample_0(uv01,compare0),shadow_sample_0(uv11,compare0),shadow_sample_0(uv10,compare0),shadow_sample_0(uv00,compare0)
151);
152#endif
153vec2 f=fract(pos.xy*u_shadow_map_resolution-vec2(0.5));lowp vec2 lerpx=mix(stepSamples.wx,stepSamples.zy,f.xx);return mix(lerpx.x,lerpx.y,f.y);}float shadow_occlusion(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth,highp float bias) {
154#ifdef SHADOWS_SINGLE_CASCADE
155light_view_pos0.xyz=light_view_pos0.xyz/light_view_pos0.w*0.5+0.5;return shadow_occlusion_0(light_view_pos0,bias);
156#else
157light_view_pos0.xyz/=light_view_pos0.w;light_view_pos1.xyz/=light_view_pos1.w;vec4 uv=vec4(light_view_pos0.xy,light_view_pos1.xy);vec4 abs_bounds=abs(uv);if (abs_bounds.x < 1.0 && abs_bounds.y < 1.0) {light_view_pos0.xyz=light_view_pos0.xyz*0.5+0.5;return shadow_occlusion_0(light_view_pos0,bias);}if (abs_bounds.z >=1.0 || abs_bounds.w >=1.0) {return 0.0;}light_view_pos1.xyz=light_view_pos1.xyz*0.5+0.5;float occlusion1=shadow_occlusion_1(light_view_pos1,bias);return mix(occlusion1,0.0,smoothstep(u_fade_range.x,u_fade_range.y,view_depth));
158#endif
159}highp float calculate_shadow_bias(float NDotL) {
160#ifdef NORMAL_OFFSET
161return 0.5*u_shadow_bias.x;
162#else
163return 0.5*(u_shadow_bias.x+clamp(u_shadow_bias.y*tan(acos(NDotL)),0.0,u_shadow_bias.z));
164#endif
165}float shadowed_light_factor_normal(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float NDotL=dot(N,u_shadow_direction);float bias=calculate_shadow_bias(NDotL);float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}float shadowed_light_factor_normal_unbiased(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float NDotL=dot(N,u_shadow_direction);float bias=0.0;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}float shadowed_light_factor(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float bias=0.0;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return 1.0-(u_shadow_intensity*occlusion);}float shadow_occlusion(float ndotl,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float bias=calculate_shadow_bias(ndotl);return shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);}
166#endif`;const ti=[];Kn(Ko,ti),Kn(vl,ti),Kn(Gc,ti);const Ct={"_prelude_fog.vertex.glsl":vs,"_prelude_terrain.vertex.glsl":bl,"_prelude_shadow.vertex.glsl":ta,"_prelude_fog.fragment.glsl":qc,"_prelude_shadow.fragment.glsl":Tl,"_prelude_lighting.glsl":`
167#ifdef LIGHTING_3D_MODE
168uniform mediump vec3 u_lighting_ambient_color;uniform mediump vec3 u_lighting_directional_dir;uniform mediump vec3 u_lighting_directional_color;uniform mediump vec3 u_ground_radiance;float calculate_ambient_directional_factor(vec3 normal) {float NdotL=dot(normal,u_lighting_directional_dir);const float factor_reduction_max=0.3;float dir_luminance=dot(u_lighting_directional_color,vec3(0.2126,0.7152,0.0722));float directional_factor_min=1.0-factor_reduction_max*min(dir_luminance,1.0);float ambient_directional_factor=mix(directional_factor_min,1.0,min((NdotL+1.0),1.0));const float vertical_factor_min=0.92;float vertical_factor=mix(vertical_factor_min,1.0,normal.z*0.5+0.5);return vertical_factor*ambient_directional_factor;}vec3 linearProduct(vec3 srgbIn,vec3 k) {return srgbIn*pow(k,vec3(1./2.2));}vec3 apply_lighting(vec3 color,vec3 normal,float dir_factor) {float ambient_directional_factor=calculate_ambient_directional_factor(normal);vec3 ambient_contrib=ambient_directional_factor*u_lighting_ambient_color;vec3 directional_contrib=u_lighting_directional_color*dir_factor;return linearProduct(color,ambient_contrib+directional_contrib);}vec4 apply_lighting(vec4 color,vec3 normal,float dir_factor) {return vec4(apply_lighting(color.rgb,normal,dir_factor),color.a);}vec3 apply_lighting(vec3 color,vec3 normal) {float dir_factor=max(dot(normal,u_lighting_directional_dir),0.0);return apply_lighting(color.rgb,normal,dir_factor);}vec4 apply_lighting(vec4 color,vec3 normal) {float dir_factor=max(dot(normal,u_lighting_directional_dir),0.0);return vec4(apply_lighting(color.rgb,normal,dir_factor),color.a);}vec3 apply_lighting_ground(vec3 color) {return color*u_ground_radiance;}vec4 apply_lighting_ground(vec4 color) {return vec4(apply_lighting_ground(color.rgb),color.a);}float calculate_NdotL(vec3 normal) {const float ext=0.70710678118;return (clamp(dot(normal,u_lighting_directional_dir),-ext,1.0)+ext)/(1.0+ext);}vec4 apply_lighting_with_emission_ground(vec4 color,float emissive_strength) {return mix(apply_lighting_ground(color),color,emissive_strength);}vec3 compute_flood_lighting(vec3 flood_light_color,float fully_occluded_factor,float occlusion,vec3 ground_shadow_factor) {vec3 fully_occluded_color=flood_light_color*mix(ground_shadow_factor,vec3(1.0),fully_occluded_factor);float occlusion_ramp=smoothstep(0.0,0.2,1.0-occlusion);return mix(fully_occluded_color,flood_light_color,occlusion_ramp);}vec3 compute_emissive_draped(vec3 unlit_color,float fully_occluded_factor,float occlusion,vec3 ground_shadow_factor) {vec3 fully_occluded_color=unlit_color*mix(ground_shadow_factor,vec3(1.0),fully_occluded_factor);return mix(fully_occluded_color,unlit_color,1.0-occlusion);}
169#endif//LIGHTING_3D_MODE`,"_prelude_raster_array.glsl":ea,"_prelude_raster_particle.glsl":wl},ia={};zt("",bl),zt(qc,vs),zt(Tl,ta),zt(ea,""),zt(wl,"");const ra=zt(Gc,vl),El=Ko;var on={background:zt(`#include "_prelude_fog.fragment.glsl"
170#include "_prelude_lighting.glsl"
171uniform vec4 u_color;uniform float u_opacity;
172#ifdef LIGHTING_3D_MODE
173in vec4 v_color;
174#endif
175void main() {vec4 out_color;
176#ifdef LIGHTING_3D_MODE
177out_color=v_color;
178#else
179out_color=u_color;
180#endif
181#ifdef FOG
182out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
183#endif
184glFragColor=out_color*u_opacity;
185#ifdef OVERDRAW_INSPECTOR
186glFragColor=vec4(1.0);
187#endif
188HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
189#include "_prelude_lighting.glsl"
190in vec2 a_pos;uniform mat4 u_matrix;
191#ifdef LIGHTING_3D_MODE
192uniform mediump vec4 u_color;out vec4 v_color;uniform float u_emissive_strength;
193#endif
194void main() {gl_Position=u_matrix*vec4(a_pos,0,1);
195#ifdef LIGHTING_3D_MODE
196v_color=apply_lighting_with_emission_ground(u_color,u_emissive_strength);
197#endif
198#ifdef FOG
199v_fog_pos=fog_position(a_pos);
200#endif
201}`),backgroundPattern:zt(`#include "_prelude_fog.fragment.glsl"
202#include "_prelude_lighting.glsl"
203uniform vec2 u_pattern_tl;uniform vec2 u_pattern_br;uniform vec2 u_texsize;uniform float u_opacity;uniform float u_emissive_strength;uniform sampler2D u_image;in vec2 v_pos;void main() {vec2 imagecoord=mod(v_pos,1.0);vec2 pos=mix(u_pattern_tl/u_texsize,u_pattern_br/u_texsize,imagecoord);vec4 out_color=textureLodCustom(u_image,pos,v_pos);
204#ifdef LIGHTING_3D_MODE
205out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);
206#endif
207#ifdef FOG
208out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
209#endif
210glFragColor=out_color*u_opacity;
211#ifdef OVERDRAW_INSPECTOR
212glFragColor=vec4(1.0);
213#endif
214HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
215uniform mat4 u_matrix;uniform vec2 u_pattern_size;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_pattern_size,u_tile_units_to_pixels,a_pos);
216#ifdef FOG
217v_fog_pos=fog_position(a_pos);
218#endif
219}`),circle:zt(`#include "_prelude_fog.fragment.glsl"
220#include "_prelude_lighting.glsl"
221in vec3 v_data;in float v_visibility;
222#pragma mapbox: define highp vec4 color
223#pragma mapbox: define mediump float radius
224#pragma mapbox: define lowp float blur
225#pragma mapbox: define lowp float opacity
226#pragma mapbox: define highp vec4 stroke_color
227#pragma mapbox: define mediump float stroke_width
228#pragma mapbox: define lowp float stroke_opacity
229uniform float u_emissive_strength;void main() {
230#pragma mapbox: initialize highp vec4 color
231#pragma mapbox: initialize mediump float radius
232#pragma mapbox: initialize lowp float blur
233#pragma mapbox: initialize lowp float opacity
234#pragma mapbox: initialize highp vec4 stroke_color
235#pragma mapbox: initialize mediump float stroke_width
236#pragma mapbox: initialize lowp float stroke_opacity
237vec2 extrude=v_data.xy;float extrude_length=length(extrude);lowp float antialiasblur=v_data.z;float antialiased_blur=-max(blur,antialiasblur);float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(
238antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width)
239);vec4 out_color=mix(color*opacity,stroke_color*stroke_opacity,color_t);
240#ifdef LIGHTING_3D_MODE
241out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);
242#endif
243#ifdef FOG
244out_color=fog_apply_premultiplied(out_color,v_fog_pos);
245#endif
246glFragColor=out_color*(v_visibility*opacity_t);
247#ifdef OVERDRAW_INSPECTOR
248glFragColor=vec4(1.0);
249#endif
250}`,`#include "_prelude_fog.vertex.glsl"
251#include "_prelude_terrain.vertex.glsl"
252#define NUM_VISIBILITY_RINGS 2
253#define INV_SQRT2 0.70710678
254#define ELEVATION_BIAS 0.0001
255#define NUM_SAMPLES_PER_RING 16
256uniform mat4 u_matrix;uniform mat2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;in vec2 a_pos;
257#ifdef PROJECTION_GLOBE_VIEW
258in vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;
259#endif
260out vec3 v_data;out float v_visibility;
261#pragma mapbox: define highp vec4 color
262#pragma mapbox: define mediump float radius
263#pragma mapbox: define lowp float blur
264#pragma mapbox: define lowp float opacity
265#pragma mapbox: define highp vec4 stroke_color
266#pragma mapbox: define mediump float stroke_width
267#pragma mapbox: define lowp float stroke_opacity
268vec2 calc_offset(vec2 extrusion,float radius,float stroke_width, float view_scale) {return extrusion*(radius+stroke_width)*u_extrude_scale*view_scale;}float cantilevered_elevation(vec2 pos,float radius,float stroke_width,float view_scale) {vec2 c1=pos+calc_offset(vec2(-1,-1),radius,stroke_width,view_scale);vec2 c2=pos+calc_offset(vec2(1,-1),radius,stroke_width,view_scale);vec2 c3=pos+calc_offset(vec2(1,1),radius,stroke_width,view_scale);vec2 c4=pos+calc_offset(vec2(-1,1),radius,stroke_width,view_scale);float h1=elevation(c1)+ELEVATION_BIAS;float h2=elevation(c2)+ELEVATION_BIAS;float h3=elevation(c3)+ELEVATION_BIAS;float h4=elevation(c4)+ELEVATION_BIAS;return max(h4,max(h3,max(h1,h2)));}float circle_elevation(vec2 pos) {
269#if defined(TERRAIN)
270return elevation(pos)+ELEVATION_BIAS;
271#else
272return 0.0;
273#endif
274}vec4 project_vertex(vec2 extrusion,vec4 world_center,vec4 projected_center,float radius,float stroke_width, float view_scale,mat3 surface_vectors) {vec2 sample_offset=calc_offset(extrusion,radius,stroke_width,view_scale);
275#ifdef PITCH_WITH_MAP
276#ifdef PROJECTION_GLOBE_VIEW
277return u_matrix*( world_center+vec4(sample_offset.x*surface_vectors[0]+sample_offset.y*surface_vectors[1],0) );
278#else
279return u_matrix*( world_center+vec4(sample_offset,0,0) );
280#endif
281#else
282return projected_center+vec4(sample_offset,0,0);
283#endif
284}float get_sample_step() {
285#ifdef PITCH_WITH_MAP
286return 2.0*PI/float(NUM_SAMPLES_PER_RING);
287#else
288return PI/float(NUM_SAMPLES_PER_RING);
289#endif
290}void main(void) {
291#pragma mapbox: initialize highp vec4 color
292#pragma mapbox: initialize mediump float radius
293#pragma mapbox: initialize lowp float blur
294#pragma mapbox: initialize lowp float opacity
295#pragma mapbox: initialize highp vec4 stroke_color
296#pragma mapbox: initialize mediump float stroke_width
297#pragma mapbox: initialize lowp float stroke_opacity
298vec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);vec4 world_center;mat3 surface_vectors;
299#ifdef PROJECTION_GLOBE_VIEW
300vec3 pos_normal_3=a_pos_normal_3/16384.0;surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(circle_center)*circle_elevation(circle_center);vec3 globe_pos=a_pos_3+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*circle_elevation(circle_center);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,circle_center,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;vec3 pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);world_center=vec4(pos,1);
301#else 
302surface_vectors=mat3(1.0);float height=circle_elevation(circle_center);world_center=vec4(circle_center,height,1);
303#endif
304vec4 projected_center=u_matrix*world_center;float view_scale=0.0;
305#ifdef PITCH_WITH_MAP
306#ifdef SCALE_WITH_MAP
307view_scale=1.0;
308#else
309view_scale=projected_center.w/u_camera_to_center_distance;
310#endif
311#else
312#ifdef SCALE_WITH_MAP
313view_scale=u_camera_to_center_distance;
314#else
315view_scale=projected_center.w;
316#endif
317#endif
318gl_Position=project_vertex(extrude,world_center,projected_center,radiu
318s,stroke_width,view_scale,surface_vectors);float visibility=0.0;
319#ifdef TERRAIN
320float step=get_sample_step();vec4 occlusion_world_center;vec4 occlusion_projected_center;
321#ifdef PITCH_WITH_MAP
322float cantilevered_height=cantilevered_elevation(circle_center,radius,stroke_width,view_scale);occlusion_world_center=vec4(circle_center,cantilevered_height,1);occlusion_projected_center=u_matrix*occlusion_world_center;
323#else
324occlusion_world_center=world_center;occlusion_projected_center=projected_center;
325#endif
326for(int ring=0; ring < NUM_VISIBILITY_RINGS; ring++) {float scale=(float(ring)+1.0)/float(NUM_VISIBILITY_RINGS);for(int i=0; i < NUM_SAMPLES_PER_RING; i++) {vec2 extrusion=vec2(cos(step*float(i)),-sin(step*float(i)))*scale;vec4 frag_pos=project_vertex(extrusion,occlusion_world_center,occlusion_projected_center,radius,stroke_width,view_scale,surface_vectors);visibility+=float(!isOccluded(frag_pos));}}visibility/=float(NUM_VISIBILITY_RINGS)*float(NUM_SAMPLES_PER_RING);
327#else
328visibility=1.0;
329#endif
330#ifdef PROJECTION_GLOBE_VIEW
331visibility=1.0;
332#endif
333v_visibility=visibility;lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);
334#ifdef FOG
335v_fog_pos=fog_position(world_center.xyz);
336#endif
337}`),clippingMask:zt("void main() {glFragColor=vec4(1.0);}","in vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),heatmap:zt(`#include "_prelude_fog.fragment.glsl"
338uniform highp float u_intensity;in vec2 v_extrude;
339#pragma mapbox: define highp float weight
340#define GAUSS_COEF 0.3989422804014327
341void main() {
342#pragma mapbox: initialize highp float weight
343float d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);glFragColor=vec4(val,1.0,1.0,1.0);
344#ifdef FOG
345if (u_is_globe==0) {glFragColor.r*=pow(1.0-fog_opacity(v_fog_pos),2.0);}
346#endif
347#ifdef OVERDRAW_INSPECTOR
348glFragColor=vec4(1.0);
349#endif
350HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_terrain.vertex.glsl"
351#include "_prelude_fog.vertex.glsl"
352uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;in vec2 a_pos;
353#ifdef PROJECTION_GLOBE_VIEW
354in vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;
355#endif
356out vec2 v_extrude;
357#pragma mapbox: define highp float weight
358#pragma mapbox: define mediump float radius
359const highp float ZERO=1.0/255.0/16.0;
360#define GAUSS_COEF 0.3989422804014327
361void main(void) {
362#pragma mapbox: initialize highp float weight
363#pragma mapbox: initialize mediump float radius
364vec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec2 tilePos=floor(a_pos*0.5);vec3 pos;
365#ifdef PROJECTION_GLOBE_VIEW
366vec3 pos_normal_3=a_pos_normal_3/16384.0;mat3 surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(tilePos)*elevation(tilePos);vec3 globe_pos=a_pos_3+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*elevation(tilePos);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,tilePos,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);
367#else
368pos=vec3(tilePos+extrude,elevation(tilePos));
369#endif
370gl_Position=u_matrix*vec4(pos,1);
371#ifdef FOG
372v_fog_pos=fog_position(pos);
373#endif
374}`),heatmapTexture:zt(`uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;in vec2 v_pos;void main() {float t=texture(u_image,v_pos).r;vec4 color=texture(u_color_ramp,vec2(t,0.5));glFragColor=color*u_opacity;
375#ifdef OVERDRAW_INSPECTOR
376glFragColor=vec4(0.0);
377#endif
378HANDLE_WIREFRAME_DEBUG;}`,"in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=vec4(a_pos,0,1);v_pos=a_pos*0.5+0.5;}"),collisionBox:zt("in float v_placed;in float v_notUsed;void main() {vec4 red =vec4(1.0,0.0,0.0,1.0);vec4 blue=vec4(0.0,0.0,1.0,0.5);glFragColor =mix(red,blue,step(0.5,v_placed))*0.5;glFragColor*=mix(1.0,0.1,step(0.5,v_notUsed));}",`#include "_prelude_terrain.vertex.glsl"
379in vec3 a_pos;in vec2 a_anchor_pos;in vec2 a_extrude;in vec2 a_placed;in vec2 a_shift;in float a_size_scale;in vec2 a_padding;in float a_z_offset;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;out float v_placed;out float v_notUsed;void main() {vec4 projectedPoint=u_matrix*vec4(a_pos+elevationVector(a_anchor_pos)*(a_z_offset+elevation(a_anchor_pos)),1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(
3800.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,1.5);gl_Position=projectedPoint;gl_Position.xy+=(a_extrude*a_size_scale+a_shift+a_padding)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}`),collisionCircle:zt("in float v_radius;in vec2 v_extrude;in float v_perspective_ratio;in float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);glFragColor=color*alpha*opacity_t;}",`in vec2 a_pos_2f;in float a_radius;in vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;out float v_radius;out vec2 v_extrude;out float v_perspective_ratio;out float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd  =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz  /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos_2f;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(
381mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(
3820.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}`),debug:zt("uniform highp vec4 u_color;uniform sampler2D u_overlay;in vec2 v_uv;void main() {vec4 overlay_color=texture(u_overlay,v_uv);glFragColor=mix(u_color,overlay_color,overlay_color.a);}",`#include "_prelude_terrain.vertex.glsl"
383in vec2 a_pos;
384#ifdef PROJECTION_GLOBE_VIEW
385in vec3 a_pos_3;
386#endif
387out vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {float h=elevation(a_pos);v_uv=a_pos/8192.0;
388#ifdef PROJECTION_GLOBE_VIEW
389gl_Position=u_matrix*vec4(a_pos_3+elevationVector(a_pos)*h,1);
390#else
391gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,h,1);
392#endif
393}`),fill:zt(`#include "_prelude_fog.fragment.glsl"
394#include "_prelude_lighting.glsl"
395#pragma mapbox: define highp vec4 color
396#pragma mapbox: define lowp float opacity
397uniform float u_emissive_strength;void main() {
398#pragma mapbox: initialize highp vec4 color
399#pragma mapbox: initialize lowp float opacity
400vec4 out_color=color;
401#ifdef LIGHTING_3D_MODE
402out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);
403#endif
404#ifdef FOG
405out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
406#endif
407glFragColor=out_color*opacity;
408#ifdef OVERDRAW_INSPECTOR
409glFragColor=vec4(1.0);
410#endif
411HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
412in vec2 a_pos;uniform mat4 u_matrix;
413#pragma mapbox: define highp vec4 color
414#pragma mapbox: define lowp float opacity
415void main() {
416#pragma mapbox: initialize highp vec4 color
417#pragma mapbox: initialize lowp float opacity
418gl_Position=u_matrix*vec4(a_pos,0,1);
419#ifdef FOG
420v_fog_pos=fog_position(a_pos);
421#endif
422}`),fillOutline:zt(`#include "_prelude_fog.fragment.glsl"
423#include "_prelude_lighting.glsl"
424in highp vec2 v_pos;uniform float u_emissive_strength;
425#pragma mapbox: define highp vec4 outline_color
426#pragma mapbox: define lowp float opacity
427void main() {
428#pragma mapbox: initialize highp vec4 outline_color
429#pragma mapbox: initialize lowp float opacity
430float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=outline_color;
431#ifdef LIGHTING_3D_MODE
432out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);
433#endif
434#ifdef FOG
435out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
436#endif
437glFragColor=out_color*(alpha*opacity);
438#ifdef OVERDRAW_INSPECTOR
439glFragColor=vec4(1.0);
440#endif
441HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
442in vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;out highp vec2 v_pos;
443#pragma mapbox: define highp vec4 outline_color
444#pragma mapbox: define lowp float opacity
445void main() {
446#pragma mapbox: initialize highp vec4 outline_color
447#pragma mapbox: initialize lowp float opacity
448gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;
449#ifdef FOG
450v_fog_pos=fog_position(a_pos);
451#endif
452}`),fillOutlinePattern:zt(`#include "_prelude_fog.fragment.glsl"
453#include "_prelude_lighting.glsl"
454uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_emissive_strength;in highp vec2 v_pos;in highp vec2 v_pos_world;
455#pragma mapbox: define lowp float opacity
456#pragma mapbox: define lowp vec4 pattern
457void main() {
458#pragma mapbox: initialize lowp float opacity
459#pragma mapbox: initialize mediump vec4 pattern
460vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 imagecoord=mod(v_pos,1.0);vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);float dist=length(v_pos_world-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=textureLodCustom(u_image,pos,lod_pos);
461#ifdef LIGHTING_3D_MODE
462out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);
463#endif
464#ifdef FOG
465out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
466#endif
467glFragColor=out_color*(alpha*opacity);
468#ifdef OVERDRAW_INSPECTOR
469glFragColor=vec4(1.0);
470#endif
471HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
472uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in vec2 a_pos;out highp vec2 v_pos;out highp vec2 v_pos_world;
473#pragma mapbox: define lowp float opacity
474#pragma mapbox: define lowp vec4 pattern
475#pragma mapbox: define lowp float pixel_ratio
476void main() {
477#pragma mapbox: initialize lowp float opacity
478#pragma mapbox: initialize mediump vec4 pattern
479#pragma mapbox: initialize lowp float pixel_ratio
480vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,a_pos);v_pos_world=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;
481#ifdef FOG
482v_fog_pos=fog_position(a_pos);
483#endif
484}`),fillPattern:zt(`#include "_prelude_fog.fragment.glsl"
485#include "_prelude_lighting.glsl"
486uniform vec2 u_texsize;uniform sampler2D u_image;in vec2 v_pos;uniform float u_emissive_strength;
487#pragma mapbox: define lowp float opacity
488#pragma mapbox: define lowp vec4 pattern
489void main() {
490#pragma mapbox: initialize lowp float opacity
491#pragma mapbox: initialize mediump vec4 pattern
492vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 imagecoord=mod(v_pos,1.0);vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);vec4 out_color=textureLodCustom(u_image,pos,lod_pos);
493#ifdef LIGHTING_3D_MODE
494out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);
495#endif
496#ifdef FOG
497out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
498#endif
499glFragColor=out_color*opacity;
500#ifdef OVERDRAW_INSPECTOR
501glFragColor=vec4(1.0);
502#endif
503HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
504uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in vec2 a_pos;out vec2 v_pos;
505#pragma mapbox: define lowp float opacity
506#pragma mapbox: define lowp vec4 pattern
507#pragma mapbox: define lowp float pixel_ratio
508void main() {
509#pragma mapbox: initialize lowp float opacity
510#pragma mapbox: initialize mediump vec4 pattern
511#pragma mapbox: initialize lowp float pixel_ratio
512vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,a_pos);
513#ifdef FOG
514v_fog_pos=fog_position(a_pos);
515#endif
516}`),fillExtrusion:zt(`#include "_prelude_fog.fragment.glsl"
517#include "_prelude_shadow.fragment.glsl"
518#include "_prelude_lighting.glsl"
519in vec4 v_color;in vec4 v_flat;
520#ifdef RENDER_SHADOWS
521in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;
522#endif
523uniform lowp float u_opacity;
524#ifdef FAUX_AO
525uniform lowp vec2 u_ao;in vec2 v_ao;
526#endif
527#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)
528in vec4 v_roof_color;
529#endif
530#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)
531in highp vec3 v_normal;
532#endif
533uniform vec3 u_flood_light_color;uniform highp float u_vertical_scale;uniform float u_flood_light_intensity;uniform vec3 u_ground_shadow_factor;
534#if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT)
535in float v_flood_radius;in float v_has_floodlight;
536#endif
537uniform float u_emissive_strength;in float v_height;void main() {
538#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)
539vec3 normal=normalize(v_normal);
540#endif
541float z;vec4 color=v_color;
542#ifdef ZERO_ROOF_RADIUS
543z=float(normal.z > 0.00001);
544#ifdef LIGHTING_3D_MODE
545normal=mix(normal,vec3(0.0,0.0,1.0),z);
546#else
547color=mix(v_color,v_roof_color,z);
548#endif
549#endif
550float h=max(0.0,v_height);float ao_shade=1.0;
551#ifdef FAUX_AO
552float intensity=u_ao[0];float h_floors=h/(u_ao[1]*u_vertical_scale);float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);ao_shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x;
553#ifdef ZERO_ROOF_RADIUS
554concave*=(1.0-z);
555#endif
556float x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);ao_shade*=mix(1.0,x_shade*x_shade*x_shade,concave);
557#ifdef LIGHTING_3D_MODE
558#ifdef FLOOD_LIGHT
559color.rgb*=mix(ao_shade,1.0,v_has_floodlight);
560#else
561color.rgb*=ao_shade;
562#endif
563#else
564color.rgb*=ao_shade;
565#endif
566#endif
567#ifdef LIGHTING_3D_MODE
568float flood_radiance=0.0;
569#ifdef FLOOD_LIGHT
570flood_radiance=(1.0-min(h/v_flood_radius,1.0))*u_flood_light_intensity*v_has_floodlight;
571#endif
572#ifdef RENDER_SHADOWS
573#ifdef FLOOD_LIGHT
574float ndotl_unclamped=dot(normal,u_shadow_direction);float ndotl=max(0.0,ndotl_unclamped);float occlusion=ndotl_unclamped < 0.0 ? 1.0 : shadow_occlusion(ndotl,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);vec3 litColor=apply_lighting(color.rgb,normal,(1.0-u_shadow_intensity*occlusion)*ndotl);vec3 floodLitColor=compute_flood_lighting(u_flood_light_color*u_opacity,1.0-u_shadow_intensity,occlusion,u_ground_shadow_factor);color.rgb=mix(litColor,floodLitColor,flood_radiance);
575#else
576float shadowed_lighting_factor=shadowed_light_factor_normal(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);color.rgb=apply_lighting(color.rgb,normal,shadowed_lighting_factor);
577#endif
578#else
579color.rgb=apply_lighting(color.rgb,normal);
580#ifdef FLOOD_LIGHT
581color.rgb=mix(color.rgb,u_flood_light_color*u_opacity,flood_radiance);
582#endif
583#endif
584color.rgb=mix(color.rgb,v_flat.rgb,u_emissive_strength);color*=u_opacity;
585#endif
586#ifdef FOG
587color=fog_dither(fog_apply_premultiplied(color,v_fog_pos,h));
588#endif
589#ifdef INDICATOR_CUTOUT
590color=applyCutout(color);
591#endif
592glFragColor=color;
593#ifdef OVERDRAW_INSPECTOR
594glFragColor=vec4(1.0);
595#endif
596HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
597#include "_prelude_terrain.vertex.glsl"
598#include "_prelude_shadow.vertex.glsl"
599#include "_prelude_lighting.glsl"
600uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform float u_edge_radius;in vec4 a_pos_normal_ed;in vec2 a_centroid_pos;
601#ifdef PROJECTION_GLOBE_VIEW
602in vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift;
603#endif
604uniform highp float u_vertical_scale;out vec4 v_color;out vec4 v_flat;
605#ifdef RENDER_SHADOWS
606uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;
607#endif
608#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)
609out vec4 v_roof_color;
610#endif
611#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)
612out highp vec3 v_normal;
613#endif
614#ifdef FAUX_AO
615uniform lowp vec2 u_ao;out vec2 v_ao;
616#endif
617#if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT)
618out float v_flood_radius;out float v_has_floodlight;
619#endif
620out float v_height;
621#pragma mapbox: define highp float base
622#pragma mapbox: define highp float height
623#pragma mapbox: define highp vec4 color
624#pragma mapbox: define highp float flood_light_wall_radius
625void main() {
626#pragma mapbox: initialize highp float base
627#pragma mapbox: initialize highp float height
628#pragma mapbox: initialize highp vec4 color
629#pragma mapbox: initialize highp float flood_light_wall_radius
630base*=u_vertical_scale;height*=u_vertical_scale;vec4 pos_nx=floor(a_pos_normal_ed*0.5);vec4 top_up_ny_start=a_pos_normal_ed-2.0*pos_nx;vec3 top_up_ny=top_up_ny_start.xyz;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0));
631#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)
632v_normal=normal;
633#endif
634base=max(0.0,base);float attr_height=height;height=max(0.0,top_up_ny.y==0.0 && top_up_ny.x==1.0 ? height-u_edge_radius : height);float t=top_up_ny.x;vec2 centroid_pos=vec2(0.0);
635#if defined(HAS_CENTROID) || defined(TERRAIN)
636centroid_pos=a_centroid_pos;
637#endif
638float ele=0.0;float h=0.0;float c_ele=0.0;vec3 pos;
639#ifdef TERRAIN
640bool flat_roof=centroid_pos.x !=0.0 && t > 0.0;ele=elevation(pos_nx.xy);c_ele=flat_roof ? centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos) : ele;h=flat_roof ? max(c_ele+height,ele+base+2.0) : ele+(t > 0.0 ? height : base==0.0 ?-5.0 : base);pos=vec3(pos_nx.xy,h);
641#else
642h=t > 0.0 ? height : base;pos=vec3(pos_nx.xy,h);
643#endif
644#ifdef PROJECTION_GLOBE_VIEW
645float lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*h);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,pos.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*pos.z;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);
646#endif
647float cutoff=1.0;vec3 scaled_pos=pos;
648#ifdef RENDER_CUTOFF
649vec3 centroid_random=vec3(centroid_pos.xy,centroid_pos.x+centroid_pos.y+1.0);vec3 ground_pos=centroid_pos.x==0.0 ? pos.xyz : (centroid_random/8.0);vec4 ground=u_matrix*vec4(ground_pos.xy,ele,1.0);cutoff=max(0.01,cutoff_opacity(u_cutoff_params,ground.z));if (centroid_pos.y !=0.0 && centroid_pos.x !=0.0) {vec3 g=floor(ground_pos);vec3 mod_=centroid_random-g*8.0;float seed=min(1.0,0.1*(min(3.5,max(mod_.x+mod_.y,0.2*attr_height))*0.35+mod_.z));if (cutoff < 0.8-seed) {cutoff=0.0;}}float cutoff_scale=cutoff;scaled_pos.z=mix(c_ele,h,cutoff_scale);
650#endif
651float hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (cutoff < 0.01 && centroid_pos.x !=0.0));gl_Position=mix(u_matrix*vec4(scaled_pos,1),AWAY,hidden);h=h-ele;v_height=h;
652#ifdef RENDER_SHADOWS
653vec3 shd_pos0=pos;vec3 shd_pos1=pos;
654#ifdef NORMAL_OFFSET
655vec3 offset=shadow_normal_offset(normal);shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();
656#endif
657v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);
658#endif
659float NdotL=0.0;float colorvalue=0.0;
660#ifndef LIGHTING_3D_MODE
661colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;NdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),NdotL);if (normal.y !=0.0) {float r=0.84;r=mix(0.7,0.98,1.0-u_lightintensity);NdotL*=(
662(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));}
663#endif
664#ifdef FAUX_AO
665float concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height;
666#ifdef TERRAIN
667top_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(ce
667ntroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height);
668#endif
669v_ao=vec2(mix(concave,-concave,start),y_ground);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]);
670#ifdef PROJECTION_GLOBE_VIEW
671top_height+=u_height_lift;
672#endif
673gl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w;
674#endif
675#ifdef LIGHTING_3D_MODE
676#ifdef FLOOD_LIGHT
677float is_wall=1.0-float(t > 0.0 && top_up_ny.y > 0.0);v_has_floodlight=float(flood_light_wall_radius > 0.0 && is_wall > 0.0);v_flood_radius=flood_light_wall_radius*u_vertical_scale;
678#endif
679v_color=vec4(color.rgb,1.0);v_flat=vec4(linearProduct(color.rgb,vec3(calculate_NdotL(normal))),1.0);
680#else
681v_color=vec4(0.0,0.0,0.0,1.0);v_color.rgb+=clamp(color.rgb*NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_color*=u_opacity;
682#endif
683#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)
684float roofNdotL=clamp(u_lightpos.z,0.0,1.0);roofNdotL=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),roofNdotL);v_roof_color=vec4(0.0,0.0,0.0,1.0);v_roof_color.rgb+=clamp(color.rgb*roofNdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_roof_color*=u_opacity;
685#endif
686#ifdef FOG
687v_fog_pos=fog_position(pos);
688#endif
689}`),fillExtrusionDepth:zt(`in highp float v_depth;void main() {
690#ifndef DEPTH_TEXTURE
691glFragColor=pack_depth(v_depth);
692#endif
693}`,`#include "_prelude_terrain.vertex.glsl"
694uniform mat4 u_matrix;uniform float u_edge_radius;uniform float u_vertical_scale;in vec4 a_pos_normal_ed;in vec2 a_centroid_pos;
695#pragma mapbox: define highp float base
696#pragma mapbox: define highp float height
697out highp float v_depth;void main() {
698#pragma mapbox: initialize highp float base
699#pragma mapbox: initialize highp float height
700base*=u_vertical_scale;height*=u_vertical_scale;vec3 pos_nx=floor(a_pos_normal_ed.xyz*0.5);mediump vec3 top_up_ny=a_pos_normal_ed.xyz-2.0*pos_nx;base=max(0.0,base);height=max(0.0,top_up_ny.y==0.0 && top_up_ny.x==1.0 ? height-u_edge_radius : height);float t=top_up_ny.x;vec2 centroid_pos=vec2(0.0);
701#if defined(HAS_CENTROID) || defined(TERRAIN)
702centroid_pos=a_centroid_pos;
703#endif
704vec3 pos;
705#ifdef TERRAIN
706bool flat_roof=centroid_pos.x !=0.0 && t > 0.0;float ele=elevation(pos_nx.xy);float c_ele=flat_roof ? centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos) : ele;float h=flat_roof ? max(c_ele+height,ele+base+2.0) : ele+(t > 0.0 ? height : base);pos=vec3(pos_nx.xy,h);
707#else
708pos=vec3(pos_nx.xy,t > 0.0 ? height : base);
709#endif
710float hidden=float(centroid_pos.x==0.0 && centroid_pos.y==1.0);gl_Position=mix(u_matrix*vec4(pos,1),AWAY,hidden);v_depth=gl_Position.z/gl_Position.w;}`),fillExtrusionPattern:zt(`#include "_prelude_fog.fragment.glsl"
711#include "_prelude_lighting.glsl"
712uniform vec2 u_texsize;uniform sampler2D u_image;
713#ifdef FAUX_AO
714uniform lowp vec2 u_ao;in vec3 v_ao;
715#endif
716#ifdef LIGHTING_3D_MODE
717in vec3 v_normal;
718#endif
719in vec2 v_pos;in vec4 v_lighting;uniform lowp float u_opacity;
720#pragma mapbox: define highp float base
721#pragma mapbox: define highp float height
722#pragma mapbox: define mediump vec4 pattern
723#pragma mapbox: define highp float pixel_ratio
724void main() {
725#pragma mapbox: initialize highp float base
726#pragma mapbox: initialize highp float height
727#pragma mapbox: initialize mediump vec4 pattern
728#pragma mapbox: initialize highp float pixel_ratio
729vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 imagecoord=mod(v_pos,1.0);vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);vec4 out_color=textureLodCustom(u_image,pos,lod_pos);
730#ifdef LIGHTING_3D_MODE
731out_color=apply_lighting(out_color,normalize(v_normal))*u_opacity;
732#else
733out_color=out_color*v_lighting;
734#endif
735#ifdef FAUX_AO
736float intensity=u_ao[0];float h=max(0.0,v_ao.z);float h_floors=h/u_ao[1];float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);float shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x;float x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);shade*=mix(1.0,x_shade*x_shade*x_shade,concave);out_color.rgb=out_color.rgb*shade;
737#endif
738#ifdef FOG
739out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
740#endif
741#ifdef INDICATOR_CUTOUT
742out_color=applyCutout(out_color);
743#endif
744glFragColor=out_color;
745#ifdef OVERDRAW_INSPECTOR
746glFragColor=vec4(1.0);
747#endif
748HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
749#include "_prelude_terrain.vertex.glsl"
750#include "_prelude_lighting.glsl"
751uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform float u_tile_units_to_pixels;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;in vec4 a_pos_normal_ed;in vec2 a_centroid_pos;
752#ifdef PROJECTION_GLOBE_VIEW
753in vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift;
754#endif
755out vec2 v_pos;out vec4 v_lighting;
756#ifdef FAUX_AO
757uniform lowp vec2 u_ao;out vec3 v_ao;
758#endif
759#ifdef LIGHTING_3D_MODE
760out vec3 v_normal;
761#endif
762#pragma mapbox: define highp float base
763#pragma mapbox: define highp float height
764#pragma mapbox: define mediump vec4 pattern
765#pragma mapbox: define highp float pixel_ratio
766void main() {
767#pragma mapbox: initialize highp float base
768#pragma mapbox: initialize highp float height
769#pragma mapbox: initialize mediump vec4 pattern
770#pragma mapbox: initialize highp float pixel_ratio
771vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec4 pos_nx=floor(a_pos_normal_ed*0.5);mediump vec4 top_up_ny_start=a_pos_normal_ed-2.0*pos_nx;mediump vec3 top_up_ny=top_up_ny_start.xyz;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0));float edgedistance=a_pos_normal_ed.w;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;base=max(0.0,base);height=max(0.0,height);float t=top_up_ny.x;float z=t > 0.0 ? height : base;vec2 centroid_pos=vec2(0.0);
772#if defined(HAS_CENTROID) || defined(TERRAIN)
773centroid_pos=a_centroid_pos;
774#endif
775float ele=0.0;float h=z;vec3 p;float c_ele;
776#ifdef TERRAIN
777bool flat_roof=centroid_pos.x !=0.0 && t > 0.0;ele=elevation(pos_nx.xy);c_ele=flat_roof ? centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos) : ele;h=flat_roof ? max(c_ele+height,ele+base+2.0) : ele+(t > 0.0 ? height : base==0.0 ?-5.0 : base);p=vec3(pos_nx.xy,h);
778#else
779p=vec3(pos_nx.xy,z);
780#endif
781#ifdef PROJECTION_GLOBE_VIEW
782float lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*(p.z+lift));vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,p.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*p.z;p=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);
783#endif
784float hidden=float(centroid_pos.x==0.0 && centroid_pos.y==1.0);gl_Position=mix(u_matrix*vec4(p,1),AWAY,hidden);vec2 pos=normal.z==1.0
785? pos_nx.xy
786: vec2(edgedistance,z*u_height_factor);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float NdotL=0.0;
787#ifdef LIGHTING_3D_MODE
788NdotL=calculate_NdotL(normal);
789#else
790NdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),NdotL);
791#endif
792if (normal.y !=0.0) {float r=0.84;
793#ifndef LIGHTING_3D_MODE
794r=mix(0.7,0.98,1.0-u_lightintensity);
795#endif
796NdotL*=(
797(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));}
798#ifdef FAUX_AO
799float concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height;
800#ifdef TERRAIN
801top_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(ce
801ntroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height);
802#endif
803v_ao=vec3(mix(concave,-concave,start),y_ground,h-ele);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]);
804#ifdef PROJECTION_GLOBE_VIEW
805top_height+=u_height_lift;
806#endif
807gl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w;
808#endif
809#ifdef LIGHTING_3D_MODE
810v_normal=normal;
811#else
812v_lighting.rgb+=clamp(NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;
813#endif 
814#ifdef FOG
815v_fog_pos=fog_position(p);
816#endif
817}`),groundShadow:zt(`#include "_prelude_shadow.fragment.glsl"
818precision highp float;uniform vec3 u_ground_shadow_factor;in vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1;
819#ifdef FOG
820in float v_fog_opacity;
821#endif
822void main() {float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);vec3 shadow=mix(u_ground_shadow_factor,vec3(1.0),light);
823#ifdef RENDER_CUTOFF
824shadow=mix(vec3(1.0),shadow,cutoff_opacity(u_cutoff_params,1.0/gl_FragCoord.w));
825#endif
826#ifdef FOG
827shadow=mix(shadow,vec3(1.0),v_fog_opacity);
828#endif
829#ifdef INDICATOR_CUTOUT
830shadow=mix(shadow,vec3(1.0),1.0-applyCutout(vec4(1.0)).r);
831#endif
832glFragColor=vec4(shadow,1.0);}`,`#include "_prelude_fog.vertex.glsl"
833uniform mat4 u_matrix;uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;in vec2 a_pos;out vec4 v_pos_light_view_0;out vec4 v_pos_light_view_1;
834#ifdef FOG
835out float v_fog_opacity;
836#endif
837void main() {gl_Position=u_matrix*vec4(a_pos,0.0,1.0);v_pos_light_view_0=u_light_matrix_0*vec4(a_pos,0.0,1.0);v_pos_light_view_1=u_light_matrix_1*vec4(a_pos,0.0,1.0);
838#ifdef FOG
839v_fog_pos=fog_position(a_pos);v_fog_opacity=fog(v_fog_pos);
840#endif
841}`),fillExtrusionGroundEffect:zt(`uniform highp float u_ao_pass;uniform highp float u_opacity;uniform highp float u_flood_light_intensity;uniform highp vec3 u_flood_light_color;uniform highp float u_attenuation;uniform sampler2D u_fb;uniform float u_fb_size;
842#ifdef SDF_SUBPASS
843in highp vec2 v_pos;in highp vec4 v_line_segment;in highp float v_flood_light_radius_tile;in highp vec2 v_ao;float line_df(highp vec2 a,highp vec2 b,highp vec2 p) {highp vec2 ba=b-a;highp vec2 pa=p-a;highp float r=clamp(dot(pa,ba)/dot(ba,ba),0.0,1.0);return length(pa-r*ba);}
844#ifdef FOG
845in highp float v_fog;
846#endif
847#endif
848void main() {
849#ifdef CLEAR_SUBPASS
850vec4 color=vec4(1.0);
851#ifdef CLEAR_FROM_TEXTURE
852color=texture(u_fb,gl_FragCoord.xy/vec2(u_fb_size));
853#endif
854glFragColor=color;
855#else
856#ifdef SDF_SUBPASS
857highp float d=line_df(v_line_segment.xy,v_line_segment.zw,v_pos);highp float effect_radius=mix(v_flood_light_radius_tile,v_ao.y,u_ao_pass);d/=effect_radius;d=min(d,1.0);d=1.0-pow(1.0-d,u_attenuation);highp float effect_intensity=mix(u_flood_light_intensity,v_ao.x,u_ao_pass);highp float fog=1.0;
858#ifdef FOG
859fog=v_fog;
860#endif
861#ifdef RENDER_CUTOFF
862fog*=v_cutoff_opacity;
863#endif
864glFragColor=vec4(vec3(0.0),mix(1.0,d,effect_intensity*u_opacity*fog));
865#else
866vec4 color=mix(vec4(u_flood_light_color,1.0),vec4(vec3(0.0),1.0),u_ao_pass);
867#ifdef OVERDRAW_INSPECTOR
868color=vec4(1.0);
869#endif
870glFragColor=color;
871#endif
872HANDLE_WIREFRAME_DEBUG;
873#endif
874}`,`#include "_prelude_fog.vertex.glsl"
875in highp vec4 a_pos_end;in highp float a_angular_offset_factor;in highp float a_hidden_by_landmark;
876#ifdef SDF_SUBPASS
877out highp vec2 v_pos;out highp vec4 v_line_segment;out highp float v_flood_light_radius_tile;out highp vec2 v_ao;
878#ifdef FOG
879out highp float v_fog;
880#endif
881#endif
882uniform highp float u_flood_light_intensity;uniform highp mat4 u_matrix;uniform highp float u_ao_pass;uniform highp float u_meter_to_tile;uniform highp float u_edge_radius;uniform highp vec2 u_ao;
883#pragma mapbox: define highp float flood_light_ground_radius
884const float TANGENT_CUTOFF=4.0;const float NORM=32767.0;void main() {
885#pragma mapbox: initialize highp float flood_light_ground_radius
886vec2 p=a_pos_end.xy;vec2 q=floor(a_pos_end.zw*0.5);vec2 start_bottom=a_pos_end.zw-q*2.0;float fl_ground_radius=flood_light_ground_radius;fl_ground_radius=abs(flood_light_ground_radius);float direction=flood_light_ground_radius < 0.0 ?-1.0 : 1.0;
886float flood_radius_tile=fl_ground_radius*u_meter_to_tile;vec2 v=normalize(q-p);float ao_radius=u_ao.y/3.5;float effect_radius=mix(flood_radius_tile,ao_radius,u_ao_pass)+u_edge_radius;float angular_offset_factor=a_angular_offset_factor/NORM*TANGENT_CUTOFF;float angular_offset=direction*angular_offset_factor*effect_radius;float top=1.0-start_bottom.y;float side=(0.5-start_bottom.x)*2.0;vec2 extrusion_parallel=v*side*mix(1.0,angular_offset,top);vec2 perp=vec2(v.y,-v.x);vec2 extrusion_perp=direction*perp*effect_radius*top;vec3 pos=vec3(mix(q,p,start_bottom.x),0.0);pos.xy+=extrusion_parallel+extrusion_perp;
887#ifdef SDF_SUBPASS
888v_pos=pos.xy;v_line_segment=vec4(p,q)+perp.xyxy*u_edge_radius;v_flood_light_radius_tile=flood_radius_tile;v_ao=vec2(u_ao.x,ao_radius);
889#ifdef FOG
890v_fog_pos=fog_position(pos);v_fog=1.0-fog(v_fog_pos);
891#endif
892#endif
893float hidden_by_landmark=0.0;
894#ifdef HAS_CENTROID
895hidden_by_landmark=a_hidden_by_landmark;
896#endif
897float isFloodlit=float(fl_ground_radius > 0.0 && u_flood_light_intensity > 0.0);float hidden=mix(1.0-isFloodlit,isFloodlit,u_ao_pass);hidden+=hidden_by_landmark;gl_Position=mix(u_matrix*vec4(pos,1.0),AWAY,float(hidden > 0.0));
898#ifdef RENDER_CUTOFF
899v_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z);
900#endif
901}`),hillshadePrepare:zt(`precision highp float;uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;float getElevation(vec2 coord) {return texture(u_image,coord).r/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y));float b=getElevation(v_pos+vec2(0,-epsilon.y));float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y));float d=getElevation(v_pos+vec2(-epsilon.x,0));float e=getElevation(v_pos+vec2(epsilon.x,0));float f=getElevation(v_pos+vec2(-epsilon.x,epsilon.y));float g=getElevation(v_pos+vec2(0,epsilon.y));float h=getElevation(v_pos+vec2(epsilon.x,epsilon.y));float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2(
902(c+e+e+h)-(a+d+d+f),(f+g+g+h)-(a+b+b+c)
903)/pow(2.0,exaggeration+(19.2562-u_zoom));glFragColor=clamp(vec4(
904deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);}`,"uniform mat4 u_matrix;uniform vec2 u_dimension;in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:zt(`#include "_prelude_fog.fragment.glsl"
905#include "_prelude_lighting.glsl"
906uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;uniform float u_emissive_strength;void main() {vec4 pixel=texture(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);glFragColor=accent_color*(1.0-shade_color.a)+shade_color;
907#ifdef LIGHTING_3D_MODE
908glFragColor=apply_lighting_with_emission_ground(glFragColor,u_emissive_strength);
909#endif
910#ifdef FOG
911glFragColor=fog_dither(fog_apply_premultiplied(glFragColor,v_fog_pos));
912#endif
913#ifdef OVERDRAW_INSPECTOR
914glFragColor=vec4(1.0);
915#endif
916HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
917uniform mat4 u_matrix;in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;
918#ifdef FOG
919v_fog_pos=fog_position(a_pos);
920#endif
921}`),line:zt(`#include "_prelude_fog.fragment.glsl"
922#include "_prelude_lighting.glsl"
923uniform lowp float u_device_pixel_ratio;
923uniform float u_alpha_discard_threshold;uniform highp vec2 u_trim_offset;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;in highp vec4 v_uv;
924#ifdef RENDER_LINE_DASH
925uniform sampler2D u_dash_image;in vec2 v_tex;
926#endif
927#ifdef RENDER_LINE_GRADIENT
928uniform sampler2D u_gradient_image;
929#endif
930float luminance(vec3 c) {return (c.r+c.r+c.b+c.g+c.g+c.g)*0.1667;}uniform float u_emissive_strength;
931#pragma mapbox: define highp vec4 color
932#pragma mapbox: define lowp float floorwidth
933#pragma mapbox: define lowp vec4 dash
934#pragma mapbox: define lowp float blur
935#pragma mapbox: define lowp float opacity
936#pragma mapbox: define lowp float border_width
937#pragma mapbox: define lowp vec4 border_color
938float linearstep(float edge0,float edge1,float x) {return  clamp((x-edge0)/(edge1-edge0),0.0,1.0);}void main() {
939#pragma mapbox: initialize highp vec4 color
940#pragma mapbox: initialize lowp float floorwidth
941#pragma mapbox: initialize lowp vec4 dash
942#pragma mapbox: initialize lowp float blur
943#pragma mapbox: initialize lowp float opacity
944#pragma mapbox: initialize lowp float border_width
945#pragma mapbox: initialize lowp vec4 border_color
946float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);
947#ifdef RENDER_LINE_DASH
948float sdfdist=texture(u_dash_image,v_tex).r;
948float sdfgamma=1.0/(2.0*u_device_pixel_ratio)/dash.z;alpha*=linearstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);
949#endif
950highp vec4 out_color;
951#ifdef RENDER_LINE_GRADIENT
952out_color=texture(u_gradient_image,v_uv.xy);
953#else
954out_color=color;
955#endif
956float trimmed=1.0;
957#ifdef RENDER_LINE_TRIM_OFFSET
958highp float start=v_uv[2];highp float end=v_uv[3];highp float trim_start=u_trim_offset[0];highp float trim_end=u_trim_offset[1];highp float line_progress=(start+(v_uv.x)*(end-start));if (trim_end > trim_start) {if (line_progress <=trim_end && line_progress >=trim_start) {out_color=vec4(0,0,0,0);trimmed=0.0;}}
959#endif
960if (u_alpha_discard_threshold !=0.0) {if (alpha < u_alpha_discard_threshold) {discard;}}
961#ifdef RENDER_LINE_BORDER
962float edgeBlur=(border_width+1.0/u_device_pixel_ratio);float alpha2=clamp(min(dist-(v_width2.t-edgeBlur),v_width2.s-dist)/edgeBlur,0.0,1.0);if (alpha2 < 1.) {float smoothAlpha=smoothstep(0.6,1.0,alpha2);if (border_color.a==0.0) {    
963float Y=(out_color.a > 0.01) ? luminance(out_color.rgb/out_color.a) : 1.;float adjustment=(Y > 0.) ? 0.5/Y : 0.45;if (out_color.a > 0.25 && Y < 0.25) {vec3 borderColor=(Y > 0.) ? out_color.rgb : vec3(1,1,1)*out_color.a;out_color.rgb=out_color.rgb+borderColor*(adjustment*(1.0-smoothAlpha));} else {out_color.rgb*=(0.6 +0.4*smoothAlpha);}} else {out_color.rgb=mix(border_color.rgb*border_color.a*trimmed,out_color.rgb,smoothAlpha);}}
964#endif
965#ifdef LIGHTING_3D_MODE
966out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);
967#endif
968#ifdef FOG
969out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
970#endif
971out_color*=(alpha*opacity);
972#ifdef INDICATOR_CUTOUT
973out_color=applyCutout(out_color);
974#endif
975glFragColor=out_color;
976#ifdef OVERDRAW_INSPECTOR
977glFragColor=vec4(1.0);
978#endif
979HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
980#define EXTRUDE_SCALE 0.015873016
981in vec2 a_pos_normal;in vec4 a_data;
982#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)
983in highp vec4 a_packed;
984#endif
985#ifdef RENDER_LINE_DASH
986in float a_linesofar;
987#endif
988uniform mat4 u_matrix;uniform mat2 u_pixels_to_tile_units;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec4 v_uv;
989#ifdef RENDER_LINE_DASH
990uniform vec2 u_texsize;uniform float u_tile_units_to_pixels;out vec2 v_tex;
991#endif
992#ifdef RENDER_LINE_GRADIENT
993uniform float u_image_height;
994#endif
995#pragma mapbox: define highp vec4 color
996#pragma mapbox: define lowp float floorwidth
997#pragma mapbox: define lowp vec4 dash
998#pragma mapbox: define lowp float blur
999#pragma mapbox: define lowp float opacity
1000#pragma mapbox: define mediump float gapwidth
1001#pragma mapbox: define lowp float offset
1002#pragma mapbox: define mediump float width
1003#pragma mapbox: define lowp float border_width
1004#pragma mapbox: define lowp vec4 border_color
1005void main() {
1006#pragma mapbox: initialize highp vec4 color
1007#pragma mapbox: initialize lowp float floorwidth
1008#pragma mapbox: initialize lowp vec4 dash
1009#pragma mapbox: initialize lowp float blur
1010#pragma mapbox: initialize lowp float opacity
1011#pragma mapbox: initialize mediump float gapwidth
1012#pragma mapbox: initialize lowp float offset
1013#pragma mapbox: initialize mediump float width
1014#pragma mapbox: initialize lowp float border_width
1015#pragma mapbox: initialize lowp vec4 border_color
1016float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*EXTRUDE_SCALE;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*EXTRUDE_SCALE*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist*u_pixels_to_tile_units,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude;
1017#ifndef RENDER_TO_TEXTURE
1018float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
1019#else
1020v_gamma_scale=1.0;
1021#endif
1022#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)
1023float a_uv_x=a_packed[0];float a_split_index=a_packed[1];highp float a_clip_start=a_packed[2];highp float a_clip_end=a_packed[3];
1024#ifdef RENDER_LINE_GRADIENT
1025highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec4(a_uv_x,a_split_index*texel_height-half_texel_height,a_clip_start,a_clip_end);
1026#else
1027v_uv=vec4(a_uv_x,0.0,a_clip_start,a_clip_end);
1028#endif
1029#endif
1030#ifdef RENDER_LINE_DASH
1031float scale=dash.z==0.0 ? 0.0 : u_tile_units_to_pixels/dash.z;float height=dash.y;v_tex=vec2(a_linesofar*scale/floorwidth,(-normal.y*height+dash.x+0.5)/u_texsize.y);
1032#endif
1033v_width2=vec2(outset,inset);
1034#ifdef FOG
1035v_fog_pos=fog_position(pos);
1036#endif
1037}`),linePattern:zt(`#include "_prelude_fog.fragment.glsl"
1038#include "_prelude_lighting.glsl"
1039uniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform mediump float u_tile_units_to_pixels;uniform highp vec2 u_trim_offset;uniform sampler2D u_image;in vec2 v_normal;in vec2 v_width2;in float v_linesofar;in float v_gamma_scale;in float v_width;
1040#ifdef RENDER_LINE_TRIM_OFFSET
1041in highp vec4 v_uv;
1042#endif
1043#ifdef LINE_JOIN_NONE
1044in vec2 v_pattern_data;
1045#endif
1046#pragma mapbox: define lowp vec4 pattern
1047#pragma mapbox: define lowp float pixel_ratio
1048#pragma mapbox: define lowp float blur
1049#pragma mapbox: define lowp float opacity
1050void main() {
1051#pragma mapbox: initialize mediump vec4 pattern
1052#pragma mapbox: initialize lowp float pixel_ratio
1053#pragma mapbox: initialize lowp float blur
1054#pragma mapbox: initialize lowp float opacity
1055vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;vec2 pattern_size=vec2(display_size.x/u_tile_units_to_pixels,display_size.y);float aspect=display_size.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float pattern_x=v_linesofar/pattern_size.x*aspect;float x=mod(pattern_x,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos=mix(pattern_tl*texel_size-texel_size,pattern_br*texel_size+texel_size,vec2(x,y));vec2 lod_pos=mix(pattern_tl*texel_size-texel_size,pattern_br*texel_size+texel_size,vec2(pattern_x,y));vec4 color=textureLodCustom(u_image,pos,lod_pos);
1056#ifdef RENDER_LINE_TRIM_OFFSET
1057highp float start=v_uv[2];highp float end=v_uv[3];highp float trim_start=u_trim_offset[0];highp float trim_end=u_trim_offset[1];highp float line_progress=(start+(v_uv.x)*(end-start));if (trim_end > trim_start) {if (line_progress <=trim_end && line_progress >=trim_start) {color=vec4(0,0,0,0);}}
1058#endif
1059#ifdef LINE_JOIN_NONE
1060float pattern_len=pattern_size.x/aspect;float segment_phase=pattern_len-mod((v_linesofar-v_pattern_data.x),pattern_len);float visible_start=segment_phase-step(pattern_len*0.5,segment_phase)*pattern_len;float visible_end=floor((v_pattern_data.y-segment_phase)/pattern_len)*pattern_len+segment_phase;visible_end+=step(pattern_len*0.5,v_pattern_data.y-visible_end)*pattern_len;if (v_pattern_data.x < visible_start || v_pattern_data.x >=visible_end) {color=vec4(0.0);}
1061#endif
1062#ifdef LIGHTING_3D_MODE
1063color=apply_lighting_ground(color);
1064#endif
1065#ifdef FOG
1066color=fog_dither(fog_apply_premultiplied(color,v_fog_pos));
1067#endif
1068color*=(alpha*opacity);
1069#ifdef INDICATOR_CUTOUT
1070color=applyCutout(color);
1071#endif
1072glFragColor=color;
1073#ifdef OVERDRAW_INSPECTOR
1074glFragColor=vec4(1.0);
1075#endif
1076HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
1077#define scale 0.015873016
1078in vec2 a_pos_normal;in vec4 a_data;
1079#ifdef RENDER_LINE_TRIM_OFFSET
1080in highp vec4 a_packed;
1081#endif
1082in float a_linesofar;
1083#ifdef LINE_JOIN_NONE
1084in vec2 a_pattern_data;out vec2 v_pattern_data;
1085#endif
1086uniform mat4 u_matrix;uniform mediump float u_tile_units_to_pixels;uniform vec2 u_units_to_pixels;uniform mat2 u_pixels_to_tile_units;uniform lowp float u_device_pixel_ratio;out vec2 v_normal;out vec2 v_width2;out float v_linesofar;out float v_gamma_scale;out float v_width;
1087#ifdef RENDER_LINE_TRIM_OFFSET
1088out highp vec4 v_uv;
1089#endif
1090#pragma mapbox: define lowp float blur
1091#pragma mapbox: define lowp float opacity
1092#pragma mapbox: define lowp float offset
1093#pragma mapbox: define mediump float gapwidth
1094#pragma mapbox: define mediump float width
1095#pragma mapbox: define lowp float floorwidth
1096#pragma mapbox: define lowp vec4 pattern
1097#pragma mapbox: define lowp float pixel_ratio
1098void main() {
1099#pragma mapbox: initialize lowp float blur
1100#pragma mapbox: initialize lowp float opacity
1101#pragma mapbox: initialize lowp float offset
1102#pragma mapbox: initialize mediump float gapwidth
1103#pragma mapbox: initialize mediump float width
1104#pragma mapbox: initialize lowp float floorwidth
1105#pragma mapbox: initialize mediump vec4 pattern
1106#pragma mapbox: initialize lowp float pixel_ratio
1107float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist*u_pixels_to_tile_units,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude;
1108#ifndef RENDER_TO_TEXTURE
1109float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
1110#else
1111v_gamma_scale=1.0;
1112#endif
1113#ifdef RENDER_LINE_TRIM_OFFSET
1114float a_uv_x=a_packed[0];highp float a_clip_start=a_packed[2];highp float a_clip_end=a_packed[3];v_uv=vec4(a_uv_x,0.0,a_clip_start,a_clip_end);
1115#endif
1116v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;
1117#ifdef LINE_JOIN_NONE
1118v_width+=ANTIALIASING;float offset_sign=(fract(a_pattern_data.x)-0.5)*4.0;float line_progress_offset=offset_sign*v_width*0.5/u_tile_units_to_pixels;v_linesofar+=line_progress_offset;v_pattern_data=vec2(a_pattern_data.x+line_progress_offset,a_pattern_data.y);
1119#endif
1120#ifdef FOG
1121v_fog_pos=fog_position(pos);
1122#endif
1123}`),raster:zt(`#include "_prelude_fog.fragment.glsl"
1124#include "_prelude_lighting.glsl"
1125#include "_prelude_raster_array.glsl"
1126uniform float u_fade_t;uniform float u_opacity;uniform highp float u_raster_elevation;uniform highp float u_zoom_transition;in vec2 v_pos0;in vec2 v_pos1;in float v_depth;
1127#ifdef PROJECTION_GLOBE_VIEW
1128in float v_split_fade;
1129#endif
1130uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;uniform float u_emissive_strength;
1131#ifndef RASTER_ARRAY
1132uniform sampler2D u_image0;uniform sampler2D u_image1;
1133#endif
1134#ifdef RASTER_COLOR
1135uniform sampler2D u_color_ramp;uniform highp vec4 u_colorization_mix;uniform highp float u_colorization_offset;uniform vec2 u_texture_res;
1136#endif
1137void main() {vec4 color0,color1,color;vec2 value;
1138#ifdef RASTER_COLOR
1139#ifdef RASTER_ARRAY
1140#ifdef RASTER_ARRAY_LINEAR
1141value=mix(
1142raTexture2D_image0_linear(v_pos0,u_texture_res,u_colorization_mix,u_colorization_offset),raTexture2D_image1_linear(v_pos1,u_texture_res,u_colorization_mix,u_colorization_offset),u_fade_t
1143);
1144#else
1145value=mix(
1146raTexture2D_image0_nearest(v_pos0,u_texture_res,u_colorization_mix,u_colorization_offset),raTexture2D_image1_nearest(v_pos1,u_texture_res,u_colorization_mix,u_colorization_offset),u_fade_t
1147);
1148#endif
1149if (value.y > 0.0) value.x/=value.y;
1150#else
1151color=mix(texture(u_image0,v_pos0),texture(u_image1,v_pos1),u_fade_t);value=vec2(u_colorization_offset+dot(color.rgb,u_colorization_mix.rgb),color.a);
1152#endif
1153color=texture(u_color_ramp,vec2(value.x,0.5));if (color.a > 0.0) color.rgb/=color.a;color.a*=value.y;
1154#else
1155color0=texture(u_image0,v_pos0);color1=texture(u_image1,v_pos1);if (color0.a > 0.0) color0.rgb/=color0.a;if (color1.a > 0.0) color1.rgb/=color1.a;color=mix(color0,color1,u_fade_t);
1156#endif
1157color.a*=u_opacity;
1158#ifdef GLOBE_POLES
1159color.a*=1.0-smoothstep(0.0,0.05,u_zoom_transition);
1160#endif
1161vec3 rgb=color.rgb;rgb=vec3(
1162dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);vec3 out_color=mix(u_high_vec,u_low_vec,rgb);
1163#ifdef LIGHTING_3D_MODE
1164out_color=apply_lighting_with_emission_ground(vec4(out_color,1.0),u_emissive_strength).rgb;
1165#endif
1166#ifdef FOG
1167highp float fog_limit_high_meters=1000000.0;highp float fog_limit_low_meters=600000.0;float fog_limit=1.0-smoothstep(fog_limit_low_meters,fog_limit_high_meters,u_raster_elevation);out_color=fog_dither(fog_apply(out_color,v_fog_pos,fog_limit));
1168#endif
1169glFragColor=vec4(out_color*color.a,color.a);
1170#ifdef PROJECTION_GLOBE_VIEW
1171glFragColor*=mix(1.0,1.0-smoothstep(0.0,0.05,u_zoom_transition),smoothstep(0.8,0.9,v_split_fade));
1172#endif
1173#ifdef RENDER_CUTOFF
1174glFragColor=glFragColor*cutoff_opacity(u_cutoff_params,v_depth);
1175#endif
1176#ifdef OVERDRAW_INSPECTOR
1177glFragColor=vec4(1.0);
1178#endif
1179HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
1180uniform mat4 u_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform mat3 u_grid_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform vec2 u_perspective_transform;uniform vec2 u_texture_offset;uniform float u_raster_elevation;uniform float u_zoom_transition;uniform vec2 u_merc_center;
1181#define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8
1182#ifdef GLOBE_POLES
1183in vec3 a_globe_pos;in vec2 a_uv;
1184#else
1185in vec2 a_pos;in vec2 a_texture_pos;
1186#endif
1187out vec2 v_pos0;out vec2 v_pos1;out float v_depth;
1188#ifdef PROJECTION_GLOBE_VIEW
1189out float v_split_fade;
1190#endif
1191void main() {vec2 uv;
1192#ifdef GLOBE_POLES
1193vec3 globe_pos=a_globe_pos;globe_pos+=normalize(globe_pos)*u_raster_elevation*GLOBE_UPSCALE;gl_Position=u_matrix*u_globe_matrix*vec4(globe_pos   ,1.0);uv=a_uv;
1194#ifdef FOG
1195v_fog_pos=fog_position((u_normalize_matrix*vec4(a_globe_pos,1.0)).xyz);
1196#endif
1197#else
1198float w=1.0+dot(a_texture_pos,u_perspective_transform);uv=a_texture_pos/8192.0;
1199#ifdef PROJECTION_GLOBE_VIEW
1200vec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);vec3 globe_pos=latLngToECEF(latLng.xy);globe_pos+=normalize(globe_pos)*u_raster_elevation*GLOBE_UPSCALE;vec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);float mercatorY=mercatorYfromLat(latLng[0]);float mercatorX=mercatorXfromLng(latLng[1]);    
1201v_split_fade=0.0;if (u_zoom_transition > 0.0) {vec2 merc_pos=vec2(mercatorX,mercatorY);merc_world_pos=vec4(merc_pos,u_raster_elevation,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;float opposite_merc_center=mod(u_merc_center.x+0.5,1.0);float dist_from_poles=(abs(mercatorY-0.5)*2.0);float range=0.1;v_split_fade=abs(opposite_merc_center-mercatorX);v_split_fade=clamp(1.0-v_split_fade,0.0,1.0);v_split_fade=max(smoothstep(1.0-range,1.0,dist_from_poles),max(smoothstep(1.0-range,1.0,v_split_fade),smoothstep(1.0-range,1.0,1.0-v_split_fade)));}float tiles=u_grid_matrix[0][2];
1201if (tiles > 0.0) {float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];float uvY=mercatorY*tiles-idy;float uvX=mercatorX*tiles-idx;uv=vec2(uvX,uvY);}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition)*w,w);gl_Position=u_matrix*interpolated_pos;
1202#ifdef FOG
1203v_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);
1204#endif
1205#else
1206gl_Position=u_matrix*vec4(a_pos*w,u_raster_elevation*w,w);
1207#ifdef FOG
1208v_fog_pos=fog_position(a_pos);
1209#endif
1210#endif
1211#endif
1212v_pos0=uv;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;v_pos0=u_texture_offset.x+u_texture_offset.y*v_pos0;v_pos1=u_texture_offset.x+u_texture_offset.y*v_pos1;
1213#ifdef RENDER_CUTOFF
1214v_depth=gl_Position.z;
1215#endif
1216}`),rasterParticle:zt(`#include "_prelude_fog.fragment.glsl"
1217#include "_prelude_lighting.glsl"
1218uniform float u_fade_t;uniform float u_opacity;uniform highp float u_raster_elevation;in vec2 v_pos0;in vec2 v_pos1;uniform sampler2D u_image0;uniform sampler2D u_image1;void main() {vec4 color0,color1,color;color0=texture(u_image0,v_pos0);color1=texture(u_image1,v_pos1);if (color0.a > 0.0) color0.rgb/=color0.a;if (color1.a > 0.0) color1.rgb/=color1.a;color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 out_color=color.rgb;
1219#ifdef LIGHTING_3D_MODE
1220out_color=apply_lighting_with_emission_ground(vec4(out_color,1.0),0.0).rgb;
1221#endif
1222#ifdef FOG
1223highp float fog_limit_high_meters=1000000.0;highp float fog_limit_low_meters=600000.0;float fog_limit=1.0-smoothstep(fog_limit_low_meters,fog_limit_high_meters,u_raster_elevation);out_color=fog_dither(fog_apply(out_color,v_fog_pos,fog_limit));
1224#endif
1225glFragColor=vec4(out_color*color.a,color.a);
1226#ifdef OVERDRAW_INSPECTOR
1227glFragColor=vec4(1.0);
1228#endif
1229HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
1230uniform mat4 u_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform mat3 u_grid_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_raster_elevation;uniform float u_zoom_transition;uniform vec2 u_merc_center;
1231#define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8
1232in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos0;out vec2 v_pos1;void main() {float w=1.0;vec2 uv;
1233#ifdef PROJECTION_GLOBE_VIEW
1234vec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);float mercatorY=mercatorYfromLat(latLng[0]);float mercatorX=mercatorXfromLng(latLng[1]);float tiles=u_grid_matrix[0][2];float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];float uvX=mercatorX*tiles-idx;float uvY=mercatorY*tiles-idy;uv=vec2(uvX,uvY);vec3 globe_pos=latLngToECEF(latLng.xy);globe_pos+=normalize(globe_pos)*u_raster_elevation*GLOBE_UPSCALE;vec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);if (u_zoom_transition > 0.0) {vec2 merc_pos=vec2(mercatorX,mercatorY);merc_world_pos=vec4(merc_pos,u_raster_elevation,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition)*w,w);gl_Position=u_matrix*interpolated_pos;
1235#ifdef FOG
1236v_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);
1237#endif
1238#else
1239uv=a_texture_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*w,u_raster_elevation*w,w);
1240#ifdef FOG
1241v_fog_pos=fog_position(a_pos);
1242#endif
1243#endif
1244v_pos0=uv;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}`),rasterParticleDraw:zt("uniform sampler2D u_color_ramp;in float v_particle_speed;void main() {glFragColor=texture(u_color_ramp,vec2(v_particle_speed,0.5));}",`#include "_prelude_raster_particle.glsl"
1245in float a_index;uniform sampler2D u_particle_texture;uniform float u_particle_texture_side_len;uniform vec2 u_tile_offset;out float v_particle_speed;void main() {ivec2 pixel_coord=ivec2(
1246mod(a_index,u_particle_texture_side_len),a_index/u_particle_texture_side_len);vec4 pixel=texelFetch(u_particle_texture,pixel_coord,0);vec2 pos=unpack_pos_from_rgba(pixel)+u_tile_offset;vec2 tex_coord=fract(pos);vec2 velocity=lookup_velocity(tex_coord);if (velocity==INVALID_VELOCITY) {gl_Position=AWAY;v_particle_speed=0.0;} else {gl_Position=vec4(2.0*pos-vec2(1.0),0.0,1.0);v_particle_speed=length(velocity);}gl_PointSize=1.0;}`),rasterParticleTexture:zt("uniform sampler2D u_texture;uniform float u_opacity;in vec2 v_tex_pos;void main() {vec4 color=texture(u_texture,v_tex_pos);glFragColor=vec4(floor(255.0*color*u_opacity)/255.0);}","in vec2 a_pos;out vec2 v_tex_pos;void main() {vec2 uv=0.5*a_pos+vec2(0.5);v_tex_pos=uv;gl_Position=vec4(a_pos,0.0,1.0);}"),rasterParticleUpdate:zt(`#include "_prelude_raster_particle.glsl"
1247uniform sampler2D u_particle_texture;uniform mediump float u_particle_texture_side_len;uniform mediump float u_speed_factor;uniform highp float u_reset_rate;uniform highp float u_rand_seed;in highp vec2 v_tex_coord;const highp vec3 rand_constants=vec3(12.9898,78.233,4375.85453);highp float rand(const highp vec2 co) {highp float t=dot(rand_constants.xy,co);return fract(sin(t)*(rand_constants.z+t));}void main() {ivec2 pixel_coord=ivec2(v_tex_coord*u_particle_texture_side_len);highp vec4 pixel=texelFetch(u_particle_texture,pixel_coord,0);highp vec2 pos=unpack_pos_from_rgba(pixel);highp vec2 velocity=lookup_velocity(clamp(pos,0.0,1.0));
1247highp vec2 dp=velocity==INVALID_VELOCITY ? vec2(0) : velocity*u_speed_factor;pos=pos+dp;highp vec2 seed=(pos+v_tex_coord)*u_rand_seed;highp vec2 random_pos=vec2(rand(seed+1.3),rand(seed+2.1));highp float speed=velocity==INVALID_VELOCITY ? 0.0 : length(velocity);highp float reset_rate_bump=speed*u_reset_rate;highp vec2 particle_pos_min=-u_particle_pos_offset;highp vec2 particle_pos_max=vec2(1.0)+u_particle_pos_offset;highp vec2 pos_drop_rate=vec2(1.0)-step(particle_pos_min,pos)+step(particle_pos_max,pos);highp float drop_rate=max(u_reset_rate+reset_rate_bump,length(pos_drop_rate));highp float drop=step(1.0-drop_rate,rand(seed));highp vec2 next_pos=mix(pos,random_pos,drop);glFragColor=pack_pos_to_rgba(next_pos);}`,"in vec2 a_pos;out vec2 v_tex_coord;void main() {v_tex_coord=0.5*(a_pos+vec2(1.0));gl_Position=vec4(a_pos,0.0,1.0);}"),symbolIcon:zt(`#include "_prelude_lighting.glsl"
1248uniform sampler2D u_texture;
1249#ifdef ICON_TRANSITION
1250uniform float u_icon_transition;
1251#endif
1252in float v_fade_opacity;in vec2 v_tex_a;
1253#ifdef ICON_TRANSITION
1254in vec2 v_tex_b;
1255#endif
1256#ifdef COLOR_ADJUSTMENT
1257uniform mat4 u_color_adj_mat;
1258#endif
1259#pragma mapbox: define lowp float opacity
1260#pragma mapbox: define lowp float emissive_strength
1261void main() {
1262#pragma mapbox: initialize lowp float opacity
1263#pragma mapbox: initialize lowp float emissive_strength
1264lowp float alpha=opacity*v_fade_opacity;vec4 out_color;
1265#ifdef ICON_TRANSITION
1266vec4 a=texture(u_texture,v_tex_a)*(1.0-u_icon_transition);vec4 b=texture(u_texture,v_tex_b)*u_icon_transition;out_color=(a+b);
1267#else
1268out_color=texture(u_texture,v_tex_a);
1269#endif
1270#ifdef COLOR_ADJUSTMENT
1271out_color=u_color_adj_mat*out_color;
1272#endif
1273out_color*=alpha;
1274#ifdef LIGHTING_3D_MODE
1275out_color=apply_lighting_with_emission_ground(out_color,emissive_strength);
1276#endif
1277glFragColor=out_color;
1278#ifdef OVERDRAW_INSPECTOR
1279glFragColor=vec4(1.0);
1280#endif
1281HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_terrain.vertex.glsl"
1282in vec4 a_pos_offset;in vec4 a_tex_size;in vec4 a_pixeloffset;in vec4 a_projected_pos;in float a_fade_opacity;
1283#ifdef Z_OFFSET
1284in float a_z_offset;
1285#endif
1286#ifdef PROJECTION_GLOBE_VIEW
1287in vec3 a_globe_anchor;in vec3 a_globe_normal;
1288#endif
1289#ifdef ICON_TRANSITION
1290in vec2 a_texb;
1291#endif
1292uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;uniform vec3 u_up_vector;
1293#ifdef PROJECTION_GLOBE_VIEW
1294uniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_camera_forward;uniform float u_zoom_transition;uniform vec3 u_ecef_origin;uniform mat4 u_tile_matrix;
1295#endif
1296out vec2 v_tex_a;
1297#ifdef ICON_TRANSITION
1298out vec2 v_tex_b;
1299#endif
1300out float v_fade_opacity;
1301#pragma mapbox: define lowp float opacity
1302#pragma mapbox: define lowp float emissive_strength
1303void main() {
1304#pragma mapbox: initialize lowp float opacity
1305#pragma mapbox: initialize lowp float emissive_strength
1306vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_min_font_scale=a_pixeloffset.zw/256.0;highp float segment_angle=-a_projected_pos[3];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 tile_anchor=a_pos;float e=elevation(tile_anchor);
1307#ifdef Z_OFFSET
1308e+=a_z_offset;
1309#endif
1310vec3 h=elevationVector(tile_anchor)*e;float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos;
1311#ifdef PROJECTION_GLOBE_VIEW
1312mercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);world_pos=mix_globe_mercator(a_globe_anchor+h,mercator_pos,u_zoom_transition);vec4 ecef_point=u_tile_matrix*vec4(world_pos,1.0);vec3 origin_to_point=ecef_point.xyz-u_ecef_origin;globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0;
1313#else
1314world_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0;
1315#endif
1316vec4 projected_point=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projected_point.w;highp float distance_ratio=u_pitch_with_map ?
1317camera_to_anchor_distance/u_camera_to_center_distance :
1318u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(
13190.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float font_scale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjected_point;
1320#ifdef PROJECTION_GLOBE_VIEW
1321vec3 displacement=vec3(a_globe_normal.z,0,-a_globe_normal.x);offsetProjected_point=u_matrix*vec4(a_globe_anchor+displacement,1);
1322#else
1323offsetProjected_point=u_matrix*vec4(tile_anchor+vec2(1,0),0,1);
1324#endif
1325vec2 a=projected_point.xy/projected_point.w;vec2 b=offsetProjected_point.xy/offsetProjected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos;
1326#ifdef PROJECTION_GLOBE_VIEW
1327vec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz+h,mercator_pos,u_zoom_transition);projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0);
1328#else
1329projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0);
1330#endif
1331highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*max(a_min_font_scale,font_scale)+a_pxoffset/16.0);
1332#ifdef TERRAIN
1333#ifdef PITCH_WITH_MAP_TERRAIN
1334vec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);
1335#endif
1336#endif
1337float occlusion_fade=occlusionFade(projected_point)*globe_occlusion_fade;float projection_transition_fade=1.0;
1338#if defined(PROJECTED_POS_ON_VIEWPORT) && defined(PROJECTION_GLOBE_VIEW)
1339projection_transition_fade=1.0-step(EPSILON,u_zoom_transition);
1340#endif
1341vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float out_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change))*projection_transition_fade;float alpha=opacity*out_fade_opacity;float hidden=float(alpha==0.0 || projected_point.w <=0.0 || occlusion_fade==0.0);
1342#ifdef PROJECTION_GLOBE_VIEW
1343vec3 xAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,u_up_vector)) : vec3(1,0,0);vec3 yAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,xAxis)) : vec3(0,1,0);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y,1.0),AWAY,hidden);
1344#else
1345gl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,hidden);
1346#endif
1347v_tex_a=a_tex/u_texsize;
1348#ifdef ICON_TRANSITION
1349v_tex_b=a_texb/u_texsize;
1350#endif
1351v_fade_opacity=out_fade_opacity;}`),symbolSDF:zt(`#include "_prelude_lighting.glsl"
1352#define SDF_PX 8.0
1353uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;uniform bool u_is_halo;in float v_draw_halo;in vec2 v_data0;in vec3 v_data1;
1354#pragma mapbox: define highp vec4 fill_color
1355#pragma mapbox: define highp vec4 halo_color
1356#pragma mapbox: define lowp float opacity
1357#pragma mapbox: define lowp float halo_width
1358#pragma mapbox: define lowp float halo_blur
1359#pragma mapbox: define lowp float emissive_strength
1360void main() {
1361#pragma mapbox: initialize highp vec4 fill_color
1362#pragma mapbox: initialize highp vec4 halo_color
1363#pragma mapbox: initialize lowp float opacity
1364#pragma mapbox: initialize lowp float halo_width
1365#pragma mapbox: initialize lowp float halo_blur
1366#pragma mapbox: initialize lowp float emissive_strength
1367float EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;bool draw_halo=v_draw_halo > 0.0;if (draw_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture(u_texture,tex).r;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);vec4 out_color=color*(alpha*opacity*fade_opacity);
1368#ifdef LIGHTING_3D_MODE
1369out_color=apply_lighting_with_emission_ground(out_color,emissive_strength);
1370#endif
1371glFragColor=out_color;
1372#ifdef OVERDRAW_INSPECTOR
1373glFragColor=vec4(1.0);
1374#endif
1375HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_terrain.vertex.glsl"
1376in vec4 a_pos_offset;in vec4 a_tex_size;in vec4 a_pixeloffset;in vec4 a_projected_pos;in float a_fade_opacity;
1377#ifdef Z_OFFSET
1378in float a_z_offset;
1379#endif
1380#ifdef PROJECTION_GLOBE_VIEW
1381in vec3 a_globe_anchor;in vec3 a_globe_normal;
1382#endif
1383uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec3 u_up_vector;uniform bool u_is_halo;
1384#ifdef PROJECTION_GLOBE_VIEW
1385uniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_camera_forward;uniform float u_zoom_transition;uniform vec3 u_ecef_origin;uniform mat4 u_tile_matrix;
1386#endif
1387out float v_draw_halo;out vec2 v_data0;out vec3 v_data1;
1388#pragma mapbox: define highp vec4 fill_color
1389#pragma mapbox: define highp vec4 halo_color
1390#pragma mapbox: define lowp float opacity
1391#pragma mapbox: define lowp float halo_width
1392#pragma mapbox: define lowp float halo_blur
1393#pragma mapbox: define lowp float emissive_strength
1394void main() {
1395#pragma mapbox: initialize highp vec4 fill_color
1396#pragma mapbox: initialize highp vec4 halo_color
1397#pragma mapbox: initialize lowp float opacity
1398#pragma mapbox: initialize lowp float halo_width
1399#pragma mapbox: initialize lowp float halo_blur
1400#pragma mapbox: initialize lowp float emissive_strength
1401vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;highp float segment_angle=-a_projected_pos[3];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 tile_anchor=a_pos;float e=elevation(tile_anchor);
1402#ifdef Z_OFFSET
1403e+=a_z_offset;
1404#endif
1405vec3 h=elevationVector(tile_anchor)*e;float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos;
1406#ifdef PROJECTION_GLOBE_VIEW
1407mercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);world_pos=mix_globe_mercator(a_globe_anchor+h,mercator_pos,u_zoom_transition);vec4 ecef_point=u_tile_matrix*vec4(world_pos,1.0);vec3 origin_to_point=ecef_point.xyz-u_ecef_origin;globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0;
1408#else
1409world_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0;
1410#endif
1411vec4 projected_point=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projected_point.w;highp float distance_ratio=u_pitch_with_map ?
1412camera_to_anchor_distance/u_camera_to_center_distance :
1413u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(
14140.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetprojected_point;
1415#ifdef PROJECTION_GLOBE_VIEW
1416vec3 displacement=vec3(a_globe_normal.z,0,-a_globe_normal.x);offsetprojected_point=u_matrix*vec4(a_globe_anchor+displacement,1);
1417#else
1418offsetprojected_point=u_matrix*vec4(tile_anchor+vec2(1,0),0,1);
1419#endif
1420vec2 a=projected_point.xy/projected_point.w;vec2 b=offsetprojected_point.xy/offsetprojected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos;
1421#ifdef PROJECTION_GLOBE_VIEW
1422vec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz+h,mercator_pos,u_zoom_transition);projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0);
1423#else
1424projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0);
1425#endif
1426highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset);
1427#ifdef TERRAIN
1428#ifdef PITCH_WITH_MAP_TERRAIN
1429vec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);
1430#endif
1431#endif
1432float occlusion_fade=occlusionFade(projected_point)*globe_occlusion_fade;float projection_transition_fade=1.0;
1433#if defined(PROJECTED_POS_ON_VIEWPORT) && defined(PROJECTION_GLOBE_VIEW)
1434projection_transition_fade=1.0-step(EPSILON,u_zoom_transition);
1435#endif
1436vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change));float out_fade_opacity=interpolated_fade_opacity*projection_transition_fade;float alpha=opacity*out_fade_opacity;float hidden=float(alpha==0.0 || projected_point.w <=0.0 || occlusion_fade==0.0);
1437#ifdef PROJECTION_GLOBE_VIEW
1438vec3 xAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,u_up_vector)) : vec3(1,0,0);vec3 yAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,xAxis)) : vec3(0,1,0);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y,1.0),AWAY,hidden);
1439#else
1440gl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,hidden);
1441#endif
1442float gamma_scale=gl_Position.w;v_draw_halo=(u_is_halo && float(gl_InstanceID)==0.0) ? 1.0 : 0.0;v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,out_fade_opacity);}`),symbolTextAndIcon:zt(`#include "_prelude_lighting.glsl"
1443#define SDF_PX 8.0
1444#define SDF 1.0
1445#define ICON 0.0
1446uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_halo;in float v_draw_halo;in vec4 v_data0;in vec4 v_data1;
1447#pragma mapbox: define highp vec4 fill_color
1448#pragma mapbox: define highp vec4 halo_color
1449#pragma mapbox: define lowp float opacity
1450#pragma mapbox: define lowp float halo_width
1451#pragma mapbox: define lowp float halo_blur
1452#pragma mapbox: define lowp float emissive_strength
1453void main() {
1454#pragma mapbox: initialize highp vec4 fill_color
1455#pragma mapbox: initialize highp vec4 halo_color
1456#pragma mapbox: initialize lowp float opacity
1457#pragma mapbox: initialize lowp float halo_width
1458#pragma mapbox: initialize lowp float halo_blur
1459#pragma mapbox: initialize lowp float emissive_strength
1460float fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;
1460glFragColor=texture(u_texture_icon,tex_icon)*alpha;
1461#ifdef OVERDRAW_INSPECTOR
1462glFragColor=vec4(1.0);
1463#endif
1464return;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;bool draw_halo=v_draw_halo > 0.0;if (draw_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture(u_texture,tex).r;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);vec4 out_color=color*(alpha*opacity*fade_opacity);
1465#ifdef LIGHTING_3D_MODE
1466out_color=apply_lighting_with_emission_ground(out_color,emissive_strength);
1467#endif
1468glFragColor=out_color;
1469#ifdef OVERDRAW_INSPECTOR
1470glFragColor=vec4(1.0);
1471#endif
1472HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_terrain.vertex.glsl"
1473in vec4 a_pos_offset;in vec4 a_tex_size;in vec4 a_projected_pos;in float a_fade_opacity;
1474#ifdef Z_OFFSET
1475in float a_z_offset;
1476#endif
1477#ifdef PROJECTION_GLOBE_VIEW
1478in vec3 a_globe_anchor;in vec3 a_globe_normal;
1479#endif
1480uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec3 u_up_vector;uniform vec2 u_texsize_icon;uniform bool u_is_halo;
1481#ifdef PROJECTION_GLOBE_VIEW
1482uniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_camera_forward;uniform float u_zoom_transition;uniform vec3 u_ecef_origin;uniform mat4 u_tile_matrix;
1483#endif
1484out float v_draw_halo;out vec4 v_data0;out vec4 v_data1;
1485#pragma mapbox: define highp vec4 fill_color
1486#pragma mapbox: define highp vec4 halo_color
1487#pragma mapbox: define lowp float opacity
1488#pragma mapbox: define lowp float halo_width
1489#pragma mapbox: define lowp float halo_blur
1490#pragma mapbox: define lowp float emissive_strength
1491void main() {
1492#pragma mapbox: initialize highp vec4 fill_color
1493#pragma mapbox: initialize highp vec4 halo_color
1494#pragma mapbox: initialize lowp float opacity
1495#pragma mapbox: initialize lowp float halo_width
1496#pragma mapbox: initialize lowp float halo_blur
1497#pragma mapbox: initialize lowp float emissive_strength
1498vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;highp float segment_angle=-a_projected_pos[3];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 tile_anchor=a_pos;float e=elevation(tile_anchor);
1499#ifdef Z_OFFSET
1500e+=a_z_offset;
1501#endif
1502vec3 h=elevationVector(tile_anchor)*e;float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos;
1503#ifdef PROJECTION_GLOBE_VIEW
1504mercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);world_pos=mix_globe_mercator(a_globe_anchor+h,mercator_pos,u_zoom_transition);vec4 ecef_point=u_tile_matrix*vec4(world_pos,1.0);vec3 origin_to_point=ecef_point.xyz-u_ecef_origin;globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0;
1505#else
1506world_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0;
1507#endif
1508vec4 projected_point=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projected_point.w;highp float distance_ratio=u_pitch_with_map ?
1509camera_to_anchor_distance/u_camera_to_center_distance :
1510u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(
15110.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float font_scale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offset_projected_point=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projected_point.xy/projected_point.w;vec2 b=offset_projected_point.xy/offset_projected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos;
1512#ifdef PROJECTION_GLOBE_VIEW
1513vec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz+h,mercator_pos,u_zoom_transition);projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0);
1514#else
1515projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0);
1516#endif
1517highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*font_scale);
1518#ifdef TERRAIN
1519#ifdef PITCH_WITH_MAP_TERRAIN
1520vec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);
1521#endif
1522#endif
1523float occlusion_fade=occlusionFade(projected_point)*globe_occlusion_fade;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change));float projection_transition_fade=1.0;
1524#if defined(PROJECTED_POS_ON_VIEWPORT) && defined(PROJECTION_GLOBE_VIEW)
1525projection_transition_fade=1.0-step(EPSILON,u_zoom_transition);
1526#endif
1527float out_fade_opacity=interpolated_fade_opacity*projection_transition_fade;float alpha=opacity*out_fade_opacity;float hidden=float(alpha==0.0 || projected_point.w <=0.0 || occlusion_fade==0.0);
1528#ifdef PROJECTION_GLOBE_VIEW
1529vec3 xAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,u_up_vector)) : vec3(1,0,0);vec3 yAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,xAxis)) : vec3(0,1,0);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y,1.0),AWAY,hidden);
1530#else
1531gl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,hidden);
1532#endif
1533float gamma_scale=gl_Position.w;v_draw_halo=(u_is_halo && float(gl_InstanceID)==0.0) ? 1.0 : 0.0;v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,out_fade_opacity,is_sdf);}`),terrainRaster:zt(`#include "_prelude_fog.fragment.glsl"
1534#include "_prelude_shadow.fragment.glsl"
1535#include "_prelude_lighting.glsl"
1536uniform sampler2D u_image0;in vec2 v_pos0;
1537#ifdef FOG
1538in float v_fog_opacity;
1539#endif
1540#ifdef RENDER_SHADOWS
1541in vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1;
1542#endif
1543uniform vec3 u_ground_shadow_factor;void main() {vec4 image_color=texture(u_image0,v_pos0);vec4 color;
1544#ifdef LIGHTING_3D_MODE
1545const vec3 normal=vec3(0.0,0.0,1.0);
1546#ifdef RENDER_SHADOWS
1547float cutoffOpacity=1.0;
1548#ifdef RENDER_CUTOFF
1549cutoffOpacity=cutoff_opacity(u_cutoff_params,1.0/gl_FragCoord.w);
1550#endif
1551#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS
1552vec3 unlit_base=image_color.rgb*(1.0-image_color.a);vec3 emissive_base=image_color.rgb*image_color.a;float ndotl=u_shadow_direction.z;float occlusion=ndotl < 0.0 ? 1.0 : shadow_occlusion(v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w,0.0);ndotl=max(0.0,ndotl);vec3 lit=apply_lighting(unlit_base,normal,mix(1.0,(1.0-(u_shadow_intensity*occlusion))*ndotl,cutoffOpacity));vec3 emissive=compute_emissive_draped(emissive_base,1.0-u_shadow_intensity,occlusion,u_ground_shadow_factor);color.rgb=lit+emissive;color.a=1.0;
1553#else
1554float lighting_factor=shadowed_light_factor_normal_unbiased(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);color=apply_lighting(image_color,normal,mix(1.0,lighting_factor,cutoffOpacity));
1555#endif
1556#else
1557float lighting_factor=u_lighting_directional_dir.z;color=apply_lighting(image_color,normal,lighting_factor);
1558#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS
1559color.rgb=mix(color.rgb,image_color.rgb,image_color.a);color.a=1.0;
1560#endif
1561#endif
1562#else
1563color=image_color;
1564#endif
1565#ifdef FOG
1566#ifdef ZERO_EXAGGERATION
1567color=fog_dither(fog_apply_premultiplied(color,v_fog_pos));
1568#else
1569color=fog_dither(fog_apply_from_vert(color,v_fog_opacity));
1570#endif
1571#endif
1572glFragColor=color;
1573#ifdef OVERDRAW_INSPECTOR
1574glFragColor=vec4(1.0);
1575#endif
1576HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
1577#include "_prelude_terrain.vertex.glsl"
1578uniform mat4 u_matrix;uniform float u_skirt_height;in vec2 a_pos;out vec2 v_pos0;
1579#ifdef FOG
1580out float v_fog_opacity;
1581#endif
1582#ifdef RENDER_SHADOWS
1583uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out vec4 v_pos_light_view_0;out vec4 v_pos_light_view_1;out float v_depth;
1584#endif
1585void main() {vec3 decomposedPosAndSkirt=decomposeToPosAndSkirt(a_pos);float skirt=decomposedPosAndSkirt.z;vec2 decodedPos=decomposedPosAndSkirt.xy;float elevation=elevation(decodedPos)-skirt*u_skirt_height;v_pos0=decodedPos/8192.0;gl_Position=u_matrix*vec4(decodedPos,elevation,1.0);
1586#ifdef FOG
1587#ifdef ZERO_EXAGGERATION
1588v_fog_pos=fog_position(decodedPos);
1589#else
1590v_fog_opacity=fog(fog_position(vec3(decodedPos,elevation)));
1591#endif
1592#endif
1593#ifdef RENDER_SHADOWS
1594vec3 pos=vec3(decodedPos,elevation);v_pos_light_view_0=u_light_matrix_0*vec4(pos,1.);v_pos_light_view_1=u_light_matrix_1*vec4(pos,1.);
1595#endif
1596}`),terrainDepth:zt("precision highp float;in float v_depth;void main() {glFragColor=pack_depth(v_depth);}",`#include "_prelude_terrain.vertex.glsl"
1597uniform mat4 u_matrix;in vec2 a_pos;out float v_depth;void main() {float elevation=elevation(a_pos);gl_Position=u_matrix*vec4(a_pos,elevation,1.0);v_depth=gl_Position.z/gl_Position.w;}`),skybox:zt(`#include "_prelude_fog.fragment.glsl"
1598in lowp vec3 v_uv;uniform lowp samplerCube u_cubemap;uniform lowp float u_opacity;uniform highp float u_temporal_offset;uniform highp vec3 u_sun_direction;float sun_disk(highp vec3 ray_direction,highp vec3 sun_direction) {highp float cos_angle=dot(normalize(ray_direction),sun_direction);const highp float cos_sun_angular_diameter=0.99996192306;const highp float smoothstep_delta=1e-5;return smoothstep(
1599cos_sun_angular_diameter-smoothstep_delta,cos_sun_angular_diameter+smoothstep_delta,cos_angle);}float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(e
1599nd-start)+new_start;}void main() {vec3 uv=v_uv;const float y_bias=0.015;uv.y+=y_bias;uv.y=pow(abs(uv.y),1.0/5.0);uv.y=map(uv.y,0.0,1.0,-1.0,1.0);vec3 sky_color=texture(u_cubemap,uv).rgb;
1600#ifdef FOG
1601sky_color=fog_apply_sky_gradient(v_uv.xzy,sky_color);
1602#endif
1603sky_color.rgb=dither(sky_color.rgb,gl_FragCoord.xy+u_temporal_offset);sky_color+=0.1*sun_disk(v_uv,u_sun_direction);glFragColor=vec4(sky_color*u_opacity,u_opacity);
1604#ifdef OVERDRAW_INSPECTOR
1605glFragColor=vec4(1.0);
1606#endif
1607}`,Jn),skyboxGradient:zt(`#include "_prelude_fog.fragment.glsl"
1608in highp vec3 v_uv;uniform lowp sampler2D u_color_ramp;uniform highp vec3 u_center_direction;uniform lowp float u_radius;uniform lowp float u_opacity;uniform highp float u_temporal_offset;void main() {float progress=acos(dot(normalize(v_uv),u_center_direction))/u_radius;vec4 color=texture(u_color_ramp,vec2(progress,0.5));
1609#ifdef FOG
1610color.rgb=fog_apply_sky_gradient(v_uv.xzy,color.rgb/color.a)*color.a;
1611#endif
1612color*=u_opacity;color.rgb=dither(color.rgb,gl_FragCoord.xy+u_temporal_offset);glFragColor=color;
1613#ifdef OVERDRAW_INSPECTOR
1614glFragColor=vec4(1.0);
1615#endif
1616}`,Jn),skyboxCapture:zt
vendor: 3,792 bytes, lines 1616-1627
1616(`
1617in highp vec3 v_position;uniform highp float u_sun_intensity;uniform highp float u_luminance;uniform lowp vec3 u_sun_direction;uniform highp vec4 u_color_tint_r;uniform highp vec4 u_color_tint_m;precision highp float;
1618#define BETA_R                  vec3(5.5e-6,13.0e-6,22.4e-6)
1619#define BETA_M                  vec3(21e-6,21e-6,21e-6)
1620#define MIE_G                   0.76
1621#define DENSITY_HEIGHT_SCALE_R  8000.0
1622#define DENSITY_HEIGHT_SCALE_M  1200.0
1623#define PLANET_RADIUS           6360e3
1624#define ATMOSPHERE_RADIUS       6420e3
1625#define SAMPLE_STEPS            10
1626#define DENSITY_STEPS           4
1627float ray_sphere_exit(vec3 orig,vec3 dir,float radius) {float a=dot(dir,dir);float b=2.0*dot(dir,orig);float c=dot(orig,orig)-radius*radius;float d=sqrt(b*b-4.0*a*c);return (-b+d)/(2.0*a);}vec3 extinction(vec2 density) {return exp(-vec3(BETA_R*u_color_tint_r.a*density.x+BETA_M*u_color_tint_m.a*density.y));}vec2 local_density(vec3 point) {float height=max(length(point)-PLANET_RADIUS,0.0);float exp_r=exp(-height/DENSITY_HEIGHT_SCALE_R);float exp_m=exp(-height/DENSITY_HEIGHT_SCALE_M);return vec2(exp_r,exp_m);}float phase_ray(float cos_angle) {return (3.0/(16.0*PI))*(1.0+cos_angle*cos_angle);}float phase_mie(float cos_angle) {return (3.0/(8.0*PI))*((1.0-MIE_G*MIE_G)*(1.0+cos_angle*cos_angle))/((2.0+MIE_G*MIE_G)*pow(1.0+MIE_G*MIE_G-2.0*MIE_G*cos_angle,1.5));}vec2 density_to_atmosphere(vec3 point,vec3 light_dir) {float ray_len=ray_sphere_exit(point,light_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(DENSITY_STEPS);vec2 density_point_to_atmosphere=vec2(0.0);for (int i=0; i < DENSITY_STEPS;++i) {vec3 point_on_ray=point+light_dir*((float(i)+0.5)*step_len);density_point_to_atmosphere+=local_density(point_on_ray)*step_len;;}return density_point_to_atmosphere;}vec3 atmosphere(vec3 ray_dir,vec3 sun_direction,float sun_intensity) {vec2 density_orig_to_point=vec2(0.0);vec3 scatter_r=vec3(0.0);vec3 scatter_m=vec3(0.0);vec3 origin=vec3(0.0,PLANET_RADIUS,0.0);float ray_len=ray_sphere_exit(origin,ray_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(SAMPLE_STEPS);for (int i=0; i < SAMPLE_STEPS;++i) {vec3 point_on_ray=origin+ray_dir*((float(i)+0.5)*step_len);vec2 density=local_density(point_on_ray)*step_len;density_orig_to_point+=density;vec2 density_point_to_atmosphere=density_to_atmosphere(point_on_ray,sun_direction);vec2 density_orig_to_atmosphere=density_orig_to_point+density_point_to_atmosphere;vec3 extinction=extinction(density_orig_to_atmosphere);scatter_r+=density.x*extinction;scatter_m+=density.y*extinction;}float cos_angle=dot(ray_dir,sun_direction);float phase_r=phase_ray(cos_angle);float phase_m=phase_mie(cos_angle);vec3 beta_r=BETA_R*u_color_tint_r.rgb*u_color_tint_r.a;vec3 beta_m=BETA_M*u_color_tint_m.rgb*u_color_tint_m.a;return (scatter_r*phase_r*beta_r+scatter_m*phase_m*beta_m)*sun_intensity;}const float A=0.15;const float B=0.50;const float C=0.10;const float D=0.20;const float E=0.02;const float F=0.30;vec3 uncharted2_tonemap(vec3 x) {return ((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F;}void main() {vec3 ray_direction=v_position;ray_direction.y=pow(ray_direction.y,5.0);const float y_bias=0.015;ray_direction.y+=y_bias;vec3 color=atmosphere(normalize(ray_direction),u_sun_direction,u_sun_intensity);float white_scale=1.0748724675633854;color=uncharted2_tonemap((log2(2.0/pow(u_luminance,4.0)))*color)*white_scale;glFragColor=vec4(color,1.0);}`,"in highp vec3 a_pos_3f;uniform mat3 u_matrix_3f;out highp vec3 v_position;float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(end-start)+new_start;}void main() {vec4 pos=vec4(u_matrix_3f*a_pos_3f,1.0);v_position=pos.xyz;v_position.y*=-1.0;v_position.y=map(v_position.y,-1.0,1.0,0.0,1.0);gl_Position=vec4(a_pos_3f.xy,0.0,1.0);}"),globe
1627Raster:zt(`#include "_prelude_fog.fragment.glsl"
1628#include "_prelude_lighting.glsl"
1629uniform sampler2D u_image0;uniform float u_far_z_cutoff;in vec2 v_pos0;
1630#ifndef FOG
1631uniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform vec2 u_viewport;
1632#endif
1633void main() {vec4 color;
1634#ifdef CUSTOM_ANTIALIASING
1635vec2 uv=gl_FragCoord.xy/u_viewport;highp vec3 ray_dir=mix(
1636mix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);vec3 dir=normalize(ray_dir);vec3 closest_point=dot(u_globe_pos,dir)*dir;float norm_dist_from_center=1.0-length(closest_point-u_globe_pos)/u_globe_radius;const float antialias_pixel=2.0;float antialias_factor=antialias_pixel*fwidth(norm_dist_from_center);float antialias=smoothstep(0.0,antialias_factor,norm_dist_from_center);vec4 raster=texture(u_image0,v_pos0);
1637#ifdef LIGHTING_3D_MODE
1638#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS
1639raster=apply_lighting_with_emission_ground(raster,raster.a);color=vec4(raster.rgb*antialias,antialias);
1640#else
1641raster=apply_lighting_ground(raster);color=vec4(raster.rgb*antialias,raster.a*antialias);
1642#endif
1643#else
1644color=vec4(raster.rgb*antialias,raster.a*antialias);
1645#endif
1646#else
1647color=texture(u_image0,v_pos0);
1648#ifdef LIGHTING_3D_MODE
1649#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS
1650color=apply_lighting_with_emission_ground(color,color.a);color.a=1.0;
1651#else
1652color=apply_lighting_ground(color);
1653#endif
1654#endif
1655#endif
1656#ifdef FOG
1657color=fog_dither(fog_apply_premultiplied(color,v_fog_pos));
1658#endif
1659color*=1.0-step(u_far_z_cutoff,1.0/gl_FragCoord.w);glFragColor=color;
1660#ifdef OVERDRAW_INSPECTOR
1661glFragColor=vec4(1.0);
1662#endif
1663HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
1664#include "_prelude_terrain.vertex.glsl"
1665uniform mat4 u_proj_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform float u_zoom_transition;uniform vec2 u_merc_center;uniform mat3 u_grid_matrix;uniform float u_skirt_height;
1666#ifdef GLOBE_POLES
1667in vec3 a_globe_pos;in vec2 a_uv;
1668#else
1669in vec2 a_pos;
1670#endif
1671out vec2 v_pos0;void main() {
1672#ifdef GLOBE_POLES
1673vec3 globe_pos=a_globe_pos;vec2 uv=a_uv;
1674#else
1675float tiles=u_grid_matrix[0][2];float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];vec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);float mercatorY=mercatorYfromLat(latLng[0]);float uvY=mercatorY*tiles-idy;float mercatorX=mercatorXfromLng(latLng[1]);float uvX=mercatorX*tiles-idx;vec3 globe_pos=latLngToECEF(latLng.xy);vec2 merc_pos=vec2(mercatorX,mercatorY);vec2 uv=vec2(uvX,uvY);
1676#endif
1677v_pos0=uv;vec2 tile_pos=uv*EXTENT;vec3 globe_derived_up_vector=normalize(globe_pos)*u_tile_up_scale;
1678#ifdef GLOBE_POLES
1679vec3 up_vector=globe_derived_up_vector;
1680#else
1681vec3 up_vector=elevationVector(tile_pos);
1682#endif
1683float height=elevation(tile_pos);globe_pos+=up_vector*height;
1684#ifndef GLOBE_POLES
1685globe_pos-=globe_derived_up_vector*u_skirt_height*decomposed_pos_and_skirt.z;
1686#endif
1687#ifdef GLOBE_POLES
1688vec4 interpolated_pos=u_globe_matrix*vec4(globe_pos,1.0);
1689#else
1690vec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);if (u_zoom_transition > 0.0) {merc_world_pos=vec4(merc_pos,height-u_skirt_height*decomposed_pos_and_skirt.z,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition),1.0);
1691#endif
1692gl_Position=u_proj_matrix*interpolated_pos;
1693#ifdef FOG
1694v_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);
1695#endif
1696}`),globeAtmosphere:zt(`#include "_prelude_fog.fragment.glsl"
1697uniform float u_transition;uniform highp float u_fadeout_range;uniform highp float u_temporal_offset;uniform vec4 u_color;uniform vec4 u_high_color;uniform vec4 u_space_color;uniform float u_horizon_angle;in highp vec3 v_ray_dir;in highp vec3 v_horizon_dir;void main() {highp vec3 dir=normalize(v_ray_dir);float globe_pos_dot_dir;
1698#ifdef PROJECTION_GLOBE_VIEW
1699globe_pos_dot_dir=dot(u_globe_pos,dir);highp vec3 closest_point_forward=abs(globe_pos_dot_dir)*dir;float norm_dist_from_center=length(closest_point_forward-u_globe_pos)/u_globe_radius;if (norm_dist_from_center < 0.98) {
1700#ifdef ALPHA_PASS
1701glFragColor=vec4(0,0,0,0);return;
1702#else
1703#ifdef NATIVE
1704glFragColor=vec4(1,1,1,1);
1705#else
1706glFragColor=vec4(0,0,0,1);
1707#endif
1708return;
1709#endif
1710}
1711#endif
1712highp vec3 horizon_dir=normalize(v_horizon_dir);float horizon_angle_mercator=dir.y < horizon_dir.y ?
17130.0 : max(acos(clamp(dot(dir,horizon_dir),-1.0,1.0)),0.0);float horizon_angle;
1714#ifdef PROJECTION_GLOBE_VIEW
1715highp vec3 closest_point=globe_pos_dot_dir*dir;highp float closest_point_to_center=length(closest_point-u_globe_pos);highp float theta=asin(clamp(closest_point_to_center/length(u_globe_pos),-1.0,1.0));horizon_angle=globe_pos_dot_dir < 0.0 ?
1716PI-theta-u_horizon_angle : theta-u_horizon_angle;float angle_t=pow(u_transition,10.0);horizon_angle=mix(horizon_angle,horizon_angle_mercator,angle_t);
1717#else
1718horizon_angle=horizon_angle_mercator;
1719#endif
1720horizon_angle/=PI;float t=exp(-horizon_angle/u_fadeout_range);float alpha_0=u_color.a;float alpha_1=u_high_color.a;float alpha_2=u_space_color.a;vec3 color_stop_0=u_color.rgb;vec3 color_stop_1=u_high_color.rgb;
1720vec3 color_stop_2=u_space_color.rgb;
1721#ifdef ALPHA_PASS
1722float a0=mix(alpha_2,1.0,alpha_1);float a1=mix(a0,1.0,alpha_0);float a2=mix(a0,a1,t);float a =mix(alpha_2,a2,t);glFragColor=vec4(1.0,1.0,1.0,a);
1723#else
1724vec3 c0=mix(color_stop_2,color_stop_1,alpha_1);vec3 c1=mix(c0,color_stop_0,alpha_0);vec3 c2=mix(c0,c1,t);vec3 c=c2;
1725#ifndef NATIVE
1726c=dither(c,gl_FragCoord.xy+u_temporal_offset);
1727#endif
1728glFragColor=vec4(c*t,t);
1729#endif
1730}`,`in vec3 a_pos;in vec2 a_uv;uniform vec3 u_frustum_tl;uniform vec3 u_frustum_tr;uniform vec3 u_frustum_br;uniform vec3 u_frustum_bl;uniform float u_horizon;out highp vec3 v_ray_dir;out highp vec3 v_horizon_dir;void main() {v_ray_dir=mix(
1731mix(u_frustum_tl,u_frustum_tr,a_uv.x),mix(u_frustum_bl,u_frustum_br,a_uv.x),a_uv.y);v_horizon_dir=mix(
1732mix(u_frustum_tl,u_frustum_bl,u_horizon),mix(u_frustum_tr,u_frustum_br,u_horizon),a_uv.x);gl_Position=vec4(a_pos,1.0);}`),model:zt(`#include "_prelude_fog.fragment.glsl"
1733#include "_prelude_shadow.fragment.glsl"
1734#include "_prelude_lighting.glsl"
1735uniform float u_opacity;uniform vec3 u_lightcolor;uniform vec3 u_lightpos;uniform float u_lightintensity;uniform vec4 u_baseColorFactor;uniform vec4 u_emissiveFactor;uniform float u_metallicFactor;uniform float u_roughnessFactor;uniform float u_emissive_strength;in highp vec4 v_position_height;in lowp vec4 v_color_mix;
1736#ifdef RENDER_SHADOWS
1737in vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1;in float v_depth_shadows;
1738#endif
1739#ifdef OCCLUSION_TEXTURE_TRANSFORM
1740uniform vec4 u_occlusionTextureTransform;
1741#endif
1742#pragma mapbox: define-attribute highp vec3 normal_3f
1743#pragma mapbox: define-attribute highp vec3 color_3f
1744#pragma mapbox: define-attribute highp vec4 color_4f
1745#pragma mapbox: define-attribute highp vec2 uv_2f
1746#pragma mapbox: initialize-attribute highp vec3 normal_3f
1747#pragma mapbox: initialize-attribute highp vec3 color_3f
1748#pragma mapbox: initialize-attribute highp vec4 color_4f
1749#pragma mapbox: initialize-attribute highp vec2 uv_2f
1750#ifdef HAS_ATTRIBUTE_a_pbr
1751in lowp vec4 v_roughness_metallic_emissive_alpha;in mediump vec4 v_height_based_emission_params;
1752#endif
1753#ifdef HAS_TEXTURE_u_baseColorTexture
1754uniform sampler2D u_baseColorTexture;uniform bool u_baseTextureIsAlpha;uniform bool u_alphaMask;uniform float u_alphaCutoff;
1755#endif
1756#ifdef HAS_TEXTURE_u_metallicRoughnessTexture
1757uniform sampler2D u_metallicRoughnessTexture;
1758#endif
1759#ifdef HAS_TEXTURE_u_occlusionTexture
1760uniform sampler2D u_occlusionTexture;uniform float u_aoIntensity;
1761#endif
1762#ifdef HAS_TEXTURE_u_normalTexture
1763uniform sampler2D u_normalTexture;
1764#endif
1765#ifdef HAS_TEXTURE_u_emissionTexture
1766uniform sampler2D u_emissionTexture;
1767#endif
1768#ifdef TERRAIN_FRAGMENT_OCCLUSION
1769in highp float v_depth;uniform sampler2D u_depthTexture;uniform vec2 u_inv_depth_size;bool isOccluded() {vec2 coord=gl_FragCoord.xy*u_inv_depth_size;highp float depth=unpack_depth(texture(u_depthTexture,coord));return v_depth > depth+0.0005;}
1770#endif
1771#define saturate(_x) clamp(_x,0.,1.)
1772vec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}float calculate_NdotL(vec3 normal,vec3 lightDir) {const float ext=0.70710678118;return (clamp(dot(normal,lightDir),-ext,1.0)+ext)/(1.0+ext);}vec3 getDiffuseShadedColor(vec3 albedo,vec3 normal,vec3 lightDir,vec3 lightColor)
1773{
1774#ifdef LIGHTING_3D_MODE
1775vec3 transformed_normal=vec3(-normal.xy,normal.z);float lighting_factor;
1776#ifdef RENDER_SHADOWS
1777lighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows);
1778#else
1779lighting_factor=saturate(dot(transformed_normal,u_lighting_directional_dir));
1780#endif
1781return apply_lighting(albedo,transformed_normal,lighting_factor);
1782#else
1783vec3 n=normal;float colorvalue=((albedo.x*0.2126)+(albedo.y*0.7152))+(albedo.z*0.0722);vec3 c=vec3(0.03,0.03,0.03);float directional=clamp(dot(n,vec3(lightDir)),0.0,1.0);directional=mix(1.0-u_lightintensity,max((1.0-colorvalue)+u_lightintensity,1.0),directional);vec3 c3=c+clamp((albedo*directional)*lightColor,mix(vec3(0.0),vec3(0.3),vec3(1.0)-lightColor),vec3(1.0));return c3;
1784#endif
1785}vec4 getBaseColor() {vec4 albedo=u_baseColorFactor;
1786#ifdef HAS_ATTRIBUTE_a_color_3f
1787albedo*=vec4(color_3f,1.0);
1788#endif
1789#ifdef HAS_ATTRIBUTE_a_pbr
1790#else
1791#ifdef HAS_ATTRIBUTE_a_color_4f
1792albedo*=color_4f;
1793#endif
1794#endif
1795#if defined (HAS_TEXTURE_u_baseColorTexture) && defined (HAS_ATTRIBUTE_a_uv_2f)
1796vec4 texColor=texture(u_baseColorTexture,uv_2f);if(u_alphaMask) {if (texColor.w < u_alphaCutoff) {discard;}}
1797#ifdef UNPREMULT_TEXTURE_IN_SHADER
1798if(texColor.w > 0.0) {texColor.rgb/=texColor.w;}texColor.w=1.0;
1799#endif
1800if(u_baseTextureIsAlpha) {if (texColor.r < 0.5) {discard;}} else {texColor.rgb=sRGBToLinear(texColor.rgb);albedo*=texColor;}
1801#endif
1802return vec4(mix(albedo.rgb,v_color_mix.rgb,v_color_mix.a),albedo.a);}highp mat3 cotangentFrame(highp vec3 N,highp vec3 p,highp vec2 uv ) {
1803#ifdef HAS_TEXTURE_u_normalTexture
1804highp vec3 dp1=vec3(dFdx(p.x),dFdx(p.y),dFdx(p.z));highp vec3 dp2=vec3(dFdy(p.x),dFdy(p.y),dFdy(p.z));highp vec2 duv1=vec2(dFdx(uv.x),dFdx(uv.y));highp vec2 duv2=vec2(dFdy(uv.x),dFdy(uv.y));highp vec3 dp2perp=cross( dp2,N );highp vec3 dp1perp=cross( N,dp1 );highp vec3 T=dp2perp*duv1.x+dp1perp*duv2.x;highp vec3 B=dp2perp*duv1.y+dp1perp*duv2.y;highp float lengthT=dot(T,T);highp float lengthB=dot(B,B);highp float maxLength=max(lengthT,lengthB);highp float invmax=inversesqrt( maxLength );highp mat3 res=mat3( T*invmax,B*invmax,N );return res;
1805#else
1806return mat3(1.0);
1807#endif
1808}highp vec3 getNormal(){highp vec3 n;
1809#ifdef HAS_ATTRIBUTE_a_normal_3f
1810n=normalize(normal_3f);
1811#else
1812highp vec3 fdx=vec3(dFdx(v_position_height.x),dFdx(v_position_height.y),dFdx(v_position_height.z));highp vec3 fdy=vec3(dFdy(v_position_height.x),dFdy(v_position_height.y),dFdy(v_position_height.z));n=normalize(cross(fdx,fdy))*-1.0;
1813#endif
1814#if defined(HAS_TEXTURE_u_normalTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)
1815vec3 nMap=texture( u_normalTexture,uv_2f).xyz;nMap=normalize(2.0*nMap-vec3(1.0));highp vec3 v=normalize(-v_position_height.xyz);highp mat3 TBN=cotangentFrame(n,v,uv_2f);n=normalize(TBN*nMap);
1816#endif
1817return n;}struct Material {float perceptualRoughness;float alphaRoughness;float metallic;vec3 f90;vec4 baseColor;vec3 diffuseColor;vec3 specularColor;highp vec3 normal;};Material getPBRMaterial() {Material mat;mat.baseColor=getBaseColor();mat.perceptualRoughness=u_roughnessFactor;mat.metallic=u_metallicFactor;
1818#ifdef HAS_ATTRIBUTE_a_pbr
1819mat.perceptualRoughness=v_roughness_metallic_emissive_alpha.x;mat.metallic=v_roughness_metallic_emissive_alpha.y;mat.baseColor.w*=v_roughness_metallic_emissive_alpha.w;
1820#endif
1821#if defined(HAS_TEXTURE_u_metallicRoughnessTexture) && defined(HAS_ATTRIBUTE_a_uv_2f) 
vendor: 3,959 bytes, lines 1821-1853
1821
1822vec4 mrSample=texture(u_metallicRoughnessTexture,uv_2f);mat.perceptualRoughness*=mrSample.g;mat.metallic*=mrSample.b;
1823#endif
1824const float c_minRoughness=0.04;mat.perceptualRoughness=clamp(mat.perceptualRoughness,c_minRoughness,1.0);mat.metallic=saturate(mat.metallic);mat.alphaRoughness=mat.perceptualRoughness*mat.perceptualRoughness;const vec3 f0=vec3(0.04);mat.diffuseColor=mat.baseColor.rgb*(vec3(1.0)-f0);mat.diffuseColor*=1.0-mat.metallic;mat.specularColor=mix(f0,mat.baseColor.rgb,mat.metallic);highp float reflectance=max(max(mat.specularColor.r,mat.specularColor.g),mat.specularColor.b);highp float reflectance90=saturate(reflectance*25.0);mat.f90=vec3(reflectance90);mat.normal=getNormal();return mat;}float V_GGX(float NdotL,float NdotV,float roughness)
1825{float a2=roughness*roughness;float GGXV=NdotL*sqrt(NdotV*NdotV*(1.0-a2)+a2);float GGXL=NdotV*sqrt(NdotL*NdotL*(1.0-a2)+a2);return 0.5/(GGXV+GGXL);}float V_GGXFast(float NdotL,float NdotV,float roughness) {float a=roughness;float GGXV=NdotL*(NdotV*(1.0-a)+a);float GGXL=NdotV*(NdotL*(1.0-a)+a);return 0.5/(GGXV+GGXL);}vec3 F_Schlick(vec3 specularColor,vec3 f90,float VdotH)
1826{return specularColor+(f90-specularColor)*pow(clamp(1.0-VdotH,0.0,1.0),5.0);}vec3 F_SchlickFast(vec3 specularColor,float VdotH)
1827{float x=1.0-VdotH;float x4=x*x*x*x;return specularColor+(1.0-specularColor)*x4*x;}float D_GGX(highp float NdotH,float alphaRoughness)
1828{highp float a4=alphaRoughness*alphaRoughness;highp float f=(NdotH*a4-NdotH)*NdotH+1.0;return a4/(PI*f*f);}vec3 diffuseBurley(Material mat,float LdotH,float NdotL,float NdotV)
1829{float f90=2.0*LdotH*LdotH*mat.alphaRoughness-0.5;return (mat.diffuseColor/PI)*(1.0+f90*pow((1.0-NdotL),5.0))*(1.0+f90*pow((1.0-NdotV),5.0));}vec3 diffuseLambertian(Material mat)
1830{
1831#ifdef LIGHTING_3D_MODE
1832return mat.diffuseColor;
1833#else
1834return mat.diffuseColor/PI;
1835#endif
1836}vec3 EnvBRDFApprox(vec3 specularColor,float roughness,highp float NdotV)
1837{vec4 c0=vec4(-1,-0.0275,-0.572,0.022);vec4 c1=vec4(1,0.0425,1.04,-0.04);highp vec4 r=roughness*c0+c1;highp float a004=min(r.x*r.x,exp2(-9.28*NdotV))*r.x+r.y;vec2 AB=vec2(-1.04,1.04)*a004+r.zw;return specularColor*AB.x+AB.y;}vec3 computeIndirectLightContribution(Material mat,float NdotV,vec3 normal)
1838{vec3 env_light=vec3(0.65,0.65,0.65);
1839#ifdef LIGHTING_3D_MODE
1840float ambient_factor=calculate_ambient_directional_factor(normal);env_light=u_lighting_ambient_color*ambient_factor;
1841#endif
1842vec3 envBRDF=EnvBRDFApprox(mat.specularColor,mat.perceptualRoughness,NdotV);vec3 indirectSpecular= envBRDF*env_light;vec3 indirectDiffuse=mat.diffuseColor*env_light;return indirectSpecular+indirectDiffuse;}vec3 computeLightContribution(Material mat,vec3 lightPosition,vec3 lightColor)
1843{highp vec3 n=mat.normal;highp vec3 v=normalize(-v_position_height.xyz);highp vec3 l=normalize(lightPosition);highp vec3 h=normalize(v+l);float NdotV=clamp(abs(dot(n,v)),0.001,1.0);float NdotL=saturate(dot(n,l));highp float NdotH=saturate(dot(n,h));float VdotH=saturate(dot(v,h));vec3 f=F_SchlickFast(mat.specularColor,VdotH);float g=V_GGXFast(NdotL,NdotV,mat.alphaRoughness);float d=D_GGX(NdotH,mat.alphaRoughness);vec3 diffuseTerm=(1.0-f)*diffuseLambertian(mat);vec3 specularTerm=f*g*d;vec3 transformed_normal=vec3(-n.xy,n.z);float lighting_factor;
1844#ifdef RENDER_SHADOWS
1845lighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows);
1846#else
1847lighting_factor=NdotL;
1848#endif
1849vec3 directLightColor=(specularTerm+diffuseTerm)*lighting_factor*lightColor;vec3 indirectLightColor=computeIndirectLightContribution(mat,NdotV,transformed_normal);vec3 color=(saturate(directLightColor)+indirectLightColor);float intensityFactor=1.0;
1850#if !defined(LIGHTING_3D_MODE)
1851const vec3 luminosityFactor=vec3(0.2126,0.7152,0.0722);float luminance=dot(diffuseTerm,luminosityFactor);intensityFactor=mix((1.0-u_lightintensity),max((1.0-luminance+u_lightintensity),1.0),NdotL);
1852#endif
1853color*=intensityFactor;return color;}void main() {
1853
1854#ifdef TERRAIN_FRAGMENT_OCCLUSION
1855if (isOccluded()) {discard;}
1856#endif
1857vec3 lightDir=u_lightpos;vec3 lightColor=u_lightcolor;
1858#ifdef LIGHTING_3D_MODE
1859lightDir=u_lighting_directional_dir;lightDir.xy=-lightDir.xy;lightColor=u_lighting_directional_color;
1860#endif
1861vec4 finalColor;
1862#ifdef DIFFUSE_SHADED
1863vec3 N=getNormal();vec3 baseColor=getBaseColor().rgb;vec3 diffuse=getDiffuseShadedColor(baseColor,N,lightDir,lightColor);
1864#ifdef HAS_TEXTURE_u_occlusionTexture
1865float ao=(texture(u_occlusionTexture,uv_2f).r-1.0)*u_aoIntensity+1.0;diffuse*=ao;
1866#endif
1867finalColor=vec4(mix(diffuse,baseColor,u_emissive_strength),1.0)*u_opacity;
1868#else
1869Material mat=getPBRMaterial();vec3 color=computeLightContribution(mat,lightDir,lightColor);float ao=1.0;
1870#if defined (HAS_TEXTURE_u_occlusionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)
1871#ifdef OCCLUSION_TEXTURE_TRANSFORM
1872vec2 uv=uv_2f.xy*u_occlusionTextureTransform.zw+u_occlusionTextureTransform.xy;
1873#else
1874vec2 uv=uv_2f;
1875#endif
1876ao=(texture(u_occlusionTexture,uv).x-1.0)*u_aoIntensity+1.0;color*=ao;
1877#endif
1878vec4 emissive=u_emissiveFactor;
1879#if defined(HAS_TEXTURE_u_emissionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)
1880emissive.rgb*=sRGBToLinear(texture(u_emissionTexture,uv_2f).rgb);
1881#endif
1882color+=emissive.rgb;float opacity=mat.baseColor.w*u_opacity;
1883#ifdef HAS_ATTRIBUTE_a_pbr
1884float resEmission=v_roughness_metallic_emissive_alpha.z;resEmission*=v_height_based_emission_params.z+v_height_based_emission_params.w*pow(clamp(v_height_based_emission_params.x,0.0,1.0),v_height_based_emission_params.y);color=mix(color,v_color_mix.rgb,min(1.0,resEmission));
1885#ifdef HAS_ATTRIBUTE_a_color_4f
1886float distance=length(vec2(1.3*max(0.0,abs(color_4f.x)-color_4f.z),color_4f.
1886y));distance+= mix(0.5,0.0,clamp(resEmission-1.0,0.0,1.0));opacity*=v_roughness_metallic_emissive_alpha.w*saturate(1.0-distance*distance);
1887#endif
1888#endif
1889vec3 unlitColor=mat.baseColor.rgb*ao+emissive.rgb;color=mix(color,unlitColor,u_emissive_strength);color=linearTosRGB(color);color*=opacity;finalColor=vec4(color,opacity);
1890#endif
1891#ifdef FOG
1892finalColor=fog_dither(fog_apply_premultiplied(finalColor,v_fog_pos,v_position_height.w));
1893#endif
1894#ifdef RENDER_CUTOFF
1895finalColor*=v_cutoff_opacity;
1896#endif
1897#ifdef INDICATOR_CUTOUT
1898finalColor=applyCutout(finalColor);
1899#endif
1900glFragColor=finalColor;
1901#ifdef OVERDRAW_INSPECTOR
1902glFragColor=vec4(1.0);
1903#endif
1904HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
1905#include "_prelude_shadow.vertex.glsl"
1906in vec3 a_pos_3f;
1907#pragma mapbox: define-attribute highp vec3 normal_3f
1908#pragma mapbox: define-attribute highp vec2 uv_2f
1909#pragma mapbox: define-attribute highp vec3 color_3f
1910#pragma mapbox: define-attribute highp vec4 color_4f
1911#pragma mapbox: define-attribute-vertex-shader-only highp vec4 pbr
1912#pragma mapbox: define-attribute-vertex-shader-only highp vec3 heightBasedEmissiveStrength
1913uniform mat4 u_matrix;uniform mat4 u_node_matrix;uniform mat4 u_lighting_matrix;uniform vec3 u_camera_pos;uniform vec4 u_color_mix;
1914#ifdef INSTANCED_ARRAYS
1915in vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3;
1916#else
1917uniform highp mat4 u_normal_matrix;
1918#endif
1919#ifdef RENDER_SHADOWS
1920uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out vec4 v_pos_light_view_0;out vec4 v_pos_light_view_1;out float v_depth_shadows;
1921#endif
1922out vec4 v_position_height;out lowp vec4 v_color_mix;
1923#ifdef TERRAIN_FRAGMENT_OCCLUSION
1924out highp float v_depth;
1925#endif
1926#ifdef HAS_ATTRIBUTE_a_pbr
1927out lowp vec4 v_roughness_metallic_emissive_alpha;out mediump vec4 v_height_based_emission_params;
1928#endif
1929vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}void main() {
1930#pragma mapbox: initialize-attribute highp vec3 normal_3f
1931#pragma mapbox: initialize-attribute highp vec2 uv_2f
1932#pragma mapbox: initialize-attribute highp vec3 color_3f
1933#pragma mapbox: initialize-attribute highp vec4 color_4f
1934#pragma mapbox: initialize-attribute-custom highp vec4 pbr
1935#pragma mapbox: initialize-attribute-custom highp vec3 heightBasedEmissiveStrength
1936highp mat4 normal_matrix;
1937#ifdef INSTANCED_ARRAYS
1938normal_matrix=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3);
1939#else
1940normal_matrix=u_normal_matrix;
1941#endif
1942vec3 local_pos;mat3 rs;
1943#ifdef MODEL_POSITION_ON_GPU
1944vec3 pos_color=normal_matrix[0].xyz;vec4 translate=normal_matrix[1];vec3 pos_a=floor(pos_color);vec3 rgb=1.05*(pos_color-pos_a);float color_mix=pos_a.z/100.0;v_color_mix=vec4(sRGBToLinear(rgb),color_mix);float meter_to_tile=normal_matrix[0].w;vec4 pos=vec4(pos_a.xy,translate.z,1.0);rs[0].x=normal_matrix[1].w;rs[0].yz=normal_matrix[2].xy;rs[1].xy=normal_matrix[2].zw;rs[1].z=normal_matrix[3].x;rs[2].xyz=normal_matrix[3].yzw;vec4 pos_node=u_lighting_matrix*vec4(a_pos_3f,1.0);vec3 rotated_pos_node=rs*pos_node.xyz;vec3 pos_model_tile=(rotated_pos_node+vec3(translate.xy,0.0))*vec3(meter_to_tile,meter_to_tile,1.0);pos.xyz+=pos_model_tile;local_pos=pos.xyz;gl_Position=u_matrix*pos;pos.z*=meter_to_tile;v_position_height.xyz=pos.xyz-u_camera_pos;
1945#else
1946local_pos=a_pos_3f;gl_Position=u_matrix*vec4(a_pos_3f,1);v_position_height.xyz=vec3(u_lighting_matrix*vec4(a_pos_3f,1));v_color_mix=vec4(sRGBToLinear(u_color_mix.rgb),u_color_mix.a);
1947#endif
1948v_position_height.w=a_pos_3f.z;
1949#ifdef HAS_ATTRIBUTE_a_pbr
1950vec4 albedo_c=decode_color(pbr.xy);vec2 e_r_m=unpack_float(pbr.z);vec2 r_m= unpack_float(e_r_m.y*16.0);r_m.r=r_m.r*16.0;v_color_mix=vec4(albedo_c.rgb,1.0);v_roughness_metallic_emissive_alpha=vec4(vec3(r_m,e_r_m.x)/255.0,albedo_c.a);v_roughness_metallic_emissive_alpha.z*=2.0;float heightBasedRelativeIntepolation=a_pos_3f.z*heightBasedEmissiveStrength.x+heightBasedEmissiveStrength.y;v_height_based_emission_params.x=heightBasedRelativeIntepolation;v_height_based_emission_params.y=heightBasedEmissiveStrength.z;vec2 emissionMultiplierValues=unpack_float(pbr.w)/256.0;v_height_based_emission_params.z=emissionMultiplierValues.x;v_height_based_emission_params.w=emissionMultiplierValues.y-emissionMultiplierValues.x;
1951#endif
1952#ifdef FOG
1953v_fog_pos=fog_position(local_pos);
1954#endif
1955#ifdef RENDER_CUTOFF
1956v_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z);
1957#endif
1958#ifdef TERRAIN_FRAGMENT_OCCLUSION
1959v_depth=gl_Position.z/gl_Position.w;
1960#endif
1961#ifdef HAS_ATTRIBUTE_a_normal_3f
1962#ifdef MODEL_POSITION_ON_GPU
1963float x_squared_scale=dot(rs[0],rs[0]);float y_squared_scale=dot(rs[1],rs[1]);float z_squared_scale=dot(rs[2],rs[2]);vec3 squared_scale=vec3(x_squared_scale,y_squared_scale,z_squared_scale);normal_3f=rs*((u_lighting_matrix*vec4(normal_3f,0.0)).xyz/squared_scale);normal_3f=normalize(normal_3f);
1964#else
1965normal_3f=vec3(normal_matrix*vec4(normal_3f,0));
1966#endif
1967#endif
1968#ifdef HAS_ATTRIBUTE_a_pbr
1969#ifdef HAS_ATTRIBUTE_a_color_4f
1970v_roughness_metallic_emissive_alpha.w=clamp(color_4f.a*v_roughness_metallic_emissive_alpha.w*(v_roughness_metallic_emissive_alpha.z-1.0),0.0,1.0);
1971#endif
1972#endif
1973#ifdef RENDER_SHADOWS
1974vec4 shadow_pos=u_node_matrix*vec4(local_pos,1.0);
1975#ifdef NORMAL_OFFSET
1976#ifdef HAS_ATTRIBUTE_a_normal_3f
1977#ifdef MODEL_POSITION_ON_GPU
1978vec3 offset=shadow_normal_offset(vec3(-normal_3f.xy,normal_3f.z));shadow_pos.xyz+=offset*shadow_normal_offset_multiplier0();
1979#else
1980vec3 offset=shadow_normal_offset_model(normalize(normal_3f));shadow_pos.xyz+=offset*shadow_normal_offset_multiplier0();
1981#endif
1982#endif
1983#endif
1984v_pos_light_view_0=u_light_matrix_0*shadow_pos;v_pos_light_view_1=u_light_matrix_1*shadow_pos;v_depth_shadows=gl_Position.w;
1985#endif
1986}`),modelDepth:zt(`in highp float v_depth;void main() {
1987#ifndef DEPTH_TEXTURE
1988glFragColor=pack_depth(v_depth);
1989#endif
1990}`,`in vec3 a_pos_3f;uniform mat4 u_matrix;out highp float v_depth;
1991#ifdef MODEL_POSITION_ON_GPU
1992#ifdef INSTANCED_ARRAYS
1993in vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3;
1994#else
1995uniform highp mat4 u_instance;
1996#endif
1997uniform highp mat4 u_node_matrix;
1998#endif
1999void main() {
2000#ifdef MODEL_POSITION_ON_GPU
2001highp mat4 instance;
2002#ifdef INSTANCED_ARRAYS
2003instance=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3);
2004#else
2005instance=u_instance;
2006#endif
2007vec3 pos_color=instance[0].xyz;vec4 translate=instance[1];vec3 pos_a=floor(pos_color);float meter_to_tile=instance[0].w;vec4 pos=vec4(pos_a.xy,translate.z,1.0);mat3 rs;rs[0].x=instance[1].w;rs[0].yz=instance[2].xy;
2007rs[1].xy=instance[2].zw;rs[1].z=instance[3].x;rs[2].xyz=instance[3].yzw;vec4 pos_node=u_node_matrix*vec4(a_pos_3f,1.0);vec3 rotated_pos_node=rs*pos_node.xyz;vec3 pos_model_tile=(rotated_pos_node+vec3(translate.xy,0.0))*vec3(meter_to_tile,meter_to_tile,1.0);pos.xyz+=pos_model_tile;gl_Position=u_matrix*pos;
2008#else
2009gl_Position=u_matrix*vec4(a_pos_3f,1);
2010#endif
2011v_depth=gl_Position.z/gl_Position.w;}`),stars:zt(`in highp vec2 v_uv;in mediump float v_intensity;float shapeCircle(in vec2 uv)
2012{float beginFade=0.6;float lengthFromCenter=length(v_uv);return 1.0-clamp((lengthFromCenter-beginFade)/(1.0-beginFade),0.0,1.0);}void main() {float alpha=shapeCircle(v_uv);vec3 color=vec3(1.0,1.0,1.0);alpha*=v_intensity;glFragColor=vec4(color*alpha,alpha);HANDLE_WIREFRAME_DEBUG;}`,`
2013in vec3 a_pos_3f;in vec2 a_uv;in float a_size_scale;in float a_fade_opacity;uniform mat4 u_matrix;uniform vec3 u_up;uniform vec3 u_right;uniform float u_intensity_multiplier;out highp vec2 v_uv;out mediump float v_intensity;void main() {v_uv=a_uv;v_intensity=a_fade_opacity*u_intensity_multiplier;vec3 pos=a_pos_3f;pos+=a_uv.x*u_right*a_size_scale;pos+=a_uv.y*u_up*a_size_scale;gl_Position=u_matrix*vec4(pos,1.0);}`)};function Kn(c,r){const s=c.replace(/\s*\/\/[^\n]*\n/g,`
2014`).split(`
2015`);for(let u of s)if(u=u.trim(),u[0]==="#"&&u.includes("if")&&!u.includes("endif")){u=u.replace("#","").replace(/ifdef|ifndef|elif|if/g,"").replace(/!|defined|\(|\)|\|\||&&/g,"").replace(/\s+/g," ").trim();const d=u.split(" ");for(const f of d)r.includes(f)||r.push(f)}}function zt(c,r){const s=/#include\s+"([^"]+)"/g,u=/#pragma mapbox: ([\w\-]+) ([\w]+) ([\w]+) ([\w]+)/g;let d=r.match(/(attribute(\S*)|(^\s*|;)in) (highp |mediump |lowp )?([\w]+) ([\w]+)/gm);d&&(d=d.map(T=>{const S=T.split(" ");return S[S.length-1]}),d=[...new Set(d)]);const f={},_=[],y=[];if(c=c.replace(s,(T,S)=>(y.push(S),"")),(r=r.replace(s,(T,S)=>(_.push(S),""))).includes("flat out"))return void console.error('The usage of "flat" qualifier is disallowed, see: https://bugs.webkit.org/show_bug.cgi?id=268071');let b=[...ti];Kn(c,b),Kn(r,b);for(const T of[..._,...y])Ct[T]||console.error(`Undefined include: ${T}`),ia[T]||(ia[T]=[],Kn(Ct[T],ia[T])),b=[...b,...ia[T]];return{fragmentSource:c=c.replace(u,(T,S,A,C,P)=>(f[P]=!0,S==="define"?`
2016#ifndef HAS_UNIFORM_u_${P}
2017in ${A} ${C} ${P};
2018#else
2019uniform ${A} ${C} u_${P};
2020#endif
2021`:S==="initialize"?`
2022#ifdef HAS_UNIFORM_u_${P}
2023    ${A} ${C} ${P} = u_${P};
2024#endif
2025`:S==="define-attribute"?`
2026#ifdef HAS_ATTRIBUTE_a_${P}
2027    in ${A} ${C} ${P};
2028#endif
2029`:S==="initialize-attribute"?"":void 0)),vertexSource:r=r.replace(u,(T,S,A,C,P)=>{const L=C==="float"?"vec2":C,R=P.match(/color/)?"color":L;return S==="define-attribute-vertex-shader-only"?`
2030#ifdef HAS_ATTRIBUTE_a_${P}
2031in ${A} ${C} a_${P};
2032#endif
2033`:f[P]?S==="define"?`
2034#ifndef HAS_UNIFORM_u_${P}
2035uniform lowp float u_${P}_t;
2036in ${A} ${L} a_${P};
2037out ${A} ${C} ${P};
2038#else
2039uniform ${A} ${C} u_${P};
2040#endif
2041`:S==="initialize"?R==="vec4"?`
2042#ifndef HAS_UNIFORM_u_${P}
2043    ${P} = a_${P};
2044#else
2045    ${A} ${C} ${P} = u_${P};
2046#endif
2047`:`
2048#ifndef HAS_UNIFORM_u_${P}
2049    ${P} = unpack_mix_${R}(a_${P}, u_${P}_t);
2050#else
2051    ${A} ${C} ${P} = u_${P};
2052#endif
2053`:S==="define-attribute"?`
2054#ifdef HAS_ATTRIBUTE_a_${P}
2055    in ${A} ${C} a_${P};
2056    out ${A} ${C} ${P};
2057#endif
2058`:S==="initialize-attribute"?`
2059#ifdef HAS_ATTRIBUTE_a_${P}
2060    ${P} = a_${P};
2061#endif
2062`:void 0:S==="define"?`
2063#ifndef HAS_UNIFORM_u_${P}
2064uniform lowp float u_${P}_t;
2065in ${A} ${L} a_${P};
2066#else
2067uniform ${A} ${C} u_${P};
2068#endif
2069`:S==="define-instanced"?R==="mat4"?`
2070#ifdef INSTANCED_ARRAYS
2071in vec4 a_${P}0;
2072in vec4 a_${P}1;
2073in vec4 a_${P}2;
2074in vec4 a_${P}3;
2075#else
2076uniform ${A} ${C} u_${P};
2077#endif
2078`:`
2079#ifdef INSTANCED_ARRAYS
2080in ${A} ${L} a_${P};
2081#else
2082uniform ${A} ${C} u_${P};
2083#endif
2084`:S==="initialize-attribute-custom"?`
2085#ifdef HAS_ATTRIBUTE_a_${P}
2086    ${A} ${C} ${P} = a_${P};
2087#endif
2088`:R==="vec4"?`
2089#ifndef HAS_UNIFORM_u_${P}
2090    ${A} ${C} ${P} = a_${P};
2091#else
2092    ${A} ${C} ${P} = u_${P};
2093#endif
2094`:`
2095#ifndef HAS_UNIFORM_u_${P}
2096    ${A} ${C} ${P} = unpack_mix_${R}(a_${P}, u_${P}_t);
2097#else
2098    ${A} ${C} ${P} = u_${P};
2099#endif
2100`}),staticAttributes:d,usedDefines:b,vertexIncludes:_,fragmentIncludes:y}}class We{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffers=[],this.vao=null}bind(r,s,u,d,f,_,y,b){this.context=r;let T=this.boundPaintVertexBuffers.length!==d.length;for(let A=0;!T&&A<d.length;A++)this.boundPaintVertexBuffers[A]!==d[A]&&(T=!0);let S=this.boundDynamicVertexBuffers.length!==y.length;for(let A=0;!S&&A<y.length;A++)this.boundDynamicVertexBuffers[A]!==y[A]&&(S=!0);if(!this.vao||this.boundProgram!==s||this.boundLayoutVertexBuffer!==u||T||S||this.boundIndexBuffer!==f||this.boundVertexOffset!==_)this.freshBind(s,u,d,f,_,y,b);else{r.bindVertexArrayOES.set(this.vao);for(const A of y)A&&(A.bind(),b&&A.instanceCount&&A.setVertexAttribDivisor(r.gl,s,b));f&&f.dynamicDraw&&f.bind()}}freshBind(r,s,u,d,f,_,y){const b=r.numAttributes,T=this.context,S=T.gl;this.vao&&this.destroy(),this.vao=T.gl.createVertexArray(),T.bindVertexArrayOES.set(this.vao),this.boundProgram=r,this.boundLayoutVertexBuffer=s,this.boundPaintVertexBuffers=u,this.boundIndexBuffer=d,this.boundVertexOffset=f,this.boundDynamicVertexBuffers=_,s.enableAttributes(S,r),s.bind(),s.setVertexAttribPointers(S,r,f);for(const A of u)A.enableAttributes(S,r),A.bind(),A.setVertexAttribPointers(S,r,f);for(const A of _)A&&(A.enableAttributes(S,r),A.bind(),A.setVertexAttribPointers(S,r,f),y&&A.instanceCount&&A.setVertexAttribDivisor(S,r,y));d&&d.bind(),T.currentNumAttributes=b}destroy(){this.vao&&(this.context.gl.deleteVertexArray(this.vao),this.vao=null)}}function Ht(c,r){const s=Math.pow(2,r.canonical.z),u=r.canonical.y;return[new o.O(0,u/s).toLngLat().lat,new o.O(0,(u+1)/s).toLngLat().lat]}function Xt(c,r,s,u,d,f,_){const y=c.context,b=y.gl,T=s.hillshadeFBO;if(!T)return;c.prepareDrawTile();const S=c.isTileAffectedByFog(r),A=c.getOrCreateProgram("hillshade",{overrideFog:S});y.activeTexture.set(b.TEXTURE0),b.bindTexture(b.TEXTURE_2D,T.colorAttachment.get());const C=((k,O,N,$)=>{const Z=N.paint.get("hillshade-shadow-color"),Q=N.paint.get("hillshade-highlight-color"),B=N.paint.get("hillshade-accent-color"),U=N.paint.get("hillshade-emissive-strength");let K=o.bm(N.paint.get("hillshade-illumination-direction"));if(N.paint.get("hillshade-illumination-anchor")==="viewport")K-=k.transform.angle;else if(k.style&&k.style.enable3dLights()&&k.style.directionalLight){const re=k.style.directionalLight.properties.get("direction"),he=o.bT(re.x,re.y,re.z);K=o.bm(he[1])}const Y=!k.options.moving;return{u_matrix:$||k.transform.calculateProjMatrix(O.tileID.toUnwrapped(),Y),u_image:0,u_latrange:Ht(0,O.tileID),u_light:[N.paint.get("hillshade-exaggeration"),K],u_shadow:Z,u_highlight:Q,u_emissive_strength:U,u_accent:B}})(c,s,u,c.terrain?r.projMatrix:null);c.uploadCommonUniforms(y,A,r.toUnwrapped());const{tileBoundsBuffer:P,tileBoundsIndexBuffer:L,tileBoundsSegments:R}=c.getTileBoundsBuffers(s);A.draw(c,b.TRIANGLES,d,f,_,ft.disabled,C,u.id,P,L,R)}function Or(c,r,s){if(!r.needsDEMTextureUpload)return;const u=c.context,d=u.gl;u.pixelStoreUnpackPremultiplyAlpha.set(!1),r.demTexture=r.demTexture||c.getTileTexture(s.stride);const f=s.getPixels();r.demTexture?r.demTexture.update(f,{premultiply:!1}):r.demTexture=new o.T(u,f,d.R32F,{premultiply:!1}),r.needsDEMTextureUpload=!1}function eo(c,r,s){const u=c.context,d=u.gl;if(!r.dem)return;const f=r.dem;if(u.activeTexture.set(d.TEXTURE1),Or(c,r,f),!r.demTexture)return;r.demTexture.bind(d.NEAREST,d.CLAMP_TO_EDGE);const _=f.dim;u.activeTexture.set(d.TEXTURE0);let y=r.hillshadeFBO;if(!y){const C=new o.T(u,{width:_,height:_,data:null},d.RGBA);C.bind(d.LINEAR,d.CLAMP_TO_EDGE),y=r.hillshadeFBO=u.createFramebuffer(_,_,!0,"renderbuffer"),y.colorAttachment.set(C.texture)}u.bindFramebuffer.set(y.framebuffer),u.viewport.set([0,0,_,_]);const{tileBoundsBuffer:b,tileBoundsIndexBuffer:T,tileBoundsSegments:S}=c.getMercatorTileBoundsBuffers(),A=[];c.linearFloatFilteringSupported()&&A.push("TERRAIN_DEM_FLOAT_FORMAT"),c.getOrCreateProgram("hillshadePrepare",{defines:A}).draw(c,d.TRIANGLES,lt.disabled,yt.disabled,Pt.unblended,ft.disabled,((C,P)=>{const L=P.stride,R=o.a9.create();return o.a9.ortho(R,0,o.Y,-o.Y,0,0,1),o.a9.translate(R,R,[0,-o.Y,0]),{u_matrix:R,u_image:1,u_dimension:[L,L],u_zoom:C.overscaledZ}})(r.tileID,f),s.id,b,T,S),r.needsHillshadePrepare=!1}const Gt=c=>({u_matrix:new o.bN(c),u_image0:new o.bR(c),u_skirt_height:new o.bQ(c),u_ground_shadow_factor:new o.bP(c)}),na=(c,r,s)=>({u_matrix:c,u_image0:0,u_skirt_height:r,u_ground_shadow_factor:s}),to=(c,r,s,u,d,f,_,y,b,T,S,A,C,P,L,R)=>({u_proj_matrix:Float32Array.from(c),u_globe_matrix:r,u_normalize_matrix:Float32Array.from(u),u_merc_matrix:s,u_zoom_transition:d,u_merc_center:f,u_image0:0,u_frustum_tl:_,u_frustum_tr:y,u_frustum_br:b,u_frustum_bl:T,u_globe_pos:S,u_globe_radius:A,u_viewport:C,u_grid_matrix:R?Float32Array.from(R):new Float32Array(9),u_skirt_height:P,u_far_z_cutoff:L});function io(c,r){return c!=null&&r!=null&&!(!c.hasData()||!r.hasData())&&c.demTexture!=null&&r.demTexture!=null&&c.tileID.key!==r.tileID.key}const Ji=new class{constructor(){this.operations={}}newMorphing(c,r,s,u,d){if(c in this.operations){const f=this.operations[c];f.to.tileID.key!==s.tileID.key&&(f.queued=s)}else this.operations[c]={startTime:u,phase:0,duration:d,from:r,to:s,queued:null}}getMorphValuesForProxy(c){if(!(c in this.operations))return null;const r=this.operations[c];return{from:r.from,to:r.to,phase:r.phase}}update(c){for(const r in this.operations){const s=this.operations[r];for(s.phase=(c-s.startTime)/s.duration;s.phase>
vendor: 8,675 bytes, lines 2100-2101
2100=1||!this._validOp(s);)if(!this._nextOp(s,c)){delete this.operations[r];break}}}_nextOp(c,r){return!!c.queued&&(c.from=c.to,c.to=c.queued,c.queued=null,c.phase=0,c.startTime=r,!0)}_validOp(c){return c.from.hasData()&&c.to.hasData()}},Li={0:null,1:"TERRAIN_VERTEX_MORPHING"};function Ch(c,r,s){if(r===0)return 0;const u=r<1&&s===514?.25/r:1;return 6*Math.pow(1.5,22-c)*Math.max(r,1)*u}function sa(c,r){const s=1<<c.z;return!r&&(c.x===0||c.x===s-1)||c.y===0||c.y===s-1}const oa=c=>({u_matrix:c});function bs(c,r,s,u,d){if(d>0){const f=o.f.now(),_=(f-c.timeAdded)/d,y=r?(f-r.timeAdded)/d:-1,b=s.getSource(),T=u.coveringZoomLevel({tileSize:b.tileSize,roundZoom:b.roundZoom}),S=!r||Math.abs(r.tileID.overscaledZ-T)>Math.abs(c.tileID.overscaledZ-T),A=S&&c.refreshedUponExpiration?1:o.ad(S?_:1-y,0,1);return c.refreshedUponExpiration&&_>=1&&(c.refreshedUponExpiration=!1),r?{opacity:1,mix:1-A}:{opacity:A,mix:0}}return{opacity:1,mix:0}}class Zc extends tn{constructor(r){const s={type:"raster-dem",maxzoom:r.transform.maxZoom},u=new o.bZ(o.b_(),null),d=Sc("mock-dem",s,u,r.style);super("mock-dem",d,!1),d.setEventedParent(this),this._sourceLoaded=!0}_loadTile(r,s){r.state="loaded",s(null)}}class Sl extends tn{constructor(r){const s=Sc("proxy",{type:"geojson",maxzoom:r.transform.maxZoom},new o.bZ(o.b_(),null),r.style);super("proxy",s,!1),s.setEventedParent(this),this.map=this.getSource().map=r,this.used=this._sourceLoaded=!0,this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}update(r,s,u){if(r.freezeTileCoverage)return;this.transform=r;const d=r.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}).reduce((f,_)=>{if(f[_.key]="",!this._tiles[_.key]){const y=new en(_,this._source.tileSize*_.overscaleFactor(),r.tileZoom);y.state="loaded",this._tiles[_.key]=y}return f},{});for(const f in this._tiles)f in d||(this.freeFBO(f),this._tiles[f].unloadVectorData(),delete this._tiles[f])}freeFBO(r){const s=this.proxyCachedFBO[r];if(s!==void 0){const u=Object.values(s);this.renderCachePool.push(...u),delete this.proxyCachedFBO[r]}}deallocRenderCache(){this.renderCache.forEach(r=>r.fb.destroy()),this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}}class sr extends o.ap{constructor(r,s,u){super(r.overscaledZ,r.wrap,r.canonical.z,r.canonical.x,r.canonical.y),this.proxyTileKey=s,this.projMatrix=u}}class Br extends o.cp{constructor(r,s){super(),this._debugParams={sortTilesHiZFirst:!0,disableRenderCache:!1},r.tp.registerParameter(this._debugParams,["Terrain"],"sortTilesHiZFirst",{},()=>{this._style.map.triggerRepaint()}),r.tp.registerParameter(this._debugParams,["Terrain"],"disableRenderCache",{},()=>{this._style.map.triggerRepaint()}),r.tp.registerButton(["Terrain"],"Invalidate Render Cache",()=>{this.invalidateRenderCache=!0,this._style.map.triggerRepaint()}),this.painter=r,this.terrainTileForTile={},this.prevTerrainTileForTile={};const[u,d,f]=function(b){const T=new o.aQ,S=new o.az,A=131;T.reserve(17161),S.reserve(33800);const C=o.Y/128,P=o.Y+C/2,L=P+C;for(let k=-C;k<L;k+=C)for(let O=-C;O<L;O+=C){const N=O<0||O>P||k<0||k>P?24575:0,$=o.ad(Math.round(O),0,o.Y),Z=o.ad(Math.round(k),0,o.Y);T.emplaceBack($+N,Z)}const R=(k,O)=>{const N=O*A+k;S.emplaceBack(N+1,N,N+A),S.emplaceBack(N+A,N+A+1,N+1)};for(let k=1;k<129;k++)for(let O=1;O<129;O++)R(O,k);return[0,129].forEach(k=>{for(let O=0;O<130;O++)R(O,k),R(k,O)}),[T,S,32768]}(),_=r.context;this.gridBuffer=_.createVertexBuffer(u,o.aS.members),this.gridIndexBuffer=_.createIndexBuffer(d),this.gridSegments=o.aE.simpleSegment(0,0,u.length,d.length),this.gridNoSkirtSegments=o.aE.simpleSegment(0,0,u.length,f),this.proxyCoords=[],this.proxiedCoords={},this._visibleDemTiles=[],this._drapedRenderBatches=[],this._sourceTilesOverlap={},this.proxySourceCache=new Sl(s.map),this.orthoMatrix=o.a9.create(),o.a9.ortho(this.orthoMatrix,this.painter.transform.projection.name==="globe"?.015:0,o.Y,0,o.Y,0,1);const y=_.gl;this._overlapStencilMode=new yt({func:y.GEQUAL,mask:255},0,255,y.KEEP,y.KEEP,y.REPLACE),this._previousZoom=r.transform.zoom,this.pool=[],this._findCoveringTileCache={},this._tilesDirty={},this.style=s,this._useVertexMorphing=!0,this._exaggeration=1,this._mockSourceCache=new Zc(s.map),this._pendingGroundEffectLayers=[]}set style(r){r.on("data",this._onStyleDataEvent.bind(this)),this._style=r,this._style.map.on("moveend",()=>{this._clearLineLayersFromRenderCache()})}update(r,s,u){if(r&&r.terrain){this._style!==r&&(this.style=r,this._evaluationZoom=void 0);const d=r.terrain.properties,f=r.terrain.drapeRenderMode===0,_=r.terrain.isZoomDependent();this._previousUpdateTimestamp=this.enabled?this._updateTimestamp:void 0,this._updateTimestamp=o.f.now();const y=r.terrain&&r.terrain.scope,b=d.get("source"),T=f?this._mockSourceCache:r.getSourceCache(b,y);if(!T)return void o.w(`Couldn't find terrain source "${b}".`);if(this.sourceCache=T,this._exaggeration=_?this.calculateExaggeration(s):d.get("exaggeration"),!s.projection.requiresDraping&&_&&this._exaggeration===0)return void this._disable();this.enabled=!0;const S=()=>{this.sourceCache.used&&o.w(`Raster DEM source '${this.sourceCache.id}' is used both for terrain and as layer source.
2101This leads to lower resolution of hillshade. For full hillshade resolution but higher memory consumption, define another raster DEM source.`);const A=this.getScaledDemTileSize();this.sourceCache.update(s,A,!0),this.resetTileLookupCache(this.sourceCache.id)};this.sourceCache.usedForTerrain||(this.resetTileLookupCache(this.sourceCache.id),this.sourceCache.usedForTerrain=!0,S(),this._initializing=!0),S(),s.updateElevation(!0,u),this.resetTileLookupCache(this.proxySourceCache.id),this.proxySourceCache.update(s),this._emptyDEMTextureDirty=!0,this._previousZoom=s.zoom}else this._disable()}calculateExaggeration(r){const s=this._previousCameraAltitude,u=r.getFreeCameraOptions().position.z/r.pixelsPerMeter*r.worldSize;this._previousCameraAltitude=u;const d=s!=null?u-s:Number.MAX_VALUE;if(Math.abs(d)<2)return this._exaggeration;const f=r.zoom,_=this._style.terrain;if(!this._previousUpdateTimestamp)return _.getExaggeration(f);let y=f-this._previousZoom;const b=this._previousUpdateTimestamp;let T=f;this._evaluationZoom!=null&&(T=this._evaluationZoom,Math.abs(f-T)>.5&&(y=.5*(f-T+y)),y*d<0&&(T+=y)),this._evaluationZoom=T;const S=_.getExaggeration(T),A=S===_.getExaggeration(Math.max(0,T-.1));if(A&&Math.abs(S-this._exaggeration)<.01)return S;let C=Math.min(.1,.00375*(this._updateTimestamp-b));return(A||S<.1||Math.abs(y)<1e-4)&&(C=Math.min(.2,4*C)),o.X(this._exaggeration,S,C)}resetTileLookupCache(r){this._findCoveringTileCache[r]={}}getScaledDemTileSize(){return this.sourceCache.getSource().tileSize/128*this.proxySourceCache.getSource().tileSize}_onStyleDataEvent(r){r.coord&&r.dataType==="source"?this._clearRenderCacheForTile(r.sourceCacheId,r.coord):r.dataType==="style"&&(this.invalidateRenderCache=!0,this._evaluationZoom=void 0,this._previousUpdateTimestamp=void 0,this._previousCameraAltitude=void 0)}_disable(){if(this.enabled&&(this.enabled=!1,this._sharedDepthStencil=void 0,this._evaluationZoom=void 0,this._previousUpdateTimestamp=void 0,this.proxySourceCache.deallocRenderCache(),this._style))for(const r in this._style._mergedSourceCaches)this._style._mergedSourceCaches[r].usedForTerrain=!1}destroy(){this._disable(),this._emptyDEMTexture&&this._emptyDEMTexture.destroy(),this._emptyDepthBufferTexture&&this._emptyDepthBufferTexture.destroy(),this.pool.forEach(r=>r.fb.destroy()),this.pool=[],this._depthFBO&&(this._depthFBO.destroy(),this._depthFBO=void 0,this._depthTexture=void 0),this.framebufferCopyTexture&&this.framebufferCopyTexture.destroy()}_source(){return this.enabled?this.sourceCache:null}isUsingMockSource(){return this.sourceCache===this._mockSourceCache}exaggeration(){return this._exaggeration}get visibleDemTiles(){return this._visibleDemTiles}get drapeBufferSize(){const r=2*this.proxySourceCache.getSource().tileSize;return[r,r]}set useVertexMorphing(r){this._useVertexMorphing=r}updateTileBinding(r){if(!this.enabled)return;this.prevTerrainTileForTile=this.terrainTileForTile;const s=this.proxySourceCache,u=this.painter.transform;this._initializing&&(this._initializing=u._centerAltitude===0&&this.getAtPointOrZero(o.O.fromLngLat(u.center),-1)===-1,this._emptyDEMTextureDirty=!this._initializing);const d=this.proxyCoords=s.getIds().map(b=>{const T=s.getTileByID(b).tileID;return T.projMatrix=u.calculateProjMatrix(T.toUnwrapped()),T});(function(b,T){const S=T.transform.pointCoordinate(T.transform.getCameraPoint()),A=new o.P(S.x,S.y);b.sort((C,P)=>
2101{if(P.overscaledZ-C.overscaledZ)return P.overscaledZ-C.overscaledZ;const L=new o.P(C.canonical.x+(1<<C.canonical.z)*C.wrap,C.canonical.y),R=new o.P(P.canonical.x+(1<<P.canonical.z)*P.wrap,P.canonical.y),k=A.mult(1<<C.canonical.z);return k.x-=.5,k.y-=.5,k.distSqr(L)-k.distSqr(R)})})(d,this.painter);const f=this.proxyToSource||{};this.proxyToSource={},d.forEach(b=>{this.proxyToSource[b.key]={}}),this.terrainTileForTile={};const _=this._style._mergedSourceCaches;for(const b in _){const T=_[b];if(!T.used||(T!==this.sourceCache&&this.resetTileLookupCache(T.id),this._setupProxiedCoordsForOrtho(T,r[b],f),T.usedForTerrain))continue;const S=r[b];T.getSource().reparseOverscaled&&this._assignTerrainTiles(S)}this.proxiedCoords[s.id]=d.map(b=>new sr(b,b.key,this.orthoMatrix)),this._assignTerrainTiles(d),this._prepareDEMTextures(),this._setupDrapedRenderBatches(),this._initFBOPool(),this._setupRenderCache(f),this.renderingToTexture=!1;const y={};this._visibleDemTiles=[];for(const b of this.proxyCoords){const T=this.terrainTileForTile[b.key];if(!T)continue;const S=T.tileID.key;S in y||(this._visibleDemTiles.push(T),y[S]=S)}}_assignTerrainTiles(r){this._initializing||r.forEach(s=>{if(this.terrainTileForTile[s.key])return;const u=this._findTileCoveringTileID(s,this.sourceCache);u&&(this.terrainTileForTile[s.key]=u)})}_prepareDEMTextures(){const r=this.painter.context,s=r.gl;for(const u in this.terrainTileForTile){const d=this.terrainTileForTile[u],f=d.dem;!f||d.demTexture&&!d.needsDEMTextureUpload||(r.activeTexture.set(s.TEXTURE1),Or(this.painter,d,f))}}_prepareDemTileUniforms(r,s,u,d){if(!s||s.demTexture==null)return!1;const f=r.tileID.canonical,_=Math.pow(2,s.tileID.canonical.z-f.z),y=d||"";return u[`u_dem_tl${y}`]=[f.x*_%1,f.y*_%1],u[`u_dem_scale${y}`]=_,!0}get emptyDEMTexture(){return!this._emptyDEMTextureDirty&&this._emptyDEMTexture?this._emptyDEMTexture:this._updateEmptyDEMTexture()}get emptyDepthBufferTexture(){const r=this.painter.context,s=r.gl;if(!this._emptyDepthBufferTexture){const u=new o.h({width:1,height:1},Uint8Array.of(255,255,255,255));this._emptyDepthBufferTexture=new o.T(r,u,s.RGBA,{premultiply:!1})}return this._emptyDepthBufferTexture}_getLoadedAreaMinimum(){let r=0;const s=this._visibleDemTiles.reduce((u,d)=>{if(!d.dem)return u;const f=d.dem.tree.minimums[0];return f>0&&r++,u+f},0);return r?s/r:0}_updateEmptyDEMTexture(){const r=this.painter.context,s=r.gl;r.activeTexture.set(s.TEXTURE2);const u=this._getLoadedAreaMinimum(),[d,f]=(()=>{const y=new o.cr({width:1,height:1},new Float32Array([u]));return[s.R32F,y]})();this._emptyDEMTextureDirty=!1;let _=this._emptyDEMTexture;return _?_.update(f,{premultiply:!1}):_=this._emptyDEMTexture=new o.T(r,f,d,{premultiply:!1}),_}setupElevationDraw(r,s,u){const d=this.painter.context,f=d.gl,_={u_dem:2,u_dem_prev:4,u_dem_tl:[0,0],u_dem_tl_prev:[0,0],u_dem_scale:0,u_dem_scale_prev:0,u_dem_size:0,u_dem_lerp:1,u_depth:3,u_depth_size_inv:[0,0],u_exaggeration:0};_.u_exaggeration=this.exaggeration();let y=null,b=null,T=1;if(u&&u.morphing&&this._useVertexMorphing){const C=u.morphing.srcDemTile,P=u.morphing.dstDemTile;T=u.morphing.phase,C&&P&&(this._prepareDemTileUniforms(r,C,_,"_prev")&&(b=C),this._prepareDemTileUniforms(r,P,_)&&(y=P))}const S=C=>C&&C.demTexture&&this.painter.linearFloatFilteringSupported()?f.LINEAR:f.NEAREST,A=C=>{_.u_dem_size=C.size[0]===1?1:C.size[0]-2};if(b&&y)d.activeTexture.set(f.TEXTURE2),y.demTexture.bind(S(y),f.CLAMP_TO_EDGE),d.activeTexture.set(f.TEXTURE4),b.demTexture.bind(S(b),f.CLAMP_TO_EDGE),y.demTexture&&A(y.demTexture),_.u_dem_lerp=T;else{y=this.terrainTileForTile[r.tileID.key],d.activeTexture.set(f.TEXTURE2);const C=this._prepareDemTileUniforms(r,y,_)?y.demTexture:this.emptyDEMTexture;C.bind(S(y),f.CLAMP_TO_EDGE),A(C)}if(d.activeTexture.set(f.TEXTURE3),u&&u.useDepthForOcclusion?(this._depthTexture&&this._depthTexture.bind(f.NEAREST,f.CLAMP_TO_EDGE),this._depthFBO&&(_.u_depth_size_inv=[1/this._depthFBO.width,1/this._depthFBO.height])):(this.emptyDepthBufferTexture.bind(f.NEAREST,f.CLAMP_TO_EDGE),_.u_depth_size_inv=[1,1]),u&&u.useMeterToDem&&y){const C=(1<<y.tileID.canonical.z)*o.bo(1,this.painter.transform.center.lat)*this.sourceCache.getSource().tileSize;_.u_meter_to_dem=C}
vendor: 16,883 bytes, line 2101
2101if(u&&u.labelPlaneMatrixInv&&(_.u_label_plane_matrix_inv=u.labelPlaneMatrixInv),s.setTerrainUniformValues(d,_),this.painter.transform.projection.name==="globe"){const C=this.globeUniformValues(this.painter.transform,r.tileID.canonical,u&&u.useDenormalizedUpVectorScale);s.setGlobeUniformValues(d,C)}}globeUniformValues(r,s,u){const d=r.projection;return{u_tile_tl_up:d.upVector(s,0,0),u_tile_tr_up:d.upVector(s,o.Y,0),u_tile_br_up:d.upVector(s,o.Y,o.Y),u_tile_bl_up:d.upVector(s,0,o.Y),u_tile_up_scale:u?o.cq(1):d.upVectorScale(s,r.center.lat,r.worldSize).metersToTile}}renderToBackBuffer(r){const s=this.painter,u=this.painter.context;r.length!==0&&(u.bindFramebuffer.set(null),u.viewport.set([0,0,s.width,s.height]),s.gpuTimingDeferredRenderStart(),this.renderingToTexture=!1,function(d,f,_,y,b){if(d.transform.projection.name==="globe")(function(T,S,A,C,P){const L=T.context,R=L.gl;let k,O;const N=T.transform,$=o.ci(T,L,N),Z=(ce,pe)=>{if(O===pe)return;const te=[Li[pe],"PROJECTION_GLOBE_VIEW"];$&&te.push("CUSTOM_ANTIALIASING");const ae=T.isTileAffectedByFog(ce);k=T.getOrCreateProgram("globeRaster",{defines:te,overrideFog:ae}),O=pe},Q=T.colorModeForRenderPass(),B=new lt(R.LEQUAL,lt.ReadWrite,T.depthRangeFor3D);Ji.update(P);const U=o.cj(N),K=[o.a8(N.center.lng),o.ah(N.center.lat)],Y=T.globeSharedBuffers,re=[N.width*o.f.devicePixelRatio,N.height*o.f.devicePixelRatio],he=Float32Array.from(N.globeMatrix),ie={useDenormalizedUpVectorScale:!0};{const ce=T.transform,pe=Ch(ce.zoom,S.exaggeration(),S.sourceCache._source.tileSize);O=-1;const te=R.TRIANGLES;for(const ae of C){const Me=A.getTile(ae),se=yt.disabled,ue=S.prevTerrainTileForTile[ae.key],de=S.terrainTileForTile[ae.key];io(ue,de)&&Ji.newMorphing(ae.key,ue,de,P,250),L.activeTexture.set(R.TEXTURE0),Me.texture&&Me.texture.bind(R.LINEAR,R.CLAMP_TO_EDGE);const W=Ji.getMorphValuesForProxy(ae.key),xe=W?1:0;W&&o.k(ie,{morphing:{srcDemTile:W.from,dstDemTile:W.to,phase:o.ch(W.phase)}});const Ge=o.ck(ae.canonical),Xe=o.cl(Ge.getCenter().lat),nt=o.cm(ae.canonical,Ge,Xe,ce.worldSize/ce._pixelsPerMercatorPixel),et=o.aW(o.cn(ae.canonical)),at=to(ce.expandedFarZProjMatrix,he,U,et,o.W(ce.zoom),K,ce.frustumCorners.TL,ce.frustumCorners.TR,ce.frustumCorners.BR,ce.frustumCorners.BL,ce.globeCenterInViewSpace,ce.globeRadius,re,pe,ce._farZ,nt);if(Z(ae,xe),k&&(S.setupElevationDraw(Me,k,ie),T.uploadCommonUniforms(L,k,ae.toUnwrapped()),Y)){const[Ot,gt,Vt]=Y.getGridBuffers(Xe,pe!==0);k.draw(T,te,B,se,Q,ft.backCCW,at,"globe_raster",Ot,gt,Vt)}}}if(Y&&(T.renderDefaultNorthPole||T.renderDefaultSouthPole)){const ce=["GLOBE_POLES","PROJECTION_GLOBE_VIEW"];$&&ce.push("CUSTOM_ANTIALIASING"),k=T.getOrCreateProgram("globeRaster",{defines:ce});for(const pe of C){const{x:te,y:ae,z:Me}=pe.canonical,se=ae===0,ue=ae===(1<<Me)-1,[de,W,xe,Ge]=Y.getPoleBuffers(Me,!1);if(Ge&&(se||ue)){const Xe=A.getTile(pe);L.activeTexture.set(R.TEXTURE0),Xe.texture&&Xe.texture.bind(R.LINEAR,R.CLAMP_TO_EDGE);let nt=o.co(Me,te,N);const et=o.aW(o.cn(pe.canonical)),at=(Ot,gt)=>Ot.draw(T,R.TRIANGLES,B,yt.disabled,Q,ft.disabled,to(N.expandedFarZProjMatrix,nt,nt,et,0,K,N.frustumCorners.TL,N.frustumCorners.TR,N.frustumCorners.BR,N.frustumCorners.BL,N.globeCenterInViewSpace,N.globeRadius,re,0,N._farZ),"globe_pole_raster",gt,xe,Ge);S.setupElevationDraw(Xe,k,ie),T.uploadCommonUniforms(L,k,pe.toUnwrapped()),se&&T.renderDefaultNorthPole&&at(k,de),ue&&T.renderDefaultSouthPole&&(nt=o.a9.scale(o.a9.create(),nt,[1,-1,1]),at(k,W))}}}})(d,f,_,y,b);else{const T=d.context,S=T.gl;let A,C;const P=d.shadowRenderer,L=Yn(d,d.longestCutoffRange),R=Q=>{if(C===Q)return;const B=[];B.push(Li[Q]),L.shouldRenderCutoff&&B.push("RENDER_CUTOFF"),A=d.getOrCreateProgram("terrainRaster",{defines:B}),C=Q},k=d.colorModeForRenderPass(),O=new lt(S.LEQUAL,lt.ReadWrite,d.depthRangeFor3D);Ji.update(b);const N=d.transform,$=Ch(N.zoom,f.exaggeration(),f.sourceCache._source.tileSize);let Z=[0,0,0];if(P){const Q=d.style.directionalLight,B=d.style.ambientLight;Q&&B&&(Z=Vc(Q,B))}{C=-1;const Q=S.TRIANGLES,[B,U]=[f.gridIndexBuffer,f.gridSegments];for(const K of y){const Y=_.getTile(K),re=yt.disabled,he=f.prevTerrainTileForTile[K.key],ie=f.terrainTileForTile[K.key];io(he,ie)&&Ji.newMorphing(K.key,he,ie,b,250),T.activeTexture.set(S.TEXTURE0),Y.texture&&Y.texture.bind(S.LINEAR,S.CLAMP_TO_EDGE);const ce=Ji.getMorphValuesForProxy(K.key),pe=ce?1:0;let te;ce&&(te={morphing:{srcDemTile:ce.from,dstDemTile:ce.to,phase:o.ch(ce.phase)}});const ae=na(K.projMatrix,sa(K.canonical,N.renderWorldCopies)?$/10:$,Z);if(R(pe),!A)continue;f.setupElevationDraw(Y,A,te);const Me=K.toUnwrapped();P&&P.setupShadows(Me,A),d.uploadCommonUniforms(T,A,Me,null,L),A.draw(d,Q,O,re,k,ft.backCCW,ae,"terrain_raster",f.gridBuffer,B,U)}}}}(s,this,this.proxySourceCache,r,this._updateTimestamp),this.renderingToTexture=!0,s.gpuTimingDeferredRenderEnd(),r.splice(0,r.length))}renderBatch(r){if(this._drapedRenderBatches.length===0)return r+1;this.renderingToTexture=!0;const s=this.painter,u=this.painter.context,d=this.proxySourceCache,f=this.proxiedCoords[d.id],_=this._drapedRenderBatches.shift(),y=s.style.order,b=[];let T=0;for(const S of f){const A=d.getTileByID(S.proxyTileKey),C=d.proxyCachedFBO[S.key]?d.proxyCachedFBO[S.key][r]:void 0,P=C!==void 0?d.renderCache[C]:this.pool[T++],L=C!==void 0;if(A.texture=P.tex,L&&!P.dirty){b.push(A.tileID);continue}let R;u.bindFramebuffer.set(P.fb.framebuffer),this.renderedToTile=!1,P.dirty&&(u.clear({color:o.aA.transparent,stencil:0}),P.dirty=!1);for(let k=_.start;k<=_.end;++k){const O=s.style._mergedLayers[y[k]];if(O.isHidden(s.transform.zoom))continue;const N=s.style.getLayerSourceCache(O),$=N?this.proxyToSource[S.key][N.id]:[S];if(!$)continue;const Z=$;u.viewport.set([0,0,P.fb.width,P.fb.height]),R!==(N?N.id:null)&&(this._setupStencil(P,$,O,N),R=N?N.id:null),s.renderLayer(s,N,O,Z)}if(this._drapedRenderBatches.length===0)for(const k of this._pendingGroundEffectLayers){const O=s.style._mergedLayers[y[k]];if(O.isHidden(s.transform.zoom))continue;const N=s.style.getLayerSourceCache(O),$=N?this.proxyToSource[S.key][N.id]:[S];if(!$)continue;const Z=$;u.viewport.set([0,0,P.fb.width,P.fb.height]),R!==(N?N.id:null)&&(this._setupStencil(P,$,O,N),R=N?N.id:null),s.renderLayer(s,N,O,Z)}this.renderedToTile?(P.dirty=!0,b.push(A.tileID)):L||--T,T===5&&(T=0,this.renderToBackBuffer(b))}return this.renderToBackBuffer(b),this.renderingToTexture=!1,u.bindFramebuffer.set(null),u.viewport.set([0,0,s.width,s.height]),_.end+1}postRender(){}isLayerOrderingCorrect(r){const s=r.order.length;let u=-1,d=s;for(let f=0;f<s;++f)this._style.isLayerDraped(r._mergedLayers[r.order[f]])?u=Math.max(u,f):d=Math.min(d,f);return d>u}getMinElevationBelowMSL(){let r=0;return this._visibleDemTiles.filter(s=>s.dem).forEach(s=>{r=Math.min(r,s.dem.tree.minimums[0])}),r===0?r:(r-30)*this._exaggeration}raycast(r,s,u){if(!this._visibleDemTiles)return null;const d=this._visibleDemTiles.filter(f=>f.dem).map(f=>{const _=f.tileID,y=1<<_.overscaledZ,{x:b,y:T}=_.canonical,S=b/y,A=(b+1)/y,C=T/y,P=(T+1)/y;return{minx:S,miny:C,maxx:A,maxy:P,t:f.dem.tree.raycastRoot(S,C,A,P,r,s,u),tile:f}});d.sort((f,_)=>(f.t!==null?f.t:Number.MAX_VALUE)-(_.t!==null?_.t:Number.MAX_VALUE));for(const f of d){if(f.t==null)return null;const _=f.tile.dem.tree.raycast(f.minx,f.miny,f.maxx,f.maxy,r,s,u);if(_!=null)return _}return null}_createFBO(){const r=this.painter.context,s=r.gl,u=this.drapeBufferSize;r.activeTexture.set(s.TEXTURE0);const d=new o.T(r,{width:u[0],height:u[1],data:null},s.RGBA);d.bind(s.LINEAR,s.CLAMP_TO_EDGE);const f=r.createFramebuffer(u[0],u[1],!0,null);return f.colorAttachment.set(d.texture),f.depthAttachment=new pp(r,f.framebuffer),this._sharedDepthStencil===void 0?(this._sharedDepthStencil=r.createRenderbuffer(r.gl.DEPTH_STENCIL,u[0],u[1]),this._stencilRef=0,f.depthAttachment.set(this._sharedDepthStencil),r.clear({stencil:0})):f.depthAttachment.set(this._sharedDepthStencil),r.extTextureFilterAnisotropic&&s.texParameterf(s.TEXTURE_2D,r.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,r.extTextureFilterAnisotropicMax),{fb:f,tex:d,dirty:!1}}_initFBOPool(){for(;this.pool.length<Math.min(5,this.proxyCoords.length);)this.pool.push(this._createFBO())}_shouldDisableRenderCache(){if(this._debugParams.disableRenderCache||this._style.hasLightTransitions())return!0;for(const r in this._style._mergedSourceCaches)if(this._style._mergedSourceCaches[r].hasTransition())return!0;return this._style.order.some(r=>{const s=this._style._mergedLayers[r],u=s.isHidden(this.painter.transform.zoom);return s.type==="custom"?!u&&s.shouldRedrape():!u&&s.hasTransition()})}_clearLineLayersFromRenderCache(){let r=!1;for(const u of this._style.getSources())if(u instanceof Ue){r=!0;break}if(!r)return;const s={};for(let u=0;u<this._style.order.length;++u){const d=this._style._mergedLayers[this._style.order[u]],f=this._style.getLayerSourceCache(d);if(f&&!s[f.id]&&!d.isHidden(this.painter.transform.zoom)&&d.type==="line"&&d.widthExpression()instanceof o.Z){s[f.id]=!0;for(const _ of this.proxyCoords){const y=this.proxyToSource[_.key][f.id];if(y)for(const b of y)this._clearRenderCacheForTile(f.id,b)}}}}_clearRasterLayersFromRenderCache(){let r=!1;for(const u in this._style._mergedSourceCaches)if(this._style._mergedSourceCaches[u]._source instanceof je){r=!0;break}if(!r)return;const s={};for(let u=0;u<this._style.order.length;++u){const d=this._style._mergedLayers[this._style.order[u]],f=this._style.getLayerSourceCache(d);if(!f||s[f.id]||d.isHidden(this.painter.transform.zoom)||d.type!=="raster")continue;const _=d.paint.get("raster-fade-duration");for(const y of this.proxyCoords){const b=this.proxyToSource[y.key][f.id];if(b)for(const T of b){const S=bs(f.getTile(T),f.findLoadedParent(T,0),f,this.painter.transform,_);(S.opacity!==1||S.mix!==0)&&this._clearRenderCacheForTile(f.id,T)}}}}_setupDrapedRenderBatches(){const r=this._style.order,s=r.length;if(s===0)return;const u=[];this._pendingGroundEffectLayers=[];let d,f=0,_=this._style._mergedLayers[r[f]];for(;!this._style.isLayerDraped(_)&&_.isHidden(this.painter.transform.zoom)&&++f<s;)_=this._style._mergedLayers[r[f]];for(;f<s;++f){const y=this._style._mergedLayers[r[f]];y.isHidden(this.painter.transform.zoom)||(this._style.isLayerDraped(y)?d===void 0&&(d=f):(y.type==="fill-extrusion"&&this._pendingGroundEffectLayers.push(f),d!==void 0&&(u.push({start:d,end:f-1}),d=void 0)))}if(d!==void 0&&u.push({start:d,end:f-1}),u.length!==0){const y=u[u.length-1];this._pendingGroundEffectLayers.every(b=>b>y.end)||o.w("fill-extrusion with flood lighting and/or ground ambient occlusion should be moved to be on top of all draped layers.")}this._drapedRenderBatches=u}_setupRenderCache(r){const s=this.proxySourceCache;if(this._shouldDisableRenderCache()||this.invalidateRenderCache){if(this.invalidateRenderCache=!1,s.renderCache.length>s.renderCachePool.length){const _=Object.values(s.proxyCachedFBO);s.proxyCachedFBO={};for(let y=0;y<_.length;++y){const b=Object.values(_[y]);s.renderCachePool.push(...b)}}return}this._clearRasterLayersFromRenderCache();const u=this.proxyCoords,d=this._tilesDirty;for(let _=u.length-1;_>=0;_--){const y=u[_];if(s.getTileByID(y.key),s.proxyCachedFBO[y.key]!==void 0){const b=r[y.key],T=this.proxyToSource[y.key];let S=0;for(const A in T){const C=T[A],P=b[A];if(!P||P.length!==C.length||C.some((L,R)=>L!==P[R]||d[A]&&d[A].hasOwnProperty(L.key))){S=-1;break}++S}for(const A in s.proxyCachedFBO[y.key])s.renderCache[s.proxyCachedFBO[y.key][A]].dirty=S<0||S!==Object.values(b).length}}const f=[...this._drapedRenderBatches];f.sort((_,y)=>y.end-y.start-(_.end-_.start));for(const _ of f)for(const y of u){if(s.proxyCachedFBO[y.key])continue;let b=s.renderCachePool.pop();b===void 0&&s.renderCache.length<50&&(b=s.renderCache.length,s.renderCache.push(this._createFBO())),b!==void 0&&(s.proxyCachedFBO[y.key]={},s.proxyCachedFBO[y.key][_.start]=b,s.renderCache[b].dirty=!0)}this._tilesDirty={}}_setupStencil(r,s,u,d){if(!d||!this._sourceTilesOverlap[d.id])return void(this._overlapStencilType&&(this._overlapStencilType=!1));const f=this.painter.context,_=f.gl;if(s.length<=1)return void(this._overlapStencilType=!1);let y;if(u.isTileClipped())y=s.length,this._overlapStencilMode.test={func:_.EQUAL,mask:255},this._overlapStencilType="Clip";else{if(!(s[0].overscaledZ>s[s.length-1].overscaledZ))return void(this._overlapStencilType=!1);y=1,this._overlapStencilMode.test={func:_.GREATER,mask:255},this._overlapStencilType="Mask"}this._stencilRef+y>255&&(f.clear({stencil:0}),this._stencilRef=0),this._stencilRef+=y,this._overlapStencilMode.ref=this._stencilRef,u.isTileClipped()&&this._renderTileClippingMasks(s,this._overlapStencilMode.ref)}clipOrMaskOverlapStencilType(){return this._overlapStencilType==="Clip"||this._overlapStencilType==="Mask"}stencilModeForRTTOverlap(r){return this.renderingToTexture&&this._overlapStencilType?(this._overlapStencilType==="Clip"&&(this._overlapStencilMode.ref=this.painter._tileClippingMaskIDs[r.key]),this._overlapStencilMode):yt.disabled}_renderTileClippingMasks(r,s){const u=this.painter,d=this.painter.context,f=d.gl;u._tileClippingMaskIDs={},d.setColorMode(Pt.disabled),d.setDepthMode(lt.disabled);const _=u.getOrCreateProgram("clippingMask");for(const y of r){const b=u._tileClippingMaskIDs[y.key]=--s;_.draw(u,f.TRIANGLES,lt.disabled,new yt({func:f.ALWAYS,mask:0},b,255,f.KEEP,f.KEEP,f.REPLACE),Pt.disabled,ft.disabled,oa(y.projMatrix),"$clipping",u.tileExtentBuffer,u.quadTriangleIndexBuffer,u.tileExtentSegments)}}pointCoordinate(r){const s=this.painter.transform;if(r.x<0||r.x>s.width||r.y<0||r.y>s.height)return null;const u=[r.x,r.y,1,1];o.aa.transformMat4(u,u,s.pixelMatrixInverse),o.aa.scale(u,u,1/u[3]),u[0]/=s.worldSize,u[1]/=s.worldSize;const d=s._camera.position,f=o.bo(1,s.center.lat),_=[d[0],d[1],d[2]/f,0],y=o.Q.subtract([],u.slice(0,3),_);o.Q.normalize(y,y);const b=this.raycast(_,y,this._exaggeration);return b!==null&&b?(o.Q.scaleAndAdd(_,_,y,b),_[3]=_[2],_[2]*=f,_):null}drawDepth(){const r=this.painter,s=r.context,u=this.proxySourceCache,d=Math.ceil(r.width),f=Math.ceil(r.height);if(!this._depthFBO||this._depthFBO.width===d&&this._depthFBO.height===f||(this._depthFBO.destroy(),this._depthFBO=void 0,this._depthTexture=void 0),!this._depthFBO){const _=s.gl,y=s.createFramebuffer(d,f,!0,"renderbuffer");s.activeTexture.set(_.TEXTURE0);const b=new o.T(s,{width:d,height:f,data:null},_.RGBA);b.bind(_.NEAREST,_.CLAMP_TO_EDGE),y.colorAttachment.set(b.texture);const T=s.createRenderbuffer(s.gl.DEPTH_COMPONENT16,d,f);y.depthAttachment.set(T),this._depthFBO=y,this._depthTexture=b}s.bindFramebuffer.set(this._depthFBO.framebuffer),s.viewport.set([0,0,d,f]),function(_,y,b,T){if(_.transform.projection.name==="globe")return;const S=_.context,A=S.gl;S.clear({depth:1});const C=_.getOrCreateProgram("terrainDepth"),P=new lt(A.LESS,lt.ReadWrite,_.depthRangeFor3D);for(const L of T){const R=b.getTile(L),k=na(L.projMatrix,0,[0,0,0]);y.setupElevationDraw(R,C),C.draw(_,A.TRIANGLES,P,yt.disabled,Pt.unblended,ft.backCCW,k,"terrain_depth",y.gridBuffer,y.gridIndexBuffer,y.gridNoSkirtSegments)}}(r,this,u,this.proxyCoords)}_setupProxiedCoordsForOrtho(r,s,u){if(r.getSource()instanceof o.as)return this._setupProxiedCoordsForImageSource(r,s,u);this._findCoveringTileCache[r.id]=this._findCoveringTileCache[r.id]||{};const d=this.proxiedCoords[r.id]=[],f=this.proxyCoords;for(let b=0;b<f.length;b++){const T=f[b],S=this._findTileCoveringTileID(T,r);if(S){const A=this._createProxiedId(T,S,u[T.key]&&u[T.key][r.id]);d.push(A),this.proxyToSource[T.key][r.id]=[A]}}let _=!1;const y=new Set;for(let b=0;b<s.length;b++){const T=r.getTile(s[b]);if(!T||!T.hasData())continue;const S=this._findTileCoveringTileID(T.tileID,this.proxySourceCache);if(S&&S.tileID.canonical.z!==T.tileID.canonical.z){const A=this.proxyToSource[S.tileID.key][r.id],C=this._createProxiedId(S.tileID,T,u[S.tileID.key]&&u[S.tileID.key][r.id]);A?A.splice(A.length-1,0,C):this.proxyToSource[S.tileID.key][r.id]=[C];const P=this.proxyToSource[S.tileID.key][r.id];y.has(P)||y.add(P),d.push(C),_=!0}}if(this._sourceTilesOverlap[r.id]=_,_&&this._debugParams.sortTilesHiZFirst)for(const b of y)b.sort((T,S)=>S.overscaledZ-T.overscaledZ)}_setupProxiedCoordsForImageSource(r,s,u){if(!r.getSource().loaded())return;const d=this.proxiedCoords[r.id]=[],f=this.proxyCoords,_=r.getSource(),y=_.tileID;if(!y)return;const b=new o.P(y.x,y.y)._div(1<<y.z),T=_.coordinates.map(o.O.fromLngLat).reduce((A,C)=>(A.min.x=Math.min(A.min.x,C.x-b.x),A.min.y=Math.min(A.min.y,C.y-b.y),A.max.x=Math.max(A.max.x,C.x-b.x),A.max.y=Math.max(A.max.y,C.y-b.y),A),{min:new o.P(Number.MAX_VALUE,Number.MAX_VALUE),max:new o.P(-Number.MAX_VALUE,-Number.MAX_VALUE)}),S=(A,C)=>{const P=A.wrap+A.canonical.x/(1<<A.canonical.z),L=A.canonical.y/(1<<A.canonical.z),R=o.Y/(1<<A.canonical.z),k=C.wrap+C.canonical.x/(1<<C.canonical.z),O=C.canonical.y/(1<<C.canonical.z);return P+R<k+T.min.x||P>k+T.max.x||L+R<O+T.min.y||L>
2101O+T.max.y};for(let A=0;A<f.length;A++){const C=f[A];for(let P=0;P<s.length;P++){const L=r.getTile(s[P]);if(!L||!L.hasData()||S(C,L.tileID))continue;const R=this._createProxiedId(C,L,u[C.key]&&u[C.key][r.id]),k=this.proxyToSource[C.key][r.id];k?k.push(R):this.proxyToSource[C.key][r.id]=[R],d.push(R)}}}_createProxiedId(r,s,u){let d=this.orthoMatrix;if(u){const f=u.find(_=>_.key===s.tileID.key);if(f)return f}if(s.tileID.key!==r.key){const f=r.canonical.z-s.tileID.canonical.z;let _,y,b;d=o.a9.create();const T=s.tileID.wrap-r.wrap<<r.overscaledZ;f>0?(_=o.Y>>f,y=_*((s.tileID.canonical.x<<f)-r.canonical.x+T),b=_*((s.tileID.canonical.y<<f)-r.canonical.y)):(_=o.Y<<-f,y=o.Y*(s.tileID.canonical.x-(r.canonical.x+T<<-f)),b=o.Y*(s.tileID.canonical.y-(r.canonical.y<<-f))),o.a9.ortho(d,0,_,0,_,0,1),o.a9.translate(d,d,[y,b,0])}return new sr(s.tileID,r.key,d)}_findTileCoveringTileID(r,s){let u=s.getTile(r);if(u&&u.hasData())return u;const d=this._findCoveringTileCache[s.id],f=d[r.key];if(u=f?s.getTileByID(f):null,u&&u.hasData()||f===null)return u;let _=u?u.tileID:r,y=_.overscaledZ;const b=s.getSource().minzoom,T=[];if(!f){const A=s.getSource().maxzoom;if(r.canonical.z>=A){const C=r.canonical.z-A;s.getSource().reparseOverscaled?(y=Math.max(r.canonical.z+2,s.transform.tileZoom),_=new o.ap(y,r.wrap,A,r.canonical.x>>C,r.canonical.y>>C)):C!==0&&(y=A,_=new o.ap(y,r.wrap,A,r.canonical.x>>C,r.canonical.y>>C))}_.key!==r.key&&(T.push(_.key),u=s.getTile(_))}const S=A=>{T.forEach(C=>{d[C]=A}),T.length=0};for(y-=1;y>=b&&(!u||!u.hasData());y--){u&&S(u.tileID.key);const A=_.calculateScaledKey(y);if(u=s.getTileByID(A),u&&u.hasData())break;const C=d[A];if(C===null)break;C===void 0?T.push(A):u=s.getTileByID(C)}return S(u?u.tileID.key:null),u&&u.hasData()?u:null}findDEMTileFor(r){return this.enabled?this._findTileCoveringTileID(r,this.sourceCache):null}prepareDrawTile(){this.renderedToTile=!0}_clearRenderCacheForTile(r,s){let u=this._tilesDirty[r];u||(u=this._tilesDirty[r]={}),u[s.key]=!0}}function Ph(c,r,s){const u=function(y,b,T){const S=o.Q.dot(b,y),A=o.Q.dot(T,[.2126,.7152,.0722]),C=(L,R,k)=>(1-k)*L+k*R,P=C(1-.3*Math.min(A,1),1,Math.min(S+1,1));return C(.92,1,Math.asin(o.ad(b[2],-1,1))/Math.PI+.5)*P}(c,[0,0,1],r),d=[0,0,0];o.Q.scale(d,s.slice(0,3),u);const f=[0,0,0];o.Q.scale(f,r.slice(0,3),c[2]);const _=[0,0,0];return o.Q.add(_,d,f),o.bX(_)}const ro=["fill","fillOutline","fillPattern","line","linePattern","background","backgroundPattern","hillshade","raster"],Gi=["stars","fillExtrusion","fillExtrusionGroundEffect","model","symbolSDF","symbolIcon","symbolTextAndIcon"];class qr{static cacheKey(r,s,u,d){let f=`${s}${d?d.cacheKey:""}`;for(const _ of u)r.usedDefines.includes(_)&&(f+=`/${_}`);return f}constructor(r,s,u,d,f,_){const y=r.gl;this.program=y.createProgram(),this.configuration=d,this.name=s,this.fixedDefines=[..._];const b=d?d.getBinderAttributes():[],T=(u.staticAttributes||[]).concat(b);let S=d?d.defines():[];S=S.concat(_.map(k=>`#define ${k}`));const A=`#version 300 es
2102`;let C=A+S.concat("precision mediump float;",El,ra.fragmentSource).join(`
2103`);for(const k of u.fragmentIncludes)C+=`
2104${Ct[k]}`;C+=`
2105${u.fragmentSource}`;let P=A+S.concat("precision highp float;",El,ra.vertexSource).join(`
2106`);for(const k of u.vertexIncludes)P+=`
2107${Ct[k]}`;P+=`
2108${u.vertexSource}`;const L=y.createShader(y.FRAGMENT_SHADER);if(y.isContextLost())return void(this.failedToCreate=!0);y.shaderSource(L,C),y.compileShader(L),y.attachShader(this.program,L);const R=y.createShader(y.VERTEX_SHADER);if(y.isContextLost())this.failedToCreate=!0;else{y.shaderSource(R,P),y.compileShader(R),y.attachShader(this.program,R),this.attributes={},this.numAttributes=T.length;for(let k=0;k<this.numAttributes;k++)if(T[k]){const O=T[k].startsWith("a_")?T[k]:`a_${T[k]}`;y.bindAttribLocation(this.program,k,O),this.attributes[O]=k}y.linkProgram(this.program),y.deleteShader(R),y.deleteShader(L),this.fixedUniforms=f(r),this.binderUniforms=d?d.getUniforms(r):[],_.includes("TERRAIN")&&(this.terrainUniforms=(k=>({u_dem:new o.bR(k),u_dem_prev:new o.bR(k),u_dem_tl:new o.bO(k),u_dem_scale:new o.bQ(k),u_dem_tl_prev:new o.bO(k),u_dem_scale_prev:new o.bQ(k),u_dem_size:new o.bQ(k),u_dem_lerp:new o.bQ(k),u_exaggeration:new o.bQ(k),u_depth:new o.bR(k),u_depth_size_inv:new o.bO(k),u_meter_to_dem:new o.bQ(k),u_label_plane_matrix_inv:new o.bN(k)}))(r)),_.includes("GLOBE")&&(this.globeUniforms=(k=>({u_tile_tl_up:new o.bP(k),u_tile_tr_up:new o.bP(k),u_tile_br_up:new o.bP(k),u_tile_bl_up:new o.bP(k),u_tile_up_scale:new o.bQ(k)}))(r)),_.includes("FOG")&&(this.fogUniforms=(k=>({u_fog_matrix:new o.bN(k),u_fog_range:new o.bO(k),u_fog_color:new o.bS(k),u_fog_horizon_blend:new o.bQ(k),u_fog_vertical_limit:new o.bO(k),u_fog_temporal_offset:new o.bQ(k),u_frustum_tl:new o.bP(k),u_frustum_tr:new o.bP(k),u_frustum_br:new o.bP(k),u_frustum_bl:new o.bP(k),u_globe_pos:new o.bP(k),u_globe_radius:new o.bQ(k),u_globe_transition:new o.bQ(k),u_is_globe:new o.bR(k),u_viewport:new o.bO(k)}))(r)),_.includes("RENDER_CUTOFF")&&(this.cutoffUniforms=(k=>({u_cutoff_params:new o.bS(k)}))(r)),_.includes("LIGHTING_3D_MODE")&&(this.lightsUniforms=(k=>({u_lighting_ambient_color:new o.bP(k),u_lighting_directional_dir:new o.bP(k),u_lighting_directional_color:new o.bP(k),u_ground_radiance:new o.bP(k)}))(r)),_.includes("RENDER_SHADOWS")&&(this.shadowUniforms=(k=>({u_light_matrix_0:new o.bN(k),u_light_matrix_1:new o.bN(k),u_fade_range:new o.bO(k),u_shadow_normal_offset:new o.bP(k),u_shadow_intensity:new o.bQ(k),u_shadow_texel_size:new o.bQ(k),u_shadow_map_resolution:new o.bQ(k),u_shadow_direction:new o.bP(k),u_shadow_bias:new o.bP(k),u_shadowmap_0:new o.bR(k),u_shadowmap_1:new o.bR(k)}))(r))}}setTerrainUniformValues(r,s){if(!this.terrainUniforms)return;const u=this.terrainUniforms;if(!this.failedToCreate){r.program.set(this.program);for(const d in s)u[d]&&u[d].set(this.program,d,s[d])}}setGlobeUniformValues(r,s){if(!this.globeUniforms)return;const u=this.globeUniforms;if(!this.failedToCreate){r.program.set(this.program);for(const d in s)u[d]&&u[d].set(this.program,d,s[d])}}setFogUniformValues(r,s){if(!this.fogUniforms)return;const u=this.fogUniforms;if(!this.failedToCreate){r.program.set(this.program);for(const d in s)u[d].set(this.program,d,s[d])}}setCutoffUniformValues(r,s){if(!this.cutoffUniforms)return;const u=this.cutoffUniforms;if(!this.failedToCreate){r.program.set(this.program);for(const d in s)u[d].set(this.program,d,s[d])}}setLightsUniformValues(r,s){if(!this.lightsUniforms)return;const u=this.lightsUniforms;if(!this.failedToCreate){r.program.set(this.program);for(const d in s)u[d].set(this.program,d,s[d])}}setShadowUniformValues(r,s){if(this.failedToCreate||!this.shadowUniforms)return;const u=this.shadowUniforms;r.program.set(this.program);for(const d in s)u[d].set(this.program,d,s[d])}_drawDebugWireframe(r,s,u,d,f,_,y,b,T,S){const A=r.options.wireframe;if(A.terrain===!1&&A.layers2D===!1&&A.layers3D===!1)return;const C=r.context;if(!(!(!A.terrain||this.name!=="terrainRaster"&&this.name!=="globeRaster")||!(!A.layers2D||r._terrain&&r._terrain.renderingToTexture||!ro.includes(this.name))||!(!A.layers3D||!Gi.includes(this.name))))return;const P=C.gl,L=r.wireframeDebugCache.getLinesFromTrianglesBuffer(r.frameCounter,f,C);if(!L)return;const R=[...this.fixedDefines];
2108R.push("DEBUG_WIREFRAME");const k=r.getOrCreateProgram(this.name,{config:this.configuration,defines:R});C.program.set(k.program);const O=(Z,Q,B)=>{if(Q[Z]&&B[Z])for(const U in Q[Z])B[Z][U]&&B[Z][U].set(B.program,U,Q[Z][U].current)};T&&T.setUniforms(k.program,C,k.binderUniforms,y,{zoom:b}),O("fixedUniforms",this,k),O("terrainUniforms",this,k),O("globeUniforms",this,k),O("fogUniforms",this,k),O("lightsUniforms",this,k),O("shadowUniforms",this,k),L.bind(),C.setColorMode(new Pt([P.ONE,P.ONE_MINUS_SRC_ALPHA,P.ZERO,P.ONE],o.aA.transparent,[!0,!0,!0,!1])),C.setDepthMode(new lt(s.func===P.LESS?P.LEQUAL:s.func,lt.ReadOnly,s.range)),C.setStencilMode(yt.disabled);const N=3*_.primitiveLength*2,$=3*_.primitiveOffset*2*2;S&&S>1?P.drawElementsInstanced(P.LINES,N,P.UNSIGNED_SHORT,$,S):P.drawElements(P.LINES,N,P.UNSIGNED_SHORT,$),f.bind(),C.program.set(this.program),C.setDepthMode(s),C.setStencilMode(u),C.setColorMode(d)}draw(r,s,u,d,f,_,y,b,T,S,A,C,P,L,R,k){const O=r.context,N=O.gl;if(this.failedToCreate)return;O.program.set(this.program),O.setDepthMode(u),O.setStencilMode(d),O.setColorMode(f),O.setCullFace(_);for(const Q of Object.keys(this.fixedUniforms))this.fixedUniforms[Q].set(this.program,Q,y[Q]);L&&L.setUniforms(this.program,O,this.binderUniforms,C,{zoom:P});const $={[N.POINTS]:1,[N.LINES]:2,[N.TRIANGLES]:3,[N.LINE_STRIP]:1}[s],Z=k&&k>0?1:void 0;for(const Q of A.get()){const B=Q.vaos||(Q.vaos={});(B[b]||(B[b]=new We)).bind(O,this,T,L?L.getPaintVertexBuffers():[],S,Q.vertexOffset,R||[],Z),k&&k>1?N.drawElementsInstanced(s,Q.primitiveLength*$,N.UNSIGNED_SHORT,Q.primitiveOffset*$*2,k):S?N.drawElements(s,Q.primitiveLength*$,N.UNSIGNED_SHORT,Q.primitiveOffset*$*2):N.drawArrays(s,Q.vertexOffset,Q.vertexLength),s===N.TRIANGLES&&S&&this._drawDebugWireframe(r,u,d,f,S,Q,C,P,L,k)}}}function yn(c,r){const s=Math.pow(2,r.tileID.overscaledZ),u=r.tileSize*Math.pow(2,c.transform.tileZoom)/s,d=u*(r.tileID.canonical.x+r.tileID.wrap*s),f=u*r.tileID.canonical.y;return{u_image:0,u_texsize:r.imageAtlasTexture?r.imageAtlasTexture.size:[0,0],u_tile_units_to_pixels:1/o.a6(r,1,c.transform.tileZoom),u_pixel_coord_upper:[d>>16,f>>16],u_pixel_coord_lower:[65535&d,65535&f]}}const Wi=o.a9.create(),Ml=(c,r,s,u,d,f,_,y,b,T,S,A,C,P,L,R)=>{const k=r.style.light,O=k.properties.get("position"),N=[O.x,O.y,O.z],$=o.ct.create();k.properties.get("anchor")==="viewport"&&(o.ct.fromRotation($,-r.transform.angle),o.Q.transformMat3(N,N,$));const Z=k.properties.get("color"),Q=r.transform,B={u_matrix:c,u_lightpos:N,u_lightintensity:k.properties.get("intensity"),u_lightcolor:[Z.r,Z.g,Z.b],u_vertical_gradient:+s,u_opacity:u,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:Wi,u_merc_center:[0,0],u_up_dir:[0,0,0],u_height_lift:0,u_ao:d,u_edge_radius:f,u_flood_light_color:A,u_vertical_scale:C,u_flood_light_intensity:P,u_ground_shadow_factor:L,u_emissive_strength:R};return Q.projection.name==="globe"&&(B.u_tile_id=[_.canonical.x,_.canonical.y,1<<_.canonical.z],B.u_zoom_transition=b,B.u_inv_rot_matrix=S,B.u_merc_center=T,B.u_up_dir=Q.projection.upVector(new o.bv(0,0,0),T[0]*o.Y,T[1]*o.Y),B.u_height_lift=y),B},an=(c,r,s)=>({u_matrix:c,u_edge_radius:r,u_vertical_scale:s}),aa=(c,r,s,u,d,f,_,y,b,T,S,A,C,P)=>{const L=Ml(c,r,s,u,d,f,_,b,T,S,A,C,P,1,[0,0,0],0),R={u_height_factor:-Math.pow(2,_.overscaledZ)/y.tileSize/8};return o.e(L,yn(r,y),R)},no=(c,r)=>({u_matrix:c,u_emissive_strength:r}),es=(c,r,s,u)=>o.e(no(c,r),yn(s,u)),yp=(c,r,s)=>({u_matrix:c,u_world:s,u_emissive_strength:r}),Rn=(c,r,s,u,d)=>o.e(es(c,r,s,u),{u_world:d}),xp=(c,r,s,u)=>{const d=o.Y/s.tileSize;return{u_matrix:c,u_camera_to_center_distance:r.getCameraToCenterDistance(u),u_extrude_scale:[r.pixelsToGLUnits[0]/d,r.pixelsToGLUnits[1]/d]}},$c=(c,r,s=1)=>({u_matrix:c,u_color:r,u_overlay:0,u_overlay_scale:s}),Sr=o.a9.create(),vp=(c,r,s,u,d,f,_)=>{const y=c.transform,b=y.projection.name==="globe",T=b?o.cu(y.zoom,r.canonical)*y._pixelsPerMercatorPixel:o.a6(s,1,f),S={u_matrix:r.projMatrix,u_extrude_scale:T,u_intensity:_,u_inv_rot_matrix:Sr,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0]};if(b){S.u_inv_rot_matrix=u,S.u_merc_center=d,S.u_tile_id=[r.canonical.x,r.canonical.y,1<<r.canonical.z],S.u_zoom_transition=o.W(y.zoom);const A=d[0]*o.Y,C=d[1]*o.Y;S.u_up_dir=y.projection.upVector(new o.bv(0,0,0),A,C)}return S};function la(c,[r,s,u,d],[f,_]){if(f===_)return[0,0,0,0];const y=255*(c-1)/(c*(_-f));return[r*y,s*y,u*y,d*y]}function Wc(c,r,[s,u]){return s===u?0:.5/c+(r-s)*(c-1)/(c*(u-s))}const zh=(c,r,s,u,d,f,_,y,b,T,S,A,C,P,L,R,k,O,N,$,Z)=>({u_matrix:c,u_normalize_matrix:r,u_globe_matrix:s,u_merc_matrix:u,u_grid_matrix:d,u_tl_parent:f,u_scale_parent:T,u_fade_t:S.mix,u_opacity:S.opacity*A.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:A.paint.get("raster-brightness-min"),u_brightness_high:A.paint.get("raster-brightness-max"),u_saturation_factor:o.cv(A.paint.get("raster-saturation")),u_contrast_factor:o.cw(A.paint.get("raster-contrast")),u_spin_weights:bp(A.paint.get("raster-hue-rotate")),u_perspective_transform:C,u_raster_elevation:P,u_zoom_transition:_,u_merc_center:y,u_cutoff_params:b,u_colorization_mix:la(o.cx,R,O),u_colorization_offset:Wc(o.cx,k,O),u_color_ramp:L,u_texture_offset:[$/(N+2*$),N/(N+2*$)],u_texture_res:[N+2*$,N+2*$],u_emissive_strength:Z});function bp(c){c*=Math.PI/180;const r=Math.sin(c),s=Math.cos(c);return[(2*s+1)/3,(-Math.sqrt(3)*r-s+1)/3,(Math.sqrt(3)*r-s+1)/3]}const ca=(c,r,s,u,d,f,_,y,b,T,S,A)=>({u_matrix:c,u_normalize_matrix:r,u_globe_matrix:s,u_merc_matrix:u,u_grid_matrix:d,u_tl_parent:f,u_scale_parent:T,u_fade_t:S.mix,u_opacity:S.opacity,u_image0:0,u_image1:1,u_raster_elevation:A,u_zoom_transition:_,u_merc_center:y,u_cutoff_params:b}),ua=(c,r,s,u,d,f,_,y,b,T)=>({u_particle_texture:c,u_particle_texture_side_len:r,u_tile_offset:s,u_velocity:u,u_color_ramp:f,u_velocity_res:d,u_max_speed:_,u_uv_offset:y,u_data_scale:b,u_data_offset:T,u_particle_pos_scale:1.3,u_particle_pos_offset:[ms,ms]}),wp=(c,r,s,u,d,f,_,y,b,T)=>({u_particle_texture:c,u_particle_texture_side_len:r,u_velocity:s,u_velocity_res:u,u_max_speed:d,u_speed_factor:f,u_reset_rate:_,u_rand_seed:Math.random(),u_uv_offset:y,u_data_scale:b,u_data_offset:T,u_particle_pos_scale:1.3,u_particle_pos_offset:[ms,ms]}),ws=o.a9.create(),Qc=(c,r,s,u,d,f,_,y,b,T,S,A,C,P,L,R,k,O)=>{const N=d.transform,$={u_is_size_zoom_constant:+(c==="constant"||c==="source"),u_is_size_feature_constant:+(c==="constant"||c==="camera"),u_size_t:r?r.uSizeT:0,u_size:r?r.uSize:0,u_camera_to_center_distance:N.getCameraToCenterDistance(R),u_rotate_symbol:+s,u_aspect_ratio:N.width/N.height,u_fade_change:d.options.fadeDuration?d.symbolFadeChange:1,u_matrix:f,u_label_plane_matrix:_,u_coord_matrix:y,u_is_text:+b,u_pitch_with_map:+u,u_texsize:T,u_texture:0,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:ws,u_merc_center:[0,0],u_camera_forward:[0,0,0],u_ecef_origin:[0,0,0],u_tile_matrix:ws,u_up_vector:[0,-1,0],u_color_adj_mat:k,u_icon_transition:O||0};return R.name==="globe"&&($.u_tile_id=[S.canonical.x,S.canonical.y,1<<S.canonical.z],$.u_zoom_transition=A,$.u_inv_rot_matrix=P,$.u_merc_center=C,$.u_camera_forward=N._camera.forward(),$.u_ecef_origin=o.cy(N.globeMatrix,S.toUnwrapped()),$.u_tile_matrix=Float32Array.from(N.globeMatrix),$.u_up_vector=L),$},so=(c,r,s,u,d,f,_,y,b,T,S,A,C,P,L,R,k)=>o.e(Qc(c,r,s,u,d,f,_,y,b,T,A,C,P,L,R,k),{u_gamma_scale:u?d.transform.getCameraToCenterDistance(k)*Math.cos(d.terrain?0:d.transform._pitch):1,u_device_pixel_ratio:o.f.devicePixelRatio,u_is_halo:+S,undefined:void 0}),ts=(c,r,s,u,d,f,_,y,b,T,S,A,C,P,L,R)=>o.e(so(c,r,s,u,d,f,_,y,!0,b,!0,S,A,C,P,L,R),{u_texsize_icon:T,u_texture_icon:1}),Tp=(c,r,s,u)=>({u_matrix:c,u_emissive_strength:r,u_opacity:s,u_color:u}),Ep=(c,r,s,u,d,f,_)=>o.e(function(y,b,T,S){const A=T.imageManager.getPattern(y.toString(),b),{width:C,height:P}=T.imageManager.getPixelSize(b),L=Math.pow(2,S.tileID.overscaledZ
2108),R=S.tileSize*Math.pow(2,T.transform.tileZoom)/L,k=R*(S.tileID.canonical.x+S.tileID.wrap*L),O=R*S.tileID.canonical.y;return{u_image:0,u_pattern_tl:A.tl,u_pattern_br:A.br,u_texsize:[C,P],u_pattern_size:A.displaySize,u_tile_units_to_pixels:1/o.a6(S,1,T.transform.tileZoom),u_pixel_coord_upper:[k>>16,O>>16],u_pixel_coord_lower:[65535&k,65535&O]}}(d,f,u,_),{u_matrix:c,u_emissive_strength:r,u_opacity:s}),Hc=new Float32Array(o.a9.identity([])),Al=(c,r,s,u,d,f,_,y,b,T,S,A,C,P=[0,0,0],L)=>{const R=d.style.light,k=R.properties.get("position"),O=[-k.x,-k.y,k.z],N=o.ct.create();R.properties.get("anchor")==="viewport"&&(o.ct.fromRotation(N,-d.transform.angle),o.Q.transformMat3(O,O,N));const $=S.alphaMode==="MASK",Z=R.properties.get("color"),Q=C.paint.get("model-ambient-occlusion-intensity"),B=C.paint.get("model-color").constantOr(o.aA.white),U=C.paint.get("model-color-mix-intensity").constantOr(0);return{u_matrix:c,u_lighting_matrix:r,u_normal_matrix:s,u_node_matrix:u||Hc,u_lightpos:O,u_lightintensity:R.properties.get("intensity"),u_lightcolor:[Z.r,Z.g,Z.b],u_camera_pos:P,u_opacity:f,u_baseTextureIsAlpha:0,u_alphaMask:+$,u_alphaCutoff:S.alphaCutoff,u_baseColorFactor:[_.r,_.g,_.b,_.a],u_emissiveFactor:[y[0],y[1],y[2],1],u_metallicFactor:b,u_roughnessFactor:T,u_baseColorTexture:Tr.BaseColor,u_metallicRoughnessTexture:Tr.MetallicRoughness,u_normalTexture:Tr.Normal,u_occlusionTexture:Tr.Occlusion,u_emissionTexture:Tr.Emission,u_color_mix:[B.r,B.g,B.b,U],u_aoIntensity:Q,u_emissive_strength:A,u_occlusionTextureTransform:L||[0,0,0,0]}},Dh=(c,r=Hc,s=Hc)=>({u_matrix:c,u_instance:r,u_node_matrix:s}),Xc={fillExtrusion:c=>({u_matrix:new o.bN(c),u_lightpos:new o.bP(c),u_lightintensity:new o.bQ(c),u_lightcolor:new o.bP(c),u_vertical_gradient:new o.bQ(c),u_opacity:new o.bQ(c),u_edge_radius:new o.bQ(c),u_ao:new o.bO(c),u_tile_id:new o.bP(c),u_zoom_transition:new o.bQ(c),u_inv_rot_matrix:new o.bN(c),u_merc_center:new o.bO(c),u_up_dir:new o.bP(c),u_height_lift:new o.bQ(c),u_flood_light_color:new o.bP(c),u_vertical_scale:new o.bQ(c),u_flood_light_intensity:new o.bQ(c),u_ground_shadow_factor:new o.bP(c),u_emissive_strength:new o.bQ(c)}),fillExtrusionDepth:c=>({u_matrix:new o.bN(c),u_edge_radius:new o.bQ(c),u_vertical_scale:new o.bQ(c)}),fillExtrusionPattern:c=>({u_matrix:new o.bN(c),u_lightpos:new o.bP(c),u_lightintensity:new o.bQ(c),u_lightcolor:new o.bP(c),u_vertical_gradient:new o.bQ(c),u_height_factor:new o.bQ(c),u_edge_radius:new o.bQ(c),u_ao:new o.bO(c),u_tile_id:new o.bP(c),u_zoom_transition:new o.bQ(c),u_inv_rot_matrix:new o.bN(c),u_merc_center:new o.bO(c),u_up_dir:new o.bP(c),u_height_lift:new o.bQ(c),u_image:new o.bR(c),u_texsize:new o.bO(c),u_pixel_coord_upper:new o.bO(c),u_pixel_coord_lower:new o.bO(c),u_tile_units_to_pixels:new o.bQ(c),u_opacity:new o.bQ(c)}),fillExtrusionGroundEffect:c=>({u_matrix:new o.bN(c),u_opacity:new o.bQ(c),u_ao_pass:new o.bQ(c),u_meter_to_tile:new o.bQ(c),u_ao:new o.bO(c),u_flood_light_intensity:new o.bQ(c),u_flood_light_color:new o.bP(c),u_attenuation:new o.bQ(c),u_edge_radius:new o.bQ(c),u_fb:new o.bR(c),u_fb_size:new o.bQ(c)}),fill:c=>({u_matrix:new o.bN(c),u_emissive_strength:new o.bQ(c)}),fillPattern:c=>({u_matrix:new o.bN(c),u_emissive_strength:new o.bQ(c),u_image:new o.bR(c),u_texsize:new o.bO(c),u_pixel_coord_upper:new o.bO(c),u_pixel_coord_lower:new o.bO(c),u_tile_units_to_pixels:new o.bQ(c)}),fillOutline:c=>({u_matrix:new o.bN(c),u_emissive_strength:new o.bQ(c),u_world:new o.bO(c)}),fillOutlinePattern:c=>({u_matrix:new o.bN(c),u_emissive_strength:new o.bQ(c),u_world:new o.bO(c),u_image:new o.bR(c),u_texsize:new o.bO(c),u_pixel_coord_upper:new o.bO(c),u_pixel_coord_lower:new o.bO(c),u_tile_units_to_pixels:new o.bQ(c)}),circle:o.cz,collisionBox:c=>({u_matrix:new o.bN(c),u_camera_to_center_distance:new o.bQ(c),u_extrude_scale:new o.bO(c)}),collisionCircle:c=>({u_matrix:new o.bN(c),u_inv_matrix:new o.bN(c),u_camera_to_center_distance:new o.bQ(c),u_viewport_size:new o.bO(c)}),debug:c=>({u_color:new o.cf(c),u_matrix:new o.bN(c),u_overlay:new o.bR(c),u_overlay_scale:new o.bQ(c)}),clippingMask:c=>({u_matrix:new o.bN(c)}),heatmap:c=>({u_extrude_scale:new o.bQ(c),u_intensity:new o.bQ(c),u_matrix:new o.bN(c),u_inv_rot_matrix:new o.bN(c),u_merc_center:new o.bO(c),u_tile_id:new o.bP(c),u_zoom_transition:new o.bQ(c),u_up_dir:new o.bP(c)}),heatmapTexture:c=>({u_image:new o.bR(c),u_color_ramp:new o.bR(c),u_opacity:new o.bQ(c)}),hillshade:c=>({u_matrix:new o.bN(c),u_image:new o.bR(c),u_latrange:new o.bO(c),u_light:new o.bO(c),u_shadow:new o.cf(c),u_highlight:new o.cf(c),u_emissive_strength:new o.bQ(c),u_accent:new o.cf(c)}),hillshadePrepare:c=>({u_matrix:new o.bN(c),u_image:new o.bR(c),u_dimension:new o.bO(c),u_zoom:new o.bQ(c)}),line:o.cA,linePattern:o.cB,raster:c=>({u_matrix:new o.bN(c),u_normalize_matrix:new o.bN(c),u_globe_matrix:new o.bN(c),u_merc_matrix:new o.bN(c),u_grid_matrix:new o.cg
2108(c),u_tl_parent:new o.bO(c),u_scale_parent:new o.bQ(c),u_fade_t:new o.bQ(c),u_opacity:new o.bQ(c),u_image0:new o.bR(c),u_image1:new o.bR(c),u_brightness_low:new o.bQ(c),u_brightness_high:new o.bQ(c),u_saturation_factor:new o.bQ(c),u_contrast_factor:new o.bQ(c),u_spin_weights:new o.bP(c),u_perspective_transform:new o.bO(c),u_raster_elevation:new o.bQ(c),u_zoom_transition:new o.bQ(c),u_merc_center:new o.bO(c),u_cutoff_params:new o.bS(c),u_colorization_mix:new o.bS(c),u_colorization_offset:new o.bQ(c),u_color_ramp:new o.bR(c),u_texture_offset:new o.bO(c),u_texture_res:new o.bO(c),u_emissive_strength:new o.bQ(c)}),rasterParticle:c=>({u_matrix:new o.bN(c),u_normalize_matrix:new o.bN(c),u_globe_matrix:new o.bN(c),u_merc_matrix:new o.bN(c),u_grid_matrix:new o.cg(c),u_tl_parent:new o.bO(c),u_scale_parent:new o.bQ(c),u_fade_t:new o.bQ(c),u_opacity:new o.bQ(c),u_image0:new o.bR(c),u_image1:new o.bR(c),u_raster_elevation:new o.bQ(c),u_zoom_transition:new o.bQ(c),u_merc_center:new o.bO(c),u_cutoff_params:new o.bS(c)}),rasterParticleTexture:c=>({u_texture:new o.bR(c),u_opacity:new o.bQ(c)}),rasterParticleDraw:c=>({u_particle_texture:new o.bR(c),u_particle_texture_side_len:new o.bQ(c),u_tile_offset:new o.bO(c),u_velocity:new o.bR(c),u_color_ramp:new o.bR(c),u_velocity_res:new o.bO(c),u_max_speed:new o.bQ(c),u_uv_offset:new o.bO(c),u_data_scale:new o.bS(c),u_data_offset:new o.bQ(c),u_particle_pos_scale:new o.bQ(c),u_particle_pos_offset:new o.bO(c)}),rasterParticleUpdate:c=>({u_particle_texture:new o.bR(c),u_particle_texture_side_len:new o.bQ(c),u_velocity:new o.bR(c),u_velocity_res:new o.bO(c),u_max_speed:new o.bQ(c),u_speed_factor:new o.bQ(c),u_reset_rate:new o.bQ(c),u_rand_seed:new o.bQ(c),u_uv_offset:new o.bO(c),u_data_scale:new o.bS(c),u_data_offset:new o.bQ(c),u_particle_pos_scale:new o.bQ(c),u_particle_pos_offset:new o.bO(c)}),symbolIcon:c=>({u_is_size_zoom_constant:new o.bR(c),u_is_size_feature_constant:new o.bR(c),u_size_t:new o.bQ(c),u_size:new o.bQ(c),u_camera_to_center_distance:new o.bQ(c),u_rotate_symbol:new o.bR(c),u_aspect_ratio:new o.bQ(c),u_fade_change:new o.bQ(c),u_matrix:new o.bN(c),u_label_plane_matrix:new o.bN(c),u_coord_matrix:new o.bN(c),u_is_text:new o.bR(c),u_pitch_with_map:new o.bR(c),u_texsize:new o.bO(c),u_tile_id:new o.bP(c),u_zoom_transition:new o.bQ(c),u_inv_rot_matrix:new o.bN(c),u_merc_center:new o.bO(c),u_camera_forward:new o.bP(c),u_tile_matrix:new o.bN(c),u_up_vector:new o.bP(c),u_ecef_origin:new o.bP(c),u_texture:new o.bR(c),u_icon_transition:new o.bQ(c),u_color_adj_mat:new o.bN(c)}),symbolSDF:c=>({u_is_size_zoom_constant:new o.bR(c),u_is_size_feature_constant:new o.bR(c),u_size_t:new o.bQ(c),u_size:new o.bQ(c),u_camera_to_center_distance:new o.bQ(c),u_rotate_symbol:new o.bR(c),u_aspect_ratio:new o.bQ(c),u_fade_change:new o.bQ(c),u_matrix:new o.bN(c),u_label_plane_matrix:new o.bN(c),u_coord_matrix:new o.bN(c),u_is_text:new o.bR(c),u_pitch_with_map:new o.bR(c),u_texsize:new o.bO(c),u_texture:new o.bR(c),u_gamma_scale:new o.bQ(c),u_device_pixel_ratio:new o.bQ(c),u_tile_id:new o.bP(c),u_zoom_transition:new o.bQ(c),u_inv_rot_matrix:new o.bN(c),u_merc_center:new o.bO(c),u_camera_forward:new o.bP(c),u_tile_matrix:new o.bN(c),u_up_vector:new o.bP(c),u_ecef_origin:new o.bP(c),u_is_halo:new o.bR(c)}),symbolTextAndIcon:c=>({u_is_size_zoom_constant:new o.bR(c),u_is_size_feature_constant:new o.bR(c),u_size_t:new o.bQ(c),u_size:new o.bQ(c),u_camera_to_center_distance:new o.bQ(c),u_rotate_symbol:new o.bR(c),u_aspect_ratio:new o.bQ(c),u_fade_change:new o.bQ(c),u_matrix:new o.bN(c),u_label_plane_matrix:new o.bN(c),u_coord_matrix:new o.bN(c),u_is_text:new o.bR(c),u_pitch_with_map:new o.bR(c),u_texsize:new o.bO(c),u_texsize_icon:new o.bO(c),u_texture:new o.bR(c),u_texture_icon:new o.bR(c),u_gamma_scale:new o.bQ(c),u_device_pixel_ratio:new o.bQ(c),u_is_halo:new o.bR(c)}),background:c=>({u_matrix:new o.bN(c),u_emissive_strength:new o.bQ(c),u_opacity:new o.bQ(c),u_color:new o.cf(c)}),backgroundPattern:c=>({u_matrix:new o.bN(c),u_emissive_strength:new o.bQ(c),u_opacity:new o.bQ(c),u_image:new o.bR(c),u_pattern_tl:new o.bO(c),u_pattern_br:new o.bO(c),u_texsize:new o.bO(c),u_pattern_size:new o.bO(c),u_pixel_coord_upper:new o.bO(c),u_pixel_coord_lower:new o.bO(c),u_tile_units_to_pixels:new o.bQ(c)}),terrainRaster:Gt,terrainDepth:Gt,skybox:c=>({u_matrix:new o.bN(c),u_sun_direction:new o.bP(c),u_cubemap:new o.bR(c),u_opacity:new o.bQ(c),u_temporal_offset:new o.bQ(c)}),skyboxGradient:c=>({u_matrix:new o.bN(c),u_color_ramp:new o.bR(c),u_center_direction:new o.bP(c),u_radius:new o.bQ(c),u_opacity:new o.bQ(c),u_temporal_offset:new o.bQ(c)}),skyboxCapture:c=>
2108({u_matrix_3f:new o.cg(c),u_sun_direction:new o.bP(c),u_sun_intensity:new o.bQ(c),u_color_tint_r:new o.bS(c),u_color_tint_m:new o.bS(c),u_luminance:new o.bQ(c)}),globeRaster:c=>({u_proj_matrix:new o.bN(c),u_globe_matrix:new o.bN(c),u_normalize_matrix:new o.bN(c),u_merc_matrix:new o.bN(c),u_zoom_transition:new o.bQ(c),u_merc_center:new o.bO(c),u_image0:new o.bR(c),u_grid_matrix:new o.cg(c),u_skirt_height:new o.bQ(c),u_far_z_cutoff:new o.bQ(c),u_frustum_tl:new o.bP(c),u_frustum_tr:new o.bP(c),u_frustum_br:new o.bP(c),u_frustum_bl:new o.bP(c),u_globe_pos:new o.bP(c),u_globe_radius:new o.bQ(c),u_viewport:new o.bO(c)}),globeAtmosphere:c=>({u_frustum_tl:new o.bP(c),u_frustum_tr:new o.bP(c),u_frustum_br:new o.bP(c),u_frustum_bl:new o.bP(c),u_horizon:new o.bQ(c),u_transition:new o.bQ(c),u_fadeout_range:new o.bQ(c),u_color:new o.bS(c),u_high_color:new o.bS(c),u_space_color:new o.bS(c),u_temporal_offset:new o.bQ(c),u_horizon_angle:new o.bQ(c)}),model:c=>({u_matrix:new o.bN(c),u_lighting_matrix:new o.bN(c),u_normal_matrix:new o.bN(c),u_node_matrix:new o.bN(c),u_lightpos:new o.bP(c),u_lightintensity:new o.bQ(c),u_lightcolor:new o.bP(c),u_camera_pos:new o.bP(c),u_opacity:new o.bQ(c),u_baseColorFactor:new o.bS(c),u_emissiveFactor:new o.bS(c),u_metallicFactor:new o.bQ(c),u_roughnessFactor:new o.bQ(c),u_baseTextureIsAlpha:new o.bR(c),u_alphaMask:new o.bR(c),u_alphaCutoff:new o.bQ(c),u_baseColorTexture:new o.bR(c),u_metallicRoughnessTexture:new o.bR(c),u_normalTexture:new o.bR(c),u_occlusionTexture:new o.bR(c),u_emissionTexture:new o.bR(c),u_color_mix:new o.bS(c),u_aoIntensity:new o.bQ(c),u_emissive_strength:new o.bQ(c),u_occlusionTextureTransform:new o.bS(c)}),modelDepth:c=>({u_matrix:new o.bN(c),u_instance:new o.bN(c),u_node_matrix:new o.bN(c)}),groundShadow:c=>({u_matrix:new o.bN(c),u_ground_shadow_factor:new o.bP(c)}),stars:c=>({u_matrix:new o.bN(c),u_up:new o.bP(c),u_right:new o.bP(c),u_intensity_multiplier:new o.bQ(c)})};let ha;function Yc(c,r,s,u,d,f,_){const y=c.context,b=y.gl,T=c.transform,S=c.getOrCreateProgram("collisionBox"),A=[];let C=0,P=0;for(let Z=0;Z<u.length;Z++){const Q=u[Z],B=r.getTile(Q),U=B.getBucket(s);if(!U)continue;const K=_n(Q,U,T);let Y=K;d[0]===0&&d[1]===0||(Y=c.translatePosMatrix(K,B,d,f));const re=_?U.textCollisionBox:U.iconCollisionBox,he=U.collisionCircleArray;if(he.length>0){const ie=o.a9.create(),ce=Y;o.a9.mul(ie,U.placementInvProjMatrix,T.glCoordMatrix),o.a9.mul(ie,ie,U.placementViewportMatrix),A.push({circleArray:he,circleOffset:P,transform:ce,invTransform:ie,projection:U.getProjection()}),C+=he.length/4,P=C}re&&(c.terrain&&c.terrain.setupElevationDraw(B,S),S.draw(c,b.LINES,lt.disabled,yt.disabled,c.colorModeForRenderPass(),ft.disabled,xp(Y,T,B,U.getProjection()),s.id,re.layoutVertexBuffer,re.indexBuffer,re.segments,null,T.zoom,null,[re.collisionVertexBuffer,re.collisionVertexBufferExt]))}if(!_||!A.length)return;const L=c.getOrCreateProgram("collisionCircle"),R=new o.cC;R.resize(4*C),R._trim();let k=0;for(const Z of A)for(let Q=0;Q<Z.circleArray.length/4;Q++){const B=4*Q,U=Z.circleArray[B+0],K=Z.circleArray[B+1],Y=Z.circleArray[B+2],re=Z.circleArray[B+3];R.emplace(k++,U,K,Y,re,0),R.emplace(k++,U,K,Y,re,1),R.emplace(k++,U,K,Y,re,2),R.emplace(k++,U,K,Y,re,3)}(!ha||ha.length<2*C)&&(ha=function(Z){const Q=2*Z,B=new o.az;B.resize(Q),B._trim();for(let U=0;U<Q;U++){const K=6*U;B.uint16[K+0]=4*U+0,B.uint16[K+1]=4*U+1,B.uint16[K+2]=4*U+2,B.uint16[K+3]=4*U+2,B.uint16[K+4]=4*U+3,B.uint16[K+5]=4*U+0}return B}(C));const O=y.createIndexBuffer(ha,!0),N=y.createVertexBuffer(R,o.cD.members,!0);for(const Z of A){const Q={u_matrix:Z.transform,u_inv_matrix:Z.invTransform,u_camera_to_center_distance:($=T).getCameraToCenterDistance(Z.projection),u_viewport_size:[$.width,$.height]};L.draw(c,b.TRIANGLES,lt.disabled,yt.disabled,c.colorModeForRenderPass(),ft.disabled,Q,s.id,N,O,o.aE.simpleSegment(0,2*Z.circleOffset,Z.circleArray.length,Z.circleArray.length/2),null,T.zoom)}var $;N.destroy(),O.destroy()}const da=o.a9.create();function Jc(c){const r=c._camera.getWorldToCamera(c.worldSize,1),s=o.a9.multiply([],r,c.globeMatrix);o.a9.invert(s,s);const u=[0,0,0],d=[0,1,0,0];return o.aa.transformMat4(d,d,s),u[0]=d[0],u[1]=d[1],u[2]=d[2],o.Q.normalize(u,u),u}function Ts({width:c,height:r,anchor:s,textOffset:u,textScale:d},f){const{horizontalAlign:_,verticalAlign:y}=o.bi(s),b=-(_-.5)*c,T=-(y-.5)*r,S=o.bh(s,u);return new o.P((b/d+S[0])*f,(T/d+S[1])*f)}function Rh(c,r,s,u,d,f,_,y,b,T,S){const A=c.text.placedSymbolArray,C=c.text.dynamicLayoutVertexArray,P=c.icon.dynamicLayoutVertexArray,L={},R=c.getProjection(),k=ll(y,R,f),O=f.elevation,N=R.upVectorScale(y.canonical,f.center.lat,f.worldSize).metersToTile;C.clear();for(let $=0;$<A.length;$++){const Z=A.get($),{tileAnchorX:Q,tileAnchorY:B,numGlyphs:U}=Z,K=Z.hidden||!Z.crossTileID||c.allowVerticalPlacement&&!Z.placedOrientation?null:u[Z.crossTileID];if(K){let Y=0,re=0,he=0;if(O){const de=O?O.getAtTileOffset(y,Q,B):0,[W,xe,Ge]=R.upVector(y.canonical,Q,B);Y=de*W*N,re=de*xe*N,he=de*Ge*N}let[ie,ce,pe,te]=kr(Z.projectedAnchorX+Y,Z.projectedAnchorY+re,Z.projectedAnchorZ+he,s?k:_);const ae=rl(f.getCameraToCenterDistance(R),te);
2108let Me=d.evaluateSizeForFeature(c.textSizeData,T,Z)*ae/o.bf;s&&(Me*=c.tilePixelRatio/b);const se=Ts(K,Me);s?({x:ie,y:ce,z:pe}=R.projectTilePoint(Q+se.x,B+se.y,y.canonical),[ie,ce,pe]=kr(ie+Y,ce+re,pe+he,_)):(r&&se._rotate(-f.angle),ie+=se.x,ce+=se.y,pe=0);const ue=c.allowVerticalPlacement&&Z.placedOrientation===o.b9.vertical?Math.PI/2:0;for(let de=0;de<U;de++)o.bc(C,ie,ce,pe,ue);S&&Z.associatedIconIndex>=0&&(L[Z.associatedIconIndex]={x:ie,y:ce,z:pe,angle:ue})}else ys(U,C)}if(S){P.clear();const $=c.icon.placedSymbolArray;for(let Z=0;Z<$.length;Z++){const Q=$.get(Z),{numGlyphs:B}=Q,U=L[Z];if(Q.hidden||!U)ys(B,P);else{const{x:K,y:Y,z:re,angle:he}=U;for(let ie=0;ie<B;ie++)o.bc(P,K,Y,re,he)}}c.icon.dynamicLayoutVertexBuffer.updateData(P)}c.text.dynamicLayoutVertexBuffer.updateData(C)}function pa(c,r,s,u,d,f,_={}){const y=s.paint.get("icon-translate"),b=s.paint.get("text-translate"),T=s.paint.get("icon-translate-anchor"),S=s.paint.get("text-translate-anchor"),A=s.layout.get("icon-rotation-alignment"),C=s.layout.get("text-rotation-alignment"),P=s.layout.get("icon-pitch-alignment"),L=s.layout.get("text-pitch-alignment"),R=s.layout.get("icon-keep-upright"),k=s.layout.get("text-keep-upright"),O=s.paint.get("icon-color-saturation"),N=s.paint.get("icon-color-contrast"),$=s.paint.get("icon-color-brightness-min"),Z=s.paint.get("icon-color-brightness-max"),Q=c.context,B=Q.gl,U=c.transform,K=A==="map",Y=C==="map",re=P==="map",he=L==="map",ie=s.layout.get("symbol-sort-key").constantOr(1)!==void 0;let ce=!1;const pe=c.depthModeForSublayer(0,lt.ReadOnly),te=[o.a8(U.center.lng),o.ah(U.center.lat)],ae=s.layout.get("text-variable-anchor"),Me=U.projection.name==="globe",se=[],ue=[0,-1,0];for(const de of u){const W=r.getTile(de),xe=W.getBucket(s);if(!xe||xe.projection.name==="mercator"&&Me||xe.fullyClipped)continue;const Ge=xe.projection.name==="globe",Xe=Ge?o.W(U.zoom):0,nt=ll(de,xe.getProjection(),U),et=U.calculatePixelsToTileUnitsMatrix(W),at=ae&&xe.hasTextData(),Ot=xe.hasIconTextFit()&&at&&xe.hasIconData(),gt=xe.getProjection().createInversionMatrix(U,de.canonical),Vt=()=>{const St=K&&s.layout.get("symbol-placement")!=="point",It=[],gi=St||Ot,hi=s.paint.get("icon-image-cross-fade").constantOr(0);c.terrainRenderModeElevated()&&re&&It.push("PITCH_WITH_MAP_TERRAIN"),Ge&&(It.push("PROJECTION_GLOBE_VIEW"),gi&&It.push("PROJECTED_POS_ON_VIEWPORT")),hi>0&&It.push("ICON_TRANSITION"),xe.icon.zOffsetVertexBuffer&&It.push("Z_OFFSET"),O===0&&N===0&&$===0&&Z===1||It.push("COLOR_ADJUSTMENT");const Dt=xe.icon.programConfigurations.get(s.id),vt=c.getOrCreateProgram(xe.sdfIcons?"symbolSDF":"symbolIcon",{config:Dt,defines:It});let br;const ar=W.imageAtlasTexture?W.imageAtlasTexture.size:[0,0],Qi=xe.iconSizeData,lr=o.b8(Qi,U.zoom),wr=re||U.pitch!==0,pr=qo(nt,W.tileID.canonical,re,K,U,xe.getProjection(),et),Hi=zn(nt,W.tileID.canonical,re,K,U,xe.getProjection(),et),er=c.translatePosMatrix(Hi,W,y,T,!0),tr=c.translatePosMatrix(nt,W,y,T),vn=gi?da:pr,cn=K&&!re&&!St;let bn=ue;!Me&&!U.mercatorFromTransition||K||(bn=Jc(U));const wn=Ge?bn:ue;if(xe.sdfIcons&&!xe.iconsInText)br=so(Qi.kind,lr,cn,re,c,tr,vn,er,!1,ar,!0,de,Xe,te,gt,wn,xe.getProjection());else{const On=s.getColorAdjustmentMatrix(O,N,$,Z);br=Qc(Qi.kind,lr,cn,re,c,tr,vn,er,!1,ar,de,Xe,te,gt,wn,xe.getProjection(),On,hi)}const os=W.imageAtlasTexture?W.imageAtlasTexture:null,Zr=s.layout.get("icon-size").constantOr(0)!==1||xe.iconsNeedLinear,Aa=xe.sdfIcons||c.options.rotating||c.options.zooming||Zr||wr?B.LINEAR:B.NEAREST,_o=xe.sdfIcons&&s.paint.get("icon-halo-width").constantOr(1)!==0,Ia=c.terrain&&re&&St?o.a9.invert(o.a9.create(),pr):da;if(St&&xe.icon){const On=U.elevation,Xi=On?On.getAtTileOffsetFunc(de,U.center.lat,U.worldSize,xe.getProjection()):null,Ca=Zo(nt,W.tileID.canonical,re,K,U,xe.getProjection(),et);sl(xe,nt,c,!1,Ca,Hi,re,R,Xi,de)}return{program:vt,buffers:xe.icon,uniformValues:br,atlasTexture:os,atlasTextureIcon:null,atlasInterpolation:Aa,atlasInterpolationIcon:null,isSDF:xe.sdfIcons,hasHalo:_o,tile:W,labelPlaneMatrixInv:Ia}},Bt=()=>{const St=Y&&s.layout.get("symbol-placement")!=="point",It=[],gi=St||ae||Ot;c.terrainRenderModeElevated()&&he&&It.push("PITCH_WITH_MAP_TERRAIN"),Ge&&(It.push("PROJECTION_GLOBE_VIEW"),gi&&It.push("PROJECTED_POS_ON_VIEWPORT")),xe.text.zOffsetVertexBuffer&&It.push("Z_OFFSET");const hi=xe.text.programConfigurations.get(s.id),Dt=c.getOrCreateProgram(xe.iconsInText?"symbolTextAndIcon":"symbolSDF",{config:hi,defines:It});let vt,br=[0,0],ar=null;const Qi=xe.textSizeData;xe.iconsInText&&(br=W.imageAtlasTexture?W.imageAtlasTexture.size:[0,0],ar=W.imageAtlasTexture?W.imageAtlasTexture:null,vt=he||U.pitch!==0||c.options.rotating||c.options.zooming||Qi.kind==="composite"||Qi.kind==="camera"?B.LINEAR:B.NEAREST);const lr=W.glyphAtlasTexture?W.glyphAtlasTexture.size:[0,0],wr=o.b8(Qi,U.zoom),pr=qo(nt,W.tileID.canonical,he,Y,U,xe.getProjection(),et),Hi=zn(nt,W.tileID.canonical,he,Y,U,xe.getProjection(),et),er=c.translatePosMatrix(Hi,W,b,S,!0),tr=c.translatePosMatrix(nt,W,b,S),vn=gi?da:pr,cn=Y&&!he&&!St;let bn=ue;!Me&&!U.mercatorFromTransition||Y||(bn=Jc(U));const wn=Ge?bn:ue;let os;os=xe.iconsInText?ts(Qi.kind,wr,cn,he,c,tr,vn,er,lr,br,de,Xe,te,gt,wn,xe.getProjection()):so(Qi.kind,wr,cn,he,c,tr,vn,er,!0,lr,!0,de,Xe,te,gt,wn,xe.getProjection());const Zr=W.glyphAtlasTexture?W.glyphAtlasTexture:null,Aa=B.LINEAR,_o=s.paint.get("text-halo-width").constantOr(1)!==0,Ia=c.terrain&&he&&St?o.a9.invert(o.a9.create(),pr):da;if(St&&xe.text){const On=U.elevation,Xi=On?On.getAtTileOffsetFunc(de,U.center.lat,U.worldSize,xe.getProjection()):null,Ca=Zo(nt,W.tileID.canonical,he,Y,U,xe.getProjection(),et);sl(xe,nt,c,!0,Ca,Hi,he,k,Xi,de)}return{program:Dt,buffers:xe.text,uniformValues:os,atlasTexture:Zr,atlasTextureIcon:ar,atlasInterpolation:Aa,atlasInterpolationIcon:vt,isSDF:!0,hasHalo:_o,tile:W,labelPlaneMatr
vendor: 5,329 bytes, line 2108
2108ixInv:Ia}},bi=xe.icon.segments.get().length,ii=xe.text.segments.get().length,qi=bi&&!_.onlyText?Vt():null,Bi=ii&&!_.onlyIcons?Bt():null,ui=s.paint.get("icon-opacity").constantOr(1),ri=s.paint.get("text-opacity").constantOr(1);if(ie&&xe.canOverlap){ce=!0;const St=ui&&!_.onlyText?xe.icon.segments.get():[],It=ri&&!_.onlyIcons?xe.text.segments.get():[];for(const gi of St)se.push({segments:new o.aE([gi]),sortKey:gi.sortKey,state:qi});for(const gi of It)se.push({segments:new o.aE([gi]),sortKey:gi.sortKey,state:Bi})}else _.onlyText||se.push({segments:ui?xe.icon.segments:new o.aE([]),sortKey:0,state:qi}),_.onlyIcons||se.push({segments:ri?xe.text.segments:new o.aE([]),sortKey:0,state:Bi})}ce&&se.sort((de,W)=>de.sortKey-W.sortKey);for(const de of se){const W=de.state;if(W)if(c.terrain&&c.terrain.setupElevationDraw(W.tile,W.program,{useDepthForOcclusion:U.depthOcclusionForSymbolsAndCircles,labelPlaneMatrixInv:W.labelPlaneMatrixInv}),Q.activeTexture.set(B.TEXTURE0),W.atlasTexture&&W.atlasTexture.bind(W.atlasInterpolation,B.CLAMP_TO_EDGE,!0),W.atlasTextureIcon&&(Q.activeTexture.set(B.TEXTURE1),W.atlasTextureIcon&&W.atlasTextureIcon.bind(W.atlasInterpolationIcon,B.CLAMP_TO_EDGE,!0)),c.uploadCommonLightUniforms(c.context,W.program),W.hasHalo){const xe=W.uniformValues;xe.u_is_halo=1,Il(W.buffers,de.segments,s,c,W.program,pe,d,f,xe,2),xe.u_is_halo=0}else{if(W.isSDF){const xe=W.uniformValues;W.hasHalo&&(xe.u_is_halo=1,Il(W.buffers,de.segments,s,c,W.program,pe,d,f,xe,1)),xe.u_is_halo=0}Il(W.buffers,de.segments,s,c,W.program,pe,d,f,W.uniformValues,1)}}}function Il(c,r,s,u,d,f,_,y,b,T){const S=[c.dynamicLayoutVertexBuffer,c.opacityVertexBuffer,c.iconTransitioningVertexBuffer,c.globeExtVertexBuffer,c.zOffsetVertexBuffer];d.draw(u,u.context.gl.TRIANGLES,f,_,y,ft.disabled,b,s.id,c.layoutVertexBuffer,c.indexBuffer,r,s.paint,u.transform.zoom,c.programConfigurations.get(s.id),S,T)}function Cl(c,r,s,u,d,f,_){const y=c.context.gl,b=s.paint.get("fill-pattern"),T=b&&b.constantOr(1);let S,A,C,P,L;_?(A=T&&!s.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",S=y.LINES):(A=T?"fillPattern":"fill",S=y.TRIANGLES);for(const R of u){const k=r.getTile(R);if(T&&!k.patternsLoaded())continue;const O=k.getBucket(s);if(!O)continue;c.prepareDrawTile();const N=O.programConfigurations.get(s.id),$=c.isTileAffectedByFog(R),Z=c.getOrCreateProgram(A,{config:N,overrideFog:$});T&&(c.context.activeTexture.set(y.TEXTURE0),k.imageAtlasTexture&&k.imageAtlasTexture.bind(y.LINEAR,y.CLAMP_TO_EDGE),N.updatePaintBuffers());const Q=b.constantOr(null);if(Q&&k.imageAtlas){const K=k.imageAtlas.patternPositions[Q.toString()];K&&N.setConstantPatternPositions(K)}const B=c.translatePosMatrix(R.projMatrix,k,s.paint.get("fill-translate"),s.paint.get("fill-translate-anchor")),U=s.paint.get("fill-emissive-strength");if(_){P=O.indexBuffer2,L=O.segments2;const K=c.terrain&&c.terrain.renderingToTexture?c.terrain.drapeBufferSize:[y.drawingBufferWidth,y.drawingBufferHeight];C=A==="fillOutlinePattern"&&T?Rn(B,U,c,k,K):yp(B,U,K)}else P=O.indexBuffer,L=O.segments,C=T?es(B,U,c,k):no(B,U);c.uploadCommonUniforms(c.context,Z,R.toUnwrapped()),Z.draw(c,S,d,c.stencilModeForClipping(R),f,ft.disabled,C,s.id,O.layoutVertexBuffer,P,L,s.paint,c.transform.zoom,N,void 0)}}function Ve(c,r,s,u,d,f,_,y){s.resetLayerRenderingStats(c);const b=c.context,T=b.gl,S=c.transform,A=s.paint.get("fill-extrusion-pattern"),C=A.constantOr(1),P=s.paint.get("fill-extrusion-opacity"),L=c.style.enable3dLights(),R=s.paint.get(L&&!C?"fill-extrusion-ambient-occlusion-wall-radius":"fill-extrusion-ambient-occlusion-radius"),k=[s.paint.get("fill-extrusion-ambient-occlusion-intensity"),R],O=s.layout.get("fill-extrusion-edge-radius"),N=O>0&&!s.paint.get("fill-extrusion-rounded-roof"),$=N?0:O,Z=S.projection.name==="globe"?o.cM():0,Q=S.projection.name==="globe",B=Q?o.W(S.zoom):0,U=[o.a8(S.center.lng),o.ah(S.center.lat)],K=s.paint.get("fill-extrusion-flood-light-color").toArray01().slice(0,3),Y=s.paint.get("fill-extrusion-flood-light-intensity"),re=s.paint.get("fill-extrusion-vertical-scale"),he=Yn(c,s.paint.get("fill-extrusion-cutoff-fade-range")),ie=s.paint.get("fill-extrusion-emissive-strength"),ce=[];let pe;Q&&ce.push("PROJECTION_GLOBE_VIEW"),k[0]>0&&ce.push("FAUX_AO"),N&&ce.push("ZERO_ROOF_RADIUS"),y&&ce.push("HAS_CENTROID"),Y>0&&ce.push("FLOOD_LIGHT"),he.shouldRenderCutoff&&ce.push("RENDER_CUTOFF");const te=c.renderPass==="shadow",ae=c.shadowRenderer,Me=te&&!!ae;c.shadowRenderer&&(c.shadowRenderer.useNormalOffset=!0);let se=[0,0,0];if(ae){const W=c.style.directionalLight,xe=c.style.ambientLight;W&&xe&&(se=Vc(W,xe)),pe=ce.concat(["SHADOWS_SINGLE_CASCADE"])}const ue=Me?"fillExtrusionDepth":C?"fillExtrusionPattern":"fillExtrusion",de=s.getLayerRenderingStats();for(const W of u){const xe=r.getTile(W),Ge=xe.getBucket(s);if(!Ge||Ge.projection.name!==S.projection.name)continue;let Xe=!1;ae&&(Xe=ae.getMaxCascadeForTile(W.toUnwrapped())===0);const nt=c.isTileAffectedByFog(W),et=Ge.programConfigurations.get(s.id),at=c.getOrCreateProgram(ue,{config:et,defines:Xe?pe:ce,overrideFog:nt});if(c.terrain&&c.terrain.setupElevationDraw(xe,at,{useMeterToDem:!0}),!Ge.centroidVertexBuffer){const ii=at.attributes.a_centroid_pos;ii!==void 0&&T.vertexAttrib2f(ii,0,0)}!te&&ae&&ae.setupShadows(xe.tileID.toUnwrapped(),at,"vector-tile",xe.tileID.overscaledZ
2108),C&&(c.context.activeTexture.set(T.TEXTURE0),xe.imageAtlasTexture&&xe.imageAtlasTexture.bind(T.LINEAR,T.CLAMP_TO_EDGE),et.updatePaintBuffers());const Ot=A.constantOr(null);if(Ot&&xe.imageAtlas){const ii=xe.imageAtlas.patternPositions[Ot.toString()];ii&&et.setConstantPatternPositions(ii)}const gt=s.paint.get("fill-extrusion-vertical-gradient");let Vt;if(te&&ae){if(Ln(xe.tileID,Ge,c))continue;const ii=ae.calculateShadowPassMatrixFromTile(xe.tileID.toUnwrapped());Vt=an(ii,$,re)}else{const ii=c.translatePosMatrix(W.expandedProjMatrix,xe,s.paint.get("fill-extrusion-translate"),s.paint.get("fill-extrusion-translate-anchor")),qi=S.projection.createInversionMatrix(S,W.canonical);Vt=C?aa(ii,c,gt,P,k,$,W,xe,Z,B,U,qi,K,re):Ml(ii,c,gt,P,k,$,W,Z,B,U,qi,K,re,Y,se,ie)}c.uploadCommonUniforms(b,at,W.toUnwrapped(),null,he);let Bt=Ge.segments;if(S.projection.name==="mercator"&&!te&&(Bt=Ge.getVisibleSegments(xe.tileID,c.terrain,c.transform.getFrustum(0)),!Bt.get().length))continue;if(de)if(te)for(const ii of Bt.get())de.numRenderedVerticesInShadowPass+=ii.primitiveLength;else for(const ii of Bt.get())de.numRenderedVerticesInTransparentPass+=ii.primitiveLength;const bi=[];(c.terrain||y)&&bi.push(Ge.centroidVertexBuffer),Q&&bi.push(Ge.layoutVertexExtBuffer),at.draw(c,b.gl.TRIANGLES,d,f,_,ft.backCCW,Vt,s.id,Ge.layoutVertexBuffer,Ge.indexBuffer,Bt,s.paint,c.transform.zoom,et,bi)}c.shadowRenderer&&(c.shadowRenderer.useNormalOffset=!1)}function Es(c,r,s,u,d,f,_,y,b,T,S,A,C,P,L,R,k,O,N){const $=c.context,Z=$.gl,Q=c.transform,B=c.transform.zoom,U=[],K=Yn(c,s.paint.get("fill-extrusion-cutoff-fade-range"));T==="clear"?(U.push("CLEAR_SUBPASS"),N&&(U.push("CLEAR_FROM_TEXTURE"),$.activeTexture.set(Z.TEXTURE0),N.bind(Z.LINEAR,Z.CLAMP_TO_EDGE))):T==="sdf"&&U.push("SDF_SUBPASS"),k&&U.push("HAS_CENTROID"),K.shouldRenderCutoff&&U.push("RENDER_CUTOFF");const Y=s.layout.get("fill-extrusion-edge-radius"),re=(he,ie,ce,pe,te)=>{const ae=ie.programConfigurations.get(s.id),Me=c.isTileAffectedByFog(he),se=c.getOrCreateProgram("fillExtrusionGroundEffect",{config:ae,defines:U,overrideFog:Me}),ue=((W,xe,Ge,Xe,nt,et,at,Ot,gt,Vt,Bt)=>({u_matrix:xe,u_opacity:Ge,u_ao_pass:Xe?1:0,u_meter_to_tile:nt,u_ao:et,u_flood_light_intensity:at,u_flood_light_color:Ot,u_attenuation:gt,u_edge_radius:Vt,u_fb:0,u_fb_size:Bt}))(0,pe,S,b,te,[A,C*te],P,L,R,B>=17?0:Y*te,N?N.size[0]:0),de=[];k&&de.push(ie.hiddenByLandmarkVertexBuffer),c.uploadCommonUniforms($,se,he.toUnwrapped(),null,K),se.draw(c,$.gl.TRIANGLES,d,f,_,y,ue,s.id,ie.vertexBuffer,ie.indexBuffer,ce,s.paint,B,ae,de)};for(const he of u){const ie=r.getTile(he),ce=ie.getBucket(s);if(!ce||ce.projection.name!==Q.projection.name||!ce.groundEffect||ce.groundEffect&&!ce.groundEffect.hasData())continue;const pe=ce.groundEffect,te=1/ce.tileToMeter;{const ae=c.translatePosMatrix(he.projMatrix,ie,s.paint.get("fill-extrusion-translate"),s.paint.get("fill-extrusion-translate-anchor")),Me=pe.getDefaultSegment();re(he,pe,Me,ae,te)}if(O)for(let ae=0;ae<4;ae++){const Me=o.cN[ae](he),se=r.getTile(Me);if(!se)continue;const ue=se.getBucket(s);if(!ue||ue.projection.name!==Q.projection.name||!ue.groundEffect||ue.groundEffect&&!ue.groundEffect.hasData())continue;const de=ue.groundEffect;let W,xe;ae===0?(W=[-o.Y,0,0],xe=1):ae===1?(W=[o.Y,0,0],xe=0):ae===2?(W=[0,-o.Y,0],xe=3):(W=[0,o.Y,0],xe=2);const Ge=de.regionSegments[xe];if(!Ge)continue;const Xe=new Float32Array(16);o.a9.translate(Xe,he.projMatrix,W),re(he,de,Ge,c.translatePosMatrix(Xe,ie,s.paint.get("fill-extrusion-translate"),s.paint.get("fill-extrusion-translate-anchor")),te)}}}function Kc(c,r,s,u,d,f,_){u.centroidVertexArray.length===0&&u.createCentroidsBuffer();const y=f?f.findDEMTileFor(s):null;if(!(y&&y.dem||_))return;const b=O=>new o.P(Math.ceil((O+o.cQ)*o.cR),0),T=O=>{const N=r.getSource().minzoom,$=Q=>{const B=r.getTileByID(Q);if(B&&B.hasData())return B.getBucket(d)},Z=[0,-1,1];for(const Q of Z){if(O.overscaledZ+Q<N)continue;const B=$(O.calculateScaledKey(O.overscaledZ+Q));if(B)return B}},S=[0,0,0],A=(O,N)=>(S[0]=Math.min(O.min.y,N.min.y),S[1]=Math.max(O.max.y,N.max.y),S[2]=o.Y-N.min.x>
2108O.max.x?N.min.x-o.Y:O.max.x,S),C=(O,N)=>(S[0]=Math.min(O.min.x,N.min.x),S[1]=Math.max(O.max.x,N.max.x),S[2]=o.Y-N.min.y>O.max.y?N.min.y-o.Y:O.max.y,S),P=[(O,N)=>A(O,N),(O,N)=>A(N,O),(O,N)=>C(O,N),(O,N)=>C(N,O)],L=(O,N,$,Z,Q,B,U)=>{if(!f)return 0;const K=[[B?$:O,B?O:$,0],[B?$:N,B?N:$,0]],Y=U<0?o.Y+U:U,re=[B?Y:(O+N)/2,B?(O+N)/2:Y,0];return $===0&&U<0||$!==0&&U>0?f.getForTilePoints(Q,[re],!0,Z):K.push(re),f.getForTilePoints(s,K,!0,y),Math.max(K[0][2],K[1][2],re[2])/f.exaggeration()};for(let O=0;O<4;O++){const N=u.borderFeatureIndices[O];if(N.length===0)continue;const $=o.cN[O](s),Z=T($);if(!(Z&&Z instanceof o.cO)||u.borderDoneWithNeighborZ[O]===Z.canonical.z)continue;Z.centroidVertexArray.length===0&&Z.createCentroidsBuffer();const Q=f?f.findDEMTileFor($):null;if(!(Q&&Q.dem||_))continue;const B=(O<2?1:5)-O,U=Z.borderDoneWithNeighborZ[B]!==u.canonical.z,K=Z.borderFeatureIndices[B];let Y=0;if(u.canonical.z!==Z.canonical.z){for(const re of N)u.showCentroid(u.featuresOnBorder[re]);if(U)for(const re of K)Z.showCentroid(Z.featuresOnBorder[re]);u.borderDoneWithNeighborZ[O]=Z.canonical.z,Z.borderDoneWithNeighborZ[B]=u.canonical.z}for(const re of N){const he=u.featuresOnBorder[re],ie=u.centroidData[he.centroidDataIndex],ce=he.borders[O];let pe;for(;Y<K.length;){pe=Z.featuresOnBorder[K[Y]];const te=pe.borders[B];if(te[1]>ce[0]+3||te[0]>ce[0]-3)break;Z.showCentroid(pe),Y++}if(pe&&Y<K.length){const te=Y;let ae=0;for(;!(pe.borders[B][0]>ce[1]-3)&&(ae++,++Y!==K.length);)pe=Z.featuresOnBorder[K[Y]];if(pe=Z.featuresOnBorder[K[te]],ae>1){const ue=pe.borders[B];Math.abs(ce[0]-ue[0])<3&&Math.abs(ce[1]-ue[1])<3&&(ae=1,Y=te+1)}else if(ae===0){u.showCentroid(he);continue}const Me=Z.centroidData[pe.centroidDataIndex];_&&ae===1&&(((R=ie).flags|(k=Me).flags)&o.cP?(R.flags|=o.cP,k.flags|=o.cP):(R.flags&=~o.cP,k.flags&=~o.cP));const se=he.intersectsCount()>1||pe.intersectsCount()>1;if(ae>1)Y=te,ie.centroidXY=Me.centroidXY=new o.P(0,0);else if(Q&&Q.dem&&!se){const ue=P[O](ie,Me),de=O%2?o.Y-1:0,W=L(ue[0],Math.min(o.Y-1,ue[1]),de,Q,$,O<2,ue[2]);ie.centroidXY=Me.centroidXY=b(W)}else se?ie.centroidXY=Me.centroidXY=new o.P(0,0):(ie.centroidXY=u.encodeBorderCentroid(he),Me.centroidXY=Z.encodeBorderCentroid(pe));u.writeCentroidToBuffer(ie),Z.writeCentroidToBuffer(Me)}else u.showCentroid(he)}u.borderDoneWithNeighborZ[O]=Z.canonical.z,Z.borderDoneWithNeighborZ[B]=u.canonical.z}var R,k;(u.needsCentroidUpdate||!u.centroidVertexBuffer&&u.centroidVertexArray.length!==0)&&u.uploadCentroid(c)}const eu=[1,0,0],Lh=[0,1,0],Pl=[0,0,1];function Ln(c,r,s){const u=s.transform,d=s.shadowRenderer;if(!d)return!0;const f=c.toUnwrapped(),_=u.tileSize*d._cascades[s.currentShadowCascade].scale;let y=r.maxHeight;if(u.elevation){const R=u.elevation.getMinMaxForTile(c);R&&(y+=R.max)}const b=[...d.shadowDirection];b[2]=-b[2];const T=d.computeSimplifiedTileShadowVolume(f,y,_,b);if(!T)return!1;const S=[eu,Lh,Pl,b,[b[0],0,b[2]],[0,b[1],b[2]]],A=u.projection.name==="globe",C=u.scaleZoom(_),P=o.bt.fromInvProjectionMatrix(u.invProjMatrix,u.worldSize,C,!A),L=d.getCurrentCascadeFrustum();return P.intersectsPrecise(T.vertices,T.planes,S)===0||L.intersectsPrecise(T.vertices,T.planes,S)===0}function zl(c){return[c[0]*o.cS,c[1]*o.cS,c[2]*o.cS,0]}function kn(c,r,s,u,d,f,_,y,b){const T=u.getSource(),S=s.globeSharedBuffers;if(!S)return;let A,C,P;if(r&&(A=u.getTile(r)),T instanceof o.as?(C=T.texture,P=o.co(0,0,s.transform)):A&&r&&(C=A.texture,P=o.co(r.canonical.z,r.canonical.x,s.transform)),!C||!P)return;c||(P=o.a9.scale(o.a9.create(),P,[1,-1,1]));const L=s.context,R=L.gl,k=d.paint.get("raster-resampling")==="nearest"?R.NEAREST:R.LINEAR,O=s.colorModeForDrapableLayerRenderPass(f),N=_.defines;N.push("GLOBE_POLES");const $=new lt(R.LEQUAL,lt.ReadWrite,s.depthRangeFor3D),Z=Float32Array.from(s.transform.expandedFarZProjMatrix),Q=Float32Array.from(o.aW(o.cn(new o.bv(0,0,0))));s.terrain&&s.terrain.prepareDrawTile(),L.activeTexture.set(R.TEXTURE0),C.bind(k,R.CLAMP_TO_EDGE),L.activeTexture.set(R.TEXTURE1),C.bind(k,R.CLAMP_TO_EDGE),C.useMipmap&&L.extTextureFilterAnisotropic&&s.transform.pitch>20&&R.texParameterf(R.TEXTURE_2D,L.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,L.extTextureFilterAnisotropicMax);const[B,U,K,Y]=r?S.getPoleBuffers(r.canonical.z,!1):S.getPoleBuffers(0,!0),re=d.paint.get("raster-elevation");let he;c?(he=B,s.renderDefaultNorthPole=re!==0):(he=U,s.renderDefaultSouthPole=re!==0);const ie=zl(_.mix),ce=((te,ae,Me,se,ue,de,W,xe,Ge,Xe,nt,et,at)=>zh(te,ae,Me,new Float32Array(16),new Float32Array(9),[0,0],se,[0,0],[0,0,0,0],1,{opacity:1,mix:0},de,[0,0],xe,2,Xe,nt,et,1,0,at))(Z,Q,P,o.W(s.transform.zoom),0,d,0,re,0,ie,_.offset,_.range,f),pe=s.getOrCreateProgram("raster",{defines:N});s.uploadCommonUniforms(L,pe,null),pe.draw(s,R.TRIANGLES,$,b,O,y,ce,d.id,he,K,Y)}function Dl(c){const r=c._nearZ,s=c.projection.farthestPixelDistance(c),u=s-r,d=.2*c.height,f=r+d;return[r,s,(f-d-r)/u,(f-r)/u]}function oo(c,r,s,u){if(c)return r instanceof Be&&c instanceof tl?r.getTextureDescriptor(c,s,!0):{texture:c.texture,mix:zl(u.mix),offset:u.offset,buffer:0,tileSize:1}}function Sp(c,r,s){if(!c)return null;const u=r.getTextureDescriptor(c,s,!0);if(!u)return null;let{texture:d,mix:f,offset:_,tileSize:y,buffer:b,format:T}=u;
vendor: 6,235 bytes, line 2108
2108if(!d||!T)return null;let S=!1;return T==="uint32"&&(S=!0,f[3]=0,f=la(o.cT,f,[0,s.paint.get("raster-particle-max-speed")]),_=Wc(o.cT,_,[0,s.paint.get("raster-particle-max-speed")])),{texture:d,textureOffset:[b/(y+2*b),y/(y+2*b)],tileSize:y,scalarData:S,scale:f,offset:_,defines:["RASTER_ARRAY",{uint8:"DATA_FORMAT_UINT8",uint16:"DATA_FORMAT_UINT16",uint32:"DATA_FORMAT_UINT32"}[T]]}}function Mp(c){const r=c._nearZ,s=c.projection.farthestPixelDistance(c),u=s-r,d=.2*c.height,f=r+d;return[r,s,(f-d-r)/u,(f-r)/u]}const tu=new o.aA(1,0,0,1),Ap=new o.aA(0,1,0,1),kh=new o.aA(0,0,1,1),Oh=new o.aA(1,0,1,1),iu=new o.aA(0,1,1,1);function ao(c,r,s,u,d,f,_){const y=c.context,b=c.transform,T=y.gl,S=b.projection.name==="globe",A=S?["PROJECTION_GLOBE_VIEW"]:[];let C=o.a9.clone(s.projMatrix);if(S&&o.W(b.zoom)>0){const ie=o.aV(s.canonical,b),ce=o.cU(ie);C=o.a9.multiply(new Float32Array(16),b.globeMatrix,ce),o.a9.multiply(C,b.projMatrix,C)}const P=o.a9.create();P[12]+=2*d/(o.f.devicePixelRatio*b.width),P[13]+=2*f/(o.f.devicePixelRatio*b.height),o.a9.multiply(C,P,C);const L=c.getOrCreateProgram("debug",{defines:A}),R=r.getTileByID(s.key);c.terrain&&c.terrain.setupElevationDraw(R,L);const k=lt.disabled,O=yt.disabled,N=c.colorModeForRenderPass(),$="$debug";y.activeTexture.set(T.TEXTURE0),c.emptyTexture.bind(T.LINEAR,T.CLAMP_TO_EDGE),S?R._makeGlobeTileDebugBuffers(c.context,b):R._makeDebugTileBoundsBuffers(c.context,b.projection);const Z=R._tileDebugBuffer||c.debugBuffer,Q=R._tileDebugIndexBuffer||c.debugIndexBuffer,B=R._tileDebugSegments||c.debugSegments;if(L.draw(c,T.LINE_STRIP,k,O,N,ft.disabled,$c(C,u),$,Z,Q,B,null,null,null,[R._globeTileDebugBorderBuffer]),_){const ie=R.latestRawTileData,ce=Math.floor((ie&&ie.byteLength||0)/1024);let pe=s.canonical.toString();s.overscaledZ!==s.canonical.z&&(pe+=` => ${s.overscaledZ}`),pe+=` ${R.state}`,pe+=` ${ce}kb`,function(te,ae){te.initDebugOverlayCanvas();const Me=te.debugOverlayCanvas,se=te.context.gl,ue=te.debugOverlayCanvas.getContext("2d");ue.clearRect(0,0,Me.width,Me.height),ue.shadowColor="white",ue.shadowBlur=2,ue.lineWidth=1.5,ue.strokeStyle="white",ue.textBaseline="top",ue.font="bold 36px Open Sans, sans-serif",ue.fillText(ae,5,5),ue.strokeText(ae,5,5),te.debugOverlayTexture.update(Me),te.debugOverlayTexture.bind(se.LINEAR,se.CLAMP_TO_EDGE)}(c,pe)}const U=r.getTile(s).tileSize,K=512/Math.min(U,512)*(s.overscaledZ/b.zoom)*.5,Y=R._tileDebugTextBuffer||c.debugBuffer,re=R._tileDebugTextIndexBuffer||c.quadTriangleIndexBuffer,he=R._tileDebugTextSegments||c.debugSegments;L.draw(c,T.TRIANGLES,k,O,Pt.alphaBlended,ft.disabled,$c(C,o.aA.transparent,K),$,Y,re,he,null,null,null,[R._globeTileDebugTextBuffer])}function Bh(c,r,s,u){Rl(c,0,r+s/2,c.transform.width,s,u)}function Fh(c,r,s,u){Rl(c,r-s/2,0,s,c.transform.height,u)}function Rl(c,r,s,u,d,f){const _=c.context,y=_.gl;y.enable(y.SCISSOR_TEST),y.scissor(r*o.f.devicePixelRatio,s*o.f.devicePixelRatio,u*o.f.devicePixelRatio,d*o.f.devicePixelRatio),_.clear({color:f}),y.disable(y.SCISSOR_TEST)}const Nh=o.aB([{name:"a_pos_3f",components:3,type:"Float32"}]),{members:Ip}=Nh;function ln(c,r,s,u){c.emplaceBack(r,s,u)}class Vh{constructor(r){this.vertexArray=new o.cV,this.indices=new o.az,ln(this.vertexArray,-1,-1,1),ln(this.vertexArray,1,-1,1),ln(this.vertexArray,-1,1,1),ln(this.vertexArray,1,1,1),ln(this.vertexArray,-1,-1,-1),ln(this.vertexArray,1,-1,-1),ln(this.vertexArray,-1,1,-1),ln(this.vertexArray,1,1,-1),this.indices.emplaceBack(5,1,3),this.indices.emplaceBack(3,7,5),this.indices.emplaceBack(6,2,0),this.indices.emplaceBack(0,4,6),this.indices.emplaceBack(2,6,7),this.indices.emplaceBack(7,3,2),this.indices.emplaceBack(5,4,0),this.indices.emplaceBack(0,1,5),this.indices.emplaceBack(0,2,3),this.indices.emplaceBack(3,1,0),this.indices.emplaceBack(7,6,4),this.indices.emplaceBack(4,5,7),this.vertexBuffer=r.createVertexBuffer(this.vertexArray,Ip),this.indexBuffer=r.createIndexBuffer(this.indices),this.segment=o.aE.simpleSegment(0,0,36,12)}}function Ss(c,r,s,u,d,f){const _=c.context.gl,y=r.paint.get("sky-atmosphere-color"),b=r.paint.get("sky-atmosphere-halo-color"),T=r.paint.get("sky-atmosphere-sun-intensity"),S=((A,C,P,L,R)=>({u_matrix_3f:A,u_sun_direction:C,u_sun_intensity:P,u_color_tint_r:[L.r,L.g,L.b,L.a],u_color_tint_m:[R.r,R.g,R.b,R.a],u_luminance:5e-5}))(o.ct.fromMat4(o.ct.create(),u),d,T,y,b);_.framebufferTexture2D(_.FRAMEBUFFER,_.COLOR_ATTACHMENT0,_.TEXTURE_CUBE_MAP_POSITIVE_X+f,r.skyboxTexture,0),s.draw(c,_.TRIANGLES,lt.disabled,yt.disabled,Pt.unblended,ft.frontCW,S,"skyboxCapture",r.skyboxGeometry.vertexBuffer,r.skyboxGeometry.indexBuffer,r.skyboxGeometry.segment)}const ru=o.aB([{type:"Float32",name:"a_pos",components:3},{type:"Float32",name:"a_uv",components:2}]);class Ll{constructor(r){const s=new o.cW;s.emplaceBack(-1,1,1,0,0),s.emplaceBack(1,1,1,1,0),s.emplaceBack(1,-1,1,1,1),s.emplaceBack(-1,-1,1,0,1);const u=new o.az;u.emplaceBack(0,1,2),u.emplaceBack(2,3,0),this.vertexBuffer=r.createVertexBuffer(s,ru.members),this.indexBuffer=r.createIndexBuffer(u),this.segments=o.aE.simpleSegment(0,0,4,2)}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy()}}const nu=o.aB([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_size_scale",components:1},{type:"Float32",name:"a_fade_opacity",components:1}]);class Ms{constructor(){this.starsCount=16e3,this.sizeMultiplier=.15,this.sizeRange=100,this.intensityRange=200}}class su{constructor(r){this.colorModeAlphaBlendedWriteRGB=new Pt([1,Ka,1,Ka],o.aA.transparent,[!0,!0,!0,!1]),this.colorModeWriteAlpha=new Pt([1,0,1,0],o.aA.transparent,[!1,!1,!1,!0]),this.params=new Ms,this.updateNeeded=!0,r.tp.registerParameter(this.params,["Stars"],"starsCount",{min:100,max:16e3,step:1},()=>{this.updateNeeded=!0}),r.tp.registerParameter(this.params,["Stars"],"sizeMultiplier",{min:.01,max:2,step:.01}),r.tp.registerParameter(this.params,["Stars"],"sizeRange",{min:0,max:200,step:1},()=>{this.updateNeeded=!0}),r.tp.registerParameter(this.params,["Stars"],"intensityRange",{min:0,max:200,step:1},()=>{this.updateNeeded=!0})}update(r){const s=r.context;if(!this.atmosphereBuffer||this.updateNeeded){this.updateNeeded=!1,this.atmosphereBuffer=new Ll(s);
2108const u=this.params.sizeRange,d=this.params.intensityRange,f=function(S){const A=o.aC(30),C=[];for(let P=0;P<S;++P){const L=2*Math.PI*A(),R=Math.acos(1-2*A())-.5*Math.PI;C.push(o.Q.fromValues(Math.cos(R)*Math.cos(L),Math.cos(R)*Math.sin(L),Math.sin(R)))}return C}(this.params.starsCount),_=o.aC(300),y=new o.cX,b=new o.az;let T=0;for(let S=0;S<f.length;++S){const A=o.Q.scale([],f[S],200),C=Math.max(0,1+.01*u*(1*_()-.5)),P=Math.max(0,1+.01*d*(1*_()-.5));y.emplaceBack(A[0],A[1],A[2],-1,-1,C,P),y.emplaceBack(A[0],A[1],A[2],1,-1,C,P),y.emplaceBack(A[0],A[1],A[2],1,1,C,P),y.emplaceBack(A[0],A[1],A[2],-1,1,C,P),b.emplaceBack(T+0,T+1,T+2),b.emplaceBack(T+0,T+2,T+3),T+=4}this.starsVx=s.createVertexBuffer(y,nu.members),this.starsIdx=s.createIndexBuffer(b),this.starsSegments=o.aE.simpleSegment(0,0,y.length,b.length)}}destroy(){this.atmosphereBuffer&&this.atmosphereBuffer.destroy(),this.starsVx&&this.starsVx.destroy(),this.starsIdx&&this.starsIdx.destroy()}drawAtmosphereGlow(r,s){const u=r.context,d=u.gl,f=r.transform,_=new lt(d.LEQUAL,lt.ReadOnly,[0,1]),y=o.W(f.zoom),b=s.properties.get("color").toArray01(),T=s.properties.get("high-color").toArray01(),S=s.properties.get("space-color").toArray01PremultipliedAlpha(),A=5e-4,C=o.cY(s.properties.get("horizon-blend"),0,1,A,.25),P=o.ci(r,u,f)&&C===A?f.worldSize/(2*Math.PI*1.025)-1:f.globeRadius,L=r.frameCounter/1e3%1,R=o.Q.length(f.globeCenterInViewSpace),k=Math.sqrt(Math.pow(R,2)-Math.pow(P,2)),O=Math.acos(k/R),N=$=>{const Z=f.projection.name==="globe"?["PROJECTION_GLOBE_VIEW","FOG"]:["FOG"];$&&Z.push("ALPHA_PASS");const Q=r.getOrCreateProgram("globeAtmosphere",{defines:Z}),B=((K,Y,re,he,ie,ce,pe,te,ae,Me,se,ue)=>({u_frustum_tl:K,u_frustum_tr:Y,u_frustum_br:re,u_frustum_bl:he,u_horizon:ie,u_transition:ce,u_fadeout_range:pe,u_color:te,u_high_color:ae,u_space_color:Me,u_temporal_offset:se,u_horizon_angle:ue}))(f.frustumCorners.TL,f.frustumCorners.TR,f.frustumCorners.BR,f.frustumCorners.BL,f.frustumCorners.horizon,y,C,b,T,S,L,O);r.uploadCommonUniforms(u,Q);const U=this.atmosphereBuffer;U&&Q.draw(r,d.TRIANGLES,_,yt.disabled,$?this.colorModeWriteAlpha:this.colorModeAlphaBlendedWriteRGB,ft.backCW,B,$?"atmosphere_glow_alpha":"atmosphere_glow",U.vertexBuffer,U.indexBuffer,U.segments)};N(!1),N(!0)}drawStars(r,s){const u=o.ad(s.properties.get("star-intensity"),0,1);if(u===0)return;const d=r.context,f=d.gl,_=r.transform,y=r.getOrCreateProgram("stars"),b=o.bl.identity([]);o.bl.rotateX(b,b,-_._pitch),o.bl.rotateZ(b,b,-_.angle),o.bl.rotateX(b,b,o.bm(_._center.lat)),o.bl.rotateY(b,b,-o.bm(_._center.lng));const T=o.a9.fromQuat(new Float32Array(16),b),S=o.a9.multiply([],_.starsProjMatrix,T),A=o.ct.fromMat4([],T),C=o.ct.invert([],A),P=[0,1,0];o.Q.transformMat3(P,P,C),o.Q.scale(P,P,this.params.sizeMultiplier);const L=[1,0,0];o.Q.transformMat3(L,L,C),o.Q.scale(L,L,this.params.sizeMultiplier);const R=(k=P,O=L,N=u,{u_matrix:Float32Array.from(S),u_up:k,u_right:O,u_intensity_multiplier:N});var k,O,N;r.uploadCommonUniforms(d,y),this.starsVx&&this.starsIdx&&y.draw(r,f.TRIANGLES,lt.disabled,yt.disabled,this.colorModeAlphaBlendedWriteRGB,ft.disabled,R,"atmosphere_stars",this.starsVx,this.starsIdx,this.starsSegments)}}function ou(c,r){const s=[...c],u=r.cameraWorldSizeForFog/r.worldSize,d=o.a9.identity([]);return o.a9.scale(d,d,[u,u,1]),o.a9.multiply(s,d,s),o.a9.multiply(s,r.worldToFogMatrix,s),s}function is(c,r,s,u){const d=s.material,f=u.context,{baseColorTexture:_,metallicRoughnessTexture:y}=d.pbrMetallicRoughness,{normalTexture:b,occlusionTexture:T,emissionTexture:S}=d;function A(C,P,L){if(C&&(c.push(P),f.activeTexture.set(f.gl.TEXTURE0+L),C.gfxTexture)){const{minFilter:R,magFilter:k,wrapS:O,wrapT:N}=C.sampler;C.gfxTexture.bindExtraParam(R,k,O,N)}}A(_,"HAS_TEXTURE_u_baseColorTexture",Tr.BaseColor),A(y,"HAS_TEXTURE_u_metallicRoughnessTexture",Tr.MetallicRoughness),A(b,"HAS_TEXTURE_u_normalTexture",Tr.Normal),A(T,"HAS_TEXTURE_u_occlusionTexture",Tr.Occlusion),A(S,"HAS_TEXTURE_u_emissionTexture",Tr.Emission),s.texcoordBuffer&&(c.push("HAS_ATTRIBUTE_a_uv_2f"),r.push(s.texcoordBuffer)),s.colorBuffer&&(c.push(s.colorBuffer.itemSize===12?"HAS_ATTRIBUTE_a_color_3f":"HAS_ATTRIBUTE_a_color_4f"),r.push(s.colorBuffer)),s.normalBuffer&&(c.push("HAS_ATTRIBUTE_a_normal_3f"),r.push(s.normalBuffer)),s.pbrBuffer&&(c.push("HAS_ATTRIBUTE_a_pbr"),c.push("HAS_ATTRIBUTE_a_heightBasedEmissiveStrength"),r.push(s.pbrBuffer)),d.alphaMode!=="OPAQUE"&&d.alphaMode!=="MASK"||c.push("UNPREMULT_TEXTURE_IN_SHADER"),d.defined||c.push("DIFFUSE_SHADED"),c.push("USE_STANDARD_DERIVATIVES")}function rs(c,r,s,u,d,f){const _=s.paint.get("model-opacity"),y=r.context,b=new lt(r.context.gl.LEQUAL,lt.ReadWrite,r.depthRangeFor3D),T=r.transform,S=c.mesh,A=S.material,C=A.pbrMetallicRoughness,P=r.style.fog;let L;L=r.transform.projection.zAxisUnit==="pixels"?[...c.nodeModelMatrix]:o.a9.multiply([],u.zScaleMatrix,c.nodeModelMatrix),o.a9.multiply(L,u.negCameraPosMatrix,L);const R=o.a9.invert([],L);o.a9.transpose(R,R);const k=s.paint.get("model-emissive-strength").constantOr(0),O=Al(new Float32Array(c.worldViewProjection),new Float32Array(L),new Float32Array(R),null,r,_,C.baseColorFactor,A.emissiveFactor,C.metallicFactor,C.roughnessFactor,A,k,s),N={defines:[]},$=[];
2108is(N.defines,$,S,r);const Z=r.shadowRenderer;Z&&(Z.useNormalOffset=!1);let Q=null;if(P){const K=ou(c.nodeModelMatrix,r.transform);if(Q=new Float32Array(K),T.projection.name!=="globe"){const Y=S.aabb.min,re=S.aabb.max,[he,ie]=P.getOpacityForBounds(K,Y[0],Y[1],re[0],re[1]);N.overrideFog=he>=Kt||ie>=Kt}}const B=Yn(r,s.paint.get("model-cutoff-fade-range"));B.shouldRenderCutoff&&N.defines.push("RENDER_CUTOFF");const U=r.getOrCreateProgram("model",N);r.uploadCommonUniforms(y,U,null,Q,B),r.renderPass!=="shadow"&&Z&&Z.setupShadowsFromMatrix(c.nodeModelMatrix,U),U.draw(r,y.gl.TRIANGLES,b,d,f,S.material.doubleSided?ft.disabled:ft.backCCW,O,s.id,S.vertexBuffer,S.indexBuffer,S.segments,s.paint,r.transform.zoom,void 0,$)}function fa(c,r,s,u,d,f,_){let y;y=c.projection.name==="globe"?o.c_(s,c):[...s],o.a9.multiply(y,y,r.matrix);const b=o.a9.multiply([],u,y);if(r.meshes)for(const T of r.meshes){if(T.material.alphaMode!=="BLEND"){_.push({mesh:T,depth:0,modelIndex:d,worldViewProjection:b,nodeModelMatrix:y});continue}const S=o.Q.transformMat4([],T.centroid,b);S[2]>0&&f.push({mesh:T,depth:S[2],modelIndex:d,worldViewProjection:b,nodeModelMatrix:y})}if(r.children)for(const T of r.children)fa(c,T,s,u,d,f,_)}function ma(c,r,s,u){const d=s.shadowRenderer;if(!d)return;const f=d.getShadowPassDepthMode(),_=d.getShadowPassColorMode(),y=d.calculateShadowPassMatrixFromMatrix(r),b=Dh(y);s.getOrCreateProgram("modelDepth",{defines:s._shadowMapDebug?[]:["DEPTH_TEXTURE"]}).draw(s,s.context.gl.TRIANGLES,f,yt.disabled,_,ft.backCCW,b,u.id,c.vertexBuffer,c.indexBuffer,c.segments,u.paint,s.transform.zoom,void 0,void 0)}function _a(c,r,s){const u=r.updateZoomBasedPaintProperties(),d=function(f,_,y){let b,T,S,A=f.terrain?f.terrain.exaggeration():0;if(f.terrain&&A>0){const C=f.terrain,P=C.findDEMTileFor(y);P&&P.dem?b=o.d0.create(C,y,P):A=0}if(A===0&&(_.terrainElevationMin=0,_.terrainElevationMax=0),A===_.validForExaggeration&&(A===0||b&&b._demTile&&b._demTile.tileID===_.validForDEMTile.id&&b._dem._timestamp===_.validForDEMTile.timestamp))return!1;for(const C in _.instancesPerModel){const P=_.instancesPerModel[C];for(let L=0;L<P.instancedDataArray.length;++L){const R=(b?A*b.getElevationAt(0|P.instancedDataArray.float32[16*L],0|P.instancedDataArray.float32[16*L+1],!0,!0):0)+P.instancesEvaluatedElevation[L];P.instancedDataArray.float32[16*L+6]=R,T=T?Math.min(_.terrainElevationMin,R):R,S=S?Math.max(_.terrainElevationMax,R):R}}return _.terrainElevationMin=T||0,_.terrainElevationMax=S||0,_.validForExaggeration=A,_.validForDEMTile=b&&b._demTile?{id:b._demTile.tileID,timestamp:b._dem._timestamp}:{id:void 0,timestamp:0},!0}(c,r,s);(u||d)&&(r.uploaded=!1,r.upload(c.context))}const Fr={shadowUniformsInitialized:!1,useSingleShadowCascade:!1,tileMatrix:new Float64Array(16),shadowTileMatrix:new Float32Array(16),aabb:new o.bV([0,0,0],[o.Y,o.Y,0])};function kl(c,r){const s=1<<c.canonical.z,u=r.getFreeCameraOptions().position,d=r.elevation,f=c.canonical.x/s,_=(c.canonical.x+1)/s,y=c.canonical.y/s,b=(c.canonical.y+1)/s;let T=r._centerAltitude;if(d){const P=d.getMinMaxForTile(c);P&&P.max>T&&(T=P.max)}const S=o.ad(u.x,f,_)-u.x,A=o.ad(u.y,y,b)-u.y,C=o.bo(T,r.center.lat)-u.z;return r._zoomFromMercatorZ(Math.sqrt(S*S+A*A+C*C))}function Ol(c,r,s,u,d,f,_){const y=c.context,b=c.renderPass==="shadow",T=c.shadowRenderer,S=b&&T?T.getShadowPassDepthMode():new lt(y.gl.LEQUAL,lt.ReadWrite,c.depthRangeFor3D),A=c.isTileAffectedByFog(f);if(s.meshes)for(const C of s.meshes){const P=["MODEL_POSITION_ON_GPU"],L=[];let R,k,O;u.instancedDataArray.length>20&&P.push("INSTANCED_ARRAYS");const N=Yn(c,r.paint.get("model-cutoff-fade-range"));if(N.shouldRenderCutoff&&P.push("RENDER_CUTOFF"),b&&T)R=c.getOrCreateProgram("modelDepth",{defines:P}),k=Dh(_.shadowTileMatrix,_.shadowTileMatrix,Float32Array.from(s.matrix)),O=T.getShadowPassColorMode();else{is(P,L,C,c),R=c.getOrCreateProgram("model",{defines:P,overrideFog:A});const Z=C.material,Q=Z.pbrMetallicRoughness,B=r.paint.get("model-opacity"),U=r.paint.get("model-emissive-strength").constantOr(0);k=Al(f.expandedProjMatrix,Float32Array.from(s.matrix),new Float32Array(16),null,c,B,Q.baseColorFactor,Z.emissiveFactor,Q.metallicFactor,Q.roughnessFactor,Z,U,r,d),T&&(_.shadowUniformsInitialized?R.setShadowUniformValues(y,T.getShadowUniformValues()):(T.setupShadows(f.toUnwrapped(),R,"model-tile",f.overscaledZ
vendor: 5,303 bytes, line 2108
2108),_.shadowUniformsInitialized=!0)),O=N.shouldRenderCutoff||B<1||Z.alphaMode!=="OPAQUE"?Pt.alphaBlended:Pt.unblended}c.uploadCommonUniforms(y,R,f.toUnwrapped(),null,N);const $=C.material.doubleSided?ft.disabled:ft.backCCW;if(u.instancedDataArray.length>20)L.push(u.instancedDataBuffer),R.draw(c,y.gl.TRIANGLES,S,yt.disabled,O,$,k,r.id,C.vertexBuffer,C.indexBuffer,C.segments,r.paint,c.transform.zoom,void 0,L,u.instancedDataArray.length);else{const Z=b?"u_instance":"u_normal_matrix";for(let Q=0;Q<u.instancedDataArray.length;++Q)k[Z]=new Float32Array(u.instancedDataArray.arrayBuffer,64*Q,16),R.draw(c,y.gl.TRIANGLES,S,yt.disabled,O,$,k,r.id,C.vertexBuffer,C.indexBuffer,C.segments,r.paint,c.transform.zoom,void 0,L)}}if(s.children)for(const C of s.children)Ol(c,r,C,u,d,f,_)}const Bl=[1,-1,1];function ga(c,r,s,u){if(!s.modelManager)return!0;const d=s.modelManager;if(!s.shadowRenderer)return!0;const f=s.shadowRenderer,_=r.aabb;let y=!0,b=c.maxHeight;if(b===0){let S=0;for(const A in c.instancesPerModel){const C=d.getModel(A,u);C?S=Math.max(S,Math.max(Math.max(C.aabb.max[0],C.aabb.max[1]),C.aabb.max[2])):y=!1}b=c.maxScale*S*1.41+c.maxVerticalOffset,y&&(c.maxHeight=b)}_.max[2]=b,_.min[2]+=c.terrainElevationMin,_.max[2]+=c.terrainElevationMax,o.Q.transformMat4(_.min,_.min,r.tileMatrix),o.Q.transformMat4(_.max,_.max,r.tileMatrix);const T=_.intersects(f.getCurrentCascadeFrustum());return s.currentShadowCascade===0&&(c.isInsideFirstShadowMapFrustum=T===2),T===0}class Uh{}class jh{constructor(){this._storage=new Map}getLinesFromTrianglesBuffer(r,s,u){{const A=this._storage.get(s.id);if(A)return A.lastUsedFrameIdx=r,A.buf}const d=u.gl,f=d.getBufferParameter(d.ELEMENT_ARRAY_BUFFER,d.BUFFER_SIZE),_=new ArrayBuffer(f),y=new Int16Array(_);d.getBufferSubData(d.ELEMENT_ARRAY_BUFFER,0,new Int16Array(_));const b=new o.d2;for(let A=0;A<f/2;A+=3){const C=y[A],P=y[A+1],L=y[A+2];b.emplaceBack(C,P),b.emplaceBack(P,L),b.emplaceBack(L,C)}const T=u.bindVertexArrayOES.current,S=new Uh;return S.buf=new pi(u,b),S.lastUsedFrameIdx=r,this._storage.set(s.id,S),u.bindVertexArrayOES.set(T),S.buf}update(r){for(const[s,u]of this._storage)r-u.lastUsedFrameIdx>30&&(u.buf.destroy(),this._storage.delete(s))}destroy(){for(const[r,s]of this._storage)s.buf.destroy(),this._storage.delete(r)}}const Fl={symbol:function(c,r,s,u,d){if(c.renderPass!=="translucent")return;const f=yt.disabled,_=c.colorModeForRenderPass();s.layout.get("text-variable-anchor")&&function(T,S,A,C,P,L,R){const k=S.transform,O=P==="map",N=L==="map";for(const $ of T){const Z=C.getTile($),Q=Z.getBucket(A);if(!Q||!Q.text||!Q.text.segments.get().length)continue;const B=o.b8(Q.textSizeData,k.zoom),U=ll($,Q.getProjection(),k),K=k.calculatePixelsToTileUnitsMatrix(Z),Y=qo(U,Z.tileID.canonical,N,O,k,Q.getProjection(),K),re=Q.hasIconTextFit()&&Q.hasIconData();if(B){const he=Math.pow(2,k.zoom-Z.tileID.overscaledZ);Rh(Q,O,N,R,o.cE,k,Y,$,he,B,re)}}}(u,c,s,r,s.layout.get("text-rotation-alignment"),s.layout.get("text-pitch-alignment"),d);const y=s.paint.get("icon-opacity").constantOr(1)!==0,b=s.paint.get("text-opacity").constantOr(1)!==0;s.layout.get("symbol-sort-key").constantOr(1)!==void 0&&(y||b)?pa(c,r,s,u,f,_):(y&&pa(c,r,s,u,f,_,{onlyIcons:!0}),b&&pa(c,r,s,u,f,_,{onlyText:!0})),r.map.showCollisionBoxes&&(Yc(c,r,s,u,s.paint.get("text-translate"),s.paint.get("text-translate-anchor"),!0),Yc(c,r,s,u,s.paint.get("icon-translate"),s.paint.get("icon-translate-anchor"),!1))},circle:function(c,r,s,u){if(c.renderPass!=="translucent")return;const d=s.paint.get("circle-opacity"),f=s.paint.get("circle-stroke-width"),_=s.paint.get("circle-stroke-opacity"),y=s.layout.get("circle-sort-key").constantOr(1)!==void 0,b=s.paint.get("circle-emissive-strength");if(d.constantOr(1)===0&&(f.constantOr(1)===0||_.constantOr(1)===0))return;const T=c.context,S=T.gl,A=c.transform,C=c.depthModeForSublayer(0,lt.ReadOnly),P=yt.disabled,L=c.colorModeForDrapableLayerRenderPass(b),R=A.projection.name==="globe",k=[o.a8(A.center.lng),o.ah(A.center.lat)],O=[];for(let $=0;$<u.length;$++){const Z=u[$],Q=r.getTile(Z),B=Q.getBucket(s);if(!B||B.projection.name!==A.projection.name)continue;const U=B.programConfigurations.get(s.id),K=o.cF(s),Y=c.isTileAffectedByFog(Z);R&&K.push("PROJECTION_GLOBE_VIEW");const re=c.getOrCreateProgram("circle",{config:U,defines:K,overrideFog:Y}),he=B.layoutVertexBuffer,ie=B.globeExtVertexBuffer,ce=B.indexBuffer,pe=A.projection.createInversionMatrix(A,Z.canonical),te={programConfiguration:U,program:re,layoutVertexBuffer:he,globeExtVertexBuffer:ie,indexBuffer:ce,uniformValues:o.cG(c,Z,Q,pe,k,s),tile:Q};if(y){const ae=B.segments.get();for(const Me of ae)O.push({segments:new o.aE([Me]),sortKey:Me.sortKey,state:te})}else O.push({segments:B.segments,sortKey:0,state:te})}y&&O.sort(($,Z)=>$.sortKey-Z.sortKey);const N={useDepthForOcclusion:A.depthOcclusionForSymbolsAndCircles};for(const $ of O){const{programConfiguration:Z,program:Q,layoutVertexBuffer:B,globeExtVertexBuffer:U,indexBuffer:K,uniformValues:Y,tile:re}=$.state,he=$.segments;c.terrain&&c.terrain.setupElevationDraw(re,Q,N),c.uploadCommonUniforms(T,Q,re.tileID.toUnwrapped()),Q.draw(c,S.TRIANGLES,C,P,L,ft.disabled,Y,s.id,B,K,he,s.paint,A.zoom,Z,[U])}},heatmap:function(c,r,s,u){if(s.paint.get("heatmap-opacity")!==0)if(c.renderPass==="offscreen"){const d=c.context,f
2108=d.gl,_=yt.disabled,y=new Pt([f.ONE,f.ONE,f.ONE,f.ONE],o.aA.transparent,[!0,!0,!0,!0]);(function(P,L,R,k){const O=P.gl,N=L.width*k,$=L.height*k;P.activeTexture.set(O.TEXTURE1),P.viewport.set([0,0,N,$]);let Z=R.heatmapFbo;if(!Z||Z&&(Z.width!==N||Z.height!==$)){Z&&Z.destroy();const Q=O.createTexture();O.bindTexture(O.TEXTURE_2D,Q),O.texParameteri(O.TEXTURE_2D,O.TEXTURE_WRAP_S,O.CLAMP_TO_EDGE),O.texParameteri(O.TEXTURE_2D,O.TEXTURE_WRAP_T,O.CLAMP_TO_EDGE),O.texParameteri(O.TEXTURE_2D,O.TEXTURE_MIN_FILTER,O.LINEAR),O.texParameteri(O.TEXTURE_2D,O.TEXTURE_MAG_FILTER,O.LINEAR),Z=R.heatmapFbo=P.createFramebuffer(N,$,!0,null),function(B,U,K,Y,re,he){const ie=B.gl;ie.texImage2D(ie.TEXTURE_2D,0,B.extRenderToTextureHalfFloat?ie.RGBA16F:ie.RGBA,re,he,0,ie.RGBA,B.extRenderToTextureHalfFloat?ie.HALF_FLOAT:ie.UNSIGNED_BYTE,null),Y.colorAttachment.set(K)}(P,0,Q,Z,N,$)}else O.bindTexture(O.TEXTURE_2D,Z.colorAttachment.get()),P.bindFramebuffer.set(Z.framebuffer)})(d,c,s,c.transform.projection.name==="globe"?.5:.25),d.clear({color:o.aA.transparent});const b=c.transform,T=b.projection.name==="globe",S=T?["PROJECTION_GLOBE_VIEW"]:[],A=T?ft.frontCCW:ft.disabled,C=[o.a8(b.center.lng),o.ah(b.center.lat)];for(let P=0;P<u.length;P++){const L=u[P];if(r.hasRenderableParent(L))continue;const R=r.getTile(L),k=R.getBucket(s);if(!k||k.projection.name!==b.projection.name)continue;const O=c.isTileAffectedByFog(L),N=k.programConfigurations.get(s.id),$=c.getOrCreateProgram("heatmap",{config:N,defines:S,overrideFog:O}),{zoom:Z}=c.transform;c.terrain&&c.terrain.setupElevationDraw(R,$),c.uploadCommonUniforms(d,$,L.toUnwrapped());const Q=b.projection.createInversionMatrix(b,L.canonical);$.draw(c,f.TRIANGLES,lt.disabled,_,y,A,vp(c,L,R,Q,C,Z,s.paint.get("heatmap-intensity")),s.id,k.layoutVertexBuffer,k.indexBuffer,k.segments,s.paint,c.transform.zoom,N,T?[k.globeExtVertexBuffer]:null)}d.viewport.set([0,0,c.width,c.height])}else c.renderPass==="translucent"&&(c.context.setColorMode(c.colorModeForRenderPass()),function(d,f){const _=d.context,y=_.gl,b=f.heatmapFbo;if(!b)return;_.activeTexture.set(y.TEXTURE0),y.bindTexture(y.TEXTURE_2D,b.colorAttachment.get()),_.activeTexture.set(y.TEXTURE1);let T=f.colorRampTexture;T||(T=f.colorRampTexture=new o.T(_,f.colorRamp,y.RGBA)),T.bind(y.LINEAR,y.CLAMP_TO_EDGE),d.getOrCreateProgram("heatmapTexture").draw(d,y.TRIANGLES,lt.disabled,yt.disabled,d.colorModeForRenderPass(),ft.disabled,((S,A,C,P)=>({u_image:0,u_color_ramp:1,u_opacity:A.paint.get("heatmap-opacity")}))(0,f),f.id,d.viewportBuffer,d.quadTriangleIndexBuffer,d.viewportSegments,f.paint,d.transform.zoom)}(c,s))},line:function(c,r,s,u){if(c.renderPass!=="translucent")return;const d=s.paint.get("line-opacity"),f=s.paint.get("line-width");if(d.constantOr(1)===0||f.constantOr(1)===0)return;const _=s.paint.get("line-emissive-strength"),y=c.depthModeForSublayer(0,lt.ReadOnly),b=c.colorModeForDrapableLayerRenderPass(_),T=c.terrain&&c.terrain.renderingToTexture?1:o.f.devicePixelRatio,S=s.paint.get("line-dasharray"),A=S.constantOr(1),C=s.layout.get("line-cap"),P=s.paint.get("line-pattern"),L=P.constantOr(1),R=s.paint.get("line-opacity").constantOr(1)!==1;let k=!L&&R;const O=s.paint.get("line-gradient"),N=L?"linePattern":"line",$=c.context,Z=$.gl,Q=o.cH(s);c.terrain&&c.terrain.clipOrMaskOverlapStencilType()&&(k=!1);for(const B of u){const U=r.getTile(B);if(L&&!U.patternsLoaded())continue;const K=U.getBucket(s);if(!K)continue;c.prepareDrawTile();const Y=K.programConfigurations.get(s.id),re=c.isTileAffectedByFog(B),he=c.getOrCreateProgram(N,{config:Y,defines:Q,overrideFog:re}),ie=P.constantOr(null);if(ie&&U.imageAtlas){const de=U.imageAtlas.patternPositions[ie.toString()];de&&Y.setConstantPatternPositions(de)}const ce=S.constantOr(null),pe=C.constantOr(null);if(!L&&ce&&pe&&U.lineAtlas){const de=U.lineAtlas.getDash(ce,pe);de&&Y.setConstantPatternPositions(de)}let[te,ae]=s.paint.get("line-trim-offset");(pe==="round"||pe==="square")&&te!==ae&&(te===0&&(te-=1),ae===1&&(ae+=1));const Me=c.terrain?B.projMatrix:null,se=L?o.cI(c,U,s,Me,T,[te,ae]):o.cJ(c,U,s,Me,K.lineClipsArray.length,T,[te,ae]);if(O){const de=K.gradients[s.id];let W=de.texture;if(s.gradientVersion!==de.version){let xe=256;if(s.stepInterpolant){const Ge=r.getSource().maxzoom,Xe=B.canonical.z===Ge?Math.ceil(1<<c.transform.maxZoom-B.canonical.z):1;xe=o.ad(o.cK(K.maxLineLength/o.Y*1024*Xe),256,$.maxTextureSize)}
2108de.gradient=o.cL({expression:s.gradientExpression(),evaluationKey:"lineProgress",resolution:xe,image:de.gradient||void 0,clips:K.lineClipsArray}),de.texture?de.texture.update(de.gradient):de.texture=new o.T($,de.gradient,Z.RGBA),de.version=s.gradientVersion,W=de.texture}$.activeTexture.set(Z.TEXTURE1),W.bind(s.stepInterpolant?Z.NEAREST:Z.LINEAR,Z.CLAMP_TO_EDGE)}A&&($.activeTexture.set(Z.TEXTURE0),U.lineAtlasTexture&&U.lineAtlasTexture.bind(Z.LINEAR,Z.REPEAT),Y.updatePaintBuffers()),L&&($.activeTexture.set(Z.TEXTURE0),U.imageAtlasTexture&&U.imageAtlasTexture.bind(Z.LINEAR,Z.CLAMP_TO_EDGE),Y.updatePaintBuffers()),c.uploadCommonUniforms($,he,B.toUnwrapped());const ue=de=>{he.draw(c,Z.TRIANGLES,y,de,b,ft.disabled,se,s.id,K.layoutVertexBuffer,K.indexBuffer,K.segments,s.paint,c.transform.zoom,Y,[K.layoutVertexBuffer2,K.patternVertexBuffer])};if(k){const de=c.stencilModeForClipping(B).ref;de===0&&c.terrain&&$.clear({stencil:0});const W={func:Z.EQUAL,mask:255};se.u_alpha_discard_threshold=.8,ue(new yt(W,de,255,Z.KEEP,Z.KEEP,Z.INVERT)),se.u_alpha_discard_threshold=0,ue(new yt(W,de,255,Z.KEEP,Z.KEEP,Z.KEEP))}else ue(c.stencilModeForClipping(B))}k&&(c.resetStencilClippingMasks(),c.terrain&&$.clear({stencil:0}))},fill:function(c,r,s,u){const d=s.paint.get("fill-color"),f=s.paint.get("fill-opacity");if(f.constantOr(1)===0)return;const _=s.paint.get("fill-emissive-strength"),y=c.colorModeForDrapableLayerRenderPass(_),b=s.paint.get("fill-pattern"),T=c.opaquePassEnabledForLayer()&&!b.constantOr(1)&&d.constantOr(o.aA.transparent).a===1&&f.constantOr(0)===1?"opaque":"translucent";if(c.renderPass===T){const S=c.depthModeForSublayer(1,c.renderPass==="opaque"?lt.ReadWrite:lt.ReadOnly);Cl(c,r,s,u,S,y,!1)}if(c.renderPass==="translucent"&&s.paint.get("fill-antialias")){const S=c.depthModeForSublayer(s.getPaintProperty("fill-outline-color")?2:0,lt.ReadOnly);Cl(c,r,s,u,S,y,!0)}},"fill-extrusion":function(c,r,s,u){const d=s.paint.get("fill-extrusion-opacity"),f=c.context,_=f.gl,y=c.terrain,b=y&&y.renderingToTexture;if(d===0)return;const T=c.conflationActive&&c.layerUsedInConflation(s,r.getSource());if(T&&function(S,A,C,P){for(const L of P){const R=A.getTile(L).getBucket(C);R&&(R.updateReplacement(L,S.replacementSource),R.uploadCentroid(S.context))}}(c,r,s,u),y||T)for(const S of u){const A=r.getTile(S).getBucket(s);A&&Kc(c.context,r,S,A,s,y,T)}if(c.renderPass==="shadow"&&c.shadowRenderer){const S=c.shadowRenderer;if(y&&d<.65&&s._transitionablePaint._values["fill-extrusion-opacity"].value.expression instanceof o.Z)return;const A=S.getShadowPassDepthMode(),C=S.getShadowPassColorMode();Ve(c,r,s,u,A,yt.disabled,C,T)}else if(c.renderPass==="translucent"){const S=!s.paint.get("fill-extrusion-pattern").constantOr(1),A=s.paint.get("fill-extrusion-color").constantOr(o.aA.white);if(!b&&A.a!==0){const C=new lt(c.context.gl.LEQUAL,lt.ReadWrite,c.depthRangeFor3D);d===1&&S?Ve(c,r,s,u,C,yt.disabled,Pt.unblended,T):(Ve(c,r,s,u,C,yt.disabled,Pt.disabled,T),Ve(c,r,s,u,C,c.stencilModeFor3D(),c.colorModeForRenderPass(),T),c.resetStencilClippingMasks())}if(c.style.enable3dLights()&&S&&(!y&&c.transform.projection.name!=="globe"||b)){const C=s.paint.get("fill-extrusion-opacity"),P=s.paint.get("fill-extrusion-ambient-occlusion-intensity"),L=s.paint.get("fill-extrusion-ambient-occlusion-ground-radius"),R=s.paint.get("fill-extrusion-flood-light-intensity"),k=s.paint.get("fill-extrusion-flood-light-color").toArray01().slice(0,3),O=P>0&&L>0,N=R>0,$=(Q,B,U)=>(1-U)*Q+U*B,Z=Q=>{const B=c.depthModeForSublayer(1,lt.ReadOnly,_.LEQUAL,!0),U=s.paint.get(Q?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"),K=$(.1,3,U),Y=c._showOverdrawInspector;if(!Y){const re=new yt({func:_.ALWAYS,mask:255},255,255,_.KEEP,_.KEEP,_.REPLACE),he=new Pt([_.ONE,_.ONE,_.ONE,_.ONE],o.aA.transparent,[!1,!1,!1,!0],_.MIN);Es(c,r,s,u,B,re,he,ft.disabled,Q,"sdf",C,P,L,R,k,K,T,!1)}{const re=Y?yt.disabled:new yt({func:_.EQUAL,mask:255},255,255,_.KEEP,_.DECR,_.DECR),he=Y?c.colorModeForRenderPass():new Pt([_.ONE_MINUS_DST_ALPHA,_.DST_ALPHA,_.ONE,_.ONE],o.aA.transparent,[!0,!0,!0,!0]);Es(c,r,s,u,B,re,he,ft.disabled,Q,"color",C,P,L,R,k,K,T,!1)}};if(b){const Q=(B,U,K)=>{const Y=c.depthModeForSublayer(1,lt.ReadOnly,_.LEQUAL,!1),re=s.paint.get(B?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"),he=$(.1,3,re);{const ie=new Pt([_.ONE,_.ONE,_.ONE,_.ONE],o.aA.transparent,[!1,!1,!1,!0]);Es(c,r,s,u,Y,yt.disabled,ie,ft.disabled,B,"clear",C,P,L,R,k,he,T,U)}{const ie=new yt({func:_.ALWAYS,mask:255},255,255,_.KEEP,_.KEEP,_.REPLACE),ce=new Pt([_.ONE,_.ONE,_.ONE,_.ONE],o.aA.transparent,[!1,!1,!1,!0],_.MIN);Es(c,r,s,u,Y,ie,ce,ft.disabled,B,"sdf",C,P,L,R,k,he,T,U)}{const ie=B?_.ZERO:_.ONE_MINUS_DST_ALPHA,ce=new yt({func:_.EQUAL,mask:255},255,255,_.KEEP,_.DECR,_.DECR),pe=new Pt([ie,_.DST_ALPHA,_.ONE_MINUS_DST_ALPHA,_.ZERO],o.aA.transparent,[!0,!0,!0,!0]);Es(c,r,s,u,Y,ce,pe,ft.disabled,B,"color",C,P,L,R,k,he,T,U)}{const ie=new Pt([_.ONE,_.ONE,_.ONE,B?_.ZERO:_.ONE],o.aA.transparent,[!1,!1,!1,!0],B?_.FUNC_ADD:_.MAX);Es(c,r,s,u,Y,yt.disabled,ie,ft.disabled,B,"clear",C,P,L,R,k,he,T,U,K)}};if(O||N){let B;if(c.prepareDrawTile(),y){const U=y.drapeBufferSize[0],K=y.drapeBufferSize[1];B=y.framebufferCopyTexture,B&&(!B||B.size[0]===U&&B.size[1]===K)||(B&&B.destroy(),B=y.framebufferCopyTexture=new o.T(f,new o.h({width:U,height:K}),_.RGBA)),B.bind(_.LINEAR,_.CLAMP_TO_EDGE),_.copyTexImage2D(_.TEXTURE_2D,0,_.RGBA,0,0,U,K,0)}O&&Q(!0,!1,B),N&&Q(!1,!0,B)}}else O&&Z(!0),N&&Z(!1)}}},hillshade:function(c,r,s,u){if(c.renderPass!=="offscreen"&&c.renderPass!=="translucent"||c.style.disableElevatedTerrain)return;
vendor: 15,802 bytes, line 2108
2108const d=c.context,f=c.terrain&&c.terrain.renderingToTexture,[_,y]=c.renderPass!=="translucent"||f?[{},u]:c.stencilConfigForOverlap(u);for(const b of y){const T=r.getTile(b);if(T.needsHillshadePrepare&&c.renderPass==="offscreen")eo(c,T,s);else if(c.renderPass==="translucent"){const S=c.depthModeForSublayer(0,lt.ReadOnly),A=s.paint.get("hillshade-emissive-strength"),C=c.colorModeForDrapableLayerRenderPass(A),P=f&&c.terrain?c.terrain.stencilModeForRTTOverlap(b):_[b.overscaledZ];Xt(c,b,T,s,S,P,C)}}d.viewport.set([0,0,c.width,c.height]),c.resetStencilClippingMasks()},raster:function(c,r,s,u,d,f){if(c.renderPass!=="translucent"||s.paint.get("raster-opacity")===0)return;const _=c.transform.projection.name==="globe",y=s.paint.get("raster-elevation")!==0,b=y&&_;if(c.renderElevatedRasterBackface&&!b)return;const T=c.context,S=T.gl,A=r.getSource(),C=function(B,U,K,Y){const re=U.paint.get("raster-color"),he=B.type==="raster-array",ie=[],ce=U.paint.get("raster-resampling"),pe=U.paint.get("raster-color-mix");let te=U.paint.get("raster-color-range");const ae=[pe[0],pe[1],pe[2],0],Me=pe[3];let se=ce==="nearest"?Y.NEAREST:Y.LINEAR;if(he&&(ie.push("RASTER_ARRAY"),re||ie.push("RASTER_COLOR"),ce==="linear"&&ie.push("RASTER_ARRAY_LINEAR"),se=Y.NEAREST,!te&&B.rasterLayers)){const ue=B.rasterLayers.find(({id:de})=>de===U.sourceLayer);ue&&ue.fields&&ue.fields.range&&(te=ue.fields.range)}if(te=te||[0,1],re){ie.push("RASTER_COLOR"),K.activeTexture.set(Y.TEXTURE2),U.updateColorRamp(te);let ue=U.colorRampTexture;ue||(ue=U.colorRampTexture=new o.T(K,U.colorRamp,Y.RGBA)),ue.bind(Y.LINEAR,Y.CLAMP_TO_EDGE)}return{mix:ae,range:te,offset:Me,defines:ie,resampling:se}}(A,s,T,S);if(A instanceof o.as&&!u.length&&!_)return;const P=s.paint.get("raster-emissive-strength"),L=c.colorModeForDrapableLayerRenderPass(P),R=c.terrain&&c.terrain.renderingToTexture,k=!c.options.moving,O=s.paint.get("raster-resampling")==="nearest"?S.NEAREST:S.LINEAR;if(A instanceof o.as&&!u.length&&(A.onNorthPole||A.onSouthPole)){const B=y?c.stencilModeFor3D():yt.disabled;return void kn(!!A.onNorthPole,null,c,r,s,P,C,ft.disabled,B)}if(!u.length)return;const[N,$]=A instanceof o.as||R?[{},u]:c.stencilConfigForOverlap(u),Z=$[$.length-1].overscaledZ;b&&C.defines.push("PROJECTION_GLOBE_VIEW"),y&&C.defines.push("RENDER_CUTOFF");const Q=(B,U,K)=>{for(const Y of B){const re=Y.toUnwrapped(),he=r.getTile(Y);if(R&&(!he||!he.hasData()))continue;T.activeTexture.set(S.TEXTURE0);const ie=oo(he,A,s,C);if(!ie||!ie.texture)continue;const{texture:ce,mix:pe,offset:te,tileSize:ae,buffer:Me}=ie;let se,ue;R?(se=lt.disabled,ue=Y.projMatrix):y?(se=new lt(S.LEQUAL,lt.ReadWrite,c.depthRangeFor3D),ue=_?Float32Array.from(c.transform.expandedFarZProjMatrix):c.transform.calculateProjMatrix(re,k)):(se=c.depthModeForSublayer(Y.overscaledZ-Z,s.paint.get("raster-opacity")===1?lt.ReadWrite:lt.ReadOnly,S.LESS),ue=c.transform.calculateProjMatrix(re,k));const de=c.terrain&&R?c.terrain.stencilModeForRTTOverlap(Y):N[Y.overscaledZ],W=f?0:s.paint.get("raster-fade-duration");he.registerFadeDuration(W);const xe=r.findLoadedParent(Y,0),Ge=bs(he,xe,r,c.transform,W);let Xe,nt;c.terrain&&c.terrain.prepareDrawTile(),T.activeTexture.set(S.TEXTURE0),ce.bind(O,S.CLAMP_TO_EDGE),T.activeTexture.set(S.TEXTURE1),xe?(xe.texture&&xe.texture.bind(O,S.CLAMP_TO_EDGE),Xe=Math.pow(2,xe.tileID.overscaledZ-he.tileID.overscaledZ),nt=[he.tileID.canonical.x*Xe%1,he.tileID.canonical.y*Xe%1]):ce.bind(O,S.CLAMP_TO_EDGE),ce.useMipmap&&T.extTextureFilterAnisotropic&&c.transform.pitch>20&&S.texParameterf(S.TEXTURE_2D,T.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,T.extTextureFilterAnisotropicMax);const et=c.transform;let at;const Ot=y?Dl(et):[0,0,0,0];let gt,Vt,Bt,bi,ii,qi=0;if(b&&A instanceof o.as&&A.coordinates.length>3)gt=Float32Array.from(o.aW(o.cn(new o.bv(0,0,0)))),Vt=Float32Array.from(et.globeMatrix),Bt=Float32Array.from(o.cj(et)),bi=[o.a8(et.center.lng),o.ah(et.center.lat)],at=A.elevatedGlobePerspectiveTransform,ii=A.elevatedGlobeGridMatrix||new Float32Array(9);else if(b){const St=o.ck(Y.canonical);qi=o.cl(St.getCenter().lat),gt=Float32Array.from(o.aW(o.cn(Y.canonical))),Vt=Float32Array.from(et.globeMatrix),Bt=Float32Array.from(o.cj(et)),bi=[o.a8(et.center.lng),o.ah(et.center.lat)],at=[0,0],ii=Float32Array.from(o.cm(Y.canonical,St,qi,et.worldSize/et._pixelsPerMercatorPixel))}else at=A instanceof o.as?A.perspectiveTransform:[0,0],gt=new Float32Array(16),Vt=new Float32Array(9),Bt=new Float32Array(16),bi=[0,0],ii=new Float32Array(9);const Bi=zh(ue,gt,Vt,Bt,ii,nt||[0,0],o.W(c.transform.zoom),bi,Ot,Xe||1,Ge,s,at,y?s.paint.get("raster-elevation"):0,2,pe,te,C.range,ae,Me,P),ui=c.isTileAffectedByFog(Y),ri=c.getOrCreateProgram("raster",{defines:C.defines,overrideFog:ui});if(c.uploadCommonUniforms(T,ri,re),A instanceof o.as){const St=A.elevatedGlobeVertexBuffer,It=A.elevatedGlobeIndexBuffer;if(R||!_)A.boundsBuffer&&A.boundsSegments&&ri.draw(c,S.TRIANGLES,se,yt.disabled,L,ft.disabled,Bi,s.id,A.boundsBuffer,c.quadTriangleIndexBuffer,A.boundsSegments);else if(St&&It){const gi=et.zoom<=o.bJ?A.elevatedGlobeSegments:A.getSegmentsForLongitude(et.center.lng);gi&&ri.draw(c,S.TRIANGLES,se,yt.disabled,L,U,Bi,s.id,St,It,gi)}}else if(b){se=new lt(S.LEQUAL,lt.ReadOnly,c.depthRangeFor3D);const St=c.globeSharedBuffers;if(St){const[It,gi,hi]=St.getGridBuffers(qi,!1);ri.draw(c,S.TRIANGLES,se,K||de,c.colorModeForRenderPass(),U,Bi,s.id,It,gi,hi)}}else{const{tileBoundsBuffer:St,tileBoundsIndexBuffer:It,tileBoundsSegments:gi}=c.getTileBoundsBuffers(he);ri.draw(c,S.TRIANGLES,se,de,L,ft.disabled,Bi,s.id,St,It,gi)}}if(!(A instanceof o.as)&&b)for(const Y of B){const re=Y.canonical.y===(1<<Y.canonical.z)-1;Y.canonical.y===0&&kn(!0,Y,c,r,s,P,C,U,K||yt.disabled),re&&kn(!1,Y,c,r,s,P,C,U===ft.frontCW?ft.backCW:ft.frontCW,K||yt.disabled)}};b?Q($,c.renderElevatedRasterBackface?ft.backCW:ft.frontCW,c.stencilModeFor3D()):Q($,ft.disabled,void 0),c.resetStencilClippingMasks()},"raster-particle":function(c,r,s,u,d,f){c.renderPass==="offscreen"&&function(_,y,b,T){if(!T.length)return;const S=_.context,A=S.gl,C=y.getSource();if(!(C instanceof Be))return;const P=Math.ceil(Math.sqrt(b.paint.get("raster-particle-count")));let L=b.particleFramebuffer;L?L.width!==P&&(L.destroy(),L=b.particleFramebuffer=S.createFramebuffer(P,P,!0,null)):L=b.particleFramebuffer=S.createFramebuffer(P,P,!0,null);const R=[];for(const N of T){const $=y.getTile(N);if(!($ instanceof tl))continue;const Z=Sp($,C,b);if(!Z)continue;const Q=[$.tileSize,$.tileSize];let B=b.tileFramebuffer;B||(B=b.tileFramebuffer=S.createFramebuffer(Q[0],Q[1],!0,null));let U=$.rasterParticleState;U||(U=$.rasterParticleState=new mh(S,N,Q,P));const K=U.update(b.lastInvalidatedAt);U.particleTextureDimension!==P&&U.setParticleTextureDimension(N,P);const Y=U.targetColorTexture;U.targetColorTexture=U.backgroundColorTexture,U.backgroundColorTexture=Y;const re=U.particleTexture0;U.particleTexture0=U.particleTexture1,U.particleTexture1=re,R.push([N,Z,U,K])}if(R.length===0)return;const k=o.f.now(),O=b.previousDrawTimestamp?.001*(k-b.previousDrawTimestamp):.0167;if(b.previousDrawTimestamp=k,b.hasColorMap()){S.activeTexture.set(A.TEXTURE0+2);let N=b.colorRampTexture;N||(N=b.colorRampTexture=new o.T(S,b.colorRamp,A.RGBA)),N.bind(A.LINEAR,A.CLAMP_TO_EDGE)}S.bindFramebuffer.set(b.tileFramebuffer.framebuffer),function(N,$,Z){const Q=N.context,B=Q.gl,U=$.tileFramebuffer;Q.activeTexture.set(B.TEXTURE0);const K={u_texture:0,u_opacity:1.05*(re=$.paint.get("raster-particle-fade-opacity-factor"))/(re+.05)},Y=N.getOrCreateProgram("rasterParticleTexture",{defines:[],overrideFog:!1});var re;for(const he of Z){const[,,ie,ce]=he;U.colorAttachment.set(ie.targetColorTexture.texture),Q.viewport.set([0,0,U.width,U.height]),Q.clear({color:o.aA.transparent}),ce&&(ie.backgroundColorTexture.bind(B.NEAREST,B.CLAMP_TO_EDGE),Y.draw(N,B.TRIANGLES,lt.disabled,yt.disabled,Pt.alphaBlended,ft.disabled,K,$.id,N.viewportBuffer,N.quadTriangleIndexBuffer,N.viewportSegments))}}(_,b,R),function(N,$,Z,Q){const B=N.context,U=B.gl,K=Z.tileFramebuffer,Y=N.transform.projection.name==="globe",re=Z.paint.get("raster-particle-max-speed");for(const he of Q){const[ie,ce,pe]=he;B.activeTexture.set(U.TEXTURE0+0),ce.texture.bind(U.LINEAR,U.CLAMP_TO_EDGE),K.colorAttachment.set(pe.targetColorTexture.texture);const te=N.getOrCreateProgram("rasterParticleDraw",{defines:ce.defines,overrideFog:!1});B.activeTexture.set(U.TEXTURE0+1);const ae=ce.scalarData?[]:[0,1,2,3].map(ue=>o.cN[ue](ie));ae.push(ie);const Me=ie.canonical.x,se=ie.canonical.y;for(const ue of ae){const de=$.getTile(Y?ue.wrapped():ue);if(!de)continue;const W=de.rasterParticleState;if(!W)continue;const xe=ue.canonical.x+(1<<ue.canonical.z)*(ue.wrap-ie.wrap),Ge=ue.canonical.y;W.particleTexture0.bind(U.NEAREST,U.CLAMP_TO_EDGE);const Xe=ua(1,W.particleTexture0.size[0],[xe-Me,Ge-se],0,ce.texture.size,2,re,ce.textureOffset,ce.scale,ce.offset);te.draw(N,U.POINTS,lt.disabled,yt.disabled,Pt.alphaBlended,ft.disabled,Xe,Z.id,W.particleIndexBuffer,void 0,W.particleSegment)}}}(_,y,b,R),S.bindFramebuffer.set(b.particleFramebuffer.framebuffer),function(N,$,Z,Q){const B=N.context,U=B.gl,K=$.paint.get("raster-particle-max-speed"),Y=Q*$.paint.get("raster-particle-speed-factor")*.3,re=function(ie){return Math.pow(ie,6)}(.01+1*$.paint.get("raster-particle-reset-rate-factor")),he=$.particleFramebuffer;B.viewport.set([0,0,he.width,he.height]);for(const ie of Z){const[,ce,pe]=ie;B.activeTexture.set(U.TEXTURE0+0),ce.texture.bind(U.LINEAR,U.CLAMP_TO_EDGE),B.activeTexture.set(U.TEXTURE0+1);const te=pe.particleTexture0;te.bind(U.NEAREST,U.CLAMP_TO_EDGE);const ae=wp(1,te.size[0],0,ce.texture.size,K,Y,re,ce.textureOffset,ce.scale,ce.offset);he.colorAttachment.set(pe.particleTexture1.texture),B.clear({color:o.aA.transparent}),N.getOrCreateProgram("rasterParticleUpdate",{defines:ce.defines}).draw(N,U.TRIANGLES,lt.disabled,yt.disabled,Pt.unblended,ft.disabled,ae,$.id,N.viewportBuffer,N.quadTriangleIndexBuffer,N.viewportSegments)}}(_,b,R,O)}(c,r,s,u),c.renderPass==="translucent"&&(function(_,y,b,T,S){const A=_.context,C=A.gl,P=!_.options.moving,L=_.transform.projection.name==="globe";if(!T.length)return;const[R,k]=_.stencilConfigForOverlap(T),O=[];L&&O.push("PROJECTION_GLOBE_VIEW");const N=_.stencilModeFor3D();for(const $ of k){const Z=$.toUnwrapped(),Q=y.getTile($);if(!Q.rasterParticleState)continue;const B=Q.rasterParticleState,U=100;Q.registerFadeDuration(U);const K=y.findLoadedParent($,0),Y=bs(Q,K,y,_.transform,U);let re,he;_.terrain&&_.terrain.prepareDrawTile(),A.activeTexture.set(C.TEXTURE0),B.targetColorTexture.bind(C.LINEAR,C.CLAMP_TO_EDGE),A.activeTexture.set(C.TEXTURE1),K&&K.rasterParticleState?(K.rasterParticleState.targetColorTexture.bind(C.LINEAR,C.CLAMP_TO_EDGE),re=Math.pow(2,K.tileID.overscaledZ-Q.tileID.overscaledZ),he=[Q.tileID.canonical.x*re%1,Q.tileID.canonical.y*re%1]):B.targetColorTexture.bind(C.LINEAR,C.CLAMP_TO_EDGE);const ie=L?Float32Array.from(_.transform.expandedFarZProjMatrix):_.transform.calculateProjMatrix(Z,P),ce=_.transform,pe=Mp(ce),te=o.ck($.canonical),ae=o.cl(te.getCenter().lat);let Me,se,ue,de,W;L?(Me=Float32Array.from(o.aW(o.cn($.canonical))),se=Float32Array.from(ce.globeMatrix),ue=Float32Array.from(o.cj(ce)),de=[o.a8(ce.center.lng),o.ah(ce.center.lat)],W=Float32Array.from(o.cm($.canonical,te,ae,ce.worldSize/ce._pixelsPerMercatorPixel))):(Me=new Float32Array(16),se=new Float32Array(9),ue=new Float32Array(16),de=[0,0],W=new Float32Array(9));const xe=ca(ie,Me,se,ue,W,he||[0,0],o.W(_.transform.zoom),de,pe,re||1,Y,250),Ge=_.isTileAffectedByFog($),Xe=_.getOrCreateProgram("rasterParticle",{defines:O,overrideFog:Ge});if(_.uploadCommonUniforms(A,Xe,Z),L){const nt=new lt(C.LEQUAL,lt.ReadWrite,_.depthRangeFor3D),et=0,at=_.globeSharedBuffers;if(at){const[Ot,gt,Vt]=at.getGridBuffers(ae,et!==0);Xe.draw(_,C.TRIANGLES,nt,N,Pt.alphaBlended,ft.backCCW,xe,b.id,Ot,gt,Vt)}}else{const nt=_.depthModeForSublayer(0,lt.ReadOnly),et=R[$.overscaledZ],{tileBoundsBuffer:at,tileBoundsIndexBuffer:Ot,tileBoundsSegments:gt}=_.getTileBoundsBuffers(Q);Xe.draw(_,C.TRIANGLES,nt,et,Pt.alphaBlended,ft.disabled,xe,b.id,at,Ot,gt)}}_.resetStencilClippingMasks()}(c,r,s,u),c.style.map.triggerRepaint())},background:function(c,r,s,u){const d=s.paint.get("background-color"),f=s.paint.get("background-opacity"),_=s.paint.get("background-emissive-strength");if(f===0)return;const y=c.context,b=y.gl,T=c.transform,S=T.tileSize,A=s.paint.get("background-pattern");if(c.isPatternMissing(A,s.scope))return;const C=!A&&d.a===1&&f===1&&c.opaquePassEnabledForLayer()?"opaque":"translucent";if(c.renderPass!==C)return;const P=yt.disabled,L=c.depthModeForSublayer(0,C==="opaque"?lt.ReadWrite:lt.ReadOnly),R=c.colorModeForDrapableLayerRenderPass(_),k=A?"backgroundPattern":"background";let O,N=u;N||(O=c.getBackgroundTiles(),N=Object.values(O).map($=>$.tileID)),A&&(y.activeTexture.set(b.TEXTURE0),c.imageManager.bind(c.context,s.scope));for(const $ of N){const Z=c.isTileAffectedByFog($),Q=c.getOrCreateProgram(k,{overrideFog:Z}),B=$.toUnwrapped(),U=u?$.projMatrix:c.transform.calculateProjMatrix(B);c.prepareDrawTile();const K=r?r.getTile($):O?O[$.key]:new en($,S,T.zoom,c),Y=A?Ep(U,_,f,c,A,s.scope,{tileID:$,tileSize:S}):Tp(U,_,f,d);c.uploadCommonUniforms(y,Q,B);const{tileBoundsBuffer:re,tileBoundsIndexBuffer:he,tileBoundsSegments:ie}=c.getTileBoundsBuffers(K);Q.draw(c,b.TRIANGLES,L,P,R,ft.disabled,Y,s.id,re,he,ie)}},sky:function(c,r,s){const u=c._atmosphere?o.W(c.transform.zoom):1,d=s.paint.get("sky-opacity")*u;if(d===0)return;const f=c.context,_=s.paint.get("sky-type"),y=new lt(f.gl.LEQUAL,lt.ReadOnly,[0,1]),b=c.frameCounter/1e3%1;_==="atmosphere"?c.renderPass==="offscreen"?s.needsSkyboxCapture(c)&&(function(T,S,A,C){const P=T.context,L=P.gl;let R=S.skyboxFbo;if(!R){R=S.skyboxFbo=P.createFramebuffer(32,32,!0,null),S.skyboxGeometry=new Vh(P),S.skyboxTexture=P.gl.createTexture(),L.bindTexture(L.TEXTURE_CUBE_MAP,S.skyboxTexture),L.texParameteri(L.TEXTURE_CUBE_MAP,L.TEXTURE_WRAP_S,L.CLAMP_TO_EDGE),L.texParameteri(L.TEXTURE_CUBE_MAP,L.TEXTURE_WRAP_T,L.CLAMP_TO_EDGE),L.texParameteri(L.TEXTURE_CUBE_MAP,L.TEXTURE_MIN_FILTER,L.LINEAR),L.texParameteri(L.TEXTURE_CUBE_MAP,L.TEXTURE_MAG_FILTER,L.LINEAR);for(let $=0;$<6;++$)L.texImage2D(L.TEXTURE_CUBE_MAP_POSITIVE_X+$,0,L.RGBA,32,32,0,L.RGBA,L.UNSIGNED_BYTE,null)}P.bindFramebuffer.set(R.framebuffer),P.viewport.set([0,0,32,32]);const k=S.getCenter(T,!0),O=T.getOrCreateProgram("skyboxCapture"),N=new Float64Array(16);o.a9.identity(N),o.a9.rotateY(N,N,.5*-Math.PI),Ss(T,S,O,N,k,0),o.a9.identity(N),o.a9.rotateY(N,N,.5*Math.PI),Ss(T,S,O,N,k,1),o.a9.identity(N),o.a9.rotateX(N,N,.5*-Math.PI),Ss(T,S,O,N,k,2),o.a9.identity(N),o.a9.rotateX(N,N,.5*Math.PI),Ss(T,S,O,N,k,3),o.a9.identity(N),Ss(T,S,O,N,k,4),o.a9.identity(N),o.a9.rotateY(N,N,Math.PI),Ss(T,S,O,N,k,5),P.viewport.set([0,0,T.width,T.height])}(c,s),s.markSkyboxValid(c)):c.renderPass==="sky"&&function(T,S,A,C,P){const L=T.context,R=L.gl,k=T.transform,O=T.getOrCreateProgram("skybox");L.activeTexture.set(R.TEXTURE0),R.bindTexture(R.TEXTURE_CUBE_MAP,S.skyboxTexture);const N=(($,Z,Q,B,U)=>({u_matrix:$,u_sun_direction:Z,u_cubemap:0,u_opacity:B,u_temporal_offset:U}))(k.skyboxMatrix,S.getCenter(T,!1),0,C,P);T.uploadCommonUniforms(L,O),O.draw(T,R.TRIANGLES,A,yt.disabled,T.colorModeForRenderPass(),ft.backCW,N,"skybox",S.skyboxGeometry.vertexBuffer,S.skyboxGeometry.indexBuffer,S.skyboxGeometry.segment)}(c,s,y,d,b):_==="gradient"&&c.renderPass==="sky"&&function(T,S,A,C,P){const L=T.context,R=L.gl,k=T.transform,O=T.getOrCreateProgram("skyboxGradient");S.skyboxGeometry||(S.skyboxGeometry=new Vh(L)),L.activeTexture.set(R.TEXTURE0);let N=S.colorRampTexture;N||(N=S.colorRampTexture=new o.T(L,S.colorRamp,R.RGBA)),N.bind(R.LINEAR,R.CLAMP_TO_EDGE);const $=((Z,Q,B,U,K)=>({u_matrix:Z,u_color_ramp:0,u_center_direction:Q,u_radius:o.bm(B
2108),u_opacity:U,u_temporal_offset:K}))(k.skyboxMatrix,S.getCenter(T,!1),S.paint.get("sky-gradient-radius"),C,P);T.uploadCommonUniforms(L,O),O.draw(T,R.TRIANGLES,A,yt.disabled,T.colorModeForRenderPass(),ft.backCW,$,"skyboxGradient",S.skyboxGeometry.vertexBuffer,S.skyboxGeometry.indexBuffer,S.skyboxGeometry.segment)}(c,s,y,d,b)},debug:function(c,r,s,u,d,f){for(let _=0;_<s.length;_++)if(d){const T=new o.aA(u.r*.8,u.g*.8,u.b*.8,1);ao(c,r,s[_],u,-1,-1,f),ao(c,r,s[_],u,-1,1,f),ao(c,r,s[_],u,1,1,f),ao(c,r,s[_],u,1,-1,f),ao(c,r,s[_],T,0,0,f)}else ao(c,r,s[_],u,0,0,f)},custom:function(c,r,s,u){const d=c.context,f=s.implementation;if(!c.transform.projection.unsupportedLayers||!c.transform.projection.unsupportedLayers.includes("custom")||c.terrain&&(c.terrain.renderingToTexture||c.renderPass==="offscreen")&&s.isDraped(r)){if(c.renderPass==="offscreen"){const _=f.prerender;if(_){if(c.setCustomLayerDefaults(),d.setColorMode(c.colorModeForRenderPass()),c.transform.projection.name==="globe"){const y=c.transform.pointMerc;_.call(f,d.gl,c.transform.customLayerMatrix(),c.transform.getProjection(),c.transform.globeToMercatorMatrix(),o.W(c.transform.zoom),[y.x,y.y],c.transform.pixelsPerMeterRatio)}else _.call(f,d.gl,c.transform.customLayerMatrix());d.setDirty(),c.setBaseState()}}else if(c.renderPass==="translucent"){if(c.terrain&&c.terrain.renderingToTexture){const y=f.renderToTile;if(y){const b=u[0].canonical,T=new o.O(b.x+u[0].wrap*(1<<b.z),b.y,b.z);d.setDepthMode(lt.disabled),d.setStencilMode(yt.disabled),d.setColorMode(c.colorModeForRenderPass()),c.setCustomLayerDefaults(),y.call(f,d.gl,T),d.setDirty(),c.setBaseState()}return}c.setCustomLayerDefaults(),d.setColorMode(c.colorModeForRenderPass()),d.setStencilMode(yt.disabled);const _=f.renderingMode==="3d"?new lt(c.context.gl.LEQUAL,lt.ReadWrite,c.depthRangeFor3D):c.depthModeForSublayer(0,lt.ReadOnly);if(d.setDepthMode(_),c.transform.projection.name==="globe"){const y=c.transform.pointMerc;f.render(d.gl,c.transform.customLayerMatrix(),c.transform.getProjection(),c.transform.globeToMercatorMatrix(),o.W(c.transform.zoom),[y.x,y.y],c.transform.pixelsPerMeterRatio)}else f.render(d.gl,c.transform.customLayerMatrix());d.setDirty(),c.setBaseState(),d.bindFramebuffer.set(null)}}else o.w("Custom layers are not yet supported with this projection. Use mercator or globe to enable usage of custom layers.")},model:function(c,r,s,u){if(c.renderPass==="opaque")return;const d=s.paint.get("model-opacity");if(d===0)return;const f=s.paint.get("model-cast-shadows");if(c.renderPass==="shadow"&&(!f||c.terrain&&d<.65&&s._transitionablePaint._values["model-opacity"].value.expression instanceof o.Z))return;const _=c.shadowRenderer,y=s.paint.get("model-receive-shadows");_&&(_.useNormalOffset=!0,y||(_.enabled=!1));const b=()=>{_&&(_.useNormalOffset=!0,y||(_.enabled=!0))},T=r.getSource();if(c.renderPass==="light-beam"&&T.type!=="batched-model")return;if(T.type==="vector"||T.type==="geojson")return function(O,N,$,Z,Q){const B=O.transform;if(B.projection.name!=="mercator")return void o.w(`Drawing 3D models for ${B.projection.name} projection is not yet implemented`);const U=B.getFreeCameraOptions().position;if(!O.modelManager)return;const K=O.modelManager;$.modelManager=K;const Y=O.shadowRenderer;if(!$._unevaluatedLayout._values.hasOwnProperty("model-id"))return;const re=$._unevaluatedLayout._values["model-id"],he={...$.layout.get("model-id").parameters};for(const ie of Z){const ce=N.getTile(ie).getBucket($);if(!ce||ce.projection.name!==B.projection.name)continue;const pe=ce.getModelUris();pe&&!ce.modelsRequested&&(K.addModelsFromBucket(pe,Q),ce.modelsRequested=!0);const te=kl(ie,B);he.zoom=te;const ae=re.possiblyEvaluate(he);if(_a(O,ce,ie),Fr.shadowUniformsInitialized=!1,Fr.useSingleShadowCascade=!!Y&&Y.getMaxCascadeForTile(ie.toUnwrapped())===0,O.renderPass==="shadow"&&Y){if(O.currentShadowCascade===1&&ce.isInsideFirstShadowMapFrustum)continue;const ue=B.calculatePosMatrix(ie.toUnwrapped(),B.worldSize);if(Fr.tileMatrix.set(ue),Fr.shadowTileMatrix=Float32Array.from(Y.calculateShadowPassMatrixFromMatrix(ue)),Fr.aabb.min.fill(0),Fr.aabb.max[0]=Fr.aabb.max[1]=o.Y,Fr.aabb.max[2]=0,ga(ce,Fr,O,$.scope))continue}const Me=1<<ie.canonical.z,se=[((U.x-ie.wrap)*Me-ie.canonical.x)*o.Y,(U.y*Me-ie.canonical.y)*o.Y,U.z*Me*o.Y];for(let ue in ce.instancesPerModel){const de=ce.instancesPerModel[ue];de.features.length>0&&(ue=ae.evaluate(de.features[0].feature,{}));const W=K.getModel(ue,Q);if(W&&W.uploaded)for(const xe of W.nodes)Ol(O,$,xe,de,se,ie,Fr)}}}(c,r,s,u,T.type==="vector"?s.scope:""),void b();if(!T.loaded())return;if(T.type==="batched-model")return function(O,N,$,Z){$.resetLayerRenderingStats(O);const Q=O.context,B=O.transform,U=O.style.fog,K=O.shadowRenderer;if(B.projection.name!=="mercator")return void o.w(`Drawing 3D landmark models for ${B.projection.name} projection is not yet implemented`);const Y=O.transform.getFreeCameraOptions().position,re=o.Q.scale([],[Y.x,Y.y,Y.z],O.transform.worldSize);o.Q.negate(re,re);const he=o.a9.identity([]),ie=o.cZ(B.center.lat,B.zoom),ce=o.a9.fromScaling([],[1,1,1/ie]);o.a9.translate(he,he,re);const pe=$.paint.get("model-opacity"),te=new lt(Q.gl.LEQUAL,lt.ReadWrite,O.depthRangeFor3D),ae=new lt(Q.gl.LEQUAL,lt.ReadOnly,O.depthRangeFor3D),Me=new o.bV([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),se=O.renderPass==="shadow",ue=se&&K?K.getCurrentCascadeFrustum():B.getFrustum(B.scaleZoom(B.worldSize)),de=$.getLayerRenderingStats(),W=function(xe,Ge){for(const Xe of Z){const nt=N.getTile(Xe).getBucket($);if(!nt||!nt.uploaded)continue;let et=!1;K&&(et=K.getMaxCascadeForTile(Xe.toUnwrapped())===0);const at=B.calculatePosMatrix(Xe.toUnwrapped(),B.worldSize),Ot=nt.modelTraits;
2108for(const gt of nt.getNodesInfo()){if(gt.hiddenByReplacement||!gt.node.meshes)continue;const Vt=gt.evaluatedScale,Bt=gt.node;let bi=0;if(O.terrain&&Bt.elevation&&(bi=Bt.elevation*O.terrain.exaggeration()),Vt[0]<=1&&Vt[1]<=1&&Vt[2]<=1&&(()=>{const Dt=gt.getLocalBounds();return Me.min=[...Dt.min],Me.max=[...Dt.max],Me.min[2]+=bi,Me.max[2]+=bi,o.Q.transformMat4(Me.min,Me.min,at),o.Q.transformMat4(Me.max,Me.max,at),Me})().intersects(ue)===0)continue;const ii=[...at];o.a9.translate(ii,ii,[(Bt.anchor?Bt.anchor[0]:0)*(Vt[0]-1),(Bt.anchor?Bt.anchor[1]:0)*(Vt[1]-1),bi]),o.Q.exactEquals(Vt,o.c$)||o.a9.scale(ii,ii,Vt);const qi=o.a9.multiply([],ii,Bt.matrix);let Bi=o.a9.multiply([],ce,ii);o.a9.multiply(Bi,he,Bi);const ui=o.a9.invert([],Bi);o.a9.transpose(ui,ui),o.a9.scale(ui,ui,Bl),Bi=o.a9.multiply(Bi,Bi,Bt.matrix);const ri=O.renderPass==="light-beam",St=o.a9.multiply([],B.expandedFarZProjMatrix,qi),It=o.a9.multiply([],B.expandedFarZProjMatrix,ii),gi=Ot&o.d1.HasMapboxMeshFeatures,hi=gi?0:gt.evaluatedRMEA[0][2];for(let Dt=0;Dt<Bt.meshes.length;++Dt){const vt=Bt.meshes[Dt],br=Dt===Bt.lightMeshIndex;let ar=St;if(br){if(!ri&&!O.terrain&&O.shadowRenderer){O.currentLayer<O.firstLightBeamLayer&&(O.firstLightBeamLayer=O.currentLayer);continue}ar=It}else if(ri)continue;const Qi={defines:[]},lr=[];if(is(Qi.defines,lr,vt,O),gi||Qi.defines.push("DIFFUSE_SHADED"),et&&Qi.defines.push("SHADOWS_SINGLE_CASCADE"),de&&(se?de.numRenderedVerticesInShadowPass+=vt.vertexArray.length:de.numRenderedVerticesInTransparentPass+=vt.vertexArray.length),se){ma(vt,qi,O,$);continue}let wr=null;if(U){const cn=ou(qi,O.transform);if(wr=new Float32Array(cn),B.projection.name!=="globe"){const bn=vt.aabb.min,wn=vt.aabb.max,[os,Zr]=U.getOpacityForBounds(cn,bn[0],bn[1],wn[0],wn[1]);Qi.overrideFog=os>=Kt||Zr>=Kt}}const pr=vt.material;let Hi;pr.occlusionTexture&&pr.occlusionTexture.offsetScale&&(Hi=pr.occlusionTexture.offsetScale,Qi.defines.push("OCCLUSION_TEXTURE_TRANSFORM")),!se&&K&&(K.useNormalOffset=!!vt.normalBuffer);const er=O.getOrCreateProgram("model",Qi);!se&&K&&K.setupShadowsFromMatrix(ii,er,K.useNormalOffset),O.uploadCommonUniforms(Q,er,null,wr);const tr=pr.pbrMetallicRoughness;tr.metallicFactor=.9,tr.roughnessFactor=.5;const vn=Al(new Float32Array(ar),new Float32Array(Bi),new Float32Array(ui),new Float32Array(Bt.matrix),O,pe,tr.baseColorFactor,pr.emissiveFactor,tr.metallicFactor,tr.roughnessFactor,pr,hi,$,[0,0,0],Hi);er.draw(O,Q.gl.TRIANGLES,Ge&&!br?te:ae,yt.disabled,xe?br||pe<1||gt.hasTranslucentParts?Pt.alphaBlended:Pt.unblended:Pt.disabled,ft.backCCW,vn,$.id,vt.vertexBuffer,vt.indexBuffer,vt.segments,$.paint,O.transform.zoom,void 0,lr)}}}};(function(xe,Ge,Xe,nt){const et=xe.terrain?xe.terrain.exaggeration():0,at=xe.transform.zoom;for(const Ot of nt){const gt=Ge.getTile(Ot).getBucket(Xe);gt&&(xe.conflationActive&&gt.updateReplacement(Ot,xe.replacementSource),gt.evaluateScale(xe,Xe),xe.terrain&&et>0&&gt.elevationUpdate(xe.terrain,et,Ot,Xe.source),gt.needsReEvaluation(xe,at,Xe)&&gt.evaluate(Xe))}})(O,N,$,Z),pe===1?W(!0,!0):(W(!1,!0),W(!0,!1))}(c,r,s,u),void b();const S=T.getModels(),A=[],C=c.transform.getFreeCameraOptions().position,P=o.Q.scale([],[C.x,C.y,C.z],c.transform.worldSize);o.Q.negate(P,P);const L=[],R=[];let k=0;for(const O of S){const N=s.paint.get("model-rotation").constantOr(null),$=s.paint.get("model-scale").constantOr(null),Z=s.paint.get("model-translation").constantOr(null);O.computeModelMatrix(c,N,$,Z,!0,!0,!1);const Q=o.a9.identity([]),B=o.cZ(O.position.lat,c.transform.zoom),U=o.a9.fromScaling([],[1,1,1/B]);o.a9.translate(Q,Q,P),A.push({zScaleMatrix:U,negCameraPosMatrix:Q});for(const K of O.nodes)fa(c.transform,K,O.matrix,c.transform.expandedFarZProjMatrix,k,L,R);k++}if(L.sort((O,N)=>N.depth-O.depth),c.renderPass!=="shadow"){if(d===1)for(const O of R)rs(O,c,s,A[O.modelIndex],yt.disabled,c.colorModeForRenderPass());else{for(const O of R)rs(O,c,s,A[O.modelIndex],yt.disabled,Pt.disabled);for(const O of R)rs(O,c,s,A[O.modelIndex],c.stencilModeFor3D(),c.colorModeForRenderPass());c.resetStencilClippingMasks()}for(const O of L)rs(O,c,s,A[O.modelIndex],yt.disabled,c.colorModeForRenderPass());b()}else{for(const O of R)ma(O.mesh,O.nodeModelMatrix,c,s);for(const O of L)ma(O.mesh,O.nodeModelMatrix,c,s);b()}}},As={model:function(c,r,s){const u=r.getSource();if(!u.loaded())return;if(u.type==="vector"||u.type==="geojson")return void(s.modelManager&&s.modelManager.upload(s,u.type==="vector"?c.scope:""));if(u.type==="batched-model")return;const d=u.getModels();for(const f of d)f.upload(s.context)},raster:function(c,r,s){const u=r.getSource();if(!(u instanceof Be&&u.loaded()))return;const d=c.sourceLayer||u.rasterLayerIds&&u.rasterLayerIds[0];if(!d)return;const f=c.paint.get("raster-array-band")||u.getInitialBand(d);if(f==null)return;const _=r.getIds().map(y=>r.getTileByID(y));for(const y of _)y.updateNeeded(d,f)&&u.prepareTile(y,d,f)},"raster-particle":function(c,r,s){const u=r.getSource();if(!(u instanceof Be&&u.loaded()))return;const d=c.sourceLayer||u.rasterLayerIds&&u.rasterLayerIds[0];if(!d)return;const f=c.paint.get("raster-particle-array-band")||u.getInitialBand(d);if(f==null)return;const _=r.getIds().map(y=>r.getTileByID(y));for(const y of _)y.updateNeeded(d,f)&&u.prepareTile(y,d,f)}};class Gh{constructor(r,s,u,d){this.context=new mn(r,s),this.transform=u,this._tileTextures={},this.frameCopies=[],this.loadTimeStamps=[],this.tp=d,this._timeStamp=new Date().getTime(),this._averageFPS=0,this._fpsHistory=[],this._debugParams={showTerrainProxyTiles:!1,fpsWindow:30,continousRedraw:!1,enabledLayers:{}};const f=["fill","line","symbol","circle","heatmap","fill-extrusion","raster","raster-particle","hillshade","model","background","sky"];for(const _ of f)this._debugParams.enabledLayers[_]=!0;d.registerParameter(this._debugParams,["Terrain"],"showTerrainProxyTiles",{},()=>{this.style.map.triggerRepaint()}),d.registerParameter(this._debugParams,["FPS"],"fpsWindow",{min:1,max:100,step:1}),d.registerBinding(this._debugParams,["FPS"],"continousRedraw",{readonly:!0,label:"continuous redraw"}),d.registerBinding(this,["FPS"],"_averageFPS",{readonly:!0,label:"value"}),d.registerBinding(this,["FPS"],"_averageFPS",{readonly:!0,label:"graph",view:"graph",min:0,max:200});for(const _ of f)d.registerParameter(this._debugParams.enabledLayers,["Debug","Layers"],_);this.setup(),this.numSublayers=tn.maxUnderzooming+tn.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.deferredRenderGpuTimeQueries=[],this.gpuTimers={},this.frameCounter=0,this._backgroundTiles={},this.conflationActive=!1,this.replacementSource=new o.d3,this.longestCutoffRange=0,this.minCutoffZoom=0,this._fogVisible=!1,this._cachedTileFogOpacities={},this._shadowRenderer=new Ah(this),this._wireframeDebugCache=new jh,this.renderDefaultNorthPole=!0,this.renderDefaultSouthPole=!0}updateTerrain(r,s){const u=!!r&&!!r.terrain&&this.transform.projection.supportsTerrain;if(!(u||this._terrain&&this._terrain.enabled))return;this._terrain||(this._terrain=new Br(this,r));const d=this._terrain;this.transform.elevation=u?d:null,d.update(r,this.transform,s),this.transform.elevation&&!d.enabled&&(this.transform.elevation=null)}_updateFog(r){const s=r.fog;if(!s||this.transform.projection.name==="globe"||s.getOpacity(this.transform.pitch)<1||s.properties.get("horizon-blend")<.03)return void(this.transform.fogCullDistSq=null);const[u,d]=s.getFovAdjustedRange(this.transform._fov);if(u>d)return void(this.transform.fogCullDistSq=null);const f=u+.78*(d-u);this.transform.fogCullDistSq=f*f}get terrain(){return this.transform._terrainEnabled()&&this._terrain&&this._terrain.enabled?this._terrain:null}get shadowRenderer(){return this._shadowRenderer&&this._shadowRenderer.enabled?this._shadowRenderer:null}get wireframeDebugCache(){return this._wireframeDebugCache}resize(r,s){if(this.width=r*o.f.devicePixelRatio,this.height=s*o.f.devicePixelRatio,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const u of this.style.order)this.style._mergedLayers[u].resize()}setup(){const r=this.context,s=new o.aQ;s.emplaceBack(0,0),s.emplaceBack(o.Y,0),s.emplaceBack(0,o.Y),s.emplaceBack(o.Y,o.Y),this.tileExtentBuffer=r.createVertexBuffer(s,o.aS.members),this.tileExtentSegments=o.aE.simpleSegment(0,0,4,2);const u=new o.aQ;u.emplaceBack(0,0),u.emplaceBack(o.Y,0),u.emplaceBack(0,o.Y),u.emplaceBack(o.Y,o.Y),this.debugBuffer=r.createVertexBuffer(u,o.aS.members),this.debugSegments=o.aE.simpleSegment(0,0,4,5);const d=new o.aQ;d.emplaceBack(-1,-1),d.emplaceBack(1,-1),d.emplaceBack(-1,1),d.emplaceBack(1,1),this.viewportBuffer=r.createVertexBuffer(d,o.aS.members),this.viewportSegments=o.aE.simpleSegment(0,0,4,2);const f=new o.ay;f.emplaceBack(0,0,0,0),f.emplaceBack(o.Y,0,o.Y,0),f.emplaceBack(0,o.Y,0,o.Y),f.emplaceBack(o.Y,o.Y,o.Y,o.Y),this.mercatorBoundsBuffer=r.createVertexBuffer(f,o.aU.members),this.mercatorBoundsSegments=o.aE.simpleSegment(0,0,4,2);const _=new o.az;_.emplaceBack(0,1,2),_.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=r.createIndexBuffer(_);const y=new o.aR;for(const T of[0,1,3,2,0])y.emplaceBack(T);this.debugIndexBuffer=r.createIndexBuffer(y),this.emptyTexture=new o.T(r,new o.h({width:1,height:1},Uint8Array.of(0,0,0,0)),r.gl.RGBA),this.identityMat=o.a9.create();const b=this.context.gl;this.stencilClearMode=new yt({func:b.ALWAYS,mask:0},0,255,b.ZERO,b.ZERO,b.ZERO),this.loadTimeStamps.push(performance.now())}getMercatorTileBoundsBuffers(){return{tileBoundsBuffer:this.mercatorBoundsBuffer,tileBoundsIndexBuffer:this.quadTriangleIndexBuffer,tileBoundsSegments:this.mercatorBoundsSegments}}getTileBoundsBuffers(r){return r._makeTileBoundsBuffers(this.context,this.transform.projection),r._tileBoundsBuffer?{tileBoundsBuffer:r._tileBoundsBuffer,tileBoundsIndexBuffer:r._tileBoundsIndexBuffer,tileBoundsSegments:r._tileBoundsSegments}:this.getMercatorTileBoundsBuffers()}clearStencil(){const r=this.context.gl;this.nextStencilID=1,this.currentStencilSource=void 0,this._tileClippingMaskIDs={},this.getOrCreateProgram("clippingMask").draw(this,r.TRIANGLES,lt.disabled,this.stencilClearMode,Pt.disabled,ft.disabled,oa(this.identityMat),"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}resetStencilClippingMasks(){this.terrain||(this.currentStencilSource=void 0,this._tileClippingMaskIDs={})}_renderTileClippingMasks(r,s,u){if(!s||this.currentStencilSource===s.id||!r.isTileClipped()||!u||u.length===0)return;if(this._tileClippingMaskIDs&&!this.terrain){let y=!1;for(const b of u)if(this._tileClippingMaskIDs[b.key]===void 0){y=!0;break}if(!y)return}this.currentStencilSource=s.id;
2108const d=this.context,f=d.gl;this.nextStencilID+u.length>256&&this.clearStencil(),d.setColorMode(Pt.disabled),d.setDepthMode(lt.disabled);const _=this.getOrCreateProgram("clippingMask");this._tileClippingMaskIDs={};for(const y of u){const b=s.getTile(y),T=this._tileClippingMaskIDs[y.key]=this.nextStencilID++,{tileBoundsBuffer:S,tileBoundsIndexBuffer:A,tileBoundsSegments:C}=this.getTileBoundsBuffers(b);_.draw(this,f.TRIANGLES,lt.disabled,new yt({func:f.ALWAYS,mask:0},T,255,f.KEEP,f.KEEP,f.REPLACE),Pt.disabled,ft.disabled,oa(y.projMatrix),"$clipping",S,A,C)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const r=this.nextStencilID++,s=this.context.gl;return new yt({func:s.NOTEQUAL,mask:255},r,255,s.KEEP,s.KEEP,s.REPLACE)}stencilModeForClipping(r){if(this.terrain)return this.terrain.stencilModeForRTTOverlap(r);const s=this.context.gl;return new yt({func:s.EQUAL,mask:255},this._tileClippingMaskIDs[r.key],0,s.KEEP,s.KEEP,s.REPLACE)}stencilConfigForOverlap(r){const s=this.context.gl,u=r.sort((_,y)=>y.overscaledZ-_.overscaledZ),d=u[u.length-1].overscaledZ,f=u[0].overscaledZ-d+1;if(f>1){this.currentStencilSource=void 0,this.nextStencilID+f>256&&this.clearStencil();const _={};for(let y=0;y<f;y++)_[y+d]=new yt({func:s.GEQUAL,mask:255},y+this.nextStencilID,255,s.KEEP,s.KEEP,s.REPLACE);return this.nextStencilID+=f,[_,u]}return[{[d]:yt.disabled},u]}colorModeForRenderPass(){const r=this.context.gl;return this._showOverdrawInspector?new Pt([r.CONSTANT_COLOR,r.ONE,r.CONSTANT_COLOR,r.ONE],new o.aA(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?Pt.unblended:Pt.alphaBlended}colorModeForDrapableLayerRenderPass(r){const s=this.context.gl;return this.style&&this.style.enable3dLights()&&this.terrain&&this.terrain.renderingToTexture&&this.renderPass==="translucent"?new Pt([s.ONE,s.ONE_MINUS_SRC_ALPHA,s.CONSTANT_ALPHA,s.ONE_MINUS_SRC_ALPHA],new o.aA(0,0,0,r===void 0?0:r),[!0,!0,!0,!0]):this.colorModeForRenderPass()}depthModeForSublayer(r,s,u,d=!1){if(!this.opaquePassEnabledForLayer()&&!d)return lt.disabled;const f=1-((1+this.currentLayer)*this.numSublayers+r)*this.depthEpsilon;return new lt(u||this.context.gl.LEQUAL,s,[f,f])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}updateAverageFPS(){const r=new Date().getTime(),s=r-this._timeStamp;this._timeStamp=r,this._fpsHistory.push(s===0?0:1e3/s),this._fpsHistory.length>this._debugParams.fpsWindow&&this._fpsHistory.splice(0,this._fpsHistory.length-this._debugParams.fpsWindow),this._averageFPS=Math.round(this._fpsHistory.reduce((u,d)=>u+d/this._fpsHistory.length,0))}render(r,s){this._wireframeDebugCache.update(this.frameCounter),this._debugParams.continousRedraw=r.map.repaint,this.style=r,this.options=s;const u=this.style._mergedLayers,d=this.style.order.filter(B=>{const U=u[B];return!(U.type in this._debugParams.enabledLayers)||this._debugParams.enabledLayers[U.type]}),f=d.map(B=>u[B]),_=this.style._mergedSourceCaches;this.imageManager=r.imageManager,this.modelManager=r.modelManager,this.symbolFadeChange=r.placement.symbolFadeChange(o.f.now()),this.imageManager.beginFrame();let y=0,b=!1;for(const B in _){const U=_[B];U.used&&(U.prepare(this.context),U.getSource().usedInConflation&&++y)}for(const B of f)B.isHidden(this.transform.zoom)||this.prepareLayer(B);const T={},S={},A={},C={},P={};for(const B in _){const U=_[B];T[B]=U.getVisibleCoordinates(),S[B]=T[B].slice().reverse(),A[B]=U.getVisibleCoordinates(!0).reverse(),C[B]=U.getShadowCasterCoordinates(),P[B]=U.sortCoordinatesByDistance(T[B])}const L=B=>{const U=this.style.getLayerSourceCache(B);return U&&U.used?U.getSource():null};if(y){const B=[];for(const U of f)this.layerUsedInConflation(U,L(U))&&B.push(U);if(B&&B.length>1){const U=[];for(const K of B){const Y=this.style.getLayerSourceCache(K);Y&&Y.used&&Y.getSource().usedInConflation&&U.push({layer:K.fqid,cache:Y})}this.replacementSource.setSources(U),b=!0}}b||this.replacementSource.clear(),this.conflationActive=b,this.minCutoffZoom=0,this.longestCutoffRange=0;for(const B of f){const U=B.cutoffRange();if(this.longestCutoffRange=Math.max(U,this.longestCutoffRange),U>0){const K=L(B);K&&(this.minCutoffZoom=Math.max(K.minzoom,this.minCutoffZoom)),B.minzoom&&(this.minCutoffZoom=Math.max(B.minzoom,this.minCutoffZoom))}}this.opaquePassCutoff=1/0;for(let B=0;B<f.length;B++)if(f[B].is3D()){this.opaquePassCutoff=B;break}const R=this.style&&this.style.fog;R?(this._fogVisible=R.getOpacity(this.transform.pitch)!==0,this._fogVisible&&this.transform.projection.name!=="globe"&&(this._fogVisible=R.isVisibleOnFrustum(this.transform.cameraFrustum))):this._fogVisible=!1,this._cachedTileFogOpacities={},this.terrain&&(this.terrain.updateTileBinding(A),this.opaquePassCutoff=0);const k=this._shadowRenderer;if(k){k.updateShadowParameters(this.transform,this.style.directionalLight);for(const B in _)for(const U of T[B]){let K={min:0,max:0};this.terrain&&(K=this.terrain.getMinMaxForTile(U)||K),k.addShadowReceiver(U.toUnwrapped(),K.min,K.max)}}if(this.transform.projection.name!=="globe"||this.globeSharedBuffers||(this.globeSharedBuffers=new o.d4(this.context)),this.style.fog&&this.transform.projection.supportsFog?(this._atmosphere||(this._atmosphere=new su(this)),this._atmosphere.update(this)):this._atmosphere&&(this._atmosphere.de
2108stroy(),this._atmosphere=void 0),!o.d5(this.context.gl))return;this.renderPass="offscreen";for(const B of f){const U=r.getLayerSourceCache(B);if(!B.hasOffscreenPass()||B.isHidden(this.transform.zoom))continue;const K=U?S[U.id]:void 0;(B.type==="custom"||B.type==="raster"||B.type==="raster-particle"||B.isSky()||K&&K.length)&&this.renderLayer(this,U,B,K)}this.depthRangeFor3D=[0,1-(f.length+2)*this.numSublayers*this.depthEpsilon];const O=this.terrain;O&&(this.style.hasSymbolLayers()||this.style.hasCircleLayers())&&!this.transform.isOrthographic&&O.drawDepth(),this._shadowRenderer&&(this.renderPass="shadow",this._shadowRenderer.drawShadowPass(this.style,C)),this.context.bindFramebuffer.set(null),this.context.viewport.set([0,0,this.width,this.height]);const N=this.transform.projection.name==="globe"||this.transform.isHorizonVisible(),$=(()=>{if(s.showOverdrawInspector)return o.aA.black;if(this.style.fog&&this.transform.projection.supportsFog&&!N){const B=this.style.fog.properties.get("color").toArray01();return new o.aA(...B)}if(this.style.fog&&this.transform.projection.supportsFog&&N){const B=this.style.fog.properties.get("space-color").toArray01();return new o.aA(...B)}return o.aA.transparent})();if(this.context.clear({color:$,depth:1}),this.clearStencil(),this._showOverdrawInspector=s.showOverdrawInspector,this.renderPass="opaque",this.style.fog&&this.transform.projection.supportsFog&&this._atmosphere&&!this._showOverdrawInspector&&N&&this._atmosphere.drawStars(this,this.style.fog),!this.terrain)for(this.currentLayer=d.length-1;this.currentLayer>=0;this.currentLayer--){const B=f[this.currentLayer],U=r.getLayerSourceCache(B);if(B.isSky())continue;const K=U?(B.is3D()?P:S)[U.id]:void 0;this._renderTileClippingMasks(B,U,K),this.renderLayer(this,U,B,K)}if(this.style.fog&&this.transform.projection.supportsFog&&this._atmosphere&&!this._showOverdrawInspector&&N&&this._atmosphere.drawAtmosphereGlow(this,this.style.fog),this.renderPass="sky",(!this._atmosphere||o.W(this.transform.zoom)>0)&&(this.transform.projection.name==="globe"||this.transform.isHorizonVisible()))for(this.currentLayer=0;this.currentLayer<d.length;this.currentLayer++){const B=f[this.currentLayer],U=r.getLayerSourceCache(B);B.isSky()&&this.renderLayer(this,U,B,U?S[U.id]:void 0)}function Z(B,U){let K;return U&&(K=(B.type==="symbol"?A:B.is3D()?P:S)[U.id]),K}if(this.renderPass="translucent",this.transform.projection.name==="globe"){for(this.renderElevatedRasterBackface=!0,this.currentLayer=0;this.currentLayer<d.length;){const B=f[this.currentLayer];if(B.type==="raster"){const U=r.getLayerSourceCache(B);this.renderLayer(this,U,B,Z(B,U))}++this.currentLayer}this.renderElevatedRasterBackface=!1}this.currentLayer=0,this.firstLightBeamLayer=Number.MAX_SAFE_INTEGER;let Q=0;for(k&&(Q=k.getShadowCastingLayerCount());this.currentLayer<d.length;){const B=f[this.currentLayer],U=r.getLayerSourceCache(B);if(B.isSky())++this.currentLayer;else if(O&&this.style.isLayerDraped(B)){if(B.isHidden(this.transform.zoom)){++this.currentLayer;continue}this.currentLayer=O.renderBatch(this.currentLayer)}else{if(this._renderTileClippingMasks(B,U,U?T[U.id]:void 0),this.renderLayer(this,U,B,Z(B,U)),!O&&k&&Q>0&&B.hasShadowPass()&&--Q==0&&(k.drawGroundShadows(),this.firstLightBeamLayer<=this.currentLayer)){const K=this.currentLayer;for(this.renderPass="light-beam",this.currentLayer=this.firstLightBeamLayer;this.currentLayer<=K;this.currentLayer++){const Y=f[this.currentLayer];if(!Y.hasLightBeamPass())continue;const re=r.getLayerSourceCache(Y);this.renderLayer(this,re,Y,re?S[re.id]:void 0)}this.currentLayer=K,this.renderPass="translucent"}++this.currentLayer}}if(this.terrain&&this.terrain.postRender(),this.options.showTileBoundaries||this.options.showQueryGeometry||this.options.showTileAABBs){let B=null;f.forEach(U=>{const K=r.getLayerSourceCache(U);K&&!U.isHidden(this.transform.zoom)&&K.getVisibleCoordinates().length&&(!B||B.getSource().maxzoom<K.getSource().maxzoom)&&(B=K)}),B&&this.options.showTileBoundaries&&Fl.debug(this,B,B.getVisibleCoordinates(),o.aA.red,!1,this.options.showParseStatus)}this.terrain&&this._debugParams.showTerrainProxyTiles&&Fl.debug(this,this.terrain.proxySourceCache,this.terrain.proxyCoords,new o.aA(1,.8,.1,1),!0,this.options.showParseStatus),this.options.showPadding&&function(B){const U=B.transform.padding;Bh(B,B.transform.height-(U.top||0),3,tu),Bh(B,U.bottom||0,3,Ap),Fh(B,U.left||0,3,kh),Fh(B,B.transform.width-(U.right||0),3,Oh);const K=B.transform.centerPoint;(function(Y,re,he,ie){Rl(Y,re-1,he-10,2,20,ie),Rl(Y,re-10,he-1,20,2,ie)})(B,K.x,B.transform.height-K.y,iu)}(this),this.context.setDefault(),this.frameCounter=(this.frameCounter+1)%Number.MAX_SAFE_INTEGER,this.tileLoaded&&this.options.speedIndexTiming&&(this.loadTimeStamps.push(performance.now()),this.saveC
vendor: 1,830 bytes, line 2108
2108anvasCopy()),b||(this.conflationActive=!1)}prepareLayer(r){this.gpuTimingStart(r);const{unsupportedLayers:s}=this.transform.projection,u=!s||!s.includes(r.type);if(As[r.type]&&(u||this.terrain&&r.type==="custom")){const d=this.style.getLayerSourceCache(r);As[r.type](r,d,this)}this.gpuTimingEnd()}renderLayer(r,s,u,d){u.isHidden(this.transform.zoom)||(u.type==="background"||u.type==="sky"||u.type==="custom"||u.type==="model"||u.type==="raster"||u.type==="raster-particle"||d&&d.length)&&(this.id=u.id,this.gpuTimingStart(u),(!r.transform.projection.unsupportedLayers||!r.transform.projection.unsupportedLayers.includes(u.type)||r.terrain&&u.type==="custom")&&Fl[u.type](r,s,u,d,this.style.placement.variableOffsets,this.options.isInitialLoad),this.gpuTimingEnd())}gpuTimingStart(r){if(!this.options.gpuTiming)return;const s=this.context.extTimerQuery,u=this.context.gl;let d=this.gpuTimers[r.id];d||(d=this.gpuTimers[r.id]={calls:0,cpuTime:0,query:u.createQuery()}),d.calls++,u.beginQuery(s.TIME_ELAPSED_EXT,d.query)}gpuTimingDeferredRenderStart(){if(this.options.gpuTimingDeferredRender){const r=this.context.extTimerQuery,s=this.context.gl,u=s.createQuery();this.deferredRenderGpuTimeQueries.push(u),s.beginQuery(r.TIME_ELAPSED_EXT,u)}}gpuTimingDeferredRenderEnd(){this.options.gpuTimingDeferredRender&&this.context.gl.endQuery(this.context.extTimerQuery.TIME_ELAPSED_EXT)}gpuTimingEnd(){this.options.gpuTiming&&this.context.gl.endQuery(this.context.extTimerQuery.TIME_ELAPSED_EXT)}collectGpuTimers(){const r=this.gpuTimers;return this.gpuTimers={},r}collectDeferredRenderGpuQueries(){const r=this.deferredRenderGpuTimeQueries;return this.deferredRenderGpuTimeQueries=[],r}queryGpuTimers(r){const s={};for(const u in r){const d=r[u],f=this.context.extTimerQuery,_=f.getQueryParameter(d.query,this.context.gl.QUERY_RESULT)/1e6;
2108f.deleteQueryEXT(d.query),s[u]=_}return s}queryGpuTimeDeferredRender(r){if(!this.options.gpuTimingDeferredRender)return 0;const s=this.context.extTimerQuery,u=this.context.gl;let d=0;for(const f of r)d+=s.getQueryParameter(f,u.QUERY_RESULT)/1e6,s.deleteQueryEXT(f);return d}translatePosMatrix(r,s,u,d,f){if(!u[0]&&!u[1])return r;const _=f?d==="map"?this.transform.angle:0:d==="viewport"?-this.transform.angle:0;if(_){const T=Math.sin(_),S=Math.cos(_);u=[u[0]*S-u[1]*T,u[0]*T+u[1]*S]}const y=[f?u[0]:o.a6(s,u[0],this.transform.zoom),f?u[1]:o.a6(s,u[1],this.transform.zoom),0],b=new Float32Array(16);return o.a9.translate(b,r,y),b}saveTileTexture(r){const s=r.size[0],u=this._tileTextures[s];u?u.push(r):this._tileTextures[s]=[r]}getTileTexture(r){const s=this._tileTextures[r];return s&&s.length>0?s.pop():null}isPatternMissing(r,s){return r===null||r!==void 0&&!this.imageManager.getPattern(r.toString(),s)}terrainRenderModeElevated(){return this.style&&!!this.style.getTerrain()&&!!this.terrain&&!this.terrain.renderingToTexture}linearFloatFilteringSupported(){return this.context.extTextureFloatLinear!=null}currentGlobalDefines(r,s,u){const d=u===void 0?this.terrain&&this.terrain.renderingToTexture:u,f=this.terrain&&this.terrain.exaggeration()===0,_=[];return this.style&&this.style.enable3dLights()&&(r==="globeRaster"||r==="terrainRaster"?(_.push("LIGHTING_3D_MODE"),_.push("LIGHTING_3D_ALPHA_EMISSIVENESS")):d||_.push("LIGHTING_3D_MODE")),this.renderPass==="shadow"?this._shadowMapDebug||_.push("DEPTH_TEXTURE"):this.shadowRenderer&&(this.shadowRenderer.useNormalOffset?_.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET"):_.push("RENDER_SHADOWS","DEPTH_TEXTURE")),this.terrainRenderModeElevated()&&(_.push("TERRAIN"),this.linearFloatFilteringSupported()&&_.push("TERRAIN_DEM_FLOAT_FORMAT"),f&&_.push("ZERO_EXAGGERATION")),this.transform.projection.name==="globe"&&_.push("GLOBE"),!this._fogVisible||d||s!==void 0&&!s||_.push("FOG","FOG_DITHERING"),d&&_.push("RENDER_TO_TEXTURE"),this._showOverdrawInspector&&_.push("OVERDRAW_INSPECTOR"),_}getOrCreateProgram(r,s){this.cache=this.cache||{};const u=s&&s.defines||[],d=s&&s.config,f=this.currentGlobalDefines(r,s&&s.overrideFog,s&&s.overrideRtt).concat(u),_=qr.cacheKey(on[r],r,f,d);return this.cache[_]||(this.cache[_]=new qr(this.context,r,on[r],d,Xc[r],f)),this.cache[_]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.frontFace.setDefault(),this.context.cullFaceSide.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const r=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(r.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new o.T(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this._terrain&&this._terrain.destroy(),this._atmosphere&&(this._atmosphere.destroy(),this._atmosphere=void 0),this.globeSharedBuffers&&this.globeSharedBuffers.destroy(),this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this._wireframeDebugCache.destroy()}prepareDrawTile(){this.terrain&&this.terrain.prepareDrawTile()}uploadCommonLightUniforms(r,s){if(this.style.enable3dLights()){const u=this.style.directionalLight,d=this.style.ambientLight;if(u&&d){const f=((_,y)=>{const b=_.properties.get("direction"),T=_.properties.get("color").toArray01(),S=_.properties.get("intensity"),A=y.properties.get("color").toArray01(),C=y.properties.get("intensity"),P=[b.x,b.y,b.z],L=o.cs(A,C),R=o.cs(T,S);return{u_lighting_ambient_color:L,u_lighting_directional_dir:P,u_lighting_directional_color:R,u_ground_radiance:Ph(P,R,L)}})(u,d);s.setLightsUniformValues(r,f)}}}uploadCommonUniforms(r,s,u,d,f){if(this.uploadCommonLightUniforms(r,s),this.terrain&&this.terrain.renderingToTexture)return;const _=this.style.fog;if(_){const y=_.getOpacity(this.transform.pitch),b=((T,S,A,C,P,L,R,k,O,N,$,Z)=>{const Q=T.transform,B=S.properties.get("color").toArray01();B[3]=C;const U=T.frameCounter/1e3%1,[K,Y]=S.properties.get("vertical-range");return{u_fog_matrix:A?Q.calculateFogTileMatrix(A):Z||T.identityMat,u_fog_range:S.getFovAdjustedRange(Q._fov),u_fog_color:B,u_fog_horizon_blend:S.properties.get("horizon-blend"),u_fog_vertical_limit:[Math.min(K,Y),Y],u_fog_temporal_offset:U,u_frustum_tl:P,u_frustum_tr:L,u_frustum_br:R,u_frustum_bl:k,u_globe_pos:O,u_globe_radius:N,u_viewport:$,u_globe_transition:o.W(Q.zoom),u_is_globe:+(Q.projection.name==="globe")}})(this,_,u,y,this.transform.frustumCorners.TL,this.transform.frustumCorners.TR,this.transform.frustumCorners.BR,this.transform.frustumCorners.BL,this.transform.globeCenterInViewSpace,this.transform.globeRadius,[this.transform.width*o.f.devicePixelRatio,this.transform.height*o.f.devicePixelRatio],d);s.setFogUniformValues(r,b)}f&&s.setCutoffUniformValues(r,f.uniformValues)}setTileLoadedFlag(r){this.tileLoaded=r}saveCanvasCopy(){const r=this.canvasCopy();r&&(this.frameCopies.push(r),this.tileLoaded=!1)}canvasCopy(){const r=this.context.gl,s=r.createTexture();return r.bindTexture(r.TEXTURE_2D,s),r.copyTexImage2D(r.TEXTURE_2D,0,r.RGBA,0,0,r.drawingBufferWidth,r.drawingBufferHeight,0),s}getCanvasCopiesAndTimestamps(){return{canvasCopies:this.frameCopies,timeStamps:this.loadTimeStamps}}averageElevationNeedsEasing(){if(!this.transform._elevation)return!1;const r=this.style&&this.style.fog;return!!r&&r.getOpacity(this.transform.pitch)!==0}
vendor: 35,472 bytes, line 2108
2108getBackgroundTiles(){const r=this._backgroundTiles,s=this._backgroundTiles={},u=this.transform.coveringTiles({tileSize:512});for(const d of u)s[d.key]=r[d.key]||new en(d,512,this.transform.tileZoom,this);return s}clearBackgroundTiles(){this._backgroundTiles={}}layerUsedInConflation(r,s){return!(!r.is3D()||r.minzoom&&r.minzoom>this.transform.zoom||r.sourceLayer!=="building"&&(!s||s.type!=="batched-model"))}isTileAffectedByFog(r){if(!this.style||!this.style.fog)return!1;if(this.transform.projection.name==="globe")return!0;let s=this._cachedTileFogOpacities[r.key];return s||(this._cachedTileFogOpacities[r.key]=s=this.style.fog.getOpacityForTile(r)),s[0]>=Kt||s[1]>=Kt}}function qh(c,r){let s=!1,u=null;const d=()=>{u=null,s&&(c(),u=setTimeout(d,r),s=!1)};return()=>(s=!0,u||d(),u)}class Cp{constructor(r){this._hashName=r&&encodeURIComponent(r),o.a$(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=qh(this._updateHashUnthrottled.bind(this),300)}addTo(r){return this._map=r,window.addEventListener("hashchange",this._onHashChange,!1),r.on("moveend",this._updateHash),this}remove(){return this._map?(this._map.off("moveend",this._updateHash),window.removeEventListener("hashchange",this._onHashChange,!1),clearTimeout(this._updateHash()),this._map=void 0,this):this}getHashString(){const r=this._map;if(!r)return"";const s=Zh(r);if(this._hashName){const u=this._hashName;let d=!1;const f=location.hash.slice(1).split("&").map(_=>{const y=_.split("=")[0];return y===u?(d=!0,`${y}=${s}`):_}).filter(_=>_);return d||f.push(`${u}=${s}`),`#${f.join("&")}`}return`#${s}`}_getCurrentHash(){const r=location.hash.replace("#","");if(this._hashName){let s;return r.split("&").map(u=>u.split("=")).forEach(u=>{u[0]===this._hashName&&(s=u)}),(s&&s[1]||"").split("/")}return r.split("/")}_onHashChange(){const r=this._map;if(!r)return!1;const s=this._getCurrentHash();if(s.length>=3&&!s.some(u=>isNaN(u))){const u=r.dragRotate.isEnabled()&&r.touchZoomRotate.isEnabled()?+(s[3]||0):r.getBearing();return r.jumpTo({center:[+s[2],+s[1]],zoom:+s[0],bearing:u,pitch:+(s[4]||0)}),!0}return!1}_updateHashUnthrottled(){history.replaceState(history.state,"",location.href.replace(/(#.+)?$/,this.getHashString()))}}function Zh(c,r){const s=c.getCenter(),u=Math.round(100*c.getZoom())/100,d=Math.ceil((u*Math.LN2+Math.log(512/360/.5))/Math.LN10),f=Math.pow(10,d),_=Math.round(s.lng*f)/f,y=Math.round(s.lat*f)/f,b=c.getBearing(),T=c.getPitch();let S=r?`/${_}/${y}/${u}`:`${u}/${y}/${_}`;return(b||T)&&(S+="/"+Math.round(10*b)/10),T&&(S+=`/${Math.round(T)}`),S}const lo={linearity:.3,easing:o.d6(0,0,.3,1)},au=o.e({deceleration:2500,maxSpeed:1400},lo),lu=o.e({deceleration:20,maxSpeed:1400},lo),cu=o.e({deceleration:1e3,maxSpeed:360},lo),$h=o.e({deceleration:1e3,maxSpeed:90},lo);class Wh{constructor(r){this._map=r,this.clear()}clear(){this._inertiaBuffer=[]}record(r){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:o.f.now(),settings:r})}_drainInertiaBuffer(){const r=this._inertiaBuffer,s=o.f.now();for(;r.length>0&&s-r[0].time>160;)r.shift()}_onMoveEnd(r){if(this._map._prefersReducedMotion()||(this._drainInertiaBuffer(),this._inertiaBuffer.length<2))return;const s={zoom:0,bearing:0,pitch:0,pan:new o.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:f}of this._inertiaBuffer)s.zoom+=f.zoomDelta||0,s.bearing+=f.bearingDelta||0,s.pitch+=f.pitchDelta||0,f.panDelta&&s.pan._add(f.panDelta),f.around&&(s.around=f.around),f.pinchAround&&(s.pinchAround=f.pinchAround);const u=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,d={};if(s.pan.mag()){const f=ns(s.pan.mag(),u,o.e({},au,r||{}));d.offset=s.pan.mult(f.amount/s.pan.mag()),d.center=this._map.transform.center,Nl(d,f)}if(s.zoom){const f=ns(s.zoom,u,lu);d.zoom=this._map.transform.zoom+f.amount,Nl(d,f)}if(s.bearing){const f=ns(s.bearing,u,cu);d.bearing=this._map.transform.bearing+o.ad(f.amount,-179,179),Nl(d,f)}if(s.pitch){const f=ns(s.pitch,u,$h);d.pitch=this._map.transform.pitch+f.amount,Nl(d,f)}if(d.zoom||d.bearing){const f=s.pinchAround===void 0?s.around:s.pinchAround;d.around=f?this._map.unproject(f):this._map.getCenter()}return this.clear(),d.noMoveStart=!0,d}}function Nl(c,r){(!c.duration||c.duration<r.duration)&&(c.duration=r.duration,c.easing=r.easing)}function ns(c,r,s){const{maxSpeed:u,linearity:d,deceleration:f}=s,_=o.ad(c*d/(r/1e3),-u,u),y=Math.abs(_)/(f*d);return{easing:s.easing,duration:1e3*y,amount:_*(y/2)}}class or extends o.b{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(r,s,u,d={}){const f=$n(s.getCanvasContainer(),u),_=s.unproject(f);super(r,o.e({point:f,lngLat:_,originalEvent:u},d)),this._defaultPrevented=!1,this.target=s}}class ya extends o.b{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(r,s,u){const d=r==="touchend"?u.changedTouches:u.touches,f=Yr(s.getCanvasContainer(),d),_=f.map(b=>s.unproject(b)),y=f.reduce((b,T,S,A)=>b.add(T.div(A.length)),new o.P(0,0));super(r,{points:f,point:y,lngLats:_,lngLat:s.unproject(y),originalEvent:u}),this._defaultPrevented=!1}}class Nr extends o.b{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(r,s,u){super(r,{originalEvent:u}),this._defaultPrevented=!1}}class uu{constructor(r,s){this._map=r,this._clickTolerance=s.clickTolerance}reset(){this._mousedownPos=void 0}wheel(r){return this._firePreventable(new Nr(r.type,this._map,r))}mousedown(r,s){return this._mousedownPos=s,this._firePreventable(new or(r.type,this._map,r))}mouseup(r){this._map.fire(new or(r.type,this._map,r))}preclick(r){const s=o.e({},r);s.type="preclick",this._map.fire(new or(s.type,this._map,s))}click(r,s){this._mousedownPos&&this._mousedownPos.dist(s)>=this._clickTolerance||(this.preclick(r),this._map.fire(new or(r.type,this._map,r)))}dblclick(r){return this._firePreventable(new or(r.type,this._map,r))}mouseover(r){this._map.fire(new or(r.type,this._map,r))}mouseout(r){this._map.fire(new or(r.type,this._map,r))}touchstart(r){return this._firePreventable(new ya(r.type,this._map,r))}touchmove(r){this._map.fire(new ya(r.type,this._map,r))}touchend(r){this._map.fire(new ya(r.type,this._map,r))}touchcancel(r){this._map.fire(new ya(r.type,this._map,r))}_firePreventable(r){if(this._map.fire(r),r.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Vl{constructor(r){this._map=r}reset(){this._delayContextMenu=!1,this._contextMenuEvent=void 0}mousemove(r){this._map.fire(new or(r.type,this._map,r))}mousedown(){this._delayContextMenu=!0}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new or("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(r){this._delayContextMenu?this._contextMenuEvent=r:this._map.fire(new or(r.type,this._map,r)),this._map.listens("contextmenu")&&r.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Ul{constructor(r,s){this._map=r,this._el=r.getCanvasContainer(),this._container=r.getContainer(),this._clickTolerance=s.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(r,s){this.isEnabled()&&r.shiftKey&&r.button===0&&(Za(),this._startPos=this._lastPos=s,this._active=!0)}mousemoveWindow(r,s){if(!this._active)return;const u=s,d=this._startPos,f=this._lastPos;if(!d||!f||f.equals(u)||!this._box&&u.dist(d)<this._clickTolerance)return;this._lastPos=u,this._box||(this._box=Ft("div","mapboxgl-boxzoom",this._container),this._container.classList.add("mapboxgl-crosshair"),this._fireEvent("boxzoomstart",r));const _=Math.min(d.x,u.x),y=Math.max(d.x,u.x),b=Math.min(d.y,u.y),T=Math.max(d.y,u.y);this._map._requestDomTask(()=>{this._box&&(this._box.style.transform=`translate(${_}px,${b}px)`,this._box.style.width=y-_+"px",this._box.style.height=T-b+"px")})}mouseupWindow(r,s){if(!this._active)return;const u=this._startPos,d=s;if(u&&r.button===0){if(this.reset(),Ri(),u.x!==d.x||u.y!==d.y)return this._map.fire(new o.b("boxzoomend",{originalEvent:r})),{cameraAnimation:f=>f.fitScreenCoordinates(u,d,this._map.getBearing(),{linear:!1})};this._fireEvent("boxzoomcancel",r)}}keydown(r){this._active&&r.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",r))}blur(){this.reset()}reset(){this._active=!1,this._container.classList.remove("mapboxgl-crosshair"),this._box&&(this._box.remove(),this._box=null),zr(),delete this._startPos,delete this._lastPos}_fireEvent(r,s){return this._map.fire(new o.b(r,{originalEvent:s}))}}function xa(c,r){const s={};for(let u=0;u<c.length;u++)s[c[u].identifier]=r[u];return s}class hu{constructor(r){this.reset(),this.numTouches=r.numTouches}reset(){this.centroid=void 0,this.startTime=0,this.touches={},this.aborted=!1}touchstart(r,s,u){(this.centroid||u.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===0&&(this.startTime=r.timeStamp),u.length===this.numTouches&&(this.centroid=function(d){const f=new o.P(0,0);for(const _ of d)f._add(_);return f.div(d.length)}(s),this.touches=xa(u,s)))}touchmove(r,s,u){if(this.aborted||!this.centroid)return;const d=xa(u,s);for(const f in this.touches){const _=d[f];(!_||_.dist(this.touches[f])>30)&&(this.aborted=!0)}}touchend(r,s,u){if((!this.centroid||r.timeStamp-this.startTime>500)&&(this.aborted=!0),u.length===0){const d=!this.aborted&&this.centroid;if(this.reset(),d)return d}}}class co{constructor(r){this.singleTap=new hu(r),this.numTaps=r.numTaps,this.reset()}reset(){this.lastTime=1/0,this.lastTap=void 0,this.count=0,this.singleTap.reset()}touchstart(r,s,u){this.singleTap.touchstart(r,s,u)}touchmove(r,s,u){this.singleTap.touchmove(r,s,u)}touchend(r,s,u){const d=this.singleTap.touchend(r,s,u);if(d){const f=r.timeStamp-this.lastTime<500,_=!this.lastTap||this.lastTap.dist(d)<30;if(f&&_||this.reset(),this.count++,this.lastTime=r.timeStamp,this.lastTap=d,this.count===this.numTaps)return this.reset(),d}}}class du{constructor(){this._zoomIn=new co({numTouches:1,numTaps:2}),this._zoomOut=new co({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(r,s,u){this._zoomIn.touchstart(r,s,u),this._zoomOut.touchstart(r,s,u)}touchmove(r,s,u){this._zoomIn.touchmove(r,s,u),this._zoomOut.touchmove(r,s,u)}touchend(r,s,u){const d=this._zoomIn.touchend(r,s,u),f=this._zoomOut.touchend(r,s,u);return d?(this._active=!0,r.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:_=>_.easeTo({duration:300,zoom:_.getZoom()+1,around:_.unproject(d)},{originalEvent:r})}):f?(this._active=!0,r.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:_=>_.easeTo({duration:300,zoom:_.getZoom()-1,around:_.unproject(f)},{originalEvent:r})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}const pu={0:1,2:2};class uo{constructor(r){this.reset(),this._clickTolerance=r.clickTolerance||1}blur(){this.reset()}reset(){this._active=!1,this._moved=!1,this._lastPoint=void 0,this._eventButton=void 0}_correctButton(r,s){return!1}_move(r,s){return{}}mousedown(r,s){if(this._lastPoint)return;const u=$a(r);this._correctButton(r,u)&&(this._lastPoint=s,this._eventButton=u)}mousemoveWindow(r,s){const u=this._lastPoint;if(u){if(r.preventDefault(),this._eventButton!=null&&function(d,f){const _=pu[f];return d.buttons===void 0||(d.buttons&_)!==_}(r,this._eventButton))this.reset();else if(this._moved||!(s.dist(u)<this._clickTolerance))return this._moved=!0,this._lastPoint=s,this._move(u,s)}}mouseupWindow(r){this._lastPoint&&$a(r)===this._eventButton&&(this._moved&&Ri(),this.reset())}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Qh extends uo{mousedown(r,s){super.mousedown(r,s),this._lastPoint&&(this._active=!0)}_correctButton(r,s){return s===0&&!r.ctrlKey}_move(r,s){return{around:s,panDelta:s.sub(r)}}}class fu extends uo{_correctButton(r,s){return s===0&&r.ctrlKey||s===2}_move(r,s){const u=.8*(s.x-r.x);if(u)return this._active=!0,{bearingDelta:u}}contextmenu(r){r.preventDefault()}}class Is extends uo{_correctButton(r,s){return s===0&&r.ctrlKey||s===2}_move(r,s){const u=-.5*(s.y-r.y);if(u)return this._active=!0,{pitchDelta:u}}contextmenu(r){r.preventDefault()}}class Pp{constructor(r,s){this._map=r,this._el=r.getCanvasContainer(),this._minTouches=1,this._clickTolerance=s.clickTolerance||1,this.reset(),o.a$(["_addTouchPanBlocker","_showTouchPanBlockerAlert"],this)}reset(){this._active=!1,this._touches={},this._sum=new o.P(0,0)}touchstart(r,s,u){return this._calculateTransform(r,s,u)}touchmove(r,s,u){if(this._active&&!(u.length<this._minTouches)){if(this._map._cooperativeGestures&&!this._map.isMoving()){if(u.length===1&&!o.d7())return void this._showTouchPanBlockerAlert();this._alertContainer.style.visibility!=="hidden"&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}return r.cancelable&&r.preventDefault(),this._calculateTransform(r,s,u)}}touchend(r,s,u){this._calculateTransform(r,s,u),this._active&&u.length<this._minTouches&&this.reset()}touchcancel(){this.reset()}_calculateTransform(r,s,u){u.length>0&&(this._active=!0);const d=xa(u,s),f=new o.P(0,0),_=new o.P(0,0);let y=0;for(const T in d){const S=d[T],A=this._touches[T];A&&(f._add(S),_._add(S.sub(A)),y++,d[T]=S)}if(this._touches=d,y<this._minTouches||!_.mag())return;const b=_.div(y);return this._sum._add(b),this._sum.mag()<this._clickTolerance?void 0:{around:f.div(y),panDelta:b}}enable(){this._enabled=!0,this._map._cooperativeGestures&&(this._addTouchPanBlocker(),this._el.classList.add("mapboxgl-touch-pan-blocker-override","mapboxgl-scrollable-page"))}disable(){this._enabled=!1,this._map._cooperativeGestures&&(clearTimeout(this._alertTimer),this._alertContainer.remove(),this._el.classList.remove("mapboxgl-touch-pan-blocker-override","mapboxgl-scrollable-page")),this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}_addTouchPanBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=Ft("div","mapboxgl-touch-pan-blocker",this._map._container),this._alertContainer.textContent=this._map._getUIString("TouchPanBlocker.Message"),this._alertContainer.style.fontSize=`${Math.max(10,Math.min(24,Math.floor(.05*this._el.clientWidth)))}px`)}_showTouchPanBlockerAlert(){this._alertContainer.style.visibility="visible",this._alertContainer.classList.add("mapboxgl-touch-pan-blocker-show"),this._alertContainer.setAttribute("role","alert"),clearTimeout(this._alertTimer),this._alertTimer=setTimeout(()=>{this._alertContainer.classList.remove("mapboxgl-touch-pan-blocker-show"),this._alertContainer.removeAttribute("role")},500)}}class mu{constructor(){this.reset()}reset(){this._active=!1,this._firstTwoTouches=void 0}_start(r){}_move(r,s,u){return{}}touchstart(r,s,u){this._firstTwoTouches||u.length<2||(this._firstTwoTouches=[u[0].identifier,u[1].identifier],this._start([s[0],s[1]]))}touchmove(r,s,u){const d=this._firstTwoTouches;if(!d)return;r.preventDefault();const[f,_]=d,y=jl(u,s,f),b=jl(u,s,_);if(!y||!b)return;const T=this._aroundCenter?null:y.add(b).div(2);return this._move([y,b],T,r)}touchend(r,s,u){if(!this._firstTwoTouches)return;const[d,f]=this._firstTwoTouches,_=jl(u,s,d),y=jl(u,s,f);_&&y||(this._active&&Ri(),this.reset())}touchcancel(){this.reset()}enable(r){this._enabled=!0,this._aroundCenter=!!r&&r.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}function jl(c,r,s){for(let u=0;u<c.length;u++)if(c[u].identifier===s)return r[u]}function Hh(c,r){return Math.log(c/r)/Math.LN2}class zp extends mu{reset(){super.reset(),this._distance=0,this._startDistance=0}_start(r){this._startDistance=this._distance=r[0].dist(r[1])}_move(r,s){const u=this._distance;if(this._distance=r[0].dist(r[1]),this._active||!(Math.abs(Hh(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:Hh(this._distance,u),pinchAround:s}}}function Xh(c,r){return 180*c.angleWith(r)/Math.PI}class _u extends mu{reset(){super.reset(),this._minDiameter=0,this._startVector=void 0,this._vector=void 0}_start(r){this._startVector=this._vector=r[0].sub(r[1]),this._minDiameter=r[0].dist(r[1])}_move(r,s){const u=this._vector;if(this._vector=r[0].sub(r[1]),u&&(this._active||!this._isBelowThreshold(this._vector)))return this._active=!0,{bearingDelta:Xh(this._vector,u),pinchAround:s}}_isBelowThreshold(r){this._minDiameter=Math.min(this._minDiameter,r.mag());const s=25/(Math.PI*this._minDiameter)*360,u=this._startVector;if(!u)return!1;const d=Xh(r,u);return Math.abs(d)<s}}function va(c){return Math.abs(c.y)>Math.abs(c.x)}class Yh extends mu{constructor(r){super(),this._map=r}reset(){super.reset(),this._valid=void 0,this._firstMove=void 0,this._lastPoints=void 0}_start(r){this._lastPoints=r,va(r[0].sub(r[1]))&&(this._valid=!1)}_move(r,s,u){const d=this._lastPoints;if(!d)return;const f=r[0].sub(d[0]),_=r[1].sub(d[1]);return this._map._cooperativeGestures&&!o.d7()&&u.touches.length<3||(this._valid=this.gestureBeginsVertically(f,_,u.timeStamp),!this._valid)?void 0:(this._lastPoints=r,this._active=!0,{pitchDelta:(f.y+_.y)/2*-.5})}gestureBeginsVertically(r,s,u){if(this._valid!==void 0)return this._valid;const d=r.mag()>=2,f=s.mag()>=2;if(!d&&!f)return;if(!d||!f)return this._firstMove==null&&(this._firstMove=u),u-this._firstMove<100&&void 0;const _=r.y>0==s.y>0;return va(r)&&va(s)&&_}}const ho={panStep:100,bearingStep:15,pitchStep:10};class Jh{constructor(){const r=ho;this._panStep=r.panStep,this._bearingStep=r.bearingStep,this._pitchStep=r.pitchStep,this._rotationDisabled=!1}blur(){this.reset()}reset(){this._active=!1}keydown(r){if(r.altKey||r.ctrlKey||r.metaKey)return;let s=0,u=0,d=0,f=0,_=0;switch(r.keyCode){case 61:case 107:case 171:case 187:s=1;break;case 189:case 109:case 173:s=-1;break;case 37:r.shiftKey?u=-1:(r.preventDefault(),f=-1);break;case 39:r.shiftKey?u=1:(r.preventDefault(),f=1);break;case 38:r.shiftKey?d=1:(r.preventDefault(),_=-1);break;case 40:r.shiftKey?d=-1:(r.preventDefault(),_=1);break;default:return}return this._rotationDisabled&&(u=0,d=0),{cameraAnimation:y=>{const b=y.getZoom();y.easeTo({duration:300,easeId:"keyboardHandler",easing:Kh,zoom:s?Math.round(b)+s*(r.shiftKey?2:1):b,bearing:y.getBearing()+u*this._bearingStep,pitch:y.getPitch()+d*this._pitchStep,offset:[-f*this._panStep,-_*this._panStep],center:y.getCenter()},{originalEvent:r})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function Kh(c){return c*(2-c)}const gu=4.000244140625,yu=1/450;class Cs{constructor(r,s){this._map=r,this._el=r.getCanvasContainer(),this._handler=s,this._delta=0,this._lastDelta=0,this._defaultZoomRate=.01,this._wheelZoomRate=yu,o.a$(["_onTimeout","_addScrollZoomBlocker","_showBlockerAlert"],this)}setZoomRate(r){this._defaultZoomRate=r}setWheelZoomRate(r){this._wheelZoomRate=r}isEnabled(){return!!this._enabled}isActive(){return this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(r){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!r&&r.around==="center",this._map._cooperativeGestures&&this._addScrollZoomBlocker())}disable(){this.isEnabled()&&(this._enabled=!1,this._map._cooperativeGestures&&(clearTimeout(this._alertTimer),this._alertContainer.remove()))}wheel(r){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!(r.ctrlKey||r.metaKey||this.isZooming()||o.d7()))return void this._showBlockerAlert();this._alertContainer.style.visibility!=="hidden"&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}let s=r.deltaMode===WheelEvent.DOM_DELTA_LINE?40*r.deltaY:r.deltaY;const u=o.f.now(),d=u-(this._lastWheelEventTime||0);this._lastWheelEventTime=u,s!==0&&s%gu==0?this._type="wheel":s!==0&&Math.abs(s)<4?this._type="trackpad":d>400?(this._type=null,this._lastValue=s,this._timeout=setTimeout(this._onTimeout,40,r)):this._type||(this._type=Math.abs(d*s)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,s+=this._lastValue)),r.shiftKey&&s&&(s/=4),this._type&&(this._lastWheelEvent=r,this._delta-=s,this._active||this._start(r)),r.preventDefault()}_onTimeout(r){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(r)}_start(r){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const s=$n(this._el,r);this._aroundPoint=this._aroundCenter?this._map.transform.centerPoint:s,this._aroundCoord=this._map.transform.pointCoordinate3D(this._aroundPoint),this._targetZoom=void 0,this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const r=this._map.transform;this._type==="wheel"&&r.projection.wrap&&(r._center.lng>=180||r._center.lng<=-180)&&(this._prevEase=null,this._easing=null,this._lastWheelEvent=null,this._lastWheelEventTime=0);const s=()=>r._terrainEnabled()&&this._aroundCoord?r.computeZoomRelativeTo(this._aroundCoord):r.zoom;if(this._delta!==0){const T=this._type==="wheel"&&Math.abs(this._delta)>gu?this._wheelZoomRate:this._defaultZoomRate;let S=2/(1+Math.exp(-Math.abs(this._delta*T)));this._delta<0&&S!==0&&(S=1/S);const A=s(),C=Math.pow(2,A),P=typeof this._targetZoom=="number"?r.zoomScale(this._targetZoom):C;this._targetZoom=Math.min(r.maxZoom,Math.max(r.minZoom,r.scaleZoom(P*S))),this._type==="wheel"&&(this._startZoom=A,this._easing=this._smoothOutEasing(200)),this._lastDelta=this._delta,this._delta=0}const u=typeof this._targetZoom=="number"?this._targetZoom:s(),d=this._startZoom,f=this._easing;let _,y=!1;if(this._type==="wheel"&&d&&f){const T=Math.min((o.f.now()-this._lastWheelEventTime)/200,1),S=f(T);_=o.X(d,u,S),T<1?this._frameId||(this._frameId=!0):y=!0}else _=u,y=!0;this._active=!0,y&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200));let b=_-s();return b*this._lastDelta<0&&(b=0),{noInertia:!0,needsRenderFrame:!y,zoomDelta:b,around:this._aroundPoint,aroundCoord:this._aroundCoord,originalEvent:this._lastWheelEvent}}_smoothOutEasing(r){let s=o.d8;if(this._prevEase){const u=this._prevEase,d=(o.f.now()-u.start)/u.duration,f=u.easing(d+.01)-u.easing(d),_=.27/Math.sqrt(f*f+1e-4)*.01,y=Math.sqrt(.0729-_*_);s=o.d6(_,y,.25,1)}return this._prevEase={start:o.f.now(),duration:r,easing:s},s}blur(){this.reset()}reset(){this._active=!1}_addScrollZoomBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=Ft("div","mapboxgl-scroll-zoom-blocker",this._map._container),this._alertContainer.textContent=/(Mac|iPad)/i.test(navigator.userAgent)?this._map._getUIString("ScrollZoomBlocker.CmdMessage"):this._map._getUIString("ScrollZoomBlocker.CtrlMessage"),this._alertContainer.style.fontSize=`${Math.max(10,Math.min(24,Math.floor(.05*this._el.clientWidth)))}px`)}_showBlockerAlert(){this._alertContainer.style.visibility="visible",this._alertContainer.classList.add("mapboxgl-scroll-zoom-blocker-show"),this._alertContainer.setAttribute("role","alert"),clearTimeout(this._alertTimer),this._alertTimer=setTimeout(()=>{this._alertContainer.classList.remove("mapboxgl-scroll-zoom-blocker-show"),this._alertContainer.removeAttribute("role")},200)}}class ed{constructor(r,s){this._clickZoom=r,this._tapZoom=s}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class Ps{constructor(){this.reset()}reset(){this._active=!1}blur(){this.reset()}dblclick(r,s){return r.preventDefault(),{cameraAnimation:u=>{u.easeTo({duration:300,zoom:u.getZoom()+(r.shiftKey?-1:1),around:u.unproject(s)},{originalEvent:r})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class td{constructor(){this._tap=new co({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,this._swipePoint=void 0,this._swipeTouch=0,this._tapTime=0,this._tap.reset()}touchstart(r,s,u){this._swipePoint||(this._tapTime&&r.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?u.length>0&&(this._swipePoint=s[0],this._swipeTouch=u[0].identifier):this._tap.touchstart(r,s,u))}touchmove(r,s,u){if(this._tapTime){if(this._swipePoint){if(u[0].identifier!==this._swipeTouch)return;const d=s[0],f=d.y-this._swipePoint.y;return this._swipePoint=d,r.preventDefault(),this._active=!0,{zoomDelta:f/128}}}else this._tap.touchmove(r,s,u)}touchend(r,s,u){this._tapTime?this._swipePoint&&u.length===0&&this.reset():this._tap.touchend(r,s,u)&&(this._tapTime=r.timeStamp)}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Gl{constructor(r,s,u){this._el=r,this._mousePan=s,this._touchPan=u}enable(r){this._inertiaOptions=r||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("mapboxgl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("mapboxgl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class id{constructor(r,s,u){this._pitchWithRotate=r.pitchWithRotate,this._mouseRotate=s,this._mousePitch=u}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class rd{constructor(r,s,u,d){this._el=r,this._touchZoom=s,this._touchRotate=u,this._tapDragZoom=d,this._rotationDisabled=!1,this._enabled=!0}enable(r){this._touchZoom.enable(r),this._rotationDisabled||this._touchRotate.enable(r),this._tapDragZoom.enable(),this._el.classList.add("mapboxgl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("mapboxgl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}const po=c=>c.zoom||c.drag||c.pitch||c.rotate;class xu extends o.b{}class Dp{constructor(){this.constants=[1,1,.01],this.radius=0}setup(r,s){const u=o.Q.sub([],s,r);this.radius=o.Q.length(u[2]<0?o.Q.div([],u,this.constants):[u[0],u[1],0])}projectRay(r){o.Q.div(r,r,this.constants),o.Q.normalize(r,r),o.Q.mul(r,r,this.constants);const s=o.Q.scale([],r,this.radius);if(s[2]>0){const u=o.Q.scale([],[0,0,1],o.Q.dot(s,[0,0,1])),d=o.Q.scale([],o.Q.normalize([],[s[0],s[1],0]),this.radius),f=o.Q.add([],s,o.Q.scale([],o.Q.sub([],o.Q.add([],d,u),s),2));s[0]=f[0],s[1]=f[1]}return s}}function ba(c){return c.panDelta&&c.panDelta.mag()||c.zoomDelta||c.bearingDelta||c.pitchDelta}class wa{constructor(r,s){this._map=r,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Wh(r),this._bearingSnap=s.bearingSnap,this._previousActiveHandlers={},this._trackingEllipsoid=new Dp,this._dragOrigin=null,this._eventsInProgress={},this._addDefaultHandlers(s),o.a$(["handleEvent","handleWindowEvent"],this);const u=this._el;this._listeners=[[u,"touchstart",{passive:!0}],[u,"touchmove",{passive:!1}],[u,"touchend",void 0],[u,"touchcancel",void 0],[u,"mousedown",void 0],[u,"mousemove",void 0],[u,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[u,"mouseover",void 0],[u,"mouseout",void 0],[u,"dblclick",void 0],[u,"click",void 0],[u,"keydown",{capture:!1}],[u,"keyup",void 0],[u,"wheel",{passive:!1}],[u,"contextmenu",void 0],[window,"blur",void 0]];for(const[d,f,_]of this._listeners){const y=d===document?this.handleWindowEvent:this.handleEvent;d.addEventListener(f,y,_)}}destroy(){for(const[r,s,u]of this._listeners){const d=r===document?this.handleWindowEvent:this.handleEvent;r.removeEventListener(s,d,u)}}_addDefaultHandlers(r){const s=this._map,u=s.getCanvasContainer();this._add("mapEvent",new uu(s,r));const d=s.boxZoom=new Ul(s,r);this._add("boxZoom",d);const f=new du,_=new Ps;s.doubleClickZoom=new ed(_,f),this._add("tapZoom",f),this._add("clickZoom",_);const y=new td;this._add("tapDragZoom",y);const b=s.touchPitch=new Yh(s);this._add("touchPitch",b);const T=new fu(r),S=new Is(r);s.dragRotate=new id(r,T,S),this._add("mouseRotate",T,["mousePitch"]),this._add("mousePitch",S,["mouseRotate"]);const A=new Qh(r),C=new Pp(s,r);s.dragPan=new Gl(u,A,C),this._add("mousePan",A),this._add("touchPan",C,["touchZoom","touchRotate"]);const P=new _u,L=new zp;s.touchZoomRotate=new rd(u,L,P,y),this._add("touchRotate",P,["touchPan","touchZoom"]),this._add("touchZoom",L,["touchPan","touchRotate"]),this._add("blockableMapEvent",new Vl(s));const R=s.scrollZoom=new Cs(s,this);this._add("scrollZoom",R,["mousePan"]);const k=s.keyboard=new Jh;this._add("keyboard",k);for(const O of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])r.interactive&&r[O]&&s[O].enable(r[O])}_add(r,s,u){this._handlers.push({handlerName:r,handler:s,allowed:u}),this._handlersById[r]=s}stop(r){if(!this._updatingCamera){for(const{handler:s}of this._handlers)s.reset();this._inertia.clear(),this._fireEvents({},{},r),this._changes=[],this._originalZoom=void 0}}isActive(){for(const{handler:r}of this._handlers)if(r.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!po(this._eventsInProgress)||this.isZooming()}_isDragging(){return!!this._eventsInProgress.drag}_blockedByActive(r,s,u){for(const d in r)if(d!==u&&(!s||s.indexOf(d)<0))return!0;return!1}handleWindowEvent(r){this.handleEvent(r,`${r.type}Window`)}_getMapTouches(r){const s=[];for(const u of r)this._el.contains(u.target)&&s.push(u);return s}handleEvent(r,s){this._updatingCamera=!0;const u=r.type==="renderFrame",d=u?void 0:r,f={needsRenderFrame:!1},_={},y={},b=r.touches?this._getMapTouches(r.touches):void 0,T=b?Yr(this._el,b):u?void 0:$n(this._el,r);for(const{handlerName:C,handler:P,allowed:L}of this._handlers){if(!P.isEnabled())continue;let R;this._blockedByActive(y,L,C)?P.reset():P[s||r.type]&&(R=P[s||r.type](r,T,b),this.mergeHandlerResult(f,_,R,C,d),R&&R.needsRenderFrame&&this._triggerRenderFrame()),(R||P.isActive())&&(y[C]=P)}const S={};for(const C in this._previousActiveHandlers)y[C]||(S[C]=d);this._previousActiveHandlers=y,(Object.keys(S).length||ba(f))&&(this._changes.push([f,_,S]),this._triggerRenderFrame()),(Object.keys(y).length||ba(f))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:A}=f;A&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],A(this._map))}mergeHandlerResult(r,s,u,d,f){if(!u)return;o.e(r,u);const _={handlerName:d,originalEvent:u.originalEvent||f};u.zoomDelta!==void 0&&(s.zoom=_),u.panDelta!==void 0&&(s.drag=_),u.pitchDelta!==void 0&&(s.pitch=_),u.bearingDelta!==void 0&&(s.rotate=_)}_applyChanges(){const r={},s={},u={};for(const[d,f,_]of this._changes)d.panDelta&&(r.panDelta=(r.panDelta||new o.P(0,0))._add(d.panDelta)),d.zoomDelta&&(r.zoomDelta=(r.zoomDelta||0)+d.zoomDelta),d.bearingDelta&&(r.bearingDelta=(r.bearingDelta||0)+d.bearingDelta),d.pitchDelta&&(r.pitchDelta=(r.pitchDelta||0)+d.pitchDelta),d.around!==void 0&&(r.around=d.around),d.aroundCoord!==void 0&&(r.aroundCoord=d.aroundCoord),d.pinchAround!==void 0&&(r.pinchAround=d.pinchAround),d.noInertia&&(r.noInertia=d.noInertia),o.e(s,f),o.e(u,_);this._updateMapTransform(r,s,u),this._changes=[]}_updateMapTransform(r,s,u){const d=this._map,f=d.transform,_=N=>[N.x,N.y,N.z];if((N=>{const $=this._eventsInProgress.drag;return $&&!this._handlersById[$.handlerName].isActive()})()&&!ba(r)){const N=f.zoom;f.cameraElevationReference="sea",this._originalZoom!=null&&f._orthographicProjectionAtLowPitch&&f.projection.name!=="globe"&&f.pitch===0?(f.cameraElevationReference="ground",f.zoom=this._originalZoom):(f.recenterOnTerrain(),f.cameraElevationReference="ground"),N!==f.zoom&&this._map._update(!0)}if(f._isCameraConstrained&&d._stop(!0),!ba(r))return void this._fireEvents(s,u,!0);let{panDelta:y,zoomDelta:b,bearingDelta:T,pitchDelta:S,around:A,aroundCoord:C,pinchAround:P}=r;f._isCameraConstrained&&(b>0&&(b=0),f._isCameraConstrained=!1),P!==void 0&&(A=P),(b||(N=>s[N]&&!this._eventsInProgress[N])("drag"))&&A&&(this._dragOrigin=_(f.pointCoordinate3D(A)),this._originalZoom=f.zoom,this._trackingEllipsoid.setup(f._camera.position,this._dragOrigin)),f.cameraElevationReference="sea",d._stop(!0),A=A||d.transform.centerPoint,T&&(f.bearing+=T),S&&(f.pitch+=S),f._updateCameraState();const L=[0,0,0];if(y)if(f.projection.name==="mercator"){const N=this._trackingEllipsoid.projectRay(f.screenPointToMercatorRay(A).dir),$=this._trackingEllipsoid.projectRay(f.screenPointToMercatorRay(A.sub(y)).dir);L[0]=$[0]-N[0],L[1]=$[1]-N[1]}else{const N=f.pointCoordinate(A);if(f.projection.name==="globe"){y=y.rotate(-f.angle);const $=f._pixelsPerMercatorPixel/f.worldSize;L[0]=-y.x*o.d9(o.ax(N.y))*$,L[1]=-y.y*o.d9(f.center.lat)*$}else{const $=f.pointCoordinate(A.sub(y));N&&$&&(L[0]=$.x-N.x,L[1]=$.y-N.y)}}const R=f.zoom,k=[0,0,0];if(b){const N=_(C||f.pointCoordinate3D(A)),$={dir:o.Q.normalize([],o.Q.sub([],N,f._camera.position))};if($.dir[2]<0){const Z=f.zoomDeltaToMovement(N,b);o.Q.scale(k,$.dir,Z)}}const O=o.Q.add(L,L,k);f._translateCameraConstrained(O),b&&Math.abs(f.zoom-R)>1e-4&&f.recenterOnTerrain(),f.cameraElevationReference="ground",this._map._update(),r.noInertia||this._inertia.record(r),this._fireEvents(s,u,!0)}_fireEvents(r,s,u){const d=po(this._eventsInProgress),f=po(r),_={};for(const S in r){const{originalEvent:A}=r[S];this._eventsInProgress[S]||(_[`${S}start`]=A),this._eventsInProgress[S]=r[S]}!d&&f&&this._fireEvent("movestart",f.originalEvent);for(const S in _)this._fireEvent(S,_[S]);f&&this._fireEvent("move",f.originalEvent);for(const S in r){const{originalEvent:A}=r[S];this._fireEvent(S,A)}const y={};let b;for(const S in this._eventsInProgress){const{handlerName:A,originalEvent:C}=this._eventsInProgress[S];this._handlersById[A].isActive()||(delete this._eventsInProgress[S],b=s[A]||C,y[`${S}end`]=b)}for(const S in y)this._fireEvent(S,y[S]);const T=po(this._eventsInProgress);if(u&&(d||f)&&!T){this._updatingCamera=!0;const S=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),A=C=>C!==0&&-this._bearingSnap<C&&C<this._bearingSnap;
2108S?(A(S.bearing||this._map.getBearing())&&(S.bearing=0),this._map.easeTo(S,{originalEvent:b})):(this._map.fire(new o.b("moveend",{originalEvent:b})),A(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(r,s){this._map.fire(new o.b(r,s?{originalEvent:s}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(r=>{this._frameId=void 0,this.handleEvent(new xu("renderFrame",{timeStamp:r})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}const nd="map.setFreeCameraOptions(...) and map.getFreeCameraOptions() are not yet supported for non-mercator projections.";class Rp extends o.E{constructor(r,s){super(),this._moving=!1,this._zooming=!1,this.transform=r,this._bearingSnap=s.bearingSnap,this._respectPrefersReducedMotion=s.respectPrefersReducedMotion!==!1,o.a$(["_renderFrameCallback"],this)}getCenter(){return new o.bq(this.transform.center.lng,this.transform.center.lat)}setCenter(r,s){return this.jumpTo({center:r},s)}panBy(r,s,u){return r=o.P.convert(r).mult(-1),this.panTo(this.transform.center,o.e({offset:r},s),u)}panTo(r,s,u){return this.easeTo(o.e({center:r},s),u)}getZoom(){return this.transform.zoom}setZoom(r,s){return this.jumpTo({zoom:r},s),this}zoomTo(r,s,u){return this.easeTo(o.e({zoom:r},s),u)}zoomIn(r,s){return this.zoomTo(this.getZoom()+1,r,s),this}zoomOut(r,s){return this.zoomTo(this.getZoom()-1,r,s),this}getBearing(){return this.transform.bearing}setBearing(r,s){return this.jumpTo({bearing:r},s),this}getPadding(){return this.transform.padding}setPadding(r,s){return this.jumpTo({padding:r},s),this}rotateTo(r,s,u){return this.easeTo(o.e({bearing:r},s),u)}resetNorth(r,s){return this.rotateTo(0,o.e({duration:1e3},r),s),this}resetNorthPitch(r,s){return this.easeTo(o.e({bearing:0,pitch:0,duration:1e3},r),s),this}snapToNorth(r,s){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(r,s):this}getPitch(){return this.transform.pitch}setPitch(r,s){return this.jumpTo({pitch:r},s),this}cameraForBounds(r,s){r=o.ag.convert(r);const u=s&&s.bearing||0,d=s&&s.pitch||0,f=r.getNorthWest(),_=r.getSouthEast();return this._cameraForBounds(this.transform,f,_,u,d,s)}_extendPadding(r){const s={top:0,right:0,bottom:0,left:0};return r==null?o.e({},s,this.transform.padding):typeof r=="number"?{top:r,bottom:r,right:r,left:r}:o.e({},s,r)}_extendCameraOptions(r){return(r=o.e({offset:[0,0],maxZoom:this.transform.maxZoom},r)).padding=this._extendPadding(r.padding),r}_minimumAABBFrustumDistance(r,s){const u=s.max[0]-s.min[0],d=s.max[1]-s.min[1];return u/d>r.aspect?u/(2*Math.tan(.5*r.fovX)*r.aspect):d/(2*Math.tan(.5*r.fovY)*r.aspect)}_cameraForBoundsOnGlobe(r,s,u,d,f,_){const y=r.clone(),b=this._extendCameraOptions(_);y.bearing=d,y.pitch=f;const T=o.bq.convert(s),S=o.bq.convert(u),A=.5*(T.lat+S.lat),C=.5*(T.lng+S.lng),P=o.da(A,C),L=o.Q.normalize([],P),R=o.Q.normalize([],o.Q.cross([],L,[0,1,0])),k=o.Q.cross([],R,L),O=[R[0],R[1],R[2],0,k[0],k[1],k[2],0,L[0],L[1],L[2],0,0,0,0,1],N=[P,o.da(T.lat,T.lng),o.da(S.lat,T.lng),o.da(S.lat,S.lng),o.da(T.lat,S.lng),o.da(A,T.lng),o.da(A,S.lng),o.da(T.lat,C),o.da(S.lat,C)];let $=o.bV.fromPoints(N.map(de=>[o.Q.dot(R,de),o.Q.dot(k,de),o.Q.dot(L,de)]));const Z=o.Q.transformMat4([],$.center,O);o.Q.squaredLength(Z)===0&&o.Q.set(Z,0,0,1),o.Q.normalize(Z,Z),o.Q.scale(Z,Z,o.ae),y.center=o.db(Z);const Q=y.getWorldToCameraMatrix(),B=o.a9.invert(new Float64Array(16),Q);$=o.bV.applyTransform($,o.a9.multiply([],Q,O));const U=this._extendAABB($,y,b,d);if(!U)return void o.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");$=U,o.Q.transformMat4(Z,Z,Q);const K=.5*($.max[2]-$.min[2]),Y=this._minimumAABBFrustumDistance(y,$),re=o.Q.scale([],[0,0,1],K),he=o.Q.add(re,Z,re),ie=Y+(y.pitch===0?0:o.Q.distance(Z,he)),ce=y.globeCenterInViewSpace,pe=o.Q.sub([],Z,[ce[0],ce[1],ce[2]]);o.Q.normalize(pe,pe),o.Q.scale(pe,pe,ie);const te=o.Q.add([],Z,pe);o.Q.transformMat4(te,te,B);const ae=o.dc/o.ae,Me=o.Q.length(te),se=o.bo(Math.max(Me*ae-o.dc,Number.EPSILON),0),ue=Math.min(y.zoomFromMercatorZAdjusted(se),b.maxZoom);return ue>.5*(o.bJ+o.bA)?(y.setProjection({name:"mercator"}),y.zoom=ue,this._cameraForBounds(y,s,u,d,f,_)):{center:y.center,zoom:ue,bearing:d,pitch:f}}_extendAABB(r,s,u,d){const f=.5*((u.padding.left||0)+(u.padding.right||0)),_=.5*((u.padding.top||0)+(u.padding.bottom||0)),y=_,b=f,T=f,S=_,A=s.width-(b+T),C=s.height-(y+S),P=o.Q.sub([],r.max,r.min),L=Math.min(A/P[0],C/P[1]),R=Math.min(s.scaleZoom(s.scale*L),u.maxZoom);if(isNaN(R))return null;
vendor: 16,831 bytes, line 2108
2108const k=s.scale/s.zoomScale(R),O=new o.bV([r.min[0]-b*k,r.min[1]-S*k,r.min[2]],[r.max[0]+T*k,r.max[1]+y*k,r.max[2]]),N=(typeof u.offset.x=="number"&&typeof u.offset.y=="number"?new o.P(u.offset.x,u.offset.y):o.P.convert(u.offset)).rotate(-o.bm(d));return O.center[0]-=N.x*k,O.center[1]+=N.y*k,O}queryTerrainElevation(r,s){const u=this.transform.elevation;return u?(s=o.e({},{exaggerated:!0},s),u.getAtPoint(o.O.fromLngLat(r),null,s.exaggerated)):null}_cameraForBounds(r,s,u,d,f,_){if(r.projection.name==="globe")return this._cameraForBoundsOnGlobe(r,s,u,d,f,_);const y=r.clone(),b=this._extendCameraOptions(_);y.bearing=d,y.pitch=f;const T=o.bq.convert(s),S=o.bq.convert(u),A=new o.bq(T.lng,S.lat),C=new o.bq(S.lng,T.lat),P=y.project(T),L=y.project(S),R=this.queryTerrainElevation(T),k=this.queryTerrainElevation(S),O=this.queryTerrainElevation(A),N=this.queryTerrainElevation(C),$=[[P.x,P.y,Math.min(R||0,k||0,O||0,N||0)],[L.x,L.y,Math.max(R||0,k||0,O||0,N||0)]];let Z=o.bV.fromPoints($);const Q=y.getWorldToCameraMatrix(),B=o.a9.invert(new Float64Array(16),Q);Z=o.bV.applyTransform(Z,Q);const U=this._extendAABB(Z,y,b,d);if(!U)return void o.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");Z=U;const K=.5*o.Q.sub([],Z.max,Z.min)[2],Y=this._minimumAABBFrustumDistance(y,Z),re=[0,0,1,0];o.aa.transformMat4(re,re,Q),o.aa.normalize(re,re);const he=o.Q.scale([],re,Y+K),ie=o.Q.add([],Z.center,he);o.Q.transformMat4(Z.center,Z.center,B),o.Q.transformMat4(ie,ie,B);const ce=[Z.center[0],Z.center[1],ie[2]*y.pixelsPerMeter];o.Q.scale(ce,ce,1/y.worldSize);const pe=o.aw(ce[0]),te=o.ax(ce[1]),ae=Math.min(y._zoomFromMercatorZ(ce[2]),b.maxZoom),Me=new o.bq(pe,te);return y.mercatorFromTransition&&ae<.5*(o.bJ+o.bA)?(y.setProjection({name:"globe"}),y.zoom=ae,this._cameraForBounds(y,s,u,d,f,_)):{center:Me,zoom:ae,bearing:d,pitch:f}}fitBounds(r,s,u){const d=this.cameraForBounds(r,s);return this._fitInternal(d,s,u)}fitScreenCoordinates(r,s,u,d,f){const _=o.P.convert(r),y=o.P.convert(s),b=new o.P(Math.min(_.x,y.x),Math.min(_.y,y.y)),T=new o.P(Math.max(_.x,y.x),Math.max(_.y,y.y));if(this.transform.projection.name==="mercator"&&this.transform.anyCornerOffEdge(_,y))return this;const S=this.transform.pointLocation3D(b),A=this.transform.pointLocation3D(T),C=this.transform.pointLocation3D(new o.P(b.x,T.y)),P=this.transform.pointLocation3D(new o.P(T.x,b.y)),L=[Math.min(S.lng,A.lng,C.lng,P.lng),Math.min(S.lat,A.lat,C.lat,P.lat)],R=[Math.max(S.lng,A.lng,C.lng,P.lng),Math.max(S.lat,A.lat,C.lat,P.lat)],k=d&&d.pitch?d.pitch:this.getPitch(),O=this._cameraForBounds(this.transform,L,R,u,k,d);return this._fitInternal(O,d,f)}_fitInternal(r,s,u){return r?(s=o.e(r,s)).linear?this.easeTo(s,u):this.flyTo(s,u):this}jumpTo(r,s){this.stop();const u=r.preloadOnly?this.transform.clone():this.transform;let d=!1,f=!1,_=!1;return"zoom"in r&&u.zoom!==+r.zoom&&(d=!0,u.zoom=+r.zoom),r.center!==void 0&&(u.center=o.bq.convert(r.center)),"bearing"in r&&u.bearing!==+r.bearing&&(f=!0,u.bearing=+r.bearing),"pitch"in r&&u.pitch!==+r.pitch&&(_=!0,u.pitch=+r.pitch),r.padding==null||u.isPaddingEqual(r.padding)||(u.padding=r.padding),r.preloadOnly?(this._preloadTiles(u),this):(this.fire(new o.b("movestart",s)).fire(new o.b("move",s)),d&&this.fire(new o.b("zoomstart",s)).fire(new o.b("zoom",s)).fire(new o.b("zoomend",s)),f&&this.fire(new o.b("rotatestart",s)).fire(new o.b("rotate",s)).fire(new o.b("rotateend",s)),_&&this.fire(new o.b("pitchstart",s)).fire(new o.b("pitch",s)).fire(new o.b("pitchend",s)),this.fire(new o.b("moveend",s)))}getFreeCameraOptions(){return this.transform.projection.supportsFreeCamera||o.w(nd),this.transform.getFreeCameraOptions()}setFreeCameraOptions(r,s){const u=this.transform;if(!u.projection.supportsFreeCamera)return o.w(nd),this;this.stop();const d=u.zoom,f=u.pitch,_=u.bearing;u.setFreeCameraOptions(r);const y=d!==u.zoom,b=f!==u.pitch,T=_!==u.bearing;return this.fire(new o.b("movestart",s)).fire(new o.b("move",s)),y&&this.fire(new o.b("zoomstart",s)).fire(new o.b("zoom",s)).fire(new o.b("zoomend",s)),T&&this.fire(new o.b("rotatestart",s)).fire(new o.b("rotate",s)).fire(new o.b("rotateend",s)),b&&this.fire(new o.b("pitchstart",s)).fire(new o.b("pitch",s)).fire(new o.b("pitchend",s)),this.fire(new o.b("moveend",s)),this}easeTo(r,s){this._stop(!1,r.easeId),((r=o.e({offset:[0,0],duration:500,easing:o.d8},r)).animate===!1||this._prefersReducedMotion(r))&&(r.duration=0);const u=this.transform,d=this.getZoom(),f=this.getBearing(),_=this.getPitch(),y=this.getPadding(),b="zoom"in r?+r.zoom:d,T="bearing"in r?this._normalizeBearing(r.bearing,f):f,S="pitch"in r?+r.pitch:_,A=this._extendPadding(r.padding),C=o.P.convert(r.offset);let P,L,R;if(u.projection.name==="globe"){const Y=o.O.fromLngLat(u.center),re=C.rotate(-u.angle);Y.x+=re.x/u.worldSize,Y.y+=re.y/u.worldSize;const he=Y.toLngLat(),ie=o.bq.convert(r.center||he);this._normalizeCenter(ie),P=u.centerPoint.add(re),L=new o.P(Y.x,Y.y).mult(u.worldSize),R=new o.P(o.a8(ie.lng),o.ah(ie.lat)).mult(u.worldSize).sub(L)}else{P=u.centerPoint.add(C);const Y=u.pointLocation(P),re=o.bq.convert(r.center||Y);this._normalizeCenter(re),L=u.project(Y),R=u.project(re).sub(L)}const k=u.zoomScale(b-d);let O,N;r.around&&(O=o.bq.convert(r.around),N=u.locationPoint(O));const $=this._zooming||b!==d,Z=this._rotating||f!==T,Q=this._pitching||S!==_,B=!u.isPaddingEqual(A),U=Y=>re=>{if($&&(Y.zoom=o.X(d,b,re)),Z&&(Y.bearing=o.X(f,T,re)),Q&&(Y.pitch=o.X(_,S,re)),B&&(Y.interpolatePadding(y,A,re),P=Y.centerPoint.add(C)),O)Y.setLocationAtPoint(O,N);else{const he=Y.zoomScale(Y.zoom-d),ie=b>d?Math.min(2,k):Math.max(.5,k),ce=Math.pow(ie,1-re),pe=Y.unproject(L.add(R.mult(re*ce)).mult(he));Y.setLocationAtPoint(Y.renderWorldCopies?pe.wrap():pe,P)}return r.preloadOnly||this._fireMoveEvents(s),Y};if(r.preloadOnly){const Y=this._emulate(U,r.duration,u);return this._preloadTiles(Y),this}const K={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=$,this._rotating=Z,this._pitching=Q,this._padding=B,this._easeId=r.easeId,this._prepareEase(s,r.noMoveStart,K),this._ease(U(u),Y=>{u.cameraElevationReference==="sea"&&u.recenterOnTerrain(),this._afterEase(s,Y)},r),this}_prepareEase(r,s,u={}){this._moving=!0,this.transform.cameraElevationReference="sea",this.transform._orthographicProjectionAtLowPitch&&this.transform.pitch===0&&this.transform.projection.name!=="globe"&&(this.transform.cameraElevationReference="ground"),s||u.moving||this.fire(new o.b("movestart",r)),this._zooming&&!u.zooming&&this.fire(new o.b("zoomstart",r)),this._rotating&&!u.rotating&&this.fire(new o.b("rotatestart",r)),this._pitching&&!u.pitching&&this.fire(new o.b("pitchstart",r))}_fireMoveEvents(r){this.fire(new o.b("move",r)),this._zooming&&this.fire(new o.b("zoom",r)),this._rotating&&this.fire(new o.b("rotate",r)),this._pitching&&this.fire(new o.b("pitch",r))}_afterEase(r,s){if(this._easeId&&s&&this._easeId===s)return;this._easeId=void 0,this.transform.cameraElevationReference="ground";const u=this._zooming,d=this._rotating,f=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,u&&this.fire(new o.b("zoomend",r)),d&&this.fire(new o.b("rotateend",r)),f&&this.fire(new o.b("pitchend",r)),this.fire(new o.b("moveend",r))}flyTo(r,s){if(this._prefersReducedMotion(r)){const ue=o.af(r,["center","zoom","bearing","pitch","around"]);return this.jumpTo(ue,s)}this.stop(),r=o.e({offset:[0,0],speed:1.2,curve:1.42,easing:o.d8},r);const u=this.transform,d=this.getZoom(),f=this.getBearing(),_=this.getPitch(),y=this.getPadding(),b="zoom"in r?o.ad(+r.zoom,u.minZoom,u.maxZoom):d,T="bearing"in r?this._normalizeBearing(r.bearing,f):f,S="pitch"in r?+r.pitch:_,A=this._extendPadding(r.padding),C=u.zoomScale(b-d),P=o.P.convert(r.offset);let L=u.centerPoint.add(P);const R=u.pointLocation(L),k=o.bq.convert(r.center||R);this._normalizeCenter(k);const O=u.project(R),N=u.project(k).sub(O);let $=r.curve;const Z=Math.max(u.width,u.height),Q=Z/C,B=N.mag();if("minZoom"in r){const ue=o.ad(Math.min(r.minZoom,d,b),u.minZoom,u.maxZoom),de=Z/u.zoomScale(ue-d);$=Math.sqrt(de/B*2)}const U=$*$;function K(ue){const de=(Q*Q-Z*Z+(ue?-1:1)*U*U*B*B)/(2*(ue?Q:Z)*U*B);return Math.log(Math.sqrt(de*de+1)-de)}function Y(ue){return(Math.exp(ue)-Math.exp(-ue))/2}function re(ue){return(Math.exp(ue)+Math.exp(-ue))/2}const he=K(0);let ie=function(ue){return re(he)/re(he+$*ue)},ce=function(ue){return Z*((re(he)*(Y(de=he+$*ue)/re(de))-Y(he))/U)/B;var de},pe=(K(1)-he)/$;if(Math.abs(B)<1e-6||!isFinite(pe)){if(Math.abs(Z-Q)<1e-6)return this.easeTo(r,s);const ue=Q<Z?-1:1;pe=Math.abs(Math.log(Q/Z))/$,ce=function(){return 0},ie=function(de){return Math.exp(ue*$*de)}}r.duration="duration"in r?+r.duration:1e3*pe/("screenSpeed"in r?+r.screenSpeed/$:+r.speed),r.maxDuration&&r.duration>r.maxDuration&&(r.duration=0);const te=f!==T,ae=S!==_,Me=!u.isPaddingEqual(A),se=ue=>de=>{const W=de*pe,xe=1/ie(W);ue.zoom=de===1?b:d+ue.scaleZoom(xe),te&&(ue.bearing=o.X(f,T,de)),ae&&(ue.pitch=o.X(_,S,de)),Me&&(ue.interpolatePadding(y,A,de),L=ue.centerPoint.add(P));const Ge=de===1?k:ue.unproject(O.add(N.mult(ce(W))).mult(xe));return ue.setLocationAtPoint(ue.renderWorldCopies?Ge.wrap():Ge,L),ue._updateCameraOnTerrain(),r.preloadOnly||this._fireMoveEvents(s),ue};if(r.preloadOnly){const ue=this._emulate(se,r.duration,u);return this._preloadTiles(ue),this}return this._zooming=!0,this._rotating=te,this._pitching=ae,this._padding=Me,this._prepareEase(s,!1),this._ease(se(u),()=>this._afterEase(s),r),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_requestRenderFrame(r){}_cancelRenderFrame(r){}_stop(r,s){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),this._easeFrameId=void 0,this._onEaseFrame=void 0),this._onEaseEnd){const u=this._onEaseEnd;this._onEaseEnd=void 0,u.call(this,s)}if(!r){const u=this.handlers;u&&u.stop(!1)}return this}_ease(r,s,u){u.animate===!1||u.duration===0?(r(1),s()):(this._easeStart=o.f.now(),this._easeOptions=u,this._onEaseFrame=r,this._onEaseEnd=s,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){const r=Math.min((o.f.now()-this._easeStart)/this._easeOptions.duration,1),s=this._onEaseFrame;s&&s(this._easeOptions.easing(r)),r<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(r,s){r=o.bk(r,-180,180);const u=Math.abs(r-s);return Math.abs(r-360-s)<u&&(r-=360),Math.abs(r+360-s)<u&&(r+=360),r}_normalizeCenter(r){const s=this.transform;if(s.maxBounds||s.projection.name!=="globe"&&!s.renderWorldCopies)return;const u=r.lng-s.center.lng;r.lng+=u>180?-360:u<-180?360:0}_prefersReducedMotion(r){return this._respectPrefersReducedMotion&&o.f.prefersReducedMotion&&!(r&&r.essential)}_emulate(r,s,u){const d=Math.ceil(15*s/1e3),f=[],_=r(u.clone());for(let y=0;y<=d;y++){const b=_(y/d);f.push(b.clone())}return f}_preloadTiles(r,s){}}class vu{constructor(r={}){this.options=r,o.a$(["_toggleAttribution","_updateEditLink","_updateData","_updateCompact"],this)}getDefaultPosition(){return"bottom-right"}onAdd(r){const s=this.options&&this.options.compact;return this._map=r,this._container=Ft("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=Ft("button","mapboxgl-ctrl-attrib-button",this._container),Ft("span","mapboxgl-ctrl-icon",this._compactButton).setAttribute("aria-hidden","true"),this._compactButton.type="button",this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=Ft("div","mapboxgl-ctrl-attrib-inner",this._container),s&&this._container.classList.add("mapboxgl-compact"),this._updateAttributions(),this._updateEditLink(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("moveend",this._updateEditLink),s===void 0&&(this._map.on("resize",this._updateCompact),this._updateCompact()),this._container}onRemove(){this._container.remove(),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("moveend",this._updateEditLink),this._map.off("resize",this._updateCompact),this._map=void 0,this._attribHTML=void 0}_setElementTitle(r,s){const u=this._map._getUIString(`AttributionControl.${s}`);r.removeAttribute("title"),r.firstElementChild&&r.firstElementChild.setAttribute("title",u)}_toggleAttribution(){this._container.classList.contains("mapboxgl-compact-show")?(this._container.classList.remove("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","false")):(this._container.classList.add("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","true"))}_updateEditLink(){let r=this._editLink;r||(r=this._editLink=this._container.querySelector(".mapbox-improve-map"));const s=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:this._map._requestManager._customAccessToken||o.dd.ACCESS_TOKEN}];if(r){const u=s.reduce((d,f,_)=>(f.value&&(d+=`${f.key}=${f.value}${_<s.length-1?"&":""}`),d),"?");r.href=`${o.dd.FEEDBACK_URL}/${u}#${Zh(this._map,!0)}`,r.rel="noopener nofollow",this._setElementTitle(r,"MapFeedback")}}_updateData(r){!r||r.sourceDataType!=="metadata"&&r.sourceDataType!=="visibility"&&r.dataType!=="style"||(this._updateAttributions(),this._updateEditLink())}_updateAttributions(){if(!this._map.style)return;let r=[];if(this._map.style.stylesheet){const d=this._map.style.stylesheet;this.styleOwner=d.owner,this.styleId=d.id}const s=this._map.style._mergedSourceCaches;for(const d in s){const f=s[d];if(f.used){const _=f.getSource();_.attribution&&r.indexOf(_.attribution)<0&&r.push(_.attribution)}}r.sort((d,f)=>d.length-f.length),r=r.filter((d,f)=>{for(let _=f+1;_<r.length;_++)if(r[_].indexOf(d)>=0)return!1;return!0}),this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?r=[...this.options.customAttribution,...r]:r.unshift(this.options.customAttribution));const u=r.join(" | ");u!==this._attribHTML&&(this._attribHTML=u,r.length?(this._innerContainer.innerHTML=u,this._container.classList.remove("mapboxgl-attrib-empty")):this._container.classList.add("mapboxgl-attrib-empty"),this._editLink=null)}_updateCompact(){this._map.getCanvasContainer().offsetWidth<=640?this._container.classList.add("mapboxgl-compact"):this._container.classList.remove("mapboxgl-compact","mapboxgl-compact-show")}}class sd{constructor(){o.a$(["_updateLogo","_updateCompact"],this)}onAdd(r){this._map=r,this._container=Ft("div","mapboxgl-ctrl");const s=Ft("a","mapboxgl-ctrl-logo");return s.target="_blank",s.rel="noopener nofollow",s.href="https://www.mapbox.com/",s.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),s.setAttribute("rel","noopener nofollow"),this._container.appendChild(s),this._container.style.display="none",this._map.on("sourcedata",this._updateLogo),this._updateLogo(),this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){this._container.remove(),this._map.off("sourcedata",this._updateLogo),this._map.off("resize",this._updateCompact)}getDefaultPosition(){return"bottom-left"}_updateLogo(r){r&&r.sourceDataType!=="metadata"||(this._container.style.display=this._logoRequired()?"block":"none")}_logoRequired(){if(!this._map.style)return!0;const r=this._map.style._sourceCaches;if(Object.entries(r).length===0)return!0;for(const s in r){const u=r[s].getSource();if(u.hasOwnProperty("mapbox_logo")&&!u.mapbox_logo)return!1}return!0}_updateCompact(){const r=this._container.children;if(r.length){const s=r[0];this._map.getCanvasContainer().offsetWidth<250?s.classList.add("mapboxgl-compact"):s.classList.remove("mapboxgl-compact")}}}class ql{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(r){const s=++this._id;return this._queue.push({callback:r,id:s,cancelled:!1}),s}remove(r){const s=this._currentlyRunning,u=s?this._queue.concat(s):this._queue;for(const d of u)if(d.id===r)return void(d.cancelled=!0)}run(r=0){const s=this._currentlyRunning=this._queue;this._queue=[];for(const u of s)if(!u.cancelled&&(u.callback(r),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}function Zl(c,r,s){if(c=new o.bq(c.lng,c.lat),r){const u=new o.bq(c.lng-360,c.lat),d=new o.bq(c.lng+360,c.lat),f=360*Math.ceil(Math.abs(c.lng-s.center.lng)/360),_=s.locationPoint(c).distSqr(r),y=r.x<0||r.y<0||r.x>s.width||r.y>s.height;s.locationPoint(u).distSqr(r)<_&&(y||Math.abs(u.lng-s.center.lng)<f)?c=u:s.locationPoint(d).distSqr(r)<_&&(y||Math.abs(d.lng-s.center.lng)<f)&&(c=d)}for(;Math.abs(c.lng-s.center.lng)>180;){const u=s.locationPoint(c);if(u.x>=0&&u.y>=0&&u.x<=s.width&&u.y<=s.height)break;c.lng>s.center.lng?c.lng-=360:c.lng+=360}return c}
vendor: 4,133 bytes, line 2108
2108const fo={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"};class Ta extends o.E{constructor(r,s){if(super(),(r instanceof HTMLElement||s)&&(r=o.e({element:r},s)),o.a$(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress","_clearFadeTimer"],this),this._anchor=r&&r.anchor||"center",this._color=r&&r.color||"#3FB1CE",this._scale=r&&r.scale||1,this._draggable=r&&r.draggable||!1,this._clickTolerance=r&&r.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=r&&r.rotation||0,this._rotationAlignment=r&&r.rotationAlignment||"auto",this._pitchAlignment=r&&r.pitchAlignment&&r.pitchAlignment||"auto",this._updateMoving=()=>this._update(!0),this._occludedOpacity=r&&r.occludedOpacity||.2,r&&r.element)this._element=r.element,this._offset=o.P.convert(r&&r.offset||[0,0]);else{this._defaultMarker=!0,this._element=Ft("div");const f=41,_=27,y=Pr("svg",{display:"block",height:f*this._scale+"px",width:_*this._scale+"px",viewBox:`0 0 ${_} ${f}`},this._element),b=Pr("radialGradient",{id:"shadowGradient"},Pr("defs",{},y));Pr("stop",{offset:"10%","stop-opacity":.4},b),Pr("stop",{offset:"100%","stop-opacity":.05},b),Pr("ellipse",{cx:13.5,cy:34.8,rx:10.5,ry:5.25,fill:"url(#shadowGradient)"},y),Pr("path",{fill:this._color,d:"M27,13.5C27,19.07 20.25,27 14.75,34.5C14.02,35.5 12.98,35.5 12.25,34.5C6.75,27 0,19.22 0,13.5C0,6.04 6.04,0 13.5,0C20.96,0 27,6.04 27,13.5Z"},y),Pr("path",{opacity:.25,d:"M13.5,0C6.04,0 0,6.04 0,13.5C0,19.22 6.75,27 12.25,34.5C13,35.52 14.02,35.5 14.75,34.5C20.25,27 27,19.07 27,13.5C27,6.04 20.96,0 13.5,0ZM13.5,1C20.42,1 26,6.58 26,13.5C26,15.9 24.5,19.18 22.22,22.74C19.95,26.3 16.71,30.14 13.94,33.91C13.74,34.18 13.61,34.32 13.5,34.44C13.39,34.32 13.26,34.18 13.06,33.91C10.28,30.13 7.41,26.31 5.02,22.77C2.62,19.23 1,15.95 1,13.5C1,6.58 6.58,1 13.5,1Z"},y),Pr("circle",{fill:"white",cx:13.5,cy:13.5,r:5.5},y),this._offset=o.P.convert(r&&r.offset||[0,-14])}this._element.hasAttribute("aria-label")||this._element.setAttribute("aria-label","Map marker"),this._element.hasAttribute("role")||this._element.setAttribute("role","img"),this._element.classList.add("mapboxgl-marker"),this._element.addEventListener("dragstart",f=>{f.preventDefault()}),this._element.addEventListener("mousedown",f=>{f.preventDefault()});const u=this._element.classList;for(const f in fo)u.remove(`mapboxgl-marker-anchor-${f}`);u.add(`mapboxgl-marker-anchor-${this._anchor}`);const d=r&&r.className?r.className.trim().split(/\s+/):[];u.add(...d),this._popup=null}addTo(r){return r===this._map||(this.remove(),this._map=r,r.getCanvasContainer().appendChild(this._element),r.on("move",this._updateMoving),r.on("moveend",this._update),r.on("remove",this._clearFadeTimer),r._addMarker(this),this.setDraggable(this._draggable),this._update(),r.on("click",this._onMapClick)),this}remove(){const r=this._map;return r&&(r.off("click",this._onMapClick),r.off("move",this._updateMoving),r.off("moveend",this._update),r.off("mousedown",this._addDragHandler),r.off("touchstart",this._addDragHandler),r.off("mouseup",this._onUp),r.off("touchend",this._onUp),r.off("mousemove",this._onMove),r.off("touchmove",this._onMove),r.off("remove",this._clearFadeTimer),r._removeMarker(this),this._map=void 0),this._clearFadeTimer(),this._element.remove(),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(r){return this._lngLat=o.bq.convert(r),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(!0),this}getElement(){return this._element}setPopup(r){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeAttribute("role"),this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),r){if(!("offset"in r.options)){const d=Math.sqrt(Math.pow(13.5,2)/2);r.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[
vendor: 8,571 bytes, lines 2108-2113
21080,-38.1],"bottom-left":[d,-1*(38.1-13.5+d)],"bottom-right":[-d,-1*(38.1-13.5+d)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=r,r._marker=this,this._lngLat&&this._popup.setLngLat(this._lngLat),this._element.setAttribute("role","button"),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress),this._element.setAttribute("aria-expanded","false")}return this}_onKeyPress(r){const s=r.code,u=r.charCode||r.keyCode;s!=="Space"&&s!=="Enter"&&u!==32&&u!==13||this.togglePopup()}_onMapClick(r){const s=r.originalEvent.target,u=this._element;this._popup&&(s===u||u.contains(s))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){const r=this._popup;return r?(r.isOpen()?(r.remove(),this._element.setAttribute("aria-expanded","false")):this._map&&(r.addTo(this._map),this._element.setAttribute("aria-expanded","true")),this):this}_behindTerrain(){const r=this._map,s=this._pos;if(!r||!s)return!1;const u=r.unproject(s),d=r.getFreeCameraOptions();if(!d.position)return!1;const f=d.position.toLngLat();return f.distanceTo(u)<.9*f.distanceTo(this._lngLat)}_evaluateOpacity(){const r=this._map;if(!r)return;const s=this._pos;if(!s||s.x<0||s.x>r.transform.width||s.y<0||s.y>r.transform.height)return void this._clearFadeTimer();const u=r.unproject(s);let d;r._showingGlobe()&&o.de(r.transform,this._lngLat)?d=0:(d=1-r._queryFogOpacity(u),r.transform._terrainEnabled()&&r.getTerrain()&&this._behindTerrain()&&(d*=this._occludedOpacity)),this._element.style.opacity=`${d}`,this._element.style.pointerEvents=d>0?"auto":"none",this._popup&&this._popup._setOpacity(d),this._fadeTimer=null}_clearFadeTimer(){this._fadeTimer&&(clearTimeout(this._fadeTimer),this._fadeTimer=null)}_updateDOM(){const r=this._pos;if(!r||!this._map)return;const s=this._offset.mult(this._scale);this._element.style.transform=`
2109            translate(${r.x}px,${r.y}px)
2110            ${fo[this._anchor]}
2111            ${this._calculateXYTransform()} ${this._calculateZTransform()}
2112            translate(${s.x}px,${s.y}px)
2113        `}_calculateXYTransform(){const r=this._pos,s=this._map,u=this.getPitchAlignment();if(!s||!r||u!=="map")return"";if(!s._showingGlobe()){const b=s.getPitch();return b?`rotateX(${b}deg)`:""}const d=o.bI(o.df(s.transform,this._lngLat)),f=r.sub(o.dg(s.transform)),_=Math.abs(f.x)+Math.abs(f.y);if(_===0)return"";const y=d/_;return`rotateX(${-f.y*y}deg) rotateY(${f.x*y}deg)`}_calculateZTransform(){const r=this._pos,s=this._map;if(!s||!r)return"";let u=0;const d=this.getRotationAlignment();if(d==="map")if(s._showingGlobe()){const f=s.project(new o.bq(this._lngLat.lng,this._lngLat.lat+.001)),_=s.project(new o.bq(this._lngLat.lng,this._lngLat.lat-.001)).sub(f);u=o.bI(Math.atan2(_.y,_.x))-90}else u=-s.getBearing();else if(d==="horizon"){const f=o.S(4,6,s.getZoom()),_=o.dg(s.transform);_.y+=f*s.transform.height;const y=r.sub(_),b=o.bI(Math.atan2(y.y,y.x));u=(b>90?b-270:b+90)*(1-f)}return u+=this._rotation,u?`rotateZ(${u}deg)`:""}_update(r){cancelAnimationFrame(this._updateFrameId);const s=this._map;s&&(s.transform.renderWorldCopies&&(this._lngLat=Zl(this._lngLat,this._pos,s.transform)),this._pos=s.project(this._lngLat),r===!0?this._updateFrameId=requestAnimationFrame(()=>{this._element&&this._pos&&this._anchor&&(this._pos=this._pos.round(),this._updateDOM())}):this._pos=this._pos.round(),s._requestDomTask(()=>{this._map&&(this._element&&this._pos&&this._anchor&&this._updateDOM(),(s._showingGlobe()||s.getTerrain()||s.getFog())&&!this._fadeTimer&&(this._fadeTimer=setTimeout(this._evaluateOpacity.bind(this),60)))}))}getOffset(){return this._offset}setOffset(r){return this._offset=o.P.convert(r),this._update(),this}addClassName(r){return this._element.classList.add(r),this}removeClassName(r){return this._element.classList.remove(r),this}toggleClassName(r){return this._element.classList.toggle(r)}_onMove(r){const s=this._map;if(!s)return;const u=this._pointerdownPos,d=this._positionDelta;if(u&&d){if(!this._isDragging){const f=this._clickTolerance||s._clickTolerance;if(r.point.dist(u)<f)return;this._isDragging=!0}this._pos=r.point.sub(d),this._lngLat=s.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new o.b("dragstart"))),this.fire(new o.b("drag"))}}_onUp(){this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1;const r=this._map;r&&(r.off("mousemove",this._onMove),r.off("touchmove",this._onMove)),this._state==="active"&&this.fire(new o.b("dragend")),this._state="inactive"}_addDragHandler(r){const s=this._map,u=this._pos;s&&u&&this._element.contains(r.originalEvent.target)&&(r.preventDefault(),this._positionDelta=r.point.sub(u),this._pointerdownPos=r.point,this._state="pending",s.on("mousemove",this._onMove),s.on("touchmove",this._onMove),s.once("mouseup",this._onUp),s.once("touchend",this._onUp))}setDraggable(r){this._draggable=!!r;const s=this._map;return s&&(r?(s.on("mousedown",this._addDragHandler),s.on("touchstart",this._addDragHandler)):(s.off("mousedown",this._addDragHandler),s.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(r){return this._rotation=r||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(r){return this._rotationAlignment=r||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment==="auto"||this._rotationAlignment==="horizon"&&this._map&&!this._map._showingGlobe()?"viewport":this._rotationAlignment}setPitchAlignment(r){return this._pitchAlignment=r||"auto",this._update(),this}getPitchAlignment(){return this._pitchAlignment==="auto"?this.getRotationAlignment():this._pitchAlignment}setOccludedOpacity(r){return this._occludedOpacity=r||.2,this._update(),this}getOccludedOpacity(){return this._occludedOpacity}}const Ea={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},od=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Sa(c=new o.P(0,0),r="bottom"){if(typeof c=="number"){const s=Math.round(Math.sqrt(.5*Math.pow(c,2)));switch(r){case"top":return new o.P(0,c);case"top-left":return new o.P(s,s);case"top-right":return new o.P(-s,s);case"bottom":return new o.P(0,-c);case"bottom-left":return new o.P(s,-s);case"bottom-right":return new o.P(-s,-s);case"left":return new o.P(c,0);case"right":return new o.P(-c,0)}return new o.P(0,0)}return c instanceof o.P||Array.isArray(c)?o.P.convert(c):o.P.convert(c[r]||[0,0])}class $l{constructor(r){this.jumpTo(r)}getValue(r){if(r<=this._startTime)return this._start;if(r>=this._endTime)return this._end;const s=o.ch((r-this._startTime)/(this._endTime-this._startTime));return this._start*(1-s)+this._end*s}isEasing(r){return r>=this._startTime&&r<=this._endTime}jumpTo(r){this._startTime=-1/0,this._endTime=-1/0,this._start=r,this._end=r}easeTo(r,s,u){this._start=this.getValue(s),this._end=r,this._startTime=s,this._endTime=s+u}}class ad{registerParameter(r,s,u,d,f){}registerButton(r,s,u){}registerBinding(r,s,u,d){}refreshUI(){}}const ss={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"Mapbox logo","Map.Title":"Map","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScrollZoomBlocker.CtrlMessage":"Use ctrl + scroll to zoom the map","ScrollZoomBlocker.CmdMessage":"Use ⌘ + scroll to zoom the map","TouchPanBlocker.Message":"Use two fingers to move the map"},xn={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:85,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,performanceMetricsCollection:!0,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,antialias:!1,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,minTileCacheSize:null,maxTileC
2113acheSize:null,localIdeographFontFamily:"sans-serif",localFontFamily:null,transformRequest:null,accessToken:null,fadeDuration:300,respectPrefersReducedMotion:!0,crossSourceCollisions:!0,collectResourceTiming:!1,testMode:!1},mo={showCompass:!0,showZoom:!0,visualizePitch:!1};class Wl{constructor(r,s,u=!1){this._clickTolerance=10,this.element=s,this.mouseRotate=new fu({clickTolerance:r.dragRotate._mouseRotate._clickTolerance}),this.map=r,u&&(this.mousePitch=new Is({clickTolerance:r.dragRotate._mousePitch._clickTolerance})),o.a$(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),s.addEventListener("mousedown",this.mousedown),s.addEventListener("touchstart",this.touchstart,{passive:!1}),s.addEventListener("touchmove",this.touchmove),s.addEventListener("touchend",this.touchend),s.addEventListener("touchcancel",this.reset)}down(r,s){this.mouseRotate.mousedown(r,s),this.mousePitch&&this.mousePitch.mousedown(r,s),Za()}move(r,s){const u=this.map,d=this.mouseRotate.mousemoveWindow(r,s),f=d&&d.bearingDelta;if(f&&u.setBearing(u.getBearing()+f),this.mousePitch){const _=this.mousePitch.mousemoveWindow(r,s),y=_&&_.pitchDelta;y&&u.setPitch(u.getPitch()+y)}}off(){const r=this.element;r.removeEventListener("mousedown",this.mousedown),r.removeEventListener("touchstart",this.touchstart,{passive:!1}),r.removeEventListener("touchmove",this.touchmove),r.removeEventListener("touchend",this.touchend),r.removeEventListener("touchcancel",this.reset),this.offTemp()}offTemp(){zr(),window.removeEventListener("mousemove",this.mousemove),window.removeEventListener("mouseup",this.mouseup)}mousedown(r){this.down(o.e({},r,{ctrlKey:!0,preventDefault:()=>r.preventDefault()}),$n(this.element,r)),window.addEventListener("mousemove",this.mousemove),window.addEventListener("mouseup",this.mouseup)}mousemove(r){this.move(r,$n(this.element,r))}mouseup(r){this.mouseRotate.mouseupWindow(r),this.mousePitch&&this.mousePitch.mouseupWindow(r),this.offTemp()}touchstart(r){r.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=Yr(this.element,r.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:()=>r.preventDefault()},this._startPos))}touchmove(r){r.targetTouches.length!==1?this.reset():(this._lastPos=Yr(this.element,r.targetTouches)[0],this.move({preventDefault:()=>r.preventDefault()},this._lastPos))}touchend(r){r.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),this.reset()}reset(){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()}}const Qe={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0,showUserHeading:!1},ld={maxWidth:100,unit:"metric"},cd={kilometer:"km",meter:"m",mile:"mi",foot:"ft","nautical-mile":"nm"};return{version:o.du,supported:Xr,setRTLTextPlugin:o.dw,getRTLTextPluginStatus:o.dx,Map:class extends Rp{constructor(c){const r=c;if((c=o.e({},xn,c)).minZoom!=null&&c.maxZoom!=null&&c.minZoom>c.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(c.minPitch!=null&&c.maxPitch!=null&&c.minPitch>c.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(c.minPitch!=null&&c.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(c.maxPitch!=null&&c.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(c.antialias&&o.dh(window)&&(c.antialias=!1,o.w("Antialiasing is disabled for this WebGL context to avoid browser bug: https://github.com/mapbox/mapbox-gl-js/issues/11609")),super(new _l(c.minZoom,c.maxZoom,c.minPitch,c.maxPitch,c.renderWorldCopies),c),this._repaint=!!c.repaint,this._interactive=c.interactive,this._minTileCacheSize=c.minTileCacheSize,this._maxTileCacheSize=c.maxTileCacheSize,this._failIfMajorPerformanceCaveat=c.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=c.preserveDrawingBuffer,this._antialias=c.antialias,this._trackResize=c.trackResize,this._bearingSnap=c.bearingSnap,this._refreshExpiredTiles=c.refreshExpiredTiles,this._fadeDuration=c.fadeDuration,this._isInitialLoad=!0,this._crossSourceCollisions=c.crossSourceCollisions,this._collectResourceTiming=c.collectResourceTiming,this._language=this._parseLanguage(c.language),this._worldview=c.worldview,this._renderTaskQueue=new ql,this._domRenderTaskQueue=new ql,this._controls=[],this._markers=[],this._popups=[],this._mapId=o.aF(),this._locale=o.e({},ss,c.locale),this._clickTolerance=c.clickTolerance,this._cooperativeGestures=c.cooperativeGestures,this._performanceMetricsCollection=c.performanceMetricsCollection,this._containerWidth=0,this._containerHeight=0,this._showParseStatus=!0,this._averageElevationLastSampledAt=-1/0,this._averageElevationExaggeration=0,this._averageElevation=new $l(0),this._interactionRange=[1/0,-1/0],this._visibilityHidden=0,this._useExplicitProjection=!1,this._requestManager=new o.di(c.transformRequest,c.accessToken,c.testMode),this._silenceAuthErrors=!!c.testMode,this._contextCreateOptions=c.contextCreateOptions?{...c.contextCreateOptions}:{},typeof c.container=="string"){const s=document.getElementById(c.container);if(!s)throw new Error(`Container '${c.container.toString()}' not found.`);this._container=s}else{if(!(c.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=c.container}if(this._container.childNodes.length>0&&o.w("The map container element should be empty, otherwise the map's interactivity will be negatively impacted. If you want to display a message when WebGL is not supported, use the Mapbox GL Supported plugin instead."),c.maxBounds&&this.setMaxBounds(c.maxBounds),o.a$(["_onWindowOnline","_onWindowResize","_onVisibilityChange","_onMapScroll","_contextLost","_contextRestored"],this),this._setupContainer(),this._tp=c.devtools?new ad(this):new ad,this._tp.registerParameter(this,["Debug"],"showOverdrawInspector"),this._tp.registerParameter(this,["Debug"],"showTileBoundaries"),this._tp.registerParameter(this,["Debug"],"showParseStatus"),this._tp.registerParameter(this,["Debug"],"repaint"),this._tp.registerParameter(this,["Debug"],"showTileAABBs"),this._tp.registerParameter(this,["Debug"],"showPadding"),this._tp.registerParameter(this,["Debug"],"showCollisionBoxes",{noSave:!0}),this._tp.registerParameter(this.transform,["Debug"],"freezeTileCoverage",{noSave:!0},()=>{this._update()}),this._tp.registerParameter(this,["Debug","Wireframe"],"showTerrainWireframe"),this._tp.registerParameter(this,["Debug","Wireframe"],"showLayers2DWireframe"),this._tp.registerParameter(this,["Debug","Wireframe"],"showLayers3DWireframe"),this._setupPainter(),this.painter===void 0)throw new Error("Failed to initialize WebGL.");if(this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this._fullscreenchangeEvent="onfullscreenchange"in document?"fullscreenchange":"webkitfullscreenchange",window.addEventListener("online",this._onWindowOnline,!1),window.addEventListener("resize",this._onWindowResize,!1),window.addEventListener("orientationchange",this._onWindowResize,!1),window.addEventListener(this._fullscreenchangeEvent,this._onWindowResize,!1),window.addEventListener("visibilitychange",this._onVisibilityChange,!1),this.handlers=new wa(this,c),this._localFontFamily=c.localFontFamily,this._localIdeographFontFamily=c.localIdeographFontFamily,(c.style||!c.testMode)&&this.setStyle(c.style||o.dd.DEFAULT_STYLE,{config:c.config,localFontFamily:this._localFontFamily,localIdeographFontFamily:this._localIdeographFontFamily}),c.projection&&this.setProjection(c.projection),c.hash&&(this._hash=new Cp(typeof c.hash=="string"&&c.hash||void 0).addTo(this)),!this._hash||!this._hash._onHashChange()){r.center==null&&r.zoom==null||(this.transform._unmodified=!1),this.jumpTo({center:c.center,zoom:c.zoom,bearing:c.bearing,pitch:c.pitch});const s=c.bounds;s&&(this.resize(),this.fitBounds(s,o.e({}
vendor: 4,631 bytes, line 2113
2113,c.fitBoundsOptions,{duration:0})))}this.resize(),c.attributionControl&&this.addControl(new vu({customAttribution:c.customAttribution})),this._logoControl=new sd,this.addControl(this._logoControl,c.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet),this._postStyleLoadEvent()}),this.on("data",s=>{this._update(s.dataType==="style"),this.fire(new o.b(`${s.dataType}data`,s))}),this.on("dataloading",s=>{this.fire(new o.b(`${s.dataType}dataloading`,s))})}_getMapId(){return this._mapId}addControl(c,r){if(r===void 0&&(r=c.getDefaultPosition?c.getDefaultPosition():"top-right"),!c||!c.onAdd)return this.fire(new o.a(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const s=c.onAdd(this);this._controls.push(c);const u=this._controlPositions[r];return r.indexOf("bottom")!==-1?u.insertBefore(s,u.firstChild):u.appendChild(s),this}removeControl(c){if(!c||!c.onRemove)return this.fire(new o.a(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const r=this._controls.indexOf(c);return r>-1&&this._controls.splice(r,1),c.onRemove(this),this}hasControl(c){return this._controls.indexOf(c)>-1}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}resize(c){if(this._updateContainerDimensions(),this._containerWidth===this.transform.width&&this._containerHeight===this.transform.height)return this;this._resizeCanvas(this._containerWidth,this._containerHeight),this.transform.resize(this._containerWidth,this._containerHeight),this.painter.resize(Math.ceil(this._containerWidth),Math.ceil(this._containerHeight));const r=!this._moving;return r&&this.fire(new o.b("movestart",c)).fire(new o.b("move",c)),this.fire(new o.b("resize",c)),r&&this.fire(new o.b("moveend",c)),this}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()||null}setMaxBounds(c){return this.transform.setMaxBounds(o.ag.convert(c)),this._update()}setMinZoom(c){if((c=c??-2)>=-2&&c<=this.transform.maxZoom)return this.transform.minZoom=c,this._update(),this.getZoom()<c?this.setZoom(c):this.fire(new o.b("zoomstart")).fire(new o.b("zoom")).fire(new o.b("zoomend")),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(c){if((c=c??22)>=this.transform.minZoom)return this.transform.maxZoom=c,this._update(),this.getZoom()>c?this.setZoom(c):this.fire(new o.b("zoomstart")).fire(new o.b("zoom")).fire(new o.b("zoomend")),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(c){if((c=c??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(c>=0&&c<=this.transform.maxPitch)return this.transform.minPitch=c,this._update(),this.getPitch()<c?this.setPitch(c):this.fire(new o.b("pitchstart")).fire(new o.b("pitch")).fire(new o.b("pitchend")),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(c){if((c=c??85)>85)throw new Error("maxPitch must be less than or equal to 85");if(c>=this.transform.minPitch)return this.transform.maxPitch=c,this._update(),this.getPitch()>c?this.setPitch(c):this.fire(new o.b("pitchstart")).fire(new o.b("pitch")).fire(new o.b("pitchend")),this;throw new Error("maxPitch must be greater than or equal to minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(c){return this.transform.renderWorldCopies=c,this.transform.renderWorldCopies||this._forceMarkerAndPopupUpdate(!0),this._update()}getLanguage(){return this._language}_parseLanguage(c){return c==="auto"?navigator.language:Array.isArray(c)?c.length===0?void 0:c.map(r=>r==="auto"?navigator.language:r):c}setLanguage(c){const r=this._parseLanguage(c);if(!this.style||r===this._language)return this;this._language=r,this.style.reloadSources();for(const s of this._controls)s._setLanguage&&s._setLanguage(this._language);return this}getWorldview(){return this._worldview}setWorldview(c){return this.style&&c!==this._worldview?(this._worldview=c,this.style.reloadSources(),this):this}getProjection(){return this.transform.mercatorFromTransition?{name:"globe",center:[0,0]}:this.transform.getProjection()}_showingGlobe(){return this.transform.projection.name==="globe"}setProjection(c){return this._lazyInitEmptyStyle(),c?typeof c=="string"&&(c={name:c}
2113):c=null,this._useExplicitProjection=!!c,this._prioritizeAndUpdateProjection(c,this.style.projection)}_updateProjectionTransition(){if(this.getProjection().name!=="globe")return;const c=this.transform,r=c.projection.name;let s;r==="globe"&&c.zoom>=o.bA?(c.setMercatorFromTransition(),s=!0):r==="mercator"&&c.zoom<o.bA&&(c.setProjection({name:"globe"}),s=!0),s&&(this.style.applyProjectionUpdate(),this.style._forceSymbolLayerUpdate())}_prioritizeAndUpdateProjection(c,r){return this._updateProjection(c||r||{name:"mercator"})}_updateProjection(c){let r;return r=c.name==="globe"&&this.transform.zoom>=o.bA?this.transform.setMercatorFromTransition():this.transform.setProjection(c),this.style.applyProjectionUpdate(),r&&(this.painter.clearBackgroundTiles(),this.style.clearSources(),this._update(!0),this._forceMarkerAndPopupUpdate(!0)),this}project(c){return this.transform.locationPoint3D(o.bq.convert(c))}unproject(c){return this.transform.pointLocation3D(o.P.convert(c))}isMoving(){return this._moving||this.handlers&&this.handlers.isMoving()||!1}isZooming(){return this._zooming||this.handlers&&this.handlers.isZooming()||!1}isRotating(){return this._rotating||this.handlers&&this.handlers.isRotating()||!1}_isDragging(){return this.handlers&&this.handlers._isDragging()||!1}_createDelegatedListener(c,r,s){if(c==="mouseenter"||c==="mouseover"){let u=!1;const d=_=>{const y=r.filter(T=>this.getLayer(T)),b=y.length?this.queryRenderedFeatures(_.point,{layers:y}):[];b.length?u||(u=!0,s.call(this,new or(c,this,_.originalEvent,{features:b}))):u=!1},f=()=>{u=!1};return{layers:new Set(r),listener:s,delegates:{mousemove:d,mouseout:f}}}if(c==="mouseleave"||c==="mouseout"){let u=!1;const d=_=>{const y=r.filter(b=>this.getLayer(b));(y.length?this.queryRenderedFeatures(_.point,{layers:y}):[]).length?u=!0:u&&(u=!1,s.call(this,new or(c,this,_.originalEvent)))},f=_=>{u&&(u=!1,s.call(this,new or(c,this,_.originalEvent)))};return{layers:new Set(r),listener:s,delegates:{mousemove:d,mouseout:f}}}{const u=d=>{const f=r.filter(y=>this.getLayer(y)),_=f.length?this.queryRenderedFeatures(d.point,{layers:f}):[];_.length&&(d.features=_,s.call(this,d),delete d.features)};return{layers:new Set(r),listener:s,delegates:{[c]:u}}}}on(c,r,s){if(s===void 0)return super.on(c,r);if(Array.isArray(r)||(r=[r]),r){for(const d of r)if(!this._isValidId(d))return this}const u=this._createDelegatedListener(c,r,s);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[c]=this._delegatedListeners[c]||[],this._delegatedListeners[c].push(u);for(const d in u.delegates)this.on(d,u.delegates[d]);return this}once(c,r,s){if(s===void 0)return super.once(c,r);if(Array.isArray(r)||(r=[r]),r){for(const d of r)if(!this._isValidId(d))return this}const u=this._createDelegatedListener(c,r,s);for(const d in u.delegates)this.once(d,u.delegates[d]);return this}off(c,r,s){if(s===void 0)return super.off(c,r);r=new Set(Array.isArray(r)?r:[r]);for(const f of r)if(!this._isValidId(f))return this;const u=(f,_)=>{if(f.size!==_.size)return!1;for(const y of f)if(!_.has(y))return!1;return!0},d=this._delegatedListeners?this._delegatedListeners[c]:void 0;return d&&(f=>{for(let _=0;_<f.length;_++){const y=f[_];if(y.listener===s&&u(y.layers,r)){for(const b in y.delegates)this.off(b,y.delegates[b]);return f.splice(_,1),this}}})(d),this}queryRenderedFeatures(c,r){if(!this.style)return[];if(r!==void 0||c===void 0||c instanceof o.P||Array.isArray(c)||(r=c,c=void 0),c=c||[[0,0],[this.transform.width,this.transform.height]],(r=r||{}).layers&&Array.isArray(r.layers)){for(const s of r.layers)if(!this._isValidId(s))return[]}return this.style.queryRenderedFeatures(c,r,this.transform)}querySourceFeatures(c,r){return this._isValidId(c)?this.style.querySourceFeatures(c,r):[]}isPointOnSurface(c){const{name:r}=this.transform.projection;return r!=="globe"&&r!=="mercator"&&o.w(`${r} projection does not support isPointOnSurface, this API may behave unexpectedly.`),this.transform.isPointOnSurface(o.P.convert(c))}setStyle(c,r){return r=o.e({},{localIdeographFontFamily:this._localIdeographFontFamily,localFontFamily:this._localFontFamily},r),this.style&&c&&r.diff!==!1&&r.localFontFamily===this._localFontFamily&&r.localIdeographFontFamily===this._localIdeographFontFamily&&!r.config?(this.style._diffStyle(c,(s,u)=>{s?(o.w(`Unable to perform style diff: ${String(s.message||s.error||s)}. Rebuilding the style from scratch.`),this._updateStyle(c,r)):u&&this._update(!0)},()=>{this._postStyleLoadEvent()}),this):(this._localIdeographFontFamily=r.localIdeographFontFamily,this._localFontFamily=r.localFontFamily,this._updateStyle(c,r))}_getUIString(c){const r=this._locale[c];if(r==null)throw new Error(`Missing UI string '${c}'`);return r}_updateStyle(c,r){if(this.style&&(this.style.setEventedParent(null),this.style._remove(),this.style=void 0),c){const s=o.e({},r);r&&r.config&&(s.initialConfig=r.config,delete s.config),this.style=new sn(this,s).setEventedParent(this,{style:this.style}).load(c)}return this._updateTerrain(),this}_lazyInitEmptyStyle(){this.style||(this.style=new sn(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():(o.w("There is no style added to the map."),!1)}_isValidId(c){return c==null?(this.fire(new o.a(new Error("IDs can't be empty."))),!1):!o.c9(c)||(this.fire(new o.a(new Error(`IDs can't 
2113contain special symbols: "${c}".`))),!1)}addSource(c,r){return this._isValidId(c)?(this._lazyInitEmptyStyle(),this.style.addSource(c,r),this._update(!0)):this}isSourceLoaded(c){return!!this._isValidId(c)&&!!this.style&&this.style._isSourceCacheLoaded(c)}areTilesLoaded(){return this.style.areTilesLoaded()}addSourceType(c,r,s){this._lazyInitEmptyStyle(),this.style.addSourceType(c,r,s)}removeSource(c){return this._isValidId(c)?(this.style.removeSource(c),this._updateTerrain(),this._update(!0)):this}getSource(c){return this._isValidId(c)?this.style.getOwnSource(c):null}addImage(c,r,{pixelRatio:s=1,sdf:u=!1,stretchX:d,stretchY:f,content:_}={}){if(this._lazyInitEmptyStyle(),r instanceof HTMLImageElement||ImageBitmap&&r instanceof ImageBitmap){const{width:y,height:b,data:T}=o.f.getImageData(r);this.style.addImage(c,{data:new o.h({width:y,height:b},T),pixelRatio:s,stretchX:d,stretchY:f,content:_,sdf:u,version:0})}else if(r.width===void 0||r.height===void 0)this.fire(new o.a(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));else{const{width:y,height:b}=r,T=r;this.style.addImage(c,{data:new o.h({width:y,height:b},new Uint8Array(T.data)),pixelRatio:s,stretchX:d,stretchY:f,content:_,sdf:u,version:0,userImage:T}),T.onAdd&&T.onAdd(this,c)}}updateImage(c,r){this._lazyInitEmptyStyle();const s=this.style.getImage(c);if(!s)return void this.fire(new o.a(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const u=r instanceof HTMLImageElement||ImageBitmap&&r instanceof ImageBitmap?o.f.getImageData(r):r,{width:d,height:f}=u,_=u.data;if(d===void 0||f===void 0)return void this.fire(new o.a(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(d!==s.data.width||f!==s.data.height)return void this.fire(new o.a(new Error(`The width and height of the updated image (${d}, ${f})
2114                must be that same as the previous version of the image
2115                (${s.data.width}, ${s.data.height})`)));const y=!(r instanceof HTMLImageElement||ImageBitmap&&r instanceof ImageBitmap);s.data.replace(_,y),this.style.updateImage(c,s)}hasImage(c){return c?!!this.style&&!!this.style.getImage(c):(this.fire(new o.a(new Error("Missing required image id"))),!1)}removeImage(c){this.style.removeImage(c)}loadImage(c,r){o.d(this._requestManager.transformRequest(c,o.R.Image),(s,u)=>{r(s,u instanceof HTMLImageElement?o.f.getImageData(u):u)})}listImages(){return this.style.listImages()}addModel(c,r){this._lazyInitEmptyStyle(),this.style.addModel(c,r)}hasModel(c){return c?this.style.hasModel(c):(this.fire(new o.a(new Error("Missing required model id"))),!1)}removeModel(c){this.style.removeModel(c)}listModels(){return this.style.listModels()}addLayer(c,r){return this._isValidId(c.id)?(this._lazyInitEmptyStyle(),this.style.addLayer(c,r),this._update(!0)):this}getSlot(c){const r=this.getLayer(c);return r&&r.slot||null}setSlot(c,r){return this.style.setSlot(c,r),this.style.mergeLayers(),this._update(!0)}addImport(c,r){return this.style.addImport(c,r),this}updateImport(c,r){return typeof r!="string"&&r.id!==c?(this.removeImport(c),this.addImport(r)):(this.style.updateImport(c,r),this._update(!0))}removeImport(c){return this.style.removeImport(c),this}moveImport(c,r){return this.style.moveImport(c,r),this._update(!0)}moveLayer(c,r){return this._isValidId(c)?(this.style.moveLayer(c,r),this._update(!0)):this}removeLayer(c){return this._isValidId(c)?(this.style.removeLayer(c),this._update(!0)):this}getLayer(c){return this._isValidId(c)?this.style.getOwnLayer(c):null}setLayerZoomRange(c,r,s){return this._isValidId(c)?(this.style.setLayerZoomRange(c,r,s),this._update(!0)):this}setFilter(c,r,s={}){return this._isValidId(c)?(this.style.setFilter(c,r,s),this._update(!0)):this}getFilter(c){return this._isValidId(c)?this.style.getFilter(c):null}setPaintProperty(c,r,s,u={}){return this._isValidId(c)?(this.style.setPaintProperty(c,r,s,u),this._update(!0)):this}getPaintProperty(c,r){return this._isValidId(c)?this.style.getPaintProperty(c,r):null}setLayoutProperty(c,r,s,u={}){return this._isValidId(c)?(this.style.setLayoutProperty(c,r,s,u),this._update(!0)):this}getLayoutProperty(c,r){return this._isValidId(c)?this.style.getLayoutProperty(c,r):null}getSchema(c){return this.style.getSchema(c)}setSchema(c,r){return this.style.setSchema(c,r),this._update(!0)}getConfig(c){return this.style.getConfig(c)}setConfig(c,r){return this.style.setConfig(c,r),this._update(!0)}getConfigProperty(c,r){return this.style.getConfigProperty(c,r)}setConfigProperty(c,r,s){return this.style.setConfigProperty(c,r,s),this._update(!0)}setLights(c){if(this._lazyInitEmptyStyle(),c&&c.length===1&&c[0].type==="flat"){const r=c[0];r.properties?this.style.setFlatLight(r.properties,r.id,{}):this.style.setFlatLight({},"flat")}else this.style.setLights(c),this.painter.terrain&&(this.painter.terrain.invalidateRenderCache=!0);return this._update(!0)}getLights(){const c=this.style.getLights()||[];
vendor: 17,509 bytes, line 2115
2115return c.length===0&&c.push({id:this.style.light.id,type:"flat",properties:this.style.getFlatLight()}),c}setLight(c,r={}){return console.log("The `map.setLight` function is deprecated, prefer using `map.setLights` with `flat` light type instead."),this.setLights([{id:"flat",type:"flat",properties:c}])}getLight(){return console.log("The `map.getLight` function is deprecated, prefer using `map.getLights` instead."),this.style.getFlatLight()}setTerrain(c){return this._lazyInitEmptyStyle(),!c&&this.transform.projection.requiresDraping?this.style.setTerrainForDraping():this.style.setTerrain(c),this._averageElevationLastSampledAt=-1/0,this._update(!0)}getTerrain(){return this.style?this.style.getTerrain():null}setFog(c){return this._lazyInitEmptyStyle(),this.style.setFog(c),this._update(!0)}getFog(){return this.style?this.style.getFog():null}setCamera(c){return this.style.setCamera(c),this._triggerCameraUpdate(c)}_triggerCameraUpdate(c){return this._update(this.transform.setOrthographicProjectionAtLowPitch(c["camera-projection"]==="orthographic"))}getCamera(){return this.style.camera}_queryFogOpacity(c){return this.style&&this.style.fog?this.style.fog.getOpacityAtLatLng(o.bq.convert(c),this.transform):0}setFeatureState(c,r){return this._isValidId(c.source)?(this.style.setFeatureState(c,r),this._update()):this}removeFeatureState(c,r){return this._isValidId(c.source)?(this.style.removeFeatureState(c,r),this._update()):this}getFeatureState(c){return this._isValidId(c.source)?this.style.getFeatureState(c):null}_updateContainerDimensions(){if(!this._container)return;const c=this._container.getBoundingClientRect().width||400,r=this._container.getBoundingClientRect().height||300;let s,u,d,f=this._container;for(;f&&(!u||!d);){const _=window.getComputedStyle(f).transform;_&&_!=="none"&&(s=_.match(/matrix.*\((.+)\)/)[1].split(", "),s[0]&&s[0]!=="0"&&s[0]!=="1"&&(u=s[0]),s[3]&&s[3]!=="0"&&s[3]!=="1"&&(d=s[3])),f=f.parentElement}this._containerWidth=u?Math.abs(c/u):c,this._containerHeight=d?Math.abs(r/d):r}_detectMissingCSS(){window.getComputedStyle(this._missingCSSCanary).getPropertyValue("background-color")!=="rgb(250, 128, 114)"&&o.w("This page appears to be missing CSS declarations for Mapbox GL JS, which may cause the map to display incorrectly. Please ensure your page includes mapbox-gl.css, as described in https://www.mapbox.com/mapbox-gl-js/api/.")}_setupContainer(){const c=this._container;c.classList.add("mapboxgl-map"),(this._missingCSSCanary=Ft("div","mapboxgl-canary",c)).style.visibility="hidden",this._detectMissingCSS();const r=this._canvasContainer=Ft("div","mapboxgl-canvas-container",c);this._canvas=Ft("canvas","mapboxgl-canvas",r),this._interactive&&(r.classList.add("mapboxgl-interactive"),this._canvas.setAttribute("tabindex","0")),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region"),this._updateContainerDimensions(),this._resizeCanvas(this._containerWidth,this._containerHeight);const s=this._controlContainer=Ft("div","mapboxgl-control-container",c),u=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(d=>{u[d]=Ft("div",`mapboxgl-ctrl-${d}`,s)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(c,r){const s=o.f.devicePixelRatio||1;this._canvas.width=s*Math.ceil(c),this._canvas.height=s*Math.ceil(r),this._canvas.style.width=`${c}px`,this._canvas.style.height=`${r}px`}_addMarker(c){this._markers.push(c)}_removeMarker(c){const r=this._markers.indexOf(c);r!==-1&&this._markers.splice(r,1)}_addPopup(c){this._popups.push(c)}_removePopup(c){const r=this._popups.indexOf(c);r!==-1&&this._popups.splice(r,1)}_setupPainter(){const c=o.e({},Xr.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),r=this._canvas.getContext("webgl2",c);r?(o.dj(r,!0),this.painter=new Gh(r,this._contextCreateOptions,this.transform,this._tp),this.on("data",s=>{s.dataType==="source"&&this.painter.setTileLoadedFlag(!0)}),o.dk.testSupport(r)):this.fire(new o.a(new Error("Failed to initialize WebGL")))}_contextLost(c){c.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new o.b("webglcontextlost",{originalEvent:c}))}_contextRestored(c){this._setupPainter(),this.resize(),this._update(),this.fire(new o.b("webglcontextrestored",{originalEvent:c}))}_onMapScroll(c){if(c.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(c){return this.style?(this._styleDirty=this._styleDirty||c,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(c){return this._update(),this._renderTaskQueue.add(c)}_cancelRenderFrame(c){this._renderTaskQueue.remove(c)}_requestDomTask(c){!this.loaded()||this.loaded()&&!this.isMoving()?c():this._domRenderTaskQueue.add(c)}_render(c){let r;this.fire(new o.b("renderstart"));const s=this.painter.context.extTimerQuery,u=o.f.now(),d=this.painter.context.gl;if(this.listens("gpu-timing-frame")&&(r=d.createQuery(),d.beginQuery(s.TIME_ELAPSED_EXT,r)),this.painter.context.setDirty(),this.painter.setBaseState(),(this.isMoving()||this.isRotating()||this.isZooming())&&(this._interactionRange[0]=Math.min(this._interactionRange[0],performance.now()),this._interactionRange[1]=Math.max(this._interactionRange[1],performance.now())),this._renderTaskQueue.run(c),this._domRenderTaskQueue.run(c),this._removed)return;this._updateProjectionTransition();const f=this._isInitialLoad?0:this._fadeDuration;if(this.style&&this._styleDirty){this._styleDirty=!1;const b=this.transform.zoom,T=this.transform.pitch,S=o.f.now(),A=new o.N(b,{now:S,fadeDuration:f,pitch:T,transition:this.style.transition});this.style.update(A)}this.style&&this.style.hasFogTransition()&&(this.style._markersNeedUpdate=!0,this._sourcesDirty=!0);let _=!1;if(this.style&&this._sourcesDirty?(this._sourcesDirty=!1,this.painter._updateFog(this.style),this._updateTerrain(),_=this._updateAverageElevation(u),this.style.updateSources(this.transform),this._forceMarkerAndPopupUpdate()):_=this._updateAverageElevation(u),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,f,this._crossSourceCollisions),this.style&&this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showParseStatus:this.showParseStatus,wireframe:{terrain:this.showTerrainWireframe,layers2D:this.showLayers2DWireframe,layers3D:this.showLayers3DWireframe},showOverdrawInspector:this._showOverdrawInspector,showQueryGeometry:!!this._showQueryGeometry,showTileAABBs:this.showTileAABBs,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:f,isInitialLoad:this._isInitialLoad,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer"),gpuTimingDeferredRender:!!this.listens("gpu-timing-deferred-render"),speedIndexTiming:this.speedIndexTiming}),this.fire(new o.b("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,this.fire(new o.b("load"))),this.style&&this.style.hasTransitions()&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),r){const b=o.f.now()-u;d.endQuery(s.TIME_ELAPSED_EXT),setTimeout(()=>{const T=d.getQueryParameter(r,d.QUERY_RESULT)/1e6;d.deleteQuery(r),this.fire(new o.b("gpu-timing-frame",{cpuTime:b,gpuTime:T}))},50)}if(this.listens("gpu-timing-layer")){const b=this.painter.collectGpuTimers();setTimeout(()=>{const T=this.painter.queryGpuTimers(b);this.fire(new o.b("gpu-timing-layer",{layerTimes:T}))},50)}if(this.listens("gpu-timing-deferred-render")){const b=this.painter.collectDeferredRenderGpuQueries();setTimeout(()=>{const T=this.painter.queryGpuTimeDeferredRender(b);this.fire(new o.b("gpu-timing-deferred-render",{gpuTime:T}))},50)}const y=this._sourcesDirty||this._styleDirty||this._placementDirty||_;if(y||this._repaint)this.triggerRepaint();else{const b=!this.isMoving()&&this.loaded();if(b&&(_=this._updateAverageElevation(u,!0)),_)this.triggerRepaint();else if(this._triggerFrame(!1),b&&(this.fire(new o.b("idle")),this._isInitialLoad=!1,this.speedIndexTiming)){const T=this._calculateSpeedIndex();this.fire(new o.b("speedindexcompleted",{speedIndex:T})),this.speedIndexTiming=!1}}!this._loaded||this._fullyLoaded||y||(this._fullyLoaded=!0,this._performanceMetricsCollection&&o.dl(this._requestManager._customAccessToken,{width:this.painter.width,height:this.painter.height,interactionRange:this._interactionRange,visibilityHidden:this._visibilityHidden,terrainEnabled:!!this.painter.style.getTerrain(),fogEnabled:!!this.painter.style.getFog(),projection:this.getProjection().name,zoom:this.transform.zoom,renderer:this.painter.context.renderer,vendor:this.painter.context.vendor}),this._authenticate())}_forceMarkerAndPopupUpdate(c){for(const r of this._markers)c&&!this.getRenderWorldCopies()&&(r._lngLat=r._lngLat.wrap()),r._update();for(const r of this._popups)!c||this.getRenderWorldCopies()||r._trackPointer||(r._lngLat=r._lngLat.wrap()),r._update()}_updateAverageElevation(c,r=!1){const s=d=>(this.transform.averageElevation=d,this._update(!1),!0);if(!this.painter.averageElevationNeedsEasing())return this.transform.averageElevation!==0&&s(0);const u=this.transform.elevation&&this.transform.elevation.exaggeration()!==this._averageElevationExaggeration;if(u||(r||c-this._averageElevationLastSampledAt>500)&&!this._averageElevation.isEasing(c)){const d=this.transform.averageElevation;let f=this.transform.sampleAverageElevation();this.transform.elevation&&(this._averageElevationExaggeration=this.transform.elevation.exaggeration()),isNaN(f)?f=0:this._averageElevationLastSampledAt=c;const _=Math.abs(d-f);if(_>1){if(this._isInitialLoad||u)return this._averageElevation.jumpTo(f),s(f);this._averageElevation.easeTo(f,c,300)}else if(_>1e-4)return this._averageElevation.jumpTo(f),s(f)}return!!this._averageElevation.isEasing(c)&&s(this._averageElevation.getValue(c))}_authenticate(){o.dm(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,c=>{if(c&&(c.message===o.dn||c.status===401)){const r=this.painter.context.gl;o.dj(r,!1),this._logoControl instanceof sd&&this._logoControl._updateLogo(),r&&r.clear(r.DEPTH_BUFFER_BIT|r.COLOR_BUFFER_BIT|r.STENCIL_BUFFER_BIT),this._silenceAuthErrors||this.fire(new o.a(new Error("A valid Mapbox access token is required to use Mapbox GL JS. To create an account or a new access token, visit https://account.mapbox.com/")))}}),o.dp(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,()=>{})}_postStyleLoadEvent(){this.style.globalId&&o.dq(this._requestManager._customAccessToken,{map:this,skuToken:this._requestManager._skuToken,style:this.style.globalId,importedStyles:this.style.getImportGlobalIds()})}_updateTerrain(){const c=this._isDragging();this.painter.updateTerrain(this.style,c)}_calculateSpeedIndex(){const c=this.painter.canvasCopy(),r=this.painter.getCanvasCopiesAndTimestamps();r.timeStamps.push(performance.now());const s=this.painter.context.gl,u=s.createFramebuffer();function d(f){s.framebufferTexture2D(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0,s.TEXTURE_2D,f,0);const _=new Uint8Array(s.drawingBufferWidth*s.drawingBufferHeight*4);return s.readPixels(0,0,s.drawingBufferWidth,s.drawingBufferHeight,s.RGBA,s.UNSIGNED_BYTE,_),_}return s.bindFramebuffer(s.FRAMEBUFFER,u),this._canvasPixelComparison(d(c),r.canvasCopies.map(d),r.timeStamps)}_canvasPixelComparison(c,r,s){let u=s[1]-s[0];const d=c.length/4;for(let f=0;f<r.length;f++){const _=r[f];let y=0;for(let b=0;b<_.length;b+=4)_[b]===c[b]&&_[b+1]===c[b+1]&&_[b+2]===c[b+2]&&_[b+3]===c[b+3]&&(y+=1);u+=(s[f+2]-s[f+1])*(1-y/d)}return u}remove(){this._hash&&this._hash.remove();for(const r of this._controls)r.onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this._domRenderTaskQueue.clear(),this.style&&this.style.destroy(),this.painter.destroy(),this.handlers&&this.handlers.destroy(),this.handlers=void 0,this.setStyle(null),window.removeEventListener("resize",this._onWindowResize,!1),window.removeEventListener("orientationchange",this._onWindowResize,!1),window.removeEventListener(this._fullscreenchangeEvent,this._onWindowResize,!1),window.removeEventListener("online",this._onWindowOnline,!1),window.removeEventListener("visibilitychange",this._onVisibilityChange,!1);const c=this.painter.context.gl.getExtension("WEBGL_lose_context");c&&c.loseContext(),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvasContainer.remove(),this._controlContainer.remove(),this._missingCSSCanary.remove(),this._canvas=void 0,this._canvasContainer=void 0,this._controlContainer=void 0,this._missingCSSCanary=void 0,this._container.classList.remove("mapboxgl-map"),this._container.removeEventListener("scroll",this._onMapScroll,!1),o.dr(this.painter.context.gl),o.ds.remove(),o.dt.remove(),this._removed=!0,this.fire(new o.b("remove"))}triggerRepaint(){this._triggerFrame(!0)}_triggerFrame(c){this._renderNextFrame=this._renderNextFrame||c,this.style&&!this._frame&&(this._frame=o.f.frame(r=>{const s=!!this._renderNextFrame;this._frame=null,this._renderNextFrame=null,s&&this._render(r)}))}_preloadTiles(c){const r=this.style?this.style.getSourceCaches():[];return o.b4(r,(s,u)=>s._preloadTiles(c,u),()=>{this.triggerRepaint()}),this}_onWindowOnline(){this._update()}_onWindowResize(c){this._trackResize&&this.resize({originalEvent:c})._update()}_onVisibilityChange(){document.visibilityState==="hidden"&&this._visibilityHidden++}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(c){this._showTileBoundaries!==c&&(this._showTileBoundaries=c,this._tp.refreshUI(),this._update())}get showParseStatus(){return!!this._showParseStatus}set showParseStatus(c){this._showParseStatus!==c&&(this._showParseStatus=c,this._tp.refreshUI(),this._update())}get showTerrainWireframe(){return!!this._showTerrainWireframe}set showTerrainWireframe(c){this._showTerrainWireframe!==c&&(this._showTerrainWireframe=c,this._tp.refreshUI(),this._update())}get showLayers2DWireframe(){return!!this._showLayers2DWireframe}set showLayers2DWireframe(c){this._showLayers2DWireframe!==c&&(this._showLayers2DWireframe=c,this._tp.refreshUI(),this._update())}get showLayers3DWireframe(){return!!this._showLayers3DWireframe}set showLayers3DWireframe(c){this._showLayers3DWireframe!==c&&(this._showLayers3DWireframe=c,this._tp.refreshUI(),this._update())}get speedIndexTiming(){return!!this._speedIndexTiming}set speedIndexTiming(c){this._speedIndexTiming!==c&&(this._speedIndexTiming=c,this._update())}get showPadding(){return!!this._showPadding}set showPadding(c){this._showPadding!==c&&(this._showPadding=c,this._tp.refreshUI(),this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(c){this._showCollisionBoxes!==c&&(this._showCollisionBoxes=c,this._tp.refreshUI(),c?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(c){this._showOverdrawInspector!==c&&(this._showOverdrawInspector=c,this._tp.refreshUI(),this._update())}get repaint(){return!!this._repaint}set repaint(c){this._repaint!==c&&(this._repaint=c,this._tp.refreshUI(),this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(c){this._vertices=c,this._update()}get showTileAABBs(){return!!this._showTileAABBs}set showTileAABBs(c){this._showTileAABBs!==c&&(this._showTileAABBs=c,this._tp.refreshUI(),c&&this._update())}_setCacheLimits(c,r){o.dv(c,r)}get version(){return o.du}},NavigationControl:class{constructor(c){this.options=o.e({},mo,c),this._container=Ft("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",r=>r.preventDefault()),this.options.showZoom&&(o.a$(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("mapboxgl-ctrl-zoom-in",r=>{this._map&&this._map.zoomIn({},{originalEvent:r})}),Ft("span","mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("mapboxgl-ctrl-zoom-out",r=>{this._map&&this._map.zoomOut({},{originalEvent:r})}),Ft("span","mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(o.a$(["_rotateCompassArrow"],this),this._compass=this._createButton("mapboxgl-ctrl-compass",r=>{const s=this._map;s&&(this.options.visualizePitch?s.resetNorthPitch({},{originalEvent:r}):s.resetNorth({},{originalEvent:r}))}),this._compassIcon=Ft("span","mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){const c=this._map;if(!c)return;const r=c.getZoom(),s=r===c.getMaxZoom(),u=r===c.getMinZoom();this._zoomInButton.disabled=s,this._zoomOutButton.disabled=u,this._zoomInButton.setAttribute("aria-disabled",s.toString()),this._zoomOutButton.setAttribute("aria-disabled",u.toString())}_rotateCompassArrow(){const c=this._map;if(!c)return;const r=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(c.transform.pitch*(Math.PI/180)
2115),.5)}) rotateX(${c.transform.pitch}deg) rotateZ(${c.transform.angle*(180/Math.PI)}deg)`:`rotate(${c.transform.angle*(180/Math.PI)}deg)`;c._requestDomTask(()=>{this._compassIcon&&(this._compassIcon.style.transform=r)})}onAdd(c){return this._map=c,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),c.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&c.on("pitch",this._rotateCompassArrow),c.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new Wl(c,this._compass,this.options.visualizePitch)),this._container}onRemove(){const c=this._map;c&&(this._container.remove(),this.options.showZoom&&c.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&c.off("pitch",this._rotateCompassArrow),c.off("rotate",this._rotateCompassArrow),this._handler&&this._handler.off(),this._handler=void 0),this._map=void 0)}_createButton(c,r){const s=Ft("button",c,this._container);return s.type="button",s.addEventListener("click",r),s}_setButtonTitle(c,r){if(!this._map)return;const s=this._map._getUIString(`NavigationControl.${r}`);c.setAttribute("aria-label",s),c.firstElementChild&&c.firstElementChild.setAttribute("title",s)}},GeolocateControl:class extends o.E{constructor(c){super();const r=navigator.geolocation;this.options=o.e({geolocation:r},Qe,c),o.a$(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker","_updateMarkerRotation","_onDeviceOrientation"],this),this._updateMarkerRotationThrottled=qh(this._updateMarkerRotation,20),this._numberOfWatches=0}onAdd(c){return this._map=c,this._container=Ft("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkGeolocationSupport(this._setupUI),this._container}onRemove(){this._geolocationWatchID!==void 0&&(this.options.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),this._container.remove(),this._map.off("zoom",this._onZoom),this._map=void 0,this._numberOfWatches=0,this._noTimeout=!1}_checkGeolocationSupport(c){const r=(s=!!this.options.geolocation)=>{this._supportsGeolocation=s,c(s)};this._supportsGeolocation!==void 0?c(this._supportsGeolocation):navigator.permissions!==void 0?navigator.permissions.query({name:"geolocation"}).then(s=>r(s.state!=="denied")).catch(()=>r()):r()}_isOutOfMapMaxBounds(c){const r=this._map.getMaxBounds(),s=c.coords;return!!r&&(s.longitude<r.getWest()||s.longitude>r.getEast()||s.latitude<r.getSouth()||s.latitude>r.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting")}}_onSuccess(c){if(this._map){if(this._isOutOfMapMaxBounds(c))return this._setErrorState(),this.fire(new o.b("outofmaxbounds",c)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=c,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background")}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(c),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(c),this.options.showUserLocation&&this._userLocationDotMarker.removeClassName("mapboxgl-user-location-dot-stale"),this.fire(new o.b("geolocate",c)),this._finish()}}_updateCamera(c){const r=new o.bq(c.coords.longitude,c.coords.latitude),s=c.coords.accuracy,u=this._map.getBearing(),d=o.e({bearing:u},this.options.fitBoundsOptions);this._map.fitBounds(r.toBounds(s),d,{geolocateSource:!0})}_updateMarker(c){if(c){const r=new o.bq(c.coords.longitude,c.coords.latitude);this._accuracyCircleMarker.setLngLat(r).addTo(this._map),this._userLocationDotMarker.setLngLat(r).addTo(this._map),this._accuracy=c.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){const c=this._map.transform,r=o.bo(1,c._center.lat)*c.worldSize,s=Math.ceil(2*this._accuracy*r);this._circleElement.style.width=`${s}px`,this._circleElement.style.height=`${s}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}_updateMarkerRotation(){this._userLocationDotMarker&&typeof this._heading=="number"?(this._userLocationDotMarker.setRotation(this._heading),this._userLocationDotMarker.addClassName("mapboxgl-user-location-show-heading")):(this._userLocationDotMarker.removeClassName("mapboxgl-user-location-show-heading"),this._userLocationDotMarker.setRotation(0))}_onError(c){if(this._map){if(this.options.trackUserLocation)if(c.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const r=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.setAttribute("aria-label",r),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",r),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(c.code===3&&this._noTimeout)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._userLocationDotMarker.addClassName("mapboxgl-user-location-dot-stale"),this.fire(new o.b("error",c)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(c){if(this._map!==void 0){if(this._container.addEventListener("contextmenu",r=>r.preventDefault()),this._geolocateButton=Ft("button","mapboxgl-ctrl-geolocate",this._container),Ft("span","mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",c===!1){o.w("Geolocation support is not available so the GeolocateControl will be disabled.");const r=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.setAttribute("aria-label",r),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",r)}else{const r=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.setAttribute("aria-label",r),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",r)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","fal
2115se"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=Ft("div","mapboxgl-user-location"),this._dotElement.appendChild(Ft("div","mapboxgl-user-location-dot")),this._dotElement.appendChild(Ft("div","mapboxgl-user-location-heading")),this._userLocationDotMarker=new Ta({element:this._dotElement,rotationAlignment:"map",pitchAlignment:"map"}),this._circleElement=Ft("div","mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Ta({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",r=>{r.geolocateSource||this._watchState!=="ACTIVE_LOCK"||r.originalEvent&&r.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this.fire(new o.b("trackuserlocationend")))})}}_onDeviceOrientation(c){this._userLocationDotMarker&&(c.webkitCompassHeading?this._heading=c.webkitCompassHeading:c.absolute===!0&&(this._heading=-1*c.alpha),this._updateMarkerRotationThrottled())}trigger(){if(!this._setup)return o.w("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new o.b("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":this._numberOfWatches--,this._noTimeout=!1,this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this.fire(new o.b("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new o.b("trackuserlocationstart"))}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"BACKGROUND":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background");break;case"BACKGROUND_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error")}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let c;this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),this._numberOfWatches++,this._numberOfWatches>1?(c={maximumAge:6e5,timeout:0},this._noTimeout=!0):(c=this.options.positionOptions,this._noTimeout=!1),this._geolocationWatchID=this.options.geolocation.watchPosition(this._onSuccess,this._onError,c),this.options.showUserHeading&&this._addDeviceOrientationListener()}}else this.options.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_addDeviceOrientationListener(){const c=()=>{"ondeviceorientationabsolute"in window?window.addEventListener("deviceorientationabsolute",this._onDeviceOrientation):window.addEventListener("deviceorientation",this._onDeviceOrientation)};typeof DeviceMotionEvent<"u"&&typeof DeviceMotionEvent.requestPermission=="function"?DeviceOrientationEvent.requestPermission().then(r=>{r==="granted"&&c()}).catch(console.error):c()}_clearWatch(){this.options.geolocation.clearWatch(this._geolocationWatchID),window.removeEventListener("deviceorientation",this._onDeviceOrientation),window.removeEventListener("deviceorientationabsolute",this._onDeviceOrientation),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","fal
2115se"),this.options.showUserLocation&&this._updateMarker(null)}},AttributionControl:vu,ScaleControl:class{constructor(c){this.options=o.e({},ld,c),this._isNumberFormatSupported=function(){try{return new Intl.NumberFormat("en",{style:"unit",unitDisplay:"short",unit:"meter"}),!0}catch{return!1}}(),o.a$(["_update","_setScale","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_update(){const c=this.options.maxWidth||100,r=this._map,s=r._containerHeight/2,u=r._containerWidth/2-c/2,d=r.unproject([u,s]),f=r.unproject([u+c,s]),_=d.distanceTo(f);if(this.options.unit==="imperial"){const y=3.2808*_;y>5280?this._setScale(c,y/5280,"mile"):this._setScale(c,y,"foot")}else this.options.unit==="nautical"?this._setScale(c,_/1852,"nautical-mile"):_>=1e3?this._setScale(c,_/1e3,"kilometer"):this._setScale(c,_,"meter")}_setScale(c,r,s){this._map._requestDomTask(()=>{const u=function(f){const _=Math.pow(10,`${Math.floor(f)}`.length-1);let y=f/_;return y=y>=10?10:y>=5?5:y>=3?3:y>=2?2:y>=1?1:function(b){const T=Math.pow(10,Math.ceil(-Math.log(b)/Math.LN10));return Math.round(b*T)/T}(y),_*y}(r),d=u/r;this._container.innerHTML=this._isNumberFormatSupported&&s!=="nautical-mile"?new Intl.NumberFormat(this._language,{style:"unit",unitDisplay:"short",unit:s}).format(u):`${u}&nbsp;${cd[s]}`,this._container.style.width=c*d+"px"})}onAdd(c){return this._map=c,this._language=c.getLanguage(),this._container=Ft("div","mapboxgl-ctrl mapboxgl-ctrl-scale",c.getContainer()),this._container.dir="auto",this._map.on("move",this._update),this._update(),this._container}onRemove(){this._container.remove(),this._map.off("move",this._update),this._map=void 0}_setLanguage(c){this._language=c,this._update()}setUnit(c){this.options.unit=c,this._update()}},FullscreenControl:class{constructor(c){this._fullscreen=!1,c&&c.container&&(c.container instanceof HTMLElement?this._container=c.container:o.w("Full screen control 'container' must be a DOM element.")),o.a$(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onwebkitfullscreenchange"in document&&(this._fullscreenchange="webkitfullscreenchange")}onAdd(c){return this._map=c,this._container||(this._container=this._map.getContainer()),this._controlContainer=Ft("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",o.w("This device does not support fullscreen mode.")),this._controlContainer}onRemove(){this._controlContainer.remove(),this._map=null,document.removeEventListener(this._fullscreenchange,this._changeIcon)}_checkFullscreenSupport(){return!(!document.fullscreenEnabled&&!document.webkitFullscreenEnabled)}_setupUI(){const c=this._fullscreenButton=Ft("button","mapboxgl-ctrl-fullscreen",this._controlContainer);Ft("span","mapboxgl-ctrl-icon",c).setAttribute("aria-hidden","true"),c.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){const c=this._getTitle();this._fullscreenButton.setAttribute("aria-label",c),this._fullscreenButton.firstElementChild&&this._fullscreenButton.firstElementChild.setAttribute("title",c)}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_changeIcon(){(document.fullscreenElement||document.webkitFullscreenElement)===this._container!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("mapboxgl-ctrl-shrink"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-fullscreen"),this._updateTitle())}_onClickFullscreen(){this._isFullscreen()?document.exitFullscreen?document.exitFullscreen():document.webkitCancelFullScreen&&document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()}},Popup:class extends o.E{constructor(c){super(),this.options=o.e(Object.create(Ea),c),o.a$(["_update","_onClose","remove","_onMouseEvent"],this),this._classList=new Set(c&&c.className?c.className.trim().split(/\s+/):[])}addTo(c){return this._map&&this.remove(),this._map=c,this.options.closeOnClick&&c.on("preclick",this._onClose),this.options.closeOnMove&&c.on("move",this._onClose),c.on("remove",this.remove),this._update(),c._addPopup(this),this._focusFirstElement(),this._trackPointer?(c.on("mousemove",this._onMouseEvent),c.on("mouseup",this._onMouseEvent),c._canvasContainer.classList.add("mapboxgl-track-pointer")):c.on("move",this._update),this.fire(new o.b("open")),this}isOpen(){return!!this._map}remove(){this._content&&this._content.remove(),this._container&&(this._container.remove(),this._container=void 0);const c=this._map;
vendor: 4,394 bytes, line 2115
2115return c&&(c.off("move",this._update),c.off("move",this._onClose),c.off("preclick",this._onClose),c.off("click",this._onClose),c.off("remove",this.remove),c.off("mousemove",this._onMouseEvent),c.off("mouseup",this._onMouseEvent),c.off("drag",this._onMouseEvent),c._canvasContainer&&c._canvasContainer.classList.remove("mapboxgl-track-pointer"),c._removePopup(this),this._map=void 0),this.fire(new o.b("close")),this}getLngLat(){return this._lngLat}setLngLat(c){this._lngLat=o.bq.convert(c),this._pos=null,this._trackPointer=!1,this._update();const r=this._map;return r&&(r.on("move",this._update),r.off("mousemove",this._onMouseEvent),r._canvasContainer.classList.remove("mapboxgl-track-pointer")),this}trackPointer(){this._trackPointer=!0,this._pos=null,this._update();const c=this._map;return c&&(c.off("move",this._update),c.on("mousemove",this._onMouseEvent),c.on("drag",this._onMouseEvent),c._canvasContainer.classList.add("mapboxgl-track-pointer")),this}getElement(){return this._container}setText(c){return this.setDOMContent(document.createTextNode(c))}setHTML(c){const r=document.createDocumentFragment(),s=document.createElement("body");let u;for(s.innerHTML=c;u=s.firstChild,u;)r.appendChild(u);return this.setDOMContent(r)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(c){return this.options.maxWidth=c,this._update(),this}setDOMContent(c){let r=this._content;if(r)for(;r.hasChildNodes();)r.firstChild&&r.removeChild(r.firstChild);else r=this._content=Ft("div","mapboxgl-popup-content",this._container||void 0);if(r.appendChild(c),this.options.closeButton){const s=this._closeButton=Ft("button","mapboxgl-popup-close-button",r);s.type="button",s.setAttribute("aria-label","Close popup"),s.setAttribute("aria-hidden","true"),s.innerHTML="&#215;",s.addEventListener("click",this._onClose)}return this._update(),this._focusFirstElement(),this}addClassName(c){return this._classList.add(c),this._updateClassList(),this}removeClassName(c){return this._classList.delete(c),this._updateClassList(),this}setOffset(c){return this.options.offset=c,this._update(),this}toggleClassName(c){let r;return this._classList.delete(c)?r=!1:(this._classList.add(c),r=!0),this._updateClassList(),r}_onMouseEvent(c){this._update(c.point)}_getAnchor(c){if(this.options.anchor)return this.options.anchor;const r=this._map,s=this._container,u=this._pos;if(!r||!s||!u)return"bottom";const d=s.offsetWidth,f=s.offsetHeight,_=u.x<d/2,y=u.x>r.transform.width-d/2;if(u.y+c<f)return _?"top-left":y?"top-right":"top";if(u.y>r.transform.height-f){if(_)return"bottom-left";if(y)return"bottom-right"}return _?"left":y?"right":"bottom"}_updateClassList(){const c=this._container;if(!c)return;const r=[...this._classList];r.push("mapboxgl-popup"),this._anchor&&r.push(`mapboxgl-popup-anchor-${this._anchor}`),this._trackPointer&&r.push("mapboxgl-popup-track-pointer"),c.className=r.join(" ")}_update(c){const r=this._map,s=this._content;if(!r||!this._lngLat&&!this._trackPointer||!s)return;let u=this._container;if(u||(u=this._container=Ft("div","mapboxgl-popup",r.getContainer()),this._tip=Ft("div","mapboxgl-popup-tip",u),u.appendChild(s)),this.options.maxWidth&&u.style.maxWidth!==this.options.maxWidth&&(u.style.maxWidth=this.options.maxWidth),r.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=Zl(this._lngLat,this._pos,r.transform)),!this._trackPointer||c){const d=this._pos=this._trackPointer&&c?c:r.project(this._lngLat),f=Sa(this.options.offset),_=this._anchor=this._getAnchor(f.y),y=Sa(this.options.offset,_),b=d.add(y).round();r._requestDomTask(()=>{this._container&&_&&(this._container.style.transform=`${fo[_]} translate(${b.x}px,${b.y}px)`)})}if(!this._marker&&r._showingGlobe()){const d=o.de(r.transform,this._lngLat)?0:1;this._setOpacity(d)}this._updateClassList()}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const c=this._container.querySelector(od);c&&c.focus()}_onClose(){this.remove()}_setOpacity(c){this._container&&(this._container.style.opacity=`${c}`),this._content&&(this._content.style.pointerEvents=c?"auto":"none")}},Marker:Ta,Style:sn,LngLat:o.bq,LngLatBounds:o.ag,Point:o.P,MercatorCoordinate:o.O,FreeCameraOptions:Js,Evented:o.E,config:o.dd,prewarm:o.dy,clearPrewarmedResources:o.dz,get accessToken(){return o.dd.ACCESS_TOKEN},set accessToken(c){o.dd.ACCESS_TOKEN=c},get baseApiUrl(){return o.dd.API_URL}
2115,set baseApiUrl(c){o.dd.API_URL=c},get workerCount(){return o.dA.workerCount},set workerCount(c){o.dA.workerCount=c},get maxParallelImageRequests(){return o.dd.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(c){o.dd.MAX_PARALLEL_IMAGE_REQUESTS=c},clearStorage(c){o.dB(c)},get workerUrl(){return o.dC.workerUrl},set workerUrl(c){o.dC.workerUrl=c},get workerClass(){return o.dC.workerClass},set workerClass(c){o.dC.workerClass=c},get workerParams(){return o.dC.workerParams},set workerParams(c){o.dC.workerParams=c},get dracoUrl(){return o.dD()},set dracoUrl(c){o.dE(c)},get meshoptUrl(){return o.dF()},set meshoptUrl(c){o.dG(c)},setNow:o.f.setNow,restoreNow:o.f.restoreNow}});var Dy=Oo;return Dy})})(Cy);var zy=Cy.exports;const g1=f1(zy),x1=_1({__proto__:null,default:g1},[zy]);export{x1 as m};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.