@mappedin/mappedin-js 6.0.1-alpha.2 → 6.0.1-alpha.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/lib/esm/GLTFExporter-CJKR5WGG.js +1 -0
- package/lib/esm/GLTFLoader-H7ZE3A4X.js +1 -0
- package/lib/esm/{PerformanceController-VMCH7DPO.js → PerformanceController-WFRTDYOP.js} +1 -1
- package/lib/esm/{browser-G6HNHS3R.js → browser-7NYRKP6F.js} +1 -1
- package/lib/esm/chunk-2X6TZZIR.js +1 -0
- package/lib/esm/chunk-AIIHKMIL.js +1 -0
- package/lib/esm/chunk-IKFT423T.js +1 -0
- package/lib/esm/chunk-ZIBVJYLJ.js +1 -0
- package/lib/esm/index.css +1 -1
- package/lib/esm/index.d.ts +1685 -928
- package/lib/esm/index.js +1 -1
- package/lib/esm/outdoor-context-OKBFJPVG.js +1 -0
- package/lib/esm/outdoor-context-v4-SVGMPV2P.js +1 -0
- package/lib/index.css +1 -1
- package/package.json +13 -6
- package/CHANGELOG.md +0 -54
- package/lib/esm/GLTFExporter-6MY3TTW5.js +0 -1
- package/lib/esm/chunk-ISNJUESV.js +0 -1
- package/lib/esm/chunk-SVP2SCIT.js +0 -1
- package/lib/esm/chunk-VSBVGSLC.js +0 -1
- package/lib/esm/outdoor-context-HUI6WIRE.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{A as $f,B as Xf,C as pi,D as Jf,E as Yf,F as Qf,G as Al,H as Il,I as G,J as ot,K as ke,L as no,M as ed,N as td,O as oo,P as rd,Q as ao,R as id,S as nd,T as od,a as fe,b as xb,c as T,d as Tl,f as Vf,g as Ft,h as Uf,i as Gf,j as Nf,k as pe,l as ui,m as ci,n as jf,o as qf,p as Zf,q as Hf,r as we,s as Wf,t as Kf,u as Yn,v as Qn,w as eo,x as to,y as ro,z as io}from"./chunk-ZIBVJYLJ.js";import{a as m}from"./chunk-IKFT423T.js";import{a as u,e as re}from"./chunk-J5IUISYU.js";m();var so={name:"@packages/outdoor-context-v4",version:"4.1.3",private:!0,main:"dist/maplibre-gl.js",style:"dist/maplibre-gl.css",license:"BSD-3-Clause",homepage:"https://maplibre.org/",funding:"https://github.com/maplibre/maplibre-gl-js?sponsor=1",bugs:{url:"https://github.com/maplibre/maplibre-gl-js/issues/"},repository:{type:"git",url:"git://github.com/maplibre/maplibre-gl-js.git"},types:"dist/maplibre-gl.d.ts",type:"module",dependencies:{"@mapbox/geojson-rewind":"^0.5.2","@mapbox/jsonlint-lines-primitives":"^2.0.2","@mapbox/point-geometry":"^0.1.0","@mapbox/tiny-sdf":"^2.0.6","@mapbox/unitbezier":"^0.0.1","@mapbox/vector-tile":"^1.3.1","@mapbox/whoots-js":"^3.1.0","@maplibre/maplibre-gl-style-spec":"^20.1.1","@types/geojson":"^7946.0.14","@types/geojson-vt":"3.2.5","@types/junit-report-builder":"^3.0.2","@types/mapbox__point-geometry":"^0.1.4","@types/mapbox__vector-tile":"^1.3.4","@types/pbf":"^3.0.5","@types/supercluster":"^7.1.3",earcut:"^2.2.4","geojson-vt":"^3.2.1","gl-matrix":"^3.4.3","global-prefix":"^3.0.0",kdbush:"^4.0.2","murmurhash-js":"^1.0.0",pbf:"^3.2.1",potpack:"^2.0.0",quickselect:"^2.0.0",supercluster:"^8.0.1",tinyqueue:"^2.0.3","vt-pbf":"^3.1.3"},devDependencies:{"@mapbox/mapbox-gl-rtl-text":"^0.2.3","@mapbox/mvt-fixtures":"^3.10.0","@rollup/plugin-commonjs":"^25.0.7","@rollup/plugin-json":"^6.1.0","@rollup/plugin-node-resolve":"^15.2.3","@rollup/plugin-replace":"^5.0.5","@rollup/plugin-strip":"^3.0.4","@rollup/plugin-terser":"^0.4.4","@rollup/plugin-typescript":"^11.1.6","@types/benchmark":"^2.1.5","@types/cssnano":"^5.0.0","@types/d3":"^7.4.3","@types/diff":"^5.2.0","@types/earcut":"^2.1.4","@types/eslint":"^8.56.7","@types/gl":"^6.0.5","@types/glob":"^8.1.0","@types/jest":"^29.5.12","@types/jsdom":"^21.1.6","@types/minimist":"^1.2.5","@types/murmurhash-js":"^1.0.6","@types/nise":"^1.4.4","@types/node":"^20.12.7","@types/offscreencanvas":"^2019.7.3","@types/pixelmatch":"^5.2.6","@types/pngjs":"^6.0.4","@types/react":"^18.2.79","@types/react-dom":"^18.2.25","@types/request":"^2.48.12","@types/shuffle-seed":"^1.1.3","@types/window-or-global":"^1.0.6","@typescript-eslint/eslint-plugin":"^7.7.1","@typescript-eslint/parser":"^7.7.1",address:"^2.0.2",benchmark:"^2.1.4",canvas:"^2.11.2",cssnano:"^6.1.2",d3:"^7.9.0","d3-queue":"^3.0.7","devtools-protocol":"^0.0.1291694",diff:"^5.2.0","dts-bundle-generator":"^9.5.1",eslint:"^8.57.0","eslint-config-mourner":"^3.0.0","eslint-plugin-html":"^8.1.1","eslint-plugin-import":"^2.29.1","eslint-plugin-jest":"^28.2.0","eslint-plugin-react":"^7.34.1","eslint-plugin-tsdoc":"0.2.17",expect:"^29.7.0",glob:"^10.3.12","is-builtin-module":"^3.2.1",jest:"^29.7.0","jest-environment-jsdom":"^29.7.0","jest-junit":"^16.0.0","jest-monocart-coverage":"^1.1.0","jest-webgl-canvas-mock":"^2.5.3",jsdom:"^24.0.0","json-stringify-pretty-compact":"^4.0.0","junit-report-builder":"^3.2.1",minimist:"^1.2.8","mock-geolocation":"^1.0.11","monocart-coverage-reports":"^2.7.9",nise:"^5.1.9","npm-font-open-sans":"^1.1.0","npm-run-all":"^4.1.5","pdf-merger-js":"^5.1.1",pixelmatch:"^5.3.0",pngjs:"^7.0.0",postcss:"^8.4.38","postcss-cli":"^11.0.0","postcss-inline-svg":"^6.0.0","pretty-bytes":"^6.1.1",puppeteer:"^22.7.0",react:"^18.2.0","react-dom":"^18.2.0",rollup:"^4.16.4","rollup-plugin-sourcemaps":"^0.6.3",rw:"^1.3.3",semver:"^7.6.0","shuffle-seed":"^1.1.6","source-map-explorer":"^2.5.3",st:"^3.0.0",stylelint:"^16.4.0","stylelint-config-standard":"^36.0.0","ts-jest":"^29.1.2","ts-node":"^10.9.2",tslib:"^2.6.2",typedoc:"^0.25.13","typedoc-plugin-markdown":"^3.17.1","typedoc-plugin-missing-exports":"^2.2.0",typescript:"^5.4.5"},overrides:{"postcss-inline-svg":{"css-select":"^5.1.0","dom-serializer":"^2.0.0",htmlparser2:"^8.0.1","postcss-value-parser":"^4.2.0"}},scripts:{"generate-dist-package":"node --no-warnings --loader ts-node/esm build/generate-dist-package.js","generate-shaders":"node --no-warnings --loader ts-node/esm build/generate-shaders.ts","generate-struct-arrays":"node --no-warnings --loader ts-node/esm build/generate-struct-arrays.ts","generate-style-code":"node --no-warnings --loader ts-node/esm build/generate-style-code.ts","generate-typings":"dts-bundle-generator --export-referenced-types --umd-module-name=maplibregl -o ./dist/maplibre-gl.d.ts ./src/index.ts","generate-docs":"typedoc && node --no-warnings --loader ts-node/esm build/generate-docs.ts","generate-images":"node --no-warnings --loader ts-node/esm build/generate-doc-images.ts","build-dist":"npm run build-css && npm run generate-typings && npm run build-dev && npm run build-csp-dev && npm run build-prod && npm run build-csp","build-dev":"rollup --configPlugin @rollup/plugin-typescript -c --environment BUILD:dev","watch-dev":"rollup --configPlugin @rollup/plugin-typescript -c --environment BUILD:dev --watch","build-prod":"rollup --configPlugin @rollup/plugin-typescript -c --environment BUILD:production","build-csp":"rollup --configPlugin @rollup/plugin-typescript -c rollup.config.csp.ts","build-csp-dev":"rollup --configPlugin @rollup/plugin-typescript -c rollup.config.csp.ts --environment BUILD:dev","build-css":"postcss -o dist/maplibre-gl.css src/css/maplibre-gl.css","watch-css":"postcss --watch -o dist/maplibre-gl.css src/css/maplibre-gl.css","build-benchmarks":"npm run build-dev && rollup --configPlugin @rollup/plugin-typescript -c test/bench/rollup_config_benchmarks.ts","watch-benchmarks":"rollup --configPlugin @rollup/plugin-typescript -c test/bench/rollup_config_benchmarks.ts --watch","start-server":"st --no-cache -H 0.0.0.0 --port 9966 .","start-docs":"docker run --rm -it -p 8000:8000 -v ${PWD}:/docs squidfunk/mkdocs-material",start:"run-p watch-css watch-dev start-server","start-bench":"run-p watch-css watch-benchmarks start-server",lint:"eslint --cache --ext .ts,.tsx,.js,.html --ignore-path .gitignore .","lint-css":"stylelint src/css/maplibre-gl.css",test:"run-p lint lint-css test-render jest",jest:"jest","test-build":"jest --selectProjects=build --reporters=default","test-build-ci":"jest --selectProjects=build","test-integration":"jest --selectProjects=integration --reporters=default","test-integration-ci":"jest --selectProjects=integration","test-render":"node --no-warnings --loader ts-node/esm test/integration/render/run_render_tests.ts","test-unit":"jest --selectProjects=unit --reporters=default","test-unit-ci":"jest --coverage --selectProjects unit","test-watch-roots":"jest --watch",codegen:"run-p --print-label generate-dist-package generate-style-code generate-struct-arrays generate-shaders && npm run generate-typings",benchmark:"node --no-warnings --loader ts-node/esm test/bench/run-benchmarks.ts","gl-stats":"node --no-warnings --loader ts-node/esm test/bench/gl-stats.ts",prepare:"npm run codegen",typecheck:"tsc --noEmit && tsc --project tsconfig.dist.json",tsnode:"node --experimental-loader=ts-node/esm --no-warnings"},files:["build/","dist/*","src/"],engines:{npm:">=8.1.0",node:">=16.14.0"}};m();m();var ld=re(fe(),1),ud=re(xb(),1);m();m();var Cl;function lo(){return Cl==null&&(Cl=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),Cl}u(lo,"offscreenCanvasSupported");var uo;function El(){if(uo==null&&(uo=!1,lo())){let e=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(e){for(let i=0;i<5*5;i++){let n=i*4;e.fillStyle="rgb(".concat(n,",").concat(n+1,",").concat(n+2,")"),e.fillRect(i%5,Math.floor(i/5),1,1)}let r=e.getImageData(0,0,5,5).data;for(let i=0;i<5*5*4;i++)if(i%4!==3&&r[i]!==i){uo=!0;break}}}return uo||!1}u(El,"isOffscreenCanvasDistorted");function cd(o){if(o<=0)return 0;if(o>=1)return 1;let t=o*o,e=t*o;return 4*(o<.5?e:3*(o-t)+e-.75)}u(cd,"easeCubicInOut");function hi(o,t,e,r){let i=new ud.default(o,t,e,r);return function(n){return i.solve(n)}}u(hi,"bezier");var mi=hi(.25,.1,.25,1);function ge(o,t,e){return Math.min(e,Math.max(t,o))}u(ge,"clamp");function vt(o,t,e){let r=e-t,i=((o-t)%r+r)%r+t;return i===t?e:i}u(vt,"wrap");function pd(o,t){let e=[];for(let r in o)r in t||e.push(r);return e}u(pd,"keysDifference");function B(o,...t){for(let e of t)for(let r in e)o[r]=e[r];return o}u(B,"extend");function Rt(o,t){let e={};for(let r=0;r<t.length;r++){let i=t[r];i in o&&(e[i]=o[i])}return e}u(Rt,"pick");var vb=1;function co(){return vb++}u(co,"uniqueId");function hd(o){return Math.log(o)/Math.LN2%1===0}u(hd,"isPowerOfTwo");function md(o){return o<=1?1:Math.pow(2,Math.ceil(Math.log(o)/Math.LN2))}u(md,"nextPowerOfTwo");function fi(o,t,e){let r={};for(let i in o)r[i]=t.call(e||this,o[i],i,o);return r}u(fi,"mapObject");function po(o,t,e){let r={};for(let i in o)t.call(e||this,o[i],i,o)&&(r[i]=o[i]);return r}u(po,"filterObject");function bt(o,t){if(Array.isArray(o)){if(!Array.isArray(t)||o.length!==t.length)return!1;for(let e=0;e<o.length;e++)if(!bt(o[e],t[e]))return!1;return!0}if(typeof o=="object"&&o!==null&&t!==null){if(typeof t!="object"||Object.keys(o).length!==Object.keys(t).length)return!1;for(let r in o)if(!bt(o[r],t[r]))return!1;return!0}return o===t}u(bt,"deepEqual");function Xe(o){return Array.isArray(o)?o.map(Xe):typeof o=="object"&&o?fi(o,Xe):o}u(Xe,"clone");function fd(o,t){for(let e=0;e<o.length;e++)if(t.indexOf(o[e])>=0)return!0;return!1}u(fd,"arraysIntersect");var ad={};function ve(o){ad[o]||(typeof console<"u"&&console.warn(o),ad[o]=!0)}u(ve,"warnOnce");function wt(o,t,e){return(e.y-o.y)*(t.x-o.x)>(t.y-o.y)*(e.x-o.x)}u(wt,"isCounterClockwise");function dd(o,t,e,r){let i=t.y-o.y,n=t.x-o.x,a=r.y-e.y,s=r.x-e.x,l=a*n-s*i;if(l===0)return null;let c=o.y-e.y,p=o.x-e.x,h=(s*c-a*p)/l;return new ld.default(o.x+h*n,o.y+h*i)}u(dd,"findLineIntersection");function yd(o){let t=0;for(let e=0,r=o.length,i=r-1,n,a;e<r;i=e++)n=o[e],a=o[i],t+=(a.x-n.x)*(n.y+a.y);return t}u(yd,"calculateSignedArea");function gd([o,t,e]){return t+=90,t*=Math.PI/180,e*=Math.PI/180,{x:o*Math.cos(t)*Math.sin(e),y:o*Math.sin(t)*Math.sin(e),z:o*Math.cos(e)}}u(gd,"sphericalToCartesian");function Pt(o){return typeof WorkerGlobalScope<"u"&&typeof o<"u"&&o instanceof WorkerGlobalScope}u(Pt,"isWorker");function _d(o){let t=/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,e={};if(o.replace(t,(r,i,n,a)=>{let s=n||a;return e[i]=s?s.toLowerCase():!0,""}),e["max-age"]){let r=parseInt(e["max-age"],10);isNaN(r)?delete e["max-age"]:e["max-age"]=r}return e}u(_d,"parseCacheControl");var Ml=null;function xd(o){if(Ml==null){let t=o.navigator?o.navigator.userAgent:null;Ml=!!o.safari||!!(t&&(/\b(iPad|iPhone|iPod)\b/.test(t)||t.match("Safari")&&!t.match("Chrome")))}return Ml}u(xd,"isSafari");function Je(o){return typeof ImageBitmap<"u"&&o instanceof ImageBitmap}u(Je,"isImageBitmap");var bd=u(async o=>{if(o.byteLength===0)return createImageBitmap(new ImageData(1,1));let t=new Blob([new Uint8Array(o)],{type:"image/png"});try{return createImageBitmap(t)}catch(e){throw new Error("Could not load image because of ".concat(e.message,". Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."))}},"arrayBufferToImageBitmap"),sd="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=",vd=u(o=>new Promise((t,e)=>{let r=new Image;r.onload=()=>{t(r),URL.revokeObjectURL(r.src),r.onload=null,window.requestAnimationFrame(()=>{r.src=sd})},r.onerror=()=>e(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."));let i=new Blob([new Uint8Array(o)],{type:"image/png"});r.src=o.byteLength?URL.createObjectURL(i):sd}),"arrayBufferToImage");function wb(o,t,e,r,i){let n=Math.max(-t,0)*4,l=(Math.max(0,e)-e)*r*4+n,c=r*4,p=Math.max(0,t),h=Math.max(0,e),f=Math.min(o.width,t+r),d=Math.min(o.height,e+i);return{rect:{x:p,y:h,width:f-p,height:d-h},layout:[{offset:l,stride:c}]}}u(wb,"computeVideoFrameParameters");async function wd(o,t,e,r,i){if(typeof VideoFrame>"u")throw new Error("VideoFrame not supported");let n=new VideoFrame(o,{timestamp:0});try{let a=n==null?void 0:n.format;if(!a||!(a.startsWith("BGR")||a.startsWith("RGB")))throw new Error("Unrecognized format ".concat(a));let s=a.startsWith("BGR"),l=new Uint8ClampedArray(r*i*4);if(await n.copyTo(l,wb(o,t,e,r,i)),s)for(let c=0;c<l.length;c+=4){let p=l[c];l[c]=l[c+2],l[c+2]=p}return l}finally{n.close()}}u(wd,"readImageUsingVideoFrame");function Pd(o,t,e,r){return o.addEventListener(t,e,r),{unsubscribe:()=>{o.removeEventListener(t,e,r)}}}u(Pd,"subscribe");function Ll(o){return o*Math.PI/180}u(Ll,"degreesToRadians");m();m();var Pb="AbortError";function or(){return new Error(Pb)}u(or,"createAbortError");var Sb=typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),ho,Dl,$={now:Sb,frameAsync(o){return new Promise((t,e)=>{let r=requestAnimationFrame(t);o.signal.addEventListener("abort",()=>{cancelAnimationFrame(r),e(or())})})},getImageData(o,t=0){return this.getImageCanvasContext(o).getImageData(-t,-t,o.width+2*t,o.height+2*t)},getImageCanvasContext(o){let t=window.document.createElement("canvas"),e=t.getContext("2d",{willReadFrequently:!0});if(!e)throw new Error("failed to create canvas 2d context");return t.width=o.width,t.height=o.height,e.drawImage(o,0,0,o.width,o.height),e},resolveURL(o){return ho||(ho=document.createElement("a")),ho.href=o,ho.href},hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return matchMedia?(Dl==null&&(Dl=matchMedia("(prefers-reduced-motion: reduce)")),Dl.matches):!1}};m();var Sd=re(fe(),1);var _e=class _e{static testProp(t){if(!_e.docStyle)return t[0];for(let e=0;e<t.length;e++)if(t[e]in _e.docStyle)return t[e];return t[0]}static create(t,e,r){let i=window.document.createElement(t);return e!==void 0&&(i.className=e),r&&r.appendChild(i),i}static createNS(t,e){return window.document.createElementNS(t,e)}static disableDrag(){_e.docStyle&&_e.selectProp&&(_e.userSelect=_e.docStyle[_e.selectProp],_e.docStyle[_e.selectProp]="none")}static enableDrag(){_e.docStyle&&_e.selectProp&&(_e.docStyle[_e.selectProp]=_e.userSelect)}static setTransform(t,e){t.style[_e.transformProp]=e}static addEventListener(t,e,r,i={}){"passive"in i?t.addEventListener(e,r,i):t.addEventListener(e,r,i.capture)}static removeEventListener(t,e,r,i={}){"passive"in i?t.removeEventListener(e,r,i):t.removeEventListener(e,r,i.capture)}static suppressClickInternal(t){t.preventDefault(),t.stopPropagation(),window.removeEventListener("click",_e.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",_e.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",_e.suppressClickInternal,!0)},0)}static getScale(t){let e=t.getBoundingClientRect();return{x:e.width/t.offsetWidth||1,y:e.height/t.offsetHeight||1,boundingClientRect:e}}static getPoint(t,e,r){let i=e.boundingClientRect;return new Sd.default((r.clientX-i.left)/e.x-t.clientLeft,(r.clientY-i.top)/e.y-t.clientTop)}static mousePos(t,e){let r=_e.getScale(t);return _e.getPoint(t,r,e)}static touchPos(t,e){let r=[],i=_e.getScale(t);for(let n=0;n<e.length;n++)r.push(_e.getPoint(t,i,e[n]));return r}static mouseButton(t){return t.button}static remove(t){t.parentNode&&t.parentNode.removeChild(t)}};u(_e,"DOM"),_e.docStyle=typeof window<"u"&&window.document&&window.document.documentElement.style,_e.selectProp=_e.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),_e.transformProp=_e.testProp(["transform","WebkitTransform"]);var I=_e;m();m();m();var qe={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function mo(o){return qe.REGISTERED_PROTOCOLS[o.substring(0,o.indexOf("://"))]}u(mo,"getProtocol");function Tb(o,t){qe.REGISTERED_PROTOCOLS[o]=t}u(Tb,"addProtocol");function Ab(o){delete qe.REGISTERED_PROTOCOLS[o]}u(Ab,"removeProtocol");m();var fo="global-dispatcher",Fl=class Fl extends Error{constructor(e,r,i,n){super("AJAXError: ".concat(r," (").concat(e,"): ").concat(i));this.status=e,this.statusText=r,this.url=i,this.body=n}};u(Fl,"AJAXError");var ar=Fl,yo=u(()=>Pt(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,"getReferrer"),Ib=u(o=>/^file:/.test(o)||/^file:/.test(yo())&&!/^\w+:/.test(o),"isFileURL");async function Cb(o,t){let e=new Request(o.url,{method:o.method||"GET",body:o.body,credentials:o.credentials,headers:o.headers,cache:o.cache,referrer:yo(),signal:t.signal});o.type==="json"&&e.headers.set("Accept","application/json");let r=await fetch(e);if(!r.ok){let a=await r.blob();throw new ar(r.status,r.statusText,o.url,a)}let i;o.type==="arrayBuffer"||o.type==="image"?i=r.arrayBuffer():o.type==="json"?i=r.json():i=r.text();let n=await i;if(t.signal.aborted)throw or();return{data:n,cacheControl:r.headers.get("Cache-Control"),expires:r.headers.get("Expires")}}u(Cb,"makeFetchRequest");function Eb(o,t){return new Promise((e,r)=>{let i=new XMLHttpRequest;i.open(o.method||"GET",o.url,!0),(o.type==="arrayBuffer"||o.type==="image")&&(i.responseType="arraybuffer");for(let n in o.headers)i.setRequestHeader(n,o.headers[n]);o.type==="json"&&(i.responseType="text",i.setRequestHeader("Accept","application/json")),i.withCredentials=o.credentials==="include",i.onerror=()=>{r(new Error(i.statusText))},i.onload=()=>{if(!t.signal.aborted)if((i.status>=200&&i.status<300||i.status===0)&&i.response!==null){let n=i.response;if(o.type==="json")try{n=JSON.parse(i.response)}catch(a){r(a);return}e({data:n,cacheControl:i.getResponseHeader("Cache-Control"),expires:i.getResponseHeader("Expires")})}else{let n=new Blob([i.response],{type:i.getResponseHeader("Content-Type")});r(new ar(i.status,i.statusText,o.url,n))}},t.signal.addEventListener("abort",()=>{i.abort(),r(or())}),i.send(o.body)})}u(Eb,"makeXMLHttpRequest");var Lr=u(function(o,t){if(/:\/\//.test(o.url)&&!/^https?:|^file:/.test(o.url)){let e=mo(o.url);if(e)return e(o,t);if(Pt(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:o,targetMapId:fo},t)}if(!Ib(o.url)){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return Cb(o,t);if(Pt(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:o,mustQueue:!0,targetMapId:fo},t)}return Eb(o,t)},"makeRequest"),zt=u((o,t)=>Lr(B(o,{type:"json"}),t),"getJSON"),Td=u((o,t)=>Lr(B(o,{type:"arrayBuffer"}),t),"getArrayBuffer");function kl(o){if(!o||o.indexOf("://")<=0||o.indexOf("data:image/")===0||o.indexOf("blob:")===0)return!0;let t=new URL(o),e=window.location;return t.protocol===e.protocol&&t.host===e.host}u(kl,"sameOrigin");var Ad=u(o=>{let t=window.document.createElement("video");return t.muted=!0,new Promise(e=>{t.onloadstart=()=>{e(t)};for(let r of o){let i=window.document.createElement("source");kl(r)||(t.crossOrigin="Anonymous"),i.src=r,t.appendChild(i)}})},"getVideo");m();m();var yi={supported:!1,testSupport:Mb},di,Rl=!1,Dr,Id=!1;typeof document<"u"&&(Dr=document.createElement("img"),Dr.onload=function(){di&&Cd(di),di=null,Id=!0},Dr.onerror=function(){Rl=!0,di=null},Dr.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");function Mb(o){Rl||!Dr||(Id?Cd(o):di=o)}u(Mb,"testSupport");function Cd(o){let t=o.createTexture();o.bindTexture(o.TEXTURE_2D,t);try{if(o.texImage2D(o.TEXTURE_2D,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,Dr),o.isContextLost())return;yi.supported=!0}catch{}o.deleteTexture(t),Rl=!0}u(Cd,"testWebpTextureUpload");var He;(d=>{let o,t,e,r;d.resetRequestQueue=u(()=>{o=[],t=0,e=0,r={}},"resetRequestQueue"),d.addThrottleControl=u(g=>{let y=e++;return r[y]=g,y},"addThrottleControl"),d.removeThrottleControl=u(g=>{delete r[g],h()},"removeThrottleControl");let s=u(()=>{for(let g of Object.keys(r))if(r[g]())return!0;return!1},"isThrottled");d.getImage=u((g,y,_=!0)=>new Promise((w,v)=>{yi.supported&&(g.headers||(g.headers={}),g.headers.accept="image/webp,*/*"),B(g,{type:"image"});let b={abortController:y,requestParameters:g,supportImageRefresh:_,state:"queued",onError:P=>{v(P)},onSuccess:P=>{w(P)}};o.push(b),h()}),"getImage");let c=u(g=>typeof createImageBitmap=="function"?bd(g):vd(g),"arrayBufferToCanvasImageSource"),p=u(async g=>{g.state="running";let{requestParameters:y,supportImageRefresh:_,onError:w,onSuccess:v,abortController:b}=g,P=_===!1&&!Pt(self)&&!mo(y.url)&&(!y.headers||Object.keys(y.headers).reduce((A,L)=>A&&L==="accept",!0));t++;let S=P?f(y,b):Lr(y,b);try{let A=await S;if(delete g.abortController,g.state="completed",A.data instanceof HTMLImageElement||Je(A.data))v(A);else if(A.data){let L=await c(A.data);v({data:L,cacheControl:A.cacheControl,expires:A.expires})}}catch(A){delete g.abortController,w(A)}finally{t--,h()}},"doImageRequest"),h=u(()=>{let g=s()?qe.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:qe.MAX_PARALLEL_IMAGE_REQUESTS;for(let y=t;y<g&&o.length>0;y++){let _=o.shift();if(_.abortController.signal.aborted){y--;continue}p(_)}},"processQueue"),f=u((g,y)=>new Promise((_,w)=>{let v=new Image,b=g.url,P=g.credentials;P&&P==="include"?v.crossOrigin="use-credentials":(P&&P==="same-origin"||!kl(b))&&(v.crossOrigin="anonymous"),y.signal.addEventListener("abort",()=>{v.src="",w(or())}),v.fetchPriority="high",v.onload=()=>{v.onerror=v.onload=null,_({data:v})},v.onerror=()=>{v.onerror=v.onload=null,!y.signal.aborted&&w(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."))},v.src=b}),"getImageUsingHtmlImage")})(He||(He={}));He.resetRequestQueue();m();var zl=class zl{constructor(t){this._transformRequestFn=t}transformRequest(t,e){return this._transformRequestFn?this._transformRequestFn(t,e)||{url:t}:{url:t}}normalizeSpriteURL(t,e,r){let i=Db(t);return i.path+="".concat(e).concat(r),kb(i)}setTransformRequest(t){this._transformRequestFn=t}};u(zl,"RequestManager");var go=zl,Lb=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function Db(o){let t=o.match(Lb);if(!t)throw new Error('Unable to parse URL "'.concat(o,'"'));return{protocol:t[1],authority:t[2],path:t[3]||"/",params:t[4]?t[4].split("&"):[]}}u(Db,"parseUrl");function kb(o){let t=o.params.length?"?".concat(o.params.join("&")):"";return"".concat(o.protocol,"://").concat(o.authority).concat(o.path).concat(t)}u(kb,"formatUrl");m();m();function Ed(o,t,e){e[o]&&e[o].indexOf(t)!==-1||(e[o]=e[o]||[],e[o].push(t))}u(Ed,"_addEventListener");function Bl(o,t,e){if(e&&e[o]){let r=e[o].indexOf(t);r!==-1&&e[o].splice(r,1)}}u(Bl,"_removeEventListener");var Ol=class Ol{constructor(t,e={}){B(this,e),this.type=t}};u(Ol,"Event");var C=Ol,Vl=class Vl extends C{constructor(e,r={}){super("error",B({error:e},r))}};u(Vl,"ErrorEvent");var q=Vl,Ul=class Ul{on(t,e){return this._listeners=this._listeners||{},Ed(t,e,this._listeners),this}off(t,e){return Bl(t,e,this._listeners),Bl(t,e,this._oneTimeListeners),this}once(t,e){return e?(this._oneTimeListeners=this._oneTimeListeners||{},Ed(t,e,this._oneTimeListeners),this):new Promise(r=>this.once(t,r))}fire(t,e){typeof t=="string"&&(t=new C(t,e||{}));let r=t.type;if(this.listens(r)){t.target=this;let i=this._listeners&&this._listeners[r]?this._listeners[r].slice():[];for(let s of i)s.call(this,t);let n=this._oneTimeListeners&&this._oneTimeListeners[r]?this._oneTimeListeners[r].slice():[];for(let s of n)Bl(r,s,this._oneTimeListeners),s.call(this,t);let a=this._eventedParent;a&&(B(t,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),a.fire(t))}else t instanceof q&&console.error(t.error);return this}listens(t){return this._listeners&&this._listeners[t]&&this._listeners[t].length>0||this._oneTimeListeners&&this._oneTimeListeners[t]&&this._oneTimeListeners[t].length>0||this._eventedParent&&this._eventedParent.listens(t)}setEventedParent(t,e){return this._eventedParent=t,this._eventedParentData=e,this}};u(Ul,"Evented");var le=Ul;m();m();m();m();var Ie=Yf,Pw=Ie.source,Md=Ie.light,Sw=Ie.terrain,Tw=Ie.filter,Ld=Ie.paintProperty,Dd=Ie.layoutProperty;function kr(o,t){let e=!1;if(t&&t.length)for(let r of t)o.fire(new q(new Error(r.message))),e=!0;return e}u(kr,"emitValidationErrors");m();m();m();var _o=class _o{constructor(t,e,r){let i=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;let a=new Int32Array(this.arrayBuffer);t=a[0],e=a[1],r=a[2],this.d=e+2*r;for(let c=0;c<this.d*this.d;c++){let p=a[3+c],h=a[3+c+1];i.push(p===h?null:a.subarray(p,h))}let s=a[3+i.length],l=a[3+i.length+1];this.keys=a.subarray(s,l),this.bboxes=a.subarray(l),this.insert=this._insertReadonly}else{this.d=e+2*r;for(let a=0;a<this.d*this.d;a++)i.push([]);this.keys=[],this.bboxes=[]}this.n=e,this.extent=t,this.padding=r,this.scale=e/t,this.uid=0;let n=r/e*t;this.min=-n,this.max=t+n}insert(t,e,r,i,n){this._forEachCell(e,r,i,n,this._insertCell,this.uid++,void 0,void 0),this.keys.push(t),this.bboxes.push(e),this.bboxes.push(r),this.bboxes.push(i),this.bboxes.push(n)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(t,e,r,i,n,a){this.cells[n].push(a)}query(t,e,r,i,n){let a=this.min,s=this.max;if(t<=a&&e<=a&&s<=r&&s<=i&&!n)return Array.prototype.slice.call(this.keys);{let l=[],c={};return this._forEachCell(t,e,r,i,this._queryCell,l,c,n),l}}_queryCell(t,e,r,i,n,a,s,l){let c=this.cells[n];if(c!==null){let p=this.keys,h=this.bboxes;for(let f=0;f<c.length;f++){let d=c[f];if(s[d]===void 0){let g=d*4;(l?l(h[g+0],h[g+1],h[g+2],h[g+3]):t<=h[g+2]&&e<=h[g+3]&&r>=h[g+0]&&i>=h[g+1])?(s[d]=!0,a.push(p[d])):s[d]=!1}}}}_forEachCell(t,e,r,i,n,a,s,l){let c=this._convertToCellCoord(t),p=this._convertToCellCoord(e),h=this._convertToCellCoord(r),f=this._convertToCellCoord(i);for(let d=c;d<=h;d++)for(let g=p;g<=f;g++){let y=this.d*g+d;if(!(l&&!l(this._convertFromCellCoord(d),this._convertFromCellCoord(g),this._convertFromCellCoord(d+1),this._convertFromCellCoord(g+1)))&&n.call(this,t,e,r,i,y,a,s,l))return}}_convertFromCellCoord(t){return(t-this.padding)/this.scale}_convertToCellCoord(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;let t=this.cells,e=3+this.cells.length+1+1,r=0;for(let a=0;a<this.cells.length;a++)r+=this.cells[a].length;let i=new Int32Array(e+r+this.keys.length+this.bboxes.length);i[0]=this.extent,i[1]=this.n,i[2]=this.padding;let n=e;for(let a=0;a<t.length;a++){let s=t[a];i[3+a]=n,i.set(s,n),n+=s.length}return i[3+t.length]=n,i.set(this.keys,n),n+=this.keys.length,i[3+t.length+1]=n,i.set(this.bboxes,n),n+=this.bboxes.length,i.buffer}static serialize(t,e){let r=t.toArrayBuffer();return e&&e.push(r),{buffer:r}}static deserialize(t){return new _o(t.buffer)}};u(_o,"TransferableGridIndex");var lr=_o;var Bt={};function V(o,t,e={}){if(Bt[o])throw new Error("".concat(o," is already registered."));Object.defineProperty(t,"_classRegistryKey",{value:o,writeable:!1}),Bt[o]={klass:t,omit:e.omit||[],shallow:e.shallow||[]}}u(V,"register");V("Object",Object);V("TransferableGridIndex",lr);V("Color",pe);V("Error",Error);V("AJAXError",ar);V("ResolvedImage",ci);V("StylePropertyFunction",$f);V("StyleExpression",eo,{omit:["_evaluator"]});V("ZoomDependentExpression",io);V("ZoomConstantExpression",ro);V("CompoundExpression",Zf,{omit:["_evaluate"]});for(let o in Yn)Yn[o]._classRegistryKey||V("Expression_".concat(o),Yn[o]);function kd(o){return o&&typeof ArrayBuffer<"u"&&(o instanceof ArrayBuffer||o.constructor&&o.constructor.name==="ArrayBuffer")}u(kd,"isArrayBuffer");function Fr(o,t){if(o==null||typeof o=="boolean"||typeof o=="number"||typeof o=="string"||o instanceof Boolean||o instanceof Number||o instanceof String||o instanceof Date||o instanceof RegExp||o instanceof Blob||o instanceof Error)return o;if(kd(o)||Je(o))return t&&t.push(o),o;if(ArrayBuffer.isView(o)){let e=o;return t&&t.push(e.buffer),e}if(o instanceof ImageData)return t&&t.push(o.data.buffer),o;if(Array.isArray(o)){let e=[];for(let r of o)e.push(Fr(r,t));return e}if(typeof o=="object"){let e=o.constructor,r=e._classRegistryKey;if(!r)throw new Error("can't serialize object of unregistered class ".concat(e.name));if(!Bt[r])throw new Error("".concat(r," is not registered."));let i=e.serialize?e.serialize(o,t):{};if(e.serialize){if(t&&i===t[t.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(let n in o){if(!o.hasOwnProperty(n)||Bt[r].omit.indexOf(n)>=0)continue;let a=o[n];i[n]=Bt[r].shallow.indexOf(n)>=0?a:Fr(a,t)}o instanceof Error&&(i.message=o.message)}if(i.$name)throw new Error("$name property is reserved for worker serialization logic.");return r!=="Object"&&(i.$name=r),i}throw new Error("can't serialize object of type ".concat(typeof o))}u(Fr,"serialize");function Rr(o){if(o==null||typeof o=="boolean"||typeof o=="number"||typeof o=="string"||o instanceof Boolean||o instanceof Number||o instanceof String||o instanceof Date||o instanceof RegExp||o instanceof Blob||o instanceof Error||kd(o)||Je(o)||ArrayBuffer.isView(o)||o instanceof ImageData)return o;if(Array.isArray(o))return o.map(Rr);if(typeof o=="object"){let t=o.$name||"Object";if(!Bt[t])throw new Error("can't deserialize unregistered class ".concat(t));let{klass:e}=Bt[t];if(!e)throw new Error("can't deserialize unregistered class ".concat(t));if(e.deserialize)return e.deserialize(o);let r=Object.create(e.prototype);for(let i of Object.keys(o)){if(i==="$name")continue;let n=o[i];r[i]=Bt[t].shallow.indexOf(i)>=0?n:Rr(n)}return r}throw new Error("can't deserialize object of type ".concat(typeof o))}u(Rr,"deserialize");m();m();var Gl=class Gl{constructor(){this.first=!0}update(t,e){let r=Math.floor(t);return this.first?(this.first=!1,this.lastIntegerZoom=r,this.lastIntegerZoomTime=0,this.lastZoom=t,this.lastFloorZoom=r,!0):(this.lastFloorZoom>r?(this.lastIntegerZoom=r+1,this.lastIntegerZoomTime=e):this.lastFloorZoom<r&&(this.lastIntegerZoom=r,this.lastIntegerZoomTime=e),t!==this.lastZoom?(this.lastZoom=t,this.lastFloorZoom=r,!0):!1)}};u(Gl,"ZoomHistory");var zr=Gl;m();m();var oe={"Latin-1 Supplement":o=>o>=128&&o<=255,Arabic:o=>o>=1536&&o<=1791,"Arabic Supplement":o=>o>=1872&&o<=1919,"Arabic Extended-A":o=>o>=2208&&o<=2303,"Hangul Jamo":o=>o>=4352&&o<=4607,"Unified Canadian Aboriginal Syllabics":o=>o>=5120&&o<=5759,Khmer:o=>o>=6016&&o<=6143,"Unified Canadian Aboriginal Syllabics Extended":o=>o>=6320&&o<=6399,"General Punctuation":o=>o>=8192&&o<=8303,"Letterlike Symbols":o=>o>=8448&&o<=8527,"Number Forms":o=>o>=8528&&o<=8591,"Miscellaneous Technical":o=>o>=8960&&o<=9215,"Control Pictures":o=>o>=9216&&o<=9279,"Optical Character Recognition":o=>o>=9280&&o<=9311,"Enclosed Alphanumerics":o=>o>=9312&&o<=9471,"Geometric Shapes":o=>o>=9632&&o<=9727,"Miscellaneous Symbols":o=>o>=9728&&o<=9983,"Miscellaneous Symbols and Arrows":o=>o>=11008&&o<=11263,"CJK Radicals Supplement":o=>o>=11904&&o<=12031,"Kangxi Radicals":o=>o>=12032&&o<=12255,"Ideographic Description Characters":o=>o>=12272&&o<=12287,"CJK Symbols and Punctuation":o=>o>=12288&&o<=12351,Hiragana:o=>o>=12352&&o<=12447,Katakana:o=>o>=12448&&o<=12543,Bopomofo:o=>o>=12544&&o<=12591,"Hangul Compatibility Jamo":o=>o>=12592&&o<=12687,Kanbun:o=>o>=12688&&o<=12703,"Bopomofo Extended":o=>o>=12704&&o<=12735,"CJK Strokes":o=>o>=12736&&o<=12783,"Katakana Phonetic Extensions":o=>o>=12784&&o<=12799,"Enclosed CJK Letters and Months":o=>o>=12800&&o<=13055,"CJK Compatibility":o=>o>=13056&&o<=13311,"CJK Unified Ideographs Extension A":o=>o>=13312&&o<=19903,"Yijing Hexagram Symbols":o=>o>=19904&&o<=19967,"CJK Unified Ideographs":o=>o>=19968&&o<=40959,"Yi Syllables":o=>o>=40960&&o<=42127,"Yi Radicals":o=>o>=42128&&o<=42191,"Hangul Jamo Extended-A":o=>o>=43360&&o<=43391,"Hangul Syllables":o=>o>=44032&&o<=55215,"Hangul Jamo Extended-B":o=>o>=55216&&o<=55295,"Private Use Area":o=>o>=57344&&o<=63743,"CJK Compatibility Ideographs":o=>o>=63744&&o<=64255,"Arabic Presentation Forms-A":o=>o>=64336&&o<=65023,"Vertical Forms":o=>o>=65040&&o<=65055,"CJK Compatibility Forms":o=>o>=65072&&o<=65103,"Small Form Variants":o=>o>=65104&&o<=65135,"Arabic Presentation Forms-B":o=>o>=65136&&o<=65279,"Halfwidth and Fullwidth Forms":o=>o>=65280&&o<=65519};function Nl(o){for(let t of o)if(Fd(t.charCodeAt(0)))return!0;return!1}u(Nl,"allowsVerticalWritingMode");function Fd(o){return o===746||o===747?!0:o<4352?!1:!!(oe["Bopomofo Extended"](o)||oe.Bopomofo(o)||oe["CJK Compatibility Forms"](o)&&!(o>=65097&&o<=65103)||oe["CJK Compatibility Ideographs"](o)||oe["CJK Compatibility"](o)||oe["CJK Radicals Supplement"](o)||oe["CJK Strokes"](o)||oe["CJK Symbols and Punctuation"](o)&&!(o>=12296&&o<=12305)&&!(o>=12308&&o<=12319)&&o!==12336||oe["CJK Unified Ideographs Extension A"](o)||oe["CJK Unified Ideographs"](o)||oe["Enclosed CJK Letters and Months"](o)||oe["Hangul Compatibility Jamo"](o)||oe["Hangul Jamo Extended-A"](o)||oe["Hangul Jamo Extended-B"](o)||oe["Hangul Jamo"](o)||oe["Hangul Syllables"](o)||oe.Hiragana(o)||oe["Ideographic Description Characters"](o)||oe.Kanbun(o)||oe["Kangxi Radicals"](o)||oe["Katakana Phonetic Extensions"](o)||oe.Katakana(o)&&o!==12540||oe["Halfwidth and Fullwidth Forms"](o)&&o!==65288&&o!==65289&&o!==65293&&!(o>=65306&&o<=65310)&&o!==65339&&o!==65341&&o!==65343&&!(o>=65371&&o<=65503)&&o!==65507&&!(o>=65512&&o<=65519)||oe["Small Form Variants"](o)&&!(o>=65112&&o<=65118)&&!(o>=65123&&o<=65126)||oe["Unified Canadian Aboriginal Syllabics"](o)||oe["Unified Canadian Aboriginal Syllabics Extended"](o)||oe["Vertical Forms"](o)||oe["Yijing Hexagram Symbols"](o)||oe["Yi Syllables"](o)||oe["Yi Radicals"](o))}u(Fd,"charHasUprightVerticalOrientation");function Rd(o){return o>=1424&&o<=2303||oe["Arabic Presentation Forms-A"](o)||oe["Arabic Presentation Forms-B"](o)}u(Rd,"charInRTLScript");function Fb(o,t){return!(!t&&Rd(o)||o>=2304&&o<=3583||o>=3840&&o<=4255||oe.Khmer(o))}u(Fb,"charInSupportedScript");function zd(o){for(let t of o)if(Rd(t.charCodeAt(0)))return!0;return!1}u(zd,"stringContainsRTLText");function Bd(o,t){for(let e of o)if(!Fb(e.charCodeAt(0),t))return!1;return!0}u(Bd,"isStringInSupportedScript");m();var ql=class ql{constructor(){this.applyArabicShaping=null;this.processBidirectionalText=null;this.processStyledBidirectionalText=null;this.pluginStatus="unavailable";this.pluginURL=null}setState(t){this.pluginStatus=t.pluginStatus,this.pluginURL=t.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(t){this.applyArabicShaping=t.applyArabicShaping,this.processBidirectionalText=t.processBidirectionalText,this.processStyledBidirectionalText=t.processStyledBidirectionalText}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getPluginURL(){return this.pluginURL}getRTLTextPluginStatus(){return this.pluginStatus}};u(ql,"RTLWorkerPlugin");var jl=ql,St=new jl;var Zl=class Zl{constructor(t,e){this.zoom=t,e?(this.now=e.now,this.fadeDuration=e.fadeDuration,this.zoomHistory=e.zoomHistory,this.transition=e.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new zr,this.transition={})}isSupportedScript(t){return Bd(t,St.getRTLTextPluginStatus()==="loaded")}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){let t=this.zoom,e=t-Math.floor(t),r=this.crossFadingFactor();return t>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:e+(1-e)*r}:{fromScale:.5,toScale:1,t:1-(1-r)*e}}};u(Zl,"EvaluationParameters");var ue=Zl;var Hl=class Hl{constructor(t,e){this.property=t,this.value=e,this.expression=Xf(e===void 0?t.specification.default:e,t.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(t,e,r){return this.property.possiblyEvaluate(this,t,e,r)}};u(Hl,"PropertyValue");var Br=Hl,Wl=class Wl{constructor(t){this.property=t,this.value=new Br(t,void 0)}transitioned(t,e){return new xo(this.property,this.value,e,B({},t.transition,this.transition),t.now)}untransitioned(){return new xo(this.property,this.value,null,{},0)}};u(Wl,"TransitionablePropertyValue");var gi=Wl,Kl=class Kl{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues)}getValue(t){return Xe(this._values[t].value.value)}setValue(t,e){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new gi(this._values[t].property)),this._values[t].value=new Br(this._values[t].property,e===null?void 0:Xe(e))}getTransition(t){return Xe(this._values[t].transition)}setTransition(t,e){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new gi(this._values[t].property)),this._values[t].transition=Xe(e)||void 0}serialize(){let t={};for(let e of Object.keys(this._values)){let r=this.getValue(e);r!==void 0&&(t[e]=r);let i=this.getTransition(e);i!==void 0&&(t["".concat(e,"-transition")]=i)}return t}transitioned(t,e){let r=new bo(this._properties);for(let i of Object.keys(this._values))r._values[i]=this._values[i].transitioned(t,e._values[i]);return r}untransitioned(){let t=new bo(this._properties);for(let e of Object.keys(this._values))t._values[e]=this._values[e].untransitioned();return t}};u(Kl,"Transitionable");var Or=Kl,$l=class $l{constructor(t,e,r,i,n){this.property=t,this.value=e,this.begin=n+i.delay||0,this.end=this.begin+i.duration||0,t.specification.transition&&(i.delay||i.duration)&&(this.prior=r)}possiblyEvaluate(t,e,r){let i=t.now||0,n=this.value.possiblyEvaluate(t,e,r),a=this.prior;if(a){if(i>this.end)return this.prior=null,n;if(this.value.isDataDriven())return this.prior=null,n;if(i<this.begin)return a.possiblyEvaluate(t,e,r);{let s=(i-this.begin)/(this.end-this.begin);return this.property.interpolate(a.possiblyEvaluate(t,e,r),n,cd(s))}}else return n}};u($l,"TransitioningPropertyValue");var xo=$l,Xl=class Xl{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)}possiblyEvaluate(t,e,r){let i=new Ot(this._properties);for(let n of Object.keys(this._values))i._values[n]=this._values[n].possiblyEvaluate(t,e,r);return i}hasTransition(){for(let t of Object.keys(this._values))if(this._values[t].prior)return!0;return!1}};u(Xl,"Transitioning");var bo=Xl,Jl=class Jl{constructor(t){this._properties=t,this._values=Object.create(t.defaultPropertyValues)}hasValue(t){return this._values[t].value!==void 0}getValue(t){return Xe(this._values[t].value)}setValue(t,e){this._values[t]=new Br(this._values[t].property,e===null?void 0:Xe(e))}serialize(){let t={};for(let e of Object.keys(this._values)){let r=this.getValue(e);r!==void 0&&(t[e]=r)}return t}possiblyEvaluate(t,e,r){let i=new Ot(this._properties);for(let n of Object.keys(this._values))i._values[n]=this._values[n].possiblyEvaluate(t,e,r);return i}};u(Jl,"Layout");var vo=Jl,Yl=class Yl{constructor(t,e,r){this.property=t,this.value=e,this.parameters=r}isConstant(){return this.value.kind==="constant"}constantOr(t){return this.value.kind==="constant"?this.value.value:t}evaluate(t,e,r,i){return this.property.evaluate(this.value,this.parameters,t,e,r,i)}};u(Yl,"PossiblyEvaluatedPropertyValue");var Ze=Yl,Ql=class Ql{constructor(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues)}get(t){return this._values[t]}};u(Ql,"PossiblyEvaluated");var Ot=Ql,eu=class eu{constructor(t){this.specification=t}possiblyEvaluate(t,e){if(t.isDataDriven())throw new Error("Value should not be data driven");return t.expression.evaluate(e)}interpolate(t,e,r){let i=this.specification.type,n=we[i];return n?n(t,e,r):t}};u(eu,"DataConstantProperty");var j=eu,tu=class tu{constructor(t,e){this.specification=t,this.overrides=e}possiblyEvaluate(t,e,r,i){return t.expression.kind==="constant"||t.expression.kind==="camera"?new Ze(this,{kind:"constant",value:t.expression.evaluate(e,null,{},r,i)},e):new Ze(this,t.expression,e)}interpolate(t,e,r){if(t.value.kind!=="constant"||e.value.kind!=="constant")return t;if(t.value.value===void 0||e.value.value===void 0)return new Ze(this,{kind:"constant",value:void 0},t.parameters);let i=this.specification.type,n=we[i];if(n){let a=n(t.value.value,e.value.value,r);return new Ze(this,{kind:"constant",value:a},t.parameters)}else return t}evaluate(t,e,r,i,n,a){return t.kind==="constant"?t.value:t.evaluate(e,r,i,n,a)}};u(tu,"DataDrivenProperty");var Z=tu,ru=class ru extends Z{possiblyEvaluate(t,e,r,i){if(t.value===void 0)return new Ze(this,{kind:"constant",value:void 0},e);if(t.expression.kind==="constant"){let n=t.expression.evaluate(e,null,{},r,i),s=t.property.specification.type==="resolvedImage"&&typeof n!="string"?n.name:n,l=this._calculate(s,s,s,e);return new Ze(this,{kind:"constant",value:l},e)}else if(t.expression.kind==="camera"){let n=this._calculate(t.expression.evaluate({zoom:e.zoom-1}),t.expression.evaluate({zoom:e.zoom}),t.expression.evaluate({zoom:e.zoom+1}),e);return new Ze(this,{kind:"constant",value:n},e)}else return new Ze(this,t.expression,e)}evaluate(t,e,r,i,n,a){if(t.kind==="source"){let s=t.evaluate(e,r,i,n,a);return this._calculate(s,s,s,e)}else return t.kind==="composite"?this._calculate(t.evaluate({zoom:Math.floor(e.zoom)-1},r,i),t.evaluate({zoom:Math.floor(e.zoom)},r,i),t.evaluate({zoom:Math.floor(e.zoom)+1},r,i),e):t.value}_calculate(t,e,r,i){return i.zoom>i.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:r,to:e}}interpolate(t){return t}};u(ru,"CrossFadedDataDrivenProperty");var Tt=ru,iu=class iu{constructor(t){this.specification=t}possiblyEvaluate(t,e,r,i){if(t.value!==void 0)if(t.expression.kind==="constant"){let n=t.expression.evaluate(e,null,{},r,i);return this._calculate(n,n,n,e)}else return this._calculate(t.expression.evaluate(new ue(Math.floor(e.zoom-1),e)),t.expression.evaluate(new ue(Math.floor(e.zoom),e)),t.expression.evaluate(new ue(Math.floor(e.zoom+1),e)),e)}_calculate(t,e,r,i){return i.zoom>i.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:r,to:e}}interpolate(t){return t}};u(iu,"CrossFadedProperty");var ur=iu,nu=class nu{constructor(t){this.specification=t}possiblyEvaluate(t,e,r,i){return!!t.expression.evaluate(e,null,{},r,i)}interpolate(){return!1}};u(nu,"ColorRampProperty");var cr=nu,ou=class ou{constructor(t){this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(let e in t){let r=t[e];r.specification.overridable&&this.overridableProperties.push(e);let i=this.defaultPropertyValues[e]=new Br(r,void 0),n=this.defaultTransitionablePropertyValues[e]=new gi(r);this.defaultTransitioningPropertyValues[e]=n.untransitioned(),this.defaultPossiblyEvaluatedValues[e]=i.possiblyEvaluate({})}}};u(ou,"Properties");var Pe=ou;V("DataDrivenProperty",Z);V("DataConstantProperty",j);V("CrossFadedDataDrivenProperty",Tt);V("CrossFadedProperty",ur);V("ColorRampProperty",cr);var wo="-transition",au=class au extends le{constructor(e,r){super();if(this.id=e.id,this.type=e.type,this._featureFilter={filter:()=>!0,needGeometry:!1},e.type!=="custom"&&(e=e,this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,e.type!=="background"&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter),r.layout&&(this._unevaluatedLayout=new vo(r.layout)),r.paint)){this._transitionablePaint=new Or(r.paint);for(let i in e.paint)this.setPaintProperty(i,e.paint[i],{validate:!1});for(let i in e.layout)this.setLayoutProperty(i,e.layout[i],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Ot(r.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){return e==="visibility"?this.visibility:this._unevaluatedLayout.getValue(e)}setLayoutProperty(e,r,i={}){if(r!=null){let n="layers.".concat(this.id,".layout.").concat(e);if(this._validate(Dd,n,e,r,i))return}if(e==="visibility"){this.visibility=r;return}this._unevaluatedLayout.setValue(e,r)}getPaintProperty(e){return e.endsWith(wo)?this._transitionablePaint.getTransition(e.slice(0,-wo.length)):this._transitionablePaint.getValue(e)}setPaintProperty(e,r,i={}){if(r!=null){let n="layers.".concat(this.id,".paint.").concat(e);if(this._validate(Ld,n,e,r,i))return!1}if(e.endsWith(wo))return this._transitionablePaint.setTransition(e.slice(0,-wo.length),r||void 0),!1;{let n=this._transitionablePaint._values[e],a=n.property.specification["property-type"]==="cross-faded-data-driven",s=n.value.isDataDriven(),l=n.value;this._transitionablePaint.setValue(e,r),this._handleSpecialPaintPropertyUpdate(e);let c=this._transitionablePaint._values[e].value;return c.isDataDriven()||s||a||this._handleOverridablePaintPropertyUpdate(e,l,c)}}_handleSpecialPaintPropertyUpdate(e){}_handleOverridablePaintPropertyUpdate(e,r,i){return!1}isHidden(e){return this.minzoom&&e<this.minzoom||this.maxzoom&&e>=this.maxzoom?!0:this.visibility==="none"}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(e,r){e.getCrossfadeParameters&&(this._crossfadeParameters=e.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,r)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,r)}serialize(){let e={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(e.layout=e.layout||{},e.layout.visibility=this.visibility),po(e,(r,i)=>r!==void 0&&!(i==="layout"&&!Object.keys(r).length)&&!(i==="paint"&&!Object.keys(r).length))}_validate(e,r,i,n,a={}){return a&&a.validate===!1?!1:kr(this,e.call(Ie,{key:r,layerType:this.type,objectKey:i,value:n,styleSpec:T,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(let e in this.paint._values){let r=this.paint.get(e);if(!(!(r instanceof Ze)||!Qn(r.property.specification))&&(r.value.kind==="source"||r.value.kind==="composite")&&r.value.isStateDependent)return!0}return!1}};u(au,"StyleLayer");var Ce=au;m();m();m();var Rb={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array},su=class su{constructor(t,e){this._structArray=t,this._pos1=e*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}};u(su,"Struct");var Vt=su,zb=128,Bb=5,lu=class lu{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(t,e){return t._trim(),e&&(t.isTransferred=!0,e.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}}static deserialize(t){let e=Object.create(this.prototype);return e.arrayBuffer=t.arrayBuffer,e.length=t.length,e.capacity=t.arrayBuffer.byteLength/e.bytesPerElement,e._refreshViews(),e}_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(t){this.reserve(t),this.length=t}reserve(t){if(t>this.capacity){this.capacity=Math.max(t,Math.floor(this.capacity*Bb),zb),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);let e=this.uint8;this._refreshViews(),e&&this.uint8.set(e)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}};u(lu,"StructArray");var Se=lu;function he(o,t=1){let e=0,r=0,i=o.map(a=>{let s=Ob(a.type),l=e=Od(e,Math.max(t,s)),c=a.components||1;return r=Math.max(r,s),e+=s*c,{name:a.name,type:a.type,components:c,offset:l}}),n=Od(e,Math.max(r,t));return{members:i,size:n,alignment:t}}u(he,"createLayout");function Ob(o){return Rb[o].BYTES_PER_ELEMENT}u(Ob,"sizeOf");function Od(o,t){return Math.ceil(o/t)*t}u(Od,"align");var Vd=re(fe(),1);var uu=class uu extends Se{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r){let i=this.length;return this.resize(i+1),this.emplace(i,e,r)}emplace(e,r,i){let n=e*2;return this.int16[n+0]=r,this.int16[n+1]=i,e}};u(uu,"StructArrayLayout2i4");var pr=uu;pr.prototype.bytesPerElement=4;V("StructArrayLayout2i4",pr);var cu=class cu extends Se{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,i){let n=this.length;return this.resize(n+1),this.emplace(n,e,r,i)}emplace(e,r,i,n){let a=e*3;return this.int16[a+0]=r,this.int16[a+1]=i,this.int16[a+2]=n,e}};u(cu,"StructArrayLayout3i6");var Vr=cu;Vr.prototype.bytesPerElement=6;V("StructArrayLayout3i6",Vr);var pu=class pu extends Se{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,i,n){let a=this.length;return this.resize(a+1),this.emplace(a,e,r,i,n)}emplace(e,r,i,n,a){let s=e*4;return this.int16[s+0]=r,this.int16[s+1]=i,this.int16[s+2]=n,this.int16[s+3]=a,e}};u(pu,"StructArrayLayout4i8");var _i=pu;_i.prototype.bytesPerElement=8;V("StructArrayLayout4i8",_i);var hu=class hu extends Se{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,i,n,a,s){let l=this.length;return this.resize(l+1),this.emplace(l,e,r,i,n,a,s)}emplace(e,r,i,n,a,s,l){let c=e*6;return this.int16[c+0]=r,this.int16[c+1]=i,this.int16[c+2]=n,this.int16[c+3]=a,this.int16[c+4]=s,this.int16[c+5]=l,e}};u(hu,"StructArrayLayout2i4i12");var xi=hu;xi.prototype.bytesPerElement=12;V("StructArrayLayout2i4i12",xi);var mu=class mu extends Se{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,i,n,a,s){let l=this.length;return this.resize(l+1),this.emplace(l,e,r,i,n,a,s)}emplace(e,r,i,n,a,s,l){let c=e*4,p=e*8;return this.int16[c+0]=r,this.int16[c+1]=i,this.uint8[p+4]=n,this.uint8[p+5]=a,this.uint8[p+6]=s,this.uint8[p+7]=l,e}};u(mu,"StructArrayLayout2i4ub8");var bi=mu;bi.prototype.bytesPerElement=8;V("StructArrayLayout2i4ub8",bi);var fu=class fu extends Se{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r){let i=this.length;return this.resize(i+1),this.emplace(i,e,r)}emplace(e,r,i){let n=e*2;return this.float32[n+0]=r,this.float32[n+1]=i,e}};u(fu,"StructArrayLayout2f8");var Ut=fu;Ut.prototype.bytesPerElement=8;V("StructArrayLayout2f8",Ut);var du=class du extends Se{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,i,n,a,s,l,c,p,h){let f=this.length;return this.resize(f+1),this.emplace(f,e,r,i,n,a,s,l,c,p,h)}emplace(e,r,i,n,a,s,l,c,p,h,f){let d=e*10;return this.uint16[d+0]=r,this.uint16[d+1]=i,this.uint16[d+2]=n,this.uint16[d+3]=a,this.uint16[d+4]=s,this.uint16[d+5]=l,this.uint16[d+6]=c,this.uint16[d+7]=p,this.uint16[d+8]=h,this.uint16[d+9]=f,e}};u(du,"StructArrayLayout10ui20");var vi=du;vi.prototype.bytesPerElement=20;V("StructArrayLayout10ui20",vi);var yu=class yu extends Se{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,i,n,a,s,l,c,p,h,f,d){let g=this.length;return this.resize(g+1),this.emplace(g,e,r,i,n,a,s,l,c,p,h,f,d)}emplace(e,r,i,n,a,s,l,c,p,h,f,d,g){let y=e*12;return this.int16[y+0]=r,this.int16[y+1]=i,this.int16[y+2]=n,this.int16[y+3]=a,this.uint16[y+4]=s,this.uint16[y+5]=l,this.uint16[y+6]=c,this.uint16[y+7]=p,this.int16[y+8]=h,this.int16[y+9]=f,this.int16[y+10]=d,this.int16[y+11]=g,e}};u(yu,"StructArrayLayout4i4ui4i24");var wi=yu;wi.prototype.bytesPerElement=24;V("StructArrayLayout4i4ui4i24",wi);var gu=class gu extends Se{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,i){let n=this.length;return this.resize(n+1),this.emplace(n,e,r,i)}emplace(e,r,i,n){let a=e*3;return this.float32[a+0]=r,this.float32[a+1]=i,this.float32[a+2]=n,e}};u(gu,"StructArrayLayout3f12");var Pi=gu;Pi.prototype.bytesPerElement=12;V("StructArrayLayout3f12",Pi);var _u=class _u extends Se{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){let r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){let i=e*1;return this.uint32[i+0]=r,e}};u(_u,"StructArrayLayout1ul4");var Si=_u;Si.prototype.bytesPerElement=4;V("StructArrayLayout1ul4",Si);var xu=class xu extends Se{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,i,n,a,s,l,c,p){let h=this.length;return this.resize(h+1),this.emplace(h,e,r,i,n,a,s,l,c,p)}emplace(e,r,i,n,a,s,l,c,p,h){let f=e*10,d=e*5;return this.int16[f+0]=r,this.int16[f+1]=i,this.int16[f+2]=n,this.int16[f+3]=a,this.int16[f+4]=s,this.int16[f+5]=l,this.uint32[d+3]=c,this.uint16[f+8]=p,this.uint16[f+9]=h,e}};u(xu,"StructArrayLayout6i1ul2ui20");var Ti=xu;Ti.prototype.bytesPerElement=20;V("StructArrayLayout6i1ul2ui20",Ti);var bu=class bu extends Se{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,i,n,a,s){let l=this.length;return this.resize(l+1),this.emplace(l,e,r,i,n,a,s)}emplace(e,r,i,n,a,s,l){let c=e*6;return this.int16[c+0]=r,this.int16[c+1]=i,this.int16[c+2]=n,this.int16[c+3]=a,this.int16[c+4]=s,this.int16[c+5]=l,e}};u(bu,"StructArrayLayout2i2i2i12");var Ai=bu;Ai.prototype.bytesPerElement=12;V("StructArrayLayout2i2i2i12",Ai);var vu=class vu extends Se{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,i,n,a){let s=this.length;return this.resize(s+1),this.emplace(s,e,r,i,n,a)}emplace(e,r,i,n,a,s){let l=e*4,c=e*8;return this.float32[l+0]=r,this.float32[l+1]=i,this.float32[l+2]=n,this.int16[c+6]=a,this.int16[c+7]=s,e}};u(vu,"StructArrayLayout2f1f2i16");var Ii=vu;Ii.prototype.bytesPerElement=16;V("StructArrayLayout2f1f2i16",Ii);var wu=class wu extends Se{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,i,n){let a=this.length;return this.resize(a+1),this.emplace(a,e,r,i,n)}emplace(e,r,i,n,a){let s=e*12,l=e*3;return this.uint8[s+0]=r,this.uint8[s+1]=i,this.float32[l+1]=n,this.float32[l+2]=a,e}};u(wu,"StructArrayLayout2ub2f12");var Ci=wu;Ci.prototype.bytesPerElement=12;V("StructArrayLayout2ub2f12",Ci);var Pu=class Pu extends Se{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,i){let n=this.length;return this.resize(n+1),this.emplace(n,e,r,i)}emplace(e,r,i,n){let a=e*3;return this.uint16[a+0]=r,this.uint16[a+1]=i,this.uint16[a+2]=n,e}};u(Pu,"StructArrayLayout3ui6");var Ur=Pu;Ur.prototype.bytesPerElement=6;V("StructArrayLayout3ui6",Ur);var Su=class Su extends Se{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,i,n,a,s,l,c,p,h,f,d,g,y,_,w,v){let b=this.length;return this.resize(b+1),this.emplace(b,e,r,i,n,a,s,l,c,p,h,f,d,g,y,_,w,v)}emplace(e,r,i,n,a,s,l,c,p,h,f,d,g,y,_,w,v,b){let P=e*24,S=e*12,A=e*48;return this.int16[P+0]=r,this.int16[P+1]=i,this.uint16[P+2]=n,this.uint16[P+3]=a,this.uint32[S+2]=s,this.uint32[S+3]=l,this.uint32[S+4]=c,this.uint16[P+10]=p,this.uint16[P+11]=h,this.uint16[P+12]=f,this.float32[S+7]=d,this.float32[S+8]=g,this.uint8[A+36]=y,this.uint8[A+37]=_,this.uint8[A+38]=w,this.uint32[S+10]=v,this.int16[P+22]=b,e}};u(Su,"StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48");var Ei=Su;Ei.prototype.bytesPerElement=48;V("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",Ei);var Tu=class Tu extends Se{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,i,n,a,s,l,c,p,h,f,d,g,y,_,w,v,b,P,S,A,L,D,k,E,U,F,M){let N=this.length;return this.resize(N+1),this.emplace(N,e,r,i,n,a,s,l,c,p,h,f,d,g,y,_,w,v,b,P,S,A,L,D,k,E,U,F,M)}emplace(e,r,i,n,a,s,l,c,p,h,f,d,g,y,_,w,v,b,P,S,A,L,D,k,E,U,F,M,N){let z=e*32,W=e*16;return this.int16[z+0]=r,this.int16[z+1]=i,this.int16[z+2]=n,this.int16[z+3]=a,this.int16[z+4]=s,this.int16[z+5]=l,this.int16[z+6]=c,this.int16[z+7]=p,this.uint16[z+8]=h,this.uint16[z+9]=f,this.uint16[z+10]=d,this.uint16[z+11]=g,this.uint16[z+12]=y,this.uint16[z+13]=_,this.uint16[z+14]=w,this.uint16[z+15]=v,this.uint16[z+16]=b,this.uint16[z+17]=P,this.uint16[z+18]=S,this.uint16[z+19]=A,this.uint16[z+20]=L,this.uint16[z+21]=D,this.uint16[z+22]=k,this.uint32[W+12]=E,this.float32[W+13]=U,this.float32[W+14]=F,this.uint16[z+30]=M,this.uint16[z+31]=N,e}};u(Tu,"StructArrayLayout8i15ui1ul2f2ui64");var Mi=Tu;Mi.prototype.bytesPerElement=64;V("StructArrayLayout8i15ui1ul2f2ui64",Mi);var Au=class Au extends Se{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){let r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){let i=e*1;return this.float32[i+0]=r,e}};u(Au,"StructArrayLayout1f4");var hr=Au;hr.prototype.bytesPerElement=4;V("StructArrayLayout1f4",hr);var Iu=class Iu extends Se{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,i){let n=this.length;return this.resize(n+1),this.emplace(n,e,r,i)}emplace(e,r,i,n){let a=e*6,s=e*3;return this.uint16[a+0]=r,this.float32[s+1]=i,this.float32[s+2]=n,e}};u(Iu,"StructArrayLayout1ui2f12");var Li=Iu;Li.prototype.bytesPerElement=12;V("StructArrayLayout1ui2f12",Li);var Cu=class Cu extends Se{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,i){let n=this.length;return this.resize(n+1),this.emplace(n,e,r,i)}emplace(e,r,i,n){let a=e*2,s=e*4;return this.uint32[a+0]=r,this.uint16[s+2]=i,this.uint16[s+3]=n,e}};u(Cu,"StructArrayLayout1ul2ui8");var Di=Cu;Di.prototype.bytesPerElement=8;V("StructArrayLayout1ul2ui8",Di);var Eu=class Eu extends Se{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r){let i=this.length;return this.resize(i+1),this.emplace(i,e,r)}emplace(e,r,i){let n=e*2;return this.uint16[n+0]=r,this.uint16[n+1]=i,e}};u(Eu,"StructArrayLayout2ui4");var ki=Eu;ki.prototype.bytesPerElement=4;V("StructArrayLayout2ui4",ki);var Mu=class Mu extends Se{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){let r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){let i=e*1;return this.uint16[i+0]=r,e}};u(Mu,"StructArrayLayout1ui2");var Fi=Mu;Fi.prototype.bytesPerElement=2;V("StructArrayLayout1ui2",Fi);var Lu=class Lu extends Se{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,i,n){let a=this.length;return this.resize(a+1),this.emplace(a,e,r,i,n)}emplace(e,r,i,n,a){let s=e*4;return this.float32[s+0]=r,this.float32[s+1]=i,this.float32[s+2]=n,this.float32[s+3]=a,e}};u(Lu,"StructArrayLayout4f16");var Gr=Lu;Gr.prototype.bytesPerElement=16;V("StructArrayLayout4f16",Gr);var Du=class Du extends Vt{get anchorPointX(){return this._structArray.int16[this._pos2+0]}get anchorPointY(){return this._structArray.int16[this._pos2+1]}get x1(){return this._structArray.int16[this._pos2+2]}get y1(){return this._structArray.int16[this._pos2+3]}get x2(){return this._structArray.int16[this._pos2+4]}get y2(){return this._structArray.int16[this._pos2+5]}get featureIndex(){return this._structArray.uint32[this._pos4+3]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+8]}get bucketIndex(){return this._structArray.uint16[this._pos2+9]}get anchorPoint(){return new Vd.default(this.anchorPointX,this.anchorPointY)}};u(Du,"CollisionBoxStruct");var Po=Du;Po.prototype.size=20;var ku=class ku extends Ti{get(t){return new Po(this,t)}};u(ku,"CollisionBoxArray");var Ri=ku;V("CollisionBoxArray",Ri);var Fu=class Fu extends Vt{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(e){this._structArray.uint8[this._pos1+37]=e}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(e){this._structArray.uint8[this._pos1+38]=e}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(e){this._structArray.uint32[this._pos4+10]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}};u(Fu,"PlacedSymbolStruct");var So=Fu;So.prototype.size=48;var Ru=class Ru extends Ei{get(t){return new So(this,t)}};u(Ru,"PlacedSymbolArray");var zi=Ru;V("PlacedSymbolArray",zi);var zu=class zu extends Vt{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(e){this._structArray.uint32[this._pos4+12]=e}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+14]}get textAnchorOffsetStartIndex(){return this._structArray.uint16[this._pos2+30]}get textAnchorOffsetEndIndex(){return this._structArray.uint16[this._pos2+31]}};u(zu,"SymbolInstanceStruct");var To=zu;To.prototype.size=64;var Bu=class Bu extends Mi{get(t){return new To(this,t)}};u(Bu,"SymbolInstanceArray");var Bi=Bu;V("SymbolInstanceArray",Bi);var Ou=class Ou extends hr{getoffsetX(t){return this.float32[t*1+0]}};u(Ou,"GlyphOffsetArray");var Oi=Ou;V("GlyphOffsetArray",Oi);var Vu=class Vu extends Vr{getx(t){return this.int16[t*3+0]}gety(t){return this.int16[t*3+1]}gettileUnitDistanceFromAnchor(t){return this.int16[t*3+2]}};u(Vu,"SymbolLineVertexArray");var Vi=Vu;V("SymbolLineVertexArray",Vi);var Uu=class Uu extends Vt{get textAnchor(){return this._structArray.uint16[this._pos2+0]}get textOffset0(){return this._structArray.float32[this._pos4+1]}get textOffset1(){return this._structArray.float32[this._pos4+2]}};u(Uu,"TextAnchorOffsetStruct");var Ao=Uu;Ao.prototype.size=12;var Gu=class Gu extends Li{get(t){return new Ao(this,t)}};u(Gu,"TextAnchorOffsetArray");var Ui=Gu;V("TextAnchorOffsetArray",Ui);var Nu=class Nu extends Vt{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]}};u(Nu,"FeatureIndexStruct");var Io=Nu;Io.prototype.size=8;var ju=class ju extends Di{get(t){return new Io(this,t)}};u(ju,"FeatureIndexArray");var Gi=ju;V("FeatureIndexArray",Gi);var qu=class qu extends pr{};u(qu,"PosArray");var Gt=qu,Zu=class Zu extends Vr{};u(Zu,"Pos3dArray");var Co=Zu,Hu=class Hu extends _i{};u(Hu,"RasterBoundsArray");var Nr=Hu,Wu=class Wu extends pr{};u(Wu,"CircleLayoutArray");var Eo=Wu,Ku=class Ku extends pr{};u(Ku,"FillLayoutArray");var Mo=Ku,$u=class $u extends xi{};u($u,"FillExtrusionLayoutArray");var Lo=$u;var Xu=class Xu extends bi{};u(Xu,"LineLayoutArray");var Do=Xu,Ju=class Ju extends Ut{};u(Ju,"LineExtLayoutArray");var ko=Ju,Yu=class Yu extends vi{};u(Yu,"PatternLayoutArray");var At=Yu,Qu=class Qu extends wi{};u(Qu,"SymbolLayoutArray");var Fo=Qu,ec=class ec extends Pi{};u(ec,"SymbolDynamicLayoutArray");var Ro=ec,tc=class tc extends Si{};u(tc,"SymbolOpacityArray");var zo=tc,rc=class rc extends Ai{};u(rc,"CollisionBoxLayoutArray");var Ni=rc,ic=class ic extends Ii{};u(ic,"CollisionCircleLayoutArray");var Bo=ic,nc=class nc extends Ci{};u(nc,"CollisionVertexArray");var Oo=nc,oc=class oc extends Ur{};u(oc,"QuadTriangleArray");var Vo=oc,ac=class ac extends Ur{};u(ac,"TriangleIndexArray");var Ge=ac,sc=class sc extends ki{};u(sc,"LineIndexArray");var Nt=sc,lc=class lc extends Fi{};u(lc,"LineStripIndexArray");var ji=lc;m();var Vb=he([{name:"a_pos",components:2,type:"Int16"}],4);var{members:Ud,size:OP,alignment:VP}=Vb;m();var mr=class mr{constructor(t=[]){this.segments=t}prepareSegment(t,e,r,i){let n=this.segments[this.segments.length-1];return t>mr.MAX_VERTEX_ARRAY_LENGTH&&ve("Max vertices per segment is ".concat(mr.MAX_VERTEX_ARRAY_LENGTH,": bucket requested ").concat(t)),(!n||n.vertexLength+t>mr.MAX_VERTEX_ARRAY_LENGTH||n.sortKey!==i)&&(n={vertexOffset:e.length,primitiveOffset:r.length,vertexLength:0,primitiveLength:0},i!==void 0&&(n.sortKey=i),this.segments.push(n)),n}get(){return this.segments}destroy(){for(let t of this.segments)for(let e in t.vaos)t.vaos[e].destroy()}static simpleSegment(t,e,r,i){return new mr([{vertexOffset:t,primitiveOffset:e,vertexLength:r,primitiveLength:i,vaos:{},sortKey:0}])}};u(mr,"SegmentVector");var se=mr;se.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1;V("SegmentVector",se);m();m();function uc(o,t){return o=ge(Math.floor(o),0,255),t=ge(Math.floor(t),0,255),256*o+t}u(uc,"packUint8ToFloat");m();var qi=he([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]);m();var Nd=re(Qf(),1);var Go=class Go{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(t,e,r,i){this.ids.push(Gd(t)),this.positions.push(e,r,i)}getPositions(t){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");let e=Gd(t),r=0,i=this.ids.length-1;for(;r<i;){let a=r+i>>1;this.ids[a]>=e?i=a:r=a+1}let n=[];for(;this.ids[r]===e;){let a=this.positions[3*r],s=this.positions[3*r+1],l=this.positions[3*r+2];n.push({index:a,start:s,end:l}),r++}return n}static serialize(t,e){let r=new Float64Array(t.ids),i=new Uint32Array(t.positions);return cc(r,i,0,r.length-1),e&&e.push(r.buffer,i.buffer),{ids:r,positions:i}}static deserialize(t){let e=new Go;return e.ids=t.ids,e.positions=t.positions,e.indexed=!0,e}};u(Go,"FeaturePositionMap");var Zi=Go;function Gd(o){let t=+o;return!isNaN(t)&&t<=Number.MAX_SAFE_INTEGER?t:(0,Nd.default)(String(o))}u(Gd,"getNumericId");function cc(o,t,e,r){for(;e<r;){let i=o[e+r>>1],n=e-1,a=r+1;for(;;){do n++;while(o[n]<i);do a--;while(o[a]>i);if(n>=a)break;Uo(o,n,a),Uo(t,3*n,3*a),Uo(t,3*n+1,3*a+1),Uo(t,3*n+2,3*a+2)}a-e<r-a?(cc(o,t,e,a),e=a+1):(cc(o,t,a+1,r),r=a)}}u(cc,"sort");function Uo(o,t,e){let r=o[t];o[t]=o[e],o[e]=r}u(Uo,"swap");V("FeaturePositionMap",Zi);m();var pc=class pc{constructor(t,e){this.gl=t.gl,this.location=e}};u(pc,"Uniform");var It=pc,hc=class hc extends It{constructor(t,e){super(t,e),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1i(this.location,t))}};u(hc,"Uniform1i");var X=hc,mc=class mc extends It{constructor(t,e){super(t,e),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1f(this.location,t))}};u(mc,"Uniform1f");var O=mc,fc=class fc extends It{constructor(t,e){super(t,e),this.current=[0,0]}set(t){(t[0]!==this.current[0]||t[1]!==this.current[1])&&(this.current=t,this.gl.uniform2f(this.location,t[0],t[1]))}};u(fc,"Uniform2f");var Y=fc,dc=class dc extends It{constructor(t,e){super(t,e),this.current=[0,0,0]}set(t){(t[0]!==this.current[0]||t[1]!==this.current[1]||t[2]!==this.current[2])&&(this.current=t,this.gl.uniform3f(this.location,t[0],t[1],t[2]))}};u(dc,"Uniform3f");var We=dc,yc=class yc extends It{constructor(t,e){super(t,e),this.current=[0,0,0,0]}set(t){(t[0]!==this.current[0]||t[1]!==this.current[1]||t[2]!==this.current[2]||t[3]!==this.current[3])&&(this.current=t,this.gl.uniform4f(this.location,t[0],t[1],t[2],t[3]))}};u(yc,"Uniform4f");var jt=yc,gc=class gc extends It{constructor(t,e){super(t,e),this.current=pe.transparent}set(t){(t.r!==this.current.r||t.g!==this.current.g||t.b!==this.current.b||t.a!==this.current.a)&&(this.current=t,this.gl.uniform4f(this.location,t.r,t.g,t.b,t.a))}};u(gc,"UniformColor");var at=gc,Ub=new Float32Array(16),_c=class _c extends It{constructor(t,e){super(t,e),this.current=Ub}set(t){if(t[12]!==this.current[12]||t[0]!==this.current[0]){this.current=t,this.gl.uniformMatrix4fv(this.location,!1,t);return}for(let e=1;e<16;e++)if(t[e]!==this.current[e]){this.current=t,this.gl.uniformMatrix4fv(this.location,!1,t);break}}};u(_c,"UniformMatrix4f");var Q=_c;function xc(o){return[uc(255*o.r,255*o.g),uc(255*o.b,255*o.a)]}u(xc,"packColor");var bc=class bc{constructor(t,e,r){this.value=t,this.uniformNames=e.map(i=>"u_".concat(i)),this.type=r}setUniform(t,e,r){t.set(r.constantOr(this.value))}getBinding(t,e,r){return this.type==="color"?new at(t,e):new O(t,e)}};u(bc,"ConstantBinder");var fr=bc,vc=class vc{constructor(t,e){this.uniformNames=e.map(r=>"u_".concat(r)),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(t,e){this.pixelRatioFrom=e.pixelRatio,this.pixelRatioTo=t.pixelRatio,this.patternFrom=e.tlbr,this.patternTo=t.tlbr}setUniform(t,e,r,i){let n=i==="u_pattern_to"?this.patternTo:i==="u_pattern_from"?this.patternFrom:i==="u_pixel_ratio_to"?this.pixelRatioTo:i==="u_pixel_ratio_from"?this.pixelRatioFrom:null;n&&t.set(n)}getBinding(t,e,r){return r.substr(0,9)==="u_pattern"?new jt(t,e):new O(t,e)}};u(vc,"CrossFadedConstantBinder");var qt=vc,wc=class wc{constructor(t,e,r,i){this.expression=t,this.type=r,this.maxValue=0,this.paintVertexAttributes=e.map(n=>({name:"a_".concat(n),type:"Float32",components:r==="color"?2:1,offset:0})),this.paintVertexArray=new i}populatePaintArray(t,e,r,i,n){let a=this.paintVertexArray.length,s=this.expression.evaluate(new ue(0),e,{},i,[],n);this.paintVertexArray.resize(t),this._setPaintValue(a,t,s)}updatePaintArray(t,e,r,i){let n=this.expression.evaluate({zoom:0},r,i);this._setPaintValue(t,e,n)}_setPaintValue(t,e,r){if(this.type==="color"){let i=xc(r);for(let n=t;n<e;n++)this.paintVertexArray.emplace(n,i[0],i[1])}else{for(let i=t;i<e;i++)this.paintVertexArray.emplace(i,r);this.maxValue=Math.max(this.maxValue,Math.abs(r))}}upload(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}};u(wc,"SourceExpressionBinder");var ct=wc,Pc=class Pc{constructor(t,e,r,i,n,a){this.expression=t,this.uniformNames=e.map(s=>"u_".concat(s,"_t")),this.type=r,this.useIntegerZoom=i,this.zoom=n,this.maxValue=0,this.paintVertexAttributes=e.map(s=>({name:"a_".concat(s),type:"Float32",components:r==="color"?4:2,offset:0})),this.paintVertexArray=new a}populatePaintArray(t,e,r,i,n){let a=this.expression.evaluate(new ue(this.zoom),e,{},i,[],n),s=this.expression.evaluate(new ue(this.zoom+1),e,{},i,[],n),l=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(l,t,a,s)}updatePaintArray(t,e,r,i){let n=this.expression.evaluate({zoom:this.zoom},r,i),a=this.expression.evaluate({zoom:this.zoom+1},r,i);this._setPaintValue(t,e,n,a)}_setPaintValue(t,e,r,i){if(this.type==="color"){let n=xc(r),a=xc(i);for(let s=t;s<e;s++)this.paintVertexArray.emplace(s,n[0],n[1],a[0],a[1])}else{for(let n=t;n<e;n++)this.paintVertexArray.emplace(n,r,i);this.maxValue=Math.max(this.maxValue,Math.abs(r),Math.abs(i))}}upload(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(t,e){let r=this.useIntegerZoom?Math.floor(e.zoom):e.zoom,i=ge(this.expression.interpolationFactor(r,this.zoom,this.zoom+1),0,1);t.set(i)}getBinding(t,e,r){return new O(t,e)}};u(Pc,"CompositeExpressionBinder");var it=Pc,Sc=class Sc{constructor(t,e,r,i,n,a){this.expression=t,this.type=e,this.useIntegerZoom=r,this.zoom=i,this.layerId=a,this.zoomInPaintVertexArray=new n,this.zoomOutPaintVertexArray=new n}populatePaintArray(t,e,r){let i=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(t),this.zoomOutPaintVertexArray.resize(t),this._setPaintValues(i,t,e.patterns&&e.patterns[this.layerId],r)}updatePaintArray(t,e,r,i,n){this._setPaintValues(t,e,r.patterns&&r.patterns[this.layerId],n)}_setPaintValues(t,e,r,i){if(!i||!r)return;let{min:n,mid:a,max:s}=r,l=i[n],c=i[a],p=i[s];if(!(!l||!c||!p))for(let h=t;h<e;h++)this.zoomInPaintVertexArray.emplace(h,c.tl[0],c.tl[1],c.br[0],c.br[1],l.tl[0],l.tl[1],l.br[0],l.br[1],c.pixelRatio,l.pixelRatio),this.zoomOutPaintVertexArray.emplace(h,c.tl[0],c.tl[1],c.br[0],c.br[1],p.tl[0],p.tl[1],p.br[0],p.br[1],c.pixelRatio,p.pixelRatio)}upload(t){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=t.createVertexBuffer(this.zoomInPaintVertexArray,qi.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=t.createVertexBuffer(this.zoomOutPaintVertexArray,qi.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}};u(Sc,"CrossFadedCompositeBinder");var ht=Sc,Tc=class Tc{constructor(t,e,r){this.binders={},this._buffers=[];let i=[];for(let n in t.paint._values){if(!r(n))continue;let a=t.paint.get(n);if(!(a instanceof Ze)||!Qn(a.property.specification))continue;let s=Gb(n,t.type),l=a.value,c=a.property.specification.type,p=a.property.useIntegerZoom,h=a.property.specification["property-type"],f=h==="cross-faded"||h==="cross-faded-data-driven";if(l.kind==="constant")this.binders[n]=f?new qt(l.value,s):new fr(l.value,s,c),i.push("/u_".concat(n));else if(l.kind==="source"||f){let d=jd(n,c,"source");this.binders[n]=f?new ht(l,c,p,e,d,t.id):new ct(l,s,c,d),i.push("/a_".concat(n))}else{let d=jd(n,c,"composite");this.binders[n]=new it(l,s,c,p,e,d),i.push("/z_".concat(n))}}this.cacheKey=i.sort().join("")}getMaxValue(t){let e=this.binders[t];return e instanceof ct||e instanceof it?e.maxValue:0}populatePaintArrays(t,e,r,i,n){for(let a in this.binders){let s=this.binders[a];(s instanceof ct||s instanceof it||s instanceof ht)&&s.populatePaintArray(t,e,r,i,n)}}setConstantPatternPositions(t,e){for(let r in this.binders){let i=this.binders[r];i instanceof qt&&i.setConstantPatternPositions(t,e)}}updatePaintArrays(t,e,r,i,n){let a=!1;for(let s in t){let l=e.getPositions(s);for(let c of l){let p=r.feature(c.index);for(let h in this.binders){let f=this.binders[h];if((f instanceof ct||f instanceof it||f instanceof ht)&&f.expression.isStateDependent===!0){let d=i.paint.get(h);f.expression=d.value,f.updatePaintArray(c.start,c.end,p,t[s],n),a=!0}}}}return a}defines(){let t=[];for(let e in this.binders){let r=this.binders[e];(r instanceof fr||r instanceof qt)&&t.push(...r.uniformNames.map(i=>"#define HAS_UNIFORM_".concat(i)))}return t}getBinderAttributes(){let t=[];for(let e in this.binders){let r=this.binders[e];if(r instanceof ct||r instanceof it)for(let i=0;i<r.paintVertexAttributes.length;i++)t.push(r.paintVertexAttributes[i].name);else if(r instanceof ht)for(let i=0;i<qi.members.length;i++)t.push(qi.members[i].name)}return t}getBinderUniforms(){let t=[];for(let e in this.binders){let r=this.binders[e];if(r instanceof fr||r instanceof qt||r instanceof it)for(let i of r.uniformNames)t.push(i)}return t}getPaintVertexBuffers(){return this._buffers}getUniforms(t,e){let r=[];for(let i in this.binders){let n=this.binders[i];if(n instanceof fr||n instanceof qt||n instanceof it){for(let a of n.uniformNames)if(e[a]){let s=n.getBinding(t,e[a],a);r.push({name:a,property:i,binding:s})}}}return r}setUniforms(t,e,r,i){for(let{name:n,property:a,binding:s}of e)this.binders[a].setUniform(s,i,r.get(a),n)}updatePaintBuffers(t){this._buffers=[];for(let e in this.binders){let r=this.binders[e];if(t&&r instanceof ht){let i=t.fromScale===2?r.zoomInPaintVertexBuffer:r.zoomOutPaintVertexBuffer;i&&this._buffers.push(i)}else(r instanceof ct||r instanceof it)&&r.paintVertexBuffer&&this._buffers.push(r.paintVertexBuffer)}}upload(t){for(let e in this.binders){let r=this.binders[e];(r instanceof ct||r instanceof it||r instanceof ht)&&r.upload(t)}this.updatePaintBuffers()}destroy(){for(let t in this.binders){let e=this.binders[t];(e instanceof ct||e instanceof it||e instanceof ht)&&e.destroy()}}};u(Tc,"ProgramConfiguration");var No=Tc,Ac=class Ac{constructor(t,e,r=()=>!0){this.programConfigurations={};for(let i of t)this.programConfigurations[i.id]=new No(i,e,r);this.needsUpload=!1,this._featureMap=new Zi,this._bufferOffset=0}populatePaintArrays(t,e,r,i,n,a){for(let s in this.programConfigurations)this.programConfigurations[s].populatePaintArrays(t,e,i,n,a);e.id!==void 0&&this._featureMap.add(e.id,r,this._bufferOffset,t),this._bufferOffset=t,this.needsUpload=!0}updatePaintArrays(t,e,r,i){for(let n of r)this.needsUpload=this.programConfigurations[n.id].updatePaintArrays(t,this._featureMap,e,n,i)||this.needsUpload}get(t){return this.programConfigurations[t]}upload(t){if(this.needsUpload){for(let e in this.programConfigurations)this.programConfigurations[e].upload(t);this.needsUpload=!1}}destroy(){for(let t in this.programConfigurations)this.programConfigurations[t].destroy()}};u(Ac,"ProgramConfigurationSet");var Ye=Ac;function Gb(o,t){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[o]||[o.replace("".concat(t,"-"),"").replace(/-/g,"_")]}u(Gb,"paintAttributeNames");function Nb(o){return{"line-pattern":{source:At,composite:At},"fill-pattern":{source:At,composite:At},"fill-extrusion-pattern":{source:At,composite:At}}[o]}u(Nb,"getLayoutException");function jd(o,t,e){let r={color:{source:Ut,composite:Gr},number:{source:hr,composite:Ut}},i=Nb(o);return i&&i[e]||r[t][e]}u(jd,"layoutType");V("ConstantBinder",fr);V("CrossFadedConstantBinder",qt);V("SourceExpressionBinder",ct);V("CrossFadedCompositeBinder",ht);V("CompositeExpressionBinder",it);V("ProgramConfiguration",No,{omit:["_buffers"]});V("ProgramConfigurationSet",Ye);m();m();m();var jb=15,Ic=Math.pow(2,jb-1)-1,qd=-Ic-1;function Qe(o){let t=8192/o.extent,e=o.loadGeometry();for(let r=0;r<e.length;r++){let i=e[r];for(let n=0;n<i.length;n++){let a=i[n],s=Math.round(a.x*t),l=Math.round(a.y*t);a.x=ge(s,qd,Ic),a.y=ge(l,qd,Ic),(s<a.x||s>a.x+1||l<a.y||l>a.y+1)&&ve("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return e}u(Qe,"loadGeometry");m();function et(o,t){return{type:o.type,id:o.id,properties:o.properties,geometry:t?Qe(o):[]}}u(et,"toEvaluationFeature");function jo(o,t,e,r,i){o.emplaceBack(t*2+(r+1)/2,e*2+(i+1)/2)}u(jo,"addCircleVertex");var Cc=class Cc{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(e=>e.id),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new Eo,this.indexArray=new Ge,this.segments=new se,this.programConfigurations=new Ye(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id)}populate(t,e,r){let i=this.layers[0],n=[],a=null,s=!1;i.type==="circle"&&(a=i.layout.get("circle-sort-key"),s=!a.isConstant());for(let{feature:l,id:c,index:p,sourceLayerIndex:h}of t){let f=this.layers[0]._featureFilter.needGeometry,d=et(l,f);if(!this.layers[0]._featureFilter.filter(new ue(this.zoom),d,r))continue;let g=s?a.evaluate(d,{},r):void 0,y={id:c,properties:l.properties,type:l.type,sourceLayerIndex:h,index:p,geometry:f?d.geometry:Qe(l),patterns:{},sortKey:g};n.push(y)}s&&n.sort((l,c)=>l.sortKey-c.sortKey);for(let l of n){let{geometry:c,index:p,sourceLayerIndex:h}=l,f=t[p].feature;this.addFeature(l,c,p,r),e.featureIndex.insert(f,c,p,h,this.index)}}update(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,r)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Ud),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(t,e,r,i){for(let n of e)for(let a of n){let s=a.x,l=a.y;if(s<0||s>=8192||l<0||l>=8192)continue;let c=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,t.sortKey),p=c.vertexLength;jo(this.layoutVertexArray,s,l,-1,-1),jo(this.layoutVertexArray,s,l,1,-1),jo(this.layoutVertexArray,s,l,1,1),jo(this.layoutVertexArray,s,l,-1,1),this.indexArray.emplaceBack(p,p+1,p+2),this.indexArray.emplaceBack(p,p+3,p+2),c.vertexLength+=4,c.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,{},i)}};u(Cc,"CircleBucket");var dr=Cc;V("CircleBucket",dr,{omit:["layers"]});m();var Hi=re(fe(),1);function qo(o,t){for(let e=0;e<o.length;e++)if(jr(t,o[e]))return!0;for(let e=0;e<t.length;e++)if(jr(o,t[e]))return!0;return!!Mc(o,t)}u(qo,"polygonIntersectsPolygon");function Hd(o,t,e){return!!(jr(o,t)||Ec(t,o,e))}u(Hd,"polygonIntersectsBufferedPoint");function Zo(o,t){if(o.length===1)return Zd(t,o[0]);for(let e=0;e<t.length;e++){let r=t[e];for(let i=0;i<r.length;i++)if(jr(o,r[i]))return!0}for(let e=0;e<o.length;e++)if(Zd(t,o[e]))return!0;for(let e=0;e<t.length;e++)if(Mc(o,t[e]))return!0;return!1}u(Zo,"polygonIntersectsMultiPolygon");function Wd(o,t,e){for(let r=0;r<t.length;r++){let i=t[r];if(o.length>=3){for(let n=0;n<i.length;n++)if(jr(o,i[n]))return!0}if(qb(o,i,e))return!0}return!1}u(Wd,"polygonIntersectsBufferedMultiLine");function qb(o,t,e){if(o.length>1){if(Mc(o,t))return!0;for(let r=0;r<t.length;r++)if(Ec(t[r],o,e))return!0}for(let r=0;r<o.length;r++)if(Ec(o[r],t,e))return!0;return!1}u(qb,"lineIntersectsBufferedLine");function Mc(o,t){if(o.length===0||t.length===0)return!1;for(let e=0;e<o.length-1;e++){let r=o[e],i=o[e+1];for(let n=0;n<t.length-1;n++){let a=t[n],s=t[n+1];if(Zb(r,i,a,s))return!0}}return!1}u(Mc,"lineIntersectsLine");function Zb(o,t,e,r){return wt(o,e,r)!==wt(t,e,r)&&wt(o,t,e)!==wt(o,t,r)}u(Zb,"lineSegmentIntersectsLineSegment");function Ec(o,t,e){let r=e*e;if(t.length===1)return o.distSqr(t[0])<r;for(let i=1;i<t.length;i++){let n=t[i-1],a=t[i];if(Kd(o,n,a)<r)return!0}return!1}u(Ec,"pointIntersectsBufferedLine");function Kd(o,t,e){let r=t.distSqr(e);if(r===0)return o.distSqr(t);let i=((o.x-t.x)*(e.x-t.x)+(o.y-t.y)*(e.y-t.y))/r;return i<0?o.distSqr(t):i>1?o.distSqr(e):o.distSqr(e.sub(t)._mult(i)._add(t))}u(Kd,"distToSegmentSquared");function Zd(o,t){let e=!1,r,i,n;for(let a=0;a<o.length;a++){r=o[a];for(let s=0,l=r.length-1;s<r.length;l=s++)i=r[s],n=r[l],i.y>t.y!=n.y>t.y&&t.x<(n.x-i.x)*(t.y-i.y)/(n.y-i.y)+i.x&&(e=!e)}return e}u(Zd,"multiPolygonContainsPoint");function jr(o,t){let e=!1;for(let r=0,i=o.length-1;r<o.length;i=r++){let n=o[r],a=o[i];n.y>t.y!=a.y>t.y&&t.x<(a.x-n.x)*(t.y-n.y)/(a.y-n.y)+n.x&&(e=!e)}return e}u(jr,"polygonContainsPoint");function $d(o,t,e,r,i){for(let a of o)if(t<=a.x&&e<=a.y&&r>=a.x&&i>=a.y)return!0;let n=[new Hi.default(t,e),new Hi.default(t,i),new Hi.default(r,i),new Hi.default(r,e)];if(o.length>2){for(let a of n)if(jr(o,a))return!0}for(let a=0;a<o.length-1;a++){let s=o[a],l=o[a+1];if(Hb(s,l,n))return!0}return!1}u($d,"polygonIntersectsBox");function Hb(o,t,e){let r=e[0],i=e[2];if(o.x<r.x&&t.x<r.x||o.x>i.x&&t.x>i.x||o.y<r.y&&t.y<r.y||o.y>i.y&&t.y>i.y)return!1;let n=wt(o,t,e[0]);return n!==wt(o,t,e[1])||n!==wt(o,t,e[2])||n!==wt(o,t,e[3])}u(Hb,"edgeIntersectsBox");m();var Ho=re(fe(),1);function yr(o,t,e){let r=t.paint.get(o).value;return r.kind==="constant"?r.value:e.programConfigurations.get(t.id).getMaxValue(o)}u(yr,"getMaximumPaintValue");function Zt(o){return Math.sqrt(o[0]*o[0]+o[1]*o[1])}u(Zt,"translateDistance");function Ht(o,t,e,r,i){if(!t[0]&&!t[1])return o;let n=Ho.default.convert(t)._mult(i);e==="viewport"&&n._rotate(-r);let a=[];for(let s=0;s<o.length;s++){let l=o[s];a.push(l.sub(n))}return a}u(Ht,"translate");function Xd(o,t){let e=[];for(let r=0;r<o.length;r++){let i=o[r],n=[];for(let a=0;a<i.length;a++){let s=i[a-1],l=i[a],c=i[a+1],p=a===0?new Ho.default(0,0):l.sub(s)._unit()._perp(),h=a===i.length-1?new Ho.default(0,0):c.sub(l)._unit()._perp(),f=p._add(h)._unit(),d=f.x*h.x+f.y*h.y;d!==0&&f._mult(1/d),n.push(f._mult(t)._add(l))}e.push(n)}return e}u(Xd,"offsetLine");m();var Jd,Kb=u(()=>Jd=Jd||new Pe({"circle-sort-key":new Z(T.layout_circle["circle-sort-key"])}),"getLayout"),Yd,$b=u(()=>Yd=Yd||new Pe({"circle-radius":new Z(T.paint_circle["circle-radius"]),"circle-color":new Z(T.paint_circle["circle-color"]),"circle-blur":new Z(T.paint_circle["circle-blur"]),"circle-opacity":new Z(T.paint_circle["circle-opacity"]),"circle-translate":new j(T.paint_circle["circle-translate"]),"circle-translate-anchor":new j(T.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new j(T.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new j(T.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new Z(T.paint_circle["circle-stroke-width"]),"circle-stroke-color":new Z(T.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new Z(T.paint_circle["circle-stroke-opacity"])}),"getPaint"),Qd={get paint(){return $b()},get layout(){return Kb()}};var ey=re(fe(),1);var Lc=class Lc extends Ce{constructor(e){super(e,Qd)}createBucket(e){return new dr(e)}queryRadius(e){let r=e;return yr("circle-radius",this,r)+yr("circle-stroke-width",this,r)+Zt(this.paint.get("circle-translate"))}queryIntersectsFeature(e,r,i,n,a,s,l,c){let p=Ht(e,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),s.angle,l),h=this.paint.get("circle-radius").evaluate(r,i),f=this.paint.get("circle-stroke-width").evaluate(r,i),d=h+f,g=this.paint.get("circle-pitch-alignment")==="map",y=g?p:Xb(p,c),_=g?d*l:d;for(let w of n)for(let v of w){let b=g?v:ty(v,c),P=_,S=ke.transformMat4([],[v.x,v.y,0,1],c);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?P*=S[3]/s.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(P*=s.cameraToCenterDistance/S[3]),Hd(y,b,P))return!0}return!1}};u(Lc,"CircleStyleLayer");var Wo=Lc;function ty(o,t){let e=ke.transformMat4([],[o.x,o.y,0,1],t);return new ey.default(e[0]/e[3],e[1]/e[3])}u(ty,"projectPoint");function Xb(o,t){return o.map(e=>ty(e,t))}u(Xb,"projectQueryGeometry");m();m();var Dc=class Dc extends dr{};u(Dc,"HeatmapBucket");var Wi=Dc;V("HeatmapBucket",Wi,{omit:["layers"]});m();var ry,Jb=u(()=>ry=ry||new Pe({"heatmap-radius":new Z(T.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Z(T.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new j(T.paint_heatmap["heatmap-intensity"]),"heatmap-color":new cr(T.paint_heatmap["heatmap-color"]),"heatmap-opacity":new j(T.paint_heatmap["heatmap-opacity"])}),"getPaint"),iy={get paint(){return Jb()}};m();m();function kc(o,{width:t,height:e},r,i){if(!i)i=new Uint8Array(t*e*r);else if(i instanceof Uint8ClampedArray)i=new Uint8Array(i.buffer);else if(i.length!==t*e*r)throw new RangeError("mismatched image size. expected: ".concat(i.length," but got: ").concat(t*e*r));return o.width=t,o.height=e,o.data=i,o}u(kc,"createImage");function ny(o,{width:t,height:e},r){if(t===o.width&&e===o.height)return;let i=kc({},{width:t,height:e},r);Fc(o,i,{x:0,y:0},{x:0,y:0},{width:Math.min(o.width,t),height:Math.min(o.height,e)},r),o.width=t,o.height=e,o.data=i.data}u(ny,"resizeImage");function Fc(o,t,e,r,i,n){if(i.width===0||i.height===0)return t;if(i.width>o.width||i.height>o.height||e.x>o.width-i.width||e.y>o.height-i.height)throw new RangeError("out of range source coordinates for image copy");if(i.width>t.width||i.height>t.height||r.x>t.width-i.width||r.y>t.height-i.height)throw new RangeError("out of range destination coordinates for image copy");let a=o.data,s=t.data;if(a===s)throw new Error("srcData equals dstData, so image is already copied");for(let l=0;l<i.height;l++){let c=((e.y+l)*o.width+e.x)*n,p=((r.y+l)*t.width+r.x)*n;for(let h=0;h<i.width*n;h++)s[p+h]=a[c+h]}return t}u(Fc,"copyImage");var Ko=class Ko{constructor(t,e){kc(this,t,1,e)}resize(t){ny(this,t,1)}clone(){return new Ko({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,e,r,i,n){Fc(t,e,r,i,n,1)}};u(Ko,"AlphaImage");var gr=Ko,$o=class $o{constructor(t,e){kc(this,t,4,e)}resize(t){ny(this,t,4)}replace(t,e){e?this.data.set(t):t instanceof Uint8ClampedArray?this.data=new Uint8Array(t.buffer):this.data=t}clone(){return new $o({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,e,r,i,n){Fc(t,e,r,i,n,4)}};u($o,"RGBAImage");var de=$o;V("AlphaImage",gr);V("RGBAImage",de);function Xo(o){let t={},e=o.resolution||256,r=o.clips?o.clips.length:1,i=o.image||new de({width:e,height:r});if(!hd(e))throw new Error("width is not a power of 2 - ".concat(e));let n=u((a,s,l)=>{t[o.evaluationKey]=l;let c=o.expression.evaluate(t);i.data[a+s+0]=Math.floor(c.r*255/c.a),i.data[a+s+1]=Math.floor(c.g*255/c.a),i.data[a+s+2]=Math.floor(c.b*255/c.a),i.data[a+s+3]=Math.floor(c.a*255)},"renderPixel");if(o.clips)for(let a=0,s=0;a<r;++a,s+=e*4)for(let l=0,c=0;l<e;l++,c+=4){let p=l/(e-1),{start:h,end:f}=o.clips[a],d=h*(1-p)+f*p;n(s,c,d)}else for(let a=0,s=0;a<e;a++,s+=4){let l=a/(e-1);n(0,s,l)}return i}u(Xo,"renderColorRamp");var Rc=class Rc extends Ce{constructor(e){super(e,iy);this._updateColorRamp()}createBucket(e){return new Wi(e)}_handleSpecialPaintPropertyUpdate(e){e==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){let e=this._transitionablePaint._values["heatmap-color"].value.expression;this.colorRamp=Xo({expression:e,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}};u(Rc,"HeatmapStyleLayer");var Jo=Rc;m();m();var oy,Yb=u(()=>oy=oy||new Pe({"hillshade-illumination-direction":new j(T.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new j(T.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new j(T.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new j(T.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new j(T.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new j(T.paint_hillshade["hillshade-accent-color"])}),"getPaint"),ay={get paint(){return Yb()}};var zc=class zc extends Ce{constructor(e){super(e,ay)}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}};u(zc,"HillshadeStyleLayer");var Yo=zc;m();m();m();var Qb=he([{name:"a_pos",components:2,type:"Int16"}],4);var{members:sy,size:xA,alignment:bA}=Qb;var ly=re(ed(),1);m();function Ki(o,t){let e=o.length;if(e<=1)return[o];let r=[],i,n;for(let a=0;a<e;a++){let s=yd(o[a]);s!==0&&(o[a].area=Math.abs(s),n===void 0&&(n=s<0),n===s<0?(i&&r.push(i),i=[o[a]]):i.push(o[a]))}if(i&&r.push(i),t>1)for(let a=0;a<r.length;a++)r[a].length<=t||(td(r[a],t,1,r[a].length-1,ev),r[a]=r[a].slice(0,t));return r}u(Ki,"classifyRings");function ev(o,t){return t.area-o.area}u(ev,"compareAreas");m();function qr(o,t,e){let r=e.patternDependencies,i=!1;for(let n of t){let a=n.paint.get("".concat(o,"-pattern"));a.isConstant()||(i=!0);let s=a.constantOr(null);s&&(i=!0,r[s.to]=!0,r[s.from]=!0)}return i}u(qr,"hasPattern");function Zr(o,t,e,r,i){let n=i.patternDependencies;for(let a of t){let l=a.paint.get("".concat(o,"-pattern")).value;if(l.kind!=="constant"){let c=l.evaluate({zoom:r-1},e,{},i.availableImages),p=l.evaluate({zoom:r},e,{},i.availableImages),h=l.evaluate({zoom:r+1},e,{},i.availableImages);c=c&&c.name?c.name:c,p=p&&p.name?p.name:p,h=h&&h.name?h.name:h,n[c]=!0,n[p]=!0,n[h]=!0,e.patterns[a.id]={min:c,mid:p,max:h}}}return e}u(Zr,"addPatternDependencies");var tv=500,Bc=class Bc{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(e=>e.id),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new Mo,this.indexArray=new Ge,this.indexArray2=new Nt,this.programConfigurations=new Ye(t.layers,t.zoom),this.segments=new se,this.segments2=new se,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id)}populate(t,e,r){this.hasPattern=qr("fill",this.layers,e);let i=this.layers[0].layout.get("fill-sort-key"),n=!i.isConstant(),a=[];for(let{feature:s,id:l,index:c,sourceLayerIndex:p}of t){let h=this.layers[0]._featureFilter.needGeometry,f=et(s,h);if(!this.layers[0]._featureFilter.filter(new ue(this.zoom),f,r))continue;let d=n?i.evaluate(f,{},r,e.availableImages):void 0,g={id:l,properties:s.properties,type:s.type,sourceLayerIndex:p,index:c,geometry:h?f.geometry:Qe(s),patterns:{},sortKey:d};a.push(g)}n&&a.sort((s,l)=>s.sortKey-l.sortKey);for(let s of a){let{geometry:l,index:c,sourceLayerIndex:p}=s;if(this.hasPattern){let f=Zr("fill",this.layers,s,this.zoom,e);this.patternFeatures.push(f)}else this.addFeature(s,l,c,r,{});let h=t[c].feature;e.featureIndex.insert(h,l,c,p,this.index)}}update(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,r)}addFeatures(t,e,r){for(let i of this.patternFeatures)this.addFeature(i,i.geometry,i.index,e,r)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,sy),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.indexBuffer2=t.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(t),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(t,e,r,i,n){for(let a of Ki(e,tv)){let s=0;for(let d of a)s+=d.length;let l=this.segments.prepareSegment(s,this.layoutVertexArray,this.indexArray),c=l.vertexLength,p=[],h=[];for(let d of a){if(d.length===0)continue;d!==a[0]&&h.push(p.length/2);let g=this.segments2.prepareSegment(d.length,this.layoutVertexArray,this.indexArray2),y=g.vertexLength;this.layoutVertexArray.emplaceBack(d[0].x,d[0].y),this.indexArray2.emplaceBack(y+d.length-1,y),p.push(d[0].x),p.push(d[0].y);for(let _=1;_<d.length;_++)this.layoutVertexArray.emplaceBack(d[_].x,d[_].y),this.indexArray2.emplaceBack(y+_-1,y+_),p.push(d[_].x),p.push(d[_].y);g.vertexLength+=d.length,g.primitiveLength+=d.length}let f=(0,ly.default)(p,h);for(let d=0;d<f.length;d+=3)this.indexArray.emplaceBack(c+f[d],c+f[d+1],c+f[d+2]);l.vertexLength+=s,l.primitiveLength+=f.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,n,i)}};u(Bc,"FillBucket");var $i=Bc;V("FillBucket",$i,{omit:["layers","patternFeatures"]});m();var uy,rv=u(()=>uy=uy||new Pe({"fill-sort-key":new Z(T.layout_fill["fill-sort-key"])}),"getLayout"),cy,iv=u(()=>cy=cy||new Pe({"fill-antialias":new j(T.paint_fill["fill-antialias"]),"fill-opacity":new Z(T.paint_fill["fill-opacity"]),"fill-color":new Z(T.paint_fill["fill-color"]),"fill-outline-color":new Z(T.paint_fill["fill-outline-color"]),"fill-translate":new j(T.paint_fill["fill-translate"]),"fill-translate-anchor":new j(T.paint_fill["fill-translate-anchor"]),"fill-pattern":new Tt(T.paint_fill["fill-pattern"])}),"getPaint"),py={get paint(){return iv()},get layout(){return rv()}};var Oc=class Oc extends Ce{constructor(e){super(e,py)}recalculate(e,r){super.recalculate(e,r);let 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(e){return new $i(e)}queryRadius(){return Zt(this.paint.get("fill-translate"))}queryIntersectsFeature(e,r,i,n,a,s,l){let c=Ht(e,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),s.angle,l);return Zo(c,n)}isTileClipped(){return!0}};u(Oc,"FillStyleLayer");var Qo=Oc;m();m();m();var nv=he([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),hy=he([{name:"a_centroid",components:2,type:"Int16"}],4);var{members:my,size:pI,alignment:hI}=nv;var fy=re(ed(),1),dy=re(oo(),1);var ov=dy.default.VectorTileFeature.types,av=500,Vc=Math.pow(2,13);function Xi(o,t,e,r,i,n,a,s){o.emplaceBack(t,e,Math.floor(r*Vc)*2+a,i*Vc*2,n*Vc*2,Math.round(s))}u(Xi,"addVertex");var Uc=class Uc{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(e=>e.id),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new Lo,this.centroidVertexArray=new Gt,this.indexArray=new Ge,this.programConfigurations=new Ye(t.layers,t.zoom),this.segments=new se,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id)}populate(t,e,r){this.features=[],this.hasPattern=qr("fill-extrusion",this.layers,e);for(let{feature:i,id:n,index:a,sourceLayerIndex:s}of t){let l=this.layers[0]._featureFilter.needGeometry,c=et(i,l);if(!this.layers[0]._featureFilter.filter(new ue(this.zoom),c,r))continue;let p={id:n,sourceLayerIndex:s,index:a,geometry:l?c.geometry:Qe(i),properties:i.properties,type:i.type,patterns:{}};this.hasPattern?this.features.push(Zr("fill-extrusion",this.layers,p,this.zoom,e)):this.addFeature(p,p.geometry,a,r,{}),e.featureIndex.insert(i,p.geometry,a,s,this.index,!0)}}addFeatures(t,e,r){for(let i of this.features){let{geometry:n}=i;this.addFeature(i,n,i.index,e,r)}}update(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,r)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,my),this.centroidVertexBuffer=t.createVertexBuffer(this.centroidVertexArray,hy.members,!0),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(t,e,r,i,n){let a={x:0,y:0,vertexCount:0};for(let s of Ki(e,av)){let l=0;for(let g of s)l+=g.length;let c=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(let g of s){if(g.length===0||lv(g))continue;let y=0;for(let _=0;_<g.length;_++){let w=g[_];if(_>=1){let v=g[_-1];if(!sv(w,v)){c.vertexLength+4>se.MAX_VERTEX_ARRAY_LENGTH&&(c=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));let b=w.sub(v)._perp()._unit(),P=v.dist(w);y+P>32768&&(y=0),Xi(this.layoutVertexArray,w.x,w.y,b.x,b.y,0,0,y),Xi(this.layoutVertexArray,w.x,w.y,b.x,b.y,0,1,y),a.x+=2*w.x,a.y+=2*w.y,a.vertexCount+=2,y+=P,Xi(this.layoutVertexArray,v.x,v.y,b.x,b.y,0,0,y),Xi(this.layoutVertexArray,v.x,v.y,b.x,b.y,0,1,y),a.x+=2*v.x,a.y+=2*v.y,a.vertexCount+=2;let S=c.vertexLength;this.indexArray.emplaceBack(S,S+2,S+1),this.indexArray.emplaceBack(S+1,S+2,S+3),c.vertexLength+=4,c.primitiveLength+=2}}}}if(c.vertexLength+l>se.MAX_VERTEX_ARRAY_LENGTH&&(c=this.segments.prepareSegment(l,this.layoutVertexArray,this.indexArray)),ov[t.type]!=="Polygon")continue;let p=[],h=[],f=c.vertexLength;for(let g of s)if(g.length!==0){g!==s[0]&&h.push(p.length/2);for(let y=0;y<g.length;y++){let _=g[y];Xi(this.layoutVertexArray,_.x,_.y,0,0,1,1,0),a.x+=_.x,a.y+=_.y,a.vertexCount+=1,p.push(_.x),p.push(_.y)}}let d=(0,fy.default)(p,h);for(let g=0;g<d.length;g+=3)this.indexArray.emplaceBack(f+d[g],f+d[g+2],f+d[g+1]);c.primitiveLength+=d.length/3,c.vertexLength+=l}for(let s=0;s<a.vertexCount;s++)this.centroidVertexArray.emplaceBack(Math.floor(a.x/a.vertexCount),Math.floor(a.y/a.vertexCount));this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,n,i)}};u(Uc,"FillExtrusionBucket");var Ji=Uc;V("FillExtrusionBucket",Ji,{omit:["layers","features"]});function sv(o,t){return o.x===t.x&&(o.x<0||o.x>8192)||o.y===t.y&&(o.y<0||o.y>8192)}u(sv,"isBoundaryEdge");function lv(o){return o.every(t=>t.x<0)||o.every(t=>t.x>8192)||o.every(t=>t.y<0)||o.every(t=>t.y>8192)}u(lv,"isEntirelyOutside");m();var yy,uv=u(()=>yy=yy||new Pe({"fill-extrusion-opacity":new j(T["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Z(T["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new j(T["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new j(T["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Tt(T["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Z(T["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Z(T["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new j(T["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])}),"getPaint"),gy={get paint(){return uv()}};var ea=re(fe(),1);var Gc=class Gc extends Ce{constructor(e){super(e,gy)}createBucket(e){return new Ji(e)}queryRadius(){return Zt(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(e,r,i,n,a,s,l,c){let p=Ht(e,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),s.angle,l),h=this.paint.get("fill-extrusion-height").evaluate(r,i),f=this.paint.get("fill-extrusion-base").evaluate(r,i),d=hv(p,c,s,0),g=pv(n,f,h,c),y=g[0],_=g[1];return cv(y,_,d)}};u(Gc,"FillExtrusionStyleLayer");var ta=Gc;function Yi(o,t){return o.x*t.x+o.y*t.y}u(Yi,"dot");function _y(o,t){if(o.length===1){let e=0,r=t[e++],i;for(;!i||r.equals(i);)if(i=t[e++],!i)return 1/0;for(;e<t.length;e++){let n=t[e],a=o[0],s=i.sub(r),l=n.sub(r),c=a.sub(r),p=Yi(s,s),h=Yi(s,l),f=Yi(l,l),d=Yi(c,s),g=Yi(c,l),y=p*f-h*h,_=(f*d-h*g)/y,w=(p*g-h*d)/y,v=1-_-w,b=r.z*v+i.z*_+n.z*w;if(isFinite(b))return b}return 1/0}else{let e=1/0;for(let r of t)e=Math.min(e,r.z);return e}}u(_y,"getIntersectionDistance");function cv(o,t,e){let r=1/0;Zo(e,t)&&(r=_y(e,t[0]));for(let i=0;i<t.length;i++){let n=t[i],a=o[i];for(let s=0;s<n.length-1;s++){let l=n[s],c=n[s+1],p=a[s],h=a[s+1],f=[l,c,h,p,l];qo(e,f)&&(r=Math.min(r,_y(e,f)))}}return r===1/0?!1:r}u(cv,"checkIntersection");function pv(o,t,e,r){let i=[],n=[],a=r[8]*t,s=r[9]*t,l=r[10]*t,c=r[11]*t,p=r[8]*e,h=r[9]*e,f=r[10]*e,d=r[11]*e;for(let g of o){let y=[],_=[];for(let w of g){let v=w.x,b=w.y,P=r[0]*v+r[4]*b+r[12],S=r[1]*v+r[5]*b+r[13],A=r[2]*v+r[6]*b+r[14],L=r[3]*v+r[7]*b+r[15],D=P+a,k=S+s,E=A+l,U=L+c,F=P+p,M=S+h,N=A+f,z=L+d,W=new ea.default(D/U,k/U);W.z=E/U,y.push(W);let te=new ea.default(F/z,M/z);te.z=N/z,_.push(te)}i.push(y),n.push(_)}return[i,n]}u(pv,"projectExtrusion");function hv(o,t,e,r){let i=[];for(let n of o){let a=[n.x,n.y,r,1];ke.transformMat4(a,a,t),i.push(new ea.default(a[0]/a[3],a[1]/a[3]))}return i}u(hv,"projectQueryGeometry");m();m();m();var mv=he([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:xy,size:JI,alignment:YI}=mv;m();var fv=he([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:by,size:r2,alignment:i2}=fv;var Py=re(oo(),1);var dv=Py.default.VectorTileFeature.types,vy=63,yv=Math.cos(75/2*(Math.PI/180)),gv=15,_v=20,xv=15,Sy=1/2,wy=Math.pow(2,xv-1)/Sy,Nc=class Nc{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(e=>e.id),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(e=>{this.gradients[e.id]={}}),this.layoutVertexArray=new Do,this.layoutVertexArray2=new ko,this.indexArray=new Ge,this.programConfigurations=new Ye(t.layers,t.zoom),this.segments=new se,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id)}populate(t,e,r){this.hasPattern=qr("line",this.layers,e);let i=this.layers[0].layout.get("line-sort-key"),n=!i.isConstant(),a=[];for(let{feature:s,id:l,index:c,sourceLayerIndex:p}of t){let h=this.layers[0]._featureFilter.needGeometry,f=et(s,h);if(!this.layers[0]._featureFilter.filter(new ue(this.zoom),f,r))continue;let d=n?i.evaluate(f,{},r):void 0,g={id:l,properties:s.properties,type:s.type,sourceLayerIndex:p,index:c,geometry:h?f.geometry:Qe(s),patterns:{},sortKey:d};a.push(g)}n&&a.sort((s,l)=>s.sortKey-l.sortKey);for(let s of a){let{geometry:l,index:c,sourceLayerIndex:p}=s;if(this.hasPattern){let f=Zr("line",this.layers,s,this.zoom,e);this.patternFeatures.push(f)}else this.addFeature(s,l,c,r,{});let h=t[c].feature;e.featureIndex.insert(h,l,c,p,this.index)}}update(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,r)}addFeatures(t,e,r){for(let i of this.patternFeatures)this.addFeature(i,i.geometry,i.index,e,r)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=t.createVertexBuffer(this.layoutVertexArray2,by)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,xy),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(t){if(t.properties&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_end")){let e=+t.properties.mapbox_clip_start,r=+t.properties.mapbox_clip_end;return{start:e,end:r}}}addFeature(t,e,r,i,n){let a=this.layers[0].layout,s=a.get("line-join").evaluate(t,{}),l=a.get("line-cap"),c=a.get("line-miter-limit"),p=a.get("line-round-limit");this.lineClips=this.lineFeatureClips(t);for(let h of e)this.addLine(h,t,s,l,c,p);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,n,i)}addLine(t,e,r,i,n,a){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let w=0;w<t.length-1;w++)this.totalDistance+=t[w].dist(t[w+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}let s=dv[e.type]==="Polygon",l=t.length;for(;l>=2&&t[l-1].equals(t[l-2]);)l--;let c=0;for(;c<l-1&&t[c].equals(t[c+1]);)c++;if(l<(s?3:2))return;r==="bevel"&&(n=1.05);let p=this.overscaling<=16?gv*8192/(512*this.overscaling):0,h=this.segments.prepareSegment(l*10,this.layoutVertexArray,this.indexArray),f,d,g,y,_;this.e1=this.e2=-1,s&&(f=t[l-2],_=t[c].sub(f)._unit()._perp());for(let w=c;w<l;w++){if(g=w===l-1?s?t[c+1]:void 0:t[w+1],g&&t[w].equals(g))continue;_&&(y=_),f&&(d=f),f=t[w],_=g?g.sub(f)._unit()._perp():y,y=y||_;let v=y.add(_);(v.x!==0||v.y!==0)&&v._unit();let b=y.x*_.x+y.y*_.y,P=v.x*_.x+v.y*_.y,S=P!==0?1/P:1/0,A=2*Math.sqrt(2-2*P),L=P<yv&&d&&g,D=y.x*_.y-y.y*_.x>0;if(L&&w>c){let U=f.dist(d);if(U>2*p){let F=f.sub(f.sub(d)._mult(p/U)._round());this.updateDistance(d,F),this.addCurrentVertex(F,y,0,0,h),d=F}}let k=d&&g,E=k?r:s?"butt":i;if(k&&E==="round"&&(S<a?E="miter":S<=2&&(E="fakeround")),E==="miter"&&S>n&&(E="bevel"),E==="bevel"&&(S>2&&(E="flipbevel"),S<n&&(E="miter")),d&&this.updateDistance(d,f),E==="miter")v._mult(S),this.addCurrentVertex(f,v,0,0,h);else if(E==="flipbevel"){if(S>100)v=_.mult(-1);else{let U=S*y.add(_).mag()/y.sub(_).mag();v._perp()._mult(U*(D?-1:1))}this.addCurrentVertex(f,v,0,0,h),this.addCurrentVertex(f,v.mult(-1),0,0,h)}else if(E==="bevel"||E==="fakeround"){let U=-Math.sqrt(S*S-1),F=D?U:0,M=D?0:U;if(d&&this.addCurrentVertex(f,y,F,M,h),E==="fakeround"){let N=Math.round(A*180/Math.PI/_v);for(let z=1;z<N;z++){let W=z/N;if(W!==.5){let K=W-.5,H=1.0904+b*(-3.2452+b*(3.55645-b*1.43519)),ze=.848013+b*(-1.06021+b*.215638);W=W+W*K*(W-1)*(H*K*K+ze)}let te=_.sub(y)._mult(W)._add(y)._unit()._mult(D?-1:1);this.addHalfVertex(f,te.x,te.y,!1,D,0,h)}}g&&this.addCurrentVertex(f,_,-F,-M,h)}else if(E==="butt")this.addCurrentVertex(f,v,0,0,h);else if(E==="square"){let U=d?1:-1;this.addCurrentVertex(f,v,U,U,h)}else E==="round"&&(d&&(this.addCurrentVertex(f,y,0,0,h),this.addCurrentVertex(f,y,1,1,h,!0)),g&&(this.addCurrentVertex(f,_,-1,-1,h,!0),this.addCurrentVertex(f,_,0,0,h)));if(L&&w<l-1){let U=f.dist(g);if(U>2*p){let F=f.add(g.sub(f)._mult(p/U)._round());this.updateDistance(f,F),this.addCurrentVertex(F,_,0,0,h),f=F}}}}addCurrentVertex(t,e,r,i,n,a=!1){let s=e.x+e.y*r,l=e.y-e.x*r,c=-e.x+e.y*i,p=-e.y-e.x*i;this.addHalfVertex(t,s,l,a,!1,r,n),this.addHalfVertex(t,c,p,a,!0,-i,n),this.distance>wy/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(t,e,r,i,n,a))}addHalfVertex({x:t,y:e},r,i,n,a,s,l){let p=(this.lineClips?this.scaledDistance*(wy-1):this.scaledDistance)*Sy;if(this.layoutVertexArray.emplaceBack((t<<1)+(n?1:0),(e<<1)+(a?1:0),Math.round(vy*r)+128,Math.round(vy*i)+128,(s===0?0:s<0?-1:1)+1|(p&63)<<2,p>>6),this.lineClips){let f=this.scaledDistance-this.lineClips.start,d=this.lineClips.end-this.lineClips.start,g=f/d;this.layoutVertexArray2.emplaceBack(g,this.lineClipsArray.length)}let h=l.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,h),l.primitiveLength++),a?this.e2=h:this.e1=h}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(t,e){this.distance+=t.dist(e),this.updateScaledDistance()}};u(Nc,"LineBucket");var Qi=Nc;V("LineBucket",Qi,{omit:["layers","patternFeatures"]});m();var Ty,bv=u(()=>Ty=Ty||new Pe({"line-cap":new j(T.layout_line["line-cap"]),"line-join":new Z(T.layout_line["line-join"]),"line-miter-limit":new j(T.layout_line["line-miter-limit"]),"line-round-limit":new j(T.layout_line["line-round-limit"]),"line-sort-key":new Z(T.layout_line["line-sort-key"])}),"getLayout"),Ay,vv=u(()=>Ay=Ay||new Pe({"line-opacity":new Z(T.paint_line["line-opacity"]),"line-color":new Z(T.paint_line["line-color"]),"line-translate":new j(T.paint_line["line-translate"]),"line-translate-anchor":new j(T.paint_line["line-translate-anchor"]),"line-width":new Z(T.paint_line["line-width"]),"line-gap-width":new Z(T.paint_line["line-gap-width"]),"line-offset":new Z(T.paint_line["line-offset"]),"line-blur":new Z(T.paint_line["line-blur"]),"line-dasharray":new ur(T.paint_line["line-dasharray"]),"line-pattern":new Tt(T.paint_line["line-pattern"]),"line-gradient":new cr(T.paint_line["line-gradient"])}),"getPaint"),jc={get paint(){return vv()},get layout(){return bv()}};var Zc=class Zc extends Z{possiblyEvaluate(e,r){return r=new ue(Math.floor(r.zoom),{now:r.now,fadeDuration:r.fadeDuration,zoomHistory:r.zoomHistory,transition:r.transition}),super.possiblyEvaluate(e,r)}evaluate(e,r,i,n){return r=B({},r,{zoom:Math.floor(r.zoom)}),super.evaluate(e,r,i,n)}};u(Zc,"LineFloorwidthProperty");var qc=Zc,ra,Hc=class Hc extends Ce{constructor(e){super(e,jc);this.gradientVersion=0,ra||(ra=new qc(jc.paint.properties["line-width"].specification),ra.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(e){if(e==="line-gradient"){let r=this.gradientExpression();to(r)?this.stepInterpolant=r._styleExpression.expression instanceof Hf:this.stepInterpolant=!1,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(e,r){super.recalculate(e,r),this.paint._values["line-floorwidth"]=ra.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}createBucket(e){return new Qi(e)}queryRadius(e){let r=e,i=Iy(yr("line-width",this,r),yr("line-gap-width",this,r)),n=yr("line-offset",this,r);return i/2+Math.abs(n)+Zt(this.paint.get("line-translate"))}queryIntersectsFeature(e,r,i,n,a,s,l){let c=Ht(e,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),s.angle,l),p=l/2*Iy(this.paint.get("line-width").evaluate(r,i),this.paint.get("line-gap-width").evaluate(r,i)),h=this.paint.get("line-offset").evaluate(r,i);return h&&(n=Xd(n,h*l)),Wd(c,n,p)}isTileClipped(){return!0}};u(Hc,"LineStyleLayer");var ia=Hc;function Iy(o,t){return t>0?t+2*o:o}u(Iy,"getLineWidth");m();m();m();var Cy=he([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Ey=he([{name:"a_projected_pos",components:3,type:"Float32"}],4),W2=he([{name:"a_fade_opacity",components:1,type:"Uint32"}],4),My=he([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]),K2=he([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]),Wc=he([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),Ly=he([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4),$2=he([{name:"triangle",components:3,type:"Uint16"}]),X2=he([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"}]),J2=he([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Uint16",name:"textAnchorOffsetStartIndex"},{type:"Uint16",name:"textAnchorOffsetEndIndex"}]),Y2=he([{type:"Float32",name:"offsetX"}]),Q2=he([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),eC=he([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);var tn=re(fe(),1);m();function wv(o,t,e){let r=t.layout.get("text-transform").evaluate(e,{});return r==="uppercase"?o=o.toLocaleUpperCase():r==="lowercase"&&(o=o.toLocaleLowerCase()),St.applyArabicShaping&&(o=St.applyArabicShaping(o)),o}u(wv,"transformTextInternal");function Dy(o,t,e){return o.sections.forEach(r=>{r.text=wv(r.text,t,e)}),o}u(Dy,"transformText");m();function ky(o){let t={},e={},r=[],i=0;function n(c){r.push(o[c]),i++}u(n,"add");function a(c,p,h){let f=e[c];return delete e[c],e[p]=f,r[f].geometry[0].pop(),r[f].geometry[0]=r[f].geometry[0].concat(h[0]),f}u(a,"mergeFromRight");function s(c,p,h){let f=t[p];return delete t[p],t[c]=f,r[f].geometry[0].shift(),r[f].geometry[0]=h[0].concat(r[f].geometry[0]),f}u(s,"mergeFromLeft");function l(c,p,h){let f=h?p[0][p[0].length-1]:p[0][0];return"".concat(c,":").concat(f.x,":").concat(f.y)}u(l,"getKey");for(let c=0;c<o.length;c++){let p=o[c],h=p.geometry,f=p.text?p.text.toString():null;if(!f){n(c);continue}let d=l(f,h),g=l(f,h,!0);if(d in e&&g in t&&e[d]!==t[g]){let y=s(d,g,h),_=a(d,g,r[y].geometry);delete t[d],delete e[g],e[l(f,r[_].geometry,!0)]=_,r[y].geometry=null}else d in e?a(d,g,h):g in t?s(d,g,h):(n(c),t[d]=i-1,e[g]=i-1)}return r.filter(c=>c.geometry)}u(ky,"mergeLines");m();m();var Fy={"!":"\uFE15","#":"\uFF03",$:"\uFF04","%":"\uFF05","&":"\uFF06","(":"\uFE35",")":"\uFE36","*":"\uFF0A","+":"\uFF0B",",":"\uFE10","-":"\uFE32",".":"\u30FB","/":"\uFF0F",":":"\uFE13",";":"\uFE14","<":"\uFE3F","=":"\uFF1D",">":"\uFE40","?":"\uFE16","@":"\uFF20","[":"\uFE47","\\":"\uFF3C","]":"\uFE48","^":"\uFF3E",_:"\uFE33","`":"\uFF40","{":"\uFE37","|":"\u2015","}":"\uFE38","~":"\uFF5E","\xA2":"\uFFE0","\xA3":"\uFFE1","\xA5":"\uFFE5","\xA6":"\uFFE4","\xAC":"\uFFE2","\xAF":"\uFFE3","\u2013":"\uFE32","\u2014":"\uFE31","\u2018":"\uFE43","\u2019":"\uFE44","\u201C":"\uFE41","\u201D":"\uFE42","\u2026":"\uFE19","\u2027":"\u30FB","\u20A9":"\uFFE6","\u3001":"\uFE11","\u3002":"\uFE12","\u3008":"\uFE3F","\u3009":"\uFE40","\u300A":"\uFE3D","\u300B":"\uFE3E","\u300C":"\uFE41","\u300D":"\uFE42","\u300E":"\uFE43","\u300F":"\uFE44","\u3010":"\uFE3B","\u3011":"\uFE3C","\u3014":"\uFE39","\u3015":"\uFE3A","\u3016":"\uFE17","\u3017":"\uFE18","\uFF01":"\uFE15","\uFF08":"\uFE35","\uFF09":"\uFE36","\uFF0C":"\uFE10","\uFF0D":"\uFE32","\uFF0E":"\u30FB","\uFF1A":"\uFE13","\uFF1B":"\uFE14","\uFF1C":"\uFE3F","\uFF1E":"\uFE40","\uFF1F":"\uFE16","\uFF3B":"\uFE47","\uFF3D":"\uFE48","\uFF3F":"\uFE33","\uFF5B":"\uFE37","\uFF5C":"\u2015","\uFF5D":"\uFE38","\uFF5F":"\uFE35","\uFF60":"\uFE36","\uFF61":"\uFE12","\uFF62":"\uFE41","\uFF63":"\uFE42"};m();var Wt=24;m();var zy=re(rd(),1);var Ry=3;function Pv(o,t,e){o===1&&e.readMessage(Sv,t)}u(Pv,"readFontstacks");function Sv(o,t,e){if(o===3){let{id:r,bitmap:i,width:n,height:a,left:s,top:l,advance:c}=e.readMessage(Tv,{});t.push({id:r,bitmap:new gr({width:n+2*Ry,height:a+2*Ry},i),metrics:{width:n,height:a,left:s,top:l,advance:c}})}}u(Sv,"readFontstack");function Tv(o,t,e){o===1?t.id=e.readVarint():o===2?t.bitmap=e.readBytes():o===3?t.width=e.readVarint():o===4?t.height=e.readVarint():o===5?t.left=e.readSVarint():o===6?t.top=e.readSVarint():o===7&&(t.advance=e.readVarint())}u(Tv,"readGlyph");function By(o){return new zy.default(o).readFields(Pv,[])}u(By,"parseGlyphPbf");m();var tt=1;var $c=class $c{constructor(t,{pixelRatio:e,version:r,stretchX:i,stretchY:n,content:a}){this.paddedRect=t,this.pixelRatio=e,this.stretchX=i,this.stretchY=n,this.content=a,this.version=r}get tl(){return[this.paddedRect.x+tt,this.paddedRect.y+tt]}get br(){return[this.paddedRect.x+this.paddedRect.w-tt,this.paddedRect.y+this.paddedRect.h-tt]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-tt*2)/this.pixelRatio,(this.paddedRect.h-tt*2)/this.pixelRatio]}};u($c,"ImagePosition");var Hr=$c,Xc=class Xc{constructor(t,e){let r={},i={};this.haveRenderCallbacks=[];let n=[];this.addImages(t,r,n),this.addImages(e,i,n);let{w:a,h:s}=ao(n),l=new de({width:a||1,height:s||1});for(let c in t){let p=t[c],h=r[c].paddedRect;de.copy(p.data,l,{x:0,y:0},{x:h.x+tt,y:h.y+tt},p.data)}for(let c in e){let p=e[c],h=i[c].paddedRect,f=h.x+tt,d=h.y+tt,g=p.data.width,y=p.data.height;de.copy(p.data,l,{x:0,y:0},{x:f,y:d},p.data),de.copy(p.data,l,{x:0,y:y-1},{x:f,y:d-1},{width:g,height:1}),de.copy(p.data,l,{x:0,y:0},{x:f,y:d+y},{width:g,height:1}),de.copy(p.data,l,{x:g-1,y:0},{x:f-1,y:d},{width:1,height:y}),de.copy(p.data,l,{x:0,y:0},{x:f+g,y:d},{width:1,height:y})}this.image=l,this.iconPositions=r,this.patternPositions=i}addImages(t,e,r){for(let i in t){let n=t[i],a={x:0,y:0,w:n.data.width+2*tt,h:n.data.height+2*tt};r.push(a),e[i]=new Hr(a,n),n.hasRenderCallback&&this.haveRenderCallbacks.push(i)}}patchUpdatedImages(t,e){t.dispatchRenderCallbacks(this.haveRenderCallbacks);for(let r in t.updatedImages)this.patchUpdatedImage(this.iconPositions[r],t.getImage(r),e),this.patchUpdatedImage(this.patternPositions[r],t.getImage(r),e)}patchUpdatedImage(t,e,r){if(!t||!e||t.version===e.version)return;t.version=e.version;let[i,n]=t.tl;r.update(e.data,void 0,{x:i,y:n})}};u(Xc,"ImageAtlas");var Kc=Xc;V("ImagePosition",Hr);V("ImageAtlas",Kc);var _r=(i=>(i[i.none=0]="none",i[i.horizontal=1]="horizontal",i[i.vertical=2]="vertical",i[i.horizontalOnly=3]="horizontalOnly",i))(_r||{});function na(o){let t=.5,e=.5;switch(o){case"right":case"top-right":case"bottom-right":t=1;break;case"left":case"top-left":case"bottom-left":t=0;break}switch(o){case"bottom":case"bottom-right":case"bottom-left":e=1;break;case"top":case"top-right":case"top-left":e=0;break}return{horizontalAlign:t,verticalAlign:e}}u(na,"getAnchorAlignment");var Uy=re(oo(),1);m();var Oy=255,en=128,oa=Oy*en;function Jc(o,t){let{expression:e}=t;if(e.kind==="constant")return{kind:"constant",layoutSize:e.evaluate(new ue(o+1))};if(e.kind==="source")return{kind:"source"};{let{zoomStops:r,interpolationType:i}=e,n=0;for(;n<r.length&&r[n]<=o;)n++;n=Math.max(0,n-1);let a=n;for(;a<r.length&&r[a]<o+1;)a++;a=Math.min(r.length-1,a);let s=r[n],l=r[a];if(e.kind==="composite")return{kind:"composite",minZoom:s,maxZoom:l,interpolationType:i};let c=e.evaluate(new ue(s)),p=e.evaluate(new ue(l));return{kind:"camera",minZoom:s,maxZoom:l,minSize:c,maxSize:p,interpolationType:i}}}u(Jc,"getSizeData");function Wr(o,{uSize:t,uSizeT:e},{lowerSize:r,upperSize:i}){return o.kind==="source"?r/en:o.kind==="composite"?we.number(r/en,i/en,e):t}u(Wr,"evaluateSizeForFeature");function xr(o,t){let e=0,r=0;if(o.kind==="constant")r=o.layoutSize;else if(o.kind!=="source"){let{interpolationType:i,minZoom:n,maxZoom:a}=o,s=i?ge(Wf.interpolationFactor(i,t,n,a),0,1):0;o.kind==="camera"?r=we.number(o.minSize,o.maxSize,s):e=s}return{uSizeT:e,uSize:r}}u(xr,"evaluateSizeForZoom");m();function Kr(o,t,e){let r="never",i=o.get(t);return i?r=i:o.get(e)&&(r="always"),r}u(Kr,"getOverlapMode");var Iv=Uy.default.VectorTileFeature.types,Cv=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function aa(o,t,e,r,i,n,a,s,l,c,p,h,f){let d=s?Math.min(oa,Math.round(s[0])):0,g=s?Math.min(oa,Math.round(s[1])):0;o.emplaceBack(t,e,Math.round(r*32),Math.round(i*32),n,a,(d<<1)+(l?1:0),g,c*16,p*16,h*256,f*256)}u(aa,"addVertex");function br(o,t,e){o.emplaceBack(t.x,t.y,e),o.emplaceBack(t.x,t.y,e),o.emplaceBack(t.x,t.y,e),o.emplaceBack(t.x,t.y,e)}u(br,"addDynamicAttributes");function Ev(o){for(let t of o.sections)if(zd(t.text))return!0;return!1}u(Ev,"containsRTLText");var Yc=class Yc{constructor(t){this.layoutVertexArray=new Fo,this.indexArray=new Ge,this.programConfigurations=t,this.segments=new se,this.dynamicLayoutVertexArray=new Ro,this.opacityVertexArray=new zo,this.hasVisibleVertices=!1,this.placedSymbolArray=new zi}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(t,e,r,i){this.isEmpty()||(r&&(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Cy.members),this.indexBuffer=t.createIndexBuffer(this.indexArray,e),this.dynamicLayoutVertexBuffer=t.createVertexBuffer(this.dynamicLayoutVertexArray,Ey.members,!0),this.opacityVertexBuffer=t.createVertexBuffer(this.opacityVertexArray,Cv,!0),this.opacityVertexBuffer.itemSize=1),(r||i)&&this.programConfigurations.upload(t))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}};u(Yc,"SymbolBuffers");var rn=Yc;V("SymbolBuffers",rn);var Qc=class Qc{constructor(t,e,r){this.layoutVertexArray=new t,this.layoutAttributes=e,this.indexArray=new r,this.segments=new se,this.collisionVertexArray=new Oo}upload(t){this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=t.createVertexBuffer(this.collisionVertexArray,My.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}};u(Qc,"CollisionBuffers");var nn=Qc;V("CollisionBuffers",nn);var ep=class ep{constructor(t){this.collisionBoxArray=t.collisionBoxArray,this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(l=>l.id),this.index=t.index,this.pixelRatio=t.pixelRatio,this.sourceLayerIndex=t.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=G.identity([]),this.placementViewportMatrix=G.identity([]);let r=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Jc(this.zoom,r["text-size"]),this.iconSizeData=Jc(this.zoom,r["icon-size"]);let i=this.layers[0].layout,n=i.get("symbol-sort-key"),a=i.get("symbol-z-order");this.canOverlap=Kr(i,"text-overlap","text-allow-overlap")!=="never"||Kr(i,"icon-overlap","icon-allow-overlap")!=="never"||i.get("text-ignore-placement")||i.get("icon-ignore-placement"),this.sortFeaturesByKey=a!=="viewport-y"&&!n.isConstant();let s=a==="viewport-y"||a==="auto"&&!this.sortFeaturesByKey;this.sortFeaturesByY=s&&this.canOverlap,i.get("symbol-placement")==="point"&&(this.writingModes=i.get("text-writing-mode").map(l=>_r[l])),this.stateDependentLayerIds=this.layers.filter(l=>l.isStateDependent()).map(l=>l.id),this.sourceID=t.sourceID}createArrays(){this.text=new rn(new Ye(this.layers,this.zoom,t=>/^text/.test(t))),this.icon=new rn(new Ye(this.layers,this.zoom,t=>/^icon/.test(t))),this.glyphOffsetArray=new Oi,this.lineVertexArray=new Vi,this.symbolInstances=new Bi,this.textAnchorOffsets=new Ui}calculateGlyphDependencies(t,e,r,i,n){for(let a=0;a<t.length;a++)if(e[t.charCodeAt(a)]=!0,(r||i)&&n){let s=Fy[t.charAt(a)];s&&(e[s.charCodeAt(0)]=!0)}}populate(t,e,r){let i=this.layers[0],n=i.layout,a=n.get("text-font"),s=n.get("text-field"),l=n.get("icon-image"),c=(s.value.kind!=="constant"||s.value.value instanceof ui&&!s.value.value.isEmpty()||s.value.value.toString().length>0)&&(a.value.kind!=="constant"||a.value.value.length>0),p=l.value.kind!=="constant"||!!l.value.value||Object.keys(l.parameters).length>0,h=n.get("symbol-sort-key");if(this.features=[],!c&&!p)return;let f=e.iconDependencies,d=e.glyphDependencies,g=e.availableImages,y=new ue(this.zoom);for(let{feature:_,id:w,index:v,sourceLayerIndex:b}of t){let P=i._featureFilter.needGeometry,S=et(_,P);if(!i._featureFilter.filter(y,S,r))continue;P||(S.geometry=Qe(_));let A;if(c){let E=i.getValueAndResolveTokens("text-field",S,r,g),U=ui.factory(E),F=this.hasRTLText=this.hasRTLText||Ev(U);(!F||St.getRTLTextPluginStatus()==="unavailable"||F&&St.isParsed())&&(A=Dy(U,i,S))}let L;if(p){let E=i.getValueAndResolveTokens("icon-image",S,r,g);E instanceof ci?L=E:L=ci.fromString(E)}if(!A&&!L)continue;let D=this.sortFeaturesByKey?h.evaluate(S,{},r):void 0,k={id:w,text:A,icon:L,index:v,sourceLayerIndex:b,geometry:S.geometry,properties:_.properties,type:Iv[_.type],sortKey:D};if(this.features.push(k),L&&(f[L.name]=!0),A){let E=a.evaluate(S,{},r).join(","),U=n.get("text-rotation-alignment")!=="viewport"&&n.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(2)>=0;for(let F of A.sections)if(F.image)f[F.image.name]=!0;else{let M=Nl(A.toString()),N=F.fontStack||E,z=d[N]=d[N]||{};this.calculateGlyphDependencies(F.text,z,U,this.allowVerticalPlacement,M)}}}n.get("symbol-placement")==="line"&&(this.features=ky(this.features)),this.sortFeaturesByKey&&this.features.sort((_,w)=>_.sortKey-w.sortKey)}update(t,e,r){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(t,e,this.layers,r),this.icon.programConfigurations.updatePaintArrays(t,e,this.layers,r))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(t){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(t),this.iconCollisionBox.upload(t)),this.text.upload(t,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(t,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(t,e){let r=this.lineVertexArray.length;if(t.segment!==void 0){let i=t.dist(e[t.segment+1]),n=t.dist(e[t.segment]),a={};for(let s=t.segment+1;s<e.length;s++)a[s]={x:e[s].x,y:e[s].y,tileUnitDistanceFromAnchor:i},s<e.length-1&&(i+=e[s+1].dist(e[s]));for(let s=t.segment||0;s>=0;s--)a[s]={x:e[s].x,y:e[s].y,tileUnitDistanceFromAnchor:n},s>0&&(n+=e[s-1].dist(e[s]));for(let s=0;s<e.length;s++){let l=a[s];this.lineVertexArray.emplaceBack(l.x,l.y,l.tileUnitDistanceFromAnchor)}}return{lineStartIndex:r,lineLength:this.lineVertexArray.length-r}}addSymbols(t,e,r,i,n,a,s,l,c,p,h,f){let d=t.indexArray,g=t.layoutVertexArray,y=t.segments.prepareSegment(4*e.length,g,d,this.canOverlap?a.sortKey:void 0),_=this.glyphOffsetArray.length,w=y.vertexLength,v=this.allowVerticalPlacement&&s===2?Math.PI/2:0,b=a.text&&a.text.sections;for(let P=0;P<e.length;P++){let{tl:S,tr:A,bl:L,br:D,tex:k,pixelOffsetTL:E,pixelOffsetBR:U,minFontScaleX:F,minFontScaleY:M,glyphOffset:N,isSDF:z,sectionIndex:W}=e[P],te=y.vertexLength,K=N[1];aa(g,l.x,l.y,S.x,K+S.y,k.x,k.y,r,z,E.x,E.y,F,M),aa(g,l.x,l.y,A.x,K+A.y,k.x+k.w,k.y,r,z,U.x,E.y,F,M),aa(g,l.x,l.y,L.x,K+L.y,k.x,k.y+k.h,r,z,E.x,U.y,F,M),aa(g,l.x,l.y,D.x,K+D.y,k.x+k.w,k.y+k.h,r,z,U.x,U.y,F,M),br(t.dynamicLayoutVertexArray,l,v),d.emplaceBack(te,te+1,te+2),d.emplaceBack(te+1,te+2,te+3),y.vertexLength+=4,y.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(N[0]),(P===e.length-1||W!==e[P+1].sectionIndex)&&t.programConfigurations.populatePaintArrays(g.length,a,a.index,{},f,b&&b[W])}t.placedSymbolArray.emplaceBack(l.x,l.y,_,this.glyphOffsetArray.length-_,w,c,p,l.segment,r?r[0]:0,r?r[1]:0,i[0],i[1],s,0,!1,0,h)}_addCollisionDebugVertex(t,e,r,i,n,a){return e.emplaceBack(0,0),t.emplaceBack(r.x,r.y,i,n,Math.round(a.x),Math.round(a.y))}addCollisionDebugVertices(t,e,r,i,n,a,s){let l=n.segments.prepareSegment(4,n.layoutVertexArray,n.indexArray),c=l.vertexLength,p=n.layoutVertexArray,h=n.collisionVertexArray,f=s.anchorX,d=s.anchorY;this._addCollisionDebugVertex(p,h,a,f,d,new tn.default(t,e)),this._addCollisionDebugVertex(p,h,a,f,d,new tn.default(r,e)),this._addCollisionDebugVertex(p,h,a,f,d,new tn.default(r,i)),this._addCollisionDebugVertex(p,h,a,f,d,new tn.default(t,i)),l.vertexLength+=4;let g=n.indexArray;g.emplaceBack(c,c+1),g.emplaceBack(c+1,c+2),g.emplaceBack(c+2,c+3),g.emplaceBack(c+3,c),l.primitiveLength+=4}addDebugCollisionBoxes(t,e,r,i){for(let n=t;n<e;n++){let a=this.collisionBoxArray.get(n),s=a.x1,l=a.y1,c=a.x2,p=a.y2;this.addCollisionDebugVertices(s,l,c,p,i?this.textCollisionBox:this.iconCollisionBox,a.anchorPoint,r)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new nn(Ni,Wc.members,Nt),this.iconCollisionBox=new nn(Ni,Wc.members,Nt);for(let t=0;t<this.symbolInstances.length;t++){let e=this.symbolInstances.get(t);this.addDebugCollisionBoxes(e.textBoxStartIndex,e.textBoxEndIndex,e,!0),this.addDebugCollisionBoxes(e.verticalTextBoxStartIndex,e.verticalTextBoxEndIndex,e,!0),this.addDebugCollisionBoxes(e.iconBoxStartIndex,e.iconBoxEndIndex,e,!1),this.addDebugCollisionBoxes(e.verticalIconBoxStartIndex,e.verticalIconBoxEndIndex,e,!1)}}_deserializeCollisionBoxesForSymbol(t,e,r,i,n,a,s,l,c){let p={};for(let h=e;h<r;h++){let f=t.get(h);p.textBox={x1:f.x1,y1:f.y1,x2:f.x2,y2:f.y2,anchorPointX:f.anchorPointX,anchorPointY:f.anchorPointY},p.textFeatureIndex=f.featureIndex;break}for(let h=i;h<n;h++){let f=t.get(h);p.verticalTextBox={x1:f.x1,y1:f.y1,x2:f.x2,y2:f.y2,anchorPointX:f.anchorPointX,anchorPointY:f.anchorPointY},p.verticalTextFeatureIndex=f.featureIndex;break}for(let h=a;h<s;h++){let f=t.get(h);p.iconBox={x1:f.x1,y1:f.y1,x2:f.x2,y2:f.y2,anchorPointX:f.anchorPointX,anchorPointY:f.anchorPointY},p.iconFeatureIndex=f.featureIndex;break}for(let h=l;h<c;h++){let f=t.get(h);p.verticalIconBox={x1:f.x1,y1:f.y1,x2:f.x2,y2:f.y2,anchorPointX:f.anchorPointX,anchorPointY:f.anchorPointY},p.verticalIconFeatureIndex=f.featureIndex;break}return p}deserializeCollisionBoxes(t){this.collisionArrays=[];for(let e=0;e<this.symbolInstances.length;e++){let r=this.symbolInstances.get(e);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(t,r.textBoxStartIndex,r.textBoxEndIndex,r.verticalTextBoxStartIndex,r.verticalTextBoxEndIndex,r.iconBoxStartIndex,r.iconBoxEndIndex,r.verticalIconBoxStartIndex,r.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}addIndicesForPlacedSymbol(t,e){let r=t.placedSymbolArray.get(e),i=r.vertexStartIndex+r.numGlyphs*4;for(let n=r.vertexStartIndex;n<i;n+=4)t.indexArray.emplaceBack(n,n+1,n+2),t.indexArray.emplaceBack(n+1,n+2,n+3)}getSortedSymbolIndexes(t){if(this.sortedAngle===t&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;let e=Math.sin(t),r=Math.cos(t),i=[],n=[],a=[];for(let s=0;s<this.symbolInstances.length;++s){a.push(s);let l=this.symbolInstances.get(s);i.push(Math.round(e*l.anchorX+r*l.anchorY)|0),n.push(l.featureIndex)}return a.sort((s,l)=>i[s]-i[l]||n[l]-n[s]),a}addToSortKeyRanges(t,e){let r=this.sortKeyRanges[this.sortKeyRanges.length-1];r&&r.sortKey===e?r.symbolInstanceEnd=t+1:this.sortKeyRanges.push({sortKey:e,symbolInstanceStart:t,symbolInstanceEnd:t+1})}sortFeatures(t){if(this.sortFeaturesByY&&this.sortedAngle!==t&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(t),this.sortedAngle=t,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(let e of this.symbolInstanceIndexes){let r=this.symbolInstances.get(e);this.featureSortOrder.push(r.featureIndex),[r.rightJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.leftJustifiedTextSymbolIndex].forEach((i,n,a)=>{i>=0&&a.indexOf(i)===n&&this.addIndicesForPlacedSymbol(this.text,i)}),r.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,r.verticalPlacedTextSymbolIndex),r.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,r.placedIconSymbolIndex),r.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,r.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}};u(ep,"SymbolBucket");var pt=ep;V("SymbolBucket",pt,{omit:["layers","collisionBoxArray","features","compareText"]});pt.MAX_GLYPHS=65535;pt.addDynamicAttributes=br;m();function Gy(o,t){return t.replace(/{([^{}]+)}/g,(e,r)=>o&&r in o?String(o[r]):"")}u(Gy,"resolveTokens");m();var Ny,Mv=u(()=>Ny=Ny||new Pe({"symbol-placement":new j(T.layout_symbol["symbol-placement"]),"symbol-spacing":new j(T.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new j(T.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Z(T.layout_symbol["symbol-sort-key"]),"symbol-z-order":new j(T.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new j(T.layout_symbol["icon-allow-overlap"]),"icon-overlap":new j(T.layout_symbol["icon-overlap"]),"icon-ignore-placement":new j(T.layout_symbol["icon-ignore-placement"]),"icon-optional":new j(T.layout_symbol["icon-optional"]),"icon-rotation-alignment":new j(T.layout_symbol["icon-rotation-alignment"]),"icon-size":new Z(T.layout_symbol["icon-size"]),"icon-text-fit":new j(T.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new j(T.layout_symbol["icon-text-fit-padding"]),"icon-image":new Z(T.layout_symbol["icon-image"]),"icon-rotate":new Z(T.layout_symbol["icon-rotate"]),"icon-padding":new Z(T.layout_symbol["icon-padding"]),"icon-keep-upright":new j(T.layout_symbol["icon-keep-upright"]),"icon-offset":new Z(T.layout_symbol["icon-offset"]),"icon-anchor":new Z(T.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new j(T.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new j(T.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new j(T.layout_symbol["text-rotation-alignment"]),"text-field":new Z(T.layout_symbol["text-field"]),"text-font":new Z(T.layout_symbol["text-font"]),"text-size":new Z(T.layout_symbol["text-size"]),"text-max-width":new Z(T.layout_symbol["text-max-width"]),"text-line-height":new j(T.layout_symbol["text-line-height"]),"text-letter-spacing":new Z(T.layout_symbol["text-letter-spacing"]),"text-justify":new Z(T.layout_symbol["text-justify"]),"text-radial-offset":new Z(T.layout_symbol["text-radial-offset"]),"text-variable-anchor":new j(T.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new Z(T.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new Z(T.layout_symbol["text-anchor"]),"text-max-angle":new j(T.layout_symbol["text-max-angle"]),"text-writing-mode":new j(T.layout_symbol["text-writing-mode"]),"text-rotate":new Z(T.layout_symbol["text-rotate"]),"text-padding":new j(T.layout_symbol["text-padding"]),"text-keep-upright":new j(T.layout_symbol["text-keep-upright"]),"text-transform":new Z(T.layout_symbol["text-transform"]),"text-offset":new Z(T.layout_symbol["text-offset"]),"text-allow-overlap":new j(T.layout_symbol["text-allow-overlap"]),"text-overlap":new j(T.layout_symbol["text-overlap"]),"text-ignore-placement":new j(T.layout_symbol["text-ignore-placement"]),"text-optional":new j(T.layout_symbol["text-optional"])}),"getLayout"),jy,Lv=u(()=>jy=jy||new Pe({"icon-opacity":new Z(T.paint_symbol["icon-opacity"]),"icon-color":new Z(T.paint_symbol["icon-color"]),"icon-halo-color":new Z(T.paint_symbol["icon-halo-color"]),"icon-halo-width":new Z(T.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Z(T.paint_symbol["icon-halo-blur"]),"icon-translate":new j(T.paint_symbol["icon-translate"]),"icon-translate-anchor":new j(T.paint_symbol["icon-translate-anchor"]),"text-opacity":new Z(T.paint_symbol["text-opacity"]),"text-color":new Z(T.paint_symbol["text-color"],{runtimeType:Gf,getOverride:o=>o.textColor,hasOverride:o=>!!o.textColor}),"text-halo-color":new Z(T.paint_symbol["text-halo-color"]),"text-halo-width":new Z(T.paint_symbol["text-halo-width"]),"text-halo-blur":new Z(T.paint_symbol["text-halo-blur"]),"text-translate":new j(T.paint_symbol["text-translate"]),"text-translate-anchor":new j(T.paint_symbol["text-translate-anchor"])}),"getPaint"),sa={get paint(){return Lv()},get layout(){return Mv()}};m();var tp=class tp{constructor(t){if(t.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=t.property.overrides?t.property.overrides.runtimeType:Uf,this.defaultValue=t}evaluate(t){if(t.formattedSection){let e=this.defaultValue.property.overrides;if(e&&e.hasOverride(t.formattedSection))return e.getOverride(t.formattedSection)}return t.feature&&t.featureState?this.defaultValue.evaluate(t.feature,t.featureState):this.defaultValue.property.specification.default}eachChild(t){if(!this.defaultValue.isConstant()){let e=this.defaultValue.value;t(e._styleExpression.expression)}}outputDefined(){return!1}serialize(){return null}};u(tp,"FormatSectionOverride");var on=tp;V("FormatSectionOverride",on,{omit:["defaultValue"]});var an=class an extends Ce{constructor(e){super(e,sa)}recalculate(e,r){if(super.recalculate(e,r),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout.get("symbol-placement")!=="point"?this.layout._values["icon-rotation-alignment"]="map":this.layout._values["icon-rotation-alignment"]="viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout.get("symbol-placement")!=="point"?this.layout._values["text-rotation-alignment"]="map":this.layout._values["text-rotation-alignment"]="viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")==="map"?"map":"viewport"),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),this.layout.get("symbol-placement")==="point"){let i=this.layout.get("text-writing-mode");if(i){let n=[];for(let a of i)n.indexOf(a)<0&&n.push(a);this.layout._values["text-writing-mode"]=n}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(e,r,i,n){let a=this.layout.get(e).evaluate(r,{},i,n),s=this._unevaluatedLayout._values[e];return!s.isDataDriven()&&!to(s.value)&&a?Gy(r.properties,a):a}createBucket(e){return new pt(e)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(let e of sa.paint.overridableProperties){if(!an.hasPaintOverride(this.layout,e))continue;let r=this.paint.get(e),i=new on(r),n=new eo(i,r.property.specification),a=null;r.value.kind==="constant"||r.value.kind==="source"?a=new ro("source",n):a=new io("composite",n,r.value.zoomStops),this.paint._values[e]=new Ze(r.property,a,r.parameters)}}_handleOverridablePaintPropertyUpdate(e,r,i){return!this.layout||r.isDataDriven()||i.isDataDriven()?!1:an.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,r){let i=e.get("text-field"),n=sa.paint.properties[r],a=!1,s=u(l=>{for(let c of l)if(n.overrides&&n.overrides.hasOverride(c)){a=!0;return}},"checkSections");if(i.value.kind==="constant"&&i.value.value instanceof ui)s(i.value.value.sections);else if(i.value.kind==="source"){let l=u(p=>{if(!a)if(p instanceof qf&&jf(p.value)===Nf){let h=p.value;s(h.sections)}else p instanceof Kf?s(p.sections):p.eachChild(l)},"checkExpression"),c=i.value;c._styleExpression&&l(c._styleExpression.expression)}return a}};u(an,"SymbolStyleLayer");var la=an;m();m();var qy,Dv=u(()=>qy=qy||new Pe({"background-color":new j(T.paint_background["background-color"]),"background-pattern":new ur(T.paint_background["background-pattern"]),"background-opacity":new j(T.paint_background["background-opacity"])}),"getPaint"),Zy={get paint(){return Dv()}};var rp=class rp extends Ce{constructor(e){super(e,Zy)}};u(rp,"BackgroundStyleLayer");var ua=rp;m();m();var Hy,kv=u(()=>Hy=Hy||new Pe({"raster-opacity":new j(T.paint_raster["raster-opacity"]),"raster-hue-rotate":new j(T.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new j(T.paint_raster["raster-brightness-min"]),"raster-brightness-max":new j(T.paint_raster["raster-brightness-max"]),"raster-saturation":new j(T.paint_raster["raster-saturation"]),"raster-contrast":new j(T.paint_raster["raster-contrast"]),"raster-resampling":new j(T.paint_raster["raster-resampling"]),"raster-fade-duration":new j(T.paint_raster["raster-fade-duration"])}),"getPaint"),Wy={get paint(){return kv()}};var ip=class ip extends Ce{constructor(e){super(e,Wy)}};u(ip,"RasterStyleLayer");var ca=ip;m();function Ky(o){let t=[],e=o.id;return e===void 0&&t.push({message:"layers.".concat(e,': missing required property "id"')}),o.render===void 0&&t.push({message:"layers.".concat(e,': missing required method "render"')}),o.renderingMode&&o.renderingMode!=="2d"&&o.renderingMode!=="3d"&&t.push({message:"layers.".concat(e,': property "renderingMode" must be either "2d" or "3d"')}),t}u(Ky,"validateCustomStyleLayer");var np=class np extends Ce{constructor(e){super(e,{});this.onAdd=u(e=>{this.implementation.onAdd&&this.implementation.onAdd(e,e.painter.context.gl)},"onAdd");this.onRemove=u(e=>{this.implementation.onRemove&&this.implementation.onRemove(e,e.painter.context.gl)},"onRemove");this.implementation=e}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}};u(np,"CustomStyleLayer");var pa=np;function ha(o){if(o.type==="custom")return new pa(o);switch(o.type){case"background":return new ua(o);case"circle":return new Wo(o);case"fill":return new Qo(o);case"fill-extrusion":return new ta(o);case"heatmap":return new Jo(o);case"hillshade":return new Yo(o);case"line":return new ia(o);case"raster":return new ca(o);case"symbol":return new la(o)}}u(ha,"createStyleLayer");m();m();function $r(o){let t=[];if(typeof o=="string")t.push({id:"default",url:o});else if(o&&o.length>0){let e=[];for(let{id:r,url:i}of o){let n="".concat(r).concat(i);e.indexOf(n)===-1&&(e.push(n),t.push({id:r,url:i}))}}return t}u($r,"coerceSpriteToArray");async function $y(o,t,e,r){let i=$r(o),n=e>1?"@2x":"",a={},s={};for(let{id:l,url:c}of i){let p=t.transformRequest(t.normalizeSpriteURL(c,n,".json"),"SpriteJSON");a[l]=zt(p,r);let h=t.transformRequest(t.normalizeSpriteURL(c,n,".png"),"SpriteImage");s[l]=He.getImage(h,r)}return await Promise.all([...Object.values(a),...Object.values(s)]),Fv(a,s)}u($y,"loadSprite");async function Fv(o,t){let e={};for(let r in o){e[r]={};let i=$.getImageCanvasContext((await t[r]).data),n=(await o[r]).data;for(let a in n){let{width:s,height:l,x:c,y:p,sdf:h,pixelRatio:f,stretchX:d,stretchY:g,content:y}=n[a],_={width:s,height:l,x:c,y:p,context:i};e[r][a]={data:null,pixelRatio:f,sdf:h,stretchX:d,stretchY:g,content:y,spriteData:_}}}return e}u(Fv,"doOnceCompleted");m();m();var op=class op{constructor(t,e,r,i){this.context=t,this.format=r,this.texture=t.gl.createTexture(),this.update(e,i)}update(t,e,r){let{width:i,height:n}=t,a=(!this.size||this.size[0]!==i||this.size[1]!==n)&&!r,{context:s}=this,{gl:l}=s;if(this.useMipmap=!!(e&&e.useMipmap),l.bindTexture(l.TEXTURE_2D,this.texture),s.pixelStoreUnpackFlipY.set(!1),s.pixelStoreUnpack.set(1),s.pixelStoreUnpackPremultiplyAlpha.set(this.format===l.RGBA&&(!e||e.premultiply!==!1)),a)this.size=[i,n],t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||Je(t)?l.texImage2D(l.TEXTURE_2D,0,this.format,this.format,l.UNSIGNED_BYTE,t):l.texImage2D(l.TEXTURE_2D,0,this.format,i,n,0,this.format,l.UNSIGNED_BYTE,t.data);else{let{x:c,y:p}=r||{x:0,y:0};t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||Je(t)?l.texSubImage2D(l.TEXTURE_2D,0,c,p,l.RGBA,l.UNSIGNED_BYTE,t):l.texSubImage2D(l.TEXTURE_2D,0,c,p,i,n,l.RGBA,l.UNSIGNED_BYTE,t.data)}this.useMipmap&&this.isSizePowerOfTwo()&&l.generateMipmap(l.TEXTURE_2D)}bind(t,e,r){let{context:i}=this,{gl:n}=i;n.bindTexture(n.TEXTURE_2D,this.texture),r===n.LINEAR_MIPMAP_NEAREST&&!this.isSizePowerOfTwo()&&(r=n.LINEAR),t!==this.filter&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,t),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,r||t),this.filter=t),e!==this.wrap&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,e),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,e),this.wrap=e)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1===0}destroy(){let{gl:t}=this.context;t.deleteTexture(this.texture),this.texture=null}};u(op,"Texture");var me=op;m();function Xy(o){let{userImage:t}=o;return t&&t.render&&t.render()?(o.data.replace(new Uint8Array(t.data.buffer)),!0):!1}u(Xy,"renderStyleImage");var ma=1,ap=class ap extends le{constructor(){super();this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new de({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(e){if(this.loaded!==e&&(this.loaded=e,e)){for(let{ids:r,promiseResolve:i}of this.requestors)i(this._getImagesForIds(r));this.requestors=[]}}getImage(e){let r=this.images[e];if(r&&!r.data&&r.spriteData){let i=r.spriteData;r.data=new de({width:i.width,height:i.height},i.context.getImageData(i.x,i.y,i.width,i.height).data),r.spriteData=null}return r}addImage(e,r){if(this.images[e])throw new Error("Image id ".concat(e," already exist, use updateImage instead"));this._validate(e,r)&&(this.images[e]=r)}_validate(e,r){let i=!0,n=r.data||r.spriteData;return this._validateStretch(r.stretchX,n&&n.width)||(this.fire(new q(new Error('Image "'.concat(e,'" has invalid "stretchX" value')))),i=!1),this._validateStretch(r.stretchY,n&&n.height)||(this.fire(new q(new Error('Image "'.concat(e,'" has invalid "stretchY" value')))),i=!1),this._validateContent(r.content,r)||(this.fire(new q(new Error('Image "'.concat(e,'" has invalid "content" value')))),i=!1),i}_validateStretch(e,r){if(!e)return!0;let i=0;for(let n of e){if(n[0]<i||n[1]<n[0]||r<n[1])return!1;i=n[1]}return!0}_validateContent(e,r){if(!e)return!0;if(e.length!==4)return!1;let i=r.spriteData,n=i&&i.width||r.data.width,a=i&&i.height||r.data.height;return!(e[0]<0||n<e[0]||e[1]<0||a<e[1]||e[2]<0||n<e[2]||e[3]<0||a<e[3]||e[2]<e[0]||e[3]<e[1])}updateImage(e,r,i=!0){let n=this.getImage(e);if(i&&(n.data.width!==r.data.width||n.data.height!==r.data.height))throw new Error("size mismatch between old image (".concat(n.data.width,"x").concat(n.data.height,") and new image (").concat(r.data.width,"x").concat(r.data.height,")."));r.version=n.version+1,this.images[e]=r,this.updatedImages[e]=!0}removeImage(e){let r=this.images[e];delete this.images[e],delete this.patterns[e],r.userImage&&r.userImage.onRemove&&r.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(e){return new Promise((r,i)=>{let n=!0;if(!this.isLoaded())for(let a of e)this.images[a]||(n=!1);this.isLoaded()||n?r(this._getImagesForIds(e)):this.requestors.push({ids:e,promiseResolve:r})})}_getImagesForIds(e){let r={};for(let i of e){let n=this.getImage(i);n||(this.fire(new C("styleimagemissing",{id:i})),n=this.getImage(i)),n?r[i]={data:n.data.clone(),pixelRatio:n.pixelRatio,sdf:n.sdf,version:n.version,stretchX:n.stretchX,stretchY:n.stretchY,content:n.content,hasRenderCallback:!!(n.userImage&&n.userImage.render)}:ve('Image "'.concat(i,'" 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.'))}return r}getPixelSize(){let{width:e,height:r}=this.atlasImage;return{width:e,height:r}}getPattern(e){let r=this.patterns[e],i=this.getImage(e);if(!i)return null;if(r&&r.position.version===i.version)return r.position;if(r)r.position.version=i.version;else{let n=i.data.width+ma*2,a=i.data.height+ma*2,s={w:n,h:a,x:0,y:0},l=new Hr(s,i);this.patterns[e]={bin:s,position:l}}return this._updatePatternAtlas(),this.patterns[e].position}bind(e){let r=e.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new me(e,this.atlasImage,r.RGBA),this.atlasTexture.bind(r.LINEAR,r.CLAMP_TO_EDGE)}_updatePatternAtlas(){let e=[];for(let a in this.patterns)e.push(this.patterns[a].bin);let{w:r,h:i}=ao(e),n=this.atlasImage;n.resize({width:r||1,height:i||1});for(let a in this.patterns){let{bin:s}=this.patterns[a],l=s.x+ma,c=s.y+ma,p=this.getImage(a).data,h=p.width,f=p.height;de.copy(p,n,{x:0,y:0},{x:l,y:c},{width:h,height:f}),de.copy(p,n,{x:0,y:f-1},{x:l,y:c-1},{width:h,height:1}),de.copy(p,n,{x:0,y:0},{x:l,y:c+f},{width:h,height:1}),de.copy(p,n,{x:h-1,y:0},{x:l-1,y:c},{width:1,height:f}),de.copy(p,n,{x:0,y:0},{x:l+h,y:c},{width:1,height:f})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(e){for(let r of e){if(this.callbackDispatchedThisFrame[r])continue;this.callbackDispatchedThisFrame[r]=!0;let i=this.getImage(r);i||ve('Image with ID: "'.concat(r,'" was not found')),Xy(i)&&this.updateImage(r,i)}}};u(ap,"ImageManager");var fa=ap;m();m();async function Jy(o,t,e,r){let i=t*256,n=i+255,a=r.transformRequest(e.replace("{fontstack}",o).replace("{range}","".concat(i,"-").concat(n)),"Glyphs"),s=await Td(a,new AbortController);if(!s||!s.data)throw new Error("Could not load glyph range. range: ".concat(t,", ").concat(i,"-").concat(n));let l={};for(let c of By(s.data))l[c.id]=c;return l}u(Jy,"loadGlyphRange");var vr=class vr{constructor(t,e){this.requestManager=t,this.localIdeographFontFamily=e,this.entries={}}setURL(t){this.url=t}async getGlyphs(t){let e=[];for(let n in t)for(let a of t[n])e.push(this._getAndCacheGlyphsPromise(n,a));let r=await Promise.all(e),i={};for(let{stack:n,id:a,glyph:s}of r)i[n]||(i[n]={}),i[n][a]=s&&{id:s.id,bitmap:s.bitmap.clone(),metrics:s.metrics};return i}async _getAndCacheGlyphsPromise(t,e){let r=this.entries[t];r||(r=this.entries[t]={glyphs:{},requests:{},ranges:{}});let i=r.glyphs[e];if(i!==void 0)return{stack:t,id:e,glyph:i};if(i=this._tinySDF(r,t,e),i)return r.glyphs[e]=i,{stack:t,id:e,glyph:i};let n=Math.floor(e/256);if(n*256>65535)throw new Error("glyphs > 65535 not supported");if(r.ranges[n])return{stack:t,id:e,glyph:i};if(!this.url)throw new Error("glyphsUrl is not set");if(!r.requests[n]){let s=vr.loadGlyphRange(t,n,this.url,this.requestManager);r.requests[n]=s}let a=await r.requests[n];for(let s in a)this._doesCharSupportLocalGlyph(+s)||(r.glyphs[+s]=a[+s]);return r.ranges[n]=!0,{stack:t,id:e,glyph:a[e]||null}}_doesCharSupportLocalGlyph(t){return!!this.localIdeographFontFamily&&(oe["CJK Unified Ideographs"](t)||oe["Hangul Syllables"](t)||oe.Hiragana(t)||oe.Katakana(t))}_tinySDF(t,e,r){let i=this.localIdeographFontFamily;if(!i||!this._doesCharSupportLocalGlyph(r))return;let n=2,a=t.tinySDF;if(!a){let p="400";/bold/i.test(e)?p="900":/medium/i.test(e)?p="500":/light/i.test(e)&&(p="200"),a=t.tinySDF=new vr.TinySDF({fontSize:24*n,buffer:3*n,radius:8*n,cutoff:.25,fontFamily:i,fontWeight:p})}let s=a.draw(String.fromCharCode(r)),l=27.5,c=.5;return{id:r,bitmap:new gr({width:s.width||30*n,height:s.height||30*n},s.data),metrics:{width:s.glyphWidth/n||24,height:s.glyphHeight/n||24,left:s.glyphLeft/n+c||0,top:s.glyphTop/n-l||-8,advance:s.glyphAdvance/n||24,isDoubleResolution:!0}}}};u(vr,"GlyphManager"),vr.loadGlyphRange=Jy,vr.TinySDF=id;var da=vr;m();var up=class up{constructor(){this.specification=T.light.position}possiblyEvaluate(t,e){return gd(t.expression.evaluate(e))}interpolate(t,e,r){return{x:we.number(t.x,e.x,r),y:we.number(t.y,e.y,r),z:we.number(t.z,e.z,r)}}};u(up,"LightPositionProperty");var lp=up,Yy="-transition",sp,cp=class cp extends le{constructor(e){super();sp=sp||new Pe({anchor:new j(T.light.anchor),position:new lp,color:new j(T.light.color),intensity:new j(T.light.intensity)}),this._transitionable=new Or(sp),this.setLight(e),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(e,r={}){if(!this._validate(Md,e,r))for(let i in e){let n=e[i];i.endsWith(Yy)?this._transitionable.setTransition(i.slice(0,-Yy.length),n):this._transitionable.setValue(i,n)}}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(e,r,i){return i&&i.validate===!1?!1:kr(this,e.call(Ie,{value:r,style:{glyphs:!0,sprite:!0},styleSpec:T}))}};u(cp,"Light");var ya=cp;m();var pp=class pp{constructor(t,e){this.width=t,this.height=e,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(t,e){let r=t.join(",")+String(e);return this.dashEntry[r]||(this.dashEntry[r]=this.addDash(t,e)),this.dashEntry[r]}getDashRanges(t,e,r){let i=t.length%2===1,n=[],a=i?-t[t.length-1]*r:0,s=t[0]*r,l=!0;n.push({left:a,right:s,isDash:l,zeroLength:t[0]===0});let c=t[0];for(let p=1;p<t.length;p++){l=!l;let h=t[p];a=c*r,c+=h,s=c*r,n.push({left:a,right:s,isDash:l,zeroLength:h===0})}return n}addRoundDash(t,e,r){let i=e/2;for(let n=-r;n<=r;n++){let a=this.nextRow+r+n,s=this.width*a,l=0,c=t[l];for(let p=0;p<this.width;p++){p/c.right>1&&(c=t[++l]);let h=Math.abs(p-c.left),f=Math.abs(p-c.right),d=Math.min(h,f),g,y=n/r*(i+1);if(c.isDash){let _=i-Math.abs(y);g=Math.sqrt(d*d+_*_)}else g=i-Math.sqrt(d*d+y*y);this.data[s+p]=Math.max(0,Math.min(255,g+128))}}}addRegularDash(t){for(let s=t.length-1;s>=0;--s){let l=t[s],c=t[s+1];l.zeroLength?t.splice(s,1):c&&c.isDash===l.isDash&&(c.left=l.left,t.splice(s,1))}let e=t[0],r=t[t.length-1];e.isDash===r.isDash&&(e.left=r.left-this.width,r.right=e.right+this.width);let i=this.width*this.nextRow,n=0,a=t[n];for(let s=0;s<this.width;s++){s/a.right>1&&(a=t[++n]);let l=Math.abs(s-a.left),c=Math.abs(s-a.right),p=Math.min(l,c),h=a.isDash?p:-p;this.data[i+s]=Math.max(0,Math.min(255,h+128))}}addDash(t,e){let r=e?7:0,i=2*r+1;if(this.nextRow+i>this.height)return ve("LineAtlas out of space"),null;let n=0;for(let s=0;s<t.length;s++)n+=t[s];if(n!==0){let s=this.width/n,l=this.getDashRanges(t,this.width,s);e?this.addRoundDash(l,s,r):this.addRegularDash(l)}let a={y:(this.nextRow+r+.5)/this.height,height:2*r/this.height,width:n};return this.nextRow+=i,this.dirty=!0,a}bind(t){let e=t.gl;this.texture?(e.bindTexture(e.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,e.texSubImage2D(e.TEXTURE_2D,0,0,0,this.width,this.height,e.ALPHA,e.UNSIGNED_BYTE,this.data))):(this.texture=e.createTexture(),e.bindTexture(e.TEXTURE_2D,this.texture),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.REPEAT),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.REPEAT),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texImage2D(e.TEXTURE_2D,0,e.ALPHA,this.width,this.height,0,e.ALPHA,e.UNSIGNED_BYTE,this.data))}};u(pp,"LineAtlas");var ga=pp;m();m();m();var hp=class hp{constructor(t){this._methodToThrottle=t,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._methodToThrottle()},0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}};u(hp,"ThrottledInvoker");var _a=hp;var mp=class mp{constructor(t,e){this.target=t,this.mapId=e,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new _a(()=>this.process()),this.subscription=Pd(this.target,"message",r=>this.receive(r),!1),this.globalScope=Pt(self)?t:window}registerMessageHandler(t,e){this.messageHandlers[t]=e}sendAsync(t,e){return new Promise((r,i)=>{let n=Math.round(Math.random()*1e18).toString(36).substring(0,10);this.resolveRejects[n]={resolve:r,reject:i},e&&e.signal.addEventListener("abort",()=>{delete this.resolveRejects[n];let l={id:n,type:"<cancel>",origin:location.origin,targetMapId:t.targetMapId,sourceMapId:this.mapId};this.target.postMessage(l)},{once:!0});let a=[],s={...t,id:n,sourceMapId:this.mapId,origin:location.origin,data:Fr(t.data,a)};this.target.postMessage(s,{transfer:a})})}receive(t){let e=t.data,r=e.id;if(!(e.origin!=="file://"&&location.origin!=="file://"&&e.origin!==location.origin)&&!(e.targetMapId&&this.mapId!==e.targetMapId)){if(e.type==="<cancel>"){delete this.tasks[r];let i=this.abortControllers[r];delete this.abortControllers[r],i&&i.abort();return}if(Pt(self)||e.mustQueue){this.tasks[r]=e,this.taskQueue.push(r),this.invoker.trigger();return}this.processTask(r,e)}}process(){if(this.taskQueue.length===0)return;let t=this.taskQueue.shift(),e=this.tasks[t];delete this.tasks[t],this.taskQueue.length>0&&this.invoker.trigger(),e&&this.processTask(t,e)}async processTask(t,e){if(e.type==="<response>"){let n=this.resolveRejects[t];if(delete this.resolveRejects[t],!n)return;e.error?n.reject(Rr(e.error)):n.resolve(Rr(e.data));return}if(!this.messageHandlers[e.type]){this.completeTask(t,new Error("Could not find a registered handler for ".concat(e.type,", map ID: ").concat(this.mapId,", available handlers: ").concat(Object.keys(this.messageHandlers).join(", "))));return}let r=Rr(e.data),i=new AbortController;this.abortControllers[t]=i;try{let n=await this.messageHandlers[e.type](e.sourceMapId,r,i);this.completeTask(t,null,n)}catch(n){this.completeTask(t,n)}}completeTask(t,e,r){let i=[];delete this.abortControllers[t];let n={id:t,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:e?Fr(e):null,data:Fr(r,i)};this.target.postMessage(n,{transfer:i})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}};u(mp,"Actor");var xa=mp;m();m();m();m();var Qy='(()=>{var qf=Object.create;var wa=Object.defineProperty;var jf=Object.getOwnPropertyDescriptor;var Jf=Object.getOwnPropertyNames;var Zf=Object.getPrototypeOf,Wf=Object.prototype.hasOwnProperty;var Ae=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),ml=(e,t)=>{for(var r in t)wa(e,r,{get:t[r],enumerable:!0})},Hf=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Jf(t))!Wf.call(e,i)&&i!==r&&wa(e,i,{get:()=>t[i],enumerable:!(n=jf(t,i))||n.enumerable});return e};var J=(e,t,r)=>(r=e!=null?qf(Zf(e)):{},Hf(t||!e||!e.__esModule?wa(r,"default",{value:e,enumerable:!0}):r,e));var de=Ae((cb,hl)=>{"use strict";hl.exports=nr;function nr(e,t){this.x=e,this.y=t}nr.prototype={clone:function(){return new nr(this.x,this.y)},add:function(e){return this.clone()._add(e)},sub:function(e){return this.clone()._sub(e)},multByPoint:function(e){return this.clone()._multByPoint(e)},divByPoint:function(e){return this.clone()._divByPoint(e)},mult:function(e){return this.clone()._mult(e)},div:function(e){return this.clone()._div(e)},rotate:function(e){return this.clone()._rotate(e)},rotateAround:function(e,t){return this.clone()._rotateAround(e,t)},matMult:function(e){return this.clone()._matMult(e)},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(e){return this.x===e.x&&this.y===e.y},dist:function(e){return Math.sqrt(this.distSqr(e))},distSqr:function(e){var t=e.x-this.x,r=e.y-this.y;return t*t+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(e){return Math.atan2(this.y-e.y,this.x-e.x)},angleWith:function(e){return this.angleWithSep(e.x,e.y)},angleWithSep:function(e,t){return Math.atan2(this.x*t-this.y*e,this.x*e+this.y*t)},_matMult:function(e){var t=e[0]*this.x+e[1]*this.y,r=e[2]*this.x+e[3]*this.y;return this.x=t,this.y=r,this},_add:function(e){return this.x+=e.x,this.y+=e.y,this},_sub:function(e){return this.x-=e.x,this.y-=e.y,this},_mult:function(e){return this.x*=e,this.y*=e,this},_div:function(e){return this.x/=e,this.y/=e,this},_multByPoint:function(e){return this.x*=e.x,this.y*=e.y,this},_divByPoint:function(e){return this.x/=e.x,this.y/=e.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var e=this.y;return this.y=this.x,this.x=-e,this},_rotate:function(e){var t=Math.cos(e),r=Math.sin(e),n=t*this.x-r*this.y,i=r*this.x+t*this.y;return this.x=n,this.y=i,this},_rotateAround:function(e,t){var r=Math.cos(e),n=Math.sin(e),i=t.x+r*(this.x-t.x)-n*(this.y-t.y),o=t.y+n*(this.x-t.x)+r*(this.y-t.y);return this.x=i,this.y=o,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}};nr.convert=function(e){return e instanceof nr?e:Array.isArray(e)?new nr(e[0],e[1]):e}});var Aa=Ae((pb,gl)=>{"use strict";gl.exports=dl;function dl(e,t,r,n){this.cx=3*e,this.bx=3*(r-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*t,this.by=3*(n-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=t,this.p2x=r,this.p2y=n}dl.prototype={sampleCurveX:function(e){return((this.ax*e+this.bx)*e+this.cx)*e},sampleCurveY:function(e){return((this.ay*e+this.by)*e+this.cy)*e},sampleCurveDerivativeX:function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},solveCurveX:function(e,t){if(t===void 0&&(t=1e-6),e<0)return 0;if(e>1)return 1;for(var r=e,n=0;n<8;n++){var i=this.sampleCurveX(r)-e;if(Math.abs(i)<t)return r;var o=this.sampleCurveDerivativeX(r);if(Math.abs(o)<1e-6)break;r=r-i/o}var a=0,s=1;for(r=e,n=0;n<20&&(i=this.sampleCurveX(r),!(Math.abs(i-e)<t));n++)e>i?a=r:s=r,r=(s-a)*.5+a;return r},solve:function(e,t){return this.sampleCurveY(this.solveCurveX(e,t))}}});var Hu=Ae((q0,os)=>{function uh(e,t){var r,n,i,o,a,s,l,u,c,p;for(r=e.length&3,n=e.length-r,i=t,a=3432918353,l=461845907,p=0;p<n;)c=e.charCodeAt(p)&255|(e.charCodeAt(++p)&255)<<8|(e.charCodeAt(++p)&255)<<16|(e.charCodeAt(++p)&255)<<24,++p,c=(c&65535)*a+(((c>>>16)*a&65535)<<16)&4294967295,c=c<<15|c>>>17,c=(c&65535)*l+(((c>>>16)*l&65535)<<16)&4294967295,i^=c,i=i<<13|i>>>19,o=(i&65535)*5+(((i>>>16)*5&65535)<<16)&4294967295,i=(o&65535)+27492+(((o>>>16)+58964&65535)<<16);switch(c=0,r){case 3:c^=(e.charCodeAt(p+2)&255)<<16;case 2:c^=(e.charCodeAt(p+1)&255)<<8;case 1:c^=e.charCodeAt(p)&255,c=(c&65535)*a+(((c>>>16)*a&65535)<<16)&4294967295,c=c<<15|c>>>17,c=(c&65535)*l+(((c>>>16)*l&65535)<<16)&4294967295,i^=c}return i^=e.length,i^=i>>>16,i=(i&65535)*2246822507+(((i>>>16)*2246822507&65535)<<16)&4294967295,i^=i>>>13,i=(i&65535)*3266489909+(((i>>>16)*3266489909&65535)<<16)&4294967295,i^=i>>>16,i>>>0}typeof os<"u"&&(os.exports=uh)});var Ku=Ae((j0,as)=>{function ch(e,t){for(var r=e.length,n=t^r,i=0,o;r>=4;)o=e.charCodeAt(i)&255|(e.charCodeAt(++i)&255)<<8|(e.charCodeAt(++i)&255)<<16|(e.charCodeAt(++i)&255)<<24,o=(o&65535)*1540483477+(((o>>>16)*1540483477&65535)<<16),o^=o>>>24,o=(o&65535)*1540483477+(((o>>>16)*1540483477&65535)<<16),n=(n&65535)*1540483477+(((n>>>16)*1540483477&65535)<<16)^o,r-=4,++i;switch(r){case 3:n^=(e.charCodeAt(i+2)&255)<<16;case 2:n^=(e.charCodeAt(i+1)&255)<<8;case 1:n^=e.charCodeAt(i)&255,n=(n&65535)*1540483477+(((n>>>16)*1540483477&65535)<<16)}return n^=n>>>13,n=(n&65535)*1540483477+(((n>>>16)*1540483477&65535)<<16),n^=n>>>15,n>>>0}typeof as!==void 0&&(as.exports=ch)});var ss=Ae((J0,go)=>{var Yu=Hu(),ph=Ku();go.exports=Yu;go.exports.murmur3=Yu;go.exports.murmur2=ph});var vs=Ae((R1,bs)=>{"use strict";bs.exports=Mo;bs.exports.default=Mo;function Mo(e,t,r){r=r||2;var n=t&&t.length,i=n?t[0]*r:e.length,o=zc(e,0,i,r,!0),a=[];if(!o||o.next===o.prev)return a;var s,l,u,c,p,f,y;if(n&&(o=Yd(e,t,o,r)),e.length>80*r){s=u=e[0],l=c=e[1];for(var m=r;m<i;m+=r)p=e[m],f=e[m+1],p<s&&(s=p),f<l&&(l=f),p>u&&(u=p),f>c&&(c=f);y=Math.max(u-s,c-l),y=y!==0?32767/y:0}return Rn(o,a,r,s,l,y,0),a}function zc(e,t,r,n,i){var o,a;if(i===xs(e,t,r,n)>0)for(o=t;o<r;o+=n)a=Bc(o,e[o],e[o+1],a);else for(o=r-n;o>=t;o-=n)a=Bc(o,e[o],e[o+1],a);return a&&Eo(a,a.next)&&(Un(a),a=a.next),a}function Yt(e,t){if(!e)return e;t||(t=e);var r=e,n;do if(n=!1,!r.steiner&&(Eo(r,r.next)||oe(r.prev,r,r.next)===0)){if(Un(r),r=t=r.prev,r===r.next)break;n=!0}else r=r.next;while(n||r!==t);return t}function Rn(e,t,r,n,i,o,a){if(e){!a&&o&&rg(e,n,i,o);for(var s=e,l,u;e.prev!==e.next;){if(l=e.prev,u=e.next,o?Wd(e,n,i,o):Zd(e)){t.push(l.i/r|0),t.push(e.i/r|0),t.push(u.i/r|0),Un(e),e=u.next,s=u.next;continue}if(e=u,e===s){a?a===1?(e=Hd(Yt(e),t,r),Rn(e,t,r,n,i,o,2)):a===2&&Kd(e,t,r,n,i,o):Rn(Yt(e),t,r,n,i,o,1);break}}}}function Zd(e){var t=e.prev,r=e,n=e.next;if(oe(t,r,n)>=0)return!1;for(var i=t.x,o=r.x,a=n.x,s=t.y,l=r.y,u=n.y,c=i<o?i<a?i:a:o<a?o:a,p=s<l?s<u?s:u:l<u?l:u,f=i>o?i>a?i:a:o>a?o:a,y=s>l?s>u?s:u:l>u?l:u,m=n.next;m!==t;){if(m.x>=c&&m.x<=f&&m.y>=p&&m.y<=y&&Pr(i,s,o,l,a,u,m.x,m.y)&&oe(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function Wd(e,t,r,n){var i=e.prev,o=e,a=e.next;if(oe(i,o,a)>=0)return!1;for(var s=i.x,l=o.x,u=a.x,c=i.y,p=o.y,f=a.y,y=s<l?s<u?s:u:l<u?l:u,m=c<p?c<f?c:f:p<f?p:f,h=s>l?s>u?s:u:l>u?l:u,d=c>p?c>f?c:f:p>f?p:f,g=ds(y,m,t,r,n),v=ds(h,d,t,r,n),x=e.prevZ,P=e.nextZ;x&&x.z>=g&&P&&P.z<=v;){if(x.x>=y&&x.x<=h&&x.y>=m&&x.y<=d&&x!==i&&x!==a&&Pr(s,c,l,p,u,f,x.x,x.y)&&oe(x.prev,x,x.next)>=0||(x=x.prevZ,P.x>=y&&P.x<=h&&P.y>=m&&P.y<=d&&P!==i&&P!==a&&Pr(s,c,l,p,u,f,P.x,P.y)&&oe(P.prev,P,P.next)>=0))return!1;P=P.nextZ}for(;x&&x.z>=g;){if(x.x>=y&&x.x<=h&&x.y>=m&&x.y<=d&&x!==i&&x!==a&&Pr(s,c,l,p,u,f,x.x,x.y)&&oe(x.prev,x,x.next)>=0)return!1;x=x.prevZ}for(;P&&P.z<=v;){if(P.x>=y&&P.x<=h&&P.y>=m&&P.y<=d&&P!==i&&P!==a&&Pr(s,c,l,p,u,f,P.x,P.y)&&oe(P.prev,P,P.next)>=0)return!1;P=P.nextZ}return!0}function Hd(e,t,r){var n=e;do{var i=n.prev,o=n.next.next;!Eo(i,o)&&Rc(i,n,n.next,o)&&On(i,o)&&On(o,i)&&(t.push(i.i/r|0),t.push(n.i/r|0),t.push(o.i/r|0),Un(n),Un(n.next),n=e=o),n=n.next}while(n!==e);return Yt(n)}function Kd(e,t,r,n,i,o){var a=e;do{for(var s=a.next.next;s!==a.prev;){if(a.i!==s.i&&og(a,s)){var l=Oc(a,s);a=Yt(a,a.next),l=Yt(l,l.next),Rn(a,t,r,n,i,o,0),Rn(l,t,r,n,i,o,0);return}s=s.next}a=a.next}while(a!==e)}function Yd(e,t,r,n){var i=[],o,a,s,l,u;for(o=0,a=t.length;o<a;o++)s=t[o]*n,l=o<a-1?t[o+1]*n:e.length,u=zc(e,s,l,n,!1),u===u.next&&(u.steiner=!0),i.push(ig(u));for(i.sort(Xd),o=0;o<i.length;o++)r=Qd(i[o],r);return r}function Xd(e,t){return e.x-t.x}function Qd(e,t){var r=eg(e,t);if(!r)return t;var n=Oc(r,e);return Yt(n,n.next),Yt(r,r.next)}function eg(e,t){var r=t,n=e.x,i=e.y,o=-1/0,a;do{if(i<=r.y&&i>=r.next.y&&r.next.y!==r.y){var s=r.x+(i-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(s<=n&&s>o&&(o=s,a=r.x<r.next.x?r:r.next,s===n))return a}r=r.next}while(r!==t);if(!a)return null;var l=a,u=a.x,c=a.y,p=1/0,f;r=a;do n>=r.x&&r.x>=u&&n!==r.x&&Pr(i<c?n:o,i,u,c,i<c?o:n,i,r.x,r.y)&&(f=Math.abs(i-r.y)/(n-r.x),On(r,e)&&(f<p||f===p&&(r.x>a.x||r.x===a.x&&tg(a,r)))&&(a=r,p=f)),r=r.next;while(r!==l);return a}function tg(e,t){return oe(e.prev,e,t.prev)<0&&oe(t.next,e,e.next)<0}function rg(e,t,r,n){var i=e;do i.z===0&&(i.z=ds(i.x,i.y,t,r,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,ng(i)}function ng(e){var t,r,n,i,o,a,s,l,u=1;do{for(r=e,e=null,o=null,a=0;r;){for(a++,n=r,s=0,t=0;t<u&&(s++,n=n.nextZ,!!n);t++);for(l=u;s>0||l>0&&n;)s!==0&&(l===0||!n||r.z<=n.z)?(i=r,r=r.nextZ,s--):(i=n,n=n.nextZ,l--),o?o.nextZ=i:e=i,i.prevZ=o,o=i;r=n}o.nextZ=null,u*=2}while(a>1);return e}function ds(e,t,r,n,i){return e=(e-r)*i|0,t=(t-n)*i|0,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e|t<<1}function ig(e){var t=e,r=e;do(t.x<r.x||t.x===r.x&&t.y<r.y)&&(r=t),t=t.next;while(t!==e);return r}function Pr(e,t,r,n,i,o,a,s){return(i-a)*(t-s)>=(e-a)*(o-s)&&(e-a)*(n-s)>=(r-a)*(t-s)&&(r-a)*(o-s)>=(i-a)*(n-s)}function og(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!ag(e,t)&&(On(e,t)&&On(t,e)&&sg(e,t)&&(oe(e.prev,e,t.prev)||oe(e,t.prev,t))||Eo(e,t)&&oe(e.prev,e,e.next)>0&&oe(t.prev,t,t.next)>0)}function oe(e,t,r){return(t.y-e.y)*(r.x-t.x)-(t.x-e.x)*(r.y-t.y)}function Eo(e,t){return e.x===t.x&&e.y===t.y}function Rc(e,t,r,n){var i=ko(oe(e,t,r)),o=ko(oe(e,t,n)),a=ko(oe(r,n,e)),s=ko(oe(r,n,t));return!!(i!==o&&a!==s||i===0&&Co(e,r,t)||o===0&&Co(e,n,t)||a===0&&Co(r,e,n)||s===0&&Co(r,t,n))}function Co(e,t,r){return t.x<=Math.max(e.x,r.x)&&t.x>=Math.min(e.x,r.x)&&t.y<=Math.max(e.y,r.y)&&t.y>=Math.min(e.y,r.y)}function ko(e){return e>0?1:e<0?-1:0}function ag(e,t){var r=e;do{if(r.i!==e.i&&r.next.i!==e.i&&r.i!==t.i&&r.next.i!==t.i&&Rc(r,r.next,e,t))return!0;r=r.next}while(r!==e);return!1}function On(e,t){return oe(e.prev,e,e.next)<0?oe(e,t,e.next)>=0&&oe(e,e.prev,t)>=0:oe(e,t,e.prev)<0||oe(e,e.next,t)<0}function sg(e,t){var r=e,n=!1,i=(e.x+t.x)/2,o=(e.y+t.y)/2;do r.y>o!=r.next.y>o&&r.next.y!==r.y&&i<(r.next.x-r.x)*(o-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next;while(r!==e);return n}function Oc(e,t){var r=new gs(e.i,e.x,e.y),n=new gs(t.i,t.x,t.y),i=e.next,o=t.prev;return e.next=t,t.prev=e,r.next=i,i.prev=r,n.next=r,r.prev=n,o.next=n,n.prev=o,n}function Bc(e,t,r,n){var i=new gs(e,t,r);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function Un(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function gs(e,t,r){this.i=e,this.x=t,this.y=r,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}Mo.deviation=function(e,t,r,n){var i=t&&t.length,o=i?t[0]*r:e.length,a=Math.abs(xs(e,0,o,r));if(i)for(var s=0,l=t.length;s<l;s++){var u=t[s]*r,c=s<l-1?t[s+1]*r:e.length;a-=Math.abs(xs(e,u,c,r))}var p=0;for(s=0;s<n.length;s+=3){var f=n[s]*r,y=n[s+1]*r,m=n[s+2]*r;p+=Math.abs((e[f]-e[m])*(e[y+1]-e[f+1])-(e[f]-e[y])*(e[m+1]-e[f+1]))}return a===0&&p===0?0:Math.abs((p-a)/a)};function xs(e,t,r,n){for(var i=0,o=t,a=r-n;o<r;o+=n)i+=(e[a]-e[o])*(e[o+1]+e[a+1]),a=o;return i}Mo.flatten=function(e){for(var t=e[0][0].length,r={vertices:[],holes:[],dimensions:t},n=0,i=0;i<e.length;i++){for(var o=0;o<e[i].length;o++)for(var a=0;a<t;a++)r.vertices.push(e[i][o][a]);i>0&&(n+=e[i-1].length,r.holes.push(n))}return r}});var Ss=Ae((PP,Zc)=>{"use strict";var mg=de();Zc.exports=_r;function _r(e,t,r,n,i){this.properties={},this.extent=r,this.type=0,this._pbf=e,this._geometry=-1,this._keys=n,this._values=i,e.readFields(hg,this,t)}function hg(e,t,r){e==1?t.id=r.readVarint():e==2?dg(r,t):e==3?t.type=r.readVarint():e==4&&(t._geometry=r.pos)}function dg(e,t){for(var r=e.readVarint()+e.pos;e.pos<r;){var n=t._keys[e.readVarint()],i=t._values[e.readVarint()];t.properties[n]=i}}_r.types=["Unknown","Point","LineString","Polygon"];_r.prototype.loadGeometry=function(){var e=this._pbf;e.pos=this._geometry;for(var t=e.readVarint()+e.pos,r=1,n=0,i=0,o=0,a=[],s;e.pos<t;){if(n<=0){var l=e.readVarint();r=l&7,n=l>>3}if(n--,r===1||r===2)i+=e.readSVarint(),o+=e.readSVarint(),r===1&&(s&&a.push(s),s=[]),s.push(new mg(i,o));else if(r===7)s&&s.push(s[0].clone());else throw new Error("unknown command "+r)}return s&&a.push(s),a};_r.prototype.bbox=function(){var e=this._pbf;e.pos=this._geometry;for(var t=e.readVarint()+e.pos,r=1,n=0,i=0,o=0,a=1/0,s=-1/0,l=1/0,u=-1/0;e.pos<t;){if(n<=0){var c=e.readVarint();r=c&7,n=c>>3}if(n--,r===1||r===2)i+=e.readSVarint(),o+=e.readSVarint(),i<a&&(a=i),i>s&&(s=i),o<l&&(l=o),o>u&&(u=o);else if(r!==7)throw new Error("unknown command "+r)}return[a,l,s,u]};_r.prototype.toGeoJSON=function(e,t,r){var n=this.extent*Math.pow(2,r),i=this.extent*e,o=this.extent*t,a=this.loadGeometry(),s=_r.types[this.type],l,u;function c(y){for(var m=0;m<y.length;m++){var h=y[m],d=180-(h.y+o)*360/n;y[m]=[(h.x+i)*360/n-180,360/Math.PI*Math.atan(Math.exp(d*Math.PI/180))-90]}}switch(this.type){case 1:var p=[];for(l=0;l<a.length;l++)p[l]=a[l][0];a=p,c(a);break;case 2:for(l=0;l<a.length;l++)c(a[l]);break;case 3:for(a=gg(a),l=0;l<a.length;l++)for(u=0;u<a[l].length;u++)c(a[l][u]);break}a.length===1?a=a[0]:s="Multi"+s;var f={type:"Feature",geometry:{type:s,coordinates:a},properties:this.properties};return"id"in this&&(f.id=this.id),f};function gg(e){var t=e.length;if(t<=1)return[e];for(var r=[],n,i,o=0;o<t;o++){var a=xg(e[o]);a!==0&&(i===void 0&&(i=a<0),i===a<0?(n&&r.push(n),n=[e[o]]):n.push(e[o]))}return n&&r.push(n),r}function xg(e){for(var t=0,r=0,n=e.length,i=n-1,o,a;r<n;i=r++)o=e[r],a=e[i],t+=(a.x-o.x)*(o.y+a.y);return t}});var ws=Ae((SP,Hc)=>{"use strict";var bg=Ss();Hc.exports=Wc;function Wc(e,t){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],e.readFields(vg,this,t),this.length=this._features.length}function vg(e,t,r){e===15?t.version=r.readVarint():e===1?t.name=r.readString():e===5?t.extent=r.readVarint():e===2?t._features.push(r.pos):e===3?t._keys.push(r.readString()):e===4&&t._values.push(Pg(r))}function Pg(e){for(var t=null,r=e.readVarint()+e.pos;e.pos<r;){var n=e.readVarint()>>3;t=n===1?e.readString():n===2?e.readFloat():n===3?e.readDouble():n===4?e.readVarint64():n===5?e.readVarint():n===6?e.readSVarint():n===7?e.readBoolean():null}return t}Wc.prototype.feature=function(e){if(e<0||e>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[e];var t=this._pbf.readVarint()+this._pbf.pos;return new bg(this._pbf,t,this.extent,this._keys,this._values)}});var Yc=Ae((wP,Kc)=>{"use strict";var Sg=ws();Kc.exports=wg;function wg(e,t){this.layers=e.readFields(Ag,{},t)}function Ag(e,t,r){if(e===3){var n=new Sg(r,r.readVarint()+r.pos);n.length&&(t[n.name]=n)}}});var It=Ae((AP,Lo)=>{Lo.exports.VectorTile=Yc();Lo.exports.VectorTileFeature=Ss();Lo.exports.VectorTileLayer=ws()});var xp=Ae(Cs=>{Cs.read=function(e,t,r,n,i){var o,a,s=i*8-n-1,l=(1<<s)-1,u=l>>1,c=-7,p=r?i-1:0,f=r?-1:1,y=e[t+p];for(p+=f,o=y&(1<<-c)-1,y>>=-c,c+=s;c>0;o=o*256+e[t+p],p+=f,c-=8);for(a=o&(1<<-c)-1,o>>=-c,c+=n;c>0;a=a*256+e[t+p],p+=f,c-=8);if(o===0)o=1-u;else{if(o===l)return a?NaN:(y?-1:1)*(1/0);a=a+Math.pow(2,n),o=o-u}return(y?-1:1)*a*Math.pow(2,o-n)};Cs.write=function(e,t,r,n,i,o){var a,s,l,u=o*8-i-1,c=(1<<u)-1,p=c>>1,f=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,y=n?0:o-1,m=n?1:-1,h=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=c):(a=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-a))<1&&(a--,l*=2),a+p>=1?t+=f/l:t+=f*Math.pow(2,1-p),t*l>=2&&(a++,l/=2),a+p>=c?(s=0,a=c):a+p>=1?(s=(t*l-1)*Math.pow(2,i),a=a+p):(s=t*Math.pow(2,p-1)*Math.pow(2,i),a=0));i>=8;e[r+y]=s&255,y+=m,s/=256,i-=8);for(a=a<<i|s,u+=i;u>0;e[r+y]=a&255,y+=m,a/=256,u-=8);e[r+y-m]|=h*128}});var qn=Ae((aw,wp)=>{"use strict";wp.exports=Z;var Ro=xp();function Z(e){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(e)?e:new Uint8Array(e||0),this.pos=0,this.type=0,this.length=this.buf.length}Z.Varint=0;Z.Fixed64=1;Z.Bytes=2;Z.Fixed32=5;var ks=65536*65536,bp=1/ks,$g=12,Sp=typeof TextDecoder>"u"?null:new TextDecoder("utf8");Z.prototype={destroy:function(){this.buf=null},readFields:function(e,t,r){for(r=r||this.length;this.pos<r;){var n=this.readVarint(),i=n>>3,o=this.pos;this.type=n&7,e(i,t,this),this.pos===o&&this.skip(n)}return t},readMessage:function(e,t){return this.readFields(e,t,this.readVarint()+this.pos)},readFixed32:function(){var e=Oo(this.buf,this.pos);return this.pos+=4,e},readSFixed32:function(){var e=Pp(this.buf,this.pos);return this.pos+=4,e},readFixed64:function(){var e=Oo(this.buf,this.pos)+Oo(this.buf,this.pos+4)*ks;return this.pos+=8,e},readSFixed64:function(){var e=Oo(this.buf,this.pos)+Pp(this.buf,this.pos+4)*ks;return this.pos+=8,e},readFloat:function(){var e=Ro.read(this.buf,this.pos,!0,23,4);return this.pos+=4,e},readDouble:function(){var e=Ro.read(this.buf,this.pos,!0,52,8);return this.pos+=8,e},readVarint:function(e){var t=this.buf,r,n;return n=t[this.pos++],r=n&127,n<128||(n=t[this.pos++],r|=(n&127)<<7,n<128)||(n=t[this.pos++],r|=(n&127)<<14,n<128)||(n=t[this.pos++],r|=(n&127)<<21,n<128)?r:(n=t[this.pos],r|=(n&15)<<28,qg(r,e,this))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var e=this.readVarint();return e%2===1?(e+1)/-2:e/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var e=this.readVarint()+this.pos,t=this.pos;return this.pos=e,e-t>=$g&&Sp?ix(this.buf,t,e):nx(this.buf,t,e)},readBytes:function(){var e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t},readPackedVarint:function(e,t){if(this.type!==Z.Bytes)return e.push(this.readVarint(t));var r=lt(this);for(e=e||[];this.pos<r;)e.push(this.readVarint(t));return e},readPackedSVarint:function(e){if(this.type!==Z.Bytes)return e.push(this.readSVarint());var t=lt(this);for(e=e||[];this.pos<t;)e.push(this.readSVarint());return e},readPackedBoolean:function(e){if(this.type!==Z.Bytes)return e.push(this.readBoolean());var t=lt(this);for(e=e||[];this.pos<t;)e.push(this.readBoolean());return e},readPackedFloat:function(e){if(this.type!==Z.Bytes)return e.push(this.readFloat());var t=lt(this);for(e=e||[];this.pos<t;)e.push(this.readFloat());return e},readPackedDouble:function(e){if(this.type!==Z.Bytes)return e.push(this.readDouble());var t=lt(this);for(e=e||[];this.pos<t;)e.push(this.readDouble());return e},readPackedFixed32:function(e){if(this.type!==Z.Bytes)return e.push(this.readFixed32());var t=lt(this);for(e=e||[];this.pos<t;)e.push(this.readFixed32());return e},readPackedSFixed32:function(e){if(this.type!==Z.Bytes)return e.push(this.readSFixed32());var t=lt(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed32());return e},readPackedFixed64:function(e){if(this.type!==Z.Bytes)return e.push(this.readFixed64());var t=lt(this);for(e=e||[];this.pos<t;)e.push(this.readFixed64());return e},readPackedSFixed64:function(e){if(this.type!==Z.Bytes)return e.push(this.readSFixed64());var t=lt(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed64());return e},skip:function(e){var t=e&7;if(t===Z.Varint)for(;this.buf[this.pos++]>127;);else if(t===Z.Bytes)this.pos=this.readVarint()+this.pos;else if(t===Z.Fixed32)this.pos+=4;else if(t===Z.Fixed64)this.pos+=8;else throw new Error("Unimplemented type: "+t)},writeTag:function(e,t){this.writeVarint(e<<3|t)},realloc:function(e){for(var t=this.length||16;t<this.pos+e;)t*=2;if(t!==this.length){var r=new Uint8Array(t);r.set(this.buf),this.buf=r,this.length=t}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(e){this.realloc(4),Cr(this.buf,e,this.pos),this.pos+=4},writeSFixed32:function(e){this.realloc(4),Cr(this.buf,e,this.pos),this.pos+=4},writeFixed64:function(e){this.realloc(8),Cr(this.buf,e&-1,this.pos),Cr(this.buf,Math.floor(e*bp),this.pos+4),this.pos+=8},writeSFixed64:function(e){this.realloc(8),Cr(this.buf,e&-1,this.pos),Cr(this.buf,Math.floor(e*bp),this.pos+4),this.pos+=8},writeVarint:function(e){if(e=+e||0,e>268435455||e<0){jg(e,this);return}this.realloc(4),this.buf[this.pos++]=e&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=(e>>>=7)&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=(e>>>=7)&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=e>>>7&127)))},writeSVarint:function(e){this.writeVarint(e<0?-e*2-1:e*2)},writeBoolean:function(e){this.writeVarint(!!e)},writeString:function(e){e=String(e),this.realloc(e.length*4),this.pos++;var t=this.pos;this.pos=ox(this.buf,e,this.pos);var r=this.pos-t;r>=128&&vp(t,r,this),this.pos=t-1,this.writeVarint(r),this.pos+=r},writeFloat:function(e){this.realloc(4),Ro.write(this.buf,e,this.pos,!0,23,4),this.pos+=4},writeDouble:function(e){this.realloc(8),Ro.write(this.buf,e,this.pos,!0,52,8),this.pos+=8},writeBytes:function(e){var t=e.length;this.writeVarint(t),this.realloc(t);for(var r=0;r<t;r++)this.buf[this.pos++]=e[r]},writeRawMessage:function(e,t){this.pos++;var r=this.pos;e(t,this);var n=this.pos-r;n>=128&&vp(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n},writeMessage:function(e,t,r){this.writeTag(e,Z.Bytes),this.writeRawMessage(t,r)},writePackedVarint:function(e,t){t.length&&this.writeMessage(e,Wg,t)},writePackedSVarint:function(e,t){t.length&&this.writeMessage(e,Hg,t)},writePackedBoolean:function(e,t){t.length&&this.writeMessage(e,Xg,t)},writePackedFloat:function(e,t){t.length&&this.writeMessage(e,Kg,t)},writePackedDouble:function(e,t){t.length&&this.writeMessage(e,Yg,t)},writePackedFixed32:function(e,t){t.length&&this.writeMessage(e,Qg,t)},writePackedSFixed32:function(e,t){t.length&&this.writeMessage(e,ex,t)},writePackedFixed64:function(e,t){t.length&&this.writeMessage(e,tx,t)},writePackedSFixed64:function(e,t){t.length&&this.writeMessage(e,rx,t)},writeBytesField:function(e,t){this.writeTag(e,Z.Bytes),this.writeBytes(t)},writeFixed32Field:function(e,t){this.writeTag(e,Z.Fixed32),this.writeFixed32(t)},writeSFixed32Field:function(e,t){this.writeTag(e,Z.Fixed32),this.writeSFixed32(t)},writeFixed64Field:function(e,t){this.writeTag(e,Z.Fixed64),this.writeFixed64(t)},writeSFixed64Field:function(e,t){this.writeTag(e,Z.Fixed64),this.writeSFixed64(t)},writeVarintField:function(e,t){this.writeTag(e,Z.Varint),this.writeVarint(t)},writeSVarintField:function(e,t){this.writeTag(e,Z.Varint),this.writeSVarint(t)},writeStringField:function(e,t){this.writeTag(e,Z.Bytes),this.writeString(t)},writeFloatField:function(e,t){this.writeTag(e,Z.Fixed32),this.writeFloat(t)},writeDoubleField:function(e,t){this.writeTag(e,Z.Fixed64),this.writeDouble(t)},writeBooleanField:function(e,t){this.writeVarintField(e,!!t)}};function qg(e,t,r){var n=r.buf,i,o;if(o=n[r.pos++],i=(o&112)>>4,o<128||(o=n[r.pos++],i|=(o&127)<<3,o<128)||(o=n[r.pos++],i|=(o&127)<<10,o<128)||(o=n[r.pos++],i|=(o&127)<<17,o<128)||(o=n[r.pos++],i|=(o&127)<<24,o<128)||(o=n[r.pos++],i|=(o&1)<<31,o<128))return Tr(e,i,t);throw new Error("Expected varint not more than 10 bytes")}function lt(e){return e.type===Z.Bytes?e.readVarint()+e.pos:e.pos+1}function Tr(e,t,r){return r?t*4294967296+(e>>>0):(t>>>0)*4294967296+(e>>>0)}function jg(e,t){var r,n;if(e>=0?(r=e%4294967296|0,n=e/4294967296|0):(r=~(-e%4294967296),n=~(-e/4294967296),r^4294967295?r=r+1|0:(r=0,n=n+1|0)),e>=18446744073709552e3||e<-18446744073709552e3)throw new Error("Given varint doesn\'t fit into 10 bytes");t.realloc(10),Jg(r,n,t),Zg(n,t)}function Jg(e,t,r){r.buf[r.pos++]=e&127|128,e>>>=7,r.buf[r.pos++]=e&127|128,e>>>=7,r.buf[r.pos++]=e&127|128,e>>>=7,r.buf[r.pos++]=e&127|128,e>>>=7,r.buf[r.pos]=e&127}function Zg(e,t){var r=(e&7)<<4;t.buf[t.pos++]|=r|((e>>>=3)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127)))))}function vp(e,t,r){var n=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(Math.LN2*7));r.realloc(n);for(var i=r.pos-1;i>=e;i--)r.buf[i+n]=r.buf[i]}function Wg(e,t){for(var r=0;r<e.length;r++)t.writeVarint(e[r])}function Hg(e,t){for(var r=0;r<e.length;r++)t.writeSVarint(e[r])}function Kg(e,t){for(var r=0;r<e.length;r++)t.writeFloat(e[r])}function Yg(e,t){for(var r=0;r<e.length;r++)t.writeDouble(e[r])}function Xg(e,t){for(var r=0;r<e.length;r++)t.writeBoolean(e[r])}function Qg(e,t){for(var r=0;r<e.length;r++)t.writeFixed32(e[r])}function ex(e,t){for(var r=0;r<e.length;r++)t.writeSFixed32(e[r])}function tx(e,t){for(var r=0;r<e.length;r++)t.writeFixed64(e[r])}function rx(e,t){for(var r=0;r<e.length;r++)t.writeSFixed64(e[r])}function Oo(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+e[t+3]*16777216}function Cr(e,t,r){e[r]=t,e[r+1]=t>>>8,e[r+2]=t>>>16,e[r+3]=t>>>24}function Pp(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+(e[t+3]<<24)}function nx(e,t,r){for(var n="",i=t;i<r;){var o=e[i],a=null,s=o>239?4:o>223?3:o>191?2:1;if(i+s>r)break;var l,u,c;s===1?o<128&&(a=o):s===2?(l=e[i+1],(l&192)===128&&(a=(o&31)<<6|l&63,a<=127&&(a=null))):s===3?(l=e[i+1],u=e[i+2],(l&192)===128&&(u&192)===128&&(a=(o&15)<<12|(l&63)<<6|u&63,(a<=2047||a>=55296&&a<=57343)&&(a=null))):s===4&&(l=e[i+1],u=e[i+2],c=e[i+3],(l&192)===128&&(u&192)===128&&(c&192)===128&&(a=(o&15)<<18|(l&63)<<12|(u&63)<<6|c&63,(a<=65535||a>=1114112)&&(a=null))),a===null?(a=65533,s=1):a>65535&&(a-=65536,n+=String.fromCharCode(a>>>10&1023|55296),a=56320|a&1023),n+=String.fromCharCode(a),i+=s}return n}function ix(e,t,r){return Sp.decode(e.subarray(t,r))}function ox(e,t,r){for(var n=0,i,o;n<t.length;n++){if(i=t.charCodeAt(n),i>55295&&i<57344)if(o)if(i<56320){e[r++]=239,e[r++]=191,e[r++]=189,o=i;continue}else i=o-55296<<10|i-56320|65536,o=null;else{i>56319||n+1===t.length?(e[r++]=239,e[r++]=191,e[r++]=189):o=i;continue}else o&&(e[r++]=239,e[r++]=191,e[r++]=189,o=null);i<128?e[r++]=i:(i<2048?e[r++]=i>>6|192:(i<65536?e[r++]=i>>12|224:(e[r++]=i>>18|240,e[r++]=i>>12&63|128),e[r++]=i>>6&63|128),e[r++]=i&63|128)}return r}});var bf=Ae((nI,xf)=>{xf.exports=la;function la(e,t){var r=e&&e.type,n;if(r==="FeatureCollection")for(n=0;n<e.features.length;n++)la(e.features[n],t);else if(r==="GeometryCollection")for(n=0;n<e.geometries.length;n++)la(e.geometries[n],t);else if(r==="Feature")la(e.geometry,t);else if(r==="Polygon")df(e.coordinates,t);else if(r==="MultiPolygon")for(n=0;n<e.coordinates.length;n++)df(e.coordinates[n],t);return e}function df(e,t){if(e.length!==0){gf(e[0],t);for(var r=1;r<e.length;r++)gf(e[r],!t)}}function gf(e,t){for(var r=0,n=0,i=0,o=e.length,a=o-1;i<o;a=i++){var s=(e[i][0]-e[a][0])*(e[a][1]+e[i][1]),l=r+s;n+=Math.abs(r)>=Math.abs(s)?r-l+s:s-l+r,r=l}r+n>=0!=!!t&&e.reverse()}});var wf=Ae((aI,Sf)=>{"use strict";var Nx=de(),Gx=It().VectorTileFeature;Sf.exports=Pf;function Pf(e,t){this.options=t||{},this.features=e,this.length=e.length}Pf.prototype.feature=function(e){return new ca(this.features[e],this.options.extent)};function ca(e,t){this.id=typeof e.id=="number"?e.id:void 0,this.type=e.type,this.rawGeometry=e.type===1?[e.geometry]:e.geometry,this.properties=e.tags,this.extent=t||4096}ca.prototype.loadGeometry=function(){var e=this.rawGeometry;this.geometry=[];for(var t=0;t<e.length;t++){for(var r=e[t],n=[],i=0;i<r.length;i++)n.push(new Nx(r[i][0],r[i][1]));this.geometry.push(n)}return this.geometry};ca.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var e=this.geometry,t=1/0,r=-1/0,n=1/0,i=-1/0,o=0;o<e.length;o++)for(var a=e[o],s=0;s<a.length;s++){var l=a[s];t=Math.min(t,l.x),r=Math.max(r,l.x),n=Math.min(n,l.y),i=Math.max(i,l.y)}return[t,n,r,i]};ca.prototype.toGeoJSON=Gx.prototype.toGeoJSON});var If=Ae((sI,si)=>{var $x=qn(),_f=wf();si.exports=Ws;si.exports.fromVectorTileJs=Ws;si.exports.fromGeojsonVt=qx;si.exports.GeoJSONWrapper=_f;function Ws(e){var t=new $x;return jx(e,t),t.finish()}function qx(e,t){t=t||{};var r={};for(var n in e)r[n]=new _f(e[n].features,t),r[n].name=n,r[n].version=t.version,r[n].extent=t.extent;return Ws({layers:r})}function jx(e,t){for(var r in e.layers)t.writeMessage(3,Jx,e.layers[r])}function Jx(e,t){t.writeVarintField(15,e.version||1),t.writeStringField(1,e.name||""),t.writeVarintField(5,e.extent||4096);var r,n={keys:[],values:[],keycache:{},valuecache:{}};for(r=0;r<e.length;r++)n.feature=e.feature(r),t.writeMessage(2,Zx,n);var i=n.keys;for(r=0;r<i.length;r++)t.writeStringField(3,i[r]);var o=n.values;for(r=0;r<o.length;r++)t.writeMessage(4,Kx,o[r])}function Zx(e,t){var r=e.feature;r.id!==void 0&&t.writeVarintField(1,r.id),t.writeMessage(2,Wx,e),t.writeVarintField(3,r.type),t.writeMessage(4,Hx,r)}function Wx(e,t){var r=e.feature,n=e.keys,i=e.values,o=e.keycache,a=e.valuecache;for(var s in r.properties){var l=r.properties[s],u=o[s];if(l!==null){typeof u>"u"&&(n.push(s),u=n.length-1,o[s]=u),t.writeVarint(u);var c=typeof l;c!=="string"&&c!=="boolean"&&c!=="number"&&(l=JSON.stringify(l));var p=c+":"+l,f=a[p];typeof f>"u"&&(i.push(l),f=i.length-1,a[p]=f),t.writeVarint(f)}}}function Zs(e,t){return(t<<3)+(e&7)}function Af(e){return e<<1^e>>31}function Hx(e,t){for(var r=e.loadGeometry(),n=e.type,i=0,o=0,a=r.length,s=0;s<a;s++){var l=r[s],u=1;n===1&&(u=l.length),t.writeVarint(Zs(1,u));for(var c=n===3?l.length-1:l.length,p=0;p<c;p++){p===1&&n!==1&&t.writeVarint(Zs(2,c-1));var f=l[p].x-i,y=l[p].y-o;t.writeVarint(Af(f)),t.writeVarint(Af(y)),i+=f,o+=y}n===3&&t.writeVarint(Zs(7,1))}}function Kx(e,t){var r=typeof e;r==="string"?t.writeStringField(1,e):r==="boolean"?t.writeBooleanField(7,e):r==="number"&&(e%1!==0?t.writeDoubleField(3,e):e<0?t.writeSVarintField(6,e):t.writeVarintField(5,e))}});var Kf=J(de(),1),Pl=J(Aa(),1);var _a;function xl(){return _a==null&&(_a=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),_a}var gi;function bl(){if(gi==null&&(gi=!1,xl())){let r=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(r){for(let i=0;i<5*5;i++){let o=i*4;r.fillStyle="rgb(".concat(o,",").concat(o+1,",").concat(o+2,")"),r.fillRect(i%5,Math.floor(i/5),1,1)}let n=r.getImageData(0,0,5,5).data;for(let i=0;i<5*5*4;i++)if(i%4!==3&&n[i]!==i){gi=!0;break}}}return gi||!1}function Sl(e){if(e<=0)return 0;if(e>=1)return 1;let t=e*e,r=t*e;return 4*(e<.5?r:3*(e-t)+r-.75)}function Yf(e,t,r,n){let i=new Pl.default(e,t,r,n);return function(o){return i.solve(o)}}var db=Yf(.25,.1,.25,1);function tt(e,t,r){return Math.min(r,Math.max(t,e))}function wl(e,t,r){let n=r-t,i=((e-t)%n+n)%n+t;return i===t?r:i}function Pe(e,...t){for(let r of t)for(let n in r)e[n]=r[n];return e}function Al(e){return Math.log(e)/Math.LN2%1===0}function Ur(e,t,r){let n={};for(let i in e)n[i]=t.call(r||this,e[i],i,e);return n}function _l(e,t,r){let n={};for(let i in e)t.call(r||this,e[i],i,e)&&(n[i]=e[i]);return n}function et(e){return Array.isArray(e)?e.map(et):typeof e=="object"&&e?Ur(e,et):e}function Il(e,t){for(let r=0;r<e.length;r++)if(t.indexOf(e[r])>=0)return!0;return!1}var vl={};function fe(e){vl[e]||(typeof console<"u"&&console.warn(e),vl[e]=!0)}function rt(e,t,r){return(r.y-e.y)*(t.x-e.x)>(t.y-e.y)*(r.x-e.x)}function Tl(e){let t=0;for(let r=0,n=e.length,i=n-1,o,a;r<n;i=r++)o=e[r],a=e[i],t+=(a.x-o.x)*(o.y+a.y);return t}function nt(e){return typeof WorkerGlobalScope<"u"&&typeof e<"u"&&e instanceof WorkerGlobalScope}function Nr(e){return typeof ImageBitmap<"u"&&e instanceof ImageBitmap}function Xf(e,t,r,n,i){let o=Math.max(-t,0)*4,l=(Math.max(0,r)-r)*n*4+o,u=n*4,c=Math.max(0,t),p=Math.max(0,r),f=Math.min(e.width,t+n),y=Math.min(e.height,r+i);return{rect:{x:c,y:p,width:f-c,height:y-p},layout:[{offset:l,stride:u}]}}async function Qf(e,t,r,n,i){if(typeof VideoFrame>"u")throw new Error("VideoFrame not supported");let o=new VideoFrame(e,{timestamp:0});try{let a=o==null?void 0:o.format;if(!a||!(a.startsWith("BGR")||a.startsWith("RGB")))throw new Error("Unrecognized format ".concat(a));let s=a.startsWith("BGR"),l=new Uint8ClampedArray(n*i*4);if(await o.copyTo(l,Xf(e,t,r,n,i)),s)for(let u=0;u<l.length;u+=4){let c=l[u];l[u]=l[u+2],l[u+2]=c}return l}finally{o.close()}}var Rr,Or;function ey(e,t,r,n,i){let o=e.width,a=e.height;(!Rr||!Or)&&(Rr=new OffscreenCanvas(o,a),Or=Rr.getContext("2d",{willReadFrequently:!0})),Rr.width=o,Rr.height=a,Or.drawImage(e,0,0,o,a);let s=Or.getImageData(t,r,n,i);return Or.clearRect(0,0,o,a),s.data}async function Cl(e,t,r,n,i){if(bl())try{return await Qf(e,t,r,n,i)}catch{}return ey(e,t,r,n,i)}function kl(e,t,r,n){return e.addEventListener(t,r,n),{unsubscribe:()=>{e.removeEventListener(t,r,n)}}}var Lt=class e{constructor(t,r,n){let i=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;let a=new Int32Array(this.arrayBuffer);t=a[0],r=a[1],n=a[2],this.d=r+2*n;for(let u=0;u<this.d*this.d;u++){let c=a[3+u],p=a[3+u+1];i.push(c===p?null:a.subarray(c,p))}let s=a[3+i.length],l=a[3+i.length+1];this.keys=a.subarray(s,l),this.bboxes=a.subarray(l),this.insert=this._insertReadonly}else{this.d=r+2*n;for(let a=0;a<this.d*this.d;a++)i.push([]);this.keys=[],this.bboxes=[]}this.n=r,this.extent=t,this.padding=n,this.scale=r/t,this.uid=0;let o=n/r*t;this.min=-o,this.max=t+o}insert(t,r,n,i,o){this._forEachCell(r,n,i,o,this._insertCell,this.uid++,void 0,void 0),this.keys.push(t),this.bboxes.push(r),this.bboxes.push(n),this.bboxes.push(i),this.bboxes.push(o)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(t,r,n,i,o,a){this.cells[o].push(a)}query(t,r,n,i,o){let a=this.min,s=this.max;if(t<=a&&r<=a&&s<=n&&s<=i&&!o)return Array.prototype.slice.call(this.keys);{let l=[],u={};return this._forEachCell(t,r,n,i,this._queryCell,l,u,o),l}}_queryCell(t,r,n,i,o,a,s,l){let u=this.cells[o];if(u!==null){let c=this.keys,p=this.bboxes;for(let f=0;f<u.length;f++){let y=u[f];if(s[y]===void 0){let m=y*4;(l?l(p[m+0],p[m+1],p[m+2],p[m+3]):t<=p[m+2]&&r<=p[m+3]&&n>=p[m+0]&&i>=p[m+1])?(s[y]=!0,a.push(c[y])):s[y]=!1}}}}_forEachCell(t,r,n,i,o,a,s,l){let u=this._convertToCellCoord(t),c=this._convertToCellCoord(r),p=this._convertToCellCoord(n),f=this._convertToCellCoord(i);for(let y=u;y<=p;y++)for(let m=c;m<=f;m++){let h=this.d*m+y;if(!(l&&!l(this._convertFromCellCoord(y),this._convertFromCellCoord(m),this._convertFromCellCoord(y+1),this._convertFromCellCoord(m+1)))&&o.call(this,t,r,n,i,h,a,s,l))return}}_convertFromCellCoord(t){return(t-this.padding)/this.scale}_convertToCellCoord(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;let t=this.cells,r=3+this.cells.length+1+1,n=0;for(let a=0;a<this.cells.length;a++)n+=this.cells[a].length;let i=new Int32Array(r+n+this.keys.length+this.bboxes.length);i[0]=this.extent,i[1]=this.n,i[2]=this.padding;let o=r;for(let a=0;a<t.length;a++){let s=t[a];i[3+a]=o,i.set(s,o),o+=s.length}return i[3+t.length]=o,i.set(this.keys,o),o+=this.keys.length,i[3+t.length+1]=o,i.set(this.bboxes,o),o+=this.bboxes.length,i.buffer}static serialize(t,r){let n=t.toArrayBuffer();return r&&r.push(n),{buffer:n}}static deserialize(t){return new e(t.buffer)}};var ql=J(Aa(),1),ty=8,ry={version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},ny={"*":{type:"source"}},iy=["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],oy={type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},ay={type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},sy={type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{}},default:"mapbox"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},ly={type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},uy={type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},cy={type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},py={id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},fy=["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],yy={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},my={"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},hy={"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},dy={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},gy={"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},xy={"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},by={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},vy={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},Py={type:"array",value:"*"},Sy={type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{},within:{}}},wy={type:"enum",values:{Point:{},LineString:{},Polygon:{}}},Ay={type:"array",minimum:0,maximum:24,value:["number","color"],length:2},_y={type:"array",value:"*",minimum:1},Iy={anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},Ty={source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},Cy=["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],ky={"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},My={"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},Ey={"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},Fy={"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},Ly={"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},Dy={"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},Vy={"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},By={"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},zy={duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},Ry={"*":{type:"string"}},S={$version:ty,$root:ry,sources:ny,source:iy,source_vector:oy,source_raster:ay,source_raster_dem:sy,source_geojson:ly,source_video:uy,source_image:cy,layer:py,layout:fy,layout_background:yy,layout_fill:my,layout_circle:hy,layout_heatmap:dy,"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:gy,layout_symbol:xy,layout_raster:by,layout_hillshade:vy,filter:Py,filter_operator:Sy,geometry_type:wy,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:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:Ay,expression:_y,light:Iy,terrain:Ty,paint:Cy,paint_fill:ky,"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:My,paint_circle:Ey,paint_heatmap:Fy,paint_symbol:Ly,paint_raster:Dy,paint_hillshade:Vy,paint_background:By,transition:zy,"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:Ry},Oy=["type","source","source-layer","minzoom","maxzoom","filter","layout"];var L=class{constructor(t,r,n,i){this.message=(t?"".concat(t,": "):"")+n,i&&(this.identifier=i),r!=null&&r.__line__&&(this.line=r.__line__)}};function lr(e,...t){for(let r of t)for(let n in r)e[n]=r[n];return e}var Be=class extends Error{constructor(t,r){super(r),this.message=r,this.key=t}},La=class e{constructor(t,r=[]){this.parent=t,this.bindings={};for(let[n,i]of r)this.bindings[n]=i}concat(t){return new e(this,t)}get(t){if(this.bindings[t])return this.bindings[t];if(this.parent)return this.parent.get(t);throw new Error("".concat(t," not found in scope."))}has(t){return this.bindings[t]?!0:this.parent?this.parent.has(t):!1}},pr={kind:"null"},F={kind:"number"},$={kind:"string"},N={kind:"boolean"},Re={kind:"color"},ar={kind:"object"},G={kind:"value"},Uy={kind:"error"},Li={kind:"collator"},fr={kind:"formatted"},Di={kind:"padding"},en={kind:"resolvedImage"},Vi={kind:"variableAnchorOffsetCollection"};function Ee(e,t){return{kind:"array",itemType:e,N:t}}function te(e){if(e.kind==="array"){let t=te(e.itemType);return typeof e.N=="number"?"array<".concat(t,", ").concat(e.N,">"):e.itemType.kind==="value"?"array":"array<".concat(t,">")}else return e.kind}var Ny=[pr,F,$,N,Re,fr,ar,Ee(G),Di,en,Vi];function jr(e,t){if(t.kind==="error")return null;if(e.kind==="array"){if(t.kind==="array"&&(t.N===0&&t.itemType.kind==="value"||!jr(e.itemType,t.itemType))&&(typeof e.N!="number"||e.N===t.N))return null}else{if(e.kind===t.kind)return null;if(e.kind==="value"){for(let r of Ny)if(!jr(r,t))return null}}return"Expected ".concat(te(e)," but found ").concat(te(t)," instead.")}function ja(e,t){return t.some(r=>r.kind===e.kind)}function Jr(e,t){return t.some(r=>r==="null"?e===null:r==="array"?Array.isArray(e):r==="object"?e&&!Array.isArray(e)&&typeof e=="object":r===typeof e)}function Gr(e,t){return e.kind==="array"&&t.kind==="array"?e.itemType.kind===t.itemType.kind&&typeof e.N=="number":e.kind===t.kind}var jl=.96422,Jl=1,Zl=.82521,Wl=4/29,sr=6/29,Hl=3*sr*sr,Gy=sr*sr*sr,$y=Math.PI/180,qy=180/Math.PI;function Kl(e){return e=e%360,e<0&&(e+=360),e}function Yl([e,t,r,n]){e=Ia(e),t=Ia(t),r=Ia(r);let i,o,a=Ta((.2225045*e+.7168786*t+.0606169*r)/Jl);e===t&&t===r?i=o=a:(i=Ta((.4360747*e+.3850649*t+.1430804*r)/jl),o=Ta((.0139322*e+.0971045*t+.7141733*r)/Zl));let s=116*a-16;return[s<0?0:s,500*(i-a),200*(a-o),n]}function Ia(e){return e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function Ta(e){return e>Gy?Math.pow(e,1/3):e/Hl+Wl}function Xl([e,t,r,n]){let i=(e+16)/116,o=isNaN(t)?i:i+t/500,a=isNaN(r)?i:i-r/200;return i=Jl*ka(i),o=jl*ka(o),a=Zl*ka(a),[Ca(3.1338561*o-1.6168667*i-.4906146*a),Ca(-.9787684*o+1.9161415*i+.033454*a),Ca(.0719453*o-.2289914*i+1.4052427*a),n]}function Ca(e){return e=e<=.00304?12.92*e:1.055*Math.pow(e,1/2.4)-.055,e<0?0:e>1?1:e}function ka(e){return e>sr?e*e*e:Hl*(e-Wl)}function jy(e){let[t,r,n,i]=Yl(e),o=Math.sqrt(r*r+n*n);return[Math.round(o*1e4)?Kl(Math.atan2(n,r)*qy):NaN,o,t,i]}function Jy([e,t,r,n]){return e=isNaN(e)?0:e*$y,Xl([r,Math.cos(e)*t,Math.sin(e)*t,n])}function Zy([e,t,r,n]){e=Kl(e),t/=100,r/=100;function i(o){let a=(o+e/30)%12,s=t*Math.min(r,1-r);return r-s*Math.max(-1,Math.min(a-3,9-a,1))}return[i(0),i(8),i(4),n]}function Wy(e){if(e=e.toLowerCase().trim(),e==="transparent")return[0,0,0,0];let t=Hy[e];if(t){let[i,o,a]=t;return[i/255,o/255,a/255,1]}if(e.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(e)){let o=e.length<6?1:2,a=1;return[xi(e.slice(a,a+=o)),xi(e.slice(a,a+=o)),xi(e.slice(a,a+=o)),xi(e.slice(a,a+o)||"ff")]}if(e.startsWith("rgb")){let i=/^rgba?\\(\\s*([\\de.+-]+)(%)?(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)(%)?(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)(%)?(?:\\s*([,\\/])\\s*([\\de.+-]+)(%)?)?\\s*\\)$/,o=e.match(i);if(o){let[a,s,l,u,c,p,f,y,m,h,d,g]=o,v=[u||" ",f||" ",h].join("");if(v===" "||v===" /"||v===",,"||v===",,,"){let x=[l,p,m].join(""),P=x==="%%%"?100:x===""?255:0;if(P){let b=[ir(+s/P,0,1),ir(+c/P,0,1),ir(+y/P,0,1),d?Ml(+d,g):1];if(El(b))return b}}return}}let r=/^hsla?\\(\\s*([\\de.+-]+)(?:deg)?(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)%(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)%(?:\\s*([,\\/])\\s*([\\de.+-]+)(%)?)?\\s*\\)$/,n=e.match(r);if(n){let[i,o,a,s,l,u,c,p,f]=n,y=[a||" ",l||" ",c].join("");if(y===" "||y===" /"||y===",,"||y===",,,"){let m=[+o,ir(+s,0,100),ir(+u,0,100),p?Ml(+p,f):1];if(El(m))return Zy(m)}}}function xi(e){return parseInt(e.padEnd(2,e),16)/255}function Ml(e,t){return ir(t?e/100:e,0,1)}function ir(e,t,r){return Math.min(Math.max(t,e),r)}function El(e){return!e.some(Number.isNaN)}var Hy={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},W=class e{constructor(t,r,n,i=1,o=!0){this.r=t,this.g=r,this.b=n,this.a=i,o||(this.r*=i,this.g*=i,this.b*=i,i||this.overwriteGetter("rgb",[t,r,n,i]))}static parse(t){if(t instanceof e)return t;if(typeof t!="string")return;let r=Wy(t);if(r)return new e(...r,!1)}get rgb(){let{r:t,g:r,b:n,a:i}=this,o=i||1/0;return this.overwriteGetter("rgb",[t/o,r/o,n/o,i])}get hcl(){return this.overwriteGetter("hcl",jy(this.rgb))}get lab(){return this.overwriteGetter("lab",Yl(this.rgb))}overwriteGetter(t,r){return Object.defineProperty(this,t,{value:r}),r}toString(){let[t,r,n,i]=this.rgb;return"rgba(".concat([t,r,n].map(o=>Math.round(o*255)).join(","),",").concat(i,")")}};W.black=new W(0,0,0,1);W.white=new W(1,1,1,1);W.transparent=new W(0,0,0,0);W.red=new W(1,0,0,1);var Zr=class{constructor(t,r,n){t?this.sensitivity=r?"variant":"case":this.sensitivity=r?"accent":"base",this.locale=n,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(t,r){return this.collator.compare(t,r)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}},Wr=class{constructor(t,r,n,i,o){this.text=t,this.image=r,this.scale=n,this.fontStack=i,this.textColor=o}},Fe=class e{constructor(t){this.sections=t}static fromString(t){return new e([new Wr(t,null,null,null,null)])}isEmpty(){return this.sections.length===0?!0:!this.sections.some(t=>t.text.length!==0||t.image&&t.image.name.length!==0)}static factory(t){return t instanceof e?t:e.fromString(t)}toString(){return this.sections.length===0?"":this.sections.map(t=>t.text).join("")}},Je=class e{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof e)return t;if(typeof t=="number")return new e([t,t,t,t]);if(Array.isArray(t)&&!(t.length<1||t.length>4)){for(let r of t)if(typeof r!="number")return;switch(t.length){case 1:t=[t[0],t[0],t[0],t[0]];break;case 2:t=[t[0],t[1],t[0],t[1]];break;case 3:t=[t[0],t[1],t[2],t[1]];break}return new e(t)}}toString(){return JSON.stringify(this.values)}},Ky=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]),Ue=class e{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof e)return t;if(!(!Array.isArray(t)||t.length<1||t.length%2!==0)){for(let r=0;r<t.length;r+=2){let n=t[r],i=t[r+1];if(typeof n!="string"||!Ky.has(n)||!Array.isArray(i)||i.length!==2||typeof i[0]!="number"||typeof i[1]!="number")return}return new e(t)}}toString(){return JSON.stringify(this.values)}},Te=class e{constructor(t){this.name=t.name,this.available=t.available}toString(){return this.name}static fromString(t){return t?new e({name:t,available:!1}):null}};function Ql(e,t,r,n){if(!(typeof e=="number"&&e>=0&&e<=255&&typeof t=="number"&&t>=0&&t<=255&&typeof r=="number"&&r>=0&&r<=255)){let i=typeof n=="number"?[e,t,r,n]:[e,t,r];return"Invalid rgba value [".concat(i.join(", "),"]: \'r\', \'g\', and \'b\' must be between 0 and 255.")}return typeof n>"u"||typeof n=="number"&&n>=0&&n<=1?null:"Invalid rgba value [".concat([e,t,r,n].join(", "),"]: \'a\' must be between 0 and 1.")}function Si(e){if(e===null||typeof e=="string"||typeof e=="boolean"||typeof e=="number"||e instanceof W||e instanceof Zr||e instanceof Fe||e instanceof Je||e instanceof Ue||e instanceof Te)return!0;if(Array.isArray(e)){for(let t of e)if(!Si(t))return!1;return!0}else if(typeof e=="object"){for(let t in e)if(!Si(e[t]))return!1;return!0}else return!1}function ue(e){if(e===null)return pr;if(typeof e=="string")return $;if(typeof e=="boolean")return N;if(typeof e=="number")return F;if(e instanceof W)return Re;if(e instanceof Zr)return Li;if(e instanceof Fe)return fr;if(e instanceof Je)return Di;if(e instanceof Ue)return Vi;if(e instanceof Te)return en;if(Array.isArray(e)){let t=e.length,r;for(let n of e){let i=ue(n);if(!r)r=i;else{if(r===i)continue;r=G;break}}return Ee(r||G,t)}else return ar}function $r(e){let t=typeof e;return e===null?"":t==="string"||t==="number"||t==="boolean"?String(e):e instanceof W||e instanceof Fe||e instanceof Je||e instanceof Ue||e instanceof Te?e.toString():JSON.stringify(e)}var yt=class e{constructor(t,r){this.type=t,this.value=r}static parse(t,r){if(t.length!==2)return r.error("\'literal\' expression requires exactly one argument, but found ".concat(t.length-1," instead."));if(!Si(t[1]))return r.error("invalid value");let n=t[1],i=ue(n),o=r.expectedType;return i.kind==="array"&&i.N===0&&o&&o.kind==="array"&&(typeof o.N!="number"||o.N===0)&&(i=o),new e(i,n)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}},ie=class{constructor(t){this.name="ExpressionEvaluationError",this.message=t}toJSON(){return this.message}},bi={string:$,number:F,boolean:N,object:ar},qe=class e{constructor(t,r){this.type=t,this.args=r}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");let n=1,i,o=t[0];if(o==="array"){let s;if(t.length>2){let u=t[1];if(typeof u!="string"||!(u in bi)||u==="object")return r.error(\'The item type argument of "array" must be one of string, number, boolean\',1);s=bi[u],n++}else s=G;let l;if(t.length>3){if(t[2]!==null&&(typeof t[2]!="number"||t[2]<0||t[2]!==Math.floor(t[2])))return r.error(\'The length argument to "array" must be a positive integer literal\',2);l=t[2],n++}i=Ee(s,l)}else{if(!bi[o])throw new Error("Types doesn\'t contain name = ".concat(o));i=bi[o]}let a=[];for(;n<t.length;n++){let s=r.parse(t[n],n,G);if(!s)return null;a.push(s)}return new e(i,a)}evaluate(t){for(let r=0;r<this.args.length;r++){let n=this.args[r].evaluate(t);if(jr(this.type,ue(n))){if(r===this.args.length-1)throw new ie("Expected value to be of type ".concat(te(this.type),", but found ").concat(te(ue(n))," instead."))}else return n}throw new Error}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}},Fl={"to-boolean":N,"to-color":Re,"to-number":F,"to-string":$},pt=class e{constructor(t,r){this.type=t,this.args=r}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");let n=t[0];if(!Fl[n])throw new Error("Can\'t parse ".concat(n," as it is not part of the known types"));if((n==="to-boolean"||n==="to-string")&&t.length!==2)return r.error("Expected one argument.");let i=Fl[n],o=[];for(let a=1;a<t.length;a++){let s=r.parse(t[a],a,G);if(!s)return null;o.push(s)}return new e(i,o)}evaluate(t){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(t);case"color":{let r,n;for(let i of this.args){if(r=i.evaluate(t),n=null,r instanceof W)return r;if(typeof r=="string"){let o=t.parseColor(r);if(o)return o}else if(Array.isArray(r)&&(r.length<3||r.length>4?n="Invalid rbga value ".concat(JSON.stringify(r),": expected an array containing either three or four numeric values."):n=Ql(r[0],r[1],r[2],r[3]),!n))return new W(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new ie(n||"Could not parse color from value \'".concat(typeof r=="string"?r:JSON.stringify(r),"\'"))}case"padding":{let r;for(let n of this.args){r=n.evaluate(t);let i=Je.parse(r);if(i)return i}throw new ie("Could not parse padding from value \'".concat(typeof r=="string"?r:JSON.stringify(r),"\'"))}case"variableAnchorOffsetCollection":{let r;for(let n of this.args){r=n.evaluate(t);let i=Ue.parse(r);if(i)return i}throw new ie("Could not parse variableAnchorOffsetCollection from value \'".concat(typeof r=="string"?r:JSON.stringify(r),"\'"))}case"number":{let r=null;for(let n of this.args){if(r=n.evaluate(t),r===null)return 0;let i=Number(r);if(!isNaN(i))return i}throw new ie("Could not convert ".concat(JSON.stringify(r)," to number."))}case"formatted":return Fe.fromString($r(this.args[0].evaluate(t)));case"resolvedImage":return Te.fromString($r(this.args[0].evaluate(t)));default:return $r(this.args[0].evaluate(t))}}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}},Yy=["Unknown","Point","LineString","Polygon"],wi=class{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?Yy[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(t){let r=this._parseColorCache[t];return r||(r=this._parseColorCache[t]=W.parse(t)),r}},Ai=class e{constructor(t,r,n=[],i,o=new La,a=[]){this.registry=t,this.path=n,this.key=n.map(s=>"[".concat(s,"]")).join(""),this.scope=o,this.errors=a,this.expectedType=i,this._isConstant=r}parse(t,r,n,i,o={}){return r?this.concat(r,n,i)._parse(t,o):this._parse(t,o)}_parse(t,r){(t===null||typeof t=="string"||typeof t=="boolean"||typeof t=="number")&&(t=["literal",t]);function n(i,o,a){return a==="assert"?new qe(o,[i]):a==="coerce"?new pt(o,[i]):i}if(Array.isArray(t)){if(t.length===0)return this.error(\'Expected an array with at least one element. If you wanted a literal array, use ["literal", []].\');let i=t[0];if(typeof i!="string")return this.error("Expression name must be a string, but found ".concat(typeof i,\' instead. If you wanted a literal array, use ["literal", [...]].\'),0),null;let o=this.registry[i];if(o){let a=o.parse(t,this);if(!a)return null;if(this.expectedType){let s=this.expectedType,l=a.type;if((s.kind==="string"||s.kind==="number"||s.kind==="boolean"||s.kind==="object"||s.kind==="array")&&l.kind==="value")a=n(a,s,r.typeAnnotation||"assert");else if((s.kind==="color"||s.kind==="formatted"||s.kind==="resolvedImage")&&(l.kind==="value"||l.kind==="string"))a=n(a,s,r.typeAnnotation||"coerce");else if(s.kind==="padding"&&(l.kind==="value"||l.kind==="number"||l.kind==="array"))a=n(a,s,r.typeAnnotation||"coerce");else if(s.kind==="variableAnchorOffsetCollection"&&(l.kind==="value"||l.kind==="array"))a=n(a,s,r.typeAnnotation||"coerce");else if(this.checkSubtype(s,l))return null}if(!(a instanceof yt)&&a.type.kind!=="resolvedImage"&&this._isConstant(a)){let s=new wi;try{a=new yt(a.type,a.evaluate(s))}catch(l){return this.error(l.message),null}}return a}return this.error(\'Unknown expression "\'.concat(i,\'". If you wanted a literal array, use ["literal", [...]].\'),0)}else return typeof t>"u"?this.error("\'undefined\' value invalid. Use null instead."):typeof t=="object"?this.error(\'Bare objects invalid. Use ["literal", {...}] instead.\'):this.error("Expected an array, but found ".concat(typeof t," instead."))}concat(t,r,n){let i=typeof t=="number"?this.path.concat(t):this.path,o=n?this.scope.concat(n):this.scope;return new e(this.registry,this._isConstant,i,r||null,o,this.errors)}error(t,...r){let n="".concat(this.key).concat(r.map(i=>"[".concat(i,"]")).join(""));this.errors.push(new Be(n,t))}checkSubtype(t,r){let n=jr(t,r);return n&&this.error(n),n}},_i=class e{constructor(t,r,n){this.type=Li,this.locale=n,this.caseSensitive=t,this.diacriticSensitive=r}static parse(t,r){if(t.length!==2)return r.error("Expected one argument.");let n=t[1];if(typeof n!="object"||Array.isArray(n))return r.error("Collator options argument must be an object.");let i=r.parse(n["case-sensitive"]===void 0?!1:n["case-sensitive"],1,N);if(!i)return null;let o=r.parse(n["diacritic-sensitive"]===void 0?!1:n["diacritic-sensitive"],1,N);if(!o)return null;let a=null;return n.locale&&(a=r.parse(n.locale,1,$),!a)?null:new e(i,o,a)}evaluate(t){return new Zr(this.caseSensitive.evaluate(t),this.diacriticSensitive.evaluate(t),this.locale?this.locale.evaluate(t):null)}eachChild(t){t(this.caseSensitive),t(this.diacriticSensitive),this.locale&&t(this.locale)}outputDefined(){return!1}},ft=8192;function Ja(e,t){e[0]=Math.min(e[0],t[0]),e[1]=Math.min(e[1],t[1]),e[2]=Math.max(e[2],t[0]),e[3]=Math.max(e[3],t[1])}function Xy(e){return(180+e)/360}function Qy(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}function Ii(e,t){return!(e[0]<=t[0]||e[2]>=t[2]||e[1]<=t[1]||e[3]>=t[3])}function em(e,t){let r=Xy(e[0]),n=Qy(e[1]),i=Math.pow(2,t.z);return[Math.round(r*i*ft),Math.round(n*i*ft)]}function tm(e,t,r){let n=e[0]-t[0],i=e[1]-t[1],o=e[0]-r[0],a=e[1]-r[1];return n*a-o*i===0&&n*o<=0&&i*a<=0}function rm(e,t,r){return t[1]>e[1]!=r[1]>e[1]&&e[0]<(r[0]-t[0])*(e[1]-t[1])/(r[1]-t[1])+t[0]}function Za(e,t){let r=!1;for(let n=0,i=t.length;n<i;n++){let o=t[n];for(let a=0,s=o.length;a<s-1;a++){if(tm(e,o[a],o[a+1]))return!1;rm(e,o[a],o[a+1])&&(r=!r)}}return r}function nm(e,t){for(let r=0;r<t.length;r++)if(Za(e,t[r]))return!0;return!1}function im(e,t){return e[0]*t[1]-e[1]*t[0]}function Ll(e,t,r,n){let i=e[0]-r[0],o=e[1]-r[1],a=t[0]-r[0],s=t[1]-r[1],l=n[0]-r[0],u=n[1]-r[1],c=i*u-l*o,p=a*u-l*s;return c>0&&p<0||c<0&&p>0}function om(e,t,r,n){let i=[t[0]-e[0],t[1]-e[1]],o=[n[0]-r[0],n[1]-r[1]];return im(o,i)===0?!1:!!(Ll(e,t,r,n)&&Ll(r,n,e,t))}function am(e,t,r){for(let n of r)for(let i=0;i<n.length-1;++i)if(om(e,t,n[i],n[i+1]))return!0;return!1}function eu(e,t){for(let r=0;r<e.length;++r)if(!Za(e[r],t))return!1;for(let r=0;r<e.length-1;++r)if(am(e[r],e[r+1],t))return!1;return!0}function sm(e,t){for(let r=0;r<t.length;r++)if(eu(e,t[r]))return!0;return!1}function Wa(e,t,r){let n=[];for(let i=0;i<e.length;i++){let o=[];for(let a=0;a<e[i].length;a++){let s=em(e[i][a],r);Ja(t,s),o.push(s)}n.push(o)}return n}function tu(e,t,r){let n=[];for(let i=0;i<e.length;i++){let o=Wa(e[i],t,r);n.push(o)}return n}function ru(e,t,r,n){if(e[0]<r[0]||e[0]>r[2]){let i=n*.5,o=e[0]-r[0]>i?-n:r[0]-e[0]>i?n:0;o===0&&(o=e[0]-r[2]>i?-n:r[2]-e[0]>i?n:0),e[0]+=o}Ja(t,e)}function lm(e){e[0]=e[1]=1/0,e[2]=e[3]=-1/0}function Dl(e,t,r,n){let i=Math.pow(2,n.z)*ft,o=[n.x*ft,n.y*ft],a=[];for(let s of e)for(let l of s){let u=[l.x+o[0],l.y+o[1]];ru(u,t,r,i),a.push(u)}return a}function Vl(e,t,r,n){let i=Math.pow(2,n.z)*ft,o=[n.x*ft,n.y*ft],a=[];for(let s of e){let l=[];for(let u of s){let c=[u.x+o[0],u.y+o[1]];Ja(t,c),l.push(c)}a.push(l)}if(t[2]-t[0]<=i/2){lm(t);for(let s of a)for(let l of s)ru(l,t,r,i)}return a}function um(e,t){let r=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],i=e.canonicalID();if(t.type==="Polygon"){let o=Wa(t.coordinates,n,i),a=Dl(e.geometry(),r,n,i);if(!Ii(r,n))return!1;for(let s of a)if(!Za(s,o))return!1}if(t.type==="MultiPolygon"){let o=tu(t.coordinates,n,i),a=Dl(e.geometry(),r,n,i);if(!Ii(r,n))return!1;for(let s of a)if(!nm(s,o))return!1}return!0}function cm(e,t){let r=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],i=e.canonicalID();if(t.type==="Polygon"){let o=Wa(t.coordinates,n,i),a=Vl(e.geometry(),r,n,i);if(!Ii(r,n))return!1;for(let s of a)if(!eu(s,o))return!1}if(t.type==="MultiPolygon"){let o=tu(t.coordinates,n,i),a=Vl(e.geometry(),r,n,i);if(!Ii(r,n))return!1;for(let s of a)if(!sm(s,o))return!1}return!0}var Hr=class e{constructor(t,r){this.type=N,this.geojson=t,this.geometries=r}static parse(t,r){if(t.length!==2)return r.error("\'within\' expression requires exactly one argument, but found ".concat(t.length-1," instead."));if(Si(t[1])){let n=t[1];if(n.type==="FeatureCollection")for(let i=0;i<n.features.length;++i){let o=n.features[i].geometry.type;if(o==="Polygon"||o==="MultiPolygon")return new e(n,n.features[i].geometry)}else if(n.type==="Feature"){let i=n.geometry.type;if(i==="Polygon"||i==="MultiPolygon")return new e(n,n.geometry)}else if(n.type==="Polygon"||n.type==="MultiPolygon")return new e(n,n)}return r.error("\'within\' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(t.geometry()!=null&&t.canonicalID()!=null){if(t.geometryType()==="Point")return um(t,this.geometries);if(t.geometryType()==="LineString")return cm(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}},Ti=class e{constructor(t,r){this.type=r.type,this.name=t,this.boundExpression=r}static parse(t,r){if(t.length!==2||typeof t[1]!="string")return r.error("\'var\' expression requires exactly one string literal argument.");let n=t[1];return r.scope.has(n)?new e(n,r.scope.get(n)):r.error(\'Unknown variable "\'.concat(n,\'". Make sure "\').concat(n,\'" has been bound in an enclosing "let" expression before using it.\'),1)}evaluate(t){return this.boundExpression.evaluate(t)}eachChild(){}outputDefined(){return!1}},Ke=class e{constructor(t,r,n,i){this.name=t,this.type=r,this._evaluate=n,this.args=i}evaluate(t){return this._evaluate(t,this.args)}eachChild(t){this.args.forEach(t)}outputDefined(){return!1}static parse(t,r){let n=t[0],i=e.definitions[n];if(!i)return r.error(\'Unknown expression "\'.concat(n,\'". If you wanted a literal array, use ["literal", [...]].\'),0);let o=Array.isArray(i)?i[0]:i.type,a=Array.isArray(i)?[[i[1],i[2]]]:i.overloads,s=a.filter(([u])=>!Array.isArray(u)||u.length===t.length-1),l=null;for(let[u,c]of s){l=new Ai(r.registry,Ci,r.path,null,r.scope);let p=[],f=!1;for(let y=1;y<t.length;y++){let m=t[y],h=Array.isArray(u)?u[y-1]:u.type,d=l.parse(m,1+p.length,h);if(!d){f=!0;break}p.push(d)}if(!f){if(Array.isArray(u)&&u.length!==p.length){l.error("Expected ".concat(u.length," arguments, but found ").concat(p.length," instead."));continue}for(let y=0;y<p.length;y++){let m=Array.isArray(u)?u[y]:u.type,h=p[y];l.concat(y+1).checkSubtype(m,h.type)}if(l.errors.length===0)return new e(n,o,c,p)}}if(s.length===1)r.errors.push(...l.errors);else{let c=(s.length?s:a).map(([f])=>pm(f)).join(" | "),p=[];for(let f=1;f<t.length;f++){let y=r.parse(t[f],1+p.length);if(!y)return null;p.push(te(y.type))}r.error("Expected arguments of type ".concat(c,", but found (").concat(p.join(", "),") instead."))}return null}static register(t,r){e.definitions=r;for(let n in r)t[n]=e}};function pm(e){return Array.isArray(e)?"(".concat(e.map(te).join(", "),")"):"(".concat(te(e.type),"...)")}function Ci(e){if(e instanceof Ti)return Ci(e.boundExpression);if(e instanceof Ke&&e.name==="error")return!1;if(e instanceof _i)return!1;if(e instanceof Hr)return!1;let t=e instanceof pt||e instanceof qe,r=!0;return e.eachChild(n=>{t?r=r&&Ci(n):r=r&&n instanceof yt}),r?Bi(e)&&zi(e,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"]):!1}function Bi(e){if(e instanceof Ke){if(e.name==="get"&&e.args.length===1)return!1;if(e.name==="feature-state")return!1;if(e.name==="has"&&e.args.length===1)return!1;if(e.name==="properties"||e.name==="geometry-type"||e.name==="id")return!1;if(/^filter-/.test(e.name))return!1}if(e instanceof Hr)return!1;let t=!0;return e.eachChild(r=>{t&&!Bi(r)&&(t=!1)}),t}function Kr(e){if(e instanceof Ke&&e.name==="feature-state")return!1;let t=!0;return e.eachChild(r=>{t&&!Kr(r)&&(t=!1)}),t}function zi(e,t){if(e instanceof Ke&&t.indexOf(e.name)>=0)return!1;let r=!0;return e.eachChild(n=>{r&&!zi(n,t)&&(r=!1)}),r}function Ri(e,t){let r=e.length-1,n=0,i=r,o=0,a,s;for(;n<=i;)if(o=Math.floor((n+i)/2),a=e[o],s=e[o+1],a<=t){if(o===r||t<s)return o;n=o+1}else if(a>t)i=o-1;else throw new ie("Input is not a number.");return 0}var ur=class e{constructor(t,r,n){this.type=t,this.input=r,this.labels=[],this.outputs=[];for(let[i,o]of n)this.labels.push(i),this.outputs.push(o)}static parse(t,r){if(t.length-1<4)return r.error("Expected at least 4 arguments, but found only ".concat(t.length-1,"."));if((t.length-1)%2!==0)return r.error("Expected an even number of arguments.");let n=r.parse(t[1],1,F);if(!n)return null;let i=[],o=null;r.expectedType&&r.expectedType.kind!=="value"&&(o=r.expectedType);for(let a=1;a<t.length;a+=2){let s=a===1?-1/0:t[a],l=t[a+1],u=a,c=a+1;if(typeof s!="number")return r.error(\'Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.\',u);if(i.length&&i[i.length-1][0]>=s)return r.error(\'Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.\',u);let p=r.parse(l,c,o);if(!p)return null;o=o||p.type,i.push([s,p])}return new e(o,n,i)}evaluate(t){let r=this.labels,n=this.outputs;if(r.length===1)return n[0].evaluate(t);let i=this.input.evaluate(t);if(i<=r[0])return n[0].evaluate(t);let o=r.length;if(i>=r[o-1])return n[o-1].evaluate(t);let a=Ri(r,i);return n[a].evaluate(t)}eachChild(t){t(this.input);for(let r of this.outputs)t(r)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}};function fm(e){return e==="rgb"||e==="hcl"||e==="lab"}function Vt(e,t,r){return e+r*(t-e)}function ym(e,t,r,n="rgb"){switch(n){case"rgb":{let[i,o,a,s]=ki(e.rgb,t.rgb,r);return new W(i,o,a,s,!1)}case"hcl":{let[i,o,a,s]=e.hcl,[l,u,c,p]=t.hcl,f,y;if(!isNaN(i)&&!isNaN(l)){let v=l-i;l>i&&v>180?v-=360:l<i&&i-l>180&&(v+=360),f=i+r*v}else isNaN(i)?isNaN(l)?f=NaN:(f=l,(a===1||a===0)&&(y=u)):(f=i,(c===1||c===0)&&(y=o));let[m,h,d,g]=Jy([f,y!=null?y:Vt(o,u,r),Vt(a,c,r),Vt(s,p,r)]);return new W(m,h,d,g,!1)}case"lab":{let[i,o,a,s]=Xl(ki(e.lab,t.lab,r));return new W(i,o,a,s,!1)}}}function ki(e,t,r){return e.map((n,i)=>Vt(n,t[i],r))}function mm(e,t,r){return new Je(ki(e.values,t.values,r))}function hm(e,t,r){let n=e.values,i=t.values;if(n.length!==i.length)throw new ie("Cannot interpolate values of different length. from: ".concat(e.toString(),", to: ").concat(t.toString()));let o=[];for(let a=0;a<n.length;a+=2){if(n[a]!==i[a])throw new ie("Cannot interpolate values containing mismatched anchors. from[".concat(a,"]: ").concat(n[a],", to[").concat(a,"]: ").concat(i[a]));o.push(n[a]);let[s,l]=n[a+1],[u,c]=i[a+1];o.push([Vt(s,u,r),Vt(l,c,r)])}return new Ue(o)}var Oe={number:Vt,color:ym,array:ki,padding:mm,variableAnchorOffsetCollection:hm},je=class e{constructor(t,r,n,i,o){this.type=t,this.operator=r,this.interpolation=n,this.input=i,this.labels=[],this.outputs=[];for(let[a,s]of o)this.labels.push(a),this.outputs.push(s)}static interpolationFactor(t,r,n,i){let o=0;if(t.name==="exponential")o=Ma(r,t.base,n,i);else if(t.name==="linear")o=Ma(r,1,n,i);else if(t.name==="cubic-bezier"){let a=t.controlPoints;o=new ql.default(a[0],a[1],a[2],a[3]).solve(Ma(r,1,n,i))}return o}static parse(t,r){let[n,i,o,...a]=t;if(!Array.isArray(i)||i.length===0)return r.error("Expected an interpolation type expression.",1);if(i[0]==="linear")i={name:"linear"};else if(i[0]==="exponential"){let u=i[1];if(typeof u!="number")return r.error("Exponential interpolation requires a numeric base.",1,1);i={name:"exponential",base:u}}else if(i[0]==="cubic-bezier"){let u=i.slice(1);if(u.length!==4||u.some(c=>typeof c!="number"||c<0||c>1))return r.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);i={name:"cubic-bezier",controlPoints:u}}else return r.error("Unknown interpolation type ".concat(String(i[0])),1,0);if(t.length-1<4)return r.error("Expected at least 4 arguments, but found only ".concat(t.length-1,"."));if((t.length-1)%2!==0)return r.error("Expected an even number of arguments.");if(o=r.parse(o,2,F),!o)return null;let s=[],l=null;n==="interpolate-hcl"||n==="interpolate-lab"?l=Re:r.expectedType&&r.expectedType.kind!=="value"&&(l=r.expectedType);for(let u=0;u<a.length;u+=2){let c=a[u],p=a[u+1],f=u+3,y=u+4;if(typeof c!="number")return r.error(\'Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.\',f);if(s.length&&s[s.length-1][0]>=c)return r.error(\'Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.\',f);let m=r.parse(p,y,l);if(!m)return null;l=l||m.type,s.push([c,m])}return!Gr(l,F)&&!Gr(l,Re)&&!Gr(l,Di)&&!Gr(l,Vi)&&!Gr(l,Ee(F))?r.error("Type ".concat(te(l)," is not interpolatable.")):new e(l,n,i,o,s)}evaluate(t){let r=this.labels,n=this.outputs;if(r.length===1)return n[0].evaluate(t);let i=this.input.evaluate(t);if(i<=r[0])return n[0].evaluate(t);let o=r.length;if(i>=r[o-1])return n[o-1].evaluate(t);let a=Ri(r,i),s=r[a],l=r[a+1],u=e.interpolationFactor(this.interpolation,i,s,l),c=n[a].evaluate(t),p=n[a+1].evaluate(t);switch(this.operator){case"interpolate":return Oe[this.type.kind](c,p,u);case"interpolate-hcl":return Oe.color(c,p,u,"hcl");case"interpolate-lab":return Oe.color(c,p,u,"lab")}}eachChild(t){t(this.input);for(let r of this.outputs)t(r)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}};function Ma(e,t,r,n){let i=n-r,o=e-r;return i===0?0:t===1?o/i:(Math.pow(t,o)-1)/(Math.pow(t,i)-1)}var Mi=class e{constructor(t,r){this.type=t,this.args=r}static parse(t,r){if(t.length<2)return r.error("Expectected at least one argument.");let n=null,i=r.expectedType;i&&i.kind!=="value"&&(n=i);let o=[];for(let s of t.slice(1)){let l=r.parse(s,1+o.length,n,void 0,{typeAnnotation:"omit"});if(!l)return null;n=n||l.type,o.push(l)}if(!n)throw new Error("No output type");return i&&o.some(s=>jr(i,s.type))?new e(G,o):new e(n,o)}evaluate(t){let r=null,n=0,i;for(let o of this.args)if(n++,r=o.evaluate(t),r&&r instanceof Te&&!r.available&&(i||(i=r.name),r=null,n===this.args.length&&(r=i)),r!==null)break;return r}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}},Ei=class e{constructor(t,r){this.type=r.type,this.bindings=[].concat(t),this.result=r}evaluate(t){return this.result.evaluate(t)}eachChild(t){for(let r of this.bindings)t(r[1]);t(this.result)}static parse(t,r){if(t.length<4)return r.error("Expected at least 3 arguments, but found ".concat(t.length-1," instead."));let n=[];for(let o=1;o<t.length-1;o+=2){let a=t[o];if(typeof a!="string")return r.error("Expected string, but found ".concat(typeof a," instead."),o);if(/[^a-zA-Z0-9_]/.test(a))return r.error("Variable names must contain only alphanumeric characters or \'_\'.",o);let s=r.parse(t[o+1],o+1);if(!s)return null;n.push([a,s])}let i=r.parse(t[t.length-1],t.length-1,r.expectedType,n);return i?new e(n,i):null}outputDefined(){return this.result.outputDefined()}},Da=class e{constructor(t,r,n){this.type=t,this.index=r,this.input=n}static parse(t,r){if(t.length!==3)return r.error("Expected 2 arguments, but found ".concat(t.length-1," instead."));let n=r.parse(t[1],1,F),i=r.parse(t[2],2,Ee(r.expectedType||G));if(!n||!i)return null;let o=i.type;return new e(o.itemType,n,i)}evaluate(t){let r=this.index.evaluate(t),n=this.input.evaluate(t);if(r<0)throw new ie("Array index out of bounds: ".concat(r," < 0."));if(r>=n.length)throw new ie("Array index out of bounds: ".concat(r," > ").concat(n.length-1,"."));if(r!==Math.floor(r))throw new ie("Array index must be an integer, but found ".concat(r," instead."));return n[r]}eachChild(t){t(this.index),t(this.input)}outputDefined(){return!1}},Va=class e{constructor(t,r){this.type=N,this.needle=t,this.haystack=r}static parse(t,r){if(t.length!==3)return r.error("Expected 2 arguments, but found ".concat(t.length-1," instead."));let n=r.parse(t[1],1,G),i=r.parse(t[2],2,G);return!n||!i?null:ja(n.type,[N,$,F,pr,G])?new e(n,i):r.error("Expected first argument to be of type boolean, string, number or null, but found ".concat(te(n.type)," instead"))}evaluate(t){let r=this.needle.evaluate(t),n=this.haystack.evaluate(t);if(!n)return!1;if(!Jr(r,["boolean","string","number","null"]))throw new ie("Expected first argument to be of type boolean, string, number or null, but found ".concat(te(ue(r))," instead."));if(!Jr(n,["string","array"]))throw new ie("Expected second argument to be of type array or string, but found ".concat(te(ue(n))," instead."));return n.indexOf(r)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}},Ba=class e{constructor(t,r,n){this.type=F,this.needle=t,this.haystack=r,this.fromIndex=n}static parse(t,r){if(t.length<=2||t.length>=5)return r.error("Expected 3 or 4 arguments, but found ".concat(t.length-1," instead."));let n=r.parse(t[1],1,G),i=r.parse(t[2],2,G);if(!n||!i)return null;if(!ja(n.type,[N,$,F,pr,G]))return r.error("Expected first argument to be of type boolean, string, number or null, but found ".concat(te(n.type)," instead"));if(t.length===4){let o=r.parse(t[3],3,F);return o?new e(n,i,o):null}else return new e(n,i)}evaluate(t){let r=this.needle.evaluate(t),n=this.haystack.evaluate(t);if(!Jr(r,["boolean","string","number","null"]))throw new ie("Expected first argument to be of type boolean, string, number or null, but found ".concat(te(ue(r))," instead."));if(!Jr(n,["string","array"]))throw new ie("Expected second argument to be of type array or string, but found ".concat(te(ue(n))," instead."));if(this.fromIndex){let i=this.fromIndex.evaluate(t);return n.indexOf(r,i)}return n.indexOf(r)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}},za=class e{constructor(t,r,n,i,o,a){this.inputType=t,this.type=r,this.input=n,this.cases=i,this.outputs=o,this.otherwise=a}static parse(t,r){if(t.length<5)return r.error("Expected at least 4 arguments, but found only ".concat(t.length-1,"."));if(t.length%2!==1)return r.error("Expected an even number of arguments.");let n,i;r.expectedType&&r.expectedType.kind!=="value"&&(i=r.expectedType);let o={},a=[];for(let u=2;u<t.length-1;u+=2){let c=t[u],p=t[u+1];Array.isArray(c)||(c=[c]);let f=r.concat(u);if(c.length===0)return f.error("Expected at least one branch label.");for(let m of c){if(typeof m!="number"&&typeof m!="string")return f.error("Branch labels must be numbers or strings.");if(typeof m=="number"&&Math.abs(m)>Number.MAX_SAFE_INTEGER)return f.error("Branch labels must be integers no larger than ".concat(Number.MAX_SAFE_INTEGER,"."));if(typeof m=="number"&&Math.floor(m)!==m)return f.error("Numeric branch labels must be integer values.");if(!n)n=ue(m);else if(f.checkSubtype(n,ue(m)))return null;if(typeof o[String(m)]<"u")return f.error("Branch labels must be unique.");o[String(m)]=a.length}let y=r.parse(p,u,i);if(!y)return null;i=i||y.type,a.push(y)}let s=r.parse(t[1],1,G);if(!s)return null;let l=r.parse(t[t.length-1],t.length-1,i);return!l||s.type.kind!=="value"&&r.concat(1).checkSubtype(n,s.type)?null:new e(n,i,s,o,a,l)}evaluate(t){let r=this.input.evaluate(t);return(ue(r)===this.inputType&&this.outputs[this.cases[r]]||this.otherwise).evaluate(t)}eachChild(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)}outputDefined(){return this.outputs.every(t=>t.outputDefined())&&this.otherwise.outputDefined()}},Ra=class e{constructor(t,r,n){this.type=t,this.branches=r,this.otherwise=n}static parse(t,r){if(t.length<4)return r.error("Expected at least 3 arguments, but found only ".concat(t.length-1,"."));if(t.length%2!==0)return r.error("Expected an odd number of arguments.");let n;r.expectedType&&r.expectedType.kind!=="value"&&(n=r.expectedType);let i=[];for(let a=1;a<t.length-1;a+=2){let s=r.parse(t[a],a,N);if(!s)return null;let l=r.parse(t[a+1],a+1,n);if(!l)return null;i.push([s,l]),n=n||l.type}let o=r.parse(t[t.length-1],t.length-1,n);if(!o)return null;if(!n)throw new Error("Can\'t infer output type");return new e(n,i,o)}evaluate(t){for(let[r,n]of this.branches)if(r.evaluate(t))return n.evaluate(t);return this.otherwise.evaluate(t)}eachChild(t){for(let[r,n]of this.branches)t(r),t(n);t(this.otherwise)}outputDefined(){return this.branches.every(([t,r])=>r.outputDefined())&&this.otherwise.outputDefined()}},Oa=class e{constructor(t,r,n,i){this.type=t,this.input=r,this.beginIndex=n,this.endIndex=i}static parse(t,r){if(t.length<=2||t.length>=5)return r.error("Expected 3 or 4 arguments, but found ".concat(t.length-1," instead."));let n=r.parse(t[1],1,G),i=r.parse(t[2],2,F);if(!n||!i)return null;if(!ja(n.type,[Ee(G),$,G]))return r.error("Expected first argument to be of type array or string, but found ".concat(te(n.type)," instead"));if(t.length===4){let o=r.parse(t[3],3,F);return o?new e(n.type,n,i,o):null}else return new e(n.type,n,i)}evaluate(t){let r=this.input.evaluate(t),n=this.beginIndex.evaluate(t);if(!Jr(r,["string","array"]))throw new ie("Expected first argument to be of type array or string, but found ".concat(te(ue(r))," instead."));if(this.endIndex){let i=this.endIndex.evaluate(t);return r.slice(n,i)}return r.slice(n)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}};function Bl(e,t){return e==="=="||e==="!="?t.kind==="boolean"||t.kind==="string"||t.kind==="number"||t.kind==="null"||t.kind==="value":t.kind==="string"||t.kind==="number"||t.kind==="value"}function dm(e,t,r){return t===r}function gm(e,t,r){return t!==r}function xm(e,t,r){return t<r}function bm(e,t,r){return t>r}function vm(e,t,r){return t<=r}function Pm(e,t,r){return t>=r}function nu(e,t,r,n){return n.compare(t,r)===0}function Sm(e,t,r,n){return!nu(e,t,r,n)}function wm(e,t,r,n){return n.compare(t,r)<0}function Am(e,t,r,n){return n.compare(t,r)>0}function _m(e,t,r,n){return n.compare(t,r)<=0}function Im(e,t,r,n){return n.compare(t,r)>=0}function yr(e,t,r){let n=e!=="=="&&e!=="!=";return class iu{constructor(o,a,s){this.type=N,this.lhs=o,this.rhs=a,this.collator=s,this.hasUntypedArgument=o.type.kind==="value"||a.type.kind==="value"}static parse(o,a){if(o.length!==3&&o.length!==4)return a.error("Expected two or three arguments.");let s=o[0],l=a.parse(o[1],1,G);if(!l)return null;if(!Bl(s,l.type))return a.concat(1).error(\'"\'.concat(s,"\\" comparisons are not supported for type \'").concat(te(l.type),"\'."));let u=a.parse(o[2],2,G);if(!u)return null;if(!Bl(s,u.type))return a.concat(2).error(\'"\'.concat(s,"\\" comparisons are not supported for type \'").concat(te(u.type),"\'."));if(l.type.kind!==u.type.kind&&l.type.kind!=="value"&&u.type.kind!=="value")return a.error("Cannot compare types \'".concat(te(l.type),"\' and \'").concat(te(u.type),"\'."));n&&(l.type.kind==="value"&&u.type.kind!=="value"?l=new qe(u.type,[l]):l.type.kind!=="value"&&u.type.kind==="value"&&(u=new qe(l.type,[u])));let c=null;if(o.length===4){if(l.type.kind!=="string"&&u.type.kind!=="string"&&l.type.kind!=="value"&&u.type.kind!=="value")return a.error("Cannot use collator to compare non-string types.");if(c=a.parse(o[3],3,Li),!c)return null}return new iu(l,u,c)}evaluate(o){let a=this.lhs.evaluate(o),s=this.rhs.evaluate(o);if(n&&this.hasUntypedArgument){let l=ue(a),u=ue(s);if(l.kind!==u.kind||!(l.kind==="string"||l.kind==="number"))throw new ie(\'Expected arguments for "\'.concat(e,\'" to be (string, string) or (number, number), but found (\').concat(l.kind,", ").concat(u.kind,") instead."))}if(this.collator&&!n&&this.hasUntypedArgument){let l=ue(a),u=ue(s);if(l.kind!=="string"||u.kind!=="string")return t(o,a,s)}return this.collator?r(o,a,s,this.collator.evaluate(o)):t(o,a,s)}eachChild(o){o(this.lhs),o(this.rhs),this.collator&&o(this.collator)}outputDefined(){return!0}}}var Tm=yr("==",dm,nu),Cm=yr("!=",gm,Sm),km=yr("<",xm,wm),Mm=yr(">",bm,Am),Em=yr("<=",vm,_m),Fm=yr(">=",Pm,Im),Ua=class e{constructor(t,r,n,i,o){this.type=$,this.number=t,this.locale=r,this.currency=n,this.minFractionDigits=i,this.maxFractionDigits=o}static parse(t,r){if(t.length!==3)return r.error("Expected two arguments.");let n=r.parse(t[1],1,F);if(!n)return null;let i=t[2];if(typeof i!="object"||Array.isArray(i))return r.error("NumberFormat options argument must be an object.");let o=null;if(i.locale&&(o=r.parse(i.locale,1,$),!o))return null;let a=null;if(i.currency&&(a=r.parse(i.currency,1,$),!a))return null;let s=null;if(i["min-fraction-digits"]&&(s=r.parse(i["min-fraction-digits"],1,F),!s))return null;let l=null;return i["max-fraction-digits"]&&(l=r.parse(i["max-fraction-digits"],1,F),!l)?null:new e(n,o,a,s,l)}evaluate(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))}eachChild(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)}outputDefined(){return!1}},Yr=class e{constructor(t){this.type=fr,this.sections=t}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");let n=t[1];if(!Array.isArray(n)&&typeof n=="object")return r.error("First argument must be an image or text section.");let i=[],o=!1;for(let a=1;a<=t.length-1;++a){let s=t[a];if(o&&typeof s=="object"&&!Array.isArray(s)){o=!1;let l=null;if(s["font-scale"]&&(l=r.parse(s["font-scale"],1,F),!l))return null;let u=null;if(s["text-font"]&&(u=r.parse(s["text-font"],1,Ee($)),!u))return null;let c=null;if(s["text-color"]&&(c=r.parse(s["text-color"],1,Re),!c))return null;let p=i[i.length-1];p.scale=l,p.font=u,p.textColor=c}else{let l=r.parse(t[a],1,G);if(!l)return null;let u=l.type.kind;if(u!=="string"&&u!=="value"&&u!=="null"&&u!=="resolvedImage")return r.error("Formatted text type must be \'string\', \'value\', \'image\' or \'null\'.");o=!0,i.push({content:l,scale:null,font:null,textColor:null})}}return new e(i)}evaluate(t){let r=n=>{let i=n.content.evaluate(t);return ue(i)===en?new Wr("",i,null,null,null):new Wr($r(i),null,n.scale?n.scale.evaluate(t):null,n.font?n.font.evaluate(t).join(","):null,n.textColor?n.textColor.evaluate(t):null)};return new Fe(this.sections.map(r))}eachChild(t){for(let r of this.sections)t(r.content),r.scale&&t(r.scale),r.font&&t(r.font),r.textColor&&t(r.textColor)}outputDefined(){return!1}},Na=class e{constructor(t){this.type=en,this.input=t}static parse(t,r){if(t.length!==2)return r.error("Expected two arguments.");let n=r.parse(t[1],1,$);return n?new e(n):r.error("No image name provided.")}evaluate(t){let r=this.input.evaluate(t),n=Te.fromString(r);return n&&t.availableImages&&(n.available=t.availableImages.indexOf(r)>-1),n}eachChild(t){t(this.input)}outputDefined(){return!1}},Ga=class e{constructor(t){this.type=F,this.input=t}static parse(t,r){if(t.length!==2)return r.error("Expected 1 argument, but found ".concat(t.length-1," instead."));let n=r.parse(t[1],1);return n?n.type.kind!=="array"&&n.type.kind!=="string"&&n.type.kind!=="value"?r.error("Expected argument of type string or array, but found ".concat(te(n.type)," instead.")):new e(n):null}evaluate(t){let r=this.input.evaluate(t);if(typeof r=="string")return r.length;if(Array.isArray(r))return r.length;throw new ie("Expected value to be of type string or array, but found ".concat(te(ue(r))," instead."))}eachChild(t){t(this.input)}outputDefined(){return!1}},Ot={"==":Tm,"!=":Cm,">":Mm,"<":km,">=":Fm,"<=":Em,array:qe,at:Da,boolean:qe,case:Ra,coalesce:Mi,collator:_i,format:Yr,image:Na,in:Va,"index-of":Ba,interpolate:je,"interpolate-hcl":je,"interpolate-lab":je,length:Ga,let:Ei,literal:yt,match:za,number:qe,"number-format":Ua,object:qe,slice:Oa,step:ur,string:qe,"to-boolean":pt,"to-color":pt,"to-number":pt,"to-string":pt,var:Ti,within:Hr};function zl(e,[t,r,n,i]){t=t.evaluate(e),r=r.evaluate(e),n=n.evaluate(e);let o=i?i.evaluate(e):1,a=Ql(t,r,n,o);if(a)throw new ie(a);return new W(t/255,r/255,n/255,o,!1)}function Rl(e,t){return e in t}function Ea(e,t){let r=t[e];return typeof r>"u"?null:r}function Lm(e,t,r,n){for(;r<=n;){let i=r+n>>1;if(t[i]===e)return!0;t[i]>e?n=i-1:r=i+1}return!1}function Dt(e){return{type:e}}Ke.register(Ot,{error:[Uy,[$],(e,[t])=>{throw new ie(t.evaluate(e))}],typeof:[$,[G],(e,[t])=>te(ue(t.evaluate(e)))],"to-rgba":[Ee(F,4),[Re],(e,[t])=>{let[r,n,i,o]=t.evaluate(e).rgb;return[r*255,n*255,i*255,o]}],rgb:[Re,[F,F,F],zl],rgba:[Re,[F,F,F,F],zl],has:{type:N,overloads:[[[$],(e,[t])=>Rl(t.evaluate(e),e.properties())],[[$,ar],(e,[t,r])=>Rl(t.evaluate(e),r.evaluate(e))]]},get:{type:G,overloads:[[[$],(e,[t])=>Ea(t.evaluate(e),e.properties())],[[$,ar],(e,[t,r])=>Ea(t.evaluate(e),r.evaluate(e))]]},"feature-state":[G,[$],(e,[t])=>Ea(t.evaluate(e),e.featureState||{})],properties:[ar,[],e=>e.properties()],"geometry-type":[$,[],e=>e.geometryType()],id:[G,[],e=>e.id()],zoom:[F,[],e=>e.globals.zoom],"heatmap-density":[F,[],e=>e.globals.heatmapDensity||0],"line-progress":[F,[],e=>e.globals.lineProgress||0],accumulated:[G,[],e=>e.globals.accumulated===void 0?null:e.globals.accumulated],"+":[F,Dt(F),(e,t)=>{let r=0;for(let n of t)r+=n.evaluate(e);return r}],"*":[F,Dt(F),(e,t)=>{let r=1;for(let n of t)r*=n.evaluate(e);return r}],"-":{type:F,overloads:[[[F,F],(e,[t,r])=>t.evaluate(e)-r.evaluate(e)],[[F],(e,[t])=>-t.evaluate(e)]]},"/":[F,[F,F],(e,[t,r])=>t.evaluate(e)/r.evaluate(e)],"%":[F,[F,F],(e,[t,r])=>t.evaluate(e)%r.evaluate(e)],ln2:[F,[],()=>Math.LN2],pi:[F,[],()=>Math.PI],e:[F,[],()=>Math.E],"^":[F,[F,F],(e,[t,r])=>Math.pow(t.evaluate(e),r.evaluate(e))],sqrt:[F,[F],(e,[t])=>Math.sqrt(t.evaluate(e))],log10:[F,[F],(e,[t])=>Math.log(t.evaluate(e))/Math.LN10],ln:[F,[F],(e,[t])=>Math.log(t.evaluate(e))],log2:[F,[F],(e,[t])=>Math.log(t.evaluate(e))/Math.LN2],sin:[F,[F],(e,[t])=>Math.sin(t.evaluate(e))],cos:[F,[F],(e,[t])=>Math.cos(t.evaluate(e))],tan:[F,[F],(e,[t])=>Math.tan(t.evaluate(e))],asin:[F,[F],(e,[t])=>Math.asin(t.evaluate(e))],acos:[F,[F],(e,[t])=>Math.acos(t.evaluate(e))],atan:[F,[F],(e,[t])=>Math.atan(t.evaluate(e))],min:[F,Dt(F),(e,t)=>Math.min(...t.map(r=>r.evaluate(e)))],max:[F,Dt(F),(e,t)=>Math.max(...t.map(r=>r.evaluate(e)))],abs:[F,[F],(e,[t])=>Math.abs(t.evaluate(e))],round:[F,[F],(e,[t])=>{let r=t.evaluate(e);return r<0?-Math.round(-r):Math.round(r)}],floor:[F,[F],(e,[t])=>Math.floor(t.evaluate(e))],ceil:[F,[F],(e,[t])=>Math.ceil(t.evaluate(e))],"filter-==":[N,[$,G],(e,[t,r])=>e.properties()[t.value]===r.value],"filter-id-==":[N,[G],(e,[t])=>e.id()===t.value],"filter-type-==":[N,[$],(e,[t])=>e.geometryType()===t.value],"filter-<":[N,[$,G],(e,[t,r])=>{let n=e.properties()[t.value],i=r.value;return typeof n==typeof i&&n<i}],"filter-id-<":[N,[G],(e,[t])=>{let r=e.id(),n=t.value;return typeof r==typeof n&&r<n}],"filter->":[N,[$,G],(e,[t,r])=>{let n=e.properties()[t.value],i=r.value;return typeof n==typeof i&&n>i}],"filter-id->":[N,[G],(e,[t])=>{let r=e.id(),n=t.value;return typeof r==typeof n&&r>n}],"filter-<=":[N,[$,G],(e,[t,r])=>{let n=e.properties()[t.value],i=r.value;return typeof n==typeof i&&n<=i}],"filter-id-<=":[N,[G],(e,[t])=>{let r=e.id(),n=t.value;return typeof r==typeof n&&r<=n}],"filter->=":[N,[$,G],(e,[t,r])=>{let n=e.properties()[t.value],i=r.value;return typeof n==typeof i&&n>=i}],"filter-id->=":[N,[G],(e,[t])=>{let r=e.id(),n=t.value;return typeof r==typeof n&&r>=n}],"filter-has":[N,[G],(e,[t])=>t.value in e.properties()],"filter-has-id":[N,[],e=>e.id()!==null&&e.id()!==void 0],"filter-type-in":[N,[Ee($)],(e,[t])=>t.value.indexOf(e.geometryType())>=0],"filter-id-in":[N,[Ee(G)],(e,[t])=>t.value.indexOf(e.id())>=0],"filter-in-small":[N,[$,Ee(G)],(e,[t,r])=>r.value.indexOf(e.properties()[t.value])>=0],"filter-in-large":[N,[$,Ee(G)],(e,[t,r])=>Lm(e.properties()[t.value],r.value,0,r.value.length-1)],all:{type:N,overloads:[[[N,N],(e,[t,r])=>t.evaluate(e)&&r.evaluate(e)],[Dt(N),(e,t)=>{for(let r of t)if(!r.evaluate(e))return!1;return!0}]]},any:{type:N,overloads:[[[N,N],(e,[t,r])=>t.evaluate(e)||r.evaluate(e)],[Dt(N),(e,t)=>{for(let r of t)if(r.evaluate(e))return!0;return!1}]]},"!":[N,[N],(e,[t])=>!t.evaluate(e)],"is-supported-script":[N,[$],(e,[t])=>{let r=e.globals&&e.globals.isSupportedScript;return r?r(t.evaluate(e)):!0}],upcase:[$,[$],(e,[t])=>t.evaluate(e).toUpperCase()],downcase:[$,[$],(e,[t])=>t.evaluate(e).toLowerCase()],concat:[$,Dt(G),(e,t)=>t.map(r=>$r(r.evaluate(e))).join("")],"resolved-locale":[$,[Li],(e,[t])=>t.evaluate(e).resolvedLocale()]});function $a(e){return{result:"success",value:e}}function or(e){return{result:"error",value:e}}function mt(e){return e["property-type"]==="data-driven"||e["property-type"]==="cross-faded-data-driven"}function ou(e){return!!e.expression&&e.expression.parameters.indexOf("zoom")>-1}function Ha(e){return!!e.expression&&e.expression.interpolated}function j(e){return e instanceof Number?"number":e instanceof String?"string":e instanceof Boolean?"boolean":Array.isArray(e)?"array":e===null?"null":typeof e}function Oi(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Dm(e){return e}function au(e,t){let r=t.type==="color",n=e.stops&&typeof e.stops[0][0]=="object",i=n||e.property!==void 0,o=n||!i,a=e.type||(Ha(t)?"exponential":"interval");if(r||t.type==="padding"){let c=r?W.parse:Je.parse;e=lr({},e),e.stops&&(e.stops=e.stops.map(p=>[p[0],c(p[1])])),e.default?e.default=c(e.default):e.default=c(t.default)}if(e.colorSpace&&!fm(e.colorSpace))throw new Error(\'Unknown color space: "\'.concat(e.colorSpace,\'"\'));let s,l,u;if(a==="exponential")s=Ol;else if(a==="interval")s=Bm;else if(a==="categorical"){s=Vm,l=Object.create(null);for(let c of e.stops)l[c[0]]=c[1];u=typeof e.stops[0][0]}else if(a==="identity")s=zm;else throw new Error(\'Unknown function type "\'.concat(a,\'"\'));if(n){let c={},p=[];for(let m=0;m<e.stops.length;m++){let h=e.stops[m],d=h[0].zoom;c[d]===void 0&&(c[d]={zoom:d,type:e.type,property:e.property,default:e.default,stops:[]},p.push(d)),c[d].stops.push([h[0].value,h[1]])}let f=[];for(let m of p)f.push([c[m].zoom,au(c[m],t)]);let y={name:"linear"};return{kind:"composite",interpolationType:y,interpolationFactor:je.interpolationFactor.bind(void 0,y),zoomStops:f.map(m=>m[0]),evaluate({zoom:m},h){return Ol({stops:f,base:e.base},t,m).evaluate(m,h)}}}else if(o){let c=a==="exponential"?{name:"exponential",base:e.base!==void 0?e.base:1}:null;return{kind:"camera",interpolationType:c,interpolationFactor:je.interpolationFactor.bind(void 0,c),zoomStops:e.stops.map(p=>p[0]),evaluate:({zoom:p})=>s(e,t,p,l,u)}}else return{kind:"source",evaluate(c,p){let f=p&&p.properties?p.properties[e.property]:void 0;return f===void 0?tn(e.default,t.default):s(e,t,f,l,u)}}}function tn(e,t,r){if(e!==void 0)return e;if(t!==void 0)return t;if(r!==void 0)return r}function Vm(e,t,r,n,i){let o=typeof r===i?n[r]:void 0;return tn(o,e.default,t.default)}function Bm(e,t,r){if(j(r)!=="number")return tn(e.default,t.default);let n=e.stops.length;if(n===1||r<=e.stops[0][0])return e.stops[0][1];if(r>=e.stops[n-1][0])return e.stops[n-1][1];let i=Ri(e.stops.map(o=>o[0]),r);return e.stops[i][1]}function Ol(e,t,r){let n=e.base!==void 0?e.base:1;if(j(r)!=="number")return tn(e.default,t.default);let i=e.stops.length;if(i===1||r<=e.stops[0][0])return e.stops[0][1];if(r>=e.stops[i-1][0])return e.stops[i-1][1];let o=Ri(e.stops.map(c=>c[0]),r),a=Rm(r,n,e.stops[o][0],e.stops[o+1][0]),s=e.stops[o][1],l=e.stops[o+1][1],u=Oe[t.type]||Dm;return typeof s.evaluate=="function"?{evaluate(...c){let p=s.evaluate.apply(void 0,c),f=l.evaluate.apply(void 0,c);if(!(p===void 0||f===void 0))return u(p,f,a,e.colorSpace)}}:u(s,l,a,e.colorSpace)}function zm(e,t,r){switch(t.type){case"color":r=W.parse(r);break;case"formatted":r=Fe.fromString(r.toString());break;case"resolvedImage":r=Te.fromString(r.toString());break;case"padding":r=Je.parse(r);break;default:j(r)!==t.type&&(t.type!=="enum"||!t.values[r])&&(r=void 0)}return tn(r,e.default,t.default)}function Rm(e,t,r,n){let i=n-r,o=e-r;return i===0?0:t===1?o/i:(Math.pow(t,o)-1)/(Math.pow(t,i)-1)}var Bt=class{constructor(t,r){this.expression=t,this._warningHistory={},this._evaluator=new wi,this._defaultValue=r?Um(r):null,this._enumValues=r&&r.type==="enum"?r.values:null}evaluateWithoutErrorHandling(t,r,n,i,o,a){return this._evaluator.globals=t,this._evaluator.feature=r,this._evaluator.featureState=n,this._evaluator.canonical=i,this._evaluator.availableImages=o||null,this._evaluator.formattedSection=a,this.expression.evaluate(this._evaluator)}evaluate(t,r,n,i,o,a){this._evaluator.globals=t,this._evaluator.feature=r||null,this._evaluator.featureState=n||null,this._evaluator.canonical=i,this._evaluator.availableImages=o||null,this._evaluator.formattedSection=a||null;try{let s=this.expression.evaluate(this._evaluator);if(s==null||typeof s=="number"&&s!==s)return this._defaultValue;if(this._enumValues&&!(s in this._enumValues))throw new ie("Expected value to be one of ".concat(Object.keys(this._enumValues).map(l=>JSON.stringify(l)).join(", "),", but found ").concat(JSON.stringify(s)," instead."));return s}catch(s){return this._warningHistory[s.message]||(this._warningHistory[s.message]=!0,typeof console<"u"&&console.warn(s.message)),this._defaultValue}}};function Ut(e){return Array.isArray(e)&&e.length>0&&typeof e[0]=="string"&&e[0]in Ot}function Nt(e,t){let r=new Ai(Ot,Ci,[],t?Om(t):void 0),n=r.parse(e,void 0,void 0,void 0,t&&t.type==="string"?{typeAnnotation:"coerce"}:void 0);return n?$a(new Bt(n,t)):or(r.errors)}var ht=class{constructor(t,r){this.kind=t,this._styleExpression=r,this.isStateDependent=t!=="constant"&&!Kr(r.expression)}evaluateWithoutErrorHandling(t,r,n,i,o,a){return this._styleExpression.evaluateWithoutErrorHandling(t,r,n,i,o,a)}evaluate(t,r,n,i,o,a){return this._styleExpression.evaluate(t,r,n,i,o,a)}},dt=class{constructor(t,r,n,i){this.kind=t,this.zoomStops=n,this._styleExpression=r,this.isStateDependent=t!=="camera"&&!Kr(r.expression),this.interpolationType=i}evaluateWithoutErrorHandling(t,r,n,i,o,a){return this._styleExpression.evaluateWithoutErrorHandling(t,r,n,i,o,a)}evaluate(t,r,n,i,o,a){return this._styleExpression.evaluate(t,r,n,i,o,a)}interpolationFactor(t,r,n){return this.interpolationType?je.interpolationFactor(this.interpolationType,t,r,n):0}};function su(e,t){let r=Nt(e,t);if(r.result==="error")return r;let n=r.value.expression,i=Bi(n);if(!i&&!mt(t))return or([new Be("","data expressions not supported")]);let o=zi(n,["zoom"]);if(!o&&!ou(t))return or([new Be("","zoom expressions not supported")]);let a=Pi(n);if(!a&&!o)return or([new Be("",\'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.\')]);if(a instanceof Be)return or([a]);if(a instanceof je&&!Ha(t))return or([new Be("",\'"interpolate" expressions cannot be used with this property\')]);if(!a)return $a(i?new ht("constant",r.value):new ht("source",r.value));let s=a instanceof je?a.interpolation:void 0;return $a(i?new dt("camera",r.value,a.labels,s):new dt("composite",r.value,a.labels,s))}var Xr=class e{constructor(t,r){this._parameters=t,this._specification=r,lr(this,au(this._parameters,this._specification))}static deserialize(t){return new e(t._parameters,t._specification)}static serialize(t){return{_parameters:t._parameters,_specification:t._specification}}};function lu(e,t){if(Oi(e))return new Xr(e,t);if(Ut(e)){let r=su(e,t);if(r.result==="error")throw new Error(r.value.map(n=>"".concat(n.key,": ").concat(n.message)).join(", "));return r.value}else{let r=e;return t.type==="color"&&typeof e=="string"?r=W.parse(e):t.type==="padding"&&(typeof e=="number"||Array.isArray(e))?r=Je.parse(e):t.type==="variableAnchorOffsetCollection"&&Array.isArray(e)&&(r=Ue.parse(e)),{kind:"constant",evaluate:()=>r}}}function Pi(e){let t=null;if(e instanceof Ei)t=Pi(e.result);else if(e instanceof Mi){for(let r of e.args)if(t=Pi(r),t)break}else(e instanceof ur||e instanceof je)&&e.input instanceof Ke&&e.input.name==="zoom"&&(t=e);return t instanceof Be||e.eachChild(r=>{let n=Pi(r);n instanceof Be?t=n:!t&&n?t=new Be("",\'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.\'):t&&n&&t!==n&&(t=new Be("",\'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.\'))}),t}function Om(e){let t={color:Re,string:$,number:F,enum:$,boolean:N,formatted:fr,padding:Di,resolvedImage:en,variableAnchorOffsetCollection:Vi};return e.type==="array"?Ee(t[e.value]||G,e.length):t[e.type]}function Um(e){return e.type==="color"&&Oi(e.default)?new W(0,0,0,0):e.type==="color"?W.parse(e.default)||null:e.type==="padding"?Je.parse(e.default)||null:e.type==="variableAnchorOffsetCollection"?Ue.parse(e.default)||null:e.default===void 0?null:e.default}function Ka(e){if(e===!0||e===!1)return!0;if(!Array.isArray(e)||e.length===0)return!1;switch(e[0]){case"has":return e.length>=2&&e[1]!=="$id"&&e[1]!=="$type";case"in":return e.length>=3&&(typeof e[1]!="string"||Array.isArray(e[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return e.length!==3||Array.isArray(e[1])||Array.isArray(e[2]);case"any":case"all":for(let t of e.slice(1))if(!Ka(t)&&typeof t!="boolean")return!1;return!0;default:return!0}}var Nm={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function rn(e){if(e==null)return{filter:()=>!0,needGeometry:!1};Ka(e)||(e=Fi(e));let t=Nt(e,Nm);if(t.result==="error")throw new Error(t.value.map(r=>"".concat(r.key,": ").concat(r.message)).join(", "));{let r=uu(e);return{filter:(n,i,o)=>t.value.evaluate(n,i,{},o),needGeometry:r}}}function Gm(e,t){return e<t?-1:e>t?1:0}function uu(e){if(!Array.isArray(e))return!1;if(e[0]==="within")return!0;for(let t=1;t<e.length;t++)if(uu(e[t]))return!0;return!1}function Fi(e){if(!e)return!0;let t=e[0];return e.length<=1?t!=="any":t==="=="?Fa(e[1],e[2],"=="):t==="!="?vi(Fa(e[1],e[2],"==")):t==="<"||t===">"||t==="<="||t===">="?Fa(e[1],e[2],t):t==="any"?$m(e.slice(1)):t==="all"?["all"].concat(e.slice(1).map(Fi)):t==="none"?["all"].concat(e.slice(1).map(Fi).map(vi)):t==="in"?Ul(e[1],e.slice(2)):t==="!in"?vi(Ul(e[1],e.slice(2))):t==="has"?Nl(e[1]):t==="!has"?vi(Nl(e[1])):t==="within"?e:!0}function Fa(e,t,r){switch(e){case"$type":return["filter-type-".concat(r),t];case"$id":return["filter-id-".concat(r),t];default:return["filter-".concat(r),e,t]}}function $m(e){return["any"].concat(e.map(Fi))}function Ul(e,t){if(t.length===0)return!1;switch(e){case"$type":return["filter-type-in",["literal",t]];case"$id":return["filter-id-in",["literal",t]];default:return t.length>200&&!t.some(r=>typeof r!=typeof t[0])?["filter-in-large",e,["literal",t.sort(Gm)]]:["filter-in-small",e,["literal",t]]}}function Nl(e){switch(e){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",e]}}function vi(e){return["!",e]}function qa(e){let t=typeof e;if(t==="number"||t==="boolean"||t==="string"||e===void 0||e===null)return JSON.stringify(e);if(Array.isArray(e)){let i="[";for(let o of e)i+="".concat(qa(o),",");return"".concat(i,"]")}let r=Object.keys(e).sort(),n="{";for(let i=0;i<r.length;i++)n+="".concat(JSON.stringify(r[i]),":").concat(qa(e[r[i]]),",");return"".concat(n,"}")}function qm(e){let t="";for(let r of Oy)t+="/".concat(qa(e[r]));return t}function cu(e,t){let r={};for(let i=0;i<e.length;i++){let o=t&&t[e[i].id]||qm(e[i]);t&&(t[e[i].id]=o);let a=r[o];a||(a=r[o]=[]),a.push(e[i])}let n=[];for(let i in r)n.push(r[i]);return n}function pu(e){let t=e.key,r=e.value;return r?[new L(t,r,"constants have been deprecated as of v8")]:[]}function le(e){return e instanceof Number||e instanceof String||e instanceof Boolean?e.valueOf():e}function zt(e){if(Array.isArray(e))return e.map(zt);if(e instanceof Object&&!(e instanceof Number||e instanceof String||e instanceof Boolean)){let t={};for(let r in e)t[r]=zt(e[r]);return t}return le(e)}function ze(e){let t=e.key,r=e.value,n=e.valueSpec||{},i=e.objectElementValidators||{},o=e.style,a=e.styleSpec,s=e.validateSpec,l=[],u=j(r);if(u!=="object")return[new L(t,r,"object expected, ".concat(u," found"))];for(let c in r){let p=c.split(".")[0],f=n[p]||n["*"],y;if(i[p])y=i[p];else if(n[p])y=s;else if(i["*"])y=i["*"];else if(n["*"])y=s;else{l.push(new L(t,r[c],\'unknown property "\'.concat(c,\'"\')));continue}l=l.concat(y({key:(t&&"".concat(t,"."))+c,value:r[c],valueSpec:f,style:o,styleSpec:a,object:r,objectKey:c,validateSpec:s},r))}for(let c in n)i[c]||n[c].required&&n[c].default===void 0&&r[c]===void 0&&l.push(new L(t,r,\'missing required property "\'.concat(c,\'"\')));return l}function Ya(e){let t=e.value,r=e.valueSpec,n=e.validateSpec,i=e.style,o=e.styleSpec,a=e.key,s=e.arrayElementValidator||n;if(j(t)!=="array")return[new L(a,t,"array expected, ".concat(j(t)," found"))];if(r.length&&t.length!==r.length)return[new L(a,t,"array length ".concat(r.length," expected, length ").concat(t.length," found"))];if(r["min-length"]&&t.length<r["min-length"])return[new L(a,t,"array length at least ".concat(r["min-length"]," expected, length ").concat(t.length," found"))];let l={type:r.value,values:r.values};o.$version<7&&(l.function=r.function),j(r.value)==="object"&&(l=r.value);let u=[];for(let c=0;c<t.length;c++)u=u.concat(s({array:t,arrayIndex:c,value:t[c],valueSpec:l,validateSpec:e.validateSpec,style:i,styleSpec:o,key:"".concat(a,"[").concat(c,"]")}));return u}function Xa(e){let t=e.key,r=e.value,n=e.valueSpec,i=j(r);return i==="number"&&r!==r&&(i="NaN"),i!=="number"?[new L(t,r,"number expected, ".concat(i," found"))]:"minimum"in n&&r<n.minimum?[new L(t,r,"".concat(r," is less than the minimum value ").concat(n.minimum))]:"maximum"in n&&r>n.maximum?[new L(t,r,"".concat(r," is greater than the maximum value ").concat(n.maximum))]:[]}function fu(e){let t=e.valueSpec,r=le(e.value.type),n,i={},o,a,s=r!=="categorical"&&e.value.property===void 0,l=!s,u=j(e.value.stops)==="array"&&j(e.value.stops[0])==="array"&&j(e.value.stops[0][0])==="object",c=ze({key:e.key,value:e.value,valueSpec:e.styleSpec.function,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{stops:p,default:m}});return r==="identity"&&s&&c.push(new L(e.key,e.value,\'missing required property "property"\')),r!=="identity"&&!e.value.stops&&c.push(new L(e.key,e.value,\'missing required property "stops"\')),r==="exponential"&&e.valueSpec.expression&&!Ha(e.valueSpec)&&c.push(new L(e.key,e.value,"exponential functions not supported")),e.styleSpec.$version>=8&&(l&&!mt(e.valueSpec)?c.push(new L(e.key,e.value,"property functions not supported")):s&&!ou(e.valueSpec)&&c.push(new L(e.key,e.value,"zoom functions not supported"))),(r==="categorical"||u)&&e.value.property===void 0&&c.push(new L(e.key,e.value,\'"property" property is required\')),c;function p(h){if(r==="identity")return[new L(h.key,h.value,\'identity function may not have a "stops" property\')];let d=[],g=h.value;return d=d.concat(Ya({key:h.key,value:g,valueSpec:h.valueSpec,validateSpec:h.validateSpec,style:h.style,styleSpec:h.styleSpec,arrayElementValidator:f})),j(g)==="array"&&g.length===0&&d.push(new L(h.key,g,"array must have at least one stop")),d}function f(h){let d=[],g=h.value,v=h.key;if(j(g)!=="array")return[new L(v,g,"array expected, ".concat(j(g)," found"))];if(g.length!==2)return[new L(v,g,"array length 2 expected, length ".concat(g.length," found"))];if(u){if(j(g[0])!=="object")return[new L(v,g,"object expected, ".concat(j(g[0])," found"))];if(g[0].zoom===void 0)return[new L(v,g,"object stop key must have zoom")];if(g[0].value===void 0)return[new L(v,g,"object stop key must have value")];if(a&&a>le(g[0].zoom))return[new L(v,g[0].zoom,"stop zoom values must appear in ascending order")];le(g[0].zoom)!==a&&(a=le(g[0].zoom),o=void 0,i={}),d=d.concat(ze({key:"".concat(v,"[0]"),value:g[0],valueSpec:{zoom:{}},validateSpec:h.validateSpec,style:h.style,styleSpec:h.styleSpec,objectElementValidators:{zoom:Xa,value:y}}))}else d=d.concat(y({key:"".concat(v,"[0]"),value:g[0],valueSpec:{},validateSpec:h.validateSpec,style:h.style,styleSpec:h.styleSpec},g));return Ut(zt(g[1]))?d.concat([new L("".concat(v,"[1]"),g[1],"expressions are not allowed in function stops.")]):d.concat(h.validateSpec({key:"".concat(v,"[1]"),value:g[1],valueSpec:t,validateSpec:h.validateSpec,style:h.style,styleSpec:h.styleSpec}))}function y(h,d){let g=j(h.value),v=le(h.value),x=h.value!==null?h.value:d;if(!n)n=g;else if(g!==n)return[new L(h.key,x,"".concat(g," stop domain type must match previous stop domain type ").concat(n))];if(g!=="number"&&g!=="string"&&g!=="boolean")return[new L(h.key,x,"stop domain value must be a number, string, or boolean")];if(g!=="number"&&r!=="categorical"){let P="number expected, ".concat(g," found");return mt(t)&&r===void 0&&(P+=\'\\nIf you intended to use a categorical function, specify `"type": "categorical"`.\'),[new L(h.key,x,P)]}return r==="categorical"&&g==="number"&&(!isFinite(v)||Math.floor(v)!==v)?[new L(h.key,x,"integer expected, found ".concat(v))]:r!=="categorical"&&g==="number"&&o!==void 0&&v<o?[new L(h.key,x,"stop domain values must appear in ascending order")]:(o=v,r==="categorical"&&v in i?[new L(h.key,x,"stop domain values must be unique")]:(i[v]=!0,[]))}function m(h){return h.validateSpec({key:h.key,value:h.value,valueSpec:t,validateSpec:h.validateSpec,style:h.style,styleSpec:h.styleSpec})}}function cr(e){let t=(e.expressionContext==="property"?su:Nt)(zt(e.value),e.valueSpec);if(t.result==="error")return t.value.map(n=>new L("".concat(e.key).concat(n.key),e.value,n.message));let r=t.value.expression||t.value._styleExpression.expression;if(e.expressionContext==="property"&&e.propertyKey==="text-font"&&!r.outputDefined())return[new L(e.key,e.value,\'Invalid data expression for "\'.concat(e.propertyKey,\'". Output values must be contained as literals within the expression.\'))];if(e.expressionContext==="property"&&e.propertyType==="layout"&&!Kr(r))return[new L(e.key,e.value,\'"feature-state" data expressions are not supported with layout properties.\')];if(e.expressionContext==="filter"&&!Kr(r))return[new L(e.key,e.value,\'"feature-state" data expressions are not supported with filters.\')];if(e.expressionContext&&e.expressionContext.indexOf("cluster")===0){if(!zi(r,["zoom","feature-state"]))return[new L(e.key,e.value,\'"zoom" and "feature-state" expressions are not supported with cluster properties.\')];if(e.expressionContext==="cluster-initial"&&!Bi(r))return[new L(e.key,e.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function jm(e){let t=e.value,r=e.key,n=j(t);return n!=="boolean"?[new L(r,t,"boolean expected, ".concat(n," found"))]:[]}function Jm(e){let t=e.key,r=e.value,n=j(r);return n!=="string"?[new L(t,r,"color expected, ".concat(n," found"))]:W.parse(String(r))?[]:[new L(t,r,\'color expected, "\'.concat(r,\'" found\'))]}function Qr(e){let t=e.key,r=e.value,n=e.valueSpec,i=[];return Array.isArray(n.values)?n.values.indexOf(le(r))===-1&&i.push(new L(t,r,"expected one of [".concat(n.values.join(", "),"], ").concat(JSON.stringify(r)," found"))):Object.keys(n.values).indexOf(le(r))===-1&&i.push(new L(t,r,"expected one of [".concat(Object.keys(n.values).join(", "),"], ").concat(JSON.stringify(r)," found"))),i}function Qa(e){return Ka(zt(e.value))?cr(lr({},e,{expressionContext:"filter",valueSpec:{value:"boolean"}})):yu(e)}function yu(e){let t=e.value,r=e.key;if(j(t)!=="array")return[new L(r,t,"array expected, ".concat(j(t)," found"))];let n=e.styleSpec,i,o=[];if(t.length<1)return[new L(r,t,"filter array must have at least 1 element")];switch(o=o.concat(Qr({key:"".concat(r,"[0]"),value:t[0],valueSpec:n.filter_operator,style:e.style,styleSpec:e.styleSpec})),le(t[0])){case"<":case"<=":case">":case">=":t.length>=2&&le(t[1])==="$type"&&o.push(new L(r,t,\'"$type" cannot be use with operator "\'.concat(t[0],\'"\')));case"==":case"!=":t.length!==3&&o.push(new L(r,t,\'filter array for operator "\'.concat(t[0],\'" must have 3 elements\')));case"in":case"!in":t.length>=2&&(i=j(t[1]),i!=="string"&&o.push(new L("".concat(r,"[1]"),t[1],"string expected, ".concat(i," found"))));for(let a=2;a<t.length;a++)i=j(t[a]),le(t[1])==="$type"?o=o.concat(Qr({key:"".concat(r,"[").concat(a,"]"),value:t[a],valueSpec:n.geometry_type,style:e.style,styleSpec:e.styleSpec})):i!=="string"&&i!=="number"&&i!=="boolean"&&o.push(new L("".concat(r,"[").concat(a,"]"),t[a],"string, number, or boolean expected, ".concat(i," found")));break;case"any":case"all":case"none":for(let a=1;a<t.length;a++)o=o.concat(yu({key:"".concat(r,"[").concat(a,"]"),value:t[a],style:e.style,styleSpec:e.styleSpec}));break;case"has":case"!has":i=j(t[1]),t.length!==2?o.push(new L(r,t,\'filter array for "\'.concat(t[0],\'" operator must have 2 elements\'))):i!=="string"&&o.push(new L("".concat(r,"[1]"),t[1],"string expected, ".concat(i," found")));break;case"within":i=j(t[1]),t.length!==2?o.push(new L(r,t,\'filter array for "\'.concat(t[0],\'" operator must have 2 elements\'))):i!=="object"&&o.push(new L("".concat(r,"[1]"),t[1],"object expected, ".concat(i," found")));break}return o}function mu(e,t){let r=e.key,n=e.validateSpec,i=e.style,o=e.styleSpec,a=e.value,s=e.objectKey,l=o["".concat(t,"_").concat(e.layerType)];if(!l)return[];let u=s.match(/^(.*)-transition$/);if(t==="paint"&&u&&l[u[1]]&&l[u[1]].transition)return n({key:r,value:a,valueSpec:o.transition,style:i,styleSpec:o});let c=e.valueSpec||l[s];if(!c)return[new L(r,a,\'unknown property "\'.concat(s,\'"\'))];let p;if(j(a)==="string"&&mt(c)&&!c.tokens&&(p=/^{([^}]+)}$/.exec(a)))return[new L(r,a,\'"\'.concat(s,\'" does not support interpolation syntax\\n\')+\'Use an identity property function instead: `{ "type": "identity", "property": \'.concat(JSON.stringify(p[1])," }`."))];let f=[];return e.layerType==="symbol"&&(s==="text-field"&&i&&!i.glyphs&&f.push(new L(r,a,\'use of "text-field" requires a style "glyphs" property\')),s==="text-font"&&Oi(zt(a))&&le(a.type)==="identity"&&f.push(new L(r,a,\'"text-font" does not support identity functions\'))),f.concat(n({key:e.key,value:a,valueSpec:c,style:i,styleSpec:o,expressionContext:"property",propertyType:t,propertyKey:s}))}function hu(e){return mu(e,"paint")}function du(e){return mu(e,"layout")}function gu(e){let t=[],r=e.value,n=e.key,i=e.style,o=e.styleSpec;!r.type&&!r.ref&&t.push(new L(n,r,\'either "type" or "ref" is required\'));let a=le(r.type),s=le(r.ref);if(r.id){let l=le(r.id);for(let u=0;u<e.arrayIndex;u++){let c=i.layers[u];le(c.id)===l&&t.push(new L(n,r.id,\'duplicate layer id "\'.concat(r.id,\'", previously used at line \').concat(c.id.__line__)))}}if("ref"in r){["type","source","source-layer","filter","layout"].forEach(u=>{u in r&&t.push(new L(n,r[u],\'"\'.concat(u,\'" is prohibited for ref layers\')))});let l;i.layers.forEach(u=>{le(u.id)===s&&(l=u)}),l?l.ref?t.push(new L(n,r.ref,"ref cannot reference another ref layer")):a=le(l.type):t.push(new L(n,r.ref,\'ref layer "\'.concat(s,\'" not found\')))}else if(a!=="background")if(!r.source)t.push(new L(n,r,\'missing required property "source"\'));else{let l=i.sources&&i.sources[r.source],u=l&&le(l.type);l?u==="vector"&&a==="raster"?t.push(new L(n,r.source,\'layer "\'.concat(r.id,\'" requires a raster source\'))):u==="raster"&&a!=="raster"?t.push(new L(n,r.source,\'layer "\'.concat(r.id,\'" requires a vector source\'))):u==="vector"&&!r["source-layer"]?t.push(new L(n,r,\'layer "\'.concat(r.id,\'" must specify a "source-layer"\'))):u==="raster-dem"&&a!=="hillshade"?t.push(new L(n,r.source,"raster-dem source can only be used with layer type \'hillshade\'.")):a==="line"&&r.paint&&r.paint["line-gradient"]&&(u!=="geojson"||!l.lineMetrics)&&t.push(new L(n,r,\'layer "\'.concat(r.id,\'" specifies a line-gradient, which requires a GeoJSON source with `lineMetrics` enabled.\'))):t.push(new L(n,r.source,\'source "\'.concat(r.source,\'" not found\')))}return t=t.concat(ze({key:n,value:r,valueSpec:o.layer,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,objectElementValidators:{"*"(){return[]},type(){return e.validateSpec({key:"".concat(n,".type"),value:r.type,valueSpec:o.layer.type,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,object:r,objectKey:"type"})},filter:Qa,layout(l){return ze({layer:r,key:l.key,value:l.value,style:l.style,styleSpec:l.styleSpec,validateSpec:l.validateSpec,objectElementValidators:{"*"(u){return du(lr({layerType:a},u))}}})},paint(l){return ze({layer:r,key:l.key,value:l.value,style:l.style,styleSpec:l.styleSpec,validateSpec:l.validateSpec,objectElementValidators:{"*"(u){return hu(lr({layerType:a},u))}}})}}})),t}function Rt(e){let t=e.value,r=e.key,n=j(t);return n!=="string"?[new L(r,t,"string expected, ".concat(n," found"))]:[]}var Gl={promoteId:Zm};function xu(e){let t=e.value,r=e.key,n=e.styleSpec,i=e.style,o=e.validateSpec;if(!t.type)return[new L(r,t,\'"type" is required\')];let a=le(t.type),s;switch(a){case"vector":case"raster":case"raster-dem":return s=ze({key:r,value:t,valueSpec:n["source_".concat(a.replace("-","_"))],style:e.style,styleSpec:n,objectElementValidators:Gl,validateSpec:o}),s;case"geojson":if(s=ze({key:r,value:t,valueSpec:n.source_geojson,style:i,styleSpec:n,validateSpec:o,objectElementValidators:Gl}),t.cluster)for(let l in t.clusterProperties){let[u,c]=t.clusterProperties[l],p=typeof u=="string"?[u,["accumulated"],["get",l]]:u;s.push(...cr({key:"".concat(r,".").concat(l,".map"),value:c,validateSpec:o,expressionContext:"cluster-map"})),s.push(...cr({key:"".concat(r,".").concat(l,".reduce"),value:p,validateSpec:o,expressionContext:"cluster-reduce"}))}return s;case"video":return ze({key:r,value:t,valueSpec:n.source_video,style:i,validateSpec:o,styleSpec:n});case"image":return ze({key:r,value:t,valueSpec:n.source_image,style:i,validateSpec:o,styleSpec:n});case"canvas":return[new L(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Qr({key:"".concat(r,".type"),value:t.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:i,validateSpec:o,styleSpec:n})}}function Zm({key:e,value:t}){if(j(t)==="string")return Rt({key:e,value:t});{let r=[];for(let n in t)r.push(...Rt({key:"".concat(e,".").concat(n),value:t[n]}));return r}}function bu(e){let t=e.value,r=e.styleSpec,n=r.light,i=e.style,o=[],a=j(t);if(t===void 0)return o;if(a!=="object")return o=o.concat([new L("light",t,"object expected, ".concat(a," found"))]),o;for(let s in t){let l=s.match(/^(.*)-transition$/);l&&n[l[1]]&&n[l[1]].transition?o=o.concat(e.validateSpec({key:s,value:t[s],valueSpec:r.transition,validateSpec:e.validateSpec,style:i,styleSpec:r})):n[s]?o=o.concat(e.validateSpec({key:s,value:t[s],valueSpec:n[s],validateSpec:e.validateSpec,style:i,styleSpec:r})):o=o.concat([new L(s,t[s],\'unknown property "\'.concat(s,\'"\'))])}return o}function vu(e){let t=e.value,r=e.styleSpec,n=r.terrain,i=e.style,o=[],a=j(t);if(t===void 0)return o;if(a!=="object")return o=o.concat([new L("terrain",t,"object expected, ".concat(a," found"))]),o;for(let s in t)n[s]?o=o.concat(e.validateSpec({key:s,value:t[s],valueSpec:n[s],validateSpec:e.validateSpec,style:i,styleSpec:r})):o=o.concat([new L(s,t[s],\'unknown property "\'.concat(s,\'"\'))]);return o}function Wm(e){return Rt(e).length===0?[]:cr(e)}function Hm(e){return Rt(e).length===0?[]:cr(e)}function Km(e){let t=e.key,r=e.value;if(j(r)==="array"){if(r.length<1||r.length>4)return[new L(t,r,"padding requires 1 to 4 values; ".concat(r.length," values found"))];let i={type:"number"},o=[];for(let a=0;a<r.length;a++)o=o.concat(e.validateSpec({key:"".concat(t,"[").concat(a,"]"),value:r[a],validateSpec:e.validateSpec,valueSpec:i}));return o}else return Xa({key:t,value:r,valueSpec:{}})}function Ym(e){let t=e.key,r=e.value,n=j(r),i=e.styleSpec;if(n!=="array"||r.length<1||r.length%2!==0)return[new L(t,r,"variableAnchorOffsetCollection requires a non-empty array of even length")];let o=[];for(let a=0;a<r.length;a+=2)o=o.concat(Qr({key:"".concat(t,"[").concat(a,"]"),value:r[a],valueSpec:i.layout_symbol["text-anchor"]})),o=o.concat(Ya({key:"".concat(t,"[").concat(a+1,"]"),value:r[a+1],valueSpec:{length:2,value:"number"},validateSpec:e.validateSpec,style:e.style,styleSpec:i}));return o}function Pu(e){let t=[],r=e.value,n=e.key;if(Array.isArray(r)){let i=[],o=[];for(let a in r){r[a].id&&i.includes(r[a].id)&&t.push(new L(n,r,"all the sprites\' ids must be unique, but ".concat(r[a].id," is duplicated"))),i.push(r[a].id),r[a].url&&o.includes(r[a].url)&&t.push(new L(n,r,"all the sprites\' URLs must be unique, but ".concat(r[a].url," is duplicated"))),o.push(r[a].url);let s={id:{type:"string",required:!0},url:{type:"string",required:!0}};t=t.concat(ze({key:"".concat(n,"[").concat(a,"]"),value:r[a],valueSpec:s,validateSpec:e.validateSpec}))}return t}else return Rt({key:n,value:r})}var $l={"*"(){return[]},array:Ya,boolean:jm,number:Xa,color:Jm,constants:pu,enum:Qr,filter:Qa,function:fu,layer:gu,object:ze,source:xu,light:bu,terrain:vu,string:Rt,formatted:Wm,resolvedImage:Hm,padding:Km,variableAnchorOffsetCollection:Ym,sprite:Pu};function qr(e){let t=e.value,r=e.valueSpec,n=e.styleSpec;return e.validateSpec=qr,r.expression&&Oi(le(t))?fu(e):r.expression&&Ut(zt(t))?cr(e):r.type&&$l[r.type]?$l[r.type](e):ze(lr({},e,{valueSpec:r.type?n[r.type]:r}))}function Su(e){let t=e.value,r=e.key,n=Rt(e);return n.length||(t.indexOf("{fontstack}")===-1&&n.push(new L(r,t,\'"glyphs" url must include a "{fontstack}" token\')),t.indexOf("{range}")===-1&&n.push(new L(r,t,\'"glyphs" url must include a "{range}" token\'))),n}function Ze(e,t=S){let r=[];return r=r.concat(qr({key:"",value:e,valueSpec:t.$root,styleSpec:t,style:e,validateSpec:qr,objectElementValidators:{glyphs:Su,"*"(){return[]}}})),e.constants&&(r=r.concat(pu({key:"constants",value:e.constants,style:e,styleSpec:t,validateSpec:qr}))),wu(r)}Ze.source=ot(it(xu));Ze.sprite=ot(it(Pu));Ze.glyphs=ot(it(Su));Ze.light=ot(it(bu));Ze.terrain=ot(it(vu));Ze.layer=ot(it(gu));Ze.filter=ot(it(Qa));Ze.paintProperty=ot(it(hu));Ze.layoutProperty=ot(it(du));function it(e){return function(t){return e({...t,validateSpec:qr})}}function wu(e){return[].concat(e).sort((t,r)=>t.line-r.line)}function ot(e){return function(...t){return wu(e.apply(this,t))}}var Au="AbortError";function _u(e){return e.message===Au}function es(){return new Error(Au)}var Ui={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function Iu(e){return Ui.REGISTERED_PROTOCOLS[e.substring(0,e.indexOf("://"))]}function Tu(e,t){Ui.REGISTERED_PROTOCOLS[e]=t}function Cu(e){delete Ui.REGISTERED_PROTOCOLS[e]}var ku="global-dispatcher",mr=class extends Error{constructor(r,n,i,o){super("AJAXError: ".concat(n," (").concat(r,"): ").concat(i));this.status=r,this.statusText=n,this.url=i,this.body=o}},Eu=()=>nt(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,Xm=e=>/^file:/.test(e)||/^file:/.test(Eu())&&!/^\\w+:/.test(e);async function Qm(e,t){let r=new Request(e.url,{method:e.method||"GET",body:e.body,credentials:e.credentials,headers:e.headers,cache:e.cache,referrer:Eu(),signal:t.signal});e.type==="json"&&r.headers.set("Accept","application/json");let n=await fetch(r);if(!n.ok){let a=await n.blob();throw new mr(n.status,n.statusText,e.url,a)}let i;e.type==="arrayBuffer"||e.type==="image"?i=n.arrayBuffer():e.type==="json"?i=n.json():i=n.text();let o=await i;if(t.signal.aborted)throw es();return{data:o,cacheControl:n.headers.get("Cache-Control"),expires:n.headers.get("Expires")}}function eh(e,t){return new Promise((r,n)=>{let i=new XMLHttpRequest;i.open(e.method||"GET",e.url,!0),(e.type==="arrayBuffer"||e.type==="image")&&(i.responseType="arraybuffer");for(let o in e.headers)i.setRequestHeader(o,e.headers[o]);e.type==="json"&&(i.responseType="text",i.setRequestHeader("Accept","application/json")),i.withCredentials=e.credentials==="include",i.onerror=()=>{n(new Error(i.statusText))},i.onload=()=>{if(!t.signal.aborted)if((i.status>=200&&i.status<300||i.status===0)&&i.response!==null){let o=i.response;if(e.type==="json")try{o=JSON.parse(i.response)}catch(a){n(a);return}r({data:o,cacheControl:i.getResponseHeader("Cache-Control"),expires:i.getResponseHeader("Expires")})}else{let o=new Blob([i.response],{type:i.getResponseHeader("Content-Type")});n(new mr(i.status,i.statusText,e.url,o))}},t.signal.addEventListener("abort",()=>{i.abort(),n(es())}),i.send(e.body)})}var Fu=function(e,t){if(/:\\/\\//.test(e.url)&&!/^https?:|^file:/.test(e.url)){let r=Iu(e.url);if(r)return r(e,t);if(nt(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:e,targetMapId:ku},t)}if(!Xm(e.url)){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return Qm(e,t);if(nt(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:e,mustQueue:!0,targetMapId:ku},t)}return eh(e,t)},Lu=(e,t)=>Fu(Pe(e,{type:"json"}),t),Du=(e,t)=>Fu(Pe(e,{type:"arrayBuffer"}),t);var gt={};function C(e,t,r={}){if(gt[e])throw new Error("".concat(e," is already registered."));Object.defineProperty(t,"_classRegistryKey",{value:e,writeable:!1}),gt[e]={klass:t,omit:r.omit||[],shallow:r.shallow||[]}}C("Object",Object);C("TransferableGridIndex",Lt);C("Color",W);C("Error",Error);C("AJAXError",mr);C("ResolvedImage",Te);C("StylePropertyFunction",Xr);C("StyleExpression",Bt,{omit:["_evaluator"]});C("ZoomDependentExpression",dt);C("ZoomConstantExpression",ht);C("CompoundExpression",Ke,{omit:["_evaluate"]});for(let e in Ot)Ot[e]._classRegistryKey||C("Expression_".concat(e),Ot[e]);function Vu(e){return e&&typeof ArrayBuffer<"u"&&(e instanceof ArrayBuffer||e.constructor&&e.constructor.name==="ArrayBuffer")}function hr(e,t){if(e==null||typeof e=="boolean"||typeof e=="number"||typeof e=="string"||e instanceof Boolean||e instanceof Number||e instanceof String||e instanceof Date||e instanceof RegExp||e instanceof Blob||e instanceof Error)return e;if(Vu(e)||Nr(e))return t&&t.push(e),e;if(ArrayBuffer.isView(e)){let r=e;return t&&t.push(r.buffer),r}if(e instanceof ImageData)return t&&t.push(e.data.buffer),e;if(Array.isArray(e)){let r=[];for(let n of e)r.push(hr(n,t));return r}if(typeof e=="object"){let r=e.constructor,n=r._classRegistryKey;if(!n)throw new Error("can\'t serialize object of unregistered class ".concat(r.name));if(!gt[n])throw new Error("".concat(n," is not registered."));let i=r.serialize?r.serialize(e,t):{};if(r.serialize){if(t&&i===t[t.length-1])throw new Error("statically serialized object won\'t survive transfer of $name property")}else{for(let o in e){if(!e.hasOwnProperty(o)||gt[n].omit.indexOf(o)>=0)continue;let a=e[o];i[o]=gt[n].shallow.indexOf(o)>=0?a:hr(a,t)}e instanceof Error&&(i.message=e.message)}if(i.$name)throw new Error("$name property is reserved for worker serialization logic.");return n!=="Object"&&(i.$name=n),i}throw new Error("can\'t serialize object of type ".concat(typeof e))}function dr(e){if(e==null||typeof e=="boolean"||typeof e=="number"||typeof e=="string"||e instanceof Boolean||e instanceof Number||e instanceof String||e instanceof Date||e instanceof RegExp||e instanceof Blob||e instanceof Error||Vu(e)||Nr(e)||ArrayBuffer.isView(e)||e instanceof ImageData)return e;if(Array.isArray(e))return e.map(dr);if(typeof e=="object"){let t=e.$name||"Object";if(!gt[t])throw new Error("can\'t deserialize unregistered class ".concat(t));let{klass:r}=gt[t];if(!r)throw new Error("can\'t deserialize unregistered class ".concat(t));if(r.deserialize)return r.deserialize(e);let n=Object.create(r.prototype);for(let i of Object.keys(e)){if(i==="$name")continue;let o=e[i];n[i]=gt[t].shallow.indexOf(i)>=0?o:dr(o)}return n}throw new Error("can\'t deserialize object of type ".concat(typeof e))}var Ni=class{constructor(t){this._methodToThrottle=t,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._methodToThrottle()},0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}};var Gi=class{constructor(t,r){this.target=t,this.mapId=r,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new Ni(()=>this.process()),this.subscription=kl(this.target,"message",n=>this.receive(n),!1),this.globalScope=nt(self)?t:window}registerMessageHandler(t,r){this.messageHandlers[t]=r}sendAsync(t,r){return new Promise((n,i)=>{let o=Math.round(Math.random()*1e18).toString(36).substring(0,10);this.resolveRejects[o]={resolve:n,reject:i},r&&r.signal.addEventListener("abort",()=>{delete this.resolveRejects[o];let l={id:o,type:"<cancel>",origin:location.origin,targetMapId:t.targetMapId,sourceMapId:this.mapId};this.target.postMessage(l)},{once:!0});let a=[],s={...t,id:o,sourceMapId:this.mapId,origin:location.origin,data:hr(t.data,a)};this.target.postMessage(s,{transfer:a})})}receive(t){let r=t.data,n=r.id;if(!(r.origin!=="file://"&&location.origin!=="file://"&&r.origin!==location.origin)&&!(r.targetMapId&&this.mapId!==r.targetMapId)){if(r.type==="<cancel>"){delete this.tasks[n];let i=this.abortControllers[n];delete this.abortControllers[n],i&&i.abort();return}if(nt(self)||r.mustQueue){this.tasks[n]=r,this.taskQueue.push(n),this.invoker.trigger();return}this.processTask(n,r)}}process(){if(this.taskQueue.length===0)return;let t=this.taskQueue.shift(),r=this.tasks[t];delete this.tasks[t],this.taskQueue.length>0&&this.invoker.trigger(),r&&this.processTask(t,r)}async processTask(t,r){if(r.type==="<response>"){let o=this.resolveRejects[t];if(delete this.resolveRejects[t],!o)return;r.error?o.reject(dr(r.error)):o.resolve(dr(r.data));return}if(!this.messageHandlers[r.type]){this.completeTask(t,new Error("Could not find a registered handler for ".concat(r.type,", map ID: ").concat(this.mapId,", available handlers: ").concat(Object.keys(this.messageHandlers).join(", "))));return}let n=dr(r.data),i=new AbortController;this.abortControllers[t]=i;try{let o=await this.messageHandlers[r.type](r.sourceMapId,n,i);this.completeTask(t,null,o)}catch(o){this.completeTask(t,o)}}completeTask(t,r,n){let i=[];delete this.abortControllers[t];let o={id:t,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:r?hr(r):null,data:hr(n,i)};this.target.postMessage(o,{transfer:i})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}};function Bu(e,t,r){r[e]&&r[e].indexOf(t)!==-1||(r[e]=r[e]||[],r[e].push(t))}function ts(e,t,r){if(r&&r[e]){let n=r[e].indexOf(t);n!==-1&&r[e].splice(n,1)}}var $i=class{constructor(t,r={}){Pe(this,r),this.type=t}},nn=class extends $i{constructor(r,n={}){super("error",Pe({error:r},n))}},qi=class{on(t,r){return this._listeners=this._listeners||{},Bu(t,r,this._listeners),this}off(t,r){return ts(t,r,this._listeners),ts(t,r,this._oneTimeListeners),this}once(t,r){return r?(this._oneTimeListeners=this._oneTimeListeners||{},Bu(t,r,this._oneTimeListeners),this):new Promise(n=>this.once(t,n))}fire(t,r){typeof t=="string"&&(t=new $i(t,r||{}));let n=t.type;if(this.listens(n)){t.target=this;let i=this._listeners&&this._listeners[n]?this._listeners[n].slice():[];for(let s of i)s.call(this,t);let o=this._oneTimeListeners&&this._oneTimeListeners[n]?this._oneTimeListeners[n].slice():[];for(let s of o)ts(n,s,this._oneTimeListeners),s.call(this,t);let a=this._eventedParent;a&&(Pe(t,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),a.fire(t))}else t instanceof nn&&console.error(t.error);return this}listens(t){return this._listeners&&this._listeners[t]&&this._listeners[t].length>0||this._oneTimeListeners&&this._oneTimeListeners[t]&&this._oneTimeListeners[t].length>0||this._eventedParent&&this._eventedParent.listens(t)}setEventedParent(t,r){return this._eventedParent=t,this._eventedParentData=r,this}};var xt=Ze,Zb=xt.source,Wb=xt.light,Hb=xt.terrain,Kb=xt.filter,zu=xt.paintProperty,Ru=xt.layoutProperty;function Ou(e,t){let r=!1;if(t&&t.length)for(let n of t)e.fire(new nn(new Error(n.message))),r=!0;return r}var ji=class{constructor(){this.first=!0}update(t,r){let n=Math.floor(t);return this.first?(this.first=!1,this.lastIntegerZoom=n,this.lastIntegerZoomTime=0,this.lastZoom=t,this.lastFloorZoom=n,!0):(this.lastFloorZoom>n?(this.lastIntegerZoom=n+1,this.lastIntegerZoomTime=r):this.lastFloorZoom<n&&(this.lastIntegerZoom=n,this.lastIntegerZoomTime=r),t!==this.lastZoom?(this.lastZoom=t,this.lastFloorZoom=n,!0):!1)}};var V={"Latin-1 Supplement":e=>e>=128&&e<=255,Arabic:e=>e>=1536&&e<=1791,"Arabic Supplement":e=>e>=1872&&e<=1919,"Arabic Extended-A":e=>e>=2208&&e<=2303,"Hangul Jamo":e=>e>=4352&&e<=4607,"Unified Canadian Aboriginal Syllabics":e=>e>=5120&&e<=5759,Khmer:e=>e>=6016&&e<=6143,"Unified Canadian Aboriginal Syllabics Extended":e=>e>=6320&&e<=6399,"General Punctuation":e=>e>=8192&&e<=8303,"Letterlike Symbols":e=>e>=8448&&e<=8527,"Number Forms":e=>e>=8528&&e<=8591,"Miscellaneous Technical":e=>e>=8960&&e<=9215,"Control Pictures":e=>e>=9216&&e<=9279,"Optical Character Recognition":e=>e>=9280&&e<=9311,"Enclosed Alphanumerics":e=>e>=9312&&e<=9471,"Geometric Shapes":e=>e>=9632&&e<=9727,"Miscellaneous Symbols":e=>e>=9728&&e<=9983,"Miscellaneous Symbols and Arrows":e=>e>=11008&&e<=11263,"CJK Radicals Supplement":e=>e>=11904&&e<=12031,"Kangxi Radicals":e=>e>=12032&&e<=12255,"Ideographic Description Characters":e=>e>=12272&&e<=12287,"CJK Symbols and Punctuation":e=>e>=12288&&e<=12351,Hiragana:e=>e>=12352&&e<=12447,Katakana:e=>e>=12448&&e<=12543,Bopomofo:e=>e>=12544&&e<=12591,"Hangul Compatibility Jamo":e=>e>=12592&&e<=12687,Kanbun:e=>e>=12688&&e<=12703,"Bopomofo Extended":e=>e>=12704&&e<=12735,"CJK Strokes":e=>e>=12736&&e<=12783,"Katakana Phonetic Extensions":e=>e>=12784&&e<=12799,"Enclosed CJK Letters and Months":e=>e>=12800&&e<=13055,"CJK Compatibility":e=>e>=13056&&e<=13311,"CJK Unified Ideographs Extension A":e=>e>=13312&&e<=19903,"Yijing Hexagram Symbols":e=>e>=19904&&e<=19967,"CJK Unified Ideographs":e=>e>=19968&&e<=40959,"Yi Syllables":e=>e>=40960&&e<=42127,"Yi Radicals":e=>e>=42128&&e<=42191,"Hangul Jamo Extended-A":e=>e>=43360&&e<=43391,"Hangul Syllables":e=>e>=44032&&e<=55215,"Hangul Jamo Extended-B":e=>e>=55216&&e<=55295,"Private Use Area":e=>e>=57344&&e<=63743,"CJK Compatibility Ideographs":e=>e>=63744&&e<=64255,"Arabic Presentation Forms-A":e=>e>=64336&&e<=65023,"Vertical Forms":e=>e>=65040&&e<=65055,"CJK Compatibility Forms":e=>e>=65072&&e<=65103,"Small Form Variants":e=>e>=65104&&e<=65135,"Arabic Presentation Forms-B":e=>e>=65136&&e<=65279,"Halfwidth and Fullwidth Forms":e=>e>=65280&&e<=65519};function on(e){for(let t of e)if(Ji(t.charCodeAt(0)))return!0;return!1}function Uu(e){for(let t of e)if(!th(t.charCodeAt(0)))return!1;return!0}function th(e){return!(V.Arabic(e)||V["Arabic Supplement"](e)||V["Arabic Extended-A"](e)||V["Arabic Presentation Forms-A"](e)||V["Arabic Presentation Forms-B"](e))}function Nu(e){return e<11904?!1:!!(V["Bopomofo Extended"](e)||V.Bopomofo(e)||V["CJK Compatibility Forms"](e)||V["CJK Compatibility Ideographs"](e)||V["CJK Compatibility"](e)||V["CJK Radicals Supplement"](e)||V["CJK Strokes"](e)||V["CJK Symbols and Punctuation"](e)||V["CJK Unified Ideographs Extension A"](e)||V["CJK Unified Ideographs"](e)||V["Enclosed CJK Letters and Months"](e)||V["Halfwidth and Fullwidth Forms"](e)||V.Hiragana(e)||V["Ideographic Description Characters"](e)||V["Kangxi Radicals"](e)||V["Katakana Phonetic Extensions"](e)||V.Katakana(e)||V["Vertical Forms"](e)||V["Yi Radicals"](e)||V["Yi Syllables"](e))}function Ji(e){return e===746||e===747?!0:e<4352?!1:!!(V["Bopomofo Extended"](e)||V.Bopomofo(e)||V["CJK Compatibility Forms"](e)&&!(e>=65097&&e<=65103)||V["CJK Compatibility Ideographs"](e)||V["CJK Compatibility"](e)||V["CJK Radicals Supplement"](e)||V["CJK Strokes"](e)||V["CJK Symbols and Punctuation"](e)&&!(e>=12296&&e<=12305)&&!(e>=12308&&e<=12319)&&e!==12336||V["CJK Unified Ideographs Extension A"](e)||V["CJK Unified Ideographs"](e)||V["Enclosed CJK Letters and Months"](e)||V["Hangul Compatibility Jamo"](e)||V["Hangul Jamo Extended-A"](e)||V["Hangul Jamo Extended-B"](e)||V["Hangul Jamo"](e)||V["Hangul Syllables"](e)||V.Hiragana(e)||V["Ideographic Description Characters"](e)||V.Kanbun(e)||V["Kangxi Radicals"](e)||V["Katakana Phonetic Extensions"](e)||V.Katakana(e)&&e!==12540||V["Halfwidth and Fullwidth Forms"](e)&&e!==65288&&e!==65289&&e!==65293&&!(e>=65306&&e<=65310)&&e!==65339&&e!==65341&&e!==65343&&!(e>=65371&&e<=65503)&&e!==65507&&!(e>=65512&&e<=65519)||V["Small Form Variants"](e)&&!(e>=65112&&e<=65118)&&!(e>=65123&&e<=65126)||V["Unified Canadian Aboriginal Syllabics"](e)||V["Unified Canadian Aboriginal Syllabics Extended"](e)||V["Vertical Forms"](e)||V["Yijing Hexagram Symbols"](e)||V["Yi Syllables"](e)||V["Yi Radicals"](e))}function rh(e){return!!(V["Latin-1 Supplement"](e)&&(e===167||e===169||e===174||e===177||e===188||e===189||e===190||e===215||e===247)||V["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)||V["Letterlike Symbols"](e)||V["Number Forms"](e)||V["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)||V["Control Pictures"](e)&&e!==9251||V["Optical Character Recognition"](e)||V["Enclosed Alphanumerics"](e)||V["Geometric Shapes"](e)||V["Miscellaneous Symbols"](e)&&!(e>=9754&&e<=9759)||V["Miscellaneous Symbols and Arrows"](e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||V["CJK Symbols and Punctuation"](e)||V.Katakana(e)||V["Private Use Area"](e)||V["CJK Compatibility Forms"](e)||V["Small Form Variants"](e)||V["Halfwidth and Fullwidth Forms"](e)||e===8734||e===8756||e===8757||e>=9984&&e<=10087||e>=10102&&e<=10131||e===65532||e===65533)}function rs(e){return!(Ji(e)||rh(e))}function Gu(e){return V.Arabic(e)||V["Arabic Supplement"](e)||V["Arabic Extended-A"](e)||V["Arabic Presentation Forms-A"](e)||V["Arabic Presentation Forms-B"](e)}function $u(e){return e>=1424&&e<=2303||V["Arabic Presentation Forms-A"](e)||V["Arabic Presentation Forms-B"](e)}function nh(e,t){return!(!t&&$u(e)||e>=2304&&e<=3583||e>=3840&&e<=4255||V.Khmer(e))}function qu(e){for(let t of e)if($u(t.charCodeAt(0)))return!0;return!1}function ju(e,t){for(let r of e)if(!nh(r.charCodeAt(0),t))return!1;return!0}var ns=class{constructor(){this.applyArabicShaping=null;this.processBidirectionalText=null;this.processStyledBidirectionalText=null;this.pluginStatus="unavailable";this.pluginURL=null}setState(t){this.pluginStatus=t.pluginStatus,this.pluginURL=t.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(t){this.applyArabicShaping=t.applyArabicShaping,this.processBidirectionalText=t.processBidirectionalText,this.processStyledBidirectionalText=t.processStyledBidirectionalText}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getPluginURL(){return this.pluginURL}getRTLTextPluginStatus(){return this.pluginStatus}},ye=new ns;var q=class{constructor(t,r){this.zoom=t,r?(this.now=r.now,this.fadeDuration=r.fadeDuration,this.zoomHistory=r.zoomHistory,this.transition=r.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new ji,this.transition={})}isSupportedScript(t){return ju(t,ye.getRTLTextPluginStatus()==="loaded")}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){let t=this.zoom,r=t-Math.floor(t),n=this.crossFadingFactor();return t>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:r+(1-r)*n}:{fromScale:.5,toScale:1,t:1-(1-n)*r}}};var gr=class{constructor(t,r){this.property=t,this.value=r,this.expression=lu(r===void 0?t.specification.default:r,t.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(t,r,n){return this.property.possiblyEvaluate(this,t,r,n)}},an=class{constructor(t){this.property=t,this.value=new gr(t,void 0)}transitioned(t,r){return new Wi(this.property,this.value,r,Pe({},t.transition,this.transition),t.now)}untransitioned(){return new Wi(this.property,this.value,null,{},0)}},Zi=class{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues)}getValue(t){return et(this._values[t].value.value)}setValue(t,r){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new an(this._values[t].property)),this._values[t].value=new gr(this._values[t].property,r===null?void 0:et(r))}getTransition(t){return et(this._values[t].transition)}setTransition(t,r){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new an(this._values[t].property)),this._values[t].transition=et(r)||void 0}serialize(){let t={};for(let r of Object.keys(this._values)){let n=this.getValue(r);n!==void 0&&(t[r]=n);let i=this.getTransition(r);i!==void 0&&(t["".concat(r,"-transition")]=i)}return t}transitioned(t,r){let n=new Hi(this._properties);for(let i of Object.keys(this._values))n._values[i]=this._values[i].transitioned(t,r._values[i]);return n}untransitioned(){let t=new Hi(this._properties);for(let r of Object.keys(this._values))t._values[r]=this._values[r].untransitioned();return t}},Wi=class{constructor(t,r,n,i,o){this.property=t,this.value=r,this.begin=o+i.delay||0,this.end=this.begin+i.duration||0,t.specification.transition&&(i.delay||i.duration)&&(this.prior=n)}possiblyEvaluate(t,r,n){let i=t.now||0,o=this.value.possiblyEvaluate(t,r,n),a=this.prior;if(a){if(i>this.end)return this.prior=null,o;if(this.value.isDataDriven())return this.prior=null,o;if(i<this.begin)return a.possiblyEvaluate(t,r,n);{let s=(i-this.begin)/(this.end-this.begin);return this.property.interpolate(a.possiblyEvaluate(t,r,n),o,Sl(s))}}else return o}},Hi=class{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)}possiblyEvaluate(t,r,n){let i=new bt(this._properties);for(let o of Object.keys(this._values))i._values[o]=this._values[o].possiblyEvaluate(t,r,n);return i}hasTransition(){for(let t of Object.keys(this._values))if(this._values[t].prior)return!0;return!1}},Ki=class{constructor(t){this._properties=t,this._values=Object.create(t.defaultPropertyValues)}hasValue(t){return this._values[t].value!==void 0}getValue(t){return et(this._values[t].value)}setValue(t,r){this._values[t]=new gr(this._values[t].property,r===null?void 0:et(r))}serialize(){let t={};for(let r of Object.keys(this._values)){let n=this.getValue(r);n!==void 0&&(t[r]=n)}return t}possiblyEvaluate(t,r,n){let i=new bt(this._properties);for(let o of Object.keys(this._values))i._values[o]=this._values[o].possiblyEvaluate(t,r,n);return i}},Se=class{constructor(t,r,n){this.property=t,this.value=r,this.parameters=n}isConstant(){return this.value.kind==="constant"}constantOr(t){return this.value.kind==="constant"?this.value.value:t}evaluate(t,r,n,i){return this.property.evaluate(this.value,this.parameters,t,r,n,i)}},bt=class{constructor(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues)}get(t){return this._values[t]}},z=class{constructor(t){this.specification=t}possiblyEvaluate(t,r){if(t.isDataDriven())throw new Error("Value should not be data driven");return t.expression.evaluate(r)}interpolate(t,r,n){let i=this.specification.type,o=Oe[i];return o?o(t,r,n):t}},O=class{constructor(t,r){this.specification=t,this.overrides=r}possiblyEvaluate(t,r,n,i){return t.expression.kind==="constant"||t.expression.kind==="camera"?new Se(this,{kind:"constant",value:t.expression.evaluate(r,null,{},n,i)},r):new Se(this,t.expression,r)}interpolate(t,r,n){if(t.value.kind!=="constant"||r.value.kind!=="constant")return t;if(t.value.value===void 0||r.value.value===void 0)return new Se(this,{kind:"constant",value:void 0},t.parameters);let i=this.specification.type,o=Oe[i];if(o){let a=o(t.value.value,r.value.value,n);return new Se(this,{kind:"constant",value:a},t.parameters)}else return t}evaluate(t,r,n,i,o,a){return t.kind==="constant"?t.value:t.evaluate(r,n,i,o,a)}},at=class extends O{possiblyEvaluate(t,r,n,i){if(t.value===void 0)return new Se(this,{kind:"constant",value:void 0},r);if(t.expression.kind==="constant"){let o=t.expression.evaluate(r,null,{},n,i),s=t.property.specification.type==="resolvedImage"&&typeof o!="string"?o.name:o,l=this._calculate(s,s,s,r);return new Se(this,{kind:"constant",value:l},r)}else if(t.expression.kind==="camera"){let o=this._calculate(t.expression.evaluate({zoom:r.zoom-1}),t.expression.evaluate({zoom:r.zoom}),t.expression.evaluate({zoom:r.zoom+1}),r);return new Se(this,{kind:"constant",value:o},r)}else return new Se(this,t.expression,r)}evaluate(t,r,n,i,o,a){if(t.kind==="source"){let s=t.evaluate(r,n,i,o,a);return this._calculate(s,s,s,r)}else return t.kind==="composite"?this._calculate(t.evaluate({zoom:Math.floor(r.zoom)-1},n,i),t.evaluate({zoom:Math.floor(r.zoom)},n,i),t.evaluate({zoom:Math.floor(r.zoom)+1},n,i),r):t.value}_calculate(t,r,n,i){return i.zoom>i.zoomHistory.lastIntegerZoom?{from:t,to:r}:{from:n,to:r}}interpolate(t){return t}},Gt=class{constructor(t){this.specification=t}possiblyEvaluate(t,r,n,i){if(t.value!==void 0)if(t.expression.kind==="constant"){let o=t.expression.evaluate(r,null,{},n,i);return this._calculate(o,o,o,r)}else return this._calculate(t.expression.evaluate(new q(Math.floor(r.zoom-1),r)),t.expression.evaluate(new q(Math.floor(r.zoom),r)),t.expression.evaluate(new q(Math.floor(r.zoom+1),r)),r)}_calculate(t,r,n,i){return i.zoom>i.zoomHistory.lastIntegerZoom?{from:t,to:r}:{from:n,to:r}}interpolate(t){return t}},$t=class{constructor(t){this.specification=t}possiblyEvaluate(t,r,n,i){return!!t.expression.evaluate(r,null,{},n,i)}interpolate(){return!1}},re=class{constructor(t){this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(let r in t){let n=t[r];n.specification.overridable&&this.overridableProperties.push(r);let i=this.defaultPropertyValues[r]=new gr(n,void 0),o=this.defaultTransitionablePropertyValues[r]=new an(n);this.defaultTransitioningPropertyValues[r]=o.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=i.possiblyEvaluate({})}}};C("DataDrivenProperty",O);C("DataConstantProperty",z);C("CrossFadedDataDrivenProperty",at);C("CrossFadedProperty",Gt);C("ColorRampProperty",$t);var Yi="-transition",ae=class extends qi{constructor(r,n){super();if(this.id=r.id,this.type=r.type,this._featureFilter={filter:()=>!0,needGeometry:!1},r.type!=="custom"&&(r=r,this.metadata=r.metadata,this.minzoom=r.minzoom,this.maxzoom=r.maxzoom,r.type!=="background"&&(this.source=r.source,this.sourceLayer=r["source-layer"],this.filter=r.filter),n.layout&&(this._unevaluatedLayout=new Ki(n.layout)),n.paint)){this._transitionablePaint=new Zi(n.paint);for(let i in r.paint)this.setPaintProperty(i,r.paint[i],{validate:!1});for(let i in r.layout)this.setLayoutProperty(i,r.layout[i],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new bt(n.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(r){return r==="visibility"?this.visibility:this._unevaluatedLayout.getValue(r)}setLayoutProperty(r,n,i={}){if(n!=null){let o="layers.".concat(this.id,".layout.").concat(r);if(this._validate(Ru,o,r,n,i))return}if(r==="visibility"){this.visibility=n;return}this._unevaluatedLayout.setValue(r,n)}getPaintProperty(r){return r.endsWith(Yi)?this._transitionablePaint.getTransition(r.slice(0,-Yi.length)):this._transitionablePaint.getValue(r)}setPaintProperty(r,n,i={}){if(n!=null){let o="layers.".concat(this.id,".paint.").concat(r);if(this._validate(zu,o,r,n,i))return!1}if(r.endsWith(Yi))return this._transitionablePaint.setTransition(r.slice(0,-Yi.length),n||void 0),!1;{let o=this._transitionablePaint._values[r],a=o.property.specification["property-type"]==="cross-faded-data-driven",s=o.value.isDataDriven(),l=o.value;this._transitionablePaint.setValue(r,n),this._handleSpecialPaintPropertyUpdate(r);let u=this._transitionablePaint._values[r].value;return u.isDataDriven()||s||a||this._handleOverridablePaintPropertyUpdate(r,l,u)}}_handleSpecialPaintPropertyUpdate(r){}_handleOverridablePaintPropertyUpdate(r,n,i){return!1}isHidden(r){return this.minzoom&&r<this.minzoom||this.maxzoom&&r>=this.maxzoom?!0:this.visibility==="none"}updateTransitions(r){this._transitioningPaint=this._transitionablePaint.transitioned(r,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(r,n){r.getCrossfadeParameters&&(this._crossfadeParameters=r.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(r,void 0,n)),this.paint=this._transitioningPaint.possiblyEvaluate(r,void 0,n)}serialize(){let r={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(r.layout=r.layout||{},r.layout.visibility=this.visibility),_l(r,(n,i)=>n!==void 0&&!(i==="layout"&&!Object.keys(n).length)&&!(i==="paint"&&!Object.keys(n).length))}_validate(r,n,i,o,a={}){return a&&a.validate===!1?!1:Ou(this,r.call(xt,{key:n,layerType:this.type,objectKey:i,value:o,styleSpec:S,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(let r in this.paint._values){let n=this.paint.get(r);if(!(!(n instanceof Se)||!mt(n.property.specification))&&(n.value.kind==="source"||n.value.kind==="composite")&&n.value.isStateDependent)return!0}return!1}};var ih={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array},vt=class{constructor(t,r){this._structArray=t,this._pos1=r*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}},oh=128,ah=5,ee=class{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(t,r){return t._trim(),r&&(t.isTransferred=!0,r.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}}static deserialize(t){let r=Object.create(this.prototype);return r.arrayBuffer=t.arrayBuffer,r.length=t.length,r.capacity=t.arrayBuffer.byteLength/r.bytesPerElement,r._refreshViews(),r}_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(t){this.reserve(t),this.length=t}reserve(t){if(t>this.capacity){this.capacity=Math.max(t,Math.floor(this.capacity*ah),oh),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);let r=this.uint8;this._refreshViews(),r&&this.uint8.set(r)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}};function X(e,t=1){let r=0,n=0,i=e.map(a=>{let s=sh(a.type),l=r=Ju(r,Math.max(t,s)),u=a.components||1;return n=Math.max(n,s),r+=s*u,{name:a.name,type:a.type,components:u,offset:l}}),o=Ju(r,Math.max(n,t));return{members:i,size:o,alignment:t}}function sh(e){return ih[e].BYTES_PER_ELEMENT}function Ju(e,t){return Math.ceil(e/t)*t}var Zu=J(de(),1),qt=class extends ee{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(r,n){let i=this.length;return this.resize(i+1),this.emplace(i,r,n)}emplace(r,n,i){let o=r*2;return this.int16[o+0]=n,this.int16[o+1]=i,r}};qt.prototype.bytesPerElement=4;C("StructArrayLayout2i4",qt);var sn=class extends ee{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(r,n,i){let o=this.length;return this.resize(o+1),this.emplace(o,r,n,i)}emplace(r,n,i,o){let a=r*3;return this.int16[a+0]=n,this.int16[a+1]=i,this.int16[a+2]=o,r}};sn.prototype.bytesPerElement=6;C("StructArrayLayout3i6",sn);var Xi=class extends ee{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(r,n,i,o){let a=this.length;return this.resize(a+1),this.emplace(a,r,n,i,o)}emplace(r,n,i,o,a){let s=r*4;return this.int16[s+0]=n,this.int16[s+1]=i,this.int16[s+2]=o,this.int16[s+3]=a,r}};Xi.prototype.bytesPerElement=8;C("StructArrayLayout4i8",Xi);var ln=class extends ee{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(r,n,i,o,a,s){let l=this.length;return this.resize(l+1),this.emplace(l,r,n,i,o,a,s)}emplace(r,n,i,o,a,s,l){let u=r*6;return this.int16[u+0]=n,this.int16[u+1]=i,this.int16[u+2]=o,this.int16[u+3]=a,this.int16[u+4]=s,this.int16[u+5]=l,r}};ln.prototype.bytesPerElement=12;C("StructArrayLayout2i4i12",ln);var un=class extends ee{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(r,n,i,o,a,s){let l=this.length;return this.resize(l+1),this.emplace(l,r,n,i,o,a,s)}emplace(r,n,i,o,a,s,l){let u=r*4,c=r*8;return this.int16[u+0]=n,this.int16[u+1]=i,this.uint8[c+4]=o,this.uint8[c+5]=a,this.uint8[c+6]=s,this.uint8[c+7]=l,r}};un.prototype.bytesPerElement=8;C("StructArrayLayout2i4ub8",un);var Pt=class extends ee{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(r,n){let i=this.length;return this.resize(i+1),this.emplace(i,r,n)}emplace(r,n,i){let o=r*2;return this.float32[o+0]=n,this.float32[o+1]=i,r}};Pt.prototype.bytesPerElement=8;C("StructArrayLayout2f8",Pt);var cn=class extends ee{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(r,n,i,o,a,s,l,u,c,p){let f=this.length;return this.resize(f+1),this.emplace(f,r,n,i,o,a,s,l,u,c,p)}emplace(r,n,i,o,a,s,l,u,c,p,f){let y=r*10;return this.uint16[y+0]=n,this.uint16[y+1]=i,this.uint16[y+2]=o,this.uint16[y+3]=a,this.uint16[y+4]=s,this.uint16[y+5]=l,this.uint16[y+6]=u,this.uint16[y+7]=c,this.uint16[y+8]=p,this.uint16[y+9]=f,r}};cn.prototype.bytesPerElement=20;C("StructArrayLayout10ui20",cn);var pn=class extends ee{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(r,n,i,o,a,s,l,u,c,p,f,y){let m=this.length;return this.resize(m+1),this.emplace(m,r,n,i,o,a,s,l,u,c,p,f,y)}emplace(r,n,i,o,a,s,l,u,c,p,f,y,m){let h=r*12;return this.int16[h+0]=n,this.int16[h+1]=i,this.int16[h+2]=o,this.int16[h+3]=a,this.uint16[h+4]=s,this.uint16[h+5]=l,this.uint16[h+6]=u,this.uint16[h+7]=c,this.int16[h+8]=p,this.int16[h+9]=f,this.int16[h+10]=y,this.int16[h+11]=m,r}};pn.prototype.bytesPerElement=24;C("StructArrayLayout4i4ui4i24",pn);var fn=class extends ee{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(r,n,i){let o=this.length;return this.resize(o+1),this.emplace(o,r,n,i)}emplace(r,n,i,o){let a=r*3;return this.float32[a+0]=n,this.float32[a+1]=i,this.float32[a+2]=o,r}};fn.prototype.bytesPerElement=12;C("StructArrayLayout3f12",fn);var yn=class extends ee{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(r){let n=this.length;return this.resize(n+1),this.emplace(n,r)}emplace(r,n){let i=r*1;return this.uint32[i+0]=n,r}};yn.prototype.bytesPerElement=4;C("StructArrayLayout1ul4",yn);var mn=class extends ee{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(r,n,i,o,a,s,l,u,c){let p=this.length;return this.resize(p+1),this.emplace(p,r,n,i,o,a,s,l,u,c)}emplace(r,n,i,o,a,s,l,u,c,p){let f=r*10,y=r*5;return this.int16[f+0]=n,this.int16[f+1]=i,this.int16[f+2]=o,this.int16[f+3]=a,this.int16[f+4]=s,this.int16[f+5]=l,this.uint32[y+3]=u,this.uint16[f+8]=c,this.uint16[f+9]=p,r}};mn.prototype.bytesPerElement=20;C("StructArrayLayout6i1ul2ui20",mn);var hn=class extends ee{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(r,n,i,o,a,s){let l=this.length;return this.resize(l+1),this.emplace(l,r,n,i,o,a,s)}emplace(r,n,i,o,a,s,l){let u=r*6;return this.int16[u+0]=n,this.int16[u+1]=i,this.int16[u+2]=o,this.int16[u+3]=a,this.int16[u+4]=s,this.int16[u+5]=l,r}};hn.prototype.bytesPerElement=12;C("StructArrayLayout2i2i2i12",hn);var Qi=class extends ee{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(r,n,i,o,a){let s=this.length;return this.resize(s+1),this.emplace(s,r,n,i,o,a)}emplace(r,n,i,o,a,s){let l=r*4,u=r*8;return this.float32[l+0]=n,this.float32[l+1]=i,this.float32[l+2]=o,this.int16[u+6]=a,this.int16[u+7]=s,r}};Qi.prototype.bytesPerElement=16;C("StructArrayLayout2f1f2i16",Qi);var dn=class extends ee{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(r,n,i,o){let a=this.length;return this.resize(a+1),this.emplace(a,r,n,i,o)}emplace(r,n,i,o,a){let s=r*12,l=r*3;return this.uint8[s+0]=n,this.uint8[s+1]=i,this.float32[l+1]=o,this.float32[l+2]=a,r}};dn.prototype.bytesPerElement=12;C("StructArrayLayout2ub2f12",dn);var gn=class extends ee{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(r,n,i){let o=this.length;return this.resize(o+1),this.emplace(o,r,n,i)}emplace(r,n,i,o){let a=r*3;return this.uint16[a+0]=n,this.uint16[a+1]=i,this.uint16[a+2]=o,r}};gn.prototype.bytesPerElement=6;C("StructArrayLayout3ui6",gn);var xn=class extends ee{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(r,n,i,o,a,s,l,u,c,p,f,y,m,h,d,g,v){let x=this.length;return this.resize(x+1),this.emplace(x,r,n,i,o,a,s,l,u,c,p,f,y,m,h,d,g,v)}emplace(r,n,i,o,a,s,l,u,c,p,f,y,m,h,d,g,v,x){let P=r*24,b=r*12,w=r*48;return this.int16[P+0]=n,this.int16[P+1]=i,this.uint16[P+2]=o,this.uint16[P+3]=a,this.uint32[b+2]=s,this.uint32[b+3]=l,this.uint32[b+4]=u,this.uint16[P+10]=c,this.uint16[P+11]=p,this.uint16[P+12]=f,this.float32[b+7]=y,this.float32[b+8]=m,this.uint8[w+36]=h,this.uint8[w+37]=d,this.uint8[w+38]=g,this.uint32[b+10]=v,this.int16[P+22]=x,r}};xn.prototype.bytesPerElement=48;C("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",xn);var bn=class extends ee{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(r,n,i,o,a,s,l,u,c,p,f,y,m,h,d,g,v,x,P,b,w,I,E,M,A,_,k,B){let D=this.length;return this.resize(D+1),this.emplace(D,r,n,i,o,a,s,l,u,c,p,f,y,m,h,d,g,v,x,P,b,w,I,E,M,A,_,k,B)}emplace(r,n,i,o,a,s,l,u,c,p,f,y,m,h,d,g,v,x,P,b,w,I,E,M,A,_,k,B,D){let T=r*32,R=r*16;return this.int16[T+0]=n,this.int16[T+1]=i,this.int16[T+2]=o,this.int16[T+3]=a,this.int16[T+4]=s,this.int16[T+5]=l,this.int16[T+6]=u,this.int16[T+7]=c,this.uint16[T+8]=p,this.uint16[T+9]=f,this.uint16[T+10]=y,this.uint16[T+11]=m,this.uint16[T+12]=h,this.uint16[T+13]=d,this.uint16[T+14]=g,this.uint16[T+15]=v,this.uint16[T+16]=x,this.uint16[T+17]=P,this.uint16[T+18]=b,this.uint16[T+19]=w,this.uint16[T+20]=I,this.uint16[T+21]=E,this.uint16[T+22]=M,this.uint32[R+12]=A,this.float32[R+13]=_,this.float32[R+14]=k,this.uint16[T+30]=B,this.uint16[T+31]=D,r}};bn.prototype.bytesPerElement=64;C("StructArrayLayout8i15ui1ul2f2ui64",bn);var jt=class extends ee{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(r){let n=this.length;return this.resize(n+1),this.emplace(n,r)}emplace(r,n){let i=r*1;return this.float32[i+0]=n,r}};jt.prototype.bytesPerElement=4;C("StructArrayLayout1f4",jt);var vn=class extends ee{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(r,n,i){let o=this.length;return this.resize(o+1),this.emplace(o,r,n,i)}emplace(r,n,i,o){let a=r*6,s=r*3;return this.uint16[a+0]=n,this.float32[s+1]=i,this.float32[s+2]=o,r}};vn.prototype.bytesPerElement=12;C("StructArrayLayout1ui2f12",vn);var Pn=class extends ee{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(r,n,i){let o=this.length;return this.resize(o+1),this.emplace(o,r,n,i)}emplace(r,n,i,o){let a=r*2,s=r*4;return this.uint32[a+0]=n,this.uint16[s+2]=i,this.uint16[s+3]=o,r}};Pn.prototype.bytesPerElement=8;C("StructArrayLayout1ul2ui8",Pn);var Sn=class extends ee{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(r,n){let i=this.length;return this.resize(i+1),this.emplace(i,r,n)}emplace(r,n,i){let o=r*2;return this.uint16[o+0]=n,this.uint16[o+1]=i,r}};Sn.prototype.bytesPerElement=4;C("StructArrayLayout2ui4",Sn);var eo=class extends ee{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(r){let n=this.length;return this.resize(n+1),this.emplace(n,r)}emplace(r,n){let i=r*1;return this.uint16[i+0]=n,r}};eo.prototype.bytesPerElement=2;C("StructArrayLayout1ui2",eo);var xr=class extends ee{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(r,n,i,o){let a=this.length;return this.resize(a+1),this.emplace(a,r,n,i,o)}emplace(r,n,i,o,a){let s=r*4;return this.float32[s+0]=n,this.float32[s+1]=i,this.float32[s+2]=o,this.float32[s+3]=a,r}};xr.prototype.bytesPerElement=16;C("StructArrayLayout4f16",xr);var to=class extends vt{get anchorPointX(){return this._structArray.int16[this._pos2+0]}get anchorPointY(){return this._structArray.int16[this._pos2+1]}get x1(){return this._structArray.int16[this._pos2+2]}get y1(){return this._structArray.int16[this._pos2+3]}get x2(){return this._structArray.int16[this._pos2+4]}get y2(){return this._structArray.int16[this._pos2+5]}get featureIndex(){return this._structArray.uint32[this._pos4+3]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+8]}get bucketIndex(){return this._structArray.uint16[this._pos2+9]}get anchorPoint(){return new Zu.default(this.anchorPointX,this.anchorPointY)}};to.prototype.size=20;var wn=class extends mn{get(t){return new to(this,t)}};C("CollisionBoxArray",wn);var ro=class extends vt{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(r){this._structArray.uint8[this._pos1+37]=r}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(r){this._structArray.uint8[this._pos1+38]=r}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(r){this._structArray.uint32[this._pos4+10]=r}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}};ro.prototype.size=48;var An=class extends xn{get(t){return new ro(this,t)}};C("PlacedSymbolArray",An);var no=class extends vt{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(r){this._structArray.uint32[this._pos4+12]=r}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+14]}get textAnchorOffsetStartIndex(){return this._structArray.uint16[this._pos2+30]}get textAnchorOffsetEndIndex(){return this._structArray.uint16[this._pos2+31]}};no.prototype.size=64;var _n=class extends bn{get(t){return new no(this,t)}};C("SymbolInstanceArray",_n);var In=class extends jt{getoffsetX(t){return this.float32[t*1+0]}};C("GlyphOffsetArray",In);var Tn=class extends sn{getx(t){return this.int16[t*3+0]}gety(t){return this.int16[t*3+1]}gettileUnitDistanceFromAnchor(t){return this.int16[t*3+2]}};C("SymbolLineVertexArray",Tn);var io=class extends vt{get textAnchor(){return this._structArray.uint16[this._pos2+0]}get textOffset0(){return this._structArray.float32[this._pos4+1]}get textOffset1(){return this._structArray.float32[this._pos4+2]}};io.prototype.size=12;var Cn=class extends vn{get(t){return new io(this,t)}};C("TextAnchorOffsetArray",Cn);var oo=class extends vt{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]}};oo.prototype.size=8;var kn=class extends Pn{get(t){return new oo(this,t)}};C("FeatureIndexArray",kn);var ao=class extends qt{};var so=class extends qt{},lo=class extends qt{},uo=class extends ln{};var co=class extends un{},po=class extends Pt{},st=class extends cn{},fo=class extends pn{},yo=class extends fn{},mo=class extends yn{},Mn=class extends hn{};var ho=class extends dn{};var Le=class extends gn{},St=class extends Sn{};var lh=X([{name:"a_pos",components:2,type:"Int16"}],4);var{members:Wu,size:D0,alignment:V0}=lh;var me=class e{constructor(t=[]){this.segments=t}prepareSegment(t,r,n,i){let o=this.segments[this.segments.length-1];return t>e.MAX_VERTEX_ARRAY_LENGTH&&fe("Max vertices per segment is ".concat(e.MAX_VERTEX_ARRAY_LENGTH,": bucket requested ").concat(t)),(!o||o.vertexLength+t>e.MAX_VERTEX_ARRAY_LENGTH||o.sortKey!==i)&&(o={vertexOffset:r.length,primitiveOffset:n.length,vertexLength:0,primitiveLength:0},i!==void 0&&(o.sortKey=i),this.segments.push(o)),o}get(){return this.segments}destroy(){for(let t of this.segments)for(let r in t.vaos)t.vaos[r].destroy()}static simpleSegment(t,r,n,i){return new e([{vertexOffset:t,primitiveOffset:r,vertexLength:n,primitiveLength:i,vaos:{},sortKey:0}])}};me.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1;C("SegmentVector",me);function is(e,t){return e=tt(Math.floor(e),0,255),t=tt(Math.floor(t),0,255),256*e+t}var En=X([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]);var Qu=J(ss(),1);var Fn=class e{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(t,r,n,i){this.ids.push(Xu(t)),this.positions.push(r,n,i)}getPositions(t){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");let r=Xu(t),n=0,i=this.ids.length-1;for(;n<i;){let a=n+i>>1;this.ids[a]>=r?i=a:n=a+1}let o=[];for(;this.ids[n]===r;){let a=this.positions[3*n],s=this.positions[3*n+1],l=this.positions[3*n+2];o.push({index:a,start:s,end:l}),n++}return o}static serialize(t,r){let n=new Float64Array(t.ids),i=new Uint32Array(t.positions);return ls(n,i,0,n.length-1),r&&r.push(n.buffer,i.buffer),{ids:n,positions:i}}static deserialize(t){let r=new e;return r.ids=t.ids,r.positions=t.positions,r.indexed=!0,r}};function Xu(e){let t=+e;return!isNaN(t)&&t<=Number.MAX_SAFE_INTEGER?t:(0,Qu.default)(String(e))}function ls(e,t,r,n){for(;r<n;){let i=e[r+n>>1],o=r-1,a=n+1;for(;;){do o++;while(e[o]<i);do a--;while(e[a]>i);if(o>=a)break;xo(e,o,a),xo(t,3*o,3*a),xo(t,3*o+1,3*a+1),xo(t,3*o+2,3*a+2)}a-r<n-a?(ls(e,t,r,a),r=a+1):(ls(e,t,a+1,n),n=a)}}function xo(e,t,r){let n=e[t];e[t]=e[r],e[r]=n}C("FeaturePositionMap",Fn);var Ln=class{constructor(t,r){this.gl=t.gl,this.location=r}};var br=class extends Ln{constructor(t,r){super(t,r),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1f(this.location,t))}};var bo=class extends Ln{constructor(t,r){super(t,r),this.current=[0,0,0,0]}set(t){(t[0]!==this.current[0]||t[1]!==this.current[1]||t[2]!==this.current[2]||t[3]!==this.current[3])&&(this.current=t,this.gl.uniform4f(this.location,t[0],t[1],t[2],t[3]))}},vo=class extends Ln{constructor(t,r){super(t,r),this.current=W.transparent}set(t){(t.r!==this.current.r||t.g!==this.current.g||t.b!==this.current.b||t.a!==this.current.a)&&(this.current=t,this.gl.uniform4f(this.location,t.r,t.g,t.b,t.a))}},K0=new Float32Array(16);function us(e){return[is(255*e.r,255*e.g),is(255*e.b,255*e.a)]}var Jt=class{constructor(t,r,n){this.value=t,this.uniformNames=r.map(i=>"u_".concat(i)),this.type=n}setUniform(t,r,n){t.set(n.constantOr(this.value))}getBinding(t,r,n){return this.type==="color"?new vo(t,r):new br(t,r)}},wt=class{constructor(t,r){this.uniformNames=r.map(n=>"u_".concat(n)),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(t,r){this.pixelRatioFrom=r.pixelRatio,this.pixelRatioTo=t.pixelRatio,this.patternFrom=r.tlbr,this.patternTo=t.tlbr}setUniform(t,r,n,i){let o=i==="u_pattern_to"?this.patternTo:i==="u_pattern_from"?this.patternFrom:i==="u_pixel_ratio_to"?this.pixelRatioTo:i==="u_pixel_ratio_from"?this.pixelRatioFrom:null;o&&t.set(o)}getBinding(t,r,n){return n.substr(0,9)==="u_pattern"?new bo(t,r):new br(t,r)}},We=class{constructor(t,r,n,i){this.expression=t,this.type=n,this.maxValue=0,this.paintVertexAttributes=r.map(o=>({name:"a_".concat(o),type:"Float32",components:n==="color"?2:1,offset:0})),this.paintVertexArray=new i}populatePaintArray(t,r,n,i,o){let a=this.paintVertexArray.length,s=this.expression.evaluate(new q(0),r,{},i,[],o);this.paintVertexArray.resize(t),this._setPaintValue(a,t,s)}updatePaintArray(t,r,n,i){let o=this.expression.evaluate({zoom:0},n,i);this._setPaintValue(t,r,o)}_setPaintValue(t,r,n){if(this.type==="color"){let i=us(n);for(let o=t;o<r;o++)this.paintVertexArray.emplace(o,i[0],i[1])}else{for(let i=t;i<r;i++)this.paintVertexArray.emplace(i,n);this.maxValue=Math.max(this.maxValue,Math.abs(n))}}upload(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}},De=class{constructor(t,r,n,i,o,a){this.expression=t,this.uniformNames=r.map(s=>"u_".concat(s,"_t")),this.type=n,this.useIntegerZoom=i,this.zoom=o,this.maxValue=0,this.paintVertexAttributes=r.map(s=>({name:"a_".concat(s),type:"Float32",components:n==="color"?4:2,offset:0})),this.paintVertexArray=new a}populatePaintArray(t,r,n,i,o){let a=this.expression.evaluate(new q(this.zoom),r,{},i,[],o),s=this.expression.evaluate(new q(this.zoom+1),r,{},i,[],o),l=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(l,t,a,s)}updatePaintArray(t,r,n,i){let o=this.expression.evaluate({zoom:this.zoom},n,i),a=this.expression.evaluate({zoom:this.zoom+1},n,i);this._setPaintValue(t,r,o,a)}_setPaintValue(t,r,n,i){if(this.type==="color"){let o=us(n),a=us(i);for(let s=t;s<r;s++)this.paintVertexArray.emplace(s,o[0],o[1],a[0],a[1])}else{for(let o=t;o<r;o++)this.paintVertexArray.emplace(o,n,i);this.maxValue=Math.max(this.maxValue,Math.abs(n),Math.abs(i))}}upload(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(t,r){let n=this.useIntegerZoom?Math.floor(r.zoom):r.zoom,i=tt(this.expression.interpolationFactor(n,this.zoom,this.zoom+1),0,1);t.set(i)}getBinding(t,r,n){return new br(t,r)}},Ye=class{constructor(t,r,n,i,o,a){this.expression=t,this.type=r,this.useIntegerZoom=n,this.zoom=i,this.layerId=a,this.zoomInPaintVertexArray=new o,this.zoomOutPaintVertexArray=new o}populatePaintArray(t,r,n){let i=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(t),this.zoomOutPaintVertexArray.resize(t),this._setPaintValues(i,t,r.patterns&&r.patterns[this.layerId],n)}updatePaintArray(t,r,n,i,o){this._setPaintValues(t,r,n.patterns&&n.patterns[this.layerId],o)}_setPaintValues(t,r,n,i){if(!i||!n)return;let{min:o,mid:a,max:s}=n,l=i[o],u=i[a],c=i[s];if(!(!l||!u||!c))for(let p=t;p<r;p++)this.zoomInPaintVertexArray.emplace(p,u.tl[0],u.tl[1],u.br[0],u.br[1],l.tl[0],l.tl[1],l.br[0],l.br[1],u.pixelRatio,l.pixelRatio),this.zoomOutPaintVertexArray.emplace(p,u.tl[0],u.tl[1],u.br[0],u.br[1],c.tl[0],c.tl[1],c.br[0],c.br[1],u.pixelRatio,c.pixelRatio)}upload(t){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=t.createVertexBuffer(this.zoomInPaintVertexArray,En.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=t.createVertexBuffer(this.zoomOutPaintVertexArray,En.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}},Po=class{constructor(t,r,n){this.binders={},this._buffers=[];let i=[];for(let o in t.paint._values){if(!n(o))continue;let a=t.paint.get(o);if(!(a instanceof Se)||!mt(a.property.specification))continue;let s=fh(o,t.type),l=a.value,u=a.property.specification.type,c=a.property.useIntegerZoom,p=a.property.specification["property-type"],f=p==="cross-faded"||p==="cross-faded-data-driven";if(l.kind==="constant")this.binders[o]=f?new wt(l.value,s):new Jt(l.value,s,u),i.push("/u_".concat(o));else if(l.kind==="source"||f){let y=ec(o,u,"source");this.binders[o]=f?new Ye(l,u,c,r,y,t.id):new We(l,s,u,y),i.push("/a_".concat(o))}else{let y=ec(o,u,"composite");this.binders[o]=new De(l,s,u,c,r,y),i.push("/z_".concat(o))}}this.cacheKey=i.sort().join("")}getMaxValue(t){let r=this.binders[t];return r instanceof We||r instanceof De?r.maxValue:0}populatePaintArrays(t,r,n,i,o){for(let a in this.binders){let s=this.binders[a];(s instanceof We||s instanceof De||s instanceof Ye)&&s.populatePaintArray(t,r,n,i,o)}}setConstantPatternPositions(t,r){for(let n in this.binders){let i=this.binders[n];i instanceof wt&&i.setConstantPatternPositions(t,r)}}updatePaintArrays(t,r,n,i,o){let a=!1;for(let s in t){let l=r.getPositions(s);for(let u of l){let c=n.feature(u.index);for(let p in this.binders){let f=this.binders[p];if((f instanceof We||f instanceof De||f instanceof Ye)&&f.expression.isStateDependent===!0){let y=i.paint.get(p);f.expression=y.value,f.updatePaintArray(u.start,u.end,c,t[s],o),a=!0}}}}return a}defines(){let t=[];for(let r in this.binders){let n=this.binders[r];(n instanceof Jt||n instanceof wt)&&t.push(...n.uniformNames.map(i=>"#define HAS_UNIFORM_".concat(i)))}return t}getBinderAttributes(){let t=[];for(let r in this.binders){let n=this.binders[r];if(n instanceof We||n instanceof De)for(let i=0;i<n.paintVertexAttributes.length;i++)t.push(n.paintVertexAttributes[i].name);else if(n instanceof Ye)for(let i=0;i<En.members.length;i++)t.push(En.members[i].name)}return t}getBinderUniforms(){let t=[];for(let r in this.binders){let n=this.binders[r];if(n instanceof Jt||n instanceof wt||n instanceof De)for(let i of n.uniformNames)t.push(i)}return t}getPaintVertexBuffers(){return this._buffers}getUniforms(t,r){let n=[];for(let i in this.binders){let o=this.binders[i];if(o instanceof Jt||o instanceof wt||o instanceof De){for(let a of o.uniformNames)if(r[a]){let s=o.getBinding(t,r[a],a);n.push({name:a,property:i,binding:s})}}}return n}setUniforms(t,r,n,i){for(let{name:o,property:a,binding:s}of r)this.binders[a].setUniform(s,i,n.get(a),o)}updatePaintBuffers(t){this._buffers=[];for(let r in this.binders){let n=this.binders[r];if(t&&n instanceof Ye){let i=t.fromScale===2?n.zoomInPaintVertexBuffer:n.zoomOutPaintVertexBuffer;i&&this._buffers.push(i)}else(n instanceof We||n instanceof De)&&n.paintVertexBuffer&&this._buffers.push(n.paintVertexBuffer)}}upload(t){for(let r in this.binders){let n=this.binders[r];(n instanceof We||n instanceof De||n instanceof Ye)&&n.upload(t)}this.updatePaintBuffers()}destroy(){for(let t in this.binders){let r=this.binders[t];(r instanceof We||r instanceof De||r instanceof Ye)&&r.destroy()}}},Ce=class{constructor(t,r,n=()=>!0){this.programConfigurations={};for(let i of t)this.programConfigurations[i.id]=new Po(i,r,n);this.needsUpload=!1,this._featureMap=new Fn,this._bufferOffset=0}populatePaintArrays(t,r,n,i,o,a){for(let s in this.programConfigurations)this.programConfigurations[s].populatePaintArrays(t,r,i,o,a);r.id!==void 0&&this._featureMap.add(r.id,n,this._bufferOffset,t),this._bufferOffset=t,this.needsUpload=!0}updatePaintArrays(t,r,n,i){for(let o of n)this.needsUpload=this.programConfigurations[o.id].updatePaintArrays(t,this._featureMap,r,o,i)||this.needsUpload}get(t){return this.programConfigurations[t]}upload(t){if(this.needsUpload){for(let r in this.programConfigurations)this.programConfigurations[r].upload(t);this.needsUpload=!1}}destroy(){for(let t in this.programConfigurations)this.programConfigurations[t].destroy()}};function fh(e,t){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[e]||[e.replace("".concat(t,"-"),"").replace(/-/g,"_")]}function yh(e){return{"line-pattern":{source:st,composite:st},"fill-pattern":{source:st,composite:st},"fill-extrusion-pattern":{source:st,composite:st}}[e]}function ec(e,t,r){let n={color:{source:Pt,composite:xr},number:{source:jt,composite:Pt}},i=yh(e);return i&&i[r]||n[t][r]}C("ConstantBinder",Jt);C("CrossFadedConstantBinder",wt);C("SourceExpressionBinder",We);C("CrossFadedCompositeBinder",Ye);C("CompositeExpressionBinder",De);C("ProgramConfiguration",Po,{omit:["_buffers"]});C("ProgramConfigurationSet",Ce);var mh=15,cs=Math.pow(2,mh-1)-1,tc=-cs-1;function ke(e){let t=8192/e.extent,r=e.loadGeometry();for(let n=0;n<r.length;n++){let i=r[n];for(let o=0;o<i.length;o++){let a=i[o],s=Math.round(a.x*t),l=Math.round(a.y*t);a.x=tt(s,tc,cs),a.y=tt(l,tc,cs),(s<a.x||s>a.x+1||l<a.y||l>a.y+1)&&fe("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return r}function Ne(e,t){return{type:e.type,id:e.id,properties:e.properties,geometry:t?ke(e):[]}}function So(e,t,r,n,i){e.emplaceBack(t*2+(n+1)/2,r*2+(i+1)/2)}var Zt=class{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(r=>r.id),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new so,this.indexArray=new Le,this.segments=new me,this.programConfigurations=new Ce(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(t,r,n){let i=this.layers[0],o=[],a=null,s=!1;i.type==="circle"&&(a=i.layout.get("circle-sort-key"),s=!a.isConstant());for(let{feature:l,id:u,index:c,sourceLayerIndex:p}of t){let f=this.layers[0]._featureFilter.needGeometry,y=Ne(l,f);if(!this.layers[0]._featureFilter.filter(new q(this.zoom),y,n))continue;let m=s?a.evaluate(y,{},n):void 0,h={id:u,properties:l.properties,type:l.type,sourceLayerIndex:p,index:c,geometry:f?y.geometry:ke(l),patterns:{},sortKey:m};o.push(h)}s&&o.sort((l,u)=>l.sortKey-u.sortKey);for(let l of o){let{geometry:u,index:c,sourceLayerIndex:p}=l,f=t[c].feature;this.addFeature(l,u,c,n),r.featureIndex.insert(f,u,c,p,this.index)}}update(t,r,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,n)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Wu),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(t,r,n,i){for(let o of r)for(let a of o){let s=a.x,l=a.y;if(s<0||s>=8192||l<0||l>=8192)continue;let u=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,t.sortKey),c=u.vertexLength;So(this.layoutVertexArray,s,l,-1,-1),So(this.layoutVertexArray,s,l,1,-1),So(this.layoutVertexArray,s,l,1,1),So(this.layoutVertexArray,s,l,-1,1),this.indexArray.emplaceBack(c,c+1,c+2),this.indexArray.emplaceBack(c,c+3,c+2),u.vertexLength+=4,u.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,n,{},i)}};C("CircleBucket",Zt,{omit:["layers"]});var Dn=J(de(),1);function nc(e,t){for(let r=0;r<e.length;r++)if(vr(t,e[r]))return!0;for(let r=0;r<t.length;r++)if(vr(e,t[r]))return!0;return!!fs(e,t)}function ic(e,t,r){return!!(vr(e,t)||ps(t,e,r))}function wo(e,t){if(e.length===1)return rc(t,e[0]);for(let r=0;r<t.length;r++){let n=t[r];for(let i=0;i<n.length;i++)if(vr(e,n[i]))return!0}for(let r=0;r<e.length;r++)if(rc(t,e[r]))return!0;for(let r=0;r<t.length;r++)if(fs(e,t[r]))return!0;return!1}function oc(e,t,r){for(let n=0;n<t.length;n++){let i=t[n];if(e.length>=3){for(let o=0;o<i.length;o++)if(vr(e,i[o]))return!0}if(hh(e,i,r))return!0}return!1}function hh(e,t,r){if(e.length>1){if(fs(e,t))return!0;for(let n=0;n<t.length;n++)if(ps(t[n],e,r))return!0}for(let n=0;n<e.length;n++)if(ps(e[n],t,r))return!0;return!1}function fs(e,t){if(e.length===0||t.length===0)return!1;for(let r=0;r<e.length-1;r++){let n=e[r],i=e[r+1];for(let o=0;o<t.length-1;o++){let a=t[o],s=t[o+1];if(dh(n,i,a,s))return!0}}return!1}function dh(e,t,r,n){return rt(e,r,n)!==rt(t,r,n)&&rt(e,t,r)!==rt(e,t,n)}function ps(e,t,r){let n=r*r;if(t.length===1)return e.distSqr(t[0])<n;for(let i=1;i<t.length;i++){let o=t[i-1],a=t[i];if(ys(e,o,a)<n)return!0}return!1}function ys(e,t,r){let n=t.distSqr(r);if(n===0)return e.distSqr(t);let i=((e.x-t.x)*(r.x-t.x)+(e.y-t.y)*(r.y-t.y))/n;return i<0?e.distSqr(t):i>1?e.distSqr(r):e.distSqr(r.sub(t)._mult(i)._add(t))}function rc(e,t){let r=!1,n,i,o;for(let a=0;a<e.length;a++){n=e[a];for(let s=0,l=n.length-1;s<n.length;l=s++)i=n[s],o=n[l],i.y>t.y!=o.y>t.y&&t.x<(o.x-i.x)*(t.y-i.y)/(o.y-i.y)+i.x&&(r=!r)}return r}function vr(e,t){let r=!1;for(let n=0,i=e.length-1;n<e.length;i=n++){let o=e[n],a=e[i];o.y>t.y!=a.y>t.y&&t.x<(a.x-o.x)*(t.y-o.y)/(a.y-o.y)+o.x&&(r=!r)}return r}function ac(e,t,r,n,i){for(let a of e)if(t<=a.x&&r<=a.y&&n>=a.x&&i>=a.y)return!0;let o=[new Dn.default(t,r),new Dn.default(t,i),new Dn.default(n,i),new Dn.default(n,r)];if(e.length>2){for(let a of o)if(vr(e,a))return!0}for(let a=0;a<e.length-1;a++){let s=e[a],l=e[a+1];if(gh(s,l,o))return!0}return!1}function gh(e,t,r){let n=r[0],i=r[2];if(e.x<n.x&&t.x<n.x||e.x>i.x&&t.x>i.x||e.y<n.y&&t.y<n.y||e.y>i.y&&t.y>i.y)return!1;let o=rt(e,t,r[0]);return o!==rt(e,t,r[1])||o!==rt(e,t,r[2])||o!==rt(e,t,r[3])}var Ao=J(de(),1);function Wt(e,t,r){let n=t.paint.get(e).value;return n.kind==="constant"?n.value:r.programConfigurations.get(t.id).getMaxValue(e)}function At(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function _t(e,t,r,n,i){if(!t[0]&&!t[1])return e;let o=Ao.default.convert(t)._mult(i);r==="viewport"&&o._rotate(-n);let a=[];for(let s=0;s<e.length;s++){let l=e[s];a.push(l.sub(o))}return a}function sc(e,t){let r=[];for(let n=0;n<e.length;n++){let i=e[n],o=[];for(let a=0;a<i.length;a++){let s=i[a-1],l=i[a],u=i[a+1],c=a===0?new Ao.default(0,0):l.sub(s)._unit()._perp(),p=a===i.length-1?new Ao.default(0,0):u.sub(l)._unit()._perp(),f=c._add(p)._unit(),y=f.x*p.x+f.y*p.y;y!==0&&f._mult(1/y),o.push(f._mult(t)._add(l))}r.push(o)}return r}var lc,xh=()=>lc=lc||new re({"circle-sort-key":new O(S.layout_circle["circle-sort-key"])}),uc,bh=()=>uc=uc||new re({"circle-radius":new O(S.paint_circle["circle-radius"]),"circle-color":new O(S.paint_circle["circle-color"]),"circle-blur":new O(S.paint_circle["circle-blur"]),"circle-opacity":new O(S.paint_circle["circle-opacity"]),"circle-translate":new z(S.paint_circle["circle-translate"]),"circle-translate-anchor":new z(S.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new z(S.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new z(S.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new O(S.paint_circle["circle-stroke-width"]),"circle-stroke-color":new O(S.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new O(S.paint_circle["circle-stroke-opacity"])}),cc={get paint(){return bh()},get layout(){return xh()}};var Q=1e-6,Ge=typeof Float32Array<"u"?Float32Array:Array,Vn=Math.random;var Gv=Math.PI/180;Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});var Bn={};ml(Bn,{add:()=>nd,adjoint:()=>Th,clone:()=>Ph,copy:()=>Sh,create:()=>vh,determinant:()=>Ch,equals:()=>sd,exactEquals:()=>ad,frob:()=>rd,fromQuat:()=>Jh,fromQuat2:()=>Nh,fromRotation:()=>zh,fromRotationTranslation:()=>mc,fromRotationTranslationScale:()=>qh,fromRotationTranslationScaleOrigin:()=>jh,fromScaling:()=>Bh,fromTranslation:()=>Vh,fromValues:()=>wh,fromXRotation:()=>Rh,fromYRotation:()=>Oh,fromZRotation:()=>Uh,frustum:()=>Zh,getRotation:()=>$h,getScaling:()=>hc,getTranslation:()=>Gh,identity:()=>fc,invert:()=>Ih,lookAt:()=>Qh,mul:()=>ld,multiply:()=>yc,multiplyScalar:()=>id,multiplyScalarAndAdd:()=>od,ortho:()=>Yh,orthoNO:()=>gc,orthoZO:()=>Xh,perspective:()=>Wh,perspectiveFromFieldOfView:()=>Kh,perspectiveNO:()=>dc,perspectiveZO:()=>Hh,rotate:()=>Eh,rotateX:()=>Fh,rotateY:()=>Lh,rotateZ:()=>Dh,scale:()=>Mh,set:()=>Ah,str:()=>td,sub:()=>ud,subtract:()=>xc,targetTo:()=>ed,translate:()=>kh,transpose:()=>_h});function vh(){var e=new Ge(16);return Ge!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function Ph(e){var t=new Ge(16);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function Sh(e,t){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}function wh(e,t,r,n,i,o,a,s,l,u,c,p,f,y,m,h){var d=new Ge(16);return d[0]=e,d[1]=t,d[2]=r,d[3]=n,d[4]=i,d[5]=o,d[6]=a,d[7]=s,d[8]=l,d[9]=u,d[10]=c,d[11]=p,d[12]=f,d[13]=y,d[14]=m,d[15]=h,d}function Ah(e,t,r,n,i,o,a,s,l,u,c,p,f,y,m,h,d){return e[0]=t,e[1]=r,e[2]=n,e[3]=i,e[4]=o,e[5]=a,e[6]=s,e[7]=l,e[8]=u,e[9]=c,e[10]=p,e[11]=f,e[12]=y,e[13]=m,e[14]=h,e[15]=d,e}function fc(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function _h(e,t){if(e===t){var r=t[1],n=t[2],i=t[3],o=t[6],a=t[7],s=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=r,e[6]=t[9],e[7]=t[13],e[8]=n,e[9]=o,e[11]=t[14],e[12]=i,e[13]=a,e[14]=s}else e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15];return e}function Ih(e,t){var r=t[0],n=t[1],i=t[2],o=t[3],a=t[4],s=t[5],l=t[6],u=t[7],c=t[8],p=t[9],f=t[10],y=t[11],m=t[12],h=t[13],d=t[14],g=t[15],v=r*s-n*a,x=r*l-i*a,P=r*u-o*a,b=n*l-i*s,w=n*u-o*s,I=i*u-o*l,E=c*h-p*m,M=c*d-f*m,A=c*g-y*m,_=p*d-f*h,k=p*g-y*h,B=f*g-y*d,D=v*B-x*k+P*_+b*A-w*M+I*E;return D?(D=1/D,e[0]=(s*B-l*k+u*_)*D,e[1]=(i*k-n*B-o*_)*D,e[2]=(h*I-d*w+g*b)*D,e[3]=(f*w-p*I-y*b)*D,e[4]=(l*A-a*B-u*M)*D,e[5]=(r*B-i*A+o*M)*D,e[6]=(d*P-m*I-g*x)*D,e[7]=(c*I-f*P+y*x)*D,e[8]=(a*k-s*A+u*E)*D,e[9]=(n*A-r*k-o*E)*D,e[10]=(m*w-h*P+g*v)*D,e[11]=(p*P-c*w-y*v)*D,e[12]=(s*M-a*_-l*E)*D,e[13]=(r*_-n*M+i*E)*D,e[14]=(h*x-m*b-d*v)*D,e[15]=(c*b-p*x+f*v)*D,e):null}function Th(e,t){var r=t[0],n=t[1],i=t[2],o=t[3],a=t[4],s=t[5],l=t[6],u=t[7],c=t[8],p=t[9],f=t[10],y=t[11],m=t[12],h=t[13],d=t[14],g=t[15];return e[0]=s*(f*g-y*d)-p*(l*g-u*d)+h*(l*y-u*f),e[1]=-(n*(f*g-y*d)-p*(i*g-o*d)+h*(i*y-o*f)),e[2]=n*(l*g-u*d)-s*(i*g-o*d)+h*(i*u-o*l),e[3]=-(n*(l*y-u*f)-s*(i*y-o*f)+p*(i*u-o*l)),e[4]=-(a*(f*g-y*d)-c*(l*g-u*d)+m*(l*y-u*f)),e[5]=r*(f*g-y*d)-c*(i*g-o*d)+m*(i*y-o*f),e[6]=-(r*(l*g-u*d)-a*(i*g-o*d)+m*(i*u-o*l)),e[7]=r*(l*y-u*f)-a*(i*y-o*f)+c*(i*u-o*l),e[8]=a*(p*g-y*h)-c*(s*g-u*h)+m*(s*y-u*p),e[9]=-(r*(p*g-y*h)-c*(n*g-o*h)+m*(n*y-o*p)),e[10]=r*(s*g-u*h)-a*(n*g-o*h)+m*(n*u-o*s),e[11]=-(r*(s*y-u*p)-a*(n*y-o*p)+c*(n*u-o*s)),e[12]=-(a*(p*d-f*h)-c*(s*d-l*h)+m*(s*f-l*p)),e[13]=r*(p*d-f*h)-c*(n*d-i*h)+m*(n*f-i*p),e[14]=-(r*(s*d-l*h)-a*(n*d-i*h)+m*(n*l-i*s)),e[15]=r*(s*f-l*p)-a*(n*f-i*p)+c*(n*l-i*s),e}function Ch(e){var t=e[0],r=e[1],n=e[2],i=e[3],o=e[4],a=e[5],s=e[6],l=e[7],u=e[8],c=e[9],p=e[10],f=e[11],y=e[12],m=e[13],h=e[14],d=e[15],g=t*a-r*o,v=t*s-n*o,x=t*l-i*o,P=r*s-n*a,b=r*l-i*a,w=n*l-i*s,I=u*m-c*y,E=u*h-p*y,M=u*d-f*y,A=c*h-p*m,_=c*d-f*m,k=p*d-f*h;return g*k-v*_+x*A+P*M-b*E+w*I}function yc(e,t,r){var n=t[0],i=t[1],o=t[2],a=t[3],s=t[4],l=t[5],u=t[6],c=t[7],p=t[8],f=t[9],y=t[10],m=t[11],h=t[12],d=t[13],g=t[14],v=t[15],x=r[0],P=r[1],b=r[2],w=r[3];return e[0]=x*n+P*s+b*p+w*h,e[1]=x*i+P*l+b*f+w*d,e[2]=x*o+P*u+b*y+w*g,e[3]=x*a+P*c+b*m+w*v,x=r[4],P=r[5],b=r[6],w=r[7],e[4]=x*n+P*s+b*p+w*h,e[5]=x*i+P*l+b*f+w*d,e[6]=x*o+P*u+b*y+w*g,e[7]=x*a+P*c+b*m+w*v,x=r[8],P=r[9],b=r[10],w=r[11],e[8]=x*n+P*s+b*p+w*h,e[9]=x*i+P*l+b*f+w*d,e[10]=x*o+P*u+b*y+w*g,e[11]=x*a+P*c+b*m+w*v,x=r[12],P=r[13],b=r[14],w=r[15],e[12]=x*n+P*s+b*p+w*h,e[13]=x*i+P*l+b*f+w*d,e[14]=x*o+P*u+b*y+w*g,e[15]=x*a+P*c+b*m+w*v,e}function kh(e,t,r){var n=r[0],i=r[1],o=r[2],a,s,l,u,c,p,f,y,m,h,d,g;return t===e?(e[12]=t[0]*n+t[4]*i+t[8]*o+t[12],e[13]=t[1]*n+t[5]*i+t[9]*o+t[13],e[14]=t[2]*n+t[6]*i+t[10]*o+t[14],e[15]=t[3]*n+t[7]*i+t[11]*o+t[15]):(a=t[0],s=t[1],l=t[2],u=t[3],c=t[4],p=t[5],f=t[6],y=t[7],m=t[8],h=t[9],d=t[10],g=t[11],e[0]=a,e[1]=s,e[2]=l,e[3]=u,e[4]=c,e[5]=p,e[6]=f,e[7]=y,e[8]=m,e[9]=h,e[10]=d,e[11]=g,e[12]=a*n+c*i+m*o+t[12],e[13]=s*n+p*i+h*o+t[13],e[14]=l*n+f*i+d*o+t[14],e[15]=u*n+y*i+g*o+t[15]),e}function Mh(e,t,r){var n=r[0],i=r[1],o=r[2];return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*i,e[5]=t[5]*i,e[6]=t[6]*i,e[7]=t[7]*i,e[8]=t[8]*o,e[9]=t[9]*o,e[10]=t[10]*o,e[11]=t[11]*o,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function Eh(e,t,r,n){var i=n[0],o=n[1],a=n[2],s=Math.hypot(i,o,a),l,u,c,p,f,y,m,h,d,g,v,x,P,b,w,I,E,M,A,_,k,B,D,T;return s<Q?null:(s=1/s,i*=s,o*=s,a*=s,l=Math.sin(r),u=Math.cos(r),c=1-u,p=t[0],f=t[1],y=t[2],m=t[3],h=t[4],d=t[5],g=t[6],v=t[7],x=t[8],P=t[9],b=t[10],w=t[11],I=i*i*c+u,E=o*i*c+a*l,M=a*i*c-o*l,A=i*o*c-a*l,_=o*o*c+u,k=a*o*c+i*l,B=i*a*c+o*l,D=o*a*c-i*l,T=a*a*c+u,e[0]=p*I+h*E+x*M,e[1]=f*I+d*E+P*M,e[2]=y*I+g*E+b*M,e[3]=m*I+v*E+w*M,e[4]=p*A+h*_+x*k,e[5]=f*A+d*_+P*k,e[6]=y*A+g*_+b*k,e[7]=m*A+v*_+w*k,e[8]=p*B+h*D+x*T,e[9]=f*B+d*D+P*T,e[10]=y*B+g*D+b*T,e[11]=m*B+v*D+w*T,t!==e&&(e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e)}function Fh(e,t,r){var n=Math.sin(r),i=Math.cos(r),o=t[4],a=t[5],s=t[6],l=t[7],u=t[8],c=t[9],p=t[10],f=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=o*i+u*n,e[5]=a*i+c*n,e[6]=s*i+p*n,e[7]=l*i+f*n,e[8]=u*i-o*n,e[9]=c*i-a*n,e[10]=p*i-s*n,e[11]=f*i-l*n,e}function Lh(e,t,r){var n=Math.sin(r),i=Math.cos(r),o=t[0],a=t[1],s=t[2],l=t[3],u=t[8],c=t[9],p=t[10],f=t[11];return t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=o*i-u*n,e[1]=a*i-c*n,e[2]=s*i-p*n,e[3]=l*i-f*n,e[8]=o*n+u*i,e[9]=a*n+c*i,e[10]=s*n+p*i,e[11]=l*n+f*i,e}function Dh(e,t,r){var n=Math.sin(r),i=Math.cos(r),o=t[0],a=t[1],s=t[2],l=t[3],u=t[4],c=t[5],p=t[6],f=t[7];return t!==e&&(e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=o*i+u*n,e[1]=a*i+c*n,e[2]=s*i+p*n,e[3]=l*i+f*n,e[4]=u*i-o*n,e[5]=c*i-a*n,e[6]=p*i-s*n,e[7]=f*i-l*n,e}function Vh(e,t){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=t[0],e[13]=t[1],e[14]=t[2],e[15]=1,e}function Bh(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t[2],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function zh(e,t,r){var n=r[0],i=r[1],o=r[2],a=Math.hypot(n,i,o),s,l,u;return a<Q?null:(a=1/a,n*=a,i*=a,o*=a,s=Math.sin(t),l=Math.cos(t),u=1-l,e[0]=n*n*u+l,e[1]=i*n*u+o*s,e[2]=o*n*u-i*s,e[3]=0,e[4]=n*i*u-o*s,e[5]=i*i*u+l,e[6]=o*i*u+n*s,e[7]=0,e[8]=n*o*u+i*s,e[9]=i*o*u-n*s,e[10]=o*o*u+l,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e)}function Rh(e,t){var r=Math.sin(t),n=Math.cos(t);return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=n,e[6]=r,e[7]=0,e[8]=0,e[9]=-r,e[10]=n,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function Oh(e,t){var r=Math.sin(t),n=Math.cos(t);return e[0]=n,e[1]=0,e[2]=-r,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=r,e[9]=0,e[10]=n,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function Uh(e,t){var r=Math.sin(t),n=Math.cos(t);return e[0]=n,e[1]=r,e[2]=0,e[3]=0,e[4]=-r,e[5]=n,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function mc(e,t,r){var n=t[0],i=t[1],o=t[2],a=t[3],s=n+n,l=i+i,u=o+o,c=n*s,p=n*l,f=n*u,y=i*l,m=i*u,h=o*u,d=a*s,g=a*l,v=a*u;return e[0]=1-(y+h),e[1]=p+v,e[2]=f-g,e[3]=0,e[4]=p-v,e[5]=1-(c+h),e[6]=m+d,e[7]=0,e[8]=f+g,e[9]=m-d,e[10]=1-(c+y),e[11]=0,e[12]=r[0],e[13]=r[1],e[14]=r[2],e[15]=1,e}function Nh(e,t){var r=new Ge(3),n=-t[0],i=-t[1],o=-t[2],a=t[3],s=t[4],l=t[5],u=t[6],c=t[7],p=n*n+i*i+o*o+a*a;return p>0?(r[0]=(s*a+c*n+l*o-u*i)*2/p,r[1]=(l*a+c*i+u*n-s*o)*2/p,r[2]=(u*a+c*o+s*i-l*n)*2/p):(r[0]=(s*a+c*n+l*o-u*i)*2,r[1]=(l*a+c*i+u*n-s*o)*2,r[2]=(u*a+c*o+s*i-l*n)*2),mc(e,t,r),e}function Gh(e,t){return e[0]=t[12],e[1]=t[13],e[2]=t[14],e}function hc(e,t){var r=t[0],n=t[1],i=t[2],o=t[4],a=t[5],s=t[6],l=t[8],u=t[9],c=t[10];return e[0]=Math.hypot(r,n,i),e[1]=Math.hypot(o,a,s),e[2]=Math.hypot(l,u,c),e}function $h(e,t){var r=new Ge(3);hc(r,t);var n=1/r[0],i=1/r[1],o=1/r[2],a=t[0]*n,s=t[1]*i,l=t[2]*o,u=t[4]*n,c=t[5]*i,p=t[6]*o,f=t[8]*n,y=t[9]*i,m=t[10]*o,h=a+c+m,d=0;return h>0?(d=Math.sqrt(h+1)*2,e[3]=.25*d,e[0]=(p-y)/d,e[1]=(f-l)/d,e[2]=(s-u)/d):a>c&&a>m?(d=Math.sqrt(1+a-c-m)*2,e[3]=(p-y)/d,e[0]=.25*d,e[1]=(s+u)/d,e[2]=(f+l)/d):c>m?(d=Math.sqrt(1+c-a-m)*2,e[3]=(f-l)/d,e[0]=(s+u)/d,e[1]=.25*d,e[2]=(p+y)/d):(d=Math.sqrt(1+m-a-c)*2,e[3]=(s-u)/d,e[0]=(f+l)/d,e[1]=(p+y)/d,e[2]=.25*d),e}function qh(e,t,r,n){var i=t[0],o=t[1],a=t[2],s=t[3],l=i+i,u=o+o,c=a+a,p=i*l,f=i*u,y=i*c,m=o*u,h=o*c,d=a*c,g=s*l,v=s*u,x=s*c,P=n[0],b=n[1],w=n[2];return e[0]=(1-(m+d))*P,e[1]=(f+x)*P,e[2]=(y-v)*P,e[3]=0,e[4]=(f-x)*b,e[5]=(1-(p+d))*b,e[6]=(h+g)*b,e[7]=0,e[8]=(y+v)*w,e[9]=(h-g)*w,e[10]=(1-(p+m))*w,e[11]=0,e[12]=r[0],e[13]=r[1],e[14]=r[2],e[15]=1,e}function jh(e,t,r,n,i){var o=t[0],a=t[1],s=t[2],l=t[3],u=o+o,c=a+a,p=s+s,f=o*u,y=o*c,m=o*p,h=a*c,d=a*p,g=s*p,v=l*u,x=l*c,P=l*p,b=n[0],w=n[1],I=n[2],E=i[0],M=i[1],A=i[2],_=(1-(h+g))*b,k=(y+P)*b,B=(m-x)*b,D=(y-P)*w,T=(1-(f+g))*w,R=(d+v)*w,U=(m+x)*I,K=(d-v)*I,he=(1-(f+h))*I;return e[0]=_,e[1]=k,e[2]=B,e[3]=0,e[4]=D,e[5]=T,e[6]=R,e[7]=0,e[8]=U,e[9]=K,e[10]=he,e[11]=0,e[12]=r[0]+E-(_*E+D*M+U*A),e[13]=r[1]+M-(k*E+T*M+K*A),e[14]=r[2]+A-(B*E+R*M+he*A),e[15]=1,e}function Jh(e,t){var r=t[0],n=t[1],i=t[2],o=t[3],a=r+r,s=n+n,l=i+i,u=r*a,c=n*a,p=n*s,f=i*a,y=i*s,m=i*l,h=o*a,d=o*s,g=o*l;return e[0]=1-p-m,e[1]=c+g,e[2]=f-d,e[3]=0,e[4]=c-g,e[5]=1-u-m,e[6]=y+h,e[7]=0,e[8]=f+d,e[9]=y-h,e[10]=1-u-p,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function Zh(e,t,r,n,i,o,a){var s=1/(r-t),l=1/(i-n),u=1/(o-a);return e[0]=o*2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=o*2*l,e[6]=0,e[7]=0,e[8]=(r+t)*s,e[9]=(i+n)*l,e[10]=(a+o)*u,e[11]=-1,e[12]=0,e[13]=0,e[14]=a*o*2*u,e[15]=0,e}function dc(e,t,r,n,i){var o=1/Math.tan(t/2),a;return e[0]=o/r,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=o,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,i!=null&&i!==1/0?(a=1/(n-i),e[10]=(i+n)*a,e[14]=2*i*n*a):(e[10]=-1,e[14]=-2*n),e}var Wh=dc;function Hh(e,t,r,n,i){var o=1/Math.tan(t/2),a;return e[0]=o/r,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=o,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,i!=null&&i!==1/0?(a=1/(n-i),e[10]=i*a,e[14]=i*n*a):(e[10]=-1,e[14]=-n),e}function Kh(e,t,r,n){var i=Math.tan(t.upDegrees*Math.PI/180),o=Math.tan(t.downDegrees*Math.PI/180),a=Math.tan(t.leftDegrees*Math.PI/180),s=Math.tan(t.rightDegrees*Math.PI/180),l=2/(a+s),u=2/(i+o);return e[0]=l,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=u,e[6]=0,e[7]=0,e[8]=-((a-s)*l*.5),e[9]=(i-o)*u*.5,e[10]=n/(r-n),e[11]=-1,e[12]=0,e[13]=0,e[14]=n*r/(r-n),e[15]=0,e}function gc(e,t,r,n,i,o,a){var s=1/(t-r),l=1/(n-i),u=1/(o-a);return e[0]=-2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*u,e[11]=0,e[12]=(t+r)*s,e[13]=(i+n)*l,e[14]=(a+o)*u,e[15]=1,e}var Yh=gc;function Xh(e,t,r,n,i,o,a){var s=1/(t-r),l=1/(n-i),u=1/(o-a);return e[0]=-2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=u,e[11]=0,e[12]=(t+r)*s,e[13]=(i+n)*l,e[14]=o*u,e[15]=1,e}function Qh(e,t,r,n){var i,o,a,s,l,u,c,p,f,y,m=t[0],h=t[1],d=t[2],g=n[0],v=n[1],x=n[2],P=r[0],b=r[1],w=r[2];return Math.abs(m-P)<Q&&Math.abs(h-b)<Q&&Math.abs(d-w)<Q?fc(e):(c=m-P,p=h-b,f=d-w,y=1/Math.hypot(c,p,f),c*=y,p*=y,f*=y,i=v*f-x*p,o=x*c-g*f,a=g*p-v*c,y=Math.hypot(i,o,a),y?(y=1/y,i*=y,o*=y,a*=y):(i=0,o=0,a=0),s=p*a-f*o,l=f*i-c*a,u=c*o-p*i,y=Math.hypot(s,l,u),y?(y=1/y,s*=y,l*=y,u*=y):(s=0,l=0,u=0),e[0]=i,e[1]=s,e[2]=c,e[3]=0,e[4]=o,e[5]=l,e[6]=p,e[7]=0,e[8]=a,e[9]=u,e[10]=f,e[11]=0,e[12]=-(i*m+o*h+a*d),e[13]=-(s*m+l*h+u*d),e[14]=-(c*m+p*h+f*d),e[15]=1,e)}function ed(e,t,r,n){var i=t[0],o=t[1],a=t[2],s=n[0],l=n[1],u=n[2],c=i-r[0],p=o-r[1],f=a-r[2],y=c*c+p*p+f*f;y>0&&(y=1/Math.sqrt(y),c*=y,p*=y,f*=y);var m=l*f-u*p,h=u*c-s*f,d=s*p-l*c;return y=m*m+h*h+d*d,y>0&&(y=1/Math.sqrt(y),m*=y,h*=y,d*=y),e[0]=m,e[1]=h,e[2]=d,e[3]=0,e[4]=p*d-f*h,e[5]=f*m-c*d,e[6]=c*h-p*m,e[7]=0,e[8]=c,e[9]=p,e[10]=f,e[11]=0,e[12]=i,e[13]=o,e[14]=a,e[15]=1,e}function td(e){return"mat4("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+", "+e[6]+", "+e[7]+", "+e[8]+", "+e[9]+", "+e[10]+", "+e[11]+", "+e[12]+", "+e[13]+", "+e[14]+", "+e[15]+")"}function rd(e){return Math.hypot(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])}function nd(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e[3]=t[3]+r[3],e[4]=t[4]+r[4],e[5]=t[5]+r[5],e[6]=t[6]+r[6],e[7]=t[7]+r[7],e[8]=t[8]+r[8],e[9]=t[9]+r[9],e[10]=t[10]+r[10],e[11]=t[11]+r[11],e[12]=t[12]+r[12],e[13]=t[13]+r[13],e[14]=t[14]+r[14],e[15]=t[15]+r[15],e}function xc(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e[3]=t[3]-r[3],e[4]=t[4]-r[4],e[5]=t[5]-r[5],e[6]=t[6]-r[6],e[7]=t[7]-r[7],e[8]=t[8]-r[8],e[9]=t[9]-r[9],e[10]=t[10]-r[10],e[11]=t[11]-r[11],e[12]=t[12]-r[12],e[13]=t[13]-r[13],e[14]=t[14]-r[14],e[15]=t[15]-r[15],e}function id(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*r,e[5]=t[5]*r,e[6]=t[6]*r,e[7]=t[7]*r,e[8]=t[8]*r,e[9]=t[9]*r,e[10]=t[10]*r,e[11]=t[11]*r,e[12]=t[12]*r,e[13]=t[13]*r,e[14]=t[14]*r,e[15]=t[15]*r,e}function od(e,t,r,n){return e[0]=t[0]+r[0]*n,e[1]=t[1]+r[1]*n,e[2]=t[2]+r[2]*n,e[3]=t[3]+r[3]*n,e[4]=t[4]+r[4]*n,e[5]=t[5]+r[5]*n,e[6]=t[6]+r[6]*n,e[7]=t[7]+r[7]*n,e[8]=t[8]+r[8]*n,e[9]=t[9]+r[9]*n,e[10]=t[10]+r[10]*n,e[11]=t[11]+r[11]*n,e[12]=t[12]+r[12]*n,e[13]=t[13]+r[13]*n,e[14]=t[14]+r[14]*n,e[15]=t[15]+r[15]*n,e}function ad(e,t){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]}function sd(e,t){var r=e[0],n=e[1],i=e[2],o=e[3],a=e[4],s=e[5],l=e[6],u=e[7],c=e[8],p=e[9],f=e[10],y=e[11],m=e[12],h=e[13],d=e[14],g=e[15],v=t[0],x=t[1],P=t[2],b=t[3],w=t[4],I=t[5],E=t[6],M=t[7],A=t[8],_=t[9],k=t[10],B=t[11],D=t[12],T=t[13],R=t[14],U=t[15];return Math.abs(r-v)<=Q*Math.max(1,Math.abs(r),Math.abs(v))&&Math.abs(n-x)<=Q*Math.max(1,Math.abs(n),Math.abs(x))&&Math.abs(i-P)<=Q*Math.max(1,Math.abs(i),Math.abs(P))&&Math.abs(o-b)<=Q*Math.max(1,Math.abs(o),Math.abs(b))&&Math.abs(a-w)<=Q*Math.max(1,Math.abs(a),Math.abs(w))&&Math.abs(s-I)<=Q*Math.max(1,Math.abs(s),Math.abs(I))&&Math.abs(l-E)<=Q*Math.max(1,Math.abs(l),Math.abs(E))&&Math.abs(u-M)<=Q*Math.max(1,Math.abs(u),Math.abs(M))&&Math.abs(c-A)<=Q*Math.max(1,Math.abs(c),Math.abs(A))&&Math.abs(p-_)<=Q*Math.max(1,Math.abs(p),Math.abs(_))&&Math.abs(f-k)<=Q*Math.max(1,Math.abs(f),Math.abs(k))&&Math.abs(y-B)<=Q*Math.max(1,Math.abs(y),Math.abs(B))&&Math.abs(m-D)<=Q*Math.max(1,Math.abs(m),Math.abs(D))&&Math.abs(h-T)<=Q*Math.max(1,Math.abs(h),Math.abs(T))&&Math.abs(d-R)<=Q*Math.max(1,Math.abs(d),Math.abs(R))&&Math.abs(g-U)<=Q*Math.max(1,Math.abs(g),Math.abs(U))}var ld=yc,ud=xc;var Ht={};ml(Ht,{add:()=>md,ceil:()=>hd,clone:()=>cd,copy:()=>fd,create:()=>bc,cross:()=>Id,dist:()=>Rd,distance:()=>wc,div:()=>zd,divide:()=>Sc,dot:()=>_d,equals:()=>Dd,exactEquals:()=>Ld,floor:()=>dd,forEach:()=>Gd,fromValues:()=>pd,inverse:()=>wd,len:()=>Ud,length:()=>_c,lerp:()=>Td,max:()=>xd,min:()=>gd,mul:()=>Bd,multiply:()=>Pc,negate:()=>Sd,normalize:()=>Ad,random:()=>Cd,round:()=>bd,scale:()=>vd,scaleAndAdd:()=>Pd,set:()=>yd,sqrDist:()=>Od,sqrLen:()=>Nd,squaredDistance:()=>Ac,squaredLength:()=>Ic,str:()=>Fd,sub:()=>Vd,subtract:()=>vc,transformMat4:()=>kd,transformQuat:()=>Md,zero:()=>Ed});function bc(){var e=new Ge(4);return Ge!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function cd(e){var t=new Ge(4);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function pd(e,t,r,n){var i=new Ge(4);return i[0]=e,i[1]=t,i[2]=r,i[3]=n,i}function fd(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}function yd(e,t,r,n,i){return e[0]=t,e[1]=r,e[2]=n,e[3]=i,e}function md(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e[3]=t[3]+r[3],e}function vc(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e[3]=t[3]-r[3],e}function Pc(e,t,r){return e[0]=t[0]*r[0],e[1]=t[1]*r[1],e[2]=t[2]*r[2],e[3]=t[3]*r[3],e}function Sc(e,t,r){return e[0]=t[0]/r[0],e[1]=t[1]/r[1],e[2]=t[2]/r[2],e[3]=t[3]/r[3],e}function hd(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e[2]=Math.ceil(t[2]),e[3]=Math.ceil(t[3]),e}function dd(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e[2]=Math.floor(t[2]),e[3]=Math.floor(t[3]),e}function gd(e,t,r){return e[0]=Math.min(t[0],r[0]),e[1]=Math.min(t[1],r[1]),e[2]=Math.min(t[2],r[2]),e[3]=Math.min(t[3],r[3]),e}function xd(e,t,r){return e[0]=Math.max(t[0],r[0]),e[1]=Math.max(t[1],r[1]),e[2]=Math.max(t[2],r[2]),e[3]=Math.max(t[3],r[3]),e}function bd(e,t){return e[0]=Math.round(t[0]),e[1]=Math.round(t[1]),e[2]=Math.round(t[2]),e[3]=Math.round(t[3]),e}function vd(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e}function Pd(e,t,r,n){return e[0]=t[0]+r[0]*n,e[1]=t[1]+r[1]*n,e[2]=t[2]+r[2]*n,e[3]=t[3]+r[3]*n,e}function wc(e,t){var r=t[0]-e[0],n=t[1]-e[1],i=t[2]-e[2],o=t[3]-e[3];return Math.hypot(r,n,i,o)}function Ac(e,t){var r=t[0]-e[0],n=t[1]-e[1],i=t[2]-e[2],o=t[3]-e[3];return r*r+n*n+i*i+o*o}function _c(e){var t=e[0],r=e[1],n=e[2],i=e[3];return Math.hypot(t,r,n,i)}function Ic(e){var t=e[0],r=e[1],n=e[2],i=e[3];return t*t+r*r+n*n+i*i}function Sd(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=-t[3],e}function wd(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e[3]=1/t[3],e}function Ad(e,t){var r=t[0],n=t[1],i=t[2],o=t[3],a=r*r+n*n+i*i+o*o;return a>0&&(a=1/Math.sqrt(a)),e[0]=r*a,e[1]=n*a,e[2]=i*a,e[3]=o*a,e}function _d(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}function Id(e,t,r,n){var i=r[0]*n[1]-r[1]*n[0],o=r[0]*n[2]-r[2]*n[0],a=r[0]*n[3]-r[3]*n[0],s=r[1]*n[2]-r[2]*n[1],l=r[1]*n[3]-r[3]*n[1],u=r[2]*n[3]-r[3]*n[2],c=t[0],p=t[1],f=t[2],y=t[3];return e[0]=p*u-f*l+y*s,e[1]=-(c*u)+f*a-y*o,e[2]=c*l-p*a+y*i,e[3]=-(c*s)+p*o-f*i,e}function Td(e,t,r,n){var i=t[0],o=t[1],a=t[2],s=t[3];return e[0]=i+n*(r[0]-i),e[1]=o+n*(r[1]-o),e[2]=a+n*(r[2]-a),e[3]=s+n*(r[3]-s),e}function Cd(e,t){t=t||1;var r,n,i,o,a,s;do r=Vn()*2-1,n=Vn()*2-1,a=r*r+n*n;while(a>=1);do i=Vn()*2-1,o=Vn()*2-1,s=i*i+o*o;while(s>=1);var l=Math.sqrt((1-a)/s);return e[0]=t*r,e[1]=t*n,e[2]=t*i*l,e[3]=t*o*l,e}function kd(e,t,r){var n=t[0],i=t[1],o=t[2],a=t[3];return e[0]=r[0]*n+r[4]*i+r[8]*o+r[12]*a,e[1]=r[1]*n+r[5]*i+r[9]*o+r[13]*a,e[2]=r[2]*n+r[6]*i+r[10]*o+r[14]*a,e[3]=r[3]*n+r[7]*i+r[11]*o+r[15]*a,e}function Md(e,t,r){var n=t[0],i=t[1],o=t[2],a=r[0],s=r[1],l=r[2],u=r[3],c=u*n+s*o-l*i,p=u*i+l*n-a*o,f=u*o+a*i-s*n,y=-a*n-s*i-l*o;return e[0]=c*u+y*-a+p*-l-f*-s,e[1]=p*u+y*-s+f*-a-c*-l,e[2]=f*u+y*-l+c*-s-p*-a,e[3]=t[3],e}function Ed(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=0,e}function Fd(e){return"vec4("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+")"}function Ld(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]}function Dd(e,t){var r=e[0],n=e[1],i=e[2],o=e[3],a=t[0],s=t[1],l=t[2],u=t[3];return Math.abs(r-a)<=Q*Math.max(1,Math.abs(r),Math.abs(a))&&Math.abs(n-s)<=Q*Math.max(1,Math.abs(n),Math.abs(s))&&Math.abs(i-l)<=Q*Math.max(1,Math.abs(i),Math.abs(l))&&Math.abs(o-u)<=Q*Math.max(1,Math.abs(o),Math.abs(u))}var Vd=vc,Bd=Pc,zd=Sc,Rd=wc,Od=Ac,Ud=_c,Nd=Ic,Gd=function(){var e=bc();return function(t,r,n,i,o,a){var s,l;for(r||(r=4),n||(n=0),i?l=Math.min(i*r+n,t.length):l=t.length,s=n;s<l;s+=r)e[0]=t[s],e[1]=t[s+1],e[2]=t[s+2],e[3]=t[s+3],o(e,e,a),t[s]=e[0],t[s+1]=e[1],t[s+2]=e[2],t[s+3]=e[3];return t}}();var Tc=J(de(),1),_o=class extends ae{constructor(r){super(r,cc)}createBucket(r){return new Zt(r)}queryRadius(r){let n=r;return Wt("circle-radius",this,n)+Wt("circle-stroke-width",this,n)+At(this.paint.get("circle-translate"))}queryIntersectsFeature(r,n,i,o,a,s,l,u){let c=_t(r,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),s.angle,l),p=this.paint.get("circle-radius").evaluate(n,i),f=this.paint.get("circle-stroke-width").evaluate(n,i),y=p+f,m=this.paint.get("circle-pitch-alignment")==="map",h=m?c:$d(c,u),d=m?y*l:y;for(let g of o)for(let v of g){let x=m?v:Cc(v,u),P=d,b=Ht.transformMat4([],[v.x,v.y,0,1],u);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?P*=b[3]/s.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(P*=s.cameraToCenterDistance/b[3]),ic(h,x,P))return!0}return!1}};function Cc(e,t){let r=Ht.transformMat4([],[e.x,e.y,0,1],t);return new Tc.default(r[0]/r[3],r[1]/r[3])}function $d(e,t){return e.map(r=>Cc(r,t))}var zn=class extends Zt{};C("HeatmapBucket",zn,{omit:["layers"]});var kc,qd=()=>kc=kc||new re({"heatmap-radius":new O(S.paint_heatmap["heatmap-radius"]),"heatmap-weight":new O(S.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new z(S.paint_heatmap["heatmap-intensity"]),"heatmap-color":new $t(S.paint_heatmap["heatmap-color"]),"heatmap-opacity":new z(S.paint_heatmap["heatmap-opacity"])}),Mc={get paint(){return qd()}};function ms(e,{width:t,height:r},n,i){if(!i)i=new Uint8Array(t*r*n);else if(i instanceof Uint8ClampedArray)i=new Uint8Array(i.buffer);else if(i.length!==t*r*n)throw new RangeError("mismatched image size. expected: ".concat(i.length," but got: ").concat(t*r*n));return e.width=t,e.height=r,e.data=i,e}function Ec(e,{width:t,height:r},n){if(t===e.width&&r===e.height)return;let i=ms({},{width:t,height:r},n);hs(e,i,{x:0,y:0},{x:0,y:0},{width:Math.min(e.width,t),height:Math.min(e.height,r)},n),e.width=t,e.height=r,e.data=i.data}function hs(e,t,r,n,i,o){if(i.width===0||i.height===0)return t;if(i.width>e.width||i.height>e.height||r.x>e.width-i.width||r.y>e.height-i.height)throw new RangeError("out of range source coordinates for image copy");if(i.width>t.width||i.height>t.height||n.x>t.width-i.width||n.y>t.height-i.height)throw new RangeError("out of range destination coordinates for image copy");let a=e.data,s=t.data;if(a===s)throw new Error("srcData equals dstData, so image is already copied");for(let l=0;l<i.height;l++){let u=((r.y+l)*e.width+r.x)*o,c=((n.y+l)*t.width+n.x)*o;for(let p=0;p<i.width*o;p++)s[c+p]=a[u+p]}return t}var Kt=class e{constructor(t,r){ms(this,t,1,r)}resize(t){Ec(this,t,1)}clone(){return new e({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,r,n,i,o){hs(t,r,n,i,o,1)}},ge=class e{constructor(t,r){ms(this,t,4,r)}resize(t){Ec(this,t,4)}replace(t,r){r?this.data.set(t):t instanceof Uint8ClampedArray?this.data=new Uint8Array(t.buffer):this.data=t}clone(){return new e({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,r,n,i,o){hs(t,r,n,i,o,4)}};C("AlphaImage",Kt);C("RGBAImage",ge);function Fc(e){let t={},r=e.resolution||256,n=e.clips?e.clips.length:1,i=e.image||new ge({width:r,height:n});if(!Al(r))throw new Error("width is not a power of 2 - ".concat(r));let o=(a,s,l)=>{t[e.evaluationKey]=l;let u=e.expression.evaluate(t);i.data[a+s+0]=Math.floor(u.r*255/u.a),i.data[a+s+1]=Math.floor(u.g*255/u.a),i.data[a+s+2]=Math.floor(u.b*255/u.a),i.data[a+s+3]=Math.floor(u.a*255)};if(e.clips)for(let a=0,s=0;a<n;++a,s+=r*4)for(let l=0,u=0;l<r;l++,u+=4){let c=l/(r-1),{start:p,end:f}=e.clips[a],y=p*(1-c)+f*c;o(s,u,y)}else for(let a=0,s=0;a<r;a++,s+=4){let l=a/(r-1);o(0,s,l)}return i}var Io=class extends ae{constructor(r){super(r,Mc);this._updateColorRamp()}createBucket(r){return new zn(r)}_handleSpecialPaintPropertyUpdate(r){r==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){let r=this._transitionablePaint._values["heatmap-color"].value.expression;this.colorRamp=Fc({expression:r,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}};var Lc,jd=()=>Lc=Lc||new re({"hillshade-illumination-direction":new z(S.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new z(S.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new z(S.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new z(S.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new z(S.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new z(S.paint_hillshade["hillshade-accent-color"])}),Dc={get paint(){return jd()}};var To=class extends ae{constructor(r){super(r,Dc)}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}};var Jd=X([{name:"a_pos",components:2,type:"Int16"}],4);var{members:Vc,size:V1,alignment:B1}=Jd;var Nc=J(vs(),1);function Ps(e,t,r,n,i){Uc(e,t,r||0,n||e.length-1,i||lg)}function Uc(e,t,r,n,i){for(;n>r;){if(n-r>600){var o=n-r+1,a=t-r+1,s=Math.log(o),l=.5*Math.exp(2*s/3),u=.5*Math.sqrt(s*l*(o-l)/o)*(a-o/2<0?-1:1),c=Math.max(r,Math.floor(t-a*l/o+u)),p=Math.min(n,Math.floor(t+(o-a)*l/o+u));Uc(e,t,c,p,i)}var f=e[t],y=r,m=n;for(Nn(e,r,t),i(e[n],f)>0&&Nn(e,r,n);y<m;){for(Nn(e,y,m),y++,m--;i(e[y],f)<0;)y++;for(;i(e[m],f)>0;)m--}i(e[r],f)===0?Nn(e,r,m):(m++,Nn(e,m,n)),m<=t&&(r=m+1),t<=m&&(n=m-1)}}function Nn(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function lg(e,t){return e<t?-1:e>t?1:0}function Sr(e,t){let r=e.length;if(r<=1)return[e];let n=[],i,o;for(let a=0;a<r;a++){let s=Tl(e[a]);s!==0&&(e[a].area=Math.abs(s),o===void 0&&(o=s<0),o===s<0?(i&&n.push(i),i=[e[a]]):i.push(e[a]))}if(i&&n.push(i),t>1)for(let a=0;a<n.length;a++)n[a].length<=t||(Ps(n[a],t,1,n[a].length-1,ug),n[a]=n[a].slice(0,t));return n}function ug(e,t){return t.area-e.area}function wr(e,t,r){let n=r.patternDependencies,i=!1;for(let o of t){let a=o.paint.get("".concat(e,"-pattern"));a.isConstant()||(i=!0);let s=a.constantOr(null);s&&(i=!0,n[s.to]=!0,n[s.from]=!0)}return i}function Ar(e,t,r,n,i){let o=i.patternDependencies;for(let a of t){let l=a.paint.get("".concat(e,"-pattern")).value;if(l.kind!=="constant"){let u=l.evaluate({zoom:n-1},r,{},i.availableImages),c=l.evaluate({zoom:n},r,{},i.availableImages),p=l.evaluate({zoom:n+1},r,{},i.availableImages);u=u&&u.name?u.name:u,c=c&&c.name?c.name:c,p=p&&p.name?p.name:p,o[u]=!0,o[c]=!0,o[p]=!0,r.patterns[a.id]={min:u,mid:c,max:p}}}return r}var cg=500,Xt=class{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(r=>r.id),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new lo,this.indexArray=new Le,this.indexArray2=new St,this.programConfigurations=new Ce(t.layers,t.zoom),this.segments=new me,this.segments2=new me,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(t,r,n){this.hasPattern=wr("fill",this.layers,r);let i=this.layers[0].layout.get("fill-sort-key"),o=!i.isConstant(),a=[];for(let{feature:s,id:l,index:u,sourceLayerIndex:c}of t){let p=this.layers[0]._featureFilter.needGeometry,f=Ne(s,p);if(!this.layers[0]._featureFilter.filter(new q(this.zoom),f,n))continue;let y=o?i.evaluate(f,{},n,r.availableImages):void 0,m={id:l,properties:s.properties,type:s.type,sourceLayerIndex:c,index:u,geometry:p?f.geometry:ke(s),patterns:{},sortKey:y};a.push(m)}o&&a.sort((s,l)=>s.sortKey-l.sortKey);for(let s of a){let{geometry:l,index:u,sourceLayerIndex:c}=s;if(this.hasPattern){let f=Ar("fill",this.layers,s,this.zoom,r);this.patternFeatures.push(f)}else this.addFeature(s,l,u,n,{});let p=t[u].feature;r.featureIndex.insert(p,l,u,c,this.index)}}update(t,r,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,n)}addFeatures(t,r,n){for(let i of this.patternFeatures)this.addFeature(i,i.geometry,i.index,r,n)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Vc),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.indexBuffer2=t.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(t),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(t,r,n,i,o){for(let a of Sr(r,cg)){let s=0;for(let y of a)s+=y.length;let l=this.segments.prepareSegment(s,this.layoutVertexArray,this.indexArray),u=l.vertexLength,c=[],p=[];for(let y of a){if(y.length===0)continue;y!==a[0]&&p.push(c.length/2);let m=this.segments2.prepareSegment(y.length,this.layoutVertexArray,this.indexArray2),h=m.vertexLength;this.layoutVertexArray.emplaceBack(y[0].x,y[0].y),this.indexArray2.emplaceBack(h+y.length-1,h),c.push(y[0].x),c.push(y[0].y);for(let d=1;d<y.length;d++)this.layoutVertexArray.emplaceBack(y[d].x,y[d].y),this.indexArray2.emplaceBack(h+d-1,h+d),c.push(y[d].x),c.push(y[d].y);m.vertexLength+=y.length,m.primitiveLength+=y.length}let f=(0,Nc.default)(c,p);for(let y=0;y<f.length;y+=3)this.indexArray.emplaceBack(u+f[y],u+f[y+1],u+f[y+2]);l.vertexLength+=s,l.primitiveLength+=f.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,n,o,i)}};C("FillBucket",Xt,{omit:["layers","patternFeatures"]});var Gc,pg=()=>Gc=Gc||new re({"fill-sort-key":new O(S.layout_fill["fill-sort-key"])}),$c,fg=()=>$c=$c||new re({"fill-antialias":new z(S.paint_fill["fill-antialias"]),"fill-opacity":new O(S.paint_fill["fill-opacity"]),"fill-color":new O(S.paint_fill["fill-color"]),"fill-outline-color":new O(S.paint_fill["fill-outline-color"]),"fill-translate":new z(S.paint_fill["fill-translate"]),"fill-translate-anchor":new z(S.paint_fill["fill-translate-anchor"]),"fill-pattern":new at(S.paint_fill["fill-pattern"])}),qc={get paint(){return fg()},get layout(){return pg()}};var Fo=class extends ae{constructor(r){super(r,qc)}recalculate(r,n){super.recalculate(r,n);let 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(r){return new Xt(r)}queryRadius(){return At(this.paint.get("fill-translate"))}queryIntersectsFeature(r,n,i,o,a,s,l){let u=_t(r,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),s.angle,l);return wo(u,o)}isTileClipped(){return!0}};var yg=X([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),jc=X([{name:"a_centroid",components:2,type:"Int16"}],4);var{members:Jc,size:xP,alignment:bP}=yg;var Xc=J(vs(),1),Qc=J(It(),1);var _g=Qc.default.VectorTileFeature.types,Ig=500,As=Math.pow(2,13);function Gn(e,t,r,n,i,o,a,s){e.emplaceBack(t,r,Math.floor(n*As)*2+a,i*As*2,o*As*2,Math.round(s))}var Qt=class{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(r=>r.id),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new uo,this.centroidVertexArray=new ao,this.indexArray=new Le,this.programConfigurations=new Ce(t.layers,t.zoom),this.segments=new me,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(t,r,n){this.features=[],this.hasPattern=wr("fill-extrusion",this.layers,r);for(let{feature:i,id:o,index:a,sourceLayerIndex:s}of t){let l=this.layers[0]._featureFilter.needGeometry,u=Ne(i,l);if(!this.layers[0]._featureFilter.filter(new q(this.zoom),u,n))continue;let c={id:o,sourceLayerIndex:s,index:a,geometry:l?u.geometry:ke(i),properties:i.properties,type:i.type,patterns:{}};this.hasPattern?this.features.push(Ar("fill-extrusion",this.layers,c,this.zoom,r)):this.addFeature(c,c.geometry,a,n,{}),r.featureIndex.insert(i,c.geometry,a,s,this.index,!0)}}addFeatures(t,r,n){for(let i of this.features){let{geometry:o}=i;this.addFeature(i,o,i.index,r,n)}}update(t,r,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,n)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Jc),this.centroidVertexBuffer=t.createVertexBuffer(this.centroidVertexArray,jc.members,!0),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(t,r,n,i,o){let a={x:0,y:0,vertexCount:0};for(let s of Sr(r,Ig)){let l=0;for(let m of s)l+=m.length;let u=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(let m of s){if(m.length===0||Cg(m))continue;let h=0;for(let d=0;d<m.length;d++){let g=m[d];if(d>=1){let v=m[d-1];if(!Tg(g,v)){u.vertexLength+4>me.MAX_VERTEX_ARRAY_LENGTH&&(u=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));let x=g.sub(v)._perp()._unit(),P=v.dist(g);h+P>32768&&(h=0),Gn(this.layoutVertexArray,g.x,g.y,x.x,x.y,0,0,h),Gn(this.layoutVertexArray,g.x,g.y,x.x,x.y,0,1,h),a.x+=2*g.x,a.y+=2*g.y,a.vertexCount+=2,h+=P,Gn(this.layoutVertexArray,v.x,v.y,x.x,x.y,0,0,h),Gn(this.layoutVertexArray,v.x,v.y,x.x,x.y,0,1,h),a.x+=2*v.x,a.y+=2*v.y,a.vertexCount+=2;let b=u.vertexLength;this.indexArray.emplaceBack(b,b+2,b+1),this.indexArray.emplaceBack(b+1,b+2,b+3),u.vertexLength+=4,u.primitiveLength+=2}}}}if(u.vertexLength+l>me.MAX_VERTEX_ARRAY_LENGTH&&(u=this.segments.prepareSegment(l,this.layoutVertexArray,this.indexArray)),_g[t.type]!=="Polygon")continue;let c=[],p=[],f=u.vertexLength;for(let m of s)if(m.length!==0){m!==s[0]&&p.push(c.length/2);for(let h=0;h<m.length;h++){let d=m[h];Gn(this.layoutVertexArray,d.x,d.y,0,0,1,1,0),a.x+=d.x,a.y+=d.y,a.vertexCount+=1,c.push(d.x),c.push(d.y)}}let y=(0,Xc.default)(c,p);for(let m=0;m<y.length;m+=3)this.indexArray.emplaceBack(f+y[m],f+y[m+2],f+y[m+1]);u.primitiveLength+=y.length/3,u.vertexLength+=l}for(let s=0;s<a.vertexCount;s++)this.centroidVertexArray.emplaceBack(Math.floor(a.x/a.vertexCount),Math.floor(a.y/a.vertexCount));this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,n,o,i)}};C("FillExtrusionBucket",Qt,{omit:["layers","features"]});function Tg(e,t){return e.x===t.x&&(e.x<0||e.x>8192)||e.y===t.y&&(e.y<0||e.y>8192)}function Cg(e){return e.every(t=>t.x<0)||e.every(t=>t.x>8192)||e.every(t=>t.y<0)||e.every(t=>t.y>8192)}var ep,kg=()=>ep=ep||new re({"fill-extrusion-opacity":new z(S["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new O(S["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new z(S["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new z(S["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new at(S["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new O(S["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new O(S["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new z(S["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])}),tp={get paint(){return kg()}};var Do=J(de(),1);var Vo=class extends ae{constructor(r){super(r,tp)}createBucket(r){return new Qt(r)}queryRadius(){return At(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(r,n,i,o,a,s,l,u){let c=_t(r,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),s.angle,l),p=this.paint.get("fill-extrusion-height").evaluate(n,i),f=this.paint.get("fill-extrusion-base").evaluate(n,i),y=Fg(c,u,s,0),m=Eg(o,f,p,u),h=m[0],d=m[1];return Mg(h,d,y)}};function $n(e,t){return e.x*t.x+e.y*t.y}function rp(e,t){if(e.length===1){let r=0,n=t[r++],i;for(;!i||n.equals(i);)if(i=t[r++],!i)return 1/0;for(;r<t.length;r++){let o=t[r],a=e[0],s=i.sub(n),l=o.sub(n),u=a.sub(n),c=$n(s,s),p=$n(s,l),f=$n(l,l),y=$n(u,s),m=$n(u,l),h=c*f-p*p,d=(f*y-p*m)/h,g=(c*m-p*y)/h,v=1-d-g,x=n.z*v+i.z*d+o.z*g;if(isFinite(x))return x}return 1/0}else{let r=1/0;for(let n of t)r=Math.min(r,n.z);return r}}function Mg(e,t,r){let n=1/0;wo(r,t)&&(n=rp(r,t[0]));for(let i=0;i<t.length;i++){let o=t[i],a=e[i];for(let s=0;s<o.length-1;s++){let l=o[s],u=o[s+1],c=a[s],p=a[s+1],f=[l,u,p,c,l];nc(r,f)&&(n=Math.min(n,rp(r,f)))}}return n===1/0?!1:n}function Eg(e,t,r,n){let i=[],o=[],a=n[8]*t,s=n[9]*t,l=n[10]*t,u=n[11]*t,c=n[8]*r,p=n[9]*r,f=n[10]*r,y=n[11]*r;for(let m of e){let h=[],d=[];for(let g of m){let v=g.x,x=g.y,P=n[0]*v+n[4]*x+n[12],b=n[1]*v+n[5]*x+n[13],w=n[2]*v+n[6]*x+n[14],I=n[3]*v+n[7]*x+n[15],E=P+a,M=b+s,A=w+l,_=I+u,k=P+c,B=b+p,D=w+f,T=I+y,R=new Do.default(E/_,M/_);R.z=A/_,h.push(R);let U=new Do.default(k/T,B/T);U.z=D/T,d.push(U)}i.push(h),o.push(d)}return[i,o]}function Fg(e,t,r,n){let i=[];for(let o of e){let a=[o.x,o.y,n,1];Ht.transformMat4(a,a,t),i.push(new Do.default(a[0]/a[3],a[1]/a[3]))}return i}var Lg=X([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:np,size:tS,alignment:rS}=Lg;var Dg=X([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:ip,size:oS,alignment:aS}=Dg;var sp=J(It(),1);var Vg=sp.default.VectorTileFeature.types,op=63,Bg=Math.cos(75/2*(Math.PI/180)),zg=15,Rg=20,Og=15,lp=1/2,ap=Math.pow(2,Og-1)/lp,er=class{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(r=>r.id),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(r=>{this.gradients[r.id]={}}),this.layoutVertexArray=new co,this.layoutVertexArray2=new po,this.indexArray=new Le,this.programConfigurations=new Ce(t.layers,t.zoom),this.segments=new me,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(t,r,n){this.hasPattern=wr("line",this.layers,r);let i=this.layers[0].layout.get("line-sort-key"),o=!i.isConstant(),a=[];for(let{feature:s,id:l,index:u,sourceLayerIndex:c}of t){let p=this.layers[0]._featureFilter.needGeometry,f=Ne(s,p);if(!this.layers[0]._featureFilter.filter(new q(this.zoom),f,n))continue;let y=o?i.evaluate(f,{},n):void 0,m={id:l,properties:s.properties,type:s.type,sourceLayerIndex:c,index:u,geometry:p?f.geometry:ke(s),patterns:{},sortKey:y};a.push(m)}o&&a.sort((s,l)=>s.sortKey-l.sortKey);for(let s of a){let{geometry:l,index:u,sourceLayerIndex:c}=s;if(this.hasPattern){let f=Ar("line",this.layers,s,this.zoom,r);this.patternFeatures.push(f)}else this.addFeature(s,l,u,n,{});let p=t[u].feature;r.featureIndex.insert(p,l,u,c,this.index)}}update(t,r,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,n)}addFeatures(t,r,n){for(let i of this.patternFeatures)this.addFeature(i,i.geometry,i.index,r,n)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=t.createVertexBuffer(this.layoutVertexArray2,ip)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,np),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(t){if(t.properties&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_end")){let r=+t.properties.mapbox_clip_start,n=+t.properties.mapbox_clip_end;return{start:r,end:n}}}addFeature(t,r,n,i,o){let a=this.layers[0].layout,s=a.get("line-join").evaluate(t,{}),l=a.get("line-cap"),u=a.get("line-miter-limit"),c=a.get("line-round-limit");this.lineClips=this.lineFeatureClips(t);for(let p of r)this.addLine(p,t,s,l,u,c);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,n,o,i)}addLine(t,r,n,i,o,a){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let g=0;g<t.length-1;g++)this.totalDistance+=t[g].dist(t[g+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}let s=Vg[r.type]==="Polygon",l=t.length;for(;l>=2&&t[l-1].equals(t[l-2]);)l--;let u=0;for(;u<l-1&&t[u].equals(t[u+1]);)u++;if(l<(s?3:2))return;n==="bevel"&&(o=1.05);let c=this.overscaling<=16?zg*8192/(512*this.overscaling):0,p=this.segments.prepareSegment(l*10,this.layoutVertexArray,this.indexArray),f,y,m,h,d;this.e1=this.e2=-1,s&&(f=t[l-2],d=t[u].sub(f)._unit()._perp());for(let g=u;g<l;g++){if(m=g===l-1?s?t[u+1]:void 0:t[g+1],m&&t[g].equals(m))continue;d&&(h=d),f&&(y=f),f=t[g],d=m?m.sub(f)._unit()._perp():h,h=h||d;let v=h.add(d);(v.x!==0||v.y!==0)&&v._unit();let x=h.x*d.x+h.y*d.y,P=v.x*d.x+v.y*d.y,b=P!==0?1/P:1/0,w=2*Math.sqrt(2-2*P),I=P<Bg&&y&&m,E=h.x*d.y-h.y*d.x>0;if(I&&g>u){let _=f.dist(y);if(_>2*c){let k=f.sub(f.sub(y)._mult(c/_)._round());this.updateDistance(y,k),this.addCurrentVertex(k,h,0,0,p),y=k}}let M=y&&m,A=M?n:s?"butt":i;if(M&&A==="round"&&(b<a?A="miter":b<=2&&(A="fakeround")),A==="miter"&&b>o&&(A="bevel"),A==="bevel"&&(b>2&&(A="flipbevel"),b<o&&(A="miter")),y&&this.updateDistance(y,f),A==="miter")v._mult(b),this.addCurrentVertex(f,v,0,0,p);else if(A==="flipbevel"){if(b>100)v=d.mult(-1);else{let _=b*h.add(d).mag()/h.sub(d).mag();v._perp()._mult(_*(E?-1:1))}this.addCurrentVertex(f,v,0,0,p),this.addCurrentVertex(f,v.mult(-1),0,0,p)}else if(A==="bevel"||A==="fakeround"){let _=-Math.sqrt(b*b-1),k=E?_:0,B=E?0:_;if(y&&this.addCurrentVertex(f,h,k,B,p),A==="fakeround"){let D=Math.round(w*180/Math.PI/Rg);for(let T=1;T<D;T++){let R=T/D;if(R!==.5){let K=R-.5,he=1.0904+x*(-3.2452+x*(3.55645-x*1.43519)),Y=.848013+x*(-1.06021+x*.215638);R=R+R*K*(R-1)*(he*K*K+Y)}let U=d.sub(h)._mult(R)._add(h)._unit()._mult(E?-1:1);this.addHalfVertex(f,U.x,U.y,!1,E,0,p)}}m&&this.addCurrentVertex(f,d,-k,-B,p)}else if(A==="butt")this.addCurrentVertex(f,v,0,0,p);else if(A==="square"){let _=y?1:-1;this.addCurrentVertex(f,v,_,_,p)}else A==="round"&&(y&&(this.addCurrentVertex(f,h,0,0,p),this.addCurrentVertex(f,h,1,1,p,!0)),m&&(this.addCurrentVertex(f,d,-1,-1,p,!0),this.addCurrentVertex(f,d,0,0,p)));if(I&&g<l-1){let _=f.dist(m);if(_>2*c){let k=f.add(m.sub(f)._mult(c/_)._round());this.updateDistance(f,k),this.addCurrentVertex(k,d,0,0,p),f=k}}}}addCurrentVertex(t,r,n,i,o,a=!1){let s=r.x+r.y*n,l=r.y-r.x*n,u=-r.x+r.y*i,c=-r.y-r.x*i;this.addHalfVertex(t,s,l,a,!1,n,o),this.addHalfVertex(t,u,c,a,!0,-i,o),this.distance>ap/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(t,r,n,i,o,a))}addHalfVertex({x:t,y:r},n,i,o,a,s,l){let c=(this.lineClips?this.scaledDistance*(ap-1):this.scaledDistance)*lp;if(this.layoutVertexArray.emplaceBack((t<<1)+(o?1:0),(r<<1)+(a?1:0),Math.round(op*n)+128,Math.round(op*i)+128,(s===0?0:s<0?-1:1)+1|(c&63)<<2,c>>6),this.lineClips){let f=this.scaledDistance-this.lineClips.start,y=this.lineClips.end-this.lineClips.start,m=f/y;this.layoutVertexArray2.emplaceBack(m,this.lineClipsArray.length)}let p=l.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,p),l.primitiveLength++),a?this.e2=p:this.e1=p}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(t,r){this.distance+=t.dist(r),this.updateScaledDistance()}};C("LineBucket",er,{omit:["layers","patternFeatures"]});var up,Ug=()=>up=up||new re({"line-cap":new z(S.layout_line["line-cap"]),"line-join":new O(S.layout_line["line-join"]),"line-miter-limit":new z(S.layout_line["line-miter-limit"]),"line-round-limit":new z(S.layout_line["line-round-limit"]),"line-sort-key":new O(S.layout_line["line-sort-key"])}),cp,Ng=()=>cp=cp||new re({"line-opacity":new O(S.paint_line["line-opacity"]),"line-color":new O(S.paint_line["line-color"]),"line-translate":new z(S.paint_line["line-translate"]),"line-translate-anchor":new z(S.paint_line["line-translate-anchor"]),"line-width":new O(S.paint_line["line-width"]),"line-gap-width":new O(S.paint_line["line-gap-width"]),"line-offset":new O(S.paint_line["line-offset"]),"line-blur":new O(S.paint_line["line-blur"]),"line-dasharray":new Gt(S.paint_line["line-dasharray"]),"line-pattern":new at(S.paint_line["line-pattern"]),"line-gradient":new $t(S.paint_line["line-gradient"])}),_s={get paint(){return Ng()},get layout(){return Ug()}};var Is=class extends O{possiblyEvaluate(r,n){return n=new q(Math.floor(n.zoom),{now:n.now,fadeDuration:n.fadeDuration,zoomHistory:n.zoomHistory,transition:n.transition}),super.possiblyEvaluate(r,n)}evaluate(r,n,i,o){return n=Pe({},n,{zoom:Math.floor(n.zoom)}),super.evaluate(r,n,i,o)}},Bo,zo=class extends ae{constructor(r){super(r,_s);this.gradientVersion=0,Bo||(Bo=new Is(_s.paint.properties["line-width"].specification),Bo.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(r){if(r==="line-gradient"){let n=this.gradientExpression();Ut(n)?this.stepInterpolant=n._styleExpression.expression instanceof ur:this.stepInterpolant=!1,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(r,n){super.recalculate(r,n),this.paint._values["line-floorwidth"]=Bo.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,r)}createBucket(r){return new er(r)}queryRadius(r){let n=r,i=pp(Wt("line-width",this,n),Wt("line-gap-width",this,n)),o=Wt("line-offset",this,n);return i/2+Math.abs(o)+At(this.paint.get("line-translate"))}queryIntersectsFeature(r,n,i,o,a,s,l){let u=_t(r,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),s.angle,l),c=l/2*pp(this.paint.get("line-width").evaluate(n,i),this.paint.get("line-gap-width").evaluate(n,i)),p=this.paint.get("line-offset").evaluate(n,i);return p&&(o=sc(o,p*l)),oc(u,o,c)}isTileClipped(){return!0}};function pp(e,t){return t>0?t+2*e:e}var fp=X([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),yp=X([{name:"a_projected_pos",components:3,type:"Float32"}],4),$S=X([{name:"a_fade_opacity",components:1,type:"Uint32"}],4),mp=X([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]),qS=X([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]),Ts=X([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),jS=X([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4),JS=X([{name:"triangle",components:3,type:"Uint16"}]),ZS=X([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"}]),WS=X([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Uint16",name:"textAnchorOffsetStartIndex"},{type:"Uint16",name:"textAnchorOffsetEndIndex"}]),HS=X([{type:"Float32",name:"offsetX"}]),KS=X([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),YS=X([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);var Hn=J(de(),1);function Gg(e,t,r){let n=t.layout.get("text-transform").evaluate(r,{});return n==="uppercase"?e=e.toLocaleUpperCase():n==="lowercase"&&(e=e.toLocaleLowerCase()),ye.applyArabicShaping&&(e=ye.applyArabicShaping(e)),e}function hp(e,t,r){return e.sections.forEach(n=>{n.text=Gg(n.text,t,r)}),e}function dp(e){let t={},r={},n=[],i=0;function o(u){n.push(e[u]),i++}function a(u,c,p){let f=r[u];return delete r[u],r[c]=f,n[f].geometry[0].pop(),n[f].geometry[0]=n[f].geometry[0].concat(p[0]),f}function s(u,c,p){let f=t[c];return delete t[c],t[u]=f,n[f].geometry[0].shift(),n[f].geometry[0]=p[0].concat(n[f].geometry[0]),f}function l(u,c,p){let f=p?c[0][c[0].length-1]:c[0][0];return"".concat(u,":").concat(f.x,":").concat(f.y)}for(let u=0;u<e.length;u++){let c=e[u],p=c.geometry,f=c.text?c.text.toString():null;if(!f){o(u);continue}let y=l(f,p),m=l(f,p,!0);if(y in r&&m in t&&r[y]!==t[m]){let h=s(y,m,p),d=a(y,m,n[h].geometry);delete t[y],delete r[m],r[l(f,n[d].geometry,!0)]=d,n[h].geometry=null}else y in r?a(y,m,p):m in t?s(y,m,p):(o(u),t[y]=i-1,r[m]=i-1)}return n.filter(u=>u.geometry)}var Ir={"!":"\\uFE15","#":"\\uFF03",$:"\\uFF04","%":"\\uFF05","&":"\\uFF06","(":"\\uFE35",")":"\\uFE36","*":"\\uFF0A","+":"\\uFF0B",",":"\\uFE10","-":"\\uFE32",".":"\\u30FB","/":"\\uFF0F",":":"\\uFE13",";":"\\uFE14","<":"\\uFE3F","=":"\\uFF1D",">":"\\uFE40","?":"\\uFE16","@":"\\uFF20","[":"\\uFE47","\\\\":"\\uFF3C","]":"\\uFE48","^":"\\uFF3E",_:"\\uFE33","`":"\\uFF40","{":"\\uFE37","|":"\\u2015","}":"\\uFE38","~":"\\uFF5E","\\xA2":"\\uFFE0","\\xA3":"\\uFFE1","\\xA5":"\\uFFE5","\\xA6":"\\uFFE4","\\xAC":"\\uFFE2","\\xAF":"\\uFFE3","\\u2013":"\\uFE32","\\u2014":"\\uFE31","\\u2018":"\\uFE43","\\u2019":"\\uFE44","\\u201C":"\\uFE41","\\u201D":"\\uFE42","\\u2026":"\\uFE19","\\u2027":"\\u30FB","\\u20A9":"\\uFFE6","\\u3001":"\\uFE11","\\u3002":"\\uFE12","\\u3008":"\\uFE3F","\\u3009":"\\uFE40","\\u300A":"\\uFE3D","\\u300B":"\\uFE3E","\\u300C":"\\uFE41","\\u300D":"\\uFE42","\\u300E":"\\uFE43","\\u300F":"\\uFE44","\\u3010":"\\uFE3B","\\u3011":"\\uFE3C","\\u3014":"\\uFE39","\\u3015":"\\uFE3A","\\u3016":"\\uFE17","\\u3017":"\\uFE18","\\uFF01":"\\uFE15","\\uFF08":"\\uFE35","\\uFF09":"\\uFE36","\\uFF0C":"\\uFE10","\\uFF0D":"\\uFE32","\\uFF0E":"\\u30FB","\\uFF1A":"\\uFE13","\\uFF1B":"\\uFE14","\\uFF1C":"\\uFE3F","\\uFF1E":"\\uFE40","\\uFF1F":"\\uFE16","\\uFF3B":"\\uFE47","\\uFF3D":"\\uFE48","\\uFF3F":"\\uFE33","\\uFF5B":"\\uFE37","\\uFF5C":"\\u2015","\\uFF5D":"\\uFE38","\\uFF5F":"\\uFE35","\\uFF60":"\\uFE36","\\uFF61":"\\uFE12","\\uFF62":"\\uFE41","\\uFF63":"\\uFE42"};function gp(e){let t="";for(let r=0;r<e.length;r++){let n=e.charCodeAt(r+1)||null,i=e.charCodeAt(r-1)||null;(!n||!rs(n)||Ir[e[r+1]])&&(!i||!rs(i)||Ir[e[r-1]])&&Ir[e[r]]?t+=Ir[e[r]]:t+=e[r]}return t}var ne=24;var ax=J(qn(),1),sx=3;var Uo=sx;function jn(e){let t=0,r=0;for(let s of e)t+=s.w*s.h,r=Math.max(r,s.w);e.sort((s,l)=>l.h-s.h);let i=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(t/.95)),r),h:1/0}],o=0,a=0;for(let s of e)for(let l=i.length-1;l>=0;l--){let u=i[l];if(!(s.w>u.w||s.h>u.h)){if(s.x=u.x,s.y=u.y,a=Math.max(a,s.y+s.h),o=Math.max(o,s.x+s.w),s.w===u.w&&s.h===u.h){let c=i.pop();l<i.length&&(i[l]=c)}else s.h===u.h?(u.x+=s.w,u.w-=s.w):s.w===u.w?(u.y+=s.h,u.h-=s.h):(i.push({x:u.x+s.w,y:u.y,w:u.w-s.w,h:s.h}),u.y+=s.h,u.h-=s.h);break}}return{w:o,h:a,fill:t/(o*a)||0}}var xe=1;var No=class{constructor(t,{pixelRatio:r,version:n,stretchX:i,stretchY:o,content:a}){this.paddedRect=t,this.pixelRatio=r,this.stretchX=i,this.stretchY=o,this.content=a,this.version=n}get tl(){return[this.paddedRect.x+xe,this.paddedRect.y+xe]}get br(){return[this.paddedRect.x+this.paddedRect.w-xe,this.paddedRect.y+this.paddedRect.h-xe]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-xe*2)/this.pixelRatio,(this.paddedRect.h-xe*2)/this.pixelRatio]}},Jn=class{constructor(t,r){let n={},i={};this.haveRenderCallbacks=[];let o=[];this.addImages(t,n,o),this.addImages(r,i,o);let{w:a,h:s}=jn(o),l=new ge({width:a||1,height:s||1});for(let u in t){let c=t[u],p=n[u].paddedRect;ge.copy(c.data,l,{x:0,y:0},{x:p.x+xe,y:p.y+xe},c.data)}for(let u in r){let c=r[u],p=i[u].paddedRect,f=p.x+xe,y=p.y+xe,m=c.data.width,h=c.data.height;ge.copy(c.data,l,{x:0,y:0},{x:f,y},c.data),ge.copy(c.data,l,{x:0,y:h-1},{x:f,y:y-1},{width:m,height:1}),ge.copy(c.data,l,{x:0,y:0},{x:f,y:y+h},{width:m,height:1}),ge.copy(c.data,l,{x:m-1,y:0},{x:f-1,y},{width:1,height:h}),ge.copy(c.data,l,{x:0,y:0},{x:f+m,y},{width:1,height:h})}this.image=l,this.iconPositions=n,this.patternPositions=i}addImages(t,r,n){for(let i in t){let o=t[i],a={x:0,y:0,w:o.data.width+2*xe,h:o.data.height+2*xe};n.push(a),r[i]=new No(a,o),o.hasRenderCallback&&this.haveRenderCallbacks.push(i)}}patchUpdatedImages(t,r){t.dispatchRenderCallbacks(this.haveRenderCallbacks);for(let n in t.updatedImages)this.patchUpdatedImage(this.iconPositions[n],t.getImage(n),r),this.patchUpdatedImage(this.patternPositions[n],t.getImage(n),r)}patchUpdatedImage(t,r,n){if(!t||!r||t.version===r.version)return;t.version=r.version;let[i,o]=t.tl;n.update(r.data,void 0,{x:i,y:o})}};C("ImagePosition",No);C("ImageAtlas",Jn);var qo=(i=>(i[i.none=0]="none",i[i.horizontal=1]="horizontal",i[i.vertical=2]="vertical",i[i.horizontalOnly=3]="horizontalOnly",i))(qo||{}),kr=-17;function lx(e){for(let t of e)if(t.positionedGlyphs.length!==0)return!1;return!0}var Ap=57344,_p=63743,Go=class e{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(t,r){let n=new e;return n.scale=t||1,n.fontStack=r,n}static forImage(t){let r=new e;return r.imageName=t,r}},Zn=class e{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(t,r){let n=new e;for(let i=0;i<t.sections.length;i++){let o=t.sections[i];o.image?n.addImageSection(o):n.addTextSection(o,r)}return n}length(){return this.text.length}getSection(t){return this.sections[this.sectionIndex[t]]}getSectionIndex(t){return this.sectionIndex[t]}getCharCode(t){return this.text.charCodeAt(t)}verticalizePunctuation(){this.text=gp(this.text)}trim(){let t=0;for(let n=0;n<this.text.length&&$o[this.text.charCodeAt(n)];n++)t++;let r=this.text.length;for(let n=this.text.length-1;n>=0&&n>=t&&$o[this.text.charCodeAt(n)];n--)r--;this.text=this.text.substring(t,r),this.sectionIndex=this.sectionIndex.slice(t,r)}substring(t,r){let n=new e;return n.text=this.text.substring(t,r),n.sectionIndex=this.sectionIndex.slice(t,r),n.sections=this.sections,n}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((t,r)=>Math.max(t,this.sections[r].scale),0)}addTextSection(t,r){this.text+=t.text,this.sections.push(Go.forText(t.scale,t.fontStack||r));let n=this.sections.length-1;for(let i=0;i<t.text.length;++i)this.sectionIndex.push(n)}addImageSection(t){let r=t.image?t.image.name:"";if(r.length===0){fe("Can\'t add FormattedSection with an empty image.");return}let n=this.getNextImageSectionCharCode();if(!n){fe("Reached maximum number of images ".concat(_p-Ap+2));return}this.text+=String.fromCharCode(n),this.sections.push(Go.forImage(r)),this.sectionIndex.push(this.sections.length-1)}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=_p?null:++this.imageSectionID:(this.imageSectionID=Ap,this.imageSectionID)}};function ux(e,t){let r=[],n=e.text,i=0;for(let o of t)r.push(e.substring(i,o)),i=o;return i<n.length&&r.push(e.substring(i,n.length)),r}function Wn(e,t,r,n,i,o,a,s,l,u,c,p,f,y,m,h){let d=Zn.fromFeature(e,i);p===2&&d.verticalizePunctuation();let g,{processBidirectionalText:v,processStyledBidirectionalText:x}=ye;if(v&&d.sections.length===1){g=[];let w=v(d.toString(),Ms(d,u,o,t,n,y,m));for(let I of w){let E=new Zn;E.text=I,E.sections=d.sections;for(let M=0;M<I.length;M++)E.sectionIndex.push(0);g.push(E)}}else if(x){g=[];let w=x(d.text,d.sectionIndex,Ms(d,u,o,t,n,y,m));for(let I of w){let E=new Zn;E.text=I[0],E.sectionIndex=I[1],E.sections=d.sections,g.push(E)}}else g=ux(d,Ms(d,u,o,t,n,y,m));let P=[],b={positionedLines:P,text:d.toString(),top:c[1],bottom:c[1],left:c[0],right:c[0],writingMode:p,iconsInText:!1,verticalizable:!1};return yx(b,t,r,n,g,a,s,l,p,u,f,h),lx(P)?!1:b}var $o={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},cx={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 Cp(e,t,r,n,i,o){if(t.imageName){let a=n[t.imageName];return a?a.displaySize[0]*t.scale*ne/o+i:0}else{let a=r[t.fontStack],s=a&&a[e];return s?s.metrics.advance*t.scale+i:0}}function px(e,t,r,n,i,o){let a=0;for(let l=0;l<e.length();l++){let u=e.getSection(l);a+=Cp(e.getCharCode(l),u,n,i,t,o)}let s=Math.max(1,Math.ceil(a/r));return a/s}function Ip(e,t,r,n){let i=Math.pow(e-t,2);return n?e<t?i/2:i*2:i+Math.abs(r)*r}function fx(e,t,r){let n=0;return e===10&&(n-=1e4),r&&(n+=150),(e===40||e===65288)&&(n+=50),(t===41||t===65289)&&(n+=50),n}function Tp(e,t,r,n,i,o){let a=null,s=Ip(t,r,i,o);for(let l of n){let u=t-l.x,c=Ip(u,r,i,o)+l.badness;c<=s&&(a=l,s=c)}return{index:e,x:t,priorBreak:a,badness:s}}function kp(e){return e?kp(e.priorBreak).concat(e.index):[]}function Ms(e,t,r,n,i,o,a){if(o!=="point")return[];if(!e)return[];let s=[],l=px(e,t,r,n,i,a),u=e.text.indexOf("\\u200B")>=0,c=0;for(let p=0;p<e.length();p++){let f=e.getSection(p),y=e.getCharCode(p);if($o[y]||(c+=Cp(y,f,n,i,t,a)),p<e.length()-1){let m=Nu(y);(cx[y]||m||f.imageName)&&s.push(Tp(p+1,c,l,s,fx(y,e.getCharCode(p+1),m&&u),!1))}}return kp(Tp(e.length(),c,l,s,0,!0))}function Mp(e){let t=.5,r=.5;switch(e){case"right":case"top-right":case"bottom-right":t=1;break;case"left":case"top-left":case"bottom-left":t=0;break}switch(e){case"bottom":case"bottom-right":case"bottom-left":r=1;break;case"top":case"top-right":case"top-left":r=0;break}return{horizontalAlign:t,verticalAlign:r}}function yx(e,t,r,n,i,o,a,s,l,u,c,p){let f=0,y=kr,m=0,h=0,d=s==="right"?1:s==="left"?0:.5,g=0;for(let b of i){b.trim();let w=b.getMaxScale(),I=(w-1)*ne,E={positionedGlyphs:[],lineOffset:0};e.positionedLines[g]=E;let M=E.positionedGlyphs,A=0;if(!b.length()){y+=o,++g;continue}for(let k=0;k<b.length();k++){let B=b.getSection(k),D=b.getSectionIndex(k),T=b.getCharCode(k),R=0,U=null,K=null,he=null,Y=ne,se=!(l===1||!c&&!Ji(T)||c&&($o[T]||Gu(T)));if(B.imageName){let ce=n[B.imageName];if(!ce)continue;he=B.imageName,e.iconsInText=e.iconsInText||!0,K=ce.paddedRect;let pe=ce.displaySize;B.scale=B.scale*ne/p,U={width:pe[0],height:pe[1],left:xe,top:-Uo,advance:se?pe[1]:pe[0]};let _e=ne-pe[1]*B.scale;R=I+_e,Y=U.advance;let be=se?pe[0]*B.scale-ne*w:pe[1]*B.scale-ne*w;be>0&&be>A&&(A=be)}else{let ce=r[B.fontStack],pe=ce&&ce[T];if(pe&&pe.rect)K=pe.rect,U=pe.metrics;else{let _e=t[B.fontStack],be=_e&&_e[T];if(!be)continue;U=be.metrics}R=(w-B.scale)*ne}se?(e.verticalizable=!0,M.push({glyph:T,imageName:he,x:f,y:y+R,vertical:se,scale:B.scale,fontStack:B.fontStack,sectionIndex:D,metrics:U,rect:K}),f+=Y*B.scale+u):(M.push({glyph:T,imageName:he,x:f,y:y+R,vertical:se,scale:B.scale,fontStack:B.fontStack,sectionIndex:D,metrics:U,rect:K}),f+=U.advance*B.scale+u)}if(M.length!==0){let k=f-u;m=Math.max(k,m),mx(M,0,M.length-1,d,A)}f=0;let _=o*w+A;E.lineOffset=Math.max(A,I),y+=_,h=Math.max(_,h),++g}let v=y-kr,{horizontalAlign:x,verticalAlign:P}=Mp(a);hx(e.positionedLines,d,x,P,m,h,o,v,i.length),e.top+=-P*v,e.bottom=e.top+v,e.left+=-x*m,e.right=e.left+m}function mx(e,t,r,n,i){if(!n&&!i)return;let o=e[r],a=o.metrics.advance*o.scale,s=(e[r].x+a)*n;for(let l=t;l<=r;l++)e[l].x-=s,e[l].y+=i}function hx(e,t,r,n,i,o,a,s,l){let u=(t-r)*i,c=0;o!==a?c=-s*n-kr:c=(-n*l+.5)*a;for(let p of e)for(let f of p.positionedGlyphs)f.x+=u,f.y+=c}function Ep(e,t,r){let{horizontalAlign:n,verticalAlign:i}=Mp(r),o=t[0],a=t[1],s=o-e.displaySize[0]*n,l=s+e.displaySize[0],u=a-e.displaySize[1]*i,c=u+e.displaySize[1];return{image:e,top:u,bottom:c,left:s,right:l}}function Es(e,t,r,n,i,o){let a=e.image,s;if(a.content){let d=a.content,g=a.pixelRatio||1;s=[d[0]/g,d[1]/g,a.displaySize[0]-d[2]/g,a.displaySize[1]-d[3]/g]}let l=t.left*o,u=t.right*o,c,p,f,y;r==="width"||r==="both"?(y=i[0]+l-n[3],p=i[0]+u+n[1]):(y=i[0]+(l+u-a.displaySize[0])/2,p=y+a.displaySize[0]);let m=t.top*o,h=t.bottom*o;return r==="height"||r==="both"?(c=i[1]+m-n[0],f=i[1]+h+n[2]):(c=i[1]+(m+h-a.displaySize[1])/2,f=c+a.displaySize[1]),{image:a,top:c,right:p,bottom:f,left:y,collisionPadding:s}}var Fp=J(It(),1);var Mr=255,Tt=128,Xe=Mr*Tt;function Fs(e,t){let{expression:r}=t;if(r.kind==="constant")return{kind:"constant",layoutSize:r.evaluate(new q(e+1))};if(r.kind==="source")return{kind:"source"};{let{zoomStops:n,interpolationType:i}=r,o=0;for(;o<n.length&&n[o]<=e;)o++;o=Math.max(0,o-1);let a=o;for(;a<n.length&&n[a]<e+1;)a++;a=Math.min(n.length-1,a);let s=n[o],l=n[a];if(r.kind==="composite")return{kind:"composite",minZoom:s,maxZoom:l,interpolationType:i};let u=r.evaluate(new q(s)),c=r.evaluate(new q(l));return{kind:"camera",minZoom:s,maxZoom:l,minSize:u,maxSize:c,interpolationType:i}}}function Ls(e,t,r){let n="never",i=e.get(t);return i?n=i:e.get(r)&&(n="always"),n}var dx=Fp.default.VectorTileFeature.types,gx=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function jo(e,t,r,n,i,o,a,s,l,u,c,p,f){let y=s?Math.min(Xe,Math.round(s[0])):0,m=s?Math.min(Xe,Math.round(s[1])):0;e.emplaceBack(t,r,Math.round(n*32),Math.round(i*32),o,a,(y<<1)+(l?1:0),m,u*16,c*16,p*256,f*256)}function Lp(e,t,r){e.emplaceBack(t.x,t.y,r),e.emplaceBack(t.x,t.y,r),e.emplaceBack(t.x,t.y,r),e.emplaceBack(t.x,t.y,r)}function xx(e){for(let t of e.sections)if(qu(t.text))return!0;return!1}var Kn=class{constructor(t){this.layoutVertexArray=new fo,this.indexArray=new Le,this.programConfigurations=t,this.segments=new me,this.dynamicLayoutVertexArray=new yo,this.opacityVertexArray=new mo,this.hasVisibleVertices=!1,this.placedSymbolArray=new An}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(t,r,n,i){this.isEmpty()||(n&&(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,fp.members),this.indexBuffer=t.createIndexBuffer(this.indexArray,r),this.dynamicLayoutVertexBuffer=t.createVertexBuffer(this.dynamicLayoutVertexArray,yp.members,!0),this.opacityVertexBuffer=t.createVertexBuffer(this.opacityVertexArray,gx,!0),this.opacityVertexBuffer.itemSize=1),(n||i)&&this.programConfigurations.upload(t))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}};C("SymbolBuffers",Kn);var Yn=class{constructor(t,r,n){this.layoutVertexArray=new t,this.layoutAttributes=r,this.indexArray=new n,this.segments=new me,this.collisionVertexArray=new ho}upload(t){this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=t.createVertexBuffer(this.collisionVertexArray,mp.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}};C("CollisionBuffers",Yn);var He=class{constructor(t){this.collisionBoxArray=t.collisionBoxArray,this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(l=>l.id),this.index=t.index,this.pixelRatio=t.pixelRatio,this.sourceLayerIndex=t.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=Bn.identity([]),this.placementViewportMatrix=Bn.identity([]);let n=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Fs(this.zoom,n["text-size"]),this.iconSizeData=Fs(this.zoom,n["icon-size"]);let i=this.layers[0].layout,o=i.get("symbol-sort-key"),a=i.get("symbol-z-order");this.canOverlap=Ls(i,"text-overlap","text-allow-overlap")!=="never"||Ls(i,"icon-overlap","icon-allow-overlap")!=="never"||i.get("text-ignore-placement")||i.get("icon-ignore-placement"),this.sortFeaturesByKey=a!=="viewport-y"&&!o.isConstant();let s=a==="viewport-y"||a==="auto"&&!this.sortFeaturesByKey;this.sortFeaturesByY=s&&this.canOverlap,i.get("symbol-placement")==="point"&&(this.writingModes=i.get("text-writing-mode").map(l=>qo[l])),this.stateDependentLayerIds=this.layers.filter(l=>l.isStateDependent()).map(l=>l.id),this.sourceID=t.sourceID}createArrays(){this.text=new Kn(new Ce(this.layers,this.zoom,t=>/^text/.test(t))),this.icon=new Kn(new Ce(this.layers,this.zoom,t=>/^icon/.test(t))),this.glyphOffsetArray=new In,this.lineVertexArray=new Tn,this.symbolInstances=new _n,this.textAnchorOffsets=new Cn}calculateGlyphDependencies(t,r,n,i,o){for(let a=0;a<t.length;a++)if(r[t.charCodeAt(a)]=!0,(n||i)&&o){let s=Ir[t.charAt(a)];s&&(r[s.charCodeAt(0)]=!0)}}populate(t,r,n){let i=this.layers[0],o=i.layout,a=o.get("text-font"),s=o.get("text-field"),l=o.get("icon-image"),u=(s.value.kind!=="constant"||s.value.value instanceof Fe&&!s.value.value.isEmpty()||s.value.value.toString().length>0)&&(a.value.kind!=="constant"||a.value.value.length>0),c=l.value.kind!=="constant"||!!l.value.value||Object.keys(l.parameters).length>0,p=o.get("symbol-sort-key");if(this.features=[],!u&&!c)return;let f=r.iconDependencies,y=r.glyphDependencies,m=r.availableImages,h=new q(this.zoom);for(let{feature:d,id:g,index:v,sourceLayerIndex:x}of t){let P=i._featureFilter.needGeometry,b=Ne(d,P);if(!i._featureFilter.filter(h,b,n))continue;P||(b.geometry=ke(d));let w;if(u){let A=i.getValueAndResolveTokens("text-field",b,n,m),_=Fe.factory(A),k=this.hasRTLText=this.hasRTLText||xx(_);(!k||ye.getRTLTextPluginStatus()==="unavailable"||k&&ye.isParsed())&&(w=hp(_,i,b))}let I;if(c){let A=i.getValueAndResolveTokens("icon-image",b,n,m);A instanceof Te?I=A:I=Te.fromString(A)}if(!w&&!I)continue;let E=this.sortFeaturesByKey?p.evaluate(b,{},n):void 0,M={id:g,text:w,icon:I,index:v,sourceLayerIndex:x,geometry:b.geometry,properties:d.properties,type:dx[d.type],sortKey:E};if(this.features.push(M),I&&(f[I.name]=!0),w){let A=a.evaluate(b,{},n).join(","),_=o.get("text-rotation-alignment")!=="viewport"&&o.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(2)>=0;for(let k of w.sections)if(k.image)f[k.image.name]=!0;else{let B=on(w.toString()),D=k.fontStack||A,T=y[D]=y[D]||{};this.calculateGlyphDependencies(k.text,T,_,this.allowVerticalPlacement,B)}}}o.get("symbol-placement")==="line"&&(this.features=dp(this.features)),this.sortFeaturesByKey&&this.features.sort((d,g)=>d.sortKey-g.sortKey)}update(t,r,n){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(t,r,this.layers,n),this.icon.programConfigurations.updatePaintArrays(t,r,this.layers,n))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(t){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(t),this.iconCollisionBox.upload(t)),this.text.upload(t,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(t,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(t,r){let n=this.lineVertexArray.length;if(t.segment!==void 0){let i=t.dist(r[t.segment+1]),o=t.dist(r[t.segment]),a={};for(let s=t.segment+1;s<r.length;s++)a[s]={x:r[s].x,y:r[s].y,tileUnitDistanceFromAnchor:i},s<r.length-1&&(i+=r[s+1].dist(r[s]));for(let s=t.segment||0;s>=0;s--)a[s]={x:r[s].x,y:r[s].y,tileUnitDistanceFromAnchor:o},s>0&&(o+=r[s-1].dist(r[s]));for(let s=0;s<r.length;s++){let l=a[s];this.lineVertexArray.emplaceBack(l.x,l.y,l.tileUnitDistanceFromAnchor)}}return{lineStartIndex:n,lineLength:this.lineVertexArray.length-n}}addSymbols(t,r,n,i,o,a,s,l,u,c,p,f){let y=t.indexArray,m=t.layoutVertexArray,h=t.segments.prepareSegment(4*r.length,m,y,this.canOverlap?a.sortKey:void 0),d=this.glyphOffsetArray.length,g=h.vertexLength,v=this.allowVerticalPlacement&&s===2?Math.PI/2:0,x=a.text&&a.text.sections;for(let P=0;P<r.length;P++){let{tl:b,tr:w,bl:I,br:E,tex:M,pixelOffsetTL:A,pixelOffsetBR:_,minFontScaleX:k,minFontScaleY:B,glyphOffset:D,isSDF:T,sectionIndex:R}=r[P],U=h.vertexLength,K=D[1];jo(m,l.x,l.y,b.x,K+b.y,M.x,M.y,n,T,A.x,A.y,k,B),jo(m,l.x,l.y,w.x,K+w.y,M.x+M.w,M.y,n,T,_.x,A.y,k,B),jo(m,l.x,l.y,I.x,K+I.y,M.x,M.y+M.h,n,T,A.x,_.y,k,B),jo(m,l.x,l.y,E.x,K+E.y,M.x+M.w,M.y+M.h,n,T,_.x,_.y,k,B),Lp(t.dynamicLayoutVertexArray,l,v),y.emplaceBack(U,U+1,U+2),y.emplaceBack(U+1,U+2,U+3),h.vertexLength+=4,h.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(D[0]),(P===r.length-1||R!==r[P+1].sectionIndex)&&t.programConfigurations.populatePaintArrays(m.length,a,a.index,{},f,x&&x[R])}t.placedSymbolArray.emplaceBack(l.x,l.y,d,this.glyphOffsetArray.length-d,g,u,c,l.segment,n?n[0]:0,n?n[1]:0,i[0],i[1],s,0,!1,0,p)}_addCollisionDebugVertex(t,r,n,i,o,a){return r.emplaceBack(0,0),t.emplaceBack(n.x,n.y,i,o,Math.round(a.x),Math.round(a.y))}addCollisionDebugVertices(t,r,n,i,o,a,s){let l=o.segments.prepareSegment(4,o.layoutVertexArray,o.indexArray),u=l.vertexLength,c=o.layoutVertexArray,p=o.collisionVertexArray,f=s.anchorX,y=s.anchorY;this._addCollisionDebugVertex(c,p,a,f,y,new Hn.default(t,r)),this._addCollisionDebugVertex(c,p,a,f,y,new Hn.default(n,r)),this._addCollisionDebugVertex(c,p,a,f,y,new Hn.default(n,i)),this._addCollisionDebugVertex(c,p,a,f,y,new Hn.default(t,i)),l.vertexLength+=4;let m=o.indexArray;m.emplaceBack(u,u+1),m.emplaceBack(u+1,u+2),m.emplaceBack(u+2,u+3),m.emplaceBack(u+3,u),l.primitiveLength+=4}addDebugCollisionBoxes(t,r,n,i){for(let o=t;o<r;o++){let a=this.collisionBoxArray.get(o),s=a.x1,l=a.y1,u=a.x2,c=a.y2;this.addCollisionDebugVertices(s,l,u,c,i?this.textCollisionBox:this.iconCollisionBox,a.anchorPoint,n)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new Yn(Mn,Ts.members,St),this.iconCollisionBox=new Yn(Mn,Ts.members,St);for(let t=0;t<this.symbolInstances.length;t++){let r=this.symbolInstances.get(t);this.addDebugCollisionBoxes(r.textBoxStartIndex,r.textBoxEndIndex,r,!0),this.addDebugCollisionBoxes(r.verticalTextBoxStartIndex,r.verticalTextBoxEndIndex,r,!0),this.addDebugCollisionBoxes(r.iconBoxStartIndex,r.iconBoxEndIndex,r,!1),this.addDebugCollisionBoxes(r.verticalIconBoxStartIndex,r.verticalIconBoxEndIndex,r,!1)}}_deserializeCollisionBoxesForSymbol(t,r,n,i,o,a,s,l,u){let c={};for(let p=r;p<n;p++){let f=t.get(p);c.textBox={x1:f.x1,y1:f.y1,x2:f.x2,y2:f.y2,anchorPointX:f.anchorPointX,anchorPointY:f.anchorPointY},c.textFeatureIndex=f.featureIndex;break}for(let p=i;p<o;p++){let f=t.get(p);c.verticalTextBox={x1:f.x1,y1:f.y1,x2:f.x2,y2:f.y2,anchorPointX:f.anchorPointX,anchorPointY:f.anchorPointY},c.verticalTextFeatureIndex=f.featureIndex;break}for(let p=a;p<s;p++){let f=t.get(p);c.iconBox={x1:f.x1,y1:f.y1,x2:f.x2,y2:f.y2,anchorPointX:f.anchorPointX,anchorPointY:f.anchorPointY},c.iconFeatureIndex=f.featureIndex;break}for(let p=l;p<u;p++){let f=t.get(p);c.verticalIconBox={x1:f.x1,y1:f.y1,x2:f.x2,y2:f.y2,anchorPointX:f.anchorPointX,anchorPointY:f.anchorPointY},c.verticalIconFeatureIndex=f.featureIndex;break}return c}deserializeCollisionBoxes(t){this.collisionArrays=[];for(let r=0;r<this.symbolInstances.length;r++){let n=this.symbolInstances.get(r);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(t,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}addIndicesForPlacedSymbol(t,r){let n=t.placedSymbolArray.get(r),i=n.vertexStartIndex+n.numGlyphs*4;for(let o=n.vertexStartIndex;o<i;o+=4)t.indexArray.emplaceBack(o,o+1,o+2),t.indexArray.emplaceBack(o+1,o+2,o+3)}getSortedSymbolIndexes(t){if(this.sortedAngle===t&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;let r=Math.sin(t),n=Math.cos(t),i=[],o=[],a=[];for(let s=0;s<this.symbolInstances.length;++s){a.push(s);let l=this.symbolInstances.get(s);i.push(Math.round(r*l.anchorX+n*l.anchorY)|0),o.push(l.featureIndex)}return a.sort((s,l)=>i[s]-i[l]||o[l]-o[s]),a}addToSortKeyRanges(t,r){let n=this.sortKeyRanges[this.sortKeyRanges.length-1];n&&n.sortKey===r?n.symbolInstanceEnd=t+1:this.sortKeyRanges.push({sortKey:r,symbolInstanceStart:t,symbolInstanceEnd:t+1})}sortFeatures(t){if(this.sortFeaturesByY&&this.sortedAngle!==t&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(t),this.sortedAngle=t,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(let r of this.symbolInstanceIndexes){let n=this.symbolInstances.get(r);this.featureSortOrder.push(n.featureIndex),[n.rightJustifiedTextSymbolIndex,n.centerJustifiedTextSymbolIndex,n.leftJustifiedTextSymbolIndex].forEach((i,o,a)=>{i>=0&&a.indexOf(i)===o&&this.addIndicesForPlacedSymbol(this.text,i)}),n.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,n.verticalPlacedTextSymbolIndex),n.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,n.placedIconSymbolIndex),n.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,n.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}};C("SymbolBucket",He,{omit:["layers","collisionBoxArray","features","compareText"]});He.MAX_GLYPHS=65535;He.addDynamicAttributes=Lp;function Dp(e,t){return t.replace(/{([^{}]+)}/g,(r,n)=>e&&n in e?String(e[n]):"")}var Vp,bx=()=>Vp=Vp||new re({"symbol-placement":new z(S.layout_symbol["symbol-placement"]),"symbol-spacing":new z(S.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new z(S.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new O(S.layout_symbol["symbol-sort-key"]),"symbol-z-order":new z(S.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new z(S.layout_symbol["icon-allow-overlap"]),"icon-overlap":new z(S.layout_symbol["icon-overlap"]),"icon-ignore-placement":new z(S.layout_symbol["icon-ignore-placement"]),"icon-optional":new z(S.layout_symbol["icon-optional"]),"icon-rotation-alignment":new z(S.layout_symbol["icon-rotation-alignment"]),"icon-size":new O(S.layout_symbol["icon-size"]),"icon-text-fit":new z(S.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new z(S.layout_symbol["icon-text-fit-padding"]),"icon-image":new O(S.layout_symbol["icon-image"]),"icon-rotate":new O(S.layout_symbol["icon-rotate"]),"icon-padding":new O(S.layout_symbol["icon-padding"]),"icon-keep-upright":new z(S.layout_symbol["icon-keep-upright"]),"icon-offset":new O(S.layout_symbol["icon-offset"]),"icon-anchor":new O(S.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new z(S.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new z(S.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new z(S.layout_symbol["text-rotation-alignment"]),"text-field":new O(S.layout_symbol["text-field"]),"text-font":new O(S.layout_symbol["text-font"]),"text-size":new O(S.layout_symbol["text-size"]),"text-max-width":new O(S.layout_symbol["text-max-width"]),"text-line-height":new z(S.layout_symbol["text-line-height"]),"text-letter-spacing":new O(S.layout_symbol["text-letter-spacing"]),"text-justify":new O(S.layout_symbol["text-justify"]),"text-radial-offset":new O(S.layout_symbol["text-radial-offset"]),"text-variable-anchor":new z(S.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new O(S.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new O(S.layout_symbol["text-anchor"]),"text-max-angle":new z(S.layout_symbol["text-max-angle"]),"text-writing-mode":new z(S.layout_symbol["text-writing-mode"]),"text-rotate":new O(S.layout_symbol["text-rotate"]),"text-padding":new z(S.layout_symbol["text-padding"]),"text-keep-upright":new z(S.layout_symbol["text-keep-upright"]),"text-transform":new O(S.layout_symbol["text-transform"]),"text-offset":new O(S.layout_symbol["text-offset"]),"text-allow-overlap":new z(S.layout_symbol["text-allow-overlap"]),"text-overlap":new z(S.layout_symbol["text-overlap"]),"text-ignore-placement":new z(S.layout_symbol["text-ignore-placement"]),"text-optional":new z(S.layout_symbol["text-optional"])}),Bp,vx=()=>Bp=Bp||new re({"icon-opacity":new O(S.paint_symbol["icon-opacity"]),"icon-color":new O(S.paint_symbol["icon-color"]),"icon-halo-color":new O(S.paint_symbol["icon-halo-color"]),"icon-halo-width":new O(S.paint_symbol["icon-halo-width"]),"icon-halo-blur":new O(S.paint_symbol["icon-halo-blur"]),"icon-translate":new z(S.paint_symbol["icon-translate"]),"icon-translate-anchor":new z(S.paint_symbol["icon-translate-anchor"]),"text-opacity":new O(S.paint_symbol["text-opacity"]),"text-color":new O(S.paint_symbol["text-color"],{runtimeType:Re,getOverride:e=>e.textColor,hasOverride:e=>!!e.textColor}),"text-halo-color":new O(S.paint_symbol["text-halo-color"]),"text-halo-width":new O(S.paint_symbol["text-halo-width"]),"text-halo-blur":new O(S.paint_symbol["text-halo-blur"]),"text-translate":new z(S.paint_symbol["text-translate"]),"text-translate-anchor":new z(S.paint_symbol["text-translate-anchor"])}),Jo={get paint(){return vx()},get layout(){return bx()}};var Xn=class{constructor(t){if(t.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=t.property.overrides?t.property.overrides.runtimeType:pr,this.defaultValue=t}evaluate(t){if(t.formattedSection){let r=this.defaultValue.property.overrides;if(r&&r.hasOverride(t.formattedSection))return r.getOverride(t.formattedSection)}return t.feature&&t.featureState?this.defaultValue.evaluate(t.feature,t.featureState):this.defaultValue.property.specification.default}eachChild(t){if(!this.defaultValue.isConstant()){let r=this.defaultValue.value;t(r._styleExpression.expression)}}outputDefined(){return!1}serialize(){return null}};C("FormatSectionOverride",Xn,{omit:["defaultValue"]});var Zo=class e extends ae{constructor(r){super(r,Jo)}recalculate(r,n){if(super.recalculate(r,n),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout.get("symbol-placement")!=="point"?this.layout._values["icon-rotation-alignment"]="map":this.layout._values["icon-rotation-alignment"]="viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout.get("symbol-placement")!=="point"?this.layout._values["text-rotation-alignment"]="map":this.layout._values["text-rotation-alignment"]="viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")==="map"?"map":"viewport"),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),this.layout.get("symbol-placement")==="point"){let i=this.layout.get("text-writing-mode");if(i){let o=[];for(let a of i)o.indexOf(a)<0&&o.push(a);this.layout._values["text-writing-mode"]=o}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(r,n,i,o){let a=this.layout.get(r).evaluate(n,{},i,o),s=this._unevaluatedLayout._values[r];return!s.isDataDriven()&&!Ut(s.value)&&a?Dp(n.properties,a):a}createBucket(r){return new He(r)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(let r of Jo.paint.overridableProperties){if(!e.hasPaintOverride(this.layout,r))continue;let n=this.paint.get(r),i=new Xn(n),o=new Bt(i,n.property.specification),a=null;n.value.kind==="constant"||n.value.kind==="source"?a=new ht("source",o):a=new dt("composite",o,n.value.zoomStops),this.paint._values[r]=new Se(n.property,a,n.parameters)}}_handleOverridablePaintPropertyUpdate(r,n,i){return!this.layout||n.isDataDriven()||i.isDataDriven()?!1:e.hasPaintOverride(this.layout,r)}static hasPaintOverride(r,n){let i=r.get("text-field"),o=Jo.paint.properties[n],a=!1,s=l=>{for(let u of l)if(o.overrides&&o.overrides.hasOverride(u)){a=!0;return}};if(i.value.kind==="constant"&&i.value.value instanceof Fe)s(i.value.value.sections);else if(i.value.kind==="source"){let l=c=>{if(!a)if(c instanceof yt&&ue(c.value)===fr){let p=c.value;s(p.sections)}else c instanceof Yr?s(c.sections):c.eachChild(l)},u=i.value;u._styleExpression&&l(u._styleExpression.expression)}return a}};function zp(e,t,r,n=1){let i=e.get("icon-padding").evaluate(t,{},r),o=i&&i.values;return[o[0]*n,o[1]*n,o[2]*n,o[3]*n]}var Rp,Px=()=>Rp=Rp||new re({"background-color":new z(S.paint_background["background-color"]),"background-pattern":new Gt(S.paint_background["background-pattern"]),"background-opacity":new z(S.paint_background["background-opacity"])}),Op={get paint(){return Px()}};var Wo=class extends ae{constructor(r){super(r,Op)}};var Up,Sx=()=>Up=Up||new re({"raster-opacity":new z(S.paint_raster["raster-opacity"]),"raster-hue-rotate":new z(S.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new z(S.paint_raster["raster-brightness-min"]),"raster-brightness-max":new z(S.paint_raster["raster-brightness-max"]),"raster-saturation":new z(S.paint_raster["raster-saturation"]),"raster-contrast":new z(S.paint_raster["raster-contrast"]),"raster-resampling":new z(S.paint_raster["raster-resampling"]),"raster-fade-duration":new z(S.paint_raster["raster-fade-duration"])}),Np={get paint(){return Sx()}};var Ho=class extends ae{constructor(r){super(r,Np)}};var Ko=class extends ae{constructor(r){super(r,{});this.onAdd=r=>{this.implementation.onAdd&&this.implementation.onAdd(r,r.painter.context.gl)};this.onRemove=r=>{this.implementation.onRemove&&this.implementation.onRemove(r,r.painter.context.gl)};this.implementation=r}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}};function Gp(e){if(e.type==="custom")return new Ko(e);switch(e.type){case"background":return new Wo(e);case"circle":return new _o(e);case"fill":return new Fo(e);case"fill-extrusion":return new Vo(e);case"heatmap":return new Io(e);case"hillshade":return new To(e);case"line":return new zo(e);case"raster":return new Ho(e);case"symbol":return new Zo(e)}}var Yo=class{constructor(t){this.keyCache={},t&&this.replace(t)}replace(t){this._layerConfigs={},this._layers={},this.update(t,[])}update(t,r){for(let i of t){this._layerConfigs[i.id]=i;let o=this._layers[i.id]=Gp(i);o._featureFilter=rn(o.filter),this.keyCache[i.id]&&delete this.keyCache[i.id]}for(let i of r)delete this.keyCache[i],delete this._layerConfigs[i],delete this._layers[i];this.familiesBySource={};let n=cu(Object.values(this._layerConfigs),this.keyCache);for(let i of n){let o=i.map(p=>this._layers[p.id]),a=o[0];if(a.visibility==="none")continue;let s=a.source||"",l=this.familiesBySource[s];l||(l=this.familiesBySource[s]={});let u=a.sourceLayer||"_geojsonTileLayer",c=l[u];c||(c=l[u]=[]),c.push(o)}}};var mf=J(It(),1),hf=J(qn(),1);var Er=class{constructor(t){this._stringToNumber={},this._numberToString=[];for(let r=0;r<t.length;r++){let n=t[r];this._stringToNumber[n]=r,this._numberToString[r]=n}}encode(t){return this._stringToNumber[t]}decode(t){if(t>=this._numberToString.length)throw new Error("Out of bounds. Index requested n=".concat(t," can\'t be >= this._numberToString.length ").concat(this._numberToString.length));return this._numberToString[t]}};var jp=J(It(),1),Jp=J(qn(),1);var Xo=class{constructor(t,r,n,i,o){this.type="Feature",this._vectorTileFeature=t,t._z=r,t._x=n,t._y=i,this.properties=t.properties,this.id=o}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(t){this._geometry=t}toJSON(){let t={geometry:this.geometry};for(let r in this)r==="_geometry"||r==="_vectorTileFeature"||(t[r]=this[r]);return t}};var Qn=class{constructor(t,r){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new Lt(8192,16,0),this.grid3D=new Lt(8192,16,0),this.featureIndexArray=new kn,this.promoteId=r}insert(t,r,n,i,o,a){let s=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(n,i,o);let l=a?this.grid3D:this.grid;for(let u=0;u<r.length;u++){let c=r[u],p=[1/0,1/0,-1/0,-1/0];for(let f=0;f<c.length;f++){let y=c[f];p[0]=Math.min(p[0],y.x),p[1]=Math.min(p[1],y.y),p[2]=Math.max(p[2],y.x),p[3]=Math.max(p[3],y.y)}p[0]<8192&&p[1]<8192&&p[2]>=0&&p[3]>=0&&l.insert(s,p[0],p[1],p[2],p[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new jp.default.VectorTile(new Jp.default(this.rawTileData)).layers,this.sourceLayerCoder=new Er(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(t,r,n,i){this.loadVTLayers();let o=t.params||{},a=8192/t.tileSize/t.scale,s=rn(o.filter),l=t.queryGeometry,u=t.queryPadding*a,c=qp(l),p=this.grid.query(c.minX-u,c.minY-u,c.maxX+u,c.maxY+u),f=qp(t.cameraQueryGeometry),y=this.grid3D.query(f.minX-u,f.minY-u,f.maxX+u,f.maxY+u,(d,g,v,x)=>ac(t.cameraQueryGeometry,d-u,g-u,v+u,x+u));for(let d of y)p.push(d);p.sort(wx);let m={},h;for(let d=0;d<p.length;d++){let g=p[d];if(g===h)continue;h=g;let v=this.featureIndexArray.get(g),x=null;this.loadMatchingFeature(m,v.bucketIndex,v.sourceLayerIndex,v.featureIndex,s,o.layers,o.availableImages,r,n,i,(P,b,w)=>(x||(x=ke(P)),b.queryIntersectsFeature(l,P,w,x,this.z,t.transform,a,t.pixelPosMatrix)))}return m}loadMatchingFeature(t,r,n,i,o,a,s,l,u,c,p){let f=this.bucketLayerIDs[r];if(a&&!Il(a,f))return;let y=this.sourceLayerCoder.decode(n),h=this.vtLayers[y].feature(i);if(o.needGeometry){let g=Ne(h,!0);if(!o.filter(new q(this.tileID.overscaledZ),g,this.tileID.canonical))return}else if(!o.filter(new q(this.tileID.overscaledZ),h))return;let d=this.getId(h,y);for(let g=0;g<f.length;g++){let v=f[g];if(a&&a.indexOf(v)<0)continue;let x=l[v];if(!x)continue;let P={};d&&c&&(P=c.getState(x.sourceLayer||"_geojsonTileLayer",d));let b=Pe({},u[v]);b.paint=$p(b.paint,x.paint,h,P,s),b.layout=$p(b.layout,x.layout,h,P,s);let w=!p||p(h,x,P);if(!w)continue;let I=new Xo(h,this.z,this.x,this.y,d);I.layer=b;let E=t[v];E===void 0&&(E=t[v]=[]),E.push({featureIndex:i,feature:I,intersectionZ:w})}}lookupSymbolFeatures(t,r,n,i,o,a,s,l){let u={};this.loadVTLayers();let c=rn(o);for(let p of t)this.loadMatchingFeature(u,n,i,p,c,a,s,l,r);return u}hasLayer(t){for(let r of this.bucketLayerIDs)for(let n of r)if(t===n)return!0;return!1}getId(t,r){let n=t.id;if(this.promoteId){let i=typeof this.promoteId=="string"?this.promoteId:this.promoteId[r];n=t.properties[i],typeof n=="boolean"&&(n=Number(n))}return n}};C("FeatureIndex",Qn,{omit:["rawTileData","sourceLayerCoder"]});function $p(e,t,r,n,i){return Ur(e,(o,a)=>{let s=t instanceof bt?t.get(a):null;return s&&s.evaluate?s.evaluate(r,n,i):s})}function qp(e){let t=1/0,r=1/0,n=-1/0,i=-1/0;for(let o of e)t=Math.min(t,o.x),r=Math.min(r,o.y),n=Math.max(n,o.x),i=Math.max(i,o.y);return{minX:t,minY:r,maxX:n,maxY:i}}function wx(e,t){return t-e}var Zp=J(de(),1);var Qe=class e extends Zp.default{constructor(r,n,i,o){super(r,n);this.angle=i,o!==void 0&&(this.segment=o)}clone(){return new e(this.x,this.y,this.angle,this.segment)}};C("Anchor",Qe);function Ds(e,t,r,n,i){if(t.segment===void 0||r===0)return!0;let o=t,a=t.segment+1,s=0;for(;s>-r/2;){if(a--,a<0)return!1;s-=e[a].dist(o),o=e[a]}s+=e[a].dist(e[a+1]),a++;let l=[],u=0;for(;s<r/2;){let c=e[a-1],p=e[a],f=e[a+1];if(!f)return!1;let y=c.angleTo(p)-p.angleTo(f);for(y=Math.abs((y+3*Math.PI)%(Math.PI*2)-Math.PI),l.push({distance:s,angleDelta:y}),u+=y;s-l[0].distance>n;)u-=l.shift().angleDelta;if(u>i)return!1;a++,s+=p.dist(f)}return!0}function Wp(e){let t=0;for(let r=0;r<e.length-1;r++)t+=e[r].dist(e[r+1]);return t}function Hp(e,t,r){return e?3/5*t*r:0}function Kp(e,t){return Math.max(e?e.right-e.left:0,t?t.right-t.left:0)}function Yp(e,t,r,n,i,o){let a=Hp(r,i,o),s=Kp(r,n)*o,l=0,u=Wp(e)/2;for(let c=0;c<e.length-1;c++){let p=e[c],f=e[c+1],y=p.dist(f);if(l+y>u){let m=(u-l)/y,h=Oe.number(p.x,f.x,m),d=Oe.number(p.y,f.y,m),g=new Qe(h,d,f.angleTo(p),c);return g._round(),!a||Ds(e,g,s,a,t)?g:void 0}l+=y}}function Xp(e,t,r,n,i,o,a,s,l){let u=Hp(n,o,a),c=Kp(n,i),p=c*a,f=e[0].x===0||e[0].x===l||e[0].y===0||e[0].y===l;t-p<t/4&&(t=p+t/4);let y=o*2,m=f?t/2*s%t:(c/2+y)*a*s%t;return Qp(e,m,t,u,r,p,f,!1,l)}function Qp(e,t,r,n,i,o,a,s,l){let u=o/2,c=Wp(e),p=0,f=t-r,y=[];for(let m=0;m<e.length-1;m++){let h=e[m],d=e[m+1],g=h.dist(d),v=d.angleTo(h);for(;f+r<p+g;){f+=r;let x=(f-p)/g,P=Oe.number(h.x,d.x,x),b=Oe.number(h.y,d.y,x);if(P>=0&&P<l&&b>=0&&b<l&&f-u>=0&&f+u<=c){let w=new Qe(P,b,v,m);w._round(),(!n||Ds(e,w,o,n,i))&&y.push(w)}}p+=g}return!s&&!y.length&&!a&&(y=Qp(e,p/2,r,n,i,o,a,!0,l)),y}var ut=J(de(),1);function ef(e,t,r,n,i){let o=[];for(let a=0;a<e.length;a++){let s=e[a],l;for(let u=0;u<s.length-1;u++){let c=s[u],p=s[u+1];c.x<t&&p.x<t||(c.x<t?c=new ut.default(t,c.y+(p.y-c.y)*((t-c.x)/(p.x-c.x)))._round():p.x<t&&(p=new ut.default(t,c.y+(p.y-c.y)*((t-c.x)/(p.x-c.x)))._round()),!(c.y<r&&p.y<r)&&(c.y<r?c=new ut.default(c.x+(p.x-c.x)*((r-c.y)/(p.y-c.y)),r)._round():p.y<r&&(p=new ut.default(c.x+(p.x-c.x)*((r-c.y)/(p.y-c.y)),r)._round()),!(c.x>=n&&p.x>=n)&&(c.x>=n?c=new ut.default(n,c.y+(p.y-c.y)*((n-c.x)/(p.x-c.x)))._round():p.x>=n&&(p=new ut.default(n,c.y+(p.y-c.y)*((n-c.x)/(p.x-c.x)))._round()),!(c.y>=i&&p.y>=i)&&(c.y>=i?c=new ut.default(c.x+(p.x-c.x)*((i-c.y)/(p.y-c.y)),i)._round():p.y>=i&&(p=new ut.default(c.x+(p.x-c.x)*((i-c.y)/(p.y-c.y)),i)._round()),(!l||!c.equals(l[l.length-1]))&&(l=[c],o.push(l)),l.push(p)))))}}return o}var we=J(de(),1);var Fr=xe;function Vs(e,t,r,n){let i=[],o=e.image,a=o.pixelRatio,s=o.paddedRect.w-2*Fr,l=o.paddedRect.h-2*Fr,u=e.right-e.left,c=e.bottom-e.top,p=o.stretchX||[[0,s]],f=o.stretchY||[[0,l]],y=(_,k)=>_+k[1]-k[0],m=p.reduce(y,0),h=f.reduce(y,0),d=s-m,g=l-h,v=0,x=m,P=0,b=h,w=0,I=d,E=0,M=g;if(o.content&&n){let _=o.content;v=Qo(p,0,_[0]),P=Qo(f,0,_[1]),x=Qo(p,_[0],_[2]),b=Qo(f,_[1],_[3]),w=_[0]-v,E=_[1]-P,I=_[2]-_[0]-x,M=_[3]-_[1]-b}let A=(_,k,B,D)=>{let T=ea(_.stretch-v,x,u,e.left),R=ta(_.fixed-w,I,_.stretch,m),U=ea(k.stretch-P,b,c,e.top),K=ta(k.fixed-E,M,k.stretch,h),he=ea(B.stretch-v,x,u,e.left),Y=ta(B.fixed-w,I,B.stretch,m),se=ea(D.stretch-P,b,c,e.top),ce=ta(D.fixed-E,M,D.stretch,h),pe=new we.default(T,U),_e=new we.default(he,U),be=new we.default(he,se),mi=new we.default(T,se),xa=new we.default(R/a,K/a),ba=new we.default(Y/a,ce/a),Br=t*Math.PI/180;if(Br){let Ie=Math.sin(Br),ve=Math.cos(Br),Ve=[ve,-Ie,Ie,ve];pe._matMult(Ve),_e._matMult(Ve),mi._matMult(Ve),be._matMult(Ve)}let hi=_.stretch+_.fixed,Me=B.stretch+B.fixed,Et=k.stretch+k.fixed,di=D.stretch+D.fixed,va={x:o.paddedRect.x+Fr+hi,y:o.paddedRect.y+Fr+Et,w:Me-hi,h:di-Et},Pa=I/a/u,Sa=M/a/c;return{tl:pe,tr:_e,bl:mi,br:be,tex:va,writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:xa,pixelOffsetBR:ba,minFontScaleX:Pa,minFontScaleY:Sa,isSDF:r}};if(!n||!o.stretchX&&!o.stretchY)i.push(A({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:s+1},{fixed:0,stretch:l+1}));else{let _=tf(p,d,m),k=tf(f,g,h);for(let B=0;B<_.length-1;B++){let D=_[B],T=_[B+1];for(let R=0;R<k.length-1;R++){let U=k[R],K=k[R+1];i.push(A(D,U,T,K))}}}return i}function Qo(e,t,r){let n=0;for(let i of e)n+=Math.max(t,Math.min(r,i[1]))-Math.max(t,Math.min(r,i[0]));return n}function tf(e,t,r){let n=[{fixed:-Fr,stretch:0}];for(let[i,o]of e){let a=n[n.length-1];n.push({fixed:i-a.stretch,stretch:a.stretch}),n.push({fixed:i-a.stretch,stretch:a.stretch+(o-i)})}return n.push({fixed:t+Fr,stretch:r}),n}function ea(e,t,r,n){return e/t*r+n}function ta(e,t,r,n){return e-t*r/n}function rf(e,t,r,n,i,o,a,s){let l=n.layout.get("text-rotate").evaluate(o,{})*Math.PI/180,u=[];for(let c of t.positionedLines)for(let p of c.positionedGlyphs){if(!p.rect)continue;let f=p.rect||{},m=Uo+1,h=!0,d=1,g=0,v=(i||s)&&p.vertical,x=p.metrics.advance*p.scale/2;if(s&&t.verticalizable){let Y=(p.scale-1)*ne,se=(ne-p.metrics.width*p.scale)/2;g=c.lineOffset/2-(p.imageName?-se:Y)}if(p.imageName){let Y=a[p.imageName];h=Y.sdf,d=Y.pixelRatio,m=xe/d}let P=i?[p.x+x,p.y]:[0,0],b=i?[0,0]:[p.x+x+r[0],p.y+r[1]-g],w=[0,0];v&&(w=b,b=[0,0]);let I=p.metrics.isDoubleResolution?2:1,E=(p.metrics.left-m)*p.scale-x+b[0],M=(-p.metrics.top-m)*p.scale+b[1],A=E+f.w/I*p.scale/d,_=M+f.h/I*p.scale/d,k=new we.default(E,M),B=new we.default(A,M),D=new we.default(E,_),T=new we.default(A,_);if(v){let Y=new we.default(-x,x-kr),se=-Math.PI/2,ce=ne/2-x,pe=p.imageName?ce:0,_e=new we.default(5-kr-ce,-pe),be=new we.default(...w);k._rotateAround(se,Y)._add(_e)._add(be),B._rotateAround(se,Y)._add(_e)._add(be),D._rotateAround(se,Y)._add(_e)._add(be),T._rotateAround(se,Y)._add(_e)._add(be)}if(l){let Y=Math.sin(l),se=Math.cos(l),ce=[se,-Y,Y,se];k._matMult(ce),B._matMult(ce),D._matMult(ce),T._matMult(ce)}let R=new we.default(0,0),U=new we.default(0,0),K=0,he=0;u.push({tl:k,tr:B,bl:D,br:T,tex:f,writingMode:t.writingMode,glyphOffset:P,sectionIndex:p.sectionIndex,isSDF:h,pixelOffsetTL:R,pixelOffsetBR:U,minFontScaleX:K,minFontScaleY:he})}return u}var ei=J(de(),1),tr=class{constructor(t,r,n,i,o,a,s,l,u,c){if(this.boxStartIndex=t.length,u){let p=a.top,f=a.bottom,y=a.collisionPadding;y&&(p-=y[1],f+=y[3]);let m=f-p;m>0&&(m=Math.max(10,m),this.circleDiameter=m)}else{let p=a.top*s-l[0],f=a.bottom*s+l[2],y=a.left*s-l[3],m=a.right*s+l[1],h=a.collisionPadding;if(h&&(y-=h[0]*s,p-=h[1]*s,m+=h[2]*s,f+=h[3]*s),c){let d=new ei.default(y,p),g=new ei.default(m,p),v=new ei.default(y,f),x=new ei.default(m,f),P=c*Math.PI/180;d._rotate(P),g._rotate(P),v._rotate(P),x._rotate(P),y=Math.min(d.x,g.x,v.x,x.x),m=Math.max(d.x,g.x,v.x,x.x),p=Math.min(d.y,g.y,v.y,x.y),f=Math.max(d.y,g.y,v.y,x.y)}t.emplaceBack(r.x,r.y,y,p,m,f,n,i,o)}this.boxEndIndex=t.length}};var ti=class{constructor(t=[],r=Ax){if(this.data=t,this.length=this.data.length,this.compare=r,this.length>0)for(let n=(this.length>>1)-1;n>=0;n--)this._down(n)}push(t){this.data.push(t),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;let t=this.data[0],r=this.data.pop();return this.length--,this.length>0&&(this.data[0]=r,this._down(0)),t}peek(){return this.data[0]}_up(t){let{data:r,compare:n}=this,i=r[t];for(;t>0;){let o=t-1>>1,a=r[o];if(n(i,a)>=0)break;r[t]=a,t=o}r[t]=i}_down(t){let{data:r,compare:n}=this,i=this.length>>1,o=r[t];for(;t<i;){let a=(t<<1)+1,s=r[a],l=a+1;if(l<this.length&&n(r[l],s)<0&&(a=l,s=r[l]),n(s,o)>=0)break;r[t]=s,t=a}r[t]=o}};function Ax(e,t){return e<t?-1:e>t?1:0}var Bs=J(de(),1);function nf(e,t=1,r=!1){let n=1/0,i=1/0,o=-1/0,a=-1/0,s=e[0];for(let h=0;h<s.length;h++){let d=s[h];(!h||d.x<n)&&(n=d.x),(!h||d.y<i)&&(i=d.y),(!h||d.x>o)&&(o=d.x),(!h||d.y>a)&&(a=d.y)}let l=o-n,u=a-i,c=Math.min(l,u),p=c/2,f=new ti([],_x);if(c===0)return new Bs.default(n,i);for(let h=n;h<o;h+=c)for(let d=i;d<a;d+=c)f.push(new Lr(h+p,d+p,p,e));let y=Tx(e),m=f.length;for(;f.length;){let h=f.pop();(h.d>y.d||!y.d)&&(y=h,r&&console.log("found best %d after %d probes",Math.round(1e4*h.d)/1e4,m)),!(h.max-y.d<=t)&&(p=h.h/2,f.push(new Lr(h.p.x-p,h.p.y-p,p,e)),f.push(new Lr(h.p.x+p,h.p.y-p,p,e)),f.push(new Lr(h.p.x-p,h.p.y+p,p,e)),f.push(new Lr(h.p.x+p,h.p.y+p,p,e)),m+=4)}return r&&(console.log("num probes: ".concat(m)),console.log("best distance: ".concat(y.d))),y.p}function _x(e,t){return t.max-e.max}function Lr(e,t,r,n){this.p=new Bs.default(e,t),this.h=r,this.d=Ix(this.p,n),this.max=this.d+this.h*Math.SQRT2}function Ix(e,t){let r=!1,n=1/0;for(let i=0;i<t.length;i++){let o=t[i];for(let a=0,s=o.length,l=s-1;a<s;l=a++){let u=o[a],c=o[l];u.y>e.y!=c.y>e.y&&e.x<(c.x-u.x)*(e.y-u.y)/(c.y-u.y)+u.x&&(r=!r),n=Math.min(n,ys(e,u,c))}}return(r?1:-1)*Math.sqrt(n)}function Tx(e){let t=0,r=0,n=0,i=e[0];for(let o=0,a=i.length,s=a-1;o<a;s=o++){let l=i[o],u=i[s],c=l.x*u.y-u.x*l.y;r+=(l.x+u.x)*c,n+=(l.y+u.y)*c,t+=c*3}return new Lr(r/t,n/t,0,e)}var Us=J(ss(),1);var zs=(o=>(o[o.center=1]="center",o[o.left=2]="left",o[o.right=3]="right",o[o.top=4]="top",o[o.bottom=5]="bottom",o[o["top-left"]=6]="top-left",o[o["top-right"]=7]="top-right",o[o["bottom-left"]=8]="bottom-left",o[o["bottom-right"]=9]="bottom-right",o))(zs||{}),Ct=7,ra=Number.POSITIVE_INFINITY;function Rs(e,t){function r(i,o){let a=0,s=0;o<0&&(o=0);let l=o/Math.SQRT2;switch(i){case"top-right":case"top-left":s=l-Ct;break;case"bottom-right":case"bottom-left":s=-l+Ct;break;case"bottom":s=-o+Ct;break;case"top":s=o-Ct;break}switch(i){case"top-right":case"bottom-right":a=-l;break;case"top-left":case"bottom-left":a=l;break;case"left":a=o;break;case"right":a=-o;break}return[a,s]}function n(i,o,a){let s=0,l=0;switch(o=Math.abs(o),a=Math.abs(a),i){case"top-right":case"top-left":case"top":l=a-Ct;break;case"bottom-right":case"bottom-left":case"bottom":l=-a+Ct;break}switch(i){case"top-right":case"bottom-right":case"right":s=-o;break;case"top-left":case"bottom-left":case"left":s=o;break}return[s,l]}return t[1]!==ra?n(e,t[0],t[1]):r(e,t[0])}function Os(e,t,r){var a;let n=e.layout,i=(a=n.get("text-variable-anchor-offset"))==null?void 0:a.evaluate(t,{},r);if(i){let s=i.values,l=[];for(let u=0;u<s.length;u+=2){let c=l[u]=s[u],p=s[u+1].map(f=>f*ne);c.startsWith("top")?p[1]-=Ct:c.startsWith("bottom")&&(p[1]+=Ct),l[u+1]=p}return new Ue(l)}let o=n.get("text-variable-anchor");if(o){let s;e._unevaluatedLayout.getValue("text-radial-offset")!==void 0?s=[n.get("text-radial-offset").evaluate(t,{},r)*ne,ra]:s=n.get("text-offset").evaluate(t,{},r).map(c=>c*ne);let u=[];for(let c of o)u.push(c,Rs(c,s));return new Ue(u)}return null}function sf(e){e.bucket.createArrays();let t=512*e.bucket.overscaling;e.bucket.tilePixelRatio=8192/t,e.bucket.compareText={},e.bucket.iconsNeedLinear=!1;let r=e.bucket.layers[0],n=r.layout,i=r._unevaluatedLayout._values,o={layoutIconSize:i["icon-size"].possiblyEvaluate(new q(e.bucket.zoom+1),e.canonical),layoutTextSize:i["text-size"].possiblyEvaluate(new q(e.bucket.zoom+1),e.canonical),textMaxSize:i["text-size"].possiblyEvaluate(new q(18))};if(e.bucket.textSizeData.kind==="composite"){let{minZoom:c,maxZoom:p}=e.bucket.textSizeData;o.compositeTextSizes=[i["text-size"].possiblyEvaluate(new q(c),e.canonical),i["text-size"].possiblyEvaluate(new q(p),e.canonical)]}if(e.bucket.iconSizeData.kind==="composite"){let{minZoom:c,maxZoom:p}=e.bucket.iconSizeData;o.compositeIconSizes=[i["icon-size"].possiblyEvaluate(new q(c),e.canonical),i["icon-size"].possiblyEvaluate(new q(p),e.canonical)]}let a=n.get("text-line-height")*ne,s=n.get("text-rotation-alignment")!=="viewport"&&n.get("symbol-placement")!=="point",l=n.get("text-keep-upright"),u=n.get("text-size");for(let c of e.bucket.features){let p=n.get("text-font").evaluate(c,{},e.canonical).join(","),f=u.evaluate(c,{},e.canonical),y=o.layoutTextSize.evaluate(c,{},e.canonical),m=o.layoutIconSize.evaluate(c,{},e.canonical),h={horizontal:{},vertical:void 0},d=c.text,g=[0,0];if(d){let b=d.toString(),w=n.get("text-letter-spacing").evaluate(c,{},e.canonical)*ne,I=Uu(b)?w:0,E=n.get("text-anchor").evaluate(c,{},e.canonical),M=Os(r,c,e.canonical);if(!M){let D=n.get("text-radial-offset").evaluate(c,{},e.canonical);D?g=Rs(E,[D*ne,ra]):g=n.get("text-offset").evaluate(c,{},e.canonical).map(T=>T*ne)}let A=s?"center":n.get("text-justify").evaluate(c,{},e.canonical),_=n.get("symbol-placement"),k=_==="point"?n.get("text-max-width").evaluate(c,{},e.canonical)*ne:0,B=()=>{e.bucket.allowVerticalPlacement&&on(b)&&(h.vertical=Wn(d,e.glyphMap,e.glyphPositions,e.imagePositions,p,k,a,E,"left",I,g,2,!0,_,y,f))};if(!s&&M){let D=new Set;if(A==="auto")for(let R=0;R<M.values.length;R+=2)D.add(of(M.values[R]));else D.add(A);let T=!1;for(let R of D)if(!h.horizontal[R])if(T)h.horizontal[R]=h.horizontal[0];else{let U=Wn(d,e.glyphMap,e.glyphPositions,e.imagePositions,p,k,a,"center",R,I,g,1,!1,_,y,f);U&&(h.horizontal[R]=U,T=U.positionedLines.length===1)}B()}else{A==="auto"&&(A=of(E));let D=Wn(d,e.glyphMap,e.glyphPositions,e.imagePositions,p,k,a,E,A,I,g,1,!1,_,y,f);D&&(h.horizontal[A]=D),B(),on(b)&&s&&l&&(h.vertical=Wn(d,e.glyphMap,e.glyphPositions,e.imagePositions,p,k,a,E,A,I,g,2,!1,_,y,f))}}let v,x=!1;if(c.icon&&c.icon.name){let b=e.imageMap[c.icon.name];b&&(v=Ep(e.imagePositions[c.icon.name],n.get("icon-offset").evaluate(c,{},e.canonical),n.get("icon-anchor").evaluate(c,{},e.canonical)),x=!!b.sdf,e.bucket.sdfIcons===void 0?e.bucket.sdfIcons=x:e.bucket.sdfIcons!==x&&fe("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(b.pixelRatio!==e.bucket.pixelRatio||n.get("icon-rotate").constantOr(1)!==0)&&(e.bucket.iconsNeedLinear=!0))}let P=lf(h.horizontal)||h.vertical;e.bucket.iconsInText=P?P.iconsInText:!1,(P||v)&&Cx(e.bucket,c,h,v,e.imageMap,o,y,m,g,x,e.canonical)}e.showCollisionBoxes&&e.bucket.generateCollisionDebugBuffers()}function of(e){switch(e){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function Cx(e,t,r,n,i,o,a,s,l,u,c){let p=o.textMaxSize.evaluate(t,{});p===void 0&&(p=a);let f=e.layers[0].layout,y=f.get("icon-offset").evaluate(t,{},c),m=lf(r.horizontal),h=24,d=a/h,g=e.tilePixelRatio*d,v=e.tilePixelRatio*p/h,x=e.tilePixelRatio*s,P=e.tilePixelRatio*f.get("symbol-spacing"),b=f.get("text-padding")*e.tilePixelRatio,w=zp(f,t,c,e.tilePixelRatio),I=f.get("text-max-angle")/180*Math.PI,E=f.get("text-rotation-alignment")!=="viewport"&&f.get("symbol-placement")!=="point",M=f.get("icon-rotation-alignment")==="map"&&f.get("symbol-placement")!=="point",A=f.get("symbol-placement"),_=P/2,k=f.get("icon-text-fit"),B;n&&k!=="none"&&(e.allowVerticalPlacement&&r.vertical&&(B=Es(n,r.vertical,k,f.get("icon-text-fit-padding"),y,d)),m&&(n=Es(n,m,k,f.get("icon-text-fit-padding"),y,d)));let D=(T,R)=>{R.x<0||R.x>=8192||R.y<0||R.y>=8192||Mx(e,R,T,r,n,i,B,e.layers[0],e.collisionBoxArray,t.index,t.sourceLayerIndex,e.index,g,[b,b,b,b],E,l,x,w,M,y,t,o,u,c,a)};if(A==="line")for(let T of ef(t.geometry,0,0,8192,8192)){let R=Xp(T,P,I,r.vertical||m,n,h,v,e.overscaling,8192);for(let U of R){let K=m;(!K||!Ex(e,K.text,_,U))&&D(T,U)}}else if(A==="line-center"){for(let T of t.geometry)if(T.length>1){let R=Yp(T,I,r.vertical||m,n,h,v);R&&D(T,R)}}else if(t.type==="Polygon")for(let T of Sr(t.geometry,0)){let R=nf(T,16);D(T[0],new Qe(R.x,R.y,0))}else if(t.type==="LineString")for(let T of t.geometry)D(T,new Qe(T[0].x,T[0].y,0));else if(t.type==="Point")for(let T of t.geometry)for(let R of T)D([R],new Qe(R.x,R.y,0))}function kx(e,t){let r=e.length,n=t==null?void 0:t.values;if((n==null?void 0:n.length)>0)for(let i=0;i<n.length;i+=2){let o=zs[n[i]],a=n[i+1];e.emplaceBack(o,a[0],a[1])}return[r,e.length]}function af(e,t,r,n,i,o,a,s,l,u,c,p,f,y,m){let h=rf(t,r,s,i,o,a,n,e.allowVerticalPlacement),d=e.textSizeData,g=null;d.kind==="source"?(g=[Tt*i.layout.get("text-size").evaluate(a,{})],g[0]>Xe&&fe("".concat(e.layerIds[0],\': Value for "text-size" is >= \').concat(Mr,\'. Reduce your "text-size".\'))):d.kind==="composite"&&(g=[Tt*y.compositeTextSizes[0].evaluate(a,{},m),Tt*y.compositeTextSizes[1].evaluate(a,{},m)],(g[0]>Xe||g[1]>Xe)&&fe("".concat(e.layerIds[0],\': Value for "text-size" is >= \').concat(Mr,\'. Reduce your "text-size".\'))),e.addSymbols(e.text,h,g,s,o,a,u,t,l.lineStartIndex,l.lineLength,f,m);for(let v of c)p[v]=e.text.placedSymbolArray.length-1;return h.length*4}function lf(e){for(let t in e)return e[t];return null}function Mx(e,t,r,n,i,o,a,s,l,u,c,p,f,y,m,h,d,g,v,x,P,b,w,I,E){let M=e.addToLineVertexArray(t,r),A,_,k,B,D=0,T=0,R=0,U=0,K=-1,he=-1,Y={},se=(0,Us.default)("");if(e.allowVerticalPlacement&&n.vertical){let ve=s.layout.get("text-rotate").evaluate(P,{},I)+90,Ve=n.vertical;k=new tr(l,t,u,c,p,Ve,f,y,m,ve),a&&(B=new tr(l,t,u,c,p,a,d,g,m,ve))}if(i){let Ie=s.layout.get("icon-rotate").evaluate(P,{}),ve=s.layout.get("icon-text-fit")!=="none",Ve=Vs(i,Ie,w,ve),zr=a?Vs(a,Ie,w,ve):void 0;_=new tr(l,t,u,c,p,i,d,g,!1,Ie),D=Ve.length*4;let yl=e.iconSizeData,Ft=null;yl.kind==="source"?(Ft=[Tt*s.layout.get("icon-size").evaluate(P,{})],Ft[0]>Xe&&fe("".concat(e.layerIds[0],\': Value for "icon-size" is >= \').concat(Mr,\'. Reduce your "icon-size".\'))):yl.kind==="composite"&&(Ft=[Tt*b.compositeIconSizes[0].evaluate(P,{},I),Tt*b.compositeIconSizes[1].evaluate(P,{},I)],(Ft[0]>Xe||Ft[1]>Xe)&&fe("".concat(e.layerIds[0],\': Value for "icon-size" is >= \').concat(Mr,\'. Reduce your "icon-size".\'))),e.addSymbols(e.icon,Ve,Ft,x,v,P,0,t,M.lineStartIndex,M.lineLength,-1,I),K=e.icon.placedSymbolArray.length-1,zr&&(T=zr.length*4,e.addSymbols(e.icon,zr,Ft,x,v,P,2,t,M.lineStartIndex,M.lineLength,-1,I),he=e.icon.placedSymbolArray.length-1)}let ce=Object.keys(n.horizontal);for(let Ie of ce){let ve=n.horizontal[Ie];if(!A){se=(0,Us.default)(ve.text);let zr=s.layout.get("text-rotate").evaluate(P,{},I);A=new tr(l,t,u,c,p,ve,f,y,m,zr)}let Ve=ve.positionedLines.length===1;if(R+=af(e,t,ve,o,s,m,P,h,M,n.vertical?1:3,Ve?ce:[Ie],Y,K,b,I),Ve)break}n.vertical&&(U+=af(e,t,n.vertical,o,s,m,P,h,M,2,["vertical"],Y,he,b,I));let pe=A?A.boxStartIndex:e.collisionBoxArray.length,_e=A?A.boxEndIndex:e.collisionBoxArray.length,be=k?k.boxStartIndex:e.collisionBoxArray.length,mi=k?k.boxEndIndex:e.collisionBoxArray.length,xa=_?_.boxStartIndex:e.collisionBoxArray.length,ba=_?_.boxEndIndex:e.collisionBoxArray.length,Br=B?B.boxStartIndex:e.collisionBoxArray.length,hi=B?B.boxEndIndex:e.collisionBoxArray.length,Me=-1,Et=(Ie,ve)=>Ie&&Ie.circleDiameter?Math.max(Ie.circleDiameter,ve):ve;Me=Et(A,Me),Me=Et(k,Me),Me=Et(_,Me),Me=Et(B,Me);let di=Me>-1?1:0;di&&(Me*=E/ne),e.glyphOffsetArray.length>=He.MAX_GLYPHS&&fe("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),P.sortKey!==void 0&&e.addToSortKeyRanges(e.symbolInstances.length,P.sortKey);let va=Os(s,P,I),[Pa,Sa]=kx(e.textAnchorOffsets,va);e.symbolInstances.emplaceBack(t.x,t.y,Y.right>=0?Y.right:-1,Y.center>=0?Y.center:-1,Y.left>=0?Y.left:-1,Y.vertical||-1,K,he,se,pe,_e,be,mi,xa,ba,Br,hi,u,R,U,D,T,di,0,f,Me,Pa,Sa)}function Ex(e,t,r,n){let i=e.compareText;if(!(t in i))i[t]=[];else{let o=i[t];for(let a=o.length-1;a>=0;a--)if(n.dist(o[a])<r)return!0}return i[t].push(n),!1}var na=1,ri=class{constructor(t){let r={},n=[];for(let s in t){let l=t[s],u=r[s]={};for(let c in l){let p=l[+c];if(!p||p.bitmap.width===0||p.bitmap.height===0)continue;let f={x:0,y:0,w:p.bitmap.width+2*na,h:p.bitmap.height+2*na};n.push(f),u[c]={rect:f,metrics:p.metrics}}}let{w:i,h:o}=jn(n),a=new Kt({width:i||1,height:o||1});for(let s in t){let l=t[s];for(let u in l){let c=l[+u];if(!c||c.bitmap.width===0||c.bitmap.height===0)continue;let p=r[s][u].rect;Kt.copy(c.bitmap,a,{x:0,y:0},{x:p.x+na,y:p.y+na},c.bitmap)}}this.image=a,this.positions=r}};C("GlyphAtlas",ri);function cf(e,t,r){t=Math.pow(2,r)-t-1;var n=uf(e*256,t*256,r),i=uf((e+1)*256,(t+1)*256,r);return n[0]+","+n[1]+","+i[0]+","+i[1]}function uf(e,t,r){var n=2*Math.PI*6378137/256/Math.pow(2,r),i=e*n-2*Math.PI*6378137/2,o=t*n-2*Math.PI*6378137/2;return[i,o]}var yf=J(de(),1);var Ns=63710088e-1,ni=class e{constructor(t,r){if(isNaN(t)||isNaN(r))throw new Error("Invalid LngLat object: (".concat(t,", ").concat(r,")"));if(this.lng=+t,this.lat=+r,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new e(wl(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return"LngLat(".concat(this.lng,", ").concat(this.lat,")")}distanceTo(t){let r=Math.PI/180,n=this.lat*r,i=t.lat*r,o=Math.sin(n)*Math.sin(i)+Math.cos(n)*Math.cos(i)*Math.cos((t.lng-this.lng)*r);return Ns*Math.acos(Math.min(o,1))}static convert(t){if(t instanceof e)return t;if(Array.isArray(t)&&(t.length===2||t.length===3))return new e(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&typeof t=="object"&&t!==null)return new e(Number("lng"in t?t.lng:t.lon),Number(t.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}};var pf=2*Math.PI*Ns;function ff(e){return pf*Math.cos(e*Math.PI/180)}function Fx(e){return(180+e)/360}function Lx(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}function Dx(e,t){return e/ff(t)}function Vx(e){return e*360-180}function Gs(e){let t=180-e*360;return 360/Math.PI*Math.atan(Math.exp(t*Math.PI/180))-90}function Bx(e,t){return e*ff(Gs(t))}function zx(e){return 1/Math.cos(e*Math.PI/180)}var ia=class e{constructor(t,r,n=0){this.x=+t,this.y=+r,this.z=+n}static fromLngLat(t,r=0){let n=ni.convert(t);return new e(Fx(n.lng),Lx(n.lat),Dx(r,n.lat))}toLngLat(){return new ni(Vx(this.x),Gs(this.y))}toAltitude(){return Bx(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/pf*zx(Gs(this.y))}};var oa=class{constructor(t,r,n){if(t<0||t>25||n<0||n>=Math.pow(2,t)||r<0||r>=Math.pow(2,t))throw new Error("x=".concat(r,", y=").concat(n,", z=").concat(t," outside of bounds. 0<=x<").concat(Math.pow(2,t),", 0<=y<").concat(Math.pow(2,t)," 0<=z<=25 "));this.z=t,this.x=r,this.y=n,this.key=ii(0,t,t,r,n)}equals(t){return this.z===t.z&&this.x===t.x&&this.y===t.y}url(t,r,n){let i=cf(this.x,this.y,this.z),o=Rx(this.z,this.x,this.y);return t[(this.x+this.y)%t.length].replace(/{prefix}/g,(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(n==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,r>1?"@2x":"").replace(/{quadkey}/g,o).replace(/{bbox-epsg-3857}/g,i)}isChildOf(t){let r=this.z-t.z;return r>0&&t.x===this.x>>r&&t.y===this.y>>r}getTilePoint(t){let r=Math.pow(2,this.z);return new yf.default((t.x*r-this.x)*8192,(t.y*r-this.y)*8192)}toString(){return"".concat(this.z,"/").concat(this.x,"/").concat(this.y)}},$s=class{constructor(t,r){this.wrap=t,this.canonical=r,this.key=ii(t,r.z,r.z,r.x,r.y)}},oi=class e{constructor(t,r,n,i,o){if(t<n)throw new Error("overscaledZ should be >= z; overscaledZ = ".concat(t,"; z = ").concat(n));this.overscaledZ=t,this.wrap=r,this.canonical=new oa(n,+i,+o),this.key=ii(r,t,n,i,o)}clone(){return new e(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(t){return this.overscaledZ===t.overscaledZ&&this.wrap===t.wrap&&this.canonical.equals(t.canonical)}scaledTo(t){if(t>this.overscaledZ)throw new Error("targetZ > this.overscaledZ; targetZ = ".concat(t,"; overscaledZ = ").concat(this.overscaledZ));let r=this.canonical.z-t;return t>this.canonical.z?new e(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new e(t,this.wrap,t,this.canonical.x>>r,this.canonical.y>>r)}calculateScaledKey(t,r){if(t>this.overscaledZ)throw new Error("targetZ > this.overscaledZ; targetZ = ".concat(t,"; overscaledZ = ").concat(this.overscaledZ));let n=this.canonical.z-t;return t>this.canonical.z?ii(this.wrap*+r,t,this.canonical.z,this.canonical.x,this.canonical.y):ii(this.wrap*+r,t,t,this.canonical.x>>n,this.canonical.y>>n)}isChildOf(t){if(t.wrap!==this.wrap)return!1;let r=this.canonical.z-t.canonical.z;return t.overscaledZ===0||t.overscaledZ<this.overscaledZ&&t.canonical.x===this.canonical.x>>r&&t.canonical.y===this.canonical.y>>r}children(t){if(this.overscaledZ>=t)return[new e(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];let r=this.canonical.z+1,n=this.canonical.x*2,i=this.canonical.y*2;return[new e(r,this.wrap,r,n,i),new e(r,this.wrap,r,n+1,i),new e(r,this.wrap,r,n,i+1),new e(r,this.wrap,r,n+1,i+1)]}isLessThan(t){return this.wrap<t.wrap?!0:this.wrap>t.wrap?!1:this.overscaledZ<t.overscaledZ?!0:this.overscaledZ>t.overscaledZ?!1:this.canonical.x<t.canonical.x?!0:this.canonical.x>t.canonical.x?!1:this.canonical.y<t.canonical.y}wrapped(){return new e(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(t){return new e(this.overscaledZ,t,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new $s(this.wrap,this.canonical)}toString(){return"".concat(this.overscaledZ,"/").concat(this.canonical.x,"/").concat(this.canonical.y)}getTilePoint(t){return this.canonical.getTilePoint(new ia(t.x-this.wrap,t.y))}};function ii(e,t,r,n,i){e*=2,e<0&&(e=e*-1-1);let o=1<<r;return(o*o*e+o*i+n).toString(36)+r.toString(36)+t.toString(36)}function Rx(e,t,r){let n="",i;for(let o=e;o>0;o--)i=1<<o-1,n+=(t&i?1:0)+(r&i?2:0);return n}C("CanonicalTileID",oa);C("OverscaledTileID",oi,{omit:["posMatrix"]});var aa=class{constructor(t){this.tileID=new oi(t.tileID.overscaledZ,t.tileID.wrap,t.tileID.canonical.z,t.tileID.canonical.x,t.tileID.canonical.y),this.uid=t.uid,this.zoom=t.zoom,this.pixelRatio=t.pixelRatio,this.tileSize=t.tileSize,this.source=t.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=t.showCollisionBoxes,this.collectResourceTiming=!!t.collectResourceTiming,this.returnDependencies=!!t.returnDependencies,this.promoteId=t.promoteId,this.inFlightDependencies=[]}async parse(t,r,n,i){this.status="parsing",this.data=t,this.collisionBoxArray=new wn;let o=new Er(Object.keys(t.layers).sort()),a=new Qn(this.tileID,this.promoteId);a.bucketLayerIDs=[];let s={},l={featureIndex:a,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:n},u=r.familiesBySource[this.source];for(let b in u){let w=t.layers[b];if(!w)continue;w.version===1&&fe(\'Vector tile source "\'.concat(this.source,\'" layer "\').concat(b,\'" \')+"does not use vector tile spec v2 and therefore may have some rendering errors.");let I=o.encode(b),E=[];for(let M=0;M<w.length;M++){let A=w.feature(M),_=a.getId(A,b);E.push({feature:A,id:_,index:M,sourceLayerIndex:I})}for(let M of u[b]){let A=M[0];if(A.source!==this.source&&fe("layer.source = ".concat(A.source," does not equal this.source = ").concat(this.source)),A.minzoom&&this.zoom<Math.floor(A.minzoom)||A.maxzoom&&this.zoom>=A.maxzoom||A.visibility==="none")continue;qs(M,this.zoom,n),(s[A.id]=A.createBucket({index:a.bucketLayerIDs.length,layers:M,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:I,sourceID:this.source})).populate(E,l,this.tileID.canonical),a.bucketLayerIDs.push(M.map(k=>k.id))}}let c=Ur(l.glyphDependencies,b=>Object.keys(b).map(Number));this.inFlightDependencies.forEach(b=>b==null?void 0:b.abort()),this.inFlightDependencies=[];let p=Promise.resolve({});if(Object.keys(c).length){let b=new AbortController;this.inFlightDependencies.push(b),p=i.sendAsync({type:"GG",data:{stacks:c,source:this.source,tileID:this.tileID,type:"glyphs"}},b)}let f=Object.keys(l.iconDependencies),y=Promise.resolve({});if(f.length){let b=new AbortController;this.inFlightDependencies.push(b),y=i.sendAsync({type:"GI",data:{icons:f,source:this.source,tileID:this.tileID,type:"icons"}},b)}let m=Object.keys(l.patternDependencies),h=Promise.resolve({});if(m.length){let b=new AbortController;this.inFlightDependencies.push(b),h=i.sendAsync({type:"GI",data:{icons:m,source:this.source,tileID:this.tileID,type:"patterns"}},b)}let[d,g,v]=await Promise.all([p,y,h]),x=new ri(d),P=new Jn(g,v);for(let b in s){let w=s[b];w instanceof He?(qs(w.layers,this.zoom,n),sf({bucket:w,glyphMap:d,glyphPositions:x.positions,imageMap:g,imagePositions:P.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):w.hasPattern&&(w instanceof er||w instanceof Xt||w instanceof Qt)&&(qs(w.layers,this.zoom,n),w.addFeatures(l,this.tileID.canonical,P.patternPositions))}return this.status="done",{buckets:Object.values(s).filter(b=>!b.isEmpty()),featureIndex:a,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:x.image,imageAtlas:P,glyphMap:this.returnDependencies?d:null,iconMap:this.returnDependencies?g:null,glyphPositions:this.returnDependencies?x.positions:null}}};function qs(e,t,r){let n=new q(t);for(let i of e)i.recalculate(n,r)}var Ox=60,N_=1e3/Ox;var Dr=class{constructor(t){this._marks={start:[t.url,"start"].join("#"),end:[t.url,"end"].join("#"),measure:t.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let t=performance.getEntriesByName(this._marks.measure);return t.length===0&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),t=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),t}};var Vr=class{constructor(t,r,n){this.actor=t,this.layerIndex=r,this.availableImages=n,this.fetching={},this.loading={},this.loaded={}}async loadVectorTile(t,r){let n=await Du(t.request,r);try{return{vectorTile:new mf.default.VectorTile(new hf.default(n.data)),rawData:n.data,cacheControl:n.cacheControl,expires:n.expires}}catch(i){let o=new Uint8Array(n.data),a=o[0]===31&&o[1]===139,s="Unable to parse the tile at ".concat(t.request.url,", ");throw a?s+="please make sure the data is not gzipped and that you have configured the relevant header in the server":s+="got error: ".concat(i.messge),new Error(s)}}async loadTile(t){let r=t.uid,n=t&&t.request&&t.request.collectResourceTiming?new Dr(t.request):!1,i=new aa(t);this.loading[r]=i;let o=new AbortController;i.abort=o;try{let a=await this.loadVectorTile(t,o);if(delete this.loading[r],!a)return null;let s=a.rawData,l={};a.expires&&(l.expires=a.expires),a.cacheControl&&(l.cacheControl=a.cacheControl);let u={};if(n){let p=n.finish();p&&(u.resourceTiming=JSON.parse(JSON.stringify(p)))}i.vectorTile=a.vectorTile;let c=i.parse(a.vectorTile,this.layerIndex,this.availableImages,this.actor);this.loaded[r]=i,this.fetching[r]={rawTileData:s,cacheControl:l,resourceTiming:u};try{let p=await c;return Pe({rawTileData:s.slice(0)},p,l,u)}finally{delete this.fetching[r]}}catch(a){throw delete this.loading[r],i.status="done",this.loaded[r]=i,a}}async reloadTile(t){let r=t.uid;if(!this.loaded||!this.loaded[r])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");let n=this.loaded[r];if(n.showCollisionBoxes=t.showCollisionBoxes,n.status==="parsing"){let i=await n.parse(n.vectorTile,this.layerIndex,this.availableImages,this.actor),o;if(this.fetching[r]){let{rawTileData:a,cacheControl:s,resourceTiming:l}=this.fetching[r];delete this.fetching[r],o=Pe({rawTileData:a.slice(0)},i,s,l)}else o=i;return o}if(n.status==="done"&&n.vectorTile)return n.parse(n.vectorTile,this.layerIndex,this.availableImages,this.actor)}async abortTile(t){let r=this.loading,n=t.uid;r&&r[n]&&r[n].abort&&(r[n].abort.abort(),delete r[n])}async removeTile(t){this.loaded&&this.loaded[t.uid]&&delete this.loaded[t.uid]}};var ai=class{constructor(t,r,n,i=1,o=1,a=1,s=0){if(this.uid=t,r.height!==r.width)throw new RangeError("DEM tiles must be square");if(n&&!["mapbox","terrarium","custom"].includes(n)){fe(\'"\'.concat(n,\'" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".\'));return}this.stride=r.height;let l=this.dim=r.height-2;switch(this.data=new Uint32Array(r.data.buffer),n){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case"custom":this.redFactor=i,this.greenFactor=o,this.blueFactor=a,this.baseShift=s;break;case"mapbox":default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4;break}for(let u=0;u<l;u++)this.data[this._idx(-1,u)]=this.data[this._idx(0,u)],this.data[this._idx(l,u)]=this.data[this._idx(l-1,u)],this.data[this._idx(u,-1)]=this.data[this._idx(u,0)],this.data[this._idx(u,l)]=this.data[this._idx(u,l-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(l,-1)]=this.data[this._idx(l-1,0)],this.data[this._idx(-1,l)]=this.data[this._idx(0,l-1)],this.data[this._idx(l,l)]=this.data[this._idx(l-1,l-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let u=0;u<l;u++)for(let c=0;c<l;c++){let p=this.get(u,c);p>this.max&&(this.max=p),p<this.min&&(this.min=p)}}get(t,r){let n=new Uint8Array(this.data.buffer),i=this._idx(t,r)*4;return this.unpack(n[i],n[i+1],n[i+2])}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(t,r){if(t<-1||t>=this.dim+1||r<-1||r>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(r+1)*this.stride+(t+1)}unpack(t,r,n){return t*this.redFactor+r*this.greenFactor+n*this.blueFactor-this.baseShift}getPixels(){return new ge({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(t,r,n){if(this.dim!==t.dim)throw new Error("dem dimension mismatch");let i=r*this.dim,o=r*this.dim+this.dim,a=n*this.dim,s=n*this.dim+this.dim;switch(r){case-1:i=o-1;break;case 1:o=i+1;break}switch(n){case-1:a=s-1;break;case 1:s=a+1;break}let l=-r*this.dim,u=-n*this.dim;for(let c=a;c<s;c++)for(let p=i;p<o;p++)this.data[this._idx(p,c)]=t.data[this._idx(p+l,c+u)]}};C("DEMData",ai);var sa=class{constructor(){this.loaded={}}async loadTile(t){let{uid:r,encoding:n,rawImageData:i,redFactor:o,greenFactor:a,blueFactor:s,baseShift:l}=t,u=i.width+2,c=i.height+2,p=Nr(i)?new ge({width:u,height:c},await Cl(i,-1,-1,u,c)):i,f=new ai(r,p,n,o,a,s,l);return this.loaded=this.loaded||{},this.loaded[r]=f,f}removeTile(t){let r=this.loaded,n=t.uid;r&&r[n]&&delete r[n]}};var Gf=J(bf(),1);var js=J(de(),1),vf=J(It(),1);var Ux=vf.default.VectorTileFeature.prototype.toGeoJSON,Js=class{constructor(t){this._feature=t,this.extent=8192,this.type=t.type,this.properties=t.tags,"id"in t&&!isNaN(t.id)&&(this.id=parseInt(t.id,10))}loadGeometry(){if(this._feature.type===1){let t=[];for(let r of this._feature.geometry)t.push([new js.default(r[0],r[1])]);return t}else{let t=[];for(let r of this._feature.geometry){let n=[];for(let i of r)n.push(new js.default(i[0],i[1]));t.push(n)}return t}}toGeoJSON(t,r,n){return Ux.call(this,t,r,n)}},ua=class{constructor(t){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=8192,this.length=t.length,this._features=t}feature(t){return new Js(this._features[t])}};var $f=J(If(),1);var Tf=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],Hs=1,li=8,ci=class e{static from(t){if(!(t instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");let[r,n]=new Uint8Array(t,0,2);if(r!==219)throw new Error("Data does not appear to be in a KDBush format.");let i=n>>4;if(i!==Hs)throw new Error("Got v".concat(i," data when expected v").concat(Hs,"."));let o=Tf[n&15];if(!o)throw new Error("Unrecognized array type.");let[a]=new Uint16Array(t,2,1),[s]=new Uint32Array(t,4,1);return new e(s,a,o,t)}constructor(t,r=64,n=Float64Array,i){if(isNaN(t)||t<0)throw new Error("Unpexpected numItems value: ".concat(t,"."));this.numItems=+t,this.nodeSize=Math.min(Math.max(+r,2),65535),this.ArrayType=n,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;let o=Tf.indexOf(this.ArrayType),a=t*2*this.ArrayType.BYTES_PER_ELEMENT,s=t*this.IndexArrayType.BYTES_PER_ELEMENT,l=(8-s%8)%8;if(o<0)throw new Error("Unexpected typed array class: ".concat(n,"."));i&&i instanceof ArrayBuffer?(this.data=i,this.ids=new this.IndexArrayType(this.data,li,t),this.coords=new this.ArrayType(this.data,li+s+l,t*2),this._pos=t*2,this._finished=!0):(this.data=new ArrayBuffer(li+a+s+l),this.ids=new this.IndexArrayType(this.data,li,t),this.coords=new this.ArrayType(this.data,li+s+l,t*2),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,(Hs<<4)+o]),new Uint16Array(this.data,2,1)[0]=r,new Uint32Array(this.data,4,1)[0]=t)}add(t,r){let n=this._pos>>1;return this.ids[n]=n,this.coords[this._pos++]=t,this.coords[this._pos++]=r,n}finish(){let t=this._pos>>1;if(t!==this.numItems)throw new Error("Added ".concat(t," items when expected ").concat(this.numItems,"."));return Ys(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,r,n,i){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");let{ids:o,coords:a,nodeSize:s}=this,l=[0,o.length-1,0],u=[];for(;l.length;){let c=l.pop()||0,p=l.pop()||0,f=l.pop()||0;if(p-f<=s){for(let d=f;d<=p;d++){let g=a[2*d],v=a[2*d+1];g>=t&&g<=n&&v>=r&&v<=i&&u.push(o[d])}continue}let y=f+p>>1,m=a[2*y],h=a[2*y+1];m>=t&&m<=n&&h>=r&&h<=i&&u.push(o[y]),(c===0?t<=m:r<=h)&&(l.push(f),l.push(y-1),l.push(1-c)),(c===0?n>=m:i>=h)&&(l.push(y+1),l.push(p),l.push(1-c))}return u}within(t,r,n){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");let{ids:i,coords:o,nodeSize:a}=this,s=[0,i.length-1,0],l=[],u=n*n;for(;s.length;){let c=s.pop()||0,p=s.pop()||0,f=s.pop()||0;if(p-f<=a){for(let d=f;d<=p;d++)Cf(o[2*d],o[2*d+1],t,r)<=u&&l.push(i[d]);continue}let y=f+p>>1,m=o[2*y],h=o[2*y+1];Cf(m,h,t,r)<=u&&l.push(i[y]),(c===0?t-n<=m:r-n<=h)&&(s.push(f),s.push(y-1),s.push(1-c)),(c===0?t+n>=m:r+n>=h)&&(s.push(y+1),s.push(p),s.push(1-c))}return l}};function Ys(e,t,r,n,i,o){if(i-n<=r)return;let a=n+i>>1;kf(e,t,a,n,i,o),Ys(e,t,r,n,a-1,1-o),Ys(e,t,r,a+1,i,1-o)}function kf(e,t,r,n,i,o){for(;i>n;){if(i-n>600){let u=i-n+1,c=r-n+1,p=Math.log(u),f=.5*Math.exp(2*p/3),y=.5*Math.sqrt(p*f*(u-f)/u)*(c-u/2<0?-1:1),m=Math.max(n,Math.floor(r-c*f/u+y)),h=Math.min(i,Math.floor(r+(u-c)*f/u+y));kf(e,t,r,m,h,o)}let a=t[2*r+o],s=n,l=i;for(ui(e,t,n,r),t[2*i+o]>a&&ui(e,t,n,i);s<l;){for(ui(e,t,s,l),s++,l--;t[2*s+o]<a;)s++;for(;t[2*l+o]>a;)l--}t[2*n+o]===a?ui(e,t,n,l):(l++,ui(e,t,l,i)),l<=r&&(n=l+1),r<=l&&(i=l-1)}}function ui(e,t,r,n){Ks(e,r,n),Ks(t,2*r,2*n),Ks(t,2*r+1,2*n+1)}function Ks(e,t,r){let n=e[t];e[t]=e[r],e[r]=n}function Cf(e,t,r,n){let i=e-r,o=t-n;return i*i+o*o}var Yx={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:e=>e},Mf=Math.fround||(e=>t=>(e[0]=+t,e[0]))(new Float32Array(1)),rr=2,Mt=3,Xs=4,kt=5,Ff=6,pi=class{constructor(t){this.options=Object.assign(Object.create(Yx),t),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(t){let{log:r,minZoom:n,maxZoom:i}=this.options;r&&console.time("total time");let o="prepare ".concat(t.length," points");r&&console.time(o),this.points=t;let a=[];for(let l=0;l<t.length;l++){let u=t[l];if(!u.geometry)continue;let[c,p]=u.geometry.coordinates,f=Mf(pa(c)),y=Mf(fa(p));a.push(f,y,1/0,l,-1,1),this.options.reduce&&a.push(0)}let s=this.trees[i+1]=this._createTree(a);r&&console.timeEnd(o);for(let l=i;l>=n;l--){let u=+Date.now();s=this.trees[l]=this._createTree(this._cluster(s,l)),r&&console.log("z%d: %d clusters in %dms",l,s.numItems,+Date.now()-u)}return r&&console.timeEnd("total time"),this}getClusters(t,r){let n=((t[0]+180)%360+360)%360-180,i=Math.max(-90,Math.min(90,t[1])),o=t[2]===180?180:((t[2]+180)%360+360)%360-180,a=Math.max(-90,Math.min(90,t[3]));if(t[2]-t[0]>=360)n=-180,o=180;else if(n>o){let p=this.getClusters([n,i,180,a],r),f=this.getClusters([-180,i,o,a],r);return p.concat(f)}let s=this.trees[this._limitZoom(r)],l=s.range(pa(n),fa(a),pa(o),fa(i)),u=s.data,c=[];for(let p of l){let f=this.stride*p;c.push(u[f+kt]>1?Ef(u,f,this.clusterProps):this.points[u[f+Mt]])}return c}getChildren(t){let r=this._getOriginId(t),n=this._getOriginZoom(t),i="No cluster with the specified id.",o=this.trees[n];if(!o)throw new Error(i);let a=o.data;if(r*this.stride>=a.length)throw new Error(i);let s=this.options.radius/(this.options.extent*Math.pow(2,n-1)),l=a[r*this.stride],u=a[r*this.stride+1],c=o.within(l,u,s),p=[];for(let f of c){let y=f*this.stride;a[y+Xs]===t&&p.push(a[y+kt]>1?Ef(a,y,this.clusterProps):this.points[a[y+Mt]])}if(p.length===0)throw new Error(i);return p}getLeaves(t,r,n){r=r||10,n=n||0;let i=[];return this._appendLeaves(i,t,r,n,0),i}getTile(t,r,n){let i=this.trees[this._limitZoom(t)],o=Math.pow(2,t),{extent:a,radius:s}=this.options,l=s/a,u=(n-l)/o,c=(n+1+l)/o,p={features:[]};return this._addTileFeatures(i.range((r-l)/o,u,(r+1+l)/o,c),i.data,r,n,o,p),r===0&&this._addTileFeatures(i.range(1-l/o,u,1,c),i.data,o,n,o,p),r===o-1&&this._addTileFeatures(i.range(0,u,l/o,c),i.data,-1,n,o,p),p.features.length?p:null}getClusterExpansionZoom(t){let r=this._getOriginZoom(t)-1;for(;r<=this.options.maxZoom;){let n=this.getChildren(t);if(r++,n.length!==1)break;t=n[0].properties.cluster_id}return r}_appendLeaves(t,r,n,i,o){let a=this.getChildren(r);for(let s of a){let l=s.properties;if(l&&l.cluster?o+l.point_count<=i?o+=l.point_count:o=this._appendLeaves(t,l.cluster_id,n,i,o):o<i?o++:t.push(s),t.length===n)break}return o}_createTree(t){let r=new ci(t.length/this.stride|0,this.options.nodeSize,Float32Array);for(let n=0;n<t.length;n+=this.stride)r.add(t[n],t[n+1]);return r.finish(),r.data=t,r}_addTileFeatures(t,r,n,i,o,a){for(let s of t){let l=s*this.stride,u=r[l+kt]>1,c,p,f;if(u)c=Lf(r,l,this.clusterProps),p=r[l],f=r[l+1];else{let h=this.points[r[l+Mt]];c=h.properties;let[d,g]=h.geometry.coordinates;p=pa(d),f=fa(g)}let y={type:1,geometry:[[Math.round(this.options.extent*(p*o-n)),Math.round(this.options.extent*(f*o-i))]],tags:c},m;u||this.options.generateId?m=r[l+Mt]:m=this.points[r[l+Mt]].id,m!==void 0&&(y.id=m),a.features.push(y)}}_limitZoom(t){return Math.max(this.options.minZoom,Math.min(Math.floor(+t),this.options.maxZoom+1))}_cluster(t,r){let{radius:n,extent:i,reduce:o,minPoints:a}=this.options,s=n/(i*Math.pow(2,r)),l=t.data,u=[],c=this.stride;for(let p=0;p<l.length;p+=c){if(l[p+rr]<=r)continue;l[p+rr]=r;let f=l[p],y=l[p+1],m=t.within(l[p],l[p+1],s),h=l[p+kt],d=h;for(let g of m){let v=g*c;l[v+rr]>r&&(d+=l[v+kt])}if(d>h&&d>=a){let g=f*h,v=y*h,x,P=-1,b=((p/c|0)<<5)+(r+1)+this.points.length;for(let w of m){let I=w*c;if(l[I+rr]<=r)continue;l[I+rr]=r;let E=l[I+kt];g+=l[I]*E,v+=l[I+1]*E,l[I+Xs]=b,o&&(x||(x=this._map(l,p,!0),P=this.clusterProps.length,this.clusterProps.push(x)),o(x,this._map(l,I)))}l[p+Xs]=b,u.push(g/d,v/d,1/0,b,-1,d),o&&u.push(P)}else{for(let g=0;g<c;g++)u.push(l[p+g]);if(d>1)for(let g of m){let v=g*c;if(!(l[v+rr]<=r)){l[v+rr]=r;for(let x=0;x<c;x++)u.push(l[v+x])}}}}return u}_getOriginId(t){return t-this.points.length>>5}_getOriginZoom(t){return(t-this.points.length)%32}_map(t,r,n){if(t[r+kt]>1){let a=this.clusterProps[t[r+Ff]];return n?Object.assign({},a):a}let i=this.points[t[r+Mt]].properties,o=this.options.map(i);return n&&o===i?Object.assign({},o):o}};function Ef(e,t,r){return{type:"Feature",id:e[t+Mt],properties:Lf(e,t,r),geometry:{type:"Point",coordinates:[Xx(e[t]),Qx(e[t+1])]}}}function Lf(e,t,r){let n=e[t+kt],i=n>=1e4?"".concat(Math.round(n/1e3),"k"):n>=1e3?"".concat(Math.round(n/100)/10,"k"):n,o=e[t+Ff],a=o===-1?{}:Object.assign({},r[o]);return Object.assign(a,{cluster:!0,cluster_id:e[t+Mt],point_count:n,point_count_abbreviated:i})}function pa(e){return e/360+.5}function fa(e){let t=Math.sin(e*Math.PI/180),r=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return r<0?0:r>1?1:r}function Xx(e){return(e-.5)*360}function Qx(e){let t=(180-e*360)*Math.PI/180;return 360*Math.atan(Math.exp(t))/Math.PI-90}function fi(e,t,r,n){for(var i=n,o=r-t>>1,a=r-t,s,l=e[t],u=e[t+1],c=e[r],p=e[r+1],f=t+3;f<r;f+=3){var y=eb(e[f],e[f+1],l,u,c,p);if(y>i)s=f,i=y;else if(y===i){var m=Math.abs(f-o);m<a&&(s=f,a=m)}}i>n&&(s-t>3&&fi(e,t,s,n),e[s+2]=i,r-s>3&&fi(e,s,r,n))}function eb(e,t,r,n,i,o){var a=i-r,s=o-n;if(a!==0||s!==0){var l=((e-r)*a+(t-n)*s)/(a*a+s*s);l>1?(r=i,n=o):l>0&&(r+=a*l,n+=s*l)}return a=e-r,s=t-n,a*a+s*s}function ct(e,t,r,n){var i={id:typeof e>"u"?null:e,type:t,geometry:r,tags:n,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return tb(i),i}function tb(e){var t=e.geometry,r=e.type;if(r==="Point"||r==="MultiPoint"||r==="LineString")Qs(e,t);else if(r==="Polygon"||r==="MultiLineString")for(var n=0;n<t.length;n++)Qs(e,t[n]);else if(r==="MultiPolygon")for(n=0;n<t.length;n++)for(var i=0;i<t[n].length;i++)Qs(e,t[n][i])}function Qs(e,t){for(var r=0;r<t.length;r+=3)e.minX=Math.min(e.minX,t[r]),e.minY=Math.min(e.minY,t[r+1]),e.maxX=Math.max(e.maxX,t[r]),e.maxY=Math.max(e.maxY,t[r+1])}function rl(e,t){var r=[];if(e.type==="FeatureCollection")for(var n=0;n<e.features.length;n++)ya(r,e.features[n],t,n);else e.type==="Feature"?ya(r,e,t):ya(r,{geometry:e},t);return r}function ya(e,t,r,n){if(t.geometry){var i=t.geometry.coordinates,o=t.geometry.type,a=Math.pow(r.tolerance/((1<<r.maxZoom)*r.extent),2),s=[],l=t.id;if(r.promoteId?l=t.properties[r.promoteId]:r.generateId&&(l=n||0),o==="Point")Df(i,s);else if(o==="MultiPoint")for(var u=0;u<i.length;u++)Df(i[u],s);else if(o==="LineString")tl(i,s,a,!1);else if(o==="MultiLineString")if(r.lineMetrics){for(u=0;u<i.length;u++)s=[],tl(i[u],s,a,!1),e.push(ct(l,"LineString",s,t.properties));return}else el(i,s,a,!1);else if(o==="Polygon")el(i,s,a,!0);else if(o==="MultiPolygon")for(u=0;u<i.length;u++){var c=[];el(i[u],c,a,!0),s.push(c)}else if(o==="GeometryCollection"){for(u=0;u<t.geometry.geometries.length;u++)ya(e,{id:l,geometry:t.geometry.geometries[u],properties:t.properties},r,n);return}else throw new Error("Input data is not a valid GeoJSON object.");e.push(ct(l,o,s,t.properties))}}function Df(e,t){t.push(Vf(e[0])),t.push(Bf(e[1])),t.push(0)}function tl(e,t,r,n){for(var i,o,a=0,s=0;s<e.length;s++){var l=Vf(e[s][0]),u=Bf(e[s][1]);t.push(l),t.push(u),t.push(0),s>0&&(n?a+=(i*u-l*o)/2:a+=Math.sqrt(Math.pow(l-i,2)+Math.pow(u-o,2))),i=l,o=u}var c=t.length-3;t[2]=1,fi(t,0,c,r),t[c+2]=1,t.size=Math.abs(a),t.start=0,t.end=t.size}function el(e,t,r,n){for(var i=0;i<e.length;i++){var o=[];tl(e[i],o,r,n),t.push(o)}}function Vf(e){return e/360+.5}function Bf(e){var t=Math.sin(e*Math.PI/180),r=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return r<0?0:r>1?1:r}function $e(e,t,r,n,i,o,a,s){if(r/=t,n/=t,o>=r&&a<n)return e;if(a<r||o>=n)return null;for(var l=[],u=0;u<e.length;u++){var c=e[u],p=c.geometry,f=c.type,y=i===0?c.minX:c.minY,m=i===0?c.maxX:c.maxY;if(y>=r&&m<n){l.push(c);continue}else if(m<r||y>=n)continue;var h=[];if(f==="Point"||f==="MultiPoint")rb(p,h,r,n,i);else if(f==="LineString")Rf(p,h,r,n,i,!1,s.lineMetrics);else if(f==="MultiLineString")nl(p,h,r,n,i,!1);else if(f==="Polygon")nl(p,h,r,n,i,!0);else if(f==="MultiPolygon")for(var d=0;d<p.length;d++){var g=[];nl(p[d],g,r,n,i,!0),g.length&&h.push(g)}if(h.length){if(s.lineMetrics&&f==="LineString"){for(d=0;d<h.length;d++)l.push(ct(c.id,f,h[d],c.tags));continue}(f==="LineString"||f==="MultiLineString")&&(h.length===1?(f="LineString",h=h[0]):f="MultiLineString"),(f==="Point"||f==="MultiPoint")&&(f=h.length===3?"Point":"MultiPoint"),l.push(ct(c.id,f,h,c.tags))}}return l.length?l:null}function rb(e,t,r,n,i){for(var o=0;o<e.length;o+=3){var a=e[o+i];a>=r&&a<=n&&(t.push(e[o]),t.push(e[o+1]),t.push(e[o+2]))}}function Rf(e,t,r,n,i,o,a){for(var s=zf(e),l=i===0?nb:ib,u=e.start,c,p,f=0;f<e.length-3;f+=3){var y=e[f],m=e[f+1],h=e[f+2],d=e[f+3],g=e[f+4],v=i===0?y:m,x=i===0?d:g,P=!1;a&&(c=Math.sqrt(Math.pow(y-d,2)+Math.pow(m-g,2))),v<r?x>r&&(p=l(s,y,m,d,g,r),a&&(s.start=u+c*p)):v>n?x<n&&(p=l(s,y,m,d,g,n),a&&(s.start=u+c*p)):il(s,y,m,h),x<r&&v>=r&&(p=l(s,y,m,d,g,r),P=!0),x>n&&v<=n&&(p=l(s,y,m,d,g,n),P=!0),!o&&P&&(a&&(s.end=u+c*p),t.push(s),s=zf(e)),a&&(u+=c)}var b=e.length-3;y=e[b],m=e[b+1],h=e[b+2],v=i===0?y:m,v>=r&&v<=n&&il(s,y,m,h),b=s.length-3,o&&b>=3&&(s[b]!==s[0]||s[b+1]!==s[1])&&il(s,s[0],s[1],s[2]),s.length&&t.push(s)}function zf(e){var t=[];return t.size=e.size,t.start=e.start,t.end=e.end,t}function nl(e,t,r,n,i,o){for(var a=0;a<e.length;a++)Rf(e[a],t,r,n,i,o,!1)}function il(e,t,r,n){e.push(t),e.push(r),e.push(n)}function nb(e,t,r,n,i,o){var a=(o-t)/(n-t);return e.push(o),e.push(r+(i-r)*a),e.push(1),a}function ib(e,t,r,n,i,o){var a=(o-r)/(i-r);return e.push(t+(n-t)*a),e.push(o),e.push(1),a}function al(e,t){var r=t.buffer/t.extent,n=e,i=$e(e,1,-1-r,r,0,-1,2,t),o=$e(e,1,1-r,2+r,0,-1,2,t);return(i||o)&&(n=$e(e,1,-r,1+r,0,-1,2,t)||[],i&&(n=Of(i,1).concat(n)),o&&(n=n.concat(Of(o,-1)))),n}function Of(e,t){for(var r=[],n=0;n<e.length;n++){var i=e[n],o=i.type,a;if(o==="Point"||o==="MultiPoint"||o==="LineString")a=ol(i.geometry,t);else if(o==="MultiLineString"||o==="Polygon"){a=[];for(var s=0;s<i.geometry.length;s++)a.push(ol(i.geometry[s],t))}else if(o==="MultiPolygon")for(a=[],s=0;s<i.geometry.length;s++){for(var l=[],u=0;u<i.geometry[s].length;u++)l.push(ol(i.geometry[s][u],t));a.push(l)}r.push(ct(i.id,o,a,i.tags))}return r}function ol(e,t){var r=[];r.size=e.size,e.start!==void 0&&(r.start=e.start,r.end=e.end);for(var n=0;n<e.length;n+=3)r.push(e[n]+t,e[n+1],e[n+2]);return r}function ma(e,t){if(e.transformed)return e;var r=1<<e.z,n=e.x,i=e.y,o,a,s;for(o=0;o<e.features.length;o++){var l=e.features[o],u=l.geometry,c=l.type;if(l.geometry=[],c===1)for(a=0;a<u.length;a+=2)l.geometry.push(Uf(u[a],u[a+1],t,r,n,i));else for(a=0;a<u.length;a++){var p=[];for(s=0;s<u[a].length;s+=2)p.push(Uf(u[a][s],u[a][s+1],t,r,n,i));l.geometry.push(p)}}return e.transformed=!0,e}function Uf(e,t,r,n,i,o){return[Math.round(r*(e*n-i)),Math.round(r*(t*n-o))]}function ll(e,t,r,n,i){for(var o=t===i.maxZoom?0:i.tolerance/((1<<t)*i.extent),a={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:r,y:n,z:t,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0},s=0;s<e.length;s++){a.numFeatures++,ob(a,e[s],o,i);var l=e[s].minX,u=e[s].minY,c=e[s].maxX,p=e[s].maxY;l<a.minX&&(a.minX=l),u<a.minY&&(a.minY=u),c>a.maxX&&(a.maxX=c),p>a.maxY&&(a.maxY=p)}return a}function ob(e,t,r,n){var i=t.geometry,o=t.type,a=[];if(o==="Point"||o==="MultiPoint")for(var s=0;s<i.length;s+=3)a.push(i[s]),a.push(i[s+1]),e.numPoints++,e.numSimplified++;else if(o==="LineString")sl(a,i,e,r,!1,!1);else if(o==="MultiLineString"||o==="Polygon")for(s=0;s<i.length;s++)sl(a,i[s],e,r,o==="Polygon",s===0);else if(o==="MultiPolygon")for(var l=0;l<i.length;l++){var u=i[l];for(s=0;s<u.length;s++)sl(a,u[s],e,r,!0,s===0)}if(a.length){var c=t.tags||null;if(o==="LineString"&&n.lineMetrics){c={};for(var p in t.tags)c[p]=t.tags[p];c.mapbox_clip_start=i.start/i.size,c.mapbox_clip_end=i.end/i.size}var f={geometry:a,type:o==="Polygon"||o==="MultiPolygon"?3:o==="LineString"||o==="MultiLineString"?2:1,tags:c};t.id!==null&&(f.id=t.id),e.features.push(f)}}function sl(e,t,r,n,i,o){var a=n*n;if(n>0&&t.size<(i?a:n)){r.numPoints+=t.length/3;return}for(var s=[],l=0;l<t.length;l+=3)(n===0||t[l+2]>a)&&(r.numSimplified++,s.push(t[l]),s.push(t[l+1])),r.numPoints++;i&&ab(s,o),e.push(s)}function ab(e,t){for(var r=0,n=0,i=e.length,o=i-2;n<i;o=n,n+=2)r+=(e[n]-e[o])*(e[n+1]+e[o+1]);if(r>0===t)for(n=0,i=e.length;n<i/2;n+=2){var a=e[n],s=e[n+1];e[n]=e[i-2-n],e[n+1]=e[i-1-n],e[i-2-n]=a,e[i-1-n]=s}}function cl(e,t){return new ha(e,t)}function ha(e,t){t=this.options=sb(Object.create(this.options),t);var r=t.debug;if(r&&console.time("preprocess data"),t.maxZoom<0||t.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(t.promoteId&&t.generateId)throw new Error("promoteId and generateId cannot be used together.");var n=rl(e,t);this.tiles={},this.tileCoords=[],r&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",t.indexMaxZoom,t.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),n=al(n,t),n.length&&this.splitTile(n,0,0,0),r&&(n.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)))}ha.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};ha.prototype.splitTile=function(e,t,r,n,i,o,a){for(var s=[e,t,r,n],l=this.options,u=l.debug;s.length;){n=s.pop(),r=s.pop(),t=s.pop(),e=s.pop();var c=1<<t,p=ul(t,r,n),f=this.tiles[p];if(!f&&(u>1&&console.time("creation"),f=this.tiles[p]=ll(e,t,r,n,l),this.tileCoords.push({z:t,x:r,y:n}),u)){u>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",t,r,n,f.numFeatures,f.numPoints,f.numSimplified),console.timeEnd("creation"));var y="z"+t;this.stats[y]=(this.stats[y]||0)+1,this.total++}if(f.source=e,i){if(t===l.maxZoom||t===i)continue;var m=1<<i-t;if(r!==Math.floor(o/m)||n!==Math.floor(a/m))continue}else if(t===l.indexMaxZoom||f.numPoints<=l.indexMaxPoints)continue;if(f.source=null,e.length!==0){u>1&&console.time("clipping");var h=.5*l.buffer/l.extent,d=.5-h,g=.5+h,v=1+h,x,P,b,w,I,E;x=P=b=w=null,I=$e(e,c,r-h,r+g,0,f.minX,f.maxX,l),E=$e(e,c,r+d,r+v,0,f.minX,f.maxX,l),e=null,I&&(x=$e(I,c,n-h,n+g,1,f.minY,f.maxY,l),P=$e(I,c,n+d,n+v,1,f.minY,f.maxY,l),I=null),E&&(b=$e(E,c,n-h,n+g,1,f.minY,f.maxY,l),w=$e(E,c,n+d,n+v,1,f.minY,f.maxY,l),E=null),u>1&&console.timeEnd("clipping"),s.push(x||[],t+1,r*2,n*2),s.push(P||[],t+1,r*2,n*2+1),s.push(b||[],t+1,r*2+1,n*2),s.push(w||[],t+1,r*2+1,n*2+1)}}};ha.prototype.getTile=function(e,t,r){var n=this.options,i=n.extent,o=n.debug;if(e<0||e>24)return null;var a=1<<e;t=(t%a+a)%a;var s=ul(e,t,r);if(this.tiles[s])return ma(this.tiles[s],i);o>1&&console.log("drilling down to z%d-%d-%d",e,t,r);for(var l=e,u=t,c=r,p;!p&&l>0;)l--,u=Math.floor(u/2),c=Math.floor(c/2),p=this.tiles[ul(l,u,c)];return!p||!p.source?null:(o>1&&console.log("found parent tile z%d-%d-%d",l,u,c),o>1&&console.time("drilling down"),this.splitTile(p.source,l,u,c,e,t,r),o>1&&console.timeEnd("drilling down"),this.tiles[s]?ma(this.tiles[s],i):null)};function ul(e,t,r){return((1<<e)*r+t)*32+e}function sb(e,t){for(var r in t)e[r]=t[r];return e}function yi(e,t){return t?e.properties[t]:e.id}function pl(e,t){if(e==null)return!0;if(e.type==="Feature")return yi(e,t)!=null;if(e.type==="FeatureCollection"){let r=new Set;for(let n of e.features){let i=yi(n,t);if(i==null||r.has(i))return!1;r.add(i)}return!0}return!1}function fl(e,t){let r=new Map;if(e!=null)if(e.type==="Feature")r.set(yi(e,t),e);else for(let n of e.features)r.set(yi(n,t),n);return r}function Nf(e,t,r){var n,i,o,a;if(t.removeAll&&e.clear(),t.remove)for(let s of t.remove)e.delete(s);if(t.add)for(let s of t.add){let l=yi(s,r);l!=null&&e.set(l,s)}if(t.update)for(let s of t.update){let l=e.get(s.id);if(l==null)continue;let u=s.newGeometry||s.removeAllProperties,c=!s.removeAllProperties&&(((n=s.removeProperties)==null?void 0:n.length)>0||((i=s.addOrUpdateProperties)==null?void 0:i.length)>0);if((u||c)&&(l={...l},e.set(s.id,l),c&&(l.properties={...l.properties})),s.newGeometry&&(l.geometry=s.newGeometry),s.removeAllProperties)l.properties={};else if(((o=s.removeProperties)==null?void 0:o.length)>0)for(let p of s.removeProperties)Object.prototype.hasOwnProperty.call(l.properties,p)&&delete l.properties[p];if(((a=s.addOrUpdateProperties)==null?void 0:a.length)>0)for(let{key:p,value:f}of s.addOrUpdateProperties)l.properties[p]=f}}var da=class extends Vr{constructor(){super(...arguments);this._dataUpdateable=new Map}async loadVectorTile(r,n){let i=r.tileID.canonical;if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");let o=this._geoJSONIndex.getTile(i.z,i.x,i.y);if(!o)return null;let a=new ua(o.features),s=(0,$f.default)(a);return(s.byteOffset!==0||s.byteLength!==s.buffer.byteLength)&&(s=new Uint8Array(s)),{vectorTile:a,rawData:s.buffer}}async loadData(r){var i;(i=this._pendingRequest)==null||i.abort();let n=r&&r.request&&r.request.collectResourceTiming?new Dr(r.request):!1;this._pendingRequest=new AbortController;try{let o=await this.loadGeoJSON(r,this._pendingRequest);if(delete this._pendingRequest,typeof o!="object")throw new Error("Input data given to \'".concat(r.source,"\' is not a valid GeoJSON object."));if((0,Gf.default)(o,!0),r.filter){let s=Nt(r.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(s.result==="error")throw new Error(s.value.map(u=>"".concat(u.key,": ").concat(u.message)).join(", "));o={type:"FeatureCollection",features:o.features.filter(u=>s.value.evaluate({zoom:0},u))}}this._geoJSONIndex=r.cluster?new pi(lb(r)).load(o.features):cl(o,r.geojsonVtOptions),this.loaded={};let a={};if(n){let s=n.finish();s&&(a.resourceTiming={},a.resourceTiming[r.source]=JSON.parse(JSON.stringify(s)))}return a}catch(o){if(delete this._pendingRequest,_u(o))return{abandoned:!0};throw o}}reloadTile(r){let n=this.loaded,i=r.uid;return n&&n[i]?super.reloadTile(r):this.loadTile(r)}async loadGeoJSON(r,n){let{promoteId:i}=r;if(r.request){let o=await Lu(r.request,n);return this._dataUpdateable=pl(o.data,i)?fl(o.data,i):void 0,o.data}if(typeof r.data=="string")try{let o=JSON.parse(r.data);return this._dataUpdateable=pl(o,i)?fl(o,i):void 0,o}catch{throw new Error("Input data given to \'".concat(r.source,"\' is not a valid GeoJSON object."))}if(!r.dataDiff)throw new Error("Input data given to \'".concat(r.source,"\' is not a valid GeoJSON object."));if(!this._dataUpdateable)throw new Error("Cannot update existing geojson data in ".concat(r.source));return Nf(this._dataUpdateable,r.dataDiff,i),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}}async removeSource(r){this._pendingRequest&&this._pendingRequest.abort()}getClusterExpansionZoom(r){return this._geoJSONIndex.getClusterExpansionZoom(r.clusterId)}getClusterChildren(r){return this._geoJSONIndex.getChildren(r.clusterId)}getClusterLeaves(r){return this._geoJSONIndex.getLeaves(r.clusterId,r.limit,r.offset)}};function lb({superclusterOptions:e,clusterProperties:t}){if(!t||!e)return e;let r={},n={},i={accumulated:null,zoom:0},o={properties:null},a=Object.keys(t);for(let s of a){let[l,u]=t[s],c=Nt(u),p=Nt(typeof l=="string"?[l,["accumulated"],["get",s]]:l);r[s]=c.value,n[s]=p.value}return e.map=s=>{o.properties=s;let l={};for(let u of a)l[u]=r[u].evaluate(i,o);return l},e.reduce=(s,l)=>{o.properties=l;for(let u of a)i.accumulated=s[u],s[u]=n[u].evaluate(i,o)},e}var ga=class{constructor(t){this.self=t,this.actor=new Gi(t),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(r,n)=>{if(this.externalWorkerSourceTypes[r])throw new Error(\'Worker source with name "\'.concat(r,\'" already registered.\'));this.externalWorkerSourceTypes[r]=n},this.self.addProtocol=Tu,this.self.removeProtocol=Cu,this.self.registerRTLTextPlugin=r=>{if(ye.isParsed())throw new Error("RTL text plugin already registered.");ye.setMethods(r)},this.actor.registerMessageHandler("LDT",(r,n)=>this._getDEMWorkerSource(r,n.source).loadTile(n)),this.actor.registerMessageHandler("RDT",async(r,n)=>{this._getDEMWorkerSource(r,n.source).removeTile(n)}),this.actor.registerMessageHandler("GCEZ",async(r,n)=>this._getWorkerSource(r,n.type,n.source).getClusterExpansionZoom(n)),this.actor.registerMessageHandler("GCC",async(r,n)=>this._getWorkerSource(r,n.type,n.source).getClusterChildren(n)),this.actor.registerMessageHandler("GCL",async(r,n)=>this._getWorkerSource(r,n.type,n.source).getClusterLeaves(n)),this.actor.registerMessageHandler("LD",(r,n)=>this._getWorkerSource(r,n.type,n.source).loadData(n)),this.actor.registerMessageHandler("LT",(r,n)=>this._getWorkerSource(r,n.type,n.source).loadTile(n)),this.actor.registerMessageHandler("RT",(r,n)=>this._getWorkerSource(r,n.type,n.source).reloadTile(n)),this.actor.registerMessageHandler("AT",(r,n)=>this._getWorkerSource(r,n.type,n.source).abortTile(n)),this.actor.registerMessageHandler("RMT",(r,n)=>this._getWorkerSource(r,n.type,n.source).removeTile(n)),this.actor.registerMessageHandler("RS",async(r,n)=>{if(!this.workerSources[r]||!this.workerSources[r][n.type]||!this.workerSources[r][n.type][n.source])return;let i=this.workerSources[r][n.type][n.source];delete this.workerSources[r][n.type][n.source],i.removeSource!==void 0&&i.removeSource(n)}),this.actor.registerMessageHandler("RM",async r=>{delete this.layerIndexes[r],delete this.availableImages[r],delete this.workerSources[r],delete this.demWorkerSources[r]}),this.actor.registerMessageHandler("SR",async(r,n)=>{this.referrer=n}),this.actor.registerMessageHandler("SRPS",(r,n)=>this._syncRTLPluginState(r,n)),this.actor.registerMessageHandler("IS",async(r,n)=>{this.self.importScripts(n)}),this.actor.registerMessageHandler("SI",(r,n)=>this._setImages(r,n)),this.actor.registerMessageHandler("UL",async(r,n)=>{this._getLayerIndex(r).update(n.layers,n.removedIds)}),this.actor.registerMessageHandler("SL",async(r,n)=>{this._getLayerIndex(r).replace(n)})}async _setImages(t,r){this.availableImages[t]=r;for(let n in this.workerSources[t]){let i=this.workerSources[t][n];for(let o in i)i[o].availableImages=r}}async _syncRTLPluginState(t,r){if(ye.isParsed())return ye.getState();if(r.pluginStatus!=="loading")return ye.setState(r),r;let n=r.pluginURL;if(this.self.importScripts(n),ye.isParsed()){let o={pluginStatus:"loaded",pluginURL:n};return ye.setState(o),o}throw ye.setState({pluginStatus:"error",pluginURL:""}),new Error("RTL Text Plugin failed to import scripts from ".concat(n))}_getAvailableImages(t){let r=this.availableImages[t];return r||(r=[]),r}_getLayerIndex(t){let r=this.layerIndexes[t];return r||(r=this.layerIndexes[t]=new Yo),r}_getWorkerSource(t,r,n){if(this.workerSources[t]||(this.workerSources[t]={}),this.workerSources[t][r]||(this.workerSources[t][r]={}),!this.workerSources[t][r][n]){let i={sendAsync:(o,a)=>(o.targetMapId=t,this.actor.sendAsync(o,a))};switch(r){case"vector":this.workerSources[t][r][n]=new Vr(i,this._getLayerIndex(t),this._getAvailableImages(t));break;case"geojson":this.workerSources[t][r][n]=new da(i,this._getLayerIndex(t),this._getAvailableImages(t));break;default:this.workerSources[t][r][n]=new this.externalWorkerSourceTypes[r](i,this._getLayerIndex(t),this._getAvailableImages(t));break}}return this.workerSources[t][r][n]}_getDEMWorkerSource(t,r){return this.demWorkerSources[t]||(this.demWorkerSources[t]={}),this.demWorkerSources[t][r]||(this.demWorkerSources[t][r]=new sa),this.demWorkerSources[t][r]}};nt(self)&&(self.worker=new ga(self));})();\n/*! Bundled license information:\n\nieee754/index.js:\n (*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> *)\n*/\n';var Rv=u(()=>URL.createObjectURL(new Blob([Qy],{type:"text/javascript"})),"getWorkerURL");function eg(){return new Worker(Rv())}u(eg,"workerFactory");var va="maplibre_preloaded_worker_pool",ba=class ba{constructor(){this.active={}}acquire(t){if(!this.workers)for(this.workers=[];this.workers.length<ba.workerCount;)this.workers.push(eg());return this.active[t]=!0,this.workers.slice()}release(t){delete this.active[t],this.numActive()===0&&(this.workers.forEach(e=>{e.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[va]}numActive(){return Object.keys(this.active).length}};u(ba,"WorkerPool");var Kt=ba,zv=Math.floor($.hardwareConcurrency/2);Kt.workerCount=xd(globalThis)?Math.max(Math.min(zv,3),1):1;var sn;function ln(){return sn||(sn=new Kt),sn}u(ln,"getGlobalWorkerPool");function Bv(){ln().acquire(va)}u(Bv,"prewarm");function Ov(){let o=sn;o&&(o.isPreloaded()&&o.numActive()===1?(o.release(va),sn=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()"))}u(Ov,"clearPrewarmedResources");var fp=class fp{constructor(t,e){this.workerPool=t,this.actors=[],this.currentActor=0,this.id=e;let r=this.workerPool.acquire(e);for(let i=0;i<r.length;i++){let n=r[i],a=new xa(n,e);a.name="Worker ".concat(i),this.actors.push(a)}if(!this.actors.length)throw new Error("No actors found")}broadcast(t,e){let r=[];for(let i of this.actors)r.push(i.sendAsync({type:t,data:e}));return Promise.all(r)}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(t=!0){this.actors.forEach(e=>{e.remove()}),this.actors=[],t&&this.workerPool.release(this.id)}registerMessageHandler(t,e){for(let r of this.actors)r.registerMessageHandler(t,e)}};u(fp,"Dispatcher");var un=fp,wa;function Pa(){return wa||(wa=new un(ln(),fo),wa.registerMessageHandler("GR",(o,t,e)=>Lr(t,e))),wa}u(Pa,"getGlobalDispatcher");m();function Vv(o,t){let e=G.create();return G.translate(e,e,[1,1,0]),G.scale(e,e,[o.width*.5,o.height*.5,1]),G.multiply(e,e,o.calculatePosMatrix(t.toUnwrapped()))}u(Vv,"getPixelPosMatrix");function Uv(o,t,e){if(o)for(let r of o){let i=t[r];if(i&&i.source===e&&i.type==="fill-extrusion")return!0}else for(let r in t){let i=t[r];if(i.source===e&&i.type==="fill-extrusion")return!0}return!1}u(Uv,"queryIncludes3DLayer");function tg(o,t,e,r,i,n){let a=Uv(i&&i.layers,t,o.id),s=n.maxPitchScaleFactor(),l=o.tilesIn(r,s,a);l.sort(ng);let c=[];for(let h of l)c.push({wrappedTileID:h.tileID.wrapped().key,queryResults:h.tile.queryRenderedFeatures(t,e,o._state,h.queryGeometry,h.cameraQueryGeometry,h.scale,i,n,s,Vv(o.transform,h.tileID))});let p=Gv(c);for(let h in p)p[h].forEach(f=>{let d=f.feature,g=o.getFeatureState(d.layer["source-layer"],d.id);d.source=d.layer.source,d.layer["source-layer"]&&(d.sourceLayer=d.layer["source-layer"]),d.state=g});return p}u(tg,"queryRenderedFeatures");function rg(o,t,e,r,i,n,a){let s={},l=n.queryRenderedSymbols(r),c=[];for(let p of Object.keys(l).map(Number))c.push(a[p]);c.sort(ng);for(let p of c){let h=p.featureIndex.lookupSymbolFeatures(l[p.bucketInstanceId],t,p.bucketIndex,p.sourceLayerIndex,i.filter,i.layers,i.availableImages,o);for(let f in h){let d=s[f]=s[f]||[],g=h[f];g.sort((y,_)=>{let w=p.featureSortOrder;if(w){let v=w.indexOf(y.featureIndex);return w.indexOf(_.featureIndex)-v}else return _.featureIndex-y.featureIndex});for(let y of g)d.push(y)}}for(let p in s)s[p].forEach(h=>{let f=h.feature,d=o[p],y=e[d.source].getFeatureState(f.layer["source-layer"],f.id);f.source=f.layer.source,f.layer["source-layer"]&&(f.sourceLayer=f.layer["source-layer"]),f.state=y});return s}u(rg,"queryRenderedSymbols");function ig(o,t){let e=o.getRenderableIds().map(n=>o.getTileByID(n)),r=[],i={};for(let n=0;n<e.length;n++){let a=e[n],s=a.tileID.canonical.key;i[s]||(i[s]=!0,a.querySourceFeatures(r,t))}return r}u(ig,"querySourceFeatures");function ng(o,t){let e=o.tileID,r=t.tileID;return e.overscaledZ-r.overscaledZ||e.canonical.y-r.canonical.y||e.wrap-r.wrap||e.canonical.x-r.canonical.x}u(ng,"sortTilesIn");function Gv(o){let t={},e={};for(let r of o){let i=r.queryResults,n=r.wrappedTileID,a=e[n]=e[n]||{};for(let s in i){let l=i[s],c=a[s]=a[s]||{},p=t[s]=t[s]||[];for(let h of l)c[h.featureIndex]||(c[h.featureIndex]=!0,p.push(h))}}return t}u(Gv,"mergeRenderedFeatureLayers");m();m();m();m();async function Sa(o,t,e){let r=o;if(o.url?r=(await zt(t.transformRequest(o.url,"Source"),e)).data:await $.frameAsync(e),!r)return null;let i=Rt(B(r,o),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in r&&r.vector_layers&&(i.vectorLayerIds=r.vector_layers.map(n=>n.id)),i}u(Sa,"loadTileJson");m();m();m();var cn=63710088e-1,wr=class wr{constructor(t,e){if(isNaN(t)||isNaN(e))throw new Error("Invalid LngLat object: (".concat(t,", ").concat(e,")"));if(this.lng=+t,this.lat=+e,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new wr(vt(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return"LngLat(".concat(this.lng,", ").concat(this.lat,")")}distanceTo(t){let e=Math.PI/180,r=this.lat*e,i=t.lat*e,n=Math.sin(r)*Math.sin(i)+Math.cos(r)*Math.cos(i)*Math.cos((t.lng-this.lng)*e);return cn*Math.acos(Math.min(n,1))}static convert(t){if(t instanceof wr)return t;if(Array.isArray(t)&&(t.length===2||t.length===3))return new wr(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&typeof t=="object"&&t!==null)return new wr(Number("lng"in t?t.lng:t.lon),Number(t.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}};u(wr,"LngLat");var ee=wr;var $t=class $t{constructor(t,e){t&&(e?this.setSouthWest(t).setNorthEast(e):Array.isArray(t)&&(t.length===4?this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]]):this.setSouthWest(t[0]).setNorthEast(t[1])))}setNorthEast(t){return this._ne=t instanceof ee?new ee(t.lng,t.lat):ee.convert(t),this}setSouthWest(t){return this._sw=t instanceof ee?new ee(t.lng,t.lat):ee.convert(t),this}extend(t){let e=this._sw,r=this._ne,i,n;if(t instanceof ee)i=t,n=t;else if(t instanceof $t){if(i=t._sw,n=t._ne,!i||!n)return this}else{if(Array.isArray(t))if(t.length===4||t.every(Array.isArray)){let a=t;return this.extend($t.convert(a))}else{let a=t;return this.extend(ee.convert(a))}else if(t&&("lng"in t||"lon"in t)&&"lat"in t)return this.extend(ee.convert(t));return this}return!e&&!r?(this._sw=new ee(i.lng,i.lat),this._ne=new ee(n.lng,n.lat)):(e.lng=Math.min(i.lng,e.lng),e.lat=Math.min(i.lat,e.lat),r.lng=Math.max(n.lng,r.lng),r.lat=Math.max(n.lat,r.lat)),this}getCenter(){return new ee((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 ee(this.getWest(),this.getNorth())}getSouthEast(){return new ee(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(".concat(this._sw.toString(),", ").concat(this._ne.toString(),")")}isEmpty(){return!(this._sw&&this._ne)}contains(t){let{lng:e,lat:r}=ee.convert(t),i=this._sw.lat<=r&&r<=this._ne.lat,n=this._sw.lng<=e&&e<=this._ne.lng;return this._sw.lng>this._ne.lng&&(n=this._sw.lng>=e&&e>=this._ne.lng),i&&n}static convert(t){return t instanceof $t||!t?t:new $t(t)}static fromLngLat(t,e=0){let i=360*e/40075017,n=i/Math.cos(Math.PI/180*t.lat);return new $t(new ee(t.lng-n,t.lat-i),new ee(t.lng+n,t.lat+i))}};u($t,"LngLatBounds");var Ke=$t;m();var og=2*Math.PI*cn;function ag(o){return og*Math.cos(o*Math.PI/180)}u(ag,"circumferenceAtLatitude");function Xt(o){return(180+o)/360}u(Xt,"mercatorXfromLng");function Jt(o){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+o*Math.PI/360)))/360}u(Jt,"mercatorYfromLat");function Aa(o,t){return o/ag(t)}u(Aa,"mercatorZfromAltitude");function Nv(o){return o*360-180}u(Nv,"lngFromMercatorX");function dp(o){let t=180-o*360;return 360/Math.PI*Math.atan(Math.exp(t*Math.PI/180))-90}u(dp,"latFromMercatorY");function jv(o,t){return o*ag(dp(t))}u(jv,"altitudeFromMercatorZ");function qv(o){return 1/Math.cos(o*Math.PI/180)}u(qv,"mercatorScale");var Ta=class Ta{constructor(t,e,r=0){this.x=+t,this.y=+e,this.z=+r}static fromLngLat(t,e=0){let r=ee.convert(t);return new Ta(Xt(r.lng),Jt(r.lat),Aa(e,r.lat))}toLngLat(){return new ee(Nv(this.x),dp(this.y))}toAltitude(){return jv(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/og*qv(dp(this.y))}};u(Ta,"MercatorCoordinate");var Te=Ta;var yp=class yp{constructor(t,e,r){this.bounds=Ke.convert(this.validateBounds(t)),this.minzoom=e||0,this.maxzoom=r||24}validateBounds(t){return!Array.isArray(t)||t.length!==4?[-180,-90,180,90]:[Math.max(-180,t[0]),Math.max(-90,t[1]),Math.min(180,t[2]),Math.min(90,t[3])]}contains(t){let e=Math.pow(2,t.z),r={minX:Math.floor(Xt(this.bounds.getWest())*e),minY:Math.floor(Jt(this.bounds.getNorth())*e),maxX:Math.ceil(Xt(this.bounds.getEast())*e),maxY:Math.ceil(Jt(this.bounds.getSouth())*e)};return t.x>=r.minX&&t.x<r.maxX&&t.y>=r.minY&&t.y<r.maxY}};u(yp,"TileBounds");var Xr=yp;var gp=class gp extends le{constructor(e,r,i,n){super();if(this.id=e,this.dispatcher=i,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,B(this,Rt(r,["url","scheme","tileSize","promoteId"])),this._options=B({type:"vector"},r),this._collectResourceTiming=r.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(n)}async load(){this._loaded=!1,this.fire(new C("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{let e=await Sa(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),e&&(B(this,e),e.bounds&&(this.tileBounds=new Xr(e.bounds,this.minzoom,this.maxzoom)),this.fire(new C("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new C("data",{dataType:"source",sourceDataType:"content"})))}catch(e){this._tileJSONRequest=null,this.fire(new q(e))}}loaded(){return this._loaded}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}onAdd(e){this.map=e,this.load()}setSourceProperty(e){this._tileJSONRequest&&this._tileJSONRequest.abort(),e(),this.load()}setTiles(e){return this.setSourceProperty(()=>{this._options.tiles=e}),this}setUrl(e){return this.setSourceProperty(()=>{this.url=e,this._options.url=e}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return B({},this._options)}async loadTile(e){let r=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),i={request:this.map._requestManager.transformRequest(r,"Tile"),uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,tileSize:this.tileSize*e.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};i.request.collectResourceTiming=this._collectResourceTiming;let n="RT";if(!e.actor||e.state==="expired")e.actor=this.dispatcher.getActor(),n="LT";else if(e.state==="loading")return new Promise((a,s)=>{e.reloadPromise={resolve:a,reject:s}});e.abortController=new AbortController;try{let a=await e.actor.sendAsync({type:n,data:i},e.abortController);if(delete e.abortController,e.aborted)return;this._afterTileLoadWorkerResponse(e,a)}catch(a){if(delete e.abortController,e.aborted)return;if(a&&a.status!==404)throw a;this._afterTileLoadWorkerResponse(e,null)}}_afterTileLoadWorkerResponse(e,r){if(r&&r.resourceTiming&&(e.resourceTiming=r.resourceTiming),r&&this.map._refreshExpiredTiles&&e.setExpiryData(r),e.loadVectorData(r,this.map.painter),e.reloadPromise){let i=e.reloadPromise;e.reloadPromise=null,this.loadTile(e).then(i.resolve).catch(i.reject)}}async abortTile(e){e.abortController&&(e.abortController.abort(),delete e.abortController),e.actor&&await e.actor.sendAsync({type:"AT",data:{uid:e.uid,type:this.type,source:this.id}})}async unloadTile(e){e.unloadVectorData(),e.actor&&await e.actor.sendAsync({type:"RMT",data:{uid:e.uid,type:this.type,source:this.id}})}hasTransition(){return!1}};u(gp,"VectorTileSource");var pn=gp;m();var _p=class _p extends le{constructor(e,r,i,n){super();this.id=e,this.dispatcher=i,this.setEventedParent(n),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=B({type:"raster"},r),B(this,Rt(r,["url","scheme","tileSize"]))}async load(){this._loaded=!1,this.fire(new C("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{let e=await Sa(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,e&&(B(this,e),e.bounds&&(this.tileBounds=new Xr(e.bounds,this.minzoom,this.maxzoom)),this.fire(new C("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new C("data",{dataType:"source",sourceDataType:"content"})))}catch(e){this._tileJSONRequest=null,this.fire(new q(e))}}loaded(){return this._loaded}onAdd(e){this.map=e,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(e){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),e(),this.load()}setTiles(e){return this.setSourceProperty(()=>{this._options.tiles=e}),this}setUrl(e){return this.setSourceProperty(()=>{this.url=e,this._options.url=e}),this}serialize(){return B({},this._options)}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}async loadTile(e){let r=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);e.abortController=new AbortController;try{let i=await He.getImage(this.map._requestManager.transformRequest(r,"Tile"),e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted){e.state="unloaded";return}if(i&&i.data){this.map._refreshExpiredTiles&&i.cacheControl&&i.expires&&e.setExpiryData({cacheControl:i.cacheControl,expires:i.expires});let n=this.map.painter.context,a=n.gl,s=i.data;e.texture=this.map.painter.getTileTexture(s.width),e.texture?e.texture.update(s,{useMipmap:!0}):(e.texture=new me(n,s,a.RGBA,{useMipmap:!0}),e.texture.bind(a.LINEAR,a.CLAMP_TO_EDGE,a.LINEAR_MIPMAP_NEAREST),n.extTextureFilterAnisotropic&&a.texParameterf(a.TEXTURE_2D,n.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,n.extTextureFilterAnisotropicMax)),e.state="loaded"}}catch(i){if(delete e.abortController,e.aborted)e.state="unloaded";else if(i)throw e.state="errored",i}}async abortTile(e){e.abortController&&(e.abortController.abort(),delete e.abortController)}async unloadTile(e){e.texture&&this.map.painter.saveTileTexture(e.texture)}hasTransition(){return!1}};u(_p,"RasterTileSource");var Pr=_p;m();m();var sg=re(fe(),1);var xp=class xp{constructor(t,e,r){if(t<0||t>25||r<0||r>=Math.pow(2,t)||e<0||e>=Math.pow(2,t))throw new Error("x=".concat(e,", y=").concat(r,", z=").concat(t," outside of bounds. 0<=x<").concat(Math.pow(2,t),", 0<=y<").concat(Math.pow(2,t)," 0<=z<=25 "));this.z=t,this.x=e,this.y=r,this.key=hn(0,t,t,e,r)}equals(t){return this.z===t.z&&this.x===t.x&&this.y===t.y}url(t,e,r){let i=nd(this.x,this.y,this.z),n=Zv(this.z,this.x,this.y);return t[(this.x+this.y)%t.length].replace(/{prefix}/g,(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(r==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,e>1?"@2x":"").replace(/{quadkey}/g,n).replace(/{bbox-epsg-3857}/g,i)}isChildOf(t){let e=this.z-t.z;return e>0&&t.x===this.x>>e&&t.y===this.y>>e}getTilePoint(t){let e=Math.pow(2,this.z);return new sg.default((t.x*e-this.x)*8192,(t.y*e-this.y)*8192)}toString(){return"".concat(this.z,"/").concat(this.x,"/").concat(this.y)}};u(xp,"CanonicalTileID");var Jr=xp,bp=class bp{constructor(t,e){this.wrap=t,this.canonical=e,this.key=hn(t,e.z,e.z,e.x,e.y)}};u(bp,"UnwrappedTileID");var Yr=bp,nt=class nt{constructor(t,e,r,i,n){if(t<r)throw new Error("overscaledZ should be >= z; overscaledZ = ".concat(t,"; z = ").concat(r));this.overscaledZ=t,this.wrap=e,this.canonical=new Jr(r,+i,+n),this.key=hn(e,t,r,i,n)}clone(){return new nt(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(t){return this.overscaledZ===t.overscaledZ&&this.wrap===t.wrap&&this.canonical.equals(t.canonical)}scaledTo(t){if(t>this.overscaledZ)throw new Error("targetZ > this.overscaledZ; targetZ = ".concat(t,"; overscaledZ = ").concat(this.overscaledZ));let e=this.canonical.z-t;return t>this.canonical.z?new nt(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new nt(t,this.wrap,t,this.canonical.x>>e,this.canonical.y>>e)}calculateScaledKey(t,e){if(t>this.overscaledZ)throw new Error("targetZ > this.overscaledZ; targetZ = ".concat(t,"; overscaledZ = ").concat(this.overscaledZ));let r=this.canonical.z-t;return t>this.canonical.z?hn(this.wrap*+e,t,this.canonical.z,this.canonical.x,this.canonical.y):hn(this.wrap*+e,t,t,this.canonical.x>>r,this.canonical.y>>r)}isChildOf(t){if(t.wrap!==this.wrap)return!1;let e=this.canonical.z-t.canonical.z;return t.overscaledZ===0||t.overscaledZ<this.overscaledZ&&t.canonical.x===this.canonical.x>>e&&t.canonical.y===this.canonical.y>>e}children(t){if(this.overscaledZ>=t)return[new nt(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];let e=this.canonical.z+1,r=this.canonical.x*2,i=this.canonical.y*2;return[new nt(e,this.wrap,e,r,i),new nt(e,this.wrap,e,r+1,i),new nt(e,this.wrap,e,r,i+1),new nt(e,this.wrap,e,r+1,i+1)]}isLessThan(t){return this.wrap<t.wrap?!0:this.wrap>t.wrap?!1:this.overscaledZ<t.overscaledZ?!0:this.overscaledZ>t.overscaledZ?!1:this.canonical.x<t.canonical.x?!0:this.canonical.x>t.canonical.x?!1:this.canonical.y<t.canonical.y}wrapped(){return new nt(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(t){return new nt(this.overscaledZ,t,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new Yr(this.wrap,this.canonical)}toString(){return"".concat(this.overscaledZ,"/").concat(this.canonical.x,"/").concat(this.canonical.y)}getTilePoint(t){return this.canonical.getTilePoint(new Te(t.x-this.wrap,t.y))}};u(nt,"OverscaledTileID");var Re=nt;function hn(o,t,e,r,i){o*=2,o<0&&(o=o*-1-1);let n=1<<e;return(n*n*o+n*i+r).toString(36)+e.toString(36)+t.toString(36)}u(hn,"calculateKey");function Zv(o,t,e){let r="",i;for(let n=o;n>0;n--)i=1<<n-1,r+=(t&i?1:0)+(e&i?2:0);return r}u(Zv,"getQuadkey");V("CanonicalTileID",Jr);V("OverscaledTileID",Re,{omit:["posMatrix"]});m();var wp=class wp{constructor(t,e,r,i=1,n=1,a=1,s=0){if(this.uid=t,e.height!==e.width)throw new RangeError("DEM tiles must be square");if(r&&!["mapbox","terrarium","custom"].includes(r)){ve('"'.concat(r,'" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".'));return}this.stride=e.height;let l=this.dim=e.height-2;switch(this.data=new Uint32Array(e.data.buffer),r){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case"custom":this.redFactor=i,this.greenFactor=n,this.blueFactor=a,this.baseShift=s;break;case"mapbox":default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4;break}for(let c=0;c<l;c++)this.data[this._idx(-1,c)]=this.data[this._idx(0,c)],this.data[this._idx(l,c)]=this.data[this._idx(l-1,c)],this.data[this._idx(c,-1)]=this.data[this._idx(c,0)],this.data[this._idx(c,l)]=this.data[this._idx(c,l-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(l,-1)]=this.data[this._idx(l-1,0)],this.data[this._idx(-1,l)]=this.data[this._idx(0,l-1)],this.data[this._idx(l,l)]=this.data[this._idx(l-1,l-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let c=0;c<l;c++)for(let p=0;p<l;p++){let h=this.get(c,p);h>this.max&&(this.max=h),h<this.min&&(this.min=h)}}get(t,e){let r=new Uint8Array(this.data.buffer),i=this._idx(t,e)*4;return this.unpack(r[i],r[i+1],r[i+2])}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(t,e){if(t<-1||t>=this.dim+1||e<-1||e>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(e+1)*this.stride+(t+1)}unpack(t,e,r){return t*this.redFactor+e*this.greenFactor+r*this.blueFactor-this.baseShift}getPixels(){return new de({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(t,e,r){if(this.dim!==t.dim)throw new Error("dem dimension mismatch");let i=e*this.dim,n=e*this.dim+this.dim,a=r*this.dim,s=r*this.dim+this.dim;switch(e){case-1:i=n-1;break;case 1:n=i+1;break}switch(r){case-1:a=s-1;break;case 1:s=a+1;break}let l=-e*this.dim,c=-r*this.dim;for(let p=a;p<s;p++)for(let h=i;h<n;h++)this.data[this._idx(h,p)]=t.data[this._idx(h+l,p+c)]}};u(wp,"DEMData");var vp=wp;V("DEMData",vp);var Pp=class Pp extends Pr{constructor(e,r,i,n){super(e,r,i,n);this.type="raster-dem",this.maxzoom=22,this._options=B({type:"raster-dem"},r),this.encoding=r.encoding||"mapbox",this.redFactor=r.redFactor,this.greenFactor=r.greenFactor,this.blueFactor=r.blueFactor,this.baseShift=r.baseShift}async loadTile(e){let r=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),i=this.map._requestManager.transformRequest(r,"Tile");e.neighboringTiles=this._getNeighboringTiles(e.tileID),e.abortController=new AbortController;try{let n=await He.getImage(i,e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted){e.state="unloaded";return}if(n&&n.data){let a=n.data;this.map._refreshExpiredTiles&&n.cacheControl&&n.expires&&e.setExpiryData({cacheControl:n.cacheControl,expires:n.expires});let l=Je(a)&&lo()?a:await this.readImageNow(a),c={type:this.type,uid:e.uid,source:this.id,rawImageData:l,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!e.actor||e.state==="expired"){e.actor=this.dispatcher.getActor();let p=await e.actor.sendAsync({type:"LDT",data:c});e.dem=p,e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0,e.state="loaded"}}}catch(n){if(delete e.abortController,e.aborted)e.state="unloaded";else if(n)throw e.state="errored",n}}async readImageNow(e){if(typeof VideoFrame<"u"&&El()){let r=e.width+2,i=e.height+2;try{return new de({width:r,height:i},await wd(e,-1,-1,r,i))}catch{}}return $.getImageData(e,1)}_getNeighboringTiles(e){let r=e.canonical,i=Math.pow(2,r.z),n=(r.x-1+i)%i,a=r.x===0?e.wrap-1:e.wrap,s=(r.x+1+i)%i,l=r.x+1===i?e.wrap+1:e.wrap,c={};return c[new Re(e.overscaledZ,a,r.z,n,r.y).key]={backfilled:!1},c[new Re(e.overscaledZ,l,r.z,s,r.y).key]={backfilled:!1},r.y>0&&(c[new Re(e.overscaledZ,a,r.z,n,r.y-1).key]={backfilled:!1},c[new Re(e.overscaledZ,e.wrap,r.z,r.x,r.y-1).key]={backfilled:!1},c[new Re(e.overscaledZ,l,r.z,s,r.y-1).key]={backfilled:!1}),r.y+1<i&&(c[new Re(e.overscaledZ,a,r.z,n,r.y+1).key]={backfilled:!1},c[new Re(e.overscaledZ,e.wrap,r.z,r.x,r.y+1).key]={backfilled:!1},c[new Re(e.overscaledZ,l,r.z,s,r.y+1).key]={backfilled:!1}),c}async unloadTile(e){e.demTexture&&this.map.painter.saveTileTexture(e.demTexture),e.fbo&&(e.fbo.destroy(),delete e.fbo),e.dem&&delete e.dem,delete e.neighboringTiles,e.state="unloaded",e.actor&&await e.actor.sendAsync({type:"RDT",data:{type:this.type,uid:e.uid,source:this.id}})}};u(Pp,"RasterDEMTileSource");var mn=Pp;m();var Sp=class Sp extends le{constructor(e,r,i,n){super();this.id=e,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._pendingLoads=0,this.actor=i.getActor(),this.setEventedParent(n),this._data=r.data,this._options=B({},r),this._collectResourceTiming=r.collectResourceTiming,r.maxzoom!==void 0&&(this.maxzoom=r.maxzoom),r.type&&(this.type=r.type),r.attribution&&(this.attribution=r.attribution),this.promoteId=r.promoteId;let a=8192/this.tileSize;this.workerOptions=B({source:this.id,cluster:r.cluster||!1,geojsonVtOptions:{buffer:(r.buffer!==void 0?r.buffer:128)*a,tolerance:(r.tolerance!==void 0?r.tolerance:.375)*a,extent:8192,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:8192,radius:(r.clusterRadius||50)*a,log:!1,generateId:r.generateId||!1},clusterProperties:r.clusterProperties,filter:r.filter},r.workerOptions),typeof this.promoteId=="string"&&(this.workerOptions.promoteId=this.promoteId)}async load(){await this._updateWorkerData()}onAdd(e){this.map=e,this.load()}setData(e){return this._data=e,this._updateWorkerData(),this}updateData(e){return this._updateWorkerData(e),this}setClusterOptions(e){return this.workerOptions.cluster=e.cluster,e&&(e.clusterRadius!==void 0&&(this.workerOptions.superclusterOptions.radius=e.clusterRadius),e.clusterMaxZoom!==void 0&&(this.workerOptions.superclusterOptions.maxZoom=e.clusterMaxZoom)),this._updateWorkerData(),this}getClusterExpansionZoom(e){return this.actor.sendAsync({type:"GCEZ",data:{type:this.type,clusterId:e,source:this.id}})}getClusterChildren(e){return this.actor.sendAsync({type:"GCC",data:{type:this.type,clusterId:e,source:this.id}})}getClusterLeaves(e,r,i){return this.actor.sendAsync({type:"GCL",data:{type:this.type,source:this.id,clusterId:e,limit:r,offset:i}})}async _updateWorkerData(e){let r=B({type:this.type},this.workerOptions);e?r.dataDiff=e:typeof this._data=="string"?(r.request=this.map._requestManager.transformRequest($.resolveURL(this._data),"Source"),r.request.collectResourceTiming=this._collectResourceTiming):r.data=JSON.stringify(this._data),this._pendingLoads++,this.fire(new C("dataloading",{dataType:"source"}));try{let i=await this.actor.sendAsync({type:"LD",data:r});if(this._pendingLoads--,this._removed||i.abandoned){this.fire(new C("dataabort",{dataType:"source"}));return}let n=null;i.resourceTiming&&i.resourceTiming[this.id]&&(n=i.resourceTiming[this.id].slice(0));let a={dataType:"source"};this._collectResourceTiming&&n&&n.length>0&&B(a,{resourceTiming:n}),this.fire(new C("data",{...a,sourceDataType:"metadata"})),this.fire(new C("data",{...a,sourceDataType:"content"}))}catch(i){if(this._pendingLoads--,this._removed){this.fire(new C("dataabort",{dataType:"source"}));return}this.fire(new q(i))}}loaded(){return this._pendingLoads===0}async loadTile(e){let r=e.actor?"RT":"LT";e.actor=this.actor;let i={type:this.type,uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};e.abortController=new AbortController;let n=await this.actor.sendAsync({type:r,data:i},e.abortController);delete e.abortController,e.unloadVectorData(),e.aborted||e.loadVectorData(n,this.map.painter,r==="RT")}async abortTile(e){e.abortController&&(e.abortController.abort(),delete e.abortController),e.aborted=!0}async unloadTile(e){e.unloadVectorData(),await this.actor.sendAsync({type:"RMT",data:{uid:e.uid,type:this.type,source:this.id}})}onRemove(){this._removed=!0,this.actor.sendAsync({type:"RS",data:{type:this.type,source:this.id}})}serialize(){return B({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}};u(Sp,"GeoJSONSource");var fn=Sp;m();m();m();var Yt=he([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);var Tp=class Tp extends le{constructor(e,r,i,n){super();this.id=e,this.dispatcher=i,this.coordinates=r.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(n),this.options=r}async load(e){this._loaded=!1,this.fire(new C("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{let r=await He.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,r&&r.data&&(this.image=r.data,e&&(this.coordinates=e),this._finishLoading())}catch(r){this._request=null,this._loaded=!0,this.fire(new q(r))}}loaded(){return this._loaded}updateImage(e){return e.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=e.url,this.load(e.coordinates).finally(()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new C("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(e){this.map=e,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(e){this.coordinates=e;let r=e.map(Te.fromLngLat);this.tileID=Hv(r),this.minzoom=this.maxzoom=this.tileID.z;let i=r.map(n=>this.tileID.getTilePoint(n)._round());return this._boundsArray=new Nr,this._boundsArray.emplaceBack(i[0].x,i[0].y,0,0),this._boundsArray.emplaceBack(i[1].x,i[1].y,8192,0),this._boundsArray.emplaceBack(i[3].x,i[3].y,0,8192),this._boundsArray.emplaceBack(i[2].x,i[2].y,8192,8192),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new C("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;let e=this.map.painter.context,r=e.gl;this.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,Yt.members)),this.boundsSegments||(this.boundsSegments=se.simpleSegment(0,0,4,2)),this.texture||(this.texture=new me(e,this.image,r.RGBA),this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE));let i=!1;for(let n in this.tiles){let a=this.tiles[n];a.state!=="loaded"&&(a.state="loaded",a.texture=this.texture,i=!0)}i&&this.fire(new C("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}async loadTile(e){this.tileID&&this.tileID.equals(e.tileID.canonical)?(this.tiles[String(e.tileID.wrap)]=e,e.buckets={}):e.state="errored"}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}};u(Tp,"ImageSource");var st=Tp;function Hv(o){let t=1/0,e=1/0,r=-1/0,i=-1/0;for(let p of o)t=Math.min(t,p.x),e=Math.min(e,p.y),r=Math.max(r,p.x),i=Math.max(i,p.y);let n=r-t,a=i-e,s=Math.max(n,a),l=Math.max(0,Math.floor(-Math.log(s)/Math.LN2)),c=Math.pow(2,l);return new Jr(l,Math.floor((t+r)/2*c),Math.floor((e+i)/2*c))}u(Hv,"getCoordinatesCenterTileID");var Ap=class Ap extends st{constructor(e,r,i,n){super(e,r,i,n);this.roundZoom=!0,this.type="video",this.options=r}async load(){this._loaded=!1;let e=this.options;this.urls=[];for(let r of e.urls)this.urls.push(this.map._requestManager.transformRequest(r,"Source").url);try{let r=await Ad(this.urls);if(this._loaded=!0,!r)return;this.video=r,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading()}catch(r){this.fire(new q(r))}}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(e){if(this.video){let r=this.video.seekable;e<r.start(0)||e>r.end(0)?this.fire(new q(new Ft("sources.".concat(this.id),null,"Playback for this video can be set only between the ".concat(r.start(0)," and ").concat(r.end(0),"-second mark.")))):this.video.currentTime=e}}getVideo(){return this.video}onAdd(e){this.map||(this.map=e,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;let e=this.map.painter.context,r=e.gl;this.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,Yt.members)),this.boundsSegments||(this.boundsSegments=se.simpleSegment(0,0,4,2)),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 me(e,this.video,r.RGBA),this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE));let i=!1;for(let n in this.tiles){let a=this.tiles[n];a.state!=="loaded"&&(a.state="loaded",a.texture=this.texture,i=!0)}i&&this.fire(new C("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}};u(Ap,"VideoSource");var dn=Ap;m();var Ip=class Ip extends st{constructor(e,r,i,n){super(e,r,i,n);r.coordinates?(!Array.isArray(r.coordinates)||r.coordinates.length!==4||r.coordinates.some(a=>!Array.isArray(a)||a.length!==2||a.some(s=>typeof s!="number")))&&this.fire(new q(new Ft("sources.".concat(e),null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new q(new Ft("sources.".concat(e),null,'missing required property "coordinates"'))),r.animate&&typeof r.animate!="boolean"&&this.fire(new q(new Ft("sources.".concat(e),null,'optional "animate" property must be a boolean value'))),r.canvas?typeof r.canvas!="string"&&!(r.canvas instanceof HTMLCanvasElement)&&this.fire(new q(new Ft("sources.".concat(e),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 q(new Ft("sources.".concat(e),null,'missing required property "canvas"'))),this.options=r,this.animate=r.animate!==void 0?r.animate:!0}async load(){if(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 q(new Error("Canvas dimensions cannot be less than or equal to zero.")));return}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(e){this.map=e,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let e=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,e=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,e=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;let r=this.map.painter.context,i=r.gl;this.boundsBuffer||(this.boundsBuffer=r.createVertexBuffer(this._boundsArray,Yt.members)),this.boundsSegments||(this.boundsSegments=se.simpleSegment(0,0,4,2)),this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new me(r,this.canvas,i.RGBA,{premultiply:!0});let n=!1;for(let a in this.tiles){let s=this.tiles[a];s.state!=="loaded"&&(s.state="loaded",s.texture=this.texture,n=!0)}n&&this.fire(new C("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(let e of[this.canvas.width,this.canvas.height])if(isNaN(e)||e<=0)return!0;return!1}};u(Ip,"CanvasSource");var yn=Ip;var lg={},ug=u((o,t,e,r)=>{let i=cg(t.type),n=new i(o,t,e,r);if(n.id!==o)throw new Error("Expected Source id to be ".concat(o," instead of ").concat(n.id));return n},"create"),cg=u(o=>{switch(o){case"geojson":return fn;case"image":return st;case"raster":return Pr;case"raster-dem":return mn;case"vector":return pn;case"video":return dn;case"canvas":return yn}return lg[o]},"getSourceType"),Wv=u((o,t)=>{lg[o]=t},"setSourceType"),Kv=u(async(o,t)=>{if(cg(o))throw new Error('A source type called "'.concat(o,'" already exists.'));Wv(o,t)},"addSourceType");m();m();function pg(o,t){let e={};if(!t)return e;for(let r of o){let i=r.layerIds.map(n=>t.getLayer(n)).filter(Boolean);if(i.length!==0){r.layers=i,r.stateDependentLayerIds&&(r.stateDependentLayers=r.stateDependentLayerIds.map(n=>i.filter(a=>a.id===n)[0]));for(let n of i)e[n.id]=r}}return e}u(pg,"deserialize");m();m();var Cp=class Cp{constructor(t){this._stringToNumber={},this._numberToString=[];for(let e=0;e<t.length;e++){let r=t[e];this._stringToNumber[r]=e,this._numberToString[e]=r}}encode(t){return this._stringToNumber[t]}decode(t){if(t>=this._numberToString.length)throw new Error("Out of bounds. Index requested n=".concat(t," can't be >= this._numberToString.length ").concat(this._numberToString.length));return this._numberToString[t]}};u(Cp,"DictionaryCoder");var Ia=Cp;var fg=re(oo(),1),dg=re(rd(),1);m();var Ep=class Ep{constructor(t,e,r,i,n){this.type="Feature",this._vectorTileFeature=t,t._z=e,t._x=r,t._y=i,this.properties=t.properties,this.id=n}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(t){this._geometry=t}toJSON(){let t={geometry:this.geometry};for(let e in this)e==="_geometry"||e==="_vectorTileFeature"||(t[e]=this[e]);return t}};u(Ep,"GeoJSONFeature");var Qr=Ep;var Lp=class Lp{constructor(t,e){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new lr(8192,16,0),this.grid3D=new lr(8192,16,0),this.featureIndexArray=new Gi,this.promoteId=e}insert(t,e,r,i,n,a){let s=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(r,i,n);let l=a?this.grid3D:this.grid;for(let c=0;c<e.length;c++){let p=e[c],h=[1/0,1/0,-1/0,-1/0];for(let f=0;f<p.length;f++){let d=p[f];h[0]=Math.min(h[0],d.x),h[1]=Math.min(h[1],d.y),h[2]=Math.max(h[2],d.x),h[3]=Math.max(h[3],d.y)}h[0]<8192&&h[1]<8192&&h[2]>=0&&h[3]>=0&&l.insert(s,h[0],h[1],h[2],h[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new fg.default.VectorTile(new dg.default(this.rawTileData)).layers,this.sourceLayerCoder=new Ia(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(t,e,r,i){this.loadVTLayers();let n=t.params||{},a=8192/t.tileSize/t.scale,s=pi(n.filter),l=t.queryGeometry,c=t.queryPadding*a,p=mg(l),h=this.grid.query(p.minX-c,p.minY-c,p.maxX+c,p.maxY+c),f=mg(t.cameraQueryGeometry),d=this.grid3D.query(f.minX-c,f.minY-c,f.maxX+c,f.maxY+c,(_,w,v,b)=>$d(t.cameraQueryGeometry,_-c,w-c,v+c,b+c));for(let _ of d)h.push(_);h.sort($v);let g={},y;for(let _=0;_<h.length;_++){let w=h[_];if(w===y)continue;y=w;let v=this.featureIndexArray.get(w),b=null;this.loadMatchingFeature(g,v.bucketIndex,v.sourceLayerIndex,v.featureIndex,s,n.layers,n.availableImages,e,r,i,(P,S,A)=>(b||(b=Qe(P)),S.queryIntersectsFeature(l,P,A,b,this.z,t.transform,a,t.pixelPosMatrix)))}return g}loadMatchingFeature(t,e,r,i,n,a,s,l,c,p,h){let f=this.bucketLayerIDs[e];if(a&&!fd(a,f))return;let d=this.sourceLayerCoder.decode(r),y=this.vtLayers[d].feature(i);if(n.needGeometry){let w=et(y,!0);if(!n.filter(new ue(this.tileID.overscaledZ),w,this.tileID.canonical))return}else if(!n.filter(new ue(this.tileID.overscaledZ),y))return;let _=this.getId(y,d);for(let w=0;w<f.length;w++){let v=f[w];if(a&&a.indexOf(v)<0)continue;let b=l[v];if(!b)continue;let P={};_&&p&&(P=p.getState(b.sourceLayer||"_geojsonTileLayer",_));let S=B({},c[v]);S.paint=hg(S.paint,b.paint,y,P,s),S.layout=hg(S.layout,b.layout,y,P,s);let A=!h||h(y,b,P);if(!A)continue;let L=new Qr(y,this.z,this.x,this.y,_);L.layer=S;let D=t[v];D===void 0&&(D=t[v]=[]),D.push({featureIndex:i,feature:L,intersectionZ:A})}}lookupSymbolFeatures(t,e,r,i,n,a,s,l){let c={};this.loadVTLayers();let p=pi(n);for(let h of t)this.loadMatchingFeature(c,r,i,h,p,a,s,l,e);return c}hasLayer(t){for(let e of this.bucketLayerIDs)for(let r of e)if(t===r)return!0;return!1}getId(t,e){let r=t.id;if(this.promoteId){let i=typeof this.promoteId=="string"?this.promoteId:this.promoteId[e];r=t.properties[i],typeof r=="boolean"&&(r=Number(r))}return r}};u(Lp,"FeatureIndex");var Mp=Lp;V("FeatureIndex",Mp,{omit:["rawTileData","sourceLayerCoder"]});function hg(o,t,e,r,i){return fi(o,(n,a)=>{let s=t instanceof Ot?t.get(a):null;return s&&s.evaluate?s.evaluate(e,r,i):s})}u(hg,"evaluateProperties");function mg(o){let t=1/0,e=1/0,r=-1/0,i=-1/0;for(let n of o)t=Math.min(t,n.x),e=Math.min(e,n.y),r=Math.max(r,n.x),i=Math.max(i,n.y);return{minX:t,minY:e,maxX:r,maxY:i}}u(mg,"getBounds");function $v(o,t){return t-o}u($v,"topDownFeatureComparator");m();m();var gn="RTLPluginLoaded";var Fp=class Fp extends le{constructor(){super(...arguments);this.status="unavailable";this.url=null;this.dispatcher=Pa()}_syncState(e){return this.status=e,this.dispatcher.broadcast("SRPS",{pluginStatus:e,pluginURL:this.url}).catch(r=>{throw this.status="error",r})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}async setRTLTextPlugin(e,r=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=$.resolveURL(e),!this.url)throw new Error("requested url ".concat(e," is invalid"));if(this.status==="unavailable")if(r)this.status="deferred",this._syncState(this.status);else return this._requestImport();else if(this.status==="requested")return this._requestImport()}async _requestImport(){await this._syncState("loading"),this.status="loaded",this.fire(new C(gn))}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}};u(Fp,"RTLMainThreadPlugin");var kp=Fp,Dp=null;function Qt(){return Dp||(Dp=new kp),Dp}u(Qt,"rtlMainThreadPluginFactory");var Xv=3e4,Rp=class Rp{constructor(t,e){this.timeAdded=0;this.fadeEndTime=0;this.tileID=t,this.uid=co(),this.uses=0,this.tileSize=e,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttCoords={},this.expiredRequestCount=0,this.state="loading"}registerFadeDuration(t){let e=t+this.timeAdded;e<this.fadeEndTime||(this.fadeEndTime=e)}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}clearTextures(t){this.demTexture&&t.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(t,e,r){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",!t){this.collisionBoxArray=new Ri;return}t.featureIndex&&(this.latestFeatureIndex=t.featureIndex,t.rawTileData?(this.latestRawTileData=t.rawTileData,this.latestFeatureIndex.rawTileData=t.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=t.collisionBoxArray,this.buckets=pg(t.buckets,e.style),this.hasSymbolBuckets=!1;for(let i in this.buckets){let n=this.buckets[i];if(n instanceof pt)if(this.hasSymbolBuckets=!0,r)n.justReloaded=!0;else break}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(let i in this.buckets){let n=this.buckets[i];if(n instanceof pt&&n.hasRTLText){this.hasRTLText=!0,Qt().lazyLoad();break}}this.queryPadding=0;for(let i in this.buckets){let n=this.buckets[i];this.queryPadding=Math.max(this.queryPadding,e.style.getLayer(i).queryRadius(n))}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage)}unloadVectorData(){for(let t in this.buckets)this.buckets[t].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(t){return this.buckets[t.id]}upload(t){for(let r in this.buckets){let i=this.buckets[r];i.uploadPending()&&i.upload(t)}let e=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new me(t,this.imageAtlas.image,e.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new me(t,this.glyphAtlasImage,e.ALPHA),this.glyphAtlasImage=null)}prepare(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture)}queryRenderedFeatures(t,e,r,i,n,a,s,l,c,p){return!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData?{}:this.latestFeatureIndex.query({queryGeometry:i,cameraQueryGeometry:n,scale:a,tileSize:this.tileSize,pixelPosMatrix:p,transform:l,params:s,queryPadding:this.queryPadding*c},t,e,r)}querySourceFeatures(t,e){let r=this.latestFeatureIndex;if(!r||!r.rawTileData)return;let i=r.loadVTLayers(),n=e&&e.sourceLayer?e.sourceLayer:"",a=i._geojsonTileLayer||i[n];if(!a)return;let s=pi(e&&e.filter),{z:l,x:c,y:p}=this.tileID.canonical,h={z:l,x:c,y:p};for(let f=0;f<a.length;f++){let d=a.feature(f);if(s.needGeometry){let _=et(d,!0);if(!s.filter(new ue(this.tileID.overscaledZ),_,this.tileID.canonical))continue}else if(!s.filter(new ue(this.tileID.overscaledZ),d))continue;let g=r.getId(d,n),y=new Qr(d,l,c,p,g);y.tile=h,t.push(y)}}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(t){let e=this.expirationTime;if(t.cacheControl){let r=_d(t.cacheControl);r["max-age"]&&(this.expirationTime=Date.now()+r["max-age"]*1e3)}else t.expires&&(this.expirationTime=new Date(t.expires).getTime());if(this.expirationTime){let r=Date.now(),i=!1;if(this.expirationTime>r)i=!1;else if(!e)i=!0;else if(this.expirationTime<e)i=!0;else{let n=this.expirationTime-e;n?this.expirationTime=r+Math.max(n,Xv):i=!0}i?(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(t,e){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||Object.keys(t).length===0)return;let r=this.latestFeatureIndex.loadVTLayers();for(let i in this.buckets){if(!e.style.hasLayer(i))continue;let n=this.buckets[i],a=n.layers[0].sourceLayer||"_geojsonTileLayer",s=r[a],l=t[a];if(!s||!l||Object.keys(l).length===0)continue;n.update(l,s,this.imageAtlas&&this.imageAtlas.patternPositions||{});let c=e&&e.style&&e.style.getLayer(i);c&&(this.queryPadding=Math.max(this.queryPadding,c.queryRadius(n)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<$.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(t){this.symbolFadeHoldUntil=$.now()+t}setDependencies(t,e){let r={};for(let i of e)r[i]=!0;this.dependencies[t]=r}hasDependency(t,e){for(let r of t){let i=this.dependencies[r];if(i){for(let n of e)if(i[n])return!0}}return!1}};u(Rp,"Tile");var ei=Rp;m();var zp=class zp{constructor(t,e){this.max=t,this.onRemove=e,this.reset()}reset(){for(let t in this.data)for(let e of this.data[t])e.timeout&&clearTimeout(e.timeout),this.onRemove(e.value);return this.data={},this.order=[],this}add(t,e,r){let i=t.wrapped().key;this.data[i]===void 0&&(this.data[i]=[]);let n={value:e,timeout:void 0};if(r!==void 0&&(n.timeout=setTimeout(()=>{this.remove(t,n)},r)),this.data[i].push(n),this.order.push(i),this.order.length>this.max){let a=this._getAndRemoveByKey(this.order[0]);a&&this.onRemove(a)}return this}has(t){return t.wrapped().key in this.data}getAndRemove(t){return this.has(t)?this._getAndRemoveByKey(t.wrapped().key):null}_getAndRemoveByKey(t){let e=this.data[t].shift();return e.timeout&&clearTimeout(e.timeout),this.data[t].length===0&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),e.value}getByKey(t){let e=this.data[t];return e?e[0].value:null}get(t){return this.has(t)?this.data[t.wrapped().key][0].value:null}remove(t,e){if(!this.has(t))return this;let r=t.wrapped().key,i=e===void 0?0:this.data[r].indexOf(e),n=this.data[r][i];return this.data[r].splice(i,1),n.timeout&&clearTimeout(n.timeout),this.data[r].length===0&&delete this.data[r],this.onRemove(n.value),this.order.splice(this.order.indexOf(r),1),this}setMaxSize(t){for(this.max=t;this.order.length>this.max;){let e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this}filter(t){let e=[];for(let r in this.data)for(let i of this.data[r])t(i.value)||e.push(i);for(let r of e)this.remove(r.value.tileID,r)}};u(zp,"TileCache");var Ca=zp;var Op=re(fe(),1);m();var Bp=class Bp{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(t,e,r){let i=String(e);if(this.stateChanges[t]=this.stateChanges[t]||{},this.stateChanges[t][i]=this.stateChanges[t][i]||{},B(this.stateChanges[t][i],r),this.deletedStates[t]===null){this.deletedStates[t]={};for(let n in this.state[t])n!==i&&(this.deletedStates[t][n]=null)}else if(this.deletedStates[t]&&this.deletedStates[t][i]===null){this.deletedStates[t][i]={};for(let a in this.state[t][i])r[a]||(this.deletedStates[t][i][a]=null)}else for(let a in r)this.deletedStates[t]&&this.deletedStates[t][i]&&this.deletedStates[t][i][a]===null&&delete this.deletedStates[t][i][a]}removeFeatureState(t,e,r){if(this.deletedStates[t]===null)return;let n=String(e);if(this.deletedStates[t]=this.deletedStates[t]||{},r&&e!==void 0)this.deletedStates[t][n]!==null&&(this.deletedStates[t][n]=this.deletedStates[t][n]||{},this.deletedStates[t][n][r]=null);else if(e!==void 0)if(this.stateChanges[t]&&this.stateChanges[t][n]){this.deletedStates[t][n]={};for(r in this.stateChanges[t][n])this.deletedStates[t][n][r]=null}else this.deletedStates[t][n]=null;else this.deletedStates[t]=null}getState(t,e){let r=String(e),i=this.state[t]||{},n=this.stateChanges[t]||{},a=B({},i[r],n[r]);if(this.deletedStates[t]===null)return{};if(this.deletedStates[t]){let s=this.deletedStates[t][e];if(s===null)return{};for(let l in s)delete a[l]}return a}initializeTileState(t,e){t.setFeatureState(this.state,e)}coalesceChanges(t,e){let r={};for(let i in this.stateChanges){this.state[i]=this.state[i]||{};let n={};for(let a in this.stateChanges[i])this.state[i][a]||(this.state[i][a]={}),B(this.state[i][a],this.stateChanges[i][a]),n[a]=this.state[i][a];r[i]=n}for(let i in this.deletedStates){this.state[i]=this.state[i]||{};let n={};if(this.deletedStates[i]===null)for(let a in this.state[i])n[a]={},this.state[i][a]={};else for(let a in this.deletedStates[i]){if(this.deletedStates[i][a]===null)this.state[i][a]={};else for(let l of Object.keys(this.deletedStates[i][a]))delete this.state[i][a][l];n[a]=this.state[i][a]}r[i]=r[i]||{},B(r[i],n)}if(this.stateChanges={},this.deletedStates={},Object.keys(r).length!==0)for(let i in t)t[i].setFeatureState(r,e)}};u(Bp,"SourceFeatureState");var Ea=Bp;var Sr=class Sr extends le{constructor(e,r,i){super();this.id=e,this.dispatcher=i,this.on("data",n=>this._dataHandler(n)),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=ug(e,r,i,this),this._tiles={},this._cache=new Ca(0,n=>this._unloadTile(n)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new Ea,this._didEmitContent=!1,this._updated=!1}onAdd(e){this.map=e,this._maxTileCacheSize=e?e._maxTileCacheSize:null,this._maxTileCacheZoomLevels=e?e._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(e)}onRemove(e){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(e)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;if((this.used!==void 0||this.usedForTerrain!==void 0)&&!this.used&&!this.usedForTerrain)return!0;if(!this._updated)return!1;for(let e in this._tiles){let r=this._tiles[e];if(r.state!=="loaded"&&r.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;let e=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,e&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}async _loadTile(e,r,i){try{await this._source.loadTile(e),this._tileLoaded(e,r,i)}catch(n){e.state="errored",n.status!==404?this._source.fire(new q(n,{tile:e})):this.update(this.transform,this.terrain)}}_unloadTile(e){this._source.unloadTile&&this._source.unloadTile(e)}_abortTile(e){this._source.abortTile&&this._source.abortTile(e),this._source.fire(new C("dataabort",{tile:e,coord:e.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(e){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(let r in this._tiles){let i=this._tiles[r];i.upload(e),i.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(e=>e.tileID).sort(yg).map(e=>e.key)}getRenderableIds(e){let r=[];for(let i in this._tiles)this._isIdRenderable(i,e)&&r.push(this._tiles[i]);return e?r.sort((i,n)=>{let a=i.tileID,s=n.tileID,l=new Op.default(a.canonical.x,a.canonical.y)._rotate(this.transform.angle),c=new Op.default(s.canonical.x,s.canonical.y)._rotate(this.transform.angle);return a.overscaledZ-s.overscaledZ||c.y-l.y||c.x-l.x}).map(i=>i.tileID.key):r.map(i=>i.tileID).sort(yg).map(i=>i.key)}hasRenderableParent(e){let r=this.findLoadedParent(e,0);return r?this._isIdRenderable(r.tileID.key):!1}_isIdRenderable(e,r){return this._tiles[e]&&this._tiles[e].hasData()&&!this._coveredTiles[e]&&(r||!this._tiles[e].holdingForFade())}reload(){if(this._paused){this._shouldReloadOnResume=!0;return}this._cache.reset();for(let e in this._tiles)this._tiles[e].state!=="errored"&&this._reloadTile(e,"reloading")}async _reloadTile(e,r){let i=this._tiles[e];i&&(i.state!=="loading"&&(i.state=r),await this._loadTile(i,e,r))}_tileLoaded(e,r,i){e.timeAdded=$.now(),i==="expired"&&(e.refreshedUponExpiration=!0),this._setTileReloadTimer(r,e),this.getSource().type==="raster-dem"&&e.dem&&this._backfillDEM(e),this._state.initializeTileState(e,this.map?this.map.painter:null),e.aborted||this._source.fire(new C("data",{dataType:"source",tile:e,coord:e.tileID}))}_backfillDEM(e){let r=this.getRenderableIds();for(let n=0;n<r.length;n++){let a=r[n];if(e.neighboringTiles&&e.neighboringTiles[a]){let s=this.getTileByID(a);i(e,s),i(s,e)}}function i(n,a){n.needsHillshadePrepare=!0,n.needsTerrainPrepare=!0;let s=a.tileID.canonical.x-n.tileID.canonical.x,l=a.tileID.canonical.y-n.tileID.canonical.y,c=Math.pow(2,n.tileID.canonical.z),p=a.tileID.key;s===0&&l===0||Math.abs(l)>1||(Math.abs(s)>1&&(Math.abs(s+c)===1?s+=c:Math.abs(s-c)===1&&(s-=c)),!(!a.dem||!n.dem)&&(n.dem.backfillBorder(a.dem,s,l),n.neighboringTiles&&n.neighboringTiles[p]&&(n.neighboringTiles[p].backfilled=!0)))}u(i,"fillBorder")}getTile(e){return this.getTileByID(e.key)}getTileByID(e){return this._tiles[e]}_retainLoadedChildren(e,r,i,n){for(let a in this._tiles){let s=this._tiles[a];if(n[a]||!s.hasData()||s.tileID.overscaledZ<=r||s.tileID.overscaledZ>i)continue;let l=s.tileID;for(;s&&s.tileID.overscaledZ>r+1;){let p=s.tileID.scaledTo(s.tileID.overscaledZ-1);s=this._tiles[p.key],s&&s.hasData()&&(l=p)}let c=l;for(;c.overscaledZ>r;)if(c=c.scaledTo(c.overscaledZ-1),e[c.key]){n[l.key]=l;break}}}findLoadedParent(e,r){if(e.key in this._loadedParentTiles){let i=this._loadedParentTiles[e.key];return i&&i.tileID.overscaledZ>=r?i:null}for(let i=e.overscaledZ-1;i>=r;i--){let n=e.scaledTo(i),a=this._getLoadedTile(n);if(a)return a}}_getLoadedTile(e){let r=this._tiles[e.key];return r&&r.hasData()?r:this._cache.getByKey(e.wrapped().key)}updateCacheSize(e){let r=Math.ceil(e.width/this._source.tileSize)+1,i=Math.ceil(e.height/this._source.tileSize)+1,n=r*i,a=this._maxTileCacheZoomLevels===null?qe.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels,s=Math.floor(n*a),l=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,s):s;this._cache.setMaxSize(l)}handleWrapJump(e){let r=this._prevLng===void 0?e:this._prevLng,n=(e-r)/360,a=Math.round(n);if(this._prevLng=e,a){let s={};for(let l in this._tiles){let c=this._tiles[l];c.tileID=c.tileID.unwrapTo(c.tileID.wrap+a),s[c.tileID.key]=c}this._tiles=s;for(let l in this._timers)clearTimeout(this._timers[l]),delete this._timers[l];for(let l in this._tiles){let c=this._tiles[l];this._setTileReloadTimer(l,c)}}}update(e,r){if(!this._sourceLoaded||this._paused)return;this.transform=e,this.terrain=r,this.updateCacheSize(e),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={};let i;!this.used&&!this.usedForTerrain?i=[]:this._source.tileID?i=e.getVisibleUnwrappedCoordinates(this._source.tileID).map(h=>new Re(h.canonical.z,h.wrap,h.canonical.z,h.canonical.x,h.canonical.y)):(i=e.coveringTiles({tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this.usedForTerrain?!1:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:r}),this._source.hasTile&&(i=i.filter(h=>this._source.hasTile(h))));let n=e.coveringZoomLevel(this._source),a=Math.max(n-Sr.maxOverzooming,this._source.minzoom),s=Math.max(n+Sr.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){let h={};for(let f of i)if(f.canonical.z>this._source.minzoom){let d=f.scaledTo(f.canonical.z-1);h[d.key]=d;let g=f.scaledTo(Math.max(this._source.minzoom,Math.min(f.canonical.z,5)));h[g.key]=g}i=i.concat(Object.values(h))}let l=i.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,l&&this.fire(new C("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));let c=this._updateRetainedTiles(i,n);if(gg(this._source.type)){let h={},f={},d=Object.keys(c),g=$.now();for(let y of d){let _=c[y],w=this._tiles[y];if(!w||w.fadeEndTime!==0&&w.fadeEndTime<=g)continue;let v=this.findLoadedParent(_,a);v&&(this._addTile(v.tileID),h[v.tileID.key]=v.tileID),f[y]=_}this._retainLoadedChildren(f,n,s,c);for(let y in h)c[y]||(this._coveredTiles[y]=!0,c[y]=h[y]);if(r){let y={},_={};for(let w of i)this._tiles[w.key].hasData()?y[w.key]=w:_[w.key]=w;for(let w in _){let v=_[w].children(this._source.maxzoom);this._tiles[v[0].key]&&this._tiles[v[1].key]&&this._tiles[v[2].key]&&this._tiles[v[3].key]&&(y[v[0].key]=c[v[0].key]=v[0],y[v[1].key]=c[v[1].key]=v[1],y[v[2].key]=c[v[2].key]=v[2],y[v[3].key]=c[v[3].key]=v[3],delete _[w])}for(let w in _){let v=this.findLoadedParent(_[w],this._source.minzoom);if(v){y[v.tileID.key]=c[v.tileID.key]=v.tileID;for(let b in y)y[b].isChildOf(v.tileID)&&delete y[b]}}for(let w in this._tiles)y[w]||(this._coveredTiles[w]=!0)}}for(let h in c)this._tiles[h].clearFadeHold();let p=pd(this._tiles,c);for(let h of p){let f=this._tiles[h];f.hasSymbolBuckets&&!f.holdingForFade()?f.setHoldDuration(this.map._fadeDuration):(!f.hasSymbolBuckets||f.symbolFadeFinished())&&this._removeTile(h)}this._updateLoadedParentTileCache()}releaseSymbolFadeTiles(){for(let e in this._tiles)this._tiles[e].holdingForFade()&&this._removeTile(e)}_updateRetainedTiles(e,r){let i={},n={},a=Math.max(r-Sr.maxOverzooming,this._source.minzoom),s=Math.max(r+Sr.maxUnderzooming,this._source.minzoom),l={};for(let c of e){let p=this._addTile(c);i[c.key]=c,!p.hasData()&&r<this._source.maxzoom&&(l[c.key]=c)}this._retainLoadedChildren(l,r,s,i);for(let c of e){let p=this._tiles[c.key];if(p.hasData())continue;if(r+1>this._source.maxzoom){let f=c.children(this._source.maxzoom)[0],d=this.getTile(f);if(d&&d.hasData()){i[f.key]=f;continue}}else{let f=c.children(this._source.maxzoom);if(i[f[0].key]&&i[f[1].key]&&i[f[2].key]&&i[f[3].key])continue}let h=p.wasRequested();for(let f=c.overscaledZ-1;f>=a;--f){let d=c.scaledTo(f);if(n[d.key])break;if(n[d.key]=!0,p=this.getTile(d),!p&&h&&(p=this._addTile(d)),p){let g=p.hasData();if((h||g)&&(i[d.key]=d),h=p.wasRequested(),g)break}}}return i}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(let e in this._tiles){let r=[],i,n=this._tiles[e].tileID;for(;n.overscaledZ>0;){if(n.key in this._loadedParentTiles){i=this._loadedParentTiles[n.key];break}r.push(n.key);let a=n.scaledTo(n.overscaledZ-1);if(i=this._getLoadedTile(a),i)break;n=a}for(let a of r)this._loadedParentTiles[a]=i}}_addTile(e){let r=this._tiles[e.key];if(r)return r;r=this._cache.getAndRemove(e),r&&(this._setTileReloadTimer(e.key,r),r.tileID=e,this._state.initializeTileState(r,this.map?this.map.painter:null),this._cacheTimers[e.key]&&(clearTimeout(this._cacheTimers[e.key]),delete this._cacheTimers[e.key],this._setTileReloadTimer(e.key,r)));let i=r;return r||(r=new ei(e,this._source.tileSize*e.overscaleFactor()),this._loadTile(r,e.key,r.state)),r.uses++,this._tiles[e.key]=r,i||this._source.fire(new C("dataloading",{tile:r,coord:r.tileID,dataType:"source"})),r}_setTileReloadTimer(e,r){e in this._timers&&(clearTimeout(this._timers[e]),delete this._timers[e]);let i=r.getExpiryTimeout();i&&(this._timers[e]=setTimeout(()=>{this._reloadTile(e,"expired"),delete this._timers[e]},i))}_removeTile(e){let r=this._tiles[e];r&&(r.uses--,delete this._tiles[e],this._timers[e]&&(clearTimeout(this._timers[e]),delete this._timers[e]),!(r.uses>0)&&(r.hasData()&&r.state!=="reloading"?this._cache.add(r.tileID,r,r.getExpiryTimeout()):(r.aborted=!0,this._abortTile(r),this._unloadTile(r))))}_dataHandler(e){let r=e.sourceDataType;e.dataType==="source"&&r==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&e.dataType==="source"&&r==="content"&&(this.reload(),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(let e in this._tiles)this._removeTile(e);this._cache.reset()}tilesIn(e,r,i){let n=[],a=this.transform;if(!a)return n;let s=i?a.getCameraQueryGeometry(e):e,l=e.map(y=>a.pointCoordinate(y,this.terrain)),c=s.map(y=>a.pointCoordinate(y,this.terrain)),p=this.getIds(),h=1/0,f=1/0,d=-1/0,g=-1/0;for(let y of c)h=Math.min(h,y.x),f=Math.min(f,y.y),d=Math.max(d,y.x),g=Math.max(g,y.y);for(let y=0;y<p.length;y++){let _=this._tiles[p[y]];if(_.holdingForFade())continue;let w=_.tileID,v=Math.pow(2,a.zoom-_.tileID.overscaledZ),b=r*_.queryPadding*8192/_.tileSize/v,P=[w.getTilePoint(new Te(h,f)),w.getTilePoint(new Te(d,g))];if(P[0].x-b<8192&&P[0].y-b<8192&&P[1].x+b>=0&&P[1].y+b>=0){let S=l.map(L=>w.getTilePoint(L)),A=c.map(L=>w.getTilePoint(L));n.push({tile:_,tileID:w,queryGeometry:S,cameraQueryGeometry:A,scale:v})}}return n}getVisibleCoordinates(e){let r=this.getRenderableIds(e).map(i=>this._tiles[i].tileID);for(let i of r)i.posMatrix=this.transform.calculatePosMatrix(i.toUnwrapped());return r}hasTransition(){if(this._source.hasTransition())return!0;if(gg(this._source.type)){let e=$.now();for(let r in this._tiles)if(this._tiles[r].fadeEndTime>=e)return!0}return!1}setFeatureState(e,r,i){e=e||"_geojsonTileLayer",this._state.updateState(e,r,i)}removeFeatureState(e,r,i){e=e||"_geojsonTileLayer",this._state.removeFeatureState(e,r,i)}getFeatureState(e,r){return e=e||"_geojsonTileLayer",this._state.getState(e,r)}setDependencies(e,r,i){let n=this._tiles[e];n&&n.setDependencies(r,i)}reloadTilesForDependencies(e,r){for(let i in this._tiles)this._tiles[i].hasDependency(e,r)&&this._reloadTile(i,"reloading");this._cache.filter(i=>!i.hasDependency(e,r))}};u(Sr,"SourceCache");var Ct=Sr;Ct.maxOverzooming=10;Ct.maxUnderzooming=3;function yg(o,t){let e=Math.abs(o.wrap*2)-+(o.wrap<0),r=Math.abs(t.wrap*2)-+(t.wrap<0);return o.overscaledZ-t.overscaledZ||r-e||t.canonical.y-o.canonical.y||t.canonical.x-o.canonical.x}u(yg,"compareTileId");function gg(o){return o==="raster"||o==="image"||o==="video"}u(gg,"isRasterType");m();m();m();var ft=re(fe(),1);m();var Et=re(fe(),1);function Vp(o,t,e,r,i){let n=[];for(let a=0;a<o.length;a++){let s=o[a],l;for(let c=0;c<s.length-1;c++){let p=s[c],h=s[c+1];p.x<t&&h.x<t||(p.x<t?p=new Et.default(t,p.y+(h.y-p.y)*((t-p.x)/(h.x-p.x)))._round():h.x<t&&(h=new Et.default(t,p.y+(h.y-p.y)*((t-p.x)/(h.x-p.x)))._round()),!(p.y<e&&h.y<e)&&(p.y<e?p=new Et.default(p.x+(h.x-p.x)*((e-p.y)/(h.y-p.y)),e)._round():h.y<e&&(h=new Et.default(p.x+(h.x-p.x)*((e-p.y)/(h.y-p.y)),e)._round()),!(p.x>=r&&h.x>=r)&&(p.x>=r?p=new Et.default(r,p.y+(h.y-p.y)*((r-p.x)/(h.x-p.x)))._round():h.x>=r&&(h=new Et.default(r,p.y+(h.y-p.y)*((r-p.x)/(h.x-p.x)))._round()),!(p.y>=i&&h.y>=i)&&(p.y>=i?p=new Et.default(p.x+(h.x-p.x)*((i-p.y)/(h.y-p.y)),i)._round():h.y>=i&&(h=new Et.default(p.x+(h.x-p.x)*((i-p.y)/(h.y-p.y)),i)._round()),(!l||!p.equals(l[l.length-1]))&&(l=[p],n.push(l)),l.push(h)))))}}return n}u(Vp,"clipLine");m();var Up=class Up{constructor(t,e){this.reset(t,e)}reset(t,e){this.points=t||[],this._distances=[0];for(let r=1;r<this.points.length;r++)this._distances[r]=this._distances[r-1]+this.points[r].dist(this.points[r-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(e||0,this.length*.5),this.paddedLength=this.length-this.padding*2}lerp(t){if(this.points.length===1)return this.points[0];t=ge(t,0,1);let e=1,r=this._distances[e],i=t*this.paddedLength+this.padding;for(;r<i&&e<this._distances.length;)r=this._distances[++e];let n=e-1,a=this._distances[n],s=r-a,l=s>0?(i-a)/s:0;return this.points[n].mult(1-l).add(this.points[e].mult(l))}};u(Up,"PathInterpolator");var Ma=Up;m();function La(o,t){let e=!0;return o==="always"||(o==="never"||t==="never")&&(e=!1),e}u(La,"overlapAllowed");var Gp=class Gp{constructor(t,e,r){let i=this.boxCells=[],n=this.circleCells=[];this.xCellCount=Math.ceil(t/r),this.yCellCount=Math.ceil(e/r);for(let a=0;a<this.xCellCount*this.yCellCount;a++)i.push([]),n.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=t,this.height=e,this.xScale=this.xCellCount/t,this.yScale=this.yCellCount/e,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(t,e,r,i,n){this._forEachCell(e,r,i,n,this._insertBoxCell,this.boxUid++),this.boxKeys.push(t),this.bboxes.push(e),this.bboxes.push(r),this.bboxes.push(i),this.bboxes.push(n)}insertCircle(t,e,r,i){this._forEachCell(e-i,r-i,e+i,r+i,this._insertCircleCell,this.circleUid++),this.circleKeys.push(t),this.circles.push(e),this.circles.push(r),this.circles.push(i)}_insertBoxCell(t,e,r,i,n,a){this.boxCells[n].push(a)}_insertCircleCell(t,e,r,i,n,a){this.circleCells[n].push(a)}_query(t,e,r,i,n,a,s){if(r<0||t>this.width||i<0||e>this.height)return[];let l=[];if(t<=0&&e<=0&&this.width<=r&&this.height<=i){if(n)return[{key:null,x1:t,y1:e,x2:r,y2:i}];for(let c=0;c<this.boxKeys.length;c++)l.push({key:this.boxKeys[c],x1:this.bboxes[c*4],y1:this.bboxes[c*4+1],x2:this.bboxes[c*4+2],y2:this.bboxes[c*4+3]});for(let c=0;c<this.circleKeys.length;c++){let p=this.circles[c*3],h=this.circles[c*3+1],f=this.circles[c*3+2];l.push({key:this.circleKeys[c],x1:p-f,y1:h-f,x2:p+f,y2:h+f})}}else{let c={hitTest:n,overlapMode:a,seenUids:{box:{},circle:{}}};this._forEachCell(t,e,r,i,this._queryCell,l,c,s)}return l}query(t,e,r,i){return this._query(t,e,r,i,!1,null)}hitTest(t,e,r,i,n,a){return this._query(t,e,r,i,!0,n,a).length>0}hitTestCircle(t,e,r,i,n){let a=t-r,s=t+r,l=e-r,c=e+r;if(s<0||a>this.width||c<0||l>this.height)return!1;let p=[],h={hitTest:!0,overlapMode:i,circle:{x:t,y:e,radius:r},seenUids:{box:{},circle:{}}};return this._forEachCell(a,l,s,c,this._queryCellCircle,p,h,n),p.length>0}_queryCell(t,e,r,i,n,a,s,l){let{seenUids:c,hitTest:p,overlapMode:h}=s,f=this.boxCells[n];if(f!==null){let g=this.bboxes;for(let y of f)if(!c.box[y]){c.box[y]=!0;let _=y*4,w=this.boxKeys[y];if(t<=g[_+2]&&e<=g[_+3]&&r>=g[_+0]&&i>=g[_+1]&&(!l||l(w))&&(!p||!La(h,w.overlapMode))&&(a.push({key:w,x1:g[_],y1:g[_+1],x2:g[_+2],y2:g[_+3]}),p))return!0}}let d=this.circleCells[n];if(d!==null){let g=this.circles;for(let y of d)if(!c.circle[y]){c.circle[y]=!0;let _=y*3,w=this.circleKeys[y];if(this._circleAndRectCollide(g[_],g[_+1],g[_+2],t,e,r,i)&&(!l||l(w))&&(!p||!La(h,w.overlapMode))){let v=g[_],b=g[_+1],P=g[_+2];if(a.push({key:w,x1:v-P,y1:b-P,x2:v+P,y2:b+P}),p)return!0}}}return!1}_queryCellCircle(t,e,r,i,n,a,s,l){let{circle:c,seenUids:p,overlapMode:h}=s,f=this.boxCells[n];if(f!==null){let g=this.bboxes;for(let y of f)if(!p.box[y]){p.box[y]=!0;let _=y*4,w=this.boxKeys[y];if(this._circleAndRectCollide(c.x,c.y,c.radius,g[_+0],g[_+1],g[_+2],g[_+3])&&(!l||l(w))&&!La(h,w.overlapMode))return a.push(!0),!0}}let d=this.circleCells[n];if(d!==null){let g=this.circles;for(let y of d)if(!p.circle[y]){p.circle[y]=!0;let _=y*3,w=this.circleKeys[y];if(this._circlesCollide(g[_],g[_+1],g[_+2],c.x,c.y,c.radius)&&(!l||l(w))&&!La(h,w.overlapMode))return a.push(!0),!0}}}_forEachCell(t,e,r,i,n,a,s,l){let c=this._convertToXCellCoord(t),p=this._convertToYCellCoord(e),h=this._convertToXCellCoord(r),f=this._convertToYCellCoord(i);for(let d=c;d<=h;d++)for(let g=p;g<=f;g++){let y=this.xCellCount*g+d;if(n.call(this,t,e,r,i,y,a,s,l))return}}_convertToXCellCoord(t){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(t*this.xScale)))}_convertToYCellCoord(t){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(t*this.yScale)))}_circlesCollide(t,e,r,i,n,a){let s=i-t,l=n-e,c=r+a;return c*c>s*s+l*l}_circleAndRectCollide(t,e,r,i,n,a,s){let l=(a-i)/2,c=Math.abs(t-(i+l));if(c>l+r)return!1;let p=(s-n)/2,h=Math.abs(e-(n+p));if(h>p+r)return!1;if(c<=l||h<=p)return!0;let f=c-l,d=h-p;return f*f+d*d<=r*r}};u(Gp,"GridIndex");var _n=Gp;m();var ti=re(fe(),1);function xn(o,t,e,r,i){let n=G.create();return t?(G.scale(n,n,[1/i,1/i,1]),e||G.rotateZ(n,n,r.angle)):G.multiply(n,r.labelPlaneMatrix,o),n}u(xn,"getLabelPlaneMatrix");function ka(o,t,e,r,i){if(t){let n=G.clone(o);return G.scale(n,n,[i,i,1]),e||G.rotateZ(n,n,-r.angle),n}else return r.glCoordMatrix}u(ka,"getGlCoordMatrix");function rt(o,t,e){let r;e?(r=[o.x,o.y,e(o.x,o.y),1],ke.transformMat4(r,r,t)):(r=[o.x,o.y,0,1],Fa(r,r,t));let i=r[3];return{point:new ti.default(r[0]/i,r[1]/i),signedDistanceFromCamera:i}}u(rt,"project");function bn(o,t){return .5+.5*(o/t)}u(bn,"getPerspectiveRatio");function Jv(o,t){let e=o[0]/o[3],r=o[1]/o[3];return e>=-t[0]&&e<=t[0]&&r>=-t[1]&&r<=t[1]}u(Jv,"isVisible");function bg(o,t,e,r,i,n,a,s,l,c){let p=r?o.textSizeData:o.iconSizeData,h=xr(p,e.transform.zoom),f=[256/e.width*2+1,256/e.height*2+1],d=r?o.text.dynamicLayoutVertexArray:o.icon.dynamicLayoutVertexArray;d.clear();let g=o.lineVertexArray,y=r?o.text.placedSymbolArray:o.icon.placedSymbolArray,_=e.transform.width/e.transform.height,w=!1;for(let v=0;v<y.length;v++){let b=y.get(v);if(b.hidden||b.writingMode===2&&!w){Tr(b.numGlyphs,d);continue}w=!1;let P;if(c?(P=[b.anchorX,b.anchorY,c(b.anchorX,b.anchorY),1],ke.transformMat4(P,P,t)):(P=[b.anchorX,b.anchorY,0,1],Fa(P,P,t)),!Jv(P,f)){Tr(b.numGlyphs,d);continue}let S=P[3],A=bn(e.transform.cameraToCenterDistance,S),L=Wr(p,h,b),D=a?L/A:L*A,k=new ti.default(b.anchorX,b.anchorY),E=rt(k,i,c).point,U={projections:{},offsets:{}},F=xg(b,D,!1,s,t,i,n,o.glyphOffsetArray,g,d,E,k,U,_,l,c);w=F.useVertical,(F.notEnoughRoom||w||F.needsFlipping&&xg(b,D,!0,s,t,i,n,o.glyphOffsetArray,g,d,E,k,U,_,l,c).notEnoughRoom)&&Tr(b.numGlyphs,d)}r?o.text.dynamicLayoutVertexBuffer.updateData(d):o.icon.dynamicLayoutVertexBuffer.updateData(d)}u(bg,"updateLineLabels");function qp(o,t,e,r,i,n,a,s,l,c,p,h,f){let d=s.glyphStartIndex+s.numGlyphs,g=s.lineStartIndex,y=s.lineStartIndex+s.lineLength,_=t.getoffsetX(s.glyphStartIndex),w=t.getoffsetX(d-1),v=Da(o*_,e,r,i,n,a,s.segment,g,y,l,c,p,h,f);if(!v)return null;let b=Da(o*w,e,r,i,n,a,s.segment,g,y,l,c,p,h,f);return b?{first:v,last:b}:null}u(qp,"placeFirstAndLastGlyph");function _g(o,t,e,r){if(o===1){let i=Math.abs(e.y-t.y),n=Math.abs(e.x-t.x)*r;if(i>n)return{useVertical:!0}}return(o===2?t.y<e.y:t.x>e.x)?{needsFlipping:!0}:null}u(_g,"requiresOrientationChange");function xg(o,t,e,r,i,n,a,s,l,c,p,h,f,d,g,y){let _=t/24,w=o.lineOffsetX*_,v=o.lineOffsetY*_,b;if(o.numGlyphs>1){let P=o.glyphStartIndex+o.numGlyphs,S=o.lineStartIndex,A=o.lineStartIndex+o.lineLength,L=qp(_,s,w,v,e,p,h,o,l,n,f,g,y);if(!L)return{notEnoughRoom:!0};let D=rt(L.first.point,a,y).point,k=rt(L.last.point,a,y).point;if(r&&!e){let E=_g(o.writingMode,D,k,d);if(E)return E}b=[L.first];for(let E=o.glyphStartIndex+1;E<P-1;E++)b.push(Da(_*s.getoffsetX(E),w,v,e,p,h,o.segment,S,A,l,n,f,g,y));b.push(L.last)}else{if(r&&!e){let S=rt(h,i,y).point,A=o.lineStartIndex+o.segment+1,L=new ti.default(l.getx(A),l.gety(A)),D=rt(L,i,y),k=D.signedDistanceFromCamera>0?D.point:vg(h,L,S,1,i,y),E=_g(o.writingMode,S,k,d);if(E)return E}let P=Da(_*s.getoffsetX(o.glyphStartIndex),w,v,e,p,h,o.segment,o.lineStartIndex,o.lineStartIndex+o.lineLength,l,n,f,g,y);if(!P)return{notEnoughRoom:!0};b=[P]}for(let P of b)br(c,P.point,P.angle);return{}}u(xg,"placeGlyphsAlongLine");function vg(o,t,e,r,i,n){let a=rt(o.add(o.sub(t)._unit()),i,n).point,s=e.sub(a);return e.add(s._mult(r/s.mag()))}u(vg,"projectTruncatedLineSegment");function Np(o,t){let{projectionCache:e,lineVertexArray:r,labelPlaneMatrix:i,tileAnchorPoint:n,distanceFromAnchor:a,getElevation:s,previousVertex:l,direction:c,absOffsetX:p}=t;if(e.projections[o])return e.projections[o];let h=new ti.default(r.getx(o),r.gety(o)),f=rt(h,i,s);if(f.signedDistanceFromCamera>0)return e.projections[o]=f.point,f.point;let d=o-c,g=a===0?n:new ti.default(r.getx(d),r.gety(d));return vg(g,h,l,p-a+1,i,s)}u(Np,"projectVertexToViewport");function jp(o,t,e){return o._unit()._perp()._mult(t*e)}u(jp,"transformToOffsetNormal");function Yv(o,t,e,r,i,n,a,s){let{projectionCache:l,direction:c}=s;if(l.offsets[o])return l.offsets[o];let p=e.add(t);if(o+c<r||o+c>=i)return l.offsets[o]=p,p;let h=Np(o+c,s),f=jp(h.sub(e),a,c),d=e.add(f),g=h.add(f);return l.offsets[o]=dd(n,p,d,g)||p,l.offsets[o]}u(Yv,"findOffsetIntersectionPoint");function Da(o,t,e,r,i,n,a,s,l,c,p,h,f,d){let g=r?o-t:o+t,y=g>0?1:-1,_=0;r&&(y*=-1,_=Math.PI),y<0&&(_+=Math.PI);let w=y>0?s+a:s+a+1,v=i,b=i,P,S,A=0,L=0,D=Math.abs(g),k=[],E;for(;A+L<=D;){if(w+=y,w<s||w>=l)return null;A+=L,b=v,S=P;let N={projectionCache:h,lineVertexArray:c,labelPlaneMatrix:p,tileAnchorPoint:n,distanceFromAnchor:A,getElevation:d,previousVertex:b,direction:y,absOffsetX:D};if(v=Np(w,N),e===0)k.push(b),E=v.sub(b);else{let z,W=v.sub(b);if(W.mag()===0){let te=Np(w+y,N);z=jp(te.sub(v),e,y)}else z=jp(W,e,y);S||(S=b.add(z)),P=Yv(w,z,v,s,l,S,e,N),k.push(S),E=P.sub(S)}L=E.mag()}let U=(D-A)/L,F=E._mult(U)._add(S||b),M=_+Math.atan2(v.y-b.y,v.x-b.x);return k.push(F),{point:F,angle:f?M:0,path:k}}u(Da,"placeGlyphAlongLine");var Qv=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function Tr(o,t){for(let e=0;e<o;e++){let r=t.length;t.resize(r+4),t.float32.set(Qv,r*3)}}u(Tr,"hideGlyphs");function Fa(o,t,e){let r=t[0],i=t[1];return o[0]=e[0]*r+e[4]*i+e[12],o[1]=e[1]*r+e[5]*i+e[13],o[3]=e[3]*r+e[7]*i+e[15],o}u(Fa,"xyTransformMat4");var Fe=100,Hp=class Hp{constructor(t,e=new _n(t.width+2*Fe,t.height+2*Fe,25),r=new _n(t.width+2*Fe,t.height+2*Fe,25)){this.transform=t,this.grid=e,this.ignoredGrid=r,this.pitchfactor=Math.cos(t._pitch)*t.cameraToCenterDistance,this.screenRightBoundary=t.width+Fe,this.screenBottomBoundary=t.height+Fe,this.gridRightBoundary=t.width+2*Fe,this.gridBottomBoundary=t.height+2*Fe,this.perspectiveRatioCutoff=.6}placeCollisionBox(t,e,r,i,n,a){let s=this.projectAndGetPerspectiveRatio(i,t.anchorPointX,t.anchorPointY,a),l=r*s.perspectiveRatio,c=t.x1*l+s.point.x,p=t.y1*l+s.point.y,h=t.x2*l+s.point.x,f=t.y2*l+s.point.y;return!this.isInsideGrid(c,p,h,f)||e!=="always"&&this.grid.hitTest(c,p,h,f,e,n)||s.perspectiveRatio<this.perspectiveRatioCutoff?{box:[],offscreen:!1}:{box:[c,p,h,f],offscreen:this.isOffscreen(c,p,h,f)}}placeCollisionCircles(t,e,r,i,n,a,s,l,c,p,h,f,d,g){let y=[],_=new ft.default(e.anchorX,e.anchorY),w=rt(_,a,g),v=bn(this.transform.cameraToCenterDistance,w.signedDistanceFromCamera),P=(p?n/v:n*v)/Wt,S=rt(_,s,g).point,A={projections:{},offsets:{}},L=e.lineOffsetX*P,D=e.lineOffsetY*P,k=qp(P,i,L,D,!1,S,_,e,r,s,A,!1,g),E=!1,U=!1,F=!0;if(k){let M=f*.5*v+d,N=new ft.default(-Fe,-Fe),z=new ft.default(this.screenRightBoundary,this.screenBottomBoundary),W=new Ma,te=k.first,K=k.last,H=[];for(let ne=te.path.length-1;ne>=1;ne--)H.push(te.path[ne]);for(let ne=1;ne<K.path.length;ne++)H.push(K.path[ne]);let ze=M*2.5;if(l){let ne=H.map(ye=>rt(ye,l,g));ne.some(ye=>ye.signedDistanceFromCamera<=0)?H=[]:H=ne.map(ye=>ye.point)}let Ae=[];if(H.length>0){let ne=H[0].clone(),ye=H[0].clone();for(let Be=1;Be<H.length;Be++)ne.x=Math.min(ne.x,H[Be].x),ne.y=Math.min(ne.y,H[Be].y),ye.x=Math.max(ye.x,H[Be].x),ye.y=Math.max(ye.y,H[Be].y);ne.x>=N.x&&ye.x<=z.x&&ne.y>=N.y&&ye.y<=z.y?Ae=[H]:ye.x<N.x||ne.x>z.x||ye.y<N.y||ne.y>z.y?Ae=[]:Ae=Vp([H],N.x,N.y,z.x,z.y)}for(let ne of Ae){W.reset(ne,M*.25);let ye=0;W.length<=.5*M?ye=1:ye=Math.ceil(W.paddedLength/ze)+1;for(let Be=0;Be<ye;Be++){let Dt=Be/Math.max(ye-1,1),kt=W.lerp(Dt),ut=kt.x+Fe,yt=kt.y+Fe;y.push(ut,yt,M,0);let rr=ut-M,gt=yt-M,_t=ut+M,Oe=yt+M;if(F=F&&this.isOffscreen(rr,gt,_t,Oe),U=U||this.isInsideGrid(rr,gt,_t,Oe),t!=="always"&&this.grid.hitTestCircle(ut,yt,M,t,h)&&(E=!0,!c))return{circles:[],offscreen:!1,collisionDetected:E}}}}return{circles:!c&&E||!U||v<this.perspectiveRatioCutoff?[]:y,offscreen:F,collisionDetected:E}}queryRenderedSymbols(t){if(t.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};let e=[],r=1/0,i=1/0,n=-1/0,a=-1/0;for(let p of t){let h=new ft.default(p.x+Fe,p.y+Fe);r=Math.min(r,h.x),i=Math.min(i,h.y),n=Math.max(n,h.x),a=Math.max(a,h.y),e.push(h)}let s=this.grid.query(r,i,n,a).concat(this.ignoredGrid.query(r,i,n,a)),l={},c={};for(let p of s){let h=p.key;if(l[h.bucketInstanceId]===void 0&&(l[h.bucketInstanceId]={}),l[h.bucketInstanceId][h.featureIndex])continue;let f=[new ft.default(p.x1,p.y1),new ft.default(p.x2,p.y1),new ft.default(p.x2,p.y2),new ft.default(p.x1,p.y2)];qo(e,f)&&(l[h.bucketInstanceId][h.featureIndex]=!0,c[h.bucketInstanceId]===void 0&&(c[h.bucketInstanceId]=[]),c[h.bucketInstanceId].push(h.featureIndex))}return c}insertCollisionBox(t,e,r,i,n,a){let s=r?this.ignoredGrid:this.grid,l={bucketInstanceId:i,featureIndex:n,collisionGroupID:a,overlapMode:e};s.insert(l,t[0],t[1],t[2],t[3])}insertCollisionCircles(t,e,r,i,n,a){let s=r?this.ignoredGrid:this.grid,l={bucketInstanceId:i,featureIndex:n,collisionGroupID:a,overlapMode:e};for(let c=0;c<t.length;c+=4)s.insertCircle(l,t[c],t[c+1],t[c+2])}projectAndGetPerspectiveRatio(t,e,r,i){let n;return i?(n=[e,r,i(e,r),1],ke.transformMat4(n,n,t)):(n=[e,r,0,1],Fa(n,n,t)),{point:new ft.default((n[0]/n[3]+1)/2*this.transform.width+Fe,(-n[1]/n[3]+1)/2*this.transform.height+Fe),perspectiveRatio:.5+.5*(this.transform.cameraToCenterDistance/n[3])}}isOffscreen(t,e,r,i){return r<Fe||t>=this.screenRightBoundary||i<Fe||e>this.screenBottomBoundary}isInsideGrid(t,e,r,i){return r>=0&&t<this.gridRightBoundary&&i>=0&&e<this.gridBottomBoundary}getViewportMatrix(){let t=G.identity([]);return G.translate(t,t,[-Fe,-Fe,0]),t}};u(Hp,"CollisionIndex");var Ra=Hp;m();m();var wg=re(fe(),1);var za=class za extends wg.default{constructor(e,r,i,n){super(e,r);this.angle=i,n!==void 0&&(this.segment=n)}clone(){return new za(this.x,this.y,this.angle,this.segment)}};u(za,"Anchor");var vn=za;V("Anchor",vn);m();m();m();var e0=re(fe(),1);m();var t0=re(fe(),1);m();var r0=re(fe(),1);var n0=re(Qf(),1);m();var wn=(n=>(n[n.center=1]="center",n[n.left=2]="left",n[n.right=3]="right",n[n.top=4]="top",n[n.bottom=5]="bottom",n[n["top-left"]=6]="top-left",n[n["top-right"]=7]="top-right",n[n["bottom-left"]=8]="bottom-left",n[n["bottom-right"]=9]="bottom-right",n))(wn||{});var i0=Number.POSITIVE_INFINITY;function Pg(o){switch(o){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}u(Pg,"getAnchorJustification");m();function Le(o,t,e){return t*(8192/(o.tileSize*Math.pow(2,e-o.tileID.overscaledZ)))}u(Le,"pixelsToTileUnits");var Ga=re(fe(),1);var Jp=class Jp{constructor(t,e,r,i){t?this.opacity=Math.max(0,Math.min(1,t.opacity+(t.placed?e:-e))):this.opacity=i&&r?1:0,this.placed=r}isHidden(){return this.opacity===0&&!this.placed}};u(Jp,"OpacityState");var Oa=Jp,Yp=class Yp{constructor(t,e,r,i,n){this.text=new Oa(t?t.text:null,e,r,n),this.icon=new Oa(t?t.icon:null,e,i,n)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}};u(Yp,"JointOpacityState");var Ar=Yp,Qp=class Qp{constructor(t,e,r){this.text=t,this.icon=e,this.skipFade=r}};u(Qp,"JointPlacement");var Va=Qp,eh=class eh{constructor(){this.invProjMatrix=G.create(),this.viewportMatrix=G.create(),this.circles=[]}};u(eh,"CollisionCircleArray");var Kp=eh,th=class th{constructor(t,e,r,i,n){this.bucketInstanceId=t,this.featureIndex=e,this.sourceLayerIndex=r,this.bucketIndex=i,this.tileID=n}};u(th,"RetainedQueryData");var $p=th,rh=class rh{constructor(t){this.crossSourceCollisions=t,this.maxGroupID=0,this.collisionGroups={}}get(t){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[t]){let e=++this.maxGroupID;this.collisionGroups[t]={ID:e,predicate:r=>r.collisionGroupID===e}}return this.collisionGroups[t]}};u(rh,"CollisionGroups");var Xp=rh;function Sg(o,t,e,r,i){let{horizontalAlign:n,verticalAlign:a}=na(o),s=-(n-.5)*t,l=-(a-.5)*e;return new Ga.default(s+r[0]*i,l+r[1]*i)}u(Sg,"calculateVariableLayoutShift");function Wp(o,t,e,r,i,n){let{x1:a,x2:s,y1:l,y2:c,anchorPointX:p,anchorPointY:h}=o,f=new Ga.default(t,e);return r&&f._rotate(i?n:-n),{x1:a+f.x,y1:l+f.y,x2:s+f.x,y2:c+f.y,anchorPointX:p,anchorPointY:h}}u(Wp,"shiftVariableCollisionBox");var ih=class ih{constructor(t,e,r,i,n){this.transform=t.clone(),this.terrain=e,this.collisionIndex=new Ra(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=r,this.retainedQueryData={},this.collisionGroups=new Xp(i),this.collisionCircleArrays={},this.prevPlacement=n,n&&(n.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(t,e,r,i){let n=r.getBucket(e),a=r.latestFeatureIndex;if(!n||!a||e.id!==n.layerIds[0])return;let s=r.collisionBoxArray,l=n.layers[0].layout,c=Math.pow(2,this.transform.zoom-r.tileID.overscaledZ),p=r.tileSize/8192,h=this.transform.calculatePosMatrix(r.tileID.toUnwrapped()),f=l.get("text-pitch-alignment")==="map",d=l.get("text-rotation-alignment")==="map",g=Le(r,1,this.transform.zoom),y=xn(h,f,d,this.transform,g),_=null;if(f){let v=ka(h,f,d,this.transform,g);_=G.multiply([],this.transform.labelPlaneMatrix,v)}this.retainedQueryData[n.bucketInstanceId]=new $p(n.bucketInstanceId,a,n.sourceLayerIndex,n.index,r.tileID);let w={bucket:n,layout:l,posMatrix:h,textLabelPlaneMatrix:y,labelToScreenMatrix:_,scale:c,textPixelRatio:p,holdingForFade:r.holdingForFade(),collisionBoxArray:s,partiallyEvaluatedTextSize:xr(n.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(n.sourceID)};if(i)for(let v of n.sortKeyRanges){let{sortKey:b,symbolInstanceStart:P,symbolInstanceEnd:S}=v;t.push({sortKey:b,symbolInstanceStart:P,symbolInstanceEnd:S,parameters:w})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:n.symbolInstances.length,parameters:w})}attemptAnchorPlacement(t,e,r,i,n,a,s,l,c,p,h,f,d,g,y,_){let w=wn[t.textAnchor],v=[t.textOffset0,t.textOffset1],b=Sg(w,r,i,v,n),P=this.collisionIndex.placeCollisionBox(Wp(e,b.x,b.y,a,s,this.transform.angle),h,l,c,p.predicate,_);if(!(y&&this.collisionIndex.placeCollisionBox(Wp(y,b.x,b.y,a,s,this.transform.angle),h,l,c,p.predicate,_).box.length===0)&&P.box.length>0){let S;if(this.prevPlacement&&this.prevPlacement.variableOffsets[f.crossTileID]&&this.prevPlacement.placements[f.crossTileID]&&this.prevPlacement.placements[f.crossTileID].text&&(S=this.prevPlacement.variableOffsets[f.crossTileID].anchor),f.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[f.crossTileID]={textOffset:v,width:r,height:i,anchor:w,textBoxScale:n,prevAnchor:S},this.markUsedJustification(d,w,f,g),d.allowVerticalPlacement&&(this.markUsedOrientation(d,g,f),this.placedOrientations[f.crossTileID]=g),{shift:b,placedGlyphBoxes:P}}}placeLayerBucketPart(t,e,r){let{bucket:i,layout:n,posMatrix:a,textLabelPlaneMatrix:s,labelToScreenMatrix:l,textPixelRatio:c,holdingForFade:p,collisionBoxArray:h,partiallyEvaluatedTextSize:f,collisionGroup:d}=t.parameters,g=n.get("text-optional"),y=n.get("icon-optional"),_=Kr(n,"text-overlap","text-allow-overlap"),w=_==="always",v=Kr(n,"icon-overlap","icon-allow-overlap"),b=v==="always",P=n.get("text-rotation-alignment")==="map",S=n.get("text-pitch-alignment")==="map",A=n.get("icon-text-fit")!=="none",L=n.get("symbol-z-order")==="viewport-y",D=w&&(b||!i.hasIconData()||y),k=b&&(w||!i.hasTextData()||g);!i.collisionArrays&&h&&i.deserializeCollisionBoxes(h);let E=this.retainedQueryData[i.bucketInstanceId].tileID,U=this.terrain?(M,N)=>this.terrain.getElevation(E,M,N):null,F=u((M,N)=>{var gt,_t;if(e[M.crossTileID])return;if(p){this.placements[M.crossTileID]=new Va(!1,!1,!1);return}let z=!1,W=!1,te=!0,K=null,H={box:null,offscreen:null},ze={box:null,offscreen:null},Ae=null,ne=null,ye=null,Be=0,Dt=0,kt=0;N.textFeatureIndex?Be=N.textFeatureIndex:M.useRuntimeCollisionCircles&&(Be=M.featureIndex),N.verticalTextFeatureIndex&&(Dt=N.verticalTextFeatureIndex);let ut=N.textBox;if(ut){let Oe=u(Me=>{let $e=1;if(i.allowVerticalPlacement&&!Me&&this.prevPlacement){let xt=this.prevPlacement.placedOrientations[M.crossTileID];xt&&(this.placedOrientations[M.crossTileID]=xt,$e=xt,this.markUsedOrientation(i,$e,M))}return $e},"updatePreviousOrientationIfNotPlaced"),je=u((Me,$e)=>{if(i.allowVerticalPlacement&&M.numVerticalGlyphVertices>0&&N.verticalTextBox){for(let xt of i.writingModes)if(xt===2?(H=$e(),ze=H):H=Me(),H&&H.box&&H.box.length)break}else H=Me()},"placeTextForPlacementModes"),Ve=M.textAnchorOffsetStartIndex,ir=M.textAnchorOffsetEndIndex;if(ir===Ve){let Me=u((nr,Jn)=>{let Ue=this.collisionIndex.placeCollisionBox(nr,_,c,a,d.predicate,U);return Ue&&Ue.box&&Ue.box.length&&(this.markUsedOrientation(i,Jn,M),this.placedOrientations[M.crossTileID]=Jn),Ue},"placeBox");je(u(()=>Me(ut,1),"placeHorizontal"),u(()=>{let nr=N.verticalTextBox;return i.allowVerticalPlacement&&M.numVerticalGlyphVertices>0&&nr?Me(nr,2):{box:null,offscreen:null}},"placeVertical")),Oe(H&&H.box&&H.box.length)}else{let Me=wn[(_t=(gt=this.prevPlacement)==null?void 0:gt.variableOffsets[M.crossTileID])==null?void 0:_t.anchor],$e=u((Ue,wl,fb)=>{let db=Ue.x2-Ue.x1,yb=Ue.y2-Ue.y1,gb=M.textBoxScale,_b=A&&v==="never"?wl:null,Mr={box:[],offscreen:!1},Rf=_==="never"?1:2,zf="never";Me&&Rf++;for(let Bf=0;Bf<Rf;Bf++){for(let Pl=Ve;Pl<ir;Pl++){let Of=i.textAnchorOffsets.get(Pl);if(Me&&Of.textAnchor!==Me)continue;let Sl=this.attemptAnchorPlacement(Of,Ue,db,yb,gb,P,S,c,a,d,zf,M,i,fb,_b,U);if(Sl&&(Mr=Sl.placedGlyphBoxes,Mr&&Mr.box&&Mr.box.length))return z=!0,K=Sl.shift,Mr}Me?Me=null:zf=_}return Mr},"placeBoxForVariableAnchors");je(u(()=>$e(ut,N.iconBox,1),"placeHorizontal"),u(()=>{let Ue=N.verticalTextBox,wl=H&&H.box&&H.box.length;return i.allowVerticalPlacement&&!wl&&M.numVerticalGlyphVertices>0&&Ue?$e(Ue,N.verticalIconBox,2):{box:null,offscreen:null}},"placeVertical")),H&&(z=H.box,te=H.offscreen);let Jn=Oe(H&&H.box);if(!z&&this.prevPlacement){let Ue=this.prevPlacement.variableOffsets[M.crossTileID];Ue&&(this.variableOffsets[M.crossTileID]=Ue,this.markUsedJustification(i,Ue.anchor,M,Jn))}}}if(Ae=H,z=Ae&&Ae.box&&Ae.box.length>0,te=Ae&&Ae.offscreen,M.useRuntimeCollisionCircles){let Oe=i.text.placedSymbolArray.get(M.centerJustifiedTextSymbolIndex),je=Wr(i.textSizeData,f,Oe),Ve=n.get("text-padding"),ir=M.collisionCircleDiameter;ne=this.collisionIndex.placeCollisionCircles(_,Oe,i.lineVertexArray,i.glyphOffsetArray,je,a,s,l,r,S,d.predicate,ir,Ve,U),ne.circles.length&&ne.collisionDetected&&!r&&ve("Collisions detected, but collision boxes are not shown"),z=w||ne.circles.length>0&&!ne.collisionDetected,te=te&&ne.offscreen}if(N.iconFeatureIndex&&(kt=N.iconFeatureIndex),N.iconBox){let Oe=u(je=>{let Ve=A&&K?Wp(je,K.x,K.y,P,S,this.transform.angle):je;return this.collisionIndex.placeCollisionBox(Ve,v,c,a,d.predicate,U)},"placeIconFeature");ze&&ze.box&&ze.box.length&&N.verticalIconBox?(ye=Oe(N.verticalIconBox),W=ye.box.length>0):(ye=Oe(N.iconBox),W=ye.box.length>0),te=te&&ye.offscreen}let yt=g||M.numHorizontalGlyphVertices===0&&M.numVerticalGlyphVertices===0,rr=y||M.numIconVertices===0;if(!yt&&!rr?W=z=W&&z:rr?yt||(W=W&&z):z=W&&z,z&&Ae&&Ae.box&&(ze&&ze.box&&Dt?this.collisionIndex.insertCollisionBox(Ae.box,_,n.get("text-ignore-placement"),i.bucketInstanceId,Dt,d.ID):this.collisionIndex.insertCollisionBox(Ae.box,_,n.get("text-ignore-placement"),i.bucketInstanceId,Be,d.ID)),W&&ye&&this.collisionIndex.insertCollisionBox(ye.box,v,n.get("icon-ignore-placement"),i.bucketInstanceId,kt,d.ID),ne&&(z&&this.collisionIndex.insertCollisionCircles(ne.circles,_,n.get("text-ignore-placement"),i.bucketInstanceId,Be,d.ID),r)){let Oe=i.bucketInstanceId,je=this.collisionCircleArrays[Oe];je===void 0&&(je=this.collisionCircleArrays[Oe]=new Kp);for(let Ve=0;Ve<ne.circles.length;Ve+=4)je.circles.push(ne.circles[Ve+0]),je.circles.push(ne.circles[Ve+1]),je.circles.push(ne.circles[Ve+2]),je.circles.push(ne.collisionDetected?1:0)}if(M.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");if(i.bucketInstanceId===0)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[M.crossTileID]=new Va(z||D,W||k,te||i.justReloaded),e[M.crossTileID]=!0},"placeSymbol");if(L){if(t.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");let M=i.getSortedSymbolIndexes(this.transform.angle);for(let N=M.length-1;N>=0;--N){let z=M[N];F(i.symbolInstances.get(z),i.collisionArrays[z])}}else for(let M=t.symbolInstanceStart;M<t.symbolInstanceEnd;M++)F(i.symbolInstances.get(M),i.collisionArrays[M]);if(r&&i.bucketInstanceId in this.collisionCircleArrays){let M=this.collisionCircleArrays[i.bucketInstanceId];G.invert(M.invProjMatrix,a),M.viewportMatrix=this.collisionIndex.getViewportMatrix()}i.justReloaded=!1}markUsedJustification(t,e,r,i){let n={left:r.leftJustifiedTextSymbolIndex,center:r.centerJustifiedTextSymbolIndex,right:r.rightJustifiedTextSymbolIndex},a;i===2?a=r.verticalPlacedTextSymbolIndex:a=n[Pg(e)];let s=[r.leftJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.rightJustifiedTextSymbolIndex,r.verticalPlacedTextSymbolIndex];for(let l of s)l>=0&&(a>=0&&l!==a?t.text.placedSymbolArray.get(l).crossTileID=0:t.text.placedSymbolArray.get(l).crossTileID=r.crossTileID)}markUsedOrientation(t,e,r){let i=e===1||e===3?e:0,n=e===2?e:0,a=[r.leftJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.rightJustifiedTextSymbolIndex];for(let s of a)t.text.placedSymbolArray.get(s).placedOrientation=i;r.verticalPlacedTextSymbolIndex&&(t.text.placedSymbolArray.get(r.verticalPlacedTextSymbolIndex).placedOrientation=n)}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;let e=this.prevPlacement,r=!1;this.prevZoomAdjustment=e?e.zoomAdjustment(this.transform.zoom):0;let i=e?e.symbolFadeChange(t):1,n=e?e.opacities:{},a=e?e.variableOffsets:{},s=e?e.placedOrientations:{};for(let l in this.placements){let c=this.placements[l],p=n[l];p?(this.opacities[l]=new Ar(p,i,c.text,c.icon),r=r||c.text!==p.text.placed||c.icon!==p.icon.placed):(this.opacities[l]=new Ar(null,i,c.text,c.icon,c.skipFade),r=r||c.text||c.icon)}for(let l in n){let c=n[l];if(!this.opacities[l]){let p=new Ar(c,i,!1,!1);p.isHidden()||(this.opacities[l]=p,r=r||c.text.placed||c.icon.placed)}}for(let l in a)!this.variableOffsets[l]&&this.opacities[l]&&!this.opacities[l].isHidden()&&(this.variableOffsets[l]=a[l]);for(let l in s)!this.placedOrientations[l]&&this.opacities[l]&&!this.opacities[l].isHidden()&&(this.placedOrientations[l]=s[l]);if(e&&e.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");r?this.lastPlacementChangeTime=t:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=e?e.lastPlacementChangeTime:t)}updateLayerOpacities(t,e){let r={};for(let i of e){let n=i.getBucket(t);n&&i.latestFeatureIndex&&t.id===n.layerIds[0]&&this.updateBucketOpacities(n,r,i.collisionBoxArray)}}updateBucketOpacities(t,e,r){t.hasTextData()&&(t.text.opacityVertexArray.clear(),t.text.hasVisibleVertices=!1),t.hasIconData()&&(t.icon.opacityVertexArray.clear(),t.icon.hasVisibleVertices=!1),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexArray.clear(),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexArray.clear();let i=t.layers[0],n=i.layout,a=new Ar(null,0,!1,!1,!0),s=n.get("text-allow-overlap"),l=n.get("icon-allow-overlap"),c=i._unevaluatedLayout.hasValue("text-variable-anchor")||i._unevaluatedLayout.hasValue("text-variable-anchor-offset"),p=n.get("text-rotation-alignment")==="map",h=n.get("text-pitch-alignment")==="map",f=n.get("icon-text-fit")!=="none",d=new Ar(null,0,s&&(l||!t.hasIconData()||n.get("icon-optional")),l&&(s||!t.hasTextData()||n.get("text-optional")),!0);!t.collisionArrays&&r&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(r);let g=u((y,_,w)=>{for(let v=0;v<_/4;v++)y.opacityVertexArray.emplaceBack(w);y.hasVisibleVertices=y.hasVisibleVertices||w!==Pn},"addOpacities");for(let y=0;y<t.symbolInstances.length;y++){let _=t.symbolInstances.get(y),{numHorizontalGlyphVertices:w,numVerticalGlyphVertices:v,crossTileID:b}=_,P=e[b],S=this.opacities[b];P?S=a:S||(S=d,this.opacities[b]=S),e[b]=!0;let A=w>0||v>0,L=_.numIconVertices>0,D=this.placedOrientations[_.crossTileID],k=D===2,E=D===1||D===3;if(A){let U=Tg(S.text),F=k?Pn:U;g(t.text,w,F);let M=E?Pn:U;g(t.text,v,M);let N=S.text.isHidden();[_.rightJustifiedTextSymbolIndex,_.centerJustifiedTextSymbolIndex,_.leftJustifiedTextSymbolIndex].forEach(te=>{te>=0&&(t.text.placedSymbolArray.get(te).hidden=N||k?1:0)}),_.verticalPlacedTextSymbolIndex>=0&&(t.text.placedSymbolArray.get(_.verticalPlacedTextSymbolIndex).hidden=N||E?1:0);let z=this.variableOffsets[_.crossTileID];z&&this.markUsedJustification(t,z.anchor,_,D);let W=this.placedOrientations[_.crossTileID];W&&(this.markUsedJustification(t,"left",_,W),this.markUsedOrientation(t,W,_))}if(L){let U=Tg(S.icon),F=!(f&&_.verticalPlacedIconSymbolIndex&&k);if(_.placedIconSymbolIndex>=0){let M=F?U:Pn;g(t.icon,_.numIconVertices,M),t.icon.placedSymbolArray.get(_.placedIconSymbolIndex).hidden=S.icon.isHidden()}if(_.verticalPlacedIconSymbolIndex>=0){let M=F?Pn:U;g(t.icon,_.numVerticalIconVertices,M),t.icon.placedSymbolArray.get(_.verticalPlacedIconSymbolIndex).hidden=S.icon.isHidden()}}if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){let U=t.collisionArrays[y];if(U){let F=new Ga.default(0,0);if(U.textBox||U.verticalTextBox){let N=!0;if(c){let z=this.variableOffsets[b];z?(F=Sg(z.anchor,z.width,z.height,z.textOffset,z.textBoxScale),p&&F._rotate(h?this.transform.angle:-this.transform.angle)):N=!1}U.textBox&&Ba(t.textCollisionBox.collisionVertexArray,S.text.placed,!N||k,F.x,F.y),U.verticalTextBox&&Ba(t.textCollisionBox.collisionVertexArray,S.text.placed,!N||E,F.x,F.y)}let M=!!(!E&&U.verticalIconBox);U.iconBox&&Ba(t.iconCollisionBox.collisionVertexArray,S.icon.placed,M,f?F.x:0,f?F.y:0),U.verticalIconBox&&Ba(t.iconCollisionBox.collisionVertexArray,S.icon.placed,!M,f?F.x:0,f?F.y:0)}}}if(t.sortFeatures(this.transform.angle),this.retainedQueryData[t.bucketInstanceId]&&(this.retainedQueryData[t.bucketInstanceId].featureSortOrder=t.featureSortOrder),t.hasTextData()&&t.text.opacityVertexBuffer&&t.text.opacityVertexBuffer.updateData(t.text.opacityVertexArray),t.hasIconData()&&t.icon.opacityVertexBuffer&&t.icon.opacityVertexBuffer.updateData(t.icon.opacityVertexArray),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexBuffer&&t.iconCollisionBox.collisionVertexBuffer.updateData(t.iconCollisionBox.collisionVertexArray),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexBuffer&&t.textCollisionBox.collisionVertexBuffer.updateData(t.textCollisionBox.collisionVertexArray),t.text.opacityVertexArray.length!==t.text.layoutVertexArray.length/4)throw new Error("bucket.text.opacityVertexArray.length (= ".concat(t.text.opacityVertexArray.length,") !== bucket.text.layoutVertexArray.length (= ").concat(t.text.layoutVertexArray.length,") / 4"));if(t.icon.opacityVertexArray.length!==t.icon.layoutVertexArray.length/4)throw new Error("bucket.icon.opacityVertexArray.length (= ".concat(t.icon.opacityVertexArray.length,") !== bucket.icon.layoutVertexArray.length (= ").concat(t.icon.layoutVertexArray.length,") / 4"));if(t.bucketInstanceId in this.collisionCircleArrays){let y=this.collisionCircleArrays[t.bucketInstanceId];t.placementInvProjMatrix=y.invProjMatrix,t.placementViewportMatrix=y.viewportMatrix,t.collisionCircleArray=y.circles,delete this.collisionCircleArrays[t.bucketInstanceId]}}symbolFadeChange(t){return this.fadeDuration===0?1:(t-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(t){return Math.max(0,(this.transform.zoom-t)/1.5)}hasTransitions(t){return this.stale||t-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(t,e){let r=this.zoomAtLastRecencyCheck===e?1-this.zoomAdjustment(e):1;return this.zoomAtLastRecencyCheck=e,this.commitTime+this.fadeDuration*r>t}setStale(){this.stale=!0}};u(ih,"Placement");var Ua=ih;function Ba(o,t,e,r,i){o.emplaceBack(t?1:0,e?1:0,r||0,i||0),o.emplaceBack(t?1:0,e?1:0,r||0,i||0),o.emplaceBack(t?1:0,e?1:0,r||0,i||0),o.emplaceBack(t?1:0,e?1:0,r||0,i||0)}u(Ba,"updateCollisionVertices");var o0=Math.pow(2,25),a0=Math.pow(2,24),s0=Math.pow(2,17),l0=Math.pow(2,16),u0=Math.pow(2,9),c0=Math.pow(2,8),p0=Math.pow(2,1);function Tg(o){if(o.opacity===0&&!o.placed)return 0;if(o.opacity===1&&o.placed)return 4294967295;let t=o.placed?1:0,e=Math.floor(o.opacity*127);return e*o0+t*a0+e*s0+t*l0+e*u0+t*c0+e*p0+t}u(Tg,"packOpacity");var Pn=0;var oh=class oh{constructor(t){this._sortAcrossTiles=t.layout.get("symbol-z-order")!=="viewport-y"&&!t.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(t,e,r,i,n){let a=this._bucketParts;for(;this._currentTileIndex<t.length;){let s=t[this._currentTileIndex];if(e.getBucketParts(a,i,s,this._sortAcrossTiles),this._currentTileIndex++,n())return!0}for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,a.sort((s,l)=>s.sortKey-l.sortKey));this._currentPartIndex<a.length;){let s=a[this._currentPartIndex];if(e.placeLayerBucketPart(s,this._seenCrossTileIDs,r),this._currentPartIndex++,n())return!0}return!1}};u(oh,"LayerPlacement");var nh=oh,ah=class ah{constructor(t,e,r,i,n,a,s,l){this.placement=new Ua(t,e,a,s,l),this._currentPlacementIndex=r.length-1,this._forceFullPlacement=i,this._showCollisionBoxes=n,this._done=!1}isDone(){return this._done}continuePlacement(t,e,r){let i=$.now(),n=u(()=>this._forceFullPlacement?!1:$.now()-i>2,"shouldPausePlacement");for(;this._currentPlacementIndex>=0;){let a=t[this._currentPlacementIndex],s=e[a],l=this.placement.collisionIndex.transform.zoom;if(s.type==="symbol"&&(!s.minzoom||s.minzoom<=l)&&(!s.maxzoom||s.maxzoom>l)){if(this._inProgressLayer||(this._inProgressLayer=new nh(s)),this._inProgressLayer.continuePlacement(r[s.source],this.placement,this._showCollisionBoxes,s,n))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(t){return this.placement.commit(t),this.placement}};u(ah,"PauseablePlacement");var Na=ah;m();var Sn=512/8192/2,h0=128,ch=class ch{constructor(t,e,r){this.tileID=t;this.bucketInstanceId=r;this._symbolsByKey={};let i=new Map;for(let n=0;n<e.length;n++){let a=e.get(n),s=a.key,l=i.get(s);l?l.push(a):i.set(s,[a])}for(let[n,a]of i){let s=a.map(p=>({x:Math.floor(p.anchorX*Sn),y:Math.floor(p.anchorY*Sn)})),l=a.map(p=>p.crossTileID),c={positions:s,crossTileIDs:l};if(c.positions.length>h0){let p=new od(c.positions.length,16,Uint16Array);for(let{x:h,y:f}of c.positions)p.add(h,f);p.finish(),delete c.positions,c.index=p}this._symbolsByKey[n]=c}}getScaledCoordinates(t,e){let{x:r,y:i,z:n}=this.tileID.canonical,{x:a,y:s,z:l}=e.canonical,c=l-n,p=Sn/Math.pow(2,c),h=(a*8192+t.anchorX)*p,f=(s*8192+t.anchorY)*p,d=r*8192*Sn,g=i*8192*Sn;return{x:Math.floor(h-d),y:Math.floor(f-g)}}findMatches(t,e,r){let i=this.tileID.canonical.z<e.canonical.z?1:Math.pow(2,this.tileID.canonical.z-e.canonical.z);for(let n=0;n<t.length;n++){let a=t.get(n);if(a.crossTileID)continue;let s=this._symbolsByKey[a.key];if(!s)continue;let l=this.getScaledCoordinates(a,e);if(s.index){let c=s.index.range(l.x-i,l.y-i,l.x+i,l.y+i).sort();for(let p of c){let h=s.crossTileIDs[p];if(!r[h]){r[h]=!0,a.crossTileID=h;break}}}else if(s.positions)for(let c=0;c<s.positions.length;c++){let p=s.positions[c],h=s.crossTileIDs[c];if(Math.abs(p.x-l.x)<=i&&Math.abs(p.y-l.y)<=i&&!r[h]){r[h]=!0,a.crossTileID=h;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map(({crossTileIDs:t})=>t)}};u(ch,"TileLayerIndex");var sh=ch,ph=class ph{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}};u(ph,"CrossTileIDs");var lh=ph,hh=class hh{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(t){let e=Math.round((t-this.lng)/360);if(e!==0)for(let r in this.indexes){let i=this.indexes[r],n={};for(let a in i){let s=i[a];s.tileID=s.tileID.unwrapTo(s.tileID.wrap+e),n[s.tileID.key]=s}this.indexes[r]=n}this.lng=t}addBucket(t,e,r){if(this.indexes[t.overscaledZ]&&this.indexes[t.overscaledZ][t.key]){if(this.indexes[t.overscaledZ][t.key].bucketInstanceId===e.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(t.overscaledZ,this.indexes[t.overscaledZ][t.key])}for(let n=0;n<e.symbolInstances.length;n++){let a=e.symbolInstances.get(n);a.crossTileID=0}this.usedCrossTileIDs[t.overscaledZ]||(this.usedCrossTileIDs[t.overscaledZ]={});let i=this.usedCrossTileIDs[t.overscaledZ];for(let n in this.indexes){let a=this.indexes[n];if(Number(n)>t.overscaledZ)for(let s in a){let l=a[s];l.tileID.isChildOf(t)&&l.findMatches(e.symbolInstances,t,i)}else{let s=t.scaledTo(Number(n)),l=a[s.key];l&&l.findMatches(e.symbolInstances,t,i)}}for(let n=0;n<e.symbolInstances.length;n++){let a=e.symbolInstances.get(n);a.crossTileID||(a.crossTileID=r.generate(),i[a.crossTileID]=!0)}return this.indexes[t.overscaledZ]===void 0&&(this.indexes[t.overscaledZ]={}),this.indexes[t.overscaledZ][t.key]=new sh(t,e.symbolInstances,e.bucketInstanceId),!0}removeBucketCrossTileIDs(t,e){for(let r of e.getCrossTileIDsLists())for(let i of r)delete this.usedCrossTileIDs[t][i]}removeStaleBuckets(t){let e=!1;for(let r in this.indexes){let i=this.indexes[r];for(let n in i)t[i[n].bucketInstanceId]||(this.removeBucketCrossTileIDs(r,i[n]),delete i[n],e=!0)}return e}};u(hh,"CrossTileSymbolLayerIndex");var uh=hh,mh=class mh{constructor(){this.layerIndexes={},this.crossTileIDs=new lh,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(t,e,r){let i=this.layerIndexes[t.id];i===void 0&&(i=this.layerIndexes[t.id]=new uh);let n=!1,a={};i.handleWrapJump(r);for(let s of e){let l=s.getBucket(t);!l||t.id!==l.layerIds[0]||(l.bucketInstanceId||(l.bucketInstanceId=++this.maxBucketInstanceId),i.addBucket(s.tileID,l,this.crossTileIDs)&&(n=!0),a[l.bucketInstanceId]=!0)}return i.removeStaleBuckets(a)&&(n=!0),n}pruneUnusedLayers(t){let e={};t.forEach(r=>{e[r]=!0});for(let r in this.layerIndexes)e[r]||delete this.layerIndexes[r]}};u(mh,"CrossTileSymbolIndex");var ri=mh;var ja=u((o,t)=>kr(o,t&&t.filter(e=>e.identifier!=="source.canvas")),"emitValidationErrors"),m0=Jf(),fh=class fh extends le{constructor(e,r={}){super();this._rtlPluginLoaded=u(()=>{for(let e in this.sourceCaches){let r=this.sourceCaches[e].getSource().type;(r==="vector"||r==="geojson")&&this.sourceCaches[e].reload()}},"_rtlPluginLoaded");this.map=e,this.dispatcher=new un(ln(),e._getMapId()),this.dispatcher.registerMessageHandler("GG",(i,n)=>this.getGlyphs(i,n)),this.dispatcher.registerMessageHandler("GI",(i,n)=>this.getImages(i,n)),this.imageManager=new fa,this.imageManager.setEventedParent(this),this.glyphManager=new da(e._requestManager,r.localIdeographFontFamily),this.lineAtlas=new ga(256,512),this.crossTileSymbolIndex=new ri,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new zr,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("SR",yo()),Qt().on(gn,this._rtlPluginLoaded),this.on("data",i=>{if(i.dataType!=="source"||i.sourceDataType!=="metadata")return;let n=this.sourceCaches[i.sourceId];if(!n)return;let a=n.getSource();if(!(!a||!a.vectorLayerIds))for(let s in this._layers){let l=this._layers[s];l.source===a.id&&this._validateLayer(l)}})}loadURL(e,r={},i){this.fire(new C("dataloading",{dataType:"style"})),r.validate=typeof r.validate=="boolean"?r.validate:!0;let n=this.map._requestManager.transformRequest(e,"Style");this._loadStyleRequest=new AbortController,zt(n,this._loadStyleRequest).then(a=>{this._loadStyleRequest=null,this._load(a.data,r,i)}).catch(a=>{this._loadStyleRequest=null,a&&this.fire(new q(a))})}loadJSON(e,r={},i){this.fire(new C("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,$.frameAsync(this._frameRequest).then(()=>{this._frameRequest=null,r.validate=r.validate!==!1,this._load(e,r,i)}).catch(()=>{})}loadEmpty(){this.fire(new C("dataloading",{dataType:"style"})),this._load(m0,{validate:!1})}_load(e,r,i){var a;let n=r.transformStyle?r.transformStyle(i,e):e;if(!(r.validate&&ja(this,Ie(n)))){this._loaded=!0,this.stylesheet=n;for(let s in n.sources)this.addSource(s,n.sources[s],{validate:!1});n.sprite?this._loadSprite(n.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(n.glyphs),this._createLayers(),this.light=new ya(this.stylesheet.light),this.map.setTerrain((a=this.stylesheet.terrain)!=null?a:null),this.fire(new C("data",{dataType:"style"})),this.fire(new C("style.load"))}}_createLayers(){let e=Tl(this.stylesheet.layers);this.dispatcher.broadcast("SL",e),this._order=e.map(r=>r.id),this._layers={},this._serializedLayers=null;for(let r of e){let i=ha(r);i.setEventedParent(this,{layer:{id:r.id}}),this._layers[r.id]=i}}_loadSprite(e,r=!1,i=void 0){this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController;let n;$y(e,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then(a=>{if(this._spriteRequest=null,a)for(let s in a){this._spritesImagesIds[s]=[];let l=this._spritesImagesIds[s]?this._spritesImagesIds[s].filter(c=>!(c in a)):[];for(let c of l)this.imageManager.removeImage(c),this._changedImages[c]=!0;for(let c in a[s]){let p=s==="default"?c:"".concat(s,":").concat(c);this._spritesImagesIds[s].push(p),p in this.imageManager.images?this.imageManager.updateImage(p,a[s][c],!1):this.imageManager.addImage(p,a[s][c]),r&&(this._changedImages[p]=!0)}}}).catch(a=>{this._spriteRequest=null,n=a,this.fire(new q(n))}).finally(()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),r&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new C("data",{dataType:"style"})),i&&i(n)})}_unloadSprite(){for(let e of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(e),this._changedImages[e]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new C("data",{dataType:"style"}))}_validateLayer(e){let r=this.sourceCaches[e.source];if(!r)return;let i=e.sourceLayer;if(!i)return;let n=r.getSource();(n.type==="geojson"||n.vectorLayerIds&&n.vectorLayerIds.indexOf(i)===-1)&&this.fire(new q(new Error('Source layer "'.concat(i,'" ')+'does not exist on source "'.concat(n.id,'" ')+'as specified by style layer "'.concat(e.id,'".'))))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(let e in this.sourceCaches)if(!this.sourceCaches[e].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(e){let r=this._serializedAllLayers();if(!e||e.length===0)return Object.values(r);let i=[];for(let n of e)r[n]&&i.push(r[n]);return i}_serializedAllLayers(){let e=this._serializedLayers;if(e)return e;e=this._serializedLayers={};let r=Object.keys(this._layers);for(let i of r){let n=this._layers[i];n.type!=="custom"&&(e[i]=n.serialize())}return e}hasTransitions(){if(this.light&&this.light.hasTransition())return!0;for(let e in this.sourceCaches)if(this.sourceCaches[e].hasTransition())return!0;for(let e in this._layers)if(this._layers[e].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(e){if(!this._loaded)return;let r=this._changed;if(r){let n=Object.keys(this._updatedLayers),a=Object.keys(this._removedLayers);(n.length||a.length)&&this._updateWorkerLayers(n,a);for(let s in this._updatedSources){let l=this._updatedSources[s];if(l==="reload")this._reloadSource(s);else if(l==="clear")this._clearSource(s);else throw new Error("Invalid action ".concat(l))}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(let s in this._updatedPaintProps)this._layers[s].updateTransitions(e);this.light.updateTransitions(e),this._resetUpdates()}let i={};for(let n in this.sourceCaches){let a=this.sourceCaches[n];i[n]=a.used,a.used=!1}for(let n of this._order){let a=this._layers[n];a.recalculate(e,this._availableImages),!a.isHidden(e.zoom)&&a.source&&(this.sourceCaches[a.source].used=!0)}for(let n in i){let a=this.sourceCaches[n];!!i[n]!=!!a.used&&a.fire(new C("data",{sourceDataType:"visibility",dataType:"source",sourceId:n}))}this.light.recalculate(e),this.z=e.zoom,r&&this.fire(new C("data",{dataType:"style"}))}_updateTilesForChangedImages(){let e=Object.keys(this._changedImages);if(e.length){for(let r in this.sourceCaches)this.sourceCaches[r].reloadTilesForDependencies(["icons","patterns"],e);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(let e in this.sourceCaches)this.sourceCaches[e].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(e,r){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(e),removedIds:r})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(e,r={}){var l;this._checkLoaded();let i=this.serialize();if(e=r.transformStyle?r.transformStyle(i,e):e,((l=r.validate)!=null?l:!0)&&ja(this,Ie(e)))return!1;e=Xe(e),e.layers=Tl(e.layers);let a=Vf(i,e),s=this._getOperationsToPerform(a);if(s.unimplemented.length>0)throw new Error("Unimplemented: ".concat(s.unimplemented.join(", "),"."));if(s.operations.length===0)return!1;for(let c of s.operations)c();return this.stylesheet=e,this._serializedLayers=null,!0}_getOperationsToPerform(e){let r=[],i=[];for(let n of e)switch(n.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":continue;case"addLayer":r.push(()=>this.addLayer.apply(this,n.args));break;case"removeLayer":r.push(()=>this.removeLayer.apply(this,n.args));break;case"setPaintProperty":r.push(()=>this.setPaintProperty.apply(this,n.args));break;case"setLayoutProperty":r.push(()=>this.setLayoutProperty.apply(this,n.args));break;case"setFilter":r.push(()=>this.setFilter.apply(this,n.args));break;case"addSource":r.push(()=>this.addSource.apply(this,n.args));break;case"removeSource":r.push(()=>this.removeSource.apply(this,n.args));break;case"setLayerZoomRange":r.push(()=>this.setLayerZoomRange.apply(this,n.args));break;case"setLight":r.push(()=>this.setLight.apply(this,n.args));break;case"setGeoJSONSourceData":r.push(()=>this.setGeoJSONSourceData.apply(this,n.args));break;case"setGlyphs":r.push(()=>this.setGlyphs.apply(this,n.args));break;case"setSprite":r.push(()=>this.setSprite.apply(this,n.args));break;case"setTerrain":r.push(()=>this.map.setTerrain.apply(this,n.args));break;case"setTransition":r.push(()=>{});break;default:i.push(n.command);break}return{operations:r,unimplemented:i}}addImage(e,r){if(this.getImage(e))return this.fire(new q(new Error('An image named "'.concat(e,'" already exists.'))));this.imageManager.addImage(e,r),this._afterImageUpdated(e)}updateImage(e,r){this.imageManager.updateImage(e,r)}getImage(e){return this.imageManager.getImage(e)}removeImage(e){if(!this.getImage(e))return this.fire(new q(new Error('An image named "'.concat(e,'" does not exist.'))));this.imageManager.removeImage(e),this._afterImageUpdated(e)}_afterImageUpdated(e){this._availableImages=this.imageManager.listImages(),this._changedImages[e]=!0,this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new C("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(e,r,i={}){if(this._checkLoaded(),this.sourceCaches[e]!==void 0)throw new Error('Source "'.concat(e,'" already exists.'));if(!r.type)throw new Error("The type property must be defined, but only the following properties were given: ".concat(Object.keys(r).join(", "),"."));if(["vector","raster","geojson","video","image"].indexOf(r.type)>=0&&this._validate(Ie.source,"sources.".concat(e),r,null,i))return;this.map&&this.map._collectResourceTiming&&(r.collectResourceTiming=!0);let s=this.sourceCaches[e]=new Ct(e,r,this.dispatcher);s.style=this,s.setEventedParent(this,()=>({isSourceLoaded:s.loaded(),source:s.serialize(),sourceId:e})),s.onAdd(this.map),this._changed=!0}removeSource(e){if(this._checkLoaded(),this.sourceCaches[e]===void 0)throw new Error("There is no source with this ID");for(let i in this._layers)if(this._layers[i].source===e)return this.fire(new q(new Error('Source "'.concat(e,'" cannot be removed while layer "').concat(i,'" is using it.'))));let r=this.sourceCaches[e];delete this.sourceCaches[e],delete this._updatedSources[e],r.fire(new C("data",{sourceDataType:"metadata",dataType:"source",sourceId:e})),r.setEventedParent(null),r.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(e,r){if(this._checkLoaded(),this.sourceCaches[e]===void 0)throw new Error("There is no source with this ID=".concat(e));let i=this.sourceCaches[e].getSource();if(i.type!=="geojson")throw new Error("geojsonSource.type is ".concat(i.type,", which is !== 'geojson"));i.setData(r),this._changed=!0}getSource(e){return this.sourceCaches[e]&&this.sourceCaches[e].getSource()}addLayer(e,r,i={}){this._checkLoaded();let n=e.id;if(this.getLayer(n)){this.fire(new q(new Error('Layer "'.concat(n,'" already exists on this map.'))));return}let a;if(e.type==="custom"){if(ja(this,Ky(e)))return;a=ha(e)}else{if("source"in e&&typeof e.source=="object"&&(this.addSource(n,e.source),e=Xe(e),e=B(e,{source:n})),this._validate(Ie.layer,"layers.".concat(n),e,{arrayIndex:-1},i))return;a=ha(e),this._validateLayer(a),a.setEventedParent(this,{layer:{id:n}})}let s=r?this._order.indexOf(r):this._order.length;if(r&&s===-1){this.fire(new q(new Error('Cannot add layer "'.concat(n,'" before non-existing layer "').concat(r,'".'))));return}if(this._order.splice(s,0,n),this._layerOrderChanged=!0,this._layers[n]=a,this._removedLayers[n]&&a.source&&a.type!=="custom"){let l=this._removedLayers[n];delete this._removedLayers[n],l.type!==a.type?this._updatedSources[a.source]="clear":(this._updatedSources[a.source]="reload",this.sourceCaches[a.source].pause())}this._updateLayer(a),a.onAdd&&a.onAdd(this.map)}moveLayer(e,r){if(this._checkLoaded(),this._changed=!0,!this._layers[e]){this.fire(new q(new Error("The layer '".concat(e,"' does not exist in the map's style and cannot be moved."))));return}if(e===r)return;let n=this._order.indexOf(e);this._order.splice(n,1);let a=r?this._order.indexOf(r):this._order.length;if(r&&a===-1){this.fire(new q(new Error('Cannot move layer "'.concat(e,'" before non-existing layer "').concat(r,'".'))));return}this._order.splice(a,0,e),this._layerOrderChanged=!0}removeLayer(e){this._checkLoaded();let r=this._layers[e];if(!r){this.fire(new q(new Error('Cannot remove non-existing layer "'.concat(e,'".'))));return}r.setEventedParent(null);let i=this._order.indexOf(e);this._order.splice(i,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[e]=r,delete this._layers[e],this._serializedLayers&&delete this._serializedLayers[e],delete this._updatedLayers[e],delete this._updatedPaintProps[e],r.onRemove&&r.onRemove(this.map)}getLayer(e){return this._layers[e]}getLayersOrder(){return[...this._order]}hasLayer(e){return e in this._layers}setLayerZoomRange(e,r,i){this._checkLoaded();let n=this.getLayer(e);if(!n){this.fire(new q(new Error('Cannot set the zoom range of non-existing layer "'.concat(e,'".'))));return}n.minzoom===r&&n.maxzoom===i||(r!=null&&(n.minzoom=r),i!=null&&(n.maxzoom=i),this._updateLayer(n))}setFilter(e,r,i={}){this._checkLoaded();let n=this.getLayer(e);if(!n){this.fire(new q(new Error('Cannot filter non-existing layer "'.concat(e,'".'))));return}if(!bt(n.filter,r)){if(r==null){n.filter=void 0,this._updateLayer(n);return}this._validate(Ie.filter,"layers.".concat(n.id,".filter"),r,null,i)||(n.filter=Xe(r),this._updateLayer(n))}}getFilter(e){return Xe(this.getLayer(e).filter)}setLayoutProperty(e,r,i,n={}){this._checkLoaded();let a=this.getLayer(e);if(!a){this.fire(new q(new Error('Cannot style non-existing layer "'.concat(e,'".'))));return}bt(a.getLayoutProperty(r),i)||(a.setLayoutProperty(r,i,n),this._updateLayer(a))}getLayoutProperty(e,r){let i=this.getLayer(e);if(!i){this.fire(new q(new Error('Cannot get style of non-existing layer "'.concat(e,'".'))));return}return i.getLayoutProperty(r)}setPaintProperty(e,r,i,n={}){this._checkLoaded();let a=this.getLayer(e);if(!a){this.fire(new q(new Error('Cannot style non-existing layer "'.concat(e,'".'))));return}if(bt(a.getPaintProperty(r),i))return;a.setPaintProperty(r,i,n)&&this._updateLayer(a),this._changed=!0,this._updatedPaintProps[e]=!0,this._serializedLayers=null}getPaintProperty(e,r){return this.getLayer(e).getPaintProperty(r)}setFeatureState(e,r){this._checkLoaded();let i=e.source,n=e.sourceLayer,a=this.sourceCaches[i];if(a===void 0){this.fire(new q(new Error("The source '".concat(i,"' does not exist in the map's style."))));return}let s=a.getSource().type;if(s==="geojson"&&n){this.fire(new q(new Error("GeoJSON sources cannot have a sourceLayer parameter.")));return}if(s==="vector"&&!n){this.fire(new q(new Error("The sourceLayer parameter must be provided for vector source types.")));return}e.id===void 0&&this.fire(new q(new Error("The feature id parameter must be provided."))),a.setFeatureState(n,e.id,r)}removeFeatureState(e,r){this._checkLoaded();let i=e.source,n=this.sourceCaches[i];if(n===void 0){this.fire(new q(new Error("The source '".concat(i,"' does not exist in the map's style."))));return}let a=n.getSource().type,s=a==="vector"?e.sourceLayer:void 0;if(a==="vector"&&!s){this.fire(new q(new Error("The sourceLayer parameter must be provided for vector source types.")));return}if(r&&typeof e.id!="string"&&typeof e.id!="number"){this.fire(new q(new Error("A feature id is required to remove its specific state property.")));return}n.removeFeatureState(s,e.id,r)}getFeatureState(e){this._checkLoaded();let r=e.source,i=e.sourceLayer,n=this.sourceCaches[r];if(n===void 0){this.fire(new q(new Error("The source '".concat(r,"' does not exist in the map's style."))));return}if(n.getSource().type==="vector"&&!i){this.fire(new q(new Error("The sourceLayer parameter must be provided for vector source types.")));return}return e.id===void 0&&this.fire(new q(new Error("The feature id parameter must be provided."))),n.getFeatureState(i,e.id)}getTransition(){return B({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;let e=fi(this.sourceCaches,a=>a.serialize()),r=this._serializeByIds(this._order),i=this.map.getTerrain()||void 0,n=this.stylesheet;return po({version:n.version,name:n.name,metadata:n.metadata,light:n.light,center:n.center,zoom:n.zoom,bearing:n.bearing,pitch:n.pitch,sprite:n.sprite,glyphs:n.glyphs,transition:n.transition,sources:e,layers:r,terrain:i},a=>a!==void 0)}_updateLayer(e){this._updatedLayers[e.id]=!0,e.source&&!this._updatedSources[e.source]&&this.sourceCaches[e.source].getSource().type!=="raster"&&(this._updatedSources[e.source]="reload",this.sourceCaches[e.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(e){let r=u(s=>this._layers[s].type==="fill-extrusion","isLayer3D"),i={},n=[];for(let s=this._order.length-1;s>=0;s--){let l=this._order[s];if(r(l)){i[l]=s;for(let c of e){let p=c[l];if(p)for(let h of p)n.push(h)}}}n.sort((s,l)=>l.intersectionZ-s.intersectionZ);let a=[];for(let s=this._order.length-1;s>=0;s--){let l=this._order[s];if(r(l))for(let c=n.length-1;c>=0;c--){let p=n[c].feature;if(i[p.layer.id]<s)break;a.push(p),n.pop()}else for(let c of e){let p=c[l];if(p)for(let h of p)a.push(h.feature)}}return a}queryRenderedFeatures(e,r,i){r&&r.filter&&this._validate(Ie.filter,"queryRenderedFeatures.filter",r.filter,null,r);let n={};if(r&&r.layers){if(!Array.isArray(r.layers))return this.fire(new q(new Error("parameters.layers must be an Array."))),[];for(let l of r.layers){let c=this._layers[l];if(!c)return this.fire(new q(new Error("The layer '".concat(l,"' does not exist in the map's style and cannot be queried for features.")))),[];n[c.source]=!0}}let a=[];r.availableImages=this._availableImages;let s=this._serializedAllLayers();for(let l in this.sourceCaches)r.layers&&!n[l]||a.push(tg(this.sourceCaches[l],this._layers,s,e,r,i));return this.placement&&a.push(rg(this._layers,s,this.sourceCaches,e,r,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(a)}querySourceFeatures(e,r){r&&r.filter&&this._validate(Ie.filter,"querySourceFeatures.filter",r.filter,null,r);let i=this.sourceCaches[e];return i?ig(i,r):[]}getLight(){return this.light.getLight()}setLight(e,r={}){this._checkLoaded();let i=this.light.getLight(),n=!1;for(let s in e)if(!bt(e[s],i[s])){n=!0;break}if(!n)return;let a={now:$.now(),transition:B({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(e,r),this.light.updateTransitions(a)}_validate(e,r,i,n,a={}){return a&&a.validate===!1?!1:ja(this,e.call(Ie,B({key:r,style:this.serialize(),value:i,styleSpec:T},n)))}_remove(e=!0){this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._loadStyleRequest&&(this._loadStyleRequest.abort(),this._loadStyleRequest=null),this._spriteRequest&&(this._spriteRequest.abort(),this._spriteRequest=null),Qt().off(gn,this._rtlPluginLoaded);for(let r in this._layers)this._layers[r].setEventedParent(null);for(let r in this.sourceCaches){let i=this.sourceCaches[r];i.setEventedParent(null),i.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),e&&this.dispatcher.broadcast("RM",void 0),this.dispatcher.remove(e)}_clearSource(e){this.sourceCaches[e].clearTiles()}_reloadSource(e){this.sourceCaches[e].resume(),this.sourceCaches[e].reload()}_updateSources(e){for(let r in this.sourceCaches)this.sourceCaches[r].update(e,this.map.terrain)}_generateCollisionBoxes(){for(let e in this.sourceCaches)this._reloadSource(e)}_updatePlacement(e,r,i,n,a=!1){let s=!1,l=!1,c={};for(let h of this._order){let f=this._layers[h];if(f.type!=="symbol")continue;if(!c[f.source]){let g=this.sourceCaches[f.source];c[f.source]=g.getRenderableIds(!0).map(y=>g.getTileByID(y)).sort((y,_)=>_.tileID.overscaledZ-y.tileID.overscaledZ||(y.tileID.isLessThan(_.tileID)?-1:1))}let d=this.crossTileSymbolIndex.addLayer(f,c[f.source],e.center.lng);s=s||d}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),a=a||this._layerOrderChanged||i===0,(a||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent($.now(),e.zoom))&&(this.pauseablePlacement=new Na(e,this.map.terrain,this._order,a,r,i,n,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,c),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit($.now()),l=!0),s&&this.pauseablePlacement.placement.setStale()),l||s)for(let h of this._order){let f=this._layers[h];f.type==="symbol"&&this.placement.updateLayerOpacities(f,c[f.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions($.now())}_releaseSymbolFadeTiles(){for(let e in this.sourceCaches)this.sourceCaches[e].releaseSymbolFadeTiles()}async getImages(e,r){let i=await this.imageManager.getImages(r.icons);this._updateTilesForChangedImages();let n=this.sourceCaches[r.source];return n&&n.setDependencies(r.tileID.key,r.type,r.icons),i}async getGlyphs(e,r){let i=await this.glyphManager.getGlyphs(r.stacks),n=this.sourceCaches[r.source];return n&&n.setDependencies(r.tileID.key,r.type,[""]),i}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(e,r={}){this._checkLoaded(),!(e&&this._validate(Ie.glyphs,"glyphs",e,null,r))&&(this._glyphsDidChange=!0,this.stylesheet.glyphs=e,this.glyphManager.entries={},this.glyphManager.setURL(e))}addSprite(e,r,i={},n){this._checkLoaded();let a=[{id:e,url:r}],s=[...$r(this.stylesheet.sprite),...a];this._validate(Ie.sprite,"sprite",s,null,i)||(this.stylesheet.sprite=s,this._loadSprite(a,!0,n))}removeSprite(e){this._checkLoaded();let r=$r(this.stylesheet.sprite);if(!r.find(i=>i.id===e)){this.fire(new q(new Error('Sprite "'.concat(e,"\" doesn't exists on this map."))));return}if(this._spritesImagesIds[e])for(let i of this._spritesImagesIds[e])this.imageManager.removeImage(i),this._changedImages[i]=!0;r.splice(r.findIndex(i=>i.id===e),1),this.stylesheet.sprite=r.length>0?r:void 0,delete this._spritesImagesIds[e],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new C("data",{dataType:"style"}))}getSprite(){return $r(this.stylesheet.sprite)}setSprite(e,r={},i){this._checkLoaded(),!(e&&this._validate(Ie.sprite,"sprite",e,null,r))&&(this.stylesheet.sprite=e,e?this._loadSprite(e,!0,i):(this._unloadSprite(),i&&i(null)))}};u(fh,"Style");var ii=fh;m();m();var qa=he([{name:"a_pos",type:"Int16",components:2}]);m();m();var Ag="#ifdef GL_ES\nprecision mediump float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif\n";m();var Ig="#ifdef GL_ES\nprecision highp float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif\nvec2 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(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0\n);}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);return (tile_units_to_pixels*pos+offset)/pattern_size;}\n#ifdef TERRAIN3D\nuniform sampler2D u_terrain;uniform float u_terrain_dim;uniform mat4 u_terrain_matrix;uniform vec4 u_terrain_unpack;uniform float u_terrain_exaggeration;uniform highp sampler2D u_depth;\n#endif\nconst highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitShifts=vec4(1.)/bitSh;highp float unpack(highp vec4 color) {return dot(color,bitShifts);}highp float depthOpacity(vec3 frag) {\n#ifdef TERRAIN3D\nhighp float d=unpack(texture2D(u_depth,frag.xy*0.5+0.5))+0.0001-frag.z;return 1.0-max(0.0,min(1.0,-d*500.0));\n#else\nreturn 1.0;\n#endif\n}float calculate_visibility(vec4 pos) {\n#ifdef TERRAIN3D\nvec3 frag=pos.xyz/pos.w;highp float d=depthOpacity(frag);if (d > 0.95) return 1.0;return (d+depthOpacity(frag+vec3(0.0,0.01,0.0)))/2.0;\n#else\nreturn 1.0;\n#endif\n}float ele(vec2 pos) {\n#ifdef TERRAIN3D\nvec4 rgb=(texture2D(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a;\n#else\nreturn 0.0;\n#endif\n}float get_elevation(vec2 pos) {\n#ifdef TERRAIN3D\nvec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.0;vec2 f=fract(coord);vec2 c=(floor(coord)+0.5)/(u_terrain_dim+2.0);float d=1.0/(u_terrain_dim+2.0);float tl=ele(c);float tr=ele(c+vec2(d,0.0));float bl=ele(c+vec2(0.0,d));float br=ele(c+vec2(d,d));float elevation=mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);return elevation*u_terrain_exaggeration;\n#else\nreturn 0.0;\n#endif\n}";m();var Cg="uniform vec4 u_color;uniform float u_opacity;void main() {gl_FragColor=u_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";m();var Eg="attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}";m();var Mg="uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_mix)*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";m();var Lg="uniform mat4 u_matrix;uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}";m();var Dg="varying vec3 v_data;varying float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 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(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));gl_FragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";m();var kg="uniform mat4 u_matrix;uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;attribute vec2 a_pos;varying vec3 v_data;varying float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main(void) {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);float ele=get_elevation(circle_center);v_visibility=calculate_visibility(u_matrix*vec4(circle_center,ele,1.0));if (u_pitch_with_map) {vec2 corner_position=circle_center;if (u_scale_with_map) {corner_position+=extrude*(radius+stroke_width)*u_extrude_scale;} else {vec4 projected_center=u_matrix*vec4(circle_center,0,1);corner_position+=extrude*(radius+stroke_width)*u_extrude_scale*(projected_center.w/u_camera_to_center_distance);}gl_Position=u_matrix*vec4(corner_position,ele,1);} else {gl_Position=u_matrix*vec4(circle_center,ele,1);if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);}";m();var Fg="void main() {gl_FragColor=vec4(1.0);}";m();var Rg="attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}";m();var zg="uniform highp float u_intensity;varying vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#define GAUSS_COEF 0.3989422804014327\nvoid main() {\n#pragma mapbox: initialize highp float weight\nfloat d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);gl_FragColor=vec4(val,1.0,1.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";m();var Bg="uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;attribute vec2 a_pos;varying vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#pragma mapbox: define mediump float radius\nconst highp float ZERO=1.0/255.0/16.0;\n#define GAUSS_COEF 0.3989422804014327\nvoid main(void) {\n#pragma mapbox: initialize highp float weight\n#pragma mapbox: initialize mediump float radius\nvec2 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;vec4 pos=vec4(floor(a_pos*0.5)+extrude,0,1);gl_Position=u_matrix*pos;}";m();var Og="uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;varying vec2 v_pos;void main() {float t=texture2D(u_image,v_pos).r;vec4 color=texture2D(u_color_ramp,vec2(t,0.5));gl_FragColor=color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(0.0);\n#endif\n}";m();var Vg="uniform mat4 u_matrix;uniform vec2 u_world;attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}";m();var Ug="varying float v_placed;varying float v_notUsed;void main() {float alpha=0.5;gl_FragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {gl_FragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {gl_FragColor*=.1;}}";m();var Gg="attribute vec2 a_pos;attribute vec2 a_anchor_pos;attribute vec2 a_extrude;attribute vec2 a_placed;attribute vec2 a_shift;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;varying float v_placed;varying float v_notUsed;void main() {vec4 projectedPoint=u_matrix*vec4(a_anchor_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);gl_Position=u_matrix*vec4(a_pos,get_elevation(a_pos),1.0);gl_Position.xy+=(a_extrude+a_shift)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}";m();var Ng="varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying 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);gl_FragColor=color*alpha*opacity_t;}";m();var jg="attribute vec2 a_pos;attribute float a_radius;attribute vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying 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;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-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(0.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);}";m();var qg="uniform highp vec4 u_color;uniform sampler2D u_overlay;varying vec2 v_uv;void main() {vec4 overlay_color=texture2D(u_overlay,v_uv);gl_FragColor=mix(u_color,overlay_color,overlay_color.a);}";m();var Zg="attribute vec2 a_pos;varying vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,get_elevation(a_pos),1);}";m();var Hg="#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_FragColor=color*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";m();var Wg="attribute vec2 a_pos;uniform mat4 u_matrix;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);}";m();var Kg="varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=outline_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";m();var $g="attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}";m();var Xg="uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=mix(color1,color2,u_fade)*alpha*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";m();var Jg="uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}";m();var Yg="#ifdef GL_ES\nprecision highp float;\n#endif\nuniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_fade)*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";m();var Qg="uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}";m();var e_="varying vec4 v_color;void main() {gl_FragColor=v_color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";m();var t_="uniform 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;attribute vec2 a_pos;attribute vec4 a_normal_ed;\n#ifdef TERRAIN3D\nattribute vec2 a_centroid;\n#endif\nvarying vec4 v_color;\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\nvec3 normal=a_normal_ed.xyz;\n#ifdef TERRAIN3D\nfloat height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);\n#else\nfloat height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;\n#endif\nbase=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);gl_Position=u_matrix*vec4(a_pos,t > 0.0 ? height : base,1);float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;float directional=clamp(dot(normal/16384.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}";m();var r_="uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);gl_FragColor=mixedColor*v_lighting;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";m();var i_="uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute vec2 a_pos;attribute vec4 a_normal_ed;\n#ifdef TERRAIN3D\nattribute vec2 a_centroid;\n#endif\nvarying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;\n#ifdef TERRAIN3D\nfloat height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);\n#else\nfloat height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;\n#endif\nbase=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float z=t > 0.0 ? height : base;gl_Position=u_matrix*vec4(a_pos,z,1);vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0\n? a_pos\n: vec2(edgedistance,z*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}";m();var n_="#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);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((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))/pow(2.0,exaggeration+(19.2562-u_zoom));gl_FragColor=clamp(vec4(deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";m();var o_="uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying 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;}";m();var a_="uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;\n#define PI 3.141592653589793\nvoid main() {vec4 pixel=texture2D(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);gl_FragColor=accent_color*(1.0-shade_color.a)+shade_color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";m();var s_="uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;}";m();var l_="uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat 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);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";m();var u_="\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp float v_linesofar;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat 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;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.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_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat 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;\n#endif\nv_width2=vec2(outset,inset);}";m();var c_="uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp vec2 v_uv;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat 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);vec4 color=texture2D(u_image,v_uv);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";m();var p_="\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;attribute float a_uv_x;attribute float a_split_index;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp vec2 v_uv;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat 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;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);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_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat 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;\n#endif\nv_width2=vec2(outset,inset);}";m();var h_="#ifdef GL_ES\nprecision highp float;\n#endif\nuniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.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 x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture2D(u_image,pos_a),texture2D(u_image,pos_b),u_fade);gl_FragColor=color*alpha*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";m();var m_="\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nfloat 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;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;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_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat 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;\n#endif\nv_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}";m();var f_="uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\nfloat 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 sdfdist_a=texture2D(u_image,v_tex_a).a;float sdfdist_b=texture2D(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);alpha*=smoothstep(0.5-u_sdfgamma/floorwidth,0.5+u_sdfgamma/floorwidth,sdfdist);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";m();var d_="\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_patternscale_a;uniform float u_tex_y_a;uniform vec2 u_patternscale_b;uniform float u_tex_y_b;uniform vec2 u_units_to_pixels;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\nfloat 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;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;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_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat 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;\n#endif\nv_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}";m();var y_="uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;varying vec2 v_pos0;varying vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture2D(u_image0,v_pos0);vec4 color1=texture2D(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(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);gl_FragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";m();var g_="uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos0=(((a_texture_pos/8192.0)-0.5)/u_buffer_scale )+0.5;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}";m();var __="uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nlowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";m();var x_="const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform 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 highp float u_pitch;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;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];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;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp 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);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0),z,1.0);v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float visibility=calculate_visibility(projectedPoint);v_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));}";m();var b_="#define SDF_PX 8.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat 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 inner_edge=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);inner_edge=inner_edge+gamma*gamma_scale;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(inner_edge-gamma_scaled,inner_edge+gamma_scaled,dist);if (u_is_halo) {lowp float halo_edge=(6.0-halo_width/fontScale)/SDF_PX;alpha=min(smoothstep(halo_edge-gamma_scaled,halo_edge+gamma_scaled,dist),1.0-alpha);}gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";m();var v_="const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform 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 highp float u_pitch;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;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];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;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp 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);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset),z,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}";m();var w_="#define SDF_PX 8.0\n#define SDF 1.0\n#define ICON 0.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;varying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\nreturn;}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;if (u_is_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=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";m();var P_="const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform 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 highp float u_pitch;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 vec2 u_texsize_icon;varying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];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;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp 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);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale),z,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}";m();var S_="varying float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {gl_FragColor=pack(v_depth);}";m();var T_="precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;varying vec2 v_texture_pos;void main() {vec4 rgba=texture2D(u_texture,v_texture_pos);gl_FragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}";m();var A_="uniform sampler2D u_texture;varying vec2 v_texture_pos;void main() {gl_FragColor=texture2D(u_texture,v_texture_pos);}";m();var Za="attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform float u_ele_delta;varying vec2 v_texture_pos;varying float v_depth;void main() {float extent=8192.0;float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/extent;gl_Position=u_matrix*vec4(a_pos3d.xy,get_elevation(a_pos3d.xy)-ele_delta,1.0);v_depth=gl_Position.z/gl_Position.w;}";var Ir={prelude:xe(Ag,Ig),background:xe(Cg,Eg),backgroundPattern:xe(Mg,Lg),circle:xe(Dg,kg),clippingMask:xe(Fg,Rg),heatmap:xe(zg,Bg),heatmapTexture:xe(Og,Vg),collisionBox:xe(Ug,Gg),collisionCircle:xe(Ng,jg),debug:xe(qg,Zg),fill:xe(Hg,Wg),fillOutline:xe(Kg,$g),fillOutlinePattern:xe(Xg,Jg),fillPattern:xe(Yg,Qg),fillExtrusion:xe(e_,t_),fillExtrusionPattern:xe(r_,i_),hillshadePrepare:xe(n_,o_),hillshade:xe(a_,s_),line:xe(l_,u_),lineGradient:xe(c_,p_),linePattern:xe(h_,m_),lineSDF:xe(f_,d_),raster:xe(y_,g_),symbolIcon:xe(__,x_),symbolSDF:xe(b_,v_),symbolTextAndIcon:xe(w_,P_),terrain:xe(A_,Za),terrainDepth:xe(S_,Za),terrainCoords:xe(T_,Za)};function xe(o,t){let e=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,r=t.match(/attribute ([\w]+) ([\w]+)/g),i=o.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),n=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),a=n?n.concat(i):i,s={};return o=o.replace(e,(l,c,p,h,f)=>(s[f]=!0,c==="define"?"\n#ifndef HAS_UNIFORM_u_".concat(f,"\nvarying ").concat(p," ").concat(h," ").concat(f,";\n#else\nuniform ").concat(p," ").concat(h," u_").concat(f,";\n#endif\n"):"\n#ifdef HAS_UNIFORM_u_".concat(f,"\n ").concat(p," ").concat(h," ").concat(f," = u_").concat(f,";\n#endif\n"))),t=t.replace(e,(l,c,p,h,f)=>{let d=h==="float"?"vec2":"vec4",g=f.match(/color/)?"color":d;return s[f]?c==="define"?"\n#ifndef HAS_UNIFORM_u_".concat(f,"\nuniform lowp float u_").concat(f,"_t;\nattribute ").concat(p," ").concat(d," a_").concat(f,";\nvarying ").concat(p," ").concat(h," ").concat(f,";\n#else\nuniform ").concat(p," ").concat(h," u_").concat(f,";\n#endif\n"):g==="vec4"?"\n#ifndef HAS_UNIFORM_u_".concat(f,"\n ").concat(f," = a_").concat(f,";\n#else\n ").concat(p," ").concat(h," ").concat(f," = u_").concat(f,";\n#endif\n"):"\n#ifndef HAS_UNIFORM_u_".concat(f,"\n ").concat(f," = unpack_mix_").concat(g,"(a_").concat(f,", u_").concat(f,"_t);\n#else\n ").concat(p," ").concat(h," ").concat(f," = u_").concat(f,";\n#endif\n"):c==="define"?"\n#ifndef HAS_UNIFORM_u_".concat(f,"\nuniform lowp float u_").concat(f,"_t;\nattribute ").concat(p," ").concat(d," a_").concat(f,";\n#else\nuniform ").concat(p," ").concat(h," u_").concat(f,";\n#endif\n"):g==="vec4"?"\n#ifndef HAS_UNIFORM_u_".concat(f,"\n ").concat(p," ").concat(h," ").concat(f," = a_").concat(f,";\n#else\n ").concat(p," ").concat(h," ").concat(f," = u_").concat(f,";\n#endif\n"):"\n#ifndef HAS_UNIFORM_u_".concat(f,"\n ").concat(p," ").concat(h," ").concat(f," = unpack_mix_").concat(g,"(a_").concat(f,", u_").concat(f,"_t);\n#else\n ").concat(p," ").concat(h," ").concat(f," = u_").concat(f,";\n#endif\n")}),{fragmentSource:o,vertexSource:t,staticAttributes:r,staticUniforms:a}}u(xe,"compile");m();m();var dh=class dh{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(t,e,r,i,n,a,s,l,c){this.context=t;let p=this.boundPaintVertexBuffers.length!==i.length;for(let f=0;!p&&f<i.length;f++)this.boundPaintVertexBuffers[f]!==i[f]&&(p=!0);!this.vao||this.boundProgram!==e||this.boundLayoutVertexBuffer!==r||p||this.boundIndexBuffer!==n||this.boundVertexOffset!==a||this.boundDynamicVertexBuffer!==s||this.boundDynamicVertexBuffer2!==l||this.boundDynamicVertexBuffer3!==c?this.freshBind(e,r,i,n,a,s,l,c):(t.bindVertexArray.set(this.vao),s&&s.bind(),n&&n.dynamicDraw&&n.bind(),l&&l.bind(),c&&c.bind())}freshBind(t,e,r,i,n,a,s,l){let c=t.numAttributes,p=this.context,h=p.gl;this.vao&&this.destroy(),this.vao=p.createVertexArray(),p.bindVertexArray.set(this.vao),this.boundProgram=t,this.boundLayoutVertexBuffer=e,this.boundPaintVertexBuffers=r,this.boundIndexBuffer=i,this.boundVertexOffset=n,this.boundDynamicVertexBuffer=a,this.boundDynamicVertexBuffer2=s,this.boundDynamicVertexBuffer3=l,e.enableAttributes(h,t);for(let f of r)f.enableAttributes(h,t);a&&a.enableAttributes(h,t),s&&s.enableAttributes(h,t),l&&l.enableAttributes(h,t),e.bind(),e.setVertexAttribPointers(h,t,n);for(let f of r)f.bind(),f.setVertexAttribPointers(h,t,n);a&&(a.bind(),a.setVertexAttribPointers(h,t,n)),i&&i.bind(),s&&(s.bind(),s.setVertexAttribPointers(h,t,n)),l&&(l.bind(),l.setVertexAttribPointers(h,t,n)),p.currentNumAttributes=c}destroy(){this.vao&&(this.context.deleteVertexArray(this.vao),this.vao=null)}};u(dh,"VertexArrayObject");var Ha=dh;m();var I_=u((o,t)=>({u_depth:new X(o,t.u_depth),u_terrain:new X(o,t.u_terrain),u_terrain_dim:new O(o,t.u_terrain_dim),u_terrain_matrix:new Q(o,t.u_terrain_matrix),u_terrain_unpack:new jt(o,t.u_terrain_unpack),u_terrain_exaggeration:new O(o,t.u_terrain_exaggeration)}),"terrainPreludeUniforms"),C_=u((o,t)=>({u_matrix:new Q(o,t.u_matrix),u_texture:new X(o,t.u_texture),u_ele_delta:new O(o,t.u_ele_delta)}),"terrainUniforms"),E_=u((o,t)=>({u_matrix:new Q(o,t.u_matrix),u_ele_delta:new O(o,t.u_ele_delta)}),"terrainDepthUniforms"),M_=u((o,t)=>({u_matrix:new Q(o,t.u_matrix),u_texture:new X(o,t.u_texture),u_terrain_coords_id:new O(o,t.u_terrain_coords_id),u_ele_delta:new O(o,t.u_ele_delta)}),"terrainCoordsUniforms"),L_=u((o,t)=>({u_matrix:o,u_texture:0,u_ele_delta:t}),"terrainUniformValues"),D_=u((o,t)=>({u_matrix:o,u_ele_delta:t}),"terrainDepthUniformValues"),k_=u((o,t,e)=>({u_matrix:o,u_terrain_coords_id:t/255,u_texture:0,u_ele_delta:e}),"terrainCoordsUniformValues");function yh(o){let t=[];for(let e=0;e<o.length;e++){if(o[e]===null)continue;let r=o[e].split(" ");t.push(r.pop())}return t}u(yh,"getTokenizedAttributesAndUniforms");var gh=class gh{constructor(t,e,r,i,n,a){let s=t.gl;this.program=s.createProgram();let l=yh(e.staticAttributes),c=r?r.getBinderAttributes():[],p=l.concat(c),h=Ir.prelude.staticUniforms?yh(Ir.prelude.staticUniforms):[],f=e.staticUniforms?yh(e.staticUniforms):[],d=r?r.getBinderUniforms():[],g=h.concat(f).concat(d),y=[];for(let A of g)y.indexOf(A)<0&&y.push(A);let _=r?r.defines():[];n&&_.push("#define OVERDRAW_INSPECTOR;"),a&&_.push("#define TERRAIN3D;");let w=_.concat(Ir.prelude.fragmentSource,e.fragmentSource).join("\n"),v=_.concat(Ir.prelude.vertexSource,e.vertexSource).join("\n"),b=s.createShader(s.FRAGMENT_SHADER);if(s.isContextLost()){this.failedToCreate=!0;return}if(s.shaderSource(b,w),s.compileShader(b),!s.getShaderParameter(b,s.COMPILE_STATUS))throw new Error("Could not compile fragment shader: ".concat(s.getShaderInfoLog(b)));s.attachShader(this.program,b);let P=s.createShader(s.VERTEX_SHADER);if(s.isContextLost()){this.failedToCreate=!0;return}if(s.shaderSource(P,v),s.compileShader(P),!s.getShaderParameter(P,s.COMPILE_STATUS))throw new Error("Could not compile vertex shader: ".concat(s.getShaderInfoLog(P)));s.attachShader(this.program,P),this.attributes={};let S={};this.numAttributes=p.length;for(let A=0;A<this.numAttributes;A++)p[A]&&(s.bindAttribLocation(this.program,A,p[A]),this.attributes[p[A]]=A);if(s.linkProgram(this.program),!s.getProgramParameter(this.program,s.LINK_STATUS))throw new Error("Program failed to link: ".concat(s.getProgramInfoLog(this.program)));s.deleteShader(P),s.deleteShader(b);for(let A=0;A<y.length;A++){let L=y[A];if(L&&!S[L]){let D=s.getUniformLocation(this.program,L);D&&(S[L]=D)}}this.fixedUniforms=i(t,S),this.terrainUniforms=I_(t,S),this.binderUniforms=r?r.getUniforms(t,S):[]}draw(t,e,r,i,n,a,s,l,c,p,h,f,d,g,y,_,w,v){let b=t.gl;if(this.failedToCreate)return;if(t.program.set(this.program),t.setDepthMode(r),t.setStencilMode(i),t.setColorMode(n),t.setCullFace(a),l){t.activeTexture.set(b.TEXTURE2),b.bindTexture(b.TEXTURE_2D,l.depthTexture),t.activeTexture.set(b.TEXTURE3),b.bindTexture(b.TEXTURE_2D,l.texture);for(let S in this.terrainUniforms)this.terrainUniforms[S].set(l[S])}for(let S in this.fixedUniforms)this.fixedUniforms[S].set(s[S]);y&&y.setUniforms(t,this.binderUniforms,d,{zoom:g});let P=0;switch(e){case b.LINES:P=2;break;case b.TRIANGLES:P=3;break;case b.LINE_STRIP:P=1;break}for(let S of f.get()){let A=S.vaos||(S.vaos={});(A[c]||(A[c]=new Ha)).bind(t,this,p,y?y.getPaintVertexBuffers():[],h,S.vertexOffset,_,w,v),b.drawElements(e,S.primitiveLength*P,b.UNSIGNED_SHORT,S.primitiveOffset*P*2)}}};u(gh,"Program");var Wa=gh;m();m();m();function Ka(o,t,e){let r=1/Le(e,1,t.transform.tileZoom),i=Math.pow(2,e.tileID.overscaledZ),n=e.tileSize*Math.pow(2,t.transform.tileZoom)/i,a=n*(e.tileID.canonical.x+e.tileID.wrap*i),s=n*e.tileID.canonical.y;return{u_image:0,u_texsize:e.imageAtlasTexture.size,u_scale:[r,o.fromScale,o.toScale],u_fade:o.t,u_pixel_coord_upper:[a>>16,s>>16],u_pixel_coord_lower:[a&65535,s&65535]}}u(Ka,"patternUniformValues");function F_(o,t,e,r){let i=e.imageManager.getPattern(o.from.toString()),n=e.imageManager.getPattern(o.to.toString()),{width:a,height:s}=e.imageManager.getPixelSize(),l=Math.pow(2,r.tileID.overscaledZ),c=r.tileSize*Math.pow(2,e.transform.tileZoom)/l,p=c*(r.tileID.canonical.x+r.tileID.wrap*l),h=c*r.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:i.tl,u_pattern_br_a:i.br,u_pattern_tl_b:n.tl,u_pattern_br_b:n.br,u_texsize:[a,s],u_mix:t.t,u_pattern_size_a:i.displaySize,u_pattern_size_b:n.displaySize,u_scale_a:t.fromScale,u_scale_b:t.toScale,u_tile_units_to_pixels:1/Le(r,1,e.transform.tileZoom),u_pixel_coord_upper:[p>>16,h>>16],u_pixel_coord_lower:[p&65535,h&65535]}}u(F_,"bgPatternUniformValues");var R_=u((o,t)=>({u_matrix:new Q(o,t.u_matrix),u_lightpos:new We(o,t.u_lightpos),u_lightintensity:new O(o,t.u_lightintensity),u_lightcolor:new We(o,t.u_lightcolor),u_vertical_gradient:new O(o,t.u_vertical_gradient),u_opacity:new O(o,t.u_opacity)}),"fillExtrusionUniforms"),z_=u((o,t)=>({u_matrix:new Q(o,t.u_matrix),u_lightpos:new We(o,t.u_lightpos),u_lightintensity:new O(o,t.u_lightintensity),u_lightcolor:new We(o,t.u_lightcolor),u_vertical_gradient:new O(o,t.u_vertical_gradient),u_height_factor:new O(o,t.u_height_factor),u_image:new X(o,t.u_image),u_texsize:new Y(o,t.u_texsize),u_pixel_coord_upper:new Y(o,t.u_pixel_coord_upper),u_pixel_coord_lower:new Y(o,t.u_pixel_coord_lower),u_scale:new We(o,t.u_scale),u_fade:new O(o,t.u_fade),u_opacity:new O(o,t.u_opacity)}),"fillExtrusionPatternUniforms"),_h=u((o,t,e,r)=>{let i=t.style.light,n=i.properties.get("position"),a=[n.x,n.y,n.z],s=Il.create();i.properties.get("anchor")==="viewport"&&Il.fromRotation(s,-t.transform.angle),ot.transformMat3(a,a,s);let l=i.properties.get("color");return{u_matrix:o,u_lightpos:a,u_lightintensity:i.properties.get("intensity"),u_lightcolor:[l.r,l.g,l.b],u_vertical_gradient:+e,u_opacity:r}},"fillExtrusionUniformValues"),B_=u((o,t,e,r,i,n,a)=>B(_h(o,t,e,r),Ka(n,t,a),{u_height_factor:-Math.pow(2,i.overscaledZ)/a.tileSize/8}),"fillExtrusionPatternUniformValues");m();var O_=u((o,t)=>({u_matrix:new Q(o,t.u_matrix)}),"fillUniforms"),V_=u((o,t)=>({u_matrix:new Q(o,t.u_matrix),u_image:new X(o,t.u_image),u_texsize:new Y(o,t.u_texsize),u_pixel_coord_upper:new Y(o,t.u_pixel_coord_upper),u_pixel_coord_lower:new Y(o,t.u_pixel_coord_lower),u_scale:new We(o,t.u_scale),u_fade:new O(o,t.u_fade)}),"fillPatternUniforms"),U_=u((o,t)=>({u_matrix:new Q(o,t.u_matrix),u_world:new Y(o,t.u_world)}),"fillOutlineUniforms"),G_=u((o,t)=>({u_matrix:new Q(o,t.u_matrix),u_world:new Y(o,t.u_world),u_image:new X(o,t.u_image),u_texsize:new Y(o,t.u_texsize),u_pixel_coord_upper:new Y(o,t.u_pixel_coord_upper),u_pixel_coord_lower:new Y(o,t.u_pixel_coord_lower),u_scale:new We(o,t.u_scale),u_fade:new O(o,t.u_fade)}),"fillOutlinePatternUniforms"),xh=u(o=>({u_matrix:o}),"fillUniformValues"),bh=u((o,t,e,r)=>B(xh(o),Ka(e,t,r)),"fillPatternUniformValues"),N_=u((o,t)=>({u_matrix:o,u_world:t}),"fillOutlineUniformValues"),j_=u((o,t,e,r,i)=>B(bh(o,t,e,r),{u_world:i}),"fillOutlinePatternUniformValues");m();var q_=u((o,t)=>({u_camera_to_center_distance:new O(o,t.u_camera_to_center_distance),u_scale_with_map:new X(o,t.u_scale_with_map),u_pitch_with_map:new X(o,t.u_pitch_with_map),u_extrude_scale:new Y(o,t.u_extrude_scale),u_device_pixel_ratio:new O(o,t.u_device_pixel_ratio),u_matrix:new Q(o,t.u_matrix)}),"circleUniforms"),Z_=u((o,t,e,r)=>{let i=o.transform,n,a;if(r.paint.get("circle-pitch-alignment")==="map"){let s=Le(e,1,i.zoom);n=!0,a=[s,s]}else n=!1,a=i.pixelsToGLUnits;return{u_camera_to_center_distance:i.cameraToCenterDistance,u_scale_with_map:+(r.paint.get("circle-pitch-scale")==="map"),u_matrix:o.translatePosMatrix(t.posMatrix,e,r.paint.get("circle-translate"),r.paint.get("circle-translate-anchor")),u_pitch_with_map:+n,u_device_pixel_ratio:o.pixelRatio,u_extrude_scale:a}},"circleUniformValues");m();var H_=u((o,t)=>({u_matrix:new Q(o,t.u_matrix),u_camera_to_center_distance:new O(o,t.u_camera_to_center_distance),u_pixels_to_tile_units:new O(o,t.u_pixels_to_tile_units),u_extrude_scale:new Y(o,t.u_extrude_scale),u_overscale_factor:new O(o,t.u_overscale_factor)}),"collisionUniforms"),W_=u((o,t)=>({u_matrix:new Q(o,t.u_matrix),u_inv_matrix:new Q(o,t.u_inv_matrix),u_camera_to_center_distance:new O(o,t.u_camera_to_center_distance),u_viewport_size:new Y(o,t.u_viewport_size)}),"collisionCircleUniforms"),K_=u((o,t,e)=>{let r=Le(e,1,t.zoom),i=Math.pow(2,t.zoom-e.tileID.overscaledZ),n=e.tileID.overscaleFactor();return{u_matrix:o,u_camera_to_center_distance:t.cameraToCenterDistance,u_pixels_to_tile_units:r,u_extrude_scale:[t.pixelsToGLUnits[0]/(r*i),t.pixelsToGLUnits[1]/(r*i)],u_overscale_factor:n}},"collisionUniformValues"),$_=u((o,t,e)=>({u_matrix:o,u_inv_matrix:t,u_camera_to_center_distance:e.cameraToCenterDistance,u_viewport_size:[e.width,e.height]}),"collisionCircleUniformValues");m();var X_=u((o,t)=>({u_color:new at(o,t.u_color),u_matrix:new Q(o,t.u_matrix),u_overlay:new X(o,t.u_overlay),u_overlay_scale:new O(o,t.u_overlay_scale)}),"debugUniforms"),vh=u((o,t,e=1)=>({u_matrix:o,u_color:t,u_overlay:0,u_overlay_scale:e}),"debugUniformValues");m();var J_=u((o,t)=>({u_matrix:new Q(o,t.u_matrix)}),"clippingMaskUniforms"),wh=u(o=>({u_matrix:o}),"clippingMaskUniformValues");m();var Y_=u((o,t)=>({u_extrude_scale:new O(o,t.u_extrude_scale),u_intensity:new O(o,t.u_intensity),u_matrix:new Q(o,t.u_matrix)}),"heatmapUniforms"),Q_=u((o,t)=>({u_matrix:new Q(o,t.u_matrix),u_world:new Y(o,t.u_world),u_image:new X(o,t.u_image),u_color_ramp:new X(o,t.u_color_ramp),u_opacity:new O(o,t.u_opacity)}),"heatmapTextureUniforms"),ex=u((o,t,e,r)=>({u_matrix:o,u_extrude_scale:Le(t,1,e),u_intensity:r}),"heatmapUniformValues"),tx=u((o,t,e,r)=>{let i=G.create();G.ortho(i,0,o.width,o.height,0,0,1);let n=o.context.gl;return{u_matrix:i,u_world:[n.drawingBufferWidth,n.drawingBufferHeight],u_image:e,u_color_ramp:r,u_opacity:t.paint.get("heatmap-opacity")}},"heatmapTextureUniformValues");m();var rx=u((o,t)=>({u_matrix:new Q(o,t.u_matrix),u_image:new X(o,t.u_image),u_latrange:new Y(o,t.u_latrange),u_light:new Y(o,t.u_light),u_shadow:new at(o,t.u_shadow),u_highlight:new at(o,t.u_highlight),u_accent:new at(o,t.u_accent)}),"hillshadeUniforms"),ix=u((o,t)=>({u_matrix:new Q(o,t.u_matrix),u_image:new X(o,t.u_image),u_dimension:new Y(o,t.u_dimension),u_zoom:new O(o,t.u_zoom),u_unpack:new jt(o,t.u_unpack)}),"hillshadePrepareUniforms"),nx=u((o,t,e,r)=>{let i=e.paint.get("hillshade-shadow-color"),n=e.paint.get("hillshade-highlight-color"),a=e.paint.get("hillshade-accent-color"),s=e.paint.get("hillshade-illumination-direction")*(Math.PI/180);e.paint.get("hillshade-illumination-anchor")==="viewport"&&(s-=o.transform.angle);let l=!o.options.moving;return{u_matrix:r?r.posMatrix:o.transform.calculatePosMatrix(t.tileID.toUnwrapped(),l),u_image:0,u_latrange:f0(o,t.tileID),u_light:[e.paint.get("hillshade-exaggeration"),s],u_shadow:i,u_highlight:n,u_accent:a}},"hillshadeUniformValues"),ox=u((o,t)=>{let e=t.stride,r=G.create();return G.ortho(r,0,8192,-8192,0,0,1),G.translate(r,r,[0,-8192,0]),{u_matrix:r,u_image:1,u_dimension:[e,e],u_zoom:o.overscaledZ,u_unpack:t.getUnpackVector()}},"hillshadeUniformPrepareValues");function f0(o,t){let e=Math.pow(2,t.canonical.z),r=t.canonical.y;return[new Te(0,r/e).toLngLat().lat,new Te(0,(r+1)/e).toLngLat().lat]}u(f0,"getTileLatRange");m();var ax=u((o,t)=>({u_matrix:new Q(o,t.u_matrix),u_ratio:new O(o,t.u_ratio),u_device_pixel_ratio:new O(o,t.u_device_pixel_ratio),u_units_to_pixels:new Y(o,t.u_units_to_pixels)}),"lineUniforms"),sx=u((o,t)=>({u_matrix:new Q(o,t.u_matrix),u_ratio:new O(o,t.u_ratio),u_device_pixel_ratio:new O(o,t.u_device_pixel_ratio),u_units_to_pixels:new Y(o,t.u_units_to_pixels),u_image:new X(o,t.u_image),u_image_height:new O(o,t.u_image_height)}),"lineGradientUniforms"),lx=u((o,t)=>({u_matrix:new Q(o,t.u_matrix),u_texsize:new Y(o,t.u_texsize),u_ratio:new O(o,t.u_ratio),u_device_pixel_ratio:new O(o,t.u_device_pixel_ratio),u_image:new X(o,t.u_image),u_units_to_pixels:new Y(o,t.u_units_to_pixels),u_scale:new We(o,t.u_scale),u_fade:new O(o,t.u_fade)}),"linePatternUniforms"),ux=u((o,t)=>({u_matrix:new Q(o,t.u_matrix),u_ratio:new O(o,t.u_ratio),u_device_pixel_ratio:new O(o,t.u_device_pixel_ratio),u_units_to_pixels:new Y(o,t.u_units_to_pixels),u_patternscale_a:new Y(o,t.u_patternscale_a),u_patternscale_b:new Y(o,t.u_patternscale_b),u_sdfgamma:new O(o,t.u_sdfgamma),u_image:new X(o,t.u_image),u_tex_y_a:new O(o,t.u_tex_y_a),u_tex_y_b:new O(o,t.u_tex_y_b),u_mix:new O(o,t.u_mix)}),"lineSDFUniforms"),$a=u((o,t,e,r)=>{let i=o.transform;return{u_matrix:fx(o,t,e,r),u_ratio:1/Le(t,1,i.zoom),u_device_pixel_ratio:o.pixelRatio,u_units_to_pixels:[1/i.pixelsToGLUnits[0],1/i.pixelsToGLUnits[1]]}},"lineUniformValues"),cx=u((o,t,e,r,i)=>B($a(o,t,e,i),{u_image:0,u_image_height:r}),"lineGradientUniformValues"),px=u((o,t,e,r,i)=>{let n=o.transform,a=mx(t,n);return{u_matrix:fx(o,t,e,i),u_texsize:t.imageAtlasTexture.size,u_ratio:1/Le(t,1,n.zoom),u_device_pixel_ratio:o.pixelRatio,u_image:0,u_scale:[a,r.fromScale,r.toScale],u_fade:r.t,u_units_to_pixels:[1/n.pixelsToGLUnits[0],1/n.pixelsToGLUnits[1]]}},"linePatternUniformValues"),hx=u((o,t,e,r,i,n)=>{let a=o.transform,s=o.lineAtlas,l=mx(t,a),c=e.layout.get("line-cap")==="round",p=s.getDash(r.from,c),h=s.getDash(r.to,c),f=p.width*i.fromScale,d=h.width*i.toScale;return B($a(o,t,e,n),{u_patternscale_a:[l/f,-p.height/2],u_patternscale_b:[l/d,-h.height/2],u_sdfgamma:s.width/(Math.min(f,d)*256*o.pixelRatio)/2,u_image:0,u_tex_y_a:p.y,u_tex_y_b:h.y,u_mix:i.t})},"lineSDFUniformValues");function mx(o,t){return 1/Le(o,1,t.tileZoom)}u(mx,"calculateTileRatio");function fx(o,t,e,r){return o.translatePosMatrix(r?r.posMatrix:t.tileID.posMatrix,t,e.paint.get("line-translate"),e.paint.get("line-translate-anchor"))}u(fx,"calculateMatrix");m();var dx=u((o,t)=>({u_matrix:new Q(o,t.u_matrix),u_tl_parent:new Y(o,t.u_tl_parent),u_scale_parent:new O(o,t.u_scale_parent),u_buffer_scale:new O(o,t.u_buffer_scale),u_fade_t:new O(o,t.u_fade_t),u_opacity:new O(o,t.u_opacity),u_image0:new X(o,t.u_image0),u_image1:new X(o,t.u_image1),u_brightness_low:new O(o,t.u_brightness_low),u_brightness_high:new O(o,t.u_brightness_high),u_saturation_factor:new O(o,t.u_saturation_factor),u_contrast_factor:new O(o,t.u_contrast_factor),u_spin_weights:new We(o,t.u_spin_weights)}),"rasterUniforms"),yx=u((o,t,e,r,i)=>({u_matrix:o,u_tl_parent:t,u_scale_parent:e,u_buffer_scale:1,u_fade_t:r.mix,u_opacity:r.opacity*i.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:i.paint.get("raster-brightness-min"),u_brightness_high:i.paint.get("raster-brightness-max"),u_saturation_factor:g0(i.paint.get("raster-saturation")),u_contrast_factor:y0(i.paint.get("raster-contrast")),u_spin_weights:d0(i.paint.get("raster-hue-rotate"))}),"rasterUniformValues");function d0(o){o*=Math.PI/180;let t=Math.sin(o),e=Math.cos(o);return[(2*e+1)/3,(-Math.sqrt(3)*t-e+1)/3,(Math.sqrt(3)*t-e+1)/3]}u(d0,"spinWeights");function y0(o){return o>0?1/(1-o):1+o}u(y0,"contrastFactor");function g0(o){return o>0?1-1/(1.001-o):-o}u(g0,"saturationFactor");m();var gx=u((o,t)=>({u_is_size_zoom_constant:new X(o,t.u_is_size_zoom_constant),u_is_size_feature_constant:new X(o,t.u_is_size_feature_constant),u_size_t:new O(o,t.u_size_t),u_size:new O(o,t.u_size),u_camera_to_center_distance:new O(o,t.u_camera_to_center_distance),u_pitch:new O(o,t.u_pitch),u_rotate_symbol:new X(o,t.u_rotate_symbol),u_aspect_ratio:new O(o,t.u_aspect_ratio),u_fade_change:new O(o,t.u_fade_change),u_matrix:new Q(o,t.u_matrix),u_label_plane_matrix:new Q(o,t.u_label_plane_matrix),u_coord_matrix:new Q(o,t.u_coord_matrix),u_is_text:new X(o,t.u_is_text),u_pitch_with_map:new X(o,t.u_pitch_with_map),u_texsize:new Y(o,t.u_texsize),u_texture:new X(o,t.u_texture)}),"symbolIconUniforms"),_x=u((o,t)=>({u_is_size_zoom_constant:new X(o,t.u_is_size_zoom_constant),u_is_size_feature_constant:new X(o,t.u_is_size_feature_constant),u_size_t:new O(o,t.u_size_t),u_size:new O(o,t.u_size),u_camera_to_center_distance:new O(o,t.u_camera_to_center_distance),u_pitch:new O(o,t.u_pitch),u_rotate_symbol:new X(o,t.u_rotate_symbol),u_aspect_ratio:new O(o,t.u_aspect_ratio),u_fade_change:new O(o,t.u_fade_change),u_matrix:new Q(o,t.u_matrix),u_label_plane_matrix:new Q(o,t.u_label_plane_matrix),u_coord_matrix:new Q(o,t.u_coord_matrix),u_is_text:new X(o,t.u_is_text),u_pitch_with_map:new X(o,t.u_pitch_with_map),u_texsize:new Y(o,t.u_texsize),u_texture:new X(o,t.u_texture),u_gamma_scale:new O(o,t.u_gamma_scale),u_device_pixel_ratio:new O(o,t.u_device_pixel_ratio),u_is_halo:new X(o,t.u_is_halo)}),"symbolSDFUniforms"),xx=u((o,t)=>({u_is_size_zoom_constant:new X(o,t.u_is_size_zoom_constant),u_is_size_feature_constant:new X(o,t.u_is_size_feature_constant),u_size_t:new O(o,t.u_size_t),u_size:new O(o,t.u_size),u_camera_to_center_distance:new O(o,t.u_camera_to_center_distance),u_pitch:new O(o,t.u_pitch),u_rotate_symbol:new X(o,t.u_rotate_symbol),u_aspect_ratio:new O(o,t.u_aspect_ratio),u_fade_change:new O(o,t.u_fade_change),u_matrix:new Q(o,t.u_matrix),u_label_plane_matrix:new Q(o,t.u_label_plane_matrix),u_coord_matrix:new Q(o,t.u_coord_matrix),u_is_text:new X(o,t.u_is_text),u_pitch_with_map:new X(o,t.u_pitch_with_map),u_texsize:new Y(o,t.u_texsize),u_texsize_icon:new Y(o,t.u_texsize_icon),u_texture:new X(o,t.u_texture),u_texture_icon:new X(o,t.u_texture_icon),u_gamma_scale:new O(o,t.u_gamma_scale),u_device_pixel_ratio:new O(o,t.u_device_pixel_ratio),u_is_halo:new X(o,t.u_is_halo)}),"symbolTextAndIconUniforms"),Ph=u((o,t,e,r,i,n,a,s,l,c)=>{let p=i.transform;return{u_is_size_zoom_constant:+(o==="constant"||o==="source"),u_is_size_feature_constant:+(o==="constant"||o==="camera"),u_size_t:t?t.uSizeT:0,u_size:t?t.uSize:0,u_camera_to_center_distance:p.cameraToCenterDistance,u_pitch:p.pitch/360*2*Math.PI,u_rotate_symbol:+e,u_aspect_ratio:p.width/p.height,u_fade_change:i.options.fadeDuration?i.symbolFadeChange:1,u_matrix:n,u_label_plane_matrix:a,u_coord_matrix:s,u_is_text:+l,u_pitch_with_map:+r,u_texsize:c,u_texture:0}},"symbolIconUniformValues"),Sh=u((o,t,e,r,i,n,a,s,l,c,p)=>{let h=i.transform;return B(Ph(o,t,e,r,i,n,a,s,l,c),{u_gamma_scale:r?Math.cos(h._pitch)*h.cameraToCenterDistance:1,u_device_pixel_ratio:i.pixelRatio,u_is_halo:+p})},"symbolSDFUniformValues"),bx=u((o,t,e,r,i,n,a,s,l,c)=>B(Sh(o,t,e,r,i,n,a,s,!0,l,!0),{u_texsize_icon:c,u_texture_icon:1}),"symbolTextAndIconUniformValues");m();var vx=u((o,t)=>({u_matrix:new Q(o,t.u_matrix),u_opacity:new O(o,t.u_opacity),u_color:new at(o,t.u_color)}),"backgroundUniforms"),wx=u((o,t)=>({u_matrix:new Q(o,t.u_matrix),u_opacity:new O(o,t.u_opacity),u_image:new X(o,t.u_image),u_pattern_tl_a:new Y(o,t.u_pattern_tl_a),u_pattern_br_a:new Y(o,t.u_pattern_br_a),u_pattern_tl_b:new Y(o,t.u_pattern_tl_b),u_pattern_br_b:new Y(o,t.u_pattern_br_b),u_texsize:new Y(o,t.u_texsize),u_mix:new O(o,t.u_mix),u_pattern_size_a:new Y(o,t.u_pattern_size_a),u_pattern_size_b:new Y(o,t.u_pattern_size_b),u_scale_a:new O(o,t.u_scale_a),u_scale_b:new O(o,t.u_scale_b),u_pixel_coord_upper:new Y(o,t.u_pixel_coord_upper),u_pixel_coord_lower:new Y(o,t.u_pixel_coord_lower),u_tile_units_to_pixels:new O(o,t.u_tile_units_to_pixels)}),"backgroundPatternUniforms"),Px=u((o,t,e)=>({u_matrix:o,u_opacity:t,u_color:e}),"backgroundUniformValues"),Sx=u((o,t,e,r,i,n)=>B(F_(r,n,e,i),{u_matrix:o,u_opacity:t}),"backgroundPatternUniformValues");var Tx={fillExtrusion:R_,fillExtrusionPattern:z_,fill:O_,fillPattern:V_,fillOutline:U_,fillOutlinePattern:G_,circle:q_,collisionBox:H_,collisionCircle:W_,debug:X_,clippingMask:J_,heatmap:Y_,heatmapTexture:Q_,hillshade:rx,hillshadePrepare:ix,line:ax,lineGradient:sx,linePattern:lx,lineSDF:ux,raster:dx,symbolIcon:gx,symbolSDF:_x,symbolTextAndIcon:xx,background:vx,backgroundPattern:wx,terrain:C_,terrainDepth:E_,terrainCoords:M_};m();m();var Th=class Th{constructor(t,e,r){this.context=t;let i=t.gl;this.buffer=i.createBuffer(),this.dynamicDraw=!!r,this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),i.bufferData(i.ELEMENT_ARRAY_BUFFER,e.arrayBuffer,this.dynamicDraw?i.DYNAMIC_DRAW:i.STATIC_DRAW),this.dynamicDraw||delete e.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(t){let e=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),e.bufferSubData(e.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer)}destroy(){let t=this.context.gl;this.buffer&&(t.deleteBuffer(this.buffer),delete this.buffer)}};u(Th,"IndexBuffer");var Xa=Th;m();var _0={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"},Ah=class Ah{constructor(t,e,r,i){this.length=e.length,this.attributes=r,this.itemSize=e.bytesPerElement,this.dynamicDraw=i,this.context=t;let n=t.gl;this.buffer=n.createBuffer(),t.bindVertexBuffer.set(this.buffer),n.bufferData(n.ARRAY_BUFFER,e.arrayBuffer,this.dynamicDraw?n.DYNAMIC_DRAW:n.STATIC_DRAW),this.dynamicDraw||delete e.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(t){if(t.length!==this.length)throw new Error("Length of new data is ".concat(t.length,", which doesn't match current length of ").concat(this.length));let e=this.context.gl;this.bind(),e.bufferSubData(e.ARRAY_BUFFER,0,t.arrayBuffer)}enableAttributes(t,e){for(let r=0;r<this.attributes.length;r++){let i=this.attributes[r],n=e.attributes[i.name];n!==void 0&&t.enableVertexAttribArray(n)}}setVertexAttribPointers(t,e,r){for(let i=0;i<this.attributes.length;i++){let n=this.attributes[i],a=e.attributes[n.name];a!==void 0&&t.vertexAttribPointer(a,n.components,t[_0[n.type]],!1,this.itemSize,n.offset+this.itemSize*(r||0))}}destroy(){let t=this.context.gl;this.buffer&&(t.deleteBuffer(this.buffer),delete this.buffer)}};u(Ah,"VertexBuffer");var Ja=Ah;m();m();m();var Ih=new WeakMap;function ni(o){var t;if(Ih.has(o))return Ih.get(o);{let e=(t=o.getParameter(o.VERSION))==null?void 0:t.startsWith("WebGL 2.0");return Ih.set(o,e),e}}u(ni,"isWebGL2");var Ch=class Ch{constructor(t){this.gl=t.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(t){}getDefault(){return this.default}setDefault(){this.set(this.default)}};u(Ch,"BaseValue");var ce=Ch,Eh=class Eh extends ce{getDefault(){return pe.transparent}set(t){let e=this.current;t.r===e.r&&t.g===e.g&&t.b===e.b&&t.a===e.a&&!this.dirty||(this.gl.clearColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}};u(Eh,"ClearColor");var Ya=Eh,Mh=class Mh extends ce{getDefault(){return 1}set(t){t===this.current&&!this.dirty||(this.gl.clearDepth(t),this.current=t,this.dirty=!1)}};u(Mh,"ClearDepth");var Qa=Mh,Lh=class Lh extends ce{getDefault(){return 0}set(t){t===this.current&&!this.dirty||(this.gl.clearStencil(t),this.current=t,this.dirty=!1)}};u(Lh,"ClearStencil");var es=Lh,Dh=class Dh extends ce{getDefault(){return[!0,!0,!0,!0]}set(t){let e=this.current;t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&!this.dirty||(this.gl.colorMask(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}};u(Dh,"ColorMask");var ts=Dh,kh=class kh extends ce{getDefault(){return!0}set(t){t===this.current&&!this.dirty||(this.gl.depthMask(t),this.current=t,this.dirty=!1)}};u(kh,"DepthMask");var rs=kh,Fh=class Fh extends ce{getDefault(){return 255}set(t){t===this.current&&!this.dirty||(this.gl.stencilMask(t),this.current=t,this.dirty=!1)}};u(Fh,"StencilMask");var is=Fh,Rh=class Rh extends ce{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(t){let e=this.current;t.func===e.func&&t.ref===e.ref&&t.mask===e.mask&&!this.dirty||(this.gl.stencilFunc(t.func,t.ref,t.mask),this.current=t,this.dirty=!1)}};u(Rh,"StencilFunc");var ns=Rh,zh=class zh extends ce{getDefault(){let t=this.gl;return[t.KEEP,t.KEEP,t.KEEP]}set(t){let e=this.current;t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&!this.dirty||(this.gl.stencilOp(t[0],t[1],t[2]),this.current=t,this.dirty=!1)}};u(zh,"StencilOp");var os=zh,Bh=class Bh extends ce{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;let e=this.gl;t?e.enable(e.STENCIL_TEST):e.disable(e.STENCIL_TEST),this.current=t,this.dirty=!1}};u(Bh,"StencilTest");var as=Bh,Oh=class Oh extends ce{getDefault(){return[0,1]}set(t){let e=this.current;t[0]===e[0]&&t[1]===e[1]&&!this.dirty||(this.gl.depthRange(t[0],t[1]),this.current=t,this.dirty=!1)}};u(Oh,"DepthRange");var ss=Oh,Vh=class Vh extends ce{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;let e=this.gl;t?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST),this.current=t,this.dirty=!1}};u(Vh,"DepthTest");var ls=Vh,Uh=class Uh extends ce{getDefault(){return this.gl.LESS}set(t){t===this.current&&!this.dirty||(this.gl.depthFunc(t),this.current=t,this.dirty=!1)}};u(Uh,"DepthFunc");var us=Uh,Gh=class Gh extends ce{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;let e=this.gl;t?e.enable(e.BLEND):e.disable(e.BLEND),this.current=t,this.dirty=!1}};u(Gh,"Blend");var cs=Gh,Nh=class Nh extends ce{getDefault(){let t=this.gl;return[t.ONE,t.ZERO]}set(t){let e=this.current;t[0]===e[0]&&t[1]===e[1]&&!this.dirty||(this.gl.blendFunc(t[0],t[1]),this.current=t,this.dirty=!1)}};u(Nh,"BlendFunc");var ps=Nh,jh=class jh extends ce{getDefault(){return pe.transparent}set(t){let e=this.current;t.r===e.r&&t.g===e.g&&t.b===e.b&&t.a===e.a&&!this.dirty||(this.gl.blendColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}};u(jh,"BlendColor");var hs=jh,qh=class qh extends ce{getDefault(){return this.gl.FUNC_ADD}set(t){t===this.current&&!this.dirty||(this.gl.blendEquation(t),this.current=t,this.dirty=!1)}};u(qh,"BlendEquation");var ms=qh,Zh=class Zh extends ce{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;let e=this.gl;t?e.enable(e.CULL_FACE):e.disable(e.CULL_FACE),this.current=t,this.dirty=!1}};u(Zh,"CullFace");var fs=Zh,Hh=class Hh extends ce{getDefault(){return this.gl.BACK}set(t){t===this.current&&!this.dirty||(this.gl.cullFace(t),this.current=t,this.dirty=!1)}};u(Hh,"CullFaceSide");var ds=Hh,Wh=class Wh extends ce{getDefault(){return this.gl.CCW}set(t){t===this.current&&!this.dirty||(this.gl.frontFace(t),this.current=t,this.dirty=!1)}};u(Wh,"FrontFace");var ys=Wh,Kh=class Kh extends ce{getDefault(){return null}set(t){t===this.current&&!this.dirty||(this.gl.useProgram(t),this.current=t,this.dirty=!1)}};u(Kh,"ProgramValue");var gs=Kh,$h=class $h extends ce{getDefault(){return this.gl.TEXTURE0}set(t){t===this.current&&!this.dirty||(this.gl.activeTexture(t),this.current=t,this.dirty=!1)}};u($h,"ActiveTextureUnit");var _s=$h,Xh=class Xh extends ce{getDefault(){let t=this.gl;return[0,0,t.drawingBufferWidth,t.drawingBufferHeight]}set(t){let e=this.current;t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&!this.dirty||(this.gl.viewport(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}};u(Xh,"Viewport");var xs=Xh,Jh=class Jh extends ce{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;let e=this.gl;e.bindFramebuffer(e.FRAMEBUFFER,t),this.current=t,this.dirty=!1}};u(Jh,"BindFramebuffer");var bs=Jh,Yh=class Yh extends ce{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;let e=this.gl;e.bindRenderbuffer(e.RENDERBUFFER,t),this.current=t,this.dirty=!1}};u(Yh,"BindRenderbuffer");var vs=Yh,Qh=class Qh extends ce{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;let e=this.gl;e.bindTexture(e.TEXTURE_2D,t),this.current=t,this.dirty=!1}};u(Qh,"BindTexture");var ws=Qh,em=class em extends ce{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;let e=this.gl;e.bindBuffer(e.ARRAY_BUFFER,t),this.current=t,this.dirty=!1}};u(em,"BindVertexBuffer");var Ps=em,tm=class tm extends ce{getDefault(){return null}set(t){let e=this.gl;e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t),this.current=t,this.dirty=!1}};u(tm,"BindElementBuffer");var Ss=tm,rm=class rm extends ce{getDefault(){return null}set(t){var r;if(t===this.current&&!this.dirty)return;let e=this.gl;ni(e)?e.bindVertexArray(t):(r=e.getExtension("OES_vertex_array_object"))==null||r.bindVertexArrayOES(t),this.current=t,this.dirty=!1}};u(rm,"BindVertexArray");var Ts=rm,im=class im extends ce{getDefault(){return 4}set(t){if(t===this.current&&!this.dirty)return;let e=this.gl;e.pixelStorei(e.UNPACK_ALIGNMENT,t),this.current=t,this.dirty=!1}};u(im,"PixelStoreUnpack");var As=im,nm=class nm extends ce{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;let e=this.gl;e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t),this.current=t,this.dirty=!1}};u(nm,"PixelStoreUnpackPremultiplyAlpha");var Is=nm,om=class om extends ce{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;let e=this.gl;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,t),this.current=t,this.dirty=!1}};u(om,"PixelStoreUnpackFlipY");var Cs=om,am=class am extends ce{constructor(e,r){super(e);this.context=e,this.parent=r}getDefault(){return null}};u(am,"FramebufferAttachment");var Tn=am,sm=class sm extends Tn{setDirty(){this.dirty=!0}set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let e=this.gl;e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t,0),this.current=t,this.dirty=!1}};u(sm,"ColorAttachment");var Es=sm,lm=class lm extends Tn{set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let e=this.gl;e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,t),this.current=t,this.dirty=!1}};u(lm,"DepthAttachment");var Ms=lm,um=class um extends Tn{set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let e=this.gl;e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,t),this.current=t,this.dirty=!1}};u(um,"DepthStencilAttachment");var Ls=um;var cm=class cm{constructor(t,e,r,i,n){this.context=t,this.width=e,this.height=r;let a=t.gl,s=this.framebuffer=a.createFramebuffer();if(this.colorAttachment=new Es(t,s),i)this.depthAttachment=n?new Ls(t,s):new Ms(t,s);else if(n)throw new Error("Stencil cannot be set without depth");if(a.checkFramebufferStatus(a.FRAMEBUFFER)!==a.FRAMEBUFFER_COMPLETE)throw new Error("Framebuffer is not complete")}destroy(){let t=this.context.gl,e=this.colorAttachment.get();if(e&&t.deleteTexture(e),this.depthAttachment){let r=this.depthAttachment.get();r&&t.deleteRenderbuffer(r)}t.deleteFramebuffer(this.framebuffer)}};u(cm,"Framebuffer");var Ds=cm;m();var x0=0,Ax=1,b0=771,pm=class pm{constructor(t,e,r){this.blendFunction=t,this.blendColor=e,this.mask=r}};u(pm,"ColorMode");var be=pm;be.Replace=[Ax,x0];be.disabled=new be(be.Replace,pe.transparent,[!1,!1,!1,!1]);be.unblended=new be(be.Replace,pe.transparent,[!0,!0,!0,!0]);be.alphaBlended=new be([Ax,b0],pe.transparent,[!0,!0,!0,!0]);var hm=class hm{constructor(t){var e,r;if(this.gl=t,this.clearColor=new Ya(this),this.clearDepth=new Qa(this),this.clearStencil=new es(this),this.colorMask=new ts(this),this.depthMask=new rs(this),this.stencilMask=new is(this),this.stencilFunc=new ns(this),this.stencilOp=new os(this),this.stencilTest=new as(this),this.depthRange=new ss(this),this.depthTest=new ls(this),this.depthFunc=new us(this),this.blend=new cs(this),this.blendFunc=new ps(this),this.blendColor=new hs(this),this.blendEquation=new ms(this),this.cullFace=new fs(this),this.cullFaceSide=new ds(this),this.frontFace=new ys(this),this.program=new gs(this),this.activeTexture=new _s(this),this.viewport=new xs(this),this.bindFramebuffer=new bs(this),this.bindRenderbuffer=new vs(this),this.bindTexture=new ws(this),this.bindVertexBuffer=new Ps(this),this.bindElementBuffer=new Ss(this),this.bindVertexArray=new Ts(this),this.pixelStoreUnpack=new As(this),this.pixelStoreUnpackPremultiplyAlpha=new Is(this),this.pixelStoreUnpackFlipY=new Cs(this),this.extTextureFilterAnisotropic=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=t.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=t.getParameter(t.MAX_TEXTURE_SIZE),ni(t)){this.HALF_FLOAT=t.HALF_FLOAT;let i=t.getExtension("EXT_color_buffer_half_float");this.RGBA16F=(e=t.RGBA16F)!=null?e:i==null?void 0:i.RGBA16F_EXT,this.RGB16F=(r=t.RGB16F)!=null?r:i==null?void 0:i.RGB16F_EXT,t.getExtension("EXT_color_buffer_float")}else{t.getExtension("EXT_color_buffer_half_float"),t.getExtension("OES_texture_half_float_linear");let i=t.getExtension("OES_texture_half_float");this.HALF_FLOAT=i==null?void 0:i.HALF_FLOAT_OES}}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.bindVertexArray.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(t,e){return new Xa(this,t,e)}createVertexBuffer(t,e,r){return new Ja(this,t,e,r)}createRenderbuffer(t,e,r){let i=this.gl,n=i.createRenderbuffer();return this.bindRenderbuffer.set(n),i.renderbufferStorage(i.RENDERBUFFER,t,e,r),this.bindRenderbuffer.set(null),n}createFramebuffer(t,e,r,i){return new Ds(this,t,e,r,i)}clear({color:t,depth:e,stencil:r}){let i=this.gl,n=0;t&&(n|=i.COLOR_BUFFER_BIT,this.clearColor.set(t),this.colorMask.set([!0,!0,!0,!0])),typeof e<"u"&&(n|=i.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(e),this.depthMask.set(!0)),typeof r<"u"&&(n|=i.STENCIL_BUFFER_BIT,this.clearStencil.set(r),this.stencilMask.set(255)),i.clear(n)}setCullFace(t){t.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(t.mode),this.frontFace.set(t.frontFace))}setDepthMode(t){t.func===this.gl.ALWAYS&&!t.mask?this.depthTest.set(!1):(this.depthTest.set(!0),this.depthFunc.set(t.func),this.depthMask.set(t.mask),this.depthRange.set(t.range))}setStencilMode(t){t.test.func===this.gl.ALWAYS&&!t.mask?this.stencilTest.set(!1):(this.stencilTest.set(!0),this.stencilMask.set(t.mask),this.stencilOp.set([t.fail,t.depthFail,t.pass]),this.stencilFunc.set({func:t.test.func,ref:t.ref,mask:t.test.mask}))}setColorMode(t){bt(t.blendFunction,be.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(t.blendFunction),this.blendColor.set(t.blendColor)),this.colorMask.set(t.mask)}createVertexArray(){var t;return ni(this.gl)?this.gl.createVertexArray():(t=this.gl.getExtension("OES_vertex_array_object"))==null?void 0:t.createVertexArrayOES()}deleteVertexArray(t){var e;return ni(this.gl)?this.gl.deleteVertexArray(t):(e=this.gl.getExtension("OES_vertex_array_object"))==null?void 0:e.deleteVertexArrayOES(t)}unbindVAO(){this.bindVertexArray.set(null)}};u(hm,"Context");var ks=hm;m();var mm=class mm{constructor(t,e,r){this.func=t,this.mask=e,this.range=r}};u(mm,"DepthMode");var J=mm;J.ReadOnly=!1;J.ReadWrite=!0;J.disabled=new J(519,J.ReadOnly,[0,1]);m();var fm=class fm{constructor(t,e,r,i,n,a){this.test=t,this.ref=e,this.mask=r,this.fail=i,this.depthFail=n,this.pass=a}};u(fm,"StencilMode");var ae=fm;ae.disabled=new ae({func:519,mask:0},0,0,7680,7680,7680);m();var dm=class dm{constructor(t,e,r){this.enable=t,this.mode=e,this.frontFace=r}};u(dm,"CullFaceMode");var ie=dm;ie.disabled=new ie(!1,1029,2305);ie.backCCW=new ie(!0,1029,2305);m();var gm=re(fe(),1);m();var Fs;function ym(o,t,e,r,i,n,a){let s=o.context,l=s.gl,c=o.useProgram("collisionBox"),p=[],h=0,f=0;for(let v=0;v<r.length;v++){let b=r[v],P=t.getTile(b),S=P.getBucket(e);if(!S)continue;let A=b.posMatrix;(i[0]!==0||i[1]!==0)&&(A=o.translatePosMatrix(b.posMatrix,P,i,n));let L=a?S.textCollisionBox:S.iconCollisionBox,D=S.collisionCircleArray;if(D.length>0){let k=G.create(),E=A;G.mul(k,S.placementInvProjMatrix,o.transform.glCoordMatrix),G.mul(k,k,S.placementViewportMatrix),p.push({circleArray:D,circleOffset:f,transform:E,invTransform:k,coord:b}),h+=D.length/4,f=h}L&&c.draw(s,l.LINES,J.disabled,ae.disabled,o.colorModeForRenderPass(),ie.disabled,K_(A,o.transform,P),o.style.map.terrain&&o.style.map.terrain.getTerrainData(b),e.id,L.layoutVertexBuffer,L.indexBuffer,L.segments,null,o.transform.zoom,null,null,L.collisionVertexBuffer)}if(!a||!p.length)return;let d=o.useProgram("collisionCircle"),g=new Bo;g.resize(h*4),g._trim();let y=0;for(let v of p)for(let b=0;b<v.circleArray.length/4;b++){let P=b*4,S=v.circleArray[P+0],A=v.circleArray[P+1],L=v.circleArray[P+2],D=v.circleArray[P+3];g.emplace(y++,S,A,L,D,0),g.emplace(y++,S,A,L,D,1),g.emplace(y++,S,A,L,D,2),g.emplace(y++,S,A,L,D,3)}(!Fs||Fs.length<h*2)&&(Fs=v0(h));let _=s.createIndexBuffer(Fs,!0),w=s.createVertexBuffer(g,Ly.members,!0);for(let v of p){let b=$_(v.transform,v.invTransform,o.transform);d.draw(s,l.TRIANGLES,J.disabled,ae.disabled,o.colorModeForRenderPass(),ie.disabled,b,o.style.map.terrain&&o.style.map.terrain.getTerrainData(v.coord),e.id,w,_,se.simpleSegment(0,v.circleOffset*2,v.circleArray.length,v.circleArray.length/2),null,o.transform.zoom,null,null,null)}w.destroy(),_.destroy()}u(ym,"drawCollisionDebug");function v0(o){let t=o*2,e=new Vo;e.resize(t),e._trim();for(let r=0;r<t;r++){let i=r*6;e.uint16[i+0]=r*4+0,e.uint16[i+1]=r*4+1,e.uint16[i+2]=r*4+2,e.uint16[i+3]=r*4+2,e.uint16[i+4]=r*4+3,e.uint16[i+5]=r*4+0}return e}u(v0,"createQuadTriangles");var w0=G.identity(new Float32Array(16));function Ex(o,t,e,r,i){if(o.renderPass!=="translucent")return;let n=ae.disabled,a=o.colorModeForRenderPass();(e._unevaluatedLayout.hasValue("text-variable-anchor")||e._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&S0(r,o,e,t,e.layout.get("text-rotation-alignment"),e.layout.get("text-pitch-alignment"),i),e.paint.get("icon-opacity").constantOr(1)!==0&&Ix(o,t,e,r,!1,e.paint.get("icon-translate"),e.paint.get("icon-translate-anchor"),e.layout.get("icon-rotation-alignment"),e.layout.get("icon-pitch-alignment"),e.layout.get("icon-keep-upright"),n,a),e.paint.get("text-opacity").constantOr(1)!==0&&Ix(o,t,e,r,!0,e.paint.get("text-translate"),e.paint.get("text-translate-anchor"),e.layout.get("text-rotation-alignment"),e.layout.get("text-pitch-alignment"),e.layout.get("text-keep-upright"),n,a),t.map.showCollisionBoxes&&(ym(o,t,e,r,e.paint.get("text-translate"),e.paint.get("text-translate-anchor"),!0),ym(o,t,e,r,e.paint.get("icon-translate"),e.paint.get("icon-translate-anchor"),!1))}u(Ex,"drawSymbols");function P0(o,t,e,r,i,n){let{horizontalAlign:a,verticalAlign:s}=na(o),l=-(a-.5)*t,c=-(s-.5)*e;return new gm.default((l/i+r[0])*n,(c/i+r[1])*n)}u(P0,"calculateVariableRenderShift");function S0(o,t,e,r,i,n,a){let s=t.transform,l=i==="map",c=n==="map";for(let p of o){let h=r.getTile(p),f=h.getBucket(e);if(!f||!f.text||!f.text.segments.get().length)continue;let d=f.textSizeData,g=xr(d,s.zoom),y=Le(h,1,t.transform.zoom),_=xn(p.posMatrix,c,l,t.transform,y),w=e.layout.get("icon-text-fit")!=="none"&&f.hasIconData();if(g){let v=Math.pow(2,s.zoom-h.tileID.overscaledZ),b=t.style.map.terrain?(P,S)=>t.style.map.terrain.getElevation(p,P,S):null;T0(f,l,c,a,s,_,p.posMatrix,v,g,w,b)}}}u(S0,"updateVariableAnchors");function T0(o,t,e,r,i,n,a,s,l,c,p){let h=o.text.placedSymbolArray,f=o.text.dynamicLayoutVertexArray,d=o.icon.dynamicLayoutVertexArray,g={};f.clear();for(let y=0;y<h.length;y++){let _=h.get(y),w=o.allowVerticalPlacement&&!_.placedOrientation,v=!_.hidden&&_.crossTileID&&!w?r[_.crossTileID]:null;if(!v)Tr(_.numGlyphs,f);else{let b=new gm.default(_.anchorX,_.anchorY),P=rt(b,e?a:n,p),S=bn(i.cameraToCenterDistance,P.signedDistanceFromCamera),A=Wr(o.textSizeData,l,_)*S/Wt;e&&(A*=o.tilePixelRatio/s);let{width:L,height:D,anchor:k,textOffset:E,textBoxScale:U}=v,F=P0(k,L,D,E,U,A),M=e?rt(b.add(F),n,p).point:P.point.add(t?F.rotate(-i.angle):F),N=o.allowVerticalPlacement&&_.placedOrientation===2?Math.PI/2:0;for(let z=0;z<_.numGlyphs;z++)br(f,M,N);c&&_.associatedIconIndex>=0&&(g[_.associatedIconIndex]={shiftedAnchor:M,angle:N})}}if(c){d.clear();let y=o.icon.placedSymbolArray;for(let _=0;_<y.length;_++){let w=y.get(_);if(w.hidden)Tr(w.numGlyphs,d);else{let v=g[_];if(!v)Tr(w.numGlyphs,d);else for(let b=0;b<w.numGlyphs;b++)br(d,v.shiftedAnchor,v.angle)}}o.icon.dynamicLayoutVertexBuffer.updateData(d)}o.text.dynamicLayoutVertexBuffer.updateData(f)}u(T0,"updateVariableAnchorsForBucket");function A0(o,t,e){return e.iconsInText&&t?"symbolTextAndIcon":o?"symbolSDF":"symbolIcon"}u(A0,"getSymbolProgramName");function Ix(o,t,e,r,i,n,a,s,l,c,p,h){let f=o.context,d=f.gl,g=o.transform,y=s==="map",_=l==="map",w=s!=="viewport"&&e.layout.get("symbol-placement")!=="point",v=y&&!_&&!w,b=!e.layout.get("symbol-sort-key").isConstant(),P=!1,S=o.depthModeForSublayer(0,J.ReadOnly),A=e._unevaluatedLayout.hasValue("text-variable-anchor")||e._unevaluatedLayout.hasValue("text-variable-anchor-offset"),L=[];for(let D of r){let k=t.getTile(D),E=k.getBucket(e);if(!E)continue;let U=i?E.text:E.icon;if(!U||!U.segments.get().length||!U.hasVisibleVertices)continue;let F=U.programConfigurations.get(e.id),M=i||E.sdfIcons,N=i?E.textSizeData:E.iconSizeData,z=_||g.pitch!==0,W=o.useProgram(A0(M,i,E),F),te=xr(N,g.zoom),K=o.style.map.terrain&&o.style.map.terrain.getTerrainData(D),H,ze=[0,0],Ae,ne,ye=null,Be;if(i){if(Ae=k.glyphAtlasTexture,ne=d.LINEAR,H=k.glyphAtlasTexture.size,E.iconsInText){ze=k.imageAtlasTexture.size,ye=k.imageAtlasTexture;let Me=N.kind==="composite"||N.kind==="camera";Be=z||o.options.rotating||o.options.zooming||Me?d.LINEAR:d.NEAREST}}else{let Me=e.layout.get("icon-size").constantOr(0)!==1||E.iconsNeedLinear;Ae=k.imageAtlasTexture,ne=M||o.options.rotating||o.options.zooming||Me||z?d.LINEAR:d.NEAREST,H=k.imageAtlasTexture.size}let Dt=Le(k,1,o.transform.zoom),kt=xn(D.posMatrix,_,y,o.transform,Dt),ut=ka(D.posMatrix,_,y,o.transform,Dt),yt=A&&E.hasTextData(),rr=e.layout.get("icon-text-fit")!=="none"&&yt&&E.hasIconData();if(w){let Me=o.style.map.terrain?(xt,nr)=>o.style.map.terrain.getElevation(D,xt,nr):null,$e=e.layout.get("text-rotation-alignment")==="map";bg(E,D.posMatrix,o,i,kt,ut,_,c,$e,Me)}let gt=o.translatePosMatrix(D.posMatrix,k,n,a),_t=w||i&&A||rr?w0:kt,Oe=o.translatePosMatrix(ut,k,n,a,!0),je=M&&e.paint.get(i?"text-halo-width":"icon-halo-width").constantOr(1)!==0,Ve;M?E.iconsInText?Ve=bx(N.kind,te,v,_,o,gt,_t,Oe,H,ze):Ve=Sh(N.kind,te,v,_,o,gt,_t,Oe,i,H,!0):Ve=Ph(N.kind,te,v,_,o,gt,_t,Oe,i,H);let ir={program:W,buffers:U,uniformValues:Ve,atlasTexture:Ae,atlasTextureIcon:ye,atlasInterpolation:ne,atlasInterpolationIcon:Be,isSDF:M,hasHalo:je};if(b&&E.canOverlap){P=!0;let Me=U.segments.get();for(let $e of Me)L.push({segments:new se([$e]),sortKey:$e.sortKey,state:ir,terrainData:K})}else L.push({segments:U.segments,sortKey:0,state:ir,terrainData:K})}P&&L.sort((D,k)=>D.sortKey-k.sortKey);for(let D of L){let k=D.state;if(f.activeTexture.set(d.TEXTURE0),k.atlasTexture.bind(k.atlasInterpolation,d.CLAMP_TO_EDGE),k.atlasTextureIcon&&(f.activeTexture.set(d.TEXTURE1),k.atlasTextureIcon&&k.atlasTextureIcon.bind(k.atlasInterpolationIcon,d.CLAMP_TO_EDGE)),k.isSDF){let E=k.uniformValues;k.hasHalo&&(E.u_is_halo=1,Cx(k.buffers,D.segments,e,o,k.program,S,p,h,E,D.terrainData)),E.u_is_halo=0}Cx(k.buffers,D.segments,e,o,k.program,S,p,h,k.uniformValues,D.terrainData)}}u(Ix,"drawLayerSymbols");function Cx(o,t,e,r,i,n,a,s,l,c){let p=r.context,h=p.gl;i.draw(p,h.TRIANGLES,n,a,s,ie.disabled,l,c,e.id,o.layoutVertexBuffer,o.indexBuffer,t,e.paint,r.transform.zoom,o.programConfigurations.get(e.id),o.dynamicLayoutVertexBuffer,o.opacityVertexBuffer)}u(Cx,"drawSymbolElements");m();function Mx(o,t,e,r){if(o.renderPass!=="translucent")return;let i=e.paint.get("circle-opacity"),n=e.paint.get("circle-stroke-width"),a=e.paint.get("circle-stroke-opacity"),s=!e.layout.get("circle-sort-key").isConstant();if(i.constantOr(1)===0&&(n.constantOr(1)===0||a.constantOr(1)===0))return;let l=o.context,c=l.gl,p=o.depthModeForSublayer(0,J.ReadOnly),h=ae.disabled,f=o.colorModeForRenderPass(),d=[];for(let g=0;g<r.length;g++){let y=r[g],_=t.getTile(y),w=_.getBucket(e);if(!w)continue;let v=w.programConfigurations.get(e.id),b=o.useProgram("circle",v),P=w.layoutVertexBuffer,S=w.indexBuffer,A=o.style.map.terrain&&o.style.map.terrain.getTerrainData(y),L=Z_(o,y,_,e),D={programConfiguration:v,program:b,layoutVertexBuffer:P,indexBuffer:S,uniformValues:L,terrainData:A};if(s){let k=w.segments.get();for(let E of k)d.push({segments:new se([E]),sortKey:E.sortKey,state:D})}else d.push({segments:w.segments,sortKey:0,state:D})}s&&d.sort((g,y)=>g.sortKey-y.sortKey);for(let g of d){let{programConfiguration:y,program:_,layoutVertexBuffer:w,indexBuffer:v,uniformValues:b,terrainData:P}=g.state,S=g.segments;_.draw(l,c.TRIANGLES,p,h,f,ie.disabled,b,P,e.id,w,v,S,e.paint,o.transform.zoom,y)}}u(Mx,"drawCircles");m();function Lx(o,t,e,r){if(e.paint.get("heatmap-opacity")!==0)if(o.renderPass==="offscreen"){let i=o.context,n=i.gl,a=ae.disabled,s=new be([n.ONE,n.ONE],pe.transparent,[!0,!0,!0,!0]);I0(i,o,e),i.clear({color:pe.transparent});for(let l=0;l<r.length;l++){let c=r[l];if(t.hasRenderableParent(c))continue;let p=t.getTile(c),h=p.getBucket(e);if(!h)continue;let f=h.programConfigurations.get(e.id),d=o.useProgram("heatmap",f),{zoom:g}=o.transform;d.draw(i,n.TRIANGLES,J.disabled,a,s,ie.disabled,ex(c.posMatrix,p,g,e.paint.get("heatmap-intensity")),null,e.id,h.layoutVertexBuffer,h.indexBuffer,h.segments,e.paint,o.transform.zoom,f)}i.viewport.set([0,0,o.width,o.height])}else o.renderPass==="translucent"&&(o.context.setColorMode(o.colorModeForRenderPass()),E0(o,e))}u(Lx,"drawHeatmap");function I0(o,t,e){let r=o.gl;o.activeTexture.set(r.TEXTURE1),o.viewport.set([0,0,t.width/4,t.height/4]);let i=e.heatmapFbo;if(i)r.bindTexture(r.TEXTURE_2D,i.colorAttachment.get()),o.bindFramebuffer.set(i.framebuffer);else{let n=r.createTexture();r.bindTexture(r.TEXTURE_2D,n),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.LINEAR),i=e.heatmapFbo=o.createFramebuffer(t.width/4,t.height/4,!1,!1),C0(o,t,n,i)}}u(I0,"bindFramebuffer");function C0(o,t,e,r){var s,l;let i=o.gl,n=(s=o.HALF_FLOAT)!=null?s:i.UNSIGNED_BYTE,a=(l=o.RGBA16F)!=null?l:i.RGBA;i.texImage2D(i.TEXTURE_2D,0,a,t.width/4,t.height/4,0,i.RGBA,n,null),r.colorAttachment.set(e)}u(C0,"bindTextureToFramebuffer");function E0(o,t){let e=o.context,r=e.gl,i=t.heatmapFbo;if(!i)return;e.activeTexture.set(r.TEXTURE0),r.bindTexture(r.TEXTURE_2D,i.colorAttachment.get()),e.activeTexture.set(r.TEXTURE1);let n=t.colorRampTexture;n||(n=t.colorRampTexture=new me(e,t.colorRamp,r.RGBA)),n.bind(r.LINEAR,r.CLAMP_TO_EDGE),o.useProgram("heatmapTexture").draw(e,r.TRIANGLES,J.disabled,ae.disabled,o.colorModeForRenderPass(),ie.disabled,tx(o,t,0,1),null,t.id,o.viewportBuffer,o.quadTriangleIndexBuffer,o.viewportSegments,t.paint,o.transform.zoom)}u(E0,"renderTextureToMap");m();function Dx(o,t,e,r){if(o.renderPass!=="translucent")return;let i=e.paint.get("line-opacity"),n=e.paint.get("line-width");if(i.constantOr(1)===0||n.constantOr(1)===0)return;let a=o.depthModeForSublayer(0,J.ReadOnly),s=o.colorModeForRenderPass(),l=e.paint.get("line-dasharray"),c=e.paint.get("line-pattern"),p=c.constantOr(1),h=e.paint.get("line-gradient"),f=e.getCrossfadeParameters(),d=p?"linePattern":l?"lineSDF":h?"lineGradient":"line",g=o.context,y=g.gl,_=!0;for(let w of r){let v=t.getTile(w);if(p&&!v.patternsLoaded())continue;let b=v.getBucket(e);if(!b)continue;let P=b.programConfigurations.get(e.id),S=o.context.program.get(),A=o.useProgram(d,P),L=_||A.program!==S,D=o.style.map.terrain&&o.style.map.terrain.getTerrainData(w),k=c.constantOr(null);if(k&&v.imageAtlas){let F=v.imageAtlas,M=F.patternPositions[k.to.toString()],N=F.patternPositions[k.from.toString()];M&&N&&P.setConstantPatternPositions(M,N)}let E=D?w:null,U=p?px(o,v,e,f,E):l?hx(o,v,e,l,f,E):h?cx(o,v,e,b.lineClipsArray.length,E):$a(o,v,e,E);if(p)g.activeTexture.set(y.TEXTURE0),v.imageAtlasTexture.bind(y.LINEAR,y.CLAMP_TO_EDGE),P.updatePaintBuffers(f);else if(l&&(L||o.lineAtlas.dirty))g.activeTexture.set(y.TEXTURE0),o.lineAtlas.bind(g);else if(h){let F=b.gradients[e.id],M=F.texture;if(e.gradientVersion!==F.version){let N=256;if(e.stepInterpolant){let z=t.getSource().maxzoom,W=w.canonical.z===z?Math.ceil(1<<o.transform.maxZoom-w.canonical.z):1,H=b.maxLineLength/8192*1024*W;N=ge(md(H),256,g.maxTextureSize)}F.gradient=Xo({expression:e.gradientExpression(),evaluationKey:"lineProgress",resolution:N,image:F.gradient||void 0,clips:b.lineClipsArray}),F.texture?F.texture.update(F.gradient):F.texture=new me(g,F.gradient,y.RGBA),F.version=e.gradientVersion,M=F.texture}g.activeTexture.set(y.TEXTURE0),M.bind(e.stepInterpolant?y.NEAREST:y.LINEAR,y.CLAMP_TO_EDGE)}A.draw(g,y.TRIANGLES,a,o.stencilModeForClipping(w),s,ie.disabled,U,D,e.id,b.layoutVertexBuffer,b.indexBuffer,b.segments,e.paint,o.transform.zoom,P,b.layoutVertexBuffer2),_=!1}}u(Dx,"drawLine");m();m();function Rs(o,t,e,r,i){if(!e||!r||!r.imageAtlas)return;let n=r.imageAtlas.patternPositions,a=n[e.to.toString()],s=n[e.from.toString()];if(!a&&s&&(a=s),!s&&a&&(s=a),!a||!s){let l=i.getPaintProperty(t);a=n[l],s=n[l]}a&&s&&o.setConstantPatternPositions(a,s)}u(Rs,"updatePatternPositionsInProgram");function Fx(o,t,e,r){let i=e.paint.get("fill-color"),n=e.paint.get("fill-opacity");if(n.constantOr(1)===0)return;let a=o.colorModeForRenderPass(),s=e.paint.get("fill-pattern"),l=o.opaquePassEnabledForLayer()&&!s.constantOr(1)&&i.constantOr(pe.transparent).a===1&&n.constantOr(0)===1?"opaque":"translucent";if(o.renderPass===l){let c=o.depthModeForSublayer(1,o.renderPass==="opaque"?J.ReadWrite:J.ReadOnly);kx(o,t,e,r,c,a,!1)}if(o.renderPass==="translucent"&&e.paint.get("fill-antialias")){let c=o.depthModeForSublayer(e.getPaintProperty("fill-outline-color")?2:0,J.ReadOnly);kx(o,t,e,r,c,a,!0)}}u(Fx,"drawFill");function kx(o,t,e,r,i,n,a){let s=o.context.gl,l="fill-pattern",c=e.paint.get(l),p=c&&c.constantOr(1),h=e.getCrossfadeParameters(),f,d,g,y,_;a?(d=p&&!e.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",f=s.LINES):(d=p?"fillPattern":"fill",f=s.TRIANGLES);let w=c.constantOr(null);for(let v of r){let b=t.getTile(v);if(p&&!b.patternsLoaded())continue;let P=b.getBucket(e);if(!P)continue;let S=P.programConfigurations.get(e.id),A=o.useProgram(d,S),L=o.style.map.terrain&&o.style.map.terrain.getTerrainData(v);p&&(o.context.activeTexture.set(s.TEXTURE0),b.imageAtlasTexture.bind(s.LINEAR,s.CLAMP_TO_EDGE),S.updatePaintBuffers(h)),Rs(S,l,w,b,e);let D=L?v:null,k=D?D.posMatrix:v.posMatrix,E=o.translatePosMatrix(k,b,e.paint.get("fill-translate"),e.paint.get("fill-translate-anchor"));if(!a)y=P.indexBuffer,_=P.segments,g=p?bh(E,o,h,b):xh(E);else{y=P.indexBuffer2,_=P.segments2;let U=[s.drawingBufferWidth,s.drawingBufferHeight];g=d==="fillOutlinePattern"&&p?j_(E,o,h,b,U):N_(E,U)}A.draw(o.context,f,i,o.stencilModeForClipping(v),n,ie.disabled,g,L,e.id,P.layoutVertexBuffer,y,_,e.paint,o.transform.zoom,S)}}u(kx,"drawFillTiles");m();function Rx(o,t,e,r){let i=e.paint.get("fill-extrusion-opacity");if(i!==0&&o.renderPass==="translucent"){let n=new J(o.context.gl.LEQUAL,J.ReadWrite,o.depthRangeFor3D);if(i===1&&!e.paint.get("fill-extrusion-pattern").constantOr(1)){let a=o.colorModeForRenderPass();_m(o,t,e,r,n,ae.disabled,a)}else _m(o,t,e,r,n,ae.disabled,be.disabled),_m(o,t,e,r,n,o.stencilModeFor3D(),o.colorModeForRenderPass())}}u(Rx,"drawFillExtrusion");function _m(o,t,e,r,i,n,a){let s=o.context,l=s.gl,c="fill-extrusion-pattern",p=e.paint.get(c),h=p.constantOr(1),f=e.getCrossfadeParameters(),d=e.paint.get("fill-extrusion-opacity"),g=p.constantOr(null);for(let y of r){let _=t.getTile(y),w=_.getBucket(e);if(!w)continue;let v=o.style.map.terrain&&o.style.map.terrain.getTerrainData(y),b=w.programConfigurations.get(e.id),P=o.useProgram(h?"fillExtrusionPattern":"fillExtrusion",b);h&&(o.context.activeTexture.set(l.TEXTURE0),_.imageAtlasTexture.bind(l.LINEAR,l.CLAMP_TO_EDGE),b.updatePaintBuffers(f)),Rs(b,c,g,_,e);let S=o.translatePosMatrix(y.posMatrix,_,e.paint.get("fill-extrusion-translate"),e.paint.get("fill-extrusion-translate-anchor")),A=e.paint.get("fill-extrusion-vertical-gradient"),L=h?B_(S,o,A,d,y,f,_):_h(S,o,A,d);P.draw(s,s.gl.TRIANGLES,i,n,a,ie.backCCW,L,v,e.id,w.layoutVertexBuffer,w.indexBuffer,w.segments,e.paint,o.transform.zoom,b,o.style.map.terrain&&w.centroidVertexBuffer)}}u(_m,"drawExtrusionTiles");m();function zx(o,t,e,r){if(o.renderPass!=="offscreen"&&o.renderPass!=="translucent")return;let i=o.context,n=o.depthModeForSublayer(0,J.ReadOnly),a=o.colorModeForRenderPass(),[s,l]=o.renderPass==="translucent"?o.stencilConfigForOverlap(r):[{},r];for(let c of l){let p=t.getTile(c);typeof p.needsHillshadePrepare<"u"&&p.needsHillshadePrepare&&o.renderPass==="offscreen"?L0(o,p,e,n,ae.disabled,a):o.renderPass==="translucent"&&M0(o,c,p,e,n,s[c.overscaledZ],a)}i.viewport.set([0,0,o.width,o.height])}u(zx,"drawHillshade");function M0(o,t,e,r,i,n,a){let s=o.context,l=s.gl,c=e.fbo;if(!c)return;let p=o.useProgram("hillshade"),h=o.style.map.terrain&&o.style.map.terrain.getTerrainData(t);s.activeTexture.set(l.TEXTURE0),l.bindTexture(l.TEXTURE_2D,c.colorAttachment.get());let f=h?t:null;p.draw(s,l.TRIANGLES,i,n,a,ie.disabled,nx(o,e,r,f),h,r.id,o.rasterBoundsBuffer,o.quadTriangleIndexBuffer,o.rasterBoundsSegments)}u(M0,"renderHillshade");function L0(o,t,e,r,i,n){let a=o.context,s=a.gl,l=t.dem;if(l&&l.data){let c=l.dim,p=l.stride,h=l.getPixels();if(a.activeTexture.set(s.TEXTURE1),a.pixelStoreUnpackPremultiplyAlpha.set(!1),t.demTexture=t.demTexture||o.getTileTexture(p),t.demTexture){let d=t.demTexture;d.update(h,{premultiply:!1}),d.bind(s.NEAREST,s.CLAMP_TO_EDGE)}else t.demTexture=new me(a,h,s.RGBA,{premultiply:!1}),t.demTexture.bind(s.NEAREST,s.CLAMP_TO_EDGE);a.activeTexture.set(s.TEXTURE0);let f=t.fbo;if(!f){let d=new me(a,{width:c,height:c,data:null},s.RGBA);d.bind(s.LINEAR,s.CLAMP_TO_EDGE),f=t.fbo=a.createFramebuffer(c,c,!0,!1),f.colorAttachment.set(d.texture)}a.bindFramebuffer.set(f.framebuffer),a.viewport.set([0,0,c,c]),o.useProgram("hillshadePrepare").draw(a,s.TRIANGLES,r,i,n,ie.disabled,ox(t.tileID,l),null,e.id,o.rasterBoundsBuffer,o.quadTriangleIndexBuffer,o.rasterBoundsSegments),t.needsHillshadePrepare=!1}}u(L0,"prepareHillshade");m();function Bx(o,t,e,r){if(o.renderPass!=="translucent"||e.paint.get("raster-opacity")===0||!r.length)return;let i=o.context,n=i.gl,a=t.getSource(),s=o.useProgram("raster"),l=o.colorModeForRenderPass(),[c,p]=a instanceof st?[{},r]:o.stencilConfigForOverlap(r),h=p[p.length-1].overscaledZ,f=!o.options.moving;for(let d of p){let g=o.depthModeForSublayer(d.overscaledZ-h,e.paint.get("raster-opacity")===1?J.ReadWrite:J.ReadOnly,n.LESS),y=t.getTile(d);y.registerFadeDuration(e.paint.get("raster-fade-duration"));let _=t.findLoadedParent(d,0),w=D0(y,_,t,e,o.transform,o.style.map.terrain),v,b,P=e.paint.get("raster-resampling")==="nearest"?n.NEAREST:n.LINEAR;i.activeTexture.set(n.TEXTURE0),y.texture.bind(P,n.CLAMP_TO_EDGE,n.LINEAR_MIPMAP_NEAREST),i.activeTexture.set(n.TEXTURE1),_?(_.texture.bind(P,n.CLAMP_TO_EDGE,n.LINEAR_MIPMAP_NEAREST),v=Math.pow(2,_.tileID.overscaledZ-y.tileID.overscaledZ),b=[y.tileID.canonical.x*v%1,y.tileID.canonical.y*v%1]):y.texture.bind(P,n.CLAMP_TO_EDGE,n.LINEAR_MIPMAP_NEAREST);let S=o.style.map.terrain&&o.style.map.terrain.getTerrainData(d),A=S?d:null,L=A?A.posMatrix:o.transform.calculatePosMatrix(d.toUnwrapped(),f),D=yx(L,b||[0,0],v||1,w,e);a instanceof st?s.draw(i,n.TRIANGLES,g,ae.disabled,l,ie.disabled,D,S,e.id,a.boundsBuffer,o.quadTriangleIndexBuffer,a.boundsSegments):s.draw(i,n.TRIANGLES,g,c[d.overscaledZ],l,ie.disabled,D,S,e.id,o.rasterBoundsBuffer,o.quadTriangleIndexBuffer,o.rasterBoundsSegments)}}u(Bx,"drawRaster");function D0(o,t,e,r,i,n){let a=r.paint.get("raster-fade-duration");if(!n&&a>0){let s=$.now(),l=(s-o.timeAdded)/a,c=t?(s-t.timeAdded)/a:-1,p=e.getSource(),h=i.coveringZoomLevel({tileSize:p.tileSize,roundZoom:p.roundZoom}),f=!t||Math.abs(t.tileID.overscaledZ-h)>Math.abs(o.tileID.overscaledZ-h),d=f&&o.refreshedUponExpiration?1:ge(f?l:1-c,0,1);return o.refreshedUponExpiration&&l>=1&&(o.refreshedUponExpiration=!1),t?{opacity:1,mix:1-d}:{opacity:d,mix:0}}else return{opacity:1,mix:0}}u(D0,"getFadeValues");m();function Ox(o,t,e,r){let i=e.paint.get("background-color"),n=e.paint.get("background-opacity");if(n===0)return;let a=o.context,s=a.gl,l=o.transform,c=l.tileSize,p=e.paint.get("background-pattern");if(o.isPatternMissing(p))return;let h=!p&&i.a===1&&n===1&&o.opaquePassEnabledForLayer()?"opaque":"translucent";if(o.renderPass!==h)return;let f=ae.disabled,d=o.depthModeForSublayer(0,h==="opaque"?J.ReadWrite:J.ReadOnly),g=o.colorModeForRenderPass(),y=o.useProgram(p?"backgroundPattern":"background"),_=r||l.coveringTiles({tileSize:c,terrain:o.style.map.terrain});p&&(a.activeTexture.set(s.TEXTURE0),o.imageManager.bind(o.context));let w=e.getCrossfadeParameters();for(let v of _){let b=r?v.posMatrix:o.transform.calculatePosMatrix(v.toUnwrapped()),P=p?Sx(b,n,o,p,{tileID:v,tileSize:c},w):Px(b,n,i),S=o.style.map.terrain&&o.style.map.terrain.getTerrainData(v);y.draw(a,s.TRIANGLES,d,f,g,ie.disabled,P,S,e.id,o.tileExtentBuffer,o.quadTriangleIndexBuffer,o.tileExtentSegments)}}u(Ox,"drawBackground");m();var k0=new pe(1,0,0,1),F0=new pe(0,1,0,1),R0=new pe(0,0,1,1),z0=new pe(1,0,1,1),B0=new pe(0,1,1,1);function Gx(o){let t=o.transform.padding,e=3;Vx(o,o.transform.height-(t.top||0),e,k0),Vx(o,t.bottom||0,e,F0),Ux(o,t.left||0,e,R0),Ux(o,o.transform.width-(t.right||0),e,z0);let r=o.transform.centerPoint;O0(o,r.x,o.transform.height-r.y,B0)}u(Gx,"drawDebugPadding");function O0(o,t,e,r){zs(o,t-2/2,e-20/2,2,20,r),zs(o,t-20/2,e-2/2,20,2,r)}u(O0,"drawCrosshair");function Vx(o,t,e,r){zs(o,0,t+e/2,o.transform.width,e,r)}u(Vx,"drawHorizontalLine");function Ux(o,t,e,r){zs(o,t-e/2,0,e,o.transform.height,r)}u(Ux,"drawVerticalLine");function zs(o,t,e,r,i,n){let a=o.context,s=a.gl;s.enable(s.SCISSOR_TEST),s.scissor(t*o.pixelRatio,e*o.pixelRatio,r*o.pixelRatio,i*o.pixelRatio),a.clear({color:n}),s.disable(s.SCISSOR_TEST)}u(zs,"drawDebugSSRect");function Nx(o,t,e){for(let r=0;r<e.length;r++)V0(o,t,e[r])}u(Nx,"drawDebug");function V0(o,t,e){let r=o.context,i=r.gl,n=e.posMatrix,a=o.useProgram("debug"),s=J.disabled,l=ae.disabled,c=o.colorModeForRenderPass(),p="$debug",h=o.style.map.terrain&&o.style.map.terrain.getTerrainData(e);r.activeTexture.set(i.TEXTURE0);let f=t.getTileByID(e.key).latestRawTileData,d=f&&f.byteLength||0,g=Math.floor(d/1024),y=t.getTile(e).tileSize,_=512/Math.min(y,512)*(e.overscaledZ/o.transform.zoom)*.5,w=e.canonical.toString();e.overscaledZ!==e.canonical.z&&(w+=" => ".concat(e.overscaledZ));let v="".concat(w," ").concat(g,"kB");U0(o,v),a.draw(r,i.TRIANGLES,s,l,be.alphaBlended,ie.disabled,vh(n,pe.transparent,_),null,p,o.debugBuffer,o.quadTriangleIndexBuffer,o.debugSegments),a.draw(r,i.LINE_STRIP,s,l,c,ie.disabled,vh(n,pe.red),h,p,o.debugBuffer,o.tileBorderIndexBuffer,o.debugSegments)}u(V0,"drawDebugTile");function U0(o,t){o.initDebugOverlayCanvas();let e=o.debugOverlayCanvas,r=o.context.gl,i=o.debugOverlayCanvas.getContext("2d");i.clearRect(0,0,e.width,e.height),i.shadowColor="white",i.shadowBlur=2,i.lineWidth=1.5,i.strokeStyle="white",i.textBaseline="top",i.font="bold 36px Open Sans, sans-serif",i.fillText(t,5,5),i.strokeText(t,5,5),o.debugOverlayTexture.update(e),o.debugOverlayTexture.bind(r.LINEAR,r.CLAMP_TO_EDGE)}u(U0,"drawTextToOverlay");function jx(o,t){let e=null,i=Object.values(o._layers).flatMap(l=>l.source&&!l.isHidden(t)?[o.sourceCaches[l.source]]:[]),n=i.filter(l=>l.getSource().type==="vector"),a=i.filter(l=>l.getSource().type!=="vector"),s=u(l=>{(!e||e.getSource().maxzoom<l.getSource().maxzoom)&&(e=l)},"considerSource");return n.forEach(l=>s(l)),e||a.forEach(l=>s(l)),e}u(jx,"selectDebugSource");m();function qx(o,t,e){let r=o.context,i=e.implementation;if(o.renderPass==="offscreen"){let n=i.prerender;n&&(o.setCustomLayerDefaults(),r.setColorMode(o.colorModeForRenderPass()),n.call(i,r.gl,o.transform.customLayerMatrix()),r.setDirty(),o.setBaseState())}else if(o.renderPass==="translucent"){o.setCustomLayerDefaults(),r.setColorMode(o.colorModeForRenderPass()),r.setStencilMode(ae.disabled);let n=i.renderingMode==="3d"?new J(o.context.gl.LEQUAL,J.ReadWrite,o.depthRangeFor3D):o.depthModeForSublayer(0,J.ReadOnly);r.setDepthMode(n),i.render(r.gl,o.transform.customLayerMatrix()),r.setDirty(),o.setBaseState(),r.bindFramebuffer.set(null)}}u(qx,"drawCustom");m();function Zx(o,t){let e=o.context,r=e.gl,i=be.unblended,n=new J(r.LEQUAL,J.ReadWrite,[0,1]),a=t.getTerrainMesh(),s=t.sourceCache.getRenderableTiles(),l=o.useProgram("terrainDepth");e.bindFramebuffer.set(t.getFramebuffer("depth").framebuffer),e.viewport.set([0,0,o.width/devicePixelRatio,o.height/devicePixelRatio]),e.clear({color:pe.transparent,depth:1});for(let c of s){let p=t.getTerrainData(c.tileID),h=o.transform.calculatePosMatrix(c.tileID.toUnwrapped()),f=D_(h,t.getMeshFrameDelta(o.transform.zoom));l.draw(e,r.TRIANGLES,n,ae.disabled,i,ie.backCCW,f,p,"terrain",a.vertexBuffer,a.indexBuffer,a.segments)}e.bindFramebuffer.set(null),e.viewport.set([0,0,o.width,o.height])}u(Zx,"drawDepth");function Hx(o,t){let e=o.context,r=e.gl,i=be.unblended,n=new J(r.LEQUAL,J.ReadWrite,[0,1]),a=t.getTerrainMesh(),s=t.getCoordsTexture(),l=t.sourceCache.getRenderableTiles(),c=o.useProgram("terrainCoords");e.bindFramebuffer.set(t.getFramebuffer("coords").framebuffer),e.viewport.set([0,0,o.width/devicePixelRatio,o.height/devicePixelRatio]),e.clear({color:pe.transparent,depth:1}),t.coordsIndex=[];for(let p of l){let h=t.getTerrainData(p.tileID);e.activeTexture.set(r.TEXTURE0),r.bindTexture(r.TEXTURE_2D,s.texture);let f=o.transform.calculatePosMatrix(p.tileID.toUnwrapped()),d=k_(f,255-t.coordsIndex.length,t.getMeshFrameDelta(o.transform.zoom));c.draw(e,r.TRIANGLES,n,ae.disabled,i,ie.backCCW,d,h,"terrain",a.vertexBuffer,a.indexBuffer,a.segments),t.coordsIndex.push(p.tileID.key)}e.bindFramebuffer.set(null),e.viewport.set([0,0,o.width,o.height])}u(Hx,"drawCoords");function xm(o,t,e){let r=o.context,i=r.gl,n=o.colorModeForRenderPass(),a=new J(i.LEQUAL,J.ReadWrite,o.depthRangeFor3D),s=o.useProgram("terrain"),l=t.getTerrainMesh();r.bindFramebuffer.set(null),r.viewport.set([0,0,o.width,o.height]);for(let c of e){let p=o.renderToTexture.getTexture(c),h=t.getTerrainData(c.tileID);r.activeTexture.set(i.TEXTURE0),i.bindTexture(i.TEXTURE_2D,p.texture);let f=o.transform.calculatePosMatrix(c.tileID.toUnwrapped()),d=L_(f,t.getMeshFrameDelta(o.transform.zoom));s.draw(r,i.TRIANGLES,a,ae.disabled,n,ie.backCCW,d,h,"terrain",l.vertexBuffer,l.indexBuffer,l.segments)}}u(xm,"drawTerrain");var bm=class bm{constructor(t,e){this.context=new ks(t),this.transform=e,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:G.identity(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=Ct.maxUnderzooming+Ct.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new ri}resize(t,e,r){if(this.width=Math.floor(t*r),this.height=Math.floor(e*r),this.pixelRatio=r,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(let i of this.style._order)this.style._layers[i].resize()}setup(){let t=this.context,e=new Gt;e.emplaceBack(0,0),e.emplaceBack(8192,0),e.emplaceBack(0,8192),e.emplaceBack(8192,8192),this.tileExtentBuffer=t.createVertexBuffer(e,qa.members),this.tileExtentSegments=se.simpleSegment(0,0,4,2);let r=new Gt;r.emplaceBack(0,0),r.emplaceBack(8192,0),r.emplaceBack(0,8192),r.emplaceBack(8192,8192),this.debugBuffer=t.createVertexBuffer(r,qa.members),this.debugSegments=se.simpleSegment(0,0,4,5);let i=new Nr;i.emplaceBack(0,0,0,0),i.emplaceBack(8192,0,8192,0),i.emplaceBack(0,8192,0,8192),i.emplaceBack(8192,8192,8192,8192),this.rasterBoundsBuffer=t.createVertexBuffer(i,Yt.members),this.rasterBoundsSegments=se.simpleSegment(0,0,4,2);let n=new Gt;n.emplaceBack(0,0),n.emplaceBack(1,0),n.emplaceBack(0,1),n.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(n,qa.members),this.viewportSegments=se.simpleSegment(0,0,4,2);let a=new ji;a.emplaceBack(0),a.emplaceBack(1),a.emplaceBack(3),a.emplaceBack(2),a.emplaceBack(0),this.tileBorderIndexBuffer=t.createIndexBuffer(a);let s=new Ge;s.emplaceBack(0,1,2),s.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(s);let l=this.context.gl;this.stencilClearMode=new ae({func:l.ALWAYS,mask:0},0,255,l.ZERO,l.ZERO,l.ZERO)}clearStencil(){let t=this.context,e=t.gl;this.nextStencilID=1,this.currentStencilSource=void 0;let r=G.create();G.ortho(r,0,this.width,this.height,0,0,1),G.scale(r,r,[e.drawingBufferWidth,e.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(t,e.TRIANGLES,J.disabled,this.stencilClearMode,be.disabled,ie.disabled,wh(r),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(t,e){if(this.currentStencilSource===t.source||!t.isTileClipped()||!e||!e.length)return;this.currentStencilSource=t.source;let r=this.context,i=r.gl;this.nextStencilID+e.length>256&&this.clearStencil(),r.setColorMode(be.disabled),r.setDepthMode(J.disabled);let n=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(let a of e){let s=this._tileClippingMaskIDs[a.key]=this.nextStencilID++,l=this.style.map.terrain&&this.style.map.terrain.getTerrainData(a);n.draw(r,i.TRIANGLES,J.disabled,new ae({func:i.ALWAYS,mask:0},s,255,i.KEEP,i.KEEP,i.REPLACE),be.disabled,ie.disabled,wh(a.posMatrix),l,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();let t=this.nextStencilID++,e=this.context.gl;return new ae({func:e.NOTEQUAL,mask:255},t,255,e.KEEP,e.KEEP,e.REPLACE)}stencilModeForClipping(t){let e=this.context.gl;return new ae({func:e.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,e.KEEP,e.KEEP,e.REPLACE)}stencilConfigForOverlap(t){let e=this.context.gl,r=t.sort((a,s)=>s.overscaledZ-a.overscaledZ),i=r[r.length-1].overscaledZ,n=r[0].overscaledZ-i+1;if(n>1){this.currentStencilSource=void 0,this.nextStencilID+n>256&&this.clearStencil();let a={};for(let s=0;s<n;s++)a[s+i]=new ae({func:e.GEQUAL,mask:255},s+this.nextStencilID,255,e.KEEP,e.KEEP,e.REPLACE);return this.nextStencilID+=n,[a,r]}return[{[i]:ae.disabled},r]}colorModeForRenderPass(){let t=this.context.gl;return this._showOverdrawInspector?new be([t.CONSTANT_COLOR,t.ONE],new pe(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?be.unblended:be.alphaBlended}depthModeForSublayer(t,e,r){if(!this.opaquePassEnabledForLayer())return J.disabled;let i=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new J(r||this.context.gl.LEQUAL,e,[i,i])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(t,e){this.style=t,this.options=e,this.lineAtlas=t.lineAtlas,this.imageManager=t.imageManager,this.glyphManager=t.glyphManager,this.symbolFadeChange=t.placement.symbolFadeChange($.now()),this.imageManager.beginFrame();let r=this.style._order,i=this.style.sourceCaches,n={},a={},s={};for(let l in i){let c=i[l];c.used&&c.prepare(this.context),n[l]=c.getVisibleCoordinates(),a[l]=n[l].slice().reverse(),s[l]=c.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let l=0;l<r.length;l++){let c=r[l];if(this.style._layers[c].is3D()){this.opaquePassCutoff=l;break}}this.maybeDrawDepthAndCoords(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen";for(let l of r){let c=this.style._layers[l];if(!c.hasOffscreenPass()||c.isHidden(this.transform.zoom))continue;let p=a[c.source];c.type!=="custom"&&!p.length||this.renderLayer(this,i[c.source],c,p)}if(this.context.bindFramebuffer.set(null),this.context.clear({color:e.showOverdrawInspector?pe.black:pe.transparent,depth:1}),this.clearStencil(),this._showOverdrawInspector=e.showOverdrawInspector,this.depthRangeFor3D=[0,1-(t._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=r.length-1;this.currentLayer>=0;this.currentLayer--){let l=this.style._layers[r[this.currentLayer]],c=i[l.source],p=n[l.source];this._renderTileClippingMasks(l,p),this.renderLayer(this,c,l,p)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<r.length;this.currentLayer++){let l=this.style._layers[r[this.currentLayer]],c=i[l.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(l))continue;let p=(l.type==="symbol"?s:a)[l.source];this._renderTileClippingMasks(l,n[l.source]),this.renderLayer(this,c,l,p)}if(this.options.showTileBoundaries){let l=jx(this.style,this.transform.zoom);l&&Nx(this,l,l.getVisibleCoordinates())}this.options.showPadding&&Gx(this),this.context.setDefault()}maybeDrawDepthAndCoords(t){if(!this.style||!this.style.map||!this.style.map.terrain)return;let e=this.terrainFacilitator.matrix,r=this.transform.projMatrix,i=this.terrainFacilitator.dirty;i||(i=t?!G.exactEquals(e,r):!G.equals(e,r)),i||(i=this.style.map.terrain.sourceCache.tilesAfterTime(this.terrainFacilitator.renderTime).length>0),i&&(G.copy(e,r),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,Zx(this,this.style.map.terrain),Hx(this,this.style.map.terrain))}renderLayer(t,e,r,i){if(!r.isHidden(this.transform.zoom)&&!(r.type!=="background"&&r.type!=="custom"&&!(i||[]).length))switch(this.id=r.id,r.type){case"symbol":Ex(t,e,r,i,this.style.placement.variableOffsets);break;case"circle":Mx(t,e,r,i);break;case"heatmap":Lx(t,e,r,i);break;case"line":Dx(t,e,r,i);break;case"fill":Fx(t,e,r,i);break;case"fill-extrusion":Rx(t,e,r,i);break;case"hillshade":zx(t,e,r,i);break;case"raster":Bx(t,e,r,i);break;case"background":Ox(t,e,r,i);break;case"custom":qx(t,e,r);break}}translatePosMatrix(t,e,r,i,n){if(!r[0]&&!r[1])return t;let a=n?i==="map"?this.transform.angle:0:i==="viewport"?-this.transform.angle:0;if(a){let c=Math.sin(a),p=Math.cos(a);r=[r[0]*p-r[1]*c,r[0]*c+r[1]*p]}let s=[n?r[0]:Le(e,r[0],this.transform.zoom),n?r[1]:Le(e,r[1],this.transform.zoom),0],l=new Float32Array(16);return G.translate(l,t,s),l}saveTileTexture(t){let e=this._tileTextures[t.size[0]];e?e.push(t):this._tileTextures[t.size[0]]=[t]}getTileTexture(t){let e=this._tileTextures[t];return e&&e.length>0?e.pop():null}isPatternMissing(t){if(!t)return!1;if(!t.from||!t.to)return!0;let e=this.imageManager.getPattern(t.from.toString()),r=this.imageManager.getPattern(t.to.toString());return!e||!r}useProgram(t,e){this.cache=this.cache||{};let r=t+(e?e.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[r]||(this.cache[r]=new Wa(this.context,Ir[t],e,Tx[t],this._showOverdrawInspector,this.style.map.terrain)),this.cache[r]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){let t=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(t.FUNC_ADD)}initDebugOverlayCanvas(){if(this.debugOverlayCanvas==null){this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512;let t=this.context.gl;this.debugOverlayTexture=new me(this.context,this.debugOverlayCanvas,t.RGBA)}}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){let{drawingBufferWidth:t,drawingBufferHeight:e}=this.context.gl;return this.width!==t||this.height!==e}};u(bm,"Painter");var Bs=bm;m();var De=re(fe(),1);m();var Vs=class Vs{constructor(t,e){this.points=t;this.planes=e}static fromInvProjectionMatrix(t,e,r){let i=[[-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]],n=Math.pow(2,r),a=i.map(c=>{c=ke.transformMat4([],c,t);let p=1/c[3]/e*n;return ke.mul(c,c,[p,p,1/c[3],p])}),l=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(c=>{let p=ot.sub([],a[c[0]],a[c[1]]),h=ot.sub([],a[c[2]],a[c[1]]),f=ot.normalize([],ot.cross([],p,h)),d=-ot.dot(f,a[c[1]]);return f.concat(d)});return new Vs(a,l)}};u(Vs,"Frustum");var Os=Vs,Us=class Us{constructor(t,e){this.min=t,this.max=e,this.center=ot.scale([],ot.add([],this.min,this.max),.5)}quadrant(t){let e=[t%2===0,t<2],r=ot.clone(this.min),i=ot.clone(this.max);for(let n=0;n<e.length;n++)r[n]=e[n]?this.min[n]:this.center[n],i[n]=e[n]?this.center[n]:this.max[n];return i[2]=this.max[2],new Us(r,i)}distanceX(t){return Math.max(Math.min(this.max[0],t[0]),this.min[0])-t[0]}distanceY(t){return Math.max(Math.min(this.max[1],t[1]),this.min[1])-t[1]}intersects(t){let e=[[this.min[0],this.min[1],this.min[2],1],[this.max[0],this.min[1],this.min[2],1],[this.max[0],this.max[1],this.min[2],1],[this.min[0],this.max[1],this.min[2],1],[this.min[0],this.min[1],this.max[2],1],[this.max[0],this.min[1],this.max[2],1],[this.max[0],this.max[1],this.max[2],1],[this.min[0],this.max[1],this.max[2],1]],r=!0;for(let i=0;i<t.planes.length;i++){let n=t.planes[i],a=0;for(let s=0;s<e.length;s++)ke.dot(n,e[s])>=0&&a++;if(a===0)return 0;a!==e.length&&(r=!1)}if(r)return 2;for(let i=0;i<3;i++){let n=Number.MAX_VALUE,a=-Number.MAX_VALUE;for(let s=0;s<t.points.length;s++){let l=t.points[s][i]-this.min[i];n=Math.min(n,l),a=Math.max(a,l)}if(a<0||n>this.max[i]-this.min[i])return 0}return 1}};u(Us,"Aabb");var An=Us;m();var Wx=re(fe(),1);var Gs=class Gs{constructor(t=0,e=0,r=0,i=0){if(isNaN(t)||t<0||isNaN(e)||e<0||isNaN(r)||r<0||isNaN(i)||i<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=e,this.left=r,this.right=i}interpolate(t,e,r){return e.top!=null&&t.top!=null&&(this.top=we.number(t.top,e.top,r)),e.bottom!=null&&t.bottom!=null&&(this.bottom=we.number(t.bottom,e.bottom,r)),e.left!=null&&t.left!=null&&(this.left=we.number(t.left,e.left,r)),e.right!=null&&t.right!=null&&(this.right=we.number(t.right,e.right,r)),this}getCenter(t,e){let r=ge((this.left+t-this.right)/2,0,t),i=ge((this.top+e-this.bottom)/2,0,e);return new Wx.default(r,i)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new Gs(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}};u(Gs,"EdgeInsets");var In=Gs;var Ns=85.051129,qs=class qs{constructor(t,e,r,i,n){this.tileSize=512,this._renderWorldCopies=n===void 0?!0:!!n,this._minZoom=t||0,this._maxZoom=e||22,this._minPitch=r==null?0:r,this._maxPitch=i==null?60:i,this.setMaxBounds(),this.width=0,this.height=0,this._center=new ee(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new In,this._posMatrixCache={},this._alignedPosMatrixCache={},this.minElevationForCurrentTile=0}clone(){let t=new qs(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return t.apply(this),t}apply(t){this.tileSize=t.tileSize,this.latRange=t.latRange,this.width=t.width,this.height=t.height,this._center=t._center,this._elevation=t._elevation,this.minElevationForCurrentTile=t.minElevationForCurrentTile,this.zoom=t.zoom,this.angle=t.angle,this._fov=t._fov,this._pitch=t._pitch,this._unmodified=t._unmodified,this._edgeInsets=t._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))}get maxZoom(){return this._maxZoom}set maxZoom(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))}get minPitch(){return this._minPitch}set minPitch(t){this._minPitch!==t&&(this._minPitch=t,this.pitch=Math.max(this.pitch,t))}get maxPitch(){return this._maxPitch}set maxPitch(t){this._maxPitch!==t&&(this._maxPitch=t,this.pitch=Math.min(this.pitch,t))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(t){t===void 0?t=!0:t===null&&(t=!1),this._renderWorldCopies=t}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new De.default(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(t){let e=-vt(t,-180,180)*Math.PI/180;this.angle!==e&&(this._unmodified=!1,this.angle=e,this._calcMatrices(),this.rotationMatrix=Al.create(),Al.rotate(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(t){let e=ge(t,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==e&&(this._unmodified=!1,this._pitch=e,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(t){t=Math.max(.01,Math.min(60,t)),this._fov!==t&&(this._unmodified=!1,this._fov=t/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(t){let e=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==e&&(this._unmodified=!1,this._zoom=e,this.tileZoom=Math.max(0,Math.floor(e)),this.scale=this.zoomScale(e),this._constrain(),this._calcMatrices())}get center(){return this._center}set center(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(t){t!==this._elevation&&(this._elevation=t,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(t){this._edgeInsets.equals(t)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,t,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(t){return this._edgeInsets.equals(t)}interpolatePadding(t,e,r){this._unmodified=!1,this._edgeInsets.interpolate(t,e,r),this._constrain(),this._calcMatrices()}coveringZoomLevel(t){let e=(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize));return Math.max(0,e)}getVisibleUnwrappedCoordinates(t){let e=[new Yr(0,t)];if(this._renderWorldCopies){let r=this.pointCoordinate(new De.default(0,0)),i=this.pointCoordinate(new De.default(this.width,0)),n=this.pointCoordinate(new De.default(this.width,this.height)),a=this.pointCoordinate(new De.default(0,this.height)),s=Math.floor(Math.min(r.x,i.x,n.x,a.x)),l=Math.floor(Math.max(r.x,i.x,n.x,a.x)),c=1;for(let p=s-c;p<=l+c;p++)p!==0&&e.push(new Yr(p,t))}return e}coveringTiles(t){var w,v;let e=this.coveringZoomLevel(t),r=e;if(t.minzoom!==void 0&&e<t.minzoom)return[];t.maxzoom!==void 0&&e>t.maxzoom&&(e=t.maxzoom);let i=this.pointCoordinate(this.getCameraPoint()),n=Te.fromLngLat(this.center),a=Math.pow(2,e),s=[a*i.x,a*i.y,0],l=[a*n.x,a*n.y,0],c=Os.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,e),p=t.minzoom||0;!t.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(p=e);let h=t.terrain?2/Math.min(this.tileSize,t.tileSize)*this.tileSize:3,f=u(b=>({aabb:new An([b*a,0,0],[(b+1)*a,a,0]),zoom:0,x:0,y:0,wrap:b,fullyVisible:!1}),"newRootTile"),d=[],g=[],y=e,_=t.reparseOverscaled?r:e;if(this._renderWorldCopies)for(let b=1;b<=3;b++)d.push(f(-b)),d.push(f(b));for(d.push(f(0));d.length>0;){let b=d.pop(),P=b.x,S=b.y,A=b.fullyVisible;if(!A){let F=b.aabb.intersects(c);if(F===0)continue;A=F===2}let L=t.terrain?s:l,D=b.aabb.distanceX(L),k=b.aabb.distanceY(L),E=Math.max(Math.abs(D),Math.abs(k)),U=h+(1<<y-b.zoom)-2;if(b.zoom===y||E>U&&b.zoom>=p){let F=y-b.zoom,M=s[0]-.5-(P<<F),N=s[1]-.5-(S<<F);g.push({tileID:new Re(b.zoom===y?_:b.zoom,b.wrap,b.zoom,P,S),distanceSq:no.sqrLen([l[0]-.5-P,l[1]-.5-S]),tileDistanceToCamera:Math.sqrt(M*M+N*N)});continue}for(let F=0;F<4;F++){let M=(P<<1)+F%2,N=(S<<1)+(F>>1),z=b.zoom+1,W=b.aabb.quadrant(F);if(t.terrain){let te=new Re(z,b.wrap,z,M,N),K=t.terrain.getMinMaxElevation(te),H=(w=K.minElevation)!=null?w:this.elevation,ze=(v=K.maxElevation)!=null?v:this.elevation;W=new An([W.min[0],W.min[1],H],[W.max[0],W.max[1],ze])}d.push({aabb:W,zoom:z,x:M,y:N,wrap:b.wrap,fullyVisible:A})}}return g.sort((b,P)=>b.distanceSq-P.distanceSq).map(b=>b.tileID)}resize(t,e){this.width=t,this.height=e,this.pixelsToGLUnits=[2/t,-2/e],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(t){return Math.pow(2,t)}scaleZoom(t){return Math.log(t)/Math.LN2}project(t){let e=ge(t.lat,-Ns,Ns);return new De.default(Xt(t.lng)*this.worldSize,Jt(e)*this.worldSize)}unproject(t){return new Te(t.x/this.worldSize,t.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}getCameraPosition(){let t=this.pointLocation(this.getCameraPoint()),e=Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter;return{lngLat:t,altitude:e+this.elevation}}recalculateZoom(t){let e=this.elevation,r=Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter,i=this.pointLocation(this.centerPoint,t),n=t.getElevationForLngLatZoom(i,this.tileZoom);if(!(this.elevation-n))return;let s=r+e-n,p=Math.cos(this._pitch)*this.cameraToCenterDistance/s/Aa(1,i.lat)/this.tileSize,h=this.scaleZoom(p);this._elevation=n,this._center=i,this.zoom=h}setLocationAtPoint(t,e){let r=this.pointCoordinate(e),i=this.pointCoordinate(this.centerPoint),n=this.locationCoordinate(t),a=new Te(n.x-(r.x-i.x),n.y-(r.y-i.y));this.center=this.coordinateLocation(a),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(t,e){return e?this.coordinatePoint(this.locationCoordinate(t),e.getElevationForLngLatZoom(t,this.tileZoom),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(t))}pointLocation(t,e){return this.coordinateLocation(this.pointCoordinate(t,e))}locationCoordinate(t){return Te.fromLngLat(t)}coordinateLocation(t){return t&&t.toLngLat()}pointCoordinate(t,e){if(e){let y=e.pointCoordinate(t);if(y!=null)return y}let r=0,i=[t.x,t.y,0,1],n=[t.x,t.y,1,1];ke.transformMat4(i,i,this.pixelMatrixInverse),ke.transformMat4(n,n,this.pixelMatrixInverse);let a=i[3],s=n[3],l=i[0]/a,c=n[0]/s,p=i[1]/a,h=n[1]/s,f=i[2]/a,d=n[2]/s,g=f===d?0:(r-f)/(d-f);return new Te(we.number(l,c,g)/this.worldSize,we.number(p,h,g)/this.worldSize)}coordinatePoint(t,e=0,r=this.pixelMatrix){let i=[t.x*this.worldSize,t.y*this.worldSize,e,1];return ke.transformMat4(i,i,r),new De.default(i[0]/i[3],i[1]/i[3])}getBounds(){let t=Math.max(0,this.height/2-this.getHorizon());return new Ke().extend(this.pointLocation(new De.default(0,t))).extend(this.pointLocation(new De.default(this.width,t))).extend(this.pointLocation(new De.default(this.width,this.height))).extend(this.pointLocation(new De.default(0,this.height)))}getMaxBounds(){return!this.latRange||this.latRange.length!==2||!this.lngRange||this.lngRange.length!==2?null:new Ke([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]])}getHorizon(){return Math.tan(Math.PI/2-this._pitch)*this.cameraToCenterDistance*.85}setMaxBounds(t){t?(this.lngRange=[t.getWest(),t.getEast()],this.latRange=[t.getSouth(),t.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-Ns,Ns])}calculatePosMatrix(t,e=!1){let r=t.key,i=e?this._alignedPosMatrixCache:this._posMatrixCache;if(i[r])return i[r];let n=t.canonical,a=this.worldSize/this.zoomScale(n.z),s=n.x+Math.pow(2,n.z)*t.wrap,l=G.identity(new Float64Array(16));return G.translate(l,l,[s*a,n.y*a,0]),G.scale(l,l,[a/8192,a/8192,1]),G.multiply(l,e?this.alignedProjMatrix:this.projMatrix,l),i[r]=new Float32Array(l),i[r]}customLayerMatrix(){return this.mercatorMatrix.slice()}getConstrained(t,e){e=ge(+e,this.minZoom,this.maxZoom);let r={center:new ee(t.lng,t.lat),zoom:e},i=this.lngRange;if(!this._renderWorldCopies&&i===null){let b=179.9999999999;i=[-b,b]}let n=this.tileSize*this.zoomScale(r.zoom),a=0,s=n,l=0,c=n,p=0,h=0,{x:f,y:d}=this.size;if(this.latRange){let b=this.latRange;a=Jt(b[1])*n,s=Jt(b[0])*n,s-a<d&&(p=d/(s-a))}i&&(l=vt(Xt(i[0])*n,0,n),c=vt(Xt(i[1])*n,0,n),c<l&&(c+=n),c-l<f&&(h=f/(c-l)));let{x:g,y}=this.project.call({worldSize:n},t),_,w,v=Math.max(h||0,p||0);if(v){let b=new De.default(h?(c+l)/2:g,p?(s+a)/2:y);return r.center=this.unproject.call({worldSize:n},b).wrap(),r.zoom+=this.scaleZoom(v),r}if(this.latRange){let b=d/2;y-b<a&&(w=a+b),y+b>s&&(w=s-b)}if(i){let b=(l+c)/2,P=g;this._renderWorldCopies&&(P=vt(g,b-n/2,b+n/2));let S=f/2;P-S<l&&(_=l+S),P+S>c&&(_=c-S)}if(_!==void 0||w!==void 0){let b=new De.default(_!=null?_:g,w!=null?w:y);r.center=this.unproject.call({worldSize:n},b).wrap()}return r}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;let t=this._unmodified,{center:e,zoom:r}=this.getConstrained(this.center,this.zoom);this.center=e,this.zoom=r,this._unmodified=t,this._constraining=!1}_calcMatrices(){if(!this.height)return;let t=this._fov/2,e=this.centerOffset,r=this.point.x,i=this.point.y;this.cameraToCenterDistance=.5/Math.tan(t)*this.height,this._pixelPerMeter=Aa(1,this.center.lat)*this.worldSize;let n=G.identity(new Float64Array(16));G.scale(n,n,[this.width/2,-this.height/2,1]),G.translate(n,n,[1,-1,0]),this.labelPlaneMatrix=n,n=G.identity(new Float64Array(16)),G.scale(n,n,[1,-1,1]),G.translate(n,n,[-1,-1,0]),G.scale(n,n,[2/this.width,2/this.height,1]),this.glCoordMatrix=n;let a=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch),s=Math.min(this.elevation,this.minElevationForCurrentTile),l=a-s*this._pixelPerMeter/Math.cos(this._pitch),c=s<0?l:a,p=Math.PI/2+this._pitch,h=this._fov*(.5+e.y/this.height),f=Math.sin(h)*c/Math.sin(ge(Math.PI-p-h,.01,Math.PI-.01)),d=this.getHorizon(),y=2*Math.atan(d/this.cameraToCenterDistance)*(.5+e.y/(d*2)),_=Math.sin(y)*c/Math.sin(ge(Math.PI-p-y,.01,Math.PI-.01)),w=Math.min(f,_),v=(Math.cos(Math.PI/2-this._pitch)*w+c)*1.01,b=this.height/50;n=new Float64Array(16),G.perspective(n,this._fov,this.width/this.height,b,v),n[8]=-e.x*2/this.width,n[9]=e.y*2/this.height,G.scale(n,n,[1,-1,1]),G.translate(n,n,[0,0,-this.cameraToCenterDistance]),G.rotateX(n,n,this._pitch),G.rotateZ(n,n,this.angle),G.translate(n,n,[-r,-i,0]),this.mercatorMatrix=G.scale([],n,[this.worldSize,this.worldSize,this.worldSize]),G.scale(n,n,[1,1,this._pixelPerMeter]),this.pixelMatrix=G.multiply(new Float64Array(16),this.labelPlaneMatrix,n),G.translate(n,n,[0,0,-this.elevation]),this.projMatrix=n,this.invProjMatrix=G.invert([],n),this.pixelMatrix3D=G.multiply(new Float64Array(16),this.labelPlaneMatrix,n);let P=this.width%2/2,S=this.height%2/2,A=Math.cos(this.angle),L=Math.sin(this.angle),D=r-Math.round(r)+A*P+L*S,k=i-Math.round(i)+A*S+L*P,E=new Float64Array(n);if(G.translate(E,E,[D>.5?D-1:D,k>.5?k-1:k,0]),this.alignedProjMatrix=E,n=G.invert(new Float64Array(16),this.pixelMatrix),!n)throw new Error("failed to invert matrix");this.pixelMatrixInverse=n,this._posMatrixCache={},this._alignedPosMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;let t=this.pointCoordinate(new De.default(0,0)),e=[t.x*this.worldSize,t.y*this.worldSize,0,1];return ke.transformMat4(e,e,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){let t=this._pitch,e=Math.tan(t)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new De.default(0,e))}getCameraQueryGeometry(t){let e=this.getCameraPoint();if(t.length===1)return[t[0],e];{let r=e.x,i=e.y,n=e.x,a=e.y;for(let s of t)r=Math.min(r,s.x),i=Math.min(i,s.y),n=Math.max(n,s.x),a=Math.max(a,s.y);return[new De.default(r,i),new De.default(n,i),new De.default(n,a),new De.default(r,a),new De.default(r,i)]}}lngLatToCameraDepth(t,e){let r=this.locationCoordinate(t),i=[r.x*this.worldSize,r.y*this.worldSize,e,1];return ke.transformMat4(i,i,this.projMatrix),i[2]/i[3]}};u(qs,"Transform");var js=qs;m();m();function Zs(o,t){let e=!1,r=null,i=null,n,a=u(()=>{r=null,e&&(o.apply(i,n),r=setTimeout(a,t),e=!1)},"later");return(...s)=>(e=!0,i=this,n=s,r||a(),r)}u(Zs,"throttle");var vm=class vm{constructor(t){this._getCurrentHash=u(()=>{let t=window.location.hash.replace("#","");if(this._hashName){let e;return t.split("&").map(r=>r.split("=")).forEach(r=>{r[0]===this._hashName&&(e=r)}),(e&&e[1]||"").split("/")}return t.split("/")},"_getCurrentHash");this._onHashChange=u(()=>{let t=this._getCurrentHash();if(t.length>=3&&!t.some(e=>isNaN(e))){let e=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(t[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:e,pitch:+(t[4]||0)}),!0}return!1},"_onHashChange");this._updateHashUnthrottled=u(()=>{let t=window.location.href.replace(/(#.+)?$/,this.getHashString());try{window.history.replaceState(window.history.state,null,t)}catch{}},"_updateHashUnthrottled");this._updateHash=Zs(this._updateHashUnthrottled,30*1e3/100);this._hashName=t&&encodeURIComponent(t)}addTo(t){return this._map=t,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),delete this._map,this}getHashString(t){let e=this._map.getCenter(),r=Math.round(this._map.getZoom()*100)/100,i=Math.ceil((r*Math.LN2+Math.log(512/360/.5))/Math.LN10),n=Math.pow(10,i),a=Math.round(e.lng*n)/n,s=Math.round(e.lat*n)/n,l=this._map.getBearing(),c=this._map.getPitch(),p="";if(t?p+="/".concat(a,"/").concat(s,"/").concat(r):p+="".concat(r,"/").concat(s,"/").concat(a),(l||c)&&(p+="/".concat(Math.round(l*10)/10)),c&&(p+="/".concat(Math.round(c))),this._hashName){let h=this._hashName,f=!1,d=window.location.hash.slice(1).split("&").map(g=>{let y=g.split("=")[0];return y===h?(f=!0,"".concat(y,"=").concat(p)):g}).filter(g=>g);return f||d.push("".concat(h,"=").concat(p)),"#".concat(d.join("&"))}return"#".concat(p)}};u(vm,"Hash");var Cn=vm;m();m();var Kx=re(fe(),1);var $s={linearity:.3,easing:hi(0,0,.3,1)},G0=B({deceleration:2500,maxSpeed:1400},$s),N0=B({deceleration:20,maxSpeed:1400},$s),j0=B({deceleration:1e3,maxSpeed:360},$s),q0=B({deceleration:1e3,maxSpeed:90},$s),wm=class wm{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:$.now(),settings:t})}_drainInertiaBuffer(){let t=this._inertiaBuffer,e=$.now(),r=160;for(;t.length>0&&e-t[0].time>r;)t.shift()}_onMoveEnd(t){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;let e={zoom:0,bearing:0,pitch:0,pan:new Kx.default(0,0),pinchAround:void 0,around:void 0};for(let{settings:a}of this._inertiaBuffer)e.zoom+=a.zoomDelta||0,e.bearing+=a.bearingDelta||0,e.pitch+=a.pitchDelta||0,a.panDelta&&e.pan._add(a.panDelta),a.around&&(e.around=a.around),a.pinchAround&&(e.pinchAround=a.pinchAround);let i=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,n={};if(e.pan.mag()){let a=Ws(e.pan.mag(),i,B({},G0,t||{}));n.offset=e.pan.mult(a.amount/e.pan.mag()),n.center=this._map.transform.center,Hs(n,a)}if(e.zoom){let a=Ws(e.zoom,i,N0);n.zoom=this._map.transform.zoom+a.amount,Hs(n,a)}if(e.bearing){let a=Ws(e.bearing,i,j0);n.bearing=this._map.transform.bearing+ge(a.amount,-179,179),Hs(n,a)}if(e.pitch){let a=Ws(e.pitch,i,q0);n.pitch=this._map.transform.pitch+a.amount,Hs(n,a)}if(n.zoom||n.bearing){let a=e.pinchAround===void 0?e.around:e.pinchAround;n.around=a?this._map.unproject(a):this._map.getCenter()}return this.clear(),B(n,{noMoveStart:!0})}};u(wm,"HandlerInertia");var Ks=wm;function Hs(o,t){(!o.duration||o.duration<t.duration)&&(o.duration=t.duration,o.easing=t.easing)}u(Hs,"extendDuration");function Ws(o,t,e){let{maxSpeed:r,linearity:i,deceleration:n}=e,a=ge(o*i/(t/1e3),-r,r),s=Math.abs(a)/(n*i);return{easing:e.easing,duration:s*1e3,amount:a*(s/2)}}u(Ws,"calculateEasing");m();m();var $x=re(fe(),1);var Pm=class Pm extends C{constructor(e,r,i,n={}){let a=I.mousePos(r.getCanvas(),i),s=r.unproject(a);super(e,B({point:a,lngLat:s,originalEvent:i},n));this._defaultPrevented=!1,this.target=r}preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}};u(Pm,"MapMouseEvent");var Ne=Pm,Sm=class Sm extends C{constructor(e,r,i){let n=e==="touchend"?i.changedTouches:i.touches,a=I.touchPos(r.getCanvasContainer(),n),s=a.map(p=>r.unproject(p)),l=a.reduce((p,h,f,d)=>p.add(h.div(d.length)),new $x.default(0,0)),c=r.unproject(l);super(e,{points:a,point:l,lngLats:s,lngLat:c,originalEvent:i});this._defaultPrevented=!1}preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}};u(Sm,"MapTouchEvent");var er=Sm,Tm=class Tm extends C{constructor(e,r,i){super(e,{originalEvent:i});this._defaultPrevented=!1}preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}};u(Tm,"MapWheelEvent");var En=Tm;var Am=class Am{constructor(t,e){this._map=t,this._clickTolerance=e.clickTolerance}reset(){delete this._mousedownPos}wheel(t){return this._firePreventable(new En(t.type,this._map,t))}mousedown(t,e){return this._mousedownPos=e,this._firePreventable(new Ne(t.type,this._map,t))}mouseup(t){this._map.fire(new Ne(t.type,this._map,t))}click(t,e){this._mousedownPos&&this._mousedownPos.dist(e)>=this._clickTolerance||this._map.fire(new Ne(t.type,this._map,t))}dblclick(t){return this._firePreventable(new Ne(t.type,this._map,t))}mouseover(t){this._map.fire(new Ne(t.type,this._map,t))}mouseout(t){this._map.fire(new Ne(t.type,this._map,t))}touchstart(t){return this._firePreventable(new er(t.type,this._map,t))}touchmove(t){this._map.fire(new er(t.type,this._map,t))}touchend(t){this._map.fire(new er(t.type,this._map,t))}touchcancel(t){this._map.fire(new er(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}};u(Am,"MapEventHandler");var Xs=Am,Im=class Im{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(t){this._map.fire(new Ne(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Ne("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._ignoreContextMenu||this._map.fire(new Ne(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}};u(Im,"BlockableMapEventHandler");var Js=Im;m();m();var Xx=re(fe(),1);var Cm=class Cm{constructor(t){this._map=t}get transform(){return this._map._requestedCameraState||this._map.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(t){return this.transform.pointLocation(Xx.default.convert(t),this._map.terrain)}};u(Cm,"TransformProvider");var lt=Cm;var Em=class Em{constructor(t,e){this._map=t,this._tr=new lt(t),this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=e.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(t,e){this.isEnabled()&&t.shiftKey&&t.button===0&&(I.disableDrag(),this._startPos=this._lastPos=e,this._active=!0)}mousemoveWindow(t,e){if(!this._active)return;let r=e;if(this._lastPos.equals(r)||!this._box&&r.dist(this._startPos)<this._clickTolerance)return;let i=this._startPos;this._lastPos=r,this._box||(this._box=I.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",t));let n=Math.min(i.x,r.x),a=Math.max(i.x,r.x),s=Math.min(i.y,r.y),l=Math.max(i.y,r.y);I.setTransform(this._box,"translate(".concat(n,"px,").concat(s,"px)")),this._box.style.width="".concat(a-n,"px"),this._box.style.height="".concat(l-s,"px")}mouseupWindow(t,e){if(!this._active||t.button!==0)return;let r=this._startPos,i=e;if(this.reset(),I.suppressClick(),r.x===i.x&&r.y===i.y)this._fireEvent("boxzoomcancel",t);else return this._map.fire(new C("boxzoomend",{originalEvent:t})),{cameraAnimation:n=>n.fitScreenCoordinates(r,i,this._tr.bearing,{linear:!0})}}keydown(t){this._active&&t.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",t))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(I.remove(this._box),this._box=null),I.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(t,e){return this._map.fire(new C(t,{originalEvent:e}))}};u(Em,"BoxZoomHandler");var Mn=Em;m();m();var Jx=re(fe(),1);m();function Ln(o,t){if(o.length!==t.length)throw new Error("The number of touches and points are not equal - touches ".concat(o.length,", points ").concat(t.length));let e={};for(let r=0;r<o.length;r++)e[o[r].identifier]=t[r];return e}u(Ln,"indexTouches");function Z0(o){let t=new Jx.default(0,0);for(let e of o)t._add(e);return t.div(o.length)}u(Z0,"getCentroid");var Lm=500,H0=500,Ys=30,Dm=class Dm{constructor(t){this.reset(),this.numTouches=t.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(t,e,r){(this.centroid||r.length>this.numTouches)&&(this.aborted=!0),!this.aborted&&(this.startTime===void 0&&(this.startTime=t.timeStamp),r.length===this.numTouches&&(this.centroid=Z0(e),this.touches=Ln(r,e)))}touchmove(t,e,r){if(this.aborted||!this.centroid)return;let i=Ln(r,e);for(let n in this.touches){let a=this.touches[n],s=i[n];(!s||s.dist(a)>Ys)&&(this.aborted=!0)}}touchend(t,e,r){if((!this.centroid||t.timeStamp-this.startTime>H0)&&(this.aborted=!0),r.length===0){let i=!this.aborted&&this.centroid;if(this.reset(),i)return i}}};u(Dm,"SingleTapRecognizer");var Mm=Dm,km=class km{constructor(t){this.singleTap=new Mm(t),this.numTaps=t.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(t,e,r){this.singleTap.touchstart(t,e,r)}touchmove(t,e,r){this.singleTap.touchmove(t,e,r)}touchend(t,e,r){let i=this.singleTap.touchend(t,e,r);if(i){let n=t.timeStamp-this.lastTime<Lm,a=!this.lastTap||this.lastTap.dist(i)<Ys;if((!n||!a)&&this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=i,this.count===this.numTaps)return this.reset(),i}}};u(km,"TapRecognizer");var Cr=km;var Fm=class Fm{constructor(t){this._tr=new lt(t),this._zoomIn=new Cr({numTouches:1,numTaps:2}),this._zoomOut=new Cr({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(t,e,r){this._zoomIn.touchstart(t,e,r),this._zoomOut.touchstart(t,e,r)}touchmove(t,e,r){this._zoomIn.touchmove(t,e,r),this._zoomOut.touchmove(t,e,r)}touchend(t,e,r){let i=this._zoomIn.touchend(t,e,r),n=this._zoomOut.touchend(t,e,r),a=this._tr;if(i)return this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:s=>s.easeTo({duration:300,zoom:a.zoom+1,around:a.unproject(i)},{originalEvent:t})};if(n)return this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:s=>s.easeTo({duration:300,zoom:a.zoom-1,around:a.unproject(n)},{originalEvent:t})}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}};u(Fm,"TapZoomHandler");var Qs=Fm;m();m();var Rm=class Rm{constructor(t){this._enabled=!!t.enable,this._moveStateManager=t.moveStateManager,this._clickTolerance=t.clickTolerance||1,this._moveFunction=t.move,this._activateOnStart=!!t.activateOnStart,t.assignEvents(this),this.reset()}reset(t){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(t)}_move(...t){let e=this._moveFunction(...t);if(e.bearingDelta||e.pitchDelta||e.around||e.panDelta)return this._active=!0,e}dragStart(t,e){!this.isEnabled()||this._lastPoint||this._moveStateManager.isValidStartEvent(t)&&(this._moveStateManager.startMove(t),this._lastPoint=e.length?e[0]:e,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(t,e){if(!this.isEnabled())return;let r=this._lastPoint;if(!r)return;if(t.preventDefault(),!this._moveStateManager.isValidMoveEvent(t)){this.reset(t);return}let i=e.length?e[0]:e;if(!(!this._moved&&i.dist(r)<this._clickTolerance))return this._moved=!0,this._lastPoint=i,this._move(r,i)}dragEnd(t){!this.isEnabled()||!this._lastPoint||this._moveStateManager.isValidEndEvent(t)&&(this._moved&&I.suppressClick(),this.reset(t))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}};u(Rm,"DragHandler");var Mt=Rm;m();var W0=0,K0=2,$0={[W0]:1,[K0]:2};function X0(o,t){let e=$0[t];return o.buttons===void 0||(o.buttons&e)!==e}u(X0,"buttonNoLongerPressed");var zm=class zm{constructor(t){this._correctEvent=t.checkCorrectEvent}startMove(t){let e=I.mouseButton(t);this._eventButton=e}endMove(t){delete this._eventButton}isValidStartEvent(t){return this._correctEvent(t)}isValidMoveEvent(t){return!X0(t,this._eventButton)}isValidEndEvent(t){return I.mouseButton(t)===this._eventButton}};u(zm,"MouseMoveStateManager");var oi=zm,Bm=class Bm{constructor(){this._firstTouch=void 0}_isOneFingerTouch(t){return t.targetTouches.length===1}_isSameTouchEvent(t){return t.targetTouches[0].identifier===this._firstTouch}startMove(t){let e=t.targetTouches[0].identifier;this._firstTouch=e}endMove(t){delete this._firstTouch}isValidStartEvent(t){return this._isOneFingerTouch(t)}isValidMoveEvent(t){return this._isOneFingerTouch(t)&&this._isSameTouchEvent(t)}isValidEndEvent(t){return this._isOneFingerTouch(t)&&this._isSameTouchEvent(t)}};u(Bm,"OneFingerTouchMoveStateManager");var Dn=Bm;var Om=0,Yx=2,Vm=u(o=>{o.mousedown=o.dragStart,o.mousemoveWindow=o.dragMove,o.mouseup=o.dragEnd,o.contextmenu=function(t){t.preventDefault()}},"assignEvents"),Qx=u(({enable:o,clickTolerance:t})=>{let e=new oi({checkCorrectEvent:r=>I.mouseButton(r)===Om&&!r.ctrlKey});return new Mt({clickTolerance:t,move:(r,i)=>({around:i,panDelta:i.sub(r)}),activateOnStart:!0,moveStateManager:e,enable:o,assignEvents:Vm})},"generateMousePanHandler"),el=u(({enable:o,clickTolerance:t,bearingDegreesPerPixelMoved:e=.8})=>{let r=new oi({checkCorrectEvent:i=>I.mouseButton(i)===Om&&i.ctrlKey||I.mouseButton(i)===Yx});return new Mt({clickTolerance:t,move:(i,n)=>({bearingDelta:(n.x-i.x)*e}),moveStateManager:r,enable:o,assignEvents:Vm})},"generateMouseRotationHandler"),tl=u(({enable:o,clickTolerance:t,pitchDegreesPerPixelMoved:e=-.5})=>{let r=new oi({checkCorrectEvent:i=>I.mouseButton(i)===Om&&i.ctrlKey||I.mouseButton(i)===Yx});return new Mt({clickTolerance:t,move:(i,n)=>({pitchDelta:(n.y-i.y)*e}),moveStateManager:r,enable:o,assignEvents:Vm})},"generateMousePitchHandler");m();var rl=re(fe(),1);var Um=class Um{constructor(t,e){this._clickTolerance=t.clickTolerance||1,this._map=e,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new rl.default(0,0)}minTouchs(){return this._map.cooperativeGestures.isEnabled()?2:1}touchstart(t,e,r){return this._calculateTransform(t,e,r)}touchmove(t,e,r){if(!(!this._active||r.length<this.minTouchs()))return t.preventDefault(),this._calculateTransform(t,e,r)}touchend(t,e,r){this._calculateTransform(t,e,r),this._active&&r.length<this.minTouchs()&&this.reset()}touchcancel(){this.reset()}_calculateTransform(t,e,r){r.length>0&&(this._active=!0);let i=Ln(r,e),n=new rl.default(0,0),a=new rl.default(0,0),s=0;for(let p in i){let h=i[p],f=this._touches[p];f&&(n._add(h),a._add(h.sub(f)),s++,i[p]=h)}if(this._touches=i,s<this.minTouchs()||!a.mag())return;let l=a.div(s);return this._sum._add(l),this._sum.mag()<this._clickTolerance?void 0:{around:n.div(s),panDelta:l}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}};u(Um,"TouchPanHandler");var il=Um;m();var Nm=class Nm{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(t,e,r){this._firstTwoTouches||r.length<2||(this._firstTwoTouches=[r[0].identifier,r[1].identifier],this._start([e[0],e[1]]))}touchmove(t,e,r){if(!this._firstTwoTouches)return;t.preventDefault();let[i,n]=this._firstTwoTouches,a=nl(r,e,i),s=nl(r,e,n);if(!a||!s)return;let l=this._aroundCenter?null:a.add(s).div(2);return this._move([a,s],l,t)}touchend(t,e,r){if(!this._firstTwoTouches)return;let[i,n]=this._firstTwoTouches,a=nl(r,e,i),s=nl(r,e,n);a&&s||(this._active&&I.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(t){this._enabled=!0,this._aroundCenter=!!t&&t.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}};u(Nm,"TwoFingersTouchHandler");var kn=Nm;function nl(o,t,e){for(let r=0;r<o.length;r++)if(o[r].identifier===e)return t[r]}u(nl,"getTouchById");var J0=.1;function eb(o,t){return Math.log(o/t)/Math.LN2}u(eb,"getZoomDelta");var jm=class jm extends kn{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(e){this._startDistance=this._distance=e[0].dist(e[1])}_move(e,r){let i=this._distance;if(this._distance=e[0].dist(e[1]),!(!this._active&&Math.abs(eb(this._distance,this._startDistance))<J0))return this._active=!0,{zoomDelta:eb(this._distance,i),pinchAround:r}}};u(jm,"TwoFingersTouchZoomHandler");var Fn=jm,Y0=25;function tb(o,t){return o.angleWith(t)*180/Math.PI}u(tb,"getBearingDelta");var qm=class qm extends kn{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(e){this._startVector=this._vector=e[0].sub(e[1]),this._minDiameter=e[0].dist(e[1])}_move(e,r,i){let n=this._vector;if(this._vector=e[0].sub(e[1]),!(!this._active&&this._isBelowThreshold(this._vector)))return this._active=!0,{bearingDelta:tb(this._vector,n),pinchAround:r}}_isBelowThreshold(e){this._minDiameter=Math.min(this._minDiameter,e.mag());let r=Math.PI*this._minDiameter,i=Y0/r*360,n=tb(e,this._startVector);return Math.abs(n)<i}};u(qm,"TwoFingersTouchRotateHandler");var Rn=qm;function Gm(o){return Math.abs(o.y)>Math.abs(o.x)}u(Gm,"isVertical");var Q0=100,Zm=class Zm extends kn{constructor(e){super();this._currentTouchCount=0;this._map=e}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(e,r,i){super.touchstart(e,r,i),this._currentTouchCount=i.length}_start(e){this._lastPoints=e,Gm(e[0].sub(e[1]))&&(this._valid=!1)}_move(e,r,i){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;let n=e[0].sub(this._lastPoints[0]),a=e[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(n,a,i.timeStamp),this._valid?(this._lastPoints=e,this._active=!0,{pitchDelta:(n.y+a.y)/2*-.5}):void 0}gestureBeginsVertically(e,r,i){if(this._valid!==void 0)return this._valid;let n=2,a=e.mag()>=n,s=r.mag()>=n;if(!a&&!s)return;if(!a||!s)return this._firstMove===void 0&&(this._firstMove=i),i-this._firstMove<Q0?void 0:!1;let l=e.y>0==r.y>0;return Gm(e)&&Gm(r)&&l}};u(Zm,"TwoFingersTouchPitchHandler");var zn=Zm;m();var e1={panStep:100,bearingStep:15,pitchStep:10},Hm=class Hm{constructor(t){this._tr=new lt(t);let e=e1;this._panStep=e.panStep,this._bearingStep=e.bearingStep,this._pitchStep=e.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(t){if(t.altKey||t.ctrlKey||t.metaKey)return;let e=0,r=0,i=0,n=0,a=0;switch(t.keyCode){case 61:case 107:case 171:case 187:e=1;break;case 189:case 109:case 173:e=-1;break;case 37:t.shiftKey?r=-1:(t.preventDefault(),n=-1);break;case 39:t.shiftKey?r=1:(t.preventDefault(),n=1);break;case 38:t.shiftKey?i=1:(t.preventDefault(),a=-1);break;case 40:t.shiftKey?i=-1:(t.preventDefault(),a=1);break;default:return}return this._rotationDisabled&&(r=0,i=0),{cameraAnimation:s=>{let l=this._tr;s.easeTo({duration:300,easeId:"keyboardHandler",easing:t1,zoom:e?Math.round(l.zoom)+e*(t.shiftKey?2:1):l.zoom,bearing:l.bearing+r*this._bearingStep,pitch:l.pitch+i*this._pitchStep,offset:[-n*this._panStep,-a*this._panStep],center:l.center},{originalEvent:t})}}}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}};u(Hm,"KeyboardHandler");var Bn=Hm;function t1(o){return o*(2-o)}u(t1,"easeOut");m();var rb=4.000244140625,r1=1/100,i1=1/450,n1=2,Wm=class Wm{constructor(t,e){this._onTimeout=u(t=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(t)},"_onTimeout");this._map=t,this._tr=new lt(t),this._triggerRenderFrame=e,this._delta=0,this._defaultZoomRate=r1,this._wheelZoomRate=i1}setZoomRate(t){this._defaultZoomRate=t}setWheelZoomRate(t){this._wheelZoomRate=t}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!t&&t.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}wheel(t){if(!this.isEnabled()||this._map.cooperativeGestures.isEnabled()&&!t[this._map.cooperativeGestures._bypassKey])return;let e=t.deltaMode===WheelEvent.DOM_DELTA_LINE?t.deltaY*40:t.deltaY,r=$.now(),i=r-(this._lastWheelEventTime||0);this._lastWheelEventTime=r,e!==0&&e%rb===0?this._type="wheel":e!==0&&Math.abs(e)<4?this._type="trackpad":i>400?(this._type=null,this._lastValue=e,this._timeout=setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(i*e)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,e+=this._lastValue)),t.shiftKey&&e&&(e=e/4),this._type&&(this._lastWheelEvent=t,this._delta-=e,this._active||this._start(t)),t.preventDefault()}_start(t){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);let e=I.mousePos(this._map.getCanvas(),t),r=this._tr;e.y>r.transform.height/2-r.transform.getHorizon()?this._around=ee.convert(this._aroundCenter?r.center:r.unproject(e)):this._around=ee.convert(r.center),this._aroundPoint=r.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;let t=this._tr.transform;if(this._delta!==0){let s=this._type==="wheel"&&Math.abs(this._delta)>rb?this._wheelZoomRate:this._defaultZoomRate,l=n1/(1+Math.exp(-Math.abs(this._delta*s)));this._delta<0&&l!==0&&(l=1/l);let c=typeof this._targetZoom=="number"?t.zoomScale(this._targetZoom):t.scale;this._targetZoom=Math.min(t.maxZoom,Math.max(t.minZoom,t.scaleZoom(c*l))),this._type==="wheel"&&(this._startZoom=t.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}let e=typeof this._targetZoom=="number"?this._targetZoom:t.zoom,r=this._startZoom,i=this._easing,n=!1,a;if(this._type==="wheel"&&r&&i){let s=Math.min(($.now()-this._lastWheelEventTime)/200,1),l=i(s);a=we.number(r,e,l),s<1?this._frameId||(this._frameId=!0):n=!0}else a=e,n=!0;return this._active=!0,n&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!n,zoomDelta:a-t.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let e=mi;if(this._prevEase){let r=this._prevEase,i=($.now()-r.start)/r.duration,n=r.easing(i+.01)-r.easing(i),a=.27/Math.sqrt(n*n+1e-4)*.01,s=Math.sqrt(.27*.27-a*a);e=hi(a,s,.25,1)}return this._prevEase={start:$.now(),duration:t,easing:e},e}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}};u(Wm,"ScrollZoomHandler");var On=Wm;m();var Km=class Km{constructor(t,e){this._clickZoom=t,this._tapZoom=e}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()}};u(Km,"DoubleClickZoomHandler");var Vn=Km;m();var $m=class $m{constructor(t){this._tr=new lt(t),this.reset()}reset(){this._active=!1}dblclick(t,e){return t.preventDefault(),{cameraAnimation:r=>{r.easeTo({duration:300,zoom:this._tr.zoom+(t.shiftKey?-1:1),around:this._tr.unproject(e)},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}};u($m,"ClickZoomHandler");var ol=$m;m();var Xm=class Xm{constructor(){this._tap=new Cr({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(t,e,r){if(!this._swipePoint)if(!this._tapTime)this._tap.touchstart(t,e,r);else{let i=e[0],n=t.timeStamp-this._tapTime<Lm,a=this._tapPoint.dist(i)<Ys;!n||!a?this.reset():r.length>0&&(this._swipePoint=i,this._swipeTouch=r[0].identifier)}}touchmove(t,e,r){if(!this._tapTime)this._tap.touchmove(t,e,r);else if(this._swipePoint){if(r[0].identifier!==this._swipeTouch)return;let i=e[0],n=i.y-this._swipePoint.y;return this._swipePoint=i,t.preventDefault(),this._active=!0,{zoomDelta:n/128}}}touchend(t,e,r){if(this._tapTime)this._swipePoint&&r.length===0&&this.reset();else{let i=this._tap.touchend(t,e,r);i&&(this._tapTime=t.timeStamp,this._tapPoint=i)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}};u(Xm,"TapDragZoomHandler");var al=Xm;m();var Jm=class Jm{constructor(t,e,r){this._el=t,this._mousePan=e,this._touchPan=r}enable(t){this._inertiaOptions=t||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}};u(Jm,"DragPanHandler");var Un=Jm;m();var Ym=class Ym{constructor(t,e,r){this._pitchWithRotate=t.pitchWithRotate,this._mouseRotate=e,this._mousePitch=r}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()}};u(Ym,"DragRotateHandler");var Gn=Ym;m();var Qm=class Qm{constructor(t,e,r,i){this._el=t,this._touchZoom=e,this._touchRotate=r,this._tapDragZoom=i,this._rotationDisabled=!1,this._enabled=!0}enable(t){this._touchZoom.enable(t),this._rotationDisabled||this._touchRotate.enable(t),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-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()}};u(Qm,"TwoFingersTouchZoomRotateHandler");var Nn=Qm;m();var ef=class ef{constructor(t,e){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey";this._map=t,this._options=e,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;let t=this._map.getCanvasContainer();t.classList.add("maplibregl-cooperative-gestures"),this._container=I.create("div","maplibregl-cooperative-gesture-screen",t);let e=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(e=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));let r=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),i=document.createElement("div");i.className="maplibregl-desktop-message",i.textContent=e,this._container.appendChild(i);let n=document.createElement("div");n.className="maplibregl-mobile-message",n.textContent=r,this._container.appendChild(n),this._container.setAttribute("aria-hidden","true")}_destoryUI(){this._container&&(I.remove(this._container),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destoryUI()}isEnabled(){return this._enabled}touchmove(t){this._onCooperativeGesture(t.touches.length===1)}wheel(t){this._map.scrollZoom.isEnabled()&&this._onCooperativeGesture(!t[this._bypassKey])}_onCooperativeGesture(t){!this._enabled||!t||(this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}};u(ef,"CooperativeGesturesHandler");var jn=ef;var ib=re(fe(),1);var sl=u(o=>o.zoom||o.drag||o.pitch||o.rotate,"isMoving"),nf=class nf extends C{};u(nf,"RenderFrameEvent");var rf=nf;function tf(o){return o.panDelta&&o.panDelta.mag()||o.zoomDelta||o.bearingDelta||o.pitchDelta}u(tf,"hasChange");var of=class of{constructor(t,e){this.handleWindowEvent=u(t=>{this.handleEvent(t,"".concat(t.type,"Window"))},"handleWindowEvent");this.handleEvent=u((t,e)=>{if(t.type==="blur"){this.stop(!0);return}this._updatingCamera=!0;let r=t.type==="renderFrame"?void 0:t,i={needsRenderFrame:!1},n={},a={},s=t.touches,l=s?this._getMapTouches(s):void 0,c=l?I.touchPos(this._map.getCanvas(),l):I.mousePos(this._map.getCanvas(),t);for(let{handlerName:f,handler:d,allowed:g}of this._handlers){if(!d.isEnabled())continue;let y;this._blockedByActive(a,g,f)?d.reset():d[e||t.type]&&(y=d[e||t.type](t,c,l),this.mergeHandlerResult(i,n,y,f,r),y&&y.needsRenderFrame&&this._triggerRenderFrame()),(y||d.isActive())&&(a[f]=d)}let p={};for(let f in this._previousActiveHandlers)a[f]||(p[f]=r);this._previousActiveHandlers=a,(Object.keys(p).length||tf(i))&&(this._changes.push([i,n,p]),this._triggerRenderFrame()),(Object.keys(a).length||tf(i))&&this._map._stop(!0),this._updatingCamera=!1;let{cameraAnimation:h}=i;h&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],h(this._map))},"handleEvent");this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Ks(t),this._bearingSnap=e.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(e);let r=this._el;this._listeners=[[r,"touchstart",{passive:!0}],[r,"touchmove",{passive:!1}],[r,"touchend",void 0],[r,"touchcancel",void 0],[r,"mousedown",void 0],[r,"mousemove",void 0],[r,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[r,"mouseover",void 0],[r,"mouseout",void 0],[r,"dblclick",void 0],[r,"click",void 0],[r,"keydown",{capture:!1}],[r,"keyup",void 0],[r,"wheel",{passive:!1}],[r,"contextmenu",void 0],[window,"blur",void 0]];for(let[i,n,a]of this._listeners);}destroy(){for(let[t,e,r]of this._listeners)I.removeEventListener(t,e,t===document?this.handleWindowEvent:this.handleEvent,r)}_addDefaultHandlers(t){let e=this._map,r=e.getCanvasContainer();this._add("mapEvent",new Xs(e,t));let i=e.boxZoom=new Mn(e,t);this._add("boxZoom",i),t.interactive&&t.boxZoom&&i.enable();let n=e.cooperativeGestures=new jn(e,t.cooperativeGestures);this._add("cooperativeGestures",n),t.cooperativeGestures&&n.enable();let a=new Qs(e),s=new ol(e);e.doubleClickZoom=new Vn(s,a),this._add("tapZoom",a),this._add("clickZoom",s),t.interactive&&t.doubleClickZoom&&e.doubleClickZoom.enable();let l=new al;this._add("tapDragZoom",l);let c=e.touchPitch=new zn(e);this._add("touchPitch",c),t.interactive&&t.touchPitch&&e.touchPitch.enable(t.touchPitch);let p=el(t),h=tl(t);e.dragRotate=new Gn(t,p,h),this._add("mouseRotate",p,["mousePitch"]),this._add("mousePitch",h,["mouseRotate"]),t.interactive&&t.dragRotate&&e.dragRotate.enable();let f=Qx(t),d=new il(t,e);e.dragPan=new Un(r,f,d),this._add("mousePan",f),this._add("touchPan",d,["touchZoom","touchRotate"]),t.interactive&&t.dragPan&&e.dragPan.enable(t.dragPan);let g=new Rn,y=new Fn;e.touchZoomRotate=new Nn(r,y,g,l),this._add("touchRotate",g,["touchPan","touchZoom"]),this._add("touchZoom",y,["touchPan","touchRotate"]),t.interactive&&t.touchZoomRotate&&e.touchZoomRotate.enable(t.touchZoomRotate);let _=e.scrollZoom=new On(e,()=>this._triggerRenderFrame());this._add("scrollZoom",_,["mousePan"]),t.interactive&&t.scrollZoom&&e.scrollZoom.enable(t.scrollZoom);let w=e.keyboard=new Bn(e);this._add("keyboard",w),t.interactive&&t.keyboard&&e.keyboard.enable(),this._add("blockableMapEvent",new Js(e))}_add(t,e,r){this._handlers.push({handlerName:t,handler:e,allowed:r}),this._handlersById[t]=e}stop(t){if(!this._updatingCamera){for(let{handler:e}of this._handlers)e.reset();this._inertia.clear(),this._fireEvents({},{},t),this._changes=[]}}isActive(){for(let{handler:t}of this._handlers)if(t.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!sl(this._eventsInProgress)||this.isZooming()}_blockedByActive(t,e,r){for(let i in t)if(i!==r&&(!e||e.indexOf(i)<0))return!0;return!1}_getMapTouches(t){let e=[];for(let r of t){let i=r.target;this._el.contains(i)&&e.push(r)}return e}mergeHandlerResult(t,e,r,i,n){if(!r)return;B(t,r);let a={handlerName:i,originalEvent:r.originalEvent||n};r.zoomDelta!==void 0&&(e.zoom=a),r.panDelta!==void 0&&(e.drag=a),r.pitchDelta!==void 0&&(e.pitch=a),r.bearingDelta!==void 0&&(e.rotate=a)}_applyChanges(){let t={},e={},r={};for(let[i,n,a]of this._changes)i.panDelta&&(t.panDelta=(t.panDelta||new ib.default(0,0))._add(i.panDelta)),i.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+i.zoomDelta),i.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+i.bearingDelta),i.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+i.pitchDelta),i.around!==void 0&&(t.around=i.around),i.pinchAround!==void 0&&(t.pinchAround=i.pinchAround),i.noInertia&&(t.noInertia=i.noInertia),B(e,n),B(r,a);this._updateMapTransform(t,e,r),this._changes=[]}_updateMapTransform(t,e,r){let i=this._map,n=i._getTransformForUpdate(),a=i.terrain;if(!tf(t)&&!(a&&this._terrainMovement))return this._fireEvents(e,r,!0);let{panDelta:s,zoomDelta:l,bearingDelta:c,pitchDelta:p,around:h,pinchAround:f}=t;f!==void 0&&(h=f),i._stop(!0),h=h||i.transform.centerPoint;let d=n.pointLocation(s?h.sub(s):h);c&&(n.bearing+=c),p&&(n.pitch+=p),l&&(n.zoom+=l),a?!this._terrainMovement&&(e.drag||e.zoom)?(this._terrainMovement=!0,this._map._elevationFreeze=!0,n.setLocationAtPoint(d,h),this._map.once("moveend",()=>{this._map._elevationFreeze=!1,this._terrainMovement=!1,n.recalculateZoom(i.terrain)})):e.drag&&this._terrainMovement?n.center=n.pointLocation(n.centerPoint.sub(s)):n.setLocationAtPoint(d,h):n.setLocationAtPoint(d,h),i._applyUpdatedTransform(n),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(e,r,!0)}_fireEvents(t,e,r){let i=sl(this._eventsInProgress),n=sl(t),a={};for(let p in t){let{originalEvent:h}=t[p];this._eventsInProgress[p]||(a["".concat(p,"start")]=h),this._eventsInProgress[p]=t[p]}!i&&n&&this._fireEvent("movestart",n.originalEvent);for(let p in a)this._fireEvent(p,a[p]);n&&this._fireEvent("move",n.originalEvent);for(let p in t){let{originalEvent:h}=t[p];this._fireEvent(p,h)}let s={},l;for(let p in this._eventsInProgress){let{handlerName:h,originalEvent:f}=this._eventsInProgress[p];this._handlersById[h].isActive()||(delete this._eventsInProgress[p],l=e[h]||f,s["".concat(p,"end")]=l)}for(let p in s)this._fireEvent(p,s[p]);let c=sl(this._eventsInProgress);if(r&&(i||n)&&!c){this._updatingCamera=!0;let p=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),h=u(f=>f!==0&&-this._bearingSnap<f&&f<this._bearingSnap,"shouldSnapToNorth");p&&(p.essential||!$.prefersReducedMotion)?(h(p.bearing||this._map.getBearing())&&(p.bearing=0),p.freezeElevation=!0,this._map.easeTo(p,{originalEvent:l})):(this._map.fire(new C("moveend",{originalEvent:l})),h(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(t,e){this._map.fire(new C(t,e?{originalEvent:e}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(t=>{delete this._frameId,this.handleEvent(new rf("renderFrame",{timeStamp:t})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}};u(of,"HandlerManager");var ll=of;m();var dt=re(fe(),1);var af=class af extends le{constructor(e,r){super();this._renderFrameCallback=u(()=>{let e=Math.min(($.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(e)),e<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},"_renderFrameCallback");this._moving=!1,this._zooming=!1,this.transform=e,this._bearingSnap=r.bearingSnap,this.on("moveend",()=>{delete this._requestedCameraState})}getCenter(){return new ee(this.transform.center.lng,this.transform.center.lat)}setCenter(e,r){return this.jumpTo({center:e},r)}panBy(e,r,i){return e=dt.default.convert(e).mult(-1),this.panTo(this.transform.center,B({offset:e},r),i)}panTo(e,r,i){return this.easeTo(B({center:e},r),i)}getZoom(){return this.transform.zoom}setZoom(e,r){return this.jumpTo({zoom:e},r),this}zoomTo(e,r,i){return this.easeTo(B({zoom:e},r),i)}zoomIn(e,r){return this.zoomTo(this.getZoom()+1,e,r),this}zoomOut(e,r){return this.zoomTo(this.getZoom()-1,e,r),this}getBearing(){return this.transform.bearing}setBearing(e,r){return this.jumpTo({bearing:e},r),this}getPadding(){return this.transform.padding}setPadding(e,r){return this.jumpTo({padding:e},r),this}rotateTo(e,r,i){return this.easeTo(B({bearing:e},r),i)}resetNorth(e,r){return this.rotateTo(0,B({duration:1e3},e),r),this}resetNorthPitch(e,r){return this.easeTo(B({bearing:0,pitch:0,duration:1e3},e),r),this}snapToNorth(e,r){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(e,r):this}getPitch(){return this.transform.pitch}setPitch(e,r){return this.jumpTo({pitch:e},r),this}cameraForBounds(e,r){e=Ke.convert(e);let i=r&&r.bearing||0;return this._cameraForBoxAndBearing(e.getNorthWest(),e.getSouthEast(),i,r)}_cameraForBoxAndBearing(e,r,i,n){let a={top:0,bottom:0,right:0,left:0};if(n=B({padding:a,offset:[0,0],maxZoom:this.transform.maxZoom},n),typeof n.padding=="number"){let te=n.padding;n.padding={top:te,bottom:te,right:te,left:te}}n.padding=B(a,n.padding);let s=this.transform,l=s.padding,c=new Ke(e,r),p=s.project(c.getNorthWest()),h=s.project(c.getNorthEast()),f=s.project(c.getSouthEast()),d=s.project(c.getSouthWest()),g=Ll(-i),y=p.rotate(g),_=h.rotate(g),w=f.rotate(g),v=d.rotate(g),b=new dt.default(Math.max(y.x,_.x,v.x,w.x),Math.max(y.y,_.y,v.y,w.y)),P=new dt.default(Math.min(y.x,_.x,v.x,w.x),Math.min(y.y,_.y,v.y,w.y)),S=b.sub(P),A=(s.width-(l.left+l.right+n.padding.left+n.padding.right))/S.x,L=(s.height-(l.top+l.bottom+n.padding.top+n.padding.bottom))/S.y;if(L<0||A<0){ve("Map cannot fit within canvas with the given bounds, padding, and/or offset.");return}let D=Math.min(s.scaleZoom(s.scale*Math.min(A,L)),n.maxZoom),k=dt.default.convert(n.offset),E=(n.padding.left-n.padding.right)/2,U=(n.padding.top-n.padding.bottom)/2,M=new dt.default(E,U).rotate(Ll(i)),z=k.add(M).mult(s.scale/s.zoomScale(D));return{center:s.unproject(p.add(f).div(2).sub(z)),zoom:D,bearing:i}}fitBounds(e,r,i){return this._fitInternal(this.cameraForBounds(e,r),r,i)}fitScreenCoordinates(e,r,i,n,a){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(dt.default.convert(e)),this.transform.pointLocation(dt.default.convert(r)),i,n),n,a)}_fitInternal(e,r,i){return e?(r=B(e,r),delete r.padding,r.linear?this.easeTo(r,i):this.flyTo(r,i)):this}jumpTo(e,r){this.stop();let i=this._getTransformForUpdate(),n=!1,a=!1,s=!1;return"zoom"in e&&i.zoom!==+e.zoom&&(n=!0,i.zoom=+e.zoom),e.center!==void 0&&(i.center=ee.convert(e.center)),"bearing"in e&&i.bearing!==+e.bearing&&(a=!0,i.bearing=+e.bearing),"pitch"in e&&i.pitch!==+e.pitch&&(s=!0,i.pitch=+e.pitch),e.padding!=null&&!i.isPaddingEqual(e.padding)&&(i.padding=e.padding),this._applyUpdatedTransform(i),this.fire(new C("movestart",r)).fire(new C("move",r)),n&&this.fire(new C("zoomstart",r)).fire(new C("zoom",r)).fire(new C("zoomend",r)),a&&this.fire(new C("rotatestart",r)).fire(new C("rotate",r)).fire(new C("rotateend",r)),s&&this.fire(new C("pitchstart",r)).fire(new C("pitch",r)).fire(new C("pitchend",r)),this.fire(new C("moveend",r))}calculateCameraOptionsFromTo(e,r,i,n=0){let a=Te.fromLngLat(e,r),s=Te.fromLngLat(i,n),l=s.x-a.x,c=s.y-a.y,p=s.z-a.z,h=Math.hypot(l,c,p);if(h===0)throw new Error("Can't calculate camera options with same From and To");let f=Math.hypot(l,c),d=this.transform.scaleZoom(this.transform.cameraToCenterDistance/h/this.transform.tileSize),g=Math.atan2(l,-c)*180/Math.PI,y=Math.acos(f/h)*180/Math.PI;return y=p<0?90-y:90+y,{center:s.toLngLat(),zoom:d,pitch:y,bearing:g}}easeTo(e,r){var L;this._stop(!1,e.easeId),e=B({offset:[0,0],duration:500,easing:mi},e),(e.animate===!1||!e.essential&&$.prefersReducedMotion)&&(e.duration=0);let i=this._getTransformForUpdate(),n=this.getZoom(),a=this.getBearing(),s=this.getPitch(),l=this.getPadding(),c="bearing"in e?this._normalizeBearing(e.bearing,a):a,p="pitch"in e?+e.pitch:s,h="padding"in e?e.padding:i.padding,f=dt.default.convert(e.offset),d=i.centerPoint.add(f),g=i.pointLocation(d),{center:y,zoom:_}=i.getConstrained(ee.convert(e.center||g),(L=e.zoom)!=null?L:n);this._normalizeCenter(y);let w=i.project(g),v=i.project(y).sub(w),b=i.zoomScale(_-n),P,S;e.around&&(P=ee.convert(e.around),S=i.locationPoint(P));let A={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||_!==n,this._rotating=this._rotating||a!==c,this._pitching=this._pitching||p!==s,this._padding=!i.isPaddingEqual(h),this._easeId=e.easeId,this._prepareEase(r,e.noMoveStart,A),this.terrain&&this._prepareElevation(y),this._ease(D=>{if(this._zooming&&(i.zoom=we.number(n,_,D)),this._rotating&&(i.bearing=we.number(a,c,D)),this._pitching&&(i.pitch=we.number(s,p,D)),this._padding&&(i.interpolatePadding(l,h,D),d=i.centerPoint.add(f)),this.terrain&&!e.freezeElevation&&this._updateElevation(D),P)i.setLocationAtPoint(P,S);else{let k=i.zoomScale(i.zoom-n),E=_>n?Math.min(2,b):Math.max(.5,b),U=Math.pow(E,1-D),F=i.unproject(w.add(v.mult(D*U)).mult(k));i.setLocationAtPoint(i.renderWorldCopies?F.wrap():F,d)}this._applyUpdatedTransform(i),this._fireMoveEvents(r)},D=>{this.terrain&&this._finalizeElevation(),this._afterEase(r,D)},e),this}_prepareEase(e,r,i={}){this._moving=!0,!r&&!i.moving&&this.fire(new C("movestart",e)),this._zooming&&!i.zooming&&this.fire(new C("zoomstart",e)),this._rotating&&!i.rotating&&this.fire(new C("rotatestart",e)),this._pitching&&!i.pitching&&this.fire(new C("pitchstart",e))}_prepareElevation(e){this._elevationCenter=e,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(e,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(e){this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);let r=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(e<1&&r!==this._elevationTarget){let i=this._elevationTarget-this._elevationStart,n=(r-(i*e+this._elevationStart))/(1-e);this._elevationStart+=e*(i-n),this._elevationTarget=r}this.transform.elevation=we.number(this._elevationStart,this._elevationTarget,e)}_finalizeElevation(){this._elevationFreeze=!1,this.transform.recalculateZoom(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_applyUpdatedTransform(e){if(!this.transformCameraUpdate)return;let r=e.clone(),{center:i,zoom:n,pitch:a,bearing:s,elevation:l}=this.transformCameraUpdate(r);i&&(r.center=i),n!==void 0&&(r.zoom=n),a!==void 0&&(r.pitch=a),s!==void 0&&(r.bearing=s),l!==void 0&&(r.elevation=l),this.transform.apply(r)}_fireMoveEvents(e){this.fire(new C("move",e)),this._zooming&&this.fire(new C("zoom",e)),this._rotating&&this.fire(new C("rotate",e)),this._pitching&&this.fire(new C("pitch",e))}_afterEase(e,r){if(this._easeId&&r&&this._easeId===r)return;delete this._easeId;let i=this._zooming,n=this._rotating,a=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,i&&this.fire(new C("zoomend",e)),n&&this.fire(new C("rotateend",e)),a&&this.fire(new C("pitchend",e)),this.fire(new C("moveend",e))}flyTo(e,r){var te;if(!e.essential&&$.prefersReducedMotion){let K=Rt(e,["center","zoom","bearing","pitch","around"]);return this.jumpTo(K,r)}this.stop(),e=B({offset:[0,0],speed:1.2,curve:1.42,easing:mi},e);let i=this._getTransformForUpdate(),n=this.getZoom(),a=this.getBearing(),s=this.getPitch(),l=this.getPadding(),c="bearing"in e?this._normalizeBearing(e.bearing,a):a,p="pitch"in e?+e.pitch:s,h="padding"in e?e.padding:i.padding,f=dt.default.convert(e.offset),d=i.centerPoint.add(f),g=i.pointLocation(d),{center:y,zoom:_}=i.getConstrained(ee.convert(e.center||g),(te=e.zoom)!=null?te:n);this._normalizeCenter(y);let w=i.zoomScale(_-n),v=i.project(g),b=i.project(y).sub(v),P=e.curve,S=Math.max(i.width,i.height),A=S/w,L=b.mag();if("minZoom"in e){let K=ge(Math.min(e.minZoom,n,_),i.minZoom,i.maxZoom),H=S/i.zoomScale(K-n);P=Math.sqrt(H/L*2)}let D=P*P;function k(K){let H=(A*A-S*S+(K?-1:1)*D*D*L*L)/(2*(K?A:S)*D*L);return Math.log(Math.sqrt(H*H+1)-H)}u(k,"zoomOutFactor");function E(K){return(Math.exp(K)-Math.exp(-K))/2}u(E,"sinh");function U(K){return(Math.exp(K)+Math.exp(-K))/2}u(U,"cosh");function F(K){return E(K)/U(K)}u(F,"tanh");let M=k(!1),N=u(function(K){return U(M)/U(M+P*K)},"w"),z=u(function(K){return S*((U(M)*F(M+P*K)-E(M))/D)/L},"u"),W=(k(!0)-M)/P;if(Math.abs(L)<1e-6||!isFinite(W)){if(Math.abs(S-A)<1e-6)return this.easeTo(e,r);let K=A<S?-1:1;W=Math.abs(Math.log(A/S))/P,z=u(function(){return 0},"u"),N=u(function(H){return Math.exp(K*P*H)},"w")}if("duration"in e)e.duration=+e.duration;else{let K="screenSpeed"in e?+e.screenSpeed/P:+e.speed;e.duration=1e3*W/K}return e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=a!==c,this._pitching=p!==s,this._padding=!i.isPaddingEqual(h),this._prepareEase(r,!1),this.terrain&&this._prepareElevation(y),this._ease(K=>{let H=K*W,ze=1/N(H);i.zoom=K===1?_:n+i.scaleZoom(ze),this._rotating&&(i.bearing=we.number(a,c,K)),this._pitching&&(i.pitch=we.number(s,p,K)),this._padding&&(i.interpolatePadding(l,h,K),d=i.centerPoint.add(f)),this.terrain&&!e.freezeElevation&&this._updateElevation(K);let Ae=K===1?y:i.unproject(v.add(b.mult(z(H))).mult(ze));i.setLocationAtPoint(i.renderWorldCopies?Ae.wrap():Ae,d),this._applyUpdatedTransform(i),this._fireMoveEvents(r)},()=>{this.terrain&&this._finalizeElevation(),this._afterEase(r)},e),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(e,r){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){let i=this._onEaseEnd;delete this._onEaseEnd,i.call(this,r)}if(!e){let i=this.handlers;i&&i.stop(!1)}return this}_ease(e,r,i){i.animate===!1||i.duration===0?(e(1),r()):(this._easeStart=$.now(),this._easeOptions=i,this._onEaseFrame=e,this._onEaseEnd=r,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(e,r){e=vt(e,-180,180);let i=Math.abs(e-r);return Math.abs(e-360-r)<i&&(e-=360),Math.abs(e+360-r)<i&&(e+=360),e}_normalizeCenter(e){let r=this.transform;if(!r.renderWorldCopies||r.lngRange)return;let i=e.lng-r.center.lng;e.lng+=i>180?-360:i<-180?360:0}queryTerrainElevation(e){return this.terrain?this.terrain.getElevationForLngLatZoom(ee.convert(e),this.transform.tileZoom)-this.transform.elevation:null}};u(af,"Camera");var ul=af;var Lt=re(fe(),1);m();var sf={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'},lf=class lf{constructor(t=sf){this._toggleAttribution=u(()=>{this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")))},"_toggleAttribution");this._updateData=u(t=>{t&&(t.sourceDataType==="metadata"||t.sourceDataType==="visibility"||t.dataType==="style"||t.type==="terrain")&&this._updateAttributions()},"_updateData");this._updateCompact=u(()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact===!1?this._container.setAttribute("open",""):!this._container.classList.contains("maplibregl-compact")&&!this._container.classList.contains("maplibregl-attrib-empty")&&(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","maplibregl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show"))},"_updateCompact");this._updateCompactMinimize=u(()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")},"_updateCompactMinimize");this.options=t}getDefaultPosition(){return"bottom-right"}onAdd(t){return this._map=t,this._compact=this.options.compact,this._container=I.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=I.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=I.create("div","maplibregl-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("terrain",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._container}onRemove(){I.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(t,e){let r=this._map._getUIString("AttributionControl.".concat(e));t.title=r,t.setAttribute("aria-label",r)}_updateAttributions(){if(!this._map.style)return;let t=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=t.concat(this.options.customAttribution.map(i=>typeof i!="string"?"":i)):typeof this.options.customAttribution=="string"&&t.push(this.options.customAttribution)),this._map.style.stylesheet){let i=this._map.style.stylesheet;this.styleOwner=i.owner,this.styleId=i.id}let e=this._map.style.sourceCaches;for(let i in e){let n=e[i];if(n.used||n.usedForTerrain){let a=n.getSource();a.attribution&&t.indexOf(a.attribution)<0&&t.push(a.attribution)}}t=t.filter(i=>String(i).trim()),t.sort((i,n)=>i.length-n.length),t=t.filter((i,n)=>{for(let a=n+1;a<t.length;a++)if(t[a].indexOf(i)>=0)return!1;return!0});let r=t.join(" | ");r!==this._attribHTML&&(this._attribHTML=r,t.length?(this._innerContainer.innerHTML=r,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}};u(lf,"AttributionControl");var qn=lf;m();var uf=class uf{constructor(t={}){this._updateCompact=u(()=>{let t=this._container.children;if(t.length){let e=t[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&e.classList.add("maplibregl-compact"):e.classList.remove("maplibregl-compact")}},"_updateCompact");this.options=t}getDefaultPosition(){return"bottom-left"}onAdd(t){this._map=t,this._compact=this.options&&this.options.compact,this._container=I.create("div","maplibregl-ctrl");let e=I.create("a","maplibregl-ctrl-logo");return e.target="_blank",e.rel="noopener nofollow",e.href="https://maplibre.org/",e.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),e.setAttribute("rel","noopener nofollow"),this._container.appendChild(e),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){I.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}};u(uf,"LogoControl");var Zn=uf;m();var cf=class cf{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(t){let e=++this._id;return this._queue.push({callback:t,id:e,cancelled:!1}),e}remove(t){let e=this._currentlyRunning,r=e?this._queue.concat(e):this._queue;for(let i of r)if(i.id===t){i.cancelled=!0;return}}run(t=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");let e=this._currentlyRunning=this._queue;this._queue=[];for(let r of e)if(!r.cancelled&&(r.callback(t),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}};u(cf,"TaskQueue");var cl=cf;m();var hl=(r=>(r.create="create",r.load="load",r.fullLoad="fullLoad",r))(hl||{}),pl=null,Hn=[],o1=60,pf=1e3/o1,hf="loadTime",mf="fullLoadTime",ai={mark(o){performance.mark(o)},frame(o){let t=o;if(pl!=null){let e=t-pl;Hn.push(e)}pl=t},clearMetrics(){pl=null,Hn=[],performance.clearMeasures(hf),performance.clearMeasures(mf);for(let o in hl)performance.clearMarks(hl[o])},getPerformanceMetrics(){performance.measure(hf,"create","load"),performance.measure(mf,"create","fullLoad");let o=performance.getEntriesByName(hf)[0].duration,t=performance.getEntriesByName(mf)[0].duration,e=Hn.length,i=1/(Hn.reduce((s,l)=>s+l,0)/e/1e3),n=Hn.filter(s=>s>pf).reduce((s,l)=>s+(l-pf)/pf,0),a=n/(e+n)*100;return{loadTime:o,fullLoadTime:t,fps:i,percentDroppedFrames:a,totalFrames:e}}};m();m();var nb=he([{name:"a_pos3d",type:"Int16",components:3}]);m();var ff=class ff extends le{constructor(e){super();this.sourceCache=e,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,e.usedForTerrain=!0,e.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(e,r){this.sourceCache.update(e,r),this._renderableTilesKeys=[];let i={};for(let n of e.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:r}))i[n.key]=!0,this._renderableTilesKeys.push(n.key),this._tiles[n.key]||(n.posMatrix=new Float64Array(16),G.ortho(n.posMatrix,0,8192,0,8192,0,1),this._tiles[n.key]=new ei(n,this.tileSize));for(let n in this._tiles)i[n]||delete this._tiles[n]}freeRtt(e){for(let r in this._tiles){let i=this._tiles[r];(!e||i.tileID.equals(e)||i.tileID.isChildOf(e)||e.isChildOf(i.tileID))&&(i.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(e=>this.getTileByID(e))}getTileByID(e){return this._tiles[e]}getTerrainCoords(e){let r={};for(let i of this._renderableTilesKeys){let n=this._tiles[i].tileID;if(n.canonical.equals(e.canonical)){let a=e.clone();a.posMatrix=new Float64Array(16),G.ortho(a.posMatrix,0,8192,0,8192,0,1),r[i]=a}else if(n.canonical.isChildOf(e.canonical)){let a=e.clone();a.posMatrix=new Float64Array(16);let s=n.canonical.z-e.canonical.z,l=n.canonical.x-(n.canonical.x>>s<<s),c=n.canonical.y-(n.canonical.y>>s<<s),p=8192>>s;G.ortho(a.posMatrix,0,p,0,p,0,1),G.translate(a.posMatrix,a.posMatrix,[-l*p,-c*p,0]),r[i]=a}else if(e.canonical.isChildOf(n.canonical)){let a=e.clone();a.posMatrix=new Float64Array(16);let s=e.canonical.z-n.canonical.z,l=e.canonical.x-(e.canonical.x>>s<<s),c=e.canonical.y-(e.canonical.y>>s<<s),p=8192>>s;G.ortho(a.posMatrix,0,8192,0,8192,0,1),G.translate(a.posMatrix,a.posMatrix,[l*p,c*p,0]),G.scale(a.posMatrix,a.posMatrix,[1/2**s,1/2**s,0]),r[i]=a}}return r}getSourceTile(e,r){let i=this.sourceCache._source,n=e.overscaledZ-this.deltaZoom;if(n>i.maxzoom&&(n=i.maxzoom),n<i.minzoom)return null;this._sourceTileCache[e.key]||(this._sourceTileCache[e.key]=e.scaledTo(n).key);let a=this.sourceCache.getTileByID(this._sourceTileCache[e.key]);if(!(a&&a.dem)&&r)for(;n>=i.minzoom&&!(a&&a.dem);)a=this.sourceCache.getTileByID(e.scaledTo(n--).key);return a}tilesAfterTime(e=Date.now()){return Object.values(this._tiles).filter(r=>r.timeAdded>=e)}};u(ff,"TerrainSourceCache");var ml=ff;var df=class df{constructor(t,e,r){this.painter=t,this.sourceCache=new ml(e),this.options=r,this.exaggeration=typeof r.exaggeration=="number"?r.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(t,e,r,i=8192){var d;if(!(e>=0&&e<i&&r>=0&&r<i))return 0;let n=this.getTerrainData(t),a=(d=n.tile)==null?void 0:d.dem;if(!a)return 0;let s=no.transformMat4([],[e/i*8192,r/i*8192],n.u_terrain_matrix),l=[s[0]*a.dim,s[1]*a.dim],c=Math.floor(l[0]),p=Math.floor(l[1]),h=l[0]-c,f=l[1]-p;return a.get(c,p)*(1-h)*(1-f)+a.get(c+1,p)*h*(1-f)+a.get(c,p+1)*(1-h)*f+a.get(c+1,p+1)*h*f}getElevationForLngLatZoom(t,e){let{tileID:r,mercatorX:i,mercatorY:n}=this._getOverscaledTileIDFromLngLatZoom(t,e);return this.getElevation(r,i%8192,n%8192,8192)}getElevation(t,e,r,i=8192){return this.getDEMElevation(t,e,r,i)*this.exaggeration}getTerrainData(t){if(!this._emptyDemTexture){let i=this.painter.context,n=new de({width:1,height:1},new Uint8Array(1*4));this._emptyDepthTexture=new me(i,n,i.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new me(i,new de({width:1,height:1}),i.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(i.gl.NEAREST,i.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=G.identity([])}let e=this.sourceCache.getSourceTile(t,!0);if(e&&e.dem&&(!e.demTexture||e.needsTerrainPrepare)){let i=this.painter.context;e.demTexture=this.painter.getTileTexture(e.dem.stride),e.demTexture?e.demTexture.update(e.dem.getPixels(),{premultiply:!1}):e.demTexture=new me(i,e.dem.getPixels(),i.gl.RGBA,{premultiply:!1}),e.demTexture.bind(i.gl.NEAREST,i.gl.CLAMP_TO_EDGE),e.needsTerrainPrepare=!1}let r=e&&e+e.tileID.key+t.key;if(r&&!this._demMatrixCache[r]){let i=this.sourceCache.sourceCache._source.maxzoom,n=t.canonical.z-e.tileID.canonical.z;t.overscaledZ>t.canonical.z&&(t.canonical.z>=i?n=t.canonical.z-i:ve("cannot calculate elevation if elevation maxzoom > source.maxzoom"));let a=t.canonical.x-(t.canonical.x>>n<<n),s=t.canonical.y-(t.canonical.y>>n<<n),l=G.fromScaling(new Float64Array(16),[1/(8192<<n),1/(8192<<n),0]);G.translate(l,l,[a*8192,s*8192,0]),this._demMatrixCache[t.key]={matrix:l,coord:t}}return{u_depth:2,u_terrain:3,u_terrain_dim:e&&e.dem&&e.dem.dim||1,u_terrain_matrix:r?this._demMatrixCache[t.key].matrix:this._emptyDemMatrix,u_terrain_unpack:e&&e.dem&&e.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(e&&e.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:e}}getFramebuffer(t){let e=this.painter,r=e.width/devicePixelRatio,i=e.height/devicePixelRatio;return this._fbo&&(this._fbo.width!==r||this._fbo.height!==i)&&(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new me(e.context,{width:r,height:i,data:null},e.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(e.context.gl.NEAREST,e.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new me(e.context,{width:r,height:i,data:null},e.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(e.context.gl.NEAREST,e.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=e.context.createFramebuffer(r,i,!0,!1),this._fbo.depthAttachment.set(e.context.createRenderbuffer(e.context.gl.DEPTH_COMPONENT16,r,i))),this._fbo.colorAttachment.set(t==="coords"?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){let t=this.painter.context;if(this._coordsTexture)return this._coordsTexture;let e=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let n=0,a=0;n<this._coordsTextureSize;n++)for(let s=0;s<this._coordsTextureSize;s++,a+=4)e[a+0]=s&255,e[a+1]=n&255,e[a+2]=s>>8<<4|n>>8,e[a+3]=0;let r=new de({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(e.buffer)),i=new me(t,r,t.gl.RGBA,{premultiply:!1});return i.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),this._coordsTexture=i,i}pointCoordinate(t){this.painter.maybeDrawDepthAndCoords(!0);let e=new Uint8Array(4),r=this.painter.context,i=r.gl,n=Math.round(t.x*this.painter.pixelRatio/devicePixelRatio),a=Math.round(t.y*this.painter.pixelRatio/devicePixelRatio),s=Math.round(this.painter.height/devicePixelRatio);r.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),i.readPixels(n,s-a-1,1,1,i.RGBA,i.UNSIGNED_BYTE,e),r.bindFramebuffer.set(null);let l=e[0]+(e[2]>>4<<8),c=e[1]+((e[2]&15)<<8),p=this.coordsIndex[255-e[3]],h=p&&this.sourceCache.getTileByID(p);if(!h)return null;let f=this._coordsTextureSize,d=(1<<h.tileID.canonical.z)*f;return new Te((h.tileID.canonical.x*f+l)/d+h.tileID.wrap,(h.tileID.canonical.y*f+c)/d,this.getElevation(h.tileID,l,c,f))}depthAtPoint(t){let e=new Uint8Array(4),r=this.painter.context,i=r.gl;return r.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer),i.readPixels(t.x,this.painter.height/devicePixelRatio-t.y-1,1,1,i.RGBA,i.UNSIGNED_BYTE,e),r.bindFramebuffer.set(null),(e[0]/(256*256*256)+e[1]/(256*256)+e[2]/256+e[3])/256}getTerrainMesh(){if(this._mesh)return this._mesh;let t=this.painter.context,e=new Co,r=new Ge,i=this.meshSize,n=8192/i,a=i*i;for(let h=0;h<=i;h++)for(let f=0;f<=i;f++)e.emplaceBack(f*n,h*n,0);for(let h=0;h<a;h+=i+1)for(let f=0;f<i;f++)r.emplaceBack(f+h,i+f+h+1,i+f+h+2),r.emplaceBack(f+h,i+f+h+2,f+h+1);let s=e.length,l=s+(i+1)*2;for(let h of[0,1])for(let f=0;f<=i;f++)for(let d of[0,1])e.emplaceBack(f*n,h*8192,d);for(let h=0;h<i*2;h+=2)r.emplaceBack(l+h,l+h+1,l+h+3),r.emplaceBack(l+h,l+h+3,l+h+2),r.emplaceBack(s+h,s+h+3,s+h+1),r.emplaceBack(s+h,s+h+2,s+h+3);let c=e.length,p=c+(i+1)*2;for(let h of[0,1])for(let f=0;f<=i;f++)for(let d of[0,1])e.emplaceBack(h*8192,f*n,d);for(let h=0;h<i*2;h+=2)r.emplaceBack(c+h,c+h+1,c+h+3),r.emplaceBack(c+h,c+h+3,c+h+2),r.emplaceBack(p+h,p+h+3,p+h+1),r.emplaceBack(p+h,p+h+2,p+h+3);return this._mesh={indexBuffer:t.createIndexBuffer(r),vertexBuffer:t.createVertexBuffer(e,nb.members),segments:se.simpleSegment(0,0,e.length,r.length)},this._mesh}getMeshFrameDelta(t){return 2*Math.PI*cn/Math.pow(2,t)/5}getMinTileElevationForLngLatZoom(t,e){var i;let{tileID:r}=this._getOverscaledTileIDFromLngLatZoom(t,e);return(i=this.getMinMaxElevation(r).minElevation)!=null?i:0}getMinMaxElevation(t){let e=this.getTerrainData(t).tile,r={minElevation:null,maxElevation:null};return e&&e.dem&&(r.minElevation=e.dem.min*this.exaggeration,r.maxElevation=e.dem.max*this.exaggeration),r}_getOverscaledTileIDFromLngLatZoom(t,e){let r=Te.fromLngLat(t.wrap()),i=(1<<e)*8192,n=r.x*i,a=r.y*i,s=Math.floor(n/8192),l=Math.floor(a/8192);return{tileID:new Re(e,0,e,s,l),mercatorX:n,mercatorY:a}}};u(df,"Terrain");var fl=df;m();m();var yf=class yf{constructor(t,e,r){this._context=t;this._size=e;this._tileSize=r;this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(let t of this._objects)t.texture.destroy(),t.fbo.destroy()}_createObject(t){let e=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),r=new me(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return r.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),e.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),e.colorAttachment.set(r.texture),{id:t,fbo:e,texture:r,stamp:-1,inUse:!1}}getObjectForId(t){return this._objects[t]}useObject(t){t.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter(e=>t.id!==e),this._recentlyUsed.push(t.id)}stampObject(t){t.stamp=++this._stamp}getOrCreateFreeObject(){for(let e of this._recentlyUsed)if(!this._objects[e].inUse)return this._objects[e];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");let t=this._createObject(this._objects.length);return this._objects.push(t),t}freeObject(t){t.inUse=!1}freeAllObjects(){for(let t of this._objects)this.freeObject(t)}isFull(){return this._objects.length<this._size?!1:this._objects.some(t=>!t.inUse)===!1}};u(yf,"RenderPool");var dl=yf;var si={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0},gf=class gf{constructor(t,e){this.painter=t,this.terrain=e,this.pool=new dl(t.context,30,e.sourceCache.tileSize*e.qualityFactor)}destruct(){this.pool.destruct()}getTexture(t){return this.pool.getObjectForId(t.rtt[this._stacks.length-1].id).texture}prepareForRender(t,e){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=t._order.filter(r=>!t._layers[r].isHidden(e)),this._coordsDescendingInv={};for(let r in t.sourceCaches){this._coordsDescendingInv[r]={};let i=t.sourceCaches[r].getVisibleCoordinates();for(let n of i){let a=this.terrain.sourceCache.getTerrainCoords(n);for(let s in a)this._coordsDescendingInv[r][s]||(this._coordsDescendingInv[r][s]=[]),this._coordsDescendingInv[r][s].push(a[s])}}this._coordsDescendingInvStr={};for(let r of t._order){let i=t._layers[r],n=i.source;if(si[i.type]&&!this._coordsDescendingInvStr[n]){this._coordsDescendingInvStr[n]={};for(let a in this._coordsDescendingInv[n])this._coordsDescendingInvStr[n][a]=this._coordsDescendingInv[n][a].map(s=>s.key).sort().join()}}for(let r of this._renderableTiles)for(let i in this._coordsDescendingInvStr){let n=this._coordsDescendingInvStr[i][r.tileID.key];n&&n!==r.rttCoords[i]&&(r.rtt=[])}}renderLayer(t){if(t.isHidden(this.painter.transform.zoom))return!1;let e=t.type,r=this.painter,i=this._renderableLayerIds[this._renderableLayerIds.length-1]===t.id;if(si[e]&&((!this._prevType||!si[this._prevType])&&this._stacks.push([]),this._prevType=e,this._stacks[this._stacks.length-1].push(t.id),!i))return!0;if(si[this._prevType]||si[e]&&i){this._prevType=e;let n=this._stacks.length-1,a=this._stacks[n]||[];for(let s of this._renderableTiles){if(this.pool.isFull()&&(xm(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(s),s.rtt[n]){let c=this.pool.getObjectForId(s.rtt[n].id);if(c.stamp===s.rtt[n].stamp){this.pool.useObject(c);continue}}let l=this.pool.getOrCreateFreeObject();this.pool.useObject(l),this.pool.stampObject(l),s.rtt[n]={id:l.id,stamp:l.stamp},r.context.bindFramebuffer.set(l.fbo.framebuffer),r.context.clear({color:pe.transparent,stencil:0}),r.currentStencilSource=void 0;for(let c=0;c<a.length;c++){let p=r.style._layers[a[c]],h=p.source?this._coordsDescendingInv[p.source][s.tileID.key]:[s.tileID];r.context.viewport.set([0,0,l.fbo.width,l.fbo.height]),r._renderTileClippingMasks(p,h),r.renderLayer(r,r.style.sourceCaches[p.source],p,h),p.source&&(s.rttCoords[p.source]=this._coordsDescendingInvStr[p.source][s.tileID.key])}}return xm(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects(),si[e]}return!1}};u(gf,"RenderToTexture");var yl=gf;m();var ob={"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":"MapLibre logo","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","TerrainControl.Enable":"Enable terrain","TerrainControl.Disable":"Disable terrain","CooperativeGesturesHandler.WindowsHelpText":"Use Ctrl + scroll to zoom the map","CooperativeGesturesHandler.MacHelpText":"Use \u2318 + scroll to zoom the map","CooperativeGesturesHandler.MobileHelpText":"Use two fingers to move the map"};var a1=so.version,_l=-2,ab=22,tr=0,sb=80,gl=85,s1={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:_l,maxZoom:ab,minPitch:tr,maxPitch:sb,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:sf,maplibreLogo:!1,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,maxTileCacheSize:null,maxTileCacheZoomLevels:qe.MAX_TILE_CACHE_ZOOM_LEVELS,localIdeographFontFamily:"sans-serif",transformRequest:null,transformCameraUpdate:null,fadeDuration:300,crossSourceCollisions:!0,validateStyle:!0,maxCanvasSize:[4096,4096]},xf=class xf extends ul{constructor(e){if(ai.mark("create"),e=B({},s1,e),e.minZoom!=null&&e.maxZoom!=null&&e.minZoom>e.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(e.minPitch!=null&&e.maxPitch!=null&&e.minPitch>e.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(e.minPitch!=null&&e.minPitch<tr)throw new Error("minPitch must be greater than or equal to ".concat(tr));if(e.maxPitch!=null&&e.maxPitch>gl)throw new Error("maxPitch must be less than or equal to ".concat(gl));let r=new js(e.minZoom,e.maxZoom,e.minPitch,e.maxPitch,e.renderWorldCopies);super(r,{bearingSnap:e.bearingSnap});this._contextLost=u(e=>{e.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new C("webglcontextlost",{originalEvent:e}))},"_contextLost");this._contextRestored=u(e=>{this._setupPainter(),this.resize(),this._update(),this.fire(new C("webglcontextrestored",{originalEvent:e}))},"_contextRestored");this._onMapScroll=u(e=>{if(e.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},"_onMapScroll");this._onWindowOnline=u(()=>{this._update()},"_onWindowOnline");if(this._interactive=e.interactive,this._maxTileCacheSize=e.maxTileCacheSize,this._maxTileCacheZoomLevels=e.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=e.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=e.preserveDrawingBuffer,this._antialias=e.antialias,this._trackResize=e.trackResize,this._bearingSnap=e.bearingSnap,this._refreshExpiredTiles=e.refreshExpiredTiles,this._fadeDuration=e.fadeDuration,this._crossSourceCollisions=e.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=e.collectResourceTiming,this._renderTaskQueue=new cl,this._controls=[],this._mapId=co(),this._locale=B({},ob,e.locale),this._clickTolerance=e.clickTolerance,this._overridePixelRatio=e.pixelRatio,this._maxCanvasSize=e.maxCanvasSize,this.transformCameraUpdate=e.transformCameraUpdate,this._imageQueueHandle=He.addThrottleControl(()=>this.isMoving()),this._requestManager=new go(e.transformRequest),typeof e.container=="string"){if(this._container=document.getElementById(e.container),!this._container)throw new Error("Container '".concat(e.container,"' not found."))}else if(e.container instanceof HTMLElement)this._container=e.container;else throw new Error("Invalid type: 'container' must be a String or HTMLElement.");if(e.maxBounds&&this.setMaxBounds(e.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this.on("terrain",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}),this.once("idle",()=>{this._idleTriggered=!0}),typeof window<"u"){addEventListener("online",this._onWindowOnline,!1);let n=!1,a=Zs(s=>{this._trackResize&&!this._removed&&this.resize(s)._update()},50);this._resizeObserver=new ResizeObserver(s=>{if(!n){n=!0;return}a(s)}),this._resizeObserver.observe(this._container)}this.handlers=new ll(this,e);let i=typeof e.hash=="string"&&e.hash||void 0;this._hash=e.hash&&new Cn(i).addTo(this),(!this._hash||!this._hash._onHashChange())&&(this.jumpTo({center:e.center,zoom:e.zoom,bearing:e.bearing,pitch:e.pitch}),e.bounds&&(this.resize(),this.fitBounds(e.bounds,B({},e.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=e.localIdeographFontFamily,this._validateStyle=e.validateStyle,e.style&&this.setStyle(e.style,{localIdeographFontFamily:e.localIdeographFontFamily}),e.attributionControl&&this.addControl(new qn(typeof e.attributionControl=="boolean"?void 0:e.attributionControl)),e.maplibreLogo&&this.addControl(new Zn,e.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",n=>{this._update(n.dataType==="style"),this.fire(new C("".concat(n.dataType,"data"),n))}),this.on("dataloading",n=>{this.fire(new C("".concat(n.dataType,"dataloading"),n))}),this.on("dataabort",n=>{this.fire(new C("sourcedataabort",n))})}_getMapId(){return this._mapId}addControl(e,r){if(r===void 0&&(e.getDefaultPosition?r=e.getDefaultPosition():r="top-right"),!e||!e.onAdd)return this.fire(new q(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));let i=e.onAdd(this);this._controls.push(e);let n=this._controlPositions[r];return r.indexOf("bottom")!==-1?n.insertBefore(i,n.firstChild):n.appendChild(i),this}removeControl(e){if(!e||!e.onRemove)return this.fire(new q(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));let r=this._controls.indexOf(e);return r>-1&&this._controls.splice(r,1),e.onRemove(this),this}hasControl(e){return this._controls.indexOf(e)>-1}calculateCameraOptionsFromTo(e,r,i,n){return n==null&&this.terrain&&(n=this.terrain.getElevationForLngLatZoom(i,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(e,r,i,n)}resize(e){var l;let r=this._containerDimensions(),i=r[0],n=r[1],a=this._getClampedPixelRatio(i,n);if(this._resizeCanvas(i,n,a),this.painter.resize(i,n,a),this.painter.overLimit()){let c=this.painter.context.gl;this._maxCanvasSize=[c.drawingBufferWidth,c.drawingBufferHeight];let p=this._getClampedPixelRatio(i,n);this._resizeCanvas(i,n,p),this.painter.resize(i,n,p)}this.transform.resize(i,n),(l=this._requestedCameraState)==null||l.resize(i,n);let s=!this._moving;return s&&(this.stop(),this.fire(new C("movestart",e)).fire(new C("move",e))),this.fire(new C("resize",e)),s&&this.fire(new C("moveend",e)),this}_getClampedPixelRatio(e,r){let{0:i,1:n}=this._maxCanvasSize,a=this.getPixelRatio(),s=e*a,l=r*a,c=s>i?i/s:1,p=l>n?n/l:1;return Math.min(c,p)*a}getPixelRatio(){var e;return(e=this._overridePixelRatio)!=null?e:devicePixelRatio}setPixelRatio(e){this._overridePixelRatio=e,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(e){return this.transform.setMaxBounds(Ke.convert(e)),this._update()}setMinZoom(e){if(e=e==null?_l:e,e>=_l&&e<=this.transform.maxZoom)return this.transform.minZoom=e,this._update(),this.getZoom()<e&&this.setZoom(e),this;throw new Error("minZoom must be between ".concat(_l," and the current maxZoom, inclusive"))}getMinZoom(){return this.transform.minZoom}setMaxZoom(e){if(e=e==null?ab:e,e>=this.transform.minZoom)return this.transform.maxZoom=e,this._update(),this.getZoom()>e&&this.setZoom(e),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(e){if(e=e==null?tr:e,e<tr)throw new Error("minPitch must be greater than or equal to ".concat(tr));if(e>=tr&&e<=this.transform.maxPitch)return this.transform.minPitch=e,this._update(),this.getPitch()<e&&this.setPitch(e),this;throw new Error("minPitch must be between ".concat(tr," and the current maxPitch, inclusive"))}getMinPitch(){return this.transform.minPitch}setMaxPitch(e){if(e=e==null?sb:e,e>gl)throw new Error("maxPitch must be less than or equal to ".concat(gl));if(e>=this.transform.minPitch)return this.transform.maxPitch=e,this._update(),this.getPitch()>e&&this.setPitch(e),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(e){return this.transform.renderWorldCopies=e,this._update()}project(e){return this.transform.locationPoint(ee.convert(e),this.style&&this.terrain)}unproject(e){return this.transform.pointLocation(Lt.default.convert(e),this.terrain)}isMoving(){var e;return this._moving||((e=this.handlers)==null?void 0:e.isMoving())}isZooming(){var e;return this._zooming||((e=this.handlers)==null?void 0:e.isZooming())}isRotating(){var e;return this._rotating||((e=this.handlers)==null?void 0:e.isRotating())}_createDelegatedListener(e,r,i){if(e==="mouseenter"||e==="mouseover"){let n=!1;return{layer:r,listener:i,delegates:{mousemove:u(l=>{let c=this.getLayer(r)?this.queryRenderedFeatures(l.point,{layers:[r]}):[];c.length?n||(n=!0,i.call(this,new Ne(e,this,l.originalEvent,{features:c}))):n=!1},"mousemove"),mouseout:u(()=>{n=!1},"mouseout")}}}else if(e==="mouseleave"||e==="mouseout"){let n=!1;return{layer:r,listener:i,delegates:{mousemove:u(l=>{(this.getLayer(r)?this.queryRenderedFeatures(l.point,{layers:[r]}):[]).length?n=!0:n&&(n=!1,i.call(this,new Ne(e,this,l.originalEvent)))},"mousemove"),mouseout:u(l=>{n&&(n=!1,i.call(this,new Ne(e,this,l.originalEvent)))},"mouseout")}}}else{let n=u(a=>{let s=this.getLayer(r)?this.queryRenderedFeatures(a.point,{layers:[r]}):[];s.length&&(a.features=s,i.call(this,a),delete a.features)},"delegate");return{layer:r,listener:i,delegates:{[e]:n}}}}on(e,r,i){if(i===void 0)return super.on(e,r);let n=this._createDelegatedListener(e,r,i);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[e]=this._delegatedListeners[e]||[],this._delegatedListeners[e].push(n);for(let a in n.delegates)this.on(a,n.delegates[a]);return this}once(e,r,i){if(i===void 0)return super.once(e,r);let n=this._createDelegatedListener(e,r,i);for(let a in n.delegates)this.once(a,n.delegates[a]);return this}off(e,r,i){if(i===void 0)return super.off(e,r);let n=u(a=>{let s=a[e];for(let l=0;l<s.length;l++){let c=s[l];if(c.layer===r&&c.listener===i){for(let p in c.delegates)this.off(p,c.delegates[p]);return s.splice(l,1),this}}},"removeDelegatedListener");return this._delegatedListeners&&this._delegatedListeners[e]&&n(this._delegatedListeners),this}queryRenderedFeatures(e,r){if(!this.style)return[];let i,n=e instanceof Lt.default||Array.isArray(e),a=n?e:[[0,0],[this.transform.width,this.transform.height]];if(r=r||(n?{}:e)||{},a instanceof Lt.default||typeof a[0]=="number")i=[Lt.default.convert(a)];else{let s=Lt.default.convert(a[0]),l=Lt.default.convert(a[1]);i=[s,new Lt.default(l.x,s.y),l,new Lt.default(s.x,l.y),s]}return this.style.queryRenderedFeatures(i,r,this.transform)}querySourceFeatures(e,r){return this.style.querySourceFeatures(e,r)}setStyle(e,r){return r=B({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},r),r.diff!==!1&&r.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&e?(this._diffStyle(e,r),this):(this._localIdeographFontFamily=r.localIdeographFontFamily,this._updateStyle(e,r))}setTransformRequest(e){return this._requestManager.setTransformRequest(e),this}_getUIString(e){let r=this._locale[e];if(r==null)throw new Error("Missing UI string '".concat(e,"'"));return r}_updateStyle(e,r){if(r.transformStyle&&this.style&&!this.style._loaded){this.style.once("style.load",()=>this._updateStyle(e,r));return}let i=this.style&&r.transformStyle?this.style.serialize():void 0;if(this.style&&(this.style.setEventedParent(null),this.style._remove(!e)),e)this.style=new ii(this,r||{});else return delete this.style,this;return this.style.setEventedParent(this,{style:this.style}),typeof e=="string"?this.style.loadURL(e,r,i):this.style.loadJSON(e,r,i),this}_lazyInitEmptyStyle(){this.style||(this.style=new ii(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(e,r){if(typeof e=="string"){let i=e,n=this._requestManager.transformRequest(i,"Style");zt(n,new AbortController).then(a=>{this._updateDiff(a.data,r)}).catch(a=>{a&&this.fire(new q(a))})}else typeof e=="object"&&this._updateDiff(e,r)}_updateDiff(e,r){try{this.style.setState(e,r)&&this._update(!0)}catch(i){ve("Unable to perform style diff: ".concat(i.message||i.error||i,". Rebuilding the style from scratch.")),this._updateStyle(e,r)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():ve("There is no style added to the map.")}addSource(e,r){return this._lazyInitEmptyStyle(),this.style.addSource(e,r),this._update(!0)}isSourceLoaded(e){let r=this.style&&this.style.sourceCaches[e];if(r===void 0){this.fire(new q(new Error("There is no source with ID '".concat(e,"'"))));return}return r.loaded()}setTerrain(e){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),!e)this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform.minElevationForCurrentTile=0,this.transform.elevation=0;else{let r=this.style.sourceCaches[e.source];if(!r)throw new Error("cannot load terrain, because there exists no source with ID: ".concat(e.source));this.terrain===null&&r.reload();for(let i in this.style._layers){let n=this.style._layers[i];n.type==="hillshade"&&n.source===e.source&&ve("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain=new fl(this.painter,r,e),this.painter.renderToTexture=new yl(this.painter,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._terrainDataCallback=i=>{i.dataType==="style"?this.terrain.sourceCache.freeRtt():i.dataType==="source"&&i.tile&&(i.sourceId===e.source&&!this._elevationFreeze&&(this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.terrain.sourceCache.freeRtt(i.tile.tileID))},this.style.on("data",this._terrainDataCallback)}return this.fire(new C("terrain",{terrain:e})),this}getTerrain(){var e,r;return(r=(e=this.terrain)==null?void 0:e.options)!=null?r:null}areTilesLoaded(){let e=this.style&&this.style.sourceCaches;for(let r in e){let n=e[r]._tiles;for(let a in n){let s=n[a];if(!(s.state==="loaded"||s.state==="errored"))return!1}}return!0}removeSource(e){return this.style.removeSource(e),this._update(!0)}getSource(e){return this.style.getSource(e)}addImage(e,r,i={}){let{pixelRatio:n=1,sdf:a=!1,stretchX:s,stretchY:l,content:c}=i;this._lazyInitEmptyStyle();let p=0;if(r instanceof HTMLImageElement||Je(r)){let{width:h,height:f,data:d}=$.getImageData(r);this.style.addImage(e,{data:new de({width:h,height:f},d),pixelRatio:n,stretchX:s,stretchY:l,content:c,sdf:a,version:p})}else{if(r.width===void 0||r.height===void 0)return this.fire(new q(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`")));{let{width:h,height:f,data:d}=r,g=r;return this.style.addImage(e,{data:new de({width:h,height:f},new Uint8Array(d)),pixelRatio:n,stretchX:s,stretchY:l,content:c,sdf:a,version:p,userImage:g}),g.onAdd&&g.onAdd(this,e),this}}}updateImage(e,r){let i=this.style.getImage(e);if(!i)return this.fire(new q(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));let n=r instanceof HTMLImageElement||Je(r)?$.getImageData(r):r,{width:a,height:s,data:l}=n;if(a===void 0||s===void 0)return this.fire(new q(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(a!==i.data.width||s!==i.data.height)return this.fire(new q(new Error("The width and height of the updated image must be that same as the previous version of the image")));let c=!(r instanceof HTMLImageElement||Je(r));return i.data.replace(l,c),this.style.updateImage(e,i),this}getImage(e){return this.style.getImage(e)}hasImage(e){return e?!!this.style.getImage(e):(this.fire(new q(new Error("Missing required image id"))),!1)}removeImage(e){this.style.removeImage(e)}loadImage(e){return He.getImage(this._requestManager.transformRequest(e,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(e,r){return this._lazyInitEmptyStyle(),this.style.addLayer(e,r),this._update(!0)}moveLayer(e,r){return this.style.moveLayer(e,r),this._update(!0)}removeLayer(e){return this.style.removeLayer(e),this._update(!0)}getLayer(e){return this.style.getLayer(e)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(e,r,i){return this.style.setLayerZoomRange(e,r,i),this._update(!0)}setFilter(e,r,i={}){return this.style.setFilter(e,r,i),this._update(!0)}getFilter(e){return this.style.getFilter(e)}setPaintProperty(e,r,i,n={}){return this.style.setPaintProperty(e,r,i,n),this._update(!0)}getPaintProperty(e,r){return this.style.getPaintProperty(e,r)}setLayoutProperty(e,r,i,n={}){return this.style.setLayoutProperty(e,r,i,n),this._update(!0)}getLayoutProperty(e,r){return this.style.getLayoutProperty(e,r)}setGlyphs(e,r={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(e,r),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(e,r,i={}){return this._lazyInitEmptyStyle(),this.style.addSprite(e,r,i,n=>{n||this._update(!0)}),this}removeSprite(e){return this._lazyInitEmptyStyle(),this.style.removeSprite(e),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(e,r={}){return this._lazyInitEmptyStyle(),this.style.setSprite(e,r,i=>{i||this._update(!0)}),this}setLight(e,r={}){return this._lazyInitEmptyStyle(),this.style.setLight(e,r),this._update(!0)}getLight(){return this.style.getLight()}setFeatureState(e,r){return this.style.setFeatureState(e,r),this._update()}removeFeatureState(e,r){return this.style.removeFeatureState(e,r),this._update()}getFeatureState(e){return this.style.getFeatureState(e)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let e=0,r=0;return this._container&&(e=this._container.clientWidth||400,r=this._container.clientHeight||300),[e,r]}_setupContainer(){let e=this._container;e.classList.add("maplibregl-map");let r=this._canvasContainer=I.create("div","maplibregl-canvas-container",e);this._interactive&&r.classList.add("maplibregl-interactive"),this._canvas=I.create("canvas","maplibregl-canvas",r),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex","0"),this._canvas.setAttribute("aria-label","Map"),this._canvas.setAttribute("role","region");let i=this._containerDimensions(),n=this._getClampedPixelRatio(i[0],i[1]);this._resizeCanvas(i[0],i[1],n);let a=this._controlContainer=I.create("div","maplibregl-control-container",e),s=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(l=>{s[l]=I.create("div","maplibregl-ctrl-".concat(l," "),a)})}_resizeCanvas(e,r,i){this._canvas.width=Math.floor(i*e),this._canvas.height=Math.floor(i*r),this._canvas.style.width="".concat(e,"px"),this._canvas.style.height="".concat(r,"px")}_setupPainter(){let e={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1},r=null;this._canvas.addEventListener("webglcontextcreationerror",n=>{r={requestedAttributes:e},n&&(r.statusMessage=n.statusMessage,r.type=n.type)},{once:!0});let i=this._canvas.getContext("webgl2",e)||this._canvas.getContext("webgl",e);if(!i){let n="Failed to initialize WebGL";throw r?(r.message=n,new Error(JSON.stringify(r))):new Error(n)}this.painter=new Bs(i,this.transform),yi.testSupport(i)}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(e){return!this.style||!this.style._loaded?this:(this._styleDirty=this._styleDirty||e,this._sourcesDirty=!0,this.triggerRepaint(),this)}_requestRenderFrame(e){return this._update(),this._renderTaskQueue.add(e)}_cancelRenderFrame(e){this._renderTaskQueue.remove(e)}_render(e){let r=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(e),this._removed)return;let i=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;let a=this.transform.zoom,s=$.now();this.style.zoomHistory.update(a,s);let l=new ue(a,{now:s,fadeDuration:r,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),c=l.crossFadingFactor();(c!==1||c!==this._crossFadingFactor)&&(i=!0,this._crossFadingFactor=c),this.style.update(l)}this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._elevationFreeze||(this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.minElevationForCurrentTile=0,this.transform.elevation=0),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,r,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:r,showPadding:this.showPadding}),this.fire(new C("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,ai.mark("load"),this.fire(new C("load"))),this.style&&(this.style.hasTransitions()||i)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();let n=this._sourcesDirty||this._styleDirty||this._placementDirty;return n||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new C("idle")),this._loaded&&!this._fullyLoaded&&!n&&(this._fullyLoaded=!0,ai.mark("fullLoad")),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var r;this._hash&&this._hash.remove();for(let i of this._controls)i.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&removeEventListener("online",this._onWindowOnline,!1),He.removeThrottleControl(this._imageQueueHandle),(r=this._resizeObserver)==null||r.disconnect();let e=this.painter.context.gl.getExtension("WEBGL_lose_context");e&&e.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),I.remove(this._canvasContainer),I.remove(this._controlContainer),this._container.classList.remove("maplibregl-map"),ai.clearMetrics(),this._removed=!0,this.fire(new C("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,$.frameAsync(this._frameRequest).then(e=>{ai.frame(e),this._frameRequest=null,this._render(e)}).catch(()=>{}))}triggerRepaintSync(){this._render(performance.now())}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(e){this._showTileBoundaries!==e&&(this._showTileBoundaries=e,this._update())}get showPadding(){return!!this._showPadding}set showPadding(e){this._showPadding!==e&&(this._showPadding=e,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(e){this._showCollisionBoxes!==e&&(this._showCollisionBoxes=e,e?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(e){this._showOverdrawInspector!==e&&(this._showOverdrawInspector=e,this._update())}get repaint(){return!!this._repaint}set repaint(e){this._repaint!==e&&(this._repaint=e,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(e){this._vertices=e,this._update()}get version(){return a1}getCameraTargetElevation(){return this.transform.elevation}};u(xf,"Map");var _f=xf;m();m();var lb=u(o=>{o.touchstart=o.dragStart,o.touchmoveWindow=o.dragMove,o.touchend=o.dragEnd},"assignEvents"),ub=u(({enable:o,clickTolerance:t,bearingDegreesPerPixelMoved:e=.8})=>{let r=new Dn;return new Mt({clickTolerance:t,move:(i,n)=>({bearingDelta:(n.x-i.x)*e}),moveStateManager:r,enable:o,assignEvents:lb})},"generateOneFingerTouchRotationHandler"),cb=u(({enable:o,clickTolerance:t,pitchDegreesPerPixelMoved:e=-.5})=>{let r=new Dn;return new Mt({clickTolerance:t,move:(i,n)=>({pitchDelta:(n.y-i.y)*e}),moveStateManager:r,enable:o,assignEvents:lb})},"generateOneFingerTouchPitchHandler");var l1={showCompass:!0,showZoom:!0,visualizePitch:!1},wf=class wf{constructor(t){this._updateZoomButtons=u(()=>{let t=this._map.getZoom(),e=t===this._map.getMaxZoom(),r=t===this._map.getMinZoom();this._zoomInButton.disabled=e,this._zoomOutButton.disabled=r,this._zoomInButton.setAttribute("aria-disabled",e.toString()),this._zoomOutButton.setAttribute("aria-disabled",r.toString())},"_updateZoomButtons");this._rotateCompassArrow=u(()=>{let t=this.options.visualizePitch?"scale(".concat(1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5),") rotateX(").concat(this._map.transform.pitch,"deg) rotateZ(").concat(this._map.transform.angle*(180/Math.PI),"deg)"):"rotate(".concat(this._map.transform.angle*(180/Math.PI),"deg)");this._compassIcon.style.transform=t},"_rotateCompassArrow");this._setButtonTitle=u((t,e)=>{let r=this._map._getUIString("NavigationControl.".concat(e));t.title=r,t.setAttribute("aria-label",r)},"_setButtonTitle");this.options=B({},l1,t),this._container=I.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",e=>e.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",e=>this._map.zoomIn({},{originalEvent:e})),I.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",e=>this._map.zoomOut({},{originalEvent:e})),I.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",e=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:e}):this._map.resetNorth({},{originalEvent:e})}),this._compassIcon=I.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(t){return this._map=t,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new vf(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){I.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(t,e){let r=I.create("button",t,this._container);return r.type="button",r.addEventListener("click",e),r}};u(wf,"NavigationControl");var bf=wf,Pf=class Pf{constructor(t,e,r=!1){this.mousedown=u(t=>{this.startMouse(B({},t,{ctrlKey:!0,preventDefault:()=>t.preventDefault()}),I.mousePos(this.element,t)),I.addEventListener(window,"mousemove",this.mousemove),I.addEventListener(window,"mouseup",this.mouseup)},"mousedown");this.mousemove=u(t=>{this.moveMouse(t,I.mousePos(this.element,t))},"mousemove");this.mouseup=u(t=>{this.mouseRotate.dragEnd(t),this.mousePitch&&this.mousePitch.dragEnd(t),this.offTemp()},"mouseup");this.touchstart=u(t=>{t.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=I.touchPos(this.element,t.targetTouches)[0],this.startTouch(t,this._startPos),I.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),I.addEventListener(window,"touchend",this.touchend))},"touchstart");this.touchmove=u(t=>{t.targetTouches.length!==1?this.reset():(this._lastPos=I.touchPos(this.element,t.targetTouches)[0],this.moveTouch(t,this._lastPos))},"touchmove");this.touchend=u(t=>{t.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),delete this._startPos,delete this._lastPos,this.offTemp()},"touchend");this.reset=u(()=>{this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),this.touchRotate.reset(),this.touchPitch&&this.touchPitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},"reset");this._clickTolerance=10;let i=t.dragRotate._mouseRotate.getClickTolerance(),n=t.dragRotate._mousePitch.getClickTolerance();this.element=e,this.mouseRotate=el({clickTolerance:i,enable:!0}),this.touchRotate=ub({clickTolerance:i,enable:!0}),this.map=t,r&&(this.mousePitch=tl({clickTolerance:n,enable:!0}),this.touchPitch=cb({clickTolerance:n,enable:!0})),I.addEventListener(e,"mousedown",this.mousedown),I.addEventListener(e,"touchstart",this.touchstart,{passive:!1}),I.addEventListener(e,"touchcancel",this.reset)}startMouse(t,e){this.mouseRotate.dragStart(t,e),this.mousePitch&&this.mousePitch.dragStart(t,e),I.disableDrag()}startTouch(t,e){this.touchRotate.dragStart(t,e),this.touchPitch&&this.touchPitch.dragStart(t,e),I.disableDrag()}moveMouse(t,e){let r=this.map,{bearingDelta:i}=this.mouseRotate.dragMove(t,e)||{};if(i&&r.setBearing(r.getBearing()+i),this.mousePitch){let{pitchDelta:n}=this.mousePitch.dragMove(t,e)||{};n&&r.setPitch(r.getPitch()+n)}}moveTouch(t,e){let r=this.map,{bearingDelta:i}=this.touchRotate.dragMove(t,e)||{};if(i&&r.setBearing(r.getBearing()+i),this.touchPitch){let{pitchDelta:n}=this.touchPitch.dragMove(t,e)||{};n&&r.setPitch(r.getPitch()+n)}}off(){let t=this.element;I.removeEventListener(t,"mousedown",this.mousedown),I.removeEventListener(t,"touchstart",this.touchstart,{passive:!1}),I.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),I.removeEventListener(window,"touchend",this.touchend),I.removeEventListener(t,"touchcancel",this.reset),this.offTemp()}offTemp(){I.enableDrag(),I.removeEventListener(window,"mousemove",this.mousemove),I.removeEventListener(window,"mouseup",this.mouseup),I.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),I.removeEventListener(window,"touchend",this.touchend)}};u(Pf,"MouseRotateWrapper");var vf=Pf;m();m();var Er;async function pb(o=!1){if(Er!==void 0&&!o)return Er;if(window.navigator.permissions===void 0)return Er=!!window.navigator.geolocation,Er;try{Er=(await window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{Er=!!window.navigator.geolocation}return Er}u(pb,"checkGeolocationSupport");m();var Kn=re(fe(),1);m();function xl(o,t,e){let r=new ee(o.lng,o.lat);if(o=new ee(o.lng,o.lat),t){let i=new ee(o.lng-360,o.lat),n=new ee(o.lng+360,o.lat),a=e.locationPoint(o).distSqr(t);e.locationPoint(i).distSqr(t)<a?o=i:e.locationPoint(n).distSqr(t)<a&&(o=n)}for(;Math.abs(o.lng-e.center.lng)>180;){let i=e.locationPoint(o);if(i.x>=0&&i.y>=0&&i.x<=e.width&&i.y<=e.height)break;o.lng>e.center.lng?o.lng-=360:o.lng+=360}return o.lng!==r.lng&&e.locationPoint(o).y>e.height/2-e.getHorizon()?o:r}u(xl,"smartWrap");m();var Wn={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%)"};function bl(o,t,e){let r=o.classList;for(let i in Wn)r.remove("maplibregl-".concat(e,"-anchor-").concat(i));r.add("maplibregl-".concat(e,"-anchor-").concat(t))}u(bl,"applyAnchorClass");var Sf=class Sf extends le{constructor(e){super();this._onKeyPress=u(e=>{let r=e.code,i=e.charCode||e.keyCode;(r==="Space"||r==="Enter"||i===32||i===13)&&this.togglePopup()},"_onKeyPress");this._onMapClick=u(e=>{let r=e.originalEvent.target,i=this._element;this._popup&&(r===i||i.contains(r))&&this.togglePopup()},"_onMapClick");this._update=u(e=>{var a;if(!this._map)return;let r=this._map.loaded()&&!this._map.isMoving();((e==null?void 0:e.type)==="terrain"||(e==null?void 0:e.type)==="render"&&!r)&&this._map.once("render",this._update),this._map.transform.renderWorldCopies?this._lngLat=xl(this._lngLat,this._flatPos,this._map.transform):this._lngLat=(a=this._lngLat)==null?void 0:a.wrap(),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationPoint(this._lngLat)._add(this._offset));let i="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?i="rotateZ(".concat(this._rotation,"deg)"):this._rotationAlignment==="map"&&(i="rotateZ(".concat(this._rotation-this._map.getBearing(),"deg)"));let n="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?n="rotateX(0deg)":this._pitchAlignment==="map"&&(n="rotateX(".concat(this._map.getPitch(),"deg)")),(!e||e.type==="moveend")&&(this._pos=this._pos.round()),I.setTransform(this._element,"".concat(Wn[this._anchor]," translate(").concat(this._pos.x,"px, ").concat(this._pos.y,"px) ").concat(n," ").concat(i)),$.frameAsync(new AbortController).then(()=>{this._updateOpacity(e&&e.type==="moveend")}).catch(()=>{})},"_update");this._onMove=u(e=>{if(!this._isDragging){let r=this._clickTolerance||this._map._clickTolerance;this._isDragging=e.point.dist(this._pointerdownPos)>=r}this._isDragging&&(this._pos=e.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new C("dragstart"))),this.fire(new C("drag")))},"_onMove");this._onUp=u(()=>{this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._state==="active"&&this.fire(new C("dragend")),this._state="inactive"},"_onUp");this._addDragHandler=u(e=>{this._element.contains(e.originalEvent.target)&&(e.preventDefault(),this._positionDelta=e.point.sub(this._pos).add(this._offset),this._pointerdownPos=e.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},"_addDragHandler");if(this._anchor=e&&e.anchor||"center",this._color=e&&e.color||"#3FB1CE",this._scale=e&&e.scale||1,this._draggable=e&&e.draggable||!1,this._clickTolerance=e&&e.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=e&&e.rotation||0,this._rotationAlignment=e&&e.rotationAlignment||"auto",this._pitchAlignment=e&&e.pitchAlignment&&e.pitchAlignment!=="auto"?e.pitchAlignment:this._rotationAlignment,this.setOpacity(),this.setOpacity(e==null?void 0:e.opacity,e==null?void 0:e.opacityWhenCovered),!e||!e.element){this._defaultMarker=!0,this._element=I.create("div"),this._element.setAttribute("aria-label","Map marker");let r=I.createNS("http://www.w3.org/2000/svg","svg"),i=41,n=27;r.setAttributeNS(null,"display","block"),r.setAttributeNS(null,"height","".concat(i,"px")),r.setAttributeNS(null,"width","".concat(n,"px")),r.setAttributeNS(null,"viewBox","0 0 ".concat(n," ").concat(i));let a=I.createNS("http://www.w3.org/2000/svg","g");a.setAttributeNS(null,"stroke","none"),a.setAttributeNS(null,"stroke-width","1"),a.setAttributeNS(null,"fill","none"),a.setAttributeNS(null,"fill-rule","evenodd");let s=I.createNS("http://www.w3.org/2000/svg","g");s.setAttributeNS(null,"fill-rule","nonzero");let l=I.createNS("http://www.w3.org/2000/svg","g");l.setAttributeNS(null,"transform","translate(3.0, 29.0)"),l.setAttributeNS(null,"fill","#000000");let c=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(let v of c){let b=I.createNS("http://www.w3.org/2000/svg","ellipse");b.setAttributeNS(null,"opacity","0.04"),b.setAttributeNS(null,"cx","10.5"),b.setAttributeNS(null,"cy","5.80029008"),b.setAttributeNS(null,"rx",v.rx),b.setAttributeNS(null,"ry",v.ry),l.appendChild(b)}let p=I.createNS("http://www.w3.org/2000/svg","g");p.setAttributeNS(null,"fill",this._color);let h=I.createNS("http://www.w3.org/2000/svg","path");h.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),p.appendChild(h);let f=I.createNS("http://www.w3.org/2000/svg","g");f.setAttributeNS(null,"opacity","0.25"),f.setAttributeNS(null,"fill","#000000");let d=I.createNS("http://www.w3.org/2000/svg","path");d.setAttributeNS(null,"d","M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"),f.appendChild(d);let g=I.createNS("http://www.w3.org/2000/svg","g");g.setAttributeNS(null,"transform","translate(6.0, 7.0)"),g.setAttributeNS(null,"fill","#FFFFFF");let y=I.createNS("http://www.w3.org/2000/svg","g");y.setAttributeNS(null,"transform","translate(8.0, 8.0)");let _=I.createNS("http://www.w3.org/2000/svg","circle");_.setAttributeNS(null,"fill","#000000"),_.setAttributeNS(null,"opacity","0.25"),_.setAttributeNS(null,"cx","5.5"),_.setAttributeNS(null,"cy","5.5"),_.setAttributeNS(null,"r","5.4999962");let w=I.createNS("http://www.w3.org/2000/svg","circle");w.setAttributeNS(null,"fill","#FFFFFF"),w.setAttributeNS(null,"cx","5.5"),w.setAttributeNS(null,"cy","5.5"),w.setAttributeNS(null,"r","5.4999962"),y.appendChild(_),y.appendChild(w),s.appendChild(l),s.appendChild(p),s.appendChild(f),s.appendChild(g),s.appendChild(y),r.appendChild(s),r.setAttributeNS(null,"height","".concat(i*this._scale,"px")),r.setAttributeNS(null,"width","".concat(n*this._scale,"px")),this._element.appendChild(r),this._offset=Kn.default.convert(e&&e.offset||[0,-14])}else this._element=e.element,this._offset=Kn.default.convert(e&&e.offset||[0,0]);if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",r=>{r.preventDefault()}),this._element.addEventListener("mousedown",r=>{r.preventDefault()}),bl(this._element,this._anchor,"marker"),e&&e.className)for(let r of e.className.split(" "))this._element.classList.add(r);this._popup=null}addTo(e){return this.remove(),this._map=e,e.getCanvasContainer().appendChild(this._element),e.on("move",this._update),e.on("moveend",this._update),e.on("terrain",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),I.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=ee.convert(e),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(e){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),e){if(!("offset"in e.options)){let n=Math.abs(13.5)/Math.SQRT2;e.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[n,(38.1-13.5+n)*-1],"bottom-right":[-n,(38.1-13.5+n)*-1],left:[13.5,(38.1-13.5)*-1],right:[-13.5,(38.1-13.5)*-1]}:this._offset}this._popup=e,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}getPopup(){return this._popup}togglePopup(){let e=this._popup;if(this._element.style.opacity===this._opacityWhenCovered)return this;if(e)e.isOpen()?e.remove():(e.setLngLat(this._lngLat),e.addTo(this._map));else return this;return this}_updateOpacity(e=!1){var g,y;if(!((g=this._map)==null?void 0:g.terrain)){this._element.style.opacity!==this._opacity&&(this._element.style.opacity=this._opacity);return}if(e)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}let i=this._map,n=i.terrain.depthAtPoint(this._pos),a=i.terrain.getElevationForLngLatZoom(this._lngLat,i.transform.tileZoom),s=i.transform.lngLatToCameraDepth(this._lngLat,a),l=.006;if(s-n<l){this._element.style.opacity=this._opacity;return}let c=-this._offset.y/i.transform._pixelPerMeter,p=Math.sin(i.getPitch()*Math.PI/180)*c,h=i.terrain.depthAtPoint(new Kn.default(this._pos.x,this._pos.y-this._offset.y)),d=i.transform.lngLatToCameraDepth(this._lngLat,a+p)-h>l;(y=this._popup)!=null&&y.isOpen()&&d&&this._popup.remove(),this._element.style.opacity=d?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(e){return this._offset=Kn.default.convert(e),this._update(),this}addClassName(e){this._element.classList.add(e)}removeClassName(e){this._element.classList.remove(e)}toggleClassName(e){return this._element.classList.toggle(e)}setDraggable(e){return this._draggable=!!e,this._map&&(e?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(e){return this._rotation=e||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(e){return this._rotationAlignment=e||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(e){return this._pitchAlignment=e&&e!=="auto"?e:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(e,r){return e===void 0&&r===void 0&&(this._opacity="1",this._opacityWhenCovered="0.2"),e!==void 0&&(this._opacity=e),r!==void 0&&(this._opacityWhenCovered=r),this._map&&this._updateOpacity(!0),this}};u(Sf,"Marker");var li=Sf;var u1={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0},vl=0,$n=!1,Af=class Af extends le{constructor(e){super();this._onSuccess=u(e=>{if(this._map){if(this._isOutOfMapMaxBounds(e)){this._setErrorState(),this.fire(new C("outofmaxbounds",e)),this._updateMarker(),this._finish();return}if(this.options.trackUserLocation)switch(this._lastKnownPosition=e,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw new Error("Unexpected watchState ".concat(this._watchState))}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(e),(!this.options.trackUserLocation||this._watchState==="ACTIVE_LOCK")&&this._updateCamera(e),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new C("geolocate",e)),this._finish()}},"_onSuccess");this._updateCamera=u(e=>{let r=new ee(e.coords.longitude,e.coords.latitude),i=e.coords.accuracy,n=this._map.getBearing(),a=B({bearing:n},this.options.fitBoundsOptions),s=Ke.fromLngLat(r,i);this._map.fitBounds(s,a,{geolocateSource:!0})},"_updateCamera");this._updateMarker=u(e=>{if(e){let r=new ee(e.coords.longitude,e.coords.latitude);this._accuracyCircleMarker.setLngLat(r).addTo(this._map),this._userLocationDotMarker.setLngLat(r).addTo(this._map),this._accuracy=e.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},"_updateMarker");this._onZoom=u(()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},"_onZoom");this._onError=u(e=>{if(this._map){if(this.options.trackUserLocation)if(e.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;let r=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=r,this._geolocateButton.setAttribute("aria-label",r),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(e.code===3&&$n)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new C("error",e)),this._finish()}},"_onError");this._finish=u(()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},"_finish");this._setupUI=u(e=>{if(this._map){if(this._container.addEventListener("contextmenu",r=>r.preventDefault()),this._geolocateButton=I.create("button","maplibregl-ctrl-geolocate",this._container),I.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",e===!1){ve("Geolocation support is not available so the GeolocateControl will be disabled.");let r=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=r,this._geolocateButton.setAttribute("aria-label",r)}else{let r=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=r,this._geolocateButton.setAttribute("aria-label",r)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=I.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new li({element:this._dotElement}),this._circleElement=I.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new li({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",()=>this.trigger()),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",r=>{let i=r.originalEvent&&r.originalEvent.type==="resize";!r.geolocateSource&&this._watchState==="ACTIVE_LOCK"&&!i&&(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new C("trackuserlocationend")))})}},"_setupUI");this.options=B({},u1,e)}onAdd(e){return this._map=e,this._container=I.create("div","maplibregl-ctrl maplibregl-ctrl-group"),pb().then(r=>this._setupUI(r)),this._container}onRemove(){this._geolocationWatchID!==void 0&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),I.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,vl=0,$n=!1}_isOutOfMapMaxBounds(e){let r=this._map.getMaxBounds(),i=e.coords;return r&&(i.longitude<r.getWest()||i.longitude>r.getEast()||i.latitude<r.getSouth()||i.latitude>r.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error("Unexpected watchState ".concat(this._watchState))}}_updateCircleRadius(){let e=this._map.getBounds(),r=e.getSouthEast(),i=e.getNorthEast(),n=r.distanceTo(i),a=this._map._container.clientHeight,s=Math.ceil(2*(this._accuracy/(n/a)));this._circleElement.style.width="".concat(s,"px"),this._circleElement.style.height="".concat(s,"px")}trigger(){if(!this._setup)return ve("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 C("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":vl--,$n=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this.fire(new C("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new C("trackuserlocationstart"));break;default:throw new Error("Unexpected watchState ".concat(this._watchState))}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error("Unexpected watchState ".concat(this._watchState))}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),vl++;let e;vl>1?(e={maximumAge:6e5,timeout:0},$n=!0):(e=this.options.positionOptions,$n=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,e)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}};u(Af,"GeolocateControl");var Tf=Af;m();var c1={maxWidth:100,unit:"metric"},Cf=class Cf{constructor(t){this._onMove=u(()=>{hb(this._map,this._container,this.options)},"_onMove");this.setUnit=u(t=>{this.options.unit=t,hb(this._map,this._container,this.options)},"setUnit");this.options={...c1,...t}}getDefaultPosition(){return"bottom-left"}onAdd(t){return this._map=t,this._container=I.create("div","maplibregl-ctrl maplibregl-ctrl-scale",t.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){I.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}};u(Cf,"ScaleControl");var If=Cf;function hb(o,t,e){let r=e&&e.maxWidth||100,i=o._container.clientHeight/2,n=o.unproject([0,i]),a=o.unproject([r,i]),s=n.distanceTo(a);if(e&&e.unit==="imperial"){let l=3.2808*s;if(l>5280){let c=l/5280;Xn(t,r,c,o._getUIString("ScaleControl.Miles"))}else Xn(t,r,l,o._getUIString("ScaleControl.Feet"))}else if(e&&e.unit==="nautical"){let l=s/1852;Xn(t,r,l,o._getUIString("ScaleControl.NauticalMiles"))}else s>=1e3?Xn(t,r,s/1e3,o._getUIString("ScaleControl.Kilometers")):Xn(t,r,s,o._getUIString("ScaleControl.Meters"))}u(hb,"updateScale");function Xn(o,t,e,r){let i=h1(e),n=i/e;o.style.width="".concat(t*n,"px"),o.innerHTML="".concat(i," ").concat(r)}u(Xn,"setScale");function p1(o){let t=Math.pow(10,Math.ceil(-Math.log(o)/Math.LN10));return Math.round(o*t)/t}u(p1,"getDecimalRoundNum");function h1(o){let t=Math.pow(10,"".concat(Math.floor(o)).length-1),e=o/t;return e=e>=10?10:e>=5?5:e>=3?3:e>=2?2:e>=1?1:p1(e),t*e}u(h1,"getRoundNum");m();var Mf=class Mf extends le{constructor(e={}){super();this._onFullscreenChange=u(()=>{var r;let e=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;(r=e==null?void 0:e.shadowRoot)!=null&&r.fullscreenElement;)e=e.shadowRoot.fullscreenElement;e===this._container!==this._fullscreen&&this._handleFullscreenChange()},"_onFullscreenChange");this._onClickFullscreen=u(()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},"_onClickFullscreen");this._fullscreen=!1,e&&e.container&&(e.container instanceof HTMLElement?this._container=e.container:ve("Full screen control 'container' must be a DOM element.")),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(e){return this._map=e,this._container||(this._container=this._map.getContainer()),this._controlContainer=I.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){I.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){let e=this._fullscreenButton=I.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);I.create("span","maplibregl-ctrl-icon",e).setAttribute("aria-hidden","true"),e.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){let e=this._getTitle();this._fullscreenButton.setAttribute("aria-label",e),this._fullscreenButton.title=e}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new C("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new C("fullscreenend")),this._prevCooperativeGesturesEnabled&&this._map.cooperativeGestures.enable())}_exitFullscreen(){window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}};u(Mf,"FullscreenControl");var Ef=Mf;m();var Df=class Df{constructor(t){this._toggleTerrain=u(()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()},"_toggleTerrain");this._updateTerrainIcon=u(()=>{this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.Disable")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.Enable"))},"_updateTerrainIcon");this.options=t}onAdd(t){return this._map=t,this._container=I.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=I.create("button","maplibregl-ctrl-terrain",this._container),I.create("span","maplibregl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){I.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}};u(Df,"TerrainControl");var Lf=Df;m();var Ee=re(fe(),1);var m1={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1},f1=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", "),Ff=class Ff extends le{constructor(e){super();this.remove=u(()=>(this._content&&I.remove(this._content),this._container&&(I.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new C("close"))),this),"remove");this._onMouseUp=u(e=>{this._update(e.point)},"_onMouseUp");this._onMouseMove=u(e=>{this._update(e.point)},"_onMouseMove");this._onDrag=u(e=>{this._update(e.point)},"_onDrag");this._update=u(e=>{var l;let r=this._lngLat||this._trackPointer;if(!this._map||!r||!this._content)return;if(!this._container){if(this._container=I.create("div","maplibregl-popup",this._map.getContainer()),this._tip=I.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(let c of this.options.className.split(" "))this._container.classList.add(c);this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._map.transform.renderWorldCopies&&!this._trackPointer?this._lngLat=xl(this._lngLat,this._flatPos,this._map.transform):this._lngLat=(l=this._lngLat)==null?void 0:l.wrap(),this._trackPointer&&!e)return;let i=this._flatPos=this._pos=this._trackPointer&&e?e:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&e?e:this._map.transform.locationPoint(this._lngLat));let n=this.options.anchor,a=mb(this.options.offset);if(!n){let c=this._container.offsetWidth,p=this._container.offsetHeight,h;i.y+a.bottom.y<p?h=["top"]:i.y>this._map.transform.height-p?h=["bottom"]:h=[],i.x<c/2?h.push("left"):i.x>this._map.transform.width-c/2&&h.push("right"),h.length===0?n="bottom":n=h.join("-")}let s=i.add(a[n]);this.options.subpixelPositioning||(s=s.round()),I.setTransform(this._container,"".concat(Wn[n]," translate(").concat(s.x,"px,").concat(s.y,"px)")),bl(this._container,n,"popup")},"_update");this._onClose=u(()=>{this.remove()},"_onClose");this.options=B(Object.create(m1),e)}addTo(e){return this._map&&this.remove(),this._map=e,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new C("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=ee.convert(e),this._pos=null,this._flatPos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._flatPos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(e){return this.setDOMContent(document.createTextNode(e))}setHTML(e){let r=document.createDocumentFragment(),i=document.createElement("body"),n;for(i.innerHTML=e;n=i.firstChild,!!n;)r.appendChild(n);return this.setDOMContent(r)}getMaxWidth(){var e;return(e=this._container)==null?void 0:e.style.maxWidth}setMaxWidth(e){return this.options.maxWidth=e,this._update(),this}setDOMContent(e){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=I.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(e),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(e){this._container&&this._container.classList.add(e)}removeClassName(e){this._container&&this._container.classList.remove(e)}setOffset(e){return this.options.offset=e,this._update(),this}toggleClassName(e){if(this._container)return this._container.classList.toggle(e)}setSubpixelPositioning(e){this.options.subpixelPositioning=e}_createCloseButton(){this.options.closeButton&&(this._closeButton=I.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;let e=this._container.querySelector(f1);e&&e.focus()}};u(Ff,"Popup");var kf=Ff;function mb(o){if(o)if(typeof o=="number"){let t=Math.round(Math.abs(o)/Math.SQRT2);return{center:new Ee.default(0,0),top:new Ee.default(0,o),"top-left":new Ee.default(t,t),"top-right":new Ee.default(-t,t),bottom:new Ee.default(0,-o),"bottom-left":new Ee.default(t,-t),"bottom-right":new Ee.default(-t,-t),left:new Ee.default(o,0),right:new Ee.default(-o,0)}}else if(o instanceof Ee.default||Array.isArray(o)){let t=Ee.default.convert(o);return{center:t,top:t,"top-left":t,"top-right":t,bottom:t,"bottom-left":t,"bottom-right":t,left:t,right:t}}else return{center:Ee.default.convert(o.center||[0,0]),top:Ee.default.convert(o.top||[0,0]),"top-left":Ee.default.convert(o["top-left"]||[0,0]),"top-right":Ee.default.convert(o["top-right"]||[0,0]),bottom:Ee.default.convert(o.bottom||[0,0]),"bottom-left":Ee.default.convert(o["bottom-left"]||[0,0]),"bottom-right":Ee.default.convert(o["bottom-right"]||[0,0]),left:Ee.default.convert(o.left||[0,0]),right:Ee.default.convert(o.right||[0,0])};else return mb(new Ee.default(0,0))}u(mb,"normalizeOffset");var d1=re(fe(),1);var y1=so.version;function mK(o,t){return Qt().setRTLTextPlugin(o,t)}u(mK,"setRTLTextPlugin");function fK(){return Qt().getRTLTextPluginStatus()}u(fK,"getRTLTextPluginStatus");function dK(){return y1}u(dK,"getVersion");function yK(){return Kt.workerCount}u(yK,"getWorkerCount");function gK(o){Kt.workerCount=o}u(gK,"setWorkerCount");function _K(){return qe.MAX_PARALLEL_IMAGE_REQUESTS}u(_K,"getMaxParallelImageRequests");function xK(o){qe.MAX_PARALLEL_IMAGE_REQUESTS=o}u(xK,"setMaxParallelImageRequests");function bK(){return qe.WORKER_URL}u(bK,"getWorkerUrl");function vK(o){qe.WORKER_URL=o}u(vK,"setWorkerUrl");function wK(o){return Pa().broadcast("IS",o)}u(wK,"importScriptInWorkers");var export_Point=d1.default;export{ar as AJAXError,qn as AttributionControl,Mn as BoxZoomHandler,yn as CanvasSource,jn as CooperativeGesturesHandler,Vn as DoubleClickZoomHandler,Un as DragPanHandler,Gn as DragRotateHandler,In as EdgeInsets,le as Evented,Ef as FullscreenControl,fn as GeoJSONSource,Tf as GeolocateControl,Cn as Hash,st as ImageSource,Bn as KeyboardHandler,ee as LngLat,Ke as LngLatBounds,Zn as LogoControl,_f as Map,Ne as MapMouseEvent,er as MapTouchEvent,En as MapWheelEvent,li as Marker,Te as MercatorCoordinate,bf as NavigationControl,export_Point as Point,kf as Popup,mn as RasterDEMTileSource,Pr as RasterTileSource,If as ScaleControl,On as ScrollZoomHandler,ii as Style,Lf as TerrainControl,zn as TwoFingersTouchPitchHandler,Rn as TwoFingersTouchRotateHandler,Fn as TwoFingersTouchZoomHandler,Nn as TwoFingersTouchZoomRotateHandler,pn as VectorTileSource,dn as VideoSource,Tb as addProtocol,Kv as addSourceType,Ov as clearPrewarmedResources,qe as config,_K as getMaxParallelImageRequests,fK as getRTLTextPluginStatus,dK as getVersion,yK as getWorkerCount,bK as getWorkerUrl,wK as importScriptInWorkers,Bv as prewarm,Ab as removeProtocol,xK as setMaxParallelImageRequests,mK as setRTLTextPlugin,gK as setWorkerCount,vK as setWorkerUrl};
|