@panoramax/web-viewer 5.3.0-develop-e278677b → 5.3.0-develop-e555dbf8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/cjs/index.js
CHANGED
|
@@ -24,7 +24,7 @@ const E=globalThis,k=e=>e,S=E.trustedTypes,M=S?S.createPolicy("lit-html",{create
|
|
|
24
24
|
* Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com
|
|
25
25
|
* License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
|
|
26
26
|
* Copyright 2024 Fonticons, Inc.
|
|
27
|
-
*/function gt(e,t,i){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var n=i.call(e,t);if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function ft(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,n)}return i}function At(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?ft(Object(i),!0).forEach(function(t){gt(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):ft(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}const _t=()=>{};let vt={},yt={},xt=null,bt={mark:_t,measure:_t};try{"undefined"!=typeof window&&(vt=window),"undefined"!=typeof document&&(yt=document),"undefined"!=typeof MutationObserver&&(xt=MutationObserver),"undefined"!=typeof performance&&(bt=performance)}catch(y2){}const{userAgent:wt=""}=vt.navigator||{},Et=vt,kt=yt,St=xt,Mt=bt;Et.document;const Ct=!!kt.documentElement&&!!kt.head&&"function"==typeof kt.addEventListener&&"function"==typeof kt.createElement,Tt=~wt.indexOf("MSIE")||~wt.indexOf("Trident/");var Dt={classic:{fa:"solid",fas:"solid","fa-solid":"solid",far:"regular","fa-regular":"regular",fal:"light","fa-light":"light",fat:"thin","fa-thin":"thin",fab:"brands","fa-brands":"brands"},duotone:{fa:"solid",fad:"solid","fa-solid":"solid","fa-duotone":"solid",fadr:"regular","fa-regular":"regular",fadl:"light","fa-light":"light",fadt:"thin","fa-thin":"thin"},sharp:{fa:"solid",fass:"solid","fa-solid":"solid",fasr:"regular","fa-regular":"regular",fasl:"light","fa-light":"light",fast:"thin","fa-thin":"thin"},"sharp-duotone":{fa:"solid",fasds:"solid","fa-solid":"solid",fasdr:"regular","fa-regular":"regular",fasdl:"light","fa-light":"light",fasdt:"thin","fa-thin":"thin"}},Pt=["fa-classic","fa-duotone","fa-sharp","fa-sharp-duotone"],It="classic",Ft="duotone",zt=[It,Ft,"sharp","sharp-duotone"],Rt=new Map([["classic",{defaultShortPrefixId:"fas",defaultStyleId:"solid",styleIds:["solid","regular","light","thin","brands"],futureStyleIds:[],defaultFontWeight:900}],["sharp",{defaultShortPrefixId:"fass",defaultStyleId:"solid",styleIds:["solid","regular","light","thin"],futureStyleIds:[],defaultFontWeight:900}],["duotone",{defaultShortPrefixId:"fad",defaultStyleId:"solid",styleIds:["solid","regular","light","thin"],futureStyleIds:[],defaultFontWeight:900}],["sharp-duotone",{defaultShortPrefixId:"fasds",defaultStyleId:"solid",styleIds:["solid","regular","light","thin"],futureStyleIds:[],defaultFontWeight:900}]]),Lt=["fak","fa-kit","fakd","fa-kit-duotone"],Bt={fak:"kit","fa-kit":"kit"},Ot={fakd:"kit-duotone","fa-kit-duotone":"kit-duotone"},Ut=["fak","fakd"],Nt={kit:"fak"},jt={"kit-duotone":"fakd"},Vt={GROUP:"duotone-group",SWAP_OPACITY:"swap-opacity",PRIMARY:"primary",SECONDARY:"secondary"},qt=["fak","fa-kit","fakd","fa-kit-duotone"],Gt={classic:{fab:"fa-brands",fad:"fa-duotone",fal:"fa-light",far:"fa-regular",fas:"fa-solid",fat:"fa-thin"},duotone:{fadr:"fa-regular",fadl:"fa-light",fadt:"fa-thin"},sharp:{fass:"fa-solid",fasr:"fa-regular",fasl:"fa-light",fast:"fa-thin"},"sharp-duotone":{fasds:"fa-solid",fasdr:"fa-regular",fasdl:"fa-light",fasdt:"fa-thin"}},Ht=["fa","fas","far","fal","fat","fad","fadr","fadl","fadt","fab","fass","fasr","fasl","fast","fasds","fasdr","fasdl","fasdt","fa-classic","fa-duotone","fa-sharp","fa-sharp-duotone","fa-solid","fa-regular","fa-light","fa-thin","fa-duotone","fa-brands"],Wt=[1,2,3,4,5,6,7,8,9,10],Zt=Wt.concat([11,12,13,14,15,16,17,18,19,20]),Kt=[...Object.keys({classic:["fas","far","fal","fat","fad"],duotone:["fadr","fadl","fadt"],sharp:["fass","fasr","fasl","fast"],"sharp-duotone":["fasds","fasdr","fasdl","fasdt"]}),"solid","regular","light","thin","duotone","brands","2xs","xs","sm","lg","xl","2xl","beat","border","fade","beat-fade","bounce","flip-both","flip-horizontal","flip-vertical","flip","fw","inverse","layers-counter","layers-text","layers","li","pull-left","pull-right","pulse","rotate-180","rotate-270","rotate-90","rotate-by","shake","spin-pulse","spin-reverse","spin","stack-1x","stack-2x","stack","ul",Vt.GROUP,Vt.SWAP_OPACITY,Vt.PRIMARY,Vt.SECONDARY].concat(Wt.map(e=>"".concat(e,"x"))).concat(Zt.map(e=>"w-".concat(e)));const Xt="___FONT_AWESOME___",Qt=16,Yt="svg-inline--fa",Jt="data-fa-i2svg",$t="data-fa-pseudo-element",ei="data-prefix",ti="data-icon",ii="fontawesome-i2svg",ni=["HTML","HEAD","STYLE","SCRIPT"],ai=(()=>{try{return"production"===process.env.NODE_ENV}catch(e){return!1}})();function ri(e){return new Proxy(e,{get:(e,t)=>t in e?e[t]:e[It]})}const si=At({},Dt);si[It]=At(At(At(At({},{"fa-duotone":"duotone"}),Dt[It]),Bt),Ot);const oi=ri(si),li=At({},{classic:{solid:"fas",regular:"far",light:"fal",thin:"fat",brands:"fab"},duotone:{solid:"fad",regular:"fadr",light:"fadl",thin:"fadt"},sharp:{solid:"fass",regular:"fasr",light:"fasl",thin:"fast"},"sharp-duotone":{solid:"fasds",regular:"fasdr",light:"fasdl",thin:"fasdt"}});li[It]=At(At(At(At({},{duotone:"fad"}),li[It]),Nt),jt);const ci=ri(li),ui=At({},Gt);ui[It]=At(At({},ui[It]),{fak:"fa-kit"});const hi=ri(ui),di=At({},{classic:{"fa-brands":"fab","fa-duotone":"fad","fa-light":"fal","fa-regular":"far","fa-solid":"fas","fa-thin":"fat"},duotone:{"fa-regular":"fadr","fa-light":"fadl","fa-thin":"fadt"},sharp:{"fa-solid":"fass","fa-regular":"fasr","fa-light":"fasl","fa-thin":"fast"},"sharp-duotone":{"fa-solid":"fasds","fa-regular":"fasdr","fa-light":"fasdl","fa-thin":"fasdt"}});di[It]=At(At({},di[It]),{"fa-kit":"fak"}),ri(di);const pi=/fa(s|r|l|t|d|dr|dl|dt|b|k|kd|ss|sr|sl|st|sds|sdr|sdl|sdt)?[\-\ ]/,mi="fa-layers-text",gi=/Font ?Awesome ?([56 ]*)(Solid|Regular|Light|Thin|Duotone|Brands|Free|Pro|Sharp Duotone|Sharp|Kit)?.*/i;ri(At({},{classic:{900:"fas",400:"far",normal:"far",300:"fal",100:"fat"},duotone:{900:"fad",400:"fadr",300:"fadl",100:"fadt"},sharp:{900:"fass",400:"fasr",300:"fasl",100:"fast"},"sharp-duotone":{900:"fasds",400:"fasdr",300:"fasdl",100:"fasdt"}}));const fi=["class","data-prefix","data-icon","data-fa-transform","data-fa-mask"],Ai={GROUP:"duotone-group",PRIMARY:"primary",SECONDARY:"secondary"},_i=["kit",...Kt],vi=Et.FontAwesomeConfig||{};if(kt&&"function"==typeof kt.querySelector){[["data-family-prefix","familyPrefix"],["data-css-prefix","cssPrefix"],["data-family-default","familyDefault"],["data-style-default","styleDefault"],["data-replacement-class","replacementClass"],["data-auto-replace-svg","autoReplaceSvg"],["data-auto-add-css","autoAddCss"],["data-auto-a11y","autoA11y"],["data-search-pseudo-elements","searchPseudoElements"],["data-observe-mutations","observeMutations"],["data-mutate-approach","mutateApproach"],["data-keep-original-source","keepOriginalSource"],["data-measure-performance","measurePerformance"],["data-show-missing-icons","showMissingIcons"]].forEach(e=>{let[t,i]=e;const n=function(e){return""===e||"false"!==e&&("true"===e||e)}(function(e){var t=kt.querySelector("script["+e+"]");if(t)return t.getAttribute(e)}(t));null!=n&&(vi[i]=n)})}const yi={styleDefault:"solid",familyDefault:It,cssPrefix:"fa",replacementClass:Yt,autoReplaceSvg:!0,autoAddCss:!0,autoA11y:!0,searchPseudoElements:!1,observeMutations:!0,mutateApproach:"async",keepOriginalSource:!0,measurePerformance:!1,showMissingIcons:!0};vi.familyPrefix&&(vi.cssPrefix=vi.familyPrefix);const xi=At(At({},yi),vi);xi.autoReplaceSvg||(xi.observeMutations=!1);const bi={};Object.keys(yi).forEach(e=>{Object.defineProperty(bi,e,{enumerable:!0,set:function(t){xi[e]=t,wi.forEach(e=>e(bi))},get:function(){return xi[e]}})}),Object.defineProperty(bi,"familyPrefix",{enumerable:!0,set:function(e){xi.cssPrefix=e,wi.forEach(e=>e(bi))},get:function(){return xi.cssPrefix}}),Et.FontAwesomeConfig=bi;const wi=[];const Ei=Qt,ki={size:16,x:0,y:0,rotate:0,flipX:!1,flipY:!1};function Si(){let e=12,t="";for(;e-- >0;)t+="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[62*Math.random()|0];return t}function Mi(e){const t=[];for(let i=(e||[]).length>>>0;i--;)t[i]=e[i];return t}function Ci(e){return e.classList?Mi(e.classList):(e.getAttribute("class")||"").split(" ").filter(e=>e)}function Ti(e){return"".concat(e).replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}function Di(e){return Object.keys(e||{}).reduce((t,i)=>t+"".concat(i,": ").concat(e[i].trim(),";"),"")}function Pi(e){return e.size!==ki.size||e.x!==ki.x||e.y!==ki.y||e.rotate!==ki.rotate||e.flipX||e.flipY}function Ii(){const e="fa",t=Yt,i=bi.cssPrefix,n=bi.replacementClass;let a=':root, :host {\n --fa-font-solid: normal 900 1em/1 "Font Awesome 6 Free";\n --fa-font-regular: normal 400 1em/1 "Font Awesome 6 Free";\n --fa-font-light: normal 300 1em/1 "Font Awesome 6 Pro";\n --fa-font-thin: normal 100 1em/1 "Font Awesome 6 Pro";\n --fa-font-duotone: normal 900 1em/1 "Font Awesome 6 Duotone";\n --fa-font-duotone-regular: normal 400 1em/1 "Font Awesome 6 Duotone";\n --fa-font-duotone-light: normal 300 1em/1 "Font Awesome 6 Duotone";\n --fa-font-duotone-thin: normal 100 1em/1 "Font Awesome 6 Duotone";\n --fa-font-brands: normal 400 1em/1 "Font Awesome 6 Brands";\n --fa-font-sharp-solid: normal 900 1em/1 "Font Awesome 6 Sharp";\n --fa-font-sharp-regular: normal 400 1em/1 "Font Awesome 6 Sharp";\n --fa-font-sharp-light: normal 300 1em/1 "Font Awesome 6 Sharp";\n --fa-font-sharp-thin: normal 100 1em/1 "Font Awesome 6 Sharp";\n --fa-font-sharp-duotone-solid: normal 900 1em/1 "Font Awesome 6 Sharp Duotone";\n --fa-font-sharp-duotone-regular: normal 400 1em/1 "Font Awesome 6 Sharp Duotone";\n --fa-font-sharp-duotone-light: normal 300 1em/1 "Font Awesome 6 Sharp Duotone";\n --fa-font-sharp-duotone-thin: normal 100 1em/1 "Font Awesome 6 Sharp Duotone";\n}\n\nsvg:not(:root).svg-inline--fa, svg:not(:host).svg-inline--fa {\n overflow: visible;\n box-sizing: content-box;\n}\n\n.svg-inline--fa {\n display: var(--fa-display, inline-block);\n height: 1em;\n overflow: visible;\n vertical-align: -0.125em;\n}\n.svg-inline--fa.fa-2xs {\n vertical-align: 0.1em;\n}\n.svg-inline--fa.fa-xs {\n vertical-align: 0em;\n}\n.svg-inline--fa.fa-sm {\n vertical-align: -0.0714285705em;\n}\n.svg-inline--fa.fa-lg {\n vertical-align: -0.2em;\n}\n.svg-inline--fa.fa-xl {\n vertical-align: -0.25em;\n}\n.svg-inline--fa.fa-2xl {\n vertical-align: -0.3125em;\n}\n.svg-inline--fa.fa-pull-left {\n margin-right: var(--fa-pull-margin, 0.3em);\n width: auto;\n}\n.svg-inline--fa.fa-pull-right {\n margin-left: var(--fa-pull-margin, 0.3em);\n width: auto;\n}\n.svg-inline--fa.fa-li {\n width: var(--fa-li-width, 2em);\n top: 0.25em;\n}\n.svg-inline--fa.fa-fw {\n width: var(--fa-fw-width, 1.25em);\n}\n\n.fa-layers svg.svg-inline--fa {\n bottom: 0;\n left: 0;\n margin: auto;\n position: absolute;\n right: 0;\n top: 0;\n}\n\n.fa-layers-counter, .fa-layers-text {\n display: inline-block;\n position: absolute;\n text-align: center;\n}\n\n.fa-layers {\n display: inline-block;\n height: 1em;\n position: relative;\n text-align: center;\n vertical-align: -0.125em;\n width: 1em;\n}\n.fa-layers svg.svg-inline--fa {\n transform-origin: center center;\n}\n\n.fa-layers-text {\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n transform-origin: center center;\n}\n\n.fa-layers-counter {\n background-color: var(--fa-counter-background-color, #ff253a);\n border-radius: var(--fa-counter-border-radius, 1em);\n box-sizing: border-box;\n color: var(--fa-inverse, #fff);\n line-height: var(--fa-counter-line-height, 1);\n max-width: var(--fa-counter-max-width, 5em);\n min-width: var(--fa-counter-min-width, 1.5em);\n overflow: hidden;\n padding: var(--fa-counter-padding, 0.25em 0.5em);\n right: var(--fa-right, 0);\n text-overflow: ellipsis;\n top: var(--fa-top, 0);\n transform: scale(var(--fa-counter-scale, 0.25));\n transform-origin: top right;\n}\n\n.fa-layers-bottom-right {\n bottom: var(--fa-bottom, 0);\n right: var(--fa-right, 0);\n top: auto;\n transform: scale(var(--fa-layers-scale, 0.25));\n transform-origin: bottom right;\n}\n\n.fa-layers-bottom-left {\n bottom: var(--fa-bottom, 0);\n left: var(--fa-left, 0);\n right: auto;\n top: auto;\n transform: scale(var(--fa-layers-scale, 0.25));\n transform-origin: bottom left;\n}\n\n.fa-layers-top-right {\n top: var(--fa-top, 0);\n right: var(--fa-right, 0);\n transform: scale(var(--fa-layers-scale, 0.25));\n transform-origin: top right;\n}\n\n.fa-layers-top-left {\n left: var(--fa-left, 0);\n right: auto;\n top: var(--fa-top, 0);\n transform: scale(var(--fa-layers-scale, 0.25));\n transform-origin: top left;\n}\n\n.fa-1x {\n font-size: 1em;\n}\n\n.fa-2x {\n font-size: 2em;\n}\n\n.fa-3x {\n font-size: 3em;\n}\n\n.fa-4x {\n font-size: 4em;\n}\n\n.fa-5x {\n font-size: 5em;\n}\n\n.fa-6x {\n font-size: 6em;\n}\n\n.fa-7x {\n font-size: 7em;\n}\n\n.fa-8x {\n font-size: 8em;\n}\n\n.fa-9x {\n font-size: 9em;\n}\n\n.fa-10x {\n font-size: 10em;\n}\n\n.fa-2xs {\n font-size: 0.625em;\n line-height: 0.1em;\n vertical-align: 0.225em;\n}\n\n.fa-xs {\n font-size: 0.75em;\n line-height: 0.0833333337em;\n vertical-align: 0.125em;\n}\n\n.fa-sm {\n font-size: 0.875em;\n line-height: 0.0714285718em;\n vertical-align: 0.0535714295em;\n}\n\n.fa-lg {\n font-size: 1.25em;\n line-height: 0.05em;\n vertical-align: -0.075em;\n}\n\n.fa-xl {\n font-size: 1.5em;\n line-height: 0.0416666682em;\n vertical-align: -0.125em;\n}\n\n.fa-2xl {\n font-size: 2em;\n line-height: 0.03125em;\n vertical-align: -0.1875em;\n}\n\n.fa-fw {\n text-align: center;\n width: 1.25em;\n}\n\n.fa-ul {\n list-style-type: none;\n margin-left: var(--fa-li-margin, 2.5em);\n padding-left: 0;\n}\n.fa-ul > li {\n position: relative;\n}\n\n.fa-li {\n left: calc(-1 * var(--fa-li-width, 2em));\n position: absolute;\n text-align: center;\n width: var(--fa-li-width, 2em);\n line-height: inherit;\n}\n\n.fa-border {\n border-color: var(--fa-border-color, #eee);\n border-radius: var(--fa-border-radius, 0.1em);\n border-style: var(--fa-border-style, solid);\n border-width: var(--fa-border-width, 0.08em);\n padding: var(--fa-border-padding, 0.2em 0.25em 0.15em);\n}\n\n.fa-pull-left {\n float: left;\n margin-right: var(--fa-pull-margin, 0.3em);\n}\n\n.fa-pull-right {\n float: right;\n margin-left: var(--fa-pull-margin, 0.3em);\n}\n\n.fa-beat {\n animation-name: fa-beat;\n animation-delay: var(--fa-animation-delay, 0s);\n animation-direction: var(--fa-animation-direction, normal);\n animation-duration: var(--fa-animation-duration, 1s);\n animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n animation-timing-function: var(--fa-animation-timing, ease-in-out);\n}\n\n.fa-bounce {\n animation-name: fa-bounce;\n animation-delay: var(--fa-animation-delay, 0s);\n animation-direction: var(--fa-animation-direction, normal);\n animation-duration: var(--fa-animation-duration, 1s);\n animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n animation-timing-function: var(--fa-animation-timing, cubic-bezier(0.28, 0.84, 0.42, 1));\n}\n\n.fa-fade {\n animation-name: fa-fade;\n animation-delay: var(--fa-animation-delay, 0s);\n animation-direction: var(--fa-animation-direction, normal);\n animation-duration: var(--fa-animation-duration, 1s);\n animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n animation-timing-function: var(--fa-animation-timing, cubic-bezier(0.4, 0, 0.6, 1));\n}\n\n.fa-beat-fade {\n animation-name: fa-beat-fade;\n animation-delay: var(--fa-animation-delay, 0s);\n animation-direction: var(--fa-animation-direction, normal);\n animation-duration: var(--fa-animation-duration, 1s);\n animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n animation-timing-function: var(--fa-animation-timing, cubic-bezier(0.4, 0, 0.6, 1));\n}\n\n.fa-flip {\n animation-name: fa-flip;\n animation-delay: var(--fa-animation-delay, 0s);\n animation-direction: var(--fa-animation-direction, normal);\n animation-duration: var(--fa-animation-duration, 1s);\n animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n animation-timing-function: var(--fa-animation-timing, ease-in-out);\n}\n\n.fa-shake {\n animation-name: fa-shake;\n animation-delay: var(--fa-animation-delay, 0s);\n animation-direction: var(--fa-animation-direction, normal);\n animation-duration: var(--fa-animation-duration, 1s);\n animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n animation-timing-function: var(--fa-animation-timing, linear);\n}\n\n.fa-spin {\n animation-name: fa-spin;\n animation-delay: var(--fa-animation-delay, 0s);\n animation-direction: var(--fa-animation-direction, normal);\n animation-duration: var(--fa-animation-duration, 2s);\n animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n animation-timing-function: var(--fa-animation-timing, linear);\n}\n\n.fa-spin-reverse {\n --fa-animation-direction: reverse;\n}\n\n.fa-pulse,\n.fa-spin-pulse {\n animation-name: fa-spin;\n animation-direction: var(--fa-animation-direction, normal);\n animation-duration: var(--fa-animation-duration, 1s);\n animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n animation-timing-function: var(--fa-animation-timing, steps(8));\n}\n\n@media (prefers-reduced-motion: reduce) {\n .fa-beat,\n.fa-bounce,\n.fa-fade,\n.fa-beat-fade,\n.fa-flip,\n.fa-pulse,\n.fa-shake,\n.fa-spin,\n.fa-spin-pulse {\n animation-delay: -1ms;\n animation-duration: 1ms;\n animation-iteration-count: 1;\n transition-delay: 0s;\n transition-duration: 0s;\n }\n}\n@keyframes fa-beat {\n 0%, 90% {\n transform: scale(1);\n }\n 45% {\n transform: scale(var(--fa-beat-scale, 1.25));\n }\n}\n@keyframes fa-bounce {\n 0% {\n transform: scale(1, 1) translateY(0);\n }\n 10% {\n transform: scale(var(--fa-bounce-start-scale-x, 1.1), var(--fa-bounce-start-scale-y, 0.9)) translateY(0);\n }\n 30% {\n transform: scale(var(--fa-bounce-jump-scale-x, 0.9), var(--fa-bounce-jump-scale-y, 1.1)) translateY(var(--fa-bounce-height, -0.5em));\n }\n 50% {\n transform: scale(var(--fa-bounce-land-scale-x, 1.05), var(--fa-bounce-land-scale-y, 0.95)) translateY(0);\n }\n 57% {\n transform: scale(1, 1) translateY(var(--fa-bounce-rebound, -0.125em));\n }\n 64% {\n transform: scale(1, 1) translateY(0);\n }\n 100% {\n transform: scale(1, 1) translateY(0);\n }\n}\n@keyframes fa-fade {\n 50% {\n opacity: var(--fa-fade-opacity, 0.4);\n }\n}\n@keyframes fa-beat-fade {\n 0%, 100% {\n opacity: var(--fa-beat-fade-opacity, 0.4);\n transform: scale(1);\n }\n 50% {\n opacity: 1;\n transform: scale(var(--fa-beat-fade-scale, 1.125));\n }\n}\n@keyframes fa-flip {\n 50% {\n transform: rotate3d(var(--fa-flip-x, 0), var(--fa-flip-y, 1), var(--fa-flip-z, 0), var(--fa-flip-angle, -180deg));\n }\n}\n@keyframes fa-shake {\n 0% {\n transform: rotate(-15deg);\n }\n 4% {\n transform: rotate(15deg);\n }\n 8%, 24% {\n transform: rotate(-18deg);\n }\n 12%, 28% {\n transform: rotate(18deg);\n }\n 16% {\n transform: rotate(-22deg);\n }\n 20% {\n transform: rotate(22deg);\n }\n 32% {\n transform: rotate(-12deg);\n }\n 36% {\n transform: rotate(12deg);\n }\n 40%, 100% {\n transform: rotate(0deg);\n }\n}\n@keyframes fa-spin {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n}\n.fa-rotate-90 {\n transform: rotate(90deg);\n}\n\n.fa-rotate-180 {\n transform: rotate(180deg);\n}\n\n.fa-rotate-270 {\n transform: rotate(270deg);\n}\n\n.fa-flip-horizontal {\n transform: scale(-1, 1);\n}\n\n.fa-flip-vertical {\n transform: scale(1, -1);\n}\n\n.fa-flip-both,\n.fa-flip-horizontal.fa-flip-vertical {\n transform: scale(-1, -1);\n}\n\n.fa-rotate-by {\n transform: rotate(var(--fa-rotate-angle, 0));\n}\n\n.fa-stack {\n display: inline-block;\n vertical-align: middle;\n height: 2em;\n position: relative;\n width: 2.5em;\n}\n\n.fa-stack-1x,\n.fa-stack-2x {\n bottom: 0;\n left: 0;\n margin: auto;\n position: absolute;\n right: 0;\n top: 0;\n z-index: var(--fa-stack-z-index, auto);\n}\n\n.svg-inline--fa.fa-stack-1x {\n height: 1em;\n width: 1.25em;\n}\n.svg-inline--fa.fa-stack-2x {\n height: 2em;\n width: 2.5em;\n}\n\n.fa-inverse {\n color: var(--fa-inverse, #fff);\n}\n\n.sr-only,\n.fa-sr-only {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border-width: 0;\n}\n\n.sr-only-focusable:not(:focus),\n.fa-sr-only-focusable:not(:focus) {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border-width: 0;\n}\n\n.svg-inline--fa .fa-primary {\n fill: var(--fa-primary-color, currentColor);\n opacity: var(--fa-primary-opacity, 1);\n}\n\n.svg-inline--fa .fa-secondary {\n fill: var(--fa-secondary-color, currentColor);\n opacity: var(--fa-secondary-opacity, 0.4);\n}\n\n.svg-inline--fa.fa-swap-opacity .fa-primary {\n opacity: var(--fa-secondary-opacity, 0.4);\n}\n\n.svg-inline--fa.fa-swap-opacity .fa-secondary {\n opacity: var(--fa-primary-opacity, 1);\n}\n\n.svg-inline--fa mask .fa-primary,\n.svg-inline--fa mask .fa-secondary {\n fill: black;\n}';if(i!==e||n!==t){const r=new RegExp("\\.".concat(e,"\\-"),"g"),s=new RegExp("\\--".concat(e,"\\-"),"g"),o=new RegExp("\\.".concat(t),"g");a=a.replace(r,".".concat(i,"-")).replace(s,"--".concat(i,"-")).replace(o,".".concat(n))}return a}let Fi=!1;function zi(){bi.autoAddCss&&!Fi&&(!function(e){if(!e||!Ct)return;const t=kt.createElement("style");t.setAttribute("type","text/css"),t.innerHTML=e;const i=kt.head.childNodes;let n=null;for(let e=i.length-1;e>-1;e--){const t=i[e],a=(t.tagName||"").toUpperCase();["STYLE","LINK"].indexOf(a)>-1&&(n=t)}kt.head.insertBefore(t,n)}(Ii()),Fi=!0)}var Ri={mixout:()=>({dom:{css:Ii,insertCss:zi}}),hooks:()=>({beforeDOMElementCreation(){zi()},beforeI2svg(){zi()}})};const Li=Et||{};Li[Xt]||(Li[Xt]={}),Li[Xt].styles||(Li[Xt].styles={}),Li[Xt].hooks||(Li[Xt].hooks={}),Li[Xt].shims||(Li[Xt].shims=[]);var Bi=Li[Xt];const Oi=[],Ui=function(){kt.removeEventListener("DOMContentLoaded",Ui),Ni=1,Oi.map(e=>e())};let Ni=!1;function ji(e){const{tag:t,attributes:i={},children:n=[]}=e;return"string"==typeof e?Ti(e):"<".concat(t," ").concat(function(e){return Object.keys(e||{}).reduce((t,i)=>t+"".concat(i,'="').concat(Ti(e[i]),'" '),"").trim()}(i),">").concat(n.map(ji).join(""),"</").concat(t,">")}function Vi(e,t,i){if(e&&e[t]&&e[t][i])return{prefix:t,iconName:i,icon:e[t][i]}}Ct&&(Ni=(kt.documentElement.doScroll?/^loaded|^c/:/^loaded|^i|^c/).test(kt.readyState),Ni||kt.addEventListener("DOMContentLoaded",Ui));var qi=function(e,t,i,n){var a,r,s,o=Object.keys(e),l=o.length,c=t;for(void 0===i?(a=1,s=e[o[0]]):(a=0,s=i);a<l;a++)s=c(s,e[r=o[a]],r,e);return s};function Gi(e){const t=function(e){const t=[];let i=0;const n=e.length;for(;i<n;){const a=e.charCodeAt(i++);if(a>=55296&&a<=56319&&i<n){const n=e.charCodeAt(i++);56320==(64512&n)?t.push(((1023&a)<<10)+(1023&n)+65536):(t.push(a),i--)}else t.push(a)}return t}(e);return 1===t.length?t[0].toString(16):null}function Hi(e){return Object.keys(e).reduce((t,i)=>{const n=e[i];return!!n.icon?t[n.iconName]=n.icon:t[i]=n,t},{})}function Wi(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{skipHooks:n=!1}=i,a=Hi(t);"function"!=typeof Bi.hooks.addPack||n?Bi.styles[e]=At(At({},Bi.styles[e]||{}),a):Bi.hooks.addPack(e,Hi(t)),"fas"===e&&Wi("fa",t)}const{styles:Zi,shims:Ki}=Bi,Xi=Object.keys(hi),Qi=Xi.reduce((e,t)=>(e[t]=Object.keys(hi[t]),e),{});let Yi=null,Ji={},$i={},en={},tn={},nn={};function an(e,t){const i=t.split("-"),n=i[0],a=i.slice(1).join("-");return n!==e||""===a||(r=a,~_i.indexOf(r))?null:a;var r}const rn=()=>{const e=e=>qi(Zi,(t,i,n)=>(t[n]=qi(i,e,{}),t),{});Ji=e((e,t,i)=>{if(t[3]&&(e[t[3]]=i),t[2]){t[2].filter(e=>"number"==typeof e).forEach(t=>{e[t.toString(16)]=i})}return e}),$i=e((e,t,i)=>{if(e[i]=i,t[2]){t[2].filter(e=>"string"==typeof e).forEach(t=>{e[t]=i})}return e}),nn=e((e,t,i)=>{const n=t[2];return e[i]=i,n.forEach(t=>{e[t]=i}),e});const t="far"in Zi||bi.autoFetchSvg,i=qi(Ki,(e,i)=>{const n=i[0];let a=i[1];const r=i[2];return"far"!==a||t||(a="fas"),"string"==typeof n&&(e.names[n]={prefix:a,iconName:r}),"number"==typeof n&&(e.unicodes[n.toString(16)]={prefix:a,iconName:r}),e},{names:{},unicodes:{}});en=i.names,tn=i.unicodes,Yi=un(bi.styleDefault,{family:bi.familyDefault})};function sn(e,t){return(Ji[e]||{})[t]}function on(e,t){return(nn[e]||{})[t]}function ln(e){return en[e]||{prefix:null,iconName:null}}function cn(){return Yi}!function(e){wi.push(e)}(e=>{Yi=un(e.styleDefault,{family:bi.familyDefault})}),rn();function un(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{family:i=It}=t,n=oi[i][e];if(i===Ft&&!e)return"fad";const a=ci[i][e]||ci[i][n],r=e in Bi.styles?e:null;return a||r||null}function hn(e){return e.sort().filter((e,t,i)=>i.indexOf(e)===t)}function dn(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{skipLookups:i=!1}=t;let n=null;const a=Ht.concat(qt),r=hn(e.filter(e=>a.includes(e))),s=hn(e.filter(e=>!Ht.includes(e))),o=r.filter(e=>(n=e,!Pt.includes(e))),[l=null]=o,c=function(e){let t=It;const i=Xi.reduce((e,t)=>(e[t]="".concat(bi.cssPrefix,"-").concat(t),e),{});return zt.forEach(n=>{(e.includes(i[n])||e.some(e=>Qi[n].includes(e)))&&(t=n)}),t}(r),u=At(At({},function(e){let t=[],i=null;return e.forEach(e=>{const n=an(bi.cssPrefix,e);n?i=n:e&&t.push(e)}),{iconName:i,rest:t}}(s)),{},{prefix:un(l,{family:c})});return At(At(At({},u),function(e){const{values:t,family:i,canonical:n,givenPrefix:a="",styles:r={},config:s={}}=e,o=i===Ft,l=t.includes("fa-duotone")||t.includes("fad"),c="duotone"===s.familyDefault,u="fad"===n.prefix||"fa-duotone"===n.prefix;!o&&(l||c||u)&&(n.prefix="fad");(t.includes("fa-brands")||t.includes("fab"))&&(n.prefix="fab");if(!n.prefix&&pn.includes(i)){const e=Object.keys(r).find(e=>mn.includes(e));if(e||s.autoFetchSvg){const e=Rt.get(i).defaultShortPrefixId;n.prefix=e,n.iconName=on(n.prefix,n.iconName)||n.iconName}}"fa"!==n.prefix&&"fa"!==a||(n.prefix=cn()||"fas");return n}({values:e,family:c,styles:Zi,config:bi,canonical:u,givenPrefix:n})),function(e,t,i){let{prefix:n,iconName:a}=i;if(e||!n||!a)return{prefix:n,iconName:a};const r="fa"===t?ln(a):{},s=on(n,a);a=r.iconName||s||a,n=r.prefix||n,"far"!==n||Zi.far||!Zi.fas||bi.autoFetchSvg||(n="fas");return{prefix:n,iconName:a}}(i,n,u))}const pn=zt.filter(e=>e!==It||e!==Ft),mn=Object.keys(Gt).filter(e=>e!==It).map(e=>Object.keys(Gt[e])).flat();let gn=[],fn={};const An={},_n=Object.keys(An);function vn(e,t){for(var i=arguments.length,n=new Array(i>2?i-2:0),a=2;a<i;a++)n[a-2]=arguments[a];return(fn[e]||[]).forEach(e=>{t=e.apply(null,[t,...n])}),t}function yn(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),n=1;n<t;n++)i[n-1]=arguments[n];(fn[e]||[]).forEach(e=>{e.apply(null,i)})}function xn(){const e=arguments[0],t=Array.prototype.slice.call(arguments,1);return An[e]?An[e].apply(null,t):void 0}function bn(e){"fa"===e.prefix&&(e.prefix="fas");let{iconName:t}=e;const i=e.prefix||cn();if(t)return t=on(i,t)||t,Vi(wn.definitions,i,t)||Vi(Bi.styles,i,t)}const wn=new class{constructor(){this.definitions={}}add(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];const n=t.reduce(this._pullDefinitions,{});Object.keys(n).forEach(e=>{this.definitions[e]=At(At({},this.definitions[e]||{}),n[e]),Wi(e,n[e]);const t=hi[It][e];t&&Wi(t,n[e]),rn()})}reset(){this.definitions={}}_pullDefinitions(e,t){const i=t.prefix&&t.iconName&&t.icon?{0:t}:t;return Object.keys(i).map(t=>{const{prefix:n,iconName:a,icon:r}=i[t],s=r[2];e[n]||(e[n]={}),s.length>0&&s.forEach(t=>{"string"==typeof t&&(e[n][t]=r)}),e[n][a]=r}),e}},En={i2svg:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Ct?(yn("beforeI2svg",e),xn("pseudoElements2svg",e),xn("i2svg",e)):Promise.reject(new Error("Operation requires a DOM of some kind."))},watch:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{autoReplaceSvgRoot:t}=e;!1===bi.autoReplaceSvg&&(bi.autoReplaceSvg=!0),bi.observeMutations=!0,function(e){Ct&&(Ni?setTimeout(e,0):Oi.push(e))}(()=>{Mn({autoReplaceSvgRoot:t}),yn("watch",e)})}},kn={icon:e=>{if(null===e)return null;if("object"==typeof e&&e.prefix&&e.iconName)return{prefix:e.prefix,iconName:on(e.prefix,e.iconName)||e.iconName};if(Array.isArray(e)&&2===e.length){const t=0===e[1].indexOf("fa-")?e[1].slice(3):e[1],i=un(e[0]);return{prefix:i,iconName:on(i,t)||t}}if("string"==typeof e&&(e.indexOf("".concat(bi.cssPrefix,"-"))>-1||e.match(pi))){const t=dn(e.split(" "),{skipLookups:!0});return{prefix:t.prefix||cn(),iconName:on(t.prefix,t.iconName)||t.iconName}}if("string"==typeof e){const t=cn();return{prefix:t,iconName:on(t,e)||e}}}},Sn={noAuto:()=>{bi.autoReplaceSvg=!1,bi.observeMutations=!1,yn("noAuto")},config:bi,dom:En,parse:kn,library:wn,findIconDefinition:bn,toHtml:ji},Mn=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{autoReplaceSvgRoot:t=kt}=e;(Object.keys(Bi.styles).length>0||bi.autoFetchSvg)&&Ct&&bi.autoReplaceSvg&&Sn.dom.i2svg({node:t})};function Cn(e,t){return Object.defineProperty(e,"abstract",{get:t}),Object.defineProperty(e,"html",{get:function(){return e.abstract.map(e=>ji(e))}}),Object.defineProperty(e,"node",{get:function(){if(!Ct)return;const t=kt.createElement("div");return t.innerHTML=e.html,t.children}}),e}function Tn(e){const{icons:{main:t,mask:i},prefix:n,iconName:a,transform:r,symbol:s,title:o,maskId:l,titleId:c,extra:u,watchable:h=!1}=e,{width:d,height:p}=i.found?i:t,m=Ut.includes(n),g=[bi.replacementClass,a?"".concat(bi.cssPrefix,"-").concat(a):""].filter(e=>-1===u.classes.indexOf(e)).filter(e=>""!==e||!!e).concat(u.classes).join(" ");let f={children:[],attributes:At(At({},u.attributes),{},{"data-prefix":n,"data-icon":a,class:g,role:u.attributes.role||"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 ".concat(d," ").concat(p)})};const A=m&&!~u.classes.indexOf("fa-fw")?{width:"".concat(d/p*16*.0625,"em")}:{};h&&(f.attributes[Jt]=""),o&&(f.children.push({tag:"title",attributes:{id:f.attributes["aria-labelledby"]||"title-".concat(c||Si())},children:[o]}),delete f.attributes.title);const _=At(At({},f),{},{prefix:n,iconName:a,main:t,mask:i,maskId:l,transform:r,symbol:s,styles:At(At({},A),u.styles)}),{children:v,attributes:y}=i.found&&t.found?xn("generateAbstractMask",_)||{children:[],attributes:{}}:xn("generateAbstractIcon",_)||{children:[],attributes:{}};return _.children=v,_.attributes=y,s?function(e){let{prefix:t,iconName:i,children:n,attributes:a,symbol:r}=e;const s=!0===r?"".concat(t,"-").concat(bi.cssPrefix,"-").concat(i):r;return[{tag:"svg",attributes:{style:"display: none;"},children:[{tag:"symbol",attributes:At(At({},a),{},{id:s}),children:n}]}]}(_):function(e){let{children:t,main:i,mask:n,attributes:a,styles:r,transform:s}=e;if(Pi(s)&&i.found&&!n.found){const{width:e,height:t}=i,n={x:e/t/2,y:.5};a.style=Di(At(At({},r),{},{"transform-origin":"".concat(n.x+s.x/16,"em ").concat(n.y+s.y/16,"em")}))}return[{tag:"svg",attributes:a,children:t}]}(_)}function Dn(e){const{content:t,width:i,height:n,transform:a,title:r,extra:s,watchable:o=!1}=e,l=At(At(At({},s.attributes),r?{title:r}:{}),{},{class:s.classes.join(" ")});o&&(l[Jt]="");const c=At({},s.styles);Pi(a)&&(c.transform=function(e){let{transform:t,width:i=Qt,height:n=Qt,startCentered:a=!1}=e,r="";return r+=a&&Tt?"translate(".concat(t.x/Ei-i/2,"em, ").concat(t.y/Ei-n/2,"em) "):a?"translate(calc(-50% + ".concat(t.x/Ei,"em), calc(-50% + ").concat(t.y/Ei,"em)) "):"translate(".concat(t.x/Ei,"em, ").concat(t.y/Ei,"em) "),r+="scale(".concat(t.size/Ei*(t.flipX?-1:1),", ").concat(t.size/Ei*(t.flipY?-1:1),") "),r+="rotate(".concat(t.rotate,"deg) "),r}({transform:a,startCentered:!0,width:i,height:n}),c["-webkit-transform"]=c.transform);const u=Di(c);u.length>0&&(l.style=u);const h=[];return h.push({tag:"span",attributes:l,children:[t]}),r&&h.push({tag:"span",attributes:{class:"sr-only"},children:[r]}),h}const{styles:Pn}=Bi;function In(e){const t=e[0],i=e[1],[n]=e.slice(4);let a=null;return a=Array.isArray(n)?{tag:"g",attributes:{class:"".concat(bi.cssPrefix,"-").concat(Ai.GROUP)},children:[{tag:"path",attributes:{class:"".concat(bi.cssPrefix,"-").concat(Ai.SECONDARY),fill:"currentColor",d:n[0]}},{tag:"path",attributes:{class:"".concat(bi.cssPrefix,"-").concat(Ai.PRIMARY),fill:"currentColor",d:n[1]}}]}:{tag:"path",attributes:{fill:"currentColor",d:n}},{found:!0,width:t,height:i,icon:a}}const Fn={found:!1,width:512,height:512};function zn(e,t){let i=t;return"fa"===t&&null!==bi.styleDefault&&(t=cn()),new Promise((n,a)=>{if("fa"===i){const i=ln(e)||{};e=i.iconName||e,t=i.prefix||t}if(e&&t&&Pn[t]&&Pn[t][e]){return n(In(Pn[t][e]))}!function(e,t){ai||bi.showMissingIcons||!e||console.error('Icon with name "'.concat(e,'" and prefix "').concat(t,'" is missing.'))}(e,t),n(At(At({},Fn),{},{icon:bi.showMissingIcons&&e&&xn("missingIconAbstract")||{}}))})}const Rn=()=>{},Ln=bi.measurePerformance&&Mt&&Mt.mark&&Mt.measure?Mt:{mark:Rn,measure:Rn},Bn='FA "6.7.2"',On=e=>{Ln.mark("".concat(Bn," ").concat(e," ends")),Ln.measure("".concat(Bn," ").concat(e),"".concat(Bn," ").concat(e," begins"),"".concat(Bn," ").concat(e," ends"))};var Un=e=>(Ln.mark("".concat(Bn," ").concat(e," begins")),()=>On(e));const Nn=()=>{};function jn(e){return"string"==typeof(e.getAttribute?e.getAttribute(Jt):null)}function Vn(e){return kt.createElementNS("http://www.w3.org/2000/svg",e)}function qn(e){return kt.createElement(e)}function Gn(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{ceFn:i=("svg"===e.tag?Vn:qn)}=t;if("string"==typeof e)return kt.createTextNode(e);const n=i(e.tag);Object.keys(e.attributes||[]).forEach(function(t){n.setAttribute(t,e.attributes[t])});return(e.children||[]).forEach(function(e){n.appendChild(Gn(e,{ceFn:i}))}),n}const Hn={replace:function(e){const t=e[0];if(t.parentNode)if(e[1].forEach(e=>{t.parentNode.insertBefore(Gn(e),t)}),null===t.getAttribute(Jt)&&bi.keepOriginalSource){let e=kt.createComment(function(e){let t=" ".concat(e.outerHTML," ");return t="".concat(t,"Font Awesome fontawesome.com "),t}(t));t.parentNode.replaceChild(e,t)}else t.remove()},nest:function(e){const t=e[0],i=e[1];if(~Ci(t).indexOf(bi.replacementClass))return Hn.replace(e);const n=new RegExp("".concat(bi.cssPrefix,"-.*"));if(delete i[0].attributes.id,i[0].attributes.class){const e=i[0].attributes.class.split(" ").reduce((e,t)=>(t===bi.replacementClass||t.match(n)?e.toSvg.push(t):e.toNode.push(t),e),{toNode:[],toSvg:[]});i[0].attributes.class=e.toSvg.join(" "),0===e.toNode.length?t.removeAttribute("class"):t.setAttribute("class",e.toNode.join(" "))}const a=i.map(e=>ji(e)).join("\n");t.setAttribute(Jt,""),t.innerHTML=a}};function Wn(e){e()}function Zn(e,t){const i="function"==typeof t?t:Nn;if(0===e.length)i();else{let t=Wn;"async"===bi.mutateApproach&&(t=Et.requestAnimationFrame||Wn),t(()=>{const t=!0===bi.autoReplaceSvg?Hn.replace:Hn[bi.autoReplaceSvg]||Hn.replace,n=Un("mutate");e.map(t),n(),i()})}}let Kn=!1;function Xn(){Kn=!0}function Qn(){Kn=!1}let Yn=null;function Jn(e){if(!St)return;if(!bi.observeMutations)return;const{treeCallback:t=Nn,nodeCallback:i=Nn,pseudoElementsCallback:n=Nn,observeMutationsRoot:a=kt}=e;Yn=new St(e=>{if(Kn)return;const a=cn();Mi(e).forEach(e=>{if("childList"===e.type&&e.addedNodes.length>0&&!jn(e.addedNodes[0])&&(bi.searchPseudoElements&&n(e.target),t(e.target)),"attributes"===e.type&&e.target.parentNode&&bi.searchPseudoElements&&n(e.target.parentNode),"attributes"===e.type&&jn(e.target)&&~fi.indexOf(e.attributeName))if("class"===e.attributeName&&function(e){const t=e.getAttribute?e.getAttribute(ei):null,i=e.getAttribute?e.getAttribute(ti):null;return t&&i}(e.target)){const{prefix:t,iconName:i}=dn(Ci(e.target));e.target.setAttribute(ei,t||a),i&&e.target.setAttribute(ti,i)}else(r=e.target)&&r.classList&&r.classList.contains&&r.classList.contains(bi.replacementClass)&&i(e.target);var r})}),Ct&&Yn.observe(a,{childList:!0,attributes:!0,characterData:!0,subtree:!0})}function $n(e){const t=e.getAttribute("data-prefix"),i=e.getAttribute("data-icon"),n=void 0!==e.innerText?e.innerText.trim():"";let a=dn(Ci(e));return a.prefix||(a.prefix=cn()),t&&i&&(a.prefix=t,a.iconName=i),a.iconName&&a.prefix||(a.prefix&&n.length>0&&(a.iconName=(r=a.prefix,s=e.innerText,($i[r]||{})[s]||sn(a.prefix,Gi(e.innerText)))),!a.iconName&&bi.autoFetchSvg&&e.firstChild&&e.firstChild.nodeType===Node.TEXT_NODE&&(a.iconName=e.firstChild.data)),a;var r,s}function ea(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{styleParser:!0};const{iconName:i,prefix:n,rest:a}=$n(e),r=function(e){const t=Mi(e.attributes).reduce((e,t)=>("class"!==e.name&&"style"!==e.name&&(e[t.name]=t.value),e),{}),i=e.getAttribute("title"),n=e.getAttribute("data-fa-title-id");return bi.autoA11y&&(i?t["aria-labelledby"]="".concat(bi.replacementClass,"-title-").concat(n||Si()):(t["aria-hidden"]="true",t.focusable="false")),t}(e),s=vn("parseNodeAttributes",{},e);let o=t.styleParser?function(e){const t=e.getAttribute("style");let i=[];return t&&(i=t.split(";").reduce((e,t)=>{const i=t.split(":"),n=i[0],a=i.slice(1);return n&&a.length>0&&(e[n]=a.join(":").trim()),e},{})),i}(e):[];return At({iconName:i,title:e.getAttribute("title"),titleId:e.getAttribute("data-fa-title-id"),prefix:n,transform:ki,mask:{iconName:null,prefix:null,rest:[]},maskId:null,symbol:!1,extra:{classes:a,styles:o,attributes:r}},s)}const{styles:ta}=Bi;function ia(e){const t="nest"===bi.autoReplaceSvg?ea(e,{styleParser:!1}):ea(e);return~t.extra.classes.indexOf(mi)?xn("generateLayersText",e,t):xn("generateSvgReplacementMutation",e,t)}function na(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(!Ct)return Promise.resolve();const i=kt.documentElement.classList,n=e=>i.add("".concat(ii,"-").concat(e)),a=e=>i.remove("".concat(ii,"-").concat(e)),r=bi.autoFetchSvg?[...Lt,...Ht]:Pt.concat(Object.keys(ta));r.includes("fa")||r.push("fa");const s=[".".concat(mi,":not([").concat(Jt,"])")].concat(r.map(e=>".".concat(e,":not([").concat(Jt,"])"))).join(", ");if(0===s.length)return Promise.resolve();let o=[];try{o=Mi(e.querySelectorAll(s))}catch(e){}if(!(o.length>0))return Promise.resolve();n("pending"),a("complete");const l=Un("onTree"),c=o.reduce((e,t)=>{try{const i=ia(t);i&&e.push(i)}catch(e){ai||"MissingIcon"===e.name&&console.error(e)}return e},[]);return new Promise((e,i)=>{Promise.all(c).then(i=>{Zn(i,()=>{n("active"),n("complete"),a("pending"),"function"==typeof t&&t(),l(),e()})}).catch(e=>{l(),i(e)})})}function aa(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;ia(e).then(e=>{e&&Zn([e],t)})}const ra=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{transform:i=ki,symbol:n=!1,mask:a=null,maskId:r=null,title:s=null,titleId:o=null,classes:l=[],attributes:c={},styles:u={}}=t;if(!e)return;const{prefix:h,iconName:d,icon:p}=e;return Cn(At({type:"icon"},e),()=>(yn("beforeDOMElementCreation",{iconDefinition:e,params:t}),bi.autoA11y&&(s?c["aria-labelledby"]="".concat(bi.replacementClass,"-title-").concat(o||Si()):(c["aria-hidden"]="true",c.focusable="false")),Tn({icons:{main:In(p),mask:a?In(a.icon):{found:!1,width:null,height:null,icon:{}}},prefix:h,iconName:d,transform:At(At({},ki),i),symbol:n,title:s,maskId:r,titleId:o,extra:{attributes:c,styles:u,classes:l}})))};var sa={mixout(){return{icon:(e=ra,function(t){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=(t||{}).icon?t:bn(t||{});let{mask:a}=i;return a&&(a=(a||{}).icon?a:bn(a||{})),e(n,At(At({},i),{},{mask:a}))})};var e},hooks:()=>({mutationObserverCallbacks:e=>(e.treeCallback=na,e.nodeCallback=aa,e)}),provides(e){e.i2svg=function(e){const{node:t=kt,callback:i=()=>{}}=e;return na(t,i)},e.generateSvgReplacementMutation=function(e,t){const{iconName:i,title:n,titleId:a,prefix:r,transform:s,symbol:o,mask:l,maskId:c,extra:u}=t;return new Promise((t,h)=>{Promise.all([zn(i,r),l.iconName?zn(l.iconName,l.prefix):Promise.resolve({found:!1,width:512,height:512,icon:{}})]).then(l=>{let[h,d]=l;t([e,Tn({icons:{main:h,mask:d},prefix:r,iconName:i,transform:s,symbol:o,maskId:c,title:n,titleId:a,extra:u,watchable:!0})])}).catch(h)})},e.generateAbstractIcon=function(e){let{children:t,attributes:i,main:n,transform:a,styles:r}=e;const s=Di(r);let o;return s.length>0&&(i.style=s),Pi(a)&&(o=xn("generateAbstractTransformGrouping",{main:n,transform:a,containerWidth:n.width,iconWidth:n.width})),t.push(o||n.icon),{children:t,attributes:i}}}},oa={mixout:()=>({layer(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{classes:i=[]}=t;return Cn({type:"layer"},()=>{yn("beforeDOMElementCreation",{assembler:e,params:t});let n=[];return e(e=>{Array.isArray(e)?e.map(e=>{n=n.concat(e.abstract)}):n=n.concat(e.abstract)}),[{tag:"span",attributes:{class:["".concat(bi.cssPrefix,"-layers"),...i].join(" ")},children:n}]})}})},la={mixout:()=>({counter(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{title:i=null,classes:n=[],attributes:a={},styles:r={}}=t;return Cn({type:"counter",content:e},()=>(yn("beforeDOMElementCreation",{content:e,params:t}),function(e){const{content:t,title:i,extra:n}=e,a=At(At(At({},n.attributes),i?{title:i}:{}),{},{class:n.classes.join(" ")}),r=Di(n.styles);r.length>0&&(a.style=r);const s=[];return s.push({tag:"span",attributes:a,children:[t]}),i&&s.push({tag:"span",attributes:{class:"sr-only"},children:[i]}),s}({content:e.toString(),title:i,extra:{attributes:a,styles:r,classes:["".concat(bi.cssPrefix,"-layers-counter"),...n]}})))}})},ca={mixout:()=>({text(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{transform:i=ki,title:n=null,classes:a=[],attributes:r={},styles:s={}}=t;return Cn({type:"text",content:e},()=>(yn("beforeDOMElementCreation",{content:e,params:t}),Dn({content:e,transform:At(At({},ki),i),title:n,extra:{attributes:r,styles:s,classes:["".concat(bi.cssPrefix,"-layers-text"),...a]}})))}}),provides(e){e.generateLayersText=function(e,t){const{title:i,transform:n,extra:a}=t;let r=null,s=null;if(Tt){const t=parseInt(getComputedStyle(e).fontSize,10),i=e.getBoundingClientRect();r=i.width/t,s=i.height/t}return bi.autoA11y&&!i&&(a.attributes["aria-hidden"]="true"),Promise.resolve([e,Dn({content:e.innerHTML,width:r,height:s,transform:n,title:i,extra:a,watchable:!0})])}}};const ua=new RegExp('"',"ug"),ha=[1105920,1112319],da=At(At(At(At({},{FontAwesome:{normal:"fas",400:"fas"}}),{"Font Awesome 6 Free":{900:"fas",400:"far"},"Font Awesome 6 Pro":{900:"fas",400:"far",normal:"far",300:"fal",100:"fat"},"Font Awesome 6 Brands":{400:"fab",normal:"fab"},"Font Awesome 6 Duotone":{900:"fad",400:"fadr",normal:"fadr",300:"fadl",100:"fadt"},"Font Awesome 6 Sharp":{900:"fass",400:"fasr",normal:"fasr",300:"fasl",100:"fast"},"Font Awesome 6 Sharp Duotone":{900:"fasds",400:"fasdr",normal:"fasdr",300:"fasdl",100:"fasdt"}}),{"Font Awesome 5 Free":{900:"fas",400:"far"},"Font Awesome 5 Pro":{900:"fas",400:"far",normal:"far",300:"fal"},"Font Awesome 5 Brands":{400:"fab",normal:"fab"},"Font Awesome 5 Duotone":{900:"fad"}}),{"Font Awesome Kit":{400:"fak",normal:"fak"},"Font Awesome Kit Duotone":{400:"fakd",normal:"fakd"}}),pa=Object.keys(da).reduce((e,t)=>(e[t.toLowerCase()]=da[t],e),{}),ma=Object.keys(pa).reduce((e,t)=>{const i=pa[t];return e[t]=i[900]||[...Object.entries(i)][0][1],e},{});function ga(e,t){const i="".concat("data-fa-pseudo-element-pending").concat(t.replace(":","-"));return new Promise((n,a)=>{if(null!==e.getAttribute(i))return n();const r=Mi(e.children).filter(e=>e.getAttribute($t)===t)[0],s=Et.getComputedStyle(e,t),o=s.getPropertyValue("font-family"),l=o.match(gi),c=s.getPropertyValue("font-weight"),u=s.getPropertyValue("content");if(r&&!l)return e.removeChild(r),n();if(l&&"none"!==u&&""!==u){const u=s.getPropertyValue("content");let h=function(e,t){const i=e.replace(/^['"]|['"]$/g,"").toLowerCase(),n=parseInt(t),a=isNaN(n)?"normal":n;return(pa[i]||{})[a]||ma[i]}(o,c);const{value:d,isSecondary:p}=function(e){const t=e.replace(ua,""),i=function(e,t){const i=e.length;let n,a=e.charCodeAt(t);return a>=55296&&a<=56319&&i>t+1&&(n=e.charCodeAt(t+1),n>=56320&&n<=57343)?1024*(a-55296)+n-56320+65536:a}(t,0),n=i>=ha[0]&&i<=ha[1],a=2===t.length&&t[0]===t[1];return{value:Gi(a?t[0]:t),isSecondary:n||a}}(u),m=l[0].startsWith("FontAwesome");let g=sn(h,d),f=g;if(m){const e=function(e){const t=tn[e],i=sn("fas",e);return t||(i?{prefix:"fas",iconName:i}:null)||{prefix:null,iconName:null}}(d);e.iconName&&e.prefix&&(g=e.iconName,h=e.prefix)}if(!g||p||r&&r.getAttribute(ei)===h&&r.getAttribute(ti)===f)n();else{e.setAttribute(i,f),r&&e.removeChild(r);const s={iconName:null,title:null,titleId:null,prefix:null,transform:ki,symbol:!1,mask:{iconName:null,prefix:null,rest:[]},maskId:null,extra:{classes:[],styles:{},attributes:{}}},{extra:o}=s;o.attributes[$t]=t,zn(g,h).then(a=>{const r=Tn(At(At({},s),{},{icons:{main:a,mask:{prefix:null,iconName:null,rest:[]}},prefix:h,iconName:f,extra:o,watchable:!0})),l=kt.createElementNS("http://www.w3.org/2000/svg","svg");"::before"===t?e.insertBefore(l,e.firstChild):e.appendChild(l),l.outerHTML=r.map(e=>ji(e)).join("\n"),e.removeAttribute(i),n()}).catch(a)}}else n()})}function fa(e){return Promise.all([ga(e,"::before"),ga(e,"::after")])}function Aa(e){return!(e.parentNode===document.head||~ni.indexOf(e.tagName.toUpperCase())||e.getAttribute($t)||e.parentNode&&"svg"===e.parentNode.tagName)}function _a(e){if(Ct)return new Promise((t,i)=>{const n=Mi(e.querySelectorAll("*")).filter(Aa).map(fa),a=Un("searchPseudoElements");Xn(),Promise.all(n).then(()=>{a(),Qn(),t()}).catch(()=>{a(),Qn(),i()})})}var va={hooks:()=>({mutationObserverCallbacks:e=>(e.pseudoElementsCallback=_a,e)}),provides(e){e.pseudoElements2svg=function(e){const{node:t=kt}=e;bi.searchPseudoElements&&_a(t)}}};let ya=!1;var xa={mixout:()=>({dom:{unwatch(){Xn(),ya=!0}}}),hooks:()=>({bootstrap(){Jn(vn("mutationObserverCallbacks",{}))},noAuto(){Yn&&Yn.disconnect()},watch(e){const{observeMutationsRoot:t}=e;ya?Qn():Jn(vn("mutationObserverCallbacks",{observeMutationsRoot:t}))}})};const ba=e=>e.toLowerCase().split(" ").reduce((e,t)=>{const i=t.toLowerCase().split("-"),n=i[0];let a=i.slice(1).join("-");if(n&&"h"===a)return e.flipX=!0,e;if(n&&"v"===a)return e.flipY=!0,e;if(a=parseFloat(a),isNaN(a))return e;switch(n){case"grow":e.size=e.size+a;break;case"shrink":e.size=e.size-a;break;case"left":e.x=e.x-a;break;case"right":e.x=e.x+a;break;case"up":e.y=e.y-a;break;case"down":e.y=e.y+a;break;case"rotate":e.rotate=e.rotate+a}return e},{size:16,x:0,y:0,flipX:!1,flipY:!1,rotate:0});var wa={mixout:()=>({parse:{transform:e=>ba(e)}}),hooks:()=>({parseNodeAttributes(e,t){const i=t.getAttribute("data-fa-transform");return i&&(e.transform=ba(i)),e}}),provides(e){e.generateAbstractTransformGrouping=function(e){let{main:t,transform:i,containerWidth:n,iconWidth:a}=e;const r={transform:"translate(".concat(n/2," 256)")},s="translate(".concat(32*i.x,", ").concat(32*i.y,") "),o="scale(".concat(i.size/16*(i.flipX?-1:1),", ").concat(i.size/16*(i.flipY?-1:1),") "),l="rotate(".concat(i.rotate," 0 0)"),c={outer:r,inner:{transform:"".concat(s," ").concat(o," ").concat(l)},path:{transform:"translate(".concat(a/2*-1," -256)")}};return{tag:"g",attributes:At({},c.outer),children:[{tag:"g",attributes:At({},c.inner),children:[{tag:t.icon.tag,children:t.icon.children,attributes:At(At({},t.icon.attributes),c.path)}]}]}}}};const Ea={x:0,y:0,width:"100%",height:"100%"};function ka(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return e.attributes&&(e.attributes.fill||t)&&(e.attributes.fill="black"),e}var Sa={hooks:()=>({parseNodeAttributes(e,t){const i=t.getAttribute("data-fa-mask"),n=i?dn(i.split(" ").map(e=>e.trim())):{prefix:null,iconName:null,rest:[]};return n.prefix||(n.prefix=cn()),e.mask=n,e.maskId=t.getAttribute("data-fa-mask-id"),e}}),provides(e){e.generateAbstractMask=function(e){let{children:t,attributes:i,main:n,mask:a,maskId:r,transform:s}=e;const{width:o,icon:l}=n,{width:c,icon:u}=a,h=function(e){let{transform:t,containerWidth:i,iconWidth:n}=e;const a={transform:"translate(".concat(i/2," 256)")},r="translate(".concat(32*t.x,", ").concat(32*t.y,") "),s="scale(".concat(t.size/16*(t.flipX?-1:1),", ").concat(t.size/16*(t.flipY?-1:1),") "),o="rotate(".concat(t.rotate," 0 0)");return{outer:a,inner:{transform:"".concat(r," ").concat(s," ").concat(o)},path:{transform:"translate(".concat(n/2*-1," -256)")}}}({transform:s,containerWidth:c,iconWidth:o}),d={tag:"rect",attributes:At(At({},Ea),{},{fill:"white"})},p=l.children?{children:l.children.map(ka)}:{},m={tag:"g",attributes:At({},h.inner),children:[ka(At({tag:l.tag,attributes:At(At({},l.attributes),h.path)},p))]},g={tag:"g",attributes:At({},h.outer),children:[m]},f="mask-".concat(r||Si()),A="clip-".concat(r||Si()),_={tag:"mask",attributes:At(At({},Ea),{},{id:f,maskUnits:"userSpaceOnUse",maskContentUnits:"userSpaceOnUse"}),children:[d,g]},v={tag:"defs",children:[{tag:"clipPath",attributes:{id:A},children:(y=u,"g"===y.tag?y.children:[y])},_]};var y;return t.push(v,{tag:"rect",attributes:At({fill:"currentColor","clip-path":"url(#".concat(A,")"),mask:"url(#".concat(f,")")},Ea)}),{children:t,attributes:i}}}},Ma={provides(e){let t=!1;Et.matchMedia&&(t=Et.matchMedia("(prefers-reduced-motion: reduce)").matches),e.missingIconAbstract=function(){const e=[],i={fill:"currentColor"},n={attributeType:"XML",repeatCount:"indefinite",dur:"2s"};e.push({tag:"path",attributes:At(At({},i),{},{d:"M156.5,447.7l-12.6,29.5c-18.7-9.5-35.9-21.2-51.5-34.9l22.7-22.7C127.6,430.5,141.5,440,156.5,447.7z M40.6,272H8.5 c1.4,21.2,5.4,41.7,11.7,61.1L50,321.2C45.1,305.5,41.8,289,40.6,272z M40.6,240c1.4-18.8,5.2-37,11.1-54.1l-29.5-12.6 C14.7,194.3,10,216.7,8.5,240H40.6z M64.3,156.5c7.8-14.9,17.2-28.8,28.1-41.5L69.7,92.3c-13.7,15.6-25.5,32.8-34.9,51.5 L64.3,156.5z M397,419.6c-13.9,12-29.4,22.3-46.1,30.4l11.9,29.8c20.7-9.9,39.8-22.6,56.9-37.6L397,419.6z M115,92.4 c13.9-12,29.4-22.3,46.1-30.4l-11.9-29.8c-20.7,9.9-39.8,22.6-56.8,37.6L115,92.4z M447.7,355.5c-7.8,14.9-17.2,28.8-28.1,41.5 l22.7,22.7c13.7-15.6,25.5-32.9,34.9-51.5L447.7,355.5z M471.4,272c-1.4,18.8-5.2,37-11.1,54.1l29.5,12.6 c7.5-21.1,12.2-43.5,13.6-66.8H471.4z M321.2,462c-15.7,5-32.2,8.2-49.2,9.4v32.1c21.2-1.4,41.7-5.4,61.1-11.7L321.2,462z M240,471.4c-18.8-1.4-37-5.2-54.1-11.1l-12.6,29.5c21.1,7.5,43.5,12.2,66.8,13.6V471.4z M462,190.8c5,15.7,8.2,32.2,9.4,49.2h32.1 c-1.4-21.2-5.4-41.7-11.7-61.1L462,190.8z M92.4,397c-12-13.9-22.3-29.4-30.4-46.1l-29.8,11.9c9.9,20.7,22.6,39.8,37.6,56.9 L92.4,397z M272,40.6c18.8,1.4,36.9,5.2,54.1,11.1l12.6-29.5C317.7,14.7,295.3,10,272,8.5V40.6z M190.8,50 c15.7-5,32.2-8.2,49.2-9.4V8.5c-21.2,1.4-41.7,5.4-61.1,11.7L190.8,50z M442.3,92.3L419.6,115c12,13.9,22.3,29.4,30.5,46.1 l29.8-11.9C470,128.5,457.3,109.4,442.3,92.3z M397,92.4l22.7-22.7c-15.6-13.7-32.8-25.5-51.5-34.9l-12.6,29.5 C370.4,72.1,384.4,81.5,397,92.4z"})});const a=At(At({},n),{},{attributeName:"opacity"}),r={tag:"circle",attributes:At(At({},i),{},{cx:"256",cy:"364",r:"28"}),children:[]};return t||r.children.push({tag:"animate",attributes:At(At({},n),{},{attributeName:"r",values:"28;14;28;28;14;28;"})},{tag:"animate",attributes:At(At({},a),{},{values:"1;0;1;1;0;1;"})}),e.push(r),e.push({tag:"path",attributes:At(At({},i),{},{opacity:"1",d:"M263.7,312h-16c-6.6,0-12-5.4-12-12c0-71,77.4-63.9,77.4-107.8c0-20-17.8-40.2-57.4-40.2c-29.1,0-44.3,9.6-59.2,28.7 c-3.9,5-11.1,6-16.2,2.4l-13.1-9.2c-5.6-3.9-6.9-11.8-2.6-17.2c21.2-27.2,46.4-44.7,91.2-44.7c52.3,0,97.4,29.8,97.4,80.2 c0,67.6-77.4,63.5-77.4,107.8C275.7,306.6,270.3,312,263.7,312z"}),children:t?[]:[{tag:"animate",attributes:At(At({},a),{},{values:"1;0;0;0;0;1;"})}]}),t||e.push({tag:"path",attributes:At(At({},i),{},{opacity:"0",d:"M232.5,134.5l7,168c0.3,6.4,5.6,11.5,12,11.5h9c6.4,0,11.7-5.1,12-11.5l7-168c0.3-6.8-5.2-12.5-12-12.5h-23 C237.7,122,232.2,127.7,232.5,134.5z"}),children:[{tag:"animate",attributes:At(At({},a),{},{values:"0;0;1;1;0;0;"})}]}),{tag:"g",attributes:{class:"missing"},children:e}}}};!function(e,t){let{mixoutsTo:i}=t;gn=e,fn={},Object.keys(An).forEach(e=>{-1===_n.indexOf(e)&&delete An[e]}),gn.forEach(e=>{const t=e.mixout?e.mixout():{};if(Object.keys(t).forEach(e=>{"function"==typeof t[e]&&(i[e]=t[e]),"object"==typeof t[e]&&Object.keys(t[e]).forEach(n=>{i[e]||(i[e]={}),i[e][n]=t[e][n]})}),e.hooks){const t=e.hooks();Object.keys(t).forEach(e=>{fn[e]||(fn[e]=[]),fn[e].push(t[e])})}e.provides&&e.provides(An)})}([Ri,sa,oa,la,ca,va,xa,wa,Sa,Ma,{hooks:()=>({parseNodeAttributes(e,t){const i=t.getAttribute("data-fa-symbol"),n=null!==i&&(""===i||i);return e.symbol=n,e}})}],{mixoutsTo:Sn});const Ca=Sn.icon,Ta=Object.freeze({left:0,top:0,width:16,height:16}),Da=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),Pa=Object.freeze({...Ta,...Da}),Ia=Object.freeze({...Pa,body:"",hidden:!1}),Fa=Object.freeze({width:null,height:null}),za=Object.freeze({...Fa,...Da});const Ra=/[\s,]+/;const La={...za,preserveAspectRatio:""};function Ba(e){const t={...La},i=(t,i)=>e.getAttribute(t)||i;var n;return t.width=i("width",null),t.height=i("height",null),t.rotate=function(e,t=0){const i=e.replace(/^-?[0-9.]*/,"");function n(e){for(;e<0;)e+=4;return e%4}if(""===i){const t=parseInt(e);return isNaN(t)?0:n(t)}if(i!==e){let t=0;switch(i){case"%":t=25;break;case"deg":t=90}if(t){let a=parseFloat(e.slice(0,e.length-i.length));return isNaN(a)?0:(a/=t,a%1==0?n(a):0)}}return t}(i("rotate","")),n=t,i("flip","").split(Ra).forEach(e=>{switch(e.trim()){case"horizontal":n.hFlip=!0;break;case"vertical":n.vFlip=!0}}),t.preserveAspectRatio=i("preserveAspectRatio",i("preserveaspectratio","")),t}const Oa=/^[a-z0-9]+(-[a-z0-9]+)*$/,Ua=(e,t,i,n="")=>{const a=e.split(":");if("@"===e.slice(0,1)){if(a.length<2||a.length>3)return null;n=a.shift().slice(1)}if(a.length>3||!a.length)return null;if(a.length>1){const e=a.pop(),i=a.pop(),r={provider:a.length>0?a[0]:n,prefix:i,name:e};return t&&!Na(r)?null:r}const r=a[0],s=r.split("-");if(s.length>1){const e={provider:n,prefix:s.shift(),name:s.join("-")};return t&&!Na(e)?null:e}if(i&&""===n){const e={provider:n,prefix:"",name:r};return t&&!Na(e,i)?null:e}return null},Na=(e,t)=>!!e&&!(!(t&&""===e.prefix||e.prefix)||!e.name);function ja(e,t){const i=function(e,t){const i={};!e.hFlip!=!t.hFlip&&(i.hFlip=!0),!e.vFlip!=!t.vFlip&&(i.vFlip=!0);const n=((e.rotate||0)+(t.rotate||0))%4;return n&&(i.rotate=n),i}(e,t);for(const n in Ia)n in Da?n in e&&!(n in i)&&(i[n]=Da[n]):n in t?i[n]=t[n]:n in e&&(i[n]=e[n]);return i}function Va(e,t,i){const n=e.icons,a=e.aliases||Object.create(null);let r={};function s(e){r=ja(n[e]||a[e],r)}return s(t),i.forEach(s),ja(e,r)}function qa(e,t){const i=[];if("object"!=typeof e||"object"!=typeof e.icons)return i;e.not_found instanceof Array&&e.not_found.forEach(e=>{t(e,null),i.push(e)});const n=function(e){const t=e.icons,i=e.aliases||Object.create(null),n=Object.create(null);return Object.keys(t).concat(Object.keys(i)).forEach(function e(a){if(t[a])return n[a]=[];if(!(a in n)){n[a]=null;const t=i[a]&&i[a].parent,r=t&&e(t);r&&(n[a]=[t].concat(r))}return n[a]}),n}(e);for(const a in n){const r=n[a];r&&(t(a,Va(e,a,r)),i.push(a))}return i}const Ga={provider:"",aliases:{},not_found:{},...Ta};function Ha(e,t){for(const i in t)if(i in e&&typeof e[i]!=typeof t[i])return!1;return!0}function Wa(e){if("object"!=typeof e||null===e)return null;const t=e;if("string"!=typeof t.prefix||!e.icons||"object"!=typeof e.icons)return null;if(!Ha(e,Ga))return null;const i=t.icons;for(const e in i){const t=i[e];if(!e||"string"!=typeof t.body||!Ha(t,Ia))return null}const n=t.aliases||Object.create(null);for(const e in n){const t=n[e],a=t.parent;if(!e||"string"!=typeof a||!i[a]&&!n[a]||!Ha(t,Ia))return null}return t}const Za=Object.create(null);function Ka(e,t){const i=Za[e]||(Za[e]=Object.create(null));return i[t]||(i[t]=function(e,t){return{provider:e,prefix:t,icons:Object.create(null),missing:new Set}}(e,t))}function Xa(e,t){return Wa(t)?qa(t,(t,i)=>{i?e.icons[t]=i:e.missing.add(t)}):[]}function Qa(e,t){let i=[];return("string"==typeof e?[e]:Object.keys(Za)).forEach(e=>{("string"==typeof e&&"string"==typeof t?[t]:Object.keys(Za[e]||{})).forEach(t=>{const n=Ka(e,t);i=i.concat(Object.keys(n.icons).map(i=>(""!==e?"@"+e+":":"")+t+":"+i))})}),i}let Ya=!1;function Ja(e){return"boolean"==typeof e&&(Ya=e),Ya}function $a(e){const t="string"==typeof e?Ua(e,!0,Ya):e;if(t){const e=Ka(t.provider,t.prefix),i=t.name;return e.icons[i]||(e.missing.has(i)?null:void 0)}}function er(e,t){const i=Ua(e,!0,Ya);if(!i)return!1;const n=Ka(i.provider,i.prefix);return t?function(e,t,i){try{if("string"==typeof i.body)return e.icons[t]={...i},!0}catch(e){}return!1}(n,i.name,t):(n.missing.add(i.name),!0)}function tr(e,t){if("object"!=typeof e)return!1;if("string"!=typeof t&&(t=e.provider||""),Ya&&!t&&!e.prefix){let t=!1;return Wa(e)&&(e.prefix="",qa(e,(e,i)=>{er(e,i)&&(t=!0)})),t}const i=e.prefix;return!!Na({prefix:i,name:"a"})&&!!Xa(Ka(t,i),e)}function ir(e){return!!$a(e)}function nr(e){const t=$a(e);return t?{...Pa,...t}:t}function ar(e,t){e.forEach(e=>{const i=e.loaderCallbacks;i&&(e.loaderCallbacks=i.filter(e=>e.id!==t))})}let rr=0;const sr=Object.create(null);function or(e,t){sr[e]=t}function lr(e){return sr[e]||sr[""]}function cr(e){let t;if("string"==typeof e.resources)t=[e.resources];else if(t=e.resources,!(t instanceof Array&&t.length))return null;return{resources:t,path:e.path||"/",maxURL:e.maxURL||500,rotate:e.rotate||750,timeout:e.timeout||5e3,random:!0===e.random,index:e.index||0,dataAfterTimeout:!1!==e.dataAfterTimeout}}const ur=Object.create(null),hr=["https://api.simplesvg.com","https://api.unisvg.com"],dr=[];for(;hr.length>0;)1===hr.length||Math.random()>.5?dr.push(hr.shift()):dr.push(hr.pop());function pr(e,t){const i=cr(t);return null!==i&&(ur[e]=i,!0)}function mr(e){return ur[e]}function gr(){return Object.keys(ur)}ur[""]=cr({resources:["https://api.iconify.design"].concat(dr)});const fr={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function Ar(e,t,i,n){const a=e.resources.length,r=e.random?Math.floor(Math.random()*a):e.index;let s;if(e.random){let t=e.resources.slice(0);for(s=[];t.length>1;){const e=Math.floor(Math.random()*t.length);s.push(t[e]),t=t.slice(0,e).concat(t.slice(e+1))}s=s.concat(t)}else s=e.resources.slice(r).concat(e.resources.slice(0,r));const o=Date.now();let l,c="pending",u=0,h=null,d=[],p=[];function m(){h&&(clearTimeout(h),h=null)}function g(){"pending"===c&&(c="aborted"),m(),d.forEach(e=>{"pending"===e.status&&(e.status="aborted")}),d=[]}function f(e,t){t&&(p=[]),"function"==typeof e&&p.push(e)}function A(){c="failed",p.forEach(e=>{e(void 0,l)})}function _(){d.forEach(e=>{"pending"===e.status&&(e.status="aborted")}),d=[]}function v(){if("pending"!==c)return;m();const n=s.shift();if(void 0===n)return d.length?void(h=setTimeout(()=>{m(),"pending"===c&&(_(),A())},e.timeout)):void A();const a={status:"pending",resource:n,callback:(t,i)=>{!function(t,i,n){const a="success"!==i;switch(d=d.filter(e=>e!==t),c){case"pending":break;case"failed":if(a||!e.dataAfterTimeout)return;break;default:return}if("abort"===i)return l=n,void A();if(a)return l=n,void(d.length||(s.length?v():A()));if(m(),_(),!e.random){const i=e.resources.indexOf(t.resource);-1!==i&&i!==e.index&&(e.index=i)}c="completed",p.forEach(e=>{e(n)})}(a,t,i)}};d.push(a),u++,h=setTimeout(v,e.rotate),i(n,t,a.callback)}return"function"==typeof n&&p.push(n),setTimeout(v),function(){return{startTime:o,payload:t,status:c,queriesSent:u,queriesPending:d.length,subscribe:f,abort:g}}}function _r(e){const t={...fr,...e};let i=[];function n(){i=i.filter(e=>"pending"===e().status)}return{query:function(e,a,r){const s=Ar(t,e,a,(e,t)=>{n(),r&&r(e,t)});return i.push(s),s},find:function(e){return i.find(t=>e(t))||null},setIndex:e=>{t.index=e},getIndex:()=>t.index,cleanup:n}}function vr(){}const yr=Object.create(null);function xr(e,t,i){let n,a;if("string"==typeof e){const t=lr(e);if(!t)return i(void 0,424),vr;a=t.send;const r=function(e){if(!yr[e]){const t=mr(e);if(!t)return;yr[e]={config:t,redundancy:_r(t)}}return yr[e]}(e);r&&(n=r.redundancy)}else{const t=cr(e);if(t){n=_r(t);const i=lr(e.resources?e.resources[0]:"");i&&(a=i.send)}}return n&&a?n.query(t,a,i)().abort:(i(void 0,424),vr)}function br(){}function wr(e){e.iconsLoaderFlag||(e.iconsLoaderFlag=!0,setTimeout(()=>{e.iconsLoaderFlag=!1,function(e){e.pendingCallbacksFlag||(e.pendingCallbacksFlag=!0,setTimeout(()=>{e.pendingCallbacksFlag=!1;const t=e.loaderCallbacks?e.loaderCallbacks.slice(0):[];if(!t.length)return;let i=!1;const n=e.provider,a=e.prefix;t.forEach(t=>{const r=t.icons,s=r.pending.length;r.pending=r.pending.filter(t=>{if(t.prefix!==a)return!0;const s=t.name;if(e.icons[s])r.loaded.push({provider:n,prefix:a,name:s});else{if(!e.missing.has(s))return i=!0,!0;r.missing.push({provider:n,prefix:a,name:s})}return!1}),r.pending.length!==s&&(i||ar([e],t.id),t.callback(r.loaded.slice(0),r.missing.slice(0),r.pending.slice(0),t.abort))})}))}(e)}))}function Er(e,t,i){function n(){const i=e.pendingIcons;t.forEach(t=>{i&&i.delete(t),e.icons[t]||e.missing.add(t)})}if(i&&"object"==typeof i)try{if(!Xa(e,i).length)return void n()}catch(e){console.error(e)}n(),wr(e)}function kr(e,t){e instanceof Promise?e.then(e=>{t(e)}).catch(()=>{t(null)}):t(e)}function Sr(e,t){e.iconsToLoad?e.iconsToLoad=e.iconsToLoad.concat(t).sort():e.iconsToLoad=t,e.iconsQueueFlag||(e.iconsQueueFlag=!0,setTimeout(()=>{e.iconsQueueFlag=!1;const{provider:t,prefix:i}=e,n=e.iconsToLoad;if(delete e.iconsToLoad,!n||!n.length)return;const a=e.loadIcon;if(e.loadIcons&&(n.length>1||!a))return void kr(e.loadIcons(n,i,t),t=>{Er(e,n,t)});if(a)return void n.forEach(n=>{kr(a(n,i,t),t=>{Er(e,[n],t?{prefix:i,icons:{[n]:t}}:null)})});const{valid:r,invalid:s}=function(e){const t=[],i=[];return e.forEach(e=>{(e.match(Oa)?t:i).push(e)}),{valid:t,invalid:i}}(n);if(s.length&&Er(e,s,null),!r.length)return;const o=i.match(Oa)?lr(t):null;o?o.prepare(t,i,r).forEach(i=>{xr(t,i,t=>{Er(e,i.icons,t)})}):Er(e,r,null)}))}const Mr=(e,t)=>{const i=function(e){const t={loaded:[],missing:[],pending:[]},i=Object.create(null);e.sort((e,t)=>e.provider!==t.provider?e.provider.localeCompare(t.provider):e.prefix!==t.prefix?e.prefix.localeCompare(t.prefix):e.name.localeCompare(t.name));let n={provider:"",prefix:"",name:""};return e.forEach(e=>{if(n.name===e.name&&n.prefix===e.prefix&&n.provider===e.provider)return;n=e;const a=e.provider,r=e.prefix,s=e.name,o=i[a]||(i[a]=Object.create(null)),l=o[r]||(o[r]=Ka(a,r));let c;c=s in l.icons?t.loaded:""===r||l.missing.has(s)?t.missing:t.pending;const u={provider:a,prefix:r,name:s};c.push(u)}),t}(function(e,t=!0,i=!1){const n=[];return e.forEach(e=>{const a="string"==typeof e?Ua(e,t,i):e;a&&n.push(a)}),n}(e,!0,Ja()));if(!i.pending.length){let e=!0;return t&&setTimeout(()=>{e&&t(i.loaded,i.missing,i.pending,br)}),()=>{e=!1}}const n=Object.create(null),a=[];let r,s;return i.pending.forEach(e=>{const{provider:t,prefix:i}=e;if(i===s&&t===r)return;r=t,s=i,a.push(Ka(t,i));const o=n[t]||(n[t]=Object.create(null));o[i]||(o[i]=[])}),i.pending.forEach(e=>{const{provider:t,prefix:i,name:a}=e,r=Ka(t,i),s=r.pendingIcons||(r.pendingIcons=new Set);s.has(a)||(s.add(a),n[t][i].push(a))}),a.forEach(e=>{const t=n[e.provider][e.prefix];t.length&&Sr(e,t)}),t?function(e,t,i){const n=rr++,a=ar.bind(null,i,n);if(!t.pending.length)return a;const r={id:n,icons:t,callback:e,abort:a};return i.forEach(e=>{(e.loaderCallbacks||(e.loaderCallbacks=[])).push(r)}),a}(t,i,a):br},Cr=e=>new Promise((t,i)=>{const n="string"==typeof e?Ua(e,!0):e;n?Mr([n||e],a=>{if(a.length&&n){const e=$a(n);if(e)return void t({...Pa,...e})}i(e)}):i(e)});function Tr(e){try{const t="string"==typeof e?JSON.parse(e):e;if("string"==typeof t.body)return{...t}}catch(e){}}let Dr=!1;try{Dr=0===navigator.vendor.indexOf("Apple")}catch(sB){}const Pr=/(-?[0-9.]*[0-9]+[0-9.]*)/g,Ir=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function Fr(e,t,i){if(1===t)return e;if(i=i||100,"number"==typeof e)return Math.ceil(e*t*i)/i;if("string"!=typeof e)return e;const n=e.split(Pr);if(null===n||!n.length)return e;const a=[];let r=n.shift(),s=Ir.test(r);for(;;){if(s){const e=parseFloat(r);isNaN(e)?a.push(r):a.push(Math.ceil(e*t*i)/i)}else a.push(r);if(r=n.shift(),void 0===r)return a.join("");s=!s}}function zr(e,t){const i={...Pa,...e},n={...za,...t},a={left:i.left,top:i.top,width:i.width,height:i.height};let r=i.body;[i,n].forEach(e=>{const t=[],i=e.hFlip,n=e.vFlip;let s,o=e.rotate;switch(i?n?o+=2:(t.push("translate("+(a.width+a.left).toString()+" "+(0-a.top).toString()+")"),t.push("scale(-1 1)"),a.top=a.left=0):n&&(t.push("translate("+(0-a.left).toString()+" "+(a.height+a.top).toString()+")"),t.push("scale(1 -1)"),a.top=a.left=0),o<0&&(o-=4*Math.floor(o/4)),o%=4,o){case 1:s=a.height/2+a.top,t.unshift("rotate(90 "+s.toString()+" "+s.toString()+")");break;case 2:t.unshift("rotate(180 "+(a.width/2+a.left).toString()+" "+(a.height/2+a.top).toString()+")");break;case 3:s=a.width/2+a.left,t.unshift("rotate(-90 "+s.toString()+" "+s.toString()+")")}o%2==1&&(a.left!==a.top&&(s=a.left,a.left=a.top,a.top=s),a.width!==a.height&&(s=a.width,a.width=a.height,a.height=s)),t.length&&(r=function(e,t,i){const n=function(e,t="defs"){let i="";const n=e.indexOf("<"+t);for(;n>=0;){const a=e.indexOf(">",n),r=e.indexOf("</"+t);if(-1===a||-1===r)break;const s=e.indexOf(">",r);if(-1===s)break;i+=e.slice(a+1,r).trim(),e=e.slice(0,n).trim()+e.slice(s+1)}return{defs:i,content:e}}(e);return a=n.defs,r=t+n.content+i,a?"<defs>"+a+"</defs>"+r:r;var a,r}(r,'<g transform="'+t.join(" ")+'">',"</g>"))});const s=n.width,o=n.height,l=a.width,c=a.height;let u,h;null===s?(h=null===o?"1em":"auto"===o?c:o,u=Fr(h,l/c)):(u="auto"===s?l:s,h=null===o?Fr(u,c/l):"auto"===o?c:o);const d={},p=(e,t)=>{(e=>"unset"===e||"undefined"===e||"none"===e)(t)||(d[e]=t.toString())};p("width",u),p("height",h);const m=[a.left,a.top,l,c];return d.viewBox=m.join(" "),{attributes:d,viewBox:m,body:r}}function Rr(e,t){let i=-1===e.indexOf("xlink:")?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(const e in t)i+=" "+e+'="'+t[e]+'"';return'<svg xmlns="http://www.w3.org/2000/svg"'+i+">"+e+"</svg>"}function Lr(e){return'url("'+function(e){return"data:image/svg+xml,"+function(e){return e.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(/</g,"%3C").replace(/>/g,"%3E").replace(/\s+/g," ")}(e)}(e)+'")'}let Br=(()=>{let e;try{if(e=fetch,"function"==typeof e)return e}catch(e){}})();function Or(e){Br=e}function Ur(){return Br}const Nr={prepare:(e,t,i)=>{const n=[],a=function(e,t){const i=mr(e);if(!i)return 0;let n;if(i.maxURL){let e=0;i.resources.forEach(t=>{const i=t;e=Math.max(e,i.length)});const a=t+".json?icons=";n=i.maxURL-e-i.path.length-a.length}else n=0;return n}(e,t),r="icons";let s={type:r,provider:e,prefix:t,icons:[]},o=0;return i.forEach((i,l)=>{o+=i.length+1,o>=a&&l>0&&(n.push(s),s={type:r,provider:e,prefix:t,icons:[]},o=i.length),s.icons.push(i)}),n.push(s),n},send:(e,t,i)=>{if(!Br)return void i("abort",424);let n=function(e){if("string"==typeof e){const t=mr(e);if(t)return t.path}return"/"}(t.provider);switch(t.type){case"icons":{const e=t.prefix,i=t.icons.join(",");n+=e+".json?"+new URLSearchParams({icons:i}).toString();break}case"custom":{const e=t.uri;n+="/"===e.slice(0,1)?e.slice(1):e;break}default:return void i("abort",400)}let a=503;Br(e+n).then(e=>{const t=e.status;if(200===t)return a=501,e.json();setTimeout(()=>{i(function(e){return 404===e}(t)?"abort":"next",t)})}).then(e=>{"object"==typeof e&&null!==e?setTimeout(()=>{i("success",e)}):setTimeout(()=>{404===e?i("abort",e):i("next",a)})}).catch(()=>{i("next",a)})}};function jr(e,t,i){Ka(i||"",t).loadIcons=e}function Vr(e,t,i){Ka(i||"",t).loadIcon=e}const qr="data-style";let Gr="";function Hr(e){Gr=e}function Wr(e,t){let i=Array.from(e.childNodes).find(e=>e.hasAttribute&&e.hasAttribute(qr));i||(i=document.createElement("style"),i.setAttribute(qr,qr),e.appendChild(i)),i.textContent=":host{display:inline-block;vertical-align:"+(t?"-0.125em":"0")+"}span,svg{display:block;margin:auto}"+Gr}function Zr(){let e;or("",Nr),Ja(!0);try{e=window}catch(e){}if(e){if(void 0!==e.IconifyPreload){const t=e.IconifyPreload,i="Invalid IconifyPreload syntax.";"object"==typeof t&&null!==t&&(t instanceof Array?t:[t]).forEach(e=>{try{("object"!=typeof e||null===e||e instanceof Array||"object"!=typeof e.icons||"string"!=typeof e.prefix||!tr(e))&&console.error(i)}catch(e){console.error(i)}})}if(void 0!==e.IconifyProviders){const t=e.IconifyProviders;if("object"==typeof t&&null!==t)for(const e in t){const i="IconifyProviders["+e+"] is invalid.";try{const n=t[e];if("object"!=typeof n||!n||void 0===n.resources)continue;pr(e,n)||console.error(i)}catch(e){console.error(i)}}}}return{iconLoaded:ir,getIcon:nr,listIcons:Qa,addIcon:er,addCollection:tr,calculateSize:Fr,buildIcon:zr,iconToHTML:Rr,svgToURL:Lr,loadIcons:Mr,loadIcon:Cr,addAPIProvider:pr,setCustomIconLoader:Vr,setCustomIconsLoader:jr,appendCustomStyle:Hr,_api:{getAPIConfig:mr,setAPIModule:or,sendAPIQuery:xr,setFetch:Or,getFetch:Ur,listAPIProviders:gr}}}const Kr={"background-color":"currentColor"},Xr={"background-color":"transparent"},Qr={image:"var(--svg)",repeat:"no-repeat",size:"100% 100%"},Yr={"-webkit-mask":Kr,mask:Kr,background:Xr};for(const e in Yr){const t=Yr[e];for(const i in Qr)t[e+"-"+i]=Qr[i]}function Jr(e){return e?e+(e.match(/^[-0-9.]+$/)?"px":""):"inherit"}let $r;function es(e){return void 0===$r&&function(){try{$r=window.trustedTypes.createPolicy("iconify",{createHTML:e=>e})}catch(e){$r=null}}(),$r?$r.createHTML(e):e}function ts(e){return Array.from(e.childNodes).find(e=>{const t=e.tagName&&e.tagName.toUpperCase();return"SPAN"===t||"SVG"===t})}function is(e,t){const i=t.icon.data,n=t.customisations,a=zr(i,n);n.preserveAspectRatio&&(a.attributes.preserveAspectRatio=n.preserveAspectRatio);const r=t.renderedMode;let s;if("svg"===r)s=function(e){const t=document.createElement("span"),i=e.attributes;let n="";i.width||(n="width: inherit;"),i.height||(n+="height: inherit;"),n&&(i.style=n);const a=Rr(e.body,i);return t.innerHTML=es(a),t.firstChild}(a);else s=function(e,t,i){const n=document.createElement("span");let a=e.body;-1!==a.indexOf("<a")&&(a+="\x3c!-- "+Date.now()+" --\x3e");const r=e.attributes,s=Lr(Rr(a,{...r,width:t.width+"",height:t.height+""})),o=n.style,l={"--svg":s,width:Jr(r.width),height:Jr(r.height),...i?Kr:Xr};for(const e in l)o.setProperty(e,l[e]);return n}(a,{...Pa,...i},"mask"===r);const o=ts(e);o?"SPAN"===s.tagName&&o.tagName===s.tagName?o.setAttribute("style",s.getAttribute("style")):e.replaceChild(s,o):e.appendChild(s)}function ns(e,t,i){return{rendered:!1,inline:t,icon:e,lastRender:i&&(i.rendered?i:i.lastRender)}}const as=function(e="iconify-icon"){let t,i;try{t=window.customElements,i=window.HTMLElement}catch(e){return}if(!t||!i)return;const n=t.get(e);if(n)return n;const a=["icon","mode","inline","noobserver","width","height","rotate","flip"],r=class extends i{_shadowRoot;_initialised=!1;_state;_checkQueued=!1;_connected=!1;_observer=null;_visible=!0;constructor(){super();const e=this._shadowRoot=this.attachShadow({mode:"open"}),t=this.hasAttribute("inline");Wr(e,t),this._state=ns({value:""},t),this._queueCheck()}connectedCallback(){this._connected=!0,this.startObserver()}disconnectedCallback(){this._connected=!1,this.stopObserver()}static get observedAttributes(){return a.slice(0)}attributeChangedCallback(e){switch(e){case"inline":{const e=this.hasAttribute("inline"),t=this._state;e!==t.inline&&(t.inline=e,Wr(this._shadowRoot,e));break}case"noobserver":this.hasAttribute("noobserver")?this.startObserver():this.stopObserver();break;default:this._queueCheck()}}get icon(){const e=this.getAttribute("icon");if(e&&"{"===e.slice(0,1))try{return JSON.parse(e)}catch(e){}return e}set icon(e){"object"==typeof e&&(e=JSON.stringify(e)),this.setAttribute("icon",e)}get inline(){return this.hasAttribute("inline")}set inline(e){e?this.setAttribute("inline","true"):this.removeAttribute("inline")}get observer(){return this.hasAttribute("observer")}set observer(e){e?this.setAttribute("observer","true"):this.removeAttribute("observer")}restartAnimation(){const e=this._state;if(e.rendered){const t=this._shadowRoot;if("svg"===e.renderedMode)try{return void t.lastChild.setCurrentTime(0)}catch(e){}is(t,e)}}get status(){const e=this._state;return e.rendered?"rendered":null===e.icon.data?"failed":"loading"}_queueCheck(){this._checkQueued||(this._checkQueued=!0,setTimeout(()=>{this._check()}))}_check(){if(!this._checkQueued)return;this._checkQueued=!1;const e=this._state,t=this.getAttribute("icon");if(t!==e.icon.value)return void this._iconChanged(t);if(!e.rendered||!this._visible)return;const i=this.getAttribute("mode"),n=Ba(this);e.attrMode===i&&!function(e,t){for(const i in La)if(e[i]!==t[i])return!0;return!1}(e.customisations,n)&&ts(this._shadowRoot)||this._renderIcon(e.icon,n,i)}_iconChanged(e){const t=function(e,t){if("object"==typeof e)return{data:Tr(e),value:e};if("string"!=typeof e)return{value:e};if(e.includes("{")){const t=Tr(e);if(t)return{data:t,value:e}}const i=Ua(e,!0,!0);if(!i)return{value:e};const n=$a(i);if(void 0!==n||!i.prefix)return{value:e,name:i,data:n};const a=Mr([i],()=>t(e,i,$a(i)));return{value:e,name:i,loading:a}}(e,(e,t,i)=>{const n=this._state;if(n.rendered||this.getAttribute("icon")!==e)return;const a={value:e,name:t,data:i};a.data?this._gotIconData(a):n.icon=a});t.data?this._gotIconData(t):this._state=ns(t,this._state.inline,this._state)}_forceRender(){if(!this._visible){const e=ts(this._shadowRoot);return void(e&&this._shadowRoot.removeChild(e))}this._queueCheck()}_gotIconData(e){this._checkQueued=!1,this._renderIcon(e,Ba(this),this.getAttribute("mode"))}_renderIcon(e,t,i){const n=function(e,t){switch(t){case"svg":case"bg":case"mask":return t}return"style"===t||!Dr&&-1!==e.indexOf("<a")?-1===e.indexOf("currentColor")?"bg":"mask":"svg"}(e.data.body,i),a=this._state.inline;is(this._shadowRoot,this._state={rendered:!0,icon:e,inline:a,customisations:t,attrMode:i,renderedMode:n})}startObserver(){if(!this._observer&&!this.hasAttribute("noobserver"))try{this._observer=new IntersectionObserver(e=>{const t=e.some(e=>e.isIntersecting);t!==this._visible&&(this._visible=t,this._forceRender())}),this._observer.observe(this)}catch(e){if(this._observer){try{this._observer.disconnect()}catch(e){}this._observer=null}}}stopObserver(){this._observer&&(this._observer.disconnect(),this._observer=null,this._visible=!0,this._connected&&this._forceRender())}};a.forEach(e=>{e in r.prototype||Object.defineProperty(r.prototype,e,{get:function(){return this.getAttribute(e)},set:function(t){null!==t?this.setAttribute(e,t):this.removeAttribute(e)}})});const s=Zr();for(const e in s)r[e]=r.prototype[e]=s[e];return t.define(e,r),r}()||Zr(),{iconLoaded:rs,getIcon:ss,listIcons:os,addIcon:ls,addCollection:cs,calculateSize:us,buildIcon:hs,iconToHTML:ds,svgToURL:ps,loadIcons:ms,loadIcon:gs,setCustomIconLoader:fs,setCustomIconsLoader:As,addAPIProvider:_s,_api:vs}=as;function ys(e,t){return Ca(e,t).node[0]}function xs(){fs(async e=>{const t=await fetch(ge(e));return t.ok?{body:await t.text()}:null},"temaki")}function bs(e,t={}){const i=document.createElement(e);return Object.entries(t).forEach(([e,t])=>{e.startsWith("_")?i[e]=t:e.startsWith("fn")?i[e.substring(2)]=t:e.startsWith("on")?i.addEventListener(e.substring(2),t):t&&i.setAttribute(e,t)}),i}function ws(e,t){e._parent?.addEventListener("menu-opened",i=>{i.detail.menu!==e&&t()}),e._parent?.onceMapReady?.().then(()=>{e._parent.map?.on?.("click",()=>t())}),e._parent?.oncePSVReady?.().then(()=>{e._parent.psv.addEventListener("click",()=>t())}),e._parent?.onceReady?.().then(()=>{e._parent.legend?.addEventListener("click",()=>t())})}function Es(e){return e._parent?e._parent:e===document.body?null:e.parentNode?Es(e.parentNode):e.host?Es(e.host):void 0}function ks(e){return e._parent?Promise.resolve(e._parent):new Promise(t=>{const i=setInterval(()=>{const n=Es(e);n&&(e._parent=n,clearInterval(i),t(e._parent))},100)})}var Ss=Object.freeze({__proto__:null,createWebComp:bs,fa:ys,listenForMenuClosure:ws,moreIcons:xs,onceParentAvailable:ks}),Ms={Space_Separator:/[\u1680\u2000-\u200A\u202F\u205F\u3000]/,ID_Start:/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/,ID_Continue:/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/},Cs={isSpaceSeparator:e=>"string"==typeof e&&Ms.Space_Separator.test(e),isIdStartChar:e=>"string"==typeof e&&(e>="a"&&e<="z"||e>="A"&&e<="Z"||"$"===e||"_"===e||Ms.ID_Start.test(e)),isIdContinueChar:e=>"string"==typeof e&&(e>="a"&&e<="z"||e>="A"&&e<="Z"||e>="0"&&e<="9"||"$"===e||"_"===e||""===e||""===e||Ms.ID_Continue.test(e)),isDigit:e=>"string"==typeof e&&/[0-9]/.test(e),isHexDigit:e=>"string"==typeof e&&/[0-9A-Fa-f]/.test(e)};let Ts,Ds,Ps,Is,Fs,zs,Rs,Ls,Bs;function Os(e,t,i){const n=e[t];if(null!=n&&"object"==typeof n)if(Array.isArray(n))for(let e=0;e<n.length;e++){const t=String(e),a=Os(n,t,i);void 0===a?delete n[t]:Object.defineProperty(n,t,{value:a,writable:!0,enumerable:!0,configurable:!0})}else for(const e in n){const t=Os(n,e,i);void 0===t?delete n[e]:Object.defineProperty(n,e,{value:t,writable:!0,enumerable:!0,configurable:!0})}return i.call(e,t,n)}let Us,Ns,js,Vs,qs;function Gs(){for(Us="default",Ns="",js=!1,Vs=1;;){qs=Hs();const e=Zs[Us]();if(e)return e}}function Hs(){if(Ts[Is])return String.fromCodePoint(Ts.codePointAt(Is))}function Ws(){const e=Hs();return"\n"===e?(Fs++,zs=0):e?zs+=e.length:zs++,e&&(Is+=e.length),e}const Zs={default(){switch(qs){case"\t":case"\v":case"\f":case" ":case" ":case"\ufeff":case"\n":case"\r":case"\u2028":case"\u2029":return void Ws();case"/":return Ws(),void(Us="comment");case void 0:return Ws(),Ks("eof")}if(!Cs.isSpaceSeparator(qs))return Zs[Ds]();Ws()},comment(){switch(qs){case"*":return Ws(),void(Us="multiLineComment");case"/":return Ws(),void(Us="singleLineComment")}throw eo(Ws())},multiLineComment(){switch(qs){case"*":return Ws(),void(Us="multiLineCommentAsterisk");case void 0:throw eo(Ws())}Ws()},multiLineCommentAsterisk(){switch(qs){case"*":return void Ws();case"/":return Ws(),void(Us="default");case void 0:throw eo(Ws())}Ws(),Us="multiLineComment"},singleLineComment(){switch(qs){case"\n":case"\r":case"\u2028":case"\u2029":return Ws(),void(Us="default");case void 0:return Ws(),Ks("eof")}Ws()},value(){switch(qs){case"{":case"[":return Ks("punctuator",Ws());case"n":return Ws(),Xs("ull"),Ks("null",null);case"t":return Ws(),Xs("rue"),Ks("boolean",!0);case"f":return Ws(),Xs("alse"),Ks("boolean",!1);case"-":case"+":return"-"===Ws()&&(Vs=-1),void(Us="sign");case".":return Ns=Ws(),void(Us="decimalPointLeading");case"0":return Ns=Ws(),void(Us="zero");case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":return Ns=Ws(),void(Us="decimalInteger");case"I":return Ws(),Xs("nfinity"),Ks("numeric",1/0);case"N":return Ws(),Xs("aN"),Ks("numeric",NaN);case'"':case"'":return js='"'===Ws(),Ns="",void(Us="string")}throw eo(Ws())},identifierNameStartEscape(){if("u"!==qs)throw eo(Ws());Ws();const e=Qs();switch(e){case"$":case"_":break;default:if(!Cs.isIdStartChar(e))throw io()}Ns+=e,Us="identifierName"},identifierName(){switch(qs){case"$":case"_":case"":case"":return void(Ns+=Ws());case"\\":return Ws(),void(Us="identifierNameEscape")}if(!Cs.isIdContinueChar(qs))return Ks("identifier",Ns);Ns+=Ws()},identifierNameEscape(){if("u"!==qs)throw eo(Ws());Ws();const e=Qs();switch(e){case"$":case"_":case"":case"":break;default:if(!Cs.isIdContinueChar(e))throw io()}Ns+=e,Us="identifierName"},sign(){switch(qs){case".":return Ns=Ws(),void(Us="decimalPointLeading");case"0":return Ns=Ws(),void(Us="zero");case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":return Ns=Ws(),void(Us="decimalInteger");case"I":return Ws(),Xs("nfinity"),Ks("numeric",Vs*(1/0));case"N":return Ws(),Xs("aN"),Ks("numeric",NaN)}throw eo(Ws())},zero(){switch(qs){case".":return Ns+=Ws(),void(Us="decimalPoint");case"e":case"E":return Ns+=Ws(),void(Us="decimalExponent");case"x":case"X":return Ns+=Ws(),void(Us="hexadecimal")}return Ks("numeric",0*Vs)},decimalInteger(){switch(qs){case".":return Ns+=Ws(),void(Us="decimalPoint");case"e":case"E":return Ns+=Ws(),void(Us="decimalExponent")}if(!Cs.isDigit(qs))return Ks("numeric",Vs*Number(Ns));Ns+=Ws()},decimalPointLeading(){if(Cs.isDigit(qs))return Ns+=Ws(),void(Us="decimalFraction");throw eo(Ws())},decimalPoint(){switch(qs){case"e":case"E":return Ns+=Ws(),void(Us="decimalExponent")}return Cs.isDigit(qs)?(Ns+=Ws(),void(Us="decimalFraction")):Ks("numeric",Vs*Number(Ns))},decimalFraction(){switch(qs){case"e":case"E":return Ns+=Ws(),void(Us="decimalExponent")}if(!Cs.isDigit(qs))return Ks("numeric",Vs*Number(Ns));Ns+=Ws()},decimalExponent(){switch(qs){case"+":case"-":return Ns+=Ws(),void(Us="decimalExponentSign")}if(Cs.isDigit(qs))return Ns+=Ws(),void(Us="decimalExponentInteger");throw eo(Ws())},decimalExponentSign(){if(Cs.isDigit(qs))return Ns+=Ws(),void(Us="decimalExponentInteger");throw eo(Ws())},decimalExponentInteger(){if(!Cs.isDigit(qs))return Ks("numeric",Vs*Number(Ns));Ns+=Ws()},hexadecimal(){if(Cs.isHexDigit(qs))return Ns+=Ws(),void(Us="hexadecimalInteger");throw eo(Ws())},hexadecimalInteger(){if(!Cs.isHexDigit(qs))return Ks("numeric",Vs*Number(Ns));Ns+=Ws()},string(){switch(qs){case"\\":return Ws(),void(Ns+=function(){switch(Hs()){case"b":return Ws(),"\b";case"f":return Ws(),"\f";case"n":return Ws(),"\n";case"r":return Ws(),"\r";case"t":return Ws(),"\t";case"v":return Ws(),"\v";case"0":if(Ws(),Cs.isDigit(Hs()))throw eo(Ws());return"\0";case"x":return Ws(),function(){let e="",t=Hs();if(!Cs.isHexDigit(t))throw eo(Ws());if(e+=Ws(),t=Hs(),!Cs.isHexDigit(t))throw eo(Ws());return e+=Ws(),String.fromCodePoint(parseInt(e,16))}();case"u":return Ws(),Qs();case"\n":case"\u2028":case"\u2029":return Ws(),"";case"\r":return Ws(),"\n"===Hs()&&Ws(),"";case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case void 0:throw eo(Ws())}return Ws()}());case'"':return js?(Ws(),Ks("string",Ns)):void(Ns+=Ws());case"'":return js?void(Ns+=Ws()):(Ws(),Ks("string",Ns));case"\n":case"\r":throw eo(Ws());case"\u2028":case"\u2029":!function(e){console.warn(`JSON5: '${no(e)}' in strings is not valid ECMAScript; consider escaping`)}(qs);break;case void 0:throw eo(Ws())}Ns+=Ws()},start(){switch(qs){case"{":case"[":return Ks("punctuator",Ws())}Us="value"},beforePropertyName(){switch(qs){case"$":case"_":return Ns=Ws(),void(Us="identifierName");case"\\":return Ws(),void(Us="identifierNameStartEscape");case"}":return Ks("punctuator",Ws());case'"':case"'":return js='"'===Ws(),void(Us="string")}if(Cs.isIdStartChar(qs))return Ns+=Ws(),void(Us="identifierName");throw eo(Ws())},afterPropertyName(){if(":"===qs)return Ks("punctuator",Ws());throw eo(Ws())},beforePropertyValue(){Us="value"},afterPropertyValue(){switch(qs){case",":case"}":return Ks("punctuator",Ws())}throw eo(Ws())},beforeArrayValue(){if("]"===qs)return Ks("punctuator",Ws());Us="value"},afterArrayValue(){switch(qs){case",":case"]":return Ks("punctuator",Ws())}throw eo(Ws())},end(){throw eo(Ws())}};function Ks(e,t){return{type:e,value:t,line:Fs,column:zs}}function Xs(e){for(const t of e){if(Hs()!==t)throw eo(Ws());Ws()}}function Qs(){let e="",t=4;for(;t-- >0;){const t=Hs();if(!Cs.isHexDigit(t))throw eo(Ws());e+=Ws()}return String.fromCodePoint(parseInt(e,16))}const Ys={start(){if("eof"===Rs.type)throw to();Js()},beforePropertyName(){switch(Rs.type){case"identifier":case"string":return Ls=Rs.value,void(Ds="afterPropertyName");case"punctuator":return void $s();case"eof":throw to()}},afterPropertyName(){if("eof"===Rs.type)throw to();Ds="beforePropertyValue"},beforePropertyValue(){if("eof"===Rs.type)throw to();Js()},beforeArrayValue(){if("eof"===Rs.type)throw to();"punctuator"!==Rs.type||"]"!==Rs.value?Js():$s()},afterPropertyValue(){if("eof"===Rs.type)throw to();switch(Rs.value){case",":return void(Ds="beforePropertyName");case"}":$s()}},afterArrayValue(){if("eof"===Rs.type)throw to();switch(Rs.value){case",":return void(Ds="beforeArrayValue");case"]":$s()}},end(){}};function Js(){let e;switch(Rs.type){case"punctuator":switch(Rs.value){case"{":e={};break;case"[":e=[]}break;case"null":case"boolean":case"numeric":case"string":e=Rs.value}if(void 0===Bs)Bs=e;else{const t=Ps[Ps.length-1];Array.isArray(t)?t.push(e):Object.defineProperty(t,Ls,{value:e,writable:!0,enumerable:!0,configurable:!0})}if(null!==e&&"object"==typeof e)Ps.push(e),Ds=Array.isArray(e)?"beforeArrayValue":"beforePropertyName";else{const e=Ps[Ps.length-1];Ds=null==e?"end":Array.isArray(e)?"afterArrayValue":"afterPropertyValue"}}function $s(){Ps.pop();const e=Ps[Ps.length-1];Ds=null==e?"end":Array.isArray(e)?"afterArrayValue":"afterPropertyValue"}function eo(e){return ao(void 0===e?`JSON5: invalid end of input at ${Fs}:${zs}`:`JSON5: invalid character '${no(e)}' at ${Fs}:${zs}`)}function to(){return ao(`JSON5: invalid end of input at ${Fs}:${zs}`)}function io(){return zs-=5,ao(`JSON5: invalid identifier character at ${Fs}:${zs}`)}function no(e){const t={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"};if(t[e])return t[e];if(e<" "){const t=e.charCodeAt(0).toString(16);return"\\x"+("00"+t).substring(t.length)}return e}function ao(e){const t=new SyntaxError(e);return t.lineNumber=Fs,t.columnNumber=zs,t}const ro={parse:function(e,t){Ts=String(e),Ds="start",Ps=[],Is=0,Fs=1,zs=0,Rs=void 0,Ls=void 0,Bs=void 0;do{Rs=Gs(),Ys[Ds]()}while("eof"!==Rs.type);return"function"==typeof t?Os({"":Bs},"",t):Bs},stringify:function(e,t,i){const n=[];let a,r,s,o="",l="";if(null==t||"object"!=typeof t||Array.isArray(t)||(i=t.space,s=t.quote,t=t.replacer),"function"==typeof t)r=t;else if(Array.isArray(t)){a=[];for(const e of t){let t;"string"==typeof e?t=e:("number"==typeof e||e instanceof String||e instanceof Number)&&(t=String(e)),void 0!==t&&a.indexOf(t)<0&&a.push(t)}}return i instanceof Number?i=Number(i):i instanceof String&&(i=String(i)),"number"==typeof i?i>0&&(i=Math.min(10,Math.floor(i)),l=" ".substr(0,i)):"string"==typeof i&&(l=i.substr(0,10)),c("",{"":e});function c(e,t){let i=t[e];switch(null!=i&&("function"==typeof i.toJSON5?i=i.toJSON5(e):"function"==typeof i.toJSON&&(i=i.toJSON(e))),r&&(i=r.call(t,e,i)),i instanceof Number?i=Number(i):i instanceof String?i=String(i):i instanceof Boolean&&(i=i.valueOf()),i){case null:return"null";case!0:return"true";case!1:return"false"}return"string"==typeof i?u(i):"number"==typeof i?String(i):"object"==typeof i?Array.isArray(i)?function(e){if(n.indexOf(e)>=0)throw TypeError("Converting circular structure to JSON5");n.push(e);let t=o;o+=l;let i,a=[];for(let t=0;t<e.length;t++){const i=c(String(t),e);a.push(void 0!==i?i:"null")}if(0===a.length)i="[]";else if(""===l){i="["+a.join(",")+"]"}else{let e=",\n"+o,n=a.join(e);i="[\n"+o+n+",\n"+t+"]"}return n.pop(),o=t,i}(i):function(e){if(n.indexOf(e)>=0)throw TypeError("Converting circular structure to JSON5");n.push(e);let t=o;o+=l;let i,r=a||Object.keys(e),s=[];for(const t of r){const i=c(t,e);if(void 0!==i){let e=h(t)+":";""!==l&&(e+=" "),e+=i,s.push(e)}}if(0===s.length)i="{}";else{let e;if(""===l)e=s.join(","),i="{"+e+"}";else{let n=",\n"+o;e=s.join(n),i="{\n"+o+e+",\n"+t+"}"}}return n.pop(),o=t,i}(i):void 0}function u(e){const t={"'":.1,'"':.2},i={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"};let n="";for(let a=0;a<e.length;a++){const r=e[a];switch(r){case"'":case'"':t[r]++,n+=r;continue;case"\0":if(Cs.isDigit(e[a+1])){n+="\\x00";continue}}if(i[r])n+=i[r];else{if(r<" "){let e=r.charCodeAt(0).toString(16);n+="\\x"+("00"+e).substring(e.length);continue}n+=r}}const a=s||Object.keys(t).reduce((e,i)=>t[e]<t[i]?e:i);return n=n.replace(new RegExp(a,"g"),i[a]),a+n+a}function h(e){if(0===e.length)return u(e);const t=String.fromCodePoint(e.codePointAt(0));if(!Cs.isIdStartChar(t))return u(e);for(let i=t.length;i<e.length;i++)if(!Cs.isIdContinueChar(String.fromCodePoint(e.codePointAt(i))))return u(e);return e}}};var so=ro;const oo=new CSSStyleSheet;oo.replaceSync("/* atkinson-hyperlegible-next-latin-ext-400-normal */\n@font-face {\n font-family: 'Atkinson Hyperlegible Next';\n font-style: normal;\n font-display: swap;\n font-weight: 400;\n src: url(/fonts/atkinson-hyperlegible-next-latin-ext-400-normal.woff2) format('woff2'), url(/fonts/atkinson-hyperlegible-next-latin-ext-400-normal.woff) format('woff');\n unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;\n}\n\n/* atkinson-hyperlegible-next-latin-400-normal */\n@font-face {\n font-family: 'Atkinson Hyperlegible Next';\n font-style: normal;\n font-display: swap;\n font-weight: 400;\n src: url(/fonts/atkinson-hyperlegible-next-latin-400-normal.woff2) format('woff2'), url(/fonts/atkinson-hyperlegible-next-latin-400-normal.woff) format('woff');\n unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;\n}");const lo=new CSSStyleSheet;lo.replaceSync('/* Colors */\n:root, :host {\n\t--white: #ffffff;\n\t--black: #181818;\n\t--black-pale: #1b1a17;\n\t--red: #f70000;\n\t--red-transparent: rgba(247, 0, 0, 0.3);\n\t--red-pale: #ff726f;\n\t--grey: #f5f5f5;\n\t--grey-very-pale: #e6e6e6;\n\t--grey-pale: #cfd2cf;\n\t--grey-semi-dark: #808080;\n\t--grey-dark: #3e3e3e;\n\t--blue: #2954e9;\n\t--blue-dark: #0a1f69;\n\t--blue-semi: #d7dffc;\n\t--blue-pale: #f2f5ff;\n\t--blue-geovisio: #34495e;\n\t--beige: #f5f3ec;\n\t--yellow: #fec868;\n\t--orange: #ff6f00;\n\t--orange-transparent: rgba(255,111,0,0.3);\n\t--orange-pale: #fffafa;\n\t--green: #7ec636;\n\t--green-pale: #f0ffee;\n\t--widget-bg: var(--white);\n\t--widget-bg-hover: var(--grey);\n\t--widget-bg-active: var(--blue);\n\t--widget-bg-inactive: var(--grey-pale);\n\t--widget-bg-primary: var(--blue-semi);\n\t--widget-bg-primary-hover: #e0e7ff;\n\t--widget-bg-warn: #FFECB3;\n\t--widget-bg-danger: #FFCDD2;\n\t--widget-bg-success: #C8E6C9;\n\t--widget-border-div: var(--grey-pale);\n\t--widget-border-btn: var(--blue);\n\t--widget-font: var(--grey-dark);\n\t--widget-font-active: var(--white);\n\t--widget-font-direct: var(--blue);\n\t--widget-font-warn: #BF360C;\n\t--widget-font-danger: #B71C1C;\n\t--widget-font-success: #1B5E20;\n\t--font-family: "Atkinson Hyperlegible Next", sans-serif;\n\t--widget-option-left: #6A1B9A;\n\t--widget-option-right: #0D47A1;\n\toverscroll-behavior-y: contain;\n}\n\n.pnx-hidden { display: none !important; }\n\n/* Hidden elements on mobile */\n@container (max-width: 576px) {\n\t.pnx-mobile-hidden { display: none !important; }\n}\n\n/* Hidden elements on print */\n@media print {\n\t.pnx-print-hidden { display: none !important; }\n}\n'),document.adoptedStyleSheets.push(oo),document.adoptedStyleSheets.push(lo);class co extends ce{static properties={picture:{type:String,reflect:!0},sequence:{type:String,reflect:!0},"fetch-options":{converter:co.GetJSONConverter()},lang:{type:String},endpoint:{type:String}};constructor(e=!1){super(),this.lang=this.getAttribute("lang")||null,this.endpoint=this.getAttribute("endpoint")||null,this.picture=this.getAttribute("picture")||null,this.sequence=this.getAttribute("sequence")||null,console.info(`📷 Panoramax ${this.getClassName()} - Version 5.3.0 (e278677)\n\n🆘 Issues can be reported at https://gitlab.com/panoramax/clients/web-viewer/-/work_items`),e||(this._isInternetFast=null,$e().then(e=>this._isInternetFast=e))}connectedCallback(){super.connectedCallback(),this._t=dt(this.lang),this.loader=bs("pnx-loader",{_parent:this,"no-label":Ye()}),this._loadsAPI&&this.endpoint&&this._loadsAPI===this.endpoint||this.api&&this.api._endpoint===this.endpoint||!this.endpoint||((this._loadsAPI||this.api)&&(delete this.api,delete this._loadsAPI),this._setupAPI()),Object.entries({map:"map-options",psv:"psv-options",fetchOptions:"fetch-options",mapstyle:"map-style"}).forEach(([e,t])=>{this.getAttribute(e)&&console.error(`Component attribute "${e}" has been renamed into "${t}". Old attribute "${e}" is ignored.`)}),Ye()&&this.classList.add("pnx-iframed")}_setupAPI(){if(this.loader=this.loader||bs("pnx-loader",{_parent:this}),!this.endpoint)return void console.warn("No endpoint is defined");this._loadsAPI=this.endpoint;let e=this.endpoint;try{this.api=new st(this.endpoint,{fetch:this["fetch-options"]}),this.api.onceReady().then(()=>{if(e!==this._loadsAPI||!this.api)return;let t=this.api.getUnavailableFeatures(),i=this.api.getAvailableFeatures();i=0===t.length?"✅ All features available":"✅ Available features: "+i.join(", "),t=0===t.length?"":"🚫 Unavailable features: "+t.join(", "),console.info(`🌐 Connected to API "${this.api._metadata.name}" (${this.api._endpoint})\nℹ️ API runs STAC ${this.api._metadata.stac_version} ${this.api._metadata.geovisio_version?"& GeoVisio "+this.api._metadata.geovisio_version:""}\n ${i}\n ${t}\n`.trim())}).catch(e=>this.loader?.dismiss?.(e,this._t?.pnx.error_api)).finally(()=>delete this._loadsAPI)}catch(e){delete this._loadsAPI,this.loader?.dismiss?this.loader.dismiss(e,this._t.pnx.error_api):console.error(e)}}onceReady(){throw new Error("You must override this method on sub-class")}onceAPIReady(){return this.api?this.api.onceReady():new Promise(e=>setTimeout(e,250)).then(this.onceAPIReady.bind(this))}createRenderRoot(){return this}attributeChangedCallback(e,t,i){if(super.attributeChangedCallback(e,t,i),"endpoint"===e&&(this._loadsAPI&&i&&this._loadsAPI===i||this.api&&this.api._endpoint===i||!i||((this._loadsAPI||this.api)&&(delete this.api,delete this._loadsAPI),this._setupAPI())),["picture","sequence"].includes(e)){let n,a,r,s;"picture"===e?(n=this.sequence,r=this.sequence,a=i,s=t):(n=i,r=t,a=this.picture,s=this.picture),this.dispatchEvent(new CustomEvent("select",{bubbles:!0,composed:!0,detail:{seqId:n,picId:a,prevSeqId:r,prevPicId:s}}))}}getClassName(){return"Basic"}select(e=null,t=null,i=!1){i&&(this.picture=null,this.sequence=null),this.picture=t,this.sequence=e}isWidthSmall(){return this?.offsetWidth<576}isWidthMedium(){return this?.offsetWidth>=576&&this?.offsetWidth<768}isHeightSmall(){return this?.offsetHeight<400}render(){return H`<p>Should not be used directly, use Viewer/CoverageMap/Editor instead</p>`}getSubComponentsNames(){return["loader","api"]}getAPI(){return this.api}addEventListener(e,t,i){let n=e.split(":").shift();if(n&&this.getSubComponentsNames().includes(n)){const a=e.substring(n.length+1);this[n]?.addEventListener?this[n].addEventListener(a,t,i):setTimeout(()=>this.addEventListener(e,t,i),50)}else super.addEventListener(e,t,i)}static GetJSONConverter(){return{fromAttribute:e=>null==e||""===e?null:"object"==typeof e||Array.isArray(e)?e:so.parse(e),toAttribute:e=>null==e||""===e?"":"string"==typeof e?e:so.stringify(e)}}}var uo="data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8' standalone='no'%3f%3e%3csvg width='48' height='48' viewBox='0 0 48 48' version='1.1' id='svg1' xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg'%3e %3cdefs id='defs1' /%3e %3cpath d='m 8.0222924%2c7.8597977 a 22.594107%2c22.594107 0 0 1 31.9555636%2c0.0027 L 24.001409%2c23.838916 Z' style='fill:%2354278f%3bfill-opacity:1%3bstroke:white%3bstroke-width:2.50003%3bstroke-miterlimit:4%3bstroke-dasharray:none%3bstroke-opacity:1' id='path1' /%3e %3ccircle cx='24' cy='24' r='9.9777565' style='fill:%23b39ddb%3bfill-opacity:1%3bstroke:white%3bstroke-width:2.49449%3bstroke-miterlimit:4%3bstroke-dasharray:none%3bstroke-opacity:1' id='circle1' /%3e%3c/svg%3e";const ho="pnx-aerial",po=15,mo=["!",["has","uncrowded"]],go=["==",["get","type"],"equirectangular"];function fo(e){return{PICTURES:{paint:{"circle-radius":["interpolate",["linear"],["zoom"],po,0,15.5,e?1:["case",mo,0,1],16.5,e?2:["case",mo,0,2],17,e?4:["case",mo,1,4],18,e?5:["case",mo,3,5],20,e?7:["case",mo,5,7],22,e?7:["case",mo,7,7]],"circle-opacity":["interpolate",["linear"],["zoom"],po,0,15.5,e?1:["case",mo,0,1],16.5,e?1:["case",mo,0,1],17,1],"circle-stroke-opacity":["case",["all",mo,go],.2,go,.4,0],"circle-stroke-width":["interpolate",["linear"],["zoom"],17.5,0,18.5,e?["case",go,10,2]:["case",["all",mo,go],0,go,10,mo,0,2],19.5,e?["case",go,10,2]:["case",["all",mo,go],10,go,10,mo,0,2]]},layout:{}},SEQUENCES:{paint:{"line-width":["interpolate",["linear"],["zoom"],0,.5,10,1.5,14.5,1.5,15.5,e?2:["case",mo,.5,2],22,e?4:["case",mo,1,4]]},layout:{"line-cap":"square"}},SEQUENCES_PLUS:{paint:{"line-width":["interpolate",["linear"],["zoom"],0,15,16,30],"line-opacity":0,"line-color":"#ff0000"},layout:{"line-cap":"square"}},GRID:{layout:{"circle-sort-key":["get","coef"]},paint:{"circle-color":["interpolate",["linear"],["get","coef"],0,"#fff",.1,Te.PALETTE_1,.25,Te.PALETTE_1,.5,Te.PALETTE_2,.75,Te.PALETTE_3,1,Te.PALETTE_4],"circle-opacity":["interpolate",["linear"],["zoom"],4,.5,5,1,6.75,1,7,0],"circle-radius":["interpolate",["linear"],["zoom"],1,["match",["get","coef"],0,0,1],5,["match",["get","coef"],0,0,2.5],7,["match",["get","coef"],0,0,7]]}}}}const Ao=fo(!1),_o=fo(!0),vo=["case",["==",["get","type"],"equirectangular"],["case",["has","h_pixel_density"],["step",["get","h_pixel_density"],...Fe],1],["case",["has","h_pixel_density"],["step",["get","h_pixel_density"],...Ie],1]],yo=["case",["==",["get","gps_accuracy"],0],1,["has","gps_accuracy"],["step",["get","gps_accuracy"],...ze],1],xo=["round",["+",["*",vo,.8],["*",yo,.2]]],bo=864e5,wo=e=>new Date(e).toISOString().split("T")[0],Eo=Date.now(),ko=wo(Eo-180*bo),So=wo(Eo-365*bo),Mo=wo(Eo-94608e6),Co={default:{id:"default",sort:[],color:[["==",["get","coef"],1],Te.PALETTE_4,[">=",["get","coef"],.75],Te.PALETTE_3,[">=",["get","coef"],.5],Te.PALETTE_2,[">=",["get","coef"],.25],Te.PALETTE_1,[">=",["get","coef"],.1],Te.PALETTE_1,Te.PALETTE_0]},age:{id:"age",sort:[["!",["any",["has","date"],["has","ts"]]],0,[">=",["coalesce",["get","date"],["get","ts"]],ko],50,[">=",["coalesce",["get","date"],["get","ts"]],So],49,[">=",["coalesce",["get","date"],["get","ts"]],Mo],48],color:[["!",["any",["has","date"],["has","ts"]]],Te.BASE,[">=",["coalesce",["get","date"],["get","ts"]],ko],Te.PALETTE_4,[">=",["coalesce",["get","date"],["get","ts"]],So],Te.PALETTE_3,[">=",["coalesce",["get","date"],["get","ts"]],Mo],Te.PALETTE_2,Te.PALETTE_1]},type:{id:"type",sort:[["!",["has","type"]],0,["==",["get","type"],"equirectangular"],50],color:[["!",["has","type"]],Te.BASE,["==",["get","type"],"equirectangular"],Te.QUALI_1,Te.QUALI_2]},score:{id:"score",sort:[["==",xo,5],80,["==",xo,4],65,["==",xo,3],50,["==",xo,2],35,["==",xo,1],20],color:[["==",xo,5],Pe[0].color,["==",xo,4],Pe[1].color,["==",xo,3],Pe[2].color,["==",xo,2],Pe[3].color,Pe[4].color]},gps:{id:"gps",sort:[["==",yo,5],80,["==",yo,4],65,["==",yo,3],50,["==",yo,2],35,["==",yo,1],20],color:[[">=",yo,Re[0].score],Re[0].color,["==",yo,Re[1].score],Re[1].color,["==",yo,Re[2].score],Re[2].color,Re[3].color]}};function To(e){const t=document.createElement("img");return Ue(uo,t),t.alt=e.loading,t.title=e.loading,t.classList.add("pnx-map-thumb","pnx-map-thumb-loader"),t}function Do(e){return null==e||Array.isArray(e)&&(2===e.length&&0===e[0]&&0===e[1]||e.length<2)}function Po(e){return"symbol"===e.type&&void 0!==e?.layout?.["text-field"]&&(void 0===e.minzoom||e.minzoom<15)}function Io(e){const t=e?.metadata?.["panoramax:fields"]||{};return t?.grid?.includes("logged_coef_360_pictures")&&t?.grid?.includes("logged_coef_flat_pictures")&&t?.grid?.includes("logged_coef")||!1}function Fo(e){const t=2===e.metadata?.["panoramax:tiles_version"],i=Object.keys(e.sources)[0],n="vector"===e.sources[i].type,a=n?Ao:_o;if(t)return e.layers.push({id:`${i}_sequences_plus`,type:"line",source:i,"source-layer":"sequences",layout:{...a.SEQUENCES_PLUS.layout},paint:{...a.SEQUENCES_PLUS.paint}}),e.layers;const r=[{id:`${i}_sequences`,type:"line",source:i,"source-layer":n?"sequences":void 0,layout:{...a.SEQUENCES.layout},paint:{...a.SEQUENCES.paint,"line-color":Te.BASE}},{id:`${i}_sequences_plus`,type:"line",source:i,"source-layer":n?"sequences":void 0,layout:{...a.SEQUENCES_PLUS.layout},paint:{...a.SEQUENCES_PLUS.paint}},{id:`${i}_pictures`,type:"circle",source:i,"source-layer":n?"pictures":void 0,layout:{...a.PICTURES.layout},paint:{...a.PICTURES.paint,"circle-color":Te.BASE}}];return e?.metadata?.["panoramax:fields"]?.grid&&r.push({id:`${i}_grid`,type:"circle",source:i,"source-layer":"grid",layout:{...a.GRID.layout},paint:{...a.GRID.paint}}),r}function zo(e){return!["default","metacatalog","",null,void 0].includes(e)}function Ro(e,t){if(Array.isArray(e))return e.map(e=>Ro(e,t));if("object"==typeof e&&null!==e){const i={};for(const n in e)i[n]=Ro(e[n],t);return i}return"string"==typeof e&&(e.startsWith("coef")||e.startsWith("logged_coef"))?t:e}function Lo(e){const t=t=>{Le(t.detail.picId)?(e.map.displayPictureMarker(),e?.isMapWide?.()&&e?.mini?.setAttribute("collapsed","")):(e.map.displayPictureMarker(t.detail.lon,t.detail.lat,e.psv.getXY().x,t.detail.first&&!Do(e._initParams?.getMapPostInit()?.center),t.detail.picId),e?.isMapWide?.()&&e?.mini?.removeAttribute("collapsed"))};e.psv.addEventListener("picture-loading",t),e.psv.addEventListener("picture-loaded",t),e.psv.addEventListener("picture-failed",t),e.psv.addEventListener("view-rotated",()=>{let t=nt(e.psv.getPosition().yaw);t+=e.psv.getPictureOriginalHeading(),e.map._picMarker.setRotation(t)}),e.psv.addEventListener("picture-preview-started",t=>{e.map._picMarkerPreview.setLngLat(t.detail.coordinates).setRotation(t.detail.direction||0).addTo(e.map)}),e.psv.addEventListener("picture-preview-stopped",()=>{e.map._picMarkerPreview.remove()}),e.psv.addEventListener("picture-loaded",t=>{e.isWidthSmall()&&e._picPopup&&t.detail.picId===e._picPopup._picId&&e._picPopup.remove()}),e.map.on("picture-click",t=>{e.select(t.seqId,t.picId),!e.psv._myVTour.state.currentNode&&e?._setFocus&&e._setFocus("pic")}),e.map.on("sequence-click",t=>{(e.getAPI?.()||e.api).getPicturesAroundCoordinates(t.coordinates.lat,t.coordinates.lng,.01,1,t.seqId).then(t=>{t?.features?.length>0&&(e.select(t.features[0]?.collection,t.features[0].id),!e.psv.getPictureMetadata()&&e?._setFocus&&e._setFocus("pic"))})}),e._setFocus&&(e.psv.addEventListener("dblclick",()=>{e.isMapWide()&&e._setFocus("pic")}),e.map.on("dblclick",()=>{e.isMapWide()?"any"===e.psv.getPicturesNavigation()&&e.select():e._setFocus("map")}),e.addEventListener("focus-changed",t=>{"map"!==t.detail.focus&&e.map._dropPreview()}))}function Bo(e){e.map.keyboard.keydown=function(t){if(t.altKey||t.ctrlKey||t.metaKey)return;switch(t.key){case"*":case"5":return void e.moveCenter();case"PageUp":case"9":return void e.psv.goToNextPicture();case"PageDown":case"3":return void e.psv.goToPrevPicture();case"Home":case"7":return t.stopPropagation(),void e._toggleFocus();case"End":case"1":return void e.mini.toggleAttribute("collapsed");case" ":case"0":return void e.psv.toggleSequencePlaying()}let i=0,n=0,a=0,r=0,s=0;switch(t.keyCode){case 61:case 107:case 171:case 187:i=1;break;case 189:case 109:case 173:i=-1;break;case 37:case 100:t.shiftKey?n=-1:(t.preventDefault(),r=-1);break;case 39:case 102:t.shiftKey?n=1:(t.preventDefault(),r=1);break;case 38:case 104:t.shiftKey?a=1:(t.preventDefault(),s=-1);break;case 40:case 98:t.shiftKey?a=-1:(t.preventDefault(),s=1);break;default:return}return this._rotationDisabled&&(n=0,a=0),{cameraAnimation:e=>{const o=this._tr;e.easeTo({duration:300,easeId:"keyboardHandler",easing:e=>e*(2-e),zoom:i?Math.round(o.zoom)+i*(t.shiftKey?2:1):o.zoom,bearing:o.bearing+n*this._bearingStep,pitch:o.pitch+a*this._pitchStep,offset:[-r*this._panStep,-s*this._panStep],center:o.center},{originalEvent:t})}}}.bind(e.map.keyboard)}const Oo="pnx-map-parameters";function Uo(){const e=localStorage.getItem(Oo);if(!e)return{};try{return JSON.parse(e)}catch(e){return console.warn("Can't read map parameters stored in localStorage",e),{}}}function No(e){const t=()=>localStorage.setItem(Oo,JSON.stringify({center:Object.fromEntries(Object.entries(e.getCenter()).map(([e,t])=>[e,t.toFixed(7)])),zoom:e.getZoom().toFixed(1),background:e._parent.mapStyleComposer.basemap,theme:e._parent.mapStyleComposer.panoramaxTheme,endpoint:e._parent.mapStyleComposer.panoramax}));e._parent.mapStyleComposer.addEventListener("filters-changed",t),e._parent.mapStyleComposer.addEventListener("theme-changed",t),e._parent.mapStyleComposer.addEventListener("basemap-changed",t),e._parent.mapStyleComposer.addEventListener("panoramax-changed",t),e.on("moveend",t),e.on("zoomend",t),e.on("dragend",t),e.on("boxzoomend",t)}var jo=Object.freeze({__proto__:null,MAP_EXPR_QUALITYSCORE:xo,MAP_EXPR_QUALITYSCORE_GPS:yo,MAP_THEMES_STYLES:Co,RASTER_LAYER_ID:ho,TILES_PICTURES_SYMBOL_ZOOM:19,TILES_PICTURES_ZOOM:po,VECTOR_STYLES:Ao,VECTOR_STYLES_NOCROWD:_o,getMapParamsFromLocalStorage:Uo,getPanoramaxLayers:Fo,getThumbGif:To,hasStyleLoggedGridStats:Io,initMapKeyboardHandler:Bo,isLabelLayer:Po,isNullCoordinates:Do,isPanoramaxEndpointSingleUser:zo,linkMapAndPhoto:Lo,mapFiltersFormValues:function(e,t,i){const n=e?.shadowRoot.getElementById("pnx-filter-date-from"),a=e?.shadowRoot.getElementById("pnx-filter-date-end"),r=e?.shadowRoot.querySelectorAll("input[name='pnx-filter-type']"),s=e?.shadowRoot.getElementById("pnx-pictures-source");let o="";for(let e=0;e<r.length;e++){const t=r[e];if(t.checked){o=t.value;break}}let l=[],c=[];if(i){const t=e?.shadowRoot.getElementById("pnx-filter-qualityscore");l=(t?.grade||"").split(",").map(e=>parseInt(e)).filter(e=>!isNaN(e));const i=e?.shadowRoot.getElementById("pnx-filter-gps");c=(i?.grade||"").split(",").map(e=>parseInt(e)).filter(e=>!isNaN(e))}return{minDate:n?.value,maxDate:a?.value,pic_type:o,theme:t?.value,qualityscore:l,gps:c,source:s?.checked?"local":"metacatalog"}},mapFiltersToLayersFilters:function(e,t=!1,i=null){let n={},a=[],r=[],s=!1;if(e.minDate&&""!==e.minDate&&(n.minDate=e.minDate,a.push([">=",["get","date"],e.minDate]),r.push([">=",["get","ts"],e.minDate])),e.maxDate&&""!==e.maxDate){n.maxDate=e.maxDate,a.push(["<=",["get","date"],e.maxDate]);let t=new Date(e.maxDate);t.setDate(t.getDate()+1),t=t.toISOString().split("T")[0],r.push(["<=",["get","ts"],t])}if(e.pic_type&&""!==e.pic_type&&(n.pic_type="flat"===e.pic_type?"flat":"equirectangular",a.push(["==",["get","type"],n.pic_type]),r.push(["==",["get","type"],n.pic_type])),t&&(s=!0),e.camera&&""!==e.camera){n.camera=e.camera;const t=e.camera.toLowerCase().trim()+" ",i=e.camera.toLowerCase().trim()+"zzzzzzzzzzzzzzzzzzzz",s=["collator",{"case-sensitive":!1,"diacritic-sensitive":!1}];a.push([">=",["get","model"],t,s]),a.push(["<=",["get","model"],i,s]),r.push([">=",["get","model"],t,s]),r.push(["<=",["get","model"],i,s])}return e.qualityscore&&e.qualityscore.length>0&&(n.qualityscore=e.qualityscore,a.push(["in",xo,["literal",n.qualityscore]]),r.push(["in",xo,["literal",n.qualityscore]])),e.gps&&e.gps.length>0&&(n.gps=e.gps,a.push(["in",yo,["literal",n.gps]]),r.push(["in",yo,["literal",n.gps]])),e.theme&&Co[e.theme]&&(n.theme=e.theme,s=!0),i?.pictures&&i.pictures.features?.length>=0&&("keep"===i.pictures.rule?r.push(["in",["get","id"],["literal",i.pictures.features]]):i.pictures.features.length>0&&r.push(["!",["in",["get","id"],["literal",i.pictures.features]]])),i?.sequences&&i.sequences.features?.length>=0&&("keep"===i.sequences.rule?a.push(["in",["get","id"],["literal",i.sequences.features]]):i.sequences.features.length>0&&a.push(["!",["in",["get","id"],["literal",i.sequences.features]]])),0===a.length?a=null:a.unshift("all"),0===r.length?r=null:(r.unshift("all"),r=["step",["zoom"],!0,po,r]),{mapFilters:n,mapSeqFilters:a,mapPicFilters:r,reloadMapStyle:s}},saveMapParamsToLocalStorage:No,switchCoefValue:Ro});function Vo(e,t,i,n){let a=n;const r=t+(i-t>>1);let s,o=i-t;const l=e[t],c=e[t+1],u=e[i],h=e[i+1];for(let n=t+3;n<i;n+=3){const t=qo(e[n],e[n+1],l,c,u,h);if(t>a)s=n,a=t;else if(t===a){const e=Math.abs(n-r);e<o&&(s=n,o=e)}}a>n&&(s-t>3&&Vo(e,t,s,n),e[s+2]=a,i-s>3&&Vo(e,s,i,n))}function qo(e,t,i,n,a,r){let s=a-i,o=r-n;if(0!==s||0!==o){const l=((e-i)*s+(t-n)*o)/(s*s+o*o);l>1?(i=a,n=r):l>0&&(i+=s*l,n+=o*l)}return s=e-i,o=t-n,s*s+o*o}function Go(e,t,i,n){const a={type:t,geom:i},r={id:null==e?null:e,type:a.type,geometry:a.geom,tags:n,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};switch(a.type){case"Point":case"MultiPoint":Wo(r,a.geom);break;case"LineString":Wo(r,a.geom.points);break;case"Polygon":Wo(r,a.geom[0].points);break;case"MultiLineString":for(const e of a.geom)Wo(r,e.points);break;case"MultiPolygon":for(const e of a.geom)Wo(r,e[0].points)}return r}function Ho(e){const t=e;e.points.length>64&&(t.points=new Float64Array(e.points))}function Wo(e,t){for(let i=0;i<t.length;i+=3)e.minX=Math.min(e.minX,t[i]),e.minY=Math.min(e.minY,t[i+1]),e.maxX=Math.max(e.maxX,t[i]),e.maxY=Math.max(e.maxY,t[i+1])}function Zo(e,t){const i=[];switch(e.type){case"FeatureCollection":for(let n=0;n<e.features.length;n++)Ko(i,e.features[n],t,n);break;case"Feature":Ko(i,e,t);break;default:Ko(i,{geometry:e,properties:void 0},t)}return i}function Ko(e,t,i,n,a=0){if(!t.geometry)return;if(a>1024)throw new Error("GeometryCollection nesting exceeds supported depth: 1024");if("GeometryCollection"===t.geometry.type)return void function(e,t,i,n,a,r=0){for(const s of i.geometries)Ko(e,{id:t.id,geometry:s,properties:t.properties},n,a,r)}(e,t,t.geometry,i,n,a+1);if(!t.geometry.coordinates?.length)return;const r=function(e,t,i){return t.promoteId?e.properties?.[t.promoteId]:t.generateId?i||0:e.id}(t,i,n),s=Math.pow(i.tolerance/((1<<i.maxZoom)*i.extent),2);switch(t.geometry.type){case"Point":return void function(e,t,i,n){const a=[];a.push(Yo(i.coordinates[0]),Jo(i.coordinates[1]),0),e.push(Go(t,"Point",a,n))}(e,r,t.geometry,t.properties);case"MultiPoint":return void function(e,t,i,n){const a=[];for(const e of i.coordinates)a.push(Yo(e[0]),Jo(e[1]),0);e.push(Go(t,"MultiPoint",a,n))}(e,r,t.geometry,t.properties);case"LineString":return void function(e,t,i,n,a){const r={points:[]};Xo(i.coordinates,r,n,!1),e.push(Go(t,"LineString",r,a))}(e,r,t.geometry,s,t.properties);case"MultiLineString":return void function(e,t,i,n,a,r){if(a.lineMetrics)for(const a of i.coordinates){const i={points:[]};Xo(a,i,n,!1),e.push(Go(t,"LineString",i,r))}else{const a=[];Qo(i.coordinates,a,n,!1),e.push(Go(t,"MultiLineString",a,r))}}(e,r,t.geometry,s,i,t.properties);case"Polygon":return void function(e,t,i,n,a){const r=[];Qo(i.coordinates,r,n,!0),e.push(Go(t,"Polygon",r,a))}(e,r,t.geometry,s,t.properties);case"MultiPolygon":return void function(e,t,i,n,a){const r=[];for(const e of i.coordinates){const t=[];Qo(e,t,n,!0),r.push(t)}e.push(Go(t,"MultiPolygon",r,a))}(e,r,t.geometry,s,t.properties);default:throw new Error("Input data is not a valid GeoJSON object.")}}function Xo(e,t,i,n){let a,r,s=0;for(let i=0;i<e.length;i++){const o=Yo(e[i][0]),l=Jo(e[i][1]);t.points.push(o,l,0),i>0&&(s+=n?(a*l-o*r)/2:Math.sqrt(Math.pow(o-a,2)+Math.pow(l-r,2))),a=o,r=l}const o=t.points.length-3;t.points[2]=1,i>0&&Vo(t.points,0,o,i),t.points[o+2]=1,Ho(t),t.size=Math.abs(s),t.start=0,t.end=t.size}function Qo(e,t,i,n){for(let a=0;a<e.length;a++){const r={points:[]};Xo(e[a],r,i,n),t.push(r)}}function Yo(e){return e/360+.5}function Jo(e){const t=Math.sin(e*Math.PI/180),i=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return i<0?0:i>1?1:i}function $o(e){const t={type:"Feature",geometry:el(e),properties:e.tags};return null!=e.id&&(t.id=e.id),t}function el(e){const{type:t,geometry:i}=e;switch(t){case"Point":return{type:t,coordinates:il(i[0],i[1])};case"MultiPoint":return{type:t,coordinates:tl(i)};case"LineString":return{type:t,coordinates:tl(i.points)};case"MultiLineString":case"Polygon":return{type:t,coordinates:i.map(e=>tl(e.points))};case"MultiPolygon":return{type:t,coordinates:i.map(e=>e.map(e=>tl(e.points)))}}}function tl(e){const t=[];for(let i=0;i<e.length;i+=3)t.push(il(e[i],e[i+1]));return t}function il(e,t){return[nl(e),al(t)]}function nl(e){return 360*(e-.5)}function al(e){const t=(180-360*e)*Math.PI/180;return 360*Math.atan(Math.exp(t))/Math.PI-90}function rl(e,t,i,n,a,r,s,o){if(n/=t,r>=(i/=t)&&s<n)return e;if(s<i||r>=n)return null;const l=[];for(const t of e){const e=0===a?t.minX:t.minY,r=0===a?t.maxX:t.maxY;if(e>=i&&r<n)l.push(t);else if(!(r<i||e>=n))switch(t.type){case"Point":case"MultiPoint":sl(t,l,i,n,a);continue;case"LineString":ol(t,l,i,n,a,o);continue;case"MultiLineString":ll(t,l,i,n,a);continue;case"Polygon":cl(t,l,i,n,a);continue;case"MultiPolygon":ul(t,l,i,n,a);continue}}return l.length?l:null}function sl(e,t,i,n,a){const r=[];if(function(e,t,i,n,a){for(let r=0;r<e.length;r+=3){const s=e[r+a];s>=i&&s<=n&&ml(t,e[r],e[r+1],e[r+2])}}(e.geometry,r,i,n,a),!r.length)return;const s=3===r.length?"Point":"MultiPoint";t.push(Go(e.id,s,r,e.tags))}function ol(e,t,i,n,a,r){const s=[];if(hl(e.geometry,s,i,n,a,!1,r.lineMetrics),s.length)if(r.lineMetrics)for(const i of s)t.push(Go(e.id,"LineString",i,e.tags));else s.length>1?t.push(Go(e.id,"MultiLineString",s,e.tags)):t.push(Go(e.id,"LineString",s[0],e.tags))}function ll(e,t,i,n,a){const r=[];pl(e.geometry,r,i,n,a,!1),r.length&&(1!==r.length?t.push(Go(e.id,"MultiLineString",r,e.tags)):t.push(Go(e.id,"LineString",r[0],e.tags)))}function cl(e,t,i,n,a){const r=[];pl(e.geometry,r,i,n,a,!0),r.length&&t.push(Go(e.id,"Polygon",r,e.tags))}function ul(e,t,i,n,a){const r=[];for(const t of e.geometry){const e=[];pl(t,e,i,n,a,!0),e.length&&r.push(e)}r.length&&t.push(Go(e.id,"MultiPolygon",r,e.tags))}function hl(e,t,i,n,a,r,s){let o=dl(e);const l=0===a?gl:fl;let c,u,h=e.start;for(let d=0;d<e.points.length-3;d+=3){const p=e.points[d],m=e.points[d+1],g=e.points[d+2],f=e.points[d+3],A=e.points[d+4],_=0===a?p:m,v=0===a?f:A;let y=!1;s&&(c=Math.sqrt(Math.pow(p-f,2)+Math.pow(m-A,2))),_<i?v>i&&(u=l(o,p,m,f,A,i),s&&(o.start=h+c*u)):_>n?v<n&&(u=l(o,p,m,f,A,n),s&&(o.start=h+c*u)):ml(o.points,p,m,g),v<i&&_>=i&&(u=l(o,p,m,f,A,i),y=!0),v>n&&_<=n&&(u=l(o,p,m,f,A,n),y=!0),!r&&y&&(s&&(o.end=h+c*u),t.push(o),o=dl(e)),s&&(h+=c)}let d=e.points.length-3;const p=e.points[d],m=e.points[d+1],g=e.points[d+2],f=0===a?p:m;f>=i&&f<=n&&ml(o.points,p,m,g),d=o.points.length-3,r&&d>=3&&(o.points[d]!==o.points[0]||o.points[d+1]!==o.points[1])&&ml(o.points,o.points[0],o.points[1],o.points[2]),o.points.length&&(Ho(o),t.push(o))}function dl(e){return{points:[],size:e.size,start:e.start,end:e.end}}function pl(e,t,i,n,a,r){for(const s of e)hl(s,t,i,n,a,r,!1)}function ml(e,t,i,n){e.push(t,i,n)}function gl(e,t,i,n,a,r){const s=(r-t)/(n-t);return ml(e.points,r,i+(a-i)*s,1),s}function fl(e,t,i,n,a,r){const s=(r-i)/(a-i);return ml(e.points,t+(n-t)*s,r,1),s}function Al(e,t){const i=t.buffer/t.extent;let n=e;const a=rl(e,1,-1-i,i,0,-1,2,t),r=rl(e,1,1-i,2+i,0,-1,2,t);return a||r?(n=rl(e,1,-i,1+i,0,-1,2,t)||[],a&&(n=_l(a,1).concat(n)),r&&(n=n.concat(_l(r,-1))),n):n}function _l(e,t){const i=[];for(const n of e)switch(n.type){case"Point":case"MultiPoint":{const e=vl(n.geometry,t);i.push(Go(n.id,n.type,e,n.tags));continue}case"LineString":{const e=yl(n.geometry,t);i.push(Go(n.id,n.type,e,n.tags));continue}case"MultiLineString":case"Polygon":{const e=[];for(const i of n.geometry)e.push(yl(i,t));i.push(Go(n.id,n.type,e,n.tags));continue}case"MultiPolygon":{const e=[];for(const i of n.geometry){const n=[];for(const e of i)n.push(yl(e,t));e.push(n)}i.push(Go(n.id,n.type,e,n.tags));continue}}return i}function vl(e,t){const i=[];for(let n=0;n<e.length;n+=3)i.push(e[n]+t,e[n+1],e[n+2]);return i}function yl(e,t){const i={points:[],size:e.size};void 0!==e.start&&(i.start=e.start,i.end=e.end);for(let n=0;n<e.points.length;n+=3)i.points.push(e.points[n]+t,e.points[n+1],e.points[n+2]);return Ho(i),i}function xl(e,t,i){const n=function(e,t){return e?{removeAll:e.removeAll,remove:new Set(e.remove||[]),add:new Map(e.add?.map(e=>[t.promoteId?e.properties[t.promoteId]:e.id,e])),update:new Map(e.update?.map(e=>[e.id,e]))}:{remove:new Set,add:new Map,update:new Map}}(t,i);let a=[];if(n.removeAll&&(a=e,e=[]),n.remove.size||n.add.size){const t=[];for(const i of e)(n.remove.has(i.id)||n.add.has(i.id))&&t.push(i);if(t.length){a=a.concat(t);const i=new Set(t.map(e=>e.id));e=e.filter(e=>!i.has(e.id))}if(n.add.size){let t=Zo({type:"FeatureCollection",features:Array.from(n.add.values())},i);t=Al(t,i),a=a.concat(t),e=e.concat(t)}}if(n.update.size){const t=new Map;let r=[];for(const i of e)n.update.has(i.id)?t.set(i.id,[...t.get(i.id)||[],i]):r.push(i);for(const[e,s]of n.update){const n=t.get(e);if(!n||0===n.length)continue;const o=bl(n,s,i);a=a.concat(n,o),r=r.concat(o)}e=r}return{affected:a,source:e}}function bl(e,t,i){const n=!!t.newGeometry,a=t.removeAllProperties||t.removeProperties?.length>0||t.addOrUpdateProperties?.length>0;if(n){const n=e[0];let r=Zo({type:"FeatureCollection",features:[{type:"Feature",id:n.id,geometry:t.newGeometry,properties:a?wl(n.tags,t):n.tags}]},i);return r=Al(r,i),r}if(a){const i=[];for(const n of e){const e={...n};e.tags=wl(e.tags,t),i.push(e)}return i}return e}function wl(e,t){if(t.removeAllProperties)return{};const i={...e||{}};if(t.removeProperties)for(const e of t.removeProperties)delete i[e];if(t.addOrUpdateProperties)for(const{key:e,value:n}of t.addOrUpdateProperties)i[e]=n;return i}const El=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],kl=new Uint32Array(96);var Sl=class e{static from(t){if(!t||void 0===t.byteLength||t.buffer)throw new Error("Data must be an instance of ArrayBuffer or SharedArrayBuffer.");const[i,n]=new Uint8Array(t,0,2);if(219!==i)throw new Error("Data does not appear to be in a KDBush format.");const a=n>>4;if(1!==a)throw new Error(`Got v${a} data when expected v1.`);const r=El[15&n];if(!r)throw new Error("Unrecognized array type.");const[s]=new Uint16Array(t,2,1),[o]=new Uint32Array(t,4,1);return new e(o,s,r,void 0,t)}constructor(e,t=64,i=Float64Array,n=ArrayBuffer,a){if(isNaN(e)||e<0)throw new Error(`Unexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+t,2),65535),this.ArrayType=i,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;const r=El.indexOf(this.ArrayType),s=2*e*this.ArrayType.BYTES_PER_ELEMENT,o=e*this.IndexArrayType.BYTES_PER_ELEMENT,l=(8-o%8)%8;if(r<0)throw new Error(`Unexpected typed array class: ${i}.`);if(a)this.data=a,this.ids=new this.IndexArrayType(a,8,e),this.coords=new i(a,8+o+l,2*e),this._pos=2*e,this._finished=!0;else{const a=this.data=new n(8+s+o+l);this.ids=new this.IndexArrayType(a,8,e),this.coords=new i(a,8+o+l,2*e),this._pos=0,this._finished=!1,new Uint8Array(a,0,2).set([219,16+r]),new Uint16Array(a,2,1)[0]=t,new Uint32Array(a,4,1)[0]=e}}add(e,t){const i=this._pos>>1;return this.ids[i]=i,this.coords[this._pos++]=e,this.coords[this._pos++]=t,i}finish(){const e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return Ml(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,t,i,n){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:a,coords:r,nodeSize:s}=this;kl[0]=0,kl[1]=a.length-1,kl[2]=0;let o=3;const l=[];for(;o>0;){const c=kl[--o],u=kl[--o],h=kl[--o];if(u-h<=s){for(let s=h;s<=u;s++){const o=r[2*s],c=r[2*s+1];o>=e&&o<=i&&c>=t&&c<=n&&l.push(a[s])}continue}const d=h+u>>1,p=r[2*d],m=r[2*d+1];p>=e&&p<=i&&m>=t&&m<=n&&l.push(a[d]),(0===c?e<=p:t<=m)&&(kl[o++]=h,kl[o++]=d-1,kl[o++]=1-c),(0===c?i>=p:n>=m)&&(kl[o++]=d+1,kl[o++]=u,kl[o++]=1-c)}return l}within(e,t,i){const n=[];return this.withinInto(e,t,i,n),n}withinInto(e,t,i,n){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:a,coords:r,nodeSize:s}=this;kl[0]=0,kl[1]=a.length-1,kl[2]=0;let o=3,l=0;const c=i*i;for(;o>0;){const u=kl[--o],h=kl[--o],d=kl[--o];if(h-d<=s){for(let i=d;i<=h;i++)Pl(r[2*i],r[2*i+1],e,t)<=c&&(n[l++]=a[i]);continue}const p=d+h>>1,m=r[2*p],g=r[2*p+1];Pl(m,g,e,t)<=c&&(n[l++]=a[p]),(0===u?e-i<=m:t-i<=g)&&(kl[o++]=d,kl[o++]=p-1,kl[o++]=1-u),(0===u?e+i>=m:t+i>=g)&&(kl[o++]=p+1,kl[o++]=h,kl[o++]=1-u)}return l}};function Ml(e,t,i,n,a,r){if(a-n<=i)return;const s=n+a>>1;Cl(e,t,s,n,a,r),Ml(e,t,i,n,s-1,1-r),Ml(e,t,i,s+1,a,1-r)}function Cl(e,t,i,n,a,r){for(;a>n;){if(a-n>600){const s=a-n+1,o=i-n+1,l=Math.log(s),c=.5*Math.exp(2*l/3),u=.5*Math.sqrt(l*c*(s-c)/s)*(o-s/2<0?-1:1);Cl(e,t,i,Math.max(n,Math.floor(i-o*c/s+u)),Math.min(a,Math.floor(i+(s-o)*c/s+u)),r)}const s=t[2*i+r];let o=n,l=a;for(Tl(e,t,n,i),t[2*a+r]>s&&Tl(e,t,n,a);o<l;){for(Tl(e,t,o,l),o++,l--;t[2*o+r]<s;)o++;for(;t[2*l+r]>s;)l--}t[2*n+r]===s?Tl(e,t,n,l):(l++,Tl(e,t,l,a)),l<=i&&(n=l+1),i<=l&&(a=l-1)}}function Tl(e,t,i,n){Dl(e,i,n),Dl(t,2*i,2*n),Dl(t,2*i+1,2*n+1)}function Dl(e,t,i){const n=e[t];e[t]=e[i],e[i]=n}function Pl(e,t,i,n){const a=e-i,r=t-n;return a*a+r*r}const Il={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:e=>e};var Fl=class{constructor(e){this.options=Object.assign(Object.create(Il),e),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[],this.points=[]}load(e){const t=[];for(const i of e){if(!i.geometry)continue;const[e,n]=i.geometry.coordinates,[a,r]=[Yo(e),Jo(n)],s={id:i.id,type:"Point",geometry:[a,r],tags:i.properties};t.push(s)}this.createIndex(t)}initialize(e){const t=[];for(const i of e)"Point"===i.type&&t.push(i);this.createIndex(t)}updateIndex(e,t,i){this.options=Object.assign(Object.create(Il),i.clusterOptions),this.initialize(e)}createIndex(e){const{log:t,minZoom:i,maxZoom:n}=this.options;t&&console.time("total time");const a=`prepare ${e.length} points`;t&&console.time(a),this.points=e;const r=[];for(let t=0;t<e.length;t++){const i=e[t];if(!i?.geometry)continue;let[n,a]=i.geometry;n=Math.fround(n),a=Math.fround(a),r.push(n,a,1/0,t,-1,1),this.options.reduce&&r.push(0)}let s=this.trees[n+1]=this.createTree(r);t&&console.timeEnd(a);for(let e=n;e>=i;e--){const i=Date.now();s=this.trees[e]=this.createTree(this.cluster(s,e)),t&&console.log("z%d: %d clusters in %dms",e,s.numItems,Date.now()-i)}t&&console.timeEnd("total time")}getClusters(e,t){return this.getClustersInternal(e,t).map(e=>$o(e))}getClustersInternal(e,t){let i=((e[0]+180)%360+360)%360-180;const n=Math.max(-90,Math.min(90,e[1]));let a=180===e[2]?180:((e[2]+180)%360+360)%360-180;const r=Math.max(-90,Math.min(90,e[3]));if(e[2]-e[0]>=360)i=-180,a=180;else if(i>a){const e=this.getClustersInternal([i,n,180,r],t),s=this.getClustersInternal([-180,n,a,r],t);return e.concat(s)}const s=this.trees[this.limitZoom(t)],o=s.range(Yo(i),Jo(r),Yo(a),Jo(n)),l=s.flatData,c=[];for(const e of o){const t=this.stride*e;c.push(l[t+5]>1?zl(l,t,this.clusterProps):this.points[l[t+3]])}return c}getChildren(e){const t=this.getOriginId(e),i=this.getOriginZoom(e),n=new Error("No cluster with the specified id: "+e),a=this.trees[i];if(!a)throw n;const r=a.flatData;if(t*this.stride>=r.length)throw n;const s=this.options.radius/(this.options.extent*Math.pow(2,i-1)),o=r[t*this.stride],l=r[t*this.stride+1],c=a.within(o,l,s),u=[];for(const t of c){const i=t*this.stride;r[i+4]===e&&u.push(r[i+5]>1?Rl(r,i,this.clusterProps):$o(this.points[r[i+3]]))}if(0===u.length)throw n;return u}getLeaves(e,t,i){t=t||10,i=i||0;const n=[];return this.appendLeaves(n,e,t,i,0),n}getTile(e,t,i){const n=this.trees[this.limitZoom(e)];if(!n)return null;const a=Math.pow(2,e),{extent:r,radius:s}=this.options,o=s/r,l=(i-o)/a,c=(i+1+o)/a,u={transformed:!0,features:[],source:null,x:t,y:i,z:e};return this.addTileFeatures(n.range((t-o)/a,l,(t+1+o)/a,c),n.flatData,t,i,a,u),0===t&&this.addTileFeatures(n.range(1-o/a,l,1,c),n.flatData,a,i,a,u),t===a-1&&this.addTileFeatures(n.range(0,l,o/a,c),n.flatData,-1,i,a,u),u}getClusterExpansionZoom(e){return this.getOriginZoom(e)}appendLeaves(e,t,i,n,a){const r=this.getChildren(t);for(const t of r){const r=t.properties;if(r?.cluster?a+r.point_count<=n?a+=r.point_count:a=this.appendLeaves(e,r.cluster_id,i,n,a):a<n?a++:e.push(t),e.length===i)break}return a}createTree(e){const t=new Sl(e.length/this.stride|0,this.options.nodeSize,Float32Array);for(let i=0;i<e.length;i+=this.stride)t.add(e[i],e[i+1]);return t.finish(),t.flatData=e,t.data=null,t}addTileFeatures(e,t,i,n,a,r){for(const s of e){const e=s*this.stride,o=t[e+5]>1;let l,c,u;if(o)l=Ll(t,e,this.clusterProps),c=t[e],u=t[e+1];else{const i=this.points[t[e+3]];l=i.tags,[c,u]=i.geometry}const h={type:1,geometry:[[Math.round(this.options.extent*(c*a-i)),Math.round(this.options.extent*(u*a-n))]],tags:l};let d;d=o||this.options.generateId?t[e+3]:this.points[t[e+3]].id,void 0!==d&&(h.id=d),r.features.push(h)}}limitZoom(e){return Math.max(this.options.minZoom,Math.min(Math.floor(+e),this.options.maxZoom+1))}cluster(e,t){const{radius:i,extent:n,reduce:a,minPoints:r}=this.options,s=i/(n*Math.pow(2,t)),o=e.flatData,l=[],c=this.stride;for(let i=0;i<o.length;i+=c){if(o[i+2]<=t)continue;o[i+2]=t;const n=o[i],u=o[i+1],h=e.within(o[i],o[i+1],s),d=o[i+5];let p=d;for(const e of h){const i=e*c;o[i+2]>t&&(p+=o[i+5])}if(p>d&&p>=r){let e,r=n*d,s=u*d,m=-1;const g=(i/c<<5)+(t+1)+this.points.length;for(const n of h){const l=n*c;if(o[l+2]<=t)continue;o[l+2]=t;const u=o[l+5];r+=o[l]*u,s+=o[l+1]*u,o[l+4]=g,a&&(e||(e=this.map(o,i,!0),m=this.clusterProps.length,this.clusterProps.push(e)),a(e,this.map(o,l)))}o[i+4]=g,l.push(r/p,s/p,1/0,g,-1,p),a&&l.push(m)}else{for(let e=0;e<c;e++)l.push(o[i+e]);if(p>1)for(const e of h){const i=e*c;if(!(o[i+2]<=t)){o[i+2]=t;for(let e=0;e<c;e++)l.push(o[i+e])}}}}return l}getOriginId(e){return e-this.points.length>>5}getOriginZoom(e){return(e-this.points.length)%32}map(e,t,i){if(e[t+5]>1){const n=this.clusterProps[e[t+6]];return i?Object.assign({},n):n}const n=this.points[e[t+3]].tags,a=this.options.map(n);return i&&a===n?Object.assign({},a):a}};function zl(e,t,i){return{id:e[t+3],type:"Point",tags:Ll(e,t,i),geometry:[e[t],e[t+1]]}}function Rl(e,t,i){return{type:"Feature",id:e[t+3],properties:Ll(e,t,i),geometry:{type:"Point",coordinates:[nl(e[t]),al(e[t+1])]}}}function Ll(e,t,i){const n=e[t+5],a=n>=1e4?`${Math.round(n/1e3)}k`:n>=1e3?Math.round(n/100)/10+"k":n,r=e[t+6],s=-1===r?{}:Object.assign({},i[r]);return Object.assign(s,{cluster:!0,cluster_id:e[t+3],point_count:n,point_count_abbreviated:a})}const Bl="geojsonvt_clip_start",Ol="geojsonvt_clip_end";function Ul(e,t,i,n,a){const r=t===a.maxZoom?0:a.tolerance/((1<<t)*a.extent),s={transformed:!1,features:[],source:null,x:i,y:n,z:t,minX:2,minY:1,maxX:-1,maxY:0,numPoints:0,numSimplified:0,numFeatures:e.length};for(const t of e)Nl(s,t,r,a);return s}function Nl(e,t,i,n){switch(e.minX=Math.min(e.minX,t.minX),e.minY=Math.min(e.minY,t.minY),e.maxX=Math.max(e.maxX,t.maxX),e.maxY=Math.max(e.maxY,t.maxY),t.type){case"Point":case"MultiPoint":return void function(e,t){const i=[];for(let n=0;n<t.geometry.length;n+=3)i.push(t.geometry[n],t.geometry[n+1]),e.numPoints++,e.numSimplified++;if(!i.length)return;const n={type:1,tags:t.tags||null,geometry:i};null!==t.id&&(n.id=t.id);e.features.push(n)}(e,t);case"LineString":return void function(e,t,i,n){const a=[];if(jl(a,t.geometry,e,i,!1,!1),!a.length)return;let r=t.tags||null;if(n.lineMetrics){r={};for(const e in t.tags)r[e]=t.tags[e];r[Bl]=t.geometry.start/t.geometry.size,r[Ol]=t.geometry.end/t.geometry.size}const s={type:2,tags:r,geometry:a};null!==t.id&&(s.id=t.id);e.features.push(s)}(e,t,i,n);case"MultiLineString":case"Polygon":return void function(e,t,i){const n=[];for(let a=0;a<t.geometry.length;a++)jl(n,t.geometry[a],e,i,"Polygon"===t.type,0===a);if(!n.length)return;const a={type:"Polygon"===t.type?3:2,tags:t.tags||null,geometry:n};null!==t.id&&(a.id=t.id);e.features.push(a)}(e,t,i);case"MultiPolygon":return void function(e,t,i){const n=[];for(let a=0;a<t.geometry.length;a++){const r=t.geometry[a];for(let t=0;t<r.length;t++)jl(n,r[t],e,i,!0,0===t)}if(!n.length)return;const a={type:3,tags:t.tags||null,geometry:n};null!==t.id&&(a.id=t.id);e.features.push(a)}(e,t,i)}}function jl(e,t,i,n,a,r){const s=n*n;if(n>0&&t.size<(a?s:n))return void(i.numPoints+=t.points.length/3);const o=[];for(let e=0;e<t.points.length;e+=3)(0===n||t.points[e+2]>s)&&(i.numSimplified++,o.push(t.points[e],t.points[e+1])),i.numPoints++;a&&function(e,t){let i=0;for(let t=0,n=e.length,a=n-2;t<n;a=t,t+=2)i+=(e[t]-e[a])*(e[t+1]+e[a+1]);if(i>0!==t)return;for(let t=0,i=e.length;t<i/2;t+=2){const n=e[t],a=e[t+1];e[t]=e[i-2-t],e[t+1]=e[i-1-t],e[i-2-t]=n,e[i-1-t]=a}}(o,r),e.push(o)}function Vl(e,t){if(e.transformed)return e;const i=1<<e.z,n=e.x,a=e.y;for(const r of e.features)1===r.type?ql(r,t,i,n,a):Gl(r,t,i,n,a);return e.transformed=!0,e}function ql(e,t,i,n,a){const r=e,s=e.geometry,o=[];for(let e=0;e<s.length;e+=2)o.push(Hl(s[e],s[e+1],t,i,n,a));return r.geometry=o,r}function Gl(e,t,i,n,a){const r=e,s=e.geometry,o=[];for(const e of s){const r=[];for(let s=0;s<e.length;s+=2)r.push(Hl(e[s],e[s+1],t,i,n,a));o.push(r)}return r.geometry=o,r}function Hl(e,t,i,n,a,r){return[Math.round(i*(e*n-a)),Math.round(i*(t*n-r))]}var Wl=class{constructor(e){this.options=e,this.total=0,this.stats={},this.tiles={},this.tileCoords=[],this.stats={},this.total=0}initialize(e){this.splitTile(e,0,0,0),this.options.debug&&(e.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)))}updateIndex(e,t,i){i.debug>1&&(console.log("invalidating tiles"),console.time("invalidating")),this.invalidateTiles(t),i.debug>1&&console.timeEnd("invalidating");const[n,a,r]=[0,0,0],s=Ul(e,n,a,r,i);s.source=e;const o=Zl(n,a,r);if(this.tiles[o]=s,this.tileCoords.push({z:n,x:a,y:r,id:o}),i.debug){const e=`z${n}`;this.stats[e]=(this.stats[e]||0)+1,this.total++}}getClusterExpansionZoom(e){return null}getChildren(e){return null}getLeaves(e,t,i){return null}getTile(e,t,i){const{extent:n,debug:a}=this.options,r=1<<e,s=Zl(e,t=t+r&r-1,i);if(this.tiles[s])return Vl(this.tiles[s],n);a>1&&console.log("drilling down to z%d-%d-%d",e,t,i);let o,l=e,c=t,u=i;for(;!o&&l>0;)l--,c>>=1,u>>=1,o=this.tiles[Zl(l,c,u)];return o?.source?(a>1&&(console.log("found parent tile z%d-%d-%d",l,c,u),console.time("drilling down")),this.splitTile(o.source,l,c,u,e,t,i),a>1&&console.timeEnd("drilling down"),this.tiles[s]?Vl(this.tiles[s],n):null):null}splitTile(e,t,i,n,a,r,s){const o=[e,t,i,n],l=this.options,c=l.debug;for(;o.length;){n=o.pop(),i=o.pop(),t=o.pop(),e=o.pop();const u=1<<t,h=Zl(t,i,n);let d=this.tiles[h];if(!d&&(c>1&&console.time("creation"),d=this.tiles[h]=Ul(e,t,i,n,l),this.tileCoords.push({z:t,x:i,y:n,id:h}),c)){c>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",t,i,n,d.numFeatures,d.numPoints,d.numSimplified),console.timeEnd("creation"));const e=`z${t}`;this.stats[e]=(this.stats[e]||0)+1,this.total++}if(d.source=e,null==a){if(t===l.indexMaxZoom||d.numPoints<=l.indexMaxPoints)continue}else{if(t===l.maxZoom||t===a)continue;if(null!=a){const e=a-t;if(i!==r>>e||n!==s>>e)continue}}if(d.source=null,!e.length)continue;c>1&&console.time("clipping");const p=.5*l.buffer/l.extent,m=.5-p,g=.5+p,f=1+p;let A=null,_=null,v=null,y=null;const x=rl(e,u,i-p,i+g,0,d.minX,d.maxX,l),b=rl(e,u,i+m,i+f,0,d.minX,d.maxX,l);x&&(A=rl(x,u,n-p,n+g,1,d.minY,d.maxY,l),_=rl(x,u,n+m,n+f,1,d.minY,d.maxY,l)),b&&(v=rl(b,u,n-p,n+g,1,d.minY,d.maxY,l),y=rl(b,u,n+m,n+f,1,d.minY,d.maxY,l)),c>1&&console.timeEnd("clipping"),o.push(A||[],t+1,2*i,2*n),o.push(_||[],t+1,2*i,2*n+1),o.push(v||[],t+1,2*i+1,2*n),o.push(y||[],t+1,2*i+1,2*n+1)}}invalidateTiles(e){if(!e.length)return;const t=this.options,{debug:i}=t;let n=1/0,a=-1/0,r=1/0,s=-1/0;for(const t of e)n=Math.min(n,t.minX),a=Math.max(a,t.maxX),r=Math.min(r,t.minY),s=Math.max(s,t.maxY);const o=t.buffer/t.extent,l=new Set;for(const t in this.tiles){const c=this.tiles[t],u=1<<c.z,h=(c.x-o)/u,d=(c.x+1+o)/u,p=(c.y-o)/u,m=(c.y+1+o)/u;if(a<h||n>=d||s<p||r>=m)continue;let g=!1;for(const t of e)if(t.maxX>=h&&t.minX<d&&t.maxY>=p&&t.minY<m){g=!0;break}if(g){if(i){i>1&&console.log("invalidate tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",c.z,c.x,c.y,c.numFeatures,c.numPoints,c.numSimplified);const e=`z${c.z}`;this.stats[e]=(this.stats[e]||0)-1,this.total--}delete this.tiles[t],l.add(t)}}l.size&&(this.tileCoords=this.tileCoords.filter(e=>!l.has(e.id)))}};function Zl(e,t,i){return 32*((1<<e)*i+t)+e}const Kl={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,updateable:!1,cluster:!1,clusterOptions:Il,debug:0};var Xl=class{constructor(e,t){const i=(t=this.options=Object.assign({},Kl,t)).debug;if(i&&console.time("preprocess data"),t.maxZoom<0||t.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(t.promoteId&&t.generateId)throw new Error("promoteId and generateId cannot be used together.");let n=Zo(e,t);i&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",t.indexMaxZoom,t.indexMaxPoints),console.time("generate tiles")),n=Al(n,t),t.updateable&&(this.source=n),this.initializeIndex(n,t)}initializeIndex(e,t){this.tileIndex=t.cluster?new Fl(t.clusterOptions):new Wl(t),e.length&&this.tileIndex.initialize(e)}getTile(e,t,i){return t=+t,i=+i,(e=+e)<0||e>24?null:this.tileIndex.getTile(e,t,i)}updateData(e,t){const i=this.options;if(!i.updateable)throw new Error("to update tile geojson `updateable` option must be set to true");let{affected:n,source:a}=xl(this.source,e,i);t&&({affected:n,source:a}=this.filterUpdate(a,n,t)),n.length&&(this.source=a,this.tileIndex.updateIndex(a,n,i))}filterUpdate(e,t,i){const n=new Set;for(const a of e)null!=a.id&&(i($o(a))||(t.push(a),n.add(a.id)));return{affected:t,source:e=e.filter(e=>!n.has(e.id))}}getData(){if(!this.options.updateable)throw new Error("to retrieve data the `updateable` option must be set to true");return function(e){return{type:"FeatureCollection",features:e.map(e=>$o(e))}}(this.source)}updateClusterOptions(e,t){const i=this.options.cluster;this.options.cluster=e,this.options.clusterOptions=t,i!=e?this.initializeIndex(this.source,this.options):this.tileIndex.updateIndex(this.source,[],this.options)}getClusterExpansionZoom(e){return this.tileIndex.getClusterExpansionZoom(e)}getClusterChildren(e){return this.tileIndex.getChildren(e)}getClusterLeaves(e,t,i){return this.tileIndex.getLeaves(e,t,i)}};const Ql=4294967296,Yl=1/Ql,Jl="undefined"==typeof TextDecoder?null:new TextDecoder("utf-8");class $l{constructor(e){this.buf=ArrayBuffer.isView(e)?e:new Uint8Array(e),this.dataView=new DataView(this.buf.buffer,this.buf.byteOffset,this.buf.byteLength),this.pos=0,this.type=0,this._valueStart=-1,this.length=this.buf.length}readFields(e,t,i=this.length){let n;for(;n=this.nextField(i);)e(n,t,this);return t}readMessage(e,t){return this.readFields(e,t,this.readVarint()+this.pos)}readFixed32(){const e=this.dataView.getUint32(this.pos,!0);return this.pos+=4,e}readSFixed32(){const e=this.dataView.getInt32(this.pos,!0);return this.pos+=4,e}readFixed64(){const e=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*Ql;return this.pos+=8,e}readSFixed64(){const e=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*Ql;return this.pos+=8,e}readFloat(){const e=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,e}readDouble(){const e=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,e}readVarint(e){const t=this.buf,i=t[this.pos++];if(i<128)return i;let n,a=127&i;return n=t[this.pos++],a|=(127&n)<<7,n<128?a:(n=t[this.pos++],a|=(127&n)<<14,n<128?a:(n=t[this.pos++],a|=(127&n)<<21,n<128?a:(n=t[this.pos],a|=(15&n)<<28,function(e,t,i){const n=i.buf;let a,r;if(r=n[i.pos++],a=(112&r)>>4,r<128)return tc(e,a,t);if(r=n[i.pos++],a|=(127&r)<<3,r<128)return tc(e,a,t);if(r=n[i.pos++],a|=(127&r)<<10,r<128)return tc(e,a,t);if(r=n[i.pos++],a|=(127&r)<<17,r<128)return tc(e,a,t);if(r=n[i.pos++],a|=(127&r)<<24,r<128)return tc(e,a,t);if(r=n[i.pos++],a|=(1&r)<<31,r<128)return tc(e,a,t);throw new Error("Expected varint not more than 10 bytes")}(a,e,this))))}readSVarint(){const e=this.readVarint();return e%2==1?(e+1)/-2:e/2}readBoolean(){return Boolean(this.readVarint())}readString(){const e=this.readVarint()+this.pos,t=this.pos;return this.pos=e,e-t>=12&&Jl?Jl.decode(this.buf.subarray(t,e)):function(e,t,i){let n="",a=t;for(;a<i;){const t=e[a];let r,s,o,l=null,c=t>239?4:t>223?3:t>191?2:1;if(a+c>i)break;1===c?t<128&&(l=t):2===c?(r=e[a+1],128==(192&r)&&(l=(31&t)<<6|63&r,l<=127&&(l=null))):3===c?(r=e[a+1],s=e[a+2],128==(192&r)&&128==(192&s)&&(l=(15&t)<<12|(63&r)<<6|63&s,(l<=2047||l>=55296&&l<=57343)&&(l=null))):4===c&&(r=e[a+1],s=e[a+2],o=e[a+3],128==(192&r)&&128==(192&s)&&128==(192&o)&&(l=(15&t)<<18|(63&r)<<12|(63&s)<<6|63&o,(l<=65535||l>=1114112)&&(l=null))),null===l?(l=65533,c=1):l>65535&&(l-=65536,n+=String.fromCharCode(l>>>10&1023|55296),l=56320|1023&l),n+=String.fromCharCode(l),a+=c}return n}(this.buf,t,e)}readBytes(){const e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t}readPackedVarint(e=[],t){const i=this.readPackedEnd();for(;this.pos<i;)e.push(this.readVarint(t));return e}readPackedSVarint(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSVarint());return e}readPackedBoolean(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readBoolean());return e}readPackedFloat(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFloat());return e}readPackedDouble(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readDouble());return e}readPackedFixed32(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFixed32());return e}readPackedSFixed32(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSFixed32());return e}readPackedFixed64(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFixed64());return e}readPackedSFixed64(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSFixed64());return e}readPackedEnd(){return 2===this.type?this.readVarint()+this.pos:this.pos+1}nextField(e=this.length){if(this.pos===this._valueStart&&this.skip(this.type),this.pos>=e)return 0;const t=this.readVarint();return this.type=7&t,this._valueStart=this.pos,t>>>3}skip(e){const t=7&e;if(0===t)for(;this.buf[this.pos++]>127;);else if(2===t)this.pos=this.readVarint()+this.pos;else if(5===t)this.pos+=4;else{if(1!==t)throw new Error(`Unimplemented type: ${t}`);this.pos+=8}}}class ec{constructor(e=new Uint8Array(16)){this.buf=ArrayBuffer.isView(e)?e:new Uint8Array(e),this.dataView=new DataView(this.buf.buffer,this.buf.byteOffset,this.buf.byteLength),this.pos=0,this.length=this.buf.length}writeTag(e,t){this.writeVarint(e<<3|t)}realloc(e){let t=this.length||16;for(;t<this.pos+e;)t*=2;if(t!==this.length){const e=new Uint8Array(t);e.set(this.buf),this.buf=e,this.dataView=new DataView(e.buffer),this.length=t}}finish(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)}writeFixed32(e){this.realloc(4),this.dataView.setInt32(this.pos,e,!0),this.pos+=4}writeSFixed32(e){this.realloc(4),this.dataView.setInt32(this.pos,e,!0),this.pos+=4}writeFixed64(e){this.realloc(8),this.dataView.setInt32(this.pos,-1&e,!0),this.dataView.setInt32(this.pos+4,Math.floor(e*Yl),!0),this.pos+=8}writeSFixed64(e){this.realloc(8),this.dataView.setInt32(this.pos,-1&e,!0),this.dataView.setInt32(this.pos+4,Math.floor(e*Yl),!0),this.pos+=8}writeVarint(e){if((e=+e||0)>=0&&e<128)return this.pos>=this.length&&this.realloc(1),void(this.buf[this.pos++]=e);e>268435455||e<0?function(e,t){let i,n;e>=0?(i=e%4294967296|0,n=e/4294967296|0):(i=~(-e%4294967296),n=~(-e/4294967296),4294967295^i?i=i+1|0:(i=0,n=n+1|0));if(e>=0x10000000000000000||e<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");t.realloc(10),function(e,t,i){i.buf[i.pos++]=127&e|128,e>>>=7,i.buf[i.pos++]=127&e|128,e>>>=7,i.buf[i.pos++]=127&e|128,e>>>=7,i.buf[i.pos++]=127&e|128,e>>>=7,i.buf[i.pos]=127&e}(i,0,t),function(e,t){const i=(7&e)<<4;if(t.buf[t.pos++]|=i|((e>>>=3)?128:0),!e)return;if(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),!e)return;if(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),!e)return;if(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),!e)return;if(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),!e)return;t.buf[t.pos++]=127&e}(n,t)}(e,this):(this.realloc(4),this.buf[this.pos++]=127&e|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=e>>>7&127))))}writeSVarint(e){this.writeVarint(e<0?2*-e-1:2*e)}writeBoolean(e){this.writeVarint(+e)}writeString(e){e=String(e),this.realloc(4*e.length),this.pos++;const t=this.pos;this.pos=function(e,t,i){for(let n,a,r=0;r<t.length;r++){if(n=t.charCodeAt(r),n>55295&&n<57344){if(!a){n>56319||r+1===t.length?(e[i++]=239,e[i++]=191,e[i++]=189):a=n;continue}if(n<56320){e[i++]=239,e[i++]=191,e[i++]=189,a=n;continue}n=a-55296<<10|n-56320|65536,a=null}else a&&(e[i++]=239,e[i++]=191,e[i++]=189,a=null);n<128?e[i++]=n:(n<2048?e[i++]=n>>6|192:(n<65536?e[i++]=n>>12|224:(e[i++]=n>>18|240,e[i++]=n>>12&63|128),e[i++]=n>>6&63|128),e[i++]=63&n|128)}return i}(this.buf,e,this.pos);const i=this.pos-t;i>=128&&ic(t,i,this),this.pos=t-1,this.writeVarint(i),this.pos+=i}writeFloat(e){this.realloc(4),this.dataView.setFloat32(this.pos,e,!0),this.pos+=4}writeDouble(e){this.realloc(8),this.dataView.setFloat64(this.pos,e,!0),this.pos+=8}writeBytes(e){const t=e.length;this.writeVarint(t),this.realloc(t),this.buf.set(e,this.pos),this.pos+=t}writeRawMessage(e,t){this.pos++;const i=this.pos;e(t,this);const n=this.pos-i;n>=128&&ic(i,n,this),this.pos=i-1,this.writeVarint(n),this.pos+=n}writeMessage(e,t,i){this.writeTag(e,2),this.writeRawMessage(t,i)}writePackedVarint(e,t){t.length&&this.writeMessage(e,nc,t)}writePackedSVarint(e,t){t.length&&this.writeMessage(e,ac,t)}writePackedBoolean(e,t){t.length&&this.writeMessage(e,oc,t)}writePackedFloat(e,t){t.length&&this.writeMessage(e,rc,t)}writePackedDouble(e,t){t.length&&this.writeMessage(e,sc,t)}writePackedFixed32(e,t){t.length&&this.writeMessage(e,lc,t)}writePackedSFixed32(e,t){t.length&&this.writeMessage(e,cc,t)}writePackedFixed64(e,t){t.length&&this.writeMessage(e,uc,t)}writePackedSFixed64(e,t){t.length&&this.writeMessage(e,hc,t)}writeBytesField(e,t){this.writeTag(e,2),this.writeBytes(t)}writeFixed32Field(e,t){this.writeTag(e,5),this.writeFixed32(t)}writeSFixed32Field(e,t){this.writeTag(e,5),this.writeSFixed32(t)}writeFixed64Field(e,t){this.writeTag(e,1),this.writeFixed64(t)}writeSFixed64Field(e,t){this.writeTag(e,1),this.writeSFixed64(t)}writeVarintField(e,t){this.writeTag(e,0),this.writeVarint(t)}writeSVarintField(e,t){this.writeTag(e,0),this.writeSVarint(t)}writeStringField(e,t){this.writeTag(e,2),this.writeString(t)}writeFloatField(e,t){this.writeTag(e,5),this.writeFloat(t)}writeDoubleField(e,t){this.writeTag(e,1),this.writeDouble(t)}writeBooleanField(e,t){this.writeVarintField(e,+t)}}function tc(e,t,i){return i?4294967296*t+(e>>>0):4294967296*(t>>>0)+(e>>>0)}function ic(e,t,i){const n=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(7*Math.LN2));i.realloc(n),i.buf.copyWithin(e+n,e,i.pos)}function nc(e,t){const i=e.length;let n=t.buf,a=t.pos,r=t.length;for(let s=0;s<i;s++){let i=e[s];if(i<0||a+10>r)t.pos=a,t.writeVarint(i),n=t.buf,a=t.pos,r=t.length;else{for(;i>127;)n[a++]=i%128|128,i=Math.floor(i/128);n[a++]=i}}t.pos=a}function ac(e,t){for(let i=0;i<e.length;i++)t.writeSVarint(e[i])}function rc(e,t){for(let i=0;i<e.length;i++)t.writeFloat(e[i])}function sc(e,t){for(let i=0;i<e.length;i++)t.writeDouble(e[i])}function oc(e,t){for(let i=0;i<e.length;i++)t.writeBoolean(e[i])}function lc(e,t){for(let i=0;i<e.length;i++)t.writeFixed32(e[i])}function cc(e,t){for(let i=0;i<e.length;i++)t.writeSFixed32(e[i])}function uc(e,t){for(let i=0;i<e.length;i++)t.writeFixed64(e[i])}function hc(e,t){for(let i=0;i<e.length;i++)t.writeSFixed64(e[i])}function dc(e,t){this.x=e,this.y=t}dc.prototype={clone(){return new dc(this.x,this.y)},add(e){return this.clone()._add(e)},sub(e){return this.clone()._sub(e)},multByPoint(e){return this.clone()._multByPoint(e)},divByPoint(e){return this.clone()._divByPoint(e)},mult(e){return this.clone()._mult(e)},div(e){return this.clone()._div(e)},rotate(e){return this.clone()._rotate(e)},rotateAround(e,t){return this.clone()._rotateAround(e,t)},matMult(e){return this.clone()._matMult(e)},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(e){return this.x===e.x&&this.y===e.y},dist(e){return Math.sqrt(this.distSqr(e))},distSqr(e){const t=e.x-this.x,i=e.y-this.y;return t*t+i*i},angle(){return Math.atan2(this.y,this.x)},angleTo(e){return Math.atan2(this.y-e.y,this.x-e.x)},angleWith(e){return this.angleWithSep(e.x,e.y)},angleWithSep(e,t){return Math.atan2(this.x*t-this.y*e,this.x*e+this.y*t)},_matMult(e){const t=e[0]*this.x+e[1]*this.y,i=e[2]*this.x+e[3]*this.y;return this.x=t,this.y=i,this},_add(e){return this.x+=e.x,this.y+=e.y,this},_sub(e){return this.x-=e.x,this.y-=e.y,this},_mult(e){return this.x*=e,this.y*=e,this},_div(e){return this.x/=e,this.y/=e,this},_multByPoint(e){return this.x*=e.x,this.y*=e.y,this},_divByPoint(e){return this.x/=e.x,this.y/=e.y,this},_unit(){return this._div(this.mag()),this},_perp(){const e=this.y;return this.y=this.x,this.x=-e,this},_rotate(e){const t=Math.cos(e),i=Math.sin(e),n=t*this.x-i*this.y,a=i*this.x+t*this.y;return this.x=n,this.y=a,this},_rotateAround(e,t){const i=Math.cos(e),n=Math.sin(e),a=t.x+i*(this.x-t.x)-n*(this.y-t.y),r=t.y+n*(this.x-t.x)+i*(this.y-t.y);return this.x=a,this.y=r,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:dc},dc.convert=function(e){if(e instanceof dc)return e;if(Array.isArray(e))return new dc(+e[0],+e[1]);if(void 0!==e.x&&void 0!==e.y)return new dc(+e.x,+e.y);throw new Error("Expected [x, y] or {x, y} point format")};var pc=class{constructor(e,t){this.feature=e,this.type=e.type,this.properties=e.tags?e.tags:{},this.extent=t,"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=[],t=1===this.feature.type?[this.feature.geometry]:this.feature.geometry;for(const i of t){const t=[];for(const e of i)t.push(new dc(e[0],e[1]));e.push(t)}return e}};const mc="_geojsonTileLayer";var gc=class{constructor(e,t){this.layers={[mc]:this},this.name=mc,this.version=t?t.version:1,this.extent=t?t.extent:4096,this.length=e.length,this.features=e}feature(e){return new pc(this.features[e],this.extent)}};function fc(e,t=""){const i=new ec;return function(e,t,i=""){for(const n in e.layers)t.writeMessage(3,(e,t)=>Ac(e,t,i),e.layers[n])}(e,i,t),i.finish()}function Ac(e,t,i=""){t.writeVarintField(15,e.version||1),t.writeStringField(1,e.name||""),t.writeVarintField(5,e.extent||4096);const n={jsonPrefix:i,keys:[],values:[],keycache:{},valuecache:{}};for(let i=0;i<e.length;i++)n.feature=e.feature(i),t.writeMessage(2,_c,n);const a=n.keys;for(const e of a)t.writeStringField(3,e);const r=n.values;for(const e of r)t.writeMessage(4,wc,e)}function _c(e,t){if(!e.feature)return;const i=e.feature;void 0!==i.id&&t.writeVarintField(1,i.id),t.writeMessage(2,vc,e),t.writeVarintField(3,i.type),t.writeMessage(4,bc,i)}function vc(e,t){for(const i in e.feature?.properties){let n=e.feature.properties[i],a=e.keycache[i];if(null==n)continue;void 0===a&&(e.keys.push(i),a=e.keys.length-1,e.keycache[i]=a),t.writeVarint(a),"string"!=typeof n&&"boolean"!=typeof n&&"number"!=typeof n&&(n=e.jsonPrefix+JSON.stringify(n));const r=typeof n+":"+n;let s=e.valuecache[r];void 0===s&&(e.values.push(n),s=e.values.length-1,e.valuecache[r]=s),t.writeVarint(s)}}function yc(e,t){return(t<<3)+(7&e)}function xc(e){return e<<1^e>>31}function bc(e,t){const i=e.loadGeometry(),n=e.type;let a=0,r=0;for(const s of i){let i=1;1===n&&(i=s.length),t.writeVarint(yc(1,i));const o=3===n?s.length-1:s.length;for(let e=0;e<o;e++){1===e&&1!==n&&t.writeVarint(yc(2,o-1));const i=s[e].x-a,l=s[e].y-r;t.writeVarint(xc(i)),t.writeVarint(xc(l)),a+=i,r+=l}3===e.type&&t.writeVarint(yc(7,1))}}function wc(e,t){const i=typeof e;"string"===i?t.writeStringField(1,e):"boolean"===i?t.writeBooleanField(7,e):"number"===i&&(e%1!=0?t.writeDoubleField(3,e):e<0?t.writeSVarintField(6,e):t.writeVarintField(5,e))}const Ec={15:100,16:300,17:500,18:800,19:1e3};class kc{constructor(e){this.tiles=new Map,this._parent=e}clearCache(){this.tiles=new Map}_tileToBbox(e,t,i){const n=Math.pow(2,i),a=e/n*360-180,r=(e+1)/n*360-180,s=nt(Math.atan(Math.sinh(Math.PI*(1-2*t/n))));return[a,nt(Math.atan(Math.sinh(Math.PI*(1-2*(t+1)/n)))),r,s]}_semanticsToBasicProps(e){const t={},i=e=>{t[e.key]?t[e.key].add(e.value):t[e.key]=new Set([e.value])};return(e.properties?.collection?.semantics||[]).forEach(i),(e.properties?.semantics||[]).forEach(i),(e.properties?.annotations||[]).forEach(e=>e.semantics.forEach(i)),Object.keys(t).forEach(e=>t[e]=[...t[e]].join(";")),t.picid=e.id,t.seqid=e.collection,t}tile(){return(e,t)=>{t=t||new AbortController;const i=e.url.match(/^sem:\/\/\/(.+)\/(\d+)\/(\d+)\/(\d+)/);if(!i)throw new Error("Invalid URL");if(this.tiles.has(e.url))return{data:this.tiles.get(e.url).buffer.slice(0)};const[,n,a,r,s]=i,o=this._tileToBbox(parseInt(r),parseInt(s),parseInt(a)),l=`${this._parent.getAPI()._endpoint}/search?bbox=${o.join(",")}&limit=${Ec[parseInt(a)]}&sortby=id&filter=${encodeURIComponent(n)}`;return fetch(l,{signal:t.signal}).then(e=>e.json()).then(t=>{if(t.features){if(t.type="FeatureCollection",0===t.features.length){const t=new Uint8Array;return this.tiles.set(e.url,t),{data:t.buffer.slice(0)}}t.features=t.features.filter(e=>{let t=e.properties?.semantics?.length>0||e.properties?.annotations?.length>0;return t||e.properties?.collection?.semantics?.find(e=>"osm|level"===e.key)&&(t=!0),t}).map(e=>({type:e.type,geometry:e.geometry,id:e.id,properties:this._semanticsToBasicProps(e)}))}const i=new Xl(t,{minZoom:15,maxZoom:19}).getTile(a,r,s);if(!i)throw new Error("Can't create tile");const n=function(e,t){const i={};for(const n in e)i[n]=new gc(e[n].features,t),i[n].name=n,i[n].version=t?t.version:1,i[n].extent=t?t.extent:4096;return fc({layers:i})}({layer:i},{version:2});return this.tiles.set(e.url,n),{data:n.buffer.slice(0)}}).catch(e=>{e.message&&e.message.includes("The operation was aborted")||console.error(e)})}}}class Sc{constructor(e,t,i,n,a){for(this.properties=Object.create(null),this.extent=i,this.type=0,this.id=void 0,this._pbf=e,this._geometry=-1,this._keys=n,this._values=a;e.pos<t;){const t=e.readVarint();if(8===t)this.id=e.readVarint();else if(18===t){const t=e.readVarint()+e.pos;for(;e.pos<t;){const t=n[e.readVarint()],i=a[e.readVarint()];this.properties[t]=i}}else 24===t?this.type=e.readVarint():34===t?(this._geometry=e.pos,e.skip(t)):e.skip(t)}}loadGeometry(){if(this._geometry<0)throw new Error("feature has no geometry");const e=this._pbf;e.pos=this._geometry;const t=e.readVarint()+e.pos,i=[];let n,a=1,r=0,s=0,o=0;for(;e.pos<t;){if(r<=0){const t=e.readVarint();if(a=7&t,r=t>>3,0===r)continue}if(r--,1===a)s+=e.readSVarint(),o+=e.readSVarint(),n&&i.push(n),n=[new dc(s,o)];else if(2===a)s+=e.readSVarint(),o+=e.readSVarint(),n&&n.push(new dc(s,o));else{if(7!==a)throw new Error(`unknown command ${a}`);n&&n.push(n[0].clone())}}return n&&i.push(n),i}bbox(){if(this._geometry<0)throw new Error("feature has no geometry");const e=this._pbf;e.pos=this._geometry;const t=e.readVarint()+e.pos;let i=1,n=0,a=0,r=0,s=1/0,o=-1/0,l=1/0,c=-1/0;for(;e.pos<t;){if(n<=0){const t=e.readVarint();if(i=7&t,n=t>>3,0===n)continue}if(n--,1===i||2===i)a+=e.readSVarint(),r+=e.readSVarint(),a<s&&(s=a),a>o&&(o=a),r<l&&(l=r),r>c&&(c=r);else if(7!==i)throw new Error(`unknown command ${i}`)}return[s,l,o,c]}toGeoJSON(e,t,i){const n=this.extent*Math.pow(2,i),a=this.extent*e,r=this.extent*t,s=this.loadGeometry();function o(e){return[360*(e.x+a)/n-180,360/Math.PI*Math.atan(Math.exp((1-2*(e.y+r)/n)*Math.PI))-90]}function l(e){return e.map(o)}let c;if(1===this.type){const e=[];for(const t of s)e.push(t[0]);const t=l(e);c=1===e.length?{type:"Point",coordinates:t[0]}:{type:"MultiPoint",coordinates:t}}else if(2===this.type){const e=s.map(l);c=1===e.length?{type:"LineString",coordinates:e[0]}:{type:"MultiLineString",coordinates:e}}else{if(3!==this.type)throw new Error("unknown feature type");{const e=function(e){const t=e.length;if(t<=1)return[e];const i=[];let n,a;for(let r=0;r<t;r++){const t=Mc(e[r]);0!==t&&(void 0===a&&(a=t<0),a===t<0?(n&&i.push(n),n=[e[r]]):n&&n.push(e[r]))}n&&i.push(n);return i}(s),t=[];for(const i of e)t.push(i.map(l));c=1===t.length?{type:"Polygon",coordinates:t[0]}:{type:"MultiPolygon",coordinates:t}}}const u={type:"Feature",geometry:c,properties:this.properties};return null!=this.id&&(u.id=this.id),u}}function Mc(e){let t=0;for(let i,n,a=0,r=e.length,s=r-1;a<r;s=a++)i=e[a],n=e[s],t+=(n.x-i.x)*(i.y+n.y);return t}Sc.types=["Unknown","Point","LineString","Polygon"];class Cc{constructor(e,t){for(this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],void 0===t&&(t=e.length);e.pos<t;){const t=e.readVarint();10===t?this.name=e.readString():18===t?(this._features.push(e.pos),e.skip(t)):26===t?this._keys.push(e.readString()):34===t?this._values.push(Tc(e)):40===t?this.extent=e.readVarint():120===t?this.version=e.readVarint():e.skip(t)}this.length=this._features.length}feature(e){if(e<0||e>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[e];const t=this._pbf.readVarint()+this._pbf.pos;return new Sc(this._pbf,t,this.extent,this._keys,this._values)}}function Tc(e){let t=null;const i=e.readVarint()+e.pos;for(;e.pos<i;){const i=e.readVarint();t=10===i?e.readString():21===i?e.readFloat():25===i?e.readDouble():32===i?e.readVarint(!0):40===i?e.readVarint():48===i?e.readSVarint():56===i?e.readBoolean():(e.skip(i),null)}if(null==t)throw new Error("unknown feature value");return t}class Dc{constructor(e,t=e.length){const i=Object.create(null);for(;e.pos<t;){const t=e.readVarint();if(26===t){const t=new Cc(e,e.readVarint()+e.pos);t.length&&(i[t.name]=t)}else e.skip(t)}this.layers=i}}class Pc{tile(){return(e,t)=>{t=t||new AbortController;const i=e.url.replace(/^panora/,"http");return fetch(i,{signal:t.signal}).then(e=>e.arrayBuffer()).then(e=>new Dc(new $l(e))).then(e=>(!e.layers.pictures||e.layers.pictures.length>=5e3||Object.values(e.layers).forEach(e=>{const t=e.feature.bind(e);e.feature=e=>{const i=t(e);return i.properties.uncrowded=!0,i}}),e)).then(e=>fc(e).buffer).then(e=>({data:e}))}}}const Ic="-1000",Fc="levels";function zc(){try{return IndoorEqual,!0}catch(e){return!1}}function Rc(e,t=!1){if(e._options.indoor)if(zc()){if(!t&&!1===e._options.indoor.visible)return;e.indoorEqual=new IndoorEqual(e,e._options.indoor),e.addControl(e.indoorEqual),e.indoorEqual.loadSprite("https://files.pavie.info/depot/remote/indoorequal/indoorequal"),e.indoorEqual._refreshAfterLevelsUpdate=function(){this.levels.includes(this.level)||this.level==Ic||this.setLevel("0")};const i="sem-"+Fc;e.indoorEqual._updateLevels=function(){if(this.map.getSource(this.source.sourceId)&&this.map.isSourceLoaded(this.source.sourceId)&&this.map.getSource(i)&&this.map.isSourceLoaded(i)){let e=new Set;this.map.querySourceFeatures(this.source.sourceId,{sourceLayer:"area"}).forEach(t=>{"level"!==t.properties.class&&void 0!==t.properties.level&&e.add(t.properties.level.toString())}),this.map.querySourceFeatures(i,{sourceLayer:"layer"}).forEach(t=>{void 0!==t.properties["osm|level"]&&e.add(t.properties["osm|level"].toString())}),e.size>0&&e.add("0"),0!==e.symmetricDifference(new Set(this.levels)).size&&(this.levels=[...e].sort((e,t)=>parseFloat(e)-parseFloat(t)).reverse(),this._emitLevelsChange(),this._refreshAfterLevelsUpdate())}},e._indoorFeaturesIDs={pictures:{},sequences:{}},e.on("sourcedata",Fc,t=>{t.sourceId===i&&(t.features.forEach(t=>{e._indoorFeaturesIDs.pictures[t.properties["osm|level"]]||(e._indoorFeaturesIDs.pictures[t.properties["osm|level"]]=new Set),e._indoorFeaturesIDs.sequences[t.properties["osm|level"]]||(e._indoorFeaturesIDs.sequences[t.properties["osm|level"]]=new Set),e._indoorFeaturesIDs.pictures[t.properties["osm|level"]].add(t.properties.picid),e._indoorFeaturesIDs.sequences[t.properties["osm|level"]].add(t.properties.seqid)}),s())});const n=()=>{e.addSemanticOverlay?.(Fc,'"semantics.osm|level" IS NOT NULL',{type:"circle",layout:{visibility:"visible"},paint:{"circle-opacity":0}}),t&&e._parent._initParams?.getMapPostInit()?.level===Ic?e.indoorEqual.setLevel("0"):[null,void 0,""].includes(e._parent._initParams?.getMapPostInit()?.level)||e.indoorEqual.setLevel(e._parent._initParams?.getMapPostInit()?.level)};if(e.isStyleLoaded())n();else{const t=setInterval(()=>{e.isStyleLoaded()&&(n(),clearInterval(t))},250)}let a;e._parent.grid.appendChild(bs("pnx-level-select",{slot:"bottom-right",_parent:e._parent,class:"pnx-only-map pnx-print-hidden"}));const r=()=>{if(e.indoorEqual.level===Ic)e.restrictVisibleFeatures("hide","pictures",[]),e.restrictVisibleFeatures("hide","sequences",[]);else if("0"===e.indoorEqual.level){const t=new Set;Object.entries(e._indoorFeaturesIDs.pictures).forEach(([e,i])=>{"0"!=e&&i.forEach(e=>t.add(e))}),e.restrictVisibleFeatures("hide","pictures",[...t]);let i=new Set;Object.entries(e._indoorFeaturesIDs.sequences).forEach(([e,t])=>{"0"!=e&&(i=i.union(t))}),e._indoorFeaturesIDs.sequences[0]&&(i=i.difference(e._indoorFeaturesIDs.sequences[0])),e.restrictVisibleFeatures("hide","sequences",[...i])}else e.restrictVisibleFeatures("keep","pictures",e._indoorFeaturesIDs.pictures[e.indoorEqual.level]?[...e._indoorFeaturesIDs.pictures[e.indoorEqual.level]]:[]),e.restrictVisibleFeatures("keep","sequences",e._indoorFeaturesIDs.sequences[e.indoorEqual.level]?[...e._indoorFeaturesIDs.sequences[e.indoorEqual.level]]:[])},s=()=>{a&&(clearTimeout(a),a=void 0),a=setTimeout(r,250)};e.indoorEqual.on("levelchange",s)}else console.error("The indoor= plugin is not enabled. Please add the maplibre-gl-indoorequal before calling 'indoor' option of Panoramax Viewer.")}var Lc=Object.freeze({__proto__:null,DISABLED_LEVEL:Ic,initIndoorEqualOnMap:Rc,isIndoorEqualAvailable:zc}),Bc=Object.create,Oc=Object.defineProperty,Uc=Object.getOwnPropertyDescriptor,Nc=Object.getOwnPropertyNames,jc=Object.getPrototypeOf,Vc=Object.prototype.hasOwnProperty,qc=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),Gc=(e,t,i,n)=>{if(t&&"object"==typeof t||"function"==typeof t)for(var a,r=Nc(t),s=0,o=r.length;s<o;s++)a=r[s],!Vc.call(e,a)&&a!==i&&Oc(e,a,{get:(e=>t[e]).bind(null,a),enumerable:!(n=Uc(t,a))||n.enumerable});return e};
|
|
27
|
+
*/function gt(e,t,i){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var n=i.call(e,t);if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function ft(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,n)}return i}function At(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?ft(Object(i),!0).forEach(function(t){gt(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):ft(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}const _t=()=>{};let vt={},yt={},xt=null,bt={mark:_t,measure:_t};try{"undefined"!=typeof window&&(vt=window),"undefined"!=typeof document&&(yt=document),"undefined"!=typeof MutationObserver&&(xt=MutationObserver),"undefined"!=typeof performance&&(bt=performance)}catch(y2){}const{userAgent:wt=""}=vt.navigator||{},Et=vt,kt=yt,St=xt,Mt=bt;Et.document;const Ct=!!kt.documentElement&&!!kt.head&&"function"==typeof kt.addEventListener&&"function"==typeof kt.createElement,Tt=~wt.indexOf("MSIE")||~wt.indexOf("Trident/");var Dt={classic:{fa:"solid",fas:"solid","fa-solid":"solid",far:"regular","fa-regular":"regular",fal:"light","fa-light":"light",fat:"thin","fa-thin":"thin",fab:"brands","fa-brands":"brands"},duotone:{fa:"solid",fad:"solid","fa-solid":"solid","fa-duotone":"solid",fadr:"regular","fa-regular":"regular",fadl:"light","fa-light":"light",fadt:"thin","fa-thin":"thin"},sharp:{fa:"solid",fass:"solid","fa-solid":"solid",fasr:"regular","fa-regular":"regular",fasl:"light","fa-light":"light",fast:"thin","fa-thin":"thin"},"sharp-duotone":{fa:"solid",fasds:"solid","fa-solid":"solid",fasdr:"regular","fa-regular":"regular",fasdl:"light","fa-light":"light",fasdt:"thin","fa-thin":"thin"}},Pt=["fa-classic","fa-duotone","fa-sharp","fa-sharp-duotone"],It="classic",Ft="duotone",zt=[It,Ft,"sharp","sharp-duotone"],Rt=new Map([["classic",{defaultShortPrefixId:"fas",defaultStyleId:"solid",styleIds:["solid","regular","light","thin","brands"],futureStyleIds:[],defaultFontWeight:900}],["sharp",{defaultShortPrefixId:"fass",defaultStyleId:"solid",styleIds:["solid","regular","light","thin"],futureStyleIds:[],defaultFontWeight:900}],["duotone",{defaultShortPrefixId:"fad",defaultStyleId:"solid",styleIds:["solid","regular","light","thin"],futureStyleIds:[],defaultFontWeight:900}],["sharp-duotone",{defaultShortPrefixId:"fasds",defaultStyleId:"solid",styleIds:["solid","regular","light","thin"],futureStyleIds:[],defaultFontWeight:900}]]),Lt=["fak","fa-kit","fakd","fa-kit-duotone"],Bt={fak:"kit","fa-kit":"kit"},Ot={fakd:"kit-duotone","fa-kit-duotone":"kit-duotone"},Ut=["fak","fakd"],Nt={kit:"fak"},jt={"kit-duotone":"fakd"},Vt={GROUP:"duotone-group",SWAP_OPACITY:"swap-opacity",PRIMARY:"primary",SECONDARY:"secondary"},qt=["fak","fa-kit","fakd","fa-kit-duotone"],Gt={classic:{fab:"fa-brands",fad:"fa-duotone",fal:"fa-light",far:"fa-regular",fas:"fa-solid",fat:"fa-thin"},duotone:{fadr:"fa-regular",fadl:"fa-light",fadt:"fa-thin"},sharp:{fass:"fa-solid",fasr:"fa-regular",fasl:"fa-light",fast:"fa-thin"},"sharp-duotone":{fasds:"fa-solid",fasdr:"fa-regular",fasdl:"fa-light",fasdt:"fa-thin"}},Ht=["fa","fas","far","fal","fat","fad","fadr","fadl","fadt","fab","fass","fasr","fasl","fast","fasds","fasdr","fasdl","fasdt","fa-classic","fa-duotone","fa-sharp","fa-sharp-duotone","fa-solid","fa-regular","fa-light","fa-thin","fa-duotone","fa-brands"],Wt=[1,2,3,4,5,6,7,8,9,10],Zt=Wt.concat([11,12,13,14,15,16,17,18,19,20]),Kt=[...Object.keys({classic:["fas","far","fal","fat","fad"],duotone:["fadr","fadl","fadt"],sharp:["fass","fasr","fasl","fast"],"sharp-duotone":["fasds","fasdr","fasdl","fasdt"]}),"solid","regular","light","thin","duotone","brands","2xs","xs","sm","lg","xl","2xl","beat","border","fade","beat-fade","bounce","flip-both","flip-horizontal","flip-vertical","flip","fw","inverse","layers-counter","layers-text","layers","li","pull-left","pull-right","pulse","rotate-180","rotate-270","rotate-90","rotate-by","shake","spin-pulse","spin-reverse","spin","stack-1x","stack-2x","stack","ul",Vt.GROUP,Vt.SWAP_OPACITY,Vt.PRIMARY,Vt.SECONDARY].concat(Wt.map(e=>"".concat(e,"x"))).concat(Zt.map(e=>"w-".concat(e)));const Xt="___FONT_AWESOME___",Qt=16,Yt="svg-inline--fa",Jt="data-fa-i2svg",$t="data-fa-pseudo-element",ei="data-prefix",ti="data-icon",ii="fontawesome-i2svg",ni=["HTML","HEAD","STYLE","SCRIPT"],ai=(()=>{try{return"production"===process.env.NODE_ENV}catch(e){return!1}})();function ri(e){return new Proxy(e,{get:(e,t)=>t in e?e[t]:e[It]})}const si=At({},Dt);si[It]=At(At(At(At({},{"fa-duotone":"duotone"}),Dt[It]),Bt),Ot);const oi=ri(si),li=At({},{classic:{solid:"fas",regular:"far",light:"fal",thin:"fat",brands:"fab"},duotone:{solid:"fad",regular:"fadr",light:"fadl",thin:"fadt"},sharp:{solid:"fass",regular:"fasr",light:"fasl",thin:"fast"},"sharp-duotone":{solid:"fasds",regular:"fasdr",light:"fasdl",thin:"fasdt"}});li[It]=At(At(At(At({},{duotone:"fad"}),li[It]),Nt),jt);const ci=ri(li),ui=At({},Gt);ui[It]=At(At({},ui[It]),{fak:"fa-kit"});const hi=ri(ui),di=At({},{classic:{"fa-brands":"fab","fa-duotone":"fad","fa-light":"fal","fa-regular":"far","fa-solid":"fas","fa-thin":"fat"},duotone:{"fa-regular":"fadr","fa-light":"fadl","fa-thin":"fadt"},sharp:{"fa-solid":"fass","fa-regular":"fasr","fa-light":"fasl","fa-thin":"fast"},"sharp-duotone":{"fa-solid":"fasds","fa-regular":"fasdr","fa-light":"fasdl","fa-thin":"fasdt"}});di[It]=At(At({},di[It]),{"fa-kit":"fak"}),ri(di);const pi=/fa(s|r|l|t|d|dr|dl|dt|b|k|kd|ss|sr|sl|st|sds|sdr|sdl|sdt)?[\-\ ]/,mi="fa-layers-text",gi=/Font ?Awesome ?([56 ]*)(Solid|Regular|Light|Thin|Duotone|Brands|Free|Pro|Sharp Duotone|Sharp|Kit)?.*/i;ri(At({},{classic:{900:"fas",400:"far",normal:"far",300:"fal",100:"fat"},duotone:{900:"fad",400:"fadr",300:"fadl",100:"fadt"},sharp:{900:"fass",400:"fasr",300:"fasl",100:"fast"},"sharp-duotone":{900:"fasds",400:"fasdr",300:"fasdl",100:"fasdt"}}));const fi=["class","data-prefix","data-icon","data-fa-transform","data-fa-mask"],Ai={GROUP:"duotone-group",PRIMARY:"primary",SECONDARY:"secondary"},_i=["kit",...Kt],vi=Et.FontAwesomeConfig||{};if(kt&&"function"==typeof kt.querySelector){[["data-family-prefix","familyPrefix"],["data-css-prefix","cssPrefix"],["data-family-default","familyDefault"],["data-style-default","styleDefault"],["data-replacement-class","replacementClass"],["data-auto-replace-svg","autoReplaceSvg"],["data-auto-add-css","autoAddCss"],["data-auto-a11y","autoA11y"],["data-search-pseudo-elements","searchPseudoElements"],["data-observe-mutations","observeMutations"],["data-mutate-approach","mutateApproach"],["data-keep-original-source","keepOriginalSource"],["data-measure-performance","measurePerformance"],["data-show-missing-icons","showMissingIcons"]].forEach(e=>{let[t,i]=e;const n=function(e){return""===e||"false"!==e&&("true"===e||e)}(function(e){var t=kt.querySelector("script["+e+"]");if(t)return t.getAttribute(e)}(t));null!=n&&(vi[i]=n)})}const yi={styleDefault:"solid",familyDefault:It,cssPrefix:"fa",replacementClass:Yt,autoReplaceSvg:!0,autoAddCss:!0,autoA11y:!0,searchPseudoElements:!1,observeMutations:!0,mutateApproach:"async",keepOriginalSource:!0,measurePerformance:!1,showMissingIcons:!0};vi.familyPrefix&&(vi.cssPrefix=vi.familyPrefix);const xi=At(At({},yi),vi);xi.autoReplaceSvg||(xi.observeMutations=!1);const bi={};Object.keys(yi).forEach(e=>{Object.defineProperty(bi,e,{enumerable:!0,set:function(t){xi[e]=t,wi.forEach(e=>e(bi))},get:function(){return xi[e]}})}),Object.defineProperty(bi,"familyPrefix",{enumerable:!0,set:function(e){xi.cssPrefix=e,wi.forEach(e=>e(bi))},get:function(){return xi.cssPrefix}}),Et.FontAwesomeConfig=bi;const wi=[];const Ei=Qt,ki={size:16,x:0,y:0,rotate:0,flipX:!1,flipY:!1};function Si(){let e=12,t="";for(;e-- >0;)t+="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[62*Math.random()|0];return t}function Mi(e){const t=[];for(let i=(e||[]).length>>>0;i--;)t[i]=e[i];return t}function Ci(e){return e.classList?Mi(e.classList):(e.getAttribute("class")||"").split(" ").filter(e=>e)}function Ti(e){return"".concat(e).replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}function Di(e){return Object.keys(e||{}).reduce((t,i)=>t+"".concat(i,": ").concat(e[i].trim(),";"),"")}function Pi(e){return e.size!==ki.size||e.x!==ki.x||e.y!==ki.y||e.rotate!==ki.rotate||e.flipX||e.flipY}function Ii(){const e="fa",t=Yt,i=bi.cssPrefix,n=bi.replacementClass;let a=':root, :host {\n --fa-font-solid: normal 900 1em/1 "Font Awesome 6 Free";\n --fa-font-regular: normal 400 1em/1 "Font Awesome 6 Free";\n --fa-font-light: normal 300 1em/1 "Font Awesome 6 Pro";\n --fa-font-thin: normal 100 1em/1 "Font Awesome 6 Pro";\n --fa-font-duotone: normal 900 1em/1 "Font Awesome 6 Duotone";\n --fa-font-duotone-regular: normal 400 1em/1 "Font Awesome 6 Duotone";\n --fa-font-duotone-light: normal 300 1em/1 "Font Awesome 6 Duotone";\n --fa-font-duotone-thin: normal 100 1em/1 "Font Awesome 6 Duotone";\n --fa-font-brands: normal 400 1em/1 "Font Awesome 6 Brands";\n --fa-font-sharp-solid: normal 900 1em/1 "Font Awesome 6 Sharp";\n --fa-font-sharp-regular: normal 400 1em/1 "Font Awesome 6 Sharp";\n --fa-font-sharp-light: normal 300 1em/1 "Font Awesome 6 Sharp";\n --fa-font-sharp-thin: normal 100 1em/1 "Font Awesome 6 Sharp";\n --fa-font-sharp-duotone-solid: normal 900 1em/1 "Font Awesome 6 Sharp Duotone";\n --fa-font-sharp-duotone-regular: normal 400 1em/1 "Font Awesome 6 Sharp Duotone";\n --fa-font-sharp-duotone-light: normal 300 1em/1 "Font Awesome 6 Sharp Duotone";\n --fa-font-sharp-duotone-thin: normal 100 1em/1 "Font Awesome 6 Sharp Duotone";\n}\n\nsvg:not(:root).svg-inline--fa, svg:not(:host).svg-inline--fa {\n overflow: visible;\n box-sizing: content-box;\n}\n\n.svg-inline--fa {\n display: var(--fa-display, inline-block);\n height: 1em;\n overflow: visible;\n vertical-align: -0.125em;\n}\n.svg-inline--fa.fa-2xs {\n vertical-align: 0.1em;\n}\n.svg-inline--fa.fa-xs {\n vertical-align: 0em;\n}\n.svg-inline--fa.fa-sm {\n vertical-align: -0.0714285705em;\n}\n.svg-inline--fa.fa-lg {\n vertical-align: -0.2em;\n}\n.svg-inline--fa.fa-xl {\n vertical-align: -0.25em;\n}\n.svg-inline--fa.fa-2xl {\n vertical-align: -0.3125em;\n}\n.svg-inline--fa.fa-pull-left {\n margin-right: var(--fa-pull-margin, 0.3em);\n width: auto;\n}\n.svg-inline--fa.fa-pull-right {\n margin-left: var(--fa-pull-margin, 0.3em);\n width: auto;\n}\n.svg-inline--fa.fa-li {\n width: var(--fa-li-width, 2em);\n top: 0.25em;\n}\n.svg-inline--fa.fa-fw {\n width: var(--fa-fw-width, 1.25em);\n}\n\n.fa-layers svg.svg-inline--fa {\n bottom: 0;\n left: 0;\n margin: auto;\n position: absolute;\n right: 0;\n top: 0;\n}\n\n.fa-layers-counter, .fa-layers-text {\n display: inline-block;\n position: absolute;\n text-align: center;\n}\n\n.fa-layers {\n display: inline-block;\n height: 1em;\n position: relative;\n text-align: center;\n vertical-align: -0.125em;\n width: 1em;\n}\n.fa-layers svg.svg-inline--fa {\n transform-origin: center center;\n}\n\n.fa-layers-text {\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n transform-origin: center center;\n}\n\n.fa-layers-counter {\n background-color: var(--fa-counter-background-color, #ff253a);\n border-radius: var(--fa-counter-border-radius, 1em);\n box-sizing: border-box;\n color: var(--fa-inverse, #fff);\n line-height: var(--fa-counter-line-height, 1);\n max-width: var(--fa-counter-max-width, 5em);\n min-width: var(--fa-counter-min-width, 1.5em);\n overflow: hidden;\n padding: var(--fa-counter-padding, 0.25em 0.5em);\n right: var(--fa-right, 0);\n text-overflow: ellipsis;\n top: var(--fa-top, 0);\n transform: scale(var(--fa-counter-scale, 0.25));\n transform-origin: top right;\n}\n\n.fa-layers-bottom-right {\n bottom: var(--fa-bottom, 0);\n right: var(--fa-right, 0);\n top: auto;\n transform: scale(var(--fa-layers-scale, 0.25));\n transform-origin: bottom right;\n}\n\n.fa-layers-bottom-left {\n bottom: var(--fa-bottom, 0);\n left: var(--fa-left, 0);\n right: auto;\n top: auto;\n transform: scale(var(--fa-layers-scale, 0.25));\n transform-origin: bottom left;\n}\n\n.fa-layers-top-right {\n top: var(--fa-top, 0);\n right: var(--fa-right, 0);\n transform: scale(var(--fa-layers-scale, 0.25));\n transform-origin: top right;\n}\n\n.fa-layers-top-left {\n left: var(--fa-left, 0);\n right: auto;\n top: var(--fa-top, 0);\n transform: scale(var(--fa-layers-scale, 0.25));\n transform-origin: top left;\n}\n\n.fa-1x {\n font-size: 1em;\n}\n\n.fa-2x {\n font-size: 2em;\n}\n\n.fa-3x {\n font-size: 3em;\n}\n\n.fa-4x {\n font-size: 4em;\n}\n\n.fa-5x {\n font-size: 5em;\n}\n\n.fa-6x {\n font-size: 6em;\n}\n\n.fa-7x {\n font-size: 7em;\n}\n\n.fa-8x {\n font-size: 8em;\n}\n\n.fa-9x {\n font-size: 9em;\n}\n\n.fa-10x {\n font-size: 10em;\n}\n\n.fa-2xs {\n font-size: 0.625em;\n line-height: 0.1em;\n vertical-align: 0.225em;\n}\n\n.fa-xs {\n font-size: 0.75em;\n line-height: 0.0833333337em;\n vertical-align: 0.125em;\n}\n\n.fa-sm {\n font-size: 0.875em;\n line-height: 0.0714285718em;\n vertical-align: 0.0535714295em;\n}\n\n.fa-lg {\n font-size: 1.25em;\n line-height: 0.05em;\n vertical-align: -0.075em;\n}\n\n.fa-xl {\n font-size: 1.5em;\n line-height: 0.0416666682em;\n vertical-align: -0.125em;\n}\n\n.fa-2xl {\n font-size: 2em;\n line-height: 0.03125em;\n vertical-align: -0.1875em;\n}\n\n.fa-fw {\n text-align: center;\n width: 1.25em;\n}\n\n.fa-ul {\n list-style-type: none;\n margin-left: var(--fa-li-margin, 2.5em);\n padding-left: 0;\n}\n.fa-ul > li {\n position: relative;\n}\n\n.fa-li {\n left: calc(-1 * var(--fa-li-width, 2em));\n position: absolute;\n text-align: center;\n width: var(--fa-li-width, 2em);\n line-height: inherit;\n}\n\n.fa-border {\n border-color: var(--fa-border-color, #eee);\n border-radius: var(--fa-border-radius, 0.1em);\n border-style: var(--fa-border-style, solid);\n border-width: var(--fa-border-width, 0.08em);\n padding: var(--fa-border-padding, 0.2em 0.25em 0.15em);\n}\n\n.fa-pull-left {\n float: left;\n margin-right: var(--fa-pull-margin, 0.3em);\n}\n\n.fa-pull-right {\n float: right;\n margin-left: var(--fa-pull-margin, 0.3em);\n}\n\n.fa-beat {\n animation-name: fa-beat;\n animation-delay: var(--fa-animation-delay, 0s);\n animation-direction: var(--fa-animation-direction, normal);\n animation-duration: var(--fa-animation-duration, 1s);\n animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n animation-timing-function: var(--fa-animation-timing, ease-in-out);\n}\n\n.fa-bounce {\n animation-name: fa-bounce;\n animation-delay: var(--fa-animation-delay, 0s);\n animation-direction: var(--fa-animation-direction, normal);\n animation-duration: var(--fa-animation-duration, 1s);\n animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n animation-timing-function: var(--fa-animation-timing, cubic-bezier(0.28, 0.84, 0.42, 1));\n}\n\n.fa-fade {\n animation-name: fa-fade;\n animation-delay: var(--fa-animation-delay, 0s);\n animation-direction: var(--fa-animation-direction, normal);\n animation-duration: var(--fa-animation-duration, 1s);\n animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n animation-timing-function: var(--fa-animation-timing, cubic-bezier(0.4, 0, 0.6, 1));\n}\n\n.fa-beat-fade {\n animation-name: fa-beat-fade;\n animation-delay: var(--fa-animation-delay, 0s);\n animation-direction: var(--fa-animation-direction, normal);\n animation-duration: var(--fa-animation-duration, 1s);\n animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n animation-timing-function: var(--fa-animation-timing, cubic-bezier(0.4, 0, 0.6, 1));\n}\n\n.fa-flip {\n animation-name: fa-flip;\n animation-delay: var(--fa-animation-delay, 0s);\n animation-direction: var(--fa-animation-direction, normal);\n animation-duration: var(--fa-animation-duration, 1s);\n animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n animation-timing-function: var(--fa-animation-timing, ease-in-out);\n}\n\n.fa-shake {\n animation-name: fa-shake;\n animation-delay: var(--fa-animation-delay, 0s);\n animation-direction: var(--fa-animation-direction, normal);\n animation-duration: var(--fa-animation-duration, 1s);\n animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n animation-timing-function: var(--fa-animation-timing, linear);\n}\n\n.fa-spin {\n animation-name: fa-spin;\n animation-delay: var(--fa-animation-delay, 0s);\n animation-direction: var(--fa-animation-direction, normal);\n animation-duration: var(--fa-animation-duration, 2s);\n animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n animation-timing-function: var(--fa-animation-timing, linear);\n}\n\n.fa-spin-reverse {\n --fa-animation-direction: reverse;\n}\n\n.fa-pulse,\n.fa-spin-pulse {\n animation-name: fa-spin;\n animation-direction: var(--fa-animation-direction, normal);\n animation-duration: var(--fa-animation-duration, 1s);\n animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n animation-timing-function: var(--fa-animation-timing, steps(8));\n}\n\n@media (prefers-reduced-motion: reduce) {\n .fa-beat,\n.fa-bounce,\n.fa-fade,\n.fa-beat-fade,\n.fa-flip,\n.fa-pulse,\n.fa-shake,\n.fa-spin,\n.fa-spin-pulse {\n animation-delay: -1ms;\n animation-duration: 1ms;\n animation-iteration-count: 1;\n transition-delay: 0s;\n transition-duration: 0s;\n }\n}\n@keyframes fa-beat {\n 0%, 90% {\n transform: scale(1);\n }\n 45% {\n transform: scale(var(--fa-beat-scale, 1.25));\n }\n}\n@keyframes fa-bounce {\n 0% {\n transform: scale(1, 1) translateY(0);\n }\n 10% {\n transform: scale(var(--fa-bounce-start-scale-x, 1.1), var(--fa-bounce-start-scale-y, 0.9)) translateY(0);\n }\n 30% {\n transform: scale(var(--fa-bounce-jump-scale-x, 0.9), var(--fa-bounce-jump-scale-y, 1.1)) translateY(var(--fa-bounce-height, -0.5em));\n }\n 50% {\n transform: scale(var(--fa-bounce-land-scale-x, 1.05), var(--fa-bounce-land-scale-y, 0.95)) translateY(0);\n }\n 57% {\n transform: scale(1, 1) translateY(var(--fa-bounce-rebound, -0.125em));\n }\n 64% {\n transform: scale(1, 1) translateY(0);\n }\n 100% {\n transform: scale(1, 1) translateY(0);\n }\n}\n@keyframes fa-fade {\n 50% {\n opacity: var(--fa-fade-opacity, 0.4);\n }\n}\n@keyframes fa-beat-fade {\n 0%, 100% {\n opacity: var(--fa-beat-fade-opacity, 0.4);\n transform: scale(1);\n }\n 50% {\n opacity: 1;\n transform: scale(var(--fa-beat-fade-scale, 1.125));\n }\n}\n@keyframes fa-flip {\n 50% {\n transform: rotate3d(var(--fa-flip-x, 0), var(--fa-flip-y, 1), var(--fa-flip-z, 0), var(--fa-flip-angle, -180deg));\n }\n}\n@keyframes fa-shake {\n 0% {\n transform: rotate(-15deg);\n }\n 4% {\n transform: rotate(15deg);\n }\n 8%, 24% {\n transform: rotate(-18deg);\n }\n 12%, 28% {\n transform: rotate(18deg);\n }\n 16% {\n transform: rotate(-22deg);\n }\n 20% {\n transform: rotate(22deg);\n }\n 32% {\n transform: rotate(-12deg);\n }\n 36% {\n transform: rotate(12deg);\n }\n 40%, 100% {\n transform: rotate(0deg);\n }\n}\n@keyframes fa-spin {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n}\n.fa-rotate-90 {\n transform: rotate(90deg);\n}\n\n.fa-rotate-180 {\n transform: rotate(180deg);\n}\n\n.fa-rotate-270 {\n transform: rotate(270deg);\n}\n\n.fa-flip-horizontal {\n transform: scale(-1, 1);\n}\n\n.fa-flip-vertical {\n transform: scale(1, -1);\n}\n\n.fa-flip-both,\n.fa-flip-horizontal.fa-flip-vertical {\n transform: scale(-1, -1);\n}\n\n.fa-rotate-by {\n transform: rotate(var(--fa-rotate-angle, 0));\n}\n\n.fa-stack {\n display: inline-block;\n vertical-align: middle;\n height: 2em;\n position: relative;\n width: 2.5em;\n}\n\n.fa-stack-1x,\n.fa-stack-2x {\n bottom: 0;\n left: 0;\n margin: auto;\n position: absolute;\n right: 0;\n top: 0;\n z-index: var(--fa-stack-z-index, auto);\n}\n\n.svg-inline--fa.fa-stack-1x {\n height: 1em;\n width: 1.25em;\n}\n.svg-inline--fa.fa-stack-2x {\n height: 2em;\n width: 2.5em;\n}\n\n.fa-inverse {\n color: var(--fa-inverse, #fff);\n}\n\n.sr-only,\n.fa-sr-only {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border-width: 0;\n}\n\n.sr-only-focusable:not(:focus),\n.fa-sr-only-focusable:not(:focus) {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border-width: 0;\n}\n\n.svg-inline--fa .fa-primary {\n fill: var(--fa-primary-color, currentColor);\n opacity: var(--fa-primary-opacity, 1);\n}\n\n.svg-inline--fa .fa-secondary {\n fill: var(--fa-secondary-color, currentColor);\n opacity: var(--fa-secondary-opacity, 0.4);\n}\n\n.svg-inline--fa.fa-swap-opacity .fa-primary {\n opacity: var(--fa-secondary-opacity, 0.4);\n}\n\n.svg-inline--fa.fa-swap-opacity .fa-secondary {\n opacity: var(--fa-primary-opacity, 1);\n}\n\n.svg-inline--fa mask .fa-primary,\n.svg-inline--fa mask .fa-secondary {\n fill: black;\n}';if(i!==e||n!==t){const r=new RegExp("\\.".concat(e,"\\-"),"g"),s=new RegExp("\\--".concat(e,"\\-"),"g"),o=new RegExp("\\.".concat(t),"g");a=a.replace(r,".".concat(i,"-")).replace(s,"--".concat(i,"-")).replace(o,".".concat(n))}return a}let Fi=!1;function zi(){bi.autoAddCss&&!Fi&&(!function(e){if(!e||!Ct)return;const t=kt.createElement("style");t.setAttribute("type","text/css"),t.innerHTML=e;const i=kt.head.childNodes;let n=null;for(let e=i.length-1;e>-1;e--){const t=i[e],a=(t.tagName||"").toUpperCase();["STYLE","LINK"].indexOf(a)>-1&&(n=t)}kt.head.insertBefore(t,n)}(Ii()),Fi=!0)}var Ri={mixout:()=>({dom:{css:Ii,insertCss:zi}}),hooks:()=>({beforeDOMElementCreation(){zi()},beforeI2svg(){zi()}})};const Li=Et||{};Li[Xt]||(Li[Xt]={}),Li[Xt].styles||(Li[Xt].styles={}),Li[Xt].hooks||(Li[Xt].hooks={}),Li[Xt].shims||(Li[Xt].shims=[]);var Bi=Li[Xt];const Oi=[],Ui=function(){kt.removeEventListener("DOMContentLoaded",Ui),Ni=1,Oi.map(e=>e())};let Ni=!1;function ji(e){const{tag:t,attributes:i={},children:n=[]}=e;return"string"==typeof e?Ti(e):"<".concat(t," ").concat(function(e){return Object.keys(e||{}).reduce((t,i)=>t+"".concat(i,'="').concat(Ti(e[i]),'" '),"").trim()}(i),">").concat(n.map(ji).join(""),"</").concat(t,">")}function Vi(e,t,i){if(e&&e[t]&&e[t][i])return{prefix:t,iconName:i,icon:e[t][i]}}Ct&&(Ni=(kt.documentElement.doScroll?/^loaded|^c/:/^loaded|^i|^c/).test(kt.readyState),Ni||kt.addEventListener("DOMContentLoaded",Ui));var qi=function(e,t,i,n){var a,r,s,o=Object.keys(e),l=o.length,c=t;for(void 0===i?(a=1,s=e[o[0]]):(a=0,s=i);a<l;a++)s=c(s,e[r=o[a]],r,e);return s};function Gi(e){const t=function(e){const t=[];let i=0;const n=e.length;for(;i<n;){const a=e.charCodeAt(i++);if(a>=55296&&a<=56319&&i<n){const n=e.charCodeAt(i++);56320==(64512&n)?t.push(((1023&a)<<10)+(1023&n)+65536):(t.push(a),i--)}else t.push(a)}return t}(e);return 1===t.length?t[0].toString(16):null}function Hi(e){return Object.keys(e).reduce((t,i)=>{const n=e[i];return!!n.icon?t[n.iconName]=n.icon:t[i]=n,t},{})}function Wi(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{skipHooks:n=!1}=i,a=Hi(t);"function"!=typeof Bi.hooks.addPack||n?Bi.styles[e]=At(At({},Bi.styles[e]||{}),a):Bi.hooks.addPack(e,Hi(t)),"fas"===e&&Wi("fa",t)}const{styles:Zi,shims:Ki}=Bi,Xi=Object.keys(hi),Qi=Xi.reduce((e,t)=>(e[t]=Object.keys(hi[t]),e),{});let Yi=null,Ji={},$i={},en={},tn={},nn={};function an(e,t){const i=t.split("-"),n=i[0],a=i.slice(1).join("-");return n!==e||""===a||(r=a,~_i.indexOf(r))?null:a;var r}const rn=()=>{const e=e=>qi(Zi,(t,i,n)=>(t[n]=qi(i,e,{}),t),{});Ji=e((e,t,i)=>{if(t[3]&&(e[t[3]]=i),t[2]){t[2].filter(e=>"number"==typeof e).forEach(t=>{e[t.toString(16)]=i})}return e}),$i=e((e,t,i)=>{if(e[i]=i,t[2]){t[2].filter(e=>"string"==typeof e).forEach(t=>{e[t]=i})}return e}),nn=e((e,t,i)=>{const n=t[2];return e[i]=i,n.forEach(t=>{e[t]=i}),e});const t="far"in Zi||bi.autoFetchSvg,i=qi(Ki,(e,i)=>{const n=i[0];let a=i[1];const r=i[2];return"far"!==a||t||(a="fas"),"string"==typeof n&&(e.names[n]={prefix:a,iconName:r}),"number"==typeof n&&(e.unicodes[n.toString(16)]={prefix:a,iconName:r}),e},{names:{},unicodes:{}});en=i.names,tn=i.unicodes,Yi=un(bi.styleDefault,{family:bi.familyDefault})};function sn(e,t){return(Ji[e]||{})[t]}function on(e,t){return(nn[e]||{})[t]}function ln(e){return en[e]||{prefix:null,iconName:null}}function cn(){return Yi}!function(e){wi.push(e)}(e=>{Yi=un(e.styleDefault,{family:bi.familyDefault})}),rn();function un(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{family:i=It}=t,n=oi[i][e];if(i===Ft&&!e)return"fad";const a=ci[i][e]||ci[i][n],r=e in Bi.styles?e:null;return a||r||null}function hn(e){return e.sort().filter((e,t,i)=>i.indexOf(e)===t)}function dn(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{skipLookups:i=!1}=t;let n=null;const a=Ht.concat(qt),r=hn(e.filter(e=>a.includes(e))),s=hn(e.filter(e=>!Ht.includes(e))),o=r.filter(e=>(n=e,!Pt.includes(e))),[l=null]=o,c=function(e){let t=It;const i=Xi.reduce((e,t)=>(e[t]="".concat(bi.cssPrefix,"-").concat(t),e),{});return zt.forEach(n=>{(e.includes(i[n])||e.some(e=>Qi[n].includes(e)))&&(t=n)}),t}(r),u=At(At({},function(e){let t=[],i=null;return e.forEach(e=>{const n=an(bi.cssPrefix,e);n?i=n:e&&t.push(e)}),{iconName:i,rest:t}}(s)),{},{prefix:un(l,{family:c})});return At(At(At({},u),function(e){const{values:t,family:i,canonical:n,givenPrefix:a="",styles:r={},config:s={}}=e,o=i===Ft,l=t.includes("fa-duotone")||t.includes("fad"),c="duotone"===s.familyDefault,u="fad"===n.prefix||"fa-duotone"===n.prefix;!o&&(l||c||u)&&(n.prefix="fad");(t.includes("fa-brands")||t.includes("fab"))&&(n.prefix="fab");if(!n.prefix&&pn.includes(i)){const e=Object.keys(r).find(e=>mn.includes(e));if(e||s.autoFetchSvg){const e=Rt.get(i).defaultShortPrefixId;n.prefix=e,n.iconName=on(n.prefix,n.iconName)||n.iconName}}"fa"!==n.prefix&&"fa"!==a||(n.prefix=cn()||"fas");return n}({values:e,family:c,styles:Zi,config:bi,canonical:u,givenPrefix:n})),function(e,t,i){let{prefix:n,iconName:a}=i;if(e||!n||!a)return{prefix:n,iconName:a};const r="fa"===t?ln(a):{},s=on(n,a);a=r.iconName||s||a,n=r.prefix||n,"far"!==n||Zi.far||!Zi.fas||bi.autoFetchSvg||(n="fas");return{prefix:n,iconName:a}}(i,n,u))}const pn=zt.filter(e=>e!==It||e!==Ft),mn=Object.keys(Gt).filter(e=>e!==It).map(e=>Object.keys(Gt[e])).flat();let gn=[],fn={};const An={},_n=Object.keys(An);function vn(e,t){for(var i=arguments.length,n=new Array(i>2?i-2:0),a=2;a<i;a++)n[a-2]=arguments[a];return(fn[e]||[]).forEach(e=>{t=e.apply(null,[t,...n])}),t}function yn(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),n=1;n<t;n++)i[n-1]=arguments[n];(fn[e]||[]).forEach(e=>{e.apply(null,i)})}function xn(){const e=arguments[0],t=Array.prototype.slice.call(arguments,1);return An[e]?An[e].apply(null,t):void 0}function bn(e){"fa"===e.prefix&&(e.prefix="fas");let{iconName:t}=e;const i=e.prefix||cn();if(t)return t=on(i,t)||t,Vi(wn.definitions,i,t)||Vi(Bi.styles,i,t)}const wn=new class{constructor(){this.definitions={}}add(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];const n=t.reduce(this._pullDefinitions,{});Object.keys(n).forEach(e=>{this.definitions[e]=At(At({},this.definitions[e]||{}),n[e]),Wi(e,n[e]);const t=hi[It][e];t&&Wi(t,n[e]),rn()})}reset(){this.definitions={}}_pullDefinitions(e,t){const i=t.prefix&&t.iconName&&t.icon?{0:t}:t;return Object.keys(i).map(t=>{const{prefix:n,iconName:a,icon:r}=i[t],s=r[2];e[n]||(e[n]={}),s.length>0&&s.forEach(t=>{"string"==typeof t&&(e[n][t]=r)}),e[n][a]=r}),e}},En={i2svg:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Ct?(yn("beforeI2svg",e),xn("pseudoElements2svg",e),xn("i2svg",e)):Promise.reject(new Error("Operation requires a DOM of some kind."))},watch:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{autoReplaceSvgRoot:t}=e;!1===bi.autoReplaceSvg&&(bi.autoReplaceSvg=!0),bi.observeMutations=!0,function(e){Ct&&(Ni?setTimeout(e,0):Oi.push(e))}(()=>{Mn({autoReplaceSvgRoot:t}),yn("watch",e)})}},kn={icon:e=>{if(null===e)return null;if("object"==typeof e&&e.prefix&&e.iconName)return{prefix:e.prefix,iconName:on(e.prefix,e.iconName)||e.iconName};if(Array.isArray(e)&&2===e.length){const t=0===e[1].indexOf("fa-")?e[1].slice(3):e[1],i=un(e[0]);return{prefix:i,iconName:on(i,t)||t}}if("string"==typeof e&&(e.indexOf("".concat(bi.cssPrefix,"-"))>-1||e.match(pi))){const t=dn(e.split(" "),{skipLookups:!0});return{prefix:t.prefix||cn(),iconName:on(t.prefix,t.iconName)||t.iconName}}if("string"==typeof e){const t=cn();return{prefix:t,iconName:on(t,e)||e}}}},Sn={noAuto:()=>{bi.autoReplaceSvg=!1,bi.observeMutations=!1,yn("noAuto")},config:bi,dom:En,parse:kn,library:wn,findIconDefinition:bn,toHtml:ji},Mn=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{autoReplaceSvgRoot:t=kt}=e;(Object.keys(Bi.styles).length>0||bi.autoFetchSvg)&&Ct&&bi.autoReplaceSvg&&Sn.dom.i2svg({node:t})};function Cn(e,t){return Object.defineProperty(e,"abstract",{get:t}),Object.defineProperty(e,"html",{get:function(){return e.abstract.map(e=>ji(e))}}),Object.defineProperty(e,"node",{get:function(){if(!Ct)return;const t=kt.createElement("div");return t.innerHTML=e.html,t.children}}),e}function Tn(e){const{icons:{main:t,mask:i},prefix:n,iconName:a,transform:r,symbol:s,title:o,maskId:l,titleId:c,extra:u,watchable:h=!1}=e,{width:d,height:p}=i.found?i:t,m=Ut.includes(n),g=[bi.replacementClass,a?"".concat(bi.cssPrefix,"-").concat(a):""].filter(e=>-1===u.classes.indexOf(e)).filter(e=>""!==e||!!e).concat(u.classes).join(" ");let f={children:[],attributes:At(At({},u.attributes),{},{"data-prefix":n,"data-icon":a,class:g,role:u.attributes.role||"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 ".concat(d," ").concat(p)})};const A=m&&!~u.classes.indexOf("fa-fw")?{width:"".concat(d/p*16*.0625,"em")}:{};h&&(f.attributes[Jt]=""),o&&(f.children.push({tag:"title",attributes:{id:f.attributes["aria-labelledby"]||"title-".concat(c||Si())},children:[o]}),delete f.attributes.title);const _=At(At({},f),{},{prefix:n,iconName:a,main:t,mask:i,maskId:l,transform:r,symbol:s,styles:At(At({},A),u.styles)}),{children:v,attributes:y}=i.found&&t.found?xn("generateAbstractMask",_)||{children:[],attributes:{}}:xn("generateAbstractIcon",_)||{children:[],attributes:{}};return _.children=v,_.attributes=y,s?function(e){let{prefix:t,iconName:i,children:n,attributes:a,symbol:r}=e;const s=!0===r?"".concat(t,"-").concat(bi.cssPrefix,"-").concat(i):r;return[{tag:"svg",attributes:{style:"display: none;"},children:[{tag:"symbol",attributes:At(At({},a),{},{id:s}),children:n}]}]}(_):function(e){let{children:t,main:i,mask:n,attributes:a,styles:r,transform:s}=e;if(Pi(s)&&i.found&&!n.found){const{width:e,height:t}=i,n={x:e/t/2,y:.5};a.style=Di(At(At({},r),{},{"transform-origin":"".concat(n.x+s.x/16,"em ").concat(n.y+s.y/16,"em")}))}return[{tag:"svg",attributes:a,children:t}]}(_)}function Dn(e){const{content:t,width:i,height:n,transform:a,title:r,extra:s,watchable:o=!1}=e,l=At(At(At({},s.attributes),r?{title:r}:{}),{},{class:s.classes.join(" ")});o&&(l[Jt]="");const c=At({},s.styles);Pi(a)&&(c.transform=function(e){let{transform:t,width:i=Qt,height:n=Qt,startCentered:a=!1}=e,r="";return r+=a&&Tt?"translate(".concat(t.x/Ei-i/2,"em, ").concat(t.y/Ei-n/2,"em) "):a?"translate(calc(-50% + ".concat(t.x/Ei,"em), calc(-50% + ").concat(t.y/Ei,"em)) "):"translate(".concat(t.x/Ei,"em, ").concat(t.y/Ei,"em) "),r+="scale(".concat(t.size/Ei*(t.flipX?-1:1),", ").concat(t.size/Ei*(t.flipY?-1:1),") "),r+="rotate(".concat(t.rotate,"deg) "),r}({transform:a,startCentered:!0,width:i,height:n}),c["-webkit-transform"]=c.transform);const u=Di(c);u.length>0&&(l.style=u);const h=[];return h.push({tag:"span",attributes:l,children:[t]}),r&&h.push({tag:"span",attributes:{class:"sr-only"},children:[r]}),h}const{styles:Pn}=Bi;function In(e){const t=e[0],i=e[1],[n]=e.slice(4);let a=null;return a=Array.isArray(n)?{tag:"g",attributes:{class:"".concat(bi.cssPrefix,"-").concat(Ai.GROUP)},children:[{tag:"path",attributes:{class:"".concat(bi.cssPrefix,"-").concat(Ai.SECONDARY),fill:"currentColor",d:n[0]}},{tag:"path",attributes:{class:"".concat(bi.cssPrefix,"-").concat(Ai.PRIMARY),fill:"currentColor",d:n[1]}}]}:{tag:"path",attributes:{fill:"currentColor",d:n}},{found:!0,width:t,height:i,icon:a}}const Fn={found:!1,width:512,height:512};function zn(e,t){let i=t;return"fa"===t&&null!==bi.styleDefault&&(t=cn()),new Promise((n,a)=>{if("fa"===i){const i=ln(e)||{};e=i.iconName||e,t=i.prefix||t}if(e&&t&&Pn[t]&&Pn[t][e]){return n(In(Pn[t][e]))}!function(e,t){ai||bi.showMissingIcons||!e||console.error('Icon with name "'.concat(e,'" and prefix "').concat(t,'" is missing.'))}(e,t),n(At(At({},Fn),{},{icon:bi.showMissingIcons&&e&&xn("missingIconAbstract")||{}}))})}const Rn=()=>{},Ln=bi.measurePerformance&&Mt&&Mt.mark&&Mt.measure?Mt:{mark:Rn,measure:Rn},Bn='FA "6.7.2"',On=e=>{Ln.mark("".concat(Bn," ").concat(e," ends")),Ln.measure("".concat(Bn," ").concat(e),"".concat(Bn," ").concat(e," begins"),"".concat(Bn," ").concat(e," ends"))};var Un=e=>(Ln.mark("".concat(Bn," ").concat(e," begins")),()=>On(e));const Nn=()=>{};function jn(e){return"string"==typeof(e.getAttribute?e.getAttribute(Jt):null)}function Vn(e){return kt.createElementNS("http://www.w3.org/2000/svg",e)}function qn(e){return kt.createElement(e)}function Gn(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{ceFn:i=("svg"===e.tag?Vn:qn)}=t;if("string"==typeof e)return kt.createTextNode(e);const n=i(e.tag);Object.keys(e.attributes||[]).forEach(function(t){n.setAttribute(t,e.attributes[t])});return(e.children||[]).forEach(function(e){n.appendChild(Gn(e,{ceFn:i}))}),n}const Hn={replace:function(e){const t=e[0];if(t.parentNode)if(e[1].forEach(e=>{t.parentNode.insertBefore(Gn(e),t)}),null===t.getAttribute(Jt)&&bi.keepOriginalSource){let e=kt.createComment(function(e){let t=" ".concat(e.outerHTML," ");return t="".concat(t,"Font Awesome fontawesome.com "),t}(t));t.parentNode.replaceChild(e,t)}else t.remove()},nest:function(e){const t=e[0],i=e[1];if(~Ci(t).indexOf(bi.replacementClass))return Hn.replace(e);const n=new RegExp("".concat(bi.cssPrefix,"-.*"));if(delete i[0].attributes.id,i[0].attributes.class){const e=i[0].attributes.class.split(" ").reduce((e,t)=>(t===bi.replacementClass||t.match(n)?e.toSvg.push(t):e.toNode.push(t),e),{toNode:[],toSvg:[]});i[0].attributes.class=e.toSvg.join(" "),0===e.toNode.length?t.removeAttribute("class"):t.setAttribute("class",e.toNode.join(" "))}const a=i.map(e=>ji(e)).join("\n");t.setAttribute(Jt,""),t.innerHTML=a}};function Wn(e){e()}function Zn(e,t){const i="function"==typeof t?t:Nn;if(0===e.length)i();else{let t=Wn;"async"===bi.mutateApproach&&(t=Et.requestAnimationFrame||Wn),t(()=>{const t=!0===bi.autoReplaceSvg?Hn.replace:Hn[bi.autoReplaceSvg]||Hn.replace,n=Un("mutate");e.map(t),n(),i()})}}let Kn=!1;function Xn(){Kn=!0}function Qn(){Kn=!1}let Yn=null;function Jn(e){if(!St)return;if(!bi.observeMutations)return;const{treeCallback:t=Nn,nodeCallback:i=Nn,pseudoElementsCallback:n=Nn,observeMutationsRoot:a=kt}=e;Yn=new St(e=>{if(Kn)return;const a=cn();Mi(e).forEach(e=>{if("childList"===e.type&&e.addedNodes.length>0&&!jn(e.addedNodes[0])&&(bi.searchPseudoElements&&n(e.target),t(e.target)),"attributes"===e.type&&e.target.parentNode&&bi.searchPseudoElements&&n(e.target.parentNode),"attributes"===e.type&&jn(e.target)&&~fi.indexOf(e.attributeName))if("class"===e.attributeName&&function(e){const t=e.getAttribute?e.getAttribute(ei):null,i=e.getAttribute?e.getAttribute(ti):null;return t&&i}(e.target)){const{prefix:t,iconName:i}=dn(Ci(e.target));e.target.setAttribute(ei,t||a),i&&e.target.setAttribute(ti,i)}else(r=e.target)&&r.classList&&r.classList.contains&&r.classList.contains(bi.replacementClass)&&i(e.target);var r})}),Ct&&Yn.observe(a,{childList:!0,attributes:!0,characterData:!0,subtree:!0})}function $n(e){const t=e.getAttribute("data-prefix"),i=e.getAttribute("data-icon"),n=void 0!==e.innerText?e.innerText.trim():"";let a=dn(Ci(e));return a.prefix||(a.prefix=cn()),t&&i&&(a.prefix=t,a.iconName=i),a.iconName&&a.prefix||(a.prefix&&n.length>0&&(a.iconName=(r=a.prefix,s=e.innerText,($i[r]||{})[s]||sn(a.prefix,Gi(e.innerText)))),!a.iconName&&bi.autoFetchSvg&&e.firstChild&&e.firstChild.nodeType===Node.TEXT_NODE&&(a.iconName=e.firstChild.data)),a;var r,s}function ea(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{styleParser:!0};const{iconName:i,prefix:n,rest:a}=$n(e),r=function(e){const t=Mi(e.attributes).reduce((e,t)=>("class"!==e.name&&"style"!==e.name&&(e[t.name]=t.value),e),{}),i=e.getAttribute("title"),n=e.getAttribute("data-fa-title-id");return bi.autoA11y&&(i?t["aria-labelledby"]="".concat(bi.replacementClass,"-title-").concat(n||Si()):(t["aria-hidden"]="true",t.focusable="false")),t}(e),s=vn("parseNodeAttributes",{},e);let o=t.styleParser?function(e){const t=e.getAttribute("style");let i=[];return t&&(i=t.split(";").reduce((e,t)=>{const i=t.split(":"),n=i[0],a=i.slice(1);return n&&a.length>0&&(e[n]=a.join(":").trim()),e},{})),i}(e):[];return At({iconName:i,title:e.getAttribute("title"),titleId:e.getAttribute("data-fa-title-id"),prefix:n,transform:ki,mask:{iconName:null,prefix:null,rest:[]},maskId:null,symbol:!1,extra:{classes:a,styles:o,attributes:r}},s)}const{styles:ta}=Bi;function ia(e){const t="nest"===bi.autoReplaceSvg?ea(e,{styleParser:!1}):ea(e);return~t.extra.classes.indexOf(mi)?xn("generateLayersText",e,t):xn("generateSvgReplacementMutation",e,t)}function na(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(!Ct)return Promise.resolve();const i=kt.documentElement.classList,n=e=>i.add("".concat(ii,"-").concat(e)),a=e=>i.remove("".concat(ii,"-").concat(e)),r=bi.autoFetchSvg?[...Lt,...Ht]:Pt.concat(Object.keys(ta));r.includes("fa")||r.push("fa");const s=[".".concat(mi,":not([").concat(Jt,"])")].concat(r.map(e=>".".concat(e,":not([").concat(Jt,"])"))).join(", ");if(0===s.length)return Promise.resolve();let o=[];try{o=Mi(e.querySelectorAll(s))}catch(e){}if(!(o.length>0))return Promise.resolve();n("pending"),a("complete");const l=Un("onTree"),c=o.reduce((e,t)=>{try{const i=ia(t);i&&e.push(i)}catch(e){ai||"MissingIcon"===e.name&&console.error(e)}return e},[]);return new Promise((e,i)=>{Promise.all(c).then(i=>{Zn(i,()=>{n("active"),n("complete"),a("pending"),"function"==typeof t&&t(),l(),e()})}).catch(e=>{l(),i(e)})})}function aa(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;ia(e).then(e=>{e&&Zn([e],t)})}const ra=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{transform:i=ki,symbol:n=!1,mask:a=null,maskId:r=null,title:s=null,titleId:o=null,classes:l=[],attributes:c={},styles:u={}}=t;if(!e)return;const{prefix:h,iconName:d,icon:p}=e;return Cn(At({type:"icon"},e),()=>(yn("beforeDOMElementCreation",{iconDefinition:e,params:t}),bi.autoA11y&&(s?c["aria-labelledby"]="".concat(bi.replacementClass,"-title-").concat(o||Si()):(c["aria-hidden"]="true",c.focusable="false")),Tn({icons:{main:In(p),mask:a?In(a.icon):{found:!1,width:null,height:null,icon:{}}},prefix:h,iconName:d,transform:At(At({},ki),i),symbol:n,title:s,maskId:r,titleId:o,extra:{attributes:c,styles:u,classes:l}})))};var sa={mixout(){return{icon:(e=ra,function(t){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=(t||{}).icon?t:bn(t||{});let{mask:a}=i;return a&&(a=(a||{}).icon?a:bn(a||{})),e(n,At(At({},i),{},{mask:a}))})};var e},hooks:()=>({mutationObserverCallbacks:e=>(e.treeCallback=na,e.nodeCallback=aa,e)}),provides(e){e.i2svg=function(e){const{node:t=kt,callback:i=()=>{}}=e;return na(t,i)},e.generateSvgReplacementMutation=function(e,t){const{iconName:i,title:n,titleId:a,prefix:r,transform:s,symbol:o,mask:l,maskId:c,extra:u}=t;return new Promise((t,h)=>{Promise.all([zn(i,r),l.iconName?zn(l.iconName,l.prefix):Promise.resolve({found:!1,width:512,height:512,icon:{}})]).then(l=>{let[h,d]=l;t([e,Tn({icons:{main:h,mask:d},prefix:r,iconName:i,transform:s,symbol:o,maskId:c,title:n,titleId:a,extra:u,watchable:!0})])}).catch(h)})},e.generateAbstractIcon=function(e){let{children:t,attributes:i,main:n,transform:a,styles:r}=e;const s=Di(r);let o;return s.length>0&&(i.style=s),Pi(a)&&(o=xn("generateAbstractTransformGrouping",{main:n,transform:a,containerWidth:n.width,iconWidth:n.width})),t.push(o||n.icon),{children:t,attributes:i}}}},oa={mixout:()=>({layer(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{classes:i=[]}=t;return Cn({type:"layer"},()=>{yn("beforeDOMElementCreation",{assembler:e,params:t});let n=[];return e(e=>{Array.isArray(e)?e.map(e=>{n=n.concat(e.abstract)}):n=n.concat(e.abstract)}),[{tag:"span",attributes:{class:["".concat(bi.cssPrefix,"-layers"),...i].join(" ")},children:n}]})}})},la={mixout:()=>({counter(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{title:i=null,classes:n=[],attributes:a={},styles:r={}}=t;return Cn({type:"counter",content:e},()=>(yn("beforeDOMElementCreation",{content:e,params:t}),function(e){const{content:t,title:i,extra:n}=e,a=At(At(At({},n.attributes),i?{title:i}:{}),{},{class:n.classes.join(" ")}),r=Di(n.styles);r.length>0&&(a.style=r);const s=[];return s.push({tag:"span",attributes:a,children:[t]}),i&&s.push({tag:"span",attributes:{class:"sr-only"},children:[i]}),s}({content:e.toString(),title:i,extra:{attributes:a,styles:r,classes:["".concat(bi.cssPrefix,"-layers-counter"),...n]}})))}})},ca={mixout:()=>({text(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{transform:i=ki,title:n=null,classes:a=[],attributes:r={},styles:s={}}=t;return Cn({type:"text",content:e},()=>(yn("beforeDOMElementCreation",{content:e,params:t}),Dn({content:e,transform:At(At({},ki),i),title:n,extra:{attributes:r,styles:s,classes:["".concat(bi.cssPrefix,"-layers-text"),...a]}})))}}),provides(e){e.generateLayersText=function(e,t){const{title:i,transform:n,extra:a}=t;let r=null,s=null;if(Tt){const t=parseInt(getComputedStyle(e).fontSize,10),i=e.getBoundingClientRect();r=i.width/t,s=i.height/t}return bi.autoA11y&&!i&&(a.attributes["aria-hidden"]="true"),Promise.resolve([e,Dn({content:e.innerHTML,width:r,height:s,transform:n,title:i,extra:a,watchable:!0})])}}};const ua=new RegExp('"',"ug"),ha=[1105920,1112319],da=At(At(At(At({},{FontAwesome:{normal:"fas",400:"fas"}}),{"Font Awesome 6 Free":{900:"fas",400:"far"},"Font Awesome 6 Pro":{900:"fas",400:"far",normal:"far",300:"fal",100:"fat"},"Font Awesome 6 Brands":{400:"fab",normal:"fab"},"Font Awesome 6 Duotone":{900:"fad",400:"fadr",normal:"fadr",300:"fadl",100:"fadt"},"Font Awesome 6 Sharp":{900:"fass",400:"fasr",normal:"fasr",300:"fasl",100:"fast"},"Font Awesome 6 Sharp Duotone":{900:"fasds",400:"fasdr",normal:"fasdr",300:"fasdl",100:"fasdt"}}),{"Font Awesome 5 Free":{900:"fas",400:"far"},"Font Awesome 5 Pro":{900:"fas",400:"far",normal:"far",300:"fal"},"Font Awesome 5 Brands":{400:"fab",normal:"fab"},"Font Awesome 5 Duotone":{900:"fad"}}),{"Font Awesome Kit":{400:"fak",normal:"fak"},"Font Awesome Kit Duotone":{400:"fakd",normal:"fakd"}}),pa=Object.keys(da).reduce((e,t)=>(e[t.toLowerCase()]=da[t],e),{}),ma=Object.keys(pa).reduce((e,t)=>{const i=pa[t];return e[t]=i[900]||[...Object.entries(i)][0][1],e},{});function ga(e,t){const i="".concat("data-fa-pseudo-element-pending").concat(t.replace(":","-"));return new Promise((n,a)=>{if(null!==e.getAttribute(i))return n();const r=Mi(e.children).filter(e=>e.getAttribute($t)===t)[0],s=Et.getComputedStyle(e,t),o=s.getPropertyValue("font-family"),l=o.match(gi),c=s.getPropertyValue("font-weight"),u=s.getPropertyValue("content");if(r&&!l)return e.removeChild(r),n();if(l&&"none"!==u&&""!==u){const u=s.getPropertyValue("content");let h=function(e,t){const i=e.replace(/^['"]|['"]$/g,"").toLowerCase(),n=parseInt(t),a=isNaN(n)?"normal":n;return(pa[i]||{})[a]||ma[i]}(o,c);const{value:d,isSecondary:p}=function(e){const t=e.replace(ua,""),i=function(e,t){const i=e.length;let n,a=e.charCodeAt(t);return a>=55296&&a<=56319&&i>t+1&&(n=e.charCodeAt(t+1),n>=56320&&n<=57343)?1024*(a-55296)+n-56320+65536:a}(t,0),n=i>=ha[0]&&i<=ha[1],a=2===t.length&&t[0]===t[1];return{value:Gi(a?t[0]:t),isSecondary:n||a}}(u),m=l[0].startsWith("FontAwesome");let g=sn(h,d),f=g;if(m){const e=function(e){const t=tn[e],i=sn("fas",e);return t||(i?{prefix:"fas",iconName:i}:null)||{prefix:null,iconName:null}}(d);e.iconName&&e.prefix&&(g=e.iconName,h=e.prefix)}if(!g||p||r&&r.getAttribute(ei)===h&&r.getAttribute(ti)===f)n();else{e.setAttribute(i,f),r&&e.removeChild(r);const s={iconName:null,title:null,titleId:null,prefix:null,transform:ki,symbol:!1,mask:{iconName:null,prefix:null,rest:[]},maskId:null,extra:{classes:[],styles:{},attributes:{}}},{extra:o}=s;o.attributes[$t]=t,zn(g,h).then(a=>{const r=Tn(At(At({},s),{},{icons:{main:a,mask:{prefix:null,iconName:null,rest:[]}},prefix:h,iconName:f,extra:o,watchable:!0})),l=kt.createElementNS("http://www.w3.org/2000/svg","svg");"::before"===t?e.insertBefore(l,e.firstChild):e.appendChild(l),l.outerHTML=r.map(e=>ji(e)).join("\n"),e.removeAttribute(i),n()}).catch(a)}}else n()})}function fa(e){return Promise.all([ga(e,"::before"),ga(e,"::after")])}function Aa(e){return!(e.parentNode===document.head||~ni.indexOf(e.tagName.toUpperCase())||e.getAttribute($t)||e.parentNode&&"svg"===e.parentNode.tagName)}function _a(e){if(Ct)return new Promise((t,i)=>{const n=Mi(e.querySelectorAll("*")).filter(Aa).map(fa),a=Un("searchPseudoElements");Xn(),Promise.all(n).then(()=>{a(),Qn(),t()}).catch(()=>{a(),Qn(),i()})})}var va={hooks:()=>({mutationObserverCallbacks:e=>(e.pseudoElementsCallback=_a,e)}),provides(e){e.pseudoElements2svg=function(e){const{node:t=kt}=e;bi.searchPseudoElements&&_a(t)}}};let ya=!1;var xa={mixout:()=>({dom:{unwatch(){Xn(),ya=!0}}}),hooks:()=>({bootstrap(){Jn(vn("mutationObserverCallbacks",{}))},noAuto(){Yn&&Yn.disconnect()},watch(e){const{observeMutationsRoot:t}=e;ya?Qn():Jn(vn("mutationObserverCallbacks",{observeMutationsRoot:t}))}})};const ba=e=>e.toLowerCase().split(" ").reduce((e,t)=>{const i=t.toLowerCase().split("-"),n=i[0];let a=i.slice(1).join("-");if(n&&"h"===a)return e.flipX=!0,e;if(n&&"v"===a)return e.flipY=!0,e;if(a=parseFloat(a),isNaN(a))return e;switch(n){case"grow":e.size=e.size+a;break;case"shrink":e.size=e.size-a;break;case"left":e.x=e.x-a;break;case"right":e.x=e.x+a;break;case"up":e.y=e.y-a;break;case"down":e.y=e.y+a;break;case"rotate":e.rotate=e.rotate+a}return e},{size:16,x:0,y:0,flipX:!1,flipY:!1,rotate:0});var wa={mixout:()=>({parse:{transform:e=>ba(e)}}),hooks:()=>({parseNodeAttributes(e,t){const i=t.getAttribute("data-fa-transform");return i&&(e.transform=ba(i)),e}}),provides(e){e.generateAbstractTransformGrouping=function(e){let{main:t,transform:i,containerWidth:n,iconWidth:a}=e;const r={transform:"translate(".concat(n/2," 256)")},s="translate(".concat(32*i.x,", ").concat(32*i.y,") "),o="scale(".concat(i.size/16*(i.flipX?-1:1),", ").concat(i.size/16*(i.flipY?-1:1),") "),l="rotate(".concat(i.rotate," 0 0)"),c={outer:r,inner:{transform:"".concat(s," ").concat(o," ").concat(l)},path:{transform:"translate(".concat(a/2*-1," -256)")}};return{tag:"g",attributes:At({},c.outer),children:[{tag:"g",attributes:At({},c.inner),children:[{tag:t.icon.tag,children:t.icon.children,attributes:At(At({},t.icon.attributes),c.path)}]}]}}}};const Ea={x:0,y:0,width:"100%",height:"100%"};function ka(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return e.attributes&&(e.attributes.fill||t)&&(e.attributes.fill="black"),e}var Sa={hooks:()=>({parseNodeAttributes(e,t){const i=t.getAttribute("data-fa-mask"),n=i?dn(i.split(" ").map(e=>e.trim())):{prefix:null,iconName:null,rest:[]};return n.prefix||(n.prefix=cn()),e.mask=n,e.maskId=t.getAttribute("data-fa-mask-id"),e}}),provides(e){e.generateAbstractMask=function(e){let{children:t,attributes:i,main:n,mask:a,maskId:r,transform:s}=e;const{width:o,icon:l}=n,{width:c,icon:u}=a,h=function(e){let{transform:t,containerWidth:i,iconWidth:n}=e;const a={transform:"translate(".concat(i/2," 256)")},r="translate(".concat(32*t.x,", ").concat(32*t.y,") "),s="scale(".concat(t.size/16*(t.flipX?-1:1),", ").concat(t.size/16*(t.flipY?-1:1),") "),o="rotate(".concat(t.rotate," 0 0)");return{outer:a,inner:{transform:"".concat(r," ").concat(s," ").concat(o)},path:{transform:"translate(".concat(n/2*-1," -256)")}}}({transform:s,containerWidth:c,iconWidth:o}),d={tag:"rect",attributes:At(At({},Ea),{},{fill:"white"})},p=l.children?{children:l.children.map(ka)}:{},m={tag:"g",attributes:At({},h.inner),children:[ka(At({tag:l.tag,attributes:At(At({},l.attributes),h.path)},p))]},g={tag:"g",attributes:At({},h.outer),children:[m]},f="mask-".concat(r||Si()),A="clip-".concat(r||Si()),_={tag:"mask",attributes:At(At({},Ea),{},{id:f,maskUnits:"userSpaceOnUse",maskContentUnits:"userSpaceOnUse"}),children:[d,g]},v={tag:"defs",children:[{tag:"clipPath",attributes:{id:A},children:(y=u,"g"===y.tag?y.children:[y])},_]};var y;return t.push(v,{tag:"rect",attributes:At({fill:"currentColor","clip-path":"url(#".concat(A,")"),mask:"url(#".concat(f,")")},Ea)}),{children:t,attributes:i}}}},Ma={provides(e){let t=!1;Et.matchMedia&&(t=Et.matchMedia("(prefers-reduced-motion: reduce)").matches),e.missingIconAbstract=function(){const e=[],i={fill:"currentColor"},n={attributeType:"XML",repeatCount:"indefinite",dur:"2s"};e.push({tag:"path",attributes:At(At({},i),{},{d:"M156.5,447.7l-12.6,29.5c-18.7-9.5-35.9-21.2-51.5-34.9l22.7-22.7C127.6,430.5,141.5,440,156.5,447.7z M40.6,272H8.5 c1.4,21.2,5.4,41.7,11.7,61.1L50,321.2C45.1,305.5,41.8,289,40.6,272z M40.6,240c1.4-18.8,5.2-37,11.1-54.1l-29.5-12.6 C14.7,194.3,10,216.7,8.5,240H40.6z M64.3,156.5c7.8-14.9,17.2-28.8,28.1-41.5L69.7,92.3c-13.7,15.6-25.5,32.8-34.9,51.5 L64.3,156.5z M397,419.6c-13.9,12-29.4,22.3-46.1,30.4l11.9,29.8c20.7-9.9,39.8-22.6,56.9-37.6L397,419.6z M115,92.4 c13.9-12,29.4-22.3,46.1-30.4l-11.9-29.8c-20.7,9.9-39.8,22.6-56.8,37.6L115,92.4z M447.7,355.5c-7.8,14.9-17.2,28.8-28.1,41.5 l22.7,22.7c13.7-15.6,25.5-32.9,34.9-51.5L447.7,355.5z M471.4,272c-1.4,18.8-5.2,37-11.1,54.1l29.5,12.6 c7.5-21.1,12.2-43.5,13.6-66.8H471.4z M321.2,462c-15.7,5-32.2,8.2-49.2,9.4v32.1c21.2-1.4,41.7-5.4,61.1-11.7L321.2,462z M240,471.4c-18.8-1.4-37-5.2-54.1-11.1l-12.6,29.5c21.1,7.5,43.5,12.2,66.8,13.6V471.4z M462,190.8c5,15.7,8.2,32.2,9.4,49.2h32.1 c-1.4-21.2-5.4-41.7-11.7-61.1L462,190.8z M92.4,397c-12-13.9-22.3-29.4-30.4-46.1l-29.8,11.9c9.9,20.7,22.6,39.8,37.6,56.9 L92.4,397z M272,40.6c18.8,1.4,36.9,5.2,54.1,11.1l12.6-29.5C317.7,14.7,295.3,10,272,8.5V40.6z M190.8,50 c15.7-5,32.2-8.2,49.2-9.4V8.5c-21.2,1.4-41.7,5.4-61.1,11.7L190.8,50z M442.3,92.3L419.6,115c12,13.9,22.3,29.4,30.5,46.1 l29.8-11.9C470,128.5,457.3,109.4,442.3,92.3z M397,92.4l22.7-22.7c-15.6-13.7-32.8-25.5-51.5-34.9l-12.6,29.5 C370.4,72.1,384.4,81.5,397,92.4z"})});const a=At(At({},n),{},{attributeName:"opacity"}),r={tag:"circle",attributes:At(At({},i),{},{cx:"256",cy:"364",r:"28"}),children:[]};return t||r.children.push({tag:"animate",attributes:At(At({},n),{},{attributeName:"r",values:"28;14;28;28;14;28;"})},{tag:"animate",attributes:At(At({},a),{},{values:"1;0;1;1;0;1;"})}),e.push(r),e.push({tag:"path",attributes:At(At({},i),{},{opacity:"1",d:"M263.7,312h-16c-6.6,0-12-5.4-12-12c0-71,77.4-63.9,77.4-107.8c0-20-17.8-40.2-57.4-40.2c-29.1,0-44.3,9.6-59.2,28.7 c-3.9,5-11.1,6-16.2,2.4l-13.1-9.2c-5.6-3.9-6.9-11.8-2.6-17.2c21.2-27.2,46.4-44.7,91.2-44.7c52.3,0,97.4,29.8,97.4,80.2 c0,67.6-77.4,63.5-77.4,107.8C275.7,306.6,270.3,312,263.7,312z"}),children:t?[]:[{tag:"animate",attributes:At(At({},a),{},{values:"1;0;0;0;0;1;"})}]}),t||e.push({tag:"path",attributes:At(At({},i),{},{opacity:"0",d:"M232.5,134.5l7,168c0.3,6.4,5.6,11.5,12,11.5h9c6.4,0,11.7-5.1,12-11.5l7-168c0.3-6.8-5.2-12.5-12-12.5h-23 C237.7,122,232.2,127.7,232.5,134.5z"}),children:[{tag:"animate",attributes:At(At({},a),{},{values:"0;0;1;1;0;0;"})}]}),{tag:"g",attributes:{class:"missing"},children:e}}}};!function(e,t){let{mixoutsTo:i}=t;gn=e,fn={},Object.keys(An).forEach(e=>{-1===_n.indexOf(e)&&delete An[e]}),gn.forEach(e=>{const t=e.mixout?e.mixout():{};if(Object.keys(t).forEach(e=>{"function"==typeof t[e]&&(i[e]=t[e]),"object"==typeof t[e]&&Object.keys(t[e]).forEach(n=>{i[e]||(i[e]={}),i[e][n]=t[e][n]})}),e.hooks){const t=e.hooks();Object.keys(t).forEach(e=>{fn[e]||(fn[e]=[]),fn[e].push(t[e])})}e.provides&&e.provides(An)})}([Ri,sa,oa,la,ca,va,xa,wa,Sa,Ma,{hooks:()=>({parseNodeAttributes(e,t){const i=t.getAttribute("data-fa-symbol"),n=null!==i&&(""===i||i);return e.symbol=n,e}})}],{mixoutsTo:Sn});const Ca=Sn.icon,Ta=Object.freeze({left:0,top:0,width:16,height:16}),Da=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),Pa=Object.freeze({...Ta,...Da}),Ia=Object.freeze({...Pa,body:"",hidden:!1}),Fa=Object.freeze({width:null,height:null}),za=Object.freeze({...Fa,...Da});const Ra=/[\s,]+/;const La={...za,preserveAspectRatio:""};function Ba(e){const t={...La},i=(t,i)=>e.getAttribute(t)||i;var n;return t.width=i("width",null),t.height=i("height",null),t.rotate=function(e,t=0){const i=e.replace(/^-?[0-9.]*/,"");function n(e){for(;e<0;)e+=4;return e%4}if(""===i){const t=parseInt(e);return isNaN(t)?0:n(t)}if(i!==e){let t=0;switch(i){case"%":t=25;break;case"deg":t=90}if(t){let a=parseFloat(e.slice(0,e.length-i.length));return isNaN(a)?0:(a/=t,a%1==0?n(a):0)}}return t}(i("rotate","")),n=t,i("flip","").split(Ra).forEach(e=>{switch(e.trim()){case"horizontal":n.hFlip=!0;break;case"vertical":n.vFlip=!0}}),t.preserveAspectRatio=i("preserveAspectRatio",i("preserveaspectratio","")),t}const Oa=/^[a-z0-9]+(-[a-z0-9]+)*$/,Ua=(e,t,i,n="")=>{const a=e.split(":");if("@"===e.slice(0,1)){if(a.length<2||a.length>3)return null;n=a.shift().slice(1)}if(a.length>3||!a.length)return null;if(a.length>1){const e=a.pop(),i=a.pop(),r={provider:a.length>0?a[0]:n,prefix:i,name:e};return t&&!Na(r)?null:r}const r=a[0],s=r.split("-");if(s.length>1){const e={provider:n,prefix:s.shift(),name:s.join("-")};return t&&!Na(e)?null:e}if(i&&""===n){const e={provider:n,prefix:"",name:r};return t&&!Na(e,i)?null:e}return null},Na=(e,t)=>!!e&&!(!(t&&""===e.prefix||e.prefix)||!e.name);function ja(e,t){const i=function(e,t){const i={};!e.hFlip!=!t.hFlip&&(i.hFlip=!0),!e.vFlip!=!t.vFlip&&(i.vFlip=!0);const n=((e.rotate||0)+(t.rotate||0))%4;return n&&(i.rotate=n),i}(e,t);for(const n in Ia)n in Da?n in e&&!(n in i)&&(i[n]=Da[n]):n in t?i[n]=t[n]:n in e&&(i[n]=e[n]);return i}function Va(e,t,i){const n=e.icons,a=e.aliases||Object.create(null);let r={};function s(e){r=ja(n[e]||a[e],r)}return s(t),i.forEach(s),ja(e,r)}function qa(e,t){const i=[];if("object"!=typeof e||"object"!=typeof e.icons)return i;e.not_found instanceof Array&&e.not_found.forEach(e=>{t(e,null),i.push(e)});const n=function(e){const t=e.icons,i=e.aliases||Object.create(null),n=Object.create(null);return Object.keys(t).concat(Object.keys(i)).forEach(function e(a){if(t[a])return n[a]=[];if(!(a in n)){n[a]=null;const t=i[a]&&i[a].parent,r=t&&e(t);r&&(n[a]=[t].concat(r))}return n[a]}),n}(e);for(const a in n){const r=n[a];r&&(t(a,Va(e,a,r)),i.push(a))}return i}const Ga={provider:"",aliases:{},not_found:{},...Ta};function Ha(e,t){for(const i in t)if(i in e&&typeof e[i]!=typeof t[i])return!1;return!0}function Wa(e){if("object"!=typeof e||null===e)return null;const t=e;if("string"!=typeof t.prefix||!e.icons||"object"!=typeof e.icons)return null;if(!Ha(e,Ga))return null;const i=t.icons;for(const e in i){const t=i[e];if(!e||"string"!=typeof t.body||!Ha(t,Ia))return null}const n=t.aliases||Object.create(null);for(const e in n){const t=n[e],a=t.parent;if(!e||"string"!=typeof a||!i[a]&&!n[a]||!Ha(t,Ia))return null}return t}const Za=Object.create(null);function Ka(e,t){const i=Za[e]||(Za[e]=Object.create(null));return i[t]||(i[t]=function(e,t){return{provider:e,prefix:t,icons:Object.create(null),missing:new Set}}(e,t))}function Xa(e,t){return Wa(t)?qa(t,(t,i)=>{i?e.icons[t]=i:e.missing.add(t)}):[]}function Qa(e,t){let i=[];return("string"==typeof e?[e]:Object.keys(Za)).forEach(e=>{("string"==typeof e&&"string"==typeof t?[t]:Object.keys(Za[e]||{})).forEach(t=>{const n=Ka(e,t);i=i.concat(Object.keys(n.icons).map(i=>(""!==e?"@"+e+":":"")+t+":"+i))})}),i}let Ya=!1;function Ja(e){return"boolean"==typeof e&&(Ya=e),Ya}function $a(e){const t="string"==typeof e?Ua(e,!0,Ya):e;if(t){const e=Ka(t.provider,t.prefix),i=t.name;return e.icons[i]||(e.missing.has(i)?null:void 0)}}function er(e,t){const i=Ua(e,!0,Ya);if(!i)return!1;const n=Ka(i.provider,i.prefix);return t?function(e,t,i){try{if("string"==typeof i.body)return e.icons[t]={...i},!0}catch(e){}return!1}(n,i.name,t):(n.missing.add(i.name),!0)}function tr(e,t){if("object"!=typeof e)return!1;if("string"!=typeof t&&(t=e.provider||""),Ya&&!t&&!e.prefix){let t=!1;return Wa(e)&&(e.prefix="",qa(e,(e,i)=>{er(e,i)&&(t=!0)})),t}const i=e.prefix;return!!Na({prefix:i,name:"a"})&&!!Xa(Ka(t,i),e)}function ir(e){return!!$a(e)}function nr(e){const t=$a(e);return t?{...Pa,...t}:t}function ar(e,t){e.forEach(e=>{const i=e.loaderCallbacks;i&&(e.loaderCallbacks=i.filter(e=>e.id!==t))})}let rr=0;const sr=Object.create(null);function or(e,t){sr[e]=t}function lr(e){return sr[e]||sr[""]}function cr(e){let t;if("string"==typeof e.resources)t=[e.resources];else if(t=e.resources,!(t instanceof Array&&t.length))return null;return{resources:t,path:e.path||"/",maxURL:e.maxURL||500,rotate:e.rotate||750,timeout:e.timeout||5e3,random:!0===e.random,index:e.index||0,dataAfterTimeout:!1!==e.dataAfterTimeout}}const ur=Object.create(null),hr=["https://api.simplesvg.com","https://api.unisvg.com"],dr=[];for(;hr.length>0;)1===hr.length||Math.random()>.5?dr.push(hr.shift()):dr.push(hr.pop());function pr(e,t){const i=cr(t);return null!==i&&(ur[e]=i,!0)}function mr(e){return ur[e]}function gr(){return Object.keys(ur)}ur[""]=cr({resources:["https://api.iconify.design"].concat(dr)});const fr={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function Ar(e,t,i,n){const a=e.resources.length,r=e.random?Math.floor(Math.random()*a):e.index;let s;if(e.random){let t=e.resources.slice(0);for(s=[];t.length>1;){const e=Math.floor(Math.random()*t.length);s.push(t[e]),t=t.slice(0,e).concat(t.slice(e+1))}s=s.concat(t)}else s=e.resources.slice(r).concat(e.resources.slice(0,r));const o=Date.now();let l,c="pending",u=0,h=null,d=[],p=[];function m(){h&&(clearTimeout(h),h=null)}function g(){"pending"===c&&(c="aborted"),m(),d.forEach(e=>{"pending"===e.status&&(e.status="aborted")}),d=[]}function f(e,t){t&&(p=[]),"function"==typeof e&&p.push(e)}function A(){c="failed",p.forEach(e=>{e(void 0,l)})}function _(){d.forEach(e=>{"pending"===e.status&&(e.status="aborted")}),d=[]}function v(){if("pending"!==c)return;m();const n=s.shift();if(void 0===n)return d.length?void(h=setTimeout(()=>{m(),"pending"===c&&(_(),A())},e.timeout)):void A();const a={status:"pending",resource:n,callback:(t,i)=>{!function(t,i,n){const a="success"!==i;switch(d=d.filter(e=>e!==t),c){case"pending":break;case"failed":if(a||!e.dataAfterTimeout)return;break;default:return}if("abort"===i)return l=n,void A();if(a)return l=n,void(d.length||(s.length?v():A()));if(m(),_(),!e.random){const i=e.resources.indexOf(t.resource);-1!==i&&i!==e.index&&(e.index=i)}c="completed",p.forEach(e=>{e(n)})}(a,t,i)}};d.push(a),u++,h=setTimeout(v,e.rotate),i(n,t,a.callback)}return"function"==typeof n&&p.push(n),setTimeout(v),function(){return{startTime:o,payload:t,status:c,queriesSent:u,queriesPending:d.length,subscribe:f,abort:g}}}function _r(e){const t={...fr,...e};let i=[];function n(){i=i.filter(e=>"pending"===e().status)}return{query:function(e,a,r){const s=Ar(t,e,a,(e,t)=>{n(),r&&r(e,t)});return i.push(s),s},find:function(e){return i.find(t=>e(t))||null},setIndex:e=>{t.index=e},getIndex:()=>t.index,cleanup:n}}function vr(){}const yr=Object.create(null);function xr(e,t,i){let n,a;if("string"==typeof e){const t=lr(e);if(!t)return i(void 0,424),vr;a=t.send;const r=function(e){if(!yr[e]){const t=mr(e);if(!t)return;yr[e]={config:t,redundancy:_r(t)}}return yr[e]}(e);r&&(n=r.redundancy)}else{const t=cr(e);if(t){n=_r(t);const i=lr(e.resources?e.resources[0]:"");i&&(a=i.send)}}return n&&a?n.query(t,a,i)().abort:(i(void 0,424),vr)}function br(){}function wr(e){e.iconsLoaderFlag||(e.iconsLoaderFlag=!0,setTimeout(()=>{e.iconsLoaderFlag=!1,function(e){e.pendingCallbacksFlag||(e.pendingCallbacksFlag=!0,setTimeout(()=>{e.pendingCallbacksFlag=!1;const t=e.loaderCallbacks?e.loaderCallbacks.slice(0):[];if(!t.length)return;let i=!1;const n=e.provider,a=e.prefix;t.forEach(t=>{const r=t.icons,s=r.pending.length;r.pending=r.pending.filter(t=>{if(t.prefix!==a)return!0;const s=t.name;if(e.icons[s])r.loaded.push({provider:n,prefix:a,name:s});else{if(!e.missing.has(s))return i=!0,!0;r.missing.push({provider:n,prefix:a,name:s})}return!1}),r.pending.length!==s&&(i||ar([e],t.id),t.callback(r.loaded.slice(0),r.missing.slice(0),r.pending.slice(0),t.abort))})}))}(e)}))}function Er(e,t,i){function n(){const i=e.pendingIcons;t.forEach(t=>{i&&i.delete(t),e.icons[t]||e.missing.add(t)})}if(i&&"object"==typeof i)try{if(!Xa(e,i).length)return void n()}catch(e){console.error(e)}n(),wr(e)}function kr(e,t){e instanceof Promise?e.then(e=>{t(e)}).catch(()=>{t(null)}):t(e)}function Sr(e,t){e.iconsToLoad?e.iconsToLoad=e.iconsToLoad.concat(t).sort():e.iconsToLoad=t,e.iconsQueueFlag||(e.iconsQueueFlag=!0,setTimeout(()=>{e.iconsQueueFlag=!1;const{provider:t,prefix:i}=e,n=e.iconsToLoad;if(delete e.iconsToLoad,!n||!n.length)return;const a=e.loadIcon;if(e.loadIcons&&(n.length>1||!a))return void kr(e.loadIcons(n,i,t),t=>{Er(e,n,t)});if(a)return void n.forEach(n=>{kr(a(n,i,t),t=>{Er(e,[n],t?{prefix:i,icons:{[n]:t}}:null)})});const{valid:r,invalid:s}=function(e){const t=[],i=[];return e.forEach(e=>{(e.match(Oa)?t:i).push(e)}),{valid:t,invalid:i}}(n);if(s.length&&Er(e,s,null),!r.length)return;const o=i.match(Oa)?lr(t):null;o?o.prepare(t,i,r).forEach(i=>{xr(t,i,t=>{Er(e,i.icons,t)})}):Er(e,r,null)}))}const Mr=(e,t)=>{const i=function(e){const t={loaded:[],missing:[],pending:[]},i=Object.create(null);e.sort((e,t)=>e.provider!==t.provider?e.provider.localeCompare(t.provider):e.prefix!==t.prefix?e.prefix.localeCompare(t.prefix):e.name.localeCompare(t.name));let n={provider:"",prefix:"",name:""};return e.forEach(e=>{if(n.name===e.name&&n.prefix===e.prefix&&n.provider===e.provider)return;n=e;const a=e.provider,r=e.prefix,s=e.name,o=i[a]||(i[a]=Object.create(null)),l=o[r]||(o[r]=Ka(a,r));let c;c=s in l.icons?t.loaded:""===r||l.missing.has(s)?t.missing:t.pending;const u={provider:a,prefix:r,name:s};c.push(u)}),t}(function(e,t=!0,i=!1){const n=[];return e.forEach(e=>{const a="string"==typeof e?Ua(e,t,i):e;a&&n.push(a)}),n}(e,!0,Ja()));if(!i.pending.length){let e=!0;return t&&setTimeout(()=>{e&&t(i.loaded,i.missing,i.pending,br)}),()=>{e=!1}}const n=Object.create(null),a=[];let r,s;return i.pending.forEach(e=>{const{provider:t,prefix:i}=e;if(i===s&&t===r)return;r=t,s=i,a.push(Ka(t,i));const o=n[t]||(n[t]=Object.create(null));o[i]||(o[i]=[])}),i.pending.forEach(e=>{const{provider:t,prefix:i,name:a}=e,r=Ka(t,i),s=r.pendingIcons||(r.pendingIcons=new Set);s.has(a)||(s.add(a),n[t][i].push(a))}),a.forEach(e=>{const t=n[e.provider][e.prefix];t.length&&Sr(e,t)}),t?function(e,t,i){const n=rr++,a=ar.bind(null,i,n);if(!t.pending.length)return a;const r={id:n,icons:t,callback:e,abort:a};return i.forEach(e=>{(e.loaderCallbacks||(e.loaderCallbacks=[])).push(r)}),a}(t,i,a):br},Cr=e=>new Promise((t,i)=>{const n="string"==typeof e?Ua(e,!0):e;n?Mr([n||e],a=>{if(a.length&&n){const e=$a(n);if(e)return void t({...Pa,...e})}i(e)}):i(e)});function Tr(e){try{const t="string"==typeof e?JSON.parse(e):e;if("string"==typeof t.body)return{...t}}catch(e){}}let Dr=!1;try{Dr=0===navigator.vendor.indexOf("Apple")}catch(sB){}const Pr=/(-?[0-9.]*[0-9]+[0-9.]*)/g,Ir=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function Fr(e,t,i){if(1===t)return e;if(i=i||100,"number"==typeof e)return Math.ceil(e*t*i)/i;if("string"!=typeof e)return e;const n=e.split(Pr);if(null===n||!n.length)return e;const a=[];let r=n.shift(),s=Ir.test(r);for(;;){if(s){const e=parseFloat(r);isNaN(e)?a.push(r):a.push(Math.ceil(e*t*i)/i)}else a.push(r);if(r=n.shift(),void 0===r)return a.join("");s=!s}}function zr(e,t){const i={...Pa,...e},n={...za,...t},a={left:i.left,top:i.top,width:i.width,height:i.height};let r=i.body;[i,n].forEach(e=>{const t=[],i=e.hFlip,n=e.vFlip;let s,o=e.rotate;switch(i?n?o+=2:(t.push("translate("+(a.width+a.left).toString()+" "+(0-a.top).toString()+")"),t.push("scale(-1 1)"),a.top=a.left=0):n&&(t.push("translate("+(0-a.left).toString()+" "+(a.height+a.top).toString()+")"),t.push("scale(1 -1)"),a.top=a.left=0),o<0&&(o-=4*Math.floor(o/4)),o%=4,o){case 1:s=a.height/2+a.top,t.unshift("rotate(90 "+s.toString()+" "+s.toString()+")");break;case 2:t.unshift("rotate(180 "+(a.width/2+a.left).toString()+" "+(a.height/2+a.top).toString()+")");break;case 3:s=a.width/2+a.left,t.unshift("rotate(-90 "+s.toString()+" "+s.toString()+")")}o%2==1&&(a.left!==a.top&&(s=a.left,a.left=a.top,a.top=s),a.width!==a.height&&(s=a.width,a.width=a.height,a.height=s)),t.length&&(r=function(e,t,i){const n=function(e,t="defs"){let i="";const n=e.indexOf("<"+t);for(;n>=0;){const a=e.indexOf(">",n),r=e.indexOf("</"+t);if(-1===a||-1===r)break;const s=e.indexOf(">",r);if(-1===s)break;i+=e.slice(a+1,r).trim(),e=e.slice(0,n).trim()+e.slice(s+1)}return{defs:i,content:e}}(e);return a=n.defs,r=t+n.content+i,a?"<defs>"+a+"</defs>"+r:r;var a,r}(r,'<g transform="'+t.join(" ")+'">',"</g>"))});const s=n.width,o=n.height,l=a.width,c=a.height;let u,h;null===s?(h=null===o?"1em":"auto"===o?c:o,u=Fr(h,l/c)):(u="auto"===s?l:s,h=null===o?Fr(u,c/l):"auto"===o?c:o);const d={},p=(e,t)=>{(e=>"unset"===e||"undefined"===e||"none"===e)(t)||(d[e]=t.toString())};p("width",u),p("height",h);const m=[a.left,a.top,l,c];return d.viewBox=m.join(" "),{attributes:d,viewBox:m,body:r}}function Rr(e,t){let i=-1===e.indexOf("xlink:")?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(const e in t)i+=" "+e+'="'+t[e]+'"';return'<svg xmlns="http://www.w3.org/2000/svg"'+i+">"+e+"</svg>"}function Lr(e){return'url("'+function(e){return"data:image/svg+xml,"+function(e){return e.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(/</g,"%3C").replace(/>/g,"%3E").replace(/\s+/g," ")}(e)}(e)+'")'}let Br=(()=>{let e;try{if(e=fetch,"function"==typeof e)return e}catch(e){}})();function Or(e){Br=e}function Ur(){return Br}const Nr={prepare:(e,t,i)=>{const n=[],a=function(e,t){const i=mr(e);if(!i)return 0;let n;if(i.maxURL){let e=0;i.resources.forEach(t=>{const i=t;e=Math.max(e,i.length)});const a=t+".json?icons=";n=i.maxURL-e-i.path.length-a.length}else n=0;return n}(e,t),r="icons";let s={type:r,provider:e,prefix:t,icons:[]},o=0;return i.forEach((i,l)=>{o+=i.length+1,o>=a&&l>0&&(n.push(s),s={type:r,provider:e,prefix:t,icons:[]},o=i.length),s.icons.push(i)}),n.push(s),n},send:(e,t,i)=>{if(!Br)return void i("abort",424);let n=function(e){if("string"==typeof e){const t=mr(e);if(t)return t.path}return"/"}(t.provider);switch(t.type){case"icons":{const e=t.prefix,i=t.icons.join(",");n+=e+".json?"+new URLSearchParams({icons:i}).toString();break}case"custom":{const e=t.uri;n+="/"===e.slice(0,1)?e.slice(1):e;break}default:return void i("abort",400)}let a=503;Br(e+n).then(e=>{const t=e.status;if(200===t)return a=501,e.json();setTimeout(()=>{i(function(e){return 404===e}(t)?"abort":"next",t)})}).then(e=>{"object"==typeof e&&null!==e?setTimeout(()=>{i("success",e)}):setTimeout(()=>{404===e?i("abort",e):i("next",a)})}).catch(()=>{i("next",a)})}};function jr(e,t,i){Ka(i||"",t).loadIcons=e}function Vr(e,t,i){Ka(i||"",t).loadIcon=e}const qr="data-style";let Gr="";function Hr(e){Gr=e}function Wr(e,t){let i=Array.from(e.childNodes).find(e=>e.hasAttribute&&e.hasAttribute(qr));i||(i=document.createElement("style"),i.setAttribute(qr,qr),e.appendChild(i)),i.textContent=":host{display:inline-block;vertical-align:"+(t?"-0.125em":"0")+"}span,svg{display:block;margin:auto}"+Gr}function Zr(){let e;or("",Nr),Ja(!0);try{e=window}catch(e){}if(e){if(void 0!==e.IconifyPreload){const t=e.IconifyPreload,i="Invalid IconifyPreload syntax.";"object"==typeof t&&null!==t&&(t instanceof Array?t:[t]).forEach(e=>{try{("object"!=typeof e||null===e||e instanceof Array||"object"!=typeof e.icons||"string"!=typeof e.prefix||!tr(e))&&console.error(i)}catch(e){console.error(i)}})}if(void 0!==e.IconifyProviders){const t=e.IconifyProviders;if("object"==typeof t&&null!==t)for(const e in t){const i="IconifyProviders["+e+"] is invalid.";try{const n=t[e];if("object"!=typeof n||!n||void 0===n.resources)continue;pr(e,n)||console.error(i)}catch(e){console.error(i)}}}}return{iconLoaded:ir,getIcon:nr,listIcons:Qa,addIcon:er,addCollection:tr,calculateSize:Fr,buildIcon:zr,iconToHTML:Rr,svgToURL:Lr,loadIcons:Mr,loadIcon:Cr,addAPIProvider:pr,setCustomIconLoader:Vr,setCustomIconsLoader:jr,appendCustomStyle:Hr,_api:{getAPIConfig:mr,setAPIModule:or,sendAPIQuery:xr,setFetch:Or,getFetch:Ur,listAPIProviders:gr}}}const Kr={"background-color":"currentColor"},Xr={"background-color":"transparent"},Qr={image:"var(--svg)",repeat:"no-repeat",size:"100% 100%"},Yr={"-webkit-mask":Kr,mask:Kr,background:Xr};for(const e in Yr){const t=Yr[e];for(const i in Qr)t[e+"-"+i]=Qr[i]}function Jr(e){return e?e+(e.match(/^[-0-9.]+$/)?"px":""):"inherit"}let $r;function es(e){return void 0===$r&&function(){try{$r=window.trustedTypes.createPolicy("iconify",{createHTML:e=>e})}catch(e){$r=null}}(),$r?$r.createHTML(e):e}function ts(e){return Array.from(e.childNodes).find(e=>{const t=e.tagName&&e.tagName.toUpperCase();return"SPAN"===t||"SVG"===t})}function is(e,t){const i=t.icon.data,n=t.customisations,a=zr(i,n);n.preserveAspectRatio&&(a.attributes.preserveAspectRatio=n.preserveAspectRatio);const r=t.renderedMode;let s;if("svg"===r)s=function(e){const t=document.createElement("span"),i=e.attributes;let n="";i.width||(n="width: inherit;"),i.height||(n+="height: inherit;"),n&&(i.style=n);const a=Rr(e.body,i);return t.innerHTML=es(a),t.firstChild}(a);else s=function(e,t,i){const n=document.createElement("span");let a=e.body;-1!==a.indexOf("<a")&&(a+="\x3c!-- "+Date.now()+" --\x3e");const r=e.attributes,s=Lr(Rr(a,{...r,width:t.width+"",height:t.height+""})),o=n.style,l={"--svg":s,width:Jr(r.width),height:Jr(r.height),...i?Kr:Xr};for(const e in l)o.setProperty(e,l[e]);return n}(a,{...Pa,...i},"mask"===r);const o=ts(e);o?"SPAN"===s.tagName&&o.tagName===s.tagName?o.setAttribute("style",s.getAttribute("style")):e.replaceChild(s,o):e.appendChild(s)}function ns(e,t,i){return{rendered:!1,inline:t,icon:e,lastRender:i&&(i.rendered?i:i.lastRender)}}const as=function(e="iconify-icon"){let t,i;try{t=window.customElements,i=window.HTMLElement}catch(e){return}if(!t||!i)return;const n=t.get(e);if(n)return n;const a=["icon","mode","inline","noobserver","width","height","rotate","flip"],r=class extends i{_shadowRoot;_initialised=!1;_state;_checkQueued=!1;_connected=!1;_observer=null;_visible=!0;constructor(){super();const e=this._shadowRoot=this.attachShadow({mode:"open"}),t=this.hasAttribute("inline");Wr(e,t),this._state=ns({value:""},t),this._queueCheck()}connectedCallback(){this._connected=!0,this.startObserver()}disconnectedCallback(){this._connected=!1,this.stopObserver()}static get observedAttributes(){return a.slice(0)}attributeChangedCallback(e){switch(e){case"inline":{const e=this.hasAttribute("inline"),t=this._state;e!==t.inline&&(t.inline=e,Wr(this._shadowRoot,e));break}case"noobserver":this.hasAttribute("noobserver")?this.startObserver():this.stopObserver();break;default:this._queueCheck()}}get icon(){const e=this.getAttribute("icon");if(e&&"{"===e.slice(0,1))try{return JSON.parse(e)}catch(e){}return e}set icon(e){"object"==typeof e&&(e=JSON.stringify(e)),this.setAttribute("icon",e)}get inline(){return this.hasAttribute("inline")}set inline(e){e?this.setAttribute("inline","true"):this.removeAttribute("inline")}get observer(){return this.hasAttribute("observer")}set observer(e){e?this.setAttribute("observer","true"):this.removeAttribute("observer")}restartAnimation(){const e=this._state;if(e.rendered){const t=this._shadowRoot;if("svg"===e.renderedMode)try{return void t.lastChild.setCurrentTime(0)}catch(e){}is(t,e)}}get status(){const e=this._state;return e.rendered?"rendered":null===e.icon.data?"failed":"loading"}_queueCheck(){this._checkQueued||(this._checkQueued=!0,setTimeout(()=>{this._check()}))}_check(){if(!this._checkQueued)return;this._checkQueued=!1;const e=this._state,t=this.getAttribute("icon");if(t!==e.icon.value)return void this._iconChanged(t);if(!e.rendered||!this._visible)return;const i=this.getAttribute("mode"),n=Ba(this);e.attrMode===i&&!function(e,t){for(const i in La)if(e[i]!==t[i])return!0;return!1}(e.customisations,n)&&ts(this._shadowRoot)||this._renderIcon(e.icon,n,i)}_iconChanged(e){const t=function(e,t){if("object"==typeof e)return{data:Tr(e),value:e};if("string"!=typeof e)return{value:e};if(e.includes("{")){const t=Tr(e);if(t)return{data:t,value:e}}const i=Ua(e,!0,!0);if(!i)return{value:e};const n=$a(i);if(void 0!==n||!i.prefix)return{value:e,name:i,data:n};const a=Mr([i],()=>t(e,i,$a(i)));return{value:e,name:i,loading:a}}(e,(e,t,i)=>{const n=this._state;if(n.rendered||this.getAttribute("icon")!==e)return;const a={value:e,name:t,data:i};a.data?this._gotIconData(a):n.icon=a});t.data?this._gotIconData(t):this._state=ns(t,this._state.inline,this._state)}_forceRender(){if(!this._visible){const e=ts(this._shadowRoot);return void(e&&this._shadowRoot.removeChild(e))}this._queueCheck()}_gotIconData(e){this._checkQueued=!1,this._renderIcon(e,Ba(this),this.getAttribute("mode"))}_renderIcon(e,t,i){const n=function(e,t){switch(t){case"svg":case"bg":case"mask":return t}return"style"===t||!Dr&&-1!==e.indexOf("<a")?-1===e.indexOf("currentColor")?"bg":"mask":"svg"}(e.data.body,i),a=this._state.inline;is(this._shadowRoot,this._state={rendered:!0,icon:e,inline:a,customisations:t,attrMode:i,renderedMode:n})}startObserver(){if(!this._observer&&!this.hasAttribute("noobserver"))try{this._observer=new IntersectionObserver(e=>{const t=e.some(e=>e.isIntersecting);t!==this._visible&&(this._visible=t,this._forceRender())}),this._observer.observe(this)}catch(e){if(this._observer){try{this._observer.disconnect()}catch(e){}this._observer=null}}}stopObserver(){this._observer&&(this._observer.disconnect(),this._observer=null,this._visible=!0,this._connected&&this._forceRender())}};a.forEach(e=>{e in r.prototype||Object.defineProperty(r.prototype,e,{get:function(){return this.getAttribute(e)},set:function(t){null!==t?this.setAttribute(e,t):this.removeAttribute(e)}})});const s=Zr();for(const e in s)r[e]=r.prototype[e]=s[e];return t.define(e,r),r}()||Zr(),{iconLoaded:rs,getIcon:ss,listIcons:os,addIcon:ls,addCollection:cs,calculateSize:us,buildIcon:hs,iconToHTML:ds,svgToURL:ps,loadIcons:ms,loadIcon:gs,setCustomIconLoader:fs,setCustomIconsLoader:As,addAPIProvider:_s,_api:vs}=as;function ys(e,t){return Ca(e,t).node[0]}function xs(){fs(async e=>{const t=await fetch(ge(e));return t.ok?{body:await t.text()}:null},"temaki")}function bs(e,t={}){const i=document.createElement(e);return Object.entries(t).forEach(([e,t])=>{e.startsWith("_")?i[e]=t:e.startsWith("fn")?i[e.substring(2)]=t:e.startsWith("on")?i.addEventListener(e.substring(2),t):t&&i.setAttribute(e,t)}),i}function ws(e,t){e._parent?.addEventListener("menu-opened",i=>{i.detail.menu!==e&&t()}),e._parent?.onceMapReady?.().then(()=>{e._parent.map?.on?.("click",()=>t())}),e._parent?.oncePSVReady?.().then(()=>{e._parent.psv.addEventListener("click",()=>t())}),e._parent?.onceReady?.().then(()=>{e._parent.legend?.addEventListener("click",()=>t())})}function Es(e){return e._parent?e._parent:e===document.body?null:e.parentNode?Es(e.parentNode):e.host?Es(e.host):void 0}function ks(e){return e._parent?Promise.resolve(e._parent):new Promise(t=>{const i=setInterval(()=>{const n=Es(e);n&&(e._parent=n,clearInterval(i),t(e._parent))},100)})}var Ss=Object.freeze({__proto__:null,createWebComp:bs,fa:ys,listenForMenuClosure:ws,moreIcons:xs,onceParentAvailable:ks}),Ms={Space_Separator:/[\u1680\u2000-\u200A\u202F\u205F\u3000]/,ID_Start:/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/,ID_Continue:/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/},Cs={isSpaceSeparator:e=>"string"==typeof e&&Ms.Space_Separator.test(e),isIdStartChar:e=>"string"==typeof e&&(e>="a"&&e<="z"||e>="A"&&e<="Z"||"$"===e||"_"===e||Ms.ID_Start.test(e)),isIdContinueChar:e=>"string"==typeof e&&(e>="a"&&e<="z"||e>="A"&&e<="Z"||e>="0"&&e<="9"||"$"===e||"_"===e||""===e||""===e||Ms.ID_Continue.test(e)),isDigit:e=>"string"==typeof e&&/[0-9]/.test(e),isHexDigit:e=>"string"==typeof e&&/[0-9A-Fa-f]/.test(e)};let Ts,Ds,Ps,Is,Fs,zs,Rs,Ls,Bs;function Os(e,t,i){const n=e[t];if(null!=n&&"object"==typeof n)if(Array.isArray(n))for(let e=0;e<n.length;e++){const t=String(e),a=Os(n,t,i);void 0===a?delete n[t]:Object.defineProperty(n,t,{value:a,writable:!0,enumerable:!0,configurable:!0})}else for(const e in n){const t=Os(n,e,i);void 0===t?delete n[e]:Object.defineProperty(n,e,{value:t,writable:!0,enumerable:!0,configurable:!0})}return i.call(e,t,n)}let Us,Ns,js,Vs,qs;function Gs(){for(Us="default",Ns="",js=!1,Vs=1;;){qs=Hs();const e=Zs[Us]();if(e)return e}}function Hs(){if(Ts[Is])return String.fromCodePoint(Ts.codePointAt(Is))}function Ws(){const e=Hs();return"\n"===e?(Fs++,zs=0):e?zs+=e.length:zs++,e&&(Is+=e.length),e}const Zs={default(){switch(qs){case"\t":case"\v":case"\f":case" ":case" ":case"\ufeff":case"\n":case"\r":case"\u2028":case"\u2029":return void Ws();case"/":return Ws(),void(Us="comment");case void 0:return Ws(),Ks("eof")}if(!Cs.isSpaceSeparator(qs))return Zs[Ds]();Ws()},comment(){switch(qs){case"*":return Ws(),void(Us="multiLineComment");case"/":return Ws(),void(Us="singleLineComment")}throw eo(Ws())},multiLineComment(){switch(qs){case"*":return Ws(),void(Us="multiLineCommentAsterisk");case void 0:throw eo(Ws())}Ws()},multiLineCommentAsterisk(){switch(qs){case"*":return void Ws();case"/":return Ws(),void(Us="default");case void 0:throw eo(Ws())}Ws(),Us="multiLineComment"},singleLineComment(){switch(qs){case"\n":case"\r":case"\u2028":case"\u2029":return Ws(),void(Us="default");case void 0:return Ws(),Ks("eof")}Ws()},value(){switch(qs){case"{":case"[":return Ks("punctuator",Ws());case"n":return Ws(),Xs("ull"),Ks("null",null);case"t":return Ws(),Xs("rue"),Ks("boolean",!0);case"f":return Ws(),Xs("alse"),Ks("boolean",!1);case"-":case"+":return"-"===Ws()&&(Vs=-1),void(Us="sign");case".":return Ns=Ws(),void(Us="decimalPointLeading");case"0":return Ns=Ws(),void(Us="zero");case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":return Ns=Ws(),void(Us="decimalInteger");case"I":return Ws(),Xs("nfinity"),Ks("numeric",1/0);case"N":return Ws(),Xs("aN"),Ks("numeric",NaN);case'"':case"'":return js='"'===Ws(),Ns="",void(Us="string")}throw eo(Ws())},identifierNameStartEscape(){if("u"!==qs)throw eo(Ws());Ws();const e=Qs();switch(e){case"$":case"_":break;default:if(!Cs.isIdStartChar(e))throw io()}Ns+=e,Us="identifierName"},identifierName(){switch(qs){case"$":case"_":case"":case"":return void(Ns+=Ws());case"\\":return Ws(),void(Us="identifierNameEscape")}if(!Cs.isIdContinueChar(qs))return Ks("identifier",Ns);Ns+=Ws()},identifierNameEscape(){if("u"!==qs)throw eo(Ws());Ws();const e=Qs();switch(e){case"$":case"_":case"":case"":break;default:if(!Cs.isIdContinueChar(e))throw io()}Ns+=e,Us="identifierName"},sign(){switch(qs){case".":return Ns=Ws(),void(Us="decimalPointLeading");case"0":return Ns=Ws(),void(Us="zero");case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":return Ns=Ws(),void(Us="decimalInteger");case"I":return Ws(),Xs("nfinity"),Ks("numeric",Vs*(1/0));case"N":return Ws(),Xs("aN"),Ks("numeric",NaN)}throw eo(Ws())},zero(){switch(qs){case".":return Ns+=Ws(),void(Us="decimalPoint");case"e":case"E":return Ns+=Ws(),void(Us="decimalExponent");case"x":case"X":return Ns+=Ws(),void(Us="hexadecimal")}return Ks("numeric",0*Vs)},decimalInteger(){switch(qs){case".":return Ns+=Ws(),void(Us="decimalPoint");case"e":case"E":return Ns+=Ws(),void(Us="decimalExponent")}if(!Cs.isDigit(qs))return Ks("numeric",Vs*Number(Ns));Ns+=Ws()},decimalPointLeading(){if(Cs.isDigit(qs))return Ns+=Ws(),void(Us="decimalFraction");throw eo(Ws())},decimalPoint(){switch(qs){case"e":case"E":return Ns+=Ws(),void(Us="decimalExponent")}return Cs.isDigit(qs)?(Ns+=Ws(),void(Us="decimalFraction")):Ks("numeric",Vs*Number(Ns))},decimalFraction(){switch(qs){case"e":case"E":return Ns+=Ws(),void(Us="decimalExponent")}if(!Cs.isDigit(qs))return Ks("numeric",Vs*Number(Ns));Ns+=Ws()},decimalExponent(){switch(qs){case"+":case"-":return Ns+=Ws(),void(Us="decimalExponentSign")}if(Cs.isDigit(qs))return Ns+=Ws(),void(Us="decimalExponentInteger");throw eo(Ws())},decimalExponentSign(){if(Cs.isDigit(qs))return Ns+=Ws(),void(Us="decimalExponentInteger");throw eo(Ws())},decimalExponentInteger(){if(!Cs.isDigit(qs))return Ks("numeric",Vs*Number(Ns));Ns+=Ws()},hexadecimal(){if(Cs.isHexDigit(qs))return Ns+=Ws(),void(Us="hexadecimalInteger");throw eo(Ws())},hexadecimalInteger(){if(!Cs.isHexDigit(qs))return Ks("numeric",Vs*Number(Ns));Ns+=Ws()},string(){switch(qs){case"\\":return Ws(),void(Ns+=function(){switch(Hs()){case"b":return Ws(),"\b";case"f":return Ws(),"\f";case"n":return Ws(),"\n";case"r":return Ws(),"\r";case"t":return Ws(),"\t";case"v":return Ws(),"\v";case"0":if(Ws(),Cs.isDigit(Hs()))throw eo(Ws());return"\0";case"x":return Ws(),function(){let e="",t=Hs();if(!Cs.isHexDigit(t))throw eo(Ws());if(e+=Ws(),t=Hs(),!Cs.isHexDigit(t))throw eo(Ws());return e+=Ws(),String.fromCodePoint(parseInt(e,16))}();case"u":return Ws(),Qs();case"\n":case"\u2028":case"\u2029":return Ws(),"";case"\r":return Ws(),"\n"===Hs()&&Ws(),"";case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case void 0:throw eo(Ws())}return Ws()}());case'"':return js?(Ws(),Ks("string",Ns)):void(Ns+=Ws());case"'":return js?void(Ns+=Ws()):(Ws(),Ks("string",Ns));case"\n":case"\r":throw eo(Ws());case"\u2028":case"\u2029":!function(e){console.warn(`JSON5: '${no(e)}' in strings is not valid ECMAScript; consider escaping`)}(qs);break;case void 0:throw eo(Ws())}Ns+=Ws()},start(){switch(qs){case"{":case"[":return Ks("punctuator",Ws())}Us="value"},beforePropertyName(){switch(qs){case"$":case"_":return Ns=Ws(),void(Us="identifierName");case"\\":return Ws(),void(Us="identifierNameStartEscape");case"}":return Ks("punctuator",Ws());case'"':case"'":return js='"'===Ws(),void(Us="string")}if(Cs.isIdStartChar(qs))return Ns+=Ws(),void(Us="identifierName");throw eo(Ws())},afterPropertyName(){if(":"===qs)return Ks("punctuator",Ws());throw eo(Ws())},beforePropertyValue(){Us="value"},afterPropertyValue(){switch(qs){case",":case"}":return Ks("punctuator",Ws())}throw eo(Ws())},beforeArrayValue(){if("]"===qs)return Ks("punctuator",Ws());Us="value"},afterArrayValue(){switch(qs){case",":case"]":return Ks("punctuator",Ws())}throw eo(Ws())},end(){throw eo(Ws())}};function Ks(e,t){return{type:e,value:t,line:Fs,column:zs}}function Xs(e){for(const t of e){if(Hs()!==t)throw eo(Ws());Ws()}}function Qs(){let e="",t=4;for(;t-- >0;){const t=Hs();if(!Cs.isHexDigit(t))throw eo(Ws());e+=Ws()}return String.fromCodePoint(parseInt(e,16))}const Ys={start(){if("eof"===Rs.type)throw to();Js()},beforePropertyName(){switch(Rs.type){case"identifier":case"string":return Ls=Rs.value,void(Ds="afterPropertyName");case"punctuator":return void $s();case"eof":throw to()}},afterPropertyName(){if("eof"===Rs.type)throw to();Ds="beforePropertyValue"},beforePropertyValue(){if("eof"===Rs.type)throw to();Js()},beforeArrayValue(){if("eof"===Rs.type)throw to();"punctuator"!==Rs.type||"]"!==Rs.value?Js():$s()},afterPropertyValue(){if("eof"===Rs.type)throw to();switch(Rs.value){case",":return void(Ds="beforePropertyName");case"}":$s()}},afterArrayValue(){if("eof"===Rs.type)throw to();switch(Rs.value){case",":return void(Ds="beforeArrayValue");case"]":$s()}},end(){}};function Js(){let e;switch(Rs.type){case"punctuator":switch(Rs.value){case"{":e={};break;case"[":e=[]}break;case"null":case"boolean":case"numeric":case"string":e=Rs.value}if(void 0===Bs)Bs=e;else{const t=Ps[Ps.length-1];Array.isArray(t)?t.push(e):Object.defineProperty(t,Ls,{value:e,writable:!0,enumerable:!0,configurable:!0})}if(null!==e&&"object"==typeof e)Ps.push(e),Ds=Array.isArray(e)?"beforeArrayValue":"beforePropertyName";else{const e=Ps[Ps.length-1];Ds=null==e?"end":Array.isArray(e)?"afterArrayValue":"afterPropertyValue"}}function $s(){Ps.pop();const e=Ps[Ps.length-1];Ds=null==e?"end":Array.isArray(e)?"afterArrayValue":"afterPropertyValue"}function eo(e){return ao(void 0===e?`JSON5: invalid end of input at ${Fs}:${zs}`:`JSON5: invalid character '${no(e)}' at ${Fs}:${zs}`)}function to(){return ao(`JSON5: invalid end of input at ${Fs}:${zs}`)}function io(){return zs-=5,ao(`JSON5: invalid identifier character at ${Fs}:${zs}`)}function no(e){const t={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"};if(t[e])return t[e];if(e<" "){const t=e.charCodeAt(0).toString(16);return"\\x"+("00"+t).substring(t.length)}return e}function ao(e){const t=new SyntaxError(e);return t.lineNumber=Fs,t.columnNumber=zs,t}const ro={parse:function(e,t){Ts=String(e),Ds="start",Ps=[],Is=0,Fs=1,zs=0,Rs=void 0,Ls=void 0,Bs=void 0;do{Rs=Gs(),Ys[Ds]()}while("eof"!==Rs.type);return"function"==typeof t?Os({"":Bs},"",t):Bs},stringify:function(e,t,i){const n=[];let a,r,s,o="",l="";if(null==t||"object"!=typeof t||Array.isArray(t)||(i=t.space,s=t.quote,t=t.replacer),"function"==typeof t)r=t;else if(Array.isArray(t)){a=[];for(const e of t){let t;"string"==typeof e?t=e:("number"==typeof e||e instanceof String||e instanceof Number)&&(t=String(e)),void 0!==t&&a.indexOf(t)<0&&a.push(t)}}return i instanceof Number?i=Number(i):i instanceof String&&(i=String(i)),"number"==typeof i?i>0&&(i=Math.min(10,Math.floor(i)),l=" ".substr(0,i)):"string"==typeof i&&(l=i.substr(0,10)),c("",{"":e});function c(e,t){let i=t[e];switch(null!=i&&("function"==typeof i.toJSON5?i=i.toJSON5(e):"function"==typeof i.toJSON&&(i=i.toJSON(e))),r&&(i=r.call(t,e,i)),i instanceof Number?i=Number(i):i instanceof String?i=String(i):i instanceof Boolean&&(i=i.valueOf()),i){case null:return"null";case!0:return"true";case!1:return"false"}return"string"==typeof i?u(i):"number"==typeof i?String(i):"object"==typeof i?Array.isArray(i)?function(e){if(n.indexOf(e)>=0)throw TypeError("Converting circular structure to JSON5");n.push(e);let t=o;o+=l;let i,a=[];for(let t=0;t<e.length;t++){const i=c(String(t),e);a.push(void 0!==i?i:"null")}if(0===a.length)i="[]";else if(""===l){i="["+a.join(",")+"]"}else{let e=",\n"+o,n=a.join(e);i="[\n"+o+n+",\n"+t+"]"}return n.pop(),o=t,i}(i):function(e){if(n.indexOf(e)>=0)throw TypeError("Converting circular structure to JSON5");n.push(e);let t=o;o+=l;let i,r=a||Object.keys(e),s=[];for(const t of r){const i=c(t,e);if(void 0!==i){let e=h(t)+":";""!==l&&(e+=" "),e+=i,s.push(e)}}if(0===s.length)i="{}";else{let e;if(""===l)e=s.join(","),i="{"+e+"}";else{let n=",\n"+o;e=s.join(n),i="{\n"+o+e+",\n"+t+"}"}}return n.pop(),o=t,i}(i):void 0}function u(e){const t={"'":.1,'"':.2},i={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"};let n="";for(let a=0;a<e.length;a++){const r=e[a];switch(r){case"'":case'"':t[r]++,n+=r;continue;case"\0":if(Cs.isDigit(e[a+1])){n+="\\x00";continue}}if(i[r])n+=i[r];else{if(r<" "){let e=r.charCodeAt(0).toString(16);n+="\\x"+("00"+e).substring(e.length);continue}n+=r}}const a=s||Object.keys(t).reduce((e,i)=>t[e]<t[i]?e:i);return n=n.replace(new RegExp(a,"g"),i[a]),a+n+a}function h(e){if(0===e.length)return u(e);const t=String.fromCodePoint(e.codePointAt(0));if(!Cs.isIdStartChar(t))return u(e);for(let i=t.length;i<e.length;i++)if(!Cs.isIdContinueChar(String.fromCodePoint(e.codePointAt(i))))return u(e);return e}}};var so=ro;const oo=new CSSStyleSheet;oo.replaceSync("/* atkinson-hyperlegible-next-latin-ext-400-normal */\n@font-face {\n font-family: 'Atkinson Hyperlegible Next';\n font-style: normal;\n font-display: swap;\n font-weight: 400;\n src: url(/fonts/atkinson-hyperlegible-next-latin-ext-400-normal.woff2) format('woff2'), url(/fonts/atkinson-hyperlegible-next-latin-ext-400-normal.woff) format('woff');\n unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;\n}\n\n/* atkinson-hyperlegible-next-latin-400-normal */\n@font-face {\n font-family: 'Atkinson Hyperlegible Next';\n font-style: normal;\n font-display: swap;\n font-weight: 400;\n src: url(/fonts/atkinson-hyperlegible-next-latin-400-normal.woff2) format('woff2'), url(/fonts/atkinson-hyperlegible-next-latin-400-normal.woff) format('woff');\n unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;\n}");const lo=new CSSStyleSheet;lo.replaceSync('/* Colors */\n:root, :host {\n\t--white: #ffffff;\n\t--black: #181818;\n\t--black-pale: #1b1a17;\n\t--red: #f70000;\n\t--red-transparent: rgba(247, 0, 0, 0.3);\n\t--red-pale: #ff726f;\n\t--grey: #f5f5f5;\n\t--grey-very-pale: #e6e6e6;\n\t--grey-pale: #cfd2cf;\n\t--grey-semi-dark: #808080;\n\t--grey-dark: #3e3e3e;\n\t--blue: #2954e9;\n\t--blue-dark: #0a1f69;\n\t--blue-semi: #d7dffc;\n\t--blue-pale: #f2f5ff;\n\t--blue-geovisio: #34495e;\n\t--beige: #f5f3ec;\n\t--yellow: #fec868;\n\t--orange: #ff6f00;\n\t--orange-transparent: rgba(255,111,0,0.3);\n\t--orange-pale: #fffafa;\n\t--green: #7ec636;\n\t--green-pale: #f0ffee;\n\t--widget-bg: var(--white);\n\t--widget-bg-hover: var(--grey);\n\t--widget-bg-active: var(--blue);\n\t--widget-bg-inactive: var(--grey-pale);\n\t--widget-bg-primary: var(--blue-semi);\n\t--widget-bg-primary-hover: #e0e7ff;\n\t--widget-bg-warn: #FFECB3;\n\t--widget-bg-danger: #FFCDD2;\n\t--widget-bg-success: #C8E6C9;\n\t--widget-border-div: var(--grey-pale);\n\t--widget-border-btn: var(--blue);\n\t--widget-font: var(--grey-dark);\n\t--widget-font-active: var(--white);\n\t--widget-font-direct: var(--blue);\n\t--widget-font-warn: #BF360C;\n\t--widget-font-danger: #B71C1C;\n\t--widget-font-success: #1B5E20;\n\t--font-family: "Atkinson Hyperlegible Next", sans-serif;\n\t--widget-option-left: #6A1B9A;\n\t--widget-option-right: #0D47A1;\n\toverscroll-behavior-y: contain;\n}\n\n.pnx-hidden { display: none !important; }\n\n/* Hidden elements on mobile */\n@container (max-width: 576px) {\n\t.pnx-mobile-hidden { display: none !important; }\n}\n\n/* Hidden elements on print */\n@media print {\n\t.pnx-print-hidden { display: none !important; }\n}\n'),document.adoptedStyleSheets.push(oo),document.adoptedStyleSheets.push(lo);class co extends ce{static properties={picture:{type:String,reflect:!0},sequence:{type:String,reflect:!0},"fetch-options":{converter:co.GetJSONConverter()},lang:{type:String},endpoint:{type:String}};constructor(e=!1){super(),this.lang=this.getAttribute("lang")||null,this.endpoint=this.getAttribute("endpoint")||null,this.picture=this.getAttribute("picture")||null,this.sequence=this.getAttribute("sequence")||null,console.info(`📷 Panoramax ${this.getClassName()} - Version 5.3.0 (e555dbf)\n\n🆘 Issues can be reported at https://gitlab.com/panoramax/clients/web-viewer/-/work_items`),e||(this._isInternetFast=null,$e().then(e=>this._isInternetFast=e))}connectedCallback(){super.connectedCallback(),this._t=dt(this.lang),this.loader=bs("pnx-loader",{_parent:this,"no-label":Ye()}),this._loadsAPI&&this.endpoint&&this._loadsAPI===this.endpoint||this.api&&this.api._endpoint===this.endpoint||!this.endpoint||((this._loadsAPI||this.api)&&(delete this.api,delete this._loadsAPI),this._setupAPI()),Object.entries({map:"map-options",psv:"psv-options",fetchOptions:"fetch-options",mapstyle:"map-style"}).forEach(([e,t])=>{this.getAttribute(e)&&console.error(`Component attribute "${e}" has been renamed into "${t}". Old attribute "${e}" is ignored.`)}),Ye()&&this.classList.add("pnx-iframed")}_setupAPI(){if(this.loader=this.loader||bs("pnx-loader",{_parent:this}),!this.endpoint)return void console.warn("No endpoint is defined");this._loadsAPI=this.endpoint;let e=this.endpoint;try{this.api=new st(this.endpoint,{fetch:this["fetch-options"]}),this.api.onceReady().then(()=>{if(e!==this._loadsAPI||!this.api)return;let t=this.api.getUnavailableFeatures(),i=this.api.getAvailableFeatures();i=0===t.length?"✅ All features available":"✅ Available features: "+i.join(", "),t=0===t.length?"":"🚫 Unavailable features: "+t.join(", "),console.info(`🌐 Connected to API "${this.api._metadata.name}" (${this.api._endpoint})\nℹ️ API runs STAC ${this.api._metadata.stac_version} ${this.api._metadata.geovisio_version?"& GeoVisio "+this.api._metadata.geovisio_version:""}\n ${i}\n ${t}\n`.trim())}).catch(e=>this.loader?.dismiss?.(e,this._t?.pnx.error_api)).finally(()=>delete this._loadsAPI)}catch(e){delete this._loadsAPI,this.loader?.dismiss?this.loader.dismiss(e,this._t.pnx.error_api):console.error(e)}}onceReady(){throw new Error("You must override this method on sub-class")}onceAPIReady(){return this.api?this.api.onceReady():new Promise(e=>setTimeout(e,250)).then(this.onceAPIReady.bind(this))}createRenderRoot(){return this}attributeChangedCallback(e,t,i){if(super.attributeChangedCallback(e,t,i),"endpoint"===e&&(this._loadsAPI&&i&&this._loadsAPI===i||this.api&&this.api._endpoint===i||!i||((this._loadsAPI||this.api)&&(delete this.api,delete this._loadsAPI),this._setupAPI())),["picture","sequence"].includes(e)){let n,a,r,s;"picture"===e?(n=this.sequence,r=this.sequence,a=i,s=t):(n=i,r=t,a=this.picture,s=this.picture),this.dispatchEvent(new CustomEvent("select",{bubbles:!0,composed:!0,detail:{seqId:n,picId:a,prevSeqId:r,prevPicId:s}}))}}getClassName(){return"Basic"}select(e=null,t=null,i=!1){i&&(this.picture=null,this.sequence=null),this.picture=t,this.sequence=e}isWidthSmall(){return this?.offsetWidth<576}isWidthMedium(){return this?.offsetWidth>=576&&this?.offsetWidth<768}isHeightSmall(){return this?.offsetHeight<400}render(){return H`<p>Should not be used directly, use Viewer/CoverageMap/Editor instead</p>`}getSubComponentsNames(){return["loader","api"]}getAPI(){return this.api}addEventListener(e,t,i){let n=e.split(":").shift();if(n&&this.getSubComponentsNames().includes(n)){const a=e.substring(n.length+1);this[n]?.addEventListener?this[n].addEventListener(a,t,i):setTimeout(()=>this.addEventListener(e,t,i),50)}else super.addEventListener(e,t,i)}static GetJSONConverter(){return{fromAttribute:e=>null==e||""===e?null:"object"==typeof e||Array.isArray(e)?e:so.parse(e),toAttribute:e=>null==e||""===e?"":"string"==typeof e?e:so.stringify(e)}}}var uo="data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8' standalone='no'%3f%3e%3csvg width='48' height='48' viewBox='0 0 48 48' version='1.1' id='svg1' xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg'%3e %3cdefs id='defs1' /%3e %3cpath d='m 8.0222924%2c7.8597977 a 22.594107%2c22.594107 0 0 1 31.9555636%2c0.0027 L 24.001409%2c23.838916 Z' style='fill:%2354278f%3bfill-opacity:1%3bstroke:white%3bstroke-width:2.50003%3bstroke-miterlimit:4%3bstroke-dasharray:none%3bstroke-opacity:1' id='path1' /%3e %3ccircle cx='24' cy='24' r='9.9777565' style='fill:%23b39ddb%3bfill-opacity:1%3bstroke:white%3bstroke-width:2.49449%3bstroke-miterlimit:4%3bstroke-dasharray:none%3bstroke-opacity:1' id='circle1' /%3e%3c/svg%3e";const ho="pnx-aerial",po=15,mo=["!",["has","uncrowded"]],go=["==",["get","type"],"equirectangular"];function fo(e){return{PICTURES:{paint:{"circle-radius":["interpolate",["linear"],["zoom"],po,0,15.5,e?1:["case",mo,0,1],16.5,e?2:["case",mo,0,2],17,e?4:["case",mo,1,4],18,e?5:["case",mo,3,5],20,e?7:["case",mo,5,7],22,e?7:["case",mo,7,7]],"circle-opacity":["interpolate",["linear"],["zoom"],po,0,15.5,e?1:["case",mo,0,1],16.5,e?1:["case",mo,0,1],17,1],"circle-stroke-opacity":["case",["all",mo,go],.2,go,.4,0],"circle-stroke-width":["interpolate",["linear"],["zoom"],17.5,0,18.5,e?["case",go,10,2]:["case",["all",mo,go],0,go,10,mo,0,2],19.5,e?["case",go,10,2]:["case",["all",mo,go],10,go,10,mo,0,2]]},layout:{}},SEQUENCES:{paint:{"line-width":["interpolate",["linear"],["zoom"],0,.5,10,1.5,14.5,1.5,15.5,e?2:["case",mo,.5,2],22,e?4:["case",mo,1,4]]},layout:{"line-cap":"square"}},SEQUENCES_PLUS:{paint:{"line-width":["interpolate",["linear"],["zoom"],0,15,16,30],"line-opacity":0,"line-color":"#ff0000"},layout:{"line-cap":"square"}},GRID:{layout:{"circle-sort-key":["get","coef"]},paint:{"circle-color":["interpolate",["linear"],["get","coef"],0,"#fff",.1,Te.PALETTE_1,.25,Te.PALETTE_1,.5,Te.PALETTE_2,.75,Te.PALETTE_3,1,Te.PALETTE_4],"circle-opacity":["interpolate",["linear"],["zoom"],4,.5,5,1,6.75,1,7,0],"circle-radius":["interpolate",["linear"],["zoom"],1,["match",["get","coef"],0,0,1],5,["match",["get","coef"],0,0,2.5],7,["match",["get","coef"],0,0,7]]}}}}const Ao=fo(!1),_o=fo(!0),vo=["case",["==",["get","type"],"equirectangular"],["case",["has","h_pixel_density"],["step",["get","h_pixel_density"],...Fe],1],["case",["has","h_pixel_density"],["step",["get","h_pixel_density"],...Ie],1]],yo=["case",["==",["get","gps_accuracy"],0],1,["has","gps_accuracy"],["step",["get","gps_accuracy"],...ze],1],xo=["round",["+",["*",vo,.8],["*",yo,.2]]],bo=864e5,wo=e=>new Date(e).toISOString().split("T")[0],Eo=Date.now(),ko=wo(Eo-180*bo),So=wo(Eo-365*bo),Mo=wo(Eo-94608e6),Co={default:{id:"default",sort:[],color:[["==",["get","coef"],1],Te.PALETTE_4,[">=",["get","coef"],.75],Te.PALETTE_3,[">=",["get","coef"],.5],Te.PALETTE_2,[">=",["get","coef"],.25],Te.PALETTE_1,[">=",["get","coef"],.1],Te.PALETTE_1,Te.PALETTE_0]},age:{id:"age",sort:[["!",["any",["has","date"],["has","ts"]]],0,[">=",["coalesce",["get","date"],["get","ts"]],ko],50,[">=",["coalesce",["get","date"],["get","ts"]],So],49,[">=",["coalesce",["get","date"],["get","ts"]],Mo],48],color:[["!",["any",["has","date"],["has","ts"]]],Te.BASE,[">=",["coalesce",["get","date"],["get","ts"]],ko],Te.PALETTE_4,[">=",["coalesce",["get","date"],["get","ts"]],So],Te.PALETTE_3,[">=",["coalesce",["get","date"],["get","ts"]],Mo],Te.PALETTE_2,Te.PALETTE_1]},type:{id:"type",sort:[["!",["has","type"]],0,["==",["get","type"],"equirectangular"],50],color:[["!",["has","type"]],Te.BASE,["==",["get","type"],"equirectangular"],Te.QUALI_1,Te.QUALI_2]},score:{id:"score",sort:[["==",xo,5],80,["==",xo,4],65,["==",xo,3],50,["==",xo,2],35,["==",xo,1],20],color:[["==",xo,5],Pe[0].color,["==",xo,4],Pe[1].color,["==",xo,3],Pe[2].color,["==",xo,2],Pe[3].color,Pe[4].color]},gps:{id:"gps",sort:[["==",yo,5],80,["==",yo,4],65,["==",yo,3],50,["==",yo,2],35,["==",yo,1],20],color:[[">=",yo,Re[0].score],Re[0].color,["==",yo,Re[1].score],Re[1].color,["==",yo,Re[2].score],Re[2].color,Re[3].color]}};function To(e){const t=document.createElement("img");return Ue(uo,t),t.alt=e.loading,t.title=e.loading,t.classList.add("pnx-map-thumb","pnx-map-thumb-loader"),t}function Do(e){return null==e||Array.isArray(e)&&(2===e.length&&0===e[0]&&0===e[1]||e.length<2)}function Po(e){return"symbol"===e.type&&void 0!==e?.layout?.["text-field"]&&(void 0===e.minzoom||e.minzoom<15)}function Io(e){const t=e?.metadata?.["panoramax:fields"]||{};return t?.grid?.includes("logged_coef_360_pictures")&&t?.grid?.includes("logged_coef_flat_pictures")&&t?.grid?.includes("logged_coef")||!1}function Fo(e){const t=2===e.metadata?.["panoramax:tiles_version"],i=Object.keys(e.sources)[0],n="vector"===e.sources[i].type,a=n?Ao:_o;if(t)return e.layers.push({id:`${i}_sequences_plus`,type:"line",source:i,"source-layer":"sequences",layout:{...a.SEQUENCES_PLUS.layout},paint:{...a.SEQUENCES_PLUS.paint}}),e.layers;const r=[{id:`${i}_sequences`,type:"line",source:i,"source-layer":n?"sequences":void 0,layout:{...a.SEQUENCES.layout},paint:{...a.SEQUENCES.paint,"line-color":Te.BASE}},{id:`${i}_sequences_plus`,type:"line",source:i,"source-layer":n?"sequences":void 0,layout:{...a.SEQUENCES_PLUS.layout},paint:{...a.SEQUENCES_PLUS.paint}},{id:`${i}_pictures`,type:"circle",source:i,"source-layer":n?"pictures":void 0,layout:{...a.PICTURES.layout},paint:{...a.PICTURES.paint,"circle-color":Te.BASE}}];return e?.metadata?.["panoramax:fields"]?.grid&&r.push({id:`${i}_grid`,type:"circle",source:i,"source-layer":"grid",layout:{...a.GRID.layout},paint:{...a.GRID.paint}}),r}function zo(e){return!["default","metacatalog","",null,void 0].includes(e)}function Ro(e,t){if(Array.isArray(e))return e.map(e=>Ro(e,t));if("object"==typeof e&&null!==e){const i={};for(const n in e)i[n]=Ro(e[n],t);return i}return"string"==typeof e&&(e.startsWith("coef")||e.startsWith("logged_coef"))?t:e}function Lo(e){const t=t=>{Le(t.detail.picId)?(e.map.displayPictureMarker(),e?.isMapWide?.()&&e?.mini?.setAttribute("collapsed","")):(e.map.displayPictureMarker(t.detail.lon,t.detail.lat,e.psv.getXY().x,t.detail.first&&!Do(e._initParams?.getMapPostInit()?.center),t.detail.picId),e?.isMapWide?.()&&e?.mini?.removeAttribute("collapsed"))};e.psv.addEventListener("picture-loading",t),e.psv.addEventListener("picture-loaded",t),e.psv.addEventListener("picture-failed",t),e.psv.addEventListener("view-rotated",()=>{let t=nt(e.psv.getPosition().yaw);t+=e.psv.getPictureOriginalHeading(),e.map._picMarker.setRotation(t)}),e.psv.addEventListener("picture-preview-started",t=>{e.map._picMarkerPreview.setLngLat(t.detail.coordinates).setRotation(t.detail.direction||0).addTo(e.map)}),e.psv.addEventListener("picture-preview-stopped",()=>{e.map._picMarkerPreview.remove()}),e.psv.addEventListener("picture-loaded",t=>{e.isWidthSmall()&&e._picPopup&&t.detail.picId===e._picPopup._picId&&e._picPopup.remove()}),e.map.on("picture-click",t=>{e.select(t.seqId,t.picId),!e.psv._myVTour.state.currentNode&&e?._setFocus&&e._setFocus("pic")}),e.map.on("sequence-click",t=>{(e.getAPI?.()||e.api).getPicturesAroundCoordinates(t.coordinates.lat,t.coordinates.lng,.01,1,t.seqId).then(t=>{t?.features?.length>0&&(e.select(t.features[0]?.collection,t.features[0].id),!e.psv.getPictureMetadata()&&e?._setFocus&&e._setFocus("pic"))})}),e._setFocus&&(e.psv.addEventListener("dblclick",()=>{e.isMapWide()&&e._setFocus("pic")}),e.map.on("dblclick",()=>{e.isMapWide()?"any"===e.psv.getPicturesNavigation()&&e.select():e._setFocus("map")}),e.addEventListener("focus-changed",t=>{"map"!==t.detail.focus&&e.map._dropPreview()}))}function Bo(e){e.map.keyboard.keydown=function(t){if(t.altKey||t.ctrlKey||t.metaKey)return;switch(t.key){case"*":case"5":return void e.moveCenter();case"PageUp":case"9":return void e.psv.goToNextPicture();case"PageDown":case"3":return void e.psv.goToPrevPicture();case"Home":case"7":return t.stopPropagation(),void e._toggleFocus();case"End":case"1":return void e.mini.toggleAttribute("collapsed");case" ":case"0":return void e.psv.toggleSequencePlaying()}let i=0,n=0,a=0,r=0,s=0;switch(t.keyCode){case 61:case 107:case 171:case 187:i=1;break;case 189:case 109:case 173:i=-1;break;case 37:case 100:t.shiftKey?n=-1:(t.preventDefault(),r=-1);break;case 39:case 102:t.shiftKey?n=1:(t.preventDefault(),r=1);break;case 38:case 104:t.shiftKey?a=1:(t.preventDefault(),s=-1);break;case 40:case 98:t.shiftKey?a=-1:(t.preventDefault(),s=1);break;default:return}return this._rotationDisabled&&(n=0,a=0),{cameraAnimation:e=>{const o=this._tr;e.easeTo({duration:300,easeId:"keyboardHandler",easing:e=>e*(2-e),zoom:i?Math.round(o.zoom)+i*(t.shiftKey?2:1):o.zoom,bearing:o.bearing+n*this._bearingStep,pitch:o.pitch+a*this._pitchStep,offset:[-r*this._panStep,-s*this._panStep],center:o.center},{originalEvent:t})}}}.bind(e.map.keyboard)}const Oo="pnx-map-parameters";function Uo(){const e=localStorage.getItem(Oo);if(!e)return{};try{return JSON.parse(e)}catch(e){return console.warn("Can't read map parameters stored in localStorage",e),{}}}function No(e){const t=()=>localStorage.setItem(Oo,JSON.stringify({center:Object.fromEntries(Object.entries(e.getCenter()).map(([e,t])=>[e,t.toFixed(7)])),zoom:e.getZoom().toFixed(1),background:e._parent.mapStyleComposer.basemap,theme:e._parent.mapStyleComposer.panoramaxTheme,endpoint:e._parent.mapStyleComposer.panoramax}));e._parent.mapStyleComposer.addEventListener("filters-changed",t),e._parent.mapStyleComposer.addEventListener("theme-changed",t),e._parent.mapStyleComposer.addEventListener("basemap-changed",t),e._parent.mapStyleComposer.addEventListener("panoramax-changed",t),e.on("moveend",t),e.on("zoomend",t),e.on("dragend",t),e.on("boxzoomend",t)}var jo=Object.freeze({__proto__:null,MAP_EXPR_QUALITYSCORE:xo,MAP_EXPR_QUALITYSCORE_GPS:yo,MAP_THEMES_STYLES:Co,RASTER_LAYER_ID:ho,TILES_PICTURES_SYMBOL_ZOOM:19,TILES_PICTURES_ZOOM:po,VECTOR_STYLES:Ao,VECTOR_STYLES_NOCROWD:_o,getMapParamsFromLocalStorage:Uo,getPanoramaxLayers:Fo,getThumbGif:To,hasStyleLoggedGridStats:Io,initMapKeyboardHandler:Bo,isLabelLayer:Po,isNullCoordinates:Do,isPanoramaxEndpointSingleUser:zo,linkMapAndPhoto:Lo,mapFiltersFormValues:function(e,t,i){const n=e?.shadowRoot.getElementById("pnx-filter-date-from"),a=e?.shadowRoot.getElementById("pnx-filter-date-end"),r=e?.shadowRoot.querySelectorAll("input[name='pnx-filter-type']"),s=e?.shadowRoot.getElementById("pnx-pictures-source");let o="";for(let e=0;e<r.length;e++){const t=r[e];if(t.checked){o=t.value;break}}let l=[],c=[];if(i){const t=e?.shadowRoot.getElementById("pnx-filter-qualityscore");l=(t?.grade||"").split(",").map(e=>parseInt(e)).filter(e=>!isNaN(e));const i=e?.shadowRoot.getElementById("pnx-filter-gps");c=(i?.grade||"").split(",").map(e=>parseInt(e)).filter(e=>!isNaN(e))}return{minDate:n?.value,maxDate:a?.value,pic_type:o,theme:t?.value,qualityscore:l,gps:c,source:s?.checked?"local":"metacatalog"}},mapFiltersToLayersFilters:function(e,t=!1,i=null){let n={},a=[],r=[],s=!1;if(e.minDate&&""!==e.minDate&&(n.minDate=e.minDate,a.push([">=",["get","date"],e.minDate]),r.push([">=",["get","ts"],e.minDate])),e.maxDate&&""!==e.maxDate){n.maxDate=e.maxDate,a.push(["<=",["get","date"],e.maxDate]);let t=new Date(e.maxDate);t.setDate(t.getDate()+1),t=t.toISOString().split("T")[0],r.push(["<=",["get","ts"],t])}if(e.pic_type&&""!==e.pic_type&&(n.pic_type="flat"===e.pic_type?"flat":"equirectangular",a.push(["==",["get","type"],n.pic_type]),r.push(["==",["get","type"],n.pic_type])),t&&(s=!0),e.camera&&""!==e.camera){n.camera=e.camera;const t=e.camera.toLowerCase().trim()+" ",i=e.camera.toLowerCase().trim()+"zzzzzzzzzzzzzzzzzzzz",s=["collator",{"case-sensitive":!1,"diacritic-sensitive":!1}];a.push([">=",["get","model"],t,s]),a.push(["<=",["get","model"],i,s]),r.push([">=",["get","model"],t,s]),r.push(["<=",["get","model"],i,s])}return e.qualityscore&&e.qualityscore.length>0&&(n.qualityscore=e.qualityscore,a.push(["in",xo,["literal",n.qualityscore]]),r.push(["in",xo,["literal",n.qualityscore]])),e.gps&&e.gps.length>0&&(n.gps=e.gps,a.push(["in",yo,["literal",n.gps]]),r.push(["in",yo,["literal",n.gps]])),e.theme&&Co[e.theme]&&(n.theme=e.theme,s=!0),i?.pictures&&i.pictures.features?.length>=0&&("keep"===i.pictures.rule?r.push(["in",["get","id"],["literal",i.pictures.features]]):i.pictures.features.length>0&&r.push(["!",["in",["get","id"],["literal",i.pictures.features]]])),i?.sequences&&i.sequences.features?.length>=0&&("keep"===i.sequences.rule?a.push(["in",["get","id"],["literal",i.sequences.features]]):i.sequences.features.length>0&&a.push(["!",["in",["get","id"],["literal",i.sequences.features]]])),0===a.length?a=null:a.unshift("all"),0===r.length?r=null:(r.unshift("all"),r=["step",["zoom"],!0,po,r]),{mapFilters:n,mapSeqFilters:a,mapPicFilters:r,reloadMapStyle:s}},saveMapParamsToLocalStorage:No,switchCoefValue:Ro});function Vo(e,t,i,n){let a=n;const r=t+(i-t>>1);let s,o=i-t;const l=e[t],c=e[t+1],u=e[i],h=e[i+1];for(let n=t+3;n<i;n+=3){const t=qo(e[n],e[n+1],l,c,u,h);if(t>a)s=n,a=t;else if(t===a){const e=Math.abs(n-r);e<o&&(s=n,o=e)}}a>n&&(s-t>3&&Vo(e,t,s,n),e[s+2]=a,i-s>3&&Vo(e,s,i,n))}function qo(e,t,i,n,a,r){let s=a-i,o=r-n;if(0!==s||0!==o){const l=((e-i)*s+(t-n)*o)/(s*s+o*o);l>1?(i=a,n=r):l>0&&(i+=s*l,n+=o*l)}return s=e-i,o=t-n,s*s+o*o}function Go(e,t,i,n){const a={type:t,geom:i},r={id:null==e?null:e,type:a.type,geometry:a.geom,tags:n,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};switch(a.type){case"Point":case"MultiPoint":Wo(r,a.geom);break;case"LineString":Wo(r,a.geom.points);break;case"Polygon":Wo(r,a.geom[0].points);break;case"MultiLineString":for(const e of a.geom)Wo(r,e.points);break;case"MultiPolygon":for(const e of a.geom)Wo(r,e[0].points)}return r}function Ho(e){const t=e;e.points.length>64&&(t.points=new Float64Array(e.points))}function Wo(e,t){for(let i=0;i<t.length;i+=3)e.minX=Math.min(e.minX,t[i]),e.minY=Math.min(e.minY,t[i+1]),e.maxX=Math.max(e.maxX,t[i]),e.maxY=Math.max(e.maxY,t[i+1])}function Zo(e,t){const i=[];switch(e.type){case"FeatureCollection":for(let n=0;n<e.features.length;n++)Ko(i,e.features[n],t,n);break;case"Feature":Ko(i,e,t);break;default:Ko(i,{geometry:e,properties:void 0},t)}return i}function Ko(e,t,i,n,a=0){if(!t.geometry)return;if(a>1024)throw new Error("GeometryCollection nesting exceeds supported depth: 1024");if("GeometryCollection"===t.geometry.type)return void function(e,t,i,n,a,r=0){for(const s of i.geometries)Ko(e,{id:t.id,geometry:s,properties:t.properties},n,a,r)}(e,t,t.geometry,i,n,a+1);if(!t.geometry.coordinates?.length)return;const r=function(e,t,i){return t.promoteId?e.properties?.[t.promoteId]:t.generateId?i||0:e.id}(t,i,n),s=Math.pow(i.tolerance/((1<<i.maxZoom)*i.extent),2);switch(t.geometry.type){case"Point":return void function(e,t,i,n){const a=[];a.push(Yo(i.coordinates[0]),Jo(i.coordinates[1]),0),e.push(Go(t,"Point",a,n))}(e,r,t.geometry,t.properties);case"MultiPoint":return void function(e,t,i,n){const a=[];for(const e of i.coordinates)a.push(Yo(e[0]),Jo(e[1]),0);e.push(Go(t,"MultiPoint",a,n))}(e,r,t.geometry,t.properties);case"LineString":return void function(e,t,i,n,a){const r={points:[]};Xo(i.coordinates,r,n,!1),e.push(Go(t,"LineString",r,a))}(e,r,t.geometry,s,t.properties);case"MultiLineString":return void function(e,t,i,n,a,r){if(a.lineMetrics)for(const a of i.coordinates){const i={points:[]};Xo(a,i,n,!1),e.push(Go(t,"LineString",i,r))}else{const a=[];Qo(i.coordinates,a,n,!1),e.push(Go(t,"MultiLineString",a,r))}}(e,r,t.geometry,s,i,t.properties);case"Polygon":return void function(e,t,i,n,a){const r=[];Qo(i.coordinates,r,n,!0),e.push(Go(t,"Polygon",r,a))}(e,r,t.geometry,s,t.properties);case"MultiPolygon":return void function(e,t,i,n,a){const r=[];for(const e of i.coordinates){const t=[];Qo(e,t,n,!0),r.push(t)}e.push(Go(t,"MultiPolygon",r,a))}(e,r,t.geometry,s,t.properties);default:throw new Error("Input data is not a valid GeoJSON object.")}}function Xo(e,t,i,n){let a,r,s=0;for(let i=0;i<e.length;i++){const o=Yo(e[i][0]),l=Jo(e[i][1]);t.points.push(o,l,0),i>0&&(s+=n?(a*l-o*r)/2:Math.sqrt(Math.pow(o-a,2)+Math.pow(l-r,2))),a=o,r=l}const o=t.points.length-3;t.points[2]=1,i>0&&Vo(t.points,0,o,i),t.points[o+2]=1,Ho(t),t.size=Math.abs(s),t.start=0,t.end=t.size}function Qo(e,t,i,n){for(let a=0;a<e.length;a++){const r={points:[]};Xo(e[a],r,i,n),t.push(r)}}function Yo(e){return e/360+.5}function Jo(e){const t=Math.sin(e*Math.PI/180),i=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return i<0?0:i>1?1:i}function $o(e){const t={type:"Feature",geometry:el(e),properties:e.tags};return null!=e.id&&(t.id=e.id),t}function el(e){const{type:t,geometry:i}=e;switch(t){case"Point":return{type:t,coordinates:il(i[0],i[1])};case"MultiPoint":return{type:t,coordinates:tl(i)};case"LineString":return{type:t,coordinates:tl(i.points)};case"MultiLineString":case"Polygon":return{type:t,coordinates:i.map(e=>tl(e.points))};case"MultiPolygon":return{type:t,coordinates:i.map(e=>e.map(e=>tl(e.points)))}}}function tl(e){const t=[];for(let i=0;i<e.length;i+=3)t.push(il(e[i],e[i+1]));return t}function il(e,t){return[nl(e),al(t)]}function nl(e){return 360*(e-.5)}function al(e){const t=(180-360*e)*Math.PI/180;return 360*Math.atan(Math.exp(t))/Math.PI-90}function rl(e,t,i,n,a,r,s,o){if(n/=t,r>=(i/=t)&&s<n)return e;if(s<i||r>=n)return null;const l=[];for(const t of e){const e=0===a?t.minX:t.minY,r=0===a?t.maxX:t.maxY;if(e>=i&&r<n)l.push(t);else if(!(r<i||e>=n))switch(t.type){case"Point":case"MultiPoint":sl(t,l,i,n,a);continue;case"LineString":ol(t,l,i,n,a,o);continue;case"MultiLineString":ll(t,l,i,n,a);continue;case"Polygon":cl(t,l,i,n,a);continue;case"MultiPolygon":ul(t,l,i,n,a);continue}}return l.length?l:null}function sl(e,t,i,n,a){const r=[];if(function(e,t,i,n,a){for(let r=0;r<e.length;r+=3){const s=e[r+a];s>=i&&s<=n&&ml(t,e[r],e[r+1],e[r+2])}}(e.geometry,r,i,n,a),!r.length)return;const s=3===r.length?"Point":"MultiPoint";t.push(Go(e.id,s,r,e.tags))}function ol(e,t,i,n,a,r){const s=[];if(hl(e.geometry,s,i,n,a,!1,r.lineMetrics),s.length)if(r.lineMetrics)for(const i of s)t.push(Go(e.id,"LineString",i,e.tags));else s.length>1?t.push(Go(e.id,"MultiLineString",s,e.tags)):t.push(Go(e.id,"LineString",s[0],e.tags))}function ll(e,t,i,n,a){const r=[];pl(e.geometry,r,i,n,a,!1),r.length&&(1!==r.length?t.push(Go(e.id,"MultiLineString",r,e.tags)):t.push(Go(e.id,"LineString",r[0],e.tags)))}function cl(e,t,i,n,a){const r=[];pl(e.geometry,r,i,n,a,!0),r.length&&t.push(Go(e.id,"Polygon",r,e.tags))}function ul(e,t,i,n,a){const r=[];for(const t of e.geometry){const e=[];pl(t,e,i,n,a,!0),e.length&&r.push(e)}r.length&&t.push(Go(e.id,"MultiPolygon",r,e.tags))}function hl(e,t,i,n,a,r,s){let o=dl(e);const l=0===a?gl:fl;let c,u,h=e.start;for(let d=0;d<e.points.length-3;d+=3){const p=e.points[d],m=e.points[d+1],g=e.points[d+2],f=e.points[d+3],A=e.points[d+4],_=0===a?p:m,v=0===a?f:A;let y=!1;s&&(c=Math.sqrt(Math.pow(p-f,2)+Math.pow(m-A,2))),_<i?v>i&&(u=l(o,p,m,f,A,i),s&&(o.start=h+c*u)):_>n?v<n&&(u=l(o,p,m,f,A,n),s&&(o.start=h+c*u)):ml(o.points,p,m,g),v<i&&_>=i&&(u=l(o,p,m,f,A,i),y=!0),v>n&&_<=n&&(u=l(o,p,m,f,A,n),y=!0),!r&&y&&(s&&(o.end=h+c*u),t.push(o),o=dl(e)),s&&(h+=c)}let d=e.points.length-3;const p=e.points[d],m=e.points[d+1],g=e.points[d+2],f=0===a?p:m;f>=i&&f<=n&&ml(o.points,p,m,g),d=o.points.length-3,r&&d>=3&&(o.points[d]!==o.points[0]||o.points[d+1]!==o.points[1])&&ml(o.points,o.points[0],o.points[1],o.points[2]),o.points.length&&(Ho(o),t.push(o))}function dl(e){return{points:[],size:e.size,start:e.start,end:e.end}}function pl(e,t,i,n,a,r){for(const s of e)hl(s,t,i,n,a,r,!1)}function ml(e,t,i,n){e.push(t,i,n)}function gl(e,t,i,n,a,r){const s=(r-t)/(n-t);return ml(e.points,r,i+(a-i)*s,1),s}function fl(e,t,i,n,a,r){const s=(r-i)/(a-i);return ml(e.points,t+(n-t)*s,r,1),s}function Al(e,t){const i=t.buffer/t.extent;let n=e;const a=rl(e,1,-1-i,i,0,-1,2,t),r=rl(e,1,1-i,2+i,0,-1,2,t);return a||r?(n=rl(e,1,-i,1+i,0,-1,2,t)||[],a&&(n=_l(a,1).concat(n)),r&&(n=n.concat(_l(r,-1))),n):n}function _l(e,t){const i=[];for(const n of e)switch(n.type){case"Point":case"MultiPoint":{const e=vl(n.geometry,t);i.push(Go(n.id,n.type,e,n.tags));continue}case"LineString":{const e=yl(n.geometry,t);i.push(Go(n.id,n.type,e,n.tags));continue}case"MultiLineString":case"Polygon":{const e=[];for(const i of n.geometry)e.push(yl(i,t));i.push(Go(n.id,n.type,e,n.tags));continue}case"MultiPolygon":{const e=[];for(const i of n.geometry){const n=[];for(const e of i)n.push(yl(e,t));e.push(n)}i.push(Go(n.id,n.type,e,n.tags));continue}}return i}function vl(e,t){const i=[];for(let n=0;n<e.length;n+=3)i.push(e[n]+t,e[n+1],e[n+2]);return i}function yl(e,t){const i={points:[],size:e.size};void 0!==e.start&&(i.start=e.start,i.end=e.end);for(let n=0;n<e.points.length;n+=3)i.points.push(e.points[n]+t,e.points[n+1],e.points[n+2]);return Ho(i),i}function xl(e,t,i){const n=function(e,t){return e?{removeAll:e.removeAll,remove:new Set(e.remove||[]),add:new Map(e.add?.map(e=>[t.promoteId?e.properties[t.promoteId]:e.id,e])),update:new Map(e.update?.map(e=>[e.id,e]))}:{remove:new Set,add:new Map,update:new Map}}(t,i);let a=[];if(n.removeAll&&(a=e,e=[]),n.remove.size||n.add.size){const t=[];for(const i of e)(n.remove.has(i.id)||n.add.has(i.id))&&t.push(i);if(t.length){a=a.concat(t);const i=new Set(t.map(e=>e.id));e=e.filter(e=>!i.has(e.id))}if(n.add.size){let t=Zo({type:"FeatureCollection",features:Array.from(n.add.values())},i);t=Al(t,i),a=a.concat(t),e=e.concat(t)}}if(n.update.size){const t=new Map;let r=[];for(const i of e)n.update.has(i.id)?t.set(i.id,[...t.get(i.id)||[],i]):r.push(i);for(const[e,s]of n.update){const n=t.get(e);if(!n||0===n.length)continue;const o=bl(n,s,i);a=a.concat(n,o),r=r.concat(o)}e=r}return{affected:a,source:e}}function bl(e,t,i){const n=!!t.newGeometry,a=t.removeAllProperties||t.removeProperties?.length>0||t.addOrUpdateProperties?.length>0;if(n){const n=e[0];let r=Zo({type:"FeatureCollection",features:[{type:"Feature",id:n.id,geometry:t.newGeometry,properties:a?wl(n.tags,t):n.tags}]},i);return r=Al(r,i),r}if(a){const i=[];for(const n of e){const e={...n};e.tags=wl(e.tags,t),i.push(e)}return i}return e}function wl(e,t){if(t.removeAllProperties)return{};const i={...e||{}};if(t.removeProperties)for(const e of t.removeProperties)delete i[e];if(t.addOrUpdateProperties)for(const{key:e,value:n}of t.addOrUpdateProperties)i[e]=n;return i}const El=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],kl=new Uint32Array(96);var Sl=class e{static from(t){if(!t||void 0===t.byteLength||t.buffer)throw new Error("Data must be an instance of ArrayBuffer or SharedArrayBuffer.");const[i,n]=new Uint8Array(t,0,2);if(219!==i)throw new Error("Data does not appear to be in a KDBush format.");const a=n>>4;if(1!==a)throw new Error(`Got v${a} data when expected v1.`);const r=El[15&n];if(!r)throw new Error("Unrecognized array type.");const[s]=new Uint16Array(t,2,1),[o]=new Uint32Array(t,4,1);return new e(o,s,r,void 0,t)}constructor(e,t=64,i=Float64Array,n=ArrayBuffer,a){if(isNaN(e)||e<0)throw new Error(`Unexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+t,2),65535),this.ArrayType=i,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;const r=El.indexOf(this.ArrayType),s=2*e*this.ArrayType.BYTES_PER_ELEMENT,o=e*this.IndexArrayType.BYTES_PER_ELEMENT,l=(8-o%8)%8;if(r<0)throw new Error(`Unexpected typed array class: ${i}.`);if(a)this.data=a,this.ids=new this.IndexArrayType(a,8,e),this.coords=new i(a,8+o+l,2*e),this._pos=2*e,this._finished=!0;else{const a=this.data=new n(8+s+o+l);this.ids=new this.IndexArrayType(a,8,e),this.coords=new i(a,8+o+l,2*e),this._pos=0,this._finished=!1,new Uint8Array(a,0,2).set([219,16+r]),new Uint16Array(a,2,1)[0]=t,new Uint32Array(a,4,1)[0]=e}}add(e,t){const i=this._pos>>1;return this.ids[i]=i,this.coords[this._pos++]=e,this.coords[this._pos++]=t,i}finish(){const e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return Ml(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,t,i,n){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:a,coords:r,nodeSize:s}=this;kl[0]=0,kl[1]=a.length-1,kl[2]=0;let o=3;const l=[];for(;o>0;){const c=kl[--o],u=kl[--o],h=kl[--o];if(u-h<=s){for(let s=h;s<=u;s++){const o=r[2*s],c=r[2*s+1];o>=e&&o<=i&&c>=t&&c<=n&&l.push(a[s])}continue}const d=h+u>>1,p=r[2*d],m=r[2*d+1];p>=e&&p<=i&&m>=t&&m<=n&&l.push(a[d]),(0===c?e<=p:t<=m)&&(kl[o++]=h,kl[o++]=d-1,kl[o++]=1-c),(0===c?i>=p:n>=m)&&(kl[o++]=d+1,kl[o++]=u,kl[o++]=1-c)}return l}within(e,t,i){const n=[];return this.withinInto(e,t,i,n),n}withinInto(e,t,i,n){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:a,coords:r,nodeSize:s}=this;kl[0]=0,kl[1]=a.length-1,kl[2]=0;let o=3,l=0;const c=i*i;for(;o>0;){const u=kl[--o],h=kl[--o],d=kl[--o];if(h-d<=s){for(let i=d;i<=h;i++)Pl(r[2*i],r[2*i+1],e,t)<=c&&(n[l++]=a[i]);continue}const p=d+h>>1,m=r[2*p],g=r[2*p+1];Pl(m,g,e,t)<=c&&(n[l++]=a[p]),(0===u?e-i<=m:t-i<=g)&&(kl[o++]=d,kl[o++]=p-1,kl[o++]=1-u),(0===u?e+i>=m:t+i>=g)&&(kl[o++]=p+1,kl[o++]=h,kl[o++]=1-u)}return l}};function Ml(e,t,i,n,a,r){if(a-n<=i)return;const s=n+a>>1;Cl(e,t,s,n,a,r),Ml(e,t,i,n,s-1,1-r),Ml(e,t,i,s+1,a,1-r)}function Cl(e,t,i,n,a,r){for(;a>n;){if(a-n>600){const s=a-n+1,o=i-n+1,l=Math.log(s),c=.5*Math.exp(2*l/3),u=.5*Math.sqrt(l*c*(s-c)/s)*(o-s/2<0?-1:1);Cl(e,t,i,Math.max(n,Math.floor(i-o*c/s+u)),Math.min(a,Math.floor(i+(s-o)*c/s+u)),r)}const s=t[2*i+r];let o=n,l=a;for(Tl(e,t,n,i),t[2*a+r]>s&&Tl(e,t,n,a);o<l;){for(Tl(e,t,o,l),o++,l--;t[2*o+r]<s;)o++;for(;t[2*l+r]>s;)l--}t[2*n+r]===s?Tl(e,t,n,l):(l++,Tl(e,t,l,a)),l<=i&&(n=l+1),i<=l&&(a=l-1)}}function Tl(e,t,i,n){Dl(e,i,n),Dl(t,2*i,2*n),Dl(t,2*i+1,2*n+1)}function Dl(e,t,i){const n=e[t];e[t]=e[i],e[i]=n}function Pl(e,t,i,n){const a=e-i,r=t-n;return a*a+r*r}const Il={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:e=>e};var Fl=class{constructor(e){this.options=Object.assign(Object.create(Il),e),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[],this.points=[]}load(e){const t=[];for(const i of e){if(!i.geometry)continue;const[e,n]=i.geometry.coordinates,[a,r]=[Yo(e),Jo(n)],s={id:i.id,type:"Point",geometry:[a,r],tags:i.properties};t.push(s)}this.createIndex(t)}initialize(e){const t=[];for(const i of e)"Point"===i.type&&t.push(i);this.createIndex(t)}updateIndex(e,t,i){this.options=Object.assign(Object.create(Il),i.clusterOptions),this.initialize(e)}createIndex(e){const{log:t,minZoom:i,maxZoom:n}=this.options;t&&console.time("total time");const a=`prepare ${e.length} points`;t&&console.time(a),this.points=e;const r=[];for(let t=0;t<e.length;t++){const i=e[t];if(!i?.geometry)continue;let[n,a]=i.geometry;n=Math.fround(n),a=Math.fround(a),r.push(n,a,1/0,t,-1,1),this.options.reduce&&r.push(0)}let s=this.trees[n+1]=this.createTree(r);t&&console.timeEnd(a);for(let e=n;e>=i;e--){const i=Date.now();s=this.trees[e]=this.createTree(this.cluster(s,e)),t&&console.log("z%d: %d clusters in %dms",e,s.numItems,Date.now()-i)}t&&console.timeEnd("total time")}getClusters(e,t){return this.getClustersInternal(e,t).map(e=>$o(e))}getClustersInternal(e,t){let i=((e[0]+180)%360+360)%360-180;const n=Math.max(-90,Math.min(90,e[1]));let a=180===e[2]?180:((e[2]+180)%360+360)%360-180;const r=Math.max(-90,Math.min(90,e[3]));if(e[2]-e[0]>=360)i=-180,a=180;else if(i>a){const e=this.getClustersInternal([i,n,180,r],t),s=this.getClustersInternal([-180,n,a,r],t);return e.concat(s)}const s=this.trees[this.limitZoom(t)],o=s.range(Yo(i),Jo(r),Yo(a),Jo(n)),l=s.flatData,c=[];for(const e of o){const t=this.stride*e;c.push(l[t+5]>1?zl(l,t,this.clusterProps):this.points[l[t+3]])}return c}getChildren(e){const t=this.getOriginId(e),i=this.getOriginZoom(e),n=new Error("No cluster with the specified id: "+e),a=this.trees[i];if(!a)throw n;const r=a.flatData;if(t*this.stride>=r.length)throw n;const s=this.options.radius/(this.options.extent*Math.pow(2,i-1)),o=r[t*this.stride],l=r[t*this.stride+1],c=a.within(o,l,s),u=[];for(const t of c){const i=t*this.stride;r[i+4]===e&&u.push(r[i+5]>1?Rl(r,i,this.clusterProps):$o(this.points[r[i+3]]))}if(0===u.length)throw n;return u}getLeaves(e,t,i){t=t||10,i=i||0;const n=[];return this.appendLeaves(n,e,t,i,0),n}getTile(e,t,i){const n=this.trees[this.limitZoom(e)];if(!n)return null;const a=Math.pow(2,e),{extent:r,radius:s}=this.options,o=s/r,l=(i-o)/a,c=(i+1+o)/a,u={transformed:!0,features:[],source:null,x:t,y:i,z:e};return this.addTileFeatures(n.range((t-o)/a,l,(t+1+o)/a,c),n.flatData,t,i,a,u),0===t&&this.addTileFeatures(n.range(1-o/a,l,1,c),n.flatData,a,i,a,u),t===a-1&&this.addTileFeatures(n.range(0,l,o/a,c),n.flatData,-1,i,a,u),u}getClusterExpansionZoom(e){return this.getOriginZoom(e)}appendLeaves(e,t,i,n,a){const r=this.getChildren(t);for(const t of r){const r=t.properties;if(r?.cluster?a+r.point_count<=n?a+=r.point_count:a=this.appendLeaves(e,r.cluster_id,i,n,a):a<n?a++:e.push(t),e.length===i)break}return a}createTree(e){const t=new Sl(e.length/this.stride|0,this.options.nodeSize,Float32Array);for(let i=0;i<e.length;i+=this.stride)t.add(e[i],e[i+1]);return t.finish(),t.flatData=e,t.data=null,t}addTileFeatures(e,t,i,n,a,r){for(const s of e){const e=s*this.stride,o=t[e+5]>1;let l,c,u;if(o)l=Ll(t,e,this.clusterProps),c=t[e],u=t[e+1];else{const i=this.points[t[e+3]];l=i.tags,[c,u]=i.geometry}const h={type:1,geometry:[[Math.round(this.options.extent*(c*a-i)),Math.round(this.options.extent*(u*a-n))]],tags:l};let d;d=o||this.options.generateId?t[e+3]:this.points[t[e+3]].id,void 0!==d&&(h.id=d),r.features.push(h)}}limitZoom(e){return Math.max(this.options.minZoom,Math.min(Math.floor(+e),this.options.maxZoom+1))}cluster(e,t){const{radius:i,extent:n,reduce:a,minPoints:r}=this.options,s=i/(n*Math.pow(2,t)),o=e.flatData,l=[],c=this.stride;for(let i=0;i<o.length;i+=c){if(o[i+2]<=t)continue;o[i+2]=t;const n=o[i],u=o[i+1],h=e.within(o[i],o[i+1],s),d=o[i+5];let p=d;for(const e of h){const i=e*c;o[i+2]>t&&(p+=o[i+5])}if(p>d&&p>=r){let e,r=n*d,s=u*d,m=-1;const g=(i/c<<5)+(t+1)+this.points.length;for(const n of h){const l=n*c;if(o[l+2]<=t)continue;o[l+2]=t;const u=o[l+5];r+=o[l]*u,s+=o[l+1]*u,o[l+4]=g,a&&(e||(e=this.map(o,i,!0),m=this.clusterProps.length,this.clusterProps.push(e)),a(e,this.map(o,l)))}o[i+4]=g,l.push(r/p,s/p,1/0,g,-1,p),a&&l.push(m)}else{for(let e=0;e<c;e++)l.push(o[i+e]);if(p>1)for(const e of h){const i=e*c;if(!(o[i+2]<=t)){o[i+2]=t;for(let e=0;e<c;e++)l.push(o[i+e])}}}}return l}getOriginId(e){return e-this.points.length>>5}getOriginZoom(e){return(e-this.points.length)%32}map(e,t,i){if(e[t+5]>1){const n=this.clusterProps[e[t+6]];return i?Object.assign({},n):n}const n=this.points[e[t+3]].tags,a=this.options.map(n);return i&&a===n?Object.assign({},a):a}};function zl(e,t,i){return{id:e[t+3],type:"Point",tags:Ll(e,t,i),geometry:[e[t],e[t+1]]}}function Rl(e,t,i){return{type:"Feature",id:e[t+3],properties:Ll(e,t,i),geometry:{type:"Point",coordinates:[nl(e[t]),al(e[t+1])]}}}function Ll(e,t,i){const n=e[t+5],a=n>=1e4?`${Math.round(n/1e3)}k`:n>=1e3?Math.round(n/100)/10+"k":n,r=e[t+6],s=-1===r?{}:Object.assign({},i[r]);return Object.assign(s,{cluster:!0,cluster_id:e[t+3],point_count:n,point_count_abbreviated:a})}const Bl="geojsonvt_clip_start",Ol="geojsonvt_clip_end";function Ul(e,t,i,n,a){const r=t===a.maxZoom?0:a.tolerance/((1<<t)*a.extent),s={transformed:!1,features:[],source:null,x:i,y:n,z:t,minX:2,minY:1,maxX:-1,maxY:0,numPoints:0,numSimplified:0,numFeatures:e.length};for(const t of e)Nl(s,t,r,a);return s}function Nl(e,t,i,n){switch(e.minX=Math.min(e.minX,t.minX),e.minY=Math.min(e.minY,t.minY),e.maxX=Math.max(e.maxX,t.maxX),e.maxY=Math.max(e.maxY,t.maxY),t.type){case"Point":case"MultiPoint":return void function(e,t){const i=[];for(let n=0;n<t.geometry.length;n+=3)i.push(t.geometry[n],t.geometry[n+1]),e.numPoints++,e.numSimplified++;if(!i.length)return;const n={type:1,tags:t.tags||null,geometry:i};null!==t.id&&(n.id=t.id);e.features.push(n)}(e,t);case"LineString":return void function(e,t,i,n){const a=[];if(jl(a,t.geometry,e,i,!1,!1),!a.length)return;let r=t.tags||null;if(n.lineMetrics){r={};for(const e in t.tags)r[e]=t.tags[e];r[Bl]=t.geometry.start/t.geometry.size,r[Ol]=t.geometry.end/t.geometry.size}const s={type:2,tags:r,geometry:a};null!==t.id&&(s.id=t.id);e.features.push(s)}(e,t,i,n);case"MultiLineString":case"Polygon":return void function(e,t,i){const n=[];for(let a=0;a<t.geometry.length;a++)jl(n,t.geometry[a],e,i,"Polygon"===t.type,0===a);if(!n.length)return;const a={type:"Polygon"===t.type?3:2,tags:t.tags||null,geometry:n};null!==t.id&&(a.id=t.id);e.features.push(a)}(e,t,i);case"MultiPolygon":return void function(e,t,i){const n=[];for(let a=0;a<t.geometry.length;a++){const r=t.geometry[a];for(let t=0;t<r.length;t++)jl(n,r[t],e,i,!0,0===t)}if(!n.length)return;const a={type:3,tags:t.tags||null,geometry:n};null!==t.id&&(a.id=t.id);e.features.push(a)}(e,t,i)}}function jl(e,t,i,n,a,r){const s=n*n;if(n>0&&t.size<(a?s:n))return void(i.numPoints+=t.points.length/3);const o=[];for(let e=0;e<t.points.length;e+=3)(0===n||t.points[e+2]>s)&&(i.numSimplified++,o.push(t.points[e],t.points[e+1])),i.numPoints++;a&&function(e,t){let i=0;for(let t=0,n=e.length,a=n-2;t<n;a=t,t+=2)i+=(e[t]-e[a])*(e[t+1]+e[a+1]);if(i>0!==t)return;for(let t=0,i=e.length;t<i/2;t+=2){const n=e[t],a=e[t+1];e[t]=e[i-2-t],e[t+1]=e[i-1-t],e[i-2-t]=n,e[i-1-t]=a}}(o,r),e.push(o)}function Vl(e,t){if(e.transformed)return e;const i=1<<e.z,n=e.x,a=e.y;for(const r of e.features)1===r.type?ql(r,t,i,n,a):Gl(r,t,i,n,a);return e.transformed=!0,e}function ql(e,t,i,n,a){const r=e,s=e.geometry,o=[];for(let e=0;e<s.length;e+=2)o.push(Hl(s[e],s[e+1],t,i,n,a));return r.geometry=o,r}function Gl(e,t,i,n,a){const r=e,s=e.geometry,o=[];for(const e of s){const r=[];for(let s=0;s<e.length;s+=2)r.push(Hl(e[s],e[s+1],t,i,n,a));o.push(r)}return r.geometry=o,r}function Hl(e,t,i,n,a,r){return[Math.round(i*(e*n-a)),Math.round(i*(t*n-r))]}var Wl=class{constructor(e){this.options=e,this.total=0,this.stats={},this.tiles={},this.tileCoords=[],this.stats={},this.total=0}initialize(e){this.splitTile(e,0,0,0),this.options.debug&&(e.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)))}updateIndex(e,t,i){i.debug>1&&(console.log("invalidating tiles"),console.time("invalidating")),this.invalidateTiles(t),i.debug>1&&console.timeEnd("invalidating");const[n,a,r]=[0,0,0],s=Ul(e,n,a,r,i);s.source=e;const o=Zl(n,a,r);if(this.tiles[o]=s,this.tileCoords.push({z:n,x:a,y:r,id:o}),i.debug){const e=`z${n}`;this.stats[e]=(this.stats[e]||0)+1,this.total++}}getClusterExpansionZoom(e){return null}getChildren(e){return null}getLeaves(e,t,i){return null}getTile(e,t,i){const{extent:n,debug:a}=this.options,r=1<<e,s=Zl(e,t=t+r&r-1,i);if(this.tiles[s])return Vl(this.tiles[s],n);a>1&&console.log("drilling down to z%d-%d-%d",e,t,i);let o,l=e,c=t,u=i;for(;!o&&l>0;)l--,c>>=1,u>>=1,o=this.tiles[Zl(l,c,u)];return o?.source?(a>1&&(console.log("found parent tile z%d-%d-%d",l,c,u),console.time("drilling down")),this.splitTile(o.source,l,c,u,e,t,i),a>1&&console.timeEnd("drilling down"),this.tiles[s]?Vl(this.tiles[s],n):null):null}splitTile(e,t,i,n,a,r,s){const o=[e,t,i,n],l=this.options,c=l.debug;for(;o.length;){n=o.pop(),i=o.pop(),t=o.pop(),e=o.pop();const u=1<<t,h=Zl(t,i,n);let d=this.tiles[h];if(!d&&(c>1&&console.time("creation"),d=this.tiles[h]=Ul(e,t,i,n,l),this.tileCoords.push({z:t,x:i,y:n,id:h}),c)){c>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",t,i,n,d.numFeatures,d.numPoints,d.numSimplified),console.timeEnd("creation"));const e=`z${t}`;this.stats[e]=(this.stats[e]||0)+1,this.total++}if(d.source=e,null==a){if(t===l.indexMaxZoom||d.numPoints<=l.indexMaxPoints)continue}else{if(t===l.maxZoom||t===a)continue;if(null!=a){const e=a-t;if(i!==r>>e||n!==s>>e)continue}}if(d.source=null,!e.length)continue;c>1&&console.time("clipping");const p=.5*l.buffer/l.extent,m=.5-p,g=.5+p,f=1+p;let A=null,_=null,v=null,y=null;const x=rl(e,u,i-p,i+g,0,d.minX,d.maxX,l),b=rl(e,u,i+m,i+f,0,d.minX,d.maxX,l);x&&(A=rl(x,u,n-p,n+g,1,d.minY,d.maxY,l),_=rl(x,u,n+m,n+f,1,d.minY,d.maxY,l)),b&&(v=rl(b,u,n-p,n+g,1,d.minY,d.maxY,l),y=rl(b,u,n+m,n+f,1,d.minY,d.maxY,l)),c>1&&console.timeEnd("clipping"),o.push(A||[],t+1,2*i,2*n),o.push(_||[],t+1,2*i,2*n+1),o.push(v||[],t+1,2*i+1,2*n),o.push(y||[],t+1,2*i+1,2*n+1)}}invalidateTiles(e){if(!e.length)return;const t=this.options,{debug:i}=t;let n=1/0,a=-1/0,r=1/0,s=-1/0;for(const t of e)n=Math.min(n,t.minX),a=Math.max(a,t.maxX),r=Math.min(r,t.minY),s=Math.max(s,t.maxY);const o=t.buffer/t.extent,l=new Set;for(const t in this.tiles){const c=this.tiles[t],u=1<<c.z,h=(c.x-o)/u,d=(c.x+1+o)/u,p=(c.y-o)/u,m=(c.y+1+o)/u;if(a<h||n>=d||s<p||r>=m)continue;let g=!1;for(const t of e)if(t.maxX>=h&&t.minX<d&&t.maxY>=p&&t.minY<m){g=!0;break}if(g){if(i){i>1&&console.log("invalidate tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",c.z,c.x,c.y,c.numFeatures,c.numPoints,c.numSimplified);const e=`z${c.z}`;this.stats[e]=(this.stats[e]||0)-1,this.total--}delete this.tiles[t],l.add(t)}}l.size&&(this.tileCoords=this.tileCoords.filter(e=>!l.has(e.id)))}};function Zl(e,t,i){return 32*((1<<e)*i+t)+e}const Kl={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,updateable:!1,cluster:!1,clusterOptions:Il,debug:0};var Xl=class{constructor(e,t){const i=(t=this.options=Object.assign({},Kl,t)).debug;if(i&&console.time("preprocess data"),t.maxZoom<0||t.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(t.promoteId&&t.generateId)throw new Error("promoteId and generateId cannot be used together.");let n=Zo(e,t);i&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",t.indexMaxZoom,t.indexMaxPoints),console.time("generate tiles")),n=Al(n,t),t.updateable&&(this.source=n),this.initializeIndex(n,t)}initializeIndex(e,t){this.tileIndex=t.cluster?new Fl(t.clusterOptions):new Wl(t),e.length&&this.tileIndex.initialize(e)}getTile(e,t,i){return t=+t,i=+i,(e=+e)<0||e>24?null:this.tileIndex.getTile(e,t,i)}updateData(e,t){const i=this.options;if(!i.updateable)throw new Error("to update tile geojson `updateable` option must be set to true");let{affected:n,source:a}=xl(this.source,e,i);t&&({affected:n,source:a}=this.filterUpdate(a,n,t)),n.length&&(this.source=a,this.tileIndex.updateIndex(a,n,i))}filterUpdate(e,t,i){const n=new Set;for(const a of e)null!=a.id&&(i($o(a))||(t.push(a),n.add(a.id)));return{affected:t,source:e=e.filter(e=>!n.has(e.id))}}getData(){if(!this.options.updateable)throw new Error("to retrieve data the `updateable` option must be set to true");return function(e){return{type:"FeatureCollection",features:e.map(e=>$o(e))}}(this.source)}updateClusterOptions(e,t){const i=this.options.cluster;this.options.cluster=e,this.options.clusterOptions=t,i!=e?this.initializeIndex(this.source,this.options):this.tileIndex.updateIndex(this.source,[],this.options)}getClusterExpansionZoom(e){return this.tileIndex.getClusterExpansionZoom(e)}getClusterChildren(e){return this.tileIndex.getChildren(e)}getClusterLeaves(e,t,i){return this.tileIndex.getLeaves(e,t,i)}};const Ql=4294967296,Yl=1/Ql,Jl="undefined"==typeof TextDecoder?null:new TextDecoder("utf-8");class $l{constructor(e){this.buf=ArrayBuffer.isView(e)?e:new Uint8Array(e),this.dataView=new DataView(this.buf.buffer,this.buf.byteOffset,this.buf.byteLength),this.pos=0,this.type=0,this._valueStart=-1,this.length=this.buf.length}readFields(e,t,i=this.length){let n;for(;n=this.nextField(i);)e(n,t,this);return t}readMessage(e,t){return this.readFields(e,t,this.readVarint()+this.pos)}readFixed32(){const e=this.dataView.getUint32(this.pos,!0);return this.pos+=4,e}readSFixed32(){const e=this.dataView.getInt32(this.pos,!0);return this.pos+=4,e}readFixed64(){const e=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*Ql;return this.pos+=8,e}readSFixed64(){const e=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*Ql;return this.pos+=8,e}readFloat(){const e=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,e}readDouble(){const e=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,e}readVarint(e){const t=this.buf,i=t[this.pos++];if(i<128)return i;let n,a=127&i;return n=t[this.pos++],a|=(127&n)<<7,n<128?a:(n=t[this.pos++],a|=(127&n)<<14,n<128?a:(n=t[this.pos++],a|=(127&n)<<21,n<128?a:(n=t[this.pos],a|=(15&n)<<28,function(e,t,i){const n=i.buf;let a,r;if(r=n[i.pos++],a=(112&r)>>4,r<128)return tc(e,a,t);if(r=n[i.pos++],a|=(127&r)<<3,r<128)return tc(e,a,t);if(r=n[i.pos++],a|=(127&r)<<10,r<128)return tc(e,a,t);if(r=n[i.pos++],a|=(127&r)<<17,r<128)return tc(e,a,t);if(r=n[i.pos++],a|=(127&r)<<24,r<128)return tc(e,a,t);if(r=n[i.pos++],a|=(1&r)<<31,r<128)return tc(e,a,t);throw new Error("Expected varint not more than 10 bytes")}(a,e,this))))}readSVarint(){const e=this.readVarint();return e%2==1?(e+1)/-2:e/2}readBoolean(){return Boolean(this.readVarint())}readString(){const e=this.readVarint()+this.pos,t=this.pos;return this.pos=e,e-t>=12&&Jl?Jl.decode(this.buf.subarray(t,e)):function(e,t,i){let n="",a=t;for(;a<i;){const t=e[a];let r,s,o,l=null,c=t>239?4:t>223?3:t>191?2:1;if(a+c>i)break;1===c?t<128&&(l=t):2===c?(r=e[a+1],128==(192&r)&&(l=(31&t)<<6|63&r,l<=127&&(l=null))):3===c?(r=e[a+1],s=e[a+2],128==(192&r)&&128==(192&s)&&(l=(15&t)<<12|(63&r)<<6|63&s,(l<=2047||l>=55296&&l<=57343)&&(l=null))):4===c&&(r=e[a+1],s=e[a+2],o=e[a+3],128==(192&r)&&128==(192&s)&&128==(192&o)&&(l=(15&t)<<18|(63&r)<<12|(63&s)<<6|63&o,(l<=65535||l>=1114112)&&(l=null))),null===l?(l=65533,c=1):l>65535&&(l-=65536,n+=String.fromCharCode(l>>>10&1023|55296),l=56320|1023&l),n+=String.fromCharCode(l),a+=c}return n}(this.buf,t,e)}readBytes(){const e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t}readPackedVarint(e=[],t){const i=this.readPackedEnd();for(;this.pos<i;)e.push(this.readVarint(t));return e}readPackedSVarint(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSVarint());return e}readPackedBoolean(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readBoolean());return e}readPackedFloat(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFloat());return e}readPackedDouble(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readDouble());return e}readPackedFixed32(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFixed32());return e}readPackedSFixed32(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSFixed32());return e}readPackedFixed64(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFixed64());return e}readPackedSFixed64(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSFixed64());return e}readPackedEnd(){return 2===this.type?this.readVarint()+this.pos:this.pos+1}nextField(e=this.length){if(this.pos===this._valueStart&&this.skip(this.type),this.pos>=e)return 0;const t=this.readVarint();return this.type=7&t,this._valueStart=this.pos,t>>>3}skip(e){const t=7&e;if(0===t)for(;this.buf[this.pos++]>127;);else if(2===t)this.pos=this.readVarint()+this.pos;else if(5===t)this.pos+=4;else{if(1!==t)throw new Error(`Unimplemented type: ${t}`);this.pos+=8}}}class ec{constructor(e=new Uint8Array(16)){this.buf=ArrayBuffer.isView(e)?e:new Uint8Array(e),this.dataView=new DataView(this.buf.buffer,this.buf.byteOffset,this.buf.byteLength),this.pos=0,this.length=this.buf.length}writeTag(e,t){this.writeVarint(e<<3|t)}realloc(e){let t=this.length||16;for(;t<this.pos+e;)t*=2;if(t!==this.length){const e=new Uint8Array(t);e.set(this.buf),this.buf=e,this.dataView=new DataView(e.buffer),this.length=t}}finish(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)}writeFixed32(e){this.realloc(4),this.dataView.setInt32(this.pos,e,!0),this.pos+=4}writeSFixed32(e){this.realloc(4),this.dataView.setInt32(this.pos,e,!0),this.pos+=4}writeFixed64(e){this.realloc(8),this.dataView.setInt32(this.pos,-1&e,!0),this.dataView.setInt32(this.pos+4,Math.floor(e*Yl),!0),this.pos+=8}writeSFixed64(e){this.realloc(8),this.dataView.setInt32(this.pos,-1&e,!0),this.dataView.setInt32(this.pos+4,Math.floor(e*Yl),!0),this.pos+=8}writeVarint(e){if((e=+e||0)>=0&&e<128)return this.pos>=this.length&&this.realloc(1),void(this.buf[this.pos++]=e);e>268435455||e<0?function(e,t){let i,n;e>=0?(i=e%4294967296|0,n=e/4294967296|0):(i=~(-e%4294967296),n=~(-e/4294967296),4294967295^i?i=i+1|0:(i=0,n=n+1|0));if(e>=0x10000000000000000||e<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");t.realloc(10),function(e,t,i){i.buf[i.pos++]=127&e|128,e>>>=7,i.buf[i.pos++]=127&e|128,e>>>=7,i.buf[i.pos++]=127&e|128,e>>>=7,i.buf[i.pos++]=127&e|128,e>>>=7,i.buf[i.pos]=127&e}(i,0,t),function(e,t){const i=(7&e)<<4;if(t.buf[t.pos++]|=i|((e>>>=3)?128:0),!e)return;if(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),!e)return;if(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),!e)return;if(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),!e)return;if(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),!e)return;t.buf[t.pos++]=127&e}(n,t)}(e,this):(this.realloc(4),this.buf[this.pos++]=127&e|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=e>>>7&127))))}writeSVarint(e){this.writeVarint(e<0?2*-e-1:2*e)}writeBoolean(e){this.writeVarint(+e)}writeString(e){e=String(e),this.realloc(4*e.length),this.pos++;const t=this.pos;this.pos=function(e,t,i){for(let n,a,r=0;r<t.length;r++){if(n=t.charCodeAt(r),n>55295&&n<57344){if(!a){n>56319||r+1===t.length?(e[i++]=239,e[i++]=191,e[i++]=189):a=n;continue}if(n<56320){e[i++]=239,e[i++]=191,e[i++]=189,a=n;continue}n=a-55296<<10|n-56320|65536,a=null}else a&&(e[i++]=239,e[i++]=191,e[i++]=189,a=null);n<128?e[i++]=n:(n<2048?e[i++]=n>>6|192:(n<65536?e[i++]=n>>12|224:(e[i++]=n>>18|240,e[i++]=n>>12&63|128),e[i++]=n>>6&63|128),e[i++]=63&n|128)}return i}(this.buf,e,this.pos);const i=this.pos-t;i>=128&&ic(t,i,this),this.pos=t-1,this.writeVarint(i),this.pos+=i}writeFloat(e){this.realloc(4),this.dataView.setFloat32(this.pos,e,!0),this.pos+=4}writeDouble(e){this.realloc(8),this.dataView.setFloat64(this.pos,e,!0),this.pos+=8}writeBytes(e){const t=e.length;this.writeVarint(t),this.realloc(t),this.buf.set(e,this.pos),this.pos+=t}writeRawMessage(e,t){this.pos++;const i=this.pos;e(t,this);const n=this.pos-i;n>=128&&ic(i,n,this),this.pos=i-1,this.writeVarint(n),this.pos+=n}writeMessage(e,t,i){this.writeTag(e,2),this.writeRawMessage(t,i)}writePackedVarint(e,t){t.length&&this.writeMessage(e,nc,t)}writePackedSVarint(e,t){t.length&&this.writeMessage(e,ac,t)}writePackedBoolean(e,t){t.length&&this.writeMessage(e,oc,t)}writePackedFloat(e,t){t.length&&this.writeMessage(e,rc,t)}writePackedDouble(e,t){t.length&&this.writeMessage(e,sc,t)}writePackedFixed32(e,t){t.length&&this.writeMessage(e,lc,t)}writePackedSFixed32(e,t){t.length&&this.writeMessage(e,cc,t)}writePackedFixed64(e,t){t.length&&this.writeMessage(e,uc,t)}writePackedSFixed64(e,t){t.length&&this.writeMessage(e,hc,t)}writeBytesField(e,t){this.writeTag(e,2),this.writeBytes(t)}writeFixed32Field(e,t){this.writeTag(e,5),this.writeFixed32(t)}writeSFixed32Field(e,t){this.writeTag(e,5),this.writeSFixed32(t)}writeFixed64Field(e,t){this.writeTag(e,1),this.writeFixed64(t)}writeSFixed64Field(e,t){this.writeTag(e,1),this.writeSFixed64(t)}writeVarintField(e,t){this.writeTag(e,0),this.writeVarint(t)}writeSVarintField(e,t){this.writeTag(e,0),this.writeSVarint(t)}writeStringField(e,t){this.writeTag(e,2),this.writeString(t)}writeFloatField(e,t){this.writeTag(e,5),this.writeFloat(t)}writeDoubleField(e,t){this.writeTag(e,1),this.writeDouble(t)}writeBooleanField(e,t){this.writeVarintField(e,+t)}}function tc(e,t,i){return i?4294967296*t+(e>>>0):4294967296*(t>>>0)+(e>>>0)}function ic(e,t,i){const n=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(7*Math.LN2));i.realloc(n),i.buf.copyWithin(e+n,e,i.pos)}function nc(e,t){const i=e.length;let n=t.buf,a=t.pos,r=t.length;for(let s=0;s<i;s++){let i=e[s];if(i<0||a+10>r)t.pos=a,t.writeVarint(i),n=t.buf,a=t.pos,r=t.length;else{for(;i>127;)n[a++]=i%128|128,i=Math.floor(i/128);n[a++]=i}}t.pos=a}function ac(e,t){for(let i=0;i<e.length;i++)t.writeSVarint(e[i])}function rc(e,t){for(let i=0;i<e.length;i++)t.writeFloat(e[i])}function sc(e,t){for(let i=0;i<e.length;i++)t.writeDouble(e[i])}function oc(e,t){for(let i=0;i<e.length;i++)t.writeBoolean(e[i])}function lc(e,t){for(let i=0;i<e.length;i++)t.writeFixed32(e[i])}function cc(e,t){for(let i=0;i<e.length;i++)t.writeSFixed32(e[i])}function uc(e,t){for(let i=0;i<e.length;i++)t.writeFixed64(e[i])}function hc(e,t){for(let i=0;i<e.length;i++)t.writeSFixed64(e[i])}function dc(e,t){this.x=e,this.y=t}dc.prototype={clone(){return new dc(this.x,this.y)},add(e){return this.clone()._add(e)},sub(e){return this.clone()._sub(e)},multByPoint(e){return this.clone()._multByPoint(e)},divByPoint(e){return this.clone()._divByPoint(e)},mult(e){return this.clone()._mult(e)},div(e){return this.clone()._div(e)},rotate(e){return this.clone()._rotate(e)},rotateAround(e,t){return this.clone()._rotateAround(e,t)},matMult(e){return this.clone()._matMult(e)},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(e){return this.x===e.x&&this.y===e.y},dist(e){return Math.sqrt(this.distSqr(e))},distSqr(e){const t=e.x-this.x,i=e.y-this.y;return t*t+i*i},angle(){return Math.atan2(this.y,this.x)},angleTo(e){return Math.atan2(this.y-e.y,this.x-e.x)},angleWith(e){return this.angleWithSep(e.x,e.y)},angleWithSep(e,t){return Math.atan2(this.x*t-this.y*e,this.x*e+this.y*t)},_matMult(e){const t=e[0]*this.x+e[1]*this.y,i=e[2]*this.x+e[3]*this.y;return this.x=t,this.y=i,this},_add(e){return this.x+=e.x,this.y+=e.y,this},_sub(e){return this.x-=e.x,this.y-=e.y,this},_mult(e){return this.x*=e,this.y*=e,this},_div(e){return this.x/=e,this.y/=e,this},_multByPoint(e){return this.x*=e.x,this.y*=e.y,this},_divByPoint(e){return this.x/=e.x,this.y/=e.y,this},_unit(){return this._div(this.mag()),this},_perp(){const e=this.y;return this.y=this.x,this.x=-e,this},_rotate(e){const t=Math.cos(e),i=Math.sin(e),n=t*this.x-i*this.y,a=i*this.x+t*this.y;return this.x=n,this.y=a,this},_rotateAround(e,t){const i=Math.cos(e),n=Math.sin(e),a=t.x+i*(this.x-t.x)-n*(this.y-t.y),r=t.y+n*(this.x-t.x)+i*(this.y-t.y);return this.x=a,this.y=r,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:dc},dc.convert=function(e){if(e instanceof dc)return e;if(Array.isArray(e))return new dc(+e[0],+e[1]);if(void 0!==e.x&&void 0!==e.y)return new dc(+e.x,+e.y);throw new Error("Expected [x, y] or {x, y} point format")};var pc=class{constructor(e,t){this.feature=e,this.type=e.type,this.properties=e.tags?e.tags:{},this.extent=t,"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=[],t=1===this.feature.type?[this.feature.geometry]:this.feature.geometry;for(const i of t){const t=[];for(const e of i)t.push(new dc(e[0],e[1]));e.push(t)}return e}};const mc="_geojsonTileLayer";var gc=class{constructor(e,t){this.layers={[mc]:this},this.name=mc,this.version=t?t.version:1,this.extent=t?t.extent:4096,this.length=e.length,this.features=e}feature(e){return new pc(this.features[e],this.extent)}};function fc(e,t=""){const i=new ec;return function(e,t,i=""){for(const n in e.layers)t.writeMessage(3,(e,t)=>Ac(e,t,i),e.layers[n])}(e,i,t),i.finish()}function Ac(e,t,i=""){t.writeVarintField(15,e.version||1),t.writeStringField(1,e.name||""),t.writeVarintField(5,e.extent||4096);const n={jsonPrefix:i,keys:[],values:[],keycache:{},valuecache:{}};for(let i=0;i<e.length;i++)n.feature=e.feature(i),t.writeMessage(2,_c,n);const a=n.keys;for(const e of a)t.writeStringField(3,e);const r=n.values;for(const e of r)t.writeMessage(4,wc,e)}function _c(e,t){if(!e.feature)return;const i=e.feature;void 0!==i.id&&t.writeVarintField(1,i.id),t.writeMessage(2,vc,e),t.writeVarintField(3,i.type),t.writeMessage(4,bc,i)}function vc(e,t){for(const i in e.feature?.properties){let n=e.feature.properties[i],a=e.keycache[i];if(null==n)continue;void 0===a&&(e.keys.push(i),a=e.keys.length-1,e.keycache[i]=a),t.writeVarint(a),"string"!=typeof n&&"boolean"!=typeof n&&"number"!=typeof n&&(n=e.jsonPrefix+JSON.stringify(n));const r=typeof n+":"+n;let s=e.valuecache[r];void 0===s&&(e.values.push(n),s=e.values.length-1,e.valuecache[r]=s),t.writeVarint(s)}}function yc(e,t){return(t<<3)+(7&e)}function xc(e){return e<<1^e>>31}function bc(e,t){const i=e.loadGeometry(),n=e.type;let a=0,r=0;for(const s of i){let i=1;1===n&&(i=s.length),t.writeVarint(yc(1,i));const o=3===n?s.length-1:s.length;for(let e=0;e<o;e++){1===e&&1!==n&&t.writeVarint(yc(2,o-1));const i=s[e].x-a,l=s[e].y-r;t.writeVarint(xc(i)),t.writeVarint(xc(l)),a+=i,r+=l}3===e.type&&t.writeVarint(yc(7,1))}}function wc(e,t){const i=typeof e;"string"===i?t.writeStringField(1,e):"boolean"===i?t.writeBooleanField(7,e):"number"===i&&(e%1!=0?t.writeDoubleField(3,e):e<0?t.writeSVarintField(6,e):t.writeVarintField(5,e))}const Ec={15:100,16:300,17:500,18:800,19:1e3};class kc{constructor(e){this.tiles=new Map,this._parent=e}clearCache(){this.tiles=new Map}_tileToBbox(e,t,i){const n=Math.pow(2,i),a=e/n*360-180,r=(e+1)/n*360-180,s=nt(Math.atan(Math.sinh(Math.PI*(1-2*t/n))));return[a,nt(Math.atan(Math.sinh(Math.PI*(1-2*(t+1)/n)))),r,s]}_semanticsToBasicProps(e){const t={},i=e=>{t[e.key]?t[e.key].add(e.value):t[e.key]=new Set([e.value])};return(e.properties?.collection?.semantics||[]).forEach(i),(e.properties?.semantics||[]).forEach(i),(e.properties?.annotations||[]).forEach(e=>e.semantics.forEach(i)),Object.keys(t).forEach(e=>t[e]=[...t[e]].join(";")),t.picid=e.id,t.seqid=e.collection,t}tile(){return(e,t)=>{t=t||new AbortController;const i=e.url.match(/^sem:\/\/\/(.+)\/(\d+)\/(\d+)\/(\d+)/);if(!i)throw new Error("Invalid URL");if(this.tiles.has(e.url))return{data:this.tiles.get(e.url).buffer.slice(0)};const[,n,a,r,s]=i,o=this._tileToBbox(parseInt(r),parseInt(s),parseInt(a)),l=`${this._parent.getAPI()._endpoint}/search?bbox=${o.join(",")}&limit=${Ec[parseInt(a)]}&sortby=id&filter=${encodeURIComponent(n)}`;return fetch(l,{signal:t.signal}).then(e=>e.json()).then(t=>{if(t.features){if(t.type="FeatureCollection",0===t.features.length){const t=new Uint8Array;return this.tiles.set(e.url,t),{data:t.buffer.slice(0)}}t.features=t.features.filter(e=>{let t=e.properties?.semantics?.length>0||e.properties?.annotations?.length>0;return t||e.properties?.collection?.semantics?.find(e=>"osm|level"===e.key)&&(t=!0),t}).map(e=>({type:e.type,geometry:e.geometry,id:e.id,properties:this._semanticsToBasicProps(e)}))}const i=new Xl(t,{minZoom:15,maxZoom:19}).getTile(a,r,s);if(!i)throw new Error("Can't create tile");const n=function(e,t){const i={};for(const n in e)i[n]=new gc(e[n].features,t),i[n].name=n,i[n].version=t?t.version:1,i[n].extent=t?t.extent:4096;return fc({layers:i})}({layer:i},{version:2});return this.tiles.set(e.url,n),{data:n.buffer.slice(0)}}).catch(e=>{e.message&&e.message.includes("The operation was aborted")||console.error(e)})}}}class Sc{constructor(e,t,i,n,a){for(this.properties=Object.create(null),this.extent=i,this.type=0,this.id=void 0,this._pbf=e,this._geometry=-1,this._keys=n,this._values=a;e.pos<t;){const t=e.readVarint();if(8===t)this.id=e.readVarint();else if(18===t){const t=e.readVarint()+e.pos;for(;e.pos<t;){const t=n[e.readVarint()],i=a[e.readVarint()];this.properties[t]=i}}else 24===t?this.type=e.readVarint():34===t?(this._geometry=e.pos,e.skip(t)):e.skip(t)}}loadGeometry(){if(this._geometry<0)throw new Error("feature has no geometry");const e=this._pbf;e.pos=this._geometry;const t=e.readVarint()+e.pos,i=[];let n,a=1,r=0,s=0,o=0;for(;e.pos<t;){if(r<=0){const t=e.readVarint();if(a=7&t,r=t>>3,0===r)continue}if(r--,1===a)s+=e.readSVarint(),o+=e.readSVarint(),n&&i.push(n),n=[new dc(s,o)];else if(2===a)s+=e.readSVarint(),o+=e.readSVarint(),n&&n.push(new dc(s,o));else{if(7!==a)throw new Error(`unknown command ${a}`);n&&n.push(n[0].clone())}}return n&&i.push(n),i}bbox(){if(this._geometry<0)throw new Error("feature has no geometry");const e=this._pbf;e.pos=this._geometry;const t=e.readVarint()+e.pos;let i=1,n=0,a=0,r=0,s=1/0,o=-1/0,l=1/0,c=-1/0;for(;e.pos<t;){if(n<=0){const t=e.readVarint();if(i=7&t,n=t>>3,0===n)continue}if(n--,1===i||2===i)a+=e.readSVarint(),r+=e.readSVarint(),a<s&&(s=a),a>o&&(o=a),r<l&&(l=r),r>c&&(c=r);else if(7!==i)throw new Error(`unknown command ${i}`)}return[s,l,o,c]}toGeoJSON(e,t,i){const n=this.extent*Math.pow(2,i),a=this.extent*e,r=this.extent*t,s=this.loadGeometry();function o(e){return[360*(e.x+a)/n-180,360/Math.PI*Math.atan(Math.exp((1-2*(e.y+r)/n)*Math.PI))-90]}function l(e){return e.map(o)}let c;if(1===this.type){const e=[];for(const t of s)e.push(t[0]);const t=l(e);c=1===e.length?{type:"Point",coordinates:t[0]}:{type:"MultiPoint",coordinates:t}}else if(2===this.type){const e=s.map(l);c=1===e.length?{type:"LineString",coordinates:e[0]}:{type:"MultiLineString",coordinates:e}}else{if(3!==this.type)throw new Error("unknown feature type");{const e=function(e){const t=e.length;if(t<=1)return[e];const i=[];let n,a;for(let r=0;r<t;r++){const t=Mc(e[r]);0!==t&&(void 0===a&&(a=t<0),a===t<0?(n&&i.push(n),n=[e[r]]):n&&n.push(e[r]))}n&&i.push(n);return i}(s),t=[];for(const i of e)t.push(i.map(l));c=1===t.length?{type:"Polygon",coordinates:t[0]}:{type:"MultiPolygon",coordinates:t}}}const u={type:"Feature",geometry:c,properties:this.properties};return null!=this.id&&(u.id=this.id),u}}function Mc(e){let t=0;for(let i,n,a=0,r=e.length,s=r-1;a<r;s=a++)i=e[a],n=e[s],t+=(n.x-i.x)*(i.y+n.y);return t}Sc.types=["Unknown","Point","LineString","Polygon"];class Cc{constructor(e,t){for(this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],void 0===t&&(t=e.length);e.pos<t;){const t=e.readVarint();10===t?this.name=e.readString():18===t?(this._features.push(e.pos),e.skip(t)):26===t?this._keys.push(e.readString()):34===t?this._values.push(Tc(e)):40===t?this.extent=e.readVarint():120===t?this.version=e.readVarint():e.skip(t)}this.length=this._features.length}feature(e){if(e<0||e>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[e];const t=this._pbf.readVarint()+this._pbf.pos;return new Sc(this._pbf,t,this.extent,this._keys,this._values)}}function Tc(e){let t=null;const i=e.readVarint()+e.pos;for(;e.pos<i;){const i=e.readVarint();t=10===i?e.readString():21===i?e.readFloat():25===i?e.readDouble():32===i?e.readVarint(!0):40===i?e.readVarint():48===i?e.readSVarint():56===i?e.readBoolean():(e.skip(i),null)}if(null==t)throw new Error("unknown feature value");return t}class Dc{constructor(e,t=e.length){const i=Object.create(null);for(;e.pos<t;){const t=e.readVarint();if(26===t){const t=new Cc(e,e.readVarint()+e.pos);t.length&&(i[t.name]=t)}else e.skip(t)}this.layers=i}}class Pc{tile(){return(e,t)=>{t=t||new AbortController;const i=e.url.replace(/^panora/,"http");return fetch(i,{signal:t.signal}).then(e=>e.arrayBuffer()).then(e=>new Dc(new $l(e))).then(e=>(!e.layers.pictures||e.layers.pictures.length>=5e3||Object.values(e.layers).forEach(e=>{const t=e.feature.bind(e);e.feature=e=>{const i=t(e);return i.properties.uncrowded=!0,i}}),e)).then(e=>fc(e).buffer).then(e=>({data:e}))}}}const Ic="-1000",Fc="levels";function zc(){try{return IndoorEqual,!0}catch(e){return!1}}function Rc(e,t=!1){if(e._options.indoor)if(zc()){if(!t&&!1===e._options.indoor.visible)return;e.indoorEqual=new IndoorEqual(e,e._options.indoor),e.addControl(e.indoorEqual),e.indoorEqual.loadSprite("https://files.pavie.info/depot/remote/indoorequal/indoorequal"),e.indoorEqual._refreshAfterLevelsUpdate=function(){this.levels.includes(this.level)||this.level==Ic||this.setLevel("0")};const i="sem-"+Fc;e.indoorEqual._updateLevels=function(){if(this.map.getSource(this.source.sourceId)&&this.map.isSourceLoaded(this.source.sourceId)&&this.map.getSource(i)&&this.map.isSourceLoaded(i)){let e=new Set;this.map.querySourceFeatures(this.source.sourceId,{sourceLayer:"area"}).forEach(t=>{"level"!==t.properties.class&&void 0!==t.properties.level&&e.add(t.properties.level.toString())}),this.map.querySourceFeatures(i,{sourceLayer:"layer"}).forEach(t=>{void 0!==t.properties["osm|level"]&&e.add(t.properties["osm|level"].toString())}),e.size>0&&e.add("0"),0!==e.symmetricDifference(new Set(this.levels)).size&&(this.levels=[...e].sort((e,t)=>parseFloat(e)-parseFloat(t)).reverse(),this._emitLevelsChange(),this._refreshAfterLevelsUpdate())}},e._indoorFeaturesIDs={pictures:{},sequences:{}},e.on("sourcedata",Fc,t=>{t.sourceId===i&&(t.features.forEach(t=>{e._indoorFeaturesIDs.pictures[t.properties["osm|level"]]||(e._indoorFeaturesIDs.pictures[t.properties["osm|level"]]=new Set),e._indoorFeaturesIDs.sequences[t.properties["osm|level"]]||(e._indoorFeaturesIDs.sequences[t.properties["osm|level"]]=new Set),e._indoorFeaturesIDs.pictures[t.properties["osm|level"]].add(t.properties.picid),e._indoorFeaturesIDs.sequences[t.properties["osm|level"]].add(t.properties.seqid)}),s())});const n=()=>{e.addSemanticOverlay?.(Fc,'"semantics.osm|level" IS NOT NULL',{type:"circle",layout:{visibility:"visible"},paint:{"circle-opacity":0}}),t&&e._parent._initParams?.getMapPostInit()?.level===Ic?e.indoorEqual.setLevel("0"):[null,void 0,""].includes(e._parent._initParams?.getMapPostInit()?.level)||e.indoorEqual.setLevel(e._parent._initParams?.getMapPostInit()?.level)};if(e.isStyleLoaded())n();else{const t=setInterval(()=>{e.isStyleLoaded()&&(n(),clearInterval(t))},250)}let a;e._parent.grid.appendChild(bs("pnx-level-select",{slot:"bottom-right",_parent:e._parent,class:"pnx-only-map pnx-print-hidden"}));const r=()=>{if(e.indoorEqual.level===Ic)e.restrictVisibleFeatures("hide","pictures",[]),e.restrictVisibleFeatures("hide","sequences",[]);else if("0"===e.indoorEqual.level){const t=new Set;Object.entries(e._indoorFeaturesIDs.pictures).forEach(([e,i])=>{"0"!=e&&i.forEach(e=>t.add(e))}),e.restrictVisibleFeatures("hide","pictures",[...t]);let i=new Set;Object.entries(e._indoorFeaturesIDs.sequences).forEach(([e,t])=>{"0"!=e&&(i=i.union(t))}),e._indoorFeaturesIDs.sequences[0]&&(i=i.difference(e._indoorFeaturesIDs.sequences[0])),e.restrictVisibleFeatures("hide","sequences",[...i])}else e.restrictVisibleFeatures("keep","pictures",e._indoorFeaturesIDs.pictures[e.indoorEqual.level]?[...e._indoorFeaturesIDs.pictures[e.indoorEqual.level]]:[]),e.restrictVisibleFeatures("keep","sequences",e._indoorFeaturesIDs.sequences[e.indoorEqual.level]?[...e._indoorFeaturesIDs.sequences[e.indoorEqual.level]]:[])},s=()=>{a&&(clearTimeout(a),a=void 0),a=setTimeout(r,250)};e.indoorEqual.on("levelchange",s)}else console.error("The indoor= plugin is not enabled. Please add the maplibre-gl-indoorequal before calling 'indoor' option of Panoramax Viewer.")}var Lc=Object.freeze({__proto__:null,DISABLED_LEVEL:Ic,initIndoorEqualOnMap:Rc,isIndoorEqualAvailable:zc}),Bc=Object.create,Oc=Object.defineProperty,Uc=Object.getOwnPropertyDescriptor,Nc=Object.getOwnPropertyNames,jc=Object.getPrototypeOf,Vc=Object.prototype.hasOwnProperty,qc=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),Gc=(e,t,i,n)=>{if(t&&"object"==typeof t||"function"==typeof t)for(var a,r=Nc(t),s=0,o=r.length;s<o;s++)a=r[s],!Vc.call(e,a)&&a!==i&&Oc(e,a,{get:(e=>t[e]).bind(null,a),enumerable:!(n=Uc(t,a))||n.enumerable});return e};
|
|
28
28
|
/**
|
|
29
29
|
* MapLibre GL JS
|
|
30
30
|
* @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v6.9.0/LICENSE.txt
|
|
@@ -32,7 +32,7 @@ const E=globalThis,k=e=>e,S=E.trustedTypes,M=S?S.createPolicy("lit-html",{create
|
|
|
32
32
|
/**
|
|
33
33
|
* MapLibre GL JS
|
|
34
34
|
* @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v6.9.0/LICENSE.txt
|
|
35
|
-
*/function XM(){var e=new Qc(4);return Qc!=Float32Array&&(e[1]=0,e[2]=0),e[0]=1,e[3]=1,e}let QM,YM,JM;const $M={frame(e,t,i,n){let a=n||window,r=a.requestAnimationFrame(e=>{s(),t(e)}),{unsubscribe:s}=Sh(e.signal,"abort",()=>{s(),a.cancelAnimationFrame(r),i(new Uh(e.signal.reason))},!1)},frameAsync(e,t){return new Promise((i,n)=>{this.frame(e,i,n,t)})},getImageData(e,t=0){return this.getImageCanvasContext(e).getImageData(-t,-t,e.width+2*t,e.height+2*t)},getImageCanvasContext(e){let t;if(Kc()&&!Xc())t=new OffscreenCanvas(e.width,e.height).getContext("2d",{willReadFrequently:!0});else{let i=window.document.createElement("canvas");i.width=e.width,i.height=e.height,t=i.getContext("2d",{willReadFrequently:!0})}if(!t)throw Error("failed to create canvas 2d context");return t.drawImage(e,0,0,e.width,e.height),t},resolveURL:e=>(QM||=document.createElement("a"),QM.href=e,QM.href),get hardwareConcurrency(){return typeof navigator<"u"&&navigator.hardwareConcurrency||4},get prefersReducedMotion(){return void 0===JM?!!matchMedia&&(YM??=matchMedia("(prefers-reduced-motion: reduce)"),YM.matches):JM},set prefersReducedMotion(e){JM=e}},eC=new class{constructor(){this._frozenAt=null}getCurrentTime(){return null===this._frozenAt?performance.now():this._frozenAt}setNow(e){this._frozenAt=e}restoreNow(){this._frozenAt=null}isFrozen(){return null!==this._frozenAt}};function tC(){return eC.getCurrentTime()}var iC=class e{static{this.docStyle=typeof window<"u"&&window.document?.documentElement.style}static{this.selectProp=!e.docStyle||"userSelect"in e.docStyle?"userSelect":"webkitUserSelect"}static create(e,t,i){let n=window.document.createElement(e);return void 0!==t&&(n.className=t),i&&i.appendChild(n),n}static createNS(e,t){return window.document.createElementNS(e,t)}static disableDrag(){e.docStyle&&e.selectProp&&(e.userSelect=e.docStyle[e.selectProp],e.docStyle[e.selectProp]="none")}static enableDrag(){e.docStyle&&e.selectProp&&(e.docStyle[e.selectProp]=e.userSelect)}static suppressClickInternal(t){t.preventDefault(),t.stopPropagation(),window.removeEventListener("click",e.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",e.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",e.suppressClickInternal,!0)},0)}static getScale(e){let t=e.getBoundingClientRect();return{x:t.width/e.offsetWidth||1,y:t.height/e.offsetHeight||1,boundingClientRect:t}}static getPoint(e,t,i){let n=t.boundingClientRect;return new Hc((i.clientX-n.left)/t.x-e.clientLeft,(i.clientY-n.top)/t.y-e.clientTop)}static mousePos(t,i){let n=e.getScale(t);return e.getPoint(t,n,i)}static touchPos(t,i){let n=[],a=e.getScale(t);for(let r of i)n.push(e.getPoint(t,a,r));return n}static sanitize(t){let i=(new DOMParser).parseFromString(t,"text/html").body||document.createElement("body"),n=i.querySelectorAll("script, iframe");for(let e of n)e.remove();return e.clean(i),i.innerHTML}static isPossiblyDangerous(e,t){let i=t.replace(/\s+/g,"").toLowerCase();if(["src","href","xlink:href"].includes(e)&&(i.includes("javascript:")||i.includes("data:"))||"srcdoc"===e||e.startsWith("on"))return!0}static clean(t){let i=t.children;for(let t of i)e.removeAttributes(t),e.clean(t)}static removeAttributes(t){for(let{name:i,value:n}of Array.from(t.attributes))e.isPossiblyDangerous(i,n)&&t.removeAttribute(i)}};let nC;(function(e){let t,i,n,a;e.resetRequestQueue=()=>{t=[],i=0,n=0,a={}},e.addThrottleControl=e=>{let t=n++;return a[t]=e,t},e.removeThrottleControl=e=>{delete a[e],o()};e.transformAndGetImage=async function(e,t,i,n,a=!0,r){let s=await e.transformRequest(t,i);return jh(n.signal),nC.getImage(s,n,a,r)},e.getImage=(e,i,n=!0,a)=>new Promise((r,s)=>{e.headers||={},e.headers.accept="image/webp,*/*",lh(e,{type:"image"});let l={abortController:i,requestParameters:e,supportImageRefresh:n,imageBitmapOptions:a,state:"queued",onError:e=>{s(e)},onSuccess:e=>{r(e)}};t.push(l),o()});let r=(e,t)=>"function"==typeof createImageBitmap?(async(e,t)=>{let i=new Blob([new Uint8Array(e)],{type:"image/png"});try{return createImageBitmap(i,t)}catch(e){throw Error(`Could not load image because of ${ju(e).message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}})(e,t):(e=>new Promise((t,i)=>{let n=new Image;n.onload=()=>{t(n),URL.revokeObjectURL(n.src),n.onload=null,window.requestAnimationFrame(()=>n.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=")},n.onerror=()=>i(Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));let a=new Blob([new Uint8Array(e)],{type:"image/png"});n.src=URL.createObjectURL(a)}))(e),s=async e=>{e.state="running";let{requestParameters:t,supportImageRefresh:n,imageBitmapOptions:a,onError:s,onSuccess:c,abortController:u}=e,h=!1===n&&!a&&!bh(self)&&!qh(t.url)&&(!t.headers||Object.keys(t.headers).reduce((e,t)=>e&&"accept"===t,!0));i++;let d=h?l(t,u):Kh(t,u);try{let t=await d;delete e.abortController,e.state="completed",t.data instanceof HTMLImageElement||Eh(t.data)?c(t):t.data&&0!==t.data.byteLength?c({data:await r(t.data,a),cacheControl:t.cacheControl,expires:t.expires}):c({data:null,cacheControl:t.cacheControl,expires:t.expires})}catch(t){delete e.abortController,s(ju(t))}finally{i--,o()}},o=()=>{let e=(()=>{for(let e of Object.keys(a))if(a[e]())return!0;return!1})()?Vh.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:Vh.MAX_PARALLEL_IMAGE_REQUESTS;for(let n=i;n<e&&t.length>0;n++){let e=t.shift();e.abortController.signal.aborted?n--:s(e)}},l=(e,t)=>new Promise((i,n)=>{let a=new Image,r=e.url,s=e.credentials;s&&"include"===s?a.crossOrigin="use-credentials":(s&&"same-origin"===s||!Yh(r))&&(a.crossOrigin="anonymous"),t.signal.addEventListener("abort",()=>{a.src="",n(new Uh(t.signal.reason))}),a.fetchPriority="high",a.onload=()=>{a.onerror=a.onload=null,i({data:a})},a.onerror=()=>{a.onerror=a.onload=null,!t.signal.aborted&&n(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."))},a.src=r})})(nC||={}),nC.resetRequestQueue();var aC=class{constructor(e){this._transformRequestFn=e??null}transformRequest(e,t){return this._transformRequestFn&&this._transformRequestFn(e,t)||{url:e}}setTransformRequest(e){this._transformRequestFn=e}},rC=class extends ed{},sC=class extends rC{},oC=class extends rC{constructor(e={}){super("style.load",e)}},lC=class extends rC{constructor(e,t={}){super(e,t),this.dataType="style"}},cC=class extends rC{constructor(e,t={}){super(e,t),this.dataType="source"}},uC=class extends rC{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,t,i,n={}){i=i instanceof MouseEvent?i:new MouseEvent(e,i);let a=iC.mousePos(t.getCanvas(),i);super(e,lh({point:a,lngLat:t.unproject(a),originalEvent:i},n)),this._defaultPrevented=!1,this.target=t}},hC=class extends rC{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,t,i){let n="touchend"===e?i.changedTouches:i.touches,a=iC.touchPos(t.getCanvasContainer(),n),r=a.map(e=>t.unproject(e)),s=a.reduce((e,t,i,n)=>e.add(t.div(n.length)),new Hc(0,0));super(e,{points:a,point:s,lngLats:r,lngLat:t.unproject(s),originalEvent:i}),this._defaultPrevented=!1}},dC=class extends rC{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,t){super("wheel",{originalEvent:t}),this._defaultPrevented=!1}},pC=class extends rC{},mC=class extends rC{constructor(e={}){super("terrain",e)}},gC=class extends rC{constructor(e={}){super("projectiontransition",e)}},fC=class extends rC{},AC=class extends rC{constructor(e={}){super("styleimagemissing",e)}};function _C(e,t){let i={};for(let t in e)"ref"!==t&&(i[t]=e[t]);return rd.forEach(e=>{e in t&&(i[e]=t[e])}),i}function vC(e){e=e.slice();let t=Object.create(null);for(let i=0;i<e.length;i++)t[e[i].id]=e[i];for(let i=0;i<e.length;i++)"ref"in e[i]&&(e[i]=_C(e[i],t[e[i].ref]));return e}function yC(e,t){if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(let i=0;i<e.length;i++)if(!yC(e[i],t[i]))return!1;return!0}if("object"==typeof e&&e&&null!==t){if("object"!=typeof t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let i in e)if(!yC(e[i],t[i]))return!1;return!0}return e===t}function xC(e,t){e.push(t)}function bC(e,t,i){xC(i,{command:"addSource",args:[e,t[e]]})}function wC(e,t,i){xC(t,{command:"removeSource",args:[e]}),i[e]=!0}function EC(e,t,i,n){wC(e,i,n),bC(e,t,i)}function kC(e,t,i){let n;for(n in e[i])if(Object.prototype.hasOwnProperty.call(e[i],n)&&"data"!==n&&!yC(e[i][n],t[i][n]))return!1;for(n in t[i])if(Object.prototype.hasOwnProperty.call(t[i],n)&&"data"!==n&&!yC(e[i][n],t[i][n]))return!1;return!0}function SC(e,t,i,n,a,r){e||={},t||={};for(let s in e)Object.prototype.hasOwnProperty.call(e,s)&&(yC(e[s],t[s])||i.push({command:r,args:[n,s,t[s],a]}));for(let s in t)Object.prototype.hasOwnProperty.call(t,s)&&!Object.prototype.hasOwnProperty.call(e,s)&&(yC(e[s],t[s])||i.push({command:r,args:[n,s,t[s],a]}))}function MC(e){return e.id}function CC(e,t){return e[t.id]=t,e}function TC(e,t){if(!e)return[{command:"setStyle",args:[t]}];let i=[];try{if(!yC(e.version,t.version))return[{command:"setStyle",args:[t]}];yC(e.center,t.center)||i.push({command:"setCenter",args:[t.center]}),yC(e.state,t.state)||i.push({command:"setGlobalState",args:[t.state]}),yC(e.centerAltitude,t.centerAltitude)||i.push({command:"setCenterAltitude",args:[t.centerAltitude]}),yC(e.zoom,t.zoom)||i.push({command:"setZoom",args:[t.zoom]}),yC(e.bearing,t.bearing)||i.push({command:"setBearing",args:[t.bearing]}),yC(e.pitch,t.pitch)||i.push({command:"setPitch",args:[t.pitch]}),yC(e.roll,t.roll)||i.push({command:"setRoll",args:[t.roll]}),yC(e.sprite,t.sprite)||i.push({command:"setSprite",args:[t.sprite]}),yC(e.glyphs,t.glyphs)||i.push({command:"setGlyphs",args:[t.glyphs]}),yC(e["font-faces"],t["font-faces"])||i.push({command:"setFontFaces",args:[t["font-faces"]]}),yC(e.transition,t.transition)||i.push({command:"setTransition",args:[t.transition]}),yC(e.light,t.light)||i.push({command:"setLight",args:[t.light]}),yC(e.terrain,t.terrain)||i.push({command:"setTerrain",args:[t.terrain]}),yC(e.sky,t.sky)||i.push({command:"setSky",args:[t.sky]}),yC(e.projection,t.projection)||i.push({command:"setProjection",args:[t.projection]});let n={},a=[];!function(e,t,i,n){let a;for(a in e||={},t||={},e)Object.prototype.hasOwnProperty.call(e,a)&&(Object.prototype.hasOwnProperty.call(t,a)||wC(a,i,n));for(a in t)Object.prototype.hasOwnProperty.call(t,a)&&(Object.prototype.hasOwnProperty.call(e,a)?yC(e[a],t[a])||("geojson"===e[a].type&&"geojson"===t[a].type&&kC(e,t,a)?xC(i,{command:"setGeoJSONSourceData",args:[a,t[a].data]}):EC(a,t,i,n)):bC(a,t,i))}(e.sources,t.sources,a,n);let r=[];e.layers&&e.layers.forEach(e=>{"source"in e&&n[e.source]?i.push({command:"removeLayer",args:[e.id]}):r.push(e)}),i=i.concat(a),function(e,t,i){e||=[],t||=[];let n,a,r,s,o,l=e.map(MC),c=t.map(MC),u=e.reduce(CC,{}),h=t.reduce(CC,{}),d=l.slice(),p=Object.create(null);for(let e=0,t=0;e<l.length;e++)n=l[e],Object.prototype.hasOwnProperty.call(h,n)?t++:(xC(i,{command:"removeLayer",args:[n]}),d.splice(d.indexOf(n,t),1));for(let e=0,t=0;e<c.length;e++)n=c[c.length-1-e],d[d.length-1-e]!==n&&(Object.prototype.hasOwnProperty.call(u,n)?(xC(i,{command:"removeLayer",args:[n]}),d.splice(d.lastIndexOf(n,d.length-t),1)):t++,s=d[d.length-e],xC(i,{command:"addLayer",args:[h[n],s]}),d.splice(d.length-e,0,n),p[n]=!0);for(let e=0;e<c.length;e++)if(n=c[e],a=u[n],r=h[n],!p[n]&&!yC(a,r)){if(!yC(a.source,r.source)||!yC(a["source-layer"],r["source-layer"])||!yC(a.type,r.type)){xC(i,{command:"removeLayer",args:[n]}),s=d[d.lastIndexOf(n)+1],xC(i,{command:"addLayer",args:[r,s]});continue}for(o in SC(a.layout,r.layout,i,n,null,"setLayoutProperty"),SC(a.paint,r.paint,i,n,null,"setPaintProperty"),yC(a.filter,r.filter)||xC(i,{command:"setFilter",args:[n,r.filter]}),(!yC(a.minzoom,r.minzoom)||!yC(a.maxzoom,r.maxzoom))&&xC(i,{command:"setLayerZoomRange",args:[n,r.minzoom,r.maxzoom]}),a)Object.prototype.hasOwnProperty.call(a,o)&&"layout"!==o&&"paint"!==o&&"filter"!==o&&"metadata"!==o&&"minzoom"!==o&&"maxzoom"!==o&&(0===o.indexOf("paint.")?SC(a[o],r[o],i,n,o.slice(6),"setPaintProperty"):yC(a[o],r[o])||xC(i,{command:"setLayerProperty",args:[n,o,r[o]]}));for(o in r)Object.prototype.hasOwnProperty.call(r,o)&&!Object.prototype.hasOwnProperty.call(a,o)&&"layout"!==o&&"paint"!==o&&"filter"!==o&&"metadata"!==o&&"minzoom"!==o&&"maxzoom"!==o&&(0===o.indexOf("paint.")?SC(a[o],r[o],i,n,o.slice(6),"setPaintProperty"):yC(a[o],r[o])||xC(i,{command:"setLayerProperty",args:[n,o,r[o]]}))}}(r,t.layers,i)}catch(e){console.warn("Unable to compute style diff:",e),i=[{command:"setStyle",args:[t]}]}return i}function DC(e){let t=[];if("string"==typeof e)t.push({id:"default",url:e});else if(e&&e.length>0){let i=[];for(let{id:n,url:a}of e){let e=`${n}${a}`;i.includes(e)||(i.push(e),t.push({id:n,url:a}))}}return t}function PC(e,t,i){try{let n=new URL(e);return n.pathname+=`${t}${i}`,n.toString()}catch{throw Error(`Invalid sprite URL "${e}", must be absolute. Modify style specification directly or use TransformStyleFunction to correct the issue dynamically`)}}async function IC(e,t,i,n){let a=DC(e),r=i>1?"@2x":"",s={},o={};for(let{id:e,url:i}of a){let a=await t.transformRequest(PC(i,r,".json"),"SpriteJSON");s[e]=Xh(a,n);let l=await t.transformRequest(PC(i,r,".png"),"SpriteImage");o[e]=nC.getImage(l,n)}return await Promise.all([...Object.values(s),...Object.values(o)]),async function(e,t){let i={};for(let n in e){i[n]={};let a=(await t[n]).data;if(!a)throw Error(`Could not load sprite image for ${n}: the response is empty`);let r=$M.getImageCanvasContext(a),s=(await e[n]).data;for(let e in s){let{width:t,height:a,x:o,y:l,sdf:c,pixelRatio:u,stretchX:h,stretchY:d,content:p,textFitWidth:m,textFitHeight:g}=s[e],f={width:t,height:a,x:o,y:l,context:r};i[n][e]={data:null,pixelRatio:u,sdf:c,stretchX:h,stretchY:d,content:p,textFitWidth:m,textFitHeight:g,spriteData:f}}}return i}(s,o)}var FC=class extends id{constructor(){super(),this.images={},this.updateVersion=0,this.loaded=!1,this.requestors=[],this.missingImageResolver=null,this._spriteImagesIds={},this._imagesIds=null,this._renderCallbacksDispatchedThisFrame={}}destroy(){for(let e of Object.keys(this.images))this.removeImage(e);this._spriteImagesIds={}}isLoaded(){return this.loaded}setLoaded(e){if(this.loaded!==e&&(this.loaded=e,e)){for(let{ids:e,promiseResolve:t}of this.requestors)t(this._getImagesForIds(e));this.requestors=[]}}getImage(e){let t=this.images[e];if(t&&!t.data&&t.spriteData){let e=t.spriteData;t.data=new Hv({width:e.width,height:e.height},e.context.getImageData(e.x,e.y,e.width,e.height).data),t.spriteData=null}return t}addImage(e,t){if(this.images[e])throw Error(`Image id ${e} already exist, use updateImage instead`);this._validate(e,t)&&(this.images[e]=t,this._imagesIds=null,t.isWebGLImage&&this.updateImage(e,t,!1))}_validate(e,t){let i=!0,n=t.data||t.spriteData;return this._validateStretch(t.stretchX,n?.width)||(this.fire(new td(Error(`Image "${e}" has invalid "stretchX" value`))),i=!1),this._validateStretch(t.stretchY,n?.height)||(this.fire(new td(Error(`Image "${e}" has invalid "stretchY" value`))),i=!1),this._validateContent(t.content,t)||(this.fire(new td(Error(`Image "${e}" has invalid "content" value`))),i=!1),i}_validateStretch(e,t){if(!e)return!0;let i=0;for(let n of e){if(n[0]<i||n[1]<n[0]||t<n[1])return!1;i=n[1]}return!0}_validateContent(e,t){if(!e)return!0;if(4!==e.length)return!1;let i=t.spriteData,n=i?.width||t.data.width,a=i?.height||t.data.height;return!(e[0]<0||n<e[0]||e[1]<0||a<e[1]||e[2]<0||n<e[2]||e[3]<0||a<e[3]||e[2]<e[0])&&e[3]>=e[1]}updateImage(e,t,i=!0){let n=this.images[e];if(i){let e=n.data||n.spriteData;if(e.width!==t.data.width||e.height!==t.data.height)throw Error(`size mismatch between old image (${e.width}x${e.height}) and new image (${t.data.width}x${t.data.height}).`)}t.version=(n.version??0)+1,this.images[e]=t,this.updateVersion++}removeImage(e){let t=this.images[e];t&&(delete this.images[e],this._imagesIds=null,t.userImage?.onRemove&&t.userImage.onRemove())}listImages(){return this._imagesIds??=Object.keys(this.images),this._imagesIds}_getSpriteImageId(e,t){return"default"===e?t:`${e}:${t}`}setSpriteImages(e,t){let i=this._spriteImagesIds[e]??[],n=[];for(let i in t){let a=this._getSpriteImageId(e,i);n.push(a),a in this.images?this.updateImage(a,t[i],!1):this.addImage(a,t[i])}let a=new Set(n),r=i.filter(e=>!a.has(e));for(let e of r)this.removeImage(e);return this._spriteImagesIds[e]=n,{loaded:n,removed:r}}removeSpriteImages(e){let t=this._spriteImagesIds[e]??[];for(let e of t)this.removeImage(e);return delete this._spriteImagesIds[e],t}removeAllSpriteImages(){let e=Object.values(this._spriteImagesIds).flat();for(let t of e)this.removeImage(t);return this._spriteImagesIds={},e}setMissingImageResolver(e){this.missingImageResolver=e}getImages(e){return new Promise((t,i)=>{let n=!0;if(!this.isLoaded())for(let t of e)this.images[t]||(n=!1);this.isLoaded()||n?t(this._getImagesForIds(e)):this.requestors.push({ids:e,promiseResolve:t})})}async _getImagesForIds(e){let t=new Set(e.filter(e=>!this.getImage(e))),i=this.missingImageResolver;i&&await Promise.allSettled(Array.from(t,e=>i(e)));let n={};for(let i of e){let e=this.getImage(i);e&&(t.delete(i),n[i]={data:e.data.clone(),pixelRatio:e.pixelRatio,sdf:e.sdf,version:e.version,stretchX:e.stretchX,stretchY:e.stretchY,content:e.content,textFitWidth:e.textFitWidth,textFitHeight:e.textFitHeight,hasRenderCallback:!!e.userImage?.render,isWebGLImage:e.isWebGLImage})}for(let e of t)this.fire(new AC({id:e})),yh(`Image "${e}" could not be loaded. Please make sure you have added the image before it is needed with map.addImage(), resolved it with map.setMissingStyleImageResolver(), or included it in a "sprite" property in your style.`);return n}beginFrame(){this._renderCallbacksDispatchedThisFrame={}}dispatchRenderCallbacks(e){for(let t of e){if(this._renderCallbacksDispatchedThisFrame[t])continue;this._renderCallbacksDispatchedThisFrame[t]=!0;let e=this.getImage(t);e||yh(`Image with ID: "${t}" was not found`),_w(e)&&this.updateImage(t,e)}}cloneImages(){let e={};for(let t in this.images){let i=this.images[t];e[t]={...i,data:i.data?i.data.clone():null}}return e}},zC=class{constructor(e){this._imageManager=e,this._entries={},this._image=new Hv({width:1,height:1}),this._dirty=!0}destroy(){this._texture&&=(this._texture.destroy(),null),this._entries={},this._image=new Hv({width:1,height:1}),this._dirty=!0}getPixelSize(){let{width:e,height:t}=this._image;return{width:e,height:t}}getPattern(e){let t=this._imageManager.getImage(e);if(!t)return null;let i=this._entries[e];if(i?.image!==t){let i={w:t.data.width+2,h:t.data.height+2,x:0,y:0};this._entries[e]={bin:i,position:new yw(i,t),image:t}}else{if(i.position.version===t.version)return i.position;i.position.version=t.version}return this._update(),this._entries[e].position}bind(e){let t=e.gl;this._texture?this._dirty&&=(this._texture.update(this._image),!1):(this._texture=new iy(e,this._image,t.RGBA),this._dirty=!1),this._texture.bind(t.LINEAR,t.CLAMP_TO_EDGE)}_update(){for(let e in this._entries)this._imageManager.getImage(e)||delete this._entries[e];let e=[];for(let t in this._entries)e.push(this._entries[t].bin);let{w:t,h:i}=vw(e),n=this._image;n.resize({width:t||1,height:i||1});for(let e in this._entries){let{bin:t}=this._entries[e],i=t.x+1,a=t.y+1,r=this._entries[e].image.data,s=r.width,o=r.height;Hv.copy(r,n,{x:0,y:0},{x:i,y:a},{width:s,height:o}),Hv.copy(r,n,{x:0,y:o-1},{x:i,y:a-1},{width:s,height:1}),Hv.copy(r,n,{x:0,y:0},{x:i,y:a+o},{width:s,height:1}),Hv.copy(r,n,{x:s-1,y:0},{x:i-1,y:a},{width:1,height:o}),Hv.copy(r,n,{x:0,y:0},{x:i+s,y:a},{width:1,height:o})}this._dirty=!0}};const RC=1114111,LC={start:0,end:RC};let BC=0;function OC(e){let t=/^u\+([0-9a-f]*)(\?+)$/i.exec(e);if(t){let[,e,i]=t;return e.length+i.length>6?null:UC(parseInt(`${e}${"0".repeat(i.length)}`,16),parseInt(`${e}${"f".repeat(i.length)}`,16))}let i=/^u\+([0-9a-f]{1,6})(?:-([0-9a-f]{1,6}))?$/i.exec(e);if(!i)return null;let n=parseInt(i[1],16);return UC(n,void 0===i[2]?n:parseInt(i[2],16))}function UC(e,t){return e>t||e>RC?null:{start:e,end:Math.min(t,RC)}}function NC(e,t){return e.ranges.some(({start:e,end:i})=>t>=e&&t<=i)}var jC=class{constructor(e){this.requestManager=e,this._faces={},this._registered=new Set}setFontFaces(e){this._unregisterAll(),this._faces={};for(let[t,i]of Object.entries(e??{})){let e=Array.isArray(i)?i:[i];this._faces[t]=e.map(e=>this._declareFontFace(t,e)).filter(e=>null!==e)}}hasFontFaces(){return Object.keys(this._faces).length>0}async getFontFamily(e,t){for(let i of e.split(","))for(let e of this._faces[i.trim()]??[])if(NC(e,t)&&(e.loaded??=this._loadFontFace(e),await e.loaded))return e.family;return null}_declareFontFace(e,t){let i="string"==typeof t?{url:t}:t;if("string"!=typeof i?.url)return yh(`Ignoring the font face declared for "${e}": it has no URL.`),null;let n="maplibre-gl-font-face-"+BC++,a=i["unicode-range"];if(!a?.length)return{url:i.url,ranges:[LC],family:n};let r=[];for(let e of a){let t=OC(e);t?r.push(t):yh(`Ignoring the unicode range "${e}" of the font face at ${i.url}: it is not a valid range.`)}return r.length?{url:i.url,ranges:r,family:n}:null}async _loadFontFace(e){if(typeof FontFace>"u"||typeof document>"u"||!document.fonts)return yh(`Ignoring the font face at ${e.url}: this environment has no CSS Font Loading API.`),!1;let t;try{return t=new FontFace(e.family,await this._downloadFontFile(e.url)),!!Object.values(this._faces).some(t=>t.includes(e))&&(document.fonts.add(t),this._registered.add(t),await t.load(),!0)}catch(i){return t&&this._unregister(t),yh(`Ignoring the font face at ${e.url}: ${ju(i).message}`),!1}}async _downloadFontFile(e){let t=await this.requestManager.transformRequest(e,"Glyphs"),i=await Qh(t,new AbortController);if(!i?.data)throw Error(`the response was empty for the font file at ${e}`);return i.data}_unregister(e){document.fonts?.delete(e),this._registered.delete(e)}_unregisterAll(){for(let e of this._registered)document.fonts?.delete(e);this._registered.clear()}destroy(){this._unregisterAll(),this._faces={}}};const VC=1e20,qC=new Float64Array(256);for(let e=0;e<256;e++){let t=.5-(e/255)**(1/2.2);qC[e]=t*Math.abs(t)}qC[255]=-1e20;var GC=class{constructor({fontSize:e=24,buffer:t=3,radius:i=8,cutoff:n=.25,fontFamily:a="sans-serif",fontWeight:r="normal",fontStyle:s="normal",lang:o=null}={}){this.buffer=t,this.radius=i,this.cutoff=n,this.lang=o;let l=this.size=e+4*t,c=this._createCanvas(l),u=this.ctx=c.getContext("2d",{willReadFrequently:!0});u.font=`${s} ${r} ${e}px ${a}`,u.textBaseline="alphabetic",u.textAlign="left",u.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(e){if(typeof OffscreenCanvas<"u")return new OffscreenCanvas(e,e);let t=document.createElement("canvas");return t.width=t.height=e,t}draw(e){let{width:t,actualBoundingBoxAscent:i,actualBoundingBoxDescent:n,actualBoundingBoxLeft:a,actualBoundingBoxRight:r}=this.ctx.measureText(e),s=Math.ceil(i),o=Math.floor(-a),l=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(r)-o)),c=Math.max(0,Math.min(this.size-this.buffer,s+Math.ceil(n))),u=l+2*this.buffer,h=c+2*this.buffer,d=Math.max(u*h,0),p=new Uint8ClampedArray(d),m={data:p,width:u,height:h,glyphWidth:l,glyphHeight:c,glyphTop:s,glyphLeft:o,glyphAdvance:t};if(0===l||0===c)return m;let{ctx:g,buffer:f,gridInner:A,gridOuter:_}=this;this.lang&&(g.lang=this.lang),g.clearRect(f,f,l,c),g.fillText(e,f-o,f+s);let v=g.getImageData(f,f,l,c);_.fill(VC,0,d),A.fill(0,0,d);let y=3;for(let e=0;e<c;e++){let t=(e+f)*u+f;for(let e=0;e<l;e++,y+=4,t++){let e=v.data[y];if(0===e)continue;let i=qC[e];_[t]=Math.max(0,i),A[t]=Math.max(0,-i)}}HC(_,0,0,u,h,u,this.f,this.v,this.z);let x=Math.min(f,1);HC(A,f-x,f-x,l+2*x,c+2*x,u,this.f,this.v,this.z);let b=255/this.radius,w=255*(1-this.cutoff);for(let e=0;e<d;e++){let t=Math.sqrt(_[e])-Math.sqrt(A[e]);p[e]=Math.round(w-b*t)}return m}};function HC(e,t,i,n,a,r,s,o,l){for(let c=t;c<t+n;c++)WC(e,i*r+c,r,a,s,o,l);for(let c=i;c<i+a;c++)WC(e,c*r+t,1,n,s,o,l)}function WC(e,t,i,n,a,r,s){r[0]=0,s[0]=-1e20,s[1]=VC,a[0]=e[t];for(let o=1,l=0,c=0;o<n;o++){a[o]=e[t+o*i];let n=o*o;do{let e=r[l];c=(a[o]-a[e]+n-e*e)/(o-e)/2}while(c<=s[l]&&--l>-1);l++,r[l]=o,s[l]=c,s[l+1]=VC}for(let o=0,l=0;o<n;o++){for(;s[l+1]<o;)l++;let n=r[l],c=o-n;e[t+o*i]=a[n]+c*c}}const ZC=ad.layout_symbol["text-font"].default.join(","),KC=(e,t)=>{let i=new GC(e);return i.buffer=t,i};var XC=class{constructor(e,t,i,n=KC){this.requestManager=e,this.localIdeographFontFamily=t,this.entries={},this.lang=i,this.fontFaceManager=new jC(e),this.createRasterizer=n}setURL(e){this.url=e}setFontFaces(e){this.fontFaceManager.setFontFaces(e),this.entries={}}async getGlyphs(e){let t=[];for(let i in e)for(let n of e[i])t.push(this._getAndCacheGlyphsPromise(i,n));let i=await Promise.all(t),n={};for(let{stack:e,id:t,glyph:a}of i)n[e]||={},n[e][t]=a&&{id:a.id,bitmap:a.bitmap.clone(),metrics:a.metrics};return n}async _getAndCacheGlyphsPromise(e,t){this.entries[e]??={glyphs:{},requests:{},ranges:{}};let i=this.entries[e],n=i.glyphs[t];if(void 0!==n)return{stack:e,id:t,glyph:n};let a=t.codePointAt(0),r=this.fontFaceManager.hasFontFaces()?await this.fontFaceManager.getFontFamily(e,a):null;return r?(n=i.glyphs[t]=await this._drawGlyph(i,e,t,r),{stack:e,id:t,glyph:n}):!this.url||Ub(t)||this._charUsesLocalIdeographFontFamily(a)?(n=i.glyphs[t]=await this._drawGlyph(i,e,t),{stack:e,id:t,glyph:n}):await this._downloadAndCacheRangePromise(e,t)}async _downloadAndCacheRangePromise(e,t){let i=t.codePointAt(0),n=this.entries[e],a=Math.floor(i/256);if(n.ranges[a])return{stack:e,id:t,glyph:null};n.requests[a]||=this._loadGlyphRange(e,a);try{let r=await n.requests[a];for(let e in r)n.glyphs[String.fromCodePoint(+e)]=r[+e];return n.ranges[a]=!0,{stack:e,id:t,glyph:r[i]||null}}catch(r){let s=n.glyphs[t]=await this._drawGlyph(n,e,t);return this._warnOnMissingGlyphRange(s,a,i,ju(r)),{stack:e,id:t,glyph:s}}}async _loadGlyphRange(e,t){let i=256*t,n=i+255,a=await this.requestManager.transformRequest(this.url.replace("{fontstack}",e).replace("{range}",`${i}-${n}`),"Glyphs"),r=await Qh(a,new AbortController);if(!r?.data)throw Error(`Could not load glyph range. range: ${t}, ${i}-${n}`);let s={};for(let e of function(e){return new pw(e).readFields(mw,[])}(r.data))s[e.id]=e;return s}_warnOnMissingGlyphRange(e,t,i,n){let a=256*t;yh(`Unable to load glyph range ${t}, ${a}-${a+255}. Rendering codepoint U+${i.toString(16).padStart(4,"0").toUpperCase()} locally instead. ${n}`)}_charUsesLocalIdeographFontFamily(e){return!!this.localIdeographFontFamily&&function(e){return/[\u02EA\u02EB\u1100-\u11FF\u2E80-\u2FDF\u3000-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\uA960-\uA97C\uAC00-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFE10-\uFE1F\uFE30-\uFE4F\uFF00-\uFFEF]|\uD81B[\uDFE0-\uDFFF]|[\uD81C-\uD822\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFFF]|\uD82C[\uDC00-\uDEFB]|\uD83C[\uDE00-\uDEFF]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79]/gim.test(String.fromCodePoint(e))}(e)}async _drawGlyph(e,t,i,n){let a=(await this._getTinySDF(e,t,i,n)).draw(i),r=/^\p{gc=Cf}+$/u.test(i);return{id:i.codePointAt(0),bitmap:new Gv({width:a.width||60,height:a.height||60},a.data),metrics:{width:r?0:a.glyphWidth/2||24,height:a.glyphHeight/2||24,left:a.glyphLeft/2+.5||0,top:a.glyphTop/2-27.5||-8,advance:r?0:a.glyphAdvance/2||24,isDoubleResolution:!0}}}_getTinySDF(e,t,i,n){let a=Ub(i);if(n){let t=a?"clusterTinySDFs":"fontFaceTinySDFs";return e[t]??={},e[t][n]||=this._createTinySDF(n,!1,a?3:1),e[t][n]}let r=t===ZC&&""!==this.localIdeographFontFamily&&this._charUsesLocalIdeographFontFamily(i.codePointAt(0)),s=r?this.localIdeographFontFamily:t;if(a)return e.clusterTinySDFs??={},e.clusterTinySDFs[s]||=this._createTinySDF(s,!0,3),e.clusterTinySDFs[s];let o=r?"ideographTinySDF":"tinySDF";return e[o]||=this._createTinySDF(s),e[o]}async _createTinySDF(e,t=!0,i=1){let n=e?e.split(","):[];n.push("sans-serif");let a=n.map(e=>/[-\w]+/.test(e)?e:`'${CSS.escape(e)}'`).join(","),r=t?this._fontWeight(n[0]):void 0,s=t?this._fontStyle(n[0]):"normal";if(typeof document<"u"&&document.fonts?.load)try{await document.fonts.load(`${s} ${r||"normal"} 48px ${a}`)}catch(e){yh(`Failed to load font "${a}": ${ju(e).message}`)}return this.createRasterizer({fontSize:48,buffer:Math.max(6,Math.ceil(48*(i-1)/4)),radius:16,cutoff:.25,fontFamily:a,fontWeight:r,fontStyle:s,lang:this.lang},6)}_fontStyle(e){return/italic/i.test(e)?"italic":/oblique/i.test(e)?"oblique":"normal"}_fontWeight(e){let t,i={thin:100,hairline:100,"extra light":200,"ultra light":200,light:300,normal:400,regular:400,medium:500,semibold:600,demibold:600,bold:700,"extra bold":800,"ultra bold":800,black:900,heavy:900,"extra black":950,"ultra black":950};for(let[n,a]of Object.entries(i))RegExp(`\\b${n}\\b`,"i").test(e)&&(t=`${a}`);return t}destroy(){for(let e in this.entries){let t=this.entries[e];t.tinySDF=null,t.ideographTinySDF=null,t.fontFaceTinySDFs={},t.glyphs={},t.requests={},t.ranges={}}this.entries={},this.fontFaceManager.destroy()}};let QC;var YC=class extends id{constructor(e,t){super(),this._transitionable=new Yf(QC||=new uA({anchor:new rA(ad.light.anchor,"anchor"),position:new rA(ad.light.position,"position"),color:new rA(ad.light.color,"color"),intensity:new rA(ad.light.intensity,"intensity")}),"light",t),this.setLight(e),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}getCartesianPosition(){return function([e,t,i]){return t+=90,t*=Math.PI/180,i*=Math.PI/180,[e*Math.cos(t)*Math.sin(i),e*Math.sin(t)*Math.sin(i),e*Math.cos(i)]}(this.properties.get("position"))}setLight(e,t={}){if(!this._validate(Ff.light,e,t))for(let t in e){let i=e[t];t.endsWith("-transition")?this._transitionable.setTransition(t.slice(0,-11),i):this._transitionable.setValue(t,i)}}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(e,t,i){return Bf(this,e,{value:t},i)}};let JC;var $C=class extends id{constructor(e,t){super(),this._transitionable=new Yf(JC||=new uA({"sky-color":new rA(ad.sky["sky-color"],"sky-color"),"horizon-color":new rA(ad.sky["horizon-color"],"horizon-color"),"fog-color":new rA(ad.sky["fog-color"],"fog-color"),"fog-ground-blend":new rA(ad.sky["fog-ground-blend"],"fog-ground-blend"),"horizon-fog-blend":new rA(ad.sky["horizon-fog-blend"],"horizon-fog-blend"),"sky-horizon-blend":new rA(ad.sky["sky-horizon-blend"],"sky-horizon-blend"),"atmosphere-blend":new rA(ad.sky["atmosphere-blend"],"atmosphere-blend")}),"sky",t),this.setSky(e),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new Zf(0))}setSky(e,t={}){if(!this._validate(Ff.sky,e,t)){e||={"sky-color":"transparent","horizon-color":"transparent","fog-color":"transparent","fog-ground-blend":1,"atmosphere-blend":0};for(let t in e){let i=e[t];t.endsWith("-transition")?this._transitionable.setTransition(t.slice(0,-11),i):this._transitionable.setValue(t,i)}}}getSky(){return this._transitionable.serialize()}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(e,t,i={}){return Bf(this,e,{value:t},i)}calculateFogBlendOpacity(e){return e<60?0:e<70?(e-60)/10:1}},eT=class{constructor(e,t){this.width=e,this.height=t,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(e,t){let i=e.join(",")+String(t);return this.dashEntry[i]||=this.addDash(e,t),this.dashEntry[i]}getDashRanges(e,t,i){let n=[],a=e.length%2==1?-e[e.length-1]*i:0,r=e[0]*i,s=!0;n.push({left:a,right:r,isDash:s,zeroLength:0===e[0]});let o=e[0];for(let t=1;t<e.length;t++){s=!s;let l=e[t];a=o*i,o+=l,r=o*i,n.push({left:a,right:r,isDash:s,zeroLength:0===l})}return n}addRoundDash(e,t,i){let n=t/2;for(let t=-i;t<=i;t++){let a=this.nextRow+i+t,r=this.width*a,s=0,o=e[s];for(let a=0;a<this.width;a++){a/o.right>1&&(o=e[++s]);let l,c=Math.abs(a-o.left),u=Math.abs(a-o.right),h=Math.min(c,u),d=t/i*(n+1);if(o.isDash){let e=n-Math.abs(d);l=Math.sqrt(h*h+e*e)}else l=n-Math.sqrt(h*h+d*d);this.data[r+a]=Math.max(0,Math.min(255,l+128))}}}addRegularDash(e){for(let t=e.length-1;t>=0;--t){let i=e[t],n=e[t+1];i.zeroLength?e.splice(t,1):n?.isDash===i.isDash&&(n.left=i.left,e.splice(t,1))}let t=e[0],i=e[e.length-1];t.isDash===i.isDash&&(t.left=i.left-this.width,i.right=t.right+this.width);let n=this.width*this.nextRow,a=0,r=e[a];for(let t=0;t<this.width;t++){t/r.right>1&&(r=e[++a]);let i=Math.abs(t-r.left),s=Math.abs(t-r.right),o=Math.min(i,s),l=r.isDash?o:-o;this.data[n+t]=Math.max(0,Math.min(255,l+128))}}addDash(e,t){let i=t?7:0,n=2*i+1;if(this.nextRow+n>this.height)return yh("LineAtlas out of space"),null;let a=0;for(let t of e)a+=t;if(0!==a){let n=this.width/a,r=this.getDashRanges(e,this.width,n);t?this.addRoundDash(r,n,i):this.addRegularDash(r)}let r={y:this.nextRow+i,height:2*i,width:a};return this.nextRow+=n,this.dirty=!0,r}bind(e){let t=e.gl;this.texture?(t.bindTexture(t.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,t.texSubImage2D(t.TEXTURE_2D,0,0,0,this.width,this.height,t.ALPHA,t.UNSIGNED_BYTE,this.data))):(this.texture=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.REPEAT),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.REPEAT),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texImage2D(t.TEXTURE_2D,0,t.ALPHA,this.width,this.height,0,t.ALPHA,t.UNSIGNED_BYTE,this.data))}};function tT(e,t){if(t)try{return new Worker(e,{type:"module"})}catch(e){console.warn("Module worker not supported, falling back to classic worker",e)}return new Worker(e)}async function iT(){let t=Vh.WORKER_URL||function(){let t="undefined"==typeof document?require("url").pathToFileURL(__filename).href:e&&"SCRIPT"===e.tagName.toUpperCase()&&e.src||new URL("index.js",document.baseURI).href;if(!/^https?:/.test(t))return"";let i=t.endsWith("-dev.mjs")?"maplibre-gl-worker-dev.mjs":"maplibre-gl-worker.mjs";return new URL(`./${i}`,t).href}(),i=!t?.endsWith(".cjs");if(!function(e){if(!e)return!1;let t=globalThis.location;if(!t)return!1;try{return new URL(e,t.href).origin!==t.origin}catch{return!1}}(t))return tT(t,i);if(i){let n=function(t){let i=new Blob([`import ${JSON.stringify(new URL(t,"undefined"==typeof document?require("url").pathToFileURL(__filename).href:e&&"SCRIPT"===e.tagName.toUpperCase()&&e.src||new URL("index.js",document.baseURI).href).href)}`],{type:"text/javascript"});return URL.createObjectURL(i)}(t);try{return tT(n,i)}finally{URL.revokeObjectURL(n)}}let n=await async function(e){let t=await fetch(e);if(!t.ok)throw Error(`Failed to fetch worker script (${t.status}): ${e}`);let i=await t.text(),n=new Blob([i],{type:"text/javascript"});return URL.createObjectURL(n)}(t);try{return tT(n,i)}finally{URL.revokeObjectURL(n)}}var nT=class e{constructor(){this.active={},this.workersPromise=null}async acquire(t){if(this.active[t]=!0,!this.workersPromise){let t=[];for(;t.length<e.workerCount;)t.push(iT());this.workersPromise=Promise.all(t)}return(await this.workersPromise).slice()}release(e){if(delete this.active[e],0===this.numActive()&&this.workersPromise){let e=this.workersPromise;this.workersPromise=null,e.then(e=>{for(let t of e)t.terminate()})}}isPreloaded(){return!!this.active.maplibre_preloaded_worker_pool}numActive(){return Object.keys(this.active).length}};const aT=Math.floor($M.hardwareConcurrency/2);let rT;function sT(){return rT||=new nT,rT}nT.workerCount=function(e){if(null==wh){let t=e.navigator?e.navigator.userAgent:null;wh=!!e.safari||!(!t||!(/\b(iPad|iPhone|iPod)\b/.test(t)||t.match("Safari")&&!t.match("Chrome")))}return wh}(globalThis)?Math.max(Math.min(aT,3),1):1;var oT=class{constructor(e,t){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=t,this.removed=!1,this.actorsPromise=this.initActors(t)}async initActors(e){let t=await this.workerPool.acquire(e);if(this.removed)return[];if(this.actors=t.map((t,i)=>{let n=new jE(t,e);return n.name=`Worker ${i}`,n}),!this.actors.length)throw Error("No actors found");return this.actors}async broadcast(e,t){let i=await this.actorsPromise;return Promise.all(i.map(i=>i.sendAsync({type:e,data:t})))}async getActor(){let e=await this.actorsPromise;return this.currentActor=(this.currentActor+1)%e.length,e[this.currentActor]}async waitForInitComplete(){0===this.actors.length&&await this.actorsPromise}getReadyActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(e=!0){this.removed=!0;for(let e of this.actors)e.remove();this.actors=[],e&&this.workerPool.release(this.id)}async registerMessageHandler(e,t){let i=await this.actorsPromise;for(let n of i)n.registerMessageHandler(e,t)}async unregisterMessageHandler(e){let t=await this.actorsPromise;for(let i of t)i.unregisterMessageHandler(e)}};let lT;function cT(e,t){let i=Jc();return nu(i,i,[1,1,0]),au(i,i,[.5*e.width,.5*e.height,1]),e.calculatePosMatrix?iu(i,i,e.calculatePosMatrix(t.toUnwrapped())):i}function uT(e,t,i,n,a,r,s){let o=function(e,t,i){if(e)for(let n of e){let e=t[n];if(e?.source===i&&"fill-extrusion"===e.type)return!0}else for(let e in t){let n=t[e];if(n.source===i&&"fill-extrusion"===n.type)return!0}return!1}(a?.layers??null,t,e.id),l=r.maxPitchScaleFactor(),c=e.tilesIn(n,l,o);c.sort(dT);let u=[];for(let n of c)u.push({wrappedTileID:n.tileID.wrapped().key,queryResults:n.tile.queryRenderedFeatures(t,i,e.getState(),n.queryGeometry,n.cameraQueryGeometry,n.scale,a,r,l,cT(r,n.tileID),s?(e,t)=>s(n.tileID,e,t):void 0)});return function(e,t){for(let i in e)for(let n of e[i])pT(n,t);return e}(function(e){let t={},i={};for(let{queryResults:n,wrappedTileID:a}of e){i[a]||={};let e=i[a];for(let i in n){let a=n[i];e[i]||={};let r=e[i];t[i]||=[];for(let e of a)r[e.featureIndex]||(r[e.featureIndex]=!0,t[i].push(e))}}return t}(u),e)}function hT(e,t,i,n,a,r,s){let o={},l=r.queryRenderedSymbols(n),c=[];for(let e of Object.keys(l).map(Number))c.push(s[e]);c.sort(dT);for(let i of c){let n=i.featureIndex.lookupSymbolFeatures(l[i.bucketInstanceId],t,i.bucketIndex,i.sourceLayerIndex,{filterSpec:a.filter,globalState:a.globalState},a.layers,a.availableImages,e);for(let e in n){o[e]||=[];let t=n[e];t.sort((e,t)=>{let n=i.featureSortOrder;if(n){let i=n.indexOf(e.featureIndex);return n.indexOf(t.featureIndex)-i}return t.featureIndex-e.featureIndex});for(let i of t)o[e].push(i)}}return function(e,t,i){for(let n in e)for(let a of e[n]){pT(a,i[t[n].source])}return e}(o,e,i)}function dT(e,t){let i=e.tileID,n=t.tileID;return i.overscaledZ-n.overscaledZ||i.canonical.y-n.canonical.y||i.wrap-n.wrap||i.canonical.x-n.canonical.x}function pT(e,t){let i=e.feature,n=t.getFeatureState(i.layer["source-layer"],i.id);i.source=i.layer.source,i.layer["source-layer"]&&(i.sourceLayer=i.layer["source-layer"]),i.state=n}async function mT(e,t,i,n){let a=e;if(e.url?a=(await Xh(await t.transformRequest(e.url,"Source"),i)).data:await $M.frameAsync(i,n),!a)return null;let r=ch(lh(a,e),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in a&&a.vector_layers&&(r.vectorLayerIds=a.vector_layers.map(e=>e.id)),r}var gT=class e{constructor(e,t){e&&(t?this.setSouthWest(e).setNorthEast(t):Array.isArray(e)&&(4===e.length?this.setSouthWest([e[0],e[1]]).setNorthEast([e[2],e[3]]):this.setSouthWest(e[0]).setNorthEast(e[1])))}setNorthEast(e){return this._ne=e instanceof Ex?new Ex(e.lng,e.lat):Ex.convert(e),this}setSouthWest(e){return this._sw=e instanceof Ex?new Ex(e.lng,e.lat):Ex.convert(e),this}extend(t){let i,n,a=this._sw,r=this._ne;if(t instanceof Ex)i=t,n=t;else{if(!(t instanceof e)){if(Array.isArray(t)){if(4===t.length||t.every(Array.isArray)){let i=t;return this.extend(e.convert(i))}{let e=t;return this.extend(Ex.convert(e))}}return t&&("lng"in t||"lon"in t)&&"lat"in t?this.extend(Ex.convert(t)):this}if(i=t._sw,n=t._ne,!i||!n)return this}return a||r?(a.lng=Math.min(i.lng,a.lng),a.lat=Math.min(i.lat,a.lat),r.lng=Math.max(n.lng,r.lng),r.lat=Math.max(n.lat,r.lat)):(this._sw=new Ex(i.lng,i.lat),this._ne=new Ex(n.lng,n.lat)),this}getCenter(){return new Ex((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 Ex(this.getWest(),this.getNorth())}getSouthEast(){return new Ex(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(e){let{lng:t,lat:i}=Ex.convert(e),n=this._sw.lat<=i&&i<=this._ne.lat,a=this._sw.lng<=t&&t<=this._ne.lng;return this._sw.lng>this._ne.lng&&(a=this._sw.lng>=t&&t>=this._ne.lng),n&&a}intersects(t){if(!((t=e.convert(t)).getNorth()>=this.getSouth()&&t.getSouth()<=this.getNorth()))return!1;let i=Math.abs(this.getEast()-this.getWest()),n=Math.abs(t.getEast()-t.getWest());if(i>=360||n>=360)return!0;let a=oh(this.getWest(),-180,180),r=oh(this.getEast(),-180,180),s=oh(t.getWest(),-180,180),o=oh(t.getEast(),-180,180),l=a>r,c=s>o;return!(!l||!c)||(l?o>=a||s<=r:c?r>=s||a<=o:s<=r&&o>=a)}static convert(t){return t instanceof e||!t?t:new e(t)}static fromLngLat(t,i=0){let n=360*i/40075017,a=n/Math.cos(Math.PI/180*t.lat);return new e(new Ex(t.lng-a,t.lat-n),new Ex(t.lng+a,t.lat+n))}adjustAntiMeridian(){let t=new Ex(this._sw.lng,this._sw.lat),i=new Ex(this._ne.lng,this._ne.lat);return t.lng>i.lng?new e(t,new Ex(i.lng+360,i.lat)):new e(t,i)}},fT=class{constructor(e,t,i){this.bounds=gT.convert(this.validateBounds(e)),this.minzoom=t||0,this.maxzoom=i||24}validateBounds(e){return Array.isArray(e)&&4===e.length?[Math.max(-180,e[0]),Math.max(-90,e[1]),Math.min(180,e[2]),Math.min(90,e[3])]:[-180,-90,180,90]}contains(e){let t=2**e.z,i=Math.floor(Mx(this.bounds.getWest())*t),n=Math.floor(Cx(this.bounds.getNorth())*t),a=Math.ceil(Mx(this.bounds.getEast())*t),r=Math.ceil(Cx(this.bounds.getSouth())*t);return e.x>=i&&e.x<a&&e.y>=n&&e.y<r}},AT=class extends id{constructor(e,t,i,n){if(super(),this.id=e,this.dispatcher=i,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,lh(this,ch(t,["url","scheme","tileSize","promoteId","encoding"])),this._options=lh({type:"vector"},t),this._collectResourceTiming=t.collectResourceTiming,512!==this.tileSize)throw Error("vector tile sources must have a tileSize of 512");this.setEventedParent(n)}async load(e=!1){this._loaded=!1,this.fire(new cC("dataloading")),this._tileJSONRequest=new AbortController;try{let t=await mT(this._options,this.map._requestManager,this._tileJSONRequest,this.map._ownerWindow);this._tileJSONRequest=null,this._loaded=!0,t&&(lh(this,t),t.bounds&&(this.tileBounds=new fT(t.bounds,this.minzoom,this.maxzoom)),this.fire(new cC("data",{sourceDataType:"metadata"})),this.fire(new cC("data",{sourceDataType:"content",sourceDataChanged:e})))}catch(e){this._tileJSONRequest=null,this._loaded=!0,Nh(e)||this.fire(new td(ju(e)))}}loaded(){return this._loaded}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}onAdd(e){this.map=e,this.load()}setSourceProperty(e){this._tileJSONRequest&&this._tileJSONRequest.abort(),e(),this.load(!0)}setTiles(e){return this.setSourceProperty(()=>{this.tiles=e,this._options.tiles=e}),this}setUrl(e){return this.setSourceProperty(()=>{this.url=e,this._options.url=e}),this}onRemove(){this._tileJSONRequest&&=(this._tileJSONRequest.abort(),null)}serialize(){return lh({},this._options)}async loadTile(e){let t=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),i={request:await this.map._requestManager.transformRequest(t,"Tile"),uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,tileSize:this.tileSize*e.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity,encoding:this.encoding,overzoomParameters:await this._getOverzoomParameters(e),etag:e.etag};i.request.collectResourceTiming=this._collectResourceTiming,await this.dispatcher.waitForInitComplete();let n="RT";if(e.actor&&"expired"!==e.state){if("loading"===e.state)return new Promise((t,i)=>{e.reloadPromise={resolve:t,reject:i}})}else e.actor=this.dispatcher.getReadyActor(),n="LT";e.abortController=new AbortController;try{let t=await e.actor.sendAsync({type:n,data:i},e.abortController);if(delete e.abortController,e.aborted)return;this._afterTileLoadWorkerResponse(e,t);let a={};return t?.etagUnmodified&&(a.unmodified=!0),a}catch(t){if(delete e.abortController,e.aborted||Nh(t))return;if(t&&404!==t.status)throw t;this._afterTileLoadWorkerResponse(e,null)}}async _getOverzoomParameters(e){if(e.tileID.canonical.z<=this.maxzoom||void 0===this.map._zoomLevelsToOverscale)return;let t=e.tileID.scaledTo(this.maxzoom).canonical,i=t.url(this.tiles,this.map.getPixelRatio(),this.scheme);return{maxZoomTileID:t,overzoomRequest:await this.map._requestManager.transformRequest(i,"Tile")}}_afterTileLoadWorkerResponse(e,t){if(t?.resourceTiming&&(e.resourceTiming=t.resourceTiming),t&&this.map._refreshExpiredTiles&&e.setExpiryData(t),e.etag=t?.etag,e.loadVectorData(t,this.map.painter),e.reloadPromise){let t=e.reloadPromise;e.reloadPromise=null,this.loadTile(e).then(t.resolve).catch(t.reject)}}async abortTile(e){e.abortController&&(e.abortController.abort(),delete e.abortController),e.actor&&await e.actor.sendAsync({type:"AT",data:{uid:e.uid,type:this.type,source:this.id}})}async unloadTile(e){e.unloadVectorData(),e.actor&&await e.actor.sendAsync({type:"RMT",data:{uid:e.uid,type:this.type,source:this.id}})}hasTransition(){return!1}},_T=class extends id{constructor(e,t,i,n){super(),this.id=e,this.dispatcher=i,this.setEventedParent(n),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._premultiplyAlpha=!0,this._options=lh({type:"raster"},t),lh(this,ch(t,["url","scheme","tileSize"]))}async load(e=!1){this._loaded=!1,this.fire(new cC("dataloading")),this._tileJSONRequest=new AbortController;try{let t=await mT(this._options,this.map._requestManager,this._tileJSONRequest,this.map._ownerWindow);this._tileJSONRequest=null,this._loaded=!0,t&&(lh(this,t),t.bounds&&(this.tileBounds=new fT(t.bounds,this.minzoom,this.maxzoom)),this.fire(new cC("data",{sourceDataType:"metadata"})),this.fire(new cC("data",{sourceDataType:"content",sourceDataChanged:e})))}catch(e){this._tileJSONRequest=null,this._loaded=!0,Nh(e)||this.fire(new td(ju(e)))}}loaded(){return this._loaded}onAdd(e){this.map=e,this.load()}onRemove(){this._tileJSONRequest&&=(this._tileJSONRequest.abort(),null)}setSourceProperty(e){this._tileJSONRequest&&=(this._tileJSONRequest.abort(),null),e(),this.load(!0)}setTiles(e){return this.setSourceProperty(()=>{this.tiles=e,this._options.tiles=e}),this}setUrl(e){return this.setSourceProperty(()=>{this.url=e,this._options.url=e}),this}serialize(){return lh({},this._options)}setPremultiplyAlpha(e){return this._premultiplyAlpha===e||this.setSourceProperty(()=>{this._premultiplyAlpha=e}),this}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}async loadTile(e){let t=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),i=this._premultiplyAlpha,n=i?void 0:{premultiplyAlpha:"none"};e.abortController=new AbortController;try{let a=await nC.transformAndGetImage(this.map._requestManager,t,"Tile",e.abortController,this.map._refreshExpiredTiles,n);if(delete e.abortController,e.aborted)return void(e.state="unloaded");if(a){this.map._refreshExpiredTiles&&(a.cacheControl||a.expires)&&e.setExpiryData({cacheControl:a.cacheControl,expires:a.expires});let t=this.map.painter.context,n=t.gl,r=a.data??new Hv({width:1,height:1},new Uint8Array(4));e.texture=this.map.painter.getTileTexture(r.width),e.texture?e.texture.update(r,{useMipmap:!0,premultiply:i}):(e.texture=new iy(t,r,n.RGBA,{useMipmap:!0,premultiply:i}),e.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE,n.LINEAR_MIPMAP_NEAREST)),e.state="loaded"}}catch(t){if(delete e.abortController,e.aborted)e.state="unloaded";else if(t)throw e.state="errored",t}}async abortTile(e){e.abortController&&(e.abortController.abort(),delete e.abortController)}async unloadTile(e){e.texture&&this.map.painter.saveTileTexture(e.texture)}hasTransition(){return!1}},vT=class extends _T{constructor(e,t,i,n){super(e,t,i,n),this.type="raster-dem",this.maxzoom=22,this._options=lh({type:"raster-dem"},t),this.encoding=t.encoding||"mapbox",this.redFactor=t.redFactor,this.greenFactor=t.greenFactor,this.blueFactor=t.blueFactor,this.baseShift=t.baseShift}async loadTile(e){let t=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);e.neighboringTiles=this._getNeighboringTiles(e.tileID),e.abortController=new AbortController;try{let i=await nC.transformAndGetImage(this.map._requestManager,t,"Tile",e.abortController,this.map._refreshExpiredTiles,{colorSpaceConversion:"none"});if(delete e.abortController,e.aborted)return void(e.state="unloaded");if(i){if(this.map._refreshExpiredTiles&&(i.cacheControl||i.expires)&&e.setExpiryData({cacheControl:i.cacheControl,expires:i.expires}),!i.data)return void(e.state="loaded");let t=i.data,n=Eh(t)&&Kc()?t:await this.readImageNow(t),a={type:this.type,uid:e.uid,source:this.id,rawImageData:n,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(e.actor&&"expired"!==e.state&&"reloading"!==e.state)return;await this.dispatcher.waitForInitComplete(),(!e.actor||"expired"===e.state)&&(e.actor=this.dispatcher.getReadyActor()),e.dem=await e.actor.sendAsync({type:"LDT",data:a}),e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0,e.needsColorReliefPrepare=!0,e.state="loaded"}}catch(t){if(delete e.abortController,e.aborted)e.state="unloaded";else if(t)throw e.state="errored",t}}async readImageNow(e){if(typeof VideoFrame<"u"&&Xc()){let t=e.width+4,i=e.height+4;try{return new Hv({width:t,height:i},await kh(e,-2,-2,t,i))}catch{}}return $M.getImageData(e,2)}_getNeighboringTiles(e){let t=e.canonical,i=2**t.z,n=(t.x-1+i)%i,a=0===t.x?e.wrap-1:e.wrap,r=(t.x+1+i)%i,s=t.x+1===i?e.wrap+1:e.wrap,o={};return o[new HE(e.overscaledZ,a,t.z,n,t.y).key]={backfilled:!1},o[new HE(e.overscaledZ,s,t.z,r,t.y).key]={backfilled:!1},t.y>0&&(o[new HE(e.overscaledZ,a,t.z,n,t.y-1).key]={backfilled:!1},o[new HE(e.overscaledZ,e.wrap,t.z,t.x,t.y-1).key]={backfilled:!1},o[new HE(e.overscaledZ,s,t.z,r,t.y-1).key]={backfilled:!1}),t.y+1<i&&(o[new HE(e.overscaledZ,a,t.z,n,t.y+1).key]={backfilled:!1},o[new HE(e.overscaledZ,e.wrap,t.z,t.x,t.y+1).key]={backfilled:!1},o[new HE(e.overscaledZ,s,t.z,r,t.y+1).key]={backfilled:!1}),o}async unloadTile(e){e.demTexture&&this.map.painter.saveTileTexture(e.demTexture),e.fbo&&(e.fbo.destroy(),delete e.fbo),e.dem&&delete e.dem,delete e.neighboringTiles,e.state="unloaded",e.actor&&await e.actor.sendAsync({type:"RDT",data:{type:this.type,uid:e.uid,source:this.id}})}};function yT(e,t){return t?e.properties[t]:e.id}function xT(e,t,i){if(!e)return t||{};if(!t)return e||{};let n=wT(e),a=wT(t);!function(e,t){t.removeAll&&(e.add.clear(),e.update.clear(),e.remove.clear(),t.remove.clear());for(let i of t.remove)e.add.delete(i),e.update.delete(i);for(let[i,n]of t.update){let a=e.update.get(i);a&&(t.update.set(i,bT(a,n)),e.update.delete(i))}}(n,a);let r={};if((n.removeAll||a.removeAll)&&(r.removeAll=!0),r.remove=new Set([...n.remove,...a.remove]),r.add=new Map([...n.add,...a.add]),r.update=new Map([...n.update,...a.update]),r.remove.size&&r.add.size)for(let e of r.add.keys())r.remove.delete(e);let s=function(e){let t={};return e.removeAll&&(t.removeAll=e.removeAll),e.remove&&(t.remove=Array.from(e.remove)),e.add&&(t.add=Array.from(e.add.values())),e.update&&(t.update=Array.from(e.update.values())),t}(r);return s}function bT(e,t){let i={id:e.id};if(t.removeAllProperties&&(delete e.removeProperties,delete e.addOrUpdateProperties,delete t.removeProperties),t.removeProperties&&e.addOrUpdateProperties){let i=new Set(t.removeProperties);e.addOrUpdateProperties=e.addOrUpdateProperties.filter(e=>!i.has(e.key))}return(e.removeAllProperties||t.removeAllProperties)&&(i.removeAllProperties=!0),(e.removeProperties||t.removeProperties)&&(i.removeProperties=[...e.removeProperties||[],...t.removeProperties||[]]),(e.addOrUpdateProperties||t.addOrUpdateProperties)&&(i.addOrUpdateProperties=[...e.addOrUpdateProperties||[],...t.addOrUpdateProperties||[]]),(e.newGeometry||t.newGeometry)&&(i.newGeometry=t.newGeometry||e.newGeometry),i}function wT(e){if(!e)return{};let t={};return t.removeAll=e.removeAll,t.remove=new Set(e.remove||[]),t.add=new Map(e.add?.map(e=>[e.id,e])),t.update=new Map(e.update?.map(e=>[e.id,e])),t}function ET(e){return e&&0!==e.length?"number"==typeof e[0]?[e]:e.flatMap(e=>ET(e)):[]}function kT(e){return"GeometryCollection"===e.type?e.geometries.flatMap(e=>kT(e)):ET(e.coordinates)}function ST(e){let t,i=new gT;switch(e.type){case"FeatureCollection":t=e.features.flatMap(e=>kT(e.geometry));break;case"Feature":t=kT(e.geometry);break;default:t=kT(e)}if(0===t.length)return i;for(let e of t){let[t,n]=e;i.extend([t,n])}return i}var MT=class extends id{constructor(e,t,i,n){super(),this.id=e,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._isUpdatingWorker=!1,this._pendingWorkerUpdate={data:t.data},this.actorPromise=i.getActor(),this.setEventedParent(n),this._data="string"==typeof t.data?{url:t.data}:{geojson:t.data},this._options=lh({},t),this._collectResourceTiming=t.collectResourceTiming,void 0!==t.maxzoom&&(this.maxzoom=t.maxzoom),t.type&&(this.type=t.type),t.attribution&&(this.attribution=t.attribution),this.promoteId=t.promoteId,void 0!==t.clusterMaxZoom&&this.maxzoom<=t.clusterMaxZoom&&yh(`The maxzoom value "${this.maxzoom}" is expected to be greater than the clusterMaxZoom value "${t.clusterMaxZoom}".`),this.workerOptions=lh({source:this.id,geojsonVtOptions:{buffer:this._pixelsToTileUnits(void 0===t.buffer?128:t.buffer),tolerance:this._pixelsToTileUnits(void 0===t.tolerance?.375:t.tolerance),extent:Uu,maxZoom:this.maxzoom,lineMetrics:t.lineMetrics||!1,generateId:t.generateId||!1,promoteId:"string"==typeof t.promoteId?t.promoteId:void 0,cluster:t.cluster||!1,clusterOptions:{maxZoom:this._getClusterMaxZoom(t.clusterMaxZoom),minPoints:Math.max(2,t.clusterMinPoints||2),extent:Uu,radius:this._pixelsToTileUnits(t.clusterRadius||50),log:!1,generateId:t.generateId||!1}},clusterProperties:t.clusterProperties,filter:t.filter},t.workerOptions)}_hasPendingWorkerUpdate(){return void 0!==this._pendingWorkerUpdate.data||void 0!==this._pendingWorkerUpdate.diff||this._pendingWorkerUpdate.updateCluster}_pixelsToTileUnits(e){return e*(Uu/this.tileSize)}_tileUnitsToPixels(e){return e/(Uu/this.tileSize)}_getClusterMaxZoom(e){let t=e?Math.round(e):this.maxzoom-1;return Number.isInteger(e)||void 0===e||yh(`Integer expected for option 'clusterMaxZoom': provided value "${e}" rounded to "${t}"`),t}async load(){await this._updateWorkerData()}onAdd(e){this.map=e,this.load()}setData(e){return this._data="string"==typeof e?{url:e}:{geojson:e},this._pendingWorkerUpdate={data:e},this._updateWorkerData()}updateData(e){return this._pendingWorkerUpdate.diff=xT(this._pendingWorkerUpdate.diff,e),this._updateWorkerData()}async getData(){return this._data.url&&await this.once("data"),this._data.geojson?this._data.geojson:{type:"FeatureCollection",features:Array.from(this._data.updateable.values())}}async getBounds(){return ST(await this.getData())}setClusterOptions(e){return this.workerOptions.geojsonVtOptions.cluster=e.cluster,void 0!==e.clusterRadius&&(this.workerOptions.geojsonVtOptions.clusterOptions.radius=this._pixelsToTileUnits(e.clusterRadius)),void 0!==e.clusterMaxZoom&&(this.workerOptions.geojsonVtOptions.clusterOptions.maxZoom=this._getClusterMaxZoom(e.clusterMaxZoom)),this._pendingWorkerUpdate.updateCluster=!0,this._updateWorkerData()}getClusterOptions(){let{cluster:e,clusterOptions:t}=this.workerOptions.geojsonVtOptions;return{cluster:e,clusterMaxZoom:t.maxZoom,clusterRadius:this._tileUnitsToPixels(t.radius)}}async getClusterExpansionZoom(e){return(await this.actorPromise).sendAsync({type:"GCEZ",data:{type:this.type,clusterId:e,source:this.id}})}async getClusterChildren(e){return(await this.actorPromise).sendAsync({type:"GCC",data:{type:this.type,clusterId:e,source:this.id}})}async getClusterLeaves(e,t,i){return(await this.actorPromise).sendAsync({type:"GCL",data:{type:this.type,source:this.id,clusterId:e,limit:t,offset:i}})}async _updateWorkerData(){if(this._isUpdatingWorker)return this._updatePromise;if(!this._hasPendingWorkerUpdate())return void yh(`No pending worker updates for GeoJSONSource ${this.id}.`);let{data:e,diff:t,updateCluster:i}=this._pendingWorkerUpdate,n=this._getLoadGeoJSONParameters(e,t,i);void 0===e?t?this._pendingWorkerUpdate.diff=void 0:i&&(this._pendingWorkerUpdate.updateCluster=void 0):this._pendingWorkerUpdate.data=void 0,this._updatePromise=this._dispatchWorkerUpdate(n),await this._updatePromise}async _getLoadGeoJSONParameters(e,t,i){let n=lh({type:this.type,source:this.id},this.workerOptions);return"string"==typeof e?(n.request=await this.map._requestManager.transformRequest($M.resolveURL(e),"Source"),n.request.collectResourceTiming=this._collectResourceTiming,n):void 0!==e?(n.data=e,n):t?(n.dataDiff=t,n):i?(n.updateCluster=!0,n):void 0}async _dispatchWorkerUpdate(e){this._isUpdatingWorker=!0,this.fire(new cC("dataloading"));try{let t=await e,i=await(await this.actorPromise).sendAsync({type:"LD",data:t});if(this._isUpdatingWorker=!1,this._removed||i.abandoned)return void this.fire(new cC("dataabort"));i.data&&(this._data={geojson:i.data});let n=this._applyDiffToSource(t.dataDiff),a=this._getShouldReloadTileOptions(n),r={};this._applyResourceTiming(r,i),this.fire(new cC("data",{...r,sourceDataType:"metadata"})),this.fire(new cC("data",{...r,sourceDataType:"content",shouldReloadTileOptions:a}))}catch(e){if(this._isUpdatingWorker=!1,this._removed)return void this.fire(new cC("dataabort"));this.fire(new td(ju(e)))}finally{this._hasPendingWorkerUpdate()&&await this._updateWorkerData()}}_applyResourceTiming(e,t){if(!this._collectResourceTiming)return;let i=t.resourceTiming?.[this.id];if(!i)return;let n=i.slice(0);n?.length&&lh(e,{resourceTiming:n})}_applyDiffToSource(e){if(!e)return;let t="string"==typeof this.promoteId?this.promoteId:void 0;if(!this._data.url&&!this._data.updateable){let e=function(e,t){let i=new Map;if(null==e||null==e.type)return i;if("Feature"===e.type){let n=yT(e,t);return null==n?void 0:(i.set(n,e),i)}if("FeatureCollection"===e.type){let n=new Set;for(let a of e.features){let e=yT(a,t);if(null==e||n.has(e))return;n.add(e),i.set(e,a)}return i}}(this._data.geojson,t);if(!e)throw Error(`GeoJSONSource "${this.id}": GeoJSON data is not compatible with updateData`);this._data={updateable:e}}if(!this._data.updateable)return;let i=function(e,t,i){let n=[];if(t.removeAll)e.clear();else if(t.remove)for(let i of t.remove){let t=e.get(i);t&&(n.push(t.geometry),e.delete(i))}if(t.add)for(let a of t.add){let t=yT(a,i);if(null==t)continue;let r=e.get(t);r&&n.push(r.geometry),n.push(a.geometry),e.set(t,a)}if(t.update)for(let i of t.update){let t=e.get(i.id);if(!t)continue;let a=!!i.newGeometry,r=i.removeAllProperties||i.removeProperties?.length>0||i.addOrUpdateProperties?.length>0;if(!a&&!r)continue;n.push(t.geometry);let s={...t};if(e.set(i.id,s),a&&(n.push(i.newGeometry),s.geometry=i.newGeometry),r){if(s.properties=i.removeAllProperties?{}:{...s.properties||{}},i.removeProperties)for(let e of i.removeProperties)delete s.properties[e];if(i.addOrUpdateProperties)for(let{key:e,value:t}of i.addOrUpdateProperties)s.properties[e]=t}}return n}(this._data.updateable,e,t);return e.removeAll||this._options.cluster?void 0:i}_getShouldReloadTileOptions(e){if(e)return{affectedBounds:e.filter(Boolean).map(e=>ST(e))}}shouldReloadTile(e,{affectedBounds:t}){if("loading"===e.state)return!0;if("unloaded"===e.state)return!1;let{buffer:i,extent:n}=this.workerOptions.geojsonVtOptions,a=function({x:e,y:t,z:i},n=0){let a=Dx((e-n)/2**i),r=Px((t+1+n)/2**i),s=Dx((e+1+n)/2**i),o=Px((t-n)/2**i);return new gT([a,r],[s,o])}(e.tileID.canonical,i/n);for(let e of t)if(a.intersects(e))return!0;return!1}loaded(){return!this._isUpdatingWorker&&!this._hasPendingWorkerUpdate()}async loadTile(e){let t=e.actor?"RT":"LT";e.actor=await this.actorPromise;let i={type:this.type,uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity};e.abortController=new AbortController;try{let n=await(await this.actorPromise).sendAsync({type:t,data:i},e.abortController);delete e.abortController,e.unloadVectorData(),e.aborted||e.loadVectorData(n,this.map.painter,"RT"===t)}catch(t){if(delete e.abortController,e.aborted||Nh(t))return;throw t}}async abortTile(e){e.abortController&&(e.abortController.abort(),delete e.abortController),e.aborted=!0}async unloadTile(e){e.unloadVectorData(),await(await this.actorPromise).sendAsync({type:"RMT",data:{uid:e.uid,type:this.type,source:this.id}})}onRemove(){this._removed=!0,this.actorPromise.then(e=>e.sendAsync({type:"RS",data:{type:this.type,source:this.id}}))}serialize(){return lh({},this._options,{type:this.type,data:this._data.updateable?{type:"FeatureCollection",features:Array.from(this._data.updateable.values())}:this._data.url||this._data.geojson})}hasTransition(){return!1}};const CT=[0,0,1],TT=(e,t,i,n,a,r)=>({u_tl_parent:e,u_scale_parent:t,u_buffer_scale:1,u_image_warp:r,u_fade_t:i.mix,u_opacity:i.opacity*n.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:n.paint.get("raster-brightness-min"),u_brightness_high:n.paint.get("raster-brightness-max"),u_saturation_factor:IT(n.paint.get("raster-saturation")),u_contrast_factor:PT(n.paint.get("raster-contrast")),u_spin_weights:DT(n.paint.get("raster-hue-rotate")),u_coords_top:[a[0].x,a[0].y,a[1].x,a[1].y],u_coords_bottom:[a[3].x,a[3].y,a[2].x,a[2].y]});function DT(e){e*=Math.PI/180;let t=Math.sin(e),i=Math.cos(e);return[(2*i+1)/3,(-Math.sqrt(3)*t-i+1)/3,(Math.sqrt(3)*t-i+1)/3]}function PT(e){return e>0?1/(1-e):1+e}function IT(e){return e>0?1-1/(1.001-e):-e}var FT=class{constructor(e,t,i){this.vertexBuffer=e,this.indexBuffer=t,this.segments=i}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}};const zT=xA([{name:"a_pos",type:"Int16",components:2}]);function RT(e,t){let i=function(e,t){let i=void 0===e.granularity?1:Math.max(e.granularity,1),n=i+(e.generateBorders?2:0),a=i+(e.extendToNorthPole||e.generateBorders?1:0)+(e.extendToSouthPole||e.generateBorders?1:0),r=n+1,s=a+1,o=e.generateBorders?-1:0,l=e.generateBorders||e.extendToNorthPole?-1:0,c=i+ +!!e.generateBorders,u=i+(e.generateBorders||e.extendToSouthPole?1:0),h=r*s,d=n*a*6,p=r*s>65536;if(p&&"16bit"===t)throw Error("Granularity is too large and meshes would not fit inside 16 bit vertex indices.");let m=p||"32bit"===t,g=new Int16Array(2*h),f=0;for(let t=l;t<=u;t++)for(let n=o;n<=c;n++){let a=n/i*Uu;-1===n&&(a=-64),n===i+1&&(a=8256);let r=t/i*Uu;-1===t&&(r=e.extendToNorthPole?Yy:-64),t===i+1&&(r=e.extendToSouthPole?Jy:8256),g[f++]=a,g[f++]=r}let A=m?new Uint32Array(d):new Uint16Array(d),_=0;for(let e=0;e<a;e++)for(let t=0;t<n;t++){let i=t+e*r,n=t+1+e*r,a=t+(e+1)*r,s=t+1+(e+1)*r;A[_++]=i,A[_++]=a,A[_++]=n,A[_++]=n,A[_++]=a,A[_++]=s}return{vertices:g.buffer.slice(0),indices:A.buffer.slice(0),uses32bitIndices:m}}(t,"16bit"),n=r_.deserialize({arrayBuffer:i.vertices,length:i.vertices.byteLength/2/2}),a=b_.deserialize({arrayBuffer:i.indices,length:i.indices.byteLength/2/3});return new FT(e.createVertexBuffer(n,zT.members),e.createIndexBuffer(a),S_.simpleSegment(0,0,n.length,a.length))}var LT=class extends id{constructor(e,t,i,n){super(),this.imageWarp=CT,this.flippedWindingOrder=!1,this._warp="auto",this._imageDirty=!1,this._subdividedQuad=!1,this._subdividedMesh=null,this.id=e,this.dispatcher=i,this.coordinates=t.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(n),this.options=t}async load(e){if(void 0===this.options.url)return this._loaded=!0,void this._finishLoading();this._loaded=!1,this.fire(new cC("dataloading")),this.url=this.options.url,this._abortController=new AbortController;try{let t=await nC.transformAndGetImage(this.map._requestManager,this.url,"Image",this._abortController);this._abortController=null,this._loaded=!0,t?.data?(this._setImage(t.data),e&&(this.coordinates=e),this._finishLoading()):this.fire(new td(Error(`Could not load image ${this.url}: the response is empty`)))}catch(e){if(Nh(e))return;this._abortController=null,this._loaded=!0,this.fire(new td(ju(e)))}}loaded(){return this._loaded}updateImage(e){return this._abortController&&=(this._abortController.abort(),null),"image"in e?(this._loaded=!0,this._setImage(e.image),e.coordinates&&(this.coordinates=e.coordinates),this._finishLoading(),this):e.url?(this.options.url=e.url,this.load(e.coordinates),this):this}_setImage(e){this.image=e,this._imageDirty=!0}getMesh(e,t){return!this._subdividedQuad||t?null:(this._subdividedMesh??=RT(e,{granularity:16}),this._subdividedMesh)}_disposeTexture(){this.texture?.destroy(),this.texture=null}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new cC("data",{sourceDataType:"metadata"})))}onAdd(e){this.map=e,this.load()}onRemove(){this._abortController&&=(this._abortController.abort(),null),this._disposeTexture(),this._subdividedMesh?.destroy(),this._subdividedMesh=null,this.image=null,this.tiles={}}setWarp(e){return this._warp===e||(this._warp=e,this.tileCoords&&this.setCoordinates(this.coordinates)),this}getWarp(){return this._warp}setCoordinates(e){this.coordinates=e;let t=e.map(Fx.fromLngLat);return this.tileID=function(e){let t=px.fromPoints(e),i=t.width(),n=t.height(),a=Math.max(0,Math.floor(-Math.log(Math.max(i,n))/Math.LN2)),r=2**a;return new qE(a,Math.floor((t.minX+t.maxX)/2*r),Math.floor((t.minY+t.maxY)/2*r))}(t),this.terrainTileRanges=this._getOverlappingTileRanges(t),this.minzoom=this.maxzoom=this.tileID.z,this.tileCoords=t.map(e=>this.tileID.getTilePoint(e)._round()),this.imageWarp=function(e,t){if("flat"===t||BT(e))return CT;let[i,n,a,r]=e,s=i.x-n.x+a.x-r.x,o=i.y-n.y+a.y-r.y,l=[n.x-a.x,n.y-a.y,r.x-a.x,r.y-a.y],[c,u,h,d]=l,p=function(e){return e[0]*e[3]-e[2]*e[1]}(l),m=(s*d-h*o)/p,g=(c*o-s*u)/p,f=[1,1+m,1+m+g,1+g],A=Math.max(...f)/Math.min(...f),_="perspective"===t?0:function(e){let t=(1-4/e)/(1-4/512);return Math.max(0,t)}(A);return!(A>=1&&A<=512)||_>=1?CT:[m,g,_]}(this.tileCoords,this._warp),this._subdividedQuad=this.imageWarp[2]>0&&!BT(this.tileCoords),this.flippedWindingOrder=function(e){let t=e[1].x-e[0].x,i=e[1].y-e[0].y,n=e[2].x-e[0].x;return t*(e[2].y-e[0].y)-i*n<0}(this.tileCoords),this.fire(new cC("data",{sourceDataType:"content"})),this}prepare(){if(0===Object.keys(this.tiles).length||!this.image)return;let e=this.map.painter.context,t=e.gl;this.texture?this._imageDirty&&(this.texture.update(this.image),this.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE)):(this.texture=new iy(e,this.image,t.RGBA),this.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE)),this._imageDirty=!1;let i=!1;for(let e in this.tiles){let t=this.tiles[e];"loaded"!==t.state&&(t.state="loaded",t.texture=this.texture,i=!0)}i&&this.fire(new cC("data",{sourceDataType:"idle",sourceId:this.id}))}async loadTile(e){this.tileID?.equals(e.tileID.canonical)?(this.tiles[String(e.tileID.wrap)]=e,e.buckets={}):e.state="errored"}serialize(){let e={type:"image",coordinates:this.coordinates};return void 0!==this.options.url&&(e.url=this.options.url),e}hasTransition(){return!1}_getOverlappingTileRanges(e){let{minX:t,minY:i,maxX:n,maxY:a}=px.fromPoints(e),r={};for(let e=0;e<=25;e++){let s=2**e,o=Math.floor(t*s),l=Math.floor(i*s),c=Math.floor(n*s),u=Math.floor(a*s),h=(o%s+s)%s,d=c%s,p=Math.floor(o/s),m=Math.floor(c/s);r[e]={minWrap:p,maxWrap:m,minTileXWrapped:h,maxTileXWrapped:d,minTileY:l,maxTileY:u}}return r}};function BT(e){let[t,i,n,a]=e;return t.x+n.x===i.x+a.x&&t.y+n.y===i.y+a.y}var OT=class extends LT{constructor(e,t,i,n){super(e,t,i,n),this._onPlayingHandler=()=>{this.map?.triggerRepaint()},this.roundZoom=!0,this.type="video",this.options=t}async load(){this._loaded=!1;let e=this.options;this.urls=[];for(let t of e.urls)this.urls.push((await this.map._requestManager.transformRequest(t,"Source")).url);try{let e=await(e=>{let t=window.document.createElement("video");return t.muted=!0,new Promise(i=>{t.onloadstart=()=>{i(t)};for(let i of e){let e=window.document.createElement("source");Yh(i)||(t.crossOrigin="Anonymous"),e.src=i,t.appendChild(e)}})})(this.urls);if(this._loaded=!0,!e)return;this.video=e,this.video.loop=!0,this.video.addEventListener("playing",this._onPlayingHandler),this.map&&this.video.play(),this._finishLoading()}catch(e){this.fire(new td(ju(e)))}}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(e){if(this.video){let t=this.video.seekable;e<t.start(0)||e>t.end(0)?this.fire(new td(new sd(`sources.${this.id}`,null,`Playback for this video can be set only between the ${t.start(0)} and ${t.end(0)}-second mark.`))):this.video.currentTime=e}}getVideo(){return this.video}onAdd(e){this.map||(this.map=e,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}onRemove(){super.onRemove(),this.video&&(this.video.removeEventListener("playing",this._onPlayingHandler),this.video.pause())}prepare(){if(0===Object.keys(this.tiles).length||this.video.readyState<2)return;let e=this.map.painter.context,t=e.gl;this.texture?this.video.paused||(this.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE),t.texSubImage2D(t.TEXTURE_2D,0,0,0,t.RGBA,t.UNSIGNED_BYTE,this.video)):(this.texture=new iy(e,this.video,t.RGBA),this.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE));let i=!1;for(let e in this.tiles){let t=this.tiles[e];"loaded"!==t.state&&(t.state="loaded",t.texture=this.texture,i=!0)}i&&this.fire(new cC("data",{sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}},UT=class extends LT{constructor(e,t,i,n){super(e,t,i,n),t.coordinates?(!Array.isArray(t.coordinates)||4!==t.coordinates.length||t.coordinates.some(e=>!Array.isArray(e)||2!==e.length||e.some(e=>"number"!=typeof e)))&&this.fire(new td(new sd(`sources.${e}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new td(new sd(`sources.${e}`,null,'missing required property "coordinates"'))),t.animate&&"boolean"!=typeof t.animate&&this.fire(new td(new sd(`sources.${e}`,null,'optional "animate" property must be a boolean value'))),t.canvas?"string"!=typeof t.canvas&&!(t.canvas instanceof HTMLCanvasElement)&&this.fire(new td(new sd(`sources.${e}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new td(new sd(`sources.${e}`,null,'missing required property "canvas"'))),this.options=t,this.animate=void 0===t.animate||t.animate}async load(){this._loaded=!0,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 td(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(),!1)},this._finishLoading())}getCanvas(){return this.canvas}onAdd(e){this.map=e,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this._playing=!1,super.onRemove()}prepare(){let e=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,e=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,e=!0),this._hasInvalidDimensions()||0===Object.keys(this.tiles).length)return;let t=this.map.painter.context,i=t.gl;this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):(this.texture=new iy(t,this.canvas,i.RGBA,{premultiply:!0}),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE));let n=!1;for(let e in this.tiles){let t=this.tiles[e];"loaded"!==t.state&&(t.state="loaded",t.texture=this.texture,n=!0)}n&&this.fire(new cC("data",{sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",animate:this.animate,canvas:this.options.canvas,coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(let e of[this.canvas.width,this.canvas.height])if(isNaN(e)||e<=0)return!0;return!1}};const NT={},jT=e=>{switch(e){case"geojson":return MT;case"image":return LT;case"raster":return _T;case"raster-dem":return vT;case"vector":return AT;case"video":return OT;case"canvas":return UT}return NT[e]};const VT="RTLPluginLoaded";var qT=class extends id{constructor(...e){super(...e),this.status="unavailable",this.url=null,this.dispatcher=(lT||(lT=new oT(sT(),Hh),lT.registerMessageHandler("GR",(e,t,i)=>Kh(t,i))),lT)}_syncState(e){return this.status=e,this.dispatcher.broadcast("SRPS",{pluginStatus:e,pluginURL:this.url}).catch(e=>{throw this.status="error",e})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}async setRTLTextPlugin(e,t=!1){if(this.url)throw Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=$M.resolveURL(e),!this.url)throw Error(`requested url ${e} is invalid`);if("unavailable"===this.status){if(!t)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if("requested"===this.status)return this._requestImport()}async _requestImport(){await this._syncState("loading"),this.status="loaded",this.fire(new ed(VT))}lazyLoad(){"unavailable"===this.status?this.status="requested":"deferred"===this.status&&this._requestImport()}};let GT=null;function HT(){return GT||=new qT,GT}var WT=class{constructor(e,t){this.timeAdded=0,this.fadeEndTime=0,this.fadeOpacity=1,this.tileID=e,this.uid=hh(),this.uses=0,this.tileSize=t,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rttObjects=[],this.rttFingerprint={},this.expiredRequestCount=0,this.state="loading",this.featureStateRevision=-1}isRenderable(e){return this.hasData()&&(!this.fadeEndTime||this.fadeOpacity>0)&&(e||!this.holdingForSymbolFade())}setCrossFadeLogic({fadingRole:e,fadingDirection:t,fadingParentID:i,fadeEndTime:n}){this.resetFadeLogic(),this.fadingRole=e,this.fadingDirection=t,this.fadingParentID=i,this.fadeEndTime=n}setSelfFadeLogic(e){this.resetFadeLogic(),this.selfFading=!0,this.fadeEndTime=e}resetFadeLogic(){this.fadingRole=null,this.fadingDirection=null,this.fadingParentID=null,this.selfFading=!1,this.timeAdded=tC(),this.fadeEndTime=0,this.fadeOpacity=1}wasRequested(){return"errored"===this.state||"loaded"===this.state||"reloading"===this.state}clearTextures(e){this.demTexture&&e.saveTileTexture(this.demTexture),this.demTexture=null}getRTT(e){return this.rttObjects[e]}acquireRTT(e,t,i){return this.rttObjects[t]=e.acquireRTT(i)}releaseRTT(e){if(0!==this.rttObjects.length){for(let t of this.rttObjects)t&&e.releaseRTT(t);this.rttObjects.length=0}}loadVectorData(e,t,i){if(!0!==e?.etagUnmodified)if(this.hasData()&&this.unloadVectorData(),this.state="loaded",e){e.featureIndex&&(this.latestFeatureIndex=e.featureIndex,e.rawTileData?(this.latestRawTileData=e.rawTileData,this.latestEncoding=e.encoding,this.latestFeatureIndex.rawTileData=e.rawTileData,this.latestFeatureIndex.encoding=e.encoding):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData,this.latestFeatureIndex.encoding=this.latestEncoding)),this.collisionBoxArray=e.collisionBoxArray,this.buckets=function(e,t){let i={};if(!t)return i;for(let n of e){let e=n.layerIds.map(e=>t.getLayer(e)).filter(Boolean);if(0!==e.length){n.layers=e,n.stateDependentLayerIds&&(n.stateDependentLayers=n.stateDependentLayerIds.map(t=>e.filter(e=>e.id===t)[0]));for(let t of e)i[t.id]=n}}return i}(e.buckets,t?.style),this.hasSymbolBuckets=!1;for(let e in this.buckets){let t=this.buckets[e];if(t instanceof ME){if(this.hasSymbolBuckets=!0,!i)break;t.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(let e in this.buckets){let t=this.buckets[e];if(t instanceof ME&&t.hasRTLText){this.hasRTLText=!0,HT().lazyLoad();break}}this.queryPadding=0;for(let e in this.buckets){let i=this.buckets[e];this.queryPadding=Math.max(this.queryPadding,t.style.getLayer(e).queryRadius(i))}e.imageAtlas&&(this.imageAtlas=e.imageAtlas),e.glyphAtlasImage&&(this.glyphAtlasImage=e.glyphAtlasImage),this.dashPositions=e.dashPositions}else this.collisionBoxArray=new KA;else this.state="loaded"}unloadVectorData(){for(let e in this.buckets)this.buckets[e].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.imageAtlas=null,this.dashPositions=null,this.latestFeatureIndex=null,this.state="unloaded"}getBucket(e){return this.buckets[e.id]}upload(e){for(let t in this.buckets){let i=this.buckets[t];i.uploadPending()&&i.upload(e)}let t=e.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new iy(e,this.imageAtlas.image,t.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&=(this.glyphAtlasTexture=new iy(e,this.glyphAtlasImage,t.ALPHA),null)}prepare(e){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(e,this.imageAtlasTexture)}queryRenderedFeatures(e,t,i,n,a,r,s,o,l,c,u){return this.latestFeatureIndex?.rawTileData?this.latestFeatureIndex.query({queryGeometry:n,cameraQueryGeometry:a,scale:r,tileSize:this.tileSize,pixelPosMatrix:c,transform:o,params:s,queryPadding:this.queryPadding*l,getElevation:u},e,t,i):{}}querySourceFeatures(e,t){let i=this.latestFeatureIndex;if(!i?.rawTileData)return;let n=i.loadVTLayers(),a=t?.sourceLayer?t.sourceLayer:"",r=n._geojsonTileLayer||n[a];if(!r)return;let s=Og(t?.filter,`querySourceFeatures[${a}].filter`,t?.globalState),{z:o,x:l,y:c}=this.tileID.canonical,u={z:o,x:l,y:c};for(let t=0;t<r.length;t++){let n=r.feature(t);if(s.needGeometry){let e=cv(n,!0);if(!s.filter(new Zf(this.tileID.overscaledZ),e,this.tileID.canonical))continue}else if(!s.filter(new Zf(this.tileID.overscaledZ),n))continue;let h=i.getId(n,a),d=new JE(n,o,l,c,h);d.tile=u,e.push(d)}}hasData(){return"loaded"===this.state||"reloading"===this.state||"expired"===this.state}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(e){let t=this.expirationTime;if(e.cacheControl){let t=function(e){let t={};if(e.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(e,i,n,a)=>{let r=n||a;return t[i]=!r||r.toLowerCase(),""}),t["max-age"]){let e=parseInt(t["max-age"],10);isNaN(e)?delete t["max-age"]:t["max-age"]=e}return t}(e.cacheControl);t["max-age"]&&(this.expirationTime=Date.now()+1e3*t["max-age"])}else e.expires&&(this.expirationTime=new Date(e.expires).getTime());if(this.expirationTime){let e=Date.now(),i=!1;if(this.expirationTime>e)i=!1;else if(t)if(this.expirationTime<t)i=!0;else{let n=this.expirationTime-t;n?this.expirationTime=e+Math.max(n,3e4):i=!0}else i=!0;i?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-(new Date).getTime(),2**31-1)}setFeatureState(e,t,i){if(!this.latestFeatureIndex?.rawTileData||0===Object.keys(e).length||this.featureStateRevision===i)return;this.featureStateRevision=i;let n=this.latestFeatureIndex.loadVTLayers();for(let i in this.buckets){if(!t.style.hasLayer(i))continue;let a=this.buckets[i],r=a.layers[0].sourceLayer||"_geojsonTileLayer",s=n[r],o=e[r];if(!s||!o||0===o.length)continue;a.update(o,s,this.imageAtlas?.patternPositions||{},this.dashPositions||{});let l=t?.style?.getLayer(i);l&&(this.queryPadding=Math.max(this.queryPadding,l.queryRadius(a)))}}holdingForSymbolFade(){return void 0!==this.symbolFadeHoldUntil}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<tC()}clearSymbolFadeHold(){this.symbolFadeHoldUntil=void 0}setSymbolHoldDuration(e){this.symbolFadeHoldUntil=tC()+e}setDependencies(e,t){let i={};for(let e of t)i[e]=!0;this.dependencies[e]=i}hasDependency(e,t){for(let i of e){let e=this.dependencies[i];if(e)for(let i of t)if(e[i])return!0}return!1}};function ZT(e){let t=[];for(let i in e)t.push({id:i,state:e[i]});return t}var KT=class{constructor(){this.state={},this.stateChanges={},this.deletedStates={},this.revision=0}updateState(e,t,i){let n=String(t);if(this.stateChanges[e]||={},this.stateChanges[e][n]||={},lh(this.stateChanges[e][n],i),null===this.deletedStates[e]){this.deletedStates[e]={};for(let t in this.state[e])if(t===n){this.deletedStates[e][n]={};for(let a in this.state[e][t])void 0===i[a]&&(this.deletedStates[e][n][a]=null)}else this.deletedStates[e][t]=null}else if(null===this.deletedStates[e]?.[n]){this.deletedStates[e][n]={};for(let t in this.state[e][n])void 0===i[t]&&(this.deletedStates[e][n][t]=null)}else for(let t in i)null===this.deletedStates[e]?.[n]?.[t]&&delete this.deletedStates[e][n][t]}removeFeatureState(e,t,i){if(null===this.deletedStates[e])return;let n=String(t);if(this.deletedStates[e]||={},i&&void 0!==t)null!==this.deletedStates[e][n]&&(this.deletedStates[e][n]||={},this.deletedStates[e][n][i]=null);else if(void 0!==t)if(this.stateChanges[e]?.[n])for(i in this.deletedStates[e][n]={},this.stateChanges[e][n])this.deletedStates[e][n][i]=null;else this.deletedStates[e][n]=null;else this.deletedStates[e]=null}getState(e,t){let i=String(t),n=this.state[e]||{},a=this.stateChanges[e]||{},r=lh({},n[i],a[i]);if(null===this.deletedStates[e])return{};if(this.deletedStates[e]){let i=this.deletedStates[e][t];if(null===i)return{};for(let e in i)delete r[e]}return r}initializeTileState(e,t){let i={};for(let e in this.state)i[e]=ZT(this.state[e]);e.setFeatureState(i,t,this.revision)}coalesceChanges(e,t){let i={};for(let e in this.stateChanges){this.state[e]||={},i[e]||={};for(let t in this.stateChanges[e])this.state[e][t]||={},lh(this.state[e][t],this.stateChanges[e][t]),i[e][t]=this.state[e][t]}for(let e in this.deletedStates)if(this.state[e]||={},i[e]||={},null===this.deletedStates[e])for(let t in this.state[e])this.state[e][t]={},i[e][t]={};else for(let t in this.deletedStates[e]){if(null===this.deletedStates[e][t])this.state[e][t]={};else for(let i of Object.keys(this.deletedStates[e][t]))delete this.state[e][t][i];i[e][t]=this.state[e][t]}if(this.stateChanges={},this.deletedStates={},0===Object.keys(i).length)return;this.revision++;let n={};for(let e in i)n[e]=ZT(i[e]);e.setFeatureState(n,t,this.revision)}},XT=class e{constructor(e,t){this.min=e,this.max=t,this.center=fu([],mu([],this.min,this.max),.5)}quadrant(t){let i=[t%2==0,t<2],n=hu(this.min),a=hu(this.max);for(let e=0;e<i.length;e++)n[e]=i[e]?this.min[e]:this.center[e],a[e]=i[e]?this.center[e]:this.max[e];return a[2]=this.max[2],new e(n,a)}distanceX(e){return Math.max(Math.min(this.max[0],e[0]),this.min[0])-e[0]}distanceY(e){return Math.max(Math.min(this.max[1],e[1]),this.min[1])-e[1]}intersectsFrustum(e){let t=!0;for(let i of e.planes){let e=this.intersectsPlane(i);if(0===e)return 0;1===e&&(t=!1)}return t?2:e.aabb.min[0]>this.max[0]||e.aabb.min[1]>this.max[1]||e.aabb.min[2]>this.max[2]||e.aabb.max[0]<this.min[0]||e.aabb.max[1]<this.min[1]||e.aabb.max[2]<this.min[2]?0:1}intersectsPlane(e){let t=e[3],i=e[3];for(let n=0;n<3;n++)e[n]>0?(t+=e[n]*this.min[n],i+=e[n]*this.max[n]):(i+=e[n]*this.min[n],t+=e[n]*this.max[n]);return t>=0?2:i<0?0:1}},QT=class e{constructor(e,t,i){this.points=e,this.planes=t,this.aabb=i}static fromInvProjectionMatrix(t,i=1,n=0,a,r){let s=r?[[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]],o=2**n,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(e=>function(e,t,i,n){let a=Mu([],e,t),r=1/a[3]/i*n;return Cu(a,a,[r,r,1/a[3],r])}(e,t,i,o));a&&function(e,t,i,n){let a=n?4:0,r=n?0:4,s=0,o=[],l=[];for(let t=0;t<4;t++){let i=ku([],e[t+r],e[t+a]),n=du(i);fu(i,i,1/n),o.push(n),l.push(i)}for(let t=0;t<4;t++){let n=Qu(e[t+a],l[t],i);s=null!==n&&n>=0?Math.max(s,n):Math.max(s,o[t])}let c=function(e,t){let i=ku([],e[t[0]],e[t[1]]),n=ku([],e[t[2]],e[t[1]]),a=[0,0,0,0];return _u(a,yu([],i,n)),a[3]=-vu(a,e[t[0]]),a}(e,t),u=function(e,t){let i=Su(e),n=function(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e[3]=t[3]*i,e}([],e,1/i),a=ku([],t,fu([],n,vu(t,n))),r=Su(a);if(r>0){let e=Math.sqrt(1-n[3]*n[3]);return Ku(t,mu([],fu([],n,-n[3]),fu([],a,e/r)))}return null}(i,c);if(null!==u){let e=u/vu(l[0],c);s=Math.min(s,e)}for(let t=0;t<4;t++){let i=Math.min(s,o[t]);e[t+r]=[e[t+a][0]+l[t][0]*i,e[t+a][1]+l[t][1]*i,e[t+a][2]+l[t][2]*i,1]}}(l,s[0],a,r);let c=s.map(e=>{let t=_u([],yu([],ku([],l[e[0]],l[e[1]]),ku([],l[e[2]],l[e[1]]))),i=-vu(t,l[e[1]]);return t.concat(i)}),u=[1/0,1/0,1/0],h=[-1/0,-1/0,-1/0];for(let e of l)for(let t=0;t<3;t++)u[t]=Math.min(u[t],e[t]),h[t]=Math.max(h[t],e[t]);return new e(l,c,new XT(u,h))}};function YT(e,t,i){let n=t.intersectsFrustum(e);if(!i||0===n)return n;let a=t.intersectsPlane(i);return 0===a?0:2===n&&2===a?2:1}function JT(e,t,i){let n=0,a=(i-t)/10;for(let r=0;r<10;r++){let s=t+(r+.5)/10*(i-t);n+=a*Math.cos(s)**+e}return n}function $T(e,t){return function(i,n,a,r,s){let o=2*((e-1)/ph(Math.cos(Mh(zx-s))/Math.cos(Mh(zx)))-1),l=Math.acos(a/r),c=2*JT(o-1,0,Mh(s/2)),u=Math.min(Mh(zx),l+Mh(s/2)),h=JT(o-1,Math.min(u,l-Mh(s/2)),u),d=Math.atan(n/a),p=i;return p+=ph(r/Math.hypot(n,a)/Math.max(.5,Math.cos(Mh(s/2)))),p+=o*ph(Math.cos(d))/2,p-=ph(Math.max(1,h/c/t))/2,p}}const eD=$T(9.314,3);function tD(e,t){let i=(t.roundZoom?Math.round:Math.floor)(e.zoom+ph(e.tileSize/t.tileSize));return Math.max(0,i)}function iD(e,t){let i=e.getCameraFrustum(),n=e.getClippingPlane();if(n&&t.maxContentElevation>0){let a=Math.hypot(n[0],n[1],n[2]);if(a>0){let r=1+t.maxContentElevation/wx,s=sh(-n[3]/a,-1,1),o=Math.cos(Math.acos(s)+Math.acos(1/r));n=[n[0],n[1],n[2],-o*a],i=function(e,t,i){let n=e.planes[1],a=e.points.map(e=>{let a=n[0]*e[0]+n[1]*e[1]+n[2]*e[2]+n[3];if(Math.abs(a)>1e-6)return e;let r=[e[0]-i[0],e[1]-i[1],e[2]-i[2]],s=n[0]*r[0]+n[1]*r[1]+n[2]*r[2];if(s>=-1e-9)return e;let o=t/-s;return[e[0]+r[0]*o,e[1]+r[1]*o,e[2]+r[2]*o,e[3]]}),r=e.planes.map((e,i)=>1===i?[e[0],e[1],e[2],e[3]+t]:e),s=[1/0,1/0,1/0],o=[-1/0,-1/0,-1/0];for(let e of a)for(let t=0;t<3;t++)s[t]=Math.min(s[t],e[t]),o[t]=Math.max(o[t],e[t]);return new QT(a,r,new XT(s,o))}(i,Math.sqrt(r*r-1),e.cameraPosition)}}let a=function(e){let t=Tx(1,e.center.lat)*e.worldSize;return Nx(e.center,e.elevation,e.pitch,e.bearing,e.cameraToCenterDistance/t)}(e),r=Fx.fromLngLat(e.center,e.elevation),s=function(e,t){let i=sh((15-(zx-e.pitch-e.fov/2))/15,0,1),n=Math.max(500,t??0);return e.elevation+i*n}(e,t.maxContentElevation),o=e.getCoveringTilesDetailsProvider(),l=o.allowVariableZoom(e,t),c=tD(e,t),u=t.minzoom||0,h=void 0===t.maxzoom?e.maxZoom:t.maxzoom,d=Math.min(Math.max(0,c),h),p=2**d,m=[p*a.x,p*a.y,0],g=[p*r.x,p*r.y,0],f=Math.hypot(r.x-a.x,r.y-a.y),A=Math.abs(r.z-a.z),_=Math.hypot(f,A),v=e=>({zoom:0,x:0,y:0,wrap:e,fullyVisible:!1}),y=[],x=[];if(e.renderWorldCopies&&o.allowWorldCopies())for(let e=1;e<=3;e++)y.push(v(-e)),y.push(v(e));for(y.push(v(0));y.length>0;){let p=y.pop(),f=p.x,v=p.y,b=p.fullyVisible,w={x:f,y:v,z:p.zoom},E=o.getTileBoundingVolume(w,p.wrap,s,t);if(!b){let e=YT(i,E,n);if(0===e)continue;b=2===e}let k=o.distanceToTile2d(a.x,a.y,w,E),S=c;l&&(S=(t.calculateTileZoom||eD)(e.zoom+ph(e.tileSize/t.tileSize),k,A,_,e.fov)),S=(t.roundZoom?Math.round:Math.floor)(S),S=Math.max(0,S);let M=Math.min(S,h);if(p.wrap=o.getWrap(r,w,p.wrap),p.zoom>=M){if(p.zoom<u)continue;let e=d-p.zoom,i=m[0]-.5-(f<<e),n=m[1]-.5-(v<<e),a=t.reparseOverscaled?Math.max(p.zoom,S):p.zoom;x.push({tileID:new HE(p.zoom===h?a:p.zoom,p.wrap,p.zoom,f,v),distanceSq:Ou([g[0]-.5-f,g[1]-.5-v]),tileDistanceToCamera:Math.sqrt(i*i+n*n)});continue}for(let e=0;e<4;e++){let t=(f<<1)+e%2,i=(v<<1)+(e>>1),n=p.zoom+1;y.push({zoom:n,x:t,y:i,wrap:p.wrap,fullyVisible:b})}}return x.sort((e,t)=>e.distanceSq-t.distanceSq).map(e=>e.tileID)}function nD(e){return"raster"===e||"image"===e||"video"===e}function aD(e,t,i,n,a,r,s){let o=tC(),l=function(e){if(!e.length)return new Set;let t=Math.max(...e.map(e=>e.canonical.z)),i=1/0,n=-1/0,a=1/0,r=-1/0,s=[];for(let o of e){let{x:e,y:l,z:c}=o.canonical,u=2**(t-c),h=e*u,d=l*u;s.push({id:o,x:h,y:d}),h<i&&(i=h),h>n&&(n=h),d<a&&(a=d),d>r&&(r=d)}let o=new Set;for(let e of s)(e.x===i||e.x===n||e.y===a||e.y===r)&&o.add(e.id);return o}(t);for(let c of t){let t=e.getTileById(c.key);(0===t.fadingDirection||0===t.fadeOpacity)&&t.resetFadeLogic(),!rD(e,t,i,o,n,a,s)&&(sD(e,t,i,o,r,s)||lD(t,l,o,s)||t.resetFadeLogic())}}function rD(e,t,i,n,a,r,s){if(!t.hasData())return!1;let{tileID:o,fadingRole:l,fadingDirection:c,fadingParentID:u}=t;if(0===l&&1===c&&u)return i[u.key]=u,!0;let h=Math.max(o.overscaledZ-a,r);for(let a=o.overscaledZ-1;a>=h;a--){let r=o.scaledTo(a),l=e.getLoadedTile(r);if(l)return t.setCrossFadeLogic({fadingRole:0,fadingDirection:1,fadingParentID:l.tileID,fadeEndTime:n+s}),l.setCrossFadeLogic({fadingRole:1,fadingDirection:0,fadeEndTime:n+s}),i[r.key]=r,!0}return!1}function sD(e,t,i,n,a,r){if(!t.hasData())return!1;let s=t.tileID.children(a),o=oD(e,t,s,i,n,a,r);if(o)return!0;for(let l of s)oD(e,t,l.children(a),i,n,a,r)&&(o=!0);return o}function oD(e,t,i,n,a,r,s){if(i[0].overscaledZ>=r)return!1;let o=!1;for(let r of i){let i=e.getLoadedTile(r);if(!i)continue;let{fadingRole:l,fadingDirection:c,fadingParentID:u}=i;(0!==l||0!==c||!u)&&(i.setCrossFadeLogic({fadingRole:0,fadingDirection:0,fadingParentID:t.tileID,fadeEndTime:a+s}),t.setCrossFadeLogic({fadingRole:1,fadingDirection:1,fadeEndTime:a+s})),n[r.key]=r,o=!0}return o}function lD(e,t,i,n){let a=e.tileID;if(e.selfFading)return!0;if(e.hasData())return!1;if(t.has(a)){let t=i+n;return e.setSelfFadeLogic(t),!0}return!1}function cD(e,t){e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0,e.needsColorReliefPrepare=!0;let i=t.tileID.canonical.x-e.tileID.canonical.x,n=t.tileID.canonical.y-e.tileID.canonical.y,a=2**e.tileID.canonical.z,r=t.tileID.key;(0!==i||0!==n)&&(Math.abs(n)>1||(Math.abs(i)>1&&(1===Math.abs(i+a)?i+=a:1===Math.abs(i-a)&&(i-=a)),t.dem&&e.dem&&(e.dem.backfillBorder(t.dem,i,n),e.neighboringTiles?.[r]&&(e.neighboringTiles[r].backfilled=!0))))}var uD=class{constructor(){this._tiles={}}handleWrapJump(e){let t={};for(let i in this._tiles){let n=this._tiles[i];n.tileID=n.tileID.unwrapTo(n.tileID.wrap+e),t[n.tileID.key]=n}this._tiles=t}setFeatureState(e,t,i){for(let n in this._tiles)this._tiles[n].setFeatureState(e,t,i)}getAllTiles(){return Object.values(this._tiles)}getAllIds(e=!1){return e?Object.values(this._tiles).map(e=>e.tileID).sort(XE).map(e=>e.key):Object.keys(this._tiles)}getTileById(e){return this._tiles[e]}setTile(e,t){this._tiles[e]=t}deleteTileById(e){delete this._tiles[e]}getLoadedTile(e){let t=this.getTileById(e.key);return t?.hasData()?t:null}isIdRenderable(e,t=!1){return this.getTileById(e)?.isRenderable(t)}getRenderableIds(e=0,t){let i=[];for(let e of this.getAllIds())this.isIdRenderable(e,t)&&i.push(this.getTileById(e));return t?i.sort((t,i)=>{let n=t.tileID,a=i.tileID,r=new Hc(n.canonical.x,n.canonical.y)._rotate(-e),s=new Hc(a.canonical.x,a.canonical.y)._rotate(-e);return n.overscaledZ-a.overscaledZ||s.y-r.y||s.x-r.x}).map(e=>e.tileID.key):i.map(e=>e.tileID).sort(XE).map(e=>e.key)}},hD=class e extends id{static{this.maxUnderzooming=10}static{this.maxOverzooming=3}constructor(e,t,i){super(),this._maxContentElevationSeen=0,this.id=e,this.dispatcher=i,this.on("data",e=>{this._dataHandler(e)}),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((e,t,i,n)=>{let a=new(jT(t.type))(e,t,i,n);if(a.id!==e)throw Error(`Expected Source id to be ${e} instead of ${a.id}`);return a})(e,t,i,this),this._inViewTiles=new uD,this._outOfViewCache=new KM(0,e=>this._unloadTile(e)),this._timers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._rasterFadeDuration=0,this._maxFadingAncestorLevels=5,this._state=new KT,this._didEmitContent=!1,this._updated=!1}onAdd(e){this.map=e,this._maxTileCacheSize=e?e._maxTileCacheSize:null,this._maxTileCacheZoomLevels=e?e._maxTileCacheZoomLevels:null,this._source?.onAdd&&this._source.onAdd(e)}onRemove(e){for(let e of this._inViewTiles.getAllTiles())e.unloadVectorData();this.clearTiles(),this._source?.onRemove&&this._source.onRemove(e),this._inViewTiles=new uD}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!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(let e of this._inViewTiles.getAllTiles())if("loaded"!==e.state&&"errored"!==e.state)return!1;return!0}getSource(){return this._source}getState(){return this._state}pause(){this._paused=!0}resume(){if(!this._paused)return;let e=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,e&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}async _loadTile(e,t,i,n){try{let a=await this._source.loadTile(e);this._tileLoaded(e,t,i,n,a)}catch(t){e.state="errored",404===t.status?this.update(this.transform,this.terrain):this._source.fire(new td(ju(t),{tile:e}))}}_unloadTile(e){this._source.unloadTile&&this._source.unloadTile(e)}_abortTile(e){this._source.abortTile&&this._source.abortTile(e),this._source.fire(new cC("dataabort",{tile:e,coord:e.tileID}))}serialize(){return this._source.serialize()}prepare(e){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._inViewTiles,this.map?this.map.painter:null);for(let t of this._inViewTiles.getAllTiles())t.upload(e),t.prepare(this.map.style.imageManager)}getIds(){return this._inViewTiles.getAllIds(!0)}getRenderableIds(e){return this._inViewTiles.getRenderableIds(this.transform?.bearingInRadians,e)}hasRenderableParent(e){let t=e.overscaledZ-1;if(t>=this._source.minzoom){let i=this.getLoadedTile(e.scaledTo(t));if(i)return this._inViewTiles.isIdRenderable(i.tileID.key)}return!1}reload(e,t=void 0){if(this._paused)this._shouldReloadOnResume=!0;else{this._outOfViewCache.reset();for(let i of this._inViewTiles.getAllIds()){let n=this._inViewTiles.getTileById(i);(!t||this._source.shouldReloadTile(n,t))&&(e?this._reloadTile(i,"errored"===n.state?"loading":"expired"):"errored"!==n.state&&this._reloadTile(i,"reloading"))}}}async _reloadTile(e,t){let i=this._inViewTiles.getTileById(e);if(!i)return;let n=i.hasData();"loading"!==i.state&&(i.state=t),await this._loadTile(i,e,t,n)}_tileLoaded(e,t,i,n,a){n||(e.timeAdded=tC(),e.selfFading&&(e.fadeEndTime=e.timeAdded+this._rasterFadeDuration)),"expired"===i&&(e.refreshedUponExpiration=!0),this._setTileReloadTimer(t,e),!a?.unmodified&&("raster-dem"===this.getSource().type&&e.dem&&function(e,t){let i=t.getRenderableIds();for(let n of i){if(!e.neighboringTiles?.[n])continue;let i=t.getTileById(n);e.neighboringTiles[n].backfilled||cD(e,i),!i.neighboringTiles?.[e.tileID.key]?.backfilled&&cD(i,e)}}(e,this._inViewTiles),e.featureStateRevision=-1,this._state.initializeTileState(e,this.map?this.map.painter:null),e.aborted||this._source.fire(new cC("data",{tile:e,coord:e.tileID})))}getTile(e){return this.getTileByID(e.key)}getTileByID(e){return this._inViewTiles.getTileById(e)}_retainLoadedChildren(t,i){let n=this._getLoadedDescendents(i),a=new Set;for(let r of i){let i=n[r.key];if(!i?.length){a.add(r);continue}let s=r.overscaledZ+e.maxOverzooming,o=i.filter(e=>e.tileID.overscaledZ<=s);if(!o.length){a.add(r);continue}let l=Math.min(...o.map(e=>e.tileID.overscaledZ)),c=o.filter(e=>e.tileID.overscaledZ===l).map(e=>e.tileID);for(let e of c)t[e.key]=e;this._areDescendentsComplete(c,l,r.overscaledZ)||a.add(r)}return a}_getLoadedDescendents(e){let t={};for(let i of this._inViewTiles.getAllTiles().filter(e=>e.hasData()))for(let n of e)i.tileID.isChildOf(n)&&(t[n.key]||=[],t[n.key].push(i));return t}_areDescendentsComplete(e,t,i){return 1===e.length&&e[0].isOverscaled()?e[0].overscaledZ===t:4**(t-i)===e.length}getLoadedTile(e){return this._inViewTiles.getLoadedTile(e)}updateCacheSize(e){let t=(Math.ceil(e.width/this._source.tileSize)+1)*(Math.ceil(e.height/this._source.tileSize)+1),i=null===this._maxTileCacheZoomLevels?Vh.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels,n=Math.floor(t*i),a="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,n):n;this._outOfViewCache.setMaxSize(a)}handleWrapJump(e){let t=(e-(void 0===this._prevLng?e:this._prevLng))/360,i=Math.round(t);this._prevLng=e,i&&(this._inViewTiles.handleWrapJump(i),this._resetTileReloadTimers())}_updateMaxContentElevation(){let e=this._maxContentElevationSeen,t=this.map?.style?._layers;if(!t)return e;let i=this._inViewTiles.getAllTiles();for(let n in t){let a=t[n];if("symbol"!==a.type||a.source!==this.id||a.isHidden(this.transform.zoom))continue;let r=a;if(r.layout){e=Math.max(e,r.layout.get("symbol-height-offset").constantOr(0));for(let t of i){let i=t.getBucket(a);i&&i.maxHeightOffset>e&&(e=i.maxHeightOffset)}}}return this._maxContentElevationSeen=e,e}update(e,t){if(!this._sourceLoaded||this._paused)return;let i;this.transform=e,this.terrain=t,this.updateCacheSize(e),this.handleWrapJump(this.transform.center.lng),this.used||this.usedForTerrain?this._source.tileID?i=e.getVisibleUnwrappedCoordinates(this._source.tileID).map(e=>new HE(e.canonical.z,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y)):(i=iD(e,{tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:"vector"===this._source.type&&void 0!==this.map._zoomLevelsToOverscale?Math.max(this._source.maxzoom,e.maxZoom-this.map._zoomLevelsToOverscale):this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:t,calculateTileZoom:this._source.calculateTileZoom,maxContentElevation:this._updateMaxContentElevation()}),this._source.hasTile&&(i=i.filter(e=>this._source.hasTile(e)))):i=[],this.usedForTerrain&&(i=this._addTerrainIdealTiles(i));let n=0===i.length&&!this._updated&&this._didEmitContent;this._updated=!0,n&&this.fire(new cC("data",{sourceDataType:"idle",sourceId:this.id}));let a=tD(e,this._source),r=this._updateRetainedTiles(i,a),s=nD(this._source.type);s&&this._rasterFadeDuration>0&&!t&&aD(this._inViewTiles,i,r,this._maxFadingAncestorLevels,this._source.minzoom,this._source.maxzoom,this._rasterFadeDuration),s?this._cleanUpRasterTiles(r):this._cleanUpVectorTiles(r)}_cleanUpRasterTiles(e){for(let t of this._inViewTiles.getAllIds())e[t]||this._removeTile(t)}_cleanUpVectorTiles(e){for(let t of this._inViewTiles.getAllIds()){let i=this._inViewTiles.getTileById(t);e[t]?i.clearSymbolFadeHold():i.hasSymbolBuckets?i.holdingForSymbolFade()?i.symbolFadeFinished()&&this._removeTile(t):i.setSymbolHoldDuration(this.map._fadeDuration):this._removeTile(t)}}_addTerrainIdealTiles(e){let t=[];for(let i of e)if(i.canonical.z>this._source.minzoom){let e=i.scaledTo(i.canonical.z-1);t.push(e);let n=i.scaledTo(Math.max(this._source.minzoom,Math.min(i.canonical.z,5)));t.push(n)}return e.concat(t)}releaseSymbolFadeTiles(){for(let e of this._inViewTiles.getAllIds())this._inViewTiles.getTileById(e).holdingForSymbolFade()&&this._removeTile(e)}_updateRetainedTiles(t,i){let n=new Set;for(let e of t)this._addTile(e).hasData()||n.add(e);let a=t.reduce((e,t)=>(e[t.key]=t,e),{}),r=this._retainLoadedChildren(a,n),s={},o=Math.max(i-e.maxUnderzooming,this._source.minzoom);for(let e of r){let t=this._inViewTiles.getTileById(e.key),i=t?.wasRequested();for(let n=e.overscaledZ-1;n>=o;--n){let r=e.scaledTo(n);if(s[r.key])break;if(s[r.key]=!0,t=this.getTile(r),!t&&i&&(t=this._addTile(r)),t){let e=t.hasData();if((e||!this.map?.cancelPendingTileRequestsWhileZooming||i)&&(a[r.key]=r),i=t.wasRequested(),e)break}}}return a}_addTile(e){let t=this._inViewTiles.getTileById(e.key);if(t)return t;t=this._outOfViewCache.getAndRemove(e),t&&(t.resetFadeLogic(),this._setTileReloadTimer(e.key,t),t.tileID=e,this._state.initializeTileState(t,this.map?this.map.painter:null));let i=t;return t||(t=new WT(e,this._source.tileSize*e.overscaleFactor()),this._loadTile(t,e.key,t.state,!1)),t.uses++,this._inViewTiles.setTile(e.key,t),i||this._source.fire(new cC("dataloading",{tile:t,coord:t.tileID})),t}_setTileReloadTimer(e,t){this._clearTileReloadTimer(e);let i=t.getExpiryTimeout();if(i){let t=()=>{this._reloadTile(e,"expired"),delete this._timers[e]};this._timers[e]=setTimeout(t,i)}}_clearTileReloadTimer(e){let t=this._timers[e];t&&(clearTimeout(t),delete this._timers[e])}_resetTileReloadTimers(){for(let e in this._timers)clearTimeout(this._timers[e]),delete this._timers[e];for(let e of this._inViewTiles.getAllIds()){let t=this._inViewTiles.getTileById(e);this._setTileReloadTimer(e,t)}}refreshTiles(e){for(let t of this._inViewTiles.getAllIds()){let i=this._inViewTiles.getTileById(t);(this._inViewTiles.isIdRenderable(t)||"errored"==i.state)&&e.some(e=>e.equals(i.tileID.canonical))&&this._reloadTile(t,"expired")}}_removeTile(e){let t=this._inViewTiles.getTileById(e);t&&(t.uses--,this._inViewTiles.deleteTileById(e),this._clearTileReloadTimer(e),!(t.uses>0)&&(t.hasData()&&"reloading"!==t.state?this._outOfViewCache.add(t.tileID,t,t.getExpiryTimeout()):(t.aborted=!0,this._abortTile(t),this._unloadTile(t))))}_dataHandler(e){if("source"===e.dataType){if("metadata"===e.sourceDataType)return void(this._sourceLoaded=!0);"content"===e.sourceDataType&&this._sourceLoaded&&!this._paused&&(this.reload(e.sourceDataChanged,e.shouldReloadTileOptions),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}}resetMaxContentElevation(){this._maxContentElevationSeen=0}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1,this.resetMaxContentElevation();for(let e of this._inViewTiles.getAllIds())this._removeTile(e);this._outOfViewCache.reset()}tilesIn(e,t,i){let n=[],a=this.transform;if(!a)return n;let r=a.getCoveringTilesDetailsProvider().allowWorldCopies(),s=i?a.getCameraQueryGeometry(e):e,o=e=>a.screenPointToMercatorCoordinate(e,this.terrain),l=this.transformBbox(e,o,!r),c=this.transformBbox(s,o,!r),u=this.getIds(),h=px.fromPoints(c);for(let e of u){let i=this._inViewTiles.getTileById(e);if(i.holdingForSymbolFade())continue;let s=r?[i.tileID]:[i.tileID.unwrapTo(-1),i.tileID.unwrapTo(0)],o=2**(a.zoom-i.tileID.overscaledZ),u=t*i.queryPadding*Uu/i.tileSize/o;for(let e of s){let t=h.map(t=>e.getTilePoint(new Fx(t.x,t.y)));if(t.expandBy(u),t.intersects(mx)){let t=l.map(t=>e.getTilePoint(t)),a=c.map(t=>e.getTilePoint(t));n.push({tile:i,tileID:r?e:e.unwrapTo(0),queryGeometry:t,cameraQueryGeometry:a,scale:o})}}}return n}transformBbox(e,t,i){let n=e.map(t);if(i){let i=px.fromPoints(e);i.shrinkBy(.001*Math.min(i.width(),i.height()));let a=i.map(t);px.fromPoints(n).covers(a)||(n=n.map(e=>e.x>.5?new Fx(e.x-1,e.y,e.z):e))}return n}getVisibleCoordinates(e){let t=this.getRenderableIds(e).map(e=>this._inViewTiles.getTileById(e).tileID);return this.transform&&this.transform.populateCache(t),t}hasTransition(){return!!this._source.hasTransition()||nD(this._source.type)&&function(e,t){if(t<=0)return!1;let i=tC();for(let t of e.getAllTiles())if(t.fadeEndTime>=i)return!0;return!1}(this._inViewTiles,this._rasterFadeDuration)}setRasterFadeDuration(e){this._rasterFadeDuration=e}setFeatureState(e,t,i){e||=QE,this._state.updateState(e,t,i)}removeFeatureState(e,t,i){e||=QE,this._state.removeFeatureState(e,t,i)}getFeatureState(e,t){return e||=QE,this._state.getState(e,t)}setDependencies(e,t,i){let n=this._inViewTiles.getTileById(e);n&&n.setDependencies(t,i)}reloadTilesForDependencies(e,t){for(let i of this._inViewTiles.getAllIds())this._inViewTiles.getTileById(i).hasDependency(e,t)&&this._reloadTile(i,"reloading");this._outOfViewCache.filter(i=>!i.hasDependency(e,t))}areTilesLoaded(){for(let e of this._inViewTiles.getAllTiles())if("loaded"!==e.state&&"errored"!==e.state)return!1;return!0}},dD=class{constructor(e,t){this.reset(e,t)}reset(e,t){this.points=e||[],this._distances=[0];for(let e=1;e<this.points.length;e++)this._distances[e]=this._distances[e-1]+this.points[e].dist(this.points[e-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(t||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(e){if(1===this.points.length)return this.points[0];e=sh(e,0,1);let t=1,i=this._distances[t],n=e*this.paddedLength+this.padding;for(;i<n&&t<this._distances.length;)i=this._distances[++t];let a=t-1,r=this._distances[a],s=i-r,o=s>0?(n-r)/s:0;return this.points[a].mult(1-o).add(this.points[t].mult(o))}};function pD(e,t,i,n,a){return a?e?e(t,i)+n:0===n?void 0:n:n}function mD(e,t){let i=!0;return"always"===e||("never"===e||"never"===t)&&(i=!1),i}var gD=class{constructor(e,t,i){let n=this.boxCells=[],a=this.circleCells=[];this.xCellCount=Math.ceil(e/i),this.yCellCount=Math.ceil(t/i);for(let e=0;e<this.xCellCount*this.yCellCount;e++)n.push([]),a.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=e,this.height=t,this.xScale=this.xCellCount/e,this.yScale=this.yCellCount/t,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(e,t,i,n,a){this._forEachCell(t,i,n,a,this._insertBoxCell,this.boxUid++),this.boxKeys.push(e),this.bboxes.push(t),this.bboxes.push(i),this.bboxes.push(n),this.bboxes.push(a)}insertCircle(e,t,i,n){this._forEachCell(t-n,i-n,t+n,i+n,this._insertCircleCell,this.circleUid++),this.circleKeys.push(e),this.circles.push(t),this.circles.push(i),this.circles.push(n)}_insertBoxCell(e,t,i,n,a,r){this.boxCells[a].push(r)}_insertCircleCell(e,t,i,n,a,r){this.circleCells[a].push(r)}_query(e,t,i,n,a,r,s){if(i<0||e>this.width||n<0||t>this.height)return[];let o=[];if(e<=0&&t<=0&&this.width<=i&&this.height<=n){if(a)return[{key:null,x1:e,y1:t,x2:i,y2:n}];for(let e=0;e<this.boxKeys.length;e++)o.push({key:this.boxKeys[e],x1:this.bboxes[4*e],y1:this.bboxes[4*e+1],x2:this.bboxes[4*e+2],y2:this.bboxes[4*e+3]});for(let e=0;e<this.circleKeys.length;e++){let t=this.circles[3*e],i=this.circles[3*e+1],n=this.circles[3*e+2];o.push({key:this.circleKeys[e],x1:t-n,y1:i-n,x2:t+n,y2:i+n})}}else{let l={hitTest:a,overlapMode:r,seenUids:{box:{},circle:{}}};this._forEachCell(e,t,i,n,this._queryCell,o,l,s)}return o}query(e,t,i,n){return this._query(e,t,i,n,!1,null)}hitTest(e,t,i,n,a,r){return this._query(e,t,i,n,!0,a,r).length>0}hitTestCircle(e,t,i,n,a){let r=e-i,s=e+i,o=t-i,l=t+i;if(s<0||r>this.width||l<0||o>this.height)return!1;let c=[],u={hitTest:!0,overlapMode:n,circle:{x:e,y:t,radius:i},seenUids:{box:{},circle:{}}};return this._forEachCell(r,o,s,l,this._queryCellCircle,c,u,a),c.length>0}_queryCell(e,t,i,n,a,r,s,o){let{seenUids:l,hitTest:c,overlapMode:u}=s,h=this.boxCells[a],d=1e-6;if(null!==h){let a=this.bboxes;for(let s of h)if(!l.box[s]){l.box[s]=!0;let h=4*s,p=this.boxKeys[s];if(e<=a[h+2]+d&&t<=a[h+3]+d&&i>=a[h+0]-d&&n>=a[h+1]-d&&(!o||o(p))&&(!c||!mD(u,p.overlapMode))&&(r.push({key:p,x1:a[h],y1:a[h+1],x2:a[h+2],y2:a[h+3]}),c))return!0}}let p=this.circleCells[a];if(null!==p){let a=this.circles;for(let s of p)if(!l.circle[s]){l.circle[s]=!0;let h=3*s,d=this.circleKeys[s];if(this._circleAndRectCollide(a[h],a[h+1],a[h+2],e,t,i,n)&&(!o||o(d))&&(!c||!mD(u,d.overlapMode))){let e=a[h],t=a[h+1],i=a[h+2];if(r.push({key:d,x1:e-i,y1:t-i,x2:e+i,y2:t+i}),c)return!0}}}return!1}_queryCellCircle(e,t,i,n,a,r,s,o){let{circle:l,seenUids:c,overlapMode:u}=s,h=this.boxCells[a];if(null!==h){let e=this.bboxes;for(let t of h)if(!c.box[t]){c.box[t]=!0;let i=4*t,n=this.boxKeys[t];if(this._circleAndRectCollide(l.x,l.y,l.radius,e[i+0],e[i+1],e[i+2],e[i+3])&&(!o||o(n))&&!mD(u,n.overlapMode))return r.push(!0),!0}}let d=this.circleCells[a];if(null!==d){let e=this.circles;for(let t of d)if(!c.circle[t]){c.circle[t]=!0;let i=3*t,n=this.circleKeys[t];if(this._circlesCollide(e[i],e[i+1],e[i+2],l.x,l.y,l.radius)&&(!o||o(n))&&!mD(u,n.overlapMode))return r.push(!0),!0}}}_forEachCell(e,t,i,n,a,r,s,o){let l=this._convertToXCellCoord(e),c=this._convertToYCellCoord(t),u=this._convertToXCellCoord(i),h=this._convertToYCellCoord(n);for(let d=l;d<=u;d++)for(let l=c;l<=h;l++){let c=this.xCellCount*l+d;if(a.call(this,e,t,i,n,c,r,s,o))return}}_convertToXCellCoord(e){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(e*this.xScale)))}_convertToYCellCoord(e){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(e*this.yScale)))}_circlesCollide(e,t,i,n,a,r){let s=n-e,o=a-t,l=i+r;return l*l>s*s+o*o}_circleAndRectCollide(e,t,i,n,a,r,s){let o=(r-n)/2,l=Math.abs(e-(n+o));if(l>o+i)return!1;let c=(s-a)/2,u=Math.abs(t-(a+c));if(u>c+i)return!1;if(l<=o||u<=c)return!0;let h=l-o,d=u-c;return h*h+d*d<=i*i}};function fD(e,t){let i=1/(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]),n=1/(t[8]*t[8]+t[9]*t[9]+t[10]*t[10]),a=t[0]*i,r=t[4]*i,s=t[8]*n,o=t[1]*i,l=t[5]*i,c=t[9]*n,u=t[2]*i,h=t[6]*i,d=t[10]*n;e[0]=a,e[1]=r,e[2]=s,e[4]=o,e[5]=l,e[6]=c,e[8]=u,e[9]=h,e[10]=d;let p=t[12],m=t[13],g=t[14];return e[12]=-a*p-o*m-u*g,e[13]=-r*p-l*m-h*g,e[14]=-s*p-c*m-d*g,e[3]=0,e[7]=0,e[11]=0,e[15]=1,e}const AD=Jc();function _D(e,t,i){let n=Jc();if(!e){let{vecSouth:e,vecEast:i}=yD(t),a=XM();a[0]=i[0],a[1]=i[1],a[2]=e[0],a[3]=e[1],function(e,t){var i=t[0],n=t[1],a=t[2],r=t[3],s=i*r-a*n;s&&(s=1/s,e[0]=r*s,e[1]=-n*s,e[2]=-a*s,e[3]=i*s)}(a,a),n[0]=a[0],n[1]=a[1],n[4]=a[2],n[5]=a[3]}return au(n,n,[1/i,1/i,1]),n}function vD(e,t,i,n){if(e){let e=Jc();if(!t){let{vecSouth:t,vecEast:n}=yD(i);e[0]=n[0],e[1]=n[1],e[4]=t[0],e[5]=t[1]}return au(e,e,[n,n,1]),e}return i.pixelsToClipSpaceMatrix}function yD(e){let t=Math.cos(e.rollInRadians),i=Math.sin(e.rollInRadians),n=Math.cos(e.pitchInRadians),a=Math.cos(e.bearingInRadians),r=Math.sin(e.bearingInRadians),s=Fu();s[0]=-a*n*i-r*t,s[1]=-r*n*i+a*t;let o=Lu(s);o<1e-9?Bu(s):Ru(s,s,1/o);let l=Fu();l[0]=a*n*t-r*i,l[1]=r*n*t+a*i;let c=Lu(l);return c<1e-9?Bu(l):Ru(l,l,1/c),{vecEast:l,vecSouth:s}}function xD(e,t,i){return pD(e.getElevation,t,i,e.heightOffset??0,e.heightAnchorGround??!0)}function bD(e,t,i,n){let a;null==n?(a=[e,t,0,1],UD(a,a,i)):(a=[e,t,n,1],Mu(a,a,i));let r=a[3];return{point:new Hc(a[0]/r,a[1]/r),signedDistanceFromCamera:r,isOccluded:!1}}function wD(e,t){return.5+e/t*.5}function ED(e,t){return e.x>=-t[0]&&e.x<=t[0]&&e.y>=-t[1]&&e.y<=t[1]}function kD(e,t,i,n,a,r,s,o,l,c,u,h,d){let p=i?e.textSizeData:e.iconSizeData,m=Hw(p,t.transform.zoom),g=[256/t.width*2+1,256/t.height*2+1],f=i?e.text.dynamicLayoutVertexArray:e.icon.dynamicLayoutVertexArray;f.clear();let A=e.lineVertexArray,_=i?e.text.placedSymbolArray:e.icon.placedSymbolArray,v=t.transform.width/t.transform.height,y=!1;for(let i=0;i<_.length;i++){let x=_.get(i);if(x.hidden||2===x.writingMode&&!y){OD(x.numGlyphs,f);continue}y=!1;let b=new Hc(x.anchorX,x.anchorY),w={getElevation:d,pitchedLabelPlaneMatrix:n,lineVertexArray:A,pitchWithMap:r,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:t.transform,tileAnchorPoint:b,unwrappedTileID:l,width:c,height:u,translation:h},E=FD(x.anchorX,x.anchorY,w);if(!ED(E.point,g)){OD(x.numGlyphs,f);continue}let k=E.signedDistanceFromCamera,S=wD(t.transform.cameraToCenterDistance,k),M=Gw(p,m,x),C=r?M*t.transform.getPitchedTextCorrection(x.anchorX,x.anchorY,l)/S:M*S,T=CD({projectionContext:w,pitchedLabelPlaneMatrixInverse:a,symbol:x,fontSize:C,flip:!1,keepUpright:s,glyphOffsetArray:e.glyphOffsetArray,dynamicLayoutVertexArray:f,aspectRatio:v,rotateToLine:o});y=T.useVertical,(T.notEnoughRoom||y||T.needsFlipping&&CD({projectionContext:w,pitchedLabelPlaneMatrixInverse:a,symbol:x,fontSize:C,flip:!0,keepUpright:s,glyphOffsetArray:e.glyphOffsetArray,dynamicLayoutVertexArray:f,aspectRatio:v,rotateToLine:o}).notEnoughRoom)&&OD(x.numGlyphs,f)}i?e.text.dynamicLayoutVertexBuffer.updateData(f):e.icon.dynamicLayoutVertexBuffer.updateData(f)}function SD(e,t,i,n,a,r,s,o){let l=r.glyphStartIndex+r.numGlyphs,c=r.lineStartIndex,u=r.lineStartIndex+r.lineLength,h=t.getoffsetX(r.glyphStartIndex),d=t.getoffsetX(l-1),p=LD(e*h,i,n,a,r.segment,c,u,o,s);if(!p)return null;let m=LD(e*d,i,n,a,r.segment,c,u,o,s);return!m||o.projectionCache.anyProjectionOccluded?null:{first:p,last:m}}function MD(e,t,i,n){return 1===e&&Math.abs(i.y-t.y)>Math.abs(i.x-t.x)*n?{useVertical:!0}:(2===e?t.y<i.y:t.x>i.x)?{needsFlipping:!0}:null}function CD(e){let t,{projectionContext:i,pitchedLabelPlaneMatrixInverse:n,symbol:a,fontSize:r,flip:s,keepUpright:o,glyphOffsetArray:l,dynamicLayoutVertexArray:c,aspectRatio:u,rotateToLine:h}=e,d=r/24,p=a.lineOffsetX*d,m=a.lineOffsetY*d;if(a.numGlyphs>1){let e=a.glyphStartIndex+a.numGlyphs,r=a.lineStartIndex,c=a.lineStartIndex+a.lineLength,g=SD(d,l,p,m,s,a,h,i);if(!g)return{notEnoughRoom:!0};let f=ID(g.first.point.x,g.first.point.y,i,n),A=ID(g.last.point.x,g.last.point.y,i,n);if(o&&!s){let e=MD(a.writingMode,f,A,u);if(e)return e}t=[g.first];for(let n=a.glyphStartIndex+1;n<e-1;n++){let e=LD(d*l.getoffsetX(n),p,m,s,a.segment,r,c,i,h);if(!e)return{notEnoughRoom:!0};t.push(e)}t.push(g.last)}else{if(o&&!s){let e=PD(i.tileAnchorPoint.x,i.tileAnchorPoint.y,i).point,t=a.lineStartIndex+a.segment+1,r=new Hc(i.lineVertexArray.getx(t),i.lineVertexArray.gety(t)),s=PD(r.x,r.y,i),o=s.signedDistanceFromCamera>0?s.point:TD(i.tileAnchorPoint,r,e,1,i),l=ID(e.x,e.y,i,n),c=ID(o.x,o.y,i,n),h=MD(a.writingMode,l,c,u);if(h)return h}let e=LD(d*l.getoffsetX(a.glyphStartIndex),p,m,s,a.segment,a.lineStartIndex,a.lineStartIndex+a.lineLength,i,h);if(!e||i.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};t=[e]}for(let e of t)wE(c,e.point,e.angle);return{}}function TD(e,t,i,n,a){let r=e.add(e.sub(t)._unit()),s=PD(r.x,r.y,a).point,o=i.sub(s);return i.add(o._mult(n/o.mag()))}function DD(e,t,i){let n=t.projectionCache;if(n.projections[e])return n.projections[e];let a=new Hc(t.lineVertexArray.getx(e),t.lineVertexArray.gety(e)),r=PD(a.x,a.y,t);if(r.signedDistanceFromCamera>0)return n.projections[e]=r.point,n.anyProjectionOccluded||=r.isOccluded,r.point;let s=e-i.direction,o=0===i.distanceFromAnchor?t.tileAnchorPoint:new Hc(t.lineVertexArray.getx(s),t.lineVertexArray.gety(s)),l=i.absOffsetX-i.distanceFromAnchor+1;return TD(o,a,i.previousVertex,l,t)}function PD(e,t,i){let n,a=e+i.translation[0],r=t+i.translation[1];return i.pitchWithMap?(n=bD(a,r,i.pitchedLabelPlaneMatrix,xD(i,a,r)),n.isOccluded=!1):(n=i.transform.projectTileCoordinates(a,r,i.unwrappedTileID,xD(i,a,r)),n.point.x=(.5*n.point.x+.5)*i.width,n.point.y=(.5*-n.point.y+.5)*i.height),n}function ID(e,t,i,n){if(i.pitchWithMap){let a=[e,t,0,1];Mu(a,a,n);let r=a[0]/a[3],s=a[1]/a[3];return i.transform.projectTileCoordinates(r,s,i.unwrappedTileID,xD(i,r,s)).point}return{x:e/i.width*2-1,y:1-t/i.height*2}}function FD(e,t,i){return i.transform.projectTileCoordinates(e,t,i.unwrappedTileID,xD(i,e,t))}function zD(e,t,i){return e._unit()._perp()._mult(t*i)}function RD(e,t,i,n,a,r,s,o,l){if(o.projectionCache.offsets[e])return o.projectionCache.offsets[e];let c=i.add(t);if(e+l.direction<n||e+l.direction>=a)return o.projectionCache.offsets[e]=c,c;let u=DD(e+l.direction,o,l),h=zD(u.sub(i),s,l.direction),d=i.add(h),p=u.add(h);return o.projectionCache.offsets[e]=function(e,t,i,n){let a=t.y-e.y,r=t.x-e.x,s=n.y-i.y,o=n.x-i.x,l=s*r-o*a;if(0===l)return null;let c=(o*(e.y-i.y)-s*(e.x-i.x))/l;return new Hc(e.x+c*r,e.y+c*a)}(r,c,d,p)||c,o.projectionCache.offsets[e]}function LD(e,t,i,n,a,r,s,o,l){let c=n?e-t:e+t,u=c>0?1:-1,h=0;n&&(u*=-1,h=Math.PI),u<0&&(h+=Math.PI);let d,p=u>0?r+a:r+a+1;o.projectionCache.cachedAnchorPoint?d=o.projectionCache.cachedAnchorPoint:(d=PD(o.tileAnchorPoint.x,o.tileAnchorPoint.y,o).point,o.projectionCache.cachedAnchorPoint=d);let m,g,f,A=d,_=d,v=0,y=0,x=Math.abs(c),b=[];for(;v+y<=x;){if(p+=u,p<r||p>=s)return null;v+=y,_=A,g=m;let e={absOffsetX:x,direction:u,distanceFromAnchor:v,previousVertex:_};if(A=DD(p,o,e),0===i)b.push(_),f=A.sub(_);else{let t,n=A.sub(_);t=0===n.mag()?zD(DD(p+u,o,e).sub(A),i,u):zD(n,i,u),g||=_.add(t),m=RD(p,t,A,r,s,g,i,o,e),b.push(g),f=m.sub(g)}y=f.mag()}let w=(x-v)/y,E=f._mult(w)._add(g||_),k=h+Math.atan2(A.y-_.y,A.x-_.x);return b.push(E),{point:E,angle:l?k:0,path:b}}const BD=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function OD(e,t){for(let i=0;i<e;i++){let e=t.length;t.resize(e+4),t.float32.set(BD,3*e)}}function UD(e,t,i){let n=t[0],a=t[1];return e[0]=i[0]*n+i[4]*a+i[12],e[1]=i[1]*n+i[5]*a+i[13],e[3]=i[3]*n+i[7]*a+i[15],e}var ND=class{constructor(e,t=new gD(e.width+200,e.height+200,25),i=new gD(e.width+200,e.height+200,25)){this.transform=e,this.grid=t,this.ignoredGrid=i,this.pitchFactor=Math.cos(e.pitch*Math.PI/180)*e.cameraToCenterDistance,this.screenRightBoundary=e.width+100,this.screenBottomBoundary=e.height+100,this.gridRightBoundary=e.width+200,this.gridBottomBoundary=e.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(e,t,i,n,a,r,s,o,l,c,u,h,d=0,p=!0){let m,g=e.anchorPointX+o[0],f=e.anchorPointY+o[1],A=this.projectAndGetPerspectiveRatio(g,f,a,pD(c,g,f,d,p),h),_=i*A.perspectiveRatio;if(r||s)m=this._projectCollisionBox(e,_,n,a,r,s,o,A,c,u,h,d,p);else{let t=A.x+(u?u.x*_:0),i=A.y+(u?u.y*_:0);m={allPointsOccluded:!1,box:[t+e.x1*_,i+e.y1*_,t+e.x2*_,i+e.y2*_]}}let[v,y,x,b]=m.box,w=r?m.allPointsOccluded:A.isOccluded,E=w;return E||=A.perspectiveRatio<this.perspectiveRatioCutoff,E||=!this.isInsideGrid(v,y,x,b),E||"always"!==t&&this.grid.hitTest(v,y,x,b,t,l)?{box:[v,y,x,b],placeable:!1,offscreen:!1,occluded:w}:{box:[v,y,x,b],placeable:!0,offscreen:this.isOffscreen(v,y,x,b),occluded:w}}placeCollisionCircles(e,t,i,n,a,r,s,o,l,c,u,h,d,p){let m=[],g=new Hc(t.anchorX,t.anchorY),f=this.getPerspectiveRatio(g.x,g.y,r,p?.(g.x,g.y)),A=(l?a*this.transform.getPitchedTextCorrection(t.anchorX,t.anchorY,r)/f:a*f)/24,_=t.lineOffsetX*A,v=t.lineOffsetY*A,y={getElevation:p,pitchedLabelPlaneMatrix:s,lineVertexArray:i,pitchWithMap:l,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:this.transform,tileAnchorPoint:g,unwrappedTileID:r,width:this.transform.width,height:this.transform.height,translation:d},x=SD(A,n,_,v,!1,t,!1,y),b=!1,w=!1,E=!0;if(x){let t=.5*u*f+h,i=new Hc(-100,-100),n=new Hc(this.screenRightBoundary,this.screenBottomBoundary),a=new dD,r=x.first,s=x.last,d=[];for(let e=r.path.length-1;e>=1;e--)d.push(r.path[e]);for(let e=1;e<s.path.length;e++)d.push(s.path[e]);let p=2.5*t;if(l){let e=this.projectPathToScreenSpace(d,y);d=e.some(e=>e.signedDistanceFromCamera<=0)?[]:e.map(e=>e.point)}let g=[];if(d.length>0){let e=d[0].clone(),t=d[0].clone();for(let i=1;i<d.length;i++)e.x=Math.min(e.x,d[i].x),e.y=Math.min(e.y,d[i].y),t.x=Math.max(t.x,d[i].x),t.y=Math.max(t.y,d[i].y);g=e.x>=i.x&&t.x<=n.x&&e.y>=i.y&&t.y<=n.y?[d]:t.x<i.x||e.x>n.x||t.y<i.y||e.y>n.y?[]:eE([d],i.x,i.y,n.x,n.y)}for(let i of g){a.reset(i,.25*t);let n=0;n=a.length<=.5*t?1:Math.ceil(a.paddedLength/p)+1;for(let i=0;i<n;i++){let r=i/Math.max(n-1,1),s=a.lerp(r),l=s.x+100,u=s.y+100;m.push(l,u,t,0);let h=l-t,d=u-t,p=l+t,g=u+t;if(E&&=this.isOffscreen(h,d,p,g),w||=this.isInsideGrid(h,d,p,g),"always"!==e&&this.grid.hitTestCircle(l,u,t,e,c)&&(b=!0,!o))return{circles:[],offscreen:!1,collisionDetected:b}}}}return{circles:!o&&b||!w||f<this.perspectiveRatioCutoff?[]:m,offscreen:E,collisionDetected:b}}projectPathToScreenSpace(e,t){return function(e){let t=0,i=0,n=0,a=0;for(let r=0;r<e.length;r++)e[r].isOccluded?(n=r+1,a=0):(a++,a>i&&(i=a,t=n));return e.slice(t,t+i)}(function(e,t){let i=AD;return function(e,t){let i=1/(t[0]*t[5]-t[1]*t[4]);e[0]=t[5]*i,e[1]=-t[1]*i,e[2]=0,e[3]=0,e[4]=-t[4]*i,e[5]=t[0]*i,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1/t[10],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1/t[15]}(i,t.pitchedLabelPlaneMatrix),e.map(e=>{let n=bD(e.x,e.y,i,xD(t,e.x,e.y)),a=t.transform.projectTileCoordinates(n.point.x,n.point.y,t.unwrappedTileID,xD(t,n.point.x,n.point.y));return a.point.x=(.5*a.point.x+.5)*t.width,a.point.y=(.5*-a.point.y+.5)*t.height,a})}(e,t))}queryRenderedSymbols(e){if(0===e.length||0===this.grid.keysLength()&&0===this.ignoredGrid.keysLength())return{};let t=[],i=new px;for(let n of e){let e=new Hc(n.x+100,n.y+100);i.extend(e),t.push(e)}let{minX:n,minY:a,maxX:r,maxY:s}=i,o=this.grid.query(n,a,r,s).concat(this.ignoredGrid.query(n,a,r,s)),l={},c={};for(let e of o){let i=e.key;(void 0===l[i.bucketInstanceId]&&(l[i.bucketInstanceId]={}),l[i.bucketInstanceId][i.featureIndex])||pv(t,[new Hc(e.x1,e.y1),new Hc(e.x2,e.y1),new Hc(e.x2,e.y2),new Hc(e.x1,e.y2)])&&(l[i.bucketInstanceId][i.featureIndex]=!0,void 0===c[i.bucketInstanceId]&&(c[i.bucketInstanceId]=[]),c[i.bucketInstanceId].push(i.featureIndex))}return c}insertCollisionBox(e,t,i,n,a,r){let s={bucketInstanceId:n,featureIndex:a,collisionGroupID:r,overlapMode:t};(i?this.ignoredGrid:this.grid).insert(s,e[0],e[1],e[2],e[3])}insertCollisionCircles(e,t,i,n,a,r){let s=i?this.ignoredGrid:this.grid,o={bucketInstanceId:n,featureIndex:a,collisionGroupID:r,overlapMode:t};for(let t=0;t<e.length;t+=4)s.insertCircle(o,e[t],e[t+1],e[t+2])}projectAndGetPerspectiveRatio(e,t,i,n,a){if(a){let i;null==n?(i=[e,t,0,1],UD(i,i,a)):(i=[e,t,n,1],Mu(i,i,a));let r=i[3];return{x:(i[0]/r+1)/2*this.transform.width+100,y:(-i[1]/r+1)/2*this.transform.height+100,perspectiveRatio:.5+this.transform.cameraToCenterDistance/r*.5,isOccluded:!1,signedDistanceFromCamera:r}}{let a=this.transform.projectTileCoordinates(e,t,i,n);return{x:(a.point.x+1)/2*this.transform.width+100,y:(1-a.point.y)/2*this.transform.height+100,perspectiveRatio:.5+this.transform.cameraToCenterDistance/a.signedDistanceFromCamera*.5,isOccluded:a.isOccluded,signedDistanceFromCamera:a.signedDistanceFromCamera}}}getPerspectiveRatio(e,t,i,n){let a=this.transform.projectTileCoordinates(e,t,i,n);return.5+this.transform.cameraToCenterDistance/a.signedDistanceFromCamera*.5}isOffscreen(e,t,i,n){return i<100||e>=this.screenRightBoundary||n<100||t>this.screenBottomBoundary}isInsideGrid(e,t,i,n){return i>=0&&e<this.gridRightBoundary&&n>=0&&t<this.gridBottomBoundary}getViewportMatrix(){let e=eu([]);return nu(e,e,[-100,-100,0]),e}_projectCollisionBox(e,t,i,n,a,r,s,o,l,c,u,h=0,d=!0){let p=1,m=0,g=0,f=1,A=e.anchorPointX+s[0],_=e.anchorPointY+s[1];if(r&&!a){let e=this.projectAndGetPerspectiveRatio(A+1,_,n,pD(l,A+1,_,h,d),u),t=e.x-o.x,i=e.y-o.y,a=Math.atan(i/t)+(t<0?Math.PI:0),r=Math.sin(a),s=Math.cos(a);p=s,m=r,g=-r,f=s}else if(!r&&a){let e=yD(this.transform);p=e.vecEast[0],m=e.vecEast[1],g=e.vecSouth[0],f=e.vecSouth[1]}let v=o.x,y=o.y,x=t;if(a&&(v=A,y=_,x=2**-(this.transform.zoom-i.overscaledZ),x*=this.transform.getPitchedTextCorrection(A,_,n),!c)){x*=sh(.5+.5*(o.signedDistanceFromCamera/this.transform.cameraToCenterDistance),0,4)}c&&(v+=p*c.x*x+g*c.y*x,y+=m*c.x*x+f*c.y*x);let b=e.x1*x,w=e.x2*x,E=(b+w)/2,k=e.y1*x,S=e.y2*x,M=(k+S)/2,C=[{offsetX:b,offsetY:k},{offsetX:E,offsetY:k},{offsetX:w,offsetY:k},{offsetX:w,offsetY:M},{offsetX:w,offsetY:S},{offsetX:E,offsetY:S},{offsetX:b,offsetY:S},{offsetX:b,offsetY:M}],T=[];for(let{offsetX:e,offsetY:t}of C)T.push(new Hc(v+p*e+g*t,y+m*e+f*t));let D=!1;if(a){let e=T.map(e=>this.projectAndGetPerspectiveRatio(e.x,e.y,n,pD(l,e.x,e.y,h,d),u));D=e.some(e=>!e.isOccluded),T=e.map(e=>new Hc(e.x,e.y))}else D=!0;return{box:nh(T),allPointsOccluded:!D}}},jD=class{constructor(e,t,i,n){this.opacity=e?Math.max(0,Math.min(1,e.opacity+(e.placed?t:-t))):n&&i?1:0,this.placed=i}isHidden(){return 0===this.opacity&&!this.placed}},VD=class{constructor(e,t,i,n,a){this.text=new jD(e?e.text:null,t,i,a),this.icon=new jD(e?e.icon:null,t,n,a)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}},qD=class{constructor(e,t,i){this.text=e,this.icon=t,this.skipFade=i}},GD=class{constructor(e,t,i,n,a){this.bucketInstanceId=e,this.featureIndex=t,this.sourceLayerIndex=i,this.bucketIndex=n,this.tileID=a}},HD=class{constructor(e){this.crossSourceCollisions=e,this.maxGroupID=0,this.collisionGroups={}}get(e){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[e]){let t=++this.maxGroupID;this.collisionGroups[e]={ID:t,predicate:e=>e.collisionGroupID===t}}return this.collisionGroups[e]}};function WD(e,t,i,n,a){let{horizontalAlign:r,verticalAlign:s}=Cw(e),o=-(s-.5)*i;return new Hc(-(r-.5)*t+n[0]*a,o+n[1]*a)}var ZD=class{constructor(e,t,i,n,a){this.transform=e.clone(),this.terrain=t,this.collisionIndex=new ND(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=i,this.retainedQueryData={},this.collisionGroups=new HD(n),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=a,a&&(a.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(e){let t=this.terrain;if(t)return(i,n)=>t.getElevation(e,i,n)}getBucketParts(e,t,i,n){let a=i.getBucket(t),r=i.latestFeatureIndex;if(!a||!r||t.id!==a.layerIds[0])return;let s=i.collisionBoxArray,o=a.layers[0].layout,l=a.layers[0].paint,c=2**(this.transform.zoom-i.tileID.overscaledZ),u=i.tileSize/Uu,h=i.tileID.toUnwrapped(),d="map"===o.get("text-rotation-alignment"),p=Nu(i,1,this.transform.zoom),m=Zu(this.collisionIndex.transform,i,l.get("text-translate"),l.get("text-translate-anchor")),g=Zu(this.collisionIndex.transform,i,l.get("icon-translate"),l.get("icon-translate-anchor")),f=_D(d,this.transform,p);this.retainedQueryData[a.bucketInstanceId]=new GD(a.bucketInstanceId,r,a.sourceLayerIndex,a.index,i.tileID);let A={bucket:a,layout:o,translationText:m,translationIcon:g,unwrappedTileID:h,pitchedLabelPlaneMatrix:f,scale:c,textPixelRatio:u,holdingForFade:i.holdingForSymbolFade(),collisionBoxArray:s,partiallyEvaluatedTextSize:Hw(a.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(a.sourceID)};if(n)for(let t of a.sortKeyRanges){let{sortKey:i,symbolInstanceStart:n,symbolInstanceEnd:a}=t;e.push({sortKey:i,symbolInstanceStart:n,symbolInstanceEnd:a,parameters:A})}else e.push({symbolInstanceStart:0,symbolInstanceEnd:a.symbolInstances.length,parameters:A})}attemptAnchorPlacement(e,t,i,n,a,r,s,o,l,c,u,h,d,p,m,g,f,A,_,v,y,x){let b=hE[e.textAnchor],w=[e.textOffset0,e.textOffset1],E=WD(b,i,n,w,a),k=this.collisionIndex.placeCollisionBox(t,h,o,l,c,s,r,g,u.predicate,_,E,v,y,x);if((!A||this.collisionIndex.placeCollisionBox(A,h,o,l,c,s,r,f,u.predicate,_,E,v,y,x).placeable)&&k.placeable){let e;if(this.prevPlacement?.variableOffsets[d.crossTileID]&&this.prevPlacement?.placements[d.crossTileID]?.text&&(e=this.prevPlacement.variableOffsets[d.crossTileID].anchor),0===d.crossTileID)throw Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[d.crossTileID]={textOffset:w,width:i,height:n,anchor:b,textBoxScale:a,prevAnchor:e},this.markUsedJustification(p,b,d,m),p.allowVerticalPlacement&&(this.markUsedOrientation(p,m,d),this.placedOrientations[d.crossTileID]=m),{shift:E,placedGlyphBoxes:k}}}placeLayerBucketPart(e,t,i){let{bucket:n,layout:a,translationText:r,translationIcon:s,unwrappedTileID:o,pitchedLabelPlaneMatrix:l,textPixelRatio:c,holdingForFade:u,collisionBoxArray:h,partiallyEvaluatedTextSize:d,collisionGroup:p}=e.parameters,m=a.get("text-optional"),g=a.get("icon-optional"),f=yE(a,"text-overlap","text-allow-overlap"),A="always"===f,_=yE(a,"icon-overlap","icon-allow-overlap"),v="always"===_,y="map"===a.get("text-rotation-alignment"),x="map"===a.get("text-pitch-alignment"),b="none"!==a.get("icon-text-fit"),w="viewport-y"===a.get("symbol-z-order"),E="ground"===a.get("symbol-height-anchor"),k=A&&(v||!n.hasIconData()||g),S=v&&(A||!n.hasTextData()||m);!n.collisionArrays&&h&&n.deserializeCollisionBoxes(h);let M=this.retainedQueryData[n.bucketInstanceId].tileID,C=this._getTerrainElevationFunc(M),T=this.transform.getFastPathSimpleProjectionMatrix(M),D=(e,h,v)=>{if(t[e.crossTileID])return;if(u)return void(this.placements[e.crossTileID]=new qD(!1,!1,!1));let w=e.heightOffset,D=!1,P=!1,I=!0,F=null,z={box:null,placeable:!1,offscreen:null,occluded:!1},R={placeable:!1},L=null,B=null,O=null,U=0,N=0,j=0;h.textFeatureIndex?U=h.textFeatureIndex:e.useRuntimeCollisionCircles&&(U=e.featureIndex),h.verticalTextFeatureIndex&&(N=h.verticalTextFeatureIndex);let V=h.textBox;if(V){let t=t=>{let i=1;if(n.allowVerticalPlacement&&!t&&this.prevPlacement){let t=this.prevPlacement.placedOrientations[e.crossTileID];t&&(this.placedOrientations[e.crossTileID]=t,i=t,this.markUsedOrientation(n,i,e))}return i},a=(t,i)=>{if(n.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&h.verticalTextBox){for(let e of n.writingModes)if(2===e?(z=i(),R=z):z=t(),z?.placeable)break}else z=t()},l=e.textAnchorOffsetStartIndex,u=e.textAnchorOffsetEndIndex;if(u===l){let i=(t,i)=>{let a=this.collisionIndex.placeCollisionBox(t,f,c,M,o,x,y,r,p.predicate,C,void 0,T,w,E);return a?.placeable&&(this.markUsedOrientation(n,i,e),this.placedOrientations[e.crossTileID]=i),a};a(()=>i(V,1),()=>{let t=h.verticalTextBox;return n.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&t?i(t,2):{box:null,offscreen:null}}),t(z?.placeable)}else{let d=hE[this.prevPlacement?.variableOffsets[e.crossTileID]?.anchor],m=(t,a,h)=>{let m=t.x2-t.x1,g=t.y2-t.y1,A=e.textBoxScale,v=b&&"never"===_?a:null,k=null,S="never"===f?1:2,P="never";d&&S++;for(let i=0;i<S;i++){for(let i=l;i<u;i++){let a=n.textAnchorOffsets.get(i);if(d&&a.textAnchor!==d)continue;let l=this.attemptAnchorPlacement(a,t,m,g,A,y,x,c,M,o,p,P,e,n,h,r,s,v,C,T,w,E);if(l&&(k=l.placedGlyphBoxes,k?.placeable))return D=!0,F=l.shift,k}d?d=null:P=f}return i&&!k&&(k={box:this.collisionIndex.placeCollisionBox(V,"always",c,M,o,x,y,r,p.predicate,C,void 0,T,w,E).box,offscreen:!1,placeable:!1,occluded:!1}),k};a(()=>m(V,h.iconBox,1),()=>{let t=h.verticalTextBox,i=z?.placeable;return n.allowVerticalPlacement&&!i&&e.numVerticalGlyphVertices>0&&t?m(t,h.verticalIconBox,2):{box:null,occluded:!0,offscreen:null}}),z&&(D=z.placeable,I=z.offscreen);let g=t(z?.placeable);if(!D&&this.prevPlacement){let t=this.prevPlacement.variableOffsets[e.crossTileID];t&&(this.variableOffsets[e.crossTileID]=t,this.markUsedJustification(n,t.anchor,e,g))}}}if(L=z,D=L?.placeable,I=L?.offscreen,e.useRuntimeCollisionCircles&&e.centerJustifiedTextSymbolIndex>=0){let t=n.text.placedSymbolArray.get(e.centerJustifiedTextSymbolIndex),s=Gw(n.textSizeData,d,t),c=a.get("text-padding"),u=e.collisionCircleDiameter;B=this.collisionIndex.placeCollisionCircles(f,t,n.lineVertexArray,n.glyphOffsetArray,s,o,l,i,x,p.predicate,u,c,r,C),B.circles.length&&B.collisionDetected&&!i&&yh("Collisions detected, but collision boxes are not shown"),D=A||B.circles.length>0&&!B.collisionDetected,I&&=B.offscreen}if(h.iconFeatureIndex&&(j=h.iconFeatureIndex),h.iconBox){let e=e=>this.collisionIndex.placeCollisionBox(e,_,c,M,o,x,y,s,p.predicate,C,b&&F?F:void 0,T,w,E);R&&R.placeable&&h.verticalIconBox?(O=e(h.verticalIconBox),P=O.placeable):(O=e(h.iconBox),P=O.placeable),I&&=O.offscreen}let q=m||0===e.numHorizontalGlyphVertices&&0===e.numVerticalGlyphVertices,G=g||0===e.numIconVertices;q||G?G?q||(P&&=D):D=P&&D:P=D=P&&D;let H=D&&L.placeable,W=P&&O.placeable;if(H&&(R&&R.placeable&&N?this.collisionIndex.insertCollisionBox(L.box,f,a.get("text-ignore-placement"),n.bucketInstanceId,N,p.ID):this.collisionIndex.insertCollisionBox(L.box,f,a.get("text-ignore-placement"),n.bucketInstanceId,U,p.ID)),W&&this.collisionIndex.insertCollisionBox(O.box,_,a.get("icon-ignore-placement"),n.bucketInstanceId,j,p.ID),B&&D&&this.collisionIndex.insertCollisionCircles(B.circles,f,a.get("text-ignore-placement"),n.bucketInstanceId,U,p.ID),i&&this.storeCollisionData(n.bucketInstanceId,v,h,L,O,B),0===e.crossTileID)throw Error("symbolInstance.crossTileID can't be 0");if(0===n.bucketInstanceId)throw Error("bucket.bucketInstanceId can't be 0");let Z=(D||k)&&!L?.occluded,K=(P||S)&&!O?.occluded;this.placements[e.crossTileID]=new qD(Z,K,I||n.justReloaded),t[e.crossTileID]=!0};if(w){if(0!==e.symbolInstanceStart)throw Error("bucket.bucketInstanceId should be 0");let t=n.getSortedSymbolIndexes(-this.transform.bearingInRadians);for(let e=t.length-1;e>=0;--e){let i=t[e];D(n.symbolInstances.get(i),n.collisionArrays[i],i)}}else for(let t=e.symbolInstanceStart;t<e.symbolInstanceEnd;t++)D(n.symbolInstances.get(t),n.collisionArrays[t],t);n.justReloaded=!1}storeCollisionData(e,t,i,n,a,r){if(i.textBox||i.iconBox){let r,s;this.collisionBoxArrays.has(e)?r=this.collisionBoxArrays.get(e):(r=new Map,this.collisionBoxArrays.set(e,r)),r.has(t)?s=r.get(t):(s={text:null,icon:null},r.set(t,s)),i.textBox&&(s.text=n.box),i.iconBox&&(s.icon=a.box)}if(r){let t=this.collisionCircleArrays[e];void 0===t&&(t=this.collisionCircleArrays[e]=[]);for(let e=0;e<r.circles.length;e+=4)t.push(r.circles[e+0]-100),t.push(r.circles[e+1]-100),t.push(r.circles[e+2]),t.push(+!!r.collisionDetected)}}markUsedJustification(e,t,i,n){let a,r={left:i.leftJustifiedTextSymbolIndex,center:i.centerJustifiedTextSymbolIndex,right:i.rightJustifiedTextSymbolIndex};a=2===n?i.verticalPlacedTextSymbolIndex:r[gE(t)];let s=[i.leftJustifiedTextSymbolIndex,i.centerJustifiedTextSymbolIndex,i.rightJustifiedTextSymbolIndex,i.verticalPlacedTextSymbolIndex];for(let t of s)t>=0&&(e.text.placedSymbolArray.get(t).crossTileID=a>=0&&t!==a?0:i.crossTileID)}markUsedOrientation(e,t,i){let n=1===t||3===t?t:0,a=2===t?t:0,r=[i.leftJustifiedTextSymbolIndex,i.centerJustifiedTextSymbolIndex,i.rightJustifiedTextSymbolIndex];for(let t of r)e.text.placedSymbolArray.get(t).placedOrientation=n;i.verticalPlacedTextSymbolIndex&&(e.text.placedSymbolArray.get(i.verticalPlacedTextSymbolIndex).placedOrientation=a)}commit(e){this.commitTime=e,this.zoomAtLastRecencyCheck=this.transform.zoom;let t=this.prevPlacement,i=!1;this.prevZoomAdjustment=t?t.zoomAdjustment(this.transform.zoom):0;let n=t?t.symbolFadeChange(e):1,a=t?t.opacities:{},r=t?t.variableOffsets:{},s=t?t.placedOrientations:{};for(let e in this.placements){let t=this.placements[e],r=a[e];r?(this.opacities[e]=new VD(r,n,t.text,t.icon),i||=t.text!==r.text.placed,i||=t.icon!==r.icon.placed):(this.opacities[e]=new VD(null,n,t.text,t.icon,t.skipFade),i||=t.text||t.icon)}for(let e in a){let t=a[e];if(!this.opacities[e]){let a=new VD(t,n,!1,!1);a.isHidden()||(this.opacities[e]=a,i||=t.text.placed,i||=t.icon.placed)}}for(let e in r)!this.variableOffsets[e]&&this.opacities[e]&&!this.opacities[e].isHidden()&&(this.variableOffsets[e]=r[e]);for(let e in s)!this.placedOrientations[e]&&this.opacities[e]&&!this.opacities[e].isHidden()&&(this.placedOrientations[e]=s[e]);if(t&&void 0===t.lastPlacementChangeTime)throw Error("Last placement time for previous placement is not defined");i?this.lastPlacementChangeTime=e:"number"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=t?t.lastPlacementChangeTime:e)}updateLayerOpacities(e,t){let i={};for(let n of t){let t=n.getBucket(e);t&&n.latestFeatureIndex&&e.id===t.layerIds[0]&&this.updateBucketOpacities(t,n.tileID,i,n.collisionBoxArray)}}updateBucketOpacities(e,t,i,n){e.hasTextData()&&(e.text.opacityVertexArray.clear(),e.text.hasVisibleVertices=!1),e.hasIconData()&&(e.icon.opacityVertexArray.clear(),e.icon.hasVisibleVertices=!1),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexArray.clear(),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexArray.clear();let a=e.layers[0],r=a.layout,s=new VD(null,0,!1,!1,!0),o=r.get("text-allow-overlap"),l=r.get("icon-allow-overlap"),c=a._unevaluatedLayout.hasValue("text-variable-anchor")||a._unevaluatedLayout.hasValue("text-variable-anchor-offset"),u="map"===r.get("text-rotation-alignment"),h="map"===r.get("text-pitch-alignment"),d="none"!==r.get("icon-text-fit"),p=new VD(null,0,o&&(l||!e.hasIconData()||r.get("icon-optional")),l&&(o||!e.hasTextData()||r.get("text-optional")),!0);!e.collisionArrays&&n&&(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData())&&e.deserializeCollisionBoxes(n);let m=(e,t,i)=>{for(let n=0;n<t/4;n++)e.opacityVertexArray.emplaceBack(i);e.hasVisibleVertices||=i!==eP},g=this.collisionBoxArrays.get(e.bucketInstanceId);for(let t=0;t<e.symbolInstances.length;t++){let n=e.symbolInstances.get(t),{numHorizontalGlyphVertices:a,numVerticalGlyphVertices:r,crossTileID:o}=n,l=i[o],f=this.opacities[o];l?f=s:f||(f=p,this.opacities[o]=f),i[o]=!0;let A=a>0||r>0,_=n.numIconVertices>0,v=this.placedOrientations[n.crossTileID],y=2===v,x=1===v||3===v;if(A){let t=$D(f.text),i=y?eP:t;m(e.text,a,i);let s=x?eP:t;m(e.text,r,s);let o=f.text.isHidden(),l=[n.rightJustifiedTextSymbolIndex,n.centerJustifiedTextSymbolIndex,n.leftJustifiedTextSymbolIndex];for(let t of l)t>=0&&(e.text.placedSymbolArray.get(t).hidden=o||y?1:0);n.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(n.verticalPlacedTextSymbolIndex).hidden=o||x?1:0);let c=this.variableOffsets[n.crossTileID];c&&this.markUsedJustification(e,c.anchor,n,v);let u=this.placedOrientations[n.crossTileID];u&&(this.markUsedJustification(e,"left",n,u),this.markUsedOrientation(e,u,n))}if(_){let t=$D(f.icon),i=!(d&&n.verticalPlacedIconSymbolIndex&&y);if(n.placedIconSymbolIndex>=0){let a=i?t:eP;m(e.icon,n.numIconVertices,a),e.icon.placedSymbolArray.get(n.placedIconSymbolIndex).hidden=f.icon.isHidden()}if(n.verticalPlacedIconSymbolIndex>=0){let a=i?eP:t;m(e.icon,n.numVerticalIconVertices,a),e.icon.placedSymbolArray.get(n.verticalPlacedIconSymbolIndex).hidden=f.icon.isHidden()}}let b=g?.has(t)?g.get(t):{text:null,icon:null};if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){let i=e.collisionArrays[t];if(i){let t=new Hc(0,0);if(i.textBox||i.verticalTextBox){let n=!0;if(c){let e=this.variableOffsets[o];e?(t=WD(e.anchor,e.width,e.height,e.textOffset,e.textBoxScale),u&&t._rotate(h?-this.transform.bearingInRadians:this.transform.bearingInRadians)):n=!1}if(i.textBox||i.verticalTextBox){let a;i.textBox&&(a=y),i.verticalTextBox&&(a=x),KD(e.textCollisionBox.collisionVertexArray,f.text.placed,!n||a,b.text,t.x,t.y)}}if(i.iconBox||i.verticalIconBox){let n,a=!(x||!i.verticalIconBox);i.iconBox&&(n=a),i.verticalIconBox&&(n=!a),KD(e.iconCollisionBox.collisionVertexArray,f.icon.placed,n,b.icon,d?t.x:0,d?t.y:0)}}}}if(e.sortFeatures(-this.transform.bearingInRadians),this.retainedQueryData[e.bucketInstanceId]&&(this.retainedQueryData[e.bucketInstanceId].featureSortOrder=e.featureSortOrder),e.hasTextData()&&e.text.opacityVertexBuffer&&e.text.opacityVertexBuffer.updateData(e.text.opacityVertexArray),e.hasIconData()&&e.icon.opacityVertexBuffer&&e.icon.opacityVertexBuffer.updateData(e.icon.opacityVertexArray),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexBuffer&&e.iconCollisionBox.collisionVertexBuffer.updateData(e.iconCollisionBox.collisionVertexArray),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexBuffer&&e.textCollisionBox.collisionVertexBuffer.updateData(e.textCollisionBox.collisionVertexArray),e.text.opacityVertexArray.length!==e.text.layoutVertexArray.length/4)throw Error(`bucket.text.opacityVertexArray.length (= ${e.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${e.text.layoutVertexArray.length}) / 4`);if(e.icon.opacityVertexArray.length!==e.icon.layoutVertexArray.length/4)throw Error(`bucket.icon.opacityVertexArray.length (= ${e.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${e.icon.layoutVertexArray.length}) / 4`);e.bucketInstanceId in this.collisionCircleArrays&&(e.collisionCircleArray=this.collisionCircleArrays[e.bucketInstanceId],delete this.collisionCircleArrays[e.bucketInstanceId])}symbolFadeChange(e){return 0===this.fadeDuration?1:(e-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(e){return Math.max(0,(this.transform.zoom-e)/1.5)}hasTransitions(e){return this.stale||e-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(e,t){let i=this.zoomAtLastRecencyCheck===t?1-this.zoomAdjustment(t):1;return this.zoomAtLastRecencyCheck=t,this.commitTime+this.fadeDuration*i>e}setStale(){this.stale=!0}};function KD(e,t,i,n,a,r){(!n||0===n.length)&&(n=[0,0,0,0]);let s=n[0]-100,o=n[1]-100,l=n[2]-100,c=n[3]-100;e.emplaceBack(+!!t,+!!i,a||0,r||0,s,o),e.emplaceBack(+!!t,+!!i,a||0,r||0,l,o),e.emplaceBack(+!!t,+!!i,a||0,r||0,l,c),e.emplaceBack(+!!t,+!!i,a||0,r||0,s,c)}const XD=2**25,QD=2**24,YD=2**17,JD=65536;function $D(e){if(0===e.opacity&&!e.placed)return 0;if(1===e.opacity&&e.placed)return 4294967295;let t=+!!e.placed,i=Math.floor(127*e.opacity);return i*XD+t*QD+i*YD+t*JD+512*i+256*t+2*i+t}const eP=0;var tP=class{constructor(e){this._sortAcrossTiles="viewport-y"!==e.layout.get("symbol-z-order")&&!e.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(e,t,i,n,a){let r=this._bucketParts;for(;this._currentTileIndex<e.length;){let i=e[this._currentTileIndex];if(t.getBucketParts(r,n,i,this._sortAcrossTiles),this._currentTileIndex++,a())return!0}for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,r.sort((e,t)=>e.sortKey-t.sortKey));this._currentPartIndex<r.length;){let e=r[this._currentPartIndex];if(t.placeLayerBucketPart(e,this._seenCrossTileIDs,i),this._currentPartIndex++,a())return!0}return!1}},iP=class{constructor(e,t,i,n,a,r,s,o){this.placement=new ZD(e,t,r,s,o),this._currentPlacementIndex=i.length-1,this._forceFullPlacement=n,this._showCollisionBoxes=a,this._done=!1}isDone(){return this._done}continuePlacement(e,t,i){let n=tC(),a=()=>!this._forceFullPlacement&&tC()-n>2;for(;this._currentPlacementIndex>=0;){let n=t[e[this._currentPlacementIndex]],r=this.placement.collisionIndex.transform.zoom;if(IE(n)&&n.layout&&(!n.minzoom||n.minzoom<=r)&&(!n.maxzoom||n.maxzoom>r)){if(this._inProgressLayer||=new tP(n),this._inProgressLayer.continuePlacement(i[n.source],this.placement,this._showCollisionBoxes,n,a))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(e){return this.placement.commit(e),this.placement}};const nP=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],aP=new Uint32Array(96);var rP=class e{static from(t){if(!t||void 0===t.byteLength||t.buffer)throw Error("Data must be an instance of ArrayBuffer or SharedArrayBuffer.");let[i,n]=new Uint8Array(t,0,2);if(219!==i)throw Error("Data does not appear to be in a KDBush format.");let a=n>>4;if(1!==a)throw Error(`Got v${a} data when expected v1.`);let r=nP[15&n];if(!r)throw Error("Unrecognized array type.");let[s]=new Uint16Array(t,2,1),[o]=new Uint32Array(t,4,1);return new e(o,s,r,void 0,t)}constructor(e,t=64,i=Float64Array,n=ArrayBuffer,a){if(isNaN(e)||e<0)throw Error(`Unexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+t,2),65535),this.ArrayType=i,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;let r=nP.indexOf(this.ArrayType),s=2*e*this.ArrayType.BYTES_PER_ELEMENT,o=e*this.IndexArrayType.BYTES_PER_ELEMENT,l=(8-o%8)%8;if(r<0)throw Error(`Unexpected typed array class: ${i}.`);if(a)this.data=a,this.ids=new this.IndexArrayType(a,8,e),this.coords=new i(a,8+o+l,2*e),this._pos=2*e,this._finished=!0;else{let a=this.data=new n(8+s+o+l);this.ids=new this.IndexArrayType(a,8,e),this.coords=new i(a,8+o+l,2*e),this._pos=0,this._finished=!1,new Uint8Array(a,0,2).set([219,16+r]),new Uint16Array(a,2,1)[0]=t,new Uint32Array(a,4,1)[0]=e}}add(e,t){let i=this._pos>>1;return this.ids[i]=i,this.coords[this._pos++]=e,this.coords[this._pos++]=t,i}finish(){let e=this._pos>>1;if(e!==this.numItems)throw Error(`Added ${e} items when expected ${this.numItems}.`);return sP(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,t,i,n){if(!this._finished)throw Error("Data not yet indexed - call index.finish().");let{ids:a,coords:r,nodeSize:s}=this;aP[0]=0,aP[1]=a.length-1,aP[2]=0;let o=3,l=[];for(;o>0;){let c=aP[--o],u=aP[--o],h=aP[--o];if(u-h<=s){for(let s=h;s<=u;s++){let o=r[2*s],c=r[2*s+1];o>=e&&o<=i&&c>=t&&c<=n&&l.push(a[s])}continue}let d=h+u>>1,p=r[2*d],m=r[2*d+1];p>=e&&p<=i&&m>=t&&m<=n&&l.push(a[d]),(0===c?e<=p:t<=m)&&(aP[o++]=h,aP[o++]=d-1,aP[o++]=1-c),(0===c?i>=p:n>=m)&&(aP[o++]=d+1,aP[o++]=u,aP[o++]=1-c)}return l}within(e,t,i){let n=[];return this.withinInto(e,t,i,n),n}withinInto(e,t,i,n){if(!this._finished)throw Error("Data not yet indexed - call index.finish().");let{ids:a,coords:r,nodeSize:s}=this;aP[0]=0,aP[1]=a.length-1,aP[2]=0;let o=3,l=0,c=i*i;for(;o>0;){let u=aP[--o],h=aP[--o],d=aP[--o];if(h-d<=s){for(let i=d;i<=h;i++)uP(r[2*i],r[2*i+1],e,t)<=c&&(n[l++]=a[i]);continue}let p=d+h>>1,m=r[2*p],g=r[2*p+1];uP(m,g,e,t)<=c&&(n[l++]=a[p]),(0===u?e-i<=m:t-i<=g)&&(aP[o++]=d,aP[o++]=p-1,aP[o++]=1-u),(0===u?e+i>=m:t+i>=g)&&(aP[o++]=p+1,aP[o++]=h,aP[o++]=1-u)}return l}};function sP(e,t,i,n,a,r){if(a-n<=i)return;let s=n+a>>1;oP(e,t,s,n,a,r),sP(e,t,i,n,s-1,1-r),sP(e,t,i,s+1,a,1-r)}function oP(e,t,i,n,a,r){for(;a>n;){if(a-n>600){let s=a-n+1,o=i-n+1,l=Math.log(s),c=.5*Math.exp(2*l/3),u=.5*Math.sqrt(l*c*(s-c)/s)*(o-s/2<0?-1:1);oP(e,t,i,Math.max(n,Math.floor(i-o*c/s+u)),Math.min(a,Math.floor(i+(s-o)*c/s+u)),r)}let s=t[2*i+r],o=n,l=a;for(lP(e,t,n,i),t[2*a+r]>s&&lP(e,t,n,a);o<l;){for(lP(e,t,o,l),o++,l--;t[2*o+r]<s;)o++;for(;t[2*l+r]>s;)l--}t[2*n+r]===s?lP(e,t,n,l):(l++,lP(e,t,l,a)),l<=i&&(n=l+1),i<=l&&(a=l-1)}}function lP(e,t,i,n){cP(e,i,n),cP(t,2*i,2*n),cP(t,2*i+1,2*n+1)}function cP(e,t,i){let n=e[t];e[t]=e[i],e[i]=n}function uP(e,t,i,n){let a=e-i,r=t-n;return a*a+r*r}const hP=.03125;var dP=class{constructor(e,t,i){this.tileID=e,this.bucketInstanceId=i,this._symbolsByKey={};let n=new Map;for(let e=0;e<t.length;e++){let i=t.get(e),a=i.key,r=n.get(a);r?r.push(i):n.set(a,[i])}for(let[e,t]of n){let i={positions:t.map(e=>({x:Math.floor(e.anchorX*hP),y:Math.floor(e.anchorY*hP)})),crossTileIDs:t.map(e=>e.crossTileID)};if(i.positions.length>128){let e=new rP(i.positions.length,16,Uint16Array);for(let{x:t,y:n}of i.positions)e.add(t,n);e.finish(),delete i.positions,i.index=e}this._symbolsByKey[e]=i}}getScaledCoordinates(e,t){let{x:i,y:n,z:a}=this.tileID.canonical,{x:r,y:s,z:o}=t.canonical,l=hP/2**(o-a),c=(r*Uu+e.anchorX)*l,u=(s*Uu+e.anchorY)*l,h=i*Uu*hP,d=n*Uu*hP;return{x:Math.floor(c-h),y:Math.floor(u-d)}}findMatches(e,t,i){let n=this.tileID.canonical.z<t.canonical.z?1:2**(this.tileID.canonical.z-t.canonical.z);for(let a=0;a<e.length;a++){let r=e.get(a);if(r.crossTileID)continue;let s=this._symbolsByKey[r.key];if(!s)continue;let o=this.getScaledCoordinates(r,t);s.index?this.findMatchesForIndexedEntry(s,r,o,n,i):s.positions&&this.findMatchesForNonIndexedEntry(s,r,o,n,i)}}findMatchesForIndexedEntry(e,t,i,n,a){let r=e.index.range(i.x-n,i.y-n,i.x+n,i.y+n),s=1/0;for(let t of r)t<s&&!a[e.crossTileIDs[t]]&&(s=t);if(s!==1/0){let i=e.crossTileIDs[s];a[i]=!0,t.crossTileID=i}}findMatchesForNonIndexedEntry(e,t,i,n,a){for(let r=0;r<e.positions.length;r++){let s=e.positions[r],o=e.crossTileIDs[r];if(Math.abs(s.x-i.x)<=n&&Math.abs(s.y-i.y)<=n&&!a[o]){a[o]=!0,t.crossTileID=o;break}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map(({crossTileIDs:e})=>e)}},pP=class{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}},mP=class{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(e){let t=Math.round((e-this.lng)/360);if(0!==t)for(let e in this.indexes){let i=this.indexes[e],n={};for(let e in i){let a=i[e];a.tileID=a.tileID.unwrapTo(a.tileID.wrap+t),n[a.tileID.key]=a}this.indexes[e]=n}this.lng=e}addBucket(e,t,i){if(this.indexes[e.overscaledZ]?.[e.key]){if(this.indexes[e.overscaledZ][e.key].bucketInstanceId===t.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(e.overscaledZ,this.indexes[e.overscaledZ][e.key])}for(let e=0;e<t.symbolInstances.length;e++){t.symbolInstances.get(e).crossTileID=0}this.usedCrossTileIDs[e.overscaledZ]||={};let n=this.usedCrossTileIDs[e.overscaledZ];for(let i in this.indexes){let a=this.indexes[i];if(Number(i)>e.overscaledZ)for(let i in a){let r=a[i];r.tileID.isChildOf(e)&&r.findMatches(t.symbolInstances,e,n)}else{let r=a[e.scaledTo(Number(i)).key];r&&r.findMatches(t.symbolInstances,e,n)}}for(let e=0;e<t.symbolInstances.length;e++){let a=t.symbolInstances.get(e);a.crossTileID||(a.crossTileID=i.generate(),n[a.crossTileID]=!0)}return void 0===this.indexes[e.overscaledZ]&&(this.indexes[e.overscaledZ]={}),this.indexes[e.overscaledZ][e.key]=new dP(e,t.symbolInstances,t.bucketInstanceId),!0}removeBucketCrossTileIDs(e,t){for(let i of t.getCrossTileIDsLists())for(let t of i)delete this.usedCrossTileIDs[e][t]}removeStaleBuckets(e){let t=!1;for(let i in this.indexes){let n=this.indexes[i];for(let a in n)e[n[a].bucketInstanceId]||(this.removeBucketCrossTileIDs(i,n[a]),delete n[a],t=!0)}return t}},gP=class{constructor(){this.layerIndexes={},this.crossTileIDs=new pP,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(e,t,i){let n=this.layerIndexes[e.id];void 0===n&&(n=this.layerIndexes[e.id]=new mP);let a=!1,r={};n.handleWrapJump(i);for(let i of t){let t=i.getBucket(e);e.id===t?.layerIds[0]&&(t.bucketInstanceId||=(this.maxBucketInstanceId+=1,this.maxBucketInstanceId),n.addBucket(i.tileID,t,this.crossTileIDs)&&(a=!0),r[t.bucketInstanceId]=!0)}return n.removeStaleBuckets(r)&&(a=!0),a}pruneUnusedLayers(e){let t={};for(let i of e)t[i]=!0;for(let e in this.layerIndexes)t[e]||delete this.layerIndexes[e]}},fP="void main() {fragColor=vec4(1.0);}";const AP={prelude:_P("#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;layout(std140) uniform ProjectionUBO {highp mat4 u_projection_matrix;highp mat4 u_projection_fallback_matrix;highp vec4 u_projection_tile_mercator_coords;highp vec4 u_projection_clipping_plane;highp float u_projection_transition;highp int u_projection_clip_antimeridian;};layout(std140) uniform FrameUBO {highp vec2 u_units_to_pixels;highp vec2 u_world_size;highp float u_camera_to_center_distance;highp float u_symbol_fade_change;highp float u_aspect_ratio;highp float u_device_pixel_ratio;highp vec2 u_viewport_size;highp vec2 u_pixel_extrude_scale;highp float u_pitch;};","#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 uint packedOpacity) {return vec2(float(packedOpacity >> 1u)/127.0,float(packedOpacity & 1u));}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 highp sampler2D u_depth;layout(std140) uniform TerrainUBO {highp mat4 u_terrain_matrix;highp vec4 u_terrain_unpack;highp float u_terrain_dim;highp float u_terrain_exaggeration;};\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(ivec2 pos) {\n#ifdef TERRAIN3D\nvec4 rgb=(texelFetch(u_terrain,pos,0)*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+2.0;vec2 f=fract(coord);ivec2 c=ivec2(floor(coord));ivec2 hi=textureSize(u_terrain,0)-1;float tl=ele(clamp(c,ivec2(0),hi));float tr=ele(clamp(c+ivec2(1,0),ivec2(0),hi));float bl=ele(clamp(c+ivec2(0,1),ivec2(0),hi));float br=ele(clamp(c+ivec2(1,1),ivec2(0),hi));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;\n#define PROJECTION_UBO\nlayout(std140) uniform ProjectionUBO {highp mat4 u_projection_matrix;highp mat4 u_projection_fallback_matrix;highp vec4 u_projection_tile_mercator_coords;highp vec4 u_projection_clipping_plane;highp float u_projection_transition;highp int u_projection_clip_antimeridian;};layout(std140) uniform FrameUBO {highp vec2 u_units_to_pixels;highp vec2 u_world_size;highp float u_camera_to_center_distance;highp float u_symbol_fade_change;highp float u_aspect_ratio;highp float u_device_pixel_ratio;highp vec2 u_viewport_size;highp vec2 u_pixel_extrude_scale;highp float u_pitch;};"),projectionMercator:_P("\nvoid clipAntimeridian() {}","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:_P("in highp float v_projection_tile_x;void clipAntimeridian() {if (u_projection_clip_antimeridian !=0 && (v_projection_tile_x < 0.0 || v_projection_tile_x >=8192.0)) {discard;}}","#define GLOBE_RADIUS 6371008.8\n#ifndef PROJECTION_UBO\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;\n#endif\nout highp float v_projection_tile_x;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 t=exp(PI-(mercator_pos_y*PI*2.0));return (2.0*t)/(t*t+1.0);}float projectLineThickness(float tileY) {float thickness=1.0/circumferenceRatioAtTileY(tileY);if (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;float spherical_x=mercator_pos.x*PI*2.0+PI;float t=exp(PI-(mercator_pos.y*PI*2.0));float t2=t*t;float denom=t2+1.0;float sin_sy=(t2-1.0)/denom;float cos_sy=(2.0*t)/denom;vec3 pos=vec3(sin(spherical_x)*cos_sy,sin_sy,cos(spherical_x)*cos_sy\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) {v_projection_tile_x=posInTile.x;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) {v_projection_tile_x=posInTile.x;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:_P("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}","layout(location=0) in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),backgroundPattern:_P("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;layout(location=0) 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:_P("in vec3 v_data;flat in float v_visibility;\n#pragma maplibre: define highp vec4 color\n#pragma maplibre: define mediump float radius\n#pragma maplibre: define lowp float blur\n#pragma maplibre: define lowp float opacity\n#pragma maplibre: define highp vec4 stroke_color\n#pragma maplibre: define mediump float stroke_width\n#pragma maplibre: define lowp float stroke_opacity\nvoid main() {\n#pragma maplibre: initialize highp vec4 color\n#pragma maplibre: initialize mediump float radius\n#pragma maplibre: initialize lowp float blur\n#pragma maplibre: initialize lowp float opacity\n#pragma maplibre: initialize highp vec4 stroke_color\n#pragma maplibre: initialize mediump float stroke_width\n#pragma maplibre: 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 vec2 u_translate;layout(location=0) in ivec2 a_pos;out vec3 v_data;flat out float v_visibility;\n#pragma maplibre: define highp vec4 color\n#pragma maplibre: define mediump float radius\n#pragma maplibre: define lowp float blur\n#pragma maplibre: define lowp float opacity\n#pragma maplibre: define highp vec4 stroke_color\n#pragma maplibre: define mediump float stroke_width\n#pragma maplibre: define lowp float stroke_opacity\nvoid main(void) {\n#pragma maplibre: initialize highp vec4 color\n#pragma maplibre: initialize mediump float radius\n#pragma maplibre: initialize lowp float blur\n#pragma maplibre: initialize lowp float opacity\n#pragma maplibre: initialize highp vec4 stroke_color\n#pragma maplibre: initialize mediump float stroke_width\n#pragma maplibre: initialize lowp float stroke_opacity\nivec2 pos_raw=a_pos+32768;vec2 extrude=vec2(pos_raw & 7)/7.0*2.0-1.0;vec2 circle_center=vec2(pos_raw >> 3)+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:_P(fP,"layout(location=0) in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),heatmap:_P("uniform highp float u_intensity;in vec2 v_extrude;\n#pragma maplibre: define highp float weight\n#define GAUSS_COEF 0.3989422804014327\nvoid main() {\n#pragma maplibre: 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;layout(location=0) in ivec2 a_pos;out vec2 v_extrude;\n#pragma maplibre: define highp float weight\n#pragma maplibre: 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 maplibre: initialize highp float weight\n#pragma maplibre: initialize mediump float radius\nivec2 pos_raw=a_pos+32768;vec2 unscaled_extrude=vec2(pos_raw & 7)/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=vec2(pos_raw >> 3);\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:_P("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;layout(location=0) in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world_size,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"),collisionBox:_P("flat in float v_placed;flat 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;}}","layout(location=0) in vec2 a_anchor_pos;layout(location=1) in vec2 a_placed;layout(location=2) in vec2 a_box_real;flat out float v_placed;flat 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:_P("flat in float v_radius;in vec2 v_extrude;flat 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;}","layout(location=0) in vec2 a_pos;layout(location=1) in float a_radius;layout(location=2) in vec2 a_flags;flat out float v_radius;out vec2 v_extrude;flat 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:_P("#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) {vec4 data=texelFetch(u_elevation_stops,ivec2(stop,0),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;layout(location=0) in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=projectTile(a_pos,a_pos);highp vec2 epsilon=2.0/u_dimension;float scale=(u_dimension.x-4.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:_P("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);}","layout(location=0) 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:_P(fP,"layout(location=0) 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:_P("#pragma maplibre: define highp vec4 color\n#pragma maplibre: define lowp float opacity\nvoid main() {\n#pragma maplibre: initialize highp vec4 color\n#pragma maplibre: initialize lowp float opacity\nfragColor=color*opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_fill_translate;layout(location=0) in vec2 a_pos;\n#pragma maplibre: define highp vec4 color\n#pragma maplibre: define lowp float opacity\nvoid main() {\n#pragma maplibre: initialize highp vec4 color\n#pragma maplibre: initialize lowp float opacity\nif (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}gl_Position=projectTile(a_pos+u_fill_translate,a_pos);}"),fillOutline:_P("in vec2 v_pos;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma maplibre: define highp vec4 outline_color\n#pragma maplibre: define lowp float opacity\nvoid main() {\n#pragma maplibre: initialize highp vec4 outline_color\n#pragma maplibre: 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_fill_translate;layout(location=0) in vec2 a_pos;out vec2 v_pos;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma maplibre: define highp vec4 outline_color\n#pragma maplibre: define lowp float opacity\nvoid main() {\n#pragma maplibre: initialize highp vec4 outline_color\n#pragma maplibre: initialize lowp float opacity\nif (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}gl_Position=projectTile(a_pos+u_fill_translate,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world_size;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n}"),fillOutlinePattern:_P("uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;uniform bool u_sdf_pattern;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 maplibre: define lowp float opacity\n#pragma maplibre: define highp vec4 color\n#pragma maplibre: define lowp vec4 pattern_from\n#pragma maplibre: define lowp vec4 pattern_to\nvoid main() {\n#pragma maplibre: initialize lowp float opacity\n#pragma maplibre: initialize highp vec4 color\n#pragma maplibre: initialize mediump vec4 pattern_from\n#pragma maplibre: 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);if (u_sdf_pattern) {highp float sdf_edge=(256.0-64.0)/256.0;highp float sdf_gamma_a=max(fwidth(color1.a)*0.5,1.0/255.0/16.0);highp float sdf_gamma_b=max(fwidth(color2.a)*0.5,1.0/255.0/16.0);float sdf_alpha_a=smoothstep(sdf_edge-sdf_gamma_a,sdf_edge+sdf_gamma_a,color1.a);float sdf_alpha_b=smoothstep(sdf_edge-sdf_gamma_b,sdf_edge+sdf_gamma_b,color2.a);fragColor=mix(color*sdf_alpha_a,color*sdf_alpha_b,u_fade)*alpha*opacity;} else {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_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;layout(location=0) 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 maplibre: define lowp float opacity\n#pragma maplibre: define highp vec4 color\n#pragma maplibre: define lowp vec4 pattern_from\n#pragma maplibre: define lowp vec4 pattern_to\n#pragma maplibre: define lowp float pixel_ratio_from\n#pragma maplibre: define lowp float pixel_ratio_to\nvoid main() {\n#pragma maplibre: initialize lowp float opacity\n#pragma maplibre: initialize highp vec4 color\n#pragma maplibre: initialize mediump vec4 pattern_from\n#pragma maplibre: initialize mediump vec4 pattern_to\n#pragma maplibre: initialize lowp float pixel_ratio_from\n#pragma maplibre: initialize lowp float pixel_ratio_to\nif (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}vec2 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_size;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n}"),fillPattern:_P("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform vec2 u_texsize;uniform float u_fade;uniform bool u_sdf_pattern;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;\n#pragma maplibre: define lowp float opacity\n#pragma maplibre: define highp vec4 color\n#pragma maplibre: define lowp vec4 pattern_from\n#pragma maplibre: define lowp vec4 pattern_to\nvoid main() {\n#pragma maplibre: initialize lowp float opacity\n#pragma maplibre: initialize highp vec4 color\n#pragma maplibre: initialize mediump vec4 pattern_from\n#pragma maplibre: 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);if (u_sdf_pattern) {highp float sdf_edge=(256.0-64.0)/256.0;highp float sdf_gamma_a=max(fwidth(color1.a)*0.5,1.0/255.0/16.0);highp float sdf_gamma_b=max(fwidth(color2.a)*0.5,1.0/255.0/16.0);float sdf_alpha_a=smoothstep(sdf_edge-sdf_gamma_a,sdf_edge+sdf_gamma_a,color1.a);float sdf_alpha_b=smoothstep(sdf_edge-sdf_gamma_b,sdf_edge+sdf_gamma_b,color2.a);fragColor=mix(color*sdf_alpha_a,color*sdf_alpha_b,u_fade)*opacity;} else {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;layout(location=0) in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;\n#pragma maplibre: define lowp float opacity\n#pragma maplibre: define highp vec4 color\n#pragma maplibre: define lowp vec4 pattern_from\n#pragma maplibre: define lowp vec4 pattern_to\n#pragma maplibre: define lowp float pixel_ratio_from\n#pragma maplibre: define lowp float pixel_ratio_to\nvoid main() {\n#pragma maplibre: initialize lowp float opacity\n#pragma maplibre: initialize highp vec4 color\n#pragma maplibre: initialize mediump vec4 pattern_from\n#pragma maplibre: initialize mediump vec4 pattern_to\n#pragma maplibre: initialize lowp float pixel_ratio_from\n#pragma maplibre: initialize lowp float pixel_ratio_to\nif (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}vec2 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:_P("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;layout(location=0) in vec2 a_pos;layout(location=1) in ivec4 a_normal_ed;\n#ifdef TERRAIN3D\nlayout(location=2) in vec2 a_centroid;\n#endif\nout vec4 v_color;\n#pragma maplibre: define highp float base\n#pragma maplibre: define highp float height\n#pragma maplibre: define highp vec4 color\nvoid main() {\n#pragma maplibre: initialize highp float base\n#pragma maplibre: initialize highp float height\n#pragma maplibre: initialize highp vec4 color\nvec3 normal=vec3(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=float(a_normal_ed.x & 1);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:_P("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 maplibre: define lowp float base\n#pragma maplibre: define lowp float height\n#pragma maplibre: define lowp vec4 pattern_from\n#pragma maplibre: define lowp vec4 pattern_to\n#pragma maplibre: define lowp float pixel_ratio_from\n#pragma maplibre: define lowp float pixel_ratio_to\nvoid main() {\n#pragma maplibre: initialize lowp float base\n#pragma maplibre: initialize lowp float height\n#pragma maplibre: initialize mediump vec4 pattern_from\n#pragma maplibre: initialize mediump vec4 pattern_to\n#pragma maplibre: initialize lowp float pixel_ratio_from\n#pragma maplibre: 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;layout(location=0) in vec2 a_pos;layout(location=1) in ivec4 a_normal_ed;\n#ifdef TERRAIN3D\nlayout(location=2) in 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 maplibre: define lowp float base\n#pragma maplibre: define lowp float height\n#pragma maplibre: define lowp vec4 pattern_from\n#pragma maplibre: define lowp vec4 pattern_to\n#pragma maplibre: define lowp float pixel_ratio_from\n#pragma maplibre: define lowp float pixel_ratio_to\nvoid main() {\n#pragma maplibre: initialize lowp float base\n#pragma maplibre: initialize lowp float height\n#pragma maplibre: initialize mediump vec4 pattern_from\n#pragma maplibre: initialize mediump vec4 pattern_to\n#pragma maplibre: initialize lowp float pixel_ratio_from\n#pragma maplibre: 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=vec3(a_normal_ed.xyz);float edgedistance=float(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=float(a_normal_ed.x & 1);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=a_normal_ed.x==1 && a_normal_ed.y==0 && a_normal_ed.z==16384\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:_P("#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(ivec2 texel) {vec4 data=texelFetch(u_image,texel,0)*255.0;data.a=-1.0;return dot(data,u_unpack);}void main() {ivec2 pos=ivec2(gl_FragCoord.xy)+ivec2(1);float tileSize=u_dimension.x-4.0;float a=getElevation(pos+ivec2(-1,-1));float b=getElevation(pos+ivec2(0,-1));float c=getElevation(pos+ivec2(1,-1));float d=getElevation(pos+ivec2(-1,0));float e=getElevation(pos);float f=getElevation(pos+ivec2(1,0));float g=getElevation(pos+ivec2(-1,1));float h=getElevation(pos+ivec2(0,1));float i=getElevation(pos+ivec2(1,1));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;layout(location=0) in vec2 a_pos;layout(location=1) 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:_P("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() {vec2 size=vec2(textureSize(u_image,0));vec2 texturePos=(v_pos*(size-2.0)+1.0)/size;vec4 pixel=texture(u_image,texturePos);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;layout(location=0) 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:_P("flat in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma maplibre: define highp vec4 color\n#pragma maplibre: define lowp float blur\n#pragma maplibre: define lowp float opacity\nvoid main() {\n#pragma maplibre: initialize highp vec4 color\n#pragma maplibre: initialize lowp float blur\n#pragma maplibre: initialize lowp float opacity\nclipAntimeridian();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);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\nlayout(location=0) in ivec2 a_pos_normal;layout(location=1) in uvec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;out vec2 v_normal;flat 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 maplibre: define highp vec4 color\n#pragma maplibre: define lowp float blur\n#pragma maplibre: define lowp float opacity\n#pragma maplibre: define mediump float gapwidth\n#pragma maplibre: define lowp float offset\n#pragma maplibre: define mediump float width\nvoid main() {\n#pragma maplibre: initialize highp vec4 color\n#pragma maplibre: initialize lowp float blur\n#pragma maplibre: initialize lowp float opacity\n#pragma maplibre: initialize mediump float gapwidth\n#pragma maplibre: initialize lowp float offset\n#pragma maplibre: initialize mediump float width\nif (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=vec2(ivec2(a_data.xy)-128);float a_direction=float(int(a_data.z & 3u)-1);v_linesofar=float((a_data.z >> 2u)+a_data.w*64u)*2.0;vec2 pos=vec2(a_pos_normal >> 1);mediump vec2 normal=vec2(a_pos_normal & 1);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:_P("uniform sampler2D u_image;flat 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 maplibre: define lowp float blur\n#pragma maplibre: define lowp float opacity\nvoid main() {\n#pragma maplibre: initialize lowp float blur\n#pragma maplibre: initialize lowp float opacity\nclipAntimeridian();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);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\nlayout(location=0) in ivec2 a_pos_normal;layout(location=1) in uvec4 a_data;layout(location=2) in float a_uv_x;layout(location=3) in float a_split_index;uniform vec2 u_translation;uniform mediump float u_ratio;uniform float u_image_height;out vec2 v_normal;flat 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 maplibre: define lowp float blur\n#pragma maplibre: define lowp float opacity\n#pragma maplibre: define mediump float gapwidth\n#pragma maplibre: define lowp float offset\n#pragma maplibre: define mediump float width\nvoid main() {\n#pragma maplibre: initialize lowp float blur\n#pragma maplibre: initialize lowp float opacity\n#pragma maplibre: initialize mediump float gapwidth\n#pragma maplibre: initialize lowp float offset\n#pragma maplibre: initialize mediump float width\nif (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=vec2(ivec2(a_data.xy)-128);float a_direction=float(int(a_data.z & 3u)-1);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=vec2(a_pos_normal >> 1);mediump vec2 normal=vec2(a_pos_normal & 1);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:_P("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;in vec2 v_normal;flat in vec2 v_width2;in float v_linesofar;in float v_gamma_scale;flat in float v_width;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma maplibre: define lowp vec4 pattern_from\n#pragma maplibre: define lowp vec4 pattern_to\n#pragma maplibre: define lowp float pixel_ratio_from\n#pragma maplibre: define lowp float pixel_ratio_to\n#pragma maplibre: define lowp float blur\n#pragma maplibre: define lowp float opacity\nvoid main() {\n#pragma maplibre: initialize mediump vec4 pattern_from\n#pragma maplibre: initialize mediump vec4 pattern_to\n#pragma maplibre: initialize lowp float pixel_ratio_from\n#pragma maplibre: initialize lowp float pixel_ratio_to\n#pragma maplibre: initialize lowp float blur\n#pragma maplibre: initialize lowp float opacity\nclipAntimeridian();vec2 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\nlayout(location=0) in ivec2 a_pos_normal;layout(location=1) in uvec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;out vec2 v_normal;flat out vec2 v_width2;out float v_linesofar;out float v_gamma_scale;flat out float v_width;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma maplibre: define lowp float blur\n#pragma maplibre: define lowp float opacity\n#pragma maplibre: define lowp float offset\n#pragma maplibre: define mediump float gapwidth\n#pragma maplibre: define mediump float width\n#pragma maplibre: define lowp float floorwidth\n#pragma maplibre: define lowp vec4 pattern_from\n#pragma maplibre: define lowp vec4 pattern_to\n#pragma maplibre: define lowp float pixel_ratio_from\n#pragma maplibre: define lowp float pixel_ratio_to\nvoid main() {\n#pragma maplibre: initialize lowp float blur\n#pragma maplibre: initialize lowp float opacity\n#pragma maplibre: initialize lowp float offset\n#pragma maplibre: initialize mediump float gapwidth\n#pragma maplibre: initialize mediump float width\n#pragma maplibre: initialize lowp float floorwidth\n#pragma maplibre: initialize mediump vec4 pattern_from\n#pragma maplibre: initialize mediump vec4 pattern_to\n#pragma maplibre: initialize lowp float pixel_ratio_from\n#pragma maplibre: initialize lowp float pixel_ratio_to\nif (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=vec2(ivec2(a_data.xy)-128);float a_direction=float(int(a_data.z & 3u)-1);float a_linesofar=float((a_data.z >> 2u)+a_data.w*64u)*LINE_DISTANCE_SCALE;vec2 pos=vec2(a_pos_normal >> 1);mediump vec2 normal=vec2(a_pos_normal & 1);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:_P("uniform lowp float u_lineatlas_width;uniform sampler2D u_image;uniform float u_mix;in vec2 v_normal;flat 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 maplibre: define highp vec4 color\n#pragma maplibre: define lowp float blur\n#pragma maplibre: define lowp float opacity\n#pragma maplibre: define mediump float width\n#pragma maplibre: define lowp float floorwidth\n#pragma maplibre: define mediump vec4 dasharray_from\n#pragma maplibre: define mediump vec4 dasharray_to\nvoid main() {\n#pragma maplibre: initialize highp vec4 color\n#pragma maplibre: initialize lowp float blur\n#pragma maplibre: initialize lowp float opacity\n#pragma maplibre: initialize mediump float width\n#pragma maplibre: initialize lowp float floorwidth\n#pragma maplibre: initialize mediump vec4 dasharray_from\n#pragma maplibre: initialize mediump vec4 dasharray_to\nclipAntimeridian();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 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);float sdfgamma=(u_lineatlas_width/256.0/u_device_pixel_ratio)/min(dasharray_from.w,dasharray_to.w);alpha*=smoothstep(0.5-sdfgamma/floorwidth,0.5+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\nlayout(location=0) in ivec2 a_pos_normal;layout(location=1) in uvec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;uniform float u_tileratio;uniform float u_crossfade_from;uniform float u_crossfade_to;uniform float u_lineatlas_height;out vec2 v_normal;flat 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 maplibre: define highp vec4 color\n#pragma maplibre: define lowp float blur\n#pragma maplibre: define lowp float opacity\n#pragma maplibre: define mediump float gapwidth\n#pragma maplibre: define lowp float offset\n#pragma maplibre: define mediump float width\n#pragma maplibre: define lowp float floorwidth\n#pragma maplibre: define mediump vec4 dasharray_from\n#pragma maplibre: define mediump vec4 dasharray_to\nvoid main() {\n#pragma maplibre: initialize highp vec4 color\n#pragma maplibre: initialize lowp float blur\n#pragma maplibre: initialize lowp float opacity\n#pragma maplibre: initialize mediump float gapwidth\n#pragma maplibre: initialize lowp float offset\n#pragma maplibre: initialize mediump float width\n#pragma maplibre: initialize lowp float floorwidth\n#pragma maplibre: initialize mediump vec4 dasharray_from\n#pragma maplibre: initialize mediump vec4 dasharray_to\nif (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=vec2(ivec2(a_data.xy)-128);float a_direction=float(int(a_data.z & 3u)-1);float a_linesofar=float((a_data.z >> 2u)+a_data.w*64u)*LINE_DISTANCE_SCALE;vec2 pos=vec2(a_pos_normal >> 1);mediump vec2 normal=vec2(a_pos_normal & 1);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\nfloat u_patternscale_a_x=u_tileratio/dasharray_from.w/u_crossfade_from;float u_patternscale_a_y=-dasharray_from.z/2.0/u_lineatlas_height;float u_patternscale_b_x=u_tileratio/dasharray_to.w/u_crossfade_to;float u_patternscale_b_y=-dasharray_to.z/2.0/u_lineatlas_height;v_tex_a=vec2(a_linesofar*u_patternscale_a_x/floorwidth,normal.y*u_patternscale_a_y+(float(dasharray_from.y)+0.5)/u_lineatlas_height);v_tex_b=vec2(a_linesofar*u_patternscale_b_x/floorwidth,normal.y*u_patternscale_b_y+(float(dasharray_to.y)+0.5)/u_lineatlas_height);v_width2=vec2(outset,inset);}"),lineGradientSDF:_P("uniform sampler2D u_image;uniform sampler2D u_image_dash;uniform float u_mix;uniform lowp float u_lineatlas_width;in vec2 v_normal;flat in vec2 v_width2;in vec2 v_tex_a;in vec2 v_tex_b;in float v_gamma_scale;in highp vec2 v_uv;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma maplibre: define lowp float blur\n#pragma maplibre: define lowp float opacity\n#pragma maplibre: define mediump float width\n#pragma maplibre: define lowp float floorwidth\n#pragma maplibre: define mediump vec4 dasharray_from\n#pragma maplibre: define mediump vec4 dasharray_to\nvoid main() {\n#pragma maplibre: initialize lowp float blur\n#pragma maplibre: initialize lowp float opacity\n#pragma maplibre: initialize mediump float width\n#pragma maplibre: initialize lowp float floorwidth\n#pragma maplibre: initialize mediump vec4 dasharray_from\n#pragma maplibre: initialize mediump vec4 dasharray_to\nclipAntimeridian();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);vec4 color=texture(u_image,v_uv);float sdfdist_a=texture(u_image_dash,v_tex_a).a;float sdfdist_b=texture(u_image_dash,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);float sdfgamma=(u_lineatlas_width/256.0)/min(dasharray_from.w,dasharray_to.w);float dash_alpha=smoothstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);fragColor=color*(alpha*dash_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\nlayout(location=0) in ivec2 a_pos_normal;layout(location=1) in uvec4 a_data;layout(location=2) in float a_uv_x;layout(location=3) in float a_split_index;uniform vec2 u_translation;uniform mediump float u_ratio;uniform float u_image_height;uniform float u_tileratio;uniform float u_crossfade_from;uniform float u_crossfade_to;uniform float u_lineatlas_height;out vec2 v_normal;flat out vec2 v_width2;out float v_gamma_scale;out highp vec2 v_uv;out vec2 v_tex_a;out vec2 v_tex_b;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma maplibre: define lowp float blur\n#pragma maplibre: define lowp float opacity\n#pragma maplibre: define mediump float gapwidth\n#pragma maplibre: define lowp float offset\n#pragma maplibre: define mediump float width\n#pragma maplibre: define lowp float floorwidth\n#pragma maplibre: define mediump vec4 dasharray_from\n#pragma maplibre: define mediump vec4 dasharray_to\nvoid main() {\n#pragma maplibre: initialize lowp float blur\n#pragma maplibre: initialize lowp float opacity\n#pragma maplibre: initialize mediump float gapwidth\n#pragma maplibre: initialize lowp float offset\n#pragma maplibre: initialize mediump float width\n#pragma maplibre: initialize lowp float floorwidth\n#pragma maplibre: initialize mediump vec4 dasharray_from\n#pragma maplibre: initialize mediump vec4 dasharray_to\nif (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=vec2(ivec2(a_data.xy)-128);float a_direction=float(int(a_data.z & 3u)-1);float a_linesofar=float((a_data.z >> 2u)+a_data.w*64u)*LINE_DISTANCE_SCALE;float texel_height=1.0/u_image_height;float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=vec2(a_pos_normal >> 1);mediump vec2 normal=vec2(a_pos_normal & 1);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\nfloat u_patternscale_a_x=u_tileratio/dasharray_from.w/u_crossfade_from;float u_patternscale_a_y=-dasharray_from.z/2.0/u_lineatlas_height;float u_patternscale_b_x=u_tileratio/dasharray_to.w/u_crossfade_to;float u_patternscale_b_y=-dasharray_to.z/2.0/u_lineatlas_height;v_tex_a=vec2(a_linesofar*u_patternscale_a_x/floorwidth,normal.y*u_patternscale_a_y+(float(dasharray_from.y)+0.5)/u_lineatlas_height);v_tex_b=vec2(a_linesofar*u_patternscale_b_x/floorwidth,normal.y*u_patternscale_b_y+(float(dasharray_to.y)+0.5)/u_lineatlas_height);v_width2=vec2(outset,inset);}"),layerOpacity:_P("uniform sampler2D u_image;uniform float u_opacity;in vec2 v_pos;void main() {fragColor=texture(u_image,v_pos)*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(0.0);\n#endif\n}","layout(location=0) in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=vec4(a_pos.x*2.0-1.0,1.0-a_pos.y*2.0,0.0,1.0);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"),raster:_P("uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;in vec3 v_pos0;in vec3 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.xy/v_pos0.z);vec4 color1=texture(u_image1,v_pos1.xy/v_pos1.z);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 vec3 u_image_warp;uniform vec4 u_coords_top;uniform vec4 u_coords_bottom;layout(location=0) in vec2 a_pos;out vec3 v_pos0;out vec3 v_pos1;void main() {vec2 fractionalPos=a_pos/8192.0;vec2 topLeft=u_coords_top.xy;vec2 topRight=u_coords_top.zw;vec2 bottomLeft=u_coords_bottom.xy;vec2 bottomRight=u_coords_bottom.zw;vec2 bilinearPos=mix(mix(topLeft,topRight,fractionalPos.x),mix(bottomLeft,bottomRight,fractionalPos.x),fractionalPos.y);float denominator=dot(u_image_warp.xy,fractionalPos)+1.0;vec2 acrossTop=topRight-topLeft+u_image_warp.x*topRight;vec2 downLeft=bottomLeft-topLeft+u_image_warp.y*bottomLeft;vec2 projectivePos=(acrossTop*fractionalPos.x+downLeft*fractionalPos.y+topLeft)/denominator;vec2 position=mix(projectivePos,bilinearPos,u_image_warp.z);gl_Position=projectTile(position,position);vec2 texturePos=((fractionalPos-0.5)/u_buffer_scale)+0.5;\n#ifdef GLOBE\nif (a_pos.y <-32767.5) {texturePos.y=0.0;}if (a_pos.y > 32766.5) {texturePos.y=1.0;}\n#endif\nfloat perspectiveRatio=mix(1.0/denominator,1.0,u_image_warp.z);v_pos0=vec3(texturePos*perspectiveRatio,perspectiveRatio);vec2 parentPos=(texturePos*u_scale_parent)+u_tl_parent;v_pos1=vec3(parentPos*perspectiveRatio,perspectiveRatio);}"),symbolIcon:_P("uniform sampler2D u_texture;in vec2 v_tex;flat in float v_total_opacity;void main() {fragColor=texture(u_texture,v_tex)*v_total_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","layout(location=0) in vec4 a_pos_offset;layout(location=1) in uvec4 a_data;layout(location=2) in vec4 a_pixeloffset;layout(location=3) in vec3 a_projected_pos;layout(location=4) in uint a_fade_opacity;layout(location=5) in float a_height_offset;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 bool u_rotate_symbol;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;uniform bool u_is_offset;uniform bool u_height_anchor_ground;out vec2 v_tex;flat out float v_total_opacity;\n#pragma maplibre: define lowp float opacity\nvoid main() {\n#pragma maplibre: initialize lowp float opacity\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=vec2(a_data.xy);vec2 a_size=vec2(a_data.zw);float a_size_min=float(a_data.z >> 1u);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=a_height_offset+(u_height_anchor_ground ? get_elevation(a_pos) : 0.0);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);vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_symbol_fade_change :-u_symbol_fade_change;float visibility=calculate_visibility(projectedPoint);v_total_opacity=opacity*max(0.0,min(visibility,fade_opacity[0]+fade_change));if (v_total_opacity < 0.1){gl_Position=vec4(-2.,-2.,-2.,1.);return;}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);if (!u_is_offset) {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;}"),symbolSDF:_P("#define SDF_PX 8.0\nuniform bool u_is_halo;uniform bool u_is_plain;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform bool u_is_text;in vec2 v_data0;in vec3 v_data1;\n#pragma maplibre: define highp vec4 fill_color\n#pragma maplibre: define highp vec4 halo_color\n#pragma maplibre: define lowp float halo_width\n#pragma maplibre: define lowp float halo_blur\nvoid main() {\n#pragma maplibre: initialize highp vec4 fill_color\n#pragma maplibre: initialize highp vec4 halo_color\n#pragma maplibre: initialize lowp float halo_width\n#pragma maplibre: 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 total_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float inner_edge=(256.0-64.0)/256.0;lowp float dist=texture(u_texture,tex).a;lowp vec4 color_alpha_out_text,color_alpha_out_halo;if (u_is_plain){highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(inner_edge-gamma_scaled,inner_edge+gamma_scaled,dist);color_alpha_out_text=total_opacity*alpha*fill_color;}if (u_is_halo) {float gamma_halo=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);float inner_edge_halo=inner_edge+gamma_halo*gamma_scale;highp float gamma_scaled_halo=gamma_halo*gamma_scale;highp float alpha_halo=smoothstep(inner_edge_halo-gamma_scaled_halo,inner_edge_halo+gamma_scaled_halo,dist);highp float halo_edge=(6.0-halo_width/fontScale)/SDF_PX;alpha_halo= min(smoothstep(halo_edge-gamma_scaled_halo,halo_edge+gamma_scaled_halo,dist),1.0-alpha_halo);color_alpha_out_halo=total_opacity*alpha_halo*halo_color;}if (u_is_plain && u_is_halo) {fragColor=color_alpha_out_text+(1.-color_alpha_out_text.a)*color_alpha_out_halo;} else if (u_is_halo){fragColor=color_alpha_out_halo;} else {fragColor=color_alpha_out_text;}\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","layout(location=0) in vec4 a_pos_offset;layout(location=1) in uvec4 a_data;layout(location=2) in vec4 a_pixeloffset;layout(location=3) in vec3 a_projected_pos;layout(location=4) in uint a_fade_opacity;layout(location=5) in float a_height_offset;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 bool u_rotate_symbol;uniform vec2 u_texsize;uniform vec2 u_translation;uniform float u_pitched_scale;uniform bool u_is_offset;uniform bool u_height_anchor_ground;out vec2 v_data0;out vec3 v_data1;\n#pragma maplibre: define highp vec4 fill_color\n#pragma maplibre: define highp vec4 halo_color\n#pragma maplibre: define lowp float opacity\n#pragma maplibre: define lowp float halo_width\n#pragma maplibre: define lowp float halo_blur\nvoid main() {\n#pragma maplibre: initialize highp vec4 fill_color\n#pragma maplibre: initialize highp vec4 halo_color\n#pragma maplibre: initialize lowp float opacity\n#pragma maplibre: initialize lowp float halo_width\n#pragma maplibre: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=vec2(a_data.xy);vec2 a_size=vec2(a_data.zw);float a_size_min=float(a_data.z >> 1u);vec2 a_pxoffset=a_pixeloffset.xy/16.0;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=a_height_offset+(u_height_anchor_ground ? get_elevation(a_pos) : 0.0);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);vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_symbol_fade_change :-u_symbol_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));float total_opacity=opacity*interpolated_fade_opacity;if (total_opacity < 0.1){gl_Position=vec4(-2.,-2.,-2.,1.);return;}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);if (!u_is_offset) {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)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,total_opacity);}"),symbolTextAndIcon:_P("#define SDF_PX 8.0\n#define SDF 1.0\n#define ICON 0.0\nuniform bool u_is_halo;uniform bool u_is_text;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;in vec4 v_data0;in vec3 v_data1;flat in float v_is_sdf;\n#pragma maplibre: define highp vec4 fill_color\n#pragma maplibre: define highp vec4 halo_color\n#pragma maplibre: define lowp float halo_width\n#pragma maplibre: define lowp float halo_blur\nvoid main() {\n#pragma maplibre: initialize highp vec4 fill_color\n#pragma maplibre: initialize highp vec4 halo_color\n#pragma maplibre: initialize lowp float halo_width\n#pragma maplibre: initialize lowp float halo_blur\nfloat total_opacity=v_data1[2];if (v_is_sdf==ICON) {vec2 tex_icon=v_data0.zw;fragColor=texture(u_texture_icon,tex_icon)*total_opacity;\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;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;lowp float dist=texture(u_texture,tex).a;lowp vec4 color_alpha_out,color_alpha_out_halo;if (u_is_text) {highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);color_alpha_out=fill_color*(alpha*total_opacity);}if (u_is_halo) {highp float gamma_halo=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);lowp float buff_halo=(6.0-halo_width/fontScale)/SDF_PX;highp float gamma_scaled_halo=gamma_halo*gamma_scale;highp float alpha_halo=smoothstep(buff_halo-gamma_scaled_halo,buff_halo+gamma_scaled_halo,dist);color_alpha_out_halo=halo_color*(alpha_halo*total_opacity);}if (u_is_text && u_is_halo) {fragColor=color_alpha_out+(1.-color_alpha_out.a)*color_alpha_out_halo;} else if (u_is_halo) {fragColor=color_alpha_out_halo;} else {fragColor=color_alpha_out;}\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","layout(location=0) in vec4 a_pos_offset;layout(location=1) in uvec4 a_data;layout(location=2) in vec3 a_projected_pos;layout(location=3) in uint a_fade_opacity;layout(location=4) in float a_height_offset;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_rotate_symbol;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;uniform bool u_is_offset;uniform bool u_height_anchor_ground;out vec4 v_data0;out vec3 v_data1;flat out float v_is_sdf;\n#pragma maplibre: define highp vec4 fill_color\n#pragma maplibre: define highp vec4 halo_color\n#pragma maplibre: define lowp float opacity\n#pragma maplibre: define lowp float halo_width\n#pragma maplibre: define lowp float halo_blur\nvoid main() {\n#pragma maplibre: initialize highp vec4 fill_color\n#pragma maplibre: initialize highp vec4 halo_color\n#pragma maplibre: initialize lowp float opacity\n#pragma maplibre: initialize lowp float halo_width\n#pragma maplibre: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=vec2(a_data.xy);vec2 a_size=vec2(a_data.zw);float a_size_min=float(a_data.z >> 1u);float is_sdf=float(a_data.z & 1u);float ele=a_height_offset+(u_height_anchor_ground ? get_elevation(a_pos) : 0.0);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);vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_symbol_fade_change :-u_symbol_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));float total_opacity=opacity*interpolated_fade_opacity;if (total_opacity < 0.1){gl_Position=vec4(-2.,-2.,-2.,1.);return;}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);if (!u_is_offset) {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;v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec3(gamma_scale,size,total_opacity);v_is_sdf=is_sdf;}"),terrain:_P("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 && u_fog_ground_blend_opacity > 0.0 && 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;}}","layout(location=0) 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,ele-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:_P("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);}","layout(location=0) 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;}"),atmosphere:_P("#ifdef GL_ES\nprecision highp float;\n#endif\nin 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;}","layout(location=0) 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:_P("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;uniform vec3 u_globe_position;uniform float u_globe_radius;in vec3 v_view_direction;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 (u_sky_blend > 0.0) {vec3 ray=normalize(v_view_direction);float globe_distance=length(u_globe_position);float angle_to_globe_center=acos(clamp(dot(ray,u_globe_position)/globe_distance,-1.0,1.0));float horizon_angle=asin(min(u_globe_radius/globe_distance,1.0));blend=mix(blend,(angle_to_globe_center-horizon_angle)*u_camera_to_center_distance*u_device_pixel_ratio,u_sky_blend);}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);}","layout(location=0) in vec2 a_pos;uniform mat4 u_inv_proj_matrix;out vec3 v_view_direction;void main() {v_view_direction=(u_inv_proj_matrix*vec4(a_pos,0.0,1.0)).xyz;gl_Position=vec4(a_pos,1.0,1.0);}")};function _P(e,t){let i=/#pragma maplibre: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,n=t.match(/in ([\w]+) ([\w]+)/g),a=e.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),r=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),s=r?r.concat(a):a,o=n?n.length:0,l={};return e=e.replace(i,(e,t,i,n,a)=>(l[a]=!0,"define"===t?`\n#ifndef HAS_UNIFORM_u_${a}\nin ${i} ${n} ${a};\n#else\nuniform ${i} ${n} u_${a};\n#endif\n`:`\n#ifdef HAS_UNIFORM_u_${a}\n ${i} ${n} ${a} = u_${a};\n#endif\n`)),t=t.replace(i,(e,t,i,n,a)=>{let r="float"===n?"vec2":"vec4",s=a.match(/color/)?"color":r;return l[a]?"define"===t?`\n#ifndef HAS_UNIFORM_u_${a}\nuniform lowp float u_${a}_t;\nlayout(location = ${o++}) in ${i} ${r} a_${a};\nout ${i} ${n} ${a};\n#else\nuniform ${i} ${n} u_${a};\n#endif\n`:"vec4"===s?`\n#ifndef HAS_UNIFORM_u_${a}\n ${a} = a_${a};\n#else\n ${i} ${n} ${a} = u_${a};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${a}\n ${a} = unpack_mix_${s}(a_${a}, u_${a}_t);\n#else\n ${i} ${n} ${a} = u_${a};\n#endif\n`:"define"===t?`\n#ifndef HAS_UNIFORM_u_${a}\nuniform lowp float u_${a}_t;\nlayout(location = ${o++}) in ${i} ${r} a_${a};\n#else\nuniform ${i} ${n} u_${a};\n#endif\n`:"vec4"===s?`\n#ifndef HAS_UNIFORM_u_${a}\n ${i} ${n} ${a} = a_${a};\n#else\n ${i} ${n} ${a} = u_${a};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${a}\n ${i} ${n} ${a} = unpack_mix_${s}(a_${a}, u_${a}_t);\n#else\n ${i} ${n} ${a} = u_${a};\n#endif\n`}),{fragmentSource:e,vertexSource:t,staticAttributes:n,staticUniforms:s}}const vP="#define PROJECTION_MERCATOR",yP="mercator";var xP=class{constructor(){this._cachedMesh=null}get name(){return"mercator"}get useSubdivision(){return!1}get shaderVariantName(){return yP}get shaderDefine(){return vP}get shaderPreludeCode(){return AP.projectionMercator}get vertexShaderPreludeCode(){return AP.projectionMercator.vertexSource}get subdivisionGranularity(){return Qy.noSubdivision}get useGlobeControls(){return!1}get transitionState(){return 0}destroy(){}getMeshFromTileID(e,t,i,n,a){if(this._cachedMesh)return this._cachedMesh;let r=new r_;r.emplaceBack(0,0),r.emplaceBack(Uu,0),r.emplaceBack(0,Uu),r.emplaceBack(Uu,Uu);let s=e.createVertexBuffer(r,zT.members),o=S_.simpleSegment(0,0,4,2),l=new b_;l.emplaceBack(1,0,2),l.emplaceBack(1,2,3);let c=e.createIndexBuffer(l);return this._cachedMesh=new FT(s,c,o),this._cachedMesh}recalculate(){}hasTransition(){return!1}},bP=class e{constructor(e=0,t=0,i=0,n=0){if(isNaN(e)||e<0||isNaN(t)||t<0||isNaN(i)||i<0||isNaN(n)||n<0)throw Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=e,this.bottom=t,this.left=i,this.right=n}interpolate(e,t,i){return null!=t.top&&null!=e.top&&(this.top=Ep.number(e.top,t.top,i)),null!=t.bottom&&null!=e.bottom&&(this.bottom=Ep.number(e.bottom,t.bottom,i)),null!=t.left&&null!=e.left&&(this.left=Ep.number(e.left,t.left,i)),null!=t.right&&null!=e.right&&(this.right=Ep.number(e.right,t.right,i)),this}getCenter(e,t){return new Hc(sh((this.left+e-this.right)/2,0,e),sh((this.top+t-this.bottom)/2,0,t))}equals(e){return this.top===e.top&&this.bottom===e.bottom&&this.left===e.left&&this.right===e.right}clone(){return new e(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}};function wP(e,t){if(!e.renderWorldCopies||e.lngRange)return;let i=t.lng-e.center.lng;t.lng+=i>180?-360:i<-180?360:0}function EP(e){return Math.max(0,Math.floor(e))}var kP=class{constructor(e,t){this.applyConstrain=(e,t)=>null===this._constrainOverride?this._callbacks.defaultConstrain(e,t):this._constrainOverride(e,t),this._callbacks=e,this._tileSize=512,this._renderWorldCopies=void 0===t?.renderWorldCopies||!!t?.renderWorldCopies,this._minZoom=t?.minZoom||0,this._maxZoom=t?.maxZoom||22,this._minPitch=null==t?.minPitch?0:t?.minPitch,this._maxPitch=null==t?.maxPitch?60:t?.maxPitch,this._constrainOverride=t?.constrainOverride??null,this.setMaxBounds(),this._width=0,this._height=0,this._center=new Ex(0,0),this._elevation=0,this._zoom=0,this._tileZoom=EP(this._zoom),this._scale=dh(this._zoom),this._bearingInRadians=0,this._fovInRadians=.6435011087932844,this._pitchInRadians=0,this._rollInRadians=0,this._unmodified=!0,this._edgeInsets=new bP,this._minElevationForCurrentTile=0,this._autoCalculateNearFarZ=!0}apply(e,t,i){this._constrainOverride=e.constrainOverride,this._latRange=e.latRange,this._lngRange=e.lngRange,this._width=e.width,this._height=e.height,this._center=e.center,this._elevation=e.elevation,this._minElevationForCurrentTile=e.minElevationForCurrentTile,this._zoom=e.zoom,this._tileZoom=EP(this._zoom),this._scale=dh(this._zoom),this._bearingInRadians=e.bearingInRadians,this._fovInRadians=e.fovInRadians,this._pitchInRadians=e.pitchInRadians,this._rollInRadians=e.rollInRadians,this._unmodified=e.unmodified,this._edgeInsets=new bP(e.padding.top,e.padding.bottom,e.padding.left,e.padding.right),this._minZoom=e.minZoom,this._maxZoom=e.maxZoom,this._minPitch=e.minPitch,this._maxPitch=e.maxPitch,this._renderWorldCopies=e.renderWorldCopies,this._cameraToCenterDistance=e.cameraToCenterDistance,this._nearZ=e.nearZ,this._farZ=e.farZ,this._autoCalculateNearFarZ=!i&&e.autoCalculateNearFarZ,t&&this.constrainInternal(),this._calcMatrices()}get pixelsToClipSpaceMatrix(){return this._pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._clipSpaceToPixelsMatrix}get minElevationForCurrentTile(){return this._minElevationForCurrentTile}setMinElevationForCurrentTile(e){this._minElevationForCurrentTile=e}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(e){if(this._minZoom===e)return;this._minZoom=e;let t=this._unmodified;this.setZoom(this.applyConstrain(this._center,this.zoom).zoom),this._unmodified=t}get maxZoom(){return this._maxZoom}setMaxZoom(e){if(this._maxZoom===e)return;this._maxZoom=e;let t=this._unmodified;this.setZoom(this.applyConstrain(this._center,this.zoom).zoom),this._unmodified=t}get minPitch(){return this._minPitch}setMinPitch(e){if(this._minPitch===e)return;this._minPitch=e;let t=this._unmodified;this.setPitch(Math.max(this.pitch,e)),this._unmodified=t}get maxPitch(){return this._maxPitch}setMaxPitch(e){if(this._maxPitch===e)return;this._maxPitch=e;let t=this._unmodified;this.setPitch(Math.min(this.pitch,e)),this._unmodified=t}get renderWorldCopies(){return this._renderWorldCopies}setRenderWorldCopies(e){void 0===e?e=!0:null===e&&(e=!1),this._renderWorldCopies=e}get constrainOverride(){return this._constrainOverride}setConstrainOverride(e){void 0===e&&(e=null),this._constrainOverride!==e&&(this._constrainOverride=e,this.constrainInternal(),this._calcMatrices())}get worldSize(){return this._tileSize*this._scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new Hc(this._width,this._height)}get bearing(){return this._bearingInRadians/Math.PI*180}setBearing(e){let t=oh(e,-180,180)*Math.PI/180;this._bearingInRadians!==t&&(this._unmodified=!1,this._bearingInRadians=t,this._calcMatrices(),this._rotationMatrix=XM(),function(e,t,i){var n=t[0],a=t[1],r=t[2],s=t[3],o=Math.sin(i),l=Math.cos(i);e[0]=n*l+r*o,e[1]=a*l+s*o,e[2]=n*-o+r*l,e[3]=a*-o+s*l}(this._rotationMatrix,this._rotationMatrix,-this._bearingInRadians))}get rotationMatrix(){return this._rotationMatrix}get pitchInRadians(){return this._pitchInRadians}get pitch(){return this._pitchInRadians/Math.PI*180}setPitch(e){let t=sh(e,this.minPitch,this.maxPitch)/180*Math.PI;this._pitchInRadians!==t&&(this._unmodified=!1,this._pitchInRadians=t,this._calcMatrices())}get rollInRadians(){return this._rollInRadians}get roll(){return this._rollInRadians/Math.PI*180}setRoll(e){let t=e/180*Math.PI;this._rollInRadians!==t&&(this._unmodified=!1,this._rollInRadians=t,this._calcMatrices())}get fovInRadians(){return this._fovInRadians}get fov(){return Ch(this._fovInRadians)}setFov(e){e=sh(e,.1,150),this.fov!==e&&(this._unmodified=!1,this._fovInRadians=Mh(e),this._calcMatrices())}get zoom(){return this._zoom}setZoom(e){let t=this.applyConstrain(this._center,e).zoom;this._zoom!==t&&(this._unmodified=!1,this._zoom=t,this._tileZoom=Math.max(0,Math.floor(t)),this._scale=dh(t),this.constrainInternal(),this._calcMatrices())}get center(){return this._center}setCenter(e){(e.lat!==this._center.lat||e.lng!==this._center.lng)&&(this._unmodified=!1,this._center=e,this.constrainInternal(),this._calcMatrices())}get elevation(){return this._elevation}setElevation(e){e!==this._elevation&&(this._elevation=e,this.constrainInternal(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}setPadding(e){this._edgeInsets.equals(e)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,e,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(e,t){this._autoCalculateNearFarZ=!1,this._nearZ=e,this._farZ=t,this._calcMatrices()}clearNearFarZOverride(){this._autoCalculateNearFarZ=!0,this._calcMatrices()}isPaddingEqual(e){return this._edgeInsets.equals(e)}interpolatePadding(e,t,i){this._unmodified=!1,this._edgeInsets.interpolate(e,t,i),this.constrainInternal(),this._calcMatrices()}resize(e,t,i=!0){this._width=e,this._height=t,i&&this.constrainInternal(),this._calcMatrices()}getMaxBounds(){return 2!==this._latRange?.length||2!==this._lngRange?.length?null:new gT([this._lngRange[0],this._latRange[0]],[this._lngRange[1],this._latRange[1]])}setMaxBounds(e){e?(this._lngRange=[e.getWest(),e.getEast()],this._latRange=[e.getSouth(),e.getNorth()],this.constrainInternal()):(this._lngRange=null,this._latRange=[-Ih,Ih])}getCameraQueryGeometry(e,t){if(1===t.length)return[t[0],e];{let{minX:i,minY:n,maxX:a,maxY:r}=px.fromPoints(t).extend(e);return[new Hc(i,n),new Hc(a,n),new Hc(a,r),new Hc(i,r),new Hc(i,n)]}}constrainInternal(){if(!this.center||!this._width||!this._height||this._constraining)return;this._constraining=!0;let e=this._unmodified,{center:t,zoom:i}=this.applyConstrain(this.center,this.zoom);this.setCenter(t),this.setZoom(i),this._unmodified=e,this._constraining=!1}_calcMatrices(){if(this._pixelPerMeter=Tx(1,this.center.lat)*this.worldSize,!this._width||!this._height)return;this._pixelsToGLUnits=[2/this._width,-2/this._height];let e=eu(new Float64Array(16));au(e,e,[this._width/2,-this._height/2,1]),nu(e,e,[1,-1,0]),this._clipSpaceToPixelsMatrix=e,e=eu(new Float64Array(16)),au(e,e,[1,-1,1]),nu(e,e,[-1,-1,0]),au(e,e,[2/this._width,2/this._height,1]),this._pixelsToClipSpaceMatrix=e;let t=this.fovInRadians/2;this._cameraToCenterDistance=.5/Math.tan(t)*this._height,this._callbacks.calcMatrices()}calculateCenterFromCameraLngLatAlt(e,t,i,n){let a,r,s=void 0===i?this.bearing:i,o=n=void 0===n?this.pitch:n,{distanceToCenter:l,clampedElevation:c}=this._distanceToCenterFromAltElevationPitch(t,this.elevation,o),{x:u,y:h}=jx(o,s),d=Fx.fromLngLat(e,t),p=Ix(1,d.y),m=0;do{if(m+=1,m>10)break;r=l/p;let e=u*r,t=h*r;a=new Fx(d.x+e,d.y+t),p=1/a.meterInMercatorCoordinateUnits()}while(Math.abs(l-r*p)>1e-12);return{center:a.toLngLat(),elevation:c,zoom:ph(this.height/2/Math.tan(this.fovInRadians/2)/r/this.tileSize)}}recalculateZoomAndCenter(e){if(this.elevation-e===0)return;let t=1/this.worldSize,i=Tx(1,this.center.lat)*this.worldSize,n=Fx.fromLngLat(this.center,this.elevation),a=n.x/t,r=n.y/t,s=n.z/t,o=this.pitch,l=this.bearing,{x:c,y:u,z:h}=jx(o,l),d=this.cameraToCenterDistance,p=a+d*-c,m=r+d*-u,g=s+d*h,{distanceToCenter:f,clampedElevation:A}=this._distanceToCenterFromAltElevationPitch(g/i,e,o),_=f*i,v=new Fx((p+c*_)*t,(m+u*_)*t,0).toLngLat(),y=Tx(1,v.lat),x=ph(this.height/2/Math.tan(this.fovInRadians/2)/f/y/this.tileSize);this._elevation=A,this._center=v,this.setZoom(x)}_distanceToCenterFromAltElevationPitch(e,t,i){let n,a=-Math.cos(Mh(i)),r=e-t,s=t;return a*r>=0||Math.abs(a)<.1?(n=1e4,s=e+n*a):n=-r/a,{distanceToCenter:n,clampedElevation:s}}getCameraPoint(){let e=this.pitchInRadians,t=Math.tan(e)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new Hc(t*Math.sin(this.rollInRadians),t*Math.cos(this.rollInRadians)))}getMercatorTileCoordinates(e){if(!e)return[0,0,1,1];let t=e.canonical.z>=0?1<<e.canonical.z:2**e.canonical.z;return[e.canonical.x/t,e.canonical.y/t,1/t/Uu,1/t/Uu]}},SP=class{distanceToTile2d(e,t,i,n){let a=n,r=a.distanceX([e,t]),s=a.distanceY([e,t]);return Math.hypot(r,s)}getWrap(e,t,i){return i}getTileBoundingVolume(e,t,i,n){let a=Math.min(0,i),r=Math.max(0,i);if(n?.terrain){let i=new HE(e.z,t,e.z,e.x,e.y),s=n.terrain.getMinMaxElevation(i);a=s.minElevation??a,r=s.maxElevation??r}let s=1<<e.z;return new XT([t+e.x/s,e.y/s,a],[t+(e.x+1)/s,(e.y+1)/s,r])}allowVariableZoom(e,t){let i=sh(78.5-e.fov*(Math.abs(Math.cos(e.rollInRadians))*e.height+Math.abs(Math.sin(e.rollInRadians))*e.width)/e.height/2,0,60);return!!t.terrain||e.pitch>i}allowWorldCopies(){return!0}prepareNextFrame(){}};const MP=xA([{name:"a_pos3d",type:"Int16",components:3}]);var CP=class extends id{constructor(e){super(),this._lastTilesetChange=tC(),this.tileManager=e,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.deltaZoom=1,this.tileSize=e._source.tileSize*2**this.deltaZoom,e.usedForTerrain=!0,e.tileSize=this.tileSize}destruct(){this.tileManager.usedForTerrain=!1,this.tileManager.tileSize=null,this.releaseAllRTT()}getSource(){return this.tileManager._source}update(e,t){this.tileManager.update(e,t),this._renderableTilesKeys=[];let i={},n=!1;for(let a of iD(e,{tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:t,calculateTileZoom:this.tileManager._source.calculateTileZoom}))i[a.key]=!0,this._renderableTilesKeys.push(a.key),this._tiles[a.key]||(a.terrainRttPosMatrix32f=new Float32Array(16),cu(a.terrainRttPosMatrix32f,0,Uu,Uu,0,0,1),this._tiles[a.key]=new WT(a,this.tileSize),this._lastTilesetChange=tC(),n=!0);for(let e in this._tiles)i[e]||(this._tiles[e].releaseRTT(this.tileManager.map.painter),delete this._tiles[e],n=!0);return n}releaseRTT(e){for(let t in this._tiles){let i=this._tiles[t];(i.tileID.equals(e)||i.tileID.isChildOf(e)||e.isChildOf(i.tileID))&&i.releaseRTT(this.tileManager.map.painter)}}releaseAllRTT(){for(let e in this._tiles)this._tiles[e].releaseRTT(this.tileManager.map.painter)}getRenderableTiles(){return this._renderableTilesKeys.map(e=>this.getTileByID(e))}getTileByID(e){return this._tiles[e]}getTerrainCoords(e,t){return t?this._getTerrainCoordsForTileRanges(e,t):this._getTerrainCoordsForRegularTile(e)}_getTerrainCoordsForRegularTile(e){let t={};for(let i of this._renderableTilesKeys){let n=this._tiles[i].tileID,a=e.clone(),r=Gu();if(n.canonical.equals(e.canonical))cu(r,0,Uu,Uu,0,0,1);else if(n.canonical.isChildOf(e.canonical)){let t=n.canonical.z-e.canonical.z,i=n.canonical.x-(n.canonical.x>>t<<t),a=n.canonical.y-(n.canonical.y>>t<<t),s=Uu>>t;cu(r,0,s,s,0,0,1),nu(r,r,[-i*s,-a*s,0])}else{if(!e.canonical.isChildOf(n.canonical))continue;{let t=e.canonical.z-n.canonical.z,i=e.canonical.x-(e.canonical.x>>t<<t),a=e.canonical.y-(e.canonical.y>>t<<t),s=Uu>>t;cu(r,0,Uu,Uu,0,0,1),nu(r,r,[i*s,a*s,0]),au(r,r,[1/2**t,1/2**t,0])}}a.terrainRttPosMatrix32f=new Float32Array(r),t[i]=a}return t}_getTerrainCoordsForTileRanges(e,t){let i={};for(let n of this._renderableTilesKeys){let a=this._tiles[n].tileID;if(!this._isWithinTileRanges(a,t))continue;let r=e.clone(),s=Gu();if(a.canonical.z===e.canonical.z){let t=e.canonical.x-a.canonical.x+e.wrap*(1<<e.canonical.z),i=e.canonical.y-a.canonical.y;cu(s,0,Uu,Uu,0,0,1),nu(s,s,[t*Uu,i*Uu,0])}else if(a.canonical.z>e.canonical.z){let t=a.canonical.z-e.canonical.z,i=a.canonical.x-(a.canonical.x>>t<<t)+e.wrap*(1<<a.canonical.z),n=a.canonical.y-(a.canonical.y>>t<<t),r=e.canonical.x-(a.canonical.x>>t),o=e.canonical.y-(a.canonical.y>>t),l=Uu>>t;cu(s,0,l,l,0,0,1),nu(s,s,[-i*l+r*Uu,-n*l+o*Uu,0])}else{let t=e.canonical.z-a.canonical.z,i=e.canonical.x-(e.canonical.x>>t<<t)+e.wrap*(1<<e.canonical.z),n=e.canonical.y-(e.canonical.y>>t<<t),r=(e.canonical.x>>t)-a.canonical.x,o=(e.canonical.y>>t)-a.canonical.y,l=Uu<<t;cu(s,0,l,l,0,0,1),nu(s,s,[i*Uu+r*l,n*Uu+o*l,0])}r.terrainRttPosMatrix32f=new Float32Array(s),i[n]=r}return i}getSourceTile(e,t){let i=this.tileManager._source,n=e.overscaledZ-this.deltaZoom;if(n>i.maxzoom&&(n=i.maxzoom),n<i.minzoom)return;this._sourceTileCache[e.key]||=e.scaledTo(n).key;let a=this.findTileInCaches(this._sourceTileCache[e.key]);if(!a?.dem&&t)for(;n>=i.minzoom&&!a?.dem;)a=this.findTileInCaches(e.scaledTo(n--).key);return a}findTileInCaches(e){let t=this.tileManager.getTileByID(e);return t||(t=this.tileManager._outOfViewCache.getByKey(e),t)}anyTilesAfterTime(e=tC()){return this._lastTilesetChange>=e}_isWithinTileRanges(e,t){let i=t[e.canonical.z];return!!i&&(e.wrap>i.minWrap||e.wrap<i.maxWrap||e.canonical.x>=i.minTileXWrapped&&e.canonical.x<=i.maxTileXWrapped&&e.canonical.y>=i.minTileY&&e.canonical.y<=i.maxTileY)}};const TP=Uu*(1-1e-12);var DP=class{constructor(e,t,i,n="auto"){this._meshCache={},this.painter=e,this.tileManager=new CP(t),this.options=i,this.exaggeration="number"==typeof i.exaggeration?i.exaggeration:1,this._terrainSkirtLength=n,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache=new Map,this._elevationSamplerCache=new Map}destroy(){this._fbo&&=(this._fbo.destroy(),null),this._fboDepthTexture&&=(this._fboDepthTexture.destroy(),null),this._emptyDemTexture&&=(this._emptyDemTexture.destroy(),null),this._emptyDepthTexture&&=(this._emptyDepthTexture.destroy(),null);for(let e in this._meshCache)this._meshCache[e].destroy();this._meshCache={},this.tileManager.destruct()}getDEMElevation(e,t,i,n=Uu){let a=e.normalizeCoordinates(t,i,n);if(!a)return 0;let r=this.getElevationSampler(a.tileID);return r?r(a.x,a.y,n):0}getElevationForLngLatZoom(e,t){if(!VE(t,e.wrap()))return 0;let{tileID:i,mercatorX:n,mercatorY:a}=this._getOverscaledTileIDFromLngLatZoom(e,t);return this.getElevation(i,n%Uu,a%Uu,Uu)}getElevationForLngLat(e,t){let i=this.getCoverageIndex();if(i){let t=Fx.fromLngLat(e),n=IP(i,this.exaggeration,t.x,t.y);if(n.demLoaded)return n.elevation}let n=iD(t,{maxzoom:this.tileManager.maxzoom,minzoom:this.tileManager.minzoom,tileSize:512,terrain:this}),a=0;for(let e of n)e.canonical.z>a&&(a=Math.min(e.canonical.z,this.tileManager.maxzoom));return this.getElevationForLngLatZoom(e,a)}getElevation(e,t,i,n=Uu){return this.getDEMElevation(e,t,i,n)*this.exaggeration}resetElevationCache(){this._elevationSamplerCache.clear(),this._coverageIndex=void 0}getCoverageIndex(){return void 0===this._coverageIndex&&(this._coverageIndex=this._buildCoverageIndex()),this._coverageIndex}_buildCoverageIndex(){let e=[],t=new Map,i=0,n=0;for(let a of this.tileManager.getRenderableTiles()){if(!a)continue;let{canonical:r,wrap:s}=a.tileID;e.includes(r.z)||e.push(r.z);let o=this.getElevationSampler(a.tileID);t.set(`${s}/${r.z}/${r.x}/${r.y}`,o);let{minElevation:l,maxElevation:c}=this.getMinMaxElevation(a.tileID);i=Math.min(i,l??0),n=Math.max(n,c??0)}return 0===t.size?null:(e.sort((e,t)=>t-e),{zooms:e,samplerPerTile:t,minElevation:i-10,maxElevation:n+10})}getElevationSampler(e){let t=e.key,i=this._elevationSamplerCache.get(t);if(i)return i;let n=this.tileManager.getSourceTile(e,!0),a=n?.dem;if(!n||!a)return null;let r=this._getDEMTileMatrix(e,n),s=r[0]*a.dim,o=r[5]*a.dim,l=r[12]*a.dim,c=r[13]*a.dim,u=(e,t,i)=>{let n=8192===i?1:Uu/i;return a.sampleBilinear(e*n*s+l,t*n*o+c)};return this._elevationSamplerCache.set(t,u),u}_getDEMTileMatrix(e,t){let i=`${t.tileID.key}/${e.key}`,n=this._demMatrixCache.get(i);if(n)return n;let a=this.tileManager.getSource().maxzoom,r=e.canonical.z-t.tileID.canonical.z;e.overscaledZ>e.canonical.z&&(e.canonical.z>=a?r=e.canonical.z-a:yh("cannot calculate elevation if elevation maxzoom > source.maxzoom"));let s=e.canonical.x-(e.canonical.x>>r<<r),o=e.canonical.y-(e.canonical.y>>r<<r),l=function(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t[2],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}(new Float64Array(16),[1/(Uu<<r),1/(Uu<<r),0]);return nu(l,l,[s*Uu,o*Uu,0]),this._demMatrixCache.set(i,l),l}getTerrainData(e){if(!this._emptyDemTexture){let e=this.painter.context,t=new Hv({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new iy(e,t,e.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new iy(e,new Hv({width:1,height:1}),e.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=eu([])}let t=this.tileManager.getSourceTile(e,!0);if(t?.dem&&(!t.demTexture||t.needsTerrainPrepare)){let e=this.painter.context;t.demTexture||=this.painter.getTileTexture(t.dem.stride),t.demTexture?t.demTexture.update(t.dem.getPixels(),{premultiply:!1}):t.demTexture=new iy(e,t.dem.getPixels(),e.gl.RGBA,{premultiply:!1}),t.demTexture.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),t.needsTerrainPrepare=!1}let i=t?this._getDEMTileMatrix(e,t):this._emptyDemMatrix;return{u_depth:2,u_terrain:3,u_terrain_dim:t?.dem?.dim||1,u_terrain_matrix:i,u_terrain_unpack:t?.dem?.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(t?.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:t}}getFramebuffer(){let e=this.painter,t=e.width/devicePixelRatio,i=e.height/devicePixelRatio;return this._fbo&&(this._fbo.width!==t||this._fbo.height!==i)&&(this._fbo.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture),this._fboDepthTexture||(this._fboDepthTexture=new iy(e.context,{width:t,height:i,data:null},e.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(e.context.gl.NEAREST,e.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=e.context.createFramebuffer(t,i,!0,!1),this._fbo.depthAttachment.set(e.context.createRenderbuffer(e.context.gl.DEPTH_COMPONENT16,t,i))),this._fbo.colorAttachment.set(this._fboDepthTexture.texture),this._fbo}depthAtPoint(e){let t=new Uint8Array(4),i=this.painter.context,n=i.gl;return i.bindFramebuffer.set(this.getFramebuffer().framebuffer),n.readPixels(e.x,this.painter.height/devicePixelRatio-e.y-1,1,1,n.RGBA,n.UNSIGNED_BYTE,t),i.bindFramebuffer.set(null),(t[0]/16777216+t[1]/65536+t[2]/256+t[3])/256}getTerrainMesh(e){let t=this.painter.style.projection?.transitionState>0,i=t&&0===e.canonical.y,n=t&&e.canonical.y===(1<<e.canonical.z)-1,a=`m_${i?"n":""}_${n?"s":""}`;if(this._meshCache[a])return this._meshCache[a];let r=this.painter.context,s=new s_,o=new b_,l=this.meshSize,c=Uu/l,u=l*l;for(let e=0;e<=l;e++)for(let t=0;t<=l;t++)s.emplaceBack(t*c,e*c,0);for(let e=0;e<u;e+=l+1)for(let t=0;t<l;t++)o.emplaceBack(t+e,l+t+e+1,l+t+e+2),o.emplaceBack(t+e,l+t+e+2,t+e+1);"none"!==this._terrainSkirtLength&&this._buildSkirts(s,o,l,c,i,n);let h=new FT(r.createVertexBuffer(s,MP.members),r.createIndexBuffer(o),S_.simpleSegment(0,0,s.length,o.length));return this._meshCache[a]=h,h}getSkirtLength(e){return 2*Math.PI*wx/2**Math.max(e,0)/5}getMinTileElevationForLngLatZoom(e,t){if(!VE(t,e.wrap()))return 0;let{tileID:i}=this._getOverscaledTileIDFromLngLatZoom(e,t);return this.getMinMaxElevation(i).minElevation??0}getMinMaxElevation(e){let t=this.tileManager.getSourceTile(e,!0),i={minElevation:null,maxElevation:null};return t?.dem&&(i.minElevation=t.dem.min*this.exaggeration,i.maxElevation=t.dem.max*this.exaggeration),i}_getOverscaledTileIDFromLngLatZoom(e,t){let i=Fx.fromLngLat(e.wrap()),n=(1<<t)*Uu,a=i.x*n,r=i.y*n,s=Math.floor(a/Uu),o=Math.floor(r/Uu);return{tileID:new HE(t,0,t,s,o),mercatorX:a,mercatorY:r}}_buildSkirts(e,t,i,n,a,r){let s=e.length,o=s+(i+1),l=(i+1)*i,c=a?Yy:0,u=+!a,h=r?Jy:Uu,d=+!r;for(let t=0;t<=i;t++)e.emplaceBack(t*n,c,u);for(let t=0;t<=i;t++)e.emplaceBack(t*n,h,d);for(let e=0;e<i;e++)t.emplaceBack(l+e,o+e,o+e+1),t.emplaceBack(l+e,o+e+1,l+e+1),t.emplaceBack(0+e,s+e+1,s+e),t.emplaceBack(0+e,0+e+1,s+e+1);let p=e.length,m=p+2*(i+1);for(let t of[0,1])for(let a=0;a<=i;a++)for(let i of[0,1])e.emplaceBack(t*Uu,a*n,i);for(let e=0;e<2*i;e+=2)t.emplaceBack(p+e,p+e+1,p+e+3),t.emplaceBack(p+e,p+e+3,p+e+2),t.emplaceBack(m+e,m+e+3,m+e+1),t.emplaceBack(m+e,m+e+2,m+e+3)}};const PP={covered:!1,demLoaded:!1,elevation:0};function IP(e,t,i,n){if(n<0||n>=1)return PP;let a=Math.floor(i),r=i-a;for(let i of e.zooms){let s=1<<i,o=r*s,l=n*s,c=Math.floor(o),u=Math.floor(l),h=`${a}/${i}/${c}/${u}`;if(!e.samplerPerTile.has(h))continue;let d=e.samplerPerTile.get(h);return d?{covered:!0,demLoaded:!0,elevation:d(Math.min((o-c)*Uu,TP),Math.min((l-u)*Uu,TP),Uu)*t}:{covered:!0,demLoaded:!1,elevation:0}}return PP}function FP(e,t){return e.covered&&t<=e.elevation+1e-6}function zP(e,t,i,n,a){for(let r=0;r<40&&n-i>a;r++){let a=(i+n)/2;t(e,a)?n=a:i=a}return{lo:i,hi:n}}var RP=class e{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(e){this._helper.setMinZoom(e)}setMaxZoom(e){this._helper.setMaxZoom(e)}setMinPitch(e){this._helper.setMinPitch(e)}setMaxPitch(e){this._helper.setMaxPitch(e)}setRenderWorldCopies(e){this._helper.setRenderWorldCopies(e)}setBearing(e){this._helper.setBearing(e)}setPitch(e){this._helper.setPitch(e)}setRoll(e){this._helper.setRoll(e)}setFov(e){this._helper.setFov(e)}setZoom(e){this._helper.setZoom(e)}setCenter(e){this._helper.setCenter(e)}setElevation(e){this._helper.setElevation(e)}setMinElevationForCurrentTile(e){this._helper.setMinElevationForCurrentTile(e)}setPadding(e){this._helper.setPadding(e)}interpolatePadding(e,t,i){this._helper.interpolatePadding(e,t,i)}isPaddingEqual(e){return this._helper.isPaddingEqual(e)}resize(e,t,i=!0){this._helper.resize(e,t,i)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(e){this._helper.setMaxBounds(e)}setConstrainOverride(e){this._helper.setConstrainOverride(e)}overrideNearFarZ(e,t){this._helper.overrideNearFarZ(e,t)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(e){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),e)}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 constrainOverride(){return this._helper.constrainOverride}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(e){}constructor(e){this._posMatrixCache=new Map,this._alignedPosMatrixCache=new Map,this._fogMatrixCacheF32=new Map,this.defaultConstrain=(e,t)=>{t=sh(+t,this.minZoom,this.maxZoom);let i={center:new Ex(e.lng,e.lat),zoom:t},n=this._helper._lngRange;!this._helper._renderWorldCopies&&null===n&&(n=[-179.9999999999,180-1e-10]);let a=this.tileSize*dh(i.zoom),r=0,s=a,o=0,l=a,c=0,u=0,{x:h,y:d}=this.size;if(this._helper._latRange){let e=this._helper._latRange;r=Cx(e[1])*a,s=Cx(e[0])*a,s-r<d&&(c=d/(s-r))}n&&(o=oh(Mx(n[0])*a,0,a),l=oh(Mx(n[1])*a,0,a),l<o&&(l+=a),l-o<h&&(u=h/(l-o)));let p,m,{x:g,y:f}=Lx(a,e),A=Math.max(u||0,c||0);if(A){let e=new Hc(u?(l+o)/2:g,c?(s+r)/2:f);return i.center=Bx(a,e).wrap(),i.zoom+=ph(A),i}if(this._helper._latRange){let e=d/2;f-e<r&&(m=r+e),f+e>s&&(m=s-e)}if(n){let e=(o+l)/2,t=g;this._helper._renderWorldCopies&&(t=oh(g,e-a/2,e+a/2));let i=h/2;t-i<o&&(p=o+i),t+i>l&&(p=l-i)}if(void 0!==p||void 0!==m){let e=new Hc(p??g,m??f);i.center=Bx(a,e).wrap()}return i},this.applyConstrain=(e,t)=>this._helper.applyConstrain(e,t),this._helper=new kP({calcMatrices:()=>this._calcMatrices(),defaultConstrain:(e,t)=>this.defaultConstrain(e,t)},e),this._coveringTilesDetailsProvider=new SP}clone(){let t=new e;return t.apply(this,!1),t}apply(e,t,i){this._helper.apply(e,t,i)}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(e){let t=[new GE(0,e)];if(this._helper._renderWorldCopies){let i=this.screenPointToMercatorCoordinate(new Hc(0,0)),n=this.screenPointToMercatorCoordinate(new Hc(this._helper._width,0)),a=this.screenPointToMercatorCoordinate(new Hc(this._helper._width,this._helper._height)),r=this.screenPointToMercatorCoordinate(new Hc(0,this._helper._height)),s=Math.floor(Math.min(i.x,n.x,a.x,r.x)),o=Math.floor(Math.max(i.x,n.x,a.x,r.x));for(let i=s-1;i<=o+1;i++)0!==i&&t.push(new GE(i,e))}return t}getCameraFrustum(){return QT.fromInvProjectionMatrix(this._invViewProjMatrix,this.worldSize)}getClippingPlane(){return null}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(e){let t=this.screenPointToLocation(this.centerPoint,e),i=e?e.getElevationForLngLat(t,this):0;this._helper.recalculateZoomAndCenter(i)}setLocationAtPoint(e,t,i=this.elevation){let n=i-this.elevation,a=this.screenPointToMercatorCoordinateAtZ(t,n),r=this.screenPointToMercatorCoordinateAtZ(this.centerPoint,0),s=Fx.fromLngLat(e),o=new Fx(s.x-(a.x-r.x),s.y-(a.y-r.y));this.setCenter(o?.toLngLat()),this._helper._renderWorldCopies&&this.setCenter(this.center.wrap())}locationToScreenPoint(e,t){return t?this.coordinatePoint(Fx.fromLngLat(e),t.getElevationForLngLat(e,this),this._pixelMatrix3D):this.coordinatePoint(Fx.fromLngLat(e))}screenPointToLocation(e,t){return this.screenPointToMercatorCoordinate(e,t)?.toLngLat()}screenPointToLocationAtElevation(e,t){return this.screenPointToMercatorCoordinateAtZ(e,t-this.elevation)?.toLngLat()}screenPointToMercatorCoordinate(e,t){if(t){let i=this.screenTerrainPointToMercatorCoordinate(e,t);if(null!=i)return i}return this.screenPointToMercatorCoordinateAtZ(e)}screenTerrainPointToMercatorCoordinate(e,t){let i=t.getCoverageIndex();if(!i)return null;let{near:n,far:a}=this.getRaySegmentFromPixel(e),r=this.worldSize,s=a[0]-n[0],o=a[1]-n[1],l=a[2]-n[2],c={index:i,exaggeration:t.exaggeration,near:n,dx:s,dy:o,dz:l,worldSize:r},u=0,h=1;if(0===l){if(n[2]>i.maxElevation||n[2]<i.minElevation)return null}else{let e=(i.maxElevation-n[2])/l,t=(i.minElevation-n[2])/l;if(u=Math.max(u,Math.min(e,t)),h=Math.min(h,Math.max(e,t)),u>h)return null}let d=Math.hypot(s,o),p=sh(Math.ceil(d*(h-u)/4),1,512),m=0,g=!BP(c,0);for(let e=0;e<=p;e++){let t=u+(h-u)*e/p;if(g){if(BP(c,t)){let{lo:e,hi:i}=zP(c,BP,m,t,.001/d),a=LP(c,e),u=LP(c,i),h=n[2]+e*l-a.elevation,p=n[2]+i*l-u.elevation,g=a.covered&&h>p?sh(e+h*(i-e)/(h-p),e,i):i;return new Fx((n[0]+g*s)/r,(n[1]+g*o)/r,LP(c,g).elevation)}}else g=!BP(c,t);m=t}return null}getRaySegmentFromPixel(e){let t=[e.x,e.y,0,1],i=[e.x,e.y,1,1];Mu(t,t,this._pixelMatrixInverse),Mu(i,i,this._pixelMatrixInverse);let n=t[3],a=i[3],r=this.elevation;return{near:[t[0]/n,t[1]/n,t[2]/n+r],far:[i[0]/a,i[1]/a,i[2]/a+r]}}screenPointToMercatorCoordinateAtZ(e,t){let i=t||0,{near:n,far:a}=this.getRaySegmentFromPixel(e),r=n[2]===a[2]?0:(i+this.elevation-n[2])/(a[2]-n[2]);return new Fx(Ep.number(n[0],a[0],r)/this.worldSize,Ep.number(n[1],a[1],r)/this.worldSize,i)}coordinatePoint(e,t=0,i=this._pixelMatrix){let n=[e.x*this.worldSize,e.y*this.worldSize,t,1];return Mu(n,n,i),new Hc(n[0]/n[3],n[1]/n[3])}getBounds(){let e=Math.max(0,this._helper._height/2-Ox(this));return(new gT).extend(this.screenPointToLocation(new Hc(0,e))).extend(this.screenPointToLocation(new Hc(this._helper._width,e))).extend(this.screenPointToLocation(new Hc(this._helper._width,this._helper._height))).extend(this.screenPointToLocation(new Hc(0,this._helper._height)))}isPointOnMapSurface(e,t){return t?null!=this.screenTerrainPointToMercatorCoordinate(e,t):e.y>this.height/2-Ox(this)}calculatePosMatrix(e,t=!1,i=!1){let n=e.key??WE(e.wrap,e.canonical.z,e.canonical.z,e.canonical.x,e.canonical.y),a=t?this._alignedPosMatrixCache:this._posMatrixCache;if(a.has(n)){let e=a.get(n);return i?e.f32:e.f64}let r=Ux(e,this.worldSize);iu(r,t?this._alignedProjMatrix:this._viewProjMatrix,r);let s={f64:r,f32:new Float32Array(r)};return a.set(n,s),i?s.f32:s.f64}calculateFogMatrix(e){let t=e.key,i=this._fogMatrixCacheF32;if(i.has(t))return i.get(t);let n=Ux(e,this.worldSize);return iu(n,this._fogMatrix,n),i.set(t,new Float32Array(n)),i.get(t)}calculateCenterFromCameraLngLatAlt(e,t,i,n){return this._helper.calculateCenterFromCameraLngLatAlt(e,t,i,n)}calculateCameraOptionsFromTo(e,t,i,n){let a=Fx.fromLngLat(e,t),r=Fx.fromLngLat(i,n),s=r.x-a.x,o=r.y-a.y,l=r.z-a.z,c=Math.hypot(s,o,l);if(0===c)throw Error("Can't calculate camera options with same From and To");let u=Math.hypot(s,o),h=ph(this.cameraToCenterDistance/c/this.tileSize),d=Ch(Math.atan2(s,-o)),p=Ch(Math.acos(u/c));return p=l<0?90-p:90+p,{center:r.toLngLat(),elevation:n,zoom:h,pitch:p,bearing:d}}_calculateNearFarZIfNeeded(e,t,i){if(!this._helper.autoCalculateNearFarZ)return;let n=Math.min(this.elevation,this.minElevationForCurrentTile,this.getCameraAltitude()-100),a=e-n*this._helper._pixelPerMeter/Math.cos(t),r=n<0?a:e,s=Math.PI/2+this.pitchInRadians,o=Mh(this.fov)*(Math.abs(Math.cos(Mh(this.roll)))*this.height+Math.abs(Math.sin(Mh(this.roll)))*this.width)/this.height*(.5+i.y/this.height),l=Math.sin(o)*r/Math.sin(sh(Math.PI-s-o,.01,Math.PI-.01)),c=Ox(this),u=Math.atan(c/this._helper.cameraToCenterDistance),h=Mh(.75),d=u>h?2*u*(.5+i.y/(2*c)):h,p=Math.sin(d)*r/Math.sin(sh(Math.PI-s-d,.01,Math.PI-.01)),m=Math.min(l,p);this._helper._farZ=1.01*(Math.cos(Math.PI/2-t)*m+r),this._helper._nearZ=this._helper._height/50}_calcMatrices(){let e,t=this.centerOffset,i=Lx(this.worldSize,this.center),n=i.x,a=i.y,r=Mh(Math.min(this.pitch,zx)),s=Math.max(this._helper.cameraToCenterDistance/2,this._helper.cameraToCenterDistance+this._helper._elevation*this._helper._pixelPerMeter/Math.cos(r));this._calculateNearFarZIfNeeded(s,r,t),e=new Float64Array(16),lu(e,this.fovInRadians,this._helper._width/this._helper._height,this._helper._nearZ,this._helper._farZ),this._invProjMatrix=new Float64Array(16),function(e,t){e[0]=1/t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1/t[5],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=0,e[11]=1/t[14],e[12]=0,e[13]=0,e[14]=-1,e[15]=t[10]/t[14]}(this._invProjMatrix,e),e[8]=2*-t.x/this._helper._width,e[9]=2*t.y/this._helper._height,this._projectionMatrix=$c(e),au(e,e,[1,-1,1]),nu(e,e,[0,0,-this._helper.cameraToCenterDistance]),ou(e,e,-this.rollInRadians),ru(e,e,this.pitchInRadians),ou(e,e,-this.bearingInRadians),nu(e,e,[-n,-a,0]),this._mercatorMatrix=au([],e,[this.worldSize,this.worldSize,this.worldSize]),au(e,e,[1,1,this._helper._pixelPerMeter]),this._pixelMatrix=iu(new Float64Array(16),this.clipSpaceToPixelsMatrix,e),nu(e,e,[0,0,-this.elevation]),this._viewProjMatrix=e,this._invViewProjMatrix=tu([],e);let o=[0,0,-1,1];Mu(o,o,this._invViewProjMatrix),this._cameraPosition=[o[0]/o[3],o[1]/o[3],o[2]/o[3]],this._fogMatrix=new Float64Array(16),lu(this._fogMatrix,this.fovInRadians,this.width/this.height,s,this._helper._farZ),this._fogMatrix[8]=2*-t.x/this.width,this._fogMatrix[9]=2*t.y/this.height,au(this._fogMatrix,this._fogMatrix,[1,-1,1]),nu(this._fogMatrix,this._fogMatrix,[0,0,-this.cameraToCenterDistance]),ou(this._fogMatrix,this._fogMatrix,-this.rollInRadians),ru(this._fogMatrix,this._fogMatrix,this.pitchInRadians),ou(this._fogMatrix,this._fogMatrix,-this.bearingInRadians),nu(this._fogMatrix,this._fogMatrix,[-n,-a,0]),au(this._fogMatrix,this._fogMatrix,[1,1,this._helper._pixelPerMeter]),nu(this._fogMatrix,this._fogMatrix,[0,0,-this.elevation]),this._pixelMatrix3D=iu(new Float64Array(16),this.clipSpaceToPixelsMatrix,e);let l=this._helper._width%2/2,c=this._helper._height%2/2,u=Math.cos(this.bearingInRadians),h=Math.sin(-this.bearingInRadians),d=n-Math.round(n)+u*l+h*c,p=a-Math.round(a)+u*c+h*l,m=new Float64Array(e);if(nu(m,m,[d>.5?d-1:d,p>.5?p-1:p,0]),this._alignedProjMatrix=m,e=tu(new Float64Array(16),this._pixelMatrix),!e)throw Error("failed to invert matrix");this._pixelMatrixInverse=e,this._clearMatrixCaches()}_clearMatrixCaches(){this._posMatrixCache.clear(),this._alignedPosMatrixCache.clear(),this._fogMatrixCacheF32.clear()}maxPitchScaleFactor(){if(!this._pixelMatrixInverse)return 1;let e=this.screenPointToMercatorCoordinate(new Hc(0,0)),t=[e.x*this.worldSize,e.y*this.worldSize,0,1];return Mu(t,t,this._pixelMatrix)[3]/this._helper.cameraToCenterDistance}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return Math.cos(this.pitchInRadians)*this.cameraToCenterDistance/this.pixelsPerMeter+this.elevation}getCameraLngLat(){let e=Tx(1,this.center.lat)*this.worldSize,t=this._helper.cameraToCenterDistance/e;return Nx(this.center,this.elevation,this.pitch,this.bearing,t).toLngLat()}lngLatToCameraDepth(e,t){let i=Fx.fromLngLat(e),n=[i.x*this.worldSize,i.y*this.worldSize,t,1];return Mu(n,n,this._viewProjMatrix),n[2]/n[3]}getProjectionData(e){let t,{overscaledTileID:i,aligned:n,applyTerrainMatrix:a}=e,r=this._helper.getMercatorTileCoordinates(i),s=i?this.calculatePosMatrix(i,n,!0):null;return t=i?.terrainRttPosMatrix32f&&a?i.terrainRttPosMatrix32f:s||Wu(),{mainMatrix:t,tileMercatorCoords:r,clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:t,clipAntimeridian:!1}}isLocationOccluded(e){return!1}getPixelScale(){return 1}getCircleRadiusCorrection(){return 1}getPitchedTextCorrection(e,t,i){return 1}transformLightDirection(e){return hu(e)}getRayDirectionFromPixel(e){throw Error("Not implemented.")}projectTileCoordinates(e,t,i,n){let a,r=this.calculatePosMatrix(i);null==n?(a=[e,t,0,1],UD(a,a,r)):(a=[e,t,n,1],Mu(a,a,r));let s=a[3];return{point:new Hc(a[0]/s,a[1]/s),signedDistanceFromCamera:s,isOccluded:!1}}populateCache(e){for(let t of e)this.calculatePosMatrix(t)}getProjectionDataForCustomLayer(e=!0){let t=new HE(0,0,0,0,0),i=this.getProjectionData({overscaledTileID:t,applyGlobeMatrix:e}),n=Ux(t,this.worldSize);iu(n,this._viewProjMatrix,n);let a=[Uu,Uu,this.worldSize/this._helper.pixelsPerMeter],r=Gu();return au(r,n,a),{...i,tileMercatorCoords:[0,0,1,1],fallbackMatrix:r,mainMatrix:r}}getFastPathSimpleProjectionMatrix(e){return this.calculatePosMatrix(e)}};function LP(e,t){return IP(e.index,e.exaggeration,(e.near[0]+t*e.dx)/e.worldSize,(e.near[1]+t*e.dy)/e.worldSize)}function BP(e,t){return FP(LP(e,t),e.near[2]+t*e.dz)}function OP(){yh("Map cannot fit within canvas with the given bounds, padding, and/or offset.")}function UP(e){if(e.useSlerp)if(e.k<1){let t=Ph(e.startEulerAngles.roll,e.startEulerAngles.pitch,e.startEulerAngles.bearing),i=Ph(e.endEulerAngles.roll,e.endEulerAngles.pitch,e.endEulerAngles.bearing),n=new Float64Array(4);Du(n,t,i,e.k);let a=function(e){let t=new Float64Array(9);!function(e,t){var i=t[0],n=t[1],a=t[2],r=t[3],s=i+i,o=n+n,l=a+a,c=i*s,u=n*s,h=n*o,d=a*s,p=a*o,m=a*l,g=r*s,f=r*o,A=r*l;e[0]=1-h-m,e[3]=u-A,e[6]=d+f,e[1]=u+A,e[4]=1-c-m,e[7]=p-g,e[2]=d-f,e[5]=p+g,e[8]=1-c-h}(t,e);let i,n,a=Ch(-Math.asin(sh(t[2],-1,1)));return Math.hypot(t[5],t[8])<.001?(i=0,n=-Ch(Math.atan2(t[3],t[4]))):(i=Ch(0===t[5]&&0===t[8]?0:Math.atan2(t[5],t[8])),n=Ch(0===t[1]&&0===t[0]?0:Math.atan2(t[1],t[0]))),{roll:i,pitch:a+90,bearing:n}}(n);e.tr.setRoll(a.roll),e.tr.setPitch(a.pitch),e.tr.setBearing(a.bearing)}else e.tr.setRoll(e.endEulerAngles.roll),e.tr.setPitch(e.endEulerAngles.pitch),e.tr.setBearing(e.endEulerAngles.bearing);else e.tr.setRoll(Ep.number(e.startEulerAngles.roll,e.endEulerAngles.roll,e.k)),e.tr.setPitch(Ep.number(e.startEulerAngles.pitch,e.endEulerAngles.pitch,e.k)),e.tr.setBearing(Ep.number(e.startEulerAngles.bearing,e.endEulerAngles.bearing,e.k))}function NP(e,t,i,n,a){let r=a.padding,s=Lx(a.worldSize,i.getNorthWest()),o=Lx(a.worldSize,i.getNorthEast()),l=Lx(a.worldSize,i.getSouthEast()),c=Lx(a.worldSize,i.getSouthWest()),u=Mh(-n),h=s.rotate(u),d=o.rotate(u),p=l.rotate(u),m=c.rotate(u),g=new Hc(Math.max(h.x,d.x,m.x,p.x),Math.max(h.y,d.y,m.y,p.y)),f=new Hc(Math.min(h.x,d.x,m.x,p.x),Math.min(h.y,d.y,m.y,p.y)),A=g.sub(f),_=a.width-(r.left+r.right+t.left+t.right),v=a.height-(r.top+r.bottom+t.top+t.bottom),y=_/A.x,x=v/A.y;if(x<0||y<0)return void OP();let b=Math.min(ph(a.scale*Math.min(y,x)),e.maxZoom),w=Hc.convert(e.offset),E=new Hc((t.left-t.right)/2,(t.top-t.bottom)/2).rotate(Mh(n)),k=w.add(E).mult(a.scale/dh(b));return{center:Bx(a.worldSize,s.add(l).div(2).sub(k)),zoom:b,bearing:n}}var jP=class{get useGlobeControls(){return!1}handlePanInertia(e,t){let i=e.mag(),n=Math.abs(Ox(t));return{easingOffset:e.mult(Math.min(.75*n/i,1)),easingCenter:t.center}}handleMapControlsRollPitchBearingZoom(e,t){e.bearingDelta&&t.setBearing(t.bearing+e.bearingDelta),e.pitchDelta&&t.setPitch(t.pitch+e.pitchDelta),e.rollDelta&&t.setRoll(t.roll+e.rollDelta),e.zoomDelta&&t.setZoom(t.zoom+e.zoomDelta)}handleMapControlsPan(e,t,i){e.around.distSqr(t.centerPoint)<.01||t.setLocationAtPoint(i,e.around,e.aroundElevation)}cameraForBoxAndBearing(e,t,i,n,a){return NP(e,t,i,n,a)}handleJumpToCenterZoom(e,t){let i=void 0===t.zoom?e.zoom:+t.zoom;e.zoom!==i&&e.setZoom(+t.zoom),void 0!==t.center&&e.setCenter(Ex.convert(t.center))}handleEaseTo(e,t){let i=e.zoom,n=e.padding,a={roll:e.roll,pitch:e.pitch,bearing:e.bearing},r={roll:void 0===t.roll?e.roll:t.roll,pitch:void 0===t.pitch?e.pitch:t.pitch,bearing:void 0===t.bearing?e.bearing:t.bearing},s=void 0!==t.zoom,o=!e.isPaddingEqual(t.padding),l=!1,c=s?+t.zoom:e.zoom,u=e.centerPoint.add(t.offsetAsPoint),h=e.screenPointToLocation(u),{center:d,zoom:p}=e.applyConstrain(Ex.convert(t.center||h),c??i);wP(e,d);let m=Lx(e.worldSize,h),g=Lx(e.worldSize,d).sub(m),f=dh(p-i);return l=p!==i,{easeFunc:s=>{if(l&&e.setZoom(Ep.number(i,p,s)),Th(a,r)||UP({startEulerAngles:a,endEulerAngles:r,tr:e,k:s,useSlerp:a.roll!=r.roll}),o&&(e.interpolatePadding(n,t.padding,s),u=e.centerPoint.add(t.offsetAsPoint)),t.around)e.setLocationAtPoint(t.around,t.aroundPoint);else{let t=dh(e.zoom-i),n=(p>i?Math.min(2,f):Math.max(.5,f))**(1-s),a=Bx(e.worldSize,m.add(g.mult(s*n)).mult(t));e.setLocationAtPoint(e.renderWorldCopies?a.wrap():a,u)}},isZooming:l,elevationCenter:d}}handleFlyTo(e,t){let i=void 0!==t.zoom,n=e.zoom,a=e.applyConstrain(Ex.convert(t.center||t.locationAtOffset),i?+t.zoom:n),r=a.center,s=a.zoom;wP(e,r);let o=e.worldSize,l=Lx(o,t.locationAtOffset),c=Lx(o,r).sub(l),u=c.mag(),h=dh(s-n),d=void 0===t.minZoom?e.minZoom:+t.minZoom,p=Math.max(d,e.minZoom),m=Math.min(p,n,s),g=e.applyConstrain(r,m).zoom;return{easeFunc:(t,i,a,u)=>{e.setZoom(1===t?s:n+ph(i));let h=1===t?r:Bx(o,l.add(c.mult(a)));e.setLocationAtPoint(e.renderWorldCopies?h.wrap():h,u)},scaleOfZoom:h,targetCenter:r,scaleOfMinZoom:dh(g-n),pixelPathLength:u}}};let VP;const qP=new Qy({fill:new Xy(128,2),line:new Xy(512,0),tile:new Xy(128,32),stencil:new Xy(128,1),circle:3});var GP=class{constructor(){this._tileMeshCache={}}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 AP.projectionGlobe}get vertexShaderPreludeCode(){return AP.projectionMercator.vertexSource}get subdivisionGranularity(){return qP}get useGlobeControls(){return!0}destroy(){}_getMeshKey(e){return`${e.granularity.toString(36)}_${e.generateBorders?"b":""}${e.extendToNorthPole?"n":""}${e.extendToSouthPole?"s":""}`}getMeshFromTileID(e,t,i,n,a){let r=("stencil"===a?qP.stencil:qP.tile).getGranularityForZoomLevel(t.z),s=0===t.y&&n,o=t.y===(1<<t.z)-1&&n;return this._getMesh(e,{granularity:r,generateBorders:i,extendToNorthPole:s,extendToSouthPole:o})}_getMesh(e,t){let i=this._getMeshKey(t);if(i in this._tileMeshCache)return this._tileMeshCache[i];let n=RT(e,t);return this._tileMeshCache[i]=n,n}recalculate(e){}hasTransition(){return!1}},HP=class extends id{constructor(e,t){super(),this._transitionable=new Yf(VP||=new uA({type:new rA(ad.projection.type,"type")}),"projection",t),this.setProjection(e),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new Zf(0)),this._mercatorProjection=new xP,this._verticalPerspectiveProjection=new GP}get transitionState(){let e=this.properties.get("type");if("string"==typeof e&&"mercator"===e)return 0;if("string"==typeof e&&"vertical-perspective"===e)return 1;if(e instanceof hp){if(e.from===e.to)return"mercator"===e.from?0:1;if("vertical-perspective"===e.from&&"mercator"===e.to)return 1-e.transition;if("mercator"===e.from&&"vertical-perspective"===e.to)return e.transition}return 1}get useGlobeRendering(){return this.transitionState>0}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()}getMeshFromTileID(e,t,i,n,a){return this.currentProjection.getMeshFromTileID(e,t,i,n,a)}setProjection(e){this._transitionable.setValue("type",e?.type||"mercator")}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()||this.currentProjection.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}};function WP(e){let t=XP(e.worldSize,e.center.lat);return 2*Math.PI*t}function ZP(e,t,i,n,a){let r=1/(1<<a),s=t/Uu*r+n*r,o=eh((e/Uu*r+i*r)*Math.PI*2+Math.PI,2*Math.PI),l=2*Math.atan(Math.exp(Math.PI-s*Math.PI*2))-.5*Math.PI,c=Math.cos(l),u=new Float64Array(3);return u[0]=Math.sin(o)*c,u[1]=Math.sin(l),u[2]=Math.cos(o)*c,u}function KP(e){return function(e,t){let i=Math.cos(t),n=new Float64Array(3);return n[0]=Math.sin(e)*i,n[1]=Math.sin(t),n[2]=Math.cos(e)*i,n}(e.lng*Math.PI/180,e.lat*Math.PI/180)}function XP(e,t){return e/(2*Math.PI)/Math.cos(t*Math.PI/180)}function QP(e){let t=Mu(Vu(),[0,0,0,1],e.modelViewProjectionMatrix);return Mu(t,t,e.inverseProjectionMatrix),[t[0]/t[3],t[1]/t[3],t[2]/t[3]]}function YP(e){let t=Math.asin(e[1])/Math.PI*180,i=Math.sqrt(e[0]*e[0]+e[2]*e[2]);if(i>1e-6){let n=e[0]/i,a=e[2]/i,r=Math.acos(a),s=(n>0?r:-r)/Math.PI*180;return new Ex(oh(s,-180,180),t)}return new Ex(0,t)}const JP=.98*Math.PI;function $P(e,t){let i=e.cameraPosition,n=du(i);if(n<=1)return e.screenPointToLocation(t);let a=qu();_u(a,i);let r=e.getRayDirectionFromPixel(t),s=-vu(r,a),o=qu();Au(o,r,a,s);let l=du(o);if(l<1e-9)return e.screenPointToLocation(t);let c=Math.atan2(l,s),u=.9*Math.asin(1/n);if(c<u)return e.screenPointToLocation(t);let h=n*Math.sin(u),d=Math.asin(sh(h,-1,1))-u,p=n*Math.cos(u)/Math.sqrt(Math.max(1-h*h,1e-12))-1,m=JP-d,g=c-u,f=d+p*g*m/(m+p*g),A=qu();fu(A,o,1/l);let _=qu();return fu(_,a,Math.cos(sh(f,0,JP))),Au(_,_,A,Math.sin(sh(f,0,JP))),_u(_,_),YP(_)}function eI(e,t,i,n,a=!0){let r=$P(e,i),s=t;if(n)s=$P(e,i.sub(n));else if(!e.isPointOnMapSurface(i))return;let o=KP(r),l=KP(s),c=function(e,t){return Pu(Vu(),-e.lng,-e.lat,t)}(e.center,e.bearing),u=yu(qu(),l,o),h=Math.sqrt(vu(u,u)),d=Math.acos(sh(vu(l,o),-1,1))/2,p=Math.sin(d),m=h?Iu(u[1]/h*p,-u[0]/h*p,u[2]/h*p,Math.cos(d)):Iu(0,0,0,1),{lng:g,lat:f,bearing:A}=function(e){let t=e[0],i=e[1],n=e[2],a=e[3];return{lng:180*-Math.atan2(2*(a*t+i*n),1-2*(t*t+i*i))/Math.PI,lat:180*-Math.asin(sh(2*(a*i-n*t),-1,1))/Math.PI,bearing:180*Math.atan2(2*(a*n+t*i),1-2*(i*i+n*n))/Math.PI}}(function(e,t,i){var n=t[0],a=t[1],r=t[2],s=t[3],o=i[0],l=i[1],c=i[2],u=i[3];return e[0]=n*u+s*o+a*c-r*l,e[1]=a*u+s*l+r*o-n*c,e[2]=r*u+s*c+n*l-a*o,e[3]=s*u-n*o-a*l-r*c,e}(Vu(),c,m)),_=e.center.lat,v=e.zoom,y=sh(f,-90,90),x=a?function(e,t,i,n){let a=e.center.lng,r=e.center.lat,s=r>=0?90:-90,o=e.locationToScreenPoint(new Ex(0,s)),l=t.x-o.x,c=t.y-o.y,u=l*l+c*c,h=sh(1-(Ih-Math.abs(r))/12,0,1),d=h*h*(3-2*h),p=eh(n-a+180,360)-180,m=0;if(d>0&&i){m=(s>0?1:-1)*((l*i.y-c*i.x)/Math.max(u,400))*180/Math.PI}return a+(1-d)*p+d*m}(e,i,n,g):g;e.setCenter(new Ex(oh(x,-180,180),y)),a||e.setBearing(A),e.setZoom(v+iI(_,e.center.lat))}function tI(e){return Math.cos(e*Math.PI/180)}function iI(e,t){let i=tI(e);return ph(tI(t)/i)}function nI(e,t){let i=e.rotate(t.bearingInRadians),n=t.zoom+iI(t.center.lat,0),a=ih(1/tI(t.center.lat),1/tI(Math.min(Math.abs(t.center.lat),60)),th(n,7,3,0,1)),r=function(e,t){return 360/WP({worldSize:e,center:{lat:t}})}(t.worldSize,t.center.lat);return new Ex(t.center.lng-i.x*r*a,sh(t.center.lat+i.y*r,-Ih,Ih))}function aI(e){let t=.5*e,i=Math.sin(t),n=Math.cos(t);return Math.log(i+n)-Math.log(n-i)}function rI(e,t,i,n){let a=e.lat+i*n;if(Math.abs(i)>1){let r=e.lat+i,s=(Math.sign(r)===Math.sign(e.lat)?Math.abs(e.lat):-Math.abs(e.lat))*Math.PI/180,o=Math.abs(e.lat+i)*Math.PI/180,l=aI(s+n*(o-s)),c=aI(s),u=(l-c)/(aI(o)-c),h=e.lng+t*u;return new Ex(h,a)}{let i=e.lng+t*n;return new Ex(i,a)}}function sI(e,t,i=1){let n=vu(e,t),a=i*i,r=qu(),s=qu();fu(s,t,n),ku(r,e,s);let o=a-vu(r,r);if(o<0)return null;let l=vu(e,e)-a,c=-n+(n<0?1:-1)*Math.sqrt(o),u=l/c,h=c;return{tMin:Math.min(u,h),tMax:Math.max(u,h)}}var oI=class{constructor(e){this._cachePrevious=new Map,this._cache=new Map,this._hadAnyChanges=!1,this._boundingVolumeFactory=e}swapBuffers(){if(!this._hadAnyChanges)return;let e=this._cachePrevious;this._cachePrevious=this._cache,this._cache=e,this._cache.clear(),this._hadAnyChanges=!1}getTileBoundingVolume(e,t,i,n){let a=`${e.z}_${e.x}_${e.y}_${n?.terrain?"t":""}_${Math.round(i)}`,r=this._cache.get(a);if(r)return r;let s=this._cachePrevious.get(a);if(s)return this._cache.set(a,s),s;let o=this._boundingVolumeFactory(e,t,i,n);return this._cache.set(a,o),this._hadAnyChanges=!0,o}},lI=class e{constructor(e,t,i,n){this.min=i,this.max=n,this.points=e,this.planes=t}static fromAabb(t,i){let n=[];for(let e=0;e<8;e++)n.push([1&~e?t[0]:i[0],1==(e>>1&1)?i[1]:t[1],1==(e>>2&1)?i[2]:t[2]]);return new e(n,[[-1,0,0,i[0]],[1,0,0,-t[0]],[0,-1,0,i[1]],[0,1,0,-t[1]],[0,0,-1,i[2]],[0,0,1,-t[2]]],t,i)}static fromCenterSizeAngles(t,i,n){let a=Pu([],n[0],n[1],n[2]),r=xu([],[i[0],0,0],a),s=xu([],[0,i[1],0],a),o=xu([],[0,0,i[2]],a),l=[...t],c=[...t];for(let e=0;e<8;e++)for(let i=0;i<3;i++){let n=t[i]+r[i]*(1&~e?-1:1)+s[i]*(1==(e>>1&1)?1:-1)+o[i]*(1==(e>>2&1)?1:-1);l[i]=Math.min(l[i],n),c[i]=Math.max(c[i],n)}let u=[];for(let e=0;e<8;e++){let i=[...t];mu(i,i,fu([],r,1&~e?-1:1)),mu(i,i,fu([],s,1==(e>>1&1)?1:-1)),mu(i,i,fu([],o,1==(e>>2&1)?1:-1)),u.push(i)}return new e(u,[[...r,-vu(r,u[0])],[...s,-vu(s,u[0])],[...o,-vu(o,u[0])],[-r[0],-r[1],-r[2],-vu(r,u[7])],[-s[0],-s[1],-s[2],-vu(s,u[7])],[-o[0],-o[1],-o[2],-vu(o,u[7])]],l,c)}intersectsFrustum(e){let t=!0,i=this.points.length,n=this.planes.length,a=e.planes.length,r=e.points.length;for(let n=0;n<a;n++){let a=e.planes[n],r=0;for(let e=0;e<i;e++){let t=this.points[e];a[0]*t[0]+a[1]*t[1]+a[2]*t[2]+a[3]>=0&&r++}if(0===r)return 0;r<i&&(t=!1)}if(t)return 2;for(let t=0;t<n;t++){let i=this.planes[t],n=0;for(let t=0;t<r;t++){let a=e.points[t];i[0]*a[0]+i[1]*a[1]+i[2]*a[2]+i[3]>=0&&n++}if(0===n)return 0}return 1}intersectsPlane(e){let t=this.points.length,i=0;for(let n=0;n<t;n++){let t=this.points[n];e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]>=0&&i++}return i===t?2:0===i?0:1}};function cI(e,t,i){let n=e-t;return n<0?-n:Math.max(0,n-i)}function uI(e,t,i,n,a){let r,s=e-i;return r=s<0?Math.min(-s,1+s-a):s>a?Math.min(Math.max(s-a,0),1-s):0,Math.max(r,cI(t,n,a))}var hI=class{constructor(){this._boundingVolumeCache=new oI(this._computeTileBoundingVolume)}prepareNextFrame(){this._boundingVolumeCache.swapBuffers()}distanceToTile2d(e,t,i,n){let a=1<<i.z,r=1/a,s=i.x/a,o=i.y/a,l=2;return l=Math.min(l,uI(e,t,s,o,r)),l=Math.min(l,uI(e,t,s+.5,-o-r,r)),l=Math.min(l,uI(e,t,s+.5,2-o-r,r)),l}getWrap(e,t,i){let n=1<<t.z,a=1/n,r=t.x/n,s=cI(e.x,r,a),o=cI(e.x,r-1,a),l=cI(e.x,r+1,a),c=Math.min(s,o,l);return c===l?1:c===o?-1:0}allowVariableZoom(e,t){return tD(e,t)>4}allowWorldCopies(){return!1}getTileBoundingVolume(e,t,i,n){return this._boundingVolumeCache.getTileBoundingVolume(e,t,i,n)}_computeTileBoundingVolume(e,t,i,n){let a=Math.min(0,i),r=Math.max(0,i);if(n?.terrain){let i=new HE(e.z,t,e.z,e.x,e.y),s=n.terrain.getMinMaxElevation(i);a=s.minElevation??a,r=Math.max(s.maxElevation??r,r)}if(a/=wx,r/=wx,a+=1,r+=1,e.z<=0)return lI.fromAabb([-r,-r,-r],[r,r,r]);if(1===e.z)return lI.fromAabb([0===e.x?-r:0,0===e.y?0:-r,-r],[0===e.x?0:r,0===e.y?r:0,r]);{let t=[ZP(0,0,e.x,e.y,e.z),ZP(Uu,0,e.x,e.y,e.z),ZP(Uu,Uu,e.x,e.y,e.z),ZP(0,Uu,e.x,e.y,e.z)],i=[];for(let e of t)i.push(fu([],e,r));if(r!==a)for(let e of t)i.push(fu([],e,a));0===e.y&&i.push([0,1,0]),e.y===(1<<e.z)-1&&i.push([0,-1,0]);let n=[1,1,1],s=[-1,-1,-1];for(let e of i)for(let t=0;t<3;t++)n[t]=Math.min(n[t],e[t]),s[t]=Math.max(s[t],e[t]);let o=ZP(4096,4096,e.x,e.y,e.z),l=yu([],[0,1,0],o);_u(l,l);let c=yu([],o,l);_u(c,c);let u=yu([],t[2],t[1]);_u(u,u);let h=yu([],t[0],t[3]);_u(h,h),i.push(fu([],o,r)),e.y>=(1<<e.z)/2&&i.push(fu([],ZP(4096,0,e.x,e.y,e.z),r)),e.y<(1<<e.z)/2&&i.push(fu([],ZP(4096,Uu,e.x,e.y,e.z),r));let d=dI(o,i),p=dI(c,i),m=[-o[0],-o[1],-o[2],d.max],g=[o[0],o[1],o[2],-d.min],f=[-c[0],-c[1],-c[2],p.max],A=[c[0],c[1],c[2],-p.min],_=[...u,0],v=[...h,0],y=[];return 0===e.y?y.push(Xu(v,_,m),Xu(v,_,g)):y.push(Xu(f,_,m),Xu(f,_,g),Xu(f,v,m),Xu(f,v,g)),e.y===(1<<e.z)-1?y.push(Xu(v,_,m),Xu(v,_,g)):y.push(Xu(A,_,m),Xu(A,_,g),Xu(A,v,m),Xu(A,v,g)),new lI(y,[m,g,f,A,_,v],n,s)}}};function dI(e,t){let i=1/0,n=-1/0;for(let a of t){let t=vu(e,a);i=Math.min(i,t),n=Math.max(n,t)}return{min:i,max:n}}var pI=class e{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(e){this._helper.setMinZoom(e)}setMaxZoom(e){this._helper.setMaxZoom(e)}setMinPitch(e){this._helper.setMinPitch(e)}setMaxPitch(e){this._helper.setMaxPitch(e)}setRenderWorldCopies(e){this._helper.setRenderWorldCopies(e)}setBearing(e){this._helper.setBearing(e)}setPitch(e){this._helper.setPitch(e)}setRoll(e){this._helper.setRoll(e)}setFov(e){this._helper.setFov(e)}setZoom(e){this._helper.setZoom(e)}setCenter(e){this._helper.setCenter(e)}setElevation(e){this._helper.setElevation(e)}setMinElevationForCurrentTile(e){this._helper.setMinElevationForCurrentTile(e)}setPadding(e){this._helper.setPadding(e)}interpolatePadding(e,t,i){this._helper.interpolatePadding(e,t,i)}isPaddingEqual(e){return this._helper.isPaddingEqual(e)}resize(e,t){this._helper.resize(e,t)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(e){this._helper.setMaxBounds(e)}setConstrainOverride(e){this._helper.setConstrainOverride(e)}overrideNearFarZ(e,t){this._helper.overrideNearFarZ(e,t)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(e){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),e)}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 constrainOverride(){return this._helper.constrainOverride}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(e){}constructor(e){this._cachedClippingPlane=Vu(),this._projectionMatrix=Hu(),this._globeViewProjMatrix32f=Wu(),this._globeViewProjMatrixF64=Hu(),this._globeViewProjMatrixF64Inverted=Hu(),this._globeProjMatrixInverted=Hu(),this._cameraPosition=qu(),this.defaultConstrain=(e,t)=>{let i=sh(e.lat,-Ih,Ih),n=sh(+t,this.minZoom+iI(0,i),this.maxZoom);return{center:new Ex(e.lng,i),zoom:n}},this.applyConstrain=(e,t)=>this._helper.applyConstrain(e,t),this._helper=new kP({calcMatrices:()=>this._calcMatrices(),defaultConstrain:(e,t)=>this.defaultConstrain(e,t)},e),this._coveringTilesDetailsProvider=new hI}clone(){let t=new e;return t.apply(this,!1),t}apply(e,t){this._helper.apply(e,t)}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._globeViewProjMatrixF64}get inverseProjectionMatrix(){return this._globeProjMatrixInverted}get cameraPosition(){let e=qu();return e[0]=this._cameraPosition[0],e[1]=this._cameraPosition[1],e[2]=this._cameraPosition[2],e}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}getProjectionData(e){let{overscaledTileID:t,applyGlobeMatrix:i}=e,n=this._helper.getMercatorTileCoordinates(t);return{mainMatrix:this._globeViewProjMatrix32f,tileMercatorCoords:n,clippingPlane:this._cachedClippingPlane,projectionTransition:+!!i,fallbackMatrix:this._globeViewProjMatrix32f,clipAntimeridian:0===t?.canonical.z}}_computeClippingPlane(e){let t=this.pitchInRadians,i=this.cameraToCenterDistance/e,n=Math.sin(t)*i,a=Math.cos(t)*i+1,r=1/Math.sqrt(n*n+a*a)*1,s=-n,o=a,l=Math.sqrt(s*s+o*o);s/=l,o/=l;let c=[0,s,o];Eu(c,c,[0,0,0],-this.bearingInRadians),bu(c,c,[0,0,0],-1*this.center.lat*Math.PI/180),wu(c,c,[0,0,0],this.center.lng*Math.PI/180);let u=1/du(c);return fu(c,c,u),[...c,-r*u]}isLocationOccluded(e){return!this.isSurfacePointVisible(KP(e))}transformLightDirection(e){let t=this._helper._center.lng*Math.PI/180,i=this._helper._center.lat*Math.PI/180,n=Math.cos(i),a=[Math.sin(t)*n,Math.sin(i),Math.cos(t)*n],r=[a[2],0,-a[0]],s=[0,0,0];yu(s,r,a),_u(r,r),_u(s,s);let o=[0,0,0];return _u(o,[r[0]*e[0]+s[0]*e[1]+a[0]*e[2],r[1]*e[0]+s[1]*e[1]+a[1]*e[2],r[2]*e[0]+s[2]*e[1]+a[2]*e[2]]),o}getPixelScale(){return 1/Math.cos(this._helper._center.lat*Math.PI/180)}getCircleRadiusCorrection(){return Math.cos(this._helper._center.lat*Math.PI/180)}getPitchedTextCorrection(e,t,i){let n=Rx(e,t,i.canonical),a=function(e,t){return[eh(e*Math.PI*2+Math.PI,2*Math.PI),2*Math.atan(Math.exp(Math.PI-t*Math.PI*2))-.5*Math.PI]}(n.x,n.y);return this.getCircleRadiusCorrection()/Math.cos(a[1])}projectTileCoordinates(e,t,i,n){let a,r=i.canonical,s=ZP(e,t,r.x,r.y,r.z),o=1+(n??0)/wx,l=s[0]*o,c=s[1]*o,u=s[2]*o,h=[l,c,u,1];if(Mu(h,h,this._globeViewProjMatrixF64),o<=1){let e=this._cachedClippingPlane;a=e[0]*s[0]+e[1]*s[1]+e[2]*s[2]+e[3]<0}else a=this._isLineOfSightBlocked(l,c,u);return{point:new Hc(h[0]/h[3],h[1]/h[3]),signedDistanceFromCamera:h[3],isOccluded:a}}_isLineOfSightBlocked(e,t,i){let n=this._cameraPosition,a=e-n[0],r=t-n[1],s=i-n[2],o=a*a+r*r+s*s;if(0===o)return!1;let l=sh(-(n[0]*a+n[1]*r+n[2]*s)/o,0,1),c=n[0]+l*a,u=n[1]+l*r,h=n[2]+l*s;return c*c+u*u+h*h<1}_calcMatrices(){let e=XP(this.worldSize,this.center.lat),t=Gu();this._helper.autoCalculateNearFarZ&&(this._helper._nearZ=.5,this._helper._farZ=this.cameraToCenterDistance+2*e),lu(t,this.fovInRadians,this.width/this.height,this._helper._nearZ,this._helper._farZ);let i=this.centerOffset;t[8]=2*-i.x/this._helper._width,t[9]=2*i.y/this._helper._height,this._projectionMatrix=$c(t),this._globeProjMatrixInverted=Gu(),tu(this._globeProjMatrixInverted,t),nu(t,t,[0,0,-this.cameraToCenterDistance]),ou(t,t,this.rollInRadians),ru(t,t,-this.pitchInRadians),ou(t,t,this.bearingInRadians),nu(t,t,[0,0,-e]);let n=qu();n[0]=e,n[1]=e,n[2]=e,ru(t,t,this.center.lat*Math.PI/180),su(t,t,-this.center.lng*Math.PI/180),au(t,t,n),this._globeViewProjMatrixF64=t,this._globeViewProjMatrix32f=new Float32Array(t),this._globeViewProjMatrixF64Inverted=Gu(),tu(this._globeViewProjMatrixF64Inverted,t);let a=qu();this._cameraPosition=qu(),this._cameraPosition[2]=this.cameraToCenterDistance/e,Eu(this._cameraPosition,this._cameraPosition,a,-this.rollInRadians),bu(this._cameraPosition,this._cameraPosition,a,this.pitchInRadians),Eu(this._cameraPosition,this._cameraPosition,a,-this.bearingInRadians),mu(this._cameraPosition,this._cameraPosition,[0,0,1]),bu(this._cameraPosition,this._cameraPosition,a,-this.center.lat*Math.PI/180),wu(this._cameraPosition,this._cameraPosition,a,this.center.lng*Math.PI/180),this._cachedClippingPlane=this._computeClippingPlane(e);let r=$c(this._globeViewProjMatrixF64Inverted);au(r,r,[1,1,-1]),this._cachedFrustum=QT.fromInvProjectionMatrix(r,1,0,this._cachedClippingPlane,!0)}calculateFogMatrix(e){yh("calculateFogMatrix is not supported on globe projection.");let t=Gu();return eu(t),t}getVisibleUnwrappedCoordinates(e){return[new GE(0,e)]}getCameraFrustum(){return this._cachedFrustum}getClippingPlane(){return this._cachedClippingPlane}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(e){e?yh("terrain is not fully supported on vertical perspective projection."):this._helper.recalculateZoomAndCenter(0)}maxPitchScaleFactor(){return 1}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return(du(this._cameraPosition)-1)*wx}getCameraLngLat(){let e=qu();return _u(e,this._cameraPosition),YP(e)}lngLatToCameraDepth(e,t){let i=KP(e);fu(i,i,1+t/wx);let n=Vu();return Mu(n,[i[0],i[1],i[2],1],this._globeViewProjMatrixF64),n[2]/n[3]}populateCache(e){}getBounds(){let e=.5*this.width,t=.5*this.height,i=[new Hc(0,0),new Hc(e,0),new Hc(this.width,0),new Hc(this.width,t),new Hc(this.width,this.height),new Hc(e,this.height),new Hc(0,this.height),new Hc(0,t)],n=[];for(let e of i)n.push(this.unprojectScreenPoint(e));let a=0,r=0,s=0,o=0,l=this.center;for(let e of n){let t=Ju(l.lng,e.lng),i=Ju(l.lat,e.lat);t<r&&(r=t),t>a&&(a=t),i<o&&(o=i),i>s&&(s=i)}let c=[l.lng+r,l.lat+o,l.lng+a,l.lat+s];return this.isSurfacePointOnScreen([0,1,0])&&(c[3]=90,c[0]=-180,c[2]=180),this.isSurfacePointOnScreen([0,-1,0])&&(c[1]=-90,c[0]=-180,c[2]=180),new gT(c)}calculateCenterFromCameraLngLatAlt(e,t,i,n){return this._helper.calculateCenterFromCameraLngLatAlt(e,t,i,n)}calculateCameraOptionsFromTo(e,t,i,n){let a=Ex.convert(i),r=KP(Ex.convert(e));fu(r,r,1+t/wx);let s=KP(a),o=fu(qu(),s,1+n/wx),l=gu(qu(),r,s),c=du(l);if(c<1e-12||function(e,t){var i=t[0]-e[0],n=t[1]-e[1],a=t[2]-e[2];return Math.sqrt(i*i+n*n+a*a)}(r,o)<1e-12)throw Error("Can't calculate camera options with same From and To");let u=qu();wu(l,l,u,-Mh(a.lng)),bu(l,l,u,Mh(a.lat));let h=Ch(Math.acos(sh(l[2]/c,-1,1))),d=Math.hypot(l[0],l[1])<1e-9*c?this.bearing:Ch(Math.atan2(-l[0],-l[1]));return{center:a,elevation:n,zoom:ph(this.cameraToCenterDistance/c/XP(this.tileSize,a.lat)),pitch:h,bearing:d}}setLocationAtPoint(e,t,i){let n=KP(this.unprojectScreenPoint(t)),a=KP(e),r=qu();!function(e){e[0]=0,e[1]=0,e[2]=0}(r);let s=qu();wu(s,n,r,-this.center.lng*Math.PI/180),bu(s,s,r,this.center.lat*Math.PI/180);let o=a[0]*a[0]+a[2]*a[2],l=s[0]*s[0];if(o<l)return;let c=Math.sqrt(o-l),u=-c,h=Yu(a[0],a[2],s[0],c),d=Yu(a[0],a[2],s[0],u),p=qu();wu(p,a,r,-h);let m=Yu(p[1],p[2],s[1],s[2]),g=qu();wu(g,a,r,-d);let f,A,_=Yu(g[1],g[2],s[1],s[2]),v=.5*Math.PI,y=m>=-v&&m<=v,x=_>=-v&&_<=v;if(y&&x){let e=this.center.lng*Math.PI/180,t=this.center.lat*Math.PI/180;$u(h,e)+$u(m,t)<$u(d,e)+$u(_,t)?(f=h,A=m):(f=d,A=_)}else if(y)f=h,A=m;else{if(!x)return;f=d,A=_}let b=f/Math.PI*180,w=A/Math.PI*180,E=this.center.lat;this.setCenter(new Ex(b,sh(w,-90,90))),this.setZoom(this.zoom+iI(E,this.center.lat))}locationToScreenPoint(e,t){let i=KP(e);if(t){fu(i,i,1+t.getElevationForLngLatZoom(e,this._helper._tileZoom)/wx)}return this._projectSurfacePointToScreen(i)}_projectSurfacePointToScreen(e){let t=Vu();return Mu(t,[...e,1],this._globeViewProjMatrixF64),t[0]/=t[3],t[1]/=t[3],new Hc((.5*t[0]+.5)*this.width,(.5*-t[1]+.5)*this.height)}screenPointToMercatorCoordinate(e,t){if(t){let i=this.screenTerrainPointToMercatorCoordinate(e,t);if(i)return i}return Fx.fromLngLat(this.unprojectScreenPoint(e))}screenTerrainPointToMercatorCoordinate(e,t){let i=t.getCoverageIndex();if(!i)return null;let n=this.cameraPosition,a=this.getRayDirectionFromPixel(e),r=sI(n,a,1+i.maxElevation/wx);if(!r)return null;let s=sI(n,a,1+i.minElevation/wx),o=Math.max(r.tMin,0),l=s?s.tMin:r.tMax;if(l<=o)return null;let c={index:i,exaggeration:t.exaggeration,origin:n,direction:a},u=0;for(let e=0;e<=256;e++){let t=o+(l-o)*e/256;if(gI(c,t)){let{hi:e}=zP(c,gI,u,t,1e-12),{sample:i,mercator:n}=mI(c,e);return new Fx(n.x,n.y,i.elevation)}u=t}return null}screenPointToLocation(e,t){return this.screenPointToMercatorCoordinate(e,t)?.toLngLat()}screenPointToLocationAtElevation(e,t){return this.screenPointToLocation(e)}isPointOnMapSurface(e,t){return!!sI(this._cameraPosition,this.getRayDirectionFromPixel(e))}getRayDirectionFromPixel(e){let t=Vu();t[0]=e.x/this.width*2-1,t[1]=-1*(e.y/this.height*2-1),t[2]=1,t[3]=1,Mu(t,t,this._globeViewProjMatrixF64Inverted),t[0]/=t[3],t[1]/=t[3],t[2]/=t[3];let i=qu();i[0]=t[0]-this._cameraPosition[0],i[1]=t[1]-this._cameraPosition[1],i[2]=t[2]-this._cameraPosition[2];let n=qu();return _u(n,i),n}isSurfacePointVisible(e){let t=this._cachedClippingPlane;return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]>=0}isSurfacePointOnScreen(e){if(!this.isSurfacePointVisible(e))return!1;let t=Vu();return Mu(t,[...e,1],this._globeViewProjMatrixF64),t[0]/=t[3],t[1]/=t[3],t[2]/=t[3],t[0]>-1&&t[0]<1&&t[1]>-1&&t[1]<1&&t[2]>-1&&t[2]<1}unprojectScreenPoint(e){let t=this._cameraPosition,i=this.getRayDirectionFromPixel(e),n=sI(t,i);if(n){let e=qu();mu(e,t,[i[0]*n.tMin,i[1]*n.tMin,i[2]*n.tMin]);let a=qu();return _u(a,e),YP(a)}let a=this._cachedClippingPlane,r=a[0]*i[0]+a[1]*i[1]+a[2]*i[2],s=-Ku(a,t)/r,o=qu();if(s>0)mu(o,t,[i[0]*s,i[1]*s,i[2]*s]);else{let e=qu();mu(e,t,[2*i[0],2*i[1],2*i[2]]);let n=Ku(this._cachedClippingPlane,e);ku(o,e,[this._cachedClippingPlane[0]*n,this._cachedClippingPlane[1]*n,this._cachedClippingPlane[2]*n])}let l=function(e){let t=qu();return t[0]=e[0]*-e[3],t[1]=e[1]*-e[3],t[2]=e[2]*-e[3],{center:t,radius:Math.sqrt(1-e[3]*e[3])}}(a);return YP(function(e,t,i){let n=qu();ku(n,i,e);let a=qu();return Au(a,e,n,t/Su(n)),a}(l.center,l.radius,o))}getProjectionDataForCustomLayer(e=!0){let t=this.getProjectionData({overscaledTileID:new HE(0,0,0,0,0),applyGlobeMatrix:e});return t.tileMercatorCoords=[0,0,1,1],t}getFastPathSimpleProjectionMatrix(e){}};function mI(e,t){let i=qu();Au(i,e.origin,e.direction,t);let n=du(i),a=qu();fu(a,i,1/n);let r=YP(a),s=Fx.fromLngLat(r),o=new Fx(s.x,sh(s.y,0,.999999999)),l=IP(e.index,e.exaggeration,o.x,o.y),c=Math.abs(r.lat)>85.051129?0:l.elevation;return{sample:{...l,elevation:c},radius:n,mercator:o}}function gI(e,t){let{sample:i,radius:n}=mI(e,t);return FP(i,(n-1)*wx)}var fI=class e{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(e){this._helper.setMinZoom(e)}setMaxZoom(e){this._helper.setMaxZoom(e)}setMinPitch(e){this._helper.setMinPitch(e)}setMaxPitch(e){this._helper.setMaxPitch(e)}setRenderWorldCopies(e){this._helper.setRenderWorldCopies(e)}setBearing(e){this._helper.setBearing(e)}setPitch(e){this._helper.setPitch(e)}setRoll(e){this._helper.setRoll(e)}setFov(e){this._helper.setFov(e)}setZoom(e){this._helper.setZoom(e)}setCenter(e){this._helper.setCenter(e)}setElevation(e){this._helper.setElevation(e)}setMinElevationForCurrentTile(e){this._helper.setMinElevationForCurrentTile(e)}setPadding(e){this._helper.setPadding(e)}interpolatePadding(e,t,i){this._helper.interpolatePadding(e,t,i)}isPaddingEqual(e){return this._helper.isPaddingEqual(e)}resize(e,t,i=!0){this._helper.resize(e,t,i)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(e){this._helper.setMaxBounds(e)}setConstrainOverride(e){this._helper.setConstrainOverride(e)}overrideNearFarZ(e,t){this._helper.overrideNearFarZ(e,t)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(e){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),e)}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 constrainOverride(){return this._helper.constrainOverride}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(e){this._globeness=e,this._calcMatrices(),this._verticalPerspectiveTransform.getCoveringTilesDetailsProvider().prepareNextFrame(),this._mercatorTransform.getCoveringTilesDetailsProvider().prepareNextFrame()}get currentTransform(){return this.isGlobeRendering?this._verticalPerspectiveTransform:this._mercatorTransform}constructor(e){this._globeness=1,this.defaultConstrain=(e,t)=>this.currentTransform.defaultConstrain(e,t),this.applyConstrain=(e,t)=>this._helper.applyConstrain(e,t),this._helper=new kP({calcMatrices:()=>this._calcMatrices(),defaultConstrain:(e,t)=>this.defaultConstrain(e,t)},e),this._globeness=1,this._mercatorTransform=new RP,this._verticalPerspectiveTransform=new pI}clone(){let t=new e;return t._globeness=this._globeness,t.apply(this,!1),t}apply(e,t){this._helper.apply(e,t),this._mercatorTransform.apply(this,!1),this._verticalPerspectiveTransform.apply(this,!1)}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(e){let t=this._mercatorTransform.getProjectionData(e),i=this._verticalPerspectiveTransform.getProjectionData(e);return{mainMatrix:this.isGlobeRendering?i.mainMatrix:t.mainMatrix,clippingPlane:i.clippingPlane,tileMercatorCoords:i.tileMercatorCoords,projectionTransition:e.applyGlobeMatrix?this._globeness:0,fallbackMatrix:t.fallbackMatrix,clipAntimeridian:i.clipAntimeridian}}isLocationOccluded(e){return this.currentTransform.isLocationOccluded(e)}transformLightDirection(e){return this.currentTransform.transformLightDirection(e)}getPixelScale(){return ih(this._mercatorTransform.getPixelScale(),this._verticalPerspectiveTransform.getPixelScale(),this._globeness)}getCircleRadiusCorrection(){return ih(this._mercatorTransform.getCircleRadiusCorrection(),this._verticalPerspectiveTransform.getCircleRadiusCorrection(),this._globeness)}getPitchedTextCorrection(e,t,i){return ih(this._mercatorTransform.getPitchedTextCorrection(e,t,i),this._verticalPerspectiveTransform.getPitchedTextCorrection(e,t,i),this._globeness)}projectTileCoordinates(e,t,i,n){return this.currentTransform.projectTileCoordinates(e,t,i,n)}_calcMatrices(){this._helper._width&&this._helper._height&&(this._verticalPerspectiveTransform.apply(this,!1),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(e){return this.currentTransform.calculateFogMatrix(e)}getVisibleUnwrappedCoordinates(e){return this.currentTransform.getVisibleUnwrappedCoordinates(e)}getCameraFrustum(){return this.currentTransform.getCameraFrustum()}getClippingPlane(){return this.currentTransform.getClippingPlane()}getCoveringTilesDetailsProvider(){return this.currentTransform.getCoveringTilesDetailsProvider()}recalculateZoomAndCenter(e){this.currentTransform.recalculateZoomAndCenter(e)}maxPitchScaleFactor(){return this._mercatorTransform.maxPitchScaleFactor()}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this.currentTransform.getCameraAltitude()}getCameraLngLat(){return this.currentTransform.getCameraLngLat()}lngLatToCameraDepth(e,t){return this.currentTransform.lngLatToCameraDepth(e,t)}populateCache(e){this._mercatorTransform.populateCache(e),this._verticalPerspectiveTransform.populateCache(e)}getBounds(){return this.currentTransform.getBounds()}calculateCenterFromCameraLngLatAlt(e,t,i,n){return this._helper.calculateCenterFromCameraLngLatAlt(e,t,i,n)}calculateCameraOptionsFromTo(e,t,i,n){return this.currentTransform.calculateCameraOptionsFromTo(e,t,i,n)}setLocationAtPoint(e,t,i){if(!this.isGlobeRendering)return this._mercatorTransform.setLocationAtPoint(e,t,i),void this.apply(this._mercatorTransform,!1);this._verticalPerspectiveTransform.setLocationAtPoint(e,t,i),this.apply(this._verticalPerspectiveTransform,!1)}locationToScreenPoint(e,t){return this.currentTransform.locationToScreenPoint(e,t)}screenPointToMercatorCoordinate(e,t){return this.currentTransform.screenPointToMercatorCoordinate(e,t)}screenTerrainPointToMercatorCoordinate(e,t){return this.currentTransform.screenTerrainPointToMercatorCoordinate(e,t)}screenPointToLocation(e,t){return this.currentTransform.screenPointToLocation(e,t)}screenPointToLocationAtElevation(e,t){return this.currentTransform.screenPointToLocationAtElevation(e,t)}isPointOnMapSurface(e,t){return this.currentTransform.isPointOnMapSurface(e,t)}getRayDirectionFromPixel(e){return this._verticalPerspectiveTransform.getRayDirectionFromPixel(e)}getProjectionDataForCustomLayer(e=!0){let t=this._mercatorTransform.getProjectionDataForCustomLayer(e);if(!this.isGlobeRendering)return t;let i=this._verticalPerspectiveTransform.getProjectionDataForCustomLayer(e);return i.fallbackMatrix=t.mainMatrix,i.projectionTransition=this._globeness,i}getFastPathSimpleProjectionMatrix(e){return this.currentTransform.getFastPathSimpleProjectionMatrix(e)}},AI=class e{get useGlobeControls(){return!0}handlePanInertia(e,t){let i=nI(e,t);return Math.abs(i.lng-t.center.lng)>180&&(i.lng=t.center.lng+179.5*Math.sign(i.lng-t.center.lng)),{easingCenter:i,easingOffset:new Hc(0,0)}}handleMapControlsRollPitchBearingZoom(e,t){let i=e.around,n=t.screenPointToLocation(i);e.bearingDelta&&t.setBearing(t.bearing+e.bearingDelta),e.pitchDelta&&t.setPitch(t.pitch+e.pitchDelta),e.rollDelta&&t.setRoll(t.roll+e.rollDelta);let a=t.zoom;e.zoomDelta&&t.setZoom(t.zoom+e.zoomDelta);let r=t.zoom-a;if(0===r)return;let s=Ju(t.center.lng,n.lng),o=s/(Math.abs(s/180)+1),l=Ju(t.center.lat,n.lat),c=t.getRayDirectionFromPixel(i),u=t.cameraPosition,h=-1*vu(u,c),d=qu();mu(d,u,[c[0]*h,c[1]*h,c[2]*h]);let p=du(d),m=p-1,g=Math.exp(.5*-Math.max(m-.3,0)),f=th(p,.95,.999,0,1),A=th(XP(t.worldSize,t.center.lat)/Math.min(t.width,t.height),.9,.5,1,.25),_=Math.min(g,ih(1,A,f)),v=(1-dh(-r))*_,y=t.center.lat,x=t.zoom,b=new Ex(t.center.lng+o*v,sh(t.center.lat+l*v,-Ih,Ih));t.setLocationAtPoint(n,i);let w=t.center,E=th(Math.abs(s),45,85,0,1),k=Math.max(E,f)**.25,S=Ju(w.lng,b.lng),M=Ju(w.lat,b.lat);t.setCenter(new Ex(w.lng+S*k,w.lat+M*k).wrap()),t.setZoom(x+iI(y,t.center.lat))}handleMapControlsPan(e,t,i){e.panDelta&&eI(t,i,t.isPointOnMapSurface(e.around)?e.around:t.centerPoint,e.panDelta)}cameraForBoxAndBearing(t,i,n,a,r){let s=NP(t,i,n,a,r),o=i.left/r.width*2-1,l=(r.width-i.right)/r.width*2-1,c=i.top/r.height*-2+1,u=(r.height-i.bottom)/r.height*-2+1,h=Ju(n.getWest(),n.getEast())<0,d=h?n.getEast():n.getWest(),p=h?n.getWest():n.getEast(),m=Math.max(n.getNorth(),n.getSouth()),g=Math.min(n.getNorth(),n.getSouth()),f=d+.5*Ju(d,p),A=m+.5*Ju(m,g),_=r.clone();_.setCenter(s.center),_.setBearing(s.bearing),_.setPitch(0),_.setRoll(0),_.setZoom(s.zoom);let v=_.modelViewProjectionMatrix,y=[KP(n.getNorthWest()),KP(n.getNorthEast()),KP(n.getSouthWest()),KP(n.getSouthEast()),KP(new Ex(p,A)),KP(new Ex(d,A)),KP(new Ex(f,m)),KP(new Ex(f,g))],x=KP(s.center),b=1/0;for(let t of y)o<0&&(b=e.getLesserNonNegativeNonNull(b,e.solveVectorScale(t,x,v,"x",o))),l>0&&(b=e.getLesserNonNegativeNonNull(b,e.solveVectorScale(t,x,v,"x",l))),c>0&&(b=e.getLesserNonNegativeNonNull(b,e.solveVectorScale(t,x,v,"y",c))),u<0&&(b=e.getLesserNonNegativeNonNull(b,e.solveVectorScale(t,x,v,"y",u)));if(Number.isFinite(b)&&0!==b)return s.zoom=Math.min(_.zoom+ph(b),t.maxZoom),s;OP()}handleJumpToCenterZoom(e,t){let i=e.center.lat,n=e.applyConstrain(t.center?Ex.convert(t.center):e.center,e.zoom).center;e.setCenter(n.wrap());let a=void 0===t.zoom?e.zoom+iI(i,n.lat):+t.zoom;e.zoom!==a&&e.setZoom(a)}handleEaseTo(e,t){let i=e.zoom,n=e.center,a=e.padding,r={roll:e.roll,pitch:e.pitch,bearing:e.bearing},s={roll:void 0===t.roll?e.roll:t.roll,pitch:void 0===t.pitch?e.pitch:t.pitch,bearing:void 0===t.bearing?e.bearing:t.bearing},o=void 0!==t.zoom,l=!e.isPaddingEqual(t.padding),c=!1,u=t.center?Ex.convert(t.center):n,h=e.applyConstrain(u,i).center;wP(e,h);let d=e.clone();d.setCenter(h),d.setZoom(o?+t.zoom:i+iI(n.lat,u.lat)),d.setBearing(t.bearing);let p=new Hc(sh(e.centerPoint.x+t.offsetAsPoint.x,0,e.width),sh(e.centerPoint.y+t.offsetAsPoint.y,0,e.height));d.setLocationAtPoint(h,p);let m=(t.offset&&t.offsetAsPoint.mag())>0?d.center:h,g=o?+t.zoom:i+iI(n.lat,m.lat),f=i+iI(n.lat,0),A=g+iI(m.lat,0),_=Ju(n.lng,m.lng),v=Ju(n.lat,m.lat),y=dh(A-f);return c=g!==i,{easeFunc:i=>{if(Th(r,s)||UP({startEulerAngles:r,endEulerAngles:s,tr:e,k:i,useSlerp:r.roll!=s.roll}),l&&e.interpolatePadding(a,t.padding,i),t.around)yh("Easing around a point is not supported under globe projection."),e.setLocationAtPoint(t.around,t.aroundPoint);else{let t=i*(A>f?Math.min(2,y):Math.max(.5,y))**(1-i),a=rI(n,_,v,t);e.setCenter(a.wrap())}if(c){let t=Ep.number(f,A,i)+iI(0,e.center.lat);e.setZoom(t)}},isZooming:c,elevationCenter:m}}handleFlyTo(e,t){let i=void 0!==t.zoom,n=e.center,a=e.zoom,r=e.padding,s=!e.isPaddingEqual(t.padding),o=e.applyConstrain(Ex.convert(t.center||t.locationAtOffset),a).center,l=i?+t.zoom:e.zoom+iI(e.center.lat,o.lat),c=e.clone();c.setCenter(o),c.setZoom(l),c.setBearing(t.bearing);let u=new Hc(sh(e.centerPoint.x+t.offsetAsPoint.x,0,e.width),sh(e.centerPoint.y+t.offsetAsPoint.y,0,e.height));c.setLocationAtPoint(o,u);let h=c.center;wP(e,h);let d=function(e,t,i){let n=vu(KP(t),KP(i)),a=Math.acos(n),r=WP(e);return a/(2*Math.PI)*r}(e,n,h),p=a+iI(n.lat,0),m=l+iI(h.lat,0),g=dh(m-p),f="number"==typeof t.minZoom?+t.minZoom:e.minZoom,A=Math.max(f,e.minZoom)+iI(h.lat,0),_=Math.min(A,p,m)+iI(0,h.lat),v=dh(e.applyConstrain(h,_).zoom+iI(h.lat,0)-p),y=Ju(n.lng,h.lng),x=Ju(n.lat,h.lat);return{easeFunc:(i,a,o,c)=>{let u=rI(n,y,x,o);s&&e.interpolatePadding(r,t.padding,i);let d=1===i?h:u;e.setCenter(d.wrap());let m=p+ph(a);e.setZoom(1===i?l:m+iI(0,d.lat))},scaleOfZoom:g,targetCenter:h,scaleOfMinZoom:v,pixelPathLength:d}}static solveVectorScale(e,t,i,n,a){let r=a,s="x"===n?[i[0],i[4],i[8],i[12]]:[i[1],i[5],i[9],i[13]],o=[i[3],i[7],i[11],i[15]],l=e[0]*s[0]+e[1]*s[1]+e[2]*s[2],c=e[0]*o[0]+e[1]*o[1]+e[2]*o[2],u=t[0]*s[0]+t[1]*s[1]+t[2]*s[2],h=t[0]*o[0]+t[1]*o[1]+t[2]*o[2];return u+r*c===l+r*h||o[3]*(l-u)+s[3]*(h-c)+l*h===u*c?null:(u+s[3]-r*h-r*o[3])/(u-l-r*h+r*c)}static getLesserNonNegativeNonNull(e,t){return null!==t&&t>=0&&t<e?t:e}},_I=class{constructor(e){this._globe=e,this._mercatorCameraHelper=new jP,this._verticalPerspectiveCameraHelper=new AI}get useGlobeControls(){return this._globe.useGlobeRendering}get currentHelper(){return this.useGlobeControls?this._verticalPerspectiveCameraHelper:this._mercatorCameraHelper}handlePanInertia(e,t){return this.currentHelper.handlePanInertia(e,t)}handleMapControlsRollPitchBearingZoom(e,t){this.currentHelper.handleMapControlsRollPitchBearingZoom(e,t)}handleMapControlsPan(e,t,i){this.currentHelper.handleMapControlsPan(e,t,i)}cameraForBoxAndBearing(e,t,i,n,a){return this.currentHelper.cameraForBoxAndBearing(e,t,i,n,a)}handleJumpToCenterZoom(e,t){this.currentHelper.handleJumpToCenterZoom(e,t)}handleEaseTo(e,t){return this.currentHelper.handleEaseTo(e,t)}handleFlyTo(e,t){return this.currentHelper.handleFlyTo(e,t)}};const vI=function(){let e={},t=ad.$version;for(let i in ad.$root){let n=ad.$root[i];if(n.required){let a=null;a="version"===i?t:"array"===n.type?[]:{},null!=a&&(e[i]=a)}}return e}();var yI=class extends id{constructor(e,t={}){super(),this._rtlPluginLoaded=()=>{for(let e in this.tileManagers){let t=this.tileManagers[e].getSource().type;("vector"===t||"geojson"===t)&&this.tileManagers[e].reload()}},this.map=e,this.dispatcher=new oT(sT(),e._getMapId()),this.dispatcher.registerMessageHandler("GG",(e,t)=>this.getGlyphs(e,t)),this.dispatcher.registerMessageHandler("GI",(e,t)=>this.getImages(e,t)),this.dispatcher.registerMessageHandler("GDA",(e,t)=>this.getDashes(e,t)),this.imageManager=new FC,this.imageManager.setEventedParent(this),this.imageManager.setMissingImageResolver(e._missingStyleImageResolver),this.patternAtlas=new zC(this.imageManager);let i=e._container?.lang||typeof document<"u"&&document.documentElement?.lang||void 0;this.glyphManager=new XC(e._requestManager,t.localIdeographFontFamily,i),this.lineAtlas=new eT(256,512),this.crossTileSymbolIndex=new gP,this._setInitialValues(),this._resetUpdates(),this.dispatcher.broadcast("SR",Zh()),HT().on(VT,this._rtlPluginLoaded),this.on("data",e=>{if("source"!==e.dataType||"metadata"!==e.sourceDataType)return;let t=this.tileManagers[e.sourceId];if(!t)return;let i=t.getSource();if(i?.vectorLayerIds)for(let e in this._layers){let t=this._layers[e];t.source===i.id&&this._validateLayer(t)}})}_setInitialValues(){this._layers={},this._order=[],this.tileManagers={},this.zoomHistory=new Wf,this._imagesListDirty=!1,this._globalState={},this._serializedLayers={},this.stylesheet=null,this.light=null,this.sky=null,this.projection&&(this.projection.destroy(),delete this.projection),this._loaded=!1,this._changed=!1,this._updatedLayers={},this._updatedSources={},this._changedImages={},this._glyphsDidChange=!1,this._updatedPaintProps={},this._layerOrderChanged=!1,this._symbolPlacementTriggered=!1,this._placedProjectionTransition=void 0,this.crossTileSymbolIndex=new(this.crossTileSymbolIndex?.constructor||Object),this.pauseablePlacement=void 0,this.placement=void 0,this.z=0}setGlobalStateProperty(e,t){this._checkLoaded();let i=null===t?this.stylesheet.state?.[e]?.default??null:t;if(Ah(i,this._globalState[e]))return this;this._globalState[e]=i,this._applyGlobalStateChanges([e])}getGlobalState(){return this._globalState}setGlobalState(e){this._checkLoaded();let t=[];for(let i in e)Ah(this._globalState[i],e[i].default)||(t.push(i),this._globalState[i]=e[i].default);this._applyGlobalStateChanges(t)}_applyGlobalStateChanges(e){if(0===e.length)return;let t=new Set,i={};for(let n of e){i[n]=this._globalState[n];for(let e in this._layers){let i=this._layers[e],a=i.getLayoutAffectingGlobalStateRefs(),r=i.getPaintAffectingGlobalStateRefs(),s=i.getVisibilityAffectingGlobalStateRefs();if(a.has(n)&&t.add(i.source),r.has(n))for(let{name:e,value:t}of r.get(n))this._updatePaintProperty(i,e,t);s?.has(n)&&(i.recalculateVisibility(),this._updateLayer(i))}}this.dispatcher.broadcast("UGS",i);for(let e in this.tileManagers)t.has(e)&&(this._reloadSource(e),this._changed=!0)}async loadURL(e,t={},i){this.fire(new lC("dataloading")),t.validate="boolean"!=typeof t.validate||t.validate,this._loadStyleRequest=new AbortController;let n=this._loadStyleRequest;try{let a=await this.map._requestManager.transformRequest(e,"Style");jh(n.signal);let r=await Xh(a,n);this._loadStyleRequest===n&&(this._loadStyleRequest=null),this._load(r.data,t,i)}catch(e){this._loadStyleRequest===n&&(this._loadStyleRequest=null),e&&!n.signal.aborted&&this.fire(new td(ju(e)))}}loadJSON(e,t={},i){this.fire(new lC("dataloading")),this._frameRequest=new AbortController,$M.frameAsync(this._frameRequest,this.map._ownerWindow).then(()=>{this._frameRequest=null,t.validate=!1!==t.validate,this._load(e,t,i)}).catch(()=>{})}loadEmpty(){this.fire(new lC("dataloading")),this._load(vI,{validate:!1})}_load(e,t,i){let n=t.transformStyle?t.transformStyle(i,e):e;if(!t.validate||!Rf(this,n)){n={...n},this._loaded=!0,this.stylesheet=n;for(let e in n.sources)this.addSource(e,n.sources[e],{validate:!1});n.sprite?this._loadSprite(n.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(n.glyphs),this.glyphManager.setFontFaces(n["font-faces"]),this._createLayers(),this.light=new YC(this.stylesheet.light??{},this._globalState),this._setProjectionInternal(this.stylesheet.projection?.type||"mercator"),this.sky=new $C(this.stylesheet.sky,this._globalState),this.map.setTerrain(this.stylesheet.terrain??null,{validate:!1}),this.fire(new lC("data")),this.fire(new oC)}}_createLayers(){let e=vC(this.stylesheet.layers);this.setGlobalState(this.stylesheet.state??null),this.dispatcher.broadcast("SL",e),this._order=e.map(e=>e.id),this._layers={},this._serializedLayers=null;for(let t of e){let e=OE(t,this._globalState);if(e.setEventedParent(this,{layer:{id:t.id}}),this._layers[t.id]=e,fA(e)&&this.tileManagers[e.source]){let i=t.paint?.["raster-fade-duration"]??e.paint.get("raster-fade-duration");this.tileManagers[e.source].setRasterFadeDuration(i)}}}async _loadSprite(e,t=!1,i=void 0){this.imageManager.setLoaded(!1);let n,a=new AbortController;this._spriteRequest=a;try{let i=await IC(e,this.map._requestManager,this.map.getPixelRatio(),a);if(!i)return;for(let e in i){let{loaded:n,removed:a}=this.imageManager.setSpriteImages(e,i[e]);this._markImagesChanged(a),t&&this._markImagesChanged(n)}}catch(e){n=e,a.signal.aborted||this.fire(new td(n))}finally{this._spriteRequest=null,this.imageManager.setLoaded(!0),t&&(this._changed=!0),this.dispatcher.broadcast("SI",this.imageManager.listImages()),this.fire(new lC("data")),i?.(n)}}_unloadSprite(){this._markImagesChanged(this.imageManager.removeAllSpriteImages()),this._imagesListDirty=!0,this._changed=!0,this.fire(new lC("data"))}_validateLayer(e){let t=this.tileManagers[e.source];if(!t)return;let i=e.sourceLayer;if(!i)return;let n=t.getSource();("geojson"===n.type||n.vectorLayerIds&&!n.vectorLayerIds.includes(i))&&this.fire(new td(Error(`Source layer "${i}" does not exist on source "${n.id}" as specified by style layer "${e.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(let e in this.tileManagers)if(!this.tileManagers[e].loaded())return!1;return this.imageManager.isLoaded()}_serializeByIds(e,t=!1){let i=this._serializedAllLayers();if(!e||0===e.length)return Object.values(t?_h(i):i);let n=[];for(let a of e)if(i[a]){let e=t?_h(i[a]):i[a];n.push(e)}return n}_serializedAllLayers(){let e=this._serializedLayers;if(e)return e;e=this._serializedLayers={};let t=Object.keys(this._layers);for(let i of t){let t=this._layers[i];"custom"!==t.type&&(e[i]=t.serialize())}return e}hasTransitions(){if(this.light?.hasTransition()||this.sky?.hasTransition()||this.projection?.hasTransition())return!0;for(let e in this.tileManagers)if(this.tileManagers[e].hasTransition())return!0;for(let e in this._layers)if(this._layers[e].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw Error("Style is not done loading.")}update(e){if(!this._loaded)return;let t=this._changed;if(t){this._imagesListDirty&&=(this.dispatcher.broadcast("SI",this.imageManager.listImages()),!1);let t=Object.keys(this._updatedLayers),i=Object.keys(this._removedLayers);(t.length||i.length)&&this._updateWorkerLayers(t,i);for(let e in this._updatedSources){let t=this._updatedSources[e];if("reload"===t)this._reloadSource(e);else{if("clear"!==t)throw Error(`Invalid action ${t}`);this._clearSource(e)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(let t in this._updatedPaintProps)this._layers[t].updateTransitions(e);this._resetUpdates()}let i={};for(let e in this.tileManagers){let t=this.tileManagers[e];i[e]=t.used,t.used=!1}let n=this.imageManager.listImages();for(let t of this._order){let i=this._layers[t];i.recalculate(e,n),!i.isHidden(e.zoom)&&i.source&&(this.tileManagers[i.source].used=!0)}for(let e in i){let t=this.tileManagers[e];!!i[e]!=!!t.used&&t.fire(new cC("data",{sourceDataType:"visibility",sourceId:e}))}this.light.recalculate(e),this.sky.recalculate(e),this.projection.recalculate(e),this.z=e.zoom,t&&this.fire(new lC("data"))}_updateTilesForChangedImages(){let e=Object.keys(this._changedImages);if(e.length){for(let t in this.tileManagers)this.tileManagers[t].reloadTilesForDependencies(["icons","patterns"],e);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(let e in this.tileManagers)this.tileManagers[e].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(e,t){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(e,!1),removedIds:t})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(e,t={}){this._checkLoaded();let i=this.serialize();if(e=t.transformStyle?t.transformStyle(i,e):e,(t.validate??!0)&&Rf(this,e))return!1;(e=_h(e)).layers=vC(e.layers);let n=TC(i,e),a=this._getOperationsToPerform(n);if(a.unimplemented.length>0)throw Error(`Unimplemented: ${a.unimplemented.join(", ")}.`);if(0===a.operations.length)return!1;for(let e of a.operations)e();return this.stylesheet=e,this._serializedLayers=null,this.fire(new oC({style:this})),!0}_getOperationsToPerform(e){let t=[],i=[];for(let n of e)switch(n.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":case"setRoll":continue;case"addLayer":t.push(()=>this.addLayer.apply(this,n.args));break;case"removeLayer":t.push(()=>this.removeLayer.apply(this,n.args));break;case"setPaintProperty":t.push(()=>this.setPaintProperty.apply(this,n.args));break;case"setLayoutProperty":t.push(()=>this.setLayoutProperty.apply(this,n.args));break;case"setFilter":t.push(()=>this.setFilter.apply(this,n.args));break;case"addSource":t.push(()=>this.addSource.apply(this,n.args));break;case"removeSource":t.push(()=>this.removeSource.apply(this,n.args));break;case"setLayerZoomRange":t.push(()=>this.setLayerZoomRange.apply(this,n.args));break;case"setLight":t.push(()=>this.setLight.apply(this,n.args));break;case"setGeoJSONSourceData":t.push(()=>this.setGeoJSONSourceData.apply(this,n.args));break;case"setGlyphs":t.push(()=>this.setGlyphs.apply(this,n.args));break;case"setFontFaces":t.push(()=>this.setFontFaces.apply(this,n.args));break;case"setSprite":t.push(()=>this.setSprite.apply(this,n.args));break;case"setTerrain":t.push(()=>this.map.setTerrain.apply(this,n.args));break;case"setSky":t.push(()=>this.setSky.apply(this,n.args));break;case"setProjection":this.setProjection.apply(this,n.args);break;case"setGlobalState":t.push(()=>this.setGlobalState.apply(this,n.args));break;case"setTransition":t.push(()=>{});break;default:i.push(n.command)}return{operations:t,unimplemented:i}}addImage(e,t){this.getImage(e)?this.fire(new td(Error(`An image named "${e}" already exists.`))):(this.imageManager.addImage(e,t),this._afterImageUpdated(e))}updateImage(e,t){this.imageManager.updateImage(e,t)}getImage(e){return this.imageManager.getImage(e)}setMissingImageResolver(e){this.imageManager.setMissingImageResolver(e)}removeImage(e){this.getImage(e)?(this.imageManager.removeImage(e),this._afterImageUpdated(e)):this.fire(new td(Error(`An image named "${e}" does not exist.`)))}_markImagesChanged(e){for(let t of e)this._changedImages[t]=!0}_afterImageUpdated(e){this._changedImages[e]=!0,this._imagesListDirty=!0,this._changed=!0,this.fire(new lC("data"))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(e,t,i={}){if(this._checkLoaded(),void 0!==this.tileManagers[e])throw Error(`Source "${e}" already exists.`);if(!t.type)throw Error(`The type property must be defined, but only the following properties were given: ${Object.keys(t).join(", ")}.`);if(zf.has(t.type)&&this._validate(Ff.source,`sources.${e}`,t,null,i))return;this.map?._collectResourceTiming&&(t.collectResourceTiming=!0);let n=this.tileManagers[e]=new hD(e,t,this.dispatcher);n.style=this,n.setEventedParent(this,()=>({isSourceLoaded:n.loaded(),source:n.serialize(),sourceId:e})),n.onAdd(this.map),this._changed=!0}removeSource(e){if(this._checkLoaded(),void 0===this.tileManagers[e])throw Error(`There is no source with this ID=${e}`);for(let t in this._layers)if(this._layers[t].source===e)return this.fire(new td(Error(`Source "${e}" cannot be removed while layer "${t}" is using it.`)));let t=this.tileManagers[e];delete this.tileManagers[e],delete this._updatedSources[e],t.fire(new cC("data",{sourceDataType:"metadata",sourceId:e})),t.setEventedParent(null),t.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(e,t){if(this._checkLoaded(),void 0===this.tileManagers[e])throw Error(`There is no source with this ID=${e}`);let i=this.tileManagers[e].getSource();if("geojson"!==i.type)throw Error(`geojsonSource.type is ${i.type}, which is !== 'geojson`);i.setData(t),this._changed=!0}getSource(e){return this.tileManagers[e]?.getSource()}addLayer(e,t,i={}){this._checkLoaded();let n,a=e.id;if(this.getLayer(a))return void this.fire(new td(Error(`Layer "${a}" already exists on this map.`)));if("custom"===e.type){if(Lf(this,function(e){let t=[],i=e.id;return void 0===i&&t.push(new sd(`layers.${i}`,null,'missing required property "id"')),void 0===e.render&&t.push(new sd(`layers.${i}`,null,'missing required method "render"')),e.renderingMode&&"2d"!==e.renderingMode&&"3d"!==e.renderingMode&&t.push(new sd(`layers.${i}`,null,'property "renderingMode" must be either "2d" or "3d"')),t}(e)))return;n=OE(e,this._globalState)}else{if("source"in e&&"object"==typeof e.source&&(this.addSource(a,e.source),e=lh(e=_h(e),{source:a})),this._validate(Ff.layer,`layers.${a}`,e,{arrayIndex:-1},i))return;n=OE(e,this._globalState),this._validateLayer(n),n.setEventedParent(this,{layer:{id:a}})}let r=t?this._order.indexOf(t):this._order.length;if(t&&-1===r)this.fire(new td(Error(`Cannot add layer "${a}" before non-existing layer "${t}".`)));else{if(this._order.splice(r,0,a),this._layerOrderChanged=!0,this._layers[a]=n,this._removedLayers[a]&&n.source&&"custom"!==n.type){let e=this._removedLayers[a];delete this._removedLayers[a],e.type===n.type?(this._updatedSources[n.source]="reload",this.tileManagers[n.source].pause()):this._updatedSources[n.source]="clear"}this._updateLayer(n),n.onAdd&&n.onAdd(this.map)}}moveLayer(e,t){if(this._checkLoaded(),this._changed=!0,!this._layers[e])return void this.fire(new td(Error(`The layer '${e}' does not exist in the map's style and cannot be moved.`)));if(e===t)return;if(t&&!this._order.includes(t))return void this.fire(new td(Error(`Cannot move layer "${e}" before non-existing layer "${t}".`)));let i=this._order.indexOf(e);this._order.splice(i,1);let n=t?this._order.indexOf(t):this._order.length;this._order.splice(n,0,e),this._layerOrderChanged=!0}removeLayer(e){this._checkLoaded();let t=this._layers[e];if(!t)return void this.fire(new td(Error(`Cannot remove non-existing layer "${e}".`)));t.setEventedParent(null);let i=this._order.indexOf(e);this._order.splice(i,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[e]=t,delete this._layers[e],this._serializedLayers&&delete this._serializedLayers[e],delete this._updatedLayers[e],delete this._updatedPaintProps[e],"symbol"===t.type&&t.source&&this.tileManagers[t.source]?.resetMaxContentElevation(),t.onRemove&&t.onRemove(this.map)}getLayer(e){return this._layers[e]}getLayersOrder(){return[...this._order]}hasLayer(e){return e in this._layers}setLayerZoomRange(e,t,i){this._checkLoaded();let n=this.getLayer(e);n?(n.minzoom!==t||n.maxzoom!==i)&&(null!=t&&(n.minzoom=t),null!=i&&(n.maxzoom=i),this._updateLayer(n)):this.fire(new td(Error(`Cannot set the zoom range of non-existing layer "${e}".`)))}setFilter(e,t,i={}){this._checkLoaded();let n=this.getLayer(e);if(n){if(!Ah(n.filter,t)){if(null==t)return n.setFilter(void 0),void this._updateLayer(n);this._validate(Ff.filter,`layers.${n.id}.filter`,t,null,i)||(n.setFilter(_h(t)),this._updateLayer(n))}}else this.fire(new td(Error(`Cannot filter non-existing layer "${e}".`)))}getFilter(e){return _h(this.getLayer(e).filter)}setLayoutProperty(e,t,i,n={}){this._checkLoaded();let a=this.getLayer(e);a?Ah(a.getLayoutProperty(t),i)||(a.setLayoutProperty(t,i,n),this._updateLayer(a)):this.fire(new td(Error(`Cannot style non-existing layer "${e}".`)))}getLayoutProperty(e,t){let i=this.getLayer(e);if(i)return i.getLayoutProperty(t);this.fire(new td(Error(`Cannot get style of non-existing layer "${e}".`)))}setPaintProperty(e,t,i,n={}){this._checkLoaded();let a=this.getLayer(e);a?Ah(a.getPaintProperty(t),i)||this._updatePaintProperty(a,t,i,n):this.fire(new td(Error(`Cannot style non-existing layer "${e}".`)))}_updatePaintProperty(e,t,i,n={}){e.setPaintProperty(t,i,n)&&this._updateLayer(e),fA(e)&&"raster-fade-duration"===t&&this.tileManagers[e.source].setRasterFadeDuration(i),this._changed=!0,this._updatedPaintProps[e.id]=!0,"symbol"===e.type&&this.triggerSymbolPlacement(),this._serializedLayers=null}getPaintProperty(e,t){return this.getLayer(e).getPaintProperty(t)}setFeatureState(e,t){this._checkLoaded();let i=e.source,n=e.sourceLayer,a=this.tileManagers[i];if(void 0===a)return void this.fire(new td(Error(`The source '${i}' does not exist in the map's style.`)));let r=a.getSource().type;if("geojson"===r&&n)return void this.fire(new td(Error("GeoJSON sources cannot have a sourceLayer parameter.")));if("vector"===r&&!n)return void this.fire(new td(Error("The sourceLayer parameter must be provided for vector source types.")));if(void 0===e.id)return void this.fire(new td(Error("The feature id parameter must be provided.")));let s=["__proto__","constructor","prototype"];t&&Object.keys(t).some(e=>s.includes(e))?this.fire(new td(Error(`The feature state should not include one of the following keys: ${s}`))):a.setFeatureState(n,e.id,t)}removeFeatureState(e,t){this._checkLoaded();let i=e.source,n=this.tileManagers[i];if(void 0===n)return void this.fire(new td(Error(`The source '${i}' does not exist in the map's style.`)));let a=n.getSource().type,r="vector"===a?e.sourceLayer:void 0;"vector"!==a||r?t&&"string"!=typeof e.id&&"number"!=typeof e.id?this.fire(new td(Error("A feature id is required to remove its specific state property."))):n.removeFeatureState(r,e.id,t):this.fire(new td(Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(e){this._checkLoaded();let t=e.source,i=e.sourceLayer,n=this.tileManagers[t];if(void 0!==n){if("vector"!==n.getSource().type||i)return void 0===e.id&&this.fire(new td(Error("The feature id parameter must be provided."))),n.getFeatureState(i,e.id);this.fire(new td(Error("The sourceLayer parameter must be provided for vector source types.")))}else this.fire(new td(Error(`The source '${t}' does not exist in the map's style.`)))}getTransition(){return lh({duration:300,delay:0},this.stylesheet?.transition)}serialize(){if(!this._loaded)return;let e=gh(this.tileManagers,e=>e.serialize()),t=this._serializeByIds(this._order,!0),i=this.map.getTerrain()||void 0,n=this.stylesheet;return fh({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,"font-faces":n["font-faces"],transition:n.transition,projection:n.projection,state:n.state,sources:e,layers:t,terrain:i},e=>void 0!==e)}_updateLayer(e){this._updatedLayers[e.id]=!0,e.source&&!this._updatedSources[e.source]&&"raster"!==this.tileManagers[e.source].getSource().type&&(this._updatedSources[e.source]="reload",this.tileManagers[e.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(e){let t=e=>"fill-extrusion"===this._layers[e].type,i={},n=[];for(let a=this._order.length-1;a>=0;a--){let r=this._order[a];if(t(r)){i[r]=a;for(let t of e){let e=t[r];if(e)for(let t of e)n.push(t)}}}n.sort((e,t)=>t.intersectionZ-e.intersectionZ);let a=[];for(let r=this._order.length-1;r>=0;r--){let s=this._order[r];if(t(s))for(let e=n.length-1;e>=0;e--){let t=n[e].feature;if(i[t.layer.id]<r)break;a.push(t),n.pop()}else for(let t of e){let e=t[s];if(e)for(let t of e)a.push(t.feature)}}return a}queryRenderedFeatures(e,t,i){t?.filter&&this._validate(Ff.filter,"queryRenderedFeatures.filter",t.filter,null,t);let n={};if(t?.layers){if(!(Array.isArray(t.layers)||t.layers instanceof Set))return this.fire(new td(Error("parameters.layers must be an Array or a Set of strings"))),[];for(let e of t.layers){let t=this._layers[e];if(!t)return this.fire(new td(Error(`The layer '${e}' does not exist in the map's style and cannot be queried for features.`))),[];n[t.source]=!0}}let a=[];t.availableImages=this.imageManager.listImages();let r=this._serializedAllLayers(),s=t.layers instanceof Set?t.layers:Array.isArray(t.layers)?new Set(t.layers):null,o={...t,layers:s,globalState:this._globalState};for(let s in this.tileManagers)(!t.layers||n[s])&&a.push(uT(this.tileManagers[s],this._layers,r,e,o,i,this.map.terrain?(e,t,i)=>this.map.terrain.getElevation(e,t,i):void 0));return this.placement&&a.push(hT(this._layers,r,this.tileManagers,e,o,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(a)}querySourceFeatures(e,t){t?.filter&&this._validate(Ff.filter,"querySourceFeatures.filter",t.filter,null,t);let i=this.tileManagers[e];return i?function(e,t){let i=e.getRenderableIds().map(t=>e.getTileByID(t)),n=[],a={};for(let e of i){let i=e.tileID.canonical.key;a[i]||(a[i]=!0,e.querySourceFeatures(n,t))}return n}(i,t?{...t,globalState:this._globalState}:{globalState:this._globalState}):[]}getLight(){return this.light.getLight()}setLight(e,t={}){this._checkLoaded();let i=this.light.getLight(),n=!1;for(let t in e)if(!Ah(e[t],i[t])){n=!0;break}if(!n)return;let a={now:tC(),transition:lh({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(e,t),this.light.updateTransitions(a)}getProjection(){return this.stylesheet?.projection}setProjection(e){this._checkLoaded();let t=e??{type:"mercator"};if(this.stylesheet.projection=e,this.projection){if(this.projection.name===t.type)return;this.projection.destroy(),delete this.projection}this._setProjectionInternal(t.type)}getSky(){return this.stylesheet?.sky}setSky(e,t={}){this._checkLoaded();let i=this.getSky(),n=!1;if(!e&&!i)return;if(e&&!i)n=!0;else if(!e&&i)n=!0;else for(let t in e)if(!Ah(e[t],i[t])){n=!0;break}if(!n)return;let a={now:tC(),transition:lh({duration:300,delay:0},this.stylesheet.transition)};this.stylesheet.sky=e,this.sky.setSky(e,t),this.sky.updateTransitions(a)}_setProjectionInternal(e){let t=function(e,t,i){let n={constrainOverride:t};if(Array.isArray(e)){let t=new HP({type:e},i);return{projection:t,transform:new fI(n),cameraHelper:new _I(t)}}switch(e){case"mercator":return{projection:new xP,transform:new RP(n),cameraHelper:new jP};case"globe":{let e=new HP({type:["interpolate",["linear"],["zoom"],11,"vertical-perspective",12,"mercator"]},{});return{projection:e,transform:new fI(n),cameraHelper:new _I(e)}}case"vertical-perspective":return{projection:new GP,transform:new pI(n),cameraHelper:new AI};default:return yh(`Unknown projection name: ${e}. Falling back to mercator projection.`),{projection:new xP,transform:new RP(n),cameraHelper:new jP}}}(e,this.map._camera?.transform.constrainOverride,this._globalState);this.projection=t.projection,this.map.migrateProjection(t.transform,t.cameraHelper);for(let e in this.tileManagers)this.tileManagers[e].reload()}_validate(e,t,i,n,a={}){return!1!==a.validate&&Bf(this,e,{key:t,style:this.serialize(),value:i,...n},a)}_remove(e=!0){this._frameRequest&&=(this._frameRequest.abort(),null),this._loadStyleRequest&&=(this._loadStyleRequest.abort(),null),this._spriteRequest&&=(this._spriteRequest.abort(),null),HT().off(VT,this._rtlPluginLoaded);for(let e in this._layers)this._layers[e].setEventedParent(null);for(let e in this.tileManagers){let t=this.tileManagers[e];t.setEventedParent(null),t.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),e&&this.dispatcher.broadcast("RM",void 0),this.dispatcher.remove(e)}_clearSource(e){this.tileManagers[e].clearTiles()}_reloadSource(e){this.tileManagers[e].resume(),this.tileManagers[e].reload()}_updateSources(e){for(let t in this.tileManagers)this.tileManagers[t].update(e,this.map.terrain)}_generateCollisionBoxes(){for(let e in this.tileManagers)this._reloadSource(e)}triggerSymbolPlacement(){this._symbolPlacementTriggered=!0}_placementInputsChanged(e,t,i){let n=this.pauseablePlacement;return!n||this._symbolPlacementTriggered||this._placedProjectionTransition!==this.projection?.transitionState||n._showCollisionBoxes!==t||n.placement.collisionGroups.crossSourceCollisions!==i||n.placement.transform.renderWorldCopies!==e.renderWorldCopies||!function(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]&&e[9]===t[9]&&e[10]===t[10]&&e[11]===t[11]&&e[12]===t[12]&&e[13]===t[13]&&e[14]===t[14]&&e[15]===t[15]}(n.placement.transform.modelViewProjectionMatrix,e.modelViewProjectionMatrix)}_updatePlacement(e,t,i,n,a=!1){let r=!1,s=!1,o={};for(let t of this._order){let i=this._layers[t];if("symbol"!==i.type)continue;if(!o[i.source]){let e=this.tileManagers[i.source];o[i.source]=e.getRenderableIds(!0).map(t=>e.getTileByID(t)).sort((e,t)=>t.tileID.overscaledZ-e.tileID.overscaledZ||(e.tileID.isLessThan(t.tileID)?-1:1))}let n=this.crossTileSymbolIndex.addLayer(i,o[i.source],e.center.lng);r||=n}this.crossTileSymbolIndex.pruneUnusedLayers(this._order),a||=this._layerOrderChanged||0===i;let l=r||this._placementInputsChanged(e,t,n),c=this.pauseablePlacement?.isDone()&&!this.placement.stillRecent(tC(),e.zoom);if((a||!this.pauseablePlacement||c&&(l||this.placement.stale))&&(this._symbolPlacementTriggered=!1,this._placedProjectionTransition=this.projection?.transitionState,this.pauseablePlacement=new iP(e,this.map.terrain,this._order,a,t,i,n,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?l&&this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,o),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(tC()),s=!0),r&&this.pauseablePlacement.placement.setStale()),s||r)for(let e of this._order){let t=this._layers[e];"symbol"===t.type&&this.placement.updateLayerOpacities(t,o[t.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(tC())}_releaseSymbolFadeTiles(){for(let e in this.tileManagers)this.tileManagers[e].releaseSymbolFadeTiles()}async getImages(e,t){let i=await this.imageManager.getImages(t.icons);this._updateTilesForChangedImages();let n=this.tileManagers[t.source];return n&&n.setDependencies(t.tileID.key,t.type,t.icons),i}async getGlyphs(e,t){let i=await this.glyphManager.getGlyphs(t.stacks),n=this.tileManagers[t.source];return n&&n.setDependencies(t.tileID.key,t.type,[""]),i}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(e,t={}){this._checkLoaded(),(!e||!this._validate(Ff.glyphs,"glyphs",e,null,t))&&(this._changed=!0,this._glyphsDidChange=!0,this.stylesheet.glyphs=e,this.glyphManager.entries={},this.glyphManager.setURL(e))}getFontFaces(){return this.stylesheet["font-faces"]||null}setFontFaces(e){this._checkLoaded(),this._changed=!0,this._glyphsDidChange=!0,this.stylesheet["font-faces"]=e,this.glyphManager.setFontFaces(e)}async getDashes(e,t){let i={};for(let[e,n]of Object.entries(t.dashes))i[e]=this.lineAtlas.getDash(n.dasharray,n.round);return i}addSprite(e,t,i={},n){this._checkLoaded();let a=[{id:e,url:t}],r=[...DC(this.stylesheet.sprite),...a];this._validate(Ff.sprite,"sprite",r,null,i)||(this.stylesheet.sprite=r,this._loadSprite(a,!0,n))}removeSprite(e){this._checkLoaded();let t=DC(this.stylesheet.sprite);if(!t.find(t=>t.id===e))return void this.fire(new td(Error(`Sprite "${e}" doesn't exists on this map.`)));let i=this.imageManager.removeSpriteImages(e);this._markImagesChanged(i),t.splice(t.findIndex(t=>t.id===e),1),this.stylesheet.sprite=t.length>0?t:void 0,this._imagesListDirty=!0,this._changed=!0,this.fire(new lC("data"))}getSprite(){return DC(this.stylesheet.sprite)}setSprite(e,t={},i){this._checkLoaded(),(!e||!this._validate(Ff.sprite,"sprite",e,null,t))&&(this.stylesheet.sprite=e,e?this._loadSprite(e,!0,i):(this._unloadSprite(),i&&i(null)))}destroy(){this._frameRequest&&=(this._frameRequest.abort(),null),this._loadStyleRequest&&=(this._loadStyleRequest.abort(),null),this._spriteRequest&&=(this._spriteRequest.abort(),null);for(let e in this.tileManagers){let t=this.tileManagers[e];t.setEventedParent(null),t.onRemove(this.map)}this.tileManagers={},this.imageManager&&(this.imageManager.setEventedParent(null),this.imageManager.destroy(),this.patternAtlas.destroy()),this.glyphManager&&this.glyphManager.destroy();for(let e in this._layers){let t=this._layers[e];t.setEventedParent(null),t.onRemove&&t.onRemove(this.map)}this._setInitialValues(),this.setEventedParent(null),this.dispatcher.unregisterMessageHandler("GG"),this.dispatcher.unregisterMessageHandler("GI"),this.dispatcher.unregisterMessageHandler("GDA"),this.dispatcher.remove(!0),this._listeners={},this._oneTimeListeners={}}};const xI=xA([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);var bI=class{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(e,t,i,n,a,r,s,o,l){this.context=e;let c=this.boundPaintVertexBuffers.length!==n.length;for(let e=0;!c&&e<n.length;e++)this.boundPaintVertexBuffers[e]!==n[e]&&(c=!0);!this.vao||this.boundProgram!==t||this.boundLayoutVertexBuffer!==i||c||this.boundIndexBuffer!==a||this.boundVertexOffset!==r||this.boundDynamicVertexBuffer!==s||this.boundDynamicVertexBuffer2!==o||this.boundDynamicVertexBuffer3!==l?this.freshBind(t,i,n,a,r,s,o,l):e.bindVertexArray.set(this.vao)}freshBind(e,t,i,n,a,r,s,o){let l=e.numAttributes,c=this.context,u=c.gl;this.vao&&this.destroy(),this.vao=c.createVertexArray(),c.bindVertexArray.set(this.vao),this.boundProgram=e,this.boundLayoutVertexBuffer=t,this.boundPaintVertexBuffers=i,this.boundIndexBuffer=n,this.boundVertexOffset=a,this.boundDynamicVertexBuffer=r,this.boundDynamicVertexBuffer2=s,this.boundDynamicVertexBuffer3=o,t.enableAttributes(u,e);for(let t of i)t.enableAttributes(u,e);r&&r.enableAttributes(u,e),s&&s.enableAttributes(u,e),o&&o.enableAttributes(u,e),t.bind(),t.setVertexAttribPointers(u,e,a);for(let t of i)t.bind(),t.setVertexAttribPointers(u,e,a);r&&(r.bind(),r.setVertexAttribPointers(u,e,a)),n&&n.bind(),s&&(s.bind(),s.setVertexAttribPointers(u,e,a)),o&&(o.bind(),o.setVertexAttribPointers(u,e,a)),c.currentNumAttributes=l}destroy(){this.vao&&=(this.context.deleteVertexArray(this.vao),null)}};const wI=(e,t,i,n,a)=>({u_texture:0,u_ele_delta:e,u_fog_matrix:t,u_fog_color:i?i.properties.get("fog-color"):ep.white,u_fog_ground_blend:i?i.properties.get("fog-ground-blend"):1,u_fog_ground_blend_opacity:a?0:i?i.calculateFogBlendOpacity(n):0,u_horizon_color:i?i.properties.get("horizon-color"):ep.white,u_horizon_fog_blend:i?i.properties.get("horizon-fog-blend"):1,u_is_globe_mode:+!!a}),EI=e=>({u_ele_delta:e}),kI={ProjectionUBO:0,TerrainUBO:1,FrameUBO:2};const SI={float:[1,1],int:[1,1],vec2:[2,2],vec4:[4,4],mat4:[16,4]};function MI(e){let t={},i=0;for(let{name:n,type:a}of e){let[e,r]=SI[a];i=Math.ceil(i/r)*r,t[n]=i,i+=e}return{offsets:t,contentWords:i,sizeWords:4*Math.ceil(i/4)}}var CI=class{constructor(e,t,i){this.context=e,this.binding=t,this.contentWords=i.contentWords;let n=e.gl;this.buffer=n.createBuffer(),n.bindBuffer(n.UNIFORM_BUFFER,this.buffer),n.bufferData(n.UNIFORM_BUFFER,4*i.sizeWords,n.DYNAMIC_DRAW),n.bindBufferBase(n.UNIFORM_BUFFER,t,this.buffer),this.uploaded=new Float32Array(i.sizeWords),this.pending=new Float32Array(i.sizeWords),this.uploadedWords=new Uint32Array(this.uploaded.buffer),this.pendingWords=new Uint32Array(this.pending.buffer),this.hasData=!1,this.bindingDirty=!1}upload(){let e=this.context.gl,t=!this.hasData;if(!t){let e=this.pendingWords,i=this.uploadedWords;for(let n=0;n<this.contentWords;n++)if(e[n]!==i[n]){t=!0;break}}this.bindingDirty&&=(e.bindBufferBase(e.UNIFORM_BUFFER,this.binding,this.buffer),!1),t&&(e.bindBuffer(e.UNIFORM_BUFFER,this.buffer),e.bufferSubData(e.UNIFORM_BUFFER,0,this.pending),this.uploaded.set(this.pending),this.hasData=!0)}destroy(){let e=this.context.gl;this.buffer&&(e.deleteBuffer(this.buffer),delete this.buffer)}};const TI=MI([{name:"u_projection_matrix",type:"mat4"},{name:"u_projection_fallback_matrix",type:"mat4"},{name:"u_projection_tile_mercator_coords",type:"vec4"},{name:"u_projection_clipping_plane",type:"vec4"},{name:"u_projection_transition",type:"float"},{name:"u_projection_clip_antimeridian",type:"int"}]),DI=TI.offsets;const PI=MI([{name:"u_terrain_matrix",type:"mat4"},{name:"u_terrain_unpack",type:"vec4"},{name:"u_terrain_dim",type:"float"},{name:"u_terrain_exaggeration",type:"float"}]),II=PI.offsets;function FI(e){let t=[];for(let i of e){if(null===i)continue;let e=i.split(" ");t.push(e.pop())}return t}var zI=class{constructor(e,t,i,n,a,r,s,o,l=[]){let c=e.gl;this.program=c.createProgram();let u=FI(t.staticAttributes),h=i?i.getBinderAttributes():[],d=u.concat(h),p=AP.prelude.staticUniforms?FI(AP.prelude.staticUniforms):[],m=t.staticUniforms?FI(t.staticUniforms):[],g=i?i.getBinderUniforms():[],f=p.concat(m).concat(g),A=[];for(let e of f)A.includes(e)||A.push(e);let _=i?i.defines():[];_.unshift("#version 300 es"),a&&_.push("#define OVERDRAW_INSPECTOR;"),r&&_.push("#define TERRAIN3D;"),o&&_.push(o),l&&_.push(...l);let v=_.concat(AP.prelude.fragmentSource,s.fragmentSource,t.fragmentSource).join("\n"),y=_.concat(AP.prelude.vertexSource,s.vertexSource,t.vertexSource).join("\n"),x=c.createShader(c.FRAGMENT_SHADER);if(c.isContextLost())return void(this.failedToCreate=!0);c.shaderSource(x,v),c.compileShader(x),c.attachShader(this.program,x);let b=c.createShader(c.VERTEX_SHADER);if(c.isContextLost())return void(this.failedToCreate=!0);c.shaderSource(b,y),c.compileShader(b),c.attachShader(this.program,b),this.attributes={};let w={};if(this.numAttributes=d.length,c.linkProgram(this.program),!c.getProgramParameter(this.program,c.LINK_STATUS)){if(c.isContextLost())return void(this.failedToCreate=!0);throw c.getShaderParameter(x,c.COMPILE_STATUS)?c.getShaderParameter(b,c.COMPILE_STATUS)?Error(`Program failed to link: ${c.getProgramInfoLog(this.program)}`):Error(`Could not compile vertex shader: ${c.getShaderInfoLog(b)}`):Error(`Could not compile fragment shader: ${c.getShaderInfoLog(x)}`)}!function(e,t){for(let[i,n]of Object.entries(kI)){let a=e.getUniformBlockIndex(t,i);a!==e.INVALID_INDEX&&e.uniformBlockBinding(t,a,n)}}(c,this.program);let E=function(e,t){let i=new Set([e.INT,e.INT_VEC2,e.INT_VEC3,e.INT_VEC4,e.UNSIGNED_INT,e.UNSIGNED_INT_VEC2,e.UNSIGNED_INT_VEC3,e.UNSIGNED_INT_VEC4]),n=new Set,a=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES);for(let r=0;r<a;r++){let a=e.getActiveAttrib(t,r);a&&i.has(a.type)&&n.add(a.name)}return n}(c,this.program);for(let e of d){if(!e)continue;let t=c.getAttribLocation(this.program,e);t>=0&&(this.attributes[e]={location:t,isInteger:E.has(e)})}c.deleteShader(b),c.deleteShader(x);for(let e of A)if(e&&!w[e]){let t=c.getUniformLocation(this.program,e);t&&(w[e]=t)}this.fixedUniforms=n(e,w),this.terrainUniforms=((e,t)=>({u_depth:new O_(e,t.u_depth),u_terrain:new O_(e,t.u_terrain)}))(e,w),this.binderUniforms=i?i.getUniforms(e,w):[]}draw(e,t,i,n,a,r,s,o,l,c,u,h,d,p,m,g,f,A,_){let v=e.gl;if(this.failedToCreate)return;if(e.program.set(this.program),e.setDepthMode(i),e.setStencilMode(n),e.setColorMode(a),e.setCullFace(r),o){e.activeTexture.set(v.TEXTURE2),v.bindTexture(v.TEXTURE_2D,o.depthTexture),e.activeTexture.set(v.TEXTURE3),v.bindTexture(v.TEXTURE_2D,o.texture);for(let e in this.terrainUniforms)this.terrainUniforms[e].set(o[e]);!function(e,t){let i=e.pending;i.set(t.u_terrain_matrix,II.u_terrain_matrix),i.set(t.u_terrain_unpack,II.u_terrain_unpack),i[II.u_terrain_dim]=t.u_terrain_dim,i[II.u_terrain_exaggeration]=t.u_terrain_exaggeration,e.upload()}(e.terrainUniformBuffer,o)}if(l&&function(e,t){let i=e.pending;i.set(t.mainMatrix,DI.u_projection_matrix),i.set(t.fallbackMatrix,DI.u_projection_fallback_matrix),i.set(t.tileMercatorCoords,DI.u_projection_tile_mercator_coords),i.set(t.clippingPlane,DI.u_projection_clipping_plane),i[DI.u_projection_transition]=t.projectionTransition,e.pendingWords[DI.u_projection_clip_antimeridian]=+!!t.clipAntimeridian,e.upload()}(e.projectionUniformBuffer,l),s)for(let e in this.fixedUniforms)this.fixedUniforms[e].set(s[e]);g&&g.setUniforms(e,this.binderUniforms,p,{zoom:m});let y=0;switch(t){case v.LINES:y=2;break;case v.TRIANGLES:y=3;break;case v.LINE_STRIP:y=1}for(let i of d.get())i.vaos||={},i.vaos[c]||=new bI,i.vaos[c].bind(e,this,u,g?g.getPaintVertexBuffers():[],h,i.vertexOffset,f,A,_),v.drawElements(t,i.primitiveLength*y,v.UNSIGNED_SHORT,i.primitiveOffset*y*2)}};function RI(e,t,i){let n=1/Nu(i,1,t.transform.tileZoom),a=2**i.tileID.overscaledZ,r=i.tileSize*2**t.transform.tileZoom/a,s=r*(i.tileID.canonical.x+i.tileID.wrap*a),o=r*i.tileID.canonical.y;return{u_image:0,u_texsize:i.imageAtlasTexture.size,u_scale:[n,e.fromScale,e.toScale],u_fade:e.t,u_pixel_coord_upper:[s>>16,o>>16],u_pixel_coord_lower:[65535&s,65535&o]}}const LI=(e,t,i,n)=>{let a=e.style.light,r=a.getCartesianPosition(),s=Yc();"viewport"===a.properties.get("anchor")&&function(e,t){var i=Math.sin(t),n=Math.cos(t);e[0]=n,e[1]=i,e[2]=0,e[3]=-i,e[4]=n,e[5]=0,e[6]=0,e[7]=0,e[8]=1}(s,e.transform.bearingInRadians),function(e,t,i){var n=t[0],a=t[1],r=t[2];e[0]=n*i[0]+a*i[3]+r*i[6],e[1]=n*i[1]+a*i[4]+r*i[7],e[2]=n*i[2]+a*i[5]+r*i[8]}(r,r,s);let o=e.transform.transformLightDirection(r),l=a.properties.get("color");return{u_lightpos:r,u_lightpos_globe:o,u_lightintensity:a.properties.get("intensity"),u_lightcolor:[l.r,l.g,l.b],u_vertical_gradient:+t,u_opacity:i,u_fill_translate:n}},BI=(e,t,i,n,a,r,s)=>lh(LI(e,t,i,n),RI(r,e,s),{u_height_factor:-(2**a.overscaledZ)/s.tileSize/8}),OI=(e,t,i,n,a)=>lh(RI(t,e,i),{u_fill_translate:n,u_sdf_pattern:+!!a}),UI=e=>({u_fill_translate:e}),NI=e=>({u_fill_translate:e}),jI=(e,t,i,n,a)=>OI(e,t,i,n,a),VI=(e,t,i,n,a)=>{let r,s,o=e.transform,l=0;if("map"===i.paint.get("circle-pitch-alignment")){let e=Nu(t,1,o.zoom);r=!0,s=[e,e],l=e/(Uu*2**t.tileID.overscaledZ)*2*Math.PI*a}else r=!1,s=o.pixelsToGLUnits;return{u_scale_with_map:+("map"===i.paint.get("circle-pitch-scale")),u_pitch_with_map:+r,u_extrude_scale:s,u_globe_extrude_scale:l,u_translate:n}},qI=(e,t=1)=>({u_color:e,u_overlay:0,u_overlay_scale:t}),GI=(e,t,i,n)=>{let a=Nu(e,1,t)/(Uu*2**e.tileID.overscaledZ)*2*Math.PI*n;return{u_extrude_scale:Nu(e,1,t),u_intensity:i,u_globe_extrude_scale:a}},HI=(e,t,i,n)=>{let a=Jc();return cu(a,0,e.width,e.height,0,0,1),{u_matrix:a,u_image:i,u_color_ramp:n,u_opacity:t.paint.get("heatmap-opacity")}},WI=(e,t,i)=>{let n,a=i.paint.get("hillshade-accent-color");switch(i.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}let r=i.getIlluminationProperties();for(let t=0;t<r.directionRadians.length;t++)"viewport"===i.paint.get("hillshade-illumination-anchor")&&(r.directionRadians[t]+=e.transform.bearingInRadians);return{u_image:0,u_latrange:KI(e,t.tileID),u_exaggeration:i.paint.get("hillshade-exaggeration"),u_altitudes:r.altitudeRadians,u_azimuths:r.directionRadians,u_accent:a,u_method:n,u_highlights:r.highlightColor,u_shadows:r.shadowColor}},ZI=(e,t)=>{let i=t.stride,n=Jc();return cu(n,0,Uu,-Uu,0,0,1),nu(n,n,[0,-Uu,0]),{u_matrix:n,u_image:1,u_dimension:[i,i],u_zoom:e.overscaledZ,u_unpack:t.getUnpackVector()}};function KI(e,t){let i=2**t.canonical.z,n=t.canonical.y;return[new Fx(0,n/i).toLngLat().lat,new Fx(0,(n+1)/i).toLngLat().lat]}const XI=(e,t,i=0)=>({u_image:0,u_unpack:t.getUnpackVector(),u_dimension:[t.stride,t.stride],u_elevation_stops:1,u_color_stops:4,u_color_ramp_size:i,u_opacity:e.paint.get("color-relief-opacity")}),QI=(e,t,i,n)=>{let a=e.transform;return{u_translation:iF(e,t,i),u_ratio:n/Nu(t,1,a.zoom)}},YI=(e,t,i,n,a)=>lh(QI(e,t,i,n),{u_image:0,u_image_height:a}),JI=(e,t,i,n,a)=>{let r=e.transform,s=tF(t,r);return{u_translation:iF(e,t,i),u_texsize:t.imageAtlasTexture.size,u_ratio:n/Nu(t,1,r.zoom),u_image:0,u_scale:[s,a.fromScale,a.toScale],u_fade:a.t}},$I=(e,t,i,n,a)=>{let r=tF(t,e.transform);return lh(QI(e,t,i,n),{u_tileratio:r,u_crossfade_from:a.fromScale,u_crossfade_to:a.toScale,u_image:0,u_mix:a.t,u_lineatlas_width:e.lineAtlas.width,u_lineatlas_height:e.lineAtlas.height})},eF=(e,t,i,n,a,r)=>{let s=tF(t,e.transform);return lh(QI(e,t,i,n),{u_image:0,u_image_height:r,u_tileratio:s,u_crossfade_from:a.fromScale,u_crossfade_to:a.toScale,u_image_dash:1,u_mix:a.t,u_lineatlas_width:e.lineAtlas.width,u_lineatlas_height:e.lineAtlas.height})};function tF(e,t){return 1/Nu(e,1,t.tileZoom)}function iF(e,t,i){return Zu(e.transform,t,i.paint.get("line-translate"),i.paint.get("line-translate-anchor"))}const nF=(e,t,i,n,a,r,s,o,l,c,u,h,d,p,m)=>({u_is_size_zoom_constant:+("constant"===e||"source"===e),u_is_size_feature_constant:+("constant"===e||"camera"===e),u_size_t:t?t.uSizeT:0,u_size:t?t.uSize:0,u_rotate_symbol:+i,u_label_plane_matrix:o,u_coord_matrix:l,u_is_text:+u,u_pitch_with_map:+n,u_is_along_line:a,u_is_variable_anchor:r,u_texsize:h,u_texture:0,u_translation:c,u_pitched_scale:d,u_is_offset:p,u_height_anchor_ground:+m}),aF=(e,t,i,n,a,r,s,o,l,c,u,h,d,p,m,g)=>{let f=s.transform;return lh(nF(e,t,i,n,a,r,0,o,l,c,u,h,p,m,g),{u_gamma_scale:n?Math.cos(f.pitch*Math.PI/180)*f.cameraToCenterDistance:1,u_is_halo:+!!d,u_is_plain:1})},rF=(e,t,i,n,a,r,s,o,l,c,u,h,d,p,m)=>lh(aF(e,t,i,n,a,r,s,o,l,c,!0,u,!0,d,p,m),{u_texsize_icon:h,u_texture_icon:1}),sF=(e,t)=>({u_opacity:e,u_color:t}),oF=(e,t,i,n,a)=>lh(function(e,t,i,n){let a=i.patternAtlas.getPattern(e.from.toString()),r=i.patternAtlas.getPattern(e.to.toString()),{width:s,height:o}=i.patternAtlas.getPixelSize(),l=2**n.tileID.overscaledZ,c=n.tileSize*2**i.transform.tileZoom/l,u=c*(n.tileID.canonical.x+n.tileID.wrap*l),h=c*n.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:a.tl,u_pattern_br_a:a.br,u_pattern_tl_b:r.tl,u_pattern_br_b:r.br,u_texsize:[s,o],u_mix:t.t,u_pattern_size_a:a.displaySize,u_pattern_size_b:r.displaySize,u_scale_a:t.fromScale,u_scale_b:t.toScale,u_tile_units_to_pixels:1/Nu(n,1,i.transform.tileZoom),u_pixel_coord_upper:[u>>16,h>>16],u_pixel_coord_lower:[65535&u,65535&h]}}(i,a,t,n),{u_opacity:e}),lF=(e,t)=>({}),cF={fillExtrusion:(e,t)=>({u_lightpos:new j_(e,t.u_lightpos),u_lightpos_globe:new j_(e,t.u_lightpos_globe),u_lightintensity:new U_(e,t.u_lightintensity),u_lightcolor:new j_(e,t.u_lightcolor),u_vertical_gradient:new U_(e,t.u_vertical_gradient),u_opacity:new U_(e,t.u_opacity),u_fill_translate:new N_(e,t.u_fill_translate)}),fillExtrusionPattern:(e,t)=>({u_lightpos:new j_(e,t.u_lightpos),u_lightpos_globe:new j_(e,t.u_lightpos_globe),u_lightintensity:new U_(e,t.u_lightintensity),u_lightcolor:new j_(e,t.u_lightcolor),u_vertical_gradient:new U_(e,t.u_vertical_gradient),u_height_factor:new U_(e,t.u_height_factor),u_opacity:new U_(e,t.u_opacity),u_fill_translate:new N_(e,t.u_fill_translate),u_image:new O_(e,t.u_image),u_texsize:new N_(e,t.u_texsize),u_pixel_coord_upper:new N_(e,t.u_pixel_coord_upper),u_pixel_coord_lower:new N_(e,t.u_pixel_coord_lower),u_scale:new j_(e,t.u_scale),u_fade:new U_(e,t.u_fade)}),fill:(e,t)=>({u_fill_translate:new N_(e,t.u_fill_translate)}),fillPattern:(e,t)=>({u_image:new O_(e,t.u_image),u_texsize:new N_(e,t.u_texsize),u_pixel_coord_upper:new N_(e,t.u_pixel_coord_upper),u_pixel_coord_lower:new N_(e,t.u_pixel_coord_lower),u_scale:new j_(e,t.u_scale),u_fade:new U_(e,t.u_fade),u_sdf_pattern:new O_(e,t.u_sdf_pattern),u_fill_translate:new N_(e,t.u_fill_translate)}),fillOutline:(e,t)=>({u_fill_translate:new N_(e,t.u_fill_translate)}),fillOutlinePattern:(e,t)=>({u_image:new O_(e,t.u_image),u_texsize:new N_(e,t.u_texsize),u_pixel_coord_upper:new N_(e,t.u_pixel_coord_upper),u_pixel_coord_lower:new N_(e,t.u_pixel_coord_lower),u_scale:new j_(e,t.u_scale),u_fade:new U_(e,t.u_fade),u_sdf_pattern:new O_(e,t.u_sdf_pattern),u_fill_translate:new N_(e,t.u_fill_translate)}),circle:(e,t)=>({u_scale_with_map:new O_(e,t.u_scale_with_map),u_pitch_with_map:new O_(e,t.u_pitch_with_map),u_extrude_scale:new N_(e,t.u_extrude_scale),u_globe_extrude_scale:new U_(e,t.u_globe_extrude_scale),u_translate:new N_(e,t.u_translate)}),collisionBox:lF,collisionCircle:lF,debug:(e,t)=>({u_color:new q_(e,t.u_color),u_overlay:new O_(e,t.u_overlay),u_overlay_scale:new U_(e,t.u_overlay_scale)}),depth:lF,clippingMask:lF,heatmap:(e,t)=>({u_extrude_scale:new U_(e,t.u_extrude_scale),u_intensity:new U_(e,t.u_intensity),u_globe_extrude_scale:new U_(e,t.u_globe_extrude_scale)}),heatmapTexture:(e,t)=>({u_matrix:new Z_(e,t.u_matrix),u_image:new O_(e,t.u_image),u_color_ramp:new O_(e,t.u_color_ramp),u_opacity:new U_(e,t.u_opacity)}),hillshade:(e,t)=>({u_image:new O_(e,t.u_image),u_latrange:new N_(e,t.u_latrange),u_exaggeration:new U_(e,t.u_exaggeration),u_altitudes:new H_(e,t.u_altitudes),u_azimuths:new H_(e,t.u_azimuths),u_accent:new q_(e,t.u_accent),u_method:new O_(e,t.u_method),u_shadows:new G_(e,t.u_shadows),u_highlights:new G_(e,t.u_highlights)}),hillshadePrepare:(e,t)=>({u_matrix:new Z_(e,t.u_matrix),u_image:new O_(e,t.u_image),u_dimension:new N_(e,t.u_dimension),u_zoom:new U_(e,t.u_zoom),u_unpack:new V_(e,t.u_unpack)}),colorRelief:(e,t)=>({u_image:new O_(e,t.u_image),u_unpack:new V_(e,t.u_unpack),u_dimension:new N_(e,t.u_dimension),u_elevation_stops:new O_(e,t.u_elevation_stops),u_color_stops:new O_(e,t.u_color_stops),u_color_ramp_size:new O_(e,t.u_color_ramp_size),u_opacity:new U_(e,t.u_opacity)}),line:(e,t)=>({u_translation:new N_(e,t.u_translation),u_ratio:new U_(e,t.u_ratio)}),lineGradient:(e,t)=>({u_translation:new N_(e,t.u_translation),u_ratio:new U_(e,t.u_ratio),u_image:new O_(e,t.u_image),u_image_height:new U_(e,t.u_image_height)}),linePattern:(e,t)=>({u_translation:new N_(e,t.u_translation),u_texsize:new N_(e,t.u_texsize),u_ratio:new U_(e,t.u_ratio),u_image:new O_(e,t.u_image),u_scale:new j_(e,t.u_scale),u_fade:new U_(e,t.u_fade)}),lineSDF:(e,t)=>({u_translation:new N_(e,t.u_translation),u_ratio:new U_(e,t.u_ratio),u_image:new O_(e,t.u_image),u_mix:new U_(e,t.u_mix),u_tileratio:new U_(e,t.u_tileratio),u_crossfade_from:new U_(e,t.u_crossfade_from),u_crossfade_to:new U_(e,t.u_crossfade_to),u_lineatlas_width:new U_(e,t.u_lineatlas_width),u_lineatlas_height:new U_(e,t.u_lineatlas_height)}),lineGradientSDF:(e,t)=>({u_translation:new N_(e,t.u_translation),u_ratio:new U_(e,t.u_ratio),u_image:new O_(e,t.u_image),u_image_height:new U_(e,t.u_image_height),u_tileratio:new U_(e,t.u_tileratio),u_crossfade_from:new U_(e,t.u_crossfade_from),u_crossfade_to:new U_(e,t.u_crossfade_to),u_image_dash:new O_(e,t.u_image_dash),u_mix:new U_(e,t.u_mix),u_lineatlas_width:new U_(e,t.u_lineatlas_width),u_lineatlas_height:new U_(e,t.u_lineatlas_height)}),layerOpacity:(e,t)=>({u_image:new O_(e,t.u_image),u_opacity:new U_(e,t.u_opacity)}),raster:(e,t)=>({u_tl_parent:new N_(e,t.u_tl_parent),u_scale_parent:new U_(e,t.u_scale_parent),u_buffer_scale:new U_(e,t.u_buffer_scale),u_image_warp:new j_(e,t.u_image_warp),u_fade_t:new U_(e,t.u_fade_t),u_opacity:new U_(e,t.u_opacity),u_image0:new O_(e,t.u_image0),u_image1:new O_(e,t.u_image1),u_brightness_low:new U_(e,t.u_brightness_low),u_brightness_high:new U_(e,t.u_brightness_high),u_saturation_factor:new U_(e,t.u_saturation_factor),u_contrast_factor:new U_(e,t.u_contrast_factor),u_spin_weights:new j_(e,t.u_spin_weights),u_coords_top:new V_(e,t.u_coords_top),u_coords_bottom:new V_(e,t.u_coords_bottom)}),symbolIcon:(e,t)=>({u_is_size_zoom_constant:new O_(e,t.u_is_size_zoom_constant),u_is_size_feature_constant:new O_(e,t.u_is_size_feature_constant),u_size_t:new U_(e,t.u_size_t),u_size:new U_(e,t.u_size),u_rotate_symbol:new O_(e,t.u_rotate_symbol),u_label_plane_matrix:new Z_(e,t.u_label_plane_matrix),u_coord_matrix:new Z_(e,t.u_coord_matrix),u_is_text:new O_(e,t.u_is_text),u_pitch_with_map:new O_(e,t.u_pitch_with_map),u_is_along_line:new O_(e,t.u_is_along_line),u_is_variable_anchor:new O_(e,t.u_is_variable_anchor),u_texsize:new N_(e,t.u_texsize),u_texture:new O_(e,t.u_texture),u_translation:new N_(e,t.u_translation),u_pitched_scale:new U_(e,t.u_pitched_scale),u_is_offset:new O_(e,t.u_is_offset),u_height_anchor_ground:new O_(e,t.u_height_anchor_ground)}),symbolSDF:(e,t)=>({u_is_size_zoom_constant:new O_(e,t.u_is_size_zoom_constant),u_is_size_feature_constant:new O_(e,t.u_is_size_feature_constant),u_size_t:new U_(e,t.u_size_t),u_size:new U_(e,t.u_size),u_rotate_symbol:new O_(e,t.u_rotate_symbol),u_label_plane_matrix:new Z_(e,t.u_label_plane_matrix),u_coord_matrix:new Z_(e,t.u_coord_matrix),u_is_text:new O_(e,t.u_is_text),u_pitch_with_map:new O_(e,t.u_pitch_with_map),u_is_along_line:new O_(e,t.u_is_along_line),u_is_variable_anchor:new O_(e,t.u_is_variable_anchor),u_texsize:new N_(e,t.u_texsize),u_texture:new O_(e,t.u_texture),u_gamma_scale:new U_(e,t.u_gamma_scale),u_is_halo:new O_(e,t.u_is_halo),u_is_plain:new O_(e,t.u_is_plain),u_translation:new N_(e,t.u_translation),u_pitched_scale:new U_(e,t.u_pitched_scale),u_is_offset:new O_(e,t.u_is_offset),u_height_anchor_ground:new O_(e,t.u_height_anchor_ground)}),symbolTextAndIcon:(e,t)=>({u_is_size_zoom_constant:new O_(e,t.u_is_size_zoom_constant),u_is_size_feature_constant:new O_(e,t.u_is_size_feature_constant),u_size_t:new U_(e,t.u_size_t),u_size:new U_(e,t.u_size),u_rotate_symbol:new O_(e,t.u_rotate_symbol),u_label_plane_matrix:new Z_(e,t.u_label_plane_matrix),u_coord_matrix:new Z_(e,t.u_coord_matrix),u_is_text:new O_(e,t.u_is_text),u_pitch_with_map:new O_(e,t.u_pitch_with_map),u_is_along_line:new O_(e,t.u_is_along_line),u_is_variable_anchor:new O_(e,t.u_is_variable_anchor),u_texsize:new N_(e,t.u_texsize),u_texsize_icon:new N_(e,t.u_texsize_icon),u_texture:new O_(e,t.u_texture),u_texture_icon:new O_(e,t.u_texture_icon),u_gamma_scale:new U_(e,t.u_gamma_scale),u_is_halo:new O_(e,t.u_is_halo),u_translation:new N_(e,t.u_translation),u_pitched_scale:new U_(e,t.u_pitched_scale),u_is_offset:new O_(e,t.u_is_offset),u_height_anchor_ground:new O_(e,t.u_height_anchor_ground)}),background:(e,t)=>({u_opacity:new U_(e,t.u_opacity),u_color:new q_(e,t.u_color)}),backgroundPattern:(e,t)=>({u_opacity:new U_(e,t.u_opacity),u_image:new O_(e,t.u_image),u_pattern_tl_a:new N_(e,t.u_pattern_tl_a),u_pattern_br_a:new N_(e,t.u_pattern_br_a),u_pattern_tl_b:new N_(e,t.u_pattern_tl_b),u_pattern_br_b:new N_(e,t.u_pattern_br_b),u_texsize:new N_(e,t.u_texsize),u_mix:new U_(e,t.u_mix),u_pattern_size_a:new N_(e,t.u_pattern_size_a),u_pattern_size_b:new N_(e,t.u_pattern_size_b),u_scale_a:new U_(e,t.u_scale_a),u_scale_b:new U_(e,t.u_scale_b),u_pixel_coord_upper:new N_(e,t.u_pixel_coord_upper),u_pixel_coord_lower:new N_(e,t.u_pixel_coord_lower),u_tile_units_to_pixels:new U_(e,t.u_tile_units_to_pixels)}),terrain:(e,t)=>({u_texture:new O_(e,t.u_texture),u_ele_delta:new U_(e,t.u_ele_delta),u_fog_matrix:new Z_(e,t.u_fog_matrix),u_fog_color:new q_(e,t.u_fog_color),u_fog_ground_blend:new U_(e,t.u_fog_ground_blend),u_fog_ground_blend_opacity:new U_(e,t.u_fog_ground_blend_opacity),u_horizon_color:new q_(e,t.u_horizon_color),u_horizon_fog_blend:new U_(e,t.u_horizon_fog_blend),u_is_globe_mode:new U_(e,t.u_is_globe_mode)}),terrainDepth:(e,t)=>({u_ele_delta:new U_(e,t.u_ele_delta)}),atmosphere:(e,t)=>({u_sun_pos:new j_(e,t.u_sun_pos),u_atmosphere_blend:new U_(e,t.u_atmosphere_blend),u_globe_position:new j_(e,t.u_globe_position),u_globe_radius:new U_(e,t.u_globe_radius),u_inv_proj_matrix:new Z_(e,t.u_inv_proj_matrix)}),sky:(e,t)=>({u_sky_color:new q_(e,t.u_sky_color),u_horizon_color:new q_(e,t.u_horizon_color),u_horizon:new N_(e,t.u_horizon),u_horizon_normal:new N_(e,t.u_horizon_normal),u_sky_horizon_blend:new U_(e,t.u_sky_horizon_blend),u_sky_blend:new U_(e,t.u_sky_blend),u_inv_proj_matrix:new Z_(e,t.u_inv_proj_matrix),u_globe_position:new j_(e,t.u_globe_position),u_globe_radius:new U_(e,t.u_globe_radius)})};var uF=class{constructor(e,t,i){this.context=e;let n=e.gl;this.buffer=n.createBuffer(),this.dynamicDraw=!!i,this.context.unbindVAO(),e.bindElementBuffer.set(this.buffer),n.bufferData(n.ELEMENT_ARRAY_BUFFER,t.arrayBuffer,this.dynamicDraw?n.DYNAMIC_DRAW:n.STATIC_DRAW),this.dynamicDraw||t.freeBufferAfterUpload()}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(e){let t=this.context.gl;if(!this.dynamicDraw)throw Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),t.bufferSubData(t.ELEMENT_ARRAY_BUFFER,0,e.arrayBuffer)}destroy(){let e=this.context.gl;this.buffer&&(e.deleteBuffer(this.buffer),delete this.buffer)}};const hF={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};var dF=class{constructor(e,t,i,n){this.length=t.length,this.attributes=i,this.itemSize=t.bytesPerElement,this.dynamicDraw=n,this.context=e;let a=e.gl;this.buffer=a.createBuffer(),e.bindVertexBuffer.set(this.buffer),a.bufferData(a.ARRAY_BUFFER,t.arrayBuffer,this.dynamicDraw?a.DYNAMIC_DRAW:a.STATIC_DRAW),this.dynamicDraw||t.freeBufferAfterUpload()}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(e){if(e.length!==this.length)throw Error(`Length of new data is ${e.length}, which doesn't match current length of ${this.length}`);let t=this.context.gl;this.bind(),t.bufferSubData(t.ARRAY_BUFFER,0,e.arrayBuffer)}enableAttributes(e,t){for(let i of this.attributes){let n=t.attributes[i.name];void 0!==n&&e.enableVertexAttribArray(n.location)}}setVertexAttribPointers(e,t,i){for(let n of this.attributes){let a=t.attributes[n.name];if(void 0!==a){let t=n.offset+this.itemSize*(i||0);a.isInteger?e.vertexAttribIPointer(a.location,n.components,e[hF[n.type]],this.itemSize,t):e.vertexAttribPointer(a.location,n.components,e[hF[n.type]],!1,this.itemSize,t)}}}destroy(){let e=this.context.gl;this.buffer&&(e.deleteBuffer(this.buffer),delete this.buffer)}},pF=class{constructor(e){this.gl=e.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(e){}getDefault(){return this.default}setDefault(){this.set(this.default)}},mF=class extends pF{getDefault(){return ep.transparent}set(e){let t=this.current;(e.r!==t.r||e.g!==t.g||e.b!==t.b||e.a!==t.a||this.dirty)&&(this.gl.clearColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}},gF=class extends pF{getDefault(){return 1}set(e){(e!==this.current||this.dirty)&&(this.gl.clearDepth(e),this.current=e,this.dirty=!1)}},fF=class extends pF{getDefault(){return 0}set(e){(e!==this.current||this.dirty)&&(this.gl.clearStencil(e),this.current=e,this.dirty=!1)}},AF=class extends pF{getDefault(){return[!0,!0,!0,!0]}set(e){let t=this.current;(e[0]!==t[0]||e[1]!==t[1]||e[2]!==t[2]||e[3]!==t[3]||this.dirty)&&(this.gl.colorMask(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}},_F=class extends pF{getDefault(){return!0}set(e){(e!==this.current||this.dirty)&&(this.gl.depthMask(e),this.current=e,this.dirty=!1)}},vF=class extends pF{getDefault(){return 255}set(e){(e!==this.current||this.dirty)&&(this.gl.stencilMask(e),this.current=e,this.dirty=!1)}},yF=class extends pF{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(e){let t=this.current;(e.func!==t.func||e.ref!==t.ref||e.mask!==t.mask||this.dirty)&&(this.gl.stencilFunc(e.func,e.ref,e.mask),this.current=e,this.dirty=!1)}},xF=class extends pF{getDefault(){let e=this.gl;return[e.KEEP,e.KEEP,e.KEEP]}set(e){let t=this.current;(e[0]!==t[0]||e[1]!==t[1]||e[2]!==t[2]||this.dirty)&&(this.gl.stencilOp(e[0],e[1],e[2]),this.current=e,this.dirty=!1)}},bF=class extends pF{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;e?t.enable(t.STENCIL_TEST):t.disable(t.STENCIL_TEST),this.current=e,this.dirty=!1}},wF=class extends pF{getDefault(){return[0,1]}set(e){let t=this.current;(e[0]!==t[0]||e[1]!==t[1]||this.dirty)&&(this.gl.depthRange(e[0],e[1]),this.current=e,this.dirty=!1)}},EF=class extends pF{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;e?t.enable(t.DEPTH_TEST):t.disable(t.DEPTH_TEST),this.current=e,this.dirty=!1}},kF=class extends pF{getDefault(){return this.gl.LESS}set(e){(e!==this.current||this.dirty)&&(this.gl.depthFunc(e),this.current=e,this.dirty=!1)}},SF=class extends pF{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;e?t.enable(t.BLEND):t.disable(t.BLEND),this.current=e,this.dirty=!1}},MF=class extends pF{getDefault(){let e=this.gl;return[e.ONE,e.ZERO]}set(e){let t=this.current;(e[0]!==t[0]||e[1]!==t[1]||this.dirty)&&(this.gl.blendFunc(e[0],e[1]),this.current=e,this.dirty=!1)}},CF=class extends pF{getDefault(){return ep.transparent}set(e){let t=this.current;(e.r!==t.r||e.g!==t.g||e.b!==t.b||e.a!==t.a||this.dirty)&&(this.gl.blendColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}},TF=class extends pF{getDefault(){return this.gl.FUNC_ADD}set(e){(e!==this.current||this.dirty)&&(this.gl.blendEquation(e),this.current=e,this.dirty=!1)}},DF=class extends pF{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;e?t.enable(t.CULL_FACE):t.disable(t.CULL_FACE),this.current=e,this.dirty=!1}},PF=class extends pF{getDefault(){return this.gl.BACK}set(e){(e!==this.current||this.dirty)&&(this.gl.cullFace(e),this.current=e,this.dirty=!1)}},IF=class extends pF{getDefault(){return this.gl.CCW}set(e){(e!==this.current||this.dirty)&&(this.gl.frontFace(e),this.current=e,this.dirty=!1)}},FF=class extends pF{getDefault(){return null}set(e){(e!==this.current||this.dirty)&&(this.gl.useProgram(e),this.current=e,this.dirty=!1)}},zF=class extends pF{getDefault(){return this.gl.TEXTURE0}set(e){(e!==this.current||this.dirty)&&(this.gl.activeTexture(e),this.current=e,this.dirty=!1)}},RF=class extends pF{getDefault(){let e=this.gl;return[0,0,e.drawingBufferWidth,e.drawingBufferHeight]}set(e){let t=this.current;(e[0]!==t[0]||e[1]!==t[1]||e[2]!==t[2]||e[3]!==t[3]||this.dirty)&&(this.gl.viewport(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}},LF=class extends pF{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.bindFramebuffer(t.FRAMEBUFFER,e),this.current=e,this.dirty=!1}},BF=class extends pF{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.bindRenderbuffer(t.RENDERBUFFER,e),this.current=e,this.dirty=!1}},OF=class extends pF{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.bindTexture(t.TEXTURE_2D,e),this.current=e,this.dirty=!1}},UF=class extends pF{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.bindBuffer(t.ARRAY_BUFFER,e),this.current=e,this.dirty=!1}},NF=class extends pF{getDefault(){return null}set(e){let t=this.gl;t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,e),this.current=e,this.dirty=!1}},jF=class extends pF{getDefault(){return null}set(e){(e!==this.current||this.dirty)&&(this.gl.bindVertexArray(e),this.current=e,this.dirty=!1)}},VF=class extends pF{getDefault(){return 4}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.pixelStorei(t.UNPACK_ALIGNMENT,e),this.current=e,this.dirty=!1}},qF=class extends pF{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e),this.current=e,this.dirty=!1}},GF=class extends pF{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,e),this.current=e,this.dirty=!1}},HF=class extends pF{constructor(e,t){super(e),this.context=e,this.parent=t}getDefault(){return null}},WF=class extends HF{setDirty(){this.dirty=!0}set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let t=this.gl;t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,e,0),this.current=e,this.dirty=!1}},ZF=class extends HF{set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let t=this.gl;t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.RENDERBUFFER,e),this.current=e,this.dirty=!1}},KF=class extends HF{set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let t=this.gl;t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.RENDERBUFFER,e),this.current=e,this.dirty=!1}},XF=class{constructor(e,t,i,n,a){this.context=e,this.width=t,this.height=i;let r=e.gl,s=this.framebuffer=r.createFramebuffer();if(this.colorAttachment=new WF(e,s),n)this.depthAttachment=a?new KF(e,s):new ZF(e,s);else if(a)throw Error("Stencil cannot be set without depth")}destroy(){let e=this.context.gl,t=this.colorAttachment.get();if(t&&e.deleteTexture(t),this.depthAttachment){let t=this.depthAttachment.get();t&&e.deleteRenderbuffer(t)}e.deleteFramebuffer(this.framebuffer)}};const QF=MI([{name:"u_units_to_pixels",type:"vec2"},{name:"u_world_size",type:"vec2"},{name:"u_camera_to_center_distance",type:"float"},{name:"u_symbol_fade_change",type:"float"},{name:"u_aspect_ratio",type:"float"},{name:"u_device_pixel_ratio",type:"float"},{name:"u_viewport_size",type:"vec2"},{name:"u_pixel_extrude_scale",type:"vec2"},{name:"u_pitch",type:"float"}]),YF=QF.offsets;var JF=class{constructor(e,t,i){this.blendFunction=e,this.blendColor=t,this.mask=i}};JF.Replace=[1,0],JF.disabled=new JF(JF.Replace,ep.transparent,[!1,!1,!1,!1]),JF.unblended=new JF(JF.Replace,ep.transparent,[!0,!0,!0,!0]),JF.alphaBlended=new JF([1,771],ep.transparent,[!0,!0,!0,!0]);var $F=class{constructor(e){this.gl=e,this.clearColor=new mF(this),this.clearDepth=new gF(this),this.clearStencil=new fF(this),this.colorMask=new AF(this),this.depthMask=new _F(this),this.stencilMask=new vF(this),this.stencilFunc=new yF(this),this.stencilOp=new xF(this),this.stencilTest=new bF(this),this.depthRange=new wF(this),this.depthTest=new EF(this),this.depthFunc=new kF(this),this.blend=new SF(this),this.blendFunc=new MF(this),this.blendColor=new CF(this),this.blendEquation=new TF(this),this.cullFace=new DF(this),this.cullFaceSide=new PF(this),this.frontFace=new IF(this),this.program=new FF(this),this.activeTexture=new zF(this),this.viewport=new RF(this),this.bindFramebuffer=new LF(this),this.bindRenderbuffer=new BF(this),this.bindTexture=new OF(this),this.bindVertexBuffer=new UF(this),this.bindElementBuffer=new NF(this),this.bindVertexArray=new jF(this),this.pixelStoreUnpack=new VF(this),this.pixelStoreUnpackPremultiplyAlpha=new qF(this),this.pixelStoreUnpackFlipY=new GF(this),this.extTextureFilterAnisotropic=e.getExtension("EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=e.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=e.getParameter(e.MAX_TEXTURE_SIZE),e.getExtension("EXT_color_buffer_half_float"),e.getExtension("EXT_color_buffer_float"),this.projectionUniformBuffer=function(e){return new CI(e,kI.ProjectionUBO,TI)}(this),this.terrainUniformBuffer=function(e){return new CI(e,kI.TerrainUBO,PI)}(this),this.frameUniformBuffer=function(e){return new CI(e,kI.FrameUBO,QF)}(this)}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,this.projectionUniformBuffer.bindingDirty=!0,this.terrainUniformBuffer.bindingDirty=!0,this.frameUniformBuffer.bindingDirty=!0}setCustomLayerDefaults(){this.unbindVAO(),this.cullFace.setDefault(),this.activeTexture.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}createIndexBuffer(e,t){return new uF(this,e,t)}createVertexBuffer(e,t,i){return new dF(this,e,t,i)}createRenderbuffer(e,t,i){let n=this.gl,a=n.createRenderbuffer();return this.bindRenderbuffer.set(a),n.renderbufferStorage(n.RENDERBUFFER,e,t,i),this.bindRenderbuffer.set(null),a}createFramebuffer(e,t,i,n){return new XF(this,e,t,i,n)}clear({color:e,depth:t,stencil:i}){let n=this.gl,a=0;e&&(a|=n.COLOR_BUFFER_BIT,this.clearColor.set(e),this.colorMask.set([!0,!0,!0,!0])),void 0!==t&&(a|=n.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(t),this.depthMask.set(!0)),void 0!==i&&(a|=n.STENCIL_BUFFER_BIT,this.clearStencil.set(i),this.stencilMask.set(255)),n.clear(a)}setCullFace(e){!1===e.enable?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(e.mode),this.frontFace.set(e.frontFace))}setDepthMode(e){e.func!==this.gl.ALWAYS||e.mask?(this.depthTest.set(!0),this.depthFunc.set(e.func),this.depthMask.set(e.mask),this.depthRange.set(e.range)):this.depthTest.set(!1)}setStencilMode(e){e.test.func!==this.gl.ALWAYS||e.mask?(this.stencilTest.set(!0),this.stencilMask.set(e.mask),this.stencilOp.set([e.fail,e.depthFail,e.pass]),this.stencilFunc.set({func:e.test.func,ref:e.ref,mask:e.test.mask})):this.stencilTest.set(!1)}setColorMode(e){Ah(e.blendFunction,JF.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(e.blendFunction),this.blendColor.set(e.blendColor)),this.colorMask.set(e.mask)}createVertexArray(){return this.gl.createVertexArray()}deleteVertexArray(e){this.gl.deleteVertexArray(e)}unbindVAO(){this.bindVertexArray.set(null)}},ez=class{constructor(e,t,i){this.func=e,this.mask=t,this.range=i}};ez.ReadOnly=!1,ez.ReadWrite=!0,ez.disabled=new ez(519,ez.ReadOnly,[0,1]);const tz=7680;var iz=class{constructor(e,t,i,n,a,r){this.test=e,this.ref=t,this.mask=i,this.fail=n,this.depthFail=a,this.pass=r}};iz.disabled=new iz({func:519,mask:0},0,0,tz,tz,tz);const nz=2305;var az=class{constructor(e,t,i){this.enable=e,this.mode=t,this.frontFace=i}};let rz;function sz(e,t,i,n,a){let r=e.context,s=e.transform,o=r.gl,l=e.useProgram("collisionBox"),c=[],u=0,h=0;for(let d of n){let n=t.getTile(d).getBucket(i);if(!n)continue;let p=a?n.textCollisionBox:n.iconCollisionBox,m=n.collisionCircleArray;m.length>0&&(c.push({circleArray:m,circleOffset:h,coord:d}),u+=m.length/4,h=u),p&&l.draw(r,o.LINES,ez.disabled,iz.disabled,e.colorModeForRenderPass(),az.disabled,null,e.style.map.terrain?.getTerrainData(d),s.getProjectionData({overscaledTileID:d,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),i.id,p.layoutVertexBuffer,p.indexBuffer,p.segments,null,e.transform.zoom,null,null,p.collisionVertexBuffer)}if(!a||!c.length)return;let d=e.useProgram("collisionCircle"),p=new v_;p.resize(4*u),p._trim();let m=0;for(let e of c)for(let t=0;t<e.circleArray.length/4;t++){let i=4*t,n=e.circleArray[i+0],a=e.circleArray[i+1],r=e.circleArray[i+2],s=e.circleArray[i+3];p.emplace(m++,n,a,r,s,0),p.emplace(m++,n,a,r,s,1),p.emplace(m++,n,a,r,s,2),p.emplace(m++,n,a,r,s,3)}(!rz||rz.length<2*u)&&(rz=function(e){let t=2*e,i=new x_;i.resize(t),i._trim();for(let e=0;e<t;e++){let t=6*e;i.uint16[t+0]=4*e+0,i.uint16[t+1]=4*e+1,i.uint16[t+2]=4*e+2,i.uint16[t+3]=4*e+2,i.uint16[t+4]=4*e+3,i.uint16[t+5]=4*e+0}return i}(u));let g=r.createIndexBuffer(rz,!0),f=r.createVertexBuffer(p,gb.members,!0);for(let t of c)d.draw(r,o.TRIANGLES,ez.disabled,iz.disabled,e.colorModeForRenderPass(),az.disabled,null,e.style.map.terrain?.getTerrainData(t.coord),null,i.id,f,g,S_.simpleSegment(0,2*t.circleOffset,t.circleArray.length,t.circleArray.length/2),null,e.transform.zoom,null,null,null);f.destroy(),g.destroy()}az.disabled=new az(!1,1029,nz),az.backCCW=new az(!0,1029,nz),az.frontCCW=new az(!0,1028,nz);const oz=eu(new Float32Array(16));function lz(e,t,i,n,a,r){let{horizontalAlign:s,verticalAlign:o}=Cw(e),l=-(o-.5)*i;return new Hc((-(s-.5)*t/a+n[0])*r,(l/a+n[1])*r)}function cz(e,t,i,n,a,r){let s=t.tileAnchorPoint.add(new Hc(t.translation[0],t.translation[1]));if(t.pitchWithMap){let e=n.mult(r);i||(e=e.rotate(-a));let o=s.add(e);return bD(o.x,o.y,t.pitchedLabelPlaneMatrix,xD(t,o.x,o.y)).point}if(i){let i=PD(t.tileAnchorPoint.x+1,t.tileAnchorPoint.y,t).point.sub(e),a=Math.atan(i.y/i.x)+(i.x<0?Math.PI:0);return e.add(n.rotate(a))}return e.add(n)}function uz(e,t,i,n,a,r,s,o,l,c,u,h,d){let p=e.text.placedSymbolArray,m=e.text.dynamicLayoutVertexArray,g=e.icon.dynamicLayoutVertexArray,f={};m.clear();for(let g=0;g<p.length;g++){let A=p.get(g),_=e.allowVerticalPlacement&&!A.placedOrientation,v=A.hidden||!A.crossTileID||_?null:n[A.crossTileID];if(v){let n=new Hc(A.anchorX,A.anchorY),p={getElevation:h,heightOffset:A.heightOffset,heightAnchorGround:d,width:a.width,height:a.height,pitchedLabelPlaneMatrix:r,pitchWithMap:i,transform:a,tileAnchorPoint:n,translation:c,unwrappedTileID:u},g=i?FD(n.x,n.y,p):PD(n.x,n.y,p),_=wD(a.cameraToCenterDistance,g.signedDistanceFromCamera),y=Gw(e.textSizeData,o,A)*_/24;i&&(y*=e.tilePixelRatio/s);let{width:x,height:b,anchor:w,textOffset:E,textBoxScale:k}=v,S=lz(w,x,b,E,k,y),M=a.getPitchedTextCorrection(n.x+c[0],n.y+c[1],u),C=cz(g.point,p,t,S,-a.bearingInRadians,M),T=e.allowVerticalPlacement&&2===A.placedOrientation?Math.PI/2:0;for(let e=0;e<A.numGlyphs;e++)wE(m,C,T);l&&A.associatedIconIndex>=0&&(f[A.associatedIconIndex]={shiftedAnchor:C,angle:T})}else OD(A.numGlyphs,m)}if(l){g.clear();let t=e.icon.placedSymbolArray;for(let e=0;e<t.length;e++){let i=t.get(e);if(i.hidden)OD(i.numGlyphs,g);else{let t=f[e];if(t)for(let e=0;e<i.numGlyphs;e++)wE(g,t.shiftedAnchor,t.angle);else OD(i.numGlyphs,g)}}e.icon.dynamicLayoutVertexBuffer.updateData(g)}e.text.dynamicLayoutVertexBuffer.updateData(m)}function hz(e,t,i){return i.iconsInText&&t?"symbolTextAndIcon":e?"symbolSDF":"symbolIcon"}function dz(e,t,i,n,a,r,s,o,l,c,u,h,d){let p=e.context,m=p.gl,g=e.transform,f="map"===o,A="map"===l,_="viewport"!==o&&"point"!==i.layout.get("symbol-placement"),v=f&&!A&&!_,y=!i.layout.get("symbol-sort-key").isConstant(),x=!1,b=e.getDepthModeForSublayer(0,ez.ReadOnly),w=i._unevaluatedLayout.hasValue("text-variable-anchor")||i._unevaluatedLayout.hasValue("text-variable-anchor-offset"),E=[],k=g.getCircleRadiusCorrection();for(let o of n){let n=t.getTile(o),l=n.getBucket(i);if(!l)continue;let u=a?l.text:l.icon;if(!u?.segments.get().length||!u.hasVisibleVertices)continue;let h,p,b,S,M=u.programConfigurations.get(i.id),C=a||l.sdfIcons,T=a?l.textSizeData:l.iconSizeData,D=A||0!==g.pitch,P=e.useProgram(hz(C,a,l),M),I=Hw(T,g.zoom),F=e.style.map.terrain?.getTerrainData(o),z=[0,0],R=null;if(a){if(p=n.glyphAtlasTexture,b=m.LINEAR,h=n.glyphAtlasTexture.size,l.iconsInText){z=n.imageAtlasTexture.size,R=n.imageAtlasTexture;let t="composite"===T.kind||"camera"===T.kind;S=D||e.options.rotating||e.options.zooming||t?m.LINEAR:m.NEAREST}}else{let t=1!==i.layout.get("icon-size").constantOr(0)||l.iconsNeedLinear;p=n.imageAtlasTexture,b=C||e.options.rotating||e.options.zooming||t||D?m.LINEAR:m.NEAREST,h=n.imageAtlasTexture.size}let L=Nu(n,1,e.transform.zoom),B=_D(f,e.transform,L),O=vD(A,f,e.transform,L),U=Zu(g,n,r,s),N=g.getProjectionData({overscaledTileID:o,applyGlobeMatrix:!d,applyTerrainMatrix:!0}),j=w&&l.hasTextData(),V="none"!==i.layout.get("icon-text-fit")&&j&&l.hasIconData(),q=i._unevaluatedLayout.hasValue("icon-offset"),G="ground"===i.layout.get("symbol-height-anchor");if(_){let t=Jc();fD(t,B);let n=e.style.map.terrain?(t,i)=>e.style.map.terrain.getElevation(o,t,i):void 0;kD(l,e,a,B,t,A,c,"map"===i.layout.get("text-rotation-alignment"),o.toUnwrapped(),g.width,g.height,U,n)}let H,W=a&&w||V,Z=A?B:e.transform.clipSpaceToPixelsMatrix,K=_||W?oz:Z,X=C&&0!==i.paint.get(a?"text-halo-width":"icon-halo-width").constantOr(1);H=C?l.iconsInText?rF(T.kind,I,v,A,_,W,e,K,O,U,h,z,k,q,G):aF(T.kind,I,v,A,_,W,e,K,O,U,a,h,X,k,q,G):nF(T.kind,I,v,A,_,W,0,K,O,U,a,h,k,q,G);let Q={program:P,buffers:u,uniformValues:H,projectionData:N,atlasTexture:p,atlasTextureIcon:R,atlasInterpolation:b,atlasInterpolationIcon:S,isSDF:C,hasHalo:X};if(y&&l.canOverlap){x=!0;let e=u.segments.get();for(let t of e)E.push({segments:new S_([t]),sortKey:t.sortKey,state:Q,terrainData:F})}else E.push({segments:u.segments,sortKey:0,state:Q,terrainData:F})}x&&E.sort((e,t)=>e.sortKey-t.sortKey);let S=i.paint.get(a?"text-halo-width":"icon-halo-width").constantOr(null)??1/0,M=24*i.layout.get("text-letter-spacing").constantOr(0)<0||S>1;for(let t of E){let n=t.state;p.activeTexture.set(m.TEXTURE0),n.atlasTexture.bind(n.atlasInterpolation,m.CLAMP_TO_EDGE),n.atlasTextureIcon&&(p.activeTexture.set(m.TEXTURE1),n.atlasTextureIcon&&n.atlasTextureIcon.bind(n.atlasInterpolationIcon,m.CLAMP_TO_EDGE));let a=n.isSDF&&n.hasHalo;if(a){let a=n.uniformValues;a.u_is_halo=1,M&&(a.u_is_plain=0,pz(n.buffers,t.segments,i,e,n.program,b,u,h,a,n.projectionData,t.terrainData),a.u_is_halo=0,a.u_is_plain=1)}pz(n.buffers,t.segments,i,e,n.program,b,u,h,n.uniformValues,n.projectionData,t.terrainData),a&&!M&&(n.uniformValues.u_is_halo=0)}}function pz(e,t,i,n,a,r,s,o,l,c,u){let h=n.context,d=h.gl;a.draw(h,d.TRIANGLES,r,s,o,az.backCCW,l,u,c,i.id,e.layoutVertexBuffer,e.indexBuffer,t,i.paint,n.transform.zoom,e.programConfigurations.get(i.id),e.dynamicLayoutVertexBuffer,e.opacityVertexBuffer)}function mz(e,t,i,n,a){let r=e.context,s=r.gl,o=iz.disabled,l=new JF([s.ONE,s.ONE],ep.transparent,[!0,!0,!0,!0]),c=t.getBucket(i);if(!c)return;let u=n.key,h=i.heatmapFbos.get(u);h||(h=fz(r,t.tileSize,t.tileSize),i.heatmapFbos.set(u,h)),r.bindFramebuffer.set(h.framebuffer),r.viewport.set([0,0,t.tileSize,t.tileSize]),r.clear({color:ep.transparent});let d=c.programConfigurations.get(i.id),p=e.useProgram("heatmap",d,!a),m=e.transform.getProjectionData({overscaledTileID:t.tileID,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),g=e.style.map.terrain.getTerrainData(n);p.draw(r,s.TRIANGLES,ez.disabled,o,l,az.disabled,GI(t,e.transform.zoom,i.paint.get("heatmap-intensity"),1),g,m,i.id,c.layoutVertexBuffer,c.indexBuffer,c.segments,i.paint,e.transform.zoom,d)}function gz(e,t,i,n,a){let r=e.context,s=r.gl,o=e.transform;r.setColorMode(e.colorModeForRenderPass());let l=Az(r,t),c=i.key,u=t.heatmapFbos.get(c);if(!u)return;r.activeTexture.set(s.TEXTURE0),s.bindTexture(s.TEXTURE_2D,u.colorAttachment.get()),r.activeTexture.set(s.TEXTURE1),l.bind(s.LINEAR,s.CLAMP_TO_EDGE);let h=o.getProjectionData({overscaledTileID:i,applyTerrainMatrix:a,applyGlobeMatrix:!n});e.useProgram("heatmapTexture").draw(r,s.TRIANGLES,ez.disabled,iz.disabled,e.colorModeForRenderPass(),az.disabled,HI(e,t,0,1),null,h,t.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments,t.paint,o.zoom),u.destroy(),t.heatmapFbos.delete(c)}function fz(e,t,i){let n=e.gl,a=n.createTexture();n.bindTexture(n.TEXTURE_2D,a),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.LINEAR),n.texStorage2D(n.TEXTURE_2D,1,n.RGBA16F,t,i);let r=e.createFramebuffer(t,i,!1,!1);return r.colorAttachment.set(a),r}function Az(e,t){return t.colorRampTexture||=new iy(e,t.colorRamp,e.gl.RGBA),t.colorRampTexture}function _z(e,t,i,n){let a=e.context,r=a.bindFramebuffer.get(),s=a.viewport.get(),[,,o,l]=s;return function(e,t,i){let n=e.context.gl;if(!e.layerOpacityFbo){let a=e.context.createFramebuffer(t,i,!0,!0),r=n.createTexture();return n.bindTexture(n.TEXTURE_2D,r),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.LINEAR),n.texImage2D(n.TEXTURE_2D,0,n.RGBA,t,i,0,n.RGBA,n.UNSIGNED_BYTE,null),a.colorAttachment.set(r),a.depthAttachment.set(e.context.createRenderbuffer(n.DEPTH_STENCIL,t,i)),e.layerOpacityFbo=a,void e.context.bindFramebuffer.set(e.layerOpacityFbo.framebuffer)}if(e.layerOpacityFbo.width===t&&e.layerOpacityFbo.height===i)return void e.context.bindFramebuffer.set(e.layerOpacityFbo.framebuffer);let a=e.layerOpacityFbo;n.bindTexture(n.TEXTURE_2D,a.colorAttachment.get()),n.texImage2D(n.TEXTURE_2D,0,n.RGBA,t,i,0,n.RGBA,n.UNSIGNED_BYTE,null),e.context.bindRenderbuffer.set(a.depthAttachment.get()),n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_STENCIL,t,i),e.context.bindRenderbuffer.set(null),a.width=t,a.height=i,e.context.bindFramebuffer.set(a.framebuffer)}(e,o,l),a.viewport.set([0,0,o,l]),a.clear({color:ep.transparent,depth:1,stencil:0}),e.currentStencilSource=void 0,e.renderTileClippingMasks(t,i,n),{compositeTarget:r,compositeViewport:s}}function vz(e,t,i,n){let a=e.context,r=a.gl;a.bindFramebuffer.set(i.compositeTarget),a.viewport.set(i.compositeViewport),a.activeTexture.set(r.TEXTURE0),r.bindTexture(r.TEXTURE_2D,e.layerOpacityFbo.colorAttachment.get()),e.useProgram("layerOpacity").draw(a,r.TRIANGLES,ez.disabled,iz.disabled,e.colorModeForRenderPass(),az.disabled,((e,t)=>({u_image:t,u_opacity:e}))(t,0),null,null,n.id,e.viewportBuffer,e.quadTriangleIndexBuffer,e.viewportSegments,n.paint,e.transform.zoom),e.currentStencilSource=void 0}function yz(e,t,i,n,a,r,s,o){let l=256;if(a.stepInterpolant){let n=t.getSource().maxzoom,a=s.canonical.z===n?Math.ceil(1<<e.transform.maxZoom-s.canonical.z):1;l=sh(function(e){return e<=1?1:2**Math.ceil(Math.log(e)/Math.LN2)}(r.maxLineLength/Uu*1024*a),256,i.maxTextureSize)}return o.gradient=Zv({expression:a.gradientExpression(),evaluationKey:"lineProgress",resolution:l,image:o.gradient||void 0,clips:r.lineClipsArray}),o.texture?o.texture.update(o.gradient):o.texture=new iy(i,o.gradient,n.RGBA),o.version=a.gradientVersion,o.texture}function xz(e,t,i,n,a){e.activeTexture.set(t.TEXTURE0),i.imageAtlasTexture.bind(t.LINEAR,t.CLAMP_TO_EDGE),n.updatePaintBuffers(a)}function bz(e,t,i,n,a,r){(a||e.lineAtlas.dirty)&&(t.activeTexture.set(i.TEXTURE0),e.lineAtlas.bind(t)),n.updatePaintBuffers(r)}function wz(e,t,i,n,a,r,s){let o=r.gradients[a.id],l=o.texture;a.gradientVersion!==o.version&&(l=yz(e,t,i,n,a,r,s,o)),i.activeTexture.set(n.TEXTURE0),l.bind(a.stepInterpolant?n.NEAREST:n.LINEAR,n.CLAMP_TO_EDGE)}function Ez(e,t,i,n,a,r,s,o,l){let c=r.gradients[a.id],u=c.texture;a.gradientVersion!==c.version&&(u=yz(e,t,i,n,a,r,s,c)),i.activeTexture.set(n.TEXTURE0),u.bind(a.stepInterpolant?n.NEAREST:n.LINEAR,n.CLAMP_TO_EDGE),i.activeTexture.set(n.TEXTURE1),e.lineAtlas.bind(i),o.updatePaintBuffers(l)}function kz(e,t,i,n,a,r){let s,{isRenderingToTexture:o}=a,l=e.getDepthModeForSublayer(0,ez.ReadOnly),c=e.colorModeForRenderPass(),u=i.paint.get("line-dasharray"),h=u.constantOr(1),d=i.paint.get("line-pattern"),p=d.constantOr(1),m=i.paint.get("line-gradient"),g=i.getCrossfadeParameters();s=p?"linePattern":h&&m?"lineGradientSDF":h?"lineSDF":m?"lineGradient":"line";let f=e.context,A=f.gl,_=e.transform,v=!0;for(let a of n){let n=t.getTile(a);if(p&&!n.patternsLoaded())continue;let y=n.getBucket(i);if(!y)continue;let x=y.programConfigurations.get(i.id),b=e.context.program.get(),w=e.useProgram(s,x),E=v||w.program!==b,k=r?e.getTerrainDataForTile(a,o):null,S=d.constantOr(null),M=u?.constantOr(null);if(S&&n.imageAtlas){let e=n.imageAtlas,t=e.patternPositions[S.to.toString()],i=e.patternPositions[S.from.toString()];t&&i&&x.setConstantPatternPositions(t,i)}else if(M){let t="round"===i.layout.get("line-cap").constantOr(null),n=e.lineAtlas.getDash(M.to,t),a=e.lineAtlas.getDash(M.from,t);x.setConstantDashPositions(n,a)}let C,T=_.getProjectionData({overscaledTileID:a,applyGlobeMatrix:!o,applyTerrainMatrix:!0}),D=_.getPixelScale();p?(C=JI(e,n,i,D,g),xz(f,A,n,x,g)):h&&m?(C=eF(e,n,i,D,g,y.lineClipsArray.length),Ez(e,t,f,A,i,y,a,x,g)):h?(C=$I(e,n,i,D,g),bz(e,f,A,x,E,g)):m?(C=YI(e,n,i,D,y.lineClipsArray.length),wz(e,t,f,A,i,y,a)):C=QI(e,n,i,D);let P=e.stencilModeForClipping(a);w.draw(f,A.TRIANGLES,l,P,c,az.disabled,C,k,T,i.id,y.layoutVertexBuffer,y.indexBuffer,y.segments,i.paint,e.transform.zoom,x,y.layoutVertexBuffer2),v=!1}}function Sz(e,t,i,n,a){if(!i||!n?.imageAtlas)return;let r=n.imageAtlas.patternPositions,s=r[i.to.toString()],o=r[i.from.toString()];if(!s&&o&&(s=o),!o&&s&&(o=s),!s||!o){let e=a.getPaintProperty(t);s=r[e],o=r[e]}s&&o&&e.setConstantPatternPositions(s,o)}function Mz(e,t,i,n,a){let{isRenderingToTexture:r}=a,s=e.colorModeForRenderPass();Tz(e,t,i,n,e.getDepthModeForSublayer(1,ez.ReadOnly),s,!1,r),Cz(e,t,i,n,a)}function Cz(e,t,i,n,a){if(!i.paint.get("fill-antialias"))return;let{isRenderingToTexture:r}=a,s=e.colorModeForRenderPass();Tz(e,t,i,n,e.getDepthModeForSublayer(i.getPaintProperty("fill-outline-color")?2:0,ez.ReadOnly),s,!0,r)}function Tz(e,t,i,n,a,r,s,o){let l,c,u,h,d,p=e.context.gl,m="fill-pattern",g=i.paint.get(m),f=g?.constantOr(1),A=i.getCrossfadeParameters(),_=e.transform,v=i.paint.get("fill-translate"),y=i.paint.get("fill-translate-anchor");s?(c=f&&!i.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",l=p.LINES):(c=f?"fillPattern":"fill",l=p.TRIANGLES);let x=g.constantOr(null);for(let g of n){let n=t.getTile(g);if(f&&!n.patternsLoaded())continue;let b=n.getBucket(i);if(!b)continue;let w=b.sdfPatterns[i.id]??!1,E=b.programConfigurations.get(i.id),k=e.useProgram(c,E),S=e.getTerrainDataForTile(g,o);f&&(e.context.activeTexture.set(p.TEXTURE0),n.imageAtlasTexture.bind(p.LINEAR,p.CLAMP_TO_EDGE),E.updatePaintBuffers(A)),Sz(E,m,x,n,i);let M=_.getProjectionData({overscaledTileID:g,applyGlobeMatrix:!o,applyTerrainMatrix:!0}),C=Zu(_,n,v,y);s?(h=b.indexBuffer2,d=b.segments2,u="fillOutlinePattern"===c&&f?jI(e,A,n,C,w):NI(C)):(h=b.indexBuffer,d=b.segments,u=f?OI(e,A,n,C,w):UI(C));let T=e.stencilModeForClipping(g);k.draw(e.context,l,a,T,r,az.backCCW,u,S,M,i.id,b.layoutVertexBuffer,h,d,i.paint,e.transform.zoom,E)}}function Dz(e,t,i,n,a,r,s,o){let l=e.context,c=l.gl,u="fill-extrusion-pattern",h=i.paint.get(u),d=h.constantOr(1),p=i.getCrossfadeParameters(),m=i.paint.get("fill-extrusion-opacity"),g=h.constantOr(null),f=e.transform;for(let h of n){let n=t.getTile(h),A=n.getBucket(i);if(!A)continue;let _=e.style.map.terrain?.getTerrainData(h),v=A.programConfigurations.get(i.id),y=e.useProgram(d?"fillExtrusionPattern":"fillExtrusion",v);d&&(e.context.activeTexture.set(c.TEXTURE0),n.imageAtlasTexture.bind(c.LINEAR,c.CLAMP_TO_EDGE),v.updatePaintBuffers(p));let x=f.getProjectionData({overscaledTileID:h,applyGlobeMatrix:!o,applyTerrainMatrix:!0});Sz(v,u,g,n,i);let b=Zu(f,n,i.paint.get("fill-extrusion-translate"),i.paint.get("fill-extrusion-translate-anchor")),w=i.paint.get("fill-extrusion-vertical-gradient"),E=d?BI(e,w,m,b,h,p,n):LI(e,w,m,b);y.draw(l,l.gl.TRIANGLES,a,r,s,az.backCCW,E,_,x,i.id,A.layoutVertexBuffer,A.indexBuffer,A.segments,i.paint,e.transform.zoom,v,e.style.map.terrain&&A.centroidVertexBuffer)}}function Pz(e,t,i,n,a,r,s,o,l){let c=e.style.projection,u=e.context,h=e.transform,d=u.gl,p=[`#define NUM_ILLUMINATION_SOURCES ${i.paint.get("hillshade-highlight-color").values.length}`],m=e.useProgram("hillshade",null,!1,p),g=!e.options.moving;for(let p of n){let n=t.getTile(p),f=n.fbo;if(!f)continue;let A=c.getMeshFromTileID(u,p.canonical,o,!0,"raster"),_=e.getTerrainDataForTile(p,l);u.activeTexture.set(d.TEXTURE0),d.bindTexture(d.TEXTURE_2D,f.colorAttachment.get());let v=h.getProjectionData({overscaledTileID:p,aligned:g,applyGlobeMatrix:!l,applyTerrainMatrix:!0});m.draw(u,d.TRIANGLES,r,a[p.overscaledZ],s,az.backCCW,WI(e,n,i),_,v,i.id,A.vertexBuffer,A.indexBuffer,A.segments)}}let Iz=0;function Fz(e,t,i,n,a,r,s,o,l){let c=e.style.projection,u=e.context,h=e.transform,d=u.gl,p=e.useProgram("colorRelief"),m=!e.options.moving,g="nearest"===i.paint.get("resampling")?d.NEAREST:d.LINEAR,f=!0,A=0;for(let _ of n){let n=t.getTile(_),v=n.dem;if(!v?.data)continue;if(f){Iz||=d.getParameter(d.MAX_TEXTURE_SIZE);let e=Iz,{elevationTexture:t,colorTexture:n}=i.getColorRampTextures(u,e,v.getUnpackVector());u.activeTexture.set(d.TEXTURE1),t.bind(d.NEAREST,d.CLAMP_TO_EDGE),u.activeTexture.set(d.TEXTURE4),n.bind(d.LINEAR,d.CLAMP_TO_EDGE),f=!1,A=t.size[0]}let y=v.stride;u.activeTexture.set(d.TEXTURE0),(!n.demTexture||n.needsColorReliefPrepare)&&(u.pixelStoreUnpackPremultiplyAlpha.set(!1),n.demTexture||=e.getTileTexture(y)??new iy(u,{width:y,height:y,data:null},d.RGBA),n.demTexture.update(v.getPixels(),{premultiply:!1}),n.needsColorReliefPrepare=!1),n.demTexture.bind(g,d.CLAMP_TO_EDGE);let x=c.getMeshFromTileID(u,_.canonical,o,!0,"raster"),b=e.getTerrainDataForTile(_,l),w=h.getProjectionData({overscaledTileID:_,aligned:m,applyGlobeMatrix:!l,applyTerrainMatrix:!0});p.draw(u,d.TRIANGLES,r,a[_.overscaledZ],s,az.backCCW,XI(i,n.dem,A),b,w,i.id,x.vertexBuffer,x.indexBuffer,x.segments)}}const zz=[new Hc(0,0),new Hc(Uu,0),new Hc(Uu,Uu),new Hc(0,Uu)];function Rz(e,t,i,n,a,r,s,o,l,c=!1,u=!1,h=null){let d=n[n.length-1].overscaledZ,p=e.context,m=p.gl,g=e.useProgram("raster"),f=e.transform,A=e.style.projection,_=e.colorModeForRenderPass(),v=!e.options.moving,y=i.paint.get("raster-opacity"),x="nearest"===i.paint.get("resampling")||"nearest"===i.paint.get("raster-resampling")?m.NEAREST:m.LINEAR,b=i.paint.get("raster-fade-duration"),w=!!e.style.map.terrain;for(let E of n){let n=e.getDepthModeForSublayer(E.overscaledZ-d,1===y?ez.ReadWrite:ez.ReadOnly,m.LESS),k=t.getTile(E);p.activeTexture.set(m.TEXTURE0),k.texture.bind(x,m.CLAMP_TO_EDGE,m.LINEAR_MIPMAP_NEAREST),p.activeTexture.set(m.TEXTURE1);let{parentTile:S,parentScaleBy:M,parentTopLeft:C,fadeValues:T}=Lz(k,t,b,w);k.fadeOpacity=T.tileOpacity,S?(S.fadeOpacity=T.parentTileOpacity,S.texture.bind(x,m.CLAMP_TO_EDGE,m.LINEAR_MIPMAP_NEAREST)):k.texture.bind(x,m.CLAMP_TO_EDGE,m.LINEAR_MIPMAP_NEAREST),k.texture.useMipmap&&p.extTextureFilterAnisotropic&&e.transform.pitch>e.options.anisotropicFilterPitch&&m.texParameterf(m.TEXTURE_2D,p.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,p.extTextureFilterAnisotropicMax);let D=e.getTerrainDataForTile(E,u),P=f.getProjectionData({overscaledTileID:E,aligned:v,applyGlobeMatrix:!u,applyTerrainMatrix:!0}),I=TT(C,M,T.fadeMix,i,o,l),F=h??A.getMeshFromTileID(p,E.canonical,r,s,"raster"),z=a?a[E.overscaledZ]:iz.disabled;g.draw(p,m.TRIANGLES,n,z,_,c?az.frontCCW:az.backCCW,I,D,P,i.id,F.vertexBuffer,F.indexBuffer,F.segments)}}function Lz(e,t,i,n){let a={parentTile:null,parentScaleBy:1,parentTopLeft:[0,0],fadeValues:{tileOpacity:1,parentTileOpacity:1,fadeMix:{opacity:1,mix:0}}};if(0===i||n)return a;if(e.fadingParentID){let n=t.getLoadedTile(e.fadingParentID);if(!n)return a;let r=2**(n.tileID.overscaledZ-e.tileID.overscaledZ);return{parentTile:n,parentScaleBy:r,parentTopLeft:[e.tileID.canonical.x*r%1,e.tileID.canonical.y*r%1],fadeValues:Bz(e,n,i)}}return e.selfFading?{parentTile:null,parentScaleBy:1,parentTopLeft:[0,0],fadeValues:Oz(e,i)}:a}function Bz(e,t,i){let n=tC(),a=(n-e.timeAdded)/i,r=(n-t.timeAdded)/i,s=1===e.fadingDirection,o=sh(a,0,1),l=sh(1-r,0,1),c=s?o:l;return{tileOpacity:c,parentTileOpacity:s?l:o,fadeMix:{opacity:1,mix:1-c}}}function Oz(e,t){let i=sh((tC()-e.timeAdded)/t,0,1);return{tileOpacity:i,fadeMix:{opacity:i,mix:0}}}const Uz=new ep(1,0,0,1),Nz=new ep(0,1,0,1),jz=new ep(0,0,1,1),Vz=new ep(1,0,1,1),qz=new ep(0,1,1,1);function Gz(e,t,i,n){Wz(e,0,t+i/2,e.transform.width,i,n)}function Hz(e,t,i,n){Wz(e,t-i/2,0,i,e.transform.height,n)}function Wz(e,t,i,n,a,r){let s=e.context,o=s.gl;o.enable(o.SCISSOR_TEST),o.scissor(t*e.pixelRatio,i*e.pixelRatio,n*e.pixelRatio,a*e.pixelRatio),s.clear({color:r}),o.disable(o.SCISSOR_TEST)}function Zz(e,t,i){let n=e.context,a=n.gl,r=e.useProgram("debug"),s=ez.disabled,o=iz.disabled,l=e.colorModeForRenderPass(),c="$debug",u=e.style.map.terrain?.getTerrainData(i);n.activeTexture.set(a.TEXTURE0);let h=t.getTileByID(i.key).latestRawTileData?.byteLength||0,d=Math.floor(h/1024),p=t.getTile(i).tileSize,m=512/Math.min(p,512)*(i.overscaledZ/e.transform.zoom)*.5,g=i.canonical.toString();i.overscaledZ!==i.canonical.z&&(g+=` => ${i.overscaledZ}`),function(e,t){e.initDebugOverlayCanvas();let i=e.debugOverlayCanvas,n=e.context.gl,a=e.debugOverlayCanvas.getContext("2d");a.clearRect(0,0,i.width,i.height),a.shadowColor="white",a.shadowBlur=2,a.lineWidth=1.5,a.strokeStyle="white",a.textBaseline="top",a.font="bold 36px Open Sans, sans-serif",a.fillText(t,5,5),a.strokeText(t,5,5),e.debugOverlayTexture.update(i),e.debugOverlayTexture.bind(n.LINEAR,n.CLAMP_TO_EDGE)}(e,`${g} ${d}kB`);let f=e.transform.getProjectionData({overscaledTileID:i,applyGlobeMatrix:!0,applyTerrainMatrix:!0});r.draw(n,a.TRIANGLES,s,o,JF.alphaBlended,az.disabled,qI(ep.transparent,m),null,f,c,e.debugBuffer,e.quadTriangleIndexBuffer,e.debugSegments),r.draw(n,a.LINE_STRIP,s,o,l,az.disabled,qI(ep.red),u,f,c,e.debugBuffer,e.tileBorderIndexBuffer,e.debugSegments)}function Kz(e,t){if(!t.mesh){let i=new r_;i.emplaceBack(-1,-1),i.emplaceBack(1,-1),i.emplaceBack(1,1),i.emplaceBack(-1,1);let n=new b_;n.emplaceBack(0,1,2),n.emplaceBack(0,2,3),t.mesh=new FT(e.createVertexBuffer(i,zT.members),e.createIndexBuffer(n),S_.simpleSegment(0,0,i.length,n.length))}return t.mesh}const Xz={symbol:function(e,t,i,n,a,r){if("translucent"!==r.currentPass)return;let{isRenderingToTexture:s}=r,o=iz.disabled,l=e.colorModeForRenderPass();(i._unevaluatedLayout.hasValue("text-variable-anchor")||i._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(e,t,i,n,a,r,s,o,l){let c=t.transform,u=t.style.map.terrain,h="map"===a,d="map"===r;for(let a of e){let e=n.getTile(a),r=e.getBucket(i);if(!r?.text?.segments.get().length)continue;let p=Hw(r.textSizeData,c.zoom),m=Nu(e,1,t.transform.zoom),g=_D(h,t.transform,m),f="none"!==i.layout.get("icon-text-fit")&&r.hasIconData();if(p){let t=2**(c.zoom-e.tileID.overscaledZ),n=u?(e,t)=>u.getElevation(a,e,t):void 0;uz(r,h,d,l,c,g,t,p,f,Zu(c,e,s,o),a.toUnwrapped(),n,"ground"===i.layout.get("symbol-height-anchor"))}}}(n,e,i,t,i.layout.get("text-rotation-alignment"),i.layout.get("text-pitch-alignment"),i.paint.get("text-translate"),i.paint.get("text-translate-anchor"),a),0!==i.paint.get("icon-opacity").constantOr(1)&&dz(e,t,i,n,!1,i.paint.get("icon-translate"),i.paint.get("icon-translate-anchor"),i.layout.get("icon-rotation-alignment").constantOr("viewport"),i.layout.get("icon-pitch-alignment"),i.layout.get("icon-keep-upright"),o,l,s),0!==i.paint.get("text-opacity").constantOr(1)&&dz(e,t,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"),o,l,s),t.map.showCollisionBoxes&&(sz(e,t,i,n,!0),sz(e,t,i,n,!1))},circle:function(e,t,i,n,a){if("translucent"!==a.currentPass)return;let{isRenderingToTexture:r}=a,s=i.paint.get("circle-opacity"),o=i.paint.get("circle-stroke-width"),l=i.paint.get("circle-stroke-opacity"),c=!i.layout.get("circle-sort-key").isConstant();if(0===s.constantOr(1)&&(0===o.constantOr(1)||0===l.constantOr(1)))return;let u=e.context,h=u.gl,d=e.transform,p=e.getDepthModeForSublayer(0,ez.ReadOnly),m=iz.disabled,g=e.colorModeForRenderPass(),f=[],A=d.getCircleRadiusCorrection();for(let a of n){let n=t.getTile(a),s=n.getBucket(i);if(!s)continue;let o=Zu(d,n,i.paint.get("circle-translate"),i.paint.get("circle-translate-anchor")),l=s.programConfigurations.get(i.id),u=e.useProgram("circle",l),h=s.layoutVertexBuffer,p=s.indexBuffer,m=e.style.map.terrain?.getTerrainData(a),g={programConfiguration:l,program:u,layoutVertexBuffer:h,indexBuffer:p,uniformValues:VI(e,n,i,o,A),terrainData:m,projectionData:d.getProjectionData({overscaledTileID:a,applyGlobeMatrix:!r,applyTerrainMatrix:!0})};if(c){let e=s.segments.get();for(let t of e)f.push({segments:new S_([t]),sortKey:t.sortKey,state:g})}else f.push({segments:s.segments,sortKey:0,state:g})}c&&f.sort((e,t)=>e.sortKey-t.sortKey);for(let t of f){let{programConfiguration:n,program:a,layoutVertexBuffer:r,indexBuffer:s,uniformValues:o,terrainData:l,projectionData:c}=t.state,d=t.segments;a.draw(u,h.TRIANGLES,p,m,g,az.backCCW,o,l,c,i.id,r,s,d,i.paint,e.transform.zoom,n)}},heatmap:function(e,t,i,n,a){if(0===i.paint.get("heatmap-opacity"))return;let r=e.context,{isRenderingToTexture:s,isRenderingGlobe:o}=a;if(e.style.map.terrain){for(let r of n){let n=t.getTile(r);t.hasRenderableParent(r)||("offscreen"===a.currentPass?mz(e,n,i,r,o):"translucent"===a.currentPass&&gz(e,i,r,s,o))}r.viewport.set([0,0,e.width,e.height])}else"offscreen"===a.currentPass?function(e,t,i,n){let a=e.context,r=a.gl,s=e.transform,o=iz.disabled,l=new JF([r.ONE,r.ONE],ep.transparent,[!0,!0,!0,!0]);(function(e,t,i){let n=e.gl;e.activeTexture.set(n.TEXTURE1),e.viewport.set([0,0,t.width/4,t.height/4]);let a=i.heatmapFbos.get(Kv);a?(n.bindTexture(n.TEXTURE_2D,a.colorAttachment.get()),e.bindFramebuffer.set(a.framebuffer)):(a=fz(e,t.width/4,t.height/4),i.heatmapFbos.set(Kv,a))})(a,e,i),a.clear({color:ep.transparent});for(let c of n){if(t.hasRenderableParent(c))continue;let n=t.getTile(c),u=n.getBucket(i);if(!u)continue;let h=u.programConfigurations.get(i.id),d=e.useProgram("heatmap",h),p=s.getProjectionData({overscaledTileID:c,applyGlobeMatrix:!0,applyTerrainMatrix:!1}),m=s.getCircleRadiusCorrection();d.draw(a,r.TRIANGLES,ez.disabled,o,l,az.backCCW,GI(n,s.zoom,i.paint.get("heatmap-intensity"),m),null,p,i.id,u.layoutVertexBuffer,u.indexBuffer,u.segments,i.paint,s.zoom,h)}a.viewport.set([0,0,e.width,e.height])}(e,t,i,n):"translucent"===a.currentPass&&function(e,t){let i=e.context,n=i.gl;i.setColorMode(e.colorModeForRenderPass());let a=t.heatmapFbos.get(Kv);a&&(i.activeTexture.set(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,a.colorAttachment.get()),i.activeTexture.set(n.TEXTURE1),Az(i,t).bind(n.LINEAR,n.CLAMP_TO_EDGE),e.useProgram("heatmapTexture").draw(i,n.TRIANGLES,ez.disabled,iz.disabled,e.colorModeForRenderPass(),az.disabled,HI(e,t,0,1),null,null,t.id,e.viewportBuffer,e.quadTriangleIndexBuffer,e.viewportSegments,t.paint,e.transform.zoom))}(e,i)},line:function(e,t,i,n,a){if("translucent"!==a.currentPass)return;let r=i.paint.get("line-opacity"),s=i.paint.get("line-width"),o=i.paint.get("line-layer-opacity");if(0===r.constantOr(1)||0===s.constantOr(1)||0===o)return;let l=!!e.style.map.terrain;if(o<1){let r=_z(e,i,n,l);return kz(e,t,i,n,a,l),void vz(e,o,r,i)}kz(e,t,i,n,a,l)},fill:function(e,t,i,n,a){let r=i.paint.get("fill-color"),s=i.paint.get("fill-opacity"),o=i.paint.get("fill-layer-opacity");if(0===s.constantOr(1)||0===o)return;if(o<1){if("translucent"!==a.currentPass)return;let r=_z(e,i,n,!!e.style.map.terrain);return Mz(e,t,i,n,a),void vz(e,o,r,i)}let l=i.paint.get("fill-pattern"),c=e.opaquePassEnabledForLayer()&&!l.constantOr(1)&&1===r.constantOr(ep.transparent).a&&1===s.constantOr(0);if(c&&"opaque"===a.currentPass){let{isRenderingToTexture:r}=a,s=e.colorModeForRenderPass();return void Tz(e,t,i,n,e.getDepthModeForSublayer(1,ez.ReadWrite),s,!1,r)}c&&"translucent"===a.currentPass?Cz(e,t,i,n,a):"translucent"===a.currentPass&&Mz(e,t,i,n,a)},fillExtrusion:function(e,t,i,n,a){let r=i.paint.get("fill-extrusion-opacity");if(0===r)return;let{isRenderingToTexture:s}=a;if("translucent"===a.currentPass){let o=new ez(e.context.gl.LEQUAL,ez.ReadWrite,a.depthRangeFor3D);if(1!==r||i.paint.get("fill-extrusion-pattern").constantOr(1))Dz(e,t,i,n,o,iz.disabled,JF.disabled,s),Dz(e,t,i,n,o,e.stencilModeFor3D(),e.colorModeForRenderPass(),s);else{let a=e.colorModeForRenderPass();Dz(e,t,i,n,o,iz.disabled,a,s)}}},hillshade:function(e,t,i,n,a){if("offscreen"!==a.currentPass&&"translucent"!==a.currentPass)return;let{isRenderingToTexture:r}=a,s=e.context,o=e.style.projection.useSubdivision,l=e.getDepthModeForSublayer(0,ez.ReadOnly),c=e.colorModeForRenderPass();if("offscreen"===a.currentPass)(function(e,t,i,n,a,r,s){let o=e.context,l=o.gl,c="nearest"===n.paint.get("resampling")?l.NEAREST:l.LINEAR;for(let u of i){let i=t.getTile(u),h=i.dem;if(!h?.data||!i.needsHillshadePrepare)continue;let d=h.dim+2,p=h.stride,m=h.getPixels();if(o.activeTexture.set(l.TEXTURE1),o.pixelStoreUnpackPremultiplyAlpha.set(!1),i.demTexture||=e.getTileTexture(p),i.demTexture){let e=i.demTexture;e.update(m,{premultiply:!1}),e.bind(l.NEAREST,l.CLAMP_TO_EDGE)}else i.demTexture=new iy(o,m,l.RGBA,{premultiply:!1}),i.demTexture.bind(l.NEAREST,l.CLAMP_TO_EDGE);o.activeTexture.set(l.TEXTURE0);let g=i.fbo;if(!g){let e=new iy(o,{width:d,height:d,data:null},l.RGBA);e.bind(c,l.CLAMP_TO_EDGE),g=i.fbo=o.createFramebuffer(d,d,!0,!1),g.colorAttachment.set(e.texture)}o.bindFramebuffer.set(g.framebuffer),o.viewport.set([0,0,d,d]),e.useProgram("hillshadePrepare").draw(o,l.TRIANGLES,a,r,s,az.disabled,ZI(i.tileID,h),null,null,n.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments),i.needsHillshadePrepare=!1}})(e,t,n,i,l,iz.disabled,c),s.viewport.set([0,0,e.width,e.height]);else if("translucent"===a.currentPass)if(o){let[a,s,o]=e.stencilConfigForOverlapTwoPass(n);Pz(e,t,i,o,a,l,c,!1,r),Pz(e,t,i,o,s,l,c,!0,r)}else{let[a,s]=e.getStencilConfigForOverlapAndUpdateStencilID(n);Pz(e,t,i,s,a,l,c,!1,r)}},colorRelief:function(e,t,i,n,a){if("translucent"!==a.currentPass||!n.length)return;let{isRenderingToTexture:r}=a,s=e.style.projection.useSubdivision,o=e.getDepthModeForSublayer(0,ez.ReadOnly),l=e.colorModeForRenderPass();if(s){let[a,s,c]=e.stencilConfigForOverlapTwoPass(n);Fz(e,t,i,c,a,o,l,!1,r),Fz(e,t,i,c,s,o,l,!0,r)}else{let[a,s]=e.getStencilConfigForOverlapAndUpdateStencilID(n);Fz(e,t,i,s,a,o,l,!1,r)}},raster:function(e,t,i,n,a){if("translucent"!==a.currentPass||0===i.paint.get("raster-opacity")||!n.length)return;let{isRenderingToTexture:r}=a,s=t.getSource(),o=e.style.projection.useSubdivision;if(s instanceof LT)Rz(e,t,i,n,null,!1,!1,s.tileCoords,s.imageWarp,s.flippedWindingOrder,r,s.getMesh(e.context,o));else if(o){let[a,s,o]=e.stencilConfigForOverlapTwoPass(n);Rz(e,t,i,o,a,!1,!0,zz,CT,!1,r),Rz(e,t,i,o,s,!0,!0,zz,CT,!1,r)}else{let[a,s]=e.getStencilConfigForOverlapAndUpdateStencilID(n);Rz(e,t,i,s,a,!1,!0,zz,CT,!1,r)}},background:function(e,t,i,n,a){let r=i.paint.get("background-color"),s=i.paint.get("background-opacity");if(0===s)return;let{isRenderingToTexture:o}=a,l=e.context,c=l.gl,u=e.style.projection,h=e.transform,d=h.tileSize,p=i.paint.get("background-pattern");if(e.isPatternMissing(p))return;let m=!p&&1===r.a&&1===s&&e.opaquePassEnabledForLayer()?"opaque":"translucent";if(a.currentPass!==m)return;let g=iz.disabled,f=e.getDepthModeForSublayer(0,"opaque"===m?ez.ReadWrite:ez.ReadOnly),A=e.colorModeForRenderPass(),_=e.useProgram(p?"backgroundPattern":"background"),v=n||iD(h,{tileSize:d,terrain:e.style.map.terrain});p&&(l.activeTexture.set(c.TEXTURE0),e.patternAtlas.bind(e.context));let y=i.getCrossfadeParameters();for(let t of v){let n=h.getProjectionData({overscaledTileID:t,applyGlobeMatrix:!o,applyTerrainMatrix:!0}),a=p?oF(s,e,p,{tileID:t,tileSize:d},y):sF(s,r),m=e.getTerrainDataForTile(t,o),v=u.getMeshFromTileID(l,t.canonical,!1,!0,"raster");_.draw(l,c.TRIANGLES,f,g,A,az.backCCW,a,m,n,i.id,v.vertexBuffer,v.indexBuffer,v.segments)}},sky:function(e,t){let i=e.context,n=i.gl,a=((e,t,i)=>{let n=Math.cos(t.rollInRadians),a=Math.sin(t.rollInRadians),r=Ox(t),s=t.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}).projectionTransition;return{u_sky_color:e.properties.get("sky-color"),u_horizon_color:e.properties.get("horizon-color"),u_horizon:[(t.width/2-r*a)*i,(t.height/2+r*n)*i],u_horizon_normal:[-a,n],u_sky_horizon_blend:e.properties.get("sky-horizon-blend")*t.height/2*i,u_sky_blend:s,u_inv_proj_matrix:t.inverseProjectionMatrix,u_globe_position:QP(t),u_globe_radius:XP(t.worldSize,t.center.lat)}})(t,e.transform,e.pixelRatio),r=new ez(n.LEQUAL,ez.ReadWrite,[0,1]),s=iz.disabled,o=e.colorModeForRenderPass(),l=e.useProgram("sky"),c=Kz(i,t);l.draw(i,n.TRIANGLES,r,s,o,az.disabled,a,null,void 0,"sky",c.vertexBuffer,c.indexBuffer,c.segments)},atmosphere:function(e,t,i){let n=e.context,a=n.gl,r=e.useProgram("atmosphere"),s=new ez(a.LEQUAL,ez.ReadOnly,[0,1]),o=e.transform,l=function(e,t){let i=e.getCartesianPosition();!function(e,t){e[0]=-t[0],e[1]=-t[1],e[2]=-t[2]}(i,i);let n=eu(new Float64Array(16));return"map"===e.properties.get("anchor")&&(ou(n,n,t.rollInRadians),ru(n,n,-t.pitchInRadians),ou(n,n,t.bearingInRadians),ru(n,n,t.center.lat*Math.PI/180),su(n,n,-t.center.lng*Math.PI/180)),function(e,t,i){var n=t[0],a=t[1],r=t[2],s=i[3]*n+i[7]*a+i[11]*r+i[15];s||=1,e[0]=(i[0]*n+i[4]*a+i[8]*r+i[12])/s,e[1]=(i[1]*n+i[5]*a+i[9]*r+i[13])/s,e[2]=(i[2]*n+i[6]*a+i[10]*r+i[14])/s}(i,i,n),i}(i,e.transform),c=o.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),u=t.properties.get("atmosphere-blend")*c.projectionTransition;if(0===u)return;let h=XP(o.worldSize,o.center.lat),d=((e,t,i,n,a)=>({u_sun_pos:e,u_atmosphere_blend:t,u_globe_position:i,u_globe_radius:n,u_inv_proj_matrix:a}))(l,u,QP(o),h,o.inverseProjectionMatrix),p=Kz(n,t);r.draw(n,a.TRIANGLES,s,iz.disabled,JF.alphaBlended,az.disabled,d,null,null,"atmosphere",p.vertexBuffer,p.indexBuffer,p.segments)},custom:function(e,t,i,n){let{isRenderingGlobe:a}=n,r=e.context,s=i.implementation,o=e.style.projection,l=e.transform,c=l.getProjectionDataForCustomLayer(a),u={farZ:l.farZ,nearZ:l.nearZ,fov:l.fov*Math.PI/180,modelViewProjectionMatrix:l.modelViewProjectionMatrix,projectionMatrix:l.projectionMatrix,shaderData:{variantName:o.shaderVariantName,vertexShaderPrelude:`const float PI = 3.141592653589793;\nuniform mat4 u_projection_matrix;\n${o.shaderPreludeCode.vertexSource}`,define:o.shaderDefine},defaultProjectionData:c,getProjectionData:e=>l.getProjectionData({overscaledTileID:new HE(e.tileID.canonical.z,e.tileID.wrap??0,e.tileID.canonical.z,e.tileID.canonical.x,e.tileID.canonical.y),aligned:e.aligned,applyGlobeMatrix:e.applyGlobeMatrix,applyTerrainMatrix:e.applyTerrainMatrix})},h=s.renderingMode?s.renderingMode:"2d";if("offscreen"===n.currentPass){let t=s.prerender;t&&(e.setCustomLayerDefaults(),r.setColorMode(e.colorModeForRenderPass()),t.call(s,r.gl,u),r.setDirty(),e.setBaseState())}else if("translucent"===n.currentPass){e.setCustomLayerDefaults(),r.setColorMode(e.colorModeForRenderPass()),r.setStencilMode(iz.disabled);let t="3d"===h?e.getDepthModeFor3D():e.getDepthModeForSublayer(0,ez.ReadOnly);r.setDepthMode(t),s.render(r.gl,u),r.setDirty(),e.setBaseState(),r.bindFramebuffer.set(null)}},debug:function(e,t,i){for(let n of i)Zz(e,t,n)},debugPadding:function(e){let t=e.transform.padding;Gz(e,e.transform.height-(t.top||0),3,Uz),Gz(e,t.bottom||0,3,Nz),Hz(e,t.left||0,3,jz),Hz(e,e.transform.width-(t.right||0),3,Vz);let i=e.transform.centerPoint;!function(e,t,i,n){Wz(e,t-1,i-10,2,20,n),Wz(e,t-10,i-1,20,2,n)}(e,i.x,e.transform.height-i.y,qz)},terrainDepth:function(e,t){let i=e.context,n=i.gl,a=e.transform,r=JF.unblended,s=new ez(n.LEQUAL,ez.ReadWrite,[0,1]),o=t.tileManager.getRenderableTiles(),l=e.useProgram("terrainDepth");i.bindFramebuffer.set(t.getFramebuffer().framebuffer),i.viewport.set([0,0,e.width/devicePixelRatio,e.height/devicePixelRatio]),i.clear({color:ep.white,depth:1});for(let e of o){let o=t.getTerrainMesh(e.tileID),c=t.getTerrainData(e.tileID),u=a.getProjectionData({overscaledTileID:e.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0}),h=EI(t.getSkirtLength(a.zoom));l.draw(i,n.TRIANGLES,s,iz.disabled,r,az.backCCW,h,c,u,"terrain",o.vertexBuffer,o.indexBuffer,o.segments)}i.bindFramebuffer.set(null),i.viewport.set([0,0,e.width,e.height])}};var Qz=class e{constructor(e,t){this.drawFunctions=Xz,this.context=new $F(e),this.transform=t,this.layerOpacityFbo=null,this._tileTextures={},this._rttObjectRecyclePool=[],this._rttSharedFbo=null,this.terrainFacilitator={depthDirty:!0,matrix:eu(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=hD.maxOverzooming+hD.maxUnderzooming+1,this.depthEpsilon=1/65536,this.crossTileSymbolIndex=new gP}resize(e,t,i){if(this.width=Math.floor(e*i),this.height=Math.floor(t*i),this.pixelRatio=i,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(let e of this.style._order)this.style._layers[e].resize()}setup(){let e=this.context,t=new r_;t.emplaceBack(0,0),t.emplaceBack(Uu,0),t.emplaceBack(0,Uu),t.emplaceBack(Uu,Uu),this.tileExtentBuffer=e.createVertexBuffer(t,zT.members),this.tileExtentSegments=S_.simpleSegment(0,0,4,2);let i=new r_;i.emplaceBack(0,0),i.emplaceBack(Uu,0),i.emplaceBack(0,Uu),i.emplaceBack(Uu,Uu),this.debugBuffer=e.createVertexBuffer(i,zT.members),this.debugSegments=S_.simpleSegment(0,0,4,5);let n=new o_;n.emplaceBack(0,0,0,0),n.emplaceBack(Uu,0,Uu,0),n.emplaceBack(0,Uu,0,Uu),n.emplaceBack(Uu,Uu,Uu,Uu),this.rasterBoundsBuffer=e.createVertexBuffer(n,xI.members),this.rasterBoundsSegments=S_.simpleSegment(0,0,4,2);let a=new r_;a.emplaceBack(0,0),a.emplaceBack(Uu,0),a.emplaceBack(0,Uu),a.emplaceBack(Uu,Uu),this.rasterBoundsBufferPosOnly=e.createVertexBuffer(a,zT.members),this.rasterBoundsSegmentsPosOnly=S_.simpleSegment(0,0,4,5);let r=new r_;r.emplaceBack(0,0),r.emplaceBack(1,0),r.emplaceBack(0,1),r.emplaceBack(1,1),this.viewportBuffer=e.createVertexBuffer(r,zT.members),this.viewportSegments=S_.simpleSegment(0,0,4,2);let s=new E_;s.emplaceBack(0),s.emplaceBack(1),s.emplaceBack(3),s.emplaceBack(2),s.emplaceBack(0),this.tileBorderIndexBuffer=e.createIndexBuffer(s);let o=new b_;o.emplaceBack(1,0,2),o.emplaceBack(1,2,3),this.quadTriangleIndexBuffer=e.createIndexBuffer(o);let l=this.context.gl;this.stencilClearMode=new iz({func:l.ALWAYS,mask:0},0,255,l.ZERO,l.ZERO,l.ZERO),this.tileExtentMesh=new FT(this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}clearStencil(){let e=this.context,t=e.gl;this.nextStencilID=1,this.currentStencilSource=void 0;let i=Jc();cu(i,0,this.width,this.height,0,0,1),au(i,i,[t.drawingBufferWidth,t.drawingBufferHeight,0]);let n={mainMatrix:i,tileMercatorCoords:[0,0,1,1],clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:i,clipAntimeridian:!1};this.useProgram("clippingMask",null,!0).draw(e,t.TRIANGLES,ez.disabled,this.stencilClearMode,JF.disabled,az.disabled,null,null,n,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}renderTileClippingMasks(e,t,i){if(this.currentStencilSource===e.source||!e.isTileClipped()||!t?.length)return;this.currentStencilSource=e.source,this.nextStencilID+t.length>256&&this.clearStencil();let n=this.context;n.setColorMode(JF.disabled),n.setDepthMode(ez.disabled);let a={};for(let e of t)a[e.key]=this.nextStencilID++;this.style.projection.useSubdivision&&this._renderTileMasks(a,t,i,!0),this._renderTileMasks(a,t,i,!1),this._tileClippingMaskIDs=a}_renderTileMasks(e,t,i,n){let a=this.context,r=a.gl,s=this.style.projection,o=this.transform,l=this.useProgram("clippingMask");for(let c of t){let t=e[c.key],u=this.getTerrainDataForTile(c,i),h=s.getMeshFromTileID(this.context,c.canonical,n,!0,"stencil"),d=o.getProjectionData({overscaledTileID:c,applyGlobeMatrix:!i,applyTerrainMatrix:!0});l.draw(a,r.TRIANGLES,ez.disabled,new iz({func:r.ALWAYS,mask:0},t,255,r.KEEP,r.KEEP,r.REPLACE),JF.disabled,i?az.disabled:az.backCCW,null,u,d,"$clipping",h.vertexBuffer,h.indexBuffer,h.segments)}}getTerrainDataForTile(e,t){return t&&"mercator"===this.style.projection?.name?null:this.style.map.terrain?.getTerrainData(e)||null}_renderTilesDepthBuffer(){let e=this.context,t=e.gl,i=this.style.projection,n=this.transform,a=this.useProgram("depth"),r=this.getDepthModeFor3D(),s=iD(n,{tileSize:n.tileSize});for(let o of s){let s=this.style.map.terrain?.getTerrainData(o),l=i.getMeshFromTileID(this.context,o.canonical,!0,!0,"raster"),c=n.getProjectionData({overscaledTileID:o,applyGlobeMatrix:!0,applyTerrainMatrix:!0});a.draw(e,t.TRIANGLES,r,iz.disabled,JF.disabled,az.backCCW,null,s,c,"$clipping",l.vertexBuffer,l.indexBuffer,l.segments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();let e=this.nextStencilID++,t=this.context.gl;return new iz({func:t.NOTEQUAL,mask:255},e,255,t.KEEP,t.KEEP,t.REPLACE)}stencilModeForClipping(e){let t=this.context.gl;return new iz({func:t.EQUAL,mask:255},this._tileClippingMaskIDs[e.key],0,t.KEEP,t.KEEP,t.REPLACE)}getStencilConfigForOverlapAndUpdateStencilID(e){let t=this.context.gl,i=e.sort((e,t)=>t.overscaledZ-e.overscaledZ),n=i[i.length-1].overscaledZ,a=i[0].overscaledZ-n+1;if(a>1){this.currentStencilSource=void 0,this.nextStencilID+a>256&&this.clearStencil();let e={};for(let i=0;i<a;i++)e[i+n]=new iz({func:t.GEQUAL,mask:255},i+this.nextStencilID,255,t.KEEP,t.KEEP,t.REPLACE);return this.nextStencilID+=a,[e,i]}return[{[n]:iz.disabled},i]}stencilConfigForOverlapTwoPass(e){let t=this.context.gl,i=e.sort((e,t)=>t.overscaledZ-e.overscaledZ),n=i[i.length-1].overscaledZ,a=i[0].overscaledZ-n+1;if(this.clearStencil(),a>1){let e={},r={};for(let i=0;i<a;i++)e[i+n]=new iz({func:t.GREATER,mask:255},a+1+i,255,t.KEEP,t.KEEP,t.REPLACE),r[i+n]=new iz({func:t.GREATER,mask:255},1+i,255,t.KEEP,t.KEEP,t.REPLACE);return this.nextStencilID=2*a+1,[e,r,i]}return this.nextStencilID=3,[{[n]:new iz({func:t.GREATER,mask:255},2,255,t.KEEP,t.KEEP,t.REPLACE)},{[n]:new iz({func:t.GREATER,mask:255},1,255,t.KEEP,t.KEEP,t.REPLACE)},i]}colorModeForRenderPass(){let e=this.context.gl;if(this._showOverdrawInspector){let t=1/8;return new JF([e.CONSTANT_COLOR,e.ONE],new ep(t,t,t,0),[!0,!0,!0,!0])}return"opaque"===this.renderOptions.currentPass?JF.unblended:JF.alphaBlended}getDepthModeForSublayer(e,t,i){if(!this.opaquePassEnabledForLayer())return ez.disabled;let n=1-((1+this.renderOptions.currentLayer)*this.numSublayers+e)*this.depthEpsilon;return new ez(i||this.context.gl.LEQUAL,t,[n,n])}getDepthModeFor3D(){return new ez(this.context.gl.LEQUAL,ez.ReadWrite,this.renderOptions.depthRangeFor3D)}opaquePassEnabledForLayer(){return this.renderOptions.currentLayer<this.renderOptions.opaquePassCutoff}render(e,t){this.style=e,this.options=t;let i=this.renderOptions=function(e,t,i){let n=t?.transitionState??0;return{currentPass:"offscreen",currentLayer:0,opaquePassCutoff:1/0,depthRangeFor3D:[0,1],isRenderingToTexture:!1,transform:e,terrain:i,projectionTransition:n,isRenderingGlobe:n>0}}(this.transform,e.projection,e.map.terrain??null);this.lineAtlas=e.lineAtlas,this.imageManager=e.imageManager,this.patternAtlas=e.patternAtlas,this.glyphManager=e.glyphManager,this.symbolFadeChange=e.placement.symbolFadeChange(tC()),function(e,t){let i=e.pending,{transform:n}=t,a=t.context.gl;i[YF.u_units_to_pixels]=1/n.pixelsToGLUnits[0],i[YF.u_units_to_pixels+1]=1/n.pixelsToGLUnits[1],i[YF.u_world_size]=a.drawingBufferWidth,i[YF.u_world_size+1]=a.drawingBufferHeight,i[YF.u_camera_to_center_distance]=n.cameraToCenterDistance,i[YF.u_symbol_fade_change]=t.options.fadeDuration?t.symbolFadeChange:1,i[YF.u_aspect_ratio]=n.width/n.height,i[YF.u_device_pixel_ratio]=t.pixelRatio,i[YF.u_viewport_size]=n.width,i[YF.u_viewport_size+1]=n.height,i[YF.u_pixel_extrude_scale]=1/n.width,i[YF.u_pixel_extrude_scale+1]=1/n.height,i[YF.u_pitch]=n.pitch/360*2*Math.PI,e.upload()}(this.context.frameUniformBuffer,this),this.imageManager.beginFrame();let n=this.style._order,a=this.style.tileManagers,r={},s={},o={};for(let e in a){let t=a[e];t.used&&t.prepare(this.context),r[e]=t.getVisibleCoordinates(!1),s[e]=r[e].slice().reverse(),o[e]=t.getVisibleCoordinates(!0).reverse()}i.opaquePassCutoff=1/0;for(let e=0;e<n.length;e++){let t=n[e];if(this.style._layers[t].is3D()){i.opaquePassCutoff=e;break}}this.maybeDrawDepth(),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),i.opaquePassCutoff=0),i.currentPass="offscreen";for(let e of n){let t=this.style._layers[e];if(!t.hasOffscreenPass()||t.isHidden(this.transform.zoom))continue;let n=s[t.source];("custom"===t.type||n.length)&&this.renderLayer(this,a[t.source],t,n,i)}if(this.context.viewport.set([0,0,this.width,this.height]),this.context.bindFramebuffer.set(null),this.context.clear({color:t.showOverdrawInspector?ep.black:ep.transparent,depth:1}),this.clearStencil(),this.style.sky&&this.drawFunctions.sky(this,this.style.sky),this._showOverdrawInspector=t.showOverdrawInspector,i.depthRangeFor3D=[0,1-(e._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(i.currentPass="opaque",i.currentLayer=n.length-1;i.currentLayer>=0;i.currentLayer--){let e=this.style._layers[n[i.currentLayer]];if(e.isHidden(this.transform.zoom))continue;let t=a[e.source],s=r[e.source];this.renderTileClippingMasks(e,s,!1),this.renderLayer(this,t,e,s,i)}i.currentPass="translucent";let l=!1;for(i.currentLayer=0;i.currentLayer<n.length;i.currentLayer++){let e=this.style._layers[n[i.currentLayer]];if(e.isHidden(this.transform.zoom))continue;let t=a[e.source];if(this.renderToTexture?.renderLayer(e,i))continue;!this.opaquePassEnabledForLayer()&&!l&&(l=!0,i.isRenderingGlobe&&!this.style.map.terrain&&this._renderTilesDepthBuffer());let c=("symbol"===e.type?o:s)[e.source];this.renderTileClippingMasks(e,r[e.source],!!this.renderToTexture),this.renderLayer(this,t,e,c,i)}if(i.isRenderingGlobe&&this.drawFunctions.atmosphere(this,this.style.sky,this.style.light),this.options.showTileBoundaries){let e=function(e,t){let i=null,n=Object.values(e._layers).flatMap(i=>i.source&&!i.isHidden(t)?[e.tileManagers[i.source]]:[]),a=n.filter(e=>"vector"===e.getSource().type),r=n.filter(e=>"vector"!==e.getSource().type),s=e=>{(!i||i.getSource().maxzoom<e.getSource().maxzoom)&&(i=e)};for(let e of a)s(e);if(!i)for(let e of r)s(e);return i}(this.style,this.transform.zoom);e&&this.drawFunctions.debug(this,e,e.getVisibleCoordinates())}this.options.showPadding&&this.drawFunctions.debugPadding(this),this.context.setDefault()}maybeDrawDepth(){if(!this.style?.projection||!this.style.map?.terrain)return;let e=this.terrainFacilitator.matrix,t=this.transform.modelViewProjectionMatrix,i=this.terrainFacilitator.depthDirty;i||=!function(e,t){var i=e[0],n=e[1],a=e[2],r=e[3],s=e[4],o=e[5],l=e[6],c=e[7],u=e[8],h=e[9],d=e[10],p=e[11],m=e[12],g=e[13],f=e[14],A=e[15],_=t[0],v=t[1],y=t[2],x=t[3],b=t[4],w=t[5],E=t[6],k=t[7],S=t[8],M=t[9],C=t[10],T=t[11],D=t[12],P=t[13],I=t[14],F=t[15];return Math.abs(i-_)<=1e-6*Math.max(1,Math.abs(i),Math.abs(_))&&Math.abs(n-v)<=1e-6*Math.max(1,Math.abs(n),Math.abs(v))&&Math.abs(a-y)<=1e-6*Math.max(1,Math.abs(a),Math.abs(y))&&Math.abs(r-x)<=1e-6*Math.max(1,Math.abs(r),Math.abs(x))&&Math.abs(s-b)<=1e-6*Math.max(1,Math.abs(s),Math.abs(b))&&Math.abs(o-w)<=1e-6*Math.max(1,Math.abs(o),Math.abs(w))&&Math.abs(l-E)<=1e-6*Math.max(1,Math.abs(l),Math.abs(E))&&Math.abs(c-k)<=1e-6*Math.max(1,Math.abs(c),Math.abs(k))&&Math.abs(u-S)<=1e-6*Math.max(1,Math.abs(u),Math.abs(S))&&Math.abs(h-M)<=1e-6*Math.max(1,Math.abs(h),Math.abs(M))&&Math.abs(d-C)<=1e-6*Math.max(1,Math.abs(d),Math.abs(C))&&Math.abs(p-T)<=1e-6*Math.max(1,Math.abs(p),Math.abs(T))&&Math.abs(m-D)<=1e-6*Math.max(1,Math.abs(m),Math.abs(D))&&Math.abs(g-P)<=1e-6*Math.max(1,Math.abs(g),Math.abs(P))&&Math.abs(f-I)<=1e-6*Math.max(1,Math.abs(f),Math.abs(I))&&Math.abs(A-F)<=1e-6*Math.max(1,Math.abs(A),Math.abs(F))}(e,t),i||=this.style.map.terrain.tileManager.anyTilesAfterTime(this.terrainFacilitator.renderTime),i&&(function(e,t){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),this.terrainFacilitator.renderTime=tC(),this.terrainFacilitator.depthDirty=!1,this.drawFunctions.terrainDepth(this,this.style.map.terrain))}renderLayer(e,t,i,n,a){if(i.isHidden(this.transform.zoom)||"background"!==i.type&&"custom"!==i.type&&!(n||[]).length)return;this.id=i.id;let r=this.drawFunctions;IE(i)?r.symbol(e,t,i,n,this.style.placement.variableOffsets,a):(e=>"circle"===e.type)(i)?r.circle(e,t,i,n,a):(e=>"heatmap"===e.type)(i)?r.heatmap(e,t,i,n,a):(e=>"line"===e.type)(i)?r.line(e,t,i,n,a):(e=>"fill"===e.type)(i)?r.fill(e,t,i,n,a):(e=>"fill-extrusion"===e.type)(i)?r.fillExtrusion(e,t,i,n,a):(e=>"hillshade"===e.type)(i)?r.hillshade(e,t,i,n,a):(e=>"color-relief"===e.type)(i)?r.colorRelief(e,t,i,n,a):fA(i)?r.raster(e,t,i,n,a):(e=>"background"===e.type)(i)?r.background(e,t,i,n,a):(e=>"custom"===e.type)(i)&&r.custom(e,t,i,a)}static{this.MAX_TEXTURE_POOL_SIZE_PER_BUCKET=50}saveTileTexture(t){let i=this._tileTextures[t.size[0]];i?i.length<e.MAX_TEXTURE_POOL_SIZE_PER_BUCKET?i.push(t):t.destroy():this._tileTextures[t.size[0]]=[t]}getTileTexture(e){let t=this._tileTextures[e];return t&&t.length>0?t.pop():null}acquireRTT(e){let t=this.context.gl,i=this._rttObjectRecyclePool.pop();if(i)return i.size!==e&&(i.texture.update({width:e,height:e,data:null},{premultiply:!1,useMipmap:!0}),i.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE,t.LINEAR_MIPMAP_LINEAR),this.context.extTextureFilterAnisotropic&&t.texParameterf(t.TEXTURE_2D,this.context.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,this.context.extTextureFilterAnisotropicMax),i.size=e),i;let n=new iy(this.context,{width:e,height:e,data:null},t.RGBA,{premultiply:!1,useMipmap:!0});return n.bind(t.LINEAR,t.CLAMP_TO_EDGE,t.LINEAR_MIPMAP_LINEAR),this.context.extTextureFilterAnisotropic&&t.texParameterf(t.TEXTURE_2D,this.context.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,this.context.extTextureFilterAnisotropicMax),{texture:n,size:e}}bindRTT(e){let t=this.context.gl,i=e.size;if(!this._rttSharedFbo){let e=this.context.createFramebuffer(i,i,!0,!0),n=this.context.createRenderbuffer(t.DEPTH_STENCIL,i,i);e.depthAttachment.set(n),this._rttSharedFbo={fbo:e,depthRenderbuffer:n,size:i}}this._rttSharedFbo.size!==i&&(this.context.bindRenderbuffer.set(this._rttSharedFbo.depthRenderbuffer),t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_STENCIL,i,i),this.context.bindRenderbuffer.set(null),this._rttSharedFbo.fbo.width=i,this._rttSharedFbo.fbo.height=i,this._rttSharedFbo.size=i),this._rttSharedFbo.fbo.colorAttachment.set(e.texture.texture),this.context.bindFramebuffer.set(this._rttSharedFbo.fbo.framebuffer)}releaseRTT(e){this._rttObjectRecyclePool.push(e)}isPatternMissing(e){if(!e)return!1;if(!e.from||!e.to)return!0;let t=this.patternAtlas.getPattern(e.from.toString()),i=this.patternAtlas.getPattern(e.to.toString());return!t||!i}useProgram(e,t,i=!1,n=[]){this.cache||={};let a=!!this.style.map.terrain,r=this.style.projection,s=i?AP.projectionMercator:r.shaderPreludeCode,o=i?vP:r.shaderDefine,l=`/${i?yP:r.shaderVariantName}`,c=e+(t?t.cacheKey:"")+l+(this._showOverdrawInspector?"/overdraw":"")+(a?"/terrain":"")+(n?`/${n.join("/")}`:"");return this.cache[c]||=new zI(this.context,AP[e],t,cF[e],this._showOverdrawInspector,a,s,o,n),this.cache[c]}setCustomLayerDefaults(){this.context.setCustomLayerDefaults()}setBaseState(){let e=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(e.FUNC_ADD)}initDebugOverlayCanvas(){if(null==this.debugOverlayCanvas){this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512;let e=this.context.gl;this.debugOverlayTexture=new iy(this.context,this.debugOverlayCanvas,e.RGBA)}}destroy(){if(this._tileTextures){for(let e in this._tileTextures){let t=this._tileTextures[e];if(t)for(let e of t)e.destroy()}this._tileTextures={}}for(let e of this._rttObjectRecyclePool)e.texture.destroy();if(this._rttObjectRecyclePool=[],this._rttSharedFbo){this._rttSharedFbo.fbo.colorAttachment.set(null),this._rttSharedFbo.fbo.depthAttachment.set(null);let e=this.context.gl;e.deleteRenderbuffer(this._rttSharedFbo.depthRenderbuffer),e.deleteFramebuffer(this._rttSharedFbo.fbo.framebuffer),this._rttSharedFbo=null}if(this.layerOpacityFbo?.destroy(),this.layerOpacityFbo=null,this.tileExtentBuffer&&this.tileExtentBuffer.destroy(),this.debugBuffer&&this.debugBuffer.destroy(),this.rasterBoundsBuffer&&this.rasterBoundsBuffer.destroy(),this.rasterBoundsBufferPosOnly&&this.rasterBoundsBufferPosOnly.destroy(),this.viewportBuffer&&this.viewportBuffer.destroy(),this.tileBorderIndexBuffer&&this.tileBorderIndexBuffer.destroy(),this.quadTriangleIndexBuffer&&this.quadTriangleIndexBuffer.destroy(),this.tileExtentMesh&&this.tileExtentMesh.vertexBuffer?.destroy(),this.tileExtentMesh&&this.tileExtentMesh.indexBuffer?.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this.context.projectionUniformBuffer.destroy(),this.context.terrainUniformBuffer.destroy(),this.context.frameUniformBuffer.destroy(),this.cache){for(let e in this.cache){let t=this.cache[e];t?.program&&this.context.gl.deleteProgram(t.program)}this.cache={}}this.context&&this.context.setDefault()}overLimit(){let{drawingBufferWidth:e,drawingBufferHeight:t}=this.context.gl;return this.width!==e||this.height!==t}},Yz=class extends Error{constructor(e,t){super("WebGL2 is required to display this map. We are sorry, but it seems that your browser does not support WebGL2, a technology for rendering 3D graphics on the web. Read more on https://wiki.openstreetmap.org/wiki/This_map_requires_WebGL"),this.name="GPUInitializationError",this.requestedAttributes=e,this.statusMessage=t?.statusMessage??null}};function Jz(e,t){let i,n=!1,a=null,r=()=>{a=null,n&&=(e(...i),a=setTimeout(r,t),!1)};return(...e)=>(n=!0,i=e,a||r(),a)}var $z=class{constructor(e){this._getHashParams=()=>new URLSearchParams(window.location.hash.replace("#","")),this._getCurrentHash=()=>{let e=this._getHashParams();return this._hashName?(e.get(this._hashName)||"").split("/"):([...e.keys()][0]??"").split("/")},this._onHashChange=()=>{let e=this._getCurrentHash();if(!this._isValidHash(e))return!1;let t=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(e[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+e[2],+e[1]],zoom:+e[0],bearing:t,pitch:+(e[4]||0)}),!0},this._updateHashUnthrottled=()=>{let e=window.location.href.replace(/(#.*)?$/,this.getHashString());window.history.replaceState(window.history.state,null,e)},this._removeHash=()=>{let e=this._getHashParams();if(this._hashName)e.delete(this._hashName);else{let t=Array.from(e.keys());t.length>0&&e.delete(t[0])}let t=decodeURIComponent(e.toString()).replace(/=&/g,"&").replace(/=$/g,""),i=t?`#${t}`:"",n=window.location.href.replace(/(#.+)?$/,i);n=n.replace("&&","&"),window.history.replaceState(window.history.state,null,n)},this._updateHash=Jz(this._updateHashUnthrottled,300),this._hashName=e&&encodeURIComponent(e)}addTo(e){return this._map=e,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(e){let t=this._map.getCenter(),i=Math.round(100*this._map.getZoom())/100,n=10**Math.ceil((i*Math.LN2+Math.log(512/360/.5))/Math.LN10),a=Math.round(t.lng*n)/n,r=Math.round(t.lat*n)/n,s=this._map.getBearing(),o=this._map.getPitch(),l="";if(l+=e?`/${a}/${r}/${i}`:`${i}/${r}/${a}`,(s||o)&&(l+="/"+Math.round(10*s)/10),o&&(l+=`/${Math.round(o)}`),this._hashName){let e=this._getHashParams();return e.set(this._hashName,l),`#${decodeURIComponent(e.toString()).replace(/=&/g,"&").replace(/=$/g,"")}`}return`#${l}`}_isValidHash(e){if(e.length<3||e.some(e=>isNaN(+e)))return!1;try{new Ex(+e[2],+e[1])}catch{return!1}let t=+e[0],i=+(e[3]||0),n=+(e[4]||0);return t>=this._map.getMinZoom()&&t<=this._map.getMaxZoom()&&i>=-180&&i<=180&&n>=this._map.getMinPitch()&&n<=this._map.getMaxPitch()}};const eR={linearity:.3,easing:ah(0,0,.3,1)},tR=lh({deceleration:2500,maxSpeed:1400},eR),iR=lh({deceleration:20,maxSpeed:1400},eR),nR=lh({deceleration:1e3,maxSpeed:360},eR),aR=lh({deceleration:1e3,maxSpeed:90},eR),rR=lh({deceleration:1e3,maxSpeed:360},eR);var sR=class{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:tC(),settings:e})}_drainInertiaBuffer(){let e=this._inertiaBuffer,t=tC();for(;e.length>0&&t-e[0].time>160;)e.shift()}_getVelocityEntries(){let e=this._inertiaBuffer,t=tC()-60,i=Math.max(0,e.length-2);for(;i>0&&e[i-1].time>=t;)i--;return e.slice(i)}_onMoveEnd(e){this._drainInertiaBuffer();let t=this._getVelocityEntries();if(t.length<2)return void this.clear();let i={zoom:0,bearing:0,pitch:0,roll:0,pan:new Hc(0,0),pinchAround:void 0,around:void 0};for(let{settings:e}of t)e.around&&(i.around=e.around),e.pinchAround&&(i.pinchAround=e.pinchAround);for(let{settings:e}of t.slice(1))i.zoom+=e.zoomDelta||0,i.bearing+=e.bearingDelta||0,i.pitch+=e.pitchDelta||0,i.roll+=e.rollDelta||0,e.panDelta&&i.pan._add(e.panDelta);if(!(i.pan.mag()||i.zoom||i.bearing||i.pitch||i.roll))return void this.clear();let n=tC()-t[0].time,a={};if(i.pan.mag()){let t=lR(i.pan.mag(),n,lh({},tR,e||{})),r=i.pan.mult(t.amount/i.pan.mag()),s=this._map._camera.cameraHelper.handlePanInertia(r,this._map._camera.transform);a.center=s.easingCenter,a.offset=s.easingOffset,oR(a,t)}if(i.zoom){let e=lR(i.zoom,n,iR);a.zoom=mh(this._map.getZoom()+e.amount,this._map.getZoomSnap(),e.amount),oR(a,e)}if(i.bearing){let e=lR(i.bearing,n,nR);a.bearing=this._map.getBearing()+sh(e.amount,-179,179),oR(a,e)}if(i.pitch){let e=lR(i.pitch,n,aR);a.pitch=this._map.getPitch()+e.amount,oR(a,e)}if(i.roll){let e=lR(i.roll,n,rR);a.roll=this._map.getRoll()+sh(e.amount,-179,179),oR(a,e)}if(a.zoom||a.bearing){let e=void 0===i.pinchAround?i.around:i.pinchAround;a.around=e?this._map.unproject(e):this._map.getCenter()}return this.clear(),lh(a,{noMoveStart:!0})}};function oR(e,t){(!e.duration||e.duration<t.duration)&&(e.duration=t.duration,e.easing=t.easing)}function lR(e,t,i){let{maxSpeed:n,linearity:a,deceleration:r}=i,s=sh(e*a/(t/1e3),-n,n),o=Math.abs(s)/(r*a);return{easing:i.easing,duration:1e3*o,amount:o/2*s}}var cR=class{constructor(e,t){this._map=e,this._clickTolerance=t.clickTolerance}reset(){delete this._mousedownPos}wheel(e){return this._firePreventable(new dC(this._map,e))}mousedown(e,t){return this._mousedownPos=t,this._firePreventable(new uC(e.type,this._map,e))}mouseup(e){this._map.fire(new uC(e.type,this._map,e))}click(e,t){this._mousedownPos&&this._mousedownPos.dist(t)>=this._clickTolerance||this._map.fire(new uC(e.type,this._map,e))}dblclick(e){return this._firePreventable(new uC(e.type,this._map,e))}mouseover(e){this._map.fire(new uC(e.type,this._map,e))}mouseout(e){this._map.fire(new uC(e.type,this._map,e))}touchstart(e){return this._firePreventable(new hC(e.type,this._map,e))}touchmove(e){this._map.fire(new hC(e.type,this._map,e))}touchend(e){this._map.fire(new hC(e.type,this._map,e))}touchcancel(e){this._map.fire(new hC(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}},uR=class{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(e){this._map.fire(new uC(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new uC("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._ignoreContextMenu||this._map.fire(new uC(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}},hR=class{constructor(e,t,i){this._map=e,this._tr=i,this._el=e.getCanvasContainer(),this._container=e.getContainer(),this._clickTolerance=t.clickTolerance||1,t.boxZoom&&"object"==typeof t.boxZoom&&(this._boxZoomEnd=t.boxZoom.boxZoomEnd)}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(e,t){this.isEnabled()&&e.shiftKey&&0===e.button&&(iC.disableDrag(),this._startPos=this._lastPos=t,this._active=!0)}mousemoveWindow(e,t){if(!this._active)return;let i=t;if(this._lastPos.equals(i)||!this._box&&i.dist(this._startPos)<this._clickTolerance)return;let n=this._startPos;this._lastPos=i,this._box||(this._box=iC.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",e));let a=Math.min(n.x,i.x),r=Math.max(n.x,i.x),s=Math.min(n.y,i.y),o=Math.max(n.y,i.y);this._box.style.transform=`translate(${a}px,${s}px)`,this._box.style.width=r-a+"px",this._box.style.height=o-s+"px"}mouseupWindow(e,t){if(!this._active||0!==e.button)return;let i=this._startPos,n=t;if(this.reset(),iC.suppressClick(),i.x!==n.x||i.y!==n.y)return this._map.fire(new pC("boxzoomend",{originalEvent:e})),this._boxZoomEnd?void this._boxZoomEnd(this._map,i,n,e):{cameraAnimation:e=>e.fitScreenCoordinates(i,n,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",e)}keydown(e){this._active&&27===e.keyCode&&(this.reset(),this._fireEvent("boxzoomcancel",e))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&=(this._box.remove(),null),iC.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(e,t){return this._map.fire(new pC(e,{originalEvent:t}))}};function dR(e,t){if(e.length!==t.length)throw Error(`The number of touches and points are not equal - touches ${e.length}, points ${t.length}`);let i={};for(let n=0;n<e.length;n++)i[e[n].identifier]=t[n];return i}var pR=class{constructor(e){this.reset(),this.numTouches=e.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(e,t,i){(this.centroid||i.length>this.numTouches)&&(this.aborted=!0),!this.aborted&&(void 0===this.startTime&&(this.startTime=e.timeStamp),i.length===this.numTouches&&(this.centroid=function(e){let t=new Hc(0,0);for(let i of e)t._add(i);return t.div(e.length)}(t),this.touches=dR(i,t)))}touchmove(e,t,i){if(this.aborted||!this.centroid)return;let n=dR(i,t);for(let e in this.touches){let t=this.touches[e],i=n[e];(!i||i.dist(t)>30)&&(this.aborted=!0)}}touchend(e,t,i){if((!this.centroid||e.timeStamp-this.startTime>500)&&(this.aborted=!0),0===i.length){let e=!this.aborted&&this.centroid;if(this.reset(),e)return e}}},mR=class{constructor(e){this.singleTap=new pR(e),this.numTaps=e.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(e,t,i){this.singleTap.touchstart(e,t,i)}touchmove(e,t,i){this.singleTap.touchmove(e,t,i)}touchend(e,t,i){let n=this.singleTap.touchend(e,t,i);if(n){let t=e.timeStamp-this.lastTime<500,i=!this.lastTap||this.lastTap.dist(n)<30;if((!t||!i)&&this.reset(),this.count++,this.lastTime=e.timeStamp,this.lastTap=n,this.count===this.numTaps)return this.reset(),n}}},gR=class{constructor(e,t){this._tr=t,this._zoomIn=new mR({numTouches:1,numTaps:2}),this._zoomOut=new mR({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(e,t,i){this._zoomIn.touchstart(e,t,i),this._zoomOut.touchstart(e,t,i)}touchmove(e,t,i){this._zoomIn.touchmove(e,t,i),this._zoomOut.touchmove(e,t,i)}touchend(e,t,i){let n=this._zoomIn.touchend(e,t,i),a=this._zoomOut.touchend(e,t,i),r=this._tr;return n?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:t=>t.easeTo({duration:300,zoom:mh(r.zoom+1,t.getZoomSnap()),around:r.unproject(n)},{originalEvent:e})}):a?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:t=>t.easeTo({duration:300,zoom:mh(r.zoom-1,t.getZoomSnap()),around:r.unproject(a)},{originalEvent:e})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}},fR=class{constructor(e){this._enabled=!!e.enable,this._moveStateManager=e.moveStateManager,this._clickTolerance=e.clickTolerance||1,this._moveFunction=e.move,this._activateOnStart=!!e.activateOnStart,e.assignEvents(this),this.reset()}reset(e){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(e)}_move(...e){let t=this._moveFunction(...e);if(t.bearingDelta||t.pitchDelta||t.rollDelta||t.around||t.panDelta)return this._active=!0,t}dragStart(e,t){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(e)&&(this._moveStateManager.startMove(e),this._lastPoint=Array.isArray(t)?t[0]:t,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(e,t){if(!this.isEnabled())return;let i=this._lastPoint;if(!i)return;if(e.preventDefault(),!this._moveStateManager.isValidMoveEvent(e))return void this.reset(e);let n=Array.isArray(t)?t[0]:t;return!this._moved&&n.dist(i)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=n,this._move(i,n))}dragEnd(e){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(e)&&(this._moved&&iC.suppressClick(),this.reset(e))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}};const AR={0:1,2:2};var _R=class{constructor(e){this._correctEvent=e.checkCorrectEvent}startMove(e){this._eventButton=e.button}endMove(e){delete this._eventButton}isValidStartEvent(e){return this._correctEvent(e)}isValidMoveEvent(e){return!function(e,t){let i=AR[t];return void 0===e.buttons||(e.buttons&i)!==i}(e,this._eventButton)}isValidEndEvent(e){return e.button===this._eventButton}},vR=class{constructor(){this._firstTouch=void 0}_isOneFingerTouch(e){return 1===e.targetTouches.length}_isSameTouchEvent(e){return e.targetTouches[0].identifier===this._firstTouch}startMove(e){this._firstTouch=e.targetTouches[0].identifier}endMove(e){delete this._firstTouch}isValidStartEvent(e){return this._isOneFingerTouch(e)}isValidMoveEvent(e){return this._isOneFingerTouch(e)&&this._isSameTouchEvent(e)}isValidEndEvent(e){return this._isOneFingerTouch(e)&&this._isSameTouchEvent(e)}},yR=class{constructor(e=new _R({checkCorrectEvent:()=>!0}),t=new vR){this.mouseMoveStateManager=e,this.oneFingerTouchMoveStateManager=t}_executeRelevantHandler(e,t,i){return e instanceof MouseEvent?t(e):typeof TouchEvent<"u"&&e instanceof TouchEvent?i(e):void 0}startMove(e){this._executeRelevantHandler(e,e=>{this.mouseMoveStateManager.startMove(e)},e=>{this.oneFingerTouchMoveStateManager.startMove(e)})}endMove(e){this._executeRelevantHandler(e,e=>{this.mouseMoveStateManager.endMove(e)},e=>{this.oneFingerTouchMoveStateManager.endMove(e)})}isValidStartEvent(e){return!!this._executeRelevantHandler(e,e=>this.mouseMoveStateManager.isValidStartEvent(e),e=>this.oneFingerTouchMoveStateManager.isValidStartEvent(e))}isValidMoveEvent(e){return!!this._executeRelevantHandler(e,e=>this.mouseMoveStateManager.isValidMoveEvent(e),e=>this.oneFingerTouchMoveStateManager.isValidMoveEvent(e))}isValidEndEvent(e){return!!this._executeRelevantHandler(e,e=>this.mouseMoveStateManager.isValidEndEvent(e),e=>this.oneFingerTouchMoveStateManager.isValidEndEvent(e))}};const xR=e=>{e.mousedown=e.dragStart,e.mousemoveWindow=e.dragMove,e.mouseup=e.dragEnd,e.contextmenu=e=>{e.preventDefault()}};var bR=class{constructor(e,t){this._clickTolerance=e.clickTolerance||1,this._map=t,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new Hc(0,0)}_shouldBePrevented(e){return e<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(e,t,i){return this._calculateTransform(e,t,i)}touchmove(e,t,i){if(this._active)return this._shouldBePrevented(i.length)?void this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",e):(e.preventDefault(),this._calculateTransform(e,t,i))}touchend(e,t,i){this._calculateTransform(e,t,i),this._active&&this._shouldBePrevented(i.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(e,t,i){i.length>0&&(this._active=!0);let n=dR(i,t),a=new Hc(0,0),r=new Hc(0,0),s=0;for(let e in n){let t=n[e],i=this._touches[e];i&&(a._add(t),r._add(t.sub(i)),s++,n[e]=t)}if(this._touches=n,this._shouldBePrevented(s)||!r.mag())return;let o=r.div(s);return this._sum._add(o),this._sum.mag()<this._clickTolerance?void 0:{around:a.div(s),panDelta:o}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}},wR=class{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(e,t,i){this._firstTwoTouches||i.length<2||(this._firstTwoTouches=[i[0].identifier,i[1].identifier],this._start([t[0],t[1]]))}touchmove(e,t,i){if(!this._firstTwoTouches)return;e.preventDefault();let[n,a]=this._firstTwoTouches,r=ER(i,t,n),s=ER(i,t,a);if(!r||!s)return;let o=this._aroundCenter?null:r.add(s).div(2);return this._move([r,s],o,e)}touchend(e,t,i){if(!this._firstTwoTouches)return;let[n,a]=this._firstTwoTouches,r=ER(i,t,n),s=ER(i,t,a);r&&s||(this._active&&iC.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(e){this._enabled=!0,this._aroundCenter=!!e&&"center"===e.around}disable(){this._enabled=!1,this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}};function ER(e,t,i){for(let n=0;n<e.length;n++)if(e[n].identifier===i)return t[n]}function kR(e,t){return Math.log(e/t)/Math.LN2}var SR=class extends wR{constructor(){super(),this._zoomRate=1,this._zoomThreshold=.1}setZoomRate(e){this._zoomRate=e??1}setZoomThreshold(e){this._zoomThreshold=e??.1}reset(){super.reset(),delete this._distance,delete this._startDistance}_start(e){this._startDistance=this._distance=e[0].dist(e[1])}_move(e,t){let i=this._distance;if(this._distance=e[0].dist(e[1]),this._active||!(Math.abs(kR(this._distance,this._startDistance))<this._zoomThreshold))return this._active=!0,{zoomDelta:kR(this._distance,i)*this._zoomRate,pinchAround:t}}};function MR(e,t){return 180*e.angleWith(t)/Math.PI}var CR=class extends wR{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(e){this._startVector=this._vector=e[0].sub(e[1]),this._minDiameter=e[0].dist(e[1])}_move(e,t,i){let n=this._vector;if(this._vector=e[0].sub(e[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:MR(this._vector,n),pinchAround:t}}_isBelowThreshold(e){this._minDiameter=Math.min(this._minDiameter,e.mag());let t=25/(Math.PI*this._minDiameter)*360,i=MR(e,this._startVector);return Math.abs(i)<t}};function TR(e){return Math.abs(e.y)>Math.abs(e.x)}var DR=class extends wR{constructor(e){super(),this._currentTouchCount=0,this._map=e}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(e,t,i){super.touchstart(e,t,i),this._currentTouchCount=i.length}_start(e){this._lastPoints=e,TR(e[0].sub(e[1]))&&(this._valid=!1)}_move(e,t,i){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;let n=e[0].sub(this._lastPoints[0]),a=e[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(n,a,i.timeStamp),this._valid?(this._lastPoints=e,this._active=!0,{pitchDelta:(n.y+a.y)/2*-.5}):void 0}gestureBeginsVertically(e,t,i){if(void 0!==this._valid)return this._valid;let n=e.mag()>=2,a=t.mag()>=2;if(!n&&!a)return;if(!n||!a)return void 0===this._firstMove&&(this._firstMove=i),i-this._firstMove<100&&void 0;let r=e.y>0==t.y>0;return TR(e)&&TR(t)&&r}};const PR={panStep:100,bearingStep:15,pitchStep:10};var IR=class{constructor(e,t){this._tr=t;let i=PR;this._panStep=i.panStep,this._bearingStep=i.bearingStep,this._pitchStep=i.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;let t=0,i=0,n=0,a=0,r=0;switch(e.keyCode){case 61:case 107:case 171:case 187:t=1;break;case 189:case 109:case 173:t=-1;break;case 37:e.shiftKey?i=-1:(e.preventDefault(),a=-1);break;case 39:e.shiftKey?i=1:(e.preventDefault(),a=1);break;case 38:e.shiftKey?n=1:(e.preventDefault(),r=-1);break;case 40:e.shiftKey?n=-1:(e.preventDefault(),r=1);break;default:return}return this._rotationDisabled&&(i=0,n=0),{cameraAnimation:s=>{let o=this._tr;s.easeTo({duration:300,easeId:"keyboardHandler",easing:FR,zoom:t?mh(o.zoom+t*(e.shiftKey?2:1),s.getZoomSnap()):o.zoom,bearing:o.bearing+i*this._bearingStep,pitch:o.pitch+n*this._pitchStep,offset:[-a*this._panStep,-r*this._panStep],center:o.center},{originalEvent:e})}}}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 FR(e){return e*(2-e)}const zR=4.000244140625;var RR=class{constructor(e,t,i){this._onTimeout=e=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(e)},this._map=e,this._tr=i,this._triggerRenderFrame=t,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(e){this._defaultZoomRate=e}setWheelZoomRate(e){this._wheelZoomRate=e}isEnabled(){return!!this._enabled}isActive(){return!!this._active||void 0!==this._finishTimeout}isZooming(){return!!this._zooming}enable(e){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!e&&"center"===e.around)}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(e){return!!this._map.cooperativeGestures.isEnabled()&&!(e.ctrlKey||this._map.cooperativeGestures.isBypassed(e))}wheel(e){if(!this.isEnabled())return;if(this._shouldBePrevented(e))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",e);let t=e.deltaMode===WheelEvent.DOM_DELTA_LINE?40*e.deltaY:e.deltaY,i=tC(),n=i-(this._lastWheelEventTime||0);this._lastWheelEventTime=i,0!==t&&t%zR==0?this._type="wheel":0!==t&&Math.abs(t)<4?this._type="trackpad":n>400?(this._type=null,this._lastValue=t,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(n*t)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,t+=this._lastValue)),e.shiftKey&&t&&(t/=4),this._type&&(this._lastWheelEvent=e,this._delta-=t,this._active||this._start(e)),e.preventDefault()}_start(e){if(!this._delta)return;this._needsRerender=!1,this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);let t=iC.mousePos(this._map.getCanvas(),e),i=this._tr;this._aroundPoint=this._aroundCenter?i.transform.locationToScreenPoint(Ex.convert(i.center)):t,this._needsRerender||(this._needsRerender=!0,this._triggerRenderFrame())}renderFrame(){if(!this._needsRerender||(this._needsRerender=!1,!this.isActive()))return;let e=this._tr.transform;if("number"==typeof this._lastExpectedZoom){let t=e.zoom-this._lastExpectedZoom;"number"==typeof this._startZoom&&(this._startZoom+=t),"number"==typeof this._targetZoom&&(this._targetZoom+=t)}if(0!==this._delta){let t="wheel"===this._type&&Math.abs(this._delta)>zR?this._wheelZoomRate:this._defaultZoomRate,i=2/(1+Math.exp(-Math.abs(this._delta*t)));this._delta<0&&0!==i&&(i=1/i);let n="number"==typeof this._targetZoom?dh(this._targetZoom):e.scale,a=e.applyConstrain(e.getCameraLngLat(),ph(n*i)).zoom,r=this._map.getZoomSnap();if("wheel"===this._type&&r>0){let t=mh(e.zoom,r);this._targetZoom=mh(a,r,a-t)}else this._targetZoom=a;"wheel"===this._type&&(this._startZoom=e.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}let t,i="number"==typeof this._targetZoom?this._targetZoom:e.zoom,n=this._startZoom,a=this._easing,r=!1;if("wheel"===this._type&&n&&a){let e=tC()-this._lastWheelEventTime,s=Math.min((e+5)/200,1),o=a(s);t=Ep.number(n,i,o),s<1?this._needsRerender=!0:r=!0}else t=i,r=!0;return this._active=!0,r&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._lastExpectedZoom,delete this._finishTimeout},200)),this._lastExpectedZoom=t,{noInertia:!0,needsRenderFrame:!r,zoomDelta:t-e.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(e){let t=rh;if(this._prevEase){let e=this._prevEase,i=(tC()-e.start)/e.duration,n=e.easing(i+.01)-e.easing(i),a=.27/Math.sqrt(n*n+1e-4)*.01;t=ah(a,Math.sqrt(.0729-a*a),.25,1)}return this._prevEase={start:tC(),duration:e,easing:t},t}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,delete this._lastExpectedZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}},LR=class{constructor(e,t){this._clickZoom=e,this._tapZoom=t}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()}},BR=class{constructor(e,t){this._tr=t,this.reset()}reset(){this._active=!1}dblclick(e,t){return e.preventDefault(),{cameraAnimation:i=>{i.easeTo({duration:300,zoom:mh(this._tr.zoom+(e.shiftKey?-1:1),i.getZoomSnap()),around:this._tr.unproject(t)},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}},OR=class{constructor(){this._tap=new mR({numTouches:1,numTaps:1}),this._zoomRate=1,this.reset()}setZoomRate(e){this._zoomRate=e??1}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(e,t,i){if(!this._swipePoint)if(this._tapTime){let n=t[0],a=e.timeStamp-this._tapTime<500,r=this._tapPoint.dist(n)<30;a&&r?i.length>0&&(this._swipePoint=n,this._swipeTouch=i[0].identifier):this.reset()}else this._tap.touchstart(e,t,i)}touchmove(e,t,i){if(this._tapTime){if(this._swipePoint){if(i[0].identifier!==this._swipeTouch)return;let n=t[0],a=n.y-this._swipePoint.y;return this._swipePoint=n,e.preventDefault(),this._active=!0,{zoomDelta:a/128*this._zoomRate}}}else this._tap.touchmove(e,t,i)}touchend(e,t,i){if(this._tapTime)this._swipePoint&&0===i.length&&this.reset();else{let n=this._tap.touchend(e,t,i);n&&(this._tapTime=e.timeStamp,this._tapPoint=n)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}},UR=class{constructor(e,t,i){this._el=e,this._mousePan=t,this._touchPan=i}enable(e){this._inertiaOptions=e||{},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()}},NR=class{constructor(e,t,i,n){this._pitchWithRotate=e.pitchWithRotate,this._rollEnabled=e.rollEnabled,this._mouseRotate=t,this._mousePitch=i,this._mouseRoll=n}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()}},jR=class{constructor(e,t,i,n){this._el=e,this._touchZoom=t,this._touchRotate=i,this._tapDragZoom=n,this._rotationDisabled=!1,this._enabled=!0}enable(e){this._touchZoom.enable(e),this._rotationDisabled||this._touchRotate.enable(e),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()}setZoomRate(e){this._touchZoom.setZoomRate(e),this._tapDragZoom.setZoomRate(e)}setZoomThreshold(e){this._touchZoom.setZoomThreshold(e)}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}},VR=class{constructor(e,t){this._bypassKey=navigator.userAgent.includes("Mac")?"metaKey":"ctrlKey",this._map=e,this._options=t,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;let e=this._map.getCanvasContainer();e.classList.add("maplibregl-cooperative-gestures"),this._container=iC.create("div","maplibregl-cooperative-gesture-screen",e);let t=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");"metaKey"===this._bypassKey&&(t=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));let i=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),n=document.createElement("div");n.className="maplibregl-desktop-message",n.textContent=t,this._container.appendChild(n);let a=document.createElement("div");a.className="maplibregl-mobile-message",a.textContent=i,this._container.appendChild(a),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(this._container.remove(),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(e){return e[this._bypassKey]}notifyGestureBlocked(e,t){this._enabled&&(this._map.fire(new rC("cooperativegestureprevented",{gestureType:e,originalEvent:t})),this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}},qR=class{constructor(e){this._camera=e}get transform(){return this._camera._requestedCameraState||this._camera.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(e){return this.transform.screenPointToLocation(Hc.convert(e),this._camera.terrain)}};const GR=e=>e.zoom||e.drag||e.roll||e.pitch||e.rotate;var HR=class extends ed{};function WR(e){return e.panDelta?.mag()||e.zoomDelta||e.bearingDelta||e.pitchDelta||e.rollDelta}var ZR=class{get _ownerDocument(){return this._el?.ownerDocument||document}get _ownerWindow(){return this._el?.ownerDocument?.defaultView||window}constructor(e,t,i){this._terrainGestureAnchorElevation=null,this.handleWindowEvent=e=>{this.handleEvent(e,`${e.type}Window`)},this.handleEvent=(e,t)=>{if("blur"===e.type)return void this.stop(!0);this._updatingCamera=!0;let i="renderFrame"===e.type?void 0:e,n={needsRenderFrame:!1},a={},r={};for(let{handlerName:s,handler:o,allowed:l}of this._handlers){if(!o.isEnabled())continue;let c;if(this._blockedByActive(r,l,s))o.reset();else if(o[t||e.type]){if(Lh(e,t||e.type)){let i=iC.mousePos(this._map.getCanvas(),e);c=o[t||e.type](e,i)}else if(Rh(e,t||e.type)){let i=e.touches,n=this._getMapTouches(i),a=iC.touchPos(this._map.getCanvas(),n);c=o[t||e.type](e,a,n)}else Bh(t||e.type)||(c=o[t||e.type](e));this.mergeHandlerResult(n,a,c,s,i),c?.needsRenderFrame&&this._triggerRenderFrame()}(c||o.isActive())&&(r[s]=o)}let s={};for(let e in this._previousActiveHandlers)r[e]||(s[e]=i);this._previousActiveHandlers=r,(Object.keys(s).length||WR(n))&&(this._changes.push([n,a,s]),this._triggerRenderFrame()),(Object.keys(r).length||WR(n))&&this._camera.stop(!0),this._updatingCamera=!1;let{cameraAnimation:o}=n;o&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],o(this._map))},this._map=e,this._camera=t,this._transformProvider=new qR(this._camera),this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new sR(e),this._bearingSnap=i.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(i);let n=this._el;this._listeners=[[n,"touchstart",{passive:!0}],[n,"touchmove",{passive:!1}],[n,"touchend",void 0],[n,"touchcancel",void 0],[n,"mousedown",void 0],[n,"mousemove",void 0],[n,"mouseup",void 0],[this._ownerDocument,"mousemove",{capture:!0}],[this._ownerDocument,"mouseup",void 0],[n,"mouseover",void 0],[n,"mouseout",void 0],[n,"dblclick",void 0],[n,"click",void 0],[n,"keydown",{capture:!1}],[n,"keyup",void 0],[n,"wheel",{passive:!1}],[n,"contextmenu",void 0],[this._ownerWindow,"blur",void 0]];for(let[e,t,i]of this._listeners)e.addEventListener(t,e===this._ownerDocument?this.handleWindowEvent:this.handleEvent,i)}destroy(){for(let[e,t,i]of this._listeners)e.removeEventListener(t,e===this._ownerDocument?this.handleWindowEvent:this.handleEvent,i)}_addDefaultHandlers(e){let t=this._map,i=t.getCanvasContainer();this._add("mapEvent",new cR(t,e));let n=t.boxZoom=new hR(t,e,this._transformProvider);this._add("boxZoom",n),e.interactive&&e.boxZoom&&n.enable();let a=t.cooperativeGestures=new VR(t,e.cooperativeGestures);this._add("cooperativeGestures",a),e.cooperativeGestures&&a.enable();let r=new gR(t,this._transformProvider),s=new BR(t,this._transformProvider);t.doubleClickZoom=new LR(s,r),this._add("tapZoom",r),this._add("clickZoom",s),e.interactive&&e.doubleClickZoom&&t.doubleClickZoom.enable();let o=new OR;this._add("tapDragZoom",o);let l=t.touchPitch=new DR(t);this._add("touchPitch",l),e.interactive&&e.touchPitch&&t.touchPitch.enable(e.touchPitch);let c=()=>t.project(t.getCenter()),u=function({enable:e,clickTolerance:t,aroundCenter:i=!0,minPixelCenterThreshold:n=100,rotateSpeed:a=.8},r){return new fR({clickTolerance:t,move:(e,t)=>{let s=r();if(i&&Math.abs(s.y-e.y)>n)return{bearingDelta:Dh(new Hc(e.x,t.y),t,s)};let o=(t.x-e.x)*a;return i&&t.y<s.y&&(o=-o),{bearingDelta:o}},moveStateManager:new _R({checkCorrectEvent:e=>0===e.button&&e.ctrlKey||2===e.button&&!e.ctrlKey}),enable:e,assignEvents:xR})}(e,c),h=function({enable:e,clickTolerance:t,pitchSpeed:i=-.5}){return new fR({clickTolerance:t,move:(e,t)=>({pitchDelta:(t.y-e.y)*i}),moveStateManager:new _R({checkCorrectEvent:e=>0===e.button&&e.ctrlKey||2===e.button}),enable:e,assignEvents:xR})}(e),d=function({enable:e,clickTolerance:t,rollDegreesPerPixelMoved:i=.3},n){return new fR({clickTolerance:t,move:(e,t)=>{let a=n(),r=(t.x-e.x)*i;return t.y<a.y&&(r=-r),{rollDelta:r}},moveStateManager:new _R({checkCorrectEvent:e=>2===e.button&&e.ctrlKey}),enable:e,assignEvents:xR})}(e,c);t.dragRotate=new NR(e,u,h,d),this._add("mouseRotate",u,["mousePitch"]),this._add("mousePitch",h,["mouseRotate","mouseRoll"]),this._add("mouseRoll",d,["mousePitch"]),e.interactive&&e.dragRotate&&t.dragRotate.enable();let p=function({enable:e,clickTolerance:t}){return new fR({clickTolerance:t,move:(e,t)=>({around:t,panDelta:t.sub(e)}),activateOnStart:!0,moveStateManager:new _R({checkCorrectEvent:e=>0===e.button&&!e.ctrlKey}),enable:e,assignEvents:xR})}(e),m=new bR(e,t);t.dragPan=new UR(i,p,m),this._add("mousePan",p),this._add("touchPan",m,["touchZoom","touchRotate"]),e.interactive&&e.dragPan&&t.dragPan.enable(e.dragPan);let g=new CR,f=new SR;t.touchZoomRotate=new jR(i,f,g,o),this._add("touchRotate",g,["touchPan","touchZoom"]),this._add("touchZoom",f,["touchPan","touchRotate"]),e.interactive&&e.touchZoomRotate&&t.touchZoomRotate.enable(e.touchZoomRotate),this._add("blockableMapEvent",new uR(t));let A=t.scrollZoom=new RR(t,()=>this._triggerRenderFrame(),this._transformProvider);this._add("scrollZoom",A,["mousePan"]),e.interactive&&e.scrollZoom&&t.scrollZoom.enable(e.scrollZoom);let _=t.keyboard=new IR(t,this._transformProvider);this._add("keyboard",_),e.interactive&&e.keyboard&&t.keyboard.enable()}_add(e,t,i){this._handlers.push({handlerName:e,handler:t,allowed:i}),this._handlersById[e]=t}stop(e){if(!this._updatingCamera){for(let{handler:e}of this._handlers)e.reset();this._inertia.clear(),this._fireEvents({},{},e),this._changes=[]}}isActive(){for(let{handler:e}of this._handlers)if(e.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!GR(this._eventsInProgress)||this.isZooming()}_blockedByActive(e,t,i){for(let n in e)if(n!==i&&!t?.includes(n))return!0;return!1}_getMapTouches(e){let t=[];for(let i of e){let e=i.target;this._el.contains(e)&&t.push(i)}return t}mergeHandlerResult(e,t,i,n,a){if(!i)return;lh(e,i);let r={handlerName:n,originalEvent:i.originalEvent||a};void 0!==i.zoomDelta&&(t.zoom=r),void 0!==i.panDelta&&(t.drag=r),void 0!==i.rollDelta&&(t.roll=r),void 0!==i.pitchDelta&&(t.pitch=r),void 0!==i.bearingDelta&&(t.rotate=r)}_applyChanges(){let e={},t={},i={};for(let[n,a,r]of this._changes)n.panDelta&&(e.panDelta=(e.panDelta||new Hc(0,0))._add(n.panDelta)),n.zoomDelta&&(e.zoomDelta=(e.zoomDelta||0)+n.zoomDelta),n.bearingDelta&&(e.bearingDelta=(e.bearingDelta||0)+n.bearingDelta),n.pitchDelta&&(e.pitchDelta=(e.pitchDelta||0)+n.pitchDelta),n.rollDelta&&(e.rollDelta=(e.rollDelta||0)+n.rollDelta),void 0!==n.around&&(e.around=n.around),void 0!==n.pinchAround&&(e.pinchAround=n.pinchAround),n.noInertia&&(e.noInertia=n.noInertia),lh(t,a),lh(i,r);this._updateMapTransform(e,t,i),this._changes=[]}_updateMapTransform(e,t,i){let n=this._map,a=this._camera.getTransformForUpdate(),r=n.terrain;if(!(WR(e)||r&&this._terrainMovement))return void this._fireEvents(t,i,!0);this._camera.stop(!0);let{panDelta:s,zoomDelta:o,bearingDelta:l,pitchDelta:c,rollDelta:u}=e,{around:h,aroundOnSurface:d}=this._resolveAround(e,r,a),p=r?this._terrainGestureElevation(r,h,d,a,t):void 0,m={panDelta:s,zoomDelta:o,rollDelta:u,pitchDelta:c,bearingDelta:l,around:h,aroundElevation:p};this._camera.cameraHelper.useGlobeControls&&!a.isPointOnMapSurface(h)&&(h=a.centerPoint);let g=this._computePreZoomAroundLoc(a,h,s,p);this._handleMapControls({terrain:r,tr:a,deltasForHelper:m,preZoomAroundLoc:g,combinedEventsInProgress:t,panDelta:s}),this._camera.applyUpdatedTransform(a),this._map._update(),e.noInertia||this._inertia.record(e),this._fireEvents(t,i,!0)}_resolveAround(e,t,i){let n=void 0===e.pinchAround?e.around:e.pinchAround;return n||=this._camera.transform.centerPoint,t&&!i.isPointOnMapSurface(n)?{around:i.centerPoint,aroundOnSurface:!1}:{around:n,aroundOnSurface:!0}}_terrainGestureElevation(e,t,i,n,a){if(!i)return;if(!this._terrainMovement&&(a.drag||a.zoom)){let i=n.screenTerrainPointToMercatorCoordinate(t,e);this._terrainGestureAnchorElevation=i?i.z:null}if(null===this._terrainGestureAnchorElevation)return;let r=this._terrainGestureAnchorElevation;return t.distSqr(n.centerPoint)<.01||r-n.elevation>=.9*(n.getCameraAltitude()-n.elevation)?void 0:r}_computePreZoomAroundLoc(e,t,i,n){if(t.distSqr(e.centerPoint)<.01)return e.center;let a=i?t.sub(i):t;return void 0===n?e.screenPointToLocation(a):e.screenPointToLocationAtElevation(a,n)}_handleMapControls({terrain:e,tr:t,deltasForHelper:i,preZoomAroundLoc:n,combinedEventsInProgress:a,panDelta:r}){let s=this._camera.cameraHelper;if(s.handleMapControlsRollPitchBearingZoom(i,t),e)return s.useGlobeControls?(!this._terrainMovement&&(a.drag||a.zoom)&&(this._terrainMovement=!0,this._camera.elevationFreeze=!0),void s.handleMapControlsPan(i,t,n)):this._terrainMovement||!a.drag&&!a.zoom?void(void 0===i.aroundElevation&&a.drag&&this._terrainMovement&&r?t.setCenter(t.screenPointToLocation(t.centerPoint.sub(r))):s.handleMapControlsPan(i,t,n)):(this._terrainMovement=!0,this._camera.elevationFreeze=!0,void s.handleMapControlsPan(i,t,n));s.handleMapControlsPan(i,t,n)}_fireEvents(e,t,i){let n=GR(this._eventsInProgress),a=GR(e),r={};for(let t in e){let{originalEvent:i}=e[t];this._eventsInProgress[t]||(r[`${t}start`]=i),this._eventsInProgress[t]=e[t]}!n&&a&&this._fireEvent("movestart",a.originalEvent);for(let e in r)this._fireEvent(e,r[e]);a&&this._fireEvent("move",a.originalEvent);for(let t in e){let{originalEvent:i}=e[t];this._fireEvent(t,i)}let s,o={};for(let e in this._eventsInProgress){let{handlerName:i,originalEvent:n}=this._eventsInProgress[e];this._handlersById[i].isActive()||(delete this._eventsInProgress[e],s=t[i]||n,o[`${e}end`]=s)}for(let e in o)this._fireEvent(e,o[e]);let l=GR(this._eventsInProgress),c=(n||a)&&!l;if(c&&this._terrainMovement){this._camera.elevationFreeze=!1,this._terrainMovement=!1,this._terrainGestureAnchorElevation=null;let e=this._camera.getTransformForUpdate();this._map.getCenterClampedToGround()&&e.recalculateZoomAndCenter(this._map.terrain),this._camera.applyUpdatedTransform(e)}if(i&&c){this._updatingCamera=!0;let e=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),t=e=>0!==e&&-this._bearingSnap<e&&e<this._bearingSnap;!e||!e.essential&&$M.prefersReducedMotion?(this._map.fire(new sC("moveend",{originalEvent:s})),t(this._map.getBearing())&&this._map.resetNorth()):(t(e.bearing||this._map.getBearing())&&(e.bearing=0),e.freezeElevation=!0,this._map.easeTo(e,{originalEvent:s})),this._updatingCamera=!1}}_fireEvent(e,t){this._map.fire(new sC(e,t?{originalEvent:t}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(e=>{delete this._frameId,this.handleEvent(new HR("renderFrame",{timeStamp:e})),this._applyChanges()})}_triggerRenderFrame(){void 0===this._frameId&&(this._frameId=this._requestFrame())}},KR=class extends id{constructor(e){super(),this._renderFrameCallback=()=>{let e=Math.min((tC()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(e)),e<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this.transform=new RP,this.cameraHelper=new jP,void 0!==e.minZoom&&this.transform.setMinZoom(e.minZoom),void 0!==e.maxZoom&&this.transform.setMaxZoom(e.maxZoom),void 0!==e.minPitch&&this.transform.setMinPitch(e.minPitch),void 0!==e.maxPitch&&this.transform.setMaxPitch(e.maxPitch),void 0!==e.renderWorldCopies&&this.transform.setRenderWorldCopies(e.renderWorldCopies),null!==e.transformConstrain&&this.transform.setConstrainOverride(e.transformConstrain),this._moving=!1,this._zooming=!1,this._bearingSnap=e.bearingSnap,this._zoomSnap=e.zoomSnap,this._requestRenderFrame=e.requestRenderFrame,this._cancelRenderFrame=e.cancelRenderFrame,this.terrain=e.terrain,this._centerClampedToGround=e.centerClampedToGround??!0,this.transformCameraUpdate=e.transformCameraUpdate??null,this._stopHandlers=e.stopHandlers??(()=>{}),this.on("moveend",()=>{delete this._requestedCameraState})}migrateProjection(e,t){if(e.apply(this.transform,!0),this.transform=e,this.cameraHelper=t,this._requestedCameraState){let t=e.clone();t.apply(this._requestedCameraState,!0),this._requestedCameraState=t}}getCenter(){return new Ex(this.transform.center.lng,this.transform.center.lat)}setCenter(e,t){return this.jumpTo({center:e},t)}getCenterElevation(){return this.transform.elevation}setCenterElevation(e,t){return this.jumpTo({elevation:e},t),this}getCenterClampedToGround(){return this._centerClampedToGround}setCenterClampedToGround(e){this._centerClampedToGround=e}panBy(e,t,i){return e=Hc.convert(e).mult(-1),this.panTo(this.transform.center,lh({offset:e},t),i)}panTo(e,t,i){return this.easeTo(lh({center:e},t),i)}getZoom(){return this.transform.zoom}setZoom(e,t){return this.jumpTo({zoom:e},t),this}zoomTo(e,t,i){return this.easeTo(lh({zoom:e},t),i)}zoomIn(e,t){return this.zoomTo(mh(this.getZoom()+1,this._zoomSnap),e,t),this}zoomOut(e,t){return this.zoomTo(mh(this.getZoom()-1,this._zoomSnap),e,t),this}getVerticalFieldOfView(){return this.transform.fov}setVerticalFieldOfView(e,t){return e!=this.transform.fov&&(this.transform.setFov(e),this.fire(new sC("movestart",t)).fire(new sC("move",t)).fire(new sC("moveend",t))),this}getBearing(){return this.transform.bearing}setZoomSnap(e){return this._zoomSnap=e,this}getZoomSnap(){return this._zoomSnap}setBearing(e,t){return this.jumpTo({bearing:e},t),this}getPadding(){return this.transform.padding}setPadding(e,t){return this.jumpTo({padding:e},t),this}rotateTo(e,t,i){return this.easeTo(lh({bearing:e},t),i)}resetNorth(e,t){return this.rotateTo(0,lh({duration:1e3},e),t),this}resetNorthPitch(e,t){return this.easeTo(lh({bearing:0,pitch:0,roll:0,duration:1e3},e),t),this}snapToNorth(e,t){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(e,t):this}getPitch(){return this.transform.pitch}setPitch(e,t){return this.jumpTo({pitch:e},t),this}getRoll(){return this.transform.roll}setRoll(e,t){return this.jumpTo({roll:e},t),this}cameraForBounds(e,t){e=gT.convert(e).adjustAntiMeridian();let i=t?.bearing||0;return this._cameraForBoxAndBearing(e.getNorthWest(),e.getSouthEast(),i,t)}_cameraForBoxAndBearing(e,t,i,n){let a={top:0,bottom:0,right:0,left:0};if("number"==typeof(n=lh({padding:a,offset:[0,0],maxZoom:this.transform.maxZoom},n)).padding){let e=n.padding;n.padding={top:e,bottom:e,right:e,left:e}}let r=lh(a,n.padding);n.padding=r;let s=this.transform,o=new gT(e,t),l=this.cameraHelper.cameraForBoxAndBearing(n,r,o,i,s);return l&&this._zoomSnap&&(l.zoom=mh(l.zoom,this._zoomSnap,-1)),l}fitBounds(e,t,i){return this._fitInternal(this.cameraForBounds(e,t),t,i)}fitScreenCoordinates(e,t,i,n,a){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.screenPointToLocation(Hc.convert(e)),this.transform.screenPointToLocation(Hc.convert(t)),i,n),n,a)}_fitInternal(e,t,i){return e?(delete(t=lh(e,t)).padding,t.linear?this.easeTo(t,i):this.flyTo(t,i)):this}jumpTo(e,t){this.stop(),void 0!==e.zoom&&this._zoomSnap&&(e.zoom=mh(e.zoom,this._zoomSnap));let i=this.getTransformForUpdate(),n=!1,a=!1,r=!1,s=i.zoom;this.terrain&&i.setElevation(this.terrain.getElevationForLngLat(e.center?Ex.convert(e.center):i.center,i)),this.cameraHelper.handleJumpToCenterZoom(i,e);let o=i.zoom!==s;return void 0!==e.elevation&&i.elevation!==+e.elevation&&i.setElevation(+e.elevation),void 0!==e.bearing&&i.bearing!==+e.bearing&&(n=!0,i.setBearing(+e.bearing)),void 0!==e.pitch&&i.pitch!==+e.pitch&&(a=!0,i.setPitch(+e.pitch)),void 0!==e.roll&&i.roll!==+e.roll&&(r=!0,i.setRoll(+e.roll)),null!=e.padding&&!i.isPaddingEqual(e.padding)&&i.setPadding(e.padding),this.applyUpdatedTransform(i),this.fire(new sC("movestart",t)).fire(new sC("move",t)),o&&this.fire(new sC("zoomstart",t)).fire(new sC("zoom",t)).fire(new sC("zoomend",t)),n&&this.fire(new sC("rotatestart",t)).fire(new sC("rotate",t)).fire(new sC("rotateend",t)),a&&this.fire(new sC("pitchstart",t)).fire(new sC("pitch",t)).fire(new sC("pitchend",t)),r&&this.fire(new sC("rollstart",t)).fire(new sC("roll",t)).fire(new sC("rollend",t)),this.fire(new sC("moveend",t))}calculateCameraOptionsFromCameraLngLatAltRotation(e,t,i,n,a){let r=this.transform.calculateCenterFromCameraLngLatAlt(e,t,i,n);return{center:r.center,elevation:r.elevation,zoom:r.zoom,bearing:i,pitch:n,roll:a}}easeTo(e,t){this._stop(!1,e.easeId),void 0!==(e=lh({offset:[0,0],duration:500,easing:rh},e)).zoom&&this._zoomSnap&&(e.zoom=mh(e.zoom,this._zoomSnap)),(!1===e.animate||!e.essential&&$M.prefersReducedMotion)&&(e.duration=0);let i,n,a=this.getTransformForUpdate(),r=this.getBearing(),s=a.pitch,o=a.roll,l=void 0===e.bearing?r:this._normalizeBearing(e.bearing,r),c=void 0===e.pitch?s:+e.pitch,u=void 0===e.roll?o:this._normalizeBearing(e.roll,o),h=void 0===e.padding?a.padding:e.padding,d=Hc.convert(e.offset);e.around&&(i=Ex.convert(e.around),n=a.locationToScreenPoint(i));let p={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching,rolling:this._rolling},m=this.cameraHelper.handleEaseTo(a,{bearing:l,pitch:c,roll:u,padding:h,around:i,aroundPoint:n,offsetAsPoint:d,offset:e.offset,zoom:e.zoom,center:e.center});return this._rotating||=r!==l,this._pitching||=c!==s,this._rolling||=u!==o,this._padding=!a.isPaddingEqual(h),this._zooming||=m.isZooming,this._easeId=e.easeId,this._prepareEase(t,e.noMoveStart,p),this.terrain&&this._prepareElevation(m.elevationCenter),this._ease(i=>{m.easeFunc(i),this.terrain&&!e.freezeElevation&&this._updateElevation(i),this.applyUpdatedTransform(a),this._fireMoveEvents(t)},i=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(t,i)},e),this}_prepareEase(e,t,i={}){this._moving=!0,!t&&!i.moving&&this.fire(new sC("movestart",e)),this._zooming&&!i.zooming&&this.fire(new sC("zoomstart",e)),this._rotating&&!i.rotating&&this.fire(new sC("rotatestart",e)),this._pitching&&!i.pitching&&this.fire(new sC("pitchstart",e)),this._rolling&&!i.rolling&&this.fire(new sC("rollstart",e))}_prepareElevation(e){this._elevationCenter=e,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLat(e,this.transform),this.elevationFreeze=!0}_updateElevation(e){(void 0===this._elevationStart||void 0===this._elevationCenter)&&this._prepareElevation(this.transform.center),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom));let t=this.terrain.getElevationForLngLat(this._elevationCenter,this.transform);if(e<1&&t!==this._elevationTarget){let i=this._elevationTarget-this._elevationStart,n=(t-(i*e+this._elevationStart))/(1-e);this._elevationStart+=e*(i-n),this._elevationTarget=t}this.transform.setElevation(Ep.number(this._elevationStart,this._elevationTarget,e))}_finalizeElevation(){this.elevationFreeze=!1,this.getCenterClampedToGround()&&this.transform.recalculateZoomAndCenter(this.terrain)}getTransformForUpdate(){return this.transformCameraUpdate||this.terrain?(this._requestedCameraState||=this.transform.clone(),this._requestedCameraState):this.transform}_elevateCameraIfInsideTerrain(e){if(!this.terrain&&e.elevation>=0&&e.pitch<=90)return{};let t=e.getCameraLngLat(),i=e.getCameraAltitude(),n=this.terrain?this.terrain.getElevationForLngLatZoom(t,e.zoom):0;if(i<n){let i=e.calculateCameraOptionsFromTo(t,n,e.center,e.elevation);return{pitch:i.pitch,zoom:i.zoom}}return{}}applyUpdatedTransform(e){let t=[];if(t.push(e=>this._elevateCameraIfInsideTerrain(e)),this.transformCameraUpdate&&t.push(e=>this.transformCameraUpdate(e)),!t.length)return;let i=e.clone();for(let e of t){let t=i.clone(),{center:n,zoom:a,roll:r,pitch:s,bearing:o,elevation:l}=e(t);n&&t.setCenter(n),void 0!==l&&t.setElevation(l),void 0!==a&&t.setZoom(a),void 0!==r&&t.setRoll(r),void 0!==s&&t.setPitch(s),void 0!==o&&t.setBearing(o),i.apply(t,!1)}this.transform.apply(i,!1)}_fireMoveEvents(e){this.fire(new sC("move",e)),this._zooming&&this.fire(new sC("zoom",e)),this._rotating&&this.fire(new sC("rotate",e)),this._pitching&&this.fire(new sC("pitch",e)),this._rolling&&this.fire(new sC("roll",e))}_afterEase(e,t){if(this._easeId&&t&&this._easeId===t)return;delete this._easeId;let i=this._zooming,n=this._rotating,a=this._pitching,r=this._rolling;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._rolling=!1,this._padding=!1,i&&this.fire(new sC("zoomend",e)),n&&this.fire(new sC("rotateend",e)),a&&this.fire(new sC("pitchend",e)),r&&this.fire(new sC("rollend",e)),this.fire(new sC("moveend",e))}flyTo(e,t){if(!e.essential&&$M.prefersReducedMotion){let i=ch(e,["center","zoom","bearing","pitch","roll","elevation","padding"]);return this.jumpTo(i,t)}this.stop(),void 0!==(e=lh({offset:[0,0],speed:1.2,curve:1.42,easing:rh},e)).zoom&&this._zoomSnap&&(e.zoom=mh(e.zoom,this._zoomSnap));let i=this.getTransformForUpdate(),n=i.bearing,a=i.pitch,r=i.roll,s=i.padding,o=void 0===e.bearing?n:this._normalizeBearing(e.bearing,n),l=void 0===e.pitch?a:+e.pitch,c=void 0===e.roll?r:this._normalizeBearing(e.roll,r),u=void 0===e.padding?i.padding:e.padding,h=Hc.convert(e.offset),d=i.centerPoint.add(h),p=i.screenPointToLocation(d),m=this.cameraHelper.handleFlyTo(i,{bearing:o,pitch:l,roll:c,padding:u,locationAtOffset:p,offsetAsPoint:h,center:e.center,minZoom:e.minZoom,zoom:e.zoom}),g=e.curve,f=Math.max(i.width,i.height),A=f/m.scaleOfZoom,_=m.pixelPathLength,v=f/m.scaleOfMinZoom;g=Math.min(g,Math.sqrt(v/_*2));let y=g*g;function x(e){let t=(A*A-f*f+(e?-1:1)*y*y*_*_)/(2*(e?A:f)*y*_);return Math.log(Math.sqrt(t*t+1)-t)}function b(e){return(Math.exp(e)-Math.exp(-e))/2}function w(e){return(Math.exp(e)+Math.exp(-e))/2}let E=x(!1),k=function(e){return w(E)/w(E+g*e)},S=function(e){return f*((w(E)*function(e){return b(e)/w(e)}(E+g*e)-b(E))/y)/_},M=(x(!0)-E)/g;if(Math.abs(_)<2e-6||!isFinite(M)){if(Math.abs(f-A)<1e-6)return this.easeTo(e,t);let i=A<f?-1:1;M=Math.abs(Math.log(A/f))/g,S=()=>0,k=e=>Math.exp(i*g*e)}if(void 0!==e.duration)e.duration=+e.duration;else{let t=void 0===e.screenSpeed?+e.speed:+e.screenSpeed/g;e.duration=1e3*M/t}return e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=n!==o,this._pitching=l!==a,this._rolling=c!==r,this._padding=!i.isPaddingEqual(u),this._prepareEase(t,!1),this.terrain&&this._prepareElevation(m.targetCenter),this._ease(p=>{let g=p*M,f=1/k(g),A=S(g);this._rotating&&i.setBearing(Ep.number(n,o,p)),this._pitching&&i.setPitch(Ep.number(a,l,p)),this._rolling&&i.setRoll(Ep.number(r,c,p)),this._padding&&(i.interpolatePadding(s,u,p),d=i.centerPoint.add(h)),m.easeFunc(p,f,A,d),this.terrain&&!e.freezeElevation&&this._updateElevation(p),this.applyUpdatedTransform(i),this._fireMoveEvents(t)},()=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(t)},e),this}isEasing(){return!!this._easeFrameId}stop(e){return this._stop(e)}_stop(e,t){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){let e=this._onEaseEnd;delete this._onEaseEnd,e.call(this,t)}return e||this._stopHandlers(),this}_ease(e,t,i){!1===i.animate||0===i.duration?(e(1),t()):(this._easeStart=tC(),this._easeOptions=i,this._onEaseFrame=e,this._onEaseEnd=t,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(e,t){e=oh(e,-180,180);let i=Math.abs(e-t);return Math.abs(e-360-t)<i&&(e-=360),Math.abs(e+360-t)<i&&(e+=360),e}isMoving(){return this._moving}isZooming(){return this._zooming}isRotating(){return this._rotating}};const XR={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};var QR=class{constructor(e=XR){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=e=>{e&&("terrain"===e.type||"style"===e.dataType||"source"===e.dataType&&("metadata"===e.sourceDataType||"visibility"===e.sourceDataType))&&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=e}getDefaultPosition(){return"bottom-right"}onAdd(e){return this._map=e,this._compact=this.options.compact,this._container=iC.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=iC.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=iC.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(){this._container.remove(),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(e,t){let i=this._map._getUIString(`AttributionControl.${t}`);e.title=i,e.setAttribute("aria-label",i)}_updateAttributions(){if(!this._map.style)return;let e=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?e=e.concat(this.options.customAttribution.map(e=>"string"==typeof e?e:"")):"string"==typeof this.options.customAttribution&&e.push(this.options.customAttribution)),this._map.style.stylesheet){let e=this._map.style.stylesheet;this.styleOwner=e.owner,this.styleId=e.id}let t=this._map.style.tileManagers;for(let i in t){let n=t[i];if(n.used||n.usedForTerrain){let t=n.getSource();t.attribution&&!e.includes(t.attribution)&&e.push(t.attribution)}}e=e.filter(e=>String(e).trim()),e.sort((e,t)=>e.length-t.length),e=e.filter((t,i)=>{for(let n=i+1;n<e.length;n++)if(e[n].includes(t))return!1;return!0});let i=e.join(" | ");i!==this._attribHTML&&(this._attribHTML=i,e.length?(this._innerContainer.innerHTML=iC.sanitize(i),this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}},YR=class{constructor(e={}){this._updateCompact=()=>{let e=this._container.children;if(e.length){let t=e[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?!1!==this._compact&&t.classList.add("maplibregl-compact"):t.classList.remove("maplibregl-compact")}},this.options=e}getDefaultPosition(){return"bottom-left"}onAdd(e){this._map=e,this._compact=this.options?.compact,this._container=iC.create("div","maplibregl-ctrl");let t=iC.create("a","maplibregl-ctrl-logo");return t.target="_blank",t.rel="noopener nofollow",t.href="https://maplibre.org/",t.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),t.setAttribute("rel","noopener nofollow"),this._container.appendChild(t),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){this._container.remove(),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}},JR=class{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(e){let t=++this._id;return this._queue.push({callback:e,id:t,cancelled:!1}),t}remove(e){let t=this._currentlyRunning,i=t?this._queue.concat(t):this._queue;for(let t of i)if(t.id===e)return void(t.cancelled=!0)}run(e=0){if(this._currentlyRunning)throw Error("Attempting to run(), but is already running.");let t=this._currentlyRunning=this._queue;this._queue=[];let i,n=!1;for(let a of t)if(!a.cancelled){try{a.callback(e)}catch(e){n||(n=!0,i=e)}if(this._cleared)break}if(this._cleared=!1,this._currentlyRunning=!1,n)throw i}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}};const $R=["none","zoom","sourceTiles","visibleLayers","revision"];var eL=class{constructor(e,t,i,n){this._tileKeys=e.map(e=>e.key).sort().join(),this._revision=t,this._zoom=i,this._visibleLayerIds=n}difference(e){return this._revision===e?._revision?this._visibleLayerIds===e._visibleLayerIds?this._tileKeys===e._tileKeys?this._zoom===e._zoom?"none":"zoom":"sourceTiles":"visibleLayers":"revision"}};const tL={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0,"color-relief":!0};var iL=class{constructor(e,t){this.needsFollowUpFrame=!1,this.painter=e,this.terrain=t,this.rttSize=t.tileManager.tileSize*t.qualityFactor}getTexture(e){return e.getRTT(this._stacks.length-1).texture}prepareForRender(e,t){let i=t!==this._lastPrepareZoom;this._lastPrepareZoom=t,this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.tileManager.getRenderableTiles(),this._renderableLayerIds=e._order.filter(i=>!e._layers[i].isHidden(t));let n=this._renderableLayerIds.join(),a=new Set;for(let t of this._renderableLayerIds){let i=e._layers[t],n=i.source;n&&tL[i.type]&&a.add(n)}this._coordsAscending={},this._rttFingerprints={};for(let i of a){let a=e.tileManagers[i];if(!a)continue;this._coordsAscending[i]={};let r=this._coordsAscending[i],s=a.getSource(),o=s instanceof LT?s.terrainTileRanges:null;for(let e of a.getVisibleCoordinates()){let t=this.terrain.tileManager.getTerrainCoords(e,o);for(let e in t)r[e]||=[],r[e].push(t[e])}this._rttFingerprints[i]={};let l=this._rttFingerprints[i],c=a.getState().revision;for(let e in r)l[e]=new eL(r[e],c,t,n)}this.needsFollowUpFrame=!1;let r=i||this.painter.options.moving,s=!1;for(let e of this._renderableTiles){let t=this._textureDifference(e);"none"!==t&&("zoom"===t&&r||"visibleLayers"===t&&i?this.needsFollowUpFrame=!0:"zoom"===t||"sourceTiles"===t?(s?this.needsFollowUpFrame=!0:e.releaseRTT(this.painter),s=!0):e.releaseRTT(this.painter))}}_textureDifference(e){let t="none";for(let i in this._rttFingerprints){let n=this._rttFingerprints[i][e.tileID.key];if(!n)continue;let a=n.difference(e.rttFingerprint[i]);$R.indexOf(a)>$R.indexOf(t)&&(t=a)}return t}renderLayer(e,t){if(e.isHidden(this.painter.transform.zoom))return!1;let i={...t,isRenderingToTexture:!0},n=e.type,a=this.painter,r=this._renderableLayerIds[this._renderableLayerIds.length-1]===e.id;if(tL[n]&&((!this._prevType||!tL[this._prevType])&&this._stacks.push([]),this._prevType=n,this._stacks[this._stacks.length-1].push(e.id),!r))return!0;if(tL[this._prevType]||tL[n]&&r){this._prevType=n;let e=this._stacks.length-1,t=this._stacks[e]||[];for(let n of this._renderableTiles){if(this._rttTiles.push(n),n.getRTT(e))continue;let r=n.acquireRTT(a,e,this.rttSize);a.bindRTT(r),a.context.clear({color:ep.transparent,stencil:0}),a.currentStencilSource=void 0;for(let e of t){let t=a.style._layers[e],r=t.source?this._coordsAscending[t.source][n.tileID.key]:[n.tileID];a.context.viewport.set([0,0,this.rttSize,this.rttSize]),a.renderTileClippingMasks(t,r,!0),a.renderLayer(a,a.style.tileManagers[t.source],t,r,i),t.source&&(n.rttFingerprint[t.source]=this._rttFingerprints[t.source][n.tileID.key])}r.texture.generateMipmap()}return function(e,t,i,n){let{isRenderingGlobe:a}=n,r=e.context,s=r.gl,o=e.transform,l=e.colorModeForRenderPass(),c=e.getDepthModeFor3D(),u=e.useProgram("terrain");r.bindFramebuffer.set(null),r.viewport.set([0,0,e.width,e.height]);for(let n of i){let i=t.getTerrainMesh(n.tileID),h=e.renderToTexture.getTexture(n),d=t.getTerrainData(n.tileID);r.activeTexture.set(s.TEXTURE0),h.bind(s.LINEAR,s.CLAMP_TO_EDGE,s.LINEAR_MIPMAP_LINEAR);let p=t.getSkirtLength(o.zoom),m=o.calculateFogMatrix(n.tileID.toUnwrapped()),g=wI(p,m,e.style.sky,o.pitch,a),f=o.getProjectionData({overscaledTileID:n.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});u.draw(r,s.TRIANGLES,c,iz.disabled,l,az.backCCW,g,d,f,"terrain",i.vertexBuffer,i.indexBuffer,i.segments)}}(this.painter,this.terrain,this._rttTiles,i),this._rttTiles=[],tL[n]}return!1}};const nL={"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":"Drag to rotate map, click to reset 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"},aL={hash:!1,interactive:!0,bearingSnap:7,zoomSnap:0,attributionControl:XR,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:Vh.MAX_TILE_CACHE_ZOOM_LEVELS,transformRequest:null,transformCameraUpdate:null,transformConstrain:null,fadeDuration:300,crossSourceCollisions:!0,clickTolerance:3,localIdeographFontFamily:"sans-serif",pitchWithRotate:!0,rollEnabled:!1,rotateSpeed:.8,pitchSpeed:-.5,reduceMotion:void 0,validateStyle:!0,maxCanvasSize:[4096,4096],cancelPendingTileRequestsWhileZooming:!0,centerClampedToGround:!0,terrainSkirtLength:"auto",zoomLevelsToOverscale:4,anisotropicFilterPitch:20};var rL=class extends id{get _ownerWindow(){return this._container?.ownerDocument?.defaultView||window}constructor(e){super(),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new JR,this._controls=[],this._mapId=hh(),this._styleUrl=null,this._missingStyleImageResolver=null,this._lostContextStyle={style:null,images:null},this._contextLost=e=>{if(e.preventDefault(),this._frameRequest&&=(this._frameRequest.abort(),null),this.painter.destroy(),this._lostContextStyle=this._getStyleAndImages(),this.style){for(let e of Object.values(this.style._layers))if("custom"===e.type&&console.warn(`Custom layer with id '${e.id}' cannot be restored after WebGL context loss. You will need to re-add it manually after context restoration.`),e._listeners)for(let[t]of Object.entries(e._listeners))console.warn(`Custom layer with id '${e.id}' had event listeners for event '${t}' which cannot be restored after WebGL context loss. You will need to re-add them manually after context restoration.`);this.style.destroy(),this.style=null,this.fire(new fC("webglcontextlost",{originalEvent:e}))}else this.fire(new fC("webglcontextlost",{originalEvent:e}))},this._contextRestored=e=>{if(this._lostContextStyle.style&&this.setStyle(this._lostContextStyle.style,{diff:!1}),this._lostContextStyle.images&&this.style){this.style.imageManager.images=this._lostContextStyle.images;for(let e in this._lostContextStyle.images){let t=this._lostContextStyle.images[e];t.isWebGLImage&&this.style.imageManager.updateImage(e,t,!1)}}this._lostContextStyle={style:null,images:null};try{this._setupPainter()}catch(e){return void this.fire(new td(e))}this.resize(),this._update(),this._resizeInternal(),this.fire(new fC("webglcontextrestored",{originalEvent:e}))},this._onMapScroll=e=>{if(e.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()};let t={...aL,...e,canvasContextAttributes:{...aL.canvasContextAttributes,...e.canvasContextAttributes}};if(null!=t.minZoom&&null!=t.maxZoom&&t.minZoom>t.maxZoom)throw Error("maxZoom must be greater than or equal to minZoom");if(null!=t.minPitch&&null!=t.maxPitch&&t.minPitch>t.maxPitch)throw Error("maxPitch must be greater than or equal to minPitch");if(null!=t.minPitch&&t.minPitch<0)throw Error("minPitch must be greater than or equal to 0");if(null!=t.maxPitch&&t.maxPitch>180)throw Error("maxPitch must be less than or equal to 180");this._camera=new KR({minZoom:t.minZoom,maxZoom:t.maxZoom,minPitch:t.minPitch,maxPitch:t.maxPitch,bearingSnap:t.bearingSnap,zoomSnap:t.zoomSnap,renderWorldCopies:t.renderWorldCopies,centerClampedToGround:t.centerClampedToGround,terrain:this.terrain,transformConstrain:t.transformConstrain,requestRenderFrame:e=>this._requestRenderFrame(e),cancelRenderFrame:e=>this._cancelRenderFrame(e),transformCameraUpdate:t.transformCameraUpdate,stopHandlers:()=>this._handlers?.stop(!1)}),this._camera.setEventedParent(this),this._interactive=t.interactive,this._maxTileCacheSize=t.maxTileCacheSize,this._maxTileCacheZoomLevels=t.maxTileCacheZoomLevels,this._canvasContextAttributes={...t.canvasContextAttributes},this._trackResize=!0===t.trackResize,this._terrainSkirtLength=t.terrainSkirtLength,this._refreshExpiredTiles=!0===t.refreshExpiredTiles,this._fadeDuration=t.fadeDuration,this._crossSourceCollisions=!0===t.crossSourceCollisions,this._collectResourceTiming=!0===t.collectResourceTiming,this._locale={...nL,...t.locale},this._clickTolerance=t.clickTolerance,this._overridePixelRatio=t.pixelRatio,this._maxCanvasSize=t.maxCanvasSize,this._zoomLevelsToOverscale=t.zoomLevelsToOverscale,this.cancelPendingTileRequestsWhileZooming=!0===t.cancelPendingTileRequestsWhileZooming,this.setAnisotropicFilterPitch(t.anisotropicFilterPitch),void 0!==t.reduceMotion&&($M.prefersReducedMotion=t.reduceMotion),this._requestManager=new aC(t.transformRequest),this._container=this._resolveContainer(t.container),t.maxBounds&&this.setMaxBounds(t.maxBounds),this._setupContainer();try{this._setupPainter()}catch(e){throw this._cleanupContainer(),e}this._imageQueueHandle=nC.addThrottleControl(()=>this.isMoving()),this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this.on("terrain",()=>{this.painter.terrainFacilitator.depthDirty=!0,this._update(!0)}),this.once("idle",()=>this._idleTriggered=!0),this._handlers=new ZR(this,this._camera,t),typeof window<"u"&&(this._ownerWindow.addEventListener("online",this._onWindowOnline,!1),this._setupResizeObserver());let i="string"==typeof t.hash&&t.hash||void 0;this._hash=t.hash?new $z(i).addTo(this):void 0,this._hash?._onHashChange()||(this.jumpTo({center:t.center,elevation:t.elevation,zoom:t.zoom,bearing:t.bearing,pitch:t.pitch,roll:t.roll}),t.bounds&&(this.resize(),this.fitBounds(t.bounds,lh({},t.fitBoundsOptions,{duration:0}))));let n="string"==typeof t.style||"globe"!==t.style?.projection?.type;this.resize(null,n),this._localIdeographFontFamily=t.localIdeographFontFamily,this._validateStyle=t.validateStyle,t.style&&this.setStyle(t.style,{localIdeographFontFamily:t.localIdeographFontFamily}),t.attributionControl&&this.addControl(new QR("boolean"==typeof t.attributionControl?void 0:t.attributionControl)),t.maplibreLogo&&this.addControl(new YR,t.logoPosition),this.on("style.load",()=>{if(n||this._resizeTransform(),this._camera.transform.unmodified){let e=ch(this.style.stylesheet,["center","zoom","bearing","pitch","roll"]);this.jumpTo(e)}}),this.on("data",e=>{this._update("style"===e.dataType),this.fire("style"===e.dataType?new lC("styledata",e):new cC("sourcedata",e))}),this.on("dataloading",e=>{this.fire("style"===e.dataType?new lC("styledataloading",e):new cC("sourcedataloading",e))}),this.on("dataabort",e=>{this.fire(new cC("sourcedataabort",e))})}_getMapId(){return this._mapId}setGlobalStateProperty(e,t){return this.style.setGlobalStateProperty(e,t),this._update(!0)}getGlobalState(){return this.style.getGlobalState()}addControl(e,t){if(void 0===t&&(t=e.getDefaultPosition?e.getDefaultPosition():"top-right"),!e?.onAdd)return this.fire(new td(Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));let i=e.onAdd(this);this._controls.push(e);let n=this._controlPositions[t];return t.includes("bottom")?n.insertBefore(i,n.firstChild):n.appendChild(i),this}removeControl(e){if(!e?.onRemove)return this.fire(new td(Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));let t=this._controls.indexOf(e);return t>-1&&this._controls.splice(t,1),e.onRemove(this),this}hasControl(e){return this._controls.includes(e)}coveringTiles(e){return iD(this._camera.transform,e)}setTransformCameraUpdate(e){this._camera.transformCameraUpdate=e}getCenter(){return new Ex(this._camera.transform.center.lng,this._camera.transform.center.lat)}setCenter(e,t){return this._camera.setCenter(e,t),this}getCenterElevation(){return this._camera.transform.elevation}setCenterElevation(e,t){return this._camera.setCenterElevation(e,t),this}setCenterClampedToGround(e){this._camera.setCenterClampedToGround(e)}panBy(e,t,i){return this._camera.panBy(e,t,i),this}panTo(e,t,i){return this._camera.panTo(e,t,i),this}getZoom(){return this._camera.transform.zoom}setZoom(e,t){return this._camera.setZoom(e,t),this}zoomTo(e,t,i){return this._camera.zoomTo(e,t,i),this}zoomIn(e,t){return this._camera.zoomIn(e,t),this}zoomOut(e,t){return this._camera.zoomOut(e,t),this}getVerticalFieldOfView(){return this._camera.transform.fov}setVerticalFieldOfView(e,t){return this._camera.setVerticalFieldOfView(e,t),this}getBearing(){return this._camera.transform.bearing}setBearing(e,t){return this._camera.setBearing(e,t),this}getZoomSnap(){return this._camera.getZoomSnap()}setZoomSnap(e){return this._camera.setZoomSnap(e),this}getPadding(){return this._camera.transform.padding}setPadding(e,t){return this._camera.setPadding(e,t),this}rotateTo(e,t,i){return this._camera.rotateTo(e,t,i),this}resetNorth(e,t){return this._camera.resetNorth(e,t),this}resetNorthPitch(e,t){return this._camera.resetNorthPitch(e,t),this}snapToNorth(e,t){return this._camera.snapToNorth(e,t),this}getPitch(){return this._camera.transform.pitch}setPitch(e,t){return this._camera.setPitch(e,t),this}getRoll(){return this._camera.transform.roll}setRoll(e,t){return this._camera.setRoll(e,t),this}cameraForBounds(e,t){return this._camera.cameraForBounds(e,t)}fitBounds(e,t,i){return this._camera.fitBounds(e,t,i),this}fitScreenCoordinates(e,t,i,n,a){return this._camera.fitScreenCoordinates(e,t,i,n,a),this}jumpTo(e,t){return this._camera.jumpTo(e,t),this}calculateCameraOptionsFromCameraLngLatAltRotation(e,t,i,n,a){return this._camera.calculateCameraOptionsFromCameraLngLatAltRotation(e,t,i,n,a)}easeTo(e,t){return this._camera.easeTo(e,t),this}flyTo(e,t){return this._camera.flyTo(e,t),this}stop(){return this._camera.stop(),this}queryTerrainElevation(e){return this.terrain?this.terrain.getElevationForLngLat(Ex.convert(e),this._camera.transform):null}getCenterClampedToGround(){return this._camera.getCenterClampedToGround()}calculateCameraOptionsFromTo(e,t,i,n){return null==n&&this.terrain&&(n=this.terrain.getElevationForLngLat(i,this._camera.transform)),this._camera.transform.calculateCameraOptionsFromTo(e,t,i,n??0)}resize(e,t=!0){if(null!==this._lostContextStyle.style)return this;this._resizeInternal(t);let i=!this._camera._moving;return i&&(this.stop(),this.fire(new sC("movestart",e)).fire(new sC("move",e))),this.fire(new rC("resize",e)),i&&this.fire(new sC("moveend",e)),this}_resizeInternal(e=!0){let[t,i]=this._containerDimensions(),n=this._getClampedPixelRatio(t,i);if(this._resizeCanvas(t,i,n),this.painter.resize(t,i,n),this.painter.overLimit()){let e=this.painter.context.gl;this._maxCanvasSize=[e.drawingBufferWidth,e.drawingBufferHeight];let n=this._getClampedPixelRatio(t,i);this._resizeCanvas(t,i,n),this.painter.resize(t,i,n)}this._resizeTransform(e)}_resizeTransform(e=!0){let[t,i]=this._containerDimensions();this._camera.transform.resize(t,i,e),this._camera._requestedCameraState?.resize(t,i,e)}_getClampedPixelRatio(e,t){let{0:i,1:n}=this._maxCanvasSize,a=this.getPixelRatio(),r=e*a,s=t*a,o=r>i?i/r:1,l=s>n?n/s:1,c=Math.min(o,l);return c<1&&yh("The canvas is larger than maxCanvasSize and is rendered at a lower pixel ratio to fit. Increase maxCanvasSize, within MAX_TEXTURE_SIZE, to render at full resolution."),c*a}getPixelRatio(){return this._overridePixelRatio??devicePixelRatio}setPixelRatio(e){this._overridePixelRatio=e,this.resize()}getBounds(){return this._camera.transform.getBounds()}getMaxBounds(){return this._camera.transform.getMaxBounds()}setMaxBounds(e){return this._camera.transform.setMaxBounds(gT.convert(e)),this._update()}setMinZoom(e){if(e??=-2,e>=-2&&e<=this._camera.transform.maxZoom){let t=this._camera.transform.zoom,i=this._camera.getTransformForUpdate();return i.setMinZoom(e),this._camera.applyUpdatedTransform(i),this._update(),t!==this._camera.transform.zoom&&this.fire(new sC("zoomstart")).fire(new sC("zoom")).fire(new sC("zoomend")).fire(new sC("movestart")).fire(new sC("move")).fire(new sC("moveend")),this}throw Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(e=!1){let t=this._camera.transform;return e?t.applyConstrain(t.center,t.minZoom).zoom:t.minZoom}setMaxZoom(e){if(e??=22,e>=this._camera.transform.minZoom){let t=this._camera.transform.zoom,i=this._camera.getTransformForUpdate();return i.setMaxZoom(e),this._camera.applyUpdatedTransform(i),this._update(),t!==this._camera.transform.zoom&&this.fire(new sC("zoomstart")).fire(new sC("zoom")).fire(new sC("zoomend")).fire(new sC("movestart")).fire(new sC("move")).fire(new sC("moveend")),this}throw Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this._camera.transform.maxZoom}setMinPitch(e){if(e??=0,e<0)throw Error("minPitch must be greater than or equal to 0");if(e>=0&&e<=this._camera.transform.maxPitch){let t=this._camera.transform.pitch,i=this._camera.getTransformForUpdate();return i.setMinPitch(e),this._camera.applyUpdatedTransform(i),this._update(),t!==this._camera.transform.pitch&&this.fire(new sC("pitchstart")).fire(new sC("pitch")).fire(new sC("pitchend")).fire(new sC("movestart")).fire(new sC("move")).fire(new sC("moveend")),this}throw Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this._camera.transform.minPitch}setMaxPitch(e){if(e??=60,e>180)throw Error("maxPitch must be less than or equal to 180");if(e>=this._camera.transform.minPitch){let t=this._camera.transform.pitch,i=this._camera.getTransformForUpdate();return i.setMaxPitch(e),this._camera.applyUpdatedTransform(i),this._update(),t!==this._camera.transform.pitch&&this.fire(new sC("pitchstart")).fire(new sC("pitch")).fire(new sC("pitchend")).fire(new sC("movestart")).fire(new sC("move")).fire(new sC("moveend")),this}throw Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this._camera.transform.maxPitch}getAnisotropicFilterPitch(){return this._anisotropicFilterPitch}setAnisotropicFilterPitch(e){if(e??=20,e>180)throw Error("anisotropicFilterPitch must be less than or equal to 180");if(e<0)throw Error("anisotropicFilterPitch must be greater than or equal to 0");return this._anisotropicFilterPitch=e,this._update()}getRenderWorldCopies(){return this._camera.transform.renderWorldCopies}setRenderWorldCopies(e){return this._camera.transform.setRenderWorldCopies(e),this._update()}setTransformConstrain(e){return this._camera.transform.setConstrainOverride(e),this._update()}project(e){return this._camera.transform.locationToScreenPoint(Ex.convert(e),this.style&&this.terrain)}unproject(e){return this._camera.transform.screenPointToLocation(Hc.convert(e),this.terrain)}isMoving(){return this._camera.isMoving()||this._handlers?.isMoving()||!1}isZooming(){return this._camera.isZooming()||this._handlers?.isZooming()||!1}isRotating(){return this._camera.isRotating()||this._handlers?.isRotating()||!1}_createDelegatedListener(e,t,i){if("mouseenter"===e||"mouseover"===e){let n=!1;return{layers:t,listener:i,delegates:{mousemove:a=>{let r=t.filter(e=>this.getLayer(e)),s=0===r.length?[]:this.queryRenderedFeatures(a.point,{layers:r});s.length?n||(n=!0,i.call(this,new uC(e,this,a.originalEvent,{features:s}))):n=!1},mouseout:()=>{n=!1}}}}if("mouseleave"===e||"mouseout"===e){let n=!1;return{layers:t,listener:i,delegates:{mousemove:a=>{let r=t.filter(e=>this.getLayer(e));(0===r.length?[]:this.queryRenderedFeatures(a.point,{layers:r})).length?n=!0:n&&(n=!1,i.call(this,new uC(e,this,a.originalEvent)))},mouseout:t=>{n&&(n=!1,i.call(this,new uC(e,this,t.originalEvent)))}}}}{let n=e=>{let n=t.filter(e=>this.getLayer(e)),a=0===n.length?[]:this.queryRenderedFeatures(e.point,{layers:n});a.length&&(e.features=a,i.call(this,e),delete e.features)};return{layers:t,listener:i,delegates:{[e]:n}}}}_saveDelegatedListener(e,t){this._delegatedListeners||={},this._delegatedListeners[e]||=[],this._delegatedListeners[e].push(t)}_removeDelegatedListener(e,t,i){if(!this._delegatedListeners?.[e])return;let n=this._delegatedListeners[e];for(let e=0;e<n.length;e++){let a=n[e];if(a.listener===i&&a.layers.length===t.length&&a.layers.every(e=>t.includes(e))){for(let e in a.delegates)this.off(e,a.delegates[e]);return void n.splice(e,1)}}}on(e,t,i){if(void 0===i)return super.on(e,t);let n="string"==typeof t?[t]:t,a=this._createDelegatedListener(e,n,i);this._saveDelegatedListener(e,a);for(let e in a.delegates)this.on(e,a.delegates[e]);return{unsubscribe:()=>{this._removeDelegatedListener(e,n,i)}}}once(e,t,i){if(void 0===i)return super.once(e,t);let n="string"==typeof t?[t]:t,a=this._createDelegatedListener(e,n,i);for(let t in a.delegates){let r=a.delegates[t];a.delegates[t]=(...t)=>{this._removeDelegatedListener(e,n,i),r(...t)}}this._saveDelegatedListener(e,a);for(let e in a.delegates)this.once(e,a.delegates[e]);return this}off(e,t,i){if(void 0===i)return super.off(e,t);let n="string"==typeof t?[t]:t;return this._removeDelegatedListener(e,n,i),this}queryRenderedFeatures(e,t){if(!this.style)return[];let i,n=e instanceof Hc||Array.isArray(e),a=n?e:[[0,0],[this._camera.transform.width,this._camera.transform.height]];if(t||=(n?{}:e)||{},a instanceof Hc||"number"==typeof a[0])i=[Hc.convert(a)];else{let e=Hc.convert(a[0]),t=Hc.convert(a[1]);i=[e,new Hc(t.x,e.y),t,new Hc(e.x,t.y),e]}return this.style.queryRenderedFeatures(i,t,this._camera.transform)}querySourceFeatures(e,t){return this.style.querySourceFeatures(e,t)}setStyle(e,t){return t=lh({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},t),this._styleUrl="string"==typeof e?e:null,!1!==t.diff&&t.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&e?(this._diffStyle(e,t),this):(this._localIdeographFontFamily=t.localIdeographFontFamily,this._updateStyle(e,t))}setTransformRequest(e){return this._requestManager.setTransformRequest(e),this}_getUIString(e){let t=this._locale[e];if(null==t)throw Error(`Missing UI string '${e}'`);return t}_updateStyle(e,t){if(this._diffStyleRequest?.abort(),this._diffStyleRequest=null,t.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",()=>this._updateStyle(e,t));let i=this.style&&t.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!e)),e?(this.style=new yI(this,t||{}),this.style.setEventedParent(this,{style:this.style}),"string"==typeof e?this.style.loadURL(e,t,i):this.style.loadJSON(e,t,i),this):(this._frameRequest&&=(this._frameRequest.abort(),null),this.style?.projection?.destroy(),delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new yI(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}async _diffStyle(e,t){if(this._diffStyleRequest?.abort(),"string"==typeof e){let i=e;this._diffStyleRequest=new AbortController;let n=this._diffStyleRequest;try{let e=await this._requestManager.transformRequest(i,"Style");if(n.signal.aborted)return void(this._diffStyleRequest=null);let a=await Xh(e,n);this._diffStyleRequest=null,this._updateDiff(a.data,t)}catch(e){this._diffStyleRequest=null,Nh(e)||this.fire(new td(ju(e)))}}else"object"==typeof e&&(this._diffStyleRequest=null,this._updateDiff(e,t))}_updateDiff(e,t){try{this.style.setState(e,t)&&this._update(!0)}catch(i){yh(`Unable to perform style diff: ${ju(i).message}. Rebuilding the style from scratch.`),this._updateStyle(e,t)}}getStyle(){if(this.style)return this.style.serialize()}getStyleUrl(){return this._styleUrl}_getStyleAndImages(){return this.style?{style:this.style.serialize(),images:this.style.imageManager.cloneImages()}:{style:null,images:{}}}isStyleLoaded(){if(this.style)return this.style.loaded();yh("There is no style added to the map.")}addSource(e,t){return this._lazyInitEmptyStyle(),this.style.addSource(e,t),this._update(!0)}isSourceLoaded(e){let t=this.style?.tileManagers[e];if(void 0!==t)return t.loaded();this.fire(new td(Error(`There is no tile manager with ID '${e}'`)))}setTerrain(e,t={}){if(this.style._checkLoaded(),e&&Bf(this,Ff.terrain,{value:e},t))return this;if(this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),e){let t=this.style.tileManagers[e.source];if(!t)throw Error(`cannot load terrain, because there exists no source with ID: ${e.source}`);null===this.terrain&&t.reload();for(let t in this.style._layers){let i=this.style._layers[t];"hillshade"===i.type&&i.source===e.source&&yh("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===e.source&&yh("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&&this.terrain.destroy(),this.terrain=new DP(this.painter,t,e,this._terrainSkirtLength),this.painter.renderToTexture=new iL(this.painter,this.terrain),this._camera.terrain=this.terrain,this._camera.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._camera.transform.center,this._camera.transform.tileZoom)),this._camera.transform.setElevation(this.terrain.getElevationForLngLat(this._camera.transform.center,this._camera.transform)),this._terrainDataCallback=t=>this._handleTerrainDataEvent(t,e.source),this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.destroy(),this.terrain=null,this.painter.renderToTexture=null,this._camera.terrain=null,this._camera.transform.setMinElevationForCurrentTile(0),this.getCenterClampedToGround()&&this._camera.transform.setElevation(0);return this.style.triggerSymbolPlacement(),this.fire(new mC({terrain:e})),this}_handleTerrainDataEvent(e,t){if("style"===e.dataType)return void this.terrain.tileManager.releaseAllRTT();let i=e.sourceId===t;if(i&&(this.terrain.resetElevationCache(),this.style.triggerSymbolPlacement()),i&&e.tile&&!this._camera.elevationFreeze&&(this._camera.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._camera.transform.center,this._camera.transform.tileZoom)),this.getCenterClampedToGround()&&this._camera.transform.setElevation(this.terrain.getElevationForLngLat(this._camera.transform.center,this._camera.transform))),e.tile){if("image"===e.source?.type)return void this.terrain.tileManager.releaseAllRTT();this.terrain.tileManager.releaseRTT(e.tile.tileID)}}getTerrain(){return this.terrain?.options??null}areTilesLoaded(){let e=this.style?.tileManagers;for(let t of Object.values(e))if(!t.areTilesLoaded())return!1;return!0}removeSource(e){return this.style.removeSource(e),this._update(!0)}getSource(e){return this.style?.getSource(e)}setSourceTileLodParams(e,t,i){if(i){let n=this.getSource(i);if(!n)throw Error(`There is no source with ID "${i}", cannot set LOD parameters`);n.calculateTileZoom=$T(Math.max(1,e),Math.max(1,t))}else for(let i in this.style.tileManagers)this.style.tileManagers[i].getSource().calculateTileZoom=$T(Math.max(1,e),Math.max(1,t));return this._update(!0),this}refreshTiles(e,t){let i=this.style.tileManagers[e];if(!i)throw Error(`There is no tile manager with ID "${e}", cannot refresh tile`);void 0===t?i.reload(!0):i.refreshTiles(t.map(e=>new qE(e.z,e.x,e.y)))}addImage(e,t,i={}){this._lazyInitEmptyStyle();let n=this._createStyleImage(t,i);return n?(this.style.addImage(e,n),n.userImage?.onAdd&&n.userImage.onAdd(this,e),this):this}setMissingStyleImageResolver(e){return this._missingStyleImageResolver=e,this.style?.setMissingImageResolver(e),this}_createStyleImage(e,t={}){let{pixelRatio:i=1,sdf:n=!1,stretchX:a,stretchY:r,content:s,textFitWidth:o,textFitHeight:l}=t;if(e instanceof HTMLImageElement||Eh(e)){let{width:t,height:c,data:u}=$M.getImageData(e);return{data:new Hv({width:t,height:c},u),pixelRatio:i,stretchX:a,stretchY:r,content:s,textFitWidth:o,textFitHeight:l,sdf:n,version:0}}if(void 0===e.width||void 0===e.height)return this.fire(new td(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`"))),null;{let{width:t,height:c,data:u}=e,h=e,d=Aw(h.data);return{data:d?new Hv({width:t,height:c}):new Hv({width:t,height:c},new Uint8Array(u)),pixelRatio:i,stretchX:a,stretchY:r,content:s,textFitWidth:o,textFitHeight:l,sdf:n,version:0,isWebGLImage:d,userImage:h}}}updateImage(e,t){let i=this.style.getImage(e);if(!i)return this.fire(new td(Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));let{width:n,height:a,data:r}=t instanceof HTMLImageElement||Eh(t)?$M.getImageData(t):t;if(void 0===n||void 0===a)return this.fire(new td(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(n!==i.data.width||a!==i.data.height)return this.fire(new td(Error("The width and height of the updated image must be that same as the previous version of the image")));if(i.isWebGLImage=Aw(r),i.isWebGLImage)i.userImage=t;else{let e=!(t instanceof HTMLImageElement||Eh(t));i.data.replace(r,e)}return this.style.updateImage(e,i),this}getImage(e){return this.style.getImage(e)}hasImage(e){return e?!!this.style.getImage(e):(this.fire(new td(Error("Missing required image id"))),!1)}removeImage(e){this.style.removeImage(e)}async loadImage(e){let t=await nC.getImage(await this._requestManager.transformRequest(e,"Image"),new AbortController);if(!t.data)throw Error(`Could not load image ${e}: the response is empty`);return t}listImages(){return this.style?.listImages()??[]}addLayer(e,t){return this._lazyInitEmptyStyle(),this.style.addLayer(e,t),this._update(!0)}moveLayer(e,t){return this.style.moveLayer(e,t),this._update(!0)}removeLayer(e){return this.style.removeLayer(e),this._update(!0)}getLayer(e){return this.style?.getLayer(e)}getLayersOrder(){return this.style?.getLayersOrder()??[]}setLayerZoomRange(e,t,i){return this.style.setLayerZoomRange(e,t,i),this._update(!0)}setFilter(e,t,i={}){return this.style?.setFilter(e,t,i),this._update(!0)}getFilter(e){return this.style.getFilter(e)}setPaintProperty(e,t,i,n={}){return this.style?.setPaintProperty(e,t,i,n),this._update(!0)}getPaintProperty(e,t){return this.style.getPaintProperty(e,t)}setLayoutProperty(e,t,i,n={}){return this.style.setLayoutProperty(e,t,i,n),this._update(!0)}getLayoutProperty(e,t){return this.style.getLayoutProperty(e,t)}setGlyphs(e,t={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(e,t),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}setFontFaces(e){return this._lazyInitEmptyStyle(),this.style.setFontFaces(e),this._update(!0)}getFontFaces(){return this.style.getFontFaces()}addSprite(e,t,i={}){return this._lazyInitEmptyStyle(),this.style.addSprite(e,t,i,e=>{e||this._update(!0)}),this}removeSprite(e){return this._lazyInitEmptyStyle(),this.style.removeSprite(e),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(e,t={}){return this._lazyInitEmptyStyle(),this.style.setSprite(e,t,e=>{e||this._update(!0)}),this}setLight(e,t={}){return this._lazyInitEmptyStyle(),this.style.setLight(e,t),this._update(!0)}getLight(){return this.style.getLight()}setSky(e,t={}){return this._lazyInitEmptyStyle(),this.style.setSky(e,t),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(e,t){return this.style.setFeatureState(e,t),this._update()}removeFeatureState(e,t){return this.style.removeFeatureState(e,t),this._update()}getFeatureState(e){return this.style.getFeatureState(e)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let e=0,t=0;return this._container&&(e=this._container.clientWidth||400,t=this._container.clientHeight||300),[e,t]}_shouldHandleInitialResize(){if(!this._container?.clientWidth||!this._container.clientHeight)return!1;let[e,t]=this._containerDimensions();return e!==this._camera.transform.width||t!==this._camera.transform.height}_setupResizeObserver(){let e=!1,t=Jz(e=>{this._trackResize&&!this._removed&&(this.resize(e),this.redraw())},50),i=this._ownerWindow.ResizeObserver??ResizeObserver;this._resizeObserver=new i(i=>{!e&&(e=!0,!this._shouldHandleInitialResize())||t(i)}),this._resizeObserver.observe(this._container)}_resolveContainer(e){if("string"==typeof e){let t=document.getElementById(e);if(!t)throw Error(`Container '${e}' not found.`);return t}if(e instanceof HTMLElement||e&&"object"==typeof e&&1===e.nodeType)return e;throw Error("Invalid type: 'container' must be a String or HTMLElement.")}_setupContainer(){let e=this._container;e.classList.add("maplibregl-map");let t=this._canvasContainer=iC.create("div","maplibregl-canvas-container",e);this._interactive&&t.classList.add("maplibregl-interactive"),this._canvas=iC.create("canvas","maplibregl-canvas",t),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");let i=this._containerDimensions(),n=this._getClampedPixelRatio(i[0],i[1]);this._resizeCanvas(i[0],i[1],n);let a=this._controlContainer=iC.create("div","maplibregl-control-container",e),r=this._controlPositions={};for(let e of["top-left","top-right","bottom-left","bottom-right"])r[e]=iC.create("div",`maplibregl-ctrl-${e} `,a);this._container.addEventListener("scroll",this._onMapScroll,!1)}_cleanupContainer(){this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),this._canvasContainer.remove(),this._controlContainer.remove(),this._container.removeEventListener("scroll",this._onMapScroll,!1),this._container.classList.remove("maplibregl-map")}_resizeCanvas(e,t,i){this._canvas.width=Math.floor(i*e),this._canvas.height=Math.floor(i*t),this._canvas.style.width=`${e}px`,this._canvas.style.height=`${t}px`}_setupPainter(){let e={...this._canvasContextAttributes,alpha:!0,depth:!0,stencil:!0,premultipliedAlpha:!0},t=null;this._canvas.addEventListener("webglcontextcreationerror",e=>{t=e},{once:!0});let i=this._canvas.getContext("webgl2",e);if(!i)throw new Yz(e,t);this.painter=new Qz(i,this._camera.transform)}migrateProjection(e,t){this._camera.migrateProjection(e,t),this.painter.transform=e,this.fire(new gC({newProjection:this.style.projection.name}))}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(e){return this.style?._loaded?(this._styleDirty||=e,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(e){return this._update(),this._renderTaskQueue.add(e)}_cancelRenderFrame(e){this._renderTaskQueue.remove(e)}_render(e){let t=this._idleTriggered?this._fadeDuration:0,i=this.style.projection?.transitionState>0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(e),this._removed)return;let n=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;let e=this._camera.transform.zoom,i=tC();this.style.zoomHistory.update(e,i);let a=new Zf(e,{now:i,fadeDuration:t,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),r=a.crossFadingFactor();(1!==r||r!==this._crossFadingFactor)&&(n=!0,this._crossFadingFactor=r),this.style.update(a)}let a=this.style.projection?.transitionState>0!==i;this._camera.transform.setTransitionState(this.style.projection?.transitionState),this.style&&(this._sourcesDirty||a)&&(this._sourcesDirty=!1,this.style._updateSources(this._camera.transform)),this.terrain?(this.terrain.tileManager.update(this._camera.transform,this.terrain)&&this.terrain.resetElevationCache(),this._camera.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._camera.transform.center,this._camera.transform.tileZoom)),!this._camera.elevationFreeze&&this.getCenterClampedToGround()&&this._camera.transform.setElevation(this.terrain.getElevationForLngLat(this._camera.transform.center,this._camera.transform))):(this._camera.transform.setMinElevationForCurrentTile(0),this.getCenterClampedToGround()&&this._camera.transform.setElevation(0)),this._placementDirty=this.style?._updatePlacement(this._camera.transform,this.showCollisionBoxes,t,this._crossSourceCollisions,a),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:t,showPadding:this.showPadding,anisotropicFilterPitch:this.getAnisotropicFilterPitch()}),this.fire(new rC("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,this.fire(new rC("load"))),this.style&&(this.style.hasTransitions()||n)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();let r=this._sourcesDirty||this._styleDirty||this._placementDirty||this.painter.renderToTexture?.needsFollowUpFrame;return r||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new rC("idle")),this._loaded&&!this._fullyLoaded&&!r&&(this._fullyLoaded=!0),this}redraw(){return this.style&&(this._frameRequest&&=(this._frameRequest.abort(),null),this._render(0)),this}remove(){this._hash&&this._hash.remove();for(let e of this._controls)e.onRemove(this);this._controls=[],this._frameRequest&&=(this._frameRequest.abort(),null),this._renderTaskQueue.clear(),this._diffStyleRequest?.abort(),this.painter.destroy(),this._handlers.destroy(),this.setStyle(null),typeof window<"u"&&this._ownerWindow.removeEventListener("online",this._onWindowOnline,!1),nC.removeThrottleControl(this._imageQueueHandle),this._resizeObserver?.disconnect();let e=this.painter.context.gl.getExtension("WEBGL_lose_context");e?.loseContext&&e.loseContext(),this._cleanupContainer(),this._removed=!0,this.fire(new rC("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,$M.frame(this._frameRequest,e=>{this._frameRequest=null;try{this._render(e)}catch(e){if(!Nh(e))throw e}},()=>{},this._ownerWindow))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(e){this._showTileBoundaries!==e&&(this._showTileBoundaries=e,this._update())}get showPadding(){return!!this._showPadding}set showPadding(e){this._showPadding!==e&&(this._showPadding=e,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(e){this._showCollisionBoxes!==e&&(this._showCollisionBoxes=e,e?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(e){this._showOverdrawInspector!==e&&(this._showOverdrawInspector=e,this._update())}get repaint(){return!!this._repaint}set repaint(e){this._repaint!==e&&(this._repaint=e,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(e){this._vertices=e,this._update()}get version(){return"6.9.0"}getCameraTargetElevation(){return this._camera.transform.elevation}getProjection(){return this.style.getProjection()}setProjection(e){return this._lazyInitEmptyStyle(),this.style.setProjection(e),this._update(!0)}};const sL={showCompass:!0,showZoom:!0,visualizePitch:!1,visualizeRoll:!0};var oL=class{constructor(e){this._updateZoomButtons=()=>{let e=this._map.getZoom(),t=e===this._map.getMaxZoom(),i=e===this._map.getMinZoom(!0);this._zoomInButton.disabled=t,this._zoomOutButton.disabled=i,this._zoomInButton.setAttribute("aria-disabled",t.toString()),this._zoomOutButton.setAttribute("aria-disabled",i.toString())},this._rotateCompassArrow=()=>{let e=this._map.getPitch(),t=this._map.getRoll(),i=this._map.getBearing(),n=1/Math.cos(Mh(e))**.5;this.options.visualizePitch&&this.options.visualizeRoll?this._compassIcon.style.transform=`scale(${n}) rotateZ(${-t}deg) rotateX(${e}deg) rotateZ(${-i}deg)`:this.options.visualizePitch?this._compassIcon.style.transform=`scale(${n}) rotateX(${e}deg) rotateZ(${-i}deg)`:this.options.visualizeRoll?this._compassIcon.style.transform=`rotate(${-i-t}deg)`:this._compassIcon.style.transform=`rotate(${-i}deg)`},this._setButtonTitle=(e,t)=>{let i=this._map._getUIString(`NavigationControl.${t}`);e.title=i,e.setAttribute("aria-label",i)},this.options=lh({},sL,e),this._container=iC.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",e=>e.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",e=>this._map.zoomIn({},{originalEvent:e})),iC.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",e=>this._map.zoomOut({},{originalEvent:e})),iC.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",e=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:e}):this._map.resetNorth({},{originalEvent:e})}),this._compassIcon=iC.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(e){return this._map=e,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("move",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 lL(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){this._container.remove(),this.options.showZoom&&this._map.off("move",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(e,t){let i=iC.create("button",e,this._container);return i.type="button",i.addEventListener("click",t),i}},lL=class{constructor(e,t,i=!1){this.mousedown=e=>{this.startMove(e,iC.mousePos(this.element,e)),window.addEventListener("mousemove",this.mousemove),window.addEventListener("mouseup",this.mouseup)},this.mousemove=e=>{this.move(e,iC.mousePos(this.element,e))},this.mouseup=e=>{this._rotatePitchHandler.dragEnd(e),this.offTemp()},this.touchstart=e=>{1===e.targetTouches.length?(this._startPos=this._lastPos=iC.touchPos(this.element,e.targetTouches)[0],this.startMove(e,this._startPos),window.addEventListener("touchmove",this.touchmove,{passive:!1}),window.addEventListener("touchend",this.touchend)):this.reset()},this.touchmove=e=>{1===e.targetTouches.length?(this._lastPos=iC.touchPos(this.element,e.targetTouches)[0],this.move(e,this._lastPos)):this.reset()},this.touchend=e=>{0===e.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=t;let n=new yR;this._rotatePitchHandler=new fR({clickTolerance:3,move:(e,n)=>{let a=t.getBoundingClientRect(),r=new Hc((a.bottom-a.top)/2,(a.right-a.left)/2);return{bearingDelta:Dh(new Hc(e.x,n.y),n,r),pitchDelta:i?-.5*(n.y-e.y):void 0}},moveStateManager:n,enable:!0,assignEvents:()=>{}}),this.map=e,t.addEventListener("mousedown",this.mousedown),t.addEventListener("touchstart",this.touchstart,{passive:!1}),t.addEventListener("touchcancel",this.reset)}startMove(e,t){this._rotatePitchHandler.dragStart(e,t),iC.disableDrag()}move(e,t){let i=this.map,{bearingDelta:n,pitchDelta:a}=this._rotatePitchHandler.dragMove(e,t)||{};n&&i.setBearing(i.getBearing()+n),a&&i.setPitch(i.getPitch()+a)}off(){let e=this.element;e.removeEventListener("mousedown",this.mousedown),e.removeEventListener("touchstart",this.touchstart),window.removeEventListener("touchmove",this.touchmove),window.removeEventListener("touchend",this.touchend),e.removeEventListener("touchcancel",this.reset),this.offTemp()}offTemp(){iC.enableDrag(),window.removeEventListener("mousemove",this.mousemove),window.removeEventListener("mouseup",this.mouseup),window.removeEventListener("touchmove",this.touchmove),window.removeEventListener("touchend",this.touchend)}};let cL;function uL(e,t,i,n=!1){if(n||!i.getCoveringTilesDetailsProvider().allowWorldCopies())return e?.wrap();let a=new Ex(e.lng,e.lat);if(e=new Ex(e.lng,e.lat),t){let n=new Ex(e.lng-360,e.lat),a=new Ex(e.lng+360,e.lat),r=i.locationToScreenPoint(e).distSqr(t);i.locationToScreenPoint(n).distSqr(t)<r?e=n:i.locationToScreenPoint(a).distSqr(t)<r&&(e=a)}for(;Math.abs(e.lng-i.center.lng)>180;){let t=i.locationToScreenPoint(e);if(t.x>=0&&t.y>=0&&t.x<=i.width&&t.y<=i.height)break;e.lng>i.center.lng?e.lng-=360:e.lng+=360}return e.lng!==a.lng&&i.isPointOnMapSurface(i.locationToScreenPoint(e))?e:a}const hL={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 dL(e,t,i){let n=e.classList;for(let e in hL)n.remove(`maplibregl-${i}-anchor-${e}`);n.add(`maplibregl-${i}-anchor-${t}`)}const pL={ArrowLeft:[-1,0],ArrowRight:[1,0],ArrowUp:[0,-1],ArrowDown:[0,1]},mL="#3FB1CE";function gL(e,t,i=[]){let n=iC.createNS("http://www.w3.org/2000/svg",e);for(let e in t)n.setAttributeNS(null,e,t[e]);for(let e of i)n.appendChild(e);return n}let fL;var AL=class extends ed{},_L=class extends ed{},vL=class extends id{constructor(e){if(super(),this._onClick=e=>{this.fire(new _L("click",{originalEvent:e}))},this._onKeyPress=e=>{("Space"===e.code||"Enter"===e.code)&&this.togglePopup()},this._onKeyDown=e=>{if(!this._defaultMarker||!this._draggable||!this._map||!this._lngLat||e.composedPath()[0]!==this._element||e.altKey||e.ctrlKey||e.metaKey)return;let t=pL[e.key];if(!t)return;e.preventDefault(),e.stopPropagation();let i=e.shiftKey?10:1,n=this._map.project(this._lngLat);this.setLngLat(this._map.unproject(new Hc(n.x+t[0]*i,n.y+t[1]*i))),this._keyboardDragActive||(this._keyboardDragActive=!0,this.fire(new AL("dragstart"))),this.fire(new AL("drag"))},this._onKeyUp=e=>{pL[e.key]&&this._endKeyboardDrag()},this._onBlur=()=>{this._endKeyboardDrag()},this._onMapClick=e=>{let t=e.originalEvent.target,i=this._element;this._popup&&(t===i||i.contains(t))&&this.togglePopup()},this._update=e=>{if(!this._map)return;let t=this._map.loaded()&&!this._map.isMoving();("terrain"===e?.type||"render"===e?.type&&!t)&&this._map.once("render",this._update),this._lngLat=uL(this._lngLat,this._flatPos,this._map._camera.transform),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map._camera.transform.locationToScreenPoint(this._lngLat)._add(this._offset));let i="";"viewport"===this._rotationAlignment||"auto"===this._rotationAlignment?i=`rotateZ(${this._rotation}deg)`:"map"===this._rotationAlignment&&(i=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let n="";"viewport"===this._pitchAlignment||"auto"===this._pitchAlignment?n="rotateX(0deg)":"map"===this._pitchAlignment&&(n=`rotateX(${this._map.getPitch()}deg)`),!this._subpixelPositioning&&(!e||"moveend"===e.type)&&(this._pos=this._pos.round()),this._element.style.transform=`${hL[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${n} ${i}`,$M.frameAsync(new AbortController,this._map._ownerWindow).then(()=>{this._updateOpacity("moveend"===e?.type)}).catch(()=>{})},this._onMove=e=>{if(!this._isDragging){let t=this._clickTolerance||this._map._clickTolerance;this._isDragging=e.point.dist(this._pointerdownPos)>=t}this._isDragging&&(this._pos=e.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none","pending"===this._state&&(this._state="active",this.fire(new AL("dragstart"))),this.fire(new AL("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 AL("dragend")),this._state="inactive"},this._addDragHandler=e=>{this._element.contains(e.originalEvent.target)&&(e.preventDefault(),this._positionDelta=e.point.sub(this._pos).add(this._offset),this._pointerdownPos=e.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},this._anchor=e?.anchor||"center",this._color=e?.color||mL,this._scale=e?.scale||1,this._draggable=e?.draggable||!1,this._clickTolerance=e?.clickTolerance||0,this._subpixelPositioning=e?.subpixelPositioning||!1,this._isDragging=!1,this._roleManaged=!1,this._tabIndexManaged=!1,this._keyboardDragActive=!1,this._state="inactive",this._rotation=e?.rotation||0,this._rotationAlignment=e?.rotationAlignment||"auto",this._pitchAlignment=e?.pitchAlignment&&"auto"!==e.pitchAlignment?e.pitchAlignment:this._rotationAlignment,this.setOpacity(e?.opacity,e?.opacityWhenCovered),e?.element)this._element=e.element,this._offset=Hc.convert(e?.offset||[0,0]);else{this._defaultMarker=!0,this._element=iC.create("div");let t=(fL||(fL=gL("svg",{display:"block",height:"41px",width:"27px",viewBox:"0 0 27 41"},[gL("g",{"fill-rule":"nonzero"},[gL("g",{transform:"translate(3.0, 29.0)",fill:"#000000"},[["10.5","5.25002273"],["10.5","5.25002273"],["9.5","4.77275007"],["8.5","4.29549936"],["7.5","3.81822308"],["6.5","3.34094679"],["5.5","2.86367051"],["4.5","2.38636864"]].map(([e,t])=>gL("ellipse",{opacity:"0.04",cx:"10.5",cy:"5.80029008",rx:e,ry:t}))),gL("g",{fill:mL},[gL("path",{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"})]),gL("g",{opacity:"0.25",fill:"#000000"},[gL("path",{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"})]),gL("g",{transform:"translate(6.0, 7.0)",fill:"#FFFFFF"}),gL("g",{transform:"translate(8.0, 8.0)"},[gL("circle",{fill:"#000000",opacity:"0.25",cx:"5.5",cy:"5.5",r:"5.4999962"}),gL("circle",{fill:"#FFFFFF",cx:"5.5",cy:"5.5",r:"5.4999962"})])])]),fL)).cloneNode(!0);t.setAttributeNS(null,"height",41*this._scale+"px"),t.setAttributeNS(null,"width",27*this._scale+"px"),function(e){return e.firstElementChild.children[1]}(t).setAttributeNS(null,"fill",this._color),this._element.appendChild(t),this._offset=Hc.convert(e?.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",e=>{e.preventDefault()}),this._element.addEventListener("mousedown",e=>{e.preventDefault()}),dL(this._element,this._anchor,"marker"),e?.className)for(let t of e.className.split(" "))this._element.classList.add(t);this._popup=null}addTo(e){return this.remove(),this._map=e,this._defaultMarker&&!this._element.hasAttribute("aria-label")&&this._element.setAttribute("aria-label",e._getUIString("Marker.Title")),this._updateAccessibilityRole(),e.getCanvasContainer().appendChild(this._element),e.on("move",this._update),e.on("moveend",this._update),e.on("terrain",this._update),e.on("projectiontransition",this._update),this._element.addEventListener("click",this._onClick),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),this._element.removeEventListener("click",this._onClick),this._element.removeEventListener("keydown",this._onKeyDown),this._element.removeEventListener("keyup",this._onKeyUp),this._element.removeEventListener("blur",this._onBlur),this._element.removeEventListener("keypress",this._onKeyPress),this._keyboardDragActive=!1,this._element.remove(),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=Ex.convert(e),this._pos=null,this._update(),this._popup&&this._popup.setLngLat(this._lngLat),this}getElement(){return this._element}setPopup(e){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress)),e){if(!("offset"in e.options)){let t=13.5/Math.SQRT2;e.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[t,-1*(24.6+t)],"bottom-right":[-t,-1*(24.6+t)],left:[13.5,-24.6],right:[-13.5,-24.6]}:this._offset}this._popup=e,this._element.addEventListener("keypress",this._onKeyPress)}return this._updateTabIndex(),this._updateAccessibilityRole(),this}setSubpixelPositioning(e){return this._subpixelPositioning=e,this}_endKeyboardDrag(){this._keyboardDragActive&&(this._keyboardDragActive=!1,this.fire(new AL("dragend")))}getPopup(){return this._popup}togglePopup(){let e=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:e?(e.isOpen()?e.remove():(e.setLngLat(this._lngLat),e.addTo(this._map)),this):this}_updateOpacity(e=!1){let t=this._map?.terrain,i=this._map._camera.transform.isLocationOccluded(this._lngLat);if(!t||i){let e=i?this._opacityWhenCovered:this._opacity;return void(this._element.style.opacity!==e&&(this._element.style.opacity=e,this._element.classList.toggle("maplibregl-marker-covered",i)))}if(e)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}let n=this._map,a=n.terrain.depthAtPoint(this._pos),r=n.terrain.getElevationForLngLat(this._lngLat,n._camera.transform);if(n._camera.transform.lngLatToCameraDepth(this._lngLat,r)-a<.006)return this._element.style.opacity=this._opacity,void this._element.classList.remove("maplibregl-marker-covered");let s=-this._offset.y/n._camera.transform.pixelsPerMeter,o=Math.sin(n.getPitch()*Math.PI/180)*s,l=n.terrain.depthAtPoint(new Hc(this._pos.x,this._pos.y-this._offset.y)),c=n._camera.transform.lngLatToCameraDepth(this._lngLat,r+o)-l>.006;this._popup?.isOpen()&&c&&this._popup.remove(),this._element.style.opacity=c?this._opacityWhenCovered:this._opacity,this._element.classList.toggle("maplibregl-marker-covered",c)}getOffset(){return this._offset}setOffset(e){return this._offset=Hc.convert(e),this._update(),this}addClassName(e){this._element.classList.add(e)}removeClassName(e){this._element.classList.remove(e)}toggleClassName(e){return this._element.classList.toggle(e)}setDraggable(e){return this._draggable=!!e,this._element.classList.toggle("maplibregl-marker-draggable",this._draggable),this._map&&(e?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this._defaultMarker&&(this._draggable?(this._element.addEventListener("keydown",this._onKeyDown),this._element.addEventListener("keyup",this._onKeyUp),this._element.addEventListener("blur",this._onBlur)):(this._element.removeEventListener("keydown",this._onKeyDown),this._element.removeEventListener("keyup",this._onKeyUp),this._element.removeEventListener("blur",this._onBlur),this._endKeyboardDrag())),this._updateTabIndex(),this._updateAccessibilityRole(),this}isDraggable(){return this._draggable}_updateTabIndex(){this._popup||this._defaultMarker&&this._draggable?this._element.hasAttribute("tabindex")||(this._element.setAttribute("tabindex","0"),this._tabIndexManaged=!0):this._tabIndexManaged&&=("0"===this._element.getAttribute("tabindex")&&this._element.removeAttribute("tabindex"),!1)}_updateAccessibilityRole(){if(!this._defaultMarker||this._element.hasAttribute("role")&&!this._roleManaged)return;let e=this._draggable||this._popup?"button":"img";this._element.setAttribute("role",e),this._roleManaged=!0}setRotation(e){return this._rotation=e||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(e){return this._rotationAlignment=e||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(e){return this._pitchAlignment=e&&"auto"!==e?e:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(e,t){return(void 0===this._opacity||void 0===e&&void 0===t)&&(this._opacity="1",this._opacityWhenCovered="0.2"),void 0!==e&&(this._opacity=String(e)),void 0!==t&&(this._opacityWhenCovered=String(t)),this._map&&this._updateOpacity(!0),this}};const yL={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let xL=0,bL=!1;var wL=class extends ed{},EL=class extends ed{},kL=class extends ed{},SL=class extends id{constructor(e){super(),this._onSuccess=e=>{if(this._map){if(this._isOutOfMapMaxBounds(e))return this._setErrorState(),this.fire(new EL("outofmaxbounds",e)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=e,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&"OFF"!==this._watchState&&this._updateMarker(e),(!this.options.trackUserLocation||"ACTIVE_LOCK"===this._watchState)&&this._updateCamera(e),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new EL("geolocate",e)),this._finish()}},this._updateCamera=e=>{let t=new Ex(e.coords.longitude,e.coords.latitude),i=e.coords.accuracy,n=lh({bearing:this._map.getBearing()},this.options.fitBoundsOptions),a=gT.fromLngLat(t,i);this._map.fitBounds(a,n,{geolocateSource:!0})},this._updateMarker=e=>{if(e){let t=new Ex(e.coords.longitude,e.coords.latitude);this._accuracyCircleMarker.setLngLat(t).addTo(this._map),this._userLocationDotMarker.setLngLat(t).addTo(this._map),this._accuracy=e.coords.accuracy,this._updateCircleRadiusIfNeeded()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onUpdate=()=>{this._updateCircleRadiusIfNeeded()},this._onError=e=>{if(this._map){if(1===e.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;let e=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=e,this._geolocateButton.setAttribute("aria-label",e),void 0!==this._geolocationWatchID&&this._clearWatch()}else{if(3===e.code&&bL)return;this._setErrorState()}"OFF"!==this._watchState&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new kL("error",e)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._onMoveStart=e=>{if(!this._map)return;let t=e?.[0]instanceof ResizeObserverEntry;!e.geolocateSource&&"ACTIVE_LOCK"===this._watchState&&!t&&!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 wL("trackuserlocationend")),this.fire(new wL("userlocationlostfocus")))},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",e=>{e.preventDefault()}),this._geolocateButton=iC.create("button","maplibregl-ctrl-geolocate",this._container),iC.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",this._geolocateButton.disabled=!0)},this._finishSetupUI=e=>{if(this._map){if(!1===e){yh("Geolocation support is not available so the GeolocateControl will be disabled.");let e=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=e,this._geolocateButton.setAttribute("aria-label",e)}else{let e=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=e,this._geolocateButton.setAttribute("aria-label",e)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=iC.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new vL({element:this._dotElement}),this._circleElement=iC.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new vL({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onUpdate),this._map.on("move",this._onUpdate),this._map.on("rotate",this._onUpdate),this._map.on("pitch",this._onUpdate)),this._geolocateButton.addEventListener("click",()=>this.trigger()),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",this._onMoveStart)}},this.options=lh({},yL,e)}onAdd(e){return this._map=e,this._container=iC.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),async function(e=!1){if(void 0!==cL&&!e)return cL;if(void 0===window.navigator.permissions)return cL=!!window.navigator.geolocation,cL;try{cL="denied"!==(await window.navigator.permissions.query({name:"geolocation"})).state}catch{cL=!!window.navigator.geolocation}return cL}().then(e=>this._finishSetupUI(e)),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(),this._container.remove(),this._map.off("movestart",this._onMoveStart),this._map.off("zoom",this._onUpdate),this._map.off("move",this._onUpdate),this._map.off("rotate",this._onUpdate),this._map.off("pitch",this._onUpdate),this._map=void 0,xL=0,bL=!1}_isOutOfMapMaxBounds(e){let t=this._map.getMaxBounds(),i=e.coords;return t&&(i.longitude<t.getWest()||i.longitude>t.getEast()||i.latitude<t.getSouth()||i.latitude>t.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":case"BACKGROUND_ERROR":case"OFF":case void 0:break;default:throw Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadiusIfNeeded(){let e=this._userLocationDotMarker.getLngLat();if(!(this.options.showUserLocation&&this.options.showAccuracyCircle&&this._accuracy&&e))return;let t=this._map.project(e),i=this._map.unproject([t.x+100,t.y]),n=e.distanceTo(i)/100,a=2*this._accuracy/n;this._circleElement.style.width=`${a.toFixed(2)}px`,this._circleElement.style.height=`${a.toFixed(2)}px`}trigger(){if(!this._setup)return yh("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 wL("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":xL--,bL=!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 wL("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 wL("trackuserlocationstart")),this.fire(new wL("userlocationfocus"));break;default:throw 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 Error(`Unexpected watchState ${this._watchState}`)}if("OFF"===this._watchState&&void 0!==this._geolocationWatchID)this._clearWatch();else if(void 0===this._geolocationWatchID){let e;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),xL++,xL>1?(e={maximumAge:6e5,timeout:0},bL=!0):(e=this.options.positionOptions,bL=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,e)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}};const ML={maxWidth:100,unit:"metric"};var CL=class{constructor(e){this._onMove=()=>{TL(this._map,this._container,this.options)},this.setUnit=e=>{this.options.unit=e,TL(this._map,this._container,this.options)},this.options={...ML,...e}}getDefaultPosition(){return"bottom-left"}onAdd(e){return this._map=e,this._container=iC.create("div","maplibregl-ctrl maplibregl-ctrl-scale",e.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){this._container.remove(),this._map.off("move",this._onMove),this._map=void 0}};function TL(e,t,i){let n=i?.maxWidth||100,a=e._container.clientHeight/2,r=e._container.clientWidth/2,s=e.unproject([r-n/2,a]),o=e.unproject([r+n/2,a]),l=Math.round(e.project(o).x-e.project(s).x),c=Math.min(n,l,e._container.clientWidth),u=s.distanceTo(o);if("imperial"===i?.unit){let i=3.2808*u;i>5280?DL(t,c,i/5280,e._getUIString("ScaleControl.Miles")):DL(t,c,i,e._getUIString("ScaleControl.Feet"))}else"nautical"===i?.unit?DL(t,c,u/1852,e._getUIString("ScaleControl.NauticalMiles")):u>=1e3?DL(t,c,u/1e3,e._getUIString("ScaleControl.Kilometers")):DL(t,c,u,e._getUIString("ScaleControl.Meters"))}function DL(e,t,i,n){let a=function(e){let t=10**(`${Math.floor(e)}`.length-1),i=e/t;return i=i>=10?10:i>=5?5:i>=3?3:i>=2?2:i>=1?1:function(e){let t=10**Math.ceil(-Math.log(e)/Math.LN10);return Math.round(e*t)/t}(i),t*i}(i),r=a/i;e.style.width=t*r+"px",e.innerHTML=`${a} ${n}`}const PL={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1,locationOccludedOpacity:void 0,padding:void 0},IL=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");var FL=class extends ed{},zL=class extends id{constructor(e){super(),this._updateOpacity=()=>{void 0!==this.options.locationOccludedOpacity&&(this._map._camera.transform.isLocationOccluded(this.getLngLat())?this._container.style.opacity=`${this.options.locationOccludedOpacity}`:this._container.style.opacity="")},this.remove=()=>(this._content&&this._content.remove(),this._container&&(this._container.remove(),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("terrain",this._update),this._map.off("projectiontransition",this._update),this._map.off("mousemove",this._update),this._map.off("mouseup",this._update),this._map.off("drag",this._update),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new FL("close"))),this),this._update=e=>{let t,i=this._lngLat||this._trackPointer;if(!this._map||!i||!this._content)return;if(!this._container){if(this._container=iC.create("div","maplibregl-popup",this._map.getContainer()),this._tip=iC.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(let e of this.options.className.split(" "))this._container.classList.add(e);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=uL(this._lngLat,this._flatPos,this._map._camera.transform,this._trackPointer),e&&"point"in e&&e.point&&(t=e.point),this._trackPointer&&!t)return;let n=this._flatPos=this._pos=this._trackPointer&&t?t:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&t?t:this._map._camera.transform.locationToScreenPoint(this._lngLat));let a=this.options.anchor,r=RL(this.options.offset);if(!a){let e,t=this._container.offsetWidth,i=this._container.offsetHeight,s=function(e){return e?{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}:{top:0,right:0,bottom:0,left:0}}(this.options.padding);e=n.y+r.bottom.y<i+s.top?["top"]:n.y>this._map._camera.transform.height-i-s.bottom?["bottom"]:[],n.x<t/2+s.left?e.push("left"):n.x>this._map._camera.transform.width-t/2-s.right&&e.push("right"),a=0===e.length?"bottom":e.join("-")}let s=n.add(r[a]);this.options.subpixelPositioning||(s=s.round()),this._container.style.transform=`${hL[a]} translate(${s.x}px,${s.y}px)`,dL(this._container,a,"popup"),this._updateOpacity()},this._onClose=()=>{this.remove()},this.options=lh(Object.create(PL),e)}addTo(e){return this._map&&this.remove(),this._map=e,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._map.on("terrain",this._update),this._map.on("projectiontransition",this._update),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._update),this._map.on("mouseup",this._update),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 FL("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=Ex.convert(e),this._pos=null,this._flatPos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._update),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._update),this._map.on("drag",this._update),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(e){return this.setDOMContent(document.createTextNode(e))}setHTML(e){let t,i=document.createDocumentFragment(),n=document.createElement("body");for(n.innerHTML=e;t=n.firstChild,t;)i.appendChild(t);return this.setDOMContent(i)}getMaxWidth(){return this._container?.style.maxWidth}setMaxWidth(e){return this.options.maxWidth=e,this._update(),this}setDOMContent(e){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=iC.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(e),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(e){return this._container&&this._container.classList.add(e),this}removeClassName(e){return this._container&&this._container.classList.remove(e),this}setOffset(e){return this.options.offset=e,this._update(),this}toggleClassName(e){if(this._container)return this._container.classList.toggle(e)}setSubpixelPositioning(e){this.options.subpixelPositioning=e}setPadding(e){this.options.padding=e,this._update()}_createCloseButton(){this.options.closeButton&&(this._closeButton=iC.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;let e=this._container.querySelector(IL);e&&e.focus()}};function RL(e){if(!e)return RL(new Hc(0,0));if("number"==typeof e){let t=Math.round(Math.abs(e)/Math.SQRT2);return{center:new Hc(0,0),top:new Hc(0,e),"top-left":new Hc(t,t),"top-right":new Hc(-t,t),bottom:new Hc(0,-e),"bottom-left":new Hc(t,-t),"bottom-right":new Hc(-t,-t),left:new Hc(e,0),right:new Hc(-e,0)}}if(e instanceof Hc||Array.isArray(e)){let t=Hc.convert(e);return{center:t,top:t,"top-left":t,"top-right":t,bottom:t,"bottom-left":t,"bottom-right":t,left:t,right:t}}return{center:Hc.convert(e.center||[0,0]),top:Hc.convert(e.top||[0,0]),"top-left":Hc.convert(e["top-left"]||[0,0]),"top-right":Hc.convert(e["top-right"]||[0,0]),bottom:Hc.convert(e.bottom||[0,0]),"bottom-left":Hc.convert(e["bottom-left"]||[0,0]),"bottom-right":Hc.convert(e["bottom-right"]||[0,0]),left:Hc.convert(e.left||[0,0]),right:Hc.convert(e.right||[0,0])}}var LL=Uint8Array,BL=Uint16Array,OL=Int32Array,UL=new LL([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]),NL=new LL([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]),jL=new LL([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),VL=function(e,t){for(var i=new BL(31),n=0;n<31;++n)i[n]=t+=1<<e[n-1];var a=new OL(i[30]);for(n=1;n<30;++n)for(var r=i[n];r<i[n+1];++r)a[r]=r-i[n]<<5|n;return{b:i,r:a}},qL=VL(UL,2),GL=qL.b,HL=qL.r;GL[28]=258,HL[258]=28;for(var WL=VL(NL,0).b,ZL=new BL(32768),KL=0;KL<32768;++KL){var XL=(43690&KL)>>1|(21845&KL)<<1;XL=(61680&(XL=(52428&XL)>>2|(13107&XL)<<2))>>4|(3855&XL)<<4,ZL[KL]=((65280&XL)>>8|(255&XL)<<8)>>1}var QL=function(e,t,i){for(var n=e.length,a=0,r=new BL(t);a<n;++a)e[a]&&++r[e[a]-1];var s,o=new BL(t);for(a=1;a<t;++a)o[a]=o[a-1]+r[a-1]<<1;if(i){s=new BL(1<<t);var l=15-t;for(a=0;a<n;++a)if(e[a])for(var c=a<<4|e[a],u=t-e[a],h=o[e[a]-1]++<<u,d=h|(1<<u)-1;h<=d;++h)s[ZL[h]>>l]=c}else for(s=new BL(n),a=0;a<n;++a)e[a]&&(s[a]=ZL[o[e[a]-1]++]>>15-e[a]);return s},YL=new LL(288);for(KL=0;KL<144;++KL)YL[KL]=8;for(KL=144;KL<256;++KL)YL[KL]=9;for(KL=256;KL<280;++KL)YL[KL]=7;for(KL=280;KL<288;++KL)YL[KL]=8;var JL=new LL(32);for(KL=0;KL<32;++KL)JL[KL]=5;var $L=QL(YL,9,1),eB=QL(JL,5,1),tB=function(e){for(var t=e[0],i=1;i<e.length;++i)e[i]>t&&(t=e[i]);return t},iB=function(e,t,i){var n=t/8|0;return(e[n]|e[n+1]<<8)>>(7&t)&i},nB=function(e,t){var i=t/8|0;return(e[i]|e[i+1]<<8|e[i+2]<<16)>>(7&t)},aB=function(e){return(e+7)/8|0},rB=["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"],sB=function(e,t,i){var n=new Error(t||rB[e]);if(n.code=e,Error.captureStackTrace&&Error.captureStackTrace(n,sB),!i)throw n;return n},oB=function(e,t,i,n){var a=e.length;if(!a||t.f&&!t.l)return i||new LL(0);var r=!i,s=r||2!=t.i,o=t.i;r&&(i=new LL(3*a));var l=function(e){var t=i.length;if(e>t){var n=new LL(Math.max(2*t,e));n.set(i),i=n}},c=t.f||0,u=t.p||0,h=t.b||0,d=t.l,p=t.d,m=t.m,g=t.n,f=8*a;do{if(!d){c=iB(e,u,1);var A=iB(e,u+1,3);if(u+=3,!A){var _=e[(T=aB(u)+4)-4]|e[T-3]<<8,v=T+_;if(v>a){o&&sB(0);break}s&&l(h+_),i.set(e.subarray(T,v),h),t.b=h+=_,t.p=u=8*v,t.f=c;continue}if(1==A)d=$L,p=eB,m=9,g=5;else if(2==A){var y=iB(e,u,31)+257,x=iB(e,u+10,15)+4,b=y+iB(e,u+5,31)+1;u+=14;for(var w=new LL(b),E=new LL(19),k=0;k<x;++k)E[jL[k]]=iB(e,u+3*k,7);u+=3*x;var S=tB(E),M=(1<<S)-1,C=QL(E,S,1);for(k=0;k<b;){var T,D=C[iB(e,u,M)];if(u+=15&D,(T=D>>4)<16)w[k++]=T;else{var P=0,I=0;for(16==T?(I=3+iB(e,u,3),u+=2,P=w[k-1]):17==T?(I=3+iB(e,u,7),u+=3):18==T&&(I=11+iB(e,u,127),u+=7);I--;)w[k++]=P}}var F=w.subarray(0,y),z=w.subarray(y);m=tB(F),g=tB(z),d=QL(F,m,1),p=QL(z,g,1)}else sB(1);if(u>f){o&&sB(0);break}}s&&l(h+131072);for(var R=(1<<m)-1,L=(1<<g)-1,B=u;;B=u){var O=(P=d[nB(e,u)&R])>>4;if((u+=15&P)>f){o&&sB(0);break}if(P||sB(2),O<256)i[h++]=O;else{if(256==O){B=u,d=null;break}var U=O-254;if(O>264){var N=UL[k=O-257];U=iB(e,u,(1<<N)-1)+GL[k],u+=N}var j=p[nB(e,u)&L],V=j>>4;j||sB(3),u+=15&j;z=WL[V];if(V>3){N=NL[V];z+=nB(e,u)&(1<<N)-1,u+=N}if(u>f){o&&sB(0);break}s&&l(h+131072);var q=h+U;if(h<z){var G=0-z,H=Math.min(z,q);for(G+h<0&&sB(3);h<H;++h)i[h]=n[G+h]}for(;h<q;++h)i[h]=i[h-z]}}t.l=d,t.p=B,t.b=h,t.f=c,d&&(c=1,t.m=m,t.d=p,t.n=g)}while(!c);return h!=i.length&&r?function(e,t,i){return(null==i||i>e.length)&&(i=e.length),new LL(e.subarray(t,i))}(i,0,h):i.subarray(0,h)},lB=new LL(0);function cB(e,t){var i=function(e){31==e[0]&&139==e[1]&&8==e[2]||sB(6,"invalid gzip data");var t=e[3],i=10;4&t&&(i+=2+(e[10]|e[11]<<8));for(var n=(t>>3&1)+(t>>4&1);n>0;n-=!e[i++]);return i+(2&t)}(e);return i+8>e.length&&sB(6,"invalid gzip data"),oB(e.subarray(i,-8),{i:2},new LL(function(e){var t=e.length;return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}(e)),t)}function uB(e,t){return oB(e.subarray(function(e){return(8!=(15&e[0])||e[0]>>4>7||(e[0]<<8|e[1])%31)&&sB(6,"invalid zlib data"),1==(e[1]>>5&1)&&sB(6,"invalid zlib data: "+(32&e[1]?"need":"unexpected")+" dictionary"),2+(e[1]>>3&4)}(e),-4),{i:2},t,t)}function hB(e,t){return 31==e[0]&&139==e[1]&&8==e[2]?cB(e,t):8!=(15&e[0])||e[0]>>4>7||(e[0]<<8|e[1])%31?function(e,t){return oB(e,{i:2},t,t)}(e,t):uB(e,t)}var dB="undefined"!=typeof TextDecoder&&new TextDecoder;try{dB.decode(lB,{stream:!0})}catch(y2){}var pB=Object.defineProperty,mB=Math.pow,gB=(e,t)=>pB(e,"name",{value:t,configurable:!0}),fB=(e,t,i)=>new Promise((n,a)=>{var r=e=>{try{o(i.next(e))}catch(e){a(e)}},s=e=>{try{o(i.throw(e))}catch(e){a(e)}},o=e=>e.done?n(e.value):Promise.resolve(e.value).then(r,s);o((i=i.apply(e,t)).next())});gB((e,t)=>{let i=!1,n="",a=L.GridLayer.extend({createTile:gB((t,a)=>{let r=document.createElement("img"),s=new AbortController,o=s.signal;return r.cancel=()=>{s.abort()},i||(e.getHeader().then(e=>{1===e.tileType||6===e.tileType?console.error("Error: archive contains vector tiles, but leafletRasterLayer is for displaying raster tiles. See https://github.com/protomaps/PMTiles/tree/main/js for details."):2===e.tileType?n="image/png":3===e.tileType?n="image/jpeg":4===e.tileType?n="image/webp":5===e.tileType&&(n="image/avif")}),i=!0),e.getZxy(t.z,t.x,t.y,o).then(e=>{if(e){let t=new Blob([e.data],{type:n}),i=window.URL.createObjectURL(t);r.src=i}else r.style.display="none";r.cancel=void 0,a(void 0,r)}).catch(e=>{if("AbortError"!==e.name)throw e}),r},"createTile"),_removeTile:gB(function(e){let t=this._tiles[e];t&&(t.el.cancel&&t.el.cancel(),t.el.src&&window.URL.revokeObjectURL(t.el.src),t.el.width=0,t.el.height=0,t.el.deleted=!0,L.DomUtil.remove(t.el),delete this._tiles[e],this.fire("tileunload",{tile:t.el,coords:this._keyToTileCoords(e)}))},"_removeTile")});return new a(t)},"leafletRasterLayer");var AB=gB(e=>(t,i)=>{if(i instanceof AbortController)return e(t,i);let n=new AbortController;return e(t,n).then(e=>i(void 0,e.data,e.cacheControl||"",e.expires||""),e=>i(e)).catch(e=>i(e)),{cancel:gB(()=>n.abort(),"cancel")}},"v3compat"),_B=class{constructor(e){this.tilev4=gB((e,t)=>fB(this,null,function*(){if("json"===e.type){let i=e.url.substr(10),n=this.tiles.get(i);if(n||(n=new qB(i),this.tiles.set(i,n)),this.metadata){let i=yield n.getTileJson(e.url);return t.signal.throwIfAborted(),{data:i}}let a=yield n.getHeader();return t.signal.throwIfAborted(),(a.minLon>=a.maxLon||a.minLat>=a.maxLat)&&console.error(`Bounds of PMTiles archive ${a.minLon},${a.minLat},${a.maxLon},${a.maxLat} are not valid.`),{data:{tiles:[`${e.url}/{z}/{x}/{y}`],minzoom:a.minZoom,maxzoom:a.maxZoom,bounds:[a.minLon,a.minLat,a.maxLon,a.maxLat]}}}let i=new RegExp(/pmtiles:\/\/(.+)\/(\d+)\/(\d+)\/(\d+)/),n=e.url.match(i);if(!n)throw new Error("Invalid PMTiles protocol URL");let a=n[1],r=this.tiles.get(a);r||(r=new qB(a),this.tiles.set(a,r));let s=n[2],o=n[3],l=n[4],c=yield null==r?void 0:r.getZxy(+s,+o,+l,t.signal);if(t.signal.throwIfAborted(),c)return{data:new Uint8Array(c.data),cacheControl:c.cacheControl,expires:c.expires};let u=yield r.getHeader();if(1===u.tileType||6===u.tileType){if(this.errorOnMissingTile)throw new Error("Tile not found.");return{data:new Uint8Array}}return{data:null}}),"tilev4"),this.tile=AB(this.tilev4),this.tiles=new Map,this.metadata=(null==e?void 0:e.metadata)||!1,this.errorOnMissingTile=(null==e?void 0:e.errorOnMissingTile)||!1}add(e){this.tiles.set(e.source.getKey(),e)}get(e){return this.tiles.get(e)}};gB(_B,"Protocol");var vB=_B;function yB(e,t){return 4294967296*(t>>>0)+(e>>>0)}function xB(e,t){let i=t.buf,n=i[t.pos++],a=(112&n)>>4;if(n<128||(n=i[t.pos++],a|=(127&n)<<3,n<128)||(n=i[t.pos++],a|=(127&n)<<10,n<128)||(n=i[t.pos++],a|=(127&n)<<17,n<128)||(n=i[t.pos++],a|=(127&n)<<24,n<128)||(n=i[t.pos++],a|=(1&n)<<31,n<128))return yB(e,a);throw new Error("Expected varint not more than 10 bytes")}function bB(e){let t=e.buf,i=t[e.pos++],n=127&i;return i<128||(i=t[e.pos++],n|=(127&i)<<7,i<128)||(i=t[e.pos++],n|=(127&i)<<14,i<128)||(i=t[e.pos++],n|=(127&i)<<21,i<128)?n:(i=t[e.pos],n|=(15&i)<<28,xB(n,e))}function wB(e,t,i,n,a){return 0===a?0!==n?[e-1-i,e-1-t]:[i,t]:[t,i]}function EB(e,t,i){if(e>26)throw new Error("Tile zoom level exceeds max safe number limit (26)");if(t>=1<<e||i>=1<<e)throw new Error("tile x/y outside zoom level bounds");let n=((1<<e)*(1<<e)-1)/3,a=e-1,[r,s]=[t,i];for(let e=1<<a;e>0;e>>=1){let t=r&e,i=s&e;n+=(3*t^i)*(1<<a),[r,s]=wB(e,r,s,t,i),a--}return n}function kB(e){let t=3*e+1;return t<4294967296?31-Math.clz32(t):63-Math.clz32(t/4294967296)}gB(yB,"toNum"),gB(xB,"readVarintRemainder"),gB(bB,"readVarint"),gB(wB,"rotate"),gB(EB,"zxyToTileId"),gB(kB,"tileIdToZ"),gB(function(e){let t=kB(e)>>1;if(t>26)throw new Error("Tile zoom level exceeds max safe number limit (26)");let i=e-((1<<t)*(1<<t)-1)/3,n=0,a=0,r=1<<t;for(let e=1;e<r;e<<=1){let t=e&i/2,r=e&(i^t);[n,a]=wB(e,n,a,t,r),i/=2,n+=t,a+=r}return[t,n,a]},"tileIdToZxy");var SB=(e=>(e[e.Unknown=0]="Unknown",e[e.None=1]="None",e[e.Gzip=2]="Gzip",e[e.Brotli=3]="Brotli",e[e.Zstd=4]="Zstd",e))(SB||{});function MB(e,t){return fB(this,null,function*(){if(1===t||0===t)return e;if(2===t){if(void 0===globalThis.DecompressionStream)return hB(new Uint8Array(e));let t=new Response(e).body;if(!t)throw new Error("Failed to read response stream");let i=t.pipeThrough(new globalThis.DecompressionStream("gzip"));return new Response(i).arrayBuffer()}throw new Error("Compression method not supported")})}gB(MB,"defaultDecompress");var CB=(e=>(e[e.Unknown=0]="Unknown",e[e.Mvt=1]="Mvt",e[e.Png=2]="Png",e[e.Jpeg=3]="Jpeg",e[e.Webp=4]="Webp",e[e.Avif=5]="Avif",e[e.Mlt=6]="Mlt",e))(CB||{});function TB(e){return 1===e?".mvt":2===e?".png":3===e?".jpg":4===e?".webp":5===e?".avif":6===e?".mlt":""}gB(TB,"tileTypeExt");function DB(e,t){let i=0,n=e.length-1;for(;i<=n;){let a=n+i>>1,r=t-e[a].tileId;if(r>0)i=a+1;else{if(!(r<0))return e[a];n=a-1}}return n>=0&&(0===e[n].runLength||t-e[n].tileId<e[n].runLength)?e[n]:null}gB(DB,"findTile");gB(class{constructor(e){this.file=e}getKey(){return this.file.name}getBytes(e,t){return fB(this,null,function*(){return{data:yield this.file.slice(e,e+t).arrayBuffer()}})}},"FileSource");var PB=class{constructor(e,t=new Headers,i=void 0){var n,a;this.url=e,this.customHeaders=t,this.credentials=i,this.mustReload=!1;let r="";"navigator"in globalThis&&(r=null!=(a=null==(n=globalThis.navigator)?void 0:n.userAgent)?a:"");let s=r.indexOf("Windows")>-1,o=/Chrome|Chromium|Edg|OPR|Brave/.test(r);this.chromeWindowsNoCache=!1,s&&o&&(this.chromeWindowsNoCache=!0)}getKey(){return this.url}setHeaders(e){this.customHeaders=e}getBytes(e,t,i,n){return fB(this,null,function*(){let a,r;i?r=i:(a=new AbortController,r=a.signal);let s,o=new Headers(this.customHeaders);o.set("range",`bytes=${e}-${e+t-1}`),this.mustReload?s="reload":this.chromeWindowsNoCache&&(s="no-store");let l=yield fetch(this.url,{signal:r,cache:s,headers:o,credentials:this.credentials});if(0===e&&416===l.status){let e=l.headers.get("Content-Range");if(!e||!e.startsWith("bytes */"))throw new Error("Missing content-length on 416 response");let t=+e.substr(8);o.set("range","bytes=0-"+(t-1)),l=yield fetch(this.url,{signal:r,cache:"reload",headers:o,credentials:this.credentials})}let c=l.headers.get("Etag");if(null!=c&&c.startsWith("W/")&&(c=null),416===l.status||n&&c&&c!==n)throw this.mustReload=!0,new BB(`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 new Error(`Bad response code: ${l.status}`);let u=l.headers.get("Content-Length");if(200===l.status&&(!u||+u>t))throw a&&a.abort(),new 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}})}};gB(PB,"FetchSource");var IB=PB;function FB(e,t){let i=e.getUint32(t+4,!0),n=e.getUint32(t+0,!0);return i*mB(2,32)+n}function zB(e,t){let i=new DataView(e),n=i.getUint8(7);if(n>3)throw new Error(`Archive is spec version ${n} but this library supports up to spec version 3`);return{specVersion:n,rootDirectoryOffset:FB(i,8),rootDirectoryLength:FB(i,16),jsonMetadataOffset:FB(i,24),jsonMetadataLength:FB(i,32),leafDirectoryOffset:FB(i,40),leafDirectoryLength:FB(i,48),tileDataOffset:FB(i,56),tileDataLength:FB(i,64),numAddressedTiles:FB(i,72),numTileEntries:FB(i,80),numTileContents:FB(i,88),clustered:1===i.getUint8(96),internalCompression:i.getUint8(97),tileCompression:i.getUint8(98),tileType:i.getUint8(99),minZoom:i.getUint8(100),maxZoom:i.getUint8(101),minLon:i.getInt32(102,!0)/1e7,minLat:i.getInt32(106,!0)/1e7,maxLon:i.getInt32(110,!0)/1e7,maxLat:i.getInt32(114,!0)/1e7,centerZoom:i.getUint8(118),centerLon:i.getInt32(119,!0)/1e7,centerLat:i.getInt32(123,!0)/1e7,etag:t}}function RB(e){let t={buf:new Uint8Array(e),pos:0},i=bB(t),n=[],a=0;for(let e=0;e<i;e++){let e=bB(t);n.push({tileId:a+e,offset:0,length:0,runLength:1}),a+=e}for(let e=0;e<i;e++)n[e].runLength=bB(t);for(let e=0;e<i;e++)n[e].length=bB(t);for(let e=0;e<i;e++){let i=bB(t);n[e].offset=0===i&&e>0?n[e-1].offset+n[e-1].length:i-1}return n}gB(FB,"getUint64"),gB(zB,"bytesToHeader"),gB(RB,"deserializeIndex");var LB=class extends Error{};gB(LB,"EtagMismatch");var BB=LB;function OB(e,t){return fB(this,null,function*(){let i=yield e.getBytes(0,16384);if(19792!==new DataView(i.data).getUint16(0,!0))throw new Error("Wrong magic number for PMTiles archive");let n=zB(i.data.slice(0,127),i.etag),a=i.data.slice(n.rootDirectoryOffset,n.rootDirectoryOffset+n.rootDirectoryLength),r=`${e.getKey()}|${n.etag||""}|${n.rootDirectoryOffset}|${n.rootDirectoryLength}`,s=RB(yield t(a,n.internalCompression));return[n,[r,s.length,s]]})}function UB(e,t,i,n,a,r){return fB(this,null,function*(){let s=yield e.getBytes(i,n,r,a.etag),o=RB(yield t(s.data,a.internalCompression));if(0===o.length)throw new Error("Empty directory is invalid");return o})}gB(OB,"getHeaderAndRoot"),gB(UB,"getDirectory");gB(class{constructor(e=100,t=!0,i=MB){this.cache=new Map,this.maxCacheEntries=e,this.counter=1,this.decompress=i}getHeader(e){return fB(this,null,function*(){let t=e.getKey(),i=this.cache.get(t);if(i)return i.lastUsed=this.counter++,i.data;let n=yield OB(e,this.decompress);return n[1]&&this.cache.set(n[1][0],{lastUsed:this.counter++,data:n[1][2]}),this.cache.set(t,{lastUsed:this.counter++,data:n[0]}),this.prune(),n[0]})}getDirectory(e,t,i,n,a){return fB(this,null,function*(){let r=`${e.getKey()}|${n.etag||""}|${t}|${i}`,s=this.cache.get(r);if(s)return s.lastUsed=this.counter++,s.data;let o=yield UB(e,this.decompress,t,i,n,a);return this.cache.set(r,{lastUsed:this.counter++,data:o}),this.prune(),o})}prune(){if(this.cache.size>this.maxCacheEntries){let e,t=1/0;this.cache.forEach((i,n)=>{i.lastUsed<t&&(t=i.lastUsed,e=n)}),e&&this.cache.delete(e)}}invalidate(e){return fB(this,null,function*(){this.cache.delete(e.getKey())})}},"ResolvedValueCache");var NB=class{constructor(e=100,t=!0,i=MB){this.cache=new Map,this.invalidations=new Map,this.pendingFetches=new Map,this.maxCacheEntries=e,this.counter=1,this.decompress=i}getHeader(e){return fB(this,null,function*(){let t=e.getKey(),i=this.cache.get(t);if(i)return i.lastUsed=this.counter++,yield i.data;let n=new Promise((t,i)=>{OB(e,this.decompress).then(e=>{e[1]&&this.cache.set(e[1][0],{lastUsed:this.counter++,data:Promise.resolve(e[1][2])}),t(e[0]),this.prune()}).catch(e=>{i(e)})});return this.cache.set(t,{lastUsed:this.counter++,data:n}),n})}trackSignal(e,t,i){t.refs++,i.addEventListener("abort",()=>{--t.refs<=0&&this.pendingFetches.get(e)===t&&(t.controller.abort(),this.cache.delete(e),this.pendingFetches.delete(e))},{once:!0})}getDirectory(e,t,i,n,a){return fB(this,null,function*(){let r=`${e.getKey()}|${n.etag||""}|${t}|${i}`,s=this.cache.get(r);if(s){s.lastUsed=this.counter++;let e=this.pendingFetches.get(r);return e&&this.trackSignal(r,e,null!=a?a:(new AbortController).signal),yield s.data}let o=new AbortController,l={controller:o,refs:0};this.trackSignal(r,l,null!=a?a:(new AbortController).signal),this.pendingFetches.set(r,l);let c=new Promise((a,s)=>{UB(e,this.decompress,t,i,n,o.signal).then(e=>{this.pendingFetches.delete(r),a(e),this.prune()}).catch(e=>{s(e)})});return this.cache.set(r,{lastUsed:this.counter++,data:c}),c})}prune(){if(this.cache.size>=this.maxCacheEntries){let e,t=1/0;this.cache.forEach((i,n)=>{i.lastUsed<t&&(t=i.lastUsed,e=n)}),e&&this.cache.delete(e)}}invalidate(e){return fB(this,null,function*(){let t=e.getKey();if(this.invalidations.get(t))return yield this.invalidations.get(t);this.cache.delete(e.getKey());let i=new Promise((i,n)=>{this.getHeader(e).then(e=>{i(),this.invalidations.delete(t)}).catch(e=>{n(e)})});this.invalidations.set(t,i)})}};gB(NB,"SharedPromiseCache");var jB=NB,VB=class{constructor(e,t,i){this.source="string"==typeof e?new IB(e):e,this.decompress=i||MB,this.cache=t||new jB}getHeader(){return fB(this,null,function*(){return yield this.cache.getHeader(this.source)})}getZxyAttempt(e,t,i,n){return fB(this,null,function*(){let a=EB(e,t,i),r=yield this.cache.getHeader(this.source);if(null==n||n.throwIfAborted(),e<r.minZoom||e>r.maxZoom)return;let s=r.rootDirectoryOffset,o=r.rootDirectoryLength;for(let e=0;e<=3;e++){let e=yield this.cache.getDirectory(this.source,s,o,r,n);null==n||n.throwIfAborted();let t=DB(e,a);if(!t)return;if(t.runLength>0){let e=yield this.source.getBytes(r.tileDataOffset+t.offset,t.length,n,r.etag);return{data:yield this.decompress(e.data,r.tileCompression),cacheControl:e.cacheControl,expires:e.expires}}s=r.leafDirectoryOffset+t.offset,o=t.length}throw new Error("Maximum directory depth exceeded")})}getZxy(e,t,i,n){return fB(this,null,function*(){try{return yield this.getZxyAttempt(e,t,i,n)}catch(a){if(a instanceof BB)return this.cache.invalidate(this.source),yield this.getZxyAttempt(e,t,i,n);throw a}})}getMetadataAttempt(){return fB(this,null,function*(){let e=yield this.cache.getHeader(this.source),t=yield this.source.getBytes(e.jsonMetadataOffset,e.jsonMetadataLength,void 0,e.etag),i=yield this.decompress(t.data,e.internalCompression),n=new TextDecoder("utf-8");return JSON.parse(n.decode(i))})}getMetadata(){return fB(this,null,function*(){try{return yield this.getMetadataAttempt()}catch(e){if(e instanceof BB)return this.cache.invalidate(this.source),yield this.getMetadataAttempt();throw e}})}getTileJson(e){return fB(this,null,function*(){let t=yield this.getHeader(),i=yield this.getMetadata(),n=TB(t.tileType);return{tilejson:"3.0.0",scheme:"xyz",tiles:[`${e}/{z}/{x}/{y}${n}`],vector_layers:i.vector_layers,attribution:i.attribution,description:i.description,name:i.name,version:i.version,bounds:[t.minLon,t.minLat,t.maxLon,t.maxLat],center:[t.centerLon,t.centerLat,t.centerZoom],minzoom:t.minZoom,maxzoom:t.maxZoom}})}};gB(VB,"PMTiles");var qB=VB;const GB=new CSSStyleSheet;GB.replaceSync('.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{position:absolute;left:0;top:0}.maplibregl-map:fullscreen{width:100%;height: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{position:absolute;pointer-events:none;z-index:2}.maplibregl-ctrl-top-left{top:0;left:0}.maplibregl-ctrl-top-right{top:0;right:0}.maplibregl-ctrl-bottom-left{bottom:0;left:0}.maplibregl-ctrl-bottom-right{right:0;bottom:0}.maplibregl-ctrl{clear:both;pointer-events:auto;transform:translate(0)}.maplibregl-ctrl-top-left .maplibregl-ctrl{margin:10px 0 0 10px;float:left}.maplibregl-ctrl-top-right .maplibregl-ctrl{margin:10px 10px 0 0;float:right}.maplibregl-ctrl-bottom-left .maplibregl-ctrl{margin:0 0 10px 10px;float:left}.maplibregl-ctrl-bottom-right .maplibregl-ctrl{margin:0 10px 10px 0;float:right}.maplibregl-ctrl-group{border-radius:4px;background:#fff}.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{width:29px;height:29px;display:block;padding:0;outline:none;border:0;box-sizing:border-box;background-color:transparent;cursor:pointer}.maplibregl-ctrl-group button+button{border-top:1px solid #ddd}.maplibregl-ctrl button .maplibregl-ctrl-icon{display:block;width:100%;height:100%;background-repeat:no-repeat;background-position:50%}@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("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2229%22%20height%3D%2229%22%20fill%3D%22%23333%22%20viewBox%3D%220%200%2029%2029%22%3E%3Cpath%20d%3D%22M10%2013c-.75%200-1.5.75-1.5%201.5S9.25%2016%2010%2016h9c.75%200%201.5-.75%201.5-1.5S19.75%2013%2019%2013z%22%2F%3E%3C%2Fsvg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2229%22%20height%3D%2229%22%20fill%3D%22%23333%22%20viewBox%3D%220%200%2029%2029%22%3E%3Cpath%20d%3D%22M14.5%208.5c-.75%200-1.5.75-1.5%201.5v3h-3c-.75%200-1.5.75-1.5%201.5S9.25%2016%2010%2016h3v3c0%20.75.75%201.5%201.5%201.5S16%2019.75%2016%2019v-3h3c.75%200%201.5-.75%201.5-1.5S19.75%2013%2019%2013h-3v-3c0-.75-.75-1.5-1.5-1.5%22%2F%3E%3C%2Fsvg%3E")}@media (forced-colors:active){.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2229%22%20height%3D%2229%22%20fill%3D%22%23fff%22%20viewBox%3D%220%200%2029%2029%22%3E%3Cpath%20d%3D%22M10%2013c-.75%200-1.5.75-1.5%201.5S9.25%2016%2010%2016h9c.75%200%201.5-.75%201.5-1.5S19.75%2013%2019%2013z%22%2F%3E%3C%2Fsvg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2229%22%20height%3D%2229%22%20fill%3D%22%23fff%22%20viewBox%3D%220%200%2029%2029%22%3E%3Cpath%20d%3D%22M14.5%208.5c-.75%200-1.5.75-1.5%201.5v3h-3c-.75%200-1.5.75-1.5%201.5S9.25%2016%2010%2016h3v3c0%20.75.75%201.5%201.5%201.5S16%2019.75%2016%2019v-3h3c.75%200%201.5-.75%201.5-1.5S19.75%2013%2019%2013h-3v-3c0-.75-.75-1.5-1.5-1.5%22%2F%3E%3C%2Fsvg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2229%22%20height%3D%2229%22%20viewBox%3D%220%200%2029%2029%22%3E%3Cpath%20d%3D%22M10%2013c-.75%200-1.5.75-1.5%201.5S9.25%2016%2010%2016h9c.75%200%201.5-.75%201.5-1.5S19.75%2013%2019%2013z%22%2F%3E%3C%2Fsvg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2229%22%20height%3D%2229%22%20viewBox%3D%220%200%2029%2029%22%3E%3Cpath%20d%3D%22M14.5%208.5c-.75%200-1.5.75-1.5%201.5v3h-3c-.75%200-1.5.75-1.5%201.5S9.25%2016%2010%2016h3v3c0%20.75.75%201.5%201.5%201.5S16%2019.75%2016%2019v-3h3c.75%200%201.5-.75%201.5-1.5S19.75%2013%2019%2013h-3v-3c0-.75-.75-1.5-1.5-1.5%22%2F%3E%3C%2Fsvg%3E")}}.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2229%22%20height%3D%2229%22%20fill%3D%22%23333%22%20viewBox%3D%220%200%2029%2029%22%3E%3Cpath%20d%3D%22M24%2016v5.5c0%201.75-.75%202.5-2.5%202.5H16v-1l3-1.5-4-5.5%201-1%205.5%204%201.5-3zM6%2016l1.5%203%205.5-4%201%201-4%205.5%203%201.5v1H7.5C5.75%2024%205%2023.25%205%2021.5V16zm7-11v1l-3%201.5%204%205.5-1%201-5.5-4L6%2013H5V7.5C5%205.75%205.75%205%207.5%205zm11%202.5c0-1.75-.75-2.5-2.5-2.5H16v1l3%201.5-4%205.5%201%201%205.5-4%201.5%203h1z%22%2F%3E%3C%2Fsvg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2229%22%20height%3D%2229%22%20viewBox%3D%220%200%2029%2029%22%3E%3Cpath%20d%3D%22M18.5%2016c-1.75%200-2.5.75-2.5%202.5V24h1l1.5-3%205.5%204%201-1-4-5.5%203-1.5v-1zM13%2018.5c0-1.75-.75-2.5-2.5-2.5H5v1l3%201.5L4%2024l1%201%205.5-4%201.5%203h1zm3-8c0%201.75.75%202.5%202.5%202.5H24v-1l-3-1.5L25%205l-1-1-5.5%204L17%205h-1zM10.5%2013c1.75%200%202.5-.75%202.5-2.5V5h-1l-1.5%203L5%204%204%205l4%205.5L5%2012v1z%22%2F%3E%3C%2Fsvg%3E")}@media (forced-colors:active){.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2229%22%20height%3D%2229%22%20fill%3D%22%23fff%22%20viewBox%3D%220%200%2029%2029%22%3E%3Cpath%20d%3D%22M24%2016v5.5c0%201.75-.75%202.5-2.5%202.5H16v-1l3-1.5-4-5.5%201-1%205.5%204%201.5-3zM6%2016l1.5%203%205.5-4%201%201-4%205.5%203%201.5v1H7.5C5.75%2024%205%2023.25%205%2021.5V16zm7-11v1l-3%201.5%204%205.5-1%201-5.5-4L6%2013H5V7.5C5%205.75%205.75%205%207.5%205zm11%202.5c0-1.75-.75-2.5-2.5-2.5H16v1l3%201.5-4%205.5%201%201%205.5-4%201.5%203h1z%22%2F%3E%3C%2Fsvg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2229%22%20height%3D%2229%22%20fill%3D%22%23fff%22%20viewBox%3D%220%200%2029%2029%22%3E%3Cpath%20d%3D%22M18.5%2016c-1.75%200-2.5.75-2.5%202.5V24h1l1.5-3%205.5%204%201-1-4-5.5%203-1.5v-1zM13%2018.5c0-1.75-.75-2.5-2.5-2.5H5v1l3%201.5L4%2024l1%201%205.5-4%201.5%203h1zm3-8c0%201.75.75%202.5%202.5%202.5H24v-1l-3-1.5L25%205l-1-1-5.5%204L17%205h-1zM10.5%2013c1.75%200%202.5-.75%202.5-2.5V5h-1l-1.5%203L5%204%204%205l4%205.5L5%2012v1z%22%2F%3E%3C%2Fsvg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2229%22%20height%3D%2229%22%20viewBox%3D%220%200%2029%2029%22%3E%3Cpath%20d%3D%22M24%2016v5.5c0%201.75-.75%202.5-2.5%202.5H16v-1l3-1.5-4-5.5%201-1%205.5%204%201.5-3zM6%2016l1.5%203%205.5-4%201%201-4%205.5%203%201.5v1H7.5C5.75%2024%205%2023.25%205%2021.5V16zm7-11v1l-3%201.5%204%205.5-1%201-5.5-4L6%2013H5V7.5C5%205.75%205.75%205%207.5%205zm11%202.5c0-1.75-.75-2.5-2.5-2.5H16v1l3%201.5-4%205.5%201%201%205.5-4%201.5%203h1z%22%2F%3E%3C%2Fsvg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2229%22%20height%3D%2229%22%20viewBox%3D%220%200%2029%2029%22%3E%3Cpath%20d%3D%22M18.5%2016c-1.75%200-2.5.75-2.5%202.5V24h1l1.5-3%205.5%204%201-1-4-5.5%203-1.5v-1zM13%2018.5c0-1.75-.75-2.5-2.5-2.5H5v1l3%201.5L4%2024l1%201%205.5-4%201.5%203h1zm3-8c0%201.75.75%202.5%202.5%202.5H24v-1l-3-1.5L25%205l-1-1-5.5%204L17%205h-1zM10.5%2013c1.75%200%202.5-.75%202.5-2.5V5h-1l-1.5%203L5%204%204%205l4%205.5L5%2012v1z%22%2F%3E%3C%2Fsvg%3E")}}.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2229%22%20height%3D%2229%22%20fill%3D%22%23333%22%20viewBox%3D%220%200%2029%2029%22%3E%3Cpath%20d%3D%22m10.5%2014%204-8%204%208z%22%2F%3E%3Cpath%20fill%3D%22%23ccc%22%20d%3D%22m10.5%2016%204%208%204-8z%22%2F%3E%3C%2Fsvg%3E")}@media (forced-colors:active){.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2229%22%20height%3D%2229%22%20fill%3D%22%23fff%22%20viewBox%3D%220%200%2029%2029%22%3E%3Cpath%20d%3D%22m10.5%2014%204-8%204%208z%22%2F%3E%3Cpath%20fill%3D%22%23ccc%22%20d%3D%22m10.5%2016%204%208%204-8z%22%2F%3E%3C%2Fsvg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2229%22%20height%3D%2229%22%20viewBox%3D%220%200%2029%2029%22%3E%3Cpath%20d%3D%22m10.5%2014%204-8%204%208z%22%2F%3E%3Cpath%20fill%3D%22%23ccc%22%20d%3D%22m10.5%2016%204%208%204-8z%22%2F%3E%3C%2Fsvg%3E")}}.maplibregl-ctrl button.maplibregl-ctrl-globe .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2222%22%20height%3D%2222%22%20fill%3D%22none%22%20stroke%3D%22%23333%22%20viewBox%3D%220%200%2022%2022%22%3E%3Ccircle%20cx%3D%2211%22%20cy%3D%2211%22%20r%3D%228.5%22%2F%3E%3Cpath%20d%3D%22M17.5%2011c0%204.819-3.02%208.5-6.5%208.5S4.5%2015.819%204.5%2011%207.52%202.5%2011%202.5s6.5%203.681%206.5%208.5Z%22%2F%3E%3Cpath%20d%3D%22M13.5%2011c0%202.447-.331%204.64-.853%206.206-.262.785-.562%201.384-.872%201.777-.314.399-.58.517-.775.517s-.461-.118-.775-.517c-.31-.393-.61-.992-.872-1.777C8.831%2015.64%208.5%2013.446%208.5%2011s.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%201.777.522%201.565.853%203.76.853%206.206Z%22%2F%3E%3Cpath%20d%3D%22M11%207.5c-1.909%200-3.622-.166-4.845-.428-.616-.132-1.08-.283-1.379-.434a1.3%201.3%200%200%201-.224-.138q.07-.058.224-.138c.299-.151.763-.302%201.379-.434C7.378%205.666%209.091%205.5%2011%205.5s3.622.166%204.845.428c.616.132%201.08.283%201.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.428Zm0%209c-1.909%200-3.622-.166-4.845-.428-.616-.132-1.08-.283-1.379-.434a1.3%201.3%200%200%201-.224-.138%201.3%201.3%200%200%201%20.224-.138c.299-.151.763-.302%201.379-.434C7.378%2014.666%209.091%2014.5%2011%2014.5s3.622.166%204.845.428c.616.132%201.08.283%201.379.434.105.053.177.1.224.138a1.3%201.3%200%200%201-.224.138c-.299.151-.763.302-1.379.434-1.223.262-2.936.428-4.845.428Zm0-4c-2.46%200-4.672-.222-6.255-.574-.796-.177-1.406-.38-1.805-.59a1.5%201.5%200%200%201-.39-.272.3.3%200%200%201-.047-.064.3.3%200%200%201%20.048-.064c.066-.073.189-.167.389-.272.399-.21%201.009-.413%201.805-.59C6.328%209.722%208.54%209.5%2011%209.5s4.672.222%206.256.574c.795.177%201.405.38%201.804.59.2.105.323.2.39.272a.3.3%200%200%201%20.047.064.3.3%200%200%201-.048.064%201.4%201.4%200%200%201-.389.272c-.399.21-1.009.413-1.804.59-1.584.352-3.796.574-6.256.574Zm-8.501-1.51v.002zm0%20.018v.002zm17.002.002v-.002zm0-.018v-.002z%22%2F%3E%3C%2Fsvg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-globe-enabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2222%22%20height%3D%2222%22%20fill%3D%22none%22%20stroke%3D%22%2333b5e5%22%20viewBox%3D%220%200%2022%2022%22%3E%3Ccircle%20cx%3D%2211%22%20cy%3D%2211%22%20r%3D%228.5%22%2F%3E%3Cpath%20d%3D%22M17.5%2011c0%204.819-3.02%208.5-6.5%208.5S4.5%2015.819%204.5%2011%207.52%202.5%2011%202.5s6.5%203.681%206.5%208.5Z%22%2F%3E%3Cpath%20d%3D%22M13.5%2011c0%202.447-.331%204.64-.853%206.206-.262.785-.562%201.384-.872%201.777-.314.399-.58.517-.775.517s-.461-.118-.775-.517c-.31-.393-.61-.992-.872-1.777C8.831%2015.64%208.5%2013.446%208.5%2011s.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%201.777.522%201.565.853%203.76.853%206.206Z%22%2F%3E%3Cpath%20d%3D%22M11%207.5c-1.909%200-3.622-.166-4.845-.428-.616-.132-1.08-.283-1.379-.434a1.3%201.3%200%200%201-.224-.138q.07-.058.224-.138c.299-.151.763-.302%201.379-.434C7.378%205.666%209.091%205.5%2011%205.5s3.622.166%204.845.428c.616.132%201.08.283%201.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.428Zm0%209c-1.909%200-3.622-.166-4.845-.428-.616-.132-1.08-.283-1.379-.434a1.3%201.3%200%200%201-.224-.138%201.3%201.3%200%200%201%20.224-.138c.299-.151.763-.302%201.379-.434C7.378%2014.666%209.091%2014.5%2011%2014.5s3.622.166%204.845.428c.616.132%201.08.283%201.379.434.105.053.177.1.224.138a1.3%201.3%200%200%201-.224.138c-.299.151-.763.302-1.379.434-1.223.262-2.936.428-4.845.428Zm0-4c-2.46%200-4.672-.222-6.255-.574-.796-.177-1.406-.38-1.805-.59a1.5%201.5%200%200%201-.39-.272.3.3%200%200%201-.047-.064.3.3%200%200%201%20.048-.064c.066-.073.189-.167.389-.272.399-.21%201.009-.413%201.805-.59C6.328%209.722%208.54%209.5%2011%209.5s4.672.222%206.256.574c.795.177%201.405.38%201.804.59.2.105.323.2.39.272a.3.3%200%200%201%20.047.064.3.3%200%200%201-.048.064%201.4%201.4%200%200%201-.389.272c-.399.21-1.009.413-1.804.59-1.584.352-3.796.574-6.256.574Zm-8.501-1.51v.002zm0%20.018v.002zm17.002.002v-.002zm0-.018v-.002z%22%2F%3E%3C%2Fsvg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-terrain .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2222%22%20height%3D%2222%22%20fill%3D%22%23333%22%20viewBox%3D%220%200%2022%2022%22%3E%3Cpath%20d%3D%22m1.754%2013.406%204.453-4.851%203.09%203.09%203.281%203.277.969-.969-3.309-3.312%203.844-4.121%206.148%206.886h1.082v-.855l-7.207-8.07-4.84%205.187L6.169%206.57l-5.48%205.965v.871ZM.688%2016.844h20.625v1.375H.688Zm0%200%22%2F%3E%3C%2Fsvg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-terrain-enabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2222%22%20height%3D%2222%22%20fill%3D%22%2333b5e5%22%20viewBox%3D%220%200%2022%2022%22%3E%3Cpath%20d%3D%22m1.754%2013.406%204.453-4.851%203.09%203.09%203.281%203.277.969-.969-3.309-3.312%203.844-4.121%206.148%206.886h1.082v-.855l-7.207-8.07-4.84%205.187L6.169%206.57l-5.48%205.965v.871ZM.688%2016.844h20.625v1.375H.688Zm0%200%22%2F%3E%3C%2Fsvg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2229%22%20height%3D%2229%22%20fill%3D%22%23333%22%20viewBox%3D%220%200%2020%2020%22%3E%3Cpath%20d%3D%22M10%204C9%204%209%205%209%205v.1A5%205%200%200%200%205.1%209H5s-1%200-1%201%201%201%201%201h.1A5%205%200%200%200%209%2014.9v.1s0%201%201%201%201-1%201-1v-.1a5%205%200%200%200%203.9-3.9h.1s1%200%201-1-1-1-1-1h-.1A5%205%200%200%200%2011%205.1V5s0-1-1-1m0%202.5a3.5%203.5%200%201%201%200%207%203.5%203.5%200%201%201%200-7%22%2F%3E%3Ccircle%20cx%3D%2210%22%20cy%3D%2210%22%20r%3D%222%22%2F%3E%3C%2Fsvg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2229%22%20height%3D%2229%22%20fill%3D%22%23aaa%22%20viewBox%3D%220%200%2020%2020%22%3E%3Cpath%20d%3D%22M10%204C9%204%209%205%209%205v.1A5%205%200%200%200%205.1%209H5s-1%200-1%201%201%201%201%201h.1A5%205%200%200%200%209%2014.9v.1s0%201%201%201%201-1%201-1v-.1a5%205%200%200%200%203.9-3.9h.1s1%200%201-1-1-1-1-1h-.1A5%205%200%200%200%2011%205.1V5s0-1-1-1m0%202.5a3.5%203.5%200%201%201%200%207%203.5%203.5%200%201%201%200-7%22%2F%3E%3Ccircle%20cx%3D%2210%22%20cy%3D%2210%22%20r%3D%222%22%2F%3E%3Cpath%20fill%3D%22red%22%20d%3D%22m14%205%201%201-9%209-1-1z%22%2F%3E%3C%2Fsvg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2229%22%20height%3D%2229%22%20fill%3D%22%2333b5e5%22%20viewBox%3D%220%200%2020%2020%22%3E%3Cpath%20d%3D%22M10%204C9%204%209%205%209%205v.1A5%205%200%200%200%205.1%209H5s-1%200-1%201%201%201%201%201h.1A5%205%200%200%200%209%2014.9v.1s0%201%201%201%201-1%201-1v-.1a5%205%200%200%200%203.9-3.9h.1s1%200%201-1-1-1-1-1h-.1A5%205%200%200%200%2011%205.1V5s0-1-1-1m0%202.5a3.5%203.5%200%201%201%200%207%203.5%203.5%200%201%201%200-7%22%2F%3E%3Ccircle%20cx%3D%2210%22%20cy%3D%2210%22%20r%3D%222%22%2F%3E%3C%2Fsvg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2229%22%20height%3D%2229%22%20fill%3D%22%23e58978%22%20viewBox%3D%220%200%2020%2020%22%3E%3Cpath%20d%3D%22M10%204C9%204%209%205%209%205v.1A5%205%200%200%200%205.1%209H5s-1%200-1%201%201%201%201%201h.1A5%205%200%200%200%209%2014.9v.1s0%201%201%201%201-1%201-1v-.1a5%205%200%200%200%203.9-3.9h.1s1%200%201-1-1-1-1-1h-.1A5%205%200%200%200%2011%205.1V5s0-1-1-1m0%202.5a3.5%203.5%200%201%201%200%207%203.5%203.5%200%201%201%200-7%22%2F%3E%3Ccircle%20cx%3D%2210%22%20cy%3D%2210%22%20r%3D%222%22%2F%3E%3C%2Fsvg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2229%22%20height%3D%2229%22%20fill%3D%22%2333b5e5%22%20viewBox%3D%220%200%2020%2020%22%3E%3Cpath%20d%3D%22M10%204C9%204%209%205%209%205v.1A5%205%200%200%200%205.1%209H5s-1%200-1%201%201%201%201%201h.1A5%205%200%200%200%209%2014.9v.1s0%201%201%201%201-1%201-1v-.1a5%205%200%200%200%203.9-3.9h.1s1%200%201-1-1-1-1-1h-.1A5%205%200%200%200%2011%205.1V5s0-1-1-1m0%202.5a3.5%203.5%200%201%201%200%207%203.5%203.5%200%201%201%200-7%22%2F%3E%3C%2Fsvg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2229%22%20height%3D%2229%22%20fill%3D%22%23e54e33%22%20viewBox%3D%220%200%2020%2020%22%3E%3Cpath%20d%3D%22M10%204C9%204%209%205%209%205v.1A5%205%200%200%200%205.1%209H5s-1%200-1%201%201%201%201%201h.1A5%205%200%200%200%209%2014.9v.1s0%201%201%201%201-1%201-1v-.1a5%205%200%200%200%203.9-3.9h.1s1%200%201-1-1-1-1-1h-.1A5%205%200%200%200%2011%205.1V5s0-1-1-1m0%202.5a3.5%203.5%200%201%201%200%207%203.5%203.5%200%201%201%200-7%22%2F%3E%3C%2Fsvg%3E")}.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("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2229%22%20height%3D%2229%22%20fill%3D%22%23fff%22%20viewBox%3D%220%200%2020%2020%22%3E%3Cpath%20d%3D%22M10%204C9%204%209%205%209%205v.1A5%205%200%200%200%205.1%209H5s-1%200-1%201%201%201%201%201h.1A5%205%200%200%200%209%2014.9v.1s0%201%201%201%201-1%201-1v-.1a5%205%200%200%200%203.9-3.9h.1s1%200%201-1-1-1-1-1h-.1A5%205%200%200%200%2011%205.1V5s0-1-1-1m0%202.5a3.5%203.5%200%201%201%200%207%203.5%203.5%200%201%201%200-7%22%2F%3E%3Ccircle%20cx%3D%2210%22%20cy%3D%2210%22%20r%3D%222%22%2F%3E%3C%2Fsvg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2229%22%20height%3D%2229%22%20fill%3D%22%23999%22%20viewBox%3D%220%200%2020%2020%22%3E%3Cpath%20d%3D%22M10%204C9%204%209%205%209%205v.1A5%205%200%200%200%205.1%209H5s-1%200-1%201%201%201%201%201h.1A5%205%200%200%200%209%2014.9v.1s0%201%201%201%201-1%201-1v-.1a5%205%200%200%200%203.9-3.9h.1s1%200%201-1-1-1-1-1h-.1A5%205%200%200%200%2011%205.1V5s0-1-1-1m0%202.5a3.5%203.5%200%201%201%200%207%203.5%203.5%200%201%201%200-7%22%2F%3E%3Ccircle%20cx%3D%2210%22%20cy%3D%2210%22%20r%3D%222%22%2F%3E%3Cpath%20fill%3D%22red%22%20d%3D%22m14%205%201%201-9%209-1-1z%22%2F%3E%3C%2Fsvg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2229%22%20height%3D%2229%22%20fill%3D%22%2333b5e5%22%20viewBox%3D%220%200%2020%2020%22%3E%3Cpath%20d%3D%22M10%204C9%204%209%205%209%205v.1A5%205%200%200%200%205.1%209H5s-1%200-1%201%201%201%201%201h.1A5%205%200%200%200%209%2014.9v.1s0%201%201%201%201-1%201-1v-.1a5%205%200%200%200%203.9-3.9h.1s1%200%201-1-1-1-1-1h-.1A5%205%200%200%200%2011%205.1V5s0-1-1-1m0%202.5a3.5%203.5%200%201%201%200%207%203.5%203.5%200%201%201%200-7%22%2F%3E%3Ccircle%20cx%3D%2210%22%20cy%3D%2210%22%20r%3D%222%22%2F%3E%3C%2Fsvg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2229%22%20height%3D%2229%22%20fill%3D%22%23e58978%22%20viewBox%3D%220%200%2020%2020%22%3E%3Cpath%20d%3D%22M10%204C9%204%209%205%209%205v.1A5%205%200%200%200%205.1%209H5s-1%200-1%201%201%201%201%201h.1A5%205%200%200%200%209%2014.9v.1s0%201%201%201%201-1%201-1v-.1a5%205%200%200%200%203.9-3.9h.1s1%200%201-1-1-1-1-1h-.1A5%205%200%200%200%2011%205.1V5s0-1-1-1m0%202.5a3.5%203.5%200%201%201%200%207%203.5%203.5%200%201%201%200-7%22%2F%3E%3Ccircle%20cx%3D%2210%22%20cy%3D%2210%22%20r%3D%222%22%2F%3E%3C%2Fsvg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2229%22%20height%3D%2229%22%20fill%3D%22%2333b5e5%22%20viewBox%3D%220%200%2020%2020%22%3E%3Cpath%20d%3D%22M10%204C9%204%209%205%209%205v.1A5%205%200%200%200%205.1%209H5s-1%200-1%201%201%201%201%201h.1A5%205%200%200%200%209%2014.9v.1s0%201%201%201%201-1%201-1v-.1a5%205%200%200%200%203.9-3.9h.1s1%200%201-1-1-1-1-1h-.1A5%205%200%200%200%2011%205.1V5s0-1-1-1m0%202.5a3.5%203.5%200%201%201%200%207%203.5%203.5%200%201%201%200-7%22%2F%3E%3C%2Fsvg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2229%22%20height%3D%2229%22%20fill%3D%22%23e54e33%22%20viewBox%3D%220%200%2020%2020%22%3E%3Cpath%20d%3D%22M10%204C9%204%209%205%209%205v.1A5%205%200%200%200%205.1%209H5s-1%200-1%201%201%201%201%201h.1A5%205%200%200%200%209%2014.9v.1s0%201%201%201%201-1%201-1v-.1a5%205%200%200%200%203.9-3.9h.1s1%200%201-1-1-1-1-1h-.1A5%205%200%200%200%2011%205.1V5s0-1-1-1m0%202.5a3.5%203.5%200%201%201%200%207%203.5%203.5%200%201%201%200-7%22%2F%3E%3C%2Fsvg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2229%22%20height%3D%2229%22%20viewBox%3D%220%200%2020%2020%22%3E%3Cpath%20d%3D%22M10%204C9%204%209%205%209%205v.1A5%205%200%200%200%205.1%209H5s-1%200-1%201%201%201%201%201h.1A5%205%200%200%200%209%2014.9v.1s0%201%201%201%201-1%201-1v-.1a5%205%200%200%200%203.9-3.9h.1s1%200%201-1-1-1-1-1h-.1A5%205%200%200%200%2011%205.1V5s0-1-1-1m0%202.5a3.5%203.5%200%201%201%200%207%203.5%203.5%200%201%201%200-7%22%2F%3E%3Ccircle%20cx%3D%2210%22%20cy%3D%2210%22%20r%3D%222%22%2F%3E%3C%2Fsvg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2229%22%20height%3D%2229%22%20fill%3D%22%23666%22%20viewBox%3D%220%200%2020%2020%22%3E%3Cpath%20d%3D%22M10%204C9%204%209%205%209%205v.1A5%205%200%200%200%205.1%209H5s-1%200-1%201%201%201%201%201h.1A5%205%200%200%200%209%2014.9v.1s0%201%201%201%201-1%201-1v-.1a5%205%200%200%200%203.9-3.9h.1s1%200%201-1-1-1-1-1h-.1A5%205%200%200%200%2011%205.1V5s0-1-1-1m0%202.5a3.5%203.5%200%201%201%200%207%203.5%203.5%200%201%201%200-7%22%2F%3E%3Ccircle%20cx%3D%2210%22%20cy%3D%2210%22%20r%3D%222%22%2F%3E%3Cpath%20fill%3D%22red%22%20d%3D%22m14%205%201%201-9%209-1-1z%22%2F%3E%3C%2Fsvg%3E")}}@keyframes maplibregl-spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}a.maplibregl-ctrl-logo{width:88px;height:23px;margin:0 0 -4px -4px;display:block;background-repeat:no-repeat;cursor:pointer;overflow:hidden;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2288%22%20height%3D%2223%22%20fill%3D%22none%22%3E%3Cpath%20fill%3D%22%23000%22%20fill-opacity%3D%22.4%22%20fill-rule%3D%22evenodd%22%20d%3D%22M17.408%2016.796h-1.827l2.501-12.095h.198l3.324%206.533.988%202.19.988-2.19%203.258-6.533h.181l2.6%2012.095h-1.81l-1.218-5.644-.362-1.71-.658%201.71-2.929%205.644h-.098l-2.914-5.644-.757-1.71-.345%201.71zm1.958-3.42-.726%203.663a1.255%201.255%200%200%201-1.232%201.011h-1.827a1.255%201.255%200%200%201-1.229-1.509l2.501-12.095a1.255%201.255%200%200%201%201.23-1.001h.197a1.25%201.25%200%200%201%201.12.685l3.19%206.273%203.125-6.263a1.25%201.25%200%200%201%201.123-.695h.181a1.255%201.255%200%200%201%201.227.991l1.443%206.71a5%205%200%200%201%20.314-.787l.009-.016a4.6%204.6%200%200%201%201.777-1.887c.782-.46%201.668-.667%202.611-.667a4.6%204.6%200%200%201%201.7.32l.306.134c.21-.16.474-.256.759-.256h1.694a1.255%201.255%200%200%201%201.212.925%201.255%201.255%200%200%201%201.212-.925h1.711c.284%200%20.545.094.755.252.613-.3%201.312-.45%202.075-.45%201.356%200%202.557.445%203.482%201.4q.47.48.763%201.064V4.701a1.255%201.255%200%200%201%201.255-1.255h1.86A1.255%201.255%200%200%201%2054.44%204.7v9.194h2.217c.19%200%20.37.043.532.118v-4.77c0-.356.147-.678.385-.906a2.42%202.42%200%200%201-.682-1.71c0-.665.267-1.253.735-1.7a2.45%202.45%200%200%201%201.722-.674%202.43%202.43%200%200%201%201.705.675q.318.302.504.683V4.7a1.255%201.255%200%200%201%201.255-1.255h1.744A1.255%201.255%200%200%201%2065.812%204.7v3.335a4.8%204.8%200%200%201%201.526-.246c.938%200%201.817.214%202.59.69a4.47%204.47%200%200%201%201.67%201.743v-.98a1.255%201.255%200%200%201%201.256-1.256h1.777c.233%200%20.451.064.639.174a3.4%203.4%200%200%201%201.567-.372c.346%200%20.861.02%201.285.232a1.25%201.25%200%200%201%20.689%201.004%204.7%204.7%200%200%201%20.853-.588c.795-.44%201.675-.647%202.61-.647%201.385%200%202.65.39%203.525%201.396.836.938%201.168%202.173%201.168%203.528q-.001.515-.056%201.051a1.255%201.255%200%200%201-.947%201.09l.408.952a1.255%201.255%200%200%201-.477%201.552c-.418.268-.92.463-1.458.612-.613.171-1.304.244-2.049.244-1.06%200-2.043-.207-2.886-.698l-.015-.008c-.798-.48-1.419-1.135-1.818-1.963l-.004-.008a5.8%205.8%200%200%201-.548-2.512q0-.429.053-.843a1.3%201.3%200%200%201-.333-.086l-.166-.004c-.223%200-.426.062-.643.228-.03.024-.142.139-.142.59v3.883a1.255%201.255%200%200%201-1.256%201.256h-1.777a1.255%201.255%200%200%201-1.256-1.256V15.69l-.032.057a4.8%204.8%200%200%201-1.86%201.833%205.04%205.04%200%200%201-2.484.634%204.5%204.5%200%200%201-1.935-.424%201.25%201.25%200%200%201-.764.258h-1.71a1.255%201.255%200%200%201-1.256-1.255V7.687a2.4%202.4%200%200%201-.428.625c.253.23.412.561.412.93v7.553a1.255%201.255%200%200%201-1.256%201.255h-1.843a1.25%201.25%200%200%201-.894-.373c-.228.23-.544.373-.894.373H51.32a1.255%201.255%200%200%201-1.256-1.255v-1.251l-.061.117a4.7%204.7%200%200%201-1.782%201.884%204.77%204.77%200%200%201-2.485.67%205.6%205.6%200%200%201-1.485-.188l.009%202.764a1.255%201.255%200%200%201-1.255%201.259h-1.729a1.255%201.255%200%200%201-1.255-1.255v-3.537a1.255%201.255%200%200%201-1.167.793h-1.679a1.25%201.25%200%200%201-.77-.263%204.5%204.5%200%200%201-1.945.429c-.885%200-1.724-.21-2.495-.632l-.017-.01a5%205%200%200%201-1.081-.836%201.255%201.255%200%200%201-1.254%201.312h-1.81a1.255%201.255%200%200%201-1.228-.99l-.782-3.625-2.044%203.939a1.25%201.25%200%200%201-1.115.676h-.098a1.25%201.25%200%200%201-1.116-.68l-2.061-3.994zM35.92%2016.63l.207-.114.223-.15q.493-.356.735-.785l.061-.118.033%201.332h1.678V9.242h-1.694l-.033%201.267q-.133-.329-.526-.658l-.032-.028a3.2%203.2%200%200%200-.668-.428l-.27-.12a3.3%203.3%200%200%200-1.235-.23q-1.136-.001-1.974.493a3.36%203.36%200%200%200-1.3%201.382q-.445.89-.444%202.074%200%201.2.51%202.107a3.8%203.8%200%200%200%201.382%201.381%203.9%203.9%200%200%200%201.893.477q.795%200%201.455-.33zm-2.789-5.38q-.576.675-.575%201.762%200%201.102.559%201.794.576.675%201.645.675a2.25%202.25%200%200%200%20.934-.19%202.2%202.2%200%200%200%20.468-.29l.178-.161a2.2%202.2%200%200%200%20.397-.561q.244-.5.244-1.15v-.115q0-.708-.296-1.267l-.043-.077a2.2%202.2%200%200%200-.633-.709l-.13-.086-.047-.028a2.1%202.1%200%200%200-1.073-.285q-1.052%200-1.629.692zm2.316%202.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.96.96%200%200%200-.353-.389.85.85%200%200%200-.464-.127c-.4%200-.56.114-.664.239l-.01.012c-.148.174-.275.45-.275.945%200%20.506.122.801.27.99.097.11.266.224.68.224.303%200%20.504-.09.687-.269zm7.545%201.705a2.6%202.6%200%200%200%20.331.423q.319.33.755.548l.173.074q.65.255%201.49.255%201.02%200%201.844-.493a3.45%203.45%200%200%200%201.316-1.4q.493-.904.493-2.089%200-1.909-.988-2.913-.988-1.02-2.584-1.02-.898%200-1.575.347a3%203%200%200%200-.415.262l-.199.166a3.4%203.4%200%200%200-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138q.206.29.48.5l.155.11.053.034q.51.296%201.119.297%201.07%200%201.645-.675.577-.69.576-1.762%200-1.119-.576-1.777-.558-.675-1.645-.675-.435%200-.835.16a2%202%200%200%200-.284.136%202%202%200%200%200-.363.254%202.2%202.2%200%200%200-.46.569l-.082.162a2.6%202.6%200%200%200-.213%201.072v.115q0%20.707.296%201.267l.135.211zm.964-.818a1.1%201.1%200%200%200%20.367.385.94.94%200%200%200%20.476.118c.423%200%20.59-.117.687-.23.159-.194.28-.478.28-.95%200-.53-.133-.8-.266-.952l-.021-.025c-.078-.094-.231-.221-.68-.221a1%201%200%200%200-.503.135l-.012.007a.86.86%200%200%200-.335.343c-.073.133-.132.324-.132.614v.115a1.4%201.4%200%200%200%20.14.66zm15.7-6.222q.347-.346.346-.856a1.05%201.05%200%200%200-.345-.79%201.18%201.18%200%200%200-.84-.329q-.51%200-.855.33a1.05%201.05%200%200%200-.346.79q0%20.51.346.855.345.346.856.346.51%200%20.839-.346zm4.337%209.314.033-1.332q.191.403.59.747l.098.081a4%204%200%200%200%20.316.224l.223.122a3.2%203.2%200%200%200%201.44.322%203.8%203.8%200%200%200%201.875-.477%203.5%203.5%200%200%200%201.382-1.366q.527-.89.526-2.09%200-1.184-.444-2.073a3.24%203.24%200%200%200-1.283-1.399q-.823-.51-1.942-.51a3.5%203.5%200%200%200-1.527.344l-.086.043-.165.09a3%203%200%200%200-.33.214q-.432.315-.656.707a2%202%200%200%200-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.5%202.5%200%200%200%20.566.7q.117.098.245.18l.144.08a2.1%202.1%200%200%200%20.975.232q1.07%200%201.645-.675.576-.69.576-1.778%200-1.102-.576-1.777-.56-.691-1.645-.692a2.2%202.2%200%200%200-1.015.235q-.22.113-.415.282l-.15.142a2.1%202.1%200%200%200-.42.594q-.223.479-.223%201.1v.115q0%20.705.293%201.26zm2.616-.293c.157-.191.28-.479.28-.967%200-.51-.13-.79-.276-.961l-.021-.026c-.082-.1-.232-.225-.67-.225a.87.87%200%200%200-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0%20.285.057.499.144.669a1.1%201.1%200%200%200%20.367.405c.137.082.28.123.455.123.423%200%20.59-.118.686-.23zm8.266-3.013q.345-.13.724-.14l.069-.002q.493%200%20.642.099l.247-1.794q-.196-.099-.717-.099a2.3%202.3%200%200%200-.545.063%202%202%200%200%200-.411.148%202.2%202.2%200%200%200-.4.249%202.5%202.5%200%200%200-.485.499%202.7%202.7%200%200%200-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884q0-.546.159-.943a1.5%201.5%200%200%201%20.466-.636%202.5%202.5%200%200%201%20.399-.253%202%202%200%200%201%20.224-.099zm9.784%202.656.05-.922q0-1.743-.856-2.698-.838-.97-2.584-.97-1.119-.001-2.007.493a3.46%203.46%200%200%200-1.4%201.382q-.493.906-.493%202.106%200%201.07.428%201.975.428.89%201.332%201.432.906.526%202.255.526.973%200%201.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%200-1.497-.444a1.6%201.6%200%200%201-.192-.193q-.366-.44-.512-1.234l-.004-.021zm-5.427-1.256-.003.022h3.752v-.138q-.011-.727-.288-1.118a1%201%200%200%200-.156-.176q-.46-.428-1.316-.428-.986%200-1.494.604-.379.45-.494%201.234zm-27.053%202.77V4.7h-1.86v12.095h5.333V15.15zm7.103-5.908v7.553h-1.843V9.242h1.843z%22%2F%3E%3Cpath%20fill%3D%22%23fff%22%20d%3D%22m19.63%2011.151-.757-1.71-.345%201.71-1.12%205.644h-1.827L18.083%204.7h.197l3.325%206.533.988%202.19.988-2.19L26.839%204.7h.181l2.6%2012.095h-1.81l-1.218-5.644-.362-1.71-.658%201.71-2.93%205.644h-.098l-2.913-5.644zm14.836%205.81q-1.02%200-1.893-.478a3.8%203.8%200%200%201-1.381-1.382q-.51-.906-.51-2.106%200-1.185.444-2.074a3.36%203.36%200%200%201%201.3-1.382q.839-.494%201.974-.494a3.3%203.3%200%200%201%201.234.231%203.3%203.3%200%200%201%20.97.575q.396.33.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332q-.279.593-1.02%201.053a3.17%203.17%200%200%201-1.662.444zm.296-1.482q.938%200%201.58-.642.642-.66.642-1.711v-.115q0-.708-.296-1.267a2.2%202.2%200%200%200-.807-.872%202.1%202.1%200%200%200-1.119-.313q-1.053%200-1.629.692-.575.675-.575%201.76%200%201.103.559%201.795.577.675%201.645.675zm6.521-6.237h1.711v1.4q.906-1.597%202.83-1.597%201.596%200%202.584%201.02.988%201.005.988%202.914%200%201.185-.493%202.09a3.46%203.46%200%200%201-1.316%201.399%203.5%203.5%200%200%201-1.844.493q-.954%200-1.662-.329a2.67%202.67%200%200%201-1.086-.97l.017%205.134h-1.728zm4.048%206.22q1.07%200%201.645-.674.577-.69.576-1.762%200-1.119-.576-1.777-.558-.675-1.645-.675-.592%200-1.12.296-.51.28-.822.823-.296.527-.296%201.234v.115q0%20.708.296%201.267.313.543.823.855.51.296%201.119.297z%22%2F%3E%3Cpath%20fill%3D%22%23e1e3e9%22%20d%3D%22M51.325%204.7h1.86v10.45h3.473v1.646h-5.333zm7.12%204.542h1.843v7.553h-1.843zm.905-1.415a1.16%201.16%200%200%201-.856-.346%201.17%201.17%200%200%201-.346-.856%201.05%201.05%200%200%201%20.346-.79q.346-.329.856-.329.494%200%20.839.33a1.05%201.05%200%200%201%20.345.79%201.16%201.16%200%200%201-.345.855q-.33.346-.84.346zm7.875%209.133a3.17%203.17%200%200%201-1.662-.444q-.723-.46-1.004-1.053l-.033%201.332h-1.71V4.701h1.743v4.657l-.082%201.283q.279-.658%201.086-1.119a3.5%203.5%200%200%201%201.778-.477q1.119%200%201.942.51a3.24%203.24%200%200%201%201.283%201.4q.445.888.444%202.072%200%201.201-.526%202.09a3.5%203.5%200%200%201-1.382%201.366%203.8%203.8%200%200%201-1.876.477zm-.296-1.481q1.069%200%201.645-.675.577-.69.577-1.778%200-1.102-.577-1.776-.56-.691-1.645-.692a2.12%202.12%200%200%200-1.58.659q-.642.641-.642%201.694v.115q0%20.71.296%201.267a2.4%202.4%200%200%200%20.807.872%202.1%202.1%200%200%200%201.119.313zm5.927-6.237h1.777v1.481q.263-.757.856-1.217a2.14%202.14%200%200%201%201.349-.46q.527%200%20.724.098l-.247%201.794q-.149-.099-.642-.099-.774%200-1.416.494-.626.493-.626%201.58v3.883h-1.777V9.242zm9.534%207.718q-1.35%200-2.255-.526-.904-.543-1.332-1.432a4.6%204.6%200%200%201-.428-1.975q0-1.2.493-2.106a3.46%203.46%200%200%201%201.4-1.382q.889-.495%202.007-.494%201.744%200%202.584.97.855.956.856%202.7%200%20.444-.05.92h-5.43q.18%201.005.708%201.45.542.443%201.497.443.79%200%201.3-.131a4%204%200%200%200%20.938-.362l.542%201.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%200-1.991%201.86z%22%2F%3E%3Cpath%20d%3D%22M5.074%2015.948a.484.657%200%200%200-.486.659v1.84a.484.657%200%200%200%20.486.659h4.101a.484.657%200%200%200%20.486-.659v-1.84a.484.657%200%200%200-.486-.659zm3.56%201.16H5.617v.838h3.017z%22%20style%3D%22fill%3A%23fff%3Bfill-rule%3Aevenodd%3Bstroke-width%3A1.03600001%22%2F%3E%3Cg%20style%3D%22stroke-width%3A1.12603545%22%3E%3Cpath%20d%3D%22M-9.408-1.416c-3.833-.025-7.056%202.912-7.08%206.615-.02%203.08%201.653%204.832%203.107%206.268.903.892%201.721%201.74%202.32%202.902l-.525-.004c-.543-.003-.992.304-1.24.639a1.87%201.87%200%200%200-.362%201.121l-.011%201.877c-.003.402.104.787.347%201.125.244.338.688.653%201.23.656l4.142.028c.542.003.99-.306%201.238-.641a1.87%201.87%200%200%200%20.363-1.121l.012-1.875a1.87%201.87%200%200%200-.348-1.127c-.243-.338-.688-.653-1.23-.656l-.518-.004c.597-1.145%201.425-1.983%202.348-2.87%201.473-1.414%203.18-3.149%203.2-6.226-.016-3.59-2.923-6.684-6.993-6.707m-.006%201.1v.002c3.274.02%205.92%202.532%205.9%205.6-.017%202.706-1.39%204.026-2.863%205.44-1.034.994-2.118%202.033-2.814%203.633-.018.041-.052.055-.075.065q-.013.004-.02.01a.34.34%200%200%201-.226.084.34.34%200%200%201-.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%202.7-5.545%205.975-5.523m-.02%202.826c-1.62-.01-2.944%201.315-2.955%202.96-.01%201.646%201.295%202.988%202.916%202.999h.002c1.621.01%202.943-1.316%202.953-2.961.011-1.646-1.294-2.988-2.916-2.998m-.005%201.1c1.017.006%201.829.83%201.822%201.89s-.83%201.874-1.848%201.867c-1.018-.006-1.829-.83-1.822-1.89s.83-1.874%201.848-1.868m-2.155%2011.857%204.14.025c.271.002.49.305.487.676l-.013%201.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%22%20style%3D%22color%3A%23000%3Bfont-style%3Anormal%3Bfont-variant%3Anormal%3Bfont-weight%3A400%3Bfont-stretch%3Anormal%3Bfont-size%3Amedium%3Bline-height%3Anormal%3Bfont-family%3Asans-serif%3Bfont-variant-ligatures%3Anormal%3Bfont-variant-position%3Anormal%3Bfont-variant-caps%3Anormal%3Bfont-variant-numeric%3Anormal%3Bfont-variant-alternates%3Anormal%3Bfont-feature-settings%3Anormal%3Btext-indent%3A0%3Btext-align%3Astart%3Btext-decoration%3Anone%3Btext-decoration-line%3Anone%3Btext-decoration-style%3Asolid%3Btext-decoration-color%3A%23000%3Bletter-spacing%3Anormal%3Bword-spacing%3Anormal%3Btext-transform%3Anone%3Bwriting-mode%3Alr-tb%3Bdirection%3Altr%3Btext-orientation%3Amixed%3Bdominant-baseline%3Aauto%3Bbaseline-shift%3Abaseline%3Btext-anchor%3Astart%3Bwhite-space%3Anormal%3Bshape-padding%3A0%3Bclip-rule%3Aevenodd%3Bdisplay%3Ainline%3Boverflow%3Avisible%3Bvisibility%3Avisible%3Bopacity%3A1%3Bisolation%3Aauto%3Bmix-blend-mode%3Anormal%3Bcolor-interpolation%3AsRGB%3Bcolor-interpolation-filters%3AlinearRGB%3Bsolid-color%3A%23000%3Bsolid-opacity%3A1%3Bvector-effect%3Anone%3Bfill%3A%23000%3Bfill-opacity%3A.4%3Bfill-rule%3Aevenodd%3Bstroke%3Anone%3Bstroke-width%3A2.47727823%3Bstroke-linecap%3Abutt%3Bstroke-linejoin%3Amiter%3Bstroke-miterlimit%3A4%3Bstroke-dasharray%3Anone%3Bstroke-dashoffset%3A0%3Bstroke-opacity%3A1%3Bcolor-rendering%3Aauto%3Bimage-rendering%3Aauto%3Bshape-rendering%3Aauto%3Btext-rendering%3Aauto%22%20transform%3D%22translate(15.553%202.85)scale(.88807)%22%2F%3E%3Cpath%20d%3D%22M-9.415-.316C-12.69-.338-15.37%202.14-15.39%205.207c-.017%202.716%201.326%204.041%202.78%205.477%201.013%201%202.081%202.055%202.78%203.67l.092.076a.34.34%200%200%200%20.225.086.34.34%200%200%200%20.227-.083l.019-.01c.022-.009.057-.024.074-.064.697-1.6%201.78-2.64%202.814-3.634%201.473-1.414%202.847-2.733%202.864-5.44.02-3.067-2.627-5.58-5.901-5.601m-.057%208.784c1.621.011%202.944-1.315%202.955-2.96.01-1.646-1.295-2.988-2.916-2.999-1.622-.01-2.945%201.315-2.955%202.96s1.295%202.989%202.916%203%22%20style%3D%22clip-rule%3Aevenodd%3Bfill%3A%23e1e3e9%3Bfill-opacity%3A1%3Bfill-rule%3Aevenodd%3Bstroke%3Anone%3Bstroke-width%3A2.47727823%3Bstroke-miterlimit%3A4%3Bstroke-dasharray%3Anone%3Bstroke-opacity%3A.4%22%20transform%3D%22translate(15.553%202.85)scale(.88807)%22%2F%3E%3Cpath%20d%3D%22M-11.594%2015.465c-.27-.002-.492.297-.494.668l-.012%201.876c-.003.371.214.673.485.675l4.14.027c.271.002.492-.298.495-.668l.012-1.877c.003-.37-.215-.672-.485-.674z%22%20style%3D%22clip-rule%3Aevenodd%3Bfill%3A%23fff%3Bfill-opacity%3A1%3Bfill-rule%3Aevenodd%3Bstroke%3Anone%3Bstroke-width%3A2.47727823%3Bstroke-miterlimit%3A4%3Bstroke-dasharray%3Anone%3Bstroke-opacity%3A.4%22%20transform%3D%22translate(15.553%202.85)scale(.88807)%22%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E")}a.maplibregl-ctrl-logo.maplibregl-compact{width:14px}@media (forced-colors:active){a.maplibregl-ctrl-logo{background-color:transparent;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2288%22%20height%3D%2223%22%20fill%3D%22none%22%3E%3Cpath%20fill%3D%22%23000%22%20fill-opacity%3D%22.4%22%20fill-rule%3D%22evenodd%22%20d%3D%22M17.408%2016.796h-1.827l2.501-12.095h.198l3.324%206.533.988%202.19.988-2.19%203.258-6.533h.181l2.6%2012.095h-1.81l-1.218-5.644-.362-1.71-.658%201.71-2.929%205.644h-.098l-2.914-5.644-.757-1.71-.345%201.71zm1.958-3.42-.726%203.663a1.255%201.255%200%200%201-1.232%201.011h-1.827a1.255%201.255%200%200%201-1.229-1.509l2.501-12.095a1.255%201.255%200%200%201%201.23-1.001h.197a1.25%201.25%200%200%201%201.12.685l3.19%206.273%203.125-6.263a1.25%201.25%200%200%201%201.123-.695h.181a1.255%201.255%200%200%201%201.227.991l1.443%206.71a5%205%200%200%201%20.314-.787l.009-.016a4.6%204.6%200%200%201%201.777-1.887c.782-.46%201.668-.667%202.611-.667a4.6%204.6%200%200%201%201.7.32l.306.134c.21-.16.474-.256.759-.256h1.694a1.255%201.255%200%200%201%201.212.925%201.255%201.255%200%200%201%201.212-.925h1.711c.284%200%20.545.094.755.252.613-.3%201.312-.45%202.075-.45%201.356%200%202.557.445%203.482%201.4q.47.48.763%201.064V4.701a1.255%201.255%200%200%201%201.255-1.255h1.86A1.255%201.255%200%200%201%2054.44%204.7v9.194h2.217c.19%200%20.37.043.532.118v-4.77c0-.356.147-.678.385-.906a2.42%202.42%200%200%201-.682-1.71c0-.665.267-1.253.735-1.7a2.45%202.45%200%200%201%201.722-.674%202.43%202.43%200%200%201%201.705.675q.318.302.504.683V4.7a1.255%201.255%200%200%201%201.255-1.255h1.744A1.255%201.255%200%200%201%2065.812%204.7v3.335a4.8%204.8%200%200%201%201.526-.246c.938%200%201.817.214%202.59.69a4.47%204.47%200%200%201%201.67%201.743v-.98a1.255%201.255%200%200%201%201.256-1.256h1.777c.233%200%20.451.064.639.174a3.4%203.4%200%200%201%201.567-.372c.346%200%20.861.02%201.285.232a1.25%201.25%200%200%201%20.689%201.004%204.7%204.7%200%200%201%20.853-.588c.795-.44%201.675-.647%202.61-.647%201.385%200%202.65.39%203.525%201.396.836.938%201.168%202.173%201.168%203.528q-.001.515-.056%201.051a1.255%201.255%200%200%201-.947%201.09l.408.952a1.255%201.255%200%200%201-.477%201.552c-.418.268-.92.463-1.458.612-.613.171-1.304.244-2.049.244-1.06%200-2.043-.207-2.886-.698l-.015-.008c-.798-.48-1.419-1.135-1.818-1.963l-.004-.008a5.8%205.8%200%200%201-.548-2.512q0-.429.053-.843a1.3%201.3%200%200%201-.333-.086l-.166-.004c-.223%200-.426.062-.643.228-.03.024-.142.139-.142.59v3.883a1.255%201.255%200%200%201-1.256%201.256h-1.777a1.255%201.255%200%200%201-1.256-1.256V15.69l-.032.057a4.8%204.8%200%200%201-1.86%201.833%205.04%205.04%200%200%201-2.484.634%204.5%204.5%200%200%201-1.935-.424%201.25%201.25%200%200%201-.764.258h-1.71a1.255%201.255%200%200%201-1.256-1.255V7.687a2.4%202.4%200%200%201-.428.625c.253.23.412.561.412.93v7.553a1.255%201.255%200%200%201-1.256%201.255h-1.843a1.25%201.25%200%200%201-.894-.373c-.228.23-.544.373-.894.373H51.32a1.255%201.255%200%200%201-1.256-1.255v-1.251l-.061.117a4.7%204.7%200%200%201-1.782%201.884%204.77%204.77%200%200%201-2.485.67%205.6%205.6%200%200%201-1.485-.188l.009%202.764a1.255%201.255%200%200%201-1.255%201.259h-1.729a1.255%201.255%200%200%201-1.255-1.255v-3.537a1.255%201.255%200%200%201-1.167.793h-1.679a1.25%201.25%200%200%201-.77-.263%204.5%204.5%200%200%201-1.945.429c-.885%200-1.724-.21-2.495-.632l-.017-.01a5%205%200%200%201-1.081-.836%201.255%201.255%200%200%201-1.254%201.312h-1.81a1.255%201.255%200%200%201-1.228-.99l-.782-3.625-2.044%203.939a1.25%201.25%200%200%201-1.115.676h-.098a1.25%201.25%200%200%201-1.116-.68l-2.061-3.994zM35.92%2016.63l.207-.114.223-.15q.493-.356.735-.785l.061-.118.033%201.332h1.678V9.242h-1.694l-.033%201.267q-.133-.329-.526-.658l-.032-.028a3.2%203.2%200%200%200-.668-.428l-.27-.12a3.3%203.3%200%200%200-1.235-.23q-1.136-.001-1.974.493a3.36%203.36%200%200%200-1.3%201.382q-.445.89-.444%202.074%200%201.2.51%202.107a3.8%203.8%200%200%200%201.382%201.381%203.9%203.9%200%200%200%201.893.477q.795%200%201.455-.33zm-2.789-5.38q-.576.675-.575%201.762%200%201.102.559%201.794.576.675%201.645.675a2.25%202.25%200%200%200%20.934-.19%202.2%202.2%200%200%200%20.468-.29l.178-.161a2.2%202.2%200%200%200%20.397-.561q.244-.5.244-1.15v-.115q0-.708-.296-1.267l-.043-.077a2.2%202.2%200%200%200-.633-.709l-.13-.086-.047-.028a2.1%202.1%200%200%200-1.073-.285q-1.052%200-1.629.692zm2.316%202.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.96.96%200%200%200-.353-.389.85.85%200%200%200-.464-.127c-.4%200-.56.114-.664.239l-.01.012c-.148.174-.275.45-.275.945%200%20.506.122.801.27.99.097.11.266.224.68.224.303%200%20.504-.09.687-.269zm7.545%201.705a2.6%202.6%200%200%200%20.331.423q.319.33.755.548l.173.074q.65.255%201.49.255%201.02%200%201.844-.493a3.45%203.45%200%200%200%201.316-1.4q.493-.904.493-2.089%200-1.909-.988-2.913-.988-1.02-2.584-1.02-.898%200-1.575.347a3%203%200%200%200-.415.262l-.199.166a3.4%203.4%200%200%200-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138q.206.29.48.5l.155.11.053.034q.51.296%201.119.297%201.07%200%201.645-.675.577-.69.576-1.762%200-1.119-.576-1.777-.558-.675-1.645-.675-.435%200-.835.16a2%202%200%200%200-.284.136%202%202%200%200%200-.363.254%202.2%202.2%200%200%200-.46.569l-.082.162a2.6%202.6%200%200%200-.213%201.072v.115q0%20.707.296%201.267l.135.211zm.964-.818a1.1%201.1%200%200%200%20.367.385.94.94%200%200%200%20.476.118c.423%200%20.59-.117.687-.23.159-.194.28-.478.28-.95%200-.53-.133-.8-.266-.952l-.021-.025c-.078-.094-.231-.221-.68-.221a1%201%200%200%200-.503.135l-.012.007a.86.86%200%200%200-.335.343c-.073.133-.132.324-.132.614v.115a1.4%201.4%200%200%200%20.14.66zm15.7-6.222q.347-.346.346-.856a1.05%201.05%200%200%200-.345-.79%201.18%201.18%200%200%200-.84-.329q-.51%200-.855.33a1.05%201.05%200%200%200-.346.79q0%20.51.346.855.345.346.856.346.51%200%20.839-.346zm4.337%209.314.033-1.332q.191.403.59.747l.098.081a4%204%200%200%200%20.316.224l.223.122a3.2%203.2%200%200%200%201.44.322%203.8%203.8%200%200%200%201.875-.477%203.5%203.5%200%200%200%201.382-1.366q.527-.89.526-2.09%200-1.184-.444-2.073a3.24%203.24%200%200%200-1.283-1.399q-.823-.51-1.942-.51a3.5%203.5%200%200%200-1.527.344l-.086.043-.165.09a3%203%200%200%200-.33.214q-.432.315-.656.707a2%202%200%200%200-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.5%202.5%200%200%200%20.566.7q.117.098.245.18l.144.08a2.1%202.1%200%200%200%20.975.232q1.07%200%201.645-.675.576-.69.576-1.778%200-1.102-.576-1.777-.56-.691-1.645-.692a2.2%202.2%200%200%200-1.015.235q-.22.113-.415.282l-.15.142a2.1%202.1%200%200%200-.42.594q-.223.479-.223%201.1v.115q0%20.705.293%201.26zm2.616-.293c.157-.191.28-.479.28-.967%200-.51-.13-.79-.276-.961l-.021-.026c-.082-.1-.232-.225-.67-.225a.87.87%200%200%200-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0%20.285.057.499.144.669a1.1%201.1%200%200%200%20.367.405c.137.082.28.123.455.123.423%200%20.59-.118.686-.23zm8.266-3.013q.345-.13.724-.14l.069-.002q.493%200%20.642.099l.247-1.794q-.196-.099-.717-.099a2.3%202.3%200%200%200-.545.063%202%202%200%200%200-.411.148%202.2%202.2%200%200%200-.4.249%202.5%202.5%200%200%200-.485.499%202.7%202.7%200%200%200-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884q0-.546.159-.943a1.5%201.5%200%200%201%20.466-.636%202.5%202.5%200%200%201%20.399-.253%202%202%200%200%201%20.224-.099zm9.784%202.656.05-.922q0-1.743-.856-2.698-.838-.97-2.584-.97-1.119-.001-2.007.493a3.46%203.46%200%200%200-1.4%201.382q-.493.906-.493%202.106%200%201.07.428%201.975.428.89%201.332%201.432.906.526%202.255.526.973%200%201.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%200-1.497-.444a1.6%201.6%200%200%201-.192-.193q-.366-.44-.512-1.234l-.004-.021zm-5.427-1.256-.003.022h3.752v-.138q-.011-.727-.288-1.118a1%201%200%200%200-.156-.176q-.46-.428-1.316-.428-.986%200-1.494.604-.379.45-.494%201.234zm-27.053%202.77V4.7h-1.86v12.095h5.333V15.15zm7.103-5.908v7.553h-1.843V9.242h1.843z%22%2F%3E%3Cpath%20fill%3D%22%23fff%22%20d%3D%22m19.63%2011.151-.757-1.71-.345%201.71-1.12%205.644h-1.827L18.083%204.7h.197l3.325%206.533.988%202.19.988-2.19L26.839%204.7h.181l2.6%2012.095h-1.81l-1.218-5.644-.362-1.71-.658%201.71-2.93%205.644h-.098l-2.913-5.644zm14.836%205.81q-1.02%200-1.893-.478a3.8%203.8%200%200%201-1.381-1.382q-.51-.906-.51-2.106%200-1.185.444-2.074a3.36%203.36%200%200%201%201.3-1.382q.839-.494%201.974-.494a3.3%203.3%200%200%201%201.234.231%203.3%203.3%200%200%201%20.97.575q.396.33.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332q-.279.593-1.02%201.053a3.17%203.17%200%200%201-1.662.444zm.296-1.482q.938%200%201.58-.642.642-.66.642-1.711v-.115q0-.708-.296-1.267a2.2%202.2%200%200%200-.807-.872%202.1%202.1%200%200%200-1.119-.313q-1.053%200-1.629.692-.575.675-.575%201.76%200%201.103.559%201.795.577.675%201.645.675zm6.521-6.237h1.711v1.4q.906-1.597%202.83-1.597%201.596%200%202.584%201.02.988%201.005.988%202.914%200%201.185-.493%202.09a3.46%203.46%200%200%201-1.316%201.399%203.5%203.5%200%200%201-1.844.493q-.954%200-1.662-.329a2.67%202.67%200%200%201-1.086-.97l.017%205.134h-1.728zm4.048%206.22q1.07%200%201.645-.674.577-.69.576-1.762%200-1.119-.576-1.777-.558-.675-1.645-.675-.592%200-1.12.296-.51.28-.822.823-.296.527-.296%201.234v.115q0%20.708.296%201.267.313.543.823.855.51.296%201.119.297z%22%2F%3E%3Cpath%20fill%3D%22%23e1e3e9%22%20d%3D%22M51.325%204.7h1.86v10.45h3.473v1.646h-5.333zm7.12%204.542h1.843v7.553h-1.843zm.905-1.415a1.16%201.16%200%200%201-.856-.346%201.17%201.17%200%200%201-.346-.856%201.05%201.05%200%200%201%20.346-.79q.346-.329.856-.329.494%200%20.839.33a1.05%201.05%200%200%201%20.345.79%201.16%201.16%200%200%201-.345.855q-.33.346-.84.346zm7.875%209.133a3.17%203.17%200%200%201-1.662-.444q-.723-.46-1.004-1.053l-.033%201.332h-1.71V4.701h1.743v4.657l-.082%201.283q.279-.658%201.086-1.119a3.5%203.5%200%200%201%201.778-.477q1.119%200%201.942.51a3.24%203.24%200%200%201%201.283%201.4q.445.888.444%202.072%200%201.201-.526%202.09a3.5%203.5%200%200%201-1.382%201.366%203.8%203.8%200%200%201-1.876.477zm-.296-1.481q1.069%200%201.645-.675.577-.69.577-1.778%200-1.102-.577-1.776-.56-.691-1.645-.692a2.12%202.12%200%200%200-1.58.659q-.642.641-.642%201.694v.115q0%20.71.296%201.267a2.4%202.4%200%200%200%20.807.872%202.1%202.1%200%200%200%201.119.313zm5.927-6.237h1.777v1.481q.263-.757.856-1.217a2.14%202.14%200%200%201%201.349-.46q.527%200%20.724.098l-.247%201.794q-.149-.099-.642-.099-.774%200-1.416.494-.626.493-.626%201.58v3.883h-1.777V9.242zm9.534%207.718q-1.35%200-2.255-.526-.904-.543-1.332-1.432a4.6%204.6%200%200%201-.428-1.975q0-1.2.493-2.106a3.46%203.46%200%200%201%201.4-1.382q.889-.495%202.007-.494%201.744%200%202.584.97.855.956.856%202.7%200%20.444-.05.92h-5.43q.18%201.005.708%201.45.542.443%201.497.443.79%200%201.3-.131a4%204%200%200%200%20.938-.362l.542%201.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%200-1.991%201.86z%22%2F%3E%3Cpath%20d%3D%22M5.074%2015.948a.484.657%200%200%200-.486.659v1.84a.484.657%200%200%200%20.486.659h4.101a.484.657%200%200%200%20.486-.659v-1.84a.484.657%200%200%200-.486-.659zm3.56%201.16H5.617v.838h3.017z%22%20style%3D%22fill%3A%23fff%3Bfill-rule%3Aevenodd%3Bstroke-width%3A1.03600001%22%2F%3E%3Cg%20style%3D%22stroke-width%3A1.12603545%22%3E%3Cpath%20d%3D%22M-9.408-1.416c-3.833-.025-7.056%202.912-7.08%206.615-.02%203.08%201.653%204.832%203.107%206.268.903.892%201.721%201.74%202.32%202.902l-.525-.004c-.543-.003-.992.304-1.24.639a1.87%201.87%200%200%200-.362%201.121l-.011%201.877c-.003.402.104.787.347%201.125.244.338.688.653%201.23.656l4.142.028c.542.003.99-.306%201.238-.641a1.87%201.87%200%200%200%20.363-1.121l.012-1.875a1.87%201.87%200%200%200-.348-1.127c-.243-.338-.688-.653-1.23-.656l-.518-.004c.597-1.145%201.425-1.983%202.348-2.87%201.473-1.414%203.18-3.149%203.2-6.226-.016-3.59-2.923-6.684-6.993-6.707m-.006%201.1v.002c3.274.02%205.92%202.532%205.9%205.6-.017%202.706-1.39%204.026-2.863%205.44-1.034.994-2.118%202.033-2.814%203.633-.018.041-.052.055-.075.065q-.013.004-.02.01a.34.34%200%200%201-.226.084.34.34%200%200%201-.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%202.7-5.545%205.975-5.523m-.02%202.826c-1.62-.01-2.944%201.315-2.955%202.96-.01%201.646%201.295%202.988%202.916%202.999h.002c1.621.01%202.943-1.316%202.953-2.961.011-1.646-1.294-2.988-2.916-2.998m-.005%201.1c1.017.006%201.829.83%201.822%201.89s-.83%201.874-1.848%201.867c-1.018-.006-1.829-.83-1.822-1.89s.83-1.874%201.848-1.868m-2.155%2011.857%204.14.025c.271.002.49.305.487.676l-.013%201.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%22%20style%3D%22color%3A%23000%3Bfont-style%3Anormal%3Bfont-variant%3Anormal%3Bfont-weight%3A400%3Bfont-stretch%3Anormal%3Bfont-size%3Amedium%3Bline-height%3Anormal%3Bfont-family%3Asans-serif%3Bfont-variant-ligatures%3Anormal%3Bfont-variant-position%3Anormal%3Bfont-variant-caps%3Anormal%3Bfont-variant-numeric%3Anormal%3Bfont-variant-alternates%3Anormal%3Bfont-feature-settings%3Anormal%3Btext-indent%3A0%3Btext-align%3Astart%3Btext-decoration%3Anone%3Btext-decoration-line%3Anone%3Btext-decoration-style%3Asolid%3Btext-decoration-color%3A%23000%3Bletter-spacing%3Anormal%3Bword-spacing%3Anormal%3Btext-transform%3Anone%3Bwriting-mode%3Alr-tb%3Bdirection%3Altr%3Btext-orientation%3Amixed%3Bdominant-baseline%3Aauto%3Bbaseline-shift%3Abaseline%3Btext-anchor%3Astart%3Bwhite-space%3Anormal%3Bshape-padding%3A0%3Bclip-rule%3Aevenodd%3Bdisplay%3Ainline%3Boverflow%3Avisible%3Bvisibility%3Avisible%3Bopacity%3A1%3Bisolation%3Aauto%3Bmix-blend-mode%3Anormal%3Bcolor-interpolation%3AsRGB%3Bcolor-interpolation-filters%3AlinearRGB%3Bsolid-color%3A%23000%3Bsolid-opacity%3A1%3Bvector-effect%3Anone%3Bfill%3A%23000%3Bfill-opacity%3A.4%3Bfill-rule%3Aevenodd%3Bstroke%3Anone%3Bstroke-width%3A2.47727823%3Bstroke-linecap%3Abutt%3Bstroke-linejoin%3Amiter%3Bstroke-miterlimit%3A4%3Bstroke-dasharray%3Anone%3Bstroke-dashoffset%3A0%3Bstroke-opacity%3A1%3Bcolor-rendering%3Aauto%3Bimage-rendering%3Aauto%3Bshape-rendering%3Aauto%3Btext-rendering%3Aauto%22%20transform%3D%22translate(15.553%202.85)scale(.88807)%22%2F%3E%3Cpath%20d%3D%22M-9.415-.316C-12.69-.338-15.37%202.14-15.39%205.207c-.017%202.716%201.326%204.041%202.78%205.477%201.013%201%202.081%202.055%202.78%203.67l.092.076a.34.34%200%200%200%20.225.086.34.34%200%200%200%20.227-.083l.019-.01c.022-.009.057-.024.074-.064.697-1.6%201.78-2.64%202.814-3.634%201.473-1.414%202.847-2.733%202.864-5.44.02-3.067-2.627-5.58-5.901-5.601m-.057%208.784c1.621.011%202.944-1.315%202.955-2.96.01-1.646-1.295-2.988-2.916-2.999-1.622-.01-2.945%201.315-2.955%202.96s1.295%202.989%202.916%203%22%20style%3D%22clip-rule%3Aevenodd%3Bfill%3A%23e1e3e9%3Bfill-opacity%3A1%3Bfill-rule%3Aevenodd%3Bstroke%3Anone%3Bstroke-width%3A2.47727823%3Bstroke-miterlimit%3A4%3Bstroke-dasharray%3Anone%3Bstroke-opacity%3A.4%22%20transform%3D%22translate(15.553%202.85)scale(.88807)%22%2F%3E%3Cpath%20d%3D%22M-11.594%2015.465c-.27-.002-.492.297-.494.668l-.012%201.876c-.003.371.214.673.485.675l4.14.027c.271.002.492-.298.495-.668l.012-1.877c.003-.37-.215-.672-.485-.674z%22%20style%3D%22clip-rule%3Aevenodd%3Bfill%3A%23fff%3Bfill-opacity%3A1%3Bfill-rule%3Aevenodd%3Bstroke%3Anone%3Bstroke-width%3A2.47727823%3Bstroke-miterlimit%3A4%3Bstroke-dasharray%3Anone%3Bstroke-opacity%3A.4%22%20transform%3D%22translate(15.553%202.85)scale(.88807)%22%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){a.maplibregl-ctrl-logo{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2288%22%20height%3D%2223%22%20fill%3D%22none%22%3E%3Cpath%20fill%3D%22%23000%22%20fill-opacity%3D%22.4%22%20fill-rule%3D%22evenodd%22%20d%3D%22M17.408%2016.796h-1.827l2.501-12.095h.198l3.324%206.533.988%202.19.988-2.19%203.258-6.533h.181l2.6%2012.095h-1.81l-1.218-5.644-.362-1.71-.658%201.71-2.929%205.644h-.098l-2.914-5.644-.757-1.71-.345%201.71zm1.958-3.42-.726%203.663a1.255%201.255%200%200%201-1.232%201.011h-1.827a1.255%201.255%200%200%201-1.229-1.509l2.501-12.095a1.255%201.255%200%200%201%201.23-1.001h.197a1.25%201.25%200%200%201%201.12.685l3.19%206.273%203.125-6.263a1.25%201.25%200%200%201%201.123-.695h.181a1.255%201.255%200%200%201%201.227.991l1.443%206.71a5%205%200%200%201%20.314-.787l.009-.016a4.6%204.6%200%200%201%201.777-1.887c.782-.46%201.668-.667%202.611-.667a4.6%204.6%200%200%201%201.7.32l.306.134c.21-.16.474-.256.759-.256h1.694a1.255%201.255%200%200%201%201.212.925%201.255%201.255%200%200%201%201.212-.925h1.711c.284%200%20.545.094.755.252.613-.3%201.312-.45%202.075-.45%201.356%200%202.557.445%203.482%201.4q.47.48.763%201.064V4.701a1.255%201.255%200%200%201%201.255-1.255h1.86A1.255%201.255%200%200%201%2054.44%204.7v9.194h2.217c.19%200%20.37.043.532.118v-4.77c0-.356.147-.678.385-.906a2.42%202.42%200%200%201-.682-1.71c0-.665.267-1.253.735-1.7a2.45%202.45%200%200%201%201.722-.674%202.43%202.43%200%200%201%201.705.675q.318.302.504.683V4.7a1.255%201.255%200%200%201%201.255-1.255h1.744A1.255%201.255%200%200%201%2065.812%204.7v3.335a4.8%204.8%200%200%201%201.526-.246c.938%200%201.817.214%202.59.69a4.47%204.47%200%200%201%201.67%201.743v-.98a1.255%201.255%200%200%201%201.256-1.256h1.777c.233%200%20.451.064.639.174a3.4%203.4%200%200%201%201.567-.372c.346%200%20.861.02%201.285.232a1.25%201.25%200%200%201%20.689%201.004%204.7%204.7%200%200%201%20.853-.588c.795-.44%201.675-.647%202.61-.647%201.385%200%202.65.39%203.525%201.396.836.938%201.168%202.173%201.168%203.528q-.001.515-.056%201.051a1.255%201.255%200%200%201-.947%201.09l.408.952a1.255%201.255%200%200%201-.477%201.552c-.418.268-.92.463-1.458.612-.613.171-1.304.244-2.049.244-1.06%200-2.043-.207-2.886-.698l-.015-.008c-.798-.48-1.419-1.135-1.818-1.963l-.004-.008a5.8%205.8%200%200%201-.548-2.512q0-.429.053-.843a1.3%201.3%200%200%201-.333-.086l-.166-.004c-.223%200-.426.062-.643.228-.03.024-.142.139-.142.59v3.883a1.255%201.255%200%200%201-1.256%201.256h-1.777a1.255%201.255%200%200%201-1.256-1.256V15.69l-.032.057a4.8%204.8%200%200%201-1.86%201.833%205.04%205.04%200%200%201-2.484.634%204.5%204.5%200%200%201-1.935-.424%201.25%201.25%200%200%201-.764.258h-1.71a1.255%201.255%200%200%201-1.256-1.255V7.687a2.4%202.4%200%200%201-.428.625c.253.23.412.561.412.93v7.553a1.255%201.255%200%200%201-1.256%201.255h-1.843a1.25%201.25%200%200%201-.894-.373c-.228.23-.544.373-.894.373H51.32a1.255%201.255%200%200%201-1.256-1.255v-1.251l-.061.117a4.7%204.7%200%200%201-1.782%201.884%204.77%204.77%200%200%201-2.485.67%205.6%205.6%200%200%201-1.485-.188l.009%202.764a1.255%201.255%200%200%201-1.255%201.259h-1.729a1.255%201.255%200%200%201-1.255-1.255v-3.537a1.255%201.255%200%200%201-1.167.793h-1.679a1.25%201.25%200%200%201-.77-.263%204.5%204.5%200%200%201-1.945.429c-.885%200-1.724-.21-2.495-.632l-.017-.01a5%205%200%200%201-1.081-.836%201.255%201.255%200%200%201-1.254%201.312h-1.81a1.255%201.255%200%200%201-1.228-.99l-.782-3.625-2.044%203.939a1.25%201.25%200%200%201-1.115.676h-.098a1.25%201.25%200%200%201-1.116-.68l-2.061-3.994zM35.92%2016.63l.207-.114.223-.15q.493-.356.735-.785l.061-.118.033%201.332h1.678V9.242h-1.694l-.033%201.267q-.133-.329-.526-.658l-.032-.028a3.2%203.2%200%200%200-.668-.428l-.27-.12a3.3%203.3%200%200%200-1.235-.23q-1.136-.001-1.974.493a3.36%203.36%200%200%200-1.3%201.382q-.445.89-.444%202.074%200%201.2.51%202.107a3.8%203.8%200%200%200%201.382%201.381%203.9%203.9%200%200%200%201.893.477q.795%200%201.455-.33zm-2.789-5.38q-.576.675-.575%201.762%200%201.102.559%201.794.576.675%201.645.675a2.25%202.25%200%200%200%20.934-.19%202.2%202.2%200%200%200%20.468-.29l.178-.161a2.2%202.2%200%200%200%20.397-.561q.244-.5.244-1.15v-.115q0-.708-.296-1.267l-.043-.077a2.2%202.2%200%200%200-.633-.709l-.13-.086-.047-.028a2.1%202.1%200%200%200-1.073-.285q-1.052%200-1.629.692zm2.316%202.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.96.96%200%200%200-.353-.389.85.85%200%200%200-.464-.127c-.4%200-.56.114-.664.239l-.01.012c-.148.174-.275.45-.275.945%200%20.506.122.801.27.99.097.11.266.224.68.224.303%200%20.504-.09.687-.269zm7.545%201.705a2.6%202.6%200%200%200%20.331.423q.319.33.755.548l.173.074q.65.255%201.49.255%201.02%200%201.844-.493a3.45%203.45%200%200%200%201.316-1.4q.493-.904.493-2.089%200-1.909-.988-2.913-.988-1.02-2.584-1.02-.898%200-1.575.347a3%203%200%200%200-.415.262l-.199.166a3.4%203.4%200%200%200-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138q.206.29.48.5l.155.11.053.034q.51.296%201.119.297%201.07%200%201.645-.675.577-.69.576-1.762%200-1.119-.576-1.777-.558-.675-1.645-.675-.435%200-.835.16a2%202%200%200%200-.284.136%202%202%200%200%200-.363.254%202.2%202.2%200%200%200-.46.569l-.082.162a2.6%202.6%200%200%200-.213%201.072v.115q0%20.707.296%201.267l.135.211zm.964-.818a1.1%201.1%200%200%200%20.367.385.94.94%200%200%200%20.476.118c.423%200%20.59-.117.687-.23.159-.194.28-.478.28-.95%200-.53-.133-.8-.266-.952l-.021-.025c-.078-.094-.231-.221-.68-.221a1%201%200%200%200-.503.135l-.012.007a.86.86%200%200%200-.335.343c-.073.133-.132.324-.132.614v.115a1.4%201.4%200%200%200%20.14.66zm15.7-6.222q.347-.346.346-.856a1.05%201.05%200%200%200-.345-.79%201.18%201.18%200%200%200-.84-.329q-.51%200-.855.33a1.05%201.05%200%200%200-.346.79q0%20.51.346.855.345.346.856.346.51%200%20.839-.346zm4.337%209.314.033-1.332q.191.403.59.747l.098.081a4%204%200%200%200%20.316.224l.223.122a3.2%203.2%200%200%200%201.44.322%203.8%203.8%200%200%200%201.875-.477%203.5%203.5%200%200%200%201.382-1.366q.527-.89.526-2.09%200-1.184-.444-2.073a3.24%203.24%200%200%200-1.283-1.399q-.823-.51-1.942-.51a3.5%203.5%200%200%200-1.527.344l-.086.043-.165.09a3%203%200%200%200-.33.214q-.432.315-.656.707a2%202%200%200%200-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.5%202.5%200%200%200%20.566.7q.117.098.245.18l.144.08a2.1%202.1%200%200%200%20.975.232q1.07%200%201.645-.675.576-.69.576-1.778%200-1.102-.576-1.777-.56-.691-1.645-.692a2.2%202.2%200%200%200-1.015.235q-.22.113-.415.282l-.15.142a2.1%202.1%200%200%200-.42.594q-.223.479-.223%201.1v.115q0%20.705.293%201.26zm2.616-.293c.157-.191.28-.479.28-.967%200-.51-.13-.79-.276-.961l-.021-.026c-.082-.1-.232-.225-.67-.225a.87.87%200%200%200-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0%20.285.057.499.144.669a1.1%201.1%200%200%200%20.367.405c.137.082.28.123.455.123.423%200%20.59-.118.686-.23zm8.266-3.013q.345-.13.724-.14l.069-.002q.493%200%20.642.099l.247-1.794q-.196-.099-.717-.099a2.3%202.3%200%200%200-.545.063%202%202%200%200%200-.411.148%202.2%202.2%200%200%200-.4.249%202.5%202.5%200%200%200-.485.499%202.7%202.7%200%200%200-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884q0-.546.159-.943a1.5%201.5%200%200%201%20.466-.636%202.5%202.5%200%200%201%20.399-.253%202%202%200%200%201%20.224-.099zm9.784%202.656.05-.922q0-1.743-.856-2.698-.838-.97-2.584-.97-1.119-.001-2.007.493a3.46%203.46%200%200%200-1.4%201.382q-.493.906-.493%202.106%200%201.07.428%201.975.428.89%201.332%201.432.906.526%202.255.526.973%200%201.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%200-1.497-.444a1.6%201.6%200%200%201-.192-.193q-.366-.44-.512-1.234l-.004-.021zm-5.427-1.256-.003.022h3.752v-.138q-.011-.727-.288-1.118a1%201%200%200%200-.156-.176q-.46-.428-1.316-.428-.986%200-1.494.604-.379.45-.494%201.234zm-27.053%202.77V4.7h-1.86v12.095h5.333V15.15zm7.103-5.908v7.553h-1.843V9.242h1.843z%22%2F%3E%3Cpath%20fill%3D%22%23fff%22%20d%3D%22m19.63%2011.151-.757-1.71-.345%201.71-1.12%205.644h-1.827L18.083%204.7h.197l3.325%206.533.988%202.19.988-2.19L26.839%204.7h.181l2.6%2012.095h-1.81l-1.218-5.644-.362-1.71-.658%201.71-2.93%205.644h-.098l-2.913-5.644zm14.836%205.81q-1.02%200-1.893-.478a3.8%203.8%200%200%201-1.381-1.382q-.51-.906-.51-2.106%200-1.185.444-2.074a3.36%203.36%200%200%201%201.3-1.382q.839-.494%201.974-.494a3.3%203.3%200%200%201%201.234.231%203.3%203.3%200%200%201%20.97.575q.396.33.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332q-.279.593-1.02%201.053a3.17%203.17%200%200%201-1.662.444zm.296-1.482q.938%200%201.58-.642.642-.66.642-1.711v-.115q0-.708-.296-1.267a2.2%202.2%200%200%200-.807-.872%202.1%202.1%200%200%200-1.119-.313q-1.053%200-1.629.692-.575.675-.575%201.76%200%201.103.559%201.795.577.675%201.645.675zm6.521-6.237h1.711v1.4q.906-1.597%202.83-1.597%201.596%200%202.584%201.02.988%201.005.988%202.914%200%201.185-.493%202.09a3.46%203.46%200%200%201-1.316%201.399%203.5%203.5%200%200%201-1.844.493q-.954%200-1.662-.329a2.67%202.67%200%200%201-1.086-.97l.017%205.134h-1.728zm4.048%206.22q1.07%200%201.645-.674.577-.69.576-1.762%200-1.119-.576-1.777-.558-.675-1.645-.675-.592%200-1.12.296-.51.28-.822.823-.296.527-.296%201.234v.115q0%20.708.296%201.267.313.543.823.855.51.296%201.119.297z%22%2F%3E%3Cpath%20fill%3D%22%23e1e3e9%22%20d%3D%22M51.325%204.7h1.86v10.45h3.473v1.646h-5.333zm7.12%204.542h1.843v7.553h-1.843zm.905-1.415a1.16%201.16%200%200%201-.856-.346%201.17%201.17%200%200%201-.346-.856%201.05%201.05%200%200%201%20.346-.79q.346-.329.856-.329.494%200%20.839.33a1.05%201.05%200%200%201%20.345.79%201.16%201.16%200%200%201-.345.855q-.33.346-.84.346zm7.875%209.133a3.17%203.17%200%200%201-1.662-.444q-.723-.46-1.004-1.053l-.033%201.332h-1.71V4.701h1.743v4.657l-.082%201.283q.279-.658%201.086-1.119a3.5%203.5%200%200%201%201.778-.477q1.119%200%201.942.51a3.24%203.24%200%200%201%201.283%201.4q.445.888.444%202.072%200%201.201-.526%202.09a3.5%203.5%200%200%201-1.382%201.366%203.8%203.8%200%200%201-1.876.477zm-.296-1.481q1.069%200%201.645-.675.577-.69.577-1.778%200-1.102-.577-1.776-.56-.691-1.645-.692a2.12%202.12%200%200%200-1.58.659q-.642.641-.642%201.694v.115q0%20.71.296%201.267a2.4%202.4%200%200%200%20.807.872%202.1%202.1%200%200%200%201.119.313zm5.927-6.237h1.777v1.481q.263-.757.856-1.217a2.14%202.14%200%200%201%201.349-.46q.527%200%20.724.098l-.247%201.794q-.149-.099-.642-.099-.774%200-1.416.494-.626.493-.626%201.58v3.883h-1.777V9.242zm9.534%207.718q-1.35%200-2.255-.526-.904-.543-1.332-1.432a4.6%204.6%200%200%201-.428-1.975q0-1.2.493-2.106a3.46%203.46%200%200%201%201.4-1.382q.889-.495%202.007-.494%201.744%200%202.584.97.855.956.856%202.7%200%20.444-.05.92h-5.43q.18%201.005.708%201.45.542.443%201.497.443.79%200%201.3-.131a4%204%200%200%200%20.938-.362l.542%201.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%200-1.991%201.86z%22%2F%3E%3Cpath%20d%3D%22M5.074%2015.948a.484.657%200%200%200-.486.659v1.84a.484.657%200%200%200%20.486.659h4.101a.484.657%200%200%200%20.486-.659v-1.84a.484.657%200%200%200-.486-.659zm3.56%201.16H5.617v.838h3.017z%22%20style%3D%22fill%3A%23fff%3Bfill-rule%3Aevenodd%3Bstroke-width%3A1.03600001%22%2F%3E%3Cg%20style%3D%22stroke-width%3A1.12603545%22%3E%3Cpath%20d%3D%22M-9.408-1.416c-3.833-.025-7.056%202.912-7.08%206.615-.02%203.08%201.653%204.832%203.107%206.268.903.892%201.721%201.74%202.32%202.902l-.525-.004c-.543-.003-.992.304-1.24.639a1.87%201.87%200%200%200-.362%201.121l-.011%201.877c-.003.402.104.787.347%201.125.244.338.688.653%201.23.656l4.142.028c.542.003.99-.306%201.238-.641a1.87%201.87%200%200%200%20.363-1.121l.012-1.875a1.87%201.87%200%200%200-.348-1.127c-.243-.338-.688-.653-1.23-.656l-.518-.004c.597-1.145%201.425-1.983%202.348-2.87%201.473-1.414%203.18-3.149%203.2-6.226-.016-3.59-2.923-6.684-6.993-6.707m-.006%201.1v.002c3.274.02%205.92%202.532%205.9%205.6-.017%202.706-1.39%204.026-2.863%205.44-1.034.994-2.118%202.033-2.814%203.633-.018.041-.052.055-.075.065q-.013.004-.02.01a.34.34%200%200%201-.226.084.34.34%200%200%201-.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%202.7-5.545%205.975-5.523m-.02%202.826c-1.62-.01-2.944%201.315-2.955%202.96-.01%201.646%201.295%202.988%202.916%202.999h.002c1.621.01%202.943-1.316%202.953-2.961.011-1.646-1.294-2.988-2.916-2.998m-.005%201.1c1.017.006%201.829.83%201.822%201.89s-.83%201.874-1.848%201.867c-1.018-.006-1.829-.83-1.822-1.89s.83-1.874%201.848-1.868m-2.155%2011.857%204.14.025c.271.002.49.305.487.676l-.013%201.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%22%20style%3D%22color%3A%23000%3Bfont-style%3Anormal%3Bfont-variant%3Anormal%3Bfont-weight%3A400%3Bfont-stretch%3Anormal%3Bfont-size%3Amedium%3Bline-height%3Anormal%3Bfont-family%3Asans-serif%3Bfont-variant-ligatures%3Anormal%3Bfont-variant-position%3Anormal%3Bfont-variant-caps%3Anormal%3Bfont-variant-numeric%3Anormal%3Bfont-variant-alternates%3Anormal%3Bfont-feature-settings%3Anormal%3Btext-indent%3A0%3Btext-align%3Astart%3Btext-decoration%3Anone%3Btext-decoration-line%3Anone%3Btext-decoration-style%3Asolid%3Btext-decoration-color%3A%23000%3Bletter-spacing%3Anormal%3Bword-spacing%3Anormal%3Btext-transform%3Anone%3Bwriting-mode%3Alr-tb%3Bdirection%3Altr%3Btext-orientation%3Amixed%3Bdominant-baseline%3Aauto%3Bbaseline-shift%3Abaseline%3Btext-anchor%3Astart%3Bwhite-space%3Anormal%3Bshape-padding%3A0%3Bclip-rule%3Aevenodd%3Bdisplay%3Ainline%3Boverflow%3Avisible%3Bvisibility%3Avisible%3Bopacity%3A1%3Bisolation%3Aauto%3Bmix-blend-mode%3Anormal%3Bcolor-interpolation%3AsRGB%3Bcolor-interpolation-filters%3AlinearRGB%3Bsolid-color%3A%23000%3Bsolid-opacity%3A1%3Bvector-effect%3Anone%3Bfill%3A%23000%3Bfill-opacity%3A.4%3Bfill-rule%3Aevenodd%3Bstroke%3Anone%3Bstroke-width%3A2.47727823%3Bstroke-linecap%3Abutt%3Bstroke-linejoin%3Amiter%3Bstroke-miterlimit%3A4%3Bstroke-dasharray%3Anone%3Bstroke-dashoffset%3A0%3Bstroke-opacity%3A1%3Bcolor-rendering%3Aauto%3Bimage-rendering%3Aauto%3Bshape-rendering%3Aauto%3Btext-rendering%3Aauto%22%20transform%3D%22translate(15.553%202.85)scale(.88807)%22%2F%3E%3Cpath%20d%3D%22M-9.415-.316C-12.69-.338-15.37%202.14-15.39%205.207c-.017%202.716%201.326%204.041%202.78%205.477%201.013%201%202.081%202.055%202.78%203.67l.092.076a.34.34%200%200%200%20.225.086.34.34%200%200%200%20.227-.083l.019-.01c.022-.009.057-.024.074-.064.697-1.6%201.78-2.64%202.814-3.634%201.473-1.414%202.847-2.733%202.864-5.44.02-3.067-2.627-5.58-5.901-5.601m-.057%208.784c1.621.011%202.944-1.315%202.955-2.96.01-1.646-1.295-2.988-2.916-2.999-1.622-.01-2.945%201.315-2.955%202.96s1.295%202.989%202.916%203%22%20style%3D%22clip-rule%3Aevenodd%3Bfill%3A%23e1e3e9%3Bfill-opacity%3A1%3Bfill-rule%3Aevenodd%3Bstroke%3Anone%3Bstroke-width%3A2.47727823%3Bstroke-miterlimit%3A4%3Bstroke-dasharray%3Anone%3Bstroke-opacity%3A.4%22%20transform%3D%22translate(15.553%202.85)scale(.88807)%22%2F%3E%3Cpath%20d%3D%22M-11.594%2015.465c-.27-.002-.492.297-.494.668l-.012%201.876c-.003.371.214.673.485.675l4.14.027c.271.002.492-.298.495-.668l.012-1.877c.003-.37-.215-.672-.485-.674z%22%20style%3D%22clip-rule%3Aevenodd%3Bfill%3A%23fff%3Bfill-opacity%3A1%3Bfill-rule%3Aevenodd%3Bstroke%3Anone%3Bstroke-width%3A2.47727823%3Bstroke-miterlimit%3A4%3Bstroke-dasharray%3Anone%3Bstroke-opacity%3A.4%22%20transform%3D%22translate(15.553%202.85)scale(.88807)%22%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E")}}.maplibregl-ctrl.maplibregl-ctrl-attrib{padding:0 5px;background-color:hsla(0,0%,100%,.5);margin:0}@media screen{.maplibregl-ctrl-attrib.maplibregl-compact{min-height:20px;padding:2px 24px 2px 0;margin:10px;position:relative;background-color:#fff;color:#000;border-radius:12px;box-sizing:content-box}.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{padding:2px 8px 2px 28px;border-radius:12px}.maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-inner{display:none}.maplibregl-ctrl-attrib-button{display:none;cursor:pointer;position:absolute;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20fill-rule%3D%22evenodd%22%20viewBox%3D%220%200%2020%2020%22%3E%3Cpath%20d%3D%22M4%2010a6%206%200%201%200%2012%200%206%206%200%201%200-12%200m5-3a1%201%200%201%200%202%200%201%201%200%201%200-2%200m0%203a1%201%200%201%201%202%200v3a1%201%200%201%201-2%200%22%2F%3E%3C%2Fsvg%3E");background-color:hsla(0,0%,100%,.5);width:24px;height:24px;box-sizing:border-box;border-radius:12px;outline:none;top:0;right:0;border:0}.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{top:0;right:0}.maplibregl-ctrl-top-left>.maplibregl-ctrl-attrib.maplibregl-compact:after{top:0;left: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("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23fff%22%20fill-rule%3D%22evenodd%22%20viewBox%3D%220%200%2020%2020%22%3E%3Cpath%20d%3D%22M4%2010a6%206%200%201%200%2012%200%206%206%200%201%200-12%200m5-3a1%201%200%201%200%202%200%201%201%200%201%200-2%200m0%203a1%201%200%201%201%202%200v3a1%201%200%201%201-2%200%22%2F%3E%3C%2Fsvg%3E")}}@media screen and (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl-attrib.maplibregl-compact:after{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20fill-rule%3D%22evenodd%22%20viewBox%3D%220%200%2020%2020%22%3E%3Cpath%20d%3D%22M4%2010a6%206%200%201%200%2012%200%206%206%200%201%200-12%200m5-3a1%201%200%201%200%202%200%201%201%200%201%200-2%200m0%203a1%201%200%201%201%202%200v3a1%201%200%201%201-2%200%22%2F%3E%3C%2Fsvg%3E")}}.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);font-size:10px;white-space:nowrap;border-color:#333;border-style:none solid solid;border-width:medium 2px 2px;padding:0 5px;color:#333;box-sizing:border-box}.maplibregl-popup{position:absolute;top:0;left:0;display:flex;will-change:transform;pointer-events:none}.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{width:0;height:0;border:10px solid transparent;z-index:1}.maplibregl-popup-anchor-top .maplibregl-popup-tip{align-self:center;border-top:none;border-bottom-color:#fff}.maplibregl-popup-anchor-top-left .maplibregl-popup-tip{align-self:flex-start;border-top:none;border-left:none;border-bottom-color:#fff}.maplibregl-popup-anchor-top-right .maplibregl-popup-tip{align-self:flex-end;border-top:none;border-right:none;border-bottom-color:#fff}.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-right:none;border-left-color:#fff}[dir=rtl] .maplibregl-popup-anchor-left{flex-direction:row-reverse}[dir=rtl] .maplibregl-popup-anchor-right{flex-direction:row}[dir=rtl] .maplibregl-popup-anchor-top-left .maplibregl-popup-tip{align-self:flex-end}[dir=rtl] .maplibregl-popup-anchor-top-right .maplibregl-popup-tip{align-self:flex-start}[dir=rtl] .maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip{align-self:flex-end}[dir=rtl] .maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip{align-self:flex-start}.maplibregl-popup-close-button{position:absolute;right:0;top:0;border:0;border-radius:0 3px 0 0;cursor:pointer;background-color:transparent}.maplibregl-popup-close-button:hover{background-color:rgba(0,0,0,.05)}.maplibregl-popup-content{position:relative;background:#fff;border-radius:3px;box-shadow:0 1px 2px rgba(0,0,0,.1);padding:15px 10px;pointer-events:auto}.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{position:absolute;top:0;left:0;will-change:transform;transition:opacity .2s}.maplibregl-marker-draggable{cursor:grab}.maplibregl-user-location-dot,.maplibregl-user-location-dot:before{background-color:#1da1f2;width:15px;height:15px;border-radius:50%}.maplibregl-user-location-dot:before{content:"";position:absolute;animation:maplibregl-user-location-dot-pulse 2s infinite}.maplibregl-user-location-dot:after{border-radius:50%;border:2px solid #fff;content:"";height:19px;left:-2px;position:absolute;top:-2px;width:19px;box-sizing:border-box;box-shadow:0 0 3px rgba(0,0,0,.35)}@media (prefers-reduced-motion:reduce){.maplibregl-user-location-dot:before{animation:none}}@keyframes maplibregl-user-location-dot-pulse{0%{transform:scale(1);opacity:1}70%{transform:scale(3);opacity:0}to{transform:scale(1);opacity:0}}.maplibregl-user-location-dot-stale{background-color:#aaa}.maplibregl-user-location-dot-stale:after{display:none}.maplibregl-user-location-accuracy-circle{background-color:#1da1f233;width:1px;height:1px;border-radius:100%}.maplibregl-crosshair,.maplibregl-crosshair .maplibregl-interactive,.maplibregl-crosshair .maplibregl-interactive:active{cursor:crosshair}.maplibregl-boxzoom{position:absolute;top:0;left:0;width:0;height:0;background:#fff;border:2px dotted #202020;opacity:.5}.maplibregl-cooperative-gesture-screen{background:rgba(0,0,0,.4);position:absolute;inset:0;display:flex;justify-content:center;align-items:center;color:#fff;padding:1rem;font-size:1.4em;line-height:1.2;opacity:0;pointer-events:none;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{position:fixed!important;width:100%!important;height:100%!important;top:0!important;left:0!important;z-index:99999}');const HB=new CSSStyleSheet;HB.replaceSync(".maplibregl-map.pnx-map {\n\tbackground: white;\n}\n\n/* Picture thumbnail on map */\n.maplibregl-popup-content {\n\tpadding: 5px !important;\n\tposition: relative;\n\tpointer-events: none !important;\n}\n\n.pnx-map-thumb {\n\tdisplay: inline-block;\n\ttext-align: center;\n\tvertical-align: middle;\n\tmax-width: 130px;\n\tmax-height: 130px;\n}\n\n@keyframes rotating {\n\tfrom { transform: rotate(0deg); }\n\tto { transform: rotate(360deg); }\n}\n\n.pnx-map-thumb-loader {\n\tbackground-color: rgb(230,230,230);\n\tborder-radius: 65px;\n\tmax-height: 60px;\n\tmargin: 5px 35px;\n\tanimation: rotating 2s linear infinite;\n}\n\n.pnx-map-thumb-legend {\n\tdisplay: block;\n\tposition: absolute;\n\tbottom: 5px;\n\tright: 5px;\n\tleft: 5px;\n\tbackground-color: rgba(0,0,0,0.8);\n\tcolor: white;\n\ttext-align: center;\n\tfont-style: italic;\n\tfont-size: 0.8em;\n\tmargin: 0;\n\tpadding: 0;\n}\n\n.maplibregl-marker {\n\twidth: 60px;\n}\n\n/* Resize canvas for print */\n@media print {\n\t.pnx-map.maplibregl-map .maplibregl-canvas-container {\n\t\twidth: 100% !important;\n\t\theight: unset !important;\n\t}\n}\n\n/* Discard default indoor= widget */\n.pnx-map .maplibregl-ctrl-indoorequal {\n\tdisplay: none;\n}"),document.adoptedStyleSheets.push(GB),document.adoptedStyleSheets.push(HB),function(e){Vh.WORKER_URL=e}(new URL("./maplibre-gl-worker.mjs","undefined"==typeof document?require("url").pathToFileURL(__filename).href:e&&"SCRIPT"===e.tagName.toUpperCase()&&e.src||new URL("index.js",document.baseURI).href).toString()),Gh("pmtiles",(new vB).tile),Gh("panora",(new Pc).tile()),Gh("panoras",(new Pc).tile());let WB=class extends rL{constructor(e,t,i={}){super({container:t,style:e.mapStyleComposer.getMapStyle(),center:[0,0],zoom:0,maxZoom:24,attributionControl:!1,dragRotate:!1,pitchWithRotate:!1,touchZoomRotate:!0,touchPitch:!1,doubleClickZoom:!1,canvasContextAttributes:{preserveDrawingBuffer:!e.isWidthSmall()},transformRequest:e.api._getMapRequestTransform(),locale:e._t.maplibre,hash:!1,...i}),this._semMapProtocol=new kc(e),Gh("sem",this._semMapProtocol.tile()),this._loadMarkerImages(),this._parent=e,this._parent.mapStyleComposer.map=this,this._options=i,this.getContainer().classList.add("pnx-map"),void 0===i.touchZoomRotate&&this?.touchZoomRotate?.disableRotation(),this._options.raster&&(this._options.background=this._options.background||"streets"),this._options.basemaps&&this._parent.mapStyleComposer._createManyBasemaps(this._options.basemaps,this._options.background),Rc(this,![void 0,Ic].includes(this._options?.indoor?.level)),this._attribution=new QR({compact:!1,...i.attributionControl}),this.addControl(this._attribution),this._scale=new CL,this.addControl(this._scale),this._initMapPosition(),this._picMarker=this._getPictureMarker(),this._picMarkerPreview=this._getPictureMarker(!1),this._picPreviewTimer=null,this._picPopup=new zL({closeButton:!1,closeOnClick:!this._parent.isWidthSmall(),offset:15}),this.on("mouseout",()=>{this._parent?.isMapWide?.()||(this.getCanvas().style.cursor="",this._dropPreview())}),this._picThumbUrl={},this._seqPictures={},this._parent.addEventListener("select",this._parent.mapStyleComposer.updateMapStyle.bind(this._parent.mapStyleComposer)),this._parent.mapStyleComposer.addEventListener("panoramax-changed",this._onPanoramaxChanged.bind(this)),setTimeout(()=>{!this.loaded()&&this._parent?.loader.isVisible()&&this._parent.loader.dismiss({},this._parent._t.map.slow_loading,async()=>{await this._postLoad(),this._parent.loader.dismiss()})},15e3),this.waitForEnoughMapLoaded().then(async()=>await this._postLoad())}_postLoad(){this.resize(),this.fire("ready")}_dropPreview(e){clearTimeout(this._picDropPreviewTimer),e?this._picDropPreviewTimer=setTimeout(this._dropPreview.bind(this),250):(clearTimeout(this._picPreviewTimer),delete this._picPopup._picId,delete this._picPopup._loading,this._picPopup.remove(),this._picMarkerPreview.remove(),this._picPinMarker?.remove?.())}destroy(){this.remove(),delete this._semMapProtocol,delete this._parent,delete this._options,delete this._attribution,delete this._scale,delete this._picMarker,delete this._picMarkerPreview,delete this._picPreviewTimer,delete this._picPopup,delete this._picThumbUrl,delete this._seqPictures,delete this._picPinMarker}waitForEnoughMapLoaded(){return new Promise(e=>{let t=0,i=0,n=0,a=0;const r=e=>{"source"===e.dataType&&e.tile&&(e.sourceId.startsWith("geovisio")?i++:t++)},s=e=>{"source"===e.dataType&&e.tile&&(e.sourceId.startsWith("geovisio")?(a++,e.isSourceLoaded&&(a=i)):(n++,e.isSourceLoaded&&(n=t))),o()},o=()=>{n/t>=.75&&(0===i||a/i>=.75)&&(this.off("sourcedata",s),this.off("sourcedataloading",r),e())};this.on("sourcedataloading",r),this.on("sourcedata",s)})}_initMapPosition(){!Do(this._options.center)||this._options.zoom&&0!==this._options.zoom||this._options.hash||this._parent.onceAPIReady().then(()=>{let e=this._parent?.api?.getDataBbox();if(e)try{e=new gT(e),this.loaded()?this.fitBounds(e,{animate:!1}):this.waitForEnoughMapLoaded().then(()=>this.fitBounds(e,{animate:!1}))}catch(t){console.warn("Received invalid bbox: "+e)}})}addSource(e,t){this._parent.mapStyleComposer.registerSource(e,t),super.addSource(e,t)}addLayer(e,t){this._parent.mapStyleComposer.registerLayer(e,t),super.addLayer(e,t)}_loadMarkerImages(){[{id:"pnx-marker",img:uo}].forEach(e=>{const t=new Image(64,64);t.onload=()=>this.addImage(e.id,t),Ue(e.img,t)})}_hasQualityScore(){const e=this.getStyle()?.metadata?.["panoramax:fields"]||{};return e?.pictures?.includes("gps_accuracy")&&e?.pictures?.includes("h_pixel_density")}_hasGridStats(){const e=this.getStyle()?.metadata?.["panoramax:fields"]||{};return e?.grid?.includes("nb_360_pictures")&&e?.grid?.includes("nb_flat_pictures")&&e?.grid?.includes("coef_360_pictures")&&e?.grid?.includes("coef_flat_pictures")}_hasLoggedGridStats(){const e=this.getStyle()?.metadata?.["panoramax:fields"]||{};return e?.grid?.includes("logged_coef_360_pictures")&&e?.grid?.includes("logged_coef_flat_pictures")&&e?.grid?.includes("logged_coef")}reloadVectorTiles(){this._parent.mapStyleComposer?.layerRanges?.panoramax&&Object.values(this._parent.mapStyleComposer.layerRanges.panoramax).forEach(e=>{Object.keys(e.sources).forEach(e=>{const t=this.getSource(e);t&&t.setTiles(t.tiles)})})}displayPictureMarker(e,t,i,n=!1,a=null){this._picMarkerPreview.remove(),this._picPinMarker?.remove?.(),void 0!==e&&void 0!==t?(this._picMarker.setLngLat([e,t]).setRotation(i).addTo(this),this._picMarker.picId=a):this._picMarker.remove(),this._parent.mapStyleComposer.updateMapStyle(),n||void 0===e||void 0===t||this.jumpTo({center:[e,t],zoom:this.getZoom()<17?17:this.getZoom()})}_onPanoramaxChanged(){const e=this._parent.mapStyleComposer,t=e.layerRanges.panoramax[e.panoramax].layers.find(e=>e.id.endsWith("_pictures"))?.id,i=e.layerRanges.panoramax[e.panoramax].layers.find(e=>e.id.endsWith("_sequences_plus"))?.id,n=e.layerRanges.panoramax[e.panoramax].layers.find(e=>e.id.endsWith("_grid"))?.id;t&&i||console.error("Panoramax source not loaded"),this.on("mousemove",t,e=>{this.getCanvas().style.cursor="pointer";const i=Object.assign({},e);this._attachPreviewToPictures(i,t)}),this.on("mouseleave",t,()=>{this.getCanvas().style.cursor=""}),this.on("click",t,this._onPictureClick.bind(this)),this.on("mousemove",i,e=>{if(!(this.getZoom()>=po)&&(this._onSequenceHover(e),this.getCanvas().style.cursor="pointer",e.features[0].properties.id)){const t=Object.assign({},e);this._attachPreviewToPictures(t,i)}}),this.on("mouseleave",i,()=>{this.getZoom()>=po||(this.getCanvas().style.cursor="",this._dropPreview(!0))}),this.on("click",i,e=>{e.preventDefault(),this._onSequenceClick(e)}),n&&(this.on("mousemove",n,e=>{if(this.getZoom()<=16){this.getCanvas().style.cursor="pointer";const t=Object.assign({},e);this._attachPreviewToPictures(t,n)}}),this.on("mouseleave",n,()=>{this.getZoom()>=po||(this._dropPreview(),this.getCanvas().style.cursor="")}),this.on("click",n,e=>{e.preventDefault();const t=e.features[0];t.properties.best_item?(this._parent.select(null,t.properties.best_item),this._parent._setFocus?.("pic")):this.flyTo({center:e.lngLat,zoom:9})}))}_attachPreviewToPictures(e,t){let i=e.features.pop();if(!i)return void this._picPinMarker?.remove?.();if(!i||(i.properties.id||i.properties.best_item)==this._picPopup._picId)return;clearTimeout(this._picPreviewTimer),clearTimeout(this._picDropPreviewTimer),this._picPopup._loading=i.properties.id,this._picPopup._picId=i.properties.id,delete this._picPopup._seqId,e.lngLat||(e.lngLat=this.getCenter());let n=null;if(t.includes("_pictures")&&"Point"===i.geometry.type)n=i;else if(t.includes("_grid")&&"Polygon"===i.geometry.type)n={type:"Feature",geometry:{type:"Point",coordinates:i.geometry.coordinates[0][0]},properties:{id:i.properties.best_item}};else if(this.getZoom()<po&&t.includes("_sequences")&&"LineString"===i.geometry.type){let t=null;for(let a=0;a<i.geometry.coordinates.length;a++){let r=e.lngLat.distanceTo(new Ex(...i.geometry.coordinates[a]));(!t||r<t)&&(n={type:"Feature",geometry:{type:"Point",coordinates:i.geometry.coordinates[a]},properties:{first_sequence:i.properties.id,collection:i.properties.id}},t=r)}}n&&void 0!==n.properties.heading?(this._picPopup._seqId=n.properties.first_sequence,this._picMarkerPreview.setLngLat?.(n.geometry.coordinates).setRotation(n.properties.heading||0).addTo(this)):this._picMarkerPreview?.remove?.();let a=n?n.geometry.coordinates:e.lngLat;if("thumb"===this._options.preview)this._picPopup.setLngLat(a).addTo(this);else if("marker"===this._options.preview&&(!n||void 0===n.properties.heading)){if(!this._picPinMarker){const e=Ue("data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8' standalone='no'%3f%3e%3c!-- Generator: Adobe Illustrator 16.0.0%2c SVG Export Plug-In . SVG Version: 6.00 Build 0) --%3e%3csvg version='1.1' id='Capa_1' x='0px' y='0px' width='32' height='32' viewBox='0 0 32 32' xml:space='preserve' xmlns:xlink='http://www.w3.org/1999/xlink' xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg'%3e%3cdefs id='defs19'%3e%3clinearGradient y2='195.90816' x2='212.88858' y1='98.091812' x1='382.31149' gradientUnits='userSpaceOnUse' id='SVGID_1_' gradientTransform='matrix(4.4379641%2c0%2c0%2c4.4379641%2c-886.70524%2c-217.09784)' spreadMethod='pad'%3e %3cstop id='stop4' style='stop-color:%238F2A85' offset='0' /%3e %3cstop id='stop6' style='stop-color:%232570B6' offset='1' /%3e %3c/linearGradient%3e%3clinearGradient xlink:href='%23SVGID_1_' id='linearGradient27' x1='30.55006' y1='29.297422' x2='17.272936' y2='8.0495806' gradientUnits='userSpaceOnUse' gradientTransform='matrix(0.66910611%2c0%2c0%2c0.66910611%2c0%2c1.2499974)' /%3e%3c/defs%3e%3ccircle style='fill:white%3bfill-opacity:1%3bstroke:none%3bstroke-width:5.30813%3bstroke-linecap:square%3bstroke-linejoin:round%3bpaint-order:markers stroke fill' id='path3' cx='15.999331' cy='9.2110214' r='4.1819134' /%3e%3cpath d='m 24.381558%2c9.7115132 c 0%2c-4.6295451 -3.752348%2c-8.3818922 -8.382562%2c-8.3818922 -4.630214%2c0 -8.381892%2c3.7523471 -8.381892%2c8.3818922 0%2c6.6328488 8.381892%2c16.4479668 8.381892%2c16.4479668 0%2c0 8.382562%2c-9.849242 8.382562%2c-16.4479668 z M 11.865259%2c9.2110219 c 0%2c-2.2836592 1.851416%2c-4.1344067 4.134406%2c-4.1344067 2.28299%2c0 4.134407%2c1.8507475 4.134407%2c4.1344067 0%2c2.2836591 -1.851417%2c4.1344071 -4.134407%2c4.1344071 -2.28299%2c0 -4.134406%2c-1.850748 -4.134406%2c-4.1344071 z' fill='%23006df0' id='path1' style='fill:url(%23linearGradient27)%3bstroke-width:0.414563%3bstroke-dasharray:none' /%3e%3ccircle cx='15.998996' cy='9.2110214' r='2.0327444' fill='%23006df0' id='circle1' style='fill:url(%23SVGID_1_)%3bstroke-width:0.414543' /%3e%3cpath d='m 20.738275%2c20.743521 c -0.683158%2c0.9876 -1.324161%2c1.847402 -1.858108%2c2.537919 5.296644%2c0.318495 8.767967%2c1.461997 10.059341%2c2.312431 -1.512849%2c0.997637 -6.007903%2c2.400083 -12.939174%2c2.400083 -6.9306007%2c0 -11.4263246%2c-1.403115 -12.9391735%2c-2.400083 1.2913747%2c-0.850434 4.7600208%2c-1.993267 10.0513115%2c-2.311762 -0.535284%2c-0.690517 -1.176957%2c-1.54965 -1.860784%2c-2.53725 C 4.7339257%2c21.386532 0%2c23.314895 0%2c25.593202 0%2c28.396756 7.1641191%2c30.670379 16.000334%2c30.670379 24.837219%2c30.670379 32%2c28.398095 32%2c25.593202 32.0013%2c23.313557 27.262059%2c21.384524 20.738275%2c20.743521 Z' fill='%23006df0' id='path2' style='fill:%238f2a85%3bfill-opacity:1%3bstroke-width:0.414543' /%3e%3c/svg%3e");e.style.width="40px",this._picPinMarker=new vL({element:e,anchor:"bottom",offset:[0,10]})}this._picPinMarker.setLngLat(a).addTo(this)}n||this._picThumbUrl[i.properties.id]||this._picPopup.setDOMContent(To(this._parent._t));const r=e=>{if("thumb"===this._options.preview&&this._picPopup._loading===i.properties.id)if(e){let t=document.createElement("img");t.classList.add("pnx-map-thumb"),t.alt=this._parent._t.map.thumbnail;let n=new Image;if(n.src=e,n.addEventListener("load",()=>{this._picPopup._loading===i.properties.id&&(i.properties.hidden?t.children[0].src=n.src:t.src=n.src,this._picPopup.setDOMContent(t),delete this._picPopup._loading)}),i.properties.hidden){const e=document.createElement("div");e.classList.add("pnx-map-thumb-legend"),e.appendChild(document.createTextNode(this._parent._t.map.not_public));const i=document.createElement("div");i.appendChild(t),i.appendChild(e),t=i}}else this._picPopup.remove()};this._picPopup._loading===i.properties.id&&(this._picThumbUrl[n?.properties?.id||i.properties.id]?r(this._picThumbUrl[n?.properties?.id||i.properties.id]):(clearTimeout(this._picPreviewTimer),this._picPreviewTimer=setTimeout(()=>{this._picPopup._loading===i.properties.id&&"thumb"===this._options.preview&&(this._picPopup.setDOMContent(To(this._parent._t)),n?n.properties.id?this._getPictureThumbURL(n.properties.id,n.properties.collection).then(r):this._getSequenceThumbURL(i.properties.collection,a).then(r):t.endsWith("_grid")?this._getThumbURL(a).then(r):t.includes("_sequences")&&this._getSequenceThumbURL(i.properties.id,a).then(r))},100)))}_getThumbURL(e){return this._parent.getAPI().getPicturesAroundCoordinates(e.lat,e.lng,.1,1).then(e=>{const t=e?.features?.pop();return t?this._parent.getAPI().findThumbnailInPictureFeature(t):null})}_getSequenceThumbURL(e,t){return t?this._parent.getAPI().getPicturesAroundCoordinates(t.lat||t[1],t.lng||t[0],1,1,e).then(t=>t?.features?.length>0?this._parent.getAPI().findThumbnailInPictureFeature(t.features[0]):this._parent.getAPI().getPictureThumbnailURLForSequence(e)):this._parent.getAPI().getPictureThumbnailURLForSequence(e)}_getPictureThumbURL(e,t){let i=Promise.resolve();return e&&(void 0!==this._picThumbUrl[e]?i="string"==typeof this._picThumbUrl[e]?Promise.resolve(this._picThumbUrl[e]):this._picThumbUrl[e]:(this._picThumbUrl[e]=this._parent.getAPI().getPictureThumbnailURL(e,t).then(t=>t?(this._picThumbUrl[e]=t,t):(this._picThumbUrl[e]=null,null)).catch(()=>{this._picThumbUrl[e]=null}),i=this._picThumbUrl[e])),i}_getPictureMarker(e=!0){return new vL({element:Ue(e?"data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8' standalone='no'%3f%3e%3csvg width='48' height='48' viewBox='0 0 48 48' version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg'%3e %3cpath d='m 8.0222924%2c7.8597977 a 22.594107%2c22.594107 0 0 1 31.9555636%2c0.0027 L 24.001409%2c23.838916 Z' style='fill:%23bf360c%3bfill-opacity:1%3bstroke:white%3bstroke-width:2.50003%3bstroke-miterlimit:4%3bstroke-dasharray:none%3bstroke-opacity:1' /%3e %3ccircle cx='24' cy='24' r='9.9777565' style='fill:%23ff6f00%3bfill-opacity:1%3bstroke:white%3bstroke-width:2.49449%3bstroke-miterlimit:4%3bstroke-dasharray:none%3bstroke-opacity:1' /%3e%3c/svg%3e":uo),picId:null}).setDraggable(e&&this._options.picMarkerDraggable)}_onSequenceHover(e){e.preventDefault(),e.features.length>0&&e.features[0].properties?.id&&this.fire("sequence-hover",{seqId:e.features[0].properties.id})}_onSequenceClick(e){if(e.preventDefault(),e.originalEvent.stopImmediatePropagation(),"pic"!==this._parent.psv?.getPicturesNavigation()&&e.features.length>0){let t=e.features[0];e.features.length>1&&this._picPopup._seqId&&(t=e.features.find(e=>e.properties.id===this._picPopup._seqId)||t),t.properties?.id&&this.fire("sequence-click",{seqId:t.properties.id,coordinates:e.lngLat})}}_onPictureClick(e){if(e.preventDefault(),e.originalEvent.stopImmediatePropagation(),"pic"===this._parent.psv?.getPicturesNavigation())return;const t=this.queryRenderedFeatures(e.point);if(t.length>1&&t.find(e=>e?.source?.startsWith("sem-")))return;const i=e?.features?.length>0?e.features[0]:null;if(i?.properties?.id){let t=null;try{i.properties.sequences&&(Array.isArray(i.properties.sequences)||(i.properties.sequences=JSON.parse(i.properties.sequences)),t=i.properties.sequences.pop())}catch(e){console.log("Sequence ID is not available in vector tiles for picture "+i.properties.id)}this.fire("picture-click",{picId:i.properties.id,seqId:t,feature:i})}}addEventListener(e,t,i={}){i?.once?this.once(e,t):this.on(e,t)}};const ZB={minDate:"date_from",maxDate:"date_to",pic_type:"pic_type",camera:"camera",theme:"theme",qualityscore:"pic_score",gps:"gps"},KB=Object.fromEntries(Object.entries(ZB).map(e=>[e[1],e[0]])),XB=["none","null","false",!1],QB=["antialias","bearing","bearingSnap","bounds","boxZoom","clickTolerance","collectResourceTiming","cooperativeGestures","crossSourceCollisions","doubleClickZoom","dragPan","dragRotate","fadeDuration","failIfMajorPerformanceCaveat","fitBoundsOptions","hash","interactive","localIdeographFontFamily","locale","logoPosition","maplibreLogo","maxBounds","maxCanvasSize","maxPitch","maxTileCacheSize","maxTileCacheZoomLevels","maxZoom","minPitch","minZoom","pitch","pitchWithRotate","pixelRatio","preserveDrawingBuffer","refreshExpiredTiles","renderWorldCopies","scrollZoom","touchPitch","touchZoomRotate","trackResize","transformCameraUpdate","transformRequest","validateStyle"];class YB{constructor(e={},t={},i={}){"false"===e["url-parameters"]&&(t={});let n={};"object"==typeof e?.["psv-options"]&&(n=e["psv-options"]);let a={};"object"==typeof e?.["map-options"]&&(a=e["map-options"]);let r={};"object"==typeof i?.map&&(r=i.map);let s=t.map&&"none"!==t.map?JB(t.map):null,o=!XB.includes(t.map)&&!XB.includes(e["map-options"]),l=t.focus||e.focus,c=t.pic||e.picture,u=t.seq||e.sequence,h=t.users||e["endpoint-to-use"]||r.endpoint,d=t.speed||n?.transitionDuration,p=t.nav||n?.picturesNavigation,m=t.theme||a.theme||r?.theme,g=t.background||a.background||r?.background,f=s?.center||!c&&(a.center||r?.center)||[0,0],A=s?.zoom||a.zoom||r?.zoom,_=s?.pitch||a.pitch,v=s?.bearing||a.bearing,y=t.level||a.indoor?.level,x=e.geocoder,b=e.widgets,w=e["fetch-options"],E=e.style,k=e.lang,S=e.endpoint,M=a.raster,C=a.basemaps,T=a.indoor,D=a.attributionControl,P=a.preview,I=(F=a,Object.fromEntries(Object.entries(F).filter(([e])=>QB.includes(e))));var F;let z=e["keyboard-shortcuts"],R=e["skip-tags-menu-opening"],L="false"===i?.disableAnnotations||n?.displayAnnotations||!1,B=t.xyz,O=t.date_from,U=t.date_to,N=t.pic_type,j=t.camera,V=t.pic_score,q=t.gps,G=t.overlay,H=t.xywh,W=t.annot;!o||c||u?["map","pic"].includes(l)?"map"!==l||o||(console.warn("Parameter focus can't be 'map' as map is disabled"),l="pic"):(console.warn("Invalid value for parameter focus:",l),l=!o||c||u?"pic":"map"):l="map","aerial"!==g||M||(console.warn("Parameter background can't be 'aerial' as no aerial imagery is available"),g="streets"),y&&!T&&console.error("Can't set indoor level if indoor= plugin is not available"),!L&&W&&(L=!0),W&&!c&&console.error("Parameter annot can only be used in combination with 'picture'"),["thumb","marker","none"].includes(P)||(P&&P.length>0&&console.warn("Parameter map-options.preview is invalid, should be 'thumb', 'marker' or 'none'"),P="thumb"),this._parentInit={map:o,fetchOptions:w,style:E,lang:k,endpoint:S},this._parentPostInit={focus:l,picture:c,sequence:u,geocoder:x,widgets:b,users:h,forceFocus:!0,keyboardShortcuts:!0,willLoadPicture:void 0!==(c||u),skipTagsMenuOpening:"true"===R},this._psvInit=Object.assign(Object.fromEntries(Object.entries(n).filter(([e])=>!["transitionDuration","picturesNavigation","displayAnnotations"].includes(e))),{displayAnnotations:L}),this._psvAny={transitionDuration:d,picturesNavigation:p},this._psvPostInit={xyz:B,xywh:H,annotation:W},this._mapInit={raster:M,indoor:T,attributionControl:D,basemaps:C,preview:P,...I},this._mapAny={theme:m,background:g,center:f,zoom:A,pitch:_,bearing:v,level:y},this._mapPostInit={date_from:O,date_to:U,pic_type:N,camera:j,pic_score:V,gps:q,overlay:G},"false"===z&&(this._psvInit.keyboard=!1,this._psvInit.keyboardActions={},this._mapInit.keyboard=!1,this._parentPostInit.keyboardShortcuts=!1)}_sanitize(e){return Object.fromEntries(Object.entries(e).filter(([,e])=>void 0!==e))}getParentInit(){return this._sanitize(this._parentInit)}getParentPostInit(){return this._sanitize(this._parentPostInit)}getPSVInit(){return this._sanitize(Object.assign({},this._psvInit,this._psvAny))}getPSVPostInit(){return this._sanitize(Object.assign({},this._psvPostInit,this._psvAny))}getMapInit(){return this._sanitize(Object.assign({},this._mapInit,this._mapAny))}getMapPostInit(){return this._sanitize(Object.assign({},this._mapPostInit,this._mapAny))}static GetComponentProperties(e,t){const i={};for(let n in e.properties){e.properties[n].state||null==t[n]||(i[n]=t[n])}return i}}function JB(e,t){const i=(e||"").split("/");if(i.length>=3&&!i.some(e=>isNaN(e))){const e={center:[+i[2],+i[1]],zoom:+i[0],pitch:+(i[4]||0)};return t&&(e.bearing=t.dragRotate.isEnabled()&&t.touchZoomRotate.isEnabled()?+(i[3]||0):t.getBearing()),e}return null}function $B(e,t){t.xyz&&e.addEventListener("picture-loaded",()=>{const i=function(e){const t=(e||"").split("/");return 3!==t.length||t.some(e=>isNaN(e))?null:{x:+t[0],y:+t[1],z:+t[2]}}(t.xyz);e.setXYZ(i.x,i.y,i.z)},{once:!0}),t.xywh&&e.addEventListener("picture-loaded",()=>{const i=function(e,t){let i=(e||"").split(",");if(4!==i.length||i.some(e=>isNaN(e)))return null;{let[e,n,a,r]=i.map(e=>parseFloat(e)),s=t.panorama.basePanoData;if("function"==typeof s){const e=t?.properties?.["pers:interior_orientation"]?.sensor_array_dimensions;s=e&&2===e.length?s({width:e[0],height:e[1]}):null}if(!s?.fullWidth||!s?.fullHeight)return null;const o=s?.croppedX||0,l=s?.croppedY||0,c=o+e+a/2-s.fullWidth/2,u=-(l+n+r/2-s.fullHeight/2),h=c/s.fullWidth,d=u/s.fullHeight,p=(a/s.fullWidth+r/s.fullHeight)/2;return{yaw:2*h*Math.PI,pitch:d*Math.PI,z:100*(1-p)}}}(t.xywh,e.getPictureMetadata());e.rotate(i),e.zoom(i.z)},{once:!0}),t.annotation&&(e.getPictureMetadata()?e.focusOnAnnotation(t.annotation):e.addEventListener("picture-loaded",()=>{e.focusOnAnnotation(t.annotation)},{once:!0}));let i=t.transitionDuration||t.speed;void 0!==i&&e.setTransitionDuration(i);let n=t.picturesNavigation||t.nav;["none","pic","any","seq"].includes(n)&&e.setPicturesNavigation(n)}function eO(e,t){const i=JB(t.map,e);i&&e.jumpTo(i),e.setFilters?.(function(e){const t={};for(let i in KB)e[i]&&(t[KB[i]]=e[i]);if(t.qualityscore){let e=t.qualityscore.split("");const i={A:5,B:4,C:3,D:2,E:1};t.qualityscore=e.map(e=>i[e])}return t}(t)),e._parent?.mapStyleComposer?.layerRanges.basemaps[t.background]&&e._parent.mapStyleComposer.switchBasemap(t.background),t.overlay&&t.overlay.split(",").forEach(t=>e._parent.mapStyleComposer.switchDataOverlayVisibility("sem-"+t,!0))}function tO(e,t){let i=t.picture||t.pic,n=t.sequence||t.seq||null;if(i){const t=i.split(";");t.length>1&&console.warn("Multiple picture IDs passed in URL, only first one kept"),e.select(1===t.length?n:null,t[0],!0)}else n?e.select(n,null,!0):e.select()}function iO(e,t){tO(e,t),"map"===t.focus&&e?.map?(e.setPopup(!1),e._setFocus("map",null,t.forceFocus)):"pic"===t.focus&&e?.mini?(e.setPopup(!1),e._setFocus("pic",null,t.forceFocus)):t.focus&&"meta"===t.focus&&e?.mini&&e._setFocus("pic",null,t.forceFocus),null!=t.users&&(zo(t.users)?e.mapStyleComposer._createPanoramaxEndpointForUser(t.users):e.mapStyleComposer.switchPanoramaxEndpoint(t.users))}const nO=["streets","aerial"];class aO extends EventTarget{constructor(e){super(),this._parent=e,this.map=null,this._mapUpdateDebounce=null,this.layerRanges={basemaps:{},dataUnderlays:{},panoramax:{},dataOverlays:{}},this.basemap=null,this.dataUnderlays=new Set,this.panoramax=null,this.dataOverlays=new Set,this.detachedSources={},this.panoramaxTheme=Co.default.id,this.panoramaxFilters={},this.panoramaxOriginalStyle={}}getMapStyle(){let e={},t=[],i=[],n={},a=[];const r=e=>(this.map&&(e||[]).filter(e=>this.map.getLayer(e.id)).forEach(e=>{const t=this.map.getFilter(e.id);t&&(e.filter=t)}),e),s=e=>{(e||[]).forEach(e=>{Po(e)?i.push(e):t.push(e)})},o=(e,t)=>{Array.isArray(e)?a=a.concat(e):"object"==typeof e&&null!=e?a.push(e):"string"==typeof e&&a.push({id:t,url:e})};if(Object.entries(this.detachedSources).forEach(([t,i])=>e[t]=i),this.basemap&&this.layerRanges.basemaps[this.basemap]&&(e=Object.assign(e,this.layerRanges.basemaps[this.basemap].sources),s(this.layerRanges.basemaps[this.basemap].layers),n=this.layerRanges.basemaps[this.basemap].metadata||{},o(this.layerRanges.basemaps[this.basemap].sprite,this.basemap),n?.["panoramax:locales"]||(n["panoramax:locales"]=["fr","en","de","es","ru","pt","zh","hi","latin"])),[...this.dataUnderlays].forEach(t=>{this.layerRanges.dataUnderlays[t]&&(e=Object.assign(e,this.layerRanges.dataUnderlays[t].sources),s(r(this.layerRanges.dataUnderlays[t].layers)),o(this.layerRanges.dataUnderlays[t].sprite,t))}),this.panoramax&&this.layerRanges.panoramax[this.panoramax]){n=Object.assign(n,this.layerRanges.panoramax[this.panoramax].metadata),e=Object.assign(e,this.layerRanges.panoramax[this.panoramax].sources),o(this.layerRanges.panoramax[this.panoramax].sprite,this.panoramax);let t=this._applyPanoramaxThemeOnLayers(this.layerRanges.panoramax[this.panoramax]);t=this._applyPanoramaxFiltersOnLayers(t,this.layerRanges.panoramax[this.panoramax].metadata),s(t)}if([...this.dataOverlays].forEach(t=>{this.layerRanges.dataOverlays[t]&&(e=Object.assign(e,this.layerRanges.dataOverlays[t].sources),s(r(this.layerRanges.dataOverlays[t].layers)),o(this.layerRanges.dataOverlays[t].sprite,t))}),n["panoramax:locales"]){let e=this._parent.lang||ht(n["panoramax:locales"],"latin");e.includes("-")&&(e=e.split("-")[0]),e.includes("_")&&(e=e.split("_")[0]),i.forEach(t=>{t.layout["text-field"].includes("name:latin")&&(t.layout["text-field"]=["coalesce",["get",`name:${e}`],["get","name:latin"],["get","name"]])})}const l=i.find(e=>"place_label_city"===e.id);let c=i.find(e=>"place_label_capital"===e.id);return l&&!c&&(l.paint={"text-color":"hsl(0, 0%, 0%)","text-halo-blur":0,"text-halo-color":"hsla(0, 0%, 100%, 1)","text-halo-width":3},l.layout["text-letter-spacing"]=.1,c=JSON.parse(JSON.stringify(l)),c.id="place_label_capital",c.filter=c.filter.filter(e=>!(">"===e[0]&&"capital"===e[1])),c.filter.push(["<=","capital",2]),l.filter.find(e=>">"===e[0]&&"capital"===e[1])||l.filter.push([">","capital",2]),i.push(c)),e.plan_ign&&(e.plan_ign.maxzoom=18),e.openmaptiles&&!(e.openmaptiles.attribution||"").includes("OpenMapTiles")&&(e.openmaptiles.attribution+=" | © <a href='https://openmaptiles.org/'>OpenMapTiles</a>"),{version:8,name:"Panoramax Map Style",sources:e,layers:t.concat(i).filter(e=>e.id),metadata:n,sprite:a.length>0?a:void 0}}updateMapStyle(e=!1){clearTimeout(this._mapUpdateDebounce),this._mapUpdateDebounce=setTimeout(()=>{this.map?.setStyle(this.getMapStyle(),{diff:!0}),e&&(this.map._semMapProtocol.clearCache(),Object.entries(this.map?.getStyle()?.sources||{}).filter(([,e])=>e.tiles&&e.tiles[0].startsWith("sem")).forEach(([e])=>{const t=this.map.getSource(e);t.setTiles(t.tiles)}))},10)}registerSource(e,t){let i=!1;const n=Object.keys(this.layerRanges);for(let t=0;t<n.length;t++){const a=this.layerRanges[n[t]],r=Object.keys(a);for(let t=0;t<r.length;t++){if(r[t]===e){i=!0;break}}if(i)break}i||("indoorequal"===e&&(t.attribution='<a href="https://indoorequal.org/" target="_blank">© indoor=</a>'),this.detachedSources[e]=t)}registerLayer(e,t){let i="dataOverlays";if(("indoorequal"===e.source||t)&&(i="dataUnderlays"),"indoorequal"===e.source&&"indoor-heat"===e.id&&!1===this._parent?._initParams?.getMapInit()?.indoor?.heatmap)return;let n=!1;if(Object.values(this.layerRanges[i]).forEach(t=>{t.sources[e.source]&&(t.layers||(t.layers=[]),t.layers.push(e),n=!0)}),n)return;let a={sources:{},layers:[e]};this.detachedSources[e.source]&&(a.sources[e.source]=this.detachedSources[e.source],delete this.detachedSources[e.source],"dataOverlays"===i?this.addDataOverlay(e.id,a,!0):"dataUnderlays"===i&&this.addDataUnderlay(e.id,a,!0))}async waitFor(e,t){return this.layerRanges[e][t]?await Promise.resolve():await new Promise(e=>setTimeout(e,250)).then(()=>this.waitFor(e,t))}async addBasemap(e,t,i=!1){"string"==typeof t&&(t=await fetch(t).then(e=>e.json())),this.layerRanges.basemaps[e]=t,this.dispatchEvent(new CustomEvent("basemap-added",{detail:{basemap:e}})),i&&this.switchBasemap(e)}async switchBasemap(e){e&&!this.layerRanges.basemaps[e]&&await this.waitFor("basemaps",e),this.basemap!==e&&e&&(this.basemap=e,this.updateMapStyle(),this.dispatchEvent(new CustomEvent("basemap-changed",{detail:{basemap:e}})))}hasManyBasemaps(){return Object.keys(this.layerRanges.basemaps).length>=2}hasStreetsAerialBasemaps(){return null!=this.layerRanges.basemaps.aerial&&null!=this.layerRanges.basemaps.streets}hasComplementaryBasemaps(){return null!=Object.keys(this.layerRanges.basemaps).find(e=>!nO.includes(e))}addDataUnderlay(e,t,i=!1){this.layerRanges.dataUnderlays[e]=t,this.dispatchEvent(new CustomEvent("dataunderlay-added",{detail:{dataUnderlay:e}})),i&&this.switchDataUnderlayVisibility(e,!0)}async switchDataUnderlayVisibility(e,t){e&&!this.layerRanges.dataUnderlays[e]&&await this.waitFor("dataUnderlays",e),t?this.dataUnderlays.add(e):this.dataUnderlays.delete(e),this.updateMapStyle(),this.dispatchEvent(new CustomEvent("dataunderlay-changed",{detail:{dataUnderlay:e,visible:t}}))}addPanoramaxEndpoint(e,t,i=!1){[null,void 0,1].includes(t.metadata?.["panoramax:tiles_version"])&&Object.values(t?.sources||{}).filter(e=>e.tiles).forEach(e=>e.tiles=e.tiles.map(e=>e.replace(/^http/,"panora"))),this.layerRanges.panoramax[e]=t,this.panoramaxOriginalStyle[e]=JSON.parse(JSON.stringify(t)),this.layerRanges.panoramax[e].layers=Fo(t),this.dispatchEvent(new CustomEvent("panoramax-added",{detail:{endpoint:e}})),i&&this.switchPanoramaxEndpoint(e)}async switchPanoramaxEndpoint(e){e&&!this.layerRanges.panoramax[e]&&await this.waitFor("panoramax",e),e&&e!==this.panoramax&&(this.panoramax=e,this.updateMapStyle(!0)),this.dispatchEvent(new CustomEvent("panoramax-changed",{detail:{endpoint:e}}))}isPanoramaxEndpointSingleUser(){return zo(this.panoramax)}setPanoramaxTheme(e){e!==this.panoramaxTheme&&(this.panoramaxTheme=e,this.updateMapStyle(),this.dispatchEvent(new CustomEvent("theme-changed",{detail:{theme:e}})))}setPanoramaxFilters(e){this.panoramaxFilters=e,this.updateMapStyle(),this.dispatchEvent(new CustomEvent("filters-changed",{detail:e}))}addDataOverlay(e,t,i=!1){this.layerRanges.dataOverlays[e]=t,this.dispatchEvent(new CustomEvent("dataoverlay-added",{detail:{dataOverlay:e}})),i&&this.switchDataOverlayVisibility(e,!0)}async switchDataOverlayVisibility(e,t){e&&!this.layerRanges.dataOverlays[e]&&await this.waitFor("dataOverlays",e),t?this.dataOverlays.add(e):this.dataOverlays.delete(e),this.updateMapStyle(),this.dispatchEvent(new CustomEvent("dataoverlay-changed",{detail:{dataOverlay:e,visible:t}}))}async _createPanoramaxEndpointFromAPI(e,t,i=!0){let n;t._endpoints.style?n=t._endpoints.style:t._endpoints.tiles&&(n={sources:{geovisio:{type:"vector",tiles:[t._endpoints.tiles]}}}),n&&"string"==typeof n&&(n=await fetch(n,t._getFetchOptions()).then(e=>e.json())),n&&n.sources&&this.addPanoramaxEndpoint(e,n,i)}async _createPanoramaxEndpointForUser(e){if(!zo(e))return;if(this.layerRanges.panoramax[e])return void this.switchPanoramaxEndpoint(e);let t,i,n;e.startsWith("metacatalog_")?(i=this._parent.apiMC,n=e.replace(/^metacatalog_/,"")):(i=this._parent.api,n=e),i._endpoints.user_style?t=i._endpoints.user_style.replace(/\{userId\}/g,n):i._endpoints.user_tiles&&(t={sources:{[`geovisio_${n}`]:{tiles:[i._endpoints.user_tiles.replace(/\{userId\}/g,n)]}}}),t&&"string"==typeof t&&(t=await fetch(t,i._getFetchOptions()).then(e=>e.json())),t&&t.sources&&this.addPanoramaxEndpoint(e,t,!0)}_createManyBasemaps(e,t){const i=/\{z:(\d+)\}/;Object.entries(e).forEach(([e,n])=>{if("string"==typeof n&&n.includes(".png")){let t,a;const r=n.match(i);r&&r.length>1&&(t=parseInt(r[1]),n=n.replace(i,"{z}")),(n.includes("osm")||n.includes("openstreetmap"))&&(a='© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>'),n={sources:{[e]:{type:"raster",tiles:[n],tileSize:256,maxzoom:t,attribution:a}},layers:[{id:e,type:"raster",source:e}]}}this.addBasemap(e,n,e===t)})}_createRasterBasemap(e){return this.addBasemap("aerial",{sources:{[ho]:e},layers:[{id:ho,type:"raster",source:ho}]}),ho}_applyPanoramaxThemeOnLayers(e){const t=2===e.metadata?.["panoramax:tiles_version"],i=this._parent.psv?this._parent.psv?._myVTour?.state?.loadingNode||this._parent.psv?._myVTour?.state?.currentNode?.id:this._parent.picture,n=this._parent.psv?i?this._parent.psv?._picturesSequences[i]:null:this._parent.sequence;return e.layers=e.layers.map(i=>{const a=i.id.endsWith("_pictures"),r=i.id.endsWith("_sequences"),s=i.id.endsWith("_grid");if(i.layout||(i.layout={}),i.paint||(i.paint={}),a||r){const e=["case",["==",["get","hidden"],!0],90];r&&n?e.push(["==",["get","id"],n],100):a&&n&&e.push(["in",n,["get","sequences"]],100),e.push(...Co[this.panoramaxTheme].sort),e.push(10),i.layout[(a?"circle":"line")+"-sort-key"]=e;const t=["case",["==",["get","hidden"],!0],Te.HIDDEN];r&&n?t.push(["==",["get","id"],n],Te.SELECTED):a&&n&&t.push(["in",n,["get","sequences"]],Te.SELECTED),"default"===this.panoramaxTheme?t.push(Te.BASE):t.push(...Co[this.panoramaxTheme].color),i.paint[(a?"circle":"line")+"-color"]=t,a&&(i.paint["circle-stroke-color"]=t)}if(s){const n=t?"fill-color":"circle-color";if(i.paint[n]=["case",...Co[this.panoramaxTheme].color],t&&(i.paint["fill-opacity"]="score"===this.panoramaxTheme?.8:.5),"default"===this.panoramaxTheme){let t="coef";this.panoramaxFilters.pic_type&&(t="flat"===this.panoramaxFilters.pic_type?"coef_flat_pictures":"coef_360_pictures",Io(e)&&tt()&&(t="logged_"+t)),i=Ro(i,t)}}return i}),e.layers}_applyPanoramaxFiltersOnLayers(e,t){const i=this.panoramaxFilters,n=2===t?.["panoramax:tiles_version"];return e.forEach(e=>{const t=e.id.endsWith("_pictures"),a=e.id.endsWith("_sequences")||e.id.endsWith("_sequences_plus"),r=e.id.endsWith("_grid");if(!(t||a||r&&n))return;let s=[];if(i.minDate&&""!==i.minDate&&(t?s.push([">=",["get","ts"],i.minDate]):(a||n&&r)&&s.push([">=",["get","date"],i.minDate])),i.maxDate&&""!==i.maxDate&&((a||n&&r)&&s.push(["<=",["get","date"],i.maxDate]),t)){let e=new Date(i.maxDate);e.setDate(e.getDate()+1),e=e.toISOString().split("T")[0],s.push(["<=",["get","ts"],e])}i.pic_type&&""!==i.pic_type&&(i.pic_type="flat"===i.pic_type?"flat":"equirectangular",(a||t||n&&r)&&s.push(["==",["get","type"],i.pic_type])),i.qualityscore&&i.qualityscore.length>0&&(a||t||n&&r)&&s.push(["in",xo,["literal",i.qualityscore]]),i.gps&&i.gps.length>0&&(a||t||n&&r)&&s.push(["in",yo,["literal",i.gps]]),t&&i.featuresRestrictions?.pictures&&i.featuresRestrictions.pictures.features?.length>=0&&("keep"===i.featuresRestrictions.pictures.rule?s.push(["in",["get","id"],["literal",i.featuresRestrictions.pictures.features]]):i.featuresRestrictions.pictures.features.length>0&&s.push(["!",["in",["get","id"],["literal",i.featuresRestrictions.pictures.features]]])),a&&i.featuresRestrictions?.sequences&&i.featuresRestrictions.sequences.features?.length>=0&&("keep"===i.featuresRestrictions.sequences.rule?s.push(["in",["get","id"],["literal",i.featuresRestrictions.sequences.features]]):i.featuresRestrictions.sequences.features.length>0&&s.push(["!",["in",["get","id"],["literal",i.featuresRestrictions.sequences.features]]])),0===s.length?s=["literal",!0]:(s.unshift("all"),t&&(s=["step",["zoom"],!0,po,s])),s&&(e.filter=s)}),e}_hideMapFilters(){return 2!==this._getPanoramaxStyleVersion()&&this._parent.map.getZoom()<7}_getPanoramaxStyleVersion(){return this.layerRanges.panoramax[this.panoramax]?.metadata?.["panoramax:tiles_version"]||1}}const rO=new CSSStyleSheet;rO.replaceSync("pnx-coverage-map {\n\tdisplay: block;\n\tposition: relative;\n}\n\npnx-coverage-map .maplibregl-map {\n\tposition: absolute;\n\tinset: 0;\n\tbackground-color: white;\n}\n"),document.adoptedStyleSheets.push(rO);class sO extends co{static properties={"map-options":{converter:co.GetJSONConverter()},"map-style":{type:String},user:{type:String},...co.properties};constructor(){super(),this["map-style"]=this.getAttribute("map-style")||"https://panoramax.openstreetmap.fr/pmtiles/basic.json";try{this["map-style"]=JSON.parse(this["map-style"])}catch(e){}this._mapContainer=document.createElement("div")}connectedCallback(){super.connectedCallback(),this.mapStyleComposer=new aO(this),this.mapStyleComposer.addBasemap("streets",this["map-style"],!0),this.onceAPIReady().then(()=>{this.loader.setAttribute("value",30),this._initParams=new YB(YB.GetComponentProperties(sO,this));const e=this.user&&""!=this.user;this.mapStyleComposer._createPanoramaxEndpointFromAPI("default",this.api,!e),e&&this.mapStyleComposer._createPanoramaxEndpointForUser(this.user),this._initMap()})}attributeChangedCallback(e,t,i){super.attributeChangedCallback(e,t,i),"user"===e&&1===this.api?._isReady&&(i&&""!=i?this.mapStyleComposer._createPanoramaxEndpointForUser(i):this.mapStyleComposer.switchPanoramaxEndpoint("default"))}disconnectedCallback(){super.disconnectedCallback(),this.map?.destroy()}getClassName(){return"CoverageMap"}onceReady(){return this.map&&this.map.waitForEnoughMapLoaded?this.map.waitForEnoughMapLoaded():new Promise(e=>setTimeout(e,100)).then(this.onceReady.bind(this))}render(){return[this.loader,this._mapContainer]}getSubComponentsNames(){return super.getSubComponentsNames().concat(["map","mapStyleComposer"])}_initMap(){this.map=new WB(this,this._mapContainer,Object.assign({},this._initParams.getMapInit(),{hash:!0})),this.map.addControl(new oL({showCompass:!1})),this.loader.setAttribute("value",70),this.addEventListener("select",this._onSelect.bind(this)),this.map.on("picture-click",e=>this.select(e.seqId,e.picId)),this.map.on("sequence-click",e=>this.select(e.seqId)),this.map.waitForEnoughMapLoaded().then(()=>{eO(this.map,this._initParams.getMapPostInit()),this.loader.dismiss()})}_onSelect(e){if(e.detail.picId||e.detail.seqId){const t=this.map.getLayersOrder().find(t=>t.endsWith(e.detail.picId?"pictures":"sequences")),i=this.map.queryRenderedFeatures({layers:[t],filter:["==",["get","id"],e.detail.picId||e.detail.seqId]});i.length>=0&&null!=i[0]&&this.map._attachPreviewToPictures({features:i},t)}else this.map._dropPreview()}}customElements.define("pnx-coverage-map",sO);const oO=Ne("data:image/svg+xml,%3csvg viewBox='0 0 64 64' width='64' height='64' xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg'%3e%3cpath d='M 27.359486%2c12.65513 1.4316349%2c43.49917 c -3.2999082%2c3.906014 -0.53876046%2c9.96707 4.6468097%2c9.96707 H 57.934146 c 5.118225%2c0 7.946718%2c-5.993711 4.64681%2c-9.96707 L 36.653105%2c12.65513 c -2.424422%2c-2.8284931 -6.869197%2c-2.8284931 -9.293619%2c0 z' style='fill: currentColor%3bfill-opacity:1%3bstroke-width:0.673451' /%3e%3c/svg%3e","white"),lO=Ne("data:image/svg+xml,%3csvg viewBox='0 0 64 192' width='64' height='192' xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg'%3e%3ccircle cx='32' cy='32' r='29.897806' style='fill: currentColor%3bfill-opacity:1%3bstroke:white%3bstroke-width:4.20439%3bstroke-miterlimit:4%3bstroke-dasharray:none%3bstroke-opacity:1' /%3e%3cpath d='m 34.279873%2c20.262171 6.711442%2c6.714294 c 0.891465%2c0.891465 2.339986%2c0.891465 3.231451%2c0 0.891466%2c-0.891465 0.891466%2c-2.339985 0%2c-3.23145 -9.662902%2c-9.665829 -3.794285%2c-3.794286 -8.180297%2c-8.180298 -1.071396%2c-1.074322 -2.525696%2c-1.677165 -4.039972%2c-1.677165 -1.517129%2c0 -2.968576%2c0.602858 -4.042825%2c1.677165 l -8.180298%2c8.180298 c -0.894317%2c0.891465 -0.894317%2c2.339986 0%2c3.23145 0.891466%2c0.891465 2.339987%2c0.891465 3.231452%2c0 l 6.697106%2c-6.694253 v 27.703943 c 0%2c0 -0.109706%2c2.126292 2.285971%2c2.126292 2.395676%2c0 2.28597%2c-2.126292 2.28597%2c-2.126292 z' style='fill:white%3bfill-opacity:1%3bfill-rule:evenodd%3bstroke-width:0.731429' /%3e%3c/svg%3e",Te.NEXT);function cO(e){if(!([null,void 0,""].includes(e)||"string"==typeof e&&""===e.trim())){if("number"==typeof e)return e;if("string"!=typeof e);else{if(/^-?\d+(\.\d+)?\/-?\d+(\.\d+)?$/.test(e)){const t=e.split("/").map(e=>parseFloat(e));return t[0]/t[1]}try{return parseFloat(e)}catch(e){}}}}function uO(e){let t=null;const i=e?.properties?.["quality:horizontal_accuracy"]||cO(e?.properties?.exif?.["Exif.GPSInfo.GPSHPositioningError"]),n=cO(e?.properties?.exif?.["Exif.GPSInfo.GPSDOP"]);return void 0!==i?t=`${i} m`:void 0!==n&&(t=n<1?"ideal":n<2?"excellent":n<5?"good":n<10?"moderate":n<20?"fair":"poor"),t}function hO(e){let t=e.properties?.["view:azimuth"];if(void 0===t){const i=cO(e.properties?.exif?.["Exif.GPSInfo.GPSImgDirection"]);void 0!==i&&(t=i)}t=t||0;let i=e.properties?.["pers:yaw"],n=["Xmp.GPano.PoseHeadingDegrees","Xmp.Camera.Yaw","Exif.MpfInfo.MPFYawAngle"];if(void 0===i)for(let t of n){const n=cO(e.properties?.exif?.[t]);if(void 0!==n){i=n;break}}i=i||0,Math.round(t)===Math.round(i)&&i>0&&console.warn("Picture with UUID",e.id,"has same GPS Image direction and Yaw, could cause rendering issues");let a=e.properties?.["pers:pitch"];if(n=["Xmp.GPano.PosePitchDegrees","Xmp.Camera.Pitch","Exif.MpfInfo.MPFPitchAngle"],void 0===a)for(let t of n){const i=cO(e.properties?.exif?.[t]);if(void 0!==i){a=i;break}}a=a||0;let r=e.properties?.["pers:roll"];if(n=["Xmp.GPano.PoseRollDegrees","Xmp.Camera.Roll","Exif.MpfInfo.MPFRollAngle"],void 0===r)for(let t of n){const i=cO(e.properties?.exif?.[t]);if(void 0!==i){r=i;break}}r=r||0;return!(360===e.properties?.["pers:interior_orientation"]?.field_of_view)&&(0!==a||0!==r)||0!==a&&0!==r?{pan:at(i),tilt:at(-a),roll:at(r)}:{}}function dO(e,t){let i;if(e.properties?.["pers:interior_orientation"]&&e.properties["pers:interior_orientation"]?.visible_area&&e.properties["pers:interior_orientation"]?.sensor_array_dimensions){const t=e.properties["pers:interior_orientation"].visible_area,n=e.properties["pers:interior_orientation"].sensor_array_dimensions;try{i={fullWidth:parseInt(n[0]),fullHeight:parseInt(n[1]),croppedX:parseInt(t[0]),croppedY:parseInt(t[1]),croppedWidth:parseInt(n[0])-parseInt(t[2])-parseInt(t[0]),croppedHeight:parseInt(n[1])-parseInt(t[3])-parseInt(t[1])}}catch(t){console.warn("Invalid pers:interior_orientation values for cropped panorama "+e.id)}}if(!i&&e.properties?.exif)try{i={fullWidth:parseInt(e.properties.exif?.["Xmp.GPano.FullPanoWidthPixels"]),fullHeight:parseInt(e.properties.exif?.["Xmp.GPano.FullPanoHeightPixels"]),croppedX:parseInt(e.properties.exif?.["Xmp.GPano.CroppedAreaLeftPixels"]),croppedY:parseInt(e.properties.exif?.["Xmp.GPano.CroppedAreaTopPixels"]),croppedWidth:parseInt(e.properties.exif?.["Xmp.GPano.CroppedAreaImageWidthPixels"]),croppedHeight:parseInt(e.properties.exif?.["Xmp.GPano.CroppedAreaImageHeightPixels"])},i.croppedWidth>i.fullWidth&&(i.fullWidth=i.croppedWidth),i.croppedHeight>i.fullHeight&&(i.fullHeight=i.croppedHeight)}catch(t){console.warn("Invalid XMP.GPano values for cropped panorama "+e.id)}if(i&&(i=Object.fromEntries(Object.entries(i||{}).filter(e=>!isNaN(e[1]))),(!i.fullWidth&&!i.croppedWidth&&i.fullHeight&&!i.croppedHeight||i.fullWidth&&!i.croppedWidth&&!i.fullHeight&&!i.croppedHeight||i.fullWidth&&!i.croppedWidth&&i.fullHeight&&!i.croppedHeight||i.fullWidth==i.croppedWidth&&i.fullHeight==i.croppedHeight)&&(i={})),i?.fullWidth&&t?.width){let e=t.width/(i?.croppedWidth||i.fullWidth);i={fullWidth:void 0!==i.fullWidth?Math.floor(i.fullWidth*e):void 0,fullHeight:void 0!==i.fullHeight?Math.floor(i.fullHeight*e):void 0,croppedWidth:void 0!==i.croppedWidth?Math.floor(i.croppedWidth*e):void 0,croppedHeight:void 0!==i.croppedHeight?Math.floor(i.croppedHeight*e):void 0,croppedX:void 0!==i.croppedX?Math.floor(i.croppedX*e):void 0,croppedY:void 0!==i.croppedY?Math.floor(i.croppedY*e):void 0}}return i||{}}function pO(e){return(t,i)=>"related"!==t.rel&&"related"!==i.rel?0:"related"!==t.rel?-1:"related"!==i.rel?1:t.date===i.date?Oe(e,t.geometry.coordinates)-Oe(e,i.geometry.coordinates):i.date.localeCompare(t.date)}function mO(e,t){return e.is360!==t.is360?e.is360:e.density!==t.density?e.density>t.density:e.dist<t.dist}function gO(e,t){const i=new Map;for(const n of e||[]){if(!n?.date||!n?.coords)continue;const e=n.date.slice(0,7),a={month:e,date:n.date,id:n.id,seqId:n.seqId,coords:n.coords,is360:!!n.is360,density:n.density||0,thumb:n.thumb||null,heading:n.heading??null,dist:Oe(t,n.coords)},r=i.get(e);r&&!mO(a,r)||i.set(e,a)}return[...i.values()].map(({month:e,date:t,id:i,seqId:n,coords:a,is360:r,density:s,thumb:o,heading:l})=>({month:e,date:t,id:i,seqId:n,coords:a,is360:r,density:s,thumb:o,heading:l})).sort((e,t)=>t.month.localeCompare(e.month))}function fO(e,t){const i={};if(e?.properties?.datetimetz){i.date=new Date(e.properties.datetimetz);const t=e.properties.datetimetz.match(/([+-]\d{2}):(\d{2})$|Z$/);t&&("Z"===t[0]?i.tz="UTC":i.tz=t[0])}else e?.properties?.datetime&&(i.date=new Date(e.properties.datetime));const n=e?.providers||e?.properties?.providers;if(n){let e=n.filter(e=>e?.roles?.includes("producer"));if(0===e?.length&&(e=n.filter(e=>e?.roles?.includes("host"))),e?.length>=0){const t={};e.map(e=>e.name).forEach(e=>{const i=e.toLowerCase().replace(/\s/g,"");t[i]?t[i].push(e):t[i]=[e]}),i.producer=[],Object.values(t).forEach(e=>{const t=e[0],n=e.find(e=>e.toLowerCase()!==e);i.producer.push(n||t)})}}if(e?.properties?.license&&(i.license=e.properties.license,e?.links)){const n=e.links.find(e=>"license"===e?.rel);n&&(i.license=`<a href="${n.href}" title="${t.pnx.metadata_general_license_link}" target="_blank">${i.license}</a>`)}return i}function AO(e,t,i=!1,n=null,a=e=>e){const r=null!=e.properties?.["pers:interior_orientation"]?.field_of_view;let s=r?parseInt(e.properties["pers:interior_orientation"].field_of_view):70;const o=360===s,l=a((Object.values(e.assets).find(e=>e?.roles?.includes("data"))||{}).href),c=e?.properties?.["tiles:tile_matrix_sets"]?.geovisio,u=e.links?.find?.(e=>"prev"===e?.rel&&"application/geo+json"===e?.type),h=e.links?.find?.(e=>"next"===e?.rel&&"application/geo+json"===e?.type),d=Object.values(e.assets).find(e=>e.roles?.includes("visual")&&"image/webp"===e.type),p=Object.values(e.assets).find(e=>e.roles?.includes("visual")&&"image/jpeg"===e.type),m=a((d||p).href),g=a(Object.values(e.assets).find(e=>e.roles?.includes("thumbnail")&&"image/jpeg"===e.type)?.href),f=e?.asset_templates?.tiles_webp||e?.asset_templates?.tiles,A=dO(e),_=e.links?.find?.(e=>"via"===e?.rel&&"application/json"===e?.type),v=e.properties?.["pers:interior_orientation"]?.sensor_array_dimensions;let y;if(Object.keys(A).length>0)y={baseUrl:i?l:m,origBaseUrl:i?l:m,hdUrl:l,thumbUrl:g,basePanoData:i?A:t=>dO(e,t),cropData:A,width:A.fullWidth,cols:2,rows:1,tileUrl:()=>null};else if(o&&c)y={baseUrl:m,origBaseUrl:m,basePanoData:e=>({fullWidth:e.width,fullHeight:e.height}),hdUrl:l,thumbUrl:g,cols:c&&c.tileMatrix[0].matrixWidth,rows:c&&c.tileMatrix[0].matrixHeight,width:c&&c.tileMatrix[0].matrixWidth*c.tileMatrix[0].tileWidth,tileUrl:c&&((e,t)=>a(f.href.replace(/\{TileCol\}/g,e).replace(/\{TileRow\}/g,t)))};else{const e=e=>{e.width<e.height&&!r&&(s=35);const t=s*e.height/e.width,i=360*e.width/s,n=180*e.height/t;return{fullWidth:Math.floor(i),fullHeight:Math.floor(n),croppedWidth:e.width,croppedHeight:e.height,croppedX:Math.floor((i-e.width)/2),croppedY:Math.floor((n-e.height)/2)}};let t=v?e({width:v[0],height:v[1]}):null;y={baseUrl:i?l:m,origBaseUrl:i?l:m,hdUrl:l,thumbUrl:g,basePanoData:e,cropData:t,width:t?.fullWidth||2,cols:2,rows:1,tileUrl:()=>null}}e.properties?.semantics&&(e.properties.semantics=e.properties.semantics.filter(e=>Object.keys(e).length>0));return{id:e.id,caption:fO(e,t),panorama:y,links:_O(e,n),origLinks:e.links,gps:e.geometry.coordinates,sequence:{id:e.collection,nextPic:h?h.id:void 0,prevPic:u?u.id:void 0},sphereCorrection:hO(e),horizontalFov:s,origInstance:_,properties:e.properties,permissions:vO(e)}}function _O(e,t=null){const i=e.links.filter(e=>["next","prev","related"].includes(e?.rel)&&"application/geo+json"===e?.type).filter(e=>!t||t(e)).map(e=>(e.datetime&&(e.date=e.datetime.split("T")[0]),e)),n=e.geometry.coordinates,a=[],r={N:[],ENE:[],ESE:[],S:[],WSW:[],WNW:[]};for(let e of i){r[We(n,e.geometry.coordinates)].push(e)}for(let e in r){const t=r[e];0!==t.length&&(t.sort(pO(n)),a.push(t.shift()))}let s=e=>"related"===e.rel?{element:je(lO),size:{width:128/3,height:128}}:{element:je(oO),size:{width:75,height:75}};const o=-at(e.properties?.["view:azimuth"]||0);return a.map(e=>({nodeId:e.id,gps:e.geometry.coordinates,arrowStyle:s(e),linkOffset:{yaw:o}}))}function vO(e){let t=!1,i=!1;return e.links.find(e=>"PATCH"===e.method&&e.attributes.includes("semantics"))&&e.links.find(e=>"POST"===e.method&&"add_annotation"===e.rel)&&(t=!0),e.links.find(e=>"DELETE"===e.method&&"delete"===e.rel)&&(i=!0),{edit_semantics:t,delete_picture:i}}function yO(e){return e?.properties?.annotations?.length>0}var xO=Object.freeze({__proto__:null,apiFeatureToPSVNode:AO,filterRelatedPicsLinks:_O,getCroppedPanoData:dO,getExifFloat:cO,getGPSPrecision:uO,getHashTags:function(e){if(!e?.properties?.semantics)return[];const t=e.properties.semantics.filter(e=>"hashtags"===e.key),i=[];return t.forEach(e=>e.value.split(";").forEach(e=>i.push(e.trim()))),i},getNodeCaption:fO,getPermissions:vO,getSphereCorrection:hO,hasAnnotations:yO,pickBestPerMonth:gO,sortPicturesInDirection:pO}),bO="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAAACXBIWXMAAB2HAAAdhwGP5fFlAAAAGXRFWHRTb2Z0d2FyZQB3d3cuaW5rc2NhcGUub3Jnm+48GgAAHm5JREFUeJztnfFzU+eZ7z/SsY8tZMuIiAiMhR05Ik4UHAgOxEBDcHBISMiSyy73smGbbbaz7WRup512u9P7H+zd3na2m5nMZHbm3rl30qHDDHeYZppphi4tKY1vWNK0TpQ4OKh2TE0ESgTCQkb2se8Pr50YMNZ7JJ0j6ej9zHjskKNzTsL79fs+z/N9n9c1OzuLwhIaAO+CLw+gz/35/HcNqJ+73g3Uzf08DczM/TwFGEAOuD73lQOyQAaYmPues/S/pkZxKYEUTSOwfO6rBfADTXw58O1iCrgKXAauzH2/DEza/B6OQgnEHC7AB6yc+wogxFDJZIHPgSRwCfiML2cnRR6UQPLTDKwGWhGiqFv68opnGiGUceACYtZR3AYlkFtxAXcCbQhRVPoMUSxXEUIZQwhHDYgFKIEIXIjl0loghAioa5HrCLH8CUigxFLzAlkGhIHOuZ8VX5IB4nNf18r8LmWjFgXiAtYgRLF67p8Vt2cWEa+cm/teUwOmlgRSB3QAXYjAW2GeCYRQhhFpZcdTCwLxAOuAuxEFurKSzRhkruTIZqaYyhpkMwYAhmGQmyv16TpomgaAx6tR79HweOvxtuh4vFq5Xn0hOeBj4CMcXmdxskAaELPFPYiKtS1kswbJ0QyJ8SypRJZ0cpJUMseVxCTpdE7UxItA08Dr02kJNuIP6PgDjfiCHoKtHoLtXnSPrQKaQcQo7+FQoThRIA2IGeMeLK5m57IG54fTjAxfIRHPkBjLkkqUd5z4g40EQx6CYS8dkRbaIj47RDONEEoMhwnFSQJxI0QRxSJh5LIG8ViK+HtpRj68QvJ8BqPIGcFqNA0C7V461rUQXu8n3O1D1y0TTA4hkrM4pFrvFIGsAR7EgqJeKpEldjrJucEUo0NpjCq3BGo6tHf5WNftp2tzAH/QkpLPVWAQ+MSKm9tJtQvEB/QAwVLeNJ3METuTJDaQZGw4XXTcUMkEQo1EewNs3B60QiyfAmeoYjtLtQrEBdwL3E+JAnAjZxA7neSd4wlGHC6KRdGgo8vHpr4g0c0BtNItwwzgQ8TSq+qWXdUoED+wGVhRipslx7OcfuMCg79NfJFyrXU8Po0N24P09K8m0FqyWeUy8DbCWVw1VJNA3IgZ4z5KUP0eG0pz8rUxht9N1d5sIYsG4aiPLbtDdPX4S3HHWcRM8j5VUpGvFoF4gV6E3bwoYgNJTv18jPF4pvi3qiFaw162PxsiujlQitt9BgxQBbFJNQgkDGyiyH0Y8cEUxw+PKGEUSTDkZcf+ENHeooUyBbyDcA5XLJUsEA2RoQoXcxMlDGtojXjpP9hBOFr00uscQigVudCtVIF4ga8gAvKCSCWyHD88SmwgWbq3UtxCpMfPU18NF5si/hz4LRVoq69EgawCtiIsI6bJZQ1OHh1l4I3xqi/qVQuaDr172tixP1RMlf468DvERq2KodIE0gk8RIFZquHBFL94ZZhUUimjHPiDjTzz9U7C3QVP/LOI5dZw6d6qOCpFIC5gA8J9a5psxuBXh+OcOV5Rv3xqlmhvgL0vhPH4Ct5d8AHwxxK+UsFUgkA0RAo3VMiHh99NcezlISbSFRnj1SxNfp19L0aIFD6bfAL8P8ocvJdbIHXAIxTgpTJyBsd/OsrA8fEKzX8o0KCnL8jur4YLjU0uAm9Sxt2L5RSIDjwK3GH2g4mxDEd+8iHJMUdtPXAswZCXA9/uIhAqKNOVBE5Sptaq5RJIA7CTAtK4gwNJXntlmFxWTRvVhO7R2PeNSKEFxhTwa0Smy1bKIZAG4DFEH1tpDANOHIlz6ti4NW+lsIWe/iB7vhZBM7/iugL8OzaLxG6B6EAfJmeObMbgZz+KMRJLW/NWClsJd/s48J1oIQ0oUsAJbFxu2SmQOkTMYcpwmEpkefWHMRVvOIxAqJFDP4jiD5iOS5KI5dZ06d/qVuwSiIYQx51mPjQ+nOanP4oxkVLxhhNp8us8949dtIZ9Zj+aQATulg8MuwSyFWg384H4YIrDP46Ry1r0RoqKQPdoHPx+VyGmx0+At7B4X4kdAtmIyQr58LtCHMpLVRtoOhz4dhddPaYzXDFEcwjLsFogEYRlXZrYQJKjLw1VfDsdRWnRNNj3YoTu7aZrxqcRlnlLcFt1Y4Qrd5OZDwwqcdQshgHHXh4uZHtCybvaLMQqgXgRcYe0K3foTJJjShw1jWHA0ZeGGDqTMvMxN7ANi46vsEIgGrAdE/s54oMpjvxEiUMhRHLkJzGGB02JpAHh6St5y0grBNKDiZY8Y8NpFZArbsDIwZEfD5ndJj3fDqqklFognZjYQ55KZPnZj1QqV3EruazBT/85ZnbzWwdwVynfo5QCaUKkdKXIZg0O/3BIFQEVt2UilePVfxo029CvhxIekFQqgbgRQblUV3XDgJ/9MEZiTHUaUSxNcmySI/8SMxOf1gEPU6Kj9UolkPsxsa/j+KtxZTxUSBMfTHPicNzMRwKIMVk0pRDICkQ7UCkGB5IMvK4s6wpznHp93GyNJEoRbaPmKVYgbmALktNZYizDa69UTMMKRTVhwLF/GyY5Jp3RcWFibN6OYgVyL7Bc5kIjZ3D0pbNqJ6CiYHIZgyM/iZHLSY8hPwV2ypmnGIE0I6YxKd74aZzEqArKFcWRGJvkxOFRMx9ZTxFZrWIE8hCSlcvhwRRvq55VihIx8Ma4OLZCDg2TnsCFFCqQNiQNYtl0jmMvDanWPIrSYcCxV4bJpqWLiKuB1kIeVYhA3IguiFK8/r/jqqmbouRMpHK88aqppdaDFDDeCxHIPUiu6YYHUwyeUt3VFdbw7skEcXlTYzNif5IpzG6YagD2IlExz+UMXv6Hd0klVLOF2xEINnq6egPta8LNa5c11fn0Rs0LkJs0MtnM9NXxP10d/eB3ydFkYlK51W6DP9jIi/99I7pHKhzOAa9hoiuKWYFsQKR283L81TinXlMFwcVoWlHXsOMv2rvb1jXf73YvneiYnXXNXBi5evbk/x07c/nidfXbZhF27Guj72CH7OWmtumaEUgjYvbIexRaKpHlpX94R1nYF+HuDctX7vzL9sfr6l2m+t1MT81m3zx2/vhHZz67aNW7VSuaDt/6H5tkD/GZBn6OZAM6MzHIfUieE/jL/xNX4liE9VsDrY8d6NhjVhwAdfUuz6P/KfTkhkeCbVa8WzVj5OC4fG2kDslVEMgLxAPcLXNhfDBldstkTdC5fnlg69Nt/W5NzvG8GG6N+i17Wnfd03OHqf5itUBsIGnGALsOsSLKi6xA7kGyKHj8yIjkLWuHlWu8yx79y7VFiWMet2u27pG/WPP46s5lprutOZ03XpVubqIhRJIXGYHUIXYK5mXoTJLxYWUnWUhDY732xPMd/Xqj21uqe9bp7sbdz3X2e5frBR/h5ETG4xkzFfYIEiGDjEA6EU2n83LiyJjMZTWD2+1y7Xvx7p1NLfWm+hHL4PFq/r1/19lXV+8qycYgp3BCfgWjI7E9PJ9AXEhORbGBpDIj3sSevw0/tCLY0GHV/f13NrQ98Xx4i1X3r0bG4xmGzkgXp+8hjx0+n0DWIPaa5+XUz9XssZBte9vWhe5p7rb6OaFI8/07ng1Jb1irBU4elR6LTeTxaOUTiFTsEY+lzLZocTTRh+9Ydf/WwDa7nnfvlsDDD/atWmvX8yqd8XiGkSHpjNaSY3wpgSxDuCDz8paqmH/B6s5lvq1PrdmVr0JeSlyuWfdDu4KPtkdbpPuROZ2B16RnkVZEGWNRlhJIGIntisnxrNkueI6lJdDQ8MSh8O463S2VYy8lbs2l7/qr9v477lxm+7MrkaF3UyTHpSxsLpYI1m8nEBeSy6vTb1xQez0ATXe5n/pa+LHGZXWmzl4sJbrH3fzkC3f11zW6bZu9KhYDzhy/IHu1aYGsRKIZcC5nMPiW2ikI8PQLnVtbAg0FbcopJc3++uCzfx/Z4Xar9O8fTiUw5PavNyFaBd3C7QQiFfANnU6SVZuh6P/rjgda72oqqjlAKQms8YR3HWyX3tTmVLJpg9hp6eX/omN+MYG4gJDMHd9R+8x5aNeqjru7l5s6JMgOOtcvf7B3zxqpZbKTeeeEdAJpLYvE3IsJ5E4kjFzpZI6R4drujtjZ3XLHg32rduAqTZvLkuLC1f3InV+pdWPjyFCatFwDbA+LLLMWE4iUnXpwIFHTwfnKNd5lj+5vf7wUBkSrcLtm6x7Z17Zr9V1NUsVeR2JA7LR0Zf2WldNiApEKNGNv1e5ecysMiFZRV+9atvtv7tpdy8bGmHwi6Za6380CaUbCWpJKZGu2cm6lAdEqat3YOBbPkEpK1UR83DT+bxaI3OwhP2U5DqsNiFZR08ZGA4bks1k3zCI3C0TKWmLCc+8o7DIgWkUtGxvPybs9bisQF6JAuCS5nMFYDWav7DYgWsW9WwIPb9wZlErjO4l4LCXb9DrIgnTvQoH4kdhhFR9M1VxDhjXh5ma7DYhW4XLNujf3r9p5132+os/OqCaMHIzK7VmvY8GJBQsFIhV0xt+rrdmjJdDQ8PjftD9RDgOiVbg1l953oOPxWjM2mlhmfaGFhQJZ1ItyMyMfXjHxStVNJRgQraIWjY2jQ9Jj9wstmBJILmuQPF876d2nX4j0VoIB0SpqzdiYGM3IHuB0ywzSiIR7d3Q4bea00aqm/687ulvvWibdYKxaCazxhB872P5Aud/DDgwDzselQoRliD7UXwhE6hi1seHaWF5t3BkMdXb7K86AaBV3r1++qVaMjWNDE7KXLgeTAknUQPW8s7vljs39q/tcrtlSHZFd+dSQsXF8RDrJdINApILQxIizBbJidWPFGxCtYt7YGFy7zNHGxsSo9EkSNwgkb048mzVIpZxbAGlorNee+lpnVRgQraKu3rXsyb/tdLSxMZWclA3UbxBI3t8aidGMY+3t1WhAtArHGxsNSMhlYptACKQBiROjJDtEVCXVakC0CqcbG5NjUmNZB3Q3ILWkSCWcKZBqNyBahZONjZLWdwCvtEDSSeed/uUUA6JVONXYmJIfy/ICcdoM4iQDolU41diYSkgnm5rcLNF2cSFXklMFv1Cl4UQDolU40dh4RX4GaXQjefZHJu2MFK+TDYhW4TRjY0a+XKHPZ7GWJJvOOcaD5XQDolU4ydhoGJDNSA3oBimBZCacoY5aMSBahZOMjZMTUrNIg9QSK5up/vij1gyIVnH3+uWbtjyxuuqNjdm01JhucCOxzXayymeQmjQgWoUL14ZHV1W9sTEjZzepcyNxvLNRxQFILRsQrcIJxkbJru9uNxIn3RpVusJSBkTrqKt3LXvi+XDVGhslx7SkQKpwBnG7Xa5nvhlWBkQLWdZU59/7d507q9HYKDmmNTmBVGEJ5Mnnwz2B1Z6Ocr+H0/Hf2RB64vnw5nK/h1kkx7TbkUHrtr1t69Z2NTsiHVkNhCLN651qbHQDM/ku0qpolakMiOXh3i2Bh9dvC6wp93vIIjmmZ+QEolWHw2BNuLl569NtjykDov24XLPurU+teaxajI2aLjVEDDmBVEGC9AsDYr1LynypKD1uzaU/+lfVYWzU5IKLGTcSG2krfQZRBsTKoXGZu/nJF+7aVenGRskZZMYNTOe7qrGpov9blQGxwmj216+qdGOjV25MT7uB6/mu8vgqd4312H9ZqwyIFUhgjSfc958r19jo8UqN6etuIG9G2NtUmWmsjTuDociGO5QBsUKJPFC5xkavT2pMX5ebQbwalRaGKANiFVChxkZNA90jNaDlZhCQVpwtKANi9VCJxkavX3osX3cDUt0YWgKVMRaVAbH6qDRjY0tAOgs96Qak2sz5g+UvL7jdLtczfx/eoQyI1UclGRv9QWmdZqQF4pNXnWU8+Xy4J7DGEy73eygKo1KMjX75sZxxA1IHJpR7Btn61Oq7lQGx+glFmtdv29u2rpzv4A9Ij+WJ+SA97/aRYGv5BNIWaW5Zvy2oDIgO4f7eQG9bpLlsrodASGos54Cp+RTp1XxXB9u9EptzrWHb061bVMbKObg16rftbSvPUkuDYJtUfucqfLlZ6nK+q3WPZmbtVjLC6/0rVqzyrLX9wQpLWRFsaG+Ptqyw+7n+YKNsDeQymBAIQFBuaiop9/asqMhKrKJ47tscsD3hEmyTHsM3CETqdM7WsK+AVyoO/6rGVbY/VGEL/pW67X+3rR3SY/gGgaRkPhGK2F8M9XiVhd2peJvrpQ6PLSWhLukxfAW+FMh14Fq+T7RFfLZ7srQ6d0VUXxWlx12v5W1aWEo0DdrkVkHXmPMoLjT6JfN9SvdoBNrtdXjMzszk3a+iqE5mpu39uw2GvbIB+qX5H9yL/eFSdKyzd8UzmTWcffZ0DZObnLH177Y9Ij12FxVI3hkEILze3j35Vy5NXrT1gQrb+Pxi1ta/286N0mN3UYGkkNh+G+722doGaPSjqyP2PU1hJ2NDV0ftepamQ3uXVPwxxYKs7kKBzCKxzNJ1TfZBJeG9UxfPT16byVvpV1QXk9eM9PsDF/9s1/PCUT+6XKOGiwgtALe2HR2XucO6jQH5NyuS6anZ2Q/evnTGtgcqbOG9ty79x/TU7Gz+K0tD5wbp5dUNGrhZIBdk7tC1yW+rL+vtX144d+n8tXP2PVFhJck/Z+Nnjn/6J9seqEFXj/Qv9U8X/sPNArmKhHHRH/TQGrY33fv6/zp36mpqKmHrQxUl58pn1z/9xf/8+Ld2PjMU8eEPSAXOaW7a/rFYwwOpWSS6xb5lFsC1CWPq2MvDv0xeyI7Y+mBFyUhemPzTsZfPvnFtwt4TZ6K90mP1lrG/mEDGZO7U3Ru03f4+kc5NHf3Xs//+xzcv/cbuHLqicHKTMxN/fDPxm6P/+tEJu8WBZuqX+Sc3/8Fipf5LiEYOS9oefQGdji4fI7G07MNLwszM7Oxbv/jzx28fH48/sG1lqP3e5Wt9K/SVukfz1tW58p7Yq7Ce6enZ67mskbmayiVHPrg8Onjq0id2BuQLCUd9+OS6mFxjkVrgYgKZRcwiebdFbuoL2i6QeYzc7Mzvf31x9Pe/vmhbLl1RffT0SXekvWX2gNufLrXoxTcT3RzA46uwjnIKxRwenyYyrnKYEsglJLqdaLrGhq1B2RdQKGxlw46gbBf3CeCzxf7FUm074zJ37tm9umx71RWK26JBT99q2atvW2NbSiDnWFByvx2BVg8ReROYQmELXZv8BOQ68cwCty1aLiWQLJLWk+17QjKXKRS2sf0p6TH5Z5Zov5uvM7qUvaMj6qM1olrlKiqD1oiXkLyhdskxnk8g40h2Xtz+jJpFFJXBjn3SY3GCPM6RfAKZBT6SeVJ0c4Cgzf4sheJmWsNeM8bEIfLE2TKHz8SRPEOkb7+aRRTlpe9Ah+yl15HI1MoIZBoYlnliV0+AkIpFFGUi1OUzk1EdRuKEZ9njy87K3Ayg72CH5C0VihKiwS75sTeNGNN5kRXIJJKzSDjqp2uzvVZ4hSK6OUCHfObqLBJnc4K8QAA+QKKpA8ATh9ptbeygqG10HfoPtctePoUIzqUwI5DrSE5L/qCH3j1tJm6tUBRO7942M4fifITk7AHmBALwIZIZrR37Q/iD5T+2TeFs/MFGtsvXPXJIli3mMSuQHBCTuVDXNZ75RqcyMiqsQ4Nnvt4p284H4D0kf8HPY1YgIJZZUrukwlE/G7ergF1hDRt3BAl3S6d108DHZp9RiEBmgD/IXrz7UJgm+YPbFQopfH6d3YdMnb/ze8TYNUUhAgHhgPw071WAx6ez/8WIWmopSocGz3wjgscrPajGkezWczOFCgTgDJLFw3C3n95+6b3BCsWS9O5pNVMxN4B3Cn1WMQK5Crwve3H/c+3ipFyFogiCIS/9B6RrHgCDSDrSF6MYgYBI+0od36bpGge+1SV7gIlCcQu6V+PAd7tk95kDfI7JtO7NFCuQWeA0EltzQRzgvv+/qnhEUQAa7PtmRHYbLZgcm7ejWIGAUKlUbQSE43f7HhWPKMyxY28bUXMev/eRXN0sRSkEAuJlpE6oAug7GCbcbf+R0orqJLLRzw75fR4g2lZJ/9JeilIJZBYYQBjB8qJpcPC7URW0K/ISDDWy/1tdZk5XnkKMxZK0Oi2VQEBkCqTTabpH49B/i+KTa0uvqEF8fp1DP+g2U+8A+A8kmh7KUkqBgOgvJH3Qjc+vc/B7UZXZUtyC7tU4+APTv0CHgZL2ai61QEAUED+Xvbg17OXg97vU/hHFF+g6PPe9KK0dppbgnyHsJCXFCoHMAL/FhOc+HPVz8PtRJRIFmgYHvhulI2oqiTMJnKIAr1U+rBAIiLMWfoeJQCnS7Wf/i6aCMYXD0DTY/50us61sZxBj7ZoV72SVQAASiIBJmmhvYK5SatEbKSoWTRfiMFnrADHGLlrwSoC1AgERsH9g5gNdPQEOfjeKrkRSM2g6HPh2QeJ4H8lTCArFNWvPyVi9QIeZD8RjKQ7/cIhcVsowrKhSdK/Gc98zHXOAOPDmdxa80g3YJRAN2AGYOm0nMZbh1X+KkU6a2iWpqBJ8fp2D/xgt5EjxT4GTWBCU34xdAgEhkp3ASjMfSqdyvPrPMRJxdaitkwiGvBwyX+cAYWn6NZItqIrFToEA6EAfYCpNkc0aHPlxjPhgeQ4MVZSWyEY/B75d0NaHz4ETSFqaSoHdAgFoAB4DWsx8yDDg5LERTh49L7mPUVFxaLB9byt9B8KFpPMvI8QhXV8rBeUQCAiR7MTkTAIwdCbJsZeHyWaUSqoJ3aux75uRQjJVIGaO32CzOKB8AgGx3NoBmP4/lhzPcuRfhkiMqrikGgi2eznwnS4zm50WcgkRkNu2rFpIOQUCInB/BFhl9oNGzuDE0VFOvTaullyViga9/a30P9duZpvsQhLAm9gUkC9GuQUColj5MGBqJ/48w4Mpjr08zERKpYIrCZ9f59kXI2Yau93MCPA2NqRyl6ISBDLPA8B9hXwwmzH41eE4Z04k1GxSAUR7A+x9IYzHV7Ad4n1Em9CyU0kCAQgDD1GgBWZkKM1rr5wlOT5Z2rdSSOEPNvLM1zuLmTVmEdslTLcItYpKEwiIavs2RKbLNLmcwamjY5x6/TyGWnXZgq6LIwi27wuZaSR9M5MI64hlxsNCqESBACwDvgKsKPQG6WSO40fiDJ5KqmWXhUR6/Dz11TD+YEEZqnmSWGhZL4ZKFQiIZVYP0FnMTUZiaX51+BxjwyolXEpCXT52Hewwc+zZ7fgY0cugrMH47ahkgcxzF7AJqC/mJvHBFMcPjzCuPF1FEWz3suPZENHeoo+1mELs5SjpHvJSUw0CAfAiLPOmjI6LMXQmycljY4yrGcUUoYiX7ftCdPWU5LyXJKI1T8E9c+2iWgQC4ALuB6JzPxfF2FCagV+OM3Q6iaFilMXRhLFw6+7WYjJTC5lFpHBjlKhvldVUk0DmWQ5soYgAfiHJ8Sxnjl/gD6cSZNNKKQAen8aG7UF6+lcXag9ZjMuIwp90x5tKoBoFAmIGWQd0A3WluKGRM4idTvHOiXFGhtK1l/nSIBz1sbGvlegmf6HWkMUwELPGh1TJrLGQahXIPE2ITNfqUt40ncoReztJbCDJ2LCzxRIINRLtDbBxe7DYVO1ijCMyVBUfa9yOahfIPKuABzG5x0SGVDLL0OkUZ99NMTqUqvrio65De9RP5wY/0Z6AVa1fryKauI1bcXM7cYpAQNRNIohA3pK/9VzOYDSW5twfUoyevUJiNFPxAb6midRse1cLnd1+2qO+Yqrd+cghPFQfU6F1DbM4SSDz1COEch9F1k7ykcsanI+nGRuaYHwkTWI0Syo5Wb4lmQb+QCPBdg+tHT5CXU20RSwVxDzTiOPBP8TkOeSVjhMFMk8DIpC/B4uFspBc1iBxPkNyLEsqKQSTSuS4kpgkk84VPeNoGnh9Oi3BRvxBHX+gEX/AQyDkIdjmtbsR+DSiL1UM4aVyHE4WyDyNCKHcTYEGyFKSzRpMpnNMpKeYyhrkcgbGlNhzn8sJ9ei6hqaBVi9+rvdoNPnqafTpeCqjE/51RCf1YRwqjHlqQSDzuBGbsu4D1PFWhTGBWEqdo4y7/OyklgQyjwtoRZggWylBVd7hzCKyUefmvtfUgKlFgSzEg9ikFUbUVBRfMoGIL+JAtszvUjZqXSALaQHWInoI16pYrgHnEX1vL5X5XSoCJZBbcSFaEYUQFXqnxytpxNLpPEoUt6AEkp8mhFBWA3diY8rYIqYQ21ovIIShfP9LoARiDhfCTbwSMcusRGwPrmSuIWaG+a8r1FigXQxKIMXTgBDNckQc40fMOnYfAZRDBNYphAguz33Z3q7TSSiBWIeO2Ak5/+VBiEmf+96AqM3UI2YmN19a96cRXqZZxJJoBjHQryOEcB2RWcrMfU1QptacTuf/AwPHH6TG3RCNAAAAAElFTkSuQmCC",wO="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAAACXBIWXMAAB2HAAAdhwGP5fFlAAAAGXRFWHRTb2Z0d2FyZQB3d3cuaW5rc2NhcGUub3Jnm+48GgAAHZ9JREFUeJztnX+UVNV9wD97ebPDuOH3Shc3hGz4ISH8CG4oSjlIVZoQjXKsjVhPitocT2Nje7SJSRSNErCa39bEmhQNqYeT1FprbJQmBIOUEHFLECQUQdxSsrIC8mszzj7mcekfdx4usLvzfTNv5v2Y9zlnzq7Lffdd99zP3t/fW3fy5EkSKkIGGFz4DAEaCj8bWPhkAAuoL6QfAKQK3+eBE4XvjwMO0A3kenzNAkeBY4Wv3RX9v6lR6hJByuYc4FygscfXYbxb8avFceAwcAA4WPgcAN6pcjliRSKIN+qA4UBzj8+QQEtUnCzwFtBR+HTybuuUUIREkOIMA1oKn2be7QZFlTzwO6C98DkSbHHCTSLI2dQB7wXGY6QYGmxxKs4RjCg7MS1MUiF6kAhiqAPOAyYA52MG1LVIDiPLduD/SGSpeUEGAZMLn8EBlyVsHAO2FT5dAZclMGpRkDpgLDAF04WqC7Y4oeckplXZCrxBjbUqtSRICvgg8BHMwDvBO0cxomwB7IDLUhVqQZD3ANOBaUA64LJAVxf6yCHo6oJcDp09Zn6ed6A7Z74fmIGUBYBqGAyZDAwahBo6HAYNCqjgp9GNkWQzZho5tsRZkAymtbgAs2JdHbJZdPvr6L3tnOh4E/bvQ3d2ovd1wNFDoHV5+SsFQ4ajRjWjmpqgqZkBo5pQo1tQLeOgoarzCyeA3wIbiKkocRQkg2kxWqn0anY2i96xjfz2LeidO9Htu6Gzo6KvLEpTM6plLGrCBFKTpqMmTqqGNHngVWAjMVu5j5MgAzCtxYVUSoxcDr25jfyml9DbtqLbXy+/Rag0SqFaxqEmTyfVOgM1fYbpslUGG3gJ0/WKxWp9XAQZC8ylAot6umMv+lfryL+8Ab1tKzgRH5taadS06aRmzMSaPReamivxlsPAesziY6SJuiDDgUuB9/ma68H9OOvWkl+3Br19S/hbiTJQY1pQcy8ldcl8VPNov7P/X2ANEd7OElVBFGYAfhF+DcBtG2fdC+RXPYPeFm8pekUp0w27fIFpWdK+Tfg5QBtmfBK5blcUBRkJ/AnwB35kpvfsIf/sUzgvrIKuY35kGX0GDcWaN5/UJ65GjR7jV64HgJ9jdhNHhigJojAtxkx8WP3W27Zg/+iH6LYNtddaSFEKNf0PSV91DWrWHD9y1JiW5KXC96EnKoIMBj6O2W5eBhpn3RryK59A797hR7lqBjV+IqnrbsKaM9eP7DqB5zGD+VATBUEmA5dQ5jkMvakNe/nD6F2JGOWgWsaR+tRfYs25tNysjgMvYBYaQ0uYBbGAy4APlZNJIkZlUOdPIf3pW1DTW8vN6lWMKE75pfKfsAoyGLiSMgbiumMv+R88irN2tX+lSjgLNXM26VtuK3eK+C3gWcwW+1ARRkHejxlvlLbcm8thP7Ec5+kno7+oFxWsNNY115G+/sZyVulzwE8xB7VCQ9gEmYLpVqlSHtZtG8g99CB07vO3VAkymprJ3PZFVOvMUnM4ieluveJfocojLILUAXMwi3/e6erCXv4wznPP+FqohNKw5s4j/dnPw9CSd/68DPyXj0UqmTAIYmG6VONLeVhvXE/uq0vNVvKE8DCskcwdi1EzZpWaw2vAfxLw4D1oQVLAAkrZS2Xb2I89gvPMvyQLfWFFKaz5V5K+5TZIlzQ2+R3w75gp4UAIUpCBwNXAKK8P6vbd2EvvRO9p979UCb6jWsaRXrwMNaallMffBJ4moCO+QQmSAa7B7KvyhLN2NfbXl757PDUhGgzMkL5jMdaceaU8/Rbwb5iZrqoShCAZ4FpghKentMZ+/FGcH6+oRJkSqoR1+QLSt94BludN2AeBJ6myJNUWZCDwZ3htObq6yH35DvTWTRUpVEJ1Ua0XkrlnGTR4DkDxFvCvVLG7VU1BUsCf4nXDYWcHubtuT8YbMUONaSGz7CFoavL66D6MJHn/S3U2JS3IlYCFGZB7kkPv2E721r9M5Ighek872VtvQu/Y7vXRUZiZz6pEqqmWIB/FBIQWozdtJHf7Z+Bwsr4RWw4fJPe5z6A3t3l98n3AfKoQFbMaglwMTPTygN64ntzdn4PjyUxV7OnOkfvS7ej1a70+OQH4I/8LdDqVFmQaHrePOGtXk/vyF+B4stGwZnBsckvvwlm9yuuTMzH79ypGJQV5P+agkxhn7Wrs++8Gpyrjr4Qw4eSxv3YfzjrPxxMuw++oNj2olCDuEVlx/nrDOuwH7k22jdQyWmPffy96wzovTyngCip0fUUlBLEwh53Em2/0pjZyS+9KWo4EcPLkltxlgmnIyQBXUYGZrUoIcikeTgLqHdsLA/JkzJFQwLHJ3fcl9E5Px6RHAiXtY+kPvwWZggmyIKOzg9zdtyezVQln050jd9ftsN9TGK1JhY9v+CnIUEx8XBnZLLm7P5+scyT0zeGD5L70t5D1dAPcZfh4QZJfgijgcqRR1R2H3N2fM9HRExL6Qe9pJ7fkLi+TNyngY/hUt/0S5CJAvKnG/v7DycbDBDF600vYy7/r5ZHzMNdglI0fgjRhFmxEOGtX4zz9Ix9em1BLOE+t9LpGMhMf4jeXK4jCBJIW7YnR7bvNYacwck6DNfCOe2fXNTYNDLooQWJ99MoxnNNQvSvrpGiN/Y37vWxcdetmWXW8XEFmAOeKUtq2WSUP40nAcxqsgfc+OF9NnTYlfc/SKweMPK8mJalfuGhi/adunJ9e8rUrGDykrFCvFSGbxV56F9jiJYGRmKv4SqYcQYbhoZ9nP/pQOAflrhznNb8XQA0fMSK1eEnNSVK/cNFE64oFc4G6AU2jRqXv+fvLwyiJbn8d+7FHvDwyizJuHitHkMsQrlzqtg04zz1dxqsqxBlyuNSaJD3lcH8WZkmcZ/4FvXG9NLmFWbwuiVIFGYd0g9iRI+QeWBK+PVZ9yOFSK5L0JodLaCXRmtzX74cu8c1u7wc+UMqrShFkACYKogj7kW+FL6hbETlc4i5Jf3K4hFaSwwex//E7Xp74Y0zd9UQpglyAcKVSt20wV5uFCaEcLnGVRCKHS1glcX7+LHrTRmnyocCHvb7DqyAZpAPzXI7cQ9/wWp7K4lEOl7hJ4kUOl7BKkvvWA5ATz4xehImsI8arIDMQbiexn1gOnXs9Zl9BSpTDJS6SlCKHSygl6ezA/tEPpanTeDzh6kWQcxA2Ubpjr7mfIyyUKYdL1CUpRw6XMEriPLkS3SH+Y3wBHs4qeRFkJsJ7Au1HHwrP5TU+yeESVUn8kMMldJI4Nnn52kgK0xMSIRXkPcBUSUK9qQ39a09HJiuHz3K4RE0SP+VwCZskzro16C3iDbAfxvSIiiIV5AKEi4L2448Ks6wwFZLDJSqSVEIOl7BJYj/6sDRpCpguSSgRJIUwtIpevxb92quSpJWlwnK4hF2SSsrhEiZJ9K7tXlbYP4xgyCARZCrCqTH7ieWSZJWlSnK4hFWSasjhEiZJ7BXflyYdiOB4eDFB6hA2Rc661ejdOyVJK0eV5XAJmyTVlMMlLJLoXTu8RGlspcjvqJggY4EhkjflVz4hLFOFCEgOl7BIEoQcLmGRxF65Qpp0CEX2aBUTRDZztbkNvdtTiBZ/CVgOl6AlCVIOlzBIondtR2/ZLE3e7/i6P0EGYXZBFsV+KsAjtCGRwyUoScIgh0sYJLGfWilN2oJZxuiV/gSZjOCXrffs8RoFzz9CJodLtSUJkxwuQUuiN65H790jSaroZ7DelyB1/T3Uk/yzTwVz1iOkcrhUS5IwyuESqCRak5cf0vMsSDOSYMC2jfPCz6SF8I+Qy+FSaUnCLIdLkJI4q1dJz68PwYQKOou+BDlfVIB1L3g51eUb6c9+/qKwy+HiSuJ3tBRr4Q0fDLscLgMaR55rnf+hks+Fl8zRIzjyKd8Jvf2wN0HqgPGSHPOrnpG+3FeOP/bIy/rg2/sDeXkJqOEjRvgZLaV+4aKJ9VdcdTERkAPnhHN8xfeed9o2HAji9R7q6Pn08vvsTZDRQEPR7PZ3ordtkb7cV06+vd+2v3LnT6MmiR/drSh0q07hyrF2dUdQRdBbN0sDYL+HXi6Z7U2QcZLcnLWrAw3EUIuSJHKUgNY4638pTX1W3e9NkBZJTvlfer4qy3dqSZJEjtLJr/2FNOlZdf9MQYYhCLKlO/aidwW4ct6DWpAkkaM89I7fQqeomzWcM7ZWnSmIqPXQvwrJgagCcZYkkcMHtMbZIO5mneZASYLkXw5o5bwf4ihJIod/5NvE4YH6FETRyyj+LHI59Lat4oJVkzhJksjhL3rLJrBF4YFG08OLnoKMRHDCSm9uC09Ahl6IgySJHBXguI1+RbTDNwU0uv/RU5DirQeQ3/SSt4IFwMm399v20sXP6UNvvx10WaS4kqRuumVapOT4waPPhV6OAnl5FMZTLvQUpNe9KGcS1u7VmZw82Nlt33fnTyLXklwybxZRkWPF9553XvzFm0EXRYp+VXxG5JQLPQUZVfSxbDacd3z0QRS7W5EgKt2qM9C7d0I2K0l6liDnYA5I9f+CHdvCd41BERJJfCaicgCgNXrndknKwRSiL7qCiK5Ry28PZu9VuSSS+ESU5SjgYf/gueBREL0z4KglZZBIUiYxkAMg//ouadLTBGnsJ+EpdLs481CSSFIiMZEDQO8Wj6EbwYsg2Szsf6u0UoWIRBKPxEgOAPZ3SAfqpwlS9MYo3b4zcgP0vkgkERI3OcAM1GV3rQ8FI0gGwaU4wggRkSGRpAhxlKOA3vuGJNlAIK2QBGcATnREZj1ITCJJH8RYDoATsq3vAEMUwtCi7I/l7yqR5ExiLgcA+8T/a0PELYiWWxc5EkkK1IIceKrLgxWSAA2A3rev5AJFgZqXpEbkANDyFqRBIbr7Q8PRQ2UUKRrUrCQ1JAcARw9LUw5USO5q6zoWmyneYtScJLUmB4CTh2yXJGVG1ILoI0fLLlOUqBlJalGOAvqIKCKoTBC6RLbFithLUsNyANI6nVFI7j7PHiu3OJEktpLUuhwg7WJZCsn1zvbxcosTWWInSSKHQRb13VIIbrrVTr7s8kSZ2EiSyHEKYZ1WChhQNFneKbc8kSfykiRynI6sTg+QCVLjLYhLFKOluBx/+sdrEjl6IAtdZRXtXiWczsmDnd0nXvnNa0GXwyvWZR/7iN+X+NQCCjhRNJUV6LXXoaJ+4aKJqUvmXRR0Obzi9yU+kcdKS1I5MkFSxSe6aoFIRTzshaDvcQ8Vsjp9QgFF95CopAWJvBwuiSQGYZ3WCig+nE8XPXAYa+Iih0siCZCWd7GKT1ENEh0ZiSVxk8Ol5iVpKBonEQqCFI8JP0h26DBuxFUOl1qWRA0V1el3FNBdNLPB1b/iOmjiLodLzUoySFSnc8IWZFBNTfXWihwuNSeJlYIG0UHablELAtRMN6vW5HCpKUmGFA0D55JTgCjMnBpV/HaEqFOrcrjUiiRqlOiuKCiMQUSHPVST6H6dyFLrcrjUgiSqqUma9KgCZOdpR8a3BUnkOJ3YSyJvQY6JBRnQHM8WJJGjd+IsyQCPLUg3UHTvrxotukI9UiRy9E9cJVFjxkmSdQO2u929aIgH1TKucL4qHiRyyIidJEqhxoj+2B+Bd4/bHiyavKEhNuOQRA5vxEkS1dQMmYwk6QF4V5ADosxbxpZYrPCQyFEasZGkRdS9gkKjIW9BgNSEiSWUKDwkcpRHHCRJTRgvTXpaCyIKRKAmTSuhSOEgkcMfoi6JmjRdmvS0FiQHFI2kpSZOiuRAPZHDXyIriZUydbg4xyjsUexZ24tfIdXQYGazIkQiR2WIoiRq7HjpAP1U9BfV2w/7fclkcRMVONbCGz4YGTmcE87xJ1f+LEohhVxJohItRU0RDxFONRbeWhAg1TrDQ5GCo37hoon1V1x1MVGRY8X3nneefeoN+747fxKl4HRRipaSap0pTdprC3IAwfFbNX2GNGRKYESqW3VGxMMoRnCMRHerPo2aKur9HKfHrG5PQTTwu6KPZzKoyVO9Fq9qRFkOl0QS/1HTWiEtGn/sBU6eeu6MfxTdsJ66cJa8ZFUkDnK4JJL4S2qGuM6e5kBJgliz54ZuujdOcrgkkviEUliz50hT/+9pj57xj0cQbFykqRk1Pjyr6nGUwyWRpHzUpCkwUrTF/RBnHP/orRmQdbMunidJVnHiLIdLIkl5pOaI6+pZdb83QXZKcrIumRd4N6sW5HBJJCm1EAprziXS1GfV/d5qeAfw+6JZNY4MdNGwluRwSSQp4f1TW6GxUZK0i17WAnsT5CTCViR1+QJJMt+x5i8YEyk5fvDoc35dXhPFS3zU8BEjrBtuDmSFOXWFuI72eudLX30kWTdr9lxphDpfcV5c3aHf7Aj/bUluy/HiL0S7FKScPNjZHaUV9xOd+/blH/nGr6v+4iFDvcxeeRKkA0k4oHQaa958aQH8452s033vF1bpNzuKL2wGRYXvBIxKd+tE5759+Xu/8FP9+66qX3RpzbtcuuvjCNDZ2z/0N8reJsk59Ymrgxmsh1mSKl2YGXZJgpQDpbwMAfqs6/3V7FfpseTeZwajx6Dkq5T+EkZJqnybbFglCVQOQF10MWr0GElSDfy2z3z6efD3CNdE0p+8XpKsMoRJkoCuWg6bJEHLAZD+sz+XJn2DfmZti/WNtkreoKa1os6fIi2Q/4RBkoDvIQ+LJGGQQ50/CTVZfPbj1X7zKvLwG0i2ngCpaz8lLVBlCFKSgOVwCVqSMMgBkL7+JmnSoxTpJRUT5CTwG8mbrDlzUWMnCMtVIYKQJCRyuAQlSVjkUOMnomaJp3bbKDLOlkw/bUN4h0h60c2SZJWlmpKETA6XaksSFjkA0jf9lTRpDtheLJFEkDywRfJGNWuO2TkZNNWQJKRyuFRLkjDJoSZN8zKj+gqSE7TCzDYjuS4aSN94izDLClNJSUIuh0ulJQmTHChF+mZx3ctj6nTxbIUZZpG2ItNbsf7oUmG2FaYSkkREDpdKSRIqOQBrzqVeNs9uRnI3J3JBADYiuVMdSH/ms1AfksAOfkoSMTlc/JYkbHJQnyH96VulqY8D/y1N7EWQHMJmiaZmrKuv85B1hfFDkojK4eKXJKGTA7CuvR7kl+JsQth6gDdBwEyLFb1sByD9qRtR5432mH0FKUeSiMvhUq4kYZSDpmbSnxSvwXVjBBHjVZBuQLZtOZ0hfdudgZ86PI1SJImJHC6lShJKOZQic9ud0nCiYOqu6A/8qVd4LpTpZh0SZT69FeuSj5fwigriRZKYyeHiVZJQygFYH70SJY/0eQgzteuJUgTRwIvSxOm//hsYJjryWD0kksRUDhepJGGVgxGNpG8WD8wBfompu54otf/zBmfED+qTQUPJfPHL4epqQf+SxFwOl2KShFYOpcjcvhgGDZI+Ia+vZ76qlIcKvIBw8VC1zsRacG0Zr6oQvUlSI3K49CVJaOUArGuuQ80Ur5jnMa1HSZQjyGGkA3YgffMtwW9m7I2ektSYHC5nShJmOVTLONKLxPutAH6FcEd6b9SdPFn00GB/KOB6YKQksd7TTu6vb4Bu8TR09TinwbI+NG2Y07ZBdKFpHKlrbBqYvumvPtL9na+9xDvZ0MlBQwOZ76yQnhQEeAtYieBkbF+UKwjAHwB/jrA10uvXkVtyB2jP46WEWkYp0osfwJozV/qExshR1sKoHyPntzDbUGQvnD0H65oQrbInRAJr4Q1e5ADT/S97a41fU0svIbyhCiD96VtRrRf69OqEuKNmzCJ9g6ezRh14+KPd77v9yATTnD2P2QgmeKsic8/fh3PQnhAqVMs4Mou/4mWZwMbUxbLHDuCfIGDO964Rp25oILPs2zBCNL5PqEWGNZJZ9k1oEK93gKmDxYMeCvF79W47RaJEnEZjI5mvfB0GivfSJNQKDQ1kHvim9F4Ply3A//hZjEosb6+hjzCOvRZgwkQyX/lmeM6PJARPfYbMkq+jxnq6pGkfZSwI9kUlBDkB/Ade9txPbzUtSchvz02oAlaKzJeXmUs35byDqXMn/C5OpTZIHQN+iofNYap1Juk77wnfnq2E6qEU6TuXoGbO9vKUxsjRVZEiVSLTAv+Hl0E7YM2ZR+beryYtSS1ipUkvXoY1x3M8g58jub68RCr953or8LKXB9SsOWTuexDqk4F7zWClydxTkhy/pp/A035Qjf7Mf+FxZkHNnEVmWTK7VRM0NJB58NteoiG6vAZsqECJTqNaHf6fY7pcYtT0GWQefhxGJusksWVYI5mv/aPXATnAHmBVBUp0FtUSxAGewWNfUbWMpeEfViQr7jFEtYyj4buPoyZ4msoFs6XpJ1Rgxqo3qjlllMdI8panpxobyXzze8nerRihZswi8+1/8roICKbuPI0wPpsf+LHd3SsZ4JOAt4PqWmOvXI7zxOPJVvmoohTWJ//CBJj2Pp1/EHgSD+trfhCEIGAk+VPMWRJP6A3ryD24BLK+bbdJqAYNDaT/bnEpM1VgWo5/o8pyQHCCAKSBq4HzvD6o9+zBXvoldPvr/pcqwXfU2AmkFy/zchKwJx3Av+MxnpVfBCkIQAq4CvD+m7Nt7Ccew3nyn5MuV1hRCmvBtSbqemmLv3sxclRtzHEmQQsCMAD4GOB5OgNAt20g99WlcPigv6VKKI9hjWS+eJ+XwG5n8j/Az6jSbFVfhEEQl9nAzJKezHZhf/9hnFXPJq1JCLDmziP92c/D0KGlZvESJhpJ4IRJEIDJwDxKnH7WWzZjf+t+9O/2+FuqBBlNo8nc9sVyWg2N2b8nul25GoRNEID3AVdgZrq8Y+ewV/4Q56mVcDyQcV3tUZ/BuvZ60gsXQbrkjabulvXg77vvQRgFARgMfALwvJJ0ioP7sZd/F+eFnyXdrgqiZs4mc+vfQVNzOdnso4Jb1sshrIKAGbxfCpR1K6jesgn7sUfQ2+UngROKoyZNM9Ey5dee9cUWzEnAQAfjfRFmQVwmYUSpLycTvakNe/l30buK3vyb0A9q7ARS199Y6oJfT2zMeMPXM+R+EwVBwHS55gPvLTcjvX4t9o9WoF9LRPGCmjSF9MJFpWxL7419mNA8JcfMrRZREQTMzNaFmKngsjdZ6m1byD/zJM66NckYpS+UMkHbrr6unJmpnmjMIaeN+BS3qtJESRCXc4E/oZwBfA/03j3kn3saZ/UqOBr6P2jVYchwrHkfJXX51aVuD+mNA5iFP2+7uQMmioKAaUE+jFlcTPmSo2PjvLiW/Kpn0Fs3116rohRqaiupKxZgzZ7jZ1wAB9NqtBGRVqMnURXEZShmAP9+X3M9uB9n3Vry69agt2+JtSxqTAtq7qWk511e7lRtb7yBuWjpqN8ZV4uoC+IyBvhjYITvOXd24mz4Jfm2X6O3bI7+4mN9BjVtOqkZs0xL4f3QkoTDwFqMIJEmLoKA6XZNBy7CbKX3HzuHfmUz+U0b0a9uRrfvBiewjaYyrBSqZTxq2jRSrTNRU1vLWe0uhntN+CuUcGFmGImTIC71mPHJH1IpUVxyOfSObWZG7PVd6N2vw/6O4LpkSqGamqFlHKlx41GTp6MmTvJyj3ip5DHXg7dhJIkNcRTEJYNpUVopc5HRE9ksem87es8bnOjohP0d6M5O9L69cPRo+S2OlYIhQ1CjRqOammBUMwOamlBjPoAaM7YaMvQkjwlWvhGzlyp2xFkQl3OAC4CplLoB0k+yWfSRQ9DVBdks5LJofQLyzrt3Nw7MQMpCqQGQaYCGBhg0CDV0uPk+eHKYbtQrxFQMl1oQxGUAcD5moXF4wGWJKkeB32BajZAPvvyhlgRxqQM+gNkE2UJ1Qx9FEQ20Y85otBPBtYxyqEVBevIe4EMYWYYEXJawcQTYhol9+/uAyxIYtS5IT0ZgumCTqF1ZuoBdwE5MNJGaJxHkbOqAZmAcpgsW9/HKIUzXaReJFGeRCFKcIRhRWjDb7as3ZVwZjmPC6bQXPkkEvn5IBPFGHWY3cTMm4F0z4OkK1gA4hmkZ3ix8PUiNDbTLIRGkfDIYaRoLn5GYVmdglcvRjRlYH8BIcLDwfdXDdcaJRJDKkcaIMgRzIrIBI9PAwtcMZm2mHtMyDeDdrft5zBntk5gu0QlMRc9hRMgBWUzrcLTwifguynDy/2Dl14zI6WdFAAAAAElFTkSuQmCC";const EO=125,kO=50,SO=-45,MO=1e-4;class CO{constructor(e,t=!0){this.psv=e,this.isDesktop=t,this.isDesktop&&(this._cursor=document.createElement("img"),this._cursor.src=bO,this.psv.container.appendChild(this._cursor),this._cursor.style.width="125px",this._cursor.style.height="125px",this._cursor.style.position="absolute",this._cursor.style.zIndex=10,this._cursor.style.pointerEvents="none",this._cursor.style.display="none",this._hideCursor=!1),this._couldGoSomewhere=!1,this._mapPreviewPic=null,this.psv.container.addEventListener("mousemove",this._onPointerMove.bind(this)),this.psv.container.addEventListener("mouseleave",this._onPointerLeave.bind(this)),this.psv._myMarkers.addEventListener("enter-marker",this._onHoverOtherStuff.bind(this)),this.psv._myMarkers.addEventListener("leave-marker",this._onLeaveOtherStuff.bind(this)),this.psv._myVTour.addEventListener("enter-arrow",this._onHoverOtherStuff.bind(this)),this.psv._myVTour.addEventListener("leave-arrow",this._onLeaveOtherStuff.bind(this)),this.psv.addEventListener("sequence-playing",this._onHoverOtherStuff.bind(this)),this.psv.addEventListener("sequence-stopped",this._onLeaveOtherStuff.bind(this)),this.psv.addEventListener("sequence-playing",this._onHoverOtherStuff.bind(this)),this.psv.addEventListener("pictures-navigation-changed",this._onPSVPicNavChanged.bind(this)),this.psv.addEventListener("click",this._onClick.bind(this))}async _onClick(e){if(this.psv._sequencePlaying||"pic"===this.psv.getPicturesNavigation()||this.psv._myVTour.state.loadingNode||this.psv.getSelectedAnnotations().length>0||this.psv._parent.map&&this.psv._parent.isMapWide?.())return;if(e.stopPropagation(),this._mapPreviewPic)return this.psv._keepSameAngle=!0,this.psv._parent.select(this._mapPreviewPic.collection,this._mapPreviewPic.id),void(this._mapPreviewPic=null);const t=this.psv.getPictureMetadata();if(!t)return;let i=Math.min(this._pitchDegToProjectedDistance(nt(e.data.pitch),TO(t)),kO);if(i>0){this._couldGoSomewhere=!0;const n=(nt(e.data.yaw)+this.psv.getPictureOriginalHeading())%360,a=DO(t.gps,i,n);let r;this.psv._parent.map&&(r=this._getMapNearbyPictures(a)),r&&0!==r?.length||(r=(await this.psv._parent.api.getPicturesAroundCoordinates(a[1],a[0],MO,50))?.features);const s=this._bestPicAround(t,a,n,r);s?(this.psv._keepSameAngle=!0,this.psv._parent.select(s.collection,s.id)):this.isDesktop&&(this._cursor.src=wO,setTimeout(()=>this._cursor.src=bO,1500))}else this._couldGoSomewhere=!1}_onPointerMove(e){this._couldGoSomewhere=!1;const t=this.psv.getPositionFromEvent(e);if(!t||"pic"===this.psv.getPicturesNavigation()||this.psv.getSelectedAnnotations().length>0)return;const i=this.psv._parent?.map,n=this.psv.getPictureMetadata();if(!n)return;let a=Math.min(this._pitchDegToProjectedDistance(nt(t.pitch),TO(n)),kO);if(!this._hideCursor&&a>0){if(this._couldGoSomewhere=!0,this.isDesktop){const r=function(e){const t=((e=Math.max(Math.min(e,0),SO))-SO)/45,i=.2;return Math.max(1-Math.exp(-Math.pow(t-1,2)/(2*i*i)),.4)}
|
|
35
|
+
*/function XM(){var e=new Qc(4);return Qc!=Float32Array&&(e[1]=0,e[2]=0),e[0]=1,e[3]=1,e}let QM,YM,JM;const $M={frame(e,t,i,n){let a=n||window,r=a.requestAnimationFrame(e=>{s(),t(e)}),{unsubscribe:s}=Sh(e.signal,"abort",()=>{s(),a.cancelAnimationFrame(r),i(new Uh(e.signal.reason))},!1)},frameAsync(e,t){return new Promise((i,n)=>{this.frame(e,i,n,t)})},getImageData(e,t=0){return this.getImageCanvasContext(e).getImageData(-t,-t,e.width+2*t,e.height+2*t)},getImageCanvasContext(e){let t;if(Kc()&&!Xc())t=new OffscreenCanvas(e.width,e.height).getContext("2d",{willReadFrequently:!0});else{let i=window.document.createElement("canvas");i.width=e.width,i.height=e.height,t=i.getContext("2d",{willReadFrequently:!0})}if(!t)throw Error("failed to create canvas 2d context");return t.drawImage(e,0,0,e.width,e.height),t},resolveURL:e=>(QM||=document.createElement("a"),QM.href=e,QM.href),get hardwareConcurrency(){return typeof navigator<"u"&&navigator.hardwareConcurrency||4},get prefersReducedMotion(){return void 0===JM?!!matchMedia&&(YM??=matchMedia("(prefers-reduced-motion: reduce)"),YM.matches):JM},set prefersReducedMotion(e){JM=e}},eC=new class{constructor(){this._frozenAt=null}getCurrentTime(){return null===this._frozenAt?performance.now():this._frozenAt}setNow(e){this._frozenAt=e}restoreNow(){this._frozenAt=null}isFrozen(){return null!==this._frozenAt}};function tC(){return eC.getCurrentTime()}var iC=class e{static{this.docStyle=typeof window<"u"&&window.document?.documentElement.style}static{this.selectProp=!e.docStyle||"userSelect"in e.docStyle?"userSelect":"webkitUserSelect"}static create(e,t,i){let n=window.document.createElement(e);return void 0!==t&&(n.className=t),i&&i.appendChild(n),n}static createNS(e,t){return window.document.createElementNS(e,t)}static disableDrag(){e.docStyle&&e.selectProp&&(e.userSelect=e.docStyle[e.selectProp],e.docStyle[e.selectProp]="none")}static enableDrag(){e.docStyle&&e.selectProp&&(e.docStyle[e.selectProp]=e.userSelect)}static suppressClickInternal(t){t.preventDefault(),t.stopPropagation(),window.removeEventListener("click",e.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",e.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",e.suppressClickInternal,!0)},0)}static getScale(e){let t=e.getBoundingClientRect();return{x:t.width/e.offsetWidth||1,y:t.height/e.offsetHeight||1,boundingClientRect:t}}static getPoint(e,t,i){let n=t.boundingClientRect;return new Hc((i.clientX-n.left)/t.x-e.clientLeft,(i.clientY-n.top)/t.y-e.clientTop)}static mousePos(t,i){let n=e.getScale(t);return e.getPoint(t,n,i)}static touchPos(t,i){let n=[],a=e.getScale(t);for(let r of i)n.push(e.getPoint(t,a,r));return n}static sanitize(t){let i=(new DOMParser).parseFromString(t,"text/html").body||document.createElement("body"),n=i.querySelectorAll("script, iframe");for(let e of n)e.remove();return e.clean(i),i.innerHTML}static isPossiblyDangerous(e,t){let i=t.replace(/\s+/g,"").toLowerCase();if(["src","href","xlink:href"].includes(e)&&(i.includes("javascript:")||i.includes("data:"))||"srcdoc"===e||e.startsWith("on"))return!0}static clean(t){let i=t.children;for(let t of i)e.removeAttributes(t),e.clean(t)}static removeAttributes(t){for(let{name:i,value:n}of Array.from(t.attributes))e.isPossiblyDangerous(i,n)&&t.removeAttribute(i)}};let nC;(function(e){let t,i,n,a;e.resetRequestQueue=()=>{t=[],i=0,n=0,a={}},e.addThrottleControl=e=>{let t=n++;return a[t]=e,t},e.removeThrottleControl=e=>{delete a[e],o()};e.transformAndGetImage=async function(e,t,i,n,a=!0,r){let s=await e.transformRequest(t,i);return jh(n.signal),nC.getImage(s,n,a,r)},e.getImage=(e,i,n=!0,a)=>new Promise((r,s)=>{e.headers||={},e.headers.accept="image/webp,*/*",lh(e,{type:"image"});let l={abortController:i,requestParameters:e,supportImageRefresh:n,imageBitmapOptions:a,state:"queued",onError:e=>{s(e)},onSuccess:e=>{r(e)}};t.push(l),o()});let r=(e,t)=>"function"==typeof createImageBitmap?(async(e,t)=>{let i=new Blob([new Uint8Array(e)],{type:"image/png"});try{return createImageBitmap(i,t)}catch(e){throw Error(`Could not load image because of ${ju(e).message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}})(e,t):(e=>new Promise((t,i)=>{let n=new Image;n.onload=()=>{t(n),URL.revokeObjectURL(n.src),n.onload=null,window.requestAnimationFrame(()=>n.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=")},n.onerror=()=>i(Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));let a=new Blob([new Uint8Array(e)],{type:"image/png"});n.src=URL.createObjectURL(a)}))(e),s=async e=>{e.state="running";let{requestParameters:t,supportImageRefresh:n,imageBitmapOptions:a,onError:s,onSuccess:c,abortController:u}=e,h=!1===n&&!a&&!bh(self)&&!qh(t.url)&&(!t.headers||Object.keys(t.headers).reduce((e,t)=>e&&"accept"===t,!0));i++;let d=h?l(t,u):Kh(t,u);try{let t=await d;delete e.abortController,e.state="completed",t.data instanceof HTMLImageElement||Eh(t.data)?c(t):t.data&&0!==t.data.byteLength?c({data:await r(t.data,a),cacheControl:t.cacheControl,expires:t.expires}):c({data:null,cacheControl:t.cacheControl,expires:t.expires})}catch(t){delete e.abortController,s(ju(t))}finally{i--,o()}},o=()=>{let e=(()=>{for(let e of Object.keys(a))if(a[e]())return!0;return!1})()?Vh.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:Vh.MAX_PARALLEL_IMAGE_REQUESTS;for(let n=i;n<e&&t.length>0;n++){let e=t.shift();e.abortController.signal.aborted?n--:s(e)}},l=(e,t)=>new Promise((i,n)=>{let a=new Image,r=e.url,s=e.credentials;s&&"include"===s?a.crossOrigin="use-credentials":(s&&"same-origin"===s||!Yh(r))&&(a.crossOrigin="anonymous"),t.signal.addEventListener("abort",()=>{a.src="",n(new Uh(t.signal.reason))}),a.fetchPriority="high",a.onload=()=>{a.onerror=a.onload=null,i({data:a})},a.onerror=()=>{a.onerror=a.onload=null,!t.signal.aborted&&n(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."))},a.src=r})})(nC||={}),nC.resetRequestQueue();var aC=class{constructor(e){this._transformRequestFn=e??null}transformRequest(e,t){return this._transformRequestFn&&this._transformRequestFn(e,t)||{url:e}}setTransformRequest(e){this._transformRequestFn=e}},rC=class extends ed{},sC=class extends rC{},oC=class extends rC{constructor(e={}){super("style.load",e)}},lC=class extends rC{constructor(e,t={}){super(e,t),this.dataType="style"}},cC=class extends rC{constructor(e,t={}){super(e,t),this.dataType="source"}},uC=class extends rC{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,t,i,n={}){i=i instanceof MouseEvent?i:new MouseEvent(e,i);let a=iC.mousePos(t.getCanvas(),i);super(e,lh({point:a,lngLat:t.unproject(a),originalEvent:i},n)),this._defaultPrevented=!1,this.target=t}},hC=class extends rC{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,t,i){let n="touchend"===e?i.changedTouches:i.touches,a=iC.touchPos(t.getCanvasContainer(),n),r=a.map(e=>t.unproject(e)),s=a.reduce((e,t,i,n)=>e.add(t.div(n.length)),new Hc(0,0));super(e,{points:a,point:s,lngLats:r,lngLat:t.unproject(s),originalEvent:i}),this._defaultPrevented=!1}},dC=class extends rC{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,t){super("wheel",{originalEvent:t}),this._defaultPrevented=!1}},pC=class extends rC{},mC=class extends rC{constructor(e={}){super("terrain",e)}},gC=class extends rC{constructor(e={}){super("projectiontransition",e)}},fC=class extends rC{},AC=class extends rC{constructor(e={}){super("styleimagemissing",e)}};function _C(e,t){let i={};for(let t in e)"ref"!==t&&(i[t]=e[t]);return rd.forEach(e=>{e in t&&(i[e]=t[e])}),i}function vC(e){e=e.slice();let t=Object.create(null);for(let i=0;i<e.length;i++)t[e[i].id]=e[i];for(let i=0;i<e.length;i++)"ref"in e[i]&&(e[i]=_C(e[i],t[e[i].ref]));return e}function yC(e,t){if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(let i=0;i<e.length;i++)if(!yC(e[i],t[i]))return!1;return!0}if("object"==typeof e&&e&&null!==t){if("object"!=typeof t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let i in e)if(!yC(e[i],t[i]))return!1;return!0}return e===t}function xC(e,t){e.push(t)}function bC(e,t,i){xC(i,{command:"addSource",args:[e,t[e]]})}function wC(e,t,i){xC(t,{command:"removeSource",args:[e]}),i[e]=!0}function EC(e,t,i,n){wC(e,i,n),bC(e,t,i)}function kC(e,t,i){let n;for(n in e[i])if(Object.prototype.hasOwnProperty.call(e[i],n)&&"data"!==n&&!yC(e[i][n],t[i][n]))return!1;for(n in t[i])if(Object.prototype.hasOwnProperty.call(t[i],n)&&"data"!==n&&!yC(e[i][n],t[i][n]))return!1;return!0}function SC(e,t,i,n,a,r){e||={},t||={};for(let s in e)Object.prototype.hasOwnProperty.call(e,s)&&(yC(e[s],t[s])||i.push({command:r,args:[n,s,t[s],a]}));for(let s in t)Object.prototype.hasOwnProperty.call(t,s)&&!Object.prototype.hasOwnProperty.call(e,s)&&(yC(e[s],t[s])||i.push({command:r,args:[n,s,t[s],a]}))}function MC(e){return e.id}function CC(e,t){return e[t.id]=t,e}function TC(e,t){if(!e)return[{command:"setStyle",args:[t]}];let i=[];try{if(!yC(e.version,t.version))return[{command:"setStyle",args:[t]}];yC(e.center,t.center)||i.push({command:"setCenter",args:[t.center]}),yC(e.state,t.state)||i.push({command:"setGlobalState",args:[t.state]}),yC(e.centerAltitude,t.centerAltitude)||i.push({command:"setCenterAltitude",args:[t.centerAltitude]}),yC(e.zoom,t.zoom)||i.push({command:"setZoom",args:[t.zoom]}),yC(e.bearing,t.bearing)||i.push({command:"setBearing",args:[t.bearing]}),yC(e.pitch,t.pitch)||i.push({command:"setPitch",args:[t.pitch]}),yC(e.roll,t.roll)||i.push({command:"setRoll",args:[t.roll]}),yC(e.sprite,t.sprite)||i.push({command:"setSprite",args:[t.sprite]}),yC(e.glyphs,t.glyphs)||i.push({command:"setGlyphs",args:[t.glyphs]}),yC(e["font-faces"],t["font-faces"])||i.push({command:"setFontFaces",args:[t["font-faces"]]}),yC(e.transition,t.transition)||i.push({command:"setTransition",args:[t.transition]}),yC(e.light,t.light)||i.push({command:"setLight",args:[t.light]}),yC(e.terrain,t.terrain)||i.push({command:"setTerrain",args:[t.terrain]}),yC(e.sky,t.sky)||i.push({command:"setSky",args:[t.sky]}),yC(e.projection,t.projection)||i.push({command:"setProjection",args:[t.projection]});let n={},a=[];!function(e,t,i,n){let a;for(a in e||={},t||={},e)Object.prototype.hasOwnProperty.call(e,a)&&(Object.prototype.hasOwnProperty.call(t,a)||wC(a,i,n));for(a in t)Object.prototype.hasOwnProperty.call(t,a)&&(Object.prototype.hasOwnProperty.call(e,a)?yC(e[a],t[a])||("geojson"===e[a].type&&"geojson"===t[a].type&&kC(e,t,a)?xC(i,{command:"setGeoJSONSourceData",args:[a,t[a].data]}):EC(a,t,i,n)):bC(a,t,i))}(e.sources,t.sources,a,n);let r=[];e.layers&&e.layers.forEach(e=>{"source"in e&&n[e.source]?i.push({command:"removeLayer",args:[e.id]}):r.push(e)}),i=i.concat(a),function(e,t,i){e||=[],t||=[];let n,a,r,s,o,l=e.map(MC),c=t.map(MC),u=e.reduce(CC,{}),h=t.reduce(CC,{}),d=l.slice(),p=Object.create(null);for(let e=0,t=0;e<l.length;e++)n=l[e],Object.prototype.hasOwnProperty.call(h,n)?t++:(xC(i,{command:"removeLayer",args:[n]}),d.splice(d.indexOf(n,t),1));for(let e=0,t=0;e<c.length;e++)n=c[c.length-1-e],d[d.length-1-e]!==n&&(Object.prototype.hasOwnProperty.call(u,n)?(xC(i,{command:"removeLayer",args:[n]}),d.splice(d.lastIndexOf(n,d.length-t),1)):t++,s=d[d.length-e],xC(i,{command:"addLayer",args:[h[n],s]}),d.splice(d.length-e,0,n),p[n]=!0);for(let e=0;e<c.length;e++)if(n=c[e],a=u[n],r=h[n],!p[n]&&!yC(a,r)){if(!yC(a.source,r.source)||!yC(a["source-layer"],r["source-layer"])||!yC(a.type,r.type)){xC(i,{command:"removeLayer",args:[n]}),s=d[d.lastIndexOf(n)+1],xC(i,{command:"addLayer",args:[r,s]});continue}for(o in SC(a.layout,r.layout,i,n,null,"setLayoutProperty"),SC(a.paint,r.paint,i,n,null,"setPaintProperty"),yC(a.filter,r.filter)||xC(i,{command:"setFilter",args:[n,r.filter]}),(!yC(a.minzoom,r.minzoom)||!yC(a.maxzoom,r.maxzoom))&&xC(i,{command:"setLayerZoomRange",args:[n,r.minzoom,r.maxzoom]}),a)Object.prototype.hasOwnProperty.call(a,o)&&"layout"!==o&&"paint"!==o&&"filter"!==o&&"metadata"!==o&&"minzoom"!==o&&"maxzoom"!==o&&(0===o.indexOf("paint.")?SC(a[o],r[o],i,n,o.slice(6),"setPaintProperty"):yC(a[o],r[o])||xC(i,{command:"setLayerProperty",args:[n,o,r[o]]}));for(o in r)Object.prototype.hasOwnProperty.call(r,o)&&!Object.prototype.hasOwnProperty.call(a,o)&&"layout"!==o&&"paint"!==o&&"filter"!==o&&"metadata"!==o&&"minzoom"!==o&&"maxzoom"!==o&&(0===o.indexOf("paint.")?SC(a[o],r[o],i,n,o.slice(6),"setPaintProperty"):yC(a[o],r[o])||xC(i,{command:"setLayerProperty",args:[n,o,r[o]]}))}}(r,t.layers,i)}catch(e){console.warn("Unable to compute style diff:",e),i=[{command:"setStyle",args:[t]}]}return i}function DC(e){let t=[];if("string"==typeof e)t.push({id:"default",url:e});else if(e&&e.length>0){let i=[];for(let{id:n,url:a}of e){let e=`${n}${a}`;i.includes(e)||(i.push(e),t.push({id:n,url:a}))}}return t}function PC(e,t,i){try{let n=new URL(e);return n.pathname+=`${t}${i}`,n.toString()}catch{throw Error(`Invalid sprite URL "${e}", must be absolute. Modify style specification directly or use TransformStyleFunction to correct the issue dynamically`)}}async function IC(e,t,i,n){let a=DC(e),r=i>1?"@2x":"",s={},o={};for(let{id:e,url:i}of a){let a=await t.transformRequest(PC(i,r,".json"),"SpriteJSON");s[e]=Xh(a,n);let l=await t.transformRequest(PC(i,r,".png"),"SpriteImage");o[e]=nC.getImage(l,n)}return await Promise.all([...Object.values(s),...Object.values(o)]),async function(e,t){let i={};for(let n in e){i[n]={};let a=(await t[n]).data;if(!a)throw Error(`Could not load sprite image for ${n}: the response is empty`);let r=$M.getImageCanvasContext(a),s=(await e[n]).data;for(let e in s){let{width:t,height:a,x:o,y:l,sdf:c,pixelRatio:u,stretchX:h,stretchY:d,content:p,textFitWidth:m,textFitHeight:g}=s[e],f={width:t,height:a,x:o,y:l,context:r};i[n][e]={data:null,pixelRatio:u,sdf:c,stretchX:h,stretchY:d,content:p,textFitWidth:m,textFitHeight:g,spriteData:f}}}return i}(s,o)}var FC=class extends id{constructor(){super(),this.images={},this.updateVersion=0,this.loaded=!1,this.requestors=[],this.missingImageResolver=null,this._spriteImagesIds={},this._imagesIds=null,this._renderCallbacksDispatchedThisFrame={}}destroy(){for(let e of Object.keys(this.images))this.removeImage(e);this._spriteImagesIds={}}isLoaded(){return this.loaded}setLoaded(e){if(this.loaded!==e&&(this.loaded=e,e)){for(let{ids:e,promiseResolve:t}of this.requestors)t(this._getImagesForIds(e));this.requestors=[]}}getImage(e){let t=this.images[e];if(t&&!t.data&&t.spriteData){let e=t.spriteData;t.data=new Hv({width:e.width,height:e.height},e.context.getImageData(e.x,e.y,e.width,e.height).data),t.spriteData=null}return t}addImage(e,t){if(this.images[e])throw Error(`Image id ${e} already exist, use updateImage instead`);this._validate(e,t)&&(this.images[e]=t,this._imagesIds=null,t.isWebGLImage&&this.updateImage(e,t,!1))}_validate(e,t){let i=!0,n=t.data||t.spriteData;return this._validateStretch(t.stretchX,n?.width)||(this.fire(new td(Error(`Image "${e}" has invalid "stretchX" value`))),i=!1),this._validateStretch(t.stretchY,n?.height)||(this.fire(new td(Error(`Image "${e}" has invalid "stretchY" value`))),i=!1),this._validateContent(t.content,t)||(this.fire(new td(Error(`Image "${e}" has invalid "content" value`))),i=!1),i}_validateStretch(e,t){if(!e)return!0;let i=0;for(let n of e){if(n[0]<i||n[1]<n[0]||t<n[1])return!1;i=n[1]}return!0}_validateContent(e,t){if(!e)return!0;if(4!==e.length)return!1;let i=t.spriteData,n=i?.width||t.data.width,a=i?.height||t.data.height;return!(e[0]<0||n<e[0]||e[1]<0||a<e[1]||e[2]<0||n<e[2]||e[3]<0||a<e[3]||e[2]<e[0])&&e[3]>=e[1]}updateImage(e,t,i=!0){let n=this.images[e];if(i){let e=n.data||n.spriteData;if(e.width!==t.data.width||e.height!==t.data.height)throw Error(`size mismatch between old image (${e.width}x${e.height}) and new image (${t.data.width}x${t.data.height}).`)}t.version=(n.version??0)+1,this.images[e]=t,this.updateVersion++}removeImage(e){let t=this.images[e];t&&(delete this.images[e],this._imagesIds=null,t.userImage?.onRemove&&t.userImage.onRemove())}listImages(){return this._imagesIds??=Object.keys(this.images),this._imagesIds}_getSpriteImageId(e,t){return"default"===e?t:`${e}:${t}`}setSpriteImages(e,t){let i=this._spriteImagesIds[e]??[],n=[];for(let i in t){let a=this._getSpriteImageId(e,i);n.push(a),a in this.images?this.updateImage(a,t[i],!1):this.addImage(a,t[i])}let a=new Set(n),r=i.filter(e=>!a.has(e));for(let e of r)this.removeImage(e);return this._spriteImagesIds[e]=n,{loaded:n,removed:r}}removeSpriteImages(e){let t=this._spriteImagesIds[e]??[];for(let e of t)this.removeImage(e);return delete this._spriteImagesIds[e],t}removeAllSpriteImages(){let e=Object.values(this._spriteImagesIds).flat();for(let t of e)this.removeImage(t);return this._spriteImagesIds={},e}setMissingImageResolver(e){this.missingImageResolver=e}getImages(e){return new Promise((t,i)=>{let n=!0;if(!this.isLoaded())for(let t of e)this.images[t]||(n=!1);this.isLoaded()||n?t(this._getImagesForIds(e)):this.requestors.push({ids:e,promiseResolve:t})})}async _getImagesForIds(e){let t=new Set(e.filter(e=>!this.getImage(e))),i=this.missingImageResolver;i&&await Promise.allSettled(Array.from(t,e=>i(e)));let n={};for(let i of e){let e=this.getImage(i);e&&(t.delete(i),n[i]={data:e.data.clone(),pixelRatio:e.pixelRatio,sdf:e.sdf,version:e.version,stretchX:e.stretchX,stretchY:e.stretchY,content:e.content,textFitWidth:e.textFitWidth,textFitHeight:e.textFitHeight,hasRenderCallback:!!e.userImage?.render,isWebGLImage:e.isWebGLImage})}for(let e of t)this.fire(new AC({id:e})),yh(`Image "${e}" could not be loaded. Please make sure you have added the image before it is needed with map.addImage(), resolved it with map.setMissingStyleImageResolver(), or included it in a "sprite" property in your style.`);return n}beginFrame(){this._renderCallbacksDispatchedThisFrame={}}dispatchRenderCallbacks(e){for(let t of e){if(this._renderCallbacksDispatchedThisFrame[t])continue;this._renderCallbacksDispatchedThisFrame[t]=!0;let e=this.getImage(t);e||yh(`Image with ID: "${t}" was not found`),_w(e)&&this.updateImage(t,e)}}cloneImages(){let e={};for(let t in this.images){let i=this.images[t];e[t]={...i,data:i.data?i.data.clone():null}}return e}},zC=class{constructor(e){this._imageManager=e,this._entries={},this._image=new Hv({width:1,height:1}),this._dirty=!0}destroy(){this._texture&&=(this._texture.destroy(),null),this._entries={},this._image=new Hv({width:1,height:1}),this._dirty=!0}getPixelSize(){let{width:e,height:t}=this._image;return{width:e,height:t}}getPattern(e){let t=this._imageManager.getImage(e);if(!t)return null;let i=this._entries[e];if(i?.image!==t){let i={w:t.data.width+2,h:t.data.height+2,x:0,y:0};this._entries[e]={bin:i,position:new yw(i,t),image:t}}else{if(i.position.version===t.version)return i.position;i.position.version=t.version}return this._update(),this._entries[e].position}bind(e){let t=e.gl;this._texture?this._dirty&&=(this._texture.update(this._image),!1):(this._texture=new iy(e,this._image,t.RGBA),this._dirty=!1),this._texture.bind(t.LINEAR,t.CLAMP_TO_EDGE)}_update(){for(let e in this._entries)this._imageManager.getImage(e)||delete this._entries[e];let e=[];for(let t in this._entries)e.push(this._entries[t].bin);let{w:t,h:i}=vw(e),n=this._image;n.resize({width:t||1,height:i||1});for(let e in this._entries){let{bin:t}=this._entries[e],i=t.x+1,a=t.y+1,r=this._entries[e].image.data,s=r.width,o=r.height;Hv.copy(r,n,{x:0,y:0},{x:i,y:a},{width:s,height:o}),Hv.copy(r,n,{x:0,y:o-1},{x:i,y:a-1},{width:s,height:1}),Hv.copy(r,n,{x:0,y:0},{x:i,y:a+o},{width:s,height:1}),Hv.copy(r,n,{x:s-1,y:0},{x:i-1,y:a},{width:1,height:o}),Hv.copy(r,n,{x:0,y:0},{x:i+s,y:a},{width:1,height:o})}this._dirty=!0}};const RC=1114111,LC={start:0,end:RC};let BC=0;function OC(e){let t=/^u\+([0-9a-f]*)(\?+)$/i.exec(e);if(t){let[,e,i]=t;return e.length+i.length>6?null:UC(parseInt(`${e}${"0".repeat(i.length)}`,16),parseInt(`${e}${"f".repeat(i.length)}`,16))}let i=/^u\+([0-9a-f]{1,6})(?:-([0-9a-f]{1,6}))?$/i.exec(e);if(!i)return null;let n=parseInt(i[1],16);return UC(n,void 0===i[2]?n:parseInt(i[2],16))}function UC(e,t){return e>t||e>RC?null:{start:e,end:Math.min(t,RC)}}function NC(e,t){return e.ranges.some(({start:e,end:i})=>t>=e&&t<=i)}var jC=class{constructor(e){this.requestManager=e,this._faces={},this._registered=new Set}setFontFaces(e){this._unregisterAll(),this._faces={};for(let[t,i]of Object.entries(e??{})){let e=Array.isArray(i)?i:[i];this._faces[t]=e.map(e=>this._declareFontFace(t,e)).filter(e=>null!==e)}}hasFontFaces(){return Object.keys(this._faces).length>0}async getFontFamily(e,t){for(let i of e.split(","))for(let e of this._faces[i.trim()]??[])if(NC(e,t)&&(e.loaded??=this._loadFontFace(e),await e.loaded))return e.family;return null}_declareFontFace(e,t){let i="string"==typeof t?{url:t}:t;if("string"!=typeof i?.url)return yh(`Ignoring the font face declared for "${e}": it has no URL.`),null;let n="maplibre-gl-font-face-"+BC++,a=i["unicode-range"];if(!a?.length)return{url:i.url,ranges:[LC],family:n};let r=[];for(let e of a){let t=OC(e);t?r.push(t):yh(`Ignoring the unicode range "${e}" of the font face at ${i.url}: it is not a valid range.`)}return r.length?{url:i.url,ranges:r,family:n}:null}async _loadFontFace(e){if(typeof FontFace>"u"||typeof document>"u"||!document.fonts)return yh(`Ignoring the font face at ${e.url}: this environment has no CSS Font Loading API.`),!1;let t;try{return t=new FontFace(e.family,await this._downloadFontFile(e.url)),!!Object.values(this._faces).some(t=>t.includes(e))&&(document.fonts.add(t),this._registered.add(t),await t.load(),!0)}catch(i){return t&&this._unregister(t),yh(`Ignoring the font face at ${e.url}: ${ju(i).message}`),!1}}async _downloadFontFile(e){let t=await this.requestManager.transformRequest(e,"Glyphs"),i=await Qh(t,new AbortController);if(!i?.data)throw Error(`the response was empty for the font file at ${e}`);return i.data}_unregister(e){document.fonts?.delete(e),this._registered.delete(e)}_unregisterAll(){for(let e of this._registered)document.fonts?.delete(e);this._registered.clear()}destroy(){this._unregisterAll(),this._faces={}}};const VC=1e20,qC=new Float64Array(256);for(let e=0;e<256;e++){let t=.5-(e/255)**(1/2.2);qC[e]=t*Math.abs(t)}qC[255]=-1e20;var GC=class{constructor({fontSize:e=24,buffer:t=3,radius:i=8,cutoff:n=.25,fontFamily:a="sans-serif",fontWeight:r="normal",fontStyle:s="normal",lang:o=null}={}){this.buffer=t,this.radius=i,this.cutoff=n,this.lang=o;let l=this.size=e+4*t,c=this._createCanvas(l),u=this.ctx=c.getContext("2d",{willReadFrequently:!0});u.font=`${s} ${r} ${e}px ${a}`,u.textBaseline="alphabetic",u.textAlign="left",u.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(e){if(typeof OffscreenCanvas<"u")return new OffscreenCanvas(e,e);let t=document.createElement("canvas");return t.width=t.height=e,t}draw(e){let{width:t,actualBoundingBoxAscent:i,actualBoundingBoxDescent:n,actualBoundingBoxLeft:a,actualBoundingBoxRight:r}=this.ctx.measureText(e),s=Math.ceil(i),o=Math.floor(-a),l=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(r)-o)),c=Math.max(0,Math.min(this.size-this.buffer,s+Math.ceil(n))),u=l+2*this.buffer,h=c+2*this.buffer,d=Math.max(u*h,0),p=new Uint8ClampedArray(d),m={data:p,width:u,height:h,glyphWidth:l,glyphHeight:c,glyphTop:s,glyphLeft:o,glyphAdvance:t};if(0===l||0===c)return m;let{ctx:g,buffer:f,gridInner:A,gridOuter:_}=this;this.lang&&(g.lang=this.lang),g.clearRect(f,f,l,c),g.fillText(e,f-o,f+s);let v=g.getImageData(f,f,l,c);_.fill(VC,0,d),A.fill(0,0,d);let y=3;for(let e=0;e<c;e++){let t=(e+f)*u+f;for(let e=0;e<l;e++,y+=4,t++){let e=v.data[y];if(0===e)continue;let i=qC[e];_[t]=Math.max(0,i),A[t]=Math.max(0,-i)}}HC(_,0,0,u,h,u,this.f,this.v,this.z);let x=Math.min(f,1);HC(A,f-x,f-x,l+2*x,c+2*x,u,this.f,this.v,this.z);let b=255/this.radius,w=255*(1-this.cutoff);for(let e=0;e<d;e++){let t=Math.sqrt(_[e])-Math.sqrt(A[e]);p[e]=Math.round(w-b*t)}return m}};function HC(e,t,i,n,a,r,s,o,l){for(let c=t;c<t+n;c++)WC(e,i*r+c,r,a,s,o,l);for(let c=i;c<i+a;c++)WC(e,c*r+t,1,n,s,o,l)}function WC(e,t,i,n,a,r,s){r[0]=0,s[0]=-1e20,s[1]=VC,a[0]=e[t];for(let o=1,l=0,c=0;o<n;o++){a[o]=e[t+o*i];let n=o*o;do{let e=r[l];c=(a[o]-a[e]+n-e*e)/(o-e)/2}while(c<=s[l]&&--l>-1);l++,r[l]=o,s[l]=c,s[l+1]=VC}for(let o=0,l=0;o<n;o++){for(;s[l+1]<o;)l++;let n=r[l],c=o-n;e[t+o*i]=a[n]+c*c}}const ZC=ad.layout_symbol["text-font"].default.join(","),KC=(e,t)=>{let i=new GC(e);return i.buffer=t,i};var XC=class{constructor(e,t,i,n=KC){this.requestManager=e,this.localIdeographFontFamily=t,this.entries={},this.lang=i,this.fontFaceManager=new jC(e),this.createRasterizer=n}setURL(e){this.url=e}setFontFaces(e){this.fontFaceManager.setFontFaces(e),this.entries={}}async getGlyphs(e){let t=[];for(let i in e)for(let n of e[i])t.push(this._getAndCacheGlyphsPromise(i,n));let i=await Promise.all(t),n={};for(let{stack:e,id:t,glyph:a}of i)n[e]||={},n[e][t]=a&&{id:a.id,bitmap:a.bitmap.clone(),metrics:a.metrics};return n}async _getAndCacheGlyphsPromise(e,t){this.entries[e]??={glyphs:{},requests:{},ranges:{}};let i=this.entries[e],n=i.glyphs[t];if(void 0!==n)return{stack:e,id:t,glyph:n};let a=t.codePointAt(0),r=this.fontFaceManager.hasFontFaces()?await this.fontFaceManager.getFontFamily(e,a):null;return r?(n=i.glyphs[t]=await this._drawGlyph(i,e,t,r),{stack:e,id:t,glyph:n}):!this.url||Ub(t)||this._charUsesLocalIdeographFontFamily(a)?(n=i.glyphs[t]=await this._drawGlyph(i,e,t),{stack:e,id:t,glyph:n}):await this._downloadAndCacheRangePromise(e,t)}async _downloadAndCacheRangePromise(e,t){let i=t.codePointAt(0),n=this.entries[e],a=Math.floor(i/256);if(n.ranges[a])return{stack:e,id:t,glyph:null};n.requests[a]||=this._loadGlyphRange(e,a);try{let r=await n.requests[a];for(let e in r)n.glyphs[String.fromCodePoint(+e)]=r[+e];return n.ranges[a]=!0,{stack:e,id:t,glyph:r[i]||null}}catch(r){let s=n.glyphs[t]=await this._drawGlyph(n,e,t);return this._warnOnMissingGlyphRange(s,a,i,ju(r)),{stack:e,id:t,glyph:s}}}async _loadGlyphRange(e,t){let i=256*t,n=i+255,a=await this.requestManager.transformRequest(this.url.replace("{fontstack}",e).replace("{range}",`${i}-${n}`),"Glyphs"),r=await Qh(a,new AbortController);if(!r?.data)throw Error(`Could not load glyph range. range: ${t}, ${i}-${n}`);let s={};for(let e of function(e){return new pw(e).readFields(mw,[])}(r.data))s[e.id]=e;return s}_warnOnMissingGlyphRange(e,t,i,n){let a=256*t;yh(`Unable to load glyph range ${t}, ${a}-${a+255}. Rendering codepoint U+${i.toString(16).padStart(4,"0").toUpperCase()} locally instead. ${n}`)}_charUsesLocalIdeographFontFamily(e){return!!this.localIdeographFontFamily&&function(e){return/[\u02EA\u02EB\u1100-\u11FF\u2E80-\u2FDF\u3000-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\uA960-\uA97C\uAC00-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFE10-\uFE1F\uFE30-\uFE4F\uFF00-\uFFEF]|\uD81B[\uDFE0-\uDFFF]|[\uD81C-\uD822\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFFF]|\uD82C[\uDC00-\uDEFB]|\uD83C[\uDE00-\uDEFF]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79]/gim.test(String.fromCodePoint(e))}(e)}async _drawGlyph(e,t,i,n){let a=(await this._getTinySDF(e,t,i,n)).draw(i),r=/^\p{gc=Cf}+$/u.test(i);return{id:i.codePointAt(0),bitmap:new Gv({width:a.width||60,height:a.height||60},a.data),metrics:{width:r?0:a.glyphWidth/2||24,height:a.glyphHeight/2||24,left:a.glyphLeft/2+.5||0,top:a.glyphTop/2-27.5||-8,advance:r?0:a.glyphAdvance/2||24,isDoubleResolution:!0}}}_getTinySDF(e,t,i,n){let a=Ub(i);if(n){let t=a?"clusterTinySDFs":"fontFaceTinySDFs";return e[t]??={},e[t][n]||=this._createTinySDF(n,!1,a?3:1),e[t][n]}let r=t===ZC&&""!==this.localIdeographFontFamily&&this._charUsesLocalIdeographFontFamily(i.codePointAt(0)),s=r?this.localIdeographFontFamily:t;if(a)return e.clusterTinySDFs??={},e.clusterTinySDFs[s]||=this._createTinySDF(s,!0,3),e.clusterTinySDFs[s];let o=r?"ideographTinySDF":"tinySDF";return e[o]||=this._createTinySDF(s),e[o]}async _createTinySDF(e,t=!0,i=1){let n=e?e.split(","):[];n.push("sans-serif");let a=n.map(e=>/[-\w]+/.test(e)?e:`'${CSS.escape(e)}'`).join(","),r=t?this._fontWeight(n[0]):void 0,s=t?this._fontStyle(n[0]):"normal";if(typeof document<"u"&&document.fonts?.load)try{await document.fonts.load(`${s} ${r||"normal"} 48px ${a}`)}catch(e){yh(`Failed to load font "${a}": ${ju(e).message}`)}return this.createRasterizer({fontSize:48,buffer:Math.max(6,Math.ceil(48*(i-1)/4)),radius:16,cutoff:.25,fontFamily:a,fontWeight:r,fontStyle:s,lang:this.lang},6)}_fontStyle(e){return/italic/i.test(e)?"italic":/oblique/i.test(e)?"oblique":"normal"}_fontWeight(e){let t,i={thin:100,hairline:100,"extra light":200,"ultra light":200,light:300,normal:400,regular:400,medium:500,semibold:600,demibold:600,bold:700,"extra bold":800,"ultra bold":800,black:900,heavy:900,"extra black":950,"ultra black":950};for(let[n,a]of Object.entries(i))RegExp(`\\b${n}\\b`,"i").test(e)&&(t=`${a}`);return t}destroy(){for(let e in this.entries){let t=this.entries[e];t.tinySDF=null,t.ideographTinySDF=null,t.fontFaceTinySDFs={},t.glyphs={},t.requests={},t.ranges={}}this.entries={},this.fontFaceManager.destroy()}};let QC;var YC=class extends id{constructor(e,t){super(),this._transitionable=new Yf(QC||=new uA({anchor:new rA(ad.light.anchor,"anchor"),position:new rA(ad.light.position,"position"),color:new rA(ad.light.color,"color"),intensity:new rA(ad.light.intensity,"intensity")}),"light",t),this.setLight(e),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}getCartesianPosition(){return function([e,t,i]){return t+=90,t*=Math.PI/180,i*=Math.PI/180,[e*Math.cos(t)*Math.sin(i),e*Math.sin(t)*Math.sin(i),e*Math.cos(i)]}(this.properties.get("position"))}setLight(e,t={}){if(!this._validate(Ff.light,e,t))for(let t in e){let i=e[t];t.endsWith("-transition")?this._transitionable.setTransition(t.slice(0,-11),i):this._transitionable.setValue(t,i)}}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(e,t,i){return Bf(this,e,{value:t},i)}};let JC;var $C=class extends id{constructor(e,t){super(),this._transitionable=new Yf(JC||=new uA({"sky-color":new rA(ad.sky["sky-color"],"sky-color"),"horizon-color":new rA(ad.sky["horizon-color"],"horizon-color"),"fog-color":new rA(ad.sky["fog-color"],"fog-color"),"fog-ground-blend":new rA(ad.sky["fog-ground-blend"],"fog-ground-blend"),"horizon-fog-blend":new rA(ad.sky["horizon-fog-blend"],"horizon-fog-blend"),"sky-horizon-blend":new rA(ad.sky["sky-horizon-blend"],"sky-horizon-blend"),"atmosphere-blend":new rA(ad.sky["atmosphere-blend"],"atmosphere-blend")}),"sky",t),this.setSky(e),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new Zf(0))}setSky(e,t={}){if(!this._validate(Ff.sky,e,t)){e||={"sky-color":"transparent","horizon-color":"transparent","fog-color":"transparent","fog-ground-blend":1,"atmosphere-blend":0};for(let t in e){let i=e[t];t.endsWith("-transition")?this._transitionable.setTransition(t.slice(0,-11),i):this._transitionable.setValue(t,i)}}}getSky(){return this._transitionable.serialize()}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(e,t,i={}){return Bf(this,e,{value:t},i)}calculateFogBlendOpacity(e){return e<60?0:e<70?(e-60)/10:1}},eT=class{constructor(e,t){this.width=e,this.height=t,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(e,t){let i=e.join(",")+String(t);return this.dashEntry[i]||=this.addDash(e,t),this.dashEntry[i]}getDashRanges(e,t,i){let n=[],a=e.length%2==1?-e[e.length-1]*i:0,r=e[0]*i,s=!0;n.push({left:a,right:r,isDash:s,zeroLength:0===e[0]});let o=e[0];for(let t=1;t<e.length;t++){s=!s;let l=e[t];a=o*i,o+=l,r=o*i,n.push({left:a,right:r,isDash:s,zeroLength:0===l})}return n}addRoundDash(e,t,i){let n=t/2;for(let t=-i;t<=i;t++){let a=this.nextRow+i+t,r=this.width*a,s=0,o=e[s];for(let a=0;a<this.width;a++){a/o.right>1&&(o=e[++s]);let l,c=Math.abs(a-o.left),u=Math.abs(a-o.right),h=Math.min(c,u),d=t/i*(n+1);if(o.isDash){let e=n-Math.abs(d);l=Math.sqrt(h*h+e*e)}else l=n-Math.sqrt(h*h+d*d);this.data[r+a]=Math.max(0,Math.min(255,l+128))}}}addRegularDash(e){for(let t=e.length-1;t>=0;--t){let i=e[t],n=e[t+1];i.zeroLength?e.splice(t,1):n?.isDash===i.isDash&&(n.left=i.left,e.splice(t,1))}let t=e[0],i=e[e.length-1];t.isDash===i.isDash&&(t.left=i.left-this.width,i.right=t.right+this.width);let n=this.width*this.nextRow,a=0,r=e[a];for(let t=0;t<this.width;t++){t/r.right>1&&(r=e[++a]);let i=Math.abs(t-r.left),s=Math.abs(t-r.right),o=Math.min(i,s),l=r.isDash?o:-o;this.data[n+t]=Math.max(0,Math.min(255,l+128))}}addDash(e,t){let i=t?7:0,n=2*i+1;if(this.nextRow+n>this.height)return yh("LineAtlas out of space"),null;let a=0;for(let t of e)a+=t;if(0!==a){let n=this.width/a,r=this.getDashRanges(e,this.width,n);t?this.addRoundDash(r,n,i):this.addRegularDash(r)}let r={y:this.nextRow+i,height:2*i,width:a};return this.nextRow+=n,this.dirty=!0,r}bind(e){let t=e.gl;this.texture?(t.bindTexture(t.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,t.texSubImage2D(t.TEXTURE_2D,0,0,0,this.width,this.height,t.ALPHA,t.UNSIGNED_BYTE,this.data))):(this.texture=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.REPEAT),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.REPEAT),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texImage2D(t.TEXTURE_2D,0,t.ALPHA,this.width,this.height,0,t.ALPHA,t.UNSIGNED_BYTE,this.data))}};function tT(e,t){if(t)try{return new Worker(e,{type:"module"})}catch(e){console.warn("Module worker not supported, falling back to classic worker",e)}return new Worker(e)}async function iT(){let t=Vh.WORKER_URL||function(){let t="undefined"==typeof document?require("url").pathToFileURL(__filename).href:e&&"SCRIPT"===e.tagName.toUpperCase()&&e.src||new URL("index.js",document.baseURI).href;if(!/^https?:/.test(t))return"";let i=t.endsWith("-dev.mjs")?"maplibre-gl-worker-dev.mjs":"maplibre-gl-worker.mjs";return new URL(`./${i}`,t).href}(),i=!t?.endsWith(".cjs");if(!function(e){if(!e)return!1;let t=globalThis.location;if(!t)return!1;try{return new URL(e,t.href).origin!==t.origin}catch{return!1}}(t))return tT(t,i);if(i){let n=function(t){let i=new Blob([`import ${JSON.stringify(new URL(t,"undefined"==typeof document?require("url").pathToFileURL(__filename).href:e&&"SCRIPT"===e.tagName.toUpperCase()&&e.src||new URL("index.js",document.baseURI).href).href)}`],{type:"text/javascript"});return URL.createObjectURL(i)}(t);try{return tT(n,i)}finally{URL.revokeObjectURL(n)}}let n=await async function(e){let t=await fetch(e);if(!t.ok)throw Error(`Failed to fetch worker script (${t.status}): ${e}`);let i=await t.text(),n=new Blob([i],{type:"text/javascript"});return URL.createObjectURL(n)}(t);try{return tT(n,i)}finally{URL.revokeObjectURL(n)}}var nT=class e{constructor(){this.active={},this.workersPromise=null}async acquire(t){if(this.active[t]=!0,!this.workersPromise){let t=[];for(;t.length<e.workerCount;)t.push(iT());this.workersPromise=Promise.all(t)}return(await this.workersPromise).slice()}release(e){if(delete this.active[e],0===this.numActive()&&this.workersPromise){let e=this.workersPromise;this.workersPromise=null,e.then(e=>{for(let t of e)t.terminate()})}}isPreloaded(){return!!this.active.maplibre_preloaded_worker_pool}numActive(){return Object.keys(this.active).length}};const aT=Math.floor($M.hardwareConcurrency/2);let rT;function sT(){return rT||=new nT,rT}nT.workerCount=function(e){if(null==wh){let t=e.navigator?e.navigator.userAgent:null;wh=!!e.safari||!(!t||!(/\b(iPad|iPhone|iPod)\b/.test(t)||t.match("Safari")&&!t.match("Chrome")))}return wh}(globalThis)?Math.max(Math.min(aT,3),1):1;var oT=class{constructor(e,t){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=t,this.removed=!1,this.actorsPromise=this.initActors(t)}async initActors(e){let t=await this.workerPool.acquire(e);if(this.removed)return[];if(this.actors=t.map((t,i)=>{let n=new jE(t,e);return n.name=`Worker ${i}`,n}),!this.actors.length)throw Error("No actors found");return this.actors}async broadcast(e,t){let i=await this.actorsPromise;return Promise.all(i.map(i=>i.sendAsync({type:e,data:t})))}async getActor(){let e=await this.actorsPromise;return this.currentActor=(this.currentActor+1)%e.length,e[this.currentActor]}async waitForInitComplete(){0===this.actors.length&&await this.actorsPromise}getReadyActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(e=!0){this.removed=!0;for(let e of this.actors)e.remove();this.actors=[],e&&this.workerPool.release(this.id)}async registerMessageHandler(e,t){let i=await this.actorsPromise;for(let n of i)n.registerMessageHandler(e,t)}async unregisterMessageHandler(e){let t=await this.actorsPromise;for(let i of t)i.unregisterMessageHandler(e)}};let lT;function cT(e,t){let i=Jc();return nu(i,i,[1,1,0]),au(i,i,[.5*e.width,.5*e.height,1]),e.calculatePosMatrix?iu(i,i,e.calculatePosMatrix(t.toUnwrapped())):i}function uT(e,t,i,n,a,r,s){let o=function(e,t,i){if(e)for(let n of e){let e=t[n];if(e?.source===i&&"fill-extrusion"===e.type)return!0}else for(let e in t){let n=t[e];if(n.source===i&&"fill-extrusion"===n.type)return!0}return!1}(a?.layers??null,t,e.id),l=r.maxPitchScaleFactor(),c=e.tilesIn(n,l,o);c.sort(dT);let u=[];for(let n of c)u.push({wrappedTileID:n.tileID.wrapped().key,queryResults:n.tile.queryRenderedFeatures(t,i,e.getState(),n.queryGeometry,n.cameraQueryGeometry,n.scale,a,r,l,cT(r,n.tileID),s?(e,t)=>s(n.tileID,e,t):void 0)});return function(e,t){for(let i in e)for(let n of e[i])pT(n,t);return e}(function(e){let t={},i={};for(let{queryResults:n,wrappedTileID:a}of e){i[a]||={};let e=i[a];for(let i in n){let a=n[i];e[i]||={};let r=e[i];t[i]||=[];for(let e of a)r[e.featureIndex]||(r[e.featureIndex]=!0,t[i].push(e))}}return t}(u),e)}function hT(e,t,i,n,a,r,s){let o={},l=r.queryRenderedSymbols(n),c=[];for(let e of Object.keys(l).map(Number))c.push(s[e]);c.sort(dT);for(let i of c){let n=i.featureIndex.lookupSymbolFeatures(l[i.bucketInstanceId],t,i.bucketIndex,i.sourceLayerIndex,{filterSpec:a.filter,globalState:a.globalState},a.layers,a.availableImages,e);for(let e in n){o[e]||=[];let t=n[e];t.sort((e,t)=>{let n=i.featureSortOrder;if(n){let i=n.indexOf(e.featureIndex);return n.indexOf(t.featureIndex)-i}return t.featureIndex-e.featureIndex});for(let i of t)o[e].push(i)}}return function(e,t,i){for(let n in e)for(let a of e[n]){pT(a,i[t[n].source])}return e}(o,e,i)}function dT(e,t){let i=e.tileID,n=t.tileID;return i.overscaledZ-n.overscaledZ||i.canonical.y-n.canonical.y||i.wrap-n.wrap||i.canonical.x-n.canonical.x}function pT(e,t){let i=e.feature,n=t.getFeatureState(i.layer["source-layer"],i.id);i.source=i.layer.source,i.layer["source-layer"]&&(i.sourceLayer=i.layer["source-layer"]),i.state=n}async function mT(e,t,i,n){let a=e;if(e.url?a=(await Xh(await t.transformRequest(e.url,"Source"),i)).data:await $M.frameAsync(i,n),!a)return null;let r=ch(lh(a,e),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in a&&a.vector_layers&&(r.vectorLayerIds=a.vector_layers.map(e=>e.id)),r}var gT=class e{constructor(e,t){e&&(t?this.setSouthWest(e).setNorthEast(t):Array.isArray(e)&&(4===e.length?this.setSouthWest([e[0],e[1]]).setNorthEast([e[2],e[3]]):this.setSouthWest(e[0]).setNorthEast(e[1])))}setNorthEast(e){return this._ne=e instanceof Ex?new Ex(e.lng,e.lat):Ex.convert(e),this}setSouthWest(e){return this._sw=e instanceof Ex?new Ex(e.lng,e.lat):Ex.convert(e),this}extend(t){let i,n,a=this._sw,r=this._ne;if(t instanceof Ex)i=t,n=t;else{if(!(t instanceof e)){if(Array.isArray(t)){if(4===t.length||t.every(Array.isArray)){let i=t;return this.extend(e.convert(i))}{let e=t;return this.extend(Ex.convert(e))}}return t&&("lng"in t||"lon"in t)&&"lat"in t?this.extend(Ex.convert(t)):this}if(i=t._sw,n=t._ne,!i||!n)return this}return a||r?(a.lng=Math.min(i.lng,a.lng),a.lat=Math.min(i.lat,a.lat),r.lng=Math.max(n.lng,r.lng),r.lat=Math.max(n.lat,r.lat)):(this._sw=new Ex(i.lng,i.lat),this._ne=new Ex(n.lng,n.lat)),this}getCenter(){return new Ex((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 Ex(this.getWest(),this.getNorth())}getSouthEast(){return new Ex(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(e){let{lng:t,lat:i}=Ex.convert(e),n=this._sw.lat<=i&&i<=this._ne.lat,a=this._sw.lng<=t&&t<=this._ne.lng;return this._sw.lng>this._ne.lng&&(a=this._sw.lng>=t&&t>=this._ne.lng),n&&a}intersects(t){if(!((t=e.convert(t)).getNorth()>=this.getSouth()&&t.getSouth()<=this.getNorth()))return!1;let i=Math.abs(this.getEast()-this.getWest()),n=Math.abs(t.getEast()-t.getWest());if(i>=360||n>=360)return!0;let a=oh(this.getWest(),-180,180),r=oh(this.getEast(),-180,180),s=oh(t.getWest(),-180,180),o=oh(t.getEast(),-180,180),l=a>r,c=s>o;return!(!l||!c)||(l?o>=a||s<=r:c?r>=s||a<=o:s<=r&&o>=a)}static convert(t){return t instanceof e||!t?t:new e(t)}static fromLngLat(t,i=0){let n=360*i/40075017,a=n/Math.cos(Math.PI/180*t.lat);return new e(new Ex(t.lng-a,t.lat-n),new Ex(t.lng+a,t.lat+n))}adjustAntiMeridian(){let t=new Ex(this._sw.lng,this._sw.lat),i=new Ex(this._ne.lng,this._ne.lat);return t.lng>i.lng?new e(t,new Ex(i.lng+360,i.lat)):new e(t,i)}},fT=class{constructor(e,t,i){this.bounds=gT.convert(this.validateBounds(e)),this.minzoom=t||0,this.maxzoom=i||24}validateBounds(e){return Array.isArray(e)&&4===e.length?[Math.max(-180,e[0]),Math.max(-90,e[1]),Math.min(180,e[2]),Math.min(90,e[3])]:[-180,-90,180,90]}contains(e){let t=2**e.z,i=Math.floor(Mx(this.bounds.getWest())*t),n=Math.floor(Cx(this.bounds.getNorth())*t),a=Math.ceil(Mx(this.bounds.getEast())*t),r=Math.ceil(Cx(this.bounds.getSouth())*t);return e.x>=i&&e.x<a&&e.y>=n&&e.y<r}},AT=class extends id{constructor(e,t,i,n){if(super(),this.id=e,this.dispatcher=i,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,lh(this,ch(t,["url","scheme","tileSize","promoteId","encoding"])),this._options=lh({type:"vector"},t),this._collectResourceTiming=t.collectResourceTiming,512!==this.tileSize)throw Error("vector tile sources must have a tileSize of 512");this.setEventedParent(n)}async load(e=!1){this._loaded=!1,this.fire(new cC("dataloading")),this._tileJSONRequest=new AbortController;try{let t=await mT(this._options,this.map._requestManager,this._tileJSONRequest,this.map._ownerWindow);this._tileJSONRequest=null,this._loaded=!0,t&&(lh(this,t),t.bounds&&(this.tileBounds=new fT(t.bounds,this.minzoom,this.maxzoom)),this.fire(new cC("data",{sourceDataType:"metadata"})),this.fire(new cC("data",{sourceDataType:"content",sourceDataChanged:e})))}catch(e){this._tileJSONRequest=null,this._loaded=!0,Nh(e)||this.fire(new td(ju(e)))}}loaded(){return this._loaded}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}onAdd(e){this.map=e,this.load()}setSourceProperty(e){this._tileJSONRequest&&this._tileJSONRequest.abort(),e(),this.load(!0)}setTiles(e){return this.setSourceProperty(()=>{this.tiles=e,this._options.tiles=e}),this}setUrl(e){return this.setSourceProperty(()=>{this.url=e,this._options.url=e}),this}onRemove(){this._tileJSONRequest&&=(this._tileJSONRequest.abort(),null)}serialize(){return lh({},this._options)}async loadTile(e){let t=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),i={request:await this.map._requestManager.transformRequest(t,"Tile"),uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,tileSize:this.tileSize*e.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity,encoding:this.encoding,overzoomParameters:await this._getOverzoomParameters(e),etag:e.etag};i.request.collectResourceTiming=this._collectResourceTiming,await this.dispatcher.waitForInitComplete();let n="RT";if(e.actor&&"expired"!==e.state){if("loading"===e.state)return new Promise((t,i)=>{e.reloadPromise={resolve:t,reject:i}})}else e.actor=this.dispatcher.getReadyActor(),n="LT";e.abortController=new AbortController;try{let t=await e.actor.sendAsync({type:n,data:i},e.abortController);if(delete e.abortController,e.aborted)return;this._afterTileLoadWorkerResponse(e,t);let a={};return t?.etagUnmodified&&(a.unmodified=!0),a}catch(t){if(delete e.abortController,e.aborted||Nh(t))return;if(t&&404!==t.status)throw t;this._afterTileLoadWorkerResponse(e,null)}}async _getOverzoomParameters(e){if(e.tileID.canonical.z<=this.maxzoom||void 0===this.map._zoomLevelsToOverscale)return;let t=e.tileID.scaledTo(this.maxzoom).canonical,i=t.url(this.tiles,this.map.getPixelRatio(),this.scheme);return{maxZoomTileID:t,overzoomRequest:await this.map._requestManager.transformRequest(i,"Tile")}}_afterTileLoadWorkerResponse(e,t){if(t?.resourceTiming&&(e.resourceTiming=t.resourceTiming),t&&this.map._refreshExpiredTiles&&e.setExpiryData(t),e.etag=t?.etag,e.loadVectorData(t,this.map.painter),e.reloadPromise){let t=e.reloadPromise;e.reloadPromise=null,this.loadTile(e).then(t.resolve).catch(t.reject)}}async abortTile(e){e.abortController&&(e.abortController.abort(),delete e.abortController),e.actor&&await e.actor.sendAsync({type:"AT",data:{uid:e.uid,type:this.type,source:this.id}})}async unloadTile(e){e.unloadVectorData(),e.actor&&await e.actor.sendAsync({type:"RMT",data:{uid:e.uid,type:this.type,source:this.id}})}hasTransition(){return!1}},_T=class extends id{constructor(e,t,i,n){super(),this.id=e,this.dispatcher=i,this.setEventedParent(n),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._premultiplyAlpha=!0,this._options=lh({type:"raster"},t),lh(this,ch(t,["url","scheme","tileSize"]))}async load(e=!1){this._loaded=!1,this.fire(new cC("dataloading")),this._tileJSONRequest=new AbortController;try{let t=await mT(this._options,this.map._requestManager,this._tileJSONRequest,this.map._ownerWindow);this._tileJSONRequest=null,this._loaded=!0,t&&(lh(this,t),t.bounds&&(this.tileBounds=new fT(t.bounds,this.minzoom,this.maxzoom)),this.fire(new cC("data",{sourceDataType:"metadata"})),this.fire(new cC("data",{sourceDataType:"content",sourceDataChanged:e})))}catch(e){this._tileJSONRequest=null,this._loaded=!0,Nh(e)||this.fire(new td(ju(e)))}}loaded(){return this._loaded}onAdd(e){this.map=e,this.load()}onRemove(){this._tileJSONRequest&&=(this._tileJSONRequest.abort(),null)}setSourceProperty(e){this._tileJSONRequest&&=(this._tileJSONRequest.abort(),null),e(),this.load(!0)}setTiles(e){return this.setSourceProperty(()=>{this.tiles=e,this._options.tiles=e}),this}setUrl(e){return this.setSourceProperty(()=>{this.url=e,this._options.url=e}),this}serialize(){return lh({},this._options)}setPremultiplyAlpha(e){return this._premultiplyAlpha===e||this.setSourceProperty(()=>{this._premultiplyAlpha=e}),this}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}async loadTile(e){let t=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),i=this._premultiplyAlpha,n=i?void 0:{premultiplyAlpha:"none"};e.abortController=new AbortController;try{let a=await nC.transformAndGetImage(this.map._requestManager,t,"Tile",e.abortController,this.map._refreshExpiredTiles,n);if(delete e.abortController,e.aborted)return void(e.state="unloaded");if(a){this.map._refreshExpiredTiles&&(a.cacheControl||a.expires)&&e.setExpiryData({cacheControl:a.cacheControl,expires:a.expires});let t=this.map.painter.context,n=t.gl,r=a.data??new Hv({width:1,height:1},new Uint8Array(4));e.texture=this.map.painter.getTileTexture(r.width),e.texture?e.texture.update(r,{useMipmap:!0,premultiply:i}):(e.texture=new iy(t,r,n.RGBA,{useMipmap:!0,premultiply:i}),e.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE,n.LINEAR_MIPMAP_NEAREST)),e.state="loaded"}}catch(t){if(delete e.abortController,e.aborted)e.state="unloaded";else if(t)throw e.state="errored",t}}async abortTile(e){e.abortController&&(e.abortController.abort(),delete e.abortController)}async unloadTile(e){e.texture&&this.map.painter.saveTileTexture(e.texture)}hasTransition(){return!1}},vT=class extends _T{constructor(e,t,i,n){super(e,t,i,n),this.type="raster-dem",this.maxzoom=22,this._options=lh({type:"raster-dem"},t),this.encoding=t.encoding||"mapbox",this.redFactor=t.redFactor,this.greenFactor=t.greenFactor,this.blueFactor=t.blueFactor,this.baseShift=t.baseShift}async loadTile(e){let t=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);e.neighboringTiles=this._getNeighboringTiles(e.tileID),e.abortController=new AbortController;try{let i=await nC.transformAndGetImage(this.map._requestManager,t,"Tile",e.abortController,this.map._refreshExpiredTiles,{colorSpaceConversion:"none"});if(delete e.abortController,e.aborted)return void(e.state="unloaded");if(i){if(this.map._refreshExpiredTiles&&(i.cacheControl||i.expires)&&e.setExpiryData({cacheControl:i.cacheControl,expires:i.expires}),!i.data)return void(e.state="loaded");let t=i.data,n=Eh(t)&&Kc()?t:await this.readImageNow(t),a={type:this.type,uid:e.uid,source:this.id,rawImageData:n,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(e.actor&&"expired"!==e.state&&"reloading"!==e.state)return;await this.dispatcher.waitForInitComplete(),(!e.actor||"expired"===e.state)&&(e.actor=this.dispatcher.getReadyActor()),e.dem=await e.actor.sendAsync({type:"LDT",data:a}),e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0,e.needsColorReliefPrepare=!0,e.state="loaded"}}catch(t){if(delete e.abortController,e.aborted)e.state="unloaded";else if(t)throw e.state="errored",t}}async readImageNow(e){if(typeof VideoFrame<"u"&&Xc()){let t=e.width+4,i=e.height+4;try{return new Hv({width:t,height:i},await kh(e,-2,-2,t,i))}catch{}}return $M.getImageData(e,2)}_getNeighboringTiles(e){let t=e.canonical,i=2**t.z,n=(t.x-1+i)%i,a=0===t.x?e.wrap-1:e.wrap,r=(t.x+1+i)%i,s=t.x+1===i?e.wrap+1:e.wrap,o={};return o[new HE(e.overscaledZ,a,t.z,n,t.y).key]={backfilled:!1},o[new HE(e.overscaledZ,s,t.z,r,t.y).key]={backfilled:!1},t.y>0&&(o[new HE(e.overscaledZ,a,t.z,n,t.y-1).key]={backfilled:!1},o[new HE(e.overscaledZ,e.wrap,t.z,t.x,t.y-1).key]={backfilled:!1},o[new HE(e.overscaledZ,s,t.z,r,t.y-1).key]={backfilled:!1}),t.y+1<i&&(o[new HE(e.overscaledZ,a,t.z,n,t.y+1).key]={backfilled:!1},o[new HE(e.overscaledZ,e.wrap,t.z,t.x,t.y+1).key]={backfilled:!1},o[new HE(e.overscaledZ,s,t.z,r,t.y+1).key]={backfilled:!1}),o}async unloadTile(e){e.demTexture&&this.map.painter.saveTileTexture(e.demTexture),e.fbo&&(e.fbo.destroy(),delete e.fbo),e.dem&&delete e.dem,delete e.neighboringTiles,e.state="unloaded",e.actor&&await e.actor.sendAsync({type:"RDT",data:{type:this.type,uid:e.uid,source:this.id}})}};function yT(e,t){return t?e.properties[t]:e.id}function xT(e,t,i){if(!e)return t||{};if(!t)return e||{};let n=wT(e),a=wT(t);!function(e,t){t.removeAll&&(e.add.clear(),e.update.clear(),e.remove.clear(),t.remove.clear());for(let i of t.remove)e.add.delete(i),e.update.delete(i);for(let[i,n]of t.update){let a=e.update.get(i);a&&(t.update.set(i,bT(a,n)),e.update.delete(i))}}(n,a);let r={};if((n.removeAll||a.removeAll)&&(r.removeAll=!0),r.remove=new Set([...n.remove,...a.remove]),r.add=new Map([...n.add,...a.add]),r.update=new Map([...n.update,...a.update]),r.remove.size&&r.add.size)for(let e of r.add.keys())r.remove.delete(e);let s=function(e){let t={};return e.removeAll&&(t.removeAll=e.removeAll),e.remove&&(t.remove=Array.from(e.remove)),e.add&&(t.add=Array.from(e.add.values())),e.update&&(t.update=Array.from(e.update.values())),t}(r);return s}function bT(e,t){let i={id:e.id};if(t.removeAllProperties&&(delete e.removeProperties,delete e.addOrUpdateProperties,delete t.removeProperties),t.removeProperties&&e.addOrUpdateProperties){let i=new Set(t.removeProperties);e.addOrUpdateProperties=e.addOrUpdateProperties.filter(e=>!i.has(e.key))}return(e.removeAllProperties||t.removeAllProperties)&&(i.removeAllProperties=!0),(e.removeProperties||t.removeProperties)&&(i.removeProperties=[...e.removeProperties||[],...t.removeProperties||[]]),(e.addOrUpdateProperties||t.addOrUpdateProperties)&&(i.addOrUpdateProperties=[...e.addOrUpdateProperties||[],...t.addOrUpdateProperties||[]]),(e.newGeometry||t.newGeometry)&&(i.newGeometry=t.newGeometry||e.newGeometry),i}function wT(e){if(!e)return{};let t={};return t.removeAll=e.removeAll,t.remove=new Set(e.remove||[]),t.add=new Map(e.add?.map(e=>[e.id,e])),t.update=new Map(e.update?.map(e=>[e.id,e])),t}function ET(e){return e&&0!==e.length?"number"==typeof e[0]?[e]:e.flatMap(e=>ET(e)):[]}function kT(e){return"GeometryCollection"===e.type?e.geometries.flatMap(e=>kT(e)):ET(e.coordinates)}function ST(e){let t,i=new gT;switch(e.type){case"FeatureCollection":t=e.features.flatMap(e=>kT(e.geometry));break;case"Feature":t=kT(e.geometry);break;default:t=kT(e)}if(0===t.length)return i;for(let e of t){let[t,n]=e;i.extend([t,n])}return i}var MT=class extends id{constructor(e,t,i,n){super(),this.id=e,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._isUpdatingWorker=!1,this._pendingWorkerUpdate={data:t.data},this.actorPromise=i.getActor(),this.setEventedParent(n),this._data="string"==typeof t.data?{url:t.data}:{geojson:t.data},this._options=lh({},t),this._collectResourceTiming=t.collectResourceTiming,void 0!==t.maxzoom&&(this.maxzoom=t.maxzoom),t.type&&(this.type=t.type),t.attribution&&(this.attribution=t.attribution),this.promoteId=t.promoteId,void 0!==t.clusterMaxZoom&&this.maxzoom<=t.clusterMaxZoom&&yh(`The maxzoom value "${this.maxzoom}" is expected to be greater than the clusterMaxZoom value "${t.clusterMaxZoom}".`),this.workerOptions=lh({source:this.id,geojsonVtOptions:{buffer:this._pixelsToTileUnits(void 0===t.buffer?128:t.buffer),tolerance:this._pixelsToTileUnits(void 0===t.tolerance?.375:t.tolerance),extent:Uu,maxZoom:this.maxzoom,lineMetrics:t.lineMetrics||!1,generateId:t.generateId||!1,promoteId:"string"==typeof t.promoteId?t.promoteId:void 0,cluster:t.cluster||!1,clusterOptions:{maxZoom:this._getClusterMaxZoom(t.clusterMaxZoom),minPoints:Math.max(2,t.clusterMinPoints||2),extent:Uu,radius:this._pixelsToTileUnits(t.clusterRadius||50),log:!1,generateId:t.generateId||!1}},clusterProperties:t.clusterProperties,filter:t.filter},t.workerOptions)}_hasPendingWorkerUpdate(){return void 0!==this._pendingWorkerUpdate.data||void 0!==this._pendingWorkerUpdate.diff||this._pendingWorkerUpdate.updateCluster}_pixelsToTileUnits(e){return e*(Uu/this.tileSize)}_tileUnitsToPixels(e){return e/(Uu/this.tileSize)}_getClusterMaxZoom(e){let t=e?Math.round(e):this.maxzoom-1;return Number.isInteger(e)||void 0===e||yh(`Integer expected for option 'clusterMaxZoom': provided value "${e}" rounded to "${t}"`),t}async load(){await this._updateWorkerData()}onAdd(e){this.map=e,this.load()}setData(e){return this._data="string"==typeof e?{url:e}:{geojson:e},this._pendingWorkerUpdate={data:e},this._updateWorkerData()}updateData(e){return this._pendingWorkerUpdate.diff=xT(this._pendingWorkerUpdate.diff,e),this._updateWorkerData()}async getData(){return this._data.url&&await this.once("data"),this._data.geojson?this._data.geojson:{type:"FeatureCollection",features:Array.from(this._data.updateable.values())}}async getBounds(){return ST(await this.getData())}setClusterOptions(e){return this.workerOptions.geojsonVtOptions.cluster=e.cluster,void 0!==e.clusterRadius&&(this.workerOptions.geojsonVtOptions.clusterOptions.radius=this._pixelsToTileUnits(e.clusterRadius)),void 0!==e.clusterMaxZoom&&(this.workerOptions.geojsonVtOptions.clusterOptions.maxZoom=this._getClusterMaxZoom(e.clusterMaxZoom)),this._pendingWorkerUpdate.updateCluster=!0,this._updateWorkerData()}getClusterOptions(){let{cluster:e,clusterOptions:t}=this.workerOptions.geojsonVtOptions;return{cluster:e,clusterMaxZoom:t.maxZoom,clusterRadius:this._tileUnitsToPixels(t.radius)}}async getClusterExpansionZoom(e){return(await this.actorPromise).sendAsync({type:"GCEZ",data:{type:this.type,clusterId:e,source:this.id}})}async getClusterChildren(e){return(await this.actorPromise).sendAsync({type:"GCC",data:{type:this.type,clusterId:e,source:this.id}})}async getClusterLeaves(e,t,i){return(await this.actorPromise).sendAsync({type:"GCL",data:{type:this.type,source:this.id,clusterId:e,limit:t,offset:i}})}async _updateWorkerData(){if(this._isUpdatingWorker)return this._updatePromise;if(!this._hasPendingWorkerUpdate())return void yh(`No pending worker updates for GeoJSONSource ${this.id}.`);let{data:e,diff:t,updateCluster:i}=this._pendingWorkerUpdate,n=this._getLoadGeoJSONParameters(e,t,i);void 0===e?t?this._pendingWorkerUpdate.diff=void 0:i&&(this._pendingWorkerUpdate.updateCluster=void 0):this._pendingWorkerUpdate.data=void 0,this._updatePromise=this._dispatchWorkerUpdate(n),await this._updatePromise}async _getLoadGeoJSONParameters(e,t,i){let n=lh({type:this.type,source:this.id},this.workerOptions);return"string"==typeof e?(n.request=await this.map._requestManager.transformRequest($M.resolveURL(e),"Source"),n.request.collectResourceTiming=this._collectResourceTiming,n):void 0!==e?(n.data=e,n):t?(n.dataDiff=t,n):i?(n.updateCluster=!0,n):void 0}async _dispatchWorkerUpdate(e){this._isUpdatingWorker=!0,this.fire(new cC("dataloading"));try{let t=await e,i=await(await this.actorPromise).sendAsync({type:"LD",data:t});if(this._isUpdatingWorker=!1,this._removed||i.abandoned)return void this.fire(new cC("dataabort"));i.data&&(this._data={geojson:i.data});let n=this._applyDiffToSource(t.dataDiff),a=this._getShouldReloadTileOptions(n),r={};this._applyResourceTiming(r,i),this.fire(new cC("data",{...r,sourceDataType:"metadata"})),this.fire(new cC("data",{...r,sourceDataType:"content",shouldReloadTileOptions:a}))}catch(e){if(this._isUpdatingWorker=!1,this._removed)return void this.fire(new cC("dataabort"));this.fire(new td(ju(e)))}finally{this._hasPendingWorkerUpdate()&&await this._updateWorkerData()}}_applyResourceTiming(e,t){if(!this._collectResourceTiming)return;let i=t.resourceTiming?.[this.id];if(!i)return;let n=i.slice(0);n?.length&&lh(e,{resourceTiming:n})}_applyDiffToSource(e){if(!e)return;let t="string"==typeof this.promoteId?this.promoteId:void 0;if(!this._data.url&&!this._data.updateable){let e=function(e,t){let i=new Map;if(null==e||null==e.type)return i;if("Feature"===e.type){let n=yT(e,t);return null==n?void 0:(i.set(n,e),i)}if("FeatureCollection"===e.type){let n=new Set;for(let a of e.features){let e=yT(a,t);if(null==e||n.has(e))return;n.add(e),i.set(e,a)}return i}}(this._data.geojson,t);if(!e)throw Error(`GeoJSONSource "${this.id}": GeoJSON data is not compatible with updateData`);this._data={updateable:e}}if(!this._data.updateable)return;let i=function(e,t,i){let n=[];if(t.removeAll)e.clear();else if(t.remove)for(let i of t.remove){let t=e.get(i);t&&(n.push(t.geometry),e.delete(i))}if(t.add)for(let a of t.add){let t=yT(a,i);if(null==t)continue;let r=e.get(t);r&&n.push(r.geometry),n.push(a.geometry),e.set(t,a)}if(t.update)for(let i of t.update){let t=e.get(i.id);if(!t)continue;let a=!!i.newGeometry,r=i.removeAllProperties||i.removeProperties?.length>0||i.addOrUpdateProperties?.length>0;if(!a&&!r)continue;n.push(t.geometry);let s={...t};if(e.set(i.id,s),a&&(n.push(i.newGeometry),s.geometry=i.newGeometry),r){if(s.properties=i.removeAllProperties?{}:{...s.properties||{}},i.removeProperties)for(let e of i.removeProperties)delete s.properties[e];if(i.addOrUpdateProperties)for(let{key:e,value:t}of i.addOrUpdateProperties)s.properties[e]=t}}return n}(this._data.updateable,e,t);return e.removeAll||this._options.cluster?void 0:i}_getShouldReloadTileOptions(e){if(e)return{affectedBounds:e.filter(Boolean).map(e=>ST(e))}}shouldReloadTile(e,{affectedBounds:t}){if("loading"===e.state)return!0;if("unloaded"===e.state)return!1;let{buffer:i,extent:n}=this.workerOptions.geojsonVtOptions,a=function({x:e,y:t,z:i},n=0){let a=Dx((e-n)/2**i),r=Px((t+1+n)/2**i),s=Dx((e+1+n)/2**i),o=Px((t-n)/2**i);return new gT([a,r],[s,o])}(e.tileID.canonical,i/n);for(let e of t)if(a.intersects(e))return!0;return!1}loaded(){return!this._isUpdatingWorker&&!this._hasPendingWorkerUpdate()}async loadTile(e){let t=e.actor?"RT":"LT";e.actor=await this.actorPromise;let i={type:this.type,uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity};e.abortController=new AbortController;try{let n=await(await this.actorPromise).sendAsync({type:t,data:i},e.abortController);delete e.abortController,e.unloadVectorData(),e.aborted||e.loadVectorData(n,this.map.painter,"RT"===t)}catch(t){if(delete e.abortController,e.aborted||Nh(t))return;throw t}}async abortTile(e){e.abortController&&(e.abortController.abort(),delete e.abortController),e.aborted=!0}async unloadTile(e){e.unloadVectorData(),await(await this.actorPromise).sendAsync({type:"RMT",data:{uid:e.uid,type:this.type,source:this.id}})}onRemove(){this._removed=!0,this.actorPromise.then(e=>e.sendAsync({type:"RS",data:{type:this.type,source:this.id}}))}serialize(){return lh({},this._options,{type:this.type,data:this._data.updateable?{type:"FeatureCollection",features:Array.from(this._data.updateable.values())}:this._data.url||this._data.geojson})}hasTransition(){return!1}};const CT=[0,0,1],TT=(e,t,i,n,a,r)=>({u_tl_parent:e,u_scale_parent:t,u_buffer_scale:1,u_image_warp:r,u_fade_t:i.mix,u_opacity:i.opacity*n.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:n.paint.get("raster-brightness-min"),u_brightness_high:n.paint.get("raster-brightness-max"),u_saturation_factor:IT(n.paint.get("raster-saturation")),u_contrast_factor:PT(n.paint.get("raster-contrast")),u_spin_weights:DT(n.paint.get("raster-hue-rotate")),u_coords_top:[a[0].x,a[0].y,a[1].x,a[1].y],u_coords_bottom:[a[3].x,a[3].y,a[2].x,a[2].y]});function DT(e){e*=Math.PI/180;let t=Math.sin(e),i=Math.cos(e);return[(2*i+1)/3,(-Math.sqrt(3)*t-i+1)/3,(Math.sqrt(3)*t-i+1)/3]}function PT(e){return e>0?1/(1-e):1+e}function IT(e){return e>0?1-1/(1.001-e):-e}var FT=class{constructor(e,t,i){this.vertexBuffer=e,this.indexBuffer=t,this.segments=i}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}};const zT=xA([{name:"a_pos",type:"Int16",components:2}]);function RT(e,t){let i=function(e,t){let i=void 0===e.granularity?1:Math.max(e.granularity,1),n=i+(e.generateBorders?2:0),a=i+(e.extendToNorthPole||e.generateBorders?1:0)+(e.extendToSouthPole||e.generateBorders?1:0),r=n+1,s=a+1,o=e.generateBorders?-1:0,l=e.generateBorders||e.extendToNorthPole?-1:0,c=i+ +!!e.generateBorders,u=i+(e.generateBorders||e.extendToSouthPole?1:0),h=r*s,d=n*a*6,p=r*s>65536;if(p&&"16bit"===t)throw Error("Granularity is too large and meshes would not fit inside 16 bit vertex indices.");let m=p||"32bit"===t,g=new Int16Array(2*h),f=0;for(let t=l;t<=u;t++)for(let n=o;n<=c;n++){let a=n/i*Uu;-1===n&&(a=-64),n===i+1&&(a=8256);let r=t/i*Uu;-1===t&&(r=e.extendToNorthPole?Yy:-64),t===i+1&&(r=e.extendToSouthPole?Jy:8256),g[f++]=a,g[f++]=r}let A=m?new Uint32Array(d):new Uint16Array(d),_=0;for(let e=0;e<a;e++)for(let t=0;t<n;t++){let i=t+e*r,n=t+1+e*r,a=t+(e+1)*r,s=t+1+(e+1)*r;A[_++]=i,A[_++]=a,A[_++]=n,A[_++]=n,A[_++]=a,A[_++]=s}return{vertices:g.buffer.slice(0),indices:A.buffer.slice(0),uses32bitIndices:m}}(t,"16bit"),n=r_.deserialize({arrayBuffer:i.vertices,length:i.vertices.byteLength/2/2}),a=b_.deserialize({arrayBuffer:i.indices,length:i.indices.byteLength/2/3});return new FT(e.createVertexBuffer(n,zT.members),e.createIndexBuffer(a),S_.simpleSegment(0,0,n.length,a.length))}var LT=class extends id{constructor(e,t,i,n){super(),this.imageWarp=CT,this.flippedWindingOrder=!1,this._warp="auto",this._imageDirty=!1,this._subdividedQuad=!1,this._subdividedMesh=null,this.id=e,this.dispatcher=i,this.coordinates=t.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(n),this.options=t}async load(e){if(void 0===this.options.url)return this._loaded=!0,void this._finishLoading();this._loaded=!1,this.fire(new cC("dataloading")),this.url=this.options.url,this._abortController=new AbortController;try{let t=await nC.transformAndGetImage(this.map._requestManager,this.url,"Image",this._abortController);this._abortController=null,this._loaded=!0,t?.data?(this._setImage(t.data),e&&(this.coordinates=e),this._finishLoading()):this.fire(new td(Error(`Could not load image ${this.url}: the response is empty`)))}catch(e){if(Nh(e))return;this._abortController=null,this._loaded=!0,this.fire(new td(ju(e)))}}loaded(){return this._loaded}updateImage(e){return this._abortController&&=(this._abortController.abort(),null),"image"in e?(this._loaded=!0,this._setImage(e.image),e.coordinates&&(this.coordinates=e.coordinates),this._finishLoading(),this):e.url?(this.options.url=e.url,this.load(e.coordinates),this):this}_setImage(e){this.image=e,this._imageDirty=!0}getMesh(e,t){return!this._subdividedQuad||t?null:(this._subdividedMesh??=RT(e,{granularity:16}),this._subdividedMesh)}_disposeTexture(){this.texture?.destroy(),this.texture=null}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new cC("data",{sourceDataType:"metadata"})))}onAdd(e){this.map=e,this.load()}onRemove(){this._abortController&&=(this._abortController.abort(),null),this._disposeTexture(),this._subdividedMesh?.destroy(),this._subdividedMesh=null,this.image=null,this.tiles={}}setWarp(e){return this._warp===e||(this._warp=e,this.tileCoords&&this.setCoordinates(this.coordinates)),this}getWarp(){return this._warp}setCoordinates(e){this.coordinates=e;let t=e.map(Fx.fromLngLat);return this.tileID=function(e){let t=px.fromPoints(e),i=t.width(),n=t.height(),a=Math.max(0,Math.floor(-Math.log(Math.max(i,n))/Math.LN2)),r=2**a;return new qE(a,Math.floor((t.minX+t.maxX)/2*r),Math.floor((t.minY+t.maxY)/2*r))}(t),this.terrainTileRanges=this._getOverlappingTileRanges(t),this.minzoom=this.maxzoom=this.tileID.z,this.tileCoords=t.map(e=>this.tileID.getTilePoint(e)._round()),this.imageWarp=function(e,t){if("flat"===t||BT(e))return CT;let[i,n,a,r]=e,s=i.x-n.x+a.x-r.x,o=i.y-n.y+a.y-r.y,l=[n.x-a.x,n.y-a.y,r.x-a.x,r.y-a.y],[c,u,h,d]=l,p=function(e){return e[0]*e[3]-e[2]*e[1]}(l),m=(s*d-h*o)/p,g=(c*o-s*u)/p,f=[1,1+m,1+m+g,1+g],A=Math.max(...f)/Math.min(...f),_="perspective"===t?0:function(e){let t=(1-4/e)/(1-4/512);return Math.max(0,t)}(A);return!(A>=1&&A<=512)||_>=1?CT:[m,g,_]}(this.tileCoords,this._warp),this._subdividedQuad=this.imageWarp[2]>0&&!BT(this.tileCoords),this.flippedWindingOrder=function(e){let t=e[1].x-e[0].x,i=e[1].y-e[0].y,n=e[2].x-e[0].x;return t*(e[2].y-e[0].y)-i*n<0}(this.tileCoords),this.fire(new cC("data",{sourceDataType:"content"})),this}prepare(){if(0===Object.keys(this.tiles).length||!this.image)return;let e=this.map.painter.context,t=e.gl;this.texture?this._imageDirty&&(this.texture.update(this.image),this.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE)):(this.texture=new iy(e,this.image,t.RGBA),this.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE)),this._imageDirty=!1;let i=!1;for(let e in this.tiles){let t=this.tiles[e];"loaded"!==t.state&&(t.state="loaded",t.texture=this.texture,i=!0)}i&&this.fire(new cC("data",{sourceDataType:"idle",sourceId:this.id}))}async loadTile(e){this.tileID?.equals(e.tileID.canonical)?(this.tiles[String(e.tileID.wrap)]=e,e.buckets={}):e.state="errored"}serialize(){let e={type:"image",coordinates:this.coordinates};return void 0!==this.options.url&&(e.url=this.options.url),e}hasTransition(){return!1}_getOverlappingTileRanges(e){let{minX:t,minY:i,maxX:n,maxY:a}=px.fromPoints(e),r={};for(let e=0;e<=25;e++){let s=2**e,o=Math.floor(t*s),l=Math.floor(i*s),c=Math.floor(n*s),u=Math.floor(a*s),h=(o%s+s)%s,d=c%s,p=Math.floor(o/s),m=Math.floor(c/s);r[e]={minWrap:p,maxWrap:m,minTileXWrapped:h,maxTileXWrapped:d,minTileY:l,maxTileY:u}}return r}};function BT(e){let[t,i,n,a]=e;return t.x+n.x===i.x+a.x&&t.y+n.y===i.y+a.y}var OT=class extends LT{constructor(e,t,i,n){super(e,t,i,n),this._onPlayingHandler=()=>{this.map?.triggerRepaint()},this.roundZoom=!0,this.type="video",this.options=t}async load(){this._loaded=!1;let e=this.options;this.urls=[];for(let t of e.urls)this.urls.push((await this.map._requestManager.transformRequest(t,"Source")).url);try{let e=await(e=>{let t=window.document.createElement("video");return t.muted=!0,new Promise(i=>{t.onloadstart=()=>{i(t)};for(let i of e){let e=window.document.createElement("source");Yh(i)||(t.crossOrigin="Anonymous"),e.src=i,t.appendChild(e)}})})(this.urls);if(this._loaded=!0,!e)return;this.video=e,this.video.loop=!0,this.video.addEventListener("playing",this._onPlayingHandler),this.map&&this.video.play(),this._finishLoading()}catch(e){this.fire(new td(ju(e)))}}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(e){if(this.video){let t=this.video.seekable;e<t.start(0)||e>t.end(0)?this.fire(new td(new sd(`sources.${this.id}`,null,`Playback for this video can be set only between the ${t.start(0)} and ${t.end(0)}-second mark.`))):this.video.currentTime=e}}getVideo(){return this.video}onAdd(e){this.map||(this.map=e,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}onRemove(){super.onRemove(),this.video&&(this.video.removeEventListener("playing",this._onPlayingHandler),this.video.pause())}prepare(){if(0===Object.keys(this.tiles).length||this.video.readyState<2)return;let e=this.map.painter.context,t=e.gl;this.texture?this.video.paused||(this.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE),t.texSubImage2D(t.TEXTURE_2D,0,0,0,t.RGBA,t.UNSIGNED_BYTE,this.video)):(this.texture=new iy(e,this.video,t.RGBA),this.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE));let i=!1;for(let e in this.tiles){let t=this.tiles[e];"loaded"!==t.state&&(t.state="loaded",t.texture=this.texture,i=!0)}i&&this.fire(new cC("data",{sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}},UT=class extends LT{constructor(e,t,i,n){super(e,t,i,n),t.coordinates?(!Array.isArray(t.coordinates)||4!==t.coordinates.length||t.coordinates.some(e=>!Array.isArray(e)||2!==e.length||e.some(e=>"number"!=typeof e)))&&this.fire(new td(new sd(`sources.${e}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new td(new sd(`sources.${e}`,null,'missing required property "coordinates"'))),t.animate&&"boolean"!=typeof t.animate&&this.fire(new td(new sd(`sources.${e}`,null,'optional "animate" property must be a boolean value'))),t.canvas?"string"!=typeof t.canvas&&!(t.canvas instanceof HTMLCanvasElement)&&this.fire(new td(new sd(`sources.${e}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new td(new sd(`sources.${e}`,null,'missing required property "canvas"'))),this.options=t,this.animate=void 0===t.animate||t.animate}async load(){this._loaded=!0,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 td(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(),!1)},this._finishLoading())}getCanvas(){return this.canvas}onAdd(e){this.map=e,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this._playing=!1,super.onRemove()}prepare(){let e=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,e=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,e=!0),this._hasInvalidDimensions()||0===Object.keys(this.tiles).length)return;let t=this.map.painter.context,i=t.gl;this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):(this.texture=new iy(t,this.canvas,i.RGBA,{premultiply:!0}),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE));let n=!1;for(let e in this.tiles){let t=this.tiles[e];"loaded"!==t.state&&(t.state="loaded",t.texture=this.texture,n=!0)}n&&this.fire(new cC("data",{sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",animate:this.animate,canvas:this.options.canvas,coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(let e of[this.canvas.width,this.canvas.height])if(isNaN(e)||e<=0)return!0;return!1}};const NT={},jT=e=>{switch(e){case"geojson":return MT;case"image":return LT;case"raster":return _T;case"raster-dem":return vT;case"vector":return AT;case"video":return OT;case"canvas":return UT}return NT[e]};const VT="RTLPluginLoaded";var qT=class extends id{constructor(...e){super(...e),this.status="unavailable",this.url=null,this.dispatcher=(lT||(lT=new oT(sT(),Hh),lT.registerMessageHandler("GR",(e,t,i)=>Kh(t,i))),lT)}_syncState(e){return this.status=e,this.dispatcher.broadcast("SRPS",{pluginStatus:e,pluginURL:this.url}).catch(e=>{throw this.status="error",e})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}async setRTLTextPlugin(e,t=!1){if(this.url)throw Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=$M.resolveURL(e),!this.url)throw Error(`requested url ${e} is invalid`);if("unavailable"===this.status){if(!t)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if("requested"===this.status)return this._requestImport()}async _requestImport(){await this._syncState("loading"),this.status="loaded",this.fire(new ed(VT))}lazyLoad(){"unavailable"===this.status?this.status="requested":"deferred"===this.status&&this._requestImport()}};let GT=null;function HT(){return GT||=new qT,GT}var WT=class{constructor(e,t){this.timeAdded=0,this.fadeEndTime=0,this.fadeOpacity=1,this.tileID=e,this.uid=hh(),this.uses=0,this.tileSize=t,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rttObjects=[],this.rttFingerprint={},this.expiredRequestCount=0,this.state="loading",this.featureStateRevision=-1}isRenderable(e){return this.hasData()&&(!this.fadeEndTime||this.fadeOpacity>0)&&(e||!this.holdingForSymbolFade())}setCrossFadeLogic({fadingRole:e,fadingDirection:t,fadingParentID:i,fadeEndTime:n}){this.resetFadeLogic(),this.fadingRole=e,this.fadingDirection=t,this.fadingParentID=i,this.fadeEndTime=n}setSelfFadeLogic(e){this.resetFadeLogic(),this.selfFading=!0,this.fadeEndTime=e}resetFadeLogic(){this.fadingRole=null,this.fadingDirection=null,this.fadingParentID=null,this.selfFading=!1,this.timeAdded=tC(),this.fadeEndTime=0,this.fadeOpacity=1}wasRequested(){return"errored"===this.state||"loaded"===this.state||"reloading"===this.state}clearTextures(e){this.demTexture&&e.saveTileTexture(this.demTexture),this.demTexture=null}getRTT(e){return this.rttObjects[e]}acquireRTT(e,t,i){return this.rttObjects[t]=e.acquireRTT(i)}releaseRTT(e){if(0!==this.rttObjects.length){for(let t of this.rttObjects)t&&e.releaseRTT(t);this.rttObjects.length=0}}loadVectorData(e,t,i){if(!0!==e?.etagUnmodified)if(this.hasData()&&this.unloadVectorData(),this.state="loaded",e){e.featureIndex&&(this.latestFeatureIndex=e.featureIndex,e.rawTileData?(this.latestRawTileData=e.rawTileData,this.latestEncoding=e.encoding,this.latestFeatureIndex.rawTileData=e.rawTileData,this.latestFeatureIndex.encoding=e.encoding):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData,this.latestFeatureIndex.encoding=this.latestEncoding)),this.collisionBoxArray=e.collisionBoxArray,this.buckets=function(e,t){let i={};if(!t)return i;for(let n of e){let e=n.layerIds.map(e=>t.getLayer(e)).filter(Boolean);if(0!==e.length){n.layers=e,n.stateDependentLayerIds&&(n.stateDependentLayers=n.stateDependentLayerIds.map(t=>e.filter(e=>e.id===t)[0]));for(let t of e)i[t.id]=n}}return i}(e.buckets,t?.style),this.hasSymbolBuckets=!1;for(let e in this.buckets){let t=this.buckets[e];if(t instanceof ME){if(this.hasSymbolBuckets=!0,!i)break;t.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(let e in this.buckets){let t=this.buckets[e];if(t instanceof ME&&t.hasRTLText){this.hasRTLText=!0,HT().lazyLoad();break}}this.queryPadding=0;for(let e in this.buckets){let i=this.buckets[e];this.queryPadding=Math.max(this.queryPadding,t.style.getLayer(e).queryRadius(i))}e.imageAtlas&&(this.imageAtlas=e.imageAtlas),e.glyphAtlasImage&&(this.glyphAtlasImage=e.glyphAtlasImage),this.dashPositions=e.dashPositions}else this.collisionBoxArray=new KA;else this.state="loaded"}unloadVectorData(){for(let e in this.buckets)this.buckets[e].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.imageAtlas=null,this.dashPositions=null,this.latestFeatureIndex=null,this.state="unloaded"}getBucket(e){return this.buckets[e.id]}upload(e){for(let t in this.buckets){let i=this.buckets[t];i.uploadPending()&&i.upload(e)}let t=e.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new iy(e,this.imageAtlas.image,t.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&=(this.glyphAtlasTexture=new iy(e,this.glyphAtlasImage,t.ALPHA),null)}prepare(e){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(e,this.imageAtlasTexture)}queryRenderedFeatures(e,t,i,n,a,r,s,o,l,c,u){return this.latestFeatureIndex?.rawTileData?this.latestFeatureIndex.query({queryGeometry:n,cameraQueryGeometry:a,scale:r,tileSize:this.tileSize,pixelPosMatrix:c,transform:o,params:s,queryPadding:this.queryPadding*l,getElevation:u},e,t,i):{}}querySourceFeatures(e,t){let i=this.latestFeatureIndex;if(!i?.rawTileData)return;let n=i.loadVTLayers(),a=t?.sourceLayer?t.sourceLayer:"",r=n._geojsonTileLayer||n[a];if(!r)return;let s=Og(t?.filter,`querySourceFeatures[${a}].filter`,t?.globalState),{z:o,x:l,y:c}=this.tileID.canonical,u={z:o,x:l,y:c};for(let t=0;t<r.length;t++){let n=r.feature(t);if(s.needGeometry){let e=cv(n,!0);if(!s.filter(new Zf(this.tileID.overscaledZ),e,this.tileID.canonical))continue}else if(!s.filter(new Zf(this.tileID.overscaledZ),n))continue;let h=i.getId(n,a),d=new JE(n,o,l,c,h);d.tile=u,e.push(d)}}hasData(){return"loaded"===this.state||"reloading"===this.state||"expired"===this.state}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(e){let t=this.expirationTime;if(e.cacheControl){let t=function(e){let t={};if(e.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(e,i,n,a)=>{let r=n||a;return t[i]=!r||r.toLowerCase(),""}),t["max-age"]){let e=parseInt(t["max-age"],10);isNaN(e)?delete t["max-age"]:t["max-age"]=e}return t}(e.cacheControl);t["max-age"]&&(this.expirationTime=Date.now()+1e3*t["max-age"])}else e.expires&&(this.expirationTime=new Date(e.expires).getTime());if(this.expirationTime){let e=Date.now(),i=!1;if(this.expirationTime>e)i=!1;else if(t)if(this.expirationTime<t)i=!0;else{let n=this.expirationTime-t;n?this.expirationTime=e+Math.max(n,3e4):i=!0}else i=!0;i?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-(new Date).getTime(),2**31-1)}setFeatureState(e,t,i){if(!this.latestFeatureIndex?.rawTileData||0===Object.keys(e).length||this.featureStateRevision===i)return;this.featureStateRevision=i;let n=this.latestFeatureIndex.loadVTLayers();for(let i in this.buckets){if(!t.style.hasLayer(i))continue;let a=this.buckets[i],r=a.layers[0].sourceLayer||"_geojsonTileLayer",s=n[r],o=e[r];if(!s||!o||0===o.length)continue;a.update(o,s,this.imageAtlas?.patternPositions||{},this.dashPositions||{});let l=t?.style?.getLayer(i);l&&(this.queryPadding=Math.max(this.queryPadding,l.queryRadius(a)))}}holdingForSymbolFade(){return void 0!==this.symbolFadeHoldUntil}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<tC()}clearSymbolFadeHold(){this.symbolFadeHoldUntil=void 0}setSymbolHoldDuration(e){this.symbolFadeHoldUntil=tC()+e}setDependencies(e,t){let i={};for(let e of t)i[e]=!0;this.dependencies[e]=i}hasDependency(e,t){for(let i of e){let e=this.dependencies[i];if(e)for(let i of t)if(e[i])return!0}return!1}};function ZT(e){let t=[];for(let i in e)t.push({id:i,state:e[i]});return t}var KT=class{constructor(){this.state={},this.stateChanges={},this.deletedStates={},this.revision=0}updateState(e,t,i){let n=String(t);if(this.stateChanges[e]||={},this.stateChanges[e][n]||={},lh(this.stateChanges[e][n],i),null===this.deletedStates[e]){this.deletedStates[e]={};for(let t in this.state[e])if(t===n){this.deletedStates[e][n]={};for(let a in this.state[e][t])void 0===i[a]&&(this.deletedStates[e][n][a]=null)}else this.deletedStates[e][t]=null}else if(null===this.deletedStates[e]?.[n]){this.deletedStates[e][n]={};for(let t in this.state[e][n])void 0===i[t]&&(this.deletedStates[e][n][t]=null)}else for(let t in i)null===this.deletedStates[e]?.[n]?.[t]&&delete this.deletedStates[e][n][t]}removeFeatureState(e,t,i){if(null===this.deletedStates[e])return;let n=String(t);if(this.deletedStates[e]||={},i&&void 0!==t)null!==this.deletedStates[e][n]&&(this.deletedStates[e][n]||={},this.deletedStates[e][n][i]=null);else if(void 0!==t)if(this.stateChanges[e]?.[n])for(i in this.deletedStates[e][n]={},this.stateChanges[e][n])this.deletedStates[e][n][i]=null;else this.deletedStates[e][n]=null;else this.deletedStates[e]=null}getState(e,t){let i=String(t),n=this.state[e]||{},a=this.stateChanges[e]||{},r=lh({},n[i],a[i]);if(null===this.deletedStates[e])return{};if(this.deletedStates[e]){let i=this.deletedStates[e][t];if(null===i)return{};for(let e in i)delete r[e]}return r}initializeTileState(e,t){let i={};for(let e in this.state)i[e]=ZT(this.state[e]);e.setFeatureState(i,t,this.revision)}coalesceChanges(e,t){let i={};for(let e in this.stateChanges){this.state[e]||={},i[e]||={};for(let t in this.stateChanges[e])this.state[e][t]||={},lh(this.state[e][t],this.stateChanges[e][t]),i[e][t]=this.state[e][t]}for(let e in this.deletedStates)if(this.state[e]||={},i[e]||={},null===this.deletedStates[e])for(let t in this.state[e])this.state[e][t]={},i[e][t]={};else for(let t in this.deletedStates[e]){if(null===this.deletedStates[e][t])this.state[e][t]={};else for(let i of Object.keys(this.deletedStates[e][t]))delete this.state[e][t][i];i[e][t]=this.state[e][t]}if(this.stateChanges={},this.deletedStates={},0===Object.keys(i).length)return;this.revision++;let n={};for(let e in i)n[e]=ZT(i[e]);e.setFeatureState(n,t,this.revision)}},XT=class e{constructor(e,t){this.min=e,this.max=t,this.center=fu([],mu([],this.min,this.max),.5)}quadrant(t){let i=[t%2==0,t<2],n=hu(this.min),a=hu(this.max);for(let e=0;e<i.length;e++)n[e]=i[e]?this.min[e]:this.center[e],a[e]=i[e]?this.center[e]:this.max[e];return a[2]=this.max[2],new e(n,a)}distanceX(e){return Math.max(Math.min(this.max[0],e[0]),this.min[0])-e[0]}distanceY(e){return Math.max(Math.min(this.max[1],e[1]),this.min[1])-e[1]}intersectsFrustum(e){let t=!0;for(let i of e.planes){let e=this.intersectsPlane(i);if(0===e)return 0;1===e&&(t=!1)}return t?2:e.aabb.min[0]>this.max[0]||e.aabb.min[1]>this.max[1]||e.aabb.min[2]>this.max[2]||e.aabb.max[0]<this.min[0]||e.aabb.max[1]<this.min[1]||e.aabb.max[2]<this.min[2]?0:1}intersectsPlane(e){let t=e[3],i=e[3];for(let n=0;n<3;n++)e[n]>0?(t+=e[n]*this.min[n],i+=e[n]*this.max[n]):(i+=e[n]*this.min[n],t+=e[n]*this.max[n]);return t>=0?2:i<0?0:1}},QT=class e{constructor(e,t,i){this.points=e,this.planes=t,this.aabb=i}static fromInvProjectionMatrix(t,i=1,n=0,a,r){let s=r?[[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]],o=2**n,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(e=>function(e,t,i,n){let a=Mu([],e,t),r=1/a[3]/i*n;return Cu(a,a,[r,r,1/a[3],r])}(e,t,i,o));a&&function(e,t,i,n){let a=n?4:0,r=n?0:4,s=0,o=[],l=[];for(let t=0;t<4;t++){let i=ku([],e[t+r],e[t+a]),n=du(i);fu(i,i,1/n),o.push(n),l.push(i)}for(let t=0;t<4;t++){let n=Qu(e[t+a],l[t],i);s=null!==n&&n>=0?Math.max(s,n):Math.max(s,o[t])}let c=function(e,t){let i=ku([],e[t[0]],e[t[1]]),n=ku([],e[t[2]],e[t[1]]),a=[0,0,0,0];return _u(a,yu([],i,n)),a[3]=-vu(a,e[t[0]]),a}(e,t),u=function(e,t){let i=Su(e),n=function(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e[3]=t[3]*i,e}([],e,1/i),a=ku([],t,fu([],n,vu(t,n))),r=Su(a);if(r>0){let e=Math.sqrt(1-n[3]*n[3]);return Ku(t,mu([],fu([],n,-n[3]),fu([],a,e/r)))}return null}(i,c);if(null!==u){let e=u/vu(l[0],c);s=Math.min(s,e)}for(let t=0;t<4;t++){let i=Math.min(s,o[t]);e[t+r]=[e[t+a][0]+l[t][0]*i,e[t+a][1]+l[t][1]*i,e[t+a][2]+l[t][2]*i,1]}}(l,s[0],a,r);let c=s.map(e=>{let t=_u([],yu([],ku([],l[e[0]],l[e[1]]),ku([],l[e[2]],l[e[1]]))),i=-vu(t,l[e[1]]);return t.concat(i)}),u=[1/0,1/0,1/0],h=[-1/0,-1/0,-1/0];for(let e of l)for(let t=0;t<3;t++)u[t]=Math.min(u[t],e[t]),h[t]=Math.max(h[t],e[t]);return new e(l,c,new XT(u,h))}};function YT(e,t,i){let n=t.intersectsFrustum(e);if(!i||0===n)return n;let a=t.intersectsPlane(i);return 0===a?0:2===n&&2===a?2:1}function JT(e,t,i){let n=0,a=(i-t)/10;for(let r=0;r<10;r++){let s=t+(r+.5)/10*(i-t);n+=a*Math.cos(s)**+e}return n}function $T(e,t){return function(i,n,a,r,s){let o=2*((e-1)/ph(Math.cos(Mh(zx-s))/Math.cos(Mh(zx)))-1),l=Math.acos(a/r),c=2*JT(o-1,0,Mh(s/2)),u=Math.min(Mh(zx),l+Mh(s/2)),h=JT(o-1,Math.min(u,l-Mh(s/2)),u),d=Math.atan(n/a),p=i;return p+=ph(r/Math.hypot(n,a)/Math.max(.5,Math.cos(Mh(s/2)))),p+=o*ph(Math.cos(d))/2,p-=ph(Math.max(1,h/c/t))/2,p}}const eD=$T(9.314,3);function tD(e,t){let i=(t.roundZoom?Math.round:Math.floor)(e.zoom+ph(e.tileSize/t.tileSize));return Math.max(0,i)}function iD(e,t){let i=e.getCameraFrustum(),n=e.getClippingPlane();if(n&&t.maxContentElevation>0){let a=Math.hypot(n[0],n[1],n[2]);if(a>0){let r=1+t.maxContentElevation/wx,s=sh(-n[3]/a,-1,1),o=Math.cos(Math.acos(s)+Math.acos(1/r));n=[n[0],n[1],n[2],-o*a],i=function(e,t,i){let n=e.planes[1],a=e.points.map(e=>{let a=n[0]*e[0]+n[1]*e[1]+n[2]*e[2]+n[3];if(Math.abs(a)>1e-6)return e;let r=[e[0]-i[0],e[1]-i[1],e[2]-i[2]],s=n[0]*r[0]+n[1]*r[1]+n[2]*r[2];if(s>=-1e-9)return e;let o=t/-s;return[e[0]+r[0]*o,e[1]+r[1]*o,e[2]+r[2]*o,e[3]]}),r=e.planes.map((e,i)=>1===i?[e[0],e[1],e[2],e[3]+t]:e),s=[1/0,1/0,1/0],o=[-1/0,-1/0,-1/0];for(let e of a)for(let t=0;t<3;t++)s[t]=Math.min(s[t],e[t]),o[t]=Math.max(o[t],e[t]);return new QT(a,r,new XT(s,o))}(i,Math.sqrt(r*r-1),e.cameraPosition)}}let a=function(e){let t=Tx(1,e.center.lat)*e.worldSize;return Nx(e.center,e.elevation,e.pitch,e.bearing,e.cameraToCenterDistance/t)}(e),r=Fx.fromLngLat(e.center,e.elevation),s=function(e,t){let i=sh((15-(zx-e.pitch-e.fov/2))/15,0,1),n=Math.max(500,t??0);return e.elevation+i*n}(e,t.maxContentElevation),o=e.getCoveringTilesDetailsProvider(),l=o.allowVariableZoom(e,t),c=tD(e,t),u=t.minzoom||0,h=void 0===t.maxzoom?e.maxZoom:t.maxzoom,d=Math.min(Math.max(0,c),h),p=2**d,m=[p*a.x,p*a.y,0],g=[p*r.x,p*r.y,0],f=Math.hypot(r.x-a.x,r.y-a.y),A=Math.abs(r.z-a.z),_=Math.hypot(f,A),v=e=>({zoom:0,x:0,y:0,wrap:e,fullyVisible:!1}),y=[],x=[];if(e.renderWorldCopies&&o.allowWorldCopies())for(let e=1;e<=3;e++)y.push(v(-e)),y.push(v(e));for(y.push(v(0));y.length>0;){let p=y.pop(),f=p.x,v=p.y,b=p.fullyVisible,w={x:f,y:v,z:p.zoom},E=o.getTileBoundingVolume(w,p.wrap,s,t);if(!b){let e=YT(i,E,n);if(0===e)continue;b=2===e}let k=o.distanceToTile2d(a.x,a.y,w,E),S=c;l&&(S=(t.calculateTileZoom||eD)(e.zoom+ph(e.tileSize/t.tileSize),k,A,_,e.fov)),S=(t.roundZoom?Math.round:Math.floor)(S),S=Math.max(0,S);let M=Math.min(S,h);if(p.wrap=o.getWrap(r,w,p.wrap),p.zoom>=M){if(p.zoom<u)continue;let e=d-p.zoom,i=m[0]-.5-(f<<e),n=m[1]-.5-(v<<e),a=t.reparseOverscaled?Math.max(p.zoom,S):p.zoom;x.push({tileID:new HE(p.zoom===h?a:p.zoom,p.wrap,p.zoom,f,v),distanceSq:Ou([g[0]-.5-f,g[1]-.5-v]),tileDistanceToCamera:Math.sqrt(i*i+n*n)});continue}for(let e=0;e<4;e++){let t=(f<<1)+e%2,i=(v<<1)+(e>>1),n=p.zoom+1;y.push({zoom:n,x:t,y:i,wrap:p.wrap,fullyVisible:b})}}return x.sort((e,t)=>e.distanceSq-t.distanceSq).map(e=>e.tileID)}function nD(e){return"raster"===e||"image"===e||"video"===e}function aD(e,t,i,n,a,r,s){let o=tC(),l=function(e){if(!e.length)return new Set;let t=Math.max(...e.map(e=>e.canonical.z)),i=1/0,n=-1/0,a=1/0,r=-1/0,s=[];for(let o of e){let{x:e,y:l,z:c}=o.canonical,u=2**(t-c),h=e*u,d=l*u;s.push({id:o,x:h,y:d}),h<i&&(i=h),h>n&&(n=h),d<a&&(a=d),d>r&&(r=d)}let o=new Set;for(let e of s)(e.x===i||e.x===n||e.y===a||e.y===r)&&o.add(e.id);return o}(t);for(let c of t){let t=e.getTileById(c.key);(0===t.fadingDirection||0===t.fadeOpacity)&&t.resetFadeLogic(),!rD(e,t,i,o,n,a,s)&&(sD(e,t,i,o,r,s)||lD(t,l,o,s)||t.resetFadeLogic())}}function rD(e,t,i,n,a,r,s){if(!t.hasData())return!1;let{tileID:o,fadingRole:l,fadingDirection:c,fadingParentID:u}=t;if(0===l&&1===c&&u)return i[u.key]=u,!0;let h=Math.max(o.overscaledZ-a,r);for(let a=o.overscaledZ-1;a>=h;a--){let r=o.scaledTo(a),l=e.getLoadedTile(r);if(l)return t.setCrossFadeLogic({fadingRole:0,fadingDirection:1,fadingParentID:l.tileID,fadeEndTime:n+s}),l.setCrossFadeLogic({fadingRole:1,fadingDirection:0,fadeEndTime:n+s}),i[r.key]=r,!0}return!1}function sD(e,t,i,n,a,r){if(!t.hasData())return!1;let s=t.tileID.children(a),o=oD(e,t,s,i,n,a,r);if(o)return!0;for(let l of s)oD(e,t,l.children(a),i,n,a,r)&&(o=!0);return o}function oD(e,t,i,n,a,r,s){if(i[0].overscaledZ>=r)return!1;let o=!1;for(let r of i){let i=e.getLoadedTile(r);if(!i)continue;let{fadingRole:l,fadingDirection:c,fadingParentID:u}=i;(0!==l||0!==c||!u)&&(i.setCrossFadeLogic({fadingRole:0,fadingDirection:0,fadingParentID:t.tileID,fadeEndTime:a+s}),t.setCrossFadeLogic({fadingRole:1,fadingDirection:1,fadeEndTime:a+s})),n[r.key]=r,o=!0}return o}function lD(e,t,i,n){let a=e.tileID;if(e.selfFading)return!0;if(e.hasData())return!1;if(t.has(a)){let t=i+n;return e.setSelfFadeLogic(t),!0}return!1}function cD(e,t){e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0,e.needsColorReliefPrepare=!0;let i=t.tileID.canonical.x-e.tileID.canonical.x,n=t.tileID.canonical.y-e.tileID.canonical.y,a=2**e.tileID.canonical.z,r=t.tileID.key;(0!==i||0!==n)&&(Math.abs(n)>1||(Math.abs(i)>1&&(1===Math.abs(i+a)?i+=a:1===Math.abs(i-a)&&(i-=a)),t.dem&&e.dem&&(e.dem.backfillBorder(t.dem,i,n),e.neighboringTiles?.[r]&&(e.neighboringTiles[r].backfilled=!0))))}var uD=class{constructor(){this._tiles={}}handleWrapJump(e){let t={};for(let i in this._tiles){let n=this._tiles[i];n.tileID=n.tileID.unwrapTo(n.tileID.wrap+e),t[n.tileID.key]=n}this._tiles=t}setFeatureState(e,t,i){for(let n in this._tiles)this._tiles[n].setFeatureState(e,t,i)}getAllTiles(){return Object.values(this._tiles)}getAllIds(e=!1){return e?Object.values(this._tiles).map(e=>e.tileID).sort(XE).map(e=>e.key):Object.keys(this._tiles)}getTileById(e){return this._tiles[e]}setTile(e,t){this._tiles[e]=t}deleteTileById(e){delete this._tiles[e]}getLoadedTile(e){let t=this.getTileById(e.key);return t?.hasData()?t:null}isIdRenderable(e,t=!1){return this.getTileById(e)?.isRenderable(t)}getRenderableIds(e=0,t){let i=[];for(let e of this.getAllIds())this.isIdRenderable(e,t)&&i.push(this.getTileById(e));return t?i.sort((t,i)=>{let n=t.tileID,a=i.tileID,r=new Hc(n.canonical.x,n.canonical.y)._rotate(-e),s=new Hc(a.canonical.x,a.canonical.y)._rotate(-e);return n.overscaledZ-a.overscaledZ||s.y-r.y||s.x-r.x}).map(e=>e.tileID.key):i.map(e=>e.tileID).sort(XE).map(e=>e.key)}},hD=class e extends id{static{this.maxUnderzooming=10}static{this.maxOverzooming=3}constructor(e,t,i){super(),this._maxContentElevationSeen=0,this.id=e,this.dispatcher=i,this.on("data",e=>{this._dataHandler(e)}),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((e,t,i,n)=>{let a=new(jT(t.type))(e,t,i,n);if(a.id!==e)throw Error(`Expected Source id to be ${e} instead of ${a.id}`);return a})(e,t,i,this),this._inViewTiles=new uD,this._outOfViewCache=new KM(0,e=>this._unloadTile(e)),this._timers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._rasterFadeDuration=0,this._maxFadingAncestorLevels=5,this._state=new KT,this._didEmitContent=!1,this._updated=!1}onAdd(e){this.map=e,this._maxTileCacheSize=e?e._maxTileCacheSize:null,this._maxTileCacheZoomLevels=e?e._maxTileCacheZoomLevels:null,this._source?.onAdd&&this._source.onAdd(e)}onRemove(e){for(let e of this._inViewTiles.getAllTiles())e.unloadVectorData();this.clearTiles(),this._source?.onRemove&&this._source.onRemove(e),this._inViewTiles=new uD}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!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(let e of this._inViewTiles.getAllTiles())if("loaded"!==e.state&&"errored"!==e.state)return!1;return!0}getSource(){return this._source}getState(){return this._state}pause(){this._paused=!0}resume(){if(!this._paused)return;let e=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,e&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}async _loadTile(e,t,i,n){try{let a=await this._source.loadTile(e);this._tileLoaded(e,t,i,n,a)}catch(t){e.state="errored",404===t.status?this.update(this.transform,this.terrain):this._source.fire(new td(ju(t),{tile:e}))}}_unloadTile(e){this._source.unloadTile&&this._source.unloadTile(e)}_abortTile(e){this._source.abortTile&&this._source.abortTile(e),this._source.fire(new cC("dataabort",{tile:e,coord:e.tileID}))}serialize(){return this._source.serialize()}prepare(e){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._inViewTiles,this.map?this.map.painter:null);for(let t of this._inViewTiles.getAllTiles())t.upload(e),t.prepare(this.map.style.imageManager)}getIds(){return this._inViewTiles.getAllIds(!0)}getRenderableIds(e){return this._inViewTiles.getRenderableIds(this.transform?.bearingInRadians,e)}hasRenderableParent(e){let t=e.overscaledZ-1;if(t>=this._source.minzoom){let i=this.getLoadedTile(e.scaledTo(t));if(i)return this._inViewTiles.isIdRenderable(i.tileID.key)}return!1}reload(e,t=void 0){if(this._paused)this._shouldReloadOnResume=!0;else{this._outOfViewCache.reset();for(let i of this._inViewTiles.getAllIds()){let n=this._inViewTiles.getTileById(i);(!t||this._source.shouldReloadTile(n,t))&&(e?this._reloadTile(i,"errored"===n.state?"loading":"expired"):"errored"!==n.state&&this._reloadTile(i,"reloading"))}}}async _reloadTile(e,t){let i=this._inViewTiles.getTileById(e);if(!i)return;let n=i.hasData();"loading"!==i.state&&(i.state=t),await this._loadTile(i,e,t,n)}_tileLoaded(e,t,i,n,a){n||(e.timeAdded=tC(),e.selfFading&&(e.fadeEndTime=e.timeAdded+this._rasterFadeDuration)),"expired"===i&&(e.refreshedUponExpiration=!0),this._setTileReloadTimer(t,e),!a?.unmodified&&("raster-dem"===this.getSource().type&&e.dem&&function(e,t){let i=t.getRenderableIds();for(let n of i){if(!e.neighboringTiles?.[n])continue;let i=t.getTileById(n);e.neighboringTiles[n].backfilled||cD(e,i),!i.neighboringTiles?.[e.tileID.key]?.backfilled&&cD(i,e)}}(e,this._inViewTiles),e.featureStateRevision=-1,this._state.initializeTileState(e,this.map?this.map.painter:null),e.aborted||this._source.fire(new cC("data",{tile:e,coord:e.tileID})))}getTile(e){return this.getTileByID(e.key)}getTileByID(e){return this._inViewTiles.getTileById(e)}_retainLoadedChildren(t,i){let n=this._getLoadedDescendents(i),a=new Set;for(let r of i){let i=n[r.key];if(!i?.length){a.add(r);continue}let s=r.overscaledZ+e.maxOverzooming,o=i.filter(e=>e.tileID.overscaledZ<=s);if(!o.length){a.add(r);continue}let l=Math.min(...o.map(e=>e.tileID.overscaledZ)),c=o.filter(e=>e.tileID.overscaledZ===l).map(e=>e.tileID);for(let e of c)t[e.key]=e;this._areDescendentsComplete(c,l,r.overscaledZ)||a.add(r)}return a}_getLoadedDescendents(e){let t={};for(let i of this._inViewTiles.getAllTiles().filter(e=>e.hasData()))for(let n of e)i.tileID.isChildOf(n)&&(t[n.key]||=[],t[n.key].push(i));return t}_areDescendentsComplete(e,t,i){return 1===e.length&&e[0].isOverscaled()?e[0].overscaledZ===t:4**(t-i)===e.length}getLoadedTile(e){return this._inViewTiles.getLoadedTile(e)}updateCacheSize(e){let t=(Math.ceil(e.width/this._source.tileSize)+1)*(Math.ceil(e.height/this._source.tileSize)+1),i=null===this._maxTileCacheZoomLevels?Vh.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels,n=Math.floor(t*i),a="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,n):n;this._outOfViewCache.setMaxSize(a)}handleWrapJump(e){let t=(e-(void 0===this._prevLng?e:this._prevLng))/360,i=Math.round(t);this._prevLng=e,i&&(this._inViewTiles.handleWrapJump(i),this._resetTileReloadTimers())}_updateMaxContentElevation(){let e=this._maxContentElevationSeen,t=this.map?.style?._layers;if(!t)return e;let i=this._inViewTiles.getAllTiles();for(let n in t){let a=t[n];if("symbol"!==a.type||a.source!==this.id||a.isHidden(this.transform.zoom))continue;let r=a;if(r.layout){e=Math.max(e,r.layout.get("symbol-height-offset").constantOr(0));for(let t of i){let i=t.getBucket(a);i&&i.maxHeightOffset>e&&(e=i.maxHeightOffset)}}}return this._maxContentElevationSeen=e,e}update(e,t){if(!this._sourceLoaded||this._paused)return;let i;this.transform=e,this.terrain=t,this.updateCacheSize(e),this.handleWrapJump(this.transform.center.lng),this.used||this.usedForTerrain?this._source.tileID?i=e.getVisibleUnwrappedCoordinates(this._source.tileID).map(e=>new HE(e.canonical.z,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y)):(i=iD(e,{tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:"vector"===this._source.type&&void 0!==this.map._zoomLevelsToOverscale?Math.max(this._source.maxzoom,e.maxZoom-this.map._zoomLevelsToOverscale):this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:t,calculateTileZoom:this._source.calculateTileZoom,maxContentElevation:this._updateMaxContentElevation()}),this._source.hasTile&&(i=i.filter(e=>this._source.hasTile(e)))):i=[],this.usedForTerrain&&(i=this._addTerrainIdealTiles(i));let n=0===i.length&&!this._updated&&this._didEmitContent;this._updated=!0,n&&this.fire(new cC("data",{sourceDataType:"idle",sourceId:this.id}));let a=tD(e,this._source),r=this._updateRetainedTiles(i,a),s=nD(this._source.type);s&&this._rasterFadeDuration>0&&!t&&aD(this._inViewTiles,i,r,this._maxFadingAncestorLevels,this._source.minzoom,this._source.maxzoom,this._rasterFadeDuration),s?this._cleanUpRasterTiles(r):this._cleanUpVectorTiles(r)}_cleanUpRasterTiles(e){for(let t of this._inViewTiles.getAllIds())e[t]||this._removeTile(t)}_cleanUpVectorTiles(e){for(let t of this._inViewTiles.getAllIds()){let i=this._inViewTiles.getTileById(t);e[t]?i.clearSymbolFadeHold():i.hasSymbolBuckets?i.holdingForSymbolFade()?i.symbolFadeFinished()&&this._removeTile(t):i.setSymbolHoldDuration(this.map._fadeDuration):this._removeTile(t)}}_addTerrainIdealTiles(e){let t=[];for(let i of e)if(i.canonical.z>this._source.minzoom){let e=i.scaledTo(i.canonical.z-1);t.push(e);let n=i.scaledTo(Math.max(this._source.minzoom,Math.min(i.canonical.z,5)));t.push(n)}return e.concat(t)}releaseSymbolFadeTiles(){for(let e of this._inViewTiles.getAllIds())this._inViewTiles.getTileById(e).holdingForSymbolFade()&&this._removeTile(e)}_updateRetainedTiles(t,i){let n=new Set;for(let e of t)this._addTile(e).hasData()||n.add(e);let a=t.reduce((e,t)=>(e[t.key]=t,e),{}),r=this._retainLoadedChildren(a,n),s={},o=Math.max(i-e.maxUnderzooming,this._source.minzoom);for(let e of r){let t=this._inViewTiles.getTileById(e.key),i=t?.wasRequested();for(let n=e.overscaledZ-1;n>=o;--n){let r=e.scaledTo(n);if(s[r.key])break;if(s[r.key]=!0,t=this.getTile(r),!t&&i&&(t=this._addTile(r)),t){let e=t.hasData();if((e||!this.map?.cancelPendingTileRequestsWhileZooming||i)&&(a[r.key]=r),i=t.wasRequested(),e)break}}}return a}_addTile(e){let t=this._inViewTiles.getTileById(e.key);if(t)return t;t=this._outOfViewCache.getAndRemove(e),t&&(t.resetFadeLogic(),this._setTileReloadTimer(e.key,t),t.tileID=e,this._state.initializeTileState(t,this.map?this.map.painter:null));let i=t;return t||(t=new WT(e,this._source.tileSize*e.overscaleFactor()),this._loadTile(t,e.key,t.state,!1)),t.uses++,this._inViewTiles.setTile(e.key,t),i||this._source.fire(new cC("dataloading",{tile:t,coord:t.tileID})),t}_setTileReloadTimer(e,t){this._clearTileReloadTimer(e);let i=t.getExpiryTimeout();if(i){let t=()=>{this._reloadTile(e,"expired"),delete this._timers[e]};this._timers[e]=setTimeout(t,i)}}_clearTileReloadTimer(e){let t=this._timers[e];t&&(clearTimeout(t),delete this._timers[e])}_resetTileReloadTimers(){for(let e in this._timers)clearTimeout(this._timers[e]),delete this._timers[e];for(let e of this._inViewTiles.getAllIds()){let t=this._inViewTiles.getTileById(e);this._setTileReloadTimer(e,t)}}refreshTiles(e){for(let t of this._inViewTiles.getAllIds()){let i=this._inViewTiles.getTileById(t);(this._inViewTiles.isIdRenderable(t)||"errored"==i.state)&&e.some(e=>e.equals(i.tileID.canonical))&&this._reloadTile(t,"expired")}}_removeTile(e){let t=this._inViewTiles.getTileById(e);t&&(t.uses--,this._inViewTiles.deleteTileById(e),this._clearTileReloadTimer(e),!(t.uses>0)&&(t.hasData()&&"reloading"!==t.state?this._outOfViewCache.add(t.tileID,t,t.getExpiryTimeout()):(t.aborted=!0,this._abortTile(t),this._unloadTile(t))))}_dataHandler(e){if("source"===e.dataType){if("metadata"===e.sourceDataType)return void(this._sourceLoaded=!0);"content"===e.sourceDataType&&this._sourceLoaded&&!this._paused&&(this.reload(e.sourceDataChanged,e.shouldReloadTileOptions),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}}resetMaxContentElevation(){this._maxContentElevationSeen=0}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1,this.resetMaxContentElevation();for(let e of this._inViewTiles.getAllIds())this._removeTile(e);this._outOfViewCache.reset()}tilesIn(e,t,i){let n=[],a=this.transform;if(!a)return n;let r=a.getCoveringTilesDetailsProvider().allowWorldCopies(),s=i?a.getCameraQueryGeometry(e):e,o=e=>a.screenPointToMercatorCoordinate(e,this.terrain),l=this.transformBbox(e,o,!r),c=this.transformBbox(s,o,!r),u=this.getIds(),h=px.fromPoints(c);for(let e of u){let i=this._inViewTiles.getTileById(e);if(i.holdingForSymbolFade())continue;let s=r?[i.tileID]:[i.tileID.unwrapTo(-1),i.tileID.unwrapTo(0)],o=2**(a.zoom-i.tileID.overscaledZ),u=t*i.queryPadding*Uu/i.tileSize/o;for(let e of s){let t=h.map(t=>e.getTilePoint(new Fx(t.x,t.y)));if(t.expandBy(u),t.intersects(mx)){let t=l.map(t=>e.getTilePoint(t)),a=c.map(t=>e.getTilePoint(t));n.push({tile:i,tileID:r?e:e.unwrapTo(0),queryGeometry:t,cameraQueryGeometry:a,scale:o})}}}return n}transformBbox(e,t,i){let n=e.map(t);if(i){let i=px.fromPoints(e);i.shrinkBy(.001*Math.min(i.width(),i.height()));let a=i.map(t);px.fromPoints(n).covers(a)||(n=n.map(e=>e.x>.5?new Fx(e.x-1,e.y,e.z):e))}return n}getVisibleCoordinates(e){let t=this.getRenderableIds(e).map(e=>this._inViewTiles.getTileById(e).tileID);return this.transform&&this.transform.populateCache(t),t}hasTransition(){return!!this._source.hasTransition()||nD(this._source.type)&&function(e,t){if(t<=0)return!1;let i=tC();for(let t of e.getAllTiles())if(t.fadeEndTime>=i)return!0;return!1}(this._inViewTiles,this._rasterFadeDuration)}setRasterFadeDuration(e){this._rasterFadeDuration=e}setFeatureState(e,t,i){e||=QE,this._state.updateState(e,t,i)}removeFeatureState(e,t,i){e||=QE,this._state.removeFeatureState(e,t,i)}getFeatureState(e,t){return e||=QE,this._state.getState(e,t)}setDependencies(e,t,i){let n=this._inViewTiles.getTileById(e);n&&n.setDependencies(t,i)}reloadTilesForDependencies(e,t){for(let i of this._inViewTiles.getAllIds())this._inViewTiles.getTileById(i).hasDependency(e,t)&&this._reloadTile(i,"reloading");this._outOfViewCache.filter(i=>!i.hasDependency(e,t))}areTilesLoaded(){for(let e of this._inViewTiles.getAllTiles())if("loaded"!==e.state&&"errored"!==e.state)return!1;return!0}},dD=class{constructor(e,t){this.reset(e,t)}reset(e,t){this.points=e||[],this._distances=[0];for(let e=1;e<this.points.length;e++)this._distances[e]=this._distances[e-1]+this.points[e].dist(this.points[e-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(t||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(e){if(1===this.points.length)return this.points[0];e=sh(e,0,1);let t=1,i=this._distances[t],n=e*this.paddedLength+this.padding;for(;i<n&&t<this._distances.length;)i=this._distances[++t];let a=t-1,r=this._distances[a],s=i-r,o=s>0?(n-r)/s:0;return this.points[a].mult(1-o).add(this.points[t].mult(o))}};function pD(e,t,i,n,a){return a?e?e(t,i)+n:0===n?void 0:n:n}function mD(e,t){let i=!0;return"always"===e||("never"===e||"never"===t)&&(i=!1),i}var gD=class{constructor(e,t,i){let n=this.boxCells=[],a=this.circleCells=[];this.xCellCount=Math.ceil(e/i),this.yCellCount=Math.ceil(t/i);for(let e=0;e<this.xCellCount*this.yCellCount;e++)n.push([]),a.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=e,this.height=t,this.xScale=this.xCellCount/e,this.yScale=this.yCellCount/t,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(e,t,i,n,a){this._forEachCell(t,i,n,a,this._insertBoxCell,this.boxUid++),this.boxKeys.push(e),this.bboxes.push(t),this.bboxes.push(i),this.bboxes.push(n),this.bboxes.push(a)}insertCircle(e,t,i,n){this._forEachCell(t-n,i-n,t+n,i+n,this._insertCircleCell,this.circleUid++),this.circleKeys.push(e),this.circles.push(t),this.circles.push(i),this.circles.push(n)}_insertBoxCell(e,t,i,n,a,r){this.boxCells[a].push(r)}_insertCircleCell(e,t,i,n,a,r){this.circleCells[a].push(r)}_query(e,t,i,n,a,r,s){if(i<0||e>this.width||n<0||t>this.height)return[];let o=[];if(e<=0&&t<=0&&this.width<=i&&this.height<=n){if(a)return[{key:null,x1:e,y1:t,x2:i,y2:n}];for(let e=0;e<this.boxKeys.length;e++)o.push({key:this.boxKeys[e],x1:this.bboxes[4*e],y1:this.bboxes[4*e+1],x2:this.bboxes[4*e+2],y2:this.bboxes[4*e+3]});for(let e=0;e<this.circleKeys.length;e++){let t=this.circles[3*e],i=this.circles[3*e+1],n=this.circles[3*e+2];o.push({key:this.circleKeys[e],x1:t-n,y1:i-n,x2:t+n,y2:i+n})}}else{let l={hitTest:a,overlapMode:r,seenUids:{box:{},circle:{}}};this._forEachCell(e,t,i,n,this._queryCell,o,l,s)}return o}query(e,t,i,n){return this._query(e,t,i,n,!1,null)}hitTest(e,t,i,n,a,r){return this._query(e,t,i,n,!0,a,r).length>0}hitTestCircle(e,t,i,n,a){let r=e-i,s=e+i,o=t-i,l=t+i;if(s<0||r>this.width||l<0||o>this.height)return!1;let c=[],u={hitTest:!0,overlapMode:n,circle:{x:e,y:t,radius:i},seenUids:{box:{},circle:{}}};return this._forEachCell(r,o,s,l,this._queryCellCircle,c,u,a),c.length>0}_queryCell(e,t,i,n,a,r,s,o){let{seenUids:l,hitTest:c,overlapMode:u}=s,h=this.boxCells[a],d=1e-6;if(null!==h){let a=this.bboxes;for(let s of h)if(!l.box[s]){l.box[s]=!0;let h=4*s,p=this.boxKeys[s];if(e<=a[h+2]+d&&t<=a[h+3]+d&&i>=a[h+0]-d&&n>=a[h+1]-d&&(!o||o(p))&&(!c||!mD(u,p.overlapMode))&&(r.push({key:p,x1:a[h],y1:a[h+1],x2:a[h+2],y2:a[h+3]}),c))return!0}}let p=this.circleCells[a];if(null!==p){let a=this.circles;for(let s of p)if(!l.circle[s]){l.circle[s]=!0;let h=3*s,d=this.circleKeys[s];if(this._circleAndRectCollide(a[h],a[h+1],a[h+2],e,t,i,n)&&(!o||o(d))&&(!c||!mD(u,d.overlapMode))){let e=a[h],t=a[h+1],i=a[h+2];if(r.push({key:d,x1:e-i,y1:t-i,x2:e+i,y2:t+i}),c)return!0}}}return!1}_queryCellCircle(e,t,i,n,a,r,s,o){let{circle:l,seenUids:c,overlapMode:u}=s,h=this.boxCells[a];if(null!==h){let e=this.bboxes;for(let t of h)if(!c.box[t]){c.box[t]=!0;let i=4*t,n=this.boxKeys[t];if(this._circleAndRectCollide(l.x,l.y,l.radius,e[i+0],e[i+1],e[i+2],e[i+3])&&(!o||o(n))&&!mD(u,n.overlapMode))return r.push(!0),!0}}let d=this.circleCells[a];if(null!==d){let e=this.circles;for(let t of d)if(!c.circle[t]){c.circle[t]=!0;let i=3*t,n=this.circleKeys[t];if(this._circlesCollide(e[i],e[i+1],e[i+2],l.x,l.y,l.radius)&&(!o||o(n))&&!mD(u,n.overlapMode))return r.push(!0),!0}}}_forEachCell(e,t,i,n,a,r,s,o){let l=this._convertToXCellCoord(e),c=this._convertToYCellCoord(t),u=this._convertToXCellCoord(i),h=this._convertToYCellCoord(n);for(let d=l;d<=u;d++)for(let l=c;l<=h;l++){let c=this.xCellCount*l+d;if(a.call(this,e,t,i,n,c,r,s,o))return}}_convertToXCellCoord(e){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(e*this.xScale)))}_convertToYCellCoord(e){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(e*this.yScale)))}_circlesCollide(e,t,i,n,a,r){let s=n-e,o=a-t,l=i+r;return l*l>s*s+o*o}_circleAndRectCollide(e,t,i,n,a,r,s){let o=(r-n)/2,l=Math.abs(e-(n+o));if(l>o+i)return!1;let c=(s-a)/2,u=Math.abs(t-(a+c));if(u>c+i)return!1;if(l<=o||u<=c)return!0;let h=l-o,d=u-c;return h*h+d*d<=i*i}};function fD(e,t){let i=1/(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]),n=1/(t[8]*t[8]+t[9]*t[9]+t[10]*t[10]),a=t[0]*i,r=t[4]*i,s=t[8]*n,o=t[1]*i,l=t[5]*i,c=t[9]*n,u=t[2]*i,h=t[6]*i,d=t[10]*n;e[0]=a,e[1]=r,e[2]=s,e[4]=o,e[5]=l,e[6]=c,e[8]=u,e[9]=h,e[10]=d;let p=t[12],m=t[13],g=t[14];return e[12]=-a*p-o*m-u*g,e[13]=-r*p-l*m-h*g,e[14]=-s*p-c*m-d*g,e[3]=0,e[7]=0,e[11]=0,e[15]=1,e}const AD=Jc();function _D(e,t,i){let n=Jc();if(!e){let{vecSouth:e,vecEast:i}=yD(t),a=XM();a[0]=i[0],a[1]=i[1],a[2]=e[0],a[3]=e[1],function(e,t){var i=t[0],n=t[1],a=t[2],r=t[3],s=i*r-a*n;s&&(s=1/s,e[0]=r*s,e[1]=-n*s,e[2]=-a*s,e[3]=i*s)}(a,a),n[0]=a[0],n[1]=a[1],n[4]=a[2],n[5]=a[3]}return au(n,n,[1/i,1/i,1]),n}function vD(e,t,i,n){if(e){let e=Jc();if(!t){let{vecSouth:t,vecEast:n}=yD(i);e[0]=n[0],e[1]=n[1],e[4]=t[0],e[5]=t[1]}return au(e,e,[n,n,1]),e}return i.pixelsToClipSpaceMatrix}function yD(e){let t=Math.cos(e.rollInRadians),i=Math.sin(e.rollInRadians),n=Math.cos(e.pitchInRadians),a=Math.cos(e.bearingInRadians),r=Math.sin(e.bearingInRadians),s=Fu();s[0]=-a*n*i-r*t,s[1]=-r*n*i+a*t;let o=Lu(s);o<1e-9?Bu(s):Ru(s,s,1/o);let l=Fu();l[0]=a*n*t-r*i,l[1]=r*n*t+a*i;let c=Lu(l);return c<1e-9?Bu(l):Ru(l,l,1/c),{vecEast:l,vecSouth:s}}function xD(e,t,i){return pD(e.getElevation,t,i,e.heightOffset??0,e.heightAnchorGround??!0)}function bD(e,t,i,n){let a;null==n?(a=[e,t,0,1],UD(a,a,i)):(a=[e,t,n,1],Mu(a,a,i));let r=a[3];return{point:new Hc(a[0]/r,a[1]/r),signedDistanceFromCamera:r,isOccluded:!1}}function wD(e,t){return.5+e/t*.5}function ED(e,t){return e.x>=-t[0]&&e.x<=t[0]&&e.y>=-t[1]&&e.y<=t[1]}function kD(e,t,i,n,a,r,s,o,l,c,u,h,d){let p=i?e.textSizeData:e.iconSizeData,m=Hw(p,t.transform.zoom),g=[256/t.width*2+1,256/t.height*2+1],f=i?e.text.dynamicLayoutVertexArray:e.icon.dynamicLayoutVertexArray;f.clear();let A=e.lineVertexArray,_=i?e.text.placedSymbolArray:e.icon.placedSymbolArray,v=t.transform.width/t.transform.height,y=!1;for(let i=0;i<_.length;i++){let x=_.get(i);if(x.hidden||2===x.writingMode&&!y){OD(x.numGlyphs,f);continue}y=!1;let b=new Hc(x.anchorX,x.anchorY),w={getElevation:d,pitchedLabelPlaneMatrix:n,lineVertexArray:A,pitchWithMap:r,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:t.transform,tileAnchorPoint:b,unwrappedTileID:l,width:c,height:u,translation:h},E=FD(x.anchorX,x.anchorY,w);if(!ED(E.point,g)){OD(x.numGlyphs,f);continue}let k=E.signedDistanceFromCamera,S=wD(t.transform.cameraToCenterDistance,k),M=Gw(p,m,x),C=r?M*t.transform.getPitchedTextCorrection(x.anchorX,x.anchorY,l)/S:M*S,T=CD({projectionContext:w,pitchedLabelPlaneMatrixInverse:a,symbol:x,fontSize:C,flip:!1,keepUpright:s,glyphOffsetArray:e.glyphOffsetArray,dynamicLayoutVertexArray:f,aspectRatio:v,rotateToLine:o});y=T.useVertical,(T.notEnoughRoom||y||T.needsFlipping&&CD({projectionContext:w,pitchedLabelPlaneMatrixInverse:a,symbol:x,fontSize:C,flip:!0,keepUpright:s,glyphOffsetArray:e.glyphOffsetArray,dynamicLayoutVertexArray:f,aspectRatio:v,rotateToLine:o}).notEnoughRoom)&&OD(x.numGlyphs,f)}i?e.text.dynamicLayoutVertexBuffer.updateData(f):e.icon.dynamicLayoutVertexBuffer.updateData(f)}function SD(e,t,i,n,a,r,s,o){let l=r.glyphStartIndex+r.numGlyphs,c=r.lineStartIndex,u=r.lineStartIndex+r.lineLength,h=t.getoffsetX(r.glyphStartIndex),d=t.getoffsetX(l-1),p=LD(e*h,i,n,a,r.segment,c,u,o,s);if(!p)return null;let m=LD(e*d,i,n,a,r.segment,c,u,o,s);return!m||o.projectionCache.anyProjectionOccluded?null:{first:p,last:m}}function MD(e,t,i,n){return 1===e&&Math.abs(i.y-t.y)>Math.abs(i.x-t.x)*n?{useVertical:!0}:(2===e?t.y<i.y:t.x>i.x)?{needsFlipping:!0}:null}function CD(e){let t,{projectionContext:i,pitchedLabelPlaneMatrixInverse:n,symbol:a,fontSize:r,flip:s,keepUpright:o,glyphOffsetArray:l,dynamicLayoutVertexArray:c,aspectRatio:u,rotateToLine:h}=e,d=r/24,p=a.lineOffsetX*d,m=a.lineOffsetY*d;if(a.numGlyphs>1){let e=a.glyphStartIndex+a.numGlyphs,r=a.lineStartIndex,c=a.lineStartIndex+a.lineLength,g=SD(d,l,p,m,s,a,h,i);if(!g)return{notEnoughRoom:!0};let f=ID(g.first.point.x,g.first.point.y,i,n),A=ID(g.last.point.x,g.last.point.y,i,n);if(o&&!s){let e=MD(a.writingMode,f,A,u);if(e)return e}t=[g.first];for(let n=a.glyphStartIndex+1;n<e-1;n++){let e=LD(d*l.getoffsetX(n),p,m,s,a.segment,r,c,i,h);if(!e)return{notEnoughRoom:!0};t.push(e)}t.push(g.last)}else{if(o&&!s){let e=PD(i.tileAnchorPoint.x,i.tileAnchorPoint.y,i).point,t=a.lineStartIndex+a.segment+1,r=new Hc(i.lineVertexArray.getx(t),i.lineVertexArray.gety(t)),s=PD(r.x,r.y,i),o=s.signedDistanceFromCamera>0?s.point:TD(i.tileAnchorPoint,r,e,1,i),l=ID(e.x,e.y,i,n),c=ID(o.x,o.y,i,n),h=MD(a.writingMode,l,c,u);if(h)return h}let e=LD(d*l.getoffsetX(a.glyphStartIndex),p,m,s,a.segment,a.lineStartIndex,a.lineStartIndex+a.lineLength,i,h);if(!e||i.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};t=[e]}for(let e of t)wE(c,e.point,e.angle);return{}}function TD(e,t,i,n,a){let r=e.add(e.sub(t)._unit()),s=PD(r.x,r.y,a).point,o=i.sub(s);return i.add(o._mult(n/o.mag()))}function DD(e,t,i){let n=t.projectionCache;if(n.projections[e])return n.projections[e];let a=new Hc(t.lineVertexArray.getx(e),t.lineVertexArray.gety(e)),r=PD(a.x,a.y,t);if(r.signedDistanceFromCamera>0)return n.projections[e]=r.point,n.anyProjectionOccluded||=r.isOccluded,r.point;let s=e-i.direction,o=0===i.distanceFromAnchor?t.tileAnchorPoint:new Hc(t.lineVertexArray.getx(s),t.lineVertexArray.gety(s)),l=i.absOffsetX-i.distanceFromAnchor+1;return TD(o,a,i.previousVertex,l,t)}function PD(e,t,i){let n,a=e+i.translation[0],r=t+i.translation[1];return i.pitchWithMap?(n=bD(a,r,i.pitchedLabelPlaneMatrix,xD(i,a,r)),n.isOccluded=!1):(n=i.transform.projectTileCoordinates(a,r,i.unwrappedTileID,xD(i,a,r)),n.point.x=(.5*n.point.x+.5)*i.width,n.point.y=(.5*-n.point.y+.5)*i.height),n}function ID(e,t,i,n){if(i.pitchWithMap){let a=[e,t,0,1];Mu(a,a,n);let r=a[0]/a[3],s=a[1]/a[3];return i.transform.projectTileCoordinates(r,s,i.unwrappedTileID,xD(i,r,s)).point}return{x:e/i.width*2-1,y:1-t/i.height*2}}function FD(e,t,i){return i.transform.projectTileCoordinates(e,t,i.unwrappedTileID,xD(i,e,t))}function zD(e,t,i){return e._unit()._perp()._mult(t*i)}function RD(e,t,i,n,a,r,s,o,l){if(o.projectionCache.offsets[e])return o.projectionCache.offsets[e];let c=i.add(t);if(e+l.direction<n||e+l.direction>=a)return o.projectionCache.offsets[e]=c,c;let u=DD(e+l.direction,o,l),h=zD(u.sub(i),s,l.direction),d=i.add(h),p=u.add(h);return o.projectionCache.offsets[e]=function(e,t,i,n){let a=t.y-e.y,r=t.x-e.x,s=n.y-i.y,o=n.x-i.x,l=s*r-o*a;if(0===l)return null;let c=(o*(e.y-i.y)-s*(e.x-i.x))/l;return new Hc(e.x+c*r,e.y+c*a)}(r,c,d,p)||c,o.projectionCache.offsets[e]}function LD(e,t,i,n,a,r,s,o,l){let c=n?e-t:e+t,u=c>0?1:-1,h=0;n&&(u*=-1,h=Math.PI),u<0&&(h+=Math.PI);let d,p=u>0?r+a:r+a+1;o.projectionCache.cachedAnchorPoint?d=o.projectionCache.cachedAnchorPoint:(d=PD(o.tileAnchorPoint.x,o.tileAnchorPoint.y,o).point,o.projectionCache.cachedAnchorPoint=d);let m,g,f,A=d,_=d,v=0,y=0,x=Math.abs(c),b=[];for(;v+y<=x;){if(p+=u,p<r||p>=s)return null;v+=y,_=A,g=m;let e={absOffsetX:x,direction:u,distanceFromAnchor:v,previousVertex:_};if(A=DD(p,o,e),0===i)b.push(_),f=A.sub(_);else{let t,n=A.sub(_);t=0===n.mag()?zD(DD(p+u,o,e).sub(A),i,u):zD(n,i,u),g||=_.add(t),m=RD(p,t,A,r,s,g,i,o,e),b.push(g),f=m.sub(g)}y=f.mag()}let w=(x-v)/y,E=f._mult(w)._add(g||_),k=h+Math.atan2(A.y-_.y,A.x-_.x);return b.push(E),{point:E,angle:l?k:0,path:b}}const BD=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function OD(e,t){for(let i=0;i<e;i++){let e=t.length;t.resize(e+4),t.float32.set(BD,3*e)}}function UD(e,t,i){let n=t[0],a=t[1];return e[0]=i[0]*n+i[4]*a+i[12],e[1]=i[1]*n+i[5]*a+i[13],e[3]=i[3]*n+i[7]*a+i[15],e}var ND=class{constructor(e,t=new gD(e.width+200,e.height+200,25),i=new gD(e.width+200,e.height+200,25)){this.transform=e,this.grid=t,this.ignoredGrid=i,this.pitchFactor=Math.cos(e.pitch*Math.PI/180)*e.cameraToCenterDistance,this.screenRightBoundary=e.width+100,this.screenBottomBoundary=e.height+100,this.gridRightBoundary=e.width+200,this.gridBottomBoundary=e.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(e,t,i,n,a,r,s,o,l,c,u,h,d=0,p=!0){let m,g=e.anchorPointX+o[0],f=e.anchorPointY+o[1],A=this.projectAndGetPerspectiveRatio(g,f,a,pD(c,g,f,d,p),h),_=i*A.perspectiveRatio;if(r||s)m=this._projectCollisionBox(e,_,n,a,r,s,o,A,c,u,h,d,p);else{let t=A.x+(u?u.x*_:0),i=A.y+(u?u.y*_:0);m={allPointsOccluded:!1,box:[t+e.x1*_,i+e.y1*_,t+e.x2*_,i+e.y2*_]}}let[v,y,x,b]=m.box,w=r?m.allPointsOccluded:A.isOccluded,E=w;return E||=A.perspectiveRatio<this.perspectiveRatioCutoff,E||=!this.isInsideGrid(v,y,x,b),E||"always"!==t&&this.grid.hitTest(v,y,x,b,t,l)?{box:[v,y,x,b],placeable:!1,offscreen:!1,occluded:w}:{box:[v,y,x,b],placeable:!0,offscreen:this.isOffscreen(v,y,x,b),occluded:w}}placeCollisionCircles(e,t,i,n,a,r,s,o,l,c,u,h,d,p){let m=[],g=new Hc(t.anchorX,t.anchorY),f=this.getPerspectiveRatio(g.x,g.y,r,p?.(g.x,g.y)),A=(l?a*this.transform.getPitchedTextCorrection(t.anchorX,t.anchorY,r)/f:a*f)/24,_=t.lineOffsetX*A,v=t.lineOffsetY*A,y={getElevation:p,pitchedLabelPlaneMatrix:s,lineVertexArray:i,pitchWithMap:l,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:this.transform,tileAnchorPoint:g,unwrappedTileID:r,width:this.transform.width,height:this.transform.height,translation:d},x=SD(A,n,_,v,!1,t,!1,y),b=!1,w=!1,E=!0;if(x){let t=.5*u*f+h,i=new Hc(-100,-100),n=new Hc(this.screenRightBoundary,this.screenBottomBoundary),a=new dD,r=x.first,s=x.last,d=[];for(let e=r.path.length-1;e>=1;e--)d.push(r.path[e]);for(let e=1;e<s.path.length;e++)d.push(s.path[e]);let p=2.5*t;if(l){let e=this.projectPathToScreenSpace(d,y);d=e.some(e=>e.signedDistanceFromCamera<=0)?[]:e.map(e=>e.point)}let g=[];if(d.length>0){let e=d[0].clone(),t=d[0].clone();for(let i=1;i<d.length;i++)e.x=Math.min(e.x,d[i].x),e.y=Math.min(e.y,d[i].y),t.x=Math.max(t.x,d[i].x),t.y=Math.max(t.y,d[i].y);g=e.x>=i.x&&t.x<=n.x&&e.y>=i.y&&t.y<=n.y?[d]:t.x<i.x||e.x>n.x||t.y<i.y||e.y>n.y?[]:eE([d],i.x,i.y,n.x,n.y)}for(let i of g){a.reset(i,.25*t);let n=0;n=a.length<=.5*t?1:Math.ceil(a.paddedLength/p)+1;for(let i=0;i<n;i++){let r=i/Math.max(n-1,1),s=a.lerp(r),l=s.x+100,u=s.y+100;m.push(l,u,t,0);let h=l-t,d=u-t,p=l+t,g=u+t;if(E&&=this.isOffscreen(h,d,p,g),w||=this.isInsideGrid(h,d,p,g),"always"!==e&&this.grid.hitTestCircle(l,u,t,e,c)&&(b=!0,!o))return{circles:[],offscreen:!1,collisionDetected:b}}}}return{circles:!o&&b||!w||f<this.perspectiveRatioCutoff?[]:m,offscreen:E,collisionDetected:b}}projectPathToScreenSpace(e,t){return function(e){let t=0,i=0,n=0,a=0;for(let r=0;r<e.length;r++)e[r].isOccluded?(n=r+1,a=0):(a++,a>i&&(i=a,t=n));return e.slice(t,t+i)}(function(e,t){let i=AD;return function(e,t){let i=1/(t[0]*t[5]-t[1]*t[4]);e[0]=t[5]*i,e[1]=-t[1]*i,e[2]=0,e[3]=0,e[4]=-t[4]*i,e[5]=t[0]*i,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1/t[10],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1/t[15]}(i,t.pitchedLabelPlaneMatrix),e.map(e=>{let n=bD(e.x,e.y,i,xD(t,e.x,e.y)),a=t.transform.projectTileCoordinates(n.point.x,n.point.y,t.unwrappedTileID,xD(t,n.point.x,n.point.y));return a.point.x=(.5*a.point.x+.5)*t.width,a.point.y=(.5*-a.point.y+.5)*t.height,a})}(e,t))}queryRenderedSymbols(e){if(0===e.length||0===this.grid.keysLength()&&0===this.ignoredGrid.keysLength())return{};let t=[],i=new px;for(let n of e){let e=new Hc(n.x+100,n.y+100);i.extend(e),t.push(e)}let{minX:n,minY:a,maxX:r,maxY:s}=i,o=this.grid.query(n,a,r,s).concat(this.ignoredGrid.query(n,a,r,s)),l={},c={};for(let e of o){let i=e.key;(void 0===l[i.bucketInstanceId]&&(l[i.bucketInstanceId]={}),l[i.bucketInstanceId][i.featureIndex])||pv(t,[new Hc(e.x1,e.y1),new Hc(e.x2,e.y1),new Hc(e.x2,e.y2),new Hc(e.x1,e.y2)])&&(l[i.bucketInstanceId][i.featureIndex]=!0,void 0===c[i.bucketInstanceId]&&(c[i.bucketInstanceId]=[]),c[i.bucketInstanceId].push(i.featureIndex))}return c}insertCollisionBox(e,t,i,n,a,r){let s={bucketInstanceId:n,featureIndex:a,collisionGroupID:r,overlapMode:t};(i?this.ignoredGrid:this.grid).insert(s,e[0],e[1],e[2],e[3])}insertCollisionCircles(e,t,i,n,a,r){let s=i?this.ignoredGrid:this.grid,o={bucketInstanceId:n,featureIndex:a,collisionGroupID:r,overlapMode:t};for(let t=0;t<e.length;t+=4)s.insertCircle(o,e[t],e[t+1],e[t+2])}projectAndGetPerspectiveRatio(e,t,i,n,a){if(a){let i;null==n?(i=[e,t,0,1],UD(i,i,a)):(i=[e,t,n,1],Mu(i,i,a));let r=i[3];return{x:(i[0]/r+1)/2*this.transform.width+100,y:(-i[1]/r+1)/2*this.transform.height+100,perspectiveRatio:.5+this.transform.cameraToCenterDistance/r*.5,isOccluded:!1,signedDistanceFromCamera:r}}{let a=this.transform.projectTileCoordinates(e,t,i,n);return{x:(a.point.x+1)/2*this.transform.width+100,y:(1-a.point.y)/2*this.transform.height+100,perspectiveRatio:.5+this.transform.cameraToCenterDistance/a.signedDistanceFromCamera*.5,isOccluded:a.isOccluded,signedDistanceFromCamera:a.signedDistanceFromCamera}}}getPerspectiveRatio(e,t,i,n){let a=this.transform.projectTileCoordinates(e,t,i,n);return.5+this.transform.cameraToCenterDistance/a.signedDistanceFromCamera*.5}isOffscreen(e,t,i,n){return i<100||e>=this.screenRightBoundary||n<100||t>this.screenBottomBoundary}isInsideGrid(e,t,i,n){return i>=0&&e<this.gridRightBoundary&&n>=0&&t<this.gridBottomBoundary}getViewportMatrix(){let e=eu([]);return nu(e,e,[-100,-100,0]),e}_projectCollisionBox(e,t,i,n,a,r,s,o,l,c,u,h=0,d=!0){let p=1,m=0,g=0,f=1,A=e.anchorPointX+s[0],_=e.anchorPointY+s[1];if(r&&!a){let e=this.projectAndGetPerspectiveRatio(A+1,_,n,pD(l,A+1,_,h,d),u),t=e.x-o.x,i=e.y-o.y,a=Math.atan(i/t)+(t<0?Math.PI:0),r=Math.sin(a),s=Math.cos(a);p=s,m=r,g=-r,f=s}else if(!r&&a){let e=yD(this.transform);p=e.vecEast[0],m=e.vecEast[1],g=e.vecSouth[0],f=e.vecSouth[1]}let v=o.x,y=o.y,x=t;if(a&&(v=A,y=_,x=2**-(this.transform.zoom-i.overscaledZ),x*=this.transform.getPitchedTextCorrection(A,_,n),!c)){x*=sh(.5+.5*(o.signedDistanceFromCamera/this.transform.cameraToCenterDistance),0,4)}c&&(v+=p*c.x*x+g*c.y*x,y+=m*c.x*x+f*c.y*x);let b=e.x1*x,w=e.x2*x,E=(b+w)/2,k=e.y1*x,S=e.y2*x,M=(k+S)/2,C=[{offsetX:b,offsetY:k},{offsetX:E,offsetY:k},{offsetX:w,offsetY:k},{offsetX:w,offsetY:M},{offsetX:w,offsetY:S},{offsetX:E,offsetY:S},{offsetX:b,offsetY:S},{offsetX:b,offsetY:M}],T=[];for(let{offsetX:e,offsetY:t}of C)T.push(new Hc(v+p*e+g*t,y+m*e+f*t));let D=!1;if(a){let e=T.map(e=>this.projectAndGetPerspectiveRatio(e.x,e.y,n,pD(l,e.x,e.y,h,d),u));D=e.some(e=>!e.isOccluded),T=e.map(e=>new Hc(e.x,e.y))}else D=!0;return{box:nh(T),allPointsOccluded:!D}}},jD=class{constructor(e,t,i,n){this.opacity=e?Math.max(0,Math.min(1,e.opacity+(e.placed?t:-t))):n&&i?1:0,this.placed=i}isHidden(){return 0===this.opacity&&!this.placed}},VD=class{constructor(e,t,i,n,a){this.text=new jD(e?e.text:null,t,i,a),this.icon=new jD(e?e.icon:null,t,n,a)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}},qD=class{constructor(e,t,i){this.text=e,this.icon=t,this.skipFade=i}},GD=class{constructor(e,t,i,n,a){this.bucketInstanceId=e,this.featureIndex=t,this.sourceLayerIndex=i,this.bucketIndex=n,this.tileID=a}},HD=class{constructor(e){this.crossSourceCollisions=e,this.maxGroupID=0,this.collisionGroups={}}get(e){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[e]){let t=++this.maxGroupID;this.collisionGroups[e]={ID:t,predicate:e=>e.collisionGroupID===t}}return this.collisionGroups[e]}};function WD(e,t,i,n,a){let{horizontalAlign:r,verticalAlign:s}=Cw(e),o=-(s-.5)*i;return new Hc(-(r-.5)*t+n[0]*a,o+n[1]*a)}var ZD=class{constructor(e,t,i,n,a){this.transform=e.clone(),this.terrain=t,this.collisionIndex=new ND(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=i,this.retainedQueryData={},this.collisionGroups=new HD(n),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=a,a&&(a.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(e){let t=this.terrain;if(t)return(i,n)=>t.getElevation(e,i,n)}getBucketParts(e,t,i,n){let a=i.getBucket(t),r=i.latestFeatureIndex;if(!a||!r||t.id!==a.layerIds[0])return;let s=i.collisionBoxArray,o=a.layers[0].layout,l=a.layers[0].paint,c=2**(this.transform.zoom-i.tileID.overscaledZ),u=i.tileSize/Uu,h=i.tileID.toUnwrapped(),d="map"===o.get("text-rotation-alignment"),p=Nu(i,1,this.transform.zoom),m=Zu(this.collisionIndex.transform,i,l.get("text-translate"),l.get("text-translate-anchor")),g=Zu(this.collisionIndex.transform,i,l.get("icon-translate"),l.get("icon-translate-anchor")),f=_D(d,this.transform,p);this.retainedQueryData[a.bucketInstanceId]=new GD(a.bucketInstanceId,r,a.sourceLayerIndex,a.index,i.tileID);let A={bucket:a,layout:o,translationText:m,translationIcon:g,unwrappedTileID:h,pitchedLabelPlaneMatrix:f,scale:c,textPixelRatio:u,holdingForFade:i.holdingForSymbolFade(),collisionBoxArray:s,partiallyEvaluatedTextSize:Hw(a.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(a.sourceID)};if(n)for(let t of a.sortKeyRanges){let{sortKey:i,symbolInstanceStart:n,symbolInstanceEnd:a}=t;e.push({sortKey:i,symbolInstanceStart:n,symbolInstanceEnd:a,parameters:A})}else e.push({symbolInstanceStart:0,symbolInstanceEnd:a.symbolInstances.length,parameters:A})}attemptAnchorPlacement(e,t,i,n,a,r,s,o,l,c,u,h,d,p,m,g,f,A,_,v,y,x){let b=hE[e.textAnchor],w=[e.textOffset0,e.textOffset1],E=WD(b,i,n,w,a),k=this.collisionIndex.placeCollisionBox(t,h,o,l,c,s,r,g,u.predicate,_,E,v,y,x);if((!A||this.collisionIndex.placeCollisionBox(A,h,o,l,c,s,r,f,u.predicate,_,E,v,y,x).placeable)&&k.placeable){let e;if(this.prevPlacement?.variableOffsets[d.crossTileID]&&this.prevPlacement?.placements[d.crossTileID]?.text&&(e=this.prevPlacement.variableOffsets[d.crossTileID].anchor),0===d.crossTileID)throw Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[d.crossTileID]={textOffset:w,width:i,height:n,anchor:b,textBoxScale:a,prevAnchor:e},this.markUsedJustification(p,b,d,m),p.allowVerticalPlacement&&(this.markUsedOrientation(p,m,d),this.placedOrientations[d.crossTileID]=m),{shift:E,placedGlyphBoxes:k}}}placeLayerBucketPart(e,t,i){let{bucket:n,layout:a,translationText:r,translationIcon:s,unwrappedTileID:o,pitchedLabelPlaneMatrix:l,textPixelRatio:c,holdingForFade:u,collisionBoxArray:h,partiallyEvaluatedTextSize:d,collisionGroup:p}=e.parameters,m=a.get("text-optional"),g=a.get("icon-optional"),f=yE(a,"text-overlap","text-allow-overlap"),A="always"===f,_=yE(a,"icon-overlap","icon-allow-overlap"),v="always"===_,y="map"===a.get("text-rotation-alignment"),x="map"===a.get("text-pitch-alignment"),b="none"!==a.get("icon-text-fit"),w="viewport-y"===a.get("symbol-z-order"),E="ground"===a.get("symbol-height-anchor"),k=A&&(v||!n.hasIconData()||g),S=v&&(A||!n.hasTextData()||m);!n.collisionArrays&&h&&n.deserializeCollisionBoxes(h);let M=this.retainedQueryData[n.bucketInstanceId].tileID,C=this._getTerrainElevationFunc(M),T=this.transform.getFastPathSimpleProjectionMatrix(M),D=(e,h,v)=>{if(t[e.crossTileID])return;if(u)return void(this.placements[e.crossTileID]=new qD(!1,!1,!1));let w=e.heightOffset,D=!1,P=!1,I=!0,F=null,z={box:null,placeable:!1,offscreen:null,occluded:!1},R={placeable:!1},L=null,B=null,O=null,U=0,N=0,j=0;h.textFeatureIndex?U=h.textFeatureIndex:e.useRuntimeCollisionCircles&&(U=e.featureIndex),h.verticalTextFeatureIndex&&(N=h.verticalTextFeatureIndex);let V=h.textBox;if(V){let t=t=>{let i=1;if(n.allowVerticalPlacement&&!t&&this.prevPlacement){let t=this.prevPlacement.placedOrientations[e.crossTileID];t&&(this.placedOrientations[e.crossTileID]=t,i=t,this.markUsedOrientation(n,i,e))}return i},a=(t,i)=>{if(n.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&h.verticalTextBox){for(let e of n.writingModes)if(2===e?(z=i(),R=z):z=t(),z?.placeable)break}else z=t()},l=e.textAnchorOffsetStartIndex,u=e.textAnchorOffsetEndIndex;if(u===l){let i=(t,i)=>{let a=this.collisionIndex.placeCollisionBox(t,f,c,M,o,x,y,r,p.predicate,C,void 0,T,w,E);return a?.placeable&&(this.markUsedOrientation(n,i,e),this.placedOrientations[e.crossTileID]=i),a};a(()=>i(V,1),()=>{let t=h.verticalTextBox;return n.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&t?i(t,2):{box:null,offscreen:null}}),t(z?.placeable)}else{let d=hE[this.prevPlacement?.variableOffsets[e.crossTileID]?.anchor],m=(t,a,h)=>{let m=t.x2-t.x1,g=t.y2-t.y1,A=e.textBoxScale,v=b&&"never"===_?a:null,k=null,S="never"===f?1:2,P="never";d&&S++;for(let i=0;i<S;i++){for(let i=l;i<u;i++){let a=n.textAnchorOffsets.get(i);if(d&&a.textAnchor!==d)continue;let l=this.attemptAnchorPlacement(a,t,m,g,A,y,x,c,M,o,p,P,e,n,h,r,s,v,C,T,w,E);if(l&&(k=l.placedGlyphBoxes,k?.placeable))return D=!0,F=l.shift,k}d?d=null:P=f}return i&&!k&&(k={box:this.collisionIndex.placeCollisionBox(V,"always",c,M,o,x,y,r,p.predicate,C,void 0,T,w,E).box,offscreen:!1,placeable:!1,occluded:!1}),k};a(()=>m(V,h.iconBox,1),()=>{let t=h.verticalTextBox,i=z?.placeable;return n.allowVerticalPlacement&&!i&&e.numVerticalGlyphVertices>0&&t?m(t,h.verticalIconBox,2):{box:null,occluded:!0,offscreen:null}}),z&&(D=z.placeable,I=z.offscreen);let g=t(z?.placeable);if(!D&&this.prevPlacement){let t=this.prevPlacement.variableOffsets[e.crossTileID];t&&(this.variableOffsets[e.crossTileID]=t,this.markUsedJustification(n,t.anchor,e,g))}}}if(L=z,D=L?.placeable,I=L?.offscreen,e.useRuntimeCollisionCircles&&e.centerJustifiedTextSymbolIndex>=0){let t=n.text.placedSymbolArray.get(e.centerJustifiedTextSymbolIndex),s=Gw(n.textSizeData,d,t),c=a.get("text-padding"),u=e.collisionCircleDiameter;B=this.collisionIndex.placeCollisionCircles(f,t,n.lineVertexArray,n.glyphOffsetArray,s,o,l,i,x,p.predicate,u,c,r,C),B.circles.length&&B.collisionDetected&&!i&&yh("Collisions detected, but collision boxes are not shown"),D=A||B.circles.length>0&&!B.collisionDetected,I&&=B.offscreen}if(h.iconFeatureIndex&&(j=h.iconFeatureIndex),h.iconBox){let e=e=>this.collisionIndex.placeCollisionBox(e,_,c,M,o,x,y,s,p.predicate,C,b&&F?F:void 0,T,w,E);R&&R.placeable&&h.verticalIconBox?(O=e(h.verticalIconBox),P=O.placeable):(O=e(h.iconBox),P=O.placeable),I&&=O.offscreen}let q=m||0===e.numHorizontalGlyphVertices&&0===e.numVerticalGlyphVertices,G=g||0===e.numIconVertices;q||G?G?q||(P&&=D):D=P&&D:P=D=P&&D;let H=D&&L.placeable,W=P&&O.placeable;if(H&&(R&&R.placeable&&N?this.collisionIndex.insertCollisionBox(L.box,f,a.get("text-ignore-placement"),n.bucketInstanceId,N,p.ID):this.collisionIndex.insertCollisionBox(L.box,f,a.get("text-ignore-placement"),n.bucketInstanceId,U,p.ID)),W&&this.collisionIndex.insertCollisionBox(O.box,_,a.get("icon-ignore-placement"),n.bucketInstanceId,j,p.ID),B&&D&&this.collisionIndex.insertCollisionCircles(B.circles,f,a.get("text-ignore-placement"),n.bucketInstanceId,U,p.ID),i&&this.storeCollisionData(n.bucketInstanceId,v,h,L,O,B),0===e.crossTileID)throw Error("symbolInstance.crossTileID can't be 0");if(0===n.bucketInstanceId)throw Error("bucket.bucketInstanceId can't be 0");let Z=(D||k)&&!L?.occluded,K=(P||S)&&!O?.occluded;this.placements[e.crossTileID]=new qD(Z,K,I||n.justReloaded),t[e.crossTileID]=!0};if(w){if(0!==e.symbolInstanceStart)throw Error("bucket.bucketInstanceId should be 0");let t=n.getSortedSymbolIndexes(-this.transform.bearingInRadians);for(let e=t.length-1;e>=0;--e){let i=t[e];D(n.symbolInstances.get(i),n.collisionArrays[i],i)}}else for(let t=e.symbolInstanceStart;t<e.symbolInstanceEnd;t++)D(n.symbolInstances.get(t),n.collisionArrays[t],t);n.justReloaded=!1}storeCollisionData(e,t,i,n,a,r){if(i.textBox||i.iconBox){let r,s;this.collisionBoxArrays.has(e)?r=this.collisionBoxArrays.get(e):(r=new Map,this.collisionBoxArrays.set(e,r)),r.has(t)?s=r.get(t):(s={text:null,icon:null},r.set(t,s)),i.textBox&&(s.text=n.box),i.iconBox&&(s.icon=a.box)}if(r){let t=this.collisionCircleArrays[e];void 0===t&&(t=this.collisionCircleArrays[e]=[]);for(let e=0;e<r.circles.length;e+=4)t.push(r.circles[e+0]-100),t.push(r.circles[e+1]-100),t.push(r.circles[e+2]),t.push(+!!r.collisionDetected)}}markUsedJustification(e,t,i,n){let a,r={left:i.leftJustifiedTextSymbolIndex,center:i.centerJustifiedTextSymbolIndex,right:i.rightJustifiedTextSymbolIndex};a=2===n?i.verticalPlacedTextSymbolIndex:r[gE(t)];let s=[i.leftJustifiedTextSymbolIndex,i.centerJustifiedTextSymbolIndex,i.rightJustifiedTextSymbolIndex,i.verticalPlacedTextSymbolIndex];for(let t of s)t>=0&&(e.text.placedSymbolArray.get(t).crossTileID=a>=0&&t!==a?0:i.crossTileID)}markUsedOrientation(e,t,i){let n=1===t||3===t?t:0,a=2===t?t:0,r=[i.leftJustifiedTextSymbolIndex,i.centerJustifiedTextSymbolIndex,i.rightJustifiedTextSymbolIndex];for(let t of r)e.text.placedSymbolArray.get(t).placedOrientation=n;i.verticalPlacedTextSymbolIndex&&(e.text.placedSymbolArray.get(i.verticalPlacedTextSymbolIndex).placedOrientation=a)}commit(e){this.commitTime=e,this.zoomAtLastRecencyCheck=this.transform.zoom;let t=this.prevPlacement,i=!1;this.prevZoomAdjustment=t?t.zoomAdjustment(this.transform.zoom):0;let n=t?t.symbolFadeChange(e):1,a=t?t.opacities:{},r=t?t.variableOffsets:{},s=t?t.placedOrientations:{};for(let e in this.placements){let t=this.placements[e],r=a[e];r?(this.opacities[e]=new VD(r,n,t.text,t.icon),i||=t.text!==r.text.placed,i||=t.icon!==r.icon.placed):(this.opacities[e]=new VD(null,n,t.text,t.icon,t.skipFade),i||=t.text||t.icon)}for(let e in a){let t=a[e];if(!this.opacities[e]){let a=new VD(t,n,!1,!1);a.isHidden()||(this.opacities[e]=a,i||=t.text.placed,i||=t.icon.placed)}}for(let e in r)!this.variableOffsets[e]&&this.opacities[e]&&!this.opacities[e].isHidden()&&(this.variableOffsets[e]=r[e]);for(let e in s)!this.placedOrientations[e]&&this.opacities[e]&&!this.opacities[e].isHidden()&&(this.placedOrientations[e]=s[e]);if(t&&void 0===t.lastPlacementChangeTime)throw Error("Last placement time for previous placement is not defined");i?this.lastPlacementChangeTime=e:"number"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=t?t.lastPlacementChangeTime:e)}updateLayerOpacities(e,t){let i={};for(let n of t){let t=n.getBucket(e);t&&n.latestFeatureIndex&&e.id===t.layerIds[0]&&this.updateBucketOpacities(t,n.tileID,i,n.collisionBoxArray)}}updateBucketOpacities(e,t,i,n){e.hasTextData()&&(e.text.opacityVertexArray.clear(),e.text.hasVisibleVertices=!1),e.hasIconData()&&(e.icon.opacityVertexArray.clear(),e.icon.hasVisibleVertices=!1),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexArray.clear(),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexArray.clear();let a=e.layers[0],r=a.layout,s=new VD(null,0,!1,!1,!0),o=r.get("text-allow-overlap"),l=r.get("icon-allow-overlap"),c=a._unevaluatedLayout.hasValue("text-variable-anchor")||a._unevaluatedLayout.hasValue("text-variable-anchor-offset"),u="map"===r.get("text-rotation-alignment"),h="map"===r.get("text-pitch-alignment"),d="none"!==r.get("icon-text-fit"),p=new VD(null,0,o&&(l||!e.hasIconData()||r.get("icon-optional")),l&&(o||!e.hasTextData()||r.get("text-optional")),!0);!e.collisionArrays&&n&&(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData())&&e.deserializeCollisionBoxes(n);let m=(e,t,i)=>{for(let n=0;n<t/4;n++)e.opacityVertexArray.emplaceBack(i);e.hasVisibleVertices||=i!==eP},g=this.collisionBoxArrays.get(e.bucketInstanceId);for(let t=0;t<e.symbolInstances.length;t++){let n=e.symbolInstances.get(t),{numHorizontalGlyphVertices:a,numVerticalGlyphVertices:r,crossTileID:o}=n,l=i[o],f=this.opacities[o];l?f=s:f||(f=p,this.opacities[o]=f),i[o]=!0;let A=a>0||r>0,_=n.numIconVertices>0,v=this.placedOrientations[n.crossTileID],y=2===v,x=1===v||3===v;if(A){let t=$D(f.text),i=y?eP:t;m(e.text,a,i);let s=x?eP:t;m(e.text,r,s);let o=f.text.isHidden(),l=[n.rightJustifiedTextSymbolIndex,n.centerJustifiedTextSymbolIndex,n.leftJustifiedTextSymbolIndex];for(let t of l)t>=0&&(e.text.placedSymbolArray.get(t).hidden=o||y?1:0);n.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(n.verticalPlacedTextSymbolIndex).hidden=o||x?1:0);let c=this.variableOffsets[n.crossTileID];c&&this.markUsedJustification(e,c.anchor,n,v);let u=this.placedOrientations[n.crossTileID];u&&(this.markUsedJustification(e,"left",n,u),this.markUsedOrientation(e,u,n))}if(_){let t=$D(f.icon),i=!(d&&n.verticalPlacedIconSymbolIndex&&y);if(n.placedIconSymbolIndex>=0){let a=i?t:eP;m(e.icon,n.numIconVertices,a),e.icon.placedSymbolArray.get(n.placedIconSymbolIndex).hidden=f.icon.isHidden()}if(n.verticalPlacedIconSymbolIndex>=0){let a=i?eP:t;m(e.icon,n.numVerticalIconVertices,a),e.icon.placedSymbolArray.get(n.verticalPlacedIconSymbolIndex).hidden=f.icon.isHidden()}}let b=g?.has(t)?g.get(t):{text:null,icon:null};if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){let i=e.collisionArrays[t];if(i){let t=new Hc(0,0);if(i.textBox||i.verticalTextBox){let n=!0;if(c){let e=this.variableOffsets[o];e?(t=WD(e.anchor,e.width,e.height,e.textOffset,e.textBoxScale),u&&t._rotate(h?-this.transform.bearingInRadians:this.transform.bearingInRadians)):n=!1}if(i.textBox||i.verticalTextBox){let a;i.textBox&&(a=y),i.verticalTextBox&&(a=x),KD(e.textCollisionBox.collisionVertexArray,f.text.placed,!n||a,b.text,t.x,t.y)}}if(i.iconBox||i.verticalIconBox){let n,a=!(x||!i.verticalIconBox);i.iconBox&&(n=a),i.verticalIconBox&&(n=!a),KD(e.iconCollisionBox.collisionVertexArray,f.icon.placed,n,b.icon,d?t.x:0,d?t.y:0)}}}}if(e.sortFeatures(-this.transform.bearingInRadians),this.retainedQueryData[e.bucketInstanceId]&&(this.retainedQueryData[e.bucketInstanceId].featureSortOrder=e.featureSortOrder),e.hasTextData()&&e.text.opacityVertexBuffer&&e.text.opacityVertexBuffer.updateData(e.text.opacityVertexArray),e.hasIconData()&&e.icon.opacityVertexBuffer&&e.icon.opacityVertexBuffer.updateData(e.icon.opacityVertexArray),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexBuffer&&e.iconCollisionBox.collisionVertexBuffer.updateData(e.iconCollisionBox.collisionVertexArray),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexBuffer&&e.textCollisionBox.collisionVertexBuffer.updateData(e.textCollisionBox.collisionVertexArray),e.text.opacityVertexArray.length!==e.text.layoutVertexArray.length/4)throw Error(`bucket.text.opacityVertexArray.length (= ${e.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${e.text.layoutVertexArray.length}) / 4`);if(e.icon.opacityVertexArray.length!==e.icon.layoutVertexArray.length/4)throw Error(`bucket.icon.opacityVertexArray.length (= ${e.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${e.icon.layoutVertexArray.length}) / 4`);e.bucketInstanceId in this.collisionCircleArrays&&(e.collisionCircleArray=this.collisionCircleArrays[e.bucketInstanceId],delete this.collisionCircleArrays[e.bucketInstanceId])}symbolFadeChange(e){return 0===this.fadeDuration?1:(e-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(e){return Math.max(0,(this.transform.zoom-e)/1.5)}hasTransitions(e){return this.stale||e-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(e,t){let i=this.zoomAtLastRecencyCheck===t?1-this.zoomAdjustment(t):1;return this.zoomAtLastRecencyCheck=t,this.commitTime+this.fadeDuration*i>e}setStale(){this.stale=!0}};function KD(e,t,i,n,a,r){(!n||0===n.length)&&(n=[0,0,0,0]);let s=n[0]-100,o=n[1]-100,l=n[2]-100,c=n[3]-100;e.emplaceBack(+!!t,+!!i,a||0,r||0,s,o),e.emplaceBack(+!!t,+!!i,a||0,r||0,l,o),e.emplaceBack(+!!t,+!!i,a||0,r||0,l,c),e.emplaceBack(+!!t,+!!i,a||0,r||0,s,c)}const XD=2**25,QD=2**24,YD=2**17,JD=65536;function $D(e){if(0===e.opacity&&!e.placed)return 0;if(1===e.opacity&&e.placed)return 4294967295;let t=+!!e.placed,i=Math.floor(127*e.opacity);return i*XD+t*QD+i*YD+t*JD+512*i+256*t+2*i+t}const eP=0;var tP=class{constructor(e){this._sortAcrossTiles="viewport-y"!==e.layout.get("symbol-z-order")&&!e.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(e,t,i,n,a){let r=this._bucketParts;for(;this._currentTileIndex<e.length;){let i=e[this._currentTileIndex];if(t.getBucketParts(r,n,i,this._sortAcrossTiles),this._currentTileIndex++,a())return!0}for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,r.sort((e,t)=>e.sortKey-t.sortKey));this._currentPartIndex<r.length;){let e=r[this._currentPartIndex];if(t.placeLayerBucketPart(e,this._seenCrossTileIDs,i),this._currentPartIndex++,a())return!0}return!1}},iP=class{constructor(e,t,i,n,a,r,s,o){this.placement=new ZD(e,t,r,s,o),this._currentPlacementIndex=i.length-1,this._forceFullPlacement=n,this._showCollisionBoxes=a,this._done=!1}isDone(){return this._done}continuePlacement(e,t,i){let n=tC(),a=()=>!this._forceFullPlacement&&tC()-n>2;for(;this._currentPlacementIndex>=0;){let n=t[e[this._currentPlacementIndex]],r=this.placement.collisionIndex.transform.zoom;if(IE(n)&&n.layout&&(!n.minzoom||n.minzoom<=r)&&(!n.maxzoom||n.maxzoom>r)){if(this._inProgressLayer||=new tP(n),this._inProgressLayer.continuePlacement(i[n.source],this.placement,this._showCollisionBoxes,n,a))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(e){return this.placement.commit(e),this.placement}};const nP=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],aP=new Uint32Array(96);var rP=class e{static from(t){if(!t||void 0===t.byteLength||t.buffer)throw Error("Data must be an instance of ArrayBuffer or SharedArrayBuffer.");let[i,n]=new Uint8Array(t,0,2);if(219!==i)throw Error("Data does not appear to be in a KDBush format.");let a=n>>4;if(1!==a)throw Error(`Got v${a} data when expected v1.`);let r=nP[15&n];if(!r)throw Error("Unrecognized array type.");let[s]=new Uint16Array(t,2,1),[o]=new Uint32Array(t,4,1);return new e(o,s,r,void 0,t)}constructor(e,t=64,i=Float64Array,n=ArrayBuffer,a){if(isNaN(e)||e<0)throw Error(`Unexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+t,2),65535),this.ArrayType=i,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;let r=nP.indexOf(this.ArrayType),s=2*e*this.ArrayType.BYTES_PER_ELEMENT,o=e*this.IndexArrayType.BYTES_PER_ELEMENT,l=(8-o%8)%8;if(r<0)throw Error(`Unexpected typed array class: ${i}.`);if(a)this.data=a,this.ids=new this.IndexArrayType(a,8,e),this.coords=new i(a,8+o+l,2*e),this._pos=2*e,this._finished=!0;else{let a=this.data=new n(8+s+o+l);this.ids=new this.IndexArrayType(a,8,e),this.coords=new i(a,8+o+l,2*e),this._pos=0,this._finished=!1,new Uint8Array(a,0,2).set([219,16+r]),new Uint16Array(a,2,1)[0]=t,new Uint32Array(a,4,1)[0]=e}}add(e,t){let i=this._pos>>1;return this.ids[i]=i,this.coords[this._pos++]=e,this.coords[this._pos++]=t,i}finish(){let e=this._pos>>1;if(e!==this.numItems)throw Error(`Added ${e} items when expected ${this.numItems}.`);return sP(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,t,i,n){if(!this._finished)throw Error("Data not yet indexed - call index.finish().");let{ids:a,coords:r,nodeSize:s}=this;aP[0]=0,aP[1]=a.length-1,aP[2]=0;let o=3,l=[];for(;o>0;){let c=aP[--o],u=aP[--o],h=aP[--o];if(u-h<=s){for(let s=h;s<=u;s++){let o=r[2*s],c=r[2*s+1];o>=e&&o<=i&&c>=t&&c<=n&&l.push(a[s])}continue}let d=h+u>>1,p=r[2*d],m=r[2*d+1];p>=e&&p<=i&&m>=t&&m<=n&&l.push(a[d]),(0===c?e<=p:t<=m)&&(aP[o++]=h,aP[o++]=d-1,aP[o++]=1-c),(0===c?i>=p:n>=m)&&(aP[o++]=d+1,aP[o++]=u,aP[o++]=1-c)}return l}within(e,t,i){let n=[];return this.withinInto(e,t,i,n),n}withinInto(e,t,i,n){if(!this._finished)throw Error("Data not yet indexed - call index.finish().");let{ids:a,coords:r,nodeSize:s}=this;aP[0]=0,aP[1]=a.length-1,aP[2]=0;let o=3,l=0,c=i*i;for(;o>0;){let u=aP[--o],h=aP[--o],d=aP[--o];if(h-d<=s){for(let i=d;i<=h;i++)uP(r[2*i],r[2*i+1],e,t)<=c&&(n[l++]=a[i]);continue}let p=d+h>>1,m=r[2*p],g=r[2*p+1];uP(m,g,e,t)<=c&&(n[l++]=a[p]),(0===u?e-i<=m:t-i<=g)&&(aP[o++]=d,aP[o++]=p-1,aP[o++]=1-u),(0===u?e+i>=m:t+i>=g)&&(aP[o++]=p+1,aP[o++]=h,aP[o++]=1-u)}return l}};function sP(e,t,i,n,a,r){if(a-n<=i)return;let s=n+a>>1;oP(e,t,s,n,a,r),sP(e,t,i,n,s-1,1-r),sP(e,t,i,s+1,a,1-r)}function oP(e,t,i,n,a,r){for(;a>n;){if(a-n>600){let s=a-n+1,o=i-n+1,l=Math.log(s),c=.5*Math.exp(2*l/3),u=.5*Math.sqrt(l*c*(s-c)/s)*(o-s/2<0?-1:1);oP(e,t,i,Math.max(n,Math.floor(i-o*c/s+u)),Math.min(a,Math.floor(i+(s-o)*c/s+u)),r)}let s=t[2*i+r],o=n,l=a;for(lP(e,t,n,i),t[2*a+r]>s&&lP(e,t,n,a);o<l;){for(lP(e,t,o,l),o++,l--;t[2*o+r]<s;)o++;for(;t[2*l+r]>s;)l--}t[2*n+r]===s?lP(e,t,n,l):(l++,lP(e,t,l,a)),l<=i&&(n=l+1),i<=l&&(a=l-1)}}function lP(e,t,i,n){cP(e,i,n),cP(t,2*i,2*n),cP(t,2*i+1,2*n+1)}function cP(e,t,i){let n=e[t];e[t]=e[i],e[i]=n}function uP(e,t,i,n){let a=e-i,r=t-n;return a*a+r*r}const hP=.03125;var dP=class{constructor(e,t,i){this.tileID=e,this.bucketInstanceId=i,this._symbolsByKey={};let n=new Map;for(let e=0;e<t.length;e++){let i=t.get(e),a=i.key,r=n.get(a);r?r.push(i):n.set(a,[i])}for(let[e,t]of n){let i={positions:t.map(e=>({x:Math.floor(e.anchorX*hP),y:Math.floor(e.anchorY*hP)})),crossTileIDs:t.map(e=>e.crossTileID)};if(i.positions.length>128){let e=new rP(i.positions.length,16,Uint16Array);for(let{x:t,y:n}of i.positions)e.add(t,n);e.finish(),delete i.positions,i.index=e}this._symbolsByKey[e]=i}}getScaledCoordinates(e,t){let{x:i,y:n,z:a}=this.tileID.canonical,{x:r,y:s,z:o}=t.canonical,l=hP/2**(o-a),c=(r*Uu+e.anchorX)*l,u=(s*Uu+e.anchorY)*l,h=i*Uu*hP,d=n*Uu*hP;return{x:Math.floor(c-h),y:Math.floor(u-d)}}findMatches(e,t,i){let n=this.tileID.canonical.z<t.canonical.z?1:2**(this.tileID.canonical.z-t.canonical.z);for(let a=0;a<e.length;a++){let r=e.get(a);if(r.crossTileID)continue;let s=this._symbolsByKey[r.key];if(!s)continue;let o=this.getScaledCoordinates(r,t);s.index?this.findMatchesForIndexedEntry(s,r,o,n,i):s.positions&&this.findMatchesForNonIndexedEntry(s,r,o,n,i)}}findMatchesForIndexedEntry(e,t,i,n,a){let r=e.index.range(i.x-n,i.y-n,i.x+n,i.y+n),s=1/0;for(let t of r)t<s&&!a[e.crossTileIDs[t]]&&(s=t);if(s!==1/0){let i=e.crossTileIDs[s];a[i]=!0,t.crossTileID=i}}findMatchesForNonIndexedEntry(e,t,i,n,a){for(let r=0;r<e.positions.length;r++){let s=e.positions[r],o=e.crossTileIDs[r];if(Math.abs(s.x-i.x)<=n&&Math.abs(s.y-i.y)<=n&&!a[o]){a[o]=!0,t.crossTileID=o;break}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map(({crossTileIDs:e})=>e)}},pP=class{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}},mP=class{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(e){let t=Math.round((e-this.lng)/360);if(0!==t)for(let e in this.indexes){let i=this.indexes[e],n={};for(let e in i){let a=i[e];a.tileID=a.tileID.unwrapTo(a.tileID.wrap+t),n[a.tileID.key]=a}this.indexes[e]=n}this.lng=e}addBucket(e,t,i){if(this.indexes[e.overscaledZ]?.[e.key]){if(this.indexes[e.overscaledZ][e.key].bucketInstanceId===t.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(e.overscaledZ,this.indexes[e.overscaledZ][e.key])}for(let e=0;e<t.symbolInstances.length;e++){t.symbolInstances.get(e).crossTileID=0}this.usedCrossTileIDs[e.overscaledZ]||={};let n=this.usedCrossTileIDs[e.overscaledZ];for(let i in this.indexes){let a=this.indexes[i];if(Number(i)>e.overscaledZ)for(let i in a){let r=a[i];r.tileID.isChildOf(e)&&r.findMatches(t.symbolInstances,e,n)}else{let r=a[e.scaledTo(Number(i)).key];r&&r.findMatches(t.symbolInstances,e,n)}}for(let e=0;e<t.symbolInstances.length;e++){let a=t.symbolInstances.get(e);a.crossTileID||(a.crossTileID=i.generate(),n[a.crossTileID]=!0)}return void 0===this.indexes[e.overscaledZ]&&(this.indexes[e.overscaledZ]={}),this.indexes[e.overscaledZ][e.key]=new dP(e,t.symbolInstances,t.bucketInstanceId),!0}removeBucketCrossTileIDs(e,t){for(let i of t.getCrossTileIDsLists())for(let t of i)delete this.usedCrossTileIDs[e][t]}removeStaleBuckets(e){let t=!1;for(let i in this.indexes){let n=this.indexes[i];for(let a in n)e[n[a].bucketInstanceId]||(this.removeBucketCrossTileIDs(i,n[a]),delete n[a],t=!0)}return t}},gP=class{constructor(){this.layerIndexes={},this.crossTileIDs=new pP,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(e,t,i){let n=this.layerIndexes[e.id];void 0===n&&(n=this.layerIndexes[e.id]=new mP);let a=!1,r={};n.handleWrapJump(i);for(let i of t){let t=i.getBucket(e);e.id===t?.layerIds[0]&&(t.bucketInstanceId||=(this.maxBucketInstanceId+=1,this.maxBucketInstanceId),n.addBucket(i.tileID,t,this.crossTileIDs)&&(a=!0),r[t.bucketInstanceId]=!0)}return n.removeStaleBuckets(r)&&(a=!0),a}pruneUnusedLayers(e){let t={};for(let i of e)t[i]=!0;for(let e in this.layerIndexes)t[e]||delete this.layerIndexes[e]}},fP="void main() {fragColor=vec4(1.0);}";const AP={prelude:_P("#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;layout(std140) uniform ProjectionUBO {highp mat4 u_projection_matrix;highp mat4 u_projection_fallback_matrix;highp vec4 u_projection_tile_mercator_coords;highp vec4 u_projection_clipping_plane;highp float u_projection_transition;highp int u_projection_clip_antimeridian;};layout(std140) uniform FrameUBO {highp vec2 u_units_to_pixels;highp vec2 u_world_size;highp float u_camera_to_center_distance;highp float u_symbol_fade_change;highp float u_aspect_ratio;highp float u_device_pixel_ratio;highp vec2 u_viewport_size;highp vec2 u_pixel_extrude_scale;highp float u_pitch;};","#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 uint packedOpacity) {return vec2(float(packedOpacity >> 1u)/127.0,float(packedOpacity & 1u));}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 highp sampler2D u_depth;layout(std140) uniform TerrainUBO {highp mat4 u_terrain_matrix;highp vec4 u_terrain_unpack;highp float u_terrain_dim;highp float u_terrain_exaggeration;};\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(ivec2 pos) {\n#ifdef TERRAIN3D\nvec4 rgb=(texelFetch(u_terrain,pos,0)*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+2.0;vec2 f=fract(coord);ivec2 c=ivec2(floor(coord));ivec2 hi=textureSize(u_terrain,0)-1;float tl=ele(clamp(c,ivec2(0),hi));float tr=ele(clamp(c+ivec2(1,0),ivec2(0),hi));float bl=ele(clamp(c+ivec2(0,1),ivec2(0),hi));float br=ele(clamp(c+ivec2(1,1),ivec2(0),hi));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;\n#define PROJECTION_UBO\nlayout(std140) uniform ProjectionUBO {highp mat4 u_projection_matrix;highp mat4 u_projection_fallback_matrix;highp vec4 u_projection_tile_mercator_coords;highp vec4 u_projection_clipping_plane;highp float u_projection_transition;highp int u_projection_clip_antimeridian;};layout(std140) uniform FrameUBO {highp vec2 u_units_to_pixels;highp vec2 u_world_size;highp float u_camera_to_center_distance;highp float u_symbol_fade_change;highp float u_aspect_ratio;highp float u_device_pixel_ratio;highp vec2 u_viewport_size;highp vec2 u_pixel_extrude_scale;highp float u_pitch;};"),projectionMercator:_P("\nvoid clipAntimeridian() {}","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:_P("in highp float v_projection_tile_x;void clipAntimeridian() {if (u_projection_clip_antimeridian !=0 && (v_projection_tile_x < 0.0 || v_projection_tile_x >=8192.0)) {discard;}}","#define GLOBE_RADIUS 6371008.8\n#ifndef PROJECTION_UBO\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;\n#endif\nout highp float v_projection_tile_x;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 t=exp(PI-(mercator_pos_y*PI*2.0));return (2.0*t)/(t*t+1.0);}float projectLineThickness(float tileY) {float thickness=1.0/circumferenceRatioAtTileY(tileY);if (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;float spherical_x=mercator_pos.x*PI*2.0+PI;float t=exp(PI-(mercator_pos.y*PI*2.0));float t2=t*t;float denom=t2+1.0;float sin_sy=(t2-1.0)/denom;float cos_sy=(2.0*t)/denom;vec3 pos=vec3(sin(spherical_x)*cos_sy,sin_sy,cos(spherical_x)*cos_sy\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) {v_projection_tile_x=posInTile.x;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) {v_projection_tile_x=posInTile.x;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:_P("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}","layout(location=0) in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),backgroundPattern:_P("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;layout(location=0) 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:_P("in vec3 v_data;flat in float v_visibility;\n#pragma maplibre: define highp vec4 color\n#pragma maplibre: define mediump float radius\n#pragma maplibre: define lowp float blur\n#pragma maplibre: define lowp float opacity\n#pragma maplibre: define highp vec4 stroke_color\n#pragma maplibre: define mediump float stroke_width\n#pragma maplibre: define lowp float stroke_opacity\nvoid main() {\n#pragma maplibre: initialize highp vec4 color\n#pragma maplibre: initialize mediump float radius\n#pragma maplibre: initialize lowp float blur\n#pragma maplibre: initialize lowp float opacity\n#pragma maplibre: initialize highp vec4 stroke_color\n#pragma maplibre: initialize mediump float stroke_width\n#pragma maplibre: 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 vec2 u_translate;layout(location=0) in ivec2 a_pos;out vec3 v_data;flat out float v_visibility;\n#pragma maplibre: define highp vec4 color\n#pragma maplibre: define mediump float radius\n#pragma maplibre: define lowp float blur\n#pragma maplibre: define lowp float opacity\n#pragma maplibre: define highp vec4 stroke_color\n#pragma maplibre: define mediump float stroke_width\n#pragma maplibre: define lowp float stroke_opacity\nvoid main(void) {\n#pragma maplibre: initialize highp vec4 color\n#pragma maplibre: initialize mediump float radius\n#pragma maplibre: initialize lowp float blur\n#pragma maplibre: initialize lowp float opacity\n#pragma maplibre: initialize highp vec4 stroke_color\n#pragma maplibre: initialize mediump float stroke_width\n#pragma maplibre: initialize lowp float stroke_opacity\nivec2 pos_raw=a_pos+32768;vec2 extrude=vec2(pos_raw & 7)/7.0*2.0-1.0;vec2 circle_center=vec2(pos_raw >> 3)+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:_P(fP,"layout(location=0) in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),heatmap:_P("uniform highp float u_intensity;in vec2 v_extrude;\n#pragma maplibre: define highp float weight\n#define GAUSS_COEF 0.3989422804014327\nvoid main() {\n#pragma maplibre: 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;layout(location=0) in ivec2 a_pos;out vec2 v_extrude;\n#pragma maplibre: define highp float weight\n#pragma maplibre: 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 maplibre: initialize highp float weight\n#pragma maplibre: initialize mediump float radius\nivec2 pos_raw=a_pos+32768;vec2 unscaled_extrude=vec2(pos_raw & 7)/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=vec2(pos_raw >> 3);\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:_P("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;layout(location=0) in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world_size,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"),collisionBox:_P("flat in float v_placed;flat 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;}}","layout(location=0) in vec2 a_anchor_pos;layout(location=1) in vec2 a_placed;layout(location=2) in vec2 a_box_real;flat out float v_placed;flat 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:_P("flat in float v_radius;in vec2 v_extrude;flat 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;}","layout(location=0) in vec2 a_pos;layout(location=1) in float a_radius;layout(location=2) in vec2 a_flags;flat out float v_radius;out vec2 v_extrude;flat 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:_P("#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) {vec4 data=texelFetch(u_elevation_stops,ivec2(stop,0),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;layout(location=0) in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=projectTile(a_pos,a_pos);highp vec2 epsilon=2.0/u_dimension;float scale=(u_dimension.x-4.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:_P("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);}","layout(location=0) 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:_P(fP,"layout(location=0) 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:_P("#pragma maplibre: define highp vec4 color\n#pragma maplibre: define lowp float opacity\nvoid main() {\n#pragma maplibre: initialize highp vec4 color\n#pragma maplibre: initialize lowp float opacity\nfragColor=color*opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_fill_translate;layout(location=0) in vec2 a_pos;\n#pragma maplibre: define highp vec4 color\n#pragma maplibre: define lowp float opacity\nvoid main() {\n#pragma maplibre: initialize highp vec4 color\n#pragma maplibre: initialize lowp float opacity\nif (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}gl_Position=projectTile(a_pos+u_fill_translate,a_pos);}"),fillOutline:_P("in vec2 v_pos;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma maplibre: define highp vec4 outline_color\n#pragma maplibre: define lowp float opacity\nvoid main() {\n#pragma maplibre: initialize highp vec4 outline_color\n#pragma maplibre: 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_fill_translate;layout(location=0) in vec2 a_pos;out vec2 v_pos;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma maplibre: define highp vec4 outline_color\n#pragma maplibre: define lowp float opacity\nvoid main() {\n#pragma maplibre: initialize highp vec4 outline_color\n#pragma maplibre: initialize lowp float opacity\nif (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}gl_Position=projectTile(a_pos+u_fill_translate,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world_size;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n}"),fillOutlinePattern:_P("uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;uniform bool u_sdf_pattern;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 maplibre: define lowp float opacity\n#pragma maplibre: define highp vec4 color\n#pragma maplibre: define lowp vec4 pattern_from\n#pragma maplibre: define lowp vec4 pattern_to\nvoid main() {\n#pragma maplibre: initialize lowp float opacity\n#pragma maplibre: initialize highp vec4 color\n#pragma maplibre: initialize mediump vec4 pattern_from\n#pragma maplibre: 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);if (u_sdf_pattern) {highp float sdf_edge=(256.0-64.0)/256.0;highp float sdf_gamma_a=max(fwidth(color1.a)*0.5,1.0/255.0/16.0);highp float sdf_gamma_b=max(fwidth(color2.a)*0.5,1.0/255.0/16.0);float sdf_alpha_a=smoothstep(sdf_edge-sdf_gamma_a,sdf_edge+sdf_gamma_a,color1.a);float sdf_alpha_b=smoothstep(sdf_edge-sdf_gamma_b,sdf_edge+sdf_gamma_b,color2.a);fragColor=mix(color*sdf_alpha_a,color*sdf_alpha_b,u_fade)*alpha*opacity;} else {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_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;layout(location=0) 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 maplibre: define lowp float opacity\n#pragma maplibre: define highp vec4 color\n#pragma maplibre: define lowp vec4 pattern_from\n#pragma maplibre: define lowp vec4 pattern_to\n#pragma maplibre: define lowp float pixel_ratio_from\n#pragma maplibre: define lowp float pixel_ratio_to\nvoid main() {\n#pragma maplibre: initialize lowp float opacity\n#pragma maplibre: initialize highp vec4 color\n#pragma maplibre: initialize mediump vec4 pattern_from\n#pragma maplibre: initialize mediump vec4 pattern_to\n#pragma maplibre: initialize lowp float pixel_ratio_from\n#pragma maplibre: initialize lowp float pixel_ratio_to\nif (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}vec2 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_size;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n}"),fillPattern:_P("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform vec2 u_texsize;uniform float u_fade;uniform bool u_sdf_pattern;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;\n#pragma maplibre: define lowp float opacity\n#pragma maplibre: define highp vec4 color\n#pragma maplibre: define lowp vec4 pattern_from\n#pragma maplibre: define lowp vec4 pattern_to\nvoid main() {\n#pragma maplibre: initialize lowp float opacity\n#pragma maplibre: initialize highp vec4 color\n#pragma maplibre: initialize mediump vec4 pattern_from\n#pragma maplibre: 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);if (u_sdf_pattern) {highp float sdf_edge=(256.0-64.0)/256.0;highp float sdf_gamma_a=max(fwidth(color1.a)*0.5,1.0/255.0/16.0);highp float sdf_gamma_b=max(fwidth(color2.a)*0.5,1.0/255.0/16.0);float sdf_alpha_a=smoothstep(sdf_edge-sdf_gamma_a,sdf_edge+sdf_gamma_a,color1.a);float sdf_alpha_b=smoothstep(sdf_edge-sdf_gamma_b,sdf_edge+sdf_gamma_b,color2.a);fragColor=mix(color*sdf_alpha_a,color*sdf_alpha_b,u_fade)*opacity;} else {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;layout(location=0) in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;\n#pragma maplibre: define lowp float opacity\n#pragma maplibre: define highp vec4 color\n#pragma maplibre: define lowp vec4 pattern_from\n#pragma maplibre: define lowp vec4 pattern_to\n#pragma maplibre: define lowp float pixel_ratio_from\n#pragma maplibre: define lowp float pixel_ratio_to\nvoid main() {\n#pragma maplibre: initialize lowp float opacity\n#pragma maplibre: initialize highp vec4 color\n#pragma maplibre: initialize mediump vec4 pattern_from\n#pragma maplibre: initialize mediump vec4 pattern_to\n#pragma maplibre: initialize lowp float pixel_ratio_from\n#pragma maplibre: initialize lowp float pixel_ratio_to\nif (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}vec2 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:_P("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;layout(location=0) in vec2 a_pos;layout(location=1) in ivec4 a_normal_ed;\n#ifdef TERRAIN3D\nlayout(location=2) in vec2 a_centroid;\n#endif\nout vec4 v_color;\n#pragma maplibre: define highp float base\n#pragma maplibre: define highp float height\n#pragma maplibre: define highp vec4 color\nvoid main() {\n#pragma maplibre: initialize highp float base\n#pragma maplibre: initialize highp float height\n#pragma maplibre: initialize highp vec4 color\nvec3 normal=vec3(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=float(a_normal_ed.x & 1);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:_P("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 maplibre: define lowp float base\n#pragma maplibre: define lowp float height\n#pragma maplibre: define lowp vec4 pattern_from\n#pragma maplibre: define lowp vec4 pattern_to\n#pragma maplibre: define lowp float pixel_ratio_from\n#pragma maplibre: define lowp float pixel_ratio_to\nvoid main() {\n#pragma maplibre: initialize lowp float base\n#pragma maplibre: initialize lowp float height\n#pragma maplibre: initialize mediump vec4 pattern_from\n#pragma maplibre: initialize mediump vec4 pattern_to\n#pragma maplibre: initialize lowp float pixel_ratio_from\n#pragma maplibre: 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;layout(location=0) in vec2 a_pos;layout(location=1) in ivec4 a_normal_ed;\n#ifdef TERRAIN3D\nlayout(location=2) in 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 maplibre: define lowp float base\n#pragma maplibre: define lowp float height\n#pragma maplibre: define lowp vec4 pattern_from\n#pragma maplibre: define lowp vec4 pattern_to\n#pragma maplibre: define lowp float pixel_ratio_from\n#pragma maplibre: define lowp float pixel_ratio_to\nvoid main() {\n#pragma maplibre: initialize lowp float base\n#pragma maplibre: initialize lowp float height\n#pragma maplibre: initialize mediump vec4 pattern_from\n#pragma maplibre: initialize mediump vec4 pattern_to\n#pragma maplibre: initialize lowp float pixel_ratio_from\n#pragma maplibre: 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=vec3(a_normal_ed.xyz);float edgedistance=float(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=float(a_normal_ed.x & 1);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=a_normal_ed.x==1 && a_normal_ed.y==0 && a_normal_ed.z==16384\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:_P("#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(ivec2 texel) {vec4 data=texelFetch(u_image,texel,0)*255.0;data.a=-1.0;return dot(data,u_unpack);}void main() {ivec2 pos=ivec2(gl_FragCoord.xy)+ivec2(1);float tileSize=u_dimension.x-4.0;float a=getElevation(pos+ivec2(-1,-1));float b=getElevation(pos+ivec2(0,-1));float c=getElevation(pos+ivec2(1,-1));float d=getElevation(pos+ivec2(-1,0));float e=getElevation(pos);float f=getElevation(pos+ivec2(1,0));float g=getElevation(pos+ivec2(-1,1));float h=getElevation(pos+ivec2(0,1));float i=getElevation(pos+ivec2(1,1));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;layout(location=0) in vec2 a_pos;layout(location=1) 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:_P("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() {vec2 size=vec2(textureSize(u_image,0));vec2 texturePos=(v_pos*(size-2.0)+1.0)/size;vec4 pixel=texture(u_image,texturePos);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;layout(location=0) 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:_P("flat in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma maplibre: define highp vec4 color\n#pragma maplibre: define lowp float blur\n#pragma maplibre: define lowp float opacity\nvoid main() {\n#pragma maplibre: initialize highp vec4 color\n#pragma maplibre: initialize lowp float blur\n#pragma maplibre: initialize lowp float opacity\nclipAntimeridian();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);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\nlayout(location=0) in ivec2 a_pos_normal;layout(location=1) in uvec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;out vec2 v_normal;flat 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 maplibre: define highp vec4 color\n#pragma maplibre: define lowp float blur\n#pragma maplibre: define lowp float opacity\n#pragma maplibre: define mediump float gapwidth\n#pragma maplibre: define lowp float offset\n#pragma maplibre: define mediump float width\nvoid main() {\n#pragma maplibre: initialize highp vec4 color\n#pragma maplibre: initialize lowp float blur\n#pragma maplibre: initialize lowp float opacity\n#pragma maplibre: initialize mediump float gapwidth\n#pragma maplibre: initialize lowp float offset\n#pragma maplibre: initialize mediump float width\nif (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=vec2(ivec2(a_data.xy)-128);float a_direction=float(int(a_data.z & 3u)-1);v_linesofar=float((a_data.z >> 2u)+a_data.w*64u)*2.0;vec2 pos=vec2(a_pos_normal >> 1);mediump vec2 normal=vec2(a_pos_normal & 1);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:_P("uniform sampler2D u_image;flat 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 maplibre: define lowp float blur\n#pragma maplibre: define lowp float opacity\nvoid main() {\n#pragma maplibre: initialize lowp float blur\n#pragma maplibre: initialize lowp float opacity\nclipAntimeridian();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);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\nlayout(location=0) in ivec2 a_pos_normal;layout(location=1) in uvec4 a_data;layout(location=2) in float a_uv_x;layout(location=3) in float a_split_index;uniform vec2 u_translation;uniform mediump float u_ratio;uniform float u_image_height;out vec2 v_normal;flat 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 maplibre: define lowp float blur\n#pragma maplibre: define lowp float opacity\n#pragma maplibre: define mediump float gapwidth\n#pragma maplibre: define lowp float offset\n#pragma maplibre: define mediump float width\nvoid main() {\n#pragma maplibre: initialize lowp float blur\n#pragma maplibre: initialize lowp float opacity\n#pragma maplibre: initialize mediump float gapwidth\n#pragma maplibre: initialize lowp float offset\n#pragma maplibre: initialize mediump float width\nif (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=vec2(ivec2(a_data.xy)-128);float a_direction=float(int(a_data.z & 3u)-1);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=vec2(a_pos_normal >> 1);mediump vec2 normal=vec2(a_pos_normal & 1);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:_P("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;in vec2 v_normal;flat in vec2 v_width2;in float v_linesofar;in float v_gamma_scale;flat in float v_width;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma maplibre: define lowp vec4 pattern_from\n#pragma maplibre: define lowp vec4 pattern_to\n#pragma maplibre: define lowp float pixel_ratio_from\n#pragma maplibre: define lowp float pixel_ratio_to\n#pragma maplibre: define lowp float blur\n#pragma maplibre: define lowp float opacity\nvoid main() {\n#pragma maplibre: initialize mediump vec4 pattern_from\n#pragma maplibre: initialize mediump vec4 pattern_to\n#pragma maplibre: initialize lowp float pixel_ratio_from\n#pragma maplibre: initialize lowp float pixel_ratio_to\n#pragma maplibre: initialize lowp float blur\n#pragma maplibre: initialize lowp float opacity\nclipAntimeridian();vec2 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\nlayout(location=0) in ivec2 a_pos_normal;layout(location=1) in uvec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;out vec2 v_normal;flat out vec2 v_width2;out float v_linesofar;out float v_gamma_scale;flat out float v_width;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma maplibre: define lowp float blur\n#pragma maplibre: define lowp float opacity\n#pragma maplibre: define lowp float offset\n#pragma maplibre: define mediump float gapwidth\n#pragma maplibre: define mediump float width\n#pragma maplibre: define lowp float floorwidth\n#pragma maplibre: define lowp vec4 pattern_from\n#pragma maplibre: define lowp vec4 pattern_to\n#pragma maplibre: define lowp float pixel_ratio_from\n#pragma maplibre: define lowp float pixel_ratio_to\nvoid main() {\n#pragma maplibre: initialize lowp float blur\n#pragma maplibre: initialize lowp float opacity\n#pragma maplibre: initialize lowp float offset\n#pragma maplibre: initialize mediump float gapwidth\n#pragma maplibre: initialize mediump float width\n#pragma maplibre: initialize lowp float floorwidth\n#pragma maplibre: initialize mediump vec4 pattern_from\n#pragma maplibre: initialize mediump vec4 pattern_to\n#pragma maplibre: initialize lowp float pixel_ratio_from\n#pragma maplibre: initialize lowp float pixel_ratio_to\nif (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=vec2(ivec2(a_data.xy)-128);float a_direction=float(int(a_data.z & 3u)-1);float a_linesofar=float((a_data.z >> 2u)+a_data.w*64u)*LINE_DISTANCE_SCALE;vec2 pos=vec2(a_pos_normal >> 1);mediump vec2 normal=vec2(a_pos_normal & 1);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:_P("uniform lowp float u_lineatlas_width;uniform sampler2D u_image;uniform float u_mix;in vec2 v_normal;flat 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 maplibre: define highp vec4 color\n#pragma maplibre: define lowp float blur\n#pragma maplibre: define lowp float opacity\n#pragma maplibre: define mediump float width\n#pragma maplibre: define lowp float floorwidth\n#pragma maplibre: define mediump vec4 dasharray_from\n#pragma maplibre: define mediump vec4 dasharray_to\nvoid main() {\n#pragma maplibre: initialize highp vec4 color\n#pragma maplibre: initialize lowp float blur\n#pragma maplibre: initialize lowp float opacity\n#pragma maplibre: initialize mediump float width\n#pragma maplibre: initialize lowp float floorwidth\n#pragma maplibre: initialize mediump vec4 dasharray_from\n#pragma maplibre: initialize mediump vec4 dasharray_to\nclipAntimeridian();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 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);float sdfgamma=(u_lineatlas_width/256.0/u_device_pixel_ratio)/min(dasharray_from.w,dasharray_to.w);alpha*=smoothstep(0.5-sdfgamma/floorwidth,0.5+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\nlayout(location=0) in ivec2 a_pos_normal;layout(location=1) in uvec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;uniform float u_tileratio;uniform float u_crossfade_from;uniform float u_crossfade_to;uniform float u_lineatlas_height;out vec2 v_normal;flat 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 maplibre: define highp vec4 color\n#pragma maplibre: define lowp float blur\n#pragma maplibre: define lowp float opacity\n#pragma maplibre: define mediump float gapwidth\n#pragma maplibre: define lowp float offset\n#pragma maplibre: define mediump float width\n#pragma maplibre: define lowp float floorwidth\n#pragma maplibre: define mediump vec4 dasharray_from\n#pragma maplibre: define mediump vec4 dasharray_to\nvoid main() {\n#pragma maplibre: initialize highp vec4 color\n#pragma maplibre: initialize lowp float blur\n#pragma maplibre: initialize lowp float opacity\n#pragma maplibre: initialize mediump float gapwidth\n#pragma maplibre: initialize lowp float offset\n#pragma maplibre: initialize mediump float width\n#pragma maplibre: initialize lowp float floorwidth\n#pragma maplibre: initialize mediump vec4 dasharray_from\n#pragma maplibre: initialize mediump vec4 dasharray_to\nif (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=vec2(ivec2(a_data.xy)-128);float a_direction=float(int(a_data.z & 3u)-1);float a_linesofar=float((a_data.z >> 2u)+a_data.w*64u)*LINE_DISTANCE_SCALE;vec2 pos=vec2(a_pos_normal >> 1);mediump vec2 normal=vec2(a_pos_normal & 1);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\nfloat u_patternscale_a_x=u_tileratio/dasharray_from.w/u_crossfade_from;float u_patternscale_a_y=-dasharray_from.z/2.0/u_lineatlas_height;float u_patternscale_b_x=u_tileratio/dasharray_to.w/u_crossfade_to;float u_patternscale_b_y=-dasharray_to.z/2.0/u_lineatlas_height;v_tex_a=vec2(a_linesofar*u_patternscale_a_x/floorwidth,normal.y*u_patternscale_a_y+(float(dasharray_from.y)+0.5)/u_lineatlas_height);v_tex_b=vec2(a_linesofar*u_patternscale_b_x/floorwidth,normal.y*u_patternscale_b_y+(float(dasharray_to.y)+0.5)/u_lineatlas_height);v_width2=vec2(outset,inset);}"),lineGradientSDF:_P("uniform sampler2D u_image;uniform sampler2D u_image_dash;uniform float u_mix;uniform lowp float u_lineatlas_width;in vec2 v_normal;flat in vec2 v_width2;in vec2 v_tex_a;in vec2 v_tex_b;in float v_gamma_scale;in highp vec2 v_uv;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma maplibre: define lowp float blur\n#pragma maplibre: define lowp float opacity\n#pragma maplibre: define mediump float width\n#pragma maplibre: define lowp float floorwidth\n#pragma maplibre: define mediump vec4 dasharray_from\n#pragma maplibre: define mediump vec4 dasharray_to\nvoid main() {\n#pragma maplibre: initialize lowp float blur\n#pragma maplibre: initialize lowp float opacity\n#pragma maplibre: initialize mediump float width\n#pragma maplibre: initialize lowp float floorwidth\n#pragma maplibre: initialize mediump vec4 dasharray_from\n#pragma maplibre: initialize mediump vec4 dasharray_to\nclipAntimeridian();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);vec4 color=texture(u_image,v_uv);float sdfdist_a=texture(u_image_dash,v_tex_a).a;float sdfdist_b=texture(u_image_dash,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);float sdfgamma=(u_lineatlas_width/256.0)/min(dasharray_from.w,dasharray_to.w);float dash_alpha=smoothstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);fragColor=color*(alpha*dash_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\nlayout(location=0) in ivec2 a_pos_normal;layout(location=1) in uvec4 a_data;layout(location=2) in float a_uv_x;layout(location=3) in float a_split_index;uniform vec2 u_translation;uniform mediump float u_ratio;uniform float u_image_height;uniform float u_tileratio;uniform float u_crossfade_from;uniform float u_crossfade_to;uniform float u_lineatlas_height;out vec2 v_normal;flat out vec2 v_width2;out float v_gamma_scale;out highp vec2 v_uv;out vec2 v_tex_a;out vec2 v_tex_b;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma maplibre: define lowp float blur\n#pragma maplibre: define lowp float opacity\n#pragma maplibre: define mediump float gapwidth\n#pragma maplibre: define lowp float offset\n#pragma maplibre: define mediump float width\n#pragma maplibre: define lowp float floorwidth\n#pragma maplibre: define mediump vec4 dasharray_from\n#pragma maplibre: define mediump vec4 dasharray_to\nvoid main() {\n#pragma maplibre: initialize lowp float blur\n#pragma maplibre: initialize lowp float opacity\n#pragma maplibre: initialize mediump float gapwidth\n#pragma maplibre: initialize lowp float offset\n#pragma maplibre: initialize mediump float width\n#pragma maplibre: initialize lowp float floorwidth\n#pragma maplibre: initialize mediump vec4 dasharray_from\n#pragma maplibre: initialize mediump vec4 dasharray_to\nif (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=vec2(ivec2(a_data.xy)-128);float a_direction=float(int(a_data.z & 3u)-1);float a_linesofar=float((a_data.z >> 2u)+a_data.w*64u)*LINE_DISTANCE_SCALE;float texel_height=1.0/u_image_height;float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=vec2(a_pos_normal >> 1);mediump vec2 normal=vec2(a_pos_normal & 1);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\nfloat u_patternscale_a_x=u_tileratio/dasharray_from.w/u_crossfade_from;float u_patternscale_a_y=-dasharray_from.z/2.0/u_lineatlas_height;float u_patternscale_b_x=u_tileratio/dasharray_to.w/u_crossfade_to;float u_patternscale_b_y=-dasharray_to.z/2.0/u_lineatlas_height;v_tex_a=vec2(a_linesofar*u_patternscale_a_x/floorwidth,normal.y*u_patternscale_a_y+(float(dasharray_from.y)+0.5)/u_lineatlas_height);v_tex_b=vec2(a_linesofar*u_patternscale_b_x/floorwidth,normal.y*u_patternscale_b_y+(float(dasharray_to.y)+0.5)/u_lineatlas_height);v_width2=vec2(outset,inset);}"),layerOpacity:_P("uniform sampler2D u_image;uniform float u_opacity;in vec2 v_pos;void main() {fragColor=texture(u_image,v_pos)*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(0.0);\n#endif\n}","layout(location=0) in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=vec4(a_pos.x*2.0-1.0,1.0-a_pos.y*2.0,0.0,1.0);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"),raster:_P("uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;in vec3 v_pos0;in vec3 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.xy/v_pos0.z);vec4 color1=texture(u_image1,v_pos1.xy/v_pos1.z);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 vec3 u_image_warp;uniform vec4 u_coords_top;uniform vec4 u_coords_bottom;layout(location=0) in vec2 a_pos;out vec3 v_pos0;out vec3 v_pos1;void main() {vec2 fractionalPos=a_pos/8192.0;vec2 topLeft=u_coords_top.xy;vec2 topRight=u_coords_top.zw;vec2 bottomLeft=u_coords_bottom.xy;vec2 bottomRight=u_coords_bottom.zw;vec2 bilinearPos=mix(mix(topLeft,topRight,fractionalPos.x),mix(bottomLeft,bottomRight,fractionalPos.x),fractionalPos.y);float denominator=dot(u_image_warp.xy,fractionalPos)+1.0;vec2 acrossTop=topRight-topLeft+u_image_warp.x*topRight;vec2 downLeft=bottomLeft-topLeft+u_image_warp.y*bottomLeft;vec2 projectivePos=(acrossTop*fractionalPos.x+downLeft*fractionalPos.y+topLeft)/denominator;vec2 position=mix(projectivePos,bilinearPos,u_image_warp.z);gl_Position=projectTile(position,position);vec2 texturePos=((fractionalPos-0.5)/u_buffer_scale)+0.5;\n#ifdef GLOBE\nif (a_pos.y <-32767.5) {texturePos.y=0.0;}if (a_pos.y > 32766.5) {texturePos.y=1.0;}\n#endif\nfloat perspectiveRatio=mix(1.0/denominator,1.0,u_image_warp.z);v_pos0=vec3(texturePos*perspectiveRatio,perspectiveRatio);vec2 parentPos=(texturePos*u_scale_parent)+u_tl_parent;v_pos1=vec3(parentPos*perspectiveRatio,perspectiveRatio);}"),symbolIcon:_P("uniform sampler2D u_texture;in vec2 v_tex;flat in float v_total_opacity;void main() {fragColor=texture(u_texture,v_tex)*v_total_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","layout(location=0) in vec4 a_pos_offset;layout(location=1) in uvec4 a_data;layout(location=2) in vec4 a_pixeloffset;layout(location=3) in vec3 a_projected_pos;layout(location=4) in uint a_fade_opacity;layout(location=5) in float a_height_offset;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 bool u_rotate_symbol;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;uniform bool u_is_offset;uniform bool u_height_anchor_ground;out vec2 v_tex;flat out float v_total_opacity;\n#pragma maplibre: define lowp float opacity\nvoid main() {\n#pragma maplibre: initialize lowp float opacity\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=vec2(a_data.xy);vec2 a_size=vec2(a_data.zw);float a_size_min=float(a_data.z >> 1u);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=a_height_offset+(u_height_anchor_ground ? get_elevation(a_pos) : 0.0);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);vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_symbol_fade_change :-u_symbol_fade_change;float visibility=calculate_visibility(projectedPoint);v_total_opacity=opacity*max(0.0,min(visibility,fade_opacity[0]+fade_change));if (v_total_opacity < 0.1){gl_Position=vec4(-2.,-2.,-2.,1.);return;}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);if (!u_is_offset) {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;}"),symbolSDF:_P("#define SDF_PX 8.0\nuniform bool u_is_halo;uniform bool u_is_plain;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform bool u_is_text;in vec2 v_data0;in vec3 v_data1;\n#pragma maplibre: define highp vec4 fill_color\n#pragma maplibre: define highp vec4 halo_color\n#pragma maplibre: define lowp float halo_width\n#pragma maplibre: define lowp float halo_blur\nvoid main() {\n#pragma maplibre: initialize highp vec4 fill_color\n#pragma maplibre: initialize highp vec4 halo_color\n#pragma maplibre: initialize lowp float halo_width\n#pragma maplibre: 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 total_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float inner_edge=(256.0-64.0)/256.0;lowp float dist=texture(u_texture,tex).a;lowp vec4 color_alpha_out_text,color_alpha_out_halo;if (u_is_plain){highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(inner_edge-gamma_scaled,inner_edge+gamma_scaled,dist);color_alpha_out_text=total_opacity*alpha*fill_color;}if (u_is_halo) {float gamma_halo=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);float inner_edge_halo=inner_edge+gamma_halo*gamma_scale;highp float gamma_scaled_halo=gamma_halo*gamma_scale;highp float alpha_halo=smoothstep(inner_edge_halo-gamma_scaled_halo,inner_edge_halo+gamma_scaled_halo,dist);highp float halo_edge=(6.0-halo_width/fontScale)/SDF_PX;alpha_halo= min(smoothstep(halo_edge-gamma_scaled_halo,halo_edge+gamma_scaled_halo,dist),1.0-alpha_halo);color_alpha_out_halo=total_opacity*alpha_halo*halo_color;}if (u_is_plain && u_is_halo) {fragColor=color_alpha_out_text+(1.-color_alpha_out_text.a)*color_alpha_out_halo;} else if (u_is_halo){fragColor=color_alpha_out_halo;} else {fragColor=color_alpha_out_text;}\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","layout(location=0) in vec4 a_pos_offset;layout(location=1) in uvec4 a_data;layout(location=2) in vec4 a_pixeloffset;layout(location=3) in vec3 a_projected_pos;layout(location=4) in uint a_fade_opacity;layout(location=5) in float a_height_offset;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 bool u_rotate_symbol;uniform vec2 u_texsize;uniform vec2 u_translation;uniform float u_pitched_scale;uniform bool u_is_offset;uniform bool u_height_anchor_ground;out vec2 v_data0;out vec3 v_data1;\n#pragma maplibre: define highp vec4 fill_color\n#pragma maplibre: define highp vec4 halo_color\n#pragma maplibre: define lowp float opacity\n#pragma maplibre: define lowp float halo_width\n#pragma maplibre: define lowp float halo_blur\nvoid main() {\n#pragma maplibre: initialize highp vec4 fill_color\n#pragma maplibre: initialize highp vec4 halo_color\n#pragma maplibre: initialize lowp float opacity\n#pragma maplibre: initialize lowp float halo_width\n#pragma maplibre: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=vec2(a_data.xy);vec2 a_size=vec2(a_data.zw);float a_size_min=float(a_data.z >> 1u);vec2 a_pxoffset=a_pixeloffset.xy/16.0;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=a_height_offset+(u_height_anchor_ground ? get_elevation(a_pos) : 0.0);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);vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_symbol_fade_change :-u_symbol_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));float total_opacity=opacity*interpolated_fade_opacity;if (total_opacity < 0.1){gl_Position=vec4(-2.,-2.,-2.,1.);return;}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);if (!u_is_offset) {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)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,total_opacity);}"),symbolTextAndIcon:_P("#define SDF_PX 8.0\n#define SDF 1.0\n#define ICON 0.0\nuniform bool u_is_halo;uniform bool u_is_text;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;in vec4 v_data0;in vec3 v_data1;flat in float v_is_sdf;\n#pragma maplibre: define highp vec4 fill_color\n#pragma maplibre: define highp vec4 halo_color\n#pragma maplibre: define lowp float halo_width\n#pragma maplibre: define lowp float halo_blur\nvoid main() {\n#pragma maplibre: initialize highp vec4 fill_color\n#pragma maplibre: initialize highp vec4 halo_color\n#pragma maplibre: initialize lowp float halo_width\n#pragma maplibre: initialize lowp float halo_blur\nfloat total_opacity=v_data1[2];if (v_is_sdf==ICON) {vec2 tex_icon=v_data0.zw;fragColor=texture(u_texture_icon,tex_icon)*total_opacity;\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;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;lowp float dist=texture(u_texture,tex).a;lowp vec4 color_alpha_out,color_alpha_out_halo;if (u_is_text) {highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);color_alpha_out=fill_color*(alpha*total_opacity);}if (u_is_halo) {highp float gamma_halo=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);lowp float buff_halo=(6.0-halo_width/fontScale)/SDF_PX;highp float gamma_scaled_halo=gamma_halo*gamma_scale;highp float alpha_halo=smoothstep(buff_halo-gamma_scaled_halo,buff_halo+gamma_scaled_halo,dist);color_alpha_out_halo=halo_color*(alpha_halo*total_opacity);}if (u_is_text && u_is_halo) {fragColor=color_alpha_out+(1.-color_alpha_out.a)*color_alpha_out_halo;} else if (u_is_halo) {fragColor=color_alpha_out_halo;} else {fragColor=color_alpha_out;}\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","layout(location=0) in vec4 a_pos_offset;layout(location=1) in uvec4 a_data;layout(location=2) in vec3 a_projected_pos;layout(location=3) in uint a_fade_opacity;layout(location=4) in float a_height_offset;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_rotate_symbol;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;uniform bool u_is_offset;uniform bool u_height_anchor_ground;out vec4 v_data0;out vec3 v_data1;flat out float v_is_sdf;\n#pragma maplibre: define highp vec4 fill_color\n#pragma maplibre: define highp vec4 halo_color\n#pragma maplibre: define lowp float opacity\n#pragma maplibre: define lowp float halo_width\n#pragma maplibre: define lowp float halo_blur\nvoid main() {\n#pragma maplibre: initialize highp vec4 fill_color\n#pragma maplibre: initialize highp vec4 halo_color\n#pragma maplibre: initialize lowp float opacity\n#pragma maplibre: initialize lowp float halo_width\n#pragma maplibre: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=vec2(a_data.xy);vec2 a_size=vec2(a_data.zw);float a_size_min=float(a_data.z >> 1u);float is_sdf=float(a_data.z & 1u);float ele=a_height_offset+(u_height_anchor_ground ? get_elevation(a_pos) : 0.0);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);vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_symbol_fade_change :-u_symbol_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));float total_opacity=opacity*interpolated_fade_opacity;if (total_opacity < 0.1){gl_Position=vec4(-2.,-2.,-2.,1.);return;}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);if (!u_is_offset) {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;v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec3(gamma_scale,size,total_opacity);v_is_sdf=is_sdf;}"),terrain:_P("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 && u_fog_ground_blend_opacity > 0.0 && 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;}}","layout(location=0) 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,ele-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:_P("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);}","layout(location=0) 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;}"),atmosphere:_P("#ifdef GL_ES\nprecision highp float;\n#endif\nin 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;}","layout(location=0) 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:_P("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;uniform vec3 u_globe_position;uniform float u_globe_radius;in vec3 v_view_direction;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 (u_sky_blend > 0.0) {vec3 ray=normalize(v_view_direction);float globe_distance=length(u_globe_position);float angle_to_globe_center=acos(clamp(dot(ray,u_globe_position)/globe_distance,-1.0,1.0));float horizon_angle=asin(min(u_globe_radius/globe_distance,1.0));blend=mix(blend,(angle_to_globe_center-horizon_angle)*u_camera_to_center_distance*u_device_pixel_ratio,u_sky_blend);}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);}","layout(location=0) in vec2 a_pos;uniform mat4 u_inv_proj_matrix;out vec3 v_view_direction;void main() {v_view_direction=(u_inv_proj_matrix*vec4(a_pos,0.0,1.0)).xyz;gl_Position=vec4(a_pos,1.0,1.0);}")};function _P(e,t){let i=/#pragma maplibre: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,n=t.match(/in ([\w]+) ([\w]+)/g),a=e.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),r=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),s=r?r.concat(a):a,o=n?n.length:0,l={};return e=e.replace(i,(e,t,i,n,a)=>(l[a]=!0,"define"===t?`\n#ifndef HAS_UNIFORM_u_${a}\nin ${i} ${n} ${a};\n#else\nuniform ${i} ${n} u_${a};\n#endif\n`:`\n#ifdef HAS_UNIFORM_u_${a}\n ${i} ${n} ${a} = u_${a};\n#endif\n`)),t=t.replace(i,(e,t,i,n,a)=>{let r="float"===n?"vec2":"vec4",s=a.match(/color/)?"color":r;return l[a]?"define"===t?`\n#ifndef HAS_UNIFORM_u_${a}\nuniform lowp float u_${a}_t;\nlayout(location = ${o++}) in ${i} ${r} a_${a};\nout ${i} ${n} ${a};\n#else\nuniform ${i} ${n} u_${a};\n#endif\n`:"vec4"===s?`\n#ifndef HAS_UNIFORM_u_${a}\n ${a} = a_${a};\n#else\n ${i} ${n} ${a} = u_${a};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${a}\n ${a} = unpack_mix_${s}(a_${a}, u_${a}_t);\n#else\n ${i} ${n} ${a} = u_${a};\n#endif\n`:"define"===t?`\n#ifndef HAS_UNIFORM_u_${a}\nuniform lowp float u_${a}_t;\nlayout(location = ${o++}) in ${i} ${r} a_${a};\n#else\nuniform ${i} ${n} u_${a};\n#endif\n`:"vec4"===s?`\n#ifndef HAS_UNIFORM_u_${a}\n ${i} ${n} ${a} = a_${a};\n#else\n ${i} ${n} ${a} = u_${a};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${a}\n ${i} ${n} ${a} = unpack_mix_${s}(a_${a}, u_${a}_t);\n#else\n ${i} ${n} ${a} = u_${a};\n#endif\n`}),{fragmentSource:e,vertexSource:t,staticAttributes:n,staticUniforms:s}}const vP="#define PROJECTION_MERCATOR",yP="mercator";var xP=class{constructor(){this._cachedMesh=null}get name(){return"mercator"}get useSubdivision(){return!1}get shaderVariantName(){return yP}get shaderDefine(){return vP}get shaderPreludeCode(){return AP.projectionMercator}get vertexShaderPreludeCode(){return AP.projectionMercator.vertexSource}get subdivisionGranularity(){return Qy.noSubdivision}get useGlobeControls(){return!1}get transitionState(){return 0}destroy(){}getMeshFromTileID(e,t,i,n,a){if(this._cachedMesh)return this._cachedMesh;let r=new r_;r.emplaceBack(0,0),r.emplaceBack(Uu,0),r.emplaceBack(0,Uu),r.emplaceBack(Uu,Uu);let s=e.createVertexBuffer(r,zT.members),o=S_.simpleSegment(0,0,4,2),l=new b_;l.emplaceBack(1,0,2),l.emplaceBack(1,2,3);let c=e.createIndexBuffer(l);return this._cachedMesh=new FT(s,c,o),this._cachedMesh}recalculate(){}hasTransition(){return!1}},bP=class e{constructor(e=0,t=0,i=0,n=0){if(isNaN(e)||e<0||isNaN(t)||t<0||isNaN(i)||i<0||isNaN(n)||n<0)throw Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=e,this.bottom=t,this.left=i,this.right=n}interpolate(e,t,i){return null!=t.top&&null!=e.top&&(this.top=Ep.number(e.top,t.top,i)),null!=t.bottom&&null!=e.bottom&&(this.bottom=Ep.number(e.bottom,t.bottom,i)),null!=t.left&&null!=e.left&&(this.left=Ep.number(e.left,t.left,i)),null!=t.right&&null!=e.right&&(this.right=Ep.number(e.right,t.right,i)),this}getCenter(e,t){return new Hc(sh((this.left+e-this.right)/2,0,e),sh((this.top+t-this.bottom)/2,0,t))}equals(e){return this.top===e.top&&this.bottom===e.bottom&&this.left===e.left&&this.right===e.right}clone(){return new e(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}};function wP(e,t){if(!e.renderWorldCopies||e.lngRange)return;let i=t.lng-e.center.lng;t.lng+=i>180?-360:i<-180?360:0}function EP(e){return Math.max(0,Math.floor(e))}var kP=class{constructor(e,t){this.applyConstrain=(e,t)=>null===this._constrainOverride?this._callbacks.defaultConstrain(e,t):this._constrainOverride(e,t),this._callbacks=e,this._tileSize=512,this._renderWorldCopies=void 0===t?.renderWorldCopies||!!t?.renderWorldCopies,this._minZoom=t?.minZoom||0,this._maxZoom=t?.maxZoom||22,this._minPitch=null==t?.minPitch?0:t?.minPitch,this._maxPitch=null==t?.maxPitch?60:t?.maxPitch,this._constrainOverride=t?.constrainOverride??null,this.setMaxBounds(),this._width=0,this._height=0,this._center=new Ex(0,0),this._elevation=0,this._zoom=0,this._tileZoom=EP(this._zoom),this._scale=dh(this._zoom),this._bearingInRadians=0,this._fovInRadians=.6435011087932844,this._pitchInRadians=0,this._rollInRadians=0,this._unmodified=!0,this._edgeInsets=new bP,this._minElevationForCurrentTile=0,this._autoCalculateNearFarZ=!0}apply(e,t,i){this._constrainOverride=e.constrainOverride,this._latRange=e.latRange,this._lngRange=e.lngRange,this._width=e.width,this._height=e.height,this._center=e.center,this._elevation=e.elevation,this._minElevationForCurrentTile=e.minElevationForCurrentTile,this._zoom=e.zoom,this._tileZoom=EP(this._zoom),this._scale=dh(this._zoom),this._bearingInRadians=e.bearingInRadians,this._fovInRadians=e.fovInRadians,this._pitchInRadians=e.pitchInRadians,this._rollInRadians=e.rollInRadians,this._unmodified=e.unmodified,this._edgeInsets=new bP(e.padding.top,e.padding.bottom,e.padding.left,e.padding.right),this._minZoom=e.minZoom,this._maxZoom=e.maxZoom,this._minPitch=e.minPitch,this._maxPitch=e.maxPitch,this._renderWorldCopies=e.renderWorldCopies,this._cameraToCenterDistance=e.cameraToCenterDistance,this._nearZ=e.nearZ,this._farZ=e.farZ,this._autoCalculateNearFarZ=!i&&e.autoCalculateNearFarZ,t&&this.constrainInternal(),this._calcMatrices()}get pixelsToClipSpaceMatrix(){return this._pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._clipSpaceToPixelsMatrix}get minElevationForCurrentTile(){return this._minElevationForCurrentTile}setMinElevationForCurrentTile(e){this._minElevationForCurrentTile=e}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(e){if(this._minZoom===e)return;this._minZoom=e;let t=this._unmodified;this.setZoom(this.applyConstrain(this._center,this.zoom).zoom),this._unmodified=t}get maxZoom(){return this._maxZoom}setMaxZoom(e){if(this._maxZoom===e)return;this._maxZoom=e;let t=this._unmodified;this.setZoom(this.applyConstrain(this._center,this.zoom).zoom),this._unmodified=t}get minPitch(){return this._minPitch}setMinPitch(e){if(this._minPitch===e)return;this._minPitch=e;let t=this._unmodified;this.setPitch(Math.max(this.pitch,e)),this._unmodified=t}get maxPitch(){return this._maxPitch}setMaxPitch(e){if(this._maxPitch===e)return;this._maxPitch=e;let t=this._unmodified;this.setPitch(Math.min(this.pitch,e)),this._unmodified=t}get renderWorldCopies(){return this._renderWorldCopies}setRenderWorldCopies(e){void 0===e?e=!0:null===e&&(e=!1),this._renderWorldCopies=e}get constrainOverride(){return this._constrainOverride}setConstrainOverride(e){void 0===e&&(e=null),this._constrainOverride!==e&&(this._constrainOverride=e,this.constrainInternal(),this._calcMatrices())}get worldSize(){return this._tileSize*this._scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new Hc(this._width,this._height)}get bearing(){return this._bearingInRadians/Math.PI*180}setBearing(e){let t=oh(e,-180,180)*Math.PI/180;this._bearingInRadians!==t&&(this._unmodified=!1,this._bearingInRadians=t,this._calcMatrices(),this._rotationMatrix=XM(),function(e,t,i){var n=t[0],a=t[1],r=t[2],s=t[3],o=Math.sin(i),l=Math.cos(i);e[0]=n*l+r*o,e[1]=a*l+s*o,e[2]=n*-o+r*l,e[3]=a*-o+s*l}(this._rotationMatrix,this._rotationMatrix,-this._bearingInRadians))}get rotationMatrix(){return this._rotationMatrix}get pitchInRadians(){return this._pitchInRadians}get pitch(){return this._pitchInRadians/Math.PI*180}setPitch(e){let t=sh(e,this.minPitch,this.maxPitch)/180*Math.PI;this._pitchInRadians!==t&&(this._unmodified=!1,this._pitchInRadians=t,this._calcMatrices())}get rollInRadians(){return this._rollInRadians}get roll(){return this._rollInRadians/Math.PI*180}setRoll(e){let t=e/180*Math.PI;this._rollInRadians!==t&&(this._unmodified=!1,this._rollInRadians=t,this._calcMatrices())}get fovInRadians(){return this._fovInRadians}get fov(){return Ch(this._fovInRadians)}setFov(e){e=sh(e,.1,150),this.fov!==e&&(this._unmodified=!1,this._fovInRadians=Mh(e),this._calcMatrices())}get zoom(){return this._zoom}setZoom(e){let t=this.applyConstrain(this._center,e).zoom;this._zoom!==t&&(this._unmodified=!1,this._zoom=t,this._tileZoom=Math.max(0,Math.floor(t)),this._scale=dh(t),this.constrainInternal(),this._calcMatrices())}get center(){return this._center}setCenter(e){(e.lat!==this._center.lat||e.lng!==this._center.lng)&&(this._unmodified=!1,this._center=e,this.constrainInternal(),this._calcMatrices())}get elevation(){return this._elevation}setElevation(e){e!==this._elevation&&(this._elevation=e,this.constrainInternal(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}setPadding(e){this._edgeInsets.equals(e)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,e,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(e,t){this._autoCalculateNearFarZ=!1,this._nearZ=e,this._farZ=t,this._calcMatrices()}clearNearFarZOverride(){this._autoCalculateNearFarZ=!0,this._calcMatrices()}isPaddingEqual(e){return this._edgeInsets.equals(e)}interpolatePadding(e,t,i){this._unmodified=!1,this._edgeInsets.interpolate(e,t,i),this.constrainInternal(),this._calcMatrices()}resize(e,t,i=!0){this._width=e,this._height=t,i&&this.constrainInternal(),this._calcMatrices()}getMaxBounds(){return 2!==this._latRange?.length||2!==this._lngRange?.length?null:new gT([this._lngRange[0],this._latRange[0]],[this._lngRange[1],this._latRange[1]])}setMaxBounds(e){e?(this._lngRange=[e.getWest(),e.getEast()],this._latRange=[e.getSouth(),e.getNorth()],this.constrainInternal()):(this._lngRange=null,this._latRange=[-Ih,Ih])}getCameraQueryGeometry(e,t){if(1===t.length)return[t[0],e];{let{minX:i,minY:n,maxX:a,maxY:r}=px.fromPoints(t).extend(e);return[new Hc(i,n),new Hc(a,n),new Hc(a,r),new Hc(i,r),new Hc(i,n)]}}constrainInternal(){if(!this.center||!this._width||!this._height||this._constraining)return;this._constraining=!0;let e=this._unmodified,{center:t,zoom:i}=this.applyConstrain(this.center,this.zoom);this.setCenter(t),this.setZoom(i),this._unmodified=e,this._constraining=!1}_calcMatrices(){if(this._pixelPerMeter=Tx(1,this.center.lat)*this.worldSize,!this._width||!this._height)return;this._pixelsToGLUnits=[2/this._width,-2/this._height];let e=eu(new Float64Array(16));au(e,e,[this._width/2,-this._height/2,1]),nu(e,e,[1,-1,0]),this._clipSpaceToPixelsMatrix=e,e=eu(new Float64Array(16)),au(e,e,[1,-1,1]),nu(e,e,[-1,-1,0]),au(e,e,[2/this._width,2/this._height,1]),this._pixelsToClipSpaceMatrix=e;let t=this.fovInRadians/2;this._cameraToCenterDistance=.5/Math.tan(t)*this._height,this._callbacks.calcMatrices()}calculateCenterFromCameraLngLatAlt(e,t,i,n){let a,r,s=void 0===i?this.bearing:i,o=n=void 0===n?this.pitch:n,{distanceToCenter:l,clampedElevation:c}=this._distanceToCenterFromAltElevationPitch(t,this.elevation,o),{x:u,y:h}=jx(o,s),d=Fx.fromLngLat(e,t),p=Ix(1,d.y),m=0;do{if(m+=1,m>10)break;r=l/p;let e=u*r,t=h*r;a=new Fx(d.x+e,d.y+t),p=1/a.meterInMercatorCoordinateUnits()}while(Math.abs(l-r*p)>1e-12);return{center:a.toLngLat(),elevation:c,zoom:ph(this.height/2/Math.tan(this.fovInRadians/2)/r/this.tileSize)}}recalculateZoomAndCenter(e){if(this.elevation-e===0)return;let t=1/this.worldSize,i=Tx(1,this.center.lat)*this.worldSize,n=Fx.fromLngLat(this.center,this.elevation),a=n.x/t,r=n.y/t,s=n.z/t,o=this.pitch,l=this.bearing,{x:c,y:u,z:h}=jx(o,l),d=this.cameraToCenterDistance,p=a+d*-c,m=r+d*-u,g=s+d*h,{distanceToCenter:f,clampedElevation:A}=this._distanceToCenterFromAltElevationPitch(g/i,e,o),_=f*i,v=new Fx((p+c*_)*t,(m+u*_)*t,0).toLngLat(),y=Tx(1,v.lat),x=ph(this.height/2/Math.tan(this.fovInRadians/2)/f/y/this.tileSize);this._elevation=A,this._center=v,this.setZoom(x)}_distanceToCenterFromAltElevationPitch(e,t,i){let n,a=-Math.cos(Mh(i)),r=e-t,s=t;return a*r>=0||Math.abs(a)<.1?(n=1e4,s=e+n*a):n=-r/a,{distanceToCenter:n,clampedElevation:s}}getCameraPoint(){let e=this.pitchInRadians,t=Math.tan(e)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new Hc(t*Math.sin(this.rollInRadians),t*Math.cos(this.rollInRadians)))}getMercatorTileCoordinates(e){if(!e)return[0,0,1,1];let t=e.canonical.z>=0?1<<e.canonical.z:2**e.canonical.z;return[e.canonical.x/t,e.canonical.y/t,1/t/Uu,1/t/Uu]}},SP=class{distanceToTile2d(e,t,i,n){let a=n,r=a.distanceX([e,t]),s=a.distanceY([e,t]);return Math.hypot(r,s)}getWrap(e,t,i){return i}getTileBoundingVolume(e,t,i,n){let a=Math.min(0,i),r=Math.max(0,i);if(n?.terrain){let i=new HE(e.z,t,e.z,e.x,e.y),s=n.terrain.getMinMaxElevation(i);a=s.minElevation??a,r=s.maxElevation??r}let s=1<<e.z;return new XT([t+e.x/s,e.y/s,a],[t+(e.x+1)/s,(e.y+1)/s,r])}allowVariableZoom(e,t){let i=sh(78.5-e.fov*(Math.abs(Math.cos(e.rollInRadians))*e.height+Math.abs(Math.sin(e.rollInRadians))*e.width)/e.height/2,0,60);return!!t.terrain||e.pitch>i}allowWorldCopies(){return!0}prepareNextFrame(){}};const MP=xA([{name:"a_pos3d",type:"Int16",components:3}]);var CP=class extends id{constructor(e){super(),this._lastTilesetChange=tC(),this.tileManager=e,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.deltaZoom=1,this.tileSize=e._source.tileSize*2**this.deltaZoom,e.usedForTerrain=!0,e.tileSize=this.tileSize}destruct(){this.tileManager.usedForTerrain=!1,this.tileManager.tileSize=null,this.releaseAllRTT()}getSource(){return this.tileManager._source}update(e,t){this.tileManager.update(e,t),this._renderableTilesKeys=[];let i={},n=!1;for(let a of iD(e,{tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:t,calculateTileZoom:this.tileManager._source.calculateTileZoom}))i[a.key]=!0,this._renderableTilesKeys.push(a.key),this._tiles[a.key]||(a.terrainRttPosMatrix32f=new Float32Array(16),cu(a.terrainRttPosMatrix32f,0,Uu,Uu,0,0,1),this._tiles[a.key]=new WT(a,this.tileSize),this._lastTilesetChange=tC(),n=!0);for(let e in this._tiles)i[e]||(this._tiles[e].releaseRTT(this.tileManager.map.painter),delete this._tiles[e],n=!0);return n}releaseRTT(e){for(let t in this._tiles){let i=this._tiles[t];(i.tileID.equals(e)||i.tileID.isChildOf(e)||e.isChildOf(i.tileID))&&i.releaseRTT(this.tileManager.map.painter)}}releaseAllRTT(){for(let e in this._tiles)this._tiles[e].releaseRTT(this.tileManager.map.painter)}getRenderableTiles(){return this._renderableTilesKeys.map(e=>this.getTileByID(e))}getTileByID(e){return this._tiles[e]}getTerrainCoords(e,t){return t?this._getTerrainCoordsForTileRanges(e,t):this._getTerrainCoordsForRegularTile(e)}_getTerrainCoordsForRegularTile(e){let t={};for(let i of this._renderableTilesKeys){let n=this._tiles[i].tileID,a=e.clone(),r=Gu();if(n.canonical.equals(e.canonical))cu(r,0,Uu,Uu,0,0,1);else if(n.canonical.isChildOf(e.canonical)){let t=n.canonical.z-e.canonical.z,i=n.canonical.x-(n.canonical.x>>t<<t),a=n.canonical.y-(n.canonical.y>>t<<t),s=Uu>>t;cu(r,0,s,s,0,0,1),nu(r,r,[-i*s,-a*s,0])}else{if(!e.canonical.isChildOf(n.canonical))continue;{let t=e.canonical.z-n.canonical.z,i=e.canonical.x-(e.canonical.x>>t<<t),a=e.canonical.y-(e.canonical.y>>t<<t),s=Uu>>t;cu(r,0,Uu,Uu,0,0,1),nu(r,r,[i*s,a*s,0]),au(r,r,[1/2**t,1/2**t,0])}}a.terrainRttPosMatrix32f=new Float32Array(r),t[i]=a}return t}_getTerrainCoordsForTileRanges(e,t){let i={};for(let n of this._renderableTilesKeys){let a=this._tiles[n].tileID;if(!this._isWithinTileRanges(a,t))continue;let r=e.clone(),s=Gu();if(a.canonical.z===e.canonical.z){let t=e.canonical.x-a.canonical.x+e.wrap*(1<<e.canonical.z),i=e.canonical.y-a.canonical.y;cu(s,0,Uu,Uu,0,0,1),nu(s,s,[t*Uu,i*Uu,0])}else if(a.canonical.z>e.canonical.z){let t=a.canonical.z-e.canonical.z,i=a.canonical.x-(a.canonical.x>>t<<t)+e.wrap*(1<<a.canonical.z),n=a.canonical.y-(a.canonical.y>>t<<t),r=e.canonical.x-(a.canonical.x>>t),o=e.canonical.y-(a.canonical.y>>t),l=Uu>>t;cu(s,0,l,l,0,0,1),nu(s,s,[-i*l+r*Uu,-n*l+o*Uu,0])}else{let t=e.canonical.z-a.canonical.z,i=e.canonical.x-(e.canonical.x>>t<<t)+e.wrap*(1<<e.canonical.z),n=e.canonical.y-(e.canonical.y>>t<<t),r=(e.canonical.x>>t)-a.canonical.x,o=(e.canonical.y>>t)-a.canonical.y,l=Uu<<t;cu(s,0,l,l,0,0,1),nu(s,s,[i*Uu+r*l,n*Uu+o*l,0])}r.terrainRttPosMatrix32f=new Float32Array(s),i[n]=r}return i}getSourceTile(e,t){let i=this.tileManager._source,n=e.overscaledZ-this.deltaZoom;if(n>i.maxzoom&&(n=i.maxzoom),n<i.minzoom)return;this._sourceTileCache[e.key]||=e.scaledTo(n).key;let a=this.findTileInCaches(this._sourceTileCache[e.key]);if(!a?.dem&&t)for(;n>=i.minzoom&&!a?.dem;)a=this.findTileInCaches(e.scaledTo(n--).key);return a}findTileInCaches(e){let t=this.tileManager.getTileByID(e);return t||(t=this.tileManager._outOfViewCache.getByKey(e),t)}anyTilesAfterTime(e=tC()){return this._lastTilesetChange>=e}_isWithinTileRanges(e,t){let i=t[e.canonical.z];return!!i&&(e.wrap>i.minWrap||e.wrap<i.maxWrap||e.canonical.x>=i.minTileXWrapped&&e.canonical.x<=i.maxTileXWrapped&&e.canonical.y>=i.minTileY&&e.canonical.y<=i.maxTileY)}};const TP=Uu*(1-1e-12);var DP=class{constructor(e,t,i,n="auto"){this._meshCache={},this.painter=e,this.tileManager=new CP(t),this.options=i,this.exaggeration="number"==typeof i.exaggeration?i.exaggeration:1,this._terrainSkirtLength=n,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache=new Map,this._elevationSamplerCache=new Map}destroy(){this._fbo&&=(this._fbo.destroy(),null),this._fboDepthTexture&&=(this._fboDepthTexture.destroy(),null),this._emptyDemTexture&&=(this._emptyDemTexture.destroy(),null),this._emptyDepthTexture&&=(this._emptyDepthTexture.destroy(),null);for(let e in this._meshCache)this._meshCache[e].destroy();this._meshCache={},this.tileManager.destruct()}getDEMElevation(e,t,i,n=Uu){let a=e.normalizeCoordinates(t,i,n);if(!a)return 0;let r=this.getElevationSampler(a.tileID);return r?r(a.x,a.y,n):0}getElevationForLngLatZoom(e,t){if(!VE(t,e.wrap()))return 0;let{tileID:i,mercatorX:n,mercatorY:a}=this._getOverscaledTileIDFromLngLatZoom(e,t);return this.getElevation(i,n%Uu,a%Uu,Uu)}getElevationForLngLat(e,t){let i=this.getCoverageIndex();if(i){let t=Fx.fromLngLat(e),n=IP(i,this.exaggeration,t.x,t.y);if(n.demLoaded)return n.elevation}let n=iD(t,{maxzoom:this.tileManager.maxzoom,minzoom:this.tileManager.minzoom,tileSize:512,terrain:this}),a=0;for(let e of n)e.canonical.z>a&&(a=Math.min(e.canonical.z,this.tileManager.maxzoom));return this.getElevationForLngLatZoom(e,a)}getElevation(e,t,i,n=Uu){return this.getDEMElevation(e,t,i,n)*this.exaggeration}resetElevationCache(){this._elevationSamplerCache.clear(),this._coverageIndex=void 0}getCoverageIndex(){return void 0===this._coverageIndex&&(this._coverageIndex=this._buildCoverageIndex()),this._coverageIndex}_buildCoverageIndex(){let e=[],t=new Map,i=0,n=0;for(let a of this.tileManager.getRenderableTiles()){if(!a)continue;let{canonical:r,wrap:s}=a.tileID;e.includes(r.z)||e.push(r.z);let o=this.getElevationSampler(a.tileID);t.set(`${s}/${r.z}/${r.x}/${r.y}`,o);let{minElevation:l,maxElevation:c}=this.getMinMaxElevation(a.tileID);i=Math.min(i,l??0),n=Math.max(n,c??0)}return 0===t.size?null:(e.sort((e,t)=>t-e),{zooms:e,samplerPerTile:t,minElevation:i-10,maxElevation:n+10})}getElevationSampler(e){let t=e.key,i=this._elevationSamplerCache.get(t);if(i)return i;let n=this.tileManager.getSourceTile(e,!0),a=n?.dem;if(!n||!a)return null;let r=this._getDEMTileMatrix(e,n),s=r[0]*a.dim,o=r[5]*a.dim,l=r[12]*a.dim,c=r[13]*a.dim,u=(e,t,i)=>{let n=8192===i?1:Uu/i;return a.sampleBilinear(e*n*s+l,t*n*o+c)};return this._elevationSamplerCache.set(t,u),u}_getDEMTileMatrix(e,t){let i=`${t.tileID.key}/${e.key}`,n=this._demMatrixCache.get(i);if(n)return n;let a=this.tileManager.getSource().maxzoom,r=e.canonical.z-t.tileID.canonical.z;e.overscaledZ>e.canonical.z&&(e.canonical.z>=a?r=e.canonical.z-a:yh("cannot calculate elevation if elevation maxzoom > source.maxzoom"));let s=e.canonical.x-(e.canonical.x>>r<<r),o=e.canonical.y-(e.canonical.y>>r<<r),l=function(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t[2],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}(new Float64Array(16),[1/(Uu<<r),1/(Uu<<r),0]);return nu(l,l,[s*Uu,o*Uu,0]),this._demMatrixCache.set(i,l),l}getTerrainData(e){if(!this._emptyDemTexture){let e=this.painter.context,t=new Hv({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new iy(e,t,e.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new iy(e,new Hv({width:1,height:1}),e.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=eu([])}let t=this.tileManager.getSourceTile(e,!0);if(t?.dem&&(!t.demTexture||t.needsTerrainPrepare)){let e=this.painter.context;t.demTexture||=this.painter.getTileTexture(t.dem.stride),t.demTexture?t.demTexture.update(t.dem.getPixels(),{premultiply:!1}):t.demTexture=new iy(e,t.dem.getPixels(),e.gl.RGBA,{premultiply:!1}),t.demTexture.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),t.needsTerrainPrepare=!1}let i=t?this._getDEMTileMatrix(e,t):this._emptyDemMatrix;return{u_depth:2,u_terrain:3,u_terrain_dim:t?.dem?.dim||1,u_terrain_matrix:i,u_terrain_unpack:t?.dem?.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(t?.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:t}}getFramebuffer(){let e=this.painter,t=e.width/devicePixelRatio,i=e.height/devicePixelRatio;return this._fbo&&(this._fbo.width!==t||this._fbo.height!==i)&&(this._fbo.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture),this._fboDepthTexture||(this._fboDepthTexture=new iy(e.context,{width:t,height:i,data:null},e.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(e.context.gl.NEAREST,e.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=e.context.createFramebuffer(t,i,!0,!1),this._fbo.depthAttachment.set(e.context.createRenderbuffer(e.context.gl.DEPTH_COMPONENT16,t,i))),this._fbo.colorAttachment.set(this._fboDepthTexture.texture),this._fbo}depthAtPoint(e){let t=new Uint8Array(4),i=this.painter.context,n=i.gl;return i.bindFramebuffer.set(this.getFramebuffer().framebuffer),n.readPixels(e.x,this.painter.height/devicePixelRatio-e.y-1,1,1,n.RGBA,n.UNSIGNED_BYTE,t),i.bindFramebuffer.set(null),(t[0]/16777216+t[1]/65536+t[2]/256+t[3])/256}getTerrainMesh(e){let t=this.painter.style.projection?.transitionState>0,i=t&&0===e.canonical.y,n=t&&e.canonical.y===(1<<e.canonical.z)-1,a=`m_${i?"n":""}_${n?"s":""}`;if(this._meshCache[a])return this._meshCache[a];let r=this.painter.context,s=new s_,o=new b_,l=this.meshSize,c=Uu/l,u=l*l;for(let e=0;e<=l;e++)for(let t=0;t<=l;t++)s.emplaceBack(t*c,e*c,0);for(let e=0;e<u;e+=l+1)for(let t=0;t<l;t++)o.emplaceBack(t+e,l+t+e+1,l+t+e+2),o.emplaceBack(t+e,l+t+e+2,t+e+1);"none"!==this._terrainSkirtLength&&this._buildSkirts(s,o,l,c,i,n);let h=new FT(r.createVertexBuffer(s,MP.members),r.createIndexBuffer(o),S_.simpleSegment(0,0,s.length,o.length));return this._meshCache[a]=h,h}getSkirtLength(e){return 2*Math.PI*wx/2**Math.max(e,0)/5}getMinTileElevationForLngLatZoom(e,t){if(!VE(t,e.wrap()))return 0;let{tileID:i}=this._getOverscaledTileIDFromLngLatZoom(e,t);return this.getMinMaxElevation(i).minElevation??0}getMinMaxElevation(e){let t=this.tileManager.getSourceTile(e,!0),i={minElevation:null,maxElevation:null};return t?.dem&&(i.minElevation=t.dem.min*this.exaggeration,i.maxElevation=t.dem.max*this.exaggeration),i}_getOverscaledTileIDFromLngLatZoom(e,t){let i=Fx.fromLngLat(e.wrap()),n=(1<<t)*Uu,a=i.x*n,r=i.y*n,s=Math.floor(a/Uu),o=Math.floor(r/Uu);return{tileID:new HE(t,0,t,s,o),mercatorX:a,mercatorY:r}}_buildSkirts(e,t,i,n,a,r){let s=e.length,o=s+(i+1),l=(i+1)*i,c=a?Yy:0,u=+!a,h=r?Jy:Uu,d=+!r;for(let t=0;t<=i;t++)e.emplaceBack(t*n,c,u);for(let t=0;t<=i;t++)e.emplaceBack(t*n,h,d);for(let e=0;e<i;e++)t.emplaceBack(l+e,o+e,o+e+1),t.emplaceBack(l+e,o+e+1,l+e+1),t.emplaceBack(0+e,s+e+1,s+e),t.emplaceBack(0+e,0+e+1,s+e+1);let p=e.length,m=p+2*(i+1);for(let t of[0,1])for(let a=0;a<=i;a++)for(let i of[0,1])e.emplaceBack(t*Uu,a*n,i);for(let e=0;e<2*i;e+=2)t.emplaceBack(p+e,p+e+1,p+e+3),t.emplaceBack(p+e,p+e+3,p+e+2),t.emplaceBack(m+e,m+e+3,m+e+1),t.emplaceBack(m+e,m+e+2,m+e+3)}};const PP={covered:!1,demLoaded:!1,elevation:0};function IP(e,t,i,n){if(n<0||n>=1)return PP;let a=Math.floor(i),r=i-a;for(let i of e.zooms){let s=1<<i,o=r*s,l=n*s,c=Math.floor(o),u=Math.floor(l),h=`${a}/${i}/${c}/${u}`;if(!e.samplerPerTile.has(h))continue;let d=e.samplerPerTile.get(h);return d?{covered:!0,demLoaded:!0,elevation:d(Math.min((o-c)*Uu,TP),Math.min((l-u)*Uu,TP),Uu)*t}:{covered:!0,demLoaded:!1,elevation:0}}return PP}function FP(e,t){return e.covered&&t<=e.elevation+1e-6}function zP(e,t,i,n,a){for(let r=0;r<40&&n-i>a;r++){let a=(i+n)/2;t(e,a)?n=a:i=a}return{lo:i,hi:n}}var RP=class e{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(e){this._helper.setMinZoom(e)}setMaxZoom(e){this._helper.setMaxZoom(e)}setMinPitch(e){this._helper.setMinPitch(e)}setMaxPitch(e){this._helper.setMaxPitch(e)}setRenderWorldCopies(e){this._helper.setRenderWorldCopies(e)}setBearing(e){this._helper.setBearing(e)}setPitch(e){this._helper.setPitch(e)}setRoll(e){this._helper.setRoll(e)}setFov(e){this._helper.setFov(e)}setZoom(e){this._helper.setZoom(e)}setCenter(e){this._helper.setCenter(e)}setElevation(e){this._helper.setElevation(e)}setMinElevationForCurrentTile(e){this._helper.setMinElevationForCurrentTile(e)}setPadding(e){this._helper.setPadding(e)}interpolatePadding(e,t,i){this._helper.interpolatePadding(e,t,i)}isPaddingEqual(e){return this._helper.isPaddingEqual(e)}resize(e,t,i=!0){this._helper.resize(e,t,i)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(e){this._helper.setMaxBounds(e)}setConstrainOverride(e){this._helper.setConstrainOverride(e)}overrideNearFarZ(e,t){this._helper.overrideNearFarZ(e,t)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(e){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),e)}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 constrainOverride(){return this._helper.constrainOverride}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(e){}constructor(e){this._posMatrixCache=new Map,this._alignedPosMatrixCache=new Map,this._fogMatrixCacheF32=new Map,this.defaultConstrain=(e,t)=>{t=sh(+t,this.minZoom,this.maxZoom);let i={center:new Ex(e.lng,e.lat),zoom:t},n=this._helper._lngRange;!this._helper._renderWorldCopies&&null===n&&(n=[-179.9999999999,180-1e-10]);let a=this.tileSize*dh(i.zoom),r=0,s=a,o=0,l=a,c=0,u=0,{x:h,y:d}=this.size;if(this._helper._latRange){let e=this._helper._latRange;r=Cx(e[1])*a,s=Cx(e[0])*a,s-r<d&&(c=d/(s-r))}n&&(o=oh(Mx(n[0])*a,0,a),l=oh(Mx(n[1])*a,0,a),l<o&&(l+=a),l-o<h&&(u=h/(l-o)));let p,m,{x:g,y:f}=Lx(a,e),A=Math.max(u||0,c||0);if(A){let e=new Hc(u?(l+o)/2:g,c?(s+r)/2:f);return i.center=Bx(a,e).wrap(),i.zoom+=ph(A),i}if(this._helper._latRange){let e=d/2;f-e<r&&(m=r+e),f+e>s&&(m=s-e)}if(n){let e=(o+l)/2,t=g;this._helper._renderWorldCopies&&(t=oh(g,e-a/2,e+a/2));let i=h/2;t-i<o&&(p=o+i),t+i>l&&(p=l-i)}if(void 0!==p||void 0!==m){let e=new Hc(p??g,m??f);i.center=Bx(a,e).wrap()}return i},this.applyConstrain=(e,t)=>this._helper.applyConstrain(e,t),this._helper=new kP({calcMatrices:()=>this._calcMatrices(),defaultConstrain:(e,t)=>this.defaultConstrain(e,t)},e),this._coveringTilesDetailsProvider=new SP}clone(){let t=new e;return t.apply(this,!1),t}apply(e,t,i){this._helper.apply(e,t,i)}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(e){let t=[new GE(0,e)];if(this._helper._renderWorldCopies){let i=this.screenPointToMercatorCoordinate(new Hc(0,0)),n=this.screenPointToMercatorCoordinate(new Hc(this._helper._width,0)),a=this.screenPointToMercatorCoordinate(new Hc(this._helper._width,this._helper._height)),r=this.screenPointToMercatorCoordinate(new Hc(0,this._helper._height)),s=Math.floor(Math.min(i.x,n.x,a.x,r.x)),o=Math.floor(Math.max(i.x,n.x,a.x,r.x));for(let i=s-1;i<=o+1;i++)0!==i&&t.push(new GE(i,e))}return t}getCameraFrustum(){return QT.fromInvProjectionMatrix(this._invViewProjMatrix,this.worldSize)}getClippingPlane(){return null}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(e){let t=this.screenPointToLocation(this.centerPoint,e),i=e?e.getElevationForLngLat(t,this):0;this._helper.recalculateZoomAndCenter(i)}setLocationAtPoint(e,t,i=this.elevation){let n=i-this.elevation,a=this.screenPointToMercatorCoordinateAtZ(t,n),r=this.screenPointToMercatorCoordinateAtZ(this.centerPoint,0),s=Fx.fromLngLat(e),o=new Fx(s.x-(a.x-r.x),s.y-(a.y-r.y));this.setCenter(o?.toLngLat()),this._helper._renderWorldCopies&&this.setCenter(this.center.wrap())}locationToScreenPoint(e,t){return t?this.coordinatePoint(Fx.fromLngLat(e),t.getElevationForLngLat(e,this),this._pixelMatrix3D):this.coordinatePoint(Fx.fromLngLat(e))}screenPointToLocation(e,t){return this.screenPointToMercatorCoordinate(e,t)?.toLngLat()}screenPointToLocationAtElevation(e,t){return this.screenPointToMercatorCoordinateAtZ(e,t-this.elevation)?.toLngLat()}screenPointToMercatorCoordinate(e,t){if(t){let i=this.screenTerrainPointToMercatorCoordinate(e,t);if(null!=i)return i}return this.screenPointToMercatorCoordinateAtZ(e)}screenTerrainPointToMercatorCoordinate(e,t){let i=t.getCoverageIndex();if(!i)return null;let{near:n,far:a}=this.getRaySegmentFromPixel(e),r=this.worldSize,s=a[0]-n[0],o=a[1]-n[1],l=a[2]-n[2],c={index:i,exaggeration:t.exaggeration,near:n,dx:s,dy:o,dz:l,worldSize:r},u=0,h=1;if(0===l){if(n[2]>i.maxElevation||n[2]<i.minElevation)return null}else{let e=(i.maxElevation-n[2])/l,t=(i.minElevation-n[2])/l;if(u=Math.max(u,Math.min(e,t)),h=Math.min(h,Math.max(e,t)),u>h)return null}let d=Math.hypot(s,o),p=sh(Math.ceil(d*(h-u)/4),1,512),m=0,g=!BP(c,0);for(let e=0;e<=p;e++){let t=u+(h-u)*e/p;if(g){if(BP(c,t)){let{lo:e,hi:i}=zP(c,BP,m,t,.001/d),a=LP(c,e),u=LP(c,i),h=n[2]+e*l-a.elevation,p=n[2]+i*l-u.elevation,g=a.covered&&h>p?sh(e+h*(i-e)/(h-p),e,i):i;return new Fx((n[0]+g*s)/r,(n[1]+g*o)/r,LP(c,g).elevation)}}else g=!BP(c,t);m=t}return null}getRaySegmentFromPixel(e){let t=[e.x,e.y,0,1],i=[e.x,e.y,1,1];Mu(t,t,this._pixelMatrixInverse),Mu(i,i,this._pixelMatrixInverse);let n=t[3],a=i[3],r=this.elevation;return{near:[t[0]/n,t[1]/n,t[2]/n+r],far:[i[0]/a,i[1]/a,i[2]/a+r]}}screenPointToMercatorCoordinateAtZ(e,t){let i=t||0,{near:n,far:a}=this.getRaySegmentFromPixel(e),r=n[2]===a[2]?0:(i+this.elevation-n[2])/(a[2]-n[2]);return new Fx(Ep.number(n[0],a[0],r)/this.worldSize,Ep.number(n[1],a[1],r)/this.worldSize,i)}coordinatePoint(e,t=0,i=this._pixelMatrix){let n=[e.x*this.worldSize,e.y*this.worldSize,t,1];return Mu(n,n,i),new Hc(n[0]/n[3],n[1]/n[3])}getBounds(){let e=Math.max(0,this._helper._height/2-Ox(this));return(new gT).extend(this.screenPointToLocation(new Hc(0,e))).extend(this.screenPointToLocation(new Hc(this._helper._width,e))).extend(this.screenPointToLocation(new Hc(this._helper._width,this._helper._height))).extend(this.screenPointToLocation(new Hc(0,this._helper._height)))}isPointOnMapSurface(e,t){return t?null!=this.screenTerrainPointToMercatorCoordinate(e,t):e.y>this.height/2-Ox(this)}calculatePosMatrix(e,t=!1,i=!1){let n=e.key??WE(e.wrap,e.canonical.z,e.canonical.z,e.canonical.x,e.canonical.y),a=t?this._alignedPosMatrixCache:this._posMatrixCache;if(a.has(n)){let e=a.get(n);return i?e.f32:e.f64}let r=Ux(e,this.worldSize);iu(r,t?this._alignedProjMatrix:this._viewProjMatrix,r);let s={f64:r,f32:new Float32Array(r)};return a.set(n,s),i?s.f32:s.f64}calculateFogMatrix(e){let t=e.key,i=this._fogMatrixCacheF32;if(i.has(t))return i.get(t);let n=Ux(e,this.worldSize);return iu(n,this._fogMatrix,n),i.set(t,new Float32Array(n)),i.get(t)}calculateCenterFromCameraLngLatAlt(e,t,i,n){return this._helper.calculateCenterFromCameraLngLatAlt(e,t,i,n)}calculateCameraOptionsFromTo(e,t,i,n){let a=Fx.fromLngLat(e,t),r=Fx.fromLngLat(i,n),s=r.x-a.x,o=r.y-a.y,l=r.z-a.z,c=Math.hypot(s,o,l);if(0===c)throw Error("Can't calculate camera options with same From and To");let u=Math.hypot(s,o),h=ph(this.cameraToCenterDistance/c/this.tileSize),d=Ch(Math.atan2(s,-o)),p=Ch(Math.acos(u/c));return p=l<0?90-p:90+p,{center:r.toLngLat(),elevation:n,zoom:h,pitch:p,bearing:d}}_calculateNearFarZIfNeeded(e,t,i){if(!this._helper.autoCalculateNearFarZ)return;let n=Math.min(this.elevation,this.minElevationForCurrentTile,this.getCameraAltitude()-100),a=e-n*this._helper._pixelPerMeter/Math.cos(t),r=n<0?a:e,s=Math.PI/2+this.pitchInRadians,o=Mh(this.fov)*(Math.abs(Math.cos(Mh(this.roll)))*this.height+Math.abs(Math.sin(Mh(this.roll)))*this.width)/this.height*(.5+i.y/this.height),l=Math.sin(o)*r/Math.sin(sh(Math.PI-s-o,.01,Math.PI-.01)),c=Ox(this),u=Math.atan(c/this._helper.cameraToCenterDistance),h=Mh(.75),d=u>h?2*u*(.5+i.y/(2*c)):h,p=Math.sin(d)*r/Math.sin(sh(Math.PI-s-d,.01,Math.PI-.01)),m=Math.min(l,p);this._helper._farZ=1.01*(Math.cos(Math.PI/2-t)*m+r),this._helper._nearZ=this._helper._height/50}_calcMatrices(){let e,t=this.centerOffset,i=Lx(this.worldSize,this.center),n=i.x,a=i.y,r=Mh(Math.min(this.pitch,zx)),s=Math.max(this._helper.cameraToCenterDistance/2,this._helper.cameraToCenterDistance+this._helper._elevation*this._helper._pixelPerMeter/Math.cos(r));this._calculateNearFarZIfNeeded(s,r,t),e=new Float64Array(16),lu(e,this.fovInRadians,this._helper._width/this._helper._height,this._helper._nearZ,this._helper._farZ),this._invProjMatrix=new Float64Array(16),function(e,t){e[0]=1/t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1/t[5],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=0,e[11]=1/t[14],e[12]=0,e[13]=0,e[14]=-1,e[15]=t[10]/t[14]}(this._invProjMatrix,e),e[8]=2*-t.x/this._helper._width,e[9]=2*t.y/this._helper._height,this._projectionMatrix=$c(e),au(e,e,[1,-1,1]),nu(e,e,[0,0,-this._helper.cameraToCenterDistance]),ou(e,e,-this.rollInRadians),ru(e,e,this.pitchInRadians),ou(e,e,-this.bearingInRadians),nu(e,e,[-n,-a,0]),this._mercatorMatrix=au([],e,[this.worldSize,this.worldSize,this.worldSize]),au(e,e,[1,1,this._helper._pixelPerMeter]),this._pixelMatrix=iu(new Float64Array(16),this.clipSpaceToPixelsMatrix,e),nu(e,e,[0,0,-this.elevation]),this._viewProjMatrix=e,this._invViewProjMatrix=tu([],e);let o=[0,0,-1,1];Mu(o,o,this._invViewProjMatrix),this._cameraPosition=[o[0]/o[3],o[1]/o[3],o[2]/o[3]],this._fogMatrix=new Float64Array(16),lu(this._fogMatrix,this.fovInRadians,this.width/this.height,s,this._helper._farZ),this._fogMatrix[8]=2*-t.x/this.width,this._fogMatrix[9]=2*t.y/this.height,au(this._fogMatrix,this._fogMatrix,[1,-1,1]),nu(this._fogMatrix,this._fogMatrix,[0,0,-this.cameraToCenterDistance]),ou(this._fogMatrix,this._fogMatrix,-this.rollInRadians),ru(this._fogMatrix,this._fogMatrix,this.pitchInRadians),ou(this._fogMatrix,this._fogMatrix,-this.bearingInRadians),nu(this._fogMatrix,this._fogMatrix,[-n,-a,0]),au(this._fogMatrix,this._fogMatrix,[1,1,this._helper._pixelPerMeter]),nu(this._fogMatrix,this._fogMatrix,[0,0,-this.elevation]),this._pixelMatrix3D=iu(new Float64Array(16),this.clipSpaceToPixelsMatrix,e);let l=this._helper._width%2/2,c=this._helper._height%2/2,u=Math.cos(this.bearingInRadians),h=Math.sin(-this.bearingInRadians),d=n-Math.round(n)+u*l+h*c,p=a-Math.round(a)+u*c+h*l,m=new Float64Array(e);if(nu(m,m,[d>.5?d-1:d,p>.5?p-1:p,0]),this._alignedProjMatrix=m,e=tu(new Float64Array(16),this._pixelMatrix),!e)throw Error("failed to invert matrix");this._pixelMatrixInverse=e,this._clearMatrixCaches()}_clearMatrixCaches(){this._posMatrixCache.clear(),this._alignedPosMatrixCache.clear(),this._fogMatrixCacheF32.clear()}maxPitchScaleFactor(){if(!this._pixelMatrixInverse)return 1;let e=this.screenPointToMercatorCoordinate(new Hc(0,0)),t=[e.x*this.worldSize,e.y*this.worldSize,0,1];return Mu(t,t,this._pixelMatrix)[3]/this._helper.cameraToCenterDistance}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return Math.cos(this.pitchInRadians)*this.cameraToCenterDistance/this.pixelsPerMeter+this.elevation}getCameraLngLat(){let e=Tx(1,this.center.lat)*this.worldSize,t=this._helper.cameraToCenterDistance/e;return Nx(this.center,this.elevation,this.pitch,this.bearing,t).toLngLat()}lngLatToCameraDepth(e,t){let i=Fx.fromLngLat(e),n=[i.x*this.worldSize,i.y*this.worldSize,t,1];return Mu(n,n,this._viewProjMatrix),n[2]/n[3]}getProjectionData(e){let t,{overscaledTileID:i,aligned:n,applyTerrainMatrix:a}=e,r=this._helper.getMercatorTileCoordinates(i),s=i?this.calculatePosMatrix(i,n,!0):null;return t=i?.terrainRttPosMatrix32f&&a?i.terrainRttPosMatrix32f:s||Wu(),{mainMatrix:t,tileMercatorCoords:r,clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:t,clipAntimeridian:!1}}isLocationOccluded(e){return!1}getPixelScale(){return 1}getCircleRadiusCorrection(){return 1}getPitchedTextCorrection(e,t,i){return 1}transformLightDirection(e){return hu(e)}getRayDirectionFromPixel(e){throw Error("Not implemented.")}projectTileCoordinates(e,t,i,n){let a,r=this.calculatePosMatrix(i);null==n?(a=[e,t,0,1],UD(a,a,r)):(a=[e,t,n,1],Mu(a,a,r));let s=a[3];return{point:new Hc(a[0]/s,a[1]/s),signedDistanceFromCamera:s,isOccluded:!1}}populateCache(e){for(let t of e)this.calculatePosMatrix(t)}getProjectionDataForCustomLayer(e=!0){let t=new HE(0,0,0,0,0),i=this.getProjectionData({overscaledTileID:t,applyGlobeMatrix:e}),n=Ux(t,this.worldSize);iu(n,this._viewProjMatrix,n);let a=[Uu,Uu,this.worldSize/this._helper.pixelsPerMeter],r=Gu();return au(r,n,a),{...i,tileMercatorCoords:[0,0,1,1],fallbackMatrix:r,mainMatrix:r}}getFastPathSimpleProjectionMatrix(e){return this.calculatePosMatrix(e)}};function LP(e,t){return IP(e.index,e.exaggeration,(e.near[0]+t*e.dx)/e.worldSize,(e.near[1]+t*e.dy)/e.worldSize)}function BP(e,t){return FP(LP(e,t),e.near[2]+t*e.dz)}function OP(){yh("Map cannot fit within canvas with the given bounds, padding, and/or offset.")}function UP(e){if(e.useSlerp)if(e.k<1){let t=Ph(e.startEulerAngles.roll,e.startEulerAngles.pitch,e.startEulerAngles.bearing),i=Ph(e.endEulerAngles.roll,e.endEulerAngles.pitch,e.endEulerAngles.bearing),n=new Float64Array(4);Du(n,t,i,e.k);let a=function(e){let t=new Float64Array(9);!function(e,t){var i=t[0],n=t[1],a=t[2],r=t[3],s=i+i,o=n+n,l=a+a,c=i*s,u=n*s,h=n*o,d=a*s,p=a*o,m=a*l,g=r*s,f=r*o,A=r*l;e[0]=1-h-m,e[3]=u-A,e[6]=d+f,e[1]=u+A,e[4]=1-c-m,e[7]=p-g,e[2]=d-f,e[5]=p+g,e[8]=1-c-h}(t,e);let i,n,a=Ch(-Math.asin(sh(t[2],-1,1)));return Math.hypot(t[5],t[8])<.001?(i=0,n=-Ch(Math.atan2(t[3],t[4]))):(i=Ch(0===t[5]&&0===t[8]?0:Math.atan2(t[5],t[8])),n=Ch(0===t[1]&&0===t[0]?0:Math.atan2(t[1],t[0]))),{roll:i,pitch:a+90,bearing:n}}(n);e.tr.setRoll(a.roll),e.tr.setPitch(a.pitch),e.tr.setBearing(a.bearing)}else e.tr.setRoll(e.endEulerAngles.roll),e.tr.setPitch(e.endEulerAngles.pitch),e.tr.setBearing(e.endEulerAngles.bearing);else e.tr.setRoll(Ep.number(e.startEulerAngles.roll,e.endEulerAngles.roll,e.k)),e.tr.setPitch(Ep.number(e.startEulerAngles.pitch,e.endEulerAngles.pitch,e.k)),e.tr.setBearing(Ep.number(e.startEulerAngles.bearing,e.endEulerAngles.bearing,e.k))}function NP(e,t,i,n,a){let r=a.padding,s=Lx(a.worldSize,i.getNorthWest()),o=Lx(a.worldSize,i.getNorthEast()),l=Lx(a.worldSize,i.getSouthEast()),c=Lx(a.worldSize,i.getSouthWest()),u=Mh(-n),h=s.rotate(u),d=o.rotate(u),p=l.rotate(u),m=c.rotate(u),g=new Hc(Math.max(h.x,d.x,m.x,p.x),Math.max(h.y,d.y,m.y,p.y)),f=new Hc(Math.min(h.x,d.x,m.x,p.x),Math.min(h.y,d.y,m.y,p.y)),A=g.sub(f),_=a.width-(r.left+r.right+t.left+t.right),v=a.height-(r.top+r.bottom+t.top+t.bottom),y=_/A.x,x=v/A.y;if(x<0||y<0)return void OP();let b=Math.min(ph(a.scale*Math.min(y,x)),e.maxZoom),w=Hc.convert(e.offset),E=new Hc((t.left-t.right)/2,(t.top-t.bottom)/2).rotate(Mh(n)),k=w.add(E).mult(a.scale/dh(b));return{center:Bx(a.worldSize,s.add(l).div(2).sub(k)),zoom:b,bearing:n}}var jP=class{get useGlobeControls(){return!1}handlePanInertia(e,t){let i=e.mag(),n=Math.abs(Ox(t));return{easingOffset:e.mult(Math.min(.75*n/i,1)),easingCenter:t.center}}handleMapControlsRollPitchBearingZoom(e,t){e.bearingDelta&&t.setBearing(t.bearing+e.bearingDelta),e.pitchDelta&&t.setPitch(t.pitch+e.pitchDelta),e.rollDelta&&t.setRoll(t.roll+e.rollDelta),e.zoomDelta&&t.setZoom(t.zoom+e.zoomDelta)}handleMapControlsPan(e,t,i){e.around.distSqr(t.centerPoint)<.01||t.setLocationAtPoint(i,e.around,e.aroundElevation)}cameraForBoxAndBearing(e,t,i,n,a){return NP(e,t,i,n,a)}handleJumpToCenterZoom(e,t){let i=void 0===t.zoom?e.zoom:+t.zoom;e.zoom!==i&&e.setZoom(+t.zoom),void 0!==t.center&&e.setCenter(Ex.convert(t.center))}handleEaseTo(e,t){let i=e.zoom,n=e.padding,a={roll:e.roll,pitch:e.pitch,bearing:e.bearing},r={roll:void 0===t.roll?e.roll:t.roll,pitch:void 0===t.pitch?e.pitch:t.pitch,bearing:void 0===t.bearing?e.bearing:t.bearing},s=void 0!==t.zoom,o=!e.isPaddingEqual(t.padding),l=!1,c=s?+t.zoom:e.zoom,u=e.centerPoint.add(t.offsetAsPoint),h=e.screenPointToLocation(u),{center:d,zoom:p}=e.applyConstrain(Ex.convert(t.center||h),c??i);wP(e,d);let m=Lx(e.worldSize,h),g=Lx(e.worldSize,d).sub(m),f=dh(p-i);return l=p!==i,{easeFunc:s=>{if(l&&e.setZoom(Ep.number(i,p,s)),Th(a,r)||UP({startEulerAngles:a,endEulerAngles:r,tr:e,k:s,useSlerp:a.roll!=r.roll}),o&&(e.interpolatePadding(n,t.padding,s),u=e.centerPoint.add(t.offsetAsPoint)),t.around)e.setLocationAtPoint(t.around,t.aroundPoint);else{let t=dh(e.zoom-i),n=(p>i?Math.min(2,f):Math.max(.5,f))**(1-s),a=Bx(e.worldSize,m.add(g.mult(s*n)).mult(t));e.setLocationAtPoint(e.renderWorldCopies?a.wrap():a,u)}},isZooming:l,elevationCenter:d}}handleFlyTo(e,t){let i=void 0!==t.zoom,n=e.zoom,a=e.applyConstrain(Ex.convert(t.center||t.locationAtOffset),i?+t.zoom:n),r=a.center,s=a.zoom;wP(e,r);let o=e.worldSize,l=Lx(o,t.locationAtOffset),c=Lx(o,r).sub(l),u=c.mag(),h=dh(s-n),d=void 0===t.minZoom?e.minZoom:+t.minZoom,p=Math.max(d,e.minZoom),m=Math.min(p,n,s),g=e.applyConstrain(r,m).zoom;return{easeFunc:(t,i,a,u)=>{e.setZoom(1===t?s:n+ph(i));let h=1===t?r:Bx(o,l.add(c.mult(a)));e.setLocationAtPoint(e.renderWorldCopies?h.wrap():h,u)},scaleOfZoom:h,targetCenter:r,scaleOfMinZoom:dh(g-n),pixelPathLength:u}}};let VP;const qP=new Qy({fill:new Xy(128,2),line:new Xy(512,0),tile:new Xy(128,32),stencil:new Xy(128,1),circle:3});var GP=class{constructor(){this._tileMeshCache={}}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 AP.projectionGlobe}get vertexShaderPreludeCode(){return AP.projectionMercator.vertexSource}get subdivisionGranularity(){return qP}get useGlobeControls(){return!0}destroy(){}_getMeshKey(e){return`${e.granularity.toString(36)}_${e.generateBorders?"b":""}${e.extendToNorthPole?"n":""}${e.extendToSouthPole?"s":""}`}getMeshFromTileID(e,t,i,n,a){let r=("stencil"===a?qP.stencil:qP.tile).getGranularityForZoomLevel(t.z),s=0===t.y&&n,o=t.y===(1<<t.z)-1&&n;return this._getMesh(e,{granularity:r,generateBorders:i,extendToNorthPole:s,extendToSouthPole:o})}_getMesh(e,t){let i=this._getMeshKey(t);if(i in this._tileMeshCache)return this._tileMeshCache[i];let n=RT(e,t);return this._tileMeshCache[i]=n,n}recalculate(e){}hasTransition(){return!1}},HP=class extends id{constructor(e,t){super(),this._transitionable=new Yf(VP||=new uA({type:new rA(ad.projection.type,"type")}),"projection",t),this.setProjection(e),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new Zf(0)),this._mercatorProjection=new xP,this._verticalPerspectiveProjection=new GP}get transitionState(){let e=this.properties.get("type");if("string"==typeof e&&"mercator"===e)return 0;if("string"==typeof e&&"vertical-perspective"===e)return 1;if(e instanceof hp){if(e.from===e.to)return"mercator"===e.from?0:1;if("vertical-perspective"===e.from&&"mercator"===e.to)return 1-e.transition;if("mercator"===e.from&&"vertical-perspective"===e.to)return e.transition}return 1}get useGlobeRendering(){return this.transitionState>0}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()}getMeshFromTileID(e,t,i,n,a){return this.currentProjection.getMeshFromTileID(e,t,i,n,a)}setProjection(e){this._transitionable.setValue("type",e?.type||"mercator")}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()||this.currentProjection.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}};function WP(e){let t=XP(e.worldSize,e.center.lat);return 2*Math.PI*t}function ZP(e,t,i,n,a){let r=1/(1<<a),s=t/Uu*r+n*r,o=eh((e/Uu*r+i*r)*Math.PI*2+Math.PI,2*Math.PI),l=2*Math.atan(Math.exp(Math.PI-s*Math.PI*2))-.5*Math.PI,c=Math.cos(l),u=new Float64Array(3);return u[0]=Math.sin(o)*c,u[1]=Math.sin(l),u[2]=Math.cos(o)*c,u}function KP(e){return function(e,t){let i=Math.cos(t),n=new Float64Array(3);return n[0]=Math.sin(e)*i,n[1]=Math.sin(t),n[2]=Math.cos(e)*i,n}(e.lng*Math.PI/180,e.lat*Math.PI/180)}function XP(e,t){return e/(2*Math.PI)/Math.cos(t*Math.PI/180)}function QP(e){let t=Mu(Vu(),[0,0,0,1],e.modelViewProjectionMatrix);return Mu(t,t,e.inverseProjectionMatrix),[t[0]/t[3],t[1]/t[3],t[2]/t[3]]}function YP(e){let t=Math.asin(e[1])/Math.PI*180,i=Math.sqrt(e[0]*e[0]+e[2]*e[2]);if(i>1e-6){let n=e[0]/i,a=e[2]/i,r=Math.acos(a),s=(n>0?r:-r)/Math.PI*180;return new Ex(oh(s,-180,180),t)}return new Ex(0,t)}const JP=.98*Math.PI;function $P(e,t){let i=e.cameraPosition,n=du(i);if(n<=1)return e.screenPointToLocation(t);let a=qu();_u(a,i);let r=e.getRayDirectionFromPixel(t),s=-vu(r,a),o=qu();Au(o,r,a,s);let l=du(o);if(l<1e-9)return e.screenPointToLocation(t);let c=Math.atan2(l,s),u=.9*Math.asin(1/n);if(c<u)return e.screenPointToLocation(t);let h=n*Math.sin(u),d=Math.asin(sh(h,-1,1))-u,p=n*Math.cos(u)/Math.sqrt(Math.max(1-h*h,1e-12))-1,m=JP-d,g=c-u,f=d+p*g*m/(m+p*g),A=qu();fu(A,o,1/l);let _=qu();return fu(_,a,Math.cos(sh(f,0,JP))),Au(_,_,A,Math.sin(sh(f,0,JP))),_u(_,_),YP(_)}function eI(e,t,i,n,a=!0){let r=$P(e,i),s=t;if(n)s=$P(e,i.sub(n));else if(!e.isPointOnMapSurface(i))return;let o=KP(r),l=KP(s),c=function(e,t){return Pu(Vu(),-e.lng,-e.lat,t)}(e.center,e.bearing),u=yu(qu(),l,o),h=Math.sqrt(vu(u,u)),d=Math.acos(sh(vu(l,o),-1,1))/2,p=Math.sin(d),m=h?Iu(u[1]/h*p,-u[0]/h*p,u[2]/h*p,Math.cos(d)):Iu(0,0,0,1),{lng:g,lat:f,bearing:A}=function(e){let t=e[0],i=e[1],n=e[2],a=e[3];return{lng:180*-Math.atan2(2*(a*t+i*n),1-2*(t*t+i*i))/Math.PI,lat:180*-Math.asin(sh(2*(a*i-n*t),-1,1))/Math.PI,bearing:180*Math.atan2(2*(a*n+t*i),1-2*(i*i+n*n))/Math.PI}}(function(e,t,i){var n=t[0],a=t[1],r=t[2],s=t[3],o=i[0],l=i[1],c=i[2],u=i[3];return e[0]=n*u+s*o+a*c-r*l,e[1]=a*u+s*l+r*o-n*c,e[2]=r*u+s*c+n*l-a*o,e[3]=s*u-n*o-a*l-r*c,e}(Vu(),c,m)),_=e.center.lat,v=e.zoom,y=sh(f,-90,90),x=a?function(e,t,i,n){let a=e.center.lng,r=e.center.lat,s=r>=0?90:-90,o=e.locationToScreenPoint(new Ex(0,s)),l=t.x-o.x,c=t.y-o.y,u=l*l+c*c,h=sh(1-(Ih-Math.abs(r))/12,0,1),d=h*h*(3-2*h),p=eh(n-a+180,360)-180,m=0;if(d>0&&i){m=(s>0?1:-1)*((l*i.y-c*i.x)/Math.max(u,400))*180/Math.PI}return a+(1-d)*p+d*m}(e,i,n,g):g;e.setCenter(new Ex(oh(x,-180,180),y)),a||e.setBearing(A),e.setZoom(v+iI(_,e.center.lat))}function tI(e){return Math.cos(e*Math.PI/180)}function iI(e,t){let i=tI(e);return ph(tI(t)/i)}function nI(e,t){let i=e.rotate(t.bearingInRadians),n=t.zoom+iI(t.center.lat,0),a=ih(1/tI(t.center.lat),1/tI(Math.min(Math.abs(t.center.lat),60)),th(n,7,3,0,1)),r=function(e,t){return 360/WP({worldSize:e,center:{lat:t}})}(t.worldSize,t.center.lat);return new Ex(t.center.lng-i.x*r*a,sh(t.center.lat+i.y*r,-Ih,Ih))}function aI(e){let t=.5*e,i=Math.sin(t),n=Math.cos(t);return Math.log(i+n)-Math.log(n-i)}function rI(e,t,i,n){let a=e.lat+i*n;if(Math.abs(i)>1){let r=e.lat+i,s=(Math.sign(r)===Math.sign(e.lat)?Math.abs(e.lat):-Math.abs(e.lat))*Math.PI/180,o=Math.abs(e.lat+i)*Math.PI/180,l=aI(s+n*(o-s)),c=aI(s),u=(l-c)/(aI(o)-c),h=e.lng+t*u;return new Ex(h,a)}{let i=e.lng+t*n;return new Ex(i,a)}}function sI(e,t,i=1){let n=vu(e,t),a=i*i,r=qu(),s=qu();fu(s,t,n),ku(r,e,s);let o=a-vu(r,r);if(o<0)return null;let l=vu(e,e)-a,c=-n+(n<0?1:-1)*Math.sqrt(o),u=l/c,h=c;return{tMin:Math.min(u,h),tMax:Math.max(u,h)}}var oI=class{constructor(e){this._cachePrevious=new Map,this._cache=new Map,this._hadAnyChanges=!1,this._boundingVolumeFactory=e}swapBuffers(){if(!this._hadAnyChanges)return;let e=this._cachePrevious;this._cachePrevious=this._cache,this._cache=e,this._cache.clear(),this._hadAnyChanges=!1}getTileBoundingVolume(e,t,i,n){let a=`${e.z}_${e.x}_${e.y}_${n?.terrain?"t":""}_${Math.round(i)}`,r=this._cache.get(a);if(r)return r;let s=this._cachePrevious.get(a);if(s)return this._cache.set(a,s),s;let o=this._boundingVolumeFactory(e,t,i,n);return this._cache.set(a,o),this._hadAnyChanges=!0,o}},lI=class e{constructor(e,t,i,n){this.min=i,this.max=n,this.points=e,this.planes=t}static fromAabb(t,i){let n=[];for(let e=0;e<8;e++)n.push([1&~e?t[0]:i[0],1==(e>>1&1)?i[1]:t[1],1==(e>>2&1)?i[2]:t[2]]);return new e(n,[[-1,0,0,i[0]],[1,0,0,-t[0]],[0,-1,0,i[1]],[0,1,0,-t[1]],[0,0,-1,i[2]],[0,0,1,-t[2]]],t,i)}static fromCenterSizeAngles(t,i,n){let a=Pu([],n[0],n[1],n[2]),r=xu([],[i[0],0,0],a),s=xu([],[0,i[1],0],a),o=xu([],[0,0,i[2]],a),l=[...t],c=[...t];for(let e=0;e<8;e++)for(let i=0;i<3;i++){let n=t[i]+r[i]*(1&~e?-1:1)+s[i]*(1==(e>>1&1)?1:-1)+o[i]*(1==(e>>2&1)?1:-1);l[i]=Math.min(l[i],n),c[i]=Math.max(c[i],n)}let u=[];for(let e=0;e<8;e++){let i=[...t];mu(i,i,fu([],r,1&~e?-1:1)),mu(i,i,fu([],s,1==(e>>1&1)?1:-1)),mu(i,i,fu([],o,1==(e>>2&1)?1:-1)),u.push(i)}return new e(u,[[...r,-vu(r,u[0])],[...s,-vu(s,u[0])],[...o,-vu(o,u[0])],[-r[0],-r[1],-r[2],-vu(r,u[7])],[-s[0],-s[1],-s[2],-vu(s,u[7])],[-o[0],-o[1],-o[2],-vu(o,u[7])]],l,c)}intersectsFrustum(e){let t=!0,i=this.points.length,n=this.planes.length,a=e.planes.length,r=e.points.length;for(let n=0;n<a;n++){let a=e.planes[n],r=0;for(let e=0;e<i;e++){let t=this.points[e];a[0]*t[0]+a[1]*t[1]+a[2]*t[2]+a[3]>=0&&r++}if(0===r)return 0;r<i&&(t=!1)}if(t)return 2;for(let t=0;t<n;t++){let i=this.planes[t],n=0;for(let t=0;t<r;t++){let a=e.points[t];i[0]*a[0]+i[1]*a[1]+i[2]*a[2]+i[3]>=0&&n++}if(0===n)return 0}return 1}intersectsPlane(e){let t=this.points.length,i=0;for(let n=0;n<t;n++){let t=this.points[n];e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]>=0&&i++}return i===t?2:0===i?0:1}};function cI(e,t,i){let n=e-t;return n<0?-n:Math.max(0,n-i)}function uI(e,t,i,n,a){let r,s=e-i;return r=s<0?Math.min(-s,1+s-a):s>a?Math.min(Math.max(s-a,0),1-s):0,Math.max(r,cI(t,n,a))}var hI=class{constructor(){this._boundingVolumeCache=new oI(this._computeTileBoundingVolume)}prepareNextFrame(){this._boundingVolumeCache.swapBuffers()}distanceToTile2d(e,t,i,n){let a=1<<i.z,r=1/a,s=i.x/a,o=i.y/a,l=2;return l=Math.min(l,uI(e,t,s,o,r)),l=Math.min(l,uI(e,t,s+.5,-o-r,r)),l=Math.min(l,uI(e,t,s+.5,2-o-r,r)),l}getWrap(e,t,i){let n=1<<t.z,a=1/n,r=t.x/n,s=cI(e.x,r,a),o=cI(e.x,r-1,a),l=cI(e.x,r+1,a),c=Math.min(s,o,l);return c===l?1:c===o?-1:0}allowVariableZoom(e,t){return tD(e,t)>4}allowWorldCopies(){return!1}getTileBoundingVolume(e,t,i,n){return this._boundingVolumeCache.getTileBoundingVolume(e,t,i,n)}_computeTileBoundingVolume(e,t,i,n){let a=Math.min(0,i),r=Math.max(0,i);if(n?.terrain){let i=new HE(e.z,t,e.z,e.x,e.y),s=n.terrain.getMinMaxElevation(i);a=s.minElevation??a,r=Math.max(s.maxElevation??r,r)}if(a/=wx,r/=wx,a+=1,r+=1,e.z<=0)return lI.fromAabb([-r,-r,-r],[r,r,r]);if(1===e.z)return lI.fromAabb([0===e.x?-r:0,0===e.y?0:-r,-r],[0===e.x?0:r,0===e.y?r:0,r]);{let t=[ZP(0,0,e.x,e.y,e.z),ZP(Uu,0,e.x,e.y,e.z),ZP(Uu,Uu,e.x,e.y,e.z),ZP(0,Uu,e.x,e.y,e.z)],i=[];for(let e of t)i.push(fu([],e,r));if(r!==a)for(let e of t)i.push(fu([],e,a));0===e.y&&i.push([0,1,0]),e.y===(1<<e.z)-1&&i.push([0,-1,0]);let n=[1,1,1],s=[-1,-1,-1];for(let e of i)for(let t=0;t<3;t++)n[t]=Math.min(n[t],e[t]),s[t]=Math.max(s[t],e[t]);let o=ZP(4096,4096,e.x,e.y,e.z),l=yu([],[0,1,0],o);_u(l,l);let c=yu([],o,l);_u(c,c);let u=yu([],t[2],t[1]);_u(u,u);let h=yu([],t[0],t[3]);_u(h,h),i.push(fu([],o,r)),e.y>=(1<<e.z)/2&&i.push(fu([],ZP(4096,0,e.x,e.y,e.z),r)),e.y<(1<<e.z)/2&&i.push(fu([],ZP(4096,Uu,e.x,e.y,e.z),r));let d=dI(o,i),p=dI(c,i),m=[-o[0],-o[1],-o[2],d.max],g=[o[0],o[1],o[2],-d.min],f=[-c[0],-c[1],-c[2],p.max],A=[c[0],c[1],c[2],-p.min],_=[...u,0],v=[...h,0],y=[];return 0===e.y?y.push(Xu(v,_,m),Xu(v,_,g)):y.push(Xu(f,_,m),Xu(f,_,g),Xu(f,v,m),Xu(f,v,g)),e.y===(1<<e.z)-1?y.push(Xu(v,_,m),Xu(v,_,g)):y.push(Xu(A,_,m),Xu(A,_,g),Xu(A,v,m),Xu(A,v,g)),new lI(y,[m,g,f,A,_,v],n,s)}}};function dI(e,t){let i=1/0,n=-1/0;for(let a of t){let t=vu(e,a);i=Math.min(i,t),n=Math.max(n,t)}return{min:i,max:n}}var pI=class e{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(e){this._helper.setMinZoom(e)}setMaxZoom(e){this._helper.setMaxZoom(e)}setMinPitch(e){this._helper.setMinPitch(e)}setMaxPitch(e){this._helper.setMaxPitch(e)}setRenderWorldCopies(e){this._helper.setRenderWorldCopies(e)}setBearing(e){this._helper.setBearing(e)}setPitch(e){this._helper.setPitch(e)}setRoll(e){this._helper.setRoll(e)}setFov(e){this._helper.setFov(e)}setZoom(e){this._helper.setZoom(e)}setCenter(e){this._helper.setCenter(e)}setElevation(e){this._helper.setElevation(e)}setMinElevationForCurrentTile(e){this._helper.setMinElevationForCurrentTile(e)}setPadding(e){this._helper.setPadding(e)}interpolatePadding(e,t,i){this._helper.interpolatePadding(e,t,i)}isPaddingEqual(e){return this._helper.isPaddingEqual(e)}resize(e,t){this._helper.resize(e,t)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(e){this._helper.setMaxBounds(e)}setConstrainOverride(e){this._helper.setConstrainOverride(e)}overrideNearFarZ(e,t){this._helper.overrideNearFarZ(e,t)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(e){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),e)}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 constrainOverride(){return this._helper.constrainOverride}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(e){}constructor(e){this._cachedClippingPlane=Vu(),this._projectionMatrix=Hu(),this._globeViewProjMatrix32f=Wu(),this._globeViewProjMatrixF64=Hu(),this._globeViewProjMatrixF64Inverted=Hu(),this._globeProjMatrixInverted=Hu(),this._cameraPosition=qu(),this.defaultConstrain=(e,t)=>{let i=sh(e.lat,-Ih,Ih),n=sh(+t,this.minZoom+iI(0,i),this.maxZoom);return{center:new Ex(e.lng,i),zoom:n}},this.applyConstrain=(e,t)=>this._helper.applyConstrain(e,t),this._helper=new kP({calcMatrices:()=>this._calcMatrices(),defaultConstrain:(e,t)=>this.defaultConstrain(e,t)},e),this._coveringTilesDetailsProvider=new hI}clone(){let t=new e;return t.apply(this,!1),t}apply(e,t){this._helper.apply(e,t)}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._globeViewProjMatrixF64}get inverseProjectionMatrix(){return this._globeProjMatrixInverted}get cameraPosition(){let e=qu();return e[0]=this._cameraPosition[0],e[1]=this._cameraPosition[1],e[2]=this._cameraPosition[2],e}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}getProjectionData(e){let{overscaledTileID:t,applyGlobeMatrix:i}=e,n=this._helper.getMercatorTileCoordinates(t);return{mainMatrix:this._globeViewProjMatrix32f,tileMercatorCoords:n,clippingPlane:this._cachedClippingPlane,projectionTransition:+!!i,fallbackMatrix:this._globeViewProjMatrix32f,clipAntimeridian:0===t?.canonical.z}}_computeClippingPlane(e){let t=this.pitchInRadians,i=this.cameraToCenterDistance/e,n=Math.sin(t)*i,a=Math.cos(t)*i+1,r=1/Math.sqrt(n*n+a*a)*1,s=-n,o=a,l=Math.sqrt(s*s+o*o);s/=l,o/=l;let c=[0,s,o];Eu(c,c,[0,0,0],-this.bearingInRadians),bu(c,c,[0,0,0],-1*this.center.lat*Math.PI/180),wu(c,c,[0,0,0],this.center.lng*Math.PI/180);let u=1/du(c);return fu(c,c,u),[...c,-r*u]}isLocationOccluded(e){return!this.isSurfacePointVisible(KP(e))}transformLightDirection(e){let t=this._helper._center.lng*Math.PI/180,i=this._helper._center.lat*Math.PI/180,n=Math.cos(i),a=[Math.sin(t)*n,Math.sin(i),Math.cos(t)*n],r=[a[2],0,-a[0]],s=[0,0,0];yu(s,r,a),_u(r,r),_u(s,s);let o=[0,0,0];return _u(o,[r[0]*e[0]+s[0]*e[1]+a[0]*e[2],r[1]*e[0]+s[1]*e[1]+a[1]*e[2],r[2]*e[0]+s[2]*e[1]+a[2]*e[2]]),o}getPixelScale(){return 1/Math.cos(this._helper._center.lat*Math.PI/180)}getCircleRadiusCorrection(){return Math.cos(this._helper._center.lat*Math.PI/180)}getPitchedTextCorrection(e,t,i){let n=Rx(e,t,i.canonical),a=function(e,t){return[eh(e*Math.PI*2+Math.PI,2*Math.PI),2*Math.atan(Math.exp(Math.PI-t*Math.PI*2))-.5*Math.PI]}(n.x,n.y);return this.getCircleRadiusCorrection()/Math.cos(a[1])}projectTileCoordinates(e,t,i,n){let a,r=i.canonical,s=ZP(e,t,r.x,r.y,r.z),o=1+(n??0)/wx,l=s[0]*o,c=s[1]*o,u=s[2]*o,h=[l,c,u,1];if(Mu(h,h,this._globeViewProjMatrixF64),o<=1){let e=this._cachedClippingPlane;a=e[0]*s[0]+e[1]*s[1]+e[2]*s[2]+e[3]<0}else a=this._isLineOfSightBlocked(l,c,u);return{point:new Hc(h[0]/h[3],h[1]/h[3]),signedDistanceFromCamera:h[3],isOccluded:a}}_isLineOfSightBlocked(e,t,i){let n=this._cameraPosition,a=e-n[0],r=t-n[1],s=i-n[2],o=a*a+r*r+s*s;if(0===o)return!1;let l=sh(-(n[0]*a+n[1]*r+n[2]*s)/o,0,1),c=n[0]+l*a,u=n[1]+l*r,h=n[2]+l*s;return c*c+u*u+h*h<1}_calcMatrices(){let e=XP(this.worldSize,this.center.lat),t=Gu();this._helper.autoCalculateNearFarZ&&(this._helper._nearZ=.5,this._helper._farZ=this.cameraToCenterDistance+2*e),lu(t,this.fovInRadians,this.width/this.height,this._helper._nearZ,this._helper._farZ);let i=this.centerOffset;t[8]=2*-i.x/this._helper._width,t[9]=2*i.y/this._helper._height,this._projectionMatrix=$c(t),this._globeProjMatrixInverted=Gu(),tu(this._globeProjMatrixInverted,t),nu(t,t,[0,0,-this.cameraToCenterDistance]),ou(t,t,this.rollInRadians),ru(t,t,-this.pitchInRadians),ou(t,t,this.bearingInRadians),nu(t,t,[0,0,-e]);let n=qu();n[0]=e,n[1]=e,n[2]=e,ru(t,t,this.center.lat*Math.PI/180),su(t,t,-this.center.lng*Math.PI/180),au(t,t,n),this._globeViewProjMatrixF64=t,this._globeViewProjMatrix32f=new Float32Array(t),this._globeViewProjMatrixF64Inverted=Gu(),tu(this._globeViewProjMatrixF64Inverted,t);let a=qu();this._cameraPosition=qu(),this._cameraPosition[2]=this.cameraToCenterDistance/e,Eu(this._cameraPosition,this._cameraPosition,a,-this.rollInRadians),bu(this._cameraPosition,this._cameraPosition,a,this.pitchInRadians),Eu(this._cameraPosition,this._cameraPosition,a,-this.bearingInRadians),mu(this._cameraPosition,this._cameraPosition,[0,0,1]),bu(this._cameraPosition,this._cameraPosition,a,-this.center.lat*Math.PI/180),wu(this._cameraPosition,this._cameraPosition,a,this.center.lng*Math.PI/180),this._cachedClippingPlane=this._computeClippingPlane(e);let r=$c(this._globeViewProjMatrixF64Inverted);au(r,r,[1,1,-1]),this._cachedFrustum=QT.fromInvProjectionMatrix(r,1,0,this._cachedClippingPlane,!0)}calculateFogMatrix(e){yh("calculateFogMatrix is not supported on globe projection.");let t=Gu();return eu(t),t}getVisibleUnwrappedCoordinates(e){return[new GE(0,e)]}getCameraFrustum(){return this._cachedFrustum}getClippingPlane(){return this._cachedClippingPlane}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(e){e?yh("terrain is not fully supported on vertical perspective projection."):this._helper.recalculateZoomAndCenter(0)}maxPitchScaleFactor(){return 1}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return(du(this._cameraPosition)-1)*wx}getCameraLngLat(){let e=qu();return _u(e,this._cameraPosition),YP(e)}lngLatToCameraDepth(e,t){let i=KP(e);fu(i,i,1+t/wx);let n=Vu();return Mu(n,[i[0],i[1],i[2],1],this._globeViewProjMatrixF64),n[2]/n[3]}populateCache(e){}getBounds(){let e=.5*this.width,t=.5*this.height,i=[new Hc(0,0),new Hc(e,0),new Hc(this.width,0),new Hc(this.width,t),new Hc(this.width,this.height),new Hc(e,this.height),new Hc(0,this.height),new Hc(0,t)],n=[];for(let e of i)n.push(this.unprojectScreenPoint(e));let a=0,r=0,s=0,o=0,l=this.center;for(let e of n){let t=Ju(l.lng,e.lng),i=Ju(l.lat,e.lat);t<r&&(r=t),t>a&&(a=t),i<o&&(o=i),i>s&&(s=i)}let c=[l.lng+r,l.lat+o,l.lng+a,l.lat+s];return this.isSurfacePointOnScreen([0,1,0])&&(c[3]=90,c[0]=-180,c[2]=180),this.isSurfacePointOnScreen([0,-1,0])&&(c[1]=-90,c[0]=-180,c[2]=180),new gT(c)}calculateCenterFromCameraLngLatAlt(e,t,i,n){return this._helper.calculateCenterFromCameraLngLatAlt(e,t,i,n)}calculateCameraOptionsFromTo(e,t,i,n){let a=Ex.convert(i),r=KP(Ex.convert(e));fu(r,r,1+t/wx);let s=KP(a),o=fu(qu(),s,1+n/wx),l=gu(qu(),r,s),c=du(l);if(c<1e-12||function(e,t){var i=t[0]-e[0],n=t[1]-e[1],a=t[2]-e[2];return Math.sqrt(i*i+n*n+a*a)}(r,o)<1e-12)throw Error("Can't calculate camera options with same From and To");let u=qu();wu(l,l,u,-Mh(a.lng)),bu(l,l,u,Mh(a.lat));let h=Ch(Math.acos(sh(l[2]/c,-1,1))),d=Math.hypot(l[0],l[1])<1e-9*c?this.bearing:Ch(Math.atan2(-l[0],-l[1]));return{center:a,elevation:n,zoom:ph(this.cameraToCenterDistance/c/XP(this.tileSize,a.lat)),pitch:h,bearing:d}}setLocationAtPoint(e,t,i){let n=KP(this.unprojectScreenPoint(t)),a=KP(e),r=qu();!function(e){e[0]=0,e[1]=0,e[2]=0}(r);let s=qu();wu(s,n,r,-this.center.lng*Math.PI/180),bu(s,s,r,this.center.lat*Math.PI/180);let o=a[0]*a[0]+a[2]*a[2],l=s[0]*s[0];if(o<l)return;let c=Math.sqrt(o-l),u=-c,h=Yu(a[0],a[2],s[0],c),d=Yu(a[0],a[2],s[0],u),p=qu();wu(p,a,r,-h);let m=Yu(p[1],p[2],s[1],s[2]),g=qu();wu(g,a,r,-d);let f,A,_=Yu(g[1],g[2],s[1],s[2]),v=.5*Math.PI,y=m>=-v&&m<=v,x=_>=-v&&_<=v;if(y&&x){let e=this.center.lng*Math.PI/180,t=this.center.lat*Math.PI/180;$u(h,e)+$u(m,t)<$u(d,e)+$u(_,t)?(f=h,A=m):(f=d,A=_)}else if(y)f=h,A=m;else{if(!x)return;f=d,A=_}let b=f/Math.PI*180,w=A/Math.PI*180,E=this.center.lat;this.setCenter(new Ex(b,sh(w,-90,90))),this.setZoom(this.zoom+iI(E,this.center.lat))}locationToScreenPoint(e,t){let i=KP(e);if(t){fu(i,i,1+t.getElevationForLngLatZoom(e,this._helper._tileZoom)/wx)}return this._projectSurfacePointToScreen(i)}_projectSurfacePointToScreen(e){let t=Vu();return Mu(t,[...e,1],this._globeViewProjMatrixF64),t[0]/=t[3],t[1]/=t[3],new Hc((.5*t[0]+.5)*this.width,(.5*-t[1]+.5)*this.height)}screenPointToMercatorCoordinate(e,t){if(t){let i=this.screenTerrainPointToMercatorCoordinate(e,t);if(i)return i}return Fx.fromLngLat(this.unprojectScreenPoint(e))}screenTerrainPointToMercatorCoordinate(e,t){let i=t.getCoverageIndex();if(!i)return null;let n=this.cameraPosition,a=this.getRayDirectionFromPixel(e),r=sI(n,a,1+i.maxElevation/wx);if(!r)return null;let s=sI(n,a,1+i.minElevation/wx),o=Math.max(r.tMin,0),l=s?s.tMin:r.tMax;if(l<=o)return null;let c={index:i,exaggeration:t.exaggeration,origin:n,direction:a},u=0;for(let e=0;e<=256;e++){let t=o+(l-o)*e/256;if(gI(c,t)){let{hi:e}=zP(c,gI,u,t,1e-12),{sample:i,mercator:n}=mI(c,e);return new Fx(n.x,n.y,i.elevation)}u=t}return null}screenPointToLocation(e,t){return this.screenPointToMercatorCoordinate(e,t)?.toLngLat()}screenPointToLocationAtElevation(e,t){return this.screenPointToLocation(e)}isPointOnMapSurface(e,t){return!!sI(this._cameraPosition,this.getRayDirectionFromPixel(e))}getRayDirectionFromPixel(e){let t=Vu();t[0]=e.x/this.width*2-1,t[1]=-1*(e.y/this.height*2-1),t[2]=1,t[3]=1,Mu(t,t,this._globeViewProjMatrixF64Inverted),t[0]/=t[3],t[1]/=t[3],t[2]/=t[3];let i=qu();i[0]=t[0]-this._cameraPosition[0],i[1]=t[1]-this._cameraPosition[1],i[2]=t[2]-this._cameraPosition[2];let n=qu();return _u(n,i),n}isSurfacePointVisible(e){let t=this._cachedClippingPlane;return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]>=0}isSurfacePointOnScreen(e){if(!this.isSurfacePointVisible(e))return!1;let t=Vu();return Mu(t,[...e,1],this._globeViewProjMatrixF64),t[0]/=t[3],t[1]/=t[3],t[2]/=t[3],t[0]>-1&&t[0]<1&&t[1]>-1&&t[1]<1&&t[2]>-1&&t[2]<1}unprojectScreenPoint(e){let t=this._cameraPosition,i=this.getRayDirectionFromPixel(e),n=sI(t,i);if(n){let e=qu();mu(e,t,[i[0]*n.tMin,i[1]*n.tMin,i[2]*n.tMin]);let a=qu();return _u(a,e),YP(a)}let a=this._cachedClippingPlane,r=a[0]*i[0]+a[1]*i[1]+a[2]*i[2],s=-Ku(a,t)/r,o=qu();if(s>0)mu(o,t,[i[0]*s,i[1]*s,i[2]*s]);else{let e=qu();mu(e,t,[2*i[0],2*i[1],2*i[2]]);let n=Ku(this._cachedClippingPlane,e);ku(o,e,[this._cachedClippingPlane[0]*n,this._cachedClippingPlane[1]*n,this._cachedClippingPlane[2]*n])}let l=function(e){let t=qu();return t[0]=e[0]*-e[3],t[1]=e[1]*-e[3],t[2]=e[2]*-e[3],{center:t,radius:Math.sqrt(1-e[3]*e[3])}}(a);return YP(function(e,t,i){let n=qu();ku(n,i,e);let a=qu();return Au(a,e,n,t/Su(n)),a}(l.center,l.radius,o))}getProjectionDataForCustomLayer(e=!0){let t=this.getProjectionData({overscaledTileID:new HE(0,0,0,0,0),applyGlobeMatrix:e});return t.tileMercatorCoords=[0,0,1,1],t}getFastPathSimpleProjectionMatrix(e){}};function mI(e,t){let i=qu();Au(i,e.origin,e.direction,t);let n=du(i),a=qu();fu(a,i,1/n);let r=YP(a),s=Fx.fromLngLat(r),o=new Fx(s.x,sh(s.y,0,.999999999)),l=IP(e.index,e.exaggeration,o.x,o.y),c=Math.abs(r.lat)>85.051129?0:l.elevation;return{sample:{...l,elevation:c},radius:n,mercator:o}}function gI(e,t){let{sample:i,radius:n}=mI(e,t);return FP(i,(n-1)*wx)}var fI=class e{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(e){this._helper.setMinZoom(e)}setMaxZoom(e){this._helper.setMaxZoom(e)}setMinPitch(e){this._helper.setMinPitch(e)}setMaxPitch(e){this._helper.setMaxPitch(e)}setRenderWorldCopies(e){this._helper.setRenderWorldCopies(e)}setBearing(e){this._helper.setBearing(e)}setPitch(e){this._helper.setPitch(e)}setRoll(e){this._helper.setRoll(e)}setFov(e){this._helper.setFov(e)}setZoom(e){this._helper.setZoom(e)}setCenter(e){this._helper.setCenter(e)}setElevation(e){this._helper.setElevation(e)}setMinElevationForCurrentTile(e){this._helper.setMinElevationForCurrentTile(e)}setPadding(e){this._helper.setPadding(e)}interpolatePadding(e,t,i){this._helper.interpolatePadding(e,t,i)}isPaddingEqual(e){return this._helper.isPaddingEqual(e)}resize(e,t,i=!0){this._helper.resize(e,t,i)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(e){this._helper.setMaxBounds(e)}setConstrainOverride(e){this._helper.setConstrainOverride(e)}overrideNearFarZ(e,t){this._helper.overrideNearFarZ(e,t)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(e){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),e)}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 constrainOverride(){return this._helper.constrainOverride}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(e){this._globeness=e,this._calcMatrices(),this._verticalPerspectiveTransform.getCoveringTilesDetailsProvider().prepareNextFrame(),this._mercatorTransform.getCoveringTilesDetailsProvider().prepareNextFrame()}get currentTransform(){return this.isGlobeRendering?this._verticalPerspectiveTransform:this._mercatorTransform}constructor(e){this._globeness=1,this.defaultConstrain=(e,t)=>this.currentTransform.defaultConstrain(e,t),this.applyConstrain=(e,t)=>this._helper.applyConstrain(e,t),this._helper=new kP({calcMatrices:()=>this._calcMatrices(),defaultConstrain:(e,t)=>this.defaultConstrain(e,t)},e),this._globeness=1,this._mercatorTransform=new RP,this._verticalPerspectiveTransform=new pI}clone(){let t=new e;return t._globeness=this._globeness,t.apply(this,!1),t}apply(e,t){this._helper.apply(e,t),this._mercatorTransform.apply(this,!1),this._verticalPerspectiveTransform.apply(this,!1)}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(e){let t=this._mercatorTransform.getProjectionData(e),i=this._verticalPerspectiveTransform.getProjectionData(e);return{mainMatrix:this.isGlobeRendering?i.mainMatrix:t.mainMatrix,clippingPlane:i.clippingPlane,tileMercatorCoords:i.tileMercatorCoords,projectionTransition:e.applyGlobeMatrix?this._globeness:0,fallbackMatrix:t.fallbackMatrix,clipAntimeridian:i.clipAntimeridian}}isLocationOccluded(e){return this.currentTransform.isLocationOccluded(e)}transformLightDirection(e){return this.currentTransform.transformLightDirection(e)}getPixelScale(){return ih(this._mercatorTransform.getPixelScale(),this._verticalPerspectiveTransform.getPixelScale(),this._globeness)}getCircleRadiusCorrection(){return ih(this._mercatorTransform.getCircleRadiusCorrection(),this._verticalPerspectiveTransform.getCircleRadiusCorrection(),this._globeness)}getPitchedTextCorrection(e,t,i){return ih(this._mercatorTransform.getPitchedTextCorrection(e,t,i),this._verticalPerspectiveTransform.getPitchedTextCorrection(e,t,i),this._globeness)}projectTileCoordinates(e,t,i,n){return this.currentTransform.projectTileCoordinates(e,t,i,n)}_calcMatrices(){this._helper._width&&this._helper._height&&(this._verticalPerspectiveTransform.apply(this,!1),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(e){return this.currentTransform.calculateFogMatrix(e)}getVisibleUnwrappedCoordinates(e){return this.currentTransform.getVisibleUnwrappedCoordinates(e)}getCameraFrustum(){return this.currentTransform.getCameraFrustum()}getClippingPlane(){return this.currentTransform.getClippingPlane()}getCoveringTilesDetailsProvider(){return this.currentTransform.getCoveringTilesDetailsProvider()}recalculateZoomAndCenter(e){this.currentTransform.recalculateZoomAndCenter(e)}maxPitchScaleFactor(){return this._mercatorTransform.maxPitchScaleFactor()}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this.currentTransform.getCameraAltitude()}getCameraLngLat(){return this.currentTransform.getCameraLngLat()}lngLatToCameraDepth(e,t){return this.currentTransform.lngLatToCameraDepth(e,t)}populateCache(e){this._mercatorTransform.populateCache(e),this._verticalPerspectiveTransform.populateCache(e)}getBounds(){return this.currentTransform.getBounds()}calculateCenterFromCameraLngLatAlt(e,t,i,n){return this._helper.calculateCenterFromCameraLngLatAlt(e,t,i,n)}calculateCameraOptionsFromTo(e,t,i,n){return this.currentTransform.calculateCameraOptionsFromTo(e,t,i,n)}setLocationAtPoint(e,t,i){if(!this.isGlobeRendering)return this._mercatorTransform.setLocationAtPoint(e,t,i),void this.apply(this._mercatorTransform,!1);this._verticalPerspectiveTransform.setLocationAtPoint(e,t,i),this.apply(this._verticalPerspectiveTransform,!1)}locationToScreenPoint(e,t){return this.currentTransform.locationToScreenPoint(e,t)}screenPointToMercatorCoordinate(e,t){return this.currentTransform.screenPointToMercatorCoordinate(e,t)}screenTerrainPointToMercatorCoordinate(e,t){return this.currentTransform.screenTerrainPointToMercatorCoordinate(e,t)}screenPointToLocation(e,t){return this.currentTransform.screenPointToLocation(e,t)}screenPointToLocationAtElevation(e,t){return this.currentTransform.screenPointToLocationAtElevation(e,t)}isPointOnMapSurface(e,t){return this.currentTransform.isPointOnMapSurface(e,t)}getRayDirectionFromPixel(e){return this._verticalPerspectiveTransform.getRayDirectionFromPixel(e)}getProjectionDataForCustomLayer(e=!0){let t=this._mercatorTransform.getProjectionDataForCustomLayer(e);if(!this.isGlobeRendering)return t;let i=this._verticalPerspectiveTransform.getProjectionDataForCustomLayer(e);return i.fallbackMatrix=t.mainMatrix,i.projectionTransition=this._globeness,i}getFastPathSimpleProjectionMatrix(e){return this.currentTransform.getFastPathSimpleProjectionMatrix(e)}},AI=class e{get useGlobeControls(){return!0}handlePanInertia(e,t){let i=nI(e,t);return Math.abs(i.lng-t.center.lng)>180&&(i.lng=t.center.lng+179.5*Math.sign(i.lng-t.center.lng)),{easingCenter:i,easingOffset:new Hc(0,0)}}handleMapControlsRollPitchBearingZoom(e,t){let i=e.around,n=t.screenPointToLocation(i);e.bearingDelta&&t.setBearing(t.bearing+e.bearingDelta),e.pitchDelta&&t.setPitch(t.pitch+e.pitchDelta),e.rollDelta&&t.setRoll(t.roll+e.rollDelta);let a=t.zoom;e.zoomDelta&&t.setZoom(t.zoom+e.zoomDelta);let r=t.zoom-a;if(0===r)return;let s=Ju(t.center.lng,n.lng),o=s/(Math.abs(s/180)+1),l=Ju(t.center.lat,n.lat),c=t.getRayDirectionFromPixel(i),u=t.cameraPosition,h=-1*vu(u,c),d=qu();mu(d,u,[c[0]*h,c[1]*h,c[2]*h]);let p=du(d),m=p-1,g=Math.exp(.5*-Math.max(m-.3,0)),f=th(p,.95,.999,0,1),A=th(XP(t.worldSize,t.center.lat)/Math.min(t.width,t.height),.9,.5,1,.25),_=Math.min(g,ih(1,A,f)),v=(1-dh(-r))*_,y=t.center.lat,x=t.zoom,b=new Ex(t.center.lng+o*v,sh(t.center.lat+l*v,-Ih,Ih));t.setLocationAtPoint(n,i);let w=t.center,E=th(Math.abs(s),45,85,0,1),k=Math.max(E,f)**.25,S=Ju(w.lng,b.lng),M=Ju(w.lat,b.lat);t.setCenter(new Ex(w.lng+S*k,w.lat+M*k).wrap()),t.setZoom(x+iI(y,t.center.lat))}handleMapControlsPan(e,t,i){e.panDelta&&eI(t,i,t.isPointOnMapSurface(e.around)?e.around:t.centerPoint,e.panDelta)}cameraForBoxAndBearing(t,i,n,a,r){let s=NP(t,i,n,a,r),o=i.left/r.width*2-1,l=(r.width-i.right)/r.width*2-1,c=i.top/r.height*-2+1,u=(r.height-i.bottom)/r.height*-2+1,h=Ju(n.getWest(),n.getEast())<0,d=h?n.getEast():n.getWest(),p=h?n.getWest():n.getEast(),m=Math.max(n.getNorth(),n.getSouth()),g=Math.min(n.getNorth(),n.getSouth()),f=d+.5*Ju(d,p),A=m+.5*Ju(m,g),_=r.clone();_.setCenter(s.center),_.setBearing(s.bearing),_.setPitch(0),_.setRoll(0),_.setZoom(s.zoom);let v=_.modelViewProjectionMatrix,y=[KP(n.getNorthWest()),KP(n.getNorthEast()),KP(n.getSouthWest()),KP(n.getSouthEast()),KP(new Ex(p,A)),KP(new Ex(d,A)),KP(new Ex(f,m)),KP(new Ex(f,g))],x=KP(s.center),b=1/0;for(let t of y)o<0&&(b=e.getLesserNonNegativeNonNull(b,e.solveVectorScale(t,x,v,"x",o))),l>0&&(b=e.getLesserNonNegativeNonNull(b,e.solveVectorScale(t,x,v,"x",l))),c>0&&(b=e.getLesserNonNegativeNonNull(b,e.solveVectorScale(t,x,v,"y",c))),u<0&&(b=e.getLesserNonNegativeNonNull(b,e.solveVectorScale(t,x,v,"y",u)));if(Number.isFinite(b)&&0!==b)return s.zoom=Math.min(_.zoom+ph(b),t.maxZoom),s;OP()}handleJumpToCenterZoom(e,t){let i=e.center.lat,n=e.applyConstrain(t.center?Ex.convert(t.center):e.center,e.zoom).center;e.setCenter(n.wrap());let a=void 0===t.zoom?e.zoom+iI(i,n.lat):+t.zoom;e.zoom!==a&&e.setZoom(a)}handleEaseTo(e,t){let i=e.zoom,n=e.center,a=e.padding,r={roll:e.roll,pitch:e.pitch,bearing:e.bearing},s={roll:void 0===t.roll?e.roll:t.roll,pitch:void 0===t.pitch?e.pitch:t.pitch,bearing:void 0===t.bearing?e.bearing:t.bearing},o=void 0!==t.zoom,l=!e.isPaddingEqual(t.padding),c=!1,u=t.center?Ex.convert(t.center):n,h=e.applyConstrain(u,i).center;wP(e,h);let d=e.clone();d.setCenter(h),d.setZoom(o?+t.zoom:i+iI(n.lat,u.lat)),d.setBearing(t.bearing);let p=new Hc(sh(e.centerPoint.x+t.offsetAsPoint.x,0,e.width),sh(e.centerPoint.y+t.offsetAsPoint.y,0,e.height));d.setLocationAtPoint(h,p);let m=(t.offset&&t.offsetAsPoint.mag())>0?d.center:h,g=o?+t.zoom:i+iI(n.lat,m.lat),f=i+iI(n.lat,0),A=g+iI(m.lat,0),_=Ju(n.lng,m.lng),v=Ju(n.lat,m.lat),y=dh(A-f);return c=g!==i,{easeFunc:i=>{if(Th(r,s)||UP({startEulerAngles:r,endEulerAngles:s,tr:e,k:i,useSlerp:r.roll!=s.roll}),l&&e.interpolatePadding(a,t.padding,i),t.around)yh("Easing around a point is not supported under globe projection."),e.setLocationAtPoint(t.around,t.aroundPoint);else{let t=i*(A>f?Math.min(2,y):Math.max(.5,y))**(1-i),a=rI(n,_,v,t);e.setCenter(a.wrap())}if(c){let t=Ep.number(f,A,i)+iI(0,e.center.lat);e.setZoom(t)}},isZooming:c,elevationCenter:m}}handleFlyTo(e,t){let i=void 0!==t.zoom,n=e.center,a=e.zoom,r=e.padding,s=!e.isPaddingEqual(t.padding),o=e.applyConstrain(Ex.convert(t.center||t.locationAtOffset),a).center,l=i?+t.zoom:e.zoom+iI(e.center.lat,o.lat),c=e.clone();c.setCenter(o),c.setZoom(l),c.setBearing(t.bearing);let u=new Hc(sh(e.centerPoint.x+t.offsetAsPoint.x,0,e.width),sh(e.centerPoint.y+t.offsetAsPoint.y,0,e.height));c.setLocationAtPoint(o,u);let h=c.center;wP(e,h);let d=function(e,t,i){let n=vu(KP(t),KP(i)),a=Math.acos(n),r=WP(e);return a/(2*Math.PI)*r}(e,n,h),p=a+iI(n.lat,0),m=l+iI(h.lat,0),g=dh(m-p),f="number"==typeof t.minZoom?+t.minZoom:e.minZoom,A=Math.max(f,e.minZoom)+iI(h.lat,0),_=Math.min(A,p,m)+iI(0,h.lat),v=dh(e.applyConstrain(h,_).zoom+iI(h.lat,0)-p),y=Ju(n.lng,h.lng),x=Ju(n.lat,h.lat);return{easeFunc:(i,a,o,c)=>{let u=rI(n,y,x,o);s&&e.interpolatePadding(r,t.padding,i);let d=1===i?h:u;e.setCenter(d.wrap());let m=p+ph(a);e.setZoom(1===i?l:m+iI(0,d.lat))},scaleOfZoom:g,targetCenter:h,scaleOfMinZoom:v,pixelPathLength:d}}static solveVectorScale(e,t,i,n,a){let r=a,s="x"===n?[i[0],i[4],i[8],i[12]]:[i[1],i[5],i[9],i[13]],o=[i[3],i[7],i[11],i[15]],l=e[0]*s[0]+e[1]*s[1]+e[2]*s[2],c=e[0]*o[0]+e[1]*o[1]+e[2]*o[2],u=t[0]*s[0]+t[1]*s[1]+t[2]*s[2],h=t[0]*o[0]+t[1]*o[1]+t[2]*o[2];return u+r*c===l+r*h||o[3]*(l-u)+s[3]*(h-c)+l*h===u*c?null:(u+s[3]-r*h-r*o[3])/(u-l-r*h+r*c)}static getLesserNonNegativeNonNull(e,t){return null!==t&&t>=0&&t<e?t:e}},_I=class{constructor(e){this._globe=e,this._mercatorCameraHelper=new jP,this._verticalPerspectiveCameraHelper=new AI}get useGlobeControls(){return this._globe.useGlobeRendering}get currentHelper(){return this.useGlobeControls?this._verticalPerspectiveCameraHelper:this._mercatorCameraHelper}handlePanInertia(e,t){return this.currentHelper.handlePanInertia(e,t)}handleMapControlsRollPitchBearingZoom(e,t){this.currentHelper.handleMapControlsRollPitchBearingZoom(e,t)}handleMapControlsPan(e,t,i){this.currentHelper.handleMapControlsPan(e,t,i)}cameraForBoxAndBearing(e,t,i,n,a){return this.currentHelper.cameraForBoxAndBearing(e,t,i,n,a)}handleJumpToCenterZoom(e,t){this.currentHelper.handleJumpToCenterZoom(e,t)}handleEaseTo(e,t){return this.currentHelper.handleEaseTo(e,t)}handleFlyTo(e,t){return this.currentHelper.handleFlyTo(e,t)}};const vI=function(){let e={},t=ad.$version;for(let i in ad.$root){let n=ad.$root[i];if(n.required){let a=null;a="version"===i?t:"array"===n.type?[]:{},null!=a&&(e[i]=a)}}return e}();var yI=class extends id{constructor(e,t={}){super(),this._rtlPluginLoaded=()=>{for(let e in this.tileManagers){let t=this.tileManagers[e].getSource().type;("vector"===t||"geojson"===t)&&this.tileManagers[e].reload()}},this.map=e,this.dispatcher=new oT(sT(),e._getMapId()),this.dispatcher.registerMessageHandler("GG",(e,t)=>this.getGlyphs(e,t)),this.dispatcher.registerMessageHandler("GI",(e,t)=>this.getImages(e,t)),this.dispatcher.registerMessageHandler("GDA",(e,t)=>this.getDashes(e,t)),this.imageManager=new FC,this.imageManager.setEventedParent(this),this.imageManager.setMissingImageResolver(e._missingStyleImageResolver),this.patternAtlas=new zC(this.imageManager);let i=e._container?.lang||typeof document<"u"&&document.documentElement?.lang||void 0;this.glyphManager=new XC(e._requestManager,t.localIdeographFontFamily,i),this.lineAtlas=new eT(256,512),this.crossTileSymbolIndex=new gP,this._setInitialValues(),this._resetUpdates(),this.dispatcher.broadcast("SR",Zh()),HT().on(VT,this._rtlPluginLoaded),this.on("data",e=>{if("source"!==e.dataType||"metadata"!==e.sourceDataType)return;let t=this.tileManagers[e.sourceId];if(!t)return;let i=t.getSource();if(i?.vectorLayerIds)for(let e in this._layers){let t=this._layers[e];t.source===i.id&&this._validateLayer(t)}})}_setInitialValues(){this._layers={},this._order=[],this.tileManagers={},this.zoomHistory=new Wf,this._imagesListDirty=!1,this._globalState={},this._serializedLayers={},this.stylesheet=null,this.light=null,this.sky=null,this.projection&&(this.projection.destroy(),delete this.projection),this._loaded=!1,this._changed=!1,this._updatedLayers={},this._updatedSources={},this._changedImages={},this._glyphsDidChange=!1,this._updatedPaintProps={},this._layerOrderChanged=!1,this._symbolPlacementTriggered=!1,this._placedProjectionTransition=void 0,this.crossTileSymbolIndex=new(this.crossTileSymbolIndex?.constructor||Object),this.pauseablePlacement=void 0,this.placement=void 0,this.z=0}setGlobalStateProperty(e,t){this._checkLoaded();let i=null===t?this.stylesheet.state?.[e]?.default??null:t;if(Ah(i,this._globalState[e]))return this;this._globalState[e]=i,this._applyGlobalStateChanges([e])}getGlobalState(){return this._globalState}setGlobalState(e){this._checkLoaded();let t=[];for(let i in e)Ah(this._globalState[i],e[i].default)||(t.push(i),this._globalState[i]=e[i].default);this._applyGlobalStateChanges(t)}_applyGlobalStateChanges(e){if(0===e.length)return;let t=new Set,i={};for(let n of e){i[n]=this._globalState[n];for(let e in this._layers){let i=this._layers[e],a=i.getLayoutAffectingGlobalStateRefs(),r=i.getPaintAffectingGlobalStateRefs(),s=i.getVisibilityAffectingGlobalStateRefs();if(a.has(n)&&t.add(i.source),r.has(n))for(let{name:e,value:t}of r.get(n))this._updatePaintProperty(i,e,t);s?.has(n)&&(i.recalculateVisibility(),this._updateLayer(i))}}this.dispatcher.broadcast("UGS",i);for(let e in this.tileManagers)t.has(e)&&(this._reloadSource(e),this._changed=!0)}async loadURL(e,t={},i){this.fire(new lC("dataloading")),t.validate="boolean"!=typeof t.validate||t.validate,this._loadStyleRequest=new AbortController;let n=this._loadStyleRequest;try{let a=await this.map._requestManager.transformRequest(e,"Style");jh(n.signal);let r=await Xh(a,n);this._loadStyleRequest===n&&(this._loadStyleRequest=null),this._load(r.data,t,i)}catch(e){this._loadStyleRequest===n&&(this._loadStyleRequest=null),e&&!n.signal.aborted&&this.fire(new td(ju(e)))}}loadJSON(e,t={},i){this.fire(new lC("dataloading")),this._frameRequest=new AbortController,$M.frameAsync(this._frameRequest,this.map._ownerWindow).then(()=>{this._frameRequest=null,t.validate=!1!==t.validate,this._load(e,t,i)}).catch(()=>{})}loadEmpty(){this.fire(new lC("dataloading")),this._load(vI,{validate:!1})}_load(e,t,i){let n=t.transformStyle?t.transformStyle(i,e):e;if(!t.validate||!Rf(this,n)){n={...n},this._loaded=!0,this.stylesheet=n;for(let e in n.sources)this.addSource(e,n.sources[e],{validate:!1});n.sprite?this._loadSprite(n.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(n.glyphs),this.glyphManager.setFontFaces(n["font-faces"]),this._createLayers(),this.light=new YC(this.stylesheet.light??{},this._globalState),this._setProjectionInternal(this.stylesheet.projection?.type||"mercator"),this.sky=new $C(this.stylesheet.sky,this._globalState),this.map.setTerrain(this.stylesheet.terrain??null,{validate:!1}),this.fire(new lC("data")),this.fire(new oC)}}_createLayers(){let e=vC(this.stylesheet.layers);this.setGlobalState(this.stylesheet.state??null),this.dispatcher.broadcast("SL",e),this._order=e.map(e=>e.id),this._layers={},this._serializedLayers=null;for(let t of e){let e=OE(t,this._globalState);if(e.setEventedParent(this,{layer:{id:t.id}}),this._layers[t.id]=e,fA(e)&&this.tileManagers[e.source]){let i=t.paint?.["raster-fade-duration"]??e.paint.get("raster-fade-duration");this.tileManagers[e.source].setRasterFadeDuration(i)}}}async _loadSprite(e,t=!1,i=void 0){this.imageManager.setLoaded(!1);let n,a=new AbortController;this._spriteRequest=a;try{let i=await IC(e,this.map._requestManager,this.map.getPixelRatio(),a);if(!i)return;for(let e in i){let{loaded:n,removed:a}=this.imageManager.setSpriteImages(e,i[e]);this._markImagesChanged(a),t&&this._markImagesChanged(n)}}catch(e){n=e,a.signal.aborted||this.fire(new td(n))}finally{this._spriteRequest=null,this.imageManager.setLoaded(!0),t&&(this._changed=!0),this.dispatcher.broadcast("SI",this.imageManager.listImages()),this.fire(new lC("data")),i?.(n)}}_unloadSprite(){this._markImagesChanged(this.imageManager.removeAllSpriteImages()),this._imagesListDirty=!0,this._changed=!0,this.fire(new lC("data"))}_validateLayer(e){let t=this.tileManagers[e.source];if(!t)return;let i=e.sourceLayer;if(!i)return;let n=t.getSource();("geojson"===n.type||n.vectorLayerIds&&!n.vectorLayerIds.includes(i))&&this.fire(new td(Error(`Source layer "${i}" does not exist on source "${n.id}" as specified by style layer "${e.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(let e in this.tileManagers)if(!this.tileManagers[e].loaded())return!1;return this.imageManager.isLoaded()}_serializeByIds(e,t=!1){let i=this._serializedAllLayers();if(!e||0===e.length)return Object.values(t?_h(i):i);let n=[];for(let a of e)if(i[a]){let e=t?_h(i[a]):i[a];n.push(e)}return n}_serializedAllLayers(){let e=this._serializedLayers;if(e)return e;e=this._serializedLayers={};let t=Object.keys(this._layers);for(let i of t){let t=this._layers[i];"custom"!==t.type&&(e[i]=t.serialize())}return e}hasTransitions(){if(this.light?.hasTransition()||this.sky?.hasTransition()||this.projection?.hasTransition())return!0;for(let e in this.tileManagers)if(this.tileManagers[e].hasTransition())return!0;for(let e in this._layers)if(this._layers[e].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw Error("Style is not done loading.")}update(e){if(!this._loaded)return;let t=this._changed;if(t){this._imagesListDirty&&=(this.dispatcher.broadcast("SI",this.imageManager.listImages()),!1);let t=Object.keys(this._updatedLayers),i=Object.keys(this._removedLayers);(t.length||i.length)&&this._updateWorkerLayers(t,i);for(let e in this._updatedSources){let t=this._updatedSources[e];if("reload"===t)this._reloadSource(e);else{if("clear"!==t)throw Error(`Invalid action ${t}`);this._clearSource(e)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(let t in this._updatedPaintProps)this._layers[t].updateTransitions(e);this._resetUpdates()}let i={};for(let e in this.tileManagers){let t=this.tileManagers[e];i[e]=t.used,t.used=!1}let n=this.imageManager.listImages();for(let t of this._order){let i=this._layers[t];i.recalculate(e,n),!i.isHidden(e.zoom)&&i.source&&(this.tileManagers[i.source].used=!0)}for(let e in i){let t=this.tileManagers[e];!!i[e]!=!!t.used&&t.fire(new cC("data",{sourceDataType:"visibility",sourceId:e}))}this.light.recalculate(e),this.sky.recalculate(e),this.projection.recalculate(e),this.z=e.zoom,t&&this.fire(new lC("data"))}_updateTilesForChangedImages(){let e=Object.keys(this._changedImages);if(e.length){for(let t in this.tileManagers)this.tileManagers[t].reloadTilesForDependencies(["icons","patterns"],e);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(let e in this.tileManagers)this.tileManagers[e].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(e,t){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(e,!1),removedIds:t})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(e,t={}){this._checkLoaded();let i=this.serialize();if(e=t.transformStyle?t.transformStyle(i,e):e,(t.validate??!0)&&Rf(this,e))return!1;(e=_h(e)).layers=vC(e.layers);let n=TC(i,e),a=this._getOperationsToPerform(n);if(a.unimplemented.length>0)throw Error(`Unimplemented: ${a.unimplemented.join(", ")}.`);if(0===a.operations.length)return!1;for(let e of a.operations)e();return this.stylesheet=e,this._serializedLayers=null,this.fire(new oC({style:this})),!0}_getOperationsToPerform(e){let t=[],i=[];for(let n of e)switch(n.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":case"setRoll":continue;case"addLayer":t.push(()=>this.addLayer.apply(this,n.args));break;case"removeLayer":t.push(()=>this.removeLayer.apply(this,n.args));break;case"setPaintProperty":t.push(()=>this.setPaintProperty.apply(this,n.args));break;case"setLayoutProperty":t.push(()=>this.setLayoutProperty.apply(this,n.args));break;case"setFilter":t.push(()=>this.setFilter.apply(this,n.args));break;case"addSource":t.push(()=>this.addSource.apply(this,n.args));break;case"removeSource":t.push(()=>this.removeSource.apply(this,n.args));break;case"setLayerZoomRange":t.push(()=>this.setLayerZoomRange.apply(this,n.args));break;case"setLight":t.push(()=>this.setLight.apply(this,n.args));break;case"setGeoJSONSourceData":t.push(()=>this.setGeoJSONSourceData.apply(this,n.args));break;case"setGlyphs":t.push(()=>this.setGlyphs.apply(this,n.args));break;case"setFontFaces":t.push(()=>this.setFontFaces.apply(this,n.args));break;case"setSprite":t.push(()=>this.setSprite.apply(this,n.args));break;case"setTerrain":t.push(()=>this.map.setTerrain.apply(this,n.args));break;case"setSky":t.push(()=>this.setSky.apply(this,n.args));break;case"setProjection":this.setProjection.apply(this,n.args);break;case"setGlobalState":t.push(()=>this.setGlobalState.apply(this,n.args));break;case"setTransition":t.push(()=>{});break;default:i.push(n.command)}return{operations:t,unimplemented:i}}addImage(e,t){this.getImage(e)?this.fire(new td(Error(`An image named "${e}" already exists.`))):(this.imageManager.addImage(e,t),this._afterImageUpdated(e))}updateImage(e,t){this.imageManager.updateImage(e,t)}getImage(e){return this.imageManager.getImage(e)}setMissingImageResolver(e){this.imageManager.setMissingImageResolver(e)}removeImage(e){this.getImage(e)?(this.imageManager.removeImage(e),this._afterImageUpdated(e)):this.fire(new td(Error(`An image named "${e}" does not exist.`)))}_markImagesChanged(e){for(let t of e)this._changedImages[t]=!0}_afterImageUpdated(e){this._changedImages[e]=!0,this._imagesListDirty=!0,this._changed=!0,this.fire(new lC("data"))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(e,t,i={}){if(this._checkLoaded(),void 0!==this.tileManagers[e])throw Error(`Source "${e}" already exists.`);if(!t.type)throw Error(`The type property must be defined, but only the following properties were given: ${Object.keys(t).join(", ")}.`);if(zf.has(t.type)&&this._validate(Ff.source,`sources.${e}`,t,null,i))return;this.map?._collectResourceTiming&&(t.collectResourceTiming=!0);let n=this.tileManagers[e]=new hD(e,t,this.dispatcher);n.style=this,n.setEventedParent(this,()=>({isSourceLoaded:n.loaded(),source:n.serialize(),sourceId:e})),n.onAdd(this.map),this._changed=!0}removeSource(e){if(this._checkLoaded(),void 0===this.tileManagers[e])throw Error(`There is no source with this ID=${e}`);for(let t in this._layers)if(this._layers[t].source===e)return this.fire(new td(Error(`Source "${e}" cannot be removed while layer "${t}" is using it.`)));let t=this.tileManagers[e];delete this.tileManagers[e],delete this._updatedSources[e],t.fire(new cC("data",{sourceDataType:"metadata",sourceId:e})),t.setEventedParent(null),t.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(e,t){if(this._checkLoaded(),void 0===this.tileManagers[e])throw Error(`There is no source with this ID=${e}`);let i=this.tileManagers[e].getSource();if("geojson"!==i.type)throw Error(`geojsonSource.type is ${i.type}, which is !== 'geojson`);i.setData(t),this._changed=!0}getSource(e){return this.tileManagers[e]?.getSource()}addLayer(e,t,i={}){this._checkLoaded();let n,a=e.id;if(this.getLayer(a))return void this.fire(new td(Error(`Layer "${a}" already exists on this map.`)));if("custom"===e.type){if(Lf(this,function(e){let t=[],i=e.id;return void 0===i&&t.push(new sd(`layers.${i}`,null,'missing required property "id"')),void 0===e.render&&t.push(new sd(`layers.${i}`,null,'missing required method "render"')),e.renderingMode&&"2d"!==e.renderingMode&&"3d"!==e.renderingMode&&t.push(new sd(`layers.${i}`,null,'property "renderingMode" must be either "2d" or "3d"')),t}(e)))return;n=OE(e,this._globalState)}else{if("source"in e&&"object"==typeof e.source&&(this.addSource(a,e.source),e=lh(e=_h(e),{source:a})),this._validate(Ff.layer,`layers.${a}`,e,{arrayIndex:-1},i))return;n=OE(e,this._globalState),this._validateLayer(n),n.setEventedParent(this,{layer:{id:a}})}let r=t?this._order.indexOf(t):this._order.length;if(t&&-1===r)this.fire(new td(Error(`Cannot add layer "${a}" before non-existing layer "${t}".`)));else{if(this._order.splice(r,0,a),this._layerOrderChanged=!0,this._layers[a]=n,this._removedLayers[a]&&n.source&&"custom"!==n.type){let e=this._removedLayers[a];delete this._removedLayers[a],e.type===n.type?(this._updatedSources[n.source]="reload",this.tileManagers[n.source].pause()):this._updatedSources[n.source]="clear"}this._updateLayer(n),n.onAdd&&n.onAdd(this.map)}}moveLayer(e,t){if(this._checkLoaded(),this._changed=!0,!this._layers[e])return void this.fire(new td(Error(`The layer '${e}' does not exist in the map's style and cannot be moved.`)));if(e===t)return;if(t&&!this._order.includes(t))return void this.fire(new td(Error(`Cannot move layer "${e}" before non-existing layer "${t}".`)));let i=this._order.indexOf(e);this._order.splice(i,1);let n=t?this._order.indexOf(t):this._order.length;this._order.splice(n,0,e),this._layerOrderChanged=!0}removeLayer(e){this._checkLoaded();let t=this._layers[e];if(!t)return void this.fire(new td(Error(`Cannot remove non-existing layer "${e}".`)));t.setEventedParent(null);let i=this._order.indexOf(e);this._order.splice(i,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[e]=t,delete this._layers[e],this._serializedLayers&&delete this._serializedLayers[e],delete this._updatedLayers[e],delete this._updatedPaintProps[e],"symbol"===t.type&&t.source&&this.tileManagers[t.source]?.resetMaxContentElevation(),t.onRemove&&t.onRemove(this.map)}getLayer(e){return this._layers[e]}getLayersOrder(){return[...this._order]}hasLayer(e){return e in this._layers}setLayerZoomRange(e,t,i){this._checkLoaded();let n=this.getLayer(e);n?(n.minzoom!==t||n.maxzoom!==i)&&(null!=t&&(n.minzoom=t),null!=i&&(n.maxzoom=i),this._updateLayer(n)):this.fire(new td(Error(`Cannot set the zoom range of non-existing layer "${e}".`)))}setFilter(e,t,i={}){this._checkLoaded();let n=this.getLayer(e);if(n){if(!Ah(n.filter,t)){if(null==t)return n.setFilter(void 0),void this._updateLayer(n);this._validate(Ff.filter,`layers.${n.id}.filter`,t,null,i)||(n.setFilter(_h(t)),this._updateLayer(n))}}else this.fire(new td(Error(`Cannot filter non-existing layer "${e}".`)))}getFilter(e){return _h(this.getLayer(e).filter)}setLayoutProperty(e,t,i,n={}){this._checkLoaded();let a=this.getLayer(e);a?Ah(a.getLayoutProperty(t),i)||(a.setLayoutProperty(t,i,n),this._updateLayer(a)):this.fire(new td(Error(`Cannot style non-existing layer "${e}".`)))}getLayoutProperty(e,t){let i=this.getLayer(e);if(i)return i.getLayoutProperty(t);this.fire(new td(Error(`Cannot get style of non-existing layer "${e}".`)))}setPaintProperty(e,t,i,n={}){this._checkLoaded();let a=this.getLayer(e);a?Ah(a.getPaintProperty(t),i)||this._updatePaintProperty(a,t,i,n):this.fire(new td(Error(`Cannot style non-existing layer "${e}".`)))}_updatePaintProperty(e,t,i,n={}){e.setPaintProperty(t,i,n)&&this._updateLayer(e),fA(e)&&"raster-fade-duration"===t&&this.tileManagers[e.source].setRasterFadeDuration(i),this._changed=!0,this._updatedPaintProps[e.id]=!0,"symbol"===e.type&&this.triggerSymbolPlacement(),this._serializedLayers=null}getPaintProperty(e,t){return this.getLayer(e).getPaintProperty(t)}setFeatureState(e,t){this._checkLoaded();let i=e.source,n=e.sourceLayer,a=this.tileManagers[i];if(void 0===a)return void this.fire(new td(Error(`The source '${i}' does not exist in the map's style.`)));let r=a.getSource().type;if("geojson"===r&&n)return void this.fire(new td(Error("GeoJSON sources cannot have a sourceLayer parameter.")));if("vector"===r&&!n)return void this.fire(new td(Error("The sourceLayer parameter must be provided for vector source types.")));if(void 0===e.id)return void this.fire(new td(Error("The feature id parameter must be provided.")));let s=["__proto__","constructor","prototype"];t&&Object.keys(t).some(e=>s.includes(e))?this.fire(new td(Error(`The feature state should not include one of the following keys: ${s}`))):a.setFeatureState(n,e.id,t)}removeFeatureState(e,t){this._checkLoaded();let i=e.source,n=this.tileManagers[i];if(void 0===n)return void this.fire(new td(Error(`The source '${i}' does not exist in the map's style.`)));let a=n.getSource().type,r="vector"===a?e.sourceLayer:void 0;"vector"!==a||r?t&&"string"!=typeof e.id&&"number"!=typeof e.id?this.fire(new td(Error("A feature id is required to remove its specific state property."))):n.removeFeatureState(r,e.id,t):this.fire(new td(Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(e){this._checkLoaded();let t=e.source,i=e.sourceLayer,n=this.tileManagers[t];if(void 0!==n){if("vector"!==n.getSource().type||i)return void 0===e.id&&this.fire(new td(Error("The feature id parameter must be provided."))),n.getFeatureState(i,e.id);this.fire(new td(Error("The sourceLayer parameter must be provided for vector source types.")))}else this.fire(new td(Error(`The source '${t}' does not exist in the map's style.`)))}getTransition(){return lh({duration:300,delay:0},this.stylesheet?.transition)}serialize(){if(!this._loaded)return;let e=gh(this.tileManagers,e=>e.serialize()),t=this._serializeByIds(this._order,!0),i=this.map.getTerrain()||void 0,n=this.stylesheet;return fh({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,"font-faces":n["font-faces"],transition:n.transition,projection:n.projection,state:n.state,sources:e,layers:t,terrain:i},e=>void 0!==e)}_updateLayer(e){this._updatedLayers[e.id]=!0,e.source&&!this._updatedSources[e.source]&&"raster"!==this.tileManagers[e.source].getSource().type&&(this._updatedSources[e.source]="reload",this.tileManagers[e.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(e){let t=e=>"fill-extrusion"===this._layers[e].type,i={},n=[];for(let a=this._order.length-1;a>=0;a--){let r=this._order[a];if(t(r)){i[r]=a;for(let t of e){let e=t[r];if(e)for(let t of e)n.push(t)}}}n.sort((e,t)=>t.intersectionZ-e.intersectionZ);let a=[];for(let r=this._order.length-1;r>=0;r--){let s=this._order[r];if(t(s))for(let e=n.length-1;e>=0;e--){let t=n[e].feature;if(i[t.layer.id]<r)break;a.push(t),n.pop()}else for(let t of e){let e=t[s];if(e)for(let t of e)a.push(t.feature)}}return a}queryRenderedFeatures(e,t,i){t?.filter&&this._validate(Ff.filter,"queryRenderedFeatures.filter",t.filter,null,t);let n={};if(t?.layers){if(!(Array.isArray(t.layers)||t.layers instanceof Set))return this.fire(new td(Error("parameters.layers must be an Array or a Set of strings"))),[];for(let e of t.layers){let t=this._layers[e];if(!t)return this.fire(new td(Error(`The layer '${e}' does not exist in the map's style and cannot be queried for features.`))),[];n[t.source]=!0}}let a=[];t.availableImages=this.imageManager.listImages();let r=this._serializedAllLayers(),s=t.layers instanceof Set?t.layers:Array.isArray(t.layers)?new Set(t.layers):null,o={...t,layers:s,globalState:this._globalState};for(let s in this.tileManagers)(!t.layers||n[s])&&a.push(uT(this.tileManagers[s],this._layers,r,e,o,i,this.map.terrain?(e,t,i)=>this.map.terrain.getElevation(e,t,i):void 0));return this.placement&&a.push(hT(this._layers,r,this.tileManagers,e,o,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(a)}querySourceFeatures(e,t){t?.filter&&this._validate(Ff.filter,"querySourceFeatures.filter",t.filter,null,t);let i=this.tileManagers[e];return i?function(e,t){let i=e.getRenderableIds().map(t=>e.getTileByID(t)),n=[],a={};for(let e of i){let i=e.tileID.canonical.key;a[i]||(a[i]=!0,e.querySourceFeatures(n,t))}return n}(i,t?{...t,globalState:this._globalState}:{globalState:this._globalState}):[]}getLight(){return this.light.getLight()}setLight(e,t={}){this._checkLoaded();let i=this.light.getLight(),n=!1;for(let t in e)if(!Ah(e[t],i[t])){n=!0;break}if(!n)return;let a={now:tC(),transition:lh({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(e,t),this.light.updateTransitions(a)}getProjection(){return this.stylesheet?.projection}setProjection(e){this._checkLoaded();let t=e??{type:"mercator"};if(this.stylesheet.projection=e,this.projection){if(this.projection.name===t.type)return;this.projection.destroy(),delete this.projection}this._setProjectionInternal(t.type)}getSky(){return this.stylesheet?.sky}setSky(e,t={}){this._checkLoaded();let i=this.getSky(),n=!1;if(!e&&!i)return;if(e&&!i)n=!0;else if(!e&&i)n=!0;else for(let t in e)if(!Ah(e[t],i[t])){n=!0;break}if(!n)return;let a={now:tC(),transition:lh({duration:300,delay:0},this.stylesheet.transition)};this.stylesheet.sky=e,this.sky.setSky(e,t),this.sky.updateTransitions(a)}_setProjectionInternal(e){let t=function(e,t,i){let n={constrainOverride:t};if(Array.isArray(e)){let t=new HP({type:e},i);return{projection:t,transform:new fI(n),cameraHelper:new _I(t)}}switch(e){case"mercator":return{projection:new xP,transform:new RP(n),cameraHelper:new jP};case"globe":{let e=new HP({type:["interpolate",["linear"],["zoom"],11,"vertical-perspective",12,"mercator"]},{});return{projection:e,transform:new fI(n),cameraHelper:new _I(e)}}case"vertical-perspective":return{projection:new GP,transform:new pI(n),cameraHelper:new AI};default:return yh(`Unknown projection name: ${e}. Falling back to mercator projection.`),{projection:new xP,transform:new RP(n),cameraHelper:new jP}}}(e,this.map._camera?.transform.constrainOverride,this._globalState);this.projection=t.projection,this.map.migrateProjection(t.transform,t.cameraHelper);for(let e in this.tileManagers)this.tileManagers[e].reload()}_validate(e,t,i,n,a={}){return!1!==a.validate&&Bf(this,e,{key:t,style:this.serialize(),value:i,...n},a)}_remove(e=!0){this._frameRequest&&=(this._frameRequest.abort(),null),this._loadStyleRequest&&=(this._loadStyleRequest.abort(),null),this._spriteRequest&&=(this._spriteRequest.abort(),null),HT().off(VT,this._rtlPluginLoaded);for(let e in this._layers)this._layers[e].setEventedParent(null);for(let e in this.tileManagers){let t=this.tileManagers[e];t.setEventedParent(null),t.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),e&&this.dispatcher.broadcast("RM",void 0),this.dispatcher.remove(e)}_clearSource(e){this.tileManagers[e].clearTiles()}_reloadSource(e){this.tileManagers[e].resume(),this.tileManagers[e].reload()}_updateSources(e){for(let t in this.tileManagers)this.tileManagers[t].update(e,this.map.terrain)}_generateCollisionBoxes(){for(let e in this.tileManagers)this._reloadSource(e)}triggerSymbolPlacement(){this._symbolPlacementTriggered=!0}_placementInputsChanged(e,t,i){let n=this.pauseablePlacement;return!n||this._symbolPlacementTriggered||this._placedProjectionTransition!==this.projection?.transitionState||n._showCollisionBoxes!==t||n.placement.collisionGroups.crossSourceCollisions!==i||n.placement.transform.renderWorldCopies!==e.renderWorldCopies||!function(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]&&e[9]===t[9]&&e[10]===t[10]&&e[11]===t[11]&&e[12]===t[12]&&e[13]===t[13]&&e[14]===t[14]&&e[15]===t[15]}(n.placement.transform.modelViewProjectionMatrix,e.modelViewProjectionMatrix)}_updatePlacement(e,t,i,n,a=!1){let r=!1,s=!1,o={};for(let t of this._order){let i=this._layers[t];if("symbol"!==i.type)continue;if(!o[i.source]){let e=this.tileManagers[i.source];o[i.source]=e.getRenderableIds(!0).map(t=>e.getTileByID(t)).sort((e,t)=>t.tileID.overscaledZ-e.tileID.overscaledZ||(e.tileID.isLessThan(t.tileID)?-1:1))}let n=this.crossTileSymbolIndex.addLayer(i,o[i.source],e.center.lng);r||=n}this.crossTileSymbolIndex.pruneUnusedLayers(this._order),a||=this._layerOrderChanged||0===i;let l=r||this._placementInputsChanged(e,t,n),c=this.pauseablePlacement?.isDone()&&!this.placement.stillRecent(tC(),e.zoom);if((a||!this.pauseablePlacement||c&&(l||this.placement.stale))&&(this._symbolPlacementTriggered=!1,this._placedProjectionTransition=this.projection?.transitionState,this.pauseablePlacement=new iP(e,this.map.terrain,this._order,a,t,i,n,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?l&&this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,o),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(tC()),s=!0),r&&this.pauseablePlacement.placement.setStale()),s||r)for(let e of this._order){let t=this._layers[e];"symbol"===t.type&&this.placement.updateLayerOpacities(t,o[t.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(tC())}_releaseSymbolFadeTiles(){for(let e in this.tileManagers)this.tileManagers[e].releaseSymbolFadeTiles()}async getImages(e,t){let i=await this.imageManager.getImages(t.icons);this._updateTilesForChangedImages();let n=this.tileManagers[t.source];return n&&n.setDependencies(t.tileID.key,t.type,t.icons),i}async getGlyphs(e,t){let i=await this.glyphManager.getGlyphs(t.stacks),n=this.tileManagers[t.source];return n&&n.setDependencies(t.tileID.key,t.type,[""]),i}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(e,t={}){this._checkLoaded(),(!e||!this._validate(Ff.glyphs,"glyphs",e,null,t))&&(this._changed=!0,this._glyphsDidChange=!0,this.stylesheet.glyphs=e,this.glyphManager.entries={},this.glyphManager.setURL(e))}getFontFaces(){return this.stylesheet["font-faces"]||null}setFontFaces(e){this._checkLoaded(),this._changed=!0,this._glyphsDidChange=!0,this.stylesheet["font-faces"]=e,this.glyphManager.setFontFaces(e)}async getDashes(e,t){let i={};for(let[e,n]of Object.entries(t.dashes))i[e]=this.lineAtlas.getDash(n.dasharray,n.round);return i}addSprite(e,t,i={},n){this._checkLoaded();let a=[{id:e,url:t}],r=[...DC(this.stylesheet.sprite),...a];this._validate(Ff.sprite,"sprite",r,null,i)||(this.stylesheet.sprite=r,this._loadSprite(a,!0,n))}removeSprite(e){this._checkLoaded();let t=DC(this.stylesheet.sprite);if(!t.find(t=>t.id===e))return void this.fire(new td(Error(`Sprite "${e}" doesn't exists on this map.`)));let i=this.imageManager.removeSpriteImages(e);this._markImagesChanged(i),t.splice(t.findIndex(t=>t.id===e),1),this.stylesheet.sprite=t.length>0?t:void 0,this._imagesListDirty=!0,this._changed=!0,this.fire(new lC("data"))}getSprite(){return DC(this.stylesheet.sprite)}setSprite(e,t={},i){this._checkLoaded(),(!e||!this._validate(Ff.sprite,"sprite",e,null,t))&&(this.stylesheet.sprite=e,e?this._loadSprite(e,!0,i):(this._unloadSprite(),i&&i(null)))}destroy(){this._frameRequest&&=(this._frameRequest.abort(),null),this._loadStyleRequest&&=(this._loadStyleRequest.abort(),null),this._spriteRequest&&=(this._spriteRequest.abort(),null);for(let e in this.tileManagers){let t=this.tileManagers[e];t.setEventedParent(null),t.onRemove(this.map)}this.tileManagers={},this.imageManager&&(this.imageManager.setEventedParent(null),this.imageManager.destroy(),this.patternAtlas.destroy()),this.glyphManager&&this.glyphManager.destroy();for(let e in this._layers){let t=this._layers[e];t.setEventedParent(null),t.onRemove&&t.onRemove(this.map)}this._setInitialValues(),this.setEventedParent(null),this.dispatcher.unregisterMessageHandler("GG"),this.dispatcher.unregisterMessageHandler("GI"),this.dispatcher.unregisterMessageHandler("GDA"),this.dispatcher.remove(!0),this._listeners={},this._oneTimeListeners={}}};const xI=xA([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);var bI=class{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(e,t,i,n,a,r,s,o,l){this.context=e;let c=this.boundPaintVertexBuffers.length!==n.length;for(let e=0;!c&&e<n.length;e++)this.boundPaintVertexBuffers[e]!==n[e]&&(c=!0);!this.vao||this.boundProgram!==t||this.boundLayoutVertexBuffer!==i||c||this.boundIndexBuffer!==a||this.boundVertexOffset!==r||this.boundDynamicVertexBuffer!==s||this.boundDynamicVertexBuffer2!==o||this.boundDynamicVertexBuffer3!==l?this.freshBind(t,i,n,a,r,s,o,l):e.bindVertexArray.set(this.vao)}freshBind(e,t,i,n,a,r,s,o){let l=e.numAttributes,c=this.context,u=c.gl;this.vao&&this.destroy(),this.vao=c.createVertexArray(),c.bindVertexArray.set(this.vao),this.boundProgram=e,this.boundLayoutVertexBuffer=t,this.boundPaintVertexBuffers=i,this.boundIndexBuffer=n,this.boundVertexOffset=a,this.boundDynamicVertexBuffer=r,this.boundDynamicVertexBuffer2=s,this.boundDynamicVertexBuffer3=o,t.enableAttributes(u,e);for(let t of i)t.enableAttributes(u,e);r&&r.enableAttributes(u,e),s&&s.enableAttributes(u,e),o&&o.enableAttributes(u,e),t.bind(),t.setVertexAttribPointers(u,e,a);for(let t of i)t.bind(),t.setVertexAttribPointers(u,e,a);r&&(r.bind(),r.setVertexAttribPointers(u,e,a)),n&&n.bind(),s&&(s.bind(),s.setVertexAttribPointers(u,e,a)),o&&(o.bind(),o.setVertexAttribPointers(u,e,a)),c.currentNumAttributes=l}destroy(){this.vao&&=(this.context.deleteVertexArray(this.vao),null)}};const wI=(e,t,i,n,a)=>({u_texture:0,u_ele_delta:e,u_fog_matrix:t,u_fog_color:i?i.properties.get("fog-color"):ep.white,u_fog_ground_blend:i?i.properties.get("fog-ground-blend"):1,u_fog_ground_blend_opacity:a?0:i?i.calculateFogBlendOpacity(n):0,u_horizon_color:i?i.properties.get("horizon-color"):ep.white,u_horizon_fog_blend:i?i.properties.get("horizon-fog-blend"):1,u_is_globe_mode:+!!a}),EI=e=>({u_ele_delta:e}),kI={ProjectionUBO:0,TerrainUBO:1,FrameUBO:2};const SI={float:[1,1],int:[1,1],vec2:[2,2],vec4:[4,4],mat4:[16,4]};function MI(e){let t={},i=0;for(let{name:n,type:a}of e){let[e,r]=SI[a];i=Math.ceil(i/r)*r,t[n]=i,i+=e}return{offsets:t,contentWords:i,sizeWords:4*Math.ceil(i/4)}}var CI=class{constructor(e,t,i){this.context=e,this.binding=t,this.contentWords=i.contentWords;let n=e.gl;this.buffer=n.createBuffer(),n.bindBuffer(n.UNIFORM_BUFFER,this.buffer),n.bufferData(n.UNIFORM_BUFFER,4*i.sizeWords,n.DYNAMIC_DRAW),n.bindBufferBase(n.UNIFORM_BUFFER,t,this.buffer),this.uploaded=new Float32Array(i.sizeWords),this.pending=new Float32Array(i.sizeWords),this.uploadedWords=new Uint32Array(this.uploaded.buffer),this.pendingWords=new Uint32Array(this.pending.buffer),this.hasData=!1,this.bindingDirty=!1}upload(){let e=this.context.gl,t=!this.hasData;if(!t){let e=this.pendingWords,i=this.uploadedWords;for(let n=0;n<this.contentWords;n++)if(e[n]!==i[n]){t=!0;break}}this.bindingDirty&&=(e.bindBufferBase(e.UNIFORM_BUFFER,this.binding,this.buffer),!1),t&&(e.bindBuffer(e.UNIFORM_BUFFER,this.buffer),e.bufferSubData(e.UNIFORM_BUFFER,0,this.pending),this.uploaded.set(this.pending),this.hasData=!0)}destroy(){let e=this.context.gl;this.buffer&&(e.deleteBuffer(this.buffer),delete this.buffer)}};const TI=MI([{name:"u_projection_matrix",type:"mat4"},{name:"u_projection_fallback_matrix",type:"mat4"},{name:"u_projection_tile_mercator_coords",type:"vec4"},{name:"u_projection_clipping_plane",type:"vec4"},{name:"u_projection_transition",type:"float"},{name:"u_projection_clip_antimeridian",type:"int"}]),DI=TI.offsets;const PI=MI([{name:"u_terrain_matrix",type:"mat4"},{name:"u_terrain_unpack",type:"vec4"},{name:"u_terrain_dim",type:"float"},{name:"u_terrain_exaggeration",type:"float"}]),II=PI.offsets;function FI(e){let t=[];for(let i of e){if(null===i)continue;let e=i.split(" ");t.push(e.pop())}return t}var zI=class{constructor(e,t,i,n,a,r,s,o,l=[]){let c=e.gl;this.program=c.createProgram();let u=FI(t.staticAttributes),h=i?i.getBinderAttributes():[],d=u.concat(h),p=AP.prelude.staticUniforms?FI(AP.prelude.staticUniforms):[],m=t.staticUniforms?FI(t.staticUniforms):[],g=i?i.getBinderUniforms():[],f=p.concat(m).concat(g),A=[];for(let e of f)A.includes(e)||A.push(e);let _=i?i.defines():[];_.unshift("#version 300 es"),a&&_.push("#define OVERDRAW_INSPECTOR;"),r&&_.push("#define TERRAIN3D;"),o&&_.push(o),l&&_.push(...l);let v=_.concat(AP.prelude.fragmentSource,s.fragmentSource,t.fragmentSource).join("\n"),y=_.concat(AP.prelude.vertexSource,s.vertexSource,t.vertexSource).join("\n"),x=c.createShader(c.FRAGMENT_SHADER);if(c.isContextLost())return void(this.failedToCreate=!0);c.shaderSource(x,v),c.compileShader(x),c.attachShader(this.program,x);let b=c.createShader(c.VERTEX_SHADER);if(c.isContextLost())return void(this.failedToCreate=!0);c.shaderSource(b,y),c.compileShader(b),c.attachShader(this.program,b),this.attributes={};let w={};if(this.numAttributes=d.length,c.linkProgram(this.program),!c.getProgramParameter(this.program,c.LINK_STATUS)){if(c.isContextLost())return void(this.failedToCreate=!0);throw c.getShaderParameter(x,c.COMPILE_STATUS)?c.getShaderParameter(b,c.COMPILE_STATUS)?Error(`Program failed to link: ${c.getProgramInfoLog(this.program)}`):Error(`Could not compile vertex shader: ${c.getShaderInfoLog(b)}`):Error(`Could not compile fragment shader: ${c.getShaderInfoLog(x)}`)}!function(e,t){for(let[i,n]of Object.entries(kI)){let a=e.getUniformBlockIndex(t,i);a!==e.INVALID_INDEX&&e.uniformBlockBinding(t,a,n)}}(c,this.program);let E=function(e,t){let i=new Set([e.INT,e.INT_VEC2,e.INT_VEC3,e.INT_VEC4,e.UNSIGNED_INT,e.UNSIGNED_INT_VEC2,e.UNSIGNED_INT_VEC3,e.UNSIGNED_INT_VEC4]),n=new Set,a=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES);for(let r=0;r<a;r++){let a=e.getActiveAttrib(t,r);a&&i.has(a.type)&&n.add(a.name)}return n}(c,this.program);for(let e of d){if(!e)continue;let t=c.getAttribLocation(this.program,e);t>=0&&(this.attributes[e]={location:t,isInteger:E.has(e)})}c.deleteShader(b),c.deleteShader(x);for(let e of A)if(e&&!w[e]){let t=c.getUniformLocation(this.program,e);t&&(w[e]=t)}this.fixedUniforms=n(e,w),this.terrainUniforms=((e,t)=>({u_depth:new O_(e,t.u_depth),u_terrain:new O_(e,t.u_terrain)}))(e,w),this.binderUniforms=i?i.getUniforms(e,w):[]}draw(e,t,i,n,a,r,s,o,l,c,u,h,d,p,m,g,f,A,_){let v=e.gl;if(this.failedToCreate)return;if(e.program.set(this.program),e.setDepthMode(i),e.setStencilMode(n),e.setColorMode(a),e.setCullFace(r),o){e.activeTexture.set(v.TEXTURE2),v.bindTexture(v.TEXTURE_2D,o.depthTexture),e.activeTexture.set(v.TEXTURE3),v.bindTexture(v.TEXTURE_2D,o.texture);for(let e in this.terrainUniforms)this.terrainUniforms[e].set(o[e]);!function(e,t){let i=e.pending;i.set(t.u_terrain_matrix,II.u_terrain_matrix),i.set(t.u_terrain_unpack,II.u_terrain_unpack),i[II.u_terrain_dim]=t.u_terrain_dim,i[II.u_terrain_exaggeration]=t.u_terrain_exaggeration,e.upload()}(e.terrainUniformBuffer,o)}if(l&&function(e,t){let i=e.pending;i.set(t.mainMatrix,DI.u_projection_matrix),i.set(t.fallbackMatrix,DI.u_projection_fallback_matrix),i.set(t.tileMercatorCoords,DI.u_projection_tile_mercator_coords),i.set(t.clippingPlane,DI.u_projection_clipping_plane),i[DI.u_projection_transition]=t.projectionTransition,e.pendingWords[DI.u_projection_clip_antimeridian]=+!!t.clipAntimeridian,e.upload()}(e.projectionUniformBuffer,l),s)for(let e in this.fixedUniforms)this.fixedUniforms[e].set(s[e]);g&&g.setUniforms(e,this.binderUniforms,p,{zoom:m});let y=0;switch(t){case v.LINES:y=2;break;case v.TRIANGLES:y=3;break;case v.LINE_STRIP:y=1}for(let i of d.get())i.vaos||={},i.vaos[c]||=new bI,i.vaos[c].bind(e,this,u,g?g.getPaintVertexBuffers():[],h,i.vertexOffset,f,A,_),v.drawElements(t,i.primitiveLength*y,v.UNSIGNED_SHORT,i.primitiveOffset*y*2)}};function RI(e,t,i){let n=1/Nu(i,1,t.transform.tileZoom),a=2**i.tileID.overscaledZ,r=i.tileSize*2**t.transform.tileZoom/a,s=r*(i.tileID.canonical.x+i.tileID.wrap*a),o=r*i.tileID.canonical.y;return{u_image:0,u_texsize:i.imageAtlasTexture.size,u_scale:[n,e.fromScale,e.toScale],u_fade:e.t,u_pixel_coord_upper:[s>>16,o>>16],u_pixel_coord_lower:[65535&s,65535&o]}}const LI=(e,t,i,n)=>{let a=e.style.light,r=a.getCartesianPosition(),s=Yc();"viewport"===a.properties.get("anchor")&&function(e,t){var i=Math.sin(t),n=Math.cos(t);e[0]=n,e[1]=i,e[2]=0,e[3]=-i,e[4]=n,e[5]=0,e[6]=0,e[7]=0,e[8]=1}(s,e.transform.bearingInRadians),function(e,t,i){var n=t[0],a=t[1],r=t[2];e[0]=n*i[0]+a*i[3]+r*i[6],e[1]=n*i[1]+a*i[4]+r*i[7],e[2]=n*i[2]+a*i[5]+r*i[8]}(r,r,s);let o=e.transform.transformLightDirection(r),l=a.properties.get("color");return{u_lightpos:r,u_lightpos_globe:o,u_lightintensity:a.properties.get("intensity"),u_lightcolor:[l.r,l.g,l.b],u_vertical_gradient:+t,u_opacity:i,u_fill_translate:n}},BI=(e,t,i,n,a,r,s)=>lh(LI(e,t,i,n),RI(r,e,s),{u_height_factor:-(2**a.overscaledZ)/s.tileSize/8}),OI=(e,t,i,n,a)=>lh(RI(t,e,i),{u_fill_translate:n,u_sdf_pattern:+!!a}),UI=e=>({u_fill_translate:e}),NI=e=>({u_fill_translate:e}),jI=(e,t,i,n,a)=>OI(e,t,i,n,a),VI=(e,t,i,n,a)=>{let r,s,o=e.transform,l=0;if("map"===i.paint.get("circle-pitch-alignment")){let e=Nu(t,1,o.zoom);r=!0,s=[e,e],l=e/(Uu*2**t.tileID.overscaledZ)*2*Math.PI*a}else r=!1,s=o.pixelsToGLUnits;return{u_scale_with_map:+("map"===i.paint.get("circle-pitch-scale")),u_pitch_with_map:+r,u_extrude_scale:s,u_globe_extrude_scale:l,u_translate:n}},qI=(e,t=1)=>({u_color:e,u_overlay:0,u_overlay_scale:t}),GI=(e,t,i,n)=>{let a=Nu(e,1,t)/(Uu*2**e.tileID.overscaledZ)*2*Math.PI*n;return{u_extrude_scale:Nu(e,1,t),u_intensity:i,u_globe_extrude_scale:a}},HI=(e,t,i,n)=>{let a=Jc();return cu(a,0,e.width,e.height,0,0,1),{u_matrix:a,u_image:i,u_color_ramp:n,u_opacity:t.paint.get("heatmap-opacity")}},WI=(e,t,i)=>{let n,a=i.paint.get("hillshade-accent-color");switch(i.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}let r=i.getIlluminationProperties();for(let t=0;t<r.directionRadians.length;t++)"viewport"===i.paint.get("hillshade-illumination-anchor")&&(r.directionRadians[t]+=e.transform.bearingInRadians);return{u_image:0,u_latrange:KI(e,t.tileID),u_exaggeration:i.paint.get("hillshade-exaggeration"),u_altitudes:r.altitudeRadians,u_azimuths:r.directionRadians,u_accent:a,u_method:n,u_highlights:r.highlightColor,u_shadows:r.shadowColor}},ZI=(e,t)=>{let i=t.stride,n=Jc();return cu(n,0,Uu,-Uu,0,0,1),nu(n,n,[0,-Uu,0]),{u_matrix:n,u_image:1,u_dimension:[i,i],u_zoom:e.overscaledZ,u_unpack:t.getUnpackVector()}};function KI(e,t){let i=2**t.canonical.z,n=t.canonical.y;return[new Fx(0,n/i).toLngLat().lat,new Fx(0,(n+1)/i).toLngLat().lat]}const XI=(e,t,i=0)=>({u_image:0,u_unpack:t.getUnpackVector(),u_dimension:[t.stride,t.stride],u_elevation_stops:1,u_color_stops:4,u_color_ramp_size:i,u_opacity:e.paint.get("color-relief-opacity")}),QI=(e,t,i,n)=>{let a=e.transform;return{u_translation:iF(e,t,i),u_ratio:n/Nu(t,1,a.zoom)}},YI=(e,t,i,n,a)=>lh(QI(e,t,i,n),{u_image:0,u_image_height:a}),JI=(e,t,i,n,a)=>{let r=e.transform,s=tF(t,r);return{u_translation:iF(e,t,i),u_texsize:t.imageAtlasTexture.size,u_ratio:n/Nu(t,1,r.zoom),u_image:0,u_scale:[s,a.fromScale,a.toScale],u_fade:a.t}},$I=(e,t,i,n,a)=>{let r=tF(t,e.transform);return lh(QI(e,t,i,n),{u_tileratio:r,u_crossfade_from:a.fromScale,u_crossfade_to:a.toScale,u_image:0,u_mix:a.t,u_lineatlas_width:e.lineAtlas.width,u_lineatlas_height:e.lineAtlas.height})},eF=(e,t,i,n,a,r)=>{let s=tF(t,e.transform);return lh(QI(e,t,i,n),{u_image:0,u_image_height:r,u_tileratio:s,u_crossfade_from:a.fromScale,u_crossfade_to:a.toScale,u_image_dash:1,u_mix:a.t,u_lineatlas_width:e.lineAtlas.width,u_lineatlas_height:e.lineAtlas.height})};function tF(e,t){return 1/Nu(e,1,t.tileZoom)}function iF(e,t,i){return Zu(e.transform,t,i.paint.get("line-translate"),i.paint.get("line-translate-anchor"))}const nF=(e,t,i,n,a,r,s,o,l,c,u,h,d,p,m)=>({u_is_size_zoom_constant:+("constant"===e||"source"===e),u_is_size_feature_constant:+("constant"===e||"camera"===e),u_size_t:t?t.uSizeT:0,u_size:t?t.uSize:0,u_rotate_symbol:+i,u_label_plane_matrix:o,u_coord_matrix:l,u_is_text:+u,u_pitch_with_map:+n,u_is_along_line:a,u_is_variable_anchor:r,u_texsize:h,u_texture:0,u_translation:c,u_pitched_scale:d,u_is_offset:p,u_height_anchor_ground:+m}),aF=(e,t,i,n,a,r,s,o,l,c,u,h,d,p,m,g)=>{let f=s.transform;return lh(nF(e,t,i,n,a,r,0,o,l,c,u,h,p,m,g),{u_gamma_scale:n?Math.cos(f.pitch*Math.PI/180)*f.cameraToCenterDistance:1,u_is_halo:+!!d,u_is_plain:1})},rF=(e,t,i,n,a,r,s,o,l,c,u,h,d,p,m)=>lh(aF(e,t,i,n,a,r,s,o,l,c,!0,u,!0,d,p,m),{u_texsize_icon:h,u_texture_icon:1}),sF=(e,t)=>({u_opacity:e,u_color:t}),oF=(e,t,i,n,a)=>lh(function(e,t,i,n){let a=i.patternAtlas.getPattern(e.from.toString()),r=i.patternAtlas.getPattern(e.to.toString()),{width:s,height:o}=i.patternAtlas.getPixelSize(),l=2**n.tileID.overscaledZ,c=n.tileSize*2**i.transform.tileZoom/l,u=c*(n.tileID.canonical.x+n.tileID.wrap*l),h=c*n.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:a.tl,u_pattern_br_a:a.br,u_pattern_tl_b:r.tl,u_pattern_br_b:r.br,u_texsize:[s,o],u_mix:t.t,u_pattern_size_a:a.displaySize,u_pattern_size_b:r.displaySize,u_scale_a:t.fromScale,u_scale_b:t.toScale,u_tile_units_to_pixels:1/Nu(n,1,i.transform.tileZoom),u_pixel_coord_upper:[u>>16,h>>16],u_pixel_coord_lower:[65535&u,65535&h]}}(i,a,t,n),{u_opacity:e}),lF=(e,t)=>({}),cF={fillExtrusion:(e,t)=>({u_lightpos:new j_(e,t.u_lightpos),u_lightpos_globe:new j_(e,t.u_lightpos_globe),u_lightintensity:new U_(e,t.u_lightintensity),u_lightcolor:new j_(e,t.u_lightcolor),u_vertical_gradient:new U_(e,t.u_vertical_gradient),u_opacity:new U_(e,t.u_opacity),u_fill_translate:new N_(e,t.u_fill_translate)}),fillExtrusionPattern:(e,t)=>({u_lightpos:new j_(e,t.u_lightpos),u_lightpos_globe:new j_(e,t.u_lightpos_globe),u_lightintensity:new U_(e,t.u_lightintensity),u_lightcolor:new j_(e,t.u_lightcolor),u_vertical_gradient:new U_(e,t.u_vertical_gradient),u_height_factor:new U_(e,t.u_height_factor),u_opacity:new U_(e,t.u_opacity),u_fill_translate:new N_(e,t.u_fill_translate),u_image:new O_(e,t.u_image),u_texsize:new N_(e,t.u_texsize),u_pixel_coord_upper:new N_(e,t.u_pixel_coord_upper),u_pixel_coord_lower:new N_(e,t.u_pixel_coord_lower),u_scale:new j_(e,t.u_scale),u_fade:new U_(e,t.u_fade)}),fill:(e,t)=>({u_fill_translate:new N_(e,t.u_fill_translate)}),fillPattern:(e,t)=>({u_image:new O_(e,t.u_image),u_texsize:new N_(e,t.u_texsize),u_pixel_coord_upper:new N_(e,t.u_pixel_coord_upper),u_pixel_coord_lower:new N_(e,t.u_pixel_coord_lower),u_scale:new j_(e,t.u_scale),u_fade:new U_(e,t.u_fade),u_sdf_pattern:new O_(e,t.u_sdf_pattern),u_fill_translate:new N_(e,t.u_fill_translate)}),fillOutline:(e,t)=>({u_fill_translate:new N_(e,t.u_fill_translate)}),fillOutlinePattern:(e,t)=>({u_image:new O_(e,t.u_image),u_texsize:new N_(e,t.u_texsize),u_pixel_coord_upper:new N_(e,t.u_pixel_coord_upper),u_pixel_coord_lower:new N_(e,t.u_pixel_coord_lower),u_scale:new j_(e,t.u_scale),u_fade:new U_(e,t.u_fade),u_sdf_pattern:new O_(e,t.u_sdf_pattern),u_fill_translate:new N_(e,t.u_fill_translate)}),circle:(e,t)=>({u_scale_with_map:new O_(e,t.u_scale_with_map),u_pitch_with_map:new O_(e,t.u_pitch_with_map),u_extrude_scale:new N_(e,t.u_extrude_scale),u_globe_extrude_scale:new U_(e,t.u_globe_extrude_scale),u_translate:new N_(e,t.u_translate)}),collisionBox:lF,collisionCircle:lF,debug:(e,t)=>({u_color:new q_(e,t.u_color),u_overlay:new O_(e,t.u_overlay),u_overlay_scale:new U_(e,t.u_overlay_scale)}),depth:lF,clippingMask:lF,heatmap:(e,t)=>({u_extrude_scale:new U_(e,t.u_extrude_scale),u_intensity:new U_(e,t.u_intensity),u_globe_extrude_scale:new U_(e,t.u_globe_extrude_scale)}),heatmapTexture:(e,t)=>({u_matrix:new Z_(e,t.u_matrix),u_image:new O_(e,t.u_image),u_color_ramp:new O_(e,t.u_color_ramp),u_opacity:new U_(e,t.u_opacity)}),hillshade:(e,t)=>({u_image:new O_(e,t.u_image),u_latrange:new N_(e,t.u_latrange),u_exaggeration:new U_(e,t.u_exaggeration),u_altitudes:new H_(e,t.u_altitudes),u_azimuths:new H_(e,t.u_azimuths),u_accent:new q_(e,t.u_accent),u_method:new O_(e,t.u_method),u_shadows:new G_(e,t.u_shadows),u_highlights:new G_(e,t.u_highlights)}),hillshadePrepare:(e,t)=>({u_matrix:new Z_(e,t.u_matrix),u_image:new O_(e,t.u_image),u_dimension:new N_(e,t.u_dimension),u_zoom:new U_(e,t.u_zoom),u_unpack:new V_(e,t.u_unpack)}),colorRelief:(e,t)=>({u_image:new O_(e,t.u_image),u_unpack:new V_(e,t.u_unpack),u_dimension:new N_(e,t.u_dimension),u_elevation_stops:new O_(e,t.u_elevation_stops),u_color_stops:new O_(e,t.u_color_stops),u_color_ramp_size:new O_(e,t.u_color_ramp_size),u_opacity:new U_(e,t.u_opacity)}),line:(e,t)=>({u_translation:new N_(e,t.u_translation),u_ratio:new U_(e,t.u_ratio)}),lineGradient:(e,t)=>({u_translation:new N_(e,t.u_translation),u_ratio:new U_(e,t.u_ratio),u_image:new O_(e,t.u_image),u_image_height:new U_(e,t.u_image_height)}),linePattern:(e,t)=>({u_translation:new N_(e,t.u_translation),u_texsize:new N_(e,t.u_texsize),u_ratio:new U_(e,t.u_ratio),u_image:new O_(e,t.u_image),u_scale:new j_(e,t.u_scale),u_fade:new U_(e,t.u_fade)}),lineSDF:(e,t)=>({u_translation:new N_(e,t.u_translation),u_ratio:new U_(e,t.u_ratio),u_image:new O_(e,t.u_image),u_mix:new U_(e,t.u_mix),u_tileratio:new U_(e,t.u_tileratio),u_crossfade_from:new U_(e,t.u_crossfade_from),u_crossfade_to:new U_(e,t.u_crossfade_to),u_lineatlas_width:new U_(e,t.u_lineatlas_width),u_lineatlas_height:new U_(e,t.u_lineatlas_height)}),lineGradientSDF:(e,t)=>({u_translation:new N_(e,t.u_translation),u_ratio:new U_(e,t.u_ratio),u_image:new O_(e,t.u_image),u_image_height:new U_(e,t.u_image_height),u_tileratio:new U_(e,t.u_tileratio),u_crossfade_from:new U_(e,t.u_crossfade_from),u_crossfade_to:new U_(e,t.u_crossfade_to),u_image_dash:new O_(e,t.u_image_dash),u_mix:new U_(e,t.u_mix),u_lineatlas_width:new U_(e,t.u_lineatlas_width),u_lineatlas_height:new U_(e,t.u_lineatlas_height)}),layerOpacity:(e,t)=>({u_image:new O_(e,t.u_image),u_opacity:new U_(e,t.u_opacity)}),raster:(e,t)=>({u_tl_parent:new N_(e,t.u_tl_parent),u_scale_parent:new U_(e,t.u_scale_parent),u_buffer_scale:new U_(e,t.u_buffer_scale),u_image_warp:new j_(e,t.u_image_warp),u_fade_t:new U_(e,t.u_fade_t),u_opacity:new U_(e,t.u_opacity),u_image0:new O_(e,t.u_image0),u_image1:new O_(e,t.u_image1),u_brightness_low:new U_(e,t.u_brightness_low),u_brightness_high:new U_(e,t.u_brightness_high),u_saturation_factor:new U_(e,t.u_saturation_factor),u_contrast_factor:new U_(e,t.u_contrast_factor),u_spin_weights:new j_(e,t.u_spin_weights),u_coords_top:new V_(e,t.u_coords_top),u_coords_bottom:new V_(e,t.u_coords_bottom)}),symbolIcon:(e,t)=>({u_is_size_zoom_constant:new O_(e,t.u_is_size_zoom_constant),u_is_size_feature_constant:new O_(e,t.u_is_size_feature_constant),u_size_t:new U_(e,t.u_size_t),u_size:new U_(e,t.u_size),u_rotate_symbol:new O_(e,t.u_rotate_symbol),u_label_plane_matrix:new Z_(e,t.u_label_plane_matrix),u_coord_matrix:new Z_(e,t.u_coord_matrix),u_is_text:new O_(e,t.u_is_text),u_pitch_with_map:new O_(e,t.u_pitch_with_map),u_is_along_line:new O_(e,t.u_is_along_line),u_is_variable_anchor:new O_(e,t.u_is_variable_anchor),u_texsize:new N_(e,t.u_texsize),u_texture:new O_(e,t.u_texture),u_translation:new N_(e,t.u_translation),u_pitched_scale:new U_(e,t.u_pitched_scale),u_is_offset:new O_(e,t.u_is_offset),u_height_anchor_ground:new O_(e,t.u_height_anchor_ground)}),symbolSDF:(e,t)=>({u_is_size_zoom_constant:new O_(e,t.u_is_size_zoom_constant),u_is_size_feature_constant:new O_(e,t.u_is_size_feature_constant),u_size_t:new U_(e,t.u_size_t),u_size:new U_(e,t.u_size),u_rotate_symbol:new O_(e,t.u_rotate_symbol),u_label_plane_matrix:new Z_(e,t.u_label_plane_matrix),u_coord_matrix:new Z_(e,t.u_coord_matrix),u_is_text:new O_(e,t.u_is_text),u_pitch_with_map:new O_(e,t.u_pitch_with_map),u_is_along_line:new O_(e,t.u_is_along_line),u_is_variable_anchor:new O_(e,t.u_is_variable_anchor),u_texsize:new N_(e,t.u_texsize),u_texture:new O_(e,t.u_texture),u_gamma_scale:new U_(e,t.u_gamma_scale),u_is_halo:new O_(e,t.u_is_halo),u_is_plain:new O_(e,t.u_is_plain),u_translation:new N_(e,t.u_translation),u_pitched_scale:new U_(e,t.u_pitched_scale),u_is_offset:new O_(e,t.u_is_offset),u_height_anchor_ground:new O_(e,t.u_height_anchor_ground)}),symbolTextAndIcon:(e,t)=>({u_is_size_zoom_constant:new O_(e,t.u_is_size_zoom_constant),u_is_size_feature_constant:new O_(e,t.u_is_size_feature_constant),u_size_t:new U_(e,t.u_size_t),u_size:new U_(e,t.u_size),u_rotate_symbol:new O_(e,t.u_rotate_symbol),u_label_plane_matrix:new Z_(e,t.u_label_plane_matrix),u_coord_matrix:new Z_(e,t.u_coord_matrix),u_is_text:new O_(e,t.u_is_text),u_pitch_with_map:new O_(e,t.u_pitch_with_map),u_is_along_line:new O_(e,t.u_is_along_line),u_is_variable_anchor:new O_(e,t.u_is_variable_anchor),u_texsize:new N_(e,t.u_texsize),u_texsize_icon:new N_(e,t.u_texsize_icon),u_texture:new O_(e,t.u_texture),u_texture_icon:new O_(e,t.u_texture_icon),u_gamma_scale:new U_(e,t.u_gamma_scale),u_is_halo:new O_(e,t.u_is_halo),u_translation:new N_(e,t.u_translation),u_pitched_scale:new U_(e,t.u_pitched_scale),u_is_offset:new O_(e,t.u_is_offset),u_height_anchor_ground:new O_(e,t.u_height_anchor_ground)}),background:(e,t)=>({u_opacity:new U_(e,t.u_opacity),u_color:new q_(e,t.u_color)}),backgroundPattern:(e,t)=>({u_opacity:new U_(e,t.u_opacity),u_image:new O_(e,t.u_image),u_pattern_tl_a:new N_(e,t.u_pattern_tl_a),u_pattern_br_a:new N_(e,t.u_pattern_br_a),u_pattern_tl_b:new N_(e,t.u_pattern_tl_b),u_pattern_br_b:new N_(e,t.u_pattern_br_b),u_texsize:new N_(e,t.u_texsize),u_mix:new U_(e,t.u_mix),u_pattern_size_a:new N_(e,t.u_pattern_size_a),u_pattern_size_b:new N_(e,t.u_pattern_size_b),u_scale_a:new U_(e,t.u_scale_a),u_scale_b:new U_(e,t.u_scale_b),u_pixel_coord_upper:new N_(e,t.u_pixel_coord_upper),u_pixel_coord_lower:new N_(e,t.u_pixel_coord_lower),u_tile_units_to_pixels:new U_(e,t.u_tile_units_to_pixels)}),terrain:(e,t)=>({u_texture:new O_(e,t.u_texture),u_ele_delta:new U_(e,t.u_ele_delta),u_fog_matrix:new Z_(e,t.u_fog_matrix),u_fog_color:new q_(e,t.u_fog_color),u_fog_ground_blend:new U_(e,t.u_fog_ground_blend),u_fog_ground_blend_opacity:new U_(e,t.u_fog_ground_blend_opacity),u_horizon_color:new q_(e,t.u_horizon_color),u_horizon_fog_blend:new U_(e,t.u_horizon_fog_blend),u_is_globe_mode:new U_(e,t.u_is_globe_mode)}),terrainDepth:(e,t)=>({u_ele_delta:new U_(e,t.u_ele_delta)}),atmosphere:(e,t)=>({u_sun_pos:new j_(e,t.u_sun_pos),u_atmosphere_blend:new U_(e,t.u_atmosphere_blend),u_globe_position:new j_(e,t.u_globe_position),u_globe_radius:new U_(e,t.u_globe_radius),u_inv_proj_matrix:new Z_(e,t.u_inv_proj_matrix)}),sky:(e,t)=>({u_sky_color:new q_(e,t.u_sky_color),u_horizon_color:new q_(e,t.u_horizon_color),u_horizon:new N_(e,t.u_horizon),u_horizon_normal:new N_(e,t.u_horizon_normal),u_sky_horizon_blend:new U_(e,t.u_sky_horizon_blend),u_sky_blend:new U_(e,t.u_sky_blend),u_inv_proj_matrix:new Z_(e,t.u_inv_proj_matrix),u_globe_position:new j_(e,t.u_globe_position),u_globe_radius:new U_(e,t.u_globe_radius)})};var uF=class{constructor(e,t,i){this.context=e;let n=e.gl;this.buffer=n.createBuffer(),this.dynamicDraw=!!i,this.context.unbindVAO(),e.bindElementBuffer.set(this.buffer),n.bufferData(n.ELEMENT_ARRAY_BUFFER,t.arrayBuffer,this.dynamicDraw?n.DYNAMIC_DRAW:n.STATIC_DRAW),this.dynamicDraw||t.freeBufferAfterUpload()}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(e){let t=this.context.gl;if(!this.dynamicDraw)throw Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),t.bufferSubData(t.ELEMENT_ARRAY_BUFFER,0,e.arrayBuffer)}destroy(){let e=this.context.gl;this.buffer&&(e.deleteBuffer(this.buffer),delete this.buffer)}};const hF={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};var dF=class{constructor(e,t,i,n){this.length=t.length,this.attributes=i,this.itemSize=t.bytesPerElement,this.dynamicDraw=n,this.context=e;let a=e.gl;this.buffer=a.createBuffer(),e.bindVertexBuffer.set(this.buffer),a.bufferData(a.ARRAY_BUFFER,t.arrayBuffer,this.dynamicDraw?a.DYNAMIC_DRAW:a.STATIC_DRAW),this.dynamicDraw||t.freeBufferAfterUpload()}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(e){if(e.length!==this.length)throw Error(`Length of new data is ${e.length}, which doesn't match current length of ${this.length}`);let t=this.context.gl;this.bind(),t.bufferSubData(t.ARRAY_BUFFER,0,e.arrayBuffer)}enableAttributes(e,t){for(let i of this.attributes){let n=t.attributes[i.name];void 0!==n&&e.enableVertexAttribArray(n.location)}}setVertexAttribPointers(e,t,i){for(let n of this.attributes){let a=t.attributes[n.name];if(void 0!==a){let t=n.offset+this.itemSize*(i||0);a.isInteger?e.vertexAttribIPointer(a.location,n.components,e[hF[n.type]],this.itemSize,t):e.vertexAttribPointer(a.location,n.components,e[hF[n.type]],!1,this.itemSize,t)}}}destroy(){let e=this.context.gl;this.buffer&&(e.deleteBuffer(this.buffer),delete this.buffer)}},pF=class{constructor(e){this.gl=e.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(e){}getDefault(){return this.default}setDefault(){this.set(this.default)}},mF=class extends pF{getDefault(){return ep.transparent}set(e){let t=this.current;(e.r!==t.r||e.g!==t.g||e.b!==t.b||e.a!==t.a||this.dirty)&&(this.gl.clearColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}},gF=class extends pF{getDefault(){return 1}set(e){(e!==this.current||this.dirty)&&(this.gl.clearDepth(e),this.current=e,this.dirty=!1)}},fF=class extends pF{getDefault(){return 0}set(e){(e!==this.current||this.dirty)&&(this.gl.clearStencil(e),this.current=e,this.dirty=!1)}},AF=class extends pF{getDefault(){return[!0,!0,!0,!0]}set(e){let t=this.current;(e[0]!==t[0]||e[1]!==t[1]||e[2]!==t[2]||e[3]!==t[3]||this.dirty)&&(this.gl.colorMask(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}},_F=class extends pF{getDefault(){return!0}set(e){(e!==this.current||this.dirty)&&(this.gl.depthMask(e),this.current=e,this.dirty=!1)}},vF=class extends pF{getDefault(){return 255}set(e){(e!==this.current||this.dirty)&&(this.gl.stencilMask(e),this.current=e,this.dirty=!1)}},yF=class extends pF{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(e){let t=this.current;(e.func!==t.func||e.ref!==t.ref||e.mask!==t.mask||this.dirty)&&(this.gl.stencilFunc(e.func,e.ref,e.mask),this.current=e,this.dirty=!1)}},xF=class extends pF{getDefault(){let e=this.gl;return[e.KEEP,e.KEEP,e.KEEP]}set(e){let t=this.current;(e[0]!==t[0]||e[1]!==t[1]||e[2]!==t[2]||this.dirty)&&(this.gl.stencilOp(e[0],e[1],e[2]),this.current=e,this.dirty=!1)}},bF=class extends pF{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;e?t.enable(t.STENCIL_TEST):t.disable(t.STENCIL_TEST),this.current=e,this.dirty=!1}},wF=class extends pF{getDefault(){return[0,1]}set(e){let t=this.current;(e[0]!==t[0]||e[1]!==t[1]||this.dirty)&&(this.gl.depthRange(e[0],e[1]),this.current=e,this.dirty=!1)}},EF=class extends pF{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;e?t.enable(t.DEPTH_TEST):t.disable(t.DEPTH_TEST),this.current=e,this.dirty=!1}},kF=class extends pF{getDefault(){return this.gl.LESS}set(e){(e!==this.current||this.dirty)&&(this.gl.depthFunc(e),this.current=e,this.dirty=!1)}},SF=class extends pF{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;e?t.enable(t.BLEND):t.disable(t.BLEND),this.current=e,this.dirty=!1}},MF=class extends pF{getDefault(){let e=this.gl;return[e.ONE,e.ZERO]}set(e){let t=this.current;(e[0]!==t[0]||e[1]!==t[1]||this.dirty)&&(this.gl.blendFunc(e[0],e[1]),this.current=e,this.dirty=!1)}},CF=class extends pF{getDefault(){return ep.transparent}set(e){let t=this.current;(e.r!==t.r||e.g!==t.g||e.b!==t.b||e.a!==t.a||this.dirty)&&(this.gl.blendColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}},TF=class extends pF{getDefault(){return this.gl.FUNC_ADD}set(e){(e!==this.current||this.dirty)&&(this.gl.blendEquation(e),this.current=e,this.dirty=!1)}},DF=class extends pF{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;e?t.enable(t.CULL_FACE):t.disable(t.CULL_FACE),this.current=e,this.dirty=!1}},PF=class extends pF{getDefault(){return this.gl.BACK}set(e){(e!==this.current||this.dirty)&&(this.gl.cullFace(e),this.current=e,this.dirty=!1)}},IF=class extends pF{getDefault(){return this.gl.CCW}set(e){(e!==this.current||this.dirty)&&(this.gl.frontFace(e),this.current=e,this.dirty=!1)}},FF=class extends pF{getDefault(){return null}set(e){(e!==this.current||this.dirty)&&(this.gl.useProgram(e),this.current=e,this.dirty=!1)}},zF=class extends pF{getDefault(){return this.gl.TEXTURE0}set(e){(e!==this.current||this.dirty)&&(this.gl.activeTexture(e),this.current=e,this.dirty=!1)}},RF=class extends pF{getDefault(){let e=this.gl;return[0,0,e.drawingBufferWidth,e.drawingBufferHeight]}set(e){let t=this.current;(e[0]!==t[0]||e[1]!==t[1]||e[2]!==t[2]||e[3]!==t[3]||this.dirty)&&(this.gl.viewport(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}},LF=class extends pF{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.bindFramebuffer(t.FRAMEBUFFER,e),this.current=e,this.dirty=!1}},BF=class extends pF{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.bindRenderbuffer(t.RENDERBUFFER,e),this.current=e,this.dirty=!1}},OF=class extends pF{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.bindTexture(t.TEXTURE_2D,e),this.current=e,this.dirty=!1}},UF=class extends pF{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.bindBuffer(t.ARRAY_BUFFER,e),this.current=e,this.dirty=!1}},NF=class extends pF{getDefault(){return null}set(e){let t=this.gl;t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,e),this.current=e,this.dirty=!1}},jF=class extends pF{getDefault(){return null}set(e){(e!==this.current||this.dirty)&&(this.gl.bindVertexArray(e),this.current=e,this.dirty=!1)}},VF=class extends pF{getDefault(){return 4}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.pixelStorei(t.UNPACK_ALIGNMENT,e),this.current=e,this.dirty=!1}},qF=class extends pF{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e),this.current=e,this.dirty=!1}},GF=class extends pF{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,e),this.current=e,this.dirty=!1}},HF=class extends pF{constructor(e,t){super(e),this.context=e,this.parent=t}getDefault(){return null}},WF=class extends HF{setDirty(){this.dirty=!0}set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let t=this.gl;t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,e,0),this.current=e,this.dirty=!1}},ZF=class extends HF{set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let t=this.gl;t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.RENDERBUFFER,e),this.current=e,this.dirty=!1}},KF=class extends HF{set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let t=this.gl;t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.RENDERBUFFER,e),this.current=e,this.dirty=!1}},XF=class{constructor(e,t,i,n,a){this.context=e,this.width=t,this.height=i;let r=e.gl,s=this.framebuffer=r.createFramebuffer();if(this.colorAttachment=new WF(e,s),n)this.depthAttachment=a?new KF(e,s):new ZF(e,s);else if(a)throw Error("Stencil cannot be set without depth")}destroy(){let e=this.context.gl,t=this.colorAttachment.get();if(t&&e.deleteTexture(t),this.depthAttachment){let t=this.depthAttachment.get();t&&e.deleteRenderbuffer(t)}e.deleteFramebuffer(this.framebuffer)}};const QF=MI([{name:"u_units_to_pixels",type:"vec2"},{name:"u_world_size",type:"vec2"},{name:"u_camera_to_center_distance",type:"float"},{name:"u_symbol_fade_change",type:"float"},{name:"u_aspect_ratio",type:"float"},{name:"u_device_pixel_ratio",type:"float"},{name:"u_viewport_size",type:"vec2"},{name:"u_pixel_extrude_scale",type:"vec2"},{name:"u_pitch",type:"float"}]),YF=QF.offsets;var JF=class{constructor(e,t,i){this.blendFunction=e,this.blendColor=t,this.mask=i}};JF.Replace=[1,0],JF.disabled=new JF(JF.Replace,ep.transparent,[!1,!1,!1,!1]),JF.unblended=new JF(JF.Replace,ep.transparent,[!0,!0,!0,!0]),JF.alphaBlended=new JF([1,771],ep.transparent,[!0,!0,!0,!0]);var $F=class{constructor(e){this.gl=e,this.clearColor=new mF(this),this.clearDepth=new gF(this),this.clearStencil=new fF(this),this.colorMask=new AF(this),this.depthMask=new _F(this),this.stencilMask=new vF(this),this.stencilFunc=new yF(this),this.stencilOp=new xF(this),this.stencilTest=new bF(this),this.depthRange=new wF(this),this.depthTest=new EF(this),this.depthFunc=new kF(this),this.blend=new SF(this),this.blendFunc=new MF(this),this.blendColor=new CF(this),this.blendEquation=new TF(this),this.cullFace=new DF(this),this.cullFaceSide=new PF(this),this.frontFace=new IF(this),this.program=new FF(this),this.activeTexture=new zF(this),this.viewport=new RF(this),this.bindFramebuffer=new LF(this),this.bindRenderbuffer=new BF(this),this.bindTexture=new OF(this),this.bindVertexBuffer=new UF(this),this.bindElementBuffer=new NF(this),this.bindVertexArray=new jF(this),this.pixelStoreUnpack=new VF(this),this.pixelStoreUnpackPremultiplyAlpha=new qF(this),this.pixelStoreUnpackFlipY=new GF(this),this.extTextureFilterAnisotropic=e.getExtension("EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=e.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=e.getParameter(e.MAX_TEXTURE_SIZE),e.getExtension("EXT_color_buffer_half_float"),e.getExtension("EXT_color_buffer_float"),this.projectionUniformBuffer=function(e){return new CI(e,kI.ProjectionUBO,TI)}(this),this.terrainUniformBuffer=function(e){return new CI(e,kI.TerrainUBO,PI)}(this),this.frameUniformBuffer=function(e){return new CI(e,kI.FrameUBO,QF)}(this)}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,this.projectionUniformBuffer.bindingDirty=!0,this.terrainUniformBuffer.bindingDirty=!0,this.frameUniformBuffer.bindingDirty=!0}setCustomLayerDefaults(){this.unbindVAO(),this.cullFace.setDefault(),this.activeTexture.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}createIndexBuffer(e,t){return new uF(this,e,t)}createVertexBuffer(e,t,i){return new dF(this,e,t,i)}createRenderbuffer(e,t,i){let n=this.gl,a=n.createRenderbuffer();return this.bindRenderbuffer.set(a),n.renderbufferStorage(n.RENDERBUFFER,e,t,i),this.bindRenderbuffer.set(null),a}createFramebuffer(e,t,i,n){return new XF(this,e,t,i,n)}clear({color:e,depth:t,stencil:i}){let n=this.gl,a=0;e&&(a|=n.COLOR_BUFFER_BIT,this.clearColor.set(e),this.colorMask.set([!0,!0,!0,!0])),void 0!==t&&(a|=n.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(t),this.depthMask.set(!0)),void 0!==i&&(a|=n.STENCIL_BUFFER_BIT,this.clearStencil.set(i),this.stencilMask.set(255)),n.clear(a)}setCullFace(e){!1===e.enable?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(e.mode),this.frontFace.set(e.frontFace))}setDepthMode(e){e.func!==this.gl.ALWAYS||e.mask?(this.depthTest.set(!0),this.depthFunc.set(e.func),this.depthMask.set(e.mask),this.depthRange.set(e.range)):this.depthTest.set(!1)}setStencilMode(e){e.test.func!==this.gl.ALWAYS||e.mask?(this.stencilTest.set(!0),this.stencilMask.set(e.mask),this.stencilOp.set([e.fail,e.depthFail,e.pass]),this.stencilFunc.set({func:e.test.func,ref:e.ref,mask:e.test.mask})):this.stencilTest.set(!1)}setColorMode(e){Ah(e.blendFunction,JF.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(e.blendFunction),this.blendColor.set(e.blendColor)),this.colorMask.set(e.mask)}createVertexArray(){return this.gl.createVertexArray()}deleteVertexArray(e){this.gl.deleteVertexArray(e)}unbindVAO(){this.bindVertexArray.set(null)}},ez=class{constructor(e,t,i){this.func=e,this.mask=t,this.range=i}};ez.ReadOnly=!1,ez.ReadWrite=!0,ez.disabled=new ez(519,ez.ReadOnly,[0,1]);const tz=7680;var iz=class{constructor(e,t,i,n,a,r){this.test=e,this.ref=t,this.mask=i,this.fail=n,this.depthFail=a,this.pass=r}};iz.disabled=new iz({func:519,mask:0},0,0,tz,tz,tz);const nz=2305;var az=class{constructor(e,t,i){this.enable=e,this.mode=t,this.frontFace=i}};let rz;function sz(e,t,i,n,a){let r=e.context,s=e.transform,o=r.gl,l=e.useProgram("collisionBox"),c=[],u=0,h=0;for(let d of n){let n=t.getTile(d).getBucket(i);if(!n)continue;let p=a?n.textCollisionBox:n.iconCollisionBox,m=n.collisionCircleArray;m.length>0&&(c.push({circleArray:m,circleOffset:h,coord:d}),u+=m.length/4,h=u),p&&l.draw(r,o.LINES,ez.disabled,iz.disabled,e.colorModeForRenderPass(),az.disabled,null,e.style.map.terrain?.getTerrainData(d),s.getProjectionData({overscaledTileID:d,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),i.id,p.layoutVertexBuffer,p.indexBuffer,p.segments,null,e.transform.zoom,null,null,p.collisionVertexBuffer)}if(!a||!c.length)return;let d=e.useProgram("collisionCircle"),p=new v_;p.resize(4*u),p._trim();let m=0;for(let e of c)for(let t=0;t<e.circleArray.length/4;t++){let i=4*t,n=e.circleArray[i+0],a=e.circleArray[i+1],r=e.circleArray[i+2],s=e.circleArray[i+3];p.emplace(m++,n,a,r,s,0),p.emplace(m++,n,a,r,s,1),p.emplace(m++,n,a,r,s,2),p.emplace(m++,n,a,r,s,3)}(!rz||rz.length<2*u)&&(rz=function(e){let t=2*e,i=new x_;i.resize(t),i._trim();for(let e=0;e<t;e++){let t=6*e;i.uint16[t+0]=4*e+0,i.uint16[t+1]=4*e+1,i.uint16[t+2]=4*e+2,i.uint16[t+3]=4*e+2,i.uint16[t+4]=4*e+3,i.uint16[t+5]=4*e+0}return i}(u));let g=r.createIndexBuffer(rz,!0),f=r.createVertexBuffer(p,gb.members,!0);for(let t of c)d.draw(r,o.TRIANGLES,ez.disabled,iz.disabled,e.colorModeForRenderPass(),az.disabled,null,e.style.map.terrain?.getTerrainData(t.coord),null,i.id,f,g,S_.simpleSegment(0,2*t.circleOffset,t.circleArray.length,t.circleArray.length/2),null,e.transform.zoom,null,null,null);f.destroy(),g.destroy()}az.disabled=new az(!1,1029,nz),az.backCCW=new az(!0,1029,nz),az.frontCCW=new az(!0,1028,nz);const oz=eu(new Float32Array(16));function lz(e,t,i,n,a,r){let{horizontalAlign:s,verticalAlign:o}=Cw(e),l=-(o-.5)*i;return new Hc((-(s-.5)*t/a+n[0])*r,(l/a+n[1])*r)}function cz(e,t,i,n,a,r){let s=t.tileAnchorPoint.add(new Hc(t.translation[0],t.translation[1]));if(t.pitchWithMap){let e=n.mult(r);i||(e=e.rotate(-a));let o=s.add(e);return bD(o.x,o.y,t.pitchedLabelPlaneMatrix,xD(t,o.x,o.y)).point}if(i){let i=PD(t.tileAnchorPoint.x+1,t.tileAnchorPoint.y,t).point.sub(e),a=Math.atan(i.y/i.x)+(i.x<0?Math.PI:0);return e.add(n.rotate(a))}return e.add(n)}function uz(e,t,i,n,a,r,s,o,l,c,u,h,d){let p=e.text.placedSymbolArray,m=e.text.dynamicLayoutVertexArray,g=e.icon.dynamicLayoutVertexArray,f={};m.clear();for(let g=0;g<p.length;g++){let A=p.get(g),_=e.allowVerticalPlacement&&!A.placedOrientation,v=A.hidden||!A.crossTileID||_?null:n[A.crossTileID];if(v){let n=new Hc(A.anchorX,A.anchorY),p={getElevation:h,heightOffset:A.heightOffset,heightAnchorGround:d,width:a.width,height:a.height,pitchedLabelPlaneMatrix:r,pitchWithMap:i,transform:a,tileAnchorPoint:n,translation:c,unwrappedTileID:u},g=i?FD(n.x,n.y,p):PD(n.x,n.y,p),_=wD(a.cameraToCenterDistance,g.signedDistanceFromCamera),y=Gw(e.textSizeData,o,A)*_/24;i&&(y*=e.tilePixelRatio/s);let{width:x,height:b,anchor:w,textOffset:E,textBoxScale:k}=v,S=lz(w,x,b,E,k,y),M=a.getPitchedTextCorrection(n.x+c[0],n.y+c[1],u),C=cz(g.point,p,t,S,-a.bearingInRadians,M),T=e.allowVerticalPlacement&&2===A.placedOrientation?Math.PI/2:0;for(let e=0;e<A.numGlyphs;e++)wE(m,C,T);l&&A.associatedIconIndex>=0&&(f[A.associatedIconIndex]={shiftedAnchor:C,angle:T})}else OD(A.numGlyphs,m)}if(l){g.clear();let t=e.icon.placedSymbolArray;for(let e=0;e<t.length;e++){let i=t.get(e);if(i.hidden)OD(i.numGlyphs,g);else{let t=f[e];if(t)for(let e=0;e<i.numGlyphs;e++)wE(g,t.shiftedAnchor,t.angle);else OD(i.numGlyphs,g)}}e.icon.dynamicLayoutVertexBuffer.updateData(g)}e.text.dynamicLayoutVertexBuffer.updateData(m)}function hz(e,t,i){return i.iconsInText&&t?"symbolTextAndIcon":e?"symbolSDF":"symbolIcon"}function dz(e,t,i,n,a,r,s,o,l,c,u,h,d){let p=e.context,m=p.gl,g=e.transform,f="map"===o,A="map"===l,_="viewport"!==o&&"point"!==i.layout.get("symbol-placement"),v=f&&!A&&!_,y=!i.layout.get("symbol-sort-key").isConstant(),x=!1,b=e.getDepthModeForSublayer(0,ez.ReadOnly),w=i._unevaluatedLayout.hasValue("text-variable-anchor")||i._unevaluatedLayout.hasValue("text-variable-anchor-offset"),E=[],k=g.getCircleRadiusCorrection();for(let o of n){let n=t.getTile(o),l=n.getBucket(i);if(!l)continue;let u=a?l.text:l.icon;if(!u?.segments.get().length||!u.hasVisibleVertices)continue;let h,p,b,S,M=u.programConfigurations.get(i.id),C=a||l.sdfIcons,T=a?l.textSizeData:l.iconSizeData,D=A||0!==g.pitch,P=e.useProgram(hz(C,a,l),M),I=Hw(T,g.zoom),F=e.style.map.terrain?.getTerrainData(o),z=[0,0],R=null;if(a){if(p=n.glyphAtlasTexture,b=m.LINEAR,h=n.glyphAtlasTexture.size,l.iconsInText){z=n.imageAtlasTexture.size,R=n.imageAtlasTexture;let t="composite"===T.kind||"camera"===T.kind;S=D||e.options.rotating||e.options.zooming||t?m.LINEAR:m.NEAREST}}else{let t=1!==i.layout.get("icon-size").constantOr(0)||l.iconsNeedLinear;p=n.imageAtlasTexture,b=C||e.options.rotating||e.options.zooming||t||D?m.LINEAR:m.NEAREST,h=n.imageAtlasTexture.size}let L=Nu(n,1,e.transform.zoom),B=_D(f,e.transform,L),O=vD(A,f,e.transform,L),U=Zu(g,n,r,s),N=g.getProjectionData({overscaledTileID:o,applyGlobeMatrix:!d,applyTerrainMatrix:!0}),j=w&&l.hasTextData(),V="none"!==i.layout.get("icon-text-fit")&&j&&l.hasIconData(),q=i._unevaluatedLayout.hasValue("icon-offset"),G="ground"===i.layout.get("symbol-height-anchor");if(_){let t=Jc();fD(t,B);let n=e.style.map.terrain?(t,i)=>e.style.map.terrain.getElevation(o,t,i):void 0;kD(l,e,a,B,t,A,c,"map"===i.layout.get("text-rotation-alignment"),o.toUnwrapped(),g.width,g.height,U,n)}let H,W=a&&w||V,Z=A?B:e.transform.clipSpaceToPixelsMatrix,K=_||W?oz:Z,X=C&&0!==i.paint.get(a?"text-halo-width":"icon-halo-width").constantOr(1);H=C?l.iconsInText?rF(T.kind,I,v,A,_,W,e,K,O,U,h,z,k,q,G):aF(T.kind,I,v,A,_,W,e,K,O,U,a,h,X,k,q,G):nF(T.kind,I,v,A,_,W,0,K,O,U,a,h,k,q,G);let Q={program:P,buffers:u,uniformValues:H,projectionData:N,atlasTexture:p,atlasTextureIcon:R,atlasInterpolation:b,atlasInterpolationIcon:S,isSDF:C,hasHalo:X};if(y&&l.canOverlap){x=!0;let e=u.segments.get();for(let t of e)E.push({segments:new S_([t]),sortKey:t.sortKey,state:Q,terrainData:F})}else E.push({segments:u.segments,sortKey:0,state:Q,terrainData:F})}x&&E.sort((e,t)=>e.sortKey-t.sortKey);let S=i.paint.get(a?"text-halo-width":"icon-halo-width").constantOr(null)??1/0,M=24*i.layout.get("text-letter-spacing").constantOr(0)<0||S>1;for(let t of E){let n=t.state;p.activeTexture.set(m.TEXTURE0),n.atlasTexture.bind(n.atlasInterpolation,m.CLAMP_TO_EDGE),n.atlasTextureIcon&&(p.activeTexture.set(m.TEXTURE1),n.atlasTextureIcon&&n.atlasTextureIcon.bind(n.atlasInterpolationIcon,m.CLAMP_TO_EDGE));let a=n.isSDF&&n.hasHalo;if(a){let a=n.uniformValues;a.u_is_halo=1,M&&(a.u_is_plain=0,pz(n.buffers,t.segments,i,e,n.program,b,u,h,a,n.projectionData,t.terrainData),a.u_is_halo=0,a.u_is_plain=1)}pz(n.buffers,t.segments,i,e,n.program,b,u,h,n.uniformValues,n.projectionData,t.terrainData),a&&!M&&(n.uniformValues.u_is_halo=0)}}function pz(e,t,i,n,a,r,s,o,l,c,u){let h=n.context,d=h.gl;a.draw(h,d.TRIANGLES,r,s,o,az.backCCW,l,u,c,i.id,e.layoutVertexBuffer,e.indexBuffer,t,i.paint,n.transform.zoom,e.programConfigurations.get(i.id),e.dynamicLayoutVertexBuffer,e.opacityVertexBuffer)}function mz(e,t,i,n,a){let r=e.context,s=r.gl,o=iz.disabled,l=new JF([s.ONE,s.ONE],ep.transparent,[!0,!0,!0,!0]),c=t.getBucket(i);if(!c)return;let u=n.key,h=i.heatmapFbos.get(u);h||(h=fz(r,t.tileSize,t.tileSize),i.heatmapFbos.set(u,h)),r.bindFramebuffer.set(h.framebuffer),r.viewport.set([0,0,t.tileSize,t.tileSize]),r.clear({color:ep.transparent});let d=c.programConfigurations.get(i.id),p=e.useProgram("heatmap",d,!a),m=e.transform.getProjectionData({overscaledTileID:t.tileID,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),g=e.style.map.terrain.getTerrainData(n);p.draw(r,s.TRIANGLES,ez.disabled,o,l,az.disabled,GI(t,e.transform.zoom,i.paint.get("heatmap-intensity"),1),g,m,i.id,c.layoutVertexBuffer,c.indexBuffer,c.segments,i.paint,e.transform.zoom,d)}function gz(e,t,i,n,a){let r=e.context,s=r.gl,o=e.transform;r.setColorMode(e.colorModeForRenderPass());let l=Az(r,t),c=i.key,u=t.heatmapFbos.get(c);if(!u)return;r.activeTexture.set(s.TEXTURE0),s.bindTexture(s.TEXTURE_2D,u.colorAttachment.get()),r.activeTexture.set(s.TEXTURE1),l.bind(s.LINEAR,s.CLAMP_TO_EDGE);let h=o.getProjectionData({overscaledTileID:i,applyTerrainMatrix:a,applyGlobeMatrix:!n});e.useProgram("heatmapTexture").draw(r,s.TRIANGLES,ez.disabled,iz.disabled,e.colorModeForRenderPass(),az.disabled,HI(e,t,0,1),null,h,t.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments,t.paint,o.zoom),u.destroy(),t.heatmapFbos.delete(c)}function fz(e,t,i){let n=e.gl,a=n.createTexture();n.bindTexture(n.TEXTURE_2D,a),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.LINEAR),n.texStorage2D(n.TEXTURE_2D,1,n.RGBA16F,t,i);let r=e.createFramebuffer(t,i,!1,!1);return r.colorAttachment.set(a),r}function Az(e,t){return t.colorRampTexture||=new iy(e,t.colorRamp,e.gl.RGBA),t.colorRampTexture}function _z(e,t,i,n){let a=e.context,r=a.bindFramebuffer.get(),s=a.viewport.get(),[,,o,l]=s;return function(e,t,i){let n=e.context.gl;if(!e.layerOpacityFbo){let a=e.context.createFramebuffer(t,i,!0,!0),r=n.createTexture();return n.bindTexture(n.TEXTURE_2D,r),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.LINEAR),n.texImage2D(n.TEXTURE_2D,0,n.RGBA,t,i,0,n.RGBA,n.UNSIGNED_BYTE,null),a.colorAttachment.set(r),a.depthAttachment.set(e.context.createRenderbuffer(n.DEPTH_STENCIL,t,i)),e.layerOpacityFbo=a,void e.context.bindFramebuffer.set(e.layerOpacityFbo.framebuffer)}if(e.layerOpacityFbo.width===t&&e.layerOpacityFbo.height===i)return void e.context.bindFramebuffer.set(e.layerOpacityFbo.framebuffer);let a=e.layerOpacityFbo;n.bindTexture(n.TEXTURE_2D,a.colorAttachment.get()),n.texImage2D(n.TEXTURE_2D,0,n.RGBA,t,i,0,n.RGBA,n.UNSIGNED_BYTE,null),e.context.bindRenderbuffer.set(a.depthAttachment.get()),n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_STENCIL,t,i),e.context.bindRenderbuffer.set(null),a.width=t,a.height=i,e.context.bindFramebuffer.set(a.framebuffer)}(e,o,l),a.viewport.set([0,0,o,l]),a.clear({color:ep.transparent,depth:1,stencil:0}),e.currentStencilSource=void 0,e.renderTileClippingMasks(t,i,n),{compositeTarget:r,compositeViewport:s}}function vz(e,t,i,n){let a=e.context,r=a.gl;a.bindFramebuffer.set(i.compositeTarget),a.viewport.set(i.compositeViewport),a.activeTexture.set(r.TEXTURE0),r.bindTexture(r.TEXTURE_2D,e.layerOpacityFbo.colorAttachment.get()),e.useProgram("layerOpacity").draw(a,r.TRIANGLES,ez.disabled,iz.disabled,e.colorModeForRenderPass(),az.disabled,((e,t)=>({u_image:t,u_opacity:e}))(t,0),null,null,n.id,e.viewportBuffer,e.quadTriangleIndexBuffer,e.viewportSegments,n.paint,e.transform.zoom),e.currentStencilSource=void 0}function yz(e,t,i,n,a,r,s,o){let l=256;if(a.stepInterpolant){let n=t.getSource().maxzoom,a=s.canonical.z===n?Math.ceil(1<<e.transform.maxZoom-s.canonical.z):1;l=sh(function(e){return e<=1?1:2**Math.ceil(Math.log(e)/Math.LN2)}(r.maxLineLength/Uu*1024*a),256,i.maxTextureSize)}return o.gradient=Zv({expression:a.gradientExpression(),evaluationKey:"lineProgress",resolution:l,image:o.gradient||void 0,clips:r.lineClipsArray}),o.texture?o.texture.update(o.gradient):o.texture=new iy(i,o.gradient,n.RGBA),o.version=a.gradientVersion,o.texture}function xz(e,t,i,n,a){e.activeTexture.set(t.TEXTURE0),i.imageAtlasTexture.bind(t.LINEAR,t.CLAMP_TO_EDGE),n.updatePaintBuffers(a)}function bz(e,t,i,n,a,r){(a||e.lineAtlas.dirty)&&(t.activeTexture.set(i.TEXTURE0),e.lineAtlas.bind(t)),n.updatePaintBuffers(r)}function wz(e,t,i,n,a,r,s){let o=r.gradients[a.id],l=o.texture;a.gradientVersion!==o.version&&(l=yz(e,t,i,n,a,r,s,o)),i.activeTexture.set(n.TEXTURE0),l.bind(a.stepInterpolant?n.NEAREST:n.LINEAR,n.CLAMP_TO_EDGE)}function Ez(e,t,i,n,a,r,s,o,l){let c=r.gradients[a.id],u=c.texture;a.gradientVersion!==c.version&&(u=yz(e,t,i,n,a,r,s,c)),i.activeTexture.set(n.TEXTURE0),u.bind(a.stepInterpolant?n.NEAREST:n.LINEAR,n.CLAMP_TO_EDGE),i.activeTexture.set(n.TEXTURE1),e.lineAtlas.bind(i),o.updatePaintBuffers(l)}function kz(e,t,i,n,a,r){let s,{isRenderingToTexture:o}=a,l=e.getDepthModeForSublayer(0,ez.ReadOnly),c=e.colorModeForRenderPass(),u=i.paint.get("line-dasharray"),h=u.constantOr(1),d=i.paint.get("line-pattern"),p=d.constantOr(1),m=i.paint.get("line-gradient"),g=i.getCrossfadeParameters();s=p?"linePattern":h&&m?"lineGradientSDF":h?"lineSDF":m?"lineGradient":"line";let f=e.context,A=f.gl,_=e.transform,v=!0;for(let a of n){let n=t.getTile(a);if(p&&!n.patternsLoaded())continue;let y=n.getBucket(i);if(!y)continue;let x=y.programConfigurations.get(i.id),b=e.context.program.get(),w=e.useProgram(s,x),E=v||w.program!==b,k=r?e.getTerrainDataForTile(a,o):null,S=d.constantOr(null),M=u?.constantOr(null);if(S&&n.imageAtlas){let e=n.imageAtlas,t=e.patternPositions[S.to.toString()],i=e.patternPositions[S.from.toString()];t&&i&&x.setConstantPatternPositions(t,i)}else if(M){let t="round"===i.layout.get("line-cap").constantOr(null),n=e.lineAtlas.getDash(M.to,t),a=e.lineAtlas.getDash(M.from,t);x.setConstantDashPositions(n,a)}let C,T=_.getProjectionData({overscaledTileID:a,applyGlobeMatrix:!o,applyTerrainMatrix:!0}),D=_.getPixelScale();p?(C=JI(e,n,i,D,g),xz(f,A,n,x,g)):h&&m?(C=eF(e,n,i,D,g,y.lineClipsArray.length),Ez(e,t,f,A,i,y,a,x,g)):h?(C=$I(e,n,i,D,g),bz(e,f,A,x,E,g)):m?(C=YI(e,n,i,D,y.lineClipsArray.length),wz(e,t,f,A,i,y,a)):C=QI(e,n,i,D);let P=e.stencilModeForClipping(a);w.draw(f,A.TRIANGLES,l,P,c,az.disabled,C,k,T,i.id,y.layoutVertexBuffer,y.indexBuffer,y.segments,i.paint,e.transform.zoom,x,y.layoutVertexBuffer2),v=!1}}function Sz(e,t,i,n,a){if(!i||!n?.imageAtlas)return;let r=n.imageAtlas.patternPositions,s=r[i.to.toString()],o=r[i.from.toString()];if(!s&&o&&(s=o),!o&&s&&(o=s),!s||!o){let e=a.getPaintProperty(t);s=r[e],o=r[e]}s&&o&&e.setConstantPatternPositions(s,o)}function Mz(e,t,i,n,a){let{isRenderingToTexture:r}=a,s=e.colorModeForRenderPass();Tz(e,t,i,n,e.getDepthModeForSublayer(1,ez.ReadOnly),s,!1,r),Cz(e,t,i,n,a)}function Cz(e,t,i,n,a){if(!i.paint.get("fill-antialias"))return;let{isRenderingToTexture:r}=a,s=e.colorModeForRenderPass();Tz(e,t,i,n,e.getDepthModeForSublayer(i.getPaintProperty("fill-outline-color")?2:0,ez.ReadOnly),s,!0,r)}function Tz(e,t,i,n,a,r,s,o){let l,c,u,h,d,p=e.context.gl,m="fill-pattern",g=i.paint.get(m),f=g?.constantOr(1),A=i.getCrossfadeParameters(),_=e.transform,v=i.paint.get("fill-translate"),y=i.paint.get("fill-translate-anchor");s?(c=f&&!i.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",l=p.LINES):(c=f?"fillPattern":"fill",l=p.TRIANGLES);let x=g.constantOr(null);for(let g of n){let n=t.getTile(g);if(f&&!n.patternsLoaded())continue;let b=n.getBucket(i);if(!b)continue;let w=b.sdfPatterns[i.id]??!1,E=b.programConfigurations.get(i.id),k=e.useProgram(c,E),S=e.getTerrainDataForTile(g,o);f&&(e.context.activeTexture.set(p.TEXTURE0),n.imageAtlasTexture.bind(p.LINEAR,p.CLAMP_TO_EDGE),E.updatePaintBuffers(A)),Sz(E,m,x,n,i);let M=_.getProjectionData({overscaledTileID:g,applyGlobeMatrix:!o,applyTerrainMatrix:!0}),C=Zu(_,n,v,y);s?(h=b.indexBuffer2,d=b.segments2,u="fillOutlinePattern"===c&&f?jI(e,A,n,C,w):NI(C)):(h=b.indexBuffer,d=b.segments,u=f?OI(e,A,n,C,w):UI(C));let T=e.stencilModeForClipping(g);k.draw(e.context,l,a,T,r,az.backCCW,u,S,M,i.id,b.layoutVertexBuffer,h,d,i.paint,e.transform.zoom,E)}}function Dz(e,t,i,n,a,r,s,o){let l=e.context,c=l.gl,u="fill-extrusion-pattern",h=i.paint.get(u),d=h.constantOr(1),p=i.getCrossfadeParameters(),m=i.paint.get("fill-extrusion-opacity"),g=h.constantOr(null),f=e.transform;for(let h of n){let n=t.getTile(h),A=n.getBucket(i);if(!A)continue;let _=e.style.map.terrain?.getTerrainData(h),v=A.programConfigurations.get(i.id),y=e.useProgram(d?"fillExtrusionPattern":"fillExtrusion",v);d&&(e.context.activeTexture.set(c.TEXTURE0),n.imageAtlasTexture.bind(c.LINEAR,c.CLAMP_TO_EDGE),v.updatePaintBuffers(p));let x=f.getProjectionData({overscaledTileID:h,applyGlobeMatrix:!o,applyTerrainMatrix:!0});Sz(v,u,g,n,i);let b=Zu(f,n,i.paint.get("fill-extrusion-translate"),i.paint.get("fill-extrusion-translate-anchor")),w=i.paint.get("fill-extrusion-vertical-gradient"),E=d?BI(e,w,m,b,h,p,n):LI(e,w,m,b);y.draw(l,l.gl.TRIANGLES,a,r,s,az.backCCW,E,_,x,i.id,A.layoutVertexBuffer,A.indexBuffer,A.segments,i.paint,e.transform.zoom,v,e.style.map.terrain&&A.centroidVertexBuffer)}}function Pz(e,t,i,n,a,r,s,o,l){let c=e.style.projection,u=e.context,h=e.transform,d=u.gl,p=[`#define NUM_ILLUMINATION_SOURCES ${i.paint.get("hillshade-highlight-color").values.length}`],m=e.useProgram("hillshade",null,!1,p),g=!e.options.moving;for(let p of n){let n=t.getTile(p),f=n.fbo;if(!f)continue;let A=c.getMeshFromTileID(u,p.canonical,o,!0,"raster"),_=e.getTerrainDataForTile(p,l);u.activeTexture.set(d.TEXTURE0),d.bindTexture(d.TEXTURE_2D,f.colorAttachment.get());let v=h.getProjectionData({overscaledTileID:p,aligned:g,applyGlobeMatrix:!l,applyTerrainMatrix:!0});m.draw(u,d.TRIANGLES,r,a[p.overscaledZ],s,az.backCCW,WI(e,n,i),_,v,i.id,A.vertexBuffer,A.indexBuffer,A.segments)}}let Iz=0;function Fz(e,t,i,n,a,r,s,o,l){let c=e.style.projection,u=e.context,h=e.transform,d=u.gl,p=e.useProgram("colorRelief"),m=!e.options.moving,g="nearest"===i.paint.get("resampling")?d.NEAREST:d.LINEAR,f=!0,A=0;for(let _ of n){let n=t.getTile(_),v=n.dem;if(!v?.data)continue;if(f){Iz||=d.getParameter(d.MAX_TEXTURE_SIZE);let e=Iz,{elevationTexture:t,colorTexture:n}=i.getColorRampTextures(u,e,v.getUnpackVector());u.activeTexture.set(d.TEXTURE1),t.bind(d.NEAREST,d.CLAMP_TO_EDGE),u.activeTexture.set(d.TEXTURE4),n.bind(d.LINEAR,d.CLAMP_TO_EDGE),f=!1,A=t.size[0]}let y=v.stride;u.activeTexture.set(d.TEXTURE0),(!n.demTexture||n.needsColorReliefPrepare)&&(u.pixelStoreUnpackPremultiplyAlpha.set(!1),n.demTexture||=e.getTileTexture(y)??new iy(u,{width:y,height:y,data:null},d.RGBA),n.demTexture.update(v.getPixels(),{premultiply:!1}),n.needsColorReliefPrepare=!1),n.demTexture.bind(g,d.CLAMP_TO_EDGE);let x=c.getMeshFromTileID(u,_.canonical,o,!0,"raster"),b=e.getTerrainDataForTile(_,l),w=h.getProjectionData({overscaledTileID:_,aligned:m,applyGlobeMatrix:!l,applyTerrainMatrix:!0});p.draw(u,d.TRIANGLES,r,a[_.overscaledZ],s,az.backCCW,XI(i,n.dem,A),b,w,i.id,x.vertexBuffer,x.indexBuffer,x.segments)}}const zz=[new Hc(0,0),new Hc(Uu,0),new Hc(Uu,Uu),new Hc(0,Uu)];function Rz(e,t,i,n,a,r,s,o,l,c=!1,u=!1,h=null){let d=n[n.length-1].overscaledZ,p=e.context,m=p.gl,g=e.useProgram("raster"),f=e.transform,A=e.style.projection,_=e.colorModeForRenderPass(),v=!e.options.moving,y=i.paint.get("raster-opacity"),x="nearest"===i.paint.get("resampling")||"nearest"===i.paint.get("raster-resampling")?m.NEAREST:m.LINEAR,b=i.paint.get("raster-fade-duration"),w=!!e.style.map.terrain;for(let E of n){let n=e.getDepthModeForSublayer(E.overscaledZ-d,1===y?ez.ReadWrite:ez.ReadOnly,m.LESS),k=t.getTile(E);p.activeTexture.set(m.TEXTURE0),k.texture.bind(x,m.CLAMP_TO_EDGE,m.LINEAR_MIPMAP_NEAREST),p.activeTexture.set(m.TEXTURE1);let{parentTile:S,parentScaleBy:M,parentTopLeft:C,fadeValues:T}=Lz(k,t,b,w);k.fadeOpacity=T.tileOpacity,S?(S.fadeOpacity=T.parentTileOpacity,S.texture.bind(x,m.CLAMP_TO_EDGE,m.LINEAR_MIPMAP_NEAREST)):k.texture.bind(x,m.CLAMP_TO_EDGE,m.LINEAR_MIPMAP_NEAREST),k.texture.useMipmap&&p.extTextureFilterAnisotropic&&e.transform.pitch>e.options.anisotropicFilterPitch&&m.texParameterf(m.TEXTURE_2D,p.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,p.extTextureFilterAnisotropicMax);let D=e.getTerrainDataForTile(E,u),P=f.getProjectionData({overscaledTileID:E,aligned:v,applyGlobeMatrix:!u,applyTerrainMatrix:!0}),I=TT(C,M,T.fadeMix,i,o,l),F=h??A.getMeshFromTileID(p,E.canonical,r,s,"raster"),z=a?a[E.overscaledZ]:iz.disabled;g.draw(p,m.TRIANGLES,n,z,_,c?az.frontCCW:az.backCCW,I,D,P,i.id,F.vertexBuffer,F.indexBuffer,F.segments)}}function Lz(e,t,i,n){let a={parentTile:null,parentScaleBy:1,parentTopLeft:[0,0],fadeValues:{tileOpacity:1,parentTileOpacity:1,fadeMix:{opacity:1,mix:0}}};if(0===i||n)return a;if(e.fadingParentID){let n=t.getLoadedTile(e.fadingParentID);if(!n)return a;let r=2**(n.tileID.overscaledZ-e.tileID.overscaledZ);return{parentTile:n,parentScaleBy:r,parentTopLeft:[e.tileID.canonical.x*r%1,e.tileID.canonical.y*r%1],fadeValues:Bz(e,n,i)}}return e.selfFading?{parentTile:null,parentScaleBy:1,parentTopLeft:[0,0],fadeValues:Oz(e,i)}:a}function Bz(e,t,i){let n=tC(),a=(n-e.timeAdded)/i,r=(n-t.timeAdded)/i,s=1===e.fadingDirection,o=sh(a,0,1),l=sh(1-r,0,1),c=s?o:l;return{tileOpacity:c,parentTileOpacity:s?l:o,fadeMix:{opacity:1,mix:1-c}}}function Oz(e,t){let i=sh((tC()-e.timeAdded)/t,0,1);return{tileOpacity:i,fadeMix:{opacity:i,mix:0}}}const Uz=new ep(1,0,0,1),Nz=new ep(0,1,0,1),jz=new ep(0,0,1,1),Vz=new ep(1,0,1,1),qz=new ep(0,1,1,1);function Gz(e,t,i,n){Wz(e,0,t+i/2,e.transform.width,i,n)}function Hz(e,t,i,n){Wz(e,t-i/2,0,i,e.transform.height,n)}function Wz(e,t,i,n,a,r){let s=e.context,o=s.gl;o.enable(o.SCISSOR_TEST),o.scissor(t*e.pixelRatio,i*e.pixelRatio,n*e.pixelRatio,a*e.pixelRatio),s.clear({color:r}),o.disable(o.SCISSOR_TEST)}function Zz(e,t,i){let n=e.context,a=n.gl,r=e.useProgram("debug"),s=ez.disabled,o=iz.disabled,l=e.colorModeForRenderPass(),c="$debug",u=e.style.map.terrain?.getTerrainData(i);n.activeTexture.set(a.TEXTURE0);let h=t.getTileByID(i.key).latestRawTileData?.byteLength||0,d=Math.floor(h/1024),p=t.getTile(i).tileSize,m=512/Math.min(p,512)*(i.overscaledZ/e.transform.zoom)*.5,g=i.canonical.toString();i.overscaledZ!==i.canonical.z&&(g+=` => ${i.overscaledZ}`),function(e,t){e.initDebugOverlayCanvas();let i=e.debugOverlayCanvas,n=e.context.gl,a=e.debugOverlayCanvas.getContext("2d");a.clearRect(0,0,i.width,i.height),a.shadowColor="white",a.shadowBlur=2,a.lineWidth=1.5,a.strokeStyle="white",a.textBaseline="top",a.font="bold 36px Open Sans, sans-serif",a.fillText(t,5,5),a.strokeText(t,5,5),e.debugOverlayTexture.update(i),e.debugOverlayTexture.bind(n.LINEAR,n.CLAMP_TO_EDGE)}(e,`${g} ${d}kB`);let f=e.transform.getProjectionData({overscaledTileID:i,applyGlobeMatrix:!0,applyTerrainMatrix:!0});r.draw(n,a.TRIANGLES,s,o,JF.alphaBlended,az.disabled,qI(ep.transparent,m),null,f,c,e.debugBuffer,e.quadTriangleIndexBuffer,e.debugSegments),r.draw(n,a.LINE_STRIP,s,o,l,az.disabled,qI(ep.red),u,f,c,e.debugBuffer,e.tileBorderIndexBuffer,e.debugSegments)}function Kz(e,t){if(!t.mesh){let i=new r_;i.emplaceBack(-1,-1),i.emplaceBack(1,-1),i.emplaceBack(1,1),i.emplaceBack(-1,1);let n=new b_;n.emplaceBack(0,1,2),n.emplaceBack(0,2,3),t.mesh=new FT(e.createVertexBuffer(i,zT.members),e.createIndexBuffer(n),S_.simpleSegment(0,0,i.length,n.length))}return t.mesh}const Xz={symbol:function(e,t,i,n,a,r){if("translucent"!==r.currentPass)return;let{isRenderingToTexture:s}=r,o=iz.disabled,l=e.colorModeForRenderPass();(i._unevaluatedLayout.hasValue("text-variable-anchor")||i._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(e,t,i,n,a,r,s,o,l){let c=t.transform,u=t.style.map.terrain,h="map"===a,d="map"===r;for(let a of e){let e=n.getTile(a),r=e.getBucket(i);if(!r?.text?.segments.get().length)continue;let p=Hw(r.textSizeData,c.zoom),m=Nu(e,1,t.transform.zoom),g=_D(h,t.transform,m),f="none"!==i.layout.get("icon-text-fit")&&r.hasIconData();if(p){let t=2**(c.zoom-e.tileID.overscaledZ),n=u?(e,t)=>u.getElevation(a,e,t):void 0;uz(r,h,d,l,c,g,t,p,f,Zu(c,e,s,o),a.toUnwrapped(),n,"ground"===i.layout.get("symbol-height-anchor"))}}}(n,e,i,t,i.layout.get("text-rotation-alignment"),i.layout.get("text-pitch-alignment"),i.paint.get("text-translate"),i.paint.get("text-translate-anchor"),a),0!==i.paint.get("icon-opacity").constantOr(1)&&dz(e,t,i,n,!1,i.paint.get("icon-translate"),i.paint.get("icon-translate-anchor"),i.layout.get("icon-rotation-alignment").constantOr("viewport"),i.layout.get("icon-pitch-alignment"),i.layout.get("icon-keep-upright"),o,l,s),0!==i.paint.get("text-opacity").constantOr(1)&&dz(e,t,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"),o,l,s),t.map.showCollisionBoxes&&(sz(e,t,i,n,!0),sz(e,t,i,n,!1))},circle:function(e,t,i,n,a){if("translucent"!==a.currentPass)return;let{isRenderingToTexture:r}=a,s=i.paint.get("circle-opacity"),o=i.paint.get("circle-stroke-width"),l=i.paint.get("circle-stroke-opacity"),c=!i.layout.get("circle-sort-key").isConstant();if(0===s.constantOr(1)&&(0===o.constantOr(1)||0===l.constantOr(1)))return;let u=e.context,h=u.gl,d=e.transform,p=e.getDepthModeForSublayer(0,ez.ReadOnly),m=iz.disabled,g=e.colorModeForRenderPass(),f=[],A=d.getCircleRadiusCorrection();for(let a of n){let n=t.getTile(a),s=n.getBucket(i);if(!s)continue;let o=Zu(d,n,i.paint.get("circle-translate"),i.paint.get("circle-translate-anchor")),l=s.programConfigurations.get(i.id),u=e.useProgram("circle",l),h=s.layoutVertexBuffer,p=s.indexBuffer,m=e.style.map.terrain?.getTerrainData(a),g={programConfiguration:l,program:u,layoutVertexBuffer:h,indexBuffer:p,uniformValues:VI(e,n,i,o,A),terrainData:m,projectionData:d.getProjectionData({overscaledTileID:a,applyGlobeMatrix:!r,applyTerrainMatrix:!0})};if(c){let e=s.segments.get();for(let t of e)f.push({segments:new S_([t]),sortKey:t.sortKey,state:g})}else f.push({segments:s.segments,sortKey:0,state:g})}c&&f.sort((e,t)=>e.sortKey-t.sortKey);for(let t of f){let{programConfiguration:n,program:a,layoutVertexBuffer:r,indexBuffer:s,uniformValues:o,terrainData:l,projectionData:c}=t.state,d=t.segments;a.draw(u,h.TRIANGLES,p,m,g,az.backCCW,o,l,c,i.id,r,s,d,i.paint,e.transform.zoom,n)}},heatmap:function(e,t,i,n,a){if(0===i.paint.get("heatmap-opacity"))return;let r=e.context,{isRenderingToTexture:s,isRenderingGlobe:o}=a;if(e.style.map.terrain){for(let r of n){let n=t.getTile(r);t.hasRenderableParent(r)||("offscreen"===a.currentPass?mz(e,n,i,r,o):"translucent"===a.currentPass&&gz(e,i,r,s,o))}r.viewport.set([0,0,e.width,e.height])}else"offscreen"===a.currentPass?function(e,t,i,n){let a=e.context,r=a.gl,s=e.transform,o=iz.disabled,l=new JF([r.ONE,r.ONE],ep.transparent,[!0,!0,!0,!0]);(function(e,t,i){let n=e.gl;e.activeTexture.set(n.TEXTURE1),e.viewport.set([0,0,t.width/4,t.height/4]);let a=i.heatmapFbos.get(Kv);a?(n.bindTexture(n.TEXTURE_2D,a.colorAttachment.get()),e.bindFramebuffer.set(a.framebuffer)):(a=fz(e,t.width/4,t.height/4),i.heatmapFbos.set(Kv,a))})(a,e,i),a.clear({color:ep.transparent});for(let c of n){if(t.hasRenderableParent(c))continue;let n=t.getTile(c),u=n.getBucket(i);if(!u)continue;let h=u.programConfigurations.get(i.id),d=e.useProgram("heatmap",h),p=s.getProjectionData({overscaledTileID:c,applyGlobeMatrix:!0,applyTerrainMatrix:!1}),m=s.getCircleRadiusCorrection();d.draw(a,r.TRIANGLES,ez.disabled,o,l,az.backCCW,GI(n,s.zoom,i.paint.get("heatmap-intensity"),m),null,p,i.id,u.layoutVertexBuffer,u.indexBuffer,u.segments,i.paint,s.zoom,h)}a.viewport.set([0,0,e.width,e.height])}(e,t,i,n):"translucent"===a.currentPass&&function(e,t){let i=e.context,n=i.gl;i.setColorMode(e.colorModeForRenderPass());let a=t.heatmapFbos.get(Kv);a&&(i.activeTexture.set(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,a.colorAttachment.get()),i.activeTexture.set(n.TEXTURE1),Az(i,t).bind(n.LINEAR,n.CLAMP_TO_EDGE),e.useProgram("heatmapTexture").draw(i,n.TRIANGLES,ez.disabled,iz.disabled,e.colorModeForRenderPass(),az.disabled,HI(e,t,0,1),null,null,t.id,e.viewportBuffer,e.quadTriangleIndexBuffer,e.viewportSegments,t.paint,e.transform.zoom))}(e,i)},line:function(e,t,i,n,a){if("translucent"!==a.currentPass)return;let r=i.paint.get("line-opacity"),s=i.paint.get("line-width"),o=i.paint.get("line-layer-opacity");if(0===r.constantOr(1)||0===s.constantOr(1)||0===o)return;let l=!!e.style.map.terrain;if(o<1){let r=_z(e,i,n,l);return kz(e,t,i,n,a,l),void vz(e,o,r,i)}kz(e,t,i,n,a,l)},fill:function(e,t,i,n,a){let r=i.paint.get("fill-color"),s=i.paint.get("fill-opacity"),o=i.paint.get("fill-layer-opacity");if(0===s.constantOr(1)||0===o)return;if(o<1){if("translucent"!==a.currentPass)return;let r=_z(e,i,n,!!e.style.map.terrain);return Mz(e,t,i,n,a),void vz(e,o,r,i)}let l=i.paint.get("fill-pattern"),c=e.opaquePassEnabledForLayer()&&!l.constantOr(1)&&1===r.constantOr(ep.transparent).a&&1===s.constantOr(0);if(c&&"opaque"===a.currentPass){let{isRenderingToTexture:r}=a,s=e.colorModeForRenderPass();return void Tz(e,t,i,n,e.getDepthModeForSublayer(1,ez.ReadWrite),s,!1,r)}c&&"translucent"===a.currentPass?Cz(e,t,i,n,a):"translucent"===a.currentPass&&Mz(e,t,i,n,a)},fillExtrusion:function(e,t,i,n,a){let r=i.paint.get("fill-extrusion-opacity");if(0===r)return;let{isRenderingToTexture:s}=a;if("translucent"===a.currentPass){let o=new ez(e.context.gl.LEQUAL,ez.ReadWrite,a.depthRangeFor3D);if(1!==r||i.paint.get("fill-extrusion-pattern").constantOr(1))Dz(e,t,i,n,o,iz.disabled,JF.disabled,s),Dz(e,t,i,n,o,e.stencilModeFor3D(),e.colorModeForRenderPass(),s);else{let a=e.colorModeForRenderPass();Dz(e,t,i,n,o,iz.disabled,a,s)}}},hillshade:function(e,t,i,n,a){if("offscreen"!==a.currentPass&&"translucent"!==a.currentPass)return;let{isRenderingToTexture:r}=a,s=e.context,o=e.style.projection.useSubdivision,l=e.getDepthModeForSublayer(0,ez.ReadOnly),c=e.colorModeForRenderPass();if("offscreen"===a.currentPass)(function(e,t,i,n,a,r,s){let o=e.context,l=o.gl,c="nearest"===n.paint.get("resampling")?l.NEAREST:l.LINEAR;for(let u of i){let i=t.getTile(u),h=i.dem;if(!h?.data||!i.needsHillshadePrepare)continue;let d=h.dim+2,p=h.stride,m=h.getPixels();if(o.activeTexture.set(l.TEXTURE1),o.pixelStoreUnpackPremultiplyAlpha.set(!1),i.demTexture||=e.getTileTexture(p),i.demTexture){let e=i.demTexture;e.update(m,{premultiply:!1}),e.bind(l.NEAREST,l.CLAMP_TO_EDGE)}else i.demTexture=new iy(o,m,l.RGBA,{premultiply:!1}),i.demTexture.bind(l.NEAREST,l.CLAMP_TO_EDGE);o.activeTexture.set(l.TEXTURE0);let g=i.fbo;if(!g){let e=new iy(o,{width:d,height:d,data:null},l.RGBA);e.bind(c,l.CLAMP_TO_EDGE),g=i.fbo=o.createFramebuffer(d,d,!0,!1),g.colorAttachment.set(e.texture)}o.bindFramebuffer.set(g.framebuffer),o.viewport.set([0,0,d,d]),e.useProgram("hillshadePrepare").draw(o,l.TRIANGLES,a,r,s,az.disabled,ZI(i.tileID,h),null,null,n.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments),i.needsHillshadePrepare=!1}})(e,t,n,i,l,iz.disabled,c),s.viewport.set([0,0,e.width,e.height]);else if("translucent"===a.currentPass)if(o){let[a,s,o]=e.stencilConfigForOverlapTwoPass(n);Pz(e,t,i,o,a,l,c,!1,r),Pz(e,t,i,o,s,l,c,!0,r)}else{let[a,s]=e.getStencilConfigForOverlapAndUpdateStencilID(n);Pz(e,t,i,s,a,l,c,!1,r)}},colorRelief:function(e,t,i,n,a){if("translucent"!==a.currentPass||!n.length)return;let{isRenderingToTexture:r}=a,s=e.style.projection.useSubdivision,o=e.getDepthModeForSublayer(0,ez.ReadOnly),l=e.colorModeForRenderPass();if(s){let[a,s,c]=e.stencilConfigForOverlapTwoPass(n);Fz(e,t,i,c,a,o,l,!1,r),Fz(e,t,i,c,s,o,l,!0,r)}else{let[a,s]=e.getStencilConfigForOverlapAndUpdateStencilID(n);Fz(e,t,i,s,a,o,l,!1,r)}},raster:function(e,t,i,n,a){if("translucent"!==a.currentPass||0===i.paint.get("raster-opacity")||!n.length)return;let{isRenderingToTexture:r}=a,s=t.getSource(),o=e.style.projection.useSubdivision;if(s instanceof LT)Rz(e,t,i,n,null,!1,!1,s.tileCoords,s.imageWarp,s.flippedWindingOrder,r,s.getMesh(e.context,o));else if(o){let[a,s,o]=e.stencilConfigForOverlapTwoPass(n);Rz(e,t,i,o,a,!1,!0,zz,CT,!1,r),Rz(e,t,i,o,s,!0,!0,zz,CT,!1,r)}else{let[a,s]=e.getStencilConfigForOverlapAndUpdateStencilID(n);Rz(e,t,i,s,a,!1,!0,zz,CT,!1,r)}},background:function(e,t,i,n,a){let r=i.paint.get("background-color"),s=i.paint.get("background-opacity");if(0===s)return;let{isRenderingToTexture:o}=a,l=e.context,c=l.gl,u=e.style.projection,h=e.transform,d=h.tileSize,p=i.paint.get("background-pattern");if(e.isPatternMissing(p))return;let m=!p&&1===r.a&&1===s&&e.opaquePassEnabledForLayer()?"opaque":"translucent";if(a.currentPass!==m)return;let g=iz.disabled,f=e.getDepthModeForSublayer(0,"opaque"===m?ez.ReadWrite:ez.ReadOnly),A=e.colorModeForRenderPass(),_=e.useProgram(p?"backgroundPattern":"background"),v=n||iD(h,{tileSize:d,terrain:e.style.map.terrain});p&&(l.activeTexture.set(c.TEXTURE0),e.patternAtlas.bind(e.context));let y=i.getCrossfadeParameters();for(let t of v){let n=h.getProjectionData({overscaledTileID:t,applyGlobeMatrix:!o,applyTerrainMatrix:!0}),a=p?oF(s,e,p,{tileID:t,tileSize:d},y):sF(s,r),m=e.getTerrainDataForTile(t,o),v=u.getMeshFromTileID(l,t.canonical,!1,!0,"raster");_.draw(l,c.TRIANGLES,f,g,A,az.backCCW,a,m,n,i.id,v.vertexBuffer,v.indexBuffer,v.segments)}},sky:function(e,t){let i=e.context,n=i.gl,a=((e,t,i)=>{let n=Math.cos(t.rollInRadians),a=Math.sin(t.rollInRadians),r=Ox(t),s=t.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}).projectionTransition;return{u_sky_color:e.properties.get("sky-color"),u_horizon_color:e.properties.get("horizon-color"),u_horizon:[(t.width/2-r*a)*i,(t.height/2+r*n)*i],u_horizon_normal:[-a,n],u_sky_horizon_blend:e.properties.get("sky-horizon-blend")*t.height/2*i,u_sky_blend:s,u_inv_proj_matrix:t.inverseProjectionMatrix,u_globe_position:QP(t),u_globe_radius:XP(t.worldSize,t.center.lat)}})(t,e.transform,e.pixelRatio),r=new ez(n.LEQUAL,ez.ReadWrite,[0,1]),s=iz.disabled,o=e.colorModeForRenderPass(),l=e.useProgram("sky"),c=Kz(i,t);l.draw(i,n.TRIANGLES,r,s,o,az.disabled,a,null,void 0,"sky",c.vertexBuffer,c.indexBuffer,c.segments)},atmosphere:function(e,t,i){let n=e.context,a=n.gl,r=e.useProgram("atmosphere"),s=new ez(a.LEQUAL,ez.ReadOnly,[0,1]),o=e.transform,l=function(e,t){let i=e.getCartesianPosition();!function(e,t){e[0]=-t[0],e[1]=-t[1],e[2]=-t[2]}(i,i);let n=eu(new Float64Array(16));return"map"===e.properties.get("anchor")&&(ou(n,n,t.rollInRadians),ru(n,n,-t.pitchInRadians),ou(n,n,t.bearingInRadians),ru(n,n,t.center.lat*Math.PI/180),su(n,n,-t.center.lng*Math.PI/180)),function(e,t,i){var n=t[0],a=t[1],r=t[2],s=i[3]*n+i[7]*a+i[11]*r+i[15];s||=1,e[0]=(i[0]*n+i[4]*a+i[8]*r+i[12])/s,e[1]=(i[1]*n+i[5]*a+i[9]*r+i[13])/s,e[2]=(i[2]*n+i[6]*a+i[10]*r+i[14])/s}(i,i,n),i}(i,e.transform),c=o.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),u=t.properties.get("atmosphere-blend")*c.projectionTransition;if(0===u)return;let h=XP(o.worldSize,o.center.lat),d=((e,t,i,n,a)=>({u_sun_pos:e,u_atmosphere_blend:t,u_globe_position:i,u_globe_radius:n,u_inv_proj_matrix:a}))(l,u,QP(o),h,o.inverseProjectionMatrix),p=Kz(n,t);r.draw(n,a.TRIANGLES,s,iz.disabled,JF.alphaBlended,az.disabled,d,null,null,"atmosphere",p.vertexBuffer,p.indexBuffer,p.segments)},custom:function(e,t,i,n){let{isRenderingGlobe:a}=n,r=e.context,s=i.implementation,o=e.style.projection,l=e.transform,c=l.getProjectionDataForCustomLayer(a),u={farZ:l.farZ,nearZ:l.nearZ,fov:l.fov*Math.PI/180,modelViewProjectionMatrix:l.modelViewProjectionMatrix,projectionMatrix:l.projectionMatrix,shaderData:{variantName:o.shaderVariantName,vertexShaderPrelude:`const float PI = 3.141592653589793;\nuniform mat4 u_projection_matrix;\n${o.shaderPreludeCode.vertexSource}`,define:o.shaderDefine},defaultProjectionData:c,getProjectionData:e=>l.getProjectionData({overscaledTileID:new HE(e.tileID.canonical.z,e.tileID.wrap??0,e.tileID.canonical.z,e.tileID.canonical.x,e.tileID.canonical.y),aligned:e.aligned,applyGlobeMatrix:e.applyGlobeMatrix,applyTerrainMatrix:e.applyTerrainMatrix})},h=s.renderingMode?s.renderingMode:"2d";if("offscreen"===n.currentPass){let t=s.prerender;t&&(e.setCustomLayerDefaults(),r.setColorMode(e.colorModeForRenderPass()),t.call(s,r.gl,u),r.setDirty(),e.setBaseState())}else if("translucent"===n.currentPass){e.setCustomLayerDefaults(),r.setColorMode(e.colorModeForRenderPass()),r.setStencilMode(iz.disabled);let t="3d"===h?e.getDepthModeFor3D():e.getDepthModeForSublayer(0,ez.ReadOnly);r.setDepthMode(t),s.render(r.gl,u),r.setDirty(),e.setBaseState(),r.bindFramebuffer.set(null)}},debug:function(e,t,i){for(let n of i)Zz(e,t,n)},debugPadding:function(e){let t=e.transform.padding;Gz(e,e.transform.height-(t.top||0),3,Uz),Gz(e,t.bottom||0,3,Nz),Hz(e,t.left||0,3,jz),Hz(e,e.transform.width-(t.right||0),3,Vz);let i=e.transform.centerPoint;!function(e,t,i,n){Wz(e,t-1,i-10,2,20,n),Wz(e,t-10,i-1,20,2,n)}(e,i.x,e.transform.height-i.y,qz)},terrainDepth:function(e,t){let i=e.context,n=i.gl,a=e.transform,r=JF.unblended,s=new ez(n.LEQUAL,ez.ReadWrite,[0,1]),o=t.tileManager.getRenderableTiles(),l=e.useProgram("terrainDepth");i.bindFramebuffer.set(t.getFramebuffer().framebuffer),i.viewport.set([0,0,e.width/devicePixelRatio,e.height/devicePixelRatio]),i.clear({color:ep.white,depth:1});for(let e of o){let o=t.getTerrainMesh(e.tileID),c=t.getTerrainData(e.tileID),u=a.getProjectionData({overscaledTileID:e.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0}),h=EI(t.getSkirtLength(a.zoom));l.draw(i,n.TRIANGLES,s,iz.disabled,r,az.backCCW,h,c,u,"terrain",o.vertexBuffer,o.indexBuffer,o.segments)}i.bindFramebuffer.set(null),i.viewport.set([0,0,e.width,e.height])}};var Qz=class e{constructor(e,t){this.drawFunctions=Xz,this.context=new $F(e),this.transform=t,this.layerOpacityFbo=null,this._tileTextures={},this._rttObjectRecyclePool=[],this._rttSharedFbo=null,this.terrainFacilitator={depthDirty:!0,matrix:eu(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=hD.maxOverzooming+hD.maxUnderzooming+1,this.depthEpsilon=1/65536,this.crossTileSymbolIndex=new gP}resize(e,t,i){if(this.width=Math.floor(e*i),this.height=Math.floor(t*i),this.pixelRatio=i,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(let e of this.style._order)this.style._layers[e].resize()}setup(){let e=this.context,t=new r_;t.emplaceBack(0,0),t.emplaceBack(Uu,0),t.emplaceBack(0,Uu),t.emplaceBack(Uu,Uu),this.tileExtentBuffer=e.createVertexBuffer(t,zT.members),this.tileExtentSegments=S_.simpleSegment(0,0,4,2);let i=new r_;i.emplaceBack(0,0),i.emplaceBack(Uu,0),i.emplaceBack(0,Uu),i.emplaceBack(Uu,Uu),this.debugBuffer=e.createVertexBuffer(i,zT.members),this.debugSegments=S_.simpleSegment(0,0,4,5);let n=new o_;n.emplaceBack(0,0,0,0),n.emplaceBack(Uu,0,Uu,0),n.emplaceBack(0,Uu,0,Uu),n.emplaceBack(Uu,Uu,Uu,Uu),this.rasterBoundsBuffer=e.createVertexBuffer(n,xI.members),this.rasterBoundsSegments=S_.simpleSegment(0,0,4,2);let a=new r_;a.emplaceBack(0,0),a.emplaceBack(Uu,0),a.emplaceBack(0,Uu),a.emplaceBack(Uu,Uu),this.rasterBoundsBufferPosOnly=e.createVertexBuffer(a,zT.members),this.rasterBoundsSegmentsPosOnly=S_.simpleSegment(0,0,4,5);let r=new r_;r.emplaceBack(0,0),r.emplaceBack(1,0),r.emplaceBack(0,1),r.emplaceBack(1,1),this.viewportBuffer=e.createVertexBuffer(r,zT.members),this.viewportSegments=S_.simpleSegment(0,0,4,2);let s=new E_;s.emplaceBack(0),s.emplaceBack(1),s.emplaceBack(3),s.emplaceBack(2),s.emplaceBack(0),this.tileBorderIndexBuffer=e.createIndexBuffer(s);let o=new b_;o.emplaceBack(1,0,2),o.emplaceBack(1,2,3),this.quadTriangleIndexBuffer=e.createIndexBuffer(o);let l=this.context.gl;this.stencilClearMode=new iz({func:l.ALWAYS,mask:0},0,255,l.ZERO,l.ZERO,l.ZERO),this.tileExtentMesh=new FT(this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}clearStencil(){let e=this.context,t=e.gl;this.nextStencilID=1,this.currentStencilSource=void 0;let i=Jc();cu(i,0,this.width,this.height,0,0,1),au(i,i,[t.drawingBufferWidth,t.drawingBufferHeight,0]);let n={mainMatrix:i,tileMercatorCoords:[0,0,1,1],clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:i,clipAntimeridian:!1};this.useProgram("clippingMask",null,!0).draw(e,t.TRIANGLES,ez.disabled,this.stencilClearMode,JF.disabled,az.disabled,null,null,n,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}renderTileClippingMasks(e,t,i){if(this.currentStencilSource===e.source||!e.isTileClipped()||!t?.length)return;this.currentStencilSource=e.source,this.nextStencilID+t.length>256&&this.clearStencil();let n=this.context;n.setColorMode(JF.disabled),n.setDepthMode(ez.disabled);let a={};for(let e of t)a[e.key]=this.nextStencilID++;this.style.projection.useSubdivision&&this._renderTileMasks(a,t,i,!0),this._renderTileMasks(a,t,i,!1),this._tileClippingMaskIDs=a}_renderTileMasks(e,t,i,n){let a=this.context,r=a.gl,s=this.style.projection,o=this.transform,l=this.useProgram("clippingMask");for(let c of t){let t=e[c.key],u=this.getTerrainDataForTile(c,i),h=s.getMeshFromTileID(this.context,c.canonical,n,!0,"stencil"),d=o.getProjectionData({overscaledTileID:c,applyGlobeMatrix:!i,applyTerrainMatrix:!0});l.draw(a,r.TRIANGLES,ez.disabled,new iz({func:r.ALWAYS,mask:0},t,255,r.KEEP,r.KEEP,r.REPLACE),JF.disabled,i?az.disabled:az.backCCW,null,u,d,"$clipping",h.vertexBuffer,h.indexBuffer,h.segments)}}getTerrainDataForTile(e,t){return t&&"mercator"===this.style.projection?.name?null:this.style.map.terrain?.getTerrainData(e)||null}_renderTilesDepthBuffer(){let e=this.context,t=e.gl,i=this.style.projection,n=this.transform,a=this.useProgram("depth"),r=this.getDepthModeFor3D(),s=iD(n,{tileSize:n.tileSize});for(let o of s){let s=this.style.map.terrain?.getTerrainData(o),l=i.getMeshFromTileID(this.context,o.canonical,!0,!0,"raster"),c=n.getProjectionData({overscaledTileID:o,applyGlobeMatrix:!0,applyTerrainMatrix:!0});a.draw(e,t.TRIANGLES,r,iz.disabled,JF.disabled,az.backCCW,null,s,c,"$clipping",l.vertexBuffer,l.indexBuffer,l.segments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();let e=this.nextStencilID++,t=this.context.gl;return new iz({func:t.NOTEQUAL,mask:255},e,255,t.KEEP,t.KEEP,t.REPLACE)}stencilModeForClipping(e){let t=this.context.gl;return new iz({func:t.EQUAL,mask:255},this._tileClippingMaskIDs[e.key],0,t.KEEP,t.KEEP,t.REPLACE)}getStencilConfigForOverlapAndUpdateStencilID(e){let t=this.context.gl,i=e.sort((e,t)=>t.overscaledZ-e.overscaledZ),n=i[i.length-1].overscaledZ,a=i[0].overscaledZ-n+1;if(a>1){this.currentStencilSource=void 0,this.nextStencilID+a>256&&this.clearStencil();let e={};for(let i=0;i<a;i++)e[i+n]=new iz({func:t.GEQUAL,mask:255},i+this.nextStencilID,255,t.KEEP,t.KEEP,t.REPLACE);return this.nextStencilID+=a,[e,i]}return[{[n]:iz.disabled},i]}stencilConfigForOverlapTwoPass(e){let t=this.context.gl,i=e.sort((e,t)=>t.overscaledZ-e.overscaledZ),n=i[i.length-1].overscaledZ,a=i[0].overscaledZ-n+1;if(this.clearStencil(),a>1){let e={},r={};for(let i=0;i<a;i++)e[i+n]=new iz({func:t.GREATER,mask:255},a+1+i,255,t.KEEP,t.KEEP,t.REPLACE),r[i+n]=new iz({func:t.GREATER,mask:255},1+i,255,t.KEEP,t.KEEP,t.REPLACE);return this.nextStencilID=2*a+1,[e,r,i]}return this.nextStencilID=3,[{[n]:new iz({func:t.GREATER,mask:255},2,255,t.KEEP,t.KEEP,t.REPLACE)},{[n]:new iz({func:t.GREATER,mask:255},1,255,t.KEEP,t.KEEP,t.REPLACE)},i]}colorModeForRenderPass(){let e=this.context.gl;if(this._showOverdrawInspector){let t=1/8;return new JF([e.CONSTANT_COLOR,e.ONE],new ep(t,t,t,0),[!0,!0,!0,!0])}return"opaque"===this.renderOptions.currentPass?JF.unblended:JF.alphaBlended}getDepthModeForSublayer(e,t,i){if(!this.opaquePassEnabledForLayer())return ez.disabled;let n=1-((1+this.renderOptions.currentLayer)*this.numSublayers+e)*this.depthEpsilon;return new ez(i||this.context.gl.LEQUAL,t,[n,n])}getDepthModeFor3D(){return new ez(this.context.gl.LEQUAL,ez.ReadWrite,this.renderOptions.depthRangeFor3D)}opaquePassEnabledForLayer(){return this.renderOptions.currentLayer<this.renderOptions.opaquePassCutoff}render(e,t){this.style=e,this.options=t;let i=this.renderOptions=function(e,t,i){let n=t?.transitionState??0;return{currentPass:"offscreen",currentLayer:0,opaquePassCutoff:1/0,depthRangeFor3D:[0,1],isRenderingToTexture:!1,transform:e,terrain:i,projectionTransition:n,isRenderingGlobe:n>0}}(this.transform,e.projection,e.map.terrain??null);this.lineAtlas=e.lineAtlas,this.imageManager=e.imageManager,this.patternAtlas=e.patternAtlas,this.glyphManager=e.glyphManager,this.symbolFadeChange=e.placement.symbolFadeChange(tC()),function(e,t){let i=e.pending,{transform:n}=t,a=t.context.gl;i[YF.u_units_to_pixels]=1/n.pixelsToGLUnits[0],i[YF.u_units_to_pixels+1]=1/n.pixelsToGLUnits[1],i[YF.u_world_size]=a.drawingBufferWidth,i[YF.u_world_size+1]=a.drawingBufferHeight,i[YF.u_camera_to_center_distance]=n.cameraToCenterDistance,i[YF.u_symbol_fade_change]=t.options.fadeDuration?t.symbolFadeChange:1,i[YF.u_aspect_ratio]=n.width/n.height,i[YF.u_device_pixel_ratio]=t.pixelRatio,i[YF.u_viewport_size]=n.width,i[YF.u_viewport_size+1]=n.height,i[YF.u_pixel_extrude_scale]=1/n.width,i[YF.u_pixel_extrude_scale+1]=1/n.height,i[YF.u_pitch]=n.pitch/360*2*Math.PI,e.upload()}(this.context.frameUniformBuffer,this),this.imageManager.beginFrame();let n=this.style._order,a=this.style.tileManagers,r={},s={},o={};for(let e in a){let t=a[e];t.used&&t.prepare(this.context),r[e]=t.getVisibleCoordinates(!1),s[e]=r[e].slice().reverse(),o[e]=t.getVisibleCoordinates(!0).reverse()}i.opaquePassCutoff=1/0;for(let e=0;e<n.length;e++){let t=n[e];if(this.style._layers[t].is3D()){i.opaquePassCutoff=e;break}}this.maybeDrawDepth(),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),i.opaquePassCutoff=0),i.currentPass="offscreen";for(let e of n){let t=this.style._layers[e];if(!t.hasOffscreenPass()||t.isHidden(this.transform.zoom))continue;let n=s[t.source];("custom"===t.type||n.length)&&this.renderLayer(this,a[t.source],t,n,i)}if(this.context.viewport.set([0,0,this.width,this.height]),this.context.bindFramebuffer.set(null),this.context.clear({color:t.showOverdrawInspector?ep.black:ep.transparent,depth:1}),this.clearStencil(),this.style.sky&&this.drawFunctions.sky(this,this.style.sky),this._showOverdrawInspector=t.showOverdrawInspector,i.depthRangeFor3D=[0,1-(e._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(i.currentPass="opaque",i.currentLayer=n.length-1;i.currentLayer>=0;i.currentLayer--){let e=this.style._layers[n[i.currentLayer]];if(e.isHidden(this.transform.zoom))continue;let t=a[e.source],s=r[e.source];this.renderTileClippingMasks(e,s,!1),this.renderLayer(this,t,e,s,i)}i.currentPass="translucent";let l=!1;for(i.currentLayer=0;i.currentLayer<n.length;i.currentLayer++){let e=this.style._layers[n[i.currentLayer]];if(e.isHidden(this.transform.zoom))continue;let t=a[e.source];if(this.renderToTexture?.renderLayer(e,i))continue;!this.opaquePassEnabledForLayer()&&!l&&(l=!0,i.isRenderingGlobe&&!this.style.map.terrain&&this._renderTilesDepthBuffer());let c=("symbol"===e.type?o:s)[e.source];this.renderTileClippingMasks(e,r[e.source],!!this.renderToTexture),this.renderLayer(this,t,e,c,i)}if(i.isRenderingGlobe&&this.drawFunctions.atmosphere(this,this.style.sky,this.style.light),this.options.showTileBoundaries){let e=function(e,t){let i=null,n=Object.values(e._layers).flatMap(i=>i.source&&!i.isHidden(t)?[e.tileManagers[i.source]]:[]),a=n.filter(e=>"vector"===e.getSource().type),r=n.filter(e=>"vector"!==e.getSource().type),s=e=>{(!i||i.getSource().maxzoom<e.getSource().maxzoom)&&(i=e)};for(let e of a)s(e);if(!i)for(let e of r)s(e);return i}(this.style,this.transform.zoom);e&&this.drawFunctions.debug(this,e,e.getVisibleCoordinates())}this.options.showPadding&&this.drawFunctions.debugPadding(this),this.context.setDefault()}maybeDrawDepth(){if(!this.style?.projection||!this.style.map?.terrain)return;let e=this.terrainFacilitator.matrix,t=this.transform.modelViewProjectionMatrix,i=this.terrainFacilitator.depthDirty;i||=!function(e,t){var i=e[0],n=e[1],a=e[2],r=e[3],s=e[4],o=e[5],l=e[6],c=e[7],u=e[8],h=e[9],d=e[10],p=e[11],m=e[12],g=e[13],f=e[14],A=e[15],_=t[0],v=t[1],y=t[2],x=t[3],b=t[4],w=t[5],E=t[6],k=t[7],S=t[8],M=t[9],C=t[10],T=t[11],D=t[12],P=t[13],I=t[14],F=t[15];return Math.abs(i-_)<=1e-6*Math.max(1,Math.abs(i),Math.abs(_))&&Math.abs(n-v)<=1e-6*Math.max(1,Math.abs(n),Math.abs(v))&&Math.abs(a-y)<=1e-6*Math.max(1,Math.abs(a),Math.abs(y))&&Math.abs(r-x)<=1e-6*Math.max(1,Math.abs(r),Math.abs(x))&&Math.abs(s-b)<=1e-6*Math.max(1,Math.abs(s),Math.abs(b))&&Math.abs(o-w)<=1e-6*Math.max(1,Math.abs(o),Math.abs(w))&&Math.abs(l-E)<=1e-6*Math.max(1,Math.abs(l),Math.abs(E))&&Math.abs(c-k)<=1e-6*Math.max(1,Math.abs(c),Math.abs(k))&&Math.abs(u-S)<=1e-6*Math.max(1,Math.abs(u),Math.abs(S))&&Math.abs(h-M)<=1e-6*Math.max(1,Math.abs(h),Math.abs(M))&&Math.abs(d-C)<=1e-6*Math.max(1,Math.abs(d),Math.abs(C))&&Math.abs(p-T)<=1e-6*Math.max(1,Math.abs(p),Math.abs(T))&&Math.abs(m-D)<=1e-6*Math.max(1,Math.abs(m),Math.abs(D))&&Math.abs(g-P)<=1e-6*Math.max(1,Math.abs(g),Math.abs(P))&&Math.abs(f-I)<=1e-6*Math.max(1,Math.abs(f),Math.abs(I))&&Math.abs(A-F)<=1e-6*Math.max(1,Math.abs(A),Math.abs(F))}(e,t),i||=this.style.map.terrain.tileManager.anyTilesAfterTime(this.terrainFacilitator.renderTime),i&&(function(e,t){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),this.terrainFacilitator.renderTime=tC(),this.terrainFacilitator.depthDirty=!1,this.drawFunctions.terrainDepth(this,this.style.map.terrain))}renderLayer(e,t,i,n,a){if(i.isHidden(this.transform.zoom)||"background"!==i.type&&"custom"!==i.type&&!(n||[]).length)return;this.id=i.id;let r=this.drawFunctions;IE(i)?r.symbol(e,t,i,n,this.style.placement.variableOffsets,a):(e=>"circle"===e.type)(i)?r.circle(e,t,i,n,a):(e=>"heatmap"===e.type)(i)?r.heatmap(e,t,i,n,a):(e=>"line"===e.type)(i)?r.line(e,t,i,n,a):(e=>"fill"===e.type)(i)?r.fill(e,t,i,n,a):(e=>"fill-extrusion"===e.type)(i)?r.fillExtrusion(e,t,i,n,a):(e=>"hillshade"===e.type)(i)?r.hillshade(e,t,i,n,a):(e=>"color-relief"===e.type)(i)?r.colorRelief(e,t,i,n,a):fA(i)?r.raster(e,t,i,n,a):(e=>"background"===e.type)(i)?r.background(e,t,i,n,a):(e=>"custom"===e.type)(i)&&r.custom(e,t,i,a)}static{this.MAX_TEXTURE_POOL_SIZE_PER_BUCKET=50}saveTileTexture(t){let i=this._tileTextures[t.size[0]];i?i.length<e.MAX_TEXTURE_POOL_SIZE_PER_BUCKET?i.push(t):t.destroy():this._tileTextures[t.size[0]]=[t]}getTileTexture(e){let t=this._tileTextures[e];return t&&t.length>0?t.pop():null}acquireRTT(e){let t=this.context.gl,i=this._rttObjectRecyclePool.pop();if(i)return i.size!==e&&(i.texture.update({width:e,height:e,data:null},{premultiply:!1,useMipmap:!0}),i.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE,t.LINEAR_MIPMAP_LINEAR),this.context.extTextureFilterAnisotropic&&t.texParameterf(t.TEXTURE_2D,this.context.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,this.context.extTextureFilterAnisotropicMax),i.size=e),i;let n=new iy(this.context,{width:e,height:e,data:null},t.RGBA,{premultiply:!1,useMipmap:!0});return n.bind(t.LINEAR,t.CLAMP_TO_EDGE,t.LINEAR_MIPMAP_LINEAR),this.context.extTextureFilterAnisotropic&&t.texParameterf(t.TEXTURE_2D,this.context.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,this.context.extTextureFilterAnisotropicMax),{texture:n,size:e}}bindRTT(e){let t=this.context.gl,i=e.size;if(!this._rttSharedFbo){let e=this.context.createFramebuffer(i,i,!0,!0),n=this.context.createRenderbuffer(t.DEPTH_STENCIL,i,i);e.depthAttachment.set(n),this._rttSharedFbo={fbo:e,depthRenderbuffer:n,size:i}}this._rttSharedFbo.size!==i&&(this.context.bindRenderbuffer.set(this._rttSharedFbo.depthRenderbuffer),t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_STENCIL,i,i),this.context.bindRenderbuffer.set(null),this._rttSharedFbo.fbo.width=i,this._rttSharedFbo.fbo.height=i,this._rttSharedFbo.size=i),this._rttSharedFbo.fbo.colorAttachment.set(e.texture.texture),this.context.bindFramebuffer.set(this._rttSharedFbo.fbo.framebuffer)}releaseRTT(e){this._rttObjectRecyclePool.push(e)}isPatternMissing(e){if(!e)return!1;if(!e.from||!e.to)return!0;let t=this.patternAtlas.getPattern(e.from.toString()),i=this.patternAtlas.getPattern(e.to.toString());return!t||!i}useProgram(e,t,i=!1,n=[]){this.cache||={};let a=!!this.style.map.terrain,r=this.style.projection,s=i?AP.projectionMercator:r.shaderPreludeCode,o=i?vP:r.shaderDefine,l=`/${i?yP:r.shaderVariantName}`,c=e+(t?t.cacheKey:"")+l+(this._showOverdrawInspector?"/overdraw":"")+(a?"/terrain":"")+(n?`/${n.join("/")}`:"");return this.cache[c]||=new zI(this.context,AP[e],t,cF[e],this._showOverdrawInspector,a,s,o,n),this.cache[c]}setCustomLayerDefaults(){this.context.setCustomLayerDefaults()}setBaseState(){let e=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(e.FUNC_ADD)}initDebugOverlayCanvas(){if(null==this.debugOverlayCanvas){this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512;let e=this.context.gl;this.debugOverlayTexture=new iy(this.context,this.debugOverlayCanvas,e.RGBA)}}destroy(){if(this._tileTextures){for(let e in this._tileTextures){let t=this._tileTextures[e];if(t)for(let e of t)e.destroy()}this._tileTextures={}}for(let e of this._rttObjectRecyclePool)e.texture.destroy();if(this._rttObjectRecyclePool=[],this._rttSharedFbo){this._rttSharedFbo.fbo.colorAttachment.set(null),this._rttSharedFbo.fbo.depthAttachment.set(null);let e=this.context.gl;e.deleteRenderbuffer(this._rttSharedFbo.depthRenderbuffer),e.deleteFramebuffer(this._rttSharedFbo.fbo.framebuffer),this._rttSharedFbo=null}if(this.layerOpacityFbo?.destroy(),this.layerOpacityFbo=null,this.tileExtentBuffer&&this.tileExtentBuffer.destroy(),this.debugBuffer&&this.debugBuffer.destroy(),this.rasterBoundsBuffer&&this.rasterBoundsBuffer.destroy(),this.rasterBoundsBufferPosOnly&&this.rasterBoundsBufferPosOnly.destroy(),this.viewportBuffer&&this.viewportBuffer.destroy(),this.tileBorderIndexBuffer&&this.tileBorderIndexBuffer.destroy(),this.quadTriangleIndexBuffer&&this.quadTriangleIndexBuffer.destroy(),this.tileExtentMesh&&this.tileExtentMesh.vertexBuffer?.destroy(),this.tileExtentMesh&&this.tileExtentMesh.indexBuffer?.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this.context.projectionUniformBuffer.destroy(),this.context.terrainUniformBuffer.destroy(),this.context.frameUniformBuffer.destroy(),this.cache){for(let e in this.cache){let t=this.cache[e];t?.program&&this.context.gl.deleteProgram(t.program)}this.cache={}}this.context&&this.context.setDefault()}overLimit(){let{drawingBufferWidth:e,drawingBufferHeight:t}=this.context.gl;return this.width!==e||this.height!==t}},Yz=class extends Error{constructor(e,t){super("WebGL2 is required to display this map. We are sorry, but it seems that your browser does not support WebGL2, a technology for rendering 3D graphics on the web. Read more on https://wiki.openstreetmap.org/wiki/This_map_requires_WebGL"),this.name="GPUInitializationError",this.requestedAttributes=e,this.statusMessage=t?.statusMessage??null}};function Jz(e,t){let i,n=!1,a=null,r=()=>{a=null,n&&=(e(...i),a=setTimeout(r,t),!1)};return(...e)=>(n=!0,i=e,a||r(),a)}var $z=class{constructor(e){this._getHashParams=()=>new URLSearchParams(window.location.hash.replace("#","")),this._getCurrentHash=()=>{let e=this._getHashParams();return this._hashName?(e.get(this._hashName)||"").split("/"):([...e.keys()][0]??"").split("/")},this._onHashChange=()=>{let e=this._getCurrentHash();if(!this._isValidHash(e))return!1;let t=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(e[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+e[2],+e[1]],zoom:+e[0],bearing:t,pitch:+(e[4]||0)}),!0},this._updateHashUnthrottled=()=>{let e=window.location.href.replace(/(#.*)?$/,this.getHashString());window.history.replaceState(window.history.state,null,e)},this._removeHash=()=>{let e=this._getHashParams();if(this._hashName)e.delete(this._hashName);else{let t=Array.from(e.keys());t.length>0&&e.delete(t[0])}let t=decodeURIComponent(e.toString()).replace(/=&/g,"&").replace(/=$/g,""),i=t?`#${t}`:"",n=window.location.href.replace(/(#.+)?$/,i);n=n.replace("&&","&"),window.history.replaceState(window.history.state,null,n)},this._updateHash=Jz(this._updateHashUnthrottled,300),this._hashName=e&&encodeURIComponent(e)}addTo(e){return this._map=e,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(e){let t=this._map.getCenter(),i=Math.round(100*this._map.getZoom())/100,n=10**Math.ceil((i*Math.LN2+Math.log(512/360/.5))/Math.LN10),a=Math.round(t.lng*n)/n,r=Math.round(t.lat*n)/n,s=this._map.getBearing(),o=this._map.getPitch(),l="";if(l+=e?`/${a}/${r}/${i}`:`${i}/${r}/${a}`,(s||o)&&(l+="/"+Math.round(10*s)/10),o&&(l+=`/${Math.round(o)}`),this._hashName){let e=this._getHashParams();return e.set(this._hashName,l),`#${decodeURIComponent(e.toString()).replace(/=&/g,"&").replace(/=$/g,"")}`}return`#${l}`}_isValidHash(e){if(e.length<3||e.some(e=>isNaN(+e)))return!1;try{new Ex(+e[2],+e[1])}catch{return!1}let t=+e[0],i=+(e[3]||0),n=+(e[4]||0);return t>=this._map.getMinZoom()&&t<=this._map.getMaxZoom()&&i>=-180&&i<=180&&n>=this._map.getMinPitch()&&n<=this._map.getMaxPitch()}};const eR={linearity:.3,easing:ah(0,0,.3,1)},tR=lh({deceleration:2500,maxSpeed:1400},eR),iR=lh({deceleration:20,maxSpeed:1400},eR),nR=lh({deceleration:1e3,maxSpeed:360},eR),aR=lh({deceleration:1e3,maxSpeed:90},eR),rR=lh({deceleration:1e3,maxSpeed:360},eR);var sR=class{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:tC(),settings:e})}_drainInertiaBuffer(){let e=this._inertiaBuffer,t=tC();for(;e.length>0&&t-e[0].time>160;)e.shift()}_getVelocityEntries(){let e=this._inertiaBuffer,t=tC()-60,i=Math.max(0,e.length-2);for(;i>0&&e[i-1].time>=t;)i--;return e.slice(i)}_onMoveEnd(e){this._drainInertiaBuffer();let t=this._getVelocityEntries();if(t.length<2)return void this.clear();let i={zoom:0,bearing:0,pitch:0,roll:0,pan:new Hc(0,0),pinchAround:void 0,around:void 0};for(let{settings:e}of t)e.around&&(i.around=e.around),e.pinchAround&&(i.pinchAround=e.pinchAround);for(let{settings:e}of t.slice(1))i.zoom+=e.zoomDelta||0,i.bearing+=e.bearingDelta||0,i.pitch+=e.pitchDelta||0,i.roll+=e.rollDelta||0,e.panDelta&&i.pan._add(e.panDelta);if(!(i.pan.mag()||i.zoom||i.bearing||i.pitch||i.roll))return void this.clear();let n=tC()-t[0].time,a={};if(i.pan.mag()){let t=lR(i.pan.mag(),n,lh({},tR,e||{})),r=i.pan.mult(t.amount/i.pan.mag()),s=this._map._camera.cameraHelper.handlePanInertia(r,this._map._camera.transform);a.center=s.easingCenter,a.offset=s.easingOffset,oR(a,t)}if(i.zoom){let e=lR(i.zoom,n,iR);a.zoom=mh(this._map.getZoom()+e.amount,this._map.getZoomSnap(),e.amount),oR(a,e)}if(i.bearing){let e=lR(i.bearing,n,nR);a.bearing=this._map.getBearing()+sh(e.amount,-179,179),oR(a,e)}if(i.pitch){let e=lR(i.pitch,n,aR);a.pitch=this._map.getPitch()+e.amount,oR(a,e)}if(i.roll){let e=lR(i.roll,n,rR);a.roll=this._map.getRoll()+sh(e.amount,-179,179),oR(a,e)}if(a.zoom||a.bearing){let e=void 0===i.pinchAround?i.around:i.pinchAround;a.around=e?this._map.unproject(e):this._map.getCenter()}return this.clear(),lh(a,{noMoveStart:!0})}};function oR(e,t){(!e.duration||e.duration<t.duration)&&(e.duration=t.duration,e.easing=t.easing)}function lR(e,t,i){let{maxSpeed:n,linearity:a,deceleration:r}=i,s=sh(e*a/(t/1e3),-n,n),o=Math.abs(s)/(r*a);return{easing:i.easing,duration:1e3*o,amount:o/2*s}}var cR=class{constructor(e,t){this._map=e,this._clickTolerance=t.clickTolerance}reset(){delete this._mousedownPos}wheel(e){return this._firePreventable(new dC(this._map,e))}mousedown(e,t){return this._mousedownPos=t,this._firePreventable(new uC(e.type,this._map,e))}mouseup(e){this._map.fire(new uC(e.type,this._map,e))}click(e,t){this._mousedownPos&&this._mousedownPos.dist(t)>=this._clickTolerance||this._map.fire(new uC(e.type,this._map,e))}dblclick(e){return this._firePreventable(new uC(e.type,this._map,e))}mouseover(e){this._map.fire(new uC(e.type,this._map,e))}mouseout(e){this._map.fire(new uC(e.type,this._map,e))}touchstart(e){return this._firePreventable(new hC(e.type,this._map,e))}touchmove(e){this._map.fire(new hC(e.type,this._map,e))}touchend(e){this._map.fire(new hC(e.type,this._map,e))}touchcancel(e){this._map.fire(new hC(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}},uR=class{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(e){this._map.fire(new uC(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new uC("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._ignoreContextMenu||this._map.fire(new uC(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}},hR=class{constructor(e,t,i){this._map=e,this._tr=i,this._el=e.getCanvasContainer(),this._container=e.getContainer(),this._clickTolerance=t.clickTolerance||1,t.boxZoom&&"object"==typeof t.boxZoom&&(this._boxZoomEnd=t.boxZoom.boxZoomEnd)}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(e,t){this.isEnabled()&&e.shiftKey&&0===e.button&&(iC.disableDrag(),this._startPos=this._lastPos=t,this._active=!0)}mousemoveWindow(e,t){if(!this._active)return;let i=t;if(this._lastPos.equals(i)||!this._box&&i.dist(this._startPos)<this._clickTolerance)return;let n=this._startPos;this._lastPos=i,this._box||(this._box=iC.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",e));let a=Math.min(n.x,i.x),r=Math.max(n.x,i.x),s=Math.min(n.y,i.y),o=Math.max(n.y,i.y);this._box.style.transform=`translate(${a}px,${s}px)`,this._box.style.width=r-a+"px",this._box.style.height=o-s+"px"}mouseupWindow(e,t){if(!this._active||0!==e.button)return;let i=this._startPos,n=t;if(this.reset(),iC.suppressClick(),i.x!==n.x||i.y!==n.y)return this._map.fire(new pC("boxzoomend",{originalEvent:e})),this._boxZoomEnd?void this._boxZoomEnd(this._map,i,n,e):{cameraAnimation:e=>e.fitScreenCoordinates(i,n,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",e)}keydown(e){this._active&&27===e.keyCode&&(this.reset(),this._fireEvent("boxzoomcancel",e))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&=(this._box.remove(),null),iC.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(e,t){return this._map.fire(new pC(e,{originalEvent:t}))}};function dR(e,t){if(e.length!==t.length)throw Error(`The number of touches and points are not equal - touches ${e.length}, points ${t.length}`);let i={};for(let n=0;n<e.length;n++)i[e[n].identifier]=t[n];return i}var pR=class{constructor(e){this.reset(),this.numTouches=e.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(e,t,i){(this.centroid||i.length>this.numTouches)&&(this.aborted=!0),!this.aborted&&(void 0===this.startTime&&(this.startTime=e.timeStamp),i.length===this.numTouches&&(this.centroid=function(e){let t=new Hc(0,0);for(let i of e)t._add(i);return t.div(e.length)}(t),this.touches=dR(i,t)))}touchmove(e,t,i){if(this.aborted||!this.centroid)return;let n=dR(i,t);for(let e in this.touches){let t=this.touches[e],i=n[e];(!i||i.dist(t)>30)&&(this.aborted=!0)}}touchend(e,t,i){if((!this.centroid||e.timeStamp-this.startTime>500)&&(this.aborted=!0),0===i.length){let e=!this.aborted&&this.centroid;if(this.reset(),e)return e}}},mR=class{constructor(e){this.singleTap=new pR(e),this.numTaps=e.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(e,t,i){this.singleTap.touchstart(e,t,i)}touchmove(e,t,i){this.singleTap.touchmove(e,t,i)}touchend(e,t,i){let n=this.singleTap.touchend(e,t,i);if(n){let t=e.timeStamp-this.lastTime<500,i=!this.lastTap||this.lastTap.dist(n)<30;if((!t||!i)&&this.reset(),this.count++,this.lastTime=e.timeStamp,this.lastTap=n,this.count===this.numTaps)return this.reset(),n}}},gR=class{constructor(e,t){this._tr=t,this._zoomIn=new mR({numTouches:1,numTaps:2}),this._zoomOut=new mR({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(e,t,i){this._zoomIn.touchstart(e,t,i),this._zoomOut.touchstart(e,t,i)}touchmove(e,t,i){this._zoomIn.touchmove(e,t,i),this._zoomOut.touchmove(e,t,i)}touchend(e,t,i){let n=this._zoomIn.touchend(e,t,i),a=this._zoomOut.touchend(e,t,i),r=this._tr;return n?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:t=>t.easeTo({duration:300,zoom:mh(r.zoom+1,t.getZoomSnap()),around:r.unproject(n)},{originalEvent:e})}):a?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:t=>t.easeTo({duration:300,zoom:mh(r.zoom-1,t.getZoomSnap()),around:r.unproject(a)},{originalEvent:e})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}},fR=class{constructor(e){this._enabled=!!e.enable,this._moveStateManager=e.moveStateManager,this._clickTolerance=e.clickTolerance||1,this._moveFunction=e.move,this._activateOnStart=!!e.activateOnStart,e.assignEvents(this),this.reset()}reset(e){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(e)}_move(...e){let t=this._moveFunction(...e);if(t.bearingDelta||t.pitchDelta||t.rollDelta||t.around||t.panDelta)return this._active=!0,t}dragStart(e,t){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(e)&&(this._moveStateManager.startMove(e),this._lastPoint=Array.isArray(t)?t[0]:t,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(e,t){if(!this.isEnabled())return;let i=this._lastPoint;if(!i)return;if(e.preventDefault(),!this._moveStateManager.isValidMoveEvent(e))return void this.reset(e);let n=Array.isArray(t)?t[0]:t;return!this._moved&&n.dist(i)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=n,this._move(i,n))}dragEnd(e){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(e)&&(this._moved&&iC.suppressClick(),this.reset(e))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}};const AR={0:1,2:2};var _R=class{constructor(e){this._correctEvent=e.checkCorrectEvent}startMove(e){this._eventButton=e.button}endMove(e){delete this._eventButton}isValidStartEvent(e){return this._correctEvent(e)}isValidMoveEvent(e){return!function(e,t){let i=AR[t];return void 0===e.buttons||(e.buttons&i)!==i}(e,this._eventButton)}isValidEndEvent(e){return e.button===this._eventButton}},vR=class{constructor(){this._firstTouch=void 0}_isOneFingerTouch(e){return 1===e.targetTouches.length}_isSameTouchEvent(e){return e.targetTouches[0].identifier===this._firstTouch}startMove(e){this._firstTouch=e.targetTouches[0].identifier}endMove(e){delete this._firstTouch}isValidStartEvent(e){return this._isOneFingerTouch(e)}isValidMoveEvent(e){return this._isOneFingerTouch(e)&&this._isSameTouchEvent(e)}isValidEndEvent(e){return this._isOneFingerTouch(e)&&this._isSameTouchEvent(e)}},yR=class{constructor(e=new _R({checkCorrectEvent:()=>!0}),t=new vR){this.mouseMoveStateManager=e,this.oneFingerTouchMoveStateManager=t}_executeRelevantHandler(e,t,i){return e instanceof MouseEvent?t(e):typeof TouchEvent<"u"&&e instanceof TouchEvent?i(e):void 0}startMove(e){this._executeRelevantHandler(e,e=>{this.mouseMoveStateManager.startMove(e)},e=>{this.oneFingerTouchMoveStateManager.startMove(e)})}endMove(e){this._executeRelevantHandler(e,e=>{this.mouseMoveStateManager.endMove(e)},e=>{this.oneFingerTouchMoveStateManager.endMove(e)})}isValidStartEvent(e){return!!this._executeRelevantHandler(e,e=>this.mouseMoveStateManager.isValidStartEvent(e),e=>this.oneFingerTouchMoveStateManager.isValidStartEvent(e))}isValidMoveEvent(e){return!!this._executeRelevantHandler(e,e=>this.mouseMoveStateManager.isValidMoveEvent(e),e=>this.oneFingerTouchMoveStateManager.isValidMoveEvent(e))}isValidEndEvent(e){return!!this._executeRelevantHandler(e,e=>this.mouseMoveStateManager.isValidEndEvent(e),e=>this.oneFingerTouchMoveStateManager.isValidEndEvent(e))}};const xR=e=>{e.mousedown=e.dragStart,e.mousemoveWindow=e.dragMove,e.mouseup=e.dragEnd,e.contextmenu=e=>{e.preventDefault()}};var bR=class{constructor(e,t){this._clickTolerance=e.clickTolerance||1,this._map=t,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new Hc(0,0)}_shouldBePrevented(e){return e<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(e,t,i){return this._calculateTransform(e,t,i)}touchmove(e,t,i){if(this._active)return this._shouldBePrevented(i.length)?void this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",e):(e.preventDefault(),this._calculateTransform(e,t,i))}touchend(e,t,i){this._calculateTransform(e,t,i),this._active&&this._shouldBePrevented(i.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(e,t,i){i.length>0&&(this._active=!0);let n=dR(i,t),a=new Hc(0,0),r=new Hc(0,0),s=0;for(let e in n){let t=n[e],i=this._touches[e];i&&(a._add(t),r._add(t.sub(i)),s++,n[e]=t)}if(this._touches=n,this._shouldBePrevented(s)||!r.mag())return;let o=r.div(s);return this._sum._add(o),this._sum.mag()<this._clickTolerance?void 0:{around:a.div(s),panDelta:o}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}},wR=class{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(e,t,i){this._firstTwoTouches||i.length<2||(this._firstTwoTouches=[i[0].identifier,i[1].identifier],this._start([t[0],t[1]]))}touchmove(e,t,i){if(!this._firstTwoTouches)return;e.preventDefault();let[n,a]=this._firstTwoTouches,r=ER(i,t,n),s=ER(i,t,a);if(!r||!s)return;let o=this._aroundCenter?null:r.add(s).div(2);return this._move([r,s],o,e)}touchend(e,t,i){if(!this._firstTwoTouches)return;let[n,a]=this._firstTwoTouches,r=ER(i,t,n),s=ER(i,t,a);r&&s||(this._active&&iC.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(e){this._enabled=!0,this._aroundCenter=!!e&&"center"===e.around}disable(){this._enabled=!1,this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}};function ER(e,t,i){for(let n=0;n<e.length;n++)if(e[n].identifier===i)return t[n]}function kR(e,t){return Math.log(e/t)/Math.LN2}var SR=class extends wR{constructor(){super(),this._zoomRate=1,this._zoomThreshold=.1}setZoomRate(e){this._zoomRate=e??1}setZoomThreshold(e){this._zoomThreshold=e??.1}reset(){super.reset(),delete this._distance,delete this._startDistance}_start(e){this._startDistance=this._distance=e[0].dist(e[1])}_move(e,t){let i=this._distance;if(this._distance=e[0].dist(e[1]),this._active||!(Math.abs(kR(this._distance,this._startDistance))<this._zoomThreshold))return this._active=!0,{zoomDelta:kR(this._distance,i)*this._zoomRate,pinchAround:t}}};function MR(e,t){return 180*e.angleWith(t)/Math.PI}var CR=class extends wR{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(e){this._startVector=this._vector=e[0].sub(e[1]),this._minDiameter=e[0].dist(e[1])}_move(e,t,i){let n=this._vector;if(this._vector=e[0].sub(e[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:MR(this._vector,n),pinchAround:t}}_isBelowThreshold(e){this._minDiameter=Math.min(this._minDiameter,e.mag());let t=25/(Math.PI*this._minDiameter)*360,i=MR(e,this._startVector);return Math.abs(i)<t}};function TR(e){return Math.abs(e.y)>Math.abs(e.x)}var DR=class extends wR{constructor(e){super(),this._currentTouchCount=0,this._map=e}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(e,t,i){super.touchstart(e,t,i),this._currentTouchCount=i.length}_start(e){this._lastPoints=e,TR(e[0].sub(e[1]))&&(this._valid=!1)}_move(e,t,i){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;let n=e[0].sub(this._lastPoints[0]),a=e[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(n,a,i.timeStamp),this._valid?(this._lastPoints=e,this._active=!0,{pitchDelta:(n.y+a.y)/2*-.5}):void 0}gestureBeginsVertically(e,t,i){if(void 0!==this._valid)return this._valid;let n=e.mag()>=2,a=t.mag()>=2;if(!n&&!a)return;if(!n||!a)return void 0===this._firstMove&&(this._firstMove=i),i-this._firstMove<100&&void 0;let r=e.y>0==t.y>0;return TR(e)&&TR(t)&&r}};const PR={panStep:100,bearingStep:15,pitchStep:10};var IR=class{constructor(e,t){this._tr=t;let i=PR;this._panStep=i.panStep,this._bearingStep=i.bearingStep,this._pitchStep=i.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;let t=0,i=0,n=0,a=0,r=0;switch(e.keyCode){case 61:case 107:case 171:case 187:t=1;break;case 189:case 109:case 173:t=-1;break;case 37:e.shiftKey?i=-1:(e.preventDefault(),a=-1);break;case 39:e.shiftKey?i=1:(e.preventDefault(),a=1);break;case 38:e.shiftKey?n=1:(e.preventDefault(),r=-1);break;case 40:e.shiftKey?n=-1:(e.preventDefault(),r=1);break;default:return}return this._rotationDisabled&&(i=0,n=0),{cameraAnimation:s=>{let o=this._tr;s.easeTo({duration:300,easeId:"keyboardHandler",easing:FR,zoom:t?mh(o.zoom+t*(e.shiftKey?2:1),s.getZoomSnap()):o.zoom,bearing:o.bearing+i*this._bearingStep,pitch:o.pitch+n*this._pitchStep,offset:[-a*this._panStep,-r*this._panStep],center:o.center},{originalEvent:e})}}}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 FR(e){return e*(2-e)}const zR=4.000244140625;var RR=class{constructor(e,t,i){this._onTimeout=e=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(e)},this._map=e,this._tr=i,this._triggerRenderFrame=t,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(e){this._defaultZoomRate=e}setWheelZoomRate(e){this._wheelZoomRate=e}isEnabled(){return!!this._enabled}isActive(){return!!this._active||void 0!==this._finishTimeout}isZooming(){return!!this._zooming}enable(e){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!e&&"center"===e.around)}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(e){return!!this._map.cooperativeGestures.isEnabled()&&!(e.ctrlKey||this._map.cooperativeGestures.isBypassed(e))}wheel(e){if(!this.isEnabled())return;if(this._shouldBePrevented(e))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",e);let t=e.deltaMode===WheelEvent.DOM_DELTA_LINE?40*e.deltaY:e.deltaY,i=tC(),n=i-(this._lastWheelEventTime||0);this._lastWheelEventTime=i,0!==t&&t%zR==0?this._type="wheel":0!==t&&Math.abs(t)<4?this._type="trackpad":n>400?(this._type=null,this._lastValue=t,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(n*t)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,t+=this._lastValue)),e.shiftKey&&t&&(t/=4),this._type&&(this._lastWheelEvent=e,this._delta-=t,this._active||this._start(e)),e.preventDefault()}_start(e){if(!this._delta)return;this._needsRerender=!1,this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);let t=iC.mousePos(this._map.getCanvas(),e),i=this._tr;this._aroundPoint=this._aroundCenter?i.transform.locationToScreenPoint(Ex.convert(i.center)):t,this._needsRerender||(this._needsRerender=!0,this._triggerRenderFrame())}renderFrame(){if(!this._needsRerender||(this._needsRerender=!1,!this.isActive()))return;let e=this._tr.transform;if("number"==typeof this._lastExpectedZoom){let t=e.zoom-this._lastExpectedZoom;"number"==typeof this._startZoom&&(this._startZoom+=t),"number"==typeof this._targetZoom&&(this._targetZoom+=t)}if(0!==this._delta){let t="wheel"===this._type&&Math.abs(this._delta)>zR?this._wheelZoomRate:this._defaultZoomRate,i=2/(1+Math.exp(-Math.abs(this._delta*t)));this._delta<0&&0!==i&&(i=1/i);let n="number"==typeof this._targetZoom?dh(this._targetZoom):e.scale,a=e.applyConstrain(e.getCameraLngLat(),ph(n*i)).zoom,r=this._map.getZoomSnap();if("wheel"===this._type&&r>0){let t=mh(e.zoom,r);this._targetZoom=mh(a,r,a-t)}else this._targetZoom=a;"wheel"===this._type&&(this._startZoom=e.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}let t,i="number"==typeof this._targetZoom?this._targetZoom:e.zoom,n=this._startZoom,a=this._easing,r=!1;if("wheel"===this._type&&n&&a){let e=tC()-this._lastWheelEventTime,s=Math.min((e+5)/200,1),o=a(s);t=Ep.number(n,i,o),s<1?this._needsRerender=!0:r=!0}else t=i,r=!0;return this._active=!0,r&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._lastExpectedZoom,delete this._finishTimeout},200)),this._lastExpectedZoom=t,{noInertia:!0,needsRenderFrame:!r,zoomDelta:t-e.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(e){let t=rh;if(this._prevEase){let e=this._prevEase,i=(tC()-e.start)/e.duration,n=e.easing(i+.01)-e.easing(i),a=.27/Math.sqrt(n*n+1e-4)*.01;t=ah(a,Math.sqrt(.0729-a*a),.25,1)}return this._prevEase={start:tC(),duration:e,easing:t},t}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,delete this._lastExpectedZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}},LR=class{constructor(e,t){this._clickZoom=e,this._tapZoom=t}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()}},BR=class{constructor(e,t){this._tr=t,this.reset()}reset(){this._active=!1}dblclick(e,t){return e.preventDefault(),{cameraAnimation:i=>{i.easeTo({duration:300,zoom:mh(this._tr.zoom+(e.shiftKey?-1:1),i.getZoomSnap()),around:this._tr.unproject(t)},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}},OR=class{constructor(){this._tap=new mR({numTouches:1,numTaps:1}),this._zoomRate=1,this.reset()}setZoomRate(e){this._zoomRate=e??1}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(e,t,i){if(!this._swipePoint)if(this._tapTime){let n=t[0],a=e.timeStamp-this._tapTime<500,r=this._tapPoint.dist(n)<30;a&&r?i.length>0&&(this._swipePoint=n,this._swipeTouch=i[0].identifier):this.reset()}else this._tap.touchstart(e,t,i)}touchmove(e,t,i){if(this._tapTime){if(this._swipePoint){if(i[0].identifier!==this._swipeTouch)return;let n=t[0],a=n.y-this._swipePoint.y;return this._swipePoint=n,e.preventDefault(),this._active=!0,{zoomDelta:a/128*this._zoomRate}}}else this._tap.touchmove(e,t,i)}touchend(e,t,i){if(this._tapTime)this._swipePoint&&0===i.length&&this.reset();else{let n=this._tap.touchend(e,t,i);n&&(this._tapTime=e.timeStamp,this._tapPoint=n)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}},UR=class{constructor(e,t,i){this._el=e,this._mousePan=t,this._touchPan=i}enable(e){this._inertiaOptions=e||{},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()}},NR=class{constructor(e,t,i,n){this._pitchWithRotate=e.pitchWithRotate,this._rollEnabled=e.rollEnabled,this._mouseRotate=t,this._mousePitch=i,this._mouseRoll=n}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()}},jR=class{constructor(e,t,i,n){this._el=e,this._touchZoom=t,this._touchRotate=i,this._tapDragZoom=n,this._rotationDisabled=!1,this._enabled=!0}enable(e){this._touchZoom.enable(e),this._rotationDisabled||this._touchRotate.enable(e),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()}setZoomRate(e){this._touchZoom.setZoomRate(e),this._tapDragZoom.setZoomRate(e)}setZoomThreshold(e){this._touchZoom.setZoomThreshold(e)}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}},VR=class{constructor(e,t){this._bypassKey=navigator.userAgent.includes("Mac")?"metaKey":"ctrlKey",this._map=e,this._options=t,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;let e=this._map.getCanvasContainer();e.classList.add("maplibregl-cooperative-gestures"),this._container=iC.create("div","maplibregl-cooperative-gesture-screen",e);let t=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");"metaKey"===this._bypassKey&&(t=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));let i=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),n=document.createElement("div");n.className="maplibregl-desktop-message",n.textContent=t,this._container.appendChild(n);let a=document.createElement("div");a.className="maplibregl-mobile-message",a.textContent=i,this._container.appendChild(a),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(this._container.remove(),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(e){return e[this._bypassKey]}notifyGestureBlocked(e,t){this._enabled&&(this._map.fire(new rC("cooperativegestureprevented",{gestureType:e,originalEvent:t})),this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}},qR=class{constructor(e){this._camera=e}get transform(){return this._camera._requestedCameraState||this._camera.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(e){return this.transform.screenPointToLocation(Hc.convert(e),this._camera.terrain)}};const GR=e=>e.zoom||e.drag||e.roll||e.pitch||e.rotate;var HR=class extends ed{};function WR(e){return e.panDelta?.mag()||e.zoomDelta||e.bearingDelta||e.pitchDelta||e.rollDelta}var ZR=class{get _ownerDocument(){return this._el?.ownerDocument||document}get _ownerWindow(){return this._el?.ownerDocument?.defaultView||window}constructor(e,t,i){this._terrainGestureAnchorElevation=null,this.handleWindowEvent=e=>{this.handleEvent(e,`${e.type}Window`)},this.handleEvent=(e,t)=>{if("blur"===e.type)return void this.stop(!0);this._updatingCamera=!0;let i="renderFrame"===e.type?void 0:e,n={needsRenderFrame:!1},a={},r={};for(let{handlerName:s,handler:o,allowed:l}of this._handlers){if(!o.isEnabled())continue;let c;if(this._blockedByActive(r,l,s))o.reset();else if(o[t||e.type]){if(Lh(e,t||e.type)){let i=iC.mousePos(this._map.getCanvas(),e);c=o[t||e.type](e,i)}else if(Rh(e,t||e.type)){let i=e.touches,n=this._getMapTouches(i),a=iC.touchPos(this._map.getCanvas(),n);c=o[t||e.type](e,a,n)}else Bh(t||e.type)||(c=o[t||e.type](e));this.mergeHandlerResult(n,a,c,s,i),c?.needsRenderFrame&&this._triggerRenderFrame()}(c||o.isActive())&&(r[s]=o)}let s={};for(let e in this._previousActiveHandlers)r[e]||(s[e]=i);this._previousActiveHandlers=r,(Object.keys(s).length||WR(n))&&(this._changes.push([n,a,s]),this._triggerRenderFrame()),(Object.keys(r).length||WR(n))&&this._camera.stop(!0),this._updatingCamera=!1;let{cameraAnimation:o}=n;o&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],o(this._map))},this._map=e,this._camera=t,this._transformProvider=new qR(this._camera),this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new sR(e),this._bearingSnap=i.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(i);let n=this._el;this._listeners=[[n,"touchstart",{passive:!0}],[n,"touchmove",{passive:!1}],[n,"touchend",void 0],[n,"touchcancel",void 0],[n,"mousedown",void 0],[n,"mousemove",void 0],[n,"mouseup",void 0],[this._ownerDocument,"mousemove",{capture:!0}],[this._ownerDocument,"mouseup",void 0],[n,"mouseover",void 0],[n,"mouseout",void 0],[n,"dblclick",void 0],[n,"click",void 0],[n,"keydown",{capture:!1}],[n,"keyup",void 0],[n,"wheel",{passive:!1}],[n,"contextmenu",void 0],[this._ownerWindow,"blur",void 0]];for(let[e,t,i]of this._listeners)e.addEventListener(t,e===this._ownerDocument?this.handleWindowEvent:this.handleEvent,i)}destroy(){for(let[e,t,i]of this._listeners)e.removeEventListener(t,e===this._ownerDocument?this.handleWindowEvent:this.handleEvent,i)}_addDefaultHandlers(e){let t=this._map,i=t.getCanvasContainer();this._add("mapEvent",new cR(t,e));let n=t.boxZoom=new hR(t,e,this._transformProvider);this._add("boxZoom",n),e.interactive&&e.boxZoom&&n.enable();let a=t.cooperativeGestures=new VR(t,e.cooperativeGestures);this._add("cooperativeGestures",a),e.cooperativeGestures&&a.enable();let r=new gR(t,this._transformProvider),s=new BR(t,this._transformProvider);t.doubleClickZoom=new LR(s,r),this._add("tapZoom",r),this._add("clickZoom",s),e.interactive&&e.doubleClickZoom&&t.doubleClickZoom.enable();let o=new OR;this._add("tapDragZoom",o);let l=t.touchPitch=new DR(t);this._add("touchPitch",l),e.interactive&&e.touchPitch&&t.touchPitch.enable(e.touchPitch);let c=()=>t.project(t.getCenter()),u=function({enable:e,clickTolerance:t,aroundCenter:i=!0,minPixelCenterThreshold:n=100,rotateSpeed:a=.8},r){return new fR({clickTolerance:t,move:(e,t)=>{let s=r();if(i&&Math.abs(s.y-e.y)>n)return{bearingDelta:Dh(new Hc(e.x,t.y),t,s)};let o=(t.x-e.x)*a;return i&&t.y<s.y&&(o=-o),{bearingDelta:o}},moveStateManager:new _R({checkCorrectEvent:e=>0===e.button&&e.ctrlKey||2===e.button&&!e.ctrlKey}),enable:e,assignEvents:xR})}(e,c),h=function({enable:e,clickTolerance:t,pitchSpeed:i=-.5}){return new fR({clickTolerance:t,move:(e,t)=>({pitchDelta:(t.y-e.y)*i}),moveStateManager:new _R({checkCorrectEvent:e=>0===e.button&&e.ctrlKey||2===e.button}),enable:e,assignEvents:xR})}(e),d=function({enable:e,clickTolerance:t,rollDegreesPerPixelMoved:i=.3},n){return new fR({clickTolerance:t,move:(e,t)=>{let a=n(),r=(t.x-e.x)*i;return t.y<a.y&&(r=-r),{rollDelta:r}},moveStateManager:new _R({checkCorrectEvent:e=>2===e.button&&e.ctrlKey}),enable:e,assignEvents:xR})}(e,c);t.dragRotate=new NR(e,u,h,d),this._add("mouseRotate",u,["mousePitch"]),this._add("mousePitch",h,["mouseRotate","mouseRoll"]),this._add("mouseRoll",d,["mousePitch"]),e.interactive&&e.dragRotate&&t.dragRotate.enable();let p=function({enable:e,clickTolerance:t}){return new fR({clickTolerance:t,move:(e,t)=>({around:t,panDelta:t.sub(e)}),activateOnStart:!0,moveStateManager:new _R({checkCorrectEvent:e=>0===e.button&&!e.ctrlKey}),enable:e,assignEvents:xR})}(e),m=new bR(e,t);t.dragPan=new UR(i,p,m),this._add("mousePan",p),this._add("touchPan",m,["touchZoom","touchRotate"]),e.interactive&&e.dragPan&&t.dragPan.enable(e.dragPan);let g=new CR,f=new SR;t.touchZoomRotate=new jR(i,f,g,o),this._add("touchRotate",g,["touchPan","touchZoom"]),this._add("touchZoom",f,["touchPan","touchRotate"]),e.interactive&&e.touchZoomRotate&&t.touchZoomRotate.enable(e.touchZoomRotate),this._add("blockableMapEvent",new uR(t));let A=t.scrollZoom=new RR(t,()=>this._triggerRenderFrame(),this._transformProvider);this._add("scrollZoom",A,["mousePan"]),e.interactive&&e.scrollZoom&&t.scrollZoom.enable(e.scrollZoom);let _=t.keyboard=new IR(t,this._transformProvider);this._add("keyboard",_),e.interactive&&e.keyboard&&t.keyboard.enable()}_add(e,t,i){this._handlers.push({handlerName:e,handler:t,allowed:i}),this._handlersById[e]=t}stop(e){if(!this._updatingCamera){for(let{handler:e}of this._handlers)e.reset();this._inertia.clear(),this._fireEvents({},{},e),this._changes=[]}}isActive(){for(let{handler:e}of this._handlers)if(e.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!GR(this._eventsInProgress)||this.isZooming()}_blockedByActive(e,t,i){for(let n in e)if(n!==i&&!t?.includes(n))return!0;return!1}_getMapTouches(e){let t=[];for(let i of e){let e=i.target;this._el.contains(e)&&t.push(i)}return t}mergeHandlerResult(e,t,i,n,a){if(!i)return;lh(e,i);let r={handlerName:n,originalEvent:i.originalEvent||a};void 0!==i.zoomDelta&&(t.zoom=r),void 0!==i.panDelta&&(t.drag=r),void 0!==i.rollDelta&&(t.roll=r),void 0!==i.pitchDelta&&(t.pitch=r),void 0!==i.bearingDelta&&(t.rotate=r)}_applyChanges(){let e={},t={},i={};for(let[n,a,r]of this._changes)n.panDelta&&(e.panDelta=(e.panDelta||new Hc(0,0))._add(n.panDelta)),n.zoomDelta&&(e.zoomDelta=(e.zoomDelta||0)+n.zoomDelta),n.bearingDelta&&(e.bearingDelta=(e.bearingDelta||0)+n.bearingDelta),n.pitchDelta&&(e.pitchDelta=(e.pitchDelta||0)+n.pitchDelta),n.rollDelta&&(e.rollDelta=(e.rollDelta||0)+n.rollDelta),void 0!==n.around&&(e.around=n.around),void 0!==n.pinchAround&&(e.pinchAround=n.pinchAround),n.noInertia&&(e.noInertia=n.noInertia),lh(t,a),lh(i,r);this._updateMapTransform(e,t,i),this._changes=[]}_updateMapTransform(e,t,i){let n=this._map,a=this._camera.getTransformForUpdate(),r=n.terrain;if(!(WR(e)||r&&this._terrainMovement))return void this._fireEvents(t,i,!0);this._camera.stop(!0);let{panDelta:s,zoomDelta:o,bearingDelta:l,pitchDelta:c,rollDelta:u}=e,{around:h,aroundOnSurface:d}=this._resolveAround(e,r,a),p=r?this._terrainGestureElevation(r,h,d,a,t):void 0,m={panDelta:s,zoomDelta:o,rollDelta:u,pitchDelta:c,bearingDelta:l,around:h,aroundElevation:p};this._camera.cameraHelper.useGlobeControls&&!a.isPointOnMapSurface(h)&&(h=a.centerPoint);let g=this._computePreZoomAroundLoc(a,h,s,p);this._handleMapControls({terrain:r,tr:a,deltasForHelper:m,preZoomAroundLoc:g,combinedEventsInProgress:t,panDelta:s}),this._camera.applyUpdatedTransform(a),this._map._update(),e.noInertia||this._inertia.record(e),this._fireEvents(t,i,!0)}_resolveAround(e,t,i){let n=void 0===e.pinchAround?e.around:e.pinchAround;return n||=this._camera.transform.centerPoint,t&&!i.isPointOnMapSurface(n)?{around:i.centerPoint,aroundOnSurface:!1}:{around:n,aroundOnSurface:!0}}_terrainGestureElevation(e,t,i,n,a){if(!i)return;if(!this._terrainMovement&&(a.drag||a.zoom)){let i=n.screenTerrainPointToMercatorCoordinate(t,e);this._terrainGestureAnchorElevation=i?i.z:null}if(null===this._terrainGestureAnchorElevation)return;let r=this._terrainGestureAnchorElevation;return t.distSqr(n.centerPoint)<.01||r-n.elevation>=.9*(n.getCameraAltitude()-n.elevation)?void 0:r}_computePreZoomAroundLoc(e,t,i,n){if(t.distSqr(e.centerPoint)<.01)return e.center;let a=i?t.sub(i):t;return void 0===n?e.screenPointToLocation(a):e.screenPointToLocationAtElevation(a,n)}_handleMapControls({terrain:e,tr:t,deltasForHelper:i,preZoomAroundLoc:n,combinedEventsInProgress:a,panDelta:r}){let s=this._camera.cameraHelper;if(s.handleMapControlsRollPitchBearingZoom(i,t),e)return s.useGlobeControls?(!this._terrainMovement&&(a.drag||a.zoom)&&(this._terrainMovement=!0,this._camera.elevationFreeze=!0),void s.handleMapControlsPan(i,t,n)):this._terrainMovement||!a.drag&&!a.zoom?void(void 0===i.aroundElevation&&a.drag&&this._terrainMovement&&r?t.setCenter(t.screenPointToLocation(t.centerPoint.sub(r))):s.handleMapControlsPan(i,t,n)):(this._terrainMovement=!0,this._camera.elevationFreeze=!0,void s.handleMapControlsPan(i,t,n));s.handleMapControlsPan(i,t,n)}_fireEvents(e,t,i){let n=GR(this._eventsInProgress),a=GR(e),r={};for(let t in e){let{originalEvent:i}=e[t];this._eventsInProgress[t]||(r[`${t}start`]=i),this._eventsInProgress[t]=e[t]}!n&&a&&this._fireEvent("movestart",a.originalEvent);for(let e in r)this._fireEvent(e,r[e]);a&&this._fireEvent("move",a.originalEvent);for(let t in e){let{originalEvent:i}=e[t];this._fireEvent(t,i)}let s,o={};for(let e in this._eventsInProgress){let{handlerName:i,originalEvent:n}=this._eventsInProgress[e];this._handlersById[i].isActive()||(delete this._eventsInProgress[e],s=t[i]||n,o[`${e}end`]=s)}for(let e in o)this._fireEvent(e,o[e]);let l=GR(this._eventsInProgress),c=(n||a)&&!l;if(c&&this._terrainMovement){this._camera.elevationFreeze=!1,this._terrainMovement=!1,this._terrainGestureAnchorElevation=null;let e=this._camera.getTransformForUpdate();this._map.getCenterClampedToGround()&&e.recalculateZoomAndCenter(this._map.terrain),this._camera.applyUpdatedTransform(e)}if(i&&c){this._updatingCamera=!0;let e=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),t=e=>0!==e&&-this._bearingSnap<e&&e<this._bearingSnap;!e||!e.essential&&$M.prefersReducedMotion?(this._map.fire(new sC("moveend",{originalEvent:s})),t(this._map.getBearing())&&this._map.resetNorth()):(t(e.bearing||this._map.getBearing())&&(e.bearing=0),e.freezeElevation=!0,this._map.easeTo(e,{originalEvent:s})),this._updatingCamera=!1}}_fireEvent(e,t){this._map.fire(new sC(e,t?{originalEvent:t}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(e=>{delete this._frameId,this.handleEvent(new HR("renderFrame",{timeStamp:e})),this._applyChanges()})}_triggerRenderFrame(){void 0===this._frameId&&(this._frameId=this._requestFrame())}},KR=class extends id{constructor(e){super(),this._renderFrameCallback=()=>{let e=Math.min((tC()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(e)),e<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this.transform=new RP,this.cameraHelper=new jP,void 0!==e.minZoom&&this.transform.setMinZoom(e.minZoom),void 0!==e.maxZoom&&this.transform.setMaxZoom(e.maxZoom),void 0!==e.minPitch&&this.transform.setMinPitch(e.minPitch),void 0!==e.maxPitch&&this.transform.setMaxPitch(e.maxPitch),void 0!==e.renderWorldCopies&&this.transform.setRenderWorldCopies(e.renderWorldCopies),null!==e.transformConstrain&&this.transform.setConstrainOverride(e.transformConstrain),this._moving=!1,this._zooming=!1,this._bearingSnap=e.bearingSnap,this._zoomSnap=e.zoomSnap,this._requestRenderFrame=e.requestRenderFrame,this._cancelRenderFrame=e.cancelRenderFrame,this.terrain=e.terrain,this._centerClampedToGround=e.centerClampedToGround??!0,this.transformCameraUpdate=e.transformCameraUpdate??null,this._stopHandlers=e.stopHandlers??(()=>{}),this.on("moveend",()=>{delete this._requestedCameraState})}migrateProjection(e,t){if(e.apply(this.transform,!0),this.transform=e,this.cameraHelper=t,this._requestedCameraState){let t=e.clone();t.apply(this._requestedCameraState,!0),this._requestedCameraState=t}}getCenter(){return new Ex(this.transform.center.lng,this.transform.center.lat)}setCenter(e,t){return this.jumpTo({center:e},t)}getCenterElevation(){return this.transform.elevation}setCenterElevation(e,t){return this.jumpTo({elevation:e},t),this}getCenterClampedToGround(){return this._centerClampedToGround}setCenterClampedToGround(e){this._centerClampedToGround=e}panBy(e,t,i){return e=Hc.convert(e).mult(-1),this.panTo(this.transform.center,lh({offset:e},t),i)}panTo(e,t,i){return this.easeTo(lh({center:e},t),i)}getZoom(){return this.transform.zoom}setZoom(e,t){return this.jumpTo({zoom:e},t),this}zoomTo(e,t,i){return this.easeTo(lh({zoom:e},t),i)}zoomIn(e,t){return this.zoomTo(mh(this.getZoom()+1,this._zoomSnap),e,t),this}zoomOut(e,t){return this.zoomTo(mh(this.getZoom()-1,this._zoomSnap),e,t),this}getVerticalFieldOfView(){return this.transform.fov}setVerticalFieldOfView(e,t){return e!=this.transform.fov&&(this.transform.setFov(e),this.fire(new sC("movestart",t)).fire(new sC("move",t)).fire(new sC("moveend",t))),this}getBearing(){return this.transform.bearing}setZoomSnap(e){return this._zoomSnap=e,this}getZoomSnap(){return this._zoomSnap}setBearing(e,t){return this.jumpTo({bearing:e},t),this}getPadding(){return this.transform.padding}setPadding(e,t){return this.jumpTo({padding:e},t),this}rotateTo(e,t,i){return this.easeTo(lh({bearing:e},t),i)}resetNorth(e,t){return this.rotateTo(0,lh({duration:1e3},e),t),this}resetNorthPitch(e,t){return this.easeTo(lh({bearing:0,pitch:0,roll:0,duration:1e3},e),t),this}snapToNorth(e,t){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(e,t):this}getPitch(){return this.transform.pitch}setPitch(e,t){return this.jumpTo({pitch:e},t),this}getRoll(){return this.transform.roll}setRoll(e,t){return this.jumpTo({roll:e},t),this}cameraForBounds(e,t){e=gT.convert(e).adjustAntiMeridian();let i=t?.bearing||0;return this._cameraForBoxAndBearing(e.getNorthWest(),e.getSouthEast(),i,t)}_cameraForBoxAndBearing(e,t,i,n){let a={top:0,bottom:0,right:0,left:0};if("number"==typeof(n=lh({padding:a,offset:[0,0],maxZoom:this.transform.maxZoom},n)).padding){let e=n.padding;n.padding={top:e,bottom:e,right:e,left:e}}let r=lh(a,n.padding);n.padding=r;let s=this.transform,o=new gT(e,t),l=this.cameraHelper.cameraForBoxAndBearing(n,r,o,i,s);return l&&this._zoomSnap&&(l.zoom=mh(l.zoom,this._zoomSnap,-1)),l}fitBounds(e,t,i){return this._fitInternal(this.cameraForBounds(e,t),t,i)}fitScreenCoordinates(e,t,i,n,a){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.screenPointToLocation(Hc.convert(e)),this.transform.screenPointToLocation(Hc.convert(t)),i,n),n,a)}_fitInternal(e,t,i){return e?(delete(t=lh(e,t)).padding,t.linear?this.easeTo(t,i):this.flyTo(t,i)):this}jumpTo(e,t){this.stop(),void 0!==e.zoom&&this._zoomSnap&&(e.zoom=mh(e.zoom,this._zoomSnap));let i=this.getTransformForUpdate(),n=!1,a=!1,r=!1,s=i.zoom;this.terrain&&i.setElevation(this.terrain.getElevationForLngLat(e.center?Ex.convert(e.center):i.center,i)),this.cameraHelper.handleJumpToCenterZoom(i,e);let o=i.zoom!==s;return void 0!==e.elevation&&i.elevation!==+e.elevation&&i.setElevation(+e.elevation),void 0!==e.bearing&&i.bearing!==+e.bearing&&(n=!0,i.setBearing(+e.bearing)),void 0!==e.pitch&&i.pitch!==+e.pitch&&(a=!0,i.setPitch(+e.pitch)),void 0!==e.roll&&i.roll!==+e.roll&&(r=!0,i.setRoll(+e.roll)),null!=e.padding&&!i.isPaddingEqual(e.padding)&&i.setPadding(e.padding),this.applyUpdatedTransform(i),this.fire(new sC("movestart",t)).fire(new sC("move",t)),o&&this.fire(new sC("zoomstart",t)).fire(new sC("zoom",t)).fire(new sC("zoomend",t)),n&&this.fire(new sC("rotatestart",t)).fire(new sC("rotate",t)).fire(new sC("rotateend",t)),a&&this.fire(new sC("pitchstart",t)).fire(new sC("pitch",t)).fire(new sC("pitchend",t)),r&&this.fire(new sC("rollstart",t)).fire(new sC("roll",t)).fire(new sC("rollend",t)),this.fire(new sC("moveend",t))}calculateCameraOptionsFromCameraLngLatAltRotation(e,t,i,n,a){let r=this.transform.calculateCenterFromCameraLngLatAlt(e,t,i,n);return{center:r.center,elevation:r.elevation,zoom:r.zoom,bearing:i,pitch:n,roll:a}}easeTo(e,t){this._stop(!1,e.easeId),void 0!==(e=lh({offset:[0,0],duration:500,easing:rh},e)).zoom&&this._zoomSnap&&(e.zoom=mh(e.zoom,this._zoomSnap)),(!1===e.animate||!e.essential&&$M.prefersReducedMotion)&&(e.duration=0);let i,n,a=this.getTransformForUpdate(),r=this.getBearing(),s=a.pitch,o=a.roll,l=void 0===e.bearing?r:this._normalizeBearing(e.bearing,r),c=void 0===e.pitch?s:+e.pitch,u=void 0===e.roll?o:this._normalizeBearing(e.roll,o),h=void 0===e.padding?a.padding:e.padding,d=Hc.convert(e.offset);e.around&&(i=Ex.convert(e.around),n=a.locationToScreenPoint(i));let p={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching,rolling:this._rolling},m=this.cameraHelper.handleEaseTo(a,{bearing:l,pitch:c,roll:u,padding:h,around:i,aroundPoint:n,offsetAsPoint:d,offset:e.offset,zoom:e.zoom,center:e.center});return this._rotating||=r!==l,this._pitching||=c!==s,this._rolling||=u!==o,this._padding=!a.isPaddingEqual(h),this._zooming||=m.isZooming,this._easeId=e.easeId,this._prepareEase(t,e.noMoveStart,p),this.terrain&&this._prepareElevation(m.elevationCenter),this._ease(i=>{m.easeFunc(i),this.terrain&&!e.freezeElevation&&this._updateElevation(i),this.applyUpdatedTransform(a),this._fireMoveEvents(t)},i=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(t,i)},e),this}_prepareEase(e,t,i={}){this._moving=!0,!t&&!i.moving&&this.fire(new sC("movestart",e)),this._zooming&&!i.zooming&&this.fire(new sC("zoomstart",e)),this._rotating&&!i.rotating&&this.fire(new sC("rotatestart",e)),this._pitching&&!i.pitching&&this.fire(new sC("pitchstart",e)),this._rolling&&!i.rolling&&this.fire(new sC("rollstart",e))}_prepareElevation(e){this._elevationCenter=e,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLat(e,this.transform),this.elevationFreeze=!0}_updateElevation(e){(void 0===this._elevationStart||void 0===this._elevationCenter)&&this._prepareElevation(this.transform.center),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom));let t=this.terrain.getElevationForLngLat(this._elevationCenter,this.transform);if(e<1&&t!==this._elevationTarget){let i=this._elevationTarget-this._elevationStart,n=(t-(i*e+this._elevationStart))/(1-e);this._elevationStart+=e*(i-n),this._elevationTarget=t}this.transform.setElevation(Ep.number(this._elevationStart,this._elevationTarget,e))}_finalizeElevation(){this.elevationFreeze=!1,this.getCenterClampedToGround()&&this.transform.recalculateZoomAndCenter(this.terrain)}getTransformForUpdate(){return this.transformCameraUpdate||this.terrain?(this._requestedCameraState||=this.transform.clone(),this._requestedCameraState):this.transform}_elevateCameraIfInsideTerrain(e){if(!this.terrain&&e.elevation>=0&&e.pitch<=90)return{};let t=e.getCameraLngLat(),i=e.getCameraAltitude(),n=this.terrain?this.terrain.getElevationForLngLatZoom(t,e.zoom):0;if(i<n){let i=e.calculateCameraOptionsFromTo(t,n,e.center,e.elevation);return{pitch:i.pitch,zoom:i.zoom}}return{}}applyUpdatedTransform(e){let t=[];if(t.push(e=>this._elevateCameraIfInsideTerrain(e)),this.transformCameraUpdate&&t.push(e=>this.transformCameraUpdate(e)),!t.length)return;let i=e.clone();for(let e of t){let t=i.clone(),{center:n,zoom:a,roll:r,pitch:s,bearing:o,elevation:l}=e(t);n&&t.setCenter(n),void 0!==l&&t.setElevation(l),void 0!==a&&t.setZoom(a),void 0!==r&&t.setRoll(r),void 0!==s&&t.setPitch(s),void 0!==o&&t.setBearing(o),i.apply(t,!1)}this.transform.apply(i,!1)}_fireMoveEvents(e){this.fire(new sC("move",e)),this._zooming&&this.fire(new sC("zoom",e)),this._rotating&&this.fire(new sC("rotate",e)),this._pitching&&this.fire(new sC("pitch",e)),this._rolling&&this.fire(new sC("roll",e))}_afterEase(e,t){if(this._easeId&&t&&this._easeId===t)return;delete this._easeId;let i=this._zooming,n=this._rotating,a=this._pitching,r=this._rolling;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._rolling=!1,this._padding=!1,i&&this.fire(new sC("zoomend",e)),n&&this.fire(new sC("rotateend",e)),a&&this.fire(new sC("pitchend",e)),r&&this.fire(new sC("rollend",e)),this.fire(new sC("moveend",e))}flyTo(e,t){if(!e.essential&&$M.prefersReducedMotion){let i=ch(e,["center","zoom","bearing","pitch","roll","elevation","padding"]);return this.jumpTo(i,t)}this.stop(),void 0!==(e=lh({offset:[0,0],speed:1.2,curve:1.42,easing:rh},e)).zoom&&this._zoomSnap&&(e.zoom=mh(e.zoom,this._zoomSnap));let i=this.getTransformForUpdate(),n=i.bearing,a=i.pitch,r=i.roll,s=i.padding,o=void 0===e.bearing?n:this._normalizeBearing(e.bearing,n),l=void 0===e.pitch?a:+e.pitch,c=void 0===e.roll?r:this._normalizeBearing(e.roll,r),u=void 0===e.padding?i.padding:e.padding,h=Hc.convert(e.offset),d=i.centerPoint.add(h),p=i.screenPointToLocation(d),m=this.cameraHelper.handleFlyTo(i,{bearing:o,pitch:l,roll:c,padding:u,locationAtOffset:p,offsetAsPoint:h,center:e.center,minZoom:e.minZoom,zoom:e.zoom}),g=e.curve,f=Math.max(i.width,i.height),A=f/m.scaleOfZoom,_=m.pixelPathLength,v=f/m.scaleOfMinZoom;g=Math.min(g,Math.sqrt(v/_*2));let y=g*g;function x(e){let t=(A*A-f*f+(e?-1:1)*y*y*_*_)/(2*(e?A:f)*y*_);return Math.log(Math.sqrt(t*t+1)-t)}function b(e){return(Math.exp(e)-Math.exp(-e))/2}function w(e){return(Math.exp(e)+Math.exp(-e))/2}let E=x(!1),k=function(e){return w(E)/w(E+g*e)},S=function(e){return f*((w(E)*function(e){return b(e)/w(e)}(E+g*e)-b(E))/y)/_},M=(x(!0)-E)/g;if(Math.abs(_)<2e-6||!isFinite(M)){if(Math.abs(f-A)<1e-6)return this.easeTo(e,t);let i=A<f?-1:1;M=Math.abs(Math.log(A/f))/g,S=()=>0,k=e=>Math.exp(i*g*e)}if(void 0!==e.duration)e.duration=+e.duration;else{let t=void 0===e.screenSpeed?+e.speed:+e.screenSpeed/g;e.duration=1e3*M/t}return e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=n!==o,this._pitching=l!==a,this._rolling=c!==r,this._padding=!i.isPaddingEqual(u),this._prepareEase(t,!1),this.terrain&&this._prepareElevation(m.targetCenter),this._ease(p=>{let g=p*M,f=1/k(g),A=S(g);this._rotating&&i.setBearing(Ep.number(n,o,p)),this._pitching&&i.setPitch(Ep.number(a,l,p)),this._rolling&&i.setRoll(Ep.number(r,c,p)),this._padding&&(i.interpolatePadding(s,u,p),d=i.centerPoint.add(h)),m.easeFunc(p,f,A,d),this.terrain&&!e.freezeElevation&&this._updateElevation(p),this.applyUpdatedTransform(i),this._fireMoveEvents(t)},()=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(t)},e),this}isEasing(){return!!this._easeFrameId}stop(e){return this._stop(e)}_stop(e,t){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){let e=this._onEaseEnd;delete this._onEaseEnd,e.call(this,t)}return e||this._stopHandlers(),this}_ease(e,t,i){!1===i.animate||0===i.duration?(e(1),t()):(this._easeStart=tC(),this._easeOptions=i,this._onEaseFrame=e,this._onEaseEnd=t,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(e,t){e=oh(e,-180,180);let i=Math.abs(e-t);return Math.abs(e-360-t)<i&&(e-=360),Math.abs(e+360-t)<i&&(e+=360),e}isMoving(){return this._moving}isZooming(){return this._zooming}isRotating(){return this._rotating}};const XR={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};var QR=class{constructor(e=XR){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=e=>{e&&("terrain"===e.type||"style"===e.dataType||"source"===e.dataType&&("metadata"===e.sourceDataType||"visibility"===e.sourceDataType))&&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=e}getDefaultPosition(){return"bottom-right"}onAdd(e){return this._map=e,this._compact=this.options.compact,this._container=iC.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=iC.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=iC.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(){this._container.remove(),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(e,t){let i=this._map._getUIString(`AttributionControl.${t}`);e.title=i,e.setAttribute("aria-label",i)}_updateAttributions(){if(!this._map.style)return;let e=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?e=e.concat(this.options.customAttribution.map(e=>"string"==typeof e?e:"")):"string"==typeof this.options.customAttribution&&e.push(this.options.customAttribution)),this._map.style.stylesheet){let e=this._map.style.stylesheet;this.styleOwner=e.owner,this.styleId=e.id}let t=this._map.style.tileManagers;for(let i in t){let n=t[i];if(n.used||n.usedForTerrain){let t=n.getSource();t.attribution&&!e.includes(t.attribution)&&e.push(t.attribution)}}e=e.filter(e=>String(e).trim()),e.sort((e,t)=>e.length-t.length),e=e.filter((t,i)=>{for(let n=i+1;n<e.length;n++)if(e[n].includes(t))return!1;return!0});let i=e.join(" | ");i!==this._attribHTML&&(this._attribHTML=i,e.length?(this._innerContainer.innerHTML=iC.sanitize(i),this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}},YR=class{constructor(e={}){this._updateCompact=()=>{let e=this._container.children;if(e.length){let t=e[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?!1!==this._compact&&t.classList.add("maplibregl-compact"):t.classList.remove("maplibregl-compact")}},this.options=e}getDefaultPosition(){return"bottom-left"}onAdd(e){this._map=e,this._compact=this.options?.compact,this._container=iC.create("div","maplibregl-ctrl");let t=iC.create("a","maplibregl-ctrl-logo");return t.target="_blank",t.rel="noopener nofollow",t.href="https://maplibre.org/",t.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),t.setAttribute("rel","noopener nofollow"),this._container.appendChild(t),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){this._container.remove(),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}},JR=class{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(e){let t=++this._id;return this._queue.push({callback:e,id:t,cancelled:!1}),t}remove(e){let t=this._currentlyRunning,i=t?this._queue.concat(t):this._queue;for(let t of i)if(t.id===e)return void(t.cancelled=!0)}run(e=0){if(this._currentlyRunning)throw Error("Attempting to run(), but is already running.");let t=this._currentlyRunning=this._queue;this._queue=[];let i,n=!1;for(let a of t)if(!a.cancelled){try{a.callback(e)}catch(e){n||(n=!0,i=e)}if(this._cleared)break}if(this._cleared=!1,this._currentlyRunning=!1,n)throw i}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}};const $R=["none","zoom","sourceTiles","visibleLayers","revision"];var eL=class{constructor(e,t,i,n){this._tileKeys=e.map(e=>e.key).sort().join(),this._revision=t,this._zoom=i,this._visibleLayerIds=n}difference(e){return this._revision===e?._revision?this._visibleLayerIds===e._visibleLayerIds?this._tileKeys===e._tileKeys?this._zoom===e._zoom?"none":"zoom":"sourceTiles":"visibleLayers":"revision"}};const tL={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0,"color-relief":!0};var iL=class{constructor(e,t){this.needsFollowUpFrame=!1,this.painter=e,this.terrain=t,this.rttSize=t.tileManager.tileSize*t.qualityFactor}getTexture(e){return e.getRTT(this._stacks.length-1).texture}prepareForRender(e,t){let i=t!==this._lastPrepareZoom;this._lastPrepareZoom=t,this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.tileManager.getRenderableTiles(),this._renderableLayerIds=e._order.filter(i=>!e._layers[i].isHidden(t));let n=this._renderableLayerIds.join(),a=new Set;for(let t of this._renderableLayerIds){let i=e._layers[t],n=i.source;n&&tL[i.type]&&a.add(n)}this._coordsAscending={},this._rttFingerprints={};for(let i of a){let a=e.tileManagers[i];if(!a)continue;this._coordsAscending[i]={};let r=this._coordsAscending[i],s=a.getSource(),o=s instanceof LT?s.terrainTileRanges:null;for(let e of a.getVisibleCoordinates()){let t=this.terrain.tileManager.getTerrainCoords(e,o);for(let e in t)r[e]||=[],r[e].push(t[e])}this._rttFingerprints[i]={};let l=this._rttFingerprints[i],c=a.getState().revision;for(let e in r)l[e]=new eL(r[e],c,t,n)}this.needsFollowUpFrame=!1;let r=i||this.painter.options.moving,s=!1;for(let e of this._renderableTiles){let t=this._textureDifference(e);"none"!==t&&("zoom"===t&&r||"visibleLayers"===t&&i?this.needsFollowUpFrame=!0:"zoom"===t||"sourceTiles"===t?(s?this.needsFollowUpFrame=!0:e.releaseRTT(this.painter),s=!0):e.releaseRTT(this.painter))}}_textureDifference(e){let t="none";for(let i in this._rttFingerprints){let n=this._rttFingerprints[i][e.tileID.key];if(!n)continue;let a=n.difference(e.rttFingerprint[i]);$R.indexOf(a)>$R.indexOf(t)&&(t=a)}return t}renderLayer(e,t){if(e.isHidden(this.painter.transform.zoom))return!1;let i={...t,isRenderingToTexture:!0},n=e.type,a=this.painter,r=this._renderableLayerIds[this._renderableLayerIds.length-1]===e.id;if(tL[n]&&((!this._prevType||!tL[this._prevType])&&this._stacks.push([]),this._prevType=n,this._stacks[this._stacks.length-1].push(e.id),!r))return!0;if(tL[this._prevType]||tL[n]&&r){this._prevType=n;let e=this._stacks.length-1,t=this._stacks[e]||[];for(let n of this._renderableTiles){if(this._rttTiles.push(n),n.getRTT(e))continue;let r=n.acquireRTT(a,e,this.rttSize);a.bindRTT(r),a.context.clear({color:ep.transparent,stencil:0}),a.currentStencilSource=void 0;for(let e of t){let t=a.style._layers[e],r=t.source?this._coordsAscending[t.source][n.tileID.key]:[n.tileID];a.context.viewport.set([0,0,this.rttSize,this.rttSize]),a.renderTileClippingMasks(t,r,!0),a.renderLayer(a,a.style.tileManagers[t.source],t,r,i),t.source&&(n.rttFingerprint[t.source]=this._rttFingerprints[t.source][n.tileID.key])}r.texture.generateMipmap()}return function(e,t,i,n){let{isRenderingGlobe:a}=n,r=e.context,s=r.gl,o=e.transform,l=e.colorModeForRenderPass(),c=e.getDepthModeFor3D(),u=e.useProgram("terrain");r.bindFramebuffer.set(null),r.viewport.set([0,0,e.width,e.height]);for(let n of i){let i=t.getTerrainMesh(n.tileID),h=e.renderToTexture.getTexture(n),d=t.getTerrainData(n.tileID);r.activeTexture.set(s.TEXTURE0),h.bind(s.LINEAR,s.CLAMP_TO_EDGE,s.LINEAR_MIPMAP_LINEAR);let p=t.getSkirtLength(o.zoom),m=o.calculateFogMatrix(n.tileID.toUnwrapped()),g=wI(p,m,e.style.sky,o.pitch,a),f=o.getProjectionData({overscaledTileID:n.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});u.draw(r,s.TRIANGLES,c,iz.disabled,l,az.backCCW,g,d,f,"terrain",i.vertexBuffer,i.indexBuffer,i.segments)}}(this.painter,this.terrain,this._rttTiles,i),this._rttTiles=[],tL[n]}return!1}};const nL={"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":"Drag to rotate map, click to reset 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"},aL={hash:!1,interactive:!0,bearingSnap:7,zoomSnap:0,attributionControl:XR,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:Vh.MAX_TILE_CACHE_ZOOM_LEVELS,transformRequest:null,transformCameraUpdate:null,transformConstrain:null,fadeDuration:300,crossSourceCollisions:!0,clickTolerance:3,localIdeographFontFamily:"sans-serif",pitchWithRotate:!0,rollEnabled:!1,rotateSpeed:.8,pitchSpeed:-.5,reduceMotion:void 0,validateStyle:!0,maxCanvasSize:[4096,4096],cancelPendingTileRequestsWhileZooming:!0,centerClampedToGround:!0,terrainSkirtLength:"auto",zoomLevelsToOverscale:4,anisotropicFilterPitch:20};var rL=class extends id{get _ownerWindow(){return this._container?.ownerDocument?.defaultView||window}constructor(e){super(),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new JR,this._controls=[],this._mapId=hh(),this._styleUrl=null,this._missingStyleImageResolver=null,this._lostContextStyle={style:null,images:null},this._contextLost=e=>{if(e.preventDefault(),this._frameRequest&&=(this._frameRequest.abort(),null),this.painter.destroy(),this._lostContextStyle=this._getStyleAndImages(),this.style){for(let e of Object.values(this.style._layers))if("custom"===e.type&&console.warn(`Custom layer with id '${e.id}' cannot be restored after WebGL context loss. You will need to re-add it manually after context restoration.`),e._listeners)for(let[t]of Object.entries(e._listeners))console.warn(`Custom layer with id '${e.id}' had event listeners for event '${t}' which cannot be restored after WebGL context loss. You will need to re-add them manually after context restoration.`);this.style.destroy(),this.style=null,this.fire(new fC("webglcontextlost",{originalEvent:e}))}else this.fire(new fC("webglcontextlost",{originalEvent:e}))},this._contextRestored=e=>{if(this._lostContextStyle.style&&this.setStyle(this._lostContextStyle.style,{diff:!1}),this._lostContextStyle.images&&this.style){this.style.imageManager.images=this._lostContextStyle.images;for(let e in this._lostContextStyle.images){let t=this._lostContextStyle.images[e];t.isWebGLImage&&this.style.imageManager.updateImage(e,t,!1)}}this._lostContextStyle={style:null,images:null};try{this._setupPainter()}catch(e){return void this.fire(new td(e))}this.resize(),this._update(),this._resizeInternal(),this.fire(new fC("webglcontextrestored",{originalEvent:e}))},this._onMapScroll=e=>{if(e.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()};let t={...aL,...e,canvasContextAttributes:{...aL.canvasContextAttributes,...e.canvasContextAttributes}};if(null!=t.minZoom&&null!=t.maxZoom&&t.minZoom>t.maxZoom)throw Error("maxZoom must be greater than or equal to minZoom");if(null!=t.minPitch&&null!=t.maxPitch&&t.minPitch>t.maxPitch)throw Error("maxPitch must be greater than or equal to minPitch");if(null!=t.minPitch&&t.minPitch<0)throw Error("minPitch must be greater than or equal to 0");if(null!=t.maxPitch&&t.maxPitch>180)throw Error("maxPitch must be less than or equal to 180");this._camera=new KR({minZoom:t.minZoom,maxZoom:t.maxZoom,minPitch:t.minPitch,maxPitch:t.maxPitch,bearingSnap:t.bearingSnap,zoomSnap:t.zoomSnap,renderWorldCopies:t.renderWorldCopies,centerClampedToGround:t.centerClampedToGround,terrain:this.terrain,transformConstrain:t.transformConstrain,requestRenderFrame:e=>this._requestRenderFrame(e),cancelRenderFrame:e=>this._cancelRenderFrame(e),transformCameraUpdate:t.transformCameraUpdate,stopHandlers:()=>this._handlers?.stop(!1)}),this._camera.setEventedParent(this),this._interactive=t.interactive,this._maxTileCacheSize=t.maxTileCacheSize,this._maxTileCacheZoomLevels=t.maxTileCacheZoomLevels,this._canvasContextAttributes={...t.canvasContextAttributes},this._trackResize=!0===t.trackResize,this._terrainSkirtLength=t.terrainSkirtLength,this._refreshExpiredTiles=!0===t.refreshExpiredTiles,this._fadeDuration=t.fadeDuration,this._crossSourceCollisions=!0===t.crossSourceCollisions,this._collectResourceTiming=!0===t.collectResourceTiming,this._locale={...nL,...t.locale},this._clickTolerance=t.clickTolerance,this._overridePixelRatio=t.pixelRatio,this._maxCanvasSize=t.maxCanvasSize,this._zoomLevelsToOverscale=t.zoomLevelsToOverscale,this.cancelPendingTileRequestsWhileZooming=!0===t.cancelPendingTileRequestsWhileZooming,this.setAnisotropicFilterPitch(t.anisotropicFilterPitch),void 0!==t.reduceMotion&&($M.prefersReducedMotion=t.reduceMotion),this._requestManager=new aC(t.transformRequest),this._container=this._resolveContainer(t.container),t.maxBounds&&this.setMaxBounds(t.maxBounds),this._setupContainer();try{this._setupPainter()}catch(e){throw this._cleanupContainer(),e}this._imageQueueHandle=nC.addThrottleControl(()=>this.isMoving()),this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this.on("terrain",()=>{this.painter.terrainFacilitator.depthDirty=!0,this._update(!0)}),this.once("idle",()=>this._idleTriggered=!0),this._handlers=new ZR(this,this._camera,t),typeof window<"u"&&(this._ownerWindow.addEventListener("online",this._onWindowOnline,!1),this._setupResizeObserver());let i="string"==typeof t.hash&&t.hash||void 0;this._hash=t.hash?new $z(i).addTo(this):void 0,this._hash?._onHashChange()||(this.jumpTo({center:t.center,elevation:t.elevation,zoom:t.zoom,bearing:t.bearing,pitch:t.pitch,roll:t.roll}),t.bounds&&(this.resize(),this.fitBounds(t.bounds,lh({},t.fitBoundsOptions,{duration:0}))));let n="string"==typeof t.style||"globe"!==t.style?.projection?.type;this.resize(null,n),this._localIdeographFontFamily=t.localIdeographFontFamily,this._validateStyle=t.validateStyle,t.style&&this.setStyle(t.style,{localIdeographFontFamily:t.localIdeographFontFamily}),t.attributionControl&&this.addControl(new QR("boolean"==typeof t.attributionControl?void 0:t.attributionControl)),t.maplibreLogo&&this.addControl(new YR,t.logoPosition),this.on("style.load",()=>{if(n||this._resizeTransform(),this._camera.transform.unmodified){let e=ch(this.style.stylesheet,["center","zoom","bearing","pitch","roll"]);this.jumpTo(e)}}),this.on("data",e=>{this._update("style"===e.dataType),this.fire("style"===e.dataType?new lC("styledata",e):new cC("sourcedata",e))}),this.on("dataloading",e=>{this.fire("style"===e.dataType?new lC("styledataloading",e):new cC("sourcedataloading",e))}),this.on("dataabort",e=>{this.fire(new cC("sourcedataabort",e))})}_getMapId(){return this._mapId}setGlobalStateProperty(e,t){return this.style.setGlobalStateProperty(e,t),this._update(!0)}getGlobalState(){return this.style.getGlobalState()}addControl(e,t){if(void 0===t&&(t=e.getDefaultPosition?e.getDefaultPosition():"top-right"),!e?.onAdd)return this.fire(new td(Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));let i=e.onAdd(this);this._controls.push(e);let n=this._controlPositions[t];return t.includes("bottom")?n.insertBefore(i,n.firstChild):n.appendChild(i),this}removeControl(e){if(!e?.onRemove)return this.fire(new td(Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));let t=this._controls.indexOf(e);return t>-1&&this._controls.splice(t,1),e.onRemove(this),this}hasControl(e){return this._controls.includes(e)}coveringTiles(e){return iD(this._camera.transform,e)}setTransformCameraUpdate(e){this._camera.transformCameraUpdate=e}getCenter(){return new Ex(this._camera.transform.center.lng,this._camera.transform.center.lat)}setCenter(e,t){return this._camera.setCenter(e,t),this}getCenterElevation(){return this._camera.transform.elevation}setCenterElevation(e,t){return this._camera.setCenterElevation(e,t),this}setCenterClampedToGround(e){this._camera.setCenterClampedToGround(e)}panBy(e,t,i){return this._camera.panBy(e,t,i),this}panTo(e,t,i){return this._camera.panTo(e,t,i),this}getZoom(){return this._camera.transform.zoom}setZoom(e,t){return this._camera.setZoom(e,t),this}zoomTo(e,t,i){return this._camera.zoomTo(e,t,i),this}zoomIn(e,t){return this._camera.zoomIn(e,t),this}zoomOut(e,t){return this._camera.zoomOut(e,t),this}getVerticalFieldOfView(){return this._camera.transform.fov}setVerticalFieldOfView(e,t){return this._camera.setVerticalFieldOfView(e,t),this}getBearing(){return this._camera.transform.bearing}setBearing(e,t){return this._camera.setBearing(e,t),this}getZoomSnap(){return this._camera.getZoomSnap()}setZoomSnap(e){return this._camera.setZoomSnap(e),this}getPadding(){return this._camera.transform.padding}setPadding(e,t){return this._camera.setPadding(e,t),this}rotateTo(e,t,i){return this._camera.rotateTo(e,t,i),this}resetNorth(e,t){return this._camera.resetNorth(e,t),this}resetNorthPitch(e,t){return this._camera.resetNorthPitch(e,t),this}snapToNorth(e,t){return this._camera.snapToNorth(e,t),this}getPitch(){return this._camera.transform.pitch}setPitch(e,t){return this._camera.setPitch(e,t),this}getRoll(){return this._camera.transform.roll}setRoll(e,t){return this._camera.setRoll(e,t),this}cameraForBounds(e,t){return this._camera.cameraForBounds(e,t)}fitBounds(e,t,i){return this._camera.fitBounds(e,t,i),this}fitScreenCoordinates(e,t,i,n,a){return this._camera.fitScreenCoordinates(e,t,i,n,a),this}jumpTo(e,t){return this._camera.jumpTo(e,t),this}calculateCameraOptionsFromCameraLngLatAltRotation(e,t,i,n,a){return this._camera.calculateCameraOptionsFromCameraLngLatAltRotation(e,t,i,n,a)}easeTo(e,t){return this._camera.easeTo(e,t),this}flyTo(e,t){return this._camera.flyTo(e,t),this}stop(){return this._camera.stop(),this}queryTerrainElevation(e){return this.terrain?this.terrain.getElevationForLngLat(Ex.convert(e),this._camera.transform):null}getCenterClampedToGround(){return this._camera.getCenterClampedToGround()}calculateCameraOptionsFromTo(e,t,i,n){return null==n&&this.terrain&&(n=this.terrain.getElevationForLngLat(i,this._camera.transform)),this._camera.transform.calculateCameraOptionsFromTo(e,t,i,n??0)}resize(e,t=!0){if(null!==this._lostContextStyle.style)return this;this._resizeInternal(t);let i=!this._camera._moving;return i&&(this.stop(),this.fire(new sC("movestart",e)).fire(new sC("move",e))),this.fire(new rC("resize",e)),i&&this.fire(new sC("moveend",e)),this}_resizeInternal(e=!0){let[t,i]=this._containerDimensions(),n=this._getClampedPixelRatio(t,i);if(this._resizeCanvas(t,i,n),this.painter.resize(t,i,n),this.painter.overLimit()){let e=this.painter.context.gl;this._maxCanvasSize=[e.drawingBufferWidth,e.drawingBufferHeight];let n=this._getClampedPixelRatio(t,i);this._resizeCanvas(t,i,n),this.painter.resize(t,i,n)}this._resizeTransform(e)}_resizeTransform(e=!0){let[t,i]=this._containerDimensions();this._camera.transform.resize(t,i,e),this._camera._requestedCameraState?.resize(t,i,e)}_getClampedPixelRatio(e,t){let{0:i,1:n}=this._maxCanvasSize,a=this.getPixelRatio(),r=e*a,s=t*a,o=r>i?i/r:1,l=s>n?n/s:1,c=Math.min(o,l);return c<1&&yh("The canvas is larger than maxCanvasSize and is rendered at a lower pixel ratio to fit. Increase maxCanvasSize, within MAX_TEXTURE_SIZE, to render at full resolution."),c*a}getPixelRatio(){return this._overridePixelRatio??devicePixelRatio}setPixelRatio(e){this._overridePixelRatio=e,this.resize()}getBounds(){return this._camera.transform.getBounds()}getMaxBounds(){return this._camera.transform.getMaxBounds()}setMaxBounds(e){return this._camera.transform.setMaxBounds(gT.convert(e)),this._update()}setMinZoom(e){if(e??=-2,e>=-2&&e<=this._camera.transform.maxZoom){let t=this._camera.transform.zoom,i=this._camera.getTransformForUpdate();return i.setMinZoom(e),this._camera.applyUpdatedTransform(i),this._update(),t!==this._camera.transform.zoom&&this.fire(new sC("zoomstart")).fire(new sC("zoom")).fire(new sC("zoomend")).fire(new sC("movestart")).fire(new sC("move")).fire(new sC("moveend")),this}throw Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(e=!1){let t=this._camera.transform;return e?t.applyConstrain(t.center,t.minZoom).zoom:t.minZoom}setMaxZoom(e){if(e??=22,e>=this._camera.transform.minZoom){let t=this._camera.transform.zoom,i=this._camera.getTransformForUpdate();return i.setMaxZoom(e),this._camera.applyUpdatedTransform(i),this._update(),t!==this._camera.transform.zoom&&this.fire(new sC("zoomstart")).fire(new sC("zoom")).fire(new sC("zoomend")).fire(new sC("movestart")).fire(new sC("move")).fire(new sC("moveend")),this}throw Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this._camera.transform.maxZoom}setMinPitch(e){if(e??=0,e<0)throw Error("minPitch must be greater than or equal to 0");if(e>=0&&e<=this._camera.transform.maxPitch){let t=this._camera.transform.pitch,i=this._camera.getTransformForUpdate();return i.setMinPitch(e),this._camera.applyUpdatedTransform(i),this._update(),t!==this._camera.transform.pitch&&this.fire(new sC("pitchstart")).fire(new sC("pitch")).fire(new sC("pitchend")).fire(new sC("movestart")).fire(new sC("move")).fire(new sC("moveend")),this}throw Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this._camera.transform.minPitch}setMaxPitch(e){if(e??=60,e>180)throw Error("maxPitch must be less than or equal to 180");if(e>=this._camera.transform.minPitch){let t=this._camera.transform.pitch,i=this._camera.getTransformForUpdate();return i.setMaxPitch(e),this._camera.applyUpdatedTransform(i),this._update(),t!==this._camera.transform.pitch&&this.fire(new sC("pitchstart")).fire(new sC("pitch")).fire(new sC("pitchend")).fire(new sC("movestart")).fire(new sC("move")).fire(new sC("moveend")),this}throw Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this._camera.transform.maxPitch}getAnisotropicFilterPitch(){return this._anisotropicFilterPitch}setAnisotropicFilterPitch(e){if(e??=20,e>180)throw Error("anisotropicFilterPitch must be less than or equal to 180");if(e<0)throw Error("anisotropicFilterPitch must be greater than or equal to 0");return this._anisotropicFilterPitch=e,this._update()}getRenderWorldCopies(){return this._camera.transform.renderWorldCopies}setRenderWorldCopies(e){return this._camera.transform.setRenderWorldCopies(e),this._update()}setTransformConstrain(e){return this._camera.transform.setConstrainOverride(e),this._update()}project(e){return this._camera.transform.locationToScreenPoint(Ex.convert(e),this.style&&this.terrain)}unproject(e){return this._camera.transform.screenPointToLocation(Hc.convert(e),this.terrain)}isMoving(){return this._camera.isMoving()||this._handlers?.isMoving()||!1}isZooming(){return this._camera.isZooming()||this._handlers?.isZooming()||!1}isRotating(){return this._camera.isRotating()||this._handlers?.isRotating()||!1}_createDelegatedListener(e,t,i){if("mouseenter"===e||"mouseover"===e){let n=!1;return{layers:t,listener:i,delegates:{mousemove:a=>{let r=t.filter(e=>this.getLayer(e)),s=0===r.length?[]:this.queryRenderedFeatures(a.point,{layers:r});s.length?n||(n=!0,i.call(this,new uC(e,this,a.originalEvent,{features:s}))):n=!1},mouseout:()=>{n=!1}}}}if("mouseleave"===e||"mouseout"===e){let n=!1;return{layers:t,listener:i,delegates:{mousemove:a=>{let r=t.filter(e=>this.getLayer(e));(0===r.length?[]:this.queryRenderedFeatures(a.point,{layers:r})).length?n=!0:n&&(n=!1,i.call(this,new uC(e,this,a.originalEvent)))},mouseout:t=>{n&&(n=!1,i.call(this,new uC(e,this,t.originalEvent)))}}}}{let n=e=>{let n=t.filter(e=>this.getLayer(e)),a=0===n.length?[]:this.queryRenderedFeatures(e.point,{layers:n});a.length&&(e.features=a,i.call(this,e),delete e.features)};return{layers:t,listener:i,delegates:{[e]:n}}}}_saveDelegatedListener(e,t){this._delegatedListeners||={},this._delegatedListeners[e]||=[],this._delegatedListeners[e].push(t)}_removeDelegatedListener(e,t,i){if(!this._delegatedListeners?.[e])return;let n=this._delegatedListeners[e];for(let e=0;e<n.length;e++){let a=n[e];if(a.listener===i&&a.layers.length===t.length&&a.layers.every(e=>t.includes(e))){for(let e in a.delegates)this.off(e,a.delegates[e]);return void n.splice(e,1)}}}on(e,t,i){if(void 0===i)return super.on(e,t);let n="string"==typeof t?[t]:t,a=this._createDelegatedListener(e,n,i);this._saveDelegatedListener(e,a);for(let e in a.delegates)this.on(e,a.delegates[e]);return{unsubscribe:()=>{this._removeDelegatedListener(e,n,i)}}}once(e,t,i){if(void 0===i)return super.once(e,t);let n="string"==typeof t?[t]:t,a=this._createDelegatedListener(e,n,i);for(let t in a.delegates){let r=a.delegates[t];a.delegates[t]=(...t)=>{this._removeDelegatedListener(e,n,i),r(...t)}}this._saveDelegatedListener(e,a);for(let e in a.delegates)this.once(e,a.delegates[e]);return this}off(e,t,i){if(void 0===i)return super.off(e,t);let n="string"==typeof t?[t]:t;return this._removeDelegatedListener(e,n,i),this}queryRenderedFeatures(e,t){if(!this.style)return[];let i,n=e instanceof Hc||Array.isArray(e),a=n?e:[[0,0],[this._camera.transform.width,this._camera.transform.height]];if(t||=(n?{}:e)||{},a instanceof Hc||"number"==typeof a[0])i=[Hc.convert(a)];else{let e=Hc.convert(a[0]),t=Hc.convert(a[1]);i=[e,new Hc(t.x,e.y),t,new Hc(e.x,t.y),e]}return this.style.queryRenderedFeatures(i,t,this._camera.transform)}querySourceFeatures(e,t){return this.style.querySourceFeatures(e,t)}setStyle(e,t){return t=lh({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},t),this._styleUrl="string"==typeof e?e:null,!1!==t.diff&&t.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&e?(this._diffStyle(e,t),this):(this._localIdeographFontFamily=t.localIdeographFontFamily,this._updateStyle(e,t))}setTransformRequest(e){return this._requestManager.setTransformRequest(e),this}_getUIString(e){let t=this._locale[e];if(null==t)throw Error(`Missing UI string '${e}'`);return t}_updateStyle(e,t){if(this._diffStyleRequest?.abort(),this._diffStyleRequest=null,t.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",()=>this._updateStyle(e,t));let i=this.style&&t.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!e)),e?(this.style=new yI(this,t||{}),this.style.setEventedParent(this,{style:this.style}),"string"==typeof e?this.style.loadURL(e,t,i):this.style.loadJSON(e,t,i),this):(this._frameRequest&&=(this._frameRequest.abort(),null),this.style?.projection?.destroy(),delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new yI(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}async _diffStyle(e,t){if(this._diffStyleRequest?.abort(),"string"==typeof e){let i=e;this._diffStyleRequest=new AbortController;let n=this._diffStyleRequest;try{let e=await this._requestManager.transformRequest(i,"Style");if(n.signal.aborted)return void(this._diffStyleRequest=null);let a=await Xh(e,n);this._diffStyleRequest=null,this._updateDiff(a.data,t)}catch(e){this._diffStyleRequest=null,Nh(e)||this.fire(new td(ju(e)))}}else"object"==typeof e&&(this._diffStyleRequest=null,this._updateDiff(e,t))}_updateDiff(e,t){try{this.style.setState(e,t)&&this._update(!0)}catch(i){yh(`Unable to perform style diff: ${ju(i).message}. Rebuilding the style from scratch.`),this._updateStyle(e,t)}}getStyle(){if(this.style)return this.style.serialize()}getStyleUrl(){return this._styleUrl}_getStyleAndImages(){return this.style?{style:this.style.serialize(),images:this.style.imageManager.cloneImages()}:{style:null,images:{}}}isStyleLoaded(){if(this.style)return this.style.loaded();yh("There is no style added to the map.")}addSource(e,t){return this._lazyInitEmptyStyle(),this.style.addSource(e,t),this._update(!0)}isSourceLoaded(e){let t=this.style?.tileManagers[e];if(void 0!==t)return t.loaded();this.fire(new td(Error(`There is no tile manager with ID '${e}'`)))}setTerrain(e,t={}){if(this.style._checkLoaded(),e&&Bf(this,Ff.terrain,{value:e},t))return this;if(this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),e){let t=this.style.tileManagers[e.source];if(!t)throw Error(`cannot load terrain, because there exists no source with ID: ${e.source}`);null===this.terrain&&t.reload();for(let t in this.style._layers){let i=this.style._layers[t];"hillshade"===i.type&&i.source===e.source&&yh("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===e.source&&yh("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&&this.terrain.destroy(),this.terrain=new DP(this.painter,t,e,this._terrainSkirtLength),this.painter.renderToTexture=new iL(this.painter,this.terrain),this._camera.terrain=this.terrain,this._camera.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._camera.transform.center,this._camera.transform.tileZoom)),this._camera.transform.setElevation(this.terrain.getElevationForLngLat(this._camera.transform.center,this._camera.transform)),this._terrainDataCallback=t=>this._handleTerrainDataEvent(t,e.source),this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.destroy(),this.terrain=null,this.painter.renderToTexture=null,this._camera.terrain=null,this._camera.transform.setMinElevationForCurrentTile(0),this.getCenterClampedToGround()&&this._camera.transform.setElevation(0);return this.style.triggerSymbolPlacement(),this.fire(new mC({terrain:e})),this}_handleTerrainDataEvent(e,t){if("style"===e.dataType)return void this.terrain.tileManager.releaseAllRTT();let i=e.sourceId===t;if(i&&(this.terrain.resetElevationCache(),this.style.triggerSymbolPlacement()),i&&e.tile&&!this._camera.elevationFreeze&&(this._camera.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._camera.transform.center,this._camera.transform.tileZoom)),this.getCenterClampedToGround()&&this._camera.transform.setElevation(this.terrain.getElevationForLngLat(this._camera.transform.center,this._camera.transform))),e.tile){if("image"===e.source?.type)return void this.terrain.tileManager.releaseAllRTT();this.terrain.tileManager.releaseRTT(e.tile.tileID)}}getTerrain(){return this.terrain?.options??null}areTilesLoaded(){let e=this.style?.tileManagers;for(let t of Object.values(e))if(!t.areTilesLoaded())return!1;return!0}removeSource(e){return this.style.removeSource(e),this._update(!0)}getSource(e){return this.style?.getSource(e)}setSourceTileLodParams(e,t,i){if(i){let n=this.getSource(i);if(!n)throw Error(`There is no source with ID "${i}", cannot set LOD parameters`);n.calculateTileZoom=$T(Math.max(1,e),Math.max(1,t))}else for(let i in this.style.tileManagers)this.style.tileManagers[i].getSource().calculateTileZoom=$T(Math.max(1,e),Math.max(1,t));return this._update(!0),this}refreshTiles(e,t){let i=this.style.tileManagers[e];if(!i)throw Error(`There is no tile manager with ID "${e}", cannot refresh tile`);void 0===t?i.reload(!0):i.refreshTiles(t.map(e=>new qE(e.z,e.x,e.y)))}addImage(e,t,i={}){this._lazyInitEmptyStyle();let n=this._createStyleImage(t,i);return n?(this.style.addImage(e,n),n.userImage?.onAdd&&n.userImage.onAdd(this,e),this):this}setMissingStyleImageResolver(e){return this._missingStyleImageResolver=e,this.style?.setMissingImageResolver(e),this}_createStyleImage(e,t={}){let{pixelRatio:i=1,sdf:n=!1,stretchX:a,stretchY:r,content:s,textFitWidth:o,textFitHeight:l}=t;if(e instanceof HTMLImageElement||Eh(e)){let{width:t,height:c,data:u}=$M.getImageData(e);return{data:new Hv({width:t,height:c},u),pixelRatio:i,stretchX:a,stretchY:r,content:s,textFitWidth:o,textFitHeight:l,sdf:n,version:0}}if(void 0===e.width||void 0===e.height)return this.fire(new td(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`"))),null;{let{width:t,height:c,data:u}=e,h=e,d=Aw(h.data);return{data:d?new Hv({width:t,height:c}):new Hv({width:t,height:c},new Uint8Array(u)),pixelRatio:i,stretchX:a,stretchY:r,content:s,textFitWidth:o,textFitHeight:l,sdf:n,version:0,isWebGLImage:d,userImage:h}}}updateImage(e,t){let i=this.style.getImage(e);if(!i)return this.fire(new td(Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));let{width:n,height:a,data:r}=t instanceof HTMLImageElement||Eh(t)?$M.getImageData(t):t;if(void 0===n||void 0===a)return this.fire(new td(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(n!==i.data.width||a!==i.data.height)return this.fire(new td(Error("The width and height of the updated image must be that same as the previous version of the image")));if(i.isWebGLImage=Aw(r),i.isWebGLImage)i.userImage=t;else{let e=!(t instanceof HTMLImageElement||Eh(t));i.data.replace(r,e)}return this.style.updateImage(e,i),this}getImage(e){return this.style.getImage(e)}hasImage(e){return e?!!this.style.getImage(e):(this.fire(new td(Error("Missing required image id"))),!1)}removeImage(e){this.style.removeImage(e)}async loadImage(e){let t=await nC.getImage(await this._requestManager.transformRequest(e,"Image"),new AbortController);if(!t.data)throw Error(`Could not load image ${e}: the response is empty`);return t}listImages(){return this.style?.listImages()??[]}addLayer(e,t){return this._lazyInitEmptyStyle(),this.style.addLayer(e,t),this._update(!0)}moveLayer(e,t){return this.style.moveLayer(e,t),this._update(!0)}removeLayer(e){return this.style.removeLayer(e),this._update(!0)}getLayer(e){return this.style?.getLayer(e)}getLayersOrder(){return this.style?.getLayersOrder()??[]}setLayerZoomRange(e,t,i){return this.style.setLayerZoomRange(e,t,i),this._update(!0)}setFilter(e,t,i={}){return this.style?.setFilter(e,t,i),this._update(!0)}getFilter(e){return this.style.getFilter(e)}setPaintProperty(e,t,i,n={}){return this.style?.setPaintProperty(e,t,i,n),this._update(!0)}getPaintProperty(e,t){return this.style.getPaintProperty(e,t)}setLayoutProperty(e,t,i,n={}){return this.style.setLayoutProperty(e,t,i,n),this._update(!0)}getLayoutProperty(e,t){return this.style.getLayoutProperty(e,t)}setGlyphs(e,t={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(e,t),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}setFontFaces(e){return this._lazyInitEmptyStyle(),this.style.setFontFaces(e),this._update(!0)}getFontFaces(){return this.style.getFontFaces()}addSprite(e,t,i={}){return this._lazyInitEmptyStyle(),this.style.addSprite(e,t,i,e=>{e||this._update(!0)}),this}removeSprite(e){return this._lazyInitEmptyStyle(),this.style.removeSprite(e),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(e,t={}){return this._lazyInitEmptyStyle(),this.style.setSprite(e,t,e=>{e||this._update(!0)}),this}setLight(e,t={}){return this._lazyInitEmptyStyle(),this.style.setLight(e,t),this._update(!0)}getLight(){return this.style.getLight()}setSky(e,t={}){return this._lazyInitEmptyStyle(),this.style.setSky(e,t),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(e,t){return this.style.setFeatureState(e,t),this._update()}removeFeatureState(e,t){return this.style.removeFeatureState(e,t),this._update()}getFeatureState(e){return this.style.getFeatureState(e)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let e=0,t=0;return this._container&&(e=this._container.clientWidth||400,t=this._container.clientHeight||300),[e,t]}_shouldHandleInitialResize(){if(!this._container?.clientWidth||!this._container.clientHeight)return!1;let[e,t]=this._containerDimensions();return e!==this._camera.transform.width||t!==this._camera.transform.height}_setupResizeObserver(){let e=!1,t=Jz(e=>{this._trackResize&&!this._removed&&(this.resize(e),this.redraw())},50),i=this._ownerWindow.ResizeObserver??ResizeObserver;this._resizeObserver=new i(i=>{!e&&(e=!0,!this._shouldHandleInitialResize())||t(i)}),this._resizeObserver.observe(this._container)}_resolveContainer(e){if("string"==typeof e){let t=document.getElementById(e);if(!t)throw Error(`Container '${e}' not found.`);return t}if(e instanceof HTMLElement||e&&"object"==typeof e&&1===e.nodeType)return e;throw Error("Invalid type: 'container' must be a String or HTMLElement.")}_setupContainer(){let e=this._container;e.classList.add("maplibregl-map");let t=this._canvasContainer=iC.create("div","maplibregl-canvas-container",e);this._interactive&&t.classList.add("maplibregl-interactive"),this._canvas=iC.create("canvas","maplibregl-canvas",t),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");let i=this._containerDimensions(),n=this._getClampedPixelRatio(i[0],i[1]);this._resizeCanvas(i[0],i[1],n);let a=this._controlContainer=iC.create("div","maplibregl-control-container",e),r=this._controlPositions={};for(let e of["top-left","top-right","bottom-left","bottom-right"])r[e]=iC.create("div",`maplibregl-ctrl-${e} `,a);this._container.addEventListener("scroll",this._onMapScroll,!1)}_cleanupContainer(){this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),this._canvasContainer.remove(),this._controlContainer.remove(),this._container.removeEventListener("scroll",this._onMapScroll,!1),this._container.classList.remove("maplibregl-map")}_resizeCanvas(e,t,i){this._canvas.width=Math.floor(i*e),this._canvas.height=Math.floor(i*t),this._canvas.style.width=`${e}px`,this._canvas.style.height=`${t}px`}_setupPainter(){let e={...this._canvasContextAttributes,alpha:!0,depth:!0,stencil:!0,premultipliedAlpha:!0},t=null;this._canvas.addEventListener("webglcontextcreationerror",e=>{t=e},{once:!0});let i=this._canvas.getContext("webgl2",e);if(!i)throw new Yz(e,t);this.painter=new Qz(i,this._camera.transform)}migrateProjection(e,t){this._camera.migrateProjection(e,t),this.painter.transform=e,this.fire(new gC({newProjection:this.style.projection.name}))}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(e){return this.style?._loaded?(this._styleDirty||=e,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(e){return this._update(),this._renderTaskQueue.add(e)}_cancelRenderFrame(e){this._renderTaskQueue.remove(e)}_render(e){let t=this._idleTriggered?this._fadeDuration:0,i=this.style.projection?.transitionState>0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(e),this._removed)return;let n=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;let e=this._camera.transform.zoom,i=tC();this.style.zoomHistory.update(e,i);let a=new Zf(e,{now:i,fadeDuration:t,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),r=a.crossFadingFactor();(1!==r||r!==this._crossFadingFactor)&&(n=!0,this._crossFadingFactor=r),this.style.update(a)}let a=this.style.projection?.transitionState>0!==i;this._camera.transform.setTransitionState(this.style.projection?.transitionState),this.style&&(this._sourcesDirty||a)&&(this._sourcesDirty=!1,this.style._updateSources(this._camera.transform)),this.terrain?(this.terrain.tileManager.update(this._camera.transform,this.terrain)&&this.terrain.resetElevationCache(),this._camera.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._camera.transform.center,this._camera.transform.tileZoom)),!this._camera.elevationFreeze&&this.getCenterClampedToGround()&&this._camera.transform.setElevation(this.terrain.getElevationForLngLat(this._camera.transform.center,this._camera.transform))):(this._camera.transform.setMinElevationForCurrentTile(0),this.getCenterClampedToGround()&&this._camera.transform.setElevation(0)),this._placementDirty=this.style?._updatePlacement(this._camera.transform,this.showCollisionBoxes,t,this._crossSourceCollisions,a),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:t,showPadding:this.showPadding,anisotropicFilterPitch:this.getAnisotropicFilterPitch()}),this.fire(new rC("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,this.fire(new rC("load"))),this.style&&(this.style.hasTransitions()||n)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();let r=this._sourcesDirty||this._styleDirty||this._placementDirty||this.painter.renderToTexture?.needsFollowUpFrame;return r||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new rC("idle")),this._loaded&&!this._fullyLoaded&&!r&&(this._fullyLoaded=!0),this}redraw(){return this.style&&(this._frameRequest&&=(this._frameRequest.abort(),null),this._render(0)),this}remove(){this._hash&&this._hash.remove();for(let e of this._controls)e.onRemove(this);this._controls=[],this._frameRequest&&=(this._frameRequest.abort(),null),this._renderTaskQueue.clear(),this._diffStyleRequest?.abort(),this.painter.destroy(),this._handlers.destroy(),this.setStyle(null),typeof window<"u"&&this._ownerWindow.removeEventListener("online",this._onWindowOnline,!1),nC.removeThrottleControl(this._imageQueueHandle),this._resizeObserver?.disconnect();let e=this.painter.context.gl.getExtension("WEBGL_lose_context");e?.loseContext&&e.loseContext(),this._cleanupContainer(),this._removed=!0,this.fire(new rC("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,$M.frame(this._frameRequest,e=>{this._frameRequest=null;try{this._render(e)}catch(e){if(!Nh(e))throw e}},()=>{},this._ownerWindow))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(e){this._showTileBoundaries!==e&&(this._showTileBoundaries=e,this._update())}get showPadding(){return!!this._showPadding}set showPadding(e){this._showPadding!==e&&(this._showPadding=e,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(e){this._showCollisionBoxes!==e&&(this._showCollisionBoxes=e,e?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(e){this._showOverdrawInspector!==e&&(this._showOverdrawInspector=e,this._update())}get repaint(){return!!this._repaint}set repaint(e){this._repaint!==e&&(this._repaint=e,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(e){this._vertices=e,this._update()}get version(){return"6.9.0"}getCameraTargetElevation(){return this._camera.transform.elevation}getProjection(){return this.style.getProjection()}setProjection(e){return this._lazyInitEmptyStyle(),this.style.setProjection(e),this._update(!0)}};const sL={showCompass:!0,showZoom:!0,visualizePitch:!1,visualizeRoll:!0};var oL=class{constructor(e){this._updateZoomButtons=()=>{let e=this._map.getZoom(),t=e===this._map.getMaxZoom(),i=e===this._map.getMinZoom(!0);this._zoomInButton.disabled=t,this._zoomOutButton.disabled=i,this._zoomInButton.setAttribute("aria-disabled",t.toString()),this._zoomOutButton.setAttribute("aria-disabled",i.toString())},this._rotateCompassArrow=()=>{let e=this._map.getPitch(),t=this._map.getRoll(),i=this._map.getBearing(),n=1/Math.cos(Mh(e))**.5;this.options.visualizePitch&&this.options.visualizeRoll?this._compassIcon.style.transform=`scale(${n}) rotateZ(${-t}deg) rotateX(${e}deg) rotateZ(${-i}deg)`:this.options.visualizePitch?this._compassIcon.style.transform=`scale(${n}) rotateX(${e}deg) rotateZ(${-i}deg)`:this.options.visualizeRoll?this._compassIcon.style.transform=`rotate(${-i-t}deg)`:this._compassIcon.style.transform=`rotate(${-i}deg)`},this._setButtonTitle=(e,t)=>{let i=this._map._getUIString(`NavigationControl.${t}`);e.title=i,e.setAttribute("aria-label",i)},this.options=lh({},sL,e),this._container=iC.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",e=>e.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",e=>this._map.zoomIn({},{originalEvent:e})),iC.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",e=>this._map.zoomOut({},{originalEvent:e})),iC.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",e=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:e}):this._map.resetNorth({},{originalEvent:e})}),this._compassIcon=iC.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(e){return this._map=e,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("move",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 lL(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){this._container.remove(),this.options.showZoom&&this._map.off("move",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(e,t){let i=iC.create("button",e,this._container);return i.type="button",i.addEventListener("click",t),i}},lL=class{constructor(e,t,i=!1){this.mousedown=e=>{this.startMove(e,iC.mousePos(this.element,e)),window.addEventListener("mousemove",this.mousemove),window.addEventListener("mouseup",this.mouseup)},this.mousemove=e=>{this.move(e,iC.mousePos(this.element,e))},this.mouseup=e=>{this._rotatePitchHandler.dragEnd(e),this.offTemp()},this.touchstart=e=>{1===e.targetTouches.length?(this._startPos=this._lastPos=iC.touchPos(this.element,e.targetTouches)[0],this.startMove(e,this._startPos),window.addEventListener("touchmove",this.touchmove,{passive:!1}),window.addEventListener("touchend",this.touchend)):this.reset()},this.touchmove=e=>{1===e.targetTouches.length?(this._lastPos=iC.touchPos(this.element,e.targetTouches)[0],this.move(e,this._lastPos)):this.reset()},this.touchend=e=>{0===e.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=t;let n=new yR;this._rotatePitchHandler=new fR({clickTolerance:3,move:(e,n)=>{let a=t.getBoundingClientRect(),r=new Hc((a.bottom-a.top)/2,(a.right-a.left)/2);return{bearingDelta:Dh(new Hc(e.x,n.y),n,r),pitchDelta:i?-.5*(n.y-e.y):void 0}},moveStateManager:n,enable:!0,assignEvents:()=>{}}),this.map=e,t.addEventListener("mousedown",this.mousedown),t.addEventListener("touchstart",this.touchstart,{passive:!1}),t.addEventListener("touchcancel",this.reset)}startMove(e,t){this._rotatePitchHandler.dragStart(e,t),iC.disableDrag()}move(e,t){let i=this.map,{bearingDelta:n,pitchDelta:a}=this._rotatePitchHandler.dragMove(e,t)||{};n&&i.setBearing(i.getBearing()+n),a&&i.setPitch(i.getPitch()+a)}off(){let e=this.element;e.removeEventListener("mousedown",this.mousedown),e.removeEventListener("touchstart",this.touchstart),window.removeEventListener("touchmove",this.touchmove),window.removeEventListener("touchend",this.touchend),e.removeEventListener("touchcancel",this.reset),this.offTemp()}offTemp(){iC.enableDrag(),window.removeEventListener("mousemove",this.mousemove),window.removeEventListener("mouseup",this.mouseup),window.removeEventListener("touchmove",this.touchmove),window.removeEventListener("touchend",this.touchend)}};let cL;function uL(e,t,i,n=!1){if(n||!i.getCoveringTilesDetailsProvider().allowWorldCopies())return e?.wrap();let a=new Ex(e.lng,e.lat);if(e=new Ex(e.lng,e.lat),t){let n=new Ex(e.lng-360,e.lat),a=new Ex(e.lng+360,e.lat),r=i.locationToScreenPoint(e).distSqr(t);i.locationToScreenPoint(n).distSqr(t)<r?e=n:i.locationToScreenPoint(a).distSqr(t)<r&&(e=a)}for(;Math.abs(e.lng-i.center.lng)>180;){let t=i.locationToScreenPoint(e);if(t.x>=0&&t.y>=0&&t.x<=i.width&&t.y<=i.height)break;e.lng>i.center.lng?e.lng-=360:e.lng+=360}return e.lng!==a.lng&&i.isPointOnMapSurface(i.locationToScreenPoint(e))?e:a}const hL={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 dL(e,t,i){let n=e.classList;for(let e in hL)n.remove(`maplibregl-${i}-anchor-${e}`);n.add(`maplibregl-${i}-anchor-${t}`)}const pL={ArrowLeft:[-1,0],ArrowRight:[1,0],ArrowUp:[0,-1],ArrowDown:[0,1]},mL="#3FB1CE";function gL(e,t,i=[]){let n=iC.createNS("http://www.w3.org/2000/svg",e);for(let e in t)n.setAttributeNS(null,e,t[e]);for(let e of i)n.appendChild(e);return n}let fL;var AL=class extends ed{},_L=class extends ed{},vL=class extends id{constructor(e){if(super(),this._onClick=e=>{this.fire(new _L("click",{originalEvent:e}))},this._onKeyPress=e=>{("Space"===e.code||"Enter"===e.code)&&this.togglePopup()},this._onKeyDown=e=>{if(!this._defaultMarker||!this._draggable||!this._map||!this._lngLat||e.composedPath()[0]!==this._element||e.altKey||e.ctrlKey||e.metaKey)return;let t=pL[e.key];if(!t)return;e.preventDefault(),e.stopPropagation();let i=e.shiftKey?10:1,n=this._map.project(this._lngLat);this.setLngLat(this._map.unproject(new Hc(n.x+t[0]*i,n.y+t[1]*i))),this._keyboardDragActive||(this._keyboardDragActive=!0,this.fire(new AL("dragstart"))),this.fire(new AL("drag"))},this._onKeyUp=e=>{pL[e.key]&&this._endKeyboardDrag()},this._onBlur=()=>{this._endKeyboardDrag()},this._onMapClick=e=>{let t=e.originalEvent.target,i=this._element;this._popup&&(t===i||i.contains(t))&&this.togglePopup()},this._update=e=>{if(!this._map)return;let t=this._map.loaded()&&!this._map.isMoving();("terrain"===e?.type||"render"===e?.type&&!t)&&this._map.once("render",this._update),this._lngLat=uL(this._lngLat,this._flatPos,this._map._camera.transform),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map._camera.transform.locationToScreenPoint(this._lngLat)._add(this._offset));let i="";"viewport"===this._rotationAlignment||"auto"===this._rotationAlignment?i=`rotateZ(${this._rotation}deg)`:"map"===this._rotationAlignment&&(i=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let n="";"viewport"===this._pitchAlignment||"auto"===this._pitchAlignment?n="rotateX(0deg)":"map"===this._pitchAlignment&&(n=`rotateX(${this._map.getPitch()}deg)`),!this._subpixelPositioning&&(!e||"moveend"===e.type)&&(this._pos=this._pos.round()),this._element.style.transform=`${hL[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${n} ${i}`,$M.frameAsync(new AbortController,this._map._ownerWindow).then(()=>{this._updateOpacity("moveend"===e?.type)}).catch(()=>{})},this._onMove=e=>{if(!this._isDragging){let t=this._clickTolerance||this._map._clickTolerance;this._isDragging=e.point.dist(this._pointerdownPos)>=t}this._isDragging&&(this._pos=e.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none","pending"===this._state&&(this._state="active",this.fire(new AL("dragstart"))),this.fire(new AL("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 AL("dragend")),this._state="inactive"},this._addDragHandler=e=>{this._element.contains(e.originalEvent.target)&&(e.preventDefault(),this._positionDelta=e.point.sub(this._pos).add(this._offset),this._pointerdownPos=e.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},this._anchor=e?.anchor||"center",this._color=e?.color||mL,this._scale=e?.scale||1,this._draggable=e?.draggable||!1,this._clickTolerance=e?.clickTolerance||0,this._subpixelPositioning=e?.subpixelPositioning||!1,this._isDragging=!1,this._roleManaged=!1,this._tabIndexManaged=!1,this._keyboardDragActive=!1,this._state="inactive",this._rotation=e?.rotation||0,this._rotationAlignment=e?.rotationAlignment||"auto",this._pitchAlignment=e?.pitchAlignment&&"auto"!==e.pitchAlignment?e.pitchAlignment:this._rotationAlignment,this.setOpacity(e?.opacity,e?.opacityWhenCovered),e?.element)this._element=e.element,this._offset=Hc.convert(e?.offset||[0,0]);else{this._defaultMarker=!0,this._element=iC.create("div");let t=(fL||(fL=gL("svg",{display:"block",height:"41px",width:"27px",viewBox:"0 0 27 41"},[gL("g",{"fill-rule":"nonzero"},[gL("g",{transform:"translate(3.0, 29.0)",fill:"#000000"},[["10.5","5.25002273"],["10.5","5.25002273"],["9.5","4.77275007"],["8.5","4.29549936"],["7.5","3.81822308"],["6.5","3.34094679"],["5.5","2.86367051"],["4.5","2.38636864"]].map(([e,t])=>gL("ellipse",{opacity:"0.04",cx:"10.5",cy:"5.80029008",rx:e,ry:t}))),gL("g",{fill:mL},[gL("path",{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"})]),gL("g",{opacity:"0.25",fill:"#000000"},[gL("path",{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"})]),gL("g",{transform:"translate(6.0, 7.0)",fill:"#FFFFFF"}),gL("g",{transform:"translate(8.0, 8.0)"},[gL("circle",{fill:"#000000",opacity:"0.25",cx:"5.5",cy:"5.5",r:"5.4999962"}),gL("circle",{fill:"#FFFFFF",cx:"5.5",cy:"5.5",r:"5.4999962"})])])]),fL)).cloneNode(!0);t.setAttributeNS(null,"height",41*this._scale+"px"),t.setAttributeNS(null,"width",27*this._scale+"px"),function(e){return e.firstElementChild.children[1]}(t).setAttributeNS(null,"fill",this._color),this._element.appendChild(t),this._offset=Hc.convert(e?.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",e=>{e.preventDefault()}),this._element.addEventListener("mousedown",e=>{e.preventDefault()}),dL(this._element,this._anchor,"marker"),e?.className)for(let t of e.className.split(" "))this._element.classList.add(t);this._popup=null}addTo(e){return this.remove(),this._map=e,this._defaultMarker&&!this._element.hasAttribute("aria-label")&&this._element.setAttribute("aria-label",e._getUIString("Marker.Title")),this._updateAccessibilityRole(),e.getCanvasContainer().appendChild(this._element),e.on("move",this._update),e.on("moveend",this._update),e.on("terrain",this._update),e.on("projectiontransition",this._update),this._element.addEventListener("click",this._onClick),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),this._element.removeEventListener("click",this._onClick),this._element.removeEventListener("keydown",this._onKeyDown),this._element.removeEventListener("keyup",this._onKeyUp),this._element.removeEventListener("blur",this._onBlur),this._element.removeEventListener("keypress",this._onKeyPress),this._keyboardDragActive=!1,this._element.remove(),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=Ex.convert(e),this._pos=null,this._update(),this._popup&&this._popup.setLngLat(this._lngLat),this}getElement(){return this._element}setPopup(e){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress)),e){if(!("offset"in e.options)){let t=13.5/Math.SQRT2;e.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[t,-1*(24.6+t)],"bottom-right":[-t,-1*(24.6+t)],left:[13.5,-24.6],right:[-13.5,-24.6]}:this._offset}this._popup=e,this._element.addEventListener("keypress",this._onKeyPress)}return this._updateTabIndex(),this._updateAccessibilityRole(),this}setSubpixelPositioning(e){return this._subpixelPositioning=e,this}_endKeyboardDrag(){this._keyboardDragActive&&(this._keyboardDragActive=!1,this.fire(new AL("dragend")))}getPopup(){return this._popup}togglePopup(){let e=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:e?(e.isOpen()?e.remove():(e.setLngLat(this._lngLat),e.addTo(this._map)),this):this}_updateOpacity(e=!1){let t=this._map?.terrain,i=this._map._camera.transform.isLocationOccluded(this._lngLat);if(!t||i){let e=i?this._opacityWhenCovered:this._opacity;return void(this._element.style.opacity!==e&&(this._element.style.opacity=e,this._element.classList.toggle("maplibregl-marker-covered",i)))}if(e)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}let n=this._map,a=n.terrain.depthAtPoint(this._pos),r=n.terrain.getElevationForLngLat(this._lngLat,n._camera.transform);if(n._camera.transform.lngLatToCameraDepth(this._lngLat,r)-a<.006)return this._element.style.opacity=this._opacity,void this._element.classList.remove("maplibregl-marker-covered");let s=-this._offset.y/n._camera.transform.pixelsPerMeter,o=Math.sin(n.getPitch()*Math.PI/180)*s,l=n.terrain.depthAtPoint(new Hc(this._pos.x,this._pos.y-this._offset.y)),c=n._camera.transform.lngLatToCameraDepth(this._lngLat,r+o)-l>.006;this._popup?.isOpen()&&c&&this._popup.remove(),this._element.style.opacity=c?this._opacityWhenCovered:this._opacity,this._element.classList.toggle("maplibregl-marker-covered",c)}getOffset(){return this._offset}setOffset(e){return this._offset=Hc.convert(e),this._update(),this}addClassName(e){this._element.classList.add(e)}removeClassName(e){this._element.classList.remove(e)}toggleClassName(e){return this._element.classList.toggle(e)}setDraggable(e){return this._draggable=!!e,this._element.classList.toggle("maplibregl-marker-draggable",this._draggable),this._map&&(e?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this._defaultMarker&&(this._draggable?(this._element.addEventListener("keydown",this._onKeyDown),this._element.addEventListener("keyup",this._onKeyUp),this._element.addEventListener("blur",this._onBlur)):(this._element.removeEventListener("keydown",this._onKeyDown),this._element.removeEventListener("keyup",this._onKeyUp),this._element.removeEventListener("blur",this._onBlur),this._endKeyboardDrag())),this._updateTabIndex(),this._updateAccessibilityRole(),this}isDraggable(){return this._draggable}_updateTabIndex(){this._popup||this._defaultMarker&&this._draggable?this._element.hasAttribute("tabindex")||(this._element.setAttribute("tabindex","0"),this._tabIndexManaged=!0):this._tabIndexManaged&&=("0"===this._element.getAttribute("tabindex")&&this._element.removeAttribute("tabindex"),!1)}_updateAccessibilityRole(){if(!this._defaultMarker||this._element.hasAttribute("role")&&!this._roleManaged)return;let e=this._draggable||this._popup?"button":"img";this._element.setAttribute("role",e),this._roleManaged=!0}setRotation(e){return this._rotation=e||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(e){return this._rotationAlignment=e||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(e){return this._pitchAlignment=e&&"auto"!==e?e:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(e,t){return(void 0===this._opacity||void 0===e&&void 0===t)&&(this._opacity="1",this._opacityWhenCovered="0.2"),void 0!==e&&(this._opacity=String(e)),void 0!==t&&(this._opacityWhenCovered=String(t)),this._map&&this._updateOpacity(!0),this}};const yL={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let xL=0,bL=!1;var wL=class extends ed{},EL=class extends ed{},kL=class extends ed{},SL=class extends id{constructor(e){super(),this._onSuccess=e=>{if(this._map){if(this._isOutOfMapMaxBounds(e))return this._setErrorState(),this.fire(new EL("outofmaxbounds",e)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=e,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&"OFF"!==this._watchState&&this._updateMarker(e),(!this.options.trackUserLocation||"ACTIVE_LOCK"===this._watchState)&&this._updateCamera(e),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new EL("geolocate",e)),this._finish()}},this._updateCamera=e=>{let t=new Ex(e.coords.longitude,e.coords.latitude),i=e.coords.accuracy,n=lh({bearing:this._map.getBearing()},this.options.fitBoundsOptions),a=gT.fromLngLat(t,i);this._map.fitBounds(a,n,{geolocateSource:!0})},this._updateMarker=e=>{if(e){let t=new Ex(e.coords.longitude,e.coords.latitude);this._accuracyCircleMarker.setLngLat(t).addTo(this._map),this._userLocationDotMarker.setLngLat(t).addTo(this._map),this._accuracy=e.coords.accuracy,this._updateCircleRadiusIfNeeded()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onUpdate=()=>{this._updateCircleRadiusIfNeeded()},this._onError=e=>{if(this._map){if(1===e.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;let e=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=e,this._geolocateButton.setAttribute("aria-label",e),void 0!==this._geolocationWatchID&&this._clearWatch()}else{if(3===e.code&&bL)return;this._setErrorState()}"OFF"!==this._watchState&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new kL("error",e)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._onMoveStart=e=>{if(!this._map)return;let t=e?.[0]instanceof ResizeObserverEntry;!e.geolocateSource&&"ACTIVE_LOCK"===this._watchState&&!t&&!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 wL("trackuserlocationend")),this.fire(new wL("userlocationlostfocus")))},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",e=>{e.preventDefault()}),this._geolocateButton=iC.create("button","maplibregl-ctrl-geolocate",this._container),iC.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",this._geolocateButton.disabled=!0)},this._finishSetupUI=e=>{if(this._map){if(!1===e){yh("Geolocation support is not available so the GeolocateControl will be disabled.");let e=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=e,this._geolocateButton.setAttribute("aria-label",e)}else{let e=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=e,this._geolocateButton.setAttribute("aria-label",e)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=iC.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new vL({element:this._dotElement}),this._circleElement=iC.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new vL({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onUpdate),this._map.on("move",this._onUpdate),this._map.on("rotate",this._onUpdate),this._map.on("pitch",this._onUpdate)),this._geolocateButton.addEventListener("click",()=>this.trigger()),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",this._onMoveStart)}},this.options=lh({},yL,e)}onAdd(e){return this._map=e,this._container=iC.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),async function(e=!1){if(void 0!==cL&&!e)return cL;if(void 0===window.navigator.permissions)return cL=!!window.navigator.geolocation,cL;try{cL="denied"!==(await window.navigator.permissions.query({name:"geolocation"})).state}catch{cL=!!window.navigator.geolocation}return cL}().then(e=>this._finishSetupUI(e)),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(),this._container.remove(),this._map.off("movestart",this._onMoveStart),this._map.off("zoom",this._onUpdate),this._map.off("move",this._onUpdate),this._map.off("rotate",this._onUpdate),this._map.off("pitch",this._onUpdate),this._map=void 0,xL=0,bL=!1}_isOutOfMapMaxBounds(e){let t=this._map.getMaxBounds(),i=e.coords;return t&&(i.longitude<t.getWest()||i.longitude>t.getEast()||i.latitude<t.getSouth()||i.latitude>t.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":case"BACKGROUND_ERROR":case"OFF":case void 0:break;default:throw Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadiusIfNeeded(){let e=this._userLocationDotMarker.getLngLat();if(!(this.options.showUserLocation&&this.options.showAccuracyCircle&&this._accuracy&&e))return;let t=this._map.project(e),i=this._map.unproject([t.x+100,t.y]),n=e.distanceTo(i)/100,a=2*this._accuracy/n;this._circleElement.style.width=`${a.toFixed(2)}px`,this._circleElement.style.height=`${a.toFixed(2)}px`}trigger(){if(!this._setup)return yh("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 wL("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":xL--,bL=!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 wL("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 wL("trackuserlocationstart")),this.fire(new wL("userlocationfocus"));break;default:throw 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 Error(`Unexpected watchState ${this._watchState}`)}if("OFF"===this._watchState&&void 0!==this._geolocationWatchID)this._clearWatch();else if(void 0===this._geolocationWatchID){let e;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),xL++,xL>1?(e={maximumAge:6e5,timeout:0},bL=!0):(e=this.options.positionOptions,bL=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,e)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}};const ML={maxWidth:100,unit:"metric"};var CL=class{constructor(e){this._onMove=()=>{TL(this._map,this._container,this.options)},this.setUnit=e=>{this.options.unit=e,TL(this._map,this._container,this.options)},this.options={...ML,...e}}getDefaultPosition(){return"bottom-left"}onAdd(e){return this._map=e,this._container=iC.create("div","maplibregl-ctrl maplibregl-ctrl-scale",e.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){this._container.remove(),this._map.off("move",this._onMove),this._map=void 0}};function TL(e,t,i){let n=i?.maxWidth||100,a=e._container.clientHeight/2,r=e._container.clientWidth/2,s=e.unproject([r-n/2,a]),o=e.unproject([r+n/2,a]),l=Math.round(e.project(o).x-e.project(s).x),c=Math.min(n,l,e._container.clientWidth),u=s.distanceTo(o);if("imperial"===i?.unit){let i=3.2808*u;i>5280?DL(t,c,i/5280,e._getUIString("ScaleControl.Miles")):DL(t,c,i,e._getUIString("ScaleControl.Feet"))}else"nautical"===i?.unit?DL(t,c,u/1852,e._getUIString("ScaleControl.NauticalMiles")):u>=1e3?DL(t,c,u/1e3,e._getUIString("ScaleControl.Kilometers")):DL(t,c,u,e._getUIString("ScaleControl.Meters"))}function DL(e,t,i,n){let a=function(e){let t=10**(`${Math.floor(e)}`.length-1),i=e/t;return i=i>=10?10:i>=5?5:i>=3?3:i>=2?2:i>=1?1:function(e){let t=10**Math.ceil(-Math.log(e)/Math.LN10);return Math.round(e*t)/t}(i),t*i}(i),r=a/i;e.style.width=t*r+"px",e.innerHTML=`${a} ${n}`}const PL={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1,locationOccludedOpacity:void 0,padding:void 0},IL=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");var FL=class extends ed{},zL=class extends id{constructor(e){super(),this._updateOpacity=()=>{void 0!==this.options.locationOccludedOpacity&&(this._map._camera.transform.isLocationOccluded(this.getLngLat())?this._container.style.opacity=`${this.options.locationOccludedOpacity}`:this._container.style.opacity="")},this.remove=()=>(this._content&&this._content.remove(),this._container&&(this._container.remove(),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("terrain",this._update),this._map.off("projectiontransition",this._update),this._map.off("mousemove",this._update),this._map.off("mouseup",this._update),this._map.off("drag",this._update),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new FL("close"))),this),this._update=e=>{let t,i=this._lngLat||this._trackPointer;if(!this._map||!i||!this._content)return;if(!this._container){if(this._container=iC.create("div","maplibregl-popup",this._map.getContainer()),this._tip=iC.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(let e of this.options.className.split(" "))this._container.classList.add(e);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=uL(this._lngLat,this._flatPos,this._map._camera.transform,this._trackPointer),e&&"point"in e&&e.point&&(t=e.point),this._trackPointer&&!t)return;let n=this._flatPos=this._pos=this._trackPointer&&t?t:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&t?t:this._map._camera.transform.locationToScreenPoint(this._lngLat));let a=this.options.anchor,r=RL(this.options.offset);if(!a){let e,t=this._container.offsetWidth,i=this._container.offsetHeight,s=function(e){return e?{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}:{top:0,right:0,bottom:0,left:0}}(this.options.padding);e=n.y+r.bottom.y<i+s.top?["top"]:n.y>this._map._camera.transform.height-i-s.bottom?["bottom"]:[],n.x<t/2+s.left?e.push("left"):n.x>this._map._camera.transform.width-t/2-s.right&&e.push("right"),a=0===e.length?"bottom":e.join("-")}let s=n.add(r[a]);this.options.subpixelPositioning||(s=s.round()),this._container.style.transform=`${hL[a]} translate(${s.x}px,${s.y}px)`,dL(this._container,a,"popup"),this._updateOpacity()},this._onClose=()=>{this.remove()},this.options=lh(Object.create(PL),e)}addTo(e){return this._map&&this.remove(),this._map=e,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._map.on("terrain",this._update),this._map.on("projectiontransition",this._update),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._update),this._map.on("mouseup",this._update),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 FL("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=Ex.convert(e),this._pos=null,this._flatPos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._update),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._update),this._map.on("drag",this._update),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(e){return this.setDOMContent(document.createTextNode(e))}setHTML(e){let t,i=document.createDocumentFragment(),n=document.createElement("body");for(n.innerHTML=e;t=n.firstChild,t;)i.appendChild(t);return this.setDOMContent(i)}getMaxWidth(){return this._container?.style.maxWidth}setMaxWidth(e){return this.options.maxWidth=e,this._update(),this}setDOMContent(e){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=iC.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(e),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(e){return this._container&&this._container.classList.add(e),this}removeClassName(e){return this._container&&this._container.classList.remove(e),this}setOffset(e){return this.options.offset=e,this._update(),this}toggleClassName(e){if(this._container)return this._container.classList.toggle(e)}setSubpixelPositioning(e){this.options.subpixelPositioning=e}setPadding(e){this.options.padding=e,this._update()}_createCloseButton(){this.options.closeButton&&(this._closeButton=iC.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;let e=this._container.querySelector(IL);e&&e.focus()}};function RL(e){if(!e)return RL(new Hc(0,0));if("number"==typeof e){let t=Math.round(Math.abs(e)/Math.SQRT2);return{center:new Hc(0,0),top:new Hc(0,e),"top-left":new Hc(t,t),"top-right":new Hc(-t,t),bottom:new Hc(0,-e),"bottom-left":new Hc(t,-t),"bottom-right":new Hc(-t,-t),left:new Hc(e,0),right:new Hc(-e,0)}}if(e instanceof Hc||Array.isArray(e)){let t=Hc.convert(e);return{center:t,top:t,"top-left":t,"top-right":t,bottom:t,"bottom-left":t,"bottom-right":t,left:t,right:t}}return{center:Hc.convert(e.center||[0,0]),top:Hc.convert(e.top||[0,0]),"top-left":Hc.convert(e["top-left"]||[0,0]),"top-right":Hc.convert(e["top-right"]||[0,0]),bottom:Hc.convert(e.bottom||[0,0]),"bottom-left":Hc.convert(e["bottom-left"]||[0,0]),"bottom-right":Hc.convert(e["bottom-right"]||[0,0]),left:Hc.convert(e.left||[0,0]),right:Hc.convert(e.right||[0,0])}}var LL=Uint8Array,BL=Uint16Array,OL=Int32Array,UL=new LL([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]),NL=new LL([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]),jL=new LL([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),VL=function(e,t){for(var i=new BL(31),n=0;n<31;++n)i[n]=t+=1<<e[n-1];var a=new OL(i[30]);for(n=1;n<30;++n)for(var r=i[n];r<i[n+1];++r)a[r]=r-i[n]<<5|n;return{b:i,r:a}},qL=VL(UL,2),GL=qL.b,HL=qL.r;GL[28]=258,HL[258]=28;for(var WL=VL(NL,0).b,ZL=new BL(32768),KL=0;KL<32768;++KL){var XL=(43690&KL)>>1|(21845&KL)<<1;XL=(61680&(XL=(52428&XL)>>2|(13107&XL)<<2))>>4|(3855&XL)<<4,ZL[KL]=((65280&XL)>>8|(255&XL)<<8)>>1}var QL=function(e,t,i){for(var n=e.length,a=0,r=new BL(t);a<n;++a)e[a]&&++r[e[a]-1];var s,o=new BL(t);for(a=1;a<t;++a)o[a]=o[a-1]+r[a-1]<<1;if(i){s=new BL(1<<t);var l=15-t;for(a=0;a<n;++a)if(e[a])for(var c=a<<4|e[a],u=t-e[a],h=o[e[a]-1]++<<u,d=h|(1<<u)-1;h<=d;++h)s[ZL[h]>>l]=c}else for(s=new BL(n),a=0;a<n;++a)e[a]&&(s[a]=ZL[o[e[a]-1]++]>>15-e[a]);return s},YL=new LL(288);for(KL=0;KL<144;++KL)YL[KL]=8;for(KL=144;KL<256;++KL)YL[KL]=9;for(KL=256;KL<280;++KL)YL[KL]=7;for(KL=280;KL<288;++KL)YL[KL]=8;var JL=new LL(32);for(KL=0;KL<32;++KL)JL[KL]=5;var $L=QL(YL,9,1),eB=QL(JL,5,1),tB=function(e){for(var t=e[0],i=1;i<e.length;++i)e[i]>t&&(t=e[i]);return t},iB=function(e,t,i){var n=t/8|0;return(e[n]|e[n+1]<<8)>>(7&t)&i},nB=function(e,t){var i=t/8|0;return(e[i]|e[i+1]<<8|e[i+2]<<16)>>(7&t)},aB=function(e){return(e+7)/8|0},rB=["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"],sB=function(e,t,i){var n=new Error(t||rB[e]);if(n.code=e,Error.captureStackTrace&&Error.captureStackTrace(n,sB),!i)throw n;return n},oB=function(e,t,i,n){var a=e.length;if(!a||t.f&&!t.l)return i||new LL(0);var r=!i,s=r||2!=t.i,o=t.i;r&&(i=new LL(3*a));var l=function(e){var t=i.length;if(e>t){var n=new LL(Math.max(2*t,e));n.set(i),i=n}},c=t.f||0,u=t.p||0,h=t.b||0,d=t.l,p=t.d,m=t.m,g=t.n,f=8*a;do{if(!d){c=iB(e,u,1);var A=iB(e,u+1,3);if(u+=3,!A){var _=e[(T=aB(u)+4)-4]|e[T-3]<<8,v=T+_;if(v>a){o&&sB(0);break}s&&l(h+_),i.set(e.subarray(T,v),h),t.b=h+=_,t.p=u=8*v,t.f=c;continue}if(1==A)d=$L,p=eB,m=9,g=5;else if(2==A){var y=iB(e,u,31)+257,x=iB(e,u+10,15)+4,b=y+iB(e,u+5,31)+1;u+=14;for(var w=new LL(b),E=new LL(19),k=0;k<x;++k)E[jL[k]]=iB(e,u+3*k,7);u+=3*x;var S=tB(E),M=(1<<S)-1,C=QL(E,S,1);for(k=0;k<b;){var T,D=C[iB(e,u,M)];if(u+=15&D,(T=D>>4)<16)w[k++]=T;else{var P=0,I=0;for(16==T?(I=3+iB(e,u,3),u+=2,P=w[k-1]):17==T?(I=3+iB(e,u,7),u+=3):18==T&&(I=11+iB(e,u,127),u+=7);I--;)w[k++]=P}}var F=w.subarray(0,y),z=w.subarray(y);m=tB(F),g=tB(z),d=QL(F,m,1),p=QL(z,g,1)}else sB(1);if(u>f){o&&sB(0);break}}s&&l(h+131072);for(var R=(1<<m)-1,L=(1<<g)-1,B=u;;B=u){var O=(P=d[nB(e,u)&R])>>4;if((u+=15&P)>f){o&&sB(0);break}if(P||sB(2),O<256)i[h++]=O;else{if(256==O){B=u,d=null;break}var U=O-254;if(O>264){var N=UL[k=O-257];U=iB(e,u,(1<<N)-1)+GL[k],u+=N}var j=p[nB(e,u)&L],V=j>>4;j||sB(3),u+=15&j;z=WL[V];if(V>3){N=NL[V];z+=nB(e,u)&(1<<N)-1,u+=N}if(u>f){o&&sB(0);break}s&&l(h+131072);var q=h+U;if(h<z){var G=0-z,H=Math.min(z,q);for(G+h<0&&sB(3);h<H;++h)i[h]=n[G+h]}for(;h<q;++h)i[h]=i[h-z]}}t.l=d,t.p=B,t.b=h,t.f=c,d&&(c=1,t.m=m,t.d=p,t.n=g)}while(!c);return h!=i.length&&r?function(e,t,i){return(null==i||i>e.length)&&(i=e.length),new LL(e.subarray(t,i))}(i,0,h):i.subarray(0,h)},lB=new LL(0);function cB(e,t){var i=function(e){31==e[0]&&139==e[1]&&8==e[2]||sB(6,"invalid gzip data");var t=e[3],i=10;4&t&&(i+=2+(e[10]|e[11]<<8));for(var n=(t>>3&1)+(t>>4&1);n>0;n-=!e[i++]);return i+(2&t)}(e);return i+8>e.length&&sB(6,"invalid gzip data"),oB(e.subarray(i,-8),{i:2},new LL(function(e){var t=e.length;return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}(e)),t)}function uB(e,t){return oB(e.subarray(function(e){return(8!=(15&e[0])||e[0]>>4>7||(e[0]<<8|e[1])%31)&&sB(6,"invalid zlib data"),1==(e[1]>>5&1)&&sB(6,"invalid zlib data: "+(32&e[1]?"need":"unexpected")+" dictionary"),2+(e[1]>>3&4)}(e),-4),{i:2},t,t)}function hB(e,t){return 31==e[0]&&139==e[1]&&8==e[2]?cB(e,t):8!=(15&e[0])||e[0]>>4>7||(e[0]<<8|e[1])%31?function(e,t){return oB(e,{i:2},t,t)}(e,t):uB(e,t)}var dB="undefined"!=typeof TextDecoder&&new TextDecoder;try{dB.decode(lB,{stream:!0})}catch(y2){}var pB=Object.defineProperty,mB=Math.pow,gB=(e,t)=>pB(e,"name",{value:t,configurable:!0}),fB=(e,t,i)=>new Promise((n,a)=>{var r=e=>{try{o(i.next(e))}catch(e){a(e)}},s=e=>{try{o(i.throw(e))}catch(e){a(e)}},o=e=>e.done?n(e.value):Promise.resolve(e.value).then(r,s);o((i=i.apply(e,t)).next())});gB((e,t)=>{let i=!1,n="",a=L.GridLayer.extend({createTile:gB((t,a)=>{let r=document.createElement("img"),s=new AbortController,o=s.signal;return r.cancel=()=>{s.abort()},i||(e.getHeader().then(e=>{1===e.tileType||6===e.tileType?console.error("Error: archive contains vector tiles, but leafletRasterLayer is for displaying raster tiles. See https://github.com/protomaps/PMTiles/tree/main/js for details."):2===e.tileType?n="image/png":3===e.tileType?n="image/jpeg":4===e.tileType?n="image/webp":5===e.tileType&&(n="image/avif")}),i=!0),e.getZxy(t.z,t.x,t.y,o).then(e=>{if(e){let t=new Blob([e.data],{type:n}),i=window.URL.createObjectURL(t);r.src=i}else r.style.display="none";r.cancel=void 0,a(void 0,r)}).catch(e=>{if("AbortError"!==e.name)throw e}),r},"createTile"),_removeTile:gB(function(e){let t=this._tiles[e];t&&(t.el.cancel&&t.el.cancel(),t.el.src&&window.URL.revokeObjectURL(t.el.src),t.el.width=0,t.el.height=0,t.el.deleted=!0,L.DomUtil.remove(t.el),delete this._tiles[e],this.fire("tileunload",{tile:t.el,coords:this._keyToTileCoords(e)}))},"_removeTile")});return new a(t)},"leafletRasterLayer");var AB=gB(e=>(t,i)=>{if(i instanceof AbortController)return e(t,i);let n=new AbortController;return e(t,n).then(e=>i(void 0,e.data,e.cacheControl||"",e.expires||""),e=>i(e)).catch(e=>i(e)),{cancel:gB(()=>n.abort(),"cancel")}},"v3compat"),_B=class{constructor(e){this.tilev4=gB((e,t)=>fB(this,null,function*(){if("json"===e.type){let i=e.url.substr(10),n=this.tiles.get(i);if(n||(n=new qB(i),this.tiles.set(i,n)),this.metadata){let i=yield n.getTileJson(e.url);return t.signal.throwIfAborted(),{data:i}}let a=yield n.getHeader();return t.signal.throwIfAborted(),(a.minLon>=a.maxLon||a.minLat>=a.maxLat)&&console.error(`Bounds of PMTiles archive ${a.minLon},${a.minLat},${a.maxLon},${a.maxLat} are not valid.`),{data:{tiles:[`${e.url}/{z}/{x}/{y}`],minzoom:a.minZoom,maxzoom:a.maxZoom,bounds:[a.minLon,a.minLat,a.maxLon,a.maxLat]}}}let i=new RegExp(/pmtiles:\/\/(.+)\/(\d+)\/(\d+)\/(\d+)/),n=e.url.match(i);if(!n)throw new Error("Invalid PMTiles protocol URL");let a=n[1],r=this.tiles.get(a);r||(r=new qB(a),this.tiles.set(a,r));let s=n[2],o=n[3],l=n[4],c=yield null==r?void 0:r.getZxy(+s,+o,+l,t.signal);if(t.signal.throwIfAborted(),c)return{data:new Uint8Array(c.data),cacheControl:c.cacheControl,expires:c.expires};let u=yield r.getHeader();if(1===u.tileType||6===u.tileType){if(this.errorOnMissingTile)throw new Error("Tile not found.");return{data:new Uint8Array}}return{data:null}}),"tilev4"),this.tile=AB(this.tilev4),this.tiles=new Map,this.metadata=(null==e?void 0:e.metadata)||!1,this.errorOnMissingTile=(null==e?void 0:e.errorOnMissingTile)||!1}add(e){this.tiles.set(e.source.getKey(),e)}get(e){return this.tiles.get(e)}};gB(_B,"Protocol");var vB=_B;function yB(e,t){return 4294967296*(t>>>0)+(e>>>0)}function xB(e,t){let i=t.buf,n=i[t.pos++],a=(112&n)>>4;if(n<128||(n=i[t.pos++],a|=(127&n)<<3,n<128)||(n=i[t.pos++],a|=(127&n)<<10,n<128)||(n=i[t.pos++],a|=(127&n)<<17,n<128)||(n=i[t.pos++],a|=(127&n)<<24,n<128)||(n=i[t.pos++],a|=(1&n)<<31,n<128))return yB(e,a);throw new Error("Expected varint not more than 10 bytes")}function bB(e){let t=e.buf,i=t[e.pos++],n=127&i;return i<128||(i=t[e.pos++],n|=(127&i)<<7,i<128)||(i=t[e.pos++],n|=(127&i)<<14,i<128)||(i=t[e.pos++],n|=(127&i)<<21,i<128)?n:(i=t[e.pos],n|=(15&i)<<28,xB(n,e))}function wB(e,t,i,n,a){return 0===a?0!==n?[e-1-i,e-1-t]:[i,t]:[t,i]}function EB(e,t,i){if(e>26)throw new Error("Tile zoom level exceeds max safe number limit (26)");if(t>=1<<e||i>=1<<e)throw new Error("tile x/y outside zoom level bounds");let n=((1<<e)*(1<<e)-1)/3,a=e-1,[r,s]=[t,i];for(let e=1<<a;e>0;e>>=1){let t=r&e,i=s&e;n+=(3*t^i)*(1<<a),[r,s]=wB(e,r,s,t,i),a--}return n}function kB(e){let t=3*e+1;return t<4294967296?31-Math.clz32(t):63-Math.clz32(t/4294967296)}gB(yB,"toNum"),gB(xB,"readVarintRemainder"),gB(bB,"readVarint"),gB(wB,"rotate"),gB(EB,"zxyToTileId"),gB(kB,"tileIdToZ"),gB(function(e){let t=kB(e)>>1;if(t>26)throw new Error("Tile zoom level exceeds max safe number limit (26)");let i=e-((1<<t)*(1<<t)-1)/3,n=0,a=0,r=1<<t;for(let e=1;e<r;e<<=1){let t=e&i/2,r=e&(i^t);[n,a]=wB(e,n,a,t,r),i/=2,n+=t,a+=r}return[t,n,a]},"tileIdToZxy");var SB=(e=>(e[e.Unknown=0]="Unknown",e[e.None=1]="None",e[e.Gzip=2]="Gzip",e[e.Brotli=3]="Brotli",e[e.Zstd=4]="Zstd",e))(SB||{});function MB(e,t){return fB(this,null,function*(){if(1===t||0===t)return e;if(2===t){if(void 0===globalThis.DecompressionStream)return hB(new Uint8Array(e));let t=new Response(e).body;if(!t)throw new Error("Failed to read response stream");let i=t.pipeThrough(new globalThis.DecompressionStream("gzip"));return new Response(i).arrayBuffer()}throw new Error("Compression method not supported")})}gB(MB,"defaultDecompress");var CB=(e=>(e[e.Unknown=0]="Unknown",e[e.Mvt=1]="Mvt",e[e.Png=2]="Png",e[e.Jpeg=3]="Jpeg",e[e.Webp=4]="Webp",e[e.Avif=5]="Avif",e[e.Mlt=6]="Mlt",e))(CB||{});function TB(e){return 1===e?".mvt":2===e?".png":3===e?".jpg":4===e?".webp":5===e?".avif":6===e?".mlt":""}gB(TB,"tileTypeExt");function DB(e,t){let i=0,n=e.length-1;for(;i<=n;){let a=n+i>>1,r=t-e[a].tileId;if(r>0)i=a+1;else{if(!(r<0))return e[a];n=a-1}}return n>=0&&(0===e[n].runLength||t-e[n].tileId<e[n].runLength)?e[n]:null}gB(DB,"findTile");gB(class{constructor(e){this.file=e}getKey(){return this.file.name}getBytes(e,t){return fB(this,null,function*(){return{data:yield this.file.slice(e,e+t).arrayBuffer()}})}},"FileSource");var PB=class{constructor(e,t=new Headers,i=void 0){var n,a;this.url=e,this.customHeaders=t,this.credentials=i,this.mustReload=!1;let r="";"navigator"in globalThis&&(r=null!=(a=null==(n=globalThis.navigator)?void 0:n.userAgent)?a:"");let s=r.indexOf("Windows")>-1,o=/Chrome|Chromium|Edg|OPR|Brave/.test(r);this.chromeWindowsNoCache=!1,s&&o&&(this.chromeWindowsNoCache=!0)}getKey(){return this.url}setHeaders(e){this.customHeaders=e}getBytes(e,t,i,n){return fB(this,null,function*(){let a,r;i?r=i:(a=new AbortController,r=a.signal);let s,o=new Headers(this.customHeaders);o.set("range",`bytes=${e}-${e+t-1}`),this.mustReload?s="reload":this.chromeWindowsNoCache&&(s="no-store");let l=yield fetch(this.url,{signal:r,cache:s,headers:o,credentials:this.credentials});if(0===e&&416===l.status){let e=l.headers.get("Content-Range");if(!e||!e.startsWith("bytes */"))throw new Error("Missing content-length on 416 response");let t=+e.substr(8);o.set("range","bytes=0-"+(t-1)),l=yield fetch(this.url,{signal:r,cache:"reload",headers:o,credentials:this.credentials})}let c=l.headers.get("Etag");if(null!=c&&c.startsWith("W/")&&(c=null),416===l.status||n&&c&&c!==n)throw this.mustReload=!0,new BB(`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 new Error(`Bad response code: ${l.status}`);let u=l.headers.get("Content-Length");if(200===l.status&&(!u||+u>t))throw a&&a.abort(),new 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}})}};gB(PB,"FetchSource");var IB=PB;function FB(e,t){let i=e.getUint32(t+4,!0),n=e.getUint32(t+0,!0);return i*mB(2,32)+n}function zB(e,t){let i=new DataView(e),n=i.getUint8(7);if(n>3)throw new Error(`Archive is spec version ${n} but this library supports up to spec version 3`);return{specVersion:n,rootDirectoryOffset:FB(i,8),rootDirectoryLength:FB(i,16),jsonMetadataOffset:FB(i,24),jsonMetadataLength:FB(i,32),leafDirectoryOffset:FB(i,40),leafDirectoryLength:FB(i,48),tileDataOffset:FB(i,56),tileDataLength:FB(i,64),numAddressedTiles:FB(i,72),numTileEntries:FB(i,80),numTileContents:FB(i,88),clustered:1===i.getUint8(96),internalCompression:i.getUint8(97),tileCompression:i.getUint8(98),tileType:i.getUint8(99),minZoom:i.getUint8(100),maxZoom:i.getUint8(101),minLon:i.getInt32(102,!0)/1e7,minLat:i.getInt32(106,!0)/1e7,maxLon:i.getInt32(110,!0)/1e7,maxLat:i.getInt32(114,!0)/1e7,centerZoom:i.getUint8(118),centerLon:i.getInt32(119,!0)/1e7,centerLat:i.getInt32(123,!0)/1e7,etag:t}}function RB(e){let t={buf:new Uint8Array(e),pos:0},i=bB(t),n=[],a=0;for(let e=0;e<i;e++){let e=bB(t);n.push({tileId:a+e,offset:0,length:0,runLength:1}),a+=e}for(let e=0;e<i;e++)n[e].runLength=bB(t);for(let e=0;e<i;e++)n[e].length=bB(t);for(let e=0;e<i;e++){let i=bB(t);n[e].offset=0===i&&e>0?n[e-1].offset+n[e-1].length:i-1}return n}gB(FB,"getUint64"),gB(zB,"bytesToHeader"),gB(RB,"deserializeIndex");var LB=class extends Error{};gB(LB,"EtagMismatch");var BB=LB;function OB(e,t){return fB(this,null,function*(){let i=yield e.getBytes(0,16384);if(19792!==new DataView(i.data).getUint16(0,!0))throw new Error("Wrong magic number for PMTiles archive");let n=zB(i.data.slice(0,127),i.etag),a=i.data.slice(n.rootDirectoryOffset,n.rootDirectoryOffset+n.rootDirectoryLength),r=`${e.getKey()}|${n.etag||""}|${n.rootDirectoryOffset}|${n.rootDirectoryLength}`,s=RB(yield t(a,n.internalCompression));return[n,[r,s.length,s]]})}function UB(e,t,i,n,a,r){return fB(this,null,function*(){let s=yield e.getBytes(i,n,r,a.etag),o=RB(yield t(s.data,a.internalCompression));if(0===o.length)throw new Error("Empty directory is invalid");return o})}gB(OB,"getHeaderAndRoot"),gB(UB,"getDirectory");gB(class{constructor(e=100,t=!0,i=MB){this.cache=new Map,this.maxCacheEntries=e,this.counter=1,this.decompress=i}getHeader(e){return fB(this,null,function*(){let t=e.getKey(),i=this.cache.get(t);if(i)return i.lastUsed=this.counter++,i.data;let n=yield OB(e,this.decompress);return n[1]&&this.cache.set(n[1][0],{lastUsed:this.counter++,data:n[1][2]}),this.cache.set(t,{lastUsed:this.counter++,data:n[0]}),this.prune(),n[0]})}getDirectory(e,t,i,n,a){return fB(this,null,function*(){let r=`${e.getKey()}|${n.etag||""}|${t}|${i}`,s=this.cache.get(r);if(s)return s.lastUsed=this.counter++,s.data;let o=yield UB(e,this.decompress,t,i,n,a);return this.cache.set(r,{lastUsed:this.counter++,data:o}),this.prune(),o})}prune(){if(this.cache.size>this.maxCacheEntries){let e,t=1/0;this.cache.forEach((i,n)=>{i.lastUsed<t&&(t=i.lastUsed,e=n)}),e&&this.cache.delete(e)}}invalidate(e){return fB(this,null,function*(){this.cache.delete(e.getKey())})}},"ResolvedValueCache");var NB=class{constructor(e=100,t=!0,i=MB){this.cache=new Map,this.invalidations=new Map,this.pendingFetches=new Map,this.maxCacheEntries=e,this.counter=1,this.decompress=i}getHeader(e){return fB(this,null,function*(){let t=e.getKey(),i=this.cache.get(t);if(i)return i.lastUsed=this.counter++,yield i.data;let n=new Promise((t,i)=>{OB(e,this.decompress).then(e=>{e[1]&&this.cache.set(e[1][0],{lastUsed:this.counter++,data:Promise.resolve(e[1][2])}),t(e[0]),this.prune()}).catch(e=>{i(e)})});return this.cache.set(t,{lastUsed:this.counter++,data:n}),n})}trackSignal(e,t,i){t.refs++,i.addEventListener("abort",()=>{--t.refs<=0&&this.pendingFetches.get(e)===t&&(t.controller.abort(),this.cache.delete(e),this.pendingFetches.delete(e))},{once:!0})}getDirectory(e,t,i,n,a){return fB(this,null,function*(){let r=`${e.getKey()}|${n.etag||""}|${t}|${i}`,s=this.cache.get(r);if(s){s.lastUsed=this.counter++;let e=this.pendingFetches.get(r);return e&&this.trackSignal(r,e,null!=a?a:(new AbortController).signal),yield s.data}let o=new AbortController,l={controller:o,refs:0};this.trackSignal(r,l,null!=a?a:(new AbortController).signal),this.pendingFetches.set(r,l);let c=new Promise((a,s)=>{UB(e,this.decompress,t,i,n,o.signal).then(e=>{this.pendingFetches.delete(r),a(e),this.prune()}).catch(e=>{s(e)})});return this.cache.set(r,{lastUsed:this.counter++,data:c}),c})}prune(){if(this.cache.size>=this.maxCacheEntries){let e,t=1/0;this.cache.forEach((i,n)=>{i.lastUsed<t&&(t=i.lastUsed,e=n)}),e&&this.cache.delete(e)}}invalidate(e){return fB(this,null,function*(){let t=e.getKey();if(this.invalidations.get(t))return yield this.invalidations.get(t);this.cache.delete(e.getKey());let i=new Promise((i,n)=>{this.getHeader(e).then(e=>{i(),this.invalidations.delete(t)}).catch(e=>{n(e)})});this.invalidations.set(t,i)})}};gB(NB,"SharedPromiseCache");var jB=NB,VB=class{constructor(e,t,i){this.source="string"==typeof e?new IB(e):e,this.decompress=i||MB,this.cache=t||new jB}getHeader(){return fB(this,null,function*(){return yield this.cache.getHeader(this.source)})}getZxyAttempt(e,t,i,n){return fB(this,null,function*(){let a=EB(e,t,i),r=yield this.cache.getHeader(this.source);if(null==n||n.throwIfAborted(),e<r.minZoom||e>r.maxZoom)return;let s=r.rootDirectoryOffset,o=r.rootDirectoryLength;for(let e=0;e<=3;e++){let e=yield this.cache.getDirectory(this.source,s,o,r,n);null==n||n.throwIfAborted();let t=DB(e,a);if(!t)return;if(t.runLength>0){let e=yield this.source.getBytes(r.tileDataOffset+t.offset,t.length,n,r.etag);return{data:yield this.decompress(e.data,r.tileCompression),cacheControl:e.cacheControl,expires:e.expires}}s=r.leafDirectoryOffset+t.offset,o=t.length}throw new Error("Maximum directory depth exceeded")})}getZxy(e,t,i,n){return fB(this,null,function*(){try{return yield this.getZxyAttempt(e,t,i,n)}catch(a){if(a instanceof BB)return this.cache.invalidate(this.source),yield this.getZxyAttempt(e,t,i,n);throw a}})}getMetadataAttempt(){return fB(this,null,function*(){let e=yield this.cache.getHeader(this.source),t=yield this.source.getBytes(e.jsonMetadataOffset,e.jsonMetadataLength,void 0,e.etag),i=yield this.decompress(t.data,e.internalCompression),n=new TextDecoder("utf-8");return JSON.parse(n.decode(i))})}getMetadata(){return fB(this,null,function*(){try{return yield this.getMetadataAttempt()}catch(e){if(e instanceof BB)return this.cache.invalidate(this.source),yield this.getMetadataAttempt();throw e}})}getTileJson(e){return fB(this,null,function*(){let t=yield this.getHeader(),i=yield this.getMetadata(),n=TB(t.tileType);return{tilejson:"3.0.0",scheme:"xyz",tiles:[`${e}/{z}/{x}/{y}${n}`],vector_layers:i.vector_layers,attribution:i.attribution,description:i.description,name:i.name,version:i.version,bounds:[t.minLon,t.minLat,t.maxLon,t.maxLat],center:[t.centerLon,t.centerLat,t.centerZoom],minzoom:t.minZoom,maxzoom:t.maxZoom}})}};gB(VB,"PMTiles");var qB=VB;const GB=new CSSStyleSheet;GB.replaceSync('.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{position:absolute;left:0;top:0}.maplibregl-map:fullscreen{width:100%;height: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{position:absolute;pointer-events:none;z-index:2}.maplibregl-ctrl-top-left{top:0;left:0}.maplibregl-ctrl-top-right{top:0;right:0}.maplibregl-ctrl-bottom-left{bottom:0;left:0}.maplibregl-ctrl-bottom-right{right:0;bottom:0}.maplibregl-ctrl{clear:both;pointer-events:auto;transform:translate(0)}.maplibregl-ctrl-top-left .maplibregl-ctrl{margin:10px 0 0 10px;float:left}.maplibregl-ctrl-top-right .maplibregl-ctrl{margin:10px 10px 0 0;float:right}.maplibregl-ctrl-bottom-left .maplibregl-ctrl{margin:0 0 10px 10px;float:left}.maplibregl-ctrl-bottom-right .maplibregl-ctrl{margin:0 10px 10px 0;float:right}.maplibregl-ctrl-group{border-radius:4px;background:#fff}.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{width:29px;height:29px;display:block;padding:0;outline:none;border:0;box-sizing:border-box;background-color:transparent;cursor:pointer}.maplibregl-ctrl-group button+button{border-top:1px solid #ddd}.maplibregl-ctrl button .maplibregl-ctrl-icon{display:block;width:100%;height:100%;background-repeat:no-repeat;background-position:50%}@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("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2229%22%20height%3D%2229%22%20fill%3D%22%23333%22%20viewBox%3D%220%200%2029%2029%22%3E%3Cpath%20d%3D%22M10%2013c-.75%200-1.5.75-1.5%201.5S9.25%2016%2010%2016h9c.75%200%201.5-.75%201.5-1.5S19.75%2013%2019%2013z%22%2F%3E%3C%2Fsvg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2229%22%20height%3D%2229%22%20fill%3D%22%23333%22%20viewBox%3D%220%200%2029%2029%22%3E%3Cpath%20d%3D%22M14.5%208.5c-.75%200-1.5.75-1.5%201.5v3h-3c-.75%200-1.5.75-1.5%201.5S9.25%2016%2010%2016h3v3c0%20.75.75%201.5%201.5%201.5S16%2019.75%2016%2019v-3h3c.75%200%201.5-.75%201.5-1.5S19.75%2013%2019%2013h-3v-3c0-.75-.75-1.5-1.5-1.5%22%2F%3E%3C%2Fsvg%3E")}@media (forced-colors:active){.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2229%22%20height%3D%2229%22%20fill%3D%22%23fff%22%20viewBox%3D%220%200%2029%2029%22%3E%3Cpath%20d%3D%22M10%2013c-.75%200-1.5.75-1.5%201.5S9.25%2016%2010%2016h9c.75%200%201.5-.75%201.5-1.5S19.75%2013%2019%2013z%22%2F%3E%3C%2Fsvg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2229%22%20height%3D%2229%22%20fill%3D%22%23fff%22%20viewBox%3D%220%200%2029%2029%22%3E%3Cpath%20d%3D%22M14.5%208.5c-.75%200-1.5.75-1.5%201.5v3h-3c-.75%200-1.5.75-1.5%201.5S9.25%2016%2010%2016h3v3c0%20.75.75%201.5%201.5%201.5S16%2019.75%2016%2019v-3h3c.75%200%201.5-.75%201.5-1.5S19.75%2013%2019%2013h-3v-3c0-.75-.75-1.5-1.5-1.5%22%2F%3E%3C%2Fsvg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2229%22%20height%3D%2229%22%20viewBox%3D%220%200%2029%2029%22%3E%3Cpath%20d%3D%22M10%2013c-.75%200-1.5.75-1.5%201.5S9.25%2016%2010%2016h9c.75%200%201.5-.75%201.5-1.5S19.75%2013%2019%2013z%22%2F%3E%3C%2Fsvg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2229%22%20height%3D%2229%22%20viewBox%3D%220%200%2029%2029%22%3E%3Cpath%20d%3D%22M14.5%208.5c-.75%200-1.5.75-1.5%201.5v3h-3c-.75%200-1.5.75-1.5%201.5S9.25%2016%2010%2016h3v3c0%20.75.75%201.5%201.5%201.5S16%2019.75%2016%2019v-3h3c.75%200%201.5-.75%201.5-1.5S19.75%2013%2019%2013h-3v-3c0-.75-.75-1.5-1.5-1.5%22%2F%3E%3C%2Fsvg%3E")}}.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2229%22%20height%3D%2229%22%20fill%3D%22%23333%22%20viewBox%3D%220%200%2029%2029%22%3E%3Cpath%20d%3D%22M24%2016v5.5c0%201.75-.75%202.5-2.5%202.5H16v-1l3-1.5-4-5.5%201-1%205.5%204%201.5-3zM6%2016l1.5%203%205.5-4%201%201-4%205.5%203%201.5v1H7.5C5.75%2024%205%2023.25%205%2021.5V16zm7-11v1l-3%201.5%204%205.5-1%201-5.5-4L6%2013H5V7.5C5%205.75%205.75%205%207.5%205zm11%202.5c0-1.75-.75-2.5-2.5-2.5H16v1l3%201.5-4%205.5%201%201%205.5-4%201.5%203h1z%22%2F%3E%3C%2Fsvg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2229%22%20height%3D%2229%22%20viewBox%3D%220%200%2029%2029%22%3E%3Cpath%20d%3D%22M18.5%2016c-1.75%200-2.5.75-2.5%202.5V24h1l1.5-3%205.5%204%201-1-4-5.5%203-1.5v-1zM13%2018.5c0-1.75-.75-2.5-2.5-2.5H5v1l3%201.5L4%2024l1%201%205.5-4%201.5%203h1zm3-8c0%201.75.75%202.5%202.5%202.5H24v-1l-3-1.5L25%205l-1-1-5.5%204L17%205h-1zM10.5%2013c1.75%200%202.5-.75%202.5-2.5V5h-1l-1.5%203L5%204%204%205l4%205.5L5%2012v1z%22%2F%3E%3C%2Fsvg%3E")}@media (forced-colors:active){.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2229%22%20height%3D%2229%22%20fill%3D%22%23fff%22%20viewBox%3D%220%200%2029%2029%22%3E%3Cpath%20d%3D%22M24%2016v5.5c0%201.75-.75%202.5-2.5%202.5H16v-1l3-1.5-4-5.5%201-1%205.5%204%201.5-3zM6%2016l1.5%203%205.5-4%201%201-4%205.5%203%201.5v1H7.5C5.75%2024%205%2023.25%205%2021.5V16zm7-11v1l-3%201.5%204%205.5-1%201-5.5-4L6%2013H5V7.5C5%205.75%205.75%205%207.5%205zm11%202.5c0-1.75-.75-2.5-2.5-2.5H16v1l3%201.5-4%205.5%201%201%205.5-4%201.5%203h1z%22%2F%3E%3C%2Fsvg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2229%22%20height%3D%2229%22%20fill%3D%22%23fff%22%20viewBox%3D%220%200%2029%2029%22%3E%3Cpath%20d%3D%22M18.5%2016c-1.75%200-2.5.75-2.5%202.5V24h1l1.5-3%205.5%204%201-1-4-5.5%203-1.5v-1zM13%2018.5c0-1.75-.75-2.5-2.5-2.5H5v1l3%201.5L4%2024l1%201%205.5-4%201.5%203h1zm3-8c0%201.75.75%202.5%202.5%202.5H24v-1l-3-1.5L25%205l-1-1-5.5%204L17%205h-1zM10.5%2013c1.75%200%202.5-.75%202.5-2.5V5h-1l-1.5%203L5%204%204%205l4%205.5L5%2012v1z%22%2F%3E%3C%2Fsvg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2229%22%20height%3D%2229%22%20viewBox%3D%220%200%2029%2029%22%3E%3Cpath%20d%3D%22M24%2016v5.5c0%201.75-.75%202.5-2.5%202.5H16v-1l3-1.5-4-5.5%201-1%205.5%204%201.5-3zM6%2016l1.5%203%205.5-4%201%201-4%205.5%203%201.5v1H7.5C5.75%2024%205%2023.25%205%2021.5V16zm7-11v1l-3%201.5%204%205.5-1%201-5.5-4L6%2013H5V7.5C5%205.75%205.75%205%207.5%205zm11%202.5c0-1.75-.75-2.5-2.5-2.5H16v1l3%201.5-4%205.5%201%201%205.5-4%201.5%203h1z%22%2F%3E%3C%2Fsvg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2229%22%20height%3D%2229%22%20viewBox%3D%220%200%2029%2029%22%3E%3Cpath%20d%3D%22M18.5%2016c-1.75%200-2.5.75-2.5%202.5V24h1l1.5-3%205.5%204%201-1-4-5.5%203-1.5v-1zM13%2018.5c0-1.75-.75-2.5-2.5-2.5H5v1l3%201.5L4%2024l1%201%205.5-4%201.5%203h1zm3-8c0%201.75.75%202.5%202.5%202.5H24v-1l-3-1.5L25%205l-1-1-5.5%204L17%205h-1zM10.5%2013c1.75%200%202.5-.75%202.5-2.5V5h-1l-1.5%203L5%204%204%205l4%205.5L5%2012v1z%22%2F%3E%3C%2Fsvg%3E")}}.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2229%22%20height%3D%2229%22%20fill%3D%22%23333%22%20viewBox%3D%220%200%2029%2029%22%3E%3Cpath%20d%3D%22m10.5%2014%204-8%204%208z%22%2F%3E%3Cpath%20fill%3D%22%23ccc%22%20d%3D%22m10.5%2016%204%208%204-8z%22%2F%3E%3C%2Fsvg%3E")}@media (forced-colors:active){.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2229%22%20height%3D%2229%22%20fill%3D%22%23fff%22%20viewBox%3D%220%200%2029%2029%22%3E%3Cpath%20d%3D%22m10.5%2014%204-8%204%208z%22%2F%3E%3Cpath%20fill%3D%22%23ccc%22%20d%3D%22m10.5%2016%204%208%204-8z%22%2F%3E%3C%2Fsvg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2229%22%20height%3D%2229%22%20viewBox%3D%220%200%2029%2029%22%3E%3Cpath%20d%3D%22m10.5%2014%204-8%204%208z%22%2F%3E%3Cpath%20fill%3D%22%23ccc%22%20d%3D%22m10.5%2016%204%208%204-8z%22%2F%3E%3C%2Fsvg%3E")}}.maplibregl-ctrl button.maplibregl-ctrl-globe .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2222%22%20height%3D%2222%22%20fill%3D%22none%22%20stroke%3D%22%23333%22%20viewBox%3D%220%200%2022%2022%22%3E%3Ccircle%20cx%3D%2211%22%20cy%3D%2211%22%20r%3D%228.5%22%2F%3E%3Cpath%20d%3D%22M17.5%2011c0%204.819-3.02%208.5-6.5%208.5S4.5%2015.819%204.5%2011%207.52%202.5%2011%202.5s6.5%203.681%206.5%208.5Z%22%2F%3E%3Cpath%20d%3D%22M13.5%2011c0%202.447-.331%204.64-.853%206.206-.262.785-.562%201.384-.872%201.777-.314.399-.58.517-.775.517s-.461-.118-.775-.517c-.31-.393-.61-.992-.872-1.777C8.831%2015.64%208.5%2013.446%208.5%2011s.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%201.777.522%201.565.853%203.76.853%206.206Z%22%2F%3E%3Cpath%20d%3D%22M11%207.5c-1.909%200-3.622-.166-4.845-.428-.616-.132-1.08-.283-1.379-.434a1.3%201.3%200%200%201-.224-.138q.07-.058.224-.138c.299-.151.763-.302%201.379-.434C7.378%205.666%209.091%205.5%2011%205.5s3.622.166%204.845.428c.616.132%201.08.283%201.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.428Zm0%209c-1.909%200-3.622-.166-4.845-.428-.616-.132-1.08-.283-1.379-.434a1.3%201.3%200%200%201-.224-.138%201.3%201.3%200%200%201%20.224-.138c.299-.151.763-.302%201.379-.434C7.378%2014.666%209.091%2014.5%2011%2014.5s3.622.166%204.845.428c.616.132%201.08.283%201.379.434.105.053.177.1.224.138a1.3%201.3%200%200%201-.224.138c-.299.151-.763.302-1.379.434-1.223.262-2.936.428-4.845.428Zm0-4c-2.46%200-4.672-.222-6.255-.574-.796-.177-1.406-.38-1.805-.59a1.5%201.5%200%200%201-.39-.272.3.3%200%200%201-.047-.064.3.3%200%200%201%20.048-.064c.066-.073.189-.167.389-.272.399-.21%201.009-.413%201.805-.59C6.328%209.722%208.54%209.5%2011%209.5s4.672.222%206.256.574c.795.177%201.405.38%201.804.59.2.105.323.2.39.272a.3.3%200%200%201%20.047.064.3.3%200%200%201-.048.064%201.4%201.4%200%200%201-.389.272c-.399.21-1.009.413-1.804.59-1.584.352-3.796.574-6.256.574Zm-8.501-1.51v.002zm0%20.018v.002zm17.002.002v-.002zm0-.018v-.002z%22%2F%3E%3C%2Fsvg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-globe-enabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2222%22%20height%3D%2222%22%20fill%3D%22none%22%20stroke%3D%22%2333b5e5%22%20viewBox%3D%220%200%2022%2022%22%3E%3Ccircle%20cx%3D%2211%22%20cy%3D%2211%22%20r%3D%228.5%22%2F%3E%3Cpath%20d%3D%22M17.5%2011c0%204.819-3.02%208.5-6.5%208.5S4.5%2015.819%204.5%2011%207.52%202.5%2011%202.5s6.5%203.681%206.5%208.5Z%22%2F%3E%3Cpath%20d%3D%22M13.5%2011c0%202.447-.331%204.64-.853%206.206-.262.785-.562%201.384-.872%201.777-.314.399-.58.517-.775.517s-.461-.118-.775-.517c-.31-.393-.61-.992-.872-1.777C8.831%2015.64%208.5%2013.446%208.5%2011s.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%201.777.522%201.565.853%203.76.853%206.206Z%22%2F%3E%3Cpath%20d%3D%22M11%207.5c-1.909%200-3.622-.166-4.845-.428-.616-.132-1.08-.283-1.379-.434a1.3%201.3%200%200%201-.224-.138q.07-.058.224-.138c.299-.151.763-.302%201.379-.434C7.378%205.666%209.091%205.5%2011%205.5s3.622.166%204.845.428c.616.132%201.08.283%201.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.428Zm0%209c-1.909%200-3.622-.166-4.845-.428-.616-.132-1.08-.283-1.379-.434a1.3%201.3%200%200%201-.224-.138%201.3%201.3%200%200%201%20.224-.138c.299-.151.763-.302%201.379-.434C7.378%2014.666%209.091%2014.5%2011%2014.5s3.622.166%204.845.428c.616.132%201.08.283%201.379.434.105.053.177.1.224.138a1.3%201.3%200%200%201-.224.138c-.299.151-.763.302-1.379.434-1.223.262-2.936.428-4.845.428Zm0-4c-2.46%200-4.672-.222-6.255-.574-.796-.177-1.406-.38-1.805-.59a1.5%201.5%200%200%201-.39-.272.3.3%200%200%201-.047-.064.3.3%200%200%201%20.048-.064c.066-.073.189-.167.389-.272.399-.21%201.009-.413%201.805-.59C6.328%209.722%208.54%209.5%2011%209.5s4.672.222%206.256.574c.795.177%201.405.38%201.804.59.2.105.323.2.39.272a.3.3%200%200%201%20.047.064.3.3%200%200%201-.048.064%201.4%201.4%200%200%201-.389.272c-.399.21-1.009.413-1.804.59-1.584.352-3.796.574-6.256.574Zm-8.501-1.51v.002zm0%20.018v.002zm17.002.002v-.002zm0-.018v-.002z%22%2F%3E%3C%2Fsvg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-terrain .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2222%22%20height%3D%2222%22%20fill%3D%22%23333%22%20viewBox%3D%220%200%2022%2022%22%3E%3Cpath%20d%3D%22m1.754%2013.406%204.453-4.851%203.09%203.09%203.281%203.277.969-.969-3.309-3.312%203.844-4.121%206.148%206.886h1.082v-.855l-7.207-8.07-4.84%205.187L6.169%206.57l-5.48%205.965v.871ZM.688%2016.844h20.625v1.375H.688Zm0%200%22%2F%3E%3C%2Fsvg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-terrain-enabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2222%22%20height%3D%2222%22%20fill%3D%22%2333b5e5%22%20viewBox%3D%220%200%2022%2022%22%3E%3Cpath%20d%3D%22m1.754%2013.406%204.453-4.851%203.09%203.09%203.281%203.277.969-.969-3.309-3.312%203.844-4.121%206.148%206.886h1.082v-.855l-7.207-8.07-4.84%205.187L6.169%206.57l-5.48%205.965v.871ZM.688%2016.844h20.625v1.375H.688Zm0%200%22%2F%3E%3C%2Fsvg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2229%22%20height%3D%2229%22%20fill%3D%22%23333%22%20viewBox%3D%220%200%2020%2020%22%3E%3Cpath%20d%3D%22M10%204C9%204%209%205%209%205v.1A5%205%200%200%200%205.1%209H5s-1%200-1%201%201%201%201%201h.1A5%205%200%200%200%209%2014.9v.1s0%201%201%201%201-1%201-1v-.1a5%205%200%200%200%203.9-3.9h.1s1%200%201-1-1-1-1-1h-.1A5%205%200%200%200%2011%205.1V5s0-1-1-1m0%202.5a3.5%203.5%200%201%201%200%207%203.5%203.5%200%201%201%200-7%22%2F%3E%3Ccircle%20cx%3D%2210%22%20cy%3D%2210%22%20r%3D%222%22%2F%3E%3C%2Fsvg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2229%22%20height%3D%2229%22%20fill%3D%22%23aaa%22%20viewBox%3D%220%200%2020%2020%22%3E%3Cpath%20d%3D%22M10%204C9%204%209%205%209%205v.1A5%205%200%200%200%205.1%209H5s-1%200-1%201%201%201%201%201h.1A5%205%200%200%200%209%2014.9v.1s0%201%201%201%201-1%201-1v-.1a5%205%200%200%200%203.9-3.9h.1s1%200%201-1-1-1-1-1h-.1A5%205%200%200%200%2011%205.1V5s0-1-1-1m0%202.5a3.5%203.5%200%201%201%200%207%203.5%203.5%200%201%201%200-7%22%2F%3E%3Ccircle%20cx%3D%2210%22%20cy%3D%2210%22%20r%3D%222%22%2F%3E%3Cpath%20fill%3D%22red%22%20d%3D%22m14%205%201%201-9%209-1-1z%22%2F%3E%3C%2Fsvg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2229%22%20height%3D%2229%22%20fill%3D%22%2333b5e5%22%20viewBox%3D%220%200%2020%2020%22%3E%3Cpath%20d%3D%22M10%204C9%204%209%205%209%205v.1A5%205%200%200%200%205.1%209H5s-1%200-1%201%201%201%201%201h.1A5%205%200%200%200%209%2014.9v.1s0%201%201%201%201-1%201-1v-.1a5%205%200%200%200%203.9-3.9h.1s1%200%201-1-1-1-1-1h-.1A5%205%200%200%200%2011%205.1V5s0-1-1-1m0%202.5a3.5%203.5%200%201%201%200%207%203.5%203.5%200%201%201%200-7%22%2F%3E%3Ccircle%20cx%3D%2210%22%20cy%3D%2210%22%20r%3D%222%22%2F%3E%3C%2Fsvg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2229%22%20height%3D%2229%22%20fill%3D%22%23e58978%22%20viewBox%3D%220%200%2020%2020%22%3E%3Cpath%20d%3D%22M10%204C9%204%209%205%209%205v.1A5%205%200%200%200%205.1%209H5s-1%200-1%201%201%201%201%201h.1A5%205%200%200%200%209%2014.9v.1s0%201%201%201%201-1%201-1v-.1a5%205%200%200%200%203.9-3.9h.1s1%200%201-1-1-1-1-1h-.1A5%205%200%200%200%2011%205.1V5s0-1-1-1m0%202.5a3.5%203.5%200%201%201%200%207%203.5%203.5%200%201%201%200-7%22%2F%3E%3Ccircle%20cx%3D%2210%22%20cy%3D%2210%22%20r%3D%222%22%2F%3E%3C%2Fsvg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2229%22%20height%3D%2229%22%20fill%3D%22%2333b5e5%22%20viewBox%3D%220%200%2020%2020%22%3E%3Cpath%20d%3D%22M10%204C9%204%209%205%209%205v.1A5%205%200%200%200%205.1%209H5s-1%200-1%201%201%201%201%201h.1A5%205%200%200%200%209%2014.9v.1s0%201%201%201%201-1%201-1v-.1a5%205%200%200%200%203.9-3.9h.1s1%200%201-1-1-1-1-1h-.1A5%205%200%200%200%2011%205.1V5s0-1-1-1m0%202.5a3.5%203.5%200%201%201%200%207%203.5%203.5%200%201%201%200-7%22%2F%3E%3C%2Fsvg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2229%22%20height%3D%2229%22%20fill%3D%22%23e54e33%22%20viewBox%3D%220%200%2020%2020%22%3E%3Cpath%20d%3D%22M10%204C9%204%209%205%209%205v.1A5%205%200%200%200%205.1%209H5s-1%200-1%201%201%201%201%201h.1A5%205%200%200%200%209%2014.9v.1s0%201%201%201%201-1%201-1v-.1a5%205%200%200%200%203.9-3.9h.1s1%200%201-1-1-1-1-1h-.1A5%205%200%200%200%2011%205.1V5s0-1-1-1m0%202.5a3.5%203.5%200%201%201%200%207%203.5%203.5%200%201%201%200-7%22%2F%3E%3C%2Fsvg%3E")}.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("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2229%22%20height%3D%2229%22%20fill%3D%22%23fff%22%20viewBox%3D%220%200%2020%2020%22%3E%3Cpath%20d%3D%22M10%204C9%204%209%205%209%205v.1A5%205%200%200%200%205.1%209H5s-1%200-1%201%201%201%201%201h.1A5%205%200%200%200%209%2014.9v.1s0%201%201%201%201-1%201-1v-.1a5%205%200%200%200%203.9-3.9h.1s1%200%201-1-1-1-1-1h-.1A5%205%200%200%200%2011%205.1V5s0-1-1-1m0%202.5a3.5%203.5%200%201%201%200%207%203.5%203.5%200%201%201%200-7%22%2F%3E%3Ccircle%20cx%3D%2210%22%20cy%3D%2210%22%20r%3D%222%22%2F%3E%3C%2Fsvg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2229%22%20height%3D%2229%22%20fill%3D%22%23999%22%20viewBox%3D%220%200%2020%2020%22%3E%3Cpath%20d%3D%22M10%204C9%204%209%205%209%205v.1A5%205%200%200%200%205.1%209H5s-1%200-1%201%201%201%201%201h.1A5%205%200%200%200%209%2014.9v.1s0%201%201%201%201-1%201-1v-.1a5%205%200%200%200%203.9-3.9h.1s1%200%201-1-1-1-1-1h-.1A5%205%200%200%200%2011%205.1V5s0-1-1-1m0%202.5a3.5%203.5%200%201%201%200%207%203.5%203.5%200%201%201%200-7%22%2F%3E%3Ccircle%20cx%3D%2210%22%20cy%3D%2210%22%20r%3D%222%22%2F%3E%3Cpath%20fill%3D%22red%22%20d%3D%22m14%205%201%201-9%209-1-1z%22%2F%3E%3C%2Fsvg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2229%22%20height%3D%2229%22%20fill%3D%22%2333b5e5%22%20viewBox%3D%220%200%2020%2020%22%3E%3Cpath%20d%3D%22M10%204C9%204%209%205%209%205v.1A5%205%200%200%200%205.1%209H5s-1%200-1%201%201%201%201%201h.1A5%205%200%200%200%209%2014.9v.1s0%201%201%201%201-1%201-1v-.1a5%205%200%200%200%203.9-3.9h.1s1%200%201-1-1-1-1-1h-.1A5%205%200%200%200%2011%205.1V5s0-1-1-1m0%202.5a3.5%203.5%200%201%201%200%207%203.5%203.5%200%201%201%200-7%22%2F%3E%3Ccircle%20cx%3D%2210%22%20cy%3D%2210%22%20r%3D%222%22%2F%3E%3C%2Fsvg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2229%22%20height%3D%2229%22%20fill%3D%22%23e58978%22%20viewBox%3D%220%200%2020%2020%22%3E%3Cpath%20d%3D%22M10%204C9%204%209%205%209%205v.1A5%205%200%200%200%205.1%209H5s-1%200-1%201%201%201%201%201h.1A5%205%200%200%200%209%2014.9v.1s0%201%201%201%201-1%201-1v-.1a5%205%200%200%200%203.9-3.9h.1s1%200%201-1-1-1-1-1h-.1A5%205%200%200%200%2011%205.1V5s0-1-1-1m0%202.5a3.5%203.5%200%201%201%200%207%203.5%203.5%200%201%201%200-7%22%2F%3E%3Ccircle%20cx%3D%2210%22%20cy%3D%2210%22%20r%3D%222%22%2F%3E%3C%2Fsvg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2229%22%20height%3D%2229%22%20fill%3D%22%2333b5e5%22%20viewBox%3D%220%200%2020%2020%22%3E%3Cpath%20d%3D%22M10%204C9%204%209%205%209%205v.1A5%205%200%200%200%205.1%209H5s-1%200-1%201%201%201%201%201h.1A5%205%200%200%200%209%2014.9v.1s0%201%201%201%201-1%201-1v-.1a5%205%200%200%200%203.9-3.9h.1s1%200%201-1-1-1-1-1h-.1A5%205%200%200%200%2011%205.1V5s0-1-1-1m0%202.5a3.5%203.5%200%201%201%200%207%203.5%203.5%200%201%201%200-7%22%2F%3E%3C%2Fsvg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2229%22%20height%3D%2229%22%20fill%3D%22%23e54e33%22%20viewBox%3D%220%200%2020%2020%22%3E%3Cpath%20d%3D%22M10%204C9%204%209%205%209%205v.1A5%205%200%200%200%205.1%209H5s-1%200-1%201%201%201%201%201h.1A5%205%200%200%200%209%2014.9v.1s0%201%201%201%201-1%201-1v-.1a5%205%200%200%200%203.9-3.9h.1s1%200%201-1-1-1-1-1h-.1A5%205%200%200%200%2011%205.1V5s0-1-1-1m0%202.5a3.5%203.5%200%201%201%200%207%203.5%203.5%200%201%201%200-7%22%2F%3E%3C%2Fsvg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2229%22%20height%3D%2229%22%20viewBox%3D%220%200%2020%2020%22%3E%3Cpath%20d%3D%22M10%204C9%204%209%205%209%205v.1A5%205%200%200%200%205.1%209H5s-1%200-1%201%201%201%201%201h.1A5%205%200%200%200%209%2014.9v.1s0%201%201%201%201-1%201-1v-.1a5%205%200%200%200%203.9-3.9h.1s1%200%201-1-1-1-1-1h-.1A5%205%200%200%200%2011%205.1V5s0-1-1-1m0%202.5a3.5%203.5%200%201%201%200%207%203.5%203.5%200%201%201%200-7%22%2F%3E%3Ccircle%20cx%3D%2210%22%20cy%3D%2210%22%20r%3D%222%22%2F%3E%3C%2Fsvg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2229%22%20height%3D%2229%22%20fill%3D%22%23666%22%20viewBox%3D%220%200%2020%2020%22%3E%3Cpath%20d%3D%22M10%204C9%204%209%205%209%205v.1A5%205%200%200%200%205.1%209H5s-1%200-1%201%201%201%201%201h.1A5%205%200%200%200%209%2014.9v.1s0%201%201%201%201-1%201-1v-.1a5%205%200%200%200%203.9-3.9h.1s1%200%201-1-1-1-1-1h-.1A5%205%200%200%200%2011%205.1V5s0-1-1-1m0%202.5a3.5%203.5%200%201%201%200%207%203.5%203.5%200%201%201%200-7%22%2F%3E%3Ccircle%20cx%3D%2210%22%20cy%3D%2210%22%20r%3D%222%22%2F%3E%3Cpath%20fill%3D%22red%22%20d%3D%22m14%205%201%201-9%209-1-1z%22%2F%3E%3C%2Fsvg%3E")}}@keyframes maplibregl-spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}a.maplibregl-ctrl-logo{width:88px;height:23px;margin:0 0 -4px -4px;display:block;background-repeat:no-repeat;cursor:pointer;overflow:hidden;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2288%22%20height%3D%2223%22%20fill%3D%22none%22%3E%3Cpath%20fill%3D%22%23000%22%20fill-opacity%3D%22.4%22%20fill-rule%3D%22evenodd%22%20d%3D%22M17.408%2016.796h-1.827l2.501-12.095h.198l3.324%206.533.988%202.19.988-2.19%203.258-6.533h.181l2.6%2012.095h-1.81l-1.218-5.644-.362-1.71-.658%201.71-2.929%205.644h-.098l-2.914-5.644-.757-1.71-.345%201.71zm1.958-3.42-.726%203.663a1.255%201.255%200%200%201-1.232%201.011h-1.827a1.255%201.255%200%200%201-1.229-1.509l2.501-12.095a1.255%201.255%200%200%201%201.23-1.001h.197a1.25%201.25%200%200%201%201.12.685l3.19%206.273%203.125-6.263a1.25%201.25%200%200%201%201.123-.695h.181a1.255%201.255%200%200%201%201.227.991l1.443%206.71a5%205%200%200%201%20.314-.787l.009-.016a4.6%204.6%200%200%201%201.777-1.887c.782-.46%201.668-.667%202.611-.667a4.6%204.6%200%200%201%201.7.32l.306.134c.21-.16.474-.256.759-.256h1.694a1.255%201.255%200%200%201%201.212.925%201.255%201.255%200%200%201%201.212-.925h1.711c.284%200%20.545.094.755.252.613-.3%201.312-.45%202.075-.45%201.356%200%202.557.445%203.482%201.4q.47.48.763%201.064V4.701a1.255%201.255%200%200%201%201.255-1.255h1.86A1.255%201.255%200%200%201%2054.44%204.7v9.194h2.217c.19%200%20.37.043.532.118v-4.77c0-.356.147-.678.385-.906a2.42%202.42%200%200%201-.682-1.71c0-.665.267-1.253.735-1.7a2.45%202.45%200%200%201%201.722-.674%202.43%202.43%200%200%201%201.705.675q.318.302.504.683V4.7a1.255%201.255%200%200%201%201.255-1.255h1.744A1.255%201.255%200%200%201%2065.812%204.7v3.335a4.8%204.8%200%200%201%201.526-.246c.938%200%201.817.214%202.59.69a4.47%204.47%200%200%201%201.67%201.743v-.98a1.255%201.255%200%200%201%201.256-1.256h1.777c.233%200%20.451.064.639.174a3.4%203.4%200%200%201%201.567-.372c.346%200%20.861.02%201.285.232a1.25%201.25%200%200%201%20.689%201.004%204.7%204.7%200%200%201%20.853-.588c.795-.44%201.675-.647%202.61-.647%201.385%200%202.65.39%203.525%201.396.836.938%201.168%202.173%201.168%203.528q-.001.515-.056%201.051a1.255%201.255%200%200%201-.947%201.09l.408.952a1.255%201.255%200%200%201-.477%201.552c-.418.268-.92.463-1.458.612-.613.171-1.304.244-2.049.244-1.06%200-2.043-.207-2.886-.698l-.015-.008c-.798-.48-1.419-1.135-1.818-1.963l-.004-.008a5.8%205.8%200%200%201-.548-2.512q0-.429.053-.843a1.3%201.3%200%200%201-.333-.086l-.166-.004c-.223%200-.426.062-.643.228-.03.024-.142.139-.142.59v3.883a1.255%201.255%200%200%201-1.256%201.256h-1.777a1.255%201.255%200%200%201-1.256-1.256V15.69l-.032.057a4.8%204.8%200%200%201-1.86%201.833%205.04%205.04%200%200%201-2.484.634%204.5%204.5%200%200%201-1.935-.424%201.25%201.25%200%200%201-.764.258h-1.71a1.255%201.255%200%200%201-1.256-1.255V7.687a2.4%202.4%200%200%201-.428.625c.253.23.412.561.412.93v7.553a1.255%201.255%200%200%201-1.256%201.255h-1.843a1.25%201.25%200%200%201-.894-.373c-.228.23-.544.373-.894.373H51.32a1.255%201.255%200%200%201-1.256-1.255v-1.251l-.061.117a4.7%204.7%200%200%201-1.782%201.884%204.77%204.77%200%200%201-2.485.67%205.6%205.6%200%200%201-1.485-.188l.009%202.764a1.255%201.255%200%200%201-1.255%201.259h-1.729a1.255%201.255%200%200%201-1.255-1.255v-3.537a1.255%201.255%200%200%201-1.167.793h-1.679a1.25%201.25%200%200%201-.77-.263%204.5%204.5%200%200%201-1.945.429c-.885%200-1.724-.21-2.495-.632l-.017-.01a5%205%200%200%201-1.081-.836%201.255%201.255%200%200%201-1.254%201.312h-1.81a1.255%201.255%200%200%201-1.228-.99l-.782-3.625-2.044%203.939a1.25%201.25%200%200%201-1.115.676h-.098a1.25%201.25%200%200%201-1.116-.68l-2.061-3.994zM35.92%2016.63l.207-.114.223-.15q.493-.356.735-.785l.061-.118.033%201.332h1.678V9.242h-1.694l-.033%201.267q-.133-.329-.526-.658l-.032-.028a3.2%203.2%200%200%200-.668-.428l-.27-.12a3.3%203.3%200%200%200-1.235-.23q-1.136-.001-1.974.493a3.36%203.36%200%200%200-1.3%201.382q-.445.89-.444%202.074%200%201.2.51%202.107a3.8%203.8%200%200%200%201.382%201.381%203.9%203.9%200%200%200%201.893.477q.795%200%201.455-.33zm-2.789-5.38q-.576.675-.575%201.762%200%201.102.559%201.794.576.675%201.645.675a2.25%202.25%200%200%200%20.934-.19%202.2%202.2%200%200%200%20.468-.29l.178-.161a2.2%202.2%200%200%200%20.397-.561q.244-.5.244-1.15v-.115q0-.708-.296-1.267l-.043-.077a2.2%202.2%200%200%200-.633-.709l-.13-.086-.047-.028a2.1%202.1%200%200%200-1.073-.285q-1.052%200-1.629.692zm2.316%202.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.96.96%200%200%200-.353-.389.85.85%200%200%200-.464-.127c-.4%200-.56.114-.664.239l-.01.012c-.148.174-.275.45-.275.945%200%20.506.122.801.27.99.097.11.266.224.68.224.303%200%20.504-.09.687-.269zm7.545%201.705a2.6%202.6%200%200%200%20.331.423q.319.33.755.548l.173.074q.65.255%201.49.255%201.02%200%201.844-.493a3.45%203.45%200%200%200%201.316-1.4q.493-.904.493-2.089%200-1.909-.988-2.913-.988-1.02-2.584-1.02-.898%200-1.575.347a3%203%200%200%200-.415.262l-.199.166a3.4%203.4%200%200%200-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138q.206.29.48.5l.155.11.053.034q.51.296%201.119.297%201.07%200%201.645-.675.577-.69.576-1.762%200-1.119-.576-1.777-.558-.675-1.645-.675-.435%200-.835.16a2%202%200%200%200-.284.136%202%202%200%200%200-.363.254%202.2%202.2%200%200%200-.46.569l-.082.162a2.6%202.6%200%200%200-.213%201.072v.115q0%20.707.296%201.267l.135.211zm.964-.818a1.1%201.1%200%200%200%20.367.385.94.94%200%200%200%20.476.118c.423%200%20.59-.117.687-.23.159-.194.28-.478.28-.95%200-.53-.133-.8-.266-.952l-.021-.025c-.078-.094-.231-.221-.68-.221a1%201%200%200%200-.503.135l-.012.007a.86.86%200%200%200-.335.343c-.073.133-.132.324-.132.614v.115a1.4%201.4%200%200%200%20.14.66zm15.7-6.222q.347-.346.346-.856a1.05%201.05%200%200%200-.345-.79%201.18%201.18%200%200%200-.84-.329q-.51%200-.855.33a1.05%201.05%200%200%200-.346.79q0%20.51.346.855.345.346.856.346.51%200%20.839-.346zm4.337%209.314.033-1.332q.191.403.59.747l.098.081a4%204%200%200%200%20.316.224l.223.122a3.2%203.2%200%200%200%201.44.322%203.8%203.8%200%200%200%201.875-.477%203.5%203.5%200%200%200%201.382-1.366q.527-.89.526-2.09%200-1.184-.444-2.073a3.24%203.24%200%200%200-1.283-1.399q-.823-.51-1.942-.51a3.5%203.5%200%200%200-1.527.344l-.086.043-.165.09a3%203%200%200%200-.33.214q-.432.315-.656.707a2%202%200%200%200-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.5%202.5%200%200%200%20.566.7q.117.098.245.18l.144.08a2.1%202.1%200%200%200%20.975.232q1.07%200%201.645-.675.576-.69.576-1.778%200-1.102-.576-1.777-.56-.691-1.645-.692a2.2%202.2%200%200%200-1.015.235q-.22.113-.415.282l-.15.142a2.1%202.1%200%200%200-.42.594q-.223.479-.223%201.1v.115q0%20.705.293%201.26zm2.616-.293c.157-.191.28-.479.28-.967%200-.51-.13-.79-.276-.961l-.021-.026c-.082-.1-.232-.225-.67-.225a.87.87%200%200%200-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0%20.285.057.499.144.669a1.1%201.1%200%200%200%20.367.405c.137.082.28.123.455.123.423%200%20.59-.118.686-.23zm8.266-3.013q.345-.13.724-.14l.069-.002q.493%200%20.642.099l.247-1.794q-.196-.099-.717-.099a2.3%202.3%200%200%200-.545.063%202%202%200%200%200-.411.148%202.2%202.2%200%200%200-.4.249%202.5%202.5%200%200%200-.485.499%202.7%202.7%200%200%200-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884q0-.546.159-.943a1.5%201.5%200%200%201%20.466-.636%202.5%202.5%200%200%201%20.399-.253%202%202%200%200%201%20.224-.099zm9.784%202.656.05-.922q0-1.743-.856-2.698-.838-.97-2.584-.97-1.119-.001-2.007.493a3.46%203.46%200%200%200-1.4%201.382q-.493.906-.493%202.106%200%201.07.428%201.975.428.89%201.332%201.432.906.526%202.255.526.973%200%201.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%200-1.497-.444a1.6%201.6%200%200%201-.192-.193q-.366-.44-.512-1.234l-.004-.021zm-5.427-1.256-.003.022h3.752v-.138q-.011-.727-.288-1.118a1%201%200%200%200-.156-.176q-.46-.428-1.316-.428-.986%200-1.494.604-.379.45-.494%201.234zm-27.053%202.77V4.7h-1.86v12.095h5.333V15.15zm7.103-5.908v7.553h-1.843V9.242h1.843z%22%2F%3E%3Cpath%20fill%3D%22%23fff%22%20d%3D%22m19.63%2011.151-.757-1.71-.345%201.71-1.12%205.644h-1.827L18.083%204.7h.197l3.325%206.533.988%202.19.988-2.19L26.839%204.7h.181l2.6%2012.095h-1.81l-1.218-5.644-.362-1.71-.658%201.71-2.93%205.644h-.098l-2.913-5.644zm14.836%205.81q-1.02%200-1.893-.478a3.8%203.8%200%200%201-1.381-1.382q-.51-.906-.51-2.106%200-1.185.444-2.074a3.36%203.36%200%200%201%201.3-1.382q.839-.494%201.974-.494a3.3%203.3%200%200%201%201.234.231%203.3%203.3%200%200%201%20.97.575q.396.33.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332q-.279.593-1.02%201.053a3.17%203.17%200%200%201-1.662.444zm.296-1.482q.938%200%201.58-.642.642-.66.642-1.711v-.115q0-.708-.296-1.267a2.2%202.2%200%200%200-.807-.872%202.1%202.1%200%200%200-1.119-.313q-1.053%200-1.629.692-.575.675-.575%201.76%200%201.103.559%201.795.577.675%201.645.675zm6.521-6.237h1.711v1.4q.906-1.597%202.83-1.597%201.596%200%202.584%201.02.988%201.005.988%202.914%200%201.185-.493%202.09a3.46%203.46%200%200%201-1.316%201.399%203.5%203.5%200%200%201-1.844.493q-.954%200-1.662-.329a2.67%202.67%200%200%201-1.086-.97l.017%205.134h-1.728zm4.048%206.22q1.07%200%201.645-.674.577-.69.576-1.762%200-1.119-.576-1.777-.558-.675-1.645-.675-.592%200-1.12.296-.51.28-.822.823-.296.527-.296%201.234v.115q0%20.708.296%201.267.313.543.823.855.51.296%201.119.297z%22%2F%3E%3Cpath%20fill%3D%22%23e1e3e9%22%20d%3D%22M51.325%204.7h1.86v10.45h3.473v1.646h-5.333zm7.12%204.542h1.843v7.553h-1.843zm.905-1.415a1.16%201.16%200%200%201-.856-.346%201.17%201.17%200%200%201-.346-.856%201.05%201.05%200%200%201%20.346-.79q.346-.329.856-.329.494%200%20.839.33a1.05%201.05%200%200%201%20.345.79%201.16%201.16%200%200%201-.345.855q-.33.346-.84.346zm7.875%209.133a3.17%203.17%200%200%201-1.662-.444q-.723-.46-1.004-1.053l-.033%201.332h-1.71V4.701h1.743v4.657l-.082%201.283q.279-.658%201.086-1.119a3.5%203.5%200%200%201%201.778-.477q1.119%200%201.942.51a3.24%203.24%200%200%201%201.283%201.4q.445.888.444%202.072%200%201.201-.526%202.09a3.5%203.5%200%200%201-1.382%201.366%203.8%203.8%200%200%201-1.876.477zm-.296-1.481q1.069%200%201.645-.675.577-.69.577-1.778%200-1.102-.577-1.776-.56-.691-1.645-.692a2.12%202.12%200%200%200-1.58.659q-.642.641-.642%201.694v.115q0%20.71.296%201.267a2.4%202.4%200%200%200%20.807.872%202.1%202.1%200%200%200%201.119.313zm5.927-6.237h1.777v1.481q.263-.757.856-1.217a2.14%202.14%200%200%201%201.349-.46q.527%200%20.724.098l-.247%201.794q-.149-.099-.642-.099-.774%200-1.416.494-.626.493-.626%201.58v3.883h-1.777V9.242zm9.534%207.718q-1.35%200-2.255-.526-.904-.543-1.332-1.432a4.6%204.6%200%200%201-.428-1.975q0-1.2.493-2.106a3.46%203.46%200%200%201%201.4-1.382q.889-.495%202.007-.494%201.744%200%202.584.97.855.956.856%202.7%200%20.444-.05.92h-5.43q.18%201.005.708%201.45.542.443%201.497.443.79%200%201.3-.131a4%204%200%200%200%20.938-.362l.542%201.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%200-1.991%201.86z%22%2F%3E%3Cpath%20d%3D%22M5.074%2015.948a.484.657%200%200%200-.486.659v1.84a.484.657%200%200%200%20.486.659h4.101a.484.657%200%200%200%20.486-.659v-1.84a.484.657%200%200%200-.486-.659zm3.56%201.16H5.617v.838h3.017z%22%20style%3D%22fill%3A%23fff%3Bfill-rule%3Aevenodd%3Bstroke-width%3A1.03600001%22%2F%3E%3Cg%20style%3D%22stroke-width%3A1.12603545%22%3E%3Cpath%20d%3D%22M-9.408-1.416c-3.833-.025-7.056%202.912-7.08%206.615-.02%203.08%201.653%204.832%203.107%206.268.903.892%201.721%201.74%202.32%202.902l-.525-.004c-.543-.003-.992.304-1.24.639a1.87%201.87%200%200%200-.362%201.121l-.011%201.877c-.003.402.104.787.347%201.125.244.338.688.653%201.23.656l4.142.028c.542.003.99-.306%201.238-.641a1.87%201.87%200%200%200%20.363-1.121l.012-1.875a1.87%201.87%200%200%200-.348-1.127c-.243-.338-.688-.653-1.23-.656l-.518-.004c.597-1.145%201.425-1.983%202.348-2.87%201.473-1.414%203.18-3.149%203.2-6.226-.016-3.59-2.923-6.684-6.993-6.707m-.006%201.1v.002c3.274.02%205.92%202.532%205.9%205.6-.017%202.706-1.39%204.026-2.863%205.44-1.034.994-2.118%202.033-2.814%203.633-.018.041-.052.055-.075.065q-.013.004-.02.01a.34.34%200%200%201-.226.084.34.34%200%200%201-.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%202.7-5.545%205.975-5.523m-.02%202.826c-1.62-.01-2.944%201.315-2.955%202.96-.01%201.646%201.295%202.988%202.916%202.999h.002c1.621.01%202.943-1.316%202.953-2.961.011-1.646-1.294-2.988-2.916-2.998m-.005%201.1c1.017.006%201.829.83%201.822%201.89s-.83%201.874-1.848%201.867c-1.018-.006-1.829-.83-1.822-1.89s.83-1.874%201.848-1.868m-2.155%2011.857%204.14.025c.271.002.49.305.487.676l-.013%201.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%22%20style%3D%22color%3A%23000%3Bfont-style%3Anormal%3Bfont-variant%3Anormal%3Bfont-weight%3A400%3Bfont-stretch%3Anormal%3Bfont-size%3Amedium%3Bline-height%3Anormal%3Bfont-family%3Asans-serif%3Bfont-variant-ligatures%3Anormal%3Bfont-variant-position%3Anormal%3Bfont-variant-caps%3Anormal%3Bfont-variant-numeric%3Anormal%3Bfont-variant-alternates%3Anormal%3Bfont-feature-settings%3Anormal%3Btext-indent%3A0%3Btext-align%3Astart%3Btext-decoration%3Anone%3Btext-decoration-line%3Anone%3Btext-decoration-style%3Asolid%3Btext-decoration-color%3A%23000%3Bletter-spacing%3Anormal%3Bword-spacing%3Anormal%3Btext-transform%3Anone%3Bwriting-mode%3Alr-tb%3Bdirection%3Altr%3Btext-orientation%3Amixed%3Bdominant-baseline%3Aauto%3Bbaseline-shift%3Abaseline%3Btext-anchor%3Astart%3Bwhite-space%3Anormal%3Bshape-padding%3A0%3Bclip-rule%3Aevenodd%3Bdisplay%3Ainline%3Boverflow%3Avisible%3Bvisibility%3Avisible%3Bopacity%3A1%3Bisolation%3Aauto%3Bmix-blend-mode%3Anormal%3Bcolor-interpolation%3AsRGB%3Bcolor-interpolation-filters%3AlinearRGB%3Bsolid-color%3A%23000%3Bsolid-opacity%3A1%3Bvector-effect%3Anone%3Bfill%3A%23000%3Bfill-opacity%3A.4%3Bfill-rule%3Aevenodd%3Bstroke%3Anone%3Bstroke-width%3A2.47727823%3Bstroke-linecap%3Abutt%3Bstroke-linejoin%3Amiter%3Bstroke-miterlimit%3A4%3Bstroke-dasharray%3Anone%3Bstroke-dashoffset%3A0%3Bstroke-opacity%3A1%3Bcolor-rendering%3Aauto%3Bimage-rendering%3Aauto%3Bshape-rendering%3Aauto%3Btext-rendering%3Aauto%22%20transform%3D%22translate(15.553%202.85)scale(.88807)%22%2F%3E%3Cpath%20d%3D%22M-9.415-.316C-12.69-.338-15.37%202.14-15.39%205.207c-.017%202.716%201.326%204.041%202.78%205.477%201.013%201%202.081%202.055%202.78%203.67l.092.076a.34.34%200%200%200%20.225.086.34.34%200%200%200%20.227-.083l.019-.01c.022-.009.057-.024.074-.064.697-1.6%201.78-2.64%202.814-3.634%201.473-1.414%202.847-2.733%202.864-5.44.02-3.067-2.627-5.58-5.901-5.601m-.057%208.784c1.621.011%202.944-1.315%202.955-2.96.01-1.646-1.295-2.988-2.916-2.999-1.622-.01-2.945%201.315-2.955%202.96s1.295%202.989%202.916%203%22%20style%3D%22clip-rule%3Aevenodd%3Bfill%3A%23e1e3e9%3Bfill-opacity%3A1%3Bfill-rule%3Aevenodd%3Bstroke%3Anone%3Bstroke-width%3A2.47727823%3Bstroke-miterlimit%3A4%3Bstroke-dasharray%3Anone%3Bstroke-opacity%3A.4%22%20transform%3D%22translate(15.553%202.85)scale(.88807)%22%2F%3E%3Cpath%20d%3D%22M-11.594%2015.465c-.27-.002-.492.297-.494.668l-.012%201.876c-.003.371.214.673.485.675l4.14.027c.271.002.492-.298.495-.668l.012-1.877c.003-.37-.215-.672-.485-.674z%22%20style%3D%22clip-rule%3Aevenodd%3Bfill%3A%23fff%3Bfill-opacity%3A1%3Bfill-rule%3Aevenodd%3Bstroke%3Anone%3Bstroke-width%3A2.47727823%3Bstroke-miterlimit%3A4%3Bstroke-dasharray%3Anone%3Bstroke-opacity%3A.4%22%20transform%3D%22translate(15.553%202.85)scale(.88807)%22%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E")}a.maplibregl-ctrl-logo.maplibregl-compact{width:14px}@media (forced-colors:active){a.maplibregl-ctrl-logo{background-color:transparent;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2288%22%20height%3D%2223%22%20fill%3D%22none%22%3E%3Cpath%20fill%3D%22%23000%22%20fill-opacity%3D%22.4%22%20fill-rule%3D%22evenodd%22%20d%3D%22M17.408%2016.796h-1.827l2.501-12.095h.198l3.324%206.533.988%202.19.988-2.19%203.258-6.533h.181l2.6%2012.095h-1.81l-1.218-5.644-.362-1.71-.658%201.71-2.929%205.644h-.098l-2.914-5.644-.757-1.71-.345%201.71zm1.958-3.42-.726%203.663a1.255%201.255%200%200%201-1.232%201.011h-1.827a1.255%201.255%200%200%201-1.229-1.509l2.501-12.095a1.255%201.255%200%200%201%201.23-1.001h.197a1.25%201.25%200%200%201%201.12.685l3.19%206.273%203.125-6.263a1.25%201.25%200%200%201%201.123-.695h.181a1.255%201.255%200%200%201%201.227.991l1.443%206.71a5%205%200%200%201%20.314-.787l.009-.016a4.6%204.6%200%200%201%201.777-1.887c.782-.46%201.668-.667%202.611-.667a4.6%204.6%200%200%201%201.7.32l.306.134c.21-.16.474-.256.759-.256h1.694a1.255%201.255%200%200%201%201.212.925%201.255%201.255%200%200%201%201.212-.925h1.711c.284%200%20.545.094.755.252.613-.3%201.312-.45%202.075-.45%201.356%200%202.557.445%203.482%201.4q.47.48.763%201.064V4.701a1.255%201.255%200%200%201%201.255-1.255h1.86A1.255%201.255%200%200%201%2054.44%204.7v9.194h2.217c.19%200%20.37.043.532.118v-4.77c0-.356.147-.678.385-.906a2.42%202.42%200%200%201-.682-1.71c0-.665.267-1.253.735-1.7a2.45%202.45%200%200%201%201.722-.674%202.43%202.43%200%200%201%201.705.675q.318.302.504.683V4.7a1.255%201.255%200%200%201%201.255-1.255h1.744A1.255%201.255%200%200%201%2065.812%204.7v3.335a4.8%204.8%200%200%201%201.526-.246c.938%200%201.817.214%202.59.69a4.47%204.47%200%200%201%201.67%201.743v-.98a1.255%201.255%200%200%201%201.256-1.256h1.777c.233%200%20.451.064.639.174a3.4%203.4%200%200%201%201.567-.372c.346%200%20.861.02%201.285.232a1.25%201.25%200%200%201%20.689%201.004%204.7%204.7%200%200%201%20.853-.588c.795-.44%201.675-.647%202.61-.647%201.385%200%202.65.39%203.525%201.396.836.938%201.168%202.173%201.168%203.528q-.001.515-.056%201.051a1.255%201.255%200%200%201-.947%201.09l.408.952a1.255%201.255%200%200%201-.477%201.552c-.418.268-.92.463-1.458.612-.613.171-1.304.244-2.049.244-1.06%200-2.043-.207-2.886-.698l-.015-.008c-.798-.48-1.419-1.135-1.818-1.963l-.004-.008a5.8%205.8%200%200%201-.548-2.512q0-.429.053-.843a1.3%201.3%200%200%201-.333-.086l-.166-.004c-.223%200-.426.062-.643.228-.03.024-.142.139-.142.59v3.883a1.255%201.255%200%200%201-1.256%201.256h-1.777a1.255%201.255%200%200%201-1.256-1.256V15.69l-.032.057a4.8%204.8%200%200%201-1.86%201.833%205.04%205.04%200%200%201-2.484.634%204.5%204.5%200%200%201-1.935-.424%201.25%201.25%200%200%201-.764.258h-1.71a1.255%201.255%200%200%201-1.256-1.255V7.687a2.4%202.4%200%200%201-.428.625c.253.23.412.561.412.93v7.553a1.255%201.255%200%200%201-1.256%201.255h-1.843a1.25%201.25%200%200%201-.894-.373c-.228.23-.544.373-.894.373H51.32a1.255%201.255%200%200%201-1.256-1.255v-1.251l-.061.117a4.7%204.7%200%200%201-1.782%201.884%204.77%204.77%200%200%201-2.485.67%205.6%205.6%200%200%201-1.485-.188l.009%202.764a1.255%201.255%200%200%201-1.255%201.259h-1.729a1.255%201.255%200%200%201-1.255-1.255v-3.537a1.255%201.255%200%200%201-1.167.793h-1.679a1.25%201.25%200%200%201-.77-.263%204.5%204.5%200%200%201-1.945.429c-.885%200-1.724-.21-2.495-.632l-.017-.01a5%205%200%200%201-1.081-.836%201.255%201.255%200%200%201-1.254%201.312h-1.81a1.255%201.255%200%200%201-1.228-.99l-.782-3.625-2.044%203.939a1.25%201.25%200%200%201-1.115.676h-.098a1.25%201.25%200%200%201-1.116-.68l-2.061-3.994zM35.92%2016.63l.207-.114.223-.15q.493-.356.735-.785l.061-.118.033%201.332h1.678V9.242h-1.694l-.033%201.267q-.133-.329-.526-.658l-.032-.028a3.2%203.2%200%200%200-.668-.428l-.27-.12a3.3%203.3%200%200%200-1.235-.23q-1.136-.001-1.974.493a3.36%203.36%200%200%200-1.3%201.382q-.445.89-.444%202.074%200%201.2.51%202.107a3.8%203.8%200%200%200%201.382%201.381%203.9%203.9%200%200%200%201.893.477q.795%200%201.455-.33zm-2.789-5.38q-.576.675-.575%201.762%200%201.102.559%201.794.576.675%201.645.675a2.25%202.25%200%200%200%20.934-.19%202.2%202.2%200%200%200%20.468-.29l.178-.161a2.2%202.2%200%200%200%20.397-.561q.244-.5.244-1.15v-.115q0-.708-.296-1.267l-.043-.077a2.2%202.2%200%200%200-.633-.709l-.13-.086-.047-.028a2.1%202.1%200%200%200-1.073-.285q-1.052%200-1.629.692zm2.316%202.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.96.96%200%200%200-.353-.389.85.85%200%200%200-.464-.127c-.4%200-.56.114-.664.239l-.01.012c-.148.174-.275.45-.275.945%200%20.506.122.801.27.99.097.11.266.224.68.224.303%200%20.504-.09.687-.269zm7.545%201.705a2.6%202.6%200%200%200%20.331.423q.319.33.755.548l.173.074q.65.255%201.49.255%201.02%200%201.844-.493a3.45%203.45%200%200%200%201.316-1.4q.493-.904.493-2.089%200-1.909-.988-2.913-.988-1.02-2.584-1.02-.898%200-1.575.347a3%203%200%200%200-.415.262l-.199.166a3.4%203.4%200%200%200-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138q.206.29.48.5l.155.11.053.034q.51.296%201.119.297%201.07%200%201.645-.675.577-.69.576-1.762%200-1.119-.576-1.777-.558-.675-1.645-.675-.435%200-.835.16a2%202%200%200%200-.284.136%202%202%200%200%200-.363.254%202.2%202.2%200%200%200-.46.569l-.082.162a2.6%202.6%200%200%200-.213%201.072v.115q0%20.707.296%201.267l.135.211zm.964-.818a1.1%201.1%200%200%200%20.367.385.94.94%200%200%200%20.476.118c.423%200%20.59-.117.687-.23.159-.194.28-.478.28-.95%200-.53-.133-.8-.266-.952l-.021-.025c-.078-.094-.231-.221-.68-.221a1%201%200%200%200-.503.135l-.012.007a.86.86%200%200%200-.335.343c-.073.133-.132.324-.132.614v.115a1.4%201.4%200%200%200%20.14.66zm15.7-6.222q.347-.346.346-.856a1.05%201.05%200%200%200-.345-.79%201.18%201.18%200%200%200-.84-.329q-.51%200-.855.33a1.05%201.05%200%200%200-.346.79q0%20.51.346.855.345.346.856.346.51%200%20.839-.346zm4.337%209.314.033-1.332q.191.403.59.747l.098.081a4%204%200%200%200%20.316.224l.223.122a3.2%203.2%200%200%200%201.44.322%203.8%203.8%200%200%200%201.875-.477%203.5%203.5%200%200%200%201.382-1.366q.527-.89.526-2.09%200-1.184-.444-2.073a3.24%203.24%200%200%200-1.283-1.399q-.823-.51-1.942-.51a3.5%203.5%200%200%200-1.527.344l-.086.043-.165.09a3%203%200%200%200-.33.214q-.432.315-.656.707a2%202%200%200%200-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.5%202.5%200%200%200%20.566.7q.117.098.245.18l.144.08a2.1%202.1%200%200%200%20.975.232q1.07%200%201.645-.675.576-.69.576-1.778%200-1.102-.576-1.777-.56-.691-1.645-.692a2.2%202.2%200%200%200-1.015.235q-.22.113-.415.282l-.15.142a2.1%202.1%200%200%200-.42.594q-.223.479-.223%201.1v.115q0%20.705.293%201.26zm2.616-.293c.157-.191.28-.479.28-.967%200-.51-.13-.79-.276-.961l-.021-.026c-.082-.1-.232-.225-.67-.225a.87.87%200%200%200-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0%20.285.057.499.144.669a1.1%201.1%200%200%200%20.367.405c.137.082.28.123.455.123.423%200%20.59-.118.686-.23zm8.266-3.013q.345-.13.724-.14l.069-.002q.493%200%20.642.099l.247-1.794q-.196-.099-.717-.099a2.3%202.3%200%200%200-.545.063%202%202%200%200%200-.411.148%202.2%202.2%200%200%200-.4.249%202.5%202.5%200%200%200-.485.499%202.7%202.7%200%200%200-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884q0-.546.159-.943a1.5%201.5%200%200%201%20.466-.636%202.5%202.5%200%200%201%20.399-.253%202%202%200%200%201%20.224-.099zm9.784%202.656.05-.922q0-1.743-.856-2.698-.838-.97-2.584-.97-1.119-.001-2.007.493a3.46%203.46%200%200%200-1.4%201.382q-.493.906-.493%202.106%200%201.07.428%201.975.428.89%201.332%201.432.906.526%202.255.526.973%200%201.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%200-1.497-.444a1.6%201.6%200%200%201-.192-.193q-.366-.44-.512-1.234l-.004-.021zm-5.427-1.256-.003.022h3.752v-.138q-.011-.727-.288-1.118a1%201%200%200%200-.156-.176q-.46-.428-1.316-.428-.986%200-1.494.604-.379.45-.494%201.234zm-27.053%202.77V4.7h-1.86v12.095h5.333V15.15zm7.103-5.908v7.553h-1.843V9.242h1.843z%22%2F%3E%3Cpath%20fill%3D%22%23fff%22%20d%3D%22m19.63%2011.151-.757-1.71-.345%201.71-1.12%205.644h-1.827L18.083%204.7h.197l3.325%206.533.988%202.19.988-2.19L26.839%204.7h.181l2.6%2012.095h-1.81l-1.218-5.644-.362-1.71-.658%201.71-2.93%205.644h-.098l-2.913-5.644zm14.836%205.81q-1.02%200-1.893-.478a3.8%203.8%200%200%201-1.381-1.382q-.51-.906-.51-2.106%200-1.185.444-2.074a3.36%203.36%200%200%201%201.3-1.382q.839-.494%201.974-.494a3.3%203.3%200%200%201%201.234.231%203.3%203.3%200%200%201%20.97.575q.396.33.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332q-.279.593-1.02%201.053a3.17%203.17%200%200%201-1.662.444zm.296-1.482q.938%200%201.58-.642.642-.66.642-1.711v-.115q0-.708-.296-1.267a2.2%202.2%200%200%200-.807-.872%202.1%202.1%200%200%200-1.119-.313q-1.053%200-1.629.692-.575.675-.575%201.76%200%201.103.559%201.795.577.675%201.645.675zm6.521-6.237h1.711v1.4q.906-1.597%202.83-1.597%201.596%200%202.584%201.02.988%201.005.988%202.914%200%201.185-.493%202.09a3.46%203.46%200%200%201-1.316%201.399%203.5%203.5%200%200%201-1.844.493q-.954%200-1.662-.329a2.67%202.67%200%200%201-1.086-.97l.017%205.134h-1.728zm4.048%206.22q1.07%200%201.645-.674.577-.69.576-1.762%200-1.119-.576-1.777-.558-.675-1.645-.675-.592%200-1.12.296-.51.28-.822.823-.296.527-.296%201.234v.115q0%20.708.296%201.267.313.543.823.855.51.296%201.119.297z%22%2F%3E%3Cpath%20fill%3D%22%23e1e3e9%22%20d%3D%22M51.325%204.7h1.86v10.45h3.473v1.646h-5.333zm7.12%204.542h1.843v7.553h-1.843zm.905-1.415a1.16%201.16%200%200%201-.856-.346%201.17%201.17%200%200%201-.346-.856%201.05%201.05%200%200%201%20.346-.79q.346-.329.856-.329.494%200%20.839.33a1.05%201.05%200%200%201%20.345.79%201.16%201.16%200%200%201-.345.855q-.33.346-.84.346zm7.875%209.133a3.17%203.17%200%200%201-1.662-.444q-.723-.46-1.004-1.053l-.033%201.332h-1.71V4.701h1.743v4.657l-.082%201.283q.279-.658%201.086-1.119a3.5%203.5%200%200%201%201.778-.477q1.119%200%201.942.51a3.24%203.24%200%200%201%201.283%201.4q.445.888.444%202.072%200%201.201-.526%202.09a3.5%203.5%200%200%201-1.382%201.366%203.8%203.8%200%200%201-1.876.477zm-.296-1.481q1.069%200%201.645-.675.577-.69.577-1.778%200-1.102-.577-1.776-.56-.691-1.645-.692a2.12%202.12%200%200%200-1.58.659q-.642.641-.642%201.694v.115q0%20.71.296%201.267a2.4%202.4%200%200%200%20.807.872%202.1%202.1%200%200%200%201.119.313zm5.927-6.237h1.777v1.481q.263-.757.856-1.217a2.14%202.14%200%200%201%201.349-.46q.527%200%20.724.098l-.247%201.794q-.149-.099-.642-.099-.774%200-1.416.494-.626.493-.626%201.58v3.883h-1.777V9.242zm9.534%207.718q-1.35%200-2.255-.526-.904-.543-1.332-1.432a4.6%204.6%200%200%201-.428-1.975q0-1.2.493-2.106a3.46%203.46%200%200%201%201.4-1.382q.889-.495%202.007-.494%201.744%200%202.584.97.855.956.856%202.7%200%20.444-.05.92h-5.43q.18%201.005.708%201.45.542.443%201.497.443.79%200%201.3-.131a4%204%200%200%200%20.938-.362l.542%201.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%200-1.991%201.86z%22%2F%3E%3Cpath%20d%3D%22M5.074%2015.948a.484.657%200%200%200-.486.659v1.84a.484.657%200%200%200%20.486.659h4.101a.484.657%200%200%200%20.486-.659v-1.84a.484.657%200%200%200-.486-.659zm3.56%201.16H5.617v.838h3.017z%22%20style%3D%22fill%3A%23fff%3Bfill-rule%3Aevenodd%3Bstroke-width%3A1.03600001%22%2F%3E%3Cg%20style%3D%22stroke-width%3A1.12603545%22%3E%3Cpath%20d%3D%22M-9.408-1.416c-3.833-.025-7.056%202.912-7.08%206.615-.02%203.08%201.653%204.832%203.107%206.268.903.892%201.721%201.74%202.32%202.902l-.525-.004c-.543-.003-.992.304-1.24.639a1.87%201.87%200%200%200-.362%201.121l-.011%201.877c-.003.402.104.787.347%201.125.244.338.688.653%201.23.656l4.142.028c.542.003.99-.306%201.238-.641a1.87%201.87%200%200%200%20.363-1.121l.012-1.875a1.87%201.87%200%200%200-.348-1.127c-.243-.338-.688-.653-1.23-.656l-.518-.004c.597-1.145%201.425-1.983%202.348-2.87%201.473-1.414%203.18-3.149%203.2-6.226-.016-3.59-2.923-6.684-6.993-6.707m-.006%201.1v.002c3.274.02%205.92%202.532%205.9%205.6-.017%202.706-1.39%204.026-2.863%205.44-1.034.994-2.118%202.033-2.814%203.633-.018.041-.052.055-.075.065q-.013.004-.02.01a.34.34%200%200%201-.226.084.34.34%200%200%201-.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%202.7-5.545%205.975-5.523m-.02%202.826c-1.62-.01-2.944%201.315-2.955%202.96-.01%201.646%201.295%202.988%202.916%202.999h.002c1.621.01%202.943-1.316%202.953-2.961.011-1.646-1.294-2.988-2.916-2.998m-.005%201.1c1.017.006%201.829.83%201.822%201.89s-.83%201.874-1.848%201.867c-1.018-.006-1.829-.83-1.822-1.89s.83-1.874%201.848-1.868m-2.155%2011.857%204.14.025c.271.002.49.305.487.676l-.013%201.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%22%20style%3D%22color%3A%23000%3Bfont-style%3Anormal%3Bfont-variant%3Anormal%3Bfont-weight%3A400%3Bfont-stretch%3Anormal%3Bfont-size%3Amedium%3Bline-height%3Anormal%3Bfont-family%3Asans-serif%3Bfont-variant-ligatures%3Anormal%3Bfont-variant-position%3Anormal%3Bfont-variant-caps%3Anormal%3Bfont-variant-numeric%3Anormal%3Bfont-variant-alternates%3Anormal%3Bfont-feature-settings%3Anormal%3Btext-indent%3A0%3Btext-align%3Astart%3Btext-decoration%3Anone%3Btext-decoration-line%3Anone%3Btext-decoration-style%3Asolid%3Btext-decoration-color%3A%23000%3Bletter-spacing%3Anormal%3Bword-spacing%3Anormal%3Btext-transform%3Anone%3Bwriting-mode%3Alr-tb%3Bdirection%3Altr%3Btext-orientation%3Amixed%3Bdominant-baseline%3Aauto%3Bbaseline-shift%3Abaseline%3Btext-anchor%3Astart%3Bwhite-space%3Anormal%3Bshape-padding%3A0%3Bclip-rule%3Aevenodd%3Bdisplay%3Ainline%3Boverflow%3Avisible%3Bvisibility%3Avisible%3Bopacity%3A1%3Bisolation%3Aauto%3Bmix-blend-mode%3Anormal%3Bcolor-interpolation%3AsRGB%3Bcolor-interpolation-filters%3AlinearRGB%3Bsolid-color%3A%23000%3Bsolid-opacity%3A1%3Bvector-effect%3Anone%3Bfill%3A%23000%3Bfill-opacity%3A.4%3Bfill-rule%3Aevenodd%3Bstroke%3Anone%3Bstroke-width%3A2.47727823%3Bstroke-linecap%3Abutt%3Bstroke-linejoin%3Amiter%3Bstroke-miterlimit%3A4%3Bstroke-dasharray%3Anone%3Bstroke-dashoffset%3A0%3Bstroke-opacity%3A1%3Bcolor-rendering%3Aauto%3Bimage-rendering%3Aauto%3Bshape-rendering%3Aauto%3Btext-rendering%3Aauto%22%20transform%3D%22translate(15.553%202.85)scale(.88807)%22%2F%3E%3Cpath%20d%3D%22M-9.415-.316C-12.69-.338-15.37%202.14-15.39%205.207c-.017%202.716%201.326%204.041%202.78%205.477%201.013%201%202.081%202.055%202.78%203.67l.092.076a.34.34%200%200%200%20.225.086.34.34%200%200%200%20.227-.083l.019-.01c.022-.009.057-.024.074-.064.697-1.6%201.78-2.64%202.814-3.634%201.473-1.414%202.847-2.733%202.864-5.44.02-3.067-2.627-5.58-5.901-5.601m-.057%208.784c1.621.011%202.944-1.315%202.955-2.96.01-1.646-1.295-2.988-2.916-2.999-1.622-.01-2.945%201.315-2.955%202.96s1.295%202.989%202.916%203%22%20style%3D%22clip-rule%3Aevenodd%3Bfill%3A%23e1e3e9%3Bfill-opacity%3A1%3Bfill-rule%3Aevenodd%3Bstroke%3Anone%3Bstroke-width%3A2.47727823%3Bstroke-miterlimit%3A4%3Bstroke-dasharray%3Anone%3Bstroke-opacity%3A.4%22%20transform%3D%22translate(15.553%202.85)scale(.88807)%22%2F%3E%3Cpath%20d%3D%22M-11.594%2015.465c-.27-.002-.492.297-.494.668l-.012%201.876c-.003.371.214.673.485.675l4.14.027c.271.002.492-.298.495-.668l.012-1.877c.003-.37-.215-.672-.485-.674z%22%20style%3D%22clip-rule%3Aevenodd%3Bfill%3A%23fff%3Bfill-opacity%3A1%3Bfill-rule%3Aevenodd%3Bstroke%3Anone%3Bstroke-width%3A2.47727823%3Bstroke-miterlimit%3A4%3Bstroke-dasharray%3Anone%3Bstroke-opacity%3A.4%22%20transform%3D%22translate(15.553%202.85)scale(.88807)%22%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){a.maplibregl-ctrl-logo{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2288%22%20height%3D%2223%22%20fill%3D%22none%22%3E%3Cpath%20fill%3D%22%23000%22%20fill-opacity%3D%22.4%22%20fill-rule%3D%22evenodd%22%20d%3D%22M17.408%2016.796h-1.827l2.501-12.095h.198l3.324%206.533.988%202.19.988-2.19%203.258-6.533h.181l2.6%2012.095h-1.81l-1.218-5.644-.362-1.71-.658%201.71-2.929%205.644h-.098l-2.914-5.644-.757-1.71-.345%201.71zm1.958-3.42-.726%203.663a1.255%201.255%200%200%201-1.232%201.011h-1.827a1.255%201.255%200%200%201-1.229-1.509l2.501-12.095a1.255%201.255%200%200%201%201.23-1.001h.197a1.25%201.25%200%200%201%201.12.685l3.19%206.273%203.125-6.263a1.25%201.25%200%200%201%201.123-.695h.181a1.255%201.255%200%200%201%201.227.991l1.443%206.71a5%205%200%200%201%20.314-.787l.009-.016a4.6%204.6%200%200%201%201.777-1.887c.782-.46%201.668-.667%202.611-.667a4.6%204.6%200%200%201%201.7.32l.306.134c.21-.16.474-.256.759-.256h1.694a1.255%201.255%200%200%201%201.212.925%201.255%201.255%200%200%201%201.212-.925h1.711c.284%200%20.545.094.755.252.613-.3%201.312-.45%202.075-.45%201.356%200%202.557.445%203.482%201.4q.47.48.763%201.064V4.701a1.255%201.255%200%200%201%201.255-1.255h1.86A1.255%201.255%200%200%201%2054.44%204.7v9.194h2.217c.19%200%20.37.043.532.118v-4.77c0-.356.147-.678.385-.906a2.42%202.42%200%200%201-.682-1.71c0-.665.267-1.253.735-1.7a2.45%202.45%200%200%201%201.722-.674%202.43%202.43%200%200%201%201.705.675q.318.302.504.683V4.7a1.255%201.255%200%200%201%201.255-1.255h1.744A1.255%201.255%200%200%201%2065.812%204.7v3.335a4.8%204.8%200%200%201%201.526-.246c.938%200%201.817.214%202.59.69a4.47%204.47%200%200%201%201.67%201.743v-.98a1.255%201.255%200%200%201%201.256-1.256h1.777c.233%200%20.451.064.639.174a3.4%203.4%200%200%201%201.567-.372c.346%200%20.861.02%201.285.232a1.25%201.25%200%200%201%20.689%201.004%204.7%204.7%200%200%201%20.853-.588c.795-.44%201.675-.647%202.61-.647%201.385%200%202.65.39%203.525%201.396.836.938%201.168%202.173%201.168%203.528q-.001.515-.056%201.051a1.255%201.255%200%200%201-.947%201.09l.408.952a1.255%201.255%200%200%201-.477%201.552c-.418.268-.92.463-1.458.612-.613.171-1.304.244-2.049.244-1.06%200-2.043-.207-2.886-.698l-.015-.008c-.798-.48-1.419-1.135-1.818-1.963l-.004-.008a5.8%205.8%200%200%201-.548-2.512q0-.429.053-.843a1.3%201.3%200%200%201-.333-.086l-.166-.004c-.223%200-.426.062-.643.228-.03.024-.142.139-.142.59v3.883a1.255%201.255%200%200%201-1.256%201.256h-1.777a1.255%201.255%200%200%201-1.256-1.256V15.69l-.032.057a4.8%204.8%200%200%201-1.86%201.833%205.04%205.04%200%200%201-2.484.634%204.5%204.5%200%200%201-1.935-.424%201.25%201.25%200%200%201-.764.258h-1.71a1.255%201.255%200%200%201-1.256-1.255V7.687a2.4%202.4%200%200%201-.428.625c.253.23.412.561.412.93v7.553a1.255%201.255%200%200%201-1.256%201.255h-1.843a1.25%201.25%200%200%201-.894-.373c-.228.23-.544.373-.894.373H51.32a1.255%201.255%200%200%201-1.256-1.255v-1.251l-.061.117a4.7%204.7%200%200%201-1.782%201.884%204.77%204.77%200%200%201-2.485.67%205.6%205.6%200%200%201-1.485-.188l.009%202.764a1.255%201.255%200%200%201-1.255%201.259h-1.729a1.255%201.255%200%200%201-1.255-1.255v-3.537a1.255%201.255%200%200%201-1.167.793h-1.679a1.25%201.25%200%200%201-.77-.263%204.5%204.5%200%200%201-1.945.429c-.885%200-1.724-.21-2.495-.632l-.017-.01a5%205%200%200%201-1.081-.836%201.255%201.255%200%200%201-1.254%201.312h-1.81a1.255%201.255%200%200%201-1.228-.99l-.782-3.625-2.044%203.939a1.25%201.25%200%200%201-1.115.676h-.098a1.25%201.25%200%200%201-1.116-.68l-2.061-3.994zM35.92%2016.63l.207-.114.223-.15q.493-.356.735-.785l.061-.118.033%201.332h1.678V9.242h-1.694l-.033%201.267q-.133-.329-.526-.658l-.032-.028a3.2%203.2%200%200%200-.668-.428l-.27-.12a3.3%203.3%200%200%200-1.235-.23q-1.136-.001-1.974.493a3.36%203.36%200%200%200-1.3%201.382q-.445.89-.444%202.074%200%201.2.51%202.107a3.8%203.8%200%200%200%201.382%201.381%203.9%203.9%200%200%200%201.893.477q.795%200%201.455-.33zm-2.789-5.38q-.576.675-.575%201.762%200%201.102.559%201.794.576.675%201.645.675a2.25%202.25%200%200%200%20.934-.19%202.2%202.2%200%200%200%20.468-.29l.178-.161a2.2%202.2%200%200%200%20.397-.561q.244-.5.244-1.15v-.115q0-.708-.296-1.267l-.043-.077a2.2%202.2%200%200%200-.633-.709l-.13-.086-.047-.028a2.1%202.1%200%200%200-1.073-.285q-1.052%200-1.629.692zm2.316%202.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.96.96%200%200%200-.353-.389.85.85%200%200%200-.464-.127c-.4%200-.56.114-.664.239l-.01.012c-.148.174-.275.45-.275.945%200%20.506.122.801.27.99.097.11.266.224.68.224.303%200%20.504-.09.687-.269zm7.545%201.705a2.6%202.6%200%200%200%20.331.423q.319.33.755.548l.173.074q.65.255%201.49.255%201.02%200%201.844-.493a3.45%203.45%200%200%200%201.316-1.4q.493-.904.493-2.089%200-1.909-.988-2.913-.988-1.02-2.584-1.02-.898%200-1.575.347a3%203%200%200%200-.415.262l-.199.166a3.4%203.4%200%200%200-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138q.206.29.48.5l.155.11.053.034q.51.296%201.119.297%201.07%200%201.645-.675.577-.69.576-1.762%200-1.119-.576-1.777-.558-.675-1.645-.675-.435%200-.835.16a2%202%200%200%200-.284.136%202%202%200%200%200-.363.254%202.2%202.2%200%200%200-.46.569l-.082.162a2.6%202.6%200%200%200-.213%201.072v.115q0%20.707.296%201.267l.135.211zm.964-.818a1.1%201.1%200%200%200%20.367.385.94.94%200%200%200%20.476.118c.423%200%20.59-.117.687-.23.159-.194.28-.478.28-.95%200-.53-.133-.8-.266-.952l-.021-.025c-.078-.094-.231-.221-.68-.221a1%201%200%200%200-.503.135l-.012.007a.86.86%200%200%200-.335.343c-.073.133-.132.324-.132.614v.115a1.4%201.4%200%200%200%20.14.66zm15.7-6.222q.347-.346.346-.856a1.05%201.05%200%200%200-.345-.79%201.18%201.18%200%200%200-.84-.329q-.51%200-.855.33a1.05%201.05%200%200%200-.346.79q0%20.51.346.855.345.346.856.346.51%200%20.839-.346zm4.337%209.314.033-1.332q.191.403.59.747l.098.081a4%204%200%200%200%20.316.224l.223.122a3.2%203.2%200%200%200%201.44.322%203.8%203.8%200%200%200%201.875-.477%203.5%203.5%200%200%200%201.382-1.366q.527-.89.526-2.09%200-1.184-.444-2.073a3.24%203.24%200%200%200-1.283-1.399q-.823-.51-1.942-.51a3.5%203.5%200%200%200-1.527.344l-.086.043-.165.09a3%203%200%200%200-.33.214q-.432.315-.656.707a2%202%200%200%200-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.5%202.5%200%200%200%20.566.7q.117.098.245.18l.144.08a2.1%202.1%200%200%200%20.975.232q1.07%200%201.645-.675.576-.69.576-1.778%200-1.102-.576-1.777-.56-.691-1.645-.692a2.2%202.2%200%200%200-1.015.235q-.22.113-.415.282l-.15.142a2.1%202.1%200%200%200-.42.594q-.223.479-.223%201.1v.115q0%20.705.293%201.26zm2.616-.293c.157-.191.28-.479.28-.967%200-.51-.13-.79-.276-.961l-.021-.026c-.082-.1-.232-.225-.67-.225a.87.87%200%200%200-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0%20.285.057.499.144.669a1.1%201.1%200%200%200%20.367.405c.137.082.28.123.455.123.423%200%20.59-.118.686-.23zm8.266-3.013q.345-.13.724-.14l.069-.002q.493%200%20.642.099l.247-1.794q-.196-.099-.717-.099a2.3%202.3%200%200%200-.545.063%202%202%200%200%200-.411.148%202.2%202.2%200%200%200-.4.249%202.5%202.5%200%200%200-.485.499%202.7%202.7%200%200%200-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884q0-.546.159-.943a1.5%201.5%200%200%201%20.466-.636%202.5%202.5%200%200%201%20.399-.253%202%202%200%200%201%20.224-.099zm9.784%202.656.05-.922q0-1.743-.856-2.698-.838-.97-2.584-.97-1.119-.001-2.007.493a3.46%203.46%200%200%200-1.4%201.382q-.493.906-.493%202.106%200%201.07.428%201.975.428.89%201.332%201.432.906.526%202.255.526.973%200%201.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%200-1.497-.444a1.6%201.6%200%200%201-.192-.193q-.366-.44-.512-1.234l-.004-.021zm-5.427-1.256-.003.022h3.752v-.138q-.011-.727-.288-1.118a1%201%200%200%200-.156-.176q-.46-.428-1.316-.428-.986%200-1.494.604-.379.45-.494%201.234zm-27.053%202.77V4.7h-1.86v12.095h5.333V15.15zm7.103-5.908v7.553h-1.843V9.242h1.843z%22%2F%3E%3Cpath%20fill%3D%22%23fff%22%20d%3D%22m19.63%2011.151-.757-1.71-.345%201.71-1.12%205.644h-1.827L18.083%204.7h.197l3.325%206.533.988%202.19.988-2.19L26.839%204.7h.181l2.6%2012.095h-1.81l-1.218-5.644-.362-1.71-.658%201.71-2.93%205.644h-.098l-2.913-5.644zm14.836%205.81q-1.02%200-1.893-.478a3.8%203.8%200%200%201-1.381-1.382q-.51-.906-.51-2.106%200-1.185.444-2.074a3.36%203.36%200%200%201%201.3-1.382q.839-.494%201.974-.494a3.3%203.3%200%200%201%201.234.231%203.3%203.3%200%200%201%20.97.575q.396.33.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332q-.279.593-1.02%201.053a3.17%203.17%200%200%201-1.662.444zm.296-1.482q.938%200%201.58-.642.642-.66.642-1.711v-.115q0-.708-.296-1.267a2.2%202.2%200%200%200-.807-.872%202.1%202.1%200%200%200-1.119-.313q-1.053%200-1.629.692-.575.675-.575%201.76%200%201.103.559%201.795.577.675%201.645.675zm6.521-6.237h1.711v1.4q.906-1.597%202.83-1.597%201.596%200%202.584%201.02.988%201.005.988%202.914%200%201.185-.493%202.09a3.46%203.46%200%200%201-1.316%201.399%203.5%203.5%200%200%201-1.844.493q-.954%200-1.662-.329a2.67%202.67%200%200%201-1.086-.97l.017%205.134h-1.728zm4.048%206.22q1.07%200%201.645-.674.577-.69.576-1.762%200-1.119-.576-1.777-.558-.675-1.645-.675-.592%200-1.12.296-.51.28-.822.823-.296.527-.296%201.234v.115q0%20.708.296%201.267.313.543.823.855.51.296%201.119.297z%22%2F%3E%3Cpath%20fill%3D%22%23e1e3e9%22%20d%3D%22M51.325%204.7h1.86v10.45h3.473v1.646h-5.333zm7.12%204.542h1.843v7.553h-1.843zm.905-1.415a1.16%201.16%200%200%201-.856-.346%201.17%201.17%200%200%201-.346-.856%201.05%201.05%200%200%201%20.346-.79q.346-.329.856-.329.494%200%20.839.33a1.05%201.05%200%200%201%20.345.79%201.16%201.16%200%200%201-.345.855q-.33.346-.84.346zm7.875%209.133a3.17%203.17%200%200%201-1.662-.444q-.723-.46-1.004-1.053l-.033%201.332h-1.71V4.701h1.743v4.657l-.082%201.283q.279-.658%201.086-1.119a3.5%203.5%200%200%201%201.778-.477q1.119%200%201.942.51a3.24%203.24%200%200%201%201.283%201.4q.445.888.444%202.072%200%201.201-.526%202.09a3.5%203.5%200%200%201-1.382%201.366%203.8%203.8%200%200%201-1.876.477zm-.296-1.481q1.069%200%201.645-.675.577-.69.577-1.778%200-1.102-.577-1.776-.56-.691-1.645-.692a2.12%202.12%200%200%200-1.58.659q-.642.641-.642%201.694v.115q0%20.71.296%201.267a2.4%202.4%200%200%200%20.807.872%202.1%202.1%200%200%200%201.119.313zm5.927-6.237h1.777v1.481q.263-.757.856-1.217a2.14%202.14%200%200%201%201.349-.46q.527%200%20.724.098l-.247%201.794q-.149-.099-.642-.099-.774%200-1.416.494-.626.493-.626%201.58v3.883h-1.777V9.242zm9.534%207.718q-1.35%200-2.255-.526-.904-.543-1.332-1.432a4.6%204.6%200%200%201-.428-1.975q0-1.2.493-2.106a3.46%203.46%200%200%201%201.4-1.382q.889-.495%202.007-.494%201.744%200%202.584.97.855.956.856%202.7%200%20.444-.05.92h-5.43q.18%201.005.708%201.45.542.443%201.497.443.79%200%201.3-.131a4%204%200%200%200%20.938-.362l.542%201.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%200-1.991%201.86z%22%2F%3E%3Cpath%20d%3D%22M5.074%2015.948a.484.657%200%200%200-.486.659v1.84a.484.657%200%200%200%20.486.659h4.101a.484.657%200%200%200%20.486-.659v-1.84a.484.657%200%200%200-.486-.659zm3.56%201.16H5.617v.838h3.017z%22%20style%3D%22fill%3A%23fff%3Bfill-rule%3Aevenodd%3Bstroke-width%3A1.03600001%22%2F%3E%3Cg%20style%3D%22stroke-width%3A1.12603545%22%3E%3Cpath%20d%3D%22M-9.408-1.416c-3.833-.025-7.056%202.912-7.08%206.615-.02%203.08%201.653%204.832%203.107%206.268.903.892%201.721%201.74%202.32%202.902l-.525-.004c-.543-.003-.992.304-1.24.639a1.87%201.87%200%200%200-.362%201.121l-.011%201.877c-.003.402.104.787.347%201.125.244.338.688.653%201.23.656l4.142.028c.542.003.99-.306%201.238-.641a1.87%201.87%200%200%200%20.363-1.121l.012-1.875a1.87%201.87%200%200%200-.348-1.127c-.243-.338-.688-.653-1.23-.656l-.518-.004c.597-1.145%201.425-1.983%202.348-2.87%201.473-1.414%203.18-3.149%203.2-6.226-.016-3.59-2.923-6.684-6.993-6.707m-.006%201.1v.002c3.274.02%205.92%202.532%205.9%205.6-.017%202.706-1.39%204.026-2.863%205.44-1.034.994-2.118%202.033-2.814%203.633-.018.041-.052.055-.075.065q-.013.004-.02.01a.34.34%200%200%201-.226.084.34.34%200%200%201-.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%202.7-5.545%205.975-5.523m-.02%202.826c-1.62-.01-2.944%201.315-2.955%202.96-.01%201.646%201.295%202.988%202.916%202.999h.002c1.621.01%202.943-1.316%202.953-2.961.011-1.646-1.294-2.988-2.916-2.998m-.005%201.1c1.017.006%201.829.83%201.822%201.89s-.83%201.874-1.848%201.867c-1.018-.006-1.829-.83-1.822-1.89s.83-1.874%201.848-1.868m-2.155%2011.857%204.14.025c.271.002.49.305.487.676l-.013%201.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%22%20style%3D%22color%3A%23000%3Bfont-style%3Anormal%3Bfont-variant%3Anormal%3Bfont-weight%3A400%3Bfont-stretch%3Anormal%3Bfont-size%3Amedium%3Bline-height%3Anormal%3Bfont-family%3Asans-serif%3Bfont-variant-ligatures%3Anormal%3Bfont-variant-position%3Anormal%3Bfont-variant-caps%3Anormal%3Bfont-variant-numeric%3Anormal%3Bfont-variant-alternates%3Anormal%3Bfont-feature-settings%3Anormal%3Btext-indent%3A0%3Btext-align%3Astart%3Btext-decoration%3Anone%3Btext-decoration-line%3Anone%3Btext-decoration-style%3Asolid%3Btext-decoration-color%3A%23000%3Bletter-spacing%3Anormal%3Bword-spacing%3Anormal%3Btext-transform%3Anone%3Bwriting-mode%3Alr-tb%3Bdirection%3Altr%3Btext-orientation%3Amixed%3Bdominant-baseline%3Aauto%3Bbaseline-shift%3Abaseline%3Btext-anchor%3Astart%3Bwhite-space%3Anormal%3Bshape-padding%3A0%3Bclip-rule%3Aevenodd%3Bdisplay%3Ainline%3Boverflow%3Avisible%3Bvisibility%3Avisible%3Bopacity%3A1%3Bisolation%3Aauto%3Bmix-blend-mode%3Anormal%3Bcolor-interpolation%3AsRGB%3Bcolor-interpolation-filters%3AlinearRGB%3Bsolid-color%3A%23000%3Bsolid-opacity%3A1%3Bvector-effect%3Anone%3Bfill%3A%23000%3Bfill-opacity%3A.4%3Bfill-rule%3Aevenodd%3Bstroke%3Anone%3Bstroke-width%3A2.47727823%3Bstroke-linecap%3Abutt%3Bstroke-linejoin%3Amiter%3Bstroke-miterlimit%3A4%3Bstroke-dasharray%3Anone%3Bstroke-dashoffset%3A0%3Bstroke-opacity%3A1%3Bcolor-rendering%3Aauto%3Bimage-rendering%3Aauto%3Bshape-rendering%3Aauto%3Btext-rendering%3Aauto%22%20transform%3D%22translate(15.553%202.85)scale(.88807)%22%2F%3E%3Cpath%20d%3D%22M-9.415-.316C-12.69-.338-15.37%202.14-15.39%205.207c-.017%202.716%201.326%204.041%202.78%205.477%201.013%201%202.081%202.055%202.78%203.67l.092.076a.34.34%200%200%200%20.225.086.34.34%200%200%200%20.227-.083l.019-.01c.022-.009.057-.024.074-.064.697-1.6%201.78-2.64%202.814-3.634%201.473-1.414%202.847-2.733%202.864-5.44.02-3.067-2.627-5.58-5.901-5.601m-.057%208.784c1.621.011%202.944-1.315%202.955-2.96.01-1.646-1.295-2.988-2.916-2.999-1.622-.01-2.945%201.315-2.955%202.96s1.295%202.989%202.916%203%22%20style%3D%22clip-rule%3Aevenodd%3Bfill%3A%23e1e3e9%3Bfill-opacity%3A1%3Bfill-rule%3Aevenodd%3Bstroke%3Anone%3Bstroke-width%3A2.47727823%3Bstroke-miterlimit%3A4%3Bstroke-dasharray%3Anone%3Bstroke-opacity%3A.4%22%20transform%3D%22translate(15.553%202.85)scale(.88807)%22%2F%3E%3Cpath%20d%3D%22M-11.594%2015.465c-.27-.002-.492.297-.494.668l-.012%201.876c-.003.371.214.673.485.675l4.14.027c.271.002.492-.298.495-.668l.012-1.877c.003-.37-.215-.672-.485-.674z%22%20style%3D%22clip-rule%3Aevenodd%3Bfill%3A%23fff%3Bfill-opacity%3A1%3Bfill-rule%3Aevenodd%3Bstroke%3Anone%3Bstroke-width%3A2.47727823%3Bstroke-miterlimit%3A4%3Bstroke-dasharray%3Anone%3Bstroke-opacity%3A.4%22%20transform%3D%22translate(15.553%202.85)scale(.88807)%22%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E")}}.maplibregl-ctrl.maplibregl-ctrl-attrib{padding:0 5px;background-color:hsla(0,0%,100%,.5);margin:0}@media screen{.maplibregl-ctrl-attrib.maplibregl-compact{min-height:20px;padding:2px 24px 2px 0;margin:10px;position:relative;background-color:#fff;color:#000;border-radius:12px;box-sizing:content-box}.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{padding:2px 8px 2px 28px;border-radius:12px}.maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-inner{display:none}.maplibregl-ctrl-attrib-button{display:none;cursor:pointer;position:absolute;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20fill-rule%3D%22evenodd%22%20viewBox%3D%220%200%2020%2020%22%3E%3Cpath%20d%3D%22M4%2010a6%206%200%201%200%2012%200%206%206%200%201%200-12%200m5-3a1%201%200%201%200%202%200%201%201%200%201%200-2%200m0%203a1%201%200%201%201%202%200v3a1%201%200%201%201-2%200%22%2F%3E%3C%2Fsvg%3E");background-color:hsla(0,0%,100%,.5);width:24px;height:24px;box-sizing:border-box;border-radius:12px;outline:none;top:0;right:0;border:0}.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{top:0;right:0}.maplibregl-ctrl-top-left>.maplibregl-ctrl-attrib.maplibregl-compact:after{top:0;left: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("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23fff%22%20fill-rule%3D%22evenodd%22%20viewBox%3D%220%200%2020%2020%22%3E%3Cpath%20d%3D%22M4%2010a6%206%200%201%200%2012%200%206%206%200%201%200-12%200m5-3a1%201%200%201%200%202%200%201%201%200%201%200-2%200m0%203a1%201%200%201%201%202%200v3a1%201%200%201%201-2%200%22%2F%3E%3C%2Fsvg%3E")}}@media screen and (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl-attrib.maplibregl-compact:after{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20fill-rule%3D%22evenodd%22%20viewBox%3D%220%200%2020%2020%22%3E%3Cpath%20d%3D%22M4%2010a6%206%200%201%200%2012%200%206%206%200%201%200-12%200m5-3a1%201%200%201%200%202%200%201%201%200%201%200-2%200m0%203a1%201%200%201%201%202%200v3a1%201%200%201%201-2%200%22%2F%3E%3C%2Fsvg%3E")}}.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);font-size:10px;white-space:nowrap;border-color:#333;border-style:none solid solid;border-width:medium 2px 2px;padding:0 5px;color:#333;box-sizing:border-box}.maplibregl-popup{position:absolute;top:0;left:0;display:flex;will-change:transform;pointer-events:none}.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{width:0;height:0;border:10px solid transparent;z-index:1}.maplibregl-popup-anchor-top .maplibregl-popup-tip{align-self:center;border-top:none;border-bottom-color:#fff}.maplibregl-popup-anchor-top-left .maplibregl-popup-tip{align-self:flex-start;border-top:none;border-left:none;border-bottom-color:#fff}.maplibregl-popup-anchor-top-right .maplibregl-popup-tip{align-self:flex-end;border-top:none;border-right:none;border-bottom-color:#fff}.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-right:none;border-left-color:#fff}[dir=rtl] .maplibregl-popup-anchor-left{flex-direction:row-reverse}[dir=rtl] .maplibregl-popup-anchor-right{flex-direction:row}[dir=rtl] .maplibregl-popup-anchor-top-left .maplibregl-popup-tip{align-self:flex-end}[dir=rtl] .maplibregl-popup-anchor-top-right .maplibregl-popup-tip{align-self:flex-start}[dir=rtl] .maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip{align-self:flex-end}[dir=rtl] .maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip{align-self:flex-start}.maplibregl-popup-close-button{position:absolute;right:0;top:0;border:0;border-radius:0 3px 0 0;cursor:pointer;background-color:transparent}.maplibregl-popup-close-button:hover{background-color:rgba(0,0,0,.05)}.maplibregl-popup-content{position:relative;background:#fff;border-radius:3px;box-shadow:0 1px 2px rgba(0,0,0,.1);padding:15px 10px;pointer-events:auto}.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{position:absolute;top:0;left:0;will-change:transform;transition:opacity .2s}.maplibregl-marker-draggable{cursor:grab}.maplibregl-user-location-dot,.maplibregl-user-location-dot:before{background-color:#1da1f2;width:15px;height:15px;border-radius:50%}.maplibregl-user-location-dot:before{content:"";position:absolute;animation:maplibregl-user-location-dot-pulse 2s infinite}.maplibregl-user-location-dot:after{border-radius:50%;border:2px solid #fff;content:"";height:19px;left:-2px;position:absolute;top:-2px;width:19px;box-sizing:border-box;box-shadow:0 0 3px rgba(0,0,0,.35)}@media (prefers-reduced-motion:reduce){.maplibregl-user-location-dot:before{animation:none}}@keyframes maplibregl-user-location-dot-pulse{0%{transform:scale(1);opacity:1}70%{transform:scale(3);opacity:0}to{transform:scale(1);opacity:0}}.maplibregl-user-location-dot-stale{background-color:#aaa}.maplibregl-user-location-dot-stale:after{display:none}.maplibregl-user-location-accuracy-circle{background-color:#1da1f233;width:1px;height:1px;border-radius:100%}.maplibregl-crosshair,.maplibregl-crosshair .maplibregl-interactive,.maplibregl-crosshair .maplibregl-interactive:active{cursor:crosshair}.maplibregl-boxzoom{position:absolute;top:0;left:0;width:0;height:0;background:#fff;border:2px dotted #202020;opacity:.5}.maplibregl-cooperative-gesture-screen{background:rgba(0,0,0,.4);position:absolute;inset:0;display:flex;justify-content:center;align-items:center;color:#fff;padding:1rem;font-size:1.4em;line-height:1.2;opacity:0;pointer-events:none;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{position:fixed!important;width:100%!important;height:100%!important;top:0!important;left:0!important;z-index:99999}');const HB=new CSSStyleSheet;HB.replaceSync(".maplibregl-map.pnx-map {\n\tbackground: white;\n}\n\n/* Picture thumbnail on map */\n.maplibregl-popup-content {\n\tpadding: 5px !important;\n\tposition: relative;\n\tpointer-events: none !important;\n}\n\n.pnx-map-thumb {\n\tdisplay: inline-block;\n\ttext-align: center;\n\tvertical-align: middle;\n\tmax-width: 130px;\n\tmax-height: 130px;\n}\n\n@keyframes rotating {\n\tfrom { transform: rotate(0deg); }\n\tto { transform: rotate(360deg); }\n}\n\n.pnx-map-thumb-loader {\n\tbackground-color: rgb(230,230,230);\n\tborder-radius: 65px;\n\tmax-height: 60px;\n\tmargin: 5px 35px;\n\tanimation: rotating 2s linear infinite;\n}\n\n.pnx-map-thumb-legend {\n\tdisplay: block;\n\tposition: absolute;\n\tbottom: 5px;\n\tright: 5px;\n\tleft: 5px;\n\tbackground-color: rgba(0,0,0,0.8);\n\tcolor: white;\n\ttext-align: center;\n\tfont-style: italic;\n\tfont-size: 0.8em;\n\tmargin: 0;\n\tpadding: 0;\n}\n\n.maplibregl-marker {\n\twidth: 60px;\n}\n\n/* Resize canvas for print */\n@media print {\n\t.pnx-map.maplibregl-map .maplibregl-canvas-container {\n\t\twidth: 100% !important;\n\t\theight: unset !important;\n\t}\n}\n\n/* Discard default indoor= widget */\n.pnx-map .maplibregl-ctrl-indoorequal {\n\tdisplay: none;\n}"),document.adoptedStyleSheets.push(GB),document.adoptedStyleSheets.push(HB),function(e){Vh.WORKER_URL=e}(new URL("./maplibre-gl-worker.mjs","undefined"==typeof document?require("url").pathToFileURL(__filename).href:e&&"SCRIPT"===e.tagName.toUpperCase()&&e.src||new URL("index.js",document.baseURI).href).toString()),Gh("pmtiles",(new vB).tile),Gh("panora",(new Pc).tile()),Gh("panoras",(new Pc).tile());let WB=class extends rL{constructor(e,t,i={}){super({container:t,style:e.mapStyleComposer.getMapStyle(),center:[0,0],zoom:0,maxZoom:24,attributionControl:!1,dragRotate:!1,pitchWithRotate:!1,touchZoomRotate:!0,touchPitch:!1,doubleClickZoom:!1,canvasContextAttributes:{preserveDrawingBuffer:!e.isWidthSmall()},transformRequest:e.api._getMapRequestTransform(),locale:e._t.maplibre,hash:!1,...i}),this._semMapProtocol=new kc(e),Gh("sem",this._semMapProtocol.tile()),this._loadMarkerImages(),this._parent=e,this._parent.mapStyleComposer.map=this,this._options=i,this.getContainer().classList.add("pnx-map"),void 0===i.touchZoomRotate&&this?.touchZoomRotate?.disableRotation(),this._options.raster&&(this._options.background=this._options.background||"streets"),this._options.basemaps&&this._parent.mapStyleComposer._createManyBasemaps(this._options.basemaps,this._options.background),Rc(this,![void 0,Ic].includes(this._options?.indoor?.level)),this._attribution=new QR({compact:!1,...i.attributionControl}),this.addControl(this._attribution),this._scale=new CL,this.addControl(this._scale),this._initMapPosition(),this._picMarker=this._getPictureMarker(),this._picMarkerPreview=this._getPictureMarker(!1),this._picPreviewTimer=null,this._picPopup=new zL({closeButton:!1,closeOnClick:!this._parent.isWidthSmall(),offset:15}),this.on("mouseout",()=>{this._parent?.isMapWide?.()||(this.getCanvas().style.cursor="",this._dropPreview())}),this._picThumbUrl={},this._seqPictures={},this._parent.addEventListener("select",this._parent.mapStyleComposer.updateMapStyle.bind(this._parent.mapStyleComposer)),this._parent.mapStyleComposer.addEventListener("panoramax-changed",this._onPanoramaxChanged.bind(this)),setTimeout(()=>{!this.loaded()&&this._parent?.loader.isVisible()&&this._parent.loader.dismiss({},this._parent._t.map.slow_loading,async()=>{await this._postLoad(),this._parent.loader.dismiss()})},15e3),this.waitForEnoughMapLoaded().then(async()=>await this._postLoad())}_postLoad(){this.resize(),this.fire("ready")}_dropPreview(e){clearTimeout(this._picDropPreviewTimer),e?this._picDropPreviewTimer=setTimeout(this._dropPreview.bind(this),250):(clearTimeout(this._picPreviewTimer),delete this._picPopup._picId,delete this._picPopup._loading,this._picPopup.remove(),this._picMarkerPreview.remove(),this._picPinMarker?.remove?.())}destroy(){this.remove(),delete this._semMapProtocol,delete this._parent,delete this._options,delete this._attribution,delete this._scale,delete this._picMarker,delete this._picMarkerPreview,delete this._picPreviewTimer,delete this._picPopup,delete this._picThumbUrl,delete this._seqPictures,delete this._picPinMarker}waitForEnoughMapLoaded(){return new Promise(e=>{let t=0,i=0,n=0,a=0;const r=e=>{"source"===e.dataType&&e.tile&&(e.sourceId.startsWith("geovisio")?i++:t++)},s=e=>{"source"===e.dataType&&e.tile&&(e.sourceId.startsWith("geovisio")?(a++,e.isSourceLoaded&&(a=i)):(n++,e.isSourceLoaded&&(n=t))),o()},o=()=>{n/t>=.75&&(0===i||a/i>=.75)&&(this.off("sourcedata",s),this.off("sourcedataloading",r),e())};this.on("sourcedataloading",r),this.on("sourcedata",s)})}_initMapPosition(){!Do(this._options.center)||this._options.zoom&&0!==this._options.zoom||this._options.hash||this._parent.onceAPIReady().then(()=>{let e=this._parent?.api?.getDataBbox();if(e)try{e=new gT(e),this.loaded()?this.fitBounds(e,{animate:!1}):this.waitForEnoughMapLoaded().then(()=>this.fitBounds(e,{animate:!1}))}catch(t){console.warn("Received invalid bbox: "+e)}})}addSource(e,t){this._parent.mapStyleComposer.registerSource(e,t),super.addSource(e,t)}addLayer(e,t){this._parent.mapStyleComposer.registerLayer(e,t),super.addLayer(e,t)}_loadMarkerImages(){[{id:"pnx-marker",img:uo}].forEach(e=>{const t=new Image(64,64);t.onload=()=>this.addImage(e.id,t),Ue(e.img,t)})}_hasQualityScore(){const e=this.getStyle()?.metadata?.["panoramax:fields"]||{};return e?.pictures?.includes("gps_accuracy")&&e?.pictures?.includes("h_pixel_density")}_hasGridStats(){const e=this.getStyle()?.metadata?.["panoramax:fields"]||{};return e?.grid?.includes("nb_360_pictures")&&e?.grid?.includes("nb_flat_pictures")&&e?.grid?.includes("coef_360_pictures")&&e?.grid?.includes("coef_flat_pictures")}_hasLoggedGridStats(){const e=this.getStyle()?.metadata?.["panoramax:fields"]||{};return e?.grid?.includes("logged_coef_360_pictures")&&e?.grid?.includes("logged_coef_flat_pictures")&&e?.grid?.includes("logged_coef")}reloadVectorTiles(){this._parent.mapStyleComposer?.layerRanges?.panoramax&&Object.values(this._parent.mapStyleComposer.layerRanges.panoramax).forEach(e=>{Object.keys(e.sources).forEach(e=>{const t=this.getSource(e);t&&t.setTiles(t.tiles)})})}displayPictureMarker(e,t,i,n=!1,a=null){this._picMarkerPreview.remove(),this._picPinMarker?.remove?.(),void 0!==e&&void 0!==t?(this._picMarker.setLngLat([e,t]).setRotation(i).addTo(this),this._picMarker.picId=a):this._picMarker.remove(),this._parent.mapStyleComposer.updateMapStyle(),n||void 0===e||void 0===t||this.jumpTo({center:[e,t],zoom:this.getZoom()<17?17:this.getZoom()})}_onPanoramaxChanged(){const e=this._parent.mapStyleComposer,t=e.layerRanges.panoramax[e.panoramax].layers.find(e=>e.id.endsWith("_pictures"))?.id,i=e.layerRanges.panoramax[e.panoramax].layers.find(e=>e.id.endsWith("_sequences_plus"))?.id,n=e.layerRanges.panoramax[e.panoramax].layers.find(e=>e.id.endsWith("_grid"))?.id;t&&i||console.error("Panoramax source not loaded"),this.on("mousemove",t,e=>{this.getCanvas().style.cursor="pointer";const i=Object.assign({},e);this._attachPreviewToPictures(i,t)}),this.on("mouseleave",t,()=>{this.getCanvas().style.cursor=""}),this.on("click",t,this._onPictureClick.bind(this)),this.on("mousemove",i,e=>{if(!(this.getZoom()>=po)&&(this._onSequenceHover(e),this.getCanvas().style.cursor="pointer",e.features[0].properties.id)){const t=Object.assign({},e);this._attachPreviewToPictures(t,i)}}),this.on("mouseleave",i,()=>{this.getZoom()>=po||(this.getCanvas().style.cursor="",this._dropPreview(!0))}),this.on("click",i,e=>{e.preventDefault(),this._onSequenceClick(e)}),n&&(this.on("mousemove",n,e=>{if(this.getZoom()<=16){this.getCanvas().style.cursor="pointer";const t=Object.assign({},e);this._attachPreviewToPictures(t,n)}}),this.on("mouseleave",n,()=>{this.getZoom()>=po||(this._dropPreview(),this.getCanvas().style.cursor="")}),this.on("click",n,e=>{e.preventDefault();const t=e.features[0];t.properties.best_item?(this._parent.select(null,t.properties.best_item),this._parent._setFocus?.("pic")):this.flyTo({center:e.lngLat,zoom:9})}))}_attachPreviewToPictures(e,t){let i=e.features.pop();if(!i)return void this._picPinMarker?.remove?.();if(!i||(i.properties.id||i.properties.best_item)==this._picPopup._picId)return;clearTimeout(this._picPreviewTimer),clearTimeout(this._picDropPreviewTimer),this._picPopup._loading=i.properties.id,this._picPopup._picId=i.properties.id,delete this._picPopup._seqId,e.lngLat||(e.lngLat=this.getCenter());let n=null;if(t.includes("_pictures")&&"Point"===i.geometry.type)n=i;else if(t.includes("_grid")&&"Polygon"===i.geometry.type)n={type:"Feature",geometry:{type:"Point",coordinates:i.geometry.coordinates[0][0]},properties:{id:i.properties.best_item}};else if(this.getZoom()<po&&t.includes("_sequences")&&"LineString"===i.geometry.type){let t=null;for(let a=0;a<i.geometry.coordinates.length;a++){let r=e.lngLat.distanceTo(new Ex(...i.geometry.coordinates[a]));(!t||r<t)&&(n={type:"Feature",geometry:{type:"Point",coordinates:i.geometry.coordinates[a]},properties:{first_sequence:i.properties.id,collection:i.properties.id}},t=r)}}n&&void 0!==n.properties.heading?(this._picPopup._seqId=n.properties.first_sequence,this._picMarkerPreview.setLngLat?.(n.geometry.coordinates).setRotation(n.properties.heading||0).addTo(this)):this._picMarkerPreview?.remove?.();let a=n?n.geometry.coordinates:e.lngLat;if("thumb"===this._options.preview)this._picPopup.setLngLat(a).addTo(this);else if("marker"===this._options.preview&&(!n||void 0===n.properties.heading)){if(!this._picPinMarker){const e=Ue("data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8' standalone='no'%3f%3e%3c!-- Generator: Adobe Illustrator 16.0.0%2c SVG Export Plug-In . SVG Version: 6.00 Build 0) --%3e%3csvg version='1.1' id='Capa_1' x='0px' y='0px' width='32' height='32' viewBox='0 0 32 32' xml:space='preserve' xmlns:xlink='http://www.w3.org/1999/xlink' xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg'%3e%3cdefs id='defs19'%3e%3clinearGradient y2='195.90816' x2='212.88858' y1='98.091812' x1='382.31149' gradientUnits='userSpaceOnUse' id='SVGID_1_' gradientTransform='matrix(4.4379641%2c0%2c0%2c4.4379641%2c-886.70524%2c-217.09784)' spreadMethod='pad'%3e %3cstop id='stop4' style='stop-color:%238F2A85' offset='0' /%3e %3cstop id='stop6' style='stop-color:%232570B6' offset='1' /%3e %3c/linearGradient%3e%3clinearGradient xlink:href='%23SVGID_1_' id='linearGradient27' x1='30.55006' y1='29.297422' x2='17.272936' y2='8.0495806' gradientUnits='userSpaceOnUse' gradientTransform='matrix(0.66910611%2c0%2c0%2c0.66910611%2c0%2c1.2499974)' /%3e%3c/defs%3e%3ccircle style='fill:white%3bfill-opacity:1%3bstroke:none%3bstroke-width:5.30813%3bstroke-linecap:square%3bstroke-linejoin:round%3bpaint-order:markers stroke fill' id='path3' cx='15.999331' cy='9.2110214' r='4.1819134' /%3e%3cpath d='m 24.381558%2c9.7115132 c 0%2c-4.6295451 -3.752348%2c-8.3818922 -8.382562%2c-8.3818922 -4.630214%2c0 -8.381892%2c3.7523471 -8.381892%2c8.3818922 0%2c6.6328488 8.381892%2c16.4479668 8.381892%2c16.4479668 0%2c0 8.382562%2c-9.849242 8.382562%2c-16.4479668 z M 11.865259%2c9.2110219 c 0%2c-2.2836592 1.851416%2c-4.1344067 4.134406%2c-4.1344067 2.28299%2c0 4.134407%2c1.8507475 4.134407%2c4.1344067 0%2c2.2836591 -1.851417%2c4.1344071 -4.134407%2c4.1344071 -2.28299%2c0 -4.134406%2c-1.850748 -4.134406%2c-4.1344071 z' fill='%23006df0' id='path1' style='fill:url(%23linearGradient27)%3bstroke-width:0.414563%3bstroke-dasharray:none' /%3e%3ccircle cx='15.998996' cy='9.2110214' r='2.0327444' fill='%23006df0' id='circle1' style='fill:url(%23SVGID_1_)%3bstroke-width:0.414543' /%3e%3cpath d='m 20.738275%2c20.743521 c -0.683158%2c0.9876 -1.324161%2c1.847402 -1.858108%2c2.537919 5.296644%2c0.318495 8.767967%2c1.461997 10.059341%2c2.312431 -1.512849%2c0.997637 -6.007903%2c2.400083 -12.939174%2c2.400083 -6.9306007%2c0 -11.4263246%2c-1.403115 -12.9391735%2c-2.400083 1.2913747%2c-0.850434 4.7600208%2c-1.993267 10.0513115%2c-2.311762 -0.535284%2c-0.690517 -1.176957%2c-1.54965 -1.860784%2c-2.53725 C 4.7339257%2c21.386532 0%2c23.314895 0%2c25.593202 0%2c28.396756 7.1641191%2c30.670379 16.000334%2c30.670379 24.837219%2c30.670379 32%2c28.398095 32%2c25.593202 32.0013%2c23.313557 27.262059%2c21.384524 20.738275%2c20.743521 Z' fill='%23006df0' id='path2' style='fill:%238f2a85%3bfill-opacity:1%3bstroke-width:0.414543' /%3e%3c/svg%3e");e.style.width="40px",this._picPinMarker=new vL({element:e,anchor:"bottom",offset:[0,10]})}this._picPinMarker.setLngLat(a).addTo(this)}n||this._picThumbUrl[i.properties.id]||this._picPopup.setDOMContent(To(this._parent._t));const r=e=>{if("thumb"===this._options.preview&&this._picPopup._loading===i.properties.id)if(e){let t=document.createElement("img");t.classList.add("pnx-map-thumb"),t.alt=this._parent._t.map.thumbnail;let n=new Image;if(n.src=e,n.addEventListener("load",()=>{this._picPopup._loading===i.properties.id&&(i.properties.hidden?t.children[0].src=n.src:t.src=n.src,this._picPopup.setDOMContent(t),delete this._picPopup._loading)}),i.properties.hidden){const e=document.createElement("div");e.classList.add("pnx-map-thumb-legend"),e.appendChild(document.createTextNode(this._parent._t.map.not_public));const i=document.createElement("div");i.appendChild(t),i.appendChild(e),t=i}}else this._picPopup.remove()};this._picPopup._loading===i.properties.id&&(this._picThumbUrl[n?.properties?.id||i.properties.id]?r(this._picThumbUrl[n?.properties?.id||i.properties.id]):(clearTimeout(this._picPreviewTimer),this._picPreviewTimer=setTimeout(()=>{this._picPopup._loading===i.properties.id&&"thumb"===this._options.preview&&(this._picPopup.setDOMContent(To(this._parent._t)),n?n.properties.id?this._getPictureThumbURL(n.properties.id,n.properties.collection).then(r):this._getSequenceThumbURL(i.properties.collection,a).then(r):t.endsWith("_grid")?this._getThumbURL(a).then(r):t.includes("_sequences")&&this._getSequenceThumbURL(i.properties.id,a).then(r))},100)))}_getThumbURL(e){return this._parent.getAPI().getPicturesAroundCoordinates(e.lat,e.lng,.1,1).then(e=>{const t=e?.features?.pop();return t?this._parent.getAPI().findThumbnailInPictureFeature(t):null})}_getSequenceThumbURL(e,t){return t?this._parent.getAPI().getPicturesAroundCoordinates(t.lat||t[1],t.lng||t[0],1,1,e).then(t=>t?.features?.length>0?this._parent.getAPI().findThumbnailInPictureFeature(t.features[0]):this._parent.getAPI().getPictureThumbnailURLForSequence(e)):this._parent.getAPI().getPictureThumbnailURLForSequence(e)}_getPictureThumbURL(e,t){let i=Promise.resolve();return e&&(void 0!==this._picThumbUrl[e]?i="string"==typeof this._picThumbUrl[e]?Promise.resolve(this._picThumbUrl[e]):this._picThumbUrl[e]:(this._picThumbUrl[e]=this._parent.getAPI().getPictureThumbnailURL(e,t).then(t=>t?(this._picThumbUrl[e]=t,t):(this._picThumbUrl[e]=null,null)).catch(()=>{this._picThumbUrl[e]=null}),i=this._picThumbUrl[e])),i}_getPictureMarker(e=!0){return new vL({element:Ue(e?"data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8' standalone='no'%3f%3e%3csvg width='48' height='48' viewBox='0 0 48 48' version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg'%3e %3cpath d='m 8.0222924%2c7.8597977 a 22.594107%2c22.594107 0 0 1 31.9555636%2c0.0027 L 24.001409%2c23.838916 Z' style='fill:%23bf360c%3bfill-opacity:1%3bstroke:white%3bstroke-width:2.50003%3bstroke-miterlimit:4%3bstroke-dasharray:none%3bstroke-opacity:1' /%3e %3ccircle cx='24' cy='24' r='9.9777565' style='fill:%23ff6f00%3bfill-opacity:1%3bstroke:white%3bstroke-width:2.49449%3bstroke-miterlimit:4%3bstroke-dasharray:none%3bstroke-opacity:1' /%3e%3c/svg%3e":uo),picId:null}).setDraggable(e&&this._options.picMarkerDraggable)}_onSequenceHover(e){e.preventDefault(),e.features.length>0&&e.features[0].properties?.id&&this.fire("sequence-hover",{seqId:e.features[0].properties.id})}_onSequenceClick(e){if(e.preventDefault(),e.originalEvent.stopImmediatePropagation(),"pic"!==this._parent.psv?.getPicturesNavigation()&&e.features.length>0){let t=e.features[0];e.features.length>1&&this._picPopup._seqId&&(t=e.features.find(e=>e.properties.id===this._picPopup._seqId)||t),t.properties?.id&&this.fire("sequence-click",{seqId:t.properties.id,coordinates:e.lngLat})}}_onPictureClick(e){if(e.preventDefault(),e.originalEvent.stopImmediatePropagation(),"pic"===this._parent.psv?.getPicturesNavigation())return;const t=this.queryRenderedFeatures(e.point);if(t.length>1&&t.find(e=>e?.source?.startsWith("sem-")))return;const i=e?.features?.length>0?e.features[0]:null;if(i?.properties?.id){let t=null;try{i.properties.sequences&&(Array.isArray(i.properties.sequences)||(i.properties.sequences=JSON.parse(i.properties.sequences)),t=i.properties.sequences.pop())}catch(e){console.log("Sequence ID is not available in vector tiles for picture "+i.properties.id)}this.fire("picture-click",{picId:i.properties.id,seqId:t,feature:i})}}addEventListener(e,t,i={}){i?.once?this.once(e,t):this.on(e,t)}};const ZB={minDate:"date_from",maxDate:"date_to",pic_type:"pic_type",camera:"camera",theme:"theme",qualityscore:"pic_score",gps:"gps"},KB=Object.fromEntries(Object.entries(ZB).map(e=>[e[1],e[0]])),XB=["none","null","false",!1],QB=["antialias","bearing","bearingSnap","bounds","boxZoom","clickTolerance","collectResourceTiming","cooperativeGestures","crossSourceCollisions","doubleClickZoom","dragPan","dragRotate","fadeDuration","failIfMajorPerformanceCaveat","fitBoundsOptions","hash","interactive","localIdeographFontFamily","locale","logoPosition","maplibreLogo","maxBounds","maxCanvasSize","maxPitch","maxTileCacheSize","maxTileCacheZoomLevels","maxZoom","minPitch","minZoom","pitch","pitchWithRotate","pixelRatio","preserveDrawingBuffer","refreshExpiredTiles","renderWorldCopies","scrollZoom","touchPitch","touchZoomRotate","trackResize","transformCameraUpdate","transformRequest","validateStyle"];class YB{constructor(e={},t={},i={}){"false"===e["url-parameters"]&&(t={});let n={};"object"==typeof e?.["psv-options"]&&(n=e["psv-options"]);let a={};"object"==typeof e?.["map-options"]&&(a=e["map-options"]);let r={};"object"==typeof i?.map&&(r=i.map);let s=t.map&&"none"!==t.map?JB(t.map):null,o=!XB.includes(t.map)&&!XB.includes(e["map-options"]),l=t.focus||e.focus,c=t.pic||e.picture,u=t.seq||e.sequence,h=t.users||e["endpoint-to-use"]||r.endpoint,d=t.speed||n?.transitionDuration,p=t.nav||n?.picturesNavigation,m=t.theme||a.theme||r?.theme,g=t.background||a.background||r?.background,f=s?.center||!c&&(a.center||r?.center)||[0,0],A=s?.zoom||a.zoom||r?.zoom,_=s?.pitch||a.pitch,v=s?.bearing||a.bearing,y=t.level||a.indoor?.level,x=e.geocoder,b=e.widgets,w=e["fetch-options"],E=e.style,k=e.lang,S=e.endpoint,M=a.raster,C=a.basemaps,T=a.indoor,D=a.attributionControl,P=a.preview,I=(F=a,Object.fromEntries(Object.entries(F).filter(([e])=>QB.includes(e))));var F;let z=e["keyboard-shortcuts"],R=e["skip-tags-menu-opening"],L="false"===i?.disableAnnotations||n?.displayAnnotations||!1,B=t.xyz,O=t.date_from,U=t.date_to,N=t.pic_type,j=t.camera,V=t.pic_score,q=t.gps,G=t.overlay,H=t.xywh,W=t.annot;!o||c||u?["map","pic"].includes(l)?"map"!==l||o||(console.warn("Parameter focus can't be 'map' as map is disabled"),l="pic"):(console.warn("Invalid value for parameter focus:",l),l=!o||c||u?"pic":"map"):l="map","aerial"!==g||M||(console.warn("Parameter background can't be 'aerial' as no aerial imagery is available"),g="streets"),y&&!T&&console.error("Can't set indoor level if indoor= plugin is not available"),!L&&W&&(L=!0),W&&!c&&console.error("Parameter annot can only be used in combination with 'picture'"),["thumb","marker","none"].includes(P)||(P&&P.length>0&&console.warn("Parameter map-options.preview is invalid, should be 'thumb', 'marker' or 'none'"),P="thumb"),this._parentInit={map:o,fetchOptions:w,style:E,lang:k,endpoint:S},this._parentPostInit={focus:l,picture:c,sequence:u,geocoder:x,widgets:b,users:h,forceFocus:!0,keyboardShortcuts:!0,willLoadPicture:void 0!==(c||u),skipTagsMenuOpening:"true"===R},this._psvInit=Object.assign(Object.fromEntries(Object.entries(n).filter(([e])=>!["transitionDuration","picturesNavigation","displayAnnotations"].includes(e))),{displayAnnotations:L}),this._psvAny={transitionDuration:d,picturesNavigation:p},this._psvPostInit={xyz:B,xywh:H,annotation:W},this._mapInit={raster:M,indoor:T,attributionControl:D,basemaps:C,preview:P,...I},this._mapAny={theme:m,background:g,center:f,zoom:A,pitch:_,bearing:v,level:y},this._mapPostInit={date_from:O,date_to:U,pic_type:N,camera:j,pic_score:V,gps:q,overlay:G},"false"===z&&(this._psvInit.keyboard=!1,this._psvInit.keyboardActions={},this._mapInit.keyboard=!1,this._parentPostInit.keyboardShortcuts=!1)}_sanitize(e){return Object.fromEntries(Object.entries(e).filter(([,e])=>void 0!==e))}getParentInit(){return this._sanitize(this._parentInit)}getParentPostInit(){return this._sanitize(this._parentPostInit)}getPSVInit(){return this._sanitize(Object.assign({},this._psvInit,this._psvAny))}getPSVPostInit(){return this._sanitize(Object.assign({},this._psvPostInit,this._psvAny))}getMapInit(){return this._sanitize(Object.assign({},this._mapInit,this._mapAny))}getMapPostInit(){return this._sanitize(Object.assign({},this._mapPostInit,this._mapAny))}static GetComponentProperties(e,t){const i={};for(let n in e.properties){e.properties[n].state||null==t[n]||(i[n]=t[n])}return i}}function JB(e,t){const i=(e||"").split("/");if(i.length>=3&&!i.some(e=>isNaN(e))){const e={center:[+i[2],+i[1]],zoom:+i[0],pitch:+(i[4]||0)};return t&&(e.bearing=t.dragRotate.isEnabled()&&t.touchZoomRotate.isEnabled()?+(i[3]||0):t.getBearing()),e}return null}function $B(e,t){t.xyz&&e.addEventListener("picture-loaded",()=>{const i=function(e){const t=(e||"").split("/");return 3!==t.length||t.some(e=>isNaN(e))?null:{x:+t[0],y:+t[1],z:+t[2]}}(t.xyz);e.setXYZ(i.x,i.y,i.z)},{once:!0}),t.xywh&&e.addEventListener("picture-loaded",()=>{const i=function(e,t){let i=(e||"").split(",");if(4!==i.length||i.some(e=>isNaN(e)))return null;{let[e,n,a,r]=i.map(e=>parseFloat(e)),s=t.panorama.basePanoData;if("function"==typeof s){const e=t?.properties?.["pers:interior_orientation"]?.sensor_array_dimensions;s=e&&2===e.length?s({width:e[0],height:e[1]}):null}if(!s?.fullWidth||!s?.fullHeight)return null;const o=s?.croppedX||0,l=s?.croppedY||0,c=o+e+a/2-s.fullWidth/2,u=-(l+n+r/2-s.fullHeight/2),h=c/s.fullWidth,d=u/s.fullHeight,p=(a/s.fullWidth+r/s.fullHeight)/2;return{yaw:2*h*Math.PI,pitch:d*Math.PI,z:100*(1-p)}}}(t.xywh,e.getPictureMetadata());e.rotate(i),e.zoom(i.z)},{once:!0}),t.annotation&&(e.getPictureMetadata()?e.focusOnAnnotation(t.annotation):e.addEventListener("picture-loaded",()=>{e.focusOnAnnotation(t.annotation)},{once:!0}));let i=t.transitionDuration||t.speed;void 0!==i&&e.setTransitionDuration(i);let n=t.picturesNavigation||t.nav;["none","pic","any","seq"].includes(n)&&e.setPicturesNavigation(n)}function eO(e,t){const i=JB(t.map,e);i&&e.jumpTo(i),e.setFilters?.(function(e){const t={};for(let i in KB)e[i]&&(t[KB[i]]=e[i]);if(t.qualityscore){let e=t.qualityscore.split("");const i={A:5,B:4,C:3,D:2,E:1};t.qualityscore=e.map(e=>i[e])}return t}(t)),e._parent?.mapStyleComposer?.layerRanges.basemaps[t.background]&&e._parent.mapStyleComposer.switchBasemap(t.background),t.overlay&&t.overlay.split(",").forEach(t=>e._parent.mapStyleComposer.switchDataOverlayVisibility("sem-"+t,!0))}function tO(e,t){let i=t.picture||t.pic,n=t.sequence||t.seq||null;if(i){const t=i.split(";");t.length>1&&console.warn("Multiple picture IDs passed in URL, only first one kept"),e.select(1===t.length?n:null,t[0],!0)}else n?e.select(n,null,!0):e.select()}function iO(e,t){tO(e,t),"map"===t.focus&&e?.map?(e.setPopup(!1),e._setFocus("map",null,t.forceFocus)):"pic"===t.focus&&e?.mini?(e.setPopup(!1),e._setFocus("pic",null,t.forceFocus)):t.focus&&"meta"===t.focus&&e?.mini&&e._setFocus("pic",null,t.forceFocus),null!=t.users&&(zo(t.users)?e.mapStyleComposer._createPanoramaxEndpointForUser(t.users):e.mapStyleComposer.switchPanoramaxEndpoint(t.users))}const nO=["streets","aerial"];class aO extends EventTarget{constructor(e){super(),this._parent=e,this.map=null,this._mapUpdateDebounce=null,this.layerRanges={basemaps:{},dataUnderlays:{},panoramax:{},dataOverlays:{}},this.basemap=null,this.dataUnderlays=new Set,this.panoramax=null,this.dataOverlays=new Set,this.detachedSources={},this.panoramaxTheme=Co.default.id,this.panoramaxFilters={},this.panoramaxOriginalStyle={}}getMapStyle(){let e={},t=[],i=[],n={},a=[];const r=e=>(this.map&&(e||[]).filter(e=>this.map.getLayer(e.id)).forEach(e=>{const t=this.map.getFilter(e.id);t&&(e.filter=t)}),e),s=e=>{(e||[]).forEach(e=>{Po(e)?i.push(e):t.push(e)})},o=(e,t)=>{Array.isArray(e)?a=a.concat(e):"object"==typeof e&&null!=e?a.push(e):"string"==typeof e&&a.push({id:t,url:e})};if(Object.entries(this.detachedSources).forEach(([t,i])=>e[t]=i),this.basemap&&this.layerRanges.basemaps[this.basemap]&&(e=Object.assign(e,this.layerRanges.basemaps[this.basemap].sources),s(this.layerRanges.basemaps[this.basemap].layers),n=this.layerRanges.basemaps[this.basemap].metadata||{},o(this.layerRanges.basemaps[this.basemap].sprite,this.basemap),n?.["panoramax:locales"]||(n["panoramax:locales"]=["fr","en","de","es","ru","pt","zh","hi","latin"])),[...this.dataUnderlays].forEach(t=>{this.layerRanges.dataUnderlays[t]&&(e=Object.assign(e,this.layerRanges.dataUnderlays[t].sources),s(r(this.layerRanges.dataUnderlays[t].layers)),o(this.layerRanges.dataUnderlays[t].sprite,t))}),this.panoramax&&this.layerRanges.panoramax[this.panoramax]){n=Object.assign(n,this.layerRanges.panoramax[this.panoramax].metadata),e=Object.assign(e,this.layerRanges.panoramax[this.panoramax].sources),o(this.layerRanges.panoramax[this.panoramax].sprite,this.panoramax);let t=this._applyPanoramaxThemeOnLayers(this.layerRanges.panoramax[this.panoramax]);t=this._applyPanoramaxFiltersOnLayers(t,this.layerRanges.panoramax[this.panoramax].metadata),s(t)}if([...this.dataOverlays].forEach(t=>{this.layerRanges.dataOverlays[t]&&(e=Object.assign(e,this.layerRanges.dataOverlays[t].sources),s(r(this.layerRanges.dataOverlays[t].layers)),o(this.layerRanges.dataOverlays[t].sprite,t))}),n["panoramax:locales"]){let e=this._parent.lang||ht(n["panoramax:locales"],"latin");e.includes("-")&&(e=e.split("-")[0]),e.includes("_")&&(e=e.split("_")[0]),i.forEach(t=>{t.layout["text-field"].includes("name:latin")&&(t.layout["text-field"]=["coalesce",["get",`name:${e}`],["get","name:latin"],["get","name"]])})}const l=i.find(e=>"place_label_city"===e.id);let c=i.find(e=>"place_label_capital"===e.id);return l&&!c&&(l.paint={"text-color":"hsl(0, 0%, 0%)","text-halo-blur":0,"text-halo-color":"hsla(0, 0%, 100%, 1)","text-halo-width":3},l.layout["text-letter-spacing"]=.1,c=JSON.parse(JSON.stringify(l)),c.id="place_label_capital",c.filter=c.filter.filter(e=>!(">"===e[0]&&"capital"===e[1])),c.filter.push(["<=","capital",2]),l.filter.find(e=>">"===e[0]&&"capital"===e[1])||l.filter.push([">","capital",2]),i.push(c)),e.plan_ign&&(e.plan_ign.maxzoom=18),e.openmaptiles&&!(e.openmaptiles.attribution||"").includes("OpenMapTiles")&&(e.openmaptiles.attribution+=" | © <a href='https://openmaptiles.org/'>OpenMapTiles</a>"),{version:8,name:"Panoramax Map Style",sources:e,layers:t.concat(i).filter(e=>e.id),metadata:n,sprite:a.length>0?a:void 0}}updateMapStyle(e=!1){clearTimeout(this._mapUpdateDebounce),this._mapUpdateDebounce=setTimeout(()=>{this.map?.setStyle(this.getMapStyle(),{diff:!0}),e&&(this.map._semMapProtocol.clearCache(),Object.entries(this.map?.getStyle()?.sources||{}).filter(([,e])=>e.tiles&&e.tiles[0].startsWith("sem")).forEach(([e])=>{const t=this.map.getSource(e);t.setTiles(t.tiles)}))},10)}registerSource(e,t){let i=!1;const n=Object.keys(this.layerRanges);for(let t=0;t<n.length;t++){const a=this.layerRanges[n[t]],r=Object.keys(a);for(let t=0;t<r.length;t++){if(r[t]===e){i=!0;break}}if(i)break}i||("indoorequal"===e&&(t.attribution='<a href="https://indoorequal.org/" target="_blank">© indoor=</a>'),this.detachedSources[e]=t)}registerLayer(e,t){let i="dataOverlays";if(("indoorequal"===e.source||t)&&(i="dataUnderlays"),"indoorequal"===e.source&&"indoor-heat"===e.id&&!1===this._parent?._initParams?.getMapInit()?.indoor?.heatmap)return;let n=!1;if(Object.values(this.layerRanges[i]).forEach(t=>{t.sources[e.source]&&(t.layers||(t.layers=[]),t.layers.push(e),n=!0)}),n)return;let a={sources:{},layers:[e]};this.detachedSources[e.source]&&(a.sources[e.source]=this.detachedSources[e.source],delete this.detachedSources[e.source],"dataOverlays"===i?this.addDataOverlay(e.id,a,!0):"dataUnderlays"===i&&this.addDataUnderlay(e.id,a,!0))}async waitFor(e,t){return this.layerRanges[e][t]?await Promise.resolve():await new Promise(e=>setTimeout(e,250)).then(()=>this.waitFor(e,t))}async addBasemap(e,t,i=!1){"string"==typeof t&&(t=await fetch(t).then(e=>e.json())),this.layerRanges.basemaps[e]=t,this.dispatchEvent(new CustomEvent("basemap-added",{detail:{basemap:e}})),i&&this.switchBasemap(e)}async switchBasemap(e){e&&!this.layerRanges.basemaps[e]&&await this.waitFor("basemaps",e),this.basemap!==e&&e&&(this.basemap=e,this.updateMapStyle(),this.dispatchEvent(new CustomEvent("basemap-changed",{detail:{basemap:e}})))}hasManyBasemaps(){return Object.keys(this.layerRanges.basemaps).length>=2}hasStreetsAerialBasemaps(){return null!=this.layerRanges.basemaps.aerial&&null!=this.layerRanges.basemaps.streets}hasComplementaryBasemaps(){return null!=Object.keys(this.layerRanges.basemaps).find(e=>!nO.includes(e))}addDataUnderlay(e,t,i=!1){this.layerRanges.dataUnderlays[e]=t,this.dispatchEvent(new CustomEvent("dataunderlay-added",{detail:{dataUnderlay:e}})),i&&this.switchDataUnderlayVisibility(e,!0)}async switchDataUnderlayVisibility(e,t){e&&!this.layerRanges.dataUnderlays[e]&&await this.waitFor("dataUnderlays",e),t?this.dataUnderlays.add(e):this.dataUnderlays.delete(e),this.updateMapStyle(),this.dispatchEvent(new CustomEvent("dataunderlay-changed",{detail:{dataUnderlay:e,visible:t}}))}addPanoramaxEndpoint(e,t,i=!1){[null,void 0,1].includes(t.metadata?.["panoramax:tiles_version"])&&Object.values(t?.sources||{}).filter(e=>e.tiles).forEach(e=>e.tiles=e.tiles.map(e=>e.replace(/^http/,"panora"))),this.layerRanges.panoramax[e]=t,this.panoramaxOriginalStyle[e]=JSON.parse(JSON.stringify(t)),this.layerRanges.panoramax[e].layers=Fo(t),this.dispatchEvent(new CustomEvent("panoramax-added",{detail:{endpoint:e}})),i&&this.switchPanoramaxEndpoint(e)}async switchPanoramaxEndpoint(e){e&&!this.layerRanges.panoramax[e]&&await this.waitFor("panoramax",e),e&&e!==this.panoramax&&(this.panoramax=e,this.updateMapStyle(!0)),this.dispatchEvent(new CustomEvent("panoramax-changed",{detail:{endpoint:e}}))}isPanoramaxEndpointSingleUser(){return zo(this.panoramax)}setPanoramaxTheme(e){e!==this.panoramaxTheme&&(this.panoramaxTheme=e,this.updateMapStyle(),this.dispatchEvent(new CustomEvent("theme-changed",{detail:{theme:e}})))}setPanoramaxFilters(e){this.panoramaxFilters=e,this.updateMapStyle(),this.dispatchEvent(new CustomEvent("filters-changed",{detail:e}))}addDataOverlay(e,t,i=!1){this.layerRanges.dataOverlays[e]=t,this.dispatchEvent(new CustomEvent("dataoverlay-added",{detail:{dataOverlay:e}})),i&&this.switchDataOverlayVisibility(e,!0)}async switchDataOverlayVisibility(e,t){e&&!this.layerRanges.dataOverlays[e]&&await this.waitFor("dataOverlays",e),t?this.dataOverlays.add(e):this.dataOverlays.delete(e),this.updateMapStyle(),this.dispatchEvent(new CustomEvent("dataoverlay-changed",{detail:{dataOverlay:e,visible:t}}))}async _createPanoramaxEndpointFromAPI(e,t,i=!0){let n;t._endpoints.style?n=t._endpoints.style:t._endpoints.tiles&&(n={sources:{geovisio:{type:"vector",tiles:[t._endpoints.tiles]}}}),n&&"string"==typeof n&&(n=await fetch(n,t._getFetchOptions()).then(e=>e.json())),n&&n.sources&&this.addPanoramaxEndpoint(e,n,i)}async _createPanoramaxEndpointForUser(e){if(!zo(e))return;if(this.layerRanges.panoramax[e])return void this.switchPanoramaxEndpoint(e);let t,i,n;e.startsWith("metacatalog_")?(i=this._parent.apiMC,n=e.replace(/^metacatalog_/,"")):(i=this._parent.api,n=e),i._endpoints.user_style?t=i._endpoints.user_style.replace(/\{userId\}/g,n):i._endpoints.user_tiles&&(t={sources:{[`geovisio_${n}`]:{tiles:[i._endpoints.user_tiles.replace(/\{userId\}/g,n)]}}}),t&&"string"==typeof t&&(t=await fetch(t,i._getFetchOptions()).then(e=>e.json())),t&&t.sources&&this.addPanoramaxEndpoint(e,t,!0)}_createManyBasemaps(e,t){const i=/\{z:(\d+)\}/;Object.entries(e).forEach(([e,n])=>{if("string"==typeof n&&n.includes(".png")){let t,a;const r=n.match(i);r&&r.length>1&&(t=parseInt(r[1]),n=n.replace(i,"{z}")),(n.includes("osm")||n.includes("openstreetmap"))&&(a='© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>'),n={sources:{[e]:{type:"raster",tiles:[n],tileSize:256,maxzoom:t,attribution:a}},layers:[{id:e,type:"raster",source:e}]}}this.addBasemap(e,n,e===t)})}_createRasterBasemap(e){return this.addBasemap("aerial",{sources:{[ho]:e},layers:[{id:ho,type:"raster",source:ho}]}),ho}_applyPanoramaxThemeOnLayers(e){const t=2===e.metadata?.["panoramax:tiles_version"],i=this._parent.psv?this._parent.psv?._myVTour?.state?.loadingNode||this._parent.psv?._myVTour?.state?.currentNode?.id:this._parent.picture,n=this._parent.psv?i?this._parent.psv?._picturesSequences[i]:null:this._parent.sequence;return e.layers=e.layers.map(i=>{const a=i.id.endsWith("_pictures"),r=i.id.endsWith("_sequences"),s=i.id.endsWith("_grid");if(i.layout||(i.layout={}),i.paint||(i.paint={}),a||r){const e=["case",["==",["get","hidden"],!0],90];r&&n?e.push(["==",["get","id"],n],100):a&&n&&e.push(["in",n,["get","sequences"]],100),e.push(...Co[this.panoramaxTheme].sort),e.push(10),i.layout[(a?"circle":"line")+"-sort-key"]=e;const t=["case",["==",["get","hidden"],!0],Te.HIDDEN];r&&n?t.push(["==",["get","id"],n],Te.SELECTED):a&&n&&t.push(["in",n,["get","sequences"]],Te.SELECTED),"default"===this.panoramaxTheme?t.push(Te.BASE):t.push(...Co[this.panoramaxTheme].color),i.paint[(a?"circle":"line")+"-color"]=t,a&&(i.paint["circle-stroke-color"]=t)}if(s){const n=t?"fill-color":"circle-color";if(i.paint[n]=["case",...Co[this.panoramaxTheme].color],t&&(i.paint["fill-opacity"]="score"===this.panoramaxTheme?.8:.5),"default"===this.panoramaxTheme){let t="coef";this.panoramaxFilters.pic_type&&(t="flat"===this.panoramaxFilters.pic_type?"coef_flat_pictures":"coef_360_pictures",Io(e)&&tt()&&(t="logged_"+t)),i=Ro(i,t)}}return i}),e.layers}_applyPanoramaxFiltersOnLayers(e,t){const i=this.panoramaxFilters,n=2===t?.["panoramax:tiles_version"];return e.forEach(e=>{const t=e.id.endsWith("_pictures"),a=e.id.endsWith("_sequences")||e.id.endsWith("_sequences_plus"),r=e.id.endsWith("_grid");if(!(t||a||r&&n))return;let s=[];if(i.minDate&&""!==i.minDate&&(t?s.push([">=",["get","ts"],i.minDate]):(a||n&&r)&&s.push([">=",["get","date"],i.minDate])),i.maxDate&&""!==i.maxDate&&((a||n&&r)&&s.push(["<=",["get","date"],i.maxDate]),t)){let e=new Date(i.maxDate);e.setDate(e.getDate()+1),e=e.toISOString().split("T")[0],s.push(["<=",["get","ts"],e])}i.pic_type&&""!==i.pic_type&&(i.pic_type="flat"===i.pic_type?"flat":"equirectangular",(a||t||n&&r)&&s.push(["==",["get","type"],i.pic_type])),i.qualityscore&&i.qualityscore.length>0&&(a||t||n&&r)&&s.push(["in",xo,["literal",i.qualityscore]]),i.gps&&i.gps.length>0&&(a||t||n&&r)&&s.push(["in",yo,["literal",i.gps]]),t&&i.featuresRestrictions?.pictures&&i.featuresRestrictions.pictures.features?.length>=0&&("keep"===i.featuresRestrictions.pictures.rule?s.push(["in",["get","id"],["literal",i.featuresRestrictions.pictures.features]]):i.featuresRestrictions.pictures.features.length>0&&s.push(["!",["in",["get","id"],["literal",i.featuresRestrictions.pictures.features]]])),a&&i.featuresRestrictions?.sequences&&i.featuresRestrictions.sequences.features?.length>=0&&("keep"===i.featuresRestrictions.sequences.rule?s.push(["in",["get","id"],["literal",i.featuresRestrictions.sequences.features]]):i.featuresRestrictions.sequences.features.length>0&&s.push(["!",["in",["get","id"],["literal",i.featuresRestrictions.sequences.features]]])),0===s.length?s=["literal",!0]:(s.unshift("all"),t&&(s=["step",["zoom"],!0,po,s])),s&&(e.filter=s)}),e}_hideMapFilters(){return 2!==this._getPanoramaxStyleVersion()&&this._parent.map.getZoom()<7}_getPanoramaxStyleVersion(){return this.layerRanges.panoramax[this.panoramax]?.metadata?.["panoramax:tiles_version"]||1}}const rO=new CSSStyleSheet;rO.replaceSync("pnx-coverage-map {\n\tdisplay: block;\n\tposition: relative;\n}\n\npnx-coverage-map .maplibregl-map {\n\tposition: absolute;\n\tinset: 0;\n\tbackground-color: white;\n}\n"),document.adoptedStyleSheets.push(rO);class sO extends co{static properties={"map-options":{converter:co.GetJSONConverter()},"map-style":{type:String},user:{type:String},...co.properties};constructor(){super(),this["map-style"]=this.getAttribute("map-style")||"https://panoramax.openstreetmap.fr/pmtiles/basic.json";try{this["map-style"]=JSON.parse(this["map-style"])}catch(e){}this._mapContainer=document.createElement("div")}connectedCallback(){super.connectedCallback(),this.mapStyleComposer=new aO(this),this.mapStyleComposer.addBasemap("streets",this["map-style"],!0),this.onceAPIReady().then(()=>{this.loader.setAttribute("value",30),this._initParams=new YB(YB.GetComponentProperties(sO,this));const e=this.user&&""!=this.user;this.mapStyleComposer._createPanoramaxEndpointFromAPI("default",this.api,!e),e&&this.mapStyleComposer._createPanoramaxEndpointForUser(this.user),this._initMap()})}attributeChangedCallback(e,t,i){super.attributeChangedCallback(e,t,i),"user"===e&&1===this.api?._isReady&&(i&&""!=i?this.mapStyleComposer._createPanoramaxEndpointForUser(i):this.mapStyleComposer.switchPanoramaxEndpoint("default"))}disconnectedCallback(){super.disconnectedCallback(),this.map?.destroy()}getClassName(){return"CoverageMap"}onceReady(){return this.map&&this.map.waitForEnoughMapLoaded?this.map.waitForEnoughMapLoaded():new Promise(e=>setTimeout(e,100)).then(this.onceReady.bind(this))}render(){return[this.loader,this._mapContainer]}getSubComponentsNames(){return super.getSubComponentsNames().concat(["map","mapStyleComposer"])}_initMap(){this.map=new WB(this,this._mapContainer,Object.assign({},this._initParams.getMapInit(),{hash:!0})),this.map.addControl(new oL({showCompass:!1})),this.loader.setAttribute("value",70),this.addEventListener("select",this._onSelect.bind(this)),this.map.on("picture-click",e=>this.select(e.seqId,e.picId)),this.map.on("sequence-click",e=>this.select(e.seqId)),this.map.waitForEnoughMapLoaded().then(()=>{eO(this.map,this._initParams.getMapPostInit()),this.loader.dismiss()})}_onSelect(e){if(e.detail.picId||e.detail.seqId){const t=this.map.getLayersOrder().find(t=>t.endsWith(e.detail.picId?"pictures":"sequences")),i=this.map.queryRenderedFeatures({layers:[t],filter:["==",["get","id"],e.detail.picId||e.detail.seqId]});i.length>=0&&null!=i[0]&&this.map._attachPreviewToPictures({features:i},t)}else this.map._dropPreview()}}customElements.define("pnx-coverage-map",sO);const oO=Ne("data:image/svg+xml,%3csvg viewBox='0 0 64 64' width='64' height='64' xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg'%3e%3cpath d='M 27.359486%2c12.65513 1.4316349%2c43.49917 c -3.2999082%2c3.906014 -0.53876046%2c9.96707 4.6468097%2c9.96707 H 57.934146 c 5.118225%2c0 7.946718%2c-5.993711 4.64681%2c-9.96707 L 36.653105%2c12.65513 c -2.424422%2c-2.8284931 -6.869197%2c-2.8284931 -9.293619%2c0 z' style='fill: currentColor%3bfill-opacity:1%3bstroke-width:0.673451' /%3e%3c/svg%3e","white"),lO=Ne("data:image/svg+xml,%3csvg viewBox='0 0 64 192' width='64' height='192' xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg'%3e%3ccircle cx='32' cy='32' r='29.897806' style='fill: currentColor%3bfill-opacity:1%3bstroke:white%3bstroke-width:4.20439%3bstroke-miterlimit:4%3bstroke-dasharray:none%3bstroke-opacity:1' /%3e%3cpath d='m 34.279873%2c20.262171 6.711442%2c6.714294 c 0.891465%2c0.891465 2.339986%2c0.891465 3.231451%2c0 0.891466%2c-0.891465 0.891466%2c-2.339985 0%2c-3.23145 -9.662902%2c-9.665829 -3.794285%2c-3.794286 -8.180297%2c-8.180298 -1.071396%2c-1.074322 -2.525696%2c-1.677165 -4.039972%2c-1.677165 -1.517129%2c0 -2.968576%2c0.602858 -4.042825%2c1.677165 l -8.180298%2c8.180298 c -0.894317%2c0.891465 -0.894317%2c2.339986 0%2c3.23145 0.891466%2c0.891465 2.339987%2c0.891465 3.231452%2c0 l 6.697106%2c-6.694253 v 27.703943 c 0%2c0 -0.109706%2c2.126292 2.285971%2c2.126292 2.395676%2c0 2.28597%2c-2.126292 2.28597%2c-2.126292 z' style='fill:white%3bfill-opacity:1%3bfill-rule:evenodd%3bstroke-width:0.731429' /%3e%3c/svg%3e",Te.NEXT);function cO(e){if(!([null,void 0,""].includes(e)||"string"==typeof e&&""===e.trim())){if("number"==typeof e)return e;if("string"!=typeof e);else{if(/^-?\d+(\.\d+)?\/-?\d+(\.\d+)?$/.test(e)){const t=e.split("/").map(e=>parseFloat(e));return t[0]/t[1]}try{return parseFloat(e)}catch(e){}}}}function uO(e){let t=null;const i=e?.properties?.["quality:horizontal_accuracy"]||cO(e?.properties?.exif?.["Exif.GPSInfo.GPSHPositioningError"]),n=cO(e?.properties?.exif?.["Exif.GPSInfo.GPSDOP"]);return void 0!==i?t=`${i} m`:void 0!==n&&(t=n<1?"ideal":n<2?"excellent":n<5?"good":n<10?"moderate":n<20?"fair":"poor"),t}function hO(e){let t=e.properties?.["view:azimuth"];if(void 0===t){const i=cO(e.properties?.exif?.["Exif.GPSInfo.GPSImgDirection"]);void 0!==i&&(t=i)}t=t||0;let i=e.properties?.["pers:yaw"],n=["Xmp.GPano.PoseHeadingDegrees","Xmp.Camera.Yaw","Exif.MpfInfo.MPFYawAngle"];if(void 0===i)for(let t of n){const n=cO(e.properties?.exif?.[t]);if(void 0!==n){i=n;break}}i=i||0,Math.round(t)===Math.round(i)&&i>0&&console.warn("Picture with UUID",e.id,"has same GPS Image direction and Yaw, could cause rendering issues");let a=e.properties?.["pers:pitch"];if(n=["Xmp.GPano.PosePitchDegrees","Xmp.Camera.Pitch","Exif.MpfInfo.MPFPitchAngle"],void 0===a)for(let t of n){const i=cO(e.properties?.exif?.[t]);if(void 0!==i){a=i;break}}a=a||0;let r=e.properties?.["pers:roll"];if(n=["Xmp.GPano.PoseRollDegrees","Xmp.Camera.Roll","Exif.MpfInfo.MPFRollAngle"],void 0===r)for(let t of n){const i=cO(e.properties?.exif?.[t]);if(void 0!==i){r=i;break}}r=r||0;return!(360===e.properties?.["pers:interior_orientation"]?.field_of_view)&&(0!==a||0!==r)||0!==a&&0!==r?{pan:at(i),tilt:at(-a),roll:at(r)}:{}}function dO(e,t){let i;if(e.properties?.["pers:interior_orientation"]&&e.properties["pers:interior_orientation"]?.visible_area&&e.properties["pers:interior_orientation"]?.sensor_array_dimensions){const t=e.properties["pers:interior_orientation"].visible_area,n=e.properties["pers:interior_orientation"].sensor_array_dimensions;try{i={fullWidth:parseInt(n[0]),fullHeight:parseInt(n[1]),croppedX:parseInt(t[0]),croppedY:parseInt(t[1]),croppedWidth:parseInt(n[0])-parseInt(t[2])-parseInt(t[0]),croppedHeight:parseInt(n[1])-parseInt(t[3])-parseInt(t[1])}}catch(t){console.warn("Invalid pers:interior_orientation values for cropped panorama "+e.id)}}if(!i&&e.properties?.exif)try{i={fullWidth:parseInt(e.properties.exif?.["Xmp.GPano.FullPanoWidthPixels"]),fullHeight:parseInt(e.properties.exif?.["Xmp.GPano.FullPanoHeightPixels"]),croppedX:parseInt(e.properties.exif?.["Xmp.GPano.CroppedAreaLeftPixels"]),croppedY:parseInt(e.properties.exif?.["Xmp.GPano.CroppedAreaTopPixels"]),croppedWidth:parseInt(e.properties.exif?.["Xmp.GPano.CroppedAreaImageWidthPixels"]),croppedHeight:parseInt(e.properties.exif?.["Xmp.GPano.CroppedAreaImageHeightPixels"])},i.croppedWidth>i.fullWidth&&(i.fullWidth=i.croppedWidth),i.croppedHeight>i.fullHeight&&(i.fullHeight=i.croppedHeight)}catch(t){console.warn("Invalid XMP.GPano values for cropped panorama "+e.id)}if(i&&(i=Object.fromEntries(Object.entries(i||{}).filter(e=>!isNaN(e[1]))),(!i.fullWidth&&!i.croppedWidth&&i.fullHeight&&!i.croppedHeight||i.fullWidth&&!i.croppedWidth&&!i.fullHeight&&!i.croppedHeight||i.fullWidth&&!i.croppedWidth&&i.fullHeight&&!i.croppedHeight||i.fullWidth==i.croppedWidth&&i.fullHeight==i.croppedHeight)&&(i={})),i?.fullWidth&&t?.width){let e=t.width/(i?.croppedWidth||i.fullWidth);i={fullWidth:void 0!==i.fullWidth?Math.floor(i.fullWidth*e):void 0,fullHeight:void 0!==i.fullHeight?Math.floor(i.fullHeight*e):void 0,croppedWidth:void 0!==i.croppedWidth?Math.floor(i.croppedWidth*e):void 0,croppedHeight:void 0!==i.croppedHeight?Math.floor(i.croppedHeight*e):void 0,croppedX:void 0!==i.croppedX?Math.floor(i.croppedX*e):void 0,croppedY:void 0!==i.croppedY?Math.floor(i.croppedY*e):void 0}}return i||{}}function pO(e){return(t,i)=>"related"!==t.rel&&"related"!==i.rel?0:"related"!==t.rel?-1:"related"!==i.rel?1:t.date===i.date?Oe(e,t.geometry.coordinates)-Oe(e,i.geometry.coordinates):i.date.localeCompare(t.date)}function mO(e,t){return e.is360!==t.is360?e.is360:e.density!==t.density?e.density>t.density:e.dist<t.dist}function gO(e,t){const i=new Map;for(const n of e||[]){if(!n?.date||!n?.coords)continue;const e=n.date.slice(0,7),a={month:e,date:n.date,id:n.id,seqId:n.seqId,coords:n.coords,is360:!!n.is360,density:n.density||0,thumb:n.thumb||null,heading:n.heading??null,dist:Oe(t,n.coords)},r=i.get(e);r&&!mO(a,r)||i.set(e,a)}return[...i.values()].map(({month:e,date:t,id:i,seqId:n,coords:a,is360:r,density:s,thumb:o,heading:l})=>({month:e,date:t,id:i,seqId:n,coords:a,is360:r,density:s,thumb:o,heading:l})).sort((e,t)=>t.month.localeCompare(e.month))}function fO(e,t){const i={};if(e?.properties?.datetimetz){i.date=new Date(e.properties.datetimetz);const t=e.properties.datetimetz.match(/([+-]\d{2}):(\d{2})$|Z$/);t&&("Z"===t[0]?i.tz="UTC":i.tz=t[0])}else e?.properties?.datetime&&(i.date=new Date(e.properties.datetime));const n=e?.providers||e?.properties?.providers;if(n){let e=n.filter(e=>e?.roles?.includes("producer"));if(0===e?.length&&(e=n.filter(e=>e?.roles?.includes("host"))),e?.length>=0){const t={};e.map(e=>e.name).forEach(e=>{const i=e.toLowerCase().replace(/\s/g,"");t[i]?t[i].push(e):t[i]=[e]}),i.producer=[],Object.values(t).forEach(e=>{const t=e[0],n=e.find(e=>e.toLowerCase()!==e);i.producer.push(n||t)})}}if(e?.properties?.license&&(i.license=e.properties.license,e?.links)){const n=e.links.find(e=>"license"===e?.rel);n&&(i.license=`<a href="${n.href}" title="${t.pnx.metadata_general_license_link}" target="_blank">${i.license}</a>`)}return i}function AO(e,t,i=!1,n=null,a=e=>e){const r=null!=e.properties?.["pers:interior_orientation"]?.field_of_view;let s=r?parseInt(e.properties["pers:interior_orientation"].field_of_view):70;const o=360===s,l=a((Object.values(e.assets).find(e=>e?.roles?.includes("data"))||{}).href),c=e?.properties?.["tiles:tile_matrix_sets"]?.geovisio,u=e.links?.find?.(e=>"prev"===e?.rel&&"application/geo+json"===e?.type),h=e.links?.find?.(e=>"next"===e?.rel&&"application/geo+json"===e?.type),d=Object.values(e.assets).find(e=>e.roles?.includes("visual")&&"image/webp"===e.type),p=Object.values(e.assets).find(e=>e.roles?.includes("visual")&&"image/jpeg"===e.type),m=a((d||p).href),g=a(Object.values(e.assets).find(e=>e.roles?.includes("thumbnail")&&"image/jpeg"===e.type)?.href),f=e?.asset_templates?.tiles_webp||e?.asset_templates?.tiles,A=dO(e),_=e.links?.find?.(e=>"via"===e?.rel&&"application/json"===e?.type),v=e.properties?.["pers:interior_orientation"]?.sensor_array_dimensions;let y;if(Object.keys(A).length>0)y={baseUrl:i?l:m,origBaseUrl:i?l:m,hdUrl:l,thumbUrl:g,basePanoData:i?A:t=>dO(e,t),cropData:A,width:A.fullWidth,cols:2,rows:1,tileUrl:()=>null};else if(o&&c)y={baseUrl:m,origBaseUrl:m,basePanoData:e=>({fullWidth:e.width,fullHeight:e.height}),hdUrl:l,thumbUrl:g,cols:c&&c.tileMatrix[0].matrixWidth,rows:c&&c.tileMatrix[0].matrixHeight,width:c&&c.tileMatrix[0].matrixWidth*c.tileMatrix[0].tileWidth,tileUrl:c&&((e,t)=>a(f.href.replace(/\{TileCol\}/g,e).replace(/\{TileRow\}/g,t)))};else{const e=e=>{e.width<e.height&&!r&&(s=35);const t=s*e.height/e.width,i=360*e.width/s,n=180*e.height/t;return{fullWidth:Math.floor(i),fullHeight:Math.floor(n),croppedWidth:e.width,croppedHeight:e.height,croppedX:Math.floor((i-e.width)/2),croppedY:Math.floor((n-e.height)/2)}};let t=v?e({width:v[0],height:v[1]}):null;y={baseUrl:i?l:m,origBaseUrl:i?l:m,hdUrl:l,thumbUrl:g,basePanoData:e,cropData:t,width:t?.fullWidth||2,cols:2,rows:1,tileUrl:()=>null}}e.properties?.semantics&&(e.properties.semantics=e.properties.semantics.filter(e=>Object.keys(e).length>0));return{id:e.id,caption:fO(e,t),panorama:y,links:_O(e,n),origLinks:e.links,gps:e.geometry.coordinates,sequence:{id:e.collection,nextPic:h?h.id:void 0,prevPic:u?u.id:void 0},sphereCorrection:hO(e),horizontalFov:s,origInstance:_,properties:e.properties,permissions:vO(e)}}function _O(e,t=null){const i=e.links.filter(e=>["next","prev","related"].includes(e?.rel)&&"application/geo+json"===e?.type).filter(e=>!t||t(e)).map(e=>(e.datetime&&(e.date=e.datetime.split("T")[0]),e)),n=e.geometry.coordinates,a=[],r={N:[],ENE:[],ESE:[],S:[],WSW:[],WNW:[]};for(let e of i){r[We(n,e.geometry.coordinates)].push(e)}for(let e in r){const t=r[e];0!==t.length&&(t.sort(pO(n)),a.push(t.shift()))}let s=e=>"related"===e.rel?{element:je(lO),size:{width:128/3,height:128}}:{element:je(oO),size:{width:75,height:75}};const o=-at(e.properties?.["view:azimuth"]||0);return a.map(e=>({nodeId:e.id,gps:e.geometry.coordinates,arrowStyle:s(e),linkOffset:{yaw:o}}))}function vO(e){let t=!1,i=!1;return e.links.find(e=>"PATCH"===e.method&&e.attributes.includes("semantics"))&&e.links.find(e=>"POST"===e.method&&"add_annotation"===e.rel)&&(t=!0),e.links.find(e=>"DELETE"===e.method&&"delete"===e.rel)&&(i=!0),{edit_semantics:t,delete_picture:i}}function yO(e){return e?.properties?.annotations?.length>0}var xO=Object.freeze({__proto__:null,apiFeatureToPSVNode:AO,filterRelatedPicsLinks:_O,getCroppedPanoData:dO,getExifFloat:cO,getGPSPrecision:uO,getHashTags:function(e){if(!e?.properties?.semantics)return[];const t=e.properties.semantics.filter(e=>"hashtags"===e.key),i=[];return t.forEach(e=>e.value.split(";").forEach(e=>i.push(e.trim()))),i},getNodeCaption:fO,getPermissions:vO,getSphereCorrection:hO,hasAnnotations:yO,pickBestPerMonth:gO,sortPicturesInDirection:pO}),bO="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAAACXBIWXMAAB2HAAAdhwGP5fFlAAAAGXRFWHRTb2Z0d2FyZQB3d3cuaW5rc2NhcGUub3Jnm+48GgAAHm5JREFUeJztnfFzU+eZ7z/SsY8tZMuIiAiMhR05Ik4UHAgOxEBDcHBISMiSyy73smGbbbaz7WRup512u9P7H+zd3na2m5nMZHbm3rl30qHDDHeYZppphi4tKY1vWNK0TpQ4OKh2TE0ESgTCQkb2se8Pr50YMNZ7JJ0j6ej9zHjskKNzTsL79fs+z/N9n9c1OzuLwhIaAO+CLw+gz/35/HcNqJ+73g3Uzf08DczM/TwFGEAOuD73lQOyQAaYmPues/S/pkZxKYEUTSOwfO6rBfADTXw58O1iCrgKXAauzH2/DEza/B6OQgnEHC7AB6yc+wogxFDJZIHPgSRwCfiML2cnRR6UQPLTDKwGWhGiqFv68opnGiGUceACYtZR3AYlkFtxAXcCbQhRVPoMUSxXEUIZQwhHDYgFKIEIXIjl0loghAioa5HrCLH8CUigxFLzAlkGhIHOuZ8VX5IB4nNf18r8LmWjFgXiAtYgRLF67p8Vt2cWEa+cm/teUwOmlgRSB3QAXYjAW2GeCYRQhhFpZcdTCwLxAOuAuxEFurKSzRhkruTIZqaYyhpkMwYAhmGQmyv16TpomgaAx6tR79HweOvxtuh4vFq5Xn0hOeBj4CMcXmdxskAaELPFPYiKtS1kswbJ0QyJ8SypRJZ0cpJUMseVxCTpdE7UxItA08Dr02kJNuIP6PgDjfiCHoKtHoLtXnSPrQKaQcQo7+FQoThRIA2IGeMeLK5m57IG54fTjAxfIRHPkBjLkkqUd5z4g40EQx6CYS8dkRbaIj47RDONEEoMhwnFSQJxI0QRxSJh5LIG8ViK+HtpRj68QvJ8BqPIGcFqNA0C7V461rUQXu8n3O1D1y0TTA4hkrM4pFrvFIGsAR7EgqJeKpEldjrJucEUo0NpjCq3BGo6tHf5WNftp2tzAH/QkpLPVWAQ+MSKm9tJtQvEB/QAwVLeNJ3METuTJDaQZGw4XXTcUMkEQo1EewNs3B60QiyfAmeoYjtLtQrEBdwL3E+JAnAjZxA7neSd4wlGHC6KRdGgo8vHpr4g0c0BtNItwwzgQ8TSq+qWXdUoED+wGVhRipslx7OcfuMCg79NfJFyrXU8Po0N24P09K8m0FqyWeUy8DbCWVw1VJNA3IgZ4z5KUP0eG0pz8rUxht9N1d5sIYsG4aiPLbtDdPX4S3HHWcRM8j5VUpGvFoF4gV6E3bwoYgNJTv18jPF4pvi3qiFaw162PxsiujlQitt9BgxQBbFJNQgkDGyiyH0Y8cEUxw+PKGEUSTDkZcf+ENHeooUyBbyDcA5XLJUsEA2RoQoXcxMlDGtojXjpP9hBOFr00uscQigVudCtVIF4ga8gAvKCSCWyHD88SmwgWbq3UtxCpMfPU18NF5si/hz4LRVoq69EgawCtiIsI6bJZQ1OHh1l4I3xqi/qVQuaDr172tixP1RMlf468DvERq2KodIE0gk8RIFZquHBFL94ZZhUUimjHPiDjTzz9U7C3QVP/LOI5dZw6d6qOCpFIC5gA8J9a5psxuBXh+OcOV5Rv3xqlmhvgL0vhPH4Ct5d8AHwxxK+UsFUgkA0RAo3VMiHh99NcezlISbSFRnj1SxNfp19L0aIFD6bfAL8P8ocvJdbIHXAIxTgpTJyBsd/OsrA8fEKzX8o0KCnL8jur4YLjU0uAm9Sxt2L5RSIDjwK3GH2g4mxDEd+8iHJMUdtPXAswZCXA9/uIhAqKNOVBE5Sptaq5RJIA7CTAtK4gwNJXntlmFxWTRvVhO7R2PeNSKEFxhTwa0Smy1bKIZAG4DFEH1tpDANOHIlz6ti4NW+lsIWe/iB7vhZBM7/iugL8OzaLxG6B6EAfJmeObMbgZz+KMRJLW/NWClsJd/s48J1oIQ0oUsAJbFxu2SmQOkTMYcpwmEpkefWHMRVvOIxAqJFDP4jiD5iOS5KI5dZ06d/qVuwSiIYQx51mPjQ+nOanP4oxkVLxhhNp8us8949dtIZ9Zj+aQATulg8MuwSyFWg384H4YIrDP46Ry1r0RoqKQPdoHPx+VyGmx0+At7B4X4kdAtmIyQr58LtCHMpLVRtoOhz4dhddPaYzXDFEcwjLsFogEYRlXZrYQJKjLw1VfDsdRWnRNNj3YoTu7aZrxqcRlnlLcFt1Y4Qrd5OZDwwqcdQshgHHXh4uZHtCybvaLMQqgXgRcYe0K3foTJJjShw1jWHA0ZeGGDqTMvMxN7ANi46vsEIgGrAdE/s54oMpjvxEiUMhRHLkJzGGB02JpAHh6St5y0grBNKDiZY8Y8NpFZArbsDIwZEfD5ndJj3fDqqklFognZjYQ55KZPnZj1QqV3EruazBT/85ZnbzWwdwVynfo5QCaUKkdKXIZg0O/3BIFQEVt2UilePVfxo029CvhxIekFQqgbgRQblUV3XDgJ/9MEZiTHUaUSxNcmySI/8SMxOf1gEPU6Kj9UolkPsxsa/j+KtxZTxUSBMfTHPicNzMRwKIMVk0pRDICkQ7UCkGB5IMvK4s6wpznHp93GyNJEoRbaPmKVYgbmALktNZYizDa69UTMMKRTVhwLF/GyY5Jp3RcWFibN6OYgVyL7Bc5kIjZ3D0pbNqJ6CiYHIZgyM/iZHLSY8hPwV2ypmnGIE0I6YxKd74aZzEqArKFcWRGJvkxOFRMx9ZTxFZrWIE8hCSlcvhwRRvq55VihIx8Ma4OLZCDg2TnsCFFCqQNiQNYtl0jmMvDanWPIrSYcCxV4bJpqWLiKuB1kIeVYhA3IguiFK8/r/jqqmbouRMpHK88aqppdaDFDDeCxHIPUiu6YYHUwyeUt3VFdbw7skEcXlTYzNif5IpzG6YagD2IlExz+UMXv6Hd0klVLOF2xEINnq6egPta8LNa5c11fn0Rs0LkJs0MtnM9NXxP10d/eB3ydFkYlK51W6DP9jIi/99I7pHKhzOAa9hoiuKWYFsQKR283L81TinXlMFwcVoWlHXsOMv2rvb1jXf73YvneiYnXXNXBi5evbk/x07c/nidfXbZhF27Guj72CH7OWmtumaEUgjYvbIexRaKpHlpX94R1nYF+HuDctX7vzL9sfr6l2m+t1MT81m3zx2/vhHZz67aNW7VSuaDt/6H5tkD/GZBn6OZAM6MzHIfUieE/jL/xNX4liE9VsDrY8d6NhjVhwAdfUuz6P/KfTkhkeCbVa8WzVj5OC4fG2kDslVEMgLxAPcLXNhfDBldstkTdC5fnlg69Nt/W5NzvG8GG6N+i17Wnfd03OHqf5itUBsIGnGALsOsSLKi6xA7kGyKHj8yIjkLWuHlWu8yx79y7VFiWMet2u27pG/WPP46s5lprutOZ03XpVubqIhRJIXGYHUIXYK5mXoTJLxYWUnWUhDY732xPMd/Xqj21uqe9bp7sbdz3X2e5frBR/h5ETG4xkzFfYIEiGDjEA6EU2n83LiyJjMZTWD2+1y7Xvx7p1NLfWm+hHL4PFq/r1/19lXV+8qycYgp3BCfgWjI7E9PJ9AXEhORbGBpDIj3sSevw0/tCLY0GHV/f13NrQ98Xx4i1X3r0bG4xmGzkgXp+8hjx0+n0DWIPaa5+XUz9XssZBte9vWhe5p7rb6OaFI8/07ng1Jb1irBU4elR6LTeTxaOUTiFTsEY+lzLZocTTRh+9Ydf/WwDa7nnfvlsDDD/atWmvX8yqd8XiGkSHpjNaSY3wpgSxDuCDz8paqmH/B6s5lvq1PrdmVr0JeSlyuWfdDu4KPtkdbpPuROZ2B16RnkVZEGWNRlhJIGIntisnxrNkueI6lJdDQ8MSh8O463S2VYy8lbs2l7/qr9v477lxm+7MrkaF3UyTHpSxsLpYI1m8nEBeSy6vTb1xQez0ATXe5n/pa+LHGZXWmzl4sJbrH3fzkC3f11zW6bZu9KhYDzhy/IHu1aYGsRKIZcC5nMPiW2ikI8PQLnVtbAg0FbcopJc3++uCzfx/Z4Xar9O8fTiUw5PavNyFaBd3C7QQiFfANnU6SVZuh6P/rjgda72oqqjlAKQms8YR3HWyX3tTmVLJpg9hp6eX/omN+MYG4gJDMHd9R+8x5aNeqjru7l5s6JMgOOtcvf7B3zxqpZbKTeeeEdAJpLYvE3IsJ5E4kjFzpZI6R4drujtjZ3XLHg32rduAqTZvLkuLC1f3InV+pdWPjyFCatFwDbA+LLLMWE4iUnXpwIFHTwfnKNd5lj+5vf7wUBkSrcLtm6x7Z17Zr9V1NUsVeR2JA7LR0Zf2WldNiApEKNGNv1e5ecysMiFZRV+9atvtv7tpdy8bGmHwi6Za6380CaUbCWpJKZGu2cm6lAdEqat3YOBbPkEpK1UR83DT+bxaI3OwhP2U5DqsNiFZR08ZGA4bks1k3zCI3C0TKWmLCc+8o7DIgWkUtGxvPybs9bisQF6JAuCS5nMFYDWav7DYgWsW9WwIPb9wZlErjO4l4LCXb9DrIgnTvQoH4kdhhFR9M1VxDhjXh5ma7DYhW4XLNujf3r9p5132+os/OqCaMHIzK7VmvY8GJBQsFIhV0xt+rrdmjJdDQ8PjftD9RDgOiVbg1l953oOPxWjM2mlhmfaGFhQJZ1ItyMyMfXjHxStVNJRgQraIWjY2jQ9Jj9wstmBJILmuQPF876d2nX4j0VoIB0SpqzdiYGM3IHuB0ywzSiIR7d3Q4bea00aqm/687ulvvWibdYKxaCazxhB872P5Aud/DDgwDzselQoRliD7UXwhE6hi1seHaWF5t3BkMdXb7K86AaBV3r1++qVaMjWNDE7KXLgeTAknUQPW8s7vljs39q/tcrtlSHZFd+dSQsXF8RDrJdINApILQxIizBbJidWPFGxCtYt7YGFy7zNHGxsSo9EkSNwgkb048mzVIpZxbAGlorNee+lpnVRgQraKu3rXsyb/tdLSxMZWclA3UbxBI3t8aidGMY+3t1WhAtArHGxsNSMhlYptACKQBiROjJDtEVCXVakC0CqcbG5NjUmNZB3Q3ILWkSCWcKZBqNyBahZONjZLWdwCvtEDSSeed/uUUA6JVONXYmJIfy/ICcdoM4iQDolU41diYSkgnm5rcLNF2cSFXklMFv1Cl4UQDolU40dh4RX4GaXQjefZHJu2MFK+TDYhW4TRjY0a+XKHPZ7GWJJvOOcaD5XQDolU4ydhoGJDNSA3oBimBZCacoY5aMSBahZOMjZMTUrNIg9QSK5up/vij1gyIVnH3+uWbtjyxuuqNjdm01JhucCOxzXayymeQmjQgWoUL14ZHV1W9sTEjZzepcyNxvLNRxQFILRsQrcIJxkbJru9uNxIn3RpVusJSBkTrqKt3LXvi+XDVGhslx7SkQKpwBnG7Xa5nvhlWBkQLWdZU59/7d507q9HYKDmmNTmBVGEJ5Mnnwz2B1Z6Ocr+H0/Hf2RB64vnw5nK/h1kkx7TbkUHrtr1t69Z2NTsiHVkNhCLN651qbHQDM/ku0qpolakMiOXh3i2Bh9dvC6wp93vIIjmmZ+QEolWHw2BNuLl569NtjykDov24XLPurU+teaxajI2aLjVEDDmBVEGC9AsDYr1LynypKD1uzaU/+lfVYWzU5IKLGTcSG2krfQZRBsTKoXGZu/nJF+7aVenGRskZZMYNTOe7qrGpov9blQGxwmj216+qdGOjV25MT7uB6/mu8vgqd4312H9ZqwyIFUhgjSfc958r19jo8UqN6etuIG9G2NtUmWmsjTuDociGO5QBsUKJPFC5xkavT2pMX5ebQbwalRaGKANiFVChxkZNA90jNaDlZhCQVpwtKANi9VCJxkavX3osX3cDUt0YWgKVMRaVAbH6qDRjY0tAOgs96Qak2sz5g+UvL7jdLtczfx/eoQyI1UclGRv9QWmdZqQF4pNXnWU8+Xy4J7DGEy73eygKo1KMjX75sZxxA1IHJpR7Btn61Oq7lQGx+glFmtdv29u2rpzv4A9Ij+WJ+SA97/aRYGv5BNIWaW5Zvy2oDIgO4f7eQG9bpLlsrodASGos54Cp+RTp1XxXB9u9EptzrWHb061bVMbKObg16rftbSvPUkuDYJtUfucqfLlZ6nK+q3WPZmbtVjLC6/0rVqzyrLX9wQpLWRFsaG+Ptqyw+7n+YKNsDeQymBAIQFBuaiop9/asqMhKrKJ47tscsD3hEmyTHsM3CETqdM7WsK+AVyoO/6rGVbY/VGEL/pW67X+3rR3SY/gGgaRkPhGK2F8M9XiVhd2peJvrpQ6PLSWhLukxfAW+FMh14Fq+T7RFfLZ7srQ6d0VUXxWlx12v5W1aWEo0DdrkVkHXmPMoLjT6JfN9SvdoBNrtdXjMzszk3a+iqE5mpu39uw2GvbIB+qX5H9yL/eFSdKyzd8UzmTWcffZ0DZObnLH177Y9Ij12FxVI3hkEILze3j35Vy5NXrT1gQrb+Pxi1ta/286N0mN3UYGkkNh+G+722doGaPSjqyP2PU1hJ2NDV0ftepamQ3uXVPwxxYKs7kKBzCKxzNJ1TfZBJeG9UxfPT16byVvpV1QXk9eM9PsDF/9s1/PCUT+6XKOGiwgtALe2HR2XucO6jQH5NyuS6anZ2Q/evnTGtgcqbOG9ty79x/TU7Gz+K0tD5wbp5dUNGrhZIBdk7tC1yW+rL+vtX144d+n8tXP2PVFhJck/Z+Nnjn/6J9seqEFXj/Qv9U8X/sPNArmKhHHRH/TQGrY33fv6/zp36mpqKmHrQxUl58pn1z/9xf/8+Ld2PjMU8eEPSAXOaW7a/rFYwwOpWSS6xb5lFsC1CWPq2MvDv0xeyI7Y+mBFyUhemPzTsZfPvnFtwt4TZ6K90mP1lrG/mEDGZO7U3Ru03f4+kc5NHf3Xs//+xzcv/cbuHLqicHKTMxN/fDPxm6P/+tEJu8WBZuqX+Sc3/8Fipf5LiEYOS9oefQGdji4fI7G07MNLwszM7Oxbv/jzx28fH48/sG1lqP3e5Wt9K/SVukfz1tW58p7Yq7Ce6enZ67mskbmayiVHPrg8Onjq0id2BuQLCUd9+OS6mFxjkVrgYgKZRcwiebdFbuoL2i6QeYzc7Mzvf31x9Pe/vmhbLl1RffT0SXekvWX2gNufLrXoxTcT3RzA46uwjnIKxRwenyYyrnKYEsglJLqdaLrGhq1B2RdQKGxlw46gbBf3CeCzxf7FUm074zJ37tm9umx71RWK26JBT99q2atvW2NbSiDnWFByvx2BVg8ReROYQmELXZv8BOQ68cwCty1aLiWQLJLWk+17QjKXKRS2sf0p6TH5Z5Zov5uvM7qUvaMj6qM1olrlKiqD1oiXkLyhdskxnk8g40h2Xtz+jJpFFJXBjn3SY3GCPM6RfAKZBT6SeVJ0c4Cgzf4sheJmWsNeM8bEIfLE2TKHz8SRPEOkb7+aRRTlpe9Ah+yl15HI1MoIZBoYlnliV0+AkIpFFGUi1OUzk1EdRuKEZ9njy87K3Ayg72CH5C0VihKiwS75sTeNGNN5kRXIJJKzSDjqp2uzvVZ4hSK6OUCHfObqLBJnc4K8QAA+QKKpA8ATh9ptbeygqG10HfoPtctePoUIzqUwI5DrSE5L/qCH3j1tJm6tUBRO7942M4fifITk7AHmBALwIZIZrR37Q/iD5T+2TeFs/MFGtsvXPXJIli3mMSuQHBCTuVDXNZ75RqcyMiqsQ4Nnvt4p284H4D0kf8HPY1YgIJZZUrukwlE/G7ergF1hDRt3BAl3S6d108DHZp9RiEBmgD/IXrz7UJgm+YPbFQopfH6d3YdMnb/ze8TYNUUhAgHhgPw071WAx6ez/8WIWmopSocGz3wjgscrPajGkezWczOFCgTgDJLFw3C3n95+6b3BCsWS9O5pNVMxN4B3Cn1WMQK5Crwve3H/c+3ipFyFogiCIS/9B6RrHgCDSDrSF6MYgYBI+0od36bpGge+1SV7gIlCcQu6V+PAd7tk95kDfI7JtO7NFCuQWeA0EltzQRzgvv+/qnhEUQAa7PtmRHYbLZgcm7ejWIGAUKlUbQSE43f7HhWPKMyxY28bUXMev/eRXN0sRSkEAuJlpE6oAug7GCbcbf+R0orqJLLRzw75fR4g2lZJ/9JeilIJZBYYQBjB8qJpcPC7URW0K/ISDDWy/1tdZk5XnkKMxZK0Oi2VQEBkCqTTabpH49B/i+KTa0uvqEF8fp1DP+g2U+8A+A8kmh7KUkqBgOgvJH3Qjc+vc/B7UZXZUtyC7tU4+APTv0CHgZL2ai61QEAUED+Xvbg17OXg97vU/hHFF+g6PPe9KK0dppbgnyHsJCXFCoHMAL/FhOc+HPVz8PtRJRIFmgYHvhulI2oqiTMJnKIAr1U+rBAIiLMWfoeJQCnS7Wf/i6aCMYXD0DTY/50us61sZxBj7ZoV72SVQAASiIBJmmhvYK5SatEbKSoWTRfiMFnrADHGLlrwSoC1AgERsH9g5gNdPQEOfjeKrkRSM2g6HPh2QeJ4H8lTCArFNWvPyVi9QIeZD8RjKQ7/cIhcVsowrKhSdK/Gc98zHXOAOPDmdxa80g3YJRAN2AGYOm0nMZbh1X+KkU6a2iWpqBJ8fp2D/xgt5EjxT4GTWBCU34xdAgEhkp3ASjMfSqdyvPrPMRJxdaitkwiGvBwyX+cAYWn6NZItqIrFToEA6EAfYCpNkc0aHPlxjPhgeQ4MVZSWyEY/B75d0NaHz4ETSFqaSoHdAgFoAB4DWsx8yDDg5LERTh49L7mPUVFxaLB9byt9B8KFpPMvI8QhXV8rBeUQCAiR7MTkTAIwdCbJsZeHyWaUSqoJ3aux75uRQjJVIGaO32CzOKB8AgGx3NoBmP4/lhzPcuRfhkiMqrikGgi2eznwnS4zm50WcgkRkNu2rFpIOQUCInB/BFhl9oNGzuDE0VFOvTaullyViga9/a30P9duZpvsQhLAm9gUkC9GuQUColj5MGBqJ/48w4Mpjr08zERKpYIrCZ9f59kXI2Yau93MCPA2NqRyl6ISBDLPA8B9hXwwmzH41eE4Z04k1GxSAUR7A+x9IYzHV7Ad4n1Em9CyU0kCAQgDD1GgBWZkKM1rr5wlOT5Z2rdSSOEPNvLM1zuLmTVmEdslTLcItYpKEwiIavs2RKbLNLmcwamjY5x6/TyGWnXZgq6LIwi27wuZaSR9M5MI64hlxsNCqESBACwDvgKsKPQG6WSO40fiDJ5KqmWXhUR6/Dz11TD+YEEZqnmSWGhZL4ZKFQiIZVYP0FnMTUZiaX51+BxjwyolXEpCXT52Hewwc+zZ7fgY0cugrMH47ahkgcxzF7AJqC/mJvHBFMcPjzCuPF1FEWz3suPZENHeoo+1mELs5SjpHvJSUw0CAfAiLPOmjI6LMXQmycljY4yrGcUUoYiX7ftCdPWU5LyXJKI1T8E9c+2iWgQC4ALuB6JzPxfF2FCagV+OM3Q6iaFilMXRhLFw6+7WYjJTC5lFpHBjlKhvldVUk0DmWQ5soYgAfiHJ8Sxnjl/gD6cSZNNKKQAen8aG7UF6+lcXag9ZjMuIwp90x5tKoBoFAmIGWQd0A3WluKGRM4idTvHOiXFGhtK1l/nSIBz1sbGvlegmf6HWkMUwELPGh1TJrLGQahXIPE2ITNfqUt40ncoReztJbCDJ2LCzxRIINRLtDbBxe7DYVO1ijCMyVBUfa9yOahfIPKuABzG5x0SGVDLL0OkUZ99NMTqUqvrio65De9RP5wY/0Z6AVa1fryKauI1bcXM7cYpAQNRNIohA3pK/9VzOYDSW5twfUoyevUJiNFPxAb6midRse1cLnd1+2qO+Yqrd+cghPFQfU6F1DbM4SSDz1COEch9F1k7ykcsanI+nGRuaYHwkTWI0Syo5Wb4lmQb+QCPBdg+tHT5CXU20RSwVxDzTiOPBP8TkOeSVjhMFMk8DIpC/B4uFspBc1iBxPkNyLEsqKQSTSuS4kpgkk84VPeNoGnh9Oi3BRvxBHX+gEX/AQyDkIdjmtbsR+DSiL1UM4aVyHE4WyDyNCKHcTYEGyFKSzRpMpnNMpKeYyhrkcgbGlNhzn8sJ9ei6hqaBVi9+rvdoNPnqafTpeCqjE/51RCf1YRwqjHlqQSDzuBGbsu4D1PFWhTGBWEqdo4y7/OyklgQyjwtoRZggWylBVd7hzCKyUefmvtfUgKlFgSzEg9ikFUbUVBRfMoGIL+JAtszvUjZqXSALaQHWInoI16pYrgHnEX1vL5X5XSoCJZBbcSFaEYUQFXqnxytpxNLpPEoUt6AEkp8mhFBWA3diY8rYIqYQ21ovIIShfP9LoARiDhfCTbwSMcusRGwPrmSuIWaG+a8r1FigXQxKIMXTgBDNckQc40fMOnYfAZRDBNYphAguz33Z3q7TSSiBWIeO2Ak5/+VBiEmf+96AqM3UI2YmN19a96cRXqZZxJJoBjHQryOEcB2RWcrMfU1QptacTuf/AwPHH6TG3RCNAAAAAElFTkSuQmCC",wO="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAAACXBIWXMAAB2HAAAdhwGP5fFlAAAAGXRFWHRTb2Z0d2FyZQB3d3cuaW5rc2NhcGUub3Jnm+48GgAAHZ9JREFUeJztnX+UVNV9wD97ebPDuOH3Shc3hGz4ISH8CG4oSjlIVZoQjXKsjVhPitocT2Nje7SJSRSNErCa39bEmhQNqYeT1FprbJQmBIOUEHFLECQUQdxSsrIC8mszzj7mcekfdx4usLvzfTNv5v2Y9zlnzq7Lffdd99zP3t/fW3fy5EkSKkIGGFz4DAEaCj8bWPhkAAuoL6QfAKQK3+eBE4XvjwMO0A3kenzNAkeBY4Wv3RX9v6lR6hJByuYc4FygscfXYbxb8avFceAwcAA4WPgcAN6pcjliRSKIN+qA4UBzj8+QQEtUnCzwFtBR+HTybuuUUIREkOIMA1oKn2be7QZFlTzwO6C98DkSbHHCTSLI2dQB7wXGY6QYGmxxKs4RjCg7MS1MUiF6kAhiqAPOAyYA52MG1LVIDiPLduD/SGSpeUEGAZMLn8EBlyVsHAO2FT5dAZclMGpRkDpgLDAF04WqC7Y4oeckplXZCrxBjbUqtSRICvgg8BHMwDvBO0cxomwB7IDLUhVqQZD3ANOBaUA64LJAVxf6yCHo6oJcDp09Zn6ed6A7Z74fmIGUBYBqGAyZDAwahBo6HAYNCqjgp9GNkWQzZho5tsRZkAymtbgAs2JdHbJZdPvr6L3tnOh4E/bvQ3d2ovd1wNFDoHV5+SsFQ4ajRjWjmpqgqZkBo5pQo1tQLeOgoarzCyeA3wIbiKkocRQkg2kxWqn0anY2i96xjfz2LeidO9Htu6Gzo6KvLEpTM6plLGrCBFKTpqMmTqqGNHngVWAjMVu5j5MgAzCtxYVUSoxcDr25jfyml9DbtqLbXy+/Rag0SqFaxqEmTyfVOgM1fYbpslUGG3gJ0/WKxWp9XAQZC8ylAot6umMv+lfryL+8Ab1tKzgRH5taadS06aRmzMSaPReamivxlsPAesziY6SJuiDDgUuB9/ma68H9OOvWkl+3Br19S/hbiTJQY1pQcy8ldcl8VPNov7P/X2ANEd7OElVBFGYAfhF+DcBtG2fdC+RXPYPeFm8pekUp0w27fIFpWdK+Tfg5QBtmfBK5blcUBRkJ/AnwB35kpvfsIf/sUzgvrIKuY35kGX0GDcWaN5/UJ65GjR7jV64HgJ9jdhNHhigJojAtxkx8WP3W27Zg/+iH6LYNtddaSFEKNf0PSV91DWrWHD9y1JiW5KXC96EnKoIMBj6O2W5eBhpn3RryK59A797hR7lqBjV+IqnrbsKaM9eP7DqB5zGD+VATBUEmA5dQ5jkMvakNe/nD6F2JGOWgWsaR+tRfYs25tNysjgMvYBYaQ0uYBbGAy4APlZNJIkZlUOdPIf3pW1DTW8vN6lWMKE75pfKfsAoyGLiSMgbiumMv+R88irN2tX+lSjgLNXM26VtuK3eK+C3gWcwW+1ARRkHejxlvlLbcm8thP7Ec5+kno7+oFxWsNNY115G+/sZyVulzwE8xB7VCQ9gEmYLpVqlSHtZtG8g99CB07vO3VAkymprJ3PZFVOvMUnM4ieluveJfocojLILUAXMwi3/e6erCXv4wznPP+FqohNKw5s4j/dnPw9CSd/68DPyXj0UqmTAIYmG6VONLeVhvXE/uq0vNVvKE8DCskcwdi1EzZpWaw2vAfxLw4D1oQVLAAkrZS2Xb2I89gvPMvyQLfWFFKaz5V5K+5TZIlzQ2+R3w75gp4UAIUpCBwNXAKK8P6vbd2EvvRO9p979UCb6jWsaRXrwMNaallMffBJ4moCO+QQmSAa7B7KvyhLN2NfbXl757PDUhGgzMkL5jMdaceaU8/Rbwb5iZrqoShCAZ4FpghKentMZ+/FGcH6+oRJkSqoR1+QLSt94BludN2AeBJ6myJNUWZCDwZ3htObq6yH35DvTWTRUpVEJ1Ua0XkrlnGTR4DkDxFvCvVLG7VU1BUsCf4nXDYWcHubtuT8YbMUONaSGz7CFoavL66D6MJHn/S3U2JS3IlYCFGZB7kkPv2E721r9M5Ighek872VtvQu/Y7vXRUZiZz6pEqqmWIB/FBIQWozdtJHf7Z+Bwsr4RWw4fJPe5z6A3t3l98n3AfKoQFbMaglwMTPTygN64ntzdn4PjyUxV7OnOkfvS7ej1a70+OQH4I/8LdDqVFmQaHrePOGtXk/vyF+B4stGwZnBsckvvwlm9yuuTMzH79ypGJQV5P+agkxhn7Wrs++8Gpyrjr4Qw4eSxv3YfzjrPxxMuw++oNj2olCDuEVlx/nrDOuwH7k22jdQyWmPffy96wzovTyngCip0fUUlBLEwh53Em2/0pjZyS+9KWo4EcPLkltxlgmnIyQBXUYGZrUoIcikeTgLqHdsLA/JkzJFQwLHJ3fcl9E5Px6RHAiXtY+kPvwWZggmyIKOzg9zdtyezVQln050jd9ftsN9TGK1JhY9v+CnIUEx8XBnZLLm7P5+scyT0zeGD5L70t5D1dAPcZfh4QZJfgijgcqRR1R2H3N2fM9HRExL6Qe9pJ7fkLi+TNyngY/hUt/0S5CJAvKnG/v7DycbDBDF600vYy7/r5ZHzMNdglI0fgjRhFmxEOGtX4zz9Ix9em1BLOE+t9LpGMhMf4jeXK4jCBJIW7YnR7bvNYacwck6DNfCOe2fXNTYNDLooQWJ99MoxnNNQvSvrpGiN/Y37vWxcdetmWXW8XEFmAOeKUtq2WSUP40nAcxqsgfc+OF9NnTYlfc/SKweMPK8mJalfuGhi/adunJ9e8rUrGDykrFCvFSGbxV56F9jiJYGRmKv4SqYcQYbhoZ9nP/pQOAflrhznNb8XQA0fMSK1eEnNSVK/cNFE64oFc4G6AU2jRqXv+fvLwyiJbn8d+7FHvDwyizJuHitHkMsQrlzqtg04zz1dxqsqxBlyuNSaJD3lcH8WZkmcZ/4FvXG9NLmFWbwuiVIFGYd0g9iRI+QeWBK+PVZ9yOFSK5L0JodLaCXRmtzX74cu8c1u7wc+UMqrShFkACYKogj7kW+FL6hbETlc4i5Jf3K4hFaSwwex//E7Xp74Y0zd9UQpglyAcKVSt20wV5uFCaEcLnGVRCKHS1glcX7+LHrTRmnyocCHvb7DqyAZpAPzXI7cQ9/wWp7K4lEOl7hJ4kUOl7BKkvvWA5ATz4xehImsI8arIDMQbiexn1gOnXs9Zl9BSpTDJS6SlCKHSygl6ezA/tEPpanTeDzh6kWQcxA2Ubpjr7mfIyyUKYdL1CUpRw6XMEriPLkS3SH+Y3wBHs4qeRFkJsJ7Au1HHwrP5TU+yeESVUn8kMMldJI4Nnn52kgK0xMSIRXkPcBUSUK9qQ39a09HJiuHz3K4RE0SP+VwCZskzro16C3iDbAfxvSIiiIV5AKEi4L2448Ks6wwFZLDJSqSVEIOl7BJYj/6sDRpCpguSSgRJIUwtIpevxb92quSpJWlwnK4hF2SSsrhEiZJ9K7tXlbYP4xgyCARZCrCqTH7ieWSZJWlSnK4hFWSasjhEiZJ7BXflyYdiOB4eDFB6hA2Rc661ejdOyVJK0eV5XAJmyTVlMMlLJLoXTu8RGlspcjvqJggY4EhkjflVz4hLFOFCEgOl7BIEoQcLmGRxF65Qpp0CEX2aBUTRDZztbkNvdtTiBZ/CVgOl6AlCVIOlzBIondtR2/ZLE3e7/i6P0EGYXZBFsV+KsAjtCGRwyUoScIgh0sYJLGfWilN2oJZxuiV/gSZjOCXrffs8RoFzz9CJodLtSUJkxwuQUuiN65H790jSaroZ7DelyB1/T3Uk/yzTwVz1iOkcrhUS5IwyuESqCRak5cf0vMsSDOSYMC2jfPCz6SF8I+Qy+FSaUnCLIdLkJI4q1dJz68PwYQKOou+BDlfVIB1L3g51eUb6c9+/qKwy+HiSuJ3tBRr4Q0fDLscLgMaR55rnf+hks+Fl8zRIzjyKd8Jvf2wN0HqgPGSHPOrnpG+3FeOP/bIy/rg2/sDeXkJqOEjRvgZLaV+4aKJ9VdcdTERkAPnhHN8xfeed9o2HAji9R7q6Pn08vvsTZDRQEPR7PZ3ordtkb7cV06+vd+2v3LnT6MmiR/drSh0q07hyrF2dUdQRdBbN0sDYL+HXi6Z7U2QcZLcnLWrAw3EUIuSJHKUgNY4638pTX1W3e9NkBZJTvlfer4qy3dqSZJEjtLJr/2FNOlZdf9MQYYhCLKlO/aidwW4ct6DWpAkkaM89I7fQqeomzWcM7ZWnSmIqPXQvwrJgagCcZYkkcMHtMbZIO5mneZASYLkXw5o5bwf4ihJIod/5NvE4YH6FETRyyj+LHI59Lat4oJVkzhJksjhL3rLJrBF4YFG08OLnoKMRHDCSm9uC09Ahl6IgySJHBXguI1+RbTDNwU0uv/RU5DirQeQ3/SSt4IFwMm399v20sXP6UNvvx10WaS4kqRuumVapOT4waPPhV6OAnl5FMZTLvQUpNe9KGcS1u7VmZw82Nlt33fnTyLXklwybxZRkWPF9553XvzFm0EXRYp+VXxG5JQLPQUZVfSxbDacd3z0QRS7W5EgKt2qM9C7d0I2K0l6liDnYA5I9f+CHdvCd41BERJJfCaicgCgNXrndknKwRSiL7qCiK5Ry28PZu9VuSSS+ESU5SjgYf/gueBREL0z4KglZZBIUiYxkAMg//ouadLTBGnsJ+EpdLs481CSSFIiMZEDQO8Wj6EbwYsg2Szsf6u0UoWIRBKPxEgOAPZ3SAfqpwlS9MYo3b4zcgP0vkgkERI3OcAM1GV3rQ8FI0gGwaU4wggRkSGRpAhxlKOA3vuGJNlAIK2QBGcATnREZj1ITCJJH8RYDoATsq3vAEMUwtCi7I/l7yqR5ExiLgcA+8T/a0PELYiWWxc5EkkK1IIceKrLgxWSAA2A3rev5AJFgZqXpEbkANDyFqRBIbr7Q8PRQ2UUKRrUrCQ1JAcARw9LUw5USO5q6zoWmyneYtScJLUmB4CTh2yXJGVG1ILoI0fLLlOUqBlJalGOAvqIKCKoTBC6RLbFithLUsNyANI6nVFI7j7PHiu3OJEktpLUuhwg7WJZCsn1zvbxcosTWWInSSKHQRb13VIIbrrVTr7s8kSZ2EiSyHEKYZ1WChhQNFneKbc8kSfykiRynI6sTg+QCVLjLYhLFKOluBx/+sdrEjl6IAtdZRXtXiWczsmDnd0nXvnNa0GXwyvWZR/7iN+X+NQCCjhRNJUV6LXXoaJ+4aKJqUvmXRR0Obzi9yU+kcdKS1I5MkFSxSe6aoFIRTzshaDvcQ8Vsjp9QgFF95CopAWJvBwuiSQGYZ3WCig+nE8XPXAYa+Iih0siCZCWd7GKT1ENEh0ZiSVxk8Ol5iVpKBonEQqCFI8JP0h26DBuxFUOl1qWRA0V1el3FNBdNLPB1b/iOmjiLodLzUoySFSnc8IWZFBNTfXWihwuNSeJlYIG0UHablELAtRMN6vW5HCpKUmGFA0D55JTgCjMnBpV/HaEqFOrcrjUiiRqlOiuKCiMQUSHPVST6H6dyFLrcrjUgiSqqUma9KgCZOdpR8a3BUnkOJ3YSyJvQY6JBRnQHM8WJJGjd+IsyQCPLUg3UHTvrxotukI9UiRy9E9cJVFjxkmSdQO2u929aIgH1TKucL4qHiRyyIidJEqhxoj+2B+Bd4/bHiyavKEhNuOQRA5vxEkS1dQMmYwk6QF4V5ADosxbxpZYrPCQyFEasZGkRdS9gkKjIW9BgNSEiSWUKDwkcpRHHCRJTRgvTXpaCyIKRKAmTSuhSOEgkcMfoi6JmjRdmvS0FiQHFI2kpSZOiuRAPZHDXyIriZUydbg4xyjsUexZ24tfIdXQYGazIkQiR2WIoiRq7HjpAP1U9BfV2w/7fclkcRMVONbCGz4YGTmcE87xJ1f+LEohhVxJohItRU0RDxFONRbeWhAg1TrDQ5GCo37hoon1V1x1MVGRY8X3nneefeoN+747fxKl4HRRipaSap0pTdprC3IAwfFbNX2GNGRKYESqW3VGxMMoRnCMRHerPo2aKur9HKfHrG5PQTTwu6KPZzKoyVO9Fq9qRFkOl0QS/1HTWiEtGn/sBU6eeu6MfxTdsJ66cJa8ZFUkDnK4JJL4S2qGuM6e5kBJgliz54ZuujdOcrgkkviEUliz50hT/+9pj57xj0cQbFykqRk1Pjyr6nGUwyWRpHzUpCkwUrTF/RBnHP/orRmQdbMunidJVnHiLIdLIkl5pOaI6+pZdb83QXZKcrIumRd4N6sW5HBJJCm1EAprziXS1GfV/d5qeAfw+6JZNY4MdNGwluRwSSQp4f1TW6GxUZK0i17WAnsT5CTCViR1+QJJMt+x5i8YEyk5fvDoc35dXhPFS3zU8BEjrBtuDmSFOXWFuI72eudLX30kWTdr9lxphDpfcV5c3aHf7Aj/bUluy/HiL0S7FKScPNjZHaUV9xOd+/blH/nGr6v+4iFDvcxeeRKkA0k4oHQaa958aQH8452s033vF1bpNzuKL2wGRYXvBIxKd+tE5759+Xu/8FP9+66qX3RpzbtcuuvjCNDZ2z/0N8reJsk59Ymrgxmsh1mSKl2YGXZJgpQDpbwMAfqs6/3V7FfpseTeZwajx6Dkq5T+EkZJqnybbFglCVQOQF10MWr0GElSDfy2z3z6efD3CNdE0p+8XpKsMoRJkoCuWg6bJEHLAZD+sz+XJn2DfmZti/WNtkreoKa1os6fIi2Q/4RBkoDvIQ+LJGGQQ50/CTVZfPbj1X7zKvLwG0i2ngCpaz8lLVBlCFKSgOVwCVqSMMgBkL7+JmnSoxTpJRUT5CTwG8mbrDlzUWMnCMtVIYKQJCRyuAQlSVjkUOMnomaJp3bbKDLOlkw/bUN4h0h60c2SZJWlmpKETA6XaksSFjkA0jf9lTRpDtheLJFEkDywRfJGNWuO2TkZNNWQJKRyuFRLkjDJoSZN8zKj+gqSE7TCzDYjuS4aSN94izDLClNJSUIuh0ulJQmTHChF+mZx3ctj6nTxbIUZZpG2ItNbsf7oUmG2FaYSkkREDpdKSRIqOQBrzqVeNs9uRnI3J3JBADYiuVMdSH/ms1AfksAOfkoSMTlc/JYkbHJQnyH96VulqY8D/y1N7EWQHMJmiaZmrKuv85B1hfFDkojK4eKXJKGTA7CuvR7kl+JsQth6gDdBwEyLFb1sByD9qRtR5432mH0FKUeSiMvhUq4kYZSDpmbSnxSvwXVjBBHjVZBuQLZtOZ0hfdudgZ86PI1SJImJHC6lShJKOZQic9ud0nCiYOqu6A/8qVd4LpTpZh0SZT69FeuSj5fwigriRZKYyeHiVZJQygFYH70SJY/0eQgzteuJUgTRwIvSxOm//hsYJjryWD0kksRUDhepJGGVgxGNpG8WD8wBfompu54otf/zBmfED+qTQUPJfPHL4epqQf+SxFwOl2KShFYOpcjcvhgGDZI+Ia+vZ76qlIcKvIBw8VC1zsRacG0Zr6oQvUlSI3K49CVJaOUArGuuQ80Ur5jnMa1HSZQjyGGkA3YgffMtwW9m7I2ektSYHC5nShJmOVTLONKLxPutAH6FcEd6b9SdPFn00GB/KOB6YKQksd7TTu6vb4Bu8TR09TinwbI+NG2Y07ZBdKFpHKlrbBqYvumvPtL9na+9xDvZ0MlBQwOZ76yQnhQEeAtYieBkbF+UKwjAHwB/jrA10uvXkVtyB2jP46WEWkYp0osfwJozV/qExshR1sKoHyPntzDbUGQvnD0H65oQrbInRAJr4Q1e5ADT/S97a41fU0svIbyhCiD96VtRrRf69OqEuKNmzCJ9g6ezRh14+KPd77v9yATTnD2P2QgmeKsic8/fh3PQnhAqVMs4Mou/4mWZwMbUxbLHDuCfIGDO964Rp25oILPs2zBCNL5PqEWGNZJZ9k1oEK93gKmDxYMeCvF79W47RaJEnEZjI5mvfB0GivfSJNQKDQ1kHvim9F4Ply3A//hZjEosb6+hjzCOvRZgwkQyX/lmeM6PJARPfYbMkq+jxnq6pGkfZSwI9kUlBDkB/Ade9txPbzUtSchvz02oAlaKzJeXmUs35byDqXMn/C5OpTZIHQN+iofNYap1Juk77wnfnq2E6qEU6TuXoGbO9vKUxsjRVZEiVSLTAv+Hl0E7YM2ZR+beryYtSS1ipUkvXoY1x3M8g58jub68RCr953or8LKXB9SsOWTuexDqk4F7zWClydxTkhy/pp/A035Qjf7Mf+FxZkHNnEVmWTK7VRM0NJB58NteoiG6vAZsqECJTqNaHf6fY7pcYtT0GWQefhxGJusksWVYI5mv/aPXATnAHmBVBUp0FtUSxAGewWNfUbWMpeEfViQr7jFEtYyj4buPoyZ4msoFs6XpJ1Rgxqo3qjlllMdI8panpxobyXzze8nerRihZswi8+1/8roICKbuPI0wPpsf+LHd3SsZ4JOAt4PqWmOvXI7zxOPJVvmoohTWJ//CBJj2Pp1/EHgSD+trfhCEIGAk+VPMWRJP6A3ryD24BLK+bbdJqAYNDaT/bnEpM1VgWo5/o8pyQHCCAKSBq4HzvD6o9+zBXvoldPvr/pcqwXfU2AmkFy/zchKwJx3Av+MxnpVfBCkIQAq4CvD+m7Nt7Ccew3nyn5MuV1hRCmvBtSbqemmLv3sxclRtzHEmQQsCMAD4GOB5OgNAt20g99WlcPigv6VKKI9hjWS+eJ+XwG5n8j/Az6jSbFVfhEEQl9nAzJKezHZhf/9hnFXPJq1JCLDmziP92c/D0KGlZvESJhpJ4IRJEIDJwDxKnH7WWzZjf+t+9O/2+FuqBBlNo8nc9sVyWg2N2b8nul25GoRNEID3AVdgZrq8Y+ewV/4Q56mVcDyQcV3tUZ/BuvZ60gsXQbrkjabulvXg77vvQRgFARgMfALwvJJ0ioP7sZd/F+eFnyXdrgqiZs4mc+vfQVNzOdnso4Jb1sshrIKAGbxfCpR1K6jesgn7sUfQ2+UngROKoyZNM9Ey5dee9cUWzEnAQAfjfRFmQVwmYUSpLycTvakNe/l30buK3vyb0A9q7ARS199Y6oJfT2zMeMPXM+R+EwVBwHS55gPvLTcjvX4t9o9WoF9LRPGCmjSF9MJFpWxL7419mNA8JcfMrRZREQTMzNaFmKngsjdZ6m1byD/zJM66NckYpS+UMkHbrr6unJmpnmjMIaeN+BS3qtJESRCXc4E/oZwBfA/03j3kn3saZ/UqOBr6P2jVYchwrHkfJXX51aVuD+mNA5iFP2+7uQMmioKAaUE+jFlcTPmSo2PjvLiW/Kpn0Fs3116rohRqaiupKxZgzZ7jZ1wAB9NqtBGRVqMnURXEZShmAP9+X3M9uB9n3Vry69agt2+JtSxqTAtq7qWk511e7lRtb7yBuWjpqN8ZV4uoC+IyBvhjYITvOXd24mz4Jfm2X6O3bI7+4mN9BjVtOqkZs0xL4f3QkoTDwFqMIJEmLoKA6XZNBy7CbKX3HzuHfmUz+U0b0a9uRrfvBiewjaYyrBSqZTxq2jRSrTNRU1vLWe0uhntN+CuUcGFmGImTIC71mPHJH1IpUVxyOfSObWZG7PVd6N2vw/6O4LpkSqGamqFlHKlx41GTp6MmTvJyj3ip5DHXg7dhJIkNcRTEJYNpUVopc5HRE9ksem87es8bnOjohP0d6M5O9L69cPRo+S2OlYIhQ1CjRqOammBUMwOamlBjPoAaM7YaMvQkjwlWvhGzlyp2xFkQl3OAC4CplLoB0k+yWfSRQ9DVBdks5LJofQLyzrt3Nw7MQMpCqQGQaYCGBhg0CDV0uPk+eHKYbtQrxFQMl1oQxGUAcD5moXF4wGWJKkeB32BajZAPvvyhlgRxqQM+gNkE2UJ1Qx9FEQ20Y85otBPBtYxyqEVBevIe4EMYWYYEXJawcQTYhol9+/uAyxIYtS5IT0ZgumCTqF1ZuoBdwE5MNJGaJxHkbOqAZmAcpgsW9/HKIUzXaReJFGeRCFKcIRhRWjDb7as3ZVwZjmPC6bQXPkkEvn5IBPFGHWY3cTMm4F0z4OkK1gA4hmkZ3ix8PUiNDbTLIRGkfDIYaRoLn5GYVmdglcvRjRlYH8BIcLDwfdXDdcaJRJDKkcaIMgRzIrIBI9PAwtcMZm2mHtMyDeDdrft5zBntk5gu0QlMRc9hRMgBWUzrcLTwifguynDy/2Dl14zI6WdFAAAAAElFTkSuQmCC";const EO=125,kO=50,SO=-45,MO=1e-4;class CO{constructor(e,t=!0){this.psv=e,this.isDesktop=t,this.isDesktop&&(this._cursor=document.createElement("img"),this._cursor.src=bO,this.psv.container.appendChild(this._cursor),this._cursor.style.width="125px",this._cursor.style.height="125px",this._cursor.style.position="absolute",this._cursor.style.zIndex=10,this._cursor.style.pointerEvents="none",this._cursor.style.display="none",this._hideCursor=!1),this._couldGoSomewhere=!1,this._mapPreviewPic=null,this.psv.container.addEventListener("mousemove",this._onPointerMove.bind(this)),this.psv.container.addEventListener("mouseleave",this._onPointerLeave.bind(this)),this.psv._myMarkers.addEventListener("enter-marker",this._onHoverOtherStuff.bind(this)),this.psv._myMarkers.addEventListener("leave-marker",this._onLeaveOtherStuff.bind(this)),this.psv._myVTour.addEventListener("enter-arrow",this._onHoverOtherStuff.bind(this)),this.psv._myVTour.addEventListener("leave-arrow",this._onLeaveOtherStuff.bind(this)),this.psv.addEventListener("sequence-playing",this._onHoverOtherStuff.bind(this)),this.psv.addEventListener("sequence-stopped",this._onLeaveOtherStuff.bind(this)),this.psv.addEventListener("sequence-playing",this._onHoverOtherStuff.bind(this)),this.psv.addEventListener("pictures-navigation-changed",this._onPSVPicNavChanged.bind(this)),this.psv.addEventListener("click",this._onClick.bind(this))}async _onClick(e){if(this.psv._sequencePlaying||"pic"===this.psv.getPicturesNavigation()||this.psv._myVTour.state.loadingNode||this.psv.getSelectedAnnotations().length>0||this.psv._parent.map&&this.psv._parent.isMapWide?.())return;if(e.stopPropagation(),this._mapPreviewPic)return this.psv._keepSameAngle=!0,this.psv._parent.select(this._mapPreviewPic.collection,this._mapPreviewPic.id),void(this._mapPreviewPic=null);const t=this.psv.getPictureMetadata();if(!t)return;let i=Math.min(this._pitchDegToProjectedDistance(nt(e.data.pitch),TO(t)),kO);if(i>0){this._couldGoSomewhere=!0;const n=(nt(e.data.yaw)+this.psv.getPictureOriginalHeading())%360,a=DO(t.gps,i,n);let r;this.psv._parent.map&&(r=this._getMapNearbyPictures(a)),r&&0!==r?.length||(r=(await this.psv._parent.api.getPicturesAroundCoordinates(a[1],a[0],MO,50))?.features);const s=this._bestPicAround(t,a,n,r);s?(this.psv._keepSameAngle=!0,this.psv._parent.select(s.collection,s.id)):this.isDesktop&&(this._cursor.src=wO,setTimeout(()=>this._cursor.src=bO,1500))}else this._couldGoSomewhere=!1}_onPointerMove(e){this._couldGoSomewhere=!1;const t=this.psv.getPositionFromEvent(e);if(!t||"pic"===this.psv.getPicturesNavigation()||this.psv.getSelectedAnnotations().length>0||this.psv._parent.map&&this.psv._parent.isMapWide?.())return;const i=this.psv._parent?.map,n=this.psv.getPictureMetadata();if(!n)return;let a=Math.min(this._pitchDegToProjectedDistance(nt(t.pitch),TO(n)),kO);if(!this._hideCursor&&a>0){if(this._couldGoSomewhere=!0,this.isDesktop){const r=function(e){const t=((e=Math.max(Math.min(e,0),SO))-SO)/45,i=.2;return Math.max(1-Math.exp(-Math.pow(t-1,2)/(2*i*i)),.4)}
|
|
36
36
|
/**
|
|
37
37
|
* @license
|
|
38
38
|
* Copyright 2010-2026 Three.js Authors
|