@geolonia/embed 5.0.3 → 5.1.0

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.
@@ -0,0 +1,2 @@
1
+ /*! For license information please see embed-core.js.LICENSE.txt */
2
+ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.geoloniaEmbedCore=e():t.geoloniaEmbedCore=e()}(self,()=>(()=>{var t,e,r,i,n={34:(t,e,r)=>{"use strict";var i=r(9600),n=r(9957),o=r(4462)(),a=r(6556),s=a("Function.prototype.toString"),l=a("String.prototype.match"),c=a("Object.prototype.toString"),h=/^class /,u=/\s*function\s+([^(\s]*)\s*/,p=!(0 in[,]),d=Function.prototype,f=function(){return!1};if("object"==typeof document){var m=document.all;c(m)===c(document.all)&&(f=function(t){if((p||!t)&&(void 0===t||"object"==typeof t))try{var e=c(t);return("[object HTMLAllCollection]"===e||"[object Object]"===e)&&null==t("")}catch(t){}return!1})}t.exports=function(){if(f(this)||!function(t){if(i(t))return!1;if("function"!=typeof t)return!1;try{return!!l(s(t),h)}catch(t){}return!1}(this)&&!i(this))throw new TypeError("Function.prototype.name sham getter called on non-function");if(o&&n(this,"name"))return this.name;if(this===d)return"";var t=s(this),e=l(t,u);return e&&e[1]}},41:(t,e,r)=>{"use strict";var i=r(655),n=r(8068),o=r(9675),a=r(5795);t.exports=function(t,e,r){if(!t||"object"!=typeof t&&"function"!=typeof t)throw new o("`obj` must be an object or a function`");if("string"!=typeof e&&"symbol"!=typeof e)throw new o("`property` must be a string or a symbol`");if(arguments.length>3&&"boolean"!=typeof arguments[3]&&null!==arguments[3])throw new o("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&"boolean"!=typeof arguments[4]&&null!==arguments[4])throw new o("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&"boolean"!=typeof arguments[5]&&null!==arguments[5])throw new o("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&"boolean"!=typeof arguments[6])throw new o("`loose`, if provided, must be a boolean");var s=arguments.length>3?arguments[3]:null,l=arguments.length>4?arguments[4]:null,c=arguments.length>5?arguments[5]:null,h=arguments.length>6&&arguments[6],u=!!a&&a(t,e);if(i)i(t,e,{configurable:null===c&&u?u.configurable:!c,enumerable:null===s&&u?u.enumerable:!s,value:r,writable:null===l&&u?u.writable:!l});else{if(!h&&(s||l||c))throw new n("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.");t[e]=r}}},76:t=>{"use strict";t.exports=Function.prototype.call},113:(t,e,r)=>{"use strict";t.exports=r(1350)},122:t=>{"use strict";t.exports=function(t,e,r){var i=t(e,r);return i>=0?i:i+r}},162:t=>{"use strict";t.exports=function(t){return null===t||"function"!=typeof t&&"object"!=typeof t}},172:(t,e,r)=>{"use strict";var i=r(4224),n=r(8410),o=r(3384),a=r(3331);t.exports=function(t){var e=n(t);if(!a(e)||0===e)return 0;var r=o(e),s=i(r,65536);return 0===s?0:s}},214:(t,e,r)=>{"use strict";var i=r(487),n=r(8452),o=r(5388),a=r(8206),s=r(4895),l=r(9377),c=i(s()),h=function(t){return o(t),c(t)};n(h,{getPolyfill:s,implementation:a,shim:l}),t.exports=h},216:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 fill=%27%23333%27 viewBox=%270 0 29 29%27%3E%3Cpath d=%27m10.5 14 4-8 4 8z%27/%3E%3Cpath fill=%27%23ccc%27 d=%27m10.5 16 4 8 4-8z%27/%3E%3C/svg%3E"},256:t=>{"use strict";var e,r="function"==typeof Map&&Map.prototype?Map:null,i="function"==typeof Set&&Set.prototype?Set:null;i||(e=function(t){return!1});var n=r?Map.prototype.has:null,o=i?Set.prototype.has:null;e||o||(e=function(t){return!1}),t.exports=e||function(t){if(!t||"object"!=typeof t)return!1;try{if(o.call(t),n)try{n.call(t)}catch(t){return!0}return t instanceof i}catch(t){}return!1}},259:(t,e,r)=>{"use strict";var i=r(9957),n=r(9675),o=r(6537),a=r(6966),s=r(4323);t.exports=function(t){if(!o(t))throw new n("ToPropertyDescriptor requires an object");var e={};if(i(t,"enumerable")&&(e["[[Enumerable]]"]=s(t.enumerable)),i(t,"configurable")&&(e["[[Configurable]]"]=s(t.configurable)),i(t,"value")&&(e["[[Value]]"]=t.value),i(t,"writable")&&(e["[[Writable]]"]=s(t.writable)),i(t,"get")){var r=t.get;if(void 0!==r&&!a(r))throw new n("getter must be a function");e["[[Get]]"]=r}if(i(t,"set")){var l=t.set;if(void 0!==l&&!a(l))throw new n("setter must be a function");e["[[Set]]"]=l}if((i(e,"[[Get]]")||i(e,"[[Set]]"))&&(i(e,"[[Value]]")||i(e,"[[Writable]]")))throw new n("Invalid property descriptor. Cannot both specify accessors and a value or writable attribute");return e}},280:(t,e,r)=>{"use strict";var i=r(9675),n=r(8859),o=r(3541),a=r(6537);t.exports=function(t,e){if(!a(t))throw new i("Assertion failed: Type(O) is not Object");if(!o(e))throw new i("Assertion failed: P is not a Property Key, got "+n(e));return t[e]}},414:t=>{"use strict";t.exports=Math.round},453:(t,e,r)=>{"use strict";var i,n=r(9612),o=r(9383),a=r(1237),s=r(9290),l=r(9538),c=r(8068),h=r(9675),u=r(5345),p=r(1514),d=r(8968),f=r(6188),m=r(8002),g=r(5880),_=r(414),y=r(3093),b=Function,v=function(t){try{return b('"use strict"; return ('+t+").constructor;")()}catch(t){}},x=r(5795),w=r(655),T=function(){throw new h},S=x?function(){try{return T}catch(t){try{return x(arguments,"callee").get}catch(t){return T}}}():T,P=r(4039)(),C=r(3628),M=r(1064),A=r(8648),I=r(1002),E=r(76),k={},z="undefined"!=typeof Uint8Array&&C?C(Uint8Array):i,R={__proto__:null,"%AggregateError%":"undefined"==typeof AggregateError?i:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?i:ArrayBuffer,"%ArrayIteratorPrototype%":P&&C?C([][Symbol.iterator]()):i,"%AsyncFromSyncIteratorPrototype%":i,"%AsyncFunction%":k,"%AsyncGenerator%":k,"%AsyncGeneratorFunction%":k,"%AsyncIteratorPrototype%":k,"%Atomics%":"undefined"==typeof Atomics?i:Atomics,"%BigInt%":"undefined"==typeof BigInt?i:BigInt,"%BigInt64Array%":"undefined"==typeof BigInt64Array?i:BigInt64Array,"%BigUint64Array%":"undefined"==typeof BigUint64Array?i:BigUint64Array,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?i:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":o,"%eval%":eval,"%EvalError%":a,"%Float16Array%":"undefined"==typeof Float16Array?i:Float16Array,"%Float32Array%":"undefined"==typeof Float32Array?i:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?i:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?i:FinalizationRegistry,"%Function%":b,"%GeneratorFunction%":k,"%Int8Array%":"undefined"==typeof Int8Array?i:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?i:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?i:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":P&&C?C(C([][Symbol.iterator]())):i,"%JSON%":"object"==typeof JSON?JSON:i,"%Map%":"undefined"==typeof Map?i:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&P&&C?C((new Map)[Symbol.iterator]()):i,"%Math%":Math,"%Number%":Number,"%Object%":n,"%Object.getOwnPropertyDescriptor%":x,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?i:Promise,"%Proxy%":"undefined"==typeof Proxy?i:Proxy,"%RangeError%":s,"%ReferenceError%":l,"%Reflect%":"undefined"==typeof Reflect?i:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?i:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&P&&C?C((new Set)[Symbol.iterator]()):i,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?i:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":P&&C?C(""[Symbol.iterator]()):i,"%Symbol%":P?Symbol:i,"%SyntaxError%":c,"%ThrowTypeError%":S,"%TypedArray%":z,"%TypeError%":h,"%Uint8Array%":"undefined"==typeof Uint8Array?i:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?i:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?i:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?i:Uint32Array,"%URIError%":u,"%WeakMap%":"undefined"==typeof WeakMap?i:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?i:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?i:WeakSet,"%Function.prototype.call%":E,"%Function.prototype.apply%":I,"%Object.defineProperty%":w,"%Object.getPrototypeOf%":M,"%Math.abs%":p,"%Math.floor%":d,"%Math.max%":f,"%Math.min%":m,"%Math.pow%":g,"%Math.round%":_,"%Math.sign%":y,"%Reflect.getPrototypeOf%":A};if(C)try{null.error}catch(t){var D=C(C(t));R["%Error.prototype%"]=D}var L=function t(e){var r;if("%AsyncFunction%"===e)r=v("async function () {}");else if("%GeneratorFunction%"===e)r=v("function* () {}");else if("%AsyncGeneratorFunction%"===e)r=v("async function* () {}");else if("%AsyncGenerator%"===e){var i=t("%AsyncGeneratorFunction%");i&&(r=i.prototype)}else if("%AsyncIteratorPrototype%"===e){var n=t("%AsyncGenerator%");n&&C&&(r=C(n.prototype))}return R[e]=r,r},F={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},B=r(6743),O=r(9957),j=B.call(E,Array.prototype.concat),U=B.call(I,Array.prototype.splice),N=B.call(E,String.prototype.replace),V=B.call(E,String.prototype.slice),$=B.call(E,RegExp.prototype.exec),Z=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,G=/\\(\\)?/g,q=function(t,e){var r,i=t;if(O(F,i)&&(i="%"+(r=F[i])[0]+"%"),O(R,i)){var n=R[i];if(n===k&&(n=L(i)),void 0===n&&!e)throw new h("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:r,name:i,value:n}}throw new c("intrinsic "+t+" does not exist!")};t.exports=function(t,e){if("string"!=typeof t||0===t.length)throw new h("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof e)throw new h('"allowMissing" argument must be a boolean');if(null===$(/^%?[^%]*%?$/,t))throw new c("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=function(t){var e=V(t,0,1),r=V(t,-1);if("%"===e&&"%"!==r)throw new c("invalid intrinsic syntax, expected closing `%`");if("%"===r&&"%"!==e)throw new c("invalid intrinsic syntax, expected opening `%`");var i=[];return N(t,Z,function(t,e,r,n){i[i.length]=r?N(n,G,"$1"):e||t}),i}(t),i=r.length>0?r[0]:"",n=q("%"+i+"%",e),o=n.name,a=n.value,s=!1,l=n.alias;l&&(i=l[0],U(r,j([0,1],l)));for(var u=1,p=!0;u<r.length;u+=1){var d=r[u],f=V(d,0,1),m=V(d,-1);if(('"'===f||"'"===f||"`"===f||'"'===m||"'"===m||"`"===m)&&f!==m)throw new c("property names with quotes must have matching quotes");if("constructor"!==d&&p||(s=!0),O(R,o="%"+(i+="."+d)+"%"))a=R[o];else if(null!=a){if(!(d in a)){if(!e)throw new h("base intrinsic for "+t+" exists, but the property is not available.");return}if(x&&u+1>=r.length){var g=x(a,d);a=(p=!!g)&&"get"in g&&!("originalValue"in g.get)?g.get:a[d]}else p=O(a,d),a=a[d];p&&!s&&(R[o]=a)}}return a}},487:(t,e,r)=>{"use strict";var i=r(6897),n=r(655),o=r(3126),a=r(2205);t.exports=function(t){var e=o(arguments),r=t.length-(arguments.length-1);return i(e,1+(r>0?r:0),!0)},n?n(t.exports,"apply",{value:a}):t.exports.apply=a},533:(t,e,r)=>{"use strict";t.exports=r(1412)},540:t=>{"use strict";t.exports=function(t){var e=document.createElement("style");return t.setAttributes(e,t.attributes),t.insert(e,t.options),e}},557:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 fill=%27%23fff%27 viewBox=%270 0 20 20%27%3E%3Cpath d=%27M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7%27/%3E%3Ccircle cx=%2710%27 cy=%2710%27 r=%272%27/%3E%3C/svg%3E"},592:(t,e,r)=>{"use strict";var i=r(655),n=function(){return!!i};n.hasArrayLengthDefineBug=function(){if(!i)return null;try{return 1!==i([],"length",{value:1}).length}catch(t){return!0}},t.exports=n},593:(t,e,r)=>{"use strict";var i=r(3802),n=r(256),o=r(7842),a=r(2648);t.exports=function(t){if(t&&"object"==typeof t){if(i(t))return"Map";if(n(t))return"Set";if(o(t))return"WeakMap";if(a(t))return"WeakSet"}return!1}},655:t=>{"use strict";var e=Object.defineProperty||!1;if(e)try{e({},"a",{value:1})}catch(t){e=!1}t.exports=e},866:(t,e,r)=>{"use strict";var i=r(5437);t.exports=function(t){return arguments.length>1?i(t,arguments[1]):i(t)}},893:(t,e,r)=>{"use strict";var i=r(9675),n=r(6537),o=r(5701),a=r(4769),s=r(7030),l=r(8131),c=r(3541),h=r(2875),u=r(259);t.exports=function(t,e,r){if(!n(t))throw new i("Assertion failed: Type(O) is not Object");if(!c(e))throw new i("Assertion failed: P is not a Property Key");var p=o(r)?r:u(r);if(!o(p))throw new i("Assertion failed: Desc is not a valid Property Descriptor");return a(l,h,s,t,e,p)}},1002:t=>{"use strict";t.exports=Function.prototype.apply},1064:(t,e,r)=>{"use strict";var i=r(9612);t.exports=i.getPrototypeOf||null},1087:(t,e,r)=>{"use strict";t.exports=r(7440)},1093:t=>{"use strict";var e=Object.prototype.toString;t.exports=function(t){var r=e.call(t),i="[object Arguments]"===r;return i||(i="[object Array]"!==r&&null!==t&&"object"==typeof t&&"number"==typeof t.length&&t.length>=0&&"[object Function]"===e.call(t.callee)),i}},1113:t=>{"use strict";t.exports=function(t,e){if(e.styleSheet)e.styleSheet.cssText=t;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(t))}}},1189:(t,e,r)=>{"use strict";var i=Array.prototype.slice,n=r(1093),o=Object.keys,a=o?function(t){return o(t)}:r(8875),s=Object.keys;a.shim=function(){if(Object.keys){var t=function(){var t=Object.keys(arguments);return t&&t.length===arguments.length}(1,2);t||(Object.keys=function(t){return n(t)?s(i.call(t)):s(t)})}else Object.keys=a;return Object.keys||a},t.exports=a},1208:(t,e,r)=>{"use strict";r.d(e,{A:()=>s});var i=r(1601),n=r.n(i),o=r(6314),a=r.n(o)()(n());a.push([t.id,'.geolonia-clickable-marker {\n cursor: pointer;\n}\n\n/* Make fullscreen mode works with ie11 */\n.geolonia:-ms-fullscreen {\n width: 100%;\n height: 100%;\n}\n\n/**\n * Styles for loading effect.\n */\n.loading-geolonia-map {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background-color: rgba(255, 255, 255, 0.5);\n z-index: 9999;\n justify-content: center;\n align-items: center;\n display: flex;\n}\n\n.loading-geolonia-map .lds-grid {\n display: inline-block;\n position: relative;\n width: 80px;\n height: 80px;\n}\n\n.loading-geolonia-map .lds-grid div {\n position: absolute;\n width: 16px;\n height: 16px;\n border-radius: 50%;\n background: #999999;\n animation: lds-grid 1.2s linear infinite;\n}\n\n.loading-geolonia-map .lds-grid div:nth-child(1) {\n top: 8px;\n left: 8px;\n animation-delay: 0s;\n}\n\n.loading-geolonia-map .lds-grid div:nth-child(2) {\n top: 8px;\n left: 32px;\n animation-delay: -0.4s;\n}\n\n.loading-geolonia-map .lds-grid div:nth-child(3) {\n top: 8px;\n left: 56px;\n animation-delay: -0.8s;\n}\n\n.loading-geolonia-map .lds-grid div:nth-child(4) {\n top: 32px;\n left: 8px;\n animation-delay: -0.4s;\n}\n\n.loading-geolonia-map .lds-grid div:nth-child(5) {\n top: 32px;\n left: 32px;\n animation-delay: -0.8s;\n}\n\n.loading-geolonia-map .lds-grid div:nth-child(6) {\n top: 32px;\n left: 56px;\n animation-delay: -1.2s;\n}\n\n.loading-geolonia-map .lds-grid div:nth-child(7) {\n top: 56px;\n left: 8px;\n animation-delay: -0.8s;\n}\n\n.loading-geolonia-map .lds-grid div:nth-child(8) {\n top: 56px;\n left: 32px;\n animation-delay: -1.2s;\n}\n\n.loading-geolonia-map .lds-grid div:nth-child(9) {\n top: 56px;\n left: 56px;\n animation-delay: -1.6s;\n}\n\n@keyframes lds-grid {\n 0%, 100% {\n opacity: 1;\n }\n 50% {\n opacity: 0.5;\n }\n}\n\n/* Style for restricted mode */\n.geolonia__restricted-mode-image-container {\n background-image: url("https://geolonia.github.io/embed/restricted.jpg");\n background-position: center center;\n background-size: cover;\n}\n\n/* Style for error message */\n.geolonia__error-container {\n display: flex;\n justify-content: center;\n align-items: center;\n height: 100%;\n width: 100%;\n background-color: #dedede;\n z-index: 9999;\n position: absolute;\n}\n\n.geolonia__error-message {\n max-width: 300px;\n background-color: #ffffff;\n margin: 10px;\n padding: 0.75rem 1.25rem;\n border-radius: 6px;\n position: absolute;\n z-index: 99999;\n word-wrap: break-word;\n box-shadow: 0 4px 10px #0000001a\n}\n\n.geolonia__error-message-description {\n margin: 15px 0;\n}\n\n/* CSS for Attribution */\n/* Fix: https://github.com/geolonia/embed/issues/291 */\n.maplibregl-map {\n display: block!important;\n}\n\n.maplibregl-ctrl-attrib-inner {\n display: block!important;\n}\n\n.maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-inner {\n display: none!important;\n}\n\n.maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-inner,\n.maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-button {\n display: block!important;\n}\n/* End: CSS for Attribution */\n\n@media print {\n .maplibregl-control-container button {\n display: none;\n }\n}\n',""]);const s=a},1237:t=>{"use strict";t.exports=EvalError},1333:t=>{"use strict";t.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var t={},e=Symbol("test"),r=Object(e);if("string"==typeof e)return!1;if("[object Symbol]"!==Object.prototype.toString.call(e))return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(var i in t[e]=42,t)return!1;if("function"==typeof Object.keys&&0!==Object.keys(t).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(t).length)return!1;var n=Object.getOwnPropertySymbols(t);if(1!==n.length||n[0]!==e)return!1;if(!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var o=Object.getOwnPropertyDescriptor(t,e);if(42!==o.value||!0!==o.enumerable)return!1}return!0}},1350:(t,e,r)=>{"use strict";var i=r(8968);t.exports=function(t,e){var r=t%e;return i(r>=0?r:r+e)}},1376:(t,e,r)=>{"use strict";t.exports=r(453)},1412:(t,e,r)=>{"use strict";var i=r(453)("%Array%"),n=!i.isArray&&r(6556)("Object.prototype.toString");t.exports=i.isArray||function(t){return"[object Array]"===n(t)}},1413:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 fill=%27%23fff%27 viewBox=%270 0 29 29%27%3E%3Cpath d=%27M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1z%27/%3E%3C/svg%3E"},1482:(t,e,r)=>{"use strict";var i=r(8452),n=r(487),o=r(34),a=r(2747),s=r(8013),l=n(o);i(l,{getPolyfill:a,implementation:o,shim:s}),t.exports=l},1509:(t,e,r)=>{"use strict";var i=r(9675),n=r(6537),o=r(5291),a=r(6681),s=r(5680);t.exports=function(t,e){if("SEQ-CST"!==e&&"UNORDERED"!==e)throw new i("Assertion failed: `order` must be ~SEQ-CST~ or ~UNORDERED~");if(!n(t))throw new i("Assertion failed: `O` must be an Object");if(!s(t))throw new i("Assertion failed: `O` must be a Typed Array");var r=a(t,e);if(o(r))throw new i("`O` must be in-bounds and backed by a non-detached buffer");return r}},1514:t=>{"use strict";t.exports=Math.abs},1539:(t,e,r)=>{"use strict";var i=r(4761),n=r(1703),o=r(5128),a=r(3612),s=r(9803);t.exports=function(t){return null==t||"object"!=typeof t&&"function"!=typeof t?null:i(t)?"String":n(t)?"Number":o(t)?"Boolean":a(t)?"Symbol":s(t)?"BigInt":void 0}},1601:t=>{"use strict";t.exports=function(t){return t[1]}},1703:(t,e,r)=>{"use strict";var i=r(6556),n=i("Number.prototype.toString"),o=i("Object.prototype.toString"),a=r(9092)();t.exports=function(t){return"number"==typeof t||!(!t||"object"!=typeof t)&&(a?function(t){try{return n(t),!0}catch(t){return!1}}(t):"[object Number]"===o(t))}},1907:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 fill=%27%23fff%27 viewBox=%270 0 29 29%27%3E%3Cpath d=%27m10.5 14 4-8 4 8z%27/%3E%3Cpath fill=%27%23ccc%27 d=%27m10.5 16 4 8 4-8z%27/%3E%3C/svg%3E"},2076:(t,e,r)=>{"use strict";var i=r(9675),n=r(6537),o=r(3541),a=r(2875),s=function(){try{return delete[].length,!0}catch(t){return!1}}();t.exports=function(t,e,r,l){if(!n(t))throw new i("Assertion failed: `O` must be an Object");if(!o(e))throw new i("Assertion failed: `P` must be a Property Key");if("boolean"!=typeof l)throw new i("Assertion failed: `Throw` must be a Boolean");if(l){if(t[e]=r,s&&!a(t[e],r))throw new i("Attempted to assign to readonly property.");return!0}try{return t[e]=r,!s||a(t[e],r)}catch(t){return!1}}},2120:(t,e,r)=>{"use strict";var i=r(6556),n=i("Date.prototype.getDay"),o=i("Object.prototype.toString"),a=r(9092)();t.exports=function(t){return"object"==typeof t&&null!==t&&(a?function(t){try{return n(t),!0}catch(t){return!1}}(t):"[object Date]"===o(t))}},2138:(t,e,r)=>{"use strict";var i=r(453),n=r(8068),o=r(9675),a=r(7440),s=i("%Uint8Array%",!0),l=r(7881),c=r(5910),h=r(5015),u=r(4670),p=r(7070),d=r(9957),f=r(4097),m=r(5100),g=r(3795);t.exports=function(t,e,r,i,_,y){var b=p(t);if(!u(t)&&!b)throw new o("Assertion failed: `arrayBuffer` must be an ArrayBuffer or a SharedArrayBuffer");if(!a(e)||e<0)throw new o("Assertion failed: `byteIndex` must be a non-negative integer");if("string"!=typeof r||!d(f.size,"$"+r))throw new o("Assertion failed: `type` must be one of "+f.choices);if("number"!=typeof i&&"bigint"!=typeof i)throw new o("Assertion failed: `value` must be a Number or a BigInt");if("boolean"!=typeof _)throw new o("Assertion failed: `isTypedArray` must be a boolean");if("SEQ-CST"!==y&&"UNORDERED"!==y&&"INIT"!==y)throw new o('Assertion failed: `order` must be `"SEQ-CST"`, `"UNORDERED"`, or `"INIT"`');if(arguments.length>6&&"boolean"!=typeof arguments[6])throw new o("Assertion failed: `isLittleEndian` must be a boolean, if present");if(c(t))throw new o("Assertion failed: ArrayBuffer is detached");if(l(r)?"bigint"!=typeof i:"number"!=typeof i)throw new o("Assertion failed: `value` must be a BigInt if type is ~BIGINT64~ or ~BIGUINT64~, otherwise a Number");var v=f.size["$"+r],x=h(r,i,arguments.length>6?arguments[6]:"little"===m);if(b)throw new n("SharedArrayBuffer is not supported by this implementation");var w=new s(t,e,v);g(x,function(t,e){w[e]=t})}},2158:t=>{"use strict";t.exports=function(t){return"number"==typeof t&&t>=0&&t<=255&&(0|t)===t}},2205:(t,e,r)=>{"use strict";var i=r(6743),n=r(1002),o=r(3144);t.exports=function(){return o(i,n,arguments)}},2228:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 fill=%27%2333b5e5%27 viewBox=%270 0 20 20%27%3E%3Cpath d=%27M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7%27/%3E%3Ccircle cx=%2710%27 cy=%2710%27 r=%272%27/%3E%3C/svg%3E"},2308:(t,e,r)=>{"use strict";var i=r(2682),n=r(487),o=r(9897)(),a=r(9209)(),s={__proto__:null},l=r(5795),c=Object.defineProperty;if(l){var h=function(t){return t.byteOffset};i(a,function(t){if("function"==typeof r.g[t]||"object"==typeof r.g[t]){var e=r.g[t].prototype,i=l(e,"byteOffset");if(!i){var a=o(e);i=l(a,"byteOffset")}if(i&&i.get)s[t]=n(i.get);else if(c){var u=new r.g[t](2);(i=l(u,"byteOffset"))&&i.configurable&&c(u,"length",{value:3}),2===u.length&&(s[t]=h)}}})}var u=r(5680);t.exports=function(t){return!!u(t)&&function(t){var e;return i(s,function(r){if("number"!=typeof e)try{var i=r(t);"number"==typeof i&&(e=i)}catch(t){}}),e}(t)}},2353:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2722%27 height=%2722%27 fill=%27none%27 stroke=%27%2333b5e5%27 viewBox=%270 0 22 22%27%3E%3Ccircle cx=%2711%27 cy=%2711%27 r=%278.5%27/%3E%3Cpath d=%27M17.5 11c0 4.819-3.02 8.5-6.5 8.5S4.5 15.819 4.5 11 7.52 2.5 11 2.5s6.5 3.681 6.5 8.5Z%27/%3E%3Cpath d=%27M13.5 11c0 2.447-.331 4.64-.853 6.206-.262.785-.562 1.384-.872 1.777-.314.399-.58.517-.775.517s-.461-.118-.775-.517c-.31-.393-.61-.992-.872-1.777C8.831 15.64 8.5 13.446 8.5 11s.331-4.64.853-6.206c.262-.785.562-1.384.872-1.777.314-.399.58-.517.775-.517s.461.118.775.517c.31.393.61.992.872 1.777.522 1.565.853 3.76.853 6.206Z%27/%3E%3Cpath d=%27M11 7.5c-1.909 0-3.622-.166-4.845-.428-.616-.132-1.08-.283-1.379-.434a1.3 1.3 0 0 1-.224-.138q.07-.058.224-.138c.299-.151.763-.302 1.379-.434C7.378 5.666 9.091 5.5 11 5.5s3.622.166 4.845.428c.616.132 1.08.283 1.379.434.105.053.177.1.224.138q-.07.058-.224.138c-.299.151-.763.302-1.379.434-1.223.262-2.936.428-4.845.428ZM4.486 6.436ZM11 16.5c-1.909 0-3.622-.166-4.845-.428-.616-.132-1.08-.283-1.379-.434a1.3 1.3 0 0 1-.224-.138 1.3 1.3 0 0 1 .224-.138c.299-.151.763-.302 1.379-.434C7.378 14.666 9.091 14.5 11 14.5s3.622.166 4.845.428c.616.132 1.08.283 1.379.434.105.053.177.1.224.138a1.3 1.3 0 0 1-.224.138c-.299.151-.763.302-1.379.434-1.223.262-2.936.428-4.845.428Zm-6.514-1.064ZM11 12.5c-2.46 0-4.672-.222-6.255-.574-.796-.177-1.406-.38-1.805-.59a1.5 1.5 0 0 1-.39-.272.3.3 0 0 1-.047-.064.3.3 0 0 1 .048-.064c.066-.073.189-.167.389-.272.399-.21 1.009-.413 1.805-.59C6.328 9.722 8.54 9.5 11 9.5s4.672.222 6.256.574c.795.177 1.405.38 1.804.59.2.105.323.2.39.272a.3.3 0 0 1 .047.064.3.3 0 0 1-.048.064 1.4 1.4 0 0 1-.389.272c-.399.21-1.009.413-1.804.59-1.584.352-3.796.574-6.256.574Zm-8.501-1.51v.002zm0 .018v.002zm17.002.002v-.002zm0-.018v-.002z%27/%3E%3C/svg%3E"},2475:(t,e,r)=>{"use strict";var i=r(4224),n=r(8410),o=r(3384),a=r(3331),s=4294967296;t.exports=function(t){var e=n(t);if(!a(e)||0===e)return 0;var r=o(e),l=i(r,s),c=l>=2147483648?l-s:l;return 0===c?0:c}},2491:(t,e,r)=>{"use strict";var i=r(9675),n=r(9957),o=r(6537),a=r(3541);t.exports=function(t,e){if(!o(t))throw new i("Assertion failed: `O` must be an Object");if(!a(e))throw new i("Assertion failed: `P` must be a Property Key");return n(t,e)}},2521:(t,e,r)=>{"use strict";var i=r(8268);t.exports=function(){return"function"==typeof Uint8Array&&Uint8Array.prototype.slice||i}},2634:()=>{},2648:(t,e,r)=>{"use strict";var i=r(453),n=r(6556),o=i("%WeakSet%",!0),a=n("WeakSet.prototype.has",!0);if(a){var s=n("WeakMap.prototype.has",!0);t.exports=function(t){if(!t||"object"!=typeof t)return!1;try{if(a(t,a),s)try{s(t,s)}catch(t){return!0}return t instanceof o}catch(t){}return!1}}else t.exports=function(t){return!1}},2682:(t,e,r)=>{"use strict";var i=r(9600),n=Object.prototype.toString,o=Object.prototype.hasOwnProperty;t.exports=function(t,e,r){if(!i(e))throw new TypeError("iterator must be a function");var a,s;arguments.length>=3&&(a=r),s=t,"[object Array]"===n.call(s)?function(t,e,r){for(var i=0,n=t.length;i<n;i++)o.call(t,i)&&(null==r?e(t[i],i,t):e.call(r,t[i],i,t))}(t,e,a):"string"==typeof t?function(t,e,r){for(var i=0,n=t.length;i<n;i++)null==r?e(t.charAt(i),i,t):e.call(r,t.charAt(i),i,t)}(t,e,a):function(t,e,r){for(var i in t)o.call(t,i)&&(null==r?e(t[i],i,t):e.call(r,t[i],i,t))}(t,e,a)}},2697:(t,e,r)=>{"use strict";var i=r(453),n={__proto__:null,$Int8Array:i("%Int8Array%",!0),$Uint8Array:i("%Uint8Array%",!0),$Uint8ClampedArray:i("%Uint8ClampedArray%",!0),$Int16Array:i("%Int16Array%",!0),$Uint16Array:i("%Uint16Array%",!0),$Int32Array:i("%Int32Array%",!0),$Uint32Array:i("%Uint32Array%",!0),$BigInt64Array:i("%BigInt64Array%",!0),$BigUint64Array:i("%BigUint64Array%",!0),$Float16Array:i("%Float16Array%",!0),$Float32Array:i("%Float32Array%",!0),$Float64Array:i("%Float64Array%",!0)};t.exports=function(t){return n["$"+t]}},2702:(t,e,r)=>{"use strict";t.exports=r(6537)},2747:(t,e,r)=>{"use strict";var i=r(34);t.exports=function(){return i}},2779:(t,e,r)=>{"use strict";var i=r(1514),n=r(8968),o=r(5880),a=r(3331),s=r(4459),l=r(8017);t.exports=function(t,e){if(s(t))return e?[0,0,192,127]:[127,192,0,0];var r;if(0===t)return r=l(t)?128:0,e?[0,0,0,r]:[r,0,0,0];if(i(t)>34028234663852886e22||!a(t))return r=t<0?255:127,e?[0,0,128,r]:[r,128,0,0];var c=t<0?1:0;t=i(t);for(var h=0;t>=2;)h+=1,t/=2;for(;t<1;)h-=1,t*=2;var u=t-1;u*=o(2,23)+.5,h+=127;var p=c<<31|(h<<=23)|(u=n(u)),d=255&p,f=255&(p>>=8),m=255&(p>>=8),g=255&(p>>=8);return e?[d,f,m,g]:[g,m,f,d]}},2792:(t,e,r)=>{"use strict";function i(t){switch(t&&t.type||null){case"FeatureCollection":return t.features=t.features.reduce(function(t,e){return t.concat(i(e))},[]),t;case"Feature":return t.geometry?i(t.geometry).map(function(e){var r={type:"Feature",properties:JSON.parse(JSON.stringify(t.properties)),geometry:e};return void 0!==t.id&&(r.id=t.id),r}):[t];case"MultiPoint":return t.coordinates.map(function(t){return{type:"Point",coordinates:t}});case"MultiPolygon":return t.coordinates.map(function(t){return{type:"Polygon",coordinates:t}});case"MultiLineString":return t.coordinates.map(function(t){return{type:"LineString",coordinates:t}});case"GeometryCollection":return t.geometries.map(i).reduce(function(t,e){return t.concat(e)},[]);case"Point":case"Polygon":case"LineString":return[t]}}r.r(e),r.d(e,{default:()=>i})},2875:(t,e,r)=>{"use strict";var i=r(4459);t.exports=function(t,e){return t===e?0!==t||1/t==1/e:i(t)&&i(e)}},2905:(t,e,r)=>{var i=r(8186),n=r(2792),o=r(9883);n instanceof Function||(n=n.default),t.exports=function(t){if(!t)return[];var e=n(i(t)),r=[];return e.features.forEach(function(t){t.geometry&&(r=r.concat(o(t.geometry.coordinates)))}),r}},2964:(t,e,r)=>{"use strict";var i=r(453),n=i("%BigInt%",!0),o=i("%Number%"),a=r(9675),s=r(8068),l=r(9693),c=r(866);t.exports=function(t){if(!n)throw new s("BigInts are not supported in this environment");var e=c(t,o);if(null==e)throw new a("Cannot convert null or undefined to a BigInt");if("boolean"==typeof e)return n(e?1:0);if("number"==typeof e)throw new a("Cannot convert a Number value to a BigInt");if("string"==typeof e){var r=l(e);if(void 0===r)throw new a("Failed to parse String to BigInt");return r}if("symbol"==typeof e)throw new a("Cannot convert a Symbol value to a BigInt");if("bigint"!=typeof e)throw new s("Assertion failed: unknown primitive type");return e}},2997:t=>{"use strict";t.exports=function(t){if(void 0===t)return t;var e={};return"[[Value]]"in t&&(e.value=t["[[Value]]"]),"[[Writable]]"in t&&(e.writable=!!t["[[Writable]]"]),"[[Get]]"in t&&(e.get=t["[[Get]]"]),"[[Set]]"in t&&(e.set=t["[[Set]]"]),"[[Enumerable]]"in t&&(e.enumerable=!!t["[[Enumerable]]"]),"[[Configurable]]"in t&&(e.configurable=!!t["[[Configurable]]"]),e}},3093:(t,e,r)=>{"use strict";var i=r(4459);t.exports=function(t){return i(t)||0===t?t:t<0?-1:1}},3126:(t,e,r)=>{"use strict";var i=r(6743),n=r(9675),o=r(76),a=r(3144);t.exports=function(t){if(t.length<1||"function"!=typeof t[0])throw new n("a function is required");return a(i,o,t)}},3144:(t,e,r)=>{"use strict";var i=r(6743),n=r(1002),o=r(76),a=r(7119);t.exports=a||i.call(o,n)},3331:(t,e,r)=>{"use strict";var i=r(4459);t.exports=function(t){return("number"==typeof t||"bigint"==typeof t)&&!i(t)&&t!==1/0&&t!==-1/0}},3363:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 viewBox=%270 0 29 29%27%3E%3Cpath d=%27M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5%27/%3E%3C/svg%3E"},3384:(t,e,r)=>{"use strict";var i=r(5986),n=r(9675);t.exports=function(t){if("number"!=typeof t&&"bigint"!=typeof t)throw new n("argument must be a Number or a BigInt");var e=t<0?-i(-t):i(t);return 0===e?0:e}},3432:(t,e,r)=>{"use strict";var i=r(8452),n=r(487),o=r(8268),a=r(2521),s=r(8599),l=n(a());i(l,{getPolyfill:a,implementation:o,shim:s}),t.exports=l},3446:(t,e,r)=>{"use strict";var i=r(453)("%BigInt%",!0),n=r(5880),o=r(2964),a=r(9969),s=r(122),l=i&&BigInt(n(2,32))*BigInt(n(2,31)),c=i&&BigInt(n(2,32))*BigInt(n(2,32));t.exports=function(t){var e=o(t),r=s(a,e,c);return r>=l?r-c:r}},3470:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 fill=%27%23333%27 viewBox=%270 0 29 29%27%3E%3Cpath d=%27M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5%27/%3E%3C/svg%3E"},3490:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 fill=%27%23333%27 viewBox=%270 0 29 29%27%3E%3Cpath d=%27M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1z%27/%3E%3C/svg%3E"},3541:t=>{"use strict";t.exports=function(t){return"string"==typeof t||"symbol"==typeof t}},3557:(t,e,r)=>{"use strict";var i=r(4224),n=r(8410),o=r(3384),a=r(3331);t.exports=function(t){var e=n(t);if(!a(e)||0===e)return 0;var r=o(e),s=i(r,65536);return s>=32768?s-65536:s}},3612:(t,e,r)=>{"use strict";var i=r(6556),n=i("Object.prototype.toString"),o=r(4039)(),a=r(9721);if(o){var s=i("Symbol.prototype.toString"),l=a(/^Symbol\(.*\)$/);t.exports=function(t){if("symbol"==typeof t)return!0;if(!t||"object"!=typeof t||"[object Symbol]"!==n(t))return!1;try{return function(t){return"symbol"==typeof t.valueOf()&&l(s(t))}(t)}catch(t){return!1}}}else t.exports=function(t){return!1}},3628:(t,e,r)=>{"use strict";var i=r(8648),n=r(1064),o=r(7176);t.exports=i?function(t){return i(t)}:n?function(t){if(!t||"object"!=typeof t&&"function"!=typeof t)throw new TypeError("getProto: not an object");return n(t)}:o?function(t){return o(t)}:null},3737:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 fill=%27%23666%27 viewBox=%270 0 20 20%27%3E%3Cpath d=%27M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7%27/%3E%3Ccircle cx=%2710%27 cy=%2710%27 r=%272%27/%3E%3Cpath fill=%27red%27 d=%27m14 5 1 1-9 9-1-1z%27/%3E%3C/svg%3E"},3795:t=>{"use strict";t.exports=function(t,e){for(var r=0;r<t.length;r+=1)e(t[r],r,t)}},3802:t=>{"use strict";var e,r="function"==typeof Map&&Map.prototype?Map:null,i="function"==typeof Set&&Set.prototype?Set:null;r||(e=function(t){return!1});var n=r?Map.prototype.has:null,o=i?Set.prototype.has:null;e||n||(e=function(t){return!1}),t.exports=e||function(t){if(!t||"object"!=typeof t)return!1;try{if(n.call(t),o)try{o.call(t)}catch(t){return!0}return t instanceof r}catch(t){}return!1}},3811:(t,e,r)=>{"use strict";var i=r(6556)("FinalizationRegistry.prototype.register",!0);t.exports=i?function(t){if(!t||"object"!=typeof t)return!1;try{return i(t,{},null),!0}catch(t){return!1}}:function(t){return!1}},3870:t=>{"use strict";const e=async function(){}.constructor;t.exports=()=>e},3913:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 fill=%27%23fff%27 viewBox=%270 0 29 29%27%3E%3Cpath d=%27M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1z%27/%3E%3C/svg%3E"},4035:(t,e,r)=>{"use strict";var i,n=r(6556),o=r(9092)(),a=r(9957),s=r(5795);if(o){var l=n("RegExp.prototype.exec"),c={},h=function(){throw c},u={toString:h,valueOf:h};"symbol"==typeof Symbol.toPrimitive&&(u[Symbol.toPrimitive]=h),i=function(t){if(!t||"object"!=typeof t)return!1;var e=s(t,"lastIndex");if(!e||!a(e,"value"))return!1;try{l(t,u)}catch(t){return t===c}}}else{var p=n("Object.prototype.toString");i=function(t){return!(!t||"object"!=typeof t&&"function"!=typeof t)&&"[object RegExp]"===p(t)}}t.exports=i},4039:(t,e,r)=>{"use strict";var i="undefined"!=typeof Symbol&&Symbol,n=r(1333);t.exports=function(){return"function"==typeof i&&"function"==typeof Symbol&&"symbol"==typeof i("foo")&&"symbol"==typeof Symbol("bar")&&n()}},4097:t=>{"use strict";t.exports={__proto__:null,name:{__proto__:null,$Int8Array:"INT8",$Uint8Array:"UINT8",$Uint8ClampedArray:"UINT8C",$Int16Array:"INT16",$Uint16Array:"UINT16",$Int32Array:"INT32",$Uint32Array:"UINT32",$BigInt64Array:"BIGINT64",$BigUint64Array:"BIGUINT64",$Float32Array:"FLOAT32",$Float64Array:"FLOAT64"},size:{__proto__:null,$INT8:1,$UINT8:1,$UINT8C:1,$INT16:2,$UINT16:2,$INT32:4,$UINT32:4,$BIGINT64:8,$BIGUINT64:8,$FLOAT32:4,$FLOAT64:8},choices:'"INT8", "UINT8", "UINT8C", "INT16", "UINT16", "INT32", "UINT32", "BIGINT64", "BIGUINT64", "FLOAT32", or "FLOAT64"'}},4138:t=>{"use strict";t.exports=function(t,e){for(var r=0;r<t.length;r+=1)if(!e(t[r],r,t))return!1;return!0}},4224:(t,e,r)=>{"use strict";var i=r(113);t.exports=function(t,e){return i(t,e)}},4233:t=>{"use strict";const e=function*(){}.constructor;t.exports=()=>e},4323:t=>{"use strict";t.exports=function(t){return!!t}},4372:(t,e,r)=>{"use strict";var i=r(9675),n=r(6556)("TypedArray.prototype.buffer",!0),o=r(5680);t.exports=n||function(t){if(!o(t))throw new i("Not a Typed Array");return t.buffer}},4399:(t,e,r)=>{"use strict";var i=r(453)("%Array.prototype.concat%"),n=r(487),o=r(6556)("Array.prototype.slice"),a=r(1333)()&&Symbol.isConcatSpreadable,s=[],l=a?n.apply(i,s):null,c=a?r(4634):null;t.exports=a?function(t){for(var e=0;e<arguments.length;e+=1){var r=arguments[e];if(r&&"object"==typeof r&&"boolean"==typeof r[a]){s[a]||(s[a]=!0);var i=c(r)?o(r):[r];i[a]=!0,arguments[e]=i}}return l(arguments)}:n(i,s)},4417:t=>{"use strict";t.exports=function(t,e){return e||(e={}),t?(t=String(t.__esModule?t.default:t),/^['"].*['"]$/.test(t)&&(t=t.slice(1,-1)),e.hash&&(t+=e.hash),/["'() \t\n]|(%20)/.test(t)||e.needQuotes?'"'.concat(t.replace(/"/g,'\\"').replace(/\n/g,"\\n"),'"'):t):t}},4420:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 fill=%27%23333%27 viewBox=%270 0 20 20%27%3E%3Cpath d=%27M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7%27/%3E%3Ccircle cx=%2710%27 cy=%2710%27 r=%272%27/%3E%3C/svg%3E"},4459:t=>{"use strict";t.exports=Number.isNaN||function(t){return t!=t}},4462:t=>{"use strict";var e=function(){return"string"==typeof function(){}.name},r=Object.getOwnPropertyDescriptor;if(r)try{r([],"length")}catch(t){r=null}e.functionsHaveConfigurableNames=function(){if(!e()||!r)return!1;var t=r(function(){},"name");return!!t&&!!t.configurable};var i=Function.prototype.bind;e.boundFunctionsHaveNames=function(){return e()&&"function"==typeof i&&""!==function(){}.bind().name},t.exports=e},4528:(t,e,r)=>{"use strict";var i=r(1376)("%Reflect.construct%",!0),n=r(893);try{n({},"",{"[[Get]]":function(){}})}catch(t){n=null}if(n&&i){var o={},a={};n(a,"length",{"[[Get]]":function(){throw o},"[[Enumerable]]":!0}),t.exports=function(t){try{i(t,a)}catch(t){return t===o}}}else t.exports=function(t){return"function"==typeof t&&!!t.prototype}},4634:t=>{var e={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==e.call(t)}},4643:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 viewBox=%270 0 29 29%27%3E%3Cpath d=%27M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1z%27/%3E%3C/svg%3E"},4665:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 fill=%27%23fff%27 viewBox=%270 0 29 29%27%3E%3Cpath d=%27M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5%27/%3E%3C/svg%3E"},4670:(t,e,r)=>{"use strict";var i=r(487),n=r(6556),o=r(453)("%ArrayBuffer%",!0),a=n("ArrayBuffer.prototype.byteLength",!0),s=n("Object.prototype.toString"),l=!!o&&!a&&new o(0).slice,c=!!l&&i(l);t.exports=a||c?function(t){if(!t||"object"!=typeof t)return!1;try{return a?a(t):c(t,0),!0}catch(t){return!1}}:o?function(t){return"[object ArrayBuffer]"===s(t)}:function(t){return!1}},4742:(t,e,r)=>{"use strict";var i=r(8068),n=r(9675),o=r(7440),a=r(5767),s=r(4097);t.exports=function(t){var e=a(t);if(!e)throw new n("Assertion failed: `O` must be a TypedArray");var r=s.size["$"+s.name["$"+e]];if(!o(r)||r<0)throw new i("Assertion failed: Unknown TypedArray type `"+e+"`");return r}},4748:t=>{"use strict";function e(t,e){this.x=t,this.y=e}t.exports=e,e.prototype={clone:function(){return new e(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},multByPoint:function(t){return this.clone()._multByPoint(t)},divByPoint:function(t){return this.clone()._divByPoint(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},rotateAround:function(t,e){return this.clone()._rotateAround(t,e)},matMult:function(t){return this.clone()._matMult(t)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var e=t.x-this.x,r=t.y-this.y;return e*e+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult:function(t){var e=t[0]*this.x+t[1]*this.y,r=t[2]*this.x+t[3]*this.y;return this.x=e,this.y=r,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_multByPoint:function(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint:function(t){return this.x/=t.x,this.y/=t.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var e=Math.cos(t),r=Math.sin(t),i=e*this.x-r*this.y,n=r*this.x+e*this.y;return this.x=i,this.y=n,this},_rotateAround:function(t,e){var r=Math.cos(t),i=Math.sin(t),n=e.x+r*(this.x-e.x)-i*(this.y-e.y),o=e.y+i*(this.x-e.x)+r*(this.y-e.y);return this.x=n,this.y=o,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},e.convert=function(t){return t instanceof e?t:Array.isArray(t)?new e(t[0],t[1]):t}},4751:(t,e,r)=>{"use strict";var i=r(453),n=i("%Number%"),o=i("%BigInt%",!0);t.exports=function(t,e,r){var i="bigint"==typeof t?o:n;t<0&&(t>>>=0);for(var a=[],s=0;s<e;s++)a[r?s:e-1-s]=n(t&i(255)),t>>=i(8);return a}},4761:(t,e,r)=>{"use strict";var i=r(6556),n=i("String.prototype.valueOf"),o=i("Object.prototype.toString"),a=r(9092)();t.exports=function(t){return"string"==typeof t||!(!t||"object"!=typeof t)&&(a?function(t){try{return n(t),!0}catch(t){return!1}}(t):"[object String]"===o(t))}},4769:(t,e,r)=>{"use strict";var i=r(592),n=r(655),o=i.hasArrayLengthDefineBug(),a=o&&r(1412),s=r(6556)("Object.prototype.propertyIsEnumerable");t.exports=function(t,e,r,i,l,c){if(!n){if(!t(c))return!1;if(!c["[[Configurable]]"]||!c["[[Writable]]"])return!1;if(l in i&&s(i,l)!==!!c["[[Enumerable]]"])return!1;var h=c["[[Value]]"];return i[l]=h,e(i[l],h)}return o&&"length"===l&&"[[Value]]"in c&&a(i)&&i.length!==c["[[Value]]"]?(i.length=c["[[Value]]"],i.length===c["[[Value]]"]):(n(i,l,r(c)),!0)}},4770:(t,e,r)=>{"use strict";var i=r(4224),n=r(8410),o=r(3384),a=r(3331);t.exports=function(t){var e=n(t);if(!a(e)||0===e)return 0;var r=o(e),s=i(r,4294967296);return 0===s?0:s}},4810:(t,e,r)=>{"use strict";var i=r(453)("%String%"),n=r(9675);t.exports=function(t){if("symbol"==typeof t)throw new n("Cannot convert a Symbol value to a string");return i(t)}},4890:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 viewBox=%270 0 29 29%27%3E%3Cpath d=%27M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13z%27/%3E%3C/svg%3E"},4895:(t,e,r)=>{"use strict";var i=r(8206);t.exports=function(){return String.prototype.trim&&"​"==="​".trim()&&"᠎"==="᠎".trim()&&"_᠎"==="_᠎".trim()&&"᠎_"==="᠎_".trim()?String.prototype.trim:i}},4915:(t,e,r)=>{"use strict";var i=r(5880);t.exports=function(t){var e=128&t[3]?-1:1,r=(127&t[3])<<1|t[2]>>7,n=(127&t[2])<<16|t[1]<<8|t[0];return 0===r&&0===n?1===e?0:-0:255===r&&0===n?1===e?1/0:-1/0:255===r&&0!==n?NaN:-127==(r-=127)?e*n*i(2,-149):e*(1+n*i(2,-23))*i(2,r)}},5015:(t,e,r)=>{"use strict";var i=r(9675),n=r(2491),o=r(3446),a=r(9887),s=r(3557),l=r(2475),c=r(7088),h=r(172),u=r(4770),p=r(6039),d=r(9308),f=r(2779),m=r(8894),g=r(4751),_=r(4097),y={__proto__:null,$INT8:c,$UINT8:p,$UINT8C:d,$INT16:s,$UINT16:h,$INT32:l,$UINT32:u,$BIGINT64:o,$BIGUINT64:a};t.exports=function(t,e,r){if("string"!=typeof t||!n(_.size,"$"+t))throw new i("Assertion failed: `type` must be a TypedArray element type");if("number"!=typeof e&&"bigint"!=typeof e)throw new i("Assertion failed: `value` must be a Number or a BigInt");if("boolean"!=typeof r)throw new i("Assertion failed: `isLittleEndian` must be a Boolean");if("FLOAT32"===t)return f(e,r);if("FLOAT64"===t)return m(e,r);var o=_.size["$"+t],a=(0,y["$"+t])(e);return g(a,o,r)}},5056:(t,e,r)=>{"use strict";t.exports=function(t){var e=r.nc;e&&t.setAttribute("nonce",e)}},5072:t=>{"use strict";var e=[];function r(t){for(var r=-1,i=0;i<e.length;i++)if(e[i].identifier===t){r=i;break}return r}function i(t,i){for(var o={},a=[],s=0;s<t.length;s++){var l=t[s],c=i.base?l[0]+i.base:l[0],h=o[c]||0,u="".concat(c," ").concat(h);o[c]=h+1;var p=r(u),d={css:l[1],media:l[2],sourceMap:l[3],supports:l[4],layer:l[5]};if(-1!==p)e[p].references++,e[p].updater(d);else{var f=n(d,i);i.byIndex=s,e.splice(s,0,{identifier:u,updater:f,references:1})}a.push(u)}return a}function n(t,e){var r=e.domAPI(e);return r.update(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap&&e.supports===t.supports&&e.layer===t.layer)return;r.update(t=e)}else r.remove()}}t.exports=function(t,n){var o=i(t=t||[],n=n||{});return function(t){t=t||[];for(var a=0;a<o.length;a++){var s=r(o[a]);e[s].references--}for(var l=i(t,n),c=0;c<o.length;c++){var h=r(o[c]);0===e[h].references&&(e[h].updater(),e.splice(h,1))}o=l}}},5100:(t,e,r)=>{"use strict";var i=r(453),n=i("%Uint8Array%",!0),o=i("%Uint32Array%",!0),a=r(4372),s=o&&new o([305419896]),l=s&&new n(a(s));t.exports=l?120===l[0]?"little":18===l[0]?"big":52===l[0]?"mixed":"unknown":"indeterminate"},5128:(t,e,r)=>{"use strict";var i=r(6556),n=i("Boolean.prototype.toString"),o=i("Object.prototype.toString"),a=r(9092)();t.exports=function(t){return"boolean"==typeof t||null!==t&&"object"==typeof t&&(a?function(t){try{return n(t),!0}catch(t){return!1}}(t):"[object Boolean]"===o(t))}},5233:t=>{function e(t){if(!(this instanceof e))return new e(t);this._bbox=t||[1/0,1/0,-1/0,-1/0],this._valid=!!t}t.exports=e,e.prototype.include=function(t){return this._valid=!0,this._bbox[0]=Math.min(this._bbox[0],t[0]),this._bbox[1]=Math.min(this._bbox[1],t[1]),this._bbox[2]=Math.max(this._bbox[2],t[0]),this._bbox[3]=Math.max(this._bbox[3],t[1]),this},e.prototype.equals=function(t){var r;return r=t instanceof e?t.bbox():t,this._bbox[0]==r[0]&&this._bbox[1]==r[1]&&this._bbox[2]==r[2]&&this._bbox[3]==r[3]},e.prototype.center=function(t){return this._valid?[(this._bbox[0]+this._bbox[2])/2,(this._bbox[1]+this._bbox[3])/2]:null},e.prototype.union=function(t){var r;return this._valid=!0,r=t instanceof e?t.bbox():t,this._bbox[0]=Math.min(this._bbox[0],r[0]),this._bbox[1]=Math.min(this._bbox[1],r[1]),this._bbox[2]=Math.max(this._bbox[2],r[2]),this._bbox[3]=Math.max(this._bbox[3],r[3]),this},e.prototype.bbox=function(){return this._valid?this._bbox:null},e.prototype.contains=function(t){if(!t)return this._fastContains();if(!this._valid)return null;var e=t[0],r=t[1];return this._bbox[0]<=e&&this._bbox[1]<=r&&this._bbox[2]>=e&&this._bbox[3]>=r},e.prototype.intersect=function(t){return this._valid?(r=t instanceof e?t.bbox():t,!(this._bbox[0]>r[2]||this._bbox[2]<r[0]||this._bbox[3]<r[1]||this._bbox[1]>r[3])):null;var r},e.prototype._fastContains=function(){if(!this._valid)return new Function("return null;");var t="return "+this._bbox[0]+"<= ll[0] &&"+this._bbox[1]+"<= ll[1] &&"+this._bbox[2]+">= ll[0] &&"+this._bbox[3]+">= ll[1]";return new Function("ll",t)},e.prototype.polygon=function(){return this._valid?{type:"Polygon",coordinates:[[[this._bbox[0],this._bbox[1]],[this._bbox[2],this._bbox[1]],[this._bbox[2],this._bbox[3]],[this._bbox[0],this._bbox[3]],[this._bbox[0],this._bbox[1]]]]}:null}},5291:(t,e,r)=>{"use strict";var i=r(9675),n=r(5910),o=r(6575),a=r(4742),s=r(9346),l=r(4372),c=r(2308),h=r(6058);t.exports=function(t){if(!s(t))throw new i("Assertion failed: `taRecord` must be a TypedArray With Buffer Witness Record");var e=t["[[Object]]"],r=t["[[CachedBufferByteLength]]"];if(n(l(e))&&"DETACHED"!==r)throw new i("Assertion failed: typed array is detached only if the byte length is ~DETACHED~");if("DETACHED"===r)return!0;var u,p=c(e),d=o(l(e))?h(e):"AUTO";return u="AUTO"===d?r:p+d*a(e),p>r||u>r}},5345:t=>{"use strict";t.exports=URIError},5351:(t,e,r)=>{"use strict";var i=r(6556),n=r(9721),o=i("Object.prototype.toString"),a=i("Function.prototype.toString"),s=n(/^\s*async(?:\s+function(?:\s+|\()|\s*\()/),l=r(9092)(),c=r(3628),h=r(3870);t.exports=function(t){if("function"!=typeof t)return!1;if(s(a(t)))return!0;if(!l)return"[object AsyncFunction]"===o(t);if(!c)return!1;var e=h();return e&&e.prototype===c(t)}},5388:(t,e,r)=>{"use strict";var i=r(9675);t.exports=function(t){if(null==t)throw new i(arguments.length>0&&arguments[1]||"Cannot call method on "+t);return t}},5437:(t,e,r)=>{"use strict";var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator,n=r(162),o=r(9600),a=r(2120),s=r(3612);t.exports=function(t){if(n(t))return t;var e,r="default";if(arguments.length>1&&(arguments[1]===String?r="string":arguments[1]===Number&&(r="number")),i&&(Symbol.toPrimitive?e=function(t,e){var r=t[e];if(null!=r){if(!o(r))throw new TypeError(r+" returned for property "+String(e)+" of object "+t+" is not a function");return r}}(t,Symbol.toPrimitive):s(t)&&(e=Symbol.prototype.valueOf)),void 0!==e){var l=e.call(t,r);if(n(l))return l;throw new TypeError("unable to convert exotic object to primitive")}return"default"===r&&(a(t)||s(t))&&(r="string"),function(t,e){if(null==t)throw new TypeError("Cannot call method on "+t);if("string"!=typeof e||"number"!==e&&"string"!==e)throw new TypeError('hint must be "string" or "number"');var r,i,a,s="string"===e?["toString","valueOf"]:["valueOf","toString"];for(a=0;a<s.length;++a)if(r=t[s[a]],o(r)&&(i=r.call(t),n(i)))return i;throw new TypeError("No default value")}(t,"default"===r?"number":r)}},5446:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2722%27 height=%2722%27 fill=%27%23333%27 viewBox=%270 0 22 22%27%3E%3Cpath d=%27m1.754 13.406 4.453-4.851 3.09 3.09 3.281 3.277.969-.969-3.309-3.312 3.844-4.121 6.148 6.886h1.082v-.855l-7.207-8.07-4.84 5.187L6.169 6.57l-5.48 5.965v.871ZM.688 16.844h20.625v1.375H.688Zm0 0%27/%3E%3C/svg%3E"},5680:(t,e,r)=>{"use strict";var i=r(5767);t.exports=function(t){return!!i(t)}},5701:(t,e,r)=>{"use strict";var i=r(9675),n=r(9957),o={__proto__:null,"[[Configurable]]":!0,"[[Enumerable]]":!0,"[[Get]]":!0,"[[Set]]":!0,"[[Value]]":!0,"[[Writable]]":!0};t.exports=function(t){if(!t||"object"!=typeof t)return!1;for(var e in t)if(n(t,e)&&!o[e])return!1;var r=n(t,"[[Value]]")||n(t,"[[Writable]]"),a=n(t,"[[Get]]")||n(t,"[[Set]]");if(r&&a)throw new i("Property Descriptors may not be both accessor and data descriptors");return!0}},5767:(t,e,r)=>{"use strict";var i=r(2682),n=r(9209),o=r(487),a=r(6556),s=r(5795),l=r(3628),c=a("Object.prototype.toString"),h=r(9092)(),u="undefined"==typeof globalThis?r.g:globalThis,p=n(),d=a("String.prototype.slice"),f=a("Array.prototype.indexOf",!0)||function(t,e){for(var r=0;r<t.length;r+=1)if(t[r]===e)return r;return-1},m={__proto__:null};i(p,h&&s&&l?function(t){var e=new u[t];if(Symbol.toStringTag in e&&l){var r=l(e),i=s(r,Symbol.toStringTag);if(!i&&r){var n=l(r);i=s(n,Symbol.toStringTag)}m["$"+t]=o(i.get)}}:function(t){var e=new u[t],r=e.slice||e.set;r&&(m["$"+t]=o(r))}),t.exports=function(t){if(!t||"object"!=typeof t)return!1;if(!h){var e=d(c(t),8,-1);return f(p,e)>-1?e:"Object"===e&&function(t){var e=!1;return i(m,function(r,i){if(!e)try{r(t),e=d(i,1)}catch(t){}}),e}(t)}return s?function(t){var e=!1;return i(m,function(r,i){if(!e)try{"$"+r(t)===i&&(e=d(i,1))}catch(t){}}),e}(t):null}},5795:(t,e,r)=>{"use strict";var i=r(6549);if(i)try{i([],"length")}catch(t){i=null}t.exports=i},5796:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 fill=%27%23aaa%27 viewBox=%270 0 20 20%27%3E%3Cpath d=%27M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7%27/%3E%3Ccircle cx=%2710%27 cy=%2710%27 r=%272%27/%3E%3Cpath fill=%27red%27 d=%27m14 5 1 1-9 9-1-1z%27/%3E%3C/svg%3E"},5879:(t,e,r)=>{var i=r(2905),n=r(6623),o=r(5233),a={features:["FeatureCollection"],coordinates:["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],geometry:["Feature"],geometries:["GeometryCollection"]},s=Object.keys(a);function l(t){for(var e=o(),r=i(t),n=0;n<r.length;n++)e.include(r[n]);return e}t.exports=function(t){return l(t).bbox()},t.exports.polygon=function(t){return l(t).polygon()},t.exports.bboxify=function(t){return n(t).map(function(t){t&&s.some(function(e){return!!t[e]&&-1!==a[e].indexOf(t.type)})&&(t.bbox=l(t).bbox(),this.update(t))})}},5880:t=>{"use strict";t.exports=Math.pow},5910:(t,e,r)=>{"use strict";var i=r(9675),n=r(9511),o=r(9209)(),a=r(6556),s=r(4670),l=r(7070),c=a("SharedArrayBuffer.prototype.byteLength",!0);t.exports=function(t){var e=l(t);if(!s(t)&&!e)throw new i("Assertion failed: `arrayBuffer` must be an Object with an [[ArrayBufferData]] internal slot");if(0===(e?c:n)(t))try{new r.g[o[0]](t)}catch(t){return!!t&&"TypeError"===t.name}return!1}},5955:(t,e,r)=>{"use strict";r.d(e,{A:()=>yt});var i=r(1601),n=r.n(i),o=r(6314),a=r.n(o),s=r(4417),l=r.n(s),c=new URL(r(7035),r.b),h=new URL(r(3470),r.b),u=new URL(r(8164),r.b),p=new URL(r(4665),r.b),d=new URL(r(4890),r.b),f=new URL(r(3363),r.b),m=new URL(r(3490),r.b),g=new URL(r(7603),r.b),_=new URL(r(3913),r.b),y=new URL(r(1413),r.b),b=new URL(r(4643),r.b),v=new URL(r(216),r.b),x=new URL(r(1907),r.b),w=new URL(r(8605),r.b),T=new URL(r(9387),r.b),S=new URL(r(2353),r.b),P=new URL(r(5446),r.b),C=new URL(r(6694),r.b),M=new URL(r(4420),r.b),A=new URL(r(5796),r.b),I=new URL(r(2228),r.b),E=new URL(r(9819),r.b),k=new URL(r(7695),r.b),z=new URL(r(8869),r.b),R=new URL(r(557),r.b),D=new URL(r(8460),r.b),L=new URL(r(6539),r.b),F=new URL(r(3737),r.b),B=new URL(r(7914),r.b),O=new URL(r(6117),r.b),j=new URL(r(6311),r.b),U=a()(n()),N=l()(c),V=l()(h),$=l()(u),Z=l()(p),G=l()(d),q=l()(f),H=l()(m),W=l()(g),X=l()(_),K=l()(y),Y=l()(b),J=l()(v),Q=l()(x),tt=l()(w),et=l()(T),rt=l()(S),it=l()(P),nt=l()(C),ot=l()(M),at=l()(A),st=l()(I),lt=l()(E),ct=l()(k),ht=l()(z),ut=l()(R),pt=l()(D),dt=l()(L),ft=l()(F),mt=l()(B),gt=l()(O),_t=l()(j);U.push([t.id,`.maplibregl-map{font:12px/20px Helvetica Neue,Arial,Helvetica,sans-serif;overflow:hidden;position:relative;-webkit-tap-highlight-color:rgb(0,0,0,0)}.maplibregl-canvas{left:0;position:absolute;top:0}.maplibregl-map:fullscreen{height:100%;width:100%}.maplibregl-ctrl-group button.maplibregl-ctrl-compass{touch-action:none}.maplibregl-canvas-container.maplibregl-interactive,.maplibregl-ctrl-group button.maplibregl-ctrl-compass{cursor:grab;-webkit-user-select:none;-moz-user-select:none;user-select:none}.maplibregl-canvas-container.maplibregl-interactive.maplibregl-track-pointer{cursor:pointer}.maplibregl-canvas-container.maplibregl-interactive:active,.maplibregl-ctrl-group button.maplibregl-ctrl-compass:active{cursor:grabbing}.maplibregl-canvas-container.maplibregl-touch-zoom-rotate,.maplibregl-canvas-container.maplibregl-touch-zoom-rotate .maplibregl-canvas{touch-action:pan-x pan-y}.maplibregl-canvas-container.maplibregl-touch-drag-pan,.maplibregl-canvas-container.maplibregl-touch-drag-pan .maplibregl-canvas{touch-action:pinch-zoom}.maplibregl-canvas-container.maplibregl-touch-zoom-rotate.maplibregl-touch-drag-pan,.maplibregl-canvas-container.maplibregl-touch-zoom-rotate.maplibregl-touch-drag-pan .maplibregl-canvas{touch-action:none}.maplibregl-canvas-container.maplibregl-touch-drag-pan.maplibregl-cooperative-gestures,.maplibregl-canvas-container.maplibregl-touch-drag-pan.maplibregl-cooperative-gestures .maplibregl-canvas{touch-action:pan-x pan-y}.maplibregl-ctrl-bottom-left,.maplibregl-ctrl-bottom-right,.maplibregl-ctrl-top-left,.maplibregl-ctrl-top-right{pointer-events:none;position:absolute;z-index:2}.maplibregl-ctrl-top-left{left:0;top:0}.maplibregl-ctrl-top-right{right:0;top:0}.maplibregl-ctrl-bottom-left{bottom:0;left:0}.maplibregl-ctrl-bottom-right{bottom:0;right:0}.maplibregl-ctrl{clear:both;pointer-events:auto;transform:translate(0)}.maplibregl-ctrl-top-left .maplibregl-ctrl{float:left;margin:10px 0 0 10px}.maplibregl-ctrl-top-right .maplibregl-ctrl{float:right;margin:10px 10px 0 0}.maplibregl-ctrl-bottom-left .maplibregl-ctrl{float:left;margin:0 0 10px 10px}.maplibregl-ctrl-bottom-right .maplibregl-ctrl{float:right;margin:0 10px 10px 0}.maplibregl-ctrl-group{background:#fff;border-radius:4px}.maplibregl-ctrl-group:not(:empty){box-shadow:0 0 0 2px rgba(0,0,0,.1)}@media (forced-colors:active){.maplibregl-ctrl-group:not(:empty){box-shadow:0 0 0 2px ButtonText}}.maplibregl-ctrl-group button{background-color:transparent;border:0;box-sizing:border-box;cursor:pointer;display:block;height:29px;outline:none;padding:0;width:29px}.maplibregl-ctrl-group button+button{border-top:1px solid #ddd}.maplibregl-ctrl button .maplibregl-ctrl-icon{background-position:50%;background-repeat:no-repeat;display:block;height:100%;width:100%}@media (forced-colors:active){.maplibregl-ctrl-icon{background-color:transparent}.maplibregl-ctrl-group button+button{border-top:1px solid ButtonText}}.maplibregl-ctrl button::-moz-focus-inner{border:0;padding:0}.maplibregl-ctrl-attrib-button:focus,.maplibregl-ctrl-group button:focus{box-shadow:0 0 2px 2px #0096ff}.maplibregl-ctrl button:disabled{cursor:not-allowed}.maplibregl-ctrl button:disabled .maplibregl-ctrl-icon{opacity:.25}@media (hover:hover){.maplibregl-ctrl button:not(:disabled):hover{background-color:rgba(0,0,0,.05)}}.maplibregl-ctrl button:not(:disabled):active{background-color:rgba(0,0,0,.05)}.maplibregl-ctrl-group button:focus:focus-visible{box-shadow:0 0 2px 2px #0096ff}.maplibregl-ctrl-group button:focus:not(:focus-visible){box-shadow:none}.maplibregl-ctrl-group button:focus:first-child{border-radius:4px 4px 0 0}.maplibregl-ctrl-group button:focus:last-child{border-radius:0 0 4px 4px}.maplibregl-ctrl-group button:focus:only-child{border-radius:inherit}.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url(${N})}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url(${V})}@media (forced-colors:active){.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url(${$})}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url(${Z})}}@media (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url(${G})}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url(${q})}}.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url(${H})}.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url(${W})}@media (forced-colors:active){.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url(${X})}.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url(${K})}}@media (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url(${Y})}.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url(${W})}}.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url(${J})}@media (forced-colors:active){.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url(${Q})}}@media (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url(${tt})}}.maplibregl-ctrl button.maplibregl-ctrl-globe .maplibregl-ctrl-icon{background-image:url(${et})}.maplibregl-ctrl button.maplibregl-ctrl-globe-enabled .maplibregl-ctrl-icon{background-image:url(${rt})}.maplibregl-ctrl button.maplibregl-ctrl-terrain .maplibregl-ctrl-icon{background-image:url(${it})}.maplibregl-ctrl button.maplibregl-ctrl-terrain-enabled .maplibregl-ctrl-icon{background-image:url(${nt})}.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url(${ot})}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url(${at})}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active .maplibregl-ctrl-icon{background-image:url(${st})}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active-error .maplibregl-ctrl-icon{background-image:url(${lt})}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background .maplibregl-ctrl-icon{background-image:url(${ct})}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background-error .maplibregl-ctrl-icon{background-image:url(${ht})}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-waiting .maplibregl-ctrl-icon{animation:maplibregl-spin 2s linear infinite}@media (forced-colors:active){.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url(${ut})}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url(${pt})}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active .maplibregl-ctrl-icon{background-image:url(${st})}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active-error .maplibregl-ctrl-icon{background-image:url(${lt})}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background .maplibregl-ctrl-icon{background-image:url(${ct})}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background-error .maplibregl-ctrl-icon{background-image:url(${ht})}}@media (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url(${dt})}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url(${ft})}}@keyframes maplibregl-spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}a.maplibregl-ctrl-logo{background-image:url(${mt});background-repeat:no-repeat;cursor:pointer;display:block;height:23px;margin:0 0 -4px -4px;overflow:hidden;width:88px}a.maplibregl-ctrl-logo.maplibregl-compact{width:14px}@media (forced-colors:active){a.maplibregl-ctrl-logo{background-color:transparent;background-image:url(${mt})}}@media (forced-colors:active) and (prefers-color-scheme:light){a.maplibregl-ctrl-logo{background-image:url(${mt})}}.maplibregl-ctrl.maplibregl-ctrl-attrib{background-color:hsla(0,0%,100%,.5);margin:0;padding:0 5px}@media screen{.maplibregl-ctrl-attrib.maplibregl-compact{background-color:#fff;border-radius:12px;box-sizing:content-box;color:#000;margin:10px;min-height:20px;padding:2px 24px 2px 0;position:relative}.maplibregl-ctrl-attrib.maplibregl-compact-show{padding:2px 28px 2px 8px;visibility:visible}.maplibregl-ctrl-bottom-left>.maplibregl-ctrl-attrib.maplibregl-compact-show,.maplibregl-ctrl-top-left>.maplibregl-ctrl-attrib.maplibregl-compact-show{border-radius:12px;padding:2px 8px 2px 28px}.maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-inner{display:none}.maplibregl-ctrl-attrib-button{background-color:hsla(0,0%,100%,.5);background-image:url(${gt});border:0;border-radius:12px;box-sizing:border-box;cursor:pointer;display:none;height:24px;outline:none;position:absolute;right:0;top:0;width:24px}.maplibregl-ctrl-attrib summary.maplibregl-ctrl-attrib-button{-webkit-appearance:none;-moz-appearance:none;appearance:none;list-style:none}.maplibregl-ctrl-attrib summary.maplibregl-ctrl-attrib-button::-webkit-details-marker{display:none}.maplibregl-ctrl-bottom-left .maplibregl-ctrl-attrib-button,.maplibregl-ctrl-top-left .maplibregl-ctrl-attrib-button{left:0}.maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-button,.maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-inner{display:block}.maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-button{background-color:rgba(0,0,0,.05)}.maplibregl-ctrl-bottom-right>.maplibregl-ctrl-attrib.maplibregl-compact:after{bottom:0;right:0}.maplibregl-ctrl-top-right>.maplibregl-ctrl-attrib.maplibregl-compact:after{right:0;top:0}.maplibregl-ctrl-top-left>.maplibregl-ctrl-attrib.maplibregl-compact:after{left:0;top:0}.maplibregl-ctrl-bottom-left>.maplibregl-ctrl-attrib.maplibregl-compact:after{bottom:0;left:0}}@media screen and (forced-colors:active){.maplibregl-ctrl-attrib.maplibregl-compact:after{background-image:url(${_t})}}@media screen and (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl-attrib.maplibregl-compact:after{background-image:url(${gt})}}.maplibregl-ctrl-attrib a{color:rgba(0,0,0,.75);text-decoration:none}.maplibregl-ctrl-attrib a:hover{color:inherit;text-decoration:underline}.maplibregl-attrib-empty{display:none}.maplibregl-ctrl-scale{background-color:hsla(0,0%,100%,.75);border:2px solid #333;border-top:#333;box-sizing:border-box;color:#333;font-size:10px;padding:0 5px}.maplibregl-popup{display:flex;left:0;pointer-events:none;position:absolute;top:0;will-change:transform}.maplibregl-popup-anchor-top,.maplibregl-popup-anchor-top-left,.maplibregl-popup-anchor-top-right{flex-direction:column}.maplibregl-popup-anchor-bottom,.maplibregl-popup-anchor-bottom-left,.maplibregl-popup-anchor-bottom-right{flex-direction:column-reverse}.maplibregl-popup-anchor-left{flex-direction:row}.maplibregl-popup-anchor-right{flex-direction:row-reverse}.maplibregl-popup-tip{border:10px solid transparent;height:0;width:0;z-index:1}.maplibregl-popup-anchor-top .maplibregl-popup-tip{align-self:center;border-bottom-color:#fff;border-top:none}.maplibregl-popup-anchor-top-left .maplibregl-popup-tip{align-self:flex-start;border-bottom-color:#fff;border-left:none;border-top:none}.maplibregl-popup-anchor-top-right .maplibregl-popup-tip{align-self:flex-end;border-bottom-color:#fff;border-right:none;border-top:none}.maplibregl-popup-anchor-bottom .maplibregl-popup-tip{align-self:center;border-bottom:none;border-top-color:#fff}.maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip{align-self:flex-start;border-bottom:none;border-left:none;border-top-color:#fff}.maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip{align-self:flex-end;border-bottom:none;border-right:none;border-top-color:#fff}.maplibregl-popup-anchor-left .maplibregl-popup-tip{align-self:center;border-left:none;border-right-color:#fff}.maplibregl-popup-anchor-right .maplibregl-popup-tip{align-self:center;border-left-color:#fff;border-right:none}.maplibregl-popup-close-button{background-color:transparent;border:0;border-radius:0 3px 0 0;cursor:pointer;position:absolute;right:0;top:0}.maplibregl-popup-close-button:hover{background-color:rgba(0,0,0,.05)}.maplibregl-popup-content{background:#fff;border-radius:3px;box-shadow:0 1px 2px rgba(0,0,0,.1);padding:15px 10px;pointer-events:auto;position:relative}.maplibregl-popup-anchor-top-left .maplibregl-popup-content{border-top-left-radius:0}.maplibregl-popup-anchor-top-right .maplibregl-popup-content{border-top-right-radius:0}.maplibregl-popup-anchor-bottom-left .maplibregl-popup-content{border-bottom-left-radius:0}.maplibregl-popup-anchor-bottom-right .maplibregl-popup-content{border-bottom-right-radius:0}.maplibregl-popup-track-pointer{display:none}.maplibregl-popup-track-pointer *{pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.maplibregl-map:hover .maplibregl-popup-track-pointer{display:flex}.maplibregl-map:active .maplibregl-popup-track-pointer{display:none}.maplibregl-marker{left:0;position:absolute;top:0;transition:opacity .2s;will-change:transform}.maplibregl-user-location-dot,.maplibregl-user-location-dot:before{background-color:#1da1f2;border-radius:50%;height:15px;width:15px}.maplibregl-user-location-dot:before{animation:maplibregl-user-location-dot-pulse 2s infinite;content:"";position:absolute}.maplibregl-user-location-dot:after{border:2px solid #fff;border-radius:50%;box-shadow:0 0 3px rgba(0,0,0,.35);box-sizing:border-box;content:"";height:19px;left:-2px;position:absolute;top:-2px;width:19px}@keyframes maplibregl-user-location-dot-pulse{0%{opacity:1;transform:scale(1)}70%{opacity:0;transform:scale(3)}to{opacity:0;transform:scale(1)}}.maplibregl-user-location-dot-stale{background-color:#aaa}.maplibregl-user-location-dot-stale:after{display:none}.maplibregl-user-location-accuracy-circle{background-color:#1da1f233;border-radius:100%;height:1px;width:1px}.maplibregl-crosshair,.maplibregl-crosshair .maplibregl-interactive,.maplibregl-crosshair .maplibregl-interactive:active{cursor:crosshair}.maplibregl-boxzoom{background:#fff;border:2px dotted #202020;height:0;left:0;opacity:.5;position:absolute;top:0;width:0}.maplibregl-cooperative-gesture-screen{align-items:center;background:rgba(0,0,0,.4);color:#fff;display:flex;font-size:1.4em;inset:0;justify-content:center;line-height:1.2;opacity:0;padding:1rem;pointer-events:none;position:absolute;transition:opacity 1s ease 1s;z-index:99999}.maplibregl-cooperative-gesture-screen.maplibregl-show{opacity:1;transition:opacity .05s}.maplibregl-cooperative-gesture-screen .maplibregl-mobile-message{display:none}@media (hover:none),(pointer:coarse){.maplibregl-cooperative-gesture-screen .maplibregl-desktop-message{display:none}.maplibregl-cooperative-gesture-screen .maplibregl-mobile-message{display:block}}.maplibregl-pseudo-fullscreen{height:100%!important;left:0!important;position:fixed!important;top:0!important;width:100%!important;z-index:99999}`,""]);const yt=U},5986:(t,e,r)=>{"use strict";var i=r(8968);t.exports=function(t){return"bigint"==typeof t?t:i(t)}},6039:(t,e,r)=>{"use strict";var i=r(3331),n=r(4224),o=r(8410),a=r(3384);t.exports=function(t){var e=o(t);if(!i(e)||0===e)return 0;var r=a(e);return n(r,256)}},6058:(t,e,r)=>{"use strict";var i=r(487),n=r(2682),o=r(5795),a=r(5680),s=r(6578),l=r(9897)(),c={__proto__:null},h=Object.defineProperty;if(o){var u=function(t){return t.length};n(s,function(t){var e=r.g[t];if("function"==typeof e||"object"==typeof e){var n=e.prototype,a=o(n,"length");if(!a){var s=l(n);a=o(s,"length")}if(a&&a.get)c["$"+t]=i(a.get);else if(h){var p=new r.g[t](2);(a=o(p,"length"))&&a.configurable&&h(p,"length",{value:3}),2===p.length&&(c["$"+t]=u)}}})}t.exports=function(t){return!!a(t)&&function(t){var e;return n(c,function(r){if("number"!=typeof e)try{var i=r(t);"number"==typeof i&&(e=i)}catch(t){}}),e}(t)}},6117:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2724%27 height=%2724%27 fill-rule=%27evenodd%27 viewBox=%270 0 20 20%27%3E%3Cpath d=%27M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0%27/%3E%3C/svg%3E"},6167:(t,e,r)=>{"use strict";var i=r(453),n=r(6556),o=r(9290),a=r(8068),s=r(9675),l=i("%BigInt%",!0),c=r(2491),h=r(533),u=r(7881),p=r(9373),d=r(4915),f=r(6587),m=r(6570),g=r(4138),_=r(2158),y=n("Array.prototype.reverse"),b=n("Array.prototype.slice"),v=r(4097);t.exports=function(t,e,r){if(!c(v.size,"$"+t))throw new s("Assertion failed: `type` must be a TypedArray element type");if(!h(e)||!g(e,_))throw new s("Assertion failed: `rawBytes` must be an Array of bytes");if("boolean"!=typeof r)throw new s("Assertion failed: `isLittleEndian` must be a Boolean");var i=v.size["$"+t];if(e.length!==i)throw new o("Assertion failed: `rawBytes` must have a length of "+i+" for type "+t);var n=u(t);if(n&&!l)throw new a("this environment does not support BigInts");return e=b(e,0,i),r||y(e),"FLOAT32"===t?d(e):"FLOAT64"===t?f(e):m(e,i,p(t),n)}},6188:t=>{"use strict";t.exports=Math.max},6268:(t,e,r)=>{"use strict";var i=r(453),n=r(6966),o=r(2702),a=r(9723),s=r(9675),l=r(3628),c=r(9612);t.exports=function(t){if(!o(t))throw new s("Reflect.getPrototypeOf called on non-object");if(l)return l(t);var e=a(t);if(e){var r=i("%"+e+".prototype%",!0);if(r)return r}return n(t.constructor)?t.constructor.prototype:t instanceof Object?c.prototype:null}},6311:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2724%27 height=%2724%27 fill=%27%23fff%27 fill-rule=%27evenodd%27 viewBox=%270 0 20 20%27%3E%3Cpath d=%27M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0%27/%3E%3C/svg%3E"},6314:t=>{"use strict";t.exports=function(t){var e=[];return e.toString=function(){return this.map(function(e){var r="",i=void 0!==e[5];return e[4]&&(r+="@supports (".concat(e[4],") {")),e[2]&&(r+="@media ".concat(e[2]," {")),i&&(r+="@layer".concat(e[5].length>0?" ".concat(e[5]):""," {")),r+=t(e),i&&(r+="}"),e[2]&&(r+="}"),e[4]&&(r+="}"),r}).join("")},e.i=function(t,r,i,n,o){"string"==typeof t&&(t=[[null,t,void 0]]);var a={};if(i)for(var s=0;s<this.length;s++){var l=this[s][0];null!=l&&(a[l]=!0)}for(var c=0;c<t.length;c++){var h=[].concat(t[c]);i&&a[h[0]]||(void 0!==o&&(void 0===h[5]||(h[1]="@layer".concat(h[5].length>0?" ".concat(h[5]):""," {").concat(h[1],"}")),h[5]=o),r&&(h[2]?(h[1]="@media ".concat(h[2]," {").concat(h[1],"}"),h[2]=r):h[2]=r),n&&(h[4]?(h[1]="@supports (".concat(h[4],") {").concat(h[1],"}"),h[4]=n):h[4]="".concat(n)),e.push(h))}},e}},6419:(t,e,r)=>{"use strict";var i=r(8068),n=r(9675),o=r(5767),a=r(4097);t.exports=function(t){var e=o(t);if(!e)throw new n("Assertion failed: `O` must be a TypedArray");var r=a.name["$"+e];if("string"!=typeof r)throw new i("Assertion failed: Unknown TypedArray type `"+e+"`");return r}},6443:function(t){t.exports=function(){"use strict";var t={},e={};function r(r,i,n){if(e[r]=n,"index"===r){var o="var sharedModule = {}; ("+e.shared+")(sharedModule); ("+e.worker+")(sharedModule);",a={};return e.shared(a),e.index(t,a),"undefined"!=typeof window&&t.setWorkerUrl(window.URL.createObjectURL(new Blob([o],{type:"text/javascript"}))),t}}return r("shared",0,function(t){function e(t,e,r,i){return new(r||(r=Promise))(function(n,o){function a(t){try{l(i.next(t))}catch(t){o(t)}}function s(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r(function(t){t(e)})).then(a,s)}l((i=i.apply(t,e||[])).next())})}function r(t,e){this.x=t,this.y=e}function i(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var n,o;"function"==typeof SuppressedError&&SuppressedError,r.prototype={clone(){return new r(this.x,this.y)},add(t){return this.clone()._add(t)},sub(t){return this.clone()._sub(t)},multByPoint(t){return this.clone()._multByPoint(t)},divByPoint(t){return this.clone()._divByPoint(t)},mult(t){return this.clone()._mult(t)},div(t){return this.clone()._div(t)},rotate(t){return this.clone()._rotate(t)},rotateAround(t,e){return this.clone()._rotateAround(t,e)},matMult(t){return this.clone()._matMult(t)},unit(){return this.clone()._unit()},perp(){return this.clone()._perp()},round(){return this.clone()._round()},mag(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals(t){return this.x===t.x&&this.y===t.y},dist(t){return Math.sqrt(this.distSqr(t))},distSqr(t){const e=t.x-this.x,r=t.y-this.y;return e*e+r*r},angle(){return Math.atan2(this.y,this.x)},angleTo(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith(t){return this.angleWithSep(t.x,t.y)},angleWithSep(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult(t){const e=t[2]*this.x+t[3]*this.y;return this.x=t[0]*this.x+t[1]*this.y,this.y=e,this},_add(t){return this.x+=t.x,this.y+=t.y,this},_sub(t){return this.x-=t.x,this.y-=t.y,this},_mult(t){return this.x*=t,this.y*=t,this},_div(t){return this.x/=t,this.y/=t,this},_multByPoint(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint(t){return this.x/=t.x,this.y/=t.y,this},_unit(){return this._div(this.mag()),this},_perp(){const t=this.y;return this.y=this.x,this.x=-t,this},_rotate(t){const e=Math.cos(t),r=Math.sin(t),i=r*this.x+e*this.y;return this.x=e*this.x-r*this.y,this.y=i,this},_rotateAround(t,e){const r=Math.cos(t),i=Math.sin(t),n=e.y+i*(this.x-e.x)+r*(this.y-e.y);return this.x=e.x+r*(this.x-e.x)-i*(this.y-e.y),this.y=n,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:r},r.convert=function(t){if(t instanceof r)return t;if(Array.isArray(t))return new r(+t[0],+t[1]);if(void 0!==t.x&&void 0!==t.y)return new r(+t.x,+t.y);throw new Error("Expected [x, y] or {x, y} point format")};var a=function(){if(o)return n;function t(t,e,r,i){this.cx=3*t,this.bx=3*(r-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(i-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=e,this.p2x=r,this.p2y=i}return o=1,n=t,t.prototype={sampleCurveX:function(t){return((this.ax*t+this.bx)*t+this.cx)*t},sampleCurveY:function(t){return((this.ay*t+this.by)*t+this.cy)*t},sampleCurveDerivativeX:function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},solveCurveX:function(t,e){if(void 0===e&&(e=1e-6),t<0)return 0;if(t>1)return 1;for(var r=t,i=0;i<8;i++){var n=this.sampleCurveX(r)-t;if(Math.abs(n)<e)return r;var o=this.sampleCurveDerivativeX(r);if(Math.abs(o)<1e-6)break;r-=n/o}var a=0,s=1;for(r=t,i=0;i<20&&(n=this.sampleCurveX(r),!(Math.abs(n-t)<e));i++)t>n?a=r:s=r,r=.5*(s-a)+a;return r},solve:function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))}},n}(),s=i(a);let l,c;function h(){return null==l&&(l="undefined"!=typeof OffscreenCanvas&&new OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof createImageBitmap),l}function u(){if(null==c&&(c=!1,h())){const t=5,e=new OffscreenCanvas(t,t).getContext("2d",{willReadFrequently:!0});if(e){for(let r=0;r<t*t;r++){const i=4*r;e.fillStyle=`rgb(${i},${i+1},${i+2})`,e.fillRect(r%t,Math.floor(r/t),1,1)}const r=e.getImageData(0,0,t,t).data;for(let e=0;e<t*t*4;e++)if(e%4!=3&&r[e]!==e){c=!0;break}}}return c||!1}var p=1e-6,d="undefined"!=typeof Float32Array?Float32Array:Array;function f(){var t=new d(9);return d!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t}function m(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function g(){var t=new d(3);return d!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function _(t){var e=t[0],r=t[1],i=t[2];return Math.sqrt(e*e+r*r+i*i)}function y(t,e,r){var i=new d(3);return i[0]=t,i[1]=e,i[2]=r,i}function b(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t}function v(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t}function x(t,e,r){var i=e[0],n=e[1],o=e[2],a=r[0],s=r[1],l=r[2];return t[0]=n*l-o*s,t[1]=o*a-i*l,t[2]=i*s-n*a,t}var w,T=_;function S(t,e,r){var i=e[0],n=e[1],o=e[2],a=e[3];return t[0]=r[0]*i+r[4]*n+r[8]*o+r[12]*a,t[1]=r[1]*i+r[5]*n+r[9]*o+r[13]*a,t[2]=r[2]*i+r[6]*n+r[10]*o+r[14]*a,t[3]=r[3]*i+r[7]*n+r[11]*o+r[15]*a,t}function P(){var t=new d(4);return d!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function C(t,e,r,i){var n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"zyx",o=Math.PI/360;e*=o,i*=o,r*=o;var a=Math.sin(e),s=Math.cos(e),l=Math.sin(r),c=Math.cos(r),h=Math.sin(i),u=Math.cos(i);switch(n){case"xyz":t[0]=a*c*u+s*l*h,t[1]=s*l*u-a*c*h,t[2]=s*c*h+a*l*u,t[3]=s*c*u-a*l*h;break;case"xzy":t[0]=a*c*u-s*l*h,t[1]=s*l*u-a*c*h,t[2]=s*c*h+a*l*u,t[3]=s*c*u+a*l*h;break;case"yxz":t[0]=a*c*u+s*l*h,t[1]=s*l*u-a*c*h,t[2]=s*c*h-a*l*u,t[3]=s*c*u+a*l*h;break;case"yzx":t[0]=a*c*u+s*l*h,t[1]=s*l*u+a*c*h,t[2]=s*c*h-a*l*u,t[3]=s*c*u-a*l*h;break;case"zxy":t[0]=a*c*u-s*l*h,t[1]=s*l*u+a*c*h,t[2]=s*c*h+a*l*u,t[3]=s*c*u-a*l*h;break;case"zyx":t[0]=a*c*u-s*l*h,t[1]=s*l*u+a*c*h,t[2]=s*c*h-a*l*u,t[3]=s*c*u+a*l*h;break;default:throw new Error("Unknown angle order "+n)}return t}function M(){var t=new d(2);return d!=Float32Array&&(t[0]=0,t[1]=0),t}function A(t,e){var r=new d(2);return r[0]=t,r[1]=e,r}g(),w=new d(4),d!=Float32Array&&(w[0]=0,w[1]=0,w[2]=0,w[3]=0),g(),y(1,0,0),y(0,1,0),P(),P(),f(),M();const I=8192;function E(t,e,r){return e*(I/(t.tileSize*Math.pow(2,r-t.tileID.overscaledZ)))}function k(t,e){return(t%e+e)%e}function z(t,e,r){return t*(1-r)+e*r}function R(t){if(t<=0)return 0;if(t>=1)return 1;const e=t*t,r=e*t;return 4*(t<.5?r:3*(t-e)+r-.75)}function D(t,e,r,i){const n=new s(t,e,r,i);return t=>n.solve(t)}const L=D(.25,.1,.25,1);function F(t,e,r){return Math.min(r,Math.max(e,t))}function B(t,e,r){const i=r-e,n=((t-e)%i+i)%i+e;return n===e?r:n}function O(t,...e){for(const r of e)for(const e in r)t[e]=r[e];return t}let j=1;function U(t,e,r){const i={};for(const r in t)i[r]=e.call(this,t[r],r,t);return i}function N(t,e,r){const i={};for(const r in t)e.call(this,t[r],r,t)&&(i[r]=t[r]);return i}function V(t){return Array.isArray(t)?t.map(V):"object"==typeof t&&t?U(t,V):t}const $={};function Z(t){$[t]||("undefined"!=typeof console&&console.warn(t),$[t]=!0)}function G(t,e,r){return(r.y-t.y)*(e.x-t.x)>(e.y-t.y)*(r.x-t.x)}function q(t){return"undefined"!=typeof WorkerGlobalScope&&void 0!==t&&t instanceof WorkerGlobalScope}let H=null;function W(t){return"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap}const X="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function K(t,r,i,n,o){return e(this,void 0,void 0,function*(){if("undefined"==typeof VideoFrame)throw new Error("VideoFrame not supported");const e=new VideoFrame(t,{timestamp:0});try{const a=null==e?void 0:e.format;if(!a||!a.startsWith("BGR")&&!a.startsWith("RGB"))throw new Error(`Unrecognized format ${a}`);const s=a.startsWith("BGR"),l=new Uint8ClampedArray(n*o*4);if(yield e.copyTo(l,function(t,e,r,i,n){const o=4*Math.max(-e,0),a=(Math.max(0,r)-r)*i*4+o,s=4*i,l=Math.max(0,e),c=Math.max(0,r);return{rect:{x:l,y:c,width:Math.min(t.width,e+i)-l,height:Math.min(t.height,r+n)-c},layout:[{offset:a,stride:s}]}}(t,r,i,n,o)),s)for(let t=0;t<l.length;t+=4){const e=l[t];l[t]=l[t+2],l[t+2]=e}return l}finally{e.close()}})}let Y,J;function Q(t,e,r,i){return t.addEventListener(e,r,i),{unsubscribe:()=>{t.removeEventListener(e,r,i)}}}function tt(t){return t*Math.PI/180}function et(t){return t/Math.PI*180}const rt={touchstart:!0,touchmove:!0,touchmoveWindow:!0,touchend:!0,touchcancel:!0},it={dblclick:!0,click:!0,mouseover:!0,mouseout:!0,mousedown:!0,mousemove:!0,mousemoveWindow:!0,mouseup:!0,mouseupWindow:!0,contextmenu:!0,wheel:!0},nt="AbortError";function ot(){return new Error(nt)}const at={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function st(t){return at.REGISTERED_PROTOCOLS[t.substring(0,t.indexOf("://"))]}const lt="global-dispatcher";class ct extends Error{constructor(t,e,r,i){super(`AJAXError: ${e} (${t}): ${r}`),this.status=t,this.statusText=e,this.url=r,this.body=i}}const ht=()=>q(self)?self.worker&&self.worker.referrer:("blob:"===window.location.protocol?window.parent:window).location.href,ut=function(t,r){if(/:\/\//.test(t.url)&&!/^https?:|^file:/.test(t.url)){const e=st(t.url);if(e)return e(t,r);if(q(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:t,targetMapId:lt},r)}if(!(/^file:/.test(i=t.url)||/^file:/.test(ht())&&!/^\w+:/.test(i))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return function(t,r){return e(this,void 0,void 0,function*(){const e=new Request(t.url,{method:t.method||"GET",body:t.body,credentials:t.credentials,headers:t.headers,cache:t.cache,referrer:ht(),signal:r.signal});let i,n;"json"!==t.type||e.headers.has("Accept")||e.headers.set("Accept","application/json");try{i=yield fetch(e)}catch(e){throw new ct(0,e.message,t.url,new Blob)}if(!i.ok){const e=yield i.blob();throw new ct(i.status,i.statusText,t.url,e)}n="arrayBuffer"===t.type||"image"===t.type?i.arrayBuffer():"json"===t.type?i.json():i.text();const o=yield n;if(r.signal.aborted)throw ot();return{data:o,cacheControl:i.headers.get("Cache-Control"),expires:i.headers.get("Expires")}})}(t,r);if(q(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:t,mustQueue:!0,targetMapId:lt},r)}var i;return function(t,e){return new Promise((r,i)=>{var n;const o=new XMLHttpRequest;o.open(t.method||"GET",t.url,!0),"arrayBuffer"!==t.type&&"image"!==t.type||(o.responseType="arraybuffer");for(const e in t.headers)o.setRequestHeader(e,t.headers[e]);"json"===t.type&&(o.responseType="text",(null===(n=t.headers)||void 0===n?void 0:n.Accept)||o.setRequestHeader("Accept","application/json")),o.withCredentials="include"===t.credentials,o.onerror=()=>{i(new Error(o.statusText))},o.onload=()=>{if(!e.signal.aborted)if((o.status>=200&&o.status<300||0===o.status)&&null!==o.response){let e=o.response;if("json"===t.type)try{e=JSON.parse(o.response)}catch(t){return void i(t)}r({data:e,cacheControl:o.getResponseHeader("Cache-Control"),expires:o.getResponseHeader("Expires")})}else{const e=new Blob([o.response],{type:o.getResponseHeader("Content-Type")});i(new ct(o.status,o.statusText,t.url,e))}},e.signal.addEventListener("abort",()=>{o.abort(),i(ot())}),o.send(t.body)})}(t,r)};function pt(t){if(!t||t.indexOf("://")<=0||0===t.indexOf("data:image/")||0===t.indexOf("blob:"))return!0;const e=new URL(t),r=window.location;return e.protocol===r.protocol&&e.host===r.host}function dt(t,e,r){r[t]&&-1!==r[t].indexOf(e)||(r[t]=r[t]||[],r[t].push(e))}function ft(t,e,r){if(r&&r[t]){const i=r[t].indexOf(e);-1!==i&&r[t].splice(i,1)}}class mt{constructor(t,e={}){O(this,e),this.type=t}}class gt extends mt{constructor(t,e={}){super("error",O({error:t},e))}}class _t{on(t,e){return this._listeners=this._listeners||{},dt(t,e,this._listeners),{unsubscribe:()=>{this.off(t,e)}}}off(t,e){return ft(t,e,this._listeners),ft(t,e,this._oneTimeListeners),this}once(t,e){return e?(this._oneTimeListeners=this._oneTimeListeners||{},dt(t,e,this._oneTimeListeners),this):new Promise(e=>this.once(t,e))}fire(t,e){"string"==typeof t&&(t=new mt(t,e||{}));const r=t.type;if(this.listens(r)){t.target=this;const e=this._listeners&&this._listeners[r]?this._listeners[r].slice():[];for(const r of e)r.call(this,t);const i=this._oneTimeListeners&&this._oneTimeListeners[r]?this._oneTimeListeners[r].slice():[];for(const e of i)ft(r,e,this._oneTimeListeners),e.call(this,t);const n=this._eventedParent;n&&(O(t,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),n.fire(t))}else t instanceof gt&&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}}var yt={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},centerAltitude:{type:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},roll:{type:"number",default:0,units:"degrees"},state:{type:"state",default:{}},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},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"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},"color-relief":{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_color-relief","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"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"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_color-relief":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},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:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},light:{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}},sky:{"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},projection:{type:{type:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_color-relief","paint_background"],paint_fill:{"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"}},"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:{"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"}},paint_circle:{"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"}},paint_heatmap:{"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"}},paint_symbol:{"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"}},paint_raster:{"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"}},paint_hillshade:{"hillshade-illumination-direction":{type:"numberArray",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-altitude":{type:"numberArray",default:45,minimum:0,maximum:90,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:"colorArray",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"colorArray",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"},"hillshade-method":{type:"enum",values:{standard:{},basic:{},combined:{},igor:{},multidirectional:{}},default:"standard",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},"paint_color-relief":{"color-relief-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"color-relief-color":{type:"color",transition:!1,expression:{interpolated:!0,parameters:["elevation"]},"property-type":"color-ramp"}},paint_background:{"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"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"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:{"*":{type:"string"}}};const bt=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function vt(t,e){const r={};for(const e in t)"ref"!==e&&(r[e]=t[e]);return bt.forEach(t=>{t in e&&(r[t]=e[t])}),r}function xt(t,e){if(Array.isArray(t)){if(!Array.isArray(e)||t.length!==e.length)return!1;for(let r=0;r<t.length;r++)if(!xt(t[r],e[r]))return!1;return!0}if("object"==typeof t&&null!==t&&null!==e){if("object"!=typeof e)return!1;if(Object.keys(t).length!==Object.keys(e).length)return!1;for(const r in t)if(!xt(t[r],e[r]))return!1;return!0}return t===e}function wt(t,e){t.push(e)}function Tt(t,e,r){wt(r,{command:"addSource",args:[t,e[t]]})}function St(t,e,r){wt(e,{command:"removeSource",args:[t]}),r[t]=!0}function Pt(t,e,r,i){St(t,r,i),Tt(t,e,r)}function Ct(t,e,r){let i;for(i in t[r])if(Object.prototype.hasOwnProperty.call(t[r],i)&&"data"!==i&&!xt(t[r][i],e[r][i]))return!1;for(i in e[r])if(Object.prototype.hasOwnProperty.call(e[r],i)&&"data"!==i&&!xt(t[r][i],e[r][i]))return!1;return!0}function Mt(t,e,r,i,n,o){t=t||{},e=e||{};for(const a in t)Object.prototype.hasOwnProperty.call(t,a)&&(xt(t[a],e[a])||r.push({command:o,args:[i,a,e[a],n]}));for(const a in e)Object.prototype.hasOwnProperty.call(e,a)&&!Object.prototype.hasOwnProperty.call(t,a)&&(xt(t[a],e[a])||r.push({command:o,args:[i,a,e[a],n]}))}function At(t){return t.id}function It(t,e){return t[e.id]=e,t}class Et{constructor(t,e,r,i){this.message=(t?`${t}: `:"")+r,i&&(this.identifier=i),null!=e&&e.__line__&&(this.line=e.__line__)}}function kt(t,...e){for(const r of e)for(const e in r)t[e]=r[e];return t}class zt extends Error{constructor(t,e){super(e),this.message=e,this.key=t}}class Rt{constructor(t,e=[]){this.parent=t,this.bindings={};for(const[t,r]of e)this.bindings[t]=r}concat(t){return new Rt(this,t)}get(t){if(this.bindings[t])return this.bindings[t];if(this.parent)return this.parent.get(t);throw new Error(`${t} not found in scope.`)}has(t){return!!this.bindings[t]||!!this.parent&&this.parent.has(t)}}const Dt={kind:"null"},Lt={kind:"number"},Ft={kind:"string"},Bt={kind:"boolean"},Ot={kind:"color"},jt={kind:"projectionDefinition"},Ut={kind:"object"},Nt={kind:"value"},Vt={kind:"collator"},$t={kind:"formatted"},Zt={kind:"padding"},Gt={kind:"colorArray"},qt={kind:"numberArray"},Ht={kind:"resolvedImage"},Wt={kind:"variableAnchorOffsetCollection"};function Xt(t,e){return{kind:"array",itemType:t,N:e}}function Kt(t){if("array"===t.kind){const e=Kt(t.itemType);return"number"==typeof t.N?`array<${e}, ${t.N}>`:"value"===t.itemType.kind?"array":`array<${e}>`}return t.kind}const Yt=[Dt,Lt,Ft,Bt,Ot,jt,$t,Ut,Xt(Nt),Zt,qt,Gt,Ht,Wt];function Jt(t,e){if("error"===e.kind)return null;if("array"===t.kind){if("array"===e.kind&&(0===e.N&&"value"===e.itemType.kind||!Jt(t.itemType,e.itemType))&&("number"!=typeof t.N||t.N===e.N))return null}else{if(t.kind===e.kind)return null;if("value"===t.kind)for(const t of Yt)if(!Jt(t,e))return null}return`Expected ${Kt(t)} but found ${Kt(e)} instead.`}function Qt(t,e){return e.some(e=>e.kind===t.kind)}function te(t,e){return e.some(e=>"null"===e?null===t:"array"===e?Array.isArray(t):"object"===e?t&&!Array.isArray(t)&&"object"==typeof t:e===typeof t)}function ee(t,e){return"array"===t.kind&&"array"===e.kind?t.itemType.kind===e.itemType.kind&&"number"==typeof t.N:t.kind===e.kind}const re=.96422,ie=.82521,ne=4/29,oe=6/29,ae=3*oe*oe,se=oe*oe*oe,le=Math.PI/180,ce=180/Math.PI;function he(t){return(t%=360)<0&&(t+=360),t}function ue([t,e,r,i]){let n,o;const a=de((.2225045*(t=pe(t))+.7168786*(e=pe(e))+.0606169*(r=pe(r)))/1);t===e&&e===r?n=o=a:(n=de((.4360747*t+.3850649*e+.1430804*r)/re),o=de((.0139322*t+.0971045*e+.7141733*r)/ie));const s=116*a-16;return[s<0?0:s,500*(n-a),200*(a-o),i]}function pe(t){return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function de(t){return t>se?Math.pow(t,1/3):t/ae+ne}function fe([t,e,r,i]){let n=(t+16)/116,o=isNaN(e)?n:n+e/500,a=isNaN(r)?n:n-r/200;return n=1*ge(n),o=re*ge(o),a=ie*ge(a),[me(3.1338561*o-1.6168667*n-.4906146*a),me(-.9787684*o+1.9161415*n+.033454*a),me(.0719453*o-.2289914*n+1.4052427*a),i]}function me(t){return(t=t<=.00304?12.92*t:1.055*Math.pow(t,1/2.4)-.055)<0?0:t>1?1:t}function ge(t){return t>oe?t*t*t:ae*(t-ne)}const _e=Object.hasOwn||function(t,e){return Object.prototype.hasOwnProperty.call(t,e)};function ye(t,e){return _e(t,e)?t[e]:void 0}function be(t){return parseInt(t.padEnd(2,t),16)/255}function ve(t,e){return xe(e?t/100:t,0,1)}function xe(t,e,r){return Math.min(Math.max(e,t),r)}function we(t){return!t.some(Number.isNaN)}const Te={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};function Se(t,e,r){return t+r*(e-t)}function Pe(t,e,r){return t.map((t,i)=>Se(t,e[i],r))}class Ce{constructor(t,e,r,i=1,n=!0){this.r=t,this.g=e,this.b=r,this.a=i,n||(this.r*=i,this.g*=i,this.b*=i,i||this.overwriteGetter("rgb",[t,e,r,i]))}static parse(t){if(t instanceof Ce)return t;if("string"!=typeof t)return;const e=function(t){if("transparent"===(t=t.toLowerCase().trim()))return[0,0,0,0];const e=ye(Te,t);if(e){const[t,r,i]=e;return[t/255,r/255,i/255,1]}if(t.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(t)){const e=t.length<6?1:2;let r=1;return[be(t.slice(r,r+=e)),be(t.slice(r,r+=e)),be(t.slice(r,r+=e)),be(t.slice(r,r+e)||"ff")]}if(t.startsWith("rgb")){const e=t.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(e){const[t,r,i,n,o,a,s,l,c,h,u,p]=e,d=[n||" ",s||" ",h].join("");if(" "===d||" /"===d||",,"===d||",,,"===d){const t=[i,a,c].join(""),e="%%%"===t?100:""===t?255:0;if(e){const t=[xe(+r/e,0,1),xe(+o/e,0,1),xe(+l/e,0,1),u?ve(+u,p):1];if(we(t))return t}}return}}const r=t.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(r){const[t,e,i,n,o,a,s,l,c]=r,h=[i||" ",o||" ",s].join("");if(" "===h||" /"===h||",,"===h||",,,"===h){const t=[+e,xe(+n,0,100),xe(+a,0,100),l?ve(+l,c):1];if(we(t))return function([t,e,r,i]){function n(i){const n=(i+t/30)%12,o=e*Math.min(r,1-r);return r-o*Math.max(-1,Math.min(n-3,9-n,1))}return t=he(t),e/=100,r/=100,[n(0),n(8),n(4),i]}(t)}}}(t);return e?new Ce(...e,!1):void 0}get rgb(){const{r:t,g:e,b:r,a:i}=this,n=i||1/0;return this.overwriteGetter("rgb",[t/n,e/n,r/n,i])}get hcl(){return this.overwriteGetter("hcl",function(t){const[e,r,i,n]=ue(t),o=Math.sqrt(r*r+i*i);return[Math.round(1e4*o)?he(Math.atan2(i,r)*ce):NaN,o,e,n]}(this.rgb))}get lab(){return this.overwriteGetter("lab",ue(this.rgb))}overwriteGetter(t,e){return Object.defineProperty(this,t,{value:e}),e}toString(){const[t,e,r,i]=this.rgb;return`rgba(${[t,e,r].map(t=>Math.round(255*t)).join(",")},${i})`}static interpolate(t,e,r,i="rgb"){switch(i){case"rgb":{const[i,n,o,a]=Pe(t.rgb,e.rgb,r);return new Ce(i,n,o,a,!1)}case"hcl":{const[i,n,o,a]=t.hcl,[s,l,c,h]=e.hcl;let u,p;if(isNaN(i)||isNaN(s))isNaN(i)?isNaN(s)?u=NaN:(u=s,1!==o&&0!==o||(p=l)):(u=i,1!==c&&0!==c||(p=n));else{let t=s-i;s>i&&t>180?t-=360:s<i&&i-s>180&&(t+=360),u=i+r*t}const[d,f,m,g]=function([t,e,r,i]){return t=isNaN(t)?0:t*le,fe([r,Math.cos(t)*e,Math.sin(t)*e,i])}([u,null!=p?p:Se(n,l,r),Se(o,c,r),Se(a,h,r)]);return new Ce(d,f,m,g,!1)}case"lab":{const[i,n,o,a]=fe(Pe(t.lab,e.lab,r));return new Ce(i,n,o,a,!1)}}}}Ce.black=new Ce(0,0,0,1),Ce.white=new Ce(1,1,1,1),Ce.transparent=new Ce(0,0,0,0),Ce.red=new Ce(1,0,0,1);class Me{constructor(t,e,r){this.sensitivity=t?e?"variant":"case":e?"accent":"base",this.locale=r,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(t,e){return this.collator.compare(t,e)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}const Ae=["bottom","center","top"];class Ie{constructor(t,e,r,i,n,o){this.text=t,this.image=e,this.scale=r,this.fontStack=i,this.textColor=n,this.verticalAlign=o}}class Ee{constructor(t){this.sections=t}static fromString(t){return new Ee([new Ie(t,null,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some(t=>0!==t.text.length||t.image&&0!==t.image.name.length)}static factory(t){return t instanceof Ee?t:Ee.fromString(t)}toString(){return 0===this.sections.length?"":this.sections.map(t=>t.text).join("")}}class ke{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof ke)return t;if("number"==typeof t)return new ke([t,t,t,t]);if(Array.isArray(t)&&!(t.length<1||t.length>4)){for(const e of t)if("number"!=typeof e)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]]}return new ke(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,e,r){return new ke(Pe(t.values,e.values,r))}}class ze{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof ze)return t;if("number"==typeof t)return new ze([t]);if(Array.isArray(t)){for(const e of t)if("number"!=typeof e)return;return new ze(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,e,r){return new ze(Pe(t.values,e.values,r))}}class Re{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof Re)return t;if("string"==typeof t){const e=Ce.parse(t);if(!e)return;return new Re([e])}if(!Array.isArray(t))return;const e=[];for(const r of t){if("string"!=typeof r)return;const t=Ce.parse(r);if(!t)return;e.push(t)}return new Re(e)}toString(){return JSON.stringify(this.values)}static interpolate(t,e,r,i="rgb"){const n=[];if(t.values.length!=e.values.length)throw new Error(`colorArray: Arrays have mismatched length (${t.values.length} vs. ${e.values.length}), cannot interpolate.`);for(let o=0;o<t.values.length;o++)n.push(Ce.interpolate(t.values[o],e.values[o],r,i));return new Re(n)}}class De extends Error{constructor(t){super(t),this.name="RuntimeError"}toJSON(){return this.message}}const Le=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class Fe{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof Fe)return t;if(Array.isArray(t)&&!(t.length<1)&&t.length%2==0){for(let e=0;e<t.length;e+=2){const r=t[e],i=t[e+1];if("string"!=typeof r||!Le.has(r))return;if(!Array.isArray(i)||2!==i.length||"number"!=typeof i[0]||"number"!=typeof i[1])return}return new Fe(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,e,r){const i=t.values,n=e.values;if(i.length!==n.length)throw new De(`Cannot interpolate values of different length. from: ${t.toString()}, to: ${e.toString()}`);const o=[];for(let t=0;t<i.length;t+=2){if(i[t]!==n[t])throw new De(`Cannot interpolate values containing mismatched anchors. from[${t}]: ${i[t]}, to[${t}]: ${n[t]}`);o.push(i[t]);const[e,a]=i[t+1],[s,l]=n[t+1];o.push([Se(e,s,r),Se(a,l,r)])}return new Fe(o)}}class Be{constructor(t){this.name=t.name,this.available=t.available}toString(){return this.name}static fromString(t){return t?new Be({name:t,available:!1}):null}}class Oe{constructor(t,e,r){this.from=t,this.to=e,this.transition=r}static interpolate(t,e,r){return new Oe(t,e,r)}static parse(t){return t instanceof Oe?t:Array.isArray(t)&&3===t.length&&"string"==typeof t[0]&&"string"==typeof t[1]&&"number"==typeof t[2]?new Oe(t[0],t[1],t[2]):"object"==typeof t&&"string"==typeof t.from&&"string"==typeof t.to&&"number"==typeof t.transition?new Oe(t.from,t.to,t.transition):"string"==typeof t?new Oe(t,t,1):void 0}}function je(t,e,r,i){return"number"==typeof t&&t>=0&&t<=255&&"number"==typeof e&&e>=0&&e<=255&&"number"==typeof r&&r>=0&&r<=255?void 0===i||"number"==typeof i&&i>=0&&i<=1?null:`Invalid rgba value [${[t,e,r,i].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${("number"==typeof i?[t,e,r,i]:[t,e,r]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Ue(t){if(null===t||"string"==typeof t||"boolean"==typeof t||"number"==typeof t||t instanceof Oe||t instanceof Ce||t instanceof Me||t instanceof Ee||t instanceof ke||t instanceof ze||t instanceof Re||t instanceof Fe||t instanceof Be)return!0;if(Array.isArray(t)){for(const e of t)if(!Ue(e))return!1;return!0}if("object"==typeof t){for(const e in t)if(!Ue(t[e]))return!1;return!0}return!1}function Ne(t){if(null===t)return Dt;if("string"==typeof t)return Ft;if("boolean"==typeof t)return Bt;if("number"==typeof t)return Lt;if(t instanceof Ce)return Ot;if(t instanceof Oe)return jt;if(t instanceof Me)return Vt;if(t instanceof Ee)return $t;if(t instanceof ke)return Zt;if(t instanceof ze)return qt;if(t instanceof Re)return Gt;if(t instanceof Fe)return Wt;if(t instanceof Be)return Ht;if(Array.isArray(t)){const e=t.length;let r;for(const e of t){const t=Ne(e);if(r){if(r===t)continue;r=Nt;break}r=t}return Xt(r||Nt,e)}return Ut}function Ve(t){const e=typeof t;return null===t?"":"string"===e||"number"===e||"boolean"===e?String(t):t instanceof Ce||t instanceof Oe||t instanceof Ee||t instanceof ke||t instanceof ze||t instanceof Re||t instanceof Fe||t instanceof Be?t.toString():JSON.stringify(t)}class $e{constructor(t,e){this.type=t,this.value=e}static parse(t,e){if(2!==t.length)return e.error(`'literal' expression requires exactly one argument, but found ${t.length-1} instead.`);if(!Ue(t[1]))return e.error("invalid value");const r=t[1];let i=Ne(r);const n=e.expectedType;return"array"!==i.kind||0!==i.N||!n||"array"!==n.kind||"number"==typeof n.N&&0!==n.N||(i=n),new $e(i,r)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}const Ze={string:Ft,number:Lt,boolean:Bt,object:Ut};class Ge{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");let r,i=1;const n=t[0];if("array"===n){let n,o;if(t.length>2){const r=t[1];if("string"!=typeof r||!(r in Ze)||"object"===r)return e.error('The item type argument of "array" must be one of string, number, boolean',1);n=Ze[r],i++}else n=Nt;if(t.length>3){if(null!==t[2]&&("number"!=typeof t[2]||t[2]<0||t[2]!==Math.floor(t[2])))return e.error('The length argument to "array" must be a positive integer literal',2);o=t[2],i++}r=Xt(n,o)}else{if(!Ze[n])throw new Error(`Types doesn't contain name = ${n}`);r=Ze[n]}const o=[];for(;i<t.length;i++){const r=e.parse(t[i],i,Nt);if(!r)return null;o.push(r)}return new Ge(r,o)}evaluate(t){for(let e=0;e<this.args.length;e++){const r=this.args[e].evaluate(t);if(!Jt(this.type,Ne(r)))return r;if(e===this.args.length-1)throw new De(`Expected value to be of type ${Kt(this.type)}, but found ${Kt(Ne(r))} instead.`)}throw new Error}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}const qe={"to-boolean":Bt,"to-color":Ot,"to-number":Lt,"to-string":Ft};class He{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");const r=t[0];if(!qe[r])throw new Error(`Can't parse ${r} as it is not part of the known types`);if(("to-boolean"===r||"to-string"===r)&&2!==t.length)return e.error("Expected one argument.");const i=qe[r],n=[];for(let r=1;r<t.length;r++){const i=e.parse(t[r],r,Nt);if(!i)return null;n.push(i)}return new He(i,n)}evaluate(t){switch(this.type.kind){case"boolean":return Boolean(this.args[0].evaluate(t));case"color":{let e,r;for(const i of this.args){if(e=i.evaluate(t),r=null,e instanceof Ce)return e;if("string"==typeof e){const r=t.parseColor(e);if(r)return r}else if(Array.isArray(e)&&(r=e.length<3||e.length>4?`Invalid rgba value ${JSON.stringify(e)}: expected an array containing either three or four numeric values.`:je(e[0],e[1],e[2],e[3]),!r))return new Ce(e[0]/255,e[1]/255,e[2]/255,e[3])}throw new De(r||`Could not parse color from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}case"padding":{let e;for(const r of this.args){e=r.evaluate(t);const i=ke.parse(e);if(i)return i}throw new De(`Could not parse padding from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}case"numberArray":{let e;for(const r of this.args){e=r.evaluate(t);const i=ze.parse(e);if(i)return i}throw new De(`Could not parse numberArray from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}case"colorArray":{let e;for(const r of this.args){e=r.evaluate(t);const i=Re.parse(e);if(i)return i}throw new De(`Could not parse colorArray from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}case"variableAnchorOffsetCollection":{let e;for(const r of this.args){e=r.evaluate(t);const i=Fe.parse(e);if(i)return i}throw new De(`Could not parse variableAnchorOffsetCollection from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}case"number":{let e=null;for(const r of this.args){if(e=r.evaluate(t),null===e)return 0;const i=Number(e);if(!isNaN(i))return i}throw new De(`Could not convert ${JSON.stringify(e)} to number.`)}case"formatted":return Ee.fromString(Ve(this.args[0].evaluate(t)));case"resolvedImage":return Be.fromString(Ve(this.args[0].evaluate(t)));case"projectionDefinition":return this.args[0].evaluate(t);default:return Ve(this.args[0].evaluate(t))}}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}const We=["Unknown","Point","LineString","Polygon"];class Xe{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache=new Map,this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?"number"==typeof this.feature.type?We[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 e=this._parseColorCache.get(t);return e||(e=Ce.parse(t),this._parseColorCache.set(t,e)),e}}class Ke{constructor(t,e,r=[],i,n=new Rt,o=[]){this.registry=t,this.path=r,this.key=r.map(t=>`[${t}]`).join(""),this.scope=n,this.errors=o,this.expectedType=i,this._isConstant=e}parse(t,e,r,i,n={}){return e?this.concat(e,r,i)._parse(t,n):this._parse(t,n)}_parse(t,e){function r(t,e,r){return"assert"===r?new Ge(e,[t]):"coerce"===r?new He(e,[t]):t}if(null!==t&&"string"!=typeof t&&"boolean"!=typeof t&&"number"!=typeof t||(t=["literal",t]),Array.isArray(t)){if(0===t.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const i=t[0];if("string"!=typeof i)return this.error(`Expression name must be a string, but found ${typeof i} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const n=this.registry[i];if(n){let i=n.parse(t,this);if(!i)return null;if(this.expectedType){const t=this.expectedType,n=i.type;if("string"!==t.kind&&"number"!==t.kind&&"boolean"!==t.kind&&"object"!==t.kind&&"array"!==t.kind||"value"!==n.kind){if("projectionDefinition"===t.kind&&["string","array"].includes(n.kind)||["color","formatted","resolvedImage"].includes(t.kind)&&["value","string"].includes(n.kind)||["padding","numberArray"].includes(t.kind)&&["value","number","array"].includes(n.kind)||"colorArray"===t.kind&&["value","string","array"].includes(n.kind)||"variableAnchorOffsetCollection"===t.kind&&["value","array"].includes(n.kind))i=r(i,t,e.typeAnnotation||"coerce");else if(this.checkSubtype(t,n))return null}else i=r(i,t,e.typeAnnotation||"assert")}if(!(i instanceof $e)&&"resolvedImage"!==i.type.kind&&this._isConstant(i)){const e=new Xe;try{i=new $e(i.type,i.evaluate(e))}catch(t){return this.error(t.message),null}}return i}return this.error(`Unknown expression "${i}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(void 0===t?"'undefined' value invalid. Use null instead.":"object"==typeof t?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof t} instead.`)}concat(t,e,r){const i="number"==typeof t?this.path.concat(t):this.path,n=r?this.scope.concat(r):this.scope;return new Ke(this.registry,this._isConstant,i,e||null,n,this.errors)}error(t,...e){const r=`${this.key}${e.map(t=>`[${t}]`).join("")}`;this.errors.push(new zt(r,t))}checkSubtype(t,e){const r=Jt(t,e);return r&&this.error(r),r}}class Ye{constructor(t,e){this.type=e.type,this.bindings=[].concat(t),this.result=e}evaluate(t){return this.result.evaluate(t)}eachChild(t){for(const e of this.bindings)t(e[1]);t(this.result)}static parse(t,e){if(t.length<4)return e.error(`Expected at least 3 arguments, but found ${t.length-1} instead.`);const r=[];for(let i=1;i<t.length-1;i+=2){const n=t[i];if("string"!=typeof n)return e.error(`Expected string, but found ${typeof n} instead.`,i);if(/[^a-zA-Z0-9_]/.test(n))return e.error("Variable names must contain only alphanumeric characters or '_'.",i);const o=e.parse(t[i+1],i+1);if(!o)return null;r.push([n,o])}const i=e.parse(t[t.length-1],t.length-1,e.expectedType,r);return i?new Ye(r,i):null}outputDefined(){return this.result.outputDefined()}}class Je{constructor(t,e){this.type=e.type,this.name=t,this.boundExpression=e}static parse(t,e){if(2!==t.length||"string"!=typeof t[1])return e.error("'var' expression requires exactly one string literal argument.");const r=t[1];return e.scope.has(r)?new Je(r,e.scope.get(r)):e.error(`Unknown variable "${r}". Make sure "${r}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(t){return this.boundExpression.evaluate(t)}eachChild(){}outputDefined(){return!1}}class Qe{constructor(t,e,r){this.type=t,this.index=e,this.input=r}static parse(t,e){if(3!==t.length)return e.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const r=e.parse(t[1],1,Lt),i=e.parse(t[2],2,Xt(e.expectedType||Nt));return r&&i?new Qe(i.type.itemType,r,i):null}evaluate(t){const e=this.index.evaluate(t),r=this.input.evaluate(t);if(e<0)throw new De(`Array index out of bounds: ${e} < 0.`);if(e>=r.length)throw new De(`Array index out of bounds: ${e} > ${r.length-1}.`);if(e!==Math.floor(e))throw new De(`Array index must be an integer, but found ${e} instead.`);return r[e]}eachChild(t){t(this.index),t(this.input)}outputDefined(){return!1}}class tr{constructor(t,e){this.type=Bt,this.needle=t,this.haystack=e}static parse(t,e){if(3!==t.length)return e.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const r=e.parse(t[1],1,Nt),i=e.parse(t[2],2,Nt);return r&&i?Qt(r.type,[Bt,Ft,Lt,Dt,Nt])?new tr(r,i):e.error(`Expected first argument to be of type boolean, string, number or null, but found ${Kt(r.type)} instead`):null}evaluate(t){const e=this.needle.evaluate(t),r=this.haystack.evaluate(t);if(!r)return!1;if(!te(e,["boolean","string","number","null"]))throw new De(`Expected first argument to be of type boolean, string, number or null, but found ${Kt(Ne(e))} instead.`);if(!te(r,["string","array"]))throw new De(`Expected second argument to be of type array or string, but found ${Kt(Ne(r))} instead.`);return r.indexOf(e)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}}class er{constructor(t,e,r){this.type=Lt,this.needle=t,this.haystack=e,this.fromIndex=r}static parse(t,e){if(t.length<=2||t.length>=5)return e.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const r=e.parse(t[1],1,Nt),i=e.parse(t[2],2,Nt);if(!r||!i)return null;if(!Qt(r.type,[Bt,Ft,Lt,Dt,Nt]))return e.error(`Expected first argument to be of type boolean, string, number or null, but found ${Kt(r.type)} instead`);if(4===t.length){const n=e.parse(t[3],3,Lt);return n?new er(r,i,n):null}return new er(r,i)}evaluate(t){const e=this.needle.evaluate(t),r=this.haystack.evaluate(t);if(!te(e,["boolean","string","number","null"]))throw new De(`Expected first argument to be of type boolean, string, number or null, but found ${Kt(Ne(e))} instead.`);let i;if(this.fromIndex&&(i=this.fromIndex.evaluate(t)),te(r,["string"])){const t=r.indexOf(e,i);return-1===t?-1:[...r.slice(0,t)].length}if(te(r,["array"]))return r.indexOf(e,i);throw new De(`Expected second argument to be of type array or string, but found ${Kt(Ne(r))} instead.`)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}}class rr{constructor(t,e,r,i,n,o){this.inputType=t,this.type=e,this.input=r,this.cases=i,this.outputs=n,this.otherwise=o}static parse(t,e){if(t.length<5)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if(t.length%2!=1)return e.error("Expected an even number of arguments.");let r,i;e.expectedType&&"value"!==e.expectedType.kind&&(i=e.expectedType);const n={},o=[];for(let a=2;a<t.length-1;a+=2){let s=t[a];const l=t[a+1];Array.isArray(s)||(s=[s]);const c=e.concat(a);if(0===s.length)return c.error("Expected at least one branch label.");for(const t of s){if("number"!=typeof t&&"string"!=typeof t)return c.error("Branch labels must be numbers or strings.");if("number"==typeof t&&Math.abs(t)>Number.MAX_SAFE_INTEGER)return c.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if("number"==typeof t&&Math.floor(t)!==t)return c.error("Numeric branch labels must be integer values.");if(r){if(c.checkSubtype(r,Ne(t)))return null}else r=Ne(t);if(void 0!==n[String(t)])return c.error("Branch labels must be unique.");n[String(t)]=o.length}const h=e.parse(l,a,i);if(!h)return null;i=i||h.type,o.push(h)}const a=e.parse(t[1],1,Nt);if(!a)return null;const s=e.parse(t[t.length-1],t.length-1,i);return s?"value"!==a.type.kind&&e.concat(1).checkSubtype(r,a.type)?null:new rr(r,i,a,n,o,s):null}evaluate(t){const e=this.input.evaluate(t);return(Ne(e)===this.inputType&&this.outputs[this.cases[e]]||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()}}class ir{constructor(t,e,r){this.type=t,this.branches=e,this.otherwise=r}static parse(t,e){if(t.length<4)return e.error(`Expected at least 3 arguments, but found only ${t.length-1}.`);if(t.length%2!=0)return e.error("Expected an odd number of arguments.");let r;e.expectedType&&"value"!==e.expectedType.kind&&(r=e.expectedType);const i=[];for(let n=1;n<t.length-1;n+=2){const o=e.parse(t[n],n,Bt);if(!o)return null;const a=e.parse(t[n+1],n+1,r);if(!a)return null;i.push([o,a]),r=r||a.type}const n=e.parse(t[t.length-1],t.length-1,r);if(!n)return null;if(!r)throw new Error("Can't infer output type");return new ir(r,i,n)}evaluate(t){for(const[e,r]of this.branches)if(e.evaluate(t))return r.evaluate(t);return this.otherwise.evaluate(t)}eachChild(t){for(const[e,r]of this.branches)t(e),t(r);t(this.otherwise)}outputDefined(){return this.branches.every(([t,e])=>e.outputDefined())&&this.otherwise.outputDefined()}}class nr{constructor(t,e,r,i){this.type=t,this.input=e,this.beginIndex=r,this.endIndex=i}static parse(t,e){if(t.length<=2||t.length>=5)return e.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const r=e.parse(t[1],1,Nt),i=e.parse(t[2],2,Lt);if(!r||!i)return null;if(!Qt(r.type,[Xt(Nt),Ft,Nt]))return e.error(`Expected first argument to be of type array or string, but found ${Kt(r.type)} instead`);if(4===t.length){const n=e.parse(t[3],3,Lt);return n?new nr(r.type,r,i,n):null}return new nr(r.type,r,i)}evaluate(t){const e=this.input.evaluate(t),r=this.beginIndex.evaluate(t);let i;if(this.endIndex&&(i=this.endIndex.evaluate(t)),te(e,["string"]))return[...e].slice(r,i).join("");if(te(e,["array"]))return e.slice(r,i);throw new De(`Expected first argument to be of type array or string, but found ${Kt(Ne(e))} instead.`)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}}function or(t,e){const r=t.length-1;let i,n,o=0,a=r,s=0;for(;o<=a;)if(s=Math.floor((o+a)/2),i=t[s],n=t[s+1],i<=e){if(s===r||e<n)return s;o=s+1}else{if(!(i>e))throw new De("Input is not a number.");a=s-1}return 0}class ar{constructor(t,e,r){this.type=t,this.input=e,this.labels=[],this.outputs=[];for(const[t,e]of r)this.labels.push(t),this.outputs.push(e)}static parse(t,e){if(t.length-1<4)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");const r=e.parse(t[1],1,Lt);if(!r)return null;const i=[];let n=null;e.expectedType&&"value"!==e.expectedType.kind&&(n=e.expectedType);for(let r=1;r<t.length;r+=2){const o=1===r?-1/0:t[r],a=t[r+1],s=r,l=r+1;if("number"!=typeof o)return e.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',s);if(i.length&&i[i.length-1][0]>=o)return e.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',s);const c=e.parse(a,l,n);if(!c)return null;n=n||c.type,i.push([o,c])}return new ar(n,r,i)}evaluate(t){const e=this.labels,r=this.outputs;if(1===e.length)return r[0].evaluate(t);const i=this.input.evaluate(t);if(i<=e[0])return r[0].evaluate(t);const n=e.length;return i>=e[n-1]?r[n-1].evaluate(t):r[or(e,i)].evaluate(t)}eachChild(t){t(this.input);for(const e of this.outputs)t(e)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}}var sr,lr,cr=function(){if(lr)return sr;function t(t,e,r,i){this.cx=3*t,this.bx=3*(r-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(i-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=e,this.p2x=r,this.p2y=i}return lr=1,sr=t,t.prototype={sampleCurveX:function(t){return((this.ax*t+this.bx)*t+this.cx)*t},sampleCurveY:function(t){return((this.ay*t+this.by)*t+this.cy)*t},sampleCurveDerivativeX:function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},solveCurveX:function(t,e){if(void 0===e&&(e=1e-6),t<0)return 0;if(t>1)return 1;for(var r=t,i=0;i<8;i++){var n=this.sampleCurveX(r)-t;if(Math.abs(n)<e)return r;var o=this.sampleCurveDerivativeX(r);if(Math.abs(o)<1e-6)break;r-=n/o}var a=0,s=1;for(r=t,i=0;i<20&&(n=this.sampleCurveX(r),!(Math.abs(n-t)<e));i++)t>n?a=r:s=r,r=.5*(s-a)+a;return r},solve:function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))}},sr}(),hr=function(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}(cr);class ur{constructor(t,e,r,i,n){this.type=t,this.operator=e,this.interpolation=r,this.input=i,this.labels=[],this.outputs=[];for(const[t,e]of n)this.labels.push(t),this.outputs.push(e)}static interpolationFactor(t,e,r,i){let n=0;if("exponential"===t.name)n=pr(e,t.base,r,i);else if("linear"===t.name)n=pr(e,1,r,i);else if("cubic-bezier"===t.name){const o=t.controlPoints;n=new hr(o[0],o[1],o[2],o[3]).solve(pr(e,1,r,i))}return n}static parse(t,e){let[r,i,n,...o]=t;if(!Array.isArray(i)||0===i.length)return e.error("Expected an interpolation type expression.",1);if("linear"===i[0])i={name:"linear"};else if("exponential"===i[0]){const t=i[1];if("number"!=typeof t)return e.error("Exponential interpolation requires a numeric base.",1,1);i={name:"exponential",base:t}}else{if("cubic-bezier"!==i[0])return e.error(`Unknown interpolation type ${String(i[0])}`,1,0);{const t=i.slice(1);if(4!==t.length||t.some(t=>"number"!=typeof t||t<0||t>1))return e.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);i={name:"cubic-bezier",controlPoints:t}}}if(t.length-1<4)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");if(n=e.parse(n,2,Lt),!n)return null;const a=[];let s=null;"interpolate-hcl"!==r&&"interpolate-lab"!==r||e.expectedType==Gt?e.expectedType&&"value"!==e.expectedType.kind&&(s=e.expectedType):s=Ot;for(let t=0;t<o.length;t+=2){const r=o[t],i=o[t+1],n=t+3,l=t+4;if("number"!=typeof r)return e.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',n);if(a.length&&a[a.length-1][0]>=r)return e.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',n);const c=e.parse(i,l,s);if(!c)return null;s=s||c.type,a.push([r,c])}return ee(s,Lt)||ee(s,jt)||ee(s,Ot)||ee(s,Zt)||ee(s,qt)||ee(s,Gt)||ee(s,Wt)||ee(s,Xt(Lt))?new ur(s,r,i,n,a):e.error(`Type ${Kt(s)} is not interpolatable.`)}evaluate(t){const e=this.labels,r=this.outputs;if(1===e.length)return r[0].evaluate(t);const i=this.input.evaluate(t);if(i<=e[0])return r[0].evaluate(t);const n=e.length;if(i>=e[n-1])return r[n-1].evaluate(t);const o=or(e,i),a=ur.interpolationFactor(this.interpolation,i,e[o],e[o+1]),s=r[o].evaluate(t),l=r[o+1].evaluate(t);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return Se(s,l,a);case"color":return Ce.interpolate(s,l,a);case"padding":return ke.interpolate(s,l,a);case"colorArray":return Re.interpolate(s,l,a);case"numberArray":return ze.interpolate(s,l,a);case"variableAnchorOffsetCollection":return Fe.interpolate(s,l,a);case"array":return Pe(s,l,a);case"projectionDefinition":return Oe.interpolate(s,l,a)}case"interpolate-hcl":switch(this.type.kind){case"color":return Ce.interpolate(s,l,a,"hcl");case"colorArray":return Re.interpolate(s,l,a,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return Ce.interpolate(s,l,a,"lab");case"colorArray":return Re.interpolate(s,l,a,"lab")}}}eachChild(t){t(this.input);for(const e of this.outputs)t(e)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}}function pr(t,e,r,i){const n=i-r,o=t-r;return 0===n?0:1===e?o/n:(Math.pow(e,o)-1)/(Math.pow(e,n)-1)}const dr={color:Ce.interpolate,number:Se,padding:ke.interpolate,numberArray:ze.interpolate,colorArray:Re.interpolate,variableAnchorOffsetCollection:Fe.interpolate,array:Pe};class fr{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");let r=null;const i=e.expectedType;i&&"value"!==i.kind&&(r=i);const n=[];for(const i of t.slice(1)){const t=e.parse(i,1+n.length,r,void 0,{typeAnnotation:"omit"});if(!t)return null;r=r||t.type,n.push(t)}if(!r)throw new Error("No output type");const o=i&&n.some(t=>Jt(i,t.type));return new fr(o?Nt:r,n)}evaluate(t){let e,r=null,i=0;for(const n of this.args)if(i++,r=n.evaluate(t),r&&r instanceof Be&&!r.available&&(e||(e=r.name),r=null,i===this.args.length&&(r=e)),null!==r)break;return r}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}function mr(t,e){return"=="===t||"!="===t?"boolean"===e.kind||"string"===e.kind||"number"===e.kind||"null"===e.kind||"value"===e.kind:"string"===e.kind||"number"===e.kind||"value"===e.kind}function gr(t,e,r,i){return 0===i.compare(e,r)}function _r(t,e,r){const i="=="!==t&&"!="!==t;return class n{constructor(t,e,r){this.type=Bt,this.lhs=t,this.rhs=e,this.collator=r,this.hasUntypedArgument="value"===t.type.kind||"value"===e.type.kind}static parse(t,e){if(3!==t.length&&4!==t.length)return e.error("Expected two or three arguments.");const r=t[0];let o=e.parse(t[1],1,Nt);if(!o)return null;if(!mr(r,o.type))return e.concat(1).error(`"${r}" comparisons are not supported for type '${Kt(o.type)}'.`);let a=e.parse(t[2],2,Nt);if(!a)return null;if(!mr(r,a.type))return e.concat(2).error(`"${r}" comparisons are not supported for type '${Kt(a.type)}'.`);if(o.type.kind!==a.type.kind&&"value"!==o.type.kind&&"value"!==a.type.kind)return e.error(`Cannot compare types '${Kt(o.type)}' and '${Kt(a.type)}'.`);i&&("value"===o.type.kind&&"value"!==a.type.kind?o=new Ge(a.type,[o]):"value"!==o.type.kind&&"value"===a.type.kind&&(a=new Ge(o.type,[a])));let s=null;if(4===t.length){if("string"!==o.type.kind&&"string"!==a.type.kind&&"value"!==o.type.kind&&"value"!==a.type.kind)return e.error("Cannot use collator to compare non-string types.");if(s=e.parse(t[3],3,Vt),!s)return null}return new n(o,a,s)}evaluate(n){const o=this.lhs.evaluate(n),a=this.rhs.evaluate(n);if(i&&this.hasUntypedArgument){const e=Ne(o),r=Ne(a);if(e.kind!==r.kind||"string"!==e.kind&&"number"!==e.kind)throw new De(`Expected arguments for "${t}" to be (string, string) or (number, number), but found (${e.kind}, ${r.kind}) instead.`)}if(this.collator&&!i&&this.hasUntypedArgument){const t=Ne(o),r=Ne(a);if("string"!==t.kind||"string"!==r.kind)return e(n,o,a)}return this.collator?r(n,o,a,this.collator.evaluate(n)):e(n,o,a)}eachChild(t){t(this.lhs),t(this.rhs),this.collator&&t(this.collator)}outputDefined(){return!0}}}const yr=_r("==",function(t,e,r){return e===r},gr),br=_r("!=",function(t,e,r){return e!==r},function(t,e,r,i){return!gr(0,e,r,i)}),vr=_r("<",function(t,e,r){return e<r},function(t,e,r,i){return i.compare(e,r)<0}),xr=_r(">",function(t,e,r){return e>r},function(t,e,r,i){return i.compare(e,r)>0}),wr=_r("<=",function(t,e,r){return e<=r},function(t,e,r,i){return i.compare(e,r)<=0}),Tr=_r(">=",function(t,e,r){return e>=r},function(t,e,r,i){return i.compare(e,r)>=0});class Sr{constructor(t,e,r){this.type=Vt,this.locale=r,this.caseSensitive=t,this.diacriticSensitive=e}static parse(t,e){if(2!==t.length)return e.error("Expected one argument.");const r=t[1];if("object"!=typeof r||Array.isArray(r))return e.error("Collator options argument must be an object.");const i=e.parse(void 0!==r["case-sensitive"]&&r["case-sensitive"],1,Bt);if(!i)return null;const n=e.parse(void 0!==r["diacritic-sensitive"]&&r["diacritic-sensitive"],1,Bt);if(!n)return null;let o=null;return r.locale&&(o=e.parse(r.locale,1,Ft),!o)?null:new Sr(i,n,o)}evaluate(t){return new Me(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}}class Pr{constructor(t,e,r,i,n){this.type=Ft,this.number=t,this.locale=e,this.currency=r,this.minFractionDigits=i,this.maxFractionDigits=n}static parse(t,e){if(3!==t.length)return e.error("Expected two arguments.");const r=e.parse(t[1],1,Lt);if(!r)return null;const i=t[2];if("object"!=typeof i||Array.isArray(i))return e.error("NumberFormat options argument must be an object.");let n=null;if(i.locale&&(n=e.parse(i.locale,1,Ft),!n))return null;let o=null;if(i.currency&&(o=e.parse(i.currency,1,Ft),!o))return null;let a=null;if(i["min-fraction-digits"]&&(a=e.parse(i["min-fraction-digits"],1,Lt),!a))return null;let s=null;return i["max-fraction-digits"]&&(s=e.parse(i["max-fraction-digits"],1,Lt),!s)?null:new Pr(r,n,o,a,s)}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}}class Cr{constructor(t){this.type=$t,this.sections=t}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");const r=t[1];if(!Array.isArray(r)&&"object"==typeof r)return e.error("First argument must be an image or text section.");const i=[];let n=!1;for(let r=1;r<=t.length-1;++r){const o=t[r];if(n&&"object"==typeof o&&!Array.isArray(o)){n=!1;let t=null;if(o["font-scale"]&&(t=e.parse(o["font-scale"],1,Lt),!t))return null;let r=null;if(o["text-font"]&&(r=e.parse(o["text-font"],1,Xt(Ft)),!r))return null;let a=null;if(o["text-color"]&&(a=e.parse(o["text-color"],1,Ot),!a))return null;let s=null;if(o["vertical-align"]){if("string"==typeof o["vertical-align"]&&!Ae.includes(o["vertical-align"]))return e.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${o["vertical-align"]}' instead.`);if(s=e.parse(o["vertical-align"],1,Ft),!s)return null}const l=i[i.length-1];l.scale=t,l.font=r,l.textColor=a,l.verticalAlign=s}else{const o=e.parse(t[r],1,Nt);if(!o)return null;const a=o.type.kind;if("string"!==a&&"value"!==a&&"null"!==a&&"resolvedImage"!==a)return e.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");n=!0,i.push({content:o,scale:null,font:null,textColor:null,verticalAlign:null})}}return new Cr(i)}evaluate(t){return new Ee(this.sections.map(e=>{const r=e.content.evaluate(t);return Ne(r)===Ht?new Ie("",r,null,null,null,e.verticalAlign?e.verticalAlign.evaluate(t):null):new Ie(Ve(r),null,e.scale?e.scale.evaluate(t):null,e.font?e.font.evaluate(t).join(","):null,e.textColor?e.textColor.evaluate(t):null,e.verticalAlign?e.verticalAlign.evaluate(t):null)}))}eachChild(t){for(const e of this.sections)t(e.content),e.scale&&t(e.scale),e.font&&t(e.font),e.textColor&&t(e.textColor),e.verticalAlign&&t(e.verticalAlign)}outputDefined(){return!1}}class Mr{constructor(t){this.type=Ht,this.input=t}static parse(t,e){if(2!==t.length)return e.error("Expected two arguments.");const r=e.parse(t[1],1,Ft);return r?new Mr(r):e.error("No image name provided.")}evaluate(t){const e=this.input.evaluate(t),r=Be.fromString(e);return r&&t.availableImages&&(r.available=t.availableImages.indexOf(e)>-1),r}eachChild(t){t(this.input)}outputDefined(){return!1}}class Ar{constructor(t){this.type=Lt,this.input=t}static parse(t,e){if(2!==t.length)return e.error(`Expected 1 argument, but found ${t.length-1} instead.`);const r=e.parse(t[1],1);return r?"array"!==r.type.kind&&"string"!==r.type.kind&&"value"!==r.type.kind?e.error(`Expected argument of type string or array, but found ${Kt(r.type)} instead.`):new Ar(r):null}evaluate(t){const e=this.input.evaluate(t);if("string"==typeof e)return[...e].length;if(Array.isArray(e))return e.length;throw new De(`Expected value to be of type string or array, but found ${Kt(Ne(e))} instead.`)}eachChild(t){t(this.input)}outputDefined(){return!1}}const Ir=8192;function Er(t,e){const r=(180+t[0])/360,i=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t[1]*Math.PI/360)))/360,n=Math.pow(2,e.z);return[Math.round(r*n*Ir),Math.round(i*n*Ir)]}function kr(t,e){const r=Math.pow(2,e.z);return[(n=(t[0]/Ir+e.x)/r,360*n-180),(i=(t[1]/Ir+e.y)/r,360/Math.PI*Math.atan(Math.exp((180-360*i)*Math.PI/180))-90)];var i,n}function zr(t,e){t[0]=Math.min(t[0],e[0]),t[1]=Math.min(t[1],e[1]),t[2]=Math.max(t[2],e[0]),t[3]=Math.max(t[3],e[1])}function Rr(t,e){return!(t[0]<=e[0]||t[2]>=e[2]||t[1]<=e[1]||t[3]>=e[3])}function Dr(t,e,r){const i=t[0]-e[0],n=t[1]-e[1],o=t[0]-r[0],a=t[1]-r[1];return i*a-o*n==0&&i*o<=0&&n*a<=0}function Lr(t,e,r,i){return 0!=(n=[i[0]-r[0],i[1]-r[1]])[0]*(o=[e[0]-t[0],e[1]-t[1]])[1]-n[1]*o[0]&&!(!Nr(t,e,r,i)||!Nr(r,i,t,e));var n,o}function Fr(t,e,r){for(const i of r)for(let r=0;r<i.length-1;++r)if(Lr(t,e,i[r],i[r+1]))return!0;return!1}function Br(t,e,r=!1){let i=!1;for(const s of e)for(let e=0;e<s.length-1;e++){if(Dr(t,s[e],s[e+1]))return r;(o=s[e])[1]>(n=t)[1]!=(a=s[e+1])[1]>n[1]&&n[0]<(a[0]-o[0])*(n[1]-o[1])/(a[1]-o[1])+o[0]&&(i=!i)}var n,o,a;return i}function Or(t,e){for(const r of e)if(Br(t,r))return!0;return!1}function jr(t,e){for(const r of t)if(!Br(r,e))return!1;for(let r=0;r<t.length-1;++r)if(Fr(t[r],t[r+1],e))return!1;return!0}function Ur(t,e){for(const r of e)if(jr(t,r))return!0;return!1}function Nr(t,e,r,i){const n=i[0]-r[0],o=i[1]-r[1],a=(t[0]-r[0])*o-n*(t[1]-r[1]),s=(e[0]-r[0])*o-n*(e[1]-r[1]);return a>0&&s<0||a<0&&s>0}function Vr(t,e,r){const i=[];for(let n=0;n<t.length;n++){const o=[];for(let i=0;i<t[n].length;i++){const a=Er(t[n][i],r);zr(e,a),o.push(a)}i.push(o)}return i}function $r(t,e,r){const i=[];for(let n=0;n<t.length;n++){const o=Vr(t[n],e,r);i.push(o)}return i}function Zr(t,e,r,i){if(t[0]<r[0]||t[0]>r[2]){const e=.5*i;let n=t[0]-r[0]>e?-i:r[0]-t[0]>e?i:0;0===n&&(n=t[0]-r[2]>e?-i:r[2]-t[0]>e?i:0),t[0]+=n}zr(e,t)}function Gr(t,e,r,i){const n=Math.pow(2,i.z)*Ir,o=[i.x*Ir,i.y*Ir],a=[];for(const i of t)for(const t of i){const i=[t.x+o[0],t.y+o[1]];Zr(i,e,r,n),a.push(i)}return a}function qr(t,e,r,i){const n=Math.pow(2,i.z)*Ir,o=[i.x*Ir,i.y*Ir],a=[];for(const r of t){const t=[];for(const i of r){const r=[i.x+o[0],i.y+o[1]];zr(e,r),t.push(r)}a.push(t)}if(e[2]-e[0]<=n/2){(s=e)[0]=s[1]=1/0,s[2]=s[3]=-1/0;for(const t of a)for(const i of t)Zr(i,e,r,n)}var s;return a}class Hr{constructor(t,e){this.type=Bt,this.geojson=t,this.geometries=e}static parse(t,e){if(2!==t.length)return e.error(`'within' expression requires exactly one argument, but found ${t.length-1} instead.`);if(Ue(t[1])){const e=t[1];if("FeatureCollection"===e.type){const t=[];for(const r of e.features){const{type:e,coordinates:i}=r.geometry;"Polygon"===e&&t.push(i),"MultiPolygon"===e&&t.push(...i)}if(t.length)return new Hr(e,{type:"MultiPolygon",coordinates:t})}else if("Feature"===e.type){const t=e.geometry.type;if("Polygon"===t||"MultiPolygon"===t)return new Hr(e,e.geometry)}else if("Polygon"===e.type||"MultiPolygon"===e.type)return new Hr(e,e)}return e.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(null!=t.geometry()&&null!=t.canonicalID()){if("Point"===t.geometryType())return function(t,e){const r=[1/0,1/0,-1/0,-1/0],i=[1/0,1/0,-1/0,-1/0],n=t.canonicalID();if("Polygon"===e.type){const o=Vr(e.coordinates,i,n),a=Gr(t.geometry(),r,i,n);if(!Rr(r,i))return!1;for(const t of a)if(!Br(t,o))return!1}if("MultiPolygon"===e.type){const o=$r(e.coordinates,i,n),a=Gr(t.geometry(),r,i,n);if(!Rr(r,i))return!1;for(const t of a)if(!Or(t,o))return!1}return!0}(t,this.geometries);if("LineString"===t.geometryType())return function(t,e){const r=[1/0,1/0,-1/0,-1/0],i=[1/0,1/0,-1/0,-1/0],n=t.canonicalID();if("Polygon"===e.type){const o=Vr(e.coordinates,i,n),a=qr(t.geometry(),r,i,n);if(!Rr(r,i))return!1;for(const t of a)if(!jr(t,o))return!1}if("MultiPolygon"===e.type){const o=$r(e.coordinates,i,n),a=qr(t.geometry(),r,i,n);if(!Rr(r,i))return!1;for(const t of a)if(!Ur(t,o))return!1}return!0}(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let Wr=class{constructor(t=[],e=(t,e)=>t<e?-1:t>e?1:0){if(this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(let t=(this.length>>1)-1;t>=0;t--)this._down(t)}push(t){this.data.push(t),this._up(this.length++)}pop(){if(0===this.length)return;const t=this.data[0],e=this.data.pop();return--this.length>0&&(this.data[0]=e,this._down(0)),t}peek(){return this.data[0]}_up(t){const{data:e,compare:r}=this,i=e[t];for(;t>0;){const n=t-1>>1,o=e[n];if(r(i,o)>=0)break;e[t]=o,t=n}e[t]=i}_down(t){const{data:e,compare:r}=this,i=this.length>>1,n=e[t];for(;t<i;){let i=1+(t<<1);const o=i+1;if(o<this.length&&r(e[o],e[i])<0&&(i=o),r(e[i],n)>=0)break;e[t]=e[i],t=i}e[t]=n}};function Xr(t,e,r=0,i=t.length-1,n=Yr){for(;i>r;){if(i-r>600){const o=i-r+1,a=e-r+1,s=Math.log(o),l=.5*Math.exp(2*s/3),c=.5*Math.sqrt(s*l*(o-l)/o)*(a-o/2<0?-1:1);Xr(t,e,Math.max(r,Math.floor(e-a*l/o+c)),Math.min(i,Math.floor(e+(o-a)*l/o+c)),n)}const o=t[e];let a=r,s=i;for(Kr(t,r,e),n(t[i],o)>0&&Kr(t,r,i);a<s;){for(Kr(t,a,s),a++,s--;n(t[a],o)<0;)a++;for(;n(t[s],o)>0;)s--}0===n(t[r],o)?Kr(t,r,s):(s++,Kr(t,s,i)),s<=e&&(r=s+1),e<=s&&(i=s-1)}}function Kr(t,e,r){const i=t[e];t[e]=t[r],t[r]=i}function Yr(t,e){return t<e?-1:t>e?1:0}function Jr(t,e){if(t.length<=1)return[t];const r=[];let i,n;for(const e of t){const t=ti(e);0!==t&&(e.area=Math.abs(t),void 0===n&&(n=t<0),n===t<0?(i&&r.push(i),i=[e]):i.push(e))}if(i&&r.push(i),e>1)for(let t=0;t<r.length;t++)r[t].length<=e||(Xr(r[t],e,1,r[t].length-1,Qr),r[t]=r[t].slice(0,e));return r}function Qr(t,e){return e.area-t.area}function ti(t){let e=0;for(let r,i,n=0,o=t.length,a=o-1;n<o;a=n++)r=t[n],i=t[a],e+=(i.x-r.x)*(r.y+i.y);return e}const ei=1/298.257223563,ri=ei*(2-ei),ii=Math.PI/180;class ni{constructor(t){const e=6378.137*ii*1e3,r=Math.cos(t*ii),i=1/(1-ri*(1-r*r)),n=Math.sqrt(i);this.kx=e*n*r,this.ky=e*n*i*(1-ri)}distance(t,e){const r=this.wrap(t[0]-e[0])*this.kx,i=(t[1]-e[1])*this.ky;return Math.sqrt(r*r+i*i)}pointOnLine(t,e){let r,i,n,o,a=1/0;for(let s=0;s<t.length-1;s++){let l=t[s][0],c=t[s][1],h=this.wrap(t[s+1][0]-l)*this.kx,u=(t[s+1][1]-c)*this.ky,p=0;0===h&&0===u||(p=(this.wrap(e[0]-l)*this.kx*h+(e[1]-c)*this.ky*u)/(h*h+u*u),p>1?(l=t[s+1][0],c=t[s+1][1]):p>0&&(l+=h/this.kx*p,c+=u/this.ky*p)),h=this.wrap(e[0]-l)*this.kx,u=(e[1]-c)*this.ky;const d=h*h+u*u;d<a&&(a=d,r=l,i=c,n=s,o=p)}return{point:[r,i],index:n,t:Math.max(0,Math.min(1,o))}}wrap(t){for(;t<-180;)t+=360;for(;t>180;)t-=360;return t}}function oi(t,e){return e[0]-t[0]}function ai(t){return t[1]-t[0]+1}function si(t,e){return t[1]>=t[0]&&t[1]<e}function li(t,e){if(t[0]>t[1])return[null,null];const r=ai(t);if(e){if(2===r)return[t,null];const e=Math.floor(r/2);return[[t[0],t[0]+e],[t[0]+e,t[1]]]}if(1===r)return[t,null];const i=Math.floor(r/2)-1;return[[t[0],t[0]+i],[t[0]+i+1,t[1]]]}function ci(t,e){if(!si(e,t.length))return[1/0,1/0,-1/0,-1/0];const r=[1/0,1/0,-1/0,-1/0];for(let i=e[0];i<=e[1];++i)zr(r,t[i]);return r}function hi(t){const e=[1/0,1/0,-1/0,-1/0];for(const r of t)for(const t of r)zr(e,t);return e}function ui(t){return t[0]!==-1/0&&t[1]!==-1/0&&t[2]!==1/0&&t[3]!==1/0}function pi(t,e,r){if(!ui(t)||!ui(e))return NaN;let i=0,n=0;return t[2]<e[0]&&(i=e[0]-t[2]),t[0]>e[2]&&(i=t[0]-e[2]),t[1]>e[3]&&(n=t[1]-e[3]),t[3]<e[1]&&(n=e[1]-t[3]),r.distance([0,0],[i,n])}function di(t,e,r){const i=r.pointOnLine(e,t);return r.distance(t,i.point)}function fi(t,e,r,i,n){const o=Math.min(di(t,[r,i],n),di(e,[r,i],n)),a=Math.min(di(r,[t,e],n),di(i,[t,e],n));return Math.min(o,a)}function mi(t,e,r,i,n){if(!si(e,t.length)||!si(i,r.length))return 1/0;let o=1/0;for(let a=e[0];a<e[1];++a){const e=t[a],s=t[a+1];for(let t=i[0];t<i[1];++t){const i=r[t],a=r[t+1];if(Lr(e,s,i,a))return 0;o=Math.min(o,fi(e,s,i,a,n))}}return o}function gi(t,e,r,i,n){if(!si(e,t.length)||!si(i,r.length))return NaN;let o=1/0;for(let a=e[0];a<=e[1];++a)for(let e=i[0];e<=i[1];++e)if(o=Math.min(o,n.distance(t[a],r[e])),0===o)return o;return o}function _i(t,e,r){if(Br(t,e,!0))return 0;let i=1/0;for(const n of e){const e=n[0],o=n[n.length-1];if(e!==o&&(i=Math.min(i,di(t,[o,e],r)),0===i))return i;const a=r.pointOnLine(n,t);if(i=Math.min(i,r.distance(t,a.point)),0===i)return i}return i}function yi(t,e,r,i){if(!si(e,t.length))return NaN;for(let i=e[0];i<=e[1];++i)if(Br(t[i],r,!0))return 0;let n=1/0;for(let o=e[0];o<e[1];++o){const e=t[o],a=t[o+1];for(const t of r)for(let r=0,o=t.length,s=o-1;r<o;s=r++){const o=t[s],l=t[r];if(Lr(e,a,o,l))return 0;n=Math.min(n,fi(e,a,o,l,i))}}return n}function bi(t,e){for(const r of t)for(const t of r)if(Br(t,e,!0))return!0;return!1}function vi(t,e,r,i=1/0){const n=hi(t),o=hi(e);if(i!==1/0&&pi(n,o,r)>=i)return i;if(Rr(n,o)){if(bi(t,e))return 0}else if(bi(e,t))return 0;let a=1/0;for(const i of t)for(let t=0,n=i.length,o=n-1;t<n;o=t++){const n=i[o],s=i[t];for(const t of e)for(let e=0,i=t.length,o=i-1;e<i;o=e++){const i=t[o],l=t[e];if(Lr(n,s,i,l))return 0;a=Math.min(a,fi(n,s,i,l,r))}}return a}function xi(t,e,r,i,n,o){if(!o)return;const a=pi(ci(i,o),n,r);a<e&&t.push([a,o,[0,0]])}function wi(t,e,r,i,n,o,a){if(!o||!a)return;const s=pi(ci(i,o),ci(n,a),r);s<e&&t.push([s,o,a])}function Ti(t,e,r,i,n=1/0){let o=Math.min(i.distance(t[0],r[0][0]),n);if(0===o)return o;const a=new Wr([[0,[0,t.length-1],[0,0]]],oi),s=hi(r);for(;a.length>0;){const n=a.pop();if(n[0]>=o)continue;const l=n[1],c=e?50:100;if(ai(l)<=c){if(!si(l,t.length))return NaN;if(e){const e=yi(t,l,r,i);if(isNaN(e)||0===e)return e;o=Math.min(o,e)}else for(let e=l[0];e<=l[1];++e){const n=_i(t[e],r,i);if(o=Math.min(o,n),0===o)return 0}}else{const r=li(l,e);xi(a,o,i,t,s,r[0]),xi(a,o,i,t,s,r[1])}}return o}function Si(t,e,r,i,n,o=1/0){let a=Math.min(o,n.distance(t[0],r[0]));if(0===a)return a;const s=new Wr([[0,[0,t.length-1],[0,r.length-1]]],oi);for(;s.length>0;){const o=s.pop();if(o[0]>=a)continue;const l=o[1],c=o[2],h=e?50:100,u=i?50:100;if(ai(l)<=h&&ai(c)<=u){if(!si(l,t.length)&&si(c,r.length))return NaN;let o;if(e&&i)o=mi(t,l,r,c,n),a=Math.min(a,o);else if(e&&!i){const e=t.slice(l[0],l[1]+1);for(let t=c[0];t<=c[1];++t)if(o=di(r[t],e,n),a=Math.min(a,o),0===a)return a}else if(!e&&i){const e=r.slice(c[0],c[1]+1);for(let r=l[0];r<=l[1];++r)if(o=di(t[r],e,n),a=Math.min(a,o),0===a)return a}else o=gi(t,l,r,c,n),a=Math.min(a,o)}else{const o=li(l,e),h=li(c,i);wi(s,a,n,t,r,o[0],h[0]),wi(s,a,n,t,r,o[0],h[1]),wi(s,a,n,t,r,o[1],h[0]),wi(s,a,n,t,r,o[1],h[1])}}return a}function Pi(t){return"MultiPolygon"===t.type?t.coordinates.map(t=>({type:"Polygon",coordinates:t})):"MultiLineString"===t.type?t.coordinates.map(t=>({type:"LineString",coordinates:t})):"MultiPoint"===t.type?t.coordinates.map(t=>({type:"Point",coordinates:t})):[t]}class Ci{constructor(t,e){this.type=Lt,this.geojson=t,this.geometries=e}static parse(t,e){if(2!==t.length)return e.error(`'distance' expression requires exactly one argument, but found ${t.length-1} instead.`);if(Ue(t[1])){const e=t[1];if("FeatureCollection"===e.type)return new Ci(e,e.features.map(t=>Pi(t.geometry)).flat());if("Feature"===e.type)return new Ci(e,Pi(e.geometry));if("type"in e&&"coordinates"in e)return new Ci(e,Pi(e))}return e.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(null!=t.geometry()&&null!=t.canonicalID()){if("Point"===t.geometryType())return function(t,e){const r=t.geometry(),i=r.flat().map(e=>kr([e.x,e.y],t.canonical));if(0===r.length)return NaN;const n=new ni(i[0][1]);let o=1/0;for(const t of e){switch(t.type){case"Point":o=Math.min(o,Si(i,!1,[t.coordinates],!1,n,o));break;case"LineString":o=Math.min(o,Si(i,!1,t.coordinates,!0,n,o));break;case"Polygon":o=Math.min(o,Ti(i,!1,t.coordinates,n,o))}if(0===o)return o}return o}(t,this.geometries);if("LineString"===t.geometryType())return function(t,e){const r=t.geometry(),i=r.flat().map(e=>kr([e.x,e.y],t.canonical));if(0===r.length)return NaN;const n=new ni(i[0][1]);let o=1/0;for(const t of e){switch(t.type){case"Point":o=Math.min(o,Si(i,!0,[t.coordinates],!1,n,o));break;case"LineString":o=Math.min(o,Si(i,!0,t.coordinates,!0,n,o));break;case"Polygon":o=Math.min(o,Ti(i,!0,t.coordinates,n,o))}if(0===o)return o}return o}(t,this.geometries);if("Polygon"===t.geometryType())return function(t,e){const r=t.geometry();if(0===r.length||0===r[0].length)return NaN;const i=Jr(r,0).map(e=>e.map(e=>e.map(e=>kr([e.x,e.y],t.canonical)))),n=new ni(i[0][0][0][1]);let o=1/0;for(const t of e)for(const e of i){switch(t.type){case"Point":o=Math.min(o,Ti([t.coordinates],!1,e,n,o));break;case"LineString":o=Math.min(o,Ti(t.coordinates,!0,e,n,o));break;case"Polygon":o=Math.min(o,vi(e,t.coordinates,n,o))}if(0===o)return o}return o}(t,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}class Mi{constructor(t){this.type=Nt,this.key=t}static parse(t,e){if(2!==t.length)return e.error(`Expected 1 argument, but found ${t.length-1} instead.`);const r=t[1];return null==r?e.error("Global state property must be defined."):"string"!=typeof r?e.error(`Global state property must be string, but found ${typeof t[1]} instead.`):new Mi(r)}evaluate(t){var e;const r=null===(e=t.globals)||void 0===e?void 0:e.globalState;return r&&0!==Object.keys(r).length?ye(r,this.key):null}eachChild(){}outputDefined(){return!1}}const Ai={"==":yr,"!=":br,">":xr,"<":vr,">=":Tr,"<=":wr,array:Ge,at:Qe,boolean:Ge,case:ir,coalesce:fr,collator:Sr,format:Cr,image:Mr,in:tr,"index-of":er,interpolate:ur,"interpolate-hcl":ur,"interpolate-lab":ur,length:Ar,let:Ye,literal:$e,match:rr,number:Ge,"number-format":Pr,object:Ge,slice:nr,step:ar,string:Ge,"to-boolean":He,"to-color":He,"to-number":He,"to-string":He,var:Je,within:Hr,distance:Ci,"global-state":Mi};class Ii{constructor(t,e,r,i){this.name=t,this.type=e,this._evaluate=r,this.args=i}evaluate(t){return this._evaluate(t,this.args)}eachChild(t){this.args.forEach(t)}outputDefined(){return!1}static parse(t,e){const r=t[0],i=Ii.definitions[r];if(!i)return e.error(`Unknown expression "${r}". If you wanted a literal array, use ["literal", [...]].`,0);const n=Array.isArray(i)?i[0]:i.type,o=Array.isArray(i)?[[i[1],i[2]]]:i.overloads,a=o.filter(([e])=>!Array.isArray(e)||e.length===t.length-1);let s=null;for(const[i,o]of a){s=new Ke(e.registry,Di,e.path,null,e.scope);const a=[];let l=!1;for(let e=1;e<t.length;e++){const r=t[e],n=Array.isArray(i)?i[e-1]:i.type,o=s.parse(r,1+a.length,n);if(!o){l=!0;break}a.push(o)}if(!l)if(Array.isArray(i)&&i.length!==a.length)s.error(`Expected ${i.length} arguments, but found ${a.length} instead.`);else{for(let t=0;t<a.length;t++){const e=Array.isArray(i)?i[t]:i.type,r=a[t];s.concat(t+1).checkSubtype(e,r.type)}if(0===s.errors.length)return new Ii(r,n,o,a)}}if(1===a.length)e.errors.push(...s.errors);else{const r=(a.length?a:o).map(([t])=>{return e=t,Array.isArray(e)?`(${e.map(Kt).join(", ")})`:`(${Kt(e.type)}...)`;var e}).join(" | "),i=[];for(let r=1;r<t.length;r++){const n=e.parse(t[r],1+i.length);if(!n)return null;i.push(Kt(n.type))}e.error(`Expected arguments of type ${r}, but found (${i.join(", ")}) instead.`)}return null}static register(t,e){Ii.definitions=e;for(const r in e)t[r]=Ii}}function Ei(t,[e,r,i,n]){e=e.evaluate(t),r=r.evaluate(t),i=i.evaluate(t);const o=n?n.evaluate(t):1,a=je(e,r,i,o);if(a)throw new De(a);return new Ce(e/255,r/255,i/255,o,!1)}function ki(t,e){return t in e}function zi(t,e){const r=e[t];return void 0===r?null:r}function Ri(t){return{type:t}}function Di(t){if(t instanceof Je)return Di(t.boundExpression);if(t instanceof Ii&&"error"===t.name)return!1;if(t instanceof Sr)return!1;if(t instanceof Hr)return!1;if(t instanceof Ci)return!1;if(t instanceof Mi)return!1;const e=t instanceof He||t instanceof Ge;let r=!0;return t.eachChild(t=>{r=e?r&&Di(t):r&&t instanceof $e}),!!r&&Li(t)&&Bi(t,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"])}function Li(t){if(t instanceof Ii){if("get"===t.name&&1===t.args.length)return!1;if("feature-state"===t.name)return!1;if("has"===t.name&&1===t.args.length)return!1;if("properties"===t.name||"geometry-type"===t.name||"id"===t.name)return!1;if(/^filter-/.test(t.name))return!1}if(t instanceof Hr)return!1;if(t instanceof Ci)return!1;let e=!0;return t.eachChild(t=>{e&&!Li(t)&&(e=!1)}),e}function Fi(t){if(t instanceof Ii&&"feature-state"===t.name)return!1;let e=!0;return t.eachChild(t=>{e&&!Fi(t)&&(e=!1)}),e}function Bi(t,e){if(t instanceof Ii&&e.indexOf(t.name)>=0)return!1;let r=!0;return t.eachChild(t=>{r&&!Bi(t,e)&&(r=!1)}),r}function Oi(t){return{result:"success",value:t}}function ji(t){return{result:"error",value:t}}function Ui(t){return"data-driven"===t["property-type"]||"cross-faded-data-driven"===t["property-type"]}function Ni(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}function Vi(t){return!!t.expression&&t.expression.interpolated}function $i(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":null===t?"null":typeof t}function Zi(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)&&Ne(t)===Ut}function Gi(t){return t}function qi(t,e){const r=t.stops&&"object"==typeof t.stops[0][0],i=r||!(r||void 0!==t.property),n=t.type||(Vi(e)?"exponential":"interval"),o=function(t){switch(t.type){case"color":return Ce.parse;case"padding":return ke.parse;case"numberArray":return ze.parse;case"colorArray":return Re.parse;default:return null}}(e);if(o&&((t=kt({},t)).stops&&(t.stops=t.stops.map(t=>[t[0],o(t[1])])),t.default=o(t.default?t.default:e.default)),t.colorSpace&&"rgb"!==(a=t.colorSpace)&&"hcl"!==a&&"lab"!==a)throw new Error(`Unknown color space: "${t.colorSpace}"`);var a;const s=function(t){switch(t){case"exponential":return Ki;case"interval":return Xi;case"categorical":return Wi;case"identity":return Yi;default:throw new Error(`Unknown function type "${t}"`)}}(n);let l,c;if("categorical"===n){l=Object.create(null);for(const e of t.stops)l[e[0]]=e[1];c=typeof t.stops[0][0]}if(r){const r={},i=[];for(let e=0;e<t.stops.length;e++){const n=t.stops[e],o=n[0].zoom;void 0===r[o]&&(r[o]={zoom:o,type:t.type,property:t.property,default:t.default,stops:[]},i.push(o)),r[o].stops.push([n[0].value,n[1]])}const n=[];for(const t of i)n.push([r[t].zoom,qi(r[t],e)]);const o={name:"linear"};return{kind:"composite",interpolationType:o,interpolationFactor:ur.interpolationFactor.bind(void 0,o),zoomStops:n.map(t=>t[0]),evaluate:({zoom:r},i)=>Ki({stops:n,base:t.base},e,r).evaluate(r,i)}}if(i){const r="exponential"===n?{name:"exponential",base:void 0!==t.base?t.base:1}:null;return{kind:"camera",interpolationType:r,interpolationFactor:ur.interpolationFactor.bind(void 0,r),zoomStops:t.stops.map(t=>t[0]),evaluate:({zoom:r})=>s(t,e,r,l,c)}}return{kind:"source",evaluate(r,i){const n=i&&i.properties?i.properties[t.property]:void 0;return void 0===n?Hi(t.default,e.default):s(t,e,n,l,c)}}}function Hi(t,e,r){return void 0!==t?t:void 0!==e?e:void 0!==r?r:void 0}function Wi(t,e,r,i,n){return Hi(typeof r===n?i[r]:void 0,t.default,e.default)}function Xi(t,e,r){if("number"!==$i(r))return Hi(t.default,e.default);const i=t.stops.length;if(1===i)return t.stops[0][1];if(r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[i-1][0])return t.stops[i-1][1];const n=or(t.stops.map(t=>t[0]),r);return t.stops[n][1]}function Ki(t,e,r){const i=void 0!==t.base?t.base:1;if("number"!==$i(r))return Hi(t.default,e.default);const n=t.stops.length;if(1===n)return t.stops[0][1];if(r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[n-1][0])return t.stops[n-1][1];const o=or(t.stops.map(t=>t[0]),r),a=function(t,e,r,i){const n=i-r,o=t-r;return 0===n?0:1===e?o/n:(Math.pow(e,o)-1)/(Math.pow(e,n)-1)}(r,i,t.stops[o][0],t.stops[o+1][0]),s=t.stops[o][1],l=t.stops[o+1][1],c=dr[e.type]||Gi;return"function"==typeof s.evaluate?{evaluate(...e){const r=s.evaluate.apply(void 0,e),i=l.evaluate.apply(void 0,e);if(void 0!==r&&void 0!==i)return c(r,i,a,t.colorSpace)}}:c(s,l,a,t.colorSpace)}function Yi(t,e,r){switch(e.type){case"color":r=Ce.parse(r);break;case"formatted":r=Ee.fromString(r.toString());break;case"resolvedImage":r=Be.fromString(r.toString());break;case"padding":r=ke.parse(r);break;case"colorArray":r=Re.parse(r);break;case"numberArray":r=ze.parse(r);break;default:$i(r)===e.type||"enum"===e.type&&e.values[r]||(r=void 0)}return Hi(r,t.default,e.default)}Ii.register(Ai,{error:[{kind:"error"},[Ft],(t,[e])=>{throw new De(e.evaluate(t))}],typeof:[Ft,[Nt],(t,[e])=>Kt(Ne(e.evaluate(t)))],"to-rgba":[Xt(Lt,4),[Ot],(t,[e])=>{const[r,i,n,o]=e.evaluate(t).rgb;return[255*r,255*i,255*n,o]}],rgb:[Ot,[Lt,Lt,Lt],Ei],rgba:[Ot,[Lt,Lt,Lt,Lt],Ei],has:{type:Bt,overloads:[[[Ft],(t,[e])=>ki(e.evaluate(t),t.properties())],[[Ft,Ut],(t,[e,r])=>ki(e.evaluate(t),r.evaluate(t))]]},get:{type:Nt,overloads:[[[Ft],(t,[e])=>zi(e.evaluate(t),t.properties())],[[Ft,Ut],(t,[e,r])=>zi(e.evaluate(t),r.evaluate(t))]]},"feature-state":[Nt,[Ft],(t,[e])=>zi(e.evaluate(t),t.featureState||{})],properties:[Ut,[],t=>t.properties()],"geometry-type":[Ft,[],t=>t.geometryType()],id:[Nt,[],t=>t.id()],zoom:[Lt,[],t=>t.globals.zoom],"heatmap-density":[Lt,[],t=>t.globals.heatmapDensity||0],elevation:[Lt,[],t=>t.globals.elevation||0],"line-progress":[Lt,[],t=>t.globals.lineProgress||0],accumulated:[Nt,[],t=>void 0===t.globals.accumulated?null:t.globals.accumulated],"+":[Lt,Ri(Lt),(t,e)=>{let r=0;for(const i of e)r+=i.evaluate(t);return r}],"*":[Lt,Ri(Lt),(t,e)=>{let r=1;for(const i of e)r*=i.evaluate(t);return r}],"-":{type:Lt,overloads:[[[Lt,Lt],(t,[e,r])=>e.evaluate(t)-r.evaluate(t)],[[Lt],(t,[e])=>-e.evaluate(t)]]},"/":[Lt,[Lt,Lt],(t,[e,r])=>e.evaluate(t)/r.evaluate(t)],"%":[Lt,[Lt,Lt],(t,[e,r])=>e.evaluate(t)%r.evaluate(t)],ln2:[Lt,[],()=>Math.LN2],pi:[Lt,[],()=>Math.PI],e:[Lt,[],()=>Math.E],"^":[Lt,[Lt,Lt],(t,[e,r])=>Math.pow(e.evaluate(t),r.evaluate(t))],sqrt:[Lt,[Lt],(t,[e])=>Math.sqrt(e.evaluate(t))],log10:[Lt,[Lt],(t,[e])=>Math.log(e.evaluate(t))/Math.LN10],ln:[Lt,[Lt],(t,[e])=>Math.log(e.evaluate(t))],log2:[Lt,[Lt],(t,[e])=>Math.log(e.evaluate(t))/Math.LN2],sin:[Lt,[Lt],(t,[e])=>Math.sin(e.evaluate(t))],cos:[Lt,[Lt],(t,[e])=>Math.cos(e.evaluate(t))],tan:[Lt,[Lt],(t,[e])=>Math.tan(e.evaluate(t))],asin:[Lt,[Lt],(t,[e])=>Math.asin(e.evaluate(t))],acos:[Lt,[Lt],(t,[e])=>Math.acos(e.evaluate(t))],atan:[Lt,[Lt],(t,[e])=>Math.atan(e.evaluate(t))],min:[Lt,Ri(Lt),(t,e)=>Math.min(...e.map(e=>e.evaluate(t)))],max:[Lt,Ri(Lt),(t,e)=>Math.max(...e.map(e=>e.evaluate(t)))],abs:[Lt,[Lt],(t,[e])=>Math.abs(e.evaluate(t))],round:[Lt,[Lt],(t,[e])=>{const r=e.evaluate(t);return r<0?-Math.round(-r):Math.round(r)}],floor:[Lt,[Lt],(t,[e])=>Math.floor(e.evaluate(t))],ceil:[Lt,[Lt],(t,[e])=>Math.ceil(e.evaluate(t))],"filter-==":[Bt,[Ft,Nt],(t,[e,r])=>t.properties()[e.value]===r.value],"filter-id-==":[Bt,[Nt],(t,[e])=>t.id()===e.value],"filter-type-==":[Bt,[Ft],(t,[e])=>t.geometryType()===e.value],"filter-<":[Bt,[Ft,Nt],(t,[e,r])=>{const i=t.properties()[e.value],n=r.value;return typeof i==typeof n&&i<n}],"filter-id-<":[Bt,[Nt],(t,[e])=>{const r=t.id(),i=e.value;return typeof r==typeof i&&r<i}],"filter->":[Bt,[Ft,Nt],(t,[e,r])=>{const i=t.properties()[e.value],n=r.value;return typeof i==typeof n&&i>n}],"filter-id->":[Bt,[Nt],(t,[e])=>{const r=t.id(),i=e.value;return typeof r==typeof i&&r>i}],"filter-<=":[Bt,[Ft,Nt],(t,[e,r])=>{const i=t.properties()[e.value],n=r.value;return typeof i==typeof n&&i<=n}],"filter-id-<=":[Bt,[Nt],(t,[e])=>{const r=t.id(),i=e.value;return typeof r==typeof i&&r<=i}],"filter->=":[Bt,[Ft,Nt],(t,[e,r])=>{const i=t.properties()[e.value],n=r.value;return typeof i==typeof n&&i>=n}],"filter-id->=":[Bt,[Nt],(t,[e])=>{const r=t.id(),i=e.value;return typeof r==typeof i&&r>=i}],"filter-has":[Bt,[Nt],(t,[e])=>e.value in t.properties()],"filter-has-id":[Bt,[],t=>null!==t.id()&&void 0!==t.id()],"filter-type-in":[Bt,[Xt(Ft)],(t,[e])=>e.value.indexOf(t.geometryType())>=0],"filter-id-in":[Bt,[Xt(Nt)],(t,[e])=>e.value.indexOf(t.id())>=0],"filter-in-small":[Bt,[Ft,Xt(Nt)],(t,[e,r])=>r.value.indexOf(t.properties()[e.value])>=0],"filter-in-large":[Bt,[Ft,Xt(Nt)],(t,[e,r])=>function(t,e,r,i){for(;r<=i;){const n=r+i>>1;if(e[n]===t)return!0;e[n]>t?i=n-1:r=n+1}return!1}(t.properties()[e.value],r.value,0,r.value.length-1)],all:{type:Bt,overloads:[[[Bt,Bt],(t,[e,r])=>e.evaluate(t)&&r.evaluate(t)],[Ri(Bt),(t,e)=>{for(const r of e)if(!r.evaluate(t))return!1;return!0}]]},any:{type:Bt,overloads:[[[Bt,Bt],(t,[e,r])=>e.evaluate(t)||r.evaluate(t)],[Ri(Bt),(t,e)=>{for(const r of e)if(r.evaluate(t))return!0;return!1}]]},"!":[Bt,[Bt],(t,[e])=>!e.evaluate(t)],"is-supported-script":[Bt,[Ft],(t,[e])=>{const r=t.globals&&t.globals.isSupportedScript;return!r||r(e.evaluate(t))}],upcase:[Ft,[Ft],(t,[e])=>e.evaluate(t).toUpperCase()],downcase:[Ft,[Ft],(t,[e])=>e.evaluate(t).toLowerCase()],concat:[Ft,Ri(Nt),(t,e)=>e.map(e=>Ve(e.evaluate(t))).join("")],"resolved-locale":[Ft,[Vt],(t,[e])=>e.evaluate(t).resolvedLocale()]});class Ji{constructor(t,e){this.expression=t,this._warningHistory={},this._evaluator=new Xe,this._defaultValue=e?function(t){if("color"===t.type&&Zi(t.default))return new Ce(0,0,0,0);switch(t.type){case"color":return Ce.parse(t.default)||null;case"padding":return ke.parse(t.default)||null;case"numberArray":return ze.parse(t.default)||null;case"colorArray":return Re.parse(t.default)||null;case"variableAnchorOffsetCollection":return Fe.parse(t.default)||null;case"projectionDefinition":return Oe.parse(t.default)||null;default:return void 0===t.default?null:t.default}}(e):null,this._enumValues=e&&"enum"===e.type?e.values:null}evaluateWithoutErrorHandling(t,e,r,i,n,o){return this._evaluator.globals=t,this._evaluator.feature=e,this._evaluator.featureState=r,this._evaluator.canonical=i,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=o,this.expression.evaluate(this._evaluator)}evaluate(t,e,r,i,n,o){this._evaluator.globals=t,this._evaluator.feature=e||null,this._evaluator.featureState=r||null,this._evaluator.canonical=i,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=o||null;try{const t=this.expression.evaluate(this._evaluator);if(null==t||"number"==typeof t&&t!=t)return this._defaultValue;if(this._enumValues&&!(t in this._enumValues))throw new De(`Expected value to be one of ${Object.keys(this._enumValues).map(t=>JSON.stringify(t)).join(", ")}, but found ${JSON.stringify(t)} instead.`);return t}catch(t){return this._warningHistory[t.message]||(this._warningHistory[t.message]=!0,"undefined"!=typeof console&&console.warn(t.message)),this._defaultValue}}}function Qi(t){return Array.isArray(t)&&t.length>0&&"string"==typeof t[0]&&t[0]in Ai}function tn(t,e){const r=new Ke(Ai,Di,[],e?function(t){const e={color:Ot,string:Ft,number:Lt,enum:Ft,boolean:Bt,formatted:$t,padding:Zt,numberArray:qt,colorArray:Gt,projectionDefinition:jt,resolvedImage:Ht,variableAnchorOffsetCollection:Wt};return"array"===t.type?Xt(e[t.value]||Nt,t.length):e[t.type]}(e):void 0),i=r.parse(t,void 0,void 0,void 0,e&&"string"===e.type?{typeAnnotation:"coerce"}:void 0);return i?Oi(new Ji(i,e)):ji(r.errors)}class en{constructor(t,e){this.kind=t,this._styleExpression=e,this.isStateDependent="constant"!==t&&!Fi(e.expression),this.globalStateRefs=sn(e.expression)}evaluateWithoutErrorHandling(t,e,r,i,n,o){return this._styleExpression.evaluateWithoutErrorHandling(t,e,r,i,n,o)}evaluate(t,e,r,i,n,o){return this._styleExpression.evaluate(t,e,r,i,n,o)}}class rn{constructor(t,e,r,i){this.kind=t,this.zoomStops=r,this._styleExpression=e,this.isStateDependent="camera"!==t&&!Fi(e.expression),this.globalStateRefs=sn(e.expression),this.interpolationType=i}evaluateWithoutErrorHandling(t,e,r,i,n,o){return this._styleExpression.evaluateWithoutErrorHandling(t,e,r,i,n,o)}evaluate(t,e,r,i,n,o){return this._styleExpression.evaluate(t,e,r,i,n,o)}interpolationFactor(t,e,r){return this.interpolationType?ur.interpolationFactor(this.interpolationType,t,e,r):0}}function nn(t,e){const r=tn(t,e);if("error"===r.result)return r;const i=r.value.expression,n=Li(i);if(!n&&!Ui(e))return ji([new zt("","data expressions not supported")]);const o=Bi(i,["zoom"]);if(!o&&!Ni(e))return ji([new zt("","zoom expressions not supported")]);const a=an(i);return a||o?a instanceof zt?ji([a]):a instanceof ur&&!Vi(e)?ji([new zt("",'"interpolate" expressions cannot be used with this property')]):Oi(a?new rn(n?"camera":"composite",r.value,a.labels,a instanceof ur?a.interpolation:void 0):new en(n?"constant":"source",r.value)):ji([new zt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class on{constructor(t,e){this._parameters=t,this._specification=e,kt(this,qi(this._parameters,this._specification))}static deserialize(t){return new on(t._parameters,t._specification)}static serialize(t){return{_parameters:t._parameters,_specification:t._specification}}}function an(t){let e=null;if(t instanceof Ye)e=an(t.result);else if(t instanceof fr){for(const r of t.args)if(e=an(r),e)break}else(t instanceof ar||t instanceof ur)&&t.input instanceof Ii&&"zoom"===t.input.name&&(e=t);return e instanceof zt||t.eachChild(t=>{const r=an(t);r instanceof zt?e=r:!e&&r?e=new zt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&r&&e!==r&&(e=new zt("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}function sn(t,e=new Set){return t instanceof Mi&&e.add(t.key),t.eachChild(t=>{sn(t,e)}),e}function ln(t){if(!0===t||!1===t)return!0;if(!Array.isArray(t)||0===t.length)return!1;switch(t[0]){case"has":return t.length>=2&&"$id"!==t[1]&&"$type"!==t[1];case"in":return t.length>=3&&("string"!=typeof t[1]||Array.isArray(t[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==t.length||Array.isArray(t[1])||Array.isArray(t[2]);case"any":case"all":for(const e of t.slice(1))if(!ln(e)&&"boolean"!=typeof e)return!1;return!0;default:return!0}}const cn={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function hn(t){if(null==t)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};ln(t)||(t=dn(t));const e=tn(t,cn);if("error"===e.result)throw new Error(e.value.map(t=>`${t.key}: ${t.message}`).join(", "));return{filter:(t,r,i)=>e.value.evaluate(t,r,{},i),needGeometry:pn(t),getGlobalStateRefs:()=>sn(e.value.expression)}}function un(t,e){return t<e?-1:t>e?1:0}function pn(t){if(!Array.isArray(t))return!1;if("within"===t[0]||"distance"===t[0])return!0;for(let e=1;e<t.length;e++)if(pn(t[e]))return!0;return!1}function dn(t){if(!t)return!0;const e=t[0];return t.length<=1?"any"!==e:"=="===e?fn(t[1],t[2],"=="):"!="===e?_n(fn(t[1],t[2],"==")):"<"===e||">"===e||"<="===e||">="===e?fn(t[1],t[2],e):"any"===e?(r=t.slice(1),["any"].concat(r.map(dn))):"all"===e?["all"].concat(t.slice(1).map(dn)):"none"===e?["all"].concat(t.slice(1).map(dn).map(_n)):"in"===e?mn(t[1],t.slice(2)):"!in"===e?_n(mn(t[1],t.slice(2))):"has"===e?gn(t[1]):"!has"!==e||_n(gn(t[1]));var r}function fn(t,e,r){switch(t){case"$type":return[`filter-type-${r}`,e];case"$id":return[`filter-id-${r}`,e];default:return[`filter-${r}`,t,e]}}function mn(t,e){if(0===e.length)return!1;switch(t){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(t=>typeof t!=typeof e[0])?["filter-in-large",t,["literal",e.sort(un)]]:["filter-in-small",t,["literal",e]]}}function gn(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function _n(t){return["!",t]}function yn(t){const e=typeof t;if("number"===e||"boolean"===e||"string"===e||null==t)return JSON.stringify(t);if(Array.isArray(t)){let e="[";for(const r of t)e+=`${yn(r)},`;return`${e}]`}const r=Object.keys(t).sort();let i="{";for(let e=0;e<r.length;e++)i+=`${JSON.stringify(r[e])}:${yn(t[r[e]])},`;return`${i}}`}function bn(t){let e="";for(const r of bt)e+=`/${yn(t[r])}`;return e}function vn(t){const e=t.value;return e?[new Et(t.key,e,"constants have been deprecated as of v8")]:[]}function xn(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}function wn(t){if(Array.isArray(t))return t.map(wn);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){const e={};for(const r in t)e[r]=wn(t[r]);return e}return xn(t)}function Tn(t){const e=t.key,r=t.value,i=t.valueSpec||{},n=t.objectElementValidators||{},o=t.style,a=t.styleSpec,s=t.validateSpec;let l=[];const c=$i(r);if("object"!==c)return[new Et(e,r,`object expected, ${c} found`)];for(const t in r){const c=t.split(".")[0],h=ye(i,c)||i["*"];let u;if(ye(n,c))u=n[c];else if(ye(i,c))u=s;else if(n["*"])u=n["*"];else{if(!i["*"]){l.push(new Et(e,r[t],`unknown property "${t}"`));continue}u=s}l=l.concat(u({key:(e?`${e}.`:e)+t,value:r[t],valueSpec:h,style:o,styleSpec:a,object:r,objectKey:t,validateSpec:s},r))}for(const t in i)n[t]||i[t].required&&void 0===i[t].default&&void 0===r[t]&&l.push(new Et(e,r,`missing required property "${t}"`));return l}function Sn(t){const e=t.value,r=t.valueSpec,i=t.style,n=t.styleSpec,o=t.key,a=t.arrayElementValidator||t.validateSpec;if("array"!==$i(e))return[new Et(o,e,`array expected, ${$i(e)} found`)];if(r.length&&e.length!==r.length)return[new Et(o,e,`array length ${r.length} expected, length ${e.length} found`)];if(r["min-length"]&&e.length<r["min-length"])return[new Et(o,e,`array length at least ${r["min-length"]} expected, length ${e.length} found`)];let s={type:r.value,values:r.values};n.$version<7&&(s.function=r.function),"object"===$i(r.value)&&(s=r.value);let l=[];for(let r=0;r<e.length;r++)l=l.concat(a({array:e,arrayIndex:r,value:e[r],valueSpec:s,validateSpec:t.validateSpec,style:i,styleSpec:n,key:`${o}[${r}]`}));return l}function Pn(t){const e=t.key,r=t.value,i=t.valueSpec;let n=$i(r);return"number"===n&&r!=r&&(n="NaN"),"number"!==n?[new Et(e,r,`number expected, ${n} found`)]:"minimum"in i&&r<i.minimum?[new Et(e,r,`${r} is less than the minimum value ${i.minimum}`)]:"maximum"in i&&r>i.maximum?[new Et(e,r,`${r} is greater than the maximum value ${i.maximum}`)]:[]}function Cn(t){const e=t.valueSpec,r=xn(t.value.type);let i,n,o,a={};const s="categorical"!==r&&void 0===t.value.property,l=!s,c="array"===$i(t.value.stops)&&"array"===$i(t.value.stops[0])&&"object"===$i(t.value.stops[0][0]),h=Tn({key:t.key,value:t.value,valueSpec:t.styleSpec.function,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{stops:function(t){if("identity"===r)return[new Et(t.key,t.value,'identity function may not have a "stops" property')];let e=[];const i=t.value;return e=e.concat(Sn({key:t.key,value:i,valueSpec:t.valueSpec,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,arrayElementValidator:u})),"array"===$i(i)&&0===i.length&&e.push(new Et(t.key,i,"array must have at least one stop")),e},default:function(t){return t.validateSpec({key:t.key,value:t.value,valueSpec:e,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec})}}});return"identity"===r&&s&&h.push(new Et(t.key,t.value,'missing required property "property"')),"identity"===r||t.value.stops||h.push(new Et(t.key,t.value,'missing required property "stops"')),"exponential"===r&&t.valueSpec.expression&&!Vi(t.valueSpec)&&h.push(new Et(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(l&&!Ui(t.valueSpec)?h.push(new Et(t.key,t.value,"property functions not supported")):s&&!Ni(t.valueSpec)&&h.push(new Et(t.key,t.value,"zoom functions not supported"))),"categorical"!==r&&!c||void 0!==t.value.property||h.push(new Et(t.key,t.value,'"property" property is required')),h;function u(t){let r=[];const i=t.value,s=t.key;if("array"!==$i(i))return[new Et(s,i,`array expected, ${$i(i)} found`)];if(2!==i.length)return[new Et(s,i,`array length 2 expected, length ${i.length} found`)];if(c){if("object"!==$i(i[0]))return[new Et(s,i,`object expected, ${$i(i[0])} found`)];if(void 0===i[0].zoom)return[new Et(s,i,"object stop key must have zoom")];if(void 0===i[0].value)return[new Et(s,i,"object stop key must have value")];if(o&&o>xn(i[0].zoom))return[new Et(s,i[0].zoom,"stop zoom values must appear in ascending order")];xn(i[0].zoom)!==o&&(o=xn(i[0].zoom),n=void 0,a={}),r=r.concat(Tn({key:`${s}[0]`,value:i[0],valueSpec:{zoom:{}},validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{zoom:Pn,value:p}}))}else r=r.concat(p({key:`${s}[0]`,value:i[0],validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec},i));return Qi(wn(i[1]))?r.concat([new Et(`${s}[1]`,i[1],"expressions are not allowed in function stops.")]):r.concat(t.validateSpec({key:`${s}[1]`,value:i[1],valueSpec:e,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec}))}function p(t,o){const s=$i(t.value),l=xn(t.value),c=null!==t.value?t.value:o;if(i){if(s!==i)return[new Et(t.key,c,`${s} stop domain type must match previous stop domain type ${i}`)]}else i=s;if("number"!==s&&"string"!==s&&"boolean"!==s)return[new Et(t.key,c,"stop domain value must be a number, string, or boolean")];if("number"!==s&&"categorical"!==r){let i=`number expected, ${s} found`;return Ui(e)&&void 0===r&&(i+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new Et(t.key,c,i)]}return"categorical"!==r||"number"!==s||isFinite(l)&&Math.floor(l)===l?"categorical"!==r&&"number"===s&&void 0!==n&&l<n?[new Et(t.key,c,"stop domain values must appear in ascending order")]:(n=l,"categorical"===r&&l in a?[new Et(t.key,c,"stop domain values must be unique")]:(a[l]=!0,[])):[new Et(t.key,c,`integer expected, found ${l}`)]}}function Mn(t){const e=("property"===t.expressionContext?nn:tn)(wn(t.value),t.valueSpec);if("error"===e.result)return e.value.map(e=>new Et(`${t.key}${e.key}`,t.value,e.message));const r=e.value.expression||e.value._styleExpression.expression;if("property"===t.expressionContext&&"text-font"===t.propertyKey&&!r.outputDefined())return[new Et(t.key,t.value,`Invalid data expression for "${t.propertyKey}". Output values must be contained as literals within the expression.`)];if("property"===t.expressionContext&&"layout"===t.propertyType&&!Fi(r))return[new Et(t.key,t.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===t.expressionContext&&!Fi(r))return[new Et(t.key,t.value,'"feature-state" data expressions are not supported with filters.')];if(t.expressionContext&&0===t.expressionContext.indexOf("cluster")){if(!Bi(r,["zoom","feature-state"]))return[new Et(t.key,t.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===t.expressionContext&&!Li(r))return[new Et(t.key,t.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function An(t){const e=t.key,r=t.value,i=$i(r);return"string"!==i?[new Et(e,r,`color expected, ${i} found`)]:Ce.parse(String(r))?[]:[new Et(e,r,`color expected, "${r}" found`)]}function In(t){const e=t.key,r=t.value,i=t.valueSpec,n=[];return Array.isArray(i.values)?-1===i.values.indexOf(xn(r))&&n.push(new Et(e,r,`expected one of [${i.values.join(", ")}], ${JSON.stringify(r)} found`)):-1===Object.keys(i.values).indexOf(xn(r))&&n.push(new Et(e,r,`expected one of [${Object.keys(i.values).join(", ")}], ${JSON.stringify(r)} found`)),n}function En(t){return ln(wn(t.value))?Mn(kt({},t,{expressionContext:"filter",valueSpec:{value:"boolean"}})):kn(t)}function kn(t){const e=t.value,r=t.key;if("array"!==$i(e))return[new Et(r,e,`array expected, ${$i(e)} found`)];const i=t.styleSpec;let n,o=[];if(e.length<1)return[new Et(r,e,"filter array must have at least 1 element")];switch(o=o.concat(In({key:`${r}[0]`,value:e[0],valueSpec:i.filter_operator,style:t.style,styleSpec:t.styleSpec})),xn(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&"$type"===xn(e[1])&&o.push(new Et(r,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":3!==e.length&&o.push(new Et(r,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(n=$i(e[1]),"string"!==n&&o.push(new Et(`${r}[1]`,e[1],`string expected, ${n} found`)));for(let a=2;a<e.length;a++)n=$i(e[a]),"$type"===xn(e[1])?o=o.concat(In({key:`${r}[${a}]`,value:e[a],valueSpec:i.geometry_type,style:t.style,styleSpec:t.styleSpec})):"string"!==n&&"number"!==n&&"boolean"!==n&&o.push(new Et(`${r}[${a}]`,e[a],`string, number, or boolean expected, ${n} found`));break;case"any":case"all":case"none":for(let i=1;i<e.length;i++)o=o.concat(kn({key:`${r}[${i}]`,value:e[i],style:t.style,styleSpec:t.styleSpec}));break;case"has":case"!has":n=$i(e[1]),2!==e.length?o.push(new Et(r,e,`filter array for "${e[0]}" operator must have 2 elements`)):"string"!==n&&o.push(new Et(`${r}[1]`,e[1],`string expected, ${n} found`))}return o}function zn(t,e){const r=t.key,i=t.validateSpec,n=t.style,o=t.styleSpec,a=t.value,s=t.objectKey,l=o[`${e}_${t.layerType}`];if(!l)return[];const c=s.match(/^(.*)-transition$/);if("paint"===e&&c&&l[c[1]]&&l[c[1]].transition)return i({key:r,value:a,valueSpec:o.transition,style:n,styleSpec:o});const h=t.valueSpec||l[s];if(!h)return[new Et(r,a,`unknown property "${s}"`)];let u;if("string"===$i(a)&&Ui(h)&&!h.tokens&&(u=/^{([^}]+)}$/.exec(a)))return[new Et(r,a,`"${s}" does not support interpolation syntax\nUse an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(u[1])} }\`.`)];const p=[];return"symbol"===t.layerType&&("text-field"===s&&n&&!n.glyphs&&p.push(new Et(r,a,'use of "text-field" requires a style "glyphs" property')),"text-font"===s&&Zi(wn(a))&&"identity"===xn(a.type)&&p.push(new Et(r,a,'"text-font" does not support identity functions'))),p.concat(i({key:t.key,value:a,valueSpec:h,style:n,styleSpec:o,expressionContext:"property",propertyType:e,propertyKey:s}))}function Rn(t){return zn(t,"paint")}function Dn(t){return zn(t,"layout")}function Ln(t){let e=[];const r=t.value,i=t.key,n=t.style,o=t.styleSpec;if("object"!==$i(r))return[new Et(i,r,`object expected, ${$i(r)} found`)];r.type||r.ref||e.push(new Et(i,r,'either "type" or "ref" is required'));let a=xn(r.type);const s=xn(r.ref);if(r.id){const o=xn(r.id);for(let a=0;a<t.arrayIndex;a++){const t=n.layers[a];xn(t.id)===o&&e.push(new Et(i,r.id,`duplicate layer id "${r.id}", previously used at line ${t.id.__line__}`))}}if("ref"in r){let t;["type","source","source-layer","filter","layout"].forEach(t=>{t in r&&e.push(new Et(i,r[t],`"${t}" is prohibited for ref layers`))}),n.layers.forEach(e=>{xn(e.id)===s&&(t=e)}),t?t.ref?e.push(new Et(i,r.ref,"ref cannot reference another ref layer")):a=xn(t.type):e.push(new Et(i,r.ref,`ref layer "${s}" not found`))}else if("background"!==a)if(r.source){const t=n.sources&&n.sources[r.source],o=t&&xn(t.type);t?"vector"===o&&"raster"===a?e.push(new Et(i,r.source,`layer "${r.id}" requires a raster source`)):"raster-dem"!==o&&"hillshade"===a||"raster-dem"!==o&&"color-relief"===a?e.push(new Et(i,r.source,`layer "${r.id}" requires a raster-dem source`)):"raster"===o&&"raster"!==a?e.push(new Et(i,r.source,`layer "${r.id}" requires a vector source`)):"vector"!==o||r["source-layer"]?"raster-dem"===o&&"hillshade"!==a&&"color-relief"!==a?e.push(new Et(i,r.source,"raster-dem source can only be used with layer type 'hillshade' or 'color-relief'.")):"line"!==a||!r.paint||!r.paint["line-gradient"]||"geojson"===o&&t.lineMetrics||e.push(new Et(i,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):e.push(new Et(i,r,`layer "${r.id}" must specify a "source-layer"`)):e.push(new Et(i,r.source,`source "${r.source}" not found`))}else e.push(new Et(i,r,'missing required property "source"'));return e=e.concat(Tn({key:i,value:r,valueSpec:o.layer,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*":()=>[],type:()=>t.validateSpec({key:`${i}.type`,value:r.type,valueSpec:o.layer.type,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,object:r,objectKey:"type"}),filter:En,layout:t=>Tn({layer:r,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*":t=>Dn(kt({layerType:a},t))}}),paint:t=>Tn({layer:r,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*":t=>Rn(kt({layerType:a},t))}})}})),e}function Fn(t){const e=t.value,r=t.key,i=$i(e);return"string"!==i?[new Et(r,e,`string expected, ${i} found`)]:[]}const Bn={promoteId:function({key:t,value:e}){if("string"===$i(e))return Fn({key:t,value:e});{const r=[];for(const i in e)r.push(...Fn({key:`${t}.${i}`,value:e[i]}));return r}}};function On(t){const e=t.value,r=t.key,i=t.styleSpec,n=t.style,o=t.validateSpec;if(!e.type)return[new Et(r,e,'"type" is required')];const a=xn(e.type);let s;switch(a){case"vector":case"raster":return s=Tn({key:r,value:e,valueSpec:i[`source_${a.replace("-","_")}`],style:t.style,styleSpec:i,objectElementValidators:Bn,validateSpec:o}),s;case"raster-dem":return s=function(t){var e;const r=null!==(e=t.sourceName)&&void 0!==e?e:"",i=t.value,n=t.styleSpec,o=n.source_raster_dem,a=t.style;let s=[];const l=$i(i);if(void 0===i)return s;if("object"!==l)return s.push(new Et("source_raster_dem",i,`object expected, ${l} found`)),s;const c="custom"===xn(i.encoding),h=["redFactor","greenFactor","blueFactor","baseShift"],u=t.value.encoding?`"${t.value.encoding}"`:"Default";for(const e in i)!c&&h.includes(e)?s.push(new Et(e,i[e],`In "${r}": "${e}" is only valid when "encoding" is set to "custom". ${u} encoding found`)):o[e]?s=s.concat(t.validateSpec({key:e,value:i[e],valueSpec:o[e],validateSpec:t.validateSpec,style:a,styleSpec:n})):s.push(new Et(e,i[e],`unknown property "${e}"`));return s}({sourceName:r,value:e,style:t.style,styleSpec:i,validateSpec:o}),s;case"geojson":if(s=Tn({key:r,value:e,valueSpec:i.source_geojson,style:n,styleSpec:i,validateSpec:o,objectElementValidators:Bn}),e.cluster)for(const t in e.clusterProperties){const[i,n]=e.clusterProperties[t],o="string"==typeof i?[i,["accumulated"],["get",t]]:i;s.push(...Mn({key:`${r}.${t}.map`,value:n,expressionContext:"cluster-map"})),s.push(...Mn({key:`${r}.${t}.reduce`,value:o,expressionContext:"cluster-reduce"}))}return s;case"video":return Tn({key:r,value:e,valueSpec:i.source_video,style:n,validateSpec:o,styleSpec:i});case"image":return Tn({key:r,value:e,valueSpec:i.source_image,style:n,validateSpec:o,styleSpec:i});case"canvas":return[new Et(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return In({key:`${r}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]}})}}function jn(t){const e=t.value,r=t.styleSpec,i=r.light,n=t.style;let o=[];const a=$i(e);if(void 0===e)return o;if("object"!==a)return o=o.concat([new Et("light",e,`object expected, ${a} found`)]),o;for(const a in e){const s=a.match(/^(.*)-transition$/);o=o.concat(s&&i[s[1]]&&i[s[1]].transition?t.validateSpec({key:a,value:e[a],valueSpec:r.transition,validateSpec:t.validateSpec,style:n,styleSpec:r}):i[a]?t.validateSpec({key:a,value:e[a],valueSpec:i[a],validateSpec:t.validateSpec,style:n,styleSpec:r}):[new Et(a,e[a],`unknown property "${a}"`)])}return o}function Un(t){const e=t.value,r=t.styleSpec,i=r.sky,n=t.style,o=$i(e);if(void 0===e)return[];if("object"!==o)return[new Et("sky",e,`object expected, ${o} found`)];let a=[];for(const o in e)a=a.concat(i[o]?t.validateSpec({key:o,value:e[o],valueSpec:i[o],style:n,styleSpec:r}):[new Et(o,e[o],`unknown property "${o}"`)]);return a}function Nn(t){const e=t.value,r=t.styleSpec,i=r.terrain,n=t.style;let o=[];const a=$i(e);if(void 0===e)return o;if("object"!==a)return o=o.concat([new Et("terrain",e,`object expected, ${a} found`)]),o;for(const a in e)o=o.concat(i[a]?t.validateSpec({key:a,value:e[a],valueSpec:i[a],validateSpec:t.validateSpec,style:n,styleSpec:r}):[new Et(a,e[a],`unknown property "${a}"`)]);return o}function Vn(t){let e=[];const r=t.value,i=t.key;if(Array.isArray(r)){const n=[],o=[];for(const a in r)r[a].id&&n.includes(r[a].id)&&e.push(new Et(i,r,`all the sprites' ids must be unique, but ${r[a].id} is duplicated`)),n.push(r[a].id),r[a].url&&o.includes(r[a].url)&&e.push(new Et(i,r,`all the sprites' URLs must be unique, but ${r[a].url} is duplicated`)),o.push(r[a].url),e=e.concat(Tn({key:`${i}[${a}]`,value:r[a],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:t.validateSpec}));return e}return Fn({key:i,value:r})}function $n(t){return e=t.value,Boolean(e)&&e.constructor===Object?[]:[new Et(t.key,t.value,`object expected, ${$i(t.value)} found`)];var e}const Zn={"*":()=>[],array:Sn,boolean:function(t){const e=t.value,r=t.key,i=$i(e);return"boolean"!==i?[new Et(r,e,`boolean expected, ${i} found`)]:[]},number:Pn,color:An,constants:vn,enum:In,filter:En,function:Cn,layer:Ln,object:Tn,source:On,light:jn,sky:Un,terrain:Nn,projection:function(t){const e=t.value,r=t.styleSpec,i=r.projection,n=t.style,o=$i(e);if(void 0===e)return[];if("object"!==o)return[new Et("projection",e,`object expected, ${o} found`)];let a=[];for(const o in e)a=a.concat(i[o]?t.validateSpec({key:o,value:e[o],valueSpec:i[o],style:n,styleSpec:r}):[new Et(o,e[o],`unknown property "${o}"`)]);return a},projectionDefinition:function(t){const e=t.key;let r=t.value;r=r instanceof String?r.valueOf():r;const i=$i(r);return"array"!==i||function(t){return Array.isArray(t)&&3===t.length&&"string"==typeof t[0]&&"string"==typeof t[1]&&"number"==typeof t[2]}(r)||function(t){return!!["interpolate","step","literal"].includes(t[0])}(r)?["array","string"].includes(i)?[]:[new Et(e,r,`projection expected, invalid type "${i}" found`)]:[new Et(e,r,`projection expected, invalid array ${JSON.stringify(r)} found`)]},string:Fn,formatted:function(t){return 0===Fn(t).length?[]:Mn(t)},resolvedImage:function(t){return 0===Fn(t).length?[]:Mn(t)},padding:function(t){const e=t.key,r=t.value;if("array"===$i(r)){if(r.length<1||r.length>4)return[new Et(e,r,`padding requires 1 to 4 values; ${r.length} values found`)];const i={type:"number"};let n=[];for(let o=0;o<r.length;o++)n=n.concat(t.validateSpec({key:`${e}[${o}]`,value:r[o],validateSpec:t.validateSpec,valueSpec:i}));return n}return Pn({key:e,value:r,valueSpec:{}})},numberArray:function(t){const e=t.key,r=t.value;if("array"===$i(r)){const i={type:"number"};if(r.length<1)return[new Et(e,r,"array length at least 1 expected, length 0 found")];let n=[];for(let o=0;o<r.length;o++)n=n.concat(t.validateSpec({key:`${e}[${o}]`,value:r[o],validateSpec:t.validateSpec,valueSpec:i}));return n}return Pn({key:e,value:r,valueSpec:{}})},colorArray:function(t){const e=t.key,r=t.value;if("array"===$i(r)){if(r.length<1)return[new Et(e,r,"array length at least 1 expected, length 0 found")];let t=[];for(let i=0;i<r.length;i++)t=t.concat(An({key:`${e}[${i}]`,value:r[i]}));return t}return An({key:e,value:r})},variableAnchorOffsetCollection:function(t){const e=t.key,r=t.value,i=$i(r),n=t.styleSpec;if("array"!==i||r.length<1||r.length%2!=0)return[new Et(e,r,"variableAnchorOffsetCollection requires a non-empty array of even length")];let o=[];for(let i=0;i<r.length;i+=2)o=o.concat(In({key:`${e}[${i}]`,value:r[i],valueSpec:n.layout_symbol["text-anchor"]})),o=o.concat(Sn({key:`${e}[${i+1}]`,value:r[i+1],valueSpec:{length:2,value:"number"},validateSpec:t.validateSpec,style:t.style,styleSpec:n}));return o},sprite:Vn,state:$n};function Gn(t){const e=t.value,r=t.valueSpec,i=t.styleSpec;return t.validateSpec=Gn,r.expression&&Zi(xn(e))?Cn(t):r.expression&&Qi(wn(e))?Mn(t):r.type&&Zn[r.type]?Zn[r.type](t):Tn(kt({},t,{valueSpec:r.type?i[r.type]:r}))}function qn(t){const e=t.value,r=t.key,i=Fn(t);return i.length||(-1===e.indexOf("{fontstack}")&&i.push(new Et(r,e,'"glyphs" url must include a "{fontstack}" token')),-1===e.indexOf("{range}")&&i.push(new Et(r,e,'"glyphs" url must include a "{range}" token'))),i}function Hn(t,e=yt){let r=[];return r=r.concat(Gn({key:"",value:t,valueSpec:e.$root,styleSpec:e,style:t,validateSpec:Gn,objectElementValidators:{glyphs:qn,"*":()=>[]}})),t.constants&&(r=r.concat(vn({key:"constants",value:t.constants}))),Xn(r)}function Wn(t){return function(e){return t({...e,validateSpec:Gn})}}function Xn(t){return[].concat(t).sort((t,e)=>t.line-e.line)}function Kn(t){return function(...e){return Xn(t.apply(this,e))}}Hn.source=Kn(Wn(On)),Hn.sprite=Kn(Wn(Vn)),Hn.glyphs=Kn(Wn(qn)),Hn.light=Kn(Wn(jn)),Hn.sky=Kn(Wn(Un)),Hn.terrain=Kn(Wn(Nn)),Hn.state=Kn(Wn($n)),Hn.layer=Kn(Wn(Ln)),Hn.filter=Kn(Wn(En)),Hn.paintProperty=Kn(Wn(Rn)),Hn.layoutProperty=Kn(Wn(Dn));const Yn=Hn,Jn=Yn.light,Qn=Yn.sky,to=Yn.paintProperty,eo=Yn.layoutProperty;function ro(t,e){let r=!1;if(e&&e.length)for(const i of e)t.fire(new gt(new Error(i.message))),r=!0;return r}class io{constructor(t,e,r){const i=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;const n=new Int32Array(this.arrayBuffer);t=n[0],this.d=(e=n[1])+2*(r=n[2]);for(let t=0;t<this.d*this.d;t++){const e=n[3+t],r=n[3+t+1];i.push(e===r?null:n.subarray(e,r))}const o=n[3+i.length+1];this.keys=n.subarray(n[3+i.length],o),this.bboxes=n.subarray(o),this.insert=this._insertReadonly}else{this.d=e+2*r;for(let t=0;t<this.d*this.d;t++)i.push([]);this.keys=[],this.bboxes=[]}this.n=e,this.extent=t,this.padding=r,this.scale=e/t,this.uid=0;const 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,o){this.cells[n].push(o)}query(t,e,r,i,n){const o=this.min,a=this.max;if(t<=o&&e<=o&&a<=r&&a<=i&&!n)return Array.prototype.slice.call(this.keys);{const o=[];return this._forEachCell(t,e,r,i,this._queryCell,o,{},n),o}}_queryCell(t,e,r,i,n,o,a,s){const l=this.cells[n];if(null!==l){const n=this.keys,c=this.bboxes;for(let h=0;h<l.length;h++){const u=l[h];if(void 0===a[u]){const l=4*u;(s?s(c[l+0],c[l+1],c[l+2],c[l+3]):t<=c[l+2]&&e<=c[l+3]&&r>=c[l+0]&&i>=c[l+1])?(a[u]=!0,o.push(n[u])):a[u]=!1}}}}_forEachCell(t,e,r,i,n,o,a,s){const l=this._convertToCellCoord(t),c=this._convertToCellCoord(e),h=this._convertToCellCoord(r),u=this._convertToCellCoord(i);for(let p=l;p<=h;p++)for(let l=c;l<=u;l++){const c=this.d*l+p;if((!s||s(this._convertFromCellCoord(p),this._convertFromCellCoord(l),this._convertFromCellCoord(p+1),this._convertFromCellCoord(l+1)))&&n.call(this,t,e,r,i,c,o,a,s))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;const t=this.cells,e=3+this.cells.length+1+1;let r=0;for(let t=0;t<this.cells.length;t++)r+=this.cells[t].length;const 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 e=0;e<t.length;e++){const r=t[e];i[3+e]=n,i.set(r,n),n+=r.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){const r=t.toArrayBuffer();return e&&e.push(r),{buffer:r}}static deserialize(t){return new io(t.buffer)}}const no={};function oo(t,e,r={}){if(no[t])throw new Error(`${t} is already registered.`);Object.defineProperty(e,"_classRegistryKey",{value:t,writeable:!1}),no[t]={klass:e,omit:r.omit||[],shallow:r.shallow||[]}}oo("Object",Object),oo("Set",Set),oo("TransferableGridIndex",io),oo("Color",Ce),oo("Error",Error),oo("AJAXError",ct),oo("ResolvedImage",Be),oo("StylePropertyFunction",on),oo("StyleExpression",Ji,{omit:["_evaluator"]}),oo("ZoomDependentExpression",rn),oo("ZoomConstantExpression",en),oo("CompoundExpression",Ii,{omit:["_evaluate"]});for(const t in Ai)Ai[t]._classRegistryKey||oo(`Expression_${t}`,Ai[t]);function ao(t){return t&&"undefined"!=typeof ArrayBuffer&&(t instanceof ArrayBuffer||t.constructor&&"ArrayBuffer"===t.constructor.name)}function so(t){return t.$name||t.constructor._classRegistryKey}function lo(t){return!function(t){if(null===t||"object"!=typeof t)return!1;const e=so(t);return!(!e||"Object"===e)}(t)&&(null==t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp||t instanceof Blob||t instanceof Error||ao(t)||W(t)||ArrayBuffer.isView(t)||t instanceof ImageData)}function co(t,e){if(lo(t))return(ao(t)||W(t))&&e&&e.push(t),ArrayBuffer.isView(t)&&e&&e.push(t.buffer),t instanceof ImageData&&e&&e.push(t.data.buffer),t;if(Array.isArray(t)){const r=[];for(const i of t)r.push(co(i,e));return r}if("object"!=typeof t)throw new Error("can't serialize object of type "+typeof t);const r=so(t);if(!r)throw new Error(`can't serialize object of unregistered class ${t.constructor.name}`);if(!no[r])throw new Error(`${r} is not registered.`);const{klass:i}=no[r],n=i.serialize?i.serialize(t,e):{};if(i.serialize){if(e&&n===e[e.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(const i in t){if(!t.hasOwnProperty(i))continue;if(no[r].omit.indexOf(i)>=0)continue;const o=t[i];n[i]=no[r].shallow.indexOf(i)>=0?o:co(o,e)}t instanceof Error&&(n.message=t.message)}if(n.$name)throw new Error("$name property is reserved for worker serialization logic.");return"Object"!==r&&(n.$name=r),n}function ho(t){if(lo(t))return t;if(Array.isArray(t))return t.map(ho);if("object"!=typeof t)throw new Error("can't deserialize object of type "+typeof t);const e=so(t)||"Object";if(!no[e])throw new Error(`can't deserialize unregistered class ${e}`);const{klass:r}=no[e];if(!r)throw new Error(`can't deserialize unregistered class ${e}`);if(r.deserialize)return r.deserialize(t);const i=Object.create(r.prototype);for(const r of Object.keys(t)){if("$name"===r)continue;const n=t[r];i[r]=no[e].shallow.indexOf(r)>=0?n:ho(n)}return i}class uo{constructor(){this.first=!0}update(t,e){const 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))}}const po={"Latin-1 Supplement":t=>t>=128&&t<=255,"Hangul Jamo":t=>t>=4352&&t<=4607,Khmer:t=>t>=6016&&t<=6143,"General Punctuation":t=>t>=8192&&t<=8303,"Letterlike Symbols":t=>t>=8448&&t<=8527,"Number Forms":t=>t>=8528&&t<=8591,"Miscellaneous Technical":t=>t>=8960&&t<=9215,"Control Pictures":t=>t>=9216&&t<=9279,"Optical Character Recognition":t=>t>=9280&&t<=9311,"Enclosed Alphanumerics":t=>t>=9312&&t<=9471,"Geometric Shapes":t=>t>=9632&&t<=9727,"Miscellaneous Symbols":t=>t>=9728&&t<=9983,"Miscellaneous Symbols and Arrows":t=>t>=11008&&t<=11263,"Ideographic Description Characters":t=>t>=12272&&t<=12287,"CJK Symbols and Punctuation":t=>t>=12288&&t<=12351,Hiragana:t=>t>=12352&&t<=12447,Katakana:t=>t>=12448&&t<=12543,Kanbun:t=>t>=12688&&t<=12703,"CJK Strokes":t=>t>=12736&&t<=12783,"Enclosed CJK Letters and Months":t=>t>=12800&&t<=13055,"CJK Compatibility":t=>t>=13056&&t<=13311,"Yijing Hexagram Symbols":t=>t>=19904&&t<=19967,"CJK Unified Ideographs":t=>t>=19968&&t<=40959,"Hangul Syllables":t=>t>=44032&&t<=55215,"Private Use Area":t=>t>=57344&&t<=63743,"Vertical Forms":t=>t>=65040&&t<=65055,"CJK Compatibility Forms":t=>t>=65072&&t<=65103,"Small Form Variants":t=>t>=65104&&t<=65135,"Halfwidth and Fullwidth Forms":t=>t>=65280&&t<=65519};function fo(t){for(const e of t)if(vo(e.charCodeAt(0)))return!0;return!1}function mo(t){for(const e of t)if(!yo(e.charCodeAt(0)))return!1;return!0}function go(t){const e=t.map(t=>{try{return new RegExp(`\\p{sc=${t}}`,"u").source}catch(t){return null}}).filter(t=>t);return new RegExp(e.join("|"),"u")}const _o=go(["Arab","Dupl","Mong","Ougr","Syrc"]);function yo(t){return!_o.test(String.fromCodePoint(t))}const bo=go(["Bopo","Hani","Hira","Kana","Kits","Nshu","Tang","Yiii"]);function vo(t){return!(746!==t&&747!==t&&(t<4352||!(po["CJK Compatibility Forms"](t)&&!(t>=65097&&t<=65103)||po["CJK Compatibility"](t)||po["CJK Strokes"](t)||!(!po["CJK Symbols and Punctuation"](t)||t>=12296&&t<=12305||t>=12308&&t<=12319||12336===t)||po["Enclosed CJK Letters and Months"](t)||po["Ideographic Description Characters"](t)||po.Kanbun(t)||po.Katakana(t)&&12540!==t||!(!po["Halfwidth and Fullwidth Forms"](t)||65288===t||65289===t||65293===t||t>=65306&&t<=65310||65339===t||65341===t||65343===t||t>=65371&&t<=65503||65507===t||t>=65512&&t<=65519)||!(!po["Small Form Variants"](t)||t>=65112&&t<=65118||t>=65123&&t<=65126)||po["Vertical Forms"](t)||po["Yijing Hexagram Symbols"](t)||/\p{sc=Cans}/u.test(String.fromCodePoint(t))||/\p{sc=Hang}/u.test(String.fromCodePoint(t))||bo.test(String.fromCodePoint(t)))))}function xo(t){return!(vo(t)||function(t){return!!(po["Latin-1 Supplement"](t)&&(167===t||169===t||174===t||177===t||188===t||189===t||190===t||215===t||247===t)||po["General Punctuation"](t)&&(8214===t||8224===t||8225===t||8240===t||8241===t||8251===t||8252===t||8258===t||8263===t||8264===t||8265===t||8273===t)||po["Letterlike Symbols"](t)||po["Number Forms"](t)||po["Miscellaneous Technical"](t)&&(t>=8960&&t<=8967||t>=8972&&t<=8991||t>=8996&&t<=9e3||9003===t||t>=9085&&t<=9114||t>=9150&&t<=9165||9167===t||t>=9169&&t<=9179||t>=9186&&t<=9215)||po["Control Pictures"](t)&&9251!==t||po["Optical Character Recognition"](t)||po["Enclosed Alphanumerics"](t)||po["Geometric Shapes"](t)||po["Miscellaneous Symbols"](t)&&!(t>=9754&&t<=9759)||po["Miscellaneous Symbols and Arrows"](t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||po["CJK Symbols and Punctuation"](t)||po.Katakana(t)||po["Private Use Area"](t)||po["CJK Compatibility Forms"](t)||po["Small Form Variants"](t)||po["Halfwidth and Fullwidth Forms"](t)||8734===t||8756===t||8757===t||t>=9984&&t<=10087||t>=10102&&t<=10131||65532===t||65533===t)}(t))}const wo=go(["Adlm","Arab","Armi","Avst","Chrs","Cprt","Egyp","Elym","Gara","Hatr","Hebr","Hung","Khar","Lydi","Mand","Mani","Mend","Merc","Mero","Narb","Nbat","Nkoo","Orkh","Palm","Phli","Phlp","Phnx","Prti","Rohg","Samr","Sarb","Sogo","Syrc","Thaa","Todr","Yezi"]);function To(t){return wo.test(String.fromCodePoint(t))}function So(t,e){return!(!e&&To(t)||t>=2304&&t<=3583||t>=3840&&t<=4255||po.Khmer(t))}function Po(t){for(const e of t)if(To(e.charCodeAt(0)))return!0;return!1}const Co=new class{constructor(){this.TIMEOUT=5e3,this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null,this.loadScriptResolve=()=>{}}setState(t){this.pluginStatus=t.pluginStatus,this.pluginURL=t.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(t){if(Co.isParsed())throw new Error("RTL text plugin already registered.");this.applyArabicShaping=t.applyArabicShaping,this.processBidirectionalText=t.processBidirectionalText,this.processStyledBidirectionalText=t.processStyledBidirectionalText,this.loadScriptResolve()}isParsed(){return null!=this.applyArabicShaping&&null!=this.processBidirectionalText&&null!=this.processStyledBidirectionalText}getRTLTextPluginStatus(){return this.pluginStatus}syncState(t,r){return e(this,void 0,void 0,function*(){if(this.isParsed())return this.getState();if("loading"!==t.pluginStatus)return this.setState(t),t;const e=t.pluginURL,i=new Promise(t=>{this.loadScriptResolve=t});r(e);const n=new Promise(t=>setTimeout(()=>t(),this.TIMEOUT));if(yield Promise.race([i,n]),this.isParsed()){const t={pluginStatus:"loaded",pluginURL:e};return this.setState(t),t}throw this.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${e}`)})}};class Mo{constructor(t,e){this.zoom=t,e?(this.now=e.now||0,this.fadeDuration=e.fadeDuration||0,this.zoomHistory=e.zoomHistory||new uo,this.transition=e.transition||{},this.globalState=e.globalState||{}):(this.now=0,this.fadeDuration=0,this.zoomHistory=new uo,this.transition={},this.globalState={})}isSupportedScript(t){return function(t,e){for(const r of t)if(!So(r.charCodeAt(0),e))return!1;return!0}(t,"loaded"===Co.getRTLTextPluginStatus())}crossFadingFactor(){return 0===this.fadeDuration?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const 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}}}class Ao{constructor(t,e){this.property=t,this.value=e,this.expression=function(t,e){if(Zi(t))return new on(t,e);if(Qi(t)){const r=nn(t,e);if("error"===r.result)throw new Error(r.value.map(t=>`${t.key}: ${t.message}`).join(", "));return r.value}{let r=t;return"color"===e.type&&"string"==typeof t?r=Ce.parse(t):"padding"!==e.type||"number"!=typeof t&&!Array.isArray(t)?"numberArray"!==e.type||"number"!=typeof t&&!Array.isArray(t)?"colorArray"!==e.type||"string"!=typeof t&&!Array.isArray(t)?"variableAnchorOffsetCollection"===e.type&&Array.isArray(t)?r=Fe.parse(t):"projectionDefinition"===e.type&&"string"==typeof t&&(r=Oe.parse(t)):r=Re.parse(t):r=ze.parse(t):r=ke.parse(t),{globalStateRefs:new Set,kind:"constant",evaluate:()=>r}}}(void 0===e?t.specification.default:e,t.specification)}isDataDriven(){return"source"===this.expression.kind||"composite"===this.expression.kind}getGlobalStateRefs(){return this.expression.globalStateRefs||new Set}possiblyEvaluate(t,e,r){return this.property.possiblyEvaluate(this,t,e,r)}}class Io{constructor(t){this.property=t,this.value=new Ao(t,void 0)}transitioned(t,e){return new ko(this.property,this.value,e,O({},t.transition,this.transition),t.now)}untransitioned(){return new ko(this.property,this.value,null,{},0)}}class Eo{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues)}getValue(t){return V(this._values[t].value.value)}setValue(t,e){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new Io(this._values[t].property)),this._values[t].value=new Ao(this._values[t].property,null===e?void 0:V(e))}getTransition(t){return V(this._values[t].transition)}setTransition(t,e){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new Io(this._values[t].property)),this._values[t].transition=V(e)||void 0}serialize(){const t={};for(const e of Object.keys(this._values)){const r=this.getValue(e);void 0!==r&&(t[e]=r);const i=this.getTransition(e);void 0!==i&&(t[`${e}-transition`]=i)}return t}transitioned(t,e){const r=new zo(this._properties);for(const i of Object.keys(this._values))r._values[i]=this._values[i].transitioned(t,e._values[i]);return r}untransitioned(){const t=new zo(this._properties);for(const e of Object.keys(this._values))t._values[e]=this._values[e].untransitioned();return t}}class ko{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){const i=t.now||0,n=this.value.possiblyEvaluate(t,e,r),o=this.prior;if(o){if(i>this.end)return this.prior=null,n;if(this.value.isDataDriven())return this.prior=null,n;if(i<this.begin)return o.possiblyEvaluate(t,e,r);{const a=(i-this.begin)/(this.end-this.begin);return this.property.interpolate(o.possiblyEvaluate(t,e,r),n,R(a))}}return n}}class zo{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)}possiblyEvaluate(t,e,r){const i=new Lo(this._properties);for(const n of Object.keys(this._values))i._values[n]=this._values[n].possiblyEvaluate(t,e,r);return i}hasTransition(){for(const t of Object.keys(this._values))if(this._values[t].prior)return!0;return!1}}class Ro{constructor(t){this._properties=t,this._values=Object.create(t.defaultPropertyValues)}hasValue(t){return void 0!==this._values[t].value}getValue(t){return V(this._values[t].value)}setValue(t,e){this._values[t]=new Ao(this._values[t].property,null===e?void 0:V(e))}serialize(){const t={};for(const e of Object.keys(this._values)){const r=this.getValue(e);void 0!==r&&(t[e]=r)}return t}possiblyEvaluate(t,e,r){const i=new Lo(this._properties);for(const n of Object.keys(this._values))i._values[n]=this._values[n].possiblyEvaluate(t,e,r);return i}}class Do{constructor(t,e,r){this.property=t,this.value=e,this.parameters=r}isConstant(){return"constant"===this.value.kind}constantOr(t){return"constant"===this.value.kind?this.value.value:t}evaluate(t,e,r,i){return this.property.evaluate(this.value,this.parameters,t,e,r,i)}}class Lo{constructor(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues)}get(t){return this._values[t]}}class Fo{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){const i=dr[this.specification.type];return i?i(t,e,r):t}}class Bo{constructor(t,e){this.specification=t,this.overrides=e}possiblyEvaluate(t,e,r,i){return new Do(this,"constant"===t.expression.kind||"camera"===t.expression.kind?{kind:"constant",value:t.expression.evaluate(e,null,{},r,i)}:t.expression,e)}interpolate(t,e,r){if("constant"!==t.value.kind||"constant"!==e.value.kind)return t;if(void 0===t.value.value||void 0===e.value.value)return new Do(this,{kind:"constant",value:void 0},t.parameters);const i=dr[this.specification.type];if(i){const n=i(t.value.value,e.value.value,r);return new Do(this,{kind:"constant",value:n},t.parameters)}return t}evaluate(t,e,r,i,n,o){return"constant"===t.kind?t.value:t.evaluate(e,r,i,n,o)}}class Oo extends Bo{possiblyEvaluate(t,e,r,i){if(void 0===t.value)return new Do(this,{kind:"constant",value:void 0},e);if("constant"===t.expression.kind){const n=t.expression.evaluate(e,null,{},r,i),o="resolvedImage"===t.property.specification.type&&"string"!=typeof n?n.name:n,a=this._calculate(o,o,o,e);return new Do(this,{kind:"constant",value:a},e)}if("camera"===t.expression.kind){const r=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 Do(this,{kind:"constant",value:r},e)}return new Do(this,t.expression,e)}evaluate(t,e,r,i,n,o){if("source"===t.kind){const a=t.evaluate(e,r,i,n,o);return this._calculate(a,a,a,e)}return"composite"===t.kind?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}}class jo{constructor(t){this.specification=t}possiblyEvaluate(t,e,r,i){if(void 0!==t.value){if("constant"===t.expression.kind){const n=t.expression.evaluate(e,null,{},r,i);return this._calculate(n,n,n,e)}return this._calculate(t.expression.evaluate(new Mo(Math.floor(e.zoom-1),e)),t.expression.evaluate(new Mo(Math.floor(e.zoom),e)),t.expression.evaluate(new Mo(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}}class Uo{constructor(t){this.specification=t}possiblyEvaluate(t,e,r,i){return!!t.expression.evaluate(e,null,{},r,i)}interpolate(){return!1}}class No{constructor(t){this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const e in t){const r=t[e];r.specification.overridable&&this.overridableProperties.push(e);const i=this.defaultPropertyValues[e]=new Ao(r,void 0),n=this.defaultTransitionablePropertyValues[e]=new Io(r);this.defaultTransitioningPropertyValues[e]=n.untransitioned(),this.defaultPossiblyEvaluatedValues[e]=i.possiblyEvaluate({})}}}oo("DataDrivenProperty",Bo),oo("DataConstantProperty",Fo),oo("CrossFadedDataDrivenProperty",Oo),oo("CrossFadedProperty",jo),oo("ColorRampProperty",Uo);const Vo="-transition";class $o extends _t{constructor(t,e){if(super(),this.id=t.id,this.type=t.type,this._featureFilter={filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set},"custom"!==t.type&&(this.metadata=t.metadata,this.minzoom=t.minzoom,this.maxzoom=t.maxzoom,"background"!==t.type&&(this.source=t.source,this.sourceLayer=t["source-layer"],this.filter=t.filter,this._featureFilter=hn(t.filter)),e.layout&&(this._unevaluatedLayout=new Ro(e.layout)),e.paint)){this._transitionablePaint=new Eo(e.paint);for(const e in t.paint)this.setPaintProperty(e,t.paint[e],{validate:!1});for(const e in t.layout)this.setLayoutProperty(e,t.layout[e],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Lo(e.paint)}}setFilter(t){this.filter=t,this._featureFilter=hn(t)}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(t){return"visibility"===t?this.visibility:this._unevaluatedLayout.getValue(t)}getLayoutAffectingGlobalStateRefs(){const t=new Set;if(this._unevaluatedLayout)for(const e in this._unevaluatedLayout._values){const r=this._unevaluatedLayout._values[e];for(const e of r.getGlobalStateRefs())t.add(e)}for(const e of this._featureFilter.getGlobalStateRefs())t.add(e);return t}getPaintAffectingGlobalStateRefs(){var t;const e=new globalThis.Map;if(this._transitionablePaint)for(const r in this._transitionablePaint._values){const i=this._transitionablePaint._values[r].value;for(const n of i.getGlobalStateRefs()){const o=null!==(t=e.get(n))&&void 0!==t?t:[];o.push({name:r,value:i.value}),e.set(n,o)}}return e}setLayoutProperty(t,e,r={}){null!=e&&this._validate(eo,`layers.${this.id}.layout.${t}`,t,e,r)||("visibility"!==t?this._unevaluatedLayout.setValue(t,e):this.visibility=e)}getPaintProperty(t){return t.endsWith(Vo)?this._transitionablePaint.getTransition(t.slice(0,-11)):this._transitionablePaint.getValue(t)}setPaintProperty(t,e,r={}){if(null!=e&&this._validate(to,`layers.${this.id}.paint.${t}`,t,e,r))return!1;if(t.endsWith(Vo))return this._transitionablePaint.setTransition(t.slice(0,-11),e||void 0),!1;{const r=this._transitionablePaint._values[t],i="cross-faded-data-driven"===r.property.specification["property-type"],n=r.value.isDataDriven(),o=r.value;this._transitionablePaint.setValue(t,e),this._handleSpecialPaintPropertyUpdate(t);const a=this._transitionablePaint._values[t].value;return a.isDataDriven()||n||i||this._handleOverridablePaintPropertyUpdate(t,o,a)}}_handleSpecialPaintPropertyUpdate(t){}_handleOverridablePaintPropertyUpdate(t,e,r){return!1}isHidden(t){return!!(this.minzoom&&t<this.minzoom)||!!(this.maxzoom&&t>=this.maxzoom)||"none"===this.visibility}updateTransitions(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(t,e){t.getCrossfadeParameters&&(this._crossfadeParameters=t.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t,void 0,e)),this.paint=this._transitioningPaint.possiblyEvaluate(t,void 0,e)}serialize(){const t={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&&(t.layout=t.layout||{},t.layout.visibility=this.visibility),N(t,(t,e)=>!(void 0===t||"layout"===e&&!Object.keys(t).length||"paint"===e&&!Object.keys(t).length))}_validate(t,e,r,i,n={}){return(!n||!1!==n.validate)&&ro(this,t.call(Yn,{key:e,layerType:this.type,objectKey:r,value:i,styleSpec:yt,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const t in this.paint._values){const e=this.paint.get(t);if(e instanceof Do&&Ui(e.property.specification)&&("source"===e.value.kind||"composite"===e.value.kind)&&e.value.isStateDependent)return!0}return!1}}const Zo={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Go{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}}class qo{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){const 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(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const e=this.uint8;this._refreshViews(),e&&this.uint8.set(e)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function Ho(t,e=1){let r=0,i=0;return{members:t.map(t=>{const n=Zo[t.type].BYTES_PER_ELEMENT,o=r=Wo(r,Math.max(e,n)),a=t.components||1;return i=Math.max(i,n),r+=n*a,{name:t.name,type:t.type,components:a,offset:o}}),size:Wo(r,Math.max(i,e)),alignment:e}}function Wo(t,e){return Math.ceil(t/e)*e}class Xo extends qo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e){const r=this.length;return this.resize(r+1),this.emplace(r,t,e)}emplace(t,e,r){const i=2*t;return this.int16[i+0]=e,this.int16[i+1]=r,t}}Xo.prototype.bytesPerElement=4,oo("StructArrayLayout2i4",Xo);class Ko extends qo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r){const i=this.length;return this.resize(i+1),this.emplace(i,t,e,r)}emplace(t,e,r,i){const n=3*t;return this.int16[n+0]=e,this.int16[n+1]=r,this.int16[n+2]=i,t}}Ko.prototype.bytesPerElement=6,oo("StructArrayLayout3i6",Ko);class Yo extends qo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,i){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,r,i)}emplace(t,e,r,i,n){const o=4*t;return this.int16[o+0]=e,this.int16[o+1]=r,this.int16[o+2]=i,this.int16[o+3]=n,t}}Yo.prototype.bytesPerElement=8,oo("StructArrayLayout4i8",Yo);class Jo extends qo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n,o){const a=this.length;return this.resize(a+1),this.emplace(a,t,e,r,i,n,o)}emplace(t,e,r,i,n,o,a){const s=6*t;return this.int16[s+0]=e,this.int16[s+1]=r,this.int16[s+2]=i,this.int16[s+3]=n,this.int16[s+4]=o,this.int16[s+5]=a,t}}Jo.prototype.bytesPerElement=12,oo("StructArrayLayout2i4i12",Jo);class Qo extends qo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n,o){const a=this.length;return this.resize(a+1),this.emplace(a,t,e,r,i,n,o)}emplace(t,e,r,i,n,o,a){const s=4*t,l=8*t;return this.int16[s+0]=e,this.int16[s+1]=r,this.uint8[l+4]=i,this.uint8[l+5]=n,this.uint8[l+6]=o,this.uint8[l+7]=a,t}}Qo.prototype.bytesPerElement=8,oo("StructArrayLayout2i4ub8",Qo);class ta extends qo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e){const r=this.length;return this.resize(r+1),this.emplace(r,t,e)}emplace(t,e,r){const i=2*t;return this.float32[i+0]=e,this.float32[i+1]=r,t}}ta.prototype.bytesPerElement=8,oo("StructArrayLayout2f8",ta);class ea extends qo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n,o,a,s,l,c){const h=this.length;return this.resize(h+1),this.emplace(h,t,e,r,i,n,o,a,s,l,c)}emplace(t,e,r,i,n,o,a,s,l,c,h){const u=10*t;return this.uint16[u+0]=e,this.uint16[u+1]=r,this.uint16[u+2]=i,this.uint16[u+3]=n,this.uint16[u+4]=o,this.uint16[u+5]=a,this.uint16[u+6]=s,this.uint16[u+7]=l,this.uint16[u+8]=c,this.uint16[u+9]=h,t}}ea.prototype.bytesPerElement=20,oo("StructArrayLayout10ui20",ea);class ra extends qo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n,o,a,s,l,c,h,u){const p=this.length;return this.resize(p+1),this.emplace(p,t,e,r,i,n,o,a,s,l,c,h,u)}emplace(t,e,r,i,n,o,a,s,l,c,h,u,p){const d=12*t;return this.int16[d+0]=e,this.int16[d+1]=r,this.int16[d+2]=i,this.int16[d+3]=n,this.uint16[d+4]=o,this.uint16[d+5]=a,this.uint16[d+6]=s,this.uint16[d+7]=l,this.int16[d+8]=c,this.int16[d+9]=h,this.int16[d+10]=u,this.int16[d+11]=p,t}}ra.prototype.bytesPerElement=24,oo("StructArrayLayout4i4ui4i24",ra);class ia extends qo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r){const i=this.length;return this.resize(i+1),this.emplace(i,t,e,r)}emplace(t,e,r,i){const n=3*t;return this.float32[n+0]=e,this.float32[n+1]=r,this.float32[n+2]=i,t}}ia.prototype.bytesPerElement=12,oo("StructArrayLayout3f12",ia);class na extends qo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.uint32[1*t+0]=e,t}}na.prototype.bytesPerElement=4,oo("StructArrayLayout1ul4",na);class oa extends qo{_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(t,e,r,i,n,o,a,s,l){const c=this.length;return this.resize(c+1),this.emplace(c,t,e,r,i,n,o,a,s,l)}emplace(t,e,r,i,n,o,a,s,l,c){const h=10*t,u=5*t;return this.int16[h+0]=e,this.int16[h+1]=r,this.int16[h+2]=i,this.int16[h+3]=n,this.int16[h+4]=o,this.int16[h+5]=a,this.uint32[u+3]=s,this.uint16[h+8]=l,this.uint16[h+9]=c,t}}oa.prototype.bytesPerElement=20,oo("StructArrayLayout6i1ul2ui20",oa);class aa extends qo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n,o){const a=this.length;return this.resize(a+1),this.emplace(a,t,e,r,i,n,o)}emplace(t,e,r,i,n,o,a){const s=6*t;return this.int16[s+0]=e,this.int16[s+1]=r,this.int16[s+2]=i,this.int16[s+3]=n,this.int16[s+4]=o,this.int16[s+5]=a,t}}aa.prototype.bytesPerElement=12,oo("StructArrayLayout2i2i2i12",aa);class sa extends qo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n){const o=this.length;return this.resize(o+1),this.emplace(o,t,e,r,i,n)}emplace(t,e,r,i,n,o){const a=4*t,s=8*t;return this.float32[a+0]=e,this.float32[a+1]=r,this.float32[a+2]=i,this.int16[s+6]=n,this.int16[s+7]=o,t}}sa.prototype.bytesPerElement=16,oo("StructArrayLayout2f1f2i16",sa);class la extends qo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n,o){const a=this.length;return this.resize(a+1),this.emplace(a,t,e,r,i,n,o)}emplace(t,e,r,i,n,o,a){const s=16*t,l=4*t,c=8*t;return this.uint8[s+0]=e,this.uint8[s+1]=r,this.float32[l+1]=i,this.float32[l+2]=n,this.int16[c+6]=o,this.int16[c+7]=a,t}}la.prototype.bytesPerElement=16,oo("StructArrayLayout2ub2f2i16",la);class ca extends qo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r){const i=this.length;return this.resize(i+1),this.emplace(i,t,e,r)}emplace(t,e,r,i){const n=3*t;return this.uint16[n+0]=e,this.uint16[n+1]=r,this.uint16[n+2]=i,t}}ca.prototype.bytesPerElement=6,oo("StructArrayLayout3ui6",ca);class ha extends qo{_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(t,e,r,i,n,o,a,s,l,c,h,u,p,d,f,m,g){const _=this.length;return this.resize(_+1),this.emplace(_,t,e,r,i,n,o,a,s,l,c,h,u,p,d,f,m,g)}emplace(t,e,r,i,n,o,a,s,l,c,h,u,p,d,f,m,g,_){const y=24*t,b=12*t,v=48*t;return this.int16[y+0]=e,this.int16[y+1]=r,this.uint16[y+2]=i,this.uint16[y+3]=n,this.uint32[b+2]=o,this.uint32[b+3]=a,this.uint32[b+4]=s,this.uint16[y+10]=l,this.uint16[y+11]=c,this.uint16[y+12]=h,this.float32[b+7]=u,this.float32[b+8]=p,this.uint8[v+36]=d,this.uint8[v+37]=f,this.uint8[v+38]=m,this.uint32[b+10]=g,this.int16[y+22]=_,t}}ha.prototype.bytesPerElement=48,oo("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",ha);class ua extends qo{_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(t,e,r,i,n,o,a,s,l,c,h,u,p,d,f,m,g,_,y,b,v,x,w,T,S,P,C,M){const A=this.length;return this.resize(A+1),this.emplace(A,t,e,r,i,n,o,a,s,l,c,h,u,p,d,f,m,g,_,y,b,v,x,w,T,S,P,C,M)}emplace(t,e,r,i,n,o,a,s,l,c,h,u,p,d,f,m,g,_,y,b,v,x,w,T,S,P,C,M,A){const I=32*t,E=16*t;return this.int16[I+0]=e,this.int16[I+1]=r,this.int16[I+2]=i,this.int16[I+3]=n,this.int16[I+4]=o,this.int16[I+5]=a,this.int16[I+6]=s,this.int16[I+7]=l,this.uint16[I+8]=c,this.uint16[I+9]=h,this.uint16[I+10]=u,this.uint16[I+11]=p,this.uint16[I+12]=d,this.uint16[I+13]=f,this.uint16[I+14]=m,this.uint16[I+15]=g,this.uint16[I+16]=_,this.uint16[I+17]=y,this.uint16[I+18]=b,this.uint16[I+19]=v,this.uint16[I+20]=x,this.uint16[I+21]=w,this.uint16[I+22]=T,this.uint32[E+12]=S,this.float32[E+13]=P,this.float32[E+14]=C,this.uint16[I+30]=M,this.uint16[I+31]=A,t}}ua.prototype.bytesPerElement=64,oo("StructArrayLayout8i15ui1ul2f2ui64",ua);class pa extends qo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.float32[1*t+0]=e,t}}pa.prototype.bytesPerElement=4,oo("StructArrayLayout1f4",pa);class da extends qo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r){const i=this.length;return this.resize(i+1),this.emplace(i,t,e,r)}emplace(t,e,r,i){const n=3*t;return this.uint16[6*t+0]=e,this.float32[n+1]=r,this.float32[n+2]=i,t}}da.prototype.bytesPerElement=12,oo("StructArrayLayout1ui2f12",da);class fa extends qo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r){const i=this.length;return this.resize(i+1),this.emplace(i,t,e,r)}emplace(t,e,r,i){const n=4*t;return this.uint32[2*t+0]=e,this.uint16[n+2]=r,this.uint16[n+3]=i,t}}fa.prototype.bytesPerElement=8,oo("StructArrayLayout1ul2ui8",fa);class ma extends qo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e){const r=this.length;return this.resize(r+1),this.emplace(r,t,e)}emplace(t,e,r){const i=2*t;return this.uint16[i+0]=e,this.uint16[i+1]=r,t}}ma.prototype.bytesPerElement=4,oo("StructArrayLayout2ui4",ma);class ga extends qo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.uint16[1*t+0]=e,t}}ga.prototype.bytesPerElement=2,oo("StructArrayLayout1ui2",ga);class _a extends qo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r,i){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,r,i)}emplace(t,e,r,i,n){const o=4*t;return this.float32[o+0]=e,this.float32[o+1]=r,this.float32[o+2]=i,this.float32[o+3]=n,t}}_a.prototype.bytesPerElement=16,oo("StructArrayLayout4f16",_a);class ya extends Go{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 r(this.anchorPointX,this.anchorPointY)}}ya.prototype.size=20;class ba extends oa{get(t){return new ya(this,t)}}oo("CollisionBoxArray",ba);class va extends Go{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(t){this._structArray.uint8[this._pos1+37]=t}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(t){this._structArray.uint8[this._pos1+38]=t}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(t){this._structArray.uint32[this._pos4+10]=t}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}va.prototype.size=48;class xa extends ha{get(t){return new va(this,t)}}oo("PlacedSymbolArray",xa);class wa extends Go{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(t){this._structArray.uint32[this._pos4+12]=t}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]}}wa.prototype.size=64;class Ta extends ua{get(t){return new wa(this,t)}}oo("SymbolInstanceArray",Ta);class Sa extends pa{getoffsetX(t){return this.float32[1*t+0]}}oo("GlyphOffsetArray",Sa);class Pa extends Ko{getx(t){return this.int16[3*t+0]}gety(t){return this.int16[3*t+1]}gettileUnitDistanceFromAnchor(t){return this.int16[3*t+2]}}oo("SymbolLineVertexArray",Pa);class Ca extends Go{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]}}Ca.prototype.size=12;class Ma extends da{get(t){return new Ca(this,t)}}oo("TextAnchorOffsetArray",Ma);class Aa extends Go{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]}}Aa.prototype.size=8;class Ia extends fa{get(t){return new Aa(this,t)}}oo("FeatureIndexArray",Ia);class Ea extends Xo{}class ka extends Xo{}class za extends Xo{}class Ra extends Jo{}class Da extends Qo{}class La extends ta{}class Fa extends ea{}class Ba extends ra{}class Oa extends ia{}class ja extends na{}class Ua extends aa{}class Na extends la{}class Va extends ca{}class $a extends ma{}const Za=Ho([{name:"a_pos",components:2,type:"Int16"}],4),{members:Ga}=Za;class qa{constructor(t=[]){this._forceNewSegmentOnNextPrepare=!1,this.segments=t}prepareSegment(t,e,r,i){const n=this.segments[this.segments.length-1];return t>qa.MAX_VERTEX_ARRAY_LENGTH&&Z(`Max vertices per segment is ${qa.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${t}. Consider using the \`fillLargeMeshArrays\` function if you require meshes with more than ${qa.MAX_VERTEX_ARRAY_LENGTH} vertices.`),this._forceNewSegmentOnNextPrepare||!n||n.vertexLength+t>qa.MAX_VERTEX_ARRAY_LENGTH||n.sortKey!==i?this.createNewSegment(e,r,i):n}createNewSegment(t,e,r){const i={vertexOffset:t.length,primitiveOffset:e.length,vertexLength:0,primitiveLength:0,vaos:{}};return void 0!==r&&(i.sortKey=r),this._forceNewSegmentOnNextPrepare=!1,this.segments.push(i),i}getOrCreateLatestSegment(t,e,r){return this.prepareSegment(0,t,e,r)}forceNewSegmentOnNextPrepare(){this._forceNewSegmentOnNextPrepare=!0}get(){return this.segments}destroy(){for(const t of this.segments)for(const e in t.vaos)t.vaos[e].destroy()}static simpleSegment(t,e,r,i){return new qa([{vertexOffset:t,primitiveOffset:e,vertexLength:r,primitiveLength:i,vaos:{},sortKey:0}])}}function Ha(t,e){return 256*(t=F(Math.floor(t),0,255))+F(Math.floor(e),0,255)}qa.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,oo("SegmentVector",qa);const Wa=Ho([{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 Xa,Ka,Ya,Ja={exports:{}},Qa={exports:{}},ts={exports:{}},es=function(){if(Ya)return Ja.exports;Ya=1;var t=(Xa||(Xa=1,Qa.exports=function(t,e){var r,i,n,o,a,s,l,c;for(i=t.length-(r=3&t.length),n=e,a=3432918353,s=461845907,c=0;c<i;)l=255&t.charCodeAt(c)|(255&t.charCodeAt(++c))<<8|(255&t.charCodeAt(++c))<<16|(255&t.charCodeAt(++c))<<24,++c,n=27492+(65535&(o=5*(65535&(n=(n^=l=(65535&(l=(l=(65535&l)*a+(((l>>>16)*a&65535)<<16)&4294967295)<<15|l>>>17))*s+(((l>>>16)*s&65535)<<16)&4294967295)<<13|n>>>19))+((5*(n>>>16)&65535)<<16)&4294967295))+((58964+(o>>>16)&65535)<<16);switch(l=0,r){case 3:l^=(255&t.charCodeAt(c+2))<<16;case 2:l^=(255&t.charCodeAt(c+1))<<8;case 1:n^=l=(65535&(l=(l=(65535&(l^=255&t.charCodeAt(c)))*a+(((l>>>16)*a&65535)<<16)&4294967295)<<15|l>>>17))*s+(((l>>>16)*s&65535)<<16)&4294967295}return n^=t.length,n=2246822507*(65535&(n^=n>>>16))+((2246822507*(n>>>16)&65535)<<16)&4294967295,n=3266489909*(65535&(n^=n>>>13))+((3266489909*(n>>>16)&65535)<<16)&4294967295,(n^=n>>>16)>>>0}),Qa.exports),e=(Ka||(Ka=1,ts.exports=function(t,e){for(var r,i=t.length,n=e^i,o=0;i>=4;)r=1540483477*(65535&(r=255&t.charCodeAt(o)|(255&t.charCodeAt(++o))<<8|(255&t.charCodeAt(++o))<<16|(255&t.charCodeAt(++o))<<24))+((1540483477*(r>>>16)&65535)<<16),n=1540483477*(65535&n)+((1540483477*(n>>>16)&65535)<<16)^(r=1540483477*(65535&(r^=r>>>24))+((1540483477*(r>>>16)&65535)<<16)),i-=4,++o;switch(i){case 3:n^=(255&t.charCodeAt(o+2))<<16;case 2:n^=(255&t.charCodeAt(o+1))<<8;case 1:n=1540483477*(65535&(n^=255&t.charCodeAt(o)))+((1540483477*(n>>>16)&65535)<<16)}return n=1540483477*(65535&(n^=n>>>13))+((1540483477*(n>>>16)&65535)<<16),(n^=n>>>15)>>>0}),ts.exports);return Ja.exports=t,Ja.exports.murmur3=t,Ja.exports.murmur2=e,Ja.exports}(),rs=i(es);class is{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(t,e,r,i){this.ids.push(ns(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");const e=ns(t);let r=0,i=this.ids.length-1;for(;r<i;){const t=r+i>>1;this.ids[t]>=e?i=t:r=t+1}const n=[];for(;this.ids[r]===e;)n.push({index:this.positions[3*r],start:this.positions[3*r+1],end:this.positions[3*r+2]}),r++;return n}static serialize(t,e){const r=new Float64Array(t.ids),i=new Uint32Array(t.positions);return os(r,i,0,r.length-1),e&&e.push(r.buffer,i.buffer),{ids:r,positions:i}}static deserialize(t){const e=new is;return e.ids=t.ids,e.positions=t.positions,e.indexed=!0,e}}function ns(t){const e=+t;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:rs(String(t))}function os(t,e,r,i){for(;r<i;){const n=t[r+i>>1];let o=r-1,a=i+1;for(;;){do{o++}while(t[o]<n);do{a--}while(t[a]>n);if(o>=a)break;as(t,o,a),as(e,3*o,3*a),as(e,3*o+1,3*a+1),as(e,3*o+2,3*a+2)}a-r<i-a?(os(t,e,r,a),r=a+1):(os(t,e,a+1,i),i=a)}}function as(t,e,r){const i=t[e];t[e]=t[r],t[r]=i}oo("FeaturePositionMap",is);class ss{constructor(t,e){this.gl=t.gl,this.location=e}}class ls extends ss{constructor(t,e){super(t,e),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1f(this.location,t))}}class cs extends ss{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]))}}class hs extends ss{constructor(t,e){super(t,e),this.current=Ce.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))}}const us=new Float32Array(16);function ps(t){return[Ha(255*t.r,255*t.g),Ha(255*t.b,255*t.a)]}class ds{constructor(t,e,r){this.value=t,this.uniformNames=e.map(t=>`u_${t}`),this.type=r}setUniform(t,e,r){t.set(r.constantOr(this.value))}getBinding(t,e,r){return"color"===this.type?new hs(t,e):new ls(t,e)}}class fs{constructor(t,e){this.uniformNames=e.map(t=>`u_${t}`),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){const n="u_pattern_to"===i?this.patternTo:"u_pattern_from"===i?this.patternFrom:"u_pixel_ratio_to"===i?this.pixelRatioTo:"u_pixel_ratio_from"===i?this.pixelRatioFrom:null;n&&t.set(n)}getBinding(t,e,r){return"u_pattern"===r.substr(0,9)?new cs(t,e):new ls(t,e)}}class ms{constructor(t,e,r,i){this.expression=t,this.type=r,this.maxValue=0,this.paintVertexAttributes=e.map(t=>({name:`a_${t}`,type:"Float32",components:"color"===r?2:1,offset:0})),this.paintVertexArray=new i}populatePaintArray(t,e,r){const i=this.paintVertexArray.length,n=this.expression.evaluate(new Mo(0,r),e,{},r.canonical,[],r.formattedSection);this.paintVertexArray.resize(t),this._setPaintValue(i,t,n)}updatePaintArray(t,e,r,i,n){const o=this.expression.evaluate(new Mo(0,n),r,i);this._setPaintValue(t,e,o)}_setPaintValue(t,e,r){if("color"===this.type){const i=ps(r);for(let r=t;r<e;r++)this.paintVertexArray.emplace(r,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()}}class gs{constructor(t,e,r,i,n,o){this.expression=t,this.uniformNames=e.map(t=>`u_${t}_t`),this.type=r,this.useIntegerZoom=i,this.zoom=n,this.maxValue=0,this.paintVertexAttributes=e.map(t=>({name:`a_${t}`,type:"Float32",components:"color"===r?4:2,offset:0})),this.paintVertexArray=new o}populatePaintArray(t,e,r){const i=this.expression.evaluate(new Mo(this.zoom,r),e,{},r.canonical,[],r.formattedSection),n=this.expression.evaluate(new Mo(this.zoom+1,r),e,{},r.canonical,[],r.formattedSection),o=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(o,t,i,n)}updatePaintArray(t,e,r,i,n){const o=this.expression.evaluate(new Mo(this.zoom,n),r,i),a=this.expression.evaluate(new Mo(this.zoom+1,n),r,i);this._setPaintValue(t,e,o,a)}_setPaintValue(t,e,r,i){if("color"===this.type){const n=ps(r),o=ps(i);for(let r=t;r<e;r++)this.paintVertexArray.emplace(r,n[0],n[1],o[0],o[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){const r=this.useIntegerZoom?Math.floor(e.zoom):e.zoom,i=F(this.expression.interpolationFactor(r,this.zoom,this.zoom+1),0,1);t.set(i)}getBinding(t,e,r){return new ls(t,e)}}class _s{constructor(t,e,r,i,n,o){this.expression=t,this.type=e,this.useIntegerZoom=r,this.zoom=i,this.layerId=o,this.zoomInPaintVertexArray=new n,this.zoomOutPaintVertexArray=new n}populatePaintArray(t,e,r){const i=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(t),this.zoomOutPaintVertexArray.resize(t),this._setPaintValues(i,t,e.patterns&&e.patterns[this.layerId],r.imagePositions)}updatePaintArray(t,e,r,i,n){this._setPaintValues(t,e,r.patterns&&r.patterns[this.layerId],n.imagePositions)}_setPaintValues(t,e,r,i){if(!i||!r)return;const{min:n,mid:o,max:a}=r,s=i[n],l=i[o],c=i[a];if(s&&l&&c)for(let r=t;r<e;r++)this.zoomInPaintVertexArray.emplace(r,l.tl[0],l.tl[1],l.br[0],l.br[1],s.tl[0],s.tl[1],s.br[0],s.br[1],l.pixelRatio,s.pixelRatio),this.zoomOutPaintVertexArray.emplace(r,l.tl[0],l.tl[1],l.br[0],l.br[1],c.tl[0],c.tl[1],c.br[0],c.br[1],l.pixelRatio,c.pixelRatio)}upload(t){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=t.createVertexBuffer(this.zoomInPaintVertexArray,Wa.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=t.createVertexBuffer(this.zoomOutPaintVertexArray,Wa.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class ys{constructor(t,e,r){this.binders={},this._buffers=[];const i=[];for(const n in t.paint._values){if(!r(n))continue;const o=t.paint.get(n);if(!(o instanceof Do&&Ui(o.property.specification)))continue;const a=vs(n,t.type),s=o.value,l=o.property.specification.type,c=o.property.useIntegerZoom,h=o.property.specification["property-type"],u="cross-faded"===h||"cross-faded-data-driven"===h;if("constant"===s.kind)this.binders[n]=u?new fs(s.value,a):new ds(s.value,a,l),i.push(`/u_${n}`);else if("source"===s.kind||u){const r=xs(n,l,"source");this.binders[n]=u?new _s(s,l,c,e,r,t.id):new ms(s,a,l,r),i.push(`/a_${n}`)}else{const t=xs(n,l,"composite");this.binders[n]=new gs(s,a,l,c,e,t),i.push(`/z_${n}`)}}this.cacheKey=i.sort().join("")}getMaxValue(t){const e=this.binders[t];return e instanceof ms||e instanceof gs?e.maxValue:0}populatePaintArrays(t,e,r){for(const i in this.binders){const n=this.binders[i];(n instanceof ms||n instanceof gs||n instanceof _s)&&n.populatePaintArray(t,e,r)}}setConstantPatternPositions(t,e){for(const r in this.binders){const i=this.binders[r];i instanceof fs&&i.setConstantPatternPositions(t,e)}}updatePaintArrays(t,e,r,i,n){let o=!1;for(const a in t){const s=e.getPositions(a);for(const e of s){const s=r.feature(e.index);for(const r in this.binders){const l=this.binders[r];if((l instanceof ms||l instanceof gs||l instanceof _s)&&!0===l.expression.isStateDependent){const c=i.paint.get(r);l.expression=c.value,l.updatePaintArray(e.start,e.end,s,t[a],n),o=!0}}}}return o}defines(){const t=[];for(const e in this.binders){const r=this.binders[e];(r instanceof ds||r instanceof fs)&&t.push(...r.uniformNames.map(t=>`#define HAS_UNIFORM_${t}`))}return t}getBinderAttributes(){const t=[];for(const e in this.binders){const r=this.binders[e];if(r instanceof ms||r instanceof gs)for(let e=0;e<r.paintVertexAttributes.length;e++)t.push(r.paintVertexAttributes[e].name);else if(r instanceof _s)for(let e=0;e<Wa.members.length;e++)t.push(Wa.members[e].name)}return t}getBinderUniforms(){const t=[];for(const e in this.binders){const r=this.binders[e];if(r instanceof ds||r instanceof fs||r instanceof gs)for(const e of r.uniformNames)t.push(e)}return t}getPaintVertexBuffers(){return this._buffers}getUniforms(t,e){const r=[];for(const i in this.binders){const n=this.binders[i];if(n instanceof ds||n instanceof fs||n instanceof gs)for(const o of n.uniformNames)if(e[o]){const a=n.getBinding(t,e[o],o);r.push({name:o,property:i,binding:a})}}return r}setUniforms(t,e,r,i){for(const{name:t,property:n,binding:o}of e)this.binders[n].setUniform(o,i,r.get(n),t)}updatePaintBuffers(t){this._buffers=[];for(const e in this.binders){const r=this.binders[e];if(t&&r instanceof _s){const e=2===t.fromScale?r.zoomInPaintVertexBuffer:r.zoomOutPaintVertexBuffer;e&&this._buffers.push(e)}else(r instanceof ms||r instanceof gs)&&r.paintVertexBuffer&&this._buffers.push(r.paintVertexBuffer)}}upload(t){for(const e in this.binders){const r=this.binders[e];(r instanceof ms||r instanceof gs||r instanceof _s)&&r.upload(t)}this.updatePaintBuffers()}destroy(){for(const t in this.binders){const e=this.binders[t];(e instanceof ms||e instanceof gs||e instanceof _s)&&e.destroy()}}}class bs{constructor(t,e,r=()=>!0){this.programConfigurations={};for(const i of t)this.programConfigurations[i.id]=new ys(i,e,r);this.needsUpload=!1,this._featureMap=new is,this._bufferOffset=0}populatePaintArrays(t,e,r,i){for(const r in this.programConfigurations)this.programConfigurations[r].populatePaintArrays(t,e,i);void 0!==e.id&&this._featureMap.add(e.id,r,this._bufferOffset,t),this._bufferOffset=t,this.needsUpload=!0}updatePaintArrays(t,e,r,i){for(const 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(const e in this.programConfigurations)this.programConfigurations[e].upload(t);this.needsUpload=!1}}destroy(){for(const t in this.programConfigurations)this.programConfigurations[t].destroy()}}function vs(t,e){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"]}[t]||[t.replace(`${e}-`,"").replace(/-/g,"_")]}function xs(t,e,r){const i={color:{source:ta,composite:_a},number:{source:pa,composite:ta}},n=function(t){return{"line-pattern":{source:Fa,composite:Fa},"fill-pattern":{source:Fa,composite:Fa},"fill-extrusion-pattern":{source:Fa,composite:Fa}}[t]}(t);return n&&n[r]||i[e][r]}oo("ConstantBinder",ds),oo("CrossFadedConstantBinder",fs),oo("SourceExpressionBinder",ms),oo("CrossFadedCompositeBinder",_s),oo("CompositeExpressionBinder",gs),oo("ProgramConfiguration",ys,{omit:["_buffers"]}),oo("ProgramConfigurationSet",bs);const ws=Math.pow(2,14)-1,Ts=-ws-1;function Ss(t){const e=I/t.extent,r=t.loadGeometry();for(let t=0;t<r.length;t++){const i=r[t];for(let t=0;t<i.length;t++){const r=i[t],n=Math.round(r.x*e),o=Math.round(r.y*e);r.x=F(n,Ts,ws),r.y=F(o,Ts,ws),(n<r.x||n>r.x+1||o<r.y||o>r.y+1)&&Z("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return r}function Ps(t,e){return{type:t.type,id:t.id,properties:t.properties,geometry:e?Ss(t):[]}}const Cs=-32768;function Ms(t,e,r,i,n){t.emplaceBack(Cs+8*e+i,Cs+8*r+n)}class As{constructor(t){this.zoom=t.zoom,this.globalState=t.globalState,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(t=>t.id),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new ka,this.indexArray=new Va,this.segments=new qa,this.programConfigurations=new bs(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id)}populate(t,e,r){const i=this.layers[0],n=[];let o=null,a=!1,s="heatmap"===i.type;if("circle"===i.type){const t=i;o=t.layout.get("circle-sort-key"),a=!o.isConstant(),s=s||"map"===t.paint.get("circle-pitch-alignment")}const l=s?e.subdivisionGranularity.circle:1;for(const{feature:e,id:i,index:s,sourceLayerIndex:l}of t){const t=this.layers[0]._featureFilter.needGeometry,c=Ps(e,t);if(!this.layers[0]._featureFilter.filter(new Mo(this.zoom,{globalState:this.globalState}),c,r))continue;const h=a?o.evaluate(c,{},r):void 0,u={id:i,properties:e.properties,type:e.type,sourceLayerIndex:l,index:s,geometry:t?c.geometry:Ss(e),patterns:{},sortKey:h};n.push(u)}a&&n.sort((t,e)=>t.sortKey-e.sortKey);for(const i of n){const{geometry:n,index:o,sourceLayerIndex:a}=i,s=t[o].feature;this.addFeature(i,n,o,r,l),e.featureIndex.insert(s,n,o,a,this.index)}}update(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,{imagePositions:r,globalState:this.globalState})}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Ga),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,n=1){let o;switch(n){case 1:o=[0,7];break;case 3:o=[0,2,5,7];break;case 5:o=[0,1,3,4,6,7];break;case 7:o=[0,1,2,3,4,5,6,7];break;default:throw new Error(`Invalid circle bucket granularity: ${n}; valid values are 1, 3, 5, 7.`)}const a=o.length;for(const r of e)for(const e of r){const r=e.x,i=e.y;if(r<0||r>=I||i<0||i>=I)continue;const n=this.segments.prepareSegment(a*a,this.layoutVertexArray,this.indexArray,t.sortKey),s=n.vertexLength;for(let t=0;t<a;t++)for(let e=0;e<a;e++)Ms(this.layoutVertexArray,r,i,o[e],o[t]);for(let t=0;t<a-1;t++)for(let e=0;e<a-1;e++){const r=s+t*a+e,i=s+(t+1)*a+e;this.indexArray.emplaceBack(r,i+1,r+1),this.indexArray.emplaceBack(r,i,i+1)}n.vertexLength+=a*a,n.primitiveLength+=(a-1)*(a-1)*2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,{imagePositions:{},canonical:i,globalState:this.globalState})}}function Is(t,e){for(let r=0;r<t.length;r++)if(Os(e,t[r]))return!0;for(let r=0;r<e.length;r++)if(Os(t,e[r]))return!0;return!!Rs(t,e)}function Es(t,e,r){return!!Os(t,e)||!!Ls(e,t,r)}function ks(t,e){if(1===t.length)return Bs(e,t[0]);for(let r=0;r<e.length;r++){const i=e[r];for(let e=0;e<i.length;e++)if(Os(t,i[e]))return!0}for(let r=0;r<t.length;r++)if(Bs(e,t[r]))return!0;for(let r=0;r<e.length;r++)if(Rs(t,e[r]))return!0;return!1}function zs(t,e,r){if(t.length>1){if(Rs(t,e))return!0;for(let i=0;i<e.length;i++)if(Ls(e[i],t,r))return!0}for(let i=0;i<t.length;i++)if(Ls(t[i],e,r))return!0;return!1}function Rs(t,e){if(0===t.length||0===e.length)return!1;for(let r=0;r<t.length-1;r++){const i=t[r],n=t[r+1];for(let t=0;t<e.length-1;t++)if(Ds(i,n,e[t],e[t+1]))return!0}return!1}function Ds(t,e,r,i){return G(t,r,i)!==G(e,r,i)&&G(t,e,r)!==G(t,e,i)}function Ls(t,e,r){const i=r*r;if(1===e.length)return t.distSqr(e[0])<i;for(let r=1;r<e.length;r++)if(Fs(t,e[r-1],e[r])<i)return!0;return!1}function Fs(t,e,r){const i=e.distSqr(r);if(0===i)return t.distSqr(e);const n=((t.x-e.x)*(r.x-e.x)+(t.y-e.y)*(r.y-e.y))/i;return t.distSqr(n<0?e:n>1?r:r.sub(e)._mult(n)._add(e))}function Bs(t,e){let r,i,n,o=!1;for(let a=0;a<t.length;a++){r=t[a];for(let t=0,a=r.length-1;t<r.length;a=t++)i=r[t],n=r[a],i.y>e.y!=n.y>e.y&&e.x<(n.x-i.x)*(e.y-i.y)/(n.y-i.y)+i.x&&(o=!o)}return o}function Os(t,e){let r=!1;for(let i=0,n=t.length-1;i<t.length;n=i++){const o=t[i],a=t[n];o.y>e.y!=a.y>e.y&&e.x<(a.x-o.x)*(e.y-o.y)/(a.y-o.y)+o.x&&(r=!r)}return r}function js(t,e,r){const i=r[0],n=r[2];if(t.x<i.x&&e.x<i.x||t.x>n.x&&e.x>n.x||t.y<i.y&&e.y<i.y||t.y>n.y&&e.y>n.y)return!1;const o=G(t,e,r[0]);return o!==G(t,e,r[1])||o!==G(t,e,r[2])||o!==G(t,e,r[3])}function Us(t,e,r){const i=e.paint.get(t).value;return"constant"===i.kind?i.value:r.programConfigurations.get(e.id).getMaxValue(t)}function Ns(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function Vs(t,e,i,n,o){if(!e[0]&&!e[1])return t;const a=r.convert(e)._mult(o);"viewport"===i&&a._rotate(-n);const s=[];for(let e=0;e<t.length;e++)s.push(t[e].sub(a));return s}let $s,Zs;oo("CircleBucket",As,{omit:["layers"]});var Gs={get paint(){return Zs=Zs||new No({"circle-radius":new Bo(yt.paint_circle["circle-radius"]),"circle-color":new Bo(yt.paint_circle["circle-color"]),"circle-blur":new Bo(yt.paint_circle["circle-blur"]),"circle-opacity":new Bo(yt.paint_circle["circle-opacity"]),"circle-translate":new Fo(yt.paint_circle["circle-translate"]),"circle-translate-anchor":new Fo(yt.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new Fo(yt.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new Fo(yt.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new Bo(yt.paint_circle["circle-stroke-width"]),"circle-stroke-color":new Bo(yt.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new Bo(yt.paint_circle["circle-stroke-opacity"])})},get layout(){return $s=$s||new No({"circle-sort-key":new Bo(yt.layout_circle["circle-sort-key"])})}};class qs extends $o{constructor(t){super(t,Gs)}createBucket(t){return new As(t)}queryRadius(t){const e=t;return Us("circle-radius",this,e)+Us("circle-stroke-width",this,e)+Ns(this.paint.get("circle-translate"))}queryIntersectsFeature({queryGeometry:t,feature:e,featureState:r,geometry:i,transform:n,pixelsToTileUnits:o,unwrappedTileID:a,getElevation:s}){const l=Vs(t,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),-n.bearingInRadians,o),c=this.paint.get("circle-radius").evaluate(e,r)+this.paint.get("circle-stroke-width").evaluate(e,r),h="map"===this.paint.get("circle-pitch-alignment"),u=h?l:function(t,e,r,i){return t.map(t=>Hs(t,e,r,i))}(l,n,a,s),p=h?c*o:c;for(const t of i)for(const e of t){const t=h?e:Hs(e,n,a,s);let r=p;const i=n.projectTileCoordinates(e.x,e.y,a,s).signedDistanceFromCamera;if("viewport"===this.paint.get("circle-pitch-scale")&&"map"===this.paint.get("circle-pitch-alignment")?r*=i/n.cameraToCenterDistance:"map"===this.paint.get("circle-pitch-scale")&&"viewport"===this.paint.get("circle-pitch-alignment")&&(r*=n.cameraToCenterDistance/i),Es(u,t,r))return!0}return!1}}function Hs(t,e,i,n){const o=e.projectTileCoordinates(t.x,t.y,i,n).point;return new r((.5*o.x+.5)*e.width,(.5*-o.y+.5)*e.height)}class Ws extends As{}let Xs;oo("HeatmapBucket",Ws,{omit:["layers"]});var Ks={get paint(){return Xs=Xs||new No({"heatmap-radius":new Bo(yt.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Bo(yt.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Fo(yt.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Uo(yt.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Fo(yt.paint_heatmap["heatmap-opacity"])})}};function Ys(t,{width:e,height:r},i,n){if(n){if(n instanceof Uint8ClampedArray)n=new Uint8Array(n.buffer);else if(n.length!==e*r*i)throw new RangeError(`mismatched image size. expected: ${n.length} but got: ${e*r*i}`)}else n=new Uint8Array(e*r*i);return t.width=e,t.height=r,t.data=n,t}function Js(t,{width:e,height:r},i){if(e===t.width&&r===t.height)return;const n=Ys({},{width:e,height:r},i);Qs(t,n,{x:0,y:0},{x:0,y:0},{width:Math.min(t.width,e),height:Math.min(t.height,r)},i),t.width=e,t.height=r,t.data=n.data}function Qs(t,e,r,i,n,o){if(0===n.width||0===n.height)return e;if(n.width>t.width||n.height>t.height||r.x>t.width-n.width||r.y>t.height-n.height)throw new RangeError("out of range source coordinates for image copy");if(n.width>e.width||n.height>e.height||i.x>e.width-n.width||i.y>e.height-n.height)throw new RangeError("out of range destination coordinates for image copy");const a=t.data,s=e.data;if(a===s)throw new Error("srcData equals dstData, so image is already copied");for(let l=0;l<n.height;l++){const c=((r.y+l)*t.width+r.x)*o,h=((i.y+l)*e.width+i.x)*o;for(let t=0;t<n.width*o;t++)s[h+t]=a[c+t]}return e}class tl{constructor(t,e){Ys(this,t,1,e)}resize(t){Js(this,t,1)}clone(){return new tl({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,e,r,i,n){Qs(t,e,r,i,n,1)}}class el{constructor(t,e){Ys(this,t,4,e)}resize(t){Js(this,t,4)}replace(t,e){e?this.data.set(t):this.data=t instanceof Uint8ClampedArray?new Uint8Array(t.buffer):t}clone(){return new el({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,e,r,i,n){Qs(t,e,r,i,n,4)}setPixel(t,e,r){const i=4*(t*this.width+e);this.data[i+0]=Math.round(255*r.r/r.a),this.data[i+1]=Math.round(255*r.g/r.a),this.data[i+2]=Math.round(255*r.b/r.a),this.data[i+3]=Math.round(255*r.a)}}function rl(t){const e={},r=t.resolution||256,i=t.clips?t.clips.length:1,n=t.image||new el({width:r,height:i});if(Math.log(r)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${r}`);const o=(i,o,a)=>{e[t.evaluationKey]=a;const s=t.expression.evaluate(e);n.setPixel(i/4/r,o/4,s)};if(t.clips)for(let e=0,n=0;e<i;++e,n+=4*r)for(let i=0,a=0;i<r;i++,a+=4){const s=i/(r-1),{start:l,end:c}=t.clips[e];o(n,a,l*(1-s)+c*s)}else for(let t=0,e=0;t<r;t++,e+=4)o(0,e,t/(r-1));return n}oo("AlphaImage",tl),oo("RGBAImage",el);const il="big-fb";class nl extends $o{createBucket(t){return new Ws(t)}constructor(t){super(t,Ks),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(t){"heatmap-color"===t&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=rl({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has(il)&&this.heatmapFbos.delete(il)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return 0!==this.paint.get("heatmap-opacity")&&"none"!==this.visibility}}let ol;var al={get paint(){return ol=ol||new No({"hillshade-illumination-direction":new Fo(yt.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-altitude":new Fo(yt.paint_hillshade["hillshade-illumination-altitude"]),"hillshade-illumination-anchor":new Fo(yt.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new Fo(yt.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new Fo(yt.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new Fo(yt.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new Fo(yt.paint_hillshade["hillshade-accent-color"]),"hillshade-method":new Fo(yt.paint_hillshade["hillshade-method"])})}};class sl extends $o{constructor(t){super(t,al),this.recalculate({zoom:0,zoomHistory:{}},void 0)}getIlluminationProperties(){let t=this.paint.get("hillshade-illumination-direction").values,e=this.paint.get("hillshade-illumination-altitude").values,r=this.paint.get("hillshade-highlight-color").values,i=this.paint.get("hillshade-shadow-color").values;const n=Math.max(t.length,e.length,r.length,i.length);t=t.concat(Array(n-t.length).fill(t.at(-1))),e=e.concat(Array(n-e.length).fill(e.at(-1))),r=r.concat(Array(n-r.length).fill(r.at(-1))),i=i.concat(Array(n-i.length).fill(i.at(-1)));const o=e.map(tt);return{directionRadians:t.map(tt),altitudeRadians:o,shadowColor:i,highlightColor:r}}hasOffscreenPass(){return 0!==this.paint.get("hillshade-exaggeration")&&"none"!==this.visibility}}let ll;var cl={get paint(){return ll=ll||new No({"color-relief-opacity":new Fo(yt["paint_color-relief"]["color-relief-opacity"]),"color-relief-color":new Uo(yt["paint_color-relief"]["color-relief-color"])})}};class hl{constructor(t,e,r,i){this.context=t,this.format=r,this.texture=t.gl.createTexture(),this.update(e,i)}update(t,e,r){const{width:i,height:n}=t,o=!(this.size&&this.size[0]===i&&this.size[1]===n||r),{context:a}=this,{gl:s}=a;if(this.useMipmap=Boolean(e&&e.useMipmap),s.bindTexture(s.TEXTURE_2D,this.texture),a.pixelStoreUnpackFlipY.set(!1),a.pixelStoreUnpack.set(1),a.pixelStoreUnpackPremultiplyAlpha.set(this.format===s.RGBA&&(!e||!1!==e.premultiply)),o)this.size=[i,n],t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||W(t)?s.texImage2D(s.TEXTURE_2D,0,this.format,this.format,s.UNSIGNED_BYTE,t):s.texImage2D(s.TEXTURE_2D,0,this.format,i,n,0,this.format,s.UNSIGNED_BYTE,t.data);else{const{x:e,y:o}=r||{x:0,y:0};t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||W(t)?s.texSubImage2D(s.TEXTURE_2D,0,e,o,s.RGBA,s.UNSIGNED_BYTE,t):s.texSubImage2D(s.TEXTURE_2D,0,e,o,i,n,s.RGBA,s.UNSIGNED_BYTE,t.data)}this.useMipmap&&this.isSizePowerOfTwo()&&s.generateMipmap(s.TEXTURE_2D),a.pixelStoreUnpackFlipY.setDefault(),a.pixelStoreUnpack.setDefault(),a.pixelStoreUnpackPremultiplyAlpha.setDefault()}bind(t,e,r){const{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(){const{gl:t}=this.context;t.deleteTexture(this.texture),this.texture=null}}class ul{constructor(t,e,r,i=1,n=1,o=1,a=0){if(this.uid=t,e.height!==e.width)throw new RangeError("DEM tiles must be square");if(r&&!["mapbox","terrarium","custom"].includes(r))return void Z(`"${r}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);this.stride=e.height;const s=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=o,this.baseShift=a;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4}for(let t=0;t<s;t++)this.data[this._idx(-1,t)]=this.data[this._idx(0,t)],this.data[this._idx(s,t)]=this.data[this._idx(s-1,t)],this.data[this._idx(t,-1)]=this.data[this._idx(t,0)],this.data[this._idx(t,s)]=this.data[this._idx(t,s-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(s,-1)]=this.data[this._idx(s-1,0)],this.data[this._idx(-1,s)]=this.data[this._idx(0,s-1)],this.data[this._idx(s,s)]=this.data[this._idx(s-1,s-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let t=0;t<s;t++)for(let e=0;e<s;e++){const r=this.get(t,e);r>this.max&&(this.max=r),r<this.min&&(this.min=r)}}get(t,e){const r=new Uint8Array(this.data.buffer),i=4*this._idx(t,e);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}pack(t){return pl(t,this.getUnpackVector())}getPixels(){return new el({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,o=r*this.dim,a=r*this.dim+this.dim;switch(e){case-1:i=n-1;break;case 1:n=i+1}switch(r){case-1:o=a-1;break;case 1:a=o+1}const s=-e*this.dim,l=-r*this.dim;for(let e=o;e<a;e++)for(let r=i;r<n;r++)this.data[this._idx(r,e)]=t.data[this._idx(r+s,e+l)]}}function pl(t,e){const r=e[0],i=e[1],n=e[2],o=e[3],a=Math.min(r,i,n),s=Math.round((t+o)/a);return{r:Math.floor(s*a/r)%256,g:Math.floor(s*a/i)%256,b:Math.floor(s*a/n)%256}}oo("DEMData",ul);class dl extends $o{constructor(t){super(t,cl)}_createColorRamp(t){const e={elevationStops:[],colorStops:[]},r=this._transitionablePaint._values["color-relief-color"].value.expression;if(r instanceof en&&r._styleExpression.expression instanceof ur){this.colorRampExpression=r;const t=r._styleExpression.expression;e.elevationStops=t.labels,e.colorStops=[];for(const r of e.elevationStops)e.colorStops.push(t.evaluate({globals:{elevation:r}}))}if(e.elevationStops.length<1&&(e.elevationStops=[0],e.colorStops=[Ce.transparent]),e.elevationStops.length<2&&(e.elevationStops.push(e.elevationStops[0]+1),e.colorStops.push(e.colorStops[0])),e.elevationStops.length<=t)return e;const i={elevationStops:[],colorStops:[]},n=(e.elevationStops.length-1)/(t-1);for(let t=0;t<e.elevationStops.length-.5;t+=n)i.elevationStops.push(e.elevationStops[Math.round(t)]),i.colorStops.push(e.colorStops[Math.round(t)]);return Z(`Too many colors in specification of ${this.id} color-relief layer, may not render properly.`),i}_colorRampChanged(){return this.colorRampExpression!=this._transitionablePaint._values["color-relief-color"].value.expression}getColorRampTextures(t,e,r){if(this.colorRampTextures&&!this._colorRampChanged())return this.colorRampTextures;const i=this._createColorRamp(e),n=new el({width:i.colorStops.length,height:1}),o=new el({width:i.colorStops.length,height:1});for(let t=0;t<i.elevationStops.length;t++){const e=pl(i.elevationStops[t],r);o.setPixel(0,t,new Ce(e.r/255,e.g/255,e.b/255,1)),n.setPixel(0,t,i.colorStops[t])}return this.colorRampTextures={elevationTexture:new hl(t,o,t.gl.RGBA),colorTexture:new hl(t,n,t.gl.RGBA)},this.colorRampTextures}hasOffscreenPass(){return"none"!==this.visibility&&!!this.colorRampTextures}}const fl=Ho([{name:"a_pos",components:2,type:"Int16"}],4),{members:ml}=fl;function gl(t,e,r){const i=r.patternDependencies;let n=!1;for(const r of e){const e=r.paint.get(`${t}-pattern`);e.isConstant()||(n=!0);const o=e.constantOr(null);o&&(n=!0,i[o.to]=!0,i[o.from]=!0)}return n}function _l(t,e,r,i,n){const o=n.patternDependencies;for(const a of e){const e=a.paint.get(`${t}-pattern`).value;if("constant"!==e.kind){let t=e.evaluate({zoom:i-1},r,{},n.availableImages),s=e.evaluate({zoom:i},r,{},n.availableImages),l=e.evaluate({zoom:i+1},r,{},n.availableImages);t=t&&t.name?t.name:t,s=s&&s.name?s.name:s,l=l&&l.name?l.name:l,o[t]=!0,o[s]=!0,o[l]=!0,r.patterns[a.id]={min:t,mid:s,max:l}}}return r}function yl(t,e,r,i,n){let o;if(n===function(t,e,r,i){let n=0;for(let o=e,a=r-i;o<r;o+=i)n+=(t[a]-t[o])*(t[o+1]+t[a+1]),a=o;return n}(t,e,r,i)>0)for(let n=e;n<r;n+=i)o=Ul(n/i|0,t[n],t[n+1],o);else for(let n=r-i;n>=e;n-=i)o=Ul(n/i|0,t[n],t[n+1],o);return o&&Dl(o,o.next)&&(Nl(o),o=o.next),o}function bl(t,e){if(!t)return t;e||(e=t);let r,i=t;do{if(r=!1,i.steiner||!Dl(i,i.next)&&0!==Rl(i.prev,i,i.next))i=i.next;else{if(Nl(i),i=e=i.prev,i===i.next)break;r=!0}}while(r||i!==e);return e}function vl(t,e,r,i,n,o,a){if(!t)return;!a&&o&&function(t,e,r,i){let n=t;do{0===n.z&&(n.z=Al(n.x,n.y,e,r,i)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next}while(n!==t);n.prevZ.nextZ=null,n.prevZ=null,function(t){let e,r=1;do{let i,n=t;t=null;let o=null;for(e=0;n;){e++;let a=n,s=0;for(let t=0;t<r&&(s++,a=a.nextZ,a);t++);let l=r;for(;s>0||l>0&&a;)0!==s&&(0===l||!a||n.z<=a.z)?(i=n,n=n.nextZ,s--):(i=a,a=a.nextZ,l--),o?o.nextZ=i:t=i,i.prevZ=o,o=i;n=a}o.nextZ=null,r*=2}while(e>1)}(n)}(t,i,n,o);let s=t;for(;t.prev!==t.next;){const l=t.prev,c=t.next;if(o?wl(t,i,n,o):xl(t))e.push(l.i,t.i,c.i),Nl(t),t=c.next,s=c.next;else if((t=c)===s){a?1===a?vl(t=Tl(bl(t),e),e,r,i,n,o,2):2===a&&Sl(t,e,r,i,n,o):vl(bl(t),e,r,i,n,o,1);break}}}function xl(t){const e=t.prev,r=t,i=t.next;if(Rl(e,r,i)>=0)return!1;const n=e.x,o=r.x,a=i.x,s=e.y,l=r.y,c=i.y,h=Math.min(n,o,a),u=Math.min(s,l,c),p=Math.max(n,o,a),d=Math.max(s,l,c);let f=i.next;for(;f!==e;){if(f.x>=h&&f.x<=p&&f.y>=u&&f.y<=d&&kl(n,s,o,l,a,c,f.x,f.y)&&Rl(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}function wl(t,e,r,i){const n=t.prev,o=t,a=t.next;if(Rl(n,o,a)>=0)return!1;const s=n.x,l=o.x,c=a.x,h=n.y,u=o.y,p=a.y,d=Math.min(s,l,c),f=Math.min(h,u,p),m=Math.max(s,l,c),g=Math.max(h,u,p),_=Al(d,f,e,r,i),y=Al(m,g,e,r,i);let b=t.prevZ,v=t.nextZ;for(;b&&b.z>=_&&v&&v.z<=y;){if(b.x>=d&&b.x<=m&&b.y>=f&&b.y<=g&&b!==n&&b!==a&&kl(s,h,l,u,c,p,b.x,b.y)&&Rl(b.prev,b,b.next)>=0)return!1;if(b=b.prevZ,v.x>=d&&v.x<=m&&v.y>=f&&v.y<=g&&v!==n&&v!==a&&kl(s,h,l,u,c,p,v.x,v.y)&&Rl(v.prev,v,v.next)>=0)return!1;v=v.nextZ}for(;b&&b.z>=_;){if(b.x>=d&&b.x<=m&&b.y>=f&&b.y<=g&&b!==n&&b!==a&&kl(s,h,l,u,c,p,b.x,b.y)&&Rl(b.prev,b,b.next)>=0)return!1;b=b.prevZ}for(;v&&v.z<=y;){if(v.x>=d&&v.x<=m&&v.y>=f&&v.y<=g&&v!==n&&v!==a&&kl(s,h,l,u,c,p,v.x,v.y)&&Rl(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}function Tl(t,e){let r=t;do{const i=r.prev,n=r.next.next;!Dl(i,n)&&Ll(i,r,r.next,n)&&Ol(i,n)&&Ol(n,i)&&(e.push(i.i,r.i,n.i),Nl(r),Nl(r.next),r=t=n),r=r.next}while(r!==t);return bl(r)}function Sl(t,e,r,i,n,o){let a=t;do{let t=a.next.next;for(;t!==a.prev;){if(a.i!==t.i&&zl(a,t)){let s=jl(a,t);return a=bl(a,a.next),s=bl(s,s.next),vl(a,e,r,i,n,o,0),void vl(s,e,r,i,n,o,0)}t=t.next}a=a.next}while(a!==t)}function Pl(t,e){let r=t.x-e.x;return 0===r&&(r=t.y-e.y,0===r)&&(r=(t.next.y-t.y)/(t.next.x-t.x)-(e.next.y-e.y)/(e.next.x-e.x)),r}function Cl(t,e){const r=function(t,e){let r=e;const i=t.x,n=t.y;let o,a=-1/0;if(Dl(t,r))return r;do{if(Dl(t,r.next))return r.next;if(n<=r.y&&n>=r.next.y&&r.next.y!==r.y){const t=r.x+(n-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(t<=i&&t>a&&(a=t,o=r.x<r.next.x?r:r.next,t===i))return o}r=r.next}while(r!==e);if(!o)return null;const s=o,l=o.x,c=o.y;let h=1/0;r=o;do{if(i>=r.x&&r.x>=l&&i!==r.x&&El(n<c?i:a,n,l,c,n<c?a:i,n,r.x,r.y)){const e=Math.abs(n-r.y)/(i-r.x);Ol(r,t)&&(e<h||e===h&&(r.x>o.x||r.x===o.x&&Ml(o,r)))&&(o=r,h=e)}r=r.next}while(r!==s);return o}(t,e);if(!r)return e;const i=jl(r,t);return bl(i,i.next),bl(r,r.next)}function Ml(t,e){return Rl(t.prev,t,e.prev)<0&&Rl(e.next,t,t.next)<0}function Al(t,e,r,i,n){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-r)*n|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-i)*n|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Il(t){let e=t,r=t;do{(e.x<r.x||e.x===r.x&&e.y<r.y)&&(r=e),e=e.next}while(e!==t);return r}function El(t,e,r,i,n,o,a,s){return(n-a)*(e-s)>=(t-a)*(o-s)&&(t-a)*(i-s)>=(r-a)*(e-s)&&(r-a)*(o-s)>=(n-a)*(i-s)}function kl(t,e,r,i,n,o,a,s){return!(t===a&&e===s)&&El(t,e,r,i,n,o,a,s)}function zl(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){let r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&Ll(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}(t,e)&&(Ol(t,e)&&Ol(e,t)&&function(t,e){let r=t,i=!1;const n=(t.x+e.x)/2,o=(t.y+e.y)/2;do{r.y>o!=r.next.y>o&&r.next.y!==r.y&&n<(r.next.x-r.x)*(o-r.y)/(r.next.y-r.y)+r.x&&(i=!i),r=r.next}while(r!==t);return i}(t,e)&&(Rl(t.prev,t,e.prev)||Rl(t,e.prev,e))||Dl(t,e)&&Rl(t.prev,t,t.next)>0&&Rl(e.prev,e,e.next)>0)}function Rl(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function Dl(t,e){return t.x===e.x&&t.y===e.y}function Ll(t,e,r,i){const n=Bl(Rl(t,e,r)),o=Bl(Rl(t,e,i)),a=Bl(Rl(r,i,t)),s=Bl(Rl(r,i,e));return n!==o&&a!==s||!(0!==n||!Fl(t,r,e))||!(0!==o||!Fl(t,i,e))||!(0!==a||!Fl(r,t,i))||!(0!==s||!Fl(r,e,i))}function Fl(t,e,r){return e.x<=Math.max(t.x,r.x)&&e.x>=Math.min(t.x,r.x)&&e.y<=Math.max(t.y,r.y)&&e.y>=Math.min(t.y,r.y)}function Bl(t){return t>0?1:t<0?-1:0}function Ol(t,e){return Rl(t.prev,t,t.next)<0?Rl(t,e,t.next)>=0&&Rl(t,t.prev,e)>=0:Rl(t,e,t.prev)<0||Rl(t,t.next,e)<0}function jl(t,e){const r=Vl(t.i,t.x,t.y),i=Vl(e.i,e.x,e.y),n=t.next,o=e.prev;return t.next=e,e.prev=t,r.next=n,n.prev=r,i.next=r,r.prev=i,o.next=i,i.prev=o,i}function Ul(t,e,r,i){const n=Vl(t,e,r);return i?(n.next=i.next,n.prev=i,i.next.prev=n,i.next=n):(n.prev=n,n.next=n),n}function Nl(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Vl(t,e,r){return{i:t,x:e,y:r,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}class $l{constructor(t,e){if(e>t)throw new Error("Min granularity must not be greater than base granularity.");this._baseZoomGranularity=t,this._minGranularity=e}getGranularityForZoomLevel(t){return Math.max(Math.floor(this._baseZoomGranularity/(1<<t)),this._minGranularity,1)}}class Zl{constructor(t){this.fill=t.fill,this.line=t.line,this.tile=t.tile,this.stencil=t.stencil,this.circle=t.circle}}Zl.noSubdivision=new Zl({fill:new $l(0,0),line:new $l(0,0),tile:new $l(0,0),stencil:new $l(0,0),circle:1}),oo("SubdivisionGranularityExpression",$l),oo("SubdivisionGranularitySetting",Zl);const Gl=-32768,ql=32767;class Hl{constructor(t,e){this._vertexBuffer=[],this._vertexDictionary=new Map,this._used=!1,this._granularity=t,this._granularityCellSize=I/t,this._canonical=e}_getKey(t,e){return(t+=32768)<<16|e+32768}_vertexToIndex(t,e){if(t<-32768||e<-32768||t>32767||e>32767)throw new Error("Vertex coordinates are out of signed 16 bit integer range.");const r=0|Math.round(t),i=0|Math.round(e),n=this._getKey(r,i);if(this._vertexDictionary.has(n))return this._vertexDictionary.get(n);const o=this._vertexBuffer.length/2;return this._vertexDictionary.set(n,o),this._vertexBuffer.push(r,i),o}_subdivideTrianglesScanline(t){if(this._granularity<2)return function(t,e){const r=[];for(let i=0;i<e.length;i+=3){const n=e[i],o=e[i+1],a=e[i+2],s=t[2*n],l=t[2*n+1];(t[2*o]-s)*(t[2*a+1]-l)-(t[2*o+1]-l)*(t[2*a]-s)>0?(r.push(n),r.push(a),r.push(o)):(r.push(n),r.push(o),r.push(a))}return r}(this._vertexBuffer,t);const e=[],r=t.length;for(let i=0;i<r;i+=3){const r=[t[i+0],t[i+1],t[i+2]],n=[this._vertexBuffer[2*t[i+0]+0],this._vertexBuffer[2*t[i+0]+1],this._vertexBuffer[2*t[i+1]+0],this._vertexBuffer[2*t[i+1]+1],this._vertexBuffer[2*t[i+2]+0],this._vertexBuffer[2*t[i+2]+1]];let o=1/0,a=1/0,s=-1/0,l=-1/0;for(let t=0;t<3;t++){const e=n[2*t],r=n[2*t+1];o=Math.min(o,e),s=Math.max(s,e),a=Math.min(a,r),l=Math.max(l,r)}if(o===s||a===l)continue;const c=Math.floor(o/this._granularityCellSize),h=Math.ceil(s/this._granularityCellSize),u=Math.floor(a/this._granularityCellSize),p=Math.ceil(l/this._granularityCellSize);if(c!==h||u!==p)for(let t=u;t<p;t++){const i=this._scanlineGenerateVertexRingForCellRow(t,n,r);Kl(this._vertexBuffer,i,e)}else e.push(...r)}return e}_scanlineGenerateVertexRingForCellRow(t,e,r){const i=t*this._granularityCellSize,n=i+this._granularityCellSize,o=[];for(let t=0;t<3;t++){const a=e[2*t],s=e[2*t+1],l=e[2*(t+1)%6],c=e[(2*(t+1)+1)%6],h=e[2*(t+2)%6],u=e[(2*(t+2)+1)%6],p=l-a,d=c-s,f=0===p,m=0===d,g=(i-s)/d,_=(n-s)/d,y=Math.min(g,_),b=Math.max(g,_);if(!m&&(y>=1||b<=0)||m&&(s<i||s>n)){c>=i&&c<=n&&o.push(r[(t+1)%3]);continue}!m&&y>0&&o.push(this._vertexToIndex(a+p*y,s+d*y));const v=a+p*Math.max(y,0),x=a+p*Math.min(b,1);f||this._generateIntraEdgeVertices(o,a,s,l,c,v,x),!m&&b<1&&o.push(this._vertexToIndex(a+p*b,s+d*b)),(m||c>=i&&c<=n)&&o.push(r[(t+1)%3]),!m&&(c<=i||c>=n)&&this._generateInterEdgeVertices(o,a,s,l,c,h,u,x,i,n)}return o}_generateIntraEdgeVertices(t,e,r,i,n,o,a){const s=i-e,l=n-r,c=0===l,h=c?Math.min(e,i):Math.min(o,a),u=c?Math.max(e,i):Math.max(o,a),p=Math.floor(h/this._granularityCellSize)+1,d=Math.ceil(u/this._granularityCellSize)-1;if(c?e<i:o<a)for(let i=p;i<=d;i++){const n=i*this._granularityCellSize;t.push(this._vertexToIndex(n,r+l*(n-e)/s))}else for(let i=d;i>=p;i--){const n=i*this._granularityCellSize;t.push(this._vertexToIndex(n,r+l*(n-e)/s))}}_generateInterEdgeVertices(t,e,r,i,n,o,a,s,l,c){const h=n-r,u=o-i,p=a-n,d=(l-n)/p,f=(c-n)/p,m=Math.min(d,f),g=Math.max(d,f),_=i+u*m;let y=Math.floor(Math.min(_,s)/this._granularityCellSize)+1,b=Math.ceil(Math.max(_,s)/this._granularityCellSize)-1,v=s<_;const x=0===p;if(x&&(a===l||a===c))return;if(x||m>=1||g<=0){const t=r-a,i=o+(e-o)*Math.min((l-a)/t,(c-a)/t);y=Math.floor(Math.min(i,s)/this._granularityCellSize)+1,b=Math.ceil(Math.max(i,s)/this._granularityCellSize)-1,v=s<i}const w=h>0?c:l;if(v)for(let e=y;e<=b;e++)t.push(this._vertexToIndex(e*this._granularityCellSize,w));else for(let e=b;e>=y;e--)t.push(this._vertexToIndex(e*this._granularityCellSize,w))}_generateOutline(t){const e=[];for(const r of t){const t=Xl(r,this._granularity,!0),i=this._pointArrayToIndices(t),n=[];for(let t=1;t<i.length;t++)n.push(i[t-1]),n.push(i[t]);e.push(n)}return e}_handlePoles(t){let e=!1,r=!1;this._canonical&&(0===this._canonical.y&&(e=!0),this._canonical.y===(1<<this._canonical.z)-1&&(r=!0)),(e||r)&&this._fillPoles(t,e,r)}_ensureNoPoleVertices(){const t=this._vertexBuffer;for(let e=0;e<t.length;e+=2){const r=t[e+1];r===Gl&&(t[e+1]=-32767),r===ql&&(t[e+1]=32766)}}_generatePoleQuad(t,e,r,i,n,o){i>n!=(o===Gl)?(t.push(e),t.push(r),t.push(this._vertexToIndex(i,o)),t.push(r),t.push(this._vertexToIndex(n,o)),t.push(this._vertexToIndex(i,o))):(t.push(r),t.push(e),t.push(this._vertexToIndex(i,o)),t.push(this._vertexToIndex(n,o)),t.push(r),t.push(this._vertexToIndex(i,o)))}_fillPoles(t,e,r){const i=this._vertexBuffer,n=I,o=t.length;for(let a=2;a<o;a+=3){const o=t[a-2],s=t[a-1],l=t[a],c=i[2*o],h=i[2*o+1],u=i[2*s],p=i[2*s+1],d=i[2*l],f=i[2*l+1];e&&(0===h&&0===p&&this._generatePoleQuad(t,o,s,c,u,Gl),0===p&&0===f&&this._generatePoleQuad(t,s,l,u,d,Gl),0===f&&0===h&&this._generatePoleQuad(t,l,o,d,c,Gl)),r&&(h===n&&p===n&&this._generatePoleQuad(t,o,s,c,u,ql),p===n&&f===n&&this._generatePoleQuad(t,s,l,u,d,ql),f===n&&h===n&&this._generatePoleQuad(t,l,o,d,c,ql))}}_initializeVertices(t){for(let e=0;e<t.length;e+=2)this._vertexToIndex(t[e],t[e+1])}subdividePolygonInternal(t,e){if(this._used)throw new Error("Subdivision: multiple use not allowed.");this._used=!0;const{flattened:r,holeIndices:i}=function(t){const e=[],r=[];for(const i of t)if(0!==i.length){i!==t[0]&&e.push(r.length/2);for(let t=0;t<i.length;t++)r.push(i[t].x),r.push(i[t].y)}return{flattened:r,holeIndices:e}}(t);let n;this._initializeVertices(r);try{const t=function(t,e,r=2){const i=e&&e.length,n=i?e[0]*r:t.length;let o=yl(t,0,n,r,!0);const a=[];if(!o||o.next===o.prev)return a;let s,l,c;if(i&&(o=function(t,e,r,i){const n=[];for(let r=0,o=e.length;r<o;r++){const a=yl(t,e[r]*i,r<o-1?e[r+1]*i:t.length,i,!1);a===a.next&&(a.steiner=!0),n.push(Il(a))}n.sort(Pl);for(let t=0;t<n.length;t++)r=Cl(n[t],r);return r}(t,e,o,r)),t.length>80*r){s=t[0],l=t[1];let e=s,i=l;for(let o=r;o<n;o+=r){const r=t[o],n=t[o+1];r<s&&(s=r),n<l&&(l=n),r>e&&(e=r),n>i&&(i=n)}c=Math.max(e-s,i-l),c=0!==c?32767/c:0}return vl(o,a,r,s,l,c,0),a}(r,i),e=this._convertIndices(r,t);n=this._subdivideTrianglesScanline(e)}catch(t){console.error(t)}let o=[];return e&&(o=this._generateOutline(t)),this._ensureNoPoleVertices(),this._handlePoles(n),{verticesFlattened:this._vertexBuffer,indicesTriangles:n,indicesLineList:o}}_convertIndices(t,e){const r=[];for(let i=0;i<e.length;i++)r.push(this._vertexToIndex(t[2*e[i]],t[2*e[i]+1]));return r}_pointArrayToIndices(t){const e=[];for(let r=0;r<t.length;r++){const i=t[r];e.push(this._vertexToIndex(i.x,i.y))}return e}}function Wl(t,e,r,i=!0){return new Hl(r,e).subdividePolygonInternal(t,i)}function Xl(t,e,i=!1){if(!t||t.length<1)return[];if(t.length<2)return[];const n=t[0],o=t[t.length-1],a=i&&(n.x!==o.x||n.y!==o.y);if(e<2)return a?[...t,t[0]]:[...t];const s=Math.floor(I/e),l=[];l.push(new r(t[0].x,t[0].y));const c=t.length,h=a?c:c-1;for(let e=0;e<h;e++){const i=t[e],n=e<c-1?t[e+1]:t[0],o=i.x,a=i.y,h=n.x,u=n.y,p=o!==h,d=a!==u;if(!p&&!d)continue;const f=h-o,m=u-a,g=Math.abs(f),_=Math.abs(m);let y=o,b=a;for(;;){const t=f>0?(Math.floor(y/s)+1)*s:(Math.ceil(y/s)-1)*s,e=m>0?(Math.floor(b/s)+1)*s:(Math.ceil(b/s)-1)*s,i=Math.abs(y-t),n=Math.abs(b-e),o=Math.abs(y-h),a=Math.abs(b-u),c=p?i/g:Number.POSITIVE_INFINITY,v=d?n/_:Number.POSITIVE_INFINITY;if((o<=i||!p)&&(a<=n||!d))break;if(c<v&&p||!d){y=t,b+=m*c;const e=new r(y,Math.round(b));l[l.length-1].x===e.x&&l[l.length-1].y===e.y||l.push(e)}else{y+=f*v,b=e;const t=new r(Math.round(y),b);l[l.length-1].x===t.x&&l[l.length-1].y===t.y||l.push(t)}}const v=new r(h,u);l[l.length-1].x===v.x&&l[l.length-1].y===v.y||l.push(v)}return l}function Kl(t,e,r){if(0===e.length)throw new Error("Subdivision vertex ring is empty.");let i=0,n=t[2*e[0]];for(let r=1;r<e.length;r++){const o=t[2*e[r]];o<n&&(n=o,i=r)}const o=e.length;let a=i,s=(a+1)%o;for(;;){const i=a-1>=0?a-1:o-1,n=(s+1)%o,l=t[2*e[i]],c=t[2*e[n]],h=t[2*e[a]],u=t[2*e[a]+1],p=t[2*e[s]+1];let d=!1;if(l<c)d=!0;else if(l>c)d=!1;else{const r=p-u,o=-(t[2*e[s]]-h),a=u<p?1:-1;((l-h)*r+(t[2*e[i]+1]-u)*o)*a>((c-h)*r+(t[2*e[n]+1]-u)*o)*a&&(d=!0)}if(d){const t=e[i],n=e[a],l=e[s];t!==n&&t!==l&&n!==l&&r.push(l,n,t),a--,a<0&&(a=o-1)}else{const t=e[n],i=e[a],l=e[s];t!==i&&t!==l&&i!==l&&r.push(l,i,t),s++,s>=o&&(s=0)}if(i===n)break}}function Yl(t,e,r,i,n,o,a,s,l){const c=n.length/2,h=a&&s&&l;if(c<qa.MAX_VERTEX_ARRAY_LENGTH){const u=e.prepareSegment(c,r,i),p=u.vertexLength;for(let t=0;t<o.length;t+=3)i.emplaceBack(p+o[t],p+o[t+1],p+o[t+2]);let d,f;u.vertexLength+=c,u.primitiveLength+=o.length/3,h&&(f=a.prepareSegment(c,r,s),d=f.vertexLength,f.vertexLength+=c);for(let e=0;e<n.length;e+=2)t(n[e],n[e+1]);if(h)for(let t=0;t<l.length;t++){const e=l[t];for(let t=1;t<e.length;t+=2)s.emplaceBack(d+e[t-1],d+e[t]);f.primitiveLength+=e.length/2}}else!function(t,e,r,i,n,o){const a=[];for(let t=0;t<i.length/2;t++)a.push(-1);const s={count:0};let l=0,c=t.getOrCreateLatestSegment(e,r),h=c.vertexLength;for(let u=2;u<n.length;u+=3){const p=n[u-2],d=n[u-1],f=n[u];let m=a[p]<l,g=a[d]<l,_=a[f]<l;c.vertexLength+((m?1:0)+(g?1:0)+(_?1:0))>qa.MAX_VERTEX_ARRAY_LENGTH&&(c=t.createNewSegment(e,r),l=s.count,m=!0,g=!0,_=!0,h=0);const y=Jl(a,i,o,s,p,m,c),b=Jl(a,i,o,s,d,g,c),v=Jl(a,i,o,s,f,_,c);r.emplaceBack(h+y-l,h+b-l,h+v-l),c.primitiveLength++}}(e,r,i,n,o,t),h&&function(t,e,r,i,n,o){const a=[];for(let t=0;t<i.length/2;t++)a.push(-1);const s={count:0};let l=0,c=t.getOrCreateLatestSegment(e,r),h=c.vertexLength;for(let u=0;u<n.length;u++){const p=n[u];for(let d=1;d<n[u].length;d+=2){const n=p[d-1],u=p[d];let f=a[n]<l,m=a[u]<l;c.vertexLength+((f?1:0)+(m?1:0))>qa.MAX_VERTEX_ARRAY_LENGTH&&(c=t.createNewSegment(e,r),l=s.count,f=!0,m=!0,h=0);const g=Jl(a,i,o,s,n,f,c),_=Jl(a,i,o,s,u,m,c);r.emplaceBack(h+g-l,h+_-l),c.primitiveLength++}}}(a,r,s,n,l,t),e.forceNewSegmentOnNextPrepare(),null==a||a.forceNewSegmentOnNextPrepare()}function Jl(t,e,r,i,n,o,a){if(o){const o=i.count;return r(e[2*n],e[2*n+1]),t[n]=i.count,i.count++,a.vertexLength++,o}return t[n]}class Ql{constructor(t){this.zoom=t.zoom,this.globalState=t.globalState,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(t=>t.id),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new za,this.indexArray=new Va,this.indexArray2=new $a,this.programConfigurations=new bs(t.layers,t.zoom),this.segments=new qa,this.segments2=new qa,this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id)}populate(t,e,r){this.hasPattern=gl("fill",this.layers,e);const i=this.layers[0].layout.get("fill-sort-key"),n=!i.isConstant(),o=[];for(const{feature:a,id:s,index:l,sourceLayerIndex:c}of t){const t=this.layers[0]._featureFilter.needGeometry,h=Ps(a,t);if(!this.layers[0]._featureFilter.filter(new Mo(this.zoom,{globalState:this.globalState}),h,r))continue;const u=n?i.evaluate(h,{},r,e.availableImages):void 0,p={id:s,properties:a.properties,type:a.type,sourceLayerIndex:c,index:l,geometry:t?h.geometry:Ss(a),patterns:{},sortKey:u};o.push(p)}n&&o.sort((t,e)=>t.sortKey-e.sortKey);for(const i of o){const{geometry:n,index:o,sourceLayerIndex:a}=i;if(this.hasPattern){const t=_l("fill",this.layers,i,this.zoom,e);this.patternFeatures.push(t)}else this.addFeature(i,n,o,r,{},e.subdivisionGranularity);e.featureIndex.insert(t[o].feature,n,o,a,this.index)}}update(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,{imagePositions:r,globalState:this.globalState})}addFeatures(t,e,r){for(const i of this.patternFeatures)this.addFeature(i,i.geometry,i.index,e,r,t.subdivisionGranularity)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,ml),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,o){for(const t of Jr(e,500)){const e=Wl(t,i,o.fill.getGranularityForZoomLevel(i.z)),r=this.layoutVertexArray;Yl((t,e)=>{r.emplaceBack(t,e)},this.segments,this.layoutVertexArray,this.indexArray,e.verticesFlattened,e.indicesTriangles,this.segments2,this.indexArray2,e.indicesLineList)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,{imagePositions:n,canonical:i,globalState:this.globalState})}}let tc,ec;oo("FillBucket",Ql,{omit:["layers","patternFeatures"]});var rc={get paint(){return ec=ec||new No({"fill-antialias":new Fo(yt.paint_fill["fill-antialias"]),"fill-opacity":new Bo(yt.paint_fill["fill-opacity"]),"fill-color":new Bo(yt.paint_fill["fill-color"]),"fill-outline-color":new Bo(yt.paint_fill["fill-outline-color"]),"fill-translate":new Fo(yt.paint_fill["fill-translate"]),"fill-translate-anchor":new Fo(yt.paint_fill["fill-translate-anchor"]),"fill-pattern":new Oo(yt.paint_fill["fill-pattern"])})},get layout(){return tc=tc||new No({"fill-sort-key":new Bo(yt.layout_fill["fill-sort-key"])})}};class ic extends $o{constructor(t){super(t,rc)}recalculate(t,e){super.recalculate(t,e);const r=this.paint._values["fill-outline-color"];"constant"===r.value.kind&&void 0===r.value.value&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(t){return new Ql(t)}queryRadius(){return Ns(this.paint.get("fill-translate"))}queryIntersectsFeature({queryGeometry:t,geometry:e,transform:r,pixelsToTileUnits:i}){return ks(Vs(t,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),-r.bearingInRadians,i),e)}isTileClipped(){return!0}}const nc=Ho([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),oc=Ho([{name:"a_centroid",components:2,type:"Int16"}],4),{members:ac}=nc;class sc{constructor(t,e,r,i,n){this.properties={},this.extent=r,this.type=0,this.id=void 0,this._pbf=t,this._geometry=-1,this._keys=i,this._values=n,t.readFields(lc,this,e)}loadGeometry(){const t=this._pbf;t.pos=this._geometry;const e=t.readVarint()+t.pos,i=[];let n,o=1,a=0,s=0,l=0;for(;t.pos<e;){if(a<=0){const e=t.readVarint();o=7&e,a=e>>3}if(a--,1===o||2===o)s+=t.readSVarint(),l+=t.readSVarint(),1===o&&(n&&i.push(n),n=[]),n&&n.push(new r(s,l));else{if(7!==o)throw new Error(`unknown command ${o}`);n&&n.push(n[0].clone())}}return n&&i.push(n),i}bbox(){const t=this._pbf;t.pos=this._geometry;const e=t.readVarint()+t.pos;let r=1,i=0,n=0,o=0,a=1/0,s=-1/0,l=1/0,c=-1/0;for(;t.pos<e;){if(i<=0){const e=t.readVarint();r=7&e,i=e>>3}if(i--,1===r||2===r)n+=t.readSVarint(),o+=t.readSVarint(),n<a&&(a=n),n>s&&(s=n),o<l&&(l=o),o>c&&(c=o);else if(7!==r)throw new Error(`unknown command ${r}`)}return[a,l,s,c]}toGeoJSON(t,e,r){const i=this.extent*Math.pow(2,r),n=this.extent*t,o=this.extent*e,a=this.loadGeometry();function s(t){return[360*(t.x+n)/i-180,360/Math.PI*Math.atan(Math.exp((1-2*(t.y+o)/i)*Math.PI))-90]}function l(t){return t.map(s)}let c;if(1===this.type){const t=[];for(const e of a)t.push(e[0]);const e=l(t);c=1===t.length?{type:"Point",coordinates:e[0]}:{type:"MultiPoint",coordinates:e}}else if(2===this.type){const t=a.map(l);c=1===t.length?{type:"LineString",coordinates:t[0]}:{type:"MultiLineString",coordinates:t}}else{if(3!==this.type)throw new Error("unknown feature type");{const t=function(t){const e=t.length;if(e<=1)return[t];const r=[];let i,n;for(let o=0;o<e;o++){const e=cc(t[o]);0!==e&&(void 0===n&&(n=e<0),n===e<0?(i&&r.push(i),i=[t[o]]):i&&i.push(t[o]))}return i&&r.push(i),r}(a),e=[];for(const r of t)e.push(r.map(l));c=1===e.length?{type:"Polygon",coordinates:e[0]}:{type:"MultiPolygon",coordinates:e}}}const h={type:"Feature",geometry:c,properties:this.properties};return null!=this.id&&(h.id=this.id),h}}function lc(t,e,r){1===t?e.id=r.readVarint():2===t?function(t,e){const r=t.readVarint()+t.pos;for(;t.pos<r;){const r=e._keys[t.readVarint()],i=e._values[t.readVarint()];e.properties[r]=i}}(r,e):3===t?e.type=r.readVarint():4===t&&(e._geometry=r.pos)}function cc(t){let e=0;for(let r,i,n=0,o=t.length,a=o-1;n<o;a=n++)r=t[n],i=t[a],e+=(i.x-r.x)*(r.y+i.y);return e}sc.types=["Unknown","Point","LineString","Polygon"];class hc{constructor(t,e){this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(uc,this,e),this.length=this._features.length}feature(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];const e=this._pbf.readVarint()+this._pbf.pos;return new sc(this._pbf,e,this.extent,this._keys,this._values)}}function uc(t,e,r){15===t?e.version=r.readVarint():1===t?e.name=r.readString():5===t?e.extent=r.readVarint():2===t?e._features.push(r.pos):3===t?e._keys.push(r.readString()):4===t&&e._values.push(function(t){let e=null;const r=t.readVarint()+t.pos;for(;t.pos<r;){const r=t.readVarint()>>3;e=1===r?t.readString():2===r?t.readFloat():3===r?t.readDouble():4===r?t.readVarint64():5===r?t.readVarint():6===r?t.readSVarint():7===r?t.readBoolean():null}if(null==e)throw new Error("unknown feature value");return e}(r))}class pc{constructor(t,e){this.layers=t.readFields(dc,{},e)}}function dc(t,e,r){if(3===t){const t=new hc(r,r.readVarint()+r.pos);t.length&&(e[t.name]=t)}}const fc=Math.pow(2,13);function mc(t,e,r,i,n,o,a,s){t.emplaceBack(e,r,2*Math.floor(i*fc)+a,n*fc*2,o*fc*2,Math.round(s))}class gc{constructor(t){this.zoom=t.zoom,this.globalState=t.globalState,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(t=>t.id),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new Ra,this.centroidVertexArray=new Ea,this.indexArray=new Va,this.programConfigurations=new bs(t.layers,t.zoom),this.segments=new qa,this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id)}populate(t,e,r){this.features=[],this.hasPattern=gl("fill-extrusion",this.layers,e);for(const{feature:i,id:n,index:o,sourceLayerIndex:a}of t){const t=this.layers[0]._featureFilter.needGeometry,s=Ps(i,t);if(!this.layers[0]._featureFilter.filter(new Mo(this.zoom,{globalState:this.globalState}),s,r))continue;const l={id:n,sourceLayerIndex:a,index:o,geometry:t?s.geometry:Ss(i),properties:i.properties,type:i.type,patterns:{}};this.hasPattern?this.features.push(_l("fill-extrusion",this.layers,l,this.zoom,e)):this.addFeature(l,l.geometry,o,r,{},e.subdivisionGranularity),e.featureIndex.insert(i,l.geometry,o,a,this.index,!0)}}addFeatures(t,e,r){for(const i of this.features){const{geometry:n}=i;this.addFeature(i,n,i.index,e,r,t.subdivisionGranularity)}}update(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,{imagePositions:r,globalState:this.globalState})}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.centroidVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,ac),this.centroidVertexBuffer=t.createVertexBuffer(this.centroidVertexArray,oc.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,o){for(const r of Jr(e,500)){const e={x:0,y:0,sampleCount:0},n=this.layoutVertexArray.length;this.processPolygon(e,i,t,r,o);const a=this.layoutVertexArray.length-n,s=Math.floor(e.x/e.sampleCount),l=Math.floor(e.y/e.sampleCount);for(let t=0;t<a;t++)this.centroidVertexArray.emplaceBack(s,l)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,{imagePositions:n,canonical:i,globalState:this.globalState})}processPolygon(t,e,r,i,n){if(i.length<1)return;if(bc(i[0]))return;for(const e of i)0!==e.length&&_c(t,e);const o={segment:this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray)},a=n.fill.getGranularityForZoomLevel(e.z),s="Polygon"===sc.types[r.type];for(const t of i){if(0===t.length)continue;if(bc(t))continue;const e=Xl(t,a,s);this._generateSideFaces(e,o)}if(!s)return;const l=Wl(i,e,a,!1),c=this.layoutVertexArray;Yl((t,e)=>{mc(c,t,e,0,0,1,1,0)},this.segments,this.layoutVertexArray,this.indexArray,l.verticesFlattened,l.indicesTriangles)}_generateSideFaces(t,e){let r=0;for(let i=1;i<t.length;i++){const n=t[i],o=t[i-1];if(yc(n,o))continue;e.segment.vertexLength+4>qa.MAX_VERTEX_ARRAY_LENGTH&&(e.segment=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const a=n.sub(o)._perp()._unit(),s=o.dist(n);r+s>32768&&(r=0),mc(this.layoutVertexArray,n.x,n.y,a.x,a.y,0,0,r),mc(this.layoutVertexArray,n.x,n.y,a.x,a.y,0,1,r),r+=s,mc(this.layoutVertexArray,o.x,o.y,a.x,a.y,0,0,r),mc(this.layoutVertexArray,o.x,o.y,a.x,a.y,0,1,r);const l=e.segment.vertexLength;this.indexArray.emplaceBack(l,l+2,l+1),this.indexArray.emplaceBack(l+1,l+2,l+3),e.segment.vertexLength+=4,e.segment.primitiveLength+=2}}}function _c(t,e){for(let r=0;r<e.length;r++){const i=e[r];r===e.length-1&&e[0].x===i.x&&e[0].y===i.y||(t.x+=i.x,t.y+=i.y,t.sampleCount++)}}function yc(t,e){return t.x===e.x&&(t.x<0||t.x>I)||t.y===e.y&&(t.y<0||t.y>I)}function bc(t){return t.every(t=>t.x<0)||t.every(t=>t.x>I)||t.every(t=>t.y<0)||t.every(t=>t.y>I)}let vc;oo("FillExtrusionBucket",gc,{omit:["layers","features"]});var xc={get paint(){return vc=vc||new No({"fill-extrusion-opacity":new Fo(yt["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Bo(yt["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Fo(yt["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Fo(yt["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Oo(yt["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Bo(yt["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Bo(yt["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Fo(yt["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class wc extends $o{constructor(t){super(t,xc)}createBucket(t){return new gc(t)}queryRadius(){return Ns(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature({queryGeometry:t,feature:e,featureState:i,geometry:n,transform:o,pixelsToTileUnits:a,pixelPosMatrix:s}){const l=Vs(t,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),-o.bearingInRadians,a),c=this.paint.get("fill-extrusion-height").evaluate(e,i),h=this.paint.get("fill-extrusion-base").evaluate(e,i),u=function(t,e){const i=[];for(const n of t){const t=[n.x,n.y,0,1];S(t,t,e),i.push(new r(t[0]/t[3],t[1]/t[3]))}return i}(l,s),p=function(t,e,i,n){const o=[],a=[],s=n[8]*e,l=n[9]*e,c=n[10]*e,h=n[11]*e,u=n[8]*i,p=n[9]*i,d=n[10]*i,f=n[11]*i;for(const e of t){const t=[],i=[];for(const o of e){const e=o.x,a=o.y,m=n[0]*e+n[4]*a+n[12],g=n[1]*e+n[5]*a+n[13],_=n[2]*e+n[6]*a+n[14],y=n[3]*e+n[7]*a+n[15],b=_+c,v=y+h,x=m+u,w=g+p,T=_+d,S=y+f,P=new r((m+s)/v,(g+l)/v);P.z=b/v,t.push(P);const C=new r(x/S,w/S);C.z=T/S,i.push(C)}o.push(t),a.push(i)}return[o,a]}(n,h,c,s);return function(t,e,r){let i=1/0;ks(r,e)&&(i=Sc(r,e[0]));for(let n=0;n<e.length;n++){const o=e[n],a=t[n];for(let t=0;t<o.length-1;t++){const e=o[t],n=[e,o[t+1],a[t+1],a[t],e];Is(r,n)&&(i=Math.min(i,Sc(r,n)))}}return i!==1/0&&i}(p[0],p[1],u)}}function Tc(t,e){return t.x*e.x+t.y*e.y}function Sc(t,e){if(1===t.length){let r=0;const i=e[r++];let n;for(;!n||i.equals(n);)if(n=e[r++],!n)return 1/0;for(;r<e.length;r++){const o=e[r],a=t[0],s=n.sub(i),l=o.sub(i),c=a.sub(i),h=Tc(s,s),u=Tc(s,l),p=Tc(l,l),d=Tc(c,s),f=Tc(c,l),m=h*p-u*u,g=(p*d-u*f)/m,_=(h*f-u*d)/m,y=i.z*(1-g-_)+n.z*g+o.z*_;if(isFinite(y))return y}return 1/0}{let t=1/0;for(const r of e)t=Math.min(t,r.z);return t}}const Pc=Ho([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:Cc}=Pc,Mc=Ho([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:Ac}=Mc,Ic=Math.cos(Math.PI/180*37.5),Ec=Math.pow(2,14)/.5;class kc{constructor(t){this.zoom=t.zoom,this.globalState=t.globalState,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(t=>t.id),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(t=>{this.gradients[t.id]={}}),this.layoutVertexArray=new Da,this.layoutVertexArray2=new La,this.indexArray=new Va,this.programConfigurations=new bs(t.layers,t.zoom),this.segments=new qa,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id)}populate(t,e,r){this.hasPattern=gl("line",this.layers,e);const i=this.layers[0].layout.get("line-sort-key"),n=!i.isConstant(),o=[];for(const{feature:e,id:a,index:s,sourceLayerIndex:l}of t){const t=this.layers[0]._featureFilter.needGeometry,c=Ps(e,t);if(!this.layers[0]._featureFilter.filter(new Mo(this.zoom,{globalState:this.globalState}),c,r))continue;const h=n?i.evaluate(c,{},r):void 0,u={id:a,properties:e.properties,type:e.type,sourceLayerIndex:l,index:s,geometry:t?c.geometry:Ss(e),patterns:{},sortKey:h};o.push(u)}n&&o.sort((t,e)=>t.sortKey-e.sortKey);for(const i of o){const{geometry:n,index:o,sourceLayerIndex:a}=i;if(this.hasPattern){const t=_l("line",this.layers,i,this.zoom,e);this.patternFeatures.push(t)}else this.addFeature(i,n,o,r,{},e.subdivisionGranularity);e.featureIndex.insert(t[o].feature,n,o,a,this.index)}}update(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,{imagePositions:r,globalState:this.globalState})}addFeatures(t,e,r){for(const i of this.patternFeatures)this.addFeature(i,i.geometry,i.index,e,r,t.subdivisionGranularity)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(0!==this.layoutVertexArray2.length&&(this.layoutVertexBuffer2=t.createVertexBuffer(this.layoutVertexArray2,Ac)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Cc),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"))return{start:+t.properties.mapbox_clip_start,end:+t.properties.mapbox_clip_end}}addFeature(t,e,r,i,n,o){const a=this.layers[0].layout,s=a.get("line-join").evaluate(t,{}),l=a.get("line-cap"),c=a.get("line-miter-limit"),h=a.get("line-round-limit");this.lineClips=this.lineFeatureClips(t);for(const r of e)this.addLine(r,t,s,l,c,h,i,o);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,{imagePositions:n,canonical:i,globalState:this.globalState})}addLine(t,e,r,i,n,o,a,s){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,t=Xl(t,a?s.line.getGranularityForZoomLevel(a.z):1),this.lineClips){this.lineClipsArray.push(this.lineClips);for(let e=0;e<t.length-1;e++)this.totalDistance+=t[e].dist(t[e+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const l="Polygon"===sc.types[e.type];let c=t.length;for(;c>=2&&t[c-1].equals(t[c-2]);)c--;let h=0;for(;h<c-1&&t[h].equals(t[h+1]);)h++;if(c<(l?3:2))return;"bevel"===r&&(n=1.05);const u=this.overscaling<=16?122880/(512*this.overscaling):0,p=this.segments.prepareSegment(10*c,this.layoutVertexArray,this.indexArray);let d,f,m,g,_;this.e1=this.e2=-1,l&&(d=t[c-2],_=t[h].sub(d)._unit()._perp());for(let e=h;e<c;e++){if(m=e===c-1?l?t[h+1]:void 0:t[e+1],m&&t[e].equals(m))continue;_&&(g=_),d&&(f=d),d=t[e],_=m?m.sub(d)._unit()._perp():g,g=g||_;let a=g.add(_);0===a.x&&0===a.y||a._unit();const s=g.x*_.x+g.y*_.y,y=a.x*_.x+a.y*_.y,b=0!==y?1/y:1/0,v=2*Math.sqrt(2-2*y),x=y<Ic&&f&&m,w=g.x*_.y-g.y*_.x>0;if(x&&e>h){const t=d.dist(f);if(t>2*u){const e=d.sub(d.sub(f)._mult(u/t)._round());this.updateDistance(f,e),this.addCurrentVertex(e,g,0,0,p),f=e}}const T=f&&m;let S=T?r:l?"butt":i;if(T&&"round"===S&&(b<o?S="miter":b<=2&&(S="fakeround")),"miter"===S&&b>n&&(S="bevel"),"bevel"===S&&(b>2&&(S="flipbevel"),b<n&&(S="miter")),f&&this.updateDistance(f,d),"miter"===S)a._mult(b),this.addCurrentVertex(d,a,0,0,p);else if("flipbevel"===S){if(b>100)a=_.mult(-1);else{const t=b*g.add(_).mag()/g.sub(_).mag();a._perp()._mult(t*(w?-1:1))}this.addCurrentVertex(d,a,0,0,p),this.addCurrentVertex(d,a.mult(-1),0,0,p)}else if("bevel"===S||"fakeround"===S){const t=-Math.sqrt(b*b-1),e=w?t:0,r=w?0:t;if(f&&this.addCurrentVertex(d,g,e,r,p),"fakeround"===S){const t=Math.round(180*v/Math.PI/20);for(let e=1;e<t;e++){let r=e/t;if(.5!==r){const t=r-.5;r+=r*t*(r-1)*((1.0904+s*(s*(3.55645-1.43519*s)-3.2452))*t*t+(.848013+s*(.215638*s-1.06021)))}const i=_.sub(g)._mult(r)._add(g)._unit()._mult(w?-1:1);this.addHalfVertex(d,i.x,i.y,!1,w,0,p)}}m&&this.addCurrentVertex(d,_,-e,-r,p)}else if("butt"===S)this.addCurrentVertex(d,a,0,0,p);else if("square"===S){const t=f?1:-1;this.addCurrentVertex(d,a,t,t,p)}else"round"===S&&(f&&(this.addCurrentVertex(d,g,0,0,p),this.addCurrentVertex(d,g,1,1,p,!0)),m&&(this.addCurrentVertex(d,_,-1,-1,p,!0),this.addCurrentVertex(d,_,0,0,p)));if(x&&e<c-1){const t=d.dist(m);if(t>2*u){const e=d.add(m.sub(d)._mult(u/t)._round());this.updateDistance(d,e),this.addCurrentVertex(e,_,0,0,p),d=e}}}}addCurrentVertex(t,e,r,i,n,o=!1){const a=e.y*i-e.x,s=-e.y-e.x*i;this.addHalfVertex(t,e.x+e.y*r,e.y-e.x*r,o,!1,r,n),this.addHalfVertex(t,a,s,o,!0,-i,n),this.distance>Ec/2&&0===this.totalDistance&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(t,e,r,i,n,o))}addHalfVertex({x:t,y:e},r,i,n,o,a,s){const l=.5*(this.lineClips?this.scaledDistance*(Ec-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((t<<1)+(n?1:0),(e<<1)+(o?1:0),Math.round(63*r)+128,Math.round(63*i)+128,1+(0===a?0:a<0?-1:1)|(63&l)<<2,l>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const c=s.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,c,this.e2),s.primitiveLength++),o?this.e2=c:this.e1=c}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()}}let zc,Rc;oo("LineBucket",kc,{omit:["layers","patternFeatures"]});var Dc={get paint(){return Rc=Rc||new No({"line-opacity":new Bo(yt.paint_line["line-opacity"]),"line-color":new Bo(yt.paint_line["line-color"]),"line-translate":new Fo(yt.paint_line["line-translate"]),"line-translate-anchor":new Fo(yt.paint_line["line-translate-anchor"]),"line-width":new Bo(yt.paint_line["line-width"]),"line-gap-width":new Bo(yt.paint_line["line-gap-width"]),"line-offset":new Bo(yt.paint_line["line-offset"]),"line-blur":new Bo(yt.paint_line["line-blur"]),"line-dasharray":new jo(yt.paint_line["line-dasharray"]),"line-pattern":new Oo(yt.paint_line["line-pattern"]),"line-gradient":new Uo(yt.paint_line["line-gradient"])})},get layout(){return zc=zc||new No({"line-cap":new Fo(yt.layout_line["line-cap"]),"line-join":new Bo(yt.layout_line["line-join"]),"line-miter-limit":new Fo(yt.layout_line["line-miter-limit"]),"line-round-limit":new Fo(yt.layout_line["line-round-limit"]),"line-sort-key":new Bo(yt.layout_line["line-sort-key"])})}};class Lc extends Bo{possiblyEvaluate(t,e){return e=new Mo(Math.floor(e.zoom),{now:e.now,fadeDuration:e.fadeDuration,zoomHistory:e.zoomHistory,transition:e.transition}),super.possiblyEvaluate(t,e)}evaluate(t,e,r,i){return e=O({},e,{zoom:Math.floor(e.zoom)}),super.evaluate(t,e,r,i)}}let Fc;class Bc extends $o{constructor(t){super(t,Dc),this.gradientVersion=0,Fc||(Fc=new Lc(Dc.paint.properties["line-width"].specification),Fc.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(t){if("line-gradient"===t){const t=this.gradientExpression();this.stepInterpolant=!!function(t){return void 0!==t._styleExpression}(t)&&t._styleExpression.expression instanceof ar,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(t,e){super.recalculate(t,e),this.paint._values["line-floorwidth"]=Fc.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,t)}createBucket(t){return new kc(t)}queryRadius(t){const e=t,r=Oc(Us("line-width",this,e),Us("line-gap-width",this,e)),i=Us("line-offset",this,e);return r/2+Math.abs(i)+Ns(this.paint.get("line-translate"))}queryIntersectsFeature({queryGeometry:t,feature:e,featureState:i,geometry:n,transform:o,pixelsToTileUnits:a}){const s=Vs(t,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),-o.bearingInRadians,a),l=a/2*Oc(this.paint.get("line-width").evaluate(e,i),this.paint.get("line-gap-width").evaluate(e,i)),c=this.paint.get("line-offset").evaluate(e,i);return c&&(n=function(t,e){const i=[];for(let n=0;n<t.length;n++){const o=t[n],a=[];for(let t=0;t<o.length;t++){const i=o[t-1],n=o[t],s=o[t+1],l=0===t?new r(0,0):n.sub(i)._unit()._perp(),c=t===o.length-1?new r(0,0):s.sub(n)._unit()._perp(),h=l._add(c)._unit(),u=h.x*c.x+h.y*c.y;0!==u&&h._mult(1/u),a.push(h._mult(e)._add(n))}i.push(a)}return i}(n,c*a)),function(t,e,r){for(let i=0;i<e.length;i++){const n=e[i];if(t.length>=3)for(let e=0;e<n.length;e++)if(Os(t,n[e]))return!0;if(zs(t,n,r))return!0}return!1}(s,n,l)}isTileClipped(){return!0}}function Oc(t,e){return e>0?e+2*t:t}const jc=Ho([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Uc=Ho([{name:"a_projected_pos",components:3,type:"Float32"}],4);Ho([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const Nc=Ho([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);Ho([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);const Vc=Ho([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),$c=Ho([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function Zc(t,e,r){return t.sections.forEach(t=>{t.text=function(t,e,r){const i=e.layout.get("text-transform").evaluate(r,{});return"uppercase"===i?t=t.toLocaleUpperCase():"lowercase"===i&&(t=t.toLocaleLowerCase()),Co.applyArabicShaping&&(t=Co.applyArabicShaping(t)),t}(t.text,e,r)}),t}Ho([{name:"triangle",components:3,type:"Uint16"}]),Ho([{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"}]),Ho([{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"}]),Ho([{type:"Float32",name:"offsetX"}]),Ho([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),Ho([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const Gc={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var qc=24;const Hc=4294967296,Wc=1/Hc,Xc="undefined"==typeof TextDecoder?null:new TextDecoder("utf-8");class Kc{constructor(t=new Uint8Array(16)){this.buf=ArrayBuffer.isView(t)?t:new Uint8Array(t),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this.length=this.buf.length}readFields(t,e,r=this.length){for(;this.pos<r;){const r=this.readVarint(),i=r>>3,n=this.pos;this.type=7&r,t(i,e,this),this.pos===n&&this.skip(r)}return e}readMessage(t,e){return this.readFields(t,e,this.readVarint()+this.pos)}readFixed32(){const t=this.dataView.getUint32(this.pos,!0);return this.pos+=4,t}readSFixed32(){const t=this.dataView.getInt32(this.pos,!0);return this.pos+=4,t}readFixed64(){const t=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*Hc;return this.pos+=8,t}readSFixed64(){const t=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*Hc;return this.pos+=8,t}readFloat(){const t=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,t}readDouble(){const t=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,t}readVarint(t){const e=this.buf;let r,i;return i=e[this.pos++],r=127&i,i<128?r:(i=e[this.pos++],r|=(127&i)<<7,i<128?r:(i=e[this.pos++],r|=(127&i)<<14,i<128?r:(i=e[this.pos++],r|=(127&i)<<21,i<128?r:(i=e[this.pos],r|=(15&i)<<28,function(t,e,r){const i=r.buf;let n,o;if(o=i[r.pos++],n=(112&o)>>4,o<128)return Yc(t,n,e);if(o=i[r.pos++],n|=(127&o)<<3,o<128)return Yc(t,n,e);if(o=i[r.pos++],n|=(127&o)<<10,o<128)return Yc(t,n,e);if(o=i[r.pos++],n|=(127&o)<<17,o<128)return Yc(t,n,e);if(o=i[r.pos++],n|=(127&o)<<24,o<128)return Yc(t,n,e);if(o=i[r.pos++],n|=(1&o)<<31,o<128)return Yc(t,n,e);throw new Error("Expected varint not more than 10 bytes")}(r,t,this)))))}readVarint64(){return this.readVarint(!0)}readSVarint(){const t=this.readVarint();return t%2==1?(t+1)/-2:t/2}readBoolean(){return Boolean(this.readVarint())}readString(){const t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&Xc?Xc.decode(this.buf.subarray(e,t)):function(t,e,r){let i="",n=e;for(;n<r;){const e=t[n];let o,a,s,l=null,c=e>239?4:e>223?3:e>191?2:1;if(n+c>r)break;1===c?e<128&&(l=e):2===c?(o=t[n+1],128==(192&o)&&(l=(31&e)<<6|63&o,l<=127&&(l=null))):3===c?(o=t[n+1],a=t[n+2],128==(192&o)&&128==(192&a)&&(l=(15&e)<<12|(63&o)<<6|63&a,(l<=2047||l>=55296&&l<=57343)&&(l=null))):4===c&&(o=t[n+1],a=t[n+2],s=t[n+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(l=(15&e)<<18|(63&o)<<12|(63&a)<<6|63&s,(l<=65535||l>=1114112)&&(l=null))),null===l?(l=65533,c=1):l>65535&&(l-=65536,i+=String.fromCharCode(l>>>10&1023|55296),l=56320|1023&l),i+=String.fromCharCode(l),n+=c}return i}(this.buf,e,t)}readBytes(){const t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e}readPackedVarint(t=[],e){const r=this.readPackedEnd();for(;this.pos<r;)t.push(this.readVarint(e));return t}readPackedSVarint(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readSVarint());return t}readPackedBoolean(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readBoolean());return t}readPackedFloat(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readFloat());return t}readPackedDouble(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readDouble());return t}readPackedFixed32(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readFixed32());return t}readPackedSFixed32(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readSFixed32());return t}readPackedFixed64(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readFixed64());return t}readPackedSFixed64(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readSFixed64());return t}readPackedEnd(){return 2===this.type?this.readVarint()+this.pos:this.pos+1}skip(t){const e=7&t;if(0===e)for(;this.buf[this.pos++]>127;);else if(2===e)this.pos=this.readVarint()+this.pos;else if(5===e)this.pos+=4;else{if(1!==e)throw new Error(`Unimplemented type: ${e}`);this.pos+=8}}writeTag(t,e){this.writeVarint(t<<3|e)}realloc(t){let e=this.length||16;for(;e<this.pos+t;)e*=2;if(e!==this.length){const t=new Uint8Array(e);t.set(this.buf),this.buf=t,this.dataView=new DataView(t.buffer),this.length=e}}finish(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)}writeFixed32(t){this.realloc(4),this.dataView.setInt32(this.pos,t,!0),this.pos+=4}writeSFixed32(t){this.realloc(4),this.dataView.setInt32(this.pos,t,!0),this.pos+=4}writeFixed64(t){this.realloc(8),this.dataView.setInt32(this.pos,-1&t,!0),this.dataView.setInt32(this.pos+4,Math.floor(t*Wc),!0),this.pos+=8}writeSFixed64(t){this.realloc(8),this.dataView.setInt32(this.pos,-1&t,!0),this.dataView.setInt32(this.pos+4,Math.floor(t*Wc),!0),this.pos+=8}writeVarint(t){(t=+t||0)>268435455||t<0?function(t,e){let r,i;if(t>=0?(r=t%4294967296|0,i=t/4294967296|0):(r=~(-t%4294967296),i=~(-t/4294967296),4294967295^r?r=r+1|0:(r=0,i=i+1|0)),t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),function(t,e,r){r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,r.buf[r.pos]=127&(t>>>=7)}(r,0,e),function(t,e){const r=(7&t)<<4;e.buf[e.pos++]|=r|((t>>>=3)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t)))))}(i,e)}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))}writeSVarint(t){this.writeVarint(t<0?2*-t-1:2*t)}writeBoolean(t){this.writeVarint(+t)}writeString(t){t=String(t),this.realloc(4*t.length),this.pos++;const e=this.pos;this.pos=function(t,e,r){for(let i,n,o=0;o<e.length;o++){if(i=e.charCodeAt(o),i>55295&&i<57344){if(!n){i>56319||o+1===e.length?(t[r++]=239,t[r++]=191,t[r++]=189):n=i;continue}if(i<56320){t[r++]=239,t[r++]=191,t[r++]=189,n=i;continue}i=n-55296<<10|i-56320|65536,n=null}else n&&(t[r++]=239,t[r++]=191,t[r++]=189,n=null);i<128?t[r++]=i:(i<2048?t[r++]=i>>6|192:(i<65536?t[r++]=i>>12|224:(t[r++]=i>>18|240,t[r++]=i>>12&63|128),t[r++]=i>>6&63|128),t[r++]=63&i|128)}return r}(this.buf,t,this.pos);const r=this.pos-e;r>=128&&Jc(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r}writeFloat(t){this.realloc(4),this.dataView.setFloat32(this.pos,t,!0),this.pos+=4}writeDouble(t){this.realloc(8),this.dataView.setFloat64(this.pos,t,!0),this.pos+=8}writeBytes(t){const e=t.length;this.writeVarint(e),this.realloc(e);for(let r=0;r<e;r++)this.buf[this.pos++]=t[r]}writeRawMessage(t,e){this.pos++;const r=this.pos;t(e,this);const i=this.pos-r;i>=128&&Jc(r,i,this),this.pos=r-1,this.writeVarint(i),this.pos+=i}writeMessage(t,e,r){this.writeTag(t,2),this.writeRawMessage(e,r)}writePackedVarint(t,e){e.length&&this.writeMessage(t,Qc,e)}writePackedSVarint(t,e){e.length&&this.writeMessage(t,th,e)}writePackedBoolean(t,e){e.length&&this.writeMessage(t,ih,e)}writePackedFloat(t,e){e.length&&this.writeMessage(t,eh,e)}writePackedDouble(t,e){e.length&&this.writeMessage(t,rh,e)}writePackedFixed32(t,e){e.length&&this.writeMessage(t,nh,e)}writePackedSFixed32(t,e){e.length&&this.writeMessage(t,oh,e)}writePackedFixed64(t,e){e.length&&this.writeMessage(t,ah,e)}writePackedSFixed64(t,e){e.length&&this.writeMessage(t,sh,e)}writeBytesField(t,e){this.writeTag(t,2),this.writeBytes(e)}writeFixed32Field(t,e){this.writeTag(t,5),this.writeFixed32(e)}writeSFixed32Field(t,e){this.writeTag(t,5),this.writeSFixed32(e)}writeFixed64Field(t,e){this.writeTag(t,1),this.writeFixed64(e)}writeSFixed64Field(t,e){this.writeTag(t,1),this.writeSFixed64(e)}writeVarintField(t,e){this.writeTag(t,0),this.writeVarint(e)}writeSVarintField(t,e){this.writeTag(t,0),this.writeSVarint(e)}writeStringField(t,e){this.writeTag(t,2),this.writeString(e)}writeFloatField(t,e){this.writeTag(t,5),this.writeFloat(e)}writeDoubleField(t,e){this.writeTag(t,1),this.writeDouble(e)}writeBooleanField(t,e){this.writeVarintField(t,+e)}}function Yc(t,e,r){return r?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function Jc(t,e,r){const i=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));r.realloc(i);for(let e=r.pos-1;e>=t;e--)r.buf[e+i]=r.buf[e]}function Qc(t,e){for(let r=0;r<t.length;r++)e.writeVarint(t[r])}function th(t,e){for(let r=0;r<t.length;r++)e.writeSVarint(t[r])}function eh(t,e){for(let r=0;r<t.length;r++)e.writeFloat(t[r])}function rh(t,e){for(let r=0;r<t.length;r++)e.writeDouble(t[r])}function ih(t,e){for(let r=0;r<t.length;r++)e.writeBoolean(t[r])}function nh(t,e){for(let r=0;r<t.length;r++)e.writeFixed32(t[r])}function oh(t,e){for(let r=0;r<t.length;r++)e.writeSFixed32(t[r])}function ah(t,e){for(let r=0;r<t.length;r++)e.writeFixed64(t[r])}function sh(t,e){for(let r=0;r<t.length;r++)e.writeSFixed64(t[r])}function lh(t,e,r){1===t&&r.readMessage(ch,e)}function ch(t,e,r){if(3===t){const{id:t,bitmap:i,width:n,height:o,left:a,top:s,advance:l}=r.readMessage(hh,{});e.push({id:t,bitmap:new tl({width:n+6,height:o+6},i),metrics:{width:n,height:o,left:a,top:s,advance:l}})}}function hh(t,e,r){1===t?e.id=r.readVarint():2===t?e.bitmap=r.readBytes():3===t?e.width=r.readVarint():4===t?e.height=r.readVarint():5===t?e.left=r.readSVarint():6===t?e.top=r.readSVarint():7===t&&(e.advance=r.readVarint())}function uh(t){let e=0,r=0;for(const i of t)e+=i.w*i.h,r=Math.max(r,i.w);t.sort((t,e)=>e.h-t.h);const i=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),r),h:1/0}];let n=0,o=0;for(const e of t)for(let t=i.length-1;t>=0;t--){const r=i[t];if(!(e.w>r.w||e.h>r.h)){if(e.x=r.x,e.y=r.y,o=Math.max(o,e.y+e.h),n=Math.max(n,e.x+e.w),e.w===r.w&&e.h===r.h){const e=i.pop();e&&t<i.length&&(i[t]=e)}else e.h===r.h?(r.x+=e.w,r.w-=e.w):e.w===r.w?(r.y+=e.h,r.h-=e.h):(i.push({x:r.x+e.w,y:r.y,w:r.w-e.w,h:e.h}),r.y+=e.h,r.h-=e.h);break}}return{w:n,h:o,fill:e/(n*o)||0}}class ph{constructor(t,{pixelRatio:e,version:r,stretchX:i,stretchY:n,content:o,textFitWidth:a,textFitHeight:s}){this.paddedRect=t,this.pixelRatio=e,this.stretchX=i,this.stretchY=n,this.content=o,this.version=r,this.textFitWidth=a,this.textFitHeight=s}get tl(){return[this.paddedRect.x+1,this.paddedRect.y+1]}get br(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]}}class dh{constructor(t,e){const r={},i={};this.haveRenderCallbacks=[];const n=[];this.addImages(t,r,n),this.addImages(e,i,n);const{w:o,h:a}=uh(n),s=new el({width:o||1,height:a||1});for(const e in t){const i=t[e],n=r[e].paddedRect;el.copy(i.data,s,{x:0,y:0},{x:n.x+1,y:n.y+1},i.data)}for(const t in e){const r=e[t],n=i[t].paddedRect,o=n.x+1,a=n.y+1,l=r.data.width,c=r.data.height;el.copy(r.data,s,{x:0,y:0},{x:o,y:a},r.data),el.copy(r.data,s,{x:0,y:c-1},{x:o,y:a-1},{width:l,height:1}),el.copy(r.data,s,{x:0,y:0},{x:o,y:a+c},{width:l,height:1}),el.copy(r.data,s,{x:l-1,y:0},{x:o-1,y:a},{width:1,height:c}),el.copy(r.data,s,{x:0,y:0},{x:o+l,y:a},{width:1,height:c})}this.image=s,this.iconPositions=r,this.patternPositions=i}addImages(t,e,r){for(const i in t){const n=t[i],o={x:0,y:0,w:n.data.width+2,h:n.data.height+2};r.push(o),e[i]=new ph(o,n),n.hasRenderCallback&&this.haveRenderCallbacks.push(i)}}patchUpdatedImages(t,e){t.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const 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)return;if(t.version===e.version)return;t.version=e.version;const[i,n]=t.tl;r.update(e.data,void 0,{x:i,y:n})}}var fh;oo("ImagePosition",ph),oo("ImageAtlas",dh),t.ao=void 0,(fh=t.ao||(t.ao={}))[fh.none=0]="none",fh[fh.horizontal=1]="horizontal",fh[fh.vertical=2]="vertical",fh[fh.horizontalOnly=3]="horizontalOnly";class mh{constructor(){this.scale=1,this.fontStack="",this.imageName=null,this.verticalAlign="bottom"}static forText(t,e,r){const i=new mh;return i.scale=t||1,i.fontStack=e,i.verticalAlign=r||"bottom",i}static forImage(t,e){const r=new mh;return r.imageName=t,r.verticalAlign=e||"bottom",r}}class gh{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(t,e){const r=new gh;for(let i=0;i<t.sections.length;i++){const n=t.sections[i];n.image?r.addImageSection(n):r.addTextSection(n,e)}return r}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=function(t){let e="";for(let r=0;r<t.length;r++){const i=t.charCodeAt(r+1)||null,n=t.charCodeAt(r-1)||null;e+=i&&xo(i)&&!Gc[t[r+1]]||n&&xo(n)&&!Gc[t[r-1]]||!Gc[t[r]]?t[r]:Gc[t[r]]}return e}(this.text)}trim(){let t=0;for(let e=0;e<this.text.length&&yh[this.text.charCodeAt(e)];e++)t++;let e=this.text.length;for(let r=this.text.length-1;r>=0&&r>=t&&yh[this.text.charCodeAt(r)];r--)e--;this.text=this.text.substring(t,e),this.sectionIndex=this.sectionIndex.slice(t,e)}substring(t,e){const r=new gh;return r.text=this.text.substring(t,e),r.sectionIndex=this.sectionIndex.slice(t,e),r.sections=this.sections,r}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((t,e)=>Math.max(t,this.sections[e].scale),0)}getMaxImageSize(t){let e=0,r=0;for(let i=0;i<this.length();i++){const n=this.getSection(i);if(n.imageName){const i=t[n.imageName];if(!i)continue;const o=i.displaySize;e=Math.max(e,o[0]),r=Math.max(r,o[1])}}return{maxImageWidth:e,maxImageHeight:r}}addTextSection(t,e){this.text+=t.text,this.sections.push(mh.forText(t.scale,t.fontStack||e,t.verticalAlign));const r=this.sections.length-1;for(let e=0;e<t.text.length;++e)this.sectionIndex.push(r)}addImageSection(t){const e=t.image?t.image.name:"";if(0===e.length)return void Z("Can't add FormattedSection with an empty image.");const r=this.getNextImageSectionCharCode();r?(this.text+=String.fromCharCode(r),this.sections.push(mh.forImage(e,t.verticalAlign)),this.sectionIndex.push(this.sections.length-1)):Z("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function _h(e,r,i,n,o,a,s,l,c,h,u,p,d,f,m){const g=gh.fromFeature(e,o);let _;p===t.ao.vertical&&g.verticalizePunctuation();const{processBidirectionalText:y,processStyledBidirectionalText:b}=Co;if(y&&1===g.sections.length){_=[];const t=y(g.toString(),Ch(g,h,a,r,n,f));for(const e of t){const t=new gh;t.text=e,t.sections=g.sections;for(let r=0;r<e.length;r++)t.sectionIndex.push(0);_.push(t)}}else if(b){_=[];const t=b(g.text,g.sectionIndex,Ch(g,h,a,r,n,f));for(const e of t){const t=new gh;t.text=e[0],t.sectionIndex=e[1],t.sections=g.sections,_.push(t)}}else _=function(t,e){const r=[],i=t.text;let n=0;for(const i of e)r.push(t.substring(n,i)),n=i;return n<i.length&&r.push(t.substring(n,i.length)),r}(g,Ch(g,h,a,r,n,f));const v=[],x={positionedLines:v,text:g.toString(),top:u[1],bottom:u[1],left:u[0],right:u[0],writingMode:p,iconsInText:!1,verticalizable:!1};return function(t,e,r,i,n,o,a,s,l,c,h,u){let p=0,d=0,f=0,m=0;const g="right"===s?1:"left"===s?0:.5,_=qc/u;let y=0;for(const a of n){a.trim();const n=a.getMaxScale(),s={positionedGlyphs:[],lineOffset:0};t.positionedLines[y]=s;const u=s.positionedGlyphs;let b=0;if(!a.length()){d+=o,++y;continue}const v=Ah(i,a,_);for(let o=0;o<a.length();o++){const s=a.getSection(o),f=a.getSectionIndex(o),m=a.getCharCode(o),g=Eh(l,h,m);let y;if(s.imageName){if(t.iconsInText=!0,s.scale=s.scale*_,y=zh(s,g,n,v,i),!y)continue;b=Math.max(b,y.imageOffset)}else if(y=kh(s,m,g,v,e,r),!y)continue;const{rect:x,metrics:w,baselineOffset:T}=y;u.push({glyph:m,imageName:s.imageName,x:p,y:d+T+-17,vertical:g,scale:s.scale,fontStack:s.fontStack,sectionIndex:f,metrics:w,rect:x}),g?(t.verticalizable=!0,p+=(s.imageName?w.advance:qc)*s.scale+c):p+=w.advance*s.scale+c}0!==u.length&&(f=Math.max(p-c,f),Rh(u,0,u.length-1,g)),p=0,s.lineOffset=Math.max(b,(n-1)*qc);const x=o*n+b;d+=x,m=Math.max(x,m),++y}const{horizontalAlign:b,verticalAlign:v}=Mh(a);(function(t,e,r,i,n,o,a,s,l){const c=(e-r)*n;let h=0;h=o!==a?-s*i- -17:-i*l*a+.5*a;for(const e of t)for(const t of e.positionedGlyphs)t.x+=c,t.y+=h})(t.positionedLines,g,b,v,f,m,o,d,n.length),t.top+=-v*d,t.bottom=t.top+d,t.left+=-b*f,t.right=t.left+f}(x,r,i,n,_,s,l,c,p,h,d,m),!function(t){for(const e of t)if(0!==e.positionedGlyphs.length)return!1;return!0}(v)&&x}const yh={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},bh={10:!0,32:!0,38:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0},vh={40:!0};function xh(t,e,r,i,n,o){if(e.imageName){const t=i[e.imageName];return t?t.displaySize[0]*e.scale*qc/o+n:0}{const i=r[e.fontStack],o=i&&i[t];return o?o.metrics.advance*e.scale+n:0}}function wh(t,e,r,i){const n=Math.pow(t-e,2);return i?t<e?n/2:2*n:n+Math.abs(r)*r}function Th(t,e,r){let i=0;return 10===t&&(i-=1e4),r&&(i+=150),40!==t&&65288!==t||(i+=50),41!==e&&65289!==e||(i+=50),i}function Sh(t,e,r,i,n,o){let a=null,s=wh(e,r,n,o);for(const t of i){const i=wh(e-t.x,r,n,o)+t.badness;i<=s&&(a=t,s=i)}return{index:t,x:e,priorBreak:a,badness:s}}function Ph(t){return t?Ph(t.priorBreak).concat(t.index):[]}function Ch(t,e,r,i,n,o){if(!t)return[];const a=[],s=function(t,e,r,i,n,o){let a=0;for(let r=0;r<t.length();r++){const s=t.getSection(r);a+=xh(t.getCharCode(r),s,i,n,e,o)}return a/Math.max(1,Math.ceil(a/r))}(t,e,r,i,n,o),l=t.text.indexOf("​")>=0;let c=0;for(let r=0;r<t.length();r++){const u=t.getSection(r),p=t.getCharCode(r);if(yh[p]||(c+=xh(p,u,i,n,e,o)),r<t.length()-1){const e=!((h=p)<11904)&&(!!po["CJK Compatibility Forms"](h)||!!po["CJK Compatibility"](h)||!!po["CJK Strokes"](h)||!!po["CJK Symbols and Punctuation"](h)||!!po["Enclosed CJK Letters and Months"](h)||!!po["Halfwidth and Fullwidth Forms"](h)||!!po["Ideographic Description Characters"](h)||!!po["Vertical Forms"](h)||bo.test(String.fromCodePoint(h)));(bh[p]||e||u.imageName||r!==t.length()-2&&vh[t.getCharCode(r+1)])&&a.push(Sh(r+1,c,s,a,Th(p,t.getCharCode(r+1),e&&l),!1))}}var h;return Ph(Sh(t.length(),c,s,a,0,!0))}function Mh(t){let e=.5,r=.5;switch(t){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0}switch(t){case"bottom":case"bottom-right":case"bottom-left":r=1;break;case"top":case"top-right":case"top-left":r=0}return{horizontalAlign:e,verticalAlign:r}}function Ah(t,e,r){const i=e.getMaxScale()*qc,{maxImageWidth:n,maxImageHeight:o}=e.getMaxImageSize(t),a=Math.max(i,o*r);return{verticalLineContentWidth:Math.max(i,n*r),horizontalLineContentHeight:a}}function Ih(t){switch(t){case"top":return 0;case"center":return.5;default:return 1}}function Eh(e,r,i){return!(e===t.ao.horizontal||!r&&!vo(i)||r&&(yh[i]||(n=i,/\p{sc=Arab}/u.test(String.fromCodePoint(n)))));var n}function kh(t,e,r,i,n,o){const a=o[t.fontStack],s=function(t,e,r,i){if(t&&t.rect)return t;const n=e[r.fontStack],o=n&&n[i];return o?{rect:null,metrics:o.metrics}:null}(a&&a[e],n,t,e);if(null===s)return null;let l;if(r)l=i.verticalLineContentWidth-t.scale*qc;else{const e=Ih(t.verticalAlign);l=(i.horizontalLineContentHeight-t.scale*qc)*e}return{rect:s.rect,metrics:s.metrics,baselineOffset:l}}function zh(t,e,r,i,n){const o=n[t.imageName];if(!o)return null;const a=o.paddedRect,s=o.displaySize,l={width:s[0],height:s[1],left:1,top:-3,advance:e?s[1]:s[0]};let c;if(e)c=i.verticalLineContentWidth-s[1]*t.scale;else{const e=Ih(t.verticalAlign);c=(i.horizontalLineContentHeight-s[1]*t.scale)*e}return{rect:a,metrics:l,baselineOffset:c,imageOffset:(e?s[0]:s[1])*t.scale-qc*r}}function Rh(t,e,r,i){if(0===i)return;const n=t[r],o=(t[r].x+n.metrics.advance*n.scale)*i;for(let i=e;i<=r;i++)t[i].x-=o}function Dh(t,e,r){const{horizontalAlign:i,verticalAlign:n}=Mh(r),o=e[0]-t.displaySize[0]*i,a=e[1]-t.displaySize[1]*n;return{image:t,top:a,bottom:a+t.displaySize[1],left:o,right:o+t.displaySize[0]}}function Lh(t){var e,r;let i=t.left,n=t.top,o=t.right-i,a=t.bottom-n;const s=null!==(e=t.image.textFitWidth)&&void 0!==e?e:"stretchOrShrink",l=null!==(r=t.image.textFitHeight)&&void 0!==r?r:"stretchOrShrink",c=(t.image.content[2]-t.image.content[0])/(t.image.content[3]-t.image.content[1]);if("proportional"===l){if("stretchOnly"===s&&o/a<c||"proportional"===s){const t=Math.ceil(a*c);i*=t/o,o=t}}else if("proportional"===s&&"stretchOnly"===l&&0!==c&&o/a>c){const t=Math.ceil(o/c);n*=t/a,a=t}return{x1:i,y1:n,x2:i+o,y2:n+a}}function Fh(t,e,r,i,n,o){const a=t.image;let s;if(a.content){const t=a.content,e=a.pixelRatio||1;s=[t[0]/e,t[1]/e,a.displaySize[0]-t[2]/e,a.displaySize[1]-t[3]/e]}const l=e.left*o,c=e.right*o;let h,u,p,d;"width"===r||"both"===r?(d=n[0]+l-i[3],u=n[0]+c+i[1]):(d=n[0]+(l+c-a.displaySize[0])/2,u=d+a.displaySize[0]);const f=e.top*o,m=e.bottom*o;return"height"===r||"both"===r?(h=n[1]+f-i[0],p=n[1]+m+i[2]):(h=n[1]+(f+m-a.displaySize[1])/2,p=h+a.displaySize[1]),{image:a,top:h,right:u,bottom:p,left:d,collisionPadding:s}}const Bh=128,Oh=32640;function jh(t,e){const{expression:r}=e;if("constant"===r.kind)return{kind:"constant",layoutSize:r.evaluate(new Mo(t+1))};if("source"===r.kind)return{kind:"source"};{const{zoomStops:e,interpolationType:i}=r;let n=0;for(;n<e.length&&e[n]<=t;)n++;n=Math.max(0,n-1);let o=n;for(;o<e.length&&e[o]<t+1;)o++;o=Math.min(e.length-1,o);const a=e[n],s=e[o];return"composite"===r.kind?{kind:"composite",minZoom:a,maxZoom:s,interpolationType:i}:{kind:"camera",minZoom:a,maxZoom:s,minSize:r.evaluate(new Mo(a)),maxSize:r.evaluate(new Mo(s)),interpolationType:i}}}function Uh(t,e,r){let i="never";const n=t.get(e);return n?i=n:t.get(r)&&(i="always"),i}const Nh=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function Vh(t,e,r,i,n,o,a,s,l,c,h,u,p){const d=s?Math.min(Oh,Math.round(s[0])):0,f=s?Math.min(Oh,Math.round(s[1])):0;t.emplaceBack(e,r,Math.round(32*i),Math.round(32*n),o,a,(d<<1)+(l?1:0),f,16*c,16*h,256*u,256*p)}function $h(t,e,r){t.emplaceBack(e.x,e.y,r),t.emplaceBack(e.x,e.y,r),t.emplaceBack(e.x,e.y,r),t.emplaceBack(e.x,e.y,r)}function Zh(t){for(const e of t.sections)if(Po(e.text))return!0;return!1}class Gh{constructor(t){this.layoutVertexArray=new Ba,this.indexArray=new Va,this.programConfigurations=t,this.segments=new qa,this.dynamicLayoutVertexArray=new Oa,this.opacityVertexArray=new ja,this.hasVisibleVertices=!1,this.placedSymbolArray=new xa}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.indexArray.length&&0===this.dynamicLayoutVertexArray.length&&0===this.opacityVertexArray.length}upload(t,e,r,i){this.isEmpty()||(r&&(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,jc.members),this.indexBuffer=t.createIndexBuffer(this.indexArray,e),this.dynamicLayoutVertexBuffer=t.createVertexBuffer(this.dynamicLayoutVertexArray,Uc.members,!0),this.opacityVertexBuffer=t.createVertexBuffer(this.opacityVertexArray,Nh,!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())}}oo("SymbolBuffers",Gh);class qh{constructor(t,e,r){this.layoutVertexArray=new t,this.layoutAttributes=e,this.indexArray=new r,this.segments=new qa,this.collisionVertexArray=new Na}upload(t){this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=t.createVertexBuffer(this.collisionVertexArray,Nc.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}oo("CollisionBuffers",qh);class Hh{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.globalState=e.globalState,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(t=>t.id),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[];const r=this.layers[0]._unevaluatedLayout._values;this.textSizeData=jh(this.zoom,r["text-size"]),this.iconSizeData=jh(this.zoom,r["icon-size"]);const i=this.layers[0].layout,n=i.get("symbol-sort-key"),o=i.get("symbol-z-order");this.canOverlap="never"!==Uh(i,"text-overlap","text-allow-overlap")||"never"!==Uh(i,"icon-overlap","icon-allow-overlap")||i.get("text-ignore-placement")||i.get("icon-ignore-placement"),this.sortFeaturesByKey="viewport-y"!==o&&!n.isConstant(),this.sortFeaturesByY=("viewport-y"===o||"auto"===o&&!this.sortFeaturesByKey)&&this.canOverlap,"point"===i.get("symbol-placement")&&(this.writingModes=i.get("text-writing-mode").map(e=>t.ao[e])),this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id),this.sourceID=e.sourceID}createArrays(){this.text=new Gh(new bs(this.layers,this.zoom,t=>/^text/.test(t))),this.icon=new Gh(new bs(this.layers,this.zoom,t=>/^icon/.test(t))),this.glyphOffsetArray=new Sa,this.lineVertexArray=new Pa,this.symbolInstances=new Ta,this.textAnchorOffsets=new Ma}calculateGlyphDependencies(t,e,r,i,n){for(let o=0;o<t.length;o++)if(e[t.charCodeAt(o)]=!0,(r||i)&&n){const r=Gc[t.charAt(o)];r&&(e[r.charCodeAt(0)]=!0)}}populate(e,r,i){const n=this.layers[0],o=n.layout,a=o.get("text-font"),s=o.get("text-field"),l=o.get("icon-image"),c=("constant"!==s.value.kind||s.value.value instanceof Ee&&!s.value.value.isEmpty()||s.value.value.toString().length>0)&&("constant"!==a.value.kind||a.value.value.length>0),h="constant"!==l.value.kind||!!l.value.value||Object.keys(l.parameters).length>0,u=o.get("symbol-sort-key");if(this.features=[],!c&&!h)return;const p=r.iconDependencies,d=r.glyphDependencies,f=r.availableImages,m=new Mo(this.zoom,{globalState:this.globalState});for(const{feature:r,id:s,index:l,sourceLayerIndex:g}of e){const e=n._featureFilter.needGeometry,_=Ps(r,e);if(!n._featureFilter.filter(m,_,i))continue;let y,b;if(e||(_.geometry=Ss(r)),c){const t=n.getValueAndResolveTokens("text-field",_,i,f),e=Ee.factory(t),r=this.hasRTLText=this.hasRTLText||Zh(e);(!r||"unavailable"===Co.getRTLTextPluginStatus()||r&&Co.isParsed())&&(y=Zc(e,n,_))}if(h){const t=n.getValueAndResolveTokens("icon-image",_,i,f);b=t instanceof Be?t:Be.fromString(t)}if(!y&&!b)continue;const v=this.sortFeaturesByKey?u.evaluate(_,{},i):void 0;if(this.features.push({id:s,text:y,icon:b,index:l,sourceLayerIndex:g,geometry:_.geometry,properties:r.properties,type:sc.types[r.type],sortKey:v}),b&&(p[b.name]=!0),y){const e=a.evaluate(_,{},i).join(","),r="viewport"!==o.get("text-rotation-alignment")&&"point"!==o.get("symbol-placement");this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(t.ao.vertical)>=0;for(const t of y.sections)if(t.image)p[t.image.name]=!0;else{const i=fo(y.toString()),n=t.fontStack||e,o=d[n]=d[n]||{};this.calculateGlyphDependencies(t.text,o,r,this.allowVerticalPlacement,i)}}}"line"===o.get("symbol-placement")&&(this.features=function(t){const e={},r={},i=[];let n=0;function o(e){i.push(t[e]),n++}function a(t,e,n){const o=r[t];return delete r[t],r[e]=o,i[o].geometry[0].pop(),i[o].geometry[0]=i[o].geometry[0].concat(n[0]),o}function s(t,r,n){const o=e[r];return delete e[r],e[t]=o,i[o].geometry[0].shift(),i[o].geometry[0]=n[0].concat(i[o].geometry[0]),o}function l(t,e,r){const i=r?e[0][e[0].length-1]:e[0][0];return`${t}:${i.x}:${i.y}`}for(let c=0;c<t.length;c++){const h=t[c],u=h.geometry,p=h.text?h.text.toString():null;if(!p){o(c);continue}const d=l(p,u),f=l(p,u,!0);if(d in r&&f in e&&r[d]!==e[f]){const t=s(d,f,u),n=a(d,f,i[t].geometry);delete e[d],delete r[f],r[l(p,i[n].geometry,!0)]=n,i[t].geometry=null}else d in r?a(d,f,u):f in e?s(d,f,u):(o(c),e[d]=n-1,r[f]=n-1)}return i.filter(t=>t.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((t,e)=>t.sortKey-e.sortKey)}update(t,e,r){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(t,e,this.layers,{imagePositions:r,globalState:this.globalState}),this.icon.programConfigurations.updatePaintArrays(t,e,this.layers,{imagePositions:r,globalState:this.globalState}))}isEmpty(){return 0===this.symbolInstances.length&&!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){const r=this.lineVertexArray.length;if(void 0!==t.segment){let r=t.dist(e[t.segment+1]),i=t.dist(e[t.segment]);const n={};for(let i=t.segment+1;i<e.length;i++)n[i]={x:e[i].x,y:e[i].y,tileUnitDistanceFromAnchor:r},i<e.length-1&&(r+=e[i+1].dist(e[i]));for(let r=t.segment||0;r>=0;r--)n[r]={x:e[r].x,y:e[r].y,tileUnitDistanceFromAnchor:i},r>0&&(i+=e[r-1].dist(e[r]));for(let t=0;t<e.length;t++){const e=n[t];this.lineVertexArray.emplaceBack(e.x,e.y,e.tileUnitDistanceFromAnchor)}}return{lineStartIndex:r,lineLength:this.lineVertexArray.length-r}}addSymbols(e,r,i,n,o,a,s,l,c,h,u,p){const d=e.indexArray,f=e.layoutVertexArray,m=e.segments.prepareSegment(4*r.length,f,d,this.canOverlap?a.sortKey:void 0),g=this.glyphOffsetArray.length,_=m.vertexLength,y=this.allowVerticalPlacement&&s===t.ao.vertical?Math.PI/2:0,b=a.text&&a.text.sections;for(let t=0;t<r.length;t++){const{tl:n,tr:o,bl:s,br:c,tex:h,pixelOffsetTL:u,pixelOffsetBR:g,minFontScaleX:_,minFontScaleY:v,glyphOffset:x,isSDF:w,sectionIndex:T}=r[t],S=m.vertexLength,P=x[1];Vh(f,l.x,l.y,n.x,P+n.y,h.x,h.y,i,w,u.x,u.y,_,v),Vh(f,l.x,l.y,o.x,P+o.y,h.x+h.w,h.y,i,w,g.x,u.y,_,v),Vh(f,l.x,l.y,s.x,P+s.y,h.x,h.y+h.h,i,w,u.x,g.y,_,v),Vh(f,l.x,l.y,c.x,P+c.y,h.x+h.w,h.y+h.h,i,w,g.x,g.y,_,v),$h(e.dynamicLayoutVertexArray,l,y),d.emplaceBack(S,S+2,S+1),d.emplaceBack(S+1,S+2,S+3),m.vertexLength+=4,m.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(x[0]),t!==r.length-1&&T===r[t+1].sectionIndex||e.programConfigurations.populatePaintArrays(f.length,a,a.index,{imagePositions:{},canonical:p,formattedSection:b&&b[T],globalState:this.globalState})}e.placedSymbolArray.emplaceBack(l.x,l.y,g,this.glyphOffsetArray.length-g,_,c,h,l.segment,i?i[0]:0,i?i[1]:0,n[0],n[1],s,0,!1,0,u)}_addCollisionDebugVertex(t,e,r,i,n,o){return e.emplaceBack(0,0),t.emplaceBack(r.x,r.y,i,n,Math.round(o.x),Math.round(o.y))}addCollisionDebugVertices(t,e,i,n,o,a,s){const l=o.segments.prepareSegment(4,o.layoutVertexArray,o.indexArray),c=l.vertexLength,h=o.layoutVertexArray,u=o.collisionVertexArray,p=s.anchorX,d=s.anchorY;this._addCollisionDebugVertex(h,u,a,p,d,new r(t,e)),this._addCollisionDebugVertex(h,u,a,p,d,new r(i,e)),this._addCollisionDebugVertex(h,u,a,p,d,new r(i,n)),this._addCollisionDebugVertex(h,u,a,p,d,new r(t,n)),l.vertexLength+=4;const f=o.indexArray;f.emplaceBack(c,c+1),f.emplaceBack(c+1,c+2),f.emplaceBack(c+2,c+3),f.emplaceBack(c+3,c),l.primitiveLength+=4}addDebugCollisionBoxes(t,e,r,i){for(let n=t;n<e;n++){const t=this.collisionBoxArray.get(n);this.addCollisionDebugVertices(t.x1,t.y1,t.x2,t.y2,i?this.textCollisionBox:this.iconCollisionBox,t.anchorPoint,r)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new qh(Ua,Vc.members,$a),this.iconCollisionBox=new qh(Ua,Vc.members,$a);for(let t=0;t<this.symbolInstances.length;t++){const 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,o,a,s,l){const c={};for(let i=e;i<r;i++){const e=t.get(i);c.textBox={x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,anchorPointX:e.anchorPointX,anchorPointY:e.anchorPointY},c.textFeatureIndex=e.featureIndex;break}for(let e=i;e<n;e++){const r=t.get(e);c.verticalTextBox={x1:r.x1,y1:r.y1,x2:r.x2,y2:r.y2,anchorPointX:r.anchorPointX,anchorPointY:r.anchorPointY},c.verticalTextFeatureIndex=r.featureIndex;break}for(let e=o;e<a;e++){const r=t.get(e);c.iconBox={x1:r.x1,y1:r.y1,x2:r.x2,y2:r.y2,anchorPointX:r.anchorPointX,anchorPointY:r.anchorPointY},c.iconFeatureIndex=r.featureIndex;break}for(let e=s;e<l;e++){const r=t.get(e);c.verticalIconBox={x1:r.x1,y1:r.y1,x2:r.x2,y2:r.y2,anchorPointX:r.anchorPointX,anchorPointY:r.anchorPointY},c.verticalIconFeatureIndex=r.featureIndex;break}return c}deserializeCollisionBoxes(t){this.collisionArrays=[];for(let e=0;e<this.symbolInstances.length;e++){const 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){const r=t.placedSymbolArray.get(e),i=r.vertexStartIndex+4*r.numGlyphs;for(let e=r.vertexStartIndex;e<i;e+=4)t.indexArray.emplaceBack(e,e+2,e+1),t.indexArray.emplaceBack(e+1,e+2,e+3)}getSortedSymbolIndexes(t){if(this.sortedAngle===t&&void 0!==this.symbolInstanceIndexes)return this.symbolInstanceIndexes;const e=Math.sin(t),r=Math.cos(t),i=[],n=[],o=[];for(let t=0;t<this.symbolInstances.length;++t){o.push(t);const a=this.symbolInstances.get(t);i.push(0|Math.round(e*a.anchorX+r*a.anchorY)),n.push(a.featureIndex)}return o.sort((t,e)=>i[t]-i[e]||n[e]-n[t]),o}addToSortKeyRanges(t,e){const 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(const t of this.symbolInstanceIndexes){const e=this.symbolInstances.get(t);this.featureSortOrder.push(e.featureIndex),[e.rightJustifiedTextSymbolIndex,e.centerJustifiedTextSymbolIndex,e.leftJustifiedTextSymbolIndex].forEach((t,e,r)=>{t>=0&&r.indexOf(t)===e&&this.addIndicesForPlacedSymbol(this.text,t)}),e.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,e.verticalPlacedTextSymbolIndex),e.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,e.placedIconSymbolIndex),e.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,e.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let Wh,Xh;oo("SymbolBucket",Hh,{omit:["layers","collisionBoxArray","features","compareText"]}),Hh.MAX_GLYPHS=65535,Hh.addDynamicAttributes=$h;var Kh={get paint(){return Xh=Xh||new No({"icon-opacity":new Bo(yt.paint_symbol["icon-opacity"]),"icon-color":new Bo(yt.paint_symbol["icon-color"]),"icon-halo-color":new Bo(yt.paint_symbol["icon-halo-color"]),"icon-halo-width":new Bo(yt.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Bo(yt.paint_symbol["icon-halo-blur"]),"icon-translate":new Fo(yt.paint_symbol["icon-translate"]),"icon-translate-anchor":new Fo(yt.paint_symbol["icon-translate-anchor"]),"text-opacity":new Bo(yt.paint_symbol["text-opacity"]),"text-color":new Bo(yt.paint_symbol["text-color"],{runtimeType:Ot,getOverride:t=>t.textColor,hasOverride:t=>!!t.textColor}),"text-halo-color":new Bo(yt.paint_symbol["text-halo-color"]),"text-halo-width":new Bo(yt.paint_symbol["text-halo-width"]),"text-halo-blur":new Bo(yt.paint_symbol["text-halo-blur"]),"text-translate":new Fo(yt.paint_symbol["text-translate"]),"text-translate-anchor":new Fo(yt.paint_symbol["text-translate-anchor"])})},get layout(){return Wh=Wh||new No({"symbol-placement":new Fo(yt.layout_symbol["symbol-placement"]),"symbol-spacing":new Fo(yt.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Fo(yt.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Bo(yt.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Fo(yt.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Fo(yt.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Fo(yt.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Fo(yt.layout_symbol["icon-ignore-placement"]),"icon-optional":new Fo(yt.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Fo(yt.layout_symbol["icon-rotation-alignment"]),"icon-size":new Bo(yt.layout_symbol["icon-size"]),"icon-text-fit":new Fo(yt.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Fo(yt.layout_symbol["icon-text-fit-padding"]),"icon-image":new Bo(yt.layout_symbol["icon-image"]),"icon-rotate":new Bo(yt.layout_symbol["icon-rotate"]),"icon-padding":new Bo(yt.layout_symbol["icon-padding"]),"icon-keep-upright":new Fo(yt.layout_symbol["icon-keep-upright"]),"icon-offset":new Bo(yt.layout_symbol["icon-offset"]),"icon-anchor":new Bo(yt.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Fo(yt.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Fo(yt.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Fo(yt.layout_symbol["text-rotation-alignment"]),"text-field":new Bo(yt.layout_symbol["text-field"]),"text-font":new Bo(yt.layout_symbol["text-font"]),"text-size":new Bo(yt.layout_symbol["text-size"]),"text-max-width":new Bo(yt.layout_symbol["text-max-width"]),"text-line-height":new Fo(yt.layout_symbol["text-line-height"]),"text-letter-spacing":new Bo(yt.layout_symbol["text-letter-spacing"]),"text-justify":new Bo(yt.layout_symbol["text-justify"]),"text-radial-offset":new Bo(yt.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Fo(yt.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new Bo(yt.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new Bo(yt.layout_symbol["text-anchor"]),"text-max-angle":new Fo(yt.layout_symbol["text-max-angle"]),"text-writing-mode":new Fo(yt.layout_symbol["text-writing-mode"]),"text-rotate":new Bo(yt.layout_symbol["text-rotate"]),"text-padding":new Fo(yt.layout_symbol["text-padding"]),"text-keep-upright":new Fo(yt.layout_symbol["text-keep-upright"]),"text-transform":new Bo(yt.layout_symbol["text-transform"]),"text-offset":new Bo(yt.layout_symbol["text-offset"]),"text-allow-overlap":new Fo(yt.layout_symbol["text-allow-overlap"]),"text-overlap":new Fo(yt.layout_symbol["text-overlap"]),"text-ignore-placement":new Fo(yt.layout_symbol["text-ignore-placement"]),"text-optional":new Fo(yt.layout_symbol["text-optional"])})}};class Yh{constructor(t){if(void 0===t.property.overrides)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=t.property.overrides?t.property.overrides.runtimeType:Dt,this.defaultValue=t}evaluate(t){if(t.formattedSection){const 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){this.defaultValue.isConstant()||t(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}oo("FormatSectionOverride",Yh,{omit:["defaultValue"]});class Jh extends $o{constructor(t){super(t,Kh)}recalculate(t,e){if(super.recalculate(t,e),"auto"===this.layout.get("icon-rotation-alignment")&&(this.layout._values["icon-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-rotation-alignment")&&(this.layout._values["text-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-pitch-alignment")&&(this.layout._values["text-pitch-alignment"]="map"===this.layout.get("text-rotation-alignment")?"map":"viewport"),"auto"===this.layout.get("icon-pitch-alignment")&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),"point"===this.layout.get("symbol-placement")){const t=this.layout.get("text-writing-mode");if(t){const e=[];for(const r of t)e.indexOf(r)<0&&e.push(r);this.layout._values["text-writing-mode"]=e}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(t,e,r,i){const n=this.layout.get(t).evaluate(e,{},r,i),o=this._unevaluatedLayout._values[t];return o.isDataDriven()||Qi(o.value)||!n?n:function(t,e){return e.replace(/{([^{}]+)}/g,(e,r)=>t&&r in t?String(t[r]):"")}(e.properties,n)}createBucket(t){return new Hh(t)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const t of Kh.paint.overridableProperties){if(!Jh.hasPaintOverride(this.layout,t))continue;const e=this.paint.get(t),r=new Yh(e),i=new Ji(r,e.property.specification);let n=null;n="constant"===e.value.kind||"source"===e.value.kind?new en("source",i):new rn("composite",i,e.value.zoomStops),this.paint._values[t]=new Do(e.property,n,e.parameters)}}_handleOverridablePaintPropertyUpdate(t,e,r){return!(!this.layout||e.isDataDriven()||r.isDataDriven())&&Jh.hasPaintOverride(this.layout,t)}static hasPaintOverride(t,e){const r=t.get("text-field"),i=Kh.paint.properties[e];let n=!1;const o=t=>{for(const e of t)if(i.overrides&&i.overrides.hasOverride(e))return void(n=!0)};if("constant"===r.value.kind&&r.value.value instanceof Ee)o(r.value.value.sections);else if("source"===r.value.kind){const t=e=>{n||(e instanceof $e&&Ne(e.value)===$t?o(e.value.sections):e instanceof Cr?o(e.sections):e.eachChild(t))},e=r.value;e._styleExpression&&t(e._styleExpression.expression)}return n}}let Qh;var tu={get paint(){return Qh=Qh||new No({"background-color":new Fo(yt.paint_background["background-color"]),"background-pattern":new jo(yt.paint_background["background-pattern"]),"background-opacity":new Fo(yt.paint_background["background-opacity"])})}};class eu extends $o{constructor(t){super(t,tu)}}let ru;var iu={get paint(){return ru=ru||new No({"raster-opacity":new Fo(yt.paint_raster["raster-opacity"]),"raster-hue-rotate":new Fo(yt.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Fo(yt.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Fo(yt.paint_raster["raster-brightness-max"]),"raster-saturation":new Fo(yt.paint_raster["raster-saturation"]),"raster-contrast":new Fo(yt.paint_raster["raster-contrast"]),"raster-resampling":new Fo(yt.paint_raster["raster-resampling"]),"raster-fade-duration":new Fo(yt.paint_raster["raster-fade-duration"])})}};class nu extends $o{constructor(t){super(t,iu)}}class ou extends $o{constructor(t){super(t,{}),this.onAdd=t=>{this.implementation.onAdd&&this.implementation.onAdd(t,t.painter.context.gl)},this.onRemove=t=>{this.implementation.onRemove&&this.implementation.onRemove(t,t.painter.context.gl)},this.implementation=t}is3D(){return"3d"===this.implementation.renderingMode}hasOffscreenPass(){return void 0!==this.implementation.prerender}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}}class au{constructor(t){this._methodToThrottle=t,this._triggered=!1,"undefined"!=typeof MessageChannel&&(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=()=>{}}}const su={once:!0},lu=6371008.8;class cu{constructor(t,e){if(isNaN(t)||isNaN(e))throw new Error(`Invalid LngLat object: (${t}, ${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 cu(B(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(t){const 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 lu*Math.acos(Math.min(n,1))}static convert(t){if(t instanceof cu)return t;if(Array.isArray(t)&&(2===t.length||3===t.length))return new cu(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&"object"==typeof t&&null!==t)return new cu(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>]")}}const hu=2*Math.PI*lu;function uu(t){return hu*Math.cos(t*Math.PI/180)}function pu(t){return(180+t)/360}function du(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function fu(t,e){return t/uu(e)}function mu(t){return 360/Math.PI*Math.atan(Math.exp((180-360*t)*Math.PI/180))-90}function gu(t,e){return t*uu(mu(e))}class _u{constructor(t,e,r=0){this.x=+t,this.y=+e,this.z=+r}static fromLngLat(t,e=0){const r=cu.convert(t);return new _u(pu(r.lng),du(r.lat),fu(e,r.lat))}toLngLat(){return new cu(360*this.x-180,mu(this.y))}toAltitude(){return gu(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/hu*(t=mu(this.y),1/Math.cos(t*Math.PI/180));var t}}function yu(t,e,r){var i=2*Math.PI*6378137/256/Math.pow(2,r);return[t*i-2*Math.PI*6378137/2,e*i-2*Math.PI*6378137/2]}class bu{constructor(t,e,r){if(!function(t,e,r){return!(t<0||t>25||r<0||r>=Math.pow(2,t)||e<0||e>=Math.pow(2,t))}(t,e,r))throw new Error(`x=${e}, y=${r}, z=${t} outside of bounds. 0<=x<${Math.pow(2,t)}, 0<=y<${Math.pow(2,t)} 0<=z<=25 `);this.z=t,this.x=e,this.y=r,this.key=wu(0,t,t,e,r)}equals(t){return this.z===t.z&&this.x===t.x&&this.y===t.y}url(t,e,r){const i=(o=this.y,a=this.z,s=yu(256*(n=this.x),256*(o=Math.pow(2,a)-o-1),a),l=yu(256*(n+1),256*(o+1),a),s[0]+","+s[1]+","+l[0]+","+l[1]);var n,o,a,s,l;const c=function(t,e,r){let i,n="";for(let o=t;o>0;o--)i=1<<o-1,n+=(e&i?1:0)+(r&i?2:0);return n}(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("tms"===r?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,e>1?"@2x":"").replace(/{quadkey}/g,c).replace(/{bbox-epsg-3857}/g,i)}isChildOf(t){const e=this.z-t.z;return e>0&&t.x===this.x>>e&&t.y===this.y>>e}getTilePoint(t){const e=Math.pow(2,this.z);return new r((t.x*e-this.x)*I,(t.y*e-this.y)*I)}toString(){return`${this.z}/${this.x}/${this.y}`}}class vu{constructor(t,e){this.wrap=t,this.canonical=e,this.key=wu(t,e.z,e.z,e.x,e.y)}}class xu{constructor(t,e,r,i,n){if(this.terrainRttPosMatrix32f=null,t<r)throw new Error(`overscaledZ should be >= z; overscaledZ = ${t}; z = ${r}`);this.overscaledZ=t,this.wrap=e,this.canonical=new bu(r,+i,+n),this.key=wu(e,t,r,i,n)}clone(){return new xu(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 = ${t}; overscaledZ = ${this.overscaledZ}`);const e=this.canonical.z-t;return t>this.canonical.z?new xu(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new xu(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 = ${t}; overscaledZ = ${this.overscaledZ}`);const r=this.canonical.z-t;return t>this.canonical.z?wu(this.wrap*+e,t,this.canonical.z,this.canonical.x,this.canonical.y):wu(this.wrap*+e,t,t,this.canonical.x>>r,this.canonical.y>>r)}isChildOf(t){if(t.wrap!==this.wrap)return!1;const e=this.canonical.z-t.canonical.z;return 0===t.overscaledZ||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 xu(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const e=this.canonical.z+1,r=2*this.canonical.x,i=2*this.canonical.y;return[new xu(e,this.wrap,e,r,i),new xu(e,this.wrap,e,r+1,i),new xu(e,this.wrap,e,r,i+1),new xu(e,this.wrap,e,r+1,i+1)]}isLessThan(t){return this.wrap<t.wrap||!(this.wrap>t.wrap)&&(this.overscaledZ<t.overscaledZ||!(this.overscaledZ>t.overscaledZ)&&(this.canonical.x<t.canonical.x||!(this.canonical.x>t.canonical.x)&&this.canonical.y<t.canonical.y))}wrapped(){return new xu(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(t){return new xu(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 vu(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(t){return this.canonical.getTilePoint(new _u(t.x-this.wrap,t.y))}}function wu(t,e,r,i,n){(t*=2)<0&&(t=-1*t-1);const o=1<<r;return(o*o*t+o*n+i).toString(36)+r.toString(36)+e.toString(36)}function Tu(t,e){return e?t.properties[e]:t.id}oo("CanonicalTileID",bu),oo("OverscaledTileID",xu,{omit:["terrainRttPosMatrix32f"]});class Su{constructor(){this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0}extend(t){return this.minX=Math.min(this.minX,t.x),this.minY=Math.min(this.minY,t.y),this.maxX=Math.max(this.maxX,t.x),this.maxY=Math.max(this.maxY,t.y),this}expandBy(t){return this.minX-=t,this.minY-=t,this.maxX+=t,this.maxY+=t,(this.minX>this.maxX||this.minY>this.maxY)&&(this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0),this}shrinkBy(t){return this.expandBy(-t)}map(t){const e=new Su;return e.extend(t(new r(this.minX,this.minY))),e.extend(t(new r(this.maxX,this.minY))),e.extend(t(new r(this.minX,this.maxY))),e.extend(t(new r(this.maxX,this.maxY))),e}static fromPoints(t){const e=new Su;for(const r of t)e.extend(r);return e}contains(t){return t.x>=this.minX&&t.x<=this.maxX&&t.y>=this.minY&&t.y<=this.maxY}empty(){return this.minX>this.maxX}width(){return this.maxX-this.minX}height(){return this.maxY-this.minY}covers(t){return!this.empty()&&!t.empty()&&t.minX>=this.minX&&t.maxX<=this.maxX&&t.minY>=this.minY&&t.maxY<=this.maxY}intersects(t){return!this.empty()&&!t.empty()&&t.minX<=this.maxX&&t.maxX>=this.minX&&t.minY<=this.maxY&&t.maxY>=this.minY}}class Pu{constructor(t){this._stringToNumber={},this._numberToString=[];for(let e=0;e<t.length;e++){const 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=${t} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[t]}}class Cu{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 void 0===this._geometry&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(t){this._geometry=t}toJSON(){const t={geometry:this.geometry};for(const e in this)"_geometry"!==e&&"_vectorTileFeature"!==e&&(t[e]=this[e]);return t}}class Mu{constructor(t,e){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new io(I,16,0),this.grid3D=new io(I,16,0),this.featureIndexArray=new Ia,this.promoteId=e}insert(t,e,r,i,n,o){const a=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(r,i,n);const s=o?this.grid3D:this.grid;for(let t=0;t<e.length;t++){const r=e[t],i=[1/0,1/0,-1/0,-1/0];for(let t=0;t<r.length;t++){const e=r[t];i[0]=Math.min(i[0],e.x),i[1]=Math.min(i[1],e.y),i[2]=Math.max(i[2],e.x),i[3]=Math.max(i[3],e.y)}i[0]<I&&i[1]<I&&i[2]>=0&&i[3]>=0&&s.insert(a,i[0],i[1],i[2],i[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new pc(new Kc(this.rawTileData)).layers,this.sourceLayerCoder=new Pu(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(t,e,i,n){this.loadVTLayers();const o=t.params,a=I/t.tileSize/t.scale,s=hn(o.filter),l=t.queryGeometry,c=t.queryPadding*a,h=Su.fromPoints(l),u=this.grid.query(h.minX-c,h.minY-c,h.maxX+c,h.maxY+c),p=Su.fromPoints(t.cameraQueryGeometry).expandBy(c),d=this.grid3D.query(p.minX,p.minY,p.maxX,p.maxY,(e,i,n,o)=>function(t,e,i,n,o){for(const r of t)if(e<=r.x&&i<=r.y&&n>=r.x&&o>=r.y)return!0;const a=[new r(e,i),new r(e,o),new r(n,o),new r(n,i)];if(t.length>2)for(const e of a)if(Os(t,e))return!0;for(let e=0;e<t.length-1;e++)if(js(t[e],t[e+1],a))return!0;return!1}(t.cameraQueryGeometry,e-c,i-c,n+c,o+c));for(const t of d)u.push(t);u.sort(Iu);const f={};let m;for(let r=0;r<u.length;r++){const c=u[r];if(c===m)continue;m=c;const h=this.featureIndexArray.get(c);let p=null;this.loadMatchingFeature(f,h.bucketIndex,h.sourceLayerIndex,h.featureIndex,s,o.layers,o.availableImages,e,i,n,(e,r,i)=>(p||(p=Ss(e)),r.queryIntersectsFeature({queryGeometry:l,feature:e,featureState:i,geometry:p,zoom:this.z,transform:t.transform,pixelsToTileUnits:a,pixelPosMatrix:t.pixelPosMatrix,unwrappedTileID:this.tileID.toUnwrapped(),getElevation:t.getElevation})))}return f}loadMatchingFeature(t,e,r,i,n,o,a,s,l,c,h){const u=this.bucketLayerIDs[e];if(o&&!u.some(t=>o.has(t)))return;const p=this.sourceLayerCoder.decode(r),d=this.vtLayers[p].feature(i);if(n.needGeometry){const t=Ps(d,!0);if(!n.filter(new Mo(this.tileID.overscaledZ),t,this.tileID.canonical))return}else if(!n.filter(new Mo(this.tileID.overscaledZ),d))return;const f=this.getId(d,p);for(let e=0;e<u.length;e++){const r=u[e];if(o&&!o.has(r))continue;const n=s[r];if(!n)continue;let p={};f&&c&&(p=c.getState(n.sourceLayer||"_geojsonTileLayer",f));const m=O({},l[r]);m.paint=Au(m.paint,n.paint,d,p,a),m.layout=Au(m.layout,n.layout,d,p,a);const g=!h||h(d,n,p);if(!g)continue;const _=new Cu(d,this.z,this.x,this.y,f);_.layer=m;let y=t[r];void 0===y&&(y=t[r]=[]),y.push({featureIndex:i,feature:_,intersectionZ:g})}}lookupSymbolFeatures(t,e,r,i,n,o,a,s){const l={};this.loadVTLayers();const c=hn(n);for(const n of t)this.loadMatchingFeature(l,r,i,n,c,o,a,s,e);return l}hasLayer(t){for(const e of this.bucketLayerIDs)for(const r of e)if(t===r)return!0;return!1}getId(t,e){var r;let i=t.id;return this.promoteId&&(i=t.properties["string"==typeof this.promoteId?this.promoteId:this.promoteId[e]],"boolean"==typeof i&&(i=Number(i)),void 0===i&&(null===(r=t.properties)||void 0===r?void 0:r.cluster)&&this.promoteId&&(i=Number(t.properties.cluster_id))),i}}function Au(t,e,r,i,n){return U(t,(t,o)=>{const a=e instanceof Lo?e.get(o):null;return a&&a.evaluate?a.evaluate(r,i,n):a})}function Iu(t,e){return e-t}function Eu(t,e,i,n,o){const a=[];for(let s=0;s<t.length;s++){const l=t[s];let c;for(let t=0;t<l.length-1;t++){let s=l[t],h=l[t+1];s.x<e&&h.x<e||(s.x<e?s=new r(e,s.y+(e-s.x)/(h.x-s.x)*(h.y-s.y))._round():h.x<e&&(h=new r(e,s.y+(e-s.x)/(h.x-s.x)*(h.y-s.y))._round()),s.y<i&&h.y<i||(s.y<i?s=new r(s.x+(i-s.y)/(h.y-s.y)*(h.x-s.x),i)._round():h.y<i&&(h=new r(s.x+(i-s.y)/(h.y-s.y)*(h.x-s.x),i)._round()),s.x>=n&&h.x>=n||(s.x>=n?s=new r(n,s.y+(n-s.x)/(h.x-s.x)*(h.y-s.y))._round():h.x>=n&&(h=new r(n,s.y+(n-s.x)/(h.x-s.x)*(h.y-s.y))._round()),s.y>=o&&h.y>=o||(s.y>=o?s=new r(s.x+(o-s.y)/(h.y-s.y)*(h.x-s.x),o)._round():h.y>=o&&(h=new r(s.x+(o-s.y)/(h.y-s.y)*(h.x-s.x),o)._round()),c&&s.equals(c[c.length-1])||(c=[s],a.push(c)),c.push(h)))))}}return a}oo("FeatureIndex",Mu,{omit:["rawTileData","sourceLayerCoder"]});class ku extends r{constructor(t,e,r,i){super(t,e),this.angle=r,void 0!==i&&(this.segment=i)}clone(){return new ku(this.x,this.y,this.angle,this.segment)}}function zu(t,e,r,i,n){if(void 0===e.segment||0===r)return!0;let o=e,a=e.segment+1,s=0;for(;s>-r/2;){if(a--,a<0)return!1;s-=t[a].dist(o),o=t[a]}s+=t[a].dist(t[a+1]),a++;const l=[];let c=0;for(;s<r/2;){const e=t[a],r=t[a+1];if(!r)return!1;let o=t[a-1].angleTo(e)-e.angleTo(r);for(o=Math.abs((o+3*Math.PI)%(2*Math.PI)-Math.PI),l.push({distance:s,angleDelta:o}),c+=o;s-l[0].distance>i;)c-=l.shift().angleDelta;if(c>n)return!1;a++,s+=e.dist(r)}return!0}function Ru(t){let e=0;for(let r=0;r<t.length-1;r++)e+=t[r].dist(t[r+1]);return e}function Du(t,e,r){return t?.6*e*r:0}function Lu(t,e){return Math.max(t?t.right-t.left:0,e?e.right-e.left:0)}function Fu(t,e,r,i,n,o){const a=Du(r,n,o),s=Lu(r,i)*o;let l=0;const c=Ru(t)/2;for(let r=0;r<t.length-1;r++){const i=t[r],n=t[r+1],o=i.dist(n);if(l+o>c){const h=(c-l)/o,u=dr.number(i.x,n.x,h),p=dr.number(i.y,n.y,h),d=new ku(u,p,n.angleTo(i),r);return d._round(),!a||zu(t,d,s,a,e)?d:void 0}l+=o}}function Bu(t,e,r,i,n,o,a,s,l){const c=Du(i,o,a),h=Lu(i,n),u=h*a,p=0===t[0].x||t[0].x===l||0===t[0].y||t[0].y===l;return e-u<e/4&&(e=u+e/4),Ou(t,p?e/2*s%e:(h/2+2*o)*a*s%e,e,c,r,u,p,!1,l)}function Ou(t,e,r,i,n,o,a,s,l){const c=o/2,h=Ru(t);let u=0,p=e-r,d=[];for(let e=0;e<t.length-1;e++){const a=t[e],s=t[e+1],f=a.dist(s),m=s.angleTo(a);for(;p+r<u+f;){p+=r;const g=(p-u)/f,_=dr.number(a.x,s.x,g),y=dr.number(a.y,s.y,g);if(_>=0&&_<l&&y>=0&&y<l&&p-c>=0&&p+c<=h){const r=new ku(_,y,m,e);r._round(),i&&!zu(t,r,o,i,n)||d.push(r)}}u+=f}return s||d.length||a||(d=Ou(t,u/2,r,i,n,o,a,!0,l)),d}function ju(t,e,i,n){const o=[],a=t.image,s=a.pixelRatio,l=a.paddedRect.w-2,c=a.paddedRect.h-2;let h={x1:t.left,y1:t.top,x2:t.right,y2:t.bottom};const u=a.stretchX||[[0,l]],p=a.stretchY||[[0,c]],d=(t,e)=>t+e[1]-e[0],f=u.reduce(d,0),m=p.reduce(d,0),g=l-f,_=c-m;let y=0,b=f,v=0,x=m,w=0,T=g,S=0,P=_;if(a.content&&n){const e=a.content,r=e[2]-e[0],i=e[3]-e[1];(a.textFitWidth||a.textFitHeight)&&(h=Lh(t)),y=Uu(u,0,e[0]),v=Uu(p,0,e[1]),b=Uu(u,e[0],e[2]),x=Uu(p,e[1],e[3]),w=e[0]-y,S=e[1]-v,T=r-b,P=i-x}const C=h.x1,M=h.y1,A=h.x2-C,I=h.y2-M,E=(t,n,o,l)=>{const c=Vu(t.stretch-y,b,A,C),h=$u(t.fixed-w,T,t.stretch,f),u=Vu(n.stretch-v,x,I,M),p=$u(n.fixed-S,P,n.stretch,m),d=Vu(o.stretch-y,b,A,C),g=$u(o.fixed-w,T,o.stretch,f),_=Vu(l.stretch-v,x,I,M),E=$u(l.fixed-S,P,l.stretch,m),k=new r(c,u),z=new r(d,u),R=new r(d,_),D=new r(c,_),L=new r(h/s,p/s),F=new r(g/s,E/s),B=e*Math.PI/180;if(B){const t=Math.sin(B),e=Math.cos(B),r=[e,-t,t,e];k._matMult(r),z._matMult(r),D._matMult(r),R._matMult(r)}const O=t.stretch+t.fixed,j=n.stretch+n.fixed;return{tl:k,tr:z,bl:D,br:R,tex:{x:a.paddedRect.x+1+O,y:a.paddedRect.y+1+j,w:o.stretch+o.fixed-O,h:l.stretch+l.fixed-j},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:L,pixelOffsetBR:F,minFontScaleX:T/s/A,minFontScaleY:P/s/I,isSDF:i}};if(n&&(a.stretchX||a.stretchY)){const t=Nu(u,g,f),e=Nu(p,_,m);for(let r=0;r<t.length-1;r++){const i=t[r],n=t[r+1];for(let t=0;t<e.length-1;t++)o.push(E(i,e[t],n,e[t+1]))}}else o.push(E({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:l+1},{fixed:0,stretch:c+1}));return o}function Uu(t,e,r){let i=0;for(const n of t)i+=Math.max(e,Math.min(r,n[1]))-Math.max(e,Math.min(r,n[0]));return i}function Nu(t,e,r){const i=[{fixed:-1,stretch:0}];for(const[e,r]of t){const t=i[i.length-1];i.push({fixed:e-t.stretch,stretch:t.stretch}),i.push({fixed:e-t.stretch,stretch:t.stretch+(r-e)})}return i.push({fixed:e+1,stretch:r}),i}function Vu(t,e,r,i){return t/e*r+i}function $u(t,e,r,i){return t-e*r/i}oo("Anchor",ku);class Zu{constructor(t,e,i,n,o,a,s,l,c,h){var u;if(this.boxStartIndex=t.length,c){let t=a.top,e=a.bottom;const r=a.collisionPadding;r&&(t-=r[1],e+=r[3]);let i=e-t;i>0&&(i=Math.max(10,i),this.circleDiameter=i)}else{const c=(null===(u=a.image)||void 0===u?void 0:u.content)&&(a.image.textFitWidth||a.image.textFitHeight)?Lh(a):{x1:a.left,y1:a.top,x2:a.right,y2:a.bottom};c.y1=c.y1*s-l[0],c.y2=c.y2*s+l[2],c.x1=c.x1*s-l[3],c.x2=c.x2*s+l[1];const p=a.collisionPadding;if(p&&(c.x1-=p[0]*s,c.y1-=p[1]*s,c.x2+=p[2]*s,c.y2+=p[3]*s),h){const t=new r(c.x1,c.y1),e=new r(c.x2,c.y1),i=new r(c.x1,c.y2),n=new r(c.x2,c.y2),o=h*Math.PI/180;t._rotate(o),e._rotate(o),i._rotate(o),n._rotate(o),c.x1=Math.min(t.x,e.x,i.x,n.x),c.x2=Math.max(t.x,e.x,i.x,n.x),c.y1=Math.min(t.y,e.y,i.y,n.y),c.y2=Math.max(t.y,e.y,i.y,n.y)}t.emplaceBack(e.x,e.y,c.x1,c.y1,c.x2,c.y2,i,n,o)}this.boxEndIndex=t.length}}class Gu{constructor(t=[],e=(t,e)=>t<e?-1:t>e?1:0){if(this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(let t=(this.length>>1)-1;t>=0;t--)this._down(t)}push(t){this.data.push(t),this._up(this.length++)}pop(){if(0===this.length)return;const t=this.data[0],e=this.data.pop();return--this.length>0&&(this.data[0]=e,this._down(0)),t}peek(){return this.data[0]}_up(t){const{data:e,compare:r}=this,i=e[t];for(;t>0;){const n=t-1>>1,o=e[n];if(r(i,o)>=0)break;e[t]=o,t=n}e[t]=i}_down(t){const{data:e,compare:r}=this,i=this.length>>1,n=e[t];for(;t<i;){let i=1+(t<<1);const o=i+1;if(o<this.length&&r(e[o],e[i])<0&&(i=o),r(e[i],n)>=0)break;e[t]=e[i],t=i}e[t]=n}}function qu(t,e=1,i=!1){const n=Su.fromPoints(t[0]),o=Math.min(n.width(),n.height());let a=o/2;const s=new Gu([],Hu),{minX:l,minY:c,maxX:h,maxY:u}=n;if(0===o)return new r(l,c);for(let e=l;e<h;e+=o)for(let r=c;r<u;r+=o)s.push(new Wu(e+a,r+a,a,t));let p=function(t){let e=0,r=0,i=0;const n=t[0];for(let t=0,o=n.length,a=o-1;t<o;a=t++){const o=n[t],s=n[a],l=o.x*s.y-s.x*o.y;r+=(o.x+s.x)*l,i+=(o.y+s.y)*l,e+=3*l}return new Wu(r/e,i/e,0,t)}(t),d=s.length;for(;s.length;){const r=s.pop();(r.d>p.d||!p.d)&&(p=r,i&&console.log("found best %d after %d probes",Math.round(1e4*r.d)/1e4,d)),r.max-p.d<=e||(a=r.h/2,s.push(new Wu(r.p.x-a,r.p.y-a,a,t)),s.push(new Wu(r.p.x+a,r.p.y-a,a,t)),s.push(new Wu(r.p.x-a,r.p.y+a,a,t)),s.push(new Wu(r.p.x+a,r.p.y+a,a,t)),d+=4)}return i&&(console.log(`num probes: ${d}`),console.log(`best distance: ${p.d}`)),p.p}function Hu(t,e){return e.max-t.max}function Wu(t,e,i,n){this.p=new r(t,e),this.h=i,this.d=function(t,e){let r=!1,i=1/0;for(let n=0;n<e.length;n++){const o=e[n];for(let e=0,n=o.length,a=n-1;e<n;a=e++){const n=o[e],s=o[a];n.y>t.y!=s.y>t.y&&t.x<(s.x-n.x)*(t.y-n.y)/(s.y-n.y)+n.x&&(r=!r),i=Math.min(i,Fs(t,n,s))}}return(r?1:-1)*Math.sqrt(i)}(this.p,n),this.max=this.d+this.h*Math.SQRT2}var Xu;t.aE=void 0,(Xu=t.aE||(t.aE={}))[Xu.center=1]="center",Xu[Xu.left=2]="left",Xu[Xu.right=3]="right",Xu[Xu.top=4]="top",Xu[Xu.bottom=5]="bottom",Xu[Xu["top-left"]=6]="top-left",Xu[Xu["top-right"]=7]="top-right",Xu[Xu["bottom-left"]=8]="bottom-left",Xu[Xu["bottom-right"]=9]="bottom-right";const Ku=Number.POSITIVE_INFINITY;function Yu(t,e){return e[1]!==Ku?function(t,e,r){let i=0,n=0;switch(e=Math.abs(e),r=Math.abs(r),t){case"top-right":case"top-left":case"top":n=r-7;break;case"bottom-right":case"bottom-left":case"bottom":n=7-r}switch(t){case"top-right":case"bottom-right":case"right":i=-e;break;case"top-left":case"bottom-left":case"left":i=e}return[i,n]}(t,e[0],e[1]):function(t,e){let r=0,i=0;e<0&&(e=0);const n=e/Math.SQRT2;switch(t){case"top-right":case"top-left":i=n-7;break;case"bottom-right":case"bottom-left":i=7-n;break;case"bottom":i=7-e;break;case"top":i=e-7}switch(t){case"top-right":case"bottom-right":r=-n;break;case"top-left":case"bottom-left":r=n;break;case"left":r=e;break;case"right":r=-e}return[r,i]}(t,e[0])}function Ju(t,e,r){var i;const n=t.layout,o=null===(i=n.get("text-variable-anchor-offset"))||void 0===i?void 0:i.evaluate(e,{},r);if(o){const t=o.values,e=[];for(let r=0;r<t.length;r+=2){const i=e[r]=t[r],n=t[r+1].map(t=>t*qc);i.startsWith("top")?n[1]-=7:i.startsWith("bottom")&&(n[1]+=7),e[r+1]=n}return new Fe(e)}const a=n.get("text-variable-anchor");if(a){let i;i=void 0!==t._unevaluatedLayout.getValue("text-radial-offset")?[n.get("text-radial-offset").evaluate(e,{},r)*qc,Ku]:n.get("text-offset").evaluate(e,{},r).map(t=>t*qc);const o=[];for(const t of a)o.push(t,Yu(t,i));return new Fe(o)}return null}function Qu(t){switch(t){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function tp(e,r,i,n,o,a,s,l,c,h,u,p){let d=a.textMaxSize.evaluate(r,{});void 0===d&&(d=s);const f=e.layers[0].layout,m=f.get("icon-offset").evaluate(r,{},u),g=rp(i.horizontal),_=s/24,y=e.tilePixelRatio*_,b=e.tilePixelRatio*d/24,v=e.tilePixelRatio*l,x=e.tilePixelRatio*f.get("symbol-spacing"),w=f.get("text-padding")*e.tilePixelRatio,T=function(t,e,r,i=1){const n=t.get("icon-padding").evaluate(e,{},r),o=n&&n.values;return[o[0]*i,o[1]*i,o[2]*i,o[3]*i]}(f,r,u,e.tilePixelRatio),S=f.get("text-max-angle")/180*Math.PI,P="viewport"!==f.get("text-rotation-alignment")&&"point"!==f.get("symbol-placement"),C="map"===f.get("icon-rotation-alignment")&&"point"!==f.get("symbol-placement"),M=f.get("symbol-placement"),A=x/2,E=f.get("icon-text-fit");let k;n&&"none"!==E&&(e.allowVerticalPlacement&&i.vertical&&(k=Fh(n,i.vertical,E,f.get("icon-text-fit-padding"),m,_)),g&&(n=Fh(n,g,E,f.get("icon-text-fit-padding"),m,_)));const z=u?p.line.getGranularityForZoomLevel(u.z):1,R=(l,p)=>{p.x<0||p.x>=I||p.y<0||p.y>=I||function(e,r,i,n,o,a,s,l,c,h,u,p,d,f,m,g,_,y,b,v,x,w,T,S,P){const C=e.addToLineVertexArray(r,i);let M,A,I,E,k=0,z=0,R=0,D=0,L=-1,F=-1;const B={};let O=rs("");if(e.allowVerticalPlacement&&n.vertical){const t=l.layout.get("text-rotate").evaluate(x,{},S)+90;I=new Zu(c,r,h,u,p,n.vertical,d,f,m,t),s&&(E=new Zu(c,r,h,u,p,s,_,y,m,t))}if(o){const i=l.layout.get("icon-rotate").evaluate(x,{}),n="none"!==l.layout.get("icon-text-fit"),a=ju(o,i,T,n),d=s?ju(s,i,T,n):void 0;A=new Zu(c,r,h,u,p,o,_,y,!1,i),k=4*a.length;const f=e.iconSizeData;let m=null;"source"===f.kind?(m=[Bh*l.layout.get("icon-size").evaluate(x,{})],m[0]>Oh&&Z(`${e.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)):"composite"===f.kind&&(m=[Bh*w.compositeIconSizes[0].evaluate(x,{},S),Bh*w.compositeIconSizes[1].evaluate(x,{},S)],(m[0]>Oh||m[1]>Oh)&&Z(`${e.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)),e.addSymbols(e.icon,a,m,v,b,x,t.ao.none,r,C.lineStartIndex,C.lineLength,-1,S),L=e.icon.placedSymbolArray.length-1,d&&(z=4*d.length,e.addSymbols(e.icon,d,m,v,b,x,t.ao.vertical,r,C.lineStartIndex,C.lineLength,-1,S),F=e.icon.placedSymbolArray.length-1)}const j=Object.keys(n.horizontal);for(const i of j){const o=n.horizontal[i];if(!M){O=rs(o.text);const t=l.layout.get("text-rotate").evaluate(x,{},S);M=new Zu(c,r,h,u,p,o,d,f,m,t)}const s=1===o.positionedLines.length;if(R+=ep(e,r,o,a,l,m,x,g,C,n.vertical?t.ao.horizontal:t.ao.horizontalOnly,s?j:[i],B,L,w,S),s)break}n.vertical&&(D+=ep(e,r,n.vertical,a,l,m,x,g,C,t.ao.vertical,["vertical"],B,F,w,S));const U=M?M.boxStartIndex:e.collisionBoxArray.length,N=M?M.boxEndIndex:e.collisionBoxArray.length,V=I?I.boxStartIndex:e.collisionBoxArray.length,$=I?I.boxEndIndex:e.collisionBoxArray.length,G=A?A.boxStartIndex:e.collisionBoxArray.length,q=A?A.boxEndIndex:e.collisionBoxArray.length,H=E?E.boxStartIndex:e.collisionBoxArray.length,W=E?E.boxEndIndex:e.collisionBoxArray.length;let X=-1;const K=(t,e)=>t&&t.circleDiameter?Math.max(t.circleDiameter,e):e;X=K(M,X),X=K(I,X),X=K(A,X),X=K(E,X);const Y=X>-1?1:0;Y&&(X*=P/qc),e.glyphOffsetArray.length>=Hh.MAX_GLYPHS&&Z("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==x.sortKey&&e.addToSortKeyRanges(e.symbolInstances.length,x.sortKey);const J=Ju(l,x,S),[Q,tt]=function(e,r){const i=e.length,n=null==r?void 0:r.values;if((null==n?void 0:n.length)>0)for(let r=0;r<n.length;r+=2){const i=n[r+1];e.emplaceBack(t.aE[n[r]],i[0],i[1])}return[i,e.length]}(e.textAnchorOffsets,J);e.symbolInstances.emplaceBack(r.x,r.y,B.right>=0?B.right:-1,B.center>=0?B.center:-1,B.left>=0?B.left:-1,B.vertical||-1,L,F,O,U,N,V,$,G,q,H,W,h,R,D,k,z,Y,0,d,X,Q,tt)}(e,p,l,i,n,o,k,e.layers[0],e.collisionBoxArray,r.index,r.sourceLayerIndex,e.index,y,[w,w,w,w],P,c,v,T,C,m,r,a,h,u,s)};if("line"===M)for(const t of Eu(r.geometry,0,0,I,I)){const r=Xl(t,z),o=Bu(r,x,S,i.vertical||g,n,24,b,e.overscaling,I);for(const t of o)g&&ip(e,g.text,A,t)||R(r,t)}else if("line-center"===M){for(const t of r.geometry)if(t.length>1){const e=Xl(t,z),r=Fu(e,S,i.vertical||g,n,24,b);r&&R(e,r)}}else if("Polygon"===r.type)for(const t of Jr(r.geometry,0)){const e=qu(t,16);R(Xl(t[0],z,!0),new ku(e.x,e.y,0))}else if("LineString"===r.type)for(const t of r.geometry){const e=Xl(t,z);R(e,new ku(e[0].x,e[0].y,0))}else if("Point"===r.type)for(const t of r.geometry)for(const e of t)R([e],new ku(e.x,e.y,0))}function ep(t,e,i,n,o,a,s,l,c,h,u,p,d,f,m){const g=function(t,e,i,n,o,a,s,l){const c=n.layout.get("text-rotate").evaluate(a,{})*Math.PI/180,h=[];for(const t of e.positionedLines)for(const n of t.positionedGlyphs){if(!n.rect)continue;const a=n.rect||{};let u=4,p=!0,d=1,f=0;const m=(o||l)&&n.vertical,g=n.metrics.advance*n.scale/2;if(l&&e.verticalizable&&(f=t.lineOffset/2-(n.imageName?-(qc-n.metrics.width*n.scale)/2:(n.scale-1)*qc)),n.imageName){const t=s[n.imageName];p=t.sdf,d=t.pixelRatio,u=1/d}const _=o?[n.x+g,n.y]:[0,0];let y=o?[0,0]:[n.x+g+i[0],n.y+i[1]-f],b=[0,0];m&&(b=y,y=[0,0]);const v=n.metrics.isDoubleResolution?2:1,x=(n.metrics.left-u)*n.scale-g+y[0],w=(-n.metrics.top-u)*n.scale+y[1],T=x+a.w/v*n.scale/d,S=w+a.h/v*n.scale/d,P=new r(x,w),C=new r(T,w),M=new r(x,S),A=new r(T,S);if(m){const t=new r(-g,g- -17),e=-Math.PI/2,i=12-g,o=new r(22-i,-(n.imageName?i:0)),a=new r(...b);P._rotateAround(e,t)._add(o)._add(a),C._rotateAround(e,t)._add(o)._add(a),M._rotateAround(e,t)._add(o)._add(a),A._rotateAround(e,t)._add(o)._add(a)}if(c){const t=Math.sin(c),e=Math.cos(c),r=[e,-t,t,e];P._matMult(r),C._matMult(r),M._matMult(r),A._matMult(r)}const I=new r(0,0),E=new r(0,0);h.push({tl:P,tr:C,bl:M,br:A,tex:a,writingMode:e.writingMode,glyphOffset:_,sectionIndex:n.sectionIndex,isSDF:p,pixelOffsetTL:I,pixelOffsetBR:E,minFontScaleX:0,minFontScaleY:0})}return h}(0,i,l,o,a,s,n,t.allowVerticalPlacement),_=t.textSizeData;let y=null;"source"===_.kind?(y=[Bh*o.layout.get("text-size").evaluate(s,{})],y[0]>Oh&&Z(`${t.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)):"composite"===_.kind&&(y=[Bh*f.compositeTextSizes[0].evaluate(s,{},m),Bh*f.compositeTextSizes[1].evaluate(s,{},m)],(y[0]>Oh||y[1]>Oh)&&Z(`${t.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)),t.addSymbols(t.text,g,y,l,a,s,h,e,c.lineStartIndex,c.lineLength,d,m);for(const e of u)p[e]=t.text.placedSymbolArray.length-1;return 4*g.length}function rp(t){for(const e in t)return t[e];return null}function ip(t,e,r,i){const n=t.compareText;if(e in n){const t=n[e];for(let e=t.length-1;e>=0;e--)if(i.dist(t[e])<r)return!0}else n[e]=[];return n[e].push(i),!1}const np=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class op{static from(t){if(!(t instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[e,r]=new Uint8Array(t,0,2);if(219!==e)throw new Error("Data does not appear to be in a KDBush format.");const i=r>>4;if(1!==i)throw new Error(`Got v${i} data when expected v1.`);const n=np[15&r];if(!n)throw new Error("Unrecognized array type.");const[o]=new Uint16Array(t,2,1),[a]=new Uint32Array(t,4,1);return new op(a,o,n,t)}constructor(t,e=64,r=Float64Array,i){if(isNaN(t)||t<0)throw new Error(`Unpexpected numItems value: ${t}.`);this.numItems=+t,this.nodeSize=Math.min(Math.max(+e,2),65535),this.ArrayType=r,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;const n=np.indexOf(this.ArrayType),o=2*t*this.ArrayType.BYTES_PER_ELEMENT,a=t*this.IndexArrayType.BYTES_PER_ELEMENT,s=(8-a%8)%8;if(n<0)throw new Error(`Unexpected typed array class: ${r}.`);i&&i instanceof ArrayBuffer?(this.data=i,this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+a+s,2*t),this._pos=2*t,this._finished=!0):(this.data=new ArrayBuffer(8+o+a+s),this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+a+s,2*t),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+n]),new Uint16Array(this.data,2,1)[0]=e,new Uint32Array(this.data,4,1)[0]=t)}add(t,e){const r=this._pos>>1;return this.ids[r]=r,this.coords[this._pos++]=t,this.coords[this._pos++]=e,r}finish(){const t=this._pos>>1;if(t!==this.numItems)throw new Error(`Added ${t} items when expected ${this.numItems}.`);return ap(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,e,r,i){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:n,coords:o,nodeSize:a}=this,s=[0,n.length-1,0],l=[];for(;s.length;){const c=s.pop()||0,h=s.pop()||0,u=s.pop()||0;if(h-u<=a){for(let a=u;a<=h;a++){const s=o[2*a],c=o[2*a+1];s>=t&&s<=r&&c>=e&&c<=i&&l.push(n[a])}continue}const p=u+h>>1,d=o[2*p],f=o[2*p+1];d>=t&&d<=r&&f>=e&&f<=i&&l.push(n[p]),(0===c?t<=d:e<=f)&&(s.push(u),s.push(p-1),s.push(1-c)),(0===c?r>=d:i>=f)&&(s.push(p+1),s.push(h),s.push(1-c))}return l}within(t,e,r){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:i,coords:n,nodeSize:o}=this,a=[0,i.length-1,0],s=[],l=r*r;for(;a.length;){const c=a.pop()||0,h=a.pop()||0,u=a.pop()||0;if(h-u<=o){for(let r=u;r<=h;r++)hp(n[2*r],n[2*r+1],t,e)<=l&&s.push(i[r]);continue}const p=u+h>>1,d=n[2*p],f=n[2*p+1];hp(d,f,t,e)<=l&&s.push(i[p]),(0===c?t-r<=d:e-r<=f)&&(a.push(u),a.push(p-1),a.push(1-c)),(0===c?t+r>=d:e+r>=f)&&(a.push(p+1),a.push(h),a.push(1-c))}return s}}function ap(t,e,r,i,n,o){if(n-i<=r)return;const a=i+n>>1;sp(t,e,a,i,n,o),ap(t,e,r,i,a-1,1-o),ap(t,e,r,a+1,n,1-o)}function sp(t,e,r,i,n,o){for(;n>i;){if(n-i>600){const a=n-i+1,s=r-i+1,l=Math.log(a),c=.5*Math.exp(2*l/3),h=.5*Math.sqrt(l*c*(a-c)/a)*(s-a/2<0?-1:1);sp(t,e,r,Math.max(i,Math.floor(r-s*c/a+h)),Math.min(n,Math.floor(r+(a-s)*c/a+h)),o)}const a=e[2*r+o];let s=i,l=n;for(lp(t,e,i,r),e[2*n+o]>a&&lp(t,e,i,n);s<l;){for(lp(t,e,s,l),s++,l--;e[2*s+o]<a;)s++;for(;e[2*l+o]>a;)l--}e[2*i+o]===a?lp(t,e,i,l):(l++,lp(t,e,l,n)),l<=r&&(i=l+1),r<=l&&(n=l-1)}}function lp(t,e,r,i){cp(t,r,i),cp(e,2*r,2*i),cp(e,2*r+1,2*i+1)}function cp(t,e,r){const i=t[e];t[e]=t[r],t[r]=i}function hp(t,e,r,i){const n=t-r,o=e-i;return n*n+o*o}var up;t.cx=void 0,(up=t.cx||(t.cx={})).create="create",up.load="load",up.fullLoad="fullLoad";let pp=null,dp=[];const fp=1e3/60,mp="loadTime",gp="fullLoadTime",_p={mark(t){performance.mark(t)},frame(t){const e=t;null!=pp&&dp.push(e-pp),pp=e},clearMetrics(){pp=null,dp=[],performance.clearMeasures(mp),performance.clearMeasures(gp);for(const e in t.cx)performance.clearMarks(t.cx[e])},getPerformanceMetrics(){performance.measure(mp,t.cx.create,t.cx.load),performance.measure(gp,t.cx.create,t.cx.fullLoad);const e=performance.getEntriesByName(mp)[0].duration,r=performance.getEntriesByName(gp)[0].duration,i=dp.length,n=1/(dp.reduce((t,e)=>t+e,0)/i/1e3),o=dp.filter(t=>t>fp).reduce((t,e)=>t+(e-fp)/fp,0);return{loadTime:e,fullLoadTime:r,fps:n,percentDroppedFrames:o/(i+o)*100,totalFrames:i}}};t.$=I,t.A=d,t.B=function([t,e,r]){return e+=90,e*=Math.PI/180,r*=Math.PI/180,{x:t*Math.cos(e)*Math.sin(r),y:t*Math.sin(e)*Math.sin(r),z:t*Math.cos(r)}},t.C=dr,t.D=Fo,t.E=_t,t.F=Mo,t.G=Qn,t.H=function(t){if(null==H){const e=t.navigator?t.navigator.userAgent:null;H=!!t.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return H},t.I=ph,t.J=class{constructor(t,e){this.target=t,this.mapId=e,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new au(()=>this.process()),this.subscription=Q(this.target,"message",t=>this.receive(t),!1),this.globalScope=q(self)?t:window}registerMessageHandler(t,e){this.messageHandlers[t]=e}sendAsync(t,e){return new Promise((r,i)=>{const n=Math.round(1e18*Math.random()).toString(36).substring(0,10),o=e?Q(e.signal,"abort",()=>{null==o||o.unsubscribe(),delete this.resolveRejects[n];const e={id:n,type:"<cancel>",origin:location.origin,targetMapId:t.targetMapId,sourceMapId:this.mapId};this.target.postMessage(e)},su):null;this.resolveRejects[n]={resolve:t=>{null==o||o.unsubscribe(),r(t)},reject:t=>{null==o||o.unsubscribe(),i(t)}};const a=[],s=Object.assign(Object.assign({},t),{id:n,sourceMapId:this.mapId,origin:location.origin,data:co(t.data,a)});this.target.postMessage(s,{transfer:a})})}receive(t){const e=t.data,r=e.id;if(!("file://"!==e.origin&&"file://"!==location.origin&&"resource://android"!==e.origin&&"resource://android"!==location.origin&&e.origin!==location.origin||e.targetMapId&&this.mapId!==e.targetMapId)){if("<cancel>"===e.type){delete this.tasks[r];const t=this.abortControllers[r];return delete this.abortControllers[r],void(t&&t.abort())}if(q(self)||e.mustQueue)return this.tasks[r]=e,this.taskQueue.push(r),void this.invoker.trigger();this.processTask(r,e)}}process(){if(0===this.taskQueue.length)return;const t=this.taskQueue.shift(),e=this.tasks[t];delete this.tasks[t],this.taskQueue.length>0&&this.invoker.trigger(),e&&this.processTask(t,e)}processTask(t,r){return e(this,void 0,void 0,function*(){if("<response>"===r.type){const e=this.resolveRejects[t];if(delete this.resolveRejects[t],!e)return;return void(r.error?e.reject(ho(r.error)):e.resolve(ho(r.data)))}if(!this.messageHandlers[r.type])return void this.completeTask(t,new Error(`Could not find a registered handler for ${r.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));const e=ho(r.data),i=new AbortController;this.abortControllers[t]=i;try{const n=yield this.messageHandlers[r.type](r.sourceMapId,e,i);this.completeTask(t,null,n)}catch(e){this.completeTask(t,e)}})}completeTask(t,e,r){const i=[];delete this.abortControllers[t];const n={id:t,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:e?co(e):null,data:co(r,i)};this.target.postMessage(n,{transfer:i})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},t.K=lt,t.L=function(){var t=new d(16);return d!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t},t.M=function(t,e,r){var i,n,o,a,s,l,c,h,u,p,d,f,m=r[0],g=r[1],_=r[2];return e===t?(t[12]=e[0]*m+e[4]*g+e[8]*_+e[12],t[13]=e[1]*m+e[5]*g+e[9]*_+e[13],t[14]=e[2]*m+e[6]*g+e[10]*_+e[14],t[15]=e[3]*m+e[7]*g+e[11]*_+e[15]):(n=e[1],o=e[2],a=e[3],s=e[4],l=e[5],c=e[6],h=e[7],u=e[8],p=e[9],d=e[10],f=e[11],t[0]=i=e[0],t[1]=n,t[2]=o,t[3]=a,t[4]=s,t[5]=l,t[6]=c,t[7]=h,t[8]=u,t[9]=p,t[10]=d,t[11]=f,t[12]=i*m+s*g+u*_+e[12],t[13]=n*m+l*g+p*_+e[13],t[14]=o*m+c*g+d*_+e[14],t[15]=a*m+h*g+f*_+e[15]),t},t.N=function(t,e,r){var i=r[0],n=r[1],o=r[2];return t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t[3]=e[3]*i,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*o,t[9]=e[9]*o,t[10]=e[10]*o,t[11]=e[11]*o,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},t.O=function(t,e,r){var i=e[0],n=e[1],o=e[2],a=e[3],s=e[4],l=e[5],c=e[6],h=e[7],u=e[8],p=e[9],d=e[10],f=e[11],m=e[12],g=e[13],_=e[14],y=e[15],b=r[0],v=r[1],x=r[2],w=r[3];return t[0]=b*i+v*s+x*u+w*m,t[1]=b*n+v*l+x*p+w*g,t[2]=b*o+v*c+x*d+w*_,t[3]=b*a+v*h+x*f+w*y,t[4]=(b=r[4])*i+(v=r[5])*s+(x=r[6])*u+(w=r[7])*m,t[5]=b*n+v*l+x*p+w*g,t[6]=b*o+v*c+x*d+w*_,t[7]=b*a+v*h+x*f+w*y,t[8]=(b=r[8])*i+(v=r[9])*s+(x=r[10])*u+(w=r[11])*m,t[9]=b*n+v*l+x*p+w*g,t[10]=b*o+v*c+x*d+w*_,t[11]=b*a+v*h+x*f+w*y,t[12]=(b=r[12])*i+(v=r[13])*s+(x=r[14])*u+(w=r[15])*m,t[13]=b*n+v*l+x*p+w*g,t[14]=b*o+v*c+x*d+w*_,t[15]=b*a+v*h+x*f+w*y,t},t.P=r,t.Q=function(t,e){const r={};for(let i=0;i<e.length;i++){const n=e[i];n in t&&(r[n]=t[n])}return r},t.R=el,t.S=cu,t.T=hl,t.U=du,t.V=pu,t.W=h,t.X=u,t.Y=K,t.Z=xu,t._=e,t.a=at,t.a$=T,t.a0=function(t,e){var r,i,n,o;if(!t)return null!=e?e:{};if(!e)return t;const a=Object.assign({},t);if(e.removeAll&&(a.removeAll=!0),e.remove){const t=new Set(a.remove?a.remove.concat(e.remove):e.remove);a.remove=Array.from(t.values())}if(e.add){const t=a.add?a.add.concat(e.add):e.add,r=new Map(t.map(t=>[t.id,t]));a.add=Array.from(r.values())}if(e.update){const t=new Map(null===(r=a.update)||void 0===r?void 0:r.map(t=>[t.id,t]));for(const r of e.update){const e=null!==(i=t.get(r.id))&&void 0!==i?i:{id:r.id};r.newGeometry&&(e.newGeometry=r.newGeometry),r.addOrUpdateProperties&&(e.addOrUpdateProperties=(null!==(n=e.addOrUpdateProperties)&&void 0!==n?n:[]).concat(r.addOrUpdateProperties)),r.removeProperties&&(e.removeProperties=(null!==(o=e.removeProperties)&&void 0!==o?o:[]).concat(r.removeProperties)),r.removeAllProperties&&(e.removeAllProperties=!0),t.set(r.id,e)}a.update=Array.from(t.values())}return a},t.a1=_u,t.a2=Su,t.a3=25,t.a4=bu,t.a5=t=>{const e=window.document.createElement("video");return e.muted=!0,new Promise(r=>{e.onloadstart=()=>{r(e)};for(const r of t){const t=window.document.createElement("source");pt(r)||(e.crossOrigin="Anonymous"),t.src=r,e.appendChild(t)}})},t.a6=Et,t.a7=function(){return j++},t.a8=ba,t.a9=Hh,t.aA=function(t){let e=1/0,r=1/0,i=-1/0,n=-1/0;for(const o of t)e=Math.min(e,o.x),r=Math.min(r,o.y),i=Math.max(i,o.x),n=Math.max(n,o.y);return[e,r,i,n]},t.aB=qc,t.aC=E,t.aD=function(t,e,r,i,n=!1){if(!r[0]&&!r[1])return[0,0];const o=n?"map"===i?-t.bearingInRadians:0:"viewport"===i?t.bearingInRadians:0;if(o){const t=Math.sin(o),e=Math.cos(o);r=[r[0]*e-r[1]*t,r[0]*t+r[1]*e]}return[n?r[0]:E(e,r[0],t.zoom),n?r[1]:E(e,r[1],t.zoom)]},t.aF=Uh,t.aG=Qu,t.aH=Mh,t.aI=op,t.aJ=Ho,t.aK=Zl,t.aL=Ea,t.aM=qa,t.aN=Va,t.aO=B,t.aP=et,t.aQ=gu,t.aR=v,t.aS=b,t.aT=function(t){var e=new d(3);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e},t.aU=function(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t},t.aV=function(t,e){var r=e[0],i=e[1],n=e[2],o=r*r+i*i+n*n;return o>0&&(o=1/Math.sqrt(o)),t[0]=e[0]*o,t[1]=e[1]*o,t[2]=e[2]*o,t},t.aW=x,t.aX=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]},t.aY=function(t,e,r){return t[0]=e[0]*r[0],t[1]=e[1]*r[1],t[2]=e[2]*r[2],t[3]=e[3]*r[3],t},t.aZ=_,t.a_=function(t,e,r){const i=e[0]*r[0]+e[1]*r[1]+e[2]*r[2];return 0===i?null:(-(t[0]*r[0]+t[1]*r[1]+t[2]*r[2])-r[3])/i},t.aa=hn,t.ab=Ps,t.ac=Cu,t.ad=function(t){const e={};if(t.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(t,r,i,n)=>{const o=i||n;return e[r]=!o||o.toLowerCase(),""}),e["max-age"]){const t=parseInt(e["max-age"],10);isNaN(t)?delete e["max-age"]:e["max-age"]=t}return e},t.ae=tt,t.af=function(t){return Math.pow(2,t)},t.ag=m,t.ah=F,t.ai=85.051129,t.aj=fu,t.ak=function(t){return Math.log(t)/Math.LN2},t.al=function(t){var e=t[0],r=t[1];return e*e+r*r},t.am=function(t,e){const r=[];for(const i in t)i in e||r.push(i);return r},t.an=function(t,e){let r=0,i=0;if("constant"===t.kind)i=t.layoutSize;else if("source"!==t.kind){const{interpolationType:n,minZoom:o,maxZoom:a}=t,s=n?F(ur.interpolationFactor(n,e,o,a),0,1):0;"camera"===t.kind?i=dr.number(t.minSize,t.maxSize,s):r=s}return{uSizeT:r,uSize:i}},t.ap=function(t,{uSize:e,uSizeT:r},{lowerSize:i,upperSize:n}){return"source"===t.kind?i/Bh:"composite"===t.kind?dr.number(i/Bh,n/Bh,r):e},t.aq=function(t,e){var r=e[0],i=e[1],n=e[2],o=e[3],a=e[4],s=e[5],l=e[6],c=e[7],h=e[8],u=e[9],p=e[10],d=e[11],f=e[12],m=e[13],g=e[14],_=e[15],y=r*s-i*a,b=r*l-n*a,v=r*c-o*a,x=i*l-n*s,w=i*c-o*s,T=n*c-o*l,S=h*m-u*f,P=h*g-p*f,C=h*_-d*f,M=u*g-p*m,A=u*_-d*m,I=p*_-d*g,E=y*I-b*A+v*M+x*C-w*P+T*S;return E?(t[0]=(s*I-l*A+c*M)*(E=1/E),t[1]=(n*A-i*I-o*M)*E,t[2]=(m*T-g*w+_*x)*E,t[3]=(p*w-u*T-d*x)*E,t[4]=(l*C-a*I-c*P)*E,t[5]=(r*I-n*C+o*P)*E,t[6]=(g*v-f*T-_*b)*E,t[7]=(h*T-p*v+d*b)*E,t[8]=(a*A-s*C+c*S)*E,t[9]=(i*C-r*A-o*S)*E,t[10]=(f*w-m*v+_*y)*E,t[11]=(u*v-h*w-d*y)*E,t[12]=(s*P-a*M-l*S)*E,t[13]=(r*M-i*P+n*S)*E,t[14]=(m*b-f*x-g*y)*E,t[15]=(h*x-u*b+p*y)*E,t):null},t.ar=M,t.as=function(t){var e=t[0],r=t[1];return Math.sqrt(e*e+r*r)},t.at=function(t){return t[0]=0,t[1]=0,t},t.au=function(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t},t.av=$h,t.aw=S,t.ax=function(t,e,i,n){const o=e.y-t.y,a=e.x-t.x,s=n.y-i.y,l=n.x-i.x,c=s*a-l*o;if(0===c)return null;const h=(l*(t.y-i.y)-s*(t.x-i.x))/c;return new r(t.x+h*a,t.y+h*o)},t.ay=Eu,t.az=Is,t.b=W,t.b$=class extends sa{},t.b0=function(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t},t.b1=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]},t.b2=vu,t.b3=wu,t.b4=function(t,e,r,i,n){var o=1/Math.tan(e/2);if(t[0]=o/r,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=o,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,null!=n&&n!==1/0){var a=1/(i-n);t[10]=(n+i)*a,t[14]=2*n*i*a}else t[10]=-1,t[14]=-2*i;return t},t.b5=function(t){var e=new d(16);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},t.b6=function(t,e,r){var i=Math.sin(r),n=Math.cos(r),o=e[0],a=e[1],s=e[2],l=e[3],c=e[4],h=e[5],u=e[6],p=e[7];return e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=o*n+c*i,t[1]=a*n+h*i,t[2]=s*n+u*i,t[3]=l*n+p*i,t[4]=c*n-o*i,t[5]=h*n-a*i,t[6]=u*n-s*i,t[7]=p*n-l*i,t},t.b7=function(t,e,r){var i=Math.sin(r),n=Math.cos(r),o=e[4],a=e[5],s=e[6],l=e[7],c=e[8],h=e[9],u=e[10],p=e[11];return e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=o*n+c*i,t[5]=a*n+h*i,t[6]=s*n+u*i,t[7]=l*n+p*i,t[8]=c*n-o*i,t[9]=h*n-a*i,t[10]=u*n-s*i,t[11]=p*n-l*i,t},t.b8=function(){const t=new Float32Array(16);return m(t),t},t.b9=function(){const t=new Float64Array(16);return m(t),t},t.bA=function(t,e){const r=k(t,360),i=k(e,360),n=i-r,o=i>r?n-360:n+360;return Math.abs(n)<Math.abs(o)?n:o},t.bB=function(t){return t[0]=0,t[1]=0,t[2]=0,t},t.bC=function(t,e,r,i){const n=Math.sqrt(t*t+e*e),o=Math.sqrt(r*r+i*i);t/=n,e/=n,r/=o,i/=o;const a=Math.acos(t*r+e*i);return-e*r+t*i>0?a:-a},t.bD=function(t,e){const r=k(t,2*Math.PI),i=k(e,2*Math.PI);return Math.min(Math.abs(r-i),Math.abs(r-i+2*Math.PI),Math.abs(r-i-2*Math.PI))},t.bE=function(){const t={},e=yt.$version;for(const r in yt.$root){const i=yt.$root[r];if(i.required){let n=null;n="version"===r?e:"array"===i.type?[]:{},null!=n&&(t[r]=n)}}return t},t.bF=uo,t.bG=ht,t.bH=function t(e,r){if(Array.isArray(e)){if(!Array.isArray(r)||e.length!==r.length)return!1;for(let i=0;i<e.length;i++)if(!t(e[i],r[i]))return!1;return!0}if("object"==typeof e&&null!==e&&null!==r){if("object"!=typeof r)return!1;if(Object.keys(e).length!==Object.keys(r).length)return!1;for(const i in e)if(!t(e[i],r[i]))return!1;return!0}return e===r},t.bI=function(t){t=t.slice();const e=Object.create(null);for(let r=0;r<t.length;r++)e[t[r].id]=t[r];for(let r=0;r<t.length;r++)"ref"in t[r]&&(t[r]=vt(t[r],e[t[r].ref]));return t},t.bJ=function(t){if("custom"===t.type)return new ou(t);switch(t.type){case"background":return new eu(t);case"circle":return new qs(t);case"color-relief":return new dl(t);case"fill":return new ic(t);case"fill-extrusion":return new wc(t);case"heatmap":return new nl(t);case"hillshade":return new sl(t);case"line":return new Bc(t);case"raster":return new nu(t);case"symbol":return new Jh(t)}},t.bK=V,t.bL=function(t,e){if(!t)return[{command:"setStyle",args:[e]}];let r=[];try{if(!xt(t.version,e.version))return[{command:"setStyle",args:[e]}];xt(t.center,e.center)||r.push({command:"setCenter",args:[e.center]}),xt(t.state,e.state)||r.push({command:"setGlobalState",args:[e.state]}),xt(t.centerAltitude,e.centerAltitude)||r.push({command:"setCenterAltitude",args:[e.centerAltitude]}),xt(t.zoom,e.zoom)||r.push({command:"setZoom",args:[e.zoom]}),xt(t.bearing,e.bearing)||r.push({command:"setBearing",args:[e.bearing]}),xt(t.pitch,e.pitch)||r.push({command:"setPitch",args:[e.pitch]}),xt(t.roll,e.roll)||r.push({command:"setRoll",args:[e.roll]}),xt(t.sprite,e.sprite)||r.push({command:"setSprite",args:[e.sprite]}),xt(t.glyphs,e.glyphs)||r.push({command:"setGlyphs",args:[e.glyphs]}),xt(t.transition,e.transition)||r.push({command:"setTransition",args:[e.transition]}),xt(t.light,e.light)||r.push({command:"setLight",args:[e.light]}),xt(t.terrain,e.terrain)||r.push({command:"setTerrain",args:[e.terrain]}),xt(t.sky,e.sky)||r.push({command:"setSky",args:[e.sky]}),xt(t.projection,e.projection)||r.push({command:"setProjection",args:[e.projection]});const i={},n=[];!function(t,e,r,i){let n;for(n in e=e||{},t=t||{})Object.prototype.hasOwnProperty.call(t,n)&&(Object.prototype.hasOwnProperty.call(e,n)||St(n,r,i));for(n in e)Object.prototype.hasOwnProperty.call(e,n)&&(Object.prototype.hasOwnProperty.call(t,n)?xt(t[n],e[n])||("geojson"===t[n].type&&"geojson"===e[n].type&&Ct(t,e,n)?wt(r,{command:"setGeoJSONSourceData",args:[n,e[n].data]}):Pt(n,e,r,i)):Tt(n,e,r))}(t.sources,e.sources,n,i);const o=[];t.layers&&t.layers.forEach(t=>{"source"in t&&i[t.source]?r.push({command:"removeLayer",args:[t.id]}):o.push(t)}),r=r.concat(n),function(t,e,r){e=e||[];const i=(t=t||[]).map(At),n=e.map(At),o=t.reduce(It,{}),a=e.reduce(It,{}),s=i.slice(),l=Object.create(null);let c,h,u,p,d;for(let t=0,e=0;t<i.length;t++)c=i[t],Object.prototype.hasOwnProperty.call(a,c)?e++:(wt(r,{command:"removeLayer",args:[c]}),s.splice(s.indexOf(c,e),1));for(let t=0,e=0;t<n.length;t++)c=n[n.length-1-t],s[s.length-1-t]!==c&&(Object.prototype.hasOwnProperty.call(o,c)?(wt(r,{command:"removeLayer",args:[c]}),s.splice(s.lastIndexOf(c,s.length-e),1)):e++,p=s[s.length-t],wt(r,{command:"addLayer",args:[a[c],p]}),s.splice(s.length-t,0,c),l[c]=!0);for(let t=0;t<n.length;t++)if(c=n[t],h=o[c],u=a[c],!l[c]&&!xt(h,u))if(xt(h.source,u.source)&&xt(h["source-layer"],u["source-layer"])&&xt(h.type,u.type)){for(d in Mt(h.layout,u.layout,r,c,null,"setLayoutProperty"),Mt(h.paint,u.paint,r,c,null,"setPaintProperty"),xt(h.filter,u.filter)||wt(r,{command:"setFilter",args:[c,u.filter]}),xt(h.minzoom,u.minzoom)&&xt(h.maxzoom,u.maxzoom)||wt(r,{command:"setLayerZoomRange",args:[c,u.minzoom,u.maxzoom]}),h)Object.prototype.hasOwnProperty.call(h,d)&&"layout"!==d&&"paint"!==d&&"filter"!==d&&"metadata"!==d&&"minzoom"!==d&&"maxzoom"!==d&&(0===d.indexOf("paint.")?Mt(h[d],u[d],r,c,d.slice(6),"setPaintProperty"):xt(h[d],u[d])||wt(r,{command:"setLayerProperty",args:[c,d,u[d]]}));for(d in u)Object.prototype.hasOwnProperty.call(u,d)&&!Object.prototype.hasOwnProperty.call(h,d)&&"layout"!==d&&"paint"!==d&&"filter"!==d&&"metadata"!==d&&"minzoom"!==d&&"maxzoom"!==d&&(0===d.indexOf("paint.")?Mt(h[d],u[d],r,c,d.slice(6),"setPaintProperty"):xt(h[d],u[d])||wt(r,{command:"setLayerProperty",args:[c,d,u[d]]}))}else wt(r,{command:"removeLayer",args:[c]}),p=s[s.lastIndexOf(c)+1],wt(r,{command:"addLayer",args:[u,p]})}(o,e.layers,r)}catch(t){console.warn("Unable to compute style diff:",t),r=[{command:"setStyle",args:[e]}]}return r},t.bM=function(t){const e=[],r=t.id;return void 0===r&&e.push({message:`layers.${r}: missing required property "id"`}),void 0===t.render&&e.push({message:`layers.${r}: missing required method "render"`}),t.renderingMode&&"2d"!==t.renderingMode&&"3d"!==t.renderingMode&&e.push({message:`layers.${r}: property "renderingMode" must be either "2d" or "3d"`}),e},t.bN=U,t.bO=N,t.bP=class extends ss{constructor(t,e){super(t,e),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1i(this.location,t))}},t.bQ=hs,t.bR=class extends ss{constructor(t,e){super(t,e),this.current=us}set(t){if(t[12]!==this.current[12]||t[0]!==this.current[0])return this.current=t,void this.gl.uniformMatrix4fv(this.location,!1,t);for(let e=1;e<16;e++)if(t[e]!==this.current[e]){this.current=t,this.gl.uniformMatrix4fv(this.location,!1,t);break}}},t.bS=cs,t.bT=class extends ss{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]))}},t.bU=class extends ss{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]))}},t.bV=f,t.bW=function(t,e){var r=Math.sin(e),i=Math.cos(e);return t[0]=i,t[1]=r,t[2]=0,t[3]=-r,t[4]=i,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},t.bX=function(t,e,r){var i=e[0],n=e[1],o=e[2];return t[0]=i*r[0]+n*r[3]+o*r[6],t[1]=i*r[1]+n*r[4]+o*r[7],t[2]=i*r[2]+n*r[5]+o*r[8],t},t.bY=function(t,e,r,i,n,o,a){var s=1/(e-r),l=1/(i-n),c=1/(o-a);return t[0]=-2*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*l,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*c,t[11]=0,t[12]=(e+r)*s,t[13]=(n+i)*l,t[14]=(a+o)*c,t[15]=1,t},t.bZ=class extends ss{constructor(t,e){super(t,e),this.current=new Array}set(t){if(t!=this.current){this.current=t;const e=new Float32Array(4*t.length);for(let r=0;r<t.length;r++)e[4*r]=t[r].r,e[4*r+1]=t[r].g,e[4*r+2]=t[r].b,e[4*r+3]=t[r].a;this.gl.uniform4fv(this.location,e)}}},t.b_=class extends ss{constructor(t,e){super(t,e),this.current=new Array}set(t){if(t!=this.current){this.current=t;const e=new Float32Array(t);this.gl.uniform1fv(this.location,e)}}},t.ba=function(){return new Float64Array(16)},t.bb=function(t,e,r){const i=new Float64Array(4);return C(i,t,e-90,r),i},t.bc=function(t,e,r,i){var n,o,a,s,l,c=e[0],h=e[1],u=e[2],d=e[3],f=r[0],m=r[1],g=r[2],_=r[3];return(o=c*f+h*m+u*g+d*_)<0&&(o=-o,f=-f,m=-m,g=-g,_=-_),1-o>p?(n=Math.acos(o),a=Math.sin(n),s=Math.sin((1-i)*n)/a,l=Math.sin(i*n)/a):(s=1-i,l=i),t[0]=s*c+l*f,t[1]=s*h+l*m,t[2]=s*u+l*g,t[3]=s*d+l*_,t},t.bd=function(t){const e=new Float64Array(9);var r,i,n,o,a,s,l,c,h,u,p,d,f,m,g,_,y,b;u=(n=(i=t)[0])*(l=n+n),p=(o=i[1])*l,f=(a=i[2])*l,m=a*(c=o+o),_=(s=i[3])*l,y=s*c,b=s*(h=a+a),(r=e)[0]=1-(d=o*c)-(g=a*h),r[3]=p-b,r[6]=f+y,r[1]=p+b,r[4]=1-u-g,r[7]=m-_,r[2]=f-y,r[5]=m+_,r[8]=1-u-d;const v=et(-Math.asin(F(e[2],-1,1)));let x,w;return Math.hypot(e[5],e[8])<.001?(x=0,w=-et(Math.atan2(e[3],e[4]))):(x=et(0===e[5]&&0===e[8]?0:Math.atan2(e[5],e[8])),w=et(0===e[1]&&0===e[0]?0:Math.atan2(e[1],e[0]))),{roll:x,pitch:v+90,bearing:w}},t.be=function(t,e){return t.roll==e.roll&&t.pitch==e.pitch&&t.bearing==e.bearing},t.bf=Ce,t.bg=ls,t.bh=Gl,t.bi=ql,t.bj=$l,t.bk=z,t.bl=R,t.bm=Oe,t.bn=function(t,e,r,i,n){return z(i,n,F((t-e)/(r-e),0,1))},t.bo=k,t.bp=function(){return new Float64Array(3)},t.bq=function(t,e,r,i){return t[0]=e[0]+r[0]*i,t[1]=e[1]+r[1]*i,t[2]=e[2]+r[2]*i,t},t.br=C,t.bs=function(t,e,r){var i=r[0],n=r[1],o=r[2],a=r[3],s=e[0],l=e[1],c=e[2],h=n*c-o*l,u=o*s-i*c,p=i*l-n*s;return t[0]=s+a*(h+=h)+n*(p+=p)-o*(u+=u),t[1]=l+a*u+o*h-i*p,t[2]=c+a*p+i*u-n*h,t},t.bt=function(t,e,r){const i=(n=[t[0],t[1],t[2],e[0],e[1],e[2],r[0],r[1],r[2]])[0]*((h=n[8])*(a=n[4])-(s=n[5])*(c=n[7]))+n[1]*(-h*(o=n[3])+s*(l=n[6]))+n[2]*(c*o-a*l);var n,o,a,s,l,c,h;if(0===i)return null;const u=x([],[e[0],e[1],e[2]],[r[0],r[1],r[2]]),p=x([],[r[0],r[1],r[2]],[t[0],t[1],t[2]]),d=x([],[t[0],t[1],t[2]],[e[0],e[1],e[2]]),f=v([],u,-t[3]);return b(f,f,v([],p,-e[3])),b(f,f,v([],d,-r[3])),v(f,f,1/i),f},t.bu=lu,t.bv=function(){return new Float64Array(4)},t.bw=function(t,e,r,i){var n=[],o=[];return n[0]=e[0]-r[0],n[1]=e[1]-r[1],n[2]=e[2]-r[2],o[0]=n[0]*Math.cos(i)-n[1]*Math.sin(i),o[1]=n[0]*Math.sin(i)+n[1]*Math.cos(i),o[2]=n[2],t[0]=o[0]+r[0],t[1]=o[1]+r[1],t[2]=o[2]+r[2],t},t.bx=function(t,e,r,i){var n=[],o=[];return n[0]=e[0]-r[0],n[1]=e[1]-r[1],n[2]=e[2]-r[2],o[0]=n[0],o[1]=n[1]*Math.cos(i)-n[2]*Math.sin(i),o[2]=n[1]*Math.sin(i)+n[2]*Math.cos(i),t[0]=o[0]+r[0],t[1]=o[1]+r[1],t[2]=o[2]+r[2],t},t.by=function(t,e,r,i){var n=[],o=[];return n[0]=e[0]-r[0],n[1]=e[1]-r[1],n[2]=e[2]-r[2],o[0]=n[2]*Math.sin(i)+n[0]*Math.cos(i),o[1]=n[1],o[2]=n[2]*Math.cos(i)-n[0]*Math.sin(i),t[0]=o[0]+r[0],t[1]=o[1]+r[1],t[2]=o[2]+r[2],t},t.bz=function(t,e,r){var i=Math.sin(r),n=Math.cos(r),o=e[0],a=e[1],s=e[2],l=e[3],c=e[8],h=e[9],u=e[10],p=e[11];return e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=o*n-c*i,t[1]=a*n-h*i,t[2]=s*n-u*i,t[3]=l*n-p*i,t[8]=o*i+c*n,t[9]=a*i+h*n,t[10]=s*i+u*n,t[11]=l*i+p*n,t},t.c=ot,t.c0=$c,t.c1=class extends ca{},t.c2=il,t.c3=function(t){return t<=1?1:Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))},t.c4=rl,t.c5=function(t,e,r){var i=e[0],n=e[1],o=e[2],a=r[3]*i+r[7]*n+r[11]*o+r[15];return t[0]=(r[0]*i+r[4]*n+r[8]*o+r[12])/(a=a||1),t[1]=(r[1]*i+r[5]*n+r[9]*o+r[13])/a,t[2]=(r[2]*i+r[6]*n+r[10]*o+r[14])/a,t},t.c6=class extends Yo{},t.c7=class extends ga{},t.c8=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]&&t[8]===e[8]&&t[9]===e[9]&&t[10]===e[10]&&t[11]===e[11]&&t[12]===e[12]&&t[13]===e[13]&&t[14]===e[14]&&t[15]===e[15]},t.c9=function(t,e){var r=t[0],i=t[1],n=t[2],o=t[3],a=t[4],s=t[5],l=t[6],c=t[7],h=t[8],u=t[9],d=t[10],f=t[11],m=t[12],g=t[13],_=t[14],y=t[15],b=e[0],v=e[1],x=e[2],w=e[3],T=e[4],S=e[5],P=e[6],C=e[7],M=e[8],A=e[9],I=e[10],E=e[11],k=e[12],z=e[13],R=e[14],D=e[15];return Math.abs(r-b)<=p*Math.max(1,Math.abs(r),Math.abs(b))&&Math.abs(i-v)<=p*Math.max(1,Math.abs(i),Math.abs(v))&&Math.abs(n-x)<=p*Math.max(1,Math.abs(n),Math.abs(x))&&Math.abs(o-w)<=p*Math.max(1,Math.abs(o),Math.abs(w))&&Math.abs(a-T)<=p*Math.max(1,Math.abs(a),Math.abs(T))&&Math.abs(s-S)<=p*Math.max(1,Math.abs(s),Math.abs(S))&&Math.abs(l-P)<=p*Math.max(1,Math.abs(l),Math.abs(P))&&Math.abs(c-C)<=p*Math.max(1,Math.abs(c),Math.abs(C))&&Math.abs(h-M)<=p*Math.max(1,Math.abs(h),Math.abs(M))&&Math.abs(u-A)<=p*Math.max(1,Math.abs(u),Math.abs(A))&&Math.abs(d-I)<=p*Math.max(1,Math.abs(d),Math.abs(I))&&Math.abs(f-E)<=p*Math.max(1,Math.abs(f),Math.abs(E))&&Math.abs(m-k)<=p*Math.max(1,Math.abs(m),Math.abs(k))&&Math.abs(g-z)<=p*Math.max(1,Math.abs(g),Math.abs(z))&&Math.abs(_-R)<=p*Math.max(1,Math.abs(_),Math.abs(R))&&Math.abs(y-D)<=p*Math.max(1,Math.abs(y),Math.abs(D))},t.cA=function(t,e){at.REGISTERED_PROTOCOLS[t]=e},t.cB=function(t){delete at.REGISTERED_PROTOCOLS[t]},t.cC=function(t,e){const r={};for(let i=0;i<t.length;i++){const n=e&&e[t[i].id]||bn(t[i]);e&&(e[t[i].id]=n);let o=r[n];o||(o=r[n]=[]),o.push(t[i])}const i=[];for(const t in r)i.push(r[t]);return i},t.cD=oo,t.cE=Pu,t.cF=Mu,t.cG=dh,t.cH=function(e){e.bucket.createArrays(),e.bucket.tilePixelRatio=I/(512*e.bucket.overscaling),e.bucket.compareText={},e.bucket.iconsNeedLinear=!1;const r=e.bucket.layers[0],i=r.layout,n=r._unevaluatedLayout._values,o={layoutIconSize:n["icon-size"].possiblyEvaluate(new Mo(e.bucket.zoom+1),e.canonical),layoutTextSize:n["text-size"].possiblyEvaluate(new Mo(e.bucket.zoom+1),e.canonical),textMaxSize:n["text-size"].possiblyEvaluate(new Mo(18))};if("composite"===e.bucket.textSizeData.kind){const{minZoom:t,maxZoom:r}=e.bucket.textSizeData;o.compositeTextSizes=[n["text-size"].possiblyEvaluate(new Mo(t),e.canonical),n["text-size"].possiblyEvaluate(new Mo(r),e.canonical)]}if("composite"===e.bucket.iconSizeData.kind){const{minZoom:t,maxZoom:r}=e.bucket.iconSizeData;o.compositeIconSizes=[n["icon-size"].possiblyEvaluate(new Mo(t),e.canonical),n["icon-size"].possiblyEvaluate(new Mo(r),e.canonical)]}const a=i.get("text-line-height")*qc,s="viewport"!==i.get("text-rotation-alignment")&&"point"!==i.get("symbol-placement"),l=i.get("text-keep-upright"),c=i.get("text-size");for(const n of e.bucket.features){const h=i.get("text-font").evaluate(n,{},e.canonical).join(","),u=c.evaluate(n,{},e.canonical),p=o.layoutTextSize.evaluate(n,{},e.canonical),d=o.layoutIconSize.evaluate(n,{},e.canonical),f={horizontal:{},vertical:void 0},m=n.text;let g,_=[0,0];if(m){const o=m.toString(),c=i.get("text-letter-spacing").evaluate(n,{},e.canonical)*qc,d=mo(o)?c:0,g=i.get("text-anchor").evaluate(n,{},e.canonical),y=Ju(r,n,e.canonical);if(!y){const t=i.get("text-radial-offset").evaluate(n,{},e.canonical);_=t?Yu(g,[t*qc,Ku]):i.get("text-offset").evaluate(n,{},e.canonical).map(t=>t*qc)}let b=s?"center":i.get("text-justify").evaluate(n,{},e.canonical);const v="point"===i.get("symbol-placement")?i.get("text-max-width").evaluate(n,{},e.canonical)*qc:1/0,x=()=>{e.bucket.allowVerticalPlacement&&fo(o)&&(f.vertical=_h(m,e.glyphMap,e.glyphPositions,e.imagePositions,h,v,a,g,"left",d,_,t.ao.vertical,!0,p,u))};if(!s&&y){const r=new Set;if("auto"===b)for(let t=0;t<y.values.length;t+=2)r.add(Qu(y.values[t]));else r.add(b);let i=!1;for(const n of r)if(!f.horizontal[n])if(i)f.horizontal[n]=f.horizontal[0];else{const r=_h(m,e.glyphMap,e.glyphPositions,e.imagePositions,h,v,a,"center",n,d,_,t.ao.horizontal,!1,p,u);r&&(f.horizontal[n]=r,i=1===r.positionedLines.length)}x()}else{"auto"===b&&(b=Qu(g));const r=_h(m,e.glyphMap,e.glyphPositions,e.imagePositions,h,v,a,g,b,d,_,t.ao.horizontal,!1,p,u);r&&(f.horizontal[b]=r),x(),fo(o)&&s&&l&&(f.vertical=_h(m,e.glyphMap,e.glyphPositions,e.imagePositions,h,v,a,g,b,d,_,t.ao.vertical,!1,p,u))}}let y=!1;if(n.icon&&n.icon.name){const t=e.imageMap[n.icon.name];t&&(g=Dh(e.imagePositions[n.icon.name],i.get("icon-offset").evaluate(n,{},e.canonical),i.get("icon-anchor").evaluate(n,{},e.canonical)),y=!!t.sdf,void 0===e.bucket.sdfIcons?e.bucket.sdfIcons=y:e.bucket.sdfIcons!==y&&Z("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(t.pixelRatio!==e.bucket.pixelRatio||0!==i.get("icon-rotate").constantOr(1))&&(e.bucket.iconsNeedLinear=!0))}const b=rp(f.horizontal)||f.vertical;e.bucket.iconsInText=!!b&&b.iconsInText,(b||g)&&tp(e.bucket,n,f,g,e.imageMap,o,p,d,_,y,e.canonical,e.subdivisionGranularity)}e.showCollisionBoxes&&e.bucket.generateCollisionDebugBuffers()},t.cI=kc,t.cJ=Ql,t.cK=gc,t.cL=pc,t.cM=Kc,t.cN=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 0===t.length&&(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}},t.cO=function(t,r,i,n,o){return e(this,void 0,void 0,function*(){if(u())try{return yield K(t,r,i,n,o)}catch(t){}return function(t,e,r,i,n){const o=t.width,a=t.height;Y&&J||(Y=new OffscreenCanvas(o,a),J=Y.getContext("2d",{willReadFrequently:!0})),Y.width=o,Y.height=a,J.drawImage(t,0,0,o,a);const s=J.getImageData(e,r,i,n);return J.clearRect(0,0,o,a),s.data}(t,r,i,n,o)})},t.cP=ul,t.cQ=i,t.cR=hc,t.cS=sc,t.cT=tn,t.cU=function(t,e){const r=new Map;if(null==t);else if("Feature"===t.type)r.set(Tu(t,e),t);else for(const i of t.features)r.set(Tu(i,e),i);return r},t.cV=function(t,e){if(null==t)return!0;if("Feature"===t.type)return null!=Tu(t,e);if("FeatureCollection"===t.type){const r=new Set;for(const i of t.features){const t=Tu(i,e);if(null==t)return!1;if(r.has(t))return!1;r.add(t)}return!0}return!1},t.cW=function(t,e,r){var i,n,o,a;if(e.removeAll&&t.clear(),e.remove)for(const r of e.remove)t.delete(r);if(e.add)for(const i of e.add){const e=Tu(i,r);null!=e&&t.set(e,i)}if(e.update)for(const r of e.update){let e=t.get(r.id);if(null==e)continue;const s=!r.removeAllProperties&&((null===(i=r.removeProperties)||void 0===i?void 0:i.length)>0||(null===(n=r.addOrUpdateProperties)||void 0===n?void 0:n.length)>0);if((r.newGeometry||r.removeAllProperties||s)&&(e=Object.assign({},e),t.set(r.id,e),s&&(e.properties=Object.assign({},e.properties))),r.newGeometry&&(e.geometry=r.newGeometry),r.removeAllProperties)e.properties={};else if((null===(o=r.removeProperties)||void 0===o?void 0:o.length)>0)for(const t of r.removeProperties)Object.prototype.hasOwnProperty.call(e.properties,t)&&delete e.properties[t];if((null===(a=r.addOrUpdateProperties)||void 0===a?void 0:a.length)>0)for(const{key:t,value:i}of r.addOrUpdateProperties)e.properties[t]=i}},t.cX=Co,t.ca=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},t.cb=t=>"symbol"===t.type,t.cc=t=>"circle"===t.type,t.cd=t=>"heatmap"===t.type,t.ce=t=>"line"===t.type,t.cf=t=>"fill"===t.type,t.cg=t=>"fill-extrusion"===t.type,t.ch=t=>"hillshade"===t.type,t.ci=t=>"color-relief"===t.type,t.cj=t=>"raster"===t.type,t.ck=t=>"background"===t.type,t.cl=t=>"custom"===t.type,t.cm=D,t.cn=function(t,e,r){const i=A(e.x-r.x,e.y-r.y),n=A(t.x-r.x,t.y-r.y);var o,a;return et(Math.atan2(i[0]*n[1]-i[1]*n[0],(o=i)[0]*(a=n)[0]+o[1]*a[1]))},t.co=L,t.cp=function(t,e){return it[e]&&(t instanceof MouseEvent||t instanceof WheelEvent)},t.cq=function(t,e){return rt[e]&&"touches"in t},t.cr=function(t){return rt[t]||it[t]},t.cs=function(t,e,r){var i=e[0],n=e[1];return t[0]=r[0]*i+r[4]*n+r[12],t[1]=r[1]*i+r[5]*n+r[13],t},t.ct=function(t,e){const{x:r,y:i}=_u.fromLngLat(e);return!(t<0||t>25||i<0||i>=1||r<0||r>=1)},t.cu=function(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e[1],t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e[2],t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},t.cv=class extends Ko{},t.cw=_p,t.cy=function(t){return t.message===nt},t.cz=ct,t.d=pt,t.e=O,t.f=t=>e(void 0,void 0,void 0,function*(){if(0===t.byteLength)return createImageBitmap(new ImageData(1,1));const e=new Blob([new Uint8Array(t)],{type:"image/png"});try{return createImageBitmap(e)}catch(t){throw new Error(`Could not load image because of ${t.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}}),t.g=st,t.h=t=>new Promise((e,r)=>{const i=new Image;i.onload=()=>{e(i),URL.revokeObjectURL(i.src),i.onload=null,window.requestAnimationFrame(()=>{i.src=X})},i.onerror=()=>r(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const n=new Blob([new Uint8Array(t)],{type:"image/png"});i.src=t.byteLength?URL.createObjectURL(n):X}),t.i=q,t.j=(t,e)=>ut(O(t,{type:"json"}),e),t.k=gt,t.l=mt,t.m=ut,t.n=(t,e)=>ut(O(t,{type:"arrayBuffer"}),e),t.o=function(t){return new Kc(t).readFields(lh,[])},t.p=uh,t.q=tl,t.r=No,t.s=Q,t.t=Eo,t.u=po,t.v=yt,t.w=Z,t.x=Jn,t.y=ro,t.z=Yn}),r("worker",0,function(t){class e{constructor(t){this.keyCache={},t&&this.replace(t)}replace(t){this._layerConfigs={},this._layers={},this.update(t,[])}update(e,r){for(const r of e){this._layerConfigs[r.id]=r;const e=this._layers[r.id]=t.bJ(r);e._featureFilter=t.aa(e.filter),this.keyCache[r.id]&&delete this.keyCache[r.id]}for(const t of r)delete this.keyCache[t],delete this._layerConfigs[t],delete this._layers[t];this.familiesBySource={};const i=t.cC(Object.values(this._layerConfigs),this.keyCache);for(const t of i){const e=t.map(t=>this._layers[t.id]),r=e[0];if("none"===r.visibility)continue;const i=r.source||"";let n=this.familiesBySource[i];n||(n=this.familiesBySource[i]={});const o=r.sourceLayer||"_geojsonTileLayer";let a=n[o];a||(a=n[o]=[]),a.push(e)}}}class r{constructor(e){const r={},i=[];for(const t in e){const n=e[t],o=r[t]={};for(const t in n){const e=n[+t];if(!e||0===e.bitmap.width||0===e.bitmap.height)continue;const r={x:0,y:0,w:e.bitmap.width+2,h:e.bitmap.height+2};i.push(r),o[t]={rect:r,metrics:e.metrics}}}const{w:n,h:o}=t.p(i),a=new t.q({width:n||1,height:o||1});for(const i in e){const n=e[i];for(const e in n){const o=n[+e];if(!o||0===o.bitmap.width||0===o.bitmap.height)continue;const s=r[i][e].rect;t.q.copy(o.bitmap,a,{x:0,y:0},{x:s.x+1,y:s.y+1},o.bitmap)}}this.image=a,this.positions=r}}t.cD("GlyphAtlas",r);class i{constructor(e){this.tileID=new t.Z(e.tileID.overscaledZ,e.tileID.wrap,e.tileID.canonical.z,e.tileID.canonical.x,e.tileID.canonical.y),this.uid=e.uid,this.zoom=e.zoom,this.pixelRatio=e.pixelRatio,this.tileSize=e.tileSize,this.source=e.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=e.showCollisionBoxes,this.collectResourceTiming=!!e.collectResourceTiming,this.returnDependencies=!!e.returnDependencies,this.promoteId=e.promoteId,this.inFlightDependencies=[],this.globalState=e.globalState}parse(e,i,o,a,s){return t._(this,void 0,void 0,function*(){this.status="parsing",this.data=e,this.collisionBoxArray=new t.a8;const l=new t.cE(Object.keys(e.layers).sort()),c=new t.cF(this.tileID,this.promoteId);c.bucketLayerIDs=[];const h={},u={featureIndex:c,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:o,subdivisionGranularity:s},p=i.familiesBySource[this.source];for(const r in p){const i=e.layers[r];if(!i)continue;1===i.version&&t.w(`Vector tile source "${this.source}" layer "${r}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const a=l.encode(r),s=[];for(let t=0;t<i.length;t++){const e=i.feature(t),n=c.getId(e,r);s.push({feature:e,id:n,index:t,sourceLayerIndex:a})}for(const e of p[r]){const r=e[0];r.source!==this.source&&t.w(`layer.source = ${r.source} does not equal this.source = ${this.source}`),r.minzoom&&this.zoom<Math.floor(r.minzoom)||r.maxzoom&&this.zoom>=r.maxzoom||"none"!==r.visibility&&(n(e,this.zoom,o,this.globalState),(h[r.id]=r.createBucket({index:c.bucketLayerIDs.length,layers:e,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:a,sourceID:this.source,globalState:this.globalState})).populate(s,u,this.tileID.canonical),c.bucketLayerIDs.push(e.map(t=>t.id)))}}const d=t.bN(u.glyphDependencies,t=>Object.keys(t).map(Number));this.inFlightDependencies.forEach(t=>null==t?void 0:t.abort()),this.inFlightDependencies=[];let f=Promise.resolve({});if(Object.keys(d).length){const t=new AbortController;this.inFlightDependencies.push(t),f=a.sendAsync({type:"GG",data:{stacks:d,source:this.source,tileID:this.tileID,type:"glyphs"}},t)}const m=Object.keys(u.iconDependencies);let g=Promise.resolve({});if(m.length){const t=new AbortController;this.inFlightDependencies.push(t),g=a.sendAsync({type:"GI",data:{icons:m,source:this.source,tileID:this.tileID,type:"icons"}},t)}const _=Object.keys(u.patternDependencies);let y=Promise.resolve({});if(_.length){const t=new AbortController;this.inFlightDependencies.push(t),y=a.sendAsync({type:"GI",data:{icons:_,source:this.source,tileID:this.tileID,type:"patterns"}},t)}const[b,v,x]=yield Promise.all([f,g,y]),w=new r(b),T=new t.cG(v,x);for(const e in h){const r=h[e];r instanceof t.a9?(n(r.layers,this.zoom,o,this.globalState),t.cH({bucket:r,glyphMap:b,glyphPositions:w.positions,imageMap:v,imagePositions:T.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical,subdivisionGranularity:u.subdivisionGranularity})):r.hasPattern&&(r instanceof t.cI||r instanceof t.cJ||r instanceof t.cK)&&(n(r.layers,this.zoom,o,this.globalState),r.addFeatures(u,this.tileID.canonical,T.patternPositions))}return this.status="done",{buckets:Object.values(h).filter(t=>!t.isEmpty()),featureIndex:c,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:w.image,imageAtlas:T,glyphMap:this.returnDependencies?b:null,iconMap:this.returnDependencies?v:null,glyphPositions:this.returnDependencies?w.positions:null}})}}function n(e,r,i,n){const o=new t.F(r,{globalState:n});for(const t of e)t.recalculate(o,i)}class o{constructor(t,e,r){this.actor=t,this.layerIndex=e,this.availableImages=r,this.fetching={},this.loading={},this.loaded={}}loadVectorTile(e,r){return t._(this,void 0,void 0,function*(){const i=yield t.n(e.request,r);try{return{vectorTile:new t.cL(new t.cM(i.data)),rawData:i.data,cacheControl:i.cacheControl,expires:i.expires}}catch(t){const r=new Uint8Array(i.data);let n=`Unable to parse the tile at ${e.request.url}, `;throw n+=31===r[0]&&139===r[1]?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${t.message}`,new Error(n)}})}loadTile(e){return t._(this,void 0,void 0,function*(){const r=e.uid,n=!!(e&&e.request&&e.request.collectResourceTiming)&&new t.cN(e.request),o=new i(e);this.loading[r]=o;const a=new AbortController;o.abort=a;try{const i=yield this.loadVectorTile(e,a);if(delete this.loading[r],!i)return null;const s=i.rawData,l={};i.expires&&(l.expires=i.expires),i.cacheControl&&(l.cacheControl=i.cacheControl);const c={};if(n){const t=n.finish();t&&(c.resourceTiming=JSON.parse(JSON.stringify(t)))}o.vectorTile=i.vectorTile;const h=o.parse(i.vectorTile,this.layerIndex,this.availableImages,this.actor,e.subdivisionGranularity);this.loaded[r]=o,this.fetching[r]={rawTileData:s,cacheControl:l,resourceTiming:c};try{const e=yield h;return t.e({rawTileData:s.slice(0)},e,l,c)}finally{delete this.fetching[r]}}catch(t){throw delete this.loading[r],o.status="done",this.loaded[r]=o,t}})}reloadTile(e){return t._(this,void 0,void 0,function*(){const r=e.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");const i=this.loaded[r];if(i.showCollisionBoxes=e.showCollisionBoxes,i.globalState=e.globalState,"parsing"===i.status){const n=yield i.parse(i.vectorTile,this.layerIndex,this.availableImages,this.actor,e.subdivisionGranularity);let o;if(this.fetching[r]){const{rawTileData:e,cacheControl:i,resourceTiming:a}=this.fetching[r];delete this.fetching[r],o=t.e({rawTileData:e.slice(0)},n,i,a)}else o=n;return o}if("done"===i.status&&i.vectorTile)return i.parse(i.vectorTile,this.layerIndex,this.availableImages,this.actor,e.subdivisionGranularity)})}abortTile(e){return t._(this,void 0,void 0,function*(){const t=this.loading,r=e.uid;t&&t[r]&&t[r].abort&&(t[r].abort.abort(),delete t[r])})}removeTile(e){return t._(this,void 0,void 0,function*(){this.loaded&&this.loaded[e.uid]&&delete this.loaded[e.uid]})}}class a{constructor(){this.loaded={}}loadTile(e){return t._(this,void 0,void 0,function*(){const{uid:r,encoding:i,rawImageData:n,redFactor:o,greenFactor:a,blueFactor:s,baseShift:l}=e,c=n.width+2,h=n.height+2,u=t.b(n)?new t.R({width:c,height:h},yield t.cO(n,-1,-1,c,h)):n,p=new t.cP(r,u,i,o,a,s,l);return this.loaded=this.loaded||{},this.loaded[r]=p,p})}removeTile(t){const e=this.loaded,r=t.uid;e&&e[r]&&delete e[r]}}var s,l,c=function(){if(l)return s;function t(t,r){if(0!==t.length){e(t[0],r);for(var i=1;i<t.length;i++)e(t[i],!r)}}function e(t,e){for(var r=0,i=0,n=0,o=t.length,a=o-1;n<o;a=n++){var s=(t[n][0]-t[a][0])*(t[a][1]+t[n][1]),l=r+s;i+=Math.abs(r)>=Math.abs(s)?r-l+s:s-l+r,r=l}r+i>=0!=!!e&&t.reverse()}return l=1,s=function e(r,i){var n,o=r&&r.type;if("FeatureCollection"===o)for(n=0;n<r.features.length;n++)e(r.features[n],i);else if("GeometryCollection"===o)for(n=0;n<r.geometries.length;n++)e(r.geometries[n],i);else if("Feature"===o)e(r.geometry,i);else if("Polygon"===o)t(r.coordinates,i);else if("MultiPolygon"===o)for(n=0;n<r.coordinates.length;n++)t(r.coordinates[n],i);return r}}(),h=t.cQ(c);class u extends t.cS{constructor(e,r){super(new t.cM,0,r,[],[]),this.feature=e,this.type=e.type,this.properties=e.tags?e.tags:{},"id"in e&&("string"==typeof e.id?this.id=parseInt(e.id,10):"number"!=typeof e.id||isNaN(e.id)||(this.id=e.id))}loadGeometry(){const e=[],r=1===this.feature.type?[this.feature.geometry]:this.feature.geometry;for(const i of r){const r=[];for(const e of i)r.push(new t.P(e[0],e[1]));e.push(r)}return e}}class p extends t.cR{constructor(e,r){super(new t.cM),this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.version=r?r.version:1,this.extent=r?r.extent:4096,this.length=e.length,this.features=e}feature(t){return new u(this.features[t],this.extent)}}function d(t,e){e.writeVarintField(15,t.version||1),e.writeStringField(1,t.name||""),e.writeVarintField(5,t.extent||4096);const r={keys:[],values:[],keycache:{},valuecache:{}};for(let i=0;i<t.length;i++)r.feature=t.feature(i),e.writeMessage(2,f,r);const i=r.keys;for(const t of i)e.writeStringField(3,t);const n=r.values;for(const t of n)e.writeMessage(4,b,t)}function f(t,e){if(!t.feature)return;const r=t.feature;void 0!==r.id&&e.writeVarintField(1,r.id),e.writeMessage(2,m,t),e.writeVarintField(3,r.type),e.writeMessage(4,y,r)}function m(t,e){for(const r in t.feature?.properties){let i=t.feature.properties[r],n=t.keycache[r];if(null===i)continue;void 0===n&&(t.keys.push(r),n=t.keys.length-1,t.keycache[r]=n),e.writeVarint(n),"string"!=typeof i&&"boolean"!=typeof i&&"number"!=typeof i&&(i=JSON.stringify(i));const o=typeof i+":"+i;let a=t.valuecache[o];void 0===a&&(t.values.push(i),a=t.values.length-1,t.valuecache[o]=a),e.writeVarint(a)}}function g(t,e){return(e<<3)+(7&t)}function _(t){return t<<1^t>>31}function y(t,e){const r=t.loadGeometry(),i=t.type;let n=0,o=0;for(const a of r){let r=1;1===i&&(r=a.length),e.writeVarint(g(1,r));const s=3===i?a.length-1:a.length;for(let t=0;t<s;t++){1===t&&1!==i&&e.writeVarint(g(2,s-1));const r=a[t].x-n,l=a[t].y-o;e.writeVarint(_(r)),e.writeVarint(_(l)),n+=r,o+=l}3===t.type&&e.writeVarint(g(7,1))}}function b(t,e){const r=typeof t;"string"===r?e.writeStringField(1,t):"boolean"===r?e.writeBooleanField(7,t):"number"===r&&(t%1!=0?e.writeDoubleField(3,t):t<0?e.writeSVarintField(6,t):e.writeVarintField(5,t))}const v={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:t=>t},x=Math.fround||(w=new Float32Array(1),t=>(w[0]=+t,w[0]));var w;class T{constructor(t){this.options=Object.assign(Object.create(v),t),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(t){const{log:e,minZoom:r,maxZoom:i}=this.options;e&&console.time("total time");const n=`prepare ${t.length} points`;e&&console.time(n),this.points=t;const o=[];for(let e=0;e<t.length;e++){const r=t[e];if(!r.geometry)continue;const[i,n]=r.geometry.coordinates,a=x(C(i)),s=x(M(n));o.push(a,s,1/0,e,-1,1),this.options.reduce&&o.push(0)}let a=this.trees[i+1]=this._createTree(o);e&&console.timeEnd(n);for(let t=i;t>=r;t--){const r=+Date.now();a=this.trees[t]=this._createTree(this._cluster(a,t)),e&&console.log("z%d: %d clusters in %dms",t,a.numItems,+Date.now()-r)}return e&&console.timeEnd("total time"),this}getClusters(t,e){let r=((t[0]+180)%360+360)%360-180;const i=Math.max(-90,Math.min(90,t[1]));let n=180===t[2]?180:((t[2]+180)%360+360)%360-180;const o=Math.max(-90,Math.min(90,t[3]));if(t[2]-t[0]>=360)r=-180,n=180;else if(r>n){const t=this.getClusters([r,i,180,o],e),a=this.getClusters([-180,i,n,o],e);return t.concat(a)}const a=this.trees[this._limitZoom(e)],s=a.range(C(r),M(o),C(n),M(i)),l=a.data,c=[];for(const t of s){const e=this.stride*t;c.push(l[e+5]>1?S(l,e,this.clusterProps):this.points[l[e+3]])}return c}getChildren(t){const e=this._getOriginId(t),r=this._getOriginZoom(t),i="No cluster with the specified id.",n=this.trees[r];if(!n)throw new Error(i);const o=n.data;if(e*this.stride>=o.length)throw new Error(i);const a=this.options.radius/(this.options.extent*Math.pow(2,r-1)),s=n.within(o[e*this.stride],o[e*this.stride+1],a),l=[];for(const e of s){const r=e*this.stride;o[r+4]===t&&l.push(o[r+5]>1?S(o,r,this.clusterProps):this.points[o[r+3]])}if(0===l.length)throw new Error(i);return l}getLeaves(t,e,r){const i=[];return this._appendLeaves(i,t,e=e||10,r=r||0,0),i}getTile(t,e,r){const i=this.trees[this._limitZoom(t)],n=Math.pow(2,t),{extent:o,radius:a}=this.options,s=a/o,l=(r-s)/n,c=(r+1+s)/n,h={features:[]};return this._addTileFeatures(i.range((e-s)/n,l,(e+1+s)/n,c),i.data,e,r,n,h),0===e&&this._addTileFeatures(i.range(1-s/n,l,1,c),i.data,n,r,n,h),e===n-1&&this._addTileFeatures(i.range(0,l,s/n,c),i.data,-1,r,n,h),h.features.length?h:null}getClusterExpansionZoom(t){let e=this._getOriginZoom(t)-1;for(;e<=this.options.maxZoom;){const r=this.getChildren(t);if(e++,1!==r.length)break;t=r[0].properties.cluster_id}return e}_appendLeaves(t,e,r,i,n){const o=this.getChildren(e);for(const e of o){const o=e.properties;if(o&&o.cluster?n+o.point_count<=i?n+=o.point_count:n=this._appendLeaves(t,o.cluster_id,r,i,n):n<i?n++:t.push(e),t.length===r)break}return n}_createTree(e){const r=new t.aI(e.length/this.stride|0,this.options.nodeSize,Float32Array);for(let t=0;t<e.length;t+=this.stride)r.add(e[t],e[t+1]);return r.finish(),r.data=e,r}_addTileFeatures(t,e,r,i,n,o){for(const a of t){const t=a*this.stride,s=e[t+5]>1;let l,c,h;if(s)l=P(e,t,this.clusterProps),c=e[t],h=e[t+1];else{const r=this.points[e[t+3]];l=r.properties;const[i,n]=r.geometry.coordinates;c=C(i),h=M(n)}const u={type:1,geometry:[[Math.round(this.options.extent*(c*n-r)),Math.round(this.options.extent*(h*n-i))]],tags:l};let p;p=s||this.options.generateId?e[t+3]:this.points[e[t+3]].id,void 0!==p&&(u.id=p),o.features.push(u)}}_limitZoom(t){return Math.max(this.options.minZoom,Math.min(Math.floor(+t),this.options.maxZoom+1))}_cluster(t,e){const{radius:r,extent:i,reduce:n,minPoints:o}=this.options,a=r/(i*Math.pow(2,e)),s=t.data,l=[],c=this.stride;for(let r=0;r<s.length;r+=c){if(s[r+2]<=e)continue;s[r+2]=e;const i=s[r],h=s[r+1],u=t.within(s[r],s[r+1],a),p=s[r+5];let d=p;for(const t of u){const r=t*c;s[r+2]>e&&(d+=s[r+5])}if(d>p&&d>=o){let t,o=i*p,a=h*p,f=-1;const m=(r/c<<5)+(e+1)+this.points.length;for(const i of u){const l=i*c;if(s[l+2]<=e)continue;s[l+2]=e;const h=s[l+5];o+=s[l]*h,a+=s[l+1]*h,s[l+4]=m,n&&(t||(t=this._map(s,r,!0),f=this.clusterProps.length,this.clusterProps.push(t)),n(t,this._map(s,l)))}s[r+4]=m,l.push(o/d,a/d,1/0,m,-1,d),n&&l.push(f)}else{for(let t=0;t<c;t++)l.push(s[r+t]);if(d>1)for(const t of u){const r=t*c;if(!(s[r+2]<=e)){s[r+2]=e;for(let t=0;t<c;t++)l.push(s[r+t])}}}}return l}_getOriginId(t){return t-this.points.length>>5}_getOriginZoom(t){return(t-this.points.length)%32}_map(t,e,r){if(t[e+5]>1){const i=this.clusterProps[t[e+6]];return r?Object.assign({},i):i}const i=this.points[t[e+3]].properties,n=this.options.map(i);return r&&n===i?Object.assign({},n):n}}function S(t,e,r){return{type:"Feature",id:t[e+3],properties:P(t,e,r),geometry:{type:"Point",coordinates:[(i=t[e],360*(i-.5)),A(t[e+1])]}};var i}function P(t,e,r){const i=t[e+5],n=i>=1e4?`${Math.round(i/1e3)}k`:i>=1e3?Math.round(i/100)/10+"k":i,o=t[e+6],a=-1===o?{}:Object.assign({},r[o]);return Object.assign(a,{cluster:!0,cluster_id:t[e+3],point_count:i,point_count_abbreviated:n})}function C(t){return t/360+.5}function M(t){const e=Math.sin(t*Math.PI/180),r=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return r<0?0:r>1?1:r}function A(t){const e=(180-360*t)*Math.PI/180;return 360*Math.atan(Math.exp(e))/Math.PI-90}function I(t,e,r,i){let n=i;const o=e+(r-e>>1);let a,s=r-e;const l=t[e],c=t[e+1],h=t[r],u=t[r+1];for(let i=e+3;i<r;i+=3){const e=E(t[i],t[i+1],l,c,h,u);if(e>n)a=i,n=e;else if(e===n){const t=Math.abs(i-o);t<s&&(a=i,s=t)}}n>i&&(a-e>3&&I(t,e,a,i),t[a+2]=n,r-a>3&&I(t,a,r,i))}function E(t,e,r,i,n,o){let a=n-r,s=o-i;if(0!==a||0!==s){const l=((t-r)*a+(e-i)*s)/(a*a+s*s);l>1?(r=n,i=o):l>0&&(r+=a*l,i+=s*l)}return a=t-r,s=e-i,a*a+s*s}function k(t,e,r,i){const n={id:null==t?null:t,type:e,geometry:r,tags:i,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if("Point"===e||"MultiPoint"===e||"LineString"===e)z(n,r);else if("Polygon"===e)z(n,r[0]);else if("MultiLineString"===e)for(const t of r)z(n,t);else if("MultiPolygon"===e)for(const t of r)z(n,t[0]);return n}function z(t,e){for(let r=0;r<e.length;r+=3)t.minX=Math.min(t.minX,e[r]),t.minY=Math.min(t.minY,e[r+1]),t.maxX=Math.max(t.maxX,e[r]),t.maxY=Math.max(t.maxY,e[r+1])}function R(t,e,r,i){if(!e.geometry)return;const n=e.geometry.coordinates;if(n&&0===n.length)return;const o=e.geometry.type,a=Math.pow(r.tolerance/((1<<r.maxZoom)*r.extent),2);let s=[],l=e.id;if(r.promoteId?l=e.properties[r.promoteId]:r.generateId&&(l=i||0),"Point"===o)D(n,s);else if("MultiPoint"===o)for(const t of n)D(t,s);else if("LineString"===o)L(n,s,a,!1);else if("MultiLineString"===o){if(r.lineMetrics){for(const r of n)s=[],L(r,s,a,!1),t.push(k(l,"LineString",s,e.properties));return}F(n,s,a,!1)}else if("Polygon"===o)F(n,s,a,!0);else{if("MultiPolygon"!==o){if("GeometryCollection"===o){for(const n of e.geometry.geometries)R(t,{id:l,geometry:n,properties:e.properties},r,i);return}throw new Error("Input data is not a valid GeoJSON object.")}for(const t of n){const e=[];F(t,e,a,!0),s.push(e)}}t.push(k(l,o,s,e.properties))}function D(t,e){e.push(B(t[0]),O(t[1]),0)}function L(t,e,r,i){let n,o,a=0;for(let r=0;r<t.length;r++){const s=B(t[r][0]),l=O(t[r][1]);e.push(s,l,0),r>0&&(a+=i?(n*l-s*o)/2:Math.sqrt(Math.pow(s-n,2)+Math.pow(l-o,2))),n=s,o=l}const s=e.length-3;e[2]=1,I(e,0,s,r),e[s+2]=1,e.size=Math.abs(a),e.start=0,e.end=e.size}function F(t,e,r,i){for(let n=0;n<t.length;n++){const o=[];L(t[n],o,r,i),e.push(o)}}function B(t){return t/360+.5}function O(t){const e=Math.sin(t*Math.PI/180),r=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return r<0?0:r>1?1:r}function j(t,e,r,i,n,o,a,s){if(i/=e,o>=(r/=e)&&a<i)return t;if(a<r||o>=i)return null;const l=[];for(const e of t){const t=e.geometry;let o=e.type;const a=0===n?e.minX:e.minY,c=0===n?e.maxX:e.maxY;if(a>=r&&c<i){l.push(e);continue}if(c<r||a>=i)continue;let h=[];if("Point"===o||"MultiPoint"===o)U(t,h,r,i,n);else if("LineString"===o)N(t,h,r,i,n,!1,s.lineMetrics);else if("MultiLineString"===o)$(t,h,r,i,n,!1);else if("Polygon"===o)$(t,h,r,i,n,!0);else if("MultiPolygon"===o)for(const e of t){const t=[];$(e,t,r,i,n,!0),t.length&&h.push(t)}if(h.length){if(s.lineMetrics&&"LineString"===o){for(const t of h)l.push(k(e.id,o,t,e.tags));continue}"LineString"!==o&&"MultiLineString"!==o||(1===h.length?(o="LineString",h=h[0]):o="MultiLineString"),"Point"!==o&&"MultiPoint"!==o||(o=3===h.length?"Point":"MultiPoint"),l.push(k(e.id,o,h,e.tags))}}return l.length?l:null}function U(t,e,r,i,n){for(let o=0;o<t.length;o+=3){const a=t[o+n];a>=r&&a<=i&&Z(e,t[o],t[o+1],t[o+2])}}function N(t,e,r,i,n,o,a){let s=V(t);const l=0===n?G:q;let c,h,u=t.start;for(let p=0;p<t.length-3;p+=3){const d=t[p],f=t[p+1],m=t[p+2],g=t[p+3],_=t[p+4],y=0===n?d:f,b=0===n?g:_;let v=!1;a&&(c=Math.sqrt(Math.pow(d-g,2)+Math.pow(f-_,2))),y<r?b>r&&(h=l(s,d,f,g,_,r),a&&(s.start=u+c*h)):y>i?b<i&&(h=l(s,d,f,g,_,i),a&&(s.start=u+c*h)):Z(s,d,f,m),b<r&&y>=r&&(h=l(s,d,f,g,_,r),v=!0),b>i&&y<=i&&(h=l(s,d,f,g,_,i),v=!0),!o&&v&&(a&&(s.end=u+c*h),e.push(s),s=V(t)),a&&(u+=c)}let p=t.length-3;const d=t[p],f=t[p+1],m=0===n?d:f;m>=r&&m<=i&&Z(s,d,f,t[p+2]),p=s.length-3,o&&p>=3&&(s[p]!==s[0]||s[p+1]!==s[1])&&Z(s,s[0],s[1],s[2]),s.length&&e.push(s)}function V(t){const e=[];return e.size=t.size,e.start=t.start,e.end=t.end,e}function $(t,e,r,i,n,o){for(const a of t)N(a,e,r,i,n,o,!1)}function Z(t,e,r,i){t.push(e,r,i)}function G(t,e,r,i,n,o){const a=(o-e)/(i-e);return Z(t,o,r+(n-r)*a,1),a}function q(t,e,r,i,n,o){const a=(o-r)/(n-r);return Z(t,e+(i-e)*a,o,1),a}function H(t,e){const r=[];for(let i=0;i<t.length;i++){const n=t[i],o=n.type;let a;if("Point"===o||"MultiPoint"===o||"LineString"===o)a=W(n.geometry,e);else if("MultiLineString"===o||"Polygon"===o){a=[];for(const t of n.geometry)a.push(W(t,e))}else if("MultiPolygon"===o){a=[];for(const t of n.geometry){const r=[];for(const i of t)r.push(W(i,e));a.push(r)}}r.push(k(n.id,o,a,n.tags))}return r}function W(t,e){const r=[];r.size=t.size,void 0!==t.start&&(r.start=t.start,r.end=t.end);for(let i=0;i<t.length;i+=3)r.push(t[i]+e,t[i+1],t[i+2]);return r}function X(t,e){if(t.transformed)return t;const r=1<<t.z,i=t.x,n=t.y;for(const o of t.features){const t=o.geometry,a=o.type;if(o.geometry=[],1===a)for(let a=0;a<t.length;a+=2)o.geometry.push(K(t[a],t[a+1],e,r,i,n));else for(let a=0;a<t.length;a++){const s=[];for(let o=0;o<t[a].length;o+=2)s.push(K(t[a][o],t[a][o+1],e,r,i,n));o.geometry.push(s)}}return t.transformed=!0,t}function K(t,e,r,i,n,o){return[Math.round(r*(t*i-n)),Math.round(r*(e*i-o))]}function Y(t,e,r,i,n){const o=e===n.maxZoom?0:n.tolerance/((1<<e)*n.extent),a={features:[],numPoints:0,numSimplified:0,numFeatures:t.length,source:null,x:r,y:i,z:e,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const e of t)J(a,e,o,n);return a}function J(t,e,r,i){const n=e.geometry,o=e.type,a=[];if(t.minX=Math.min(t.minX,e.minX),t.minY=Math.min(t.minY,e.minY),t.maxX=Math.max(t.maxX,e.maxX),t.maxY=Math.max(t.maxY,e.maxY),"Point"===o||"MultiPoint"===o)for(let e=0;e<n.length;e+=3)a.push(n[e],n[e+1]),t.numPoints++,t.numSimplified++;else if("LineString"===o)Q(a,n,t,r,!1,!1);else if("MultiLineString"===o||"Polygon"===o)for(let e=0;e<n.length;e++)Q(a,n[e],t,r,"Polygon"===o,0===e);else if("MultiPolygon"===o)for(let e=0;e<n.length;e++){const i=n[e];for(let e=0;e<i.length;e++)Q(a,i[e],t,r,!0,0===e)}if(a.length){let r=e.tags||null;if("LineString"===o&&i.lineMetrics){r={};for(const t in e.tags)r[t]=e.tags[t];r.mapbox_clip_start=n.start/n.size,r.mapbox_clip_end=n.end/n.size}const s={geometry:a,type:"Polygon"===o||"MultiPolygon"===o?3:"LineString"===o||"MultiLineString"===o?2:1,tags:r};null!==e.id&&(s.id=e.id),t.features.push(s)}}function Q(t,e,r,i,n,o){const a=i*i;if(i>0&&e.size<(n?a:i))return void(r.numPoints+=e.length/3);const s=[];for(let t=0;t<e.length;t+=3)(0===i||e[t+2]>a)&&(r.numSimplified++,s.push(e[t],e[t+1])),r.numPoints++;n&&function(t,e){let r=0;for(let e=0,i=t.length,n=i-2;e<i;n=e,e+=2)r+=(t[e]-t[n])*(t[e+1]+t[n+1]);if(r>0===e)for(let e=0,r=t.length;e<r/2;e+=2){const i=t[e],n=t[e+1];t[e]=t[r-2-e],t[e+1]=t[r-1-e],t[r-2-e]=i,t[r-1-e]=n}}(s,o),t.push(s)}const tt={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class et{constructor(t,e){const r=(e=this.options=function(t,e){for(const r in e)t[r]=e[r];return t}(Object.create(tt),e)).debug;if(r&&console.time("preprocess data"),e.maxZoom<0||e.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(e.promoteId&&e.generateId)throw new Error("promoteId and generateId cannot be used together.");let i=function(t,e){const r=[];if("FeatureCollection"===t.type)for(let i=0;i<t.features.length;i++)R(r,t.features[i],e,i);else R(r,"Feature"===t.type?t:{geometry:t},e);return r}(t,e);this.tiles={},this.tileCoords=[],r&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",e.indexMaxZoom,e.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),i=function(t,e){const r=e.buffer/e.extent;let i=t;const n=j(t,1,-1-r,r,0,-1,2,e),o=j(t,1,1-r,2+r,0,-1,2,e);return(n||o)&&(i=j(t,1,-r,1+r,0,-1,2,e)||[],n&&(i=H(n,1).concat(i)),o&&(i=i.concat(H(o,-1)))),i}(i,e),i.length&&this.splitTile(i,0,0,0),r&&(i.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)))}splitTile(t,e,r,i,n,o,a){const s=[t,e,r,i],l=this.options,c=l.debug;for(;s.length;){i=s.pop(),r=s.pop(),e=s.pop(),t=s.pop();const h=1<<e,u=rt(e,r,i);let p=this.tiles[u];if(!p&&(c>1&&console.time("creation"),p=this.tiles[u]=Y(t,e,r,i,l),this.tileCoords.push({z:e,x:r,y:i}),c)){c>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",e,r,i,p.numFeatures,p.numPoints,p.numSimplified),console.timeEnd("creation"));const t=`z${e}`;this.stats[t]=(this.stats[t]||0)+1,this.total++}if(p.source=t,null==n){if(e===l.indexMaxZoom||p.numPoints<=l.indexMaxPoints)continue}else{if(e===l.maxZoom||e===n)continue;if(null!=n){const t=n-e;if(r!==o>>t||i!==a>>t)continue}}if(p.source=null,0===t.length)continue;c>1&&console.time("clipping");const d=.5*l.buffer/l.extent,f=.5-d,m=.5+d,g=1+d;let _=null,y=null,b=null,v=null,x=j(t,h,r-d,r+m,0,p.minX,p.maxX,l),w=j(t,h,r+f,r+g,0,p.minX,p.maxX,l);t=null,x&&(_=j(x,h,i-d,i+m,1,p.minY,p.maxY,l),y=j(x,h,i+f,i+g,1,p.minY,p.maxY,l),x=null),w&&(b=j(w,h,i-d,i+m,1,p.minY,p.maxY,l),v=j(w,h,i+f,i+g,1,p.minY,p.maxY,l),w=null),c>1&&console.timeEnd("clipping"),s.push(_||[],e+1,2*r,2*i),s.push(y||[],e+1,2*r,2*i+1),s.push(b||[],e+1,2*r+1,2*i),s.push(v||[],e+1,2*r+1,2*i+1)}}getTile(t,e,r){t=+t,e=+e,r=+r;const i=this.options,{extent:n,debug:o}=i;if(t<0||t>24)return null;const a=1<<t,s=rt(t,e=e+a&a-1,r);if(this.tiles[s])return X(this.tiles[s],n);o>1&&console.log("drilling down to z%d-%d-%d",t,e,r);let l,c=t,h=e,u=r;for(;!l&&c>0;)c--,h>>=1,u>>=1,l=this.tiles[rt(c,h,u)];return l&&l.source?(o>1&&(console.log("found parent tile z%d-%d-%d",c,h,u),console.time("drilling down")),this.splitTile(l.source,c,h,u,t,e,r),o>1&&console.timeEnd("drilling down"),this.tiles[s]?X(this.tiles[s],n):null):null}}function rt(t,e,r){return 32*((1<<t)*r+e)+t}class it extends o{constructor(){super(...arguments),this._dataUpdateable=new Map}loadVectorTile(e,r){return t._(this,void 0,void 0,function*(){const r=e.tileID.canonical;if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");const i=this._geoJSONIndex.getTile(r.z,r.x,r.y);if(!i)return null;const n=new p(i.features,{version:2,extent:t.$});let o=function(e){const r=new t.cM;return function(t,e){for(const r in t.layers)e.writeMessage(3,d,t.layers[r])}(e,r),r.finish()}(n);return 0===o.byteOffset&&o.byteLength===o.buffer.byteLength||(o=new Uint8Array(o)),{vectorTile:n,rawData:o.buffer}})}loadData(e){return t._(this,void 0,void 0,function*(){var r;null===(r=this._pendingRequest)||void 0===r||r.abort();const i=!!(e&&e.request&&e.request.collectResourceTiming)&&new t.cN(e.request);this._pendingRequest=new AbortController;try{this._pendingData=this.loadAndProcessGeoJSON(e,this._pendingRequest);const r=yield this._pendingData;this._geoJSONIndex=e.cluster?new T(function({superclusterOptions:e,clusterProperties:r}){if(!r||!e)return e;const i={},n={},o={accumulated:null,zoom:0},a={properties:null},s=Object.keys(r);for(const e of s){const[o,a]=r[e],s=t.cT(a),l=t.cT("string"==typeof o?[o,["accumulated"],["get",e]]:o);i[e]=s.value,n[e]=l.value}return e.map=t=>{a.properties=t;const e={};for(const t of s)e[t]=i[t].evaluate(o,a);return e},e.reduce=(t,e)=>{a.properties=e;for(const e of s)o.accumulated=t[e],t[e]=n[e].evaluate(o,a)},e}(e)).load(r.features):function(t,e){return new et(t,e)}(r,e.geojsonVtOptions),this.loaded={};const n={data:r};if(i){const t=i.finish();t&&(n.resourceTiming={},n.resourceTiming[e.source]=JSON.parse(JSON.stringify(t)))}return n}catch(e){if(delete this._pendingRequest,t.cy(e))return{abandoned:!0};throw e}})}getData(){return t._(this,void 0,void 0,function*(){return this._pendingData})}reloadTile(t){const e=this.loaded;return e&&e[t.uid]?super.reloadTile(t):this.loadTile(t)}loadAndProcessGeoJSON(e,r){return t._(this,void 0,void 0,function*(){let i=yield this.loadGeoJSON(e,r);if(delete this._pendingRequest,"object"!=typeof i)throw new Error(`Input data given to '${e.source}' is not a valid GeoJSON object.`);if(h(i,!0),e.filter){const r=t.cT(e.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if("error"===r.result)throw new Error(r.value.map(t=>`${t.key}: ${t.message}`).join(", "));const n=i.features.filter(t=>r.value.evaluate({zoom:0},t));i={type:"FeatureCollection",features:n}}return i})}loadGeoJSON(e,r){return t._(this,void 0,void 0,function*(){const{promoteId:i}=e;if(e.request){const n=yield t.j(e.request,r);return this._dataUpdateable=t.cV(n.data,i)?t.cU(n.data,i):void 0,n.data}if("string"==typeof e.data)try{const r=JSON.parse(e.data);return this._dataUpdateable=t.cV(r,i)?t.cU(r,i):void 0,r}catch(t){throw new Error(`Input data given to '${e.source}' is not a valid GeoJSON object.`)}if(!e.dataDiff)throw new Error(`Input data given to '${e.source}' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${e.source}`);return t.cW(this._dataUpdateable,e.dataDiff,i),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}})}removeSource(e){return t._(this,void 0,void 0,function*(){this._pendingRequest&&this._pendingRequest.abort()})}getClusterExpansionZoom(t){return this._geoJSONIndex.getClusterExpansionZoom(t.clusterId)}getClusterChildren(t){return this._geoJSONIndex.getChildren(t.clusterId)}getClusterLeaves(t){return this._geoJSONIndex.getLeaves(t.clusterId,t.limit,t.offset)}}class nt{constructor(e){this.self=e,this.actor=new t.J(e),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(t,e)=>{if(this.externalWorkerSourceTypes[t])throw new Error(`Worker source with name "${t}" already registered.`);this.externalWorkerSourceTypes[t]=e},this.self.addProtocol=t.cA,this.self.removeProtocol=t.cB,this.self.registerRTLTextPlugin=e=>{t.cX.setMethods(e)},this.actor.registerMessageHandler("LDT",(t,e)=>this._getDEMWorkerSource(t,e.source).loadTile(e)),this.actor.registerMessageHandler("RDT",(e,r)=>t._(this,void 0,void 0,function*(){this._getDEMWorkerSource(e,r.source).removeTile(r)})),this.actor.registerMessageHandler("GCEZ",(e,r)=>t._(this,void 0,void 0,function*(){return this._getWorkerSource(e,r.type,r.source).getClusterExpansionZoom(r)})),this.actor.registerMessageHandler("GCC",(e,r)=>t._(this,void 0,void 0,function*(){return this._getWorkerSource(e,r.type,r.source).getClusterChildren(r)})),this.actor.registerMessageHandler("GCL",(e,r)=>t._(this,void 0,void 0,function*(){return this._getWorkerSource(e,r.type,r.source).getClusterLeaves(r)})),this.actor.registerMessageHandler("LD",(t,e)=>this._getWorkerSource(t,e.type,e.source).loadData(e)),this.actor.registerMessageHandler("GD",(t,e)=>this._getWorkerSource(t,e.type,e.source).getData()),this.actor.registerMessageHandler("LT",(t,e)=>this._getWorkerSource(t,e.type,e.source).loadTile(e)),this.actor.registerMessageHandler("RT",(t,e)=>this._getWorkerSource(t,e.type,e.source).reloadTile(e)),this.actor.registerMessageHandler("AT",(t,e)=>this._getWorkerSource(t,e.type,e.source).abortTile(e)),this.actor.registerMessageHandler("RMT",(t,e)=>this._getWorkerSource(t,e.type,e.source).removeTile(e)),this.actor.registerMessageHandler("RS",(e,r)=>t._(this,void 0,void 0,function*(){if(!this.workerSources[e]||!this.workerSources[e][r.type]||!this.workerSources[e][r.type][r.source])return;const t=this.workerSources[e][r.type][r.source];delete this.workerSources[e][r.type][r.source],void 0!==t.removeSource&&t.removeSource(r)})),this.actor.registerMessageHandler("RM",e=>t._(this,void 0,void 0,function*(){delete this.layerIndexes[e],delete this.availableImages[e],delete this.workerSources[e],delete this.demWorkerSources[e]})),this.actor.registerMessageHandler("SR",(e,r)=>t._(this,void 0,void 0,function*(){this.referrer=r})),this.actor.registerMessageHandler("SRPS",(t,e)=>this._syncRTLPluginState(t,e)),this.actor.registerMessageHandler("IS",(e,r)=>t._(this,void 0,void 0,function*(){this.self.importScripts(r)})),this.actor.registerMessageHandler("SI",(t,e)=>this._setImages(t,e)),this.actor.registerMessageHandler("UL",(e,r)=>t._(this,void 0,void 0,function*(){this._getLayerIndex(e).update(r.layers,r.removedIds)})),this.actor.registerMessageHandler("SL",(e,r)=>t._(this,void 0,void 0,function*(){this._getLayerIndex(e).replace(r)}))}_setImages(e,r){return t._(this,void 0,void 0,function*(){this.availableImages[e]=r;for(const t in this.workerSources[e]){const i=this.workerSources[e][t];for(const t in i)i[t].availableImages=r}})}_syncRTLPluginState(e,r){return t._(this,void 0,void 0,function*(){return yield t.cX.syncState(r,this.self.importScripts)})}_getAvailableImages(t){let e=this.availableImages[t];return e||(e=[]),e}_getLayerIndex(t){let r=this.layerIndexes[t];return r||(r=this.layerIndexes[t]=new e),r}_getWorkerSource(t,e,r){if(this.workerSources[t]||(this.workerSources[t]={}),this.workerSources[t][e]||(this.workerSources[t][e]={}),!this.workerSources[t][e][r]){const i={sendAsync:(e,r)=>(e.targetMapId=t,this.actor.sendAsync(e,r))};switch(e){case"vector":this.workerSources[t][e][r]=new o(i,this._getLayerIndex(t),this._getAvailableImages(t));break;case"geojson":this.workerSources[t][e][r]=new it(i,this._getLayerIndex(t),this._getAvailableImages(t));break;default:this.workerSources[t][e][r]=new this.externalWorkerSourceTypes[e](i,this._getLayerIndex(t),this._getAvailableImages(t))}}return this.workerSources[t][e][r]}_getDEMWorkerSource(t,e){return this.demWorkerSources[t]||(this.demWorkerSources[t]={}),this.demWorkerSources[t][e]||(this.demWorkerSources[t][e]=new a),this.demWorkerSources[t][e]}}return t.i(self)&&(self.worker=new nt(self)),nt}),r("index",0,function(t,e){var r="5.7.0";function i(){var t=new e.A(4);return e.A!=Float32Array&&(t[1]=0,t[2]=0),t[0]=1,t[3]=1,t}let n,o;const a={now:"undefined"!=typeof performance&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frame(t,r,i){const n=requestAnimationFrame(t=>{o(),r(t)}),{unsubscribe:o}=e.s(t.signal,"abort",()=>{o(),cancelAnimationFrame(n),i(e.c())},!1)},frameAsync(t){return new Promise((e,r)=>{this.frame(t,e,r)})},getImageData(t,e=0){return this.getImageCanvasContext(t).getImageData(-e,-e,t.width+2*e,t.height+2*e)},getImageCanvasContext(t){const e=window.document.createElement("canvas"),r=e.getContext("2d",{willReadFrequently:!0});if(!r)throw new Error("failed to create canvas 2d context");return e.width=t.width,e.height=t.height,r.drawImage(t,0,0,t.width,t.height),r},resolveURL:t=>(n||(n=document.createElement("a")),n.href=t,n.href),hardwareConcurrency:"undefined"!=typeof navigator&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(null==o&&(o=matchMedia("(prefers-reduced-motion: reduce)")),o.matches)}};class s{static testProp(t){if(!s.docStyle)return t[0];for(let e=0;e<t.length;e++)if(t[e]in s.docStyle)return t[e];return t[0]}static create(t,e,r){const i=window.document.createElement(t);return void 0!==e&&(i.className=e),r&&r.appendChild(i),i}static createNS(t,e){return window.document.createElementNS(t,e)}static disableDrag(){s.docStyle&&s.selectProp&&(s.userSelect=s.docStyle[s.selectProp],s.docStyle[s.selectProp]="none")}static enableDrag(){s.docStyle&&s.selectProp&&(s.docStyle[s.selectProp]=s.userSelect)}static setTransform(t,e){t.style[s.transformProp]=e}static addEventListener(t,e,r,i={}){t.addEventListener(e,r,"passive"in i?i:i.capture)}static removeEventListener(t,e,r,i={}){t.removeEventListener(e,r,"passive"in i?i:i.capture)}static suppressClickInternal(t){t.preventDefault(),t.stopPropagation(),window.removeEventListener("click",s.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",s.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",s.suppressClickInternal,!0)},0)}static getScale(t){const e=t.getBoundingClientRect();return{x:e.width/t.offsetWidth||1,y:e.height/t.offsetHeight||1,boundingClientRect:e}}static getPoint(t,r,i){const n=r.boundingClientRect;return new e.P((i.clientX-n.left)/r.x-t.clientLeft,(i.clientY-n.top)/r.y-t.clientTop)}static mousePos(t,e){const r=s.getScale(t);return s.getPoint(t,r,e)}static touchPos(t,e){const r=[],i=s.getScale(t);for(let n=0;n<e.length;n++)r.push(s.getPoint(t,i,e[n]));return r}static mouseButton(t){return t.button}static remove(t){t.parentNode&&t.parentNode.removeChild(t)}static sanitize(t){const e=(new DOMParser).parseFromString(t,"text/html").body||document.createElement("body"),r=e.querySelectorAll("script");for(const t of r)t.remove();return s.clean(e),e.innerHTML}static isPossiblyDangerous(t,e){const r=e.replace(/\s+/g,"").toLowerCase();return!(!["src","href","xlink:href"].includes(t)||!r.includes("javascript:")&&!r.includes("data:"))||!!t.startsWith("on")||void 0}static clean(t){const e=t.children;for(const t of e)s.removeAttributes(t),s.clean(t)}static removeAttributes(t){for(const{name:e,value:r}of t.attributes)s.isPossiblyDangerous(e,r)&&t.removeAttribute(e)}}s.docStyle="undefined"!=typeof window&&window.document&&window.document.documentElement.style,s.selectProp=s.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),s.transformProp=s.testProp(["transform","WebkitTransform"]);const l={supported:!1,testSupport:function(t){!u&&h&&(p?d(t):c=t)}};let c,h,u=!1,p=!1;function d(t){const e=t.createTexture();t.bindTexture(t.TEXTURE_2D,e);try{if(t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,h),t.isContextLost())return;l.supported=!0}catch(t){}t.deleteTexture(e),u=!0}var f;"undefined"!=typeof document&&(h=document.createElement("img"),h.onload=()=>{c&&d(c),c=null,p=!0},h.onerror=()=>{u=!0,c=null},h.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),function(t){let r,i,n,o;t.resetRequestQueue=()=>{r=[],i=0,n=0,o={}},t.addThrottleControl=t=>{const e=n++;return o[e]=t,e},t.removeThrottleControl=t=>{delete o[t],s()},t.getImage=(t,i,n=!0)=>new Promise((o,a)=>{l.supported&&(t.headers||(t.headers={}),t.headers.accept="image/webp,*/*"),e.e(t,{type:"image"}),r.push({abortController:i,requestParameters:t,supportImageRefresh:n,state:"queued",onError:t=>{a(t)},onSuccess:t=>{o(t)}}),s()});const a=t=>e._(this,void 0,void 0,function*(){t.state="running";const{requestParameters:r,supportImageRefresh:n,onError:o,onSuccess:a,abortController:l}=t,h=!1===n&&!e.i(self)&&!e.g(r.url)&&(!r.headers||Object.keys(r.headers).reduce((t,e)=>t&&"accept"===e,!0));i++;const u=h?c(r,l):e.m(r,l);try{const r=yield u;delete t.abortController,t.state="completed",r.data instanceof HTMLImageElement||e.b(r.data)?a(r):r.data&&a({data:yield(p=r.data,"function"==typeof createImageBitmap?e.f(p):e.h(p)),cacheControl:r.cacheControl,expires:r.expires})}catch(e){delete t.abortController,o(e)}finally{i--,s()}var p}),s=()=>{const t=(()=>{for(const t of Object.keys(o))if(o[t]())return!0;return!1})()?e.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:e.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let e=i;e<t&&r.length>0;e++){const t=r.shift();t.abortController.signal.aborted?e--:a(t)}},c=(t,r)=>new Promise((i,n)=>{const o=new Image,a=t.url,s=t.credentials;s&&"include"===s?o.crossOrigin="use-credentials":(s&&"same-origin"===s||!e.d(a))&&(o.crossOrigin="anonymous"),r.signal.addEventListener("abort",()=>{o.src="",n(e.c())}),o.fetchPriority="high",o.onload=()=>{o.onerror=o.onload=null,i({data:o})},o.onerror=()=>{o.onerror=o.onload=null,r.signal.aborted||n(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."))},o.src=a})}(f||(f={})),f.resetRequestQueue();class m{constructor(t){this._transformRequestFn=null!=t?t:null}transformRequest(t,e){return this._transformRequestFn&&this._transformRequestFn(t,e)||{url:t}}setTransformRequest(t){this._transformRequestFn=t}}function g(t){const e=[];if("string"==typeof t)e.push({id:"default",url:t});else if(t&&t.length>0){const r=[];for(const{id:i,url:n}of t){const t=`${i}${n}`;-1===r.indexOf(t)&&(r.push(t),e.push({id:i,url:n}))}}return e}function _(t,e,r){try{const i=new URL(t);return i.pathname+=`${e}${r}`,i.toString()}catch(e){throw new Error(`Invalid sprite URL "${t}", must be absolute. Modify style specification directly or use TransformStyleFunction to correct the issue dynamically`)}}function y(t){const{userImage:e}=t;return!!(e&&e.render&&e.render())&&(t.data.replace(new Uint8Array(e.data.buffer)),!0)}class b extends e.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new e.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(t){if(this.loaded!==t&&(this.loaded=t,t)){for(const{ids:t,promiseResolve:e}of this.requestors)e(this._getImagesForIds(t));this.requestors=[]}}getImage(t){const r=this.images[t];if(r&&!r.data&&r.spriteData){const t=r.spriteData;r.data=new e.R({width:t.width,height:t.height},t.context.getImageData(t.x,t.y,t.width,t.height).data),r.spriteData=null}return r}addImage(t,e){if(this.images[t])throw new Error(`Image id ${t} already exist, use updateImage instead`);this._validate(t,e)&&(this.images[t]=e)}_validate(t,r){let i=!0;const n=r.data||r.spriteData;return this._validateStretch(r.stretchX,n&&n.width)||(this.fire(new e.k(new Error(`Image "${t}" has invalid "stretchX" value`))),i=!1),this._validateStretch(r.stretchY,n&&n.height)||(this.fire(new e.k(new Error(`Image "${t}" has invalid "stretchY" value`))),i=!1),this._validateContent(r.content,r)||(this.fire(new e.k(new Error(`Image "${t}" has invalid "content" value`))),i=!1),i}_validateStretch(t,e){if(!t)return!0;let r=0;for(const i of t){if(i[0]<r||i[1]<i[0]||e<i[1])return!1;r=i[1]}return!0}_validateContent(t,e){if(!t)return!0;if(4!==t.length)return!1;const r=e.spriteData,i=r&&r.width||e.data.width,n=r&&r.height||e.data.height;return!(t[0]<0||i<t[0]||t[1]<0||n<t[1]||t[2]<0||i<t[2]||t[3]<0||n<t[3]||t[2]<t[0]||t[3]<t[1])}updateImage(t,e,r=!0){const i=this.getImage(t);if(r&&(i.data.width!==e.data.width||i.data.height!==e.data.height))throw new Error(`size mismatch between old image (${i.data.width}x${i.data.height}) and new image (${e.data.width}x${e.data.height}).`);e.version=i.version+1,this.images[t]=e,this.updatedImages[t]=!0}removeImage(t){const e=this.images[t];delete this.images[t],delete this.patterns[t],e.userImage&&e.userImage.onRemove&&e.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(t){return new Promise((e,r)=>{let i=!0;if(!this.isLoaded())for(const e of t)this.images[e]||(i=!1);this.isLoaded()||i?e(this._getImagesForIds(t)):this.requestors.push({ids:t,promiseResolve:e})})}_getImagesForIds(t){const r={};for(const i of t){let t=this.getImage(i);t||(this.fire(new e.l("styleimagemissing",{id:i})),t=this.getImage(i)),t?r[i]={data:t.data.clone(),pixelRatio:t.pixelRatio,sdf:t.sdf,version:t.version,stretchX:t.stretchX,stretchY:t.stretchY,content:t.content,textFitWidth:t.textFitWidth,textFitHeight:t.textFitHeight,hasRenderCallback:Boolean(t.userImage&&t.userImage.render)}:e.w(`Image "${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(){const{width:t,height:e}=this.atlasImage;return{width:t,height:e}}getPattern(t){const r=this.patterns[t],i=this.getImage(t);if(!i)return null;if(r&&r.position.version===i.version)return r.position;if(r)r.position.version=i.version;else{const r={w:i.data.width+2,h:i.data.height+2,x:0,y:0},n=new e.I(r,i);this.patterns[t]={bin:r,position:n}}return this._updatePatternAtlas(),this.patterns[t].position}bind(t){const r=t.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new e.T(t,this.atlasImage,r.RGBA),this.atlasTexture.bind(r.LINEAR,r.CLAMP_TO_EDGE)}_updatePatternAtlas(){const t=[];for(const e in this.patterns)t.push(this.patterns[e].bin);const{w:r,h:i}=e.p(t),n=this.atlasImage;n.resize({width:r||1,height:i||1});for(const t in this.patterns){const{bin:r}=this.patterns[t],i=r.x+1,o=r.y+1,a=this.getImage(t).data,s=a.width,l=a.height;e.R.copy(a,n,{x:0,y:0},{x:i,y:o},{width:s,height:l}),e.R.copy(a,n,{x:0,y:l-1},{x:i,y:o-1},{width:s,height:1}),e.R.copy(a,n,{x:0,y:0},{x:i,y:o+l},{width:s,height:1}),e.R.copy(a,n,{x:s-1,y:0},{x:i-1,y:o},{width:1,height:l}),e.R.copy(a,n,{x:0,y:0},{x:i+s,y:o},{width:1,height:l})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(t){for(const r of t){if(this.callbackDispatchedThisFrame[r])continue;this.callbackDispatchedThisFrame[r]=!0;const t=this.getImage(r);t||e.w(`Image with ID: "${r}" was not found`),y(t)&&this.updateImage(r,t)}}}const v=1e20;function x(t,e,r,i,n,o,a,s,l){for(let c=e;c<e+i;c++)w(t,r*o+c,o,n,a,s,l);for(let c=r;c<r+n;c++)w(t,c*o+e,1,i,a,s,l)}function w(t,e,r,i,n,o,a){o[0]=0,a[0]=-v,a[1]=v,n[0]=t[e];for(let s=1,l=0,c=0;s<i;s++){n[s]=t[e+s*r];const i=s*s;do{const t=o[l];c=(n[s]-n[t]+i-t*t)/(s-t)/2}while(c<=a[l]&&--l>-1);l++,o[l]=s,a[l]=c,a[l+1]=v}for(let s=0,l=0;s<i;s++){for(;a[l+1]<s;)l++;const i=o[l],c=s-i;t[e+s*r]=n[i]+c*c}}class T{constructor(t,e,r){this.requestManager=t,this.localIdeographFontFamily=e,this.entries={},this.lang=r}setURL(t){this.url=t}getGlyphs(t){return e._(this,void 0,void 0,function*(){const e=[];for(const r in t)for(const i of t[r])e.push(this._getAndCacheGlyphsPromise(r,i));const r=yield Promise.all(e),i={};for(const{stack:t,id:e,glyph:n}of r)i[t]||(i[t]={}),i[t][e]=n&&{id:n.id,bitmap:n.bitmap.clone(),metrics:n.metrics};return i})}_getAndCacheGlyphsPromise(t,r){return e._(this,void 0,void 0,function*(){let e=this.entries[t];e||(e=this.entries[t]={glyphs:{},requests:{},ranges:{}});let i=e.glyphs[r];if(void 0!==i)return{stack:t,id:r,glyph:i};if(i=this._tinySDF(e,t,r),i)return e.glyphs[r]=i,{stack:t,id:r,glyph:i};const n=Math.floor(r/256);if(256*n>65535)throw new Error("glyphs > 65535 not supported");if(e.ranges[n])return{stack:t,id:r,glyph:i};if(!this.url)throw new Error("glyphsUrl is not set");if(!e.requests[n]){const r=T.loadGlyphRange(t,n,this.url,this.requestManager);e.requests[n]=r}const o=yield e.requests[n];for(const t in o)this._doesCharSupportLocalGlyph(+t)||(e.glyphs[+t]=o[+t]);return e.ranges[n]=!0,{stack:t,id:r,glyph:o[r]||null}})}_doesCharSupportLocalGlyph(t){return!!this.localIdeographFontFamily&&(/\p{Ideo}|\p{sc=Hang}|\p{sc=Hira}|\p{sc=Kana}/u.test(String.fromCodePoint(t))||e.u["CJK Unified Ideographs"](t)||e.u["Hangul Syllables"](t)||e.u.Hiragana(t)||e.u.Katakana(t)||e.u["CJK Symbols and Punctuation"](t)||e.u["Halfwidth and Fullwidth Forms"](t))}_tinySDF(t,r,i){const n=this.localIdeographFontFamily;if(!n)return;if(!this._doesCharSupportLocalGlyph(i))return;let o=t.tinySDF;if(!o){let e="400";/bold/i.test(r)?e="900":/medium/i.test(r)?e="500":/light/i.test(r)&&(e="200"),o=t.tinySDF=new T.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,lang:this.lang,fontFamily:n,fontWeight:e})}const a=o.draw(String.fromCharCode(i));return{id:i,bitmap:new e.q({width:a.width||60,height:a.height||60},a.data),metrics:{width:a.glyphWidth/2||24,height:a.glyphHeight/2||24,left:a.glyphLeft/2+.5||0,top:a.glyphTop/2-27.5||-8,advance:a.glyphAdvance/2||24,isDoubleResolution:!0}}}}T.loadGlyphRange=function(t,r,i,n){return e._(this,void 0,void 0,function*(){const o=256*r,a=o+255,s=n.transformRequest(i.replace("{fontstack}",t).replace("{range}",`${o}-${a}`),"Glyphs"),l=yield e.n(s,new AbortController);if(!l||!l.data)throw new Error(`Could not load glyph range. range: ${r}, ${o}-${a}`);const c={};for(const t of e.o(l.data))c[t.id]=t;return c})},T.TinySDF=class{constructor({fontSize:t=24,buffer:e=3,radius:r=8,cutoff:i=.25,fontFamily:n="sans-serif",fontWeight:o="normal",fontStyle:a="normal",lang:s=null}={}){this.buffer=e,this.cutoff=i,this.radius=r,this.lang=s;const l=this.size=t+4*e,c=this._createCanvas(l),h=this.ctx=c.getContext("2d",{willReadFrequently:!0});h.font=`${a} ${o} ${t}px ${n}`,h.textBaseline="alphabetic",h.textAlign="left",h.fillStyle="black",this.gridOuter=new Float64Array(l*l),this.gridInner=new Float64Array(l*l),this.f=new Float64Array(l),this.z=new Float64Array(l+1),this.v=new Uint16Array(l)}_createCanvas(t){const e=document.createElement("canvas");return e.width=e.height=t,e}draw(t){const{width:e,actualBoundingBoxAscent:r,actualBoundingBoxDescent:i,actualBoundingBoxLeft:n,actualBoundingBoxRight:o}=this.ctx.measureText(t),a=Math.ceil(r),s=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(o-n))),l=Math.min(this.size-this.buffer,a+Math.ceil(i)),c=s+2*this.buffer,h=l+2*this.buffer,u=Math.max(c*h,0),p=new Uint8ClampedArray(u),d={data:p,width:c,height:h,glyphWidth:s,glyphHeight:l,glyphTop:a,glyphLeft:0,glyphAdvance:e};if(0===s||0===l)return d;const{ctx:f,buffer:m,gridInner:g,gridOuter:_}=this;this.lang&&(f.lang=this.lang),f.clearRect(m,m,s,l),f.fillText(t,m,m+a);const y=f.getImageData(m,m,s,l);_.fill(v,0,u),g.fill(0,0,u);for(let t=0;t<l;t++)for(let e=0;e<s;e++){const r=y.data[4*(t*s+e)+3]/255;if(0===r)continue;const i=(t+m)*c+e+m;if(1===r)_[i]=0,g[i]=v;else{const t=.5-r;_[i]=t>0?t*t:0,g[i]=t<0?t*t:0}}x(_,0,0,c,h,c,this.f,this.v,this.z),x(g,m,m,s,l,c,this.f,this.v,this.z);for(let t=0;t<u;t++){const e=Math.sqrt(_[t])-Math.sqrt(g[t]);p[t]=Math.round(255-255*(e/this.radius+this.cutoff))}return d}};class S{constructor(){this.specification=e.v.light.position}possiblyEvaluate(t,r){return e.B(t.expression.evaluate(r))}interpolate(t,r,i){return{x:e.C.number(t.x,r.x,i),y:e.C.number(t.y,r.y,i),z:e.C.number(t.z,r.z,i)}}}let P;class C extends e.E{constructor(t){super(),P=P||new e.r({anchor:new e.D(e.v.light.anchor),position:new S,color:new e.D(e.v.light.color),intensity:new e.D(e.v.light.intensity)}),this._transitionable=new e.t(P),this.setLight(t),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(t,r={}){if(!this._validate(e.x,t,r))for(const e in t){const r=t[e];e.endsWith("-transition")?this._transitionable.setTransition(e.slice(0,-11),r):this._transitionable.setValue(e,r)}}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}_validate(t,r,i){return(!i||!1!==i.validate)&&e.y(this,t.call(e.z,{value:r,style:{glyphs:!0,sprite:!0},styleSpec:e.v}))}}const M=new e.r({"sky-color":new e.D(e.v.sky["sky-color"]),"horizon-color":new e.D(e.v.sky["horizon-color"]),"fog-color":new e.D(e.v.sky["fog-color"]),"fog-ground-blend":new e.D(e.v.sky["fog-ground-blend"]),"horizon-fog-blend":new e.D(e.v.sky["horizon-fog-blend"]),"sky-horizon-blend":new e.D(e.v.sky["sky-horizon-blend"]),"atmosphere-blend":new e.D(e.v.sky["atmosphere-blend"])});class A extends e.E{constructor(t){super(),this._transitionable=new e.t(M),this.setSky(t),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new e.F(0))}setSky(t,r={}){if(!this._validate(e.G,t,r)){t||(t={"sky-color":"transparent","horizon-color":"transparent","fog-color":"transparent","fog-ground-blend":1,"atmosphere-blend":0});for(const e in t){const r=t[e];e.endsWith("-transition")?this._transitionable.setTransition(e.slice(0,-11),r):this._transitionable.setValue(e,r)}}}getSky(){return this._transitionable.serialize()}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}_validate(t,r,i={}){return!1!==(null==i?void 0:i.validate)&&e.y(this,t.call(e.z,e.e({value:r,style:{glyphs:!0,sprite:!0},styleSpec:e.v})))}calculateFogBlendOpacity(t){return t<60?0:t<70?(t-60)/10:1}}class I{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){const r=t.join(",")+String(e);return this.dashEntry[r]||(this.dashEntry[r]=this.addDash(t,e)),this.dashEntry[r]}getDashRanges(t,e,r){const i=[];let n=t.length%2==1?-t[t.length-1]*r:0,o=t[0]*r,a=!0;i.push({left:n,right:o,isDash:a,zeroLength:0===t[0]});let s=t[0];for(let e=1;e<t.length;e++){a=!a;const l=t[e];n=s*r,s+=l,o=s*r,i.push({left:n,right:o,isDash:a,zeroLength:0===l})}return i}addRoundDash(t,e,r){const i=e/2;for(let e=-r;e<=r;e++){const n=this.width*(this.nextRow+r+e);let o=0,a=t[o];for(let s=0;s<this.width;s++){s/a.right>1&&(a=t[++o]);const l=Math.abs(s-a.left),c=Math.abs(s-a.right),h=Math.min(l,c);let u;const p=e/r*(i+1);if(a.isDash){const t=i-Math.abs(p);u=Math.sqrt(h*h+t*t)}else u=i-Math.sqrt(h*h+p*p);this.data[n+s]=Math.max(0,Math.min(255,u+128))}}}addRegularDash(t){for(let e=t.length-1;e>=0;--e){const r=t[e],i=t[e+1];r.zeroLength?t.splice(e,1):i&&i.isDash===r.isDash&&(i.left=r.left,t.splice(e,1))}const e=t[0],r=t[t.length-1];e.isDash===r.isDash&&(e.left=r.left-this.width,r.right=e.right+this.width);const i=this.width*this.nextRow;let n=0,o=t[n];for(let e=0;e<this.width;e++){e/o.right>1&&(o=t[++n]);const r=Math.abs(e-o.left),a=Math.abs(e-o.right),s=Math.min(r,a);this.data[i+e]=Math.max(0,Math.min(255,(o.isDash?s:-s)+128))}}addDash(t,r){const i=r?7:0,n=2*i+1;if(this.nextRow+n>this.height)return e.w("LineAtlas out of space"),null;let o=0;for(let e=0;e<t.length;e++)o+=t[e];if(0!==o){const e=this.width/o,n=this.getDashRanges(t,this.width,e);r?this.addRoundDash(n,e,i):this.addRegularDash(n)}const a={y:(this.nextRow+i+.5)/this.height,height:2*i/this.height,width:o};return this.nextRow+=n,this.dirty=!0,a}bind(t){const 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))}}const E="maplibre_preloaded_worker_pool";class k{constructor(){this.active={}}acquire(t){if(!this.workers)for(this.workers=[];this.workers.length<k.workerCount;)this.workers.push(new Worker(e.a.WORKER_URL));return this.active[t]=!0,this.workers.slice()}release(t){delete this.active[t],0===this.numActive()&&(this.workers.forEach(t=>{t.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[E]}numActive(){return Object.keys(this.active).length}}const z=Math.floor(a.hardwareConcurrency/2);let R,D;function L(){return R||(R=new k),R}k.workerCount=e.H(globalThis)?Math.max(Math.min(z,3),1):1;class F{constructor(t,r){this.workerPool=t,this.actors=[],this.currentActor=0,this.id=r;const i=this.workerPool.acquire(r);for(let t=0;t<i.length;t++){const n=new e.J(i[t],r);n.name=`Worker ${t}`,this.actors.push(n)}if(!this.actors.length)throw new Error("No actors found")}broadcast(t,e){const r=[];for(const 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(t=>{t.remove()}),this.actors=[],t&&this.workerPool.release(this.id)}registerMessageHandler(t,e){for(const r of this.actors)r.registerMessageHandler(t,e)}}function B(){return D||(D=new F(L(),e.K),D.registerMessageHandler("GR",(t,r,i)=>e.m(r,i))),D}function O(t,r){const i=e.L();return e.M(i,i,[1,1,0]),e.N(i,i,[.5*t.width,.5*t.height,1]),t.calculatePosMatrix?e.O(i,i,t.calculatePosMatrix(r.toUnwrapped())):i}function j(t,e,r,i,n,o,a){var s;const l=function(t,e,r){if(t)for(const i of t){const t=e[i];if(t&&t.source===r&&"fill-extrusion"===t.type)return!0}else for(const t in e){const i=e[t];if(i.source===r&&"fill-extrusion"===i.type)return!0}return!1}(null!==(s=null==n?void 0:n.layers)&&void 0!==s?s:null,e,t.id),c=o.maxPitchScaleFactor(),h=t.tilesIn(i,c,l);h.sort(U);const u=[];for(const i of h)u.push({wrappedTileID:i.tileID.wrapped().key,queryResults:i.tile.queryRenderedFeatures(e,r,t._state,i.queryGeometry,i.cameraQueryGeometry,i.scale,n,o,c,O(t.transform,i.tileID),a?(t,e)=>a(i.tileID,t,e):void 0)});return function(t,e){for(const r in t)for(const i of t[r])N(i,e);return t}(function(t){const e={},r={};for(const i of t){const t=i.queryResults,n=i.wrappedTileID,o=r[n]=r[n]||{};for(const r in t){const i=t[r],n=o[r]=o[r]||{},a=e[r]=e[r]||[];for(const t of i)n[t.featureIndex]||(n[t.featureIndex]=!0,a.push(t))}}return e}(u),t)}function U(t,e){const r=t.tileID,i=e.tileID;return r.overscaledZ-i.overscaledZ||r.canonical.y-i.canonical.y||r.wrap-i.wrap||r.canonical.x-i.canonical.x}function N(t,e){const r=t.feature,i=e.getFeatureState(r.layer["source-layer"],r.id);r.source=r.layer.source,r.layer["source-layer"]&&(r.sourceLayer=r.layer["source-layer"]),r.state=i}function V(t,r,i){return e._(this,void 0,void 0,function*(){let n=t;if(t.url?n=(yield e.j(r.transformRequest(t.url,"Source"),i)).data:yield a.frameAsync(i),!n)return null;const o=e.Q(e.e(n,t),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in n&&n.vector_layers&&(o.vectorLayerIds=n.vector_layers.map(t=>t.id)),o})}class ${constructor(t,e){t&&(e?this.setSouthWest(t).setNorthEast(e):Array.isArray(t)&&(4===t.length?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 e.S?new e.S(t.lng,t.lat):e.S.convert(t),this}setSouthWest(t){return this._sw=t instanceof e.S?new e.S(t.lng,t.lat):e.S.convert(t),this}extend(t){const r=this._sw,i=this._ne;let n,o;if(t instanceof e.S)n=t,o=t;else{if(!(t instanceof $))return Array.isArray(t)?4===t.length||t.every(Array.isArray)?this.extend($.convert(t)):this.extend(e.S.convert(t)):t&&("lng"in t||"lon"in t)&&"lat"in t?this.extend(e.S.convert(t)):this;if(n=t._sw,o=t._ne,!n||!o)return this}return r||i?(r.lng=Math.min(n.lng,r.lng),r.lat=Math.min(n.lat,r.lat),i.lng=Math.max(o.lng,i.lng),i.lat=Math.max(o.lat,i.lat)):(this._sw=new e.S(n.lng,n.lat),this._ne=new e.S(o.lng,o.lat)),this}getCenter(){return new e.S((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 e.S(this.getWest(),this.getNorth())}getSouthEast(){return new e.S(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(t){const{lng:r,lat:i}=e.S.convert(t);let n=this._sw.lng<=r&&r<=this._ne.lng;return this._sw.lng>this._ne.lng&&(n=this._sw.lng>=r&&r>=this._ne.lng),this._sw.lat<=i&&i<=this._ne.lat&&n}static convert(t){return t instanceof $?t:t?new $(t):t}static fromLngLat(t,r=0){const i=360*r/40075017,n=i/Math.cos(Math.PI/180*t.lat);return new $(new e.S(t.lng-n,t.lat-i),new e.S(t.lng+n,t.lat+i))}adjustAntiMeridian(){const t=new e.S(this._sw.lng,this._sw.lat),r=new e.S(this._ne.lng,this._ne.lat);return new $(t,t.lng>r.lng?new e.S(r.lng+360,r.lat):r)}}class Z{constructor(t,e,r){this.bounds=$.convert(this.validateBounds(t)),this.minzoom=e||0,this.maxzoom=r||24}validateBounds(t){return Array.isArray(t)&&4===t.length?[Math.max(-180,t[0]),Math.max(-90,t[1]),Math.min(180,t[2]),Math.min(90,t[3])]:[-180,-90,180,90]}contains(t){const r=Math.pow(2,t.z),i=Math.floor(e.V(this.bounds.getWest())*r),n=Math.floor(e.U(this.bounds.getNorth())*r),o=Math.ceil(e.V(this.bounds.getEast())*r),a=Math.ceil(e.U(this.bounds.getSouth())*r);return t.x>=i&&t.x<o&&t.y>=n&&t.y<a}}class G extends e.E{constructor(t,r,i,n){if(super(),this.id=t,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,e.e(this,e.Q(r,["url","scheme","tileSize","promoteId"])),this._options=e.e({type:"vector"},r),this._collectResourceTiming=r.collectResourceTiming,512!==this.tileSize)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(n)}load(){return e._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new e.l("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const t=yield V(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),t&&(e.e(this,t),t.bounds&&(this.tileBounds=new Z(t.bounds,this.minzoom,this.maxzoom)),this.fire(new e.l("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new e.l("data",{dataType:"source",sourceDataType:"content"})))}catch(t){this._tileJSONRequest=null,this.fire(new e.k(t))}})}loaded(){return this._loaded}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}onAdd(t){this.map=t,this.load()}setSourceProperty(t){this._tileJSONRequest&&this._tileJSONRequest.abort(),t(),this.load()}setTiles(t){return this.setSourceProperty(()=>{this._options.tiles=t}),this}setUrl(t){return this.setSourceProperty(()=>{this.url=t,this._options.url=t}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return e.e({},this._options)}loadTile(t){return e._(this,void 0,void 0,function*(){const e=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),r={request:this.map._requestManager.transformRequest(e,"Tile"),uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,tileSize:this.tileSize*t.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity,globalState:this.map.getGlobalState()};r.request.collectResourceTiming=this._collectResourceTiming;let i="RT";if(t.actor&&"expired"!==t.state){if("loading"===t.state)return new Promise((e,r)=>{t.reloadPromise={resolve:e,reject:r}})}else t.actor=this.dispatcher.getActor(),i="LT";t.abortController=new AbortController;try{const e=yield t.actor.sendAsync({type:i,data:r},t.abortController);if(delete t.abortController,t.aborted)return;this._afterTileLoadWorkerResponse(t,e)}catch(e){if(delete t.abortController,t.aborted)return;if(e&&404!==e.status)throw e;this._afterTileLoadWorkerResponse(t,null)}})}_afterTileLoadWorkerResponse(t,e){if(e&&e.resourceTiming&&(t.resourceTiming=e.resourceTiming),e&&this.map._refreshExpiredTiles&&t.setExpiryData(e),t.loadVectorData(e,this.map.painter),t.reloadPromise){const e=t.reloadPromise;t.reloadPromise=null,this.loadTile(t).then(e.resolve).catch(e.reject)}}abortTile(t){return e._(this,void 0,void 0,function*(){t.abortController&&(t.abortController.abort(),delete t.abortController),t.actor&&(yield t.actor.sendAsync({type:"AT",data:{uid:t.uid,type:this.type,source:this.id}}))})}unloadTile(t){return e._(this,void 0,void 0,function*(){t.unloadVectorData(),t.actor&&(yield t.actor.sendAsync({type:"RMT",data:{uid:t.uid,type:this.type,source:this.id}}))})}hasTransition(){return!1}}class q extends e.E{constructor(t,r,i,n){super(),this.id=t,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=e.e({type:"raster"},r),e.e(this,e.Q(r,["url","scheme","tileSize"]))}load(){return e._(this,arguments,void 0,function*(t=!1){this._loaded=!1,this.fire(new e.l("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const r=yield V(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,r&&(e.e(this,r),r.bounds&&(this.tileBounds=new Z(r.bounds,this.minzoom,this.maxzoom)),this.fire(new e.l("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new e.l("data",{dataType:"source",sourceDataType:"content",sourceDataChanged:t})))}catch(t){this._tileJSONRequest=null,this.fire(new e.k(t))}})}loaded(){return this._loaded}onAdd(t){this.map=t,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(t){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),t(),this.load(!0)}setTiles(t){return this.setSourceProperty(()=>{this._options.tiles=t}),this}setUrl(t){return this.setSourceProperty(()=>{this.url=t,this._options.url=t}),this}serialize(){return e.e({},this._options)}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}loadTile(t){return e._(this,void 0,void 0,function*(){const r=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);t.abortController=new AbortController;try{const i=yield f.getImage(this.map._requestManager.transformRequest(r,"Tile"),t.abortController,this.map._refreshExpiredTiles);if(delete t.abortController,t.aborted)return void(t.state="unloaded");if(i&&i.data){this.map._refreshExpiredTiles&&(i.cacheControl||i.expires)&&t.setExpiryData({cacheControl:i.cacheControl,expires:i.expires});const r=this.map.painter.context,n=r.gl,o=i.data;t.texture=this.map.painter.getTileTexture(o.width),t.texture?t.texture.update(o,{useMipmap:!0}):(t.texture=new e.T(r,o,n.RGBA,{useMipmap:!0}),t.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE,n.LINEAR_MIPMAP_NEAREST)),t.state="loaded"}}catch(e){if(delete t.abortController,t.aborted)t.state="unloaded";else if(e)throw t.state="errored",e}})}abortTile(t){return e._(this,void 0,void 0,function*(){t.abortController&&(t.abortController.abort(),delete t.abortController)})}unloadTile(t){return e._(this,void 0,void 0,function*(){t.texture&&this.map.painter.saveTileTexture(t.texture)})}hasTransition(){return!1}}class H extends q{constructor(t,r,i,n){super(t,r,i,n),this.type="raster-dem",this.maxzoom=22,this._options=e.e({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}loadTile(t){return e._(this,void 0,void 0,function*(){const r=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),i=this.map._requestManager.transformRequest(r,"Tile");t.neighboringTiles=this._getNeighboringTiles(t.tileID),t.abortController=new AbortController;try{const r=yield f.getImage(i,t.abortController,this.map._refreshExpiredTiles);if(delete t.abortController,t.aborted)return void(t.state="unloaded");if(r&&r.data){const i=r.data;this.map._refreshExpiredTiles&&(r.cacheControl||r.expires)&&t.setExpiryData({cacheControl:r.cacheControl,expires:r.expires});const n=e.b(i)&&e.W()?i:yield this.readImageNow(i),o={type:this.type,uid:t.uid,source:this.id,rawImageData:n,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!t.actor||"expired"===t.state){t.actor=this.dispatcher.getActor();const e=yield t.actor.sendAsync({type:"LDT",data:o});t.dem=e,t.needsHillshadePrepare=!0,t.needsTerrainPrepare=!0,t.state="loaded"}}}catch(e){if(delete t.abortController,t.aborted)t.state="unloaded";else if(e)throw t.state="errored",e}})}readImageNow(t){return e._(this,void 0,void 0,function*(){if("undefined"!=typeof VideoFrame&&e.X()){const r=t.width+2,i=t.height+2;try{return new e.R({width:r,height:i},yield e.Y(t,-1,-1,r,i))}catch(t){}}return a.getImageData(t,1)})}_getNeighboringTiles(t){const r=t.canonical,i=Math.pow(2,r.z),n=(r.x-1+i)%i,o=0===r.x?t.wrap-1:t.wrap,a=(r.x+1+i)%i,s=r.x+1===i?t.wrap+1:t.wrap,l={};return l[new e.Z(t.overscaledZ,o,r.z,n,r.y).key]={backfilled:!1},l[new e.Z(t.overscaledZ,s,r.z,a,r.y).key]={backfilled:!1},r.y>0&&(l[new e.Z(t.overscaledZ,o,r.z,n,r.y-1).key]={backfilled:!1},l[new e.Z(t.overscaledZ,t.wrap,r.z,r.x,r.y-1).key]={backfilled:!1},l[new e.Z(t.overscaledZ,s,r.z,a,r.y-1).key]={backfilled:!1}),r.y+1<i&&(l[new e.Z(t.overscaledZ,o,r.z,n,r.y+1).key]={backfilled:!1},l[new e.Z(t.overscaledZ,t.wrap,r.z,r.x,r.y+1).key]={backfilled:!1},l[new e.Z(t.overscaledZ,s,r.z,a,r.y+1).key]={backfilled:!1}),l}unloadTile(t){return e._(this,void 0,void 0,function*(){t.demTexture&&this.map.painter.saveTileTexture(t.demTexture),t.fbo&&(t.fbo.destroy(),delete t.fbo),t.dem&&delete t.dem,delete t.neighboringTiles,t.state="unloaded",t.actor&&(yield t.actor.sendAsync({type:"RDT",data:{type:this.type,uid:t.uid,source:this.id}}))})}}class W extends e.E{constructor(t,r,i,n){super(),this.id=t,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._isUpdatingWorker=!1,this._pendingWorkerUpdate={data:r.data},this.actor=i.getActor(),this.setEventedParent(n),this._data=r.data,this._options=e.e({},r),this._collectResourceTiming=r.collectResourceTiming,void 0!==r.maxzoom&&(this.maxzoom=r.maxzoom),r.type&&(this.type=r.type),r.attribution&&(this.attribution=r.attribution),this.promoteId=r.promoteId,void 0!==r.clusterMaxZoom&&this.maxzoom<=r.clusterMaxZoom&&e.w(`The maxzoom value "${this.maxzoom}" is expected to be greater than the clusterMaxZoom value "${r.clusterMaxZoom}".`),this.workerOptions=e.e({source:this.id,cluster:r.cluster||!1,geojsonVtOptions:{buffer:this._pixelsToTileUnits(void 0!==r.buffer?r.buffer:128),tolerance:this._pixelsToTileUnits(void 0!==r.tolerance?r.tolerance:.375),extent:e.$,maxZoom:this.maxzoom,lineMetrics:r.lineMetrics||!1,generateId:r.generateId||!1},superclusterOptions:{maxZoom:this._getClusterMaxZoom(r.clusterMaxZoom),minPoints:Math.max(2,r.clusterMinPoints||2),extent:e.$,radius:this._pixelsToTileUnits(r.clusterRadius||50),log:!1,generateId:r.generateId||!1},clusterProperties:r.clusterProperties,filter:r.filter},r.workerOptions),"string"==typeof this.promoteId&&(this.workerOptions.promoteId=this.promoteId)}_pixelsToTileUnits(t){return t*(e.$/this.tileSize)}_getClusterMaxZoom(t){const r=t?Math.round(t):this.maxzoom-1;return Number.isInteger(t)||void 0===t||e.w(`Integer expected for option 'clusterMaxZoom': provided value "${t}" rounded to "${r}"`),r}load(){return e._(this,void 0,void 0,function*(){yield this._updateWorkerData()})}onAdd(t){this.map=t,this.load()}setData(t){return this._data=t,this._pendingWorkerUpdate={data:t},this._updateWorkerData(),this}updateData(t){return this._pendingWorkerUpdate.diff=e.a0(this._pendingWorkerUpdate.diff,t),this._updateWorkerData(),this}getData(){return e._(this,void 0,void 0,function*(){const t=e.e({type:this.type},this.workerOptions);return this.actor.sendAsync({type:"GD",data:t})})}getCoordinatesFromGeometry(t){return"GeometryCollection"===t.type?t.geometries.map(t=>t.coordinates).flat(1/0):t.coordinates.flat(1/0)}getBounds(){return e._(this,void 0,void 0,function*(){const t=new $,e=yield this.getData();let r;switch(e.type){case"FeatureCollection":r=e.features.map(t=>this.getCoordinatesFromGeometry(t.geometry)).flat(1/0);break;case"Feature":r=this.getCoordinatesFromGeometry(e.geometry);break;default:r=this.getCoordinatesFromGeometry(e)}if(0==r.length)return t;for(let e=0;e<r.length-1;e+=2)t.extend([r[e],r[e+1]]);return t})}setClusterOptions(t){return this.workerOptions.cluster=t.cluster,t&&(void 0!==t.clusterRadius&&(this.workerOptions.superclusterOptions.radius=this._pixelsToTileUnits(t.clusterRadius)),void 0!==t.clusterMaxZoom&&(this.workerOptions.superclusterOptions.maxZoom=this._getClusterMaxZoom(t.clusterMaxZoom))),this._updateWorkerData(),this}getClusterExpansionZoom(t){return this.actor.sendAsync({type:"GCEZ",data:{type:this.type,clusterId:t,source:this.id}})}getClusterChildren(t){return this.actor.sendAsync({type:"GCC",data:{type:this.type,clusterId:t,source:this.id}})}getClusterLeaves(t,e,r){return this.actor.sendAsync({type:"GCL",data:{type:this.type,source:this.id,clusterId:t,limit:e,offset:r}})}_updateWorkerData(){return e._(this,void 0,void 0,function*(){if(this._isUpdatingWorker)return;const{data:t,diff:r}=this._pendingWorkerUpdate;if(!t&&!r)return void e.w(`No data or diff provided to GeoJSONSource ${this.id}.`);const i=e.e({type:this.type},this.workerOptions);t?("string"==typeof t?(i.request=this.map._requestManager.transformRequest(a.resolveURL(t),"Source"),i.request.collectResourceTiming=this._collectResourceTiming):i.data=JSON.stringify(t),this._pendingWorkerUpdate.data=void 0):r&&(i.dataDiff=r,this._pendingWorkerUpdate.diff=void 0),this._isUpdatingWorker=!0,this.fire(new e.l("dataloading",{dataType:"source"}));try{const t=yield this.actor.sendAsync({type:"LD",data:i});if(this._isUpdatingWorker=!1,this._removed||t.abandoned)return void this.fire(new e.l("dataabort",{dataType:"source"}));this._data=t.data;let r=null;t.resourceTiming&&t.resourceTiming[this.id]&&(r=t.resourceTiming[this.id].slice(0));const n={dataType:"source"};this._collectResourceTiming&&r&&r.length>0&&e.e(n,{resourceTiming:r}),this.fire(new e.l("data",Object.assign(Object.assign({},n),{sourceDataType:"metadata"}))),this.fire(new e.l("data",Object.assign(Object.assign({},n),{sourceDataType:"content"})))}catch(t){if(this._isUpdatingWorker=!1,this._removed)return void this.fire(new e.l("dataabort",{dataType:"source"}));this.fire(new e.k(t))}finally{(this._pendingWorkerUpdate.data||this._pendingWorkerUpdate.diff)&&this._updateWorkerData()}})}loaded(){return!this._isUpdatingWorker&&void 0===this._pendingWorkerUpdate.data&&void 0===this._pendingWorkerUpdate.diff}loadTile(t){return e._(this,void 0,void 0,function*(){const e=t.actor?"RT":"LT";t.actor=this.actor;const r={type:this.type,uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity,globalState:this.map.getGlobalState()};t.abortController=new AbortController;const i=yield this.actor.sendAsync({type:e,data:r},t.abortController);delete t.abortController,t.unloadVectorData(),t.aborted||t.loadVectorData(i,this.map.painter,"RT"===e)})}abortTile(t){return e._(this,void 0,void 0,function*(){t.abortController&&(t.abortController.abort(),delete t.abortController),t.aborted=!0})}unloadTile(t){return e._(this,void 0,void 0,function*(){t.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:t.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 e.e({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}class X extends e.E{constructor(t,e,r,i){super(),this.flippedWindingOrder=!1,this.id=t,this.dispatcher=r,this.coordinates=e.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(i),this.options=e}load(t){return e._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new e.l("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{const e=yield f.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,e&&e.data&&(this.image=e.data,t&&(this.coordinates=t),this._finishLoading())}catch(t){this._request=null,this._loaded=!0,this.fire(new e.k(t))}})}loaded(){return this._loaded}updateImage(t){return t.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=t.url,this.load(t.coordinates).finally(()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new e.l("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(t){this.map=t,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(t){this.coordinates=t;const r=t.map(e.a1.fromLngLat);var i;return this.tileID=function(t){const r=e.a2.fromPoints(t),i=r.width(),n=r.height(),o=Math.max(i,n),a=Math.max(0,Math.floor(-Math.log(o)/Math.LN2)),s=Math.pow(2,a);return new e.a4(a,Math.floor((r.minX+r.maxX)/2*s),Math.floor((r.minY+r.maxY)/2*s))}(r),this.terrainTileRanges=this._getOverlappingTileRanges(r),this.minzoom=this.maxzoom=this.tileID.z,this.tileCoords=r.map(t=>this.tileID.getTilePoint(t)._round()),this.flippedWindingOrder=((i=this.tileCoords)[1].x-i[0].x)*(i[2].y-i[0].y)-(i[1].y-i[0].y)*(i[2].x-i[0].x)<0,this.fire(new e.l("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(0===Object.keys(this.tiles).length||!this.image)return;const t=this.map.painter.context,r=t.gl;this.texture||(this.texture=new e.T(t,this.image,r.RGBA),this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE));let i=!1;for(const t in this.tiles){const e=this.tiles[t];"loaded"!==e.state&&(e.state="loaded",e.texture=this.texture,i=!0)}i&&this.fire(new e.l("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(t){return e._(this,void 0,void 0,function*(){this.tileID&&this.tileID.equals(t.tileID.canonical)?(this.tiles[String(t.tileID.wrap)]=t,t.buckets={}):t.state="errored"})}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}_getOverlappingTileRanges(t){const{minX:r,minY:i,maxX:n,maxY:o}=e.a2.fromPoints(t),a={};for(let t=0;t<=e.a3;t++){const e=Math.pow(2,t),s=Math.floor(r*e),l=Math.floor(i*e),c=Math.floor(n*e),h=Math.floor(o*e);a[t]={minTileX:s,minTileY:l,maxTileX:c,maxTileY:h}}return a}}class K extends X{constructor(t,e,r,i){super(t,e,r,i),this.roundZoom=!0,this.type="video",this.options=e}load(){return e._(this,void 0,void 0,function*(){this._loaded=!1;const t=this.options;this.urls=[];for(const e of t.urls)this.urls.push(this.map._requestManager.transformRequest(e,"Source").url);try{const t=yield e.a5(this.urls);if(this._loaded=!0,!t)return;this.video=t,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading()}catch(t){this.fire(new e.k(t))}})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(t){if(this.video){const r=this.video.seekable;t<r.start(0)||t>r.end(0)?this.fire(new e.k(new e.a6(`sources.${this.id}`,null,`Playback for this video can be set only between the ${r.start(0)} and ${r.end(0)}-second mark.`))):this.video.currentTime=t}}getVideo(){return this.video}onAdd(t){this.map||(this.map=t,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(0===Object.keys(this.tiles).length||this.video.readyState<2)return;const t=this.map.painter.context,r=t.gl;this.texture?this.video.paused||(this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE),r.texSubImage2D(r.TEXTURE_2D,0,0,0,r.RGBA,r.UNSIGNED_BYTE,this.video)):(this.texture=new e.T(t,this.video,r.RGBA),this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE));let i=!1;for(const t in this.tiles){const e=this.tiles[t];"loaded"!==e.state&&(e.state="loaded",e.texture=this.texture,i=!0)}i&&this.fire(new e.l("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}}class Y extends X{constructor(t,r,i,n){super(t,r,i,n),r.coordinates?Array.isArray(r.coordinates)&&4===r.coordinates.length&&!r.coordinates.some(t=>!Array.isArray(t)||2!==t.length||t.some(t=>"number"!=typeof t))||this.fire(new e.k(new e.a6(`sources.${t}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new e.k(new e.a6(`sources.${t}`,null,'missing required property "coordinates"'))),r.animate&&"boolean"!=typeof r.animate&&this.fire(new e.k(new e.a6(`sources.${t}`,null,'optional "animate" property must be a boolean value'))),r.canvas?"string"==typeof r.canvas||r.canvas instanceof HTMLCanvasElement||this.fire(new e.k(new e.a6(`sources.${t}`,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 e.k(new e.a6(`sources.${t}`,null,'missing required property "canvas"'))),this.options=r,this.animate=void 0===r.animate||r.animate}load(){return e._(this,void 0,void 0,function*(){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 e.k(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())})}getCanvas(){return this.canvas}onAdd(t){this.map=t,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let t=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,t=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,t=!0),this._hasInvalidDimensions())return;if(0===Object.keys(this.tiles).length)return;const r=this.map.painter.context,i=r.gl;this.texture?(t||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new e.T(r,this.canvas,i.RGBA,{premultiply:!0});let n=!1;for(const t in this.tiles){const e=this.tiles[t];"loaded"!==e.state&&(e.state="loaded",e.texture=this.texture,n=!0)}n&&this.fire(new e.l("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const t of[this.canvas.width,this.canvas.height])if(isNaN(t)||t<=0)return!0;return!1}}const J={},Q=t=>{switch(t){case"geojson":return W;case"image":return X;case"raster":return q;case"raster-dem":return H;case"vector":return G;case"video":return K;case"canvas":return Y}return J[t]},tt="RTLPluginLoaded";class et extends e.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=B()}_syncState(t){return this.status=t,this.dispatcher.broadcast("SRPS",{pluginStatus:t,pluginURL:this.url}).catch(t=>{throw this.status="error",t})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(t){return e._(this,arguments,void 0,function*(t,e=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=a.resolveURL(t),!this.url)throw new Error(`requested url ${t} is invalid`);if("unavailable"===this.status){if(!e)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if("requested"===this.status)return this._requestImport()})}_requestImport(){return e._(this,void 0,void 0,function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new e.l(tt))})}lazyLoad(){"unavailable"===this.status?this.status="requested":"deferred"===this.status&&this._requestImport()}}let rt=null;function it(){return rt||(rt=new et),rt}class nt{constructor(t,r){this.timeAdded=0,this.fadeEndTime=0,this.tileID=t,this.uid=e.a7(),this.uses=0,this.tileSize=r,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){const e=t+this.timeAdded;e<this.fadeEndTime||(this.fadeEndTime=e)}wasRequested(){return"errored"===this.state||"loaded"===this.state||"reloading"===this.state}clearTextures(t){this.demTexture&&t.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(t,r,i){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",t){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=function(t,e){const r={};if(!e)return r;for(const i of t){const t=i.layerIds.map(t=>e.getLayer(t)).filter(Boolean);if(0!==t.length){i.layers=t,i.stateDependentLayerIds&&(i.stateDependentLayers=i.stateDependentLayerIds.map(e=>t.filter(t=>t.id===e)[0]));for(const e of t)r[e.id]=i}}return r}(t.buckets,null==r?void 0:r.style),this.hasSymbolBuckets=!1;for(const t in this.buckets){const r=this.buckets[t];if(r instanceof e.a9){if(this.hasSymbolBuckets=!0,!i)break;r.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const t in this.buckets){const r=this.buckets[t];if(r instanceof e.a9&&r.hasRTLText){this.hasRTLText=!0,it().lazyLoad();break}}this.queryPadding=0;for(const t in this.buckets){const e=this.buckets[t];this.queryPadding=Math.max(this.queryPadding,r.style.getLayer(t).queryRadius(e))}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage)}else this.collisionBoxArray=new e.a8}unloadVectorData(){for(const 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(const e in this.buckets){const r=this.buckets[e];r.uploadPending()&&r.upload(t)}const r=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new e.T(t,this.imageAtlas.image,r.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new e.T(t,this.glyphAtlasImage,r.ALPHA),this.glyphAtlasImage=null)}prepare(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture)}queryRenderedFeatures(t,e,r,i,n,o,a,s,l,c,h){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:i,cameraQueryGeometry:n,scale:o,tileSize:this.tileSize,pixelPosMatrix:c,transform:s,params:a,queryPadding:this.queryPadding*l,getElevation:h},t,e,r):{}}querySourceFeatures(t,r){const i=this.latestFeatureIndex;if(!i||!i.rawTileData)return;const n=i.loadVTLayers(),o=r&&r.sourceLayer?r.sourceLayer:"",a=n._geojsonTileLayer||n[o];if(!a)return;const s=e.aa(r&&r.filter),{z:l,x:c,y:h}=this.tileID.canonical,u={z:l,x:c,y:h};for(let r=0;r<a.length;r++){const n=a.feature(r);if(s.needGeometry){const t=e.ab(n,!0);if(!s.filter(new e.F(this.tileID.overscaledZ),t,this.tileID.canonical))continue}else if(!s.filter(new e.F(this.tileID.overscaledZ),n))continue;const p=i.getId(n,o),d=new e.ac(n,l,c,h,p);d.tile=u,t.push(d)}}hasData(){return"loaded"===this.state||"reloading"===this.state||"expired"===this.state}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(t){const r=this.expirationTime;if(t.cacheControl){const r=e.ad(t.cacheControl);r["max-age"]&&(this.expirationTime=Date.now()+1e3*r["max-age"])}else t.expires&&(this.expirationTime=new Date(t.expires).getTime());if(this.expirationTime){const t=Date.now();let e=!1;if(this.expirationTime>t)e=!1;else if(r)if(this.expirationTime<r)e=!0;else{const i=this.expirationTime-r;i?this.expirationTime=t+Math.max(i,3e4):e=!0}else e=!0;e?(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||0===Object.keys(t).length)return;const r=this.latestFeatureIndex.loadVTLayers();for(const i in this.buckets){if(!e.style.hasLayer(i))continue;const n=this.buckets[i],o=n.layers[0].sourceLayer||"_geojsonTileLayer",a=r[o],s=t[o];if(!a||!s||0===Object.keys(s).length)continue;n.update(s,a,this.imageAtlas&&this.imageAtlas.patternPositions||{});const l=e&&e.style&&e.style.getLayer(i);l&&(this.queryPadding=Math.max(this.queryPadding,l.queryRadius(n)))}}holdingForFade(){return void 0!==this.symbolFadeHoldUntil}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<a.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(t){this.symbolFadeHoldUntil=a.now()+t}setDependencies(t,e){const r={};for(const t of e)r[t]=!0;this.dependencies[t]=r}hasDependency(t,e){for(const r of t){const t=this.dependencies[r];if(t)for(const r of e)if(t[r])return!0}return!1}}class ot{constructor(t,e){this.max=t,this.onRemove=e,this.reset()}reset(){for(const t in this.data)for(const e of this.data[t])e.timeout&&clearTimeout(e.timeout),this.onRemove(e.value);return this.data={},this.order=[],this}add(t,e,r){const i=t.wrapped().key;void 0===this.data[i]&&(this.data[i]=[]);const n={value:e,timeout:void 0};if(void 0!==r&&(n.timeout=setTimeout(()=>{this.remove(t,n)},r)),this.data[i].push(n),this.order.push(i),this.order.length>this.max){const t=this._getAndRemoveByKey(this.order[0]);t&&this.onRemove(t)}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){const e=this.data[t].shift();return e.timeout&&clearTimeout(e.timeout),0===this.data[t].length&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),e.value}getByKey(t){const 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;const r=t.wrapped().key,i=void 0===e?0:this.data[r].indexOf(e),n=this.data[r][i];return this.data[r].splice(i,1),n.timeout&&clearTimeout(n.timeout),0===this.data[r].length&&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;){const t=this._getAndRemoveByKey(this.order[0]);t&&this.onRemove(t)}return this}filter(t){const e=[];for(const r in this.data)for(const i of this.data[r])t(i.value)||e.push(i);for(const t of e)this.remove(t.value.tileID,t)}}class at{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(t,r,i){const n=String(r);if(this.stateChanges[t]=this.stateChanges[t]||{},this.stateChanges[t][n]=this.stateChanges[t][n]||{},e.e(this.stateChanges[t][n],i),null===this.deletedStates[t]){this.deletedStates[t]={};for(const e in this.state[t])e!==n&&(this.deletedStates[t][e]=null)}else if(this.deletedStates[t]&&null===this.deletedStates[t][n]){this.deletedStates[t][n]={};for(const e in this.state[t][n])i[e]||(this.deletedStates[t][n][e]=null)}else for(const e in i)this.deletedStates[t]&&this.deletedStates[t][n]&&null===this.deletedStates[t][n][e]&&delete this.deletedStates[t][n][e]}removeFeatureState(t,e,r){if(null===this.deletedStates[t])return;const i=String(e);if(this.deletedStates[t]=this.deletedStates[t]||{},r&&void 0!==e)null!==this.deletedStates[t][i]&&(this.deletedStates[t][i]=this.deletedStates[t][i]||{},this.deletedStates[t][i][r]=null);else if(void 0!==e)if(this.stateChanges[t]&&this.stateChanges[t][i])for(r in this.deletedStates[t][i]={},this.stateChanges[t][i])this.deletedStates[t][i][r]=null;else this.deletedStates[t][i]=null;else this.deletedStates[t]=null}getState(t,r){const i=String(r),n=e.e({},(this.state[t]||{})[i],(this.stateChanges[t]||{})[i]);if(null===this.deletedStates[t])return{};if(this.deletedStates[t]){const e=this.deletedStates[t][r];if(null===e)return{};for(const t in e)delete n[t]}return n}initializeTileState(t,e){t.setFeatureState(this.state,e)}coalesceChanges(t,r){const i={};for(const t in this.stateChanges){this.state[t]=this.state[t]||{};const r={};for(const i in this.stateChanges[t])this.state[t][i]||(this.state[t][i]={}),e.e(this.state[t][i],this.stateChanges[t][i]),r[i]=this.state[t][i];i[t]=r}for(const t in this.deletedStates){this.state[t]=this.state[t]||{};const r={};if(null===this.deletedStates[t])for(const e in this.state[t])r[e]={},this.state[t][e]={};else for(const e in this.deletedStates[t]){if(null===this.deletedStates[t][e])this.state[t][e]={};else for(const r of Object.keys(this.deletedStates[t][e]))delete this.state[t][e][r];r[e]=this.state[t][e]}i[t]=i[t]||{},e.e(i[t],r)}if(this.stateChanges={},this.deletedStates={},0!==Object.keys(i).length)for(const e in t)t[e].setFeatureState(i,r)}}const st=89.25;function lt(t,r){const i=e.ah(r.lat,-e.ai,e.ai);return new e.P(e.V(r.lng)*t,e.U(i)*t)}function ct(t,r){return new e.a1(r.x/t,r.y/t).toLngLat()}function ht(t){return t.cameraToCenterDistance*Math.min(.85*Math.tan(e.ae(90-t.pitch)),Math.tan(e.ae(st-t.pitch)))}function ut(t,r){const i=t.canonical,n=r/e.af(i.z),o=i.x+Math.pow(2,i.z)*t.wrap,a=e.ag(new Float64Array(16));return e.M(a,a,[o*n,i.y*n,0]),e.N(a,a,[n/e.$,n/e.$,1]),a}function pt(t,r,i,n,o){const a=e.a1.fromLngLat(t,r),s=o*e.aj(1,t.lat),l=s*Math.cos(e.ae(i)),c=Math.sqrt(s*s-l*l),h=c*Math.sin(e.ae(-n)),u=c*Math.cos(e.ae(-n));return new e.a1(a.x+h,a.y+u,a.z+l)}function dt(t,e,r){const i=e.intersectsFrustum(t);if(!r||0===i)return i;const n=e.intersectsPlane(r);return 0===n?0:2===i&&2===n?2:1}function ft(t,e,r){let i=0;const n=(r-e)/10;for(let o=0;o<10;o++)i+=n*Math.pow(Math.cos(e+(o+.5)/10*(r-e)),t);return i}function mt(t,r){return function(i,n,o,a,s){const l=2*((t-1)/e.ak(Math.cos(e.ae(st-s))/Math.cos(e.ae(st)))-1),c=Math.acos(o/a),h=2*ft(l-1,0,e.ae(s/2)),u=Math.min(e.ae(st),c+e.ae(s/2)),p=ft(l-1,Math.min(u,c-e.ae(s/2)),u),d=Math.atan(n/o),f=Math.hypot(n,o);let m=i;return m+=e.ak(a/f/Math.max(.5,Math.cos(e.ae(s/2)))),m+=l*e.ak(Math.cos(d))/2,m-=e.ak(Math.max(1,p/h/r))/2,m}}const gt=mt(9.314,3);function _t(t,r){const i=(r.roundZoom?Math.round:Math.floor)(t.zoom+e.ak(t.tileSize/r.tileSize));return Math.max(0,i)}function yt(t,r){const i=t.getCameraFrustum(),n=t.getClippingPlane(),o=t.screenPointToMercatorCoordinate(t.getCameraPoint()),a=e.a1.fromLngLat(t.center,t.elevation);o.z=a.z+Math.cos(t.pitchInRadians)*t.cameraToCenterDistance/t.worldSize;const s=t.getCoveringTilesDetailsProvider(),l=s.allowVariableZoom(t,r),c=_t(t,r),h=r.minzoom||0,u=void 0!==r.maxzoom?r.maxzoom:t.maxZoom,p=Math.min(Math.max(0,c),u),d=Math.pow(2,p),f=[d*o.x,d*o.y,0],m=[d*a.x,d*a.y,0],g=Math.hypot(a.x-o.x,a.y-o.y),_=Math.abs(a.z-o.z),y=Math.hypot(g,_),b=t=>({zoom:0,x:0,y:0,wrap:t,fullyVisible:!1}),v=[],x=[];if(t.renderWorldCopies&&s.allowWorldCopies())for(let t=1;t<=3;t++)v.push(b(-t)),v.push(b(t));for(v.push(b(0));v.length>0;){const d=v.pop(),g=d.x,b=d.y;let w=d.fullyVisible;const T={x:g,y:b,z:d.zoom},S=s.getTileBoundingVolume(T,d.wrap,t.elevation,r);if(!w){const t=dt(i,S,n);if(0===t)continue;w=2===t}const P=s.distanceToTile2d(o.x,o.y,T,S);let C=c;l&&(C=(r.calculateTileZoom||gt)(t.zoom+e.ak(t.tileSize/r.tileSize),P,_,y,t.fov)),C=(r.roundZoom?Math.round:Math.floor)(C),C=Math.max(0,C);const M=Math.min(C,u);if(d.wrap=s.getWrap(a,T,d.wrap),d.zoom>=M){if(d.zoom<h)continue;const t=p-d.zoom,i=f[0]-.5-(g<<t),n=f[1]-.5-(b<<t),o=r.reparseOverscaled?Math.max(d.zoom,C):d.zoom;x.push({tileID:new e.Z(d.zoom===u?o:d.zoom,d.wrap,d.zoom,g,b),distanceSq:e.al([m[0]-.5-g,m[1]-.5-b]),tileDistanceToCamera:Math.sqrt(i*i+n*n)})}else for(let t=0;t<4;t++)v.push({zoom:d.zoom+1,x:(g<<1)+t%2,y:(b<<1)+(t>>1),wrap:d.wrap,fullyVisible:w})}return x.sort((t,e)=>t.distanceSq-e.distanceSq).map(t=>t.tileID)}const bt=e.a2.fromPoints([new e.P(0,0),new e.P(e.$,e.$)]);class vt extends e.E{constructor(t,e,r){super(),this.id=t,this.dispatcher=r,this.on("data",t=>this._dataHandler(t)),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((t,e,r,i)=>{const n=new(Q(e.type))(t,e,r,i);if(n.id!==t)throw new Error(`Expected Source id to be ${t} instead of ${n.id}`);return n})(t,e,r,this),this._tiles={},this._cache=new ot(0,t=>this._unloadTile(t)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new at,this._didEmitContent=!1,this._updated=!1}onAdd(t){this.map=t,this._maxTileCacheSize=t?t._maxTileCacheSize:null,this._maxTileCacheZoomLevels=t?t._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(t)}onRemove(t){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(t)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded)return!1;if(!this._source.loaded())return!1;if(!(void 0===this.used&&void 0===this.usedForTerrain||this.used||this.usedForTerrain))return!0;if(!this._updated)return!1;for(const t in this._tiles){const e=this._tiles[t];if("loaded"!==e.state&&"errored"!==e.state)return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const t=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,t&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(t,r,i){return e._(this,void 0,void 0,function*(){try{yield this._source.loadTile(t),this._tileLoaded(t,r,i)}catch(r){t.state="errored",404!==r.status?this._source.fire(new e.k(r,{tile:t})):this.update(this.transform,this.terrain)}})}_unloadTile(t){this._source.unloadTile&&this._source.unloadTile(t)}_abortTile(t){this._source.abortTile&&this._source.abortTile(t),this._source.fire(new e.l("dataabort",{tile:t,coord:t.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(t){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const e in this._tiles){const r=this._tiles[e];r.upload(t),r.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(t=>t.tileID).sort(xt).map(t=>t.key)}getRenderableIds(t){const r=[];for(const e in this._tiles)this._isIdRenderable(e,t)&&r.push(this._tiles[e]);return t?r.sort((t,r)=>{const i=t.tileID,n=r.tileID,o=new e.P(i.canonical.x,i.canonical.y)._rotate(-this.transform.bearingInRadians),a=new e.P(n.canonical.x,n.canonical.y)._rotate(-this.transform.bearingInRadians);return i.overscaledZ-n.overscaledZ||a.y-o.y||a.x-o.x}).map(t=>t.tileID.key):r.map(t=>t.tileID).sort(xt).map(t=>t.key)}hasRenderableParent(t){const e=this.findLoadedParent(t,0);return!!e&&this._isIdRenderable(e.tileID.key)}_isIdRenderable(t,e){return this._tiles[t]&&this._tiles[t].hasData()&&!this._coveredTiles[t]&&(e||!this._tiles[t].holdingForFade())}reload(t){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const e in this._tiles)t?this._reloadTile(e,"expired"):"errored"!==this._tiles[e].state&&this._reloadTile(e,"reloading")}}_reloadTile(t,r){return e._(this,void 0,void 0,function*(){const e=this._tiles[t];e&&("loading"!==e.state&&(e.state=r),yield this._loadTile(e,t,r))})}_tileLoaded(t,r,i){t.timeAdded=a.now(),"expired"===i&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(r,t),"raster-dem"===this.getSource().type&&t.dem&&this._backfillDEM(t),this._state.initializeTileState(t,this.map?this.map.painter:null),t.aborted||this._source.fire(new e.l("data",{dataType:"source",tile:t,coord:t.tileID}))}_backfillDEM(t){const e=this.getRenderableIds();for(let i=0;i<e.length;i++){const n=e[i];if(t.neighboringTiles&&t.neighboringTiles[n]){const e=this.getTileByID(n);r(t,e),r(e,t)}}function r(t,e){t.needsHillshadePrepare=!0,t.needsTerrainPrepare=!0;let r=e.tileID.canonical.x-t.tileID.canonical.x;const i=e.tileID.canonical.y-t.tileID.canonical.y,n=Math.pow(2,t.tileID.canonical.z),o=e.tileID.key;0===r&&0===i||Math.abs(i)>1||(Math.abs(r)>1&&(1===Math.abs(r+n)?r+=n:1===Math.abs(r-n)&&(r-=n)),e.dem&&t.dem&&(t.dem.backfillBorder(e.dem,r,i),t.neighboringTiles&&t.neighboringTiles[o]&&(t.neighboringTiles[o].backfilled=!0)))}}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._tiles[t]}_retainLoadedChildren(t,e,r,i){for(const n in this._tiles){let o=this._tiles[n];if(i[n]||!o.hasData()||o.tileID.overscaledZ<=e||o.tileID.overscaledZ>r)continue;let a=o.tileID;for(;o&&o.tileID.overscaledZ>e+1;){const t=o.tileID.scaledTo(o.tileID.overscaledZ-1);o=this._tiles[t.key],o&&o.hasData()&&(a=t)}let s=a;for(;s.overscaledZ>e;)if(s=s.scaledTo(s.overscaledZ-1),t[s.key]||t[s.canonical.key]){i[a.key]=a;break}}}findLoadedParent(t,e){if(t.key in this._loadedParentTiles){const r=this._loadedParentTiles[t.key];return r&&r.tileID.overscaledZ>=e?r:null}for(let r=t.overscaledZ-1;r>=e;r--){const e=t.scaledTo(r),i=this._getLoadedTile(e);if(i)return i}}findLoadedSibling(t){return this._getLoadedTile(t)}_getLoadedTile(t){const e=this._tiles[t.key];return e&&e.hasData()?e:this._cache.getByKey(t.wrapped().key)}updateCacheSize(t){const r=Math.ceil(t.width/this._source.tileSize)+1,i=Math.ceil(t.height/this._source.tileSize)+1,n=Math.floor(r*i*(null===this._maxTileCacheZoomLevels?e.a.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),o="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,n):n;this._cache.setMaxSize(o)}handleWrapJump(t){const e=Math.round((t-(void 0===this._prevLng?t:this._prevLng))/360);if(this._prevLng=t,e){const t={};for(const r in this._tiles){const i=this._tiles[r];i.tileID=i.tileID.unwrapTo(i.tileID.wrap+e),t[i.tileID.key]=i}this._tiles=t;for(const t in this._timers)clearTimeout(this._timers[t]),delete this._timers[t];for(const t in this._tiles)this._setTileReloadTimer(t,this._tiles[t])}}_updateCoveredAndRetainedTiles(t,e,r,i,n,o){const s={},l={},c=Object.keys(t),h=a.now();for(const r of c){const i=t[r],n=this._tiles[r];if(!n||0!==n.fadeEndTime&&n.fadeEndTime<=h)continue;const o=this.findLoadedParent(i,e),a=this.findLoadedSibling(i),c=o||a||null;c&&(this._addTile(c.tileID),s[c.tileID.key]=c.tileID),l[r]=i}this._retainLoadedChildren(l,i,r,t);for(const e in s)t[e]||(this._coveredTiles[e]=!0,t[e]=s[e]);if(o){const e={},r={};for(const t of n)this._tiles[t.key].hasData()?e[t.key]=t:r[t.key]=t;for(const i in r){const n=r[i].children(this._source.maxzoom);this._tiles[n[0].key]&&this._tiles[n[1].key]&&this._tiles[n[2].key]&&this._tiles[n[3].key]&&(e[n[0].key]=t[n[0].key]=n[0],e[n[1].key]=t[n[1].key]=n[1],e[n[2].key]=t[n[2].key]=n[2],e[n[3].key]=t[n[3].key]=n[3],delete r[i])}for(const i in r){const n=r[i],o=this.findLoadedParent(n,this._source.minzoom),a=this.findLoadedSibling(n),s=o||a||null;if(s){e[s.tileID.key]=t[s.tileID.key]=s.tileID;for(const t in e)e[t].isChildOf(s.tileID)&&delete e[t]}}for(const t in this._tiles)e[t]||(this._coveredTiles[t]=!0)}}update(t,r){if(!this._sourceLoaded||this._paused)return;let i;this.transform=t,this.terrain=r,this.updateCacheSize(t),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?i=t.getVisibleUnwrappedCoordinates(this._source.tileID).map(t=>new e.Z(t.canonical.z,t.wrap,t.canonical.z,t.canonical.x,t.canonical.y)):(i=yt(t,{tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:r,calculateTileZoom:this._source.calculateTileZoom}),this._source.hasTile&&(i=i.filter(t=>this._source.hasTile(t)))):i=[];const n=_t(t,this._source),o=Math.max(n-vt.maxOverzooming,this._source.minzoom),a=Math.max(n+vt.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const t={};for(const e of i)if(e.canonical.z>this._source.minzoom){const r=e.scaledTo(e.canonical.z-1);t[r.key]=r;const i=e.scaledTo(Math.max(this._source.minzoom,Math.min(e.canonical.z,5)));t[i.key]=i}i=i.concat(Object.values(t))}const s=0===i.length&&!this._updated&&this._didEmitContent;this._updated=!0,s&&this.fire(new e.l("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const l=this._updateRetainedTiles(i,n);wt(this._source.type)&&this._updateCoveredAndRetainedTiles(l,o,a,n,i,r);for(const t in l)this._tiles[t].clearFadeHold();const c=e.am(this._tiles,l);for(const t of c){const e=this._tiles[t];e.hasSymbolBuckets&&!e.holdingForFade()?e.setHoldDuration(this.map._fadeDuration):e.hasSymbolBuckets&&!e.symbolFadeFinished()||this._removeTile(t)}this._updateLoadedParentTileCache(),this._updateLoadedSiblingTileCache()}releaseSymbolFadeTiles(){for(const t in this._tiles)this._tiles[t].holdingForFade()&&this._removeTile(t)}_updateRetainedTiles(t,e){var r;const i={},n={},o=Math.max(e-vt.maxOverzooming,this._source.minzoom),a=Math.max(e+vt.maxUnderzooming,this._source.minzoom),s={};for(const r of t){const t=this._addTile(r);i[r.key]=r,t.hasData()||e<this._source.maxzoom&&(s[r.key]=r)}this._retainLoadedChildren(s,e,a,i);for(const a of t){let t=this._tiles[a.key];if(t.hasData())continue;if(e+1>this._source.maxzoom){const t=a.children(this._source.maxzoom)[0],e=this.getTile(t);if(e&&e.hasData()){i[t.key]=t;continue}}else{const t=a.children(this._source.maxzoom);if(i[t[0].key]&&i[t[1].key]&&i[t[2].key]&&i[t[3].key])continue}let s=t.wasRequested();for(let e=a.overscaledZ-1;e>=o;--e){const o=a.scaledTo(e);if(n[o.key])break;if(n[o.key]=!0,t=this.getTile(o),!t&&s&&(t=this._addTile(o)),t){const e=t.hasData();if((e||!(null===(r=this.map)||void 0===r?void 0:r.cancelPendingTileRequestsWhileZooming)||s)&&(i[o.key]=o),s=t.wasRequested(),e)break}}}return i}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const t in this._tiles){const e=[];let r,i=this._tiles[t].tileID;for(;i.overscaledZ>0;){if(i.key in this._loadedParentTiles){r=this._loadedParentTiles[i.key];break}e.push(i.key);const t=i.scaledTo(i.overscaledZ-1);if(r=this._getLoadedTile(t),r)break;i=t}for(const t of e)this._loadedParentTiles[t]=r}}_updateLoadedSiblingTileCache(){this._loadedSiblingTiles={};for(const t in this._tiles){const e=this._tiles[t].tileID,r=this._getLoadedTile(e);this._loadedSiblingTiles[e.key]=r}}_addTile(t){let r=this._tiles[t.key];if(r)return r;r=this._cache.getAndRemove(t),r&&(this._setTileReloadTimer(t.key,r),r.tileID=t,this._state.initializeTileState(r,this.map?this.map.painter:null),this._cacheTimers[t.key]&&(clearTimeout(this._cacheTimers[t.key]),delete this._cacheTimers[t.key],this._setTileReloadTimer(t.key,r)));const i=r;return r||(r=new nt(t,this._source.tileSize*t.overscaleFactor()),this._loadTile(r,t.key,r.state)),r.uses++,this._tiles[t.key]=r,i||this._source.fire(new e.l("dataloading",{tile:r,coord:r.tileID,dataType:"source"})),r}_setTileReloadTimer(t,e){t in this._timers&&(clearTimeout(this._timers[t]),delete this._timers[t]);const r=e.getExpiryTimeout();r&&(this._timers[t]=setTimeout(()=>{this._reloadTile(t,"expired"),delete this._timers[t]},r))}refreshTiles(t){for(const e in this._tiles)(this._isIdRenderable(e)||"errored"==this._tiles[e].state)&&t.some(t=>t.equals(this._tiles[e].tileID.canonical))&&this._reloadTile(e,"expired")}_removeTile(t){const e=this._tiles[t];e&&(e.uses--,delete this._tiles[t],this._timers[t]&&(clearTimeout(this._timers[t]),delete this._timers[t]),e.uses>0||(e.hasData()&&"reloading"!==e.state?this._cache.add(e.tileID,e,e.getExpiryTimeout()):(e.aborted=!0,this._abortTile(e),this._unloadTile(e))))}_dataHandler(t){const e=t.sourceDataType;"source"===t.dataType&&"metadata"===e&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&"source"===t.dataType&&"content"===e&&(this.reload(t.sourceDataChanged),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const t in this._tiles)this._removeTile(t);this._cache.reset()}tilesIn(t,r,i){const n=[],o=this.transform;if(!o)return n;const a=o.getCoveringTilesDetailsProvider().allowWorldCopies(),s=i?o.getCameraQueryGeometry(t):t,l=t=>o.screenPointToMercatorCoordinate(t,this.terrain),c=this.transformBbox(t,l,!a),h=this.transformBbox(s,l,!a),u=this.getIds(),p=e.a2.fromPoints(h);for(let t=0;t<u.length;t++){const i=this._tiles[u[t]];if(i.holdingForFade())continue;const s=a?[i.tileID]:[i.tileID.unwrapTo(-1),i.tileID.unwrapTo(0)],l=Math.pow(2,o.zoom-i.tileID.overscaledZ),d=r*i.queryPadding*e.$/i.tileSize/l;for(const t of s){const r=p.map(r=>t.getTilePoint(new e.a1(r.x,r.y)));if(r.expandBy(d),r.intersects(bt)){const e=c.map(e=>t.getTilePoint(e)),r=h.map(e=>t.getTilePoint(e));n.push({tile:i,tileID:a?t:t.unwrapTo(0),queryGeometry:e,cameraQueryGeometry:r,scale:l})}}}return n}transformBbox(t,r,i){let n=t.map(r);if(i){const i=e.a2.fromPoints(t);i.shrinkBy(.001*Math.min(i.width(),i.height()));const o=i.map(r);e.a2.fromPoints(n).covers(o)||(n=n.map(t=>t.x>.5?new e.a1(t.x-1,t.y,t.z):t))}return n}getVisibleCoordinates(t){const e=this.getRenderableIds(t).map(t=>this._tiles[t].tileID);return this.transform&&this.transform.populateCache(e),e}hasTransition(){if(this._source.hasTransition())return!0;if(wt(this._source.type)){const t=a.now();for(const e in this._tiles)if(this._tiles[e].fadeEndTime>=t)return!0}return!1}setFeatureState(t,e,r){this._state.updateState(t=t||"_geojsonTileLayer",e,r)}removeFeatureState(t,e,r){this._state.removeFeatureState(t=t||"_geojsonTileLayer",e,r)}getFeatureState(t,e){return this._state.getState(t=t||"_geojsonTileLayer",e)}setDependencies(t,e,r){const i=this._tiles[t];i&&i.setDependencies(e,r)}reloadTilesForDependencies(t,e){for(const r in this._tiles)this._tiles[r].hasDependency(t,e)&&this._reloadTile(r,"reloading");this._cache.filter(r=>!r.hasDependency(t,e))}}function xt(t,e){const r=Math.abs(2*t.wrap)-+(t.wrap<0),i=Math.abs(2*e.wrap)-+(e.wrap<0);return t.overscaledZ-e.overscaledZ||i-r||e.canonical.y-t.canonical.y||e.canonical.x-t.canonical.x}function wt(t){return"raster"===t||"image"===t||"video"===t}vt.maxOverzooming=10,vt.maxUnderzooming=3;class Tt{constructor(t,e){this.reset(t,e)}reset(t,e){this.points=t||[],this._distances=[0];for(let t=1;t<this.points.length;t++)this._distances[t]=this._distances[t-1]+this.points[t].dist(this.points[t-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(e||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(t){if(1===this.points.length)return this.points[0];t=e.ah(t,0,1);let r=1,i=this._distances[r];const n=t*this.paddedLength+this.padding;for(;i<n&&r<this._distances.length;)i=this._distances[++r];const o=r-1,a=this._distances[o],s=i-a,l=s>0?(n-a)/s:0;return this.points[o].mult(1-l).add(this.points[r].mult(l))}}function St(t,e){let r=!0;return"always"===t||"never"!==t&&"never"!==e||(r=!1),r}class Pt{constructor(t,e,r){const i=this.boxCells=[],n=this.circleCells=[];this.xCellCount=Math.ceil(t/r),this.yCellCount=Math.ceil(e/r);for(let t=0;t<this.xCellCount*this.yCellCount;t++)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,o){this.boxCells[n].push(o)}_insertCircleCell(t,e,r,i,n,o){this.circleCells[n].push(o)}_query(t,e,r,i,n,o,a){if(r<0||t>this.width||i<0||e>this.height)return[];const s=[];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 t=0;t<this.boxKeys.length;t++)s.push({key:this.boxKeys[t],x1:this.bboxes[4*t],y1:this.bboxes[4*t+1],x2:this.bboxes[4*t+2],y2:this.bboxes[4*t+3]});for(let t=0;t<this.circleKeys.length;t++){const e=this.circles[3*t],r=this.circles[3*t+1],i=this.circles[3*t+2];s.push({key:this.circleKeys[t],x1:e-i,y1:r-i,x2:e+i,y2:r+i})}}else this._forEachCell(t,e,r,i,this._queryCell,s,{hitTest:n,overlapMode:o,seenUids:{box:{},circle:{}}},a);return s}query(t,e,r,i){return this._query(t,e,r,i,!1,null)}hitTest(t,e,r,i,n,o){return this._query(t,e,r,i,!0,n,o).length>0}hitTestCircle(t,e,r,i,n){const o=t-r,a=t+r,s=e-r,l=e+r;if(a<0||o>this.width||l<0||s>this.height)return!1;const c=[];return this._forEachCell(o,s,a,l,this._queryCellCircle,c,{hitTest:!0,overlapMode:i,circle:{x:t,y:e,radius:r},seenUids:{box:{},circle:{}}},n),c.length>0}_queryCell(t,e,r,i,n,o,a,s){const{seenUids:l,hitTest:c,overlapMode:h}=a,u=this.boxCells[n];if(null!==u){const n=this.bboxes;for(const a of u)if(!l.box[a]){l.box[a]=!0;const u=4*a,p=this.boxKeys[a];if(t<=n[u+2]&&e<=n[u+3]&&r>=n[u+0]&&i>=n[u+1]&&(!s||s(p))&&(!c||!St(h,p.overlapMode))&&(o.push({key:p,x1:n[u],y1:n[u+1],x2:n[u+2],y2:n[u+3]}),c))return!0}}const p=this.circleCells[n];if(null!==p){const n=this.circles;for(const a of p)if(!l.circle[a]){l.circle[a]=!0;const u=3*a,p=this.circleKeys[a];if(this._circleAndRectCollide(n[u],n[u+1],n[u+2],t,e,r,i)&&(!s||s(p))&&(!c||!St(h,p.overlapMode))){const t=n[u],e=n[u+1],r=n[u+2];if(o.push({key:p,x1:t-r,y1:e-r,x2:t+r,y2:e+r}),c)return!0}}}return!1}_queryCellCircle(t,e,r,i,n,o,a,s){const{circle:l,seenUids:c,overlapMode:h}=a,u=this.boxCells[n];if(null!==u){const t=this.bboxes;for(const e of u)if(!c.box[e]){c.box[e]=!0;const r=4*e,i=this.boxKeys[e];if(this._circleAndRectCollide(l.x,l.y,l.radius,t[r+0],t[r+1],t[r+2],t[r+3])&&(!s||s(i))&&!St(h,i.overlapMode))return o.push(!0),!0}}const p=this.circleCells[n];if(null!==p){const t=this.circles;for(const e of p)if(!c.circle[e]){c.circle[e]=!0;const r=3*e,i=this.circleKeys[e];if(this._circlesCollide(t[r],t[r+1],t[r+2],l.x,l.y,l.radius)&&(!s||s(i))&&!St(h,i.overlapMode))return o.push(!0),!0}}}_forEachCell(t,e,r,i,n,o,a,s){const l=this._convertToXCellCoord(t),c=this._convertToYCellCoord(e),h=this._convertToXCellCoord(r),u=this._convertToYCellCoord(i);for(let p=l;p<=h;p++)for(let l=c;l<=u;l++)if(n.call(this,t,e,r,i,this.xCellCount*l+p,o,a,s))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,o){const a=i-t,s=n-e,l=r+o;return l*l>a*a+s*s}_circleAndRectCollide(t,e,r,i,n,o,a){const s=(o-i)/2,l=Math.abs(t-(i+s));if(l>s+r)return!1;const c=(a-n)/2,h=Math.abs(e-(n+c));if(h>c+r)return!1;if(l<=s||h<=c)return!0;const u=l-s,p=h-c;return u*u+p*p<=r*r}}function Ct(t,r,n){const o=e.L();if(!t){const{vecSouth:t,vecEast:e}=At(r),n=i();n[0]=e[0],n[1]=e[1],n[2]=t[0],n[3]=t[1],a=n,(p=(l=(s=n)[0])*(u=s[3])-(h=s[2])*(c=s[1]))&&(a[0]=u*(p=1/p),a[1]=-c*p,a[2]=-h*p,a[3]=l*p),o[0]=n[0],o[1]=n[1],o[4]=n[2],o[5]=n[3]}var a,s,l,c,h,u,p;return e.N(o,o,[1/n,1/n,1]),o}function Mt(t,r,i,n){if(t){const t=e.L();if(!r){const{vecSouth:e,vecEast:r}=At(i);t[0]=r[0],t[1]=r[1],t[4]=e[0],t[5]=e[1]}return e.N(t,t,[n,n,1]),t}return i.pixelsToClipSpaceMatrix}function At(t){const r=Math.cos(t.rollInRadians),i=Math.sin(t.rollInRadians),n=Math.cos(t.pitchInRadians),o=Math.cos(t.bearingInRadians),a=Math.sin(t.bearingInRadians),s=e.ar();s[0]=-o*n*i-a*r,s[1]=-a*n*i+o*r;const l=e.as(s);l<1e-9?e.at(s):e.au(s,s,1/l);const c=e.ar();c[0]=o*n*r-a*i,c[1]=a*n*r+o*i;const h=e.as(c);return h<1e-9?e.at(c):e.au(c,c,1/h),{vecEast:c,vecSouth:s}}function It(t,r,i,n){let o;n?(o=[t,r,n(t,r),1],e.aw(o,o,i)):(o=[t,r,0,1],qt(o,o,i));const a=o[3];return{point:new e.P(o[0]/a,o[1]/a),signedDistanceFromCamera:a,isOccluded:!1}}function Et(t,e){return.5+t/e*.5}function kt(t,e){return t.x>=-e[0]&&t.x<=e[0]&&t.y>=-e[1]&&t.y<=e[1]}function zt(t,r,i,n,o,a,s,l,c,h,u,p,d){const f=i?t.textSizeData:t.iconSizeData,m=e.an(f,r.transform.zoom),g=[256/r.width*2+1,256/r.height*2+1],_=i?t.text.dynamicLayoutVertexArray:t.icon.dynamicLayoutVertexArray;_.clear();const y=t.lineVertexArray,b=i?t.text.placedSymbolArray:t.icon.placedSymbolArray,v=r.transform.width/r.transform.height;let x=!1;for(let i=0;i<b.length;i++){const w=b.get(i);if(w.hidden||w.writingMode===e.ao.vertical&&!x){Gt(w.numGlyphs,_);continue}x=!1;const T=new e.P(w.anchorX,w.anchorY),S={getElevation:d,pitchedLabelPlaneMatrix:n,lineVertexArray:y,pitchWithMap:a,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:r.transform,tileAnchorPoint:T,unwrappedTileID:c,width:h,height:u,translation:p},P=Ut(w.anchorX,w.anchorY,S);if(!kt(P.point,g)){Gt(w.numGlyphs,_);continue}const C=Et(r.transform.cameraToCenterDistance,P.signedDistanceFromCamera),M=e.ap(f,m,w),A=a?M*r.transform.getPitchedTextCorrection(w.anchorX,w.anchorY,c)/C:M*C,I=Lt({projectionContext:S,pitchedLabelPlaneMatrixInverse:o,symbol:w,fontSize:A,flip:!1,keepUpright:s,glyphOffsetArray:t.glyphOffsetArray,dynamicLayoutVertexArray:_,aspectRatio:v,rotateToLine:l});x=I.useVertical,(I.notEnoughRoom||x||I.needsFlipping&&Lt({projectionContext:S,pitchedLabelPlaneMatrixInverse:o,symbol:w,fontSize:A,flip:!0,keepUpright:s,glyphOffsetArray:t.glyphOffsetArray,dynamicLayoutVertexArray:_,aspectRatio:v,rotateToLine:l}).notEnoughRoom)&&Gt(w.numGlyphs,_)}i?t.text.dynamicLayoutVertexBuffer.updateData(_):t.icon.dynamicLayoutVertexBuffer.updateData(_)}function Rt(t,e,r,i,n,o,a,s){const l=o.glyphStartIndex+o.numGlyphs,c=o.lineStartIndex,h=o.lineStartIndex+o.lineLength,u=e.getoffsetX(o.glyphStartIndex),p=e.getoffsetX(l-1),d=$t(t*u,r,i,n,o.segment,c,h,s,a);if(!d)return null;const f=$t(t*p,r,i,n,o.segment,c,h,s,a);return f?s.projectionCache.anyProjectionOccluded?null:{first:d,last:f}:null}function Dt(t,r,i,n){return t===e.ao.horizontal&&Math.abs(i.y-r.y)>Math.abs(i.x-r.x)*n?{useVertical:!0}:(t===e.ao.vertical?r.y<i.y:r.x>i.x)?{needsFlipping:!0}:null}function Lt(t){const{projectionContext:r,pitchedLabelPlaneMatrixInverse:i,symbol:n,fontSize:o,flip:a,keepUpright:s,glyphOffsetArray:l,dynamicLayoutVertexArray:c,aspectRatio:h,rotateToLine:u}=t,p=o/24,d=n.lineOffsetX*p,f=n.lineOffsetY*p;let m;if(n.numGlyphs>1){const t=n.glyphStartIndex+n.numGlyphs,e=n.lineStartIndex,o=n.lineStartIndex+n.lineLength,c=Rt(p,l,d,f,a,n,u,r);if(!c)return{notEnoughRoom:!0};const g=jt(c.first.point.x,c.first.point.y,r,i),_=jt(c.last.point.x,c.last.point.y,r,i);if(s&&!a){const t=Dt(n.writingMode,g,_,h);if(t)return t}m=[c.first];for(let i=n.glyphStartIndex+1;i<t-1;i++){const t=$t(p*l.getoffsetX(i),d,f,a,n.segment,e,o,r,u);if(!t)return{notEnoughRoom:!0};m.push(t)}m.push(c.last)}else{if(s&&!a){const t=Ot(r.tileAnchorPoint.x,r.tileAnchorPoint.y,r).point,o=n.lineStartIndex+n.segment+1,a=new e.P(r.lineVertexArray.getx(o),r.lineVertexArray.gety(o)),s=Ot(a.x,a.y,r),l=s.signedDistanceFromCamera>0?s.point:Ft(r.tileAnchorPoint,a,t,1,r),c=jt(t.x,t.y,r,i),u=jt(l.x,l.y,r,i),p=Dt(n.writingMode,c,u,h);if(p)return p}const t=$t(p*l.getoffsetX(n.glyphStartIndex),d,f,a,n.segment,n.lineStartIndex,n.lineStartIndex+n.lineLength,r,u);if(!t||r.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};m=[t]}for(const t of m)e.av(c,t.point,t.angle);return{}}function Ft(t,e,r,i,n){const o=t.add(t.sub(e)._unit()),a=Ot(o.x,o.y,n).point,s=r.sub(a);return r.add(s._mult(i/s.mag()))}function Bt(t,r,i){const n=r.projectionCache;if(n.projections[t])return n.projections[t];const o=new e.P(r.lineVertexArray.getx(t),r.lineVertexArray.gety(t)),a=Ot(o.x,o.y,r);if(a.signedDistanceFromCamera>0)return n.projections[t]=a.point,n.anyProjectionOccluded=n.anyProjectionOccluded||a.isOccluded,a.point;const s=t-i.direction;return Ft(0===i.distanceFromAnchor?r.tileAnchorPoint:new e.P(r.lineVertexArray.getx(s),r.lineVertexArray.gety(s)),o,i.previousVertex,i.absOffsetX-i.distanceFromAnchor+1,r)}function Ot(t,e,r){const i=t+r.translation[0],n=e+r.translation[1];let o;return r.pitchWithMap?(o=It(i,n,r.pitchedLabelPlaneMatrix,r.getElevation),o.isOccluded=!1):(o=r.transform.projectTileCoordinates(i,n,r.unwrappedTileID,r.getElevation),o.point.x=(.5*o.point.x+.5)*r.width,o.point.y=(.5*-o.point.y+.5)*r.height),o}function jt(t,r,i,n){if(i.pitchWithMap){const o=[t,r,0,1];return e.aw(o,o,n),i.transform.projectTileCoordinates(o[0]/o[3],o[1]/o[3],i.unwrappedTileID,i.getElevation).point}return{x:t/i.width*2-1,y:1-r/i.height*2}}function Ut(t,e,r){return r.transform.projectTileCoordinates(t,e,r.unwrappedTileID,r.getElevation)}function Nt(t,e,r){return t._unit()._perp()._mult(e*r)}function Vt(t,r,i,n,o,a,s,l,c){if(l.projectionCache.offsets[t])return l.projectionCache.offsets[t];const h=i.add(r);if(t+c.direction<n||t+c.direction>=o)return l.projectionCache.offsets[t]=h,h;const u=Bt(t+c.direction,l,c),p=Nt(u.sub(i),s,c.direction),d=i.add(p),f=u.add(p);return l.projectionCache.offsets[t]=e.ax(a,h,d,f)||h,l.projectionCache.offsets[t]}function $t(t,e,r,i,n,o,a,s,l){const c=i?t-e:t+e;let h=c>0?1:-1,u=0;i&&(h*=-1,u=Math.PI),h<0&&(u+=Math.PI);let p,d=h>0?o+n:o+n+1;s.projectionCache.cachedAnchorPoint?p=s.projectionCache.cachedAnchorPoint:(p=Ot(s.tileAnchorPoint.x,s.tileAnchorPoint.y,s).point,s.projectionCache.cachedAnchorPoint=p);let f,m,g=p,_=p,y=0,b=0;const v=Math.abs(c),x=[];let w;for(;y+b<=v;){if(d+=h,d<o||d>=a)return null;y+=b,_=g,m=f;const t={absOffsetX:v,direction:h,distanceFromAnchor:y,previousVertex:_};if(g=Bt(d,s,t),0===r)x.push(_),w=g.sub(_);else{let e;const i=g.sub(_);e=0===i.mag()?Nt(Bt(d+h,s,t).sub(g),r,h):Nt(i,r,h),m||(m=_.add(e)),f=Vt(d,e,g,o,a,m,r,s,t),x.push(m),w=f.sub(m)}b=w.mag()}const T=w._mult((v-y)/b)._add(m||_),S=u+Math.atan2(g.y-_.y,g.x-_.x);return x.push(T),{point:T,angle:l?S:0,path:x}}const Zt=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function Gt(t,e){for(let r=0;r<t;r++){const t=e.length;e.resize(t+4),e.float32.set(Zt,3*t)}}function qt(t,e,r){const i=e[0],n=e[1];return t[0]=r[0]*i+r[4]*n+r[12],t[1]=r[1]*i+r[5]*n+r[13],t[3]=r[3]*i+r[7]*n+r[15],t}const Ht=100;class Wt{constructor(t,e=new Pt(t.width+200,t.height+200,25),r=new Pt(t.width+200,t.height+200,25)){this.transform=t,this.grid=e,this.ignoredGrid=r,this.pitchFactor=Math.cos(t.pitch*Math.PI/180)*t.cameraToCenterDistance,this.screenRightBoundary=t.width+Ht,this.screenBottomBoundary=t.height+Ht,this.gridRightBoundary=t.width+200,this.gridBottomBoundary=t.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(t,e,r,i,n,o,a,s,l,c,h,u){const p=this.projectAndGetPerspectiveRatio(t.anchorPointX+s[0],t.anchorPointY+s[1],n,c,u),d=r*p.perspectiveRatio;let f;if(o||a)f=this._projectCollisionBox(t,d,i,n,o,a,s,p,c,h,u);else{const e=p.x+(h?h.x*d:0),r=p.y+(h?h.y*d:0);f={allPointsOccluded:!1,box:[e+t.x1*d,r+t.y1*d,e+t.x2*d,r+t.y2*d]}}const[m,g,_,y]=f.box,b=o?f.allPointsOccluded:p.isOccluded;let v=b;return v||(v=p.perspectiveRatio<this.perspectiveRatioCutoff),v||(v=!this.isInsideGrid(m,g,_,y)),v||"always"!==e&&this.grid.hitTest(m,g,_,y,e,l)?{box:[m,g,_,y],placeable:!1,offscreen:!1,occluded:b}:{box:[m,g,_,y],placeable:!0,offscreen:this.isOffscreen(m,g,_,y),occluded:b}}placeCollisionCircles(t,r,i,n,o,a,s,l,c,h,u,p,d,f){const m=[],g=new e.P(r.anchorX,r.anchorY),_=this.getPerspectiveRatio(g.x,g.y,a,f),y=(c?o*this.transform.getPitchedTextCorrection(r.anchorX,r.anchorY,a)/_:o*_)/e.aB,b={getElevation:f,pitchedLabelPlaneMatrix:s,lineVertexArray:i,pitchWithMap:c,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:this.transform,tileAnchorPoint:g,unwrappedTileID:a,width:this.transform.width,height:this.transform.height,translation:d},v=Rt(y,n,r.lineOffsetX*y,r.lineOffsetY*y,!1,r,!1,b);let x=!1,w=!1,T=!0;if(v){const r=.5*u*_+p,i=new e.P(-100,-100),n=new e.P(this.screenRightBoundary,this.screenBottomBoundary),o=new Tt,a=v.first,s=v.last;let d=[];for(let t=a.path.length-1;t>=1;t--)d.push(a.path[t]);for(let t=1;t<s.path.length;t++)d.push(s.path[t]);const f=2.5*r;if(c){const t=this.projectPathToScreenSpace(d,b);d=t.some(t=>t.signedDistanceFromCamera<=0)?[]:t.map(t=>t.point)}let g=[];if(d.length>0){const t=d[0].clone(),r=d[0].clone();for(let e=1;e<d.length;e++)t.x=Math.min(t.x,d[e].x),t.y=Math.min(t.y,d[e].y),r.x=Math.max(r.x,d[e].x),r.y=Math.max(r.y,d[e].y);g=t.x>=i.x&&r.x<=n.x&&t.y>=i.y&&r.y<=n.y?[d]:r.x<i.x||t.x>n.x||r.y<i.y||t.y>n.y?[]:e.ay([d],i.x,i.y,n.x,n.y)}for(const e of g){o.reset(e,.25*r);let i=0;i=o.length<=.5*r?1:Math.ceil(o.paddedLength/f)+1;for(let e=0;e<i;e++){const n=e/Math.max(i-1,1),a=o.lerp(n),s=a.x+Ht,c=a.y+Ht;m.push(s,c,r,0);const u=s-r,p=c-r,d=s+r,f=c+r;if(T=T&&this.isOffscreen(u,p,d,f),w=w||this.isInsideGrid(u,p,d,f),"always"!==t&&this.grid.hitTestCircle(s,c,r,t,h)&&(x=!0,!l))return{circles:[],offscreen:!1,collisionDetected:x}}}}return{circles:!l&&x||!w||_<this.perspectiveRatioCutoff?[]:m,offscreen:T,collisionDetected:x}}projectPathToScreenSpace(t,r){const i=function(t,r){const i=e.L();return e.aq(i,r.pitchedLabelPlaneMatrix),t.map(t=>{const e=It(t.x,t.y,i,r.getElevation),n=r.transform.projectTileCoordinates(e.point.x,e.point.y,r.unwrappedTileID,r.getElevation);return n.point.x=(.5*n.point.x+.5)*r.width,n.point.y=(.5*-n.point.y+.5)*r.height,n})}(t,r);return function(t){let e=0,r=0,i=0,n=0;for(let o=0;o<t.length;o++)t[o].isOccluded?(i=o+1,n=0):(n++,n>r&&(r=n,e=i));return t.slice(e,e+r)}(i)}queryRenderedSymbols(t){if(0===t.length||0===this.grid.keysLength()&&0===this.ignoredGrid.keysLength())return{};const r=[],i=new e.a2;for(const n of t){const t=new e.P(n.x+Ht,n.y+Ht);i.extend(t),r.push(t)}const{minX:n,minY:o,maxX:a,maxY:s}=i,l=this.grid.query(n,o,a,s).concat(this.ignoredGrid.query(n,o,a,s)),c={},h={};for(const t of l){const i=t.key;if(void 0===c[i.bucketInstanceId]&&(c[i.bucketInstanceId]={}),c[i.bucketInstanceId][i.featureIndex])continue;const n=[new e.P(t.x1,t.y1),new e.P(t.x2,t.y1),new e.P(t.x2,t.y2),new e.P(t.x1,t.y2)];e.az(r,n)&&(c[i.bucketInstanceId][i.featureIndex]=!0,void 0===h[i.bucketInstanceId]&&(h[i.bucketInstanceId]=[]),h[i.bucketInstanceId].push(i.featureIndex))}return h}insertCollisionBox(t,e,r,i,n,o){(r?this.ignoredGrid:this.grid).insert({bucketInstanceId:i,featureIndex:n,collisionGroupID:o,overlapMode:e},t[0],t[1],t[2],t[3])}insertCollisionCircles(t,e,r,i,n,o){const a=r?this.ignoredGrid:this.grid,s={bucketInstanceId:i,featureIndex:n,collisionGroupID:o,overlapMode:e};for(let e=0;e<t.length;e+=4)a.insertCircle(s,t[e],t[e+1],t[e+2])}projectAndGetPerspectiveRatio(t,r,i,n,o){if(o){let i;n?(i=[t,r,n(t,r),1],e.aw(i,i,o)):(i=[t,r,0,1],qt(i,i,o));const a=i[3];return{x:(i[0]/a+1)/2*this.transform.width+Ht,y:(-i[1]/a+1)/2*this.transform.height+Ht,perspectiveRatio:.5+this.transform.cameraToCenterDistance/a*.5,isOccluded:!1,signedDistanceFromCamera:a}}{const e=this.transform.projectTileCoordinates(t,r,i,n);return{x:(e.point.x+1)/2*this.transform.width+Ht,y:(1-e.point.y)/2*this.transform.height+Ht,perspectiveRatio:.5+this.transform.cameraToCenterDistance/e.signedDistanceFromCamera*.5,isOccluded:e.isOccluded,signedDistanceFromCamera:e.signedDistanceFromCamera}}}getPerspectiveRatio(t,e,r,i){const n=this.transform.projectTileCoordinates(t,e,r,i);return.5+this.transform.cameraToCenterDistance/n.signedDistanceFromCamera*.5}isOffscreen(t,e,r,i){return r<Ht||t>=this.screenRightBoundary||i<Ht||e>this.screenBottomBoundary}isInsideGrid(t,e,r,i){return r>=0&&t<this.gridRightBoundary&&i>=0&&e<this.gridBottomBoundary}getViewportMatrix(){const t=e.ag([]);return e.M(t,t,[-100,-100,0]),t}_projectCollisionBox(t,r,i,n,o,a,s,l,c,h,u){let p=1,d=0,f=0,m=1;const g=t.anchorPointX+s[0],_=t.anchorPointY+s[1];if(a&&!o){const t=this.projectAndGetPerspectiveRatio(g+1,_,n,c,u),e=t.x-l.x,r=Math.atan((t.y-l.y)/e)+(e<0?Math.PI:0),i=Math.sin(r),o=Math.cos(r);p=o,d=i,f=-i,m=o}else if(!a&&o){const t=At(this.transform);p=t.vecEast[0],d=t.vecEast[1],f=t.vecSouth[0],m=t.vecSouth[1]}let y=l.x,b=l.y,v=r;o&&(y=g,b=_,v=Math.pow(2,-(this.transform.zoom-i.overscaledZ)),v*=this.transform.getPitchedTextCorrection(g,_,n),h||(v*=e.ah(.5+l.signedDistanceFromCamera/this.transform.cameraToCenterDistance*.5,0,4))),h&&(y+=p*h.x*v+f*h.y*v,b+=d*h.x*v+m*h.y*v);const x=t.x1*v,w=t.x2*v,T=(x+w)/2,S=t.y1*v,P=t.y2*v,C=(S+P)/2,M=[{offsetX:x,offsetY:S},{offsetX:T,offsetY:S},{offsetX:w,offsetY:S},{offsetX:w,offsetY:C},{offsetX:w,offsetY:P},{offsetX:T,offsetY:P},{offsetX:x,offsetY:P},{offsetX:x,offsetY:C}];let A=[];for(const{offsetX:t,offsetY:r}of M)A.push(new e.P(y+p*t+f*r,b+d*t+m*r));let I=!1;if(o){const t=A.map(t=>this.projectAndGetPerspectiveRatio(t.x,t.y,n,c,u));I=t.some(t=>!t.isOccluded),A=t.map(t=>new e.P(t.x,t.y))}else I=!0;return{box:e.aA(A),allPointsOccluded:!I}}}class Xt{constructor(t,e,r,i){this.opacity=t?Math.max(0,Math.min(1,t.opacity+(t.placed?e:-e))):i&&r?1:0,this.placed=r}isHidden(){return 0===this.opacity&&!this.placed}}class Kt{constructor(t,e,r,i,n){this.text=new Xt(t?t.text:null,e,r,n),this.icon=new Xt(t?t.icon:null,e,i,n)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class Yt{constructor(t,e,r){this.text=t,this.icon=e,this.skipFade=r}}class Jt{constructor(t,e,r,i,n){this.bucketInstanceId=t,this.featureIndex=e,this.sourceLayerIndex=r,this.bucketIndex=i,this.tileID=n}}class Qt{constructor(t){this.crossSourceCollisions=t,this.maxGroupID=0,this.collisionGroups={}}get(t){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[t]){const e=++this.maxGroupID;this.collisionGroups[t]={ID:e,predicate:t=>t.collisionGroupID===e}}return this.collisionGroups[t]}}function te(t,r,i,n,o){const{horizontalAlign:a,verticalAlign:s}=e.aH(t);return new e.P(-(a-.5)*r+n[0]*o,-(s-.5)*i+n[1]*o)}class ee{constructor(t,e,r,i,n){this.transform=t.clone(),this.terrain=e,this.collisionIndex=new Wt(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=r,this.retainedQueryData={},this.collisionGroups=new Qt(i),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=n,n&&(n.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(t){const e=this.terrain;return e?(r,i)=>e.getElevation(t,r,i):null}getBucketParts(t,r,i,n){const o=i.getBucket(r),a=i.latestFeatureIndex;if(!o||!a||r.id!==o.layerIds[0])return;const s=i.collisionBoxArray,l=o.layers[0].layout,c=o.layers[0].paint,h=Math.pow(2,this.transform.zoom-i.tileID.overscaledZ),u=i.tileSize/e.$,p=i.tileID.toUnwrapped(),d="map"===l.get("text-rotation-alignment"),f=e.aC(i,1,this.transform.zoom),m=e.aD(this.collisionIndex.transform,i,c.get("text-translate"),c.get("text-translate-anchor")),g=e.aD(this.collisionIndex.transform,i,c.get("icon-translate"),c.get("icon-translate-anchor")),_=Ct(d,this.transform,f);this.retainedQueryData[o.bucketInstanceId]=new Jt(o.bucketInstanceId,a,o.sourceLayerIndex,o.index,i.tileID);const y={bucket:o,layout:l,translationText:m,translationIcon:g,unwrappedTileID:p,pitchedLabelPlaneMatrix:_,scale:h,textPixelRatio:u,holdingForFade:i.holdingForFade(),collisionBoxArray:s,partiallyEvaluatedTextSize:e.an(o.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(o.sourceID)};if(n)for(const e of o.sortKeyRanges){const{sortKey:r,symbolInstanceStart:i,symbolInstanceEnd:n}=e;t.push({sortKey:r,symbolInstanceStart:i,symbolInstanceEnd:n,parameters:y})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:o.symbolInstances.length,parameters:y})}attemptAnchorPlacement(t,r,i,n,o,a,s,l,c,h,u,p,d,f,m,g,_,y,b,v){const x=e.aE[t.textAnchor],w=[t.textOffset0,t.textOffset1],T=te(x,i,n,w,o),S=this.collisionIndex.placeCollisionBox(r,p,l,c,h,s,a,g,u.predicate,b,T,v);if((!y||this.collisionIndex.placeCollisionBox(y,p,l,c,h,s,a,_,u.predicate,b,T,v).placeable)&&S.placeable){let t;if(this.prevPlacement&&this.prevPlacement.variableOffsets[d.crossTileID]&&this.prevPlacement.placements[d.crossTileID]&&this.prevPlacement.placements[d.crossTileID].text&&(t=this.prevPlacement.variableOffsets[d.crossTileID].anchor),0===d.crossTileID)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[d.crossTileID]={textOffset:w,width:i,height:n,anchor:x,textBoxScale:o,prevAnchor:t},this.markUsedJustification(f,x,d,m),f.allowVerticalPlacement&&(this.markUsedOrientation(f,m,d),this.placedOrientations[d.crossTileID]=m),{shift:T,placedGlyphBoxes:S}}}placeLayerBucketPart(t,r,i){const{bucket:n,layout:o,translationText:a,translationIcon:s,unwrappedTileID:l,pitchedLabelPlaneMatrix:c,textPixelRatio:h,holdingForFade:u,collisionBoxArray:p,partiallyEvaluatedTextSize:d,collisionGroup:f}=t.parameters,m=o.get("text-optional"),g=o.get("icon-optional"),_=e.aF(o,"text-overlap","text-allow-overlap"),y="always"===_,b=e.aF(o,"icon-overlap","icon-allow-overlap"),v="always"===b,x="map"===o.get("text-rotation-alignment"),w="map"===o.get("text-pitch-alignment"),T="none"!==o.get("icon-text-fit"),S="viewport-y"===o.get("symbol-z-order"),P=y&&(v||!n.hasIconData()||g),C=v&&(y||!n.hasTextData()||m);!n.collisionArrays&&p&&n.deserializeCollisionBoxes(p);const M=this.retainedQueryData[n.bucketInstanceId].tileID,A=this._getTerrainElevationFunc(M),I=this.transform.getFastPathSimpleProjectionMatrix(M),E=(t,p,v)=>{var S,E;if(r[t.crossTileID])return;if(u)return void(this.placements[t.crossTileID]=new Yt(!1,!1,!1));let k=!1,z=!1,R=!0,D=null,L={box:null,placeable:!1,offscreen:null,occluded:!1},F={placeable:!1},B=null,O=null,j=null,U=0,N=0,V=0;p.textFeatureIndex?U=p.textFeatureIndex:t.useRuntimeCollisionCircles&&(U=t.featureIndex),p.verticalTextFeatureIndex&&(N=p.verticalTextFeatureIndex);const $=p.textBox;if($){const r=r=>{let i=e.ao.horizontal;if(n.allowVerticalPlacement&&!r&&this.prevPlacement){const e=this.prevPlacement.placedOrientations[t.crossTileID];e&&(this.placedOrientations[t.crossTileID]=e,i=e,this.markUsedOrientation(n,i,t))}return i},o=(r,i)=>{if(n.allowVerticalPlacement&&t.numVerticalGlyphVertices>0&&p.verticalTextBox){for(const t of n.writingModes)if(t===e.ao.vertical?(L=i(),F=L):L=r(),L&&L.placeable)break}else L=r()},c=t.textAnchorOffsetStartIndex,u=t.textAnchorOffsetEndIndex;if(u===c){const i=(e,r)=>{const i=this.collisionIndex.placeCollisionBox(e,_,h,M,l,w,x,a,f.predicate,A,void 0,I);return i&&i.placeable&&(this.markUsedOrientation(n,r,t),this.placedOrientations[t.crossTileID]=r),i};o(()=>i($,e.ao.horizontal),()=>{const r=p.verticalTextBox;return n.allowVerticalPlacement&&t.numVerticalGlyphVertices>0&&r?i(r,e.ao.vertical):{box:null,offscreen:null}}),r(L&&L.placeable)}else{let d=e.aE[null===(E=null===(S=this.prevPlacement)||void 0===S?void 0:S.variableOffsets[t.crossTileID])||void 0===E?void 0:E.anchor];const m=(e,r,o)=>{const p=e.x2-e.x1,m=e.y2-e.y1,g=t.textBoxScale,y=T&&"never"===b?r:null;let v=null,S="never"===_?1:2,P="never";d&&S++;for(let r=0;r<S;r++){for(let r=c;r<u;r++){const i=n.textAnchorOffsets.get(r);if(d&&i.textAnchor!==d)continue;const c=this.attemptAnchorPlacement(i,e,p,m,g,x,w,h,M,l,f,P,t,n,o,a,s,y,A);if(c&&(v=c.placedGlyphBoxes,v&&v.placeable))return k=!0,D=c.shift,v}d?d=null:P=_}return i&&!v&&(v={box:this.collisionIndex.placeCollisionBox($,"always",h,M,l,w,x,a,f.predicate,A,void 0,I).box,offscreen:!1,placeable:!1,occluded:!1}),v};o(()=>m($,p.iconBox,e.ao.horizontal),()=>{const r=p.verticalTextBox;return n.allowVerticalPlacement&&(!L||!L.placeable)&&t.numVerticalGlyphVertices>0&&r?m(r,p.verticalIconBox,e.ao.vertical):{box:null,occluded:!0,offscreen:null}}),L&&(k=L.placeable,R=L.offscreen);const g=r(L&&L.placeable);if(!k&&this.prevPlacement){const e=this.prevPlacement.variableOffsets[t.crossTileID];e&&(this.variableOffsets[t.crossTileID]=e,this.markUsedJustification(n,e.anchor,t,g))}}}if(B=L,k=B&&B.placeable,R=B&&B.offscreen,t.useRuntimeCollisionCircles){const r=n.text.placedSymbolArray.get(t.centerJustifiedTextSymbolIndex),s=e.ap(n.textSizeData,d,r),h=o.get("text-padding");O=this.collisionIndex.placeCollisionCircles(_,r,n.lineVertexArray,n.glyphOffsetArray,s,l,c,i,w,f.predicate,t.collisionCircleDiameter,h,a,A),O.circles.length&&O.collisionDetected&&!i&&e.w("Collisions detected, but collision boxes are not shown"),k=y||O.circles.length>0&&!O.collisionDetected,R=R&&O.offscreen}if(p.iconFeatureIndex&&(V=p.iconFeatureIndex),p.iconBox){const t=t=>this.collisionIndex.placeCollisionBox(t,b,h,M,l,w,x,s,f.predicate,A,T&&D?D:void 0,I);F&&F.placeable&&p.verticalIconBox?(j=t(p.verticalIconBox),z=j.placeable):(j=t(p.iconBox),z=j.placeable),R=R&&j.offscreen}const Z=m||0===t.numHorizontalGlyphVertices&&0===t.numVerticalGlyphVertices,G=g||0===t.numIconVertices;Z||G?G?Z||(z=z&&k):k=z&&k:z=k=z&&k;const q=z&&j.placeable;if(k&&B.placeable&&this.collisionIndex.insertCollisionBox(B.box,_,o.get("text-ignore-placement"),n.bucketInstanceId,F&&F.placeable&&N?N:U,f.ID),q&&this.collisionIndex.insertCollisionBox(j.box,b,o.get("icon-ignore-placement"),n.bucketInstanceId,V,f.ID),O&&k&&this.collisionIndex.insertCollisionCircles(O.circles,_,o.get("text-ignore-placement"),n.bucketInstanceId,U,f.ID),i&&this.storeCollisionData(n.bucketInstanceId,v,p,B,j,O),0===t.crossTileID)throw new Error("symbolInstance.crossTileID can't be 0");if(0===n.bucketInstanceId)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[t.crossTileID]=new Yt((k||P)&&!(null==B?void 0:B.occluded),(z||C)&&!(null==j?void 0:j.occluded),R||n.justReloaded),r[t.crossTileID]=!0};if(S){if(0!==t.symbolInstanceStart)throw new Error("bucket.bucketInstanceId should be 0");const e=n.getSortedSymbolIndexes(-this.transform.bearingInRadians);for(let t=e.length-1;t>=0;--t){const r=e[t];E(n.symbolInstances.get(r),n.collisionArrays[r],r)}}else for(let e=t.symbolInstanceStart;e<t.symbolInstanceEnd;e++)E(n.symbolInstances.get(e),n.collisionArrays[e],e);n.justReloaded=!1}storeCollisionData(t,e,r,i,n,o){if(r.textBox||r.iconBox){let o,a;this.collisionBoxArrays.has(t)?o=this.collisionBoxArrays.get(t):(o=new Map,this.collisionBoxArrays.set(t,o)),o.has(e)?a=o.get(e):(a={text:null,icon:null},o.set(e,a)),r.textBox&&(a.text=i.box),r.iconBox&&(a.icon=n.box)}if(o){let e=this.collisionCircleArrays[t];void 0===e&&(e=this.collisionCircleArrays[t]=[]);for(let t=0;t<o.circles.length;t+=4)e.push(o.circles[t+0]-Ht),e.push(o.circles[t+1]-Ht),e.push(o.circles[t+2]),e.push(o.collisionDetected?1:0)}}markUsedJustification(t,r,i,n){let o;o=n===e.ao.vertical?i.verticalPlacedTextSymbolIndex:{left:i.leftJustifiedTextSymbolIndex,center:i.centerJustifiedTextSymbolIndex,right:i.rightJustifiedTextSymbolIndex}[e.aG(r)];const a=[i.leftJustifiedTextSymbolIndex,i.centerJustifiedTextSymbolIndex,i.rightJustifiedTextSymbolIndex,i.verticalPlacedTextSymbolIndex];for(const e of a)e>=0&&(t.text.placedSymbolArray.get(e).crossTileID=o>=0&&e!==o?0:i.crossTileID)}markUsedOrientation(t,r,i){const n=r===e.ao.horizontal||r===e.ao.horizontalOnly?r:0,o=r===e.ao.vertical?r:0,a=[i.leftJustifiedTextSymbolIndex,i.centerJustifiedTextSymbolIndex,i.rightJustifiedTextSymbolIndex];for(const e of a)t.text.placedSymbolArray.get(e).placedOrientation=n;i.verticalPlacedTextSymbolIndex&&(t.text.placedSymbolArray.get(i.verticalPlacedTextSymbolIndex).placedOrientation=o)}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;const e=this.prevPlacement;let r=!1;this.prevZoomAdjustment=e?e.zoomAdjustment(this.transform.zoom):0;const i=e?e.symbolFadeChange(t):1,n=e?e.opacities:{},o=e?e.variableOffsets:{},a=e?e.placedOrientations:{};for(const t in this.placements){const e=this.placements[t],o=n[t];o?(this.opacities[t]=new Kt(o,i,e.text,e.icon),r=r||e.text!==o.text.placed||e.icon!==o.icon.placed):(this.opacities[t]=new Kt(null,i,e.text,e.icon,e.skipFade),r=r||e.text||e.icon)}for(const t in n){const e=n[t];if(!this.opacities[t]){const n=new Kt(e,i,!1,!1);n.isHidden()||(this.opacities[t]=n,r=r||e.text.placed||e.icon.placed)}}for(const t in o)this.variableOffsets[t]||!this.opacities[t]||this.opacities[t].isHidden()||(this.variableOffsets[t]=o[t]);for(const t in a)this.placedOrientations[t]||!this.opacities[t]||this.opacities[t].isHidden()||(this.placedOrientations[t]=a[t]);if(e&&void 0===e.lastPlacementChangeTime)throw new Error("Last placement time for previous placement is not defined");r?this.lastPlacementChangeTime=t:"number"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=e?e.lastPlacementChangeTime:t)}updateLayerOpacities(t,e){const r={};for(const i of e){const e=i.getBucket(t);e&&i.latestFeatureIndex&&t.id===e.layerIds[0]&&this.updateBucketOpacities(e,i.tileID,r,i.collisionBoxArray)}}updateBucketOpacities(t,r,i,n){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();const o=t.layers[0],a=o.layout,s=new Kt(null,0,!1,!1,!0),l=a.get("text-allow-overlap"),c=a.get("icon-allow-overlap"),h=o._unevaluatedLayout.hasValue("text-variable-anchor")||o._unevaluatedLayout.hasValue("text-variable-anchor-offset"),u="map"===a.get("text-rotation-alignment"),p="map"===a.get("text-pitch-alignment"),d="none"!==a.get("icon-text-fit"),f=new Kt(null,0,l&&(c||!t.hasIconData()||a.get("icon-optional")),c&&(l||!t.hasTextData()||a.get("text-optional")),!0);!t.collisionArrays&&n&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(n);const m=(t,e,r)=>{for(let i=0;i<e/4;i++)t.opacityVertexArray.emplaceBack(r);t.hasVisibleVertices=t.hasVisibleVertices||r!==ue},g=this.collisionBoxArrays.get(t.bucketInstanceId);for(let r=0;r<t.symbolInstances.length;r++){const n=t.symbolInstances.get(r),{numHorizontalGlyphVertices:o,numVerticalGlyphVertices:a,crossTileID:l}=n;let c=this.opacities[l];i[l]?c=s:c||(c=f,this.opacities[l]=c),i[l]=!0;const _=n.numIconVertices>0,y=this.placedOrientations[n.crossTileID],b=y===e.ao.vertical,v=y===e.ao.horizontal||y===e.ao.horizontalOnly;if(o>0||a>0){const e=he(c.text);m(t.text,o,b?ue:e),m(t.text,a,v?ue:e);const r=c.text.isHidden();[n.rightJustifiedTextSymbolIndex,n.centerJustifiedTextSymbolIndex,n.leftJustifiedTextSymbolIndex].forEach(e=>{e>=0&&(t.text.placedSymbolArray.get(e).hidden=r||b?1:0)}),n.verticalPlacedTextSymbolIndex>=0&&(t.text.placedSymbolArray.get(n.verticalPlacedTextSymbolIndex).hidden=r||v?1:0);const i=this.variableOffsets[n.crossTileID];i&&this.markUsedJustification(t,i.anchor,n,y);const s=this.placedOrientations[n.crossTileID];s&&(this.markUsedJustification(t,"left",n,s),this.markUsedOrientation(t,s,n))}if(_){const e=he(c.icon),r=!(d&&n.verticalPlacedIconSymbolIndex&&b);n.placedIconSymbolIndex>=0&&(m(t.icon,n.numIconVertices,r?e:ue),t.icon.placedSymbolArray.get(n.placedIconSymbolIndex).hidden=c.icon.isHidden()),n.verticalPlacedIconSymbolIndex>=0&&(m(t.icon,n.numVerticalIconVertices,r?ue:e),t.icon.placedSymbolArray.get(n.verticalPlacedIconSymbolIndex).hidden=c.icon.isHidden())}const x=g&&g.has(r)?g.get(r):{text:null,icon:null};if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){const i=t.collisionArrays[r];if(i){let r=new e.P(0,0);if(i.textBox||i.verticalTextBox){let e=!0;if(h){const t=this.variableOffsets[l];t?(r=te(t.anchor,t.width,t.height,t.textOffset,t.textBoxScale),u&&r._rotate(p?-this.transform.bearingInRadians:this.transform.bearingInRadians)):e=!1}if(i.textBox||i.verticalTextBox){let n;i.textBox&&(n=b),i.verticalTextBox&&(n=v),re(t.textCollisionBox.collisionVertexArray,c.text.placed,!e||n,x.text,r.x,r.y)}}if(i.iconBox||i.verticalIconBox){const e=Boolean(!v&&i.verticalIconBox);let n;i.iconBox&&(n=e),i.verticalIconBox&&(n=!e),re(t.iconCollisionBox.collisionVertexArray,c.icon.placed,n,x.icon,d?r.x:0,d?r.y:0)}}}}if(t.sortFeatures(-this.transform.bearingInRadians),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 (= ${t.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${t.text.layoutVertexArray.length}) / 4`);if(t.icon.opacityVertexArray.length!==t.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${t.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${t.icon.layoutVertexArray.length}) / 4`);t.bucketInstanceId in this.collisionCircleArrays&&(t.collisionCircleArray=this.collisionCircleArrays[t.bucketInstanceId],delete this.collisionCircleArrays[t.bucketInstanceId])}symbolFadeChange(t){return 0===this.fadeDuration?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){const r=this.zoomAtLastRecencyCheck===e?1-this.zoomAdjustment(e):1;return this.zoomAtLastRecencyCheck=e,this.commitTime+this.fadeDuration*r>t}setStale(){this.stale=!0}}function re(t,e,r,i,n,o){i&&0!==i.length||(i=[0,0,0,0]);const a=i[0]-Ht,s=i[1]-Ht,l=i[2]-Ht,c=i[3]-Ht;t.emplaceBack(e?1:0,r?1:0,n||0,o||0,a,s),t.emplaceBack(e?1:0,r?1:0,n||0,o||0,l,s),t.emplaceBack(e?1:0,r?1:0,n||0,o||0,l,c),t.emplaceBack(e?1:0,r?1:0,n||0,o||0,a,c)}const ie=Math.pow(2,25),ne=Math.pow(2,24),oe=Math.pow(2,17),ae=Math.pow(2,16),se=Math.pow(2,9),le=Math.pow(2,8),ce=Math.pow(2,1);function he(t){if(0===t.opacity&&!t.placed)return 0;if(1===t.opacity&&t.placed)return 4294967295;const e=t.placed?1:0,r=Math.floor(127*t.opacity);return r*ie+e*ne+r*oe+e*ae+r*se+e*le+r*ce+e}const ue=0;class pe{constructor(t){this._sortAcrossTiles="viewport-y"!==t.layout.get("symbol-z-order")&&!t.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(t,e,r,i,n){const o=this._bucketParts;for(;this._currentTileIndex<t.length;)if(e.getBucketParts(o,i,t[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,n())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,o.sort((t,e)=>t.sortKey-e.sortKey));this._currentPartIndex<o.length;)if(e.placeLayerBucketPart(o[this._currentPartIndex],this._seenCrossTileIDs,r),this._currentPartIndex++,n())return!0;return!1}}class de{constructor(t,e,r,i,n,o,a,s){this.placement=new ee(t,e,o,a,s),this._currentPlacementIndex=r.length-1,this._forceFullPlacement=i,this._showCollisionBoxes=n,this._done=!1}isDone(){return this._done}continuePlacement(t,e,r){const i=a.now(),n=()=>!this._forceFullPlacement&&a.now()-i>2;for(;this._currentPlacementIndex>=0;){const i=e[t[this._currentPlacementIndex]],o=this.placement.collisionIndex.transform.zoom;if("symbol"===i.type&&(!i.minzoom||i.minzoom<=o)&&(!i.maxzoom||i.maxzoom>o)){if(this._inProgressLayer||(this._inProgressLayer=new pe(i)),this._inProgressLayer.continuePlacement(r[i.source],this.placement,this._showCollisionBoxes,i,n))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(t){return this.placement.commit(t),this.placement}}const fe=512/e.$/2;class me{constructor(t,r,i){this.tileID=t,this.bucketInstanceId=i,this._symbolsByKey={};const n=new Map;for(let t=0;t<r.length;t++){const e=r.get(t),i=e.key,o=n.get(i);o?o.push(e):n.set(i,[e])}for(const[t,r]of n){const i={positions:r.map(t=>({x:Math.floor(t.anchorX*fe),y:Math.floor(t.anchorY*fe)})),crossTileIDs:r.map(t=>t.crossTileID)};if(i.positions.length>128){const t=new e.aI(i.positions.length,16,Uint16Array);for(const{x:e,y:r}of i.positions)t.add(e,r);t.finish(),delete i.positions,i.index=t}this._symbolsByKey[t]=i}}getScaledCoordinates(t,r){const{x:i,y:n,z:o}=this.tileID.canonical,{x:a,y:s,z:l}=r.canonical,c=fe/Math.pow(2,l-o),h=(s*e.$+t.anchorY)*c,u=n*e.$*fe;return{x:Math.floor((a*e.$+t.anchorX)*c-i*e.$*fe),y:Math.floor(h-u)}}findMatches(t,e,r){const 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++){const o=t.get(n);if(o.crossTileID)continue;const a=this._symbolsByKey[o.key];if(!a)continue;const s=this.getScaledCoordinates(o,e);if(a.index){const t=a.index.range(s.x-i,s.y-i,s.x+i,s.y+i).sort();for(const e of t){const t=a.crossTileIDs[e];if(!r[t]){r[t]=!0,o.crossTileID=t;break}}}else if(a.positions)for(let t=0;t<a.positions.length;t++){const e=a.positions[t],n=a.crossTileIDs[t];if(Math.abs(e.x-s.x)<=i&&Math.abs(e.y-s.y)<=i&&!r[n]){r[n]=!0,o.crossTileID=n;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map(({crossTileIDs:t})=>t)}}class ge{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class _e{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(t){const e=Math.round((t-this.lng)/360);if(0!==e)for(const t in this.indexes){const r=this.indexes[t],i={};for(const t in r){const n=r[t];n.tileID=n.tileID.unwrapTo(n.tileID.wrap+e),i[n.tileID.key]=n}this.indexes[t]=i}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 t=0;t<e.symbolInstances.length;t++)e.symbolInstances.get(t).crossTileID=0;this.usedCrossTileIDs[t.overscaledZ]||(this.usedCrossTileIDs[t.overscaledZ]={});const i=this.usedCrossTileIDs[t.overscaledZ];for(const r in this.indexes){const n=this.indexes[r];if(Number(r)>t.overscaledZ)for(const r in n){const o=n[r];o.tileID.isChildOf(t)&&o.findMatches(e.symbolInstances,t,i)}else{const o=n[t.scaledTo(Number(r)).key];o&&o.findMatches(e.symbolInstances,t,i)}}for(let t=0;t<e.symbolInstances.length;t++){const n=e.symbolInstances.get(t);n.crossTileID||(n.crossTileID=r.generate(),i[n.crossTileID]=!0)}return void 0===this.indexes[t.overscaledZ]&&(this.indexes[t.overscaledZ]={}),this.indexes[t.overscaledZ][t.key]=new me(t,e.symbolInstances,e.bucketInstanceId),!0}removeBucketCrossTileIDs(t,e){for(const r of e.getCrossTileIDsLists())for(const e of r)delete this.usedCrossTileIDs[t][e]}removeStaleBuckets(t){let e=!1;for(const r in this.indexes){const i=this.indexes[r];for(const n in i)t[i[n].bucketInstanceId]||(this.removeBucketCrossTileIDs(r,i[n]),delete i[n],e=!0)}return e}}class ye{constructor(){this.layerIndexes={},this.crossTileIDs=new ge,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(t,e,r){let i=this.layerIndexes[t.id];void 0===i&&(i=this.layerIndexes[t.id]=new _e);let n=!1;const o={};i.handleWrapJump(r);for(const r of e){const e=r.getBucket(t);e&&t.id===e.layerIds[0]&&(e.bucketInstanceId||(e.bucketInstanceId=++this.maxBucketInstanceId),i.addBucket(r.tileID,e,this.crossTileIDs)&&(n=!0),o[e.bucketInstanceId]=!0)}return i.removeStaleBuckets(o)&&(n=!0),n}pruneUnusedLayers(t){const e={};t.forEach(t=>{e[t]=!0});for(const t in this.layerIndexes)e[t]||delete this.layerIndexes[t]}}var be="void main() {fragColor=vec4(1.0);}";const ve={prelude:xe("#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\nout highp vec4 fragColor;","#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;}mat3 rotationMatrixFromAxisAngle(vec3 u,float angle) {float c=cos(angle);float s=sin(angle);float c2=1.0-c;return mat3(u.x*u.x*c2+ c,u.x*u.y*c2-u.z*s,u.x*u.z*c2+u.y*s,u.y*u.x*c2+u.z*s,u.y*u.y*c2+ c,u.y*u.z*c2-u.x*s,u.z*u.x*c2-u.y*s,u.z*u.y*c2+u.x*s,u.z*u.z*c2+ c\n);}\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(texture(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=(texture(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\n#ifdef GLOBE\nif ((pos.y <-32767.5) || (pos.y > 32766.5)) {return 0.0;}\n#endif\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}const float PI=3.141592653589793;uniform mat4 u_projection_matrix;"),projectionMercator:xe("","float projectLineThickness(float tileY) {return 1.0;}float projectCircleRadius(float tileY) {return 1.0;}vec4 projectTile(vec2 p) {vec4 result=u_projection_matrix*vec4(p,0.0,1.0);return result;}vec4 projectTile(vec2 p,vec2 rawPos) {vec4 result=u_projection_matrix*vec4(p,0.0,1.0);if (rawPos.y <-32767.5 || rawPos.y > 32766.5) {result.z=-10000000.0;}return result;}vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_projection_matrix*vec4(posInTile,elevation,1.0);}vec4 projectTileFor3D(vec2 posInTile,float elevation) {return projectTileWithElevation(posInTile,elevation);}"),projectionGlobe:xe("","#define GLOBE_RADIUS 6371008.8\nuniform highp vec4 u_projection_tile_mercator_coords;uniform highp vec4 u_projection_clipping_plane;uniform highp float u_projection_transition;uniform mat4 u_projection_fallback_matrix;vec3 globeRotateVector(vec3 vec,vec2 angles) {vec3 axisRight=vec3(vec.z,0.0,-vec.x);vec3 axisUp=cross(axisRight,vec);axisRight=normalize(axisRight);axisUp=normalize(axisUp);vec2 t=tan(angles);return normalize(vec+axisRight*t.x+axisUp*t.y);}mat3 globeGetRotationMatrix(vec3 spherePos) {vec3 axisRight=vec3(spherePos.z,0.0,-spherePos.x);vec3 axisDown=cross(axisRight,spherePos);axisRight=normalize(axisRight);axisDown=normalize(axisDown);return mat3(axisRight,axisDown,spherePos\n);}float circumferenceRatioAtTileY(float tileY) {float mercator_pos_y=u_projection_tile_mercator_coords.y+u_projection_tile_mercator_coords.w*tileY;float spherical_y=2.0*atan(exp(PI-(mercator_pos_y*PI*2.0)))-PI*0.5;return cos(spherical_y);}float projectLineThickness(float tileY) {float thickness=1.0/circumferenceRatioAtTileY(tileY); \nif (u_projection_transition < 0.999) {return mix(1.0,thickness,u_projection_transition);} else {return thickness;}}vec3 projectToSphere(vec2 translatedPos,vec2 rawPos) {vec2 mercator_pos=u_projection_tile_mercator_coords.xy+u_projection_tile_mercator_coords.zw*translatedPos;vec2 spherical;spherical.x=mercator_pos.x*PI*2.0+PI;spherical.y=2.0*atan(exp(PI-(mercator_pos.y*PI*2.0)))-PI*0.5;float len=cos(spherical.y);vec3 pos=vec3(sin(spherical.x)*len,sin(spherical.y),cos(spherical.x)*len\n);if (rawPos.y <-32767.5) {pos=vec3(0.0,1.0,0.0);}if (rawPos.y > 32766.5) {pos=vec3(0.0,-1.0,0.0);}return pos;}vec3 projectToSphere(vec2 posInTile) {return projectToSphere(posInTile,vec2(0.0,0.0));}float globeComputeClippingZ(vec3 spherePos) {return (1.0-(dot(spherePos,u_projection_clipping_plane.xyz)+u_projection_clipping_plane.w));}vec4 interpolateProjection(vec2 posInTile,vec3 spherePos,float elevation) {vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);globePosition.z=globeComputeClippingZ(elevatedPos)*globePosition.w;if (u_projection_transition > 0.999) {return globePosition;}vec4 flatPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);const float z_globeness_threshold=0.2;vec4 result=globePosition;result.z=mix(0.0,globePosition.z,clamp((u_projection_transition-z_globeness_threshold)/(1.0-z_globeness_threshold),0.0,1.0));result.xyw=mix(flatPosition.xyw,globePosition.xyw,u_projection_transition);if ((posInTile.y <-32767.5) || (posInTile.y > 32766.5)) {result=globePosition;const float poles_hidden_anim_percentage=0.02;result.z=mix(globePosition.z,100.0,pow(max((1.0-u_projection_transition)/poles_hidden_anim_percentage,0.0),8.0));}return result;}vec4 interpolateProjectionFor3D(vec2 posInTile,vec3 spherePos,float elevation) {vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);if (u_projection_transition > 0.999) {return globePosition;}vec4 fallbackPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);return mix(fallbackPosition,globePosition,u_projection_transition);}vec4 projectTile(vec2 posInTile) {return interpolateProjection(posInTile,projectToSphere(posInTile),0.0);}vec4 projectTile(vec2 posInTile,vec2 rawPos) {return interpolateProjection(posInTile,projectToSphere(posInTile,rawPos),0.0);}vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return interpolateProjection(posInTile,projectToSphere(posInTile),elevation);}vec4 projectTileFor3D(vec2 posInTile,float elevation) {vec3 spherePos=projectToSphere(posInTile,posInTile);return interpolateProjectionFor3D(posInTile,spherePos,elevation);}"),background:xe("uniform vec4 u_color;uniform float u_opacity;void main() {fragColor=u_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),backgroundPattern:xe("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;in vec2 v_pos_a;in 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=texture(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=texture(u_image,pos2);fragColor=mix(color1,color2,u_mix)*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","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;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;void main() {gl_Position=projectTile(a_pos);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);}"),circle:xe("in vec3 v_data;in 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);float antialiased_blur=v_data.z;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));fragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);const float epsilon=0.5/255.0;if (fragColor.r < epsilon && fragColor.g < epsilon && fragColor.b < epsilon && fragColor.a < epsilon) {discard;}\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform highp float u_globe_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;uniform vec2 u_translate;in vec2 a_pos;out vec3 v_data;out 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 pos_raw=a_pos+32768.0;vec2 extrude=vec2(mod(pos_raw,8.0)/7.0*2.0-1.0);vec2 circle_center=floor(pos_raw/8.0)+u_translate;float ele=get_elevation(circle_center);v_visibility=calculate_visibility(projectTileWithElevation(circle_center,ele));if (u_pitch_with_map) {\n#ifdef GLOBE\nvec3 center_vector=projectToSphere(circle_center);\n#endif\nfloat angle_scale=u_globe_extrude_scale;vec2 corner_position=circle_center;if (u_scale_with_map) {angle_scale*=(radius+stroke_width);corner_position+=extrude*u_extrude_scale*(radius+stroke_width);} else {\n#ifdef GLOBE\nvec4 projected_center=interpolateProjection(circle_center,center_vector,ele);\n#else\nvec4 projected_center=projectTileWithElevation(circle_center,ele);\n#endif\ncorner_position+=extrude*u_extrude_scale*(radius+stroke_width)*(projected_center.w/u_camera_to_center_distance);angle_scale*=(radius+stroke_width)*(projected_center.w/u_camera_to_center_distance);}\n#ifdef GLOBE\nvec2 angles=extrude*angle_scale;vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(corner_position,corner_vector,ele);\n#else\ngl_Position=projectTileWithElevation(corner_position,ele);\n#endif\n} else {gl_Position=projectTileWithElevation(circle_center,ele);if (gl_Position.z/gl_Position.w > 1.0) {gl_Position.xy=vec2(10000.0);}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;}}float antialiasblur=-max(1.0/u_device_pixel_ratio/(radius+stroke_width),blur);v_data=vec3(extrude.x,extrude.y,antialiasblur);}"),clippingMask:xe(be,"in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),heatmap:xe("uniform highp float u_intensity;in 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);fragColor=vec4(val,1.0,1.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;uniform highp float u_globe_extrude_scale;in vec2 a_pos;out 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 pos_raw=a_pos+32768.0;vec2 unscaled_extrude=vec2(mod(pos_raw,8.0)/7.0*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec2 circle_center=floor(pos_raw/8.0);\n#ifdef GLOBE\nvec2 angles=v_extrude*radius*u_globe_extrude_scale;vec3 center_vector=projectToSphere(circle_center);vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(circle_center+extrude,corner_vector,0.0);\n#else\ngl_Position=projectTileFor3D(circle_center+extrude,get_elevation(circle_center));\n#endif\n}"),heatmapTexture:xe("uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;in vec2 v_pos;void main() {float t=texture(u_image,v_pos).r;vec4 color=texture(u_color_ramp,vec2(t,0.5));fragColor=color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(0.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_world;in vec2 a_pos;out 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;}"),collisionBox:xe("in float v_placed;in float v_notUsed;void main() {float alpha=0.5;fragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {fragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {fragColor*=.1;}}","in vec2 a_anchor_pos;in vec2 a_placed;in vec2 a_box_real;uniform vec2 u_pixel_extrude_scale;out float v_placed;out float v_notUsed;void main() {gl_Position=projectTileWithElevation(a_anchor_pos,get_elevation(a_anchor_pos));gl_Position.xy=((a_box_real+0.5)*u_pixel_extrude_scale*2.0-1.0)*vec2(1.0,-1.0)*gl_Position.w;if (gl_Position.z/gl_Position.w < 1.1) {gl_Position.z=0.5;}v_placed=a_placed.x;v_notUsed=a_placed.y;}"),collisionCircle:xe("in float v_radius;in vec2 v_extrude;in float v_collision;void main() {float alpha=0.5;float stroke_radius=0.9;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);fragColor=color*alpha*opacity_t;}","in vec2 a_pos;in float a_radius;in vec2 a_flags;uniform vec2 u_viewport_size;out float v_radius;out vec2 v_extrude;out float v_collision;void main() {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;float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_collision=collision;gl_Position=vec4((a_pos/u_viewport_size*2.0-1.0)*vec2(1.0,-1.0),0.0,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),colorRelief:xe("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;uniform vec4 u_unpack;uniform sampler2D u_elevation_stops;uniform sampler2D u_color_stops;uniform int u_color_ramp_size;uniform float u_opacity;in vec2 v_pos;float getElevation(vec2 coord) {vec4 data=texture(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack);}float getElevationStop(int stop) {float x=(float(stop)+0.5)/float(u_color_ramp_size);vec4 data=texture(u_elevation_stops,vec2(x,0))*255.0;data.a=-1.0;return dot(data,u_unpack);}void main() {float el=getElevation(v_pos);int r=(u_color_ramp_size-1);int l=0;float el_l=getElevationStop(l);float el_r=getElevationStop(r);while(r-l > 1){int m=(r+l)/2;float el_m=getElevationStop(m);if(el < el_m){r=m;el_r=el_m;}else\n{l=m;el_l=el_m;}}float x=(float(l)+(el-el_l)/(el_r-el_l)+0.5)/float(u_color_ramp_size);fragColor=u_opacity*texture(u_color_stops,vec2(x,0));\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_dimension;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=projectTile(a_pos,a_pos);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_pos/8192.0)*scale+epsilon;if (a_pos.y <-32767.5) {v_pos.y=0.0;}if (a_pos.y > 32766.5) {v_pos.y=1.0;}}"),debug:xe("uniform highp vec4 u_color;uniform sampler2D u_overlay;in vec2 v_uv;void main() {vec4 overlay_color=texture(u_overlay,v_uv);fragColor=mix(u_color,overlay_color,overlay_color.a);}","in vec2 a_pos;out vec2 v_uv;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=projectTileWithElevation(a_pos*u_overlay_scale,get_elevation(a_pos));}"),depth:xe(be,"in vec2 a_pos;void main() {\n#ifdef GLOBE\ngl_Position=projectTileFor3D(a_pos,0.0);\n#else\ngl_Position=u_projection_matrix*vec4(a_pos,0.0,1.0);\n#endif\n}"),fill:xe("#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\nfragColor=color*opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_fill_translate;in vec2 a_pos;\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=projectTile(a_pos+u_fill_translate,a_pos);}"),fillOutline:xe("in vec2 v_pos;\n#ifdef GLOBE\nin float v_depth;\n#endif\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);fragColor=outline_color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_world;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos;\n#ifdef GLOBE\nout float v_depth;\n#endif\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=projectTile(a_pos+u_fill_translate,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n}"),fillOutlinePattern:xe("uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;in vec2 v_pos_a;in vec2 v_pos_b;in vec2 v_pos;\n#ifdef GLOBE\nin float v_depth;\n#endif\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=texture(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=texture(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);fragColor=mix(color1,color2,u_fade)*alpha*opacity;\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;out vec2 v_pos;\n#ifdef GLOBE\nout float v_depth;\n#endif\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=projectTile(a_pos+u_fill_translate,a_pos);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;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n}"),fillPattern:xe("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in 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=texture(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=texture(u_image,pos2);fragColor=mix(color1,color2,u_fade)*opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos_a;out 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=projectTile(a_pos+u_fill_translate,a_pos);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);}"),fillExtrusion:xe("in vec4 v_color;void main() {fragColor=v_color;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec2 u_fill_translate;in vec2 a_pos;in vec4 a_normal_ed;\n#ifdef TERRAIN3D\nin vec2 a_centroid;\n#endif\nout 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);float elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate;\n#ifdef GLOBE\nvec3 spherePos=projectToSphere(posInTile,a_pos);gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);\n#else\ngl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);\n#endif\nfloat 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;vec3 normalForLighting=normal/16384.0;float directional=clamp(dot(normalForLighting,u_lightpos),0.0,1.0);\n#ifdef GLOBE\nmat3 rotMatrix=globeGetRotationMatrix(spherePos);normalForLighting=rotMatrix*normalForLighting;directional=mix(directional,clamp(dot(normalForLighting,u_lightpos_globe),0.0,1.0),u_projection_transition);\n#endif\ndirectional=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;}"),fillExtrusionPattern:xe("uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;in 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=texture(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=texture(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);fragColor=mixedColor*v_lighting;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","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 vec2 u_fill_translate;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp float u_lightintensity;in vec2 a_pos;in vec4 a_normal_ed;\n#ifdef TERRAIN3D\nin vec2 a_centroid;\n#endif\n#ifdef GLOBE\nout vec3 v_sphere_pos;\n#endif\nout vec2 v_pos_a;out vec2 v_pos_b;out 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 elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate;\n#ifdef GLOBE\nvec3 spherePos=projectToSphere(posInTile,a_pos);vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);v_sphere_pos=elevatedPos;gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);\n#else\ngl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);\n#endif\nvec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0\n? a_pos\n: vec2(edgedistance,elevation*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;}"),hillshadePrepare:xe("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack);}void main() {vec2 epsilon=1.0/u_dimension;float tileSize=u_dimension.x-2.0;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))*tileSize/pow(2.0,exaggeration+(28.2562-u_zoom));fragColor=clamp(vec4(deriv.x/8.0+0.5,deriv.y/8.0+0.5,1.0,1.0),0.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_dimension;in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:xe("uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_latrange;uniform float u_exaggeration;uniform vec4 u_accent;uniform int u_method;uniform float u_altitudes[NUM_ILLUMINATION_SOURCES];uniform float u_azimuths[NUM_ILLUMINATION_SOURCES];uniform vec4 u_shadows[NUM_ILLUMINATION_SOURCES];uniform vec4 u_highlights[NUM_ILLUMINATION_SOURCES];\n#define PI 3.141592653589793\n#define STANDARD 0\n#define COMBINED 1\n#define IGOR 2\n#define MULTIDIRECTIONAL 3\n#define BASIC 4\nfloat get_aspect(vec2 deriv){return deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);}void igor_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float aspect=get_aspect(deriv);float azimuth=u_azimuths[0]+PI;float slope_stength=atan(length(deriv))*2.0/PI;float aspect_strength=1.0-abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);float shadow_strength=slope_stength*aspect_strength;float highlight_strength=slope_stength*(1.0-aspect_strength);fragColor=u_shadows[0]*shadow_strength+u_highlights[0]*highlight_strength;}void standard_hillshade(vec2 deriv){float azimuth=u_azimuths[0]+PI;float slope=atan(0.625*length(deriv));float aspect=get_aspect(deriv);float intensity=u_exaggeration;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_shadows[0],u_highlights[0],shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);fragColor=accent_color*(1.0-shade_color.a)+shade_color;}void basic_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float azimuth=u_azimuths[0]+PI;float cos_az=cos(azimuth);float sin_az=sin(azimuth);float cos_alt=cos(u_altitudes[0]);float sin_alt=sin(u_altitudes[0]);float cang=(sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv));float shade=clamp(cang,0.0,1.0);if(shade > 0.5){fragColor=u_highlights[0]*(2.0*shade-1.0);}else\n{fragColor=u_shadows[0]*(1.0-2.0*shade);}}void multidirectional_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;fragColor=vec4(0,0,0,0);for(int i=0; i < NUM_ILLUMINATION_SOURCES; i++){float cos_alt=cos(u_altitudes[i]);float sin_alt=sin(u_altitudes[i]);float cos_az=-cos(u_azimuths[i]);float sin_az=-sin(u_azimuths[i]);float cang=(sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv));float shade=clamp(cang,0.0,1.0);if(shade > 0.5){fragColor+=u_highlights[i]*(2.0*shade-1.0)/float(NUM_ILLUMINATION_SOURCES);}else\n{fragColor+=u_shadows[i]*(1.0-2.0*shade)/float(NUM_ILLUMINATION_SOURCES);}}}void combined_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float azimuth=u_azimuths[0]+PI;float cos_az=cos(azimuth);float sin_az=sin(azimuth);float cos_alt=cos(u_altitudes[0]);float sin_alt=sin(u_altitudes[0]);float cang=acos((sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv)));cang=clamp(cang,0.0,PI/2.0);float shade=cang*atan(length(deriv))*4.0/PI/PI;float highlight=(PI/2.0-cang)*atan(length(deriv))*4.0/PI/PI;fragColor=u_shadows[0]*shade+u_highlights[0]*highlight;}void main() {vec4 pixel=texture(u_image,v_pos);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));vec2 deriv=((pixel.rg*8.0)-4.0)/scaleFactor;if (u_method==BASIC) {basic_hillshade(deriv);} else if (u_method==COMBINED) {combined_hillshade(deriv);} else if (u_method==IGOR) {igor_hillshade(deriv);} else if (u_method==MULTIDIRECTIONAL) {multidirectional_hillshade(deriv);} else if (u_method==STANDARD) {standard_hillshade(deriv);} else {standard_hillshade(deriv);}\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=projectTile(a_pos,a_pos);v_pos=a_pos/8192.0;if (a_pos.y <-32767.5) {v_pos.y=0.0;}if (a_pos.y > 32766.5) {v_pos.y=1.0;}}"),line:xe("uniform lowp float u_device_pixel_ratio;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;\n#ifdef GLOBE\nin float v_depth;\n#endif\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);fragColor=color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nin vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp float v_linesofar;\n#ifdef GLOBE\nout float v_depth;\n#endif\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);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_width2=vec2(outset,inset);}"),lineGradient:xe("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;in highp vec2 v_uv;\n#ifdef GLOBE\nin float v_depth;\n#endif\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=texture(u_image,v_uv);fragColor=color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nin vec2 a_pos_normal;in vec4 a_data;in float a_uv_x;in float a_split_index;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec2 v_uv;\n#ifdef GLOBE\nout float v_depth;\n#endif\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);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_width2=vec2(outset,inset);}"),linePattern:xe("#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;in vec2 v_normal;in vec2 v_width2;in float v_linesofar;in float v_gamma_scale;in float v_width;\n#ifdef GLOBE\nin float v_depth;\n#endif\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(texture(u_image,pos_a),texture(u_image,pos_b),u_fade);fragColor=color*alpha*opacity;\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nin vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;out vec2 v_normal;out vec2 v_width2;out float v_linesofar;out float v_gamma_scale;out float v_width;\n#ifdef GLOBE\nout float v_depth;\n#endif\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);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.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;}"),lineSDF:xe("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;in vec2 v_normal;in vec2 v_width2;in vec2 v_tex_a;in vec2 v_tex_b;in float v_gamma_scale;\n#ifdef GLOBE\nin float v_depth;\n#endif\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=texture(u_image,v_tex_a).a;float sdfdist_b=texture(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);fragColor=color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nin vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;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;out vec2 v_normal;out vec2 v_width2;out vec2 v_tex_a;out vec2 v_tex_b;out float v_gamma_scale;\n#ifdef GLOBE\nout float v_depth;\n#endif\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);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.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);}"),raster:xe("uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;in vec2 v_pos0;in 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=texture(u_image0,v_pos0);vec4 color1=texture(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);fragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;uniform vec4 u_coords_top;uniform vec4 u_coords_bottom;in vec2 a_pos;out vec2 v_pos0;out vec2 v_pos1;void main() {vec2 fractionalPos=a_pos/8192.0;vec2 position=mix(mix(u_coords_top.xy,u_coords_top.zw,fractionalPos.x),mix(u_coords_bottom.xy,u_coords_bottom.zw,fractionalPos.x),fractionalPos.y);gl_Position=projectTile(position,position);v_pos0=((fractionalPos-0.5)/u_buffer_scale)+0.5;\n#ifdef GLOBE\nif (a_pos.y <-32767.5) {v_pos0.y=0.0;}if (a_pos.y > 32766.5) {v_pos0.y=1.0;}\n#endif\nv_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}"),symbolIcon:xe("uniform sampler2D u_texture;in vec2 v_tex;in 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;fragColor=texture(u_texture,v_tex)*alpha;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","in vec4 a_pos_offset;in vec4 a_data;in vec4 a_pixeloffset;in vec3 a_projected_pos;in 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_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;out vec2 v_tex;out 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;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);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=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);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;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;\n#ifdef GLOBE\nif(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}\n#endif\nvec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}gl_Position=finalPos;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));}"),symbolSDF:xe("#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;in vec2 v_data0;in 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=texture(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);}fragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","in vec4 a_pos_offset;in vec4 a_data;in vec4 a_pixeloffset;in vec3 a_projected_pos;in 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_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;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_translation;uniform float u_pitched_scale;out vec2 v_data0;out 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;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);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=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);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;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;\n#ifdef GLOBE\nif(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}\n#endif\nvec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;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);}"),symbolTextAndIcon:xe("#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;in vec4 v_data0;in 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;fragColor=texture(u_texture_icon,tex_icon)*alpha;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=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=texture(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);fragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","in vec4 a_pos_offset;in vec4 a_data;in vec3 a_projected_pos;in 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_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;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;out vec4 v_data0;out 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;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);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=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);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;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;\n#ifdef GLOBE\nif(u_pitch_with_map && !u_is_along_line) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}\n#endif\nvec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;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);}"),terrain:xe("uniform sampler2D u_texture;uniform vec4 u_fog_color;uniform vec4 u_horizon_color;uniform float u_fog_ground_blend;uniform float u_fog_ground_blend_opacity;uniform float u_horizon_fog_blend;uniform bool u_is_globe_mode;in vec2 v_texture_pos;in float v_fog_depth;const float gamma=2.2;vec4 gammaToLinear(vec4 color) {return pow(color,vec4(gamma));}vec4 linearToGamma(vec4 color) {return pow(color,vec4(1.0/gamma));}void main() {vec4 surface_color=texture(u_texture,vec2(v_texture_pos.x,1.0-v_texture_pos.y));if (!u_is_globe_mode && v_fog_depth > u_fog_ground_blend) {vec4 surface_color_linear=gammaToLinear(surface_color);float blend_color=smoothstep(0.0,1.0,max((v_fog_depth-u_horizon_fog_blend)/(1.0-u_horizon_fog_blend),0.0));vec4 fog_horizon_color_linear=mix(gammaToLinear(u_fog_color),gammaToLinear(u_horizon_color),blend_color);float factor_fog=max(v_fog_depth-u_fog_ground_blend,0.0)/(1.0-u_fog_ground_blend);fragColor=linearToGamma(mix(surface_color_linear,fog_horizon_color_linear,pow(factor_fog,2.0)*u_fog_ground_blend_opacity));} else {fragColor=surface_color;}}","in vec3 a_pos3d;uniform mat4 u_fog_matrix;uniform float u_ele_delta;out vec2 v_texture_pos;out float v_fog_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=projectTileFor3D(a_pos3d.xy,get_elevation(a_pos3d.xy)-ele_delta);vec4 pos=u_fog_matrix*vec4(a_pos3d.xy,ele,1.0);v_fog_depth=pos.z/pos.w*0.5+0.5;}"),terrainDepth:xe("in 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() {fragColor=pack(v_depth);}","in vec3 a_pos3d;uniform float u_ele_delta;out float v_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);v_depth=gl_Position.z/gl_Position.w;}"),terrainCoords:xe("precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;in vec2 v_texture_pos;void main() {vec4 rgba=texture(u_texture,v_texture_pos);fragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}","in vec3 a_pos3d;uniform float u_ele_delta;out vec2 v_texture_pos;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);}"),projectionErrorMeasurement:xe("in vec4 v_output_error_encoded;void main() {fragColor=v_output_error_encoded;}","in vec2 a_pos;uniform highp float u_input;uniform highp float u_output_expected;out vec4 v_output_error_encoded;void main() {float real_output=2.0*atan(exp(PI-(u_input*PI*2.0)))-PI*0.5;float error=real_output-u_output_expected;float abs_error=abs(error)*128.0;v_output_error_encoded.x=min(floor(abs_error*256.0),255.0)/255.0;abs_error-=v_output_error_encoded.x;v_output_error_encoded.y=min(floor(abs_error*65536.0),255.0)/255.0;abs_error-=v_output_error_encoded.x/255.0;v_output_error_encoded.z=min(floor(abs_error*16777216.0),255.0)/255.0;v_output_error_encoded.w=error >=0.0 ? 1.0 : 0.0;gl_Position=vec4(a_pos,0.0,1.0);}"),atmosphere:xe("in vec3 view_direction;uniform vec3 u_sun_pos;uniform vec3 u_globe_position;uniform float u_globe_radius;uniform float u_atmosphere_blend;/**Shader use from https:*Made some change to adapt to MapLibre Globe geometry*/const float PI=3.141592653589793;const int iSteps=5;const int jSteps=3;/*radius of the planet*/const float EARTH_RADIUS=6371e3;/*radius of the atmosphere*/const float ATMOS_RADIUS=6471e3;vec2 rsi(vec3 r0,vec3 rd,float sr) {float a=dot(rd,rd);float b=2.0*dot(rd,r0);float c=dot(r0,r0)-(sr*sr);float d=(b*b)-4.0*a*c;if (d < 0.0) return vec2(1e5,-1e5);return vec2((-b-sqrt(d))/(2.0*a),(-b+sqrt(d))/(2.0*a));}vec4 atmosphere(vec3 r,vec3 r0,vec3 pSun,float iSun,float rPlanet,float rAtmos,vec3 kRlh,float kMie,float shRlh,float shMie,float g) {pSun=normalize(pSun);r=normalize(r);vec2 p=rsi(r0,r,rAtmos);if (p.x > p.y) {return vec4(0.0,0.0,0.0,1.0);}if (p.x < 0.0) {p.x=0.0;}vec3 pos=r0+r*p.x;vec2 p2=rsi(r0,r,rPlanet);if (p2.x <=p2.y && p2.x > 0.0) {p.y=min(p.y,p2.x);}float iStepSize=(p.y-p.x)/float(iSteps);float iTime=p.x+iStepSize*0.5;vec3 totalRlh=vec3(0,0,0);vec3 totalMie=vec3(0,0,0);float iOdRlh=0.0;float iOdMie=0.0;float mu=dot(r,pSun);float mumu=mu*mu;float gg=g*g;float pRlh=3.0/(16.0*PI)*(1.0+mumu);float pMie=3.0/(8.0*PI)*((1.0-gg)*(mumu+1.0))/(pow(1.0+gg-2.0*mu*g,1.5)*(2.0+gg));for (int i=0; i < iSteps; i++) {vec3 iPos=r0+r*iTime;float iHeight=length(iPos)-rPlanet;float odStepRlh=exp(-iHeight/shRlh)*iStepSize;float odStepMie=exp(-iHeight/shMie)*iStepSize;iOdRlh+=odStepRlh;iOdMie+=odStepMie;float jStepSize=rsi(iPos,pSun,rAtmos).y/float(jSteps);float jTime=jStepSize*0.5;float jOdRlh=0.0;float jOdMie=0.0;for (int j=0; j < jSteps; j++) {vec3 jPos=iPos+pSun*jTime;float jHeight=length(jPos)-rPlanet;jOdRlh+=exp(-jHeight/shRlh)*jStepSize;jOdMie+=exp(-jHeight/shMie)*jStepSize;jTime+=jStepSize;}vec3 attn=exp(-(kMie*(iOdMie+jOdMie)+kRlh*(iOdRlh+jOdRlh)));totalRlh+=odStepRlh*attn;totalMie+=odStepMie*attn;iTime+=iStepSize;}float opacity=exp(-(length(kRlh)*length(totalRlh)+kMie*length(totalMie)));vec3 color=iSun*(pRlh*kRlh*totalRlh+pMie*kMie*totalMie);return vec4(color,opacity);}void main() {vec3 scale_camera_pos=-u_globe_position*EARTH_RADIUS/u_globe_radius;vec4 color=atmosphere(normalize(view_direction),scale_camera_pos,u_sun_pos,22.0,EARTH_RADIUS,ATMOS_RADIUS,vec3(5.5e-6,13.0e-6,22.4e-6),21e-6,8e3,1.2e3,0.758\n);color.rgb=1.0-exp(-1.0*color.rgb);color=pow(color,vec4(1.0/2.2));fragColor=vec4(color.rgb,1.0-color.a)*u_atmosphere_blend;}","in vec2 a_pos;uniform mat4 u_inv_proj_matrix;out vec3 view_direction;void main() {view_direction=(u_inv_proj_matrix*vec4(a_pos,0.0,1.0)).xyz;gl_Position=vec4(a_pos,0.0,1.0);}"),sky:xe("uniform vec4 u_sky_color;uniform vec4 u_horizon_color;uniform vec2 u_horizon;uniform vec2 u_horizon_normal;uniform float u_sky_horizon_blend;uniform float u_sky_blend;void main() {float x=gl_FragCoord.x;float y=gl_FragCoord.y;float blend=(y-u_horizon.y)*u_horizon_normal.y+(x-u_horizon.x)*u_horizon_normal.x;if (blend > 0.0) {if (blend < u_sky_horizon_blend) {fragColor=mix(u_sky_color,u_horizon_color,pow(1.0-blend/u_sky_horizon_blend,2.0));} else {fragColor=u_sky_color;}}fragColor=mix(fragColor,vec4(vec3(0.0),0.0),u_sky_blend);}","in vec2 a_pos;void main() {gl_Position=vec4(a_pos,1.0,1.0);}")};function xe(t,e){const r=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,i=e.match(/in ([\w]+) ([\w]+)/g),n=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),o=e.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),a=o?o.concat(n):n,s={};return{fragmentSource:t=t.replace(r,(t,e,r,i,n)=>(s[n]=!0,"define"===e?`\n#ifndef HAS_UNIFORM_u_${n}\nin ${r} ${i} ${n};\n#else\nuniform ${r} ${i} u_${n};\n#endif\n`:`\n#ifdef HAS_UNIFORM_u_${n}\n ${r} ${i} ${n} = u_${n};\n#endif\n`)),vertexSource:e=e.replace(r,(t,e,r,i,n)=>{const o="float"===i?"vec2":"vec4",a=n.match(/color/)?"color":o;return s[n]?"define"===e?`\n#ifndef HAS_UNIFORM_u_${n}\nuniform lowp float u_${n}_t;\nin ${r} ${o} a_${n};\nout ${r} ${i} ${n};\n#else\nuniform ${r} ${i} u_${n};\n#endif\n`:"vec4"===a?`\n#ifndef HAS_UNIFORM_u_${n}\n ${n} = a_${n};\n#else\n ${r} ${i} ${n} = u_${n};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${n}\n ${n} = unpack_mix_${a}(a_${n}, u_${n}_t);\n#else\n ${r} ${i} ${n} = u_${n};\n#endif\n`:"define"===e?`\n#ifndef HAS_UNIFORM_u_${n}\nuniform lowp float u_${n}_t;\nin ${r} ${o} a_${n};\n#else\nuniform ${r} ${i} u_${n};\n#endif\n`:"vec4"===a?`\n#ifndef HAS_UNIFORM_u_${n}\n ${r} ${i} ${n} = a_${n};\n#else\n ${r} ${i} ${n} = u_${n};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${n}\n ${r} ${i} ${n} = unpack_mix_${a}(a_${n}, u_${n}_t);\n#else\n ${r} ${i} ${n} = u_${n};\n#endif\n`}),staticAttributes:i,staticUniforms:a}}class we{constructor(t,e,r){this.vertexBuffer=t,this.indexBuffer=e,this.segments=r}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}}var Te=e.aJ([{name:"a_pos",type:"Int16",components:2}]);const Se="#define PROJECTION_MERCATOR",Pe="mercator";class Ce{constructor(){this._cachedMesh=null}get name(){return"mercator"}get useSubdivision(){return!1}get shaderVariantName(){return Pe}get shaderDefine(){return Se}get shaderPreludeCode(){return ve.projectionMercator}get vertexShaderPreludeCode(){return ve.projectionMercator.vertexSource}get subdivisionGranularity(){return e.aK.noSubdivision}get useGlobeControls(){return!1}get transitionState(){return 0}get latitudeErrorCorrectionRadians(){return 0}destroy(){}updateGPUdependent(t){}getMeshFromTileID(t,r,i,n,o){if(this._cachedMesh)return this._cachedMesh;const a=new e.aL;a.emplaceBack(0,0),a.emplaceBack(e.$,0),a.emplaceBack(0,e.$),a.emplaceBack(e.$,e.$);const s=t.createVertexBuffer(a,Te.members),l=e.aM.simpleSegment(0,0,4,2),c=new e.aN;c.emplaceBack(1,0,2),c.emplaceBack(1,2,3);const h=t.createIndexBuffer(c);return this._cachedMesh=new we(s,h,l),this._cachedMesh}recalculate(){}hasTransition(){return!1}setErrorQueryLatitudeDegrees(t){}}class Me{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,r,i){return null!=r.top&&null!=t.top&&(this.top=e.C.number(t.top,r.top,i)),null!=r.bottom&&null!=t.bottom&&(this.bottom=e.C.number(t.bottom,r.bottom,i)),null!=r.left&&null!=t.left&&(this.left=e.C.number(t.left,r.left,i)),null!=r.right&&null!=t.right&&(this.right=e.C.number(t.right,r.right,i)),this}getCenter(t,r){const i=e.ah((this.left+t-this.right)/2,0,t),n=e.ah((this.top+r-this.bottom)/2,0,r);return new e.P(i,n)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new Me(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}function Ae(t,e){if(!t.renderWorldCopies||t.lngRange)return;const r=e.lng-t.center.lng;e.lng+=r>180?-360:r<-180?360:0}function Ie(t){return Math.max(0,Math.floor(t))}class Ee{constructor(t,r,i,n,o,a){this._callbacks=t,this._tileSize=512,this._renderWorldCopies=void 0===a||!!a,this._minZoom=r||0,this._maxZoom=i||22,this._minPitch=null==n?0:n,this._maxPitch=null==o?60:o,this.setMaxBounds(),this._width=0,this._height=0,this._center=new e.S(0,0),this._elevation=0,this._zoom=0,this._tileZoom=Ie(this._zoom),this._scale=e.af(this._zoom),this._bearingInRadians=0,this._fovInRadians=.6435011087932844,this._pitchInRadians=0,this._rollInRadians=0,this._unmodified=!0,this._edgeInsets=new Me,this._minElevationForCurrentTile=0,this._autoCalculateNearFarZ=!0}apply(t,r,i){this._latRange=t.latRange,this._lngRange=t.lngRange,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._tileZoom=Ie(this._zoom),this._scale=e.af(this._zoom),this._bearingInRadians=t.bearingInRadians,this._fovInRadians=t.fovInRadians,this._pitchInRadians=t.pitchInRadians,this._rollInRadians=t.rollInRadians,this._unmodified=t.unmodified,this._edgeInsets=new Me(t.padding.top,t.padding.bottom,t.padding.left,t.padding.right),this._minZoom=t.minZoom,this._maxZoom=t.maxZoom,this._minPitch=t.minPitch,this._maxPitch=t.maxPitch,this._renderWorldCopies=t.renderWorldCopies,this._cameraToCenterDistance=t.cameraToCenterDistance,this._nearZ=t.nearZ,this._farZ=t.farZ,this._autoCalculateNearFarZ=!i&&t.autoCalculateNearFarZ,r&&this._constrain(),this._calcMatrices()}get pixelsToClipSpaceMatrix(){return this._pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._clipSpaceToPixelsMatrix}get minElevationForCurrentTile(){return this._minElevationForCurrentTile}setMinElevationForCurrentTile(t){this._minElevationForCurrentTile=t}get tileSize(){return this._tileSize}get tileZoom(){return this._tileZoom}get scale(){return this._scale}get width(){return this._width}get height(){return this._height}get bearingInRadians(){return this._bearingInRadians}get lngRange(){return this._lngRange}get latRange(){return this._latRange}get pixelsToGLUnits(){return this._pixelsToGLUnits}get minZoom(){return this._minZoom}setMinZoom(t){this._minZoom!==t&&(this._minZoom=t,this.setZoom(this.getConstrained(this._center,this.zoom).zoom))}get maxZoom(){return this._maxZoom}setMaxZoom(t){this._maxZoom!==t&&(this._maxZoom=t,this.setZoom(this.getConstrained(this._center,this.zoom).zoom))}get minPitch(){return this._minPitch}setMinPitch(t){this._minPitch!==t&&(this._minPitch=t,this.setPitch(Math.max(this.pitch,t)))}get maxPitch(){return this._maxPitch}setMaxPitch(t){this._maxPitch!==t&&(this._maxPitch=t,this.setPitch(Math.min(this.pitch,t)))}get renderWorldCopies(){return this._renderWorldCopies}setRenderWorldCopies(t){void 0===t?t=!0:null===t&&(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 e.P(this._width,this._height)}get bearing(){return this._bearingInRadians/Math.PI*180}setBearing(t){const r=e.aO(t,-180,180)*Math.PI/180;var n,o,a,s,l,c,h,u,p;this._bearingInRadians!==r&&(this._unmodified=!1,this._bearingInRadians=r,this._calcMatrices(),this._rotationMatrix=i(),n=this._rotationMatrix,a=-this._bearingInRadians,s=(o=this._rotationMatrix)[0],l=o[1],c=o[2],h=o[3],u=Math.sin(a),p=Math.cos(a),n[0]=s*p+c*u,n[1]=l*p+h*u,n[2]=s*-u+c*p,n[3]=l*-u+h*p)}get rotationMatrix(){return this._rotationMatrix}get pitchInRadians(){return this._pitchInRadians}get pitch(){return this._pitchInRadians/Math.PI*180}setPitch(t){const r=e.ah(t,this.minPitch,this.maxPitch)/180*Math.PI;this._pitchInRadians!==r&&(this._unmodified=!1,this._pitchInRadians=r,this._calcMatrices())}get rollInRadians(){return this._rollInRadians}get roll(){return this._rollInRadians/Math.PI*180}setRoll(t){const e=t/180*Math.PI;this._rollInRadians!==e&&(this._unmodified=!1,this._rollInRadians=e,this._calcMatrices())}get fovInRadians(){return this._fovInRadians}get fov(){return e.aP(this._fovInRadians)}setFov(t){t=e.ah(t,.1,150),this.fov!==t&&(this._unmodified=!1,this._fovInRadians=e.ae(t),this._calcMatrices())}get zoom(){return this._zoom}setZoom(t){const r=this.getConstrained(this._center,t).zoom;this._zoom!==r&&(this._unmodified=!1,this._zoom=r,this._tileZoom=Math.max(0,Math.floor(r)),this._scale=e.af(r),this._constrain(),this._calcMatrices())}get center(){return this._center}setCenter(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}setElevation(t){t!==this._elevation&&(this._elevation=t,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}setPadding(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)}get pixelsPerMeter(){return this._pixelPerMeter}get unmodified(){return this._unmodified}get cameraToCenterDistance(){return this._cameraToCenterDistance}get nearZ(){return this._nearZ}get farZ(){return this._farZ}get autoCalculateNearFarZ(){return this._autoCalculateNearFarZ}overrideNearFarZ(t,e){this._autoCalculateNearFarZ=!1,this._nearZ=t,this._farZ=e,this._calcMatrices()}clearNearFarZOverride(){this._autoCalculateNearFarZ=!0,this._calcMatrices()}isPaddingEqual(t){return this._edgeInsets.equals(t)}interpolatePadding(t,e,r){this._unmodified=!1,this._edgeInsets.interpolate(t,e,r),this._constrain(),this._calcMatrices()}resize(t,e,r=!0){this._width=t,this._height=e,r&&this._constrain(),this._calcMatrices()}getMaxBounds(){return this._latRange&&2===this._latRange.length&&this._lngRange&&2===this._lngRange.length?new $([this._lngRange[0],this._latRange[0]],[this._lngRange[1],this._latRange[1]]):null}setMaxBounds(t){t?(this._lngRange=[t.getWest(),t.getEast()],this._latRange=[t.getSouth(),t.getNorth()],this._constrain()):(this._lngRange=null,this._latRange=[-e.ai,e.ai])}getConstrained(t,e){return this._callbacks.getConstrained(t,e)}getCameraQueryGeometry(t,r){if(1===r.length)return[r[0],t];{const{minX:i,minY:n,maxX:o,maxY:a}=e.a2.fromPoints(r).extend(t);return[new e.P(i,n),new e.P(o,n),new e.P(o,a),new e.P(i,a),new e.P(i,n)]}}_constrain(){if(!this.center||!this._width||!this._height||this._constraining)return;this._constraining=!0;const t=this._unmodified,{center:e,zoom:r}=this.getConstrained(this.center,this.zoom);this.setCenter(e),this.setZoom(r),this._unmodified=t,this._constraining=!1}_calcMatrices(){if(this._width&&this._height){this._pixelsToGLUnits=[2/this._width,-2/this._height];let t=e.ag(new Float64Array(16));e.N(t,t,[this._width/2,-this._height/2,1]),e.M(t,t,[1,-1,0]),this._clipSpaceToPixelsMatrix=t,t=e.ag(new Float64Array(16)),e.N(t,t,[1,-1,1]),e.M(t,t,[-1,-1,0]),e.N(t,t,[2/this._width,2/this._height,1]),this._pixelsToClipSpaceMatrix=t,this._cameraToCenterDistance=.5/Math.tan(this.fovInRadians/2)*this._height}this._callbacks.calcMatrices()}calculateCenterFromCameraLngLatAlt(t,r,i,n){const o=void 0!==i?i:this.bearing,a=n=void 0!==n?n:this.pitch,s=e.a1.fromLngLat(t,r),l=-Math.cos(e.ae(a)),c=Math.sin(e.ae(a)),h=c*Math.sin(e.ae(o)),u=-c*Math.cos(e.ae(o));let p=this.elevation;const d=r-p;let f;l*d>=0||Math.abs(l)<.1?(f=1e4,p=r+f*l):f=-d/l;let m,g,_=e.aQ(1,s.y),y=0;do{if(y+=1,y>10)break;g=f/_,m=new e.a1(s.x+h*g,s.y+u*g),_=1/m.meterInMercatorCoordinateUnits()}while(Math.abs(f-g*_)>1e-12);return{center:m.toLngLat(),elevation:p,zoom:e.ak(this.height/2/Math.tan(this.fovInRadians/2)/g/this.tileSize)}}recalculateZoomAndCenter(t){if(this.elevation-t==0)return;const r=e.aj(1,this.center.lat)*this.worldSize,i=this.cameraToCenterDistance/r,n=e.a1.fromLngLat(this.center,this.elevation),o=pt(this.center,this.elevation,this.pitch,this.bearing,i);this._elevation=t;const a=this.calculateCenterFromCameraLngLatAlt(o.toLngLat(),e.aQ(o.z,n.y),this.bearing,this.pitch);this._elevation=a.elevation,this._center=a.center,this.setZoom(a.zoom)}getCameraPoint(){const t=Math.tan(this.pitchInRadians)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new e.P(t*Math.sin(this.rollInRadians),t*Math.cos(this.rollInRadians)))}getCameraAltitude(){return Math.cos(this.pitchInRadians)*this._cameraToCenterDistance/this._pixelPerMeter+this.elevation}getCameraLngLat(){const t=e.aj(1,this.center.lat)*this.worldSize;return pt(this.center,this.elevation,this.pitch,this.bearing,this.cameraToCenterDistance/t).toLngLat()}getMercatorTileCoordinates(t){if(!t)return[0,0,1,1];const r=t.canonical.z>=0?1<<t.canonical.z:Math.pow(2,t.canonical.z);return[t.canonical.x/r,t.canonical.y/r,1/r/e.$,1/r/e.$]}}class ke{constructor(t,r){this.min=t,this.max=r,this.center=e.aR([],e.aS([],this.min,this.max),.5)}quadrant(t){const r=[t%2==0,t<2],i=e.aT(this.min),n=e.aT(this.max);for(let t=0;t<r.length;t++)i[t]=r[t]?this.min[t]:this.center[t],n[t]=r[t]?this.center[t]:this.max[t];return n[2]=this.max[2],new ke(i,n)}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]}intersectsFrustum(t){let e=!0;for(let r=0;r<t.planes.length;r++){const i=this.intersectsPlane(t.planes[r]);if(0===i)return 0;1===i&&(e=!1)}return e?2:t.aabb.min[0]>this.max[0]||t.aabb.min[1]>this.max[1]||t.aabb.min[2]>this.max[2]||t.aabb.max[0]<this.min[0]||t.aabb.max[1]<this.min[1]||t.aabb.max[2]<this.min[2]?0:1}intersectsPlane(t){let e=t[3],r=t[3];for(let i=0;i<3;i++)t[i]>0?(e+=t[i]*this.min[i],r+=t[i]*this.max[i]):(r+=t[i]*this.min[i],e+=t[i]*this.max[i]);return e>=0?2:r<0?0:1}}class ze{distanceToTile2d(t,e,r,i){const n=i.distanceX([t,e]),o=i.distanceY([t,e]);return Math.hypot(n,o)}getWrap(t,e,r){return r}getTileBoundingVolume(t,r,i,n){var o,a;let s=0,l=0;if(null==n?void 0:n.terrain){const c=new e.Z(t.z,r,t.z,t.x,t.y),h=n.terrain.getMinMaxElevation(c);s=null!==(o=h.minElevation)&&void 0!==o?o:Math.min(0,i),l=null!==(a=h.maxElevation)&&void 0!==a?a:Math.max(0,i)}const c=1<<t.z;return new ke([r+t.x/c,t.y/c,s],[r+(t.x+1)/c,(t.y+1)/c,l])}allowVariableZoom(t,r){const i=t.fov*(Math.abs(Math.cos(t.rollInRadians))*t.height+Math.abs(Math.sin(t.rollInRadians))*t.width)/t.height,n=e.ah(78.5-i/2,0,60);return!!r.terrain||t.pitch>n}allowWorldCopies(){return!0}prepareNextFrame(){}}class Re{constructor(t,e,r){this.points=t,this.planes=e,this.aabb=r}static fromInvProjectionMatrix(t,r=1,i=0,n,o){const a=o?[[6,5,4],[0,1,2],[0,3,7],[2,1,5],[3,2,6],[0,4,5]]:[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]],s=Math.pow(2,i),l=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map(i=>function(t,r,i,n){const o=e.aw([],t,r),a=1/o[3]/i*n;return e.aY(o,o,[a,a,1/o[3],a])}(i,t,r,s));n&&function(t,r,i,n){const o=n?4:0,a=n?0:4;let s=0;const l=[],c=[];for(let r=0;r<4;r++){const i=e.aU([],t[r+a],t[r+o]),n=e.aZ(i);e.aR(i,i,1/n),l.push(n),c.push(i)}for(let r=0;r<4;r++){const n=e.a_(t[r+o],c[r],i);s=null!==n&&n>=0?Math.max(s,n):Math.max(s,l[r])}const h=function(t,r){const i=e.aU([],t[r[0]],t[r[1]]),n=e.aU([],t[r[2]],t[r[1]]),o=[0,0,0,0];return e.aV(o,e.aW([],i,n)),o[3]=-e.aX(o,t[r[0]]),o}(t,r),u=function(t,r){const i=e.a$(t),n=e.b0([],t,1/i),o=e.aU([],r,e.aR([],n,e.aX(r,n))),a=e.a$(o);if(a>0){const t=Math.sqrt(1-n[3]*n[3]),i=e.aR([],n,-n[3]),s=e.aS([],i,e.aR([],o,t/a));return e.b1(r,s)}return null}(i,h);if(null!==u){const t=u/e.aX(c[0],h);s=Math.min(s,t)}for(let e=0;e<4;e++){const r=Math.min(s,l[e]);t[e+a]=[t[e+o][0]+c[e][0]*r,t[e+o][1]+c[e][1]*r,t[e+o][2]+c[e][2]*r,1]}}(l,a[0],n,o);const c=a.map(t=>{const r=e.aU([],l[t[0]],l[t[1]]),i=e.aU([],l[t[2]],l[t[1]]),n=e.aV([],e.aW([],r,i)),o=-e.aX(n,l[t[1]]);return n.concat(o)}),h=[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY],u=[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY];for(const t of l)for(let e=0;e<3;e++)h[e]=Math.min(h[e],t[e]),u[e]=Math.max(u[e],t[e]);return new Re(l,c,new ke(h,u))}}class De{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(t){this._helper.setMinZoom(t)}setMaxZoom(t){this._helper.setMaxZoom(t)}setMinPitch(t){this._helper.setMinPitch(t)}setMaxPitch(t){this._helper.setMaxPitch(t)}setRenderWorldCopies(t){this._helper.setRenderWorldCopies(t)}setBearing(t){this._helper.setBearing(t)}setPitch(t){this._helper.setPitch(t)}setRoll(t){this._helper.setRoll(t)}setFov(t){this._helper.setFov(t)}setZoom(t){this._helper.setZoom(t)}setCenter(t){this._helper.setCenter(t)}setElevation(t){this._helper.setElevation(t)}setMinElevationForCurrentTile(t){this._helper.setMinElevationForCurrentTile(t)}setPadding(t){this._helper.setPadding(t)}interpolatePadding(t,e,r){return this._helper.interpolatePadding(t,e,r)}isPaddingEqual(t){return this._helper.isPaddingEqual(t)}resize(t,e,r=!0){this._helper.resize(t,e,r)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(t){this._helper.setMaxBounds(t)}overrideNearFarZ(t,e){this._helper.overrideNearFarZ(t,e)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(t){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),t)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(t,e){}constructor(t,e,r,i,n){this._posMatrixCache=new Map,this._alignedPosMatrixCache=new Map,this._fogMatrixCacheF32=new Map,this._helper=new Ee({calcMatrices:()=>{this._calcMatrices()},getConstrained:(t,e)=>this.getConstrained(t,e)},t,e,r,i,n),this._coveringTilesDetailsProvider=new ze}clone(){const t=new De;return t.apply(this),t}apply(t,e,r){this._helper.apply(t,e,r)}get cameraPosition(){return this._cameraPosition}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._viewProjMatrix}get inverseProjectionMatrix(){return this._invProjMatrix}get mercatorMatrix(){return this._mercatorMatrix}getVisibleUnwrappedCoordinates(t){const r=[new e.b2(0,t)];if(this._helper._renderWorldCopies){const i=this.screenPointToMercatorCoordinate(new e.P(0,0)),n=this.screenPointToMercatorCoordinate(new e.P(this._helper._width,0)),o=this.screenPointToMercatorCoordinate(new e.P(this._helper._width,this._helper._height)),a=this.screenPointToMercatorCoordinate(new e.P(0,this._helper._height)),s=Math.floor(Math.min(i.x,n.x,o.x,a.x)),l=Math.floor(Math.max(i.x,n.x,o.x,a.x)),c=1;for(let i=s-c;i<=l+c;i++)0!==i&&r.push(new e.b2(i,t))}return r}getCameraFrustum(){return Re.fromInvProjectionMatrix(this._invViewProjMatrix,this.worldSize)}getClippingPlane(){return null}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(t){const e=this.screenPointToLocation(this.centerPoint,t),r=t?t.getElevationForLngLatZoom(e,this._helper._tileZoom):0;this._helper.recalculateZoomAndCenter(r)}setLocationAtPoint(t,r){const i=e.aj(this.elevation,this.center.lat),n=this.screenPointToMercatorCoordinateAtZ(r,i),o=this.screenPointToMercatorCoordinateAtZ(this.centerPoint,i),a=e.a1.fromLngLat(t),s=new e.a1(a.x-(n.x-o.x),a.y-(n.y-o.y));this.setCenter(null==s?void 0:s.toLngLat()),this._helper._renderWorldCopies&&this.setCenter(this.center.wrap())}locationToScreenPoint(t,r){return r?this.coordinatePoint(e.a1.fromLngLat(t),r.getElevationForLngLatZoom(t,this._helper._tileZoom),this._pixelMatrix3D):this.coordinatePoint(e.a1.fromLngLat(t))}screenPointToLocation(t,e){var r;return null===(r=this.screenPointToMercatorCoordinate(t,e))||void 0===r?void 0:r.toLngLat()}screenPointToMercatorCoordinate(t,e){if(e){const r=e.pointCoordinate(t);if(null!=r)return r}return this.screenPointToMercatorCoordinateAtZ(t)}screenPointToMercatorCoordinateAtZ(t,r){const i=r||0,n=[t.x,t.y,0,1],o=[t.x,t.y,1,1];e.aw(n,n,this._pixelMatrixInverse),e.aw(o,o,this._pixelMatrixInverse);const a=n[3],s=o[3],l=n[1]/a,c=o[1]/s,h=n[2]/a,u=o[2]/s,p=h===u?0:(i-h)/(u-h);return new e.a1(e.C.number(n[0]/a,o[0]/s,p)/this.worldSize,e.C.number(l,c,p)/this.worldSize,i)}coordinatePoint(t,r=0,i=this._pixelMatrix){const n=[t.x*this.worldSize,t.y*this.worldSize,r,1];return e.aw(n,n,i),new e.P(n[0]/n[3],n[1]/n[3])}getBounds(){const t=Math.max(0,this._helper._height/2-ht(this));return(new $).extend(this.screenPointToLocation(new e.P(0,t))).extend(this.screenPointToLocation(new e.P(this._helper._width,t))).extend(this.screenPointToLocation(new e.P(this._helper._width,this._helper._height))).extend(this.screenPointToLocation(new e.P(0,this._helper._height)))}isPointOnMapSurface(t,e){return e?null!=e.pointCoordinate(t):t.y>this.height/2-ht(this)}calculatePosMatrix(t,r=!1,i){var n;const o=null!==(n=t.key)&&void 0!==n?n:e.b3(t.wrap,t.canonical.z,t.canonical.z,t.canonical.x,t.canonical.y),a=r?this._alignedPosMatrixCache:this._posMatrixCache;if(a.has(o)){const t=a.get(o);return i?t.f32:t.f64}const s=ut(t,this.worldSize);e.O(s,r?this._alignedProjMatrix:this._viewProjMatrix,s);const l={f64:s,f32:new Float32Array(s)};return a.set(o,l),i?l.f32:l.f64}calculateFogMatrix(t){const r=t.key,i=this._fogMatrixCacheF32;if(i.has(r))return i.get(r);const n=ut(t,this.worldSize);return e.O(n,this._fogMatrix,n),i.set(r,new Float32Array(n)),i.get(r)}getConstrained(t,r){r=e.ah(+r,this.minZoom,this.maxZoom);const i={center:new e.S(t.lng,t.lat),zoom:r};let n=this._helper._lngRange;if(!this._helper._renderWorldCopies&&null===n){const t=180-1e-10;n=[-t,t]}const o=this.tileSize*e.af(i.zoom);let a=0,s=o,l=0,c=o,h=0,u=0;const{x:p,y:d}=this.size;if(this._helper._latRange){const t=this._helper._latRange;a=e.U(t[1])*o,s=e.U(t[0])*o,s-a<d&&(h=d/(s-a))}n&&(l=e.aO(e.V(n[0])*o,0,o),c=e.aO(e.V(n[1])*o,0,o),c<l&&(c+=o),c-l<p&&(u=p/(c-l)));const{x:f,y:m}=lt(o,t);let g,_;const y=Math.max(u||0,h||0);if(y){const t=new e.P(u?(c+l)/2:f,h?(s+a)/2:m);return i.center=ct(o,t).wrap(),i.zoom+=e.ak(y),i}if(this._helper._latRange){const t=d/2;m-t<a&&(_=a+t),m+t>s&&(_=s-t)}if(n){const t=(l+c)/2;let r=f;this._helper._renderWorldCopies&&(r=e.aO(f,t-o/2,t+o/2));const i=p/2;r-i<l&&(g=l+i),r+i>c&&(g=c-i)}if(void 0!==g||void 0!==_){const t=new e.P(null!=g?g:f,null!=_?_:m);i.center=ct(o,t).wrap()}return i}calculateCenterFromCameraLngLatAlt(t,e,r,i){return this._helper.calculateCenterFromCameraLngLatAlt(t,e,r,i)}_calculateNearFarZIfNeeded(t,r,i){if(!this._helper.autoCalculateNearFarZ)return;const n=Math.min(this.elevation,this.minElevationForCurrentTile,this.getCameraAltitude()-100),o=t-n*this._helper._pixelPerMeter/Math.cos(r),a=n<0?o:t,s=Math.PI/2+this.pitchInRadians,l=e.ae(this.fov)*(Math.abs(Math.cos(e.ae(this.roll)))*this.height+Math.abs(Math.sin(e.ae(this.roll)))*this.width)/this.height*(.5+i.y/this.height),c=Math.sin(l)*a/Math.sin(e.ah(Math.PI-s-l,.01,Math.PI-.01)),h=ht(this),u=Math.atan(h/this._helper.cameraToCenterDistance),p=e.ae(.75),d=u>p?2*u*(.5+i.y/(2*h)):p,f=Math.sin(d)*a/Math.sin(e.ah(Math.PI-s-d,.01,Math.PI-.01)),m=Math.min(c,f);this._helper._farZ=1.01*(Math.cos(Math.PI/2-r)*m+a),this._helper._nearZ=this._helper._height/50}_calcMatrices(){if(!this._helper._height)return;const t=this.centerOffset,r=lt(this.worldSize,this.center),i=r.x,n=r.y;this._helper._pixelPerMeter=e.aj(1,this.center.lat)*this.worldSize;const o=e.ae(Math.min(this.pitch,st)),a=Math.max(this._helper.cameraToCenterDistance/2,this._helper.cameraToCenterDistance+this._helper._elevation*this._helper._pixelPerMeter/Math.cos(o));let s;this._calculateNearFarZIfNeeded(a,o,t),s=new Float64Array(16),e.b4(s,this.fovInRadians,this._helper._width/this._helper._height,this._helper._nearZ,this._helper._farZ),this._invProjMatrix=new Float64Array(16),e.aq(this._invProjMatrix,s),s[8]=2*-t.x/this._helper._width,s[9]=2*t.y/this._helper._height,this._projectionMatrix=e.b5(s),e.N(s,s,[1,-1,1]),e.M(s,s,[0,0,-this._helper.cameraToCenterDistance]),e.b6(s,s,-this.rollInRadians),e.b7(s,s,this.pitchInRadians),e.b6(s,s,-this.bearingInRadians),e.M(s,s,[-i,-n,0]),this._mercatorMatrix=e.N([],s,[this.worldSize,this.worldSize,this.worldSize]),e.N(s,s,[1,1,this._helper._pixelPerMeter]),this._pixelMatrix=e.O(new Float64Array(16),this.clipSpaceToPixelsMatrix,s),e.M(s,s,[0,0,-this.elevation]),this._viewProjMatrix=s,this._invViewProjMatrix=e.aq([],s);const l=[0,0,-1,1];e.aw(l,l,this._invViewProjMatrix),this._cameraPosition=[l[0]/l[3],l[1]/l[3],l[2]/l[3]],this._fogMatrix=new Float64Array(16),e.b4(this._fogMatrix,this.fovInRadians,this.width/this.height,a,this._helper._farZ),this._fogMatrix[8]=2*-t.x/this.width,this._fogMatrix[9]=2*t.y/this.height,e.N(this._fogMatrix,this._fogMatrix,[1,-1,1]),e.M(this._fogMatrix,this._fogMatrix,[0,0,-this.cameraToCenterDistance]),e.b6(this._fogMatrix,this._fogMatrix,-this.rollInRadians),e.b7(this._fogMatrix,this._fogMatrix,this.pitchInRadians),e.b6(this._fogMatrix,this._fogMatrix,-this.bearingInRadians),e.M(this._fogMatrix,this._fogMatrix,[-i,-n,0]),e.N(this._fogMatrix,this._fogMatrix,[1,1,this._helper._pixelPerMeter]),e.M(this._fogMatrix,this._fogMatrix,[0,0,-this.elevation]),this._pixelMatrix3D=e.O(new Float64Array(16),this.clipSpaceToPixelsMatrix,s);const c=this._helper._width%2/2,h=this._helper._height%2/2,u=Math.cos(this.bearingInRadians),p=Math.sin(-this.bearingInRadians),d=i-Math.round(i)+u*c+p*h,f=n-Math.round(n)+u*h+p*c,m=new Float64Array(s);if(e.M(m,m,[d>.5?d-1:d,f>.5?f-1:f,0]),this._alignedProjMatrix=m,s=e.aq(new Float64Array(16),this._pixelMatrix),!s)throw new Error("failed to invert matrix");this._pixelMatrixInverse=s,this._clearMatrixCaches()}_clearMatrixCaches(){this._posMatrixCache.clear(),this._alignedPosMatrixCache.clear(),this._fogMatrixCacheF32.clear()}maxPitchScaleFactor(){if(!this._pixelMatrixInverse)return 1;const t=this.screenPointToMercatorCoordinate(new e.P(0,0)),r=[t.x*this.worldSize,t.y*this.worldSize,0,1];return e.aw(r,r,this._pixelMatrix)[3]/this._helper.cameraToCenterDistance}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){const t=e.aj(1,this.center.lat)*this.worldSize;return pt(this.center,this.elevation,this.pitch,this.bearing,this._helper.cameraToCenterDistance/t).toLngLat()}lngLatToCameraDepth(t,r){const i=e.a1.fromLngLat(t),n=[i.x*this.worldSize,i.y*this.worldSize,r,1];return e.aw(n,n,this._viewProjMatrix),n[2]/n[3]}getProjectionData(t){const{overscaledTileID:r,aligned:i,applyTerrainMatrix:n}=t,o=this._helper.getMercatorTileCoordinates(r),a=r?this.calculatePosMatrix(r,i,!0):null;let s;return s=r&&r.terrainRttPosMatrix32f&&n?r.terrainRttPosMatrix32f:a||e.b8(),{mainMatrix:s,tileMercatorCoords:o,clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:s}}isLocationOccluded(t){return!1}getPixelScale(){return 1}getCircleRadiusCorrection(){return 1}getPitchedTextCorrection(t,e,r){return 1}transformLightDirection(t){return e.aT(t)}getRayDirectionFromPixel(t){throw new Error("Not implemented.")}projectTileCoordinates(t,r,i,n){const o=this.calculatePosMatrix(i);let a;n?(a=[t,r,n(t,r),1],e.aw(a,a,o)):(a=[t,r,0,1],qt(a,a,o));const s=a[3];return{point:new e.P(a[0]/s,a[1]/s),signedDistanceFromCamera:s,isOccluded:!1}}populateCache(t){for(const e of t)this.calculatePosMatrix(e)}getMatrixForModel(t,r){const i=e.a1.fromLngLat(t,r),n=i.meterInMercatorCoordinateUnits(),o=e.b9();return e.M(o,o,[i.x,i.y,i.z]),e.b6(o,o,Math.PI),e.b7(o,o,Math.PI/2),e.N(o,o,[-n,n,n]),o}getProjectionDataForCustomLayer(t=!0){const r=new e.Z(0,0,0,0,0),i=this.getProjectionData({overscaledTileID:r,applyGlobeMatrix:t}),n=ut(r,this.worldSize);e.O(n,this._viewProjMatrix,n),i.tileMercatorCoords=[0,0,1,1];const o=[e.$,e.$,this.worldSize/this._helper.pixelsPerMeter],a=e.ba();return e.N(a,n,o),i.fallbackMatrix=a,i.mainMatrix=a,i}getFastPathSimpleProjectionMatrix(t){return this.calculatePosMatrix(t)}}function Le(){e.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.")}function Fe(t){if(t.useSlerp)if(t.k<1){const r=e.bb(t.startEulerAngles.roll,t.startEulerAngles.pitch,t.startEulerAngles.bearing),i=e.bb(t.endEulerAngles.roll,t.endEulerAngles.pitch,t.endEulerAngles.bearing),n=new Float64Array(4);e.bc(n,r,i,t.k);const o=e.bd(n);t.tr.setRoll(o.roll),t.tr.setPitch(o.pitch),t.tr.setBearing(o.bearing)}else t.tr.setRoll(t.endEulerAngles.roll),t.tr.setPitch(t.endEulerAngles.pitch),t.tr.setBearing(t.endEulerAngles.bearing);else t.tr.setRoll(e.C.number(t.startEulerAngles.roll,t.endEulerAngles.roll,t.k)),t.tr.setPitch(e.C.number(t.startEulerAngles.pitch,t.endEulerAngles.pitch,t.k)),t.tr.setBearing(e.C.number(t.startEulerAngles.bearing,t.endEulerAngles.bearing,t.k))}function Be(t,r,i,n,o){const a=o.padding,s=lt(o.worldSize,i.getNorthWest()),l=lt(o.worldSize,i.getNorthEast()),c=lt(o.worldSize,i.getSouthEast()),h=lt(o.worldSize,i.getSouthWest()),u=e.ae(-n),p=s.rotate(u),d=l.rotate(u),f=c.rotate(u),m=h.rotate(u),g=new e.P(Math.max(p.x,d.x,m.x,f.x),Math.max(p.y,d.y,m.y,f.y)),_=new e.P(Math.min(p.x,d.x,m.x,f.x),Math.min(p.y,d.y,m.y,f.y)),y=g.sub(_),b=(o.width-(a.left+a.right+r.left+r.right))/y.x,v=(o.height-(a.top+a.bottom+r.top+r.bottom))/y.y;if(v<0||b<0)return void Le();const x=Math.min(e.ak(o.scale*Math.min(b,v)),t.maxZoom),w=e.P.convert(t.offset),T=new e.P((r.left-r.right)/2,(r.top-r.bottom)/2).rotate(e.ae(n)),S=w.add(T).mult(o.scale/e.af(x));return{center:ct(o.worldSize,s.add(c).div(2).sub(S)),zoom:x,bearing:n}}class Oe{get useGlobeControls(){return!1}handlePanInertia(t,e){return{easingOffset:t,easingCenter:e.center}}handleMapControlsRollPitchBearingZoom(t,e){t.bearingDelta&&e.setBearing(e.bearing+t.bearingDelta),t.pitchDelta&&e.setPitch(e.pitch+t.pitchDelta),t.rollDelta&&e.setRoll(e.roll+t.rollDelta),t.zoomDelta&&e.setZoom(e.zoom+t.zoomDelta)}handleMapControlsPan(t,e,r){t.around.distSqr(e.centerPoint)<.01||e.setLocationAtPoint(r,t.around)}cameraForBoxAndBearing(t,e,r,i,n){return Be(t,e,r,i,n)}handleJumpToCenterZoom(t,r){t.zoom!==(void 0!==r.zoom?+r.zoom:t.zoom)&&t.setZoom(+r.zoom),void 0!==r.center&&t.setCenter(e.S.convert(r.center))}handleEaseTo(t,r){const i=t.zoom,n=t.padding,o={roll:t.roll,pitch:t.pitch,bearing:t.bearing},a={roll:void 0===r.roll?t.roll:r.roll,pitch:void 0===r.pitch?t.pitch:r.pitch,bearing:void 0===r.bearing?t.bearing:r.bearing},s=void 0!==r.zoom,l=!t.isPaddingEqual(r.padding);let c=!1;const h=s?+r.zoom:t.zoom;let u=t.centerPoint.add(r.offsetAsPoint);const p=t.screenPointToLocation(u),{center:d,zoom:f}=t.getConstrained(e.S.convert(r.center||p),null!=h?h:i);Ae(t,d);const m=lt(t.worldSize,p),g=lt(t.worldSize,d).sub(m),_=e.af(f-i);return c=f!==i,{easeFunc:s=>{if(c&&t.setZoom(e.C.number(i,f,s)),e.be(o,a)||Fe({startEulerAngles:o,endEulerAngles:a,tr:t,k:s,useSlerp:o.roll!=a.roll}),l&&(t.interpolatePadding(n,r.padding,s),u=t.centerPoint.add(r.offsetAsPoint)),r.around)t.setLocationAtPoint(r.around,r.aroundPoint);else{const r=e.af(t.zoom-i),n=f>i?Math.min(2,_):Math.max(.5,_),o=Math.pow(n,1-s),a=ct(t.worldSize,m.add(g.mult(s*o)).mult(r));t.setLocationAtPoint(t.renderWorldCopies?a.wrap():a,u)}},isZooming:c,elevationCenter:d}}handleFlyTo(t,r){const i=void 0!==r.zoom,n=t.zoom,o=t.getConstrained(e.S.convert(r.center||r.locationAtOffset),i?+r.zoom:n),a=o.center,s=o.zoom;Ae(t,a);const l=lt(t.worldSize,r.locationAtOffset),c=lt(t.worldSize,a).sub(l),h=c.mag(),u=e.af(s-n);let p;if(void 0!==r.minZoom){const i=Math.min(+r.minZoom,n,s),o=t.getConstrained(a,i).zoom;p=e.af(o-n)}return{easeFunc:(r,i,o,h)=>{t.setZoom(1===r?s:n+e.ak(i));const u=1===r?a:ct(t.worldSize,l.add(c.mult(o)).mult(i));t.setLocationAtPoint(t.renderWorldCopies?u.wrap():u,h)},scaleOfZoom:u,targetCenter:a,scaleOfMinZoom:p,pixelPathLength:h}}}class je{constructor(t,e,r){this.blendFunction=t,this.blendColor=e,this.mask=r}}je.Replace=[1,0],je.disabled=new je(je.Replace,e.bf.transparent,[!1,!1,!1,!1]),je.unblended=new je(je.Replace,e.bf.transparent,[!0,!0,!0,!0]),je.alphaBlended=new je([1,771],e.bf.transparent,[!0,!0,!0,!0]);const Ue=2305;class Ne{constructor(t,e,r){this.enable=t,this.mode=e,this.frontFace=r}}Ne.disabled=new Ne(!1,1029,Ue),Ne.backCCW=new Ne(!0,1029,Ue),Ne.frontCCW=new Ne(!0,1028,Ue);class Ve{constructor(t,e,r){this.func=t,this.mask=e,this.range=r}}Ve.ReadOnly=!1,Ve.ReadWrite=!0,Ve.disabled=new Ve(519,Ve.ReadOnly,[0,1]);const $e=7680;class Ze{constructor(t,e,r,i,n,o){this.test=t,this.ref=e,this.mask=r,this.fail=i,this.depthFail=n,this.pass=o}}Ze.disabled=new Ze({func:519,mask:0},0,0,$e,$e,$e);const Ge=new WeakMap;function qe(t){var e;if(Ge.has(t))return Ge.get(t);{const r=null===(e=t.getParameter(t.VERSION))||void 0===e?void 0:e.startsWith("WebGL 2.0");return Ge.set(t,r),r}}class He{get awaitingQuery(){return!!this._readbackQueue}constructor(t){this._readbackWaitFrames=4,this._measureWaitFrames=6,this._texWidth=1,this._texHeight=1,this._measuredError=0,this._updateCount=0,this._lastReadbackFrame=-1e3,this._readbackQueue=null,this._cachedRenderContext=t;const r=t.context,i=r.gl;this._texFormat=i.RGBA,this._texType=i.UNSIGNED_BYTE;const n=new e.aL;n.emplaceBack(-1,-1),n.emplaceBack(2,-1),n.emplaceBack(-1,2);const o=new e.aN;o.emplaceBack(0,1,2),this._fullscreenTriangle=new we(r.createVertexBuffer(n,Te.members),r.createIndexBuffer(o),e.aM.simpleSegment(0,0,n.length,o.length)),this._resultBuffer=new Uint8Array(4),r.activeTexture.set(i.TEXTURE1);const a=i.createTexture();i.bindTexture(i.TEXTURE_2D,a),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.NEAREST),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.NEAREST),i.texImage2D(i.TEXTURE_2D,0,this._texFormat,this._texWidth,this._texHeight,0,this._texFormat,this._texType,null),this._fbo=r.createFramebuffer(this._texWidth,this._texHeight,!1,!1),this._fbo.colorAttachment.set(a),qe(i)&&(this._pbo=i.createBuffer(),i.bindBuffer(i.PIXEL_PACK_BUFFER,this._pbo),i.bufferData(i.PIXEL_PACK_BUFFER,4,i.STREAM_READ),i.bindBuffer(i.PIXEL_PACK_BUFFER,null))}destroy(){const t=this._cachedRenderContext.context.gl;this._fullscreenTriangle.destroy(),this._fbo.destroy(),t.deleteBuffer(this._pbo),this._fullscreenTriangle=null,this._fbo=null,this._pbo=null,this._resultBuffer=null}updateErrorLoop(t,e){const r=this._updateCount;return this._readbackQueue?r>=this._readbackQueue.frameNumberIssued+this._readbackWaitFrames&&this._tryReadback():r>=this._lastReadbackFrame+this._measureWaitFrames&&this._renderErrorTexture(t,e),this._updateCount++,this._measuredError}_bindFramebuffer(){const t=this._cachedRenderContext.context,e=t.gl;t.activeTexture.set(e.TEXTURE1),e.bindTexture(e.TEXTURE_2D,this._fbo.colorAttachment.get()),t.bindFramebuffer.set(this._fbo.framebuffer)}_renderErrorTexture(t,r){const i=this._cachedRenderContext.context,n=i.gl;if(this._bindFramebuffer(),i.viewport.set([0,0,this._texWidth,this._texHeight]),i.clear({color:e.bf.transparent}),this._cachedRenderContext.useProgram("projectionErrorMeasurement").draw(i,n.TRIANGLES,Ve.disabled,Ze.disabled,je.unblended,Ne.disabled,((t,e)=>({u_input:t,u_output_expected:e}))(t,r),null,null,"$clipping",this._fullscreenTriangle.vertexBuffer,this._fullscreenTriangle.indexBuffer,this._fullscreenTriangle.segments),this._pbo&&qe(n)){n.bindBuffer(n.PIXEL_PACK_BUFFER,this._pbo),n.readBuffer(n.COLOR_ATTACHMENT0),n.readPixels(0,0,this._texWidth,this._texHeight,this._texFormat,this._texType,0),n.bindBuffer(n.PIXEL_PACK_BUFFER,null);const t=n.fenceSync(n.SYNC_GPU_COMMANDS_COMPLETE,0);n.flush(),this._readbackQueue={frameNumberIssued:this._updateCount,sync:t}}else this._readbackQueue={frameNumberIssued:this._updateCount,sync:null}}_tryReadback(){const t=this._cachedRenderContext.context.gl;if(this._pbo&&this._readbackQueue&&qe(t)){const r=t.clientWaitSync(this._readbackQueue.sync,0,0);if(r===t.WAIT_FAILED)return e.w("WebGL2 clientWaitSync failed."),this._readbackQueue=null,void(this._lastReadbackFrame=this._updateCount);if(r===t.TIMEOUT_EXPIRED)return;t.bindBuffer(t.PIXEL_PACK_BUFFER,this._pbo),t.getBufferSubData(t.PIXEL_PACK_BUFFER,0,this._resultBuffer,0,4),t.bindBuffer(t.PIXEL_PACK_BUFFER,null)}else this._bindFramebuffer(),t.readPixels(0,0,this._texWidth,this._texHeight,this._texFormat,this._texType,this._resultBuffer);this._readbackQueue=null,this._measuredError=He._parseRGBA8float(this._resultBuffer),this._lastReadbackFrame=this._updateCount}static _parseRGBA8float(t){let e=0;return e+=t[0]/256,e+=t[1]/65536,e+=t[2]/16777216,t[3]<127&&(e=-e),e/128}}const We=e.$/128;function Xe(t,r){const i=void 0!==t.granularity?Math.max(t.granularity,1):1,n=i+(t.generateBorders?2:0),o=i+(t.extendToNorthPole||t.generateBorders?1:0)+(t.extendToSouthPole||t.generateBorders?1:0),a=n+1,s=o+1,l=t.generateBorders?-1:0,c=t.generateBorders||t.extendToNorthPole?-1:0,h=i+(t.generateBorders?1:0),u=i+(t.generateBorders||t.extendToSouthPole?1:0),p=a*s,d=n*o*6,f=a*s>65536;if(f&&"16bit"===r)throw new Error("Granularity is too large and meshes would not fit inside 16 bit vertex indices.");const m=f||"32bit"===r,g=new Int16Array(2*p);let _=0;for(let r=c;r<=u;r++)for(let n=l;n<=h;n++){let o=n/i*e.$;-1===n&&(o=-We),n===i+1&&(o=e.$+We);let a=r/i*e.$;-1===r&&(a=t.extendToNorthPole?e.bh:-We),r===i+1&&(a=t.extendToSouthPole?e.bi:e.$+We),g[_++]=o,g[_++]=a}const y=m?new Uint32Array(d):new Uint16Array(d);let b=0;for(let t=0;t<o;t++)for(let e=0;e<n;e++){const r=e+1+t*a,i=e+(t+1)*a,n=e+1+(t+1)*a;y[b++]=e+t*a,y[b++]=i,y[b++]=r,y[b++]=r,y[b++]=i,y[b++]=n}return{vertices:g.buffer.slice(0),indices:y.buffer.slice(0),uses32bitIndices:m}}const Ke=new e.aK({fill:new e.bj(128,2),line:new e.bj(512,0),tile:new e.bj(128,32),stencil:new e.bj(128,1),circle:3});class Ye{constructor(){this._tileMeshCache={},this._errorCorrectionUsable=0,this._errorMeasurementLastValue=0,this._errorCorrectionPreviousValue=0,this._errorMeasurementLastChangeTime=-1e3}get name(){return"vertical-perspective"}get transitionState(){return 1}get useSubdivision(){return!0}get shaderVariantName(){return"globe"}get shaderDefine(){return"#define GLOBE"}get shaderPreludeCode(){return ve.projectionGlobe}get vertexShaderPreludeCode(){return ve.projectionMercator.vertexSource}get subdivisionGranularity(){return Ke}get useGlobeControls(){return!0}get latitudeErrorCorrectionRadians(){return this._errorCorrectionUsable}destroy(){this._errorMeasurement&&this._errorMeasurement.destroy()}updateGPUdependent(t){this._errorMeasurement||(this._errorMeasurement=new He(t));const r=e.U(this._errorQueryLatitudeDegrees),i=2*Math.atan(Math.exp(Math.PI-r*Math.PI*2))-.5*Math.PI,n=this._errorMeasurement.updateErrorLoop(r,i),o=a.now();n!==this._errorMeasurementLastValue&&(this._errorCorrectionPreviousValue=this._errorCorrectionUsable,this._errorMeasurementLastValue=n,this._errorMeasurementLastChangeTime=o);const s=Math.min(Math.max((o-this._errorMeasurementLastChangeTime)/1e3/.5,0),1);this._errorCorrectionUsable=e.bk(this._errorCorrectionPreviousValue,-this._errorMeasurementLastValue,e.bl(s))}_getMeshKey(t){return`${t.granularity.toString(36)}_${t.generateBorders?"b":""}${t.extendToNorthPole?"n":""}${t.extendToSouthPole?"s":""}`}getMeshFromTileID(t,e,r,i,n){const o=("stencil"===n?Ke.stencil:Ke.tile).getGranularityForZoomLevel(e.z);return this._getMesh(t,{granularity:o,generateBorders:r,extendToNorthPole:0===e.y&&i,extendToSouthPole:e.y===(1<<e.z)-1&&i})}_getMesh(t,r){const i=this._getMeshKey(r);if(i in this._tileMeshCache)return this._tileMeshCache[i];const n=function(t,r){const i=Xe(r,"16bit"),n=e.aL.deserialize({arrayBuffer:i.vertices,length:i.vertices.byteLength/2/2}),o=e.aN.deserialize({arrayBuffer:i.indices,length:i.indices.byteLength/2/3});return new we(t.createVertexBuffer(n,Te.members),t.createIndexBuffer(o),e.aM.simpleSegment(0,0,n.length,o.length))}(t,r);return this._tileMeshCache[i]=n,n}recalculate(t){}hasTransition(){const t=a.now();let e=!1;return e=e||(t-this._errorMeasurementLastChangeTime)/1e3<.7,e=e||this._errorMeasurement&&this._errorMeasurement.awaitingQuery,e}setErrorQueryLatitudeDegrees(t){this._errorQueryLatitudeDegrees=t}}const Je=new e.r({type:new e.D(e.v.projection.type)});class Qe extends e.E{constructor(t){super(),this._transitionable=new e.t(Je),this.setProjection(t),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new e.F(0)),this._mercatorProjection=new Ce,this._verticalPerspectiveProjection=new Ye}get transitionState(){const t=this.properties.get("type");if("string"==typeof t&&"mercator"===t)return 0;if("string"==typeof t&&"vertical-perspective"===t)return 1;if(t instanceof e.bm){if("vertical-perspective"===t.from&&"mercator"===t.to)return 1-t.transition;if("mercator"===t.from&&"vertical-perspective"===t.to)return t.transition}return 1}get useGlobeRendering(){return this.transitionState>0}get latitudeErrorCorrectionRadians(){return this._verticalPerspectiveProjection.latitudeErrorCorrectionRadians}get currentProjection(){return this.useGlobeRendering?this._verticalPerspectiveProjection:this._mercatorProjection}get name(){return"globe"}get useSubdivision(){return this.currentProjection.useSubdivision}get shaderVariantName(){return this.currentProjection.shaderVariantName}get shaderDefine(){return this.currentProjection.shaderDefine}get shaderPreludeCode(){return this.currentProjection.shaderPreludeCode}get vertexShaderPreludeCode(){return this.currentProjection.vertexShaderPreludeCode}get subdivisionGranularity(){return this.currentProjection.subdivisionGranularity}get useGlobeControls(){return this.transitionState>0}destroy(){this._mercatorProjection.destroy(),this._verticalPerspectiveProjection.destroy()}updateGPUdependent(t){this._mercatorProjection.updateGPUdependent(t),this._verticalPerspectiveProjection.updateGPUdependent(t)}getMeshFromTileID(t,e,r,i,n){return this.currentProjection.getMeshFromTileID(t,e,r,i,n)}setProjection(t){this._transitionable.setValue("type",(null==t?void 0:t.type)||"mercator")}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()||this.currentProjection.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}setErrorQueryLatitudeDegrees(t){this._verticalPerspectiveProjection.setErrorQueryLatitudeDegrees(t),this._mercatorProjection.setErrorQueryLatitudeDegrees(t)}}function tr(t){const e=ir(t.worldSize,t.center.lat);return 2*Math.PI*e}function er(t,r,i,n,o){const a=1/(1<<o),s=r/e.$*a+n*a,l=e.bo((t/e.$*a+i*a)*Math.PI*2+Math.PI,2*Math.PI),c=2*Math.atan(Math.exp(Math.PI-s*Math.PI*2))-.5*Math.PI,h=Math.cos(c),u=new Float64Array(3);return u[0]=Math.sin(l)*h,u[1]=Math.sin(c),u[2]=Math.cos(l)*h,u}function rr(t){return function(t,e){const r=Math.cos(e),i=new Float64Array(3);return i[0]=Math.sin(t)*r,i[1]=Math.sin(e),i[2]=Math.cos(t)*r,i}(t.lng*Math.PI/180,t.lat*Math.PI/180)}function ir(t,e){return t/(2*Math.PI)/Math.cos(e*Math.PI/180)}function nr(t){const r=Math.asin(t[1])/Math.PI*180,i=Math.sqrt(t[0]*t[0]+t[2]*t[2]);if(i>1e-6){const n=t[0]/i,o=Math.acos(t[2]/i),a=(n>0?o:-o)/Math.PI*180;return new e.S(e.aO(a,-180,180),r)}return new e.S(0,r)}function or(t){return Math.cos(t*Math.PI/180)}function ar(t,r){const i=or(t),n=or(r);return e.ak(n/i)}function sr(t,r){const i=t.rotate(r.bearingInRadians),n=r.zoom+ar(r.center.lat,0),o=e.bk(1/or(r.center.lat),1/or(Math.min(Math.abs(r.center.lat),60)),e.bn(n,7,3,0,1)),a=360/tr({worldSize:r.worldSize,center:{lat:r.center.lat}});return new e.S(r.center.lng-i.x*a*o,e.ah(r.center.lat+i.y*a,-e.ai,e.ai))}function lr(t){const e=.5*t,r=Math.sin(e),i=Math.cos(e);return Math.log(r+i)-Math.log(i-r)}function cr(t,r,i,n){const o=t.lat+i*n;if(Math.abs(i)>1){const a=(Math.sign(t.lat+i)!==Math.sign(t.lat)?-Math.abs(t.lat):Math.abs(t.lat))*Math.PI/180,s=Math.abs(t.lat+i)*Math.PI/180,l=lr(a+n*(s-a)),c=lr(a),h=lr(s);return new e.S(t.lng+r*((l-c)/(h-c)),o)}return new e.S(t.lng+r*n,o)}class hr{constructor(t){this._cachePrevious=new Map,this._cache=new Map,this._hadAnyChanges=!1,this._boundingVolumeFactory=t}swapBuffers(){if(!this._hadAnyChanges)return;const t=this._cachePrevious;this._cachePrevious=this._cache,this._cache=t,this._cache.clear(),this._hadAnyChanges=!1}getTileBoundingVolume(t,e,r,i){const n=`${t.z}_${t.x}_${t.y}_${(null==i?void 0:i.terrain)?"t":""}`,o=this._cache.get(n);if(o)return o;const a=this._cachePrevious.get(n);if(a)return this._cache.set(n,a),a;const s=this._boundingVolumeFactory(t,e,r,i);return this._cache.set(n,s),this._hadAnyChanges=!0,s}}class ur{constructor(t,e,r,i){this.min=r,this.max=i,this.points=t,this.planes=e}static fromAabb(t,e){const r=[];for(let i=0;i<8;i++)r.push([1&~i?t[0]:e[0],1==(i>>1&1)?e[1]:t[1],1==(i>>2&1)?e[2]:t[2]]);return new ur(r,[[-1,0,0,e[0]],[1,0,0,-t[0]],[0,-1,0,e[1]],[0,1,0,-t[1]],[0,0,-1,e[2]],[0,0,1,-t[2]]],t,e)}static fromCenterSizeAngles(t,r,i){const n=e.br([],i[0],i[1],i[2]),o=e.bs([],[r[0],0,0],n),a=e.bs([],[0,r[1],0],n),s=e.bs([],[0,0,r[2]],n),l=[...t],c=[...t];for(let e=0;e<8;e++)for(let r=0;r<3;r++){const i=t[r]+o[r]*(1&~e?-1:1)+a[r]*(1==(e>>1&1)?1:-1)+s[r]*(1==(e>>2&1)?1:-1);l[r]=Math.min(l[r],i),c[r]=Math.max(c[r],i)}const h=[];for(let r=0;r<8;r++){const i=[...t];e.aS(i,i,e.aR([],o,1&~r?-1:1)),e.aS(i,i,e.aR([],a,1==(r>>1&1)?1:-1)),e.aS(i,i,e.aR([],s,1==(r>>2&1)?1:-1)),h.push(i)}return new ur(h,[[...o,-e.aX(o,h[0])],[...a,-e.aX(a,h[0])],[...s,-e.aX(s,h[0])],[-o[0],-o[1],-o[2],-e.aX(o,h[7])],[-a[0],-a[1],-a[2],-e.aX(a,h[7])],[-s[0],-s[1],-s[2],-e.aX(s,h[7])]],l,c)}intersectsFrustum(t){let e=!0;const r=this.points.length,i=this.planes.length,n=t.planes.length,o=t.points.length;for(let i=0;i<n;i++){const n=t.planes[i];let o=0;for(let t=0;t<r;t++){const e=this.points[t];n[0]*e[0]+n[1]*e[1]+n[2]*e[2]+n[3]>=0&&o++}if(0===o)return 0;o<r&&(e=!1)}if(e)return 2;for(let e=0;e<i;e++){const r=this.planes[e];let i=0;for(let e=0;e<o;e++){const n=t.points[e];r[0]*n[0]+r[1]*n[1]+r[2]*n[2]+r[3]>=0&&i++}if(0===i)return 0}return 1}intersectsPlane(t){const e=this.points.length;let r=0;for(let i=0;i<e;i++){const e=this.points[i];t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]>=0&&r++}return r===e?2:0===r?0:1}}function pr(t,e,r){const i=t-e;return i<0?-i:Math.max(0,i-r)}function dr(t,e,r,i,n){const o=t-r;let a;return a=o<0?Math.min(-o,1+o-n):o>1?Math.min(Math.max(o-n,0),1-o):0,Math.max(a,pr(e,i,n))}class fr{constructor(){this._boundingVolumeCache=new hr(this._computeTileBoundingVolume)}prepareNextFrame(){this._boundingVolumeCache.swapBuffers()}distanceToTile2d(t,e,r,i){const n=1<<r.z,o=1/n,a=r.x/n,s=r.y/n;let l=2;return l=Math.min(l,dr(t,e,a,s,o)),l=Math.min(l,dr(t,e,a+.5,-s-o,o)),l=Math.min(l,dr(t,e,a+.5,2-s-o,o)),l}getWrap(t,e,r){const i=1<<e.z,n=1/i,o=e.x/i,a=pr(t.x,o,n),s=pr(t.x,o-1,n),l=pr(t.x,o+1,n),c=Math.min(a,s,l);return c===l?1:c===s?-1:0}allowVariableZoom(t,e){return _t(t,e)>4}allowWorldCopies(){return!1}getTileBoundingVolume(t,e,r,i){return this._boundingVolumeCache.getTileBoundingVolume(t,e,r,i)}_computeTileBoundingVolume(t,r,i,n){var o,a;let s=0,l=0;if(null==n?void 0:n.terrain){const c=new e.Z(t.z,r,t.z,t.x,t.y),h=n.terrain.getMinMaxElevation(c);s=null!==(o=h.minElevation)&&void 0!==o?o:Math.min(0,i),l=null!==(a=h.maxElevation)&&void 0!==a?a:Math.max(0,i)}if(s/=e.bu,l/=e.bu,s+=1,l+=1,t.z<=0)return ur.fromAabb([-l,-l,-l],[l,l,l]);if(1===t.z)return ur.fromAabb([0===t.x?-l:0,0===t.y?0:-l,-l],[0===t.x?0:l,0===t.y?l:0,l]);{const r=[er(0,0,t.x,t.y,t.z),er(e.$,0,t.x,t.y,t.z),er(e.$,e.$,t.x,t.y,t.z),er(0,e.$,t.x,t.y,t.z)],i=[];for(const t of r)i.push(e.aR([],t,l));if(l!==s)for(const t of r)i.push(e.aR([],t,s));0===t.y&&i.push([0,1,0]),t.y===(1<<t.z)-1&&i.push([0,-1,0]);const n=[1,1,1],o=[-1,-1,-1];for(const t of i)for(let e=0;e<3;e++)n[e]=Math.min(n[e],t[e]),o[e]=Math.max(o[e],t[e]);const a=er(e.$/2,e.$/2,t.x,t.y,t.z),c=e.aW([],[0,1,0],a);e.aV(c,c);const h=e.aW([],a,c);e.aV(h,h);const u=e.aW([],r[2],r[1]);e.aV(u,u);const p=e.aW([],r[0],r[3]);e.aV(p,p),i.push(e.aR([],a,l)),t.y>=(1<<t.z)/2&&i.push(e.aR([],er(e.$/2,0,t.x,t.y,t.z),l)),t.y<(1<<t.z)/2&&i.push(e.aR([],er(e.$/2,e.$,t.x,t.y,t.z),l));const d=mr(a,i),f=mr(h,i),m=[-a[0],-a[1],-a[2],d.max],g=[a[0],a[1],a[2],-d.min],_=[-h[0],-h[1],-h[2],f.max],y=[h[0],h[1],h[2],-f.min],b=[...u,0],v=[...p,0],x=[];return 0===t.y?x.push(e.bt(v,b,m),e.bt(v,b,g)):x.push(e.bt(_,b,m),e.bt(_,b,g),e.bt(_,v,m),e.bt(_,v,g)),t.y===(1<<t.z)-1?x.push(e.bt(v,b,m),e.bt(v,b,g)):x.push(e.bt(y,b,m),e.bt(y,b,g),e.bt(y,v,m),e.bt(y,v,g)),new ur(x,[m,g,_,y,b,v],n,o)}}}function mr(t,r){let i=1/0,n=-1/0;for(const o of r){const r=e.aX(t,o);i=Math.min(i,r),n=Math.max(n,r)}return{min:i,max:n}}class gr{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(t){this._helper.setMinZoom(t)}setMaxZoom(t){this._helper.setMaxZoom(t)}setMinPitch(t){this._helper.setMinPitch(t)}setMaxPitch(t){this._helper.setMaxPitch(t)}setRenderWorldCopies(t){this._helper.setRenderWorldCopies(t)}setBearing(t){this._helper.setBearing(t)}setPitch(t){this._helper.setPitch(t)}setRoll(t){this._helper.setRoll(t)}setFov(t){this._helper.setFov(t)}setZoom(t){this._helper.setZoom(t)}setCenter(t){this._helper.setCenter(t)}setElevation(t){this._helper.setElevation(t)}setMinElevationForCurrentTile(t){this._helper.setMinElevationForCurrentTile(t)}setPadding(t){this._helper.setPadding(t)}interpolatePadding(t,e,r){return this._helper.interpolatePadding(t,e,r)}isPaddingEqual(t){return this._helper.isPaddingEqual(t)}resize(t,e){this._helper.resize(t,e)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(t){this._helper.setMaxBounds(t)}overrideNearFarZ(t,e){this._helper.overrideNearFarZ(t,e)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(t){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),t)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(t){}constructor(){this._cachedClippingPlane=e.bv(),this._projectionMatrix=e.b9(),this._globeViewProjMatrix32f=e.b8(),this._globeViewProjMatrixNoCorrection=e.b9(),this._globeViewProjMatrixNoCorrectionInverted=e.b9(),this._globeProjMatrixInverted=e.b9(),this._cameraPosition=e.bp(),this._globeLatitudeErrorCorrectionRadians=0,this._helper=new Ee({calcMatrices:()=>{this._calcMatrices()},getConstrained:(t,e)=>this.getConstrained(t,e)}),this._coveringTilesDetailsProvider=new fr}clone(){const t=new gr;return t.apply(this),t}apply(t,e){this._globeLatitudeErrorCorrectionRadians=e||0,this._helper.apply(t)}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._globeViewProjMatrixNoCorrection}get inverseProjectionMatrix(){return this._globeProjMatrixInverted}get cameraPosition(){const t=e.bp();return t[0]=this._cameraPosition[0],t[1]=this._cameraPosition[1],t[2]=this._cameraPosition[2],t}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}getProjectionData(t){const{overscaledTileID:e,applyGlobeMatrix:r}=t,i=this._helper.getMercatorTileCoordinates(e);return{mainMatrix:this._globeViewProjMatrix32f,tileMercatorCoords:i,clippingPlane:this._cachedClippingPlane,projectionTransition:r?1:0,fallbackMatrix:this._globeViewProjMatrix32f}}_computeClippingPlane(t){const r=this.pitchInRadians,i=this.cameraToCenterDistance/t,n=Math.sin(r)*i,o=Math.cos(r)*i+1,a=1/Math.sqrt(n*n+o*o)*1;let s=-n,l=o;const c=Math.sqrt(s*s+l*l);s/=c,l/=c;const h=[0,s,l];e.bw(h,h,[0,0,0],-this.bearingInRadians),e.bx(h,h,[0,0,0],-1*this.center.lat*Math.PI/180),e.by(h,h,[0,0,0],this.center.lng*Math.PI/180);const u=1/e.aZ(h);return e.aR(h,h,u),[...h,-a*u]}isLocationOccluded(t){return!this.isSurfacePointVisible(rr(t))}transformLightDirection(t){const r=this._helper._center.lng*Math.PI/180,i=this._helper._center.lat*Math.PI/180,n=Math.cos(i),o=[Math.sin(r)*n,Math.sin(i),Math.cos(r)*n],a=[o[2],0,-o[0]],s=[0,0,0];e.aW(s,a,o),e.aV(a,a),e.aV(s,s);const l=[0,0,0];return e.aV(l,[a[0]*t[0]+s[0]*t[1]+o[0]*t[2],a[1]*t[0]+s[1]*t[1]+o[1]*t[2],a[2]*t[0]+s[2]*t[1]+o[2]*t[2]]),l}getPixelScale(){return 1/Math.cos(this._helper._center.lat*Math.PI/180)}getCircleRadiusCorrection(){return Math.cos(this._helper._center.lat*Math.PI/180)}getPitchedTextCorrection(t,r,i){const n=function(t,r,i){const n=1/(1<<i.z);return new e.a1(t/e.$*n+i.x*n,r/e.$*n+i.y*n)}(t,r,i.canonical),o=(a=n.y,[e.bo(n.x*Math.PI*2+Math.PI,2*Math.PI),2*Math.atan(Math.exp(Math.PI-a*Math.PI*2))-.5*Math.PI]);var a;return this.getCircleRadiusCorrection()/Math.cos(o[1])}projectTileCoordinates(t,r,i,n){const o=i.canonical,a=er(t,r,o.x,o.y,o.z),s=1+(n?n(t,r):0)/e.bu,l=[a[0]*s,a[1]*s,a[2]*s,1];e.aw(l,l,this._globeViewProjMatrixNoCorrection);const c=this._cachedClippingPlane,h=c[0]*a[0]+c[1]*a[1]+c[2]*a[2]+c[3]<0;return{point:new e.P(l[0]/l[3],l[1]/l[3]),signedDistanceFromCamera:l[3],isOccluded:h}}_calcMatrices(){if(!this._helper._width||!this._helper._height)return;const t=ir(this.worldSize,this.center.lat),r=e.ba(),i=e.ba();this._helper.autoCalculateNearFarZ&&(this._helper._nearZ=.5,this._helper._farZ=this.cameraToCenterDistance+2*t),e.b4(r,this.fovInRadians,this.width/this.height,this._helper._nearZ,this._helper._farZ);const n=this.centerOffset;r[8]=2*-n.x/this._helper._width,r[9]=2*n.y/this._helper._height,this._projectionMatrix=e.b5(r),this._globeProjMatrixInverted=e.ba(),e.aq(this._globeProjMatrixInverted,r),e.M(r,r,[0,0,-this.cameraToCenterDistance]),e.b6(r,r,this.rollInRadians),e.b7(r,r,-this.pitchInRadians),e.b6(r,r,this.bearingInRadians),e.M(r,r,[0,0,-t]);const o=e.bp();o[0]=t,o[1]=t,o[2]=t,e.b7(i,r,this.center.lat*Math.PI/180),e.bz(i,i,-this.center.lng*Math.PI/180),e.N(i,i,o),this._globeViewProjMatrixNoCorrection=i,e.b7(r,r,this.center.lat*Math.PI/180-this._globeLatitudeErrorCorrectionRadians),e.bz(r,r,-this.center.lng*Math.PI/180),e.N(r,r,o),this._globeViewProjMatrix32f=new Float32Array(r),this._globeViewProjMatrixNoCorrectionInverted=e.ba(),e.aq(this._globeViewProjMatrixNoCorrectionInverted,i);const a=e.bp();this._cameraPosition=e.bp(),this._cameraPosition[2]=this.cameraToCenterDistance/t,e.bw(this._cameraPosition,this._cameraPosition,a,-this.rollInRadians),e.bx(this._cameraPosition,this._cameraPosition,a,this.pitchInRadians),e.bw(this._cameraPosition,this._cameraPosition,a,-this.bearingInRadians),e.aS(this._cameraPosition,this._cameraPosition,[0,0,1]),e.bx(this._cameraPosition,this._cameraPosition,a,-this.center.lat*Math.PI/180),e.by(this._cameraPosition,this._cameraPosition,a,this.center.lng*Math.PI/180),this._cachedClippingPlane=this._computeClippingPlane(t);const s=e.b5(this._globeViewProjMatrixNoCorrectionInverted);e.N(s,s,[1,1,-1]),this._cachedFrustum=Re.fromInvProjectionMatrix(s,1,0,this._cachedClippingPlane,!0)}calculateFogMatrix(t){e.w("calculateFogMatrix is not supported on globe projection.");const r=e.ba();return e.ag(r),r}getVisibleUnwrappedCoordinates(t){return[new e.b2(0,t)]}getCameraFrustum(){return this._cachedFrustum}getClippingPlane(){return this._cachedClippingPlane}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(t){t&&e.w("terrain is not fully supported on vertical perspective projection."),this._helper.recalculateZoomAndCenter(0)}maxPitchScaleFactor(){return 1}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){return this._helper.getCameraLngLat()}lngLatToCameraDepth(t,r){if(!this._globeViewProjMatrixNoCorrection)return 1;const i=rr(t);e.aR(i,i,1+r/e.bu);const n=e.bv();return e.aw(n,[i[0],i[1],i[2],1],this._globeViewProjMatrixNoCorrection),n[2]/n[3]}populateCache(t){}getBounds(){const t=.5*this.width,r=.5*this.height,i=[new e.P(0,0),new e.P(t,0),new e.P(this.width,0),new e.P(this.width,r),new e.P(this.width,this.height),new e.P(t,this.height),new e.P(0,this.height),new e.P(0,r)],n=[];for(const t of i)n.push(this.unprojectScreenPoint(t));let o=0,a=0,s=0,l=0;const c=this.center;for(const t of n){const r=e.bA(c.lng,t.lng),i=e.bA(c.lat,t.lat);r<a&&(a=r),r>o&&(o=r),i<l&&(l=i),i>s&&(s=i)}const h=[c.lng+a,c.lat+l,c.lng+o,c.lat+s];return this.isSurfacePointOnScreen([0,1,0])&&(h[3]=90,h[0]=-180,h[2]=180),this.isSurfacePointOnScreen([0,-1,0])&&(h[1]=-90,h[0]=-180,h[2]=180),new $(h)}getConstrained(t,r){const i=e.ah(t.lat,-e.ai,e.ai),n=e.ah(+r,this.minZoom+ar(0,i),this.maxZoom);return{center:new e.S(t.lng,i),zoom:n}}calculateCenterFromCameraLngLatAlt(t,e,r,i){return this._helper.calculateCenterFromCameraLngLatAlt(t,e,r,i)}setLocationAtPoint(t,r){const i=rr(this.unprojectScreenPoint(r)),n=rr(t),o=e.bp();e.bB(o);const a=e.bp();e.by(a,i,o,-this.center.lng*Math.PI/180),e.bx(a,a,o,this.center.lat*Math.PI/180);const s=n[0]*n[0]+n[2]*n[2],l=a[0]*a[0];if(s<l)return;const c=Math.sqrt(s-l),h=-c,u=e.bC(n[0],n[2],a[0],c),p=e.bC(n[0],n[2],a[0],h),d=e.bp();e.by(d,n,o,-u);const f=e.bC(d[1],d[2],a[1],a[2]),m=e.bp();e.by(m,n,o,-p);const g=e.bC(m[1],m[2],a[1],a[2]),_=.5*Math.PI,y=f>=-_&&f<=_,b=g>=-_&&g<=_;let v,x;if(y&&b){const t=this.center.lng*Math.PI/180,r=this.center.lat*Math.PI/180;e.bD(u,t)+e.bD(f,r)<e.bD(p,t)+e.bD(g,r)?(v=u,x=f):(v=p,x=g)}else if(y)v=u,x=f;else{if(!b)return;v=p,x=g}const w=v/Math.PI*180,T=x/Math.PI*180,S=this.center.lat;this.setCenter(new e.S(w,e.ah(T,-90,90))),this.setZoom(this.zoom+ar(S,this.center.lat))}locationToScreenPoint(t,r){const i=rr(t);if(r){const n=r.getElevationForLngLatZoom(t,this._helper._tileZoom);e.aR(i,i,1+n/e.bu)}return this._projectSurfacePointToScreen(i)}_projectSurfacePointToScreen(t){const r=e.bv();return e.aw(r,[...t,1],this._globeViewProjMatrixNoCorrection),r[0]/=r[3],r[1]/=r[3],new e.P((.5*r[0]+.5)*this.width,(.5*-r[1]+.5)*this.height)}screenPointToMercatorCoordinate(t,r){if(r){const e=r.pointCoordinate(t);if(e)return e}return e.a1.fromLngLat(this.unprojectScreenPoint(t))}screenPointToLocation(t,e){var r;return null===(r=this.screenPointToMercatorCoordinate(t,e))||void 0===r?void 0:r.toLngLat()}isPointOnMapSurface(t,e){const r=this._cameraPosition,i=this.getRayDirectionFromPixel(t);return!!this.rayPlanetIntersection(r,i)}getRayDirectionFromPixel(t){const r=e.bv();r[0]=t.x/this.width*2-1,r[1]=-1*(t.y/this.height*2-1),r[2]=1,r[3]=1,e.aw(r,r,this._globeViewProjMatrixNoCorrectionInverted),r[0]/=r[3],r[1]/=r[3],r[2]/=r[3];const i=e.bp();i[0]=r[0]-this._cameraPosition[0],i[1]=r[1]-this._cameraPosition[1],i[2]=r[2]-this._cameraPosition[2];const n=e.bp();return e.aV(n,i),n}isSurfacePointVisible(t){const e=this._cachedClippingPlane;return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]>=0}isSurfacePointOnScreen(t){if(!this.isSurfacePointVisible(t))return!1;const r=e.bv();return e.aw(r,[...t,1],this._globeViewProjMatrixNoCorrection),r[0]/=r[3],r[1]/=r[3],r[2]/=r[3],r[0]>-1&&r[0]<1&&r[1]>-1&&r[1]<1&&r[2]>-1&&r[2]<1}rayPlanetIntersection(t,r){const i=e.aX(t,r),n=e.bp(),o=e.bp();e.aR(o,r,i),e.aU(n,t,o);const a=1-e.aX(n,n);if(a<0)return null;const s=e.aX(t,t)-1,l=-i+(i<0?1:-1)*Math.sqrt(a),c=s/l,h=l;return{tMin:Math.min(c,h),tMax:Math.max(c,h)}}unprojectScreenPoint(t){const r=this._cameraPosition,i=this.getRayDirectionFromPixel(t),n=this.rayPlanetIntersection(r,i);if(n){const t=e.bp();e.aS(t,r,[i[0]*n.tMin,i[1]*n.tMin,i[2]*n.tMin]);const o=e.bp();return e.aV(o,t),nr(o)}const o=this._cachedClippingPlane,a=o[0]*i[0]+o[1]*i[1]+o[2]*i[2],s=-e.b1(o,r)/a,l=e.bp();if(s>0)e.aS(l,r,[i[0]*s,i[1]*s,i[2]*s]);else{const t=e.bp();e.aS(t,r,[2*i[0],2*i[1],2*i[2]]);const n=e.b1(this._cachedClippingPlane,t);e.aU(l,t,[this._cachedClippingPlane[0]*n,this._cachedClippingPlane[1]*n,this._cachedClippingPlane[2]*n])}const c=function(t){const r=e.bp();return r[0]=t[0]*-t[3],r[1]=t[1]*-t[3],r[2]=t[2]*-t[3],{center:r,radius:Math.sqrt(1-t[3]*t[3])}}(o);return nr(function(t,r,i){const n=e.bp();e.aU(n,i,t);const o=e.bp();return e.bq(o,t,n,r/e.a$(n)),o}(c.center,c.radius,l))}getMatrixForModel(t,r){const i=e.S.convert(t),n=1/e.bu,o=e.b9();return e.bz(o,o,i.lng/180*Math.PI),e.b7(o,o,-i.lat/180*Math.PI),e.M(o,o,[0,0,1+r/e.bu]),e.b7(o,o,.5*Math.PI),e.N(o,o,[n,n,n]),o}getProjectionDataForCustomLayer(t=!0){const r=this.getProjectionData({overscaledTileID:new e.Z(0,0,0,0,0),applyGlobeMatrix:t});return r.tileMercatorCoords=[0,0,1,1],r}getFastPathSimpleProjectionMatrix(t){}}class _r{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(t){this._helper.setMinZoom(t)}setMaxZoom(t){this._helper.setMaxZoom(t)}setMinPitch(t){this._helper.setMinPitch(t)}setMaxPitch(t){this._helper.setMaxPitch(t)}setRenderWorldCopies(t){this._helper.setRenderWorldCopies(t)}setBearing(t){this._helper.setBearing(t)}setPitch(t){this._helper.setPitch(t)}setRoll(t){this._helper.setRoll(t)}setFov(t){this._helper.setFov(t)}setZoom(t){this._helper.setZoom(t)}setCenter(t){this._helper.setCenter(t)}setElevation(t){this._helper.setElevation(t)}setMinElevationForCurrentTile(t){this._helper.setMinElevationForCurrentTile(t)}setPadding(t){this._helper.setPadding(t)}interpolatePadding(t,e,r){return this._helper.interpolatePadding(t,e,r)}isPaddingEqual(t){return this._helper.isPaddingEqual(t)}resize(t,e,r=!0){this._helper.resize(t,e,r)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(t){this._helper.setMaxBounds(t)}overrideNearFarZ(t,e){this._helper.overrideNearFarZ(t,e)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(t){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),t)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}get isGlobeRendering(){return this._globeness>0}setTransitionState(t,e){this._globeness=t,this._globeLatitudeErrorCorrectionRadians=e,this._calcMatrices(),this._verticalPerspectiveTransform.getCoveringTilesDetailsProvider().prepareNextFrame(),this._mercatorTransform.getCoveringTilesDetailsProvider().prepareNextFrame()}get currentTransform(){return this.isGlobeRendering?this._verticalPerspectiveTransform:this._mercatorTransform}constructor(){this._globeLatitudeErrorCorrectionRadians=0,this._globeness=1,this._helper=new Ee({calcMatrices:()=>{this._calcMatrices()},getConstrained:(t,e)=>this.getConstrained(t,e)}),this._globeness=1,this._mercatorTransform=new De,this._verticalPerspectiveTransform=new gr}clone(){const t=new _r;return t._globeness=this._globeness,t._globeLatitudeErrorCorrectionRadians=this._globeLatitudeErrorCorrectionRadians,t.apply(this),t}apply(t){this._helper.apply(t),this._mercatorTransform.apply(this),this._verticalPerspectiveTransform.apply(this,this._globeLatitudeErrorCorrectionRadians)}get projectionMatrix(){return this.currentTransform.projectionMatrix}get modelViewProjectionMatrix(){return this.currentTransform.modelViewProjectionMatrix}get inverseProjectionMatrix(){return this.currentTransform.inverseProjectionMatrix}get cameraPosition(){return this.currentTransform.cameraPosition}getProjectionData(t){const e=this._mercatorTransform.getProjectionData(t),r=this._verticalPerspectiveTransform.getProjectionData(t);return{mainMatrix:this.isGlobeRendering?r.mainMatrix:e.mainMatrix,clippingPlane:r.clippingPlane,tileMercatorCoords:r.tileMercatorCoords,projectionTransition:t.applyGlobeMatrix?this._globeness:0,fallbackMatrix:e.fallbackMatrix}}isLocationOccluded(t){return this.currentTransform.isLocationOccluded(t)}transformLightDirection(t){return this.currentTransform.transformLightDirection(t)}getPixelScale(){return e.bk(this._mercatorTransform.getPixelScale(),this._verticalPerspectiveTransform.getPixelScale(),this._globeness)}getCircleRadiusCorrection(){return e.bk(this._mercatorTransform.getCircleRadiusCorrection(),this._verticalPerspectiveTransform.getCircleRadiusCorrection(),this._globeness)}getPitchedTextCorrection(t,r,i){const n=this._mercatorTransform.getPitchedTextCorrection(t,r,i),o=this._verticalPerspectiveTransform.getPitchedTextCorrection(t,r,i);return e.bk(n,o,this._globeness)}projectTileCoordinates(t,e,r,i){return this.currentTransform.projectTileCoordinates(t,e,r,i)}_calcMatrices(){this._helper._width&&this._helper._height&&(this._verticalPerspectiveTransform.apply(this,this._globeLatitudeErrorCorrectionRadians),this._helper._nearZ=this._verticalPerspectiveTransform.nearZ,this._helper._farZ=this._verticalPerspectiveTransform.farZ,this._mercatorTransform.apply(this,!0,this.isGlobeRendering),this._helper._nearZ=this._mercatorTransform.nearZ,this._helper._farZ=this._mercatorTransform.farZ)}calculateFogMatrix(t){return this.currentTransform.calculateFogMatrix(t)}getVisibleUnwrappedCoordinates(t){return this.currentTransform.getVisibleUnwrappedCoordinates(t)}getCameraFrustum(){return this.currentTransform.getCameraFrustum()}getClippingPlane(){return this.currentTransform.getClippingPlane()}getCoveringTilesDetailsProvider(){return this.currentTransform.getCoveringTilesDetailsProvider()}recalculateZoomAndCenter(t){this._mercatorTransform.recalculateZoomAndCenter(t),this._verticalPerspectiveTransform.recalculateZoomAndCenter(t)}maxPitchScaleFactor(){return this._mercatorTransform.maxPitchScaleFactor()}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){return this._helper.getCameraLngLat()}lngLatToCameraDepth(t,e){return this.currentTransform.lngLatToCameraDepth(t,e)}populateCache(t){this._mercatorTransform.populateCache(t),this._verticalPerspectiveTransform.populateCache(t)}getBounds(){return this.currentTransform.getBounds()}getConstrained(t,e){return this.currentTransform.getConstrained(t,e)}calculateCenterFromCameraLngLatAlt(t,e,r,i){return this._helper.calculateCenterFromCameraLngLatAlt(t,e,r,i)}setLocationAtPoint(t,e){if(!this.isGlobeRendering)return this._mercatorTransform.setLocationAtPoint(t,e),void this.apply(this._mercatorTransform);this._verticalPerspectiveTransform.setLocationAtPoint(t,e),this.apply(this._verticalPerspectiveTransform)}locationToScreenPoint(t,e){return this.currentTransform.locationToScreenPoint(t,e)}screenPointToMercatorCoordinate(t,e){return this.currentTransform.screenPointToMercatorCoordinate(t,e)}screenPointToLocation(t,e){return this.currentTransform.screenPointToLocation(t,e)}isPointOnMapSurface(t,e){return this.currentTransform.isPointOnMapSurface(t,e)}getRayDirectionFromPixel(t){return this._verticalPerspectiveTransform.getRayDirectionFromPixel(t)}getMatrixForModel(t,e){return this.currentTransform.getMatrixForModel(t,e)}getProjectionDataForCustomLayer(t=!0){const e=this._mercatorTransform.getProjectionDataForCustomLayer(t);if(!this.isGlobeRendering)return e;const r=this._verticalPerspectiveTransform.getProjectionDataForCustomLayer(t);return r.fallbackMatrix=e.mainMatrix,r}getFastPathSimpleProjectionMatrix(t){return this.currentTransform.getFastPathSimpleProjectionMatrix(t)}}class yr{get useGlobeControls(){return!0}handlePanInertia(t,r){const i=sr(t,r);return Math.abs(i.lng-r.center.lng)>180&&(i.lng=r.center.lng+179.5*Math.sign(i.lng-r.center.lng)),{easingCenter:i,easingOffset:new e.P(0,0)}}handleMapControlsRollPitchBearingZoom(t,r){const i=t.around,n=r.screenPointToLocation(i);t.bearingDelta&&r.setBearing(r.bearing+t.bearingDelta),t.pitchDelta&&r.setPitch(r.pitch+t.pitchDelta),t.rollDelta&&r.setRoll(r.roll+t.rollDelta);const o=r.zoom;t.zoomDelta&&r.setZoom(r.zoom+t.zoomDelta);const a=r.zoom-o;if(0===a)return;const s=e.bA(r.center.lng,n.lng),l=s/(Math.abs(s/180)+1),c=e.bA(r.center.lat,n.lat),h=r.getRayDirectionFromPixel(i),u=r.cameraPosition,p=-1*e.aX(u,h),d=e.bp();e.aS(d,u,[h[0]*p,h[1]*p,h[2]*p]);const f=e.aZ(d)-1,m=Math.exp(.5*-Math.max(f-.3,0)),g=ir(r.worldSize,r.center.lat)/Math.min(r.width,r.height),_=e.bn(g,.9,.5,1,.25),y=(1-e.af(-a))*Math.min(m,_),b=r.center.lat,v=r.zoom,x=new e.S(r.center.lng+l*y,e.ah(r.center.lat+c*y,-e.ai,e.ai));r.setLocationAtPoint(n,i);const w=r.center,T=e.bn(Math.abs(s),45,85,0,1),S=e.bn(g,.75,.35,0,1),P=Math.pow(Math.max(T,S),.25),C=e.bA(w.lng,x.lng),M=e.bA(w.lat,x.lat);r.setCenter(new e.S(w.lng+C*P,w.lat+M*P).wrap()),r.setZoom(v+ar(b,r.center.lat))}handleMapControlsPan(t,e,r){if(!t.panDelta)return;const i=e.center.lat,n=e.zoom;e.setCenter(sr(t.panDelta,e).wrap()),e.setZoom(n+ar(i,e.center.lat))}cameraForBoxAndBearing(t,r,i,n,o){const a=Be(t,r,i,n,o),s=r.left/o.width*2-1,l=(o.width-r.right)/o.width*2-1,c=r.top/o.height*-2+1,h=(o.height-r.bottom)/o.height*-2+1,u=e.bA(i.getWest(),i.getEast())<0,p=u?i.getEast():i.getWest(),d=u?i.getWest():i.getEast(),f=Math.max(i.getNorth(),i.getSouth()),m=Math.min(i.getNorth(),i.getSouth()),g=p+.5*e.bA(p,d),_=f+.5*e.bA(f,m),y=o.clone();y.setCenter(a.center),y.setBearing(a.bearing),y.setPitch(0),y.setRoll(0),y.setZoom(a.zoom);const b=y.modelViewProjectionMatrix,v=[rr(i.getNorthWest()),rr(i.getNorthEast()),rr(i.getSouthWest()),rr(i.getSouthEast()),rr(new e.S(d,_)),rr(new e.S(p,_)),rr(new e.S(g,f)),rr(new e.S(g,m))],x=rr(a.center);let w=Number.POSITIVE_INFINITY;for(const t of v)s<0&&(w=yr.getLesserNonNegativeNonNull(w,yr.solveVectorScale(t,x,b,"x",s))),l>0&&(w=yr.getLesserNonNegativeNonNull(w,yr.solveVectorScale(t,x,b,"x",l))),c>0&&(w=yr.getLesserNonNegativeNonNull(w,yr.solveVectorScale(t,x,b,"y",c))),h<0&&(w=yr.getLesserNonNegativeNonNull(w,yr.solveVectorScale(t,x,b,"y",h)));if(Number.isFinite(w)&&0!==w)return a.zoom=y.zoom+e.ak(w),a;Le()}handleJumpToCenterZoom(t,r){const i=t.center.lat,n=t.getConstrained(r.center?e.S.convert(r.center):t.center,t.zoom).center;t.setCenter(n.wrap());const o=void 0!==r.zoom?+r.zoom:t.zoom+ar(i,n.lat);t.zoom!==o&&t.setZoom(o)}handleEaseTo(t,r){const i=t.zoom,n=t.center,o=t.padding,a={roll:t.roll,pitch:t.pitch,bearing:t.bearing},s={roll:void 0===r.roll?t.roll:r.roll,pitch:void 0===r.pitch?t.pitch:r.pitch,bearing:void 0===r.bearing?t.bearing:r.bearing},l=void 0!==r.zoom,c=!t.isPaddingEqual(r.padding);let h=!1;const u=r.center?e.S.convert(r.center):n,p=t.getConstrained(u,i).center;Ae(t,p);const d=t.clone();d.setCenter(p),d.setZoom(l?+r.zoom:i+ar(n.lat,u.lat)),d.setBearing(r.bearing);const f=new e.P(e.ah(t.centerPoint.x+r.offsetAsPoint.x,0,t.width),e.ah(t.centerPoint.y+r.offsetAsPoint.y,0,t.height));d.setLocationAtPoint(p,f);const m=(r.offset&&r.offsetAsPoint.mag())>0?d.center:p,g=l?+r.zoom:i+ar(n.lat,m.lat),_=i+ar(n.lat,0),y=g+ar(m.lat,0),b=e.bA(n.lng,m.lng),v=e.bA(n.lat,m.lat),x=e.af(y-_);return h=g!==i,{easeFunc:i=>{if(e.be(a,s)||Fe({startEulerAngles:a,endEulerAngles:s,tr:t,k:i,useSlerp:a.roll!=s.roll}),c&&t.interpolatePadding(o,r.padding,i),r.around)e.w("Easing around a point is not supported under globe projection."),t.setLocationAtPoint(r.around,r.aroundPoint);else{const e=y>_?Math.min(2,x):Math.max(.5,x),r=Math.pow(e,1-i),o=cr(n,b,v,i*r);t.setCenter(o.wrap())}if(h){const r=e.C.number(_,y,i)+ar(0,t.center.lat);t.setZoom(r)}},isZooming:h,elevationCenter:m}}handleFlyTo(t,r){const i=void 0!==r.zoom,n=t.center,o=t.zoom,a=t.padding,s=!t.isPaddingEqual(r.padding),l=t.getConstrained(e.S.convert(r.center||r.locationAtOffset),o).center,c=i?+r.zoom:t.zoom+ar(t.center.lat,l.lat),h=t.clone();h.setCenter(l),h.setZoom(c),h.setBearing(r.bearing);const u=new e.P(e.ah(t.centerPoint.x+r.offsetAsPoint.x,0,t.width),e.ah(t.centerPoint.y+r.offsetAsPoint.y,0,t.height));h.setLocationAtPoint(l,u);const p=h.center;Ae(t,p);const d=function(t,r,i){const n=rr(r),o=rr(i),a=e.aX(n,o),s=Math.acos(a),l=tr(t);return s/(2*Math.PI)*l}(t,n,p),f=o+ar(n.lat,0),m=c+ar(p.lat,0),g=e.af(m-f);let _;if("number"==typeof r.minZoom){const i=+r.minZoom+ar(p.lat,0),n=Math.min(i,f,m)+ar(0,p.lat),o=t.getConstrained(p,n).zoom+ar(p.lat,0);_=e.af(o-f)}const y=e.bA(n.lng,p.lng),b=e.bA(n.lat,p.lat);return{easeFunc:(i,o,l,h)=>{const u=cr(n,y,b,l);s&&t.interpolatePadding(a,r.padding,i);const d=1===i?p:u;t.setCenter(d.wrap());const m=f+e.ak(o);t.setZoom(1===i?c:m+ar(0,d.lat))},scaleOfZoom:g,targetCenter:p,scaleOfMinZoom:_,pixelPathLength:d}}static solveVectorScale(t,e,r,i,n){const o="x"===i?[r[0],r[4],r[8],r[12]]:[r[1],r[5],r[9],r[13]],a=[r[3],r[7],r[11],r[15]],s=t[0]*o[0]+t[1]*o[1]+t[2]*o[2],l=t[0]*a[0]+t[1]*a[1]+t[2]*a[2],c=e[0]*o[0]+e[1]*o[1]+e[2]*o[2],h=e[0]*a[0]+e[1]*a[1]+e[2]*a[2];return c+n*l===s+n*h||a[3]*(s-c)+o[3]*(h-l)+s*h==c*l?null:(c+o[3]-n*h-n*a[3])/(c-s-n*h+n*l)}static getLesserNonNegativeNonNull(t,e){return null!==e&&e>=0&&e<t?e:t}}class br{constructor(t){this._globe=t,this._mercatorCameraHelper=new Oe,this._verticalPerspectiveCameraHelper=new yr}get useGlobeControls(){return this._globe.useGlobeRendering}get currentHelper(){return this.useGlobeControls?this._verticalPerspectiveCameraHelper:this._mercatorCameraHelper}handlePanInertia(t,e){return this.currentHelper.handlePanInertia(t,e)}handleMapControlsRollPitchBearingZoom(t,e){return this.currentHelper.handleMapControlsRollPitchBearingZoom(t,e)}handleMapControlsPan(t,e,r){this.currentHelper.handleMapControlsPan(t,e,r)}cameraForBoxAndBearing(t,e,r,i,n){return this.currentHelper.cameraForBoxAndBearing(t,e,r,i,n)}handleJumpToCenterZoom(t,e){this.currentHelper.handleJumpToCenterZoom(t,e)}handleEaseTo(t,e){return this.currentHelper.handleEaseTo(t,e)}handleFlyTo(t,e){return this.currentHelper.handleFlyTo(t,e)}}const vr=(t,r)=>e.y(t,r&&r.filter(t=>"source.canvas"!==t.identifier)),xr=e.bE();class wr extends e.E{constructor(t,r={}){var i,n;super(),this._rtlPluginLoaded=()=>{for(const t in this.sourceCaches){const e=this.sourceCaches[t].getSource().type;"vector"!==e&&"geojson"!==e||this.sourceCaches[t].reload()}},this.map=t,this.dispatcher=new F(L(),t._getMapId()),this.dispatcher.registerMessageHandler("GG",(t,e)=>this.getGlyphs(t,e)),this.dispatcher.registerMessageHandler("GI",(t,e)=>this.getImages(t,e)),this.imageManager=new b,this.imageManager.setEventedParent(this);const o=(null===(i=t._container)||void 0===i?void 0:i.lang)||"undefined"!=typeof document&&(null===(n=document.documentElement)||void 0===n?void 0:n.lang)||void 0;this.glyphManager=new T(t._requestManager,r.localIdeographFontFamily,o),this.lineAtlas=new I(256,512),this.crossTileSymbolIndex=new ye,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new e.bF,this._loaded=!1,this._availableImages=[],this._globalState={},this._resetUpdates(),this.dispatcher.broadcast("SR",e.bG()),it().on(tt,this._rtlPluginLoaded),this.on("data",t=>{if("source"!==t.dataType||"metadata"!==t.sourceDataType)return;const e=this.sourceCaches[t.sourceId];if(!e)return;const r=e.getSource();if(r&&r.vectorLayerIds)for(const t in this._layers){const e=this._layers[t];e.source===r.id&&this._validateLayer(e)}})}setGlobalStateProperty(t,r){var i,n,o;this._checkLoaded();const a=null===r?null!==(o=null===(n=null===(i=this.stylesheet.state)||void 0===i?void 0:i[t])||void 0===n?void 0:n.default)&&void 0!==o?o:null:r;if(e.bH(a,this._globalState[t]))return this;this._globalState[t]=a,this._applyGlobalStateChanges([t])}getGlobalState(){return this._globalState}setGlobalState(t){this._checkLoaded();const r=[];for(const i in t)!e.bH(this._globalState[i],t[i].default)&&(r.push(i),this._globalState[i]=t[i].default);this._applyGlobalStateChanges(r)}_applyGlobalStateChanges(t){if(0===t.length)return;const e=new Set;for(const r in this._layers){const i=this._layers[r],n=i.getLayoutAffectingGlobalStateRefs(),o=i.getPaintAffectingGlobalStateRefs();for(const r of t)if(n.has(r)&&e.add(i.source),o.has(r))for(const{name:t,value:e}of o.get(r))this._updatePaintProperty(i,t,e)}for(const t in this.sourceCaches)e.has(t)&&(this._reloadSource(t),this._changed=!0)}loadURL(t,r={},i){this.fire(new e.l("dataloading",{dataType:"style"})),r.validate="boolean"!=typeof r.validate||r.validate;const n=this.map._requestManager.transformRequest(t,"Style");this._loadStyleRequest=new AbortController;const o=this._loadStyleRequest;e.j(n,this._loadStyleRequest).then(t=>{this._loadStyleRequest=null,this._load(t.data,r,i)}).catch(t=>{this._loadStyleRequest=null,t&&!o.signal.aborted&&this.fire(new e.k(t))})}loadJSON(t,r={},i){this.fire(new e.l("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,a.frameAsync(this._frameRequest).then(()=>{this._frameRequest=null,r.validate=!1!==r.validate,this._load(t,r,i)}).catch(()=>{})}loadEmpty(){this.fire(new e.l("dataloading",{dataType:"style"})),this._load(xr,{validate:!1})}_load(t,r,i){var n,o,a;let s=r.transformStyle?r.transformStyle(i,t):t;if(!r.validate||!vr(this,e.z(s))){s=Object.assign({},s),this._loaded=!0,this.stylesheet=s;for(const t in s.sources)this.addSource(t,s.sources[t],{validate:!1});s.sprite?this._loadSprite(s.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(s.glyphs),this._createLayers(),this.light=new C(this.stylesheet.light),this._setProjectionInternal((null===(n=this.stylesheet.projection)||void 0===n?void 0:n.type)||"mercator"),this.sky=new A(this.stylesheet.sky),this.map.setTerrain(null!==(o=this.stylesheet.terrain)&&void 0!==o?o:null),this.setGlobalState(null!==(a=this.stylesheet.state)&&void 0!==a?a:null),this.fire(new e.l("data",{dataType:"style"})),this.fire(new e.l("style.load"))}}_createLayers(){const t=e.bI(this.stylesheet.layers);this.dispatcher.broadcast("SL",t),this._order=t.map(t=>t.id),this._layers={},this._serializedLayers=null;for(const r of t){const t=e.bJ(r);t.setEventedParent(this,{layer:{id:r.id}}),this._layers[r.id]=t}}_loadSprite(t,r=!1,i=void 0){let n;this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController,function(t,r,i,n){return e._(this,void 0,void 0,function*(){const o=g(t),s=i>1?"@2x":"",l={},c={};for(const{id:t,url:i}of o){const o=r.transformRequest(_(i,s,".json"),"SpriteJSON");l[t]=e.j(o,n);const a=r.transformRequest(_(i,s,".png"),"SpriteImage");c[t]=f.getImage(a,n)}return yield Promise.all([...Object.values(l),...Object.values(c)]),function(t,r){return e._(this,void 0,void 0,function*(){const e={};for(const i in t){e[i]={};const n=a.getImageCanvasContext((yield r[i]).data),o=(yield t[i]).data;for(const t in o){const{width:r,height:a,x:s,y:l,sdf:c,pixelRatio:h,stretchX:u,stretchY:p,content:d,textFitWidth:f,textFitHeight:m}=o[t];e[i][t]={data:null,pixelRatio:h,sdf:c,stretchX:u,stretchY:p,content:d,textFitWidth:f,textFitHeight:m,spriteData:{width:r,height:a,x:s,y:l,context:n}}}}return e})}(l,c)})}(t,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then(t=>{if(this._spriteRequest=null,t)for(const e in t){this._spritesImagesIds[e]=[];const i=this._spritesImagesIds[e]?this._spritesImagesIds[e].filter(e=>!(e in t)):[];for(const t of i)this.imageManager.removeImage(t),this._changedImages[t]=!0;for(const i in t[e]){const n="default"===e?i:`${e}:${i}`;this._spritesImagesIds[e].push(n),n in this.imageManager.images?this.imageManager.updateImage(n,t[e][i],!1):this.imageManager.addImage(n,t[e][i]),r&&(this._changedImages[n]=!0)}}}).catch(t=>{this._spriteRequest=null,n=t,this.fire(new e.k(n))}).finally(()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),r&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new e.l("data",{dataType:"style"})),i&&i(n)})}_unloadSprite(){for(const t of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(t),this._changedImages[t]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new e.l("data",{dataType:"style"}))}_validateLayer(t){const r=this.sourceCaches[t.source];if(!r)return;const i=t.sourceLayer;if(!i)return;const n=r.getSource();("geojson"===n.type||n.vectorLayerIds&&-1===n.vectorLayerIds.indexOf(i))&&this.fire(new e.k(new Error(`Source layer "${i}" does not exist on source "${n.id}" as specified by style layer "${t.id}".`)))}loaded(){if(!this._loaded)return!1;if(Object.keys(this._updatedSources).length)return!1;for(const t in this.sourceCaches)if(!this.sourceCaches[t].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(t,r=!1){const i=this._serializedAllLayers();if(!t||0===t.length)return Object.values(r?e.bK(i):i);const n=[];for(const o of t)if(i[o]){const t=r?e.bK(i[o]):i[o];n.push(t)}return n}_serializedAllLayers(){let t=this._serializedLayers;if(t)return t;t=this._serializedLayers={};const e=Object.keys(this._layers);for(const r of e){const e=this._layers[r];"custom"!==e.type&&(t[r]=e.serialize())}return t}hasTransitions(){var t,e,r;if(null===(t=this.light)||void 0===t?void 0:t.hasTransition())return!0;if(null===(e=this.sky)||void 0===e?void 0:e.hasTransition())return!0;if(null===(r=this.projection)||void 0===r?void 0:r.hasTransition())return!0;for(const t in this.sourceCaches)if(this.sourceCaches[t].hasTransition())return!0;for(const t in this._layers)if(this._layers[t].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(t){if(!this._loaded)return;const r=this._changed;if(r){const e=Object.keys(this._updatedLayers),r=Object.keys(this._removedLayers);(e.length||r.length)&&this._updateWorkerLayers(e,r);for(const t in this._updatedSources){const e=this._updatedSources[t];if("reload"===e)this._reloadSource(t);else{if("clear"!==e)throw new Error(`Invalid action ${e}`);this._clearSource(t)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const e in this._updatedPaintProps)this._layers[e].updateTransitions(t);this.light.updateTransitions(t),this.sky.updateTransitions(t),this._resetUpdates()}const i={};for(const t in this.sourceCaches){const e=this.sourceCaches[t];i[t]=e.used,e.used=!1}for(const e of this._order){const r=this._layers[e];r.recalculate(t,this._availableImages),!r.isHidden(t.zoom)&&r.source&&(this.sourceCaches[r.source].used=!0)}for(const t in i){const r=this.sourceCaches[t];!!i[t]!=!!r.used&&r.fire(new e.l("data",{sourceDataType:"visibility",dataType:"source",sourceId:t}))}this.light.recalculate(t),this.sky.recalculate(t),this.projection.recalculate(t),this.z=t.zoom,r&&this.fire(new e.l("data",{dataType:"style"}))}_updateTilesForChangedImages(){const t=Object.keys(this._changedImages);if(t.length){for(const e in this.sourceCaches)this.sourceCaches[e].reloadTilesForDependencies(["icons","patterns"],t);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const t in this.sourceCaches)this.sourceCaches[t].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(t,e){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(t,!1),removedIds:e})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(t,r={}){var i;this._checkLoaded();const n=this.serialize();if(t=r.transformStyle?r.transformStyle(n,t):t,(null===(i=r.validate)||void 0===i||i)&&vr(this,e.z(t)))return!1;(t=e.bK(t)).layers=e.bI(t.layers);const o=e.bL(n,t),a=this._getOperationsToPerform(o);if(a.unimplemented.length>0)throw new Error(`Unimplemented: ${a.unimplemented.join(", ")}.`);if(0===a.operations.length)return!1;for(const t of a.operations)t();return this.stylesheet=t,this._serializedLayers=null,!0}_getOperationsToPerform(t){const e=[],r=[];for(const i of t)switch(i.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":case"setRoll":continue;case"addLayer":e.push(()=>this.addLayer.apply(this,i.args));break;case"removeLayer":e.push(()=>this.removeLayer.apply(this,i.args));break;case"setPaintProperty":e.push(()=>this.setPaintProperty.apply(this,i.args));break;case"setLayoutProperty":e.push(()=>this.setLayoutProperty.apply(this,i.args));break;case"setFilter":e.push(()=>this.setFilter.apply(this,i.args));break;case"addSource":e.push(()=>this.addSource.apply(this,i.args));break;case"removeSource":e.push(()=>this.removeSource.apply(this,i.args));break;case"setLayerZoomRange":e.push(()=>this.setLayerZoomRange.apply(this,i.args));break;case"setLight":e.push(()=>this.setLight.apply(this,i.args));break;case"setGeoJSONSourceData":e.push(()=>this.setGeoJSONSourceData.apply(this,i.args));break;case"setGlyphs":e.push(()=>this.setGlyphs.apply(this,i.args));break;case"setSprite":e.push(()=>this.setSprite.apply(this,i.args));break;case"setTerrain":e.push(()=>this.map.setTerrain.apply(this,i.args));break;case"setSky":e.push(()=>this.setSky.apply(this,i.args));break;case"setProjection":this.setProjection.apply(this,i.args);break;case"setGlobalState":e.push(()=>this.setGlobalState.apply(this,i.args));break;case"setTransition":e.push(()=>{});break;default:r.push(i.command)}return{operations:e,unimplemented:r}}addImage(t,r){if(this.getImage(t))return this.fire(new e.k(new Error(`An image named "${t}" already exists.`)));this.imageManager.addImage(t,r),this._afterImageUpdated(t)}updateImage(t,e){this.imageManager.updateImage(t,e)}getImage(t){return this.imageManager.getImage(t)}removeImage(t){if(!this.getImage(t))return this.fire(new e.k(new Error(`An image named "${t}" does not exist.`)));this.imageManager.removeImage(t),this._afterImageUpdated(t)}_afterImageUpdated(t){this._availableImages=this.imageManager.listImages(),this._changedImages[t]=!0,this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new e.l("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(t,r,i={}){if(this._checkLoaded(),void 0!==this.sourceCaches[t])throw new Error(`Source "${t}" already exists.`);if(!r.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(r).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(r.type)>=0&&this._validate(e.z.source,`sources.${t}`,r,null,i))return;this.map&&this.map._collectResourceTiming&&(r.collectResourceTiming=!0);const n=this.sourceCaches[t]=new vt(t,r,this.dispatcher);n.style=this,n.setEventedParent(this,()=>({isSourceLoaded:n.loaded(),source:n.serialize(),sourceId:t})),n.onAdd(this.map),this._changed=!0}removeSource(t){if(this._checkLoaded(),void 0===this.sourceCaches[t])throw new Error("There is no source with this ID");for(const r in this._layers)if(this._layers[r].source===t)return this.fire(new e.k(new Error(`Source "${t}" cannot be removed while layer "${r}" is using it.`)));const r=this.sourceCaches[t];delete this.sourceCaches[t],delete this._updatedSources[t],r.fire(new e.l("data",{sourceDataType:"metadata",dataType:"source",sourceId:t})),r.setEventedParent(null),r.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(t,e){if(this._checkLoaded(),void 0===this.sourceCaches[t])throw new Error(`There is no source with this ID=${t}`);const r=this.sourceCaches[t].getSource();if("geojson"!==r.type)throw new Error(`geojsonSource.type is ${r.type}, which is !== 'geojson`);r.setData(e),this._changed=!0}getSource(t){return this.sourceCaches[t]&&this.sourceCaches[t].getSource()}addLayer(t,r,i={}){this._checkLoaded();const n=t.id;if(this.getLayer(n))return void this.fire(new e.k(new Error(`Layer "${n}" already exists on this map.`)));let o;if("custom"===t.type){if(vr(this,e.bM(t)))return;o=e.bJ(t)}else{if("source"in t&&"object"==typeof t.source&&(this.addSource(n,t.source),t=e.bK(t),t=e.e(t,{source:n})),this._validate(e.z.layer,`layers.${n}`,t,{arrayIndex:-1},i))return;o=e.bJ(t),this._validateLayer(o),o.setEventedParent(this,{layer:{id:n}})}const a=r?this._order.indexOf(r):this._order.length;if(r&&-1===a)this.fire(new e.k(new Error(`Cannot add layer "${n}" before non-existing layer "${r}".`)));else{if(this._order.splice(a,0,n),this._layerOrderChanged=!0,this._layers[n]=o,this._removedLayers[n]&&o.source&&"custom"!==o.type){const t=this._removedLayers[n];delete this._removedLayers[n],t.type!==o.type?this._updatedSources[o.source]="clear":(this._updatedSources[o.source]="reload",this.sourceCaches[o.source].pause())}this._updateLayer(o),o.onAdd&&o.onAdd(this.map)}}moveLayer(t,r){if(this._checkLoaded(),this._changed=!0,!this._layers[t])return void this.fire(new e.k(new Error(`The layer '${t}' does not exist in the map's style and cannot be moved.`)));if(t===r)return;const i=this._order.indexOf(t);this._order.splice(i,1);const n=r?this._order.indexOf(r):this._order.length;r&&-1===n?this.fire(new e.k(new Error(`Cannot move layer "${t}" before non-existing layer "${r}".`))):(this._order.splice(n,0,t),this._layerOrderChanged=!0)}removeLayer(t){this._checkLoaded();const r=this._layers[t];if(!r)return void this.fire(new e.k(new Error(`Cannot remove non-existing layer "${t}".`)));r.setEventedParent(null);const i=this._order.indexOf(t);this._order.splice(i,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[t]=r,delete this._layers[t],this._serializedLayers&&delete this._serializedLayers[t],delete this._updatedLayers[t],delete this._updatedPaintProps[t],r.onRemove&&r.onRemove(this.map)}getLayer(t){return this._layers[t]}getLayersOrder(){return[...this._order]}hasLayer(t){return t in this._layers}setLayerZoomRange(t,r,i){this._checkLoaded();const n=this.getLayer(t);n?n.minzoom===r&&n.maxzoom===i||(null!=r&&(n.minzoom=r),null!=i&&(n.maxzoom=i),this._updateLayer(n)):this.fire(new e.k(new Error(`Cannot set the zoom range of non-existing layer "${t}".`)))}setFilter(t,r,i={}){this._checkLoaded();const n=this.getLayer(t);if(n){if(!e.bH(n.filter,r))return null==r?(n.setFilter(void 0),void this._updateLayer(n)):void(this._validate(e.z.filter,`layers.${n.id}.filter`,r,null,i)||(n.setFilter(e.bK(r)),this._updateLayer(n)))}else this.fire(new e.k(new Error(`Cannot filter non-existing layer "${t}".`)))}getFilter(t){return e.bK(this.getLayer(t).filter)}setLayoutProperty(t,r,i,n={}){this._checkLoaded();const o=this.getLayer(t);o?e.bH(o.getLayoutProperty(r),i)||(o.setLayoutProperty(r,i,n),this._updateLayer(o)):this.fire(new e.k(new Error(`Cannot style non-existing layer "${t}".`)))}getLayoutProperty(t,r){const i=this.getLayer(t);if(i)return i.getLayoutProperty(r);this.fire(new e.k(new Error(`Cannot get style of non-existing layer "${t}".`)))}setPaintProperty(t,r,i,n={}){this._checkLoaded();const o=this.getLayer(t);o?e.bH(o.getPaintProperty(r),i)||this._updatePaintProperty(o,r,i,n):this.fire(new e.k(new Error(`Cannot style non-existing layer "${t}".`)))}_updatePaintProperty(t,e,r,i={}){t.setPaintProperty(e,r,i)&&this._updateLayer(t),this._changed=!0,this._updatedPaintProps[t.id]=!0,this._serializedLayers=null}getPaintProperty(t,e){return this.getLayer(t).getPaintProperty(e)}setFeatureState(t,r){this._checkLoaded();const i=t.source,n=t.sourceLayer,o=this.sourceCaches[i];if(void 0===o)return void this.fire(new e.k(new Error(`The source '${i}' does not exist in the map's style.`)));const a=o.getSource().type;"geojson"===a&&n?this.fire(new e.k(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):"vector"!==a||n?(void 0===t.id&&this.fire(new e.k(new Error("The feature id parameter must be provided."))),o.setFeatureState(n,t.id,r)):this.fire(new e.k(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(t,r){this._checkLoaded();const i=t.source,n=this.sourceCaches[i];if(void 0===n)return void this.fire(new e.k(new Error(`The source '${i}' does not exist in the map's style.`)));const o=n.getSource().type,a="vector"===o?t.sourceLayer:void 0;"vector"!==o||a?r&&"string"!=typeof t.id&&"number"!=typeof t.id?this.fire(new e.k(new Error("A feature id is required to remove its specific state property."))):n.removeFeatureState(a,t.id,r):this.fire(new e.k(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(t){this._checkLoaded();const r=t.source,i=t.sourceLayer,n=this.sourceCaches[r];if(void 0!==n)return"vector"!==n.getSource().type||i?(void 0===t.id&&this.fire(new e.k(new Error("The feature id parameter must be provided."))),n.getFeatureState(i,t.id)):void this.fire(new e.k(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new e.k(new Error(`The source '${r}' does not exist in the map's style.`)))}getTransition(){return e.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;const t=e.bN(this.sourceCaches,t=>t.serialize()),r=this._serializeByIds(this._order,!0),i=this.map.getTerrain()||void 0,n=this.stylesheet;return e.bO({version:n.version,name:n.name,metadata:n.metadata,light:n.light,sky:n.sky,center:n.center,zoom:n.zoom,bearing:n.bearing,pitch:n.pitch,sprite:n.sprite,glyphs:n.glyphs,transition:n.transition,projection:n.projection,sources:t,layers:r,terrain:i},t=>void 0!==t)}_updateLayer(t){this._updatedLayers[t.id]=!0,t.source&&!this._updatedSources[t.source]&&"raster"!==this.sourceCaches[t.source].getSource().type&&(this._updatedSources[t.source]="reload",this.sourceCaches[t.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(t){const e=t=>"fill-extrusion"===this._layers[t].type,r={},i=[];for(let n=this._order.length-1;n>=0;n--){const o=this._order[n];if(e(o)){r[o]=n;for(const e of t){const t=e[o];if(t)for(const e of t)i.push(e)}}}i.sort((t,e)=>e.intersectionZ-t.intersectionZ);const n=[];for(let o=this._order.length-1;o>=0;o--){const a=this._order[o];if(e(a))for(let t=i.length-1;t>=0;t--){const e=i[t].feature;if(r[e.layer.id]<o)break;n.push(e),i.pop()}else for(const e of t){const t=e[a];if(t)for(const e of t)n.push(e.feature)}}return n}queryRenderedFeatures(t,r,i){r&&r.filter&&this._validate(e.z.filter,"queryRenderedFeatures.filter",r.filter,null,r);const n={};if(r&&r.layers){if(!(Array.isArray(r.layers)||r.layers instanceof Set))return this.fire(new e.k(new Error("parameters.layers must be an Array or a Set of strings"))),[];for(const t of r.layers){const r=this._layers[t];if(!r)return this.fire(new e.k(new Error(`The layer '${t}' does not exist in the map's style and cannot be queried for features.`))),[];n[r.source]=!0}}const o=[];r.availableImages=this._availableImages;const a=this._serializedAllLayers(),s=r.layers instanceof Set?r.layers:Array.isArray(r.layers)?new Set(r.layers):null,l=Object.assign(Object.assign({},r),{layers:s});for(const e in this.sourceCaches)r.layers&&!n[e]||o.push(j(this.sourceCaches[e],this._layers,a,t,l,i,this.map.terrain?(t,e,r)=>this.map.terrain.getElevation(t,e,r):void 0));return this.placement&&o.push(function(t,e,r,i,n,o,a){const s={},l=o.queryRenderedSymbols(i),c=[];for(const t of Object.keys(l).map(Number))c.push(a[t]);c.sort(U);for(const r of c){const i=r.featureIndex.lookupSymbolFeatures(l[r.bucketInstanceId],e,r.bucketIndex,r.sourceLayerIndex,n.filter,n.layers,n.availableImages,t);for(const t in i){const e=s[t]=s[t]||[],n=i[t];n.sort((t,e)=>{const i=r.featureSortOrder;if(i){const r=i.indexOf(t.featureIndex);return i.indexOf(e.featureIndex)-r}return e.featureIndex-t.featureIndex});for(const t of n)e.push(t)}}return function(t,e,r){for(const i in t)for(const n of t[i])N(n,r[e[i].source]);return t}(s,t,r)}(this._layers,a,this.sourceCaches,t,l,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(o)}querySourceFeatures(t,r){r&&r.filter&&this._validate(e.z.filter,"querySourceFeatures.filter",r.filter,null,r);const i=this.sourceCaches[t];return i?function(t,e){const r=t.getRenderableIds().map(e=>t.getTileByID(e)),i=[],n={};for(let t=0;t<r.length;t++){const o=r[t],a=o.tileID.canonical.key;n[a]||(n[a]=!0,o.querySourceFeatures(i,e))}return i}(i,r):[]}getLight(){return this.light.getLight()}setLight(t,r={}){this._checkLoaded();const i=this.light.getLight();let n=!1;for(const r in t)if(!e.bH(t[r],i[r])){n=!0;break}if(!n)return;const o={now:a.now(),transition:e.e({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(t,r),this.light.updateTransitions(o)}getProjection(){var t;return null===(t=this.stylesheet)||void 0===t?void 0:t.projection}setProjection(t){if(this._checkLoaded(),this.projection){if(this.projection.name===t.type)return;this.projection.destroy(),delete this.projection}this.stylesheet.projection=t,this._setProjectionInternal(t.type)}getSky(){var t;return null===(t=this.stylesheet)||void 0===t?void 0:t.sky}setSky(t,r={}){this._checkLoaded();const i=this.getSky();let n=!1;if(!t&&!i)return;if(t&&!i)n=!0;else if(!t&&i)n=!0;else for(const r in t)if(!e.bH(t[r],i[r])){n=!0;break}if(!n)return;const o={now:a.now(),transition:e.e({duration:300,delay:0},this.stylesheet.transition)};this.stylesheet.sky=t,this.sky.setSky(t,r),this.sky.updateTransitions(o)}_setProjectionInternal(t){const r=function(t){if(Array.isArray(t)){const e=new Qe({type:t});return{projection:e,transform:new _r,cameraHelper:new br(e)}}switch(t){case"mercator":return{projection:new Ce,transform:new De,cameraHelper:new Oe};case"globe":{const t=new Qe({type:["interpolate",["linear"],["zoom"],11,"vertical-perspective",12,"mercator"]});return{projection:t,transform:new _r,cameraHelper:new br(t)}}case"vertical-perspective":return{projection:new Ye,transform:new gr,cameraHelper:new yr};default:return e.w(`Unknown projection name: ${t}. Falling back to mercator projection.`),{projection:new Ce,transform:new De,cameraHelper:new Oe}}}(t);this.projection=r.projection,this.map.migrateProjection(r.transform,r.cameraHelper);for(const t in this.sourceCaches)this.sourceCaches[t].reload()}_validate(t,r,i,n,o={}){return(!o||!1!==o.validate)&&vr(this,t.call(e.z,e.e({key:r,style:this.serialize(),value:i,styleSpec:e.v},n)))}_remove(t=!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),it().off(tt,this._rtlPluginLoaded);for(const t in this._layers)this._layers[t].setEventedParent(null);for(const t in this.sourceCaches){const e=this.sourceCaches[t];e.setEventedParent(null),e.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),t&&this.dispatcher.broadcast("RM",void 0),this.dispatcher.remove(t)}_clearSource(t){this.sourceCaches[t].clearTiles()}_reloadSource(t){this.sourceCaches[t].resume(),this.sourceCaches[t].reload()}_updateSources(t){for(const e in this.sourceCaches)this.sourceCaches[e].update(t,this.map.terrain)}_generateCollisionBoxes(){for(const t in this.sourceCaches)this._reloadSource(t)}_updatePlacement(t,e,r,i,n=!1){let o=!1,s=!1;const l={};for(const e of this._order){const r=this._layers[e];if("symbol"!==r.type)continue;if(!l[r.source]){const t=this.sourceCaches[r.source];l[r.source]=t.getRenderableIds(!0).map(e=>t.getTileByID(e)).sort((t,e)=>e.tileID.overscaledZ-t.tileID.overscaledZ||(t.tileID.isLessThan(e.tileID)?-1:1))}const i=this.crossTileSymbolIndex.addLayer(r,l[r.source],t.center.lng);o=o||i}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((n=n||this._layerOrderChanged||0===r)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(a.now(),t.zoom))&&(this.pauseablePlacement=new de(t,this.map.terrain,this._order,n,e,r,i,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,l),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(a.now()),s=!0),o&&this.pauseablePlacement.placement.setStale()),s||o)for(const t of this._order){const e=this._layers[t];"symbol"===e.type&&this.placement.updateLayerOpacities(e,l[e.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(a.now())}_releaseSymbolFadeTiles(){for(const t in this.sourceCaches)this.sourceCaches[t].releaseSymbolFadeTiles()}getImages(t,r){return e._(this,void 0,void 0,function*(){const t=yield this.imageManager.getImages(r.icons);this._updateTilesForChangedImages();const e=this.sourceCaches[r.source];return e&&e.setDependencies(r.tileID.key,r.type,r.icons),t})}getGlyphs(t,r){return e._(this,void 0,void 0,function*(){const t=yield this.glyphManager.getGlyphs(r.stacks),e=this.sourceCaches[r.source];return e&&e.setDependencies(r.tileID.key,r.type,[""]),t})}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(t,r={}){this._checkLoaded(),t&&this._validate(e.z.glyphs,"glyphs",t,null,r)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=t,this.glyphManager.entries={},this.glyphManager.setURL(t))}addSprite(t,r,i={},n){this._checkLoaded();const o=[{id:t,url:r}],a=[...g(this.stylesheet.sprite),...o];this._validate(e.z.sprite,"sprite",a,null,i)||(this.stylesheet.sprite=a,this._loadSprite(o,!0,n))}removeSprite(t){this._checkLoaded();const r=g(this.stylesheet.sprite);if(r.find(e=>e.id===t)){if(this._spritesImagesIds[t])for(const e of this._spritesImagesIds[t])this.imageManager.removeImage(e),this._changedImages[e]=!0;r.splice(r.findIndex(e=>e.id===t),1),this.stylesheet.sprite=r.length>0?r:void 0,delete this._spritesImagesIds[t],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new e.l("data",{dataType:"style"}))}else this.fire(new e.k(new Error(`Sprite "${t}" doesn't exists on this map.`)))}getSprite(){return g(this.stylesheet.sprite)}setSprite(t,r={},i){this._checkLoaded(),t&&this._validate(e.z.sprite,"sprite",t,null,r)||(this.stylesheet.sprite=t,t?this._loadSprite(t,!0,i):(this._unloadSprite(),i&&i(null)))}}var Tr=e.aJ([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class Sr{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,o,a,s,l){this.context=t;let c=this.boundPaintVertexBuffers.length!==i.length;for(let t=0;!c&&t<i.length;t++)this.boundPaintVertexBuffers[t]!==i[t]&&(c=!0);!this.vao||this.boundProgram!==e||this.boundLayoutVertexBuffer!==r||c||this.boundIndexBuffer!==n||this.boundVertexOffset!==o||this.boundDynamicVertexBuffer!==a||this.boundDynamicVertexBuffer2!==s||this.boundDynamicVertexBuffer3!==l?this.freshBind(e,r,i,n,o,a,s,l):(t.bindVertexArray.set(this.vao),a&&a.bind(),n&&n.dynamicDraw&&n.bind(),s&&s.bind(),l&&l.bind())}freshBind(t,e,r,i,n,o,a,s){const l=t.numAttributes,c=this.context,h=c.gl;this.vao&&this.destroy(),this.vao=c.createVertexArray(),c.bindVertexArray.set(this.vao),this.boundProgram=t,this.boundLayoutVertexBuffer=e,this.boundPaintVertexBuffers=r,this.boundIndexBuffer=i,this.boundVertexOffset=n,this.boundDynamicVertexBuffer=o,this.boundDynamicVertexBuffer2=a,this.boundDynamicVertexBuffer3=s,e.enableAttributes(h,t);for(const e of r)e.enableAttributes(h,t);o&&o.enableAttributes(h,t),a&&a.enableAttributes(h,t),s&&s.enableAttributes(h,t),e.bind(),e.setVertexAttribPointers(h,t,n);for(const e of r)e.bind(),e.setVertexAttribPointers(h,t,n);o&&(o.bind(),o.setVertexAttribPointers(h,t,n)),i&&i.bind(),a&&(a.bind(),a.setVertexAttribPointers(h,t,n)),s&&(s.bind(),s.setVertexAttribPointers(h,t,n)),c.currentNumAttributes=l}destroy(){this.vao&&(this.context.deleteVertexArray(this.vao),this.vao=null)}}const Pr=(t,r,i,n,o)=>({u_texture:0,u_ele_delta:t,u_fog_matrix:r,u_fog_color:i?i.properties.get("fog-color"):e.bf.white,u_fog_ground_blend:i?i.properties.get("fog-ground-blend"):1,u_fog_ground_blend_opacity:o?0:i?i.calculateFogBlendOpacity(n):0,u_horizon_color:i?i.properties.get("horizon-color"):e.bf.white,u_horizon_fog_blend:i?i.properties.get("horizon-fog-blend"):1,u_is_globe_mode:o?1:0}),Cr={mainMatrix:"u_projection_matrix",tileMercatorCoords:"u_projection_tile_mercator_coords",clippingPlane:"u_projection_clipping_plane",projectionTransition:"u_projection_transition",fallbackMatrix:"u_projection_fallback_matrix"};function Mr(t){const e=[];for(let r=0;r<t.length;r++){if(null===t[r])continue;const i=t[r].split(" ");e.push(i.pop())}return e}class Ar{constructor(t,r,i,n,o,a,s,l,c=[]){const h=t.gl;this.program=h.createProgram();const u=Mr(r.staticAttributes),p=i?i.getBinderAttributes():[],d=u.concat(p),f=ve.prelude.staticUniforms?Mr(ve.prelude.staticUniforms):[],m=s.staticUniforms?Mr(s.staticUniforms):[],g=r.staticUniforms?Mr(r.staticUniforms):[],_=i?i.getBinderUniforms():[],y=f.concat(m).concat(g).concat(_),b=[];for(const t of y)b.indexOf(t)<0&&b.push(t);const v=i?i.defines():[];qe(h)&&v.unshift("#version 300 es"),o&&v.push("#define OVERDRAW_INSPECTOR;"),a&&v.push("#define TERRAIN3D;"),l&&v.push(l),c&&v.push(...c);let x=v.concat(ve.prelude.fragmentSource,s.fragmentSource,r.fragmentSource).join("\n"),w=v.concat(ve.prelude.vertexSource,s.vertexSource,r.vertexSource).join("\n");qe(h)||(x=function(t){return t.replace(/\bin\s/g,"varying ").replace("out highp vec4 fragColor;","").replace(/fragColor/g,"gl_FragColor").replace(/texture\(/g,"texture2D(")}(x),w=function(t){return t.replace(/\bin\s/g,"attribute ").replace(/\bout\s/g,"varying ").replace(/texture\(/g,"texture2D(")}(w));const T=h.createShader(h.FRAGMENT_SHADER);if(h.isContextLost())return void(this.failedToCreate=!0);if(h.shaderSource(T,x),h.compileShader(T),!h.getShaderParameter(T,h.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${h.getShaderInfoLog(T)}`);h.attachShader(this.program,T);const S=h.createShader(h.VERTEX_SHADER);if(h.isContextLost())return void(this.failedToCreate=!0);if(h.shaderSource(S,w),h.compileShader(S),!h.getShaderParameter(S,h.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${h.getShaderInfoLog(S)}`);h.attachShader(this.program,S),this.attributes={};const P={};this.numAttributes=d.length;for(let t=0;t<this.numAttributes;t++)d[t]&&(h.bindAttribLocation(this.program,t,d[t]),this.attributes[d[t]]=t);if(h.linkProgram(this.program),!h.getProgramParameter(this.program,h.LINK_STATUS))throw new Error(`Program failed to link: ${h.getProgramInfoLog(this.program)}`);h.deleteShader(S),h.deleteShader(T);for(let t=0;t<b.length;t++){const e=b[t];if(e&&!P[e]){const t=h.getUniformLocation(this.program,e);t&&(P[e]=t)}}this.fixedUniforms=n(t,P),this.terrainUniforms=((t,r)=>({u_depth:new e.bP(t,r.u_depth),u_terrain:new e.bP(t,r.u_terrain),u_terrain_dim:new e.bg(t,r.u_terrain_dim),u_terrain_matrix:new e.bR(t,r.u_terrain_matrix),u_terrain_unpack:new e.bS(t,r.u_terrain_unpack),u_terrain_exaggeration:new e.bg(t,r.u_terrain_exaggeration)}))(t,P),this.projectionUniforms=((t,r)=>({u_projection_matrix:new e.bR(t,r.u_projection_matrix),u_projection_tile_mercator_coords:new e.bS(t,r.u_projection_tile_mercator_coords),u_projection_clipping_plane:new e.bS(t,r.u_projection_clipping_plane),u_projection_transition:new e.bg(t,r.u_projection_transition),u_projection_fallback_matrix:new e.bR(t,r.u_projection_fallback_matrix)}))(t,P),this.binderUniforms=i?i.getUniforms(t,P):[]}draw(t,e,r,i,n,o,a,s,l,c,h,u,p,d,f,m,g,_,y){const b=t.gl;if(this.failedToCreate)return;if(t.program.set(this.program),t.setDepthMode(r),t.setStencilMode(i),t.setColorMode(n),t.setCullFace(o),s){t.activeTexture.set(b.TEXTURE2),b.bindTexture(b.TEXTURE_2D,s.depthTexture),t.activeTexture.set(b.TEXTURE3),b.bindTexture(b.TEXTURE_2D,s.texture);for(const t in this.terrainUniforms)this.terrainUniforms[t].set(s[t])}if(l)for(const t in l)this.projectionUniforms[Cr[t]].set(l[t]);if(a)for(const t in this.fixedUniforms)this.fixedUniforms[t].set(a[t]);m&&m.setUniforms(t,this.binderUniforms,d,{zoom:f});let v=0;switch(e){case b.LINES:v=2;break;case b.TRIANGLES:v=3;break;case b.LINE_STRIP:v=1}for(const r of p.get()){const i=r.vaos||(r.vaos={});(i[c]||(i[c]=new Sr)).bind(t,this,h,m?m.getPaintVertexBuffers():[],u,r.vertexOffset,g,_,y),b.drawElements(e,r.primitiveLength*v,b.UNSIGNED_SHORT,r.primitiveOffset*v*2)}}}function Ir(t,r,i){const n=1/e.aC(i,1,r.transform.tileZoom),o=Math.pow(2,i.tileID.overscaledZ),a=i.tileSize*Math.pow(2,r.transform.tileZoom)/o,s=a*(i.tileID.canonical.x+i.tileID.wrap*o),l=a*i.tileID.canonical.y;return{u_image:0,u_texsize:i.imageAtlasTexture.size,u_scale:[n,t.fromScale,t.toScale],u_fade:t.t,u_pixel_coord_upper:[s>>16,l>>16],u_pixel_coord_lower:[65535&s,65535&l]}}const Er=(t,r,i,n)=>{const o=t.style.light,a=o.properties.get("position"),s=[a.x,a.y,a.z],l=e.bV();"viewport"===o.properties.get("anchor")&&e.bW(l,t.transform.bearingInRadians),e.bX(s,s,l);const c=t.transform.transformLightDirection(s),h=o.properties.get("color");return{u_lightpos:s,u_lightpos_globe:c,u_lightintensity:o.properties.get("intensity"),u_lightcolor:[h.r,h.g,h.b],u_vertical_gradient:+r,u_opacity:i,u_fill_translate:n}},kr=(t,r,i,n,o,a,s)=>e.e(Er(t,r,i,n),Ir(a,t,s),{u_height_factor:-Math.pow(2,o.overscaledZ)/s.tileSize/8}),zr=(t,r,i,n)=>e.e(Ir(r,t,i),{u_fill_translate:n}),Rr=(t,e)=>({u_world:t,u_fill_translate:e}),Dr=(t,r,i,n,o)=>e.e(zr(t,r,i,o),{u_world:n}),Lr=(t,r,i,n,o)=>{const a=t.transform;let s,l,c=0;if("map"===i.paint.get("circle-pitch-alignment")){const t=e.aC(r,1,a.zoom);s=!0,l=[t,t],c=t/(e.$*Math.pow(2,r.tileID.overscaledZ))*2*Math.PI*o}else s=!1,l=a.pixelsToGLUnits;return{u_camera_to_center_distance:a.cameraToCenterDistance,u_scale_with_map:+("map"===i.paint.get("circle-pitch-scale")),u_pitch_with_map:+s,u_device_pixel_ratio:t.pixelRatio,u_extrude_scale:l,u_globe_extrude_scale:c,u_translate:n}},Fr=t=>({u_pixel_extrude_scale:[1/t.width,1/t.height]}),Br=t=>({u_viewport_size:[t.width,t.height]}),Or=(t,e=1)=>({u_color:t,u_overlay:0,u_overlay_scale:e}),jr=(t,r,i,n)=>{const o=e.aC(t,1,r)/(e.$*Math.pow(2,t.tileID.overscaledZ))*2*Math.PI*n;return{u_extrude_scale:e.aC(t,1,r),u_intensity:i,u_globe_extrude_scale:o}},Ur=(t,r,i,n)=>{const o=e.L();e.bY(o,0,t.width,t.height,0,0,1);const a=t.context.gl;return{u_matrix:o,u_world:[a.drawingBufferWidth,a.drawingBufferHeight],u_image:i,u_color_ramp:n,u_opacity:r.paint.get("heatmap-opacity")}},Nr=(t,e,r)=>{const i=r.paint.get("hillshade-accent-color");let n;switch(r.paint.get("hillshade-method")){case"basic":n=4;break;case"combined":n=1;break;case"igor":n=2;break;case"multidirectional":n=3;break;default:n=0}const o=r.getIlluminationProperties();for(let e=0;e<o.directionRadians.length;e++)"viewport"===r.paint.get("hillshade-illumination-anchor")&&(o.directionRadians[e]+=t.transform.bearingInRadians);return{u_image:0,u_latrange:$r(0,e.tileID),u_exaggeration:r.paint.get("hillshade-exaggeration"),u_altitudes:o.altitudeRadians,u_azimuths:o.directionRadians,u_accent:i,u_method:n,u_highlights:o.highlightColor,u_shadows:o.shadowColor}},Vr=(t,r)=>{const i=r.stride,n=e.L();return e.bY(n,0,e.$,-e.$,0,0,1),e.M(n,n,[0,-e.$,0]),{u_matrix:n,u_image:1,u_dimension:[i,i],u_zoom:t.overscaledZ,u_unpack:r.getUnpackVector()}};function $r(t,r){const i=Math.pow(2,r.canonical.z),n=r.canonical.y;return[new e.a1(0,n/i).toLngLat().lat,new e.a1(0,(n+1)/i).toLngLat().lat]}const Zr=(t,e,r=0)=>({u_image:0,u_unpack:e.getUnpackVector(),u_dimension:[e.stride,e.stride],u_elevation_stops:1,u_color_stops:4,u_color_ramp_size:r,u_opacity:t.paint.get("color-relief-opacity")}),Gr=(t,r,i,n)=>{const o=t.transform;return{u_translation:Kr(t,r,i),u_ratio:n/e.aC(r,1,o.zoom),u_device_pixel_ratio:t.pixelRatio,u_units_to_pixels:[1/o.pixelsToGLUnits[0],1/o.pixelsToGLUnits[1]]}},qr=(t,r,i,n,o)=>e.e(Gr(t,r,i,n),{u_image:0,u_image_height:o}),Hr=(t,r,i,n,o)=>{const a=t.transform,s=Xr(r,a);return{u_translation:Kr(t,r,i),u_texsize:r.imageAtlasTexture.size,u_ratio:n/e.aC(r,1,a.zoom),u_device_pixel_ratio:t.pixelRatio,u_image:0,u_scale:[s,o.fromScale,o.toScale],u_fade:o.t,u_units_to_pixels:[1/a.pixelsToGLUnits[0],1/a.pixelsToGLUnits[1]]}},Wr=(t,r,i,n,o,a)=>{const s=t.lineAtlas,l=Xr(r,t.transform),c="round"===i.layout.get("line-cap"),h=s.getDash(o.from,c),u=s.getDash(o.to,c),p=h.width*a.fromScale,d=u.width*a.toScale;return e.e(Gr(t,r,i,n),{u_patternscale_a:[l/p,-h.height/2],u_patternscale_b:[l/d,-u.height/2],u_sdfgamma:s.width/(256*Math.min(p,d)*t.pixelRatio)/2,u_image:0,u_tex_y_a:h.y,u_tex_y_b:u.y,u_mix:a.t})};function Xr(t,r){return 1/e.aC(t,1,r.tileZoom)}function Kr(t,r,i){return e.aD(t.transform,r,i.paint.get("line-translate"),i.paint.get("line-translate-anchor"))}const Yr=(t,e,r,i,n)=>{return{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:(a=i.paint.get("raster-saturation"),a>0?1-1/(1.001-a):-a),u_contrast_factor:(o=i.paint.get("raster-contrast"),o>0?1/(1-o):1+o),u_spin_weights:Jr(i.paint.get("raster-hue-rotate")),u_coords_top:[n[0].x,n[0].y,n[1].x,n[1].y],u_coords_bottom:[n[3].x,n[3].y,n[2].x,n[2].y]};var o,a};function Jr(t){t*=Math.PI/180;const e=Math.sin(t),r=Math.cos(t);return[(2*r+1)/3,(-Math.sqrt(3)*e-r+1)/3,(Math.sqrt(3)*e-r+1)/3]}const Qr=(t,e,r,i,n,o,a,s,l,c,h,u,p)=>{const d=a.transform;return{u_is_size_zoom_constant:+("constant"===t||"source"===t),u_is_size_feature_constant:+("constant"===t||"camera"===t),u_size_t:e?e.uSizeT:0,u_size:e?e.uSize:0,u_camera_to_center_distance:d.cameraToCenterDistance,u_pitch:d.pitch/360*2*Math.PI,u_rotate_symbol:+r,u_aspect_ratio:d.width/d.height,u_fade_change:a.options.fadeDuration?a.symbolFadeChange:1,u_label_plane_matrix:s,u_coord_matrix:l,u_is_text:+h,u_pitch_with_map:+i,u_is_along_line:n,u_is_variable_anchor:o,u_texsize:u,u_texture:0,u_translation:c,u_pitched_scale:p}},ti=(t,r,i,n,o,a,s,l,c,h,u,p,d,f)=>{const m=s.transform;return e.e(Qr(t,r,i,n,o,a,s,l,c,h,u,p,f),{u_gamma_scale:n?Math.cos(m.pitch*Math.PI/180)*m.cameraToCenterDistance:1,u_device_pixel_ratio:s.pixelRatio,u_is_halo:1})},ei=(t,r,i,n,o,a,s,l,c,h,u,p,d)=>e.e(ti(t,r,i,n,o,a,s,l,c,h,!0,u,0,d),{u_texsize_icon:p,u_texture_icon:1}),ri=(t,e)=>({u_opacity:t,u_color:e}),ii=(t,r,i,n,o)=>e.e(function(t,r,i,n){const o=i.imageManager.getPattern(t.from.toString()),a=i.imageManager.getPattern(t.to.toString()),{width:s,height:l}=i.imageManager.getPixelSize(),c=Math.pow(2,n.tileID.overscaledZ),h=n.tileSize*Math.pow(2,i.transform.tileZoom)/c,u=h*(n.tileID.canonical.x+n.tileID.wrap*c),p=h*n.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:o.tl,u_pattern_br_a:o.br,u_pattern_tl_b:a.tl,u_pattern_br_b:a.br,u_texsize:[s,l],u_mix:r.t,u_pattern_size_a:o.displaySize,u_pattern_size_b:a.displaySize,u_scale_a:r.fromScale,u_scale_b:r.toScale,u_tile_units_to_pixels:1/e.aC(n,1,i.transform.tileZoom),u_pixel_coord_upper:[u>>16,p>>16],u_pixel_coord_lower:[65535&u,65535&p]}}(i,o,r,n),{u_opacity:t}),ni=(t,e)=>{},oi={fillExtrusion:(t,r)=>({u_lightpos:new e.bT(t,r.u_lightpos),u_lightpos_globe:new e.bT(t,r.u_lightpos_globe),u_lightintensity:new e.bg(t,r.u_lightintensity),u_lightcolor:new e.bT(t,r.u_lightcolor),u_vertical_gradient:new e.bg(t,r.u_vertical_gradient),u_opacity:new e.bg(t,r.u_opacity),u_fill_translate:new e.bU(t,r.u_fill_translate)}),fillExtrusionPattern:(t,r)=>({u_lightpos:new e.bT(t,r.u_lightpos),u_lightpos_globe:new e.bT(t,r.u_lightpos_globe),u_lightintensity:new e.bg(t,r.u_lightintensity),u_lightcolor:new e.bT(t,r.u_lightcolor),u_vertical_gradient:new e.bg(t,r.u_vertical_gradient),u_height_factor:new e.bg(t,r.u_height_factor),u_opacity:new e.bg(t,r.u_opacity),u_fill_translate:new e.bU(t,r.u_fill_translate),u_image:new e.bP(t,r.u_image),u_texsize:new e.bU(t,r.u_texsize),u_pixel_coord_upper:new e.bU(t,r.u_pixel_coord_upper),u_pixel_coord_lower:new e.bU(t,r.u_pixel_coord_lower),u_scale:new e.bT(t,r.u_scale),u_fade:new e.bg(t,r.u_fade)}),fill:(t,r)=>({u_fill_translate:new e.bU(t,r.u_fill_translate)}),fillPattern:(t,r)=>({u_image:new e.bP(t,r.u_image),u_texsize:new e.bU(t,r.u_texsize),u_pixel_coord_upper:new e.bU(t,r.u_pixel_coord_upper),u_pixel_coord_lower:new e.bU(t,r.u_pixel_coord_lower),u_scale:new e.bT(t,r.u_scale),u_fade:new e.bg(t,r.u_fade),u_fill_translate:new e.bU(t,r.u_fill_translate)}),fillOutline:(t,r)=>({u_world:new e.bU(t,r.u_world),u_fill_translate:new e.bU(t,r.u_fill_translate)}),fillOutlinePattern:(t,r)=>({u_world:new e.bU(t,r.u_world),u_image:new e.bP(t,r.u_image),u_texsize:new e.bU(t,r.u_texsize),u_pixel_coord_upper:new e.bU(t,r.u_pixel_coord_upper),u_pixel_coord_lower:new e.bU(t,r.u_pixel_coord_lower),u_scale:new e.bT(t,r.u_scale),u_fade:new e.bg(t,r.u_fade),u_fill_translate:new e.bU(t,r.u_fill_translate)}),circle:(t,r)=>({u_camera_to_center_distance:new e.bg(t,r.u_camera_to_center_distance),u_scale_with_map:new e.bP(t,r.u_scale_with_map),u_pitch_with_map:new e.bP(t,r.u_pitch_with_map),u_extrude_scale:new e.bU(t,r.u_extrude_scale),u_device_pixel_ratio:new e.bg(t,r.u_device_pixel_ratio),u_globe_extrude_scale:new e.bg(t,r.u_globe_extrude_scale),u_translate:new e.bU(t,r.u_translate)}),collisionBox:(t,r)=>({u_pixel_extrude_scale:new e.bU(t,r.u_pixel_extrude_scale)}),collisionCircle:(t,r)=>({u_viewport_size:new e.bU(t,r.u_viewport_size)}),debug:(t,r)=>({u_color:new e.bQ(t,r.u_color),u_overlay:new e.bP(t,r.u_overlay),u_overlay_scale:new e.bg(t,r.u_overlay_scale)}),depth:ni,clippingMask:ni,heatmap:(t,r)=>({u_extrude_scale:new e.bg(t,r.u_extrude_scale),u_intensity:new e.bg(t,r.u_intensity),u_globe_extrude_scale:new e.bg(t,r.u_globe_extrude_scale)}),heatmapTexture:(t,r)=>({u_matrix:new e.bR(t,r.u_matrix),u_world:new e.bU(t,r.u_world),u_image:new e.bP(t,r.u_image),u_color_ramp:new e.bP(t,r.u_color_ramp),u_opacity:new e.bg(t,r.u_opacity)}),hillshade:(t,r)=>({u_image:new e.bP(t,r.u_image),u_latrange:new e.bU(t,r.u_latrange),u_exaggeration:new e.bg(t,r.u_exaggeration),u_altitudes:new e.b_(t,r.u_altitudes),u_azimuths:new e.b_(t,r.u_azimuths),u_accent:new e.bQ(t,r.u_accent),u_method:new e.bP(t,r.u_method),u_shadows:new e.bZ(t,r.u_shadows),u_highlights:new e.bZ(t,r.u_highlights)}),hillshadePrepare:(t,r)=>({u_matrix:new e.bR(t,r.u_matrix),u_image:new e.bP(t,r.u_image),u_dimension:new e.bU(t,r.u_dimension),u_zoom:new e.bg(t,r.u_zoom),u_unpack:new e.bS(t,r.u_unpack)}),colorRelief:(t,r)=>({u_image:new e.bP(t,r.u_image),u_unpack:new e.bS(t,r.u_unpack),u_dimension:new e.bU(t,r.u_dimension),u_elevation_stops:new e.bP(t,r.u_elevation_stops),u_color_stops:new e.bP(t,r.u_color_stops),u_color_ramp_size:new e.bP(t,r.u_color_ramp_size),u_opacity:new e.bg(t,r.u_opacity)}),line:(t,r)=>({u_translation:new e.bU(t,r.u_translation),u_ratio:new e.bg(t,r.u_ratio),u_device_pixel_ratio:new e.bg(t,r.u_device_pixel_ratio),u_units_to_pixels:new e.bU(t,r.u_units_to_pixels)}),lineGradient:(t,r)=>({u_translation:new e.bU(t,r.u_translation),u_ratio:new e.bg(t,r.u_ratio),u_device_pixel_ratio:new e.bg(t,r.u_device_pixel_ratio),u_units_to_pixels:new e.bU(t,r.u_units_to_pixels),u_image:new e.bP(t,r.u_image),u_image_height:new e.bg(t,r.u_image_height)}),linePattern:(t,r)=>({u_translation:new e.bU(t,r.u_translation),u_texsize:new e.bU(t,r.u_texsize),u_ratio:new e.bg(t,r.u_ratio),u_device_pixel_ratio:new e.bg(t,r.u_device_pixel_ratio),u_image:new e.bP(t,r.u_image),u_units_to_pixels:new e.bU(t,r.u_units_to_pixels),u_scale:new e.bT(t,r.u_scale),u_fade:new e.bg(t,r.u_fade)}),lineSDF:(t,r)=>({u_translation:new e.bU(t,r.u_translation),u_ratio:new e.bg(t,r.u_ratio),u_device_pixel_ratio:new e.bg(t,r.u_device_pixel_ratio),u_units_to_pixels:new e.bU(t,r.u_units_to_pixels),u_patternscale_a:new e.bU(t,r.u_patternscale_a),u_patternscale_b:new e.bU(t,r.u_patternscale_b),u_sdfgamma:new e.bg(t,r.u_sdfgamma),u_image:new e.bP(t,r.u_image),u_tex_y_a:new e.bg(t,r.u_tex_y_a),u_tex_y_b:new e.bg(t,r.u_tex_y_b),u_mix:new e.bg(t,r.u_mix)}),raster:(t,r)=>({u_tl_parent:new e.bU(t,r.u_tl_parent),u_scale_parent:new e.bg(t,r.u_scale_parent),u_buffer_scale:new e.bg(t,r.u_buffer_scale),u_fade_t:new e.bg(t,r.u_fade_t),u_opacity:new e.bg(t,r.u_opacity),u_image0:new e.bP(t,r.u_image0),u_image1:new e.bP(t,r.u_image1),u_brightness_low:new e.bg(t,r.u_brightness_low),u_brightness_high:new e.bg(t,r.u_brightness_high),u_saturation_factor:new e.bg(t,r.u_saturation_factor),u_contrast_factor:new e.bg(t,r.u_contrast_factor),u_spin_weights:new e.bT(t,r.u_spin_weights),u_coords_top:new e.bS(t,r.u_coords_top),u_coords_bottom:new e.bS(t,r.u_coords_bottom)}),symbolIcon:(t,r)=>({u_is_size_zoom_constant:new e.bP(t,r.u_is_size_zoom_constant),u_is_size_feature_constant:new e.bP(t,r.u_is_size_feature_constant),u_size_t:new e.bg(t,r.u_size_t),u_size:new e.bg(t,r.u_size),u_camera_to_center_distance:new e.bg(t,r.u_camera_to_center_distance),u_pitch:new e.bg(t,r.u_pitch),u_rotate_symbol:new e.bP(t,r.u_rotate_symbol),u_aspect_ratio:new e.bg(t,r.u_aspect_ratio),u_fade_change:new e.bg(t,r.u_fade_change),u_label_plane_matrix:new e.bR(t,r.u_label_plane_matrix),u_coord_matrix:new e.bR(t,r.u_coord_matrix),u_is_text:new e.bP(t,r.u_is_text),u_pitch_with_map:new e.bP(t,r.u_pitch_with_map),u_is_along_line:new e.bP(t,r.u_is_along_line),u_is_variable_anchor:new e.bP(t,r.u_is_variable_anchor),u_texsize:new e.bU(t,r.u_texsize),u_texture:new e.bP(t,r.u_texture),u_translation:new e.bU(t,r.u_translation),u_pitched_scale:new e.bg(t,r.u_pitched_scale)}),symbolSDF:(t,r)=>({u_is_size_zoom_constant:new e.bP(t,r.u_is_size_zoom_constant),u_is_size_feature_constant:new e.bP(t,r.u_is_size_feature_constant),u_size_t:new e.bg(t,r.u_size_t),u_size:new e.bg(t,r.u_size),u_camera_to_center_distance:new e.bg(t,r.u_camera_to_center_distance),u_pitch:new e.bg(t,r.u_pitch),u_rotate_symbol:new e.bP(t,r.u_rotate_symbol),u_aspect_ratio:new e.bg(t,r.u_aspect_ratio),u_fade_change:new e.bg(t,r.u_fade_change),u_label_plane_matrix:new e.bR(t,r.u_label_plane_matrix),u_coord_matrix:new e.bR(t,r.u_coord_matrix),u_is_text:new e.bP(t,r.u_is_text),u_pitch_with_map:new e.bP(t,r.u_pitch_with_map),u_is_along_line:new e.bP(t,r.u_is_along_line),u_is_variable_anchor:new e.bP(t,r.u_is_variable_anchor),u_texsize:new e.bU(t,r.u_texsize),u_texture:new e.bP(t,r.u_texture),u_gamma_scale:new e.bg(t,r.u_gamma_scale),u_device_pixel_ratio:new e.bg(t,r.u_device_pixel_ratio),u_is_halo:new e.bP(t,r.u_is_halo),u_translation:new e.bU(t,r.u_translation),u_pitched_scale:new e.bg(t,r.u_pitched_scale)}),symbolTextAndIcon:(t,r)=>({u_is_size_zoom_constant:new e.bP(t,r.u_is_size_zoom_constant),u_is_size_feature_constant:new e.bP(t,r.u_is_size_feature_constant),u_size_t:new e.bg(t,r.u_size_t),u_size:new e.bg(t,r.u_size),u_camera_to_center_distance:new e.bg(t,r.u_camera_to_center_distance),u_pitch:new e.bg(t,r.u_pitch),u_rotate_symbol:new e.bP(t,r.u_rotate_symbol),u_aspect_ratio:new e.bg(t,r.u_aspect_ratio),u_fade_change:new e.bg(t,r.u_fade_change),u_label_plane_matrix:new e.bR(t,r.u_label_plane_matrix),u_coord_matrix:new e.bR(t,r.u_coord_matrix),u_is_text:new e.bP(t,r.u_is_text),u_pitch_with_map:new e.bP(t,r.u_pitch_with_map),u_is_along_line:new e.bP(t,r.u_is_along_line),u_is_variable_anchor:new e.bP(t,r.u_is_variable_anchor),u_texsize:new e.bU(t,r.u_texsize),u_texsize_icon:new e.bU(t,r.u_texsize_icon),u_texture:new e.bP(t,r.u_texture),u_texture_icon:new e.bP(t,r.u_texture_icon),u_gamma_scale:new e.bg(t,r.u_gamma_scale),u_device_pixel_ratio:new e.bg(t,r.u_device_pixel_ratio),u_is_halo:new e.bP(t,r.u_is_halo),u_translation:new e.bU(t,r.u_translation),u_pitched_scale:new e.bg(t,r.u_pitched_scale)}),background:(t,r)=>({u_opacity:new e.bg(t,r.u_opacity),u_color:new e.bQ(t,r.u_color)}),backgroundPattern:(t,r)=>({u_opacity:new e.bg(t,r.u_opacity),u_image:new e.bP(t,r.u_image),u_pattern_tl_a:new e.bU(t,r.u_pattern_tl_a),u_pattern_br_a:new e.bU(t,r.u_pattern_br_a),u_pattern_tl_b:new e.bU(t,r.u_pattern_tl_b),u_pattern_br_b:new e.bU(t,r.u_pattern_br_b),u_texsize:new e.bU(t,r.u_texsize),u_mix:new e.bg(t,r.u_mix),u_pattern_size_a:new e.bU(t,r.u_pattern_size_a),u_pattern_size_b:new e.bU(t,r.u_pattern_size_b),u_scale_a:new e.bg(t,r.u_scale_a),u_scale_b:new e.bg(t,r.u_scale_b),u_pixel_coord_upper:new e.bU(t,r.u_pixel_coord_upper),u_pixel_coord_lower:new e.bU(t,r.u_pixel_coord_lower),u_tile_units_to_pixels:new e.bg(t,r.u_tile_units_to_pixels)}),terrain:(t,r)=>({u_texture:new e.bP(t,r.u_texture),u_ele_delta:new e.bg(t,r.u_ele_delta),u_fog_matrix:new e.bR(t,r.u_fog_matrix),u_fog_color:new e.bQ(t,r.u_fog_color),u_fog_ground_blend:new e.bg(t,r.u_fog_ground_blend),u_fog_ground_blend_opacity:new e.bg(t,r.u_fog_ground_blend_opacity),u_horizon_color:new e.bQ(t,r.u_horizon_color),u_horizon_fog_blend:new e.bg(t,r.u_horizon_fog_blend),u_is_globe_mode:new e.bg(t,r.u_is_globe_mode)}),terrainDepth:(t,r)=>({u_ele_delta:new e.bg(t,r.u_ele_delta)}),terrainCoords:(t,r)=>({u_texture:new e.bP(t,r.u_texture),u_terrain_coords_id:new e.bg(t,r.u_terrain_coords_id),u_ele_delta:new e.bg(t,r.u_ele_delta)}),projectionErrorMeasurement:(t,r)=>({u_input:new e.bg(t,r.u_input),u_output_expected:new e.bg(t,r.u_output_expected)}),atmosphere:(t,r)=>({u_sun_pos:new e.bT(t,r.u_sun_pos),u_atmosphere_blend:new e.bg(t,r.u_atmosphere_blend),u_globe_position:new e.bT(t,r.u_globe_position),u_globe_radius:new e.bg(t,r.u_globe_radius),u_inv_proj_matrix:new e.bR(t,r.u_inv_proj_matrix)}),sky:(t,r)=>({u_sky_color:new e.bQ(t,r.u_sky_color),u_horizon_color:new e.bQ(t,r.u_horizon_color),u_horizon:new e.bU(t,r.u_horizon),u_horizon_normal:new e.bU(t,r.u_horizon_normal),u_sky_horizon_blend:new e.bg(t,r.u_sky_horizon_blend),u_sky_blend:new e.bg(t,r.u_sky_blend)})};class ai{constructor(t,e,r){this.context=t;const i=t.gl;this.buffer=i.createBuffer(),this.dynamicDraw=Boolean(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){const 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(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const si={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class li{constructor(t,e,r,i){this.length=e.length,this.attributes=r,this.itemSize=e.bytesPerElement,this.dynamicDraw=i,this.context=t;const 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 ${t.length}, which doesn't match current length of ${this.length}`);const 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++){const i=e.attributes[this.attributes[r].name];void 0!==i&&t.enableVertexAttribArray(i)}}setVertexAttribPointers(t,e,r){for(let i=0;i<this.attributes.length;i++){const n=this.attributes[i],o=e.attributes[n.name];void 0!==o&&t.vertexAttribPointer(o,n.components,t[si[n.type]],!1,this.itemSize,n.offset+this.itemSize*(r||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class ci{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)}}class hi extends ci{getDefault(){return e.bf.transparent}set(t){const 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)}}class ui extends ci{getDefault(){return 1}set(t){(t!==this.current||this.dirty)&&(this.gl.clearDepth(t),this.current=t,this.dirty=!1)}}class pi extends ci{getDefault(){return 0}set(t){(t!==this.current||this.dirty)&&(this.gl.clearStencil(t),this.current=t,this.dirty=!1)}}class di extends ci{getDefault(){return[!0,!0,!0,!0]}set(t){const 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)}}class fi extends ci{getDefault(){return!0}set(t){(t!==this.current||this.dirty)&&(this.gl.depthMask(t),this.current=t,this.dirty=!1)}}class mi extends ci{getDefault(){return 255}set(t){(t!==this.current||this.dirty)&&(this.gl.stencilMask(t),this.current=t,this.dirty=!1)}}class gi extends ci{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(t){const 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)}}class _i extends ci{getDefault(){const t=this.gl;return[t.KEEP,t.KEEP,t.KEEP]}set(t){const 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)}}class yi extends ci{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;t?e.enable(e.STENCIL_TEST):e.disable(e.STENCIL_TEST),this.current=t,this.dirty=!1}}class bi extends ci{getDefault(){return[0,1]}set(t){const 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)}}class vi extends ci{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;t?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST),this.current=t,this.dirty=!1}}class xi extends ci{getDefault(){return this.gl.LESS}set(t){(t!==this.current||this.dirty)&&(this.gl.depthFunc(t),this.current=t,this.dirty=!1)}}class wi extends ci{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;t?e.enable(e.BLEND):e.disable(e.BLEND),this.current=t,this.dirty=!1}}class Ti extends ci{getDefault(){const t=this.gl;return[t.ONE,t.ZERO]}set(t){const 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)}}class Si extends ci{getDefault(){return e.bf.transparent}set(t){const 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)}}class Pi extends ci{getDefault(){return this.gl.FUNC_ADD}set(t){(t!==this.current||this.dirty)&&(this.gl.blendEquation(t),this.current=t,this.dirty=!1)}}class Ci extends ci{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;t?e.enable(e.CULL_FACE):e.disable(e.CULL_FACE),this.current=t,this.dirty=!1}}class Mi extends ci{getDefault(){return this.gl.BACK}set(t){(t!==this.current||this.dirty)&&(this.gl.cullFace(t),this.current=t,this.dirty=!1)}}class Ai extends ci{getDefault(){return this.gl.CCW}set(t){(t!==this.current||this.dirty)&&(this.gl.frontFace(t),this.current=t,this.dirty=!1)}}class Ii extends ci{getDefault(){return null}set(t){(t!==this.current||this.dirty)&&(this.gl.useProgram(t),this.current=t,this.dirty=!1)}}class Ei extends ci{getDefault(){return this.gl.TEXTURE0}set(t){(t!==this.current||this.dirty)&&(this.gl.activeTexture(t),this.current=t,this.dirty=!1)}}class ki extends ci{getDefault(){const t=this.gl;return[0,0,t.drawingBufferWidth,t.drawingBufferHeight]}set(t){const 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)}}class zi extends ci{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.bindFramebuffer(e.FRAMEBUFFER,t),this.current=t,this.dirty=!1}}class Ri extends ci{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.bindRenderbuffer(e.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class Di extends ci{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.bindTexture(e.TEXTURE_2D,t),this.current=t,this.dirty=!1}}class Li extends ci{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.bindBuffer(e.ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class Fi extends ci{getDefault(){return null}set(t){const e=this.gl;e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class Bi extends ci{getDefault(){return null}set(t){var e;if(t===this.current&&!this.dirty)return;const r=this.gl;qe(r)?r.bindVertexArray(t):null===(e=r.getExtension("OES_vertex_array_object"))||void 0===e||e.bindVertexArrayOES(t),this.current=t,this.dirty=!1}}class Oi extends ci{getDefault(){return 4}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.pixelStorei(e.UNPACK_ALIGNMENT,t),this.current=t,this.dirty=!1}}class ji extends ci{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t),this.current=t,this.dirty=!1}}class Ui extends ci{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,t),this.current=t,this.dirty=!1}}class Ni extends ci{constructor(t,e){super(t),this.context=t,this.parent=e}getDefault(){return null}}class Vi extends Ni{setDirty(){this.dirty=!0}set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const e=this.gl;e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t,0),this.current=t,this.dirty=!1}}class $i extends Ni{set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const e=this.gl;e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class Zi extends Ni{set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const e=this.gl;e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,t),this.current=t,this.dirty=!1}}const Gi="Framebuffer is not complete";class qi{constructor(t,e,r,i,n){this.context=t,this.width=e,this.height=r;const o=t.gl,a=this.framebuffer=o.createFramebuffer();if(this.colorAttachment=new Vi(t,a),i)this.depthAttachment=n?new Zi(t,a):new $i(t,a);else if(n)throw new Error("Stencil cannot be set without depth");if(o.checkFramebufferStatus(o.FRAMEBUFFER)!==o.FRAMEBUFFER_COMPLETE)throw new Error(Gi)}destroy(){const t=this.context.gl,e=this.colorAttachment.get();if(e&&t.deleteTexture(e),this.depthAttachment){const e=this.depthAttachment.get();e&&t.deleteRenderbuffer(e)}t.deleteFramebuffer(this.framebuffer)}}class Hi{constructor(t){var e,r;if(this.gl=t,this.clearColor=new hi(this),this.clearDepth=new ui(this),this.clearStencil=new pi(this),this.colorMask=new di(this),this.depthMask=new fi(this),this.stencilMask=new mi(this),this.stencilFunc=new gi(this),this.stencilOp=new _i(this),this.stencilTest=new yi(this),this.depthRange=new bi(this),this.depthTest=new vi(this),this.depthFunc=new xi(this),this.blend=new wi(this),this.blendFunc=new Ti(this),this.blendColor=new Si(this),this.blendEquation=new Pi(this),this.cullFace=new Ci(this),this.cullFaceSide=new Mi(this),this.frontFace=new Ai(this),this.program=new Ii(this),this.activeTexture=new Ei(this),this.viewport=new ki(this),this.bindFramebuffer=new zi(this),this.bindRenderbuffer=new Ri(this),this.bindTexture=new Di(this),this.bindVertexBuffer=new Li(this),this.bindElementBuffer=new Fi(this),this.bindVertexArray=new Bi(this),this.pixelStoreUnpack=new Oi(this),this.pixelStoreUnpackPremultiplyAlpha=new ji(this),this.pixelStoreUnpackFlipY=new Ui(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),qe(t)){this.HALF_FLOAT=t.HALF_FLOAT;const i=t.getExtension("EXT_color_buffer_half_float");this.RGBA16F=null!==(e=t.RGBA16F)&&void 0!==e?e:null==i?void 0:i.RGBA16F_EXT,this.RGB16F=null!==(r=t.RGB16F)&&void 0!==r?r:null==i?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");const e=t.getExtension("OES_texture_half_float");this.HALF_FLOAT=null==e?void 0:e.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 ai(this,t,e)}createVertexBuffer(t,e,r){return new li(this,t,e,r)}createRenderbuffer(t,e,r){const 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 qi(this,t,e,r,i)}clear({color:t,depth:e,stencil:r}){const i=this.gl;let n=0;t&&(n|=i.COLOR_BUFFER_BIT,this.clearColor.set(t),this.colorMask.set([!0,!0,!0,!0])),void 0!==e&&(n|=i.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(e),this.depthMask.set(!0)),void 0!==r&&(n|=i.STENCIL_BUFFER_BIT,this.clearStencil.set(r),this.stencilMask.set(255)),i.clear(n)}setCullFace(t){!1===t.enable?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(!0),this.depthFunc.set(t.func),this.depthMask.set(t.mask),this.depthRange.set(t.range)):this.depthTest.set(!1)}setStencilMode(t){t.test.func!==this.gl.ALWAYS||t.mask?(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})):this.stencilTest.set(!1)}setColorMode(t){e.bH(t.blendFunction,je.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 qe(this.gl)?this.gl.createVertexArray():null===(t=this.gl.getExtension("OES_vertex_array_object"))||void 0===t?void 0:t.createVertexArrayOES()}deleteVertexArray(t){var e;return qe(this.gl)?this.gl.deleteVertexArray(t):null===(e=this.gl.getExtension("OES_vertex_array_object"))||void 0===e?void 0:e.deleteVertexArrayOES(t)}unbindVAO(){this.bindVertexArray.set(null)}}let Wi;function Xi(t,r,i,n,o){const a=t.context,s=t.transform,l=a.gl,c=t.useProgram("collisionBox"),h=[];let u=0,p=0;for(let e=0;e<n.length;e++){const d=n[e],f=r.getTile(d).getBucket(i);if(!f)continue;const m=o?f.textCollisionBox:f.iconCollisionBox,g=f.collisionCircleArray;g.length>0&&(h.push({circleArray:g,circleOffset:p,coord:d}),u+=g.length/4,p=u),m&&c.draw(a,l.LINES,Ve.disabled,Ze.disabled,t.colorModeForRenderPass(),Ne.disabled,Fr(t.transform),t.style.map.terrain&&t.style.map.terrain.getTerrainData(d),s.getProjectionData({overscaledTileID:d,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),i.id,m.layoutVertexBuffer,m.indexBuffer,m.segments,null,t.transform.zoom,null,null,m.collisionVertexBuffer)}if(!o||!h.length)return;const d=t.useProgram("collisionCircle"),f=new e.b$;f.resize(4*u),f._trim();let m=0;for(const t of h)for(let e=0;e<t.circleArray.length/4;e++){const r=4*e,i=t.circleArray[r+0],n=t.circleArray[r+1],o=t.circleArray[r+2],a=t.circleArray[r+3];f.emplace(m++,i,n,o,a,0),f.emplace(m++,i,n,o,a,1),f.emplace(m++,i,n,o,a,2),f.emplace(m++,i,n,o,a,3)}(!Wi||Wi.length<2*u)&&(Wi=function(t){const r=2*t,i=new e.c1;i.resize(r),i._trim();for(let t=0;t<r;t++){const e=6*t;i.uint16[e+0]=4*t+0,i.uint16[e+1]=4*t+1,i.uint16[e+2]=4*t+2,i.uint16[e+3]=4*t+2,i.uint16[e+4]=4*t+3,i.uint16[e+5]=4*t+0}return i}(u));const g=a.createIndexBuffer(Wi,!0),_=a.createVertexBuffer(f,e.c0.members,!0);for(const r of h){const n=Br(t.transform);d.draw(a,l.TRIANGLES,Ve.disabled,Ze.disabled,t.colorModeForRenderPass(),Ne.disabled,n,t.style.map.terrain&&t.style.map.terrain.getTerrainData(r.coord),null,i.id,_,g,e.aM.simpleSegment(0,2*r.circleOffset,r.circleArray.length,r.circleArray.length/2),null,t.transform.zoom,null,null,null)}_.destroy(),g.destroy()}const Ki=e.ag(new Float32Array(16));function Yi(t,r,i,n,o,a){const{horizontalAlign:s,verticalAlign:l}=e.aH(t);return new e.P((-(s-.5)*r/o+n[0])*a,(-(l-.5)*i/o+n[1])*a)}function Ji(t,r,i,n,o,a){const s=r.tileAnchorPoint.add(new e.P(r.translation[0],r.translation[1]));if(r.pitchWithMap){let t=n.mult(a);i||(t=t.rotate(-o));const e=s.add(t);return It(e.x,e.y,r.pitchedLabelPlaneMatrix,r.getElevation).point}if(i){const e=Ot(r.tileAnchorPoint.x+1,r.tileAnchorPoint.y,r).point.sub(t),i=Math.atan(e.y/e.x)+(e.x<0?Math.PI:0);return t.add(n.rotate(i))}return t.add(n)}function Qi(t,r,i,n,o,a,s,l,c,h,u,p){const d=t.text.placedSymbolArray,f=t.text.dynamicLayoutVertexArray,m=t.icon.dynamicLayoutVertexArray,g={};f.clear();for(let m=0;m<d.length;m++){const _=d.get(m),y=_.hidden||!_.crossTileID||t.allowVerticalPlacement&&!_.placedOrientation?null:n[_.crossTileID];if(y){const n=new e.P(_.anchorX,_.anchorY),d={getElevation:p,width:o.width,height:o.height,pitchedLabelPlaneMatrix:a,pitchWithMap:i,transform:o,tileAnchorPoint:n,translation:h,unwrappedTileID:u},m=i?Ut(n.x,n.y,d):Ot(n.x,n.y,d),b=Et(o.cameraToCenterDistance,m.signedDistanceFromCamera);let v=e.ap(t.textSizeData,l,_)*b/e.aB;i&&(v*=t.tilePixelRatio/s);const{width:x,height:w,anchor:T,textOffset:S,textBoxScale:P}=y,C=Yi(T,x,w,S,P,v),M=o.getPitchedTextCorrection(n.x+h[0],n.y+h[1],u),A=Ji(m.point,d,r,C,-o.bearingInRadians,M),I=t.allowVerticalPlacement&&_.placedOrientation===e.ao.vertical?Math.PI/2:0;for(let t=0;t<_.numGlyphs;t++)e.av(f,A,I);c&&_.associatedIconIndex>=0&&(g[_.associatedIconIndex]={shiftedAnchor:A,angle:I})}else Gt(_.numGlyphs,f)}if(c){m.clear();const r=t.icon.placedSymbolArray;for(let t=0;t<r.length;t++){const i=r.get(t);if(i.hidden)Gt(i.numGlyphs,m);else{const r=g[t];if(r)for(let t=0;t<i.numGlyphs;t++)e.av(m,r.shiftedAnchor,r.angle);else Gt(i.numGlyphs,m)}}t.icon.dynamicLayoutVertexBuffer.updateData(m)}t.text.dynamicLayoutVertexBuffer.updateData(f)}function tn(t,e,r){return r.iconsInText&&e?"symbolTextAndIcon":t?"symbolSDF":"symbolIcon"}function en(t,r,i,n,o,a,s,l,c,h,u,p,d){const f=t.context,m=f.gl,g=t.transform,_="map"===l,y="map"===c,b="viewport"!==l&&"point"!==i.layout.get("symbol-placement"),v=_&&!y&&!b,x=!i.layout.get("symbol-sort-key").isConstant();let w=!1;const T=t.getDepthModeForSublayer(0,Ve.ReadOnly),S=i._unevaluatedLayout.hasValue("text-variable-anchor")||i._unevaluatedLayout.hasValue("text-variable-anchor-offset"),P=[],C=g.getCircleRadiusCorrection();for(const l of n){const n=r.getTile(l),c=n.getBucket(i);if(!c)continue;const u=o?c.text:c.icon;if(!u||!u.segments.get().length||!u.hasVisibleVertices)continue;const p=u.programConfigurations.get(i.id),f=o||c.sdfIcons,T=o?c.textSizeData:c.iconSizeData,M=y||0!==g.pitch,A=t.useProgram(tn(f,o,c),p),I=e.an(T,g.zoom),E=t.style.map.terrain&&t.style.map.terrain.getTerrainData(l);let k,z,R,D,L=[0,0],F=null;if(o)z=n.glyphAtlasTexture,R=m.LINEAR,k=n.glyphAtlasTexture.size,c.iconsInText&&(L=n.imageAtlasTexture.size,F=n.imageAtlasTexture,D=M||t.options.rotating||t.options.zooming||"composite"===T.kind||"camera"===T.kind?m.LINEAR:m.NEAREST);else{const e=1!==i.layout.get("icon-size").constantOr(0)||c.iconsNeedLinear;z=n.imageAtlasTexture,R=f||t.options.rotating||t.options.zooming||e||M?m.LINEAR:m.NEAREST,k=n.imageAtlasTexture.size}const B=e.aC(n,1,t.transform.zoom),O=Ct(_,t.transform,B),j=e.L();e.aq(j,O);const U=Mt(y,_,t.transform,B),N=e.aD(g,n,a,s),V=g.getProjectionData({overscaledTileID:l,applyGlobeMatrix:!d,applyTerrainMatrix:!0}),$=S&&c.hasTextData(),Z="none"!==i.layout.get("icon-text-fit")&&$&&c.hasIconData();if(b){const e=t.style.map.terrain?(e,r)=>t.style.map.terrain.getElevation(l,e,r):null,r="map"===i.layout.get("text-rotation-alignment");zt(c,t,o,O,j,y,h,r,l.toUnwrapped(),g.width,g.height,N,e)}const G=o&&S||Z,q=b||G?Ki:y?O:t.transform.clipSpaceToPixelsMatrix,H=f&&0!==i.paint.get(o?"text-halo-width":"icon-halo-width").constantOr(1);let W;W=f?c.iconsInText?ei(T.kind,I,v,y,b,G,t,q,U,N,k,L,C):ti(T.kind,I,v,y,b,G,t,q,U,N,o,k,0,C):Qr(T.kind,I,v,y,b,G,t,q,U,N,o,k,C);const X={program:A,buffers:u,uniformValues:W,projectionData:V,atlasTexture:z,atlasTextureIcon:F,atlasInterpolation:R,atlasInterpolationIcon:D,isSDF:f,hasHalo:H};if(x&&c.canOverlap){w=!0;const t=u.segments.get();for(const r of t)P.push({segments:new e.aM([r]),sortKey:r.sortKey,state:X,terrainData:E})}else P.push({segments:u.segments,sortKey:0,state:X,terrainData:E})}w&&P.sort((t,e)=>t.sortKey-e.sortKey);for(const e of P){const r=e.state;if(f.activeTexture.set(m.TEXTURE0),r.atlasTexture.bind(r.atlasInterpolation,m.CLAMP_TO_EDGE),r.atlasTextureIcon&&(f.activeTexture.set(m.TEXTURE1),r.atlasTextureIcon&&r.atlasTextureIcon.bind(r.atlasInterpolationIcon,m.CLAMP_TO_EDGE)),r.isSDF){const n=r.uniformValues;r.hasHalo&&(n.u_is_halo=1,rn(r.buffers,e.segments,i,t,r.program,T,u,p,n,r.projectionData,e.terrainData)),n.u_is_halo=0}rn(r.buffers,e.segments,i,t,r.program,T,u,p,r.uniformValues,r.projectionData,e.terrainData)}}function rn(t,e,r,i,n,o,a,s,l,c,h){const u=i.context;n.draw(u,u.gl.TRIANGLES,o,a,s,Ne.backCCW,l,h,c,r.id,t.layoutVertexBuffer,t.indexBuffer,e,r.paint,i.transform.zoom,t.programConfigurations.get(r.id),t.dynamicLayoutVertexBuffer,t.opacityVertexBuffer)}function nn(t,r,i,n,o){const a=t.context,s=a.gl,l=Ze.disabled,c=new je([s.ONE,s.ONE],e.bf.transparent,[!0,!0,!0,!0]),h=r.getBucket(i);if(!h)return;const u=n.key;let p=i.heatmapFbos.get(u);p||(p=an(a,r.tileSize,r.tileSize),i.heatmapFbos.set(u,p)),a.bindFramebuffer.set(p.framebuffer),a.viewport.set([0,0,r.tileSize,r.tileSize]),a.clear({color:e.bf.transparent});const d=h.programConfigurations.get(i.id),f=t.useProgram("heatmap",d,!o),m=t.transform.getProjectionData({overscaledTileID:r.tileID,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),g=t.style.map.terrain.getTerrainData(n);f.draw(a,s.TRIANGLES,Ve.disabled,l,c,Ne.disabled,jr(r,t.transform.zoom,i.paint.get("heatmap-intensity"),1),g,m,i.id,h.layoutVertexBuffer,h.indexBuffer,h.segments,i.paint,t.transform.zoom,d)}function on(t,e,r,i,n){const o=t.context,a=o.gl,s=t.transform;o.setColorMode(t.colorModeForRenderPass());const l=sn(o,e),c=r.key,h=e.heatmapFbos.get(c);if(!h)return;o.activeTexture.set(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,h.colorAttachment.get()),o.activeTexture.set(a.TEXTURE1),l.bind(a.LINEAR,a.CLAMP_TO_EDGE);const u=s.getProjectionData({overscaledTileID:r,applyTerrainMatrix:n,applyGlobeMatrix:!i});t.useProgram("heatmapTexture").draw(o,a.TRIANGLES,Ve.disabled,Ze.disabled,t.colorModeForRenderPass(),Ne.disabled,Ur(t,e,0,1),null,u,e.id,t.rasterBoundsBuffer,t.quadTriangleIndexBuffer,t.rasterBoundsSegments,e.paint,s.zoom),h.destroy(),e.heatmapFbos.delete(c)}function an(t,e,r){var i,n;const o=t.gl,a=o.createTexture();o.bindTexture(o.TEXTURE_2D,a),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,o.LINEAR),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,o.LINEAR);const s=null!==(i=t.HALF_FLOAT)&&void 0!==i?i:o.UNSIGNED_BYTE,l=null!==(n=t.RGBA16F)&&void 0!==n?n:o.RGBA;o.texImage2D(o.TEXTURE_2D,0,l,e,r,0,o.RGBA,s,null);const c=t.createFramebuffer(e,r,!1,!1);return c.colorAttachment.set(a),c}function sn(t,r){return r.colorRampTexture||(r.colorRampTexture=new e.T(t,r.colorRamp,t.gl.RGBA)),r.colorRampTexture}function ln(t,e,r,i,n){if(!r||!i||!i.imageAtlas)return;const o=i.imageAtlas.patternPositions;let a=o[r.to.toString()],s=o[r.from.toString()];if(!a&&s&&(a=s),!s&&a&&(s=a),!a||!s){const t=n.getPaintProperty(e);a=o[t],s=o[t]}a&&s&&t.setConstantPatternPositions(a,s)}function cn(t,r,i,n,o,a,s,l){const c=t.context.gl,h="fill-pattern",u=i.paint.get(h),p=u&&u.constantOr(1),d=i.getCrossfadeParameters();let f,m,g,_,y;const b=t.transform,v=i.paint.get("fill-translate"),x=i.paint.get("fill-translate-anchor");s?(m=p&&!i.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",f=c.LINES):(m=p?"fillPattern":"fill",f=c.TRIANGLES);const w=u.constantOr(null);for(const u of n){const n=r.getTile(u);if(p&&!n.patternsLoaded())continue;const T=n.getBucket(i);if(!T)continue;const S=T.programConfigurations.get(i.id),P=t.useProgram(m,S),C=t.style.map.terrain&&t.style.map.terrain.getTerrainData(u);p&&(t.context.activeTexture.set(c.TEXTURE0),n.imageAtlasTexture.bind(c.LINEAR,c.CLAMP_TO_EDGE),S.updatePaintBuffers(d)),ln(S,h,w,n,i);const M=b.getProjectionData({overscaledTileID:u,applyGlobeMatrix:!l,applyTerrainMatrix:!0}),A=e.aD(b,n,v,x);if(s){_=T.indexBuffer2,y=T.segments2;const e=[c.drawingBufferWidth,c.drawingBufferHeight];g="fillOutlinePattern"===m&&p?Dr(t,d,n,e,A):Rr(e,A)}else _=T.indexBuffer,y=T.segments,g=p?zr(t,d,n,A):{u_fill_translate:A};const I=t.stencilModeForClipping(u);P.draw(t.context,f,o,I,a,Ne.backCCW,g,C,M,i.id,T.layoutVertexBuffer,_,y,i.paint,t.transform.zoom,S)}}function hn(t,r,i,n,o,a,s,l){const c=t.context,h=c.gl,u="fill-extrusion-pattern",p=i.paint.get(u),d=p.constantOr(1),f=i.getCrossfadeParameters(),m=i.paint.get("fill-extrusion-opacity"),g=p.constantOr(null),_=t.transform;for(const p of n){const n=r.getTile(p),y=n.getBucket(i);if(!y)continue;const b=t.style.map.terrain&&t.style.map.terrain.getTerrainData(p),v=y.programConfigurations.get(i.id),x=t.useProgram(d?"fillExtrusionPattern":"fillExtrusion",v);d&&(t.context.activeTexture.set(h.TEXTURE0),n.imageAtlasTexture.bind(h.LINEAR,h.CLAMP_TO_EDGE),v.updatePaintBuffers(f));const w=_.getProjectionData({overscaledTileID:p,applyGlobeMatrix:!l,applyTerrainMatrix:!0});ln(v,u,g,n,i);const T=e.aD(_,n,i.paint.get("fill-extrusion-translate"),i.paint.get("fill-extrusion-translate-anchor")),S=i.paint.get("fill-extrusion-vertical-gradient"),P=d?kr(t,S,m,T,p,f,n):Er(t,S,m,T);x.draw(c,c.gl.TRIANGLES,o,a,s,Ne.backCCW,P,b,w,i.id,y.layoutVertexBuffer,y.indexBuffer,y.segments,i.paint,t.transform.zoom,v,t.style.map.terrain&&y.centroidVertexBuffer)}}function un(t,e,r,i,n,o,a,s,l){var c;const h=t.style.projection,u=t.context,p=t.transform,d=u.gl,f=[`#define NUM_ILLUMINATION_SOURCES ${r.paint.get("hillshade-highlight-color").values.length}`],m=t.useProgram("hillshade",null,!1,f),g=!t.options.moving;for(const f of i){const i=e.getTile(f),_=i.fbo;if(!_)continue;const y=h.getMeshFromTileID(u,f.canonical,s,!0,"raster"),b=null===(c=t.style.map.terrain)||void 0===c?void 0:c.getTerrainData(f);u.activeTexture.set(d.TEXTURE0),d.bindTexture(d.TEXTURE_2D,_.colorAttachment.get());const v=p.getProjectionData({overscaledTileID:f,aligned:g,applyGlobeMatrix:!l,applyTerrainMatrix:!0});m.draw(u,d.TRIANGLES,o,n[f.overscaledZ],a,Ne.backCCW,Nr(t,i,r),b,v,r.id,y.vertexBuffer,y.indexBuffer,y.segments)}}function pn(t,r,i,n,o,a,s,l,c){var h;const u=t.style.projection,p=t.context,d=t.transform,f=p.gl,m=t.useProgram("colorRelief"),g=!t.options.moving;let _=!0,y=0;for(const b of n){const n=r.getTile(b),v=n.dem;if(_){const t=f.getParameter(f.MAX_TEXTURE_SIZE),{elevationTexture:e,colorTexture:r}=i.getColorRampTextures(p,t,v.getUnpackVector());p.activeTexture.set(f.TEXTURE1),e.bind(f.NEAREST,f.CLAMP_TO_EDGE),p.activeTexture.set(f.TEXTURE4),r.bind(f.LINEAR,f.CLAMP_TO_EDGE),_=!1,y=e.size[0]}if(!v||!v.data)continue;const x=v.stride,w=v.getPixels();if(p.activeTexture.set(f.TEXTURE0),p.pixelStoreUnpackPremultiplyAlpha.set(!1),n.demTexture=n.demTexture||t.getTileTexture(x),n.demTexture){const t=n.demTexture;t.update(w,{premultiply:!1}),t.bind(f.LINEAR,f.CLAMP_TO_EDGE)}else n.demTexture=new e.T(p,w,f.RGBA,{premultiply:!1}),n.demTexture.bind(f.LINEAR,f.CLAMP_TO_EDGE);const T=u.getMeshFromTileID(p,b.canonical,l,!0,"raster"),S=null===(h=t.style.map.terrain)||void 0===h?void 0:h.getTerrainData(b),P=d.getProjectionData({overscaledTileID:b,aligned:g,applyGlobeMatrix:!c,applyTerrainMatrix:!0});m.draw(p,f.TRIANGLES,a,o[b.overscaledZ],s,Ne.backCCW,Zr(i,n.dem,y),S,P,i.id,T.vertexBuffer,T.indexBuffer,T.segments)}}const dn=[new e.P(0,0),new e.P(e.$,0),new e.P(e.$,e.$),new e.P(0,e.$)];function fn(t,e,r,i,n,o,a,s,l=!1,c=!1){const h=i[i.length-1].overscaledZ,u=t.context,p=u.gl,d=t.useProgram("raster"),f=t.transform,m=t.style.projection,g=t.colorModeForRenderPass(),_=!t.options.moving;for(const y of i){const i=t.getDepthModeForSublayer(y.overscaledZ-h,1===r.paint.get("raster-opacity")?Ve.ReadWrite:Ve.ReadOnly,p.LESS),b=e.getTile(y);b.registerFadeDuration(r.paint.get("raster-fade-duration"));const v=e.findLoadedParent(y,0),x=e.findLoadedSibling(y),w=mn(b,v||x||null,e,r,t.transform,t.style.map.terrain);let T,S;const P="nearest"===r.paint.get("raster-resampling")?p.NEAREST:p.LINEAR;u.activeTexture.set(p.TEXTURE0),b.texture.bind(P,p.CLAMP_TO_EDGE,p.LINEAR_MIPMAP_NEAREST),u.activeTexture.set(p.TEXTURE1),v?(v.texture.bind(P,p.CLAMP_TO_EDGE,p.LINEAR_MIPMAP_NEAREST),T=Math.pow(2,v.tileID.overscaledZ-b.tileID.overscaledZ),S=[b.tileID.canonical.x*T%1,b.tileID.canonical.y*T%1]):b.texture.bind(P,p.CLAMP_TO_EDGE,p.LINEAR_MIPMAP_NEAREST),b.texture.useMipmap&&u.extTextureFilterAnisotropic&&t.transform.pitch>20&&p.texParameterf(p.TEXTURE_2D,u.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,u.extTextureFilterAnisotropicMax);const C=t.style.map.terrain&&t.style.map.terrain.getTerrainData(y),M=f.getProjectionData({overscaledTileID:y,aligned:_,applyGlobeMatrix:!c,applyTerrainMatrix:!0}),A=Yr(S||[0,0],T||1,w,r,s),I=m.getMeshFromTileID(u,y.canonical,o,a,"raster");d.draw(u,p.TRIANGLES,i,n?n[y.overscaledZ]:Ze.disabled,g,l?Ne.frontCCW:Ne.backCCW,A,C,M,r.id,I.vertexBuffer,I.indexBuffer,I.segments)}}function mn(t,r,i,n,o,s){const l=n.paint.get("raster-fade-duration");if(!s&&l>0){const n=a.now(),s=(n-t.timeAdded)/l,c=r?(n-r.timeAdded)/l:-1,h=i.getSource(),u=_t(o,{tileSize:h.tileSize,roundZoom:h.roundZoom}),p=!r||Math.abs(r.tileID.overscaledZ-u)>Math.abs(t.tileID.overscaledZ-u),d=p&&t.refreshedUponExpiration?1:e.ah(p?s:1-c,0,1);return t.refreshedUponExpiration&&s>=1&&(t.refreshedUponExpiration=!1),r?{opacity:1,mix:1-d}:{opacity:d,mix:0}}return{opacity:1,mix:0}}const gn=new e.bf(1,0,0,1),_n=new e.bf(0,1,0,1),yn=new e.bf(0,0,1,1),bn=new e.bf(1,0,1,1),vn=new e.bf(0,1,1,1);function xn(t,e,r,i){Tn(t,0,e+r/2,t.transform.width,r,i)}function wn(t,e,r,i){Tn(t,e-r/2,0,r,t.transform.height,i)}function Tn(t,e,r,i,n,o){const a=t.context,s=a.gl;s.enable(s.SCISSOR_TEST),s.scissor(e*t.pixelRatio,r*t.pixelRatio,i*t.pixelRatio,n*t.pixelRatio),a.clear({color:o}),s.disable(s.SCISSOR_TEST)}function Sn(t,r,i){const n=t.context,o=n.gl,a=t.useProgram("debug"),s=Ve.disabled,l=Ze.disabled,c=t.colorModeForRenderPass(),h="$debug",u=t.style.map.terrain&&t.style.map.terrain.getTerrainData(i);n.activeTexture.set(o.TEXTURE0);const p=r.getTileByID(i.key).latestRawTileData,d=Math.floor((p&&p.byteLength||0)/1024),f=r.getTile(i).tileSize,m=512/Math.min(f,512)*(i.overscaledZ/t.transform.zoom)*.5;let g=i.canonical.toString();i.overscaledZ!==i.canonical.z&&(g+=` => ${i.overscaledZ}`),function(t,e){t.initDebugOverlayCanvas();const r=t.debugOverlayCanvas,i=t.context.gl,n=t.debugOverlayCanvas.getContext("2d");n.clearRect(0,0,r.width,r.height),n.shadowColor="white",n.shadowBlur=2,n.lineWidth=1.5,n.strokeStyle="white",n.textBaseline="top",n.font="bold 36px Open Sans, sans-serif",n.fillText(e,5,5),n.strokeText(e,5,5),t.debugOverlayTexture.update(r),t.debugOverlayTexture.bind(i.LINEAR,i.CLAMP_TO_EDGE)}(t,`${g} ${d}kB`);const _=t.transform.getProjectionData({overscaledTileID:i,applyGlobeMatrix:!0,applyTerrainMatrix:!0});a.draw(n,o.TRIANGLES,s,l,je.alphaBlended,Ne.disabled,Or(e.bf.transparent,m),null,_,h,t.debugBuffer,t.quadTriangleIndexBuffer,t.debugSegments),a.draw(n,o.LINE_STRIP,s,l,c,Ne.disabled,Or(e.bf.red),u,_,h,t.debugBuffer,t.tileBorderIndexBuffer,t.debugSegments)}function Pn(t,e,r,i){const{isRenderingGlobe:n}=i,o=t.context,a=o.gl,s=t.transform,l=t.colorModeForRenderPass(),c=t.getDepthModeFor3D(),h=t.useProgram("terrain");o.bindFramebuffer.set(null),o.viewport.set([0,0,t.width,t.height]);for(const i of r){const r=e.getTerrainMesh(i.tileID),u=t.renderToTexture.getTexture(i),p=e.getTerrainData(i.tileID);o.activeTexture.set(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,u.texture);const d=e.getMeshFrameDelta(s.zoom),f=s.calculateFogMatrix(i.tileID.toUnwrapped()),m=Pr(d,f,t.style.sky,s.pitch,n),g=s.getProjectionData({overscaledTileID:i.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});h.draw(o,a.TRIANGLES,c,Ze.disabled,l,Ne.backCCW,m,p,g,"terrain",r.vertexBuffer,r.indexBuffer,r.segments)}}function Cn(t,r){if(!r.mesh){const i=new e.aL;i.emplaceBack(-1,-1),i.emplaceBack(1,-1),i.emplaceBack(1,1),i.emplaceBack(-1,1);const n=new e.aN;n.emplaceBack(0,1,2),n.emplaceBack(0,2,3),r.mesh=new we(t.createVertexBuffer(i,Te.members),t.createIndexBuffer(n),e.aM.simpleSegment(0,0,i.length,n.length))}return r.mesh}class Mn{constructor(t,r){this.context=new Hi(t),this.transform=r,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:e.ag(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=vt.maxUnderzooming+vt.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new ye}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(const t of this.style._order)this.style._layers[t].resize()}setup(){const t=this.context,r=new e.aL;r.emplaceBack(0,0),r.emplaceBack(e.$,0),r.emplaceBack(0,e.$),r.emplaceBack(e.$,e.$),this.tileExtentBuffer=t.createVertexBuffer(r,Te.members),this.tileExtentSegments=e.aM.simpleSegment(0,0,4,2);const i=new e.aL;i.emplaceBack(0,0),i.emplaceBack(e.$,0),i.emplaceBack(0,e.$),i.emplaceBack(e.$,e.$),this.debugBuffer=t.createVertexBuffer(i,Te.members),this.debugSegments=e.aM.simpleSegment(0,0,4,5);const n=new e.c6;n.emplaceBack(0,0,0,0),n.emplaceBack(e.$,0,e.$,0),n.emplaceBack(0,e.$,0,e.$),n.emplaceBack(e.$,e.$,e.$,e.$),this.rasterBoundsBuffer=t.createVertexBuffer(n,Tr.members),this.rasterBoundsSegments=e.aM.simpleSegment(0,0,4,2);const o=new e.aL;o.emplaceBack(0,0),o.emplaceBack(e.$,0),o.emplaceBack(0,e.$),o.emplaceBack(e.$,e.$),this.rasterBoundsBufferPosOnly=t.createVertexBuffer(o,Te.members),this.rasterBoundsSegmentsPosOnly=e.aM.simpleSegment(0,0,4,5);const a=new e.aL;a.emplaceBack(0,0),a.emplaceBack(1,0),a.emplaceBack(0,1),a.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(a,Te.members),this.viewportSegments=e.aM.simpleSegment(0,0,4,2);const s=new e.c7;s.emplaceBack(0),s.emplaceBack(1),s.emplaceBack(3),s.emplaceBack(2),s.emplaceBack(0),this.tileBorderIndexBuffer=t.createIndexBuffer(s);const l=new e.aN;l.emplaceBack(1,0,2),l.emplaceBack(1,2,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(l);const c=this.context.gl;this.stencilClearMode=new Ze({func:c.ALWAYS,mask:0},0,255,c.ZERO,c.ZERO,c.ZERO),this.tileExtentMesh=new we(this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}clearStencil(){const t=this.context,r=t.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const i=e.L();e.bY(i,0,this.width,this.height,0,0,1),e.N(i,i,[r.drawingBufferWidth,r.drawingBufferHeight,0]);const n={mainMatrix:i,tileMercatorCoords:[0,0,1,1],clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:i};this.useProgram("clippingMask",null,!0).draw(t,r.TRIANGLES,Ve.disabled,this.stencilClearMode,je.disabled,Ne.disabled,null,null,n,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(t,e,r){if(this.currentStencilSource===t.source||!t.isTileClipped()||!e||!e.length)return;this.currentStencilSource=t.source,this.nextStencilID+e.length>256&&this.clearStencil();const i=this.context;i.setColorMode(je.disabled),i.setDepthMode(Ve.disabled);const n={};for(const t of e)n[t.key]=this.nextStencilID++;this._renderTileMasks(n,e,r,!0),this._renderTileMasks(n,e,r,!1),this._tileClippingMaskIDs=n}_renderTileMasks(t,e,r,i){const n=this.context,o=n.gl,a=this.style.projection,s=this.transform,l=this.useProgram("clippingMask");for(const c of e){const e=t[c.key],h=this.style.map.terrain&&this.style.map.terrain.getTerrainData(c),u=a.getMeshFromTileID(this.context,c.canonical,i,!0,"stencil"),p=s.getProjectionData({overscaledTileID:c,applyGlobeMatrix:!r,applyTerrainMatrix:!0});l.draw(n,o.TRIANGLES,Ve.disabled,new Ze({func:o.ALWAYS,mask:0},e,255,o.KEEP,o.KEEP,o.REPLACE),je.disabled,r?Ne.disabled:Ne.backCCW,null,h,p,"$clipping",u.vertexBuffer,u.indexBuffer,u.segments)}}_renderTilesDepthBuffer(){const t=this.context,e=t.gl,r=this.style.projection,i=this.transform,n=this.useProgram("depth"),o=this.getDepthModeFor3D(),a=yt(i,{tileSize:i.tileSize});for(const s of a){const a=this.style.map.terrain&&this.style.map.terrain.getTerrainData(s),l=r.getMeshFromTileID(this.context,s.canonical,!0,!0,"raster"),c=i.getProjectionData({overscaledTileID:s,applyGlobeMatrix:!0,applyTerrainMatrix:!0});n.draw(t,e.TRIANGLES,o,Ze.disabled,je.disabled,Ne.backCCW,null,a,c,"$clipping",l.vertexBuffer,l.indexBuffer,l.segments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const t=this.nextStencilID++,e=this.context.gl;return new Ze({func:e.NOTEQUAL,mask:255},t,255,e.KEEP,e.KEEP,e.REPLACE)}stencilModeForClipping(t){const e=this.context.gl;return new Ze({func:e.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,e.KEEP,e.KEEP,e.REPLACE)}getStencilConfigForOverlapAndUpdateStencilID(t){const e=this.context.gl,r=t.sort((t,e)=>e.overscaledZ-t.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();const t={};for(let r=0;r<n;r++)t[r+i]=new Ze({func:e.GEQUAL,mask:255},r+this.nextStencilID,255,e.KEEP,e.KEEP,e.REPLACE);return this.nextStencilID+=n,[t,r]}return[{[i]:Ze.disabled},r]}stencilConfigForOverlapTwoPass(t){const e=this.context.gl,r=t.sort((t,e)=>e.overscaledZ-t.overscaledZ),i=r[r.length-1].overscaledZ,n=r[0].overscaledZ-i+1;if(this.clearStencil(),n>1){const t={},o={};for(let r=0;r<n;r++)t[r+i]=new Ze({func:e.GREATER,mask:255},n+1+r,255,e.KEEP,e.KEEP,e.REPLACE),o[r+i]=new Ze({func:e.GREATER,mask:255},1+r,255,e.KEEP,e.KEEP,e.REPLACE);return this.nextStencilID=2*n+1,[t,o,r]}return this.nextStencilID=3,[{[i]:new Ze({func:e.GREATER,mask:255},2,255,e.KEEP,e.KEEP,e.REPLACE)},{[i]:new Ze({func:e.GREATER,mask:255},1,255,e.KEEP,e.KEEP,e.REPLACE)},r]}colorModeForRenderPass(){const t=this.context.gl;if(this._showOverdrawInspector){const r=1/8;return new je([t.CONSTANT_COLOR,t.ONE],new e.bf(r,r,r,0),[!0,!0,!0,!0])}return"opaque"===this.renderPass?je.unblended:je.alphaBlended}getDepthModeForSublayer(t,e,r){if(!this.opaquePassEnabledForLayer())return Ve.disabled;const i=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new Ve(r||this.context.gl.LEQUAL,e,[i,i])}getDepthModeFor3D(){return new Ve(this.context.gl.LEQUAL,Ve.ReadWrite,this.depthRangeFor3D)}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(t,r){var i,n;this.style=t,this.options=r,this.lineAtlas=t.lineAtlas,this.imageManager=t.imageManager,this.glyphManager=t.glyphManager,this.symbolFadeChange=t.placement.symbolFadeChange(a.now()),this.imageManager.beginFrame();const o=this.style._order,s=this.style.sourceCaches,l={},c={},h={},u={isRenderingToTexture:!1,isRenderingGlobe:(null===(i=t.projection)||void 0===i?void 0:i.transitionState)>0};for(const t in s){const e=s[t];e.used&&e.prepare(this.context),l[t]=e.getVisibleCoordinates(!1),c[t]=l[t].slice().reverse(),h[t]=e.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let t=0;t<o.length;t++)if(this.style._layers[o[t]].is3D()){this.opaquePassCutoff=t;break}this.maybeDrawDepthAndCoords(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen";for(const t of o){const e=this.style._layers[t];if(!e.hasOffscreenPass()||e.isHidden(this.transform.zoom))continue;const r=c[e.source];("custom"===e.type||r.length)&&this.renderLayer(this,s[e.source],e,r,u)}if(null===(n=this.style.projection)||void 0===n||n.updateGPUdependent({context:this.context,useProgram:t=>this.useProgram(t)}),this.context.viewport.set([0,0,this.width,this.height]),this.context.bindFramebuffer.set(null),this.context.clear({color:r.showOverdrawInspector?e.bf.black:e.bf.transparent,depth:1}),this.clearStencil(),this.style.sky&&function(t,e){const r=t.context,i=r.gl,n=((t,e,r)=>{const i=Math.cos(e.rollInRadians),n=Math.sin(e.rollInRadians),o=ht(e),a=e.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}).projectionTransition;return{u_sky_color:t.properties.get("sky-color"),u_horizon_color:t.properties.get("horizon-color"),u_horizon:[(e.width/2-o*n)*r,(e.height/2+o*i)*r],u_horizon_normal:[-n,i],u_sky_horizon_blend:t.properties.get("sky-horizon-blend")*e.height/2*r,u_sky_blend:a}})(e,t.style.map.transform,t.pixelRatio),o=new Ve(i.LEQUAL,Ve.ReadWrite,[0,1]),a=Ze.disabled,s=t.colorModeForRenderPass(),l=t.useProgram("sky"),c=Cn(r,e);l.draw(r,i.TRIANGLES,o,a,s,Ne.disabled,n,null,void 0,"sky",c.vertexBuffer,c.indexBuffer,c.segments)}(this,this.style.sky),this._showOverdrawInspector=r.showOverdrawInspector,this.depthRangeFor3D=[0,1-(t._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=o.length-1;this.currentLayer>=0;this.currentLayer--){const t=this.style._layers[o[this.currentLayer]],e=s[t.source],r=l[t.source];this._renderTileClippingMasks(t,r,!1),this.renderLayer(this,e,t,r,u)}this.renderPass="translucent";let p=!1;for(this.currentLayer=0;this.currentLayer<o.length;this.currentLayer++){const t=this.style._layers[o[this.currentLayer]],e=s[t.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(t,u))continue;this.opaquePassEnabledForLayer()||p||(p=!0,u.isRenderingGlobe&&!this.style.map.terrain&&this._renderTilesDepthBuffer());const r=("symbol"===t.type?h:c)[t.source];this._renderTileClippingMasks(t,l[t.source],!!this.renderToTexture),this.renderLayer(this,e,t,r,u)}if(u.isRenderingGlobe&&function(t,r,i){const n=t.context,o=n.gl,a=t.useProgram("atmosphere"),s=new Ve(o.LEQUAL,Ve.ReadOnly,[0,1]),l=t.transform,c=function(t,r){const i=t.properties.get("position"),n=[-i.x,-i.y,-i.z],o=e.ag(new Float64Array(16));return"map"===t.properties.get("anchor")&&(e.b6(o,o,r.rollInRadians),e.b7(o,o,-r.pitchInRadians),e.b6(o,o,r.bearingInRadians),e.b7(o,o,r.center.lat*Math.PI/180),e.bz(o,o,-r.center.lng*Math.PI/180)),e.c5(n,n,o),n}(i,t.transform),h=l.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),u=r.properties.get("atmosphere-blend")*h.projectionTransition;if(0===u)return;const p=ir(l.worldSize,l.center.lat),d=l.inverseProjectionMatrix,f=new Float64Array(4);f[3]=1,e.aw(f,f,l.modelViewProjectionMatrix),f[0]/=f[3],f[1]/=f[3],f[2]/=f[3],f[3]=1,e.aw(f,f,d),f[0]/=f[3],f[1]/=f[3],f[2]/=f[3],f[3]=1;const m=((t,e,r,i,n)=>({u_sun_pos:t,u_atmosphere_blend:e,u_globe_position:r,u_globe_radius:i,u_inv_proj_matrix:n}))(c,u,[f[0],f[1],f[2]],p,d),g=Cn(n,r);a.draw(n,o.TRIANGLES,s,Ze.disabled,je.alphaBlended,Ne.disabled,m,null,null,"atmosphere",g.vertexBuffer,g.indexBuffer,g.segments)}(this,this.style.sky,this.style.light),this.options.showTileBoundaries){const t=function(t,e){let r=null;const i=Object.values(t._layers).flatMap(r=>r.source&&!r.isHidden(e)?[t.sourceCaches[r.source]]:[]),n=i.filter(t=>"vector"===t.getSource().type),o=i.filter(t=>"vector"!==t.getSource().type),a=t=>{(!r||r.getSource().maxzoom<t.getSource().maxzoom)&&(r=t)};return n.forEach(t=>a(t)),r||o.forEach(t=>a(t)),r}(this.style,this.transform.zoom);t&&function(t,e,r){for(let i=0;i<r.length;i++)Sn(t,e,r[i])}(this,t,t.getVisibleCoordinates())}this.options.showPadding&&function(t){const e=t.transform.padding;xn(t,t.transform.height-(e.top||0),3,gn),xn(t,e.bottom||0,3,_n),wn(t,e.left||0,3,yn),wn(t,t.transform.width-(e.right||0),3,bn);const r=t.transform.centerPoint;!function(t,e,r,i){Tn(t,e-1,r-10,2,20,i),Tn(t,e-10,r-1,20,2,i)}(t,r.x,t.transform.height-r.y,vn)}(this),this.context.setDefault()}maybeDrawDepthAndCoords(t){if(!this.style||!this.style.map||!this.style.map.terrain)return;const r=this.terrainFacilitator.matrix,i=this.transform.modelViewProjectionMatrix;let n=this.terrainFacilitator.dirty;n||(n=t?!e.c8(r,i):!e.c9(r,i)),n||(n=this.style.map.terrain.sourceCache.anyTilesAfterTime(this.terrainFacilitator.renderTime)),n&&(e.ca(r,i),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(t,r){const i=t.context,n=i.gl,o=t.transform,a=je.unblended,s=new Ve(n.LEQUAL,Ve.ReadWrite,[0,1]),l=r.sourceCache.getRenderableTiles(),c=t.useProgram("terrainDepth");i.bindFramebuffer.set(r.getFramebuffer("depth").framebuffer),i.viewport.set([0,0,t.width/devicePixelRatio,t.height/devicePixelRatio]),i.clear({color:e.bf.transparent,depth:1});for(const t of l){const e=r.getTerrainMesh(t.tileID),l=r.getTerrainData(t.tileID),h=o.getProjectionData({overscaledTileID:t.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0}),u={u_ele_delta:r.getMeshFrameDelta(o.zoom)};c.draw(i,n.TRIANGLES,s,Ze.disabled,a,Ne.backCCW,u,l,h,"terrain",e.vertexBuffer,e.indexBuffer,e.segments)}i.bindFramebuffer.set(null),i.viewport.set([0,0,t.width,t.height])}(this,this.style.map.terrain),function(t,r){const i=t.context,n=i.gl,o=t.transform,a=je.unblended,s=new Ve(n.LEQUAL,Ve.ReadWrite,[0,1]),l=r.getCoordsTexture(),c=r.sourceCache.getRenderableTiles(),h=t.useProgram("terrainCoords");i.bindFramebuffer.set(r.getFramebuffer("coords").framebuffer),i.viewport.set([0,0,t.width/devicePixelRatio,t.height/devicePixelRatio]),i.clear({color:e.bf.transparent,depth:1}),r.coordsIndex=[];for(const t of c){const e=r.getTerrainMesh(t.tileID),c=r.getTerrainData(t.tileID);i.activeTexture.set(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,l.texture);const u={u_terrain_coords_id:(255-r.coordsIndex.length)/255,u_texture:0,u_ele_delta:r.getMeshFrameDelta(o.zoom)},p=o.getProjectionData({overscaledTileID:t.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});h.draw(i,n.TRIANGLES,s,Ze.disabled,a,Ne.backCCW,u,c,p,"terrain",e.vertexBuffer,e.indexBuffer,e.segments),r.coordsIndex.push(t.tileID.key)}i.bindFramebuffer.set(null),i.viewport.set([0,0,t.width,t.height])}(this,this.style.map.terrain))}renderLayer(t,r,i,n,o){i.isHidden(this.transform.zoom)||("background"===i.type||"custom"===i.type||(n||[]).length)&&(this.id=i.id,e.cb(i)?function(t,r,i,n,o,a){if("translucent"!==t.renderPass)return;const{isRenderingToTexture:s}=a,l=Ze.disabled,c=t.colorModeForRenderPass();(i._unevaluatedLayout.hasValue("text-variable-anchor")||i._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(t,r,i,n,o,a,s,l,c){const h=r.transform,u=r.style.map.terrain,p="map"===o,d="map"===a;for(const o of t){const t=n.getTile(o),a=t.getBucket(i);if(!a||!a.text||!a.text.segments.get().length)continue;const f=e.an(a.textSizeData,h.zoom),m=e.aC(t,1,r.transform.zoom),g=Ct(p,r.transform,m),_="none"!==i.layout.get("icon-text-fit")&&a.hasIconData();if(f){const r=Math.pow(2,h.zoom-t.tileID.overscaledZ),i=u?(t,e)=>u.getElevation(o,t,e):null;Qi(a,p,d,c,h,g,r,f,_,e.aD(h,t,s,l),o.toUnwrapped(),i)}}}(n,t,i,r,i.layout.get("text-rotation-alignment"),i.layout.get("text-pitch-alignment"),i.paint.get("text-translate"),i.paint.get("text-translate-anchor"),o),0!==i.paint.get("icon-opacity").constantOr(1)&&en(t,r,i,n,!1,i.paint.get("icon-translate"),i.paint.get("icon-translate-anchor"),i.layout.get("icon-rotation-alignment"),i.layout.get("icon-pitch-alignment"),i.layout.get("icon-keep-upright"),l,c,s),0!==i.paint.get("text-opacity").constantOr(1)&&en(t,r,i,n,!0,i.paint.get("text-translate"),i.paint.get("text-translate-anchor"),i.layout.get("text-rotation-alignment"),i.layout.get("text-pitch-alignment"),i.layout.get("text-keep-upright"),l,c,s),r.map.showCollisionBoxes&&(Xi(t,r,i,n,!0),Xi(t,r,i,n,!1))}(t,r,i,n,this.style.placement.variableOffsets,o):e.cc(i)?function(t,r,i,n,o){if("translucent"!==t.renderPass)return;const{isRenderingToTexture:a}=o,s=i.paint.get("circle-opacity"),l=i.paint.get("circle-stroke-width"),c=i.paint.get("circle-stroke-opacity"),h=!i.layout.get("circle-sort-key").isConstant();if(0===s.constantOr(1)&&(0===l.constantOr(1)||0===c.constantOr(1)))return;const u=t.context,p=u.gl,d=t.transform,f=t.getDepthModeForSublayer(0,Ve.ReadOnly),m=Ze.disabled,g=t.colorModeForRenderPass(),_=[],y=d.getCircleRadiusCorrection();for(let o=0;o<n.length;o++){const s=n[o],l=r.getTile(s),c=l.getBucket(i);if(!c)continue;const u=i.paint.get("circle-translate"),p=i.paint.get("circle-translate-anchor"),f=e.aD(d,l,u,p),m=c.programConfigurations.get(i.id),g=t.useProgram("circle",m),b=c.layoutVertexBuffer,v=c.indexBuffer,x=t.style.map.terrain&&t.style.map.terrain.getTerrainData(s),w={programConfiguration:m,program:g,layoutVertexBuffer:b,indexBuffer:v,uniformValues:Lr(t,l,i,f,y),terrainData:x,projectionData:d.getProjectionData({overscaledTileID:s,applyGlobeMatrix:!a,applyTerrainMatrix:!0})};if(h){const t=c.segments.get();for(const r of t)_.push({segments:new e.aM([r]),sortKey:r.sortKey,state:w})}else _.push({segments:c.segments,sortKey:0,state:w})}h&&_.sort((t,e)=>t.sortKey-e.sortKey);for(const e of _){const{programConfiguration:r,program:n,layoutVertexBuffer:o,indexBuffer:a,uniformValues:s,terrainData:l,projectionData:c}=e.state;n.draw(u,p.TRIANGLES,f,m,g,Ne.backCCW,s,l,c,i.id,o,a,e.segments,i.paint,t.transform.zoom,r)}}(t,r,i,n,o):e.cd(i)?function(t,r,i,n,o){if(0===i.paint.get("heatmap-opacity"))return;const a=t.context,{isRenderingToTexture:s,isRenderingGlobe:l}=o;if(t.style.map.terrain){for(const e of n){const n=r.getTile(e);r.hasRenderableParent(e)||("offscreen"===t.renderPass?nn(t,n,i,e,l):"translucent"===t.renderPass&&on(t,i,e,s,l))}a.viewport.set([0,0,t.width,t.height])}else"offscreen"===t.renderPass?function(t,r,i,n){const o=t.context,a=o.gl,s=t.transform,l=Ze.disabled,c=new je([a.ONE,a.ONE],e.bf.transparent,[!0,!0,!0,!0]);(function(t,r,i){const n=t.gl;t.activeTexture.set(n.TEXTURE1),t.viewport.set([0,0,r.width/4,r.height/4]);let o=i.heatmapFbos.get(e.c2);o?(n.bindTexture(n.TEXTURE_2D,o.colorAttachment.get()),t.bindFramebuffer.set(o.framebuffer)):(o=an(t,r.width/4,r.height/4),i.heatmapFbos.set(e.c2,o))})(o,t,i),o.clear({color:e.bf.transparent});for(let e=0;e<n.length;e++){const h=n[e];if(r.hasRenderableParent(h))continue;const u=r.getTile(h),p=u.getBucket(i);if(!p)continue;const d=p.programConfigurations.get(i.id),f=t.useProgram("heatmap",d),m=s.getProjectionData({overscaledTileID:h,applyGlobeMatrix:!0,applyTerrainMatrix:!1}),g=s.getCircleRadiusCorrection();f.draw(o,a.TRIANGLES,Ve.disabled,l,c,Ne.backCCW,jr(u,s.zoom,i.paint.get("heatmap-intensity"),g),null,m,i.id,p.layoutVertexBuffer,p.indexBuffer,p.segments,i.paint,s.zoom,d)}o.viewport.set([0,0,t.width,t.height])}(t,r,i,n):"translucent"===t.renderPass&&function(t,r){const i=t.context,n=i.gl;i.setColorMode(t.colorModeForRenderPass());const o=r.heatmapFbos.get(e.c2);o&&(i.activeTexture.set(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,o.colorAttachment.get()),i.activeTexture.set(n.TEXTURE1),sn(i,r).bind(n.LINEAR,n.CLAMP_TO_EDGE),t.useProgram("heatmapTexture").draw(i,n.TRIANGLES,Ve.disabled,Ze.disabled,t.colorModeForRenderPass(),Ne.disabled,Ur(t,r,0,1),null,null,r.id,t.viewportBuffer,t.quadTriangleIndexBuffer,t.viewportSegments,r.paint,t.transform.zoom))}(t,i)}(t,r,i,n,o):e.ce(i)?function(t,r,i,n,o){if("translucent"!==t.renderPass)return;const{isRenderingToTexture:a}=o,s=i.paint.get("line-opacity"),l=i.paint.get("line-width");if(0===s.constantOr(1)||0===l.constantOr(1))return;const c=t.getDepthModeForSublayer(0,Ve.ReadOnly),h=t.colorModeForRenderPass(),u=i.paint.get("line-dasharray"),p=i.paint.get("line-pattern"),d=p.constantOr(1),f=i.paint.get("line-gradient"),m=i.getCrossfadeParameters(),g=d?"linePattern":u?"lineSDF":f?"lineGradient":"line",_=t.context,y=_.gl,b=t.transform;let v=!0;for(const o of n){const n=r.getTile(o);if(d&&!n.patternsLoaded())continue;const s=n.getBucket(i);if(!s)continue;const l=s.programConfigurations.get(i.id),x=t.context.program.get(),w=t.useProgram(g,l),T=v||w.program!==x,S=t.style.map.terrain&&t.style.map.terrain.getTerrainData(o),P=p.constantOr(null);if(P&&n.imageAtlas){const t=n.imageAtlas,e=t.patternPositions[P.to.toString()],r=t.patternPositions[P.from.toString()];e&&r&&l.setConstantPatternPositions(e,r)}const C=b.getProjectionData({overscaledTileID:o,applyGlobeMatrix:!a,applyTerrainMatrix:!0}),M=b.getPixelScale(),A=d?Hr(t,n,i,M,m):u?Wr(t,n,i,M,u,m):f?qr(t,n,i,M,s.lineClipsArray.length):Gr(t,n,i,M);if(d)_.activeTexture.set(y.TEXTURE0),n.imageAtlasTexture.bind(y.LINEAR,y.CLAMP_TO_EDGE),l.updatePaintBuffers(m);else if(u&&(T||t.lineAtlas.dirty))_.activeTexture.set(y.TEXTURE0),t.lineAtlas.bind(_);else if(f){const n=s.gradients[i.id];let a=n.texture;if(i.gradientVersion!==n.version){let l=256;if(i.stepInterpolant){const i=r.getSource().maxzoom,n=o.canonical.z===i?Math.ceil(1<<t.transform.maxZoom-o.canonical.z):1;l=e.ah(e.c3(s.maxLineLength/e.$*1024*n),256,_.maxTextureSize)}n.gradient=e.c4({expression:i.gradientExpression(),evaluationKey:"lineProgress",resolution:l,image:n.gradient||void 0,clips:s.lineClipsArray}),n.texture?n.texture.update(n.gradient):n.texture=new e.T(_,n.gradient,y.RGBA),n.version=i.gradientVersion,a=n.texture}_.activeTexture.set(y.TEXTURE0),a.bind(i.stepInterpolant?y.NEAREST:y.LINEAR,y.CLAMP_TO_EDGE)}const I=t.stencilModeForClipping(o);w.draw(_,y.TRIANGLES,c,I,h,Ne.disabled,A,S,C,i.id,s.layoutVertexBuffer,s.indexBuffer,s.segments,i.paint,t.transform.zoom,l,s.layoutVertexBuffer2),v=!1}}(t,r,i,n,o):e.cf(i)?function(t,r,i,n,o){const a=i.paint.get("fill-color"),s=i.paint.get("fill-opacity");if(0===s.constantOr(1))return;const{isRenderingToTexture:l}=o,c=t.colorModeForRenderPass(),h=i.paint.get("fill-pattern"),u=t.opaquePassEnabledForLayer()&&!h.constantOr(1)&&1===a.constantOr(e.bf.transparent).a&&1===s.constantOr(0)?"opaque":"translucent";if(t.renderPass===u){const e=t.getDepthModeForSublayer(1,"opaque"===t.renderPass?Ve.ReadWrite:Ve.ReadOnly);cn(t,r,i,n,e,c,!1,l)}if("translucent"===t.renderPass&&i.paint.get("fill-antialias")){const e=t.getDepthModeForSublayer(i.getPaintProperty("fill-outline-color")?2:0,Ve.ReadOnly);cn(t,r,i,n,e,c,!0,l)}}(t,r,i,n,o):e.cg(i)?function(t,e,r,i,n){const o=r.paint.get("fill-extrusion-opacity");if(0===o)return;const{isRenderingToTexture:a}=n;if("translucent"===t.renderPass){const n=new Ve(t.context.gl.LEQUAL,Ve.ReadWrite,t.depthRangeFor3D);if(1!==o||r.paint.get("fill-extrusion-pattern").constantOr(1))hn(t,e,r,i,n,Ze.disabled,je.disabled,a),hn(t,e,r,i,n,t.stencilModeFor3D(),t.colorModeForRenderPass(),a);else{const o=t.colorModeForRenderPass();hn(t,e,r,i,n,Ze.disabled,o,a)}}}(t,r,i,n,o):e.ch(i)?function(t,r,i,n,o){if("offscreen"!==t.renderPass&&"translucent"!==t.renderPass)return;const{isRenderingToTexture:a}=o,s=t.context,l=t.style.projection.useSubdivision,c=t.getDepthModeForSublayer(0,Ve.ReadOnly),h=t.colorModeForRenderPass();if("offscreen"===t.renderPass)!function(t,r,i,n,o,a,s){const l=t.context,c=l.gl;for(const h of i){const i=r.getTile(h),u=i.dem;if(!u||!u.data)continue;if(!i.needsHillshadePrepare)continue;const p=u.dim,d=u.stride,f=u.getPixels();if(l.activeTexture.set(c.TEXTURE1),l.pixelStoreUnpackPremultiplyAlpha.set(!1),i.demTexture=i.demTexture||t.getTileTexture(d),i.demTexture){const t=i.demTexture;t.update(f,{premultiply:!1}),t.bind(c.NEAREST,c.CLAMP_TO_EDGE)}else i.demTexture=new e.T(l,f,c.RGBA,{premultiply:!1}),i.demTexture.bind(c.NEAREST,c.CLAMP_TO_EDGE);l.activeTexture.set(c.TEXTURE0);let m=i.fbo;if(!m){const t=new e.T(l,{width:p,height:p,data:null},c.RGBA);t.bind(c.LINEAR,c.CLAMP_TO_EDGE),m=i.fbo=l.createFramebuffer(p,p,!0,!1),m.colorAttachment.set(t.texture)}l.bindFramebuffer.set(m.framebuffer),l.viewport.set([0,0,p,p]),t.useProgram("hillshadePrepare").draw(l,c.TRIANGLES,o,a,s,Ne.disabled,Vr(i.tileID,u),null,null,n.id,t.rasterBoundsBuffer,t.quadTriangleIndexBuffer,t.rasterBoundsSegments),i.needsHillshadePrepare=!1}}(t,r,n,i,c,Ze.disabled,h),s.viewport.set([0,0,t.width,t.height]);else if("translucent"===t.renderPass)if(l){const[e,o,s]=t.stencilConfigForOverlapTwoPass(n);un(t,r,i,s,e,c,h,!1,a),un(t,r,i,s,o,c,h,!0,a)}else{const[e,o]=t.getStencilConfigForOverlapAndUpdateStencilID(n);un(t,r,i,o,e,c,h,!1,a)}}(t,r,i,n,o):e.ci(i)?function(t,e,r,i,n){if("translucent"!==t.renderPass)return;if(!i.length)return;const{isRenderingToTexture:o}=n,a=t.style.projection.useSubdivision,s=t.getDepthModeForSublayer(0,Ve.ReadOnly),l=t.colorModeForRenderPass();if(a){const[n,a,c]=t.stencilConfigForOverlapTwoPass(i);pn(t,e,r,c,n,s,l,!1,o),pn(t,e,r,c,a,s,l,!0,o)}else{const[n,a]=t.getStencilConfigForOverlapAndUpdateStencilID(i);pn(t,e,r,a,n,s,l,!1,o)}}(t,r,i,n,o):e.cj(i)?function(t,e,r,i,n){if("translucent"!==t.renderPass)return;if(0===r.paint.get("raster-opacity"))return;if(!i.length)return;const{isRenderingToTexture:o}=n,a=e.getSource(),s=t.style.projection.useSubdivision;if(a instanceof X)fn(t,e,r,i,null,!1,!1,a.tileCoords,a.flippedWindingOrder,o);else if(s){const[n,a,s]=t.stencilConfigForOverlapTwoPass(i);fn(t,e,r,s,n,!1,!0,dn,!1,o),fn(t,e,r,s,a,!0,!0,dn,!1,o)}else{const[n,a]=t.getStencilConfigForOverlapAndUpdateStencilID(i);fn(t,e,r,a,n,!1,!0,dn,!1,o)}}(t,r,i,n,o):e.ck(i)?function(t,e,r,i,n){const o=r.paint.get("background-color"),a=r.paint.get("background-opacity");if(0===a)return;const{isRenderingToTexture:s}=n,l=t.context,c=l.gl,h=t.style.projection,u=t.transform,p=u.tileSize,d=r.paint.get("background-pattern");if(t.isPatternMissing(d))return;const f=!d&&1===o.a&&1===a&&t.opaquePassEnabledForLayer()?"opaque":"translucent";if(t.renderPass!==f)return;const m=Ze.disabled,g=t.getDepthModeForSublayer(0,"opaque"===f?Ve.ReadWrite:Ve.ReadOnly),_=t.colorModeForRenderPass(),y=t.useProgram(d?"backgroundPattern":"background"),b=i||yt(u,{tileSize:p,terrain:t.style.map.terrain});d&&(l.activeTexture.set(c.TEXTURE0),t.imageManager.bind(t.context));const v=r.getCrossfadeParameters();for(const e of b){const i=u.getProjectionData({overscaledTileID:e,applyGlobeMatrix:!s,applyTerrainMatrix:!0}),n=d?ii(a,t,d,{tileID:e,tileSize:p},v):ri(a,o),f=t.style.map.terrain&&t.style.map.terrain.getTerrainData(e),b=h.getMeshFromTileID(l,e.canonical,!1,!0,"raster");y.draw(l,c.TRIANGLES,g,m,_,Ne.backCCW,n,f,i,r.id,b.vertexBuffer,b.indexBuffer,b.segments)}}(t,0,i,n,o):e.cl(i)&&function(t,e,r,i){const{isRenderingGlobe:n}=i,o=t.context,a=r.implementation,s=t.style.projection,l=t.transform,c=l.getProjectionDataForCustomLayer(n),h={farZ:l.farZ,nearZ:l.nearZ,fov:l.fov*Math.PI/180,modelViewProjectionMatrix:l.modelViewProjectionMatrix,projectionMatrix:l.projectionMatrix,shaderData:{variantName:s.shaderVariantName,vertexShaderPrelude:`const float PI = 3.141592653589793;\nuniform mat4 u_projection_matrix;\n${s.shaderPreludeCode.vertexSource}`,define:s.shaderDefine},defaultProjectionData:c},u=a.renderingMode?a.renderingMode:"2d";if("offscreen"===t.renderPass){const e=a.prerender;e&&(t.setCustomLayerDefaults(),o.setColorMode(t.colorModeForRenderPass()),e.call(a,o.gl,h),o.setDirty(),t.setBaseState())}else if("translucent"===t.renderPass){t.setCustomLayerDefaults(),o.setColorMode(t.colorModeForRenderPass()),o.setStencilMode(Ze.disabled);const e="3d"===u?t.getDepthModeFor3D():t.getDepthModeForSublayer(0,Ve.ReadOnly);o.setDepthMode(e),a.render(o.gl,h),o.setDirty(),t.setBaseState(),o.bindFramebuffer.set(null)}}(t,0,i,o))}saveTileTexture(t){const e=this._tileTextures[t.size[0]];e?e.push(t):this._tileTextures[t.size[0]]=[t]}getTileTexture(t){const 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;const e=this.imageManager.getPattern(t.from.toString()),r=this.imageManager.getPattern(t.to.toString());return!e||!r}useProgram(t,e,r=!1,i=[]){this.cache=this.cache||{};const n=!!this.style.map.terrain,o=this.style.projection,a=r?ve.projectionMercator:o.shaderPreludeCode,s=r?Se:o.shaderDefine,l=t+(e?e.cacheKey:"")+`/${r?Pe:o.shaderVariantName}`+(this._showOverdrawInspector?"/overdraw":"")+(n?"/terrain":"")+(i?`/${i.join("/")}`:"");return this.cache[l]||(this.cache[l]=new Ar(this.context,ve[t],e,oi[t],this._showOverdrawInspector,n,a,s,i)),this.cache[l]}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(){const 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(){null==this.debugOverlayCanvas&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new e.T(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:t,drawingBufferHeight:e}=this.context.gl;return this.width!==t||this.height!==e}}function An(t,e){let r,i=!1,n=null,o=null;const a=()=>{n=null,i&&(t.apply(o,r),n=setTimeout(a,e),i=!1)};return(...t)=>(i=!0,o=this,r=t,n||a(),n)}class In{constructor(t){this._getCurrentHash=()=>{const t=window.location.hash.replace("#","");if(this._hashName){let e;return t.split("&").map(t=>t.split("=")).forEach(t=>{t[0]===this._hashName&&(e=t)}),(e&&e[1]||"").split("/")}return t.split("/")},this._onHashChange=()=>{const t=this._getCurrentHash();if(!this._isValidHash(t))return!1;const 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},this._updateHashUnthrottled=()=>{const t=window.location.href.replace(/(#.*)?$/,this.getHashString());window.history.replaceState(window.history.state,null,t)},this._removeHash=()=>{const t=this._getCurrentHash();if(0===t.length)return;const e=t.join("/");let r=e;r.split("&").length>0&&(r=r.split("&")[0]),this._hashName&&(r=`${this._hashName}=${e}`);let i=window.location.hash.replace(r,"");i.startsWith("#&")?i=i.slice(0,1)+i.slice(2):"#"===i&&(i="");let n=window.location.href.replace(/(#.+)?$/,i);n=n.replace("&&","&"),window.history.replaceState(window.history.state,null,n)},this._updateHash=An(this._updateHashUnthrottled,300),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()),this._removeHash(),delete this._map,this}getHashString(t){const e=this._map.getCenter(),r=Math.round(100*this._map.getZoom())/100,i=Math.ceil((r*Math.LN2+Math.log(512/360/.5))/Math.LN10),n=Math.pow(10,i),o=Math.round(e.lng*n)/n,a=Math.round(e.lat*n)/n,s=this._map.getBearing(),l=this._map.getPitch();let c="";if(c+=t?`/${o}/${a}/${r}`:`${r}/${a}/${o}`,(s||l)&&(c+="/"+Math.round(10*s)/10),l&&(c+=`/${Math.round(l)}`),this._hashName){const t=this._hashName;let e=!1;const r=window.location.hash.slice(1).split("&").map(r=>{const i=r.split("=")[0];return i===t?(e=!0,`${i}=${c}`):r}).filter(t=>t);return e||r.push(`${t}=${c}`),`#${r.join("&")}`}return`#${c}`}_isValidHash(t){if(t.length<3||t.some(isNaN))return!1;try{new e.S(+t[2],+t[1])}catch(t){return!1}const r=+t[0],i=+(t[3]||0),n=+(t[4]||0);return r>=this._map.getMinZoom()&&r<=this._map.getMaxZoom()&&i>=-180&&i<=180&&n>=this._map.getMinPitch()&&n<=this._map.getMaxPitch()}}const En={linearity:.3,easing:e.cm(0,0,.3,1)},kn=e.e({deceleration:2500,maxSpeed:1400},En),zn=e.e({deceleration:20,maxSpeed:1400},En),Rn=e.e({deceleration:1e3,maxSpeed:360},En),Dn=e.e({deceleration:1e3,maxSpeed:90},En),Ln=e.e({deceleration:1e3,maxSpeed:360},En);class Fn{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:a.now(),settings:t})}_drainInertiaBuffer(){const t=this._inertiaBuffer,e=a.now();for(;t.length>0&&e-t[0].time>160;)t.shift()}_onMoveEnd(t){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const r={zoom:0,bearing:0,pitch:0,roll:0,pan:new e.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:t}of this._inertiaBuffer)r.zoom+=t.zoomDelta||0,r.bearing+=t.bearingDelta||0,r.pitch+=t.pitchDelta||0,r.roll+=t.rollDelta||0,t.panDelta&&r.pan._add(t.panDelta),t.around&&(r.around=t.around),t.pinchAround&&(r.pinchAround=t.pinchAround);const i=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,n={};if(r.pan.mag()){const o=On(r.pan.mag(),i,e.e({},kn,t||{})),a=r.pan.mult(o.amount/r.pan.mag()),s=this._map.cameraHelper.handlePanInertia(a,this._map.transform);n.center=s.easingCenter,n.offset=s.easingOffset,Bn(n,o)}if(r.zoom){const t=On(r.zoom,i,zn);n.zoom=this._map.transform.zoom+t.amount,Bn(n,t)}if(r.bearing){const t=On(r.bearing,i,Rn);n.bearing=this._map.transform.bearing+e.ah(t.amount,-179,179),Bn(n,t)}if(r.pitch){const t=On(r.pitch,i,Dn);n.pitch=this._map.transform.pitch+t.amount,Bn(n,t)}if(r.roll){const t=On(r.roll,i,Ln);n.roll=this._map.transform.roll+e.ah(t.amount,-179,179),Bn(n,t)}if(n.zoom||n.bearing){const t=void 0===r.pinchAround?r.around:r.pinchAround;n.around=t?this._map.unproject(t):this._map.getCenter()}return this.clear(),e.e(n,{noMoveStart:!0})}}function Bn(t,e){(!t.duration||t.duration<e.duration)&&(t.duration=e.duration,t.easing=e.easing)}function On(t,r,i){const{maxSpeed:n,linearity:o,deceleration:a}=i,s=e.ah(t*o/(r/1e3),-n,n),l=Math.abs(s)/(a*o);return{easing:i.easing,duration:1e3*l,amount:s*(l/2)}}class jn extends e.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,r,i,n={}){i=i instanceof MouseEvent?i:new MouseEvent(t,i);const o=s.mousePos(r.getCanvas(),i),a=r.unproject(o);super(t,e.e({point:o,lngLat:a,originalEvent:i},n)),this._defaultPrevented=!1,this.target=r}}class Un extends e.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,r,i){const n="touchend"===t?i.changedTouches:i.touches,o=s.touchPos(r.getCanvasContainer(),n),a=o.map(t=>r.unproject(t)),l=o.reduce((t,e,r,i)=>t.add(e.div(i.length)),new e.P(0,0));super(t,{points:o,point:l,lngLats:a,lngLat:r.unproject(l),originalEvent:i}),this._defaultPrevented=!1}}class Nn extends e.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,e,r){super(t,{originalEvent:r}),this._defaultPrevented=!1}}class Vn{constructor(t,e){this._map=t,this._clickTolerance=e.clickTolerance}reset(){delete this._mousedownPos}wheel(t){return this._firePreventable(new Nn(t.type,this._map,t))}mousedown(t,e){return this._mousedownPos=e,this._firePreventable(new jn(t.type,this._map,t))}mouseup(t){this._map.fire(new jn(t.type,this._map,t))}click(t,e){this._mousedownPos&&this._mousedownPos.dist(e)>=this._clickTolerance||this._map.fire(new jn(t.type,this._map,t))}dblclick(t){return this._firePreventable(new jn(t.type,this._map,t))}mouseover(t){this._map.fire(new jn(t.type,this._map,t))}mouseout(t){this._map.fire(new jn(t.type,this._map,t))}touchstart(t){return this._firePreventable(new Un(t.type,this._map,t))}touchmove(t){this._map.fire(new Un(t.type,this._map,t))}touchend(t){this._map.fire(new Un(t.type,this._map,t))}touchcancel(t){this._map.fire(new Un(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class $n{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(t){this._map.fire(new jn(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new jn("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._ignoreContextMenu||this._map.fire(new jn(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Zn{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.screenPointToLocation(e.P.convert(t),this._map.terrain)}}class Gn{constructor(t,e){this._map=t,this._tr=new Zn(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&&0===t.button&&(s.disableDrag(),this._startPos=this._lastPos=e,this._active=!0)}mousemoveWindow(t,e){if(!this._active)return;const r=e;if(this._lastPos.equals(r)||!this._box&&r.dist(this._startPos)<this._clickTolerance)return;const i=this._startPos;this._lastPos=r,this._box||(this._box=s.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",t));const n=Math.min(i.x,r.x),o=Math.max(i.x,r.x),a=Math.min(i.y,r.y),l=Math.max(i.y,r.y);s.setTransform(this._box,`translate(${n}px,${a}px)`),this._box.style.width=o-n+"px",this._box.style.height=l-a+"px"}mouseupWindow(t,r){if(!this._active)return;if(0!==t.button)return;const i=this._startPos,n=r;if(this.reset(),s.suppressClick(),i.x!==n.x||i.y!==n.y)return this._map.fire(new e.l("boxzoomend",{originalEvent:t})),{cameraAnimation:t=>t.fitScreenCoordinates(i,n,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",t)}keydown(t){this._active&&27===t.keyCode&&(this.reset(),this._fireEvent("boxzoomcancel",t))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(s.remove(this._box),this._box=null),s.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(t,r){return this._map.fire(new e.l(t,{originalEvent:r}))}}function qn(t,e){if(t.length!==e.length)throw new Error(`The number of touches and points are not equal - touches ${t.length}, points ${e.length}`);const r={};for(let i=0;i<t.length;i++)r[t[i].identifier]=e[i];return r}class Hn{constructor(t){this.reset(),this.numTouches=t.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(t,r,i){(this.centroid||i.length>this.numTouches)&&(this.aborted=!0),this.aborted||(void 0===this.startTime&&(this.startTime=t.timeStamp),i.length===this.numTouches&&(this.centroid=function(t){const r=new e.P(0,0);for(const e of t)r._add(e);return r.div(t.length)}(r),this.touches=qn(i,r)))}touchmove(t,e,r){if(this.aborted||!this.centroid)return;const i=qn(r,e);for(const t in this.touches){const e=i[t];(!e||e.dist(this.touches[t])>30)&&(this.aborted=!0)}}touchend(t,e,r){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),0===r.length){const t=!this.aborted&&this.centroid;if(this.reset(),t)return t}}}class Wn{constructor(t){this.singleTap=new Hn(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){const i=this.singleTap.touchend(t,e,r);if(i){const e=t.timeStamp-this.lastTime<500,r=!this.lastTap||this.lastTap.dist(i)<30;if(e&&r||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=i,this.count===this.numTaps)return this.reset(),i}}}class Xn{constructor(t){this._tr=new Zn(t),this._zoomIn=new Wn({numTouches:1,numTaps:2}),this._zoomOut=new Wn({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){const i=this._zoomIn.touchend(t,e,r),n=this._zoomOut.touchend(t,e,r),o=this._tr;return i?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:e=>e.easeTo({duration:300,zoom:o.zoom+1,around:o.unproject(i)},{originalEvent:t})}):n?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:e=>e.easeTo({duration:300,zoom:o.zoom-1,around:o.unproject(n)},{originalEvent:t})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Kn{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){const e=this._moveFunction(...t);if(e.bearingDelta||e.pitchDelta||e.rollDelta||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=Array.isArray(e)?e[0]:e,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(t,e){if(!this.isEnabled())return;const r=this._lastPoint;if(!r)return;if(t.preventDefault(),!this._moveStateManager.isValidMoveEvent(t))return void this.reset(t);const i=Array.isArray(e)?e[0]:e;return!this._moved&&i.dist(r)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=i,this._move(r,i))}dragEnd(t){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(t)&&(this._moved&&s.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}}const Yn=0,Jn=2,Qn={[Yn]:1,[Jn]:2};class to{constructor(t){this._correctEvent=t.checkCorrectEvent}startMove(t){const e=s.mouseButton(t);this._eventButton=e}endMove(t){delete this._eventButton}isValidStartEvent(t){return this._correctEvent(t)}isValidMoveEvent(t){return!function(t,e){const r=Qn[e];return void 0===t.buttons||(t.buttons&r)!==r}(t,this._eventButton)}isValidEndEvent(t){return s.mouseButton(t)===this._eventButton}}class eo{constructor(){this._firstTouch=void 0}_isOneFingerTouch(t){return 1===t.targetTouches.length}_isSameTouchEvent(t){return t.targetTouches[0].identifier===this._firstTouch}startMove(t){this._firstTouch=t.targetTouches[0].identifier}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)}}class ro{constructor(t=new to({checkCorrectEvent:()=>!0}),e=new eo){this.mouseMoveStateManager=t,this.oneFingerTouchMoveStateManager=e}_executeRelevantHandler(t,e,r){return t instanceof MouseEvent?e(t):"undefined"!=typeof TouchEvent&&t instanceof TouchEvent?r(t):void 0}startMove(t){this._executeRelevantHandler(t,t=>this.mouseMoveStateManager.startMove(t),t=>this.oneFingerTouchMoveStateManager.startMove(t))}endMove(t){this._executeRelevantHandler(t,t=>this.mouseMoveStateManager.endMove(t),t=>this.oneFingerTouchMoveStateManager.endMove(t))}isValidStartEvent(t){return this._executeRelevantHandler(t,t=>this.mouseMoveStateManager.isValidStartEvent(t),t=>this.oneFingerTouchMoveStateManager.isValidStartEvent(t))}isValidMoveEvent(t){return this._executeRelevantHandler(t,t=>this.mouseMoveStateManager.isValidMoveEvent(t),t=>this.oneFingerTouchMoveStateManager.isValidMoveEvent(t))}isValidEndEvent(t){return this._executeRelevantHandler(t,t=>this.mouseMoveStateManager.isValidEndEvent(t),t=>this.oneFingerTouchMoveStateManager.isValidEndEvent(t))}}const io=t=>{t.mousedown=t.dragStart,t.mousemoveWindow=t.dragMove,t.mouseup=t.dragEnd,t.contextmenu=t=>{t.preventDefault()}};class no{constructor(t,e){this._clickTolerance=t.clickTolerance||1,this._map=e,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new e.P(0,0)}_shouldBePrevented(t){return t<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(t,e,r){return this._calculateTransform(t,e,r)}touchmove(t,e,r){if(this._active){if(!this._shouldBePrevented(r.length))return t.preventDefault(),this._calculateTransform(t,e,r);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",t)}}touchend(t,e,r){this._calculateTransform(t,e,r),this._active&&this._shouldBePrevented(r.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(t,r,i){i.length>0&&(this._active=!0);const n=qn(i,r),o=new e.P(0,0),a=new e.P(0,0);let s=0;for(const t in n){const e=n[t],r=this._touches[t];r&&(o._add(e),a._add(e.sub(r)),s++,n[t]=e)}if(this._touches=n,this._shouldBePrevented(s)||!a.mag())return;const l=a.div(s);return this._sum._add(l),this._sum.mag()<this._clickTolerance?void 0:{around:o.div(s),panDelta:l}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class oo{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();const[i,n]=this._firstTwoTouches,o=ao(r,e,i),a=ao(r,e,n);if(!o||!a)return;const s=this._aroundCenter?null:o.add(a).div(2);return this._move([o,a],s,t)}touchend(t,e,r){if(!this._firstTwoTouches)return;const[i,n]=this._firstTwoTouches,o=ao(r,e,i),a=ao(r,e,n);o&&a||(this._active&&s.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(t){this._enabled=!0,this._aroundCenter=!!t&&"center"===t.around}disable(){this._enabled=!1,this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}}function ao(t,e,r){for(let i=0;i<t.length;i++)if(t[i].identifier===r)return e[i]}function so(t,e){return Math.log(t/e)/Math.LN2}class lo extends oo{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(t){this._startDistance=this._distance=t[0].dist(t[1])}_move(t,e){const r=this._distance;if(this._distance=t[0].dist(t[1]),this._active||!(Math.abs(so(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:so(this._distance,r),pinchAround:e}}}function co(t,e){return 180*t.angleWith(e)/Math.PI}class ho extends oo{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(t){this._startVector=this._vector=t[0].sub(t[1]),this._minDiameter=t[0].dist(t[1])}_move(t,e,r){const i=this._vector;if(this._vector=t[0].sub(t[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:co(this._vector,i),pinchAround:e}}_isBelowThreshold(t){this._minDiameter=Math.min(this._minDiameter,t.mag());const e=25/(Math.PI*this._minDiameter)*360,r=co(t,this._startVector);return Math.abs(r)<e}}function uo(t){return Math.abs(t.y)>Math.abs(t.x)}class po extends oo{constructor(t){super(),this._currentTouchCount=0,this._map=t}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(t,e,r){super.touchstart(t,e,r),this._currentTouchCount=r.length}_start(t){this._lastPoints=t,uo(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,e,r){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const i=t[0].sub(this._lastPoints[0]),n=t[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(i,n,r.timeStamp),this._valid?(this._lastPoints=t,this._active=!0,{pitchDelta:(i.y+n.y)/2*-.5}):void 0}gestureBeginsVertically(t,e,r){if(void 0!==this._valid)return this._valid;const i=t.mag()>=2,n=e.mag()>=2;if(!i&&!n)return;if(!i||!n)return void 0===this._firstMove&&(this._firstMove=r),r-this._firstMove<100&&void 0;const o=t.y>0==e.y>0;return uo(t)&&uo(e)&&o}}const fo={panStep:100,bearingStep:15,pitchStep:10};class mo{constructor(t){this._tr=new Zn(t);const e=fo;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,o=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(),o=-1);break;case 40:t.shiftKey?i=-1:(t.preventDefault(),o=1);break;default:return}return this._rotationDisabled&&(r=0,i=0),{cameraAnimation:a=>{const s=this._tr;a.easeTo({duration:300,easeId:"keyboardHandler",easing:go,zoom:e?Math.round(s.zoom)+e*(t.shiftKey?2:1):s.zoom,bearing:s.bearing+r*this._bearingStep,pitch:s.pitch+i*this._pitchStep,offset:[-n*this._panStep,-o*this._panStep],center:s.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}}function go(t){return t*(2-t)}const _o=4.000244140625,yo=1/450;class bo{constructor(t,e){this._onTimeout=t=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(t)},this._map=t,this._tr=new Zn(t),this._triggerRenderFrame=e,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=yo}setZoomRate(t){this._defaultZoomRate=t}setWheelZoomRate(t){this._wheelZoomRate=t}isEnabled(){return!!this._enabled}isActive(){return!!this._active||void 0!==this._finishTimeout}isZooming(){return!!this._zooming}enable(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!t&&"center"===t.around)}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(t){return!!this._map.cooperativeGestures.isEnabled()&&!(t.ctrlKey||this._map.cooperativeGestures.isBypassed(t))}wheel(t){if(!this.isEnabled())return;if(this._shouldBePrevented(t))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",t);let e=t.deltaMode===WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY;const r=a.now(),i=r-(this._lastWheelEventTime||0);this._lastWheelEventTime=r,0!==e&&e%_o==0?this._type="wheel":0!==e&&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/=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);const r=s.mousePos(this._map.getCanvas(),t),i=this._tr;this._aroundPoint=this._aroundCenter?i.transform.locationToScreenPoint(e.S.convert(i.center)):r,this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId)return;if(this._frameId=null,!this.isActive())return;const t=this._tr.transform;if("number"==typeof this._lastExpectedZoom){const e=t.zoom-this._lastExpectedZoom;"number"==typeof this._startZoom&&(this._startZoom+=e),"number"==typeof this._targetZoom&&(this._targetZoom+=e)}if(0!==this._delta){const r="wheel"===this._type&&Math.abs(this._delta)>_o?this._wheelZoomRate:this._defaultZoomRate;let i=2/(1+Math.exp(-Math.abs(this._delta*r)));this._delta<0&&0!==i&&(i=1/i);const n="number"!=typeof this._targetZoom?t.scale:e.af(this._targetZoom);this._targetZoom=t.getConstrained(t.getCameraLngLat(),e.ak(n*i)).zoom,"wheel"===this._type&&(this._startZoom=t.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const r="number"!=typeof this._targetZoom?t.zoom:this._targetZoom,i=this._startZoom,n=this._easing;let o,s=!1;if("wheel"===this._type&&i&&n){const t=a.now()-this._lastWheelEventTime,l=Math.min((t+5)/200,1),c=n(l);o=e.C.number(i,r,c),l<1?this._frameId||(this._frameId=!0):s=!0}else o=r,s=!0;return this._active=!0,s&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._lastExpectedZoom,delete this._finishTimeout},200)),this._lastExpectedZoom=o,{noInertia:!0,needsRenderFrame:!s,zoomDelta:o-t.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let r=e.co;if(this._prevEase){const t=this._prevEase,i=(a.now()-t.start)/t.duration,n=t.easing(i+.01)-t.easing(i),o=.27/Math.sqrt(n*n+1e-4)*.01,s=Math.sqrt(.0729-o*o);r=e.cm(o,s,.25,1)}return this._prevEase={start:a.now(),duration:t,easing:r},r}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,delete this._lastExpectedZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class vo{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()}}class xo{constructor(t){this._tr=new Zn(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}}class wo{constructor(){this._tap=new Wn({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){const i=e[0],n=t.timeStamp-this._tapTime<500,o=this._tapPoint.dist(i)<30;n&&o?r.length>0&&(this._swipePoint=i,this._swipeTouch=r[0].identifier):this.reset()}else this._tap.touchstart(t,e,r)}touchmove(t,e,r){if(this._tapTime){if(this._swipePoint){if(r[0].identifier!==this._swipeTouch)return;const i=e[0],n=i.y-this._swipePoint.y;return this._swipePoint=i,t.preventDefault(),this._active=!0,{zoomDelta:n/128}}}else this._tap.touchmove(t,e,r)}touchend(t,e,r){if(this._tapTime)this._swipePoint&&0===r.length&&this.reset();else{const 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}}class To{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()}}class So{constructor(t,e,r,i){this._pitchWithRotate=t.pitchWithRotate,this._rollEnabled=t.rollEnabled,this._mouseRotate=e,this._mousePitch=r,this._mouseRoll=i}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable(),this._rollEnabled&&this._mouseRoll.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable(),this._mouseRoll.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())&&(!this._rollEnabled||this._mouseRoll.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()||this._mouseRoll.isActive()}}class Po{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()}}class Co{constructor(t,e){this._bypassKey=-1!==navigator.userAgent.indexOf("Mac")?"metaKey":"ctrlKey",this._map=t,this._options=e,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;const t=this._map.getCanvasContainer();t.classList.add("maplibregl-cooperative-gestures"),this._container=s.create("div","maplibregl-cooperative-gesture-screen",t);let e=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");"metaKey"===this._bypassKey&&(e=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const r=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),i=document.createElement("div");i.className="maplibregl-desktop-message",i.textContent=e,this._container.appendChild(i);const n=document.createElement("div");n.className="maplibregl-mobile-message",n.textContent=r,this._container.appendChild(n),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(s.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._destroyUI()}isEnabled(){return this._enabled}isBypassed(t){return t[this._bypassKey]}notifyGestureBlocked(t,r){this._enabled&&(this._map.fire(new e.l("cooperativegestureprevented",{gestureType:t,originalEvent:r})),this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}}const Mo=t=>t.zoom||t.drag||t.roll||t.pitch||t.rotate;class Ao extends e.l{}function Io(t){return t.panDelta&&t.panDelta.mag()||t.zoomDelta||t.bearingDelta||t.pitchDelta||t.rollDelta}class Eo{constructor(t,r){this.handleWindowEvent=t=>{this.handleEvent(t,`${t.type}Window`)},this.handleEvent=(t,r)=>{if("blur"===t.type)return void this.stop(!0);this._updatingCamera=!0;const i="renderFrame"===t.type?void 0:t,n={needsRenderFrame:!1},o={},a={};for(const{handlerName:l,handler:c,allowed:h}of this._handlers){if(!c.isEnabled())continue;let u;if(this._blockedByActive(a,h,l))c.reset();else if(c[r||t.type]){if(e.cp(t,r||t.type)){const e=s.mousePos(this._map.getCanvas(),t);u=c[r||t.type](t,e)}else if(e.cq(t,r||t.type)){const e=this._getMapTouches(t.touches),i=s.touchPos(this._map.getCanvas(),e);u=c[r||t.type](t,i,e)}else e.cr(r||t.type)||(u=c[r||t.type](t));this.mergeHandlerResult(n,o,u,l,i),u&&u.needsRenderFrame&&this._triggerRenderFrame()}(u||c.isActive())&&(a[l]=c)}const l={};for(const t in this._previousActiveHandlers)a[t]||(l[t]=i);this._previousActiveHandlers=a,(Object.keys(l).length||Io(n))&&(this._changes.push([n,o,l]),this._triggerRenderFrame()),(Object.keys(a).length||Io(n))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:c}=n;c&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],c(this._map))},this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Fn(t),this._bearingSnap=r.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(r);const i=this._el;this._listeners=[[i,"touchstart",{passive:!0}],[i,"touchmove",{passive:!1}],[i,"touchend",void 0],[i,"touchcancel",void 0],[i,"mousedown",void 0],[i,"mousemove",void 0],[i,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[i,"mouseover",void 0],[i,"mouseout",void 0],[i,"dblclick",void 0],[i,"click",void 0],[i,"keydown",{capture:!1}],[i,"keyup",void 0],[i,"wheel",{passive:!1}],[i,"contextmenu",void 0],[window,"blur",void 0]];for(const[t,e,r]of this._listeners)s.addEventListener(t,e,t===document?this.handleWindowEvent:this.handleEvent,r)}destroy(){for(const[t,e,r]of this._listeners)s.removeEventListener(t,e,t===document?this.handleWindowEvent:this.handleEvent,r)}_addDefaultHandlers(t){const r=this._map,i=r.getCanvasContainer();this._add("mapEvent",new Vn(r,t));const n=r.boxZoom=new Gn(r,t);this._add("boxZoom",n),t.interactive&&t.boxZoom&&n.enable();const o=r.cooperativeGestures=new Co(r,t.cooperativeGestures);this._add("cooperativeGestures",o),t.cooperativeGestures&&o.enable();const a=new Xn(r),l=new xo(r);r.doubleClickZoom=new vo(l,a),this._add("tapZoom",a),this._add("clickZoom",l),t.interactive&&t.doubleClickZoom&&r.doubleClickZoom.enable();const c=new wo;this._add("tapDragZoom",c);const h=r.touchPitch=new po(r);this._add("touchPitch",h),t.interactive&&t.touchPitch&&r.touchPitch.enable(t.touchPitch);const u=()=>r.project(r.getCenter()),p=function({enable:t,clickTolerance:r,aroundCenter:i=!0,minPixelCenterThreshold:n=100,rotateDegreesPerPixelMoved:o=.8},a){const l=new to({checkCorrectEvent:t=>0===s.mouseButton(t)&&t.ctrlKey||2===s.mouseButton(t)&&!t.ctrlKey});return new Kn({clickTolerance:r,move:(t,r)=>{const s=a();if(i&&Math.abs(s.y-t.y)>n)return{bearingDelta:e.cn(new e.P(t.x,r.y),r,s)};let l=(r.x-t.x)*o;return i&&r.y<s.y&&(l=-l),{bearingDelta:l}},moveStateManager:l,enable:t,assignEvents:io})}(t,u),d=function({enable:t,clickTolerance:e,pitchDegreesPerPixelMoved:r=-.5}){const i=new to({checkCorrectEvent:t=>0===s.mouseButton(t)&&t.ctrlKey||2===s.mouseButton(t)});return new Kn({clickTolerance:e,move:(t,e)=>({pitchDelta:(e.y-t.y)*r}),moveStateManager:i,enable:t,assignEvents:io})}(t),f=function({enable:t,clickTolerance:e,rollDegreesPerPixelMoved:r=.3},i){const n=new to({checkCorrectEvent:t=>2===s.mouseButton(t)&&t.ctrlKey});return new Kn({clickTolerance:e,move:(t,e)=>{const n=i();let o=(e.x-t.x)*r;return e.y<n.y&&(o=-o),{rollDelta:o}},moveStateManager:n,enable:t,assignEvents:io})}(t,u);r.dragRotate=new So(t,p,d,f),this._add("mouseRotate",p,["mousePitch"]),this._add("mousePitch",d,["mouseRotate","mouseRoll"]),this._add("mouseRoll",f,["mousePitch"]),t.interactive&&t.dragRotate&&r.dragRotate.enable();const m=function({enable:t,clickTolerance:e}){const r=new to({checkCorrectEvent:t=>0===s.mouseButton(t)&&!t.ctrlKey});return new Kn({clickTolerance:e,move:(t,e)=>({around:e,panDelta:e.sub(t)}),activateOnStart:!0,moveStateManager:r,enable:t,assignEvents:io})}(t),g=new no(t,r);r.dragPan=new To(i,m,g),this._add("mousePan",m),this._add("touchPan",g,["touchZoom","touchRotate"]),t.interactive&&t.dragPan&&r.dragPan.enable(t.dragPan);const _=new ho,y=new lo;r.touchZoomRotate=new Po(i,y,_,c),this._add("touchRotate",_,["touchPan","touchZoom"]),this._add("touchZoom",y,["touchPan","touchRotate"]),t.interactive&&t.touchZoomRotate&&r.touchZoomRotate.enable(t.touchZoomRotate);const b=r.scrollZoom=new bo(r,()=>this._triggerRenderFrame());this._add("scrollZoom",b,["mousePan"]),t.interactive&&t.scrollZoom&&r.scrollZoom.enable(t.scrollZoom);const v=r.keyboard=new mo(r);this._add("keyboard",v),t.interactive&&t.keyboard&&r.keyboard.enable(),this._add("blockableMapEvent",new $n(r))}_add(t,e,r){this._handlers.push({handlerName:t,handler:e,allowed:r}),this._handlersById[t]=e}stop(t){if(!this._updatingCamera){for(const{handler:t}of this._handlers)t.reset();this._inertia.clear(),this._fireEvents({},{},t),this._changes=[]}}isActive(){for(const{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 Boolean(Mo(this._eventsInProgress))||this.isZooming()}_blockedByActive(t,e,r){for(const i in t)if(i!==r&&(!e||e.indexOf(i)<0))return!0;return!1}_getMapTouches(t){const e=[];for(const r of t)this._el.contains(r.target)&&e.push(r);return e}mergeHandlerResult(t,r,i,n,o){if(!i)return;e.e(t,i);const a={handlerName:n,originalEvent:i.originalEvent||o};void 0!==i.zoomDelta&&(r.zoom=a),void 0!==i.panDelta&&(r.drag=a),void 0!==i.rollDelta&&(r.roll=a),void 0!==i.pitchDelta&&(r.pitch=a),void 0!==i.bearingDelta&&(r.rotate=a)}_applyChanges(){const t={},r={},i={};for(const[n,o,a]of this._changes)n.panDelta&&(t.panDelta=(t.panDelta||new e.P(0,0))._add(n.panDelta)),n.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+n.zoomDelta),n.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+n.bearingDelta),n.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+n.pitchDelta),n.rollDelta&&(t.rollDelta=(t.rollDelta||0)+n.rollDelta),void 0!==n.around&&(t.around=n.around),void 0!==n.pinchAround&&(t.pinchAround=n.pinchAround),n.noInertia&&(t.noInertia=n.noInertia),e.e(r,o),e.e(i,a);this._updateMapTransform(t,r,i),this._changes=[]}_updateMapTransform(t,e,r){const i=this._map,n=i._getTransformForUpdate(),o=i.terrain;if(!(Io(t)||o&&this._terrainMovement))return this._fireEvents(e,r,!0);i._stop(!0);let{panDelta:a,zoomDelta:s,bearingDelta:l,pitchDelta:c,rollDelta:h,around:u,pinchAround:p}=t;void 0!==p&&(u=p),u=u||i.transform.centerPoint,o&&!n.isPointOnMapSurface(u)&&(u=n.centerPoint);const d={panDelta:a,zoomDelta:s,rollDelta:h,pitchDelta:c,bearingDelta:l,around:u};this._map.cameraHelper.useGlobeControls&&!n.isPointOnMapSurface(u)&&(u=n.centerPoint);const f=u.distSqr(n.centerPoint)<.01?n.center:n.screenPointToLocation(a?u.sub(a):u);o?(this._map.cameraHelper.handleMapControlsRollPitchBearingZoom(d,n),this._terrainMovement||!e.drag&&!e.zoom?e.drag&&this._terrainMovement?n.setCenter(n.screenPointToLocation(n.centerPoint.sub(a))):this._map.cameraHelper.handleMapControlsPan(d,n,f):(this._terrainMovement=!0,this._map._elevationFreeze=!0,this._map.cameraHelper.handleMapControlsPan(d,n,f))):(this._map.cameraHelper.handleMapControlsRollPitchBearingZoom(d,n),this._map.cameraHelper.handleMapControlsPan(d,n,f)),i._applyUpdatedTransform(n),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(e,r,!0)}_fireEvents(t,r,i){const n=Mo(this._eventsInProgress),o=Mo(t),s={};for(const e in t){const{originalEvent:r}=t[e];this._eventsInProgress[e]||(s[`${e}start`]=r),this._eventsInProgress[e]=t[e]}!n&&o&&this._fireEvent("movestart",o.originalEvent);for(const t in s)this._fireEvent(t,s[t]);o&&this._fireEvent("move",o.originalEvent);for(const e in t){const{originalEvent:r}=t[e];this._fireEvent(e,r)}const l={};let c;for(const t in this._eventsInProgress){const{handlerName:e,originalEvent:i}=this._eventsInProgress[t];this._handlersById[e].isActive()||(delete this._eventsInProgress[t],c=r[e]||i,l[`${t}end`]=c)}for(const t in l)this._fireEvent(t,l[t]);const h=Mo(this._eventsInProgress),u=(n||o)&&!h;if(u&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;const t=this._map._getTransformForUpdate();this._map.getCenterClampedToGround()&&t.recalculateZoomAndCenter(this._map.terrain),this._map._applyUpdatedTransform(t)}if(i&&u){this._updatingCamera=!0;const t=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),r=t=>0!==t&&-this._bearingSnap<t&&t<this._bearingSnap;!t||!t.essential&&a.prefersReducedMotion?(this._map.fire(new e.l("moveend",{originalEvent:c})),r(this._map.getBearing())&&this._map.resetNorth()):(r(t.bearing||this._map.getBearing())&&(t.bearing=0),t.freezeElevation=!0,this._map.easeTo(t,{originalEvent:c})),this._updatingCamera=!1}}_fireEvent(t,r){this._map.fire(new e.l(t,r?{originalEvent:r}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(t=>{delete this._frameId,this.handleEvent(new Ao("renderFrame",{timeStamp:t})),this._applyChanges()})}_triggerRenderFrame(){void 0===this._frameId&&(this._frameId=this._requestFrame())}}class ko extends e.E{constructor(t,e,r){super(),this._renderFrameCallback=()=>{const t=Math.min((a.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(t)),t<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=r.bearingSnap,this.cameraHelper=e,this.on("moveend",()=>{delete this._requestedCameraState})}migrateProjection(t,e){t.apply(this.transform),this.transform=t,this.cameraHelper=e}getCenter(){return new e.S(this.transform.center.lng,this.transform.center.lat)}setCenter(t,e){return this.jumpTo({center:t},e)}getCenterElevation(){return this.transform.elevation}setCenterElevation(t,e){return this.jumpTo({elevation:t},e),this}getCenterClampedToGround(){return this._centerClampedToGround}setCenterClampedToGround(t){this._centerClampedToGround=t}panBy(t,r,i){return t=e.P.convert(t).mult(-1),this.panTo(this.transform.center,e.e({offset:t},r),i)}panTo(t,r,i){return this.easeTo(e.e({center:t},r),i)}getZoom(){return this.transform.zoom}setZoom(t,e){return this.jumpTo({zoom:t},e),this}zoomTo(t,r,i){return this.easeTo(e.e({zoom:t},r),i)}zoomIn(t,e){return this.zoomTo(this.getZoom()+1,t,e),this}zoomOut(t,e){return this.zoomTo(this.getZoom()-1,t,e),this}getVerticalFieldOfView(){return this.transform.fov}setVerticalFieldOfView(t,r){return t!=this.transform.fov&&(this.transform.setFov(t),this.fire(new e.l("movestart",r)).fire(new e.l("move",r)).fire(new e.l("moveend",r))),this}getBearing(){return this.transform.bearing}setBearing(t,e){return this.jumpTo({bearing:t},e),this}getPadding(){return this.transform.padding}setPadding(t,e){return this.jumpTo({padding:t},e),this}rotateTo(t,r,i){return this.easeTo(e.e({bearing:t},r),i)}resetNorth(t,r){return this.rotateTo(0,e.e({duration:1e3},t),r),this}resetNorthPitch(t,r){return this.easeTo(e.e({bearing:0,pitch:0,roll:0,duration:1e3},t),r),this}snapToNorth(t,e){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(t,e):this}getPitch(){return this.transform.pitch}setPitch(t,e){return this.jumpTo({pitch:t},e),this}getRoll(){return this.transform.roll}setRoll(t,e){return this.jumpTo({roll:t},e),this}cameraForBounds(t,e){t=$.convert(t).adjustAntiMeridian();const r=e&&e.bearing||0;return this._cameraForBoxAndBearing(t.getNorthWest(),t.getSouthEast(),r,e)}_cameraForBoxAndBearing(t,r,i,n){const o={top:0,bottom:0,right:0,left:0};if("number"==typeof(n=e.e({padding:o,offset:[0,0],maxZoom:this.transform.maxZoom},n)).padding){const t=n.padding;n.padding={top:t,bottom:t,right:t,left:t}}const a=e.e(o,n.padding);n.padding=a;const s=this.transform,l=new $(t,r);return this.cameraHelper.cameraForBoxAndBearing(n,a,l,i,s)}fitBounds(t,e,r){return this._fitInternal(this.cameraForBounds(t,e),e,r)}fitScreenCoordinates(t,r,i,n,o){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.screenPointToLocation(e.P.convert(t)),this.transform.screenPointToLocation(e.P.convert(r)),i,n),n,o)}_fitInternal(t,r,i){return t?(delete(r=e.e(t,r)).padding,r.linear?this.easeTo(r,i):this.flyTo(r,i)):this}jumpTo(t,r){this.stop();const i=this._getTransformForUpdate();let n=!1,o=!1,a=!1;const s=i.zoom;this.cameraHelper.handleJumpToCenterZoom(i,t);const l=i.zoom!==s;return"elevation"in t&&i.elevation!==+t.elevation&&i.setElevation(+t.elevation),"bearing"in t&&i.bearing!==+t.bearing&&(n=!0,i.setBearing(+t.bearing)),"pitch"in t&&i.pitch!==+t.pitch&&(o=!0,i.setPitch(+t.pitch)),"roll"in t&&i.roll!==+t.roll&&(a=!0,i.setRoll(+t.roll)),null==t.padding||i.isPaddingEqual(t.padding)||i.setPadding(t.padding),this._applyUpdatedTransform(i),this.fire(new e.l("movestart",r)).fire(new e.l("move",r)),l&&this.fire(new e.l("zoomstart",r)).fire(new e.l("zoom",r)).fire(new e.l("zoomend",r)),n&&this.fire(new e.l("rotatestart",r)).fire(new e.l("rotate",r)).fire(new e.l("rotateend",r)),o&&this.fire(new e.l("pitchstart",r)).fire(new e.l("pitch",r)).fire(new e.l("pitchend",r)),a&&this.fire(new e.l("rollstart",r)).fire(new e.l("roll",r)).fire(new e.l("rollend",r)),this.fire(new e.l("moveend",r))}calculateCameraOptionsFromTo(t,r,i,n=0){const o=e.a1.fromLngLat(t,r),a=e.a1.fromLngLat(i,n),s=a.x-o.x,l=a.y-o.y,c=a.z-o.z,h=Math.hypot(s,l,c);if(0===h)throw new Error("Can't calculate camera options with same From and To");const u=Math.hypot(s,l),p=e.ak(this.transform.cameraToCenterDistance/h/this.transform.tileSize),d=180*Math.atan2(s,-l)/Math.PI;let f=180*Math.acos(u/h)/Math.PI;return f=c<0?90-f:90+f,{center:a.toLngLat(),elevation:n,zoom:p,pitch:f,bearing:d}}calculateCameraOptionsFromCameraLngLatAltRotation(t,e,r,i,n){const o=this.transform.calculateCenterFromCameraLngLatAlt(t,e,r,i);return{center:o.center,elevation:o.elevation,zoom:o.zoom,bearing:r,pitch:i,roll:n}}easeTo(t,r){this._stop(!1,t.easeId),(!1===(t=e.e({offset:[0,0],duration:500,easing:e.co},t)).animate||!t.essential&&a.prefersReducedMotion)&&(t.duration=0);const i=this._getTransformForUpdate(),n=this.getBearing(),o=i.pitch,s=i.roll,l="bearing"in t?this._normalizeBearing(t.bearing,n):n,c="pitch"in t?+t.pitch:o,h="roll"in t?this._normalizeBearing(t.roll,s):s,u="padding"in t?t.padding:i.padding,p=e.P.convert(t.offset);let d,f;t.around&&(d=e.S.convert(t.around),f=i.locationToScreenPoint(d));const m={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching,rolling:this._rolling},g=this.cameraHelper.handleEaseTo(i,{bearing:l,pitch:c,roll:h,padding:u,around:d,aroundPoint:f,offsetAsPoint:p,offset:t.offset,zoom:t.zoom,center:t.center});return this._rotating=this._rotating||n!==l,this._pitching=this._pitching||c!==o,this._rolling=this._rolling||h!==s,this._padding=!i.isPaddingEqual(u),this._zooming=this._zooming||g.isZooming,this._easeId=t.easeId,this._prepareEase(r,t.noMoveStart,m),this.terrain&&this._prepareElevation(g.elevationCenter),this._ease(e=>{g.easeFunc(e),this.terrain&&!t.freezeElevation&&this._updateElevation(e),this._applyUpdatedTransform(i),this._fireMoveEvents(r)},e=>{this.terrain&&t.freezeElevation&&this._finalizeElevation(),this._afterEase(r,e)},t),this}_prepareEase(t,r,i={}){this._moving=!0,r||i.moving||this.fire(new e.l("movestart",t)),this._zooming&&!i.zooming&&this.fire(new e.l("zoomstart",t)),this._rotating&&!i.rotating&&this.fire(new e.l("rotatestart",t)),this._pitching&&!i.pitching&&this.fire(new e.l("pitchstart",t)),this._rolling&&!i.rolling&&this.fire(new e.l("rollstart",t))}_prepareElevation(t){this._elevationCenter=t,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(t,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(t){void 0!==this._elevationStart&&void 0!==this._elevationCenter||this._prepareElevation(this.transform.center),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom));const r=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(t<1&&r!==this._elevationTarget){const e=this._elevationTarget-this._elevationStart;this._elevationStart+=t*(e-(r-(e*t+this._elevationStart))/(1-t)),this._elevationTarget=r}this.transform.setElevation(e.C.number(this._elevationStart,this._elevationTarget,t))}_finalizeElevation(){this._elevationFreeze=!1,this.getCenterClampedToGround()&&this.transform.recalculateZoomAndCenter(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate||this.terrain?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_elevateCameraIfInsideTerrain(t){if(!this.terrain&&t.elevation>=0&&t.pitch<=90)return{};const e=t.getCameraLngLat(),r=t.getCameraAltitude(),i=this.terrain?this.terrain.getElevationForLngLatZoom(e,t.zoom):0;if(r<i){const r=this.calculateCameraOptionsFromTo(e,i,t.center,t.elevation);return{pitch:r.pitch,zoom:r.zoom}}return{}}_applyUpdatedTransform(t){const e=[];if(e.push(t=>this._elevateCameraIfInsideTerrain(t)),this.transformCameraUpdate&&e.push(t=>this.transformCameraUpdate(t)),!e.length)return;const r=t.clone();for(const t of e){const e=r.clone(),{center:i,zoom:n,roll:o,pitch:a,bearing:s,elevation:l}=t(e);i&&e.setCenter(i),void 0!==l&&e.setElevation(l),void 0!==n&&e.setZoom(n),void 0!==o&&e.setRoll(o),void 0!==a&&e.setPitch(a),void 0!==s&&e.setBearing(s),r.apply(e)}this.transform.apply(r)}_fireMoveEvents(t){this.fire(new e.l("move",t)),this._zooming&&this.fire(new e.l("zoom",t)),this._rotating&&this.fire(new e.l("rotate",t)),this._pitching&&this.fire(new e.l("pitch",t)),this._rolling&&this.fire(new e.l("roll",t))}_afterEase(t,r){if(this._easeId&&r&&this._easeId===r)return;delete this._easeId;const i=this._zooming,n=this._rotating,o=this._pitching,a=this._rolling;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._rolling=!1,this._padding=!1,i&&this.fire(new e.l("zoomend",t)),n&&this.fire(new e.l("rotateend",t)),o&&this.fire(new e.l("pitchend",t)),a&&this.fire(new e.l("rollend",t)),this.fire(new e.l("moveend",t))}flyTo(t,r){if(!t.essential&&a.prefersReducedMotion){const i=e.Q(t,["center","zoom","bearing","pitch","roll","elevation"]);return this.jumpTo(i,r)}this.stop(),t=e.e({offset:[0,0],speed:1.2,curve:1.42,easing:e.co},t);const i=this._getTransformForUpdate(),n=i.bearing,o=i.pitch,s=i.roll,l=i.padding,c="bearing"in t?this._normalizeBearing(t.bearing,n):n,h="pitch"in t?+t.pitch:o,u="roll"in t?this._normalizeBearing(t.roll,s):s,p="padding"in t?t.padding:i.padding,d=e.P.convert(t.offset);let f=i.centerPoint.add(d);const m=i.screenPointToLocation(f),g=this.cameraHelper.handleFlyTo(i,{bearing:c,pitch:h,roll:u,padding:p,locationAtOffset:m,offsetAsPoint:d,center:t.center,minZoom:t.minZoom,zoom:t.zoom});let _=t.curve;const y=Math.max(i.width,i.height),b=y/g.scaleOfZoom,v=g.pixelPathLength;"number"==typeof g.scaleOfMinZoom&&(_=Math.sqrt(y/g.scaleOfMinZoom/v*2));const x=_*_;function w(t){const e=(b*b-y*y+(t?-1:1)*x*x*v*v)/(2*(t?b:y)*x*v);return Math.log(Math.sqrt(e*e+1)-e)}function T(t){return(Math.exp(t)-Math.exp(-t))/2}function S(t){return(Math.exp(t)+Math.exp(-t))/2}const P=w(!1);let C=function(t){return S(P)/S(P+_*t)},M=function(t){return y*((S(P)*(T(e=P+_*t)/S(e))-T(P))/x)/v;var e},A=(w(!0)-P)/_;if(Math.abs(v)<2e-6||!isFinite(A)){if(Math.abs(y-b)<1e-6)return this.easeTo(t,r);const e=b<y?-1:1;A=Math.abs(Math.log(b/y))/_,M=()=>0,C=t=>Math.exp(e*_*t)}return t.duration="duration"in t?+t.duration:1e3*A/("screenSpeed"in t?+t.screenSpeed/_:+t.speed),t.maxDuration&&t.duration>t.maxDuration&&(t.duration=0),this._zooming=!0,this._rotating=n!==c,this._pitching=h!==o,this._rolling=u!==s,this._padding=!i.isPaddingEqual(p),this._prepareEase(r,!1),this.terrain&&this._prepareElevation(g.targetCenter),this._ease(a=>{const m=a*A,_=1/C(m),y=M(m);this._rotating&&i.setBearing(e.C.number(n,c,a)),this._pitching&&i.setPitch(e.C.number(o,h,a)),this._rolling&&i.setRoll(e.C.number(s,u,a)),this._padding&&(i.interpolatePadding(l,p,a),f=i.centerPoint.add(d)),g.easeFunc(a,_,y,f),this.terrain&&!t.freezeElevation&&this._updateElevation(a),this._applyUpdatedTransform(i),this._fireMoveEvents(r)},()=>{this.terrain&&t.freezeElevation&&this._finalizeElevation(),this._afterEase(r)},t),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(t,e){var r;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const t=this._onEaseEnd;delete this._onEaseEnd,t.call(this,e)}return t||null===(r=this.handlers)||void 0===r||r.stop(!1),this}_ease(t,e,r){!1===r.animate||0===r.duration?(t(1),e()):(this._easeStart=a.now(),this._easeOptions=r,this._onEaseFrame=t,this._onEaseEnd=e,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(t,r){t=e.aO(t,-180,180);const i=Math.abs(t-r);return Math.abs(t-360-r)<i&&(t-=360),Math.abs(t+360-r)<i&&(t+=360),t}queryTerrainElevation(t){return this.terrain?this.terrain.getElevationForLngLatZoom(e.S.convert(t),this.transform.tileZoom):null}}const zo={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class Ro{constructor(t=zo){this._toggleAttribution=()=>{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")))},this._updateData=t=>{!t||"metadata"!==t.sourceDataType&&"visibility"!==t.sourceDataType&&"style"!==t.dataType&&"terrain"!==t.type||this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?!1===this._compact?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"))},this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")},this.options=t}getDefaultPosition(){return"bottom-right"}onAdd(t){return this._map=t,this._compact=this.options.compact,this._container=s.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=s.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=s.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(){s.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){const r=this._map._getUIString(`AttributionControl.${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(t=>"string"!=typeof t?"":t)):"string"==typeof this.options.customAttribution&&t.push(this.options.customAttribution)),this._map.style.stylesheet){const t=this._map.style.stylesheet;this.styleOwner=t.owner,this.styleId=t.id}const e=this._map.style.sourceCaches;for(const r in e){const i=e[r];if(i.used||i.usedForTerrain){const e=i.getSource();e.attribution&&t.indexOf(e.attribution)<0&&t.push(e.attribution)}}t=t.filter(t=>String(t).trim()),t.sort((t,e)=>t.length-e.length),t=t.filter((e,r)=>{for(let i=r+1;i<t.length;i++)if(t[i].indexOf(e)>=0)return!1;return!0});const r=t.join(" | ");r!==this._attribHTML&&(this._attribHTML=r,t.length?(this._innerContainer.innerHTML=s.sanitize(r),this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class Do{constructor(t={}){this._updateCompact=()=>{const t=this._container.children;if(t.length){const e=t[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?!1!==this._compact&&e.classList.add("maplibregl-compact"):e.classList.remove("maplibregl-compact")}},this.options=t}getDefaultPosition(){return"bottom-left"}onAdd(t){this._map=t,this._compact=this.options&&this.options.compact,this._container=s.create("div","maplibregl-ctrl");const e=s.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(){s.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class Lo{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(t){const e=++this._id;return this._queue.push({callback:t,id:e,cancelled:!1}),e}remove(t){const e=this._currentlyRunning,r=e?this._queue.concat(e):this._queue;for(const e of r)if(e.id===t)return void(e.cancelled=!0)}run(t=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const e=this._currentlyRunning=this._queue;this._queue=[];for(const 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=[]}}var Fo=e.aJ([{name:"a_pos3d",type:"Int16",components:3}]);class Bo extends e.E{constructor(t){super(),this._lastTilesetChange=a.now(),this.sourceCache=t,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.deltaZoom=1,this.tileSize=t._source.tileSize*2**this.deltaZoom,t.usedForTerrain=!0,t.tileSize=this.tileSize}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(t,r){this.sourceCache.update(t,r),this._renderableTilesKeys=[];const i={};for(const n of yt(t,{tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:r,calculateTileZoom:this.sourceCache._source.calculateTileZoom}))i[n.key]=!0,this._renderableTilesKeys.push(n.key),this._tiles[n.key]||(n.terrainRttPosMatrix32f=new Float64Array(16),e.bY(n.terrainRttPosMatrix32f,0,e.$,e.$,0,0,1),this._tiles[n.key]=new nt(n,this.tileSize),this._lastTilesetChange=a.now());for(const t in this._tiles)i[t]||delete this._tiles[t]}freeRtt(t){for(const e in this._tiles){const r=this._tiles[e];(!t||r.tileID.equals(t)||r.tileID.isChildOf(t)||t.isChildOf(r.tileID))&&(r.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(t=>this.getTileByID(t))}getTileByID(t){return this._tiles[t]}getTerrainCoords(t,e){return e?this._getTerrainCoordsForTileRanges(t,e):this._getTerrainCoordsForRegularTile(t)}_getTerrainCoordsForRegularTile(t){const r={};for(const i of this._renderableTilesKeys){const n=this._tiles[i].tileID,o=t.clone(),a=e.ba();if(n.canonical.equals(t.canonical))e.bY(a,0,e.$,e.$,0,0,1);else if(n.canonical.isChildOf(t.canonical)){const r=n.canonical.z-t.canonical.z,i=n.canonical.x-(n.canonical.x>>r<<r),o=n.canonical.y-(n.canonical.y>>r<<r),s=e.$>>r;e.bY(a,0,s,s,0,0,1),e.M(a,a,[-i*s,-o*s,0])}else{if(!t.canonical.isChildOf(n.canonical))continue;{const r=t.canonical.z-n.canonical.z,i=t.canonical.x-(t.canonical.x>>r<<r),o=t.canonical.y-(t.canonical.y>>r<<r),s=e.$>>r;e.bY(a,0,e.$,e.$,0,0,1),e.M(a,a,[i*s,o*s,0]),e.N(a,a,[1/2**r,1/2**r,0])}}o.terrainRttPosMatrix32f=new Float32Array(a),r[i]=o}return r}_getTerrainCoordsForTileRanges(t,r){const i={};for(const n of this._renderableTilesKeys){const o=this._tiles[n].tileID;if(!this._isWithinTileRanges(o,r))continue;const a=t.clone(),s=e.ba();if(o.canonical.z===t.canonical.z){const r=t.canonical.x-o.canonical.x,i=t.canonical.y-o.canonical.y;e.bY(s,0,e.$,e.$,0,0,1),e.M(s,s,[r*e.$,i*e.$,0])}else if(o.canonical.z>t.canonical.z){const r=o.canonical.z-t.canonical.z,i=o.canonical.x-(o.canonical.x>>r<<r),n=o.canonical.y-(o.canonical.y>>r<<r),a=t.canonical.x-(o.canonical.x>>r),l=t.canonical.y-(o.canonical.y>>r),c=e.$>>r;e.bY(s,0,c,c,0,0,1),e.M(s,s,[-i*c+a*e.$,-n*c+l*e.$,0])}else{const r=t.canonical.z-o.canonical.z,i=t.canonical.x-(t.canonical.x>>r<<r),n=t.canonical.y-(t.canonical.y>>r<<r),a=(t.canonical.x>>r)-o.canonical.x,l=(t.canonical.y>>r)-o.canonical.y,c=e.$<<r;e.bY(s,0,c,c,0,0,1),e.M(s,s,[i*e.$+a*c,n*e.$+l*c,0])}a.terrainRttPosMatrix32f=new Float32Array(s),i[n]=a}return i}getSourceTile(t,e){const r=this.sourceCache._source;let i=t.overscaledZ-this.deltaZoom;if(i>r.maxzoom&&(i=r.maxzoom),i<r.minzoom)return null;this._sourceTileCache[t.key]||(this._sourceTileCache[t.key]=t.scaledTo(i).key);let n=this.sourceCache.getTileByID(this._sourceTileCache[t.key]);if((!n||!n.dem)&&e)for(;i>=r.minzoom&&(!n||!n.dem);)n=this.sourceCache.getTileByID(t.scaledTo(i--).key);return n}anyTilesAfterTime(t=Date.now()){return this._lastTilesetChange>=t}_isWithinTileRanges(t,e){return e[t.canonical.z]&&t.canonical.x>=e[t.canonical.z].minTileX&&t.canonical.x<=e[t.canonical.z].maxTileX&&t.canonical.y>=e[t.canonical.z].minTileY&&t.canonical.y<=e[t.canonical.z].maxTileY}}class Oo{constructor(t,e,r){this._meshCache={},this.painter=t,this.sourceCache=new Bo(e),this.options=r,this.exaggeration="number"==typeof r.exaggeration?r.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(t,r,i,n=e.$){var o;if(!(r>=0&&r<n&&i>=0&&i<n))return 0;const a=this.getTerrainData(t),s=null===(o=a.tile)||void 0===o?void 0:o.dem;if(!s)return 0;const l=e.cs([],[r/n*e.$,i/n*e.$],a.u_terrain_matrix),c=[l[0]*s.dim,l[1]*s.dim],h=Math.floor(c[0]),u=Math.floor(c[1]),p=c[0]-h,d=c[1]-u;return s.get(h,u)*(1-p)*(1-d)+s.get(h+1,u)*p*(1-d)+s.get(h,u+1)*(1-p)*d+s.get(h+1,u+1)*p*d}getElevationForLngLatZoom(t,r){if(!e.ct(r,t.wrap()))return 0;const{tileID:i,mercatorX:n,mercatorY:o}=this._getOverscaledTileIDFromLngLatZoom(t,r);return this.getElevation(i,n%e.$,o%e.$,e.$)}getElevation(t,r,i,n=e.$){return this.getDEMElevation(t,r,i,n)*this.exaggeration}getTerrainData(t){if(!this._emptyDemTexture){const t=this.painter.context,r=new e.R({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new e.T(t,r,t.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new e.T(t,new e.R({width:1,height:1}),t.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=e.ag([])}const r=this.sourceCache.getSourceTile(t,!0);if(r&&r.dem&&(!r.demTexture||r.needsTerrainPrepare)){const t=this.painter.context;r.demTexture=this.painter.getTileTexture(r.dem.stride),r.demTexture?r.demTexture.update(r.dem.getPixels(),{premultiply:!1}):r.demTexture=new e.T(t,r.dem.getPixels(),t.gl.RGBA,{premultiply:!1}),r.demTexture.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),r.needsTerrainPrepare=!1}const i=r&&r+r.tileID.key+t.key;if(i&&!this._demMatrixCache[i]){const i=this.sourceCache.sourceCache._source.maxzoom;let n=t.canonical.z-r.tileID.canonical.z;t.overscaledZ>t.canonical.z&&(t.canonical.z>=i?n=t.canonical.z-i:e.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const o=t.canonical.x-(t.canonical.x>>n<<n),a=t.canonical.y-(t.canonical.y>>n<<n),s=e.cu(new Float64Array(16),[1/(e.$<<n),1/(e.$<<n),0]);e.M(s,s,[o*e.$,a*e.$,0]),this._demMatrixCache[t.key]={matrix:s,coord:t}}return{u_depth:2,u_terrain:3,u_terrain_dim:r&&r.dem&&r.dem.dim||1,u_terrain_matrix:i?this._demMatrixCache[t.key].matrix:this._emptyDemMatrix,u_terrain_unpack:r&&r.dem&&r.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(r&&r.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:r}}getFramebuffer(t){const r=this.painter,i=r.width/devicePixelRatio,n=r.height/devicePixelRatio;return!this._fbo||this._fbo.width===i&&this._fbo.height===n||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new e.T(r.context,{width:i,height:n,data:null},r.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(r.context.gl.NEAREST,r.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new e.T(r.context,{width:i,height:n,data:null},r.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(r.context.gl.NEAREST,r.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=r.context.createFramebuffer(i,n,!0,!1),this._fbo.depthAttachment.set(r.context.createRenderbuffer(r.context.gl.DEPTH_COMPONENT16,i,n))),this._fbo.colorAttachment.set("coords"===t?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){const t=this.painter.context;if(this._coordsTexture)return this._coordsTexture;const r=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let t=0,e=0;t<this._coordsTextureSize;t++)for(let i=0;i<this._coordsTextureSize;i++,e+=4)r[e+0]=255&i,r[e+1]=255&t,r[e+2]=i>>8<<4|t>>8,r[e+3]=0;const i=new e.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(r.buffer)),n=new e.T(t,i,t.gl.RGBA,{premultiply:!1});return n.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),this._coordsTexture=n,n}pointCoordinate(t){this.painter.maybeDrawDepthAndCoords(!0);const r=new Uint8Array(4),i=this.painter.context,n=i.gl,o=Math.round(t.x*this.painter.pixelRatio/devicePixelRatio),a=Math.round(t.y*this.painter.pixelRatio/devicePixelRatio),s=Math.round(this.painter.height/devicePixelRatio);i.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),n.readPixels(o,s-a-1,1,1,n.RGBA,n.UNSIGNED_BYTE,r),i.bindFramebuffer.set(null);const l=r[0]+(r[2]>>4<<8),c=r[1]+((15&r[2])<<8),h=this.coordsIndex[255-r[3]],u=h&&this.sourceCache.getTileByID(h);if(!u)return null;const p=this._coordsTextureSize,d=(1<<u.tileID.canonical.z)*p;return new e.a1((u.tileID.canonical.x*p+l)/d+u.tileID.wrap,(u.tileID.canonical.y*p+c)/d,this.getElevation(u.tileID,l,c,p))}depthAtPoint(t){const 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]/16777216+e[1]/65536+e[2]/256+e[3])/256}getTerrainMesh(t){var r;const i=(null===(r=this.painter.style.projection)||void 0===r?void 0:r.transitionState)>0,n=i&&0===t.canonical.y,o=i&&t.canonical.y===(1<<t.canonical.z)-1,a=`m_${n?"n":""}_${o?"s":""}`;if(this._meshCache[a])return this._meshCache[a];const s=this.painter.context,l=new e.cv,c=new e.aN,h=this.meshSize,u=e.$/h,p=h*h;for(let t=0;t<=h;t++)for(let e=0;e<=h;e++)l.emplaceBack(e*u,t*u,0);for(let t=0;t<p;t+=h+1)for(let e=0;e<h;e++)c.emplaceBack(e+t,h+e+t+1,h+e+t+2),c.emplaceBack(e+t,h+e+t+2,e+t+1);const d=l.length,f=d+(h+1),m=(h+1)*h,g=n?e.bh:0,_=n?0:1,y=o?e.bi:e.$,b=o?0:1;for(let t=0;t<=h;t++)l.emplaceBack(t*u,g,_);for(let t=0;t<=h;t++)l.emplaceBack(t*u,y,b);for(let t=0;t<h;t++)c.emplaceBack(m+t,f+t,f+t+1),c.emplaceBack(m+t,f+t+1,m+t+1),c.emplaceBack(0+t,d+t+1,d+t),c.emplaceBack(0+t,0+t+1,d+t+1);const v=l.length,x=v+2*(h+1);for(const t of[0,1])for(let r=0;r<=h;r++)for(const i of[0,1])l.emplaceBack(t*e.$,r*u,i);for(let t=0;t<2*h;t+=2)c.emplaceBack(v+t,v+t+1,v+t+3),c.emplaceBack(v+t,v+t+3,v+t+2),c.emplaceBack(x+t,x+t+3,x+t+1),c.emplaceBack(x+t,x+t+2,x+t+3);const w=new we(s.createVertexBuffer(l,Fo.members),s.createIndexBuffer(c),e.aM.simpleSegment(0,0,l.length,c.length));return this._meshCache[a]=w,w}getMeshFrameDelta(t){return 2*Math.PI*e.bu/Math.pow(2,Math.max(t,0))/5}getMinTileElevationForLngLatZoom(t,e){var r;const{tileID:i}=this._getOverscaledTileIDFromLngLatZoom(t,e);return null!==(r=this.getMinMaxElevation(i).minElevation)&&void 0!==r?r:0}getMinMaxElevation(t){const 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,r){const i=e.a1.fromLngLat(t.wrap()),n=(1<<r)*e.$,o=i.x*n,a=i.y*n,s=Math.floor(o/e.$),l=Math.floor(a/e.$);return{tileID:new e.Z(r,0,r,s,l),mercatorX:o,mercatorY:a}}}class jo{constructor(t,e,r){this._context=t,this._size=e,this._tileSize=r,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(const t of this._objects)t.texture.destroy(),t.fbo.destroy()}_createObject(t){const r=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),i=new e.T(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return i.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),this._context.extTextureFilterAnisotropic&&this._context.gl.texParameterf(this._context.gl.TEXTURE_2D,this._context.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,this._context.extTextureFilterAnisotropicMax),r.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),r.colorAttachment.set(i.texture),{id:t,fbo:r,texture:i,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(const t of this._recentlyUsed)if(!this._objects[t].inUse)return this._objects[t];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const t=this._createObject(this._objects.length);return this._objects.push(t),t}freeObject(t){t.inUse=!1}freeAllObjects(){for(const t of this._objects)this.freeObject(t)}isFull(){return!(this._objects.length<this._size)&&!1===this._objects.some(t=>!t.inUse)}}const Uo={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0,"color-relief":!0};class No{constructor(t,e){this.painter=t,this.terrain=e,this.pool=new jo(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._coordsAscending={};for(const e in t.sourceCaches){this._coordsAscending[e]={};const r=t.sourceCaches[e].getVisibleCoordinates(),i=t.sourceCaches[e].getSource(),n=i instanceof X?i.terrainTileRanges:null;for(const t of r){const r=this.terrain.sourceCache.getTerrainCoords(t,n);for(const t in r)this._coordsAscending[e][t]||(this._coordsAscending[e][t]=[]),this._coordsAscending[e][t].push(r[t])}}this._coordsAscendingStr={};for(const e of t._order){const r=t._layers[e],i=r.source;if(Uo[r.type]&&!this._coordsAscendingStr[i]){this._coordsAscendingStr[i]={};for(const t in this._coordsAscending[i])this._coordsAscendingStr[i][t]=this._coordsAscending[i][t].map(t=>t.key).sort().join()}}for(const t of this._renderableTiles)for(const e in this._coordsAscendingStr){const r=this._coordsAscendingStr[e][t.tileID.key];r&&r!==t.rttCoords[e]&&(t.rtt=[])}}renderLayer(t,r){if(t.isHidden(this.painter.transform.zoom))return!1;const i=Object.assign(Object.assign({},r),{isRenderingToTexture:!0}),n=t.type,o=this.painter,a=this._renderableLayerIds[this._renderableLayerIds.length-1]===t.id;if(Uo[n]&&(this._prevType&&Uo[this._prevType]||this._stacks.push([]),this._prevType=n,this._stacks[this._stacks.length-1].push(t.id),!a))return!0;if(Uo[this._prevType]||Uo[n]&&a){this._prevType=n;const t=this._stacks.length-1,r=this._stacks[t]||[];for(const n of this._renderableTiles){if(this.pool.isFull()&&(Pn(this.painter,this.terrain,this._rttTiles,i),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(n),n.rtt[t]){const e=this.pool.getObjectForId(n.rtt[t].id);if(e.stamp===n.rtt[t].stamp){this.pool.useObject(e);continue}}const a=this.pool.getOrCreateFreeObject();this.pool.useObject(a),this.pool.stampObject(a),n.rtt[t]={id:a.id,stamp:a.stamp},o.context.bindFramebuffer.set(a.fbo.framebuffer),o.context.clear({color:e.bf.transparent,stencil:0}),o.currentStencilSource=void 0;for(let t=0;t<r.length;t++){const e=o.style._layers[r[t]],s=e.source?this._coordsAscending[e.source][n.tileID.key]:[n.tileID];o.context.viewport.set([0,0,a.fbo.width,a.fbo.height]),o._renderTileClippingMasks(e,s,!0),o.renderLayer(o,o.style.sourceCaches[e.source],e,s,i),e.source&&(n.rttCoords[e.source]=this._coordsAscendingStr[e.source][n.tileID.key])}}return Pn(this.painter,this.terrain,this._rttTiles,i),this._rttTiles=[],this.pool.freeAllObjects(),Uo[n]}return!1}}const Vo={"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","Map.Title":"Map","Marker.Title":"Map marker","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","Popup.Close":"Close popup","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","GlobeControl.Enable":"Enable globe","GlobeControl.Disable":"Disable globe","TerrainControl.Enable":"Enable terrain","TerrainControl.Disable":"Disable terrain","CooperativeGesturesHandler.WindowsHelpText":"Use Ctrl + scroll to zoom the map","CooperativeGesturesHandler.MacHelpText":"Use ⌘ + scroll to zoom the map","CooperativeGesturesHandler.MobileHelpText":"Use two fingers to move the map"},$o=r,Zo={hash:!1,interactive:!0,bearingSnap:7,attributionControl:zo,maplibreLogo:!1,refreshExpiredTiles:!0,canvasContextAttributes:{antialias:!1,preserveDrawingBuffer:!1,powerPreference:"high-performance",failIfMajorPerformanceCaveat:!1,desynchronized:!1,contextType:void 0},scrollZoom:!0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,trackResize:!0,center:[0,0],elevation:0,zoom:0,bearing:0,pitch:0,roll:0,renderWorldCopies:!0,maxTileCacheSize:null,maxTileCacheZoomLevels:e.a.MAX_TILE_CACHE_ZOOM_LEVELS,transformRequest:null,transformCameraUpdate:null,fadeDuration:300,crossSourceCollisions:!0,clickTolerance:3,localIdeographFontFamily:"sans-serif",pitchWithRotate:!0,rollEnabled:!1,validateStyle:!0,maxCanvasSize:[4096,4096],cancelPendingTileRequestsWhileZooming:!0,centerClampedToGround:!0},Go={showCompass:!0,showZoom:!0,visualizePitch:!1,visualizeRoll:!0};class qo{constructor(t,r,i=!1){this.mousedown=t=>{this.startMove(t,s.mousePos(this.element,t)),s.addEventListener(window,"mousemove",this.mousemove),s.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=t=>{this.move(t,s.mousePos(this.element,t))},this.mouseup=t=>{this._rotatePitchHandler.dragEnd(t),this.offTemp()},this.touchstart=t=>{1!==t.targetTouches.length?this.reset():(this._startPos=this._lastPos=s.touchPos(this.element,t.targetTouches)[0],this.startMove(t,this._startPos),s.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),s.addEventListener(window,"touchend",this.touchend))},this.touchmove=t=>{1!==t.targetTouches.length?this.reset():(this._lastPos=s.touchPos(this.element,t.targetTouches)[0],this.move(t,this._lastPos))},this.touchend=t=>{0===t.targetTouches.length&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),delete this._startPos,delete this._lastPos,this.offTemp()},this.reset=()=>{this._rotatePitchHandler.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10,this.element=r;const n=new ro;this._rotatePitchHandler=new Kn({clickTolerance:3,move:(t,n)=>{const o=r.getBoundingClientRect(),a=new e.P((o.bottom-o.top)/2,(o.right-o.left)/2);return{bearingDelta:e.cn(new e.P(t.x,n.y),n,a),pitchDelta:i?-.5*(n.y-t.y):void 0}},moveStateManager:n,enable:!0,assignEvents:()=>{}}),this.map=t,s.addEventListener(r,"mousedown",this.mousedown),s.addEventListener(r,"touchstart",this.touchstart,{passive:!1}),s.addEventListener(r,"touchcancel",this.reset)}startMove(t,e){this._rotatePitchHandler.dragStart(t,e),s.disableDrag()}move(t,e){const r=this.map,{bearingDelta:i,pitchDelta:n}=this._rotatePitchHandler.dragMove(t,e)||{};i&&r.setBearing(r.getBearing()+i),n&&r.setPitch(r.getPitch()+n)}off(){const t=this.element;s.removeEventListener(t,"mousedown",this.mousedown),s.removeEventListener(t,"touchstart",this.touchstart,{passive:!1}),s.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),s.removeEventListener(window,"touchend",this.touchend),s.removeEventListener(t,"touchcancel",this.reset),this.offTemp()}offTemp(){s.enableDrag(),s.removeEventListener(window,"mousemove",this.mousemove),s.removeEventListener(window,"mouseup",this.mouseup),s.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),s.removeEventListener(window,"touchend",this.touchend)}}let Ho;function Wo(t,r,i,n=!1){if(n||!i.getCoveringTilesDetailsProvider().allowWorldCopies())return null==t?void 0:t.wrap();const o=new e.S(t.lng,t.lat);if(t=new e.S(t.lng,t.lat),r){const n=new e.S(t.lng-360,t.lat),o=new e.S(t.lng+360,t.lat),a=i.locationToScreenPoint(t).distSqr(r);i.locationToScreenPoint(n).distSqr(r)<a?t=n:i.locationToScreenPoint(o).distSqr(r)<a&&(t=o)}for(;Math.abs(t.lng-i.center.lng)>180;){const e=i.locationToScreenPoint(t);if(e.x>=0&&e.y>=0&&e.x<=i.width&&e.y<=i.height)break;t.lng>i.center.lng?t.lng-=360:t.lng+=360}return t.lng!==o.lng&&i.isPointOnMapSurface(i.locationToScreenPoint(t))?t:o}const Xo={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 Ko(t,e,r){const i=t.classList;for(const t in Xo)i.remove(`maplibregl-${r}-anchor-${t}`);i.add(`maplibregl-${r}-anchor-${e}`)}class Yo extends e.E{constructor(t){if(super(),this._onKeyPress=t=>{const e=t.code,r=t.charCode||t.keyCode;"Space"!==e&&"Enter"!==e&&32!==r&&13!==r||this.togglePopup()},this._onMapClick=t=>{const e=t.originalEvent.target,r=this._element;this._popup&&(e===r||r.contains(e))&&this.togglePopup()},this._update=t=>{if(!this._map)return;const e=this._map.loaded()&&!this._map.isMoving();("terrain"===(null==t?void 0:t.type)||"render"===(null==t?void 0:t.type)&&!e)&&this._map.once("render",this._update),this._lngLat=Wo(this._lngLat,this._flatPos,this._map.transform),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationToScreenPoint(this._lngLat)._add(this._offset));let r="";"viewport"===this._rotationAlignment||"auto"===this._rotationAlignment?r=`rotateZ(${this._rotation}deg)`:"map"===this._rotationAlignment&&(r=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let i="";"viewport"===this._pitchAlignment||"auto"===this._pitchAlignment?i="rotateX(0deg)":"map"===this._pitchAlignment&&(i=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||t&&"moveend"!==t.type||(this._pos=this._pos.round()),s.setTransform(this._element,`${Xo[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${i} ${r}`),a.frameAsync(new AbortController).then(()=>{this._updateOpacity(t&&"moveend"===t.type)}).catch(()=>{})},this._onMove=t=>{if(!this._isDragging){const e=this._clickTolerance||this._map._clickTolerance;this._isDragging=t.point.dist(this._pointerdownPos)>=e}this._isDragging&&(this._pos=t.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none","pending"===this._state&&(this._state="active",this.fire(new e.l("dragstart"))),this.fire(new e.l("drag")))},this._onUp=()=>{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),"active"===this._state&&this.fire(new e.l("dragend")),this._state="inactive"},this._addDragHandler=t=>{this._element.contains(t.originalEvent.target)&&(t.preventDefault(),this._positionDelta=t.point.sub(this._pos).add(this._offset),this._pointerdownPos=t.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))},this._anchor=t&&t.anchor||"center",this._color=t&&t.color||"#3FB1CE",this._scale=t&&t.scale||1,this._draggable=t&&t.draggable||!1,this._clickTolerance=t&&t.clickTolerance||0,this._subpixelPositioning=t&&t.subpixelPositioning||!1,this._isDragging=!1,this._state="inactive",this._rotation=t&&t.rotation||0,this._rotationAlignment=t&&t.rotationAlignment||"auto",this._pitchAlignment=t&&t.pitchAlignment&&"auto"!==t.pitchAlignment?t.pitchAlignment:this._rotationAlignment,this.setOpacity(null==t?void 0:t.opacity,null==t?void 0:t.opacityWhenCovered),t&&t.element)this._element=t.element,this._offset=e.P.convert(t&&t.offset||[0,0]);else{this._defaultMarker=!0,this._element=s.create("div");const r=s.createNS("http://www.w3.org/2000/svg","svg"),i=41,n=27;r.setAttributeNS(null,"display","block"),r.setAttributeNS(null,"height",`${i}px`),r.setAttributeNS(null,"width",`${n}px`),r.setAttributeNS(null,"viewBox",`0 0 ${n} ${i}`);const o=s.createNS("http://www.w3.org/2000/svg","g");o.setAttributeNS(null,"stroke","none"),o.setAttributeNS(null,"stroke-width","1"),o.setAttributeNS(null,"fill","none"),o.setAttributeNS(null,"fill-rule","evenodd");const a=s.createNS("http://www.w3.org/2000/svg","g");a.setAttributeNS(null,"fill-rule","nonzero");const l=s.createNS("http://www.w3.org/2000/svg","g");l.setAttributeNS(null,"transform","translate(3.0, 29.0)"),l.setAttributeNS(null,"fill","#000000");const 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(const t of c){const e=s.createNS("http://www.w3.org/2000/svg","ellipse");e.setAttributeNS(null,"opacity","0.04"),e.setAttributeNS(null,"cx","10.5"),e.setAttributeNS(null,"cy","5.80029008"),e.setAttributeNS(null,"rx",t.rx),e.setAttributeNS(null,"ry",t.ry),l.appendChild(e)}const h=s.createNS("http://www.w3.org/2000/svg","g");h.setAttributeNS(null,"fill",this._color);const u=s.createNS("http://www.w3.org/2000/svg","path");u.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"),h.appendChild(u);const p=s.createNS("http://www.w3.org/2000/svg","g");p.setAttributeNS(null,"opacity","0.25"),p.setAttributeNS(null,"fill","#000000");const d=s.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"),p.appendChild(d);const f=s.createNS("http://www.w3.org/2000/svg","g");f.setAttributeNS(null,"transform","translate(6.0, 7.0)"),f.setAttributeNS(null,"fill","#FFFFFF");const m=s.createNS("http://www.w3.org/2000/svg","g");m.setAttributeNS(null,"transform","translate(8.0, 8.0)");const g=s.createNS("http://www.w3.org/2000/svg","circle");g.setAttributeNS(null,"fill","#000000"),g.setAttributeNS(null,"opacity","0.25"),g.setAttributeNS(null,"cx","5.5"),g.setAttributeNS(null,"cy","5.5"),g.setAttributeNS(null,"r","5.4999962");const _=s.createNS("http://www.w3.org/2000/svg","circle");_.setAttributeNS(null,"fill","#FFFFFF"),_.setAttributeNS(null,"cx","5.5"),_.setAttributeNS(null,"cy","5.5"),_.setAttributeNS(null,"r","5.4999962"),m.appendChild(g),m.appendChild(_),a.appendChild(l),a.appendChild(h),a.appendChild(p),a.appendChild(f),a.appendChild(m),r.appendChild(a),r.setAttributeNS(null,"height",i*this._scale+"px"),r.setAttributeNS(null,"width",n*this._scale+"px"),this._element.appendChild(r),this._offset=e.P.convert(t&&t.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",t=>{t.preventDefault()}),this._element.addEventListener("mousedown",t=>{t.preventDefault()}),Ko(this._element,this._anchor,"marker"),t&&t.className)for(const e of t.className.split(" "))this._element.classList.add(e);this._popup=null}addTo(t){return this.remove(),this._map=t,this._element.hasAttribute("aria-label")||this._element.setAttribute("aria-label",t._getUIString("Marker.Title")),t.getCanvasContainer().appendChild(this._element),t.on("move",this._update),t.on("moveend",this._update),t.on("terrain",this._update),t.on("projectiontransition",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("terrain",this._update),this._map.off("projectiontransition",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),s.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=e.S.convert(t),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(t){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),t){if(!("offset"in t.options)){const e=38.1,r=13.5,i=Math.abs(r)/Math.SQRT2;t.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-e],"bottom-left":[i,-1*(e-r+i)],"bottom-right":[-i,-1*(e-r+i)],left:[r,-1*(e-r)],right:[-r,-1*(e-r)]}:this._offset}this._popup=t,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}setSubpixelPositioning(t){return this._subpixelPositioning=t,this}getPopup(){return this._popup}togglePopup(){const t=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:t?(t.isOpen()?t.remove():(t.setLngLat(this._lngLat),t.addTo(this._map)),this):this}_updateOpacity(t=!1){var r,i;const n=null===(r=this._map)||void 0===r?void 0:r.terrain,o=this._map.transform.isLocationOccluded(this._lngLat);if(!n||o){const t=o?this._opacityWhenCovered:this._opacity;return void(this._element.style.opacity!==t&&(this._element.style.opacity=t))}if(t)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}const a=this._map,s=a.terrain.depthAtPoint(this._pos),l=a.terrain.getElevationForLngLatZoom(this._lngLat,a.transform.tileZoom);if(a.transform.lngLatToCameraDepth(this._lngLat,l)-s<.006)return void(this._element.style.opacity=this._opacity);const c=-this._offset.y/a.transform.pixelsPerMeter,h=Math.sin(a.getPitch()*Math.PI/180)*c,u=a.terrain.depthAtPoint(new e.P(this._pos.x,this._pos.y-this._offset.y)),p=a.transform.lngLatToCameraDepth(this._lngLat,l+h)-u>.006;(null===(i=this._popup)||void 0===i?void 0:i.isOpen())&&p&&this._popup.remove(),this._element.style.opacity=p?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(t){return this._offset=e.P.convert(t),this._update(),this}addClassName(t){this._element.classList.add(t)}removeClassName(t){this._element.classList.remove(t)}toggleClassName(t){return this._element.classList.toggle(t)}setDraggable(t){return this._draggable=!!t,this._map&&(t?(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(t){return this._rotation=t||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(t){return this._rotationAlignment=t||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(t){return this._pitchAlignment=t&&"auto"!==t?t:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(t,e){return(void 0===this._opacity||void 0===t&&void 0===e)&&(this._opacity="1",this._opacityWhenCovered="0.2"),void 0!==t&&(this._opacity=t),void 0!==e&&(this._opacityWhenCovered=e),this._map&&this._updateOpacity(!0),this}}const Jo={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let Qo=0,ta=!1;const ea={maxWidth:100,unit:"metric"};function ra(t,e,r){const i=r&&r.maxWidth||100,n=t._container.clientHeight/2,o=t._container.clientWidth/2,a=t.unproject([o-i/2,n]),s=t.unproject([o+i/2,n]),l=Math.round(t.project(s).x-t.project(a).x),c=Math.min(i,l,t._container.clientWidth),h=a.distanceTo(s);if(r&&"imperial"===r.unit){const r=3.2808*h;r>5280?ia(e,c,r/5280,t._getUIString("ScaleControl.Miles")):ia(e,c,r,t._getUIString("ScaleControl.Feet"))}else r&&"nautical"===r.unit?ia(e,c,h/1852,t._getUIString("ScaleControl.NauticalMiles")):h>=1e3?ia(e,c,h/1e3,t._getUIString("ScaleControl.Kilometers")):ia(e,c,h,t._getUIString("ScaleControl.Meters"))}function ia(t,e,r,i){const n=function(t){const e=Math.pow(10,`${Math.floor(t)}`.length-1);let r=t/e;return r=r>=10?10:r>=5?5:r>=3?3:r>=2?2:r>=1?1:function(t){const e=Math.pow(10,Math.ceil(-Math.log(t)/Math.LN10));return Math.round(t*e)/e}(r),e*r}(r);t.style.width=e*(n/r)+"px",t.innerHTML=`${n}&nbsp;${i}`}const na={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1,locationOccludedOpacity:void 0},oa=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function aa(t){if(t){if("number"==typeof t){const r=Math.round(Math.abs(t)/Math.SQRT2);return{center:new e.P(0,0),top:new e.P(0,t),"top-left":new e.P(r,r),"top-right":new e.P(-r,r),bottom:new e.P(0,-t),"bottom-left":new e.P(r,-r),"bottom-right":new e.P(-r,-r),left:new e.P(t,0),right:new e.P(-t,0)}}if(t instanceof e.P||Array.isArray(t)){const r=e.P.convert(t);return{center:r,top:r,"top-left":r,"top-right":r,bottom:r,"bottom-left":r,"bottom-right":r,left:r,right:r}}return{center:e.P.convert(t.center||[0,0]),top:e.P.convert(t.top||[0,0]),"top-left":e.P.convert(t["top-left"]||[0,0]),"top-right":e.P.convert(t["top-right"]||[0,0]),bottom:e.P.convert(t.bottom||[0,0]),"bottom-left":e.P.convert(t["bottom-left"]||[0,0]),"bottom-right":e.P.convert(t["bottom-right"]||[0,0]),left:e.P.convert(t.left||[0,0]),right:e.P.convert(t.right||[0,0])}}return aa(new e.P(0,0))}const sa=r;t.AJAXError=e.cz,t.Event=e.l,t.Evented=e.E,t.LngLat=e.S,t.MercatorCoordinate=e.a1,t.Point=e.P,t.addProtocol=e.cA,t.config=e.a,t.removeProtocol=e.cB,t.AttributionControl=Ro,t.BoxZoomHandler=Gn,t.CanvasSource=Y,t.CooperativeGesturesHandler=Co,t.DoubleClickZoomHandler=vo,t.DragPanHandler=To,t.DragRotateHandler=So,t.EdgeInsets=Me,t.FullscreenControl=class extends e.E{constructor(t={}){super(),this._onFullscreenChange=()=>{var t;let e=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;null===(t=null==e?void 0:e.shadowRoot)||void 0===t?void 0:t.fullscreenElement;)e=e.shadowRoot.fullscreenElement;e===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,t&&t.container&&(t.container instanceof HTMLElement?this._container=t.container:e.w("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(t){return this._map=t,this._container||(this._container=this._map.getContainer()),this._controlContainer=s.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){s.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const t=this._fullscreenButton=s.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);s.create("span","maplibregl-ctrl-icon",t).setAttribute("aria-hidden","true"),t.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const t=this._getTitle();this._fullscreenButton.setAttribute("aria-label",t),this._fullscreenButton.title=t}_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 e.l("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new e.l("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()}},t.GeoJSONSource=W,t.GeolocateControl=class extends e.E{constructor(t){super(),this._onSuccess=t=>{if(this._map){if(this._isOutOfMapMaxBounds(t))return this._setErrorState(),this.fire(new e.l("outofmaxbounds",t)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=t,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 ${this._watchState}`)}this.options.showUserLocation&&"OFF"!==this._watchState&&this._updateMarker(t),this.options.trackUserLocation&&"ACTIVE_LOCK"!==this._watchState||this._updateCamera(t),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new e.l("geolocate",t)),this._finish()}},this._updateCamera=t=>{const r=new e.S(t.coords.longitude,t.coords.latitude),i=t.coords.accuracy,n=this._map.getBearing(),o=e.e({bearing:n},this.options.fitBoundsOptions),a=$.fromLngLat(r,i);this._map.fitBounds(a,o,{geolocateSource:!0})},this._updateMarker=t=>{if(t){const r=new e.S(t.coords.longitude,t.coords.latitude);this._accuracyCircleMarker.setLngLat(r).addTo(this._map),this._userLocationDotMarker.setLngLat(r).addTo(this._map),this._accuracy=t.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onZoom=()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},this._onError=t=>{if(this._map){if(1===t.code){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;const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t),void 0!==this._geolocationWatchID&&this._clearWatch()}else{if(3===t.code&&ta)return;this.options.trackUserLocation&&this._setErrorState()}"OFF"!==this._watchState&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new e.l("error",t)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",t=>t.preventDefault()),this._geolocateButton=s.create("button","maplibregl-ctrl-geolocate",this._container),s.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",this._geolocateButton.disabled=!0)},this._finishSetupUI=t=>{if(this._map){if(!1===t){e.w("Geolocation support is not available so the GeolocateControl will be disabled.");const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t)}else{const t=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=s.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new Yo({element:this._dotElement}),this._circleElement=s.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Yo({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",t=>{const r=(null==t?void 0:t[0])instanceof ResizeObserverEntry;t.geolocateSource||"ACTIVE_LOCK"!==this._watchState||r||this._map.isZooming()||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new e.l("trackuserlocationend")),this.fire(new e.l("userlocationlostfocus")))})}},this.options=e.e({},Jo,t)}onAdd(t){return this._map=t,this._container=s.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),function(){return e._(this,arguments,void 0,function*(t=!1){if(void 0!==Ho&&!t)return Ho;if(void 0===window.navigator.permissions)return Ho=!!window.navigator.geolocation,Ho;try{const t=yield window.navigator.permissions.query({name:"geolocation"});Ho="denied"!==t.state}catch(t){Ho=!!window.navigator.geolocation}return Ho})}().then(t=>this._finishSetupUI(t)),this._container}onRemove(){void 0!==this._geolocationWatchID&&(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(),s.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,Qo=0,ta=!1}_isOutOfMapMaxBounds(t){const e=this._map.getMaxBounds(),r=t.coords;return e&&(r.longitude<e.getWest()||r.longitude>e.getEast()||r.latitude<e.getSouth()||r.latitude>e.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 ${this._watchState}`)}}_updateCircleRadius(){const t=this._map.getBounds(),e=t.getSouthEast(),r=t.getNorthEast(),i=e.distanceTo(r),n=Math.ceil(this._accuracy/(i/this._map._container.clientHeight)*2);this._circleElement.style.width=`${n}px`,this._circleElement.style.height=`${n}px`}trigger(){if(!this._setup)return e.w("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new e.l("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":Qo--,ta=!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 e.l("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 e.l("trackuserlocationstart")),this.fire(new e.l("userlocationfocus"));break;default:throw new Error(`Unexpected watchState ${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 ${this._watchState}`)}if("OFF"===this._watchState&&void 0!==this._geolocationWatchID)this._clearWatch();else if(void 0===this._geolocationWatchID){let t;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),Qo++,Qo>1?(t={maximumAge:6e5,timeout:0},ta=!0):(t=this.options.positionOptions,ta=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,t)}}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)}},t.GlobeControl=class{constructor(){this._toggleProjection=()=>{var t;const e=null===(t=this._map.getProjection())||void 0===t?void 0:t.type;this._map.setProjection("mercator"!==e&&e?{type:"mercator"}:{type:"globe"}),this._updateGlobeIcon()},this._updateGlobeIcon=()=>{var t;this._globeButton.classList.remove("maplibregl-ctrl-globe"),this._globeButton.classList.remove("maplibregl-ctrl-globe-enabled"),"globe"===(null===(t=this._map.getProjection())||void 0===t?void 0:t.type)?(this._globeButton.classList.add("maplibregl-ctrl-globe-enabled"),this._globeButton.title=this._map._getUIString("GlobeControl.Disable")):(this._globeButton.classList.add("maplibregl-ctrl-globe"),this._globeButton.title=this._map._getUIString("GlobeControl.Enable"))}}onAdd(t){return this._map=t,this._container=s.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._globeButton=s.create("button","maplibregl-ctrl-globe",this._container),s.create("span","maplibregl-ctrl-icon",this._globeButton).setAttribute("aria-hidden","true"),this._globeButton.type="button",this._globeButton.addEventListener("click",this._toggleProjection),this._updateGlobeIcon(),this._map.on("styledata",this._updateGlobeIcon),this._container}onRemove(){s.remove(this._container),this._map.off("styledata",this._updateGlobeIcon),this._globeButton.removeEventListener("click",this._toggleProjection),this._map=void 0}},t.Hash=In,t.ImageSource=X,t.KeyboardHandler=mo,t.LngLatBounds=$,t.LogoControl=Do,t.Map=class extends ko{constructor(t){var r,i;e.cw.mark(e.cx.create);const n=Object.assign(Object.assign(Object.assign({},Zo),t),{canvasContextAttributes:Object.assign(Object.assign({},Zo.canvasContextAttributes),t.canvasContextAttributes)});if(null!=n.minZoom&&null!=n.maxZoom&&n.minZoom>n.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(null!=n.minPitch&&null!=n.maxPitch&&n.minPitch>n.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(null!=n.minPitch&&n.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(null!=n.maxPitch&&n.maxPitch>180)throw new Error("maxPitch must be less than or equal to 180");const o=new De,a=new Oe;if(void 0!==n.minZoom&&o.setMinZoom(n.minZoom),void 0!==n.maxZoom&&o.setMaxZoom(n.maxZoom),void 0!==n.minPitch&&o.setMinPitch(n.minPitch),void 0!==n.maxPitch&&o.setMaxPitch(n.maxPitch),void 0!==n.renderWorldCopies&&o.setRenderWorldCopies(n.renderWorldCopies),super(o,a,{bearingSnap:n.bearingSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new Lo,this._controls=[],this._mapId=e.a7(),this._contextLost=t=>{t.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new e.l("webglcontextlost",{originalEvent:t}))},this._contextRestored=t=>{this._setupPainter(),this.resize(),this._update(),this.fire(new e.l("webglcontextrestored",{originalEvent:t}))},this._onMapScroll=t=>{if(t.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=n.interactive,this._maxTileCacheSize=n.maxTileCacheSize,this._maxTileCacheZoomLevels=n.maxTileCacheZoomLevels,this._canvasContextAttributes=Object.assign({},n.canvasContextAttributes),this._trackResize=!0===n.trackResize,this._bearingSnap=n.bearingSnap,this._centerClampedToGround=n.centerClampedToGround,this._refreshExpiredTiles=!0===n.refreshExpiredTiles,this._fadeDuration=n.fadeDuration,this._crossSourceCollisions=!0===n.crossSourceCollisions,this._collectResourceTiming=!0===n.collectResourceTiming,this._locale=Object.assign(Object.assign({},Vo),n.locale),this._clickTolerance=n.clickTolerance,this._overridePixelRatio=n.pixelRatio,this._maxCanvasSize=n.maxCanvasSize,this.transformCameraUpdate=n.transformCameraUpdate,this.cancelPendingTileRequestsWhileZooming=!0===n.cancelPendingTileRequestsWhileZooming,this._imageQueueHandle=f.addThrottleControl(()=>this.isMoving()),this._requestManager=new m(n.transformRequest),"string"==typeof n.container){if(this._container=document.getElementById(n.container),!this._container)throw new Error(`Container '${n.container}' not found.`)}else{if(!(n.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=n.container}if(n.maxBounds&&this.setMaxBounds(n.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}),"undefined"!=typeof window){addEventListener("online",this._onWindowOnline,!1);let t=!1;const e=An(t=>{this._trackResize&&!this._removed&&(this.resize(t),this.redraw())},50);this._resizeObserver=new ResizeObserver(r=>{t?e(r):t=!0}),this._resizeObserver.observe(this._container)}this.handlers=new Eo(this,n),this._hash=n.hash&&new In("string"==typeof n.hash&&n.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:n.center,elevation:n.elevation,zoom:n.zoom,bearing:n.bearing,pitch:n.pitch,roll:n.roll}),n.bounds&&(this.resize(),this.fitBounds(n.bounds,e.e({},n.fitBoundsOptions,{duration:0}))));const s="string"==typeof n.style||!("globe"===(null===(i=null===(r=n.style)||void 0===r?void 0:r.projection)||void 0===i?void 0:i.type));this.resize(null,s),this._localIdeographFontFamily=n.localIdeographFontFamily,this._validateStyle=n.validateStyle,n.style&&this.setStyle(n.style,{localIdeographFontFamily:n.localIdeographFontFamily}),n.attributionControl&&this.addControl(new Ro("boolean"==typeof n.attributionControl?void 0:n.attributionControl)),n.maplibreLogo&&this.addControl(new Do,n.logoPosition),this.on("style.load",()=>{if(s||this._resizeTransform(),this.transform.unmodified){const t=e.Q(this.style.stylesheet,["center","zoom","bearing","pitch","roll"]);this.jumpTo(t)}}),this.on("data",t=>{this._update("style"===t.dataType),this.fire(new e.l(`${t.dataType}data`,t))}),this.on("dataloading",t=>{this.fire(new e.l(`${t.dataType}dataloading`,t))}),this.on("dataabort",t=>{this.fire(new e.l("sourcedataabort",t))})}_getMapId(){return this._mapId}setGlobalStateProperty(t,e){return this.style.setGlobalStateProperty(t,e),this._update(!0)}getGlobalState(){return this.style.getGlobalState()}addControl(t,r){if(void 0===r&&(r=t.getDefaultPosition?t.getDefaultPosition():"top-right"),!t||!t.onAdd)return this.fire(new e.k(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const i=t.onAdd(this);this._controls.push(t);const n=this._controlPositions[r];return-1!==r.indexOf("bottom")?n.insertBefore(i,n.firstChild):n.appendChild(i),this}removeControl(t){if(!t||!t.onRemove)return this.fire(new e.k(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const r=this._controls.indexOf(t);return r>-1&&this._controls.splice(r,1),t.onRemove(this),this}hasControl(t){return this._controls.indexOf(t)>-1}coveringTiles(t){return yt(this.transform,t)}calculateCameraOptionsFromTo(t,e,r,i){return null==i&&this.terrain&&(i=this.terrain.getElevationForLngLatZoom(r,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(t,e,r,i)}resize(t,r=!0){const[i,n]=this._containerDimensions(),o=this._getClampedPixelRatio(i,n);if(this._resizeCanvas(i,n,o),this.painter.resize(i,n,o),this.painter.overLimit()){const t=this.painter.context.gl;this._maxCanvasSize=[t.drawingBufferWidth,t.drawingBufferHeight];const e=this._getClampedPixelRatio(i,n);this._resizeCanvas(i,n,e),this.painter.resize(i,n,e)}this._resizeTransform(r);const a=!this._moving;return a&&(this.stop(),this.fire(new e.l("movestart",t)).fire(new e.l("move",t))),this.fire(new e.l("resize",t)),a&&this.fire(new e.l("moveend",t)),this}_resizeTransform(t=!0){var e;const[r,i]=this._containerDimensions();this.transform.resize(r,i,t),null===(e=this._requestedCameraState)||void 0===e||e.resize(r,i,t)}_getClampedPixelRatio(t,e){const{0:r,1:i}=this._maxCanvasSize,n=this.getPixelRatio(),o=t*n,a=e*n;return Math.min(o>r?r/o:1,a>i?i/a:1)*n}getPixelRatio(){var t;return null!==(t=this._overridePixelRatio)&&void 0!==t?t:devicePixelRatio}setPixelRatio(t){this._overridePixelRatio=t,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(t){return this.transform.setMaxBounds($.convert(t)),this._update()}setMinZoom(t){if((t=null==t?-2:t)>=-2&&t<=this.transform.maxZoom)return this.transform.setMinZoom(t),this._update(),this.getZoom()<t&&this.setZoom(t),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(t){if((t=null==t?22:t)>=this.transform.minZoom)return this.transform.setMaxZoom(t),this._update(),this.getZoom()>t&&this.setZoom(t),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(t){if((t=null==t?0:t)<0)throw new Error("minPitch must be greater than or equal to 0");if(t>=0&&t<=this.transform.maxPitch)return this.transform.setMinPitch(t),this._update(),this.getPitch()<t&&this.setPitch(t),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(t){if((t=null==t?60:t)>180)throw new Error("maxPitch must be less than or equal to 180");if(t>=this.transform.minPitch)return this.transform.setMaxPitch(t),this._update(),this.getPitch()>t&&this.setPitch(t),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(t){return this.transform.setRenderWorldCopies(t),this._update()}project(t){return this.transform.locationToScreenPoint(e.S.convert(t),this.style&&this.terrain)}unproject(t){return this.transform.screenPointToLocation(e.P.convert(t),this.terrain)}isMoving(){var t;return this._moving||(null===(t=this.handlers)||void 0===t?void 0:t.isMoving())}isZooming(){var t;return this._zooming||(null===(t=this.handlers)||void 0===t?void 0:t.isZooming())}isRotating(){var t;return this._rotating||(null===(t=this.handlers)||void 0===t?void 0:t.isRotating())}_createDelegatedListener(t,e,r){if("mouseenter"===t||"mouseover"===t){let i=!1;const n=n=>{const o=e.filter(t=>this.getLayer(t)),a=0!==o.length?this.queryRenderedFeatures(n.point,{layers:o}):[];a.length?i||(i=!0,r.call(this,new jn(t,this,n.originalEvent,{features:a}))):i=!1};return{layers:e,listener:r,delegates:{mousemove:n,mouseout:()=>{i=!1}}}}if("mouseleave"===t||"mouseout"===t){let i=!1;const n=n=>{const o=e.filter(t=>this.getLayer(t));(0!==o.length?this.queryRenderedFeatures(n.point,{layers:o}):[]).length?i=!0:i&&(i=!1,r.call(this,new jn(t,this,n.originalEvent)))},o=e=>{i&&(i=!1,r.call(this,new jn(t,this,e.originalEvent)))};return{layers:e,listener:r,delegates:{mousemove:n,mouseout:o}}}{const i=t=>{const i=e.filter(t=>this.getLayer(t)),n=0!==i.length?this.queryRenderedFeatures(t.point,{layers:i}):[];n.length&&(t.features=n,r.call(this,t),delete t.features)};return{layers:e,listener:r,delegates:{[t]:i}}}}_saveDelegatedListener(t,e){this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[t]=this._delegatedListeners[t]||[],this._delegatedListeners[t].push(e)}_removeDelegatedListener(t,e,r){if(!this._delegatedListeners||!this._delegatedListeners[t])return;const i=this._delegatedListeners[t];for(let t=0;t<i.length;t++){const n=i[t];if(n.listener===r&&n.layers.length===e.length&&n.layers.every(t=>e.includes(t))){for(const t in n.delegates)this.off(t,n.delegates[t]);return void i.splice(t,1)}}}on(t,e,r){if(void 0===r)return super.on(t,e);const i="string"==typeof e?[e]:e,n=this._createDelegatedListener(t,i,r);this._saveDelegatedListener(t,n);for(const t in n.delegates)this.on(t,n.delegates[t]);return{unsubscribe:()=>{this._removeDelegatedListener(t,i,r)}}}once(t,e,r){if(void 0===r)return super.once(t,e);const i="string"==typeof e?[e]:e,n=this._createDelegatedListener(t,i,r);for(const e in n.delegates){const o=n.delegates[e];n.delegates[e]=(...e)=>{this._removeDelegatedListener(t,i,r),o(...e)}}this._saveDelegatedListener(t,n);for(const t in n.delegates)this.once(t,n.delegates[t]);return this}off(t,e,r){return void 0===r?super.off(t,e):(this._removeDelegatedListener(t,"string"==typeof e?[e]:e,r),this)}queryRenderedFeatures(t,r){if(!this.style)return[];let i;const n=t instanceof e.P||Array.isArray(t),o=n?t:[[0,0],[this.transform.width,this.transform.height]];if(r=r||(n?{}:t)||{},o instanceof e.P||"number"==typeof o[0])i=[e.P.convert(o)];else{const t=e.P.convert(o[0]),r=e.P.convert(o[1]);i=[t,new e.P(r.x,t.y),r,new e.P(t.x,r.y),t]}return this.style.queryRenderedFeatures(i,r,this.transform)}querySourceFeatures(t,e){return this.style.querySourceFeatures(t,e)}setStyle(t,r){return!1!==(r=e.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},r)).diff&&r.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&t?(this._diffStyle(t,r),this):(this._localIdeographFontFamily=r.localIdeographFontFamily,this._updateStyle(t,r))}setTransformRequest(t){return this._requestManager.setTransformRequest(t),this}_getUIString(t){const e=this._locale[t];if(null==e)throw new Error(`Missing UI string '${t}'`);return e}_updateStyle(t,e){var r,i;if(e.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",()=>this._updateStyle(t,e));const n=this.style&&e.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!t)),t?(this.style=new wr(this,e||{}),this.style.setEventedParent(this,{style:this.style}),"string"==typeof t?this.style.loadURL(t,e,n):this.style.loadJSON(t,e,n),this):(null===(i=null===(r=this.style)||void 0===r?void 0:r.projection)||void 0===i||i.destroy(),delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new wr(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(t,r){if("string"==typeof t){const i=this._requestManager.transformRequest(t,"Style");e.j(i,new AbortController).then(t=>{this._updateDiff(t.data,r)}).catch(t=>{t&&this.fire(new e.k(t))})}else"object"==typeof t&&this._updateDiff(t,r)}_updateDiff(t,r){try{this.style.setState(t,r)&&this._update(!0)}catch(i){e.w(`Unable to perform style diff: ${i.message||i.error||i}. Rebuilding the style from scratch.`),this._updateStyle(t,r)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():e.w("There is no style added to the map.")}addSource(t,e){return this._lazyInitEmptyStyle(),this.style.addSource(t,e),this._update(!0)}isSourceLoaded(t){const r=this.style&&this.style.sourceCaches[t];if(void 0!==r)return r.loaded();this.fire(new e.k(new Error(`There is no source with ID '${t}'`)))}setTerrain(t){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),t){const r=this.style.sourceCaches[t.source];if(!r)throw new Error(`cannot load terrain, because there exists no source with ID: ${t.source}`);null===this.terrain&&r.reload();for(const r in this.style._layers){const i=this.style._layers[r];"hillshade"===i.type&&i.source===t.source&&e.w("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality."),"color-relief"===i.type&&i.source===t.source&&e.w("You are using the same source for a color-relief layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain=new Oo(this.painter,r,t),this.painter.renderToTexture=new No(this.painter,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._terrainDataCallback=e=>{var r;"style"===e.dataType?this.terrain.sourceCache.freeRtt():"source"===e.dataType&&e.tile&&(e.sourceId!==t.source||this._elevationFreeze||(this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))),"image"===(null===(r=e.source)||void 0===r?void 0:r.type)?this.terrain.sourceCache.freeRtt():this.terrain.sourceCache.freeRtt(e.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform.setMinElevationForCurrentTile(0),this._centerClampedToGround&&this.transform.setElevation(0);return this.fire(new e.l("terrain",{terrain:t})),this}getTerrain(){var t,e;return null!==(e=null===(t=this.terrain)||void 0===t?void 0:t.options)&&void 0!==e?e:null}areTilesLoaded(){const t=this.style&&this.style.sourceCaches;for(const e in t){const r=t[e]._tiles;for(const t in r){const e=r[t];if("loaded"!==e.state&&"errored"!==e.state)return!1}}return!0}removeSource(t){return this.style.removeSource(t),this._update(!0)}getSource(t){return this.style.getSource(t)}setSourceTileLodParams(t,e,r){if(r){const i=this.getSource(r);if(!i)throw new Error(`There is no source with ID "${r}", cannot set LOD parameters`);i.calculateTileZoom=mt(Math.max(1,t),Math.max(1,e))}else for(const r in this.style.sourceCaches)this.style.sourceCaches[r].getSource().calculateTileZoom=mt(Math.max(1,t),Math.max(1,e));return this._update(!0),this}refreshTiles(t,r){const i=this.style.sourceCaches[t];if(!i)throw new Error(`There is no source cache with ID "${t}", cannot refresh tile`);void 0===r?i.reload(!0):i.refreshTiles(r.map(t=>new e.a4(t.z,t.x,t.y)))}addImage(t,r,i={}){const{pixelRatio:n=1,sdf:o=!1,stretchX:s,stretchY:l,content:c,textFitWidth:h,textFitHeight:u}=i;if(this._lazyInitEmptyStyle(),!(r instanceof HTMLImageElement||e.b(r))){if(void 0===r.width||void 0===r.height)return this.fire(new e.k(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`")));{const{width:i,height:a,data:p}=r,d=r;return this.style.addImage(t,{data:new e.R({width:i,height:a},new Uint8Array(p)),pixelRatio:n,stretchX:s,stretchY:l,content:c,textFitWidth:h,textFitHeight:u,sdf:o,version:0,userImage:d}),d.onAdd&&d.onAdd(this,t),this}}{const{width:i,height:p,data:d}=a.getImageData(r);this.style.addImage(t,{data:new e.R({width:i,height:p},d),pixelRatio:n,stretchX:s,stretchY:l,content:c,textFitWidth:h,textFitHeight:u,sdf:o,version:0})}}updateImage(t,r){const i=this.style.getImage(t);if(!i)return this.fire(new e.k(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const n=r instanceof HTMLImageElement||e.b(r)?a.getImageData(r):r,{width:o,height:s,data:l}=n;if(void 0===o||void 0===s)return this.fire(new e.k(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(o!==i.data.width||s!==i.data.height)return this.fire(new e.k(new Error("The width and height of the updated image must be that same as the previous version of the image")));const c=!(r instanceof HTMLImageElement||e.b(r));return i.data.replace(l,c),this.style.updateImage(t,i),this}getImage(t){return this.style.getImage(t)}hasImage(t){return t?!!this.style.getImage(t):(this.fire(new e.k(new Error("Missing required image id"))),!1)}removeImage(t){this.style.removeImage(t)}loadImage(t){return f.getImage(this._requestManager.transformRequest(t,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(t,e){return this._lazyInitEmptyStyle(),this.style.addLayer(t,e),this._update(!0)}moveLayer(t,e){return this.style.moveLayer(t,e),this._update(!0)}removeLayer(t){return this.style.removeLayer(t),this._update(!0)}getLayer(t){return this.style.getLayer(t)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(t,e,r){return this.style.setLayerZoomRange(t,e,r),this._update(!0)}setFilter(t,e,r={}){return this.style.setFilter(t,e,r),this._update(!0)}getFilter(t){return this.style.getFilter(t)}setPaintProperty(t,e,r,i={}){return this.style.setPaintProperty(t,e,r,i),this._update(!0)}getPaintProperty(t,e){return this.style.getPaintProperty(t,e)}setLayoutProperty(t,e,r,i={}){return this.style.setLayoutProperty(t,e,r,i),this._update(!0)}getLayoutProperty(t,e){return this.style.getLayoutProperty(t,e)}setGlyphs(t,e={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(t,e),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(t,e,r={}){return this._lazyInitEmptyStyle(),this.style.addSprite(t,e,r,t=>{t||this._update(!0)}),this}removeSprite(t){return this._lazyInitEmptyStyle(),this.style.removeSprite(t),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(t,e={}){return this._lazyInitEmptyStyle(),this.style.setSprite(t,e,t=>{t||this._update(!0)}),this}setLight(t,e={}){return this._lazyInitEmptyStyle(),this.style.setLight(t,e),this._update(!0)}getLight(){return this.style.getLight()}setSky(t,e={}){return this._lazyInitEmptyStyle(),this.style.setSky(t,e),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(t,e){return this.style.setFeatureState(t,e),this._update()}removeFeatureState(t,e){return this.style.removeFeatureState(t,e),this._update()}getFeatureState(t){return this.style.getFeatureState(t)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let t=0,e=0;return this._container&&(t=this._container.clientWidth||400,e=this._container.clientHeight||300),[t,e]}_setupContainer(){const t=this._container;t.classList.add("maplibregl-map");const e=this._canvasContainer=s.create("div","maplibregl-canvas-container",t);this._interactive&&e.classList.add("maplibregl-interactive"),this._canvas=s.create("canvas","maplibregl-canvas",e),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex",this._interactive?"0":"-1"),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region");const r=this._containerDimensions(),i=this._getClampedPixelRatio(r[0],r[1]);this._resizeCanvas(r[0],r[1],i);const n=this._controlContainer=s.create("div","maplibregl-control-container",t),o=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(t=>{o[t]=s.create("div",`maplibregl-ctrl-${t} `,n)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(t,e,r){this._canvas.width=Math.floor(r*t),this._canvas.height=Math.floor(r*e),this._canvas.style.width=`${t}px`,this._canvas.style.height=`${e}px`}_setupPainter(){const t=Object.assign(Object.assign({},this._canvasContextAttributes),{alpha:!0,depth:!0,stencil:!0,premultipliedAlpha:!0});let e=null;this._canvas.addEventListener("webglcontextcreationerror",r=>{e={requestedAttributes:t},r&&(e.statusMessage=r.statusMessage,e.type=r.type)},{once:!0});let r=null;if(r=this._canvasContextAttributes.contextType?this._canvas.getContext(this._canvasContextAttributes.contextType,t):this._canvas.getContext("webgl2",t)||this._canvas.getContext("webgl",t),!r){const t="Failed to initialize WebGL";throw e?(e.message=t,new Error(JSON.stringify(e))):new Error(t)}this.painter=new Mn(r,this.transform),l.testSupport(r)}migrateProjection(t,r){super.migrateProjection(t,r),this.painter.transform=t,this.fire(new e.l("projectiontransition",{newProjection:this.style.projection.name}))}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(t){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||t,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(t){return this._update(),this._renderTaskQueue.add(t)}_cancelRenderFrame(t){this._renderTaskQueue.remove(t)}_render(t){var r,i,n,o,s;const l=this._idleTriggered?this._fadeDuration:0,c=(null===(r=this.style.projection)||void 0===r?void 0:r.transitionState)>0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(t),this._removed)return;let h=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const t=this.transform.zoom,r=a.now();this.style.zoomHistory.update(t,r);const i=new e.F(t,{now:r,fadeDuration:l,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition(),globalState:this.style.getGlobalState()}),n=i.crossFadingFactor();1===n&&n===this._crossFadingFactor||(h=!0,this._crossFadingFactor=n),this.style.update(i)}const u=(null===(i=this.style.projection)||void 0===i?void 0:i.transitionState)>0!==c;null===(n=this.style.projection)||void 0===n||n.setErrorQueryLatitudeDegrees(this.transform.center.lat),this.transform.setTransitionState(null===(o=this.style.projection)||void 0===o?void 0:o.transitionState,null===(s=this.style.projection)||void 0===s?void 0:s.latitudeErrorCorrectionRadians),this.style&&(this._sourcesDirty||u)&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),!this._elevationFreeze&&this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.setMinElevationForCurrentTile(0),this._centerClampedToGround&&this.transform.setElevation(0)),this._placementDirty=this.style&&this.style._updatePlacement(this.transform,this.showCollisionBoxes,l,this._crossSourceCollisions,u),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:l,showPadding:this.showPadding}),this.fire(new e.l("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,e.cw.mark(e.cx.load),this.fire(new e.l("load"))),this.style&&(this.style.hasTransitions()||h)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const p=this._sourcesDirty||this._styleDirty||this._placementDirty;return p||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new e.l("idle")),!this._loaded||this._fullyLoaded||p||(this._fullyLoaded=!0,e.cw.mark(e.cx.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var t;this._hash&&this._hash.remove();for(const t of this._controls)t.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),"undefined"!=typeof window&&removeEventListener("online",this._onWindowOnline,!1),f.removeThrottleControl(this._imageQueueHandle),null===(t=this._resizeObserver)||void 0===t||t.disconnect();const r=this.painter.context.gl.getExtension("WEBGL_lose_context");(null==r?void 0:r.loseContext)&&r.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),s.remove(this._canvasContainer),s.remove(this._controlContainer),this._container.removeEventListener("scroll",this._onMapScroll,!1),this._container.classList.remove("maplibregl-map"),e.cw.clearMetrics(),this._removed=!0,this.fire(new e.l("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,a.frame(this._frameRequest,t=>{e.cw.frame(t),this._frameRequest=null;try{this._render(t)}catch(t){if(!e.cy(t)&&!function(t){return t.message===Gi}(t))throw t}},()=>{}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(t){this._showTileBoundaries!==t&&(this._showTileBoundaries=t,this._update())}get showPadding(){return!!this._showPadding}set showPadding(t){this._showPadding!==t&&(this._showPadding=t,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(t){this._showCollisionBoxes!==t&&(this._showCollisionBoxes=t,t?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(t){this._showOverdrawInspector!==t&&(this._showOverdrawInspector=t,this._update())}get repaint(){return!!this._repaint}set repaint(t){this._repaint!==t&&(this._repaint=t,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(t){this._vertices=t,this._update()}get version(){return $o}getCameraTargetElevation(){return this.transform.elevation}getProjection(){return this.style.getProjection()}setProjection(t){return this._lazyInitEmptyStyle(),this.style.setProjection(t),this._update(!0)}},t.MapMouseEvent=jn,t.MapTouchEvent=Un,t.MapWheelEvent=Nn,t.Marker=Yo,t.NavigationControl=class{constructor(t){this._updateZoomButtons=()=>{const 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())},this._rotateCompassArrow=()=>{this._compassIcon.style.transform=this.options.visualizePitch&&this.options.visualizeRoll?`scale(${1/Math.pow(Math.cos(this._map.transform.pitchInRadians),.5)}) rotateZ(${-this._map.transform.roll}deg) rotateX(${this._map.transform.pitch}deg) rotateZ(${-this._map.transform.bearing}deg)`:this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitchInRadians),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${-this._map.transform.bearing}deg)`:this.options.visualizeRoll?`rotate(${-this._map.transform.bearing-this._map.transform.roll}deg)`:`rotate(${-this._map.transform.bearing}deg)`},this._setButtonTitle=(t,e)=>{const r=this._map._getUIString(`NavigationControl.${e}`);t.title=r,t.setAttribute("aria-label",r)},this.options=e.e({},Go,t),this._container=s.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",t=>t.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",t=>this._map.zoomIn({},{originalEvent:t})),s.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",t=>this._map.zoomOut({},{originalEvent:t})),s.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",t=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:t}):this._map.resetNorth({},{originalEvent:t})}),this._compassIcon=s.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.options.visualizeRoll&&this._map.on("roll",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new qo(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){s.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.options.visualizeRoll&&this._map.off("roll",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(t,e){const r=s.create("button",t,this._container);return r.type="button",r.addEventListener("click",e),r}},t.Popup=class extends e.E{constructor(t){super(),this._updateOpacity=()=>{void 0!==this.options.locationOccludedOpacity&&(this._container.style.opacity=this._map.transform.isLocationOccluded(this.getLngLat())?`${this.options.locationOccludedOpacity}`:"")},this.remove=()=>(this._content&&s.remove(this._content),this._container&&(s.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 e.l("close"))),this),this._onMouseUp=t=>{this._update(t.point)},this._onMouseMove=t=>{this._update(t.point)},this._onDrag=t=>{this._update(t.point)},this._update=t=>{if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=s.create("div","maplibregl-popup",this._map.getContainer()),this._tip=s.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const t of this.options.className.split(" "))this._container.classList.add(t);this._closeButton&&this._closeButton.setAttribute("aria-label",this._map._getUIString("Popup.Close")),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._lngLat=Wo(this._lngLat,this._flatPos,this._map.transform,this._trackPointer),this._trackPointer&&!t)return;const e=this._flatPos=this._pos=this._trackPointer&&t?t:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&t?t:this._map.transform.locationToScreenPoint(this._lngLat));let r=this.options.anchor;const i=aa(this.options.offset);if(!r){const t=this._container.offsetWidth,n=this._container.offsetHeight;let o;o=e.y+i.bottom.y<n?["top"]:e.y>this._map.transform.height-n?["bottom"]:[],e.x<t/2?o.push("left"):e.x>this._map.transform.width-t/2&&o.push("right"),r=0===o.length?"bottom":o.join("-")}let n=e.add(i[r]);this.options.subpixelPositioning||(n=n.round()),s.setTransform(this._container,`${Xo[r]} translate(${n.x}px,${n.y}px)`),Ko(this._container,r,"popup"),this._updateOpacity()},this._onClose=()=>{this.remove()},this.options=e.e(Object.create(na),t)}addTo(t){return this._map&&this.remove(),this._map=t,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 e.l("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=e.S.convert(t),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(t){return this.setDOMContent(document.createTextNode(t))}setHTML(t){const e=document.createDocumentFragment(),r=document.createElement("body");let i;for(r.innerHTML=t;i=r.firstChild,i;)e.appendChild(i);return this.setDOMContent(e)}getMaxWidth(){var t;return null===(t=this._container)||void 0===t?void 0:t.style.maxWidth}setMaxWidth(t){return this.options.maxWidth=t,this._update(),this}setDOMContent(t){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=s.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(t),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(t){return this._container&&this._container.classList.add(t),this}removeClassName(t){return this._container&&this._container.classList.remove(t),this}setOffset(t){return this.options.offset=t,this._update(),this}toggleClassName(t){if(this._container)return this._container.classList.toggle(t)}setSubpixelPositioning(t){this.options.subpixelPositioning=t}_createCloseButton(){this.options.closeButton&&(this._closeButton=s.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="&#215;",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const t=this._container.querySelector(oa);t&&t.focus()}},t.RasterDEMTileSource=H,t.RasterTileSource=q,t.ScaleControl=class{constructor(t){this._onMove=()=>{ra(this._map,this._container,this.options)},this.setUnit=t=>{this.options.unit=t,ra(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},ea),t)}getDefaultPosition(){return"bottom-left"}onAdd(t){return this._map=t,this._container=s.create("div","maplibregl-ctrl maplibregl-ctrl-scale",t.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){s.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},t.ScrollZoomHandler=bo,t.Style=wr,t.TerrainControl=class{constructor(t){this._toggleTerrain=()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()},this._updateTerrainIcon=()=>{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"))},this.options=t}onAdd(t){return this._map=t,this._container=s.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=s.create("button","maplibregl-ctrl-terrain",this._container),s.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(){s.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},t.TwoFingersTouchPitchHandler=po,t.TwoFingersTouchRotateHandler=ho,t.TwoFingersTouchZoomHandler=lo,t.TwoFingersTouchZoomRotateHandler=Po,t.VectorTileSource=G,t.VideoSource=K,t.addSourceType=(t,r)=>e._(void 0,void 0,void 0,function*(){if(Q(t))throw new Error(`A source type called "${t}" already exists.`);((t,e)=>{J[t]=e})(t,r)}),t.clearPrewarmedResources=function(){const t=R;t&&(t.isPreloaded()&&1===t.numActive()?(t.release(E),R=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()"))},t.createTileMesh=Xe,t.getMaxParallelImageRequests=function(){return e.a.MAX_PARALLEL_IMAGE_REQUESTS},t.getRTLTextPluginStatus=function(){return it().getRTLTextPluginStatus()},t.getVersion=function(){return sa},t.getWorkerCount=function(){return k.workerCount},t.getWorkerUrl=function(){return e.a.WORKER_URL},t.importScriptInWorkers=function(t){return B().broadcast("IS",t)},t.prewarm=function(){L().acquire(E)},t.setMaxParallelImageRequests=function(t){e.a.MAX_PARALLEL_IMAGE_REQUESTS=t},t.setRTLTextPlugin=function(t,e){return it().setRTLTextPlugin(t,e)},t.setWorkerCount=function(t){k.workerCount=t},t.setWorkerUrl=function(t){e.a.WORKER_URL=t}}),t}()},6537:t=>{"use strict";t.exports=function(t){return!!t&&("function"==typeof t||"object"==typeof t)}},6539:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 viewBox=%270 0 20 20%27%3E%3Cpath d=%27M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7%27/%3E%3Ccircle cx=%2710%27 cy=%2710%27 r=%272%27/%3E%3C/svg%3E"},6549:t=>{"use strict";t.exports=Object.getOwnPropertyDescriptor},6556:(t,e,r)=>{"use strict";var i=r(453),n=r(3126),o=n([i("%String.prototype.indexOf%")]);t.exports=function(t,e){var r=i(t,!!e);return"function"==typeof r&&o(t,".prototype.")>-1?n([r]):r}},6570:(t,e,r)=>{"use strict";var i=r(453),n=r(5880),o=i("%Number%"),a=i("%BigInt%",!0);t.exports=function(t,e,r,i){for(var s=i?a:o,l=s(0),c=0;c<t.length;c++)l+=s(t[c]*n(2,8*c));if(!r){var h=8*e;128&t[e-1]&&(l-=s(n(2,h)))}return l}},6575:(t,e,r)=>{"use strict";var i=r(9675),n=r(6556),o=n("%ArrayBuffer.prototype.resizable%",!0),a=n("%SharedArrayBuffer.prototype.growable%",!0),s=r(4670),l=r(7070);t.exports=function(t){var e=s(t),r=l(t);if(!e&&!r)throw new i("Assertion failed: `arrayBuffer` must be an ArrayBuffer or SharedArrayBuffer");return e&&o?!o(t):!r||!a||!a(t)}},6578:t=>{"use strict";t.exports=["Float16Array","Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]},6587:(t,e,r)=>{"use strict";var i=r(5880);t.exports=function(t){var e=128&t[7]?-1:1,r=(127&t[7])<<4|(240&t[6])>>4,n=281474976710656*(15&t[6])+1099511627776*t[5]+4294967296*t[4]+16777216*t[3]+65536*t[2]+256*t[1]+t[0];return 0===r&&0===n?0*e:2047===r&&0!==n?NaN:2047===r&&0===n?e*(1/0):-1023==(r-=1023)?e*n*5e-324:e*(1+n/4503599627370496)*i(2,r)}},6600:t=>{"use strict";t.exports=function(t){return null===t||"function"!=typeof t&&"object"!=typeof t}},6623:(t,e,r)=>{"use strict";var i=r(5767),n=r(3432),o=r(5795);function a(t){return Object.prototype.toString.call(t)}var s=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function l(t,e){if(t.forEach)return t.forEach(e);for(var r=0;r<t.length;r++)e(t[r],r,t)}var c=Object.keys||function(t){var e=[];for(var r in t)e[e.length]=r;return e},h=Object.prototype.propertyIsEnumerable,u=Object.getOwnPropertySymbols;function p(t){var e=c(t);if(u)for(var r=u(t),i=0;i<r.length;i++)h.call(t,r[i])&&(e[e.length]=r[i]);return e}var d=Object.prototype.hasOwnProperty||function(t,e){return e in t};function f(t,e){if("object"==typeof t&&null!==t){var r;if(s(t))r=[];else if("[object Date]"===a(t))r=new Date(t.getTime?t.getTime():t);else if("[object RegExp]"===a(t))r=new RegExp(t);else if(function(t){return"[object Error]"===a(t)}(t))r={message:t.message};else if(function(t){return"[object Boolean]"===a(t)}(t)||function(t){return"[object Number]"===a(t)}(t)||function(t){return"[object String]"===a(t)}(t))r=Object(t);else{if(i(t))return n(t);if(Object.create&&Object.getPrototypeOf)r=Object.create(Object.getPrototypeOf(t));else if(t.constructor===Object)r={};else{var o=t.constructor&&t.constructor.prototype||t.__proto__||{},h=function(){};h.prototype=o,r=new h}}return l((e.includeSymbols?p:c)(t),function(e){r[e]=t[e]}),r}return t}var m={__proto__:null};function g(t,e){var r=[],i=[],n=!0,a=arguments.length>2?arguments[2]:m,h=a.includeSymbols?p:c,u=!!a.immutable;return function t(c){var p=u?f(c,a):c,m={__proto__:null},g=!0,_={node:p,node_:c,path:[].concat(r),parent:i[i.length-1],parents:i,key:r[r.length-1],removedKeys:{__proto__:null},isRoot:0===r.length,level:r.length,circular:null,update:function(t,e){_.isRoot||(_.parent.node[_.key]=t),_.node=t,e&&(g=!1)},delete:function(t){delete _.parent.node[_.key],_.parent.removedKeys[_.key]=!0,t&&(g=!1)},remove:function(t){s(_.parent.node)?(_.parent.node.splice(_.key,1),_.parent.removedKeys[_.key]=!0,t&&(g=!1)):_.delete(t)},keys:null,before:function(t){m.before=t},after:function(t){m.after=t},pre:function(t){m.pre=t},post:function(t){m.post=t},stop:function(){n=!1},block:function(){g=!1}};if(!n)return _;function y(){if("object"==typeof _.node&&null!==_.node){_.keys&&_.node_===_.node||(_.keys=h(_.node)),_.isLeaf=0===_.keys.length;for(var t=0;t<i.length;t++)if(i[t].node_===c){_.circular=i[t];break}}else _.isLeaf=!0,_.keys=null;_.notLeaf=!_.isLeaf,_.notRoot=!_.isRoot}y();var b=e.call(_,_.node);return void 0!==b&&_.update&&_.update(b),m.before&&m.before.call(_,_.node),g?("object"!=typeof _.node||null===_.node||_.circular||(i[i.length]=_,y(),l(_.keys,function(e,i){var n=i-1 in _.removedKeys;n&&(e=_.keys[i-1]),r[r.length]=e,m.pre&&m.pre.call(_,_.node[e],e);var a=t(_.node[e]);u&&d.call(_.node,e)&&!function(t,e){if("function"!=typeof o)return!0;var r=o(t,e);return!r||!r.writable}(_.node,e)&&!n&&(_.node[e]=a.node),a.isLast=i===_.keys.length-1,a.isFirst=0===i,m.post&&m.post.call(_,a),r.pop()}),i.pop()),m.after&&m.after.call(_,_.node),_):_}(t).node}function _(t){this.options=arguments.length>1?arguments[1]:m,this.value=t}function y(t){return new _(t,arguments.length>1?arguments[1]:m)}_.prototype.get=function(t){for(var e=this.value,r=0;e&&r<t.length;r++){var i=t[r];if(!d.call(e,i)||!this.options.includeSymbols&&"symbol"==typeof i)return;e=e[i]}return e},_.prototype.has=function(t){var e=this.value;if(!e&&t.length>0)return!1;for(var r=0;e&&r<t.length;r++){var i=t[r];if(!d.call(e,i)||!this.options.includeSymbols&&"symbol"==typeof i)return!1;e=e[i]}return!0},_.prototype.set=function(t,e){for(var r=this.value,i=0;i<t.length-1;i++){var n=t[i];d.call(r,n)||(r[n]={}),r=r[n]}return r[t[i]]=e,e},_.prototype.map=function(t){return g(this.value,t,{__proto__:null,immutable:!0,includeSymbols:!!this.options.includeSymbols})},_.prototype.forEach=function(t){return this.value=g(this.value,t,this.options),this.value},_.prototype.reduce=function(t,e){var r=1===arguments.length,i=r?this.value:e;return this.forEach(function(e){this.isRoot&&r||(i=t.call(this,i,e))}),i},_.prototype.paths=function(){var t=[];return this.forEach(function(){t[t.length]=this.path}),t},_.prototype.nodes=function(){var t=[];return this.forEach(function(){t[t.length]=this.node}),t},_.prototype.clone=function(){var t=[],e=[],r=this.options;return i(this.value)?n(this.value):function i(n){for(var o=0;o<t.length;o++)if(t[o]===n)return e[o];if("object"==typeof n&&null!==n){var a=f(n,r);return t[t.length]=n,e[e.length]=a,l((r.includeSymbols?p:c)(n),function(t){a[t]=i(n[t])}),t.pop(),e.pop(),a}return n}(this.value)},l(p(_.prototype),function(t){y[t]=function(e){var r=[].slice.call(arguments,1),i=new _(e);return i[t].apply(i,r)}}),t.exports=y},6681:(t,e,r)=>{"use strict";var i=r(9675),n=r(7149),o=r(5910),a=r(5680),s=r(4372);t.exports=function(t,e){if(!a(t))throw new i("Assertion failed: `obj` must be a Typed Array");if("SEQ-CST"!==e&&"UNORDERED"!==e)throw new i("Assertion failed: `order` must be ~SEQ-CST~ or ~UNORDERED~");var r=s(t);return{"[[Object]]":t,"[[CachedBufferByteLength]]":o(r)?"DETACHED":n(r,e)}}},6694:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2722%27 height=%2722%27 fill=%27%2333b5e5%27 viewBox=%270 0 22 22%27%3E%3Cpath d=%27m1.754 13.406 4.453-4.851 3.09 3.09 3.281 3.277.969-.969-3.309-3.312 3.844-4.121 6.148 6.886h1.082v-.855l-7.207-8.07-4.84 5.187L6.169 6.57l-5.48 5.965v.871ZM.688 16.844h20.625v1.375H.688Zm0 0%27/%3E%3C/svg%3E"},6743:(t,e,r)=>{"use strict";var i=r(9353);t.exports=Function.prototype.bind||i},6897:(t,e,r)=>{"use strict";var i=r(453),n=r(41),o=r(592)(),a=r(5795),s=r(9675),l=i("%Math.floor%");t.exports=function(t,e){if("function"!=typeof t)throw new s("`fn` is not a function");if("number"!=typeof e||e<0||e>4294967295||l(e)!==e)throw new s("`length` must be a positive 32-bit integer");var r=arguments.length>2&&!!arguments[2],i=!0,c=!0;if("length"in t&&a){var h=a(t,"length");h&&!h.configurable&&(i=!1),h&&!h.writable&&(c=!1)}return(i||c||!r)&&(o?n(t,"length",e,!0,!0):n(t,"length",e)),t}},6966:(t,e,r)=>{"use strict";t.exports=r(9600)},7030:(t,e,r)=>{"use strict";var i=r(9675),n=r(5701),o=r(2997);t.exports=function(t){if(void 0!==t&&!n(t))throw new i("Assertion failed: `Desc` must be a Property Descriptor");return o(t)}},7035:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 fill=%27%23333%27 viewBox=%270 0 29 29%27%3E%3Cpath d=%27M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13z%27/%3E%3C/svg%3E"},7057:(t,e,r)=>{"use strict";var i=r(8068),n=r(9675),o=r(5767),a=r(9209)(),s=r(533),l=r(7732),c=r(9531),h=r(2697);t.exports=function(t,e){if(0===a.length)throw new i("Assertion failed: Typed Arrays are not supported in this environment");var r=o(t);if(!r)throw new n("Assertion failed: exemplar must be a TypedArray");if(!s(e))throw new n("Assertion failed: `argumentList` must be a List");var u=h(r);if("function"!=typeof u)throw new i("Assertion failed: `constructor` of `exemplar` ("+r+") must exist. Please report this!");var p=l(t,u);return c(p,e)}},7070:(t,e,r)=>{"use strict";var i=r(6556)("SharedArrayBuffer.prototype.byteLength",!0);t.exports=i?function(t){if(!t||"object"!=typeof t)return!1;try{return i(t),!0}catch(t){return!1}}:function(t){return!1}},7088:(t,e,r)=>{"use strict";var i=r(4224),n=r(8410),o=r(3384),a=r(3331);t.exports=function(t){var e=n(t);if(!a(e)||0===e)return 0;var r=o(e),s=i(r,256);return s>=128?s-256:s}},7119:t=>{"use strict";t.exports="undefined"!=typeof Reflect&&Reflect&&Reflect.apply},7149:(t,e,r)=>{"use strict";var i=r(9675),n=r(5910),o=r(4670),a=r(7070),s=r(9511),l=r(6556)("SharedArrayBuffer.prototype.byteLength",!0);t.exports=function(t,e){var r=a(t);if(!o(t)&&!r)throw new i("Assertion failed: `arrayBuffer` must be an ArrayBuffer or a SharedArrayBuffer");if("SEQ-CST"!==e&&"UNORDERED"!==e)throw new i("Assertion failed: `order` must be ~SEQ-CST~ or ~UNORDERED~");if(n(t))throw new i("Assertion failed: `arrayBuffer` must not be detached");return r?l(t):s(t)}},7176:(t,e,r)=>{"use strict";var i,n=r(3126),o=r(5795);try{i=[].__proto__===Array.prototype}catch(t){if(!t||"object"!=typeof t||!("code"in t)||"ERR_PROTO_ACCESS"!==t.code)throw t}var a=!!i&&o&&o(Object.prototype,"__proto__"),s=Object,l=s.getPrototypeOf;t.exports=a&&"function"==typeof a.get?n([a.get]):"function"==typeof l&&function(t){return l(null==t?t:s(t))}},7196:(t,e,r)=>{"use strict";var i=r(8410),n=r(3384),o=r(4459),a=r(3331);t.exports=function(t){var e=i(t);return o(e)||0===e?0:a(e)?n(e):e}},7440:(t,e,r)=>{"use strict";var i=r(1514),n=r(8968),o=r(4459),a=r(3331);t.exports=function(t){if("number"!=typeof t||o(t)||!a(t))return!1;var e=i(t);return n(e)===e}},7603:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 viewBox=%270 0 29 29%27%3E%3Cpath d=%27M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1z%27/%3E%3C/svg%3E"},7659:t=>{"use strict";var e={};t.exports=function(t,r){var i=function(t){if(void 0===e[t]){var r=document.querySelector(t);if(window.HTMLIFrameElement&&r instanceof window.HTMLIFrameElement)try{r=r.contentDocument.head}catch(t){r=null}e[t]=r}return e[t]}(t);if(!i)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");i.appendChild(r)}},7695:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 fill=%27%2333b5e5%27 viewBox=%270 0 20 20%27%3E%3Cpath d=%27M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7%27/%3E%3C/svg%3E"},7732:(t,e,r)=>{"use strict";var i=r(453)("%Symbol.species%",!0),n=r(9675),o=r(6537),a=r(4528);t.exports=function(t,e){if(!o(t))throw new n("Assertion failed: Type(O) is not Object");var r=t.constructor;if(void 0===r)return e;if(!o(r))throw new n("O.constructor is not an Object");var s=i?r[i]:void 0;if(null==s)return e;if(a(s))return s;throw new n("no constructor found")}},7825:t=>{"use strict";t.exports=function(t){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var e=t.insertStyleElement(t);return{update:function(r){!function(t,e,r){var i="";r.supports&&(i+="@supports (".concat(r.supports,") {")),r.media&&(i+="@media ".concat(r.media," {"));var n=void 0!==r.layer;n&&(i+="@layer".concat(r.layer.length>0?" ".concat(r.layer):""," {")),i+=r.css,n&&(i+="}"),r.media&&(i+="}"),r.supports&&(i+="}");var o=r.sourceMap;o&&"undefined"!=typeof btoa&&(i+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(o))))," */")),e.styleTagTransform(i,t,e.options)}(e,t,r)},remove:function(){!function(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t)}(e)}}}},7842:t=>{"use strict";var e,r="function"==typeof WeakMap&&WeakMap.prototype?WeakMap:null,i="function"==typeof WeakSet&&WeakSet.prototype?WeakSet:null;r||(e=function(t){return!1});var n=r?r.prototype.has:null,o=i?i.prototype.has:null;e||n||(e=function(t){return!1}),t.exports=e||function(t){if(!t||"object"!=typeof t)return!1;try{if(n.call(t,n),o)try{o.call(t,o)}catch(t){return!0}return t instanceof r}catch(t){}return!1}},7881:t=>{"use strict";t.exports=function(t){return"BIGUINT64"===t||"BIGINT64"===t}},7914:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2788%27 height=%2723%27 fill=%27none%27%3E%3Cpath fill=%27%23000%27 fill-opacity=%27.4%27 fill-rule=%27evenodd%27 d=%27M17.408 16.796h-1.827l2.501-12.095h.198l3.324 6.533.988 2.19.988-2.19 3.258-6.533h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.929 5.644h-.098l-2.914-5.644-.757-1.71-.345 1.71zm1.958-3.42-.726 3.663a1.255 1.255 0 0 1-1.232 1.011h-1.827a1.255 1.255 0 0 1-1.229-1.509l2.501-12.095a1.255 1.255 0 0 1 1.23-1.001h.197a1.25 1.25 0 0 1 1.12.685l3.19 6.273 3.125-6.263a1.25 1.25 0 0 1 1.123-.695h.181a1.255 1.255 0 0 1 1.227.991l1.443 6.71a5 5 0 0 1 .314-.787l.009-.016a4.6 4.6 0 0 1 1.777-1.887c.782-.46 1.668-.667 2.611-.667a4.6 4.6 0 0 1 1.7.32l.306.134c.21-.16.474-.256.759-.256h1.694a1.255 1.255 0 0 1 1.212.925 1.255 1.255 0 0 1 1.212-.925h1.711c.284 0 .545.094.755.252.613-.3 1.312-.45 2.075-.45 1.356 0 2.557.445 3.482 1.4q.47.48.763 1.064V4.701a1.255 1.255 0 0 1 1.255-1.255h1.86A1.255 1.255 0 0 1 54.44 4.7v9.194h2.217c.19 0 .37.043.532.118v-4.77c0-.356.147-.678.385-.906a2.42 2.42 0 0 1-.682-1.71c0-.665.267-1.253.735-1.7a2.45 2.45 0 0 1 1.722-.674 2.43 2.43 0 0 1 1.705.675q.318.302.504.683V4.7a1.255 1.255 0 0 1 1.255-1.255h1.744A1.255 1.255 0 0 1 65.812 4.7v3.335a4.8 4.8 0 0 1 1.526-.246c.938 0 1.817.214 2.59.69a4.47 4.47 0 0 1 1.67 1.743v-.98a1.255 1.255 0 0 1 1.256-1.256h1.777c.233 0 .451.064.639.174a3.4 3.4 0 0 1 1.567-.372c.346 0 .861.02 1.285.232a1.25 1.25 0 0 1 .689 1.004 4.7 4.7 0 0 1 .853-.588c.795-.44 1.675-.647 2.61-.647 1.385 0 2.65.39 3.525 1.396.836.938 1.168 2.173 1.168 3.528q-.001.515-.056 1.051a1.255 1.255 0 0 1-.947 1.09l.408.952a1.255 1.255 0 0 1-.477 1.552c-.418.268-.92.463-1.458.612-.613.171-1.304.244-2.049.244-1.06 0-2.043-.207-2.886-.698l-.015-.008c-.798-.48-1.419-1.135-1.818-1.963l-.004-.008a5.8 5.8 0 0 1-.548-2.512q0-.429.053-.843a1.3 1.3 0 0 1-.333-.086l-.166-.004c-.223 0-.426.062-.643.228-.03.024-.142.139-.142.59v3.883a1.255 1.255 0 0 1-1.256 1.256h-1.777a1.255 1.255 0 0 1-1.256-1.256V15.69l-.032.057a4.8 4.8 0 0 1-1.86 1.833 5.04 5.04 0 0 1-2.484.634 4.5 4.5 0 0 1-1.935-.424 1.25 1.25 0 0 1-.764.258h-1.71a1.255 1.255 0 0 1-1.256-1.255V7.687a2.4 2.4 0 0 1-.428.625c.253.23.412.561.412.93v7.553a1.255 1.255 0 0 1-1.256 1.255h-1.843a1.25 1.25 0 0 1-.894-.373c-.228.23-.544.373-.894.373H51.32a1.255 1.255 0 0 1-1.256-1.255v-1.251l-.061.117a4.7 4.7 0 0 1-1.782 1.884 4.77 4.77 0 0 1-2.485.67 5.6 5.6 0 0 1-1.485-.188l.009 2.764a1.255 1.255 0 0 1-1.255 1.259h-1.729a1.255 1.255 0 0 1-1.255-1.255v-3.537a1.255 1.255 0 0 1-1.167.793h-1.679a1.25 1.25 0 0 1-.77-.263 4.5 4.5 0 0 1-1.945.429c-.885 0-1.724-.21-2.495-.632l-.017-.01a5 5 0 0 1-1.081-.836 1.255 1.255 0 0 1-1.254 1.312h-1.81a1.255 1.255 0 0 1-1.228-.99l-.782-3.625-2.044 3.939a1.25 1.25 0 0 1-1.115.676h-.098a1.25 1.25 0 0 1-1.116-.68l-2.061-3.994zM35.92 16.63l.207-.114.223-.15q.493-.356.735-.785l.061-.118.033 1.332h1.678V9.242h-1.694l-.033 1.267q-.133-.329-.526-.658l-.032-.028a3.2 3.2 0 0 0-.668-.428l-.27-.12a3.3 3.3 0 0 0-1.235-.23q-1.136-.001-1.974.493a3.36 3.36 0 0 0-1.3 1.382q-.445.89-.444 2.074 0 1.2.51 2.107a3.8 3.8 0 0 0 1.382 1.381 3.9 3.9 0 0 0 1.893.477q.795 0 1.455-.33zm-2.789-5.38q-.576.675-.575 1.762 0 1.102.559 1.794.576.675 1.645.675a2.25 2.25 0 0 0 .934-.19 2.2 2.2 0 0 0 .468-.29l.178-.161a2.2 2.2 0 0 0 .397-.561q.244-.5.244-1.15v-.115q0-.708-.296-1.267l-.043-.077a2.2 2.2 0 0 0-.633-.709l-.13-.086-.047-.028a2.1 2.1 0 0 0-1.073-.285q-1.052 0-1.629.692zm2.316 2.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.96.96 0 0 0-.353-.389.85.85 0 0 0-.464-.127c-.4 0-.56.114-.664.239l-.01.012c-.148.174-.275.45-.275.945 0 .506.122.801.27.99.097.11.266.224.68.224.303 0 .504-.09.687-.269zm7.545 1.705a2.6 2.6 0 0 0 .331.423q.319.33.755.548l.173.074q.65.255 1.49.255 1.02 0 1.844-.493a3.45 3.45 0 0 0 1.316-1.4q.493-.904.493-2.089 0-1.909-.988-2.913-.988-1.02-2.584-1.02-.898 0-1.575.347a3 3 0 0 0-.415.262l-.199.166a3.4 3.4 0 0 0-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138q.206.29.48.5l.155.11.053.034q.51.296 1.119.297 1.07 0 1.645-.675.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.435 0-.835.16a2 2 0 0 0-.284.136 2 2 0 0 0-.363.254 2.2 2.2 0 0 0-.46.569l-.082.162a2.6 2.6 0 0 0-.213 1.072v.115q0 .707.296 1.267l.135.211zm.964-.818a1.1 1.1 0 0 0 .367.385.94.94 0 0 0 .476.118c.423 0 .59-.117.687-.23.159-.194.28-.478.28-.95 0-.53-.133-.8-.266-.952l-.021-.025c-.078-.094-.231-.221-.68-.221a1 1 0 0 0-.503.135l-.012.007a.86.86 0 0 0-.335.343c-.073.133-.132.324-.132.614v.115a1.4 1.4 0 0 0 .14.66zm15.7-6.222q.347-.346.346-.856a1.05 1.05 0 0 0-.345-.79 1.18 1.18 0 0 0-.84-.329q-.51 0-.855.33a1.05 1.05 0 0 0-.346.79q0 .51.346.855.345.346.856.346.51 0 .839-.346zm4.337 9.314.033-1.332q.191.403.59.747l.098.081a4 4 0 0 0 .316.224l.223.122a3.2 3.2 0 0 0 1.44.322 3.8 3.8 0 0 0 1.875-.477 3.5 3.5 0 0 0 1.382-1.366q.527-.89.526-2.09 0-1.184-.444-2.073a3.24 3.24 0 0 0-1.283-1.399q-.823-.51-1.942-.51a3.5 3.5 0 0 0-1.527.344l-.086.043-.165.09a3 3 0 0 0-.33.214q-.432.315-.656.707a2 2 0 0 0-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.5 2.5 0 0 0 .566.7q.117.098.245.18l.144.08a2.1 2.1 0 0 0 .975.232q1.07 0 1.645-.675.576-.69.576-1.778 0-1.102-.576-1.777-.56-.691-1.645-.692a2.2 2.2 0 0 0-1.015.235q-.22.113-.415.282l-.15.142a2.1 2.1 0 0 0-.42.594q-.223.479-.223 1.1v.115q0 .705.293 1.26zm2.616-.293c.157-.191.28-.479.28-.967 0-.51-.13-.79-.276-.961l-.021-.026c-.082-.1-.232-.225-.67-.225a.87.87 0 0 0-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0 .285.057.499.144.669a1.1 1.1 0 0 0 .367.405c.137.082.28.123.455.123.423 0 .59-.118.686-.23zm8.266-3.013q.345-.13.724-.14l.069-.002q.493 0 .642.099l.247-1.794q-.196-.099-.717-.099a2.3 2.3 0 0 0-.545.063 2 2 0 0 0-.411.148 2.2 2.2 0 0 0-.4.249 2.5 2.5 0 0 0-.485.499 2.7 2.7 0 0 0-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884q0-.546.159-.943a1.5 1.5 0 0 1 .466-.636 2.5 2.5 0 0 1 .399-.253 2 2 0 0 1 .224-.099zm9.784 2.656.05-.922q0-1.743-.856-2.698-.838-.97-2.584-.97-1.119-.001-2.007.493a3.46 3.46 0 0 0-1.4 1.382q-.493.906-.493 2.106 0 1.07.428 1.975.428.89 1.332 1.432.906.526 2.255.526.973 0 1.668-.185l.044-.012.135-.04q.613-.184.984-.421l-.542-1.267q-.3.162-.642.274l-.297.087q-.51.131-1.3.131-.954 0-1.497-.444a1.6 1.6 0 0 1-.192-.193q-.366-.44-.512-1.234l-.004-.021zm-5.427-1.256-.003.022h3.752v-.138q-.011-.727-.288-1.118a1 1 0 0 0-.156-.176q-.46-.428-1.316-.428-.986 0-1.494.604-.379.45-.494 1.234zm-27.053 2.77V4.7h-1.86v12.095h5.333V15.15zm7.103-5.908v7.553h-1.843V9.242h1.843z%27/%3E%3Cpath fill=%27%23fff%27 d=%27m19.63 11.151-.757-1.71-.345 1.71-1.12 5.644h-1.827L18.083 4.7h.197l3.325 6.533.988 2.19.988-2.19L26.839 4.7h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.93 5.644h-.098l-2.913-5.644zm14.836 5.81q-1.02 0-1.893-.478a3.8 3.8 0 0 1-1.381-1.382q-.51-.906-.51-2.106 0-1.185.444-2.074a3.36 3.36 0 0 1 1.3-1.382q.839-.494 1.974-.494a3.3 3.3 0 0 1 1.234.231 3.3 3.3 0 0 1 .97.575q.396.33.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332q-.279.593-1.02 1.053a3.17 3.17 0 0 1-1.662.444zm.296-1.482q.938 0 1.58-.642.642-.66.642-1.711v-.115q0-.708-.296-1.267a2.2 2.2 0 0 0-.807-.872 2.1 2.1 0 0 0-1.119-.313q-1.053 0-1.629.692-.575.675-.575 1.76 0 1.103.559 1.795.577.675 1.645.675zm6.521-6.237h1.711v1.4q.906-1.597 2.83-1.597 1.596 0 2.584 1.02.988 1.005.988 2.914 0 1.185-.493 2.09a3.46 3.46 0 0 1-1.316 1.399 3.5 3.5 0 0 1-1.844.493q-.954 0-1.662-.329a2.67 2.67 0 0 1-1.086-.97l.017 5.134h-1.728zm4.048 6.22q1.07 0 1.645-.674.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.592 0-1.12.296-.51.28-.822.823-.296.527-.296 1.234v.115q0 .708.296 1.267.313.543.823.855.51.296 1.119.297z%27/%3E%3Cpath fill=%27%23e1e3e9%27 d=%27M51.325 4.7h1.86v10.45h3.473v1.646h-5.333zm7.12 4.542h1.843v7.553h-1.843zm.905-1.415a1.16 1.16 0 0 1-.856-.346 1.17 1.17 0 0 1-.346-.856 1.05 1.05 0 0 1 .346-.79q.346-.329.856-.329.494 0 .839.33a1.05 1.05 0 0 1 .345.79 1.16 1.16 0 0 1-.345.855q-.33.346-.84.346zm7.875 9.133a3.17 3.17 0 0 1-1.662-.444q-.723-.46-1.004-1.053l-.033 1.332h-1.71V4.701h1.743v4.657l-.082 1.283q.279-.658 1.086-1.119a3.5 3.5 0 0 1 1.778-.477q1.119 0 1.942.51a3.24 3.24 0 0 1 1.283 1.4q.445.888.444 2.072 0 1.201-.526 2.09a3.5 3.5 0 0 1-1.382 1.366 3.8 3.8 0 0 1-1.876.477zm-.296-1.481q1.069 0 1.645-.675.577-.69.577-1.778 0-1.102-.577-1.776-.56-.691-1.645-.692a2.12 2.12 0 0 0-1.58.659q-.642.641-.642 1.694v.115q0 .71.296 1.267a2.4 2.4 0 0 0 .807.872 2.1 2.1 0 0 0 1.119.313zm5.927-6.237h1.777v1.481q.263-.757.856-1.217a2.14 2.14 0 0 1 1.349-.46q.527 0 .724.098l-.247 1.794q-.149-.099-.642-.099-.774 0-1.416.494-.626.493-.626 1.58v3.883h-1.777V9.242zm9.534 7.718q-1.35 0-2.255-.526-.904-.543-1.332-1.432a4.6 4.6 0 0 1-.428-1.975q0-1.2.493-2.106a3.46 3.46 0 0 1 1.4-1.382q.889-.495 2.007-.494 1.744 0 2.584.97.855.956.856 2.7 0 .444-.05.92h-5.43q.18 1.005.708 1.45.542.443 1.497.443.79 0 1.3-.131a4 4 0 0 0 .938-.362l.542 1.267q-.411.263-1.119.46-.708.198-1.711.197zm1.596-4.558q.016-1.02-.444-1.432-.46-.428-1.316-.428-1.728 0-1.991 1.86z%27/%3E%3Cpath d=%27M5.074 15.948a.484.657 0 0 0-.486.659v1.84a.484.657 0 0 0 .486.659h4.101a.484.657 0 0 0 .486-.659v-1.84a.484.657 0 0 0-.486-.659zm3.56 1.16H5.617v.838h3.017z%27 style=%27fill:%23fff;fill-rule:evenodd;stroke-width:1.03600001%27/%3E%3Cg style=%27stroke-width:1.12603545%27%3E%3Cpath d=%27M-9.408-1.416c-3.833-.025-7.056 2.912-7.08 6.615-.02 3.08 1.653 4.832 3.107 6.268.903.892 1.721 1.74 2.32 2.902l-.525-.004c-.543-.003-.992.304-1.24.639a1.87 1.87 0 0 0-.362 1.121l-.011 1.877c-.003.402.104.787.347 1.125.244.338.688.653 1.23.656l4.142.028c.542.003.99-.306 1.238-.641a1.87 1.87 0 0 0 .363-1.121l.012-1.875a1.87 1.87 0 0 0-.348-1.127c-.243-.338-.688-.653-1.23-.656l-.518-.004c.597-1.145 1.425-1.983 2.348-2.87 1.473-1.414 3.18-3.149 3.2-6.226-.016-3.59-2.923-6.684-6.993-6.707m-.006 1.1v.002c3.274.02 5.92 2.532 5.9 5.6-.017 2.706-1.39 4.026-2.863 5.44-1.034.994-2.118 2.033-2.814 3.633-.018.041-.052.055-.075.065q-.013.004-.02.01a.34.34 0 0 1-.226.084.34.34 0 0 1-.224-.086l-.092-.077c-.699-1.615-1.768-2.669-2.781-3.67-1.454-1.435-2.797-2.762-2.78-5.478.02-3.067 2.7-5.545 5.975-5.523m-.02 2.826c-1.62-.01-2.944 1.315-2.955 2.96-.01 1.646 1.295 2.988 2.916 2.999h.002c1.621.01 2.943-1.316 2.953-2.961.011-1.646-1.294-2.988-2.916-2.998m-.005 1.1c1.017.006 1.829.83 1.822 1.89s-.83 1.874-1.848 1.867c-1.018-.006-1.829-.83-1.822-1.89s.83-1.874 1.848-1.868m-2.155 11.857 4.14.025c.271.002.49.305.487.676l-.013 1.875c-.003.37-.224.67-.495.668l-4.14-.025c-.27-.002-.487-.306-.485-.676l.012-1.875c.003-.37.224-.67.494-.668%27 style=%27color:%23000;font-style:normal;font-variant:normal;font-weight:400;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:%23000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:evenodd;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:%23000;solid-opacity:1;vector-effect:none;fill:%23000;fill-opacity:.4;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto%27 transform=%27translate%2815.553 2.85%29scale%28.88807%29%27/%3E%3Cpath d=%27M-9.415-.316C-12.69-.338-15.37 2.14-15.39 5.207c-.017 2.716 1.326 4.041 2.78 5.477 1.013 1 2.081 2.055 2.78 3.67l.092.076a.34.34 0 0 0 .225.086.34.34 0 0 0 .227-.083l.019-.01c.022-.009.057-.024.074-.064.697-1.6 1.78-2.64 2.814-3.634 1.473-1.414 2.847-2.733 2.864-5.44.02-3.067-2.627-5.58-5.901-5.601m-.057 8.784c1.621.011 2.944-1.315 2.955-2.96.01-1.646-1.295-2.988-2.916-2.999-1.622-.01-2.945 1.315-2.955 2.96s1.295 2.989 2.916 3%27 style=%27clip-rule:evenodd;fill:%23e1e3e9;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4%27 transform=%27translate%2815.553 2.85%29scale%28.88807%29%27/%3E%3Cpath d=%27M-11.594 15.465c-.27-.002-.492.297-.494.668l-.012 1.876c-.003.371.214.673.485.675l4.14.027c.271.002.492-.298.495-.668l.012-1.877c.003-.37-.215-.672-.485-.674z%27 style=%27clip-rule:evenodd;fill:%23fff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4%27 transform=%27translate%2815.553 2.85%29scale%28.88807%29%27/%3E%3C/g%3E%3C/svg%3E"},8002:t=>{"use strict";t.exports=Math.min},8013:(t,e,r)=>{"use strict";var i=r(8452).supportsDescriptors,n=r(4462)(),o=r(2747),a=Object.defineProperty,s=TypeError;t.exports=function(){var t=o();if(n)return t;if(!i)throw new s("Shimming Function.prototype.name support requires ES5 property descriptor support.");var e=Function.prototype;return a(e,"name",{configurable:!0,enumerable:!1,get:function(){var r=t.call(this);return this!==e&&a(this,"name",{configurable:!0,enumerable:!1,value:r,writable:!1}),r}}),t}},8017:t=>{"use strict";t.exports=function(t){return 0===t&&1/t==-1/0}},8068:t=>{"use strict";t.exports=SyntaxError},8131:(t,e,r)=>{"use strict";var i=r(9675),n=r(9957),o=r(5701);t.exports=function(t){if(void 0===t)return!1;if(!o(t))throw new i("Assertion failed: `Desc` must be a Property Descriptor");return!(!n(t,"[[Value]]")&&!n(t,"[[Writable]]"))}},8164:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 fill=%27%23fff%27 viewBox=%270 0 29 29%27%3E%3Cpath d=%27M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13z%27/%3E%3C/svg%3E"},8173:(t,e,r)=>{"use strict";var i=r(6556)("WeakRef.prototype.deref",!0);t.exports="undefined"==typeof WeakRef?function(t){return!1}:function(t){if(!t||"object"!=typeof t)return!1;try{return i(t),!0}catch(t){return!1}}},8184:(t,e,r)=>{"use strict";var i=r(6556),n=r(9721)(/^\s*(?:function)?\*/),o=r(9092)(),a=r(3628),s=i("Object.prototype.toString"),l=i("Function.prototype.toString"),c=r(4233);t.exports=function(t){if("function"!=typeof t)return!1;if(n(l(t)))return!0;if(!o)return"[object GeneratorFunction]"===s(t);if(!a)return!1;var e=c();return e&&a(t)===e.prototype}},8186:t=>{t.exports=function(t){if(!t||!t.type)return null;var r=e[t.type];return r?"geometry"===r?{type:"FeatureCollection",features:[{type:"Feature",properties:{},geometry:t}]}:"feature"===r?{type:"FeatureCollection",features:[t]}:"featurecollection"===r?t:void 0:null};var e={Point:"geometry",MultiPoint:"geometry",LineString:"geometry",MultiLineString:"geometry",Polygon:"geometry",MultiPolygon:"geometry",GeometryCollection:"geometry",Feature:"feature",FeatureCollection:"featurecollection"}},8206:(t,e,r)=>{"use strict";var i=r(5388),n=r(4810),o=r(6556)("String.prototype.replace"),a=/^\s$/.test("᠎"),s=a?/^[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+/:/^[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+/,l=a?/[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+$/:/[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+$/;t.exports=function(){var t=n(i(this));return o(o(t,s,""),l,"")}},8213:(t,e,r)=>{"use strict";var i=r(8968);t.exports=function(t){for(var e,r="";t>0;)r=(e=t/2)===(t=i(e))?"0"+r:"1"+r;return r}},8268:(t,e,r)=>{"use strict";var i=r(9675),n=r(280),o=r(9901),a=r(5910),s=r(6188),l=r(8002),c=r(2076),h=r(2138),u=r(7196),p=r(4810),d=r(4742),f=r(6419),m=r(7057),g=r(1509),_=r(4372),y=r(2308);t.exports=function(t,e){var r=this;g(r,"SEQ-CST");var b,v=r.length,x=u(t);b=x===-1/0?0:x<0?s(v+x,0):l(x,v);var w,T=void 0===e?v:u(e);w=T===-1/0?0:T<0?s(v+T,0):l(T,v);var S=s(w-b,0),P=m(r,[S]);if(S>0){if(a(_(r)))throw new i("Cannot use a Typed Array with an underlying ArrayBuffer that is detached");if(f(r)===f(P))for(var C=_(r),M=_(P),A=d(r),I=b*A+y(r),E=y(P),k=E+S*A;E<k;){var z=o(C,I,"UINT8",!0,"UNORDERED");h(M,E,"UINT8",z,!0,"UNORDERED"),I+=1,E+=1}else for(var R=0;b<w;){var D=p(b),L=n(r,D);c(P,p(R),L,!0),b+=1,R+=1}}return P}},8410:(t,e,r)=>{"use strict";var i=r(453),n=r(9675),o=i("%Number%"),a=r(6600),s=r(866),l=r(8679);t.exports=function(t){var e=a(t)?t:s(t,o);if("symbol"==typeof e)throw new n("Cannot convert a Symbol value to a number");if("bigint"==typeof e)throw new n("Conversion from 'BigInt' to 'number' is not allowed.");return"string"==typeof e?l(e):+e}},8452:(t,e,r)=>{"use strict";var i=r(1189),n="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,a=Array.prototype.concat,s=r(41),l=r(592)(),c=function(t,e,r,i){if(e in t)if(!0===i){if(t[e]===r)return}else if("function"!=typeof(n=i)||"[object Function]"!==o.call(n)||!i())return;var n;l?s(t,e,r,!0):s(t,e,r)},h=function(t,e){var r=arguments.length>2?arguments[2]:{},o=i(e);n&&(o=a.call(o,Object.getOwnPropertySymbols(e)));for(var s=0;s<o.length;s+=1)c(t,o[s],e[o[s]],r[o[s]])};h.supportsDescriptors=!!l,t.exports=h},8460:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 fill=%27%23999%27 viewBox=%270 0 20 20%27%3E%3Cpath d=%27M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7%27/%3E%3Ccircle cx=%2710%27 cy=%2710%27 r=%272%27/%3E%3Cpath fill=%27red%27 d=%27m14 5 1 1-9 9-1-1z%27/%3E%3C/svg%3E"},8599:(t,e,r)=>{"use strict";var i=r(8452),n=r(3628),o=r(2521);t.exports=function(){if("function"==typeof Uint8Array){var t=o(),e=n(Uint8Array.prototype);i(e,{slice:t},{slice:function(){return e.slice!==t}})}return t}},8605:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 viewBox=%270 0 29 29%27%3E%3Cpath d=%27m10.5 14 4-8 4 8z%27/%3E%3Cpath fill=%27%23ccc%27 d=%27m10.5 16 4 8 4-8z%27/%3E%3C/svg%3E"},8648:t=>{"use strict";t.exports="undefined"!=typeof Reflect&&Reflect.getPrototypeOf||null},8679:(t,e,r)=>{"use strict";var i=r(453),n=i("%RegExp%"),o=r(9675),a=i("%parseInt%"),s=r(6556),l=r(9721),c=s("String.prototype.slice"),h=l(/^0b[01]+$/i),u=l(/^0o[0-7]+$/i),p=l(/^[-+]0x[0-9a-f]+$/i),d=l(new n("["+["…","​","￾"].join("")+"]","g")),f=r(214);t.exports=function t(e){if("string"!=typeof e)throw new o("Assertion failed: `argument` is not a String");if(h(e))return+a(c(e,2),2);if(u(e))return+a(c(e,2),8);if(d(e)||p(e))return NaN;var r=f(e);return r!==e?t(r):+e}},8859:(t,e,r)=>{var i="function"==typeof Map&&Map.prototype,n=Object.getOwnPropertyDescriptor&&i?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,o=i&&n&&"function"==typeof n.get?n.get:null,a=i&&Map.prototype.forEach,s="function"==typeof Set&&Set.prototype,l=Object.getOwnPropertyDescriptor&&s?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,c=s&&l&&"function"==typeof l.get?l.get:null,h=s&&Set.prototype.forEach,u="function"==typeof WeakMap&&WeakMap.prototype?WeakMap.prototype.has:null,p="function"==typeof WeakSet&&WeakSet.prototype?WeakSet.prototype.has:null,d="function"==typeof WeakRef&&WeakRef.prototype?WeakRef.prototype.deref:null,f=Boolean.prototype.valueOf,m=Object.prototype.toString,g=Function.prototype.toString,_=String.prototype.match,y=String.prototype.slice,b=String.prototype.replace,v=String.prototype.toUpperCase,x=String.prototype.toLowerCase,w=RegExp.prototype.test,T=Array.prototype.concat,S=Array.prototype.join,P=Array.prototype.slice,C=Math.floor,M="function"==typeof BigInt?BigInt.prototype.valueOf:null,A=Object.getOwnPropertySymbols,I="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?Symbol.prototype.toString:null,E="function"==typeof Symbol&&"object"==typeof Symbol.iterator,k="function"==typeof Symbol&&Symbol.toStringTag&&(Symbol.toStringTag,1)?Symbol.toStringTag:null,z=Object.prototype.propertyIsEnumerable,R=("function"==typeof Reflect?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null);function D(t,e){if(t===1/0||t===-1/0||t!=t||t&&t>-1e3&&t<1e3||w.call(/e/,e))return e;var r=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if("number"==typeof t){var i=t<0?-C(-t):C(t);if(i!==t){var n=String(i),o=y.call(e,n.length+1);return b.call(n,r,"$&_")+"."+b.call(b.call(o,/([0-9]{3})/g,"$&_"),/_$/,"")}}return b.call(e,r,"$&_")}var L=r(2634),F=L.custom,B=G(F)?F:null,O={__proto__:null,double:'"',single:"'"},j={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};function U(t,e,r){var i=r.quoteStyle||e,n=O[i];return n+t+n}function N(t){return b.call(String(t),/"/g,"&quot;")}function V(t){return!k||!("object"==typeof t&&(k in t||void 0!==t[k]))}function $(t){return"[object Array]"===W(t)&&V(t)}function Z(t){return"[object RegExp]"===W(t)&&V(t)}function G(t){if(E)return t&&"object"==typeof t&&t instanceof Symbol;if("symbol"==typeof t)return!0;if(!t||"object"!=typeof t||!I)return!1;try{return I.call(t),!0}catch(t){}return!1}t.exports=function t(e,i,n,s){var l=i||{};if(H(l,"quoteStyle")&&!H(O,l.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(H(l,"maxStringLength")&&("number"==typeof l.maxStringLength?l.maxStringLength<0&&l.maxStringLength!==1/0:null!==l.maxStringLength))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var m=!H(l,"customInspect")||l.customInspect;if("boolean"!=typeof m&&"symbol"!==m)throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(H(l,"indent")&&null!==l.indent&&"\t"!==l.indent&&!(parseInt(l.indent,10)===l.indent&&l.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(H(l,"numericSeparator")&&"boolean"!=typeof l.numericSeparator)throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var v=l.numericSeparator;if(void 0===e)return"undefined";if(null===e)return"null";if("boolean"==typeof e)return e?"true":"false";if("string"==typeof e)return K(e,l);if("number"==typeof e){if(0===e)return 1/0/e>0?"0":"-0";var w=String(e);return v?D(e,w):w}if("bigint"==typeof e){var C=String(e)+"n";return v?D(e,C):C}var A=void 0===l.depth?5:l.depth;if(void 0===n&&(n=0),n>=A&&A>0&&"object"==typeof e)return $(e)?"[Array]":"[Object]";var F,j=function(t,e){var r;if("\t"===t.indent)r="\t";else{if(!("number"==typeof t.indent&&t.indent>0))return null;r=S.call(Array(t.indent+1)," ")}return{base:r,prev:S.call(Array(e+1),r)}}(l,n);if(void 0===s)s=[];else if(X(s,e)>=0)return"[Circular]";function q(e,r,i){if(r&&(s=P.call(s)).push(r),i){var o={depth:l.depth};return H(l,"quoteStyle")&&(o.quoteStyle=l.quoteStyle),t(e,o,n+1,s)}return t(e,l,n+1,s)}if("function"==typeof e&&!Z(e)){var Y=function(t){if(t.name)return t.name;var e=_.call(g.call(t),/^function\s*([\w$]+)/);return e?e[1]:null}(e),it=rt(e,q);return"[Function"+(Y?": "+Y:" (anonymous)")+"]"+(it.length>0?" { "+S.call(it,", ")+" }":"")}if(G(e)){var nt=E?b.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):I.call(e);return"object"!=typeof e||E?nt:J(nt)}if((F=e)&&"object"==typeof F&&("undefined"!=typeof HTMLElement&&F instanceof HTMLElement||"string"==typeof F.nodeName&&"function"==typeof F.getAttribute)){for(var ot="<"+x.call(String(e.nodeName)),at=e.attributes||[],st=0;st<at.length;st++)ot+=" "+at[st].name+"="+U(N(at[st].value),"double",l);return ot+=">",e.childNodes&&e.childNodes.length&&(ot+="..."),ot+"</"+x.call(String(e.nodeName))+">"}if($(e)){if(0===e.length)return"[]";var lt=rt(e,q);return j&&!function(t){for(var e=0;e<t.length;e++)if(X(t[e],"\n")>=0)return!1;return!0}(lt)?"["+et(lt,j)+"]":"[ "+S.call(lt,", ")+" ]"}if(function(t){return"[object Error]"===W(t)&&V(t)}(e)){var ct=rt(e,q);return"cause"in Error.prototype||!("cause"in e)||z.call(e,"cause")?0===ct.length?"["+String(e)+"]":"{ ["+String(e)+"] "+S.call(ct,", ")+" }":"{ ["+String(e)+"] "+S.call(T.call("[cause]: "+q(e.cause),ct),", ")+" }"}if("object"==typeof e&&m){if(B&&"function"==typeof e[B]&&L)return L(e,{depth:A-n});if("symbol"!==m&&"function"==typeof e.inspect)return e.inspect()}if(function(t){if(!o||!t||"object"!=typeof t)return!1;try{o.call(t);try{c.call(t)}catch(t){return!0}return t instanceof Map}catch(t){}return!1}(e)){var ht=[];return a&&a.call(e,function(t,r){ht.push(q(r,e,!0)+" => "+q(t,e))}),tt("Map",o.call(e),ht,j)}if(function(t){if(!c||!t||"object"!=typeof t)return!1;try{c.call(t);try{o.call(t)}catch(t){return!0}return t instanceof Set}catch(t){}return!1}(e)){var ut=[];return h&&h.call(e,function(t){ut.push(q(t,e))}),tt("Set",c.call(e),ut,j)}if(function(t){if(!u||!t||"object"!=typeof t)return!1;try{u.call(t,u);try{p.call(t,p)}catch(t){return!0}return t instanceof WeakMap}catch(t){}return!1}(e))return Q("WeakMap");if(function(t){if(!p||!t||"object"!=typeof t)return!1;try{p.call(t,p);try{u.call(t,u)}catch(t){return!0}return t instanceof WeakSet}catch(t){}return!1}(e))return Q("WeakSet");if(function(t){if(!d||!t||"object"!=typeof t)return!1;try{return d.call(t),!0}catch(t){}return!1}(e))return Q("WeakRef");if(function(t){return"[object Number]"===W(t)&&V(t)}(e))return J(q(Number(e)));if(function(t){if(!t||"object"!=typeof t||!M)return!1;try{return M.call(t),!0}catch(t){}return!1}(e))return J(q(M.call(e)));if(function(t){return"[object Boolean]"===W(t)&&V(t)}(e))return J(f.call(e));if(function(t){return"[object String]"===W(t)&&V(t)}(e))return J(q(String(e)));if("undefined"!=typeof window&&e===window)return"{ [object Window] }";if("undefined"!=typeof globalThis&&e===globalThis||void 0!==r.g&&e===r.g)return"{ [object globalThis] }";if(!function(t){return"[object Date]"===W(t)&&V(t)}(e)&&!Z(e)){var pt=rt(e,q),dt=R?R(e)===Object.prototype:e instanceof Object||e.constructor===Object,ft=e instanceof Object?"":"null prototype",mt=!dt&&k&&Object(e)===e&&k in e?y.call(W(e),8,-1):ft?"Object":"",gt=(dt||"function"!=typeof e.constructor?"":e.constructor.name?e.constructor.name+" ":"")+(mt||ft?"["+S.call(T.call([],mt||[],ft||[]),": ")+"] ":"");return 0===pt.length?gt+"{}":j?gt+"{"+et(pt,j)+"}":gt+"{ "+S.call(pt,", ")+" }"}return String(e)};var q=Object.prototype.hasOwnProperty||function(t){return t in this};function H(t,e){return q.call(t,e)}function W(t){return m.call(t)}function X(t,e){if(t.indexOf)return t.indexOf(e);for(var r=0,i=t.length;r<i;r++)if(t[r]===e)return r;return-1}function K(t,e){if(t.length>e.maxStringLength){var r=t.length-e.maxStringLength,i="... "+r+" more character"+(r>1?"s":"");return K(y.call(t,0,e.maxStringLength),e)+i}var n=j[e.quoteStyle||"single"];return n.lastIndex=0,U(b.call(b.call(t,n,"\\$1"),/[\x00-\x1f]/g,Y),"single",e)}function Y(t){var e=t.charCodeAt(0),r={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return r?"\\"+r:"\\x"+(e<16?"0":"")+v.call(e.toString(16))}function J(t){return"Object("+t+")"}function Q(t){return t+" { ? }"}function tt(t,e,r,i){return t+" ("+e+") {"+(i?et(r,i):S.call(r,", "))+"}"}function et(t,e){if(0===t.length)return"";var r="\n"+e.prev+e.base;return r+S.call(t,","+r)+"\n"+e.prev}function rt(t,e){var r=$(t),i=[];if(r){i.length=t.length;for(var n=0;n<t.length;n++)i[n]=H(t,n)?e(t[n],t):""}var o,a="function"==typeof A?A(t):[];if(E){o={};for(var s=0;s<a.length;s++)o["$"+a[s]]=a[s]}for(var l in t)H(t,l)&&(r&&String(Number(l))===l&&l<t.length||E&&o["$"+l]instanceof Symbol||(w.call(/[^\w$]/,l)?i.push(e(l,t)+": "+e(t[l],t)):i.push(l+": "+e(t[l],t))));if("function"==typeof A)for(var c=0;c<a.length;c++)z.call(t,a[c])&&i.push("["+e(a[c])+"]: "+e(t[a[c]],t));return i}},8869:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 fill=%27%23e54e33%27 viewBox=%270 0 20 20%27%3E%3Cpath d=%27M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7%27/%3E%3C/svg%3E"},8875:(t,e,r)=>{"use strict";var i;if(!Object.keys){var n=Object.prototype.hasOwnProperty,o=Object.prototype.toString,a=r(1093),s=Object.prototype.propertyIsEnumerable,l=!s.call({toString:null},"toString"),c=s.call(function(){},"prototype"),h=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],u=function(t){var e=t.constructor;return e&&e.prototype===t},p={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},d=function(){if("undefined"==typeof window)return!1;for(var t in window)try{if(!p["$"+t]&&n.call(window,t)&&null!==window[t]&&"object"==typeof window[t])try{u(window[t])}catch(t){return!0}}catch(t){return!0}return!1}();i=function(t){var e=null!==t&&"object"==typeof t,r="[object Function]"===o.call(t),i=a(t),s=e&&"[object String]"===o.call(t),p=[];if(!e&&!r&&!i)throw new TypeError("Object.keys called on a non-object");var f=c&&r;if(s&&t.length>0&&!n.call(t,0))for(var m=0;m<t.length;++m)p.push(String(m));if(i&&t.length>0)for(var g=0;g<t.length;++g)p.push(String(g));else for(var _ in t)f&&"prototype"===_||!n.call(t,_)||p.push(String(_));if(l)for(var y=function(t){if("undefined"==typeof window||!d)return u(t);try{return u(t)}catch(t){return!1}}(t),b=0;b<h.length;++b)y&&"constructor"===h[b]||!n.call(t,h[b])||p.push(h[b]);return p}}t.exports=i},8894:(t,e,r)=>{"use strict";var i=r(453)("%parseInt%"),n=r(1514),o=r(8968),a=r(8017),s=r(6556),l=s("String.prototype.indexOf"),c=s("String.prototype.slice"),h=r(9154),u=r(8213),p="11111111111",d="00000000000",f=d+d+d+d+"0000000";t.exports=function(t,e){var r,s,m=t<0||a(t)?"1":"0";if(isNaN(t))r=p,s="1"+f;else if(isFinite(t))if(0===t)r=d,s="0"+f;else{t=n(t);var g,_=o(t),y=u(_),b=h(t-_);if(y)r=y.length-1;else{var v=l(b,"1");v>-1&&(g=v+1),r=-g}s=y+b,r<0?(r<=-1023&&(g=1022),s=c(s,g)):s=c(s,1),r=c(d+u(r+1023),-11),s=c(s+f+"0",0,52)}else r=p,s="0"+f;for(var x=m+r+s,w=[],T=0;T<8;T++)w[e?8-T-1:T]=i(c(x,8*T,8*(T+1)),2);return w}},8968:t=>{"use strict";t.exports=Math.floor},9002:t=>{t.exports='<svg viewBox="0 0 28 38" xmlns="http://www.w3.org/2000/svg"><g fill="none" fill-rule="evenodd"><ellipse fill-opacity=".3" fill="#000" cx="14" cy="36.5" rx="3" ry="1.5"></ellipse><g transform="translate(1 1)"><path d="M26.495 13.018l.002.05c.011.32-.006.775-.068 1.295-.003.062-.003.062-.005.076l.001-.008a16.517 16.517 0 01-.247 1.5c-1.208 5.775-5.112 12.154-12.865 18.457l-.344.28-.319-.309-.537-.518-.621-.603c-.511-.498-.978-.96-1.445-1.434a68.208 68.208 0 01-3.37-3.656C2.894 23.714.411 19.456-.288 15.414A12.974 12.974 0 01-.48 13.43a2.981 2.981 0 00-.007-.132v-.013a3.206 3.206 0 01-.012-.252c0-.055 0-.055.003-.09v-.002l.002-.028-.002-.048a1.288 1.288 0 01-.003-.157l.024-.475h.01C-.05 5.12 5.827-.5 12.998-.5c7.45 0 13.49 6.05 13.497 13.518zm-.07 1.413v.003z" stroke="#FFF" fill="#666" fill-rule="nonzero" class="left"></path><path d="M13 0c7.176 0 12.995 5.834 12.995 13.033 0 0 .031.472-.066 1.33v.011a15.863 15.863 0 01-.24 1.455c-.777 3.71-3.463 10.668-12.689 18.17V0z" fill="#2D2D2D" fill-rule="nonzero" class="right"></path><circle fill="#FFF" cx="13" cy="13" r="6"></circle></g></g></svg>'},9092:(t,e,r)=>{"use strict";var i=r(1333);t.exports=function(){return i()&&!!Symbol.toStringTag}},9154:t=>{"use strict";var e=1075;t.exports=function(t){var r="";if(0===t)return r;for(var i,n=e,o=0;o<e;o+=1)if((i=2*t)>=1?(t=i-1,r+="1",n===e&&(n=o)):(t=i,r+="0"),1===i||o-n>54)return r;return r}},9209:(t,e,r)=>{"use strict";var i=r(6578),n="undefined"==typeof globalThis?r.g:globalThis;t.exports=function(){for(var t=[],e=0;e<i.length;e++)"function"==typeof n[i[e]]&&(t[t.length]=i[e]);return t}},9271:(t,e,r)=>{"use strict";var i=r(9675),n=r(5986),o=r(6575),a=r(5291),s=r(4742),l=r(9346),c=r(4372),h=r(2308),u=r(6058);t.exports=function(t){if(!l(t))throw new i("Assertion failed: `taRecord` must be a TypedArray With Buffer Witness Record");if(a(t))throw new i("Assertion failed: `taRecord` is out of bounds");var e=t["[[Object]]"],r=o(c(e)),p=r?u(e):"AUTO";if("AUTO"!==p)return p;if(r)throw new i("Assertion failed: array buffer is not fixed length");var d=h(e),f=s(e),m=t["[[CachedBufferByteLength]]"];if("DETACHED"===m)throw new i("Assertion failed: typed array is detached");return n((m-d)/f)}},9290:t=>{"use strict";t.exports=RangeError},9308:(t,e,r)=>{"use strict";var i=r(9719),n=r(8410),o=r(5986),a=r(4459);t.exports=function(t){var e=n(t);if(a(e))return 0;var r=i(e,0,255),s=o(r);return r<s+.5?s:r>s+.5?s+1:s%2==0?s:s+1}},9346:(t,e,r)=>{"use strict";var i=r(9957),n=r(5680),o=r(1087);t.exports=function(t){return!!t&&"object"==typeof t&&i(t,"[[Object]]")&&i(t,"[[CachedBufferByteLength]]")&&(o(t["[[CachedBufferByteLength]]"])&&t["[[CachedBufferByteLength]]"]>=0||"DETACHED"===t["[[CachedBufferByteLength]]"])&&n(t["[[Object]]"])}},9353:t=>{"use strict";var e=Object.prototype.toString,r=Math.max,i=function(t,e){for(var r=[],i=0;i<t.length;i+=1)r[i]=t[i];for(var n=0;n<e.length;n+=1)r[n+t.length]=e[n];return r};t.exports=function(t){var n=this;if("function"!=typeof n||"[object Function]"!==e.apply(n))throw new TypeError("Function.prototype.bind called on incompatible "+n);for(var o,a=function(t){for(var e=[],r=1,i=0;r<t.length;r+=1,i+=1)e[i]=t[r];return e}(arguments),s=r(0,n.length-a.length),l=[],c=0;c<s;c++)l[c]="$"+c;if(o=Function("binder","return function ("+function(t){for(var e="",r=0;r<t.length;r+=1)e+=t[r],r+1<t.length&&(e+=",");return e}(l)+"){ return binder.apply(this,arguments); }")(function(){if(this instanceof o){var e=n.apply(this,i(a,arguments));return Object(e)===e?e:this}return n.apply(t,i(a,arguments))}),n.prototype){var h=function(){};h.prototype=n.prototype,o.prototype=new h,h.prototype=null}return o}},9373:t=>{"use strict";t.exports=function(t){return"UINT8"===t||"UINT8C"===t||"UINT16"===t||"UINT32"===t||"BIGUINT64"===t}},9377:(t,e,r)=>{"use strict";var i=r(592)(),n=r(41),o=r(4895);t.exports=function(){var t=o();return String.prototype.trim!==t&&(i?n(String.prototype,"trim",t,!0):n(String.prototype,"trim",t)),t}},9383:t=>{"use strict";t.exports=Error},9387:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2722%27 height=%2722%27 fill=%27none%27 stroke=%27%23333%27 viewBox=%270 0 22 22%27%3E%3Ccircle cx=%2711%27 cy=%2711%27 r=%278.5%27/%3E%3Cpath d=%27M17.5 11c0 4.819-3.02 8.5-6.5 8.5S4.5 15.819 4.5 11 7.52 2.5 11 2.5s6.5 3.681 6.5 8.5Z%27/%3E%3Cpath d=%27M13.5 11c0 2.447-.331 4.64-.853 6.206-.262.785-.562 1.384-.872 1.777-.314.399-.58.517-.775.517s-.461-.118-.775-.517c-.31-.393-.61-.992-.872-1.777C8.831 15.64 8.5 13.446 8.5 11s.331-4.64.853-6.206c.262-.785.562-1.384.872-1.777.314-.399.58-.517.775-.517s.461.118.775.517c.31.393.61.992.872 1.777.522 1.565.853 3.76.853 6.206Z%27/%3E%3Cpath d=%27M11 7.5c-1.909 0-3.622-.166-4.845-.428-.616-.132-1.08-.283-1.379-.434a1.3 1.3 0 0 1-.224-.138q.07-.058.224-.138c.299-.151.763-.302 1.379-.434C7.378 5.666 9.091 5.5 11 5.5s3.622.166 4.845.428c.616.132 1.08.283 1.379.434.105.053.177.1.224.138q-.07.058-.224.138c-.299.151-.763.302-1.379.434-1.223.262-2.936.428-4.845.428ZM4.486 6.436ZM11 16.5c-1.909 0-3.622-.166-4.845-.428-.616-.132-1.08-.283-1.379-.434a1.3 1.3 0 0 1-.224-.138 1.3 1.3 0 0 1 .224-.138c.299-.151.763-.302 1.379-.434C7.378 14.666 9.091 14.5 11 14.5s3.622.166 4.845.428c.616.132 1.08.283 1.379.434.105.053.177.1.224.138a1.3 1.3 0 0 1-.224.138c-.299.151-.763.302-1.379.434-1.223.262-2.936.428-4.845.428Zm-6.514-1.064ZM11 12.5c-2.46 0-4.672-.222-6.255-.574-.796-.177-1.406-.38-1.805-.59a1.5 1.5 0 0 1-.39-.272.3.3 0 0 1-.047-.064.3.3 0 0 1 .048-.064c.066-.073.189-.167.389-.272.399-.21 1.009-.413 1.805-.59C6.328 9.722 8.54 9.5 11 9.5s4.672.222 6.256.574c.795.177 1.405.38 1.804.59.2.105.323.2.39.272a.3.3 0 0 1 .047.064.3.3 0 0 1-.048.064 1.4 1.4 0 0 1-.389.272c-.399.21-1.009.413-1.804.59-1.584.352-3.796.574-6.256.574Zm-8.501-1.51v.002zm0 .018v.002zm17.002.002v-.002zm0-.018v-.002z%27/%3E%3C/svg%3E"},9511:(t,e,r)=>{"use strict";var i=r(6556)("ArrayBuffer.prototype.byteLength",!0),n=r(4670);t.exports=function(t){return n(t)?i?i(t):t.byteLength:NaN}},9531:(t,e,r)=>{"use strict";var i=r(8068),n=r(9675),o=r(533),a=r(4528),s=r(5291),l=r(9271),c=r(1509),h=r(9209)();t.exports=function(t,e){if(!a(t))throw new n("Assertion failed: `constructor` must be a constructor");if(!o(e))throw new n("Assertion failed: `argumentList` must be a List");if(0===h.length)throw new i("Assertion failed: Typed Arrays are not supported in this environment");var r;r=0===e.length?new t:1===e.length?new t(e[0]):2===e.length?new t(e[0],e[1]):new t(e[0],e[1],e[2]);var u=c(r,"SEQ-CST");if(1===e.length&&"number"==typeof e[0]){if(s(u))throw new n("new Typed Array is out of bounds");if(l(u)<e[0])throw new n("`argumentList[0]` must be <= `newTypedArray.length`")}return r}},9538:t=>{"use strict";t.exports=ReferenceError},9600:t=>{"use strict";var e,r,i=Function.prototype.toString,n="object"==typeof Reflect&&null!==Reflect&&Reflect.apply;if("function"==typeof n&&"function"==typeof Object.defineProperty)try{e=Object.defineProperty({},"length",{get:function(){throw r}}),r={},n(function(){throw 42},null,e)}catch(t){t!==r&&(n=null)}else n=null;var o=/^\s*class\b/,a=function(t){try{var e=i.call(t);return o.test(e)}catch(t){return!1}},s=function(t){try{return!a(t)&&(i.call(t),!0)}catch(t){return!1}},l=Object.prototype.toString,c="function"==typeof Symbol&&!!Symbol.toStringTag,h=!(0 in[,]),u=function(){return!1};if("object"==typeof document){var p=document.all;l.call(p)===l.call(document.all)&&(u=function(t){if((h||!t)&&(void 0===t||"object"==typeof t))try{var e=l.call(t);return("[object HTMLAllCollection]"===e||"[object HTML document.all class]"===e||"[object HTMLCollection]"===e||"[object Object]"===e)&&null==t("")}catch(t){}return!1})}t.exports=n?function(t){if(u(t))return!0;if(!t)return!1;if("function"!=typeof t&&"object"!=typeof t)return!1;try{n(t,null,e)}catch(t){if(t!==r)return!1}return!a(t)&&s(t)}:function(t){if(u(t))return!0;if(!t)return!1;if("function"!=typeof t&&"object"!=typeof t)return!1;if(c)return s(t);if(a(t))return!1;var e=l.call(t);return!("[object Function]"!==e&&"[object GeneratorFunction]"!==e&&!/^\[object HTML/.test(e))&&s(t)}},9612:t=>{"use strict";t.exports=Object},9675:t=>{"use strict";t.exports=TypeError},9693:(t,e,r)=>{"use strict";var i=r(453)("%BigInt%",!0),n=r(9675),o=r(8068);t.exports=function(t){if("string"!=typeof t)throw new n("`argument` must be a string");if(!i)throw new o("BigInts are not supported in this environment");try{return i(t)}catch(t){return}}},9719:(t,e,r)=>{"use strict";var i=r(9675),n=r(6188),o=r(8002);t.exports=function(t,e,r){if("number"!=typeof t||"number"!=typeof e||"number"!=typeof r||!(e<=r))throw new i("Assertion failed: all three arguments must be MVs, and `lower` must be `<= upper`");return o(n(e,t),r)}},9721:(t,e,r)=>{"use strict";var i=r(6556),n=r(4035),o=i("RegExp.prototype.exec"),a=r(9675);t.exports=function(t){if(!n(t))throw new a("`regex` must be a RegExp");return function(e){return null!==o(t,e)}}},9723:(t,e,r)=>{"use strict";var i=r(1539),n=r(593),o=r(5767),a=r(4634),s=r(2120),l=r(4035),c=r(8173),h=r(3811),u=r(1482),p=r(8184),d=r(5351),f=r(6556),m=r(9092)()&&Symbol.toStringTag,g=Object,_=f("Promise.prototype.then",!0),y=function(t){return!!t&&"BigInt"!==t&&"Boolean"!==t&&"Null"!==t&&"Number"!==t&&"String"!==t&&"Symbol"!==t&&"Undefined"!==t&&"Math"!==t&&"JSON"!==t&&"Reflect"!==t&&"Atomics"!==t&&"Map"!==t&&"Set"!==t&&"WeakMap"!==t&&"WeakSet"!==t&&"BigInt64Array"!==t&&"BigUint64Array"!==t&&"Float32Array"!==t&&"Float64Array"!==t&&"Int16Array"!==t&&"Int32Array"!==t&&"Int8Array"!==t&&"Uint16Array"!==t&&"Uint32Array"!==t&&"Uint8Array"!==t&&"Uint8ClampedArray"!==t&&"Array"!==t&&"Date"!==t&&"FinalizationRegistry"!==t&&"Promise"!==t&&"RegExp"!==t&&"WeakRef"!==t&&"Function"!==t&&"GeneratorFunction"!==t&&"AsyncFunction"!==t};t.exports=function(t){if(null==t)return t;var e=i(g(t))||n(t)||o(t);if(e)return e;if(a(t))return"Array";if(s(t))return"Date";if(l(t))return"RegExp";if(c(t))return"WeakRef";if(h(t))return"FinalizationRegistry";if("function"==typeof t)return p(t)?"GeneratorFunction":d(t)?"AsyncFunction":"Function";if(function(t){if(!t||"object"!=typeof t||!_)return!1;try{return _(t,null,function(){}),!0}catch(t){}return!1}(t))return"Promise";if(m&&m in t){var r=t[m];if(y(r))return r}if("function"==typeof t.constructor){var f=u(t.constructor);if(y(f))return f}return"Object"}},9790:t=>{"use strict";var e="undefined"!=typeof BigInt&&BigInt;t.exports=function(){return"function"==typeof e&&"function"==typeof BigInt&&"bigint"==typeof e(42)&&"bigint"==typeof BigInt(42)}},9803:(t,e,r)=>{"use strict";if(r(9790)()){var i=BigInt.prototype.valueOf;t.exports=function(t){return null!=t&&"boolean"!=typeof t&&"string"!=typeof t&&"number"!=typeof t&&"symbol"!=typeof t&&"function"!=typeof t&&("bigint"==typeof t||function(t){try{return i.call(t),!0}catch(t){}return!1}(t))}}else t.exports=function(t){return!1}},9819:t=>{"use strict";t.exports="data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2729%27 height=%2729%27 fill=%27%23e58978%27 viewBox=%270 0 20 20%27%3E%3Cpath d=%27M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7%27/%3E%3Ccircle cx=%2710%27 cy=%2710%27 r=%272%27/%3E%3C/svg%3E"},9883:t=>{t.exports=function(t){return function t(e){return Array.isArray(e)&&e.length&&"number"==typeof e[0]?[e]:e.reduce(function(e,r){return Array.isArray(r)&&Array.isArray(r[0])?e.concat(t(r)):(e.push(r),e)},[])}(t)}},9887:(t,e,r)=>{"use strict";var i=r(453)("%BigInt%",!0),n=r(5880),o=r(2964),a=r(9969),s=r(122),l=i&&BigInt(n(2,32))*BigInt(n(2,32));t.exports=function(t){var e=o(t);return s(a,e,l)}},9897:(t,e,r)=>{"use strict";var i=r(6268),n=r(3628);t.exports=function(){return"object"==typeof Reflect&&Reflect&&Reflect.getPrototypeOf?Reflect.getPrototypeOf:n?function(t){return n(t)}:i}},9901:(t,e,r)=>{"use strict";var i=r(453),n=r(8068),o=r(9675),a=r(6556),s=r(7440),l=i("%Uint8Array%",!0),c=a("Array.prototype.slice"),h=r(5910),u=r(6167),p=r(4670),d=r(7070),f=r(4399),m=r(4097),g=r(5100);t.exports=function(t,e,r,i,a){var _=d(t);if(!p(t)&&!_)throw new o("Assertion failed: `arrayBuffer` must be an ArrayBuffer or a SharedArrayBuffer");if(!s(e))throw new o("Assertion failed: `byteIndex` must be an integer");if("string"!=typeof r||"number"!=typeof m.size["$"+r])throw new o("Assertion failed: `type` must be one of "+m.choices);if("boolean"!=typeof i)throw new o("Assertion failed: `isTypedArray` must be a boolean");if("SEQ-CST"!==a&&"UNORDERED"!==a)throw new o("Assertion failed: `order` must be either `SEQ-CST` or `UNORDERED`");if(arguments.length>5&&"boolean"!=typeof arguments[5])throw new o("Assertion failed: `isLittleEndian` must be a boolean, if present");if(h(t))throw new o("Assertion failed: `arrayBuffer` is detached");if(e<0)throw new o("Assertion failed: `byteIndex` must be non-negative");var y,b=m.size["$"+r];if(!b)throw new o("Assertion failed: `type` must be one of "+m.choices);if(_)throw new n("SharedArrayBuffer is not supported by this implementation");y=c(new l(t,e),0,b);var v=arguments.length>5?arguments[5]:"little"===g,x=v?c(f([0,0,0,0,0,0,0,0],y),-b):c(f(y,[0,0,0,0,0,0,0,0]),0,b);return u(r,x,v)}},9957:(t,e,r)=>{"use strict";var i=Function.prototype.call,n=Object.prototype.hasOwnProperty,o=r(6743);t.exports=o.call(i,n)},9969:(t,e,r)=>{"use strict";var i=r(453)("%BigInt%",!0),n=r(9290),o=r(9675),a=i&&i(0);t.exports=function(t,e){if("bigint"!=typeof t||"bigint"!=typeof e)throw new o("Assertion failed: `n` and `d` arguments must be BigInts");if(e===a)throw new n("Division by zero");return t===a?a:t%e}}},o={};function a(t){var e=o[t];if(void 0!==e)return e.exports;var r=o[t]={id:t,exports:{}};return n[t].call(r.exports,r,r.exports,a),r.exports}a.m=n,a.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return a.d(e,{a:e}),e},e=Object.getPrototypeOf?t=>Object.getPrototypeOf(t):t=>t.__proto__,a.t=function(r,i){if(1&i&&(r=this(r)),8&i)return r;if("object"==typeof r&&r){if(4&i&&r.__esModule)return r;if(16&i&&"function"==typeof r.then)return r}var n=Object.create(null);a.r(n);var o={};t=t||[null,e({}),e([]),e(e)];for(var s=2&i&&r;("object"==typeof s||"function"==typeof s)&&!~t.indexOf(s);s=e(s))Object.getOwnPropertyNames(s).forEach(t=>o[t]=()=>r[t]);return o.default=()=>r,a.d(n,o),n},a.d=(t,e)=>{for(var r in e)a.o(e,r)&&!a.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},a.f={},a.e=t=>Promise.all(Object.keys(a.f).reduce((e,r)=>(a.f[r](t,e),e),[])),a.u=t=>"embed-chunks/"+{445:"1492645e3d07fd3de940",728:"8983d465846d11f2859f"}[t]+".js",a.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),a.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r={},i="geoloniaEmbedCore:",a.l=(t,e,n,o)=>{if(r[t])r[t].push(e);else{var s,l;if(void 0!==n)for(var c=document.getElementsByTagName("script"),h=0;h<c.length;h++){var u=c[h];if(u.getAttribute("src")==t||u.getAttribute("data-webpack")==i+n){s=u;break}}s||(l=!0,(s=document.createElement("script")).charset="utf-8",a.nc&&s.setAttribute("nonce",a.nc),s.setAttribute("data-webpack",i+n),s.src=t),r[t]=[e];var p=(e,i)=>{s.onerror=s.onload=null,clearTimeout(d);var n=r[t];if(delete r[t],s.parentNode&&s.parentNode.removeChild(s),n&&n.forEach(t=>t(i)),e)return e(i)},d=setTimeout(p.bind(null,void 0,{type:"timeout",target:s}),12e4);s.onerror=p.bind(null,s.onerror),s.onload=p.bind(null,s.onload),l&&document.head.appendChild(s)}},a.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},(()=>{var t;a.g.importScripts&&(t=a.g.location+"");var e=a.g.document;if(!t&&e&&(e.currentScript&&"SCRIPT"===e.currentScript.tagName.toUpperCase()&&(t=e.currentScript.src),!t)){var r=e.getElementsByTagName("script");if(r.length)for(var i=r.length-1;i>-1&&(!t||!/^http(s?):/.test(t));)t=r[i--].src}if(!t)throw new Error("Automatic publicPath is not supported in this browser");t=t.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),a.p=t})(),(()=>{a.b="undefined"!=typeof document&&document.baseURI||self.location.href;var t={792:0};a.f.j=(e,r)=>{var i=a.o(t,e)?t[e]:void 0;if(0!==i)if(i)r.push(i[2]);else{var n=new Promise((r,n)=>i=t[e]=[r,n]);r.push(i[2]=n);var o=a.p+a.u(e),s=new Error;a.l(o,r=>{if(a.o(t,e)&&(0!==(i=t[e])&&(t[e]=void 0),i)){var n=r&&("load"===r.type?"missing":r.type),o=r&&r.target&&r.target.src;s.message="Loading chunk "+e+" failed.\n("+n+": "+o+")",s.name="ChunkLoadError",s.type=n,s.request=o,i[1](s)}},"chunk-"+e,e)}};var e=(e,r)=>{var i,n,[o,s,l]=r,c=0;if(o.some(e=>0!==t[e])){for(i in s)a.o(s,i)&&(a.m[i]=s[i]);l&&l(a)}for(e&&e(r);c<o.length;c++)n=o[c],a.o(t,n)&&t[n]&&t[n][0](),t[n]=0},r=self.webpackChunkgeoloniaEmbedCore=self.webpackChunkgeoloniaEmbedCore||[];r.forEach(e.bind(null,0)),r.push=e.bind(null,r.push.bind(r))})(),a.nc=void 0;var s={};return(()=>{"use strict";a.r(s),a.d(s,{GeoloniaMap:()=>Le,GeoloniaMarker:()=>re,SimpleStyle:()=>Ie,SimpleStyleVector:()=>De,embedVersion:()=>tr,keyring:()=>Wt,registerPlugin:()=>Qe});var t=a(6443),e=a.n(t),r=Math.pow,i=(t,e,r)=>new Promise((i,n)=>{var o=t=>{try{s(r.next(t))}catch(t){n(t)}},a=t=>{try{s(r.throw(t))}catch(t){n(t)}},s=t=>t.done?i(t.value):Promise.resolve(t.value).then(o,a);s((r=r.apply(t,e)).next())}),n=Uint8Array,o=Uint16Array,l=Int32Array,c=new n([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),h=new n([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),u=new n([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),p=function(t,e){for(var r=new o(31),i=0;i<31;++i)r[i]=e+=1<<t[i-1];var n=new l(r[30]);for(i=1;i<30;++i)for(var a=r[i];a<r[i+1];++a)n[a]=a-r[i]<<5|i;return{b:r,r:n}},d=p(c,2),f=d.b,m=d.r;f[28]=258,m[258]=28;var g,_=p(h,0),y=_.b,b=(_.r,new o(32768));for(w=0;w<32768;++w)g=(61680&(g=(52428&(g=(43690&w)>>1|(21845&w)<<1))>>2|(13107&g)<<2))>>4|(3855&g)<<4,b[w]=((65280&g)>>8|(255&g)<<8)>>1;var v=function(t,e,r){for(var i=t.length,n=0,a=new o(e);n<i;++n)t[n]&&++a[t[n]-1];var s,l=new o(e);for(n=1;n<e;++n)l[n]=l[n-1]+a[n-1]<<1;if(r){s=new o(1<<e);var c=15-e;for(n=0;n<i;++n)if(t[n])for(var h=n<<4|t[n],u=e-t[n],p=l[t[n]-1]++<<u,d=p|(1<<u)-1;p<=d;++p)s[b[p]>>c]=h}else for(s=new o(i),n=0;n<i;++n)t[n]&&(s[n]=b[l[t[n]-1]++]>>15-t[n]);return s},x=new n(288);for(w=0;w<144;++w)x[w]=8;for(w=144;w<256;++w)x[w]=9;for(w=256;w<280;++w)x[w]=7;for(w=280;w<288;++w)x[w]=8;var w,T=new n(32);for(w=0;w<32;++w)T[w]=5;var S=v(x,9,1),P=v(T,5,1),C=function(t){for(var e=t[0],r=1;r<t.length;++r)t[r]>e&&(e=t[r]);return e},M=function(t,e,r){var i=e/8|0;return(t[i]|t[i+1]<<8)>>(7&e)&r},A=function(t,e){var r=e/8|0;return(t[r]|t[r+1]<<8|t[r+2]<<16)>>(7&e)},I=function(t){return(t+7)/8|0},E=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],k=function(t,e,r){var i=new Error(e||E[t]);if(i.code=t,Error.captureStackTrace&&Error.captureStackTrace(i,k),!r)throw i;return i},z=function(t,e,r,i){var o=t.length,a=i?i.length:0;if(!o||e.f&&!e.l)return r||new n(0);var s=!r||2!=e.i,l=e.i;r||(r=new n(3*o));var p=function(t){var e=r.length;if(t>e){var i=new n(Math.max(2*e,t));i.set(r),r=i}},d=e.f||0,m=e.p||0,g=e.b||0,_=e.l,b=e.d,x=e.m,w=e.n,T=8*o;do{if(!_){d=M(t,m,1);var E=M(t,m+1,3);if(m+=3,!E){var z=t[($=I(m)+4)-4]|t[$-3]<<8,R=$+z;if(R>o){l&&k(0);break}s&&p(g+z),r.set(t.subarray($,R),g),e.b=g+=z,e.p=m=8*R,e.f=d;continue}if(1==E)_=S,b=P,x=9,w=5;else if(2==E){var D=M(t,m,31)+257,L=M(t,m+10,15)+4,F=D+M(t,m+5,31)+1;m+=14;for(var B=new n(F),O=new n(19),j=0;j<L;++j)O[u[j]]=M(t,m+3*j,7);m+=3*L;var U=C(O),N=(1<<U)-1,V=v(O,U,1);for(j=0;j<F;){var $,Z=V[M(t,m,N)];if(m+=15&Z,($=Z>>4)<16)B[j++]=$;else{var G=0,q=0;for(16==$?(q=3+M(t,m,3),m+=2,G=B[j-1]):17==$?(q=3+M(t,m,7),m+=3):18==$&&(q=11+M(t,m,127),m+=7);q--;)B[j++]=G}}var H=B.subarray(0,D),W=B.subarray(D);x=C(H),w=C(W),_=v(H,x,1),b=v(W,w,1)}else k(1);if(m>T){l&&k(0);break}}s&&p(g+131072);for(var X=(1<<x)-1,K=(1<<w)-1,Y=m;;Y=m){var J=(G=_[A(t,m)&X])>>4;if((m+=15&G)>T){l&&k(0);break}if(G||k(2),J<256)r[g++]=J;else{if(256==J){Y=m,_=null;break}var Q=J-254;if(J>264){var tt=c[j=J-257];Q=M(t,m,(1<<tt)-1)+f[j],m+=tt}var et=b[A(t,m)&K],rt=et>>4;if(et||k(3),m+=15&et,W=y[rt],rt>3&&(tt=h[rt],W+=A(t,m)&(1<<tt)-1,m+=tt),m>T){l&&k(0);break}s&&p(g+131072);var it=g+Q;if(g<W){var nt=a-W,ot=Math.min(W,it);for(nt+g<0&&k(3);g<ot;++g)r[g]=i[nt+g]}for(;g<it;g+=4)r[g]=r[g-W],r[g+1]=r[g+1-W],r[g+2]=r[g+2-W],r[g+3]=r[g+3-W];g=it}}e.l=_,e.p=Y,e.b=g,e.f=d,_&&(d=1,e.m=x,e.d=b,e.n=w)}while(!d);return g==r.length?r:function(t,e,r){(null==e||e<0)&&(e=0),(null==r||r>t.length)&&(r=t.length);var i=new n(r-e);return i.set(t.subarray(e,r)),i}(r,0,g)},R=new n(0);function D(t,e){return 31==t[0]&&139==t[1]&&8==t[2]?function(t,e){var r,i,o=function(t){31==t[0]&&139==t[1]&&8==t[2]||k(6,"invalid gzip data");var e=t[3],r=10;4&e&&(r+=2+(t[10]|t[11]<<8));for(var i=(e>>3&1)+(e>>4&1);i>0;i-=!t[r++]);return r+(2&e)}(t);return o+8>t.length&&k(6,"invalid gzip data"),z(t.subarray(o,-8),{i:2},e&&e.out||new n((i=(r=t).length,(r[i-4]|r[i-3]<<8|r[i-2]<<16|r[i-1]<<24)>>>0)),e&&e.dictionary)}(t,e):8!=(15&t[0])||t[0]>>4>7||(t[0]<<8|t[1])%31?function(t,e){return z(t,{i:2},e&&e.out,e&&e.dictionary)}(t,e):function(t,e){return z(t.subarray((r=t,i=e&&e.dictionary,(8!=(15&r[0])||r[0]>>4>7||(r[0]<<8|r[1])%31)&&k(6,"invalid zlib data"),(r[1]>>5&1)==+!i&&k(6,"invalid zlib data: "+(32&r[1]?"need":"unexpected")+" dictionary"),2+(r[1]>>3&4)),-4),{i:2},e&&e.out,e&&e.dictionary);var r,i}(t,e)}var L="undefined"!=typeof TextDecoder&&new TextDecoder;try{L.decode(R,{stream:!0})}catch(t){}var F=(t,e)=>t*r(2,e),B=(t,e)=>Math.floor(t/r(2,e)),O=(t,e)=>F(t.getUint16(e+1,!0),8)+t.getUint8(e),j=(t,e)=>F(t.getUint32(e+2,!0),16)+t.getUint16(e,!0),U=(t,e,r,i,n)=>{if(t!==i.getUint8(n))return t-i.getUint8(n);const o=O(i,n+1);if(e!==o)return e-o;const a=O(i,n+4);return r!==a?r-a:0},N=(t,e,r,i)=>{const n=V(t,e,r,i);return n?{z:e,x:r,y:i,offset:n[0],length:n[1],isDir:!1}:null},V=(t,e,r,i)=>{let n=0,o=t.byteLength/17-1;for(;n<=o;){const a=o+n>>1,s=U(e,r,i,t,17*a);if(s>0)n=a+1;else{if(!(s<0))return[j(t,17*a+7),t.getUint32(17*a+13,!0)];o=a-1}}return null},$=(t,e)=>t.isDir&&!e.isDir?1:!t.isDir&&e.isDir?-1:t.z!==e.z?t.z-e.z:t.x!==e.x?t.x-e.x:t.y-e.y,Z=(t,e)=>{const r=t.getUint8(17*e);return{z:127&r,x:O(t,17*e+1),y:O(t,17*e+4),offset:j(t,17*e+7),length:t.getUint32(17*e+13,!0),isDir:r>>7==1}},G=t=>{const e=[],r=new DataView(t);for(let t=0;t<r.byteLength/17;t++)e.push(Z(r,t));return q(e)},q=t=>{t.sort($);const e=new ArrayBuffer(17*t.length),r=new Uint8Array(e);for(let e=0;e<t.length;e++){const i=t[e];let n=i.z;i.isDir&&(n|=128),r[17*e]=n,r[17*e+1]=255&i.x,r[17*e+2]=i.x>>8&255,r[17*e+3]=i.x>>16&255,r[17*e+4]=255&i.y,r[17*e+5]=i.y>>8&255,r[17*e+6]=i.y>>16&255,r[17*e+7]=255&i.offset,r[17*e+8]=255&B(i.offset,8),r[17*e+9]=255&B(i.offset,16),r[17*e+10]=255&B(i.offset,24),r[17*e+11]=255&B(i.offset,32),r[17*e+12]=255&B(i.offset,48),r[17*e+13]=255&i.length,r[17*e+14]=i.length>>8&255,r[17*e+15]=i.length>>16&255,r[17*e+16]=i.length>>24&255}return e},H={getHeader:function(t){return i(this,null,function*(){const e=yield t.getBytes(0,512e3),r=new DataView(e.data),i=r.getUint32(4,!0),n=r.getUint16(8,!0),o=new TextDecoder("utf-8"),a=JSON.parse(o.decode(new DataView(e.data,10,i)));let s=0;"gzip"===a.compression&&(s=2);let l=0;"minzoom"in a&&(l=+a.minzoom);let c=0;"maxzoom"in a&&(c=+a.maxzoom);let h=0,u=0,p=0,d=-180,f=-85,m=180,g=85;if(a.bounds){const t=a.bounds.split(",");d=+t[0],f=+t[1],m=+t[2],g=+t[3]}if(a.center){const t=a.center.split(",");h=+t[0],u=+t[1],p=+t[2]}return{specVersion:r.getUint16(2,!0),rootDirectoryOffset:10+i,rootDirectoryLength:17*n,jsonMetadataOffset:10,jsonMetadataLength:i,leafDirectoryOffset:0,leafDirectoryLength:void 0,tileDataOffset:0,tileDataLength:void 0,numAddressedTiles:0,numTileEntries:0,numTileContents:0,clustered:!1,internalCompression:1,tileCompression:s,tileType:1,minZoom:l,maxZoom:c,minLon:d,minLat:f,maxLon:m,maxLat:g,centerZoom:p,centerLon:h,centerLat:u,etag:e.etag}})},getZxy:function(t,e,r,n,o,a,s){return i(this,null,function*(){let i=yield r.getArrayBuffer(e,t.rootDirectoryOffset,t.rootDirectoryLength,t);1===t.specVersion&&(i=G(i));const l=N(new DataView(i),n,o,a);if(l){let t=(yield e.getBytes(l.offset,l.length,s)).data;const r=new DataView(t);return 31===r.getUint8(0)&&139===r.getUint8(1)&&(t=D(new Uint8Array(t))),{data:t}}const c=((t,e)=>{if(t.byteLength<17)return null;const r=t.byteLength/17,i=Z(t,r-1);if(i.isDir){const t=i.z,r=e.z-t;return{z:t,x:Math.trunc(e.x/(1<<r)),y:Math.trunc(e.y/(1<<r))}}return null})(new DataView(i),{z:n,x:o,y:a});if(c){const l=((t,e,r,i)=>{const n=V(t,128|e,r,i);return n?{z:e,x:r,y:i,offset:n[0],length:n[1],isDir:!0}:null})(new DataView(i),c.z,c.x,c.y);if(l){let i=yield r.getArrayBuffer(e,l.offset,l.length,t);1===t.specVersion&&(i=G(i));const c=N(new DataView(i),n,o,a);if(c){let t=(yield e.getBytes(c.offset,c.length,s)).data;const r=new DataView(t);return 31===r.getUint8(0)&&139===r.getUint8(1)&&(t=D(new Uint8Array(t))),{data:t}}}}})}};function W(t,e){return 4294967296*(e>>>0)+(t>>>0)}function X(t){const e=t.buf;let r=e[t.pos++],i=127&r;return r<128?i:(r=e[t.pos++],i|=(127&r)<<7,r<128?i:(r=e[t.pos++],i|=(127&r)<<14,r<128?i:(r=e[t.pos++],i|=(127&r)<<21,r<128?i:(r=e[t.pos],i|=(15&r)<<28,function(t,e){const r=e.buf;let i=r[e.pos++],n=(112&i)>>4;if(i<128)return W(t,n);if(i=r[e.pos++],n|=(127&i)<<3,i<128)return W(t,n);if(i=r[e.pos++],n|=(127&i)<<10,i<128)return W(t,n);if(i=r[e.pos++],n|=(127&i)<<17,i<128)return W(t,n);if(i=r[e.pos++],n|=(127&i)<<24,i<128)return W(t,n);if(i=r[e.pos++],n|=(1&i)<<31,i<128)return W(t,n);throw new Error("Expected varint not more than 10 bytes")}(i,t)))))}function K(t,e,r,i){if(0===i){1===r&&(e[0]=t-1-e[0],e[1]=t-1-e[1]);const i=e[0];e[0]=e[1],e[1]=i}}var Y=[0,1,5,21,85,341,1365,5461,21845,87381,349525,1398101,5592405,22369621,89478485,357913941,1431655765,5726623061,22906492245,91625968981,366503875925,1466015503701,5864062014805,23456248059221,93824992236885,375299968947541,0x5555555555555];function J(t,e){return i(this,null,function*(){if(1===e||0===e)return t;if(2===e){if(void 0===globalThis.DecompressionStream)return D(new Uint8Array(t));const e=new Response(t).body;if(!e)throw Error("Failed to read response stream");const r=e.pipeThrough(new globalThis.DecompressionStream("gzip"));return new Response(r).arrayBuffer()}throw Error("Compression method not supported")})}function Q(t,e){let r=0,i=t.length-1;for(;r<=i;){const n=i+r>>1,o=e-t[n].tileId;if(o>0)r=n+1;else{if(!(o<0))return t[n];i=n-1}}if(i>=0){if(0===t[i].runLength)return t[i];if(e-t[i].tileId<t[i].runLength)return t[i]}return null}var tt=class{constructor(t,e=new Headers){this.url=t,this.customHeaders=e,this.mustReload=!1;let r="";"navigator"in globalThis&&(r=globalThis.navigator.userAgent||"");const i=r.indexOf("Windows")>-1,n=/Chrome|Chromium|Edg|OPR|Brave/.test(r);this.chromeWindowsNoCache=!1,i&&n&&(this.chromeWindowsNoCache=!0)}getKey(){return this.url}setHeaders(t){this.customHeaders=t}getBytes(t,e,r,n){return i(this,null,function*(){let i,o;r?o=r:(i=new AbortController,o=i.signal);const a=new Headers(this.customHeaders);let s;a.set("range",`bytes=${t}-${t+e-1}`),this.mustReload?s="reload":this.chromeWindowsNoCache&&(s="no-store");let l=yield fetch(this.url,{signal:o,cache:s,headers:a});if(0===t&&416===l.status){const t=l.headers.get("Content-Range");if(!t||!t.startsWith("bytes */"))throw Error("Missing content-length on 416 response");const e=+t.substr(8);l=yield fetch(this.url,{signal:o,cache:"reload",headers:{range:"bytes=0-"+(e-1)}})}let c=l.headers.get("Etag");if((null==c?void 0:c.startsWith("W/"))&&(c=null),416===l.status||n&&c&&c!==n)throw this.mustReload=!0,new it(`Server returned non-matching ETag ${n} after one retry. Check browser extensions and servers for issues that may affect correct ETag headers.`);if(l.status>=300)throw Error(`Bad response code: ${l.status}`);const h=l.headers.get("Content-Length");if(200===l.status&&(!h||+h>e))throw i&&i.abort(),Error("Server returned no content-length header or content-length exceeding request. Check that your storage backend supports HTTP Byte Serving.");return{data:yield l.arrayBuffer(),etag:c||void 0,cacheControl:l.headers.get("Cache-Control")||void 0,expires:l.headers.get("Expires")||void 0}})}};function et(t,e){const i=t.getUint32(e+4,!0),n=t.getUint32(e+0,!0);return i*r(2,32)+n}function rt(t){const e={buf:new Uint8Array(t),pos:0},r=X(e),i=[];let n=0;for(let t=0;t<r;t++){const t=X(e);i.push({tileId:n+t,offset:0,length:0,runLength:1}),n+=t}for(let t=0;t<r;t++)i[t].runLength=X(e);for(let t=0;t<r;t++)i[t].length=X(e);for(let t=0;t<r;t++){const r=X(e);i[t].offset=0===r&&t>0?i[t-1].offset+i[t-1].length:r-1}return i}var it=class extends Error{};var nt=class{constructor(t=100,e=!0,r=J){this.cache=new Map,this.invalidations=new Map,this.maxCacheEntries=t,this.counter=1,this.decompress=r}getHeader(t){return i(this,null,function*(){const e=t.getKey(),r=this.cache.get(e);if(r)return r.lastUsed=this.counter++,yield r.data;const n=new Promise((e,r)=>{(function(t,e){return i(this,null,function*(){const r=yield t.getBytes(0,16384);if(19792!==new DataView(r.data).getUint16(0,!0))throw new Error("Wrong magic number for PMTiles archive");if(function(t){const e=new DataView(t);return 2===e.getUint16(2,!0)?(console.warn("PMTiles spec version 2 has been deprecated; please see github.com/protomaps/PMTiles for tools to upgrade"),2):1===e.getUint16(2,!0)?(console.warn("PMTiles spec version 1 has been deprecated; please see github.com/protomaps/PMTiles for tools to upgrade"),1):3}(r.data)<3)return[yield H.getHeader(t)];const i=function(t,e){const r=new DataView(t),i=r.getUint8(7);if(i>3)throw Error(`Archive is spec version ${i} but this library supports up to spec version 3`);return{specVersion:i,rootDirectoryOffset:et(r,8),rootDirectoryLength:et(r,16),jsonMetadataOffset:et(r,24),jsonMetadataLength:et(r,32),leafDirectoryOffset:et(r,40),leafDirectoryLength:et(r,48),tileDataOffset:et(r,56),tileDataLength:et(r,64),numAddressedTiles:et(r,72),numTileEntries:et(r,80),numTileContents:et(r,88),clustered:1===r.getUint8(96),internalCompression:r.getUint8(97),tileCompression:r.getUint8(98),tileType:r.getUint8(99),minZoom:r.getUint8(100),maxZoom:r.getUint8(101),minLon:r.getInt32(102,!0)/1e7,minLat:r.getInt32(106,!0)/1e7,maxLon:r.getInt32(110,!0)/1e7,maxLat:r.getInt32(114,!0)/1e7,centerZoom:r.getUint8(118),centerLon:r.getInt32(119,!0)/1e7,centerLat:r.getInt32(123,!0)/1e7,etag:e}}(r.data.slice(0,127),r.etag),n=r.data.slice(i.rootDirectoryOffset,i.rootDirectoryOffset+i.rootDirectoryLength),o=`${t.getKey()}|${i.etag||""}|${i.rootDirectoryOffset}|${i.rootDirectoryLength}`,a=rt(yield e(n,i.internalCompression));return[i,[o,a.length,a]]})})(t,this.decompress).then(t=>{t[1]&&this.cache.set(t[1][0],{lastUsed:this.counter++,data:Promise.resolve(t[1][2])}),e(t[0]),this.prune()}).catch(t=>{r(t)})});return this.cache.set(e,{lastUsed:this.counter++,data:n}),n})}getDirectory(t,e,r,n){return i(this,null,function*(){const o=`${t.getKey()}|${n.etag||""}|${e}|${r}`,a=this.cache.get(o);if(a)return a.lastUsed=this.counter++,yield a.data;const s=new Promise((o,a)=>{(function(t,e,r,n,o){return i(this,null,function*(){const i=yield t.getBytes(r,n,void 0,o.etag),a=rt(yield e(i.data,o.internalCompression));if(0===a.length)throw new Error("Empty directory is invalid");return a})})(t,this.decompress,e,r,n).then(t=>{o(t),this.prune()}).catch(t=>{a(t)})});return this.cache.set(o,{lastUsed:this.counter++,data:s}),s})}getArrayBuffer(t,e,r,n){return i(this,null,function*(){const i=`${t.getKey()}|${n.etag||""}|${e}|${r}`,o=this.cache.get(i);if(o)return o.lastUsed=this.counter++,yield o.data;const a=new Promise((o,a)=>{t.getBytes(e,r,void 0,n.etag).then(t=>{o(t.data),this.cache.has(i),this.prune()}).catch(t=>{a(t)})});return this.cache.set(i,{lastUsed:this.counter++,data:a}),a})}prune(){if(this.cache.size>=this.maxCacheEntries){let t,e=1/0;this.cache.forEach((r,i)=>{r.lastUsed<e&&(e=r.lastUsed,t=i)}),t&&this.cache.delete(t)}}invalidate(t){return i(this,null,function*(){const e=t.getKey();if(this.invalidations.get(e))return yield this.invalidations.get(e);this.cache.delete(t.getKey());const r=new Promise((r,i)=>{this.getHeader(t).then(t=>{r(),this.invalidations.delete(e)}).catch(t=>{i(t)})});this.invalidations.set(e,r)})}},ot=class{constructor(t,e,r){this.source="string"==typeof t?new tt(t):t,this.decompress=r||J,this.cache=e||new nt}getHeader(){return i(this,null,function*(){return yield this.cache.getHeader(this.source)})}getZxyAttempt(t,e,n,o){return i(this,null,function*(){const i=function(t,e,i){if(t>26)throw Error("Tile zoom level exceeds max safe number limit (26)");if(e>r(2,t)-1||i>r(2,t)-1)throw Error("tile x/y outside zoom level bounds");const n=Y[t];let o=0,a=0,s=0;const l=[e,i];let c=r(2,t)/2;for(;c>0;)o=(l[0]&c)>0?1:0,a=(l[1]&c)>0?1:0,s+=c*c*(3*o^a),K(c,l,o,a),c/=2;return n+s}(t,e,n),a=yield this.cache.getHeader(this.source);if(a.specVersion<3)return H.getZxy(a,this.source,this.cache,t,e,n,o);if(t<a.minZoom||t>a.maxZoom)return;let s=a.rootDirectoryOffset,l=a.rootDirectoryLength;for(let t=0;t<=3;t++){const t=Q(yield this.cache.getDirectory(this.source,s,l,a),i);if(!t)return;if(t.runLength>0){const e=yield this.source.getBytes(a.tileDataOffset+t.offset,t.length,o,a.etag);return{data:yield this.decompress(e.data,a.tileCompression),cacheControl:e.cacheControl,expires:e.expires}}s=a.leafDirectoryOffset+t.offset,l=t.length}throw Error("Maximum directory depth exceeded")})}getZxy(t,e,r,n){return i(this,null,function*(){try{return yield this.getZxyAttempt(t,e,r,n)}catch(i){if(i instanceof it)return this.cache.invalidate(this.source),yield this.getZxyAttempt(t,e,r,n);throw i}})}getMetadataAttempt(){return i(this,null,function*(){const t=yield this.cache.getHeader(this.source),e=yield this.source.getBytes(t.jsonMetadataOffset,t.jsonMetadataLength,void 0,t.etag),r=yield this.decompress(e.data,t.internalCompression),i=new TextDecoder("utf-8");return JSON.parse(i.decode(r))})}getMetadata(){return i(this,null,function*(){try{return yield this.getMetadataAttempt()}catch(t){if(t instanceof it)return this.cache.invalidate(this.source),yield this.getMetadataAttempt();throw t}})}getTileJson(t){return i(this,null,function*(){const e=yield this.getHeader(),r=yield this.getMetadata(),i=1===(n=e.tileType)?".mvt":2===n?".png":3===n?".jpg":4===n?".webp":5===n?".avif":"";var n;return{tilejson:"3.0.0",scheme:"xyz",tiles:[`${t}/{z}/{x}/{y}${i}`],vector_layers:r.vector_layers,attribution:r.attribution,description:r.description,name:r.name,version:r.version,bounds:[e.minLon,e.minLat,e.maxLon,e.maxLat],center:[e.centerLon,e.centerLat,e.centerZoom],minzoom:e.minZoom,maxzoom:e.maxZoom}})}};function at(t){return at="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},at(t)}var st=/^\s+/,lt=/\s+$/;function ct(t,e){if(e=e||{},(t=t||"")instanceof ct)return t;if(!(this instanceof ct))return new ct(t,e);var r=function(t){var e,r,i,n={r:0,g:0,b:0},o=1,a=null,s=null,l=null,c=!1,h=!1;return"string"==typeof t&&(t=function(t){t=t.replace(st,"").replace(lt,"").toLowerCase();var e,r=!1;if(Ct[t])t=Ct[t],r=!0;else if("transparent"==t)return{r:0,g:0,b:0,a:0,format:"name"};return(e=jt.rgb.exec(t))?{r:e[1],g:e[2],b:e[3]}:(e=jt.rgba.exec(t))?{r:e[1],g:e[2],b:e[3],a:e[4]}:(e=jt.hsl.exec(t))?{h:e[1],s:e[2],l:e[3]}:(e=jt.hsla.exec(t))?{h:e[1],s:e[2],l:e[3],a:e[4]}:(e=jt.hsv.exec(t))?{h:e[1],s:e[2],v:e[3]}:(e=jt.hsva.exec(t))?{h:e[1],s:e[2],v:e[3],a:e[4]}:(e=jt.hex8.exec(t))?{r:kt(e[1]),g:kt(e[2]),b:kt(e[3]),a:Lt(e[4]),format:r?"name":"hex8"}:(e=jt.hex6.exec(t))?{r:kt(e[1]),g:kt(e[2]),b:kt(e[3]),format:r?"name":"hex"}:(e=jt.hex4.exec(t))?{r:kt(e[1]+""+e[1]),g:kt(e[2]+""+e[2]),b:kt(e[3]+""+e[3]),a:Lt(e[4]+""+e[4]),format:r?"name":"hex8"}:!!(e=jt.hex3.exec(t))&&{r:kt(e[1]+""+e[1]),g:kt(e[2]+""+e[2]),b:kt(e[3]+""+e[3]),format:r?"name":"hex"}}(t)),"object"==at(t)&&(Ut(t.r)&&Ut(t.g)&&Ut(t.b)?(e=t.r,r=t.g,i=t.b,n={r:255*It(e,255),g:255*It(r,255),b:255*It(i,255)},c=!0,h="%"===String(t.r).substr(-1)?"prgb":"rgb"):Ut(t.h)&&Ut(t.s)&&Ut(t.v)?(a=Rt(t.s),s=Rt(t.v),n=function(t,e,r){t=6*It(t,360),e=It(e,100),r=It(r,100);var i=Math.floor(t),n=t-i,o=r*(1-e),a=r*(1-n*e),s=r*(1-(1-n)*e),l=i%6;return{r:255*[r,a,o,o,s,r][l],g:255*[s,r,r,a,o,o][l],b:255*[o,o,s,r,r,a][l]}}(t.h,a,s),c=!0,h="hsv"):Ut(t.h)&&Ut(t.s)&&Ut(t.l)&&(a=Rt(t.s),l=Rt(t.l),n=function(t,e,r){var i,n,o;function a(t,e,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?t+6*(e-t)*r:r<.5?e:r<2/3?t+(e-t)*(2/3-r)*6:t}if(t=It(t,360),e=It(e,100),r=It(r,100),0===e)i=n=o=r;else{var s=r<.5?r*(1+e):r+e-r*e,l=2*r-s;i=a(l,s,t+1/3),n=a(l,s,t),o=a(l,s,t-1/3)}return{r:255*i,g:255*n,b:255*o}}(t.h,a,l),c=!0,h="hsl"),t.hasOwnProperty("a")&&(o=t.a)),o=At(o),{ok:c,format:t.format||h,r:Math.min(255,Math.max(n.r,0)),g:Math.min(255,Math.max(n.g,0)),b:Math.min(255,Math.max(n.b,0)),a:o}}(t);this._originalInput=t,this._r=r.r,this._g=r.g,this._b=r.b,this._a=r.a,this._roundA=Math.round(100*this._a)/100,this._format=e.format||r.format,this._gradientType=e.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=r.ok}function ht(t,e,r){t=It(t,255),e=It(e,255),r=It(r,255);var i,n,o=Math.max(t,e,r),a=Math.min(t,e,r),s=(o+a)/2;if(o==a)i=n=0;else{var l=o-a;switch(n=s>.5?l/(2-o-a):l/(o+a),o){case t:i=(e-r)/l+(e<r?6:0);break;case e:i=(r-t)/l+2;break;case r:i=(t-e)/l+4}i/=6}return{h:i,s:n,l:s}}function ut(t,e,r){t=It(t,255),e=It(e,255),r=It(r,255);var i,n,o=Math.max(t,e,r),a=Math.min(t,e,r),s=o,l=o-a;if(n=0===o?0:l/o,o==a)i=0;else{switch(o){case t:i=(e-r)/l+(e<r?6:0);break;case e:i=(r-t)/l+2;break;case r:i=(t-e)/l+4}i/=6}return{h:i,s:n,v:s}}function pt(t,e,r,i){var n=[zt(Math.round(t).toString(16)),zt(Math.round(e).toString(16)),zt(Math.round(r).toString(16))];return i&&n[0].charAt(0)==n[0].charAt(1)&&n[1].charAt(0)==n[1].charAt(1)&&n[2].charAt(0)==n[2].charAt(1)?n[0].charAt(0)+n[1].charAt(0)+n[2].charAt(0):n.join("")}function dt(t,e,r,i){return[zt(Dt(i)),zt(Math.round(t).toString(16)),zt(Math.round(e).toString(16)),zt(Math.round(r).toString(16))].join("")}function ft(t,e){e=0===e?0:e||10;var r=ct(t).toHsl();return r.s-=e/100,r.s=Et(r.s),ct(r)}function mt(t,e){e=0===e?0:e||10;var r=ct(t).toHsl();return r.s+=e/100,r.s=Et(r.s),ct(r)}function gt(t){return ct(t).desaturate(100)}function _t(t,e){e=0===e?0:e||10;var r=ct(t).toHsl();return r.l+=e/100,r.l=Et(r.l),ct(r)}function yt(t,e){e=0===e?0:e||10;var r=ct(t).toRgb();return r.r=Math.max(0,Math.min(255,r.r-Math.round(-e/100*255))),r.g=Math.max(0,Math.min(255,r.g-Math.round(-e/100*255))),r.b=Math.max(0,Math.min(255,r.b-Math.round(-e/100*255))),ct(r)}function bt(t,e){e=0===e?0:e||10;var r=ct(t).toHsl();return r.l-=e/100,r.l=Et(r.l),ct(r)}function vt(t,e){var r=ct(t).toHsl(),i=(r.h+e)%360;return r.h=i<0?360+i:i,ct(r)}function xt(t){var e=ct(t).toHsl();return e.h=(e.h+180)%360,ct(e)}function wt(t,e){if(isNaN(e)||e<=0)throw new Error("Argument to polyad must be a positive number");for(var r=ct(t).toHsl(),i=[ct(t)],n=360/e,o=1;o<e;o++)i.push(ct({h:(r.h+o*n)%360,s:r.s,l:r.l}));return i}function Tt(t){var e=ct(t).toHsl(),r=e.h;return[ct(t),ct({h:(r+72)%360,s:e.s,l:e.l}),ct({h:(r+216)%360,s:e.s,l:e.l})]}function St(t,e,r){e=e||6,r=r||30;var i=ct(t).toHsl(),n=360/r,o=[ct(t)];for(i.h=(i.h-(n*e>>1)+720)%360;--e;)i.h=(i.h+n)%360,o.push(ct(i));return o}function Pt(t,e){e=e||6;for(var r=ct(t).toHsv(),i=r.h,n=r.s,o=r.v,a=[],s=1/e;e--;)a.push(ct({h:i,s:n,v:o})),o=(o+s)%1;return a}ct.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(299*t.r+587*t.g+114*t.b)/1e3},getLuminance:function(){var t,e,r,i=this.toRgb();return t=i.r/255,e=i.g/255,r=i.b/255,.2126*(t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4))+.7152*(e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4))+.0722*(r<=.03928?r/12.92:Math.pow((r+.055)/1.055,2.4))},setAlpha:function(t){return this._a=At(t),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var t=ut(this._r,this._g,this._b);return{h:360*t.h,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=ut(this._r,this._g,this._b),e=Math.round(360*t.h),r=Math.round(100*t.s),i=Math.round(100*t.v);return 1==this._a?"hsv("+e+", "+r+"%, "+i+"%)":"hsva("+e+", "+r+"%, "+i+"%, "+this._roundA+")"},toHsl:function(){var t=ht(this._r,this._g,this._b);return{h:360*t.h,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=ht(this._r,this._g,this._b),e=Math.round(360*t.h),r=Math.round(100*t.s),i=Math.round(100*t.l);return 1==this._a?"hsl("+e+", "+r+"%, "+i+"%)":"hsla("+e+", "+r+"%, "+i+"%, "+this._roundA+")"},toHex:function(t){return pt(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return function(t,e,r,i,n){var o=[zt(Math.round(t).toString(16)),zt(Math.round(e).toString(16)),zt(Math.round(r).toString(16)),zt(Dt(i))];return n&&o[0].charAt(0)==o[0].charAt(1)&&o[1].charAt(0)==o[1].charAt(1)&&o[2].charAt(0)==o[2].charAt(1)&&o[3].charAt(0)==o[3].charAt(1)?o[0].charAt(0)+o[1].charAt(0)+o[2].charAt(0)+o[3].charAt(0):o.join("")}(this._r,this._g,this._b,this._a,t)},toHex8String:function(t){return"#"+this.toHex8(t)},toRgb:function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:Math.round(100*It(this._r,255))+"%",g:Math.round(100*It(this._g,255))+"%",b:Math.round(100*It(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+Math.round(100*It(this._r,255))+"%, "+Math.round(100*It(this._g,255))+"%, "+Math.round(100*It(this._b,255))+"%)":"rgba("+Math.round(100*It(this._r,255))+"%, "+Math.round(100*It(this._g,255))+"%, "+Math.round(100*It(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(Mt[pt(this._r,this._g,this._b,!0)]||!1)},toFilter:function(t){var e="#"+dt(this._r,this._g,this._b,this._a),r=e,i=this._gradientType?"GradientType = 1, ":"";if(t){var n=ct(t);r="#"+dt(n._r,n._g,n._b,n._a)}return"progid:DXImageTransform.Microsoft.gradient("+i+"startColorstr="+e+",endColorstr="+r+")"},toString:function(t){var e=!!t;t=t||this._format;var r=!1,i=this._a<1&&this._a>=0;return e||!i||"hex"!==t&&"hex6"!==t&&"hex3"!==t&&"hex4"!==t&&"hex8"!==t&&"name"!==t?("rgb"===t&&(r=this.toRgbString()),"prgb"===t&&(r=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(r=this.toHexString()),"hex3"===t&&(r=this.toHexString(!0)),"hex4"===t&&(r=this.toHex8String(!0)),"hex8"===t&&(r=this.toHex8String()),"name"===t&&(r=this.toName()),"hsl"===t&&(r=this.toHslString()),"hsv"===t&&(r=this.toHsvString()),r||this.toHexString()):"name"===t&&0===this._a?this.toName():this.toRgbString()},clone:function(){return ct(this.toString())},_applyModification:function(t,e){var r=t.apply(null,[this].concat([].slice.call(e)));return this._r=r._r,this._g=r._g,this._b=r._b,this.setAlpha(r._a),this},lighten:function(){return this._applyModification(_t,arguments)},brighten:function(){return this._applyModification(yt,arguments)},darken:function(){return this._applyModification(bt,arguments)},desaturate:function(){return this._applyModification(ft,arguments)},saturate:function(){return this._applyModification(mt,arguments)},greyscale:function(){return this._applyModification(gt,arguments)},spin:function(){return this._applyModification(vt,arguments)},_applyCombination:function(t,e){return t.apply(null,[this].concat([].slice.call(e)))},analogous:function(){return this._applyCombination(St,arguments)},complement:function(){return this._applyCombination(xt,arguments)},monochromatic:function(){return this._applyCombination(Pt,arguments)},splitcomplement:function(){return this._applyCombination(Tt,arguments)},triad:function(){return this._applyCombination(wt,[3])},tetrad:function(){return this._applyCombination(wt,[4])}},ct.fromRatio=function(t,e){if("object"==at(t)){var r={};for(var i in t)t.hasOwnProperty(i)&&(r[i]="a"===i?t[i]:Rt(t[i]));t=r}return ct(t,e)},ct.equals=function(t,e){return!(!t||!e)&&ct(t).toRgbString()==ct(e).toRgbString()},ct.random=function(){return ct.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})},ct.mix=function(t,e,r){r=0===r?0:r||50;var i=ct(t).toRgb(),n=ct(e).toRgb(),o=r/100;return ct({r:(n.r-i.r)*o+i.r,g:(n.g-i.g)*o+i.g,b:(n.b-i.b)*o+i.b,a:(n.a-i.a)*o+i.a})},ct.readability=function(t,e){var r=ct(t),i=ct(e);return(Math.max(r.getLuminance(),i.getLuminance())+.05)/(Math.min(r.getLuminance(),i.getLuminance())+.05)},ct.isReadable=function(t,e,r){var i,n,o,a,s,l=ct.readability(t,e);switch(n=!1,(o=r,"AA"!==(a=((o=o||{level:"AA",size:"small"}).level||"AA").toUpperCase())&&"AAA"!==a&&(a="AA"),"small"!==(s=(o.size||"small").toLowerCase())&&"large"!==s&&(s="small"),i={level:a,size:s}).level+i.size){case"AAsmall":case"AAAlarge":n=l>=4.5;break;case"AAlarge":n=l>=3;break;case"AAAsmall":n=l>=7}return n},ct.mostReadable=function(t,e,r){var i,n,o,a,s=null,l=0;n=(r=r||{}).includeFallbackColors,o=r.level,a=r.size;for(var c=0;c<e.length;c++)(i=ct.readability(t,e[c]))>l&&(l=i,s=ct(e[c]));return ct.isReadable(t,s,{level:o,size:a})||!n?s:(r.includeFallbackColors=!1,ct.mostReadable(t,["#fff","#000"],r))};var Ct=ct.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},Mt=ct.hexNames=function(t){var e={};for(var r in t)t.hasOwnProperty(r)&&(e[t[r]]=r);return e}(Ct);function At(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function It(t,e){(function(t){return"string"==typeof t&&-1!=t.indexOf(".")&&1===parseFloat(t)})(t)&&(t="100%");var r=function(t){return"string"==typeof t&&-1!=t.indexOf("%")}(t);return t=Math.min(e,Math.max(0,parseFloat(t))),r&&(t=parseInt(t*e,10)/100),Math.abs(t-e)<1e-6?1:t%e/parseFloat(e)}function Et(t){return Math.min(1,Math.max(0,t))}function kt(t){return parseInt(t,16)}function zt(t){return 1==t.length?"0"+t:""+t}function Rt(t){return t<=1&&(t=100*t+"%"),t}function Dt(t){return Math.round(255*parseFloat(t)).toString(16)}function Lt(t){return kt(t)/255}var Ft,Bt,Ot,jt=(Bt="[\\s|\\(]+("+(Ft="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)")+")[,|\\s]+("+Ft+")[,|\\s]+("+Ft+")\\s*\\)?",Ot="[\\s|\\(]+("+Ft+")[,|\\s]+("+Ft+")[,|\\s]+("+Ft+")[,|\\s]+("+Ft+")\\s*\\)?",{CSS_UNIT:new RegExp(Ft),rgb:new RegExp("rgb"+Bt),rgba:new RegExp("rgba"+Ot),hsl:new RegExp("hsl"+Bt),hsla:new RegExp("hsla"+Ot),hsv:new RegExp("hsv"+Bt),hsva:new RegExp("hsva"+Ot),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/});function Ut(t){return!!jt.CSS_UNIT.exec(t)}var Nt,Vt,$t,Zt=a(9002),Gt=a.n(Zt),qt=function(t,e,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(t):i?i.value:e.get(t)},Ht=function(t,e,r,i,n){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!n:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?n.call(t,r):n?n.value=r:e.set(t,r),r};Nt=new WeakMap,Vt=new WeakMap,$t=new WeakMap;const Wt=new class{constructor(){Nt.set(this,void 0),Vt.set(this,void 0),$t.set(this,void 0)}get apiKey(){return qt(this,Nt,"f")||this.parse(),qt(this,Nt,"f")}get isGeoloniaStyle(){return qt(this,$t,"f")}set isGeoloniaStyle(t){Ht(this,$t,t,"f")}set apiKey(t){Ht(this,Nt,t,"f")}get stage(){return qt(this,Vt,"f")||this.parse(),qt(this,Vt,"f")}set stage(t){Ht(this,Vt,t,"f")}parse(t=document){const e=t.currentScript?[t.currentScript]:t.getElementsByTagName("script");for(const t of e){const e=new URL(t.src.startsWith("https://")||t.src.startsWith("http://")||t.src.startsWith("//")?t.src:`https://${location.host}/${t.src}`).searchParams.get("geolonia-api-key");if(e){Ht(this,Nt,e,"f"),Ht(this,Vt,"v1","f");break}}if(qt(this,Vt,"f")||Ht(this,Vt,"dev","f"),qt(this,$t,"f")&&!qt(this,Nt,"f"))throw new Error("Cannot load API key.")}reset(){Ht(this,Nt,void 0,"f"),Ht(this,Vt,void 0,"f"),Ht(this,$t,!1,"f")}isGeoloniaStyleCheck(t){if(!t||""===t)return!0;if(t.startsWith("https://cdn.geolonia.com/style/")||t.startsWith("https://api.geolonia.com/"))return!0;if(t.match(/^https?:\/\//))return!1;if(t.endsWith(".json"))try{return new URL(t,location.href).href.includes("geolonia.com")}catch(t){return!1}return!0}};function Xt(t){if(t.match(/^https?:\/\//))return t;if(t.match(/^\//)||t.match(/^\.\.?/))try{return new URL(t,location.href).href}catch(t){return console.error("[Geolonia]",t),!1}return!1}function Kt(){const t=window.navigator.languages&&window.navigator.languages[0]&&window.navigator.languages[0].toLowerCase()||window.navigator.language.toLowerCase();return"ja"===t||"ja-jp"===t?"ja":"en"}function Yt(t){return"object"==typeof HTMLElement?t instanceof HTMLElement:t&&"object"==typeof t&&null!==t&&1===t.nodeType&&"string"==typeof t.nodeName}function Jt(t){const e=t.toLowerCase();return["top-right","bottom-right","bottom-left","top-left"].includes(e)?{enabled:!0,position:e}:["on","off"].includes(e)?{enabled:"on"===e,position:void 0}:{enabled:!1,position:void 0}}let Qt="";const te=t=>{if(Qt)return Qt;{const e=new Uint8Array(t/2);window.crypto.getRandomValues(e);const r=Array.from(e,t=>t.toString(16).padStart(2,"0")).join("");return Qt=r,r}},ee=async t=>{const{default:e}=await Promise.all([a.e(728),a.e(445)]).then(a.t.bind(a,4728,23));return e(t,{allowedTags:e.defaults.allowedTags.concat(["img"]),allowedAttributes:{...e.defaults.allowedAttributes,"*":["class"]}})};class re extends e().Marker{constructor(t={},e={}){if(t=function(t,e){return t&&Yt(t)?t={element:t,...e}:t||(t=e),t}(t,e),!t||!t.element){const e=document.createElement("div");e.className="geolonia-default-marker",e.innerHTML=Gt(),e.style.margin="0",e.style.padding="0",e.style.width="26px",e.style.height="34px";const r=e.querySelector("svg");if(r.style.width="100%",r.style.height="100%",t.element=e,t.color)e.querySelector(".left").style.fill=t.color,e.querySelector(".right").style.fill=ct(t.color).darken().toString();else{const t="#E4402F";e.querySelector(".left").style.fill=t,e.querySelector(".right").style.fill=ct(t).darken().toString()}t.offset=[0,-15]}return super(t),this}}class ie{onAdd(){this.container=document.createElement("div"),this.container.className="maplibregl-ctrl";const t=document.createElement("img");t.src="https://cdn.geolonia.com/logo/geolonia-symbol_1.png",t.style.width="16px",t.style.height="16px",t.style.display="block",t.style.cursor="pointer",t.style.padding="0",t.style.margin="0",t.style.border="none",t.alt="Geolonia";const e=document.createElement("a");return e.href="https://geolonia.com/",e.appendChild(t),e.title="Powered by Geolonia",this.container.appendChild(e),this.container}onRemove(){this.container.parentNode.removeChild(this.container)}getDefaultPosition(){return"bottom-left"}}var ne,oe,ae,se,le,ce=a(4748),he=a.n(ce),ue=function(t,e,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(t):i?i.value:e.get(t)};class pe{static testProp(t){if(!ue(ne,ne,"f",oe))return t[0];for(let e=0;e<t.length;e++)if(t[e]in ue(ne,ne,"f",oe))return t[e];return t[0]}static create(t,e,r){const i=window.document.createElement(t);return void 0!==e&&(i.className=e),r&&r.appendChild(i),i}static createNS(t,e){return window.document.createElementNS(t,e)}static disableDrag(){ue(ne,ne,"f",oe)&&ue(ne,ne,"f",se)&&(function(t,e,r,i,n){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!n:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===i?n.call(t,r):n?n.value=r:e.set(t,r)}(ne,ne,ue(ne,ne,"f",oe)[ue(ne,ne,"f",se)],"f",ae),ue(ne,ne,"f",oe)[ue(ne,ne,"f",se)]="none")}static enableDrag(){ue(ne,ne,"f",oe)&&ue(ne,ne,"f",se)&&(ue(ne,ne,"f",oe)[ue(ne,ne,"f",se)]=ue(ne,ne,"f",ae))}static setTransform(t,e){t.style[ue(ne,ne,"f",le)]=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 suppressClick(){window.addEventListener("click",ue(ne,ne,"f",le),!0),window.setTimeout(()=>{window.removeEventListener("click",ue(ne,ne,"f",le),!0)},0)}static mousePos(t,e){const r=t.getBoundingClientRect();return new(he())(e.clientX-r.left-t.clientLeft,e.clientY-r.top-t.clientTop)}static touchPos(t,e){const r=t.getBoundingClientRect(),i=[];for(let n=0;n<e.length;n++)i.push(new(he())(e[n].clientX-r.left-t.clientLeft,e[n].clientY-r.top-t.clientTop));return i}static mouseButton(t){return t.button}static remove(t){t.parentNode&&t.parentNode.removeChild(t)}}ne=pe,oe={value:"undefined"!=typeof window&&window.document&&window.document.documentElement.style},ae={value:void 0},se={value:ne.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"])},le={value:ne.testProp(["transform","WebkitTransform"])};const de=class{constructor(t={}){var e;this.options=t,e=this,["_toggleAttribution","_updateData","_updateCompact","_updateCompactMinimize"].forEach(t=>{e[t]&&(e[t]=e[t].bind(e))})}getDefaultPosition(){return"bottom-right"}onAdd(t){this._map=t,this._compact=this.options&&this.options.compact,this._container=pe.create("div");const e=this._container.attachShadow({mode:"open"});this._shadowContainer=pe.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=pe.create("summary","maplibregl-ctrl-attrib-button",this._shadowContainer),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=pe.create("div","maplibregl-ctrl-attrib-inner",this._shadowContainer);const r=document.createElement("style");return r.textContent="\n .maplibregl-ctrl {\n font: 12px/20px Helvetica Neue,Arial,Helvetica,sans-serif;\n clear: both;\n pointer-events: auto;\n transform: translate(0);\n }\n\n .maplibregl-ctrl-attrib-button:focus,.maplibregl-ctrl-group button:focus {\n box-shadow: 0 0 2px 2px #0096ff\n }\n\n .maplibregl-ctrl.maplibregl-ctrl-attrib {\n background-color: hsla(0,0%,100%,.5);\n margin: 0;\n padding: 0 5px\n }\n\n @media screen {\n .maplibregl-ctrl-attrib.maplibregl-compact {\n background-color: #fff;\n border-radius: 12px;\n box-sizing: content-box;\n min-height: 20px;\n padding: 2px 24px 2px 0;\n position: relative;\n margin: 10px 10px 10px auto;\n width: 0;\n }\n\n .maplibregl-ctrl-attrib.maplibregl-compact-show {\n padding: 2px 28px 2px 8px;\n visibility: visible;\n width: auto;\n }\n\n .maplibregl-ctrl-bottom-left>.maplibregl-ctrl-attrib.maplibregl-compact-show,.maplibregl-ctrl-top-left>.maplibregl-ctrl-attrib.maplibregl-compact-show {\n border-radius: 12px;\n padding: 2px 8px 2px 28px\n }\n\n .maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-inner {\n display: none\n }\n\n .maplibregl-ctrl-attrib-button {\n background-color: hsla(0,0%,100%,.5);\n background-image: url(\"data:image/svg+xml;charset=utf-8,%3Csvg width='24' height='24' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill-rule='evenodd'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E\");\n border: 0;\n border-radius: 12px;\n box-sizing: border-box;\n cursor: pointer;\n display: none;\n height: 24px;\n outline: none;\n position: absolute;\n right: 0;\n top: 0;\n width: 24px\n }\n\n .maplibregl-ctrl-attrib summary.maplibregl-ctrl-attrib-button {\n appearance: none;\n list-style: none\n }\n\n .maplibregl-ctrl-attrib summary.maplibregl-ctrl-attrib-button::-webkit-details-marker {\n display: none\n }\n\n .maplibregl-ctrl-bottom-left .maplibregl-ctrl-attrib-button,.maplibregl-ctrl-top-left .maplibregl-ctrl-attrib-button {\n left: 0\n }\n\n .maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-button,.maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-inner {\n display: block\n }\n\n .maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-button {\n background-color: rgb(0 0 0/5%)\n }\n\n .maplibregl-ctrl-bottom-right>.maplibregl-ctrl-attrib.maplibregl-compact:after {\n bottom: 0;\n right: 0\n }\n\n .maplibregl-ctrl-top-right>.maplibregl-ctrl-attrib.maplibregl-compact:after {\n right: 0;\n top: 0\n }\n\n .maplibregl-ctrl-top-left>.maplibregl-ctrl-attrib.maplibregl-compact:after {\n left: 0;\n top: 0\n }\n\n .maplibregl-ctrl-bottom-left>.maplibregl-ctrl-attrib.maplibregl-compact:after {\n bottom: 0;\n left: 0\n }\n }\n\n @media screen and (-ms-high-contrast:active) {\n .maplibregl-ctrl-attrib.maplibregl-compact:after {\n background-image: url(\"data:image/svg+xml;charset=utf-8,%3Csvg width='24' height='24' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill-rule='evenodd' fill='%23fff'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E\")\n }\n }\n\n @media screen and (-ms-high-contrast:black-on-white) {\n .maplibregl-ctrl-attrib.maplibregl-compact:after {\n background-image: url(\"data:image/svg+xml;charset=utf-8,%3Csvg width='24' height='24' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill-rule='evenodd'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E\")\n }\n }\n\n @media print {\n .maplibregl-ctrl-attrib-button {\n display: none!important;\n }\n }\n\n .maplibregl-ctrl-attrib a {\n color: rgba(0,0,0,.75);\n text-decoration: none;\n white-space: nowrap;\n }\n\n .maplibregl-ctrl-attrib a:hover {\n color: inherit;\n text-decoration: underline\n }\n\n .maplibregl-attrib-empty {\n display: none\n }\n ",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),e.appendChild(r),e.appendChild(this._shadowContainer),this.printQuery=window.matchMedia("print"),this.onMediaPrintChange=t=>{t.matches&&(this._shadowContainer.setAttribute("open",""),this._shadowContainer.classList.remove("maplibregl-compact-show"))},this.printQuery.addEventListener("change",this.onMediaPrintChange),this._container}onRemove(){pe.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,this.printQuery.removeEventListener("change",this.onMediaPrintChange)}_setElementTitle(t,e){const r=this._map._getUIString(`AttributionControl.${e}`);t.title=r,t.setAttribute("aria-label",r)}_toggleAttribution(){this._shadowContainer.classList.contains("maplibregl-compact")&&(this._shadowContainer.classList.contains("maplibregl-compact-show")?(this._shadowContainer.setAttribute("open",""),this._shadowContainer.classList.remove("maplibregl-compact-show")):(this._shadowContainer.classList.add("maplibregl-compact-show"),this._shadowContainer.removeAttribute("open")))}_updateData(t){!t||"metadata"!==t.sourceDataType&&"visibility"!==t.sourceDataType&&"style"!==t.dataType&&"terrain"!==t.type||this._updateAttributions()}_updateAttributions(){if(!this._map.style)return;let t=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=t.concat(this.options.customAttribution.map(t=>"string"!=typeof t?"":t)):"string"==typeof this.options.customAttribution&&t.push(this.options.customAttribution)),this._map.style.stylesheet){const t=this._map.style.stylesheet;this.styleOwner=t.owner,this.styleId=t.id}const e=this._map.style.sourceCaches;for(const r in e){const i=e[r];if(i.used||i.usedForTerrain){const e=i.getSource();e.attribution&&t.indexOf(e.attribution)<0&&t.push(e.attribution)}}t=t.filter(t=>String(t).trim()),t.sort((t,e)=>t.length-e.length),t=t.filter((e,r)=>{for(let i=r+1;i<t.length;i++)if(t[i].indexOf(e)>=0)return!1;return!0});const r=t.join(" | ");r!==this._attribHTML&&(this._attribHTML=r,t.length?(this._innerContainer.innerHTML=r,this._shadowContainer.classList.remove("maplibregl-attrib-empty")):this._shadowContainer.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}_updateCompact(){this._map.getCanvasContainer().offsetWidth<=640||this._compact?!1===this._compact?this._shadowContainer.setAttribute("open",""):this._shadowContainer.classList.contains("maplibregl-compact")||this._shadowContainer.classList.contains("maplibregl-attrib-empty")||(this._shadowContainer.setAttribute("open",""),this._shadowContainer.classList.add("maplibregl-compact","maplibregl-compact-show")):(this._shadowContainer.setAttribute("open",""),this._shadowContainer.classList.contains("maplibregl-compact")&&this._shadowContainer.classList.remove("maplibregl-compact","maplibregl-compact-show"))}_updateCompactMinimize(){this._shadowContainer.classList.contains("maplibregl-compact")&&this._shadowContainer.classList.contains("maplibregl-compact-show")&&this._shadowContainer.classList.remove("maplibregl-compact-show")}};class fe{constructor(t={}){this.fullscreen=!1,this.id=`mbgl-gesture-handling-help-container-${fe.count}`,fe.count++,this.timer=null;const e="ctrl"!==t.modifierKey;let r=`Use ${e?"alt":"ctrl"} + scroll to zoom the map.`,i="Use two fingers to move the map.";if("ja"===("auto"!==t.lang&&t.lang?t.lang:function(){const t=window.navigator.languages&&window.navigator.languages[0]&&window.navigator.languages[0].toLowerCase()||window.navigator.language.toLowerCase();return"ja"===t||"ja-jp"===t?"ja":"en"}())&&(r=(e?"Alt":"Ctrl")+" キーを押しながらスクロールしてください。",i="2本指を使って操作してください。"),this.settings={backgroundColor:"rgba(0, 0, 0, 0.8)",textColor:"#ffffff",textMessage:r,textMessageMobile:i,timeout:2e3,...t,modifierKey:e?"altKey":"ctrlKey"},this.helpElement=document.querySelector(`#${this.id}`),null===this.helpElement){this.helpElement=document.createElement("div"),this.helpElement.id=this.id,this.helpElement.style.backgroundColor=this.settings.backgroundColor,this.helpElement.style.position="absolute",this.helpElement.style.display="none",this.helpElement.style.zIndex=9999,this.helpElement.style.justifyContent="center",this.helpElement.style.alignItems="center";const t=document.createElement("div");t.style.textAlign="center",t.style.color=this.settings.textColor,t.innerText="",this.helpElement.appendChild(t)}}showHelp(t,e){this.helpElement.style.top=0,this.helpElement.style.left=0,this.helpElement.style.width="100%",this.helpElement.style.height="100%",this.helpElement.style.display="flex",this.helpElement.querySelector("div").innerText=e,t.getContainer().appendChild(this.helpElement)}hideHelp(t){try{t.getContainer().removeChild(this.helpElement)}catch(t){}}addTo(t){t.scrollZoom.disable(),this.helpElement.addEventListener("wheel",e=>{e[this.settings.modifierKey]||!0===this.fullscreen?(e.preventDefault(),this.hideHelp(t)):(clearTimeout(this.timer),this.timer=setTimeout(()=>{this.hideHelp(t)},this.settings.timeout))}),t.getContainer().addEventListener("wheel",e=>{e[this.settings.modifierKey]||!0===this.fullscreen?(e.preventDefault(),t.scrollZoom.isEnabled()||(t.scrollZoom.reset(),t.scrollZoom.enable())):(t.scrollZoom.disable(),this.showHelp(t,this.settings.textMessage),this.timer=setTimeout(()=>{this.hideHelp(t)},this.settings.timeout))}),this.helpElement.addEventListener("touchstart",e=>{e.touches&&(2<=e.touches.length||!0===this.fullscreen)&&(clearTimeout(this.timer),this.hideHelp(t),t.dragPan.enable(),e.preventDefault())}),t.on("movestart",e=>{e.originalEvent&&"touches"in e.originalEvent&&2>e.originalEvent.touches.length&&!1===this.fullscreen&&(this.showHelp(t,this.settings.textMessageMobile),t.dragPan.disable(),this.timer=setTimeout(()=>{t.dragPan.enable(),this.hideHelp(t)},this.settings.timeout))}),document.addEventListener("fullscreenchange",()=>{document.fullscreenElement?this.fullscreen=!0:this.fullscreen=!1})}}fe.count=0;const me=fe,ge=(t,e={})=>{t.dataset||(t.dataset={});let r="auto";r=t.dataset.lang&&"auto"===t.dataset.lang?Kt():t.dataset.lang&&"ja"===t.dataset.lang?"ja":t.dataset.lang&&"ja"!==t.dataset.lang?"en":Kt(),Wt.parse(t);const i=t.dataset.style||"geolonia/basic-v2";return Wt.isGeoloniaStyle=Wt.isGeoloniaStyleCheck(i),{lat:0,lng:0,zoom:0,bearing:0,pitch:0,hash:"off",marker:"on",markerColor:"#E4402F",openPopup:"off",customMarker:"",customMarkerOffset:"0, 0",gestureHandling:!1===e.interactive?"off":"on",navigationControl:!1===e.interactive?"off":"on",geolocateControl:"off",fullscreenControl:"off",scaleControl:"off",geoloniaControl:"on",geojson:"",simpleVector:"",cluster:"on",clusterColor:"#ff0000",style:"geolonia/basic-v2",lang:r,plugin:"off",key:Wt.apiKey,apiUrl:`https://api.geolonia.com/${Wt.stage}`,stage:Wt.stage,loader:"on",minZoom:"",maxZoom:20,"3d":"",...t.dataset}};var _e=a(5879),ye=a.n(_e);function be(t){return!isNaN(t)&&null!==t&&!Array.isArray(t)}function ve(t,e,r){if(null!==t)for(var i,n,o,a,s,l,c,h,u=0,p=0,d=t.type,f="FeatureCollection"===d,m="Feature"===d,g=f?t.features.length:1,_=0;_<g;_++){s=(h=!!(c=f?t.features[_].geometry:m?t.geometry:t)&&"GeometryCollection"===c.type)?c.geometries.length:1;for(var y=0;y<s;y++){var b=0,v=0;if(null!==(a=h?c.geometries[y]:c)){l=a.coordinates;var x=a.type;switch(u=!r||"Polygon"!==x&&"MultiPolygon"!==x?0:1,x){case null:break;case"Point":if(!1===e(l,p,_,b,v))return!1;p++,b++;break;case"LineString":case"MultiPoint":for(i=0;i<l.length;i++){if(!1===e(l[i],p,_,b,v))return!1;p++,"MultiPoint"===x&&b++}"LineString"===x&&b++;break;case"Polygon":case"MultiLineString":for(i=0;i<l.length;i++){for(n=0;n<l[i].length-u;n++){if(!1===e(l[i][n],p,_,b,v))return!1;p++}"MultiLineString"===x&&b++,"Polygon"===x&&v++}"Polygon"===x&&b++;break;case"MultiPolygon":for(i=0;i<l.length;i++){for(v=0,n=0;n<l[i].length;n++){for(o=0;o<l[i][n].length-u;o++){if(!1===e(l[i][n][o],p,_,b,v))return!1;p++}v++}b++}break;case"GeometryCollection":for(i=0;i<a.geometries.length;i++)if(!1===ve(a.geometries[i],e,r))return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function xe(t){var e=[1/0,1/0,-1/0,-1/0];return ve(t,function(t){e[0]>t[0]&&(e[0]=t[0]),e[1]>t[1]&&(e[1]=t[1]),e[2]<t[0]&&(e[2]=t[0]),e[3]<t[1]&&(e[3]=t[1])}),e}xe.default=xe;const we=xe,Te=function(t,e){void 0===e&&(e={});var r=we(t);return function(t,e,r){if(void 0===r&&(r={}),!t)throw new Error("coordinates is required");if(!Array.isArray(t))throw new Error("coordinates must be an Array");if(t.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!be(t[0])||!be(t[1]))throw new Error("coordinates must contain numbers");return function(t,e,r){void 0===r&&(r={});var i={type:"Feature"};return(0===r.id||r.id)&&(i.id=r.id),r.bbox&&(i.bbox=r.bbox),i.properties=e||{},i.geometry=t,i}({type:"Point",coordinates:t},e,r)}([(r[0]+r[2])/2,(r[1]+r[3])/2],e.properties,e)},Se="#000000",Pe="#FFFFFF",Ce="rgba(255, 0, 0, 0.4)",Me="#FFFFFF",Ae={type:"FeatureCollection",features:[]};class Ie{constructor(t,e){this.callFitBounds=!1,this._eventHandlers=[],this.setGeoJSON(t),this.options={id:"geolonia-simple-style",cluster:!0,heatmap:!1,clusterColor:"#ff0000",...e}}updateData(t){this.setGeoJSON(t);const e=this.geojson.features,r=e.filter(t=>"point"!==t.geometry.type.toLowerCase()),i=e.filter(t=>"point"===t.geometry.type.toLowerCase());return this.map.getSource(this.options.id).setData({type:"FeatureCollection",features:r}),this.map.getSource(`${this.options.id}-points`).setData({type:"FeatureCollection",features:i}),this}addTo(t){this.map=t;const e=this.geojson.features,r=e.filter(t=>"point"!==t.geometry.type.toLowerCase()),i=e.filter(t=>"point"===t.geometry.type.toLowerCase());return this.map.addSource(this.options.id,{type:"geojson",data:{type:"FeatureCollection",features:r}}),this.setPolygonGeometries(),this.setLineGeometries(),this.map.addSource(`${this.options.id}-points`,{type:"geojson",data:{type:"FeatureCollection",features:i},cluster:this.options.cluster,clusterMaxZoom:14,clusterRadius:50}),this.map.addLayer({id:`${this.options.id}-polygon-symbol`,type:"symbol",source:this.options.id,filter:["==","$type","Polygon"],paint:{"text-color":["string",["get","text-color"],Se],"text-halo-color":["string",["get","text-halo-color"],Pe],"text-halo-width":1},layout:{"text-field":["get","title"],"text-font":["Noto Sans Regular"],"text-size":12,"text-max-width":12,"text-allow-overlap":!1}}),this.map.addLayer({id:`${this.options.id}-linestring-symbol`,type:"symbol",source:this.options.id,filter:["==","$type","LineString"],paint:{"text-color":["string",["get","text-color"],Se],"text-halo-color":["string",["get","text-halo-color"],Pe],"text-halo-width":1},layout:{"symbol-placement":"line","text-field":["get","title"],"text-font":["Noto Sans Regular"],"text-size":12,"text-max-width":12,"text-allow-overlap":!1}}),this.setPointGeometries(),this.setCluster(),this}fitBounds(t={}){this.callFitBounds=!0;const e={duration:3e3,padding:30,...t},r=ye()(this.geojson);return r&&window.requestAnimationFrame(()=>{this.map.fitBounds(r,e)}),this}setPolygonGeometries(){this.map.addLayer({id:`${this.options.id}-polygon`,type:"fill",source:this.options.id,filter:["==","$type","Polygon"],paint:{"fill-color":["string",["get","fill"],Ce],"fill-opacity":["number",["get","fill-opacity"],1],"fill-outline-color":["string",["get","stroke"],Me]}}),this.setPopup(this.map,`${this.options.id}-polygon`)}setLineGeometries(){this.map.addLayer({id:`${this.options.id}-linestring`,type:"line",source:this.options.id,filter:["==","$type","LineString"],paint:{"line-width":["number",["get","stroke-width"],2],"line-color":["string",["get","stroke"],Ce],"line-opacity":["number",["get","stroke-opacity"],1]},layout:{"line-cap":"round","line-join":"round"}}),this.setPopup(this.map,`${this.options.id}-linestring`)}setPointGeometries(){this.map.addLayer({id:`${this.options.id}-circle-points`,type:"circle",source:`${this.options.id}-points`,filter:["all",["!has","point_count"],["!has","marker-symbol"]],paint:{"circle-radius":["case",["==","small",["get","marker-size"]],7,["==","large",["get","marker-size"]],13,9],"circle-color":["string",["get","marker-color"],Ce],"circle-opacity":["number",["get","fill-opacity"],1],"circle-stroke-width":["number",["get","stroke-width"],1],"circle-stroke-color":["string",["get","stroke"],Me],"circle-stroke-opacity":["number",["get","stroke-opacity"],1]}}),this.map.addLayer({id:`${this.options.id}-symbol-points`,type:"symbol",source:`${this.options.id}-points`,filter:["!",["has","point_count"]],paint:{"text-color":["string",["get","text-color"],Se],"text-halo-color":["string",["get","text-halo-color"],Pe],"text-halo-width":1},layout:{"icon-image":["get","marker-symbol"],"text-field":["get","title"],"text-font":["Noto Sans Regular"],"text-size":12,"text-max-width":12,"text-allow-overlap":!0,"icon-allow-overlap":!0,"text-variable-anchor":["top","bottom","left","right"],"text-radial-offset":["case",["==","small",["get","marker-size"]],1,["==","large",["get","marker-size"]],1.6,1.2]}}),this.setPopup(this.map,`${this.options.id}-circle-points`),this.setPopup(this.map,`${this.options.id}-symbol-points`)}async setPopup(t,r){const i=async r=>{const i=Te(r.features[0]).geometry.coordinates,n=r.features[0].properties.description;if(n){const r=await ee(n);(new(e().Popup)).setLngLat(i).setHTML(r).addTo(t)}},n=e=>{e.features[0].properties.description&&(t.getCanvas().style.cursor="pointer")},o=()=>{t.getCanvas().style.cursor=""};t.on("click",r,i),t.on("mouseenter",r,n),t.on("mouseleave",r,o),this._eventHandlers.push({event:"click",layer:r,handler:i},{event:"mouseenter",layer:r,handler:n},{event:"mouseleave",layer:r,handler:o})}setCluster(){this.map.addLayer({id:`${this.options.id}-clusters`,type:"circle",source:`${this.options.id}-points`,filter:["has","point_count"],paint:{"circle-radius":20,"circle-color":this.options.clusterColor,"circle-opacity":1}}),this.map.addLayer({id:`${this.options.id}-cluster-count`,type:"symbol",source:`${this.options.id}-points`,filter:["has","point_count"],layout:{"text-field":"{point_count_abbreviated}","text-size":14,"text-font":["Noto Sans Regular"]}});const t=`${this.options.id}-clusters`,e=async e=>{const r=this.map.queryRenderedFeatures(e.point,{layers:[t]}),i=r[0].properties.cluster_id,n=await this.map.getSource(`${this.options.id}-points`).getClusterExpansionZoom(i);this.map.easeTo({center:r[0].geometry.coordinates,zoom:n})},r=()=>{this.map.getCanvas().style.cursor="pointer"},i=()=>{this.map.getCanvas().style.cursor=""};this.map.on("click",t,e),this.map.on("mouseenter",t,r),this.map.on("mouseleave",t,i),this._eventHandlers.push({event:"click",layer:t,handler:e},{event:"mouseenter",layer:t,handler:r},{event:"mouseleave",layer:t,handler:i})}remove(){if(!this.map)return this;const t=this.options.id;for(const{event:t,layer:e,handler:r}of this._eventHandlers)this.map.off(t,e,r);this._eventHandlers=[];const e=[`${t}-polygon-symbol`,`${t}-linestring-symbol`,`${t}-circle-points`,`${t}-symbol-points`,`${t}-polygon`,`${t}-linestring`,`${t}-clusters`,`${t}-cluster-count`];for(const t of e)this.map.getLayer(t)&&this.map.removeLayer(t);for(const e of[t,`${t}-points`])this.map.getSource(e)&&this.map.removeSource(e);return this.map.getCanvas().style.cursor="",this}setGeoJSON(t){if("string"==typeof t&&Xt(t)){this.geojson=Ae;const e=async()=>{try{const e=await window.fetch(t),r=e.ok?await e.json():{};this.geojson=r,this.updateData(r),this.callFitBounds&&(this.fitBounds(),this.callFitBounds=!1)}catch(t){console.error("[Geolonia] Failed to load GeoJSON:",t)}};this._loadingPromise=e()}else this.geojson=t}}const Ee="#000000",ke="#FFFFFF",ze="rgba(255, 0, 0, 0.4)",Re="#FFFFFF",De=class{constructor(t){this.url=t,this.sourceName="vt-geolonia-simple-style"}addTo(t){const e=t.getContainer();if(!e.dataset||!e.dataset.lng&&!e.dataset.lat){let e=!1;t.on("sourcedata",r=>{if(r.sourceId!==this.sourceName)return;const i=t.getSource(r.sourceId);!0===(i&&i.loaded())&&(e||(e=!0,t.fitBounds(i.bounds,{duration:0,padding:30})))})}t.addSource(this.sourceName,{type:"vector",url:this.url}),this.setPolygonGeometries(t),this.setLineGeometries(t),t.addLayer({id:"vt-geolonia-simple-style-polygon-symbol",type:"symbol",source:this.sourceName,"source-layer":"g-simplestyle-v1",filter:["==","$type","Polygon"],paint:{"text-color":["string",["get","text-color"],Ee],"text-halo-color":["string",["get","text-halo-color"],ke],"text-halo-width":1},layout:{"text-field":["get","title"],"text-font":["Noto Sans Regular"],"text-size":12,"text-max-width":12,"text-allow-overlap":!1}}),t.addLayer({id:"vt-geolonia-simple-style-linestring-symbol",type:"symbol",source:this.sourceName,"source-layer":"g-simplestyle-v1",filter:["==","$type","LineString"],paint:{"text-color":["string",["get","text-color"],Ee],"text-halo-color":["string",["get","text-halo-color"],ke],"text-halo-width":1},layout:{"symbol-placement":"line","text-field":["get","title"],"text-font":["Noto Sans Regular"],"text-size":12,"text-max-width":12,"text-allow-overlap":!1}}),this.setPointGeometries(t)}setPolygonGeometries(t){t.addLayer({id:"vt-geolonia-simple-style-polygon",type:"fill",source:this.sourceName,"source-layer":"g-simplestyle-v1",filter:["==","$type","Polygon"],paint:{"fill-color":["string",["get","fill"],ze],"fill-opacity":["number",["get","fill-opacity"],1],"fill-outline-color":["string",["get","stroke"],Re]}}),this.setPopup(t,"vt-geolonia-simple-style-polygon")}setLineGeometries(t){t.addLayer({id:"vt-geolonia-simple-style-linestring",type:"line",source:this.sourceName,"source-layer":"g-simplestyle-v1",filter:["==","$type","LineString"],paint:{"line-width":["number",["get","stroke-width"],2],"line-color":["string",["get","stroke"],ze],"line-opacity":["number",["get","stroke-opacity"],1]},layout:{"line-cap":"round","line-join":"round"}}),this.setPopup(t,"vt-geolonia-simple-style-linestring")}setPointGeometries(t){t.addLayer({id:"vt-circle-simple-style-points",type:"circle",source:this.sourceName,"source-layer":"g-simplestyle-v1",filter:["all",["==","$type","Point"],["!has","marker-symbol"]],paint:{"circle-radius":["case",["==","small",["get","marker-size"]],7,["==","large",["get","marker-size"]],13,9],"circle-color":["string",["get","marker-color"],ze],"circle-opacity":["number",["get","fill-opacity"],1],"circle-stroke-width":["number",["get","stroke-width"],1],"circle-stroke-color":["string",["get","stroke"],Re],"circle-stroke-opacity":["number",["get","stroke-opacity"],1]}}),t.addLayer({id:"vt-geolonia-simple-style-points",type:"symbol",source:this.sourceName,"source-layer":"g-simplestyle-v1",filter:["==","$type","Point"],paint:{"text-color":["string",["get","text-color"],Ee],"text-halo-color":["string",["get","text-halo-color"],ke],"text-halo-width":1},layout:{"icon-image":["get","marker-symbol"],"text-field":["get","title"],"text-font":["Noto Sans Regular"],"text-size":12,"text-anchor":"top","text-max-width":12,"text-offset":["case",["==","small",["get","marker-size"]],["literal",[0,1]],["==","large",["get","marker-size"]],["literal",[0,1.6]],["literal",[0,1.2]]],"text-allow-overlap":!1}}),this.setPopup(t,"vt-circle-simple-style-points"),this.setPopup(t,"vt-geolonia-simple-style-points")}async setPopup(t,r){t.on("click",r,async r=>{const i=Te(r.features[0]).geometry.coordinates,n=r.features[0].properties.description;if(n){const r=await ee(n);(new(e().Popup)).setLngLat(i).setHTML(r).addTo(t)}}),t.on("mouseenter",r,e=>{e.features[0].properties.description&&(t.getCanvas().style.cursor="pointer")}),t.on("mouseleave",r,()=>{t.getCanvas().style.cursor=""})}};class Le extends e().Map{constructor(e){const r=function(t){if(Yt(t))return t;if("string"==typeof t)return document.querySelector(t)||document.getElementById(t)||!1;if(t.container){if(Yt(t.container))return t.container;if("string"==typeof t.container)return document.querySelector(t.container)||document.getElementById(t.container)||!1}return!1}(e);if(!r)throw"string"==typeof e?new Error(`[Geolonia] No HTML elements found matching \`${e}\`. Please ensure the map container element exists.`):new Error("[Geolonia] No HTML elements found. Please ensure the map container element exists.");if(r.geoloniaMap)return r.geoloniaMap;0===r.clientHeight&&console.warn("[Geolonia] Embed API failed to render the map because the container has no height. Please set the CSS property `height` to the container.");const i=ge(r,{interactive:"object"!=typeof e||e.interactive}),n=function(t,e,r){e.container&&delete e.container,e===t&&(e={});const i={style:r.style||e.style,container:t,center:[parseFloat(r.lng),parseFloat(r.lat)],bearing:parseFloat(r.bearing),pitch:parseFloat(r.pitch),zoom:parseFloat(r.zoom),hash:"on"===r.hash,localIdeographFontFamily:"sans-serif",attributionControl:!1};return""===r.minZoom||0!==Number(r.minZoom)&&!Number(r.minZoom)||(i.minZoom=Number(r.minZoom)),""!==r.maxZoom&&Number(r.maxZoom)&&(i.maxZoom=Number(r.maxZoom)),Object.assign(i,e),i}(r,e,i),o=r.innerHTML.trim();let a;r.innerHTML="","off"!==i.loader&&(a=document.createElement("div"),a.addEventListener("touchmove",t=>{t.touches&&t.touches.length>1&&t.preventDefault()}),a.className="loading-geolonia-map",a.innerHTML='<div class="lds-grid"><div></div><div></div><div></div>\n <div></div><div></div><div></div><div></div><div></div><div></div></div>',r.appendChild(a));const s=te(40),l=new URL(`${i.apiUrl}/sources`);l.searchParams.set("key",i.key),l.searchParams.set("sessionId",s);const c=n.transformRequest;n.transformRequest=(t,e)=>{if("Source"===e&&t.startsWith("https://api.geolonia.com"))return{url:l.toString()};let r=t;if(t.startsWith("geolonia://")){const e=t.match(/^geolonia:\/\/tiles\/(?<username>.+)\/(?<customtileId>.+)/);e&&(r=`https://tileserver.geolonia.com/customtiles/${e.groups.customtileId}/tiles.json`)}const n=new URL(r),o=function(t){try{const e="string"==typeof t?new URL(t):t;return"tileserver.geolonia.com"===e.hostname||e.hostname.endsWith(".tiles.geolonia.com")}catch(t){return!1}}(n);if("Source"===e&&o)return"dev"===i.stage&&"tileserver.geolonia.com"===n.hostname&&(n.hostname="tileserver-dev.geolonia.com"),n.searchParams.set("sessionId",s),n.searchParams.set("key",i.key),{url:n.toString()};if(("SpriteJSON"===e||"SpriteImage"===e)&&r.match(/^https:\/\/api\.geolonia\.com\/(dev|v1)\/sprites\//)){const t=n.pathname.split("/");return t[1]=String(i.stage),n.pathname=t.join("/"),n.searchParams.set("key",i.key),{url:n.toString()}}let a;return"function"==typeof c&&(a=c(r,e)),a};try{super(n)}catch(t){throw(t=>{const e=document.createElement("div");e.classList.add("geolonia__error-container");const r=document.createElement("div"),i=document.createElement("h2");i.textContent="Geolonia Maps",r.appendChild(i),r.classList.add("geolonia__error-message"),r.innerHTML+='<div class="geolonia__error-message-description">地図の初期化に失敗しました。管理者にお問い合わせ下さい。開発者の方は開発者ツールでエラー詳細をご確認下さい。</div>',e.appendChild(r),t.appendChild(e)})(r),t}const h=this;this.geoloniaSourcesUrl=l,this.__styleExtensionLoadRequired=!0;const{position:u}=Jt(i.geoloniaControl);h.addControl(new ie,u),h.addControl(new de,"bottom-right");const{enabled:p,position:d}=Jt(i.fullscreenControl);p&&h.addControl(new t.FullscreenControl,d);const{enabled:f,position:m}=Jt(i.navigationControl);f&&h.addControl(new t.NavigationControl,m);const{enabled:g,position:_}=Jt(i.geolocateControl);g&&h.addControl(new t.GeolocateControl({}),_);const{enabled:y,position:b}=Jt(i.scaleControl);return y&&h.addControl(new t.ScaleControl({}),b),h.on("load",e=>{const s=e.target;if("off"!==i.loader)try{r.removeChild(a)}catch(t){}if("off"!==i.gestureHandling&&function(){const t=document.body,e=document.documentElement;return t.scrollHeight>t.clientHeight||e.scrollHeight>e.clientHeight}()&&new me({lang:i.lang}).addTo(s),i.lat&&i.lng&&"on"===i.marker)if(o){const e=new t.Popup({offset:[0,-25]}).setHTML(o);let r;if(i.customMarker){const t=i.customMarkerOffset.split(/,/).map(t=>Number(t.trim())),o=document.querySelector(i.customMarker);o.style.display="block",r=new re({element:o,offset:t}).setLngLat(n.center).addTo(s).setPopup(e)}else r=new re({color:i.markerColor}).setLngLat(n.center).addTo(s).setPopup(e);"on"===i.openPopup&&r.togglePopup(),r.getElement().classList.add("geolonia-clickable-marker")}else new re({color:i.markerColor}).setLngLat(n.center).addTo(s)}),h.on("styledata",async t=>{const e=t.target;if(this.__styleExtensionLoadRequired){if(this.__styleExtensionLoadRequired=!1,i.simpleVector){const t=(n=i.simpleVector,/^(https?|geolonia):\/\//.test(n)?n:`geolonia://tiles/custom/${n}`);new De(t).addTo(e)}var n;if(i.geojson){const t=(t=>{if(/^https?:\/\//.test(t))return!1;if(/^\//.test(t))return!1;if(/^\.\//.test(t))return!1;if(/^\.\.\//.test(t))return!1;try{return document.querySelector(t)}catch(t){return!1}})(i.geojson);let n;n=t?JSON.parse(t.textContent):i.geojson;const o=new Ie(n,{cluster:"on"===i.cluster,clusterColor:i.clusterColor});o.addTo(e),r.dataset&&(r.dataset.lng||r.dataset.lat)||o.fitBounds()}i["3d"]&&e.getStyle().layers.forEach(t=>{"on"===i["3d"]&&t.metadata&&!0===t.metadata["visible-on-3d"]?e.setLayoutProperty(t.id,"visibility","visible"):"off"===i["3d"]&&t.metadata&&!0===t.metadata["visible-on-3d"]||"on"===i["3d"]&&t.metadata&&!0===t.metadata["hide-on-3d"]?e.setLayoutProperty(t.id,"visibility","none"):"off"===i["3d"]&&t.metadata&&!0===t.metadata["hide-on-3d"]&&e.setLayoutProperty(t.id,"visibility","visible")})}}),h.on("error",async t=>{t.error&&402===t.error.status&&(t=>{if(!t._geolonia_restricted_mode_handled){t._geolonia_restricted_mode_handled=!0;const e=t.getContainer();t.remove(),e.innerHTML="",e.classList.add("geolonia__restricted-mode-image-container")}})(h)}),r.geoloniaMap=h,h}setStyle(t,e={}){if(null!==t){const e=ge(this.getContainer());"string"==typeof t&&(t=function(t,e){if(Wt.isGeoloniaStyleCheck(t)&&!e.key)throw new Error("[Geolonia] API key is required to use Geolonia styles. Please provide an API key or use an external style URL.");if(!t||""===t)return"ja"===e.lang?"https://cdn.geolonia.com/style/geolonia/basic-v2/ja.json":"https://cdn.geolonia.com/style/geolonia/basic-v2/en.json";const r=Xt(t);if(r)return"https:"===location.protocol&&r.startsWith("http:")&&console.warn(`[Geolonia] Mixed Content Warning: You are loading a style from an insecure HTTP URL (${r}) on an HTTPS page. This may fail in modern browsers.`),r;if(t.endsWith(".json"))try{const e=new URL(t,location.href).href;return"https:"===location.protocol&&e.startsWith("http:")&&console.warn(`[Geolonia] Mixed Content Warning: You are loading a style from an insecure HTTP URL (${e}) on an HTTPS page. This may fail in modern browsers.`),e}catch(e){return console.error("[Geolonia] Failed to resolve style URL:",t,e),t}return"ja"===e.lang?`https://cdn.geolonia.com/style/${t}/ja.json`:`https://cdn.geolonia.com/style/${t}/en.json`}(t,e))}return this.__styleExtensionLoadRequired=!0,super.setStyle.call(this,t,e),this}remove(){const t=this.getContainer();super.remove.call(this),delete t.geoloniaMap}loadImage(t,e){const r=super.loadImage(t);if(!e)return r;!function(t,e){t.then(t=>{e(null,t.data,{cacheControl:t.cacheControl,expires:t.expires})}).catch(t=>{e(t)})}(r,e)}}var Fe=a(5072),Be=a.n(Fe),Oe=a(7825),je=a.n(Oe),Ue=a(7659),Ne=a.n(Ue),Ve=a(5056),$e=a.n(Ve),Ze=a(540),Ge=a.n(Ze),qe=a(1113),He=a.n(qe),We=a(5955),Xe={};Xe.styleTagTransform=He(),Xe.setAttributes=$e(),Xe.insert=Ne().bind(null,"head"),Xe.domAPI=je(),Xe.insertStyleElement=Ge(),Be()(We.A,Xe),We.A&&We.A.locals&&We.A.locals;var Ke=a(1208),Ye={};Ye.styleTagTransform=He(),Ye.setAttributes=$e(),Ye.insert=Ne().bind(null,"head"),Ye.domAPI=je(),Ye.insertStyleElement=Ge(),Be()(Ke.A,Ye),Ke.A&&Ke.A.locals&&Ke.A.locals;const Je=[],Qe=t=>{Je.push(t)},tr="5.1.0",er=new class{constructor(t){var e;this.tilev4=(t,e)=>i(this,null,function*(){if("json"===t.type){const e=t.url.substr(10);let r=this.tiles.get(e);if(r||(r=new ot(e),this.tiles.set(e,r)),this.metadata)return{data:yield r.getTileJson(t.url)};const i=yield r.getHeader();return{data:{tiles:[`${t.url}/{z}/{x}/{y}`],minzoom:i.minZoom,maxzoom:i.maxZoom,bounds:[i.minLon,i.minLat,i.maxLon,i.maxLat]}}}const r=new RegExp(/pmtiles:\/\/(.+)\/(\d+)\/(\d+)\/(\d+)/),i=t.url.match(r);if(!i)throw new Error("Invalid PMTiles protocol URL");const n=i[1];let o=this.tiles.get(n);o||(o=new ot(n),this.tiles.set(n,o));const a=i[2],s=i[3],l=i[4],c=yield o.getHeader(),h=yield null==o?void 0:o.getZxy(+a,+s,+l,e.signal);return h?{data:new Uint8Array(h.data),cacheControl:h.cacheControl,expires:h.expires}:1===c.tileType?{data:new Uint8Array}:{data:null}}),this.tile=(e=this.tilev4,(t,r)=>{if(r instanceof AbortController)return e(t,r);const i=new AbortController;return e(t,i).then(t=>r(void 0,t.data,t.cacheControl||"",t.expires||""),t=>r(t)).catch(t=>r(t)),{cancel:()=>i.abort()}}),this.tiles=new Map,this.metadata=(null==t?void 0:t.metadata)||!1}add(t){this.tiles.set(t.source.getKey(),t)}get(t){return this.tiles.get(t)}};e().addProtocol("pmtiles",er.tile)})(),s})());