diff --git a/index.html b/index.html
index c9bf061..17ebb31 100644
--- a/index.html
+++ b/index.html
@@ -12,7 +12,13 @@
-
+
+
+
+
+
+
+
diff --git a/static/css/mapbox-gl-v3.16.0.css b/static/css/mapbox-gl-v3.16.0.css
new file mode 100644
index 0000000..8c716f0
--- /dev/null
+++ b/static/css/mapbox-gl-v3.16.0.css
@@ -0,0 +1 @@
+.mapboxgl-map{font:12px/20px Helvetica Neue,Arial,Helvetica,sans-serif;overflow:hidden;position:relative;-webkit-tap-highlight-color:rgb(0 0 0/0)}.mapboxgl-canvas{left:0;position:absolute;top:0}.mapboxgl-map:-webkit-full-screen{height:100%;width:100%}.mapboxgl-canary{background-color:salmon}.mapboxgl-canvas-container.mapboxgl-interactive,.mapboxgl-ctrl-group button.mapboxgl-ctrl-compass{cursor:grab;-webkit-user-select:none;user-select:none}.mapboxgl-canvas-container.mapboxgl-interactive.mapboxgl-track-pointer{cursor:pointer}.mapboxgl-canvas-container.mapboxgl-interactive:active,.mapboxgl-ctrl-group button.mapboxgl-ctrl-compass:active{cursor:grabbing}.mapboxgl-canvas-container.mapboxgl-touch-zoom-rotate,.mapboxgl-canvas-container.mapboxgl-touch-zoom-rotate .mapboxgl-canvas{touch-action:pan-x pan-y}.mapboxgl-canvas-container.mapboxgl-touch-drag-pan,.mapboxgl-canvas-container.mapboxgl-touch-drag-pan .mapboxgl-canvas{touch-action:pinch-zoom}.mapboxgl-canvas-container.mapboxgl-touch-zoom-rotate.mapboxgl-touch-drag-pan,.mapboxgl-canvas-container.mapboxgl-touch-zoom-rotate.mapboxgl-touch-drag-pan .mapboxgl-canvas{touch-action:none}.mapboxgl-ctrl-bottom,.mapboxgl-ctrl-bottom-left,.mapboxgl-ctrl-bottom-right,.mapboxgl-ctrl-left,.mapboxgl-ctrl-right,.mapboxgl-ctrl-top,.mapboxgl-ctrl-top-left,.mapboxgl-ctrl-top-right{pointer-events:none;position:absolute;z-index:2}.mapboxgl-ctrl-top-left{left:0;top:0}.mapboxgl-ctrl-top{left:50%;top:0;transform:translateX(-50%)}.mapboxgl-ctrl-top-right{right:0;top:0}.mapboxgl-ctrl-right{right:0;top:50%;transform:translateY(-50%)}.mapboxgl-ctrl-bottom-right{bottom:0;right:0}.mapboxgl-ctrl-bottom{bottom:0;left:50%;transform:translateX(-50%)}.mapboxgl-ctrl-bottom-left{bottom:0;left:0}.mapboxgl-ctrl-left{left:0;top:50%;transform:translateY(-50%)}.mapboxgl-ctrl{clear:both;pointer-events:auto;transform:translate(0)}.mapboxgl-ctrl-top-left .mapboxgl-ctrl{float:left;margin:10px 0 0 10px}.mapboxgl-ctrl-top .mapboxgl-ctrl{float:left;margin:10px 0}.mapboxgl-ctrl-top-right .mapboxgl-ctrl{float:right;margin:10px 10px 0 0}.mapboxgl-ctrl-bottom-right .mapboxgl-ctrl,.mapboxgl-ctrl-right .mapboxgl-ctrl{float:right;margin:0 10px 10px 0}.mapboxgl-ctrl-bottom .mapboxgl-ctrl{float:left;margin:10px 0}.mapboxgl-ctrl-bottom-left .mapboxgl-ctrl,.mapboxgl-ctrl-left .mapboxgl-ctrl{float:left;margin:0 0 10px 10px}.mapboxgl-ctrl-group{background:#fff;border-radius:4px}.mapboxgl-ctrl-group:not(:empty){box-shadow:0 0 0 2px #0000001a}@media (-ms-high-contrast:active){.mapboxgl-ctrl-group:not(:empty){box-shadow:0 0 0 2px ButtonText}}.mapboxgl-ctrl-group button{background-color:initial;border:0;box-sizing:border-box;cursor:pointer;display:block;height:29px;outline:none;overflow:hidden;padding:0;width:29px}.mapboxgl-ctrl-group button+button{border-top:1px solid #ddd}.mapboxgl-ctrl button .mapboxgl-ctrl-icon{background-position:50%;background-repeat:no-repeat;display:block;height:100%;width:100%}@media (-ms-high-contrast:active){.mapboxgl-ctrl-icon{background-color:initial}.mapboxgl-ctrl-group button+button{border-top:1px solid ButtonText}}.mapboxgl-ctrl-attrib-button:focus,.mapboxgl-ctrl-group button:focus{box-shadow:0 0 2px 2px #0096ff}.mapboxgl-ctrl button:disabled{cursor:not-allowed}.mapboxgl-ctrl button:disabled .mapboxgl-ctrl-icon{opacity:.25}.mapboxgl-ctrl-group button:first-child{border-radius:4px 4px 0 0}.mapboxgl-ctrl-group button:last-child{border-radius:0 0 4px 4px}.mapboxgl-ctrl-group button:only-child{border-radius:inherit}.mapboxgl-ctrl button:not(:disabled):hover{background-color:#0000000d}.mapboxgl-ctrl-group button:focus:focus-visible{box-shadow:0 0 2px 2px #0096ff}.mapboxgl-ctrl-group button:focus:not(:focus-visible){box-shadow:none}.mapboxgl-ctrl button.mapboxgl-ctrl-zoom-out .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-9z'/%3E%3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-zoom-in .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5z'/%3E%3C/svg%3E")}@media (-ms-high-contrast:active){.mapboxgl-ctrl button.mapboxgl-ctrl-zoom-out .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-9z'/%3E%3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-zoom-in .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5z'/%3E%3C/svg%3E")}}@media (-ms-high-contrast:black-on-white){.mapboxgl-ctrl button.mapboxgl-ctrl-zoom-out .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23000' viewBox='0 0 29 29'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-9z'/%3E%3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-zoom-in .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23000' viewBox='0 0 29 29'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5z'/%3E%3C/svg%3E")}}.mapboxgl-ctrl button.mapboxgl-ctrl-fullscreen .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3h1zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16h1zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5H13zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1V7.5z'/%3E%3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-shrink .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 29 29'%3E%3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1h-5.5zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1v-5.5zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1v5.5zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1h5.5z'/%3E%3C/svg%3E")}@media (-ms-high-contrast:active){.mapboxgl-ctrl button.mapboxgl-ctrl-fullscreen .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3h1zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16h1zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5H13zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1V7.5z'/%3E%3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-shrink .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1h-5.5zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1v-5.5zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1v5.5zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1h5.5z'/%3E%3C/svg%3E")}}@media (-ms-high-contrast:black-on-white){.mapboxgl-ctrl button.mapboxgl-ctrl-fullscreen .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23000' viewBox='0 0 29 29'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3h1zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16h1zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5H13zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1V7.5z'/%3E%3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-shrink .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23000' viewBox='0 0 29 29'%3E%3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1h-5.5zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1v-5.5zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1v5.5zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1h5.5z'/%3E%3C/svg%3E")}}.mapboxgl-ctrl button.mapboxgl-ctrl-compass .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='M10.5 14l4-8 4 8h-8z'/%3E%3Cpath id='south' d='M10.5 16l4 8 4-8h-8z' fill='%23ccc'/%3E%3C/svg%3E")}@media (-ms-high-contrast:active){.mapboxgl-ctrl button.mapboxgl-ctrl-compass .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M10.5 14l4-8 4 8h-8z'/%3E%3Cpath id='south' d='M10.5 16l4 8 4-8h-8z' fill='%23999'/%3E%3C/svg%3E")}}@media (-ms-high-contrast:black-on-white){.mapboxgl-ctrl button.mapboxgl-ctrl-compass .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23000' viewBox='0 0 29 29'%3E%3Cpath d='M10.5 14l4-8 4 8h-8z'/%3E%3Cpath id='south' d='M10.5 16l4 8 4-8h-8z' fill='%23ccc'/%3E%3C/svg%3E")}}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23333'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle id='dot' cx='10' cy='10' r='2'/%3E%3Cpath id='stroke' d='M14 5l1 1-9 9-1-1 9-9z' display='none'/%3E%3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-buildings-toggle .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg fill='none' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3E%3Cpath d='M3.3335 11.6666C3.3335 12.5871 4.07969 13.3333 5.00016 13.3333C5.92064 13.3333 6.66683 12.5871 6.66683 11.6666L6.66683 6.66659L11.6668 6.66659C12.5873 6.66659 13.3335 5.92039 13.3335 4.99992C13.3335 4.07944 12.5873 3.33325 11.6668 3.33325H3.3335V11.6666Z' fill='currentColor'/%3E%3Cpath d='M26.6668 11.6666C26.6668 12.5871 25.9206 13.3333 25.0002 13.3333C24.0797 13.3333 23.3335 12.5871 23.3335 11.6666L23.3335 6.66659L18.3335 6.66659C17.413 6.66659 16.6668 5.92039 16.6668 4.99992C16.6668 4.07944 17.413 3.33325 18.3335 3.33325H26.6668L26.6668 11.6666Z' fill='currentColor'/%3E%3Cpath d='M13.3335 24.9999C13.3335 25.9204 12.5873 26.6666 11.6668 26.6666H3.3335V18.3333C3.3335 17.4128 4.07969 16.6666 5.00016 16.6666C5.92064 16.6666 6.66683 17.4128 6.66683 18.3333V23.3333H11.6668C12.5873 23.3333 13.3335 24.0794 13.3335 24.9999Z' fill='currentColor'/%3E%3Cpath d='M18.3335 26.6666C17.413 26.6666 16.6668 25.9204 16.6668 24.9999C16.6668 24.0794 17.413 23.3333 18.3335 23.3333H23.3335V18.3333C23.3335 17.4128 24.0797 16.6666 25.0002 16.6666C25.9206 16.6666 26.6668 17.4128 26.6668 18.3333V26.6666H18.3335Z' fill='currentColor'/%3E%3C/svg%3E");background-size:26px 26px}.mapboxgl-ctrl button.mapboxgl-ctrl-buildings-toggle.mapboxgl-ctrl-level-button-selected .mapboxgl-ctrl-icon{filter:invert(1) brightness(1)}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate:disabled .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23aaa'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle id='dot' cx='10' cy='10' r='2'/%3E%3Cpath id='stroke' d='M14 5l1 1-9 9-1-1 9-9z' fill='%23f00'/%3E%3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-active .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%2333b5e5'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle id='dot' cx='10' cy='10' r='2'/%3E%3Cpath id='stroke' d='M14 5l1 1-9 9-1-1 9-9z' display='none'/%3E%3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-active-error .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23e58978'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle id='dot' cx='10' cy='10' r='2'/%3E%3Cpath id='stroke' d='M14 5l1 1-9 9-1-1 9-9z' display='none'/%3E%3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-background .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%2333b5e5'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle id='dot' cx='10' cy='10' r='2' display='none'/%3E%3Cpath id='stroke' d='M14 5l1 1-9 9-1-1 9-9z' display='none'/%3E%3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-background-error .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23e54e33'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle id='dot' cx='10' cy='10' r='2' display='none'/%3E%3Cpath id='stroke' d='M14 5l1 1-9 9-1-1 9-9z' display='none'/%3E%3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-waiting .mapboxgl-ctrl-icon{animation:mapboxgl-spin 2s linear infinite}@media (-ms-high-contrast:active){.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23fff'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle id='dot' cx='10' cy='10' r='2'/%3E%3Cpath id='stroke' d='M14 5l1 1-9 9-1-1 9-9z' display='none'/%3E%3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate:disabled .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23999'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle id='dot' cx='10' cy='10' r='2'/%3E%3Cpath id='stroke' d='M14 5l1 1-9 9-1-1 9-9z' fill='%23f00'/%3E%3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-active .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%2333b5e5'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle id='dot' cx='10' cy='10' r='2'/%3E%3Cpath id='stroke' d='M14 5l1 1-9 9-1-1 9-9z' display='none'/%3E%3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-active-error .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23e58978'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle id='dot' cx='10' cy='10' r='2'/%3E%3Cpath id='stroke' d='M14 5l1 1-9 9-1-1 9-9z' display='none'/%3E%3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-background .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%2333b5e5'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle id='dot' cx='10' cy='10' r='2' display='none'/%3E%3Cpath id='stroke' d='M14 5l1 1-9 9-1-1 9-9z' display='none'/%3E%3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-background-error .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23e54e33'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle id='dot' cx='10' cy='10' r='2' display='none'/%3E%3Cpath id='stroke' d='M14 5l1 1-9 9-1-1 9-9z' display='none'/%3E%3C/svg%3E")}}@media (-ms-high-contrast:black-on-white){.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23000'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle id='dot' cx='10' cy='10' r='2'/%3E%3Cpath id='stroke' d='M14 5l1 1-9 9-1-1 9-9z' display='none'/%3E%3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate:disabled .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23666'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle id='dot' cx='10' cy='10' r='2'/%3E%3Cpath id='stroke' d='M14 5l1 1-9 9-1-1 9-9z' fill='%23f00'/%3E%3C/svg%3E")}}@keyframes mapboxgl-spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}a.mapboxgl-ctrl-logo{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' fill-rule='evenodd' viewBox='0 0 88 23'%3E%3Cdefs%3E%3Cpath id='logo' d='M11.5 2.25c5.105 0 9.25 4.145 9.25 9.25s-4.145 9.25-9.25 9.25-9.25-4.145-9.25-9.25 4.145-9.25 9.25-9.25zM6.997 15.983c-.051-.338-.828-5.802 2.233-8.873a4.395 4.395 0 013.13-1.28c1.27 0 2.49.51 3.39 1.42.91.9 1.42 2.12 1.42 3.39 0 1.18-.449 2.301-1.28 3.13C12.72 16.93 7 16 7 16l-.003-.017zM15.3 10.5l-2 .8-.8 2-.8-2-2-.8 2-.8.8-2 .8 2 2 .8z'/%3E%3Cpath id='text' d='M50.63 8c.13 0 .23.1.23.23V9c.7-.76 1.7-1.18 2.73-1.18 2.17 0 3.95 1.85 3.95 4.17s-1.77 4.19-3.94 4.19c-1.04 0-2.03-.43-2.74-1.18v3.77c0 .13-.1.23-.23.23h-1.4c-.13 0-.23-.1-.23-.23V8.23c0-.12.1-.23.23-.23h1.4zm-3.86.01c.01 0 .01 0 .01-.01.13 0 .22.1.22.22v7.55c0 .12-.1.23-.23.23h-1.4c-.13 0-.23-.1-.23-.23V15c-.7.76-1.69 1.19-2.73 1.19-2.17 0-3.94-1.87-3.94-4.19 0-2.32 1.77-4.19 3.94-4.19 1.03 0 2.02.43 2.73 1.18v-.75c0-.12.1-.23.23-.23h1.4zm26.375-.19a4.24 4.24 0 00-4.16 3.29c-.13.59-.13 1.19 0 1.77a4.233 4.233 0 004.17 3.3c2.35 0 4.26-1.87 4.26-4.19 0-2.32-1.9-4.17-4.27-4.17zM60.63 5c.13 0 .23.1.23.23v3.76c.7-.76 1.7-1.18 2.73-1.18 1.88 0 3.45 1.4 3.84 3.28.13.59.13 1.2 0 1.8-.39 1.88-1.96 3.29-3.84 3.29-1.03 0-2.02-.43-2.73-1.18v.77c0 .12-.1.23-.23.23h-1.4c-.13 0-.23-.1-.23-.23V5.23c0-.12.1-.23.23-.23h1.4zm-34 11h-1.4c-.13 0-.23-.11-.23-.23V8.22c.01-.13.1-.22.23-.22h1.4c.13 0 .22.11.23.22v.68c.5-.68 1.3-1.09 2.16-1.1h.03c1.09 0 2.09.6 2.6 1.55.45-.95 1.4-1.55 2.44-1.56 1.62 0 2.93 1.25 2.9 2.78l.03 5.2c0 .13-.1.23-.23.23h-1.41c-.13 0-.23-.11-.23-.23v-4.59c0-.98-.74-1.71-1.62-1.71-.8 0-1.46.7-1.59 1.62l.01 4.68c0 .13-.11.23-.23.23h-1.41c-.13 0-.23-.11-.23-.23v-4.59c0-.98-.74-1.71-1.62-1.71-.85 0-1.54.79-1.6 1.8v4.5c0 .13-.1.23-.23.23zm53.615 0h-1.61c-.04 0-.08-.01-.12-.03-.09-.06-.13-.19-.06-.28l2.43-3.71-2.39-3.65a.213.213 0 01-.03-.12c0-.12.09-.21.21-.21h1.61c.13 0 .24.06.3.17l1.41 2.37 1.4-2.37a.34.34 0 01.3-.17h1.6c.04 0 .08.01.12.03.09.06.13.19.06.28l-2.37 3.65 2.43 3.7c0 .05.01.09.01.13 0 .12-.09.21-.21.21h-1.61c-.13 0-.24-.06-.3-.17l-1.44-2.42-1.44 2.42a.34.34 0 01-.3.17zm-7.12-1.49c-1.33 0-2.42-1.12-2.42-2.51 0-1.39 1.08-2.52 2.42-2.52 1.33 0 2.42 1.12 2.42 2.51 0 1.39-1.08 2.51-2.42 2.52zm-19.865 0c-1.32 0-2.39-1.11-2.42-2.48v-.07c.02-1.38 1.09-2.49 2.4-2.49 1.32 0 2.41 1.12 2.41 2.51 0 1.39-1.07 2.52-2.39 2.53zm-8.11-2.48c-.01 1.37-1.09 2.47-2.41 2.47s-2.42-1.12-2.42-2.51c0-1.39 1.08-2.52 2.4-2.52 1.33 0 2.39 1.11 2.41 2.48l.02.08zm18.12 2.47c-1.32 0-2.39-1.11-2.41-2.48v-.06c.02-1.38 1.09-2.48 2.41-2.48s2.42 1.12 2.42 2.51c0 1.39-1.09 2.51-2.42 2.51z'/%3E%3C/defs%3E%3Cmask id='clip'%3E%3Crect x='0' y='0' width='100%25' height='100%25' fill='white'/%3E%3Cuse xlink:href='%23logo'/%3E%3Cuse xlink:href='%23text'/%3E%3C/mask%3E%3Cg id='outline' opacity='0.3' stroke='%23000' stroke-width='3'%3E%3Ccircle mask='url(%23clip)' cx='11.5' cy='11.5' r='9.25'/%3E%3Cuse xlink:href='%23text' mask='url(%23clip)'/%3E%3C/g%3E%3Cg id='fill' opacity='0.9' fill='%23fff'%3E%3Cuse xlink:href='%23logo'/%3E%3Cuse xlink:href='%23text'/%3E%3C/g%3E%3C/svg%3E");background-repeat:no-repeat;cursor:pointer;display:block;height:23px;margin:0 0 -4px -4px;overflow:hidden;width:88px}a.mapboxgl-ctrl-logo.mapboxgl-compact{width:23px}@media (-ms-high-contrast:active){a.mapboxgl-ctrl-logo{background-color:initial;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' fill-rule='evenodd' viewBox='0 0 88 23'%3E%3Cdefs%3E%3Cpath id='logo' d='M11.5 2.25c5.105 0 9.25 4.145 9.25 9.25s-4.145 9.25-9.25 9.25-9.25-4.145-9.25-9.25 4.145-9.25 9.25-9.25zM6.997 15.983c-.051-.338-.828-5.802 2.233-8.873a4.395 4.395 0 013.13-1.28c1.27 0 2.49.51 3.39 1.42.91.9 1.42 2.12 1.42 3.39 0 1.18-.449 2.301-1.28 3.13C12.72 16.93 7 16 7 16l-.003-.017zM15.3 10.5l-2 .8-.8 2-.8-2-2-.8 2-.8.8-2 .8 2 2 .8z'/%3E%3Cpath id='text' d='M50.63 8c.13 0 .23.1.23.23V9c.7-.76 1.7-1.18 2.73-1.18 2.17 0 3.95 1.85 3.95 4.17s-1.77 4.19-3.94 4.19c-1.04 0-2.03-.43-2.74-1.18v3.77c0 .13-.1.23-.23.23h-1.4c-.13 0-.23-.1-.23-.23V8.23c0-.12.1-.23.23-.23h1.4zm-3.86.01c.01 0 .01 0 .01-.01.13 0 .22.1.22.22v7.55c0 .12-.1.23-.23.23h-1.4c-.13 0-.23-.1-.23-.23V15c-.7.76-1.69 1.19-2.73 1.19-2.17 0-3.94-1.87-3.94-4.19 0-2.32 1.77-4.19 3.94-4.19 1.03 0 2.02.43 2.73 1.18v-.75c0-.12.1-.23.23-.23h1.4zm26.375-.19a4.24 4.24 0 00-4.16 3.29c-.13.59-.13 1.19 0 1.77a4.233 4.233 0 004.17 3.3c2.35 0 4.26-1.87 4.26-4.19 0-2.32-1.9-4.17-4.27-4.17zM60.63 5c.13 0 .23.1.23.23v3.76c.7-.76 1.7-1.18 2.73-1.18 1.88 0 3.45 1.4 3.84 3.28.13.59.13 1.2 0 1.8-.39 1.88-1.96 3.29-3.84 3.29-1.03 0-2.02-.43-2.73-1.18v.77c0 .12-.1.23-.23.23h-1.4c-.13 0-.23-.1-.23-.23V5.23c0-.12.1-.23.23-.23h1.4zm-34 11h-1.4c-.13 0-.23-.11-.23-.23V8.22c.01-.13.1-.22.23-.22h1.4c.13 0 .22.11.23.22v.68c.5-.68 1.3-1.09 2.16-1.1h.03c1.09 0 2.09.6 2.6 1.55.45-.95 1.4-1.55 2.44-1.56 1.62 0 2.93 1.25 2.9 2.78l.03 5.2c0 .13-.1.23-.23.23h-1.41c-.13 0-.23-.11-.23-.23v-4.59c0-.98-.74-1.71-1.62-1.71-.8 0-1.46.7-1.59 1.62l.01 4.68c0 .13-.11.23-.23.23h-1.41c-.13 0-.23-.11-.23-.23v-4.59c0-.98-.74-1.71-1.62-1.71-.85 0-1.54.79-1.6 1.8v4.5c0 .13-.1.23-.23.23zm53.615 0h-1.61c-.04 0-.08-.01-.12-.03-.09-.06-.13-.19-.06-.28l2.43-3.71-2.39-3.65a.213.213 0 01-.03-.12c0-.12.09-.21.21-.21h1.61c.13 0 .24.06.3.17l1.41 2.37 1.4-2.37a.34.34 0 01.3-.17h1.6c.04 0 .08.01.12.03.09.06.13.19.06.28l-2.37 3.65 2.43 3.7c0 .05.01.09.01.13 0 .12-.09.21-.21.21h-1.61c-.13 0-.24-.06-.3-.17l-1.44-2.42-1.44 2.42a.34.34 0 01-.3.17zm-7.12-1.49c-1.33 0-2.42-1.12-2.42-2.51 0-1.39 1.08-2.52 2.42-2.52 1.33 0 2.42 1.12 2.42 2.51 0 1.39-1.08 2.51-2.42 2.52zm-19.865 0c-1.32 0-2.39-1.11-2.42-2.48v-.07c.02-1.38 1.09-2.49 2.4-2.49 1.32 0 2.41 1.12 2.41 2.51 0 1.39-1.07 2.52-2.39 2.53zm-8.11-2.48c-.01 1.37-1.09 2.47-2.41 2.47s-2.42-1.12-2.42-2.51c0-1.39 1.08-2.52 2.4-2.52 1.33 0 2.39 1.11 2.41 2.48l.02.08zm18.12 2.47c-1.32 0-2.39-1.11-2.41-2.48v-.06c.02-1.38 1.09-2.48 2.41-2.48s2.42 1.12 2.42 2.51c0 1.39-1.09 2.51-2.42 2.51z'/%3E%3C/defs%3E%3Cmask id='clip'%3E%3Crect x='0' y='0' width='100%25' height='100%25' fill='white'/%3E%3Cuse xlink:href='%23logo'/%3E%3Cuse xlink:href='%23text'/%3E%3C/mask%3E%3Cg id='outline' opacity='1' stroke='%23000' stroke-width='3'%3E%3Ccircle mask='url(%23clip)' cx='11.5' cy='11.5' r='9.25'/%3E%3Cuse xlink:href='%23text' mask='url(%23clip)'/%3E%3C/g%3E%3Cg id='fill' opacity='1' fill='%23fff'%3E%3Cuse xlink:href='%23logo'/%3E%3Cuse xlink:href='%23text'/%3E%3C/g%3E%3C/svg%3E")}}@media (-ms-high-contrast:black-on-white){a.mapboxgl-ctrl-logo{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' fill-rule='evenodd' viewBox='0 0 88 23'%3E%3Cdefs%3E%3Cpath id='logo' d='M11.5 2.25c5.105 0 9.25 4.145 9.25 9.25s-4.145 9.25-9.25 9.25-9.25-4.145-9.25-9.25 4.145-9.25 9.25-9.25zM6.997 15.983c-.051-.338-.828-5.802 2.233-8.873a4.395 4.395 0 013.13-1.28c1.27 0 2.49.51 3.39 1.42.91.9 1.42 2.12 1.42 3.39 0 1.18-.449 2.301-1.28 3.13C12.72 16.93 7 16 7 16l-.003-.017zM15.3 10.5l-2 .8-.8 2-.8-2-2-.8 2-.8.8-2 .8 2 2 .8z'/%3E%3Cpath id='text' d='M50.63 8c.13 0 .23.1.23.23V9c.7-.76 1.7-1.18 2.73-1.18 2.17 0 3.95 1.85 3.95 4.17s-1.77 4.19-3.94 4.19c-1.04 0-2.03-.43-2.74-1.18v3.77c0 .13-.1.23-.23.23h-1.4c-.13 0-.23-.1-.23-.23V8.23c0-.12.1-.23.23-.23h1.4zm-3.86.01c.01 0 .01 0 .01-.01.13 0 .22.1.22.22v7.55c0 .12-.1.23-.23.23h-1.4c-.13 0-.23-.1-.23-.23V15c-.7.76-1.69 1.19-2.73 1.19-2.17 0-3.94-1.87-3.94-4.19 0-2.32 1.77-4.19 3.94-4.19 1.03 0 2.02.43 2.73 1.18v-.75c0-.12.1-.23.23-.23h1.4zm26.375-.19a4.24 4.24 0 00-4.16 3.29c-.13.59-.13 1.19 0 1.77a4.233 4.233 0 004.17 3.3c2.35 0 4.26-1.87 4.26-4.19 0-2.32-1.9-4.17-4.27-4.17zM60.63 5c.13 0 .23.1.23.23v3.76c.7-.76 1.7-1.18 2.73-1.18 1.88 0 3.45 1.4 3.84 3.28.13.59.13 1.2 0 1.8-.39 1.88-1.96 3.29-3.84 3.29-1.03 0-2.02-.43-2.73-1.18v.77c0 .12-.1.23-.23.23h-1.4c-.13 0-.23-.1-.23-.23V5.23c0-.12.1-.23.23-.23h1.4zm-34 11h-1.4c-.13 0-.23-.11-.23-.23V8.22c.01-.13.1-.22.23-.22h1.4c.13 0 .22.11.23.22v.68c.5-.68 1.3-1.09 2.16-1.1h.03c1.09 0 2.09.6 2.6 1.55.45-.95 1.4-1.55 2.44-1.56 1.62 0 2.93 1.25 2.9 2.78l.03 5.2c0 .13-.1.23-.23.23h-1.41c-.13 0-.23-.11-.23-.23v-4.59c0-.98-.74-1.71-1.62-1.71-.8 0-1.46.7-1.59 1.62l.01 4.68c0 .13-.11.23-.23.23h-1.41c-.13 0-.23-.11-.23-.23v-4.59c0-.98-.74-1.71-1.62-1.71-.85 0-1.54.79-1.6 1.8v4.5c0 .13-.1.23-.23.23zm53.615 0h-1.61c-.04 0-.08-.01-.12-.03-.09-.06-.13-.19-.06-.28l2.43-3.71-2.39-3.65a.213.213 0 01-.03-.12c0-.12.09-.21.21-.21h1.61c.13 0 .24.06.3.17l1.41 2.37 1.4-2.37a.34.34 0 01.3-.17h1.6c.04 0 .08.01.12.03.09.06.13.19.06.28l-2.37 3.65 2.43 3.7c0 .05.01.09.01.13 0 .12-.09.21-.21.21h-1.61c-.13 0-.24-.06-.3-.17l-1.44-2.42-1.44 2.42a.34.34 0 01-.3.17zm-7.12-1.49c-1.33 0-2.42-1.12-2.42-2.51 0-1.39 1.08-2.52 2.42-2.52 1.33 0 2.42 1.12 2.42 2.51 0 1.39-1.08 2.51-2.42 2.52zm-19.865 0c-1.32 0-2.39-1.11-2.42-2.48v-.07c.02-1.38 1.09-2.49 2.4-2.49 1.32 0 2.41 1.12 2.41 2.51 0 1.39-1.07 2.52-2.39 2.53zm-8.11-2.48c-.01 1.37-1.09 2.47-2.41 2.47s-2.42-1.12-2.42-2.51c0-1.39 1.08-2.52 2.4-2.52 1.33 0 2.39 1.11 2.41 2.48l.02.08zm18.12 2.47c-1.32 0-2.39-1.11-2.41-2.48v-.06c.02-1.38 1.09-2.48 2.41-2.48s2.42 1.12 2.42 2.51c0 1.39-1.09 2.51-2.42 2.51z'/%3E%3C/defs%3E%3Cmask id='clip'%3E%3Crect x='0' y='0' width='100%25' height='100%25' fill='white'/%3E%3Cuse xlink:href='%23logo'/%3E%3Cuse xlink:href='%23text'/%3E%3C/mask%3E%3Cg id='outline' opacity='1' stroke='%23fff' stroke-width='3' fill='%23fff'%3E%3Ccircle mask='url(%23clip)' cx='11.5' cy='11.5' r='9.25'/%3E%3Cuse xlink:href='%23text' mask='url(%23clip)'/%3E%3C/g%3E%3Cg id='fill' opacity='1' fill='%23000'%3E%3Cuse xlink:href='%23logo'/%3E%3Cuse xlink:href='%23text'/%3E%3C/g%3E%3C/svg%3E")}}.mapboxgl-ctrl.mapboxgl-ctrl-attrib{background-color:#ffffff80;margin:0;padding:0 5px}@media screen{.mapboxgl-ctrl-attrib.mapboxgl-compact{background-color:#fff;border-radius:12px;box-sizing:initial;margin:10px;min-height:20px;padding:2px 24px 2px 0;position:relative}.mapboxgl-ctrl-attrib.mapboxgl-compact-show{padding:2px 28px 2px 8px;visibility:visible}.mapboxgl-ctrl-bottom-left>.mapboxgl-ctrl-attrib.mapboxgl-compact-show,.mapboxgl-ctrl-left>.mapboxgl-ctrl-attrib.mapboxgl-compact-show,.mapboxgl-ctrl-top-left>.mapboxgl-ctrl-attrib.mapboxgl-compact-show{border-radius:12px;padding:2px 8px 2px 28px}.mapboxgl-ctrl-attrib.mapboxgl-compact .mapboxgl-ctrl-attrib-inner{display:none}.mapboxgl-ctrl-attrib-button{background-color:#ffffff80;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill-rule='evenodd'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E");border:0;border-radius:12px;box-sizing:border-box;cursor:pointer;display:none;height:24px;outline:none;position:absolute;right:0;top:0;width:24px}.mapboxgl-ctrl-bottom-left .mapboxgl-ctrl-attrib-button,.mapboxgl-ctrl-left .mapboxgl-ctrl-attrib-button,.mapboxgl-ctrl-top-left .mapboxgl-ctrl-attrib-button{left:0}.mapboxgl-ctrl-attrib.mapboxgl-compact .mapboxgl-ctrl-attrib-button,.mapboxgl-ctrl-attrib.mapboxgl-compact-show .mapboxgl-ctrl-attrib-inner{display:block}.mapboxgl-ctrl-attrib.mapboxgl-compact-show .mapboxgl-ctrl-attrib-button{background-color:#0000000d}.mapboxgl-ctrl-bottom-right>.mapboxgl-ctrl-attrib.mapboxgl-compact:after{bottom:0;right:0}.mapboxgl-ctrl-right>.mapboxgl-ctrl-attrib.mapboxgl-compact:after{right:0}.mapboxgl-ctrl-top-right>.mapboxgl-ctrl-attrib.mapboxgl-compact:after{right:0;top:0}.mapboxgl-ctrl-top-left>.mapboxgl-ctrl-attrib.mapboxgl-compact:after{left:0;top:0}.mapboxgl-ctrl-bottom-left>.mapboxgl-ctrl-attrib.mapboxgl-compact:after{bottom:0;left:0}.mapboxgl-ctrl-left>.mapboxgl-ctrl-attrib.mapboxgl-compact:after{left:0}}@media screen and (-ms-high-contrast:active){.mapboxgl-ctrl-attrib.mapboxgl-compact:after{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill-rule='evenodd' fill='%23fff'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E")}}@media screen and (-ms-high-contrast:black-on-white){.mapboxgl-ctrl-attrib.mapboxgl-compact:after{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill-rule='evenodd'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E")}}.mapboxgl-ctrl-attrib a{color:#000000bf;text-decoration:none}.mapboxgl-ctrl-attrib a:hover{color:inherit;text-decoration:underline}.mapboxgl-ctrl-attrib .mapbox-improve-map{font-weight:700;margin-left:2px}.mapboxgl-attrib-empty{display:none}.mapboxgl-ctrl-scale{background-color:#ffffffbf;border:2px solid #333;border-top:#333;box-sizing:border-box;color:#333;font-size:10px;padding:0 5px;white-space:nowrap}.mapboxgl-popup{display:flex;left:0;pointer-events:none;position:absolute;top:0;will-change:transform}.mapboxgl-popup-anchor-top,.mapboxgl-popup-anchor-top-left,.mapboxgl-popup-anchor-top-right{flex-direction:column}.mapboxgl-popup-anchor-bottom,.mapboxgl-popup-anchor-bottom-left,.mapboxgl-popup-anchor-bottom-right{flex-direction:column-reverse}.mapboxgl-popup-anchor-left{flex-direction:row}.mapboxgl-popup-anchor-right{flex-direction:row-reverse}.mapboxgl-popup-tip{border:10px solid #0000;height:0;width:0;z-index:1}.mapboxgl-popup-anchor-top .mapboxgl-popup-tip{align-self:center;border-bottom-color:#fff;border-top:none}.mapboxgl-popup-anchor-top-left .mapboxgl-popup-tip{align-self:flex-start;border-bottom-color:#fff;border-left:none;border-top:none}.mapboxgl-popup-anchor-top-right .mapboxgl-popup-tip{align-self:flex-end;border-bottom-color:#fff;border-right:none;border-top:none}.mapboxgl-popup-anchor-bottom .mapboxgl-popup-tip{align-self:center;border-bottom:none;border-top-color:#fff}.mapboxgl-popup-anchor-bottom-left .mapboxgl-popup-tip{align-self:flex-start;border-bottom:none;border-left:none;border-top-color:#fff}.mapboxgl-popup-anchor-bottom-right .mapboxgl-popup-tip{align-self:flex-end;border-bottom:none;border-right:none;border-top-color:#fff}.mapboxgl-popup-anchor-left .mapboxgl-popup-tip{align-self:center;border-left:none;border-right-color:#fff}.mapboxgl-popup-anchor-right .mapboxgl-popup-tip{align-self:center;border-left-color:#fff;border-right:none}.mapboxgl-popup-close-button{background-color:initial;border:0;border-radius:0 3px 0 0;cursor:pointer;position:absolute;right:0;top:0}.mapboxgl-popup-close-button:hover{background-color:#0000000d}.mapboxgl-popup-content{background:#fff;border-radius:3px;box-shadow:0 1px 2px #0000001a;padding:10px 10px 15px;pointer-events:auto;position:relative}.mapboxgl-popup-anchor-top-left .mapboxgl-popup-content{border-top-left-radius:0}.mapboxgl-popup-anchor-top-right .mapboxgl-popup-content{border-top-right-radius:0}.mapboxgl-popup-anchor-bottom-left .mapboxgl-popup-content{border-bottom-left-radius:0}.mapboxgl-popup-anchor-bottom-right .mapboxgl-popup-content{border-bottom-right-radius:0}.mapboxgl-popup-track-pointer{display:none}.mapboxgl-popup-track-pointer *{pointer-events:none;user-select:none}.mapboxgl-map:hover .mapboxgl-popup-track-pointer{display:flex}.mapboxgl-map:active .mapboxgl-popup-track-pointer{display:none}.mapboxgl-marker{left:0;opacity:1;position:absolute;top:0;transition:opacity .2s;will-change:transform}.mapboxgl-user-location-dot,.mapboxgl-user-location-dot:before{background-color:#1da1f2;border-radius:50%;height:15px;width:15px}.mapboxgl-user-location-dot:before{animation:mapboxgl-user-location-dot-pulse 2s infinite;content:"";position:absolute}.mapboxgl-user-location-dot:after{border:2px solid #fff;border-radius:50%;box-shadow:0 0 3px #00000059;box-sizing:border-box;content:"";height:19px;left:-2px;position:absolute;top:-2px;width:19px}.mapboxgl-user-location-show-heading .mapboxgl-user-location-heading{height:0;width:0}.mapboxgl-user-location-show-heading .mapboxgl-user-location-heading:after,.mapboxgl-user-location-show-heading .mapboxgl-user-location-heading:before{border-bottom:7.5px solid #4aa1eb;content:"";position:absolute}.mapboxgl-user-location-show-heading .mapboxgl-user-location-heading:before{border-left:7.5px solid #0000;transform:translateY(-28px) skewY(-20deg)}.mapboxgl-user-location-show-heading .mapboxgl-user-location-heading:after{border-right:7.5px solid #0000;transform:translate(7.5px,-28px) skewY(20deg)}@keyframes mapboxgl-user-location-dot-pulse{0%{opacity:1;transform:scale(1)}70%{opacity:0;transform:scale(3)}to{opacity:0;transform:scale(1)}}.mapboxgl-user-location-dot-stale{background-color:#aaa}.mapboxgl-user-location-dot-stale:after{display:none}.mapboxgl-user-location-accuracy-circle{background-color:#1da1f233;border-radius:100%;height:1px;width:1px}.mapboxgl-crosshair,.mapboxgl-crosshair .mapboxgl-interactive,.mapboxgl-crosshair .mapboxgl-interactive:active{cursor:crosshair}.mapboxgl-boxzoom{background:#fff;border:2px dotted #202020;height:0;left:0;opacity:.5;position:absolute;top:0;width:0}@media print{.mapbox-improve-map{display:none}}.mapboxgl-scroll-zoom-blocker,.mapboxgl-touch-pan-blocker{align-items:center;background:#000000b3;color:#fff;display:flex;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif;height:100%;justify-content:center;left:0;opacity:0;pointer-events:none;position:absolute;text-align:center;top:0;transition:opacity .75s ease-in-out;transition-delay:1s;width:100%}.mapboxgl-scroll-zoom-blocker-show,.mapboxgl-touch-pan-blocker-show{opacity:1;transition:opacity .1s ease-in-out}.mapboxgl-canvas-container.mapboxgl-touch-pan-blocker-override.mapboxgl-scrollable-page,.mapboxgl-canvas-container.mapboxgl-touch-pan-blocker-override.mapboxgl-scrollable-page .mapboxgl-canvas{touch-action:pan-x pan-y}.mapboxgl-ctrl-separator{background-color:#e0e0e0;height:1px}.mapboxgl-ctrl button.mapboxgl-ctrl-level-button{color:#333;font-size:18px;font-weight:700;height:50px;width:50px}.mapboxgl-ctrl button.mapboxgl-ctrl-level-button:first-child{border-top-left-radius:8px;border-top-right-radius:8px}.mapboxgl-ctrl button.mapboxgl-ctrl-level-button:last-child{border-bottom-left-radius:8px;border-bottom-right-radius:8px}.mapboxgl-ctrl button.mapboxgl-ctrl-level-button:hover{background-color:#f5f5f5}.mapboxgl-ctrl button.mapboxgl-ctrl-level-button-selected{background-color:#4a5568;color:#fff}.mapboxgl-ctrl button.mapboxgl-ctrl-level-button-selected:hover{background-color:#2d3748}
\ No newline at end of file
diff --git a/static/js/mapbox-gl-v3.16.0.js b/static/js/mapbox-gl-v3.16.0.js
new file mode 100644
index 0000000..91cbe68
--- /dev/null
+++ b/static/js/mapbox-gl-v3.16.0.js
@@ -0,0 +1,56 @@
+/* Mapbox GL JS is Copyright © 2020 Mapbox and subject to the Mapbox Terms of Service ((https://www.mapbox.com/legal/tos/). */
+(function (global, factory) {
+typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
+typeof define === 'function' && define.amd ? define(factory) :
+(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.mapboxgl = factory());
+})(this, (function () { 'use strict';
+
+/* eslint-disable */
+
+var shared, worker, mapboxgl;
+// define gets called three times: one for each chunk. we rely on the order
+// they're imported to know which is which
+function define(_, chunk) {
+if (!shared) {
+ shared = chunk;
+} else if (!worker) {
+ worker = chunk;
+} else {
+ var workerBundleString = "self.onerror = function() { console.error('An error occurred while parsing the WebWorker bundle. This is most likely due to improper transpilation by Babel; please see https://docs.mapbox.com/mapbox-gl-js/guides/install/#transpiling'); }; var sharedChunk = {}; (" + shared + ")(sharedChunk); (" + worker + ")(sharedChunk); self.onerror = null;"
+
+ var sharedChunk = {};
+ shared(sharedChunk);
+ mapboxgl = chunk(sharedChunk);
+ if (typeof window !== 'undefined' && window && window.URL && window.URL.createObjectURL) {
+ mapboxgl.workerUrl = window.URL.createObjectURL(new Blob([workerBundleString], { type: 'text/javascript' }));
+ }
+}
+}
+
+
+define(["exports"],(function(e){var t=1e-6,r="undefined"!=typeof Float32Array?Float32Array:Array;function n(e,t){var r=t[0],n=t[1],i=t[2],s=t[3],o=r*s-i*n;return o?(e[0]=s*(o=1/o),e[1]=-n*o,e[2]=-i*o,e[3]=r*o,e):null}function i(){var e=new r(9);return r!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1,e}function s(e,t){var r=t[0],n=t[1],i=t[2],s=t[3],o=t[4],a=t[5],l=t[6],u=t[7],c=t[8];return e[0]=o*c-a*u,e[1]=i*u-n*c,e[2]=n*a-i*o,e[3]=a*l-s*c,e[4]=r*c-i*l,e[5]=i*s-r*a,e[6]=s*u-o*l,e[7]=n*l-r*u,e[8]=r*o-n*s,e}function o(e,t,r){var n=t[0],i=t[1],s=t[2],o=t[3],a=t[4],l=t[5],u=t[6],c=t[7],h=t[8],p=r[0],d=r[1],f=r[2],m=r[3],y=r[4],g=r[5],x=r[6],v=r[7],b=r[8];return e[0]=p*n+d*o+f*u,e[1]=p*i+d*a+f*c,e[2]=p*s+d*l+f*h,e[3]=m*n+y*o+g*u,e[4]=m*i+y*a+g*c,e[5]=m*s+y*l+g*h,e[6]=x*n+v*o+b*u,e[7]=x*i+v*a+b*c,e[8]=x*s+v*l+b*h,e}function a(){var e=new r(16);return r!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function l(e){var t=new r(16);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function u(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function c(e,t){var r=t[0],n=t[1],i=t[2],s=t[3],o=t[4],a=t[5],l=t[6],u=t[7],c=t[8],h=t[9],p=t[10],d=t[11],f=t[12],m=t[13],y=t[14],g=t[15],x=r*a-n*o,v=r*l-i*o,b=r*u-s*o,w=n*l-i*a,_=n*u-s*a,A=i*u-s*l,M=c*m-h*f,I=c*y-p*f,S=c*g-d*f,P=h*y-p*m,k=h*g-d*m,z=p*g-d*y,T=x*z-v*k+b*P+w*S-_*I+A*M;return T?(e[0]=(a*z-l*k+u*P)*(T=1/T),e[1]=(i*k-n*z-s*P)*T,e[2]=(m*A-y*_+g*w)*T,e[3]=(p*_-h*A-d*w)*T,e[4]=(l*S-o*z-u*I)*T,e[5]=(r*z-i*S+s*I)*T,e[6]=(y*b-f*A-g*v)*T,e[7]=(c*A-p*b+d*v)*T,e[8]=(o*k-a*S+u*M)*T,e[9]=(n*S-r*k-s*M)*T,e[10]=(f*_-m*b+g*x)*T,e[11]=(h*b-c*_-d*x)*T,e[12]=(a*I-o*P-l*M)*T,e[13]=(r*P-n*I+i*M)*T,e[14]=(m*v-f*w-y*x)*T,e[15]=(c*w-h*v+p*x)*T,e):null}function h(e,t,r){var n=t[0],i=t[1],s=t[2],o=t[3],a=t[4],l=t[5],u=t[6],c=t[7],h=t[8],p=t[9],d=t[10],f=t[11],m=t[12],y=t[13],g=t[14],x=t[15],v=r[0],b=r[1],w=r[2],_=r[3];return e[0]=v*n+b*a+w*h+_*m,e[1]=v*i+b*l+w*p+_*y,e[2]=v*s+b*u+w*d+_*g,e[3]=v*o+b*c+w*f+_*x,e[4]=(v=r[4])*n+(b=r[5])*a+(w=r[6])*h+(_=r[7])*m,e[5]=v*i+b*l+w*p+_*y,e[6]=v*s+b*u+w*d+_*g,e[7]=v*o+b*c+w*f+_*x,e[8]=(v=r[8])*n+(b=r[9])*a+(w=r[10])*h+(_=r[11])*m,e[9]=v*i+b*l+w*p+_*y,e[10]=v*s+b*u+w*d+_*g,e[11]=v*o+b*c+w*f+_*x,e[12]=(v=r[12])*n+(b=r[13])*a+(w=r[14])*h+(_=r[15])*m,e[13]=v*i+b*l+w*p+_*y,e[14]=v*s+b*u+w*d+_*g,e[15]=v*o+b*c+w*f+_*x,e}function p(e,t,r){var n,i,s,o,a,l,u,c,h,p,d,f,m=r[0],y=r[1],g=r[2];return t===e?(e[12]=t[0]*m+t[4]*y+t[8]*g+t[12],e[13]=t[1]*m+t[5]*y+t[9]*g+t[13],e[14]=t[2]*m+t[6]*y+t[10]*g+t[14],e[15]=t[3]*m+t[7]*y+t[11]*g+t[15]):(i=t[1],s=t[2],o=t[3],a=t[4],l=t[5],u=t[6],c=t[7],h=t[8],p=t[9],d=t[10],f=t[11],e[0]=n=t[0],e[1]=i,e[2]=s,e[3]=o,e[4]=a,e[5]=l,e[6]=u,e[7]=c,e[8]=h,e[9]=p,e[10]=d,e[11]=f,e[12]=n*m+a*y+h*g+t[12],e[13]=i*m+l*y+p*g+t[13],e[14]=s*m+u*y+d*g+t[14],e[15]=o*m+c*y+f*g+t[15]),e}function d(e,t,r){var n=r[0],i=r[1],s=r[2];return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*i,e[5]=t[5]*i,e[6]=t[6]*i,e[7]=t[7]*i,e[8]=t[8]*s,e[9]=t[9]*s,e[10]=t[10]*s,e[11]=t[11]*s,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function f(e,t,r){var n=Math.sin(r),i=Math.cos(r),s=t[4],o=t[5],a=t[6],l=t[7],u=t[8],c=t[9],h=t[10],p=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=s*i+u*n,e[5]=o*i+c*n,e[6]=a*i+h*n,e[7]=l*i+p*n,e[8]=u*i-s*n,e[9]=c*i-o*n,e[10]=h*i-a*n,e[11]=p*i-l*n,e}function m(e,t,r){var n=Math.sin(r),i=Math.cos(r),s=t[0],o=t[1],a=t[2],l=t[3],u=t[8],c=t[9],h=t[10],p=t[11];return t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=s*i-u*n,e[1]=o*i-c*n,e[2]=a*i-h*n,e[3]=l*i-p*n,e[8]=s*n+u*i,e[9]=o*n+c*i,e[10]=a*n+h*i,e[11]=l*n+p*i,e}function y(e,t,r){var n=Math.sin(r),i=Math.cos(r),s=t[0],o=t[1],a=t[2],l=t[3],u=t[4],c=t[5],h=t[6],p=t[7];return t!==e&&(e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=s*i+u*n,e[1]=o*i+c*n,e[2]=a*i+h*n,e[3]=l*i+p*n,e[4]=u*i-s*n,e[5]=c*i-o*n,e[6]=h*i-a*n,e[7]=p*i-l*n,e}function g(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t[2],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function x(e,r,n){var i,s,o,a=n[0],l=n[1],u=n[2],c=Math.sqrt(a*a+l*l+u*u);return c0&&(s=1/Math.sqrt(s)),e[0]=t[0]*s,e[1]=t[1]*s,e[2]=t[2]*s,e}function O(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function U(e,t,r){var n=t[0],i=t[1],s=t[2],o=r[0],a=r[1],l=r[2];return e[0]=i*l-s*a,e[1]=s*o-n*l,e[2]=n*a-i*o,e}function N(e,t,r,n){var i=t[0],s=t[1],o=t[2];return e[0]=i+n*(r[0]-i),e[1]=s+n*(r[1]-s),e[2]=o+n*(r[2]-o),e}function j(e,t,r){var n=t[0],i=t[1],s=t[2],o=r[3]*n+r[7]*i+r[11]*s+r[15];return e[0]=(r[0]*n+r[4]*i+r[8]*s+r[12])/(o=o||1),e[1]=(r[1]*n+r[5]*i+r[9]*s+r[13])/o,e[2]=(r[2]*n+r[6]*i+r[10]*s+r[14])/o,e}function $(e,t,r){var n=t[0],i=t[1],s=t[2];return e[0]=n*r[0]+i*r[3]+s*r[6],e[1]=n*r[1]+i*r[4]+s*r[7],e[2]=n*r[2]+i*r[5]+s*r[8],e}function G(e,t,r){var n=r[0],i=r[1],s=r[2],o=r[3],a=t[0],l=t[1],u=t[2],c=i*u-s*l,h=s*a-n*u,p=n*l-i*a;return e[0]=a+o*(c+=c)+i*(p+=p)-s*(h+=h),e[1]=l+o*h+s*c-n*p,e[2]=u+o*p+n*h-i*c,e}function q(e){return e[0]=0,e[1]=0,e[2]=0,e}function H(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}var X=k,Z=z,W=M;function Y(){var e=new r(4);return r!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function K(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e}function J(e,t){var r=t[0],n=t[1],i=t[2],s=t[3],o=r*r+n*n+i*i+s*s;return o>0&&(o=1/Math.sqrt(o)),e[0]=r*o,e[1]=n*o,e[2]=i*o,e[3]=s*o,e}function Q(e,t,r){var n=t[0],i=t[1],s=t[2],o=t[3];return e[0]=r[0]*n+r[4]*i+r[8]*s+r[12]*o,e[1]=r[1]*n+r[5]*i+r[9]*s+r[13]*o,e[2]=r[2]*n+r[6]*i+r[10]*s+r[14]*o,e[3]=r[3]*n+r[7]*i+r[11]*s+r[15]*o,e}function ee(){var e=new r(4);return r!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function te(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}function re(e,t,r){r*=.5;var n=t[0],i=t[1],s=t[2],o=t[3],a=Math.sin(r),l=Math.cos(r);return e[0]=n*l+o*a,e[1]=i*l+s*a,e[2]=s*l-i*a,e[3]=o*l-n*a,e}function ne(e,t,r){r*=.5;var n=t[0],i=t[1],s=t[2],o=t[3],a=Math.sin(r),l=Math.cos(r);return e[0]=n*l-s*a,e[1]=i*l+o*a,e[2]=s*l+n*a,e[3]=o*l-i*a,e}_(),Y();var ie,se,oe,ae=J,le=(ie=_(),se=I(1,0,0),oe=I(0,1,0),function(e,t,r){var n=O(t,r);return n<-.999999?(U(ie,se,t),W(ie)<1e-6&&U(ie,oe,t),L(ie,ie),function(e,t,r){r*=.5;var n=Math.sin(r);e[0]=n*t[0],e[1]=n*t[1],e[2]=n*t[2],e[3]=Math.cos(r);}(e,ie,Math.PI),e):n>.999999?(e[0]=0,e[1]=0,e[2]=0,e[3]=1,e):(U(ie,t,r),e[0]=ie[0],e[1]=ie[1],e[2]=ie[2],e[3]=1+n,ae(e,e))});function ue(){var e=new r(2);return r!=Float32Array&&(e[0]=0,e[1]=0),e}function ce(e,t){var n=new r(2);return n[0]=e,n[1]=t,n}function he(e,t,r){return e[0]=t,e[1]=r,e}function pe(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e}function de(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e}function fe(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e}function me(e){var t=e[0],r=e[1];return Math.sqrt(t*t+r*r)}function ye(e,t){var r=t[0],n=t[1],i=r*r+n*n;return i>0&&(i=1/Math.sqrt(i)),e[0]=t[0]*i,e[1]=t[1]*i,e}function ge(e,t){return e[0]*t[0]+e[1]*t[1]}ee(),ee(),i();var xe,ve,be=de;function we(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}ue();var _e=function(){if(ve)return xe;function e(e,t,r,n){this.cx=3*e,this.bx=3*(r-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*t,this.by=3*(n-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=t,this.p2x=r,this.p2y=n;}return ve=1,xe=e,e.prototype={sampleCurveX:function(e){return ((this.ax*e+this.bx)*e+this.cx)*e},sampleCurveY:function(e){return ((this.ay*e+this.by)*e+this.cy)*e},sampleCurveDerivativeX:function(e){return (3*this.ax*e+2*this.bx)*e+this.cx},solveCurveX:function(e,t){if(void 0===t&&(t=1e-6),e<0)return 0;if(e>1)return 1;for(var r=e,n=0;n<8;n++){var i=this.sampleCurveX(r)-e;if(Math.abs(i)i?o=r:a=r,r=.5*(a-o)+o;return r},solve:function(e,t){return this.sampleCurveY(this.solveCurveX(e,t))}},xe}(),Ae=we(_e);function Me(e,t){this.x=e,this.y=t;}function Ie(e,t){if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return !1;for(let r=0;r=1)return 1;const t=e*e,r=t*e;return 4*(e<.5?r:3*(e-t)+r-.75)}function Ee(e,t,r,n){const i=new Ae(e,t,r,n);return function(e){return i.solve(e)}}const Ve=Ee(.25,.1,.25,1);function Fe(e,t,r){return Math.min(r,Math.max(t,e))}function Ce(e,t,r){return (r=Fe((r-e)/(t-e),0,1))*r*(3-2*r)}function De(e,t,r){const n=r-t,i=((e-t)%n+n)%n+t;return i===t?r:i}function Re(e,t,r){if(!e.length)return r(null,[]);let n=e.length;const i=new Array(e.length);let s=null;e.forEach(((e,o)=>{t(e,((e,t)=>{e&&(s=e),i[o]=t,0==--n&&r(s,i);}));}));}let Le=1;function Oe(){return Le++}function Ue(e){return e<=1?1:Math.pow(2,Math.ceil(Math.log2(e)))}function Ne(e,t){e.forEach((e=>{t[e]&&(t[e]=t[e].bind(t));}));}function je(e,t,r){const n={};for(const r in e)n[r]=t.call(this,e[r],r,e);return n}function $e(e,t,r){const n={};for(const r in e)t.call(this,e[r],r,e)&&(n[r]=e[r]);return n}function Ge(e){return Array.isArray(e)?e.map(Ge):"object"==typeof e&&e?je(e,Ge):e}function qe(e,t){for(let r=0;r=0)return !0;return !1}const He={};function Xe(e){He[e]||("undefined"!=typeof console&&console.warn(e),He[e]=!0);}function Ze(e,t,r){return (r.y-e.y)*(t.x-e.x)>(t.y-e.y)*(r.x-e.x)}function We(e){let t=0;for(let r,n,i=0,s=e.length,o=s-1;i@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,((e,r,n,i)=>{const s=n||i;return t[r]=!s||s.toLowerCase(),""})),t["max-age"]){const e=parseInt(t["max-age"],10);isNaN(e)?delete t["max-age"]:t["max-age"]=e;}return t}let Qe=null;function et(e,t){return [e[4*t],e[4*t+1],e[4*t+2],e[4*t+3]]}function tt(e,t,r,n){for(;t>1;e[i]>1;e[i]<=n?t=i+1:r=i;}return t}function nt(e){return e>0?1/(1.001-e):1+e}function it(e){return e>0?1-1/(1.001-e):-e}function st(e,t,r){return (e-t.min)*(r.max-r.min)/(t.max-t.min)+r.min}const ot={API_URL:"https://api.mapbox.com",get API_URL_REGEX(){return /^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/|\?|$)/i},get API_TILEJSON_REGEX(){return /^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/v[0-9]*\/.*\.json.*$)/i},get API_SPRITE_REGEX(){return /^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*\/sprite.*\..*$)/i},get API_FONTS_REGEX(){return /^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/fonts\/v[0-9]*\/)(.*\.pbf.*$)/i},get API_STYLE_REGEX(){return /^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*$)/i},get API_CDN_URL_REGEX(){return /^((https?:)?\/\/)?api\.mapbox\.c(n|om)(\/mapbox-gl-js\/)(.*$)/i},get EVENTS_URL(){if(!ot.API_URL)return null;try{const e=new URL(ot.API_URL);return "api.mapbox.cn"===e.hostname?"https://events.mapbox.cn/events/v2":"api.mapbox.com"===e.hostname?"https://events.mapbox.com/events/v2":null}catch(e){return null}},SESSION_PATH:"/map-sessions/v1",FEEDBACK_URL:"https://apps.mapbox.com/feedback",TILE_URL_VERSION:"v4",RASTER_URL_PREFIX:"raster/v1",RASTERARRAYS_URL_PREFIX:"rasterarrays/v1",REQUIRE_ACCESS_TOKEN:!0,ACCESS_TOKEN:null,DEFAULT_STYLE:"mapbox://styles/mapbox/standard",MAX_PARALLEL_IMAGE_REQUESTS:16,DRACO_URL:"https://api.mapbox.com/mapbox-gl-js/draco_decoder_gltf_v1.5.6.wasm",MESHOPT_URL:"https://api.mapbox.com/mapbox-gl-js/meshopt_base_v0.20.wasm",MESHOPT_SIMD_URL:"https://api.mapbox.com/mapbox-gl-js/meshopt_simd_v0.20.wasm",BUILDING_GEN_URL:"https://api.mapbox.com/mapbox-gl-js/building-gen/building_gen_v1.2.3.wasm",GLYPHS_URL:"mapbox://fonts/mapbox/{fontstack}/{range}.pbf",TILES3D_URL_PREFIX:"3dtiles/v1"};function at(e){return ot.API_URL_REGEX.test(e)}function lt(e){return ot.API_SPRITE_REGEX.test(e)}let ut,ct,ht,pt,dt,ft;function mt(){return null==ut&&(ut=self.OffscreenCanvas&&new OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof self.createImageBitmap),ut}const yt={now:()=>void 0!==pt?pt:performance.now(),setNow(e){pt=e;},restoreNow(){pt=void 0;},frame(e){const t=requestAnimationFrame(e);return {cancel:()=>cancelAnimationFrame(t)}},getImageData(e,t=0){const{width:r,height:n}=e;dt||(dt=document.createElement("canvas"));const i=dt.getContext("2d",{willReadFrequently:!0});if(!i)throw new Error("failed to create canvas 2d context");return (r>dt.width||n>dt.height)&&(dt.width=r,dt.height=n),i.clearRect(-t,-t,r+2*t,n+2*t),i.drawImage(e,0,0,r,n),i.getImageData(-t,-t,r+2*t,n+2*t)},resolveURL:e=>(ct||(ct=document.createElement("a")),ct.href=e,ct.href),get devicePixelRatio(){return window.devicePixelRatio},get prefersReducedMotion(){return !!window.matchMedia&&(null==ht&&(ht=window.matchMedia("(prefers-reduced-motion: reduce)")),ht.matches)},hasCanvasFingerprintNoise(){if(void 0!==ft)return ft;if(!mt())return ft=!1,!1;const e=new OffscreenCanvas(85,1),t=e.getContext("2d",{willReadFrequently:!0});let r=0;for(let n=0;n0?`?${s}`:""}`}const vt="mapbox-tiles";let bt=500,wt=50;const _t=["language","worldview","jobid"];let At,Mt;function It(){try{return caches}catch(e){}}function St(){const e=It();e&&null==At&&(At=e.open(vt));}let Pt=1/0;const kt={supported:!1,testSupport:function(e){!Bt&&Tt&&(Et?Ft(e):zt=e);}};let zt,Tt,Bt=!1,Et=!1;const Vt="undefined"!=typeof self?self:{};function Ft(e){const t=e.createTexture();e.bindTexture(e.TEXTURE_2D,t);try{if(e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,Tt),e.isContextLost())return;kt.supported=!0;}catch(e){}e.deleteTexture(t),Bt=!0;}Vt.document&&(Tt=Vt.document.createElement("img"),Tt.onload=function(){zt&&Ft(zt),zt=null,Et=!0;},Tt.onerror=function(){Bt=!0,zt=null;},Tt.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const Ct={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Iconset:"Iconset",Image:"Image",Model:"Model"};"function"==typeof Object.freeze&&Object.freeze(Ct);class Dt extends Error{constructor(e,t,r){401===t&&at(r)&&(e+=": you may have provided an invalid Mapbox access token. See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes"),super(e),this.status=t,this.url=r;}toString(){return `${this.name}: ${this.message} (${this.status}): ${this.url}`}}const Rt=Ke()?()=>self.worker.referrer:()=>("blob:"===location.protocol?parent:self).location.href;const Lt=function(e,t){if(!(/^file:/.test(r=e.url)||/^file:/.test(Rt())&&!/^\w+:/.test(r))){if(self.fetch&&self.Request&&self.AbortController&&Request.prototype.hasOwnProperty("signal"))return function(e,t){const r=new AbortController,n=new Request(e.url,{method:e.method||"GET",body:e.body,credentials:e.credentials,headers:e.headers,referrer:Rt(),referrerPolicy:e.referrerPolicy,signal:r.signal});let i=!1,s=!1;const o=(a=n.url).indexOf("sku=")>0&&at(a);var a;"json"===e.type&&n.headers.set("Accept","application/json");const l=(r,i,a)=>{if(s)return;if(r&&"SecurityError"!==r.message&&Xe(r.toString()),i&&a)return u(i);const l=Date.now();fetch(n).then((r=>{if(r.ok){const e=o?r.clone():null;return u(r,e,l)}return t(new Dt(r.statusText,r.status,e.url))})).catch((r=>{"AbortError"!==r.name&&t(new Error(`${r.message} ${e.url}`));}));},u=(r,o,a)=>{("arrayBuffer"===e.type?r.arrayBuffer():"json"===e.type?r.json():r.text()).then((e=>{s||(o&&a&&function(e,t,r){if(St(),null==At)return;const n=Je(t.headers.get("Cache-Control")||"");if(n["no-store"])return;const i={status:t.status,statusText:t.statusText,headers:new Headers};t.headers.forEach(((e,t)=>i.headers.set(t,e))),n["max-age"]&&i.headers.set("Expires",new Date(r+1e3*n["max-age"]).toUTCString());const s=i.headers.get("Expires");if(!s)return;if(new Date(s).getTime()-r<42e4)return;let o=xt(e.url,{persistentParams:_t});if(206===t.status){const t=e.headers.get("Range");if(!t)return;i.status=200,o=gt(o,{range:t});}!function(e,t){if(void 0===Mt)try{new Response(new ReadableStream),Mt=!0;}catch(e){Mt=!1;}Mt?t(e.body):e.blob().then(t).catch((e=>Xe(e.message)));}(t,(e=>{const r=new Response(200!==(n=t.status)&&404!==n&&[101,103,204,205,304].includes(n)?null:e,i);var n;St(),null!=At&&At.then((e=>e.put(o,r))).catch((e=>Xe(e.message)));}));}(n,o,a),i=!0,t(null,e,r.headers));})).catch((e=>{s||t(new Error(e.message));}));};return o?function(e,t){if(St(),null==At)return t(null);At.then((r=>{let n=xt(e.url,{persistentParams:_t});const i=e.headers.get("Range");i&&(n=gt(n,{range:i})),r.match(n).then((e=>{const i=function(e){if(!e)return !1;const t=new Date(e.headers.get("Expires")||0),r=Je(e.headers.get("Cache-Control")||"");return Number(t)>Date.now()&&!r["no-cache"]}(e);r.delete(n).catch(t),i&&r.put(n,e.clone()).catch(t),t(null,e,i);})).catch(t);})).catch(t);}(n,l):l(null,null),{cancel:()=>{s=!0,i||r.abort();}}}(e,t);if(Ke(self)&&self.worker.actor)return self.worker.actor.send("getResource",e,t,void 0,!0)}var r;return function(e,t){const r=new XMLHttpRequest;r.open(e.method||"GET",e.url,!0),"arrayBuffer"===e.type&&(r.responseType="arraybuffer");for(const t in e.headers)r.setRequestHeader(t,e.headers[t]);return "json"===e.type&&(r.responseType="text",r.setRequestHeader("Accept","application/json")),r.withCredentials="include"===e.credentials,r.onerror=()=>{t(new Error(r.statusText));},r.onload=()=>{if((r.status>=200&&r.status<300||0===r.status)&&null!==r.response){let n=r.response;if("json"===e.type)try{n=JSON.parse(r.response);}catch(e){return t(e)}const i=new Headers;r.getAllResponseHeaders().trim().split(/[\r\n]+/).forEach((e=>{const t=e.split(": "),r=t.shift(),n=t.join(": ");i.append(r,n);})),t(null,n,i);}else t(new Dt(r.statusText,r.status,e.url));},r.send(e.body),{cancel:()=>r.abort()}}(e,t)},Ot=function(e,t){return Lt(Object.assign(e,{type:"arrayBuffer"}),t)};function Ut(e){const t=document.createElement("a");return t.href=e,t.protocol===location.protocol&&t.host===location.host}const Nt="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let jt,$t;jt=[],$t=0;const Gt=function(e,t){if(kt.supported&&(e.headers||(e.headers={}),e.headers.accept="image/webp,*/*"),$t>=ot.MAX_PARALLEL_IMAGE_REQUESTS){const r={requestParameters:e,callback:t,cancelled:!1,cancel(){this.cancelled=!0;}};return jt.push(r),r}$t++;let r=!1;const n=()=>{if(!r)for(r=!0,$t--;jt.length&&$t{n(),e?t(e):r&&(self.createImageBitmap?function(e,t){const r=new Blob([new Uint8Array(e)],{type:"image/png"});createImageBitmap(r).then((e=>{t(null,e);})).catch((e=>{t(new Error(`Could not load image because of ${e.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`));}));}(r,((e,r)=>t(e,r,i))):function(e,t){const r=new Image;r.onload=()=>{t(null,r),URL.revokeObjectURL(r.src),r.onload=null,requestAnimationFrame((()=>{r.src=Nt;}));},r.onerror=()=>t(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const n=new Blob([new Uint8Array(e)],{type:"image/png"});r.src=e.byteLength?URL.createObjectURL(n):Nt;}(r,((e,r)=>t(e,r,i))));}));return {cancel:()=>{i.cancel(),n();}}};var qt,Ht,Xt,Zt={exports:{}},Wt={exports:{}},Yt={exports:{}},Kt=function(){if(Xt)return Zt.exports;Xt=1;var e=(qt||(qt=1,Wt.exports=function(e,t){var r,n,i,s,o,a,l,u;for(n=e.length-(r=3&e.length),i=t,o=3432918353,a=461845907,u=0;u>>16)*o&65535)<<16)&4294967295)<<15|l>>>17))*a+(((l>>>16)*a&65535)<<16)&4294967295)<<13|i>>>19))+((5*(i>>>16)&65535)<<16)&4294967295))+((58964+(s>>>16)&65535)<<16);switch(l=0,r){case 3:l^=(255&e.charCodeAt(u+2))<<16;case 2:l^=(255&e.charCodeAt(u+1))<<8;case 1:i^=l=(65535&(l=(l=(65535&(l^=255&e.charCodeAt(u)))*o+(((l>>>16)*o&65535)<<16)&4294967295)<<15|l>>>17))*a+(((l>>>16)*a&65535)<<16)&4294967295;}return i^=e.length,i=2246822507*(65535&(i^=i>>>16))+((2246822507*(i>>>16)&65535)<<16)&4294967295,i=3266489909*(65535&(i^=i>>>13))+((3266489909*(i>>>16)&65535)<<16)&4294967295,(i^=i>>>16)>>>0}),Wt.exports),t=(Ht||(Ht=1,Yt.exports=function(e,t){for(var r,n=e.length,i=t^n,s=0;n>=4;)r=1540483477*(65535&(r=255&e.charCodeAt(s)|(255&e.charCodeAt(++s))<<8|(255&e.charCodeAt(++s))<<16|(255&e.charCodeAt(++s))<<24))+((1540483477*(r>>>16)&65535)<<16),i=1540483477*(65535&i)+((1540483477*(i>>>16)&65535)<<16)^(r=1540483477*(65535&(r^=r>>>24))+((1540483477*(r>>>16)&65535)<<16)),n-=4,++s;switch(n){case 3:i^=(255&e.charCodeAt(s+2))<<16;case 2:i^=(255&e.charCodeAt(s+1))<<8;case 1:i=1540483477*(65535&(i^=255&e.charCodeAt(s)))+((1540483477*(i>>>16)&65535)<<16);}return i=1540483477*(65535&(i^=i>>>13))+((1540483477*(i>>>16)&65535)<<16),(i^=i>>>15)>>>0}),Yt.exports);return Zt.exports=e,Zt.exports.murmur3=e,Zt.exports.murmur2=t,Zt.exports}(),Jt=we(Kt);class Qt{constructor(e,...t){Object.assign(this,t[0]||{}),this.type=e;}}class er extends Qt{constructor(e,t={}){super("error",Object.assign({error:e},t));}}function tr(e,t,r){r[e]&&-1!==r[e].indexOf(t)||(r[e]=r[e]||[],r[e].push(t));}function rr(e,t,r){if(r&&r[e]){const n=r[e].indexOf(t);-1!==n&&r[e].splice(n,1);}}class nr{on(e,t){return this._listeners=this._listeners||{},tr(e,t,this._listeners),this}off(e,t){return rr(e,t,this._listeners),rr(e,t,this._oneTimeListeners),this}once(e,t){return t?(this._oneTimeListeners=this._oneTimeListeners||{},tr(e,t,this._oneTimeListeners),this):new Promise((t=>{this.once(e,t);}))}fire(e,t){const r="string"==typeof e?new Qt(e,t):e,n=r.type;if(this.listens(n)){r.target=this;const e=this._listeners&&this._listeners[n]?this._listeners[n].slice():[];for(const t of e)t.call(this,r);const t=this._oneTimeListeners&&this._oneTimeListeners[n]?this._oneTimeListeners[n].slice():[];for(const e of t)rr(n,e,this._oneTimeListeners),e.call(this,r);const i=this._eventedParent;if(i){const e="function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData;Object.assign(r,e),i.fire(r);}}else r instanceof er&&console.error(r.error);return this}listens(e){return !!(this._listeners&&this._listeners[e]&&this._listeners[e].length>0||this._oneTimeListeners&&this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e))}setEventedParent(e,t){return this._eventedParent=e,this._eventedParentData=t,this}}class ir{constructor(e){"string"==typeof e?this.name=e:(this.name=e.name,this.iconsetId=e.iconsetId);}static from(e){return new ir(e)}static toString(e){return e.iconsetId?`${e.name}${e.iconsetId}`:e.name}static parse(e){const[t,r]=e.split("");return new ir({name:t,iconsetId:r})}static isEqual(e,t){return e.name===t.name&&e.iconsetId===t.iconsetId}toString(){return ir.toString(this)}serialize(){return {name:this.name,iconsetId:this.iconsetId}}}var sr,or={},ar=function(){if(sr)return or;sr=1;var e={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function t(e){return (e=Math.round(e))<0?0:e>255?255:e}function r(e){return t("%"===e[e.length-1]?parseFloat(e)/100*255:parseInt(e))}function n(e){return (t="%"===e[e.length-1]?parseFloat(e)/100:parseFloat(e))<0?0:t>1?1:t;var t;}function i(e,t,r){return r<0?r+=1:r>1&&(r-=1),6*r<1?e+(t-e)*r*6:2*r<1?t:3*r<2?e+(t-e)*(2/3-r)*6:e}try{or.parseCSSColor=function(s){var o,a=s.replace(/ /g,"").toLowerCase();if(a in e)return e[a].slice();if("#"===a[0])return 4===a.length?(o=parseInt(a.substr(1),16))>=0&&o<=4095?[(3840&o)>>4|(3840&o)>>8,240&o|(240&o)>>4,15&o|(15&o)<<4,1]:null:7===a.length&&(o=parseInt(a.substr(1),16))>=0&&o<=16777215?[(16711680&o)>>16,(65280&o)>>8,255&o,1]:null;var l=a.indexOf("("),u=a.indexOf(")");if(-1!==l&&u+1===a.length){var c=a.substr(0,l),h=a.substr(l+1,u-(l+1)).split(","),p=1;switch(c){case "rgba":if(4!==h.length)return null;p=n(h.pop());case "rgb":return 3!==h.length?null:[r(h[0]),r(h[1]),r(h[2]),p];case "hsla":if(4!==h.length)return null;p=n(h.pop());case "hsl":if(3!==h.length)return null;var d=(parseFloat(h[0])%360+360)%360/360,f=n(h[1]),m=n(h[2]),y=m<=.5?m*(f+1):m+f-m*f,g=2*m-y;return [t(255*i(g,y,d+1/3)),t(255*i(g,y,d)),t(255*i(g,y,d-1/3)),p];default:return null}}return null};}catch(e){}return or}();class lr{constructor(e,t,r,n=1){this.r=e,this.g=t,this.b=r,this.a=n;}static parse(e){if(!e)return;if(e instanceof lr)return e;if("string"!=typeof e)return;const t=ar.parseCSSColor(e);return t?new lr(t[0]/255,t[1]/255,t[2]/255,t[3]):void 0}toString(){const[e,t,r,n]=[this.r,this.g,this.b,this.a];return `rgba(${Math.round(255*e)},${Math.round(255*t)},${Math.round(255*r)},${n})`}toNonPremultipliedRenderColor(e){const{r:t,g:r,b:n,a:i}=this;return new cr(e,t,r,n,i)}toPremultipliedRenderColor(e){const{r:t,g:r,b:n,a:i}=this;return new hr(e,t*i,r*i,n*i,i)}clone(){return new lr(this.r,this.g,this.b,this.a)}}class ur{constructor(e,t,r,n,i,s=!1){if(this.premultiplied=!1,this.premultiplied=s,e){const s=e.image.height,o=s*s;this.premultiplied?(t=0===i?0:t/i*(s-1),r=0===i?0:r/i*(s-1),n=0===i?0:n/i*(s-1)):(t*=s-1,r*=s-1,n*=s-1);const a=Math.floor(t),l=Math.floor(r),u=Math.floor(n),c=Math.ceil(t),h=Math.ceil(r),p=Math.ceil(n),d=t-a,f=r-l,m=n-u,y=e.image.data,g=4*(a+l*o+u*s),x=4*(a+l*o+p*s),v=4*(a+h*o+u*s),b=4*(a+h*o+p*s),w=4*(c+l*o+u*s),_=4*(c+l*o+p*s),A=4*(c+h*o+u*s),M=4*(c+h*o+p*s);if(g<0||M>=y.length)throw new Error("out of range");this.r=pr(pr(pr(y[g],y[x],m),pr(y[v],y[b],m),f),pr(pr(y[w],y[_],m),pr(y[A],y[M],m),f),d)/255*(this.premultiplied?i:1),this.g=pr(pr(pr(y[g+1],y[x+1],m),pr(y[v+1],y[b+1],m),f),pr(pr(y[w+1],y[_+1],m),pr(y[A+1],y[M+1],m),f),d)/255*(this.premultiplied?i:1),this.b=pr(pr(pr(y[g+2],y[x+2],m),pr(y[v+2],y[b+2],m),f),pr(pr(y[w+2],y[_+2],m),pr(y[A+2],y[M+2],m),f),d)/255*(this.premultiplied?i:1),this.a=i;}else this.r=t,this.g=r,this.b=n,this.a=i;}toArray(){const{r:e,g:t,b:r,a:n}=this;return [255*e,255*t,255*r,n]}toHslaArray(){let{r:e,g:t,b:r,a:n}=this;if(this.premultiplied){if(0===n)return [0,0,0,0];const i=1/n;e*=i,t*=i,r*=i;}const i=Math.min(Math.max(e,0),1),s=Math.min(Math.max(t,0),1),o=Math.min(Math.max(r,0),1),a=Math.min(i,s,o),l=Math.max(i,s,o),u=l-a,c=.5*(a+l);if(0===u)return [0,0,100*c,n];const h=c>.5?u/(2-l-a):u/(l+a);let p;switch(l){case i:p=60*((s-o)/u+(spr(e,t[n],r)))}lr.black=new lr(0,0,0,1),lr.white=new lr(1,1,1,1),lr.transparent=new lr(0,0,0,0),lr.red=new lr(1,0,0,1),lr.blue=new lr(0,0,1,1);var fr=Object.freeze({__proto__:null,array:dr,color:function(e,t,r){return new lr(pr(e.r,t.r,r),pr(e.g,t.g,r),pr(e.b,t.b,r),pr(e.a,t.a,r))},number:pr});class mr extends Error{constructor(e,t){super(t),this.message=t,this.key=e;}}class yr{constructor(e,t=[]){this.parent=e,this.bindings={};for(const[e,r]of t)this.bindings[e]=r;}concat(e){return new yr(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw new Error(`${e} not found in scope.`)}has(e){return !!this.bindings[e]||!!this.parent&&this.parent.has(e)}}const gr={kind:"null"},xr={kind:"number"},vr={kind:"string"},br={kind:"boolean"},wr={kind:"color"},_r={kind:"object"},Ar={kind:"value"},Mr={kind:"collator"},Ir={kind:"formatted"},Sr={kind:"resolvedImage"};function Pr(e,t){return {kind:"array",itemType:e,N:t}}function kr(e){if("array"===e.kind){const t=kr(e.itemType);return "number"==typeof e.N?`array<${t}, ${e.N}>`:"value"===e.itemType.kind?"array":`array<${t}>`}return e.kind}const zr=[gr,xr,vr,br,wr,Ir,_r,Pr(Ar),Sr];function Tr(e,t){if("error"===t.kind)return null;if("array"===e.kind){if("array"===t.kind&&(0===t.N&&"value"===t.itemType.kind||!Tr(e.itemType,t.itemType))&&("number"!=typeof e.N||e.N===t.N))return null}else {if(e.kind===t.kind)return null;if("value"===e.kind)for(const e of zr)if(!Tr(e,t))return null}return `Expected ${kr(e)} but found ${kr(t)} instead.`}function Br(e,t){return t.some((t=>t.kind===e.kind))}function Er(e,t){return t.some((t=>"null"===t?null===e:"array"===t?Array.isArray(e):"object"===t?e&&!Array.isArray(e)&&"object"==typeof e:t===typeof e))}function Vr(e,t){return "array"===e.kind&&"array"===t.kind?e.N===t.N&&Vr(e.itemType,t.itemType):e.kind===t.kind}class Fr{constructor(e,t,r){this.sensitivity=e?t?"variant":"case":t?"accent":"base",this.locale=r,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"});}compare(e,t){return this.collator.compare(e,t)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class Cr{constructor(e,t,r,n,i){this.text=e.normalize?e.normalize():e,this.image=t,this.scale=r,this.fontStack=n,this.textColor=i;}}class Dr{constructor(e){this.sections=e;}static fromString(e){return new Dr([new Cr(e,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some((e=>0!==e.text.length||!!e.image&&e.image.hasPrimary()))}static factory(e){return e instanceof Dr?e:Dr.fromString(e)}toString(){return 0===this.sections.length?"":this.sections.map((e=>e.text)).join("")}serialize(){const e=["format"];for(const t of this.sections){if(t.image){const r=t.image.getPrimary().id.toString();e.push(["image",r]);continue}e.push(t.text);const r={};t.fontStack&&(r["text-font"]=["literal",t.fontStack.split(",")]),t.scale&&(r["font-scale"]=t.scale),t.textColor&&(r["text-color"]=["rgba"].concat(t.textColor.toNonPremultipliedRenderColor(null).toArray())),e.push(r);}return e}}class Rr{constructor(e,t={}){if(this.id=ir.from(e),this.options=Object.assign({},t),t.transform){const{a:e,b:r,c:n,d:i,e:s,f:o}=t.transform;this.options.transform=new DOMMatrix([e,r,n,i,s,o]);}else this.options.transform=new DOMMatrix([1,0,0,1,0,0]);}toString(){const{a:e,b:t,c:r,d:n,e:i,f:s}=this.options.transform;return JSON.stringify({name:this.id.name,iconsetId:this.id.iconsetId,params:this.options.params,transform:{a:e,b:t,c:r,d:n,e:i,f:s}})}static parse(e){let t,r,n,i;try{({name:t,iconsetId:r,params:n,transform:i}=JSON.parse(e)||{});}catch(e){return null}if(!t)return null;const{a:s,b:o,c:a,d:l,e:u,f:c}=i||{};return new Rr({name:t,iconsetId:r},{params:n,transform:new DOMMatrix([s,o,a,l,u,c])})}scaleSelf(e,t){return this.options.transform.scaleSelf(e,t),this}}class Lr{constructor(e,t,r,n,i=!1){this.primaryId=ir.from(e),this.primaryOptions=t,r&&(this.secondaryId=ir.from(r)),this.secondaryOptions=n,this.available=i;}toString(){return this.primaryId&&this.secondaryId?`[${this.primaryId.name},${this.secondaryId.name}]`:this.primaryId.name}hasPrimary(){return !!this.primaryId}getPrimary(){return new Rr(this.primaryId,this.primaryOptions)}hasSecondary(){return !!this.secondaryId}getSecondary(){return this.secondaryId?new Rr(this.secondaryId,this.secondaryOptions):null}static from(e){return "string"==typeof e?Lr.build({name:e}):e}static build(e,t,r,n){return !e||"object"==typeof e&&!("name"in e)?null:new Lr(e,r,t,n)}}function Or(e,t,r,n){return "number"==typeof e&&e>=0&&e<=255&&"number"==typeof t&&t>=0&&t<=255&&"number"==typeof r&&r>=0&&r<=255?void 0===n||"number"==typeof n&&n>=0&&n<=1?null:`Invalid rgba value [${[e,t,r,n].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${("number"==typeof n?[e,t,r,n]:[e,t,r]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Ur(e){if(null===e)return !0;if("string"==typeof e)return !0;if("boolean"==typeof e)return !0;if("number"==typeof e)return !0;if(e instanceof lr)return !0;if(e instanceof Fr)return !0;if(e instanceof Dr)return !0;if(e instanceof Lr)return !0;if(Array.isArray(e)){for(const t of e)if(!Ur(t))return !1;return !0}if("object"==typeof e){for(const t in e)if(!Ur(e[t]))return !1;return !0}return !1}function Nr(e){if(null===e)return gr;if("string"==typeof e)return vr;if("boolean"==typeof e)return br;if("number"==typeof e)return xr;if(e instanceof lr)return wr;if(e instanceof Fr)return Mr;if(e instanceof Dr)return Ir;if(e instanceof Lr)return Sr;if(Array.isArray(e)){const t=e.length;let r;for(const t of e){const e=Nr(t);if(r){if(r===e)continue;r=Ar;break}r=e;}return Pr(r||Ar,t)}return _r}function jr(e){const t=typeof e;return null===e?"":"string"===t||"number"===t||"boolean"===t?String(e):e instanceof Dr||e instanceof Lr||e instanceof lr?e.toString():JSON.stringify(e)}class $r{constructor(e,t){this.type=e,this.value=t;}static parse(e,t){if(2!==e.length)return t.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!Ur(e[1]))return t.error("invalid value");const r=e[1];let n=Nr(r);const i=t.expectedType;return "array"!==n.kind||0!==n.N||!i||"array"!==i.kind||"number"==typeof i.N&&0!==i.N||(n=i),new $r(n,r)}evaluate(){return this.value}eachChild(){}outputDefined(){return !0}serialize(){return "array"===this.type.kind||"object"===this.type.kind?["literal",this.value]:this.value instanceof lr?["rgba"].concat(this.value.toNonPremultipliedRenderColor(null).toArray()):this.value instanceof Dr?this.value.serialize():this.value}}class Gr{constructor(e){this.name="ExpressionEvaluationError",this.message=e;}toJSON(){return this.message}}const qr={string:vr,number:xr,boolean:br,object:_r};class Hr{constructor(e,t){this.type=e,this.args=t;}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");let r,n=1;const i=e[0];if("array"===i){let i,s;if(e.length>2){const r=e[1];if("string"!=typeof r||!(r in qr)||"object"===r)return t.error('The item type argument of "array" must be one of string, number, boolean',1);i=qr[r],n++;}else i=Ar;if(e.length>3){if(null!==e[2]&&("number"!=typeof e[2]||e[2]<0||e[2]!==Math.floor(e[2])))return t.error('The length argument to "array" must be a positive integer literal',2);s=e[2],n++;}r=Pr(i,s);}else r=qr[i];const s=[];for(;ne.outputDefined()))}serialize(){const e=this.type,t=[e.kind];if("array"===e.kind){const r=e.itemType;if("string"===r.kind||"number"===r.kind||"boolean"===r.kind){t.push(r.kind);const n=e.N;("number"==typeof n||this.args.length>1)&&t.push(n);}}return t.concat(this.args.map((e=>e.serialize())))}}class Xr{constructor(e){this.type=Ir,this.sections=e;}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");const r=e[1];if(!Array.isArray(r)&&"object"==typeof r)return t.error("First argument must be an image or text section.");const n=[];let i=!1;for(let r=1;r<=e.length-1;++r){const s=e[r];if(i&&"object"==typeof s&&!Array.isArray(s)){i=!1;let e=null;if(s["font-scale"]&&(e=t.parseObjectValue(s["font-scale"],r,"font-scale",xr),!e))return null;let o=null;if(s["text-font"]&&(o=t.parseObjectValue(s["text-font"],r,"text-font",Pr(vr)),!o))return null;let a=null;if(s["text-color"]&&(a=t.parseObjectValue(s["text-color"],r,"text-color",wr),!a))return null;const l=n[n.length-1];l.scale=e,l.font=o,l.textColor=a;}else {const s=t.parse(e[r],r,Ar);if(!s)return null;const o=s.type.kind;if("string"!==o&&"value"!==o&&"null"!==o&&"resolvedImage"!==o)return t.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");i=!0,n.push({content:s,scale:null,font:null,textColor:null});}}return new Xr(n)}evaluate(e){return new Dr(this.sections.map((t=>{const r=t.content.evaluate(e);return Vr(Nr(r),Sr)?new Cr("",r,null,null,null):new Cr(jr(r),null,t.scale?t.scale.evaluate(e):null,t.font?t.font.evaluate(e).join(","):null,t.textColor?t.textColor.evaluate(e):null)})))}eachChild(e){for(const t of this.sections)e(t.content),t.scale&&e(t.scale),t.font&&e(t.font),t.textColor&&e(t.textColor);}outputDefined(){return !1}serialize(){const e=["format"];for(const t of this.sections){e.push(t.content.serialize());const r={};t.scale&&(r["font-scale"]=t.scale.serialize()),t.font&&(r["text-font"]=t.font.serialize()),t.textColor&&(r["text-color"]=t.textColor.serialize()),e.push(r);}return e}}class Zr{constructor(e,t,r,n){this._imageWarnHistory={},this.type=Sr,this.namePrimary=e,this.nameSecondary=t,r&&(this.paramsPrimary=r.params,this.iconsetIdPrimary=r.iconset?r.iconset.id:void 0),n&&(this.paramsSecondary=n.params,this.iconsetIdSecondary=n.iconset?n.iconset.id:void 0);}static parse(e,t){if(e.length<2)return t.error("Expected two or more arguments.");let r=1;const n=[];function i(){if(rir.isEqual(e,t))),n.available){const t=n.getSecondary()?n.getSecondary().id:null;t&&(n.available=e.availableImages.some((e=>ir.isEqual(e,t))));}}return n}eachChild(e){if(e(this.namePrimary),this.paramsPrimary)for(const t in this.paramsPrimary)this.paramsPrimary[t]&&e(this.paramsPrimary[t]);if(this.nameSecondary&&(e(this.nameSecondary),this.paramsSecondary))for(const t in this.paramsSecondary)this.paramsSecondary[t]&&e(this.paramsSecondary[t]);}outputDefined(){return !1}serializeOptions(e,t){const r={};if(t&&(r.iconset={id:t}),e){r.params={};for(const t in e)e[t]&&(r.params[t]=e[t].serialize());}return Object.keys(r).length>0?r:void 0}serialize(){const e=["image",this.namePrimary.serialize()];if(this.paramsPrimary||this.iconsetIdPrimary){const t=this.serializeOptions(this.paramsPrimary,this.iconsetIdPrimary);t&&e.push(t);}if(this.nameSecondary&&(e.push(this.nameSecondary.serialize()),this.paramsSecondary||this.iconsetIdSecondary)){const t=this.serializeOptions(this.paramsSecondary,this.iconsetIdSecondary);t&&e.push(t);}return e}}function Wr(e){return Kr(e)?"string":Jr(e)?"number":Qr(e)?"boolean":Array.isArray(e)?"array":null===e?"null":Yr(e)?"object":typeof e}function Yr(e){return null!=e&&!Array.isArray(e)&&"function"!=typeof e&&!(e instanceof String||e instanceof Number||e instanceof Boolean)&&"object"==typeof e}function Kr(e){return "string"==typeof e||e instanceof String}function Jr(e){return "number"==typeof e||e instanceof Number}function Qr(e){return "boolean"==typeof e||e instanceof Boolean}const en={"to-boolean":br,"to-color":wr,"to-number":xr,"to-string":vr};class tn{constructor(e,t){this.type=e,this.args=t;}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");const r=e[0],n=[];let i=gr;if("to-array"===r){if(!Array.isArray(e[1]))return null;const r=e[1].length;if(t.expectedType){if("array"!==t.expectedType.kind)return t.error(`Expected ${t.expectedType.kind} but found array.`);i=Pr(t.expectedType.itemType,r);}else {if(!(r>0&&Ur(e[1][0])))return null;i=Pr(Nr(e[1][0]),r);}for(let s=0;s4?`Invalid rbga value ${JSON.stringify(t)}: expected an array containing either three or four numeric values.`:Or(t[0],t[1],t[2],t[3]),!r))return new lr(t[0]/255,t[1]/255,t[2]/255,t[3])}throw new Gr(r||`Could not parse color from value '${"string"==typeof t?t:String(JSON.stringify(t))}'`)}if("number"===this.type.kind){let t=null;for(const r of this.args){if(t=r.evaluate(e),null===t)return 0;const n=Number(t);if(!isNaN(n))return n}throw new Gr(`Could not convert ${JSON.stringify(t)} to number.`)}return "formatted"===this.type.kind?Dr.fromString(jr(this.args[0].evaluate(e))):"resolvedImage"===this.type.kind?Lr.build(jr(this.args[0].evaluate(e))):"array"===this.type.kind?this.args.map((t=>t.evaluate(e))):jr(this.args[0].evaluate(e))}eachChild(e){this.args.forEach(e);}outputDefined(){return this.args.every((e=>e.outputDefined()))}serialize(){if("formatted"===this.type.kind)return new Xr([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if("resolvedImage"===this.type.kind)return new Zr(this.args[0]).serialize();const e="array"===this.type.kind?[]:[`to-${this.type.kind}`];return this.eachChild((t=>{e.push(t.serialize());})),e}}const rn=["Unknown","Point","LineString","Polygon"];class nn{constructor(e,t,r){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null,this.featureTileCoord=null,this.featureDistanceData=null,this.scope=e,this.options=t,this.iconImageUseTheme=r;}id(){return this.feature&&void 0!==this.feature.id?this.feature.id:null}geometryType(){return this.feature?"number"==typeof this.feature.type?rn[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}measureLight(e){return this.globals.brightness||0}distanceFromCenter(){if(this.featureTileCoord&&this.featureDistanceData){const e=this.featureDistanceData.center,t=this.featureDistanceData.scale,{x:r,y:n}=this.featureTileCoord;return this.featureDistanceData.bearing[0]*(r*t-e[0])+this.featureDistanceData.bearing[1]*(n*t-e[1])}return 0}parseColor(e){let t=this._parseColorCache[e];return t||(t=this._parseColorCache[e]=lr.parse(e)),t}getConfig(e){return this.options?this.options.get(e):null}}class sn{constructor(e,t,r,n,i){this.name=e,this.type=t,this._evaluate=r,this.args=n,this._overloadIndex=i;}evaluate(e){if(!this._evaluate){const e=sn.definitions[this.name];this._evaluate=Array.isArray(e)?e[2]:e.overloads[this._overloadIndex][1];}return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e);}outputDefined(){return !1}serialize(){return [this.name].concat(this.args.map((e=>e.serialize())))}static parse(e,t){const r=e[0],n=sn.definitions[r];if(!n)return t.error(`Unknown expression "${r}". If you wanted a literal array, use ["literal", [...]].`,0);const i=Array.isArray(n)?n[0]:n.type,s=Array.isArray(n)?[[n[1],n[2]]]:n.overloads,o=[];let a=null,l=-1;for(const[n,u]of s){if(Array.isArray(n)&&n.length!==e.length-1)continue;o.push(n),l++,a=new Ii(t.registry,t.path,null,t.scope,void 0,t._scope,t.options,t.iconImageUseTheme);const s=[];let c=!1;for(let t=1;te))).map(on).join(" | "),n=[];for(let r=1;rr;){if(n-r>600){const s=n-r+1,o=t-r+1,a=Math.log(s),l=.5*Math.exp(2*a/3),u=.5*Math.sqrt(a*l*(s-l)/s)*(o-s/2<0?-1:1);ln(e,t,Math.max(r,Math.floor(t-o*l/s+u)),Math.min(n,Math.floor(t+(s-o)*l/s+u)),i);}const s=e[t];let o=r,a=n;for(un(e,r,t),i(e[n],s)>0&&un(e,r,n);o0;)a--;}0===i(e[r],s)?un(e,r,a):(a++,un(e,a,n)),a<=t&&(r=a+1),t<=a&&(n=a-1);}}function un(e,t,r){const n=e[t];e[t]=e[r],e[r]=n;}function cn(e,t){return et?1:0}function hn(e){let t=0;for(let r,n,i=0,s=e.length,o=s-1;i=t[2]||e[1]<=t[1]||e[3]>=t[3])}function fn(e,t,r){const n=e[0]-t[0],i=e[1]-t[1],s=e[0]-r[0],o=e[1]-r[1];return n*o-s*i==0&&n*s<=0&&i*o<=0}function mn(e,t,r=!1){let n=!1;for(let a=0,l=t.length;a(i=e)[1]!=(o=c)[1]>i[1]&&i[0]<(o[0]-s[0])*(i[1]-s[1])/(o[1]-s[1])+s[0]&&(n=!n);}}var i,s,o;return n}function yn(e,t,r,n){const i=n[0]-r[0],s=n[1]-r[1],o=(e[0]-r[0])*s-i*(e[1]-r[1]),a=(t[0]-r[0])*s-i*(t[1]-r[1]);return o>0&&a<0||o<0&&a>0}function gn(e,t,r,n){return 0!=(i=[n[0]-r[0],n[1]-r[1]])[0]*(s=[t[0]-e[0],t[1]-e[1]])[1]-i[1]*s[0]&&!(!yn(e,t,r,n)||!yn(r,n,e,t));var i,s;}function xn(e){const t=new Me(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),r=new Me(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);for(const n of e[0])t.x>n.x&&(t.x=n.x),t.y>n.y&&(t.y=n.y),r.xr[2]){const t=.5*n;let i=e[0]-r[0]>t?-n:r[0]-e[0]>t?n:0;0===i&&(i=e[0]-r[2]>t?-n:r[2]-e[0]>t?n:0),e[0]+=i;}pn(t,e);}function kn(e,t,r,n){const i=Math.pow(2,n.z)*vn,s=[n.x*vn,n.y*vn],o=[];if(!e)return o;for(const n of e)for(const e of n){const n=[e.x+s[0],e.y+s[1]];Pn(n,t,r,i),o.push(n);}return o}function zn(e,t,r,n){const i=Math.pow(2,n.z)*vn,s=[n.x*vn,n.y*vn],o=[];if(!e)return o;for(const r of e){const e=[];for(const n of r){const r=[n.x+s[0],n.y+s[1]];pn(t,r),e.push(r);}o.push(e);}if(t[2]-t[0]<=i/2){(a=t)[0]=a[1]=1/0,a[2]=a[3]=-1/0;for(const e of o)for(const n of e)Pn(n,t,r,i);}var a;return o}class Tn{constructor(e,t){this.type=br,this.geojson=e,this.geometries=t;}static parse(e,t){if(2!==e.length)return t.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(Ur(e[1])){const t=e[1];if("FeatureCollection"===t.type)for(let e=0;et)return Rn(i,s,(t-(r-o))/o)}return e[e.length-1]}pointToSegmentDistance(e,t,r){let[n,i]=t,s=Ln(r[0]-n)*this.kx,o=(r[1]-i)*this.ky;if(0!==s||0!==o){const t=(Ln(e[0]-n)*this.kx*s+(e[1]-i)*this.ky*o)/(s*s+o*o);t>1?(n=r[0],i=r[1]):t>0&&(n+=s/this.kx*t,i+=o/this.ky*t);}return s=Ln(e[0]-n)*this.kx,o=(e[1]-i)*this.ky,Math.sqrt(s*s+o*o)}pointOnLine(e,t){let r=1/0,n=e[0][0],i=e[0][1],s=0,o=0;for(let a=0;a1?(l=e[a+1][0],u=e[a+1][1]):p>0&&(l+=c/this.kx*p,u+=h/this.ky*p)),c=Ln(t[0]-l)*this.kx,h=(t[1]-u)*this.ky;const d=c*c+h*h;di.index||n.index===i.index&&n.t>i.t){const e=n;n=i,i=e;}const s=[n.point],o=n.index+1,a=i.index;!Dn(r[o],s[0])&&o<=a&&s.push(r[o]);for(let e=o+1;e<=a;e++)s.push(r[e]);return Dn(r[a],i.point)||s.push(i.point),s}lineSliceAlong(e,t,r){let n=0;const i=[];for(let s=0;se&&0===i.length&&i.push(Rn(o,a,(e-(n-l))/l)),n>=t)return i.push(Rn(o,a,(t-(n-l))/l)),i;n>e&&i.push(a);}return i}bufferPoint(e,t){const r=t/this.ky,n=t/this.kx;return [e[0]-n,e[1]-r,e[0]+n,e[1]+r]}bufferBBox(e,t){const r=t/this.ky,n=t/this.kx;return [e[0]-n,e[1]-r,e[2]+n,e[3]+r]}insideBBox(e,t){return Ln(e[0]-t[0])>=0&&Ln(e[0]-t[2])<=0&&e[1]>=t[1]&&e[1]<=t[3]}}function Dn(e,t){return e[0]===t[0]&&e[1]===t[1]}function Rn(e,t,r){const n=Ln(t[0]-e[0]);return [e[0]+n*r,e[1]+(t[1]-e[1])*r]}function Ln(e){for(;e<-180;)e+=360;for(;e>180;)e-=360;return e}class On{constructor(e=[],t=((e,t)=>et?1:0)){if(this.data=e,this.length=this.data.length,this.compare=t,this.length>0)for(let e=(this.length>>1)-1;e>=0;e--)this._down(e);}push(e){this.data.push(e),this._up(this.length++);}pop(){if(0===this.length)return;const e=this.data[0],t=this.data.pop();return --this.length>0&&(this.data[0]=t,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:t,compare:r}=this,n=t[e];for(;e>0;){const i=e-1>>1,s=t[i];if(r(n,s)>=0)break;t[e]=s,e=i;}t[e]=n;}_down(e){const{data:t,compare:r}=this,n=this.length>>1,i=t[e];for(;e=0)break;t[e]=t[n],e=n;}t[e]=i;}}var Un=8192;function Nn(e,t){return t.dist-e.dist}const jn=100,$n=50;function Gn(e){const t=[1/0,1/0,-1/0,-1/0];if(t.length!==e.length)return !1;for(let r=0;r=e[0]&&e[1]e[1])return [null,null];const r=qn(e);if(t){if(2===r)return [e,null];const t=Math.floor(r/2);return [[e[0],e[0]+t],[e[0]+t,e[1]]]}{if(1===r)return [e,null];const t=Math.floor(r/2)-1;return [[e[0],e[0]+t],[e[0]+t+1,e[1]]]}}function Zn(e,t){const r=[1/0,1/0,-1/0,-1/0];if(!Hn(t,e.length))return r;for(let n=t[0];n<=t[1];++n)pn(r,e[n]);return r}function Wn(e){const t=[1/0,1/0,-1/0,-1/0];for(let r=0;rt[2]&&(n=e[0]-t[2]),e[1]>t[3]&&(i=e[1]-t[3]),e[3]=n)return n;if(dn(i,s)){if(li(e,t))return 0}else if(li(t,e))return 0;let o=n;for(const n of e)for(let e=0,i=n.length,s=i-1;e=s)continue;const u=i.range1;if(qn(u)<=a){if(!Hn(u,e.length))return NaN;if(t){const t=ai(e,u,r,n);if(0===(s=Math.min(s,t)))return s}else for(let t=u[0];t<=u[1];++t){const i=oi(e[t],r,n);if(0===(s=Math.min(s,i)))return s}}else {const r=Xn(u,t);if(null!==r[0]){const t=Yn(Zn(e,r[0]),l,n);t=o)continue;const c=s.range1,h=s.range2;if(qn(c)<=l&&qn(h)<=u){if(!Hn(c,e.length)||!Hn(h,r.length))return NaN;if(t&&n?o=Math.min(o,ii(e,c,r,h,i)):t||n?t&&!n?o=Math.min(o,ri(r,h,e,c,i)):!t&&n&&(o=Math.min(o,ri(e,c,r,h,i))):o=Math.min(o,si(e,c,r,h,i)),0===o)return o}else {const s=Xn(c,t),l=Xn(h,n);ci(a,o,i,e,r,s[0],l[0]),ci(a,o,i,e,r,s[0],l[1]),ci(a,o,i,e,r,s[1],l[0]),ci(a,o,i,e,r,s[1],l[1]);}}return o}function di(e,t,r,n,i=1/0){let s=i;const o=Zn(e,[0,e.length-1]);for(const i of r)if(!(s!==1/0&&Yn(o,Zn(i,[0,i.length-1]),n)>=s)&&(s=Math.min(s,pi(e,t,i,!0,n,s)),0===s))return s;return s}function fi(e,t,r,n,i=1/0){let s=i;const o=Zn(e,[0,e.length-1]);for(const i of r){if(s!==1/0&&Yn(o,Wn(i),n)>=s)continue;const r=hi(e,t,i,n,s);if(isNaN(r))return r;if(0===(s=Math.min(s,r)))return s}return s}function mi(e){return "Point"===e||"MultiPoint"===e||"LineString"===e||"MultiLineString"===e||"Polygon"===e||"MultiPolygon"===e}class yi{constructor(e,t){this.type=xr,this.geojson=e,this.geometries=t;}static parse(e,t){if(2!==e.length)return t.error(`'distance' expression requires either one argument, but found ' ${e.length-1} instead.`);if(Ur(e[1])){const t=e[1];if("FeatureCollection"===t.type){for(let e=0;e{t&&!gi(e)&&(t=!1);})),t}function xi(e){if(e instanceof sn&&"feature-state"===e.name)return !1;let t=!0;return e.eachChild((e=>{t&&!xi(e)&&(t=!1);})),t}function vi(e,t){if(e instanceof sn&&t.indexOf(e.name)>=0)return !1;let r=!0;return e.eachChild((e=>{r&&!vi(e,t)&&(r=!1);})),r}function bi(e,t,r){return [e,t,r].filter(Boolean).join("")}function wi(e,t){switch(e){case "string":return jr(t);case "number":return +t;case "boolean":return !!t;case "color":return lr.parse(t);case "formatted":return Dr.fromString(jr(t));case "resolvedImage":return Lr.build(jr(t))}return t}function _i(e,t,r,n){return void 0!==n&&(e=n*Math.round(e/n)),void 0!==t&&er&&(e=r),e}class Ai{constructor(e,t,r,n=!1){this.type=e,this.key=t,this.scope=r,this.featureConstant=n;}static parse(e,t){let r=t.expectedType;if(null==r&&(r=Ar),e.length<2||e.length>3)return t.error("Invalid number of arguments for 'config' expression.");const n=t.parse(e[1],1);if(!(n instanceof $r))return t.error("Key name of 'config' expression must be a string literal.");let i,s=!0;const o=jr(n.value);if(e.length>=3){const r=t.parse(e[2],2);if(!(r instanceof $r))return t.error("Scope of 'config' expression must be a string literal.");i=jr(r.value);}if(t.options){const e=bi(o,i,t._scope),r=t.options.get(e);r&&(s=gi(r.value||r.default));}return new Ai(r,o,i,s)}evaluate(e){const t=bi(this.key,this.scope,e.scope),r=e.getConfig(t);if(!r)return null;const{type:n,value:i,values:s,minValue:o,maxValue:a,stepValue:l}=r,u=r.default.evaluate(e);let c=u;if(i){const t=e.scope;e.scope=(t||"").split("").slice(1).join(""),c=i.evaluate(e),e.scope=t;}return n&&(c=wi(n,c)),void 0===c||void 0===o&&void 0===a&&void 0===l||("number"==typeof c?c=_i(c,o,a,l):Array.isArray(c)&&(c=c.map((e=>"number"==typeof e?_i(e,o,a,l):e)))),void 0!==i&&void 0!==c&&s&&!s.includes(c)&&(c=u,n&&(c=wi(n,c))),(n&&n!==this.type||void 0!==c&&!Vr(Nr(c),this.type))&&(c=wi(this.type.kind,c)),c}eachChild(){}outputDefined(){return !1}serialize(){const e=["config",this.key];return this.scope&&e.concat(this.scope),e}}class Mi{constructor(e,t){this.type=t.type,this.name=e,this.boundExpression=t;}static parse(e,t){if(2!==e.length||"string"!=typeof e[1])return t.error("'var' expression requires exactly one string literal argument.");const r=e[1];return t.scope.has(r)?new Mi(r,t.scope.get(r)):t.error(`Unknown variable "${r}". Make sure "${r}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return !1}serialize(){return ["var",this.name]}}class Ii{constructor(e,t=[],r,n=new yr,i=[],s,o,a){this.registry=e,this.path=t,this.key=t.map((e=>"string"==typeof e?`['${e}']`:`[${e}]`)).join(""),this.scope=n,this.errors=i,this.expectedType=r,this._scope=s,this.options=o,this.iconImageUseTheme=a;}parse(e,t,r,n,i={}){return t||r?this.concat(t,null,r,n)._parse(e,i):this._parse(e,i)}parseObjectValue(e,t,r,n,i,s={}){return this.concat(t,r,n,i)._parse(e,s)}_parse(e,t){function r(e,t,r){return "assert"===r?new Hr(t,[e]):"coerce"===r?new tn(t,[e]):e}if(null!==e&&"string"!=typeof e&&"boolean"!=typeof e&&"number"!=typeof e||(e=["literal",e]),Array.isArray(e)){if(0===e.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const n="string"==typeof e[0]?this.registry[e[0]]:void 0;if(n){let i=n.parse(e,this);if(!i)return null;if(this.expectedType){const e=this.expectedType,n=i.type;if("string"!==e.kind&&"number"!==e.kind&&"boolean"!==e.kind&&"object"!==e.kind&&"array"!==e.kind||"value"!==n.kind)if("color"!==e.kind&&"formatted"!==e.kind&&"resolvedImage"!==e.kind||"value"!==n.kind&&"string"!==n.kind){if(this.checkSubtype(e,n))return null}else i=r(i,e,t.typeAnnotation||"coerce");else i=r(i,e,t.typeAnnotation||"assert");}if(!(i instanceof $r)&&"resolvedImage"!==i.type.kind&&Si(i)){const e=new nn(this._scope,this.options,this.iconImageUseTheme);try{i=new $r(i.type,i.evaluate(e));}catch(e){return this.error(e.message),null}}return i}return tn.parse(["to-array",e],this)}return this.error(void 0===e?"'undefined' value invalid. Use null instead.":"object"==typeof e?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof e} instead.`)}concat(e,t,r,n){let i="number"==typeof e?this.path.concat(e):this.path;i="string"==typeof t?i.concat(t):i;const s=n?this.scope.concat(n):this.scope;return new Ii(this.registry,i,r||null,s,this.errors,this._scope,this.options,this.iconImageUseTheme)}error(e,...t){const r=`${this.key}${t.map((e=>`[${e}]`)).join("")}`;this.errors.push(new mr(r,e));}checkSubtype(e,t){const r=Tr(e,t);return r&&this.error(r),r}}function Si(e){if(e instanceof Mi)return Si(e.boundExpression);if(e instanceof sn&&"error"===e.name)return !1;if(e instanceof an)return !1;if(e instanceof Tn)return !1;if(e instanceof yi)return !1;if(e instanceof Ai)return !1;const t=e instanceof tn||e instanceof Hr;let r=!0;return e.eachChild((e=>{r=t?r&&Si(e):r&&e instanceof $r;})),!!r&&gi(e)&&vi(e,["zoom","heatmap-density","worldview","line-progress","raster-value","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center","measure-light","raster-particle-speed"])}function Pi(e,t){const r=e.length-1;let n,i,s=0,o=r,a=0;for(;s<=o;)if(a=Math.floor((s+o)/2),n=e[a],i=e[a+1],n<=t){if(a===r||tt))throw new Gr("Input is not a number.");o=a-1;}return 0}class ki{constructor(e,t,r){this.type=e,this.input=t,this.labels=[],this.outputs=[];for(const[e,t]of r)this.labels.push(e),this.outputs.push(t);}static parse(e,t){if(e.length-1<4)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return t.error("Expected an even number of arguments.");const r=t.parse(e[1],1,xr);if(!r)return null;const n=[];let i=null;t.expectedType&&"value"!==t.expectedType.kind&&(i=t.expectedType);for(let r=1;r=s)return t.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',a);const u=t.parse(o,l,i);if(!u)return null;i=i||u.type,n.push([s,u]);}return new ki(i,r,n)}evaluate(e){const t=this.labels,r=this.outputs;if(1===t.length)return r[0].evaluate(e);const n=this.input.evaluate(e);if(n<=t[0])return r[0].evaluate(e);const i=t.length;return n>=t[i-1]?r[i-1].evaluate(e):r[Pi(t,n)].evaluate(e)}eachChild(e){e(this.input);for(const t of this.outputs)e(t);}outputDefined(){return this.outputs.every((e=>e.outputDefined()))}serialize(){const e=["step",this.input.serialize()];for(let t=0;t0&&e.push(this.labels[t]),e.push(this.outputs[t].serialize());return e}}const zi=.95047,Ti=1.08883,Bi=4/29,Ei=6/29,Vi=3*Ei*Ei,Fi=Ei*Ei*Ei,Ci=Math.PI/180,Di=180/Math.PI;function Ri(e){return e>Fi?Math.pow(e,1/3):e/Vi+Bi}function Li(e){return e>Ei?e*e*e:Vi*(e-Bi)}function Oi(e){return 255*(e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function Ui(e){return (e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function Ni(e){const t=Ui(e.r),r=Ui(e.g),n=Ui(e.b),i=Ri((.4124564*t+.3575761*r+.1804375*n)/zi),s=Ri((.2126729*t+.7151522*r+.072175*n)/1);return {l:116*s-16,a:500*(i-s),b:200*(s-Ri((.0193339*t+.119192*r+.9503041*n)/Ti)),alpha:e.a}}function ji(e){let t=(e.l+16)/116,r=isNaN(e.a)?t:t+e.a/500,n=isNaN(e.b)?t:t-e.b/200;return t=1*Li(t),r=zi*Li(r),n=Ti*Li(n),new lr(Oi(3.2404542*r-1.5371385*t-.4985314*n),Oi(-.969266*r+1.8760108*t+.041556*n),Oi(.0556434*r-.2040259*t+1.0572252*n),e.alpha)}function $i(e,t,r){const n=t-e;return e+r*(n>180||n<-180?n-360*Math.round(n/360):n)}const Gi={forward:Ni,reverse:ji,interpolate:function(e,t,r){return {l:pr(e.l,t.l,r),a:pr(e.a,t.a,r),b:pr(e.b,t.b,r),alpha:pr(e.alpha,t.alpha,r)}}},qi={forward:function(e){const{l:t,a:r,b:n}=Ni(e),i=Math.atan2(n,r)*Di;return {h:i<0?i+360:i,c:Math.sqrt(r*r+n*n),l:t,alpha:e.a}},reverse:function(e){const t=e.h*Ci,r=e.c;return ji({l:e.l,a:Math.cos(t)*r,b:Math.sin(t)*r,alpha:e.alpha})},interpolate:function(e,t,r){return {h:$i(e.h,t.h,r),c:pr(e.c,t.c,r),l:pr(e.l,t.l,r),alpha:pr(e.alpha,t.alpha,r)}}};var Hi=Object.freeze({__proto__:null,hcl:qi,lab:Gi});class Xi{constructor(e,t,r,n,i){this.type=e,this.operator=t,this.interpolation=r,this.input=n,this.labels=[],this.outputs=[];for(const[e,t]of i)this.labels.push(e),this.outputs.push(t);}static interpolationFactor(e,t,r,n){let i=0;if("exponential"===e.name)i=Zi(t,e.base,r,n);else if("linear"===e.name)i=Zi(t,1,r,n);else if("cubic-bezier"===e.name){const s=e.controlPoints;i=new Ae(s[0],s[1],s[2],s[3]).solve(Zi(t,1,r,n));}return i}static parse(e,t){let[r,n,i,...s]=e;if(!Array.isArray(n)||0===n.length)return t.error("Expected an interpolation type expression.",1);if("linear"===n[0])n={name:"linear"};else if("exponential"===n[0]){const e=n[1];if("number"!=typeof e)return t.error("Exponential interpolation requires a numeric base.",1,1);n={name:"exponential",base:e};}else {if("cubic-bezier"!==n[0])return t.error(`Unknown interpolation type ${String(n[0])}`,1,0);{const e=n.slice(1);if(4!==e.length||e.some((e=>"number"!=typeof e||e<0||e>1)))return t.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);n={name:"cubic-bezier",controlPoints:e};}}if(e.length-1<4)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length-1>3&&(e.length-1)%2!=0)return t.error("Expected an even number of arguments.");if(i=t.parse(i,2,xr),!i)return null;const o=[];let a=null;"interpolate-hcl"===r||"interpolate-lab"===r?a=wr:t.expectedType&&"value"!==t.expectedType.kind&&(a=t.expectedType);for(let e=0;e=r)return t.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',i);const u=t.parse(n,l,a);if(!u)return null;a=a||u.type,o.push([r,u]);}return "number"===a.kind||"color"===a.kind||"array"===a.kind&&"number"===a.itemType.kind&&"number"==typeof a.N?new Xi(a,r,n,i,o):t.error(`Type ${kr(a)} is not interpolatable.`)}evaluate(e){const t=this.labels,r=this.outputs;if(1===t.length)return r[0].evaluate(e);const n=this.input.evaluate(e);if(n<=t[0])return r[0].evaluate(e);const i=t.length;if(n>=t[i-1])return r[i-1].evaluate(e);const s=Pi(t,n),o=Xi.interpolationFactor(this.interpolation,n,t[s],t[s+1]),a=r[s].evaluate(e),l=r[s+1].evaluate(e);return "interpolate"===this.operator?fr[this.type.kind.toLowerCase()](a,l,o):"interpolate-hcl"===this.operator?qi.reverse(qi.interpolate(qi.forward(a),qi.forward(l),o)):Gi.reverse(Gi.interpolate(Gi.forward(a),Gi.forward(l),o))}eachChild(e){e(this.input);for(const t of this.outputs)e(t);}outputDefined(){return this.outputs.every((e=>e.outputDefined()))}serialize(){let e;e="linear"===this.interpolation.name?["linear"]:"exponential"===this.interpolation.name?1===this.interpolation.base?["linear"]:["exponential",this.interpolation.base]:["cubic-bezier",...this.interpolation.controlPoints];const t=[this.operator,e,this.input.serialize()];for(let e=0;eTr(n,e.type)));return new Wi(s?Ar:r,i)}evaluate(e){let t,r=null,n=0;for(const i of this.args){if(n++,r=i.evaluate(e),r&&r instanceof Lr&&!r.available&&(t||(t=r),r=null,n===this.args.length))return t;if(null!==r)break}return r}eachChild(e){this.args.forEach(e);}outputDefined(){return this.args.every((e=>e.outputDefined()))}serialize(){const e=["coalesce"];return this.eachChild((t=>{e.push(t.serialize());})),e}}class Yi{constructor(e,t){this.type=t.type,this.bindings=[].concat(e),this.result=t;}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const t of this.bindings)e(t[1]);e(this.result);}static parse(e,t){if(e.length<4)return t.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);const r=[];for(let n=1;n=r.length)throw new Gr("Array index out of bounds: index exceeds array size");if(t!==Math.floor(t))throw new Gr("Array index must be an integer. Use at-interpolated for fractional indices");return r[t]}eachChild(e){e(this.index),e(this.input);}outputDefined(){return !1}serialize(){return ["at",this.index.serialize(),this.input.serialize()]}}class Ji{constructor(e,t,r){this.type=e,this.index=t,this.input=r;}static parse(e,t){if(3!==e.length)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const r=t.parse(e[1],1,xr),n=t.parse(e[2],2,Pr(t.expectedType||Ar));return r&&n?new Ji(n.type.itemType,r,n):null}evaluate(e){const t=this.index.evaluate(e),r=this.input.evaluate(e);if(t<0)throw new Gr(`Array index out of bounds: ${t} < 0.`);if(t>r.length-1)throw new Gr(`Array index out of bounds: ${t} > ${r.length-1}.`);if(t===Math.floor(t))return r[t];const n=Math.floor(t),i=Math.ceil(t),s=r[n],o=r[i];if("number"!=typeof s||"number"!=typeof o)throw new Gr(`Cannot interpolate between non-number values at index ${t}.`);const a=t-n;return s*(1-a)+o*a}eachChild(e){e(this.index),e(this.input);}outputDefined(){return !1}serialize(){return ["at-interpolated",this.index.serialize(),this.input.serialize()]}}class Qi{constructor(e,t){this.type=br,this.needle=e,this.haystack=t;}static parse(e,t){if(3!==e.length)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const r=t.parse(e[1],1,Ar),n=t.parse(e[2],2,Ar);return r&&n?Br(r.type,[br,vr,xr,gr,Ar])?new Qi(r,n):t.error(`Expected first argument to be of type boolean, string, number or null, but found ${kr(r.type)} instead`):null}evaluate(e){const t=this.needle.evaluate(e),r=this.haystack.evaluate(e);if(null==r)return !1;if(!Er(t,["boolean","string","number","null"]))throw new Gr(`Expected first argument to be of type boolean, string, number or null, but found ${kr(Nr(t))} instead.`);if(!Er(r,["string","array"]))throw new Gr(`Expected second argument to be of type array or string, but found ${kr(Nr(r))} instead.`);return r.indexOf(t)>=0}eachChild(e){e(this.needle),e(this.haystack);}outputDefined(){return !0}serialize(){return ["in",this.needle.serialize(),this.haystack.serialize()]}}class es{constructor(e,t,r){this.type=xr,this.needle=e,this.haystack=t,this.fromIndex=r;}static parse(e,t){if(e.length<=2||e.length>=5)return t.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const r=t.parse(e[1],1,Ar),n=t.parse(e[2],2,Ar);if(!r||!n)return null;if(!Br(r.type,[br,vr,xr,gr,Ar]))return t.error(`Expected first argument to be of type boolean, string, number or null, but found ${kr(r.type)} instead`);if(4===e.length){const i=t.parse(e[3],3,xr);return i?new es(r,n,i):null}return new es(r,n)}evaluate(e){const t=this.needle.evaluate(e),r=this.haystack.evaluate(e);if(!Er(t,["boolean","string","number","null"]))throw new Gr(`Expected first argument to be of type boolean, string, number or null, but found ${kr(Nr(t))} instead.`);if(!Er(r,["string","array"]))throw new Gr(`Expected second argument to be of type array or string, but found ${kr(Nr(r))} instead.`);if(this.fromIndex){const n=this.fromIndex.evaluate(e);return r.indexOf(t,n)}return r.indexOf(t)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex);}outputDefined(){return !1}serialize(){if(null!=this.fromIndex&&void 0!==this.fromIndex){const e=this.fromIndex.serialize();return ["index-of",this.needle.serialize(),this.haystack.serialize(),e]}return ["index-of",this.needle.serialize(),this.haystack.serialize()]}}class ts{constructor(e,t,r,n,i,s){this.inputType=e,this.type=t,this.input=r,this.cases=n,this.outputs=i,this.otherwise=s;}static parse(e,t){if(e.length<5)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return t.error("Expected an even number of arguments.");let r,n;t.expectedType&&"value"!==t.expectedType.kind&&(n=t.expectedType);const i={},s=[];for(let o=2;oNumber.MAX_SAFE_INTEGER)return u.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if("number"==typeof e&&Math.floor(e)!==e)return u.error("Numeric branch labels must be integer values.");if(r){if(u.checkSubtype(r,Nr(e)))return null}else r=Nr(e);if(void 0!==i[String(e)])return u.error("Branch labels must be unique.");i[String(e)]=s.length;}const c=t.parse(l,o,n);if(!c)return null;n=n||c.type,s.push(c);}const o=t.parse(e[1],1,Ar);if(!o)return null;const a=t.parse(e[e.length-1],e.length-1,n);return a?"value"!==o.type.kind&&t.concat(1).checkSubtype(r,o.type)?null:new ts(r,n,o,i,s,a):null}evaluate(e){const t=this.input.evaluate(e);return (Vr(Nr(t),this.inputType)&&this.outputs[this.cases[t]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise);}outputDefined(){return this.outputs.every((e=>e.outputDefined()))&&this.otherwise.outputDefined()}serialize(){const e=["match",this.input.serialize()],t=Object.keys(this.cases).sort(),r=[],n={};for(const e of t){const t=n[this.cases[e]];void 0===t?(n[this.cases[e]]=r.length,r.push([this.cases[e],[e]])):r[t][1].push(e);}const i=e=>"number"===this.inputType.kind?Number(e):e;for(const[t,n]of r)e.push(1===n.length?i(n[0]):n.map(i)),e.push(this.outputs[t].serialize());return e.push(this.otherwise.serialize()),e}}class rs{constructor(e,t,r){this.type=e,this.branches=t,this.otherwise=r;}static parse(e,t){if(e.length<4)return t.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return t.error("Expected an odd number of arguments.");let r;t.expectedType&&"value"!==t.expectedType.kind&&(r=t.expectedType);const n=[];for(let i=1;it.outputDefined()))&&this.otherwise.outputDefined()}serialize(){const e=["case"];return this.eachChild((t=>{e.push(t.serialize());})),e}}class ns{constructor(e,t,r,n){this.type=e,this.input=t,this.beginIndex=r,this.endIndex=n;}static parse(e,t){if(e.length<=2||e.length>=5)return t.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const r=t.parse(e[1],1,Ar),n=t.parse(e[2],2,xr);if(!r||!n)return null;if(!Br(r.type,[Pr(Ar),vr,Ar]))return t.error(`Expected first argument to be of type array or string, but found ${kr(r.type)} instead`);if(4===e.length){const i=t.parse(e[3],3,xr);return i?new ns(r.type,r,n,i):null}return new ns(r.type,r,n)}evaluate(e){const t=this.input.evaluate(e),r=this.beginIndex.evaluate(e);if(!Er(t,["string","array"]))throw new Gr(`Expected first argument to be of type array or string, but found ${kr(Nr(t))} instead.`);if(this.endIndex){const n=this.endIndex.evaluate(e);return t.slice(r,n)}return t.slice(r)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex);}outputDefined(){return !1}serialize(){if(null!=this.endIndex&&void 0!==this.endIndex){const e=this.endIndex.serialize();return ["slice",this.input.serialize(),this.beginIndex.serialize(),e]}return ["slice",this.input.serialize(),this.beginIndex.serialize()]}}class is{constructor(e,t){this.type=Pr(vr),this.str=e,this.delimiter=t;}static parse(e,t){if(3!==e.length)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const r=t.parse(e[1],1,vr),n=t.parse(e[2],2,vr);return r&&n?new is(r,n):void 0}evaluate(e){const t=this.str.evaluate(e),r=this.delimiter.evaluate(e);return t.split(r)}eachChild(e){e(this.str),e(this.delimiter);}outputDefined(){return !1}serialize(){return ["split",this.str.serialize(),this.delimiter.serialize()]}}function ss(e,t){return "=="===e||"!="===e?"boolean"===t.kind||"string"===t.kind||"number"===t.kind||"null"===t.kind||"value"===t.kind:"string"===t.kind||"number"===t.kind||"value"===t.kind}function os(e,t,r,n){return 0===n.compare(t,r)}function as(e,t,r){const n="=="!==e&&"!="!==e;return class i{constructor(e,t,r){this.type=br,this.lhs=e,this.rhs=t,this.collator=r,this.hasUntypedArgument="value"===e.type.kind||"value"===t.type.kind;}static parse(e,t){if(3!==e.length&&4!==e.length)return t.error("Expected two or three arguments.");const r=e[0];let s=t.parse(e[1],1,Ar);if(!s)return null;if(!ss(r,s.type))return t.concat(1).error(`"${r}" comparisons are not supported for type '${kr(s.type)}'.`);let o=t.parse(e[2],2,Ar);if(!o)return null;if(!ss(r,o.type))return t.concat(2).error(`"${r}" comparisons are not supported for type '${kr(o.type)}'.`);if(s.type.kind!==o.type.kind&&"value"!==s.type.kind&&"value"!==o.type.kind)return t.error(`Cannot compare types '${kr(s.type)}' and '${kr(o.type)}'.`);n&&("value"===s.type.kind&&"value"!==o.type.kind?s=new Hr(o.type,[s]):"value"!==s.type.kind&&"value"===o.type.kind&&(o=new Hr(s.type,[o])));let a=null;if(4===e.length){if("string"!==s.type.kind&&"string"!==o.type.kind&&"value"!==s.type.kind&&"value"!==o.type.kind)return t.error("Cannot use collator to compare non-string types.");if(a=t.parse(e[3],3,Mr),!a)return null}return new i(s,o,a)}evaluate(i){const s=this.lhs.evaluate(i),o=this.rhs.evaluate(i);if(n&&this.hasUntypedArgument){const t=Nr(s),r=Nr(o);if(t.kind!==r.kind||"string"!==t.kind&&"number"!==t.kind)throw new Gr(`Expected arguments for "${e}" to be (string, string) or (number, number), but found (${t.kind}, ${r.kind}) instead.`)}if(this.collator&&!n&&this.hasUntypedArgument){const e=Nr(s),r=Nr(o);if("string"!==e.kind||"string"!==r.kind)return t(i,s,o)}return this.collator?r(i,s,o,this.collator.evaluate(i)):t(i,s,o)}eachChild(e){e(this.lhs),e(this.rhs),this.collator&&e(this.collator);}outputDefined(){return !0}serialize(){const t=[e];return this.eachChild((e=>{t.push(e.serialize());})),t}}}const ls=as("==",(function(e,t,r){return t===r}),os),us=as("!=",(function(e,t,r){return t!==r}),(function(e,t,r,n){return !os(0,t,r,n)})),cs=as("<",(function(e,t,r){return t",(function(e,t,r){return t>r}),(function(e,t,r,n){return n.compare(t,r)>0})),ps=as("<=",(function(e,t,r){return t<=r}),(function(e,t,r,n){return n.compare(t,r)<=0})),ds=as(">=",(function(e,t,r){return t>=r}),(function(e,t,r,n){return n.compare(t,r)>=0}));class fs{constructor(e,t,r,n,i,s){this.type=vr,this.number=e,this.locale=t,this.currency=r,this.unit=n,this.minFractionDigits=i,this.maxFractionDigits=s;}static parse(e,t){if(3!==e.length)return t.error("Expected two arguments.");const r=t.parse(e[1],1,xr);if(!r)return null;const n=e[2];if("object"!=typeof n||Array.isArray(n))return t.error("NumberFormat options argument must be an object.");let i=null;if(n.locale&&(i=t.parseObjectValue(n.locale,2,"locale",vr),!i))return null;let s=null;if(n.currency&&(s=t.parseObjectValue(n.currency,2,"currency",vr),!s))return null;let o=null;if(n.unit&&(o=t.parseObjectValue(n.unit,2,"unit",vr),!o))return null;let a=null;if(n["min-fraction-digits"]&&(a=t.parseObjectValue(n["min-fraction-digits"],2,"min-fraction-digits",xr),!a))return null;let l=null;return n["max-fraction-digits"]&&(l=t.parseObjectValue(n["max-fraction-digits"],2,"max-fraction-digits",xr),!l)?null:new fs(r,i,s,o,a,l)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:(this.currency?"currency":this.unit&&"unit")||"decimal",currency:this.currency?this.currency.evaluate(e):void 0,unit:this.unit?this.unit.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.unit&&e(this.unit),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits);}outputDefined(){return !1}serialize(){const e={};return this.locale&&(e.locale=this.locale.serialize()),this.currency&&(e.currency=this.currency.serialize()),this.unit&&(e.unit=this.unit.serialize()),this.minFractionDigits&&(e["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(e["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),e]}}class ms{constructor(e){this.type=xr,this.input=e;}static parse(e,t){if(2!==e.length)return t.error(`Expected 1 argument, but found ${e.length-1} instead.`);const r=t.parse(e[1],1);return r?"array"!==r.type.kind&&"string"!==r.type.kind&&"value"!==r.type.kind?t.error(`Expected argument of type string or array, but found ${kr(r.type)} instead.`):new ms(r):null}evaluate(e){const t=this.input.evaluate(e);if("string"==typeof t)return t.length;if(Array.isArray(t))return t.length;throw new Gr(`Expected value to be of type string or array, but found ${kr(Nr(t))} instead.`)}eachChild(e){e(this.input);}outputDefined(){return !1}serialize(){const e=["length"];return this.eachChild((t=>{e.push(t.serialize());})),e}}function ys(e){return function(){e=1831565813+(e|=0)|0;let t=Math.imul(e^e>>>15,1|e);return t=t+Math.imul(t^t>>>7,61|t)^t,((t^t>>>14)>>>0)/4294967296}}const gs={"==":ls,"!=":us,">":hs,"<":cs,">=":ds,"<=":ps,array:Hr,at:Ki,"at-interpolated":Ji,boolean:Hr,case:rs,coalesce:Wi,collator:an,format:Xr,image:Zr,in:Qi,"index-of":es,interpolate:Xi,"interpolate-hcl":Xi,"interpolate-lab":Xi,length:ms,let:Yi,literal:$r,match:ts,number:Hr,"number-format":fs,object:Hr,slice:ns,step:ki,string:Hr,"to-boolean":tn,"to-color":tn,"to-number":tn,"to-string":tn,var:Mi,within:Tn,distance:yi,config:Ai,split:is};function xs(e,[t,r,n,i]){t=t.evaluate(e),r=r.evaluate(e),n=n.evaluate(e);const s=i?i.evaluate(e):1,o=Or(t,r,n,s);if(o)throw new Gr(o);return new lr(t/255,r/255,n/255,s)}function vs(e,[t,r,n,i]){t=t.evaluate(e),r=r.evaluate(e),n=n.evaluate(e);const s=i?i.evaluate(e):1,o=function(e,t,r,n){return "number"==typeof e&&e>=0&&e<=360?"number"==typeof t&&t>=0&&t<=100&&"number"==typeof r&&r>=0&&r<=100?void 0===n||"number"==typeof n&&n>=0&&n<=1?null:`Invalid hsla value [${[e,t,r,n].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid hsla value [${("number"==typeof n?[e,t,r,n]:[e,t,r]).join(", ")}]: 's', and 'l' must be between 0 and 100.`:`Invalid hsla value [${("number"==typeof n?[e,t,r,n]:[e,t,r]).join(", ")}]: 'h' must be between 0 and 360.`}(t,r,n,s);if(o)throw new Gr(o);const a=`hsla(${t}, ${r}%, ${n}%, ${s})`,l=lr.parse(a);if(!l)throw new Gr(`Failed to parse HSLA color: ${a}`);return l}function bs(e,t){return e in t}function ws(e,t){const r=t[e];return void 0===r?null:r}function _s(e){return {type:e}}function As(e){if(e instanceof Ai)return new Set([e.key]);let t=new Set;return e.eachChild((e=>{t=new Set([...t,...As(e)]);})),t}function Ms(e){if(e instanceof sn&&"is-active-floor"===e.name)return !0;let t=!1;return e.eachChild((e=>{!t&&Ms(e)&&(t=!0);})),t}function Is(e){return {result:"success",value:e}}function Ss(e){return {result:"error",value:e}}function Ps(e,t){return !!e&&!!e.parameters&&e.parameters.indexOf(t)>-1}function ks(e){return "data-driven"===e["property-type"]}function zs(e){return Ps(e.expression,"measure-light")}function Ts(e){return Ps(e.expression,"zoom")}function Bs(e){return !!e.expression&&e.expression.interpolated}function Es(e){return "object"==typeof e&&null!==e&&!Array.isArray(e)}function Vs(e){return e}function Fs(e,t){const r="color"===t.type,n=e.stops&&"object"==typeof e.stops[0][0],i=n||!(n||void 0!==e.property),s=e.type||(Bs(t)?"exponential":"interval");if(r&&((e=Object.assign({},e)).stops&&(e.stops=e.stops.map((e=>[e[0],lr.parse(e[1])]))),e.default=lr.parse(e.default?e.default:t.default)),e.colorSpace&&"rgb"!==e.colorSpace&&!Hi[e.colorSpace])throw new Error(`Unknown color space: ${e.colorSpace}`);let o,a,l;if("exponential"===s)o=Ls;else if("interval"===s)o=Rs;else if("categorical"===s){o=Ds,a=Object.create(null);for(const t of e.stops)a[t[0]]=t[1];l=typeof e.stops[0][0];}else {if("identity"!==s)throw new Error(`Unknown function type "${s}"`);o=Os;}if(n){const r={},n=[];for(let t=0;te[0])),evaluate:({zoom:r},n)=>Ls({stops:i,base:e.base},t,r).evaluate(r,n)}}if(i){const r="exponential"===s?{name:"exponential",base:void 0!==e.base?e.base:1}:null;return {kind:"camera",interpolationType:r,interpolationFactor:Xi.interpolationFactor.bind(void 0,r),zoomStops:e.stops.map((e=>e[0])),evaluate:({zoom:r})=>o(e,t,r,a,l)}}return {kind:"source",evaluate(r,n){const i=n&&n.properties?n.properties[e.property]:void 0;return void 0===i?Cs(e.default,t.default):o(e,t,i,a,l)}}}function Cs(e,t,r){return void 0!==e?e:void 0!==t?t:void 0!==r?r:void 0}function Ds(e,t,r,n,i){return Cs(typeof r===i?n[r]:void 0,e.default,t.default)}function Rs(e,t,r){if(!Jr(r))return Cs(e.default,t.default);const n=e.stops.length;if(1===n)return e.stops[0][1];if(r<=e.stops[0][0])return e.stops[0][1];if(r>=e.stops[n-1][0])return e.stops[n-1][1];const i=Pi(e.stops.map((e=>e[0])),r);return e.stops[i][1]}function Ls(e,t,r){const n=void 0!==e.base?e.base:1;if(!Jr(r))return Cs(e.default,t.default);const i=e.stops.length;if(1===i)return e.stops[0][1];if(r<=e.stops[0][0])return e.stops[0][1];if(r>=e.stops[i-1][0])return e.stops[i-1][1];const s=Pi(e.stops.map((e=>e[0])),r),o=function(e,t,r,n){const i=n-r,s=e-r;return 0===i?0:1===t?s/i:(Math.pow(t,s)-1)/(Math.pow(t,i)-1)}(r,n,e.stops[s][0],e.stops[s+1][0]),a=e.stops[s][1],l=e.stops[s+1][1];let u=fr[t.type]||Vs;if(e.colorSpace&&"rgb"!==e.colorSpace){const t=Hi[e.colorSpace];u=(e,r)=>t.reverse(t.interpolate(t.forward(e),t.forward(r),o));}return "function"==typeof a.evaluate?{evaluate(...e){const t=a.evaluate.apply(void 0,e),r=l.evaluate.apply(void 0,e);if(void 0!==t&&void 0!==r)return u(t,r,o)}}:u(a,l,o)}function Os(e,t,r){return "color"===t.type?r=lr.parse(r):"formatted"===t.type?r=Dr.fromString(r.toString()):"resolvedImage"===t.type?r=Lr.build(r.toString()):Wr(r)===t.type||"enum"===t.type&&t.values[r]||(r=void 0),Cs(r,e.default,t.default)}sn.register(gs,{error:[{kind:"error"},[vr],(e,[t])=>{throw new Gr(t.evaluate(e))}],typeof:[vr,[Ar],(e,[t])=>kr(Nr(t.evaluate(e)))],"to-rgba":[Pr(xr,4),[wr],(e,[t])=>t.evaluate(e).toNonPremultipliedRenderColor(null).toArray()],"to-hsla":[Pr(xr,4),[wr],(e,[t])=>t.evaluate(e).toNonPremultipliedRenderColor(null).toHslaArray()],rgb:[wr,[xr,xr,xr],xs],rgba:[wr,[xr,xr,xr,xr],xs],hsl:[wr,[xr,xr,xr],vs],hsla:[wr,[xr,xr,xr,xr],vs],has:{type:br,overloads:[[[vr],(e,[t])=>bs(t.evaluate(e),e.properties())],[[vr,_r],(e,[t,r])=>bs(t.evaluate(e),r.evaluate(e))]]},get:{type:Ar,overloads:[[[vr],(e,[t])=>ws(t.evaluate(e),e.properties())],[[vr,_r],(e,[t,r])=>ws(t.evaluate(e),r.evaluate(e))]]},"feature-state":[Ar,[vr],(e,[t])=>ws(t.evaluate(e),e.featureState||{})],properties:[_r,[],e=>e.properties()],"geometry-type":[vr,[],e=>e.geometryType()],worldview:[vr,[],e=>e.globals.worldview||""],"is-active-floor":[br,_s(vr),(e,t)=>{if(!(e.globals.activeFloors&&e.globals.activeFloors.size>0))return !1;const r=e.globals.activeFloors;return t.some((t=>{const n=t.evaluate(e);return r.has(n)}))}],id:[Ar,[],e=>e.id()],zoom:[xr,[],e=>e.globals.zoom],pitch:[xr,[],e=>e.globals.pitch||0],"distance-from-center":[xr,[],e=>e.distanceFromCenter()],"measure-light":[xr,[vr],(e,[t])=>e.measureLight(t.evaluate(e))],"heatmap-density":[xr,[],e=>e.globals.heatmapDensity||0],"line-progress":[xr,[],e=>e.globals.lineProgress||0],"raster-value":[xr,[],e=>e.globals.rasterValue||0],"raster-particle-speed":[xr,[],e=>e.globals.rasterParticleSpeed||0],"sky-radial-progress":[xr,[],e=>e.globals.skyRadialProgress||0],accumulated:[Ar,[],e=>void 0===e.globals.accumulated?null:e.globals.accumulated],"+":[xr,_s(xr),(e,t)=>{let r=0;for(const n of t)r+=n.evaluate(e);return r}],"*":[xr,_s(xr),(e,t)=>{let r=1;for(const n of t)r*=n.evaluate(e);return r}],"-":{type:xr,overloads:[[[xr,xr],(e,[t,r])=>t.evaluate(e)-r.evaluate(e)],[[xr],(e,[t])=>-t.evaluate(e)]]},"/":[xr,[xr,xr],(e,[t,r])=>t.evaluate(e)/r.evaluate(e)],"%":[xr,[xr,xr],(e,[t,r])=>t.evaluate(e)%r.evaluate(e)],ln2:[xr,[],()=>Math.LN2],pi:[xr,[],()=>Math.PI],e:[xr,[],()=>Math.E],"^":[xr,[xr,xr],(e,[t,r])=>Math.pow(t.evaluate(e),r.evaluate(e))],sqrt:[xr,[xr],(e,[t])=>Math.sqrt(t.evaluate(e))],log10:[xr,[xr],(e,[t])=>Math.log(t.evaluate(e))/Math.LN10],ln:[xr,[xr],(e,[t])=>Math.log(t.evaluate(e))],log2:[xr,[xr],(e,[t])=>Math.log2(t.evaluate(e))],sin:[xr,[xr],(e,[t])=>Math.sin(t.evaluate(e))],cos:[xr,[xr],(e,[t])=>Math.cos(t.evaluate(e))],tan:[xr,[xr],(e,[t])=>Math.tan(t.evaluate(e))],asin:[xr,[xr],(e,[t])=>Math.asin(t.evaluate(e))],acos:[xr,[xr],(e,[t])=>Math.acos(t.evaluate(e))],atan:[xr,[xr],(e,[t])=>Math.atan(t.evaluate(e))],min:[xr,_s(xr),(e,t)=>Math.min(...t.map((t=>t.evaluate(e))))],max:[xr,_s(xr),(e,t)=>Math.max(...t.map((t=>t.evaluate(e))))],abs:[xr,[xr],(e,[t])=>Math.abs(t.evaluate(e))],round:[xr,[xr],(e,[t])=>{const r=t.evaluate(e);return r<0?-Math.round(-r):Math.round(r)}],floor:[xr,[xr],(e,[t])=>Math.floor(t.evaluate(e))],ceil:[xr,[xr],(e,[t])=>Math.ceil(t.evaluate(e))],"filter-==":[br,[vr,Ar],(e,[t,r])=>e.properties()[t.value]===r.value],"filter-id-==":[br,[Ar],(e,[t])=>e.id()===t.value],"filter-type-==":[br,[vr],(e,[t])=>e.geometryType()===t.value],"filter-<":[br,[vr,Ar],(e,[t,r])=>{const n=e.properties()[t.value],i=r.value;return typeof n==typeof i&&n{const r=e.id(),n=t.value;return typeof r==typeof n&&r":[br,[vr,Ar],(e,[t,r])=>{const n=e.properties()[t.value],i=r.value;return typeof n==typeof i&&n>i}],"filter-id->":[br,[Ar],(e,[t])=>{const r=e.id(),n=t.value;return typeof r==typeof n&&r>n}],"filter-<=":[br,[vr,Ar],(e,[t,r])=>{const n=e.properties()[t.value],i=r.value;return typeof n==typeof i&&n<=i}],"filter-id-<=":[br,[Ar],(e,[t])=>{const r=e.id(),n=t.value;return typeof r==typeof n&&r<=n}],"filter->=":[br,[vr,Ar],(e,[t,r])=>{const n=e.properties()[t.value],i=r.value;return typeof n==typeof i&&n>=i}],"filter-id->=":[br,[Ar],(e,[t])=>{const r=e.id(),n=t.value;return typeof r==typeof n&&r>=n}],"filter-has":[br,[Ar],(e,[t])=>t.value in e.properties()],"filter-has-id":[br,[],e=>null!==e.id()&&void 0!==e.id()],"filter-type-in":[br,[Pr(vr)],(e,[t])=>t.value.indexOf(e.geometryType())>=0],"filter-id-in":[br,[Pr(Ar)],(e,[t])=>t.value.indexOf(e.id())>=0],"filter-in-small":[br,[vr,Pr(Ar)],(e,[t,r])=>r.value.indexOf(e.properties()[t.value])>=0],"filter-in-large":[br,[vr,Pr(Ar)],(e,[t,r])=>function(e,t,r,n){for(;r<=n;){const i=r+n>>1;if(t[i]===e)return !0;t[i]>e?n=i-1:r=i+1;}return !1}(e.properties()[t.value],r.value,0,r.value.length-1)],all:{type:br,overloads:[[[br,br],(e,[t,r])=>t.evaluate(e)&&r.evaluate(e)],[_s(br),(e,t)=>{for(const r of t)if(!r.evaluate(e))return !1;return !0}]]},any:{type:br,overloads:[[[br,br],(e,[t,r])=>t.evaluate(e)||r.evaluate(e)],[_s(br),(e,t)=>{for(const r of t)if(r.evaluate(e))return !0;return !1}]]},"!":[br,[br],(e,[t])=>!t.evaluate(e)],"is-supported-script":[br,[vr],(e,[t])=>{const r=e.globals&&e.globals.isSupportedScript;return !r||r(t.evaluate(e))}],upcase:[vr,[vr],(e,[t])=>t.evaluate(e).toUpperCase()],downcase:[vr,[vr],(e,[t])=>t.evaluate(e).toLowerCase()],concat:[vr,_s(Ar),(e,t)=>t.map((t=>jr(t.evaluate(e)))).join("")],"resolved-locale":[vr,[Mr],(e,[t])=>t.evaluate(e).resolvedLocale()],random:[xr,[xr,xr,Ar],(e,t)=>{const[r,n,i]=t.map((t=>t.evaluate(e)));if(r>n)return r;if(r===n)return r;let s;if("string"==typeof i)s=function(e){let t=0;if(0===e.length)return t;for(let r=0;rJSON.stringify(e))).join(", ")}, but found ${JSON.stringify(e)} instead.`);return e}catch(e){return this._warningHistory[e.message]||(this._warningHistory[e.message]=!0,"undefined"!=typeof console&&console.warn(`Failed to evaluate expression "${JSON.stringify(this.expression.serialize())}". ${e.message}`)),this._defaultValue}}}function Ns(e){return Array.isArray(e)&&e.length>0&&"string"==typeof e[0]&&e[0]in gs}function js(e,t,r,n,i){const s=new Ii(gs,[],t?function(e){const t={color:wr,string:vr,number:xr,enum:vr,boolean:br,formatted:Ir,resolvedImage:Sr};return "array"===e.type?Pr(t[e.value]||Ar,e.length):t[e.type]}(t):void 0,void 0,void 0,r,n,i),o=s.parse(e,void 0,void 0,void 0,t&&"string"===t.type?{typeAnnotation:"coerce"}:void 0);return o?Is(new Us(o,t,r,n,i)):Ss(s.errors)}class $s{constructor(e,t,r,n){this.kind=e,this._styleExpression=t,this.isLightConstant=r,this.isLineProgressConstant=n,this.isStateDependent="constant"!==e&&!xi(t.expression),this.configDependencies=As(t.expression),this.isIndoorDependent=Ms(t.expression);}evaluateWithoutErrorHandling(e,t,r,n,i,s){return this._styleExpression.evaluateWithoutErrorHandling(e,t,r,n,i,s)}evaluate(e,t,r,n,i,s,o){return this._styleExpression.evaluate(e,t,r,n,i,s,void 0,void 0,o)}}class Gs{constructor(e,t,r,n,i,s){this.kind=e,this.zoomStops=r,this._styleExpression=t,this.isStateDependent="camera"!==e&&!xi(t.expression),this.isIndoorDependent=Ms(t.expression),this.isLightConstant=i,this.isLineProgressConstant=s,this.configDependencies=As(t.expression),this.interpolationType=n;}evaluateWithoutErrorHandling(e,t,r,n,i,s){return this._styleExpression.evaluateWithoutErrorHandling(e,t,r,n,i,s)}evaluate(e,t,r,n,i,s){return this._styleExpression.evaluate(e,t,r,n,i,s)}interpolationFactor(e,t,r){return this.interpolationType?Xi.interpolationFactor(this.interpolationType,e,t,r):0}}function qs(e,t,r,n,i){if("error"===(e=js(e,t,r,n,i)).result)return e;const s=e.value.expression,o=gi(s);if(!o&&!ks(t))return Ss([new mr("","data expressions not supported")]);const a=vi(s,["zoom","pitch","distance-from-center"]);if(!a&&!Ts(t))return Ss([new mr("","zoom expressions not supported")]);const l=vi(s,["measure-light"]);if(!l&&!zs(t))return Ss([new mr("","measure-light expression not supported")]);const u=vi(s,["line-progress"]);if(!u&&!function(e){return Ps(e.expression,"line-progress")}(t))return Ss([new mr("","line-progress expression not supported")]);const c=t.expression&&t.expression.relaxZoomRestriction,h=Xs(s);return h||a||c?h instanceof mr?Ss([h]):h instanceof Xi&&!Bs(t)?Ss([new mr("",'"interpolate" expressions cannot be used with this property')]):Is(h?new Gs(o&&u?"camera":"composite",e.value,h.labels,h instanceof Xi?h.interpolation:void 0,l,u):new $s(o&&u?"constant":"source",e.value,l,u)):Ss([new mr("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression, or in the properties of atmosphere.')])}class Hs{constructor(e,t){this._parameters=e,this._specification=t,Object.assign(this,Fs(this._parameters,this._specification));}static deserialize(e){return new Hs(e._parameters,e._specification)}static serialize(e){return {_parameters:e._parameters,_specification:e._specification}}}function Xs(e){let t=null;if(e instanceof Yi)t=Xs(e.result);else if(e instanceof Wi){for(const r of e.args)if(t=Xs(r),t)break}else (e instanceof ki||e instanceof Xi)&&e.input instanceof sn&&"zoom"===e.input.name&&(t=e);return t instanceof mr||e.eachChild((e=>{const r=Xs(e);r instanceof mr?t=r:t&&r&&t!==r&&(t=new mr("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'));})),t}var Zs,Ws,Ys=function(){if(Ws)return Zs;Ws=1,Zs=t;var e=3;function t(t,r,n){var i=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;var s=new Int32Array(this.arrayBuffer);t=s[0],this.d=(r=s[1])+2*(n=s[2]);for(var o=0;o=c[d+0]&&n>=c[d+1])?(o[p]=!0,s.push(u[p])):o[p]=!1;}}},t.prototype._forEachCell=function(e,t,r,n,i,s,o,a){for(var l=this._convertToCellCoord(e),u=this._convertToCellCoord(t),c=this._convertToCellCoord(r),h=this._convertToCellCoord(n),p=l;p<=c;p++)for(var d=u;d<=h;d++){var f=this.d*d+p;if((!a||a(this._convertFromCellCoord(p),this._convertFromCellCoord(d),this._convertFromCellCoord(p+1),this._convertFromCellCoord(d+1)))&&i.call(this,e,t,r,n,f,s,o,a))return}},t.prototype._convertFromCellCoord=function(e){return (e-this.padding)/this.scale},t.prototype._convertToCellCoord=function(e){return Math.max(0,Math.min(this.d-1,Math.floor(e*this.scale)+this.padding))},t.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var t=this.cells,r=e+this.cells.length+1+1,n=0,i=0;i=0||(i[r]=ro(e[r],t)));e instanceof Error&&(i.message=e.message);}if(i.$name)throw new Error("$name property is reserved for worker serialization logic.");return "Object"!==n&&(i.$name=n),i}throw new Error("can't serialize object of type "+typeof e)}function no(e){if(null==e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||e instanceof Boolean||e instanceof Number||e instanceof String||e instanceof Date||e instanceof RegExp||eo(e)||to(e)||ArrayBuffer.isView(e)||e instanceof ImageData)return e;if(Array.isArray(e))return e.map(no);if("object"==typeof e){const t=e.$name||"Object";if("Map"===t){const t=e.entries||[],r=new Map;for(let e=0;ee>=128&&e<=255,Arabic:e=>e>=1536&&e<=1791,"Arabic Supplement":e=>e>=1872&&e<=1919,"Arabic Extended-A":e=>e>=2208&&e<=2303,"Hangul Jamo":e=>e>=4352&&e<=4607,"Unified Canadian Aboriginal Syllabics":e=>e>=5120&&e<=5759,Khmer:e=>e>=6016&&e<=6143,"Unified Canadian Aboriginal Syllabics Extended":e=>e>=6320&&e<=6399,"General Punctuation":e=>e>=8192&&e<=8303,"Letterlike Symbols":e=>e>=8448&&e<=8527,"Number Forms":e=>e>=8528&&e<=8591,"Miscellaneous Technical":e=>e>=8960&&e<=9215,"Control Pictures":e=>e>=9216&&e<=9279,"Optical Character Recognition":e=>e>=9280&&e<=9311,"Enclosed Alphanumerics":e=>e>=9312&&e<=9471,"Geometric Shapes":e=>e>=9632&&e<=9727,"Miscellaneous Symbols":e=>e>=9728&&e<=9983,"Miscellaneous Symbols and Arrows":e=>e>=11008&&e<=11263,"CJK Radicals Supplement":e=>e>=11904&&e<=12031,"Kangxi Radicals":e=>e>=12032&&e<=12255,"Ideographic Description Characters":e=>e>=12272&&e<=12287,"CJK Symbols and Punctuation":e=>e>=12288&&e<=12351,Hiragana:e=>e>=12352&&e<=12447,Katakana:e=>e>=12448&&e<=12543,Bopomofo:e=>e>=12544&&e<=12591,"Hangul Compatibility Jamo":e=>e>=12592&&e<=12687,Kanbun:e=>e>=12688&&e<=12703,"Bopomofo Extended":e=>e>=12704&&e<=12735,"CJK Strokes":e=>e>=12736&&e<=12783,"Katakana Phonetic Extensions":e=>e>=12784&&e<=12799,"Enclosed CJK Letters and Months":e=>e>=12800&&e<=13055,"CJK Compatibility":e=>e>=13056&&e<=13311,"CJK Unified Ideographs Extension A":e=>e>=13312&&e<=19903,"Yijing Hexagram Symbols":e=>e>=19904&&e<=19967,"CJK Unified Ideographs":e=>e>=19968&&e<=40959,"Yi Syllables":e=>e>=40960&&e<=42127,"Yi Radicals":e=>e>=42128&&e<=42191,"Hangul Jamo Extended-A":e=>e>=43360&&e<=43391,"Hangul Syllables":e=>e>=44032&&e<=55215,"Hangul Jamo Extended-B":e=>e>=55216&&e<=55295,"Private Use Area":e=>e>=57344&&e<=63743,"CJK Compatibility Ideographs":e=>e>=63744&&e<=64255,"Arabic Presentation Forms-A":e=>e>=64336&&e<=65023,"Vertical Forms":e=>e>=65040&&e<=65055,"CJK Compatibility Forms":e=>e>=65072&&e<=65103,"Small Form Variants":e=>e>=65104&&e<=65135,"Arabic Presentation Forms-B":e=>e>=65136&&e<=65279,"Halfwidth and Fullwidth Forms":e=>e>=65280&&e<=65519,Osage:e=>e>=66736&&e<=66815,"CJK Unified Ideographs Extension B":e=>e>=131072&&e<=173791};function so(e){for(const t of e)if(lo(t.charCodeAt(0)))return !0;return !1}function oo(e){for(const t of e)if(!ao(t.charCodeAt(0)))return !1;return !0}function ao(e){return !(io.Arabic(e)||io["Arabic Supplement"](e)||io["Arabic Extended-A"](e)||io["Arabic Presentation Forms-A"](e)||io["Arabic Presentation Forms-B"](e))}function lo(e){return !(746!==e&&747!==e&&(e<4352||!(io["Bopomofo Extended"](e)||io.Bopomofo(e)||io["CJK Compatibility Forms"](e)&&!(e>=65097&&e<=65103)||io["CJK Compatibility Ideographs"](e)||io["CJK Compatibility"](e)||io["CJK Radicals Supplement"](e)||io["CJK Strokes"](e)||!(!io["CJK Symbols and Punctuation"](e)||e>=12296&&e<=12305||e>=12308&&e<=12319||12336===e)||io["CJK Unified Ideographs Extension A"](e)||io["CJK Unified Ideographs"](e)||io["Enclosed CJK Letters and Months"](e)||io["Hangul Compatibility Jamo"](e)||io["Hangul Jamo Extended-A"](e)||io["Hangul Jamo Extended-B"](e)||io["Hangul Jamo"](e)||io["Hangul Syllables"](e)||io.Hiragana(e)||io["Ideographic Description Characters"](e)||io.Kanbun(e)||io["Kangxi Radicals"](e)||io["Katakana Phonetic Extensions"](e)||io.Katakana(e)&&12540!==e||!(!io["Halfwidth and Fullwidth Forms"](e)||65288===e||65289===e||65293===e||e>=65306&&e<=65310||65339===e||65341===e||65343===e||e>=65371&&e<=65503||65507===e||e>=65512&&e<=65519)||!(!io["Small Form Variants"](e)||e>=65112&&e<=65118||e>=65123&&e<=65126)||io["Unified Canadian Aboriginal Syllabics"](e)||io["Unified Canadian Aboriginal Syllabics Extended"](e)||io["Vertical Forms"](e)||io["Yijing Hexagram Symbols"](e)||io["Yi Syllables"](e)||io["Yi Radicals"](e))))}function uo(e){return !(lo(e)||function(e){return !!(io["Latin-1 Supplement"](e)&&(167===e||169===e||174===e||177===e||188===e||189===e||190===e||215===e||247===e)||io["General Punctuation"](e)&&(8214===e||8224===e||8225===e||8240===e||8241===e||8251===e||8252===e||8258===e||8263===e||8264===e||8265===e||8273===e)||io["Letterlike Symbols"](e)||io["Number Forms"](e)||io["Miscellaneous Technical"](e)&&(e>=8960&&e<=8967||e>=8972&&e<=8991||e>=8996&&e<=9e3||9003===e||e>=9085&&e<=9114||e>=9150&&e<=9165||9167===e||e>=9169&&e<=9179||e>=9186&&e<=9215)||io["Control Pictures"](e)&&9251!==e||io["Optical Character Recognition"](e)||io["Enclosed Alphanumerics"](e)||io["Geometric Shapes"](e)||io["Miscellaneous Symbols"](e)&&!(e>=9754&&e<=9759)||io["Miscellaneous Symbols and Arrows"](e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||io["CJK Symbols and Punctuation"](e)||io.Katakana(e)||io["Private Use Area"](e)||io["CJK Compatibility Forms"](e)||io["Small Form Variants"](e)||io["Halfwidth and Fullwidth Forms"](e)||8734===e||8756===e||8757===e||e>=9984&&e<=10087||e>=10102&&e<=10131||65532===e||65533===e)}(e))}function co(e){return io.Arabic(e)||io["Arabic Supplement"](e)||io["Arabic Extended-A"](e)||io["Arabic Presentation Forms-A"](e)||io["Arabic Presentation Forms-B"](e)}function ho(e){return e>=1424&&e<=2303||io["Arabic Presentation Forms-A"](e)||io["Arabic Presentation Forms-B"](e)}function po(e,t){return !(!t&&ho(e)||e>=2304&&e<=3583||e>=3840&&e<=4255||io.Khmer(e))}function fo(e){for(const t of e)if(ho(t.charCodeAt(0)))return !0;return !1}const mo={unavailable:"unavailable",deferred:"deferred",loading:"loading",parsing:"parsing",parsed:"parsed",loaded:"loaded",error:"error"};let yo=null,go=mo.unavailable,xo=null;const vo=function(e){e&&"string"==typeof e&&e.indexOf("NetworkError")>-1&&(go=mo.error),yo&&yo(e);};function bo(){wo.fire(new Qt("pluginStateChange",{pluginStatus:go,pluginURL:xo}));}const wo=new nr,_o=function(){return go},Ao=function(){if(go!==mo.deferred||!xo)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");go=mo.loading,bo(),xo&&Ot({url:xo},(e=>{e?vo(e):(go=mo.loaded,bo());}));},Mo={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>go===mo.loaded||null!=Mo.applyArabicShaping,isLoading:()=>go===mo.loading,setState(e){go=e.pluginStatus,xo=e.pluginURL;},isParsing:()=>go===mo.parsing,isParsed:()=>go===mo.parsed,getPluginURL:()=>xo};class Io{constructor(e,t){this.zoom=e,t?(this.now=t.now,this.fadeDuration=t.fadeDuration,this.transition=t.transition,this.pitch=t.pitch,this.brightness=t.brightness,this.worldview=t.worldview,this.activeFloors=t.activeFloors):(this.now=0,this.fadeDuration=0,this.transition={},this.pitch=0,this.brightness=0);}isSupportedScript(e){return function(e,t){for(const r of e)if(!po(r.charCodeAt(0),t))return !1;return !0}(e,Mo.isLoaded())}}class So{constructor(e,t,r,n,i){this.property=e,this.value=t,this.expression=function(e,t,r,n,i){if(Es(e))return new Hs(e,t);if(Ns(e)||Array.isArray(e)&&e.length>0){const s=qs(e,t,r,n,i);if("error"===s.result)throw new Error(s.value.map((e=>`${e.key}: ${e.message}`)).join(", "));return s.value}{let r=e;return "string"==typeof e&&"color"===t.type&&(r=lr.parse(e)),{kind:"constant",configDependencies:new Set,isIndoorDependent:!1,evaluate:()=>r}}}(void 0===t?e.specification.default:t,e.specification,r,n,i);}isIndoorDependent(){return this.expression.isIndoorDependent}isDataDriven(){return "source"===this.expression.kind||"composite"===this.expression.kind}possiblyEvaluate(e,t,r,n){return this.property.possiblyEvaluate(this,e,t,r,n)}}class Po{constructor(e,t,r,n){this.property=e,this.value=new So(e,void 0,t,r,n);}transitioned(e,t){return new zo(this.property,this.value,t,Object.assign({},e.transition,this.transition),e.now)}untransitioned(){return new zo(this.property,this.value,null,{},0)}}class ko{constructor(e,t,r,n){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues),this._scope=t,this._options=r,this._iconImageUseTheme=n,this._isIndoorDependent=!1,this.configDependencies=new Set;}getValue(e){return Ge(this._values[e].value.value)}setValue(e,t){this._values.hasOwnProperty(e)||(this._values[e]=new Po(this._values[e].property,this._scope,this._options,this._iconImageUseTheme)),this._values[e].value=new So(this._values[e].property,null===t?void 0:Ge(t),this._scope,this._options,this._iconImageUseTheme),this._values[e].value.expression.configDependencies&&(this.configDependencies=new Set([...this.configDependencies,...this._values[e].value.expression.configDependencies]),this._isIndoorDependent=this._isIndoorDependent||this._values[e].value.isIndoorDependent());}setTransitionOrValue(e,t){t&&(this._options=t);const r=this._properties.properties;if(e)for(const t in e){const n=e[t];if(t.endsWith("-transition")){const e=t.slice(0,-11);r[e]&&this.setTransition(e,n);}else r.hasOwnProperty(t)&&this.setValue(t,n);}}getTransition(e){return Ge(this._values[e].transition)}setTransition(e,t){this._values.hasOwnProperty(e)||(this._values[e]=new Po(this._values[e].property)),this._values[e].transition=Ge(t)||void 0;}serialize(){const e={};for(const t of Object.keys(this._values)){const r=this.getValue(t);void 0!==r&&(e[t]=r);const n=this.getTransition(t);void 0!==n&&(e[`${t}-transition`]=n);}return e}transitioned(e,t){const r=new To(this._properties);for(const n of Object.keys(this._values))r._values[n]=this._values[n].transitioned(e,t._values[n]);return r}untransitioned(){const e=new To(this._properties);for(const t of Object.keys(this._values))e._values[t]=this._values[t].untransitioned();return e}isIndoorDependent(){return this._isIndoorDependent}}class zo{constructor(e,t,r,n,i){const s=n.delay||0,o=n.duration||0;i=i||0,this.property=e,this.value=t,this.begin=i+s,this.end=this.begin+o,e.specification.transition&&(n.delay||n.duration)&&(this.prior=r);}possiblyEvaluate(e,t,r){const n=e.now||0,i=this.value.possiblyEvaluate(e,t,r),s=this.prior;if(s){if(n>this.end)return this.prior=null,i;if(this.value.isDataDriven())return this.prior=null,i;if(n":1,">=":1,"<":1,"<=":1,"in":1,"!in":1,"all":1,"any":1,"none":1,"has":1,"!has":1}},"geometry_type":{"type":"enum","values":{"Point":1,"LineString":1,"Polygon":1}},"function":{"expression":{"type":"expression"},"stops":{"type":"array","value":"function_stop"},"base":{"type":"number","default":1,"minimum":0},"property":{"type":"string","default":"$zoom"},"type":{"type":"enum","values":{"identity":1,"exponential":1,"interval":1,"categorical":1},"default":"exponential"},"colorSpace":{"type":"enum","values":{"rgb":1,"lab":1,"hcl":1},"default":"rgb"},"default":{"type":"*"}},"function_stop":{"type":"array","minimum":0,"maximum":24,"value":["number","color"],"length":2},"expression":{"type":"array","value":"*","minimum":1},"fog":{"range":{"type":"array","default":[0.5,10],"minimum":-20,"maximum":20,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"high-color":{"type":"color","default":"#245cdf","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"space-color":{"type":"color","default":["interpolate",["linear"],["zoom"],4,"#010b19",7,"#367ab9"],"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"horizon-blend":{"type":"number","default":["interpolate",["linear"],["zoom"],4,0.2,7,0.1],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"star-intensity":{"type":"number","default":["interpolate",["linear"],["zoom"],5,0.35,6,0],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vertical-range":{"type":"array","default":[0,0],"minimum":0,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}}},"snow":{"density":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.85],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.3],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette-color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"center-thinning":{"type":"number","default":0.4,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"direction":{"type":"array","default":[0,50],"minimum":0,"maximum":360,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"flake-size":{"type":"number","default":0.71,"minimum":0,"maximum":5,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true}},"rain":{"density":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.5],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"color":{"type":"color","default":["interpolate",["linear"],["measure-light","brightness"],0,"#03113d",0.3,"#a8adbc"],"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"opacity":{"type":"number","default":["interpolate",["linear"],["measure-light","brightness"],0,0.88,1,0.7],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,1],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette-color":{"type":"color","default":["interpolate",["linear"],["measure-light","brightness"],0,"#001736",0.3,"#464646"],"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"center-thinning":{"type":"number","default":0.57,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"direction":{"type":"array","default":[0,80],"minimum":0,"maximum":360,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"droplet-size":{"type":"array","default":[2.6,18.2],"minimum":0,"maximum":50,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"distortion-strength":{"type":"number","default":0.7,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true}},"camera":{"camera-projection":{"type":"enum","values":{"perspective":1,"orthographic":1},"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"default":"perspective"}},"colorTheme":{"data":{"type":"string","expression":{}}},"indoor_source":{"sourceId":{"type":"string"},"sourceLayers":{"type":"array","value":"string"}},"indoor":{"*":{"type":"indoor_source"}},"light":{"anchor":{"type":"enum","default":"viewport","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"use-theme":true,"transition":true},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"projection":{"name":{"type":"enum","values":{"albers":1,"equalEarth":1,"equirectangular":1,"lambertConformalConic":1,"mercator":1,"naturalEarth":1,"winkelTripel":1,"globe":1},"default":"mercator"},"center":{"type":"array","length":2,"value":"number","minimum":[-180,-90],"maximum":[180,90]},"parallels":{"type":"array","length":2,"value":"number","minimum":[-90,-90],"maximum":[90,90]}},"terrain":{"source":{"type":"string"},"exaggeration":{"type":"number","default":1,"minimum":0,"maximum":1000,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"paint":["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_building","paint_symbol","paint_raster","paint_raster-particle","paint_hillshade","paint_background","paint_sky","paint_model"],"paint_fill":{"fill-antialias":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"fill-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-outline-color":{"type":"color","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"fill-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-z-offset":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-bridge-guard-rail-color":{"type":"color","default":"rgba(241, 236, 225, 255)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature"]},"property-type":"data-driven"},"fill-tunnel-structure-color":{"type":"color","default":"rgba(241, 236, 225, 255)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature"]},"property-type":"data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-extrusion-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"fill-extrusion-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-extrusion-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-height":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-height-alignment":{"type":"enum","values":{"terrain":1,"flat":1},"default":"flat"},"fill-extrusion-base-alignment":{"type":"enum","values":{"terrain":1,"flat":1},"default":"terrain"},"fill-extrusion-vertical-gradient":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"fill-extrusion-ambient-occlusion-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-wall-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-ground-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-flood-light-color":{"type":"color","default":"#ffffff","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-flood-light-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-flood-light-wall-radius":{"property-type":"data-driven","type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"fill-extrusion-flood-light-ground-radius":{"property-type":"data-driven","type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"fill-extrusion-flood-light-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-vertical-scale":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-rounded-roof":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"fill-extrusion-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"fill-extrusion-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"property-type":"data-driven"},"fill-extrusion-line-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-extrusion-cast-shadows":{"type":"boolean","default":true}},"paint_building":{"building-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"building-ambient-occlusion-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"parameters":[]},"transition":true},"building-ambient-occlusion-ground-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"building-ambient-occlusion-ground-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"building-ambient-occlusion-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"building-vertical-scale":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"building-cast-shadows":{"type":"boolean","default":true},"building-color":{"type":"color","default":"rgba(193, 154, 127, 1)","use-theme":true,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"property-type":"data-driven"},"building-emissive-strength":{"type":"number","default":0,"minimum":0,"maximum":5,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"property-type":"data-driven"},"building-facade-emissive-chance":{"type":"number","default":0.35,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["measure-light","zoom"]}},"building-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"building-flood-light-color":{"type":"color","default":"#ffffff","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"building-flood-light-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"building-flood-light-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_line":{"line-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"line-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"line-width":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light","line-progress"]},"property-type":"data-driven"},"line-gap-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-offset":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-dasharray":{"type":"array","value":"number","minimum":0,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"line-gradient":{"type":"color","use-theme":true,"expression":{"interpolated":true,"parameters":["line-progress"]}},"line-trim-offset":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[0,0],"maximum":[1,1]},"line-trim-fade-range":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[0,0],"maximum":[1,1],"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"line-trim-color":{"type":"color","default":"transparent","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"line-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"line-border-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-border-color":{"type":"color","default":"rgba(0, 0, 0, 0)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-occlusion-opacity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"paint_circle":{"circle-radius":{"type":"number","default":5,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-blur":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"circle-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"circle-pitch-scale":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"circle-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1},"default":"viewport","expression":{"parameters":["zoom"]}},"circle-stroke-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-stroke-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-stroke-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}}},"paint_heatmap":{"heatmap-radius":{"type":"number","default":30,"minimum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"heatmap-weight":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"heatmap-intensity":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"heatmap-color":{"type":"color","default":["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",0.1,"royalblue",0.3,"cyan",0.5,"lime",0.7,"yellow",1,"red"],"use-theme":true,"expression":{"interpolated":true,"parameters":["heatmap-density"]}},"heatmap-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_symbol":{"icon-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-occlusion-opacity":{"type":"number","minimum":0,"maximum":1,"default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-emissive-strength":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"property-type":"data-driven"},"text-emissive-strength":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"property-type":"data-driven"},"icon-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"icon-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"icon-image-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"text-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-occlusion-opacity":{"type":"number","minimum":0,"maximum":1,"default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"overridable":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"text-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"icon-color-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":{}},"icon-color-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":{}},"icon-color-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"icon-color-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{}},"symbol-z-offset":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"}},"paint_raster":{"raster-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-color":{"type":"color","use-theme":true,"expression":{"interpolated":true,"parameters":["raster-value"]}},"raster-color-mix":{"type":"array","default":[0.2126,0.7152,0.0722,0],"length":4,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-color-range":{"type":"array","length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-hue-rotate":{"type":"number","default":0,"period":360,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-resampling":{"type":"enum","values":{"linear":1,"nearest":1},"default":"linear","expression":{"parameters":["zoom"]}},"raster-fade-duration":{"type":"number","default":300,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"raster-array-band":{"type":"string"},"raster-elevation":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_raster-particle":{"raster-particle-array-band":{"type":"string"},"raster-particle-count":{"type":"number","default":512,"minimum":1},"raster-particle-color":{"type":"color","use-theme":true,"expression":{"interpolated":true,"parameters":["raster-particle-speed"]}},"raster-particle-max-speed":{"type":"number","default":1,"minimum":1},"raster-particle-speed-factor":{"type":"number","default":0.2,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-particle-fade-opacity-factor":{"type":"number","default":0.98,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-particle-reset-rate-factor":{"type":"number","default":0.8,"minimum":0,"maximum":1},"raster-particle-elevation":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_hillshade":{"hillshade-illumination-direction":{"type":"number","default":335,"minimum":0,"maximum":359,"expression":{"interpolated":true,"parameters":["zoom"]}},"hillshade-illumination-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"viewport","expression":{"parameters":["zoom"]}},"hillshade-exaggeration":{"type":"number","default":0.5,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"hillshade-shadow-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"hillshade-highlight-color":{"type":"color","default":"#FFFFFF","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"hillshade-accent-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"hillshade-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}}},"paint_background":{"background-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":[]}},"background-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"background-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom"]}},"background-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"background-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}}},"paint_sky":{"sky-type":{"type":"enum","values":{"gradient":1,"atmosphere":1},"default":"atmosphere","expression":{"parameters":["zoom"]}},"sky-atmosphere-sun":{"type":"array","value":"number","length":2,"minimum":[0,0],"maximum":[360,180],"expression":{"parameters":["zoom"]}},"sky-atmosphere-sun-intensity":{"type":"number","default":10,"minimum":0,"maximum":100},"sky-gradient-center":{"type":"array","value":"number","default":[0,0],"length":2,"minimum":[0,0],"maximum":[360,180],"expression":{"parameters":["zoom"]}},"sky-gradient-radius":{"type":"number","default":90,"minimum":0,"maximum":180,"expression":{"parameters":["zoom"]}},"sky-gradient":{"type":"color","default":["interpolate",["linear"],["sky-radial-progress"],0.8,"#87ceeb",1,"white"],"use-theme":true,"expression":{"interpolated":true,"parameters":["sky-radial-progress"]}},"sky-atmosphere-halo-color":{"type":"color","default":"white","use-theme":true},"sky-atmosphere-color":{"type":"color","default":"white","use-theme":true},"sky-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_model":{"model-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"property-type":"data-driven"},"model-rotation":{"type":"array","value":"number","length":3,"default":[0,0,0],"period":360,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-scale":{"type":"array","value":"number","length":3,"default":[1,1,1],"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-translation":{"type":"array","value":"number","length":3,"default":[0,0,0],"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-color":{"type":"color","default":"#ffffff","property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light","zoom"]},"use-theme":true,"transition":true},"model-color-mix-intensity":{"type":"number","property-type":"data-driven","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-type":{"type":"enum","values":{"common-3d":1,"location-indicator":1},"default":"common-3d"},"model-cast-shadows":{"type":"boolean","default":true},"model-receive-shadows":{"type":"boolean","default":true},"model-ambient-occlusion-intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"model-emissive-strength":{"type":"number","property-type":"data-driven","default":0,"minimum":0,"maximum":5,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-roughness":{"type":"number","default":1,"minimum":0,"maximum":1,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state"]},"transition":true},"model-height-based-emissive-strength-multiplier":{"type":"array","default":[1,1,1,1,0],"length":5,"value":"number","property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"model-front-cutoff":{"type":"array","value":"number","expression":{"interpolated":true,"parameters":["zoom"]},"length":3,"default":[0,0,1],"minimum":[0,0,0],"maximum":[1,1,1]},"model-elevation-reference":{"type":"enum","values":{"sea":1,"ground":1,"hd-road-markup":1},"default":"ground","expression":{}}},"transition":{"duration":{"type":"number","default":300,"minimum":0},"delay":{"type":"number","default":0,"minimum":0}},"promoteId":{"*":{"type":"*"}}}');function Oo(e){return e instanceof Number||e instanceof String||e instanceof Boolean?e.valueOf():e}function Uo(e){if(Array.isArray(e))return e.map(Uo);if(e instanceof Object&&!(e instanceof Number||e instanceof String||e instanceof Boolean)){const t={};for(const r in e)t[r]=Uo(e[r]);return t}return Oo(e)}function No(e){if(!0===e||!1===e)return !0;if(!Array.isArray(e)||0===e.length)return !1;switch(e[0]){case "has":return e.length>=2&&"$id"!==e[1]&&"$type"!==e[1];case "in":return e.length>=3&&("string"!=typeof e[1]||Array.isArray(e[2]));case "!in":case "!has":case "none":return !1;case "==":case "!=":case ">":case ">=":case "<":case "<=":return 3!==e.length||Array.isArray(e[1])||Array.isArray(e[2]);case "any":case "all":for(const t of e.slice(1))if(!No(t)&&"boolean"!=typeof t)return !1;return !0;default:return !0}}function jo(e,t="",r=null,n="fill"){if(null==e)return {filter:()=>!0,needGeometry:!1,needFeature:!1};No(e)||(e=Wo(e));const i=e;let s=!0;try{s=function(e){if(!qo(e))return e;let t=Uo(e);return Go(t),t=$o(t),t}(i);}catch(e){console.warn(`Failed to extract static filter. Filter will continue working, but at higher memory usage and slower framerate.\nThis is most likely a bug, please report this via https://github.com/mapbox/mapbox-gl-js/issues/new?assignees=&labels=&template=Bug_report.md\nand paste the contents of this message in the report.\nThank you!\nFilter Expression:\n${JSON.stringify(i,null,2)}\n `);}let o=null,a=null;if("background"!==n&&"sky"!==n&&"slot"!==n){a=Lo[`filter_${n}`];const e=js(s,a,t,r);if("error"===e.result)throw new Error(e.value.map((e=>`${e.key}: ${e.message}`)).join(", "));o=(t,r,n)=>e.value.evaluate(t,r,{},n);}let l=null,u=null;if(s!==i){const e=js(i,a,t,r);if("error"===e.result)throw new Error(e.value.map((e=>`${e.key}: ${e.message}`)).join(", "));l=(t,r,n,i,s)=>e.value.evaluate(t,r,{},n,void 0,void 0,i,s),u=!gi(e.value.expression);}return {filter:o,dynamicFilter:l||void 0,needGeometry:Zo(s),needFeature:!!u}}function $o(e){if(!Array.isArray(e))return e;const t=function(e){if(Ho.has(e[0]))for(let t=1;t$o(e)))}function Go(e){let t=!1;const r=[];if("case"===e[0]){for(let n=1;n",">=","<","<=","to-boolean"]);function Xo(e,t){return et?1:0}function Zo(e){if(!Array.isArray(e))return !1;if("within"===e[0]||"distance"===e[0])return !0;for(let t=1;t"===t||"<="===t||">="===t?Yo(e[1],e[2],t):"any"===t?(r=e.slice(1),["any"].concat(r.map(Wo))):"all"===t?["all"].concat(e.slice(1).map(Wo)):"none"===t?["all"].concat(e.slice(1).map(Wo).map(Qo)):"in"===t?Ko(e[1],e.slice(2)):"!in"===t?Qo(Ko(e[1],e.slice(2))):"has"===t?Jo(e[1]):"!has"!==t||Qo(Jo(e[1]));var r;}function Yo(e,t,r){switch(e){case "$type":return [`filter-type-${r}`,t];case "$id":return [`filter-id-${r}`,t];default:return [`filter-${r}`,e,t]}}function Ko(e,t){if(0===t.length)return !1;switch(e){case "$type":return ["filter-type-in",["literal",t]];case "$id":return ["filter-id-in",["literal",t]];default:return t.length>200&&!t.some((e=>typeof e!=typeof t[0]))?["filter-in-large",e,["literal",t.sort(Xo)]]:["filter-in-small",e,["literal",t]]}}function Jo(e){switch(e){case "$type":return !0;case "$id":return ["filter-has-id"];default:return ["filter-has",e]}}function Qo(e){return ["!",e]}const ea="";function ta(e,t){return t?`${e}${ea}${t}`:e}let ra;const na=()=>ra||(ra=new Ro({"icon-size":new Co(Lo.layout_symbol["icon-size"]),"icon-image":new Co(Lo.layout_symbol["icon-image"]),"icon-rotate":new Co(Lo.layout_symbol["icon-rotate"]),"icon-offset":new Co(Lo.layout_symbol["icon-offset"])}));class ia{constructor(e,t,r,n,i,s){this.cachedIconPrimary=null;const o=js(e,Lo.appearance.condition);if("success"===o.result&&(this.condition=o.value),this.name=t,r){this.properties=new Vo(na()),this.unevaluatedLayout=new Bo(na(),n,i,s);for(const e in r)this.unevaluatedLayout.setValue(e,r[e]);}}hasCachedIconPrimary(){return null!==this.cachedIconPrimary}setCachedIconPrimary(e){this.cachedIconPrimary=e;}getCachedIconPrimary(){return this.cachedIconPrimary}isActive(e){return !(this.condition||!e.isHidden||"hidden"!==this.name)||this.condition.evaluate(e.globals,e.feature,e.featureState,e.canonical)}getCondition(){return this.condition}getName(){return this.name}getProperty(e){return this.properties.get(e)}getUnevaluatedProperties(){return this.unevaluatedLayout}recalculate(e,t,r){this.unevaluatedLayout&&(this.properties=this.unevaluatedLayout.possiblyEvaluate(e,void 0,t,r));}serialize(){const e={};return e.condition=this.condition.expression.serialize(),this.name&&(e.name=this.name),this.unevaluatedLayout&&(e.properties=this.unevaluatedLayout.serialize()),e}}const sa="-transition",oa=new Set(["fill","line","background","hillshade","raster"]);class aa extends nr{constructor(e,t,r,n,i,s){if(super(),this.id=e.id,this.fqid=ta(this.id,r),this.type=e.type,this.scope=r,this.lut=n,this.options=i,this.iconImageUseTheme=s,this.appearances=new Array,this._featureFilter={filter:()=>!0,needGeometry:!1,needFeature:!1},this._filterCompiled=!1,this.expressionDependencies={isIndoorDependent:!1,configDependencies:new Set},"custom"!==e.type){if(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,e.type&&"background"!==e.type&&"sky"!==e.type&&"slot"!==e.type){this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter;const t=js(this.filter,Lo[`filter_${e.type}`]);"error"!==t.result&&(this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...t.value.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||t.value.isIndoorDependent);}if(e.slot&&(this.slot=e.slot),e.appearances&&this.setAppearances(e.appearances),t.layout&&(this._unevaluatedLayout=new Bo(t.layout,this.scope,i,this.iconImageUseTheme),this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...this._unevaluatedLayout.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||this._unevaluatedLayout.isIndoorDependent()),t.paint){this._transitionablePaint=new ko(t.paint,this.scope,i);for(const t in e.paint)this.setPaintProperty(t,e.paint[t]);for(const t in e.layout)this.setLayoutProperty(t,e.layout[t]);this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...this._transitionablePaint.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||this._transitionablePaint.isIndoorDependent(),this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Vo(t.paint);}}}onAdd(e){}onRemove(e){}isDraped(e){return !this.is3D(!0)&&oa.has(this.type)}getLayoutProperty(e){return "visibility"===e?this.visibility:this._unevaluatedLayout.getValue(e)}setLayoutProperty(e,t){if("custom"===this.type&&"visibility"===e)return void(this.visibility=t);const r=this._unevaluatedLayout;r._properties.properties[e]&&(r.setValue(e,t),this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...r.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||r.isIndoorDependent(),"visibility"===e&&this.possiblyEvaluateVisibility());}setAppearances(e){this.appearances=[],e.forEach((e=>{this.appearances.push(new ia(e.condition,e.name,e.properties,this.scope,this.options,this.iconImageUseTheme));}));}possiblyEvaluateVisibility(){this._unevaluatedLayout._values.visibility&&(this.visibility=this._unevaluatedLayout._values.visibility.possiblyEvaluate({zoom:0}));}getPaintProperty(e){return e.endsWith(sa)?this._transitionablePaint.getTransition(e.slice(0,-11)):this._transitionablePaint.getValue(e)}isPaintProperty(e){return !!this._transitionablePaint._properties.properties[e]}setPaintProperty(e,t){const r=this._transitionablePaint,n=r._properties.properties;if(e.endsWith(sa)){const i=e.slice(0,-11);return n[i]&&r.setTransition(i,t||void 0),!1}if(!n[e])return !1;const i=r._values[e],s=i.value.isDataDriven(),o=i.value;r.setValue(e,t),this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...r.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||r.isIndoorDependent(),this._handleSpecialPaintPropertyUpdate(e);const a=r._values[e].value,l=a.isDataDriven(),u=e.endsWith("pattern")||"line-dasharray"===e;return l||s||u||this._handleOverridablePaintPropertyUpdate(e,o,a)}_handleSpecialPaintPropertyUpdate(e){}getProgramIds(){return null}getDefaultProgramParams(e,t,r){return null}_handleOverridablePaintPropertyUpdate(e,t,r){return !1}isHidden(e){return !!(this.minzoom&&e=this.maxzoom)||"none"===this.visibility}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint);}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(e,t){this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,t,this.iconImageUseTheme)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,t);}serialize(){const e={id:this.id,type:this.type,slot:this.slot,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return 0!==this.appearances.length&&(e.appearances=this.appearances.map((e=>e.serialize()))),$e(e,((e,t)=>!(void 0===e||"layout"===t&&!Object.keys(e).length||"paint"===t&&!Object.keys(e).length)))}is3D(e){return !1}hasElevation(){return !1}isSky(){return !1}isTileClipped(){return !1}hasOffscreenPass(){return !1}hasShadowPass(){return !1}canCastShadows(){return !1}hasLightBeamPass(){return !1}cutoffRange(){return 0}tileCoverLift(){return 0}resize(){}_clear(){}isStateDependent(){for(const e in this.paint._values){const t=this.paint.get(e);if(t instanceof Eo&&ks(t.property.specification)&&("source"===t.value.kind||"composite"===t.value.kind)&&t.value.isStateDependent)return !0}for(const e of this.appearances)if(!xi(e.condition.expression))return !0;return !1}compileFilter(e){this._filterCompiled||(this._featureFilter=jo(this.filter,this.scope,e),this._filterCompiled=!0);}invalidateCompiledFilter(){this._filterCompiled=!1;}dynamicFilter(){return this._featureFilter.dynamicFilter}dynamicFilterNeedsFeature(){return this._featureFilter.needFeature}getLayerRenderingStats(){return this._stats}resetLayerRenderingStats(e){this._stats&&("shadow"===e.renderPass?this._stats.numRenderedVerticesInShadowPass=0:this._stats.numRenderedVerticesInTransparentPass=0);}getAppearances(){return this.appearances}queryRenderedFeatures(e,t,r){return {}}queryRadius(e){}queryIntersectsFeature(e,t,r,n,i,s,o,a,l){}}const la={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class ua{constructor(e,t){this._structArray=e,this._pos1=t*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8;}}class ca{constructor(){this.capacity=-1,this.resize(0);}static serialize(e,t){return e._trim(),t&&t.add(e.arrayBuffer),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){const t=Object.create(this.prototype);return t.arrayBuffer=e.arrayBuffer,t.length=e.length,t.capacity=e.arrayBuffer.byteLength/t.bytesPerElement,t._refreshViews(),t}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews());}clear(){this.length=0;}resize(e){this.reserve(e),this.length=e;}reserve(e){if(e>this.capacity){this.capacity=Math.max(e,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const t=this.uint8;this._refreshViews(),t&&this.uint8.set(t);}}_refreshViews(){throw new Error("StructArray#_refreshViews() must be implemented by each concrete StructArray layout")}emplace(...e){throw new Error("StructArray#emplace() must be implemented by each concrete StructArray layout")}emplaceBack(...e){throw new Error("StructArray#emplaceBack() must be implemented by each concrete StructArray layout")}destroy(){this.int8=this.uint8=this.int16=this.uint16=this.int32=this.uint32=this.float32=null,this.arrayBuffer=null;}}function ha(e,t=1){let r=0,n=0;return {members:e.map((e=>{const i=la[e.type].BYTES_PER_ELEMENT,s=r=pa(r,Math.max(t,i)),o=e.components||1;return n=Math.max(n,i),r+=i*o,{name:e.name,type:e.type,components:o,offset:s}})),size:pa(r,Math.max(n,t)),alignment:t}}function pa(e,t){return Math.ceil(e/t)*t}class da extends ca{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer);}emplaceBack(e,t){const r=this.length;return this.resize(r+1),this.emplace(r,e,t)}emplace(e,t,r){const n=2*e;return this.int16[n+0]=t,this.int16[n+1]=r,e}}da.prototype.bytesPerElement=4,Qs(da,"StructArrayLayout2i4");class fa extends ca{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer);}emplaceBack(e,t,r){const n=this.length;return this.resize(n+1),this.emplace(n,e,t,r)}emplace(e,t,r,n){const i=3*e;return this.int16[i+0]=t,this.int16[i+1]=r,this.int16[i+2]=n,e}}fa.prototype.bytesPerElement=6,Qs(fa,"StructArrayLayout3i6");class ma extends ca{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer);}emplaceBack(e,t,r,n){const i=this.length;return this.resize(i+1),this.emplace(i,e,t,r,n)}emplace(e,t,r,n,i){const s=4*e;return this.int16[s+0]=t,this.int16[s+1]=r,this.int16[s+2]=n,this.int16[s+3]=i,e}}ma.prototype.bytesPerElement=8,Qs(ma,"StructArrayLayout4i8");class ya extends ca{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer);}emplaceBack(e){const t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.float32[1*e+0]=t,e}}ya.prototype.bytesPerElement=4,Qs(ya,"StructArrayLayout1f4");class ga extends ca{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer);}emplaceBack(e,t,r){const n=this.length;return this.resize(n+1),this.emplace(n,e,t,r)}emplace(e,t,r,n){const i=4*e,s=2*e;return this.int16[i+0]=t,this.int16[i+1]=r,this.float32[s+1]=n,e}}ga.prototype.bytesPerElement=8,Qs(ga,"StructArrayLayout2i1f8");class xa extends ca{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer);}emplaceBack(e,t,r){const n=this.length;return this.resize(n+1),this.emplace(n,e,t,r)}emplace(e,t,r,n){const i=4*e;return this.int16[i+0]=t,this.int16[i+1]=r,this.int16[i+2]=n,e}}xa.prototype.bytesPerElement=8,Qs(xa,"StructArrayLayout3i8");class va extends ca{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer);}emplaceBack(e,t,r,n,i){const s=this.length;return this.resize(s+1),this.emplace(s,e,t,r,n,i)}emplace(e,t,r,n,i,s){const o=5*e;return this.int16[o+0]=t,this.int16[o+1]=r,this.int16[o+2]=n,this.int16[o+3]=i,this.int16[o+4]=s,e}}va.prototype.bytesPerElement=10,Qs(va,"StructArrayLayout5i10");class ba extends ca{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer);}emplaceBack(e,t,r,n,i,s,o){const a=this.length;return this.resize(a+1),this.emplace(a,e,t,r,n,i,s,o)}emplace(e,t,r,n,i,s,o,a){const l=6*e,u=12*e,c=3*e;return this.int16[l+0]=t,this.int16[l+1]=r,this.uint8[u+4]=n,this.uint8[u+5]=i,this.uint8[u+6]=s,this.uint8[u+7]=o,this.float32[c+2]=a,e}}ba.prototype.bytesPerElement=12,Qs(ba,"StructArrayLayout2i4ub1f12");class wa extends ca{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer);}emplaceBack(e,t,r){const n=this.length;return this.resize(n+1),this.emplace(n,e,t,r)}emplace(e,t,r,n){const i=3*e;return this.float32[i+0]=t,this.float32[i+1]=r,this.float32[i+2]=n,e}}wa.prototype.bytesPerElement=12,Qs(wa,"StructArrayLayout3f12");class _a extends ca{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer);}emplaceBack(e,t,r,n,i){const s=this.length;return this.resize(s+1),this.emplace(s,e,t,r,n,i)}emplace(e,t,r,n,i,s){const o=6*e,a=3*e;return this.uint16[o+0]=t,this.uint16[o+1]=r,this.uint16[o+2]=n,this.uint16[o+3]=i,this.float32[a+2]=s,e}}_a.prototype.bytesPerElement=12,Qs(_a,"StructArrayLayout4ui1f12");class Aa extends ca{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer);}emplaceBack(e,t,r,n){const i=this.length;return this.resize(i+1),this.emplace(i,e,t,r,n)}emplace(e,t,r,n,i){const s=4*e;return this.uint16[s+0]=t,this.uint16[s+1]=r,this.uint16[s+2]=n,this.uint16[s+3]=i,e}}Aa.prototype.bytesPerElement=8,Qs(Aa,"StructArrayLayout4ui8");class Ma extends ca{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer);}emplaceBack(e,t,r,n,i,s){const o=this.length;return this.resize(o+1),this.emplace(o,e,t,r,n,i,s)}emplace(e,t,r,n,i,s,o){const a=6*e;return this.int16[a+0]=t,this.int16[a+1]=r,this.int16[a+2]=n,this.int16[a+3]=i,this.int16[a+4]=s,this.int16[a+5]=o,e}}Ma.prototype.bytesPerElement=12,Qs(Ma,"StructArrayLayout6i12");class Ia extends ca{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer);}emplaceBack(e,t,r,n,i,s,o,a,l,u,c,h){const p=this.length;return this.resize(p+1),this.emplace(p,e,t,r,n,i,s,o,a,l,u,c,h)}emplace(e,t,r,n,i,s,o,a,l,u,c,h,p){const d=12*e;return this.int16[d+0]=t,this.int16[d+1]=r,this.int16[d+2]=n,this.int16[d+3]=i,this.uint16[d+4]=s,this.uint16[d+5]=o,this.uint16[d+6]=a,this.uint16[d+7]=l,this.int16[d+8]=u,this.int16[d+9]=c,this.int16[d+10]=h,this.int16[d+11]=p,e}}Ia.prototype.bytesPerElement=24,Qs(Ia,"StructArrayLayout4i4ui4i24");class Sa extends ca{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer);}emplaceBack(e,t,r,n,i,s){const o=this.length;return this.resize(o+1),this.emplace(o,e,t,r,n,i,s)}emplace(e,t,r,n,i,s,o){const a=10*e,l=5*e;return this.int16[a+0]=t,this.int16[a+1]=r,this.int16[a+2]=n,this.float32[l+2]=i,this.float32[l+3]=s,this.float32[l+4]=o,e}}Sa.prototype.bytesPerElement=20,Qs(Sa,"StructArrayLayout3i3f20");class Pa extends ca{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer);}emplaceBack(e,t,r,n){const i=this.length;return this.resize(i+1),this.emplace(i,e,t,r,n)}emplace(e,t,r,n,i){const s=4*e;return this.float32[s+0]=t,this.float32[s+1]=r,this.float32[s+2]=n,this.float32[s+3]=i,e}}Pa.prototype.bytesPerElement=16,Qs(Pa,"StructArrayLayout4f16");class ka extends ca{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer);}emplaceBack(e){const t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.uint32[1*e+0]=t,e}}ka.prototype.bytesPerElement=4,Qs(ka,"StructArrayLayout1ul4");class za extends ca{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer);}emplaceBack(e,t){const r=this.length;return this.resize(r+1),this.emplace(r,e,t)}emplace(e,t,r){const n=2*e;return this.uint16[n+0]=t,this.uint16[n+1]=r,e}}za.prototype.bytesPerElement=4,Qs(za,"StructArrayLayout2ui4");class Ta extends ca{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer);}emplaceBack(e,t,r,n,i,s,o,a,l,u,c,h,p){const d=this.length;return this.resize(d+1),this.emplace(d,e,t,r,n,i,s,o,a,l,u,c,h,p)}emplace(e,t,r,n,i,s,o,a,l,u,c,h,p,d){const f=20*e,m=10*e;return this.int16[f+0]=t,this.int16[f+1]=r,this.int16[f+2]=n,this.int16[f+3]=i,this.int16[f+4]=s,this.float32[m+3]=o,this.float32[m+4]=a,this.float32[m+5]=l,this.float32[m+6]=u,this.int16[f+14]=c,this.uint32[m+8]=h,this.uint16[f+18]=p,this.uint16[f+19]=d,e}}Ta.prototype.bytesPerElement=40,Qs(Ta,"StructArrayLayout5i4f1i1ul2ui40");class Ba extends ca{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer);}emplaceBack(e,t,r,n,i,s,o){const a=this.length;return this.resize(a+1),this.emplace(a,e,t,r,n,i,s,o)}emplace(e,t,r,n,i,s,o,a){const l=8*e;return this.int16[l+0]=t,this.int16[l+1]=r,this.int16[l+2]=n,this.int16[l+4]=i,this.int16[l+5]=s,this.int16[l+6]=o,this.int16[l+7]=a,e}}Ba.prototype.bytesPerElement=16,Qs(Ba,"StructArrayLayout3i2i2i16");class Ea extends ca{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer);}emplaceBack(e,t,r,n,i){const s=this.length;return this.resize(s+1),this.emplace(s,e,t,r,n,i)}emplace(e,t,r,n,i,s){const o=4*e,a=8*e;return this.float32[o+0]=t,this.float32[o+1]=r,this.float32[o+2]=n,this.int16[a+6]=i,this.int16[a+7]=s,e}}Ea.prototype.bytesPerElement=16,Qs(Ea,"StructArrayLayout2f1f2i16");class Va extends ca{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer);}emplaceBack(e,t,r,n,i,s){const o=this.length;return this.resize(o+1),this.emplace(o,e,t,r,n,i,s)}emplace(e,t,r,n,i,s,o){const a=20*e,l=5*e;return this.uint8[a+0]=t,this.uint8[a+1]=r,this.float32[l+1]=n,this.float32[l+2]=i,this.float32[l+3]=s,this.float32[l+4]=o,e}}Va.prototype.bytesPerElement=20,Qs(Va,"StructArrayLayout2ub4f20");class Fa extends ca{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer);}emplaceBack(e,t,r){const n=this.length;return this.resize(n+1),this.emplace(n,e,t,r)}emplace(e,t,r,n){const i=3*e;return this.uint16[i+0]=t,this.uint16[i+1]=r,this.uint16[i+2]=n,e}}Fa.prototype.bytesPerElement=6,Qs(Fa,"StructArrayLayout3ui6");class Ca extends ca{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer);}emplaceBack(e,t,r,n,i,s,o,a,l,u,c,h,p,d,f,m,y,g,x,v,b){const w=this.length;return this.resize(w+1),this.emplace(w,e,t,r,n,i,s,o,a,l,u,c,h,p,d,f,m,y,g,x,v,b)}emplace(e,t,r,n,i,s,o,a,l,u,c,h,p,d,f,m,y,g,x,v,b,w){const _=30*e,A=15*e,M=60*e;return this.int16[_+0]=t,this.int16[_+1]=r,this.int16[_+2]=n,this.float32[A+2]=i,this.float32[A+3]=s,this.uint16[_+8]=o,this.uint16[_+9]=a,this.uint32[A+5]=l,this.uint32[A+6]=u,this.uint32[A+7]=c,this.uint16[_+16]=h,this.uint16[_+17]=p,this.uint16[_+18]=d,this.float32[A+10]=f,this.float32[A+11]=m,this.uint8[M+48]=y,this.uint8[M+49]=g,this.uint8[M+50]=x,this.uint32[A+13]=v,this.int16[_+28]=b,this.uint8[M+58]=w,e}}Ca.prototype.bytesPerElement=60,Qs(Ca,"StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60");class Da extends ca{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer);}emplaceBack(e,t,r,n,i,s,o,a,l,u,c,h,p,d,f,m,y,g,x,v,b,w,_,A,M,I,S,P,k,z,T,B,E){const V=this.length;return this.resize(V+1),this.emplace(V,e,t,r,n,i,s,o,a,l,u,c,h,p,d,f,m,y,g,x,v,b,w,_,A,M,I,S,P,k,z,T,B,E)}emplace(e,t,r,n,i,s,o,a,l,u,c,h,p,d,f,m,y,g,x,v,b,w,_,A,M,I,S,P,k,z,T,B,E,V){const F=20*e,C=40*e,D=80*e;return this.float32[F+0]=t,this.float32[F+1]=r,this.int16[C+4]=n,this.int16[C+5]=i,this.int16[C+6]=s,this.int16[C+7]=o,this.int16[C+8]=a,this.int16[C+9]=l,this.int16[C+10]=u,this.int16[C+11]=c,this.int16[C+12]=h,this.uint16[C+13]=p,this.uint16[C+14]=d,this.uint16[C+15]=f,this.uint16[C+16]=m,this.uint16[C+17]=y,this.uint16[C+18]=g,this.uint16[C+19]=x,this.uint16[C+20]=v,this.uint16[C+21]=b,this.uint16[C+22]=w,this.uint16[C+23]=_,this.uint16[C+24]=A,this.uint16[C+25]=M,this.uint16[C+26]=I,this.uint16[C+27]=S,this.uint32[F+14]=P,this.float32[F+15]=k,this.float32[F+16]=z,this.float32[F+17]=T,this.float32[F+18]=B,this.uint8[D+76]=E,this.uint16[C+39]=V,e}}Da.prototype.bytesPerElement=80,Qs(Da,"StructArrayLayout2f9i15ui1ul4f1ub1ui80");class Ra extends ca{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer);}emplaceBack(e,t,r,n,i,s){const o=this.length;return this.resize(o+1),this.emplace(o,e,t,r,n,i,s)}emplace(e,t,r,n,i,s,o){const a=6*e;return this.float32[a+0]=t,this.float32[a+1]=r,this.float32[a+2]=n,this.float32[a+3]=i,this.float32[a+4]=s,this.float32[a+5]=o,e}}Ra.prototype.bytesPerElement=24,Qs(Ra,"StructArrayLayout6f24");class La extends ca{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer);}emplaceBack(e,t,r,n,i){const s=this.length;return this.resize(s+1),this.emplace(s,e,t,r,n,i)}emplace(e,t,r,n,i,s){const o=5*e;return this.float32[o+0]=t,this.float32[o+1]=r,this.float32[o+2]=n,this.float32[o+3]=i,this.float32[o+4]=s,e}}La.prototype.bytesPerElement=20,Qs(La,"StructArrayLayout5f20");class Oa extends ca{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer);}emplaceBack(e,t,r,n,i,s,o){const a=this.length;return this.resize(a+1),this.emplace(a,e,t,r,n,i,s,o)}emplace(e,t,r,n,i,s,o,a){const l=7*e;return this.float32[l+0]=t,this.float32[l+1]=r,this.float32[l+2]=n,this.float32[l+3]=i,this.float32[l+4]=s,this.float32[l+5]=o,this.float32[l+6]=a,e}}Oa.prototype.bytesPerElement=28,Qs(Oa,"StructArrayLayout7f28");class Ua extends ca{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer);}emplaceBack(e,t,r,n,i,s,o,a,l,u,c){const h=this.length;return this.resize(h+1),this.emplace(h,e,t,r,n,i,s,o,a,l,u,c)}emplace(e,t,r,n,i,s,o,a,l,u,c,h){const p=11*e;return this.float32[p+0]=t,this.float32[p+1]=r,this.float32[p+2]=n,this.float32[p+3]=i,this.float32[p+4]=s,this.float32[p+5]=o,this.float32[p+6]=a,this.float32[p+7]=l,this.float32[p+8]=u,this.float32[p+9]=c,this.float32[p+10]=h,e}}Ua.prototype.bytesPerElement=44,Qs(Ua,"StructArrayLayout11f44");class Na extends ca{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer);}emplaceBack(e,t,r,n,i,s,o,a,l){const u=this.length;return this.resize(u+1),this.emplace(u,e,t,r,n,i,s,o,a,l)}emplace(e,t,r,n,i,s,o,a,l,u){const c=9*e;return this.float32[c+0]=t,this.float32[c+1]=r,this.float32[c+2]=n,this.float32[c+3]=i,this.float32[c+4]=s,this.float32[c+5]=o,this.float32[c+6]=a,this.float32[c+7]=l,this.float32[c+8]=u,e}}Na.prototype.bytesPerElement=36,Qs(Na,"StructArrayLayout9f36");class ja extends ca{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer);}emplaceBack(e,t){const r=this.length;return this.resize(r+1),this.emplace(r,e,t)}emplace(e,t,r){const n=2*e;return this.float32[n+0]=t,this.float32[n+1]=r,e}}ja.prototype.bytesPerElement=8,Qs(ja,"StructArrayLayout2f8");class $a extends ca{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer);}emplaceBack(e,t,r,n){const i=this.length;return this.resize(i+1),this.emplace(i,e,t,r,n)}emplace(e,t,r,n,i){const s=6*e;return this.uint32[3*e+0]=t,this.uint16[s+2]=r,this.uint16[s+3]=n,this.uint16[s+4]=i,e}}$a.prototype.bytesPerElement=12,Qs($a,"StructArrayLayout1ul3ui12");class Ga extends ca{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer);}emplaceBack(e){const t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.uint16[1*e+0]=t,e}}Ga.prototype.bytesPerElement=2,Qs(Ga,"StructArrayLayout1ui2");class qa extends ca{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer);}emplaceBack(e,t,r,n,i,s,o,a,l,u,c,h,p,d,f,m){const y=this.length;return this.resize(y+1),this.emplace(y,e,t,r,n,i,s,o,a,l,u,c,h,p,d,f,m)}emplace(e,t,r,n,i,s,o,a,l,u,c,h,p,d,f,m,y){const g=16*e;return this.float32[g+0]=t,this.float32[g+1]=r,this.float32[g+2]=n,this.float32[g+3]=i,this.float32[g+4]=s,this.float32[g+5]=o,this.float32[g+6]=a,this.float32[g+7]=l,this.float32[g+8]=u,this.float32[g+9]=c,this.float32[g+10]=h,this.float32[g+11]=p,this.float32[g+12]=d,this.float32[g+13]=f,this.float32[g+14]=m,this.float32[g+15]=y,e}}qa.prototype.bytesPerElement=64,Qs(qa,"StructArrayLayout16f64");class Ha extends ca{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer);}emplaceBack(e,t,r,n,i,s,o){const a=this.length;return this.resize(a+1),this.emplace(a,e,t,r,n,i,s,o)}emplace(e,t,r,n,i,s,o,a){const l=10*e,u=5*e;return this.uint16[l+0]=t,this.uint16[l+1]=r,this.uint16[l+2]=n,this.uint16[l+3]=i,this.float32[u+2]=s,this.float32[u+3]=o,this.float32[u+4]=a,e}}Ha.prototype.bytesPerElement=20,Qs(Ha,"StructArrayLayout4ui3f20");class Xa extends ca{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer);}emplaceBack(e){const t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.int16[1*e+0]=t,e}}Xa.prototype.bytesPerElement=2,Qs(Xa,"StructArrayLayout1i2");class Za extends ca{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer);}emplaceBack(e){const t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.uint8[1*e+0]=t,e}}Za.prototype.bytesPerElement=1,Qs(Za,"StructArrayLayout1ub1");class Wa extends ua{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.int16[this._pos2+3]}get tileAnchorY(){return this._structArray.int16[this._pos2+4]}get x1(){return this._structArray.float32[this._pos4+3]}get y1(){return this._structArray.float32[this._pos4+4]}get x2(){return this._structArray.float32[this._pos4+5]}get y2(){return this._structArray.float32[this._pos4+6]}get padding(){return this._structArray.int16[this._pos2+14]}get featureIndex(){return this._structArray.uint32[this._pos4+8]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+18]}get bucketIndex(){return this._structArray.uint16[this._pos2+19]}}Wa.prototype.size=40;class Ya extends Ta{get(e){return new Wa(this,e)}}Qs(Ya,"CollisionBoxArray");class Ka extends ua{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.float32[this._pos4+2]}get tileAnchorY(){return this._structArray.float32[this._pos4+3]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+8]}get numGlyphs(){return this._structArray.uint16[this._pos2+9]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+5]}get lineStartIndex(){return this._structArray.uint32[this._pos4+6]}get lineLength(){return this._structArray.uint32[this._pos4+7]}get segment(){return this._structArray.uint16[this._pos2+16]}get lowerSize(){return this._structArray.uint16[this._pos2+17]}get upperSize(){return this._structArray.uint16[this._pos2+18]}get lineOffsetX(){return this._structArray.float32[this._pos4+10]}get lineOffsetY(){return this._structArray.float32[this._pos4+11]}get writingMode(){return this._structArray.uint8[this._pos1+48]}get placedOrientation(){return this._structArray.uint8[this._pos1+49]}set placedOrientation(e){this._structArray.uint8[this._pos1+49]=e;}get hidden(){return this._structArray.uint8[this._pos1+50]}set hidden(e){this._structArray.uint8[this._pos1+50]=e;}get crossTileID(){return this._structArray.uint32[this._pos4+13]}set crossTileID(e){this._structArray.uint32[this._pos4+13]=e;}get associatedIconIndex(){return this._structArray.int16[this._pos2+28]}get flipState(){return this._structArray.uint8[this._pos1+58]}set flipState(e){this._structArray.uint8[this._pos1+58]=e;}}Ka.prototype.size=60;class Ja extends Ca{get(e){return new Ka(this,e)}}Qs(Ja,"PlacedSymbolArray");class Qa extends ua{get tileAnchorX(){return this._structArray.float32[this._pos4+0]}get tileAnchorY(){return this._structArray.float32[this._pos4+1]}get projectedAnchorX(){return this._structArray.int16[this._pos2+4]}get projectedAnchorY(){return this._structArray.int16[this._pos2+5]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+6]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+7]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+8]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+9]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+10]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+11]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+12]}get key(){return this._structArray.uint16[this._pos2+13]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+14]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+15]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+16]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+17]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+18]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+19]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+20]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+21]}get featureIndex(){return this._structArray.uint16[this._pos2+22]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+23]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+24]}get numIconVertices(){return this._structArray.uint16[this._pos2+25]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+26]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+27]}get crossTileID(){return this._structArray.uint32[this._pos4+14]}set crossTileID(e){this._structArray.uint32[this._pos4+14]=e;}get textOffset0(){return this._structArray.float32[this._pos4+15]}get textOffset1(){return this._structArray.float32[this._pos4+16]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+17]}get zOffset(){return this._structArray.float32[this._pos4+18]}set zOffset(e){this._structArray.float32[this._pos4+18]=e;}get hasIconTextFit(){return this._structArray.uint8[this._pos1+76]}get elevationFeatureIndex(){return this._structArray.uint16[this._pos2+39]}}Qa.prototype.size=80;class el extends Da{get(e){return new Qa(this,e)}}Qs(el,"SymbolInstanceArray");class tl extends ya{getoffsetX(e){return this.float32[1*e+0]}}Qs(tl,"GlyphOffsetArray");class rl extends da{getx(e){return this.int16[2*e+0]}gety(e){return this.int16[2*e+1]}}Qs(rl,"SymbolLineVertexArray");class nl extends ua{get featureIndex(){return this._structArray.uint32[this._pos4+0]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+2]}get bucketIndex(){return this._structArray.uint16[this._pos2+3]}get layoutVertexArrayOffset(){return this._structArray.uint16[this._pos2+4]}}nl.prototype.size=12;class il extends $a{get(e){return new nl(this,e)}}Qs(il,"FeatureIndexArray");class sl extends za{geta_centroid_pos0(e){return this.uint16[2*e+0]}geta_centroid_pos1(e){return this.uint16[2*e+1]}}Qs(sl,"FillExtrusionCentroidArray");class ol extends ua{get a_join_normal_inside0(){return this._structArray.int16[this._pos2+0]}get a_join_normal_inside1(){return this._structArray.int16[this._pos2+1]}get a_join_normal_inside2(){return this._structArray.int16[this._pos2+2]}}ol.prototype.size=6;class al extends fa{get(e){return new ol(this,e)}}Qs(al,"FillExtrusionWallArray");const ll=ha([{name:"a_pos",components:2,type:"Int16"}],4),ul=ha([{name:"a_circle_z_offset",components:1,type:"Float32"}],4),cl=ha([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]);class hl{constructor(e=[]){this.segments=e;}_prepareSegment(e,t,r,n){let i=this.segments[this.segments.length-1];return e>hl.MAX_VERTEX_ARRAY_LENGTH&&Xe(`Max vertices per segment is ${hl.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}`),(!i||i.vertexLength+e>hl.MAX_VERTEX_ARRAY_LENGTH||i.sortKey!==n)&&(i={vertexOffset:t,primitiveOffset:r,vertexLength:0,primitiveLength:0},void 0!==n&&(i.sortKey=n),this.segments.push(i)),i}prepareSegment(e,t,r,n){return this._prepareSegment(e,t.length,r.length,n)}get(){return this.segments}destroy(){for(const e of this.segments)for(const t in e.vaos)e.vaos[t].destroy();}static simpleSegment(e,t,r,n){return new hl([{vertexOffset:e,primitiveOffset:t,vertexLength:r,primitiveLength:n,vaos:{},sortKey:0}])}}function pl(e,t){return 256*(e=Fe(Math.floor(e),0,255))+Fe(Math.floor(t),0,255)}hl.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Qs(hl,"SegmentVector");const dl=ha([{name:"a_pattern",components:4,type:"Uint16"},{name:"a_pixel_ratio",components:1,type:"Float32"}]),fl=ha([{name:"a_pattern_b",components:4,type:"Uint16"}]),ml=ha([{name:"a_dash",components:4,type:"Uint16"}]);class yl{constructor(){this.ids=[],this.uniqueIds=[],this.positions=[],this.indexed=!1;}add(e,t,r,n){this.ids.push(gl(e)),this.positions.push(t,r,n);}eachPosition(e,t){const r=gl(e);let n=0,i=this.ids.length-1;for(;n>1;this.ids[e]>=r?i=e:n=e+1;}for(;this.ids[n]===r;)t(this.positions[3*n],this.positions[3*n+1],this.positions[3*n+2]),n++;}static serialize(e,t){const r=new Float64Array(e.ids),n=new Uint32Array(e.positions);return xl(r,n,0,r.length-1),t&&(t.add(r.buffer),t.add(n.buffer)),{ids:r,positions:n}}static deserialize(e){const t=new yl;let r;t.ids=e.ids,t.positions=e.positions;for(const e of t.ids)e!==r&&t.uniqueIds.push(e),r=e;return t.indexed=!0,t}}function gl(e){const t=+e;return Number.isSafeInteger(t)?t:Jt(String(e))}function xl(e,t,r,n){for(;r>1];let s=r-1,o=n+1;for(;;){do{s++;}while(e[s]i);if(s>=o)break;vl(e,s,o),vl(t,3*s,3*o),vl(t,3*s+1,3*o+1),vl(t,3*s+2,3*o+2);}o-r`u_${e}`)),this.type=r,this.context=n;}setUniform(e,t,r,n,i){const s=n.constantOr(this.value);t.set(e,i,s instanceof lr?s.toPremultipliedRenderColor(this.lutExpression&&"constant"===this.lutExpression.kind&&"none"===this.lutExpression.value?null:this.context.lut):s);}getBinding(e,t){return "color"===this.type?new Sl(e):new _l(e)}}class Cl{constructor(e,t){this.uniformNames=t.map((e=>`u_${e}`)),this.pattern=null,this.patternTransition=null,this.pixelRatio=1;}setConstantPatternPositions(e,t){this.pixelRatio=e.pixelRatio||1,this.pattern=e.tl.concat(e.br),this.patternTransition=t?t.tl.concat(t.br):this.pattern;}setUniform(e,t,r,n,i){let s=null;"u_pattern"!==i&&"u_dash"!==i||(s=this.pattern),"u_pattern_b"===i&&(s=this.patternTransition),"u_pixel_ratio"===i&&(s=this.pixelRatio),s&&t.set(e,i,s);}getBinding(e,t){return "u_pattern"===t||"u_pattern_b"===t||"u_dash"===t?new Il(e):new _l(e)}}class Dl{constructor(e,t,r,n){this.expression=e,this.type=r,this.maxValue=0,this.paintVertexAttributes=t.map((e=>({name:`a_${e}`,type:"Float32",components:"color"===r?2:1,offset:0}))),this.paintVertexArray=new n;}populatePaintArray(e,t,r,n,i,s,o,a){const l=this.paintVertexArray.length,u="composite"===this.expression.kind||"source"===this.expression.kind?this.expression.evaluate(new Io(0,{brightness:s,worldview:a}),t,{},i,n,o):"constant"===this.expression.kind&&this.expression.value,c=Vl(this.lutExpression,t,{},n,i,s,o,a);this.paintVertexArray.resize(e),this._setPaintValue(l,e,u,c?null:this.context.lut);}updatePaintArray(e,t,r,n,i,s,o,a){const l="composite"===this.expression.kind||"source"===this.expression.kind?this.expression.evaluate({zoom:0,brightness:o,worldview:a},r,n,void 0,i):"constant"===this.expression.kind&&this.expression.value,u=Vl(this.lutExpression,r,n,i,void 0,o,void 0,a);this._setPaintValue(e,t,l,u?null:this.context.lut);}_setPaintValue(e,t,r,n){if("color"===this.type){const i=El(r.toPremultipliedRenderColor(n));for(let r=e;r`u_${e}_t`)),this.type=r,this.useIntegerZoom=n,this.context=i,this.maxValue=0,this.paintVertexAttributes=t.map((e=>({name:`a_${e}`,type:"Float32",components:"color"===r?4:2,offset:0}))),this.paintVertexArray=new s;}populatePaintArray(e,t,r,n,i,s,o,a){const l=this.expression.evaluate(new Io(this.context.zoom,{brightness:s,worldview:a}),t,{},i,n,o),u=this.expression.evaluate(new Io(this.context.zoom+1,{brightness:s,worldview:a}),t,{},i,n,o),c=Vl(this.lutExpression,t,{},n,i,s,o,a),h=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(h,e,l,u,c?null:this.context.lut);}updatePaintArray(e,t,r,n,i,s,o,a){const l=this.expression.evaluate({zoom:this.context.zoom,brightness:o,worldview:a},r,n,void 0,i),u=this.expression.evaluate({zoom:this.context.zoom+1,brightness:o,worldview:a},r,n,void 0,i),c=Vl(this.lutExpression,r,n,i,void 0,o,void 0,a);this._setPaintValue(e,t,l,u,c?null:this.context.lut);}_setPaintValue(e,t,r,n,i){if("color"===this.type){const n=El(r.toPremultipliedRenderColor(i)),s=El(r.toPremultipliedRenderColor(i));for(let r=e;r!0)){this.binders={},this._buffers=[],this.context=t;const n=[];for(const i in e.paint._values){const s=e.paint.get(i);if(i.endsWith("-use-theme"))continue;if(!r(i))continue;if(!(s instanceof Eo&&ks(s.property.specification)))continue;const o=jl(i,e.type),a=s.value,l=s.property.specification.type,u=!!s.property.useIntegerZoom,c="line-dasharray"===i||i.endsWith("pattern"),h=e.paint.get(`${i}-use-theme`),p="line-dasharray"===i&&"constant"!==e.layout.get("line-cap").value.kind||h&&"constant"!==h.value.kind;if("constant"!==a.kind||p)if("source"===a.kind||p||c){const t=ql(i,l,"source");this.binders[i]=c?new Ll(a,o,l,t,e.id):new Dl(a,o,l,t),n.push(`/a_${i}`);}else {const e=ql(i,l,"composite");this.binders[i]=new Rl(a,o,l,u,t,e),n.push(`/z_${i}`);}else this.binders[i]=c?new Cl(a.value,o):new Fl(a.value,o,l,t),n.push(`/u_${i}`);h&&(this.binders[i].lutExpression=h.value);}this.cacheKey=n.sort().join("");}getMaxValue(e){const t=this.binders[e];return t instanceof Dl||t instanceof Rl?t.maxValue:0}populatePaintArrays(e,t,r,n,i,s,o,a){for(const l in this.binders){const u=this.binders[l];u.context=this.context,(u instanceof Dl||u instanceof Rl||u instanceof Ll)&&u.populatePaintArray(e,t,r,n,i,s,o,a);}}setConstantPatternPositions(e,t){for(const r in this.binders){const n=this.binders[r];n instanceof Cl&&n.setConstantPatternPositions(e,t);}}getPatternTransitionVertexBuffer(e){const t=this.binders[e];return t instanceof Ll?t.paintTransitionVertexBuffer:null}updatePaintArrays(e,t,r,n,i,s,o,a,l,u){let c=!1;const h=Object.keys(e),p=0!==h.length&&!a,d=p?h:t.uniqueIds;this.context.lut=i.lut;for(const a in this.binders){const h=this.binders[a];if(h.context=this.context,(h instanceof Dl||h instanceof Rl||h instanceof Ll)&&h.expression&&h.expression.kind&&"constant"!==h.expression.kind&&(!0===h.expression.isStateDependent||!1===h.expression.isLightConstant)){const f=i.paint.get(a);h.expression=f.value;for(const r of d){const i=e[r.toString()];t.eachPosition(r,((e,t,r)=>{const a=n.feature(e);h.updatePaintArray(t,r,a,i,s,o,l,u);}));}if(!p)for(const t of r.uniqueIds){const i=e[t.toString()];r.eachPosition(t,((e,t,r)=>{const a=n.feature(e);h.updatePaintArray(t,r,a,i,s,o,l,u);}));}c=!0;}}return c}defines(){const e=[];for(const t in this.binders){const r=this.binders[t];(r instanceof Fl||r instanceof Cl)&&e.push(...r.uniformNames.map((e=>`#define HAS_UNIFORM_${e}`)));}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e){const t=[];for(const r in this.binders){const n=this.binders[r];if(n instanceof Fl||n instanceof Cl||n instanceof Rl)for(const i of n.uniformNames)t.push({name:i,property:r,binding:n.getBinding(e,i)});}return t}setUniforms(e,t,r,n,i){for(const{name:t,property:s,binding:o}of r)this.binders[s].setUniform(e,o,i,n.get(s),t);}updatePaintBuffers(){this._buffers=[];for(const e in this.binders){const t=this.binders[e];(t instanceof Dl||t instanceof Rl||t instanceof Ll)&&t.paintVertexBuffer&&this._buffers.push(t.paintVertexBuffer),t instanceof Ll&&t.paintTransitionVertexBuffer&&this._buffers.push(t.paintTransitionVertexBuffer);}}upload(e){for(const t in this.binders){const r=this.binders[t];(r instanceof Dl||r instanceof Rl||r instanceof Ll)&&r.upload(e);}this.updatePaintBuffers();}destroy(){for(const e in this.binders){const t=this.binders[e];(t instanceof Dl||t instanceof Rl||t instanceof Ll)&&t.destroy();}}}class Ul{constructor(e,t,r=(()=>!0)){this.programConfigurations={};for(const n of e)this.programConfigurations[n.id]=new Ol(n,t,r);this.needsUpload=!1,this._featureMap=new yl,this._featureMapWithoutIds=new yl,this._bufferOffset=0,this._idlessCounter=0;}populatePaintArrays(e,t,r,n,i,s,o,a,l){for(const r in this.programConfigurations)this.programConfigurations[r].populatePaintArrays(e,t,n,i,s,o,a,l);void 0!==t.id?this._featureMap.add(t.id,r,this._bufferOffset,e):(this._featureMapWithoutIds.add(this._idlessCounter,r,this._bufferOffset,e),this._idlessCounter+=1),this._bufferOffset=e,this.needsUpload=!0;}updatePaintArrays(e,t,r,n,i,s,o,a){for(const l of r)this.needsUpload=this.programConfigurations[l.id].updatePaintArrays(e,this._featureMap,this._featureMapWithoutIds,t,l,n,i,s,o||0,a)||this.needsUpload;}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(const t in this.programConfigurations)this.programConfigurations[t].upload(e);this.needsUpload=!1;}}destroy(){for(const e in this.programConfigurations)this.programConfigurations[e].destroy();}}const Nl={"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-occlusion-opacity":["occlusion_opacity"],"icon-occlusion-opacity":["occlusion_opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-emissive-strength":["emissive_strength"],"icon-emissive-strength":["emissive_strength"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"symbol-z-offset":["z_offset"],"line-gap-width":["gapwidth"],"line-pattern":["pattern","pixel_ratio","pattern_b"],"fill-pattern":["pattern","pixel_ratio","pattern_b"],"fill-extrusion-pattern":["pattern","pixel_ratio","pattern_b"],"line-dasharray":["dash"],"fill-bridge-guard-rail-color":["structure_color"],"fill-tunnel-structure-color":["structure_color"]};function jl(e,t){return Nl[e]||[e.replace(`${t}-`,"").replace(/-/g,"_")]}const $l={"line-pattern":{source:_a,composite:_a},"fill-pattern":{source:_a,composite:_a},"fill-extrusion-pattern":{source:_a,composite:_a},"line-dasharray":{source:Aa,composite:Aa}},Gl={color:{source:ja,composite:Pa},number:{source:ya,composite:ja}};function ql(e,t,r){const n=$l[e];return n&&n[r]||Gl[t][r]}Qs(Fl,"ConstantBinder"),Qs(Cl,"PatternConstantBinder"),Qs(Dl,"SourceExpressionBinder"),Qs(Ll,"PatternCompositeBinder"),Qs(Rl,"CompositeExpressionBinder"),Qs(Ol,"ProgramConfiguration",{omit:["_buffers"]}),Qs(Ul,"ProgramConfigurationSet");const Hl=Un/Math.PI/2,Xl=5,Zl=6,Wl=16383,Yl=64,Kl=[Yl,32,16],Jl=-Hl,Ql=Hl;function eu(e,t,r,n=Hl){return r=ke(r),[e*Math.sin(r)*n,-t*n,e*Math.cos(r)*n]}function tu(e,t,r){return eu(Math.cos(ke(e)),Math.sin(ke(e)),t,r)}const ru=6371008.8,nu=2*Math.PI*ru;class iu{constructor(e,t){if(isNaN(e)||isNaN(t))throw new Error(`Invalid LngLat object: (${e}, ${t})`);if(this.lng=+e,this.lat=+t,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new iu(De(this.lng,-180,180),this.lat)}toArray(){return [this.lng,this.lat]}toString(){return `LngLat(${this.lng}, ${this.lat})`}distanceTo(e){const t=Math.PI/180,r=this.lat*t,n=e.lat*t,i=Math.sin(r)*Math.sin(n)+Math.cos(r)*Math.cos(n)*Math.cos((e.lng-this.lng)*t);return ru*Math.acos(Math.min(i,1))}toBounds(e=0){const t=360*e/40075017,r=t/Math.cos(Math.PI/180*this.lat);return new su({lng:this.lng-r,lat:this.lat-t},{lng:this.lng+r,lat:this.lat+t})}toEcef(e){return tu(this.lat,this.lng,Hl+e*Hl/ru)}static convert(e){if(e instanceof iu)return e;if(Array.isArray(e)&&(2===e.length||3===e.length))return new iu(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&"object"==typeof e&&null!==e)return new iu(Number("lng"in e?e.lng:e.lon),Number(e.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, an object {lon: , lat: }, or an array of [, ]")}}class su{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 iu?new iu(e.lng,e.lat):iu.convert(e),this}setSouthWest(e){return this._sw=e instanceof iu?new iu(e.lng,e.lat):iu.convert(e),this}extend(e){const t=this._sw,r=this._ne;let n,i;if(e instanceof iu)n=e,i=e;else {if(!(e instanceof su))return Array.isArray(e)?4===e.length||e.every(Array.isArray)?this.extend(su.convert(e)):this.extend(iu.convert(e)):"object"==typeof e&&null!==e&&e.hasOwnProperty("lat")&&(e.hasOwnProperty("lon")||e.hasOwnProperty("lng"))?this.extend(iu.convert(e)):this;if(n=e._sw,i=e._ne,!n||!i)return this}return t||r?(t.lng=Math.min(n.lng,t.lng),t.lat=Math.min(n.lat,t.lat),r.lng=Math.max(i.lng,r.lng),r.lat=Math.max(i.lat,r.lat)):(this._sw=new iu(n.lng,n.lat),this._ne=new iu(i.lng,i.lat)),this}getCenter(){return new iu((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 iu(this.getWest(),this.getNorth())}getSouthEast(){return new iu(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return [this._sw.toArray(),this._ne.toArray()]}toString(){return `LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return !(this._sw&&this._ne)}contains(e){const{lng:t,lat:r}=iu.convert(e);let n=this._sw.lng<=t&&t<=this._ne.lng;return this._sw.lng>this._ne.lng&&(n=this._sw.lng>=t&&t>=this._ne.lng),this._sw.lat<=r&&r<=this._ne.lat&&n}static convert(e){if(e)return e instanceof su?e:new su(e)}}const ou=0,au=25.5;function lu(e){return nu*Math.cos(e*Math.PI/180)}function uu(e){return (180+e)/360}function cu(e){return (180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}function hu(e,t){return e/lu(t)}function pu(e){return 360*e-180}function du(e){return 360/Math.PI*Math.atan(Math.exp((180-360*e)*Math.PI/180))-90}function fu(e,t){return e*lu(du(t))}const mu=85.051129;function yu(e){return Math.cos(ke(Fe(e,-mu,mu)))}function gu(e,t){const r=Fe(t,ou,au),n=Math.pow(2,r);return yu(e)*nu/(512*n)}function xu(e){return 1/Math.cos(e*Math.PI/180)}function vu(e,t=0){const r=Math.exp(Math.PI*(1-(e.y+t/Un)/(1<=l?(wu(e,t,r,u,c,s,h,a,l),wu(e,u,c,n,i,h,o,a,l)):e.push(o);}function _u(e,t,r){let n=e[0],i=n.x,s=n.y;t(n);const o=[n];for(let a=1;ae.x+1||ne.y+1)&&Xe("Geometry exceeds allowed extent, reduce your vector tile buffer size"),e}function ku(e,t,r){const n=e.loadGeometry(),i=e.extent,s=Un/i;if(t&&r&&r.projection.isReprojectedInTileSpace){const s=1<{const r=pu((t.x+e.x/i)/s),n=du((t.y+e.y/i)/s),c=u.project(r,n);e.x=(c.x*o-a)*i,e.y=(c.y*o-l)*i;};for(let t=0;t=i||r.y<0||r.y>=i||(c(r),e.push(r));n[t]=e;}}for(const e of n)for(const t of e)Pu(t,s);return n}function zu(e,t){return {type:e.type,id:e.id,properties:e.properties,geometry:t?ku(e):[]}}class Tu{constructor(e,t,r,n,i){this.properties={},this.extent=r,this.type=0,this.id=void 0,this._pbf=e,this._geometry=-1,this._keys=n,this._values=i,e.readFields(Bu,this,t);}loadGeometry(){const e=this._pbf;e.pos=this._geometry;const t=e.readVarint()+e.pos,r=[];let n,i=1,s=0,o=0,a=0;for(;e.pos>3;}if(s--,1===i||2===i)o+=e.readSVarint(),a+=e.readSVarint(),1===i&&(n&&r.push(n),n=[]),n&&n.push(new Me(o,a));else {if(7!==i)throw new Error(`unknown command ${i}`);n&&n.push(n[0].clone());}}return n&&r.push(n),r}bbox(){const e=this._pbf;e.pos=this._geometry;const t=e.readVarint()+e.pos;let r=1,n=0,i=0,s=0,o=1/0,a=-1/0,l=1/0,u=-1/0;for(;e.pos>3;}if(n--,1===r||2===r)i+=e.readSVarint(),s+=e.readSVarint(),ia&&(a=i),su&&(u=s);else if(7!==r)throw new Error(`unknown command ${r}`)}return [o,l,a,u]}toGeoJSON(e,t,r){const n=this.extent*Math.pow(2,r),i=this.extent*e,s=this.extent*t,o=this.loadGeometry();function a(e){return [360*(e.x+i)/n-180,360/Math.PI*Math.atan(Math.exp((1-2*(e.y+s)/n)*Math.PI))-90]}function l(e){return e.map(a)}let u;if(1===this.type){const e=[];for(const t of o)e.push(t[0]);const t=l(e);u=1===e.length?{type:"Point",coordinates:t[0]}:{type:"MultiPoint",coordinates:t};}else if(2===this.type){const e=o.map(l);u=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 r=[];let n,i;for(let s=0;s=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 Tu(this._pbf,t,this.extent,this._keys,this._values)}}function Fu(e,t,r){15===e?t.version=r.readVarint():1===e?t.name=r.readString():5===e?t.extent=r.readVarint():2===e?t._features.push(r.pos):3===e?t._keys.push(r.readString()):4===e&&t._values.push(function(e){let t=null;const r=e.readVarint()+e.pos;for(;e.pos>3;t=1===r?e.readString():2===r?e.readFloat():3===r?e.readDouble():4===r?e.readVarint64():5===r?e.readVarint():6===r?e.readSVarint():7===r?e.readBoolean():null;}if(null==t)throw new Error("unknown feature value");return t}(r));}class Cu{constructor(e,t){this.layers=e.readFields(Du,{},t);}}function Du(e,t,r){if(3===e){const e=new Vu(r,r.readVarint()+r.pos);e.length&&(t[e.name]=e);}}const Ru="3d_elevation_id",Lu="level";class Ou{constructor(){this._valid=!1;}reset(e){return this.feature=e,this._valid=!0,this._geometry=e.loadGeometry(),0!==this._geometry.length&&0!==this._geometry[0].length||(this._valid=!1),this}geometry(e,t){return this._valid&&e(t(this._geometry)),this}require(e,t,r){return this.get(e,!0,t,r)}optional(e,t,r){return this.get(e,!1,t,r)}success(){return this._valid}get(e,t,r,n){const i=this.feature.properties.hasOwnProperty(e)?+this.feature.properties[e]:void 0;return this._valid&&void 0!==i&&!Number.isNaN(i)?r(n?n(i):i):t&&(this._valid=!1),this}}class Uu{constructor(e,t){this.featureFunc=e,this.vertexFunc=t;}parseFeature(e,t,r){return this.featureFunc(e,t,r)}parseVertex(e,t,r){return this.vertexFunc(e,t,r)}}const Nu=new Uu(((e,t,r)=>e.reset(t).require(Ru,(e=>{r.id=e;})).optional("fixed_height_relative",(e=>{r.constantHeight=e;}),$u.decodeRelativeHeight).geometry((e=>{r.bounds=e;}),xn).success()),((e,t,r)=>e.reset(t).require(Ru,(e=>{r.id=e;})).require("elevation_idx",(e=>{r.idx=e;})).require("extent",(e=>{r.extent=e;})).require("height_relative",(e=>{r.height=e;}),$u.decodeRelativeHeight).geometry((e=>{r.position=e;}),$u.getPoint).success())),ju=new Uu(((e,t,r)=>e.reset(t).require(Ru,(e=>{r.id=e;})).optional("fixed_height",(e=>{r.constantHeight=e;}),$u.decodeMetricHeight).geometry((e=>{r.bounds=e;}),xn).success()),((e,t,r)=>e.reset(t).require(Ru,(e=>{r.id=e;})).require("elevation_idx",(e=>{r.idx=e;})).require("extent",(e=>{r.extent=e;})).require("height",(e=>{r.height=e;}),$u.decodeMetricHeight).geometry((e=>{r.position=e;}),$u.getPoint).success()));class $u{static getPoint(e){return ce(e[0][0].x,e[0][0].y)}static decodeRelativeHeight(e){return 1e-4*e*5}static decodeMetricHeight(e){return 1e-4*e}static getVersionSchema(e){return e?"1.0.1"===e?ju:void 0:Nu}static parse(e){const t=[],r=[],n=e.length,i=new Ou;for(let s=0;s=0);if(0===s)return 0;s!==t.length&&(r=!1);}return r?2:1}function Wu(e,t){for(const r of e.projections){const n=Xu(t,e.points[0],r.axis);if(r.projection[1]n[1])return 0}return 1}function Yu(e,t){let r=0;const n=[0,0,0,0];for(let o=0;o=0&&r++;var i,s;return r}class Ku{constructor(e,t){this.points=e||new Array(8).fill([0,0,0]),this.planes=t||new Array(6).fill([0,0,0,0]),this.bounds=Ju.fromPoints(this.points),this.projections=[],this.frustumEdges=[X([],this.points[2],this.points[3]),X([],this.points[0],this.points[3]),X([],this.points[4],this.points[0]),X([],this.points[5],this.points[1]),X([],this.points[6],this.points[2]),X([],this.points[7],this.points[3])];for(const e of this.frustumEdges){const t=[0,-e[2],e[1]],r=[e[2],0,-e[0]];this.projections.push({axis:t,projection:Xu(this.points,this.points[0],t)}),this.projections.push({axis:r,projection:Xu(this.points,this.points[0],r)});}}static fromInvProjectionMatrix(e,t,r,n){const i=Math.pow(2,r),s=[[-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((r=>{const s=Q([],r,e),o=1/s[3]/t*i;return (a=s)[0]=(l=s)[0]*(u=[o,o,n?1/s[3]:o,o])[0],a[1]=l[1]*u[1],a[2]=l[2]*u[2],a[3]=l[3]*u[3],a;var a,l,u;})),o=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map((e=>{const t=L([],U([],X([],s[e[0]],s[e[1]]),X([],s[e[2]],s[e[1]]))),r=-O(t,s[e[1]]);return t.concat(r)})),a=[];for(let e=0;eo[1]||o[0]>s[1])return 0}return 1}containsPoint(e){for(const t of this.planes){const r=t[3];if(O([t[0],t[1],t[2]],e)+r<0)return !1}return !0}}class Ju{static fromPoints(e){const t=[1/0,1/0,1/0],r=[-1/0,-1/0,-1/0];for(const n of e)T(t,t,n),B(r,r,n);return new Ju(t,r)}static fromTileIdAndHeight(e,t,r){const n=1<e.max[t]||e.min[t]>this.max[t])return !1;return !0}intersectsAabbXY(e){return !(this.min[0]>e.max[0]||e.min[0]>this.max[0]||this.min[1]>e.max[1]||e.min[1]>this.max[1])}encapsulate(e){for(let t=0;t<3;t++)this.min[t]=Math.min(this.min[t],e.min[t]),this.max[t]=Math.max(this.max[t],e.max[t]);}encapsulatePoint(e){for(let t=0;t<3;t++)this.min[t]=Math.min(this.min[t],e[t]),this.max[t]=Math.max(this.max[t],e[t]);}closestPoint(e){return [Math.max(Math.min(this.max[0],e[0]),this.min[0]),Math.max(Math.min(this.max[1],e[1]),this.min[1]),Math.max(Math.min(this.max[2],e[2]),this.min[2])]}}Qs(Ju,"Aabb");class Qu{constructor(e,t){this.feature=e,this.metersToTile=t,this.index=0;}get(){const e=this.feature.vertices[this.index],t=this.feature.vertexProps[this.index].dir,r=t[1],n=-t[0],i=(e.extent+1)*this.metersToTile;return [new Me(Math.trunc(e.position[0]+r*i),Math.trunc(e.position[1]+n*i)),new Me(Math.trunc(e.position[0]-r*i),Math.trunc(e.position[1]-n*i))]}next(){this.index++;}valid(){return this.index{return e.a0?E(a,a,1/l):S(a,0,0,1)}getSafeArea(){return this.safeArea}isTunnel(){return this.heightRange.max<=-5}getClosestEdge(e){if(0===this.edges.length)return;let t=0,r=Number.POSITIVE_INFINITY,n=0;const[i,s,o,a,l,u,c]=this._tmpVec2;he(c,e.x,e.y);const h=new Gu(c,null);for(let e=0;e0?ge(a,o)/x:0,b=Fe(v,0,1),w=Math.abs((v-b)*this.edgeProps[e].len);de(l,c,f),he(u,d[1],-d[0]);const _=w+Math.abs(ge(l,u));_=0;--s){const o=this.edges[s].a,a=this.edges[s].b,{position:l,height:u,extent:c}=this.vertices[o],{position:h,height:p,extent:d}=this.vertices[a],f=this.vertexProps[o].dir,m=this.vertexProps[a].dir;if(S(t,l[0]/e,l[1]/e,u),S(r,h[0]/e,h[1]/e,p),S(n,f[1],-f[0],0),E(n,n,c),S(i,m[1],-m[0],0),E(i,i,d),this.distSqLines(I(t[0]+.5*n[0],t[1]+.5*n[1],t[2]+.5*n[2]),I(r[0]-.5*i[0],r[1]-.5*i[1],r[2]-.5*i[2]),I(t[0]-.5*n[0],t[1]-.5*n[1],t[2]-.5*n[2]),I(r[0]+.5*i[0],r[1]+.5*i[1],r[2]+.5*i[2]))<=.0025000000000000005)continue;const y=this.vertices.length,g=pe(ue(),l,h);this.vertices.push({position:fe(g,g,.5),height:.5*(u+p),extent:.5*(c+d)});const x=pe(ue(),f,m);this.vertexProps.push({dir:ye(x,x)}),this.edges.splice(s,1),this.edgeProps.splice(s,1),this.edges.push({a:o,b:y}),this.edges.push({a:y,b:a});const v=de(ue(),this.vertices[y].position,l),b=me(v),w={vec:v,dir:fe(ue(),v,1/b),len:b};this.edgeProps.push(w),this.edgeProps.push(w);}}distSqLines(e,t,r,n){const i=k(_(),t,e),s=k(_(),n,r),o=k(_(),e,r),a=O(i,i),l=O(i,s),u=O(i,o),c=O(s,s),h=O(s,o),p=a*c-l*l;if(0===p)return C(N(i,r,n,O(o,s)/O(s,s)),e);const d=(a*h-l*u)/p;return C(N(i,e,t,(l*h-u*c)/p),N(s,r,n,d))}}class tc{static parseFrom(e,t){const r=$u.parse(e);if(!r)return [];let{vertices:n,features:i}=r;const s=1/vu(t);i.sort(((e,t)=>e.id-t.id)),n.sort(((e,t)=>e.id-t.id||e.idx-t.idx)),n=n.filter(((e,t,r)=>t===r.findIndex((t=>t.id===e.id&&t.idx===e.idx))));const o=new Array;let a=0;const l=n.length;for(const e of i){if(e.constantHeight){o.push(new ec(e.id,e.bounds,e.constantHeight));continue}for(;a!==l&&n[a].ide.id===r))}}class rc{constructor(e,t){this.zScale=1,this.xOffset=0,this.yOffset=0,e.equals(t)||(this.zScale=Math.pow(2,t.z-e.z),this.xOffset=(e.x*this.zScale-t.x)*Un,this.yOffset=(e.y*this.zScale-t.y)*Un);}constantElevation(e,t){if(null!=e.constantHeight)return this.computeBiasedHeight(e.constantHeight,t)}pointElevation(e,t,r){const n=this.constantElevation(t,r);return null!=n?n:(e.x=e.x*this.zScale+this.xOffset,e.y=e.y*this.zScale+this.yOffset,this.computeBiasedHeight(t.pointElevation(e),r))}computeBiasedHeight(e,t){return t<=0?e:e+t*Ce(0,t,e>=0?e:Math.abs(.5*e))}}Qs(ec,"ElevationFeature");class nc{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((e=>e.fqid)),this.index=e.index,this.hasPattern=!1,this.projection=e.projection,this.layoutVertexArray=new da,this.indexArray=new Fa,this.segments=new hl,this.programConfigurations=new Ul(e.layers,{zoom:e.zoom,lut:e.lut}),this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id)),this.elevationMode=this.layers[0].layout.get("circle-elevation-reference"),this.hasElevation=!1,"none"!==this.elevationMode&&(this.elevatedLayoutVertexArray=new ya),this.worldview=e.worldview,this.hasAppearances=null;}updateFootprints(e,t){}updateAppearances(e,t,r,n){}populate(e,t,r,n){const i=this.layers[0],s=[];let o=null;"circle"===i.type&&(o=i.layout.get("circle-sort-key"));for(const{feature:i,id:a,index:l,sourceLayerIndex:u}of e){const e=this.layers[0]._featureFilter.needGeometry,c=zu(i,e);if(!this.layers[0]._featureFilter.filter(new Io(this.zoom,{worldview:this.worldview,activeFloors:t.activeFloors}),c,r))continue;const h=o?o.evaluate(c,{},r):void 0,p={id:a,properties:i.properties,type:i.type,sourceLayerIndex:u,index:l,geometry:e?c.geometry:ku(i,r,n),patterns:{},sortKey:h};s.push(p);}o&&s.sort(((e,t)=>e.sortKey-t.sortKey));let a=null;"globe"===n.projection.name&&(this.globeExtVertexArray=new Ma,a=n.projection);for(const n of s){const{geometry:i,index:s,sourceLayerIndex:o}=n,l=e[s].feature;this.addFeature(n,i,s,t.availableImages,r,a,t.brightness,t.elevationFeatures),t.featureIndex.insert(l,i,s,o,this.index);}this.hasElevation||(this.elevatedLayoutVertexArray=void 0);}update(e,t,r,n,i,s,o){this.programConfigurations.updatePaintArrays(e,t,i,r,n,s,o,this.worldview);}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return !this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,ll.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.globeExtVertexArray&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,cl.members)),this.elevatedLayoutVertexArray&&(this.elevatedLayoutVertexBuffer=e.createVertexBuffer(this.elevatedLayoutVertexArray,ul.members))),this.programConfigurations.upload(e),this.uploaded=!0;}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy(),this.elevatedLayoutVertexBuffer&&this.elevatedLayoutVertexBuffer.destroy());}addFeature(e,t,r,n,i,s,o,a){let l;"none"!==this.elevationMode&&(l=tc.getElevationFeature(e,a));for(const r of t)for(const t of r){const r=t.x,n=t.y;if(r<0||r>=Un||n<0||n>=Un)continue;if(s){const e=s.projectTilePoint(r,n,i),t=s.upVector(i,r,n);this.addGlobeExtVertex(e,t),this.addGlobeExtVertex(e,t),this.addGlobeExtVertex(e,t),this.addGlobeExtVertex(e,t);}const o=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),a=o.vertexLength;if(this.addCircleVertex(r,n,-1,-1),this.addCircleVertex(r,n,1,-1),this.addCircleVertex(r,n,1,1),this.addCircleVertex(r,n,-1,1),"none"!==this.elevationMode){const e=l?l.pointElevation(new Me(r,n)):0;this.hasElevation=this.hasElevation||0!==e;for(let t=0;t<4;t++)this.elevatedLayoutVertexArray.emplaceBack(e);}this.indexArray.emplaceBack(a,a+1,a+2),this.indexArray.emplaceBack(a,a+2,a+3),o.vertexLength+=4,o.primitiveLength+=2;}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,r,{},n,i,o,void 0,this.worldview);}addCircleVertex(e,t,r,n){this.layoutVertexArray.emplaceBack(2*e+(r+1)/2,2*t+(n+1)/2);}addGlobeExtVertex(e,t){const r=16384;this.globeExtVertexArray.emplaceBack(e.x,e.y,e.z,t[0]*r,t[1]*r,t[2]*r);}}function ic(e,t){for(let r=0;r1){if(lc(e,t))return !0;for(let n=0;n1?r:r.sub(t)._mult(i)._add(t))}function fc(e,t){let r,n,i,s=!1;for(let o=0;ot.y!=i.y>t.y&&t.x<(i.x-n.x)*(t.y-n.y)/(i.y-n.y)+n.x&&(s=!s);}return s}function mc(e,t){let r=!1;for(let n=0,i=e.length-1;nt.y!=o.y>t.y&&t.x<(o.x-s.x)*(t.y-s.y)/(o.y-s.y)+s.x&&(r=!r);}return r}function yc(e,t,r,n,i){for(const s of e)if(t<=s.x&&r<=s.y&&n>=s.x&&i>=s.y)return !0;const s=[new Me(t,r),new Me(t,i),new Me(n,i),new Me(n,r)];if(e.length>2)for(const t of s)if(mc(e,t))return !0;for(let t=0;ti.x&&t.x>i.x||e.yi.y&&t.y>i.y)return !1;const s=Ze(e,t,r[0]);return s!==Ze(e,t,r[1])||s!==Ze(e,t,r[2])||s!==Ze(e,t,r[3])}function xc(e,t,r,n,i,s){let o=t.y-e.y,a=e.x-t.x;if(s=s||0){const e=o*o+a*a;if(0===e)return !0;const t=Math.sqrt(e);o/=t,a/=t;}return !((r.x-e.x)*o+(r.y-e.y)*a-s<0||(n.x-e.x)*o+(n.y-e.y)*a-s<0||(i.x-e.x)*o+(i.y-e.y)*a-s<0)}function vc(e,t,r,n,i,s,o){return !(xc(e,t,n,i,s,o)||xc(t,r,n,i,s,o)||xc(r,e,n,i,s,o)||xc(n,i,e,t,r,o)||xc(i,s,e,t,r,o)||xc(s,n,e,t,r,o))}function bc(e,t,r){const n=t.paint.get(e).value;return "constant"===n.kind?n.value:r.programConfigurations.get(t.id).getMaxValue(e)}function wc(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function _c(e,t,r,n,i){if(!t[0]&&!t[1])return e;const s=Me.convert(t)._mult(i);"viewport"===r&&s._rotate(-n);const o=[];for(let t=0;t>t&&e.y===this.y>>t}url(e,t){const r=function(e,t,r){var n=Sc(256*e,256*(t=Math.pow(2,r)-t-1),r),i=Sc(256*(e+1),256*(t+1),r);return n[0]+","+n[1]+","+i[0]+","+i[1]}(this.x,this.y,this.z),n=function(e,t,r){let n,i="";for(let s=e;s>0;s--)n=1<this.canonical.z?new zc(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new zc(e,this.wrap,e,this.canonical.x>>t,this.canonical.y>>t)}calculateScaledKey(e,t=!0){if(this.overscaledZ===e&&t)return this.key;if(e>this.canonical.z)return Tc(this.wrap*+t,e,this.canonical.z,this.canonical.x,this.canonical.y);{const r=this.canonical.z-e;return Tc(this.wrap*+t,e,e,this.canonical.x>>r,this.canonical.y>>r)}}isChildOf(e){if(e.wrap!==this.wrap)return !1;const t=this.canonical.z-e.canonical.z;return 0===e.overscaledZ||e.overscaledZ>t&&e.canonical.y===this.canonical.y>>t}children(e){if(this.overscaledZ>=e)return [new zc(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const t=this.canonical.z+1,r=2*this.canonical.x,n=2*this.canonical.y;return [new zc(t,this.wrap,t,r,n),new zc(t,this.wrap,t,r+1,n),new zc(t,this.wrap,t,r,n+1),new zc(t,this.wrap,t,r+1,n+1)]}isLessThan(e){return this.wrape.wrap)&&(this.overscaledZe.overscaledZ)&&(this.canonical.xe.canonical.x)&&this.canonical.y{let t=e.canonical.x-1,r=e.wrap;return t<0&&(t=(1<{let t=e.canonical.x+1,r=e.wrap;return t===1<new zc(e.overscaledZ,e.wrap,e.canonical.z,e.canonical.x,(0===e.canonical.y?1<new zc(e.overscaledZ,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y===(1<1?null:function(e,t,r,n){const i=Math.sin(r);return e*(Math.sin((1-n)*r)/i)+t*(Math.sin(n*r)/i)}(e.a[t],e.b[t],e.angle,Fe(r,0,1))+e.center[t]}function Nc(e){if(e.z<=1)return Rc[e.z+2*e.y+e.x];const t=Hc(qc(e));return Ju.fromPoints(t)}function jc(e,t,r){return E(e,e,1-r),V(e,e,t,r)}function $c(e,t,r){for(const n of e)j(n,n,t),E(n,n,r);}function Gc(e,t,r,n){const i=t/e.worldSize,s=e.globeMatrix;if(r.z<=1){const e=Nc(r).getCorners();return $c(e,s,i),Ju.fromPoints(e)}const o=qc(r,n),a=Hc(o,Hl+Dc(e._tileCoverLift));$c(a,s,i);const l=Number.MAX_VALUE,u=[-l,-l,-l],c=[l,l,l];if(o.contains(e.center)){for(const e of a)T(c,c,e),B(u,u,e);u[2]=0;const t=e.point,r=[t.x*i,t.y*i,0];return T(c,c,r),B(u,u,r),new Ju(c,u)}if(e._tileCoverLift>0){for(const e of a)T(c,c,e),B(u,u,e);return new Ju(c,u)}const h=[s[12]*i,s[13]*i,s[14]*i],p=o.getCenter(),d=Fe(e.center.lat,-mu,mu),f=Fe(p.lat,-mu,mu),m=uu(e.center.lng),y=cu(d);let g=m-uu(p.lng);const x=y-cu(f);g>.5?g-=1:g<-.5&&(g+=1);let v=0;Math.abs(g)>Math.abs(x)?v=g>=0?1:3:(v=x>=0?0:2,V(h,h,[s[4]*i,s[5]*i,s[6]*i],-Math.sin(ke(x>=0?o.getSouth():o.getNorth()))*Hl));const b=a[v],w=a[(v+1)%4],_=new Oc(b,w,h),A=[Uc(_,0)||b[0],Uc(_,1)||b[1],Uc(_,2)||b[2]],M=th(e.zoom);if(M>0){const n=function({x:e,y:t,z:r},n,i,s,o){const a=1/(1<.5?p=-1:d<-.5&&(p=1),l=((l+p)*n-(s*=n))*i+s,u=((u+p)*n-s)*i+s,c=(c*n-(o*=n))*i+o,h=(h*n-o)*i+o,[[l,h,0],[u,h,0],[u,c,0],[l,c,0]]}(r,t,e._pixelsPerMercatorPixel,m,y);for(let e=0;eMath.PI/2*1.01}const ih=ke(85),sh=Math.cos(ih),oh=Math.sin(ih),ah=a(),lh=e=>{const t=[];return "map"===e.paint.get("circle-pitch-alignment")&&t.push("PITCH_WITH_MAP"),"map"===e.paint.get("circle-pitch-scale")&&t.push("SCALE_WITH_MAP"),t};function uh(e,t,r,n,i,s,o,a,l){if(s&&e.queryGeometry.isAboveHorizon)return !1;s&&(l*=e.pixelToTileUnitsFactor);const u=e.tileID.canonical,c=r.projection.upVectorScale(u,r.center.lat,r.worldSize).metersToTile;for(const h of t)for(const t of h){const h=t.add(a),p=i&&r.elevation?r.elevation.exaggeration()*i.getElevationAt(h.x,h.y,!0):0,d=r.projection.projectTilePoint(h.x,h.y,u);if(p>0){const e=r.projection.upVector(u,h.x,h.y);d.x+=e[0]*c*p,d.y+=e[1]*c*p,d.z+=e[2]*c*p;}const f=s?h:ch(d.x,d.y,d.z,n),m=s?e.tilespaceRays.map((e=>dh(e,p))):e.queryGeometry.screenGeometry,y=Q([],[d.x,d.y,d.z,1],n);if(!o&&s?l*=y[3]/r.cameraToCenterDistance:o&&!s&&(l*=r.cameraToCenterDistance/y[3]),s){const e=du((t.y/Un+u.y)/(1<e.width||i.height>e.height||r.x>e.width-i.width||r.y>e.height-i.height)throw new RangeError("out of range source coordinates for image copy");if(i.width>t.width||i.height>t.height||n.x>t.width-i.width||n.y>t.height-i.height)throw new RangeError("out of range destination coordinates for image copy");const l=e.data,u=t.data,c=4===s&&a;for(let a=0;a{t[e.evaluationKey]=s;const o=e.expression.evaluate(t),a=o?o.toNonPremultipliedRenderColor(null):null;a&&(i.data[r+n+0]=Math.floor(255*a.r),i.data[r+n+1]=Math.floor(255*a.g),i.data[r+n+2]=Math.floor(255*a.b),i.data[r+n+3]=Math.floor(255*a.a));};if(e.clips)for(let t=0,i=0;t80*r){a=e[0],l=e[1];let t=a,n=l;for(let s=r;st&&(t=r),i>n&&(n=i);}u=Math.max(t-a,n-l),u=0!==u?32767/u:0;}return Vh(s,o,r,a,l,u,0),o}function Bh(e,t,r,n,i){let s;if(i===function(e,t,r,n){let i=0;for(let s=t,o=r-n;s0)for(let i=t;i=t;i-=n)s=Qh(i/n|0,e[i],e[i+1],s);return s&&Xh(s,s.next)&&(ep(s),s=s.next),s}function Eh(e,t){if(!e)return e;t||(t=e);let r,n=e;do{if(r=!1,n.steiner||!Xh(n,n.next)&&0!==Hh(n.prev,n,n.next))n=n.next;else {if(ep(n),n=t=n.prev,n===n.next)break;r=!0;}}while(r||n!==t);return t}function Vh(e,t,r,n,i,s,o){if(!e)return;!o&&s&&function(e,t,r,n){let i=e;do{0===i.z&&(i.z=Nh(i.x,i.y,t,r,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;}while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,function(e){let t,r=1;do{let n,i=e;e=null;let s=null;for(t=0;i;){t++;let o=i,a=0;for(let e=0;e0||l>0&&o;)0!==a&&(0===l||!o||i.z<=o.z)?(n=i,i=i.nextZ,a--):(n=o,o=o.nextZ,l--),s?s.nextZ=n:e=n,n.prevZ=s,s=n;i=o;}s.nextZ=null,r*=2;}while(t>1)}(i);}(e,n,i,s);let a=e;for(;e.prev!==e.next;){const l=e.prev,u=e.next;if(s?Ch(e,n,i,s):Fh(e))t.push(l.i,e.i,u.i),ep(e),e=u.next,a=u.next;else if((e=u)===a){o?1===o?Vh(e=Dh(Eh(e),t),t,r,n,i,s,2):2===o&&Rh(e,t,r,n,i,s):Vh(Eh(e),t,r,n,i,s,1);break}}}function Fh(e){const t=e.prev,r=e,n=e.next;if(Hh(t,r,n)>=0)return !1;const i=t.x,s=r.x,o=n.x,a=t.y,l=r.y,u=n.y,c=Math.min(i,s,o),h=Math.min(a,l,u),p=Math.max(i,s,o),d=Math.max(a,l,u);let f=n.next;for(;f!==t;){if(f.x>=c&&f.x<=p&&f.y>=h&&f.y<=d&&Gh(i,a,s,l,o,u,f.x,f.y)&&Hh(f.prev,f,f.next)>=0)return !1;f=f.next;}return !0}function Ch(e,t,r,n){const i=e.prev,s=e,o=e.next;if(Hh(i,s,o)>=0)return !1;const a=i.x,l=s.x,u=o.x,c=i.y,h=s.y,p=o.y,d=Math.min(a,l,u),f=Math.min(c,h,p),m=Math.max(a,l,u),y=Math.max(c,h,p),g=Nh(d,f,t,r,n),x=Nh(m,y,t,r,n);let v=e.prevZ,b=e.nextZ;for(;v&&v.z>=g&&b&&b.z<=x;){if(v.x>=d&&v.x<=m&&v.y>=f&&v.y<=y&&v!==i&&v!==o&&Gh(a,c,l,h,u,p,v.x,v.y)&&Hh(v.prev,v,v.next)>=0)return !1;if(v=v.prevZ,b.x>=d&&b.x<=m&&b.y>=f&&b.y<=y&&b!==i&&b!==o&&Gh(a,c,l,h,u,p,b.x,b.y)&&Hh(b.prev,b,b.next)>=0)return !1;b=b.nextZ;}for(;v&&v.z>=g;){if(v.x>=d&&v.x<=m&&v.y>=f&&v.y<=y&&v!==i&&v!==o&&Gh(a,c,l,h,u,p,v.x,v.y)&&Hh(v.prev,v,v.next)>=0)return !1;v=v.prevZ;}for(;b&&b.z<=x;){if(b.x>=d&&b.x<=m&&b.y>=f&&b.y<=y&&b!==i&&b!==o&&Gh(a,c,l,h,u,p,b.x,b.y)&&Hh(b.prev,b,b.next)>=0)return !1;b=b.nextZ;}return !0}function Dh(e,t){let r=e;do{const n=r.prev,i=r.next.next;!Xh(n,i)&&Zh(n,r,r.next,i)&&Kh(n,i)&&Kh(i,n)&&(t.push(n.i,r.i,i.i),ep(r),ep(r.next),r=e=i),r=r.next;}while(r!==e);return Eh(r)}function Rh(e,t,r,n,i,s){let o=e;do{let e=o.next.next;for(;e!==o.prev;){if(o.i!==e.i&&qh(o,e)){let a=Jh(o,e);return o=Eh(o,o.next),a=Eh(a,a.next),Vh(o,t,r,n,i,s,0),void Vh(a,t,r,n,i,s,0)}e=e.next;}o=o.next;}while(o!==e)}function Lh(e,t){let r=e.x-t.x;return 0===r&&(r=e.y-t.y,0===r)&&(r=(e.next.y-e.y)/(e.next.x-e.x)-(t.next.y-t.y)/(t.next.x-t.x)),r}function Oh(e,t){const r=function(e,t){let r=t;const n=e.x,i=e.y;let s,o=-1/0;if(Xh(e,r))return r;do{if(Xh(e,r.next))return r.next;if(i<=r.y&&i>=r.next.y&&r.next.y!==r.y){const e=r.x+(i-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(e<=n&&e>o&&(o=e,s=r.x=r.x&&r.x>=l&&n!==r.x&&$h(is.x||r.x===s.x&&Uh(s,r)))&&(s=r,c=t);}r=r.next;}while(r!==a);return s}(e,t);if(!r)return t;const n=Jh(r,e);return Eh(n,n.next),Eh(r,r.next)}function Uh(e,t){return Hh(e.prev,e,t.prev)<0&&Hh(t.next,e,e.next)<0}function Nh(e,t,r,n,i){return (e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-r)*i|0)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-n)*i|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function jh(e){let t=e,r=e;do{(t.x=(e-o)*(s-a)&&(e-o)*(n-a)>=(r-o)*(t-a)&&(r-o)*(s-a)>=(i-o)*(n-a)}function Gh(e,t,r,n,i,s,o,a){return !(e===o&&t===a)&&$h(e,t,r,n,i,s,o,a)}function qh(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){let r=e;do{if(r.i!==e.i&&r.next.i!==e.i&&r.i!==t.i&&r.next.i!==t.i&&Zh(r,r.next,e,t))return !0;r=r.next;}while(r!==e);return !1}(e,t)&&(Kh(e,t)&&Kh(t,e)&&function(e,t){let r=e,n=!1;const i=(e.x+t.x)/2,s=(e.y+t.y)/2;do{r.y>s!=r.next.y>s&&r.next.y!==r.y&&i<(r.next.x-r.x)*(s-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next;}while(r!==e);return n}(e,t)&&(Hh(e.prev,e,t.prev)||Hh(e,t.prev,t))||Xh(e,t)&&Hh(e.prev,e,e.next)>0&&Hh(t.prev,t,t.next)>0)}function Hh(e,t,r){return (t.y-e.y)*(r.x-t.x)-(t.x-e.x)*(r.y-t.y)}function Xh(e,t){return e.x===t.x&&e.y===t.y}function Zh(e,t,r,n){const i=Yh(Hh(e,t,r)),s=Yh(Hh(e,t,n)),o=Yh(Hh(r,n,e)),a=Yh(Hh(r,n,t));return i!==s&&o!==a||!(0!==i||!Wh(e,r,t))||!(0!==s||!Wh(e,n,t))||!(0!==o||!Wh(r,e,n))||!(0!==a||!Wh(r,t,n))}function Wh(e,t,r){return t.x<=Math.max(e.x,r.x)&&t.x>=Math.min(e.x,r.x)&&t.y<=Math.max(e.y,r.y)&&t.y>=Math.min(e.y,r.y)}function Yh(e){return e>0?1:e<0?-1:0}function Kh(e,t){return Hh(e.prev,e,e.next)<0?Hh(e,t,e.next)>=0&&Hh(e,e.prev,t)>=0:Hh(e,t,e.prev)<0||Hh(e,e.next,t)<0}function Jh(e,t){const r=tp(e.i,e.x,e.y),n=tp(t.i,t.x,t.y),i=e.next,s=t.prev;return e.next=t,t.prev=e,r.next=i,i.prev=r,n.next=r,r.prev=n,s.next=n,n.prev=s,n}function Qh(e,t,r,n){const i=tp(e,t,r);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function ep(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ);}function tp(e,t,r){return {i:e,x:t,y:r,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function rp(e,t){const r=e.length;if(r<=1)return [e];const n=[];let i,s;for(let t=0;t1)for(let e=0;e=Un&&t>=Un}static evaluate(e){if(0===e.length)return new lp;let t=[];for(const r of e)t.push(...r.portals);if(0===t.length)return new lp;for(const e of t){const t=e.va,r=e.vb;(lp.isOnBorder(t.x,r.x)||lp.isOnBorder(t.y,r.y))&&(e.type="border");}const r=t.filter((e=>"unevaluated"!==e.type)),n=t.filter((e=>"unevaluated"===e.type));if(0===n.length)return new lp;n.sort(((e,t)=>e.hash===t.hash?e.isTunnel===t.isTunnel?0:e.isTunnel?-1:1:e.hashe.hash"fill-tunnel-structure-color"!==e)),this.tunnelProgramConfigurations=new Ul(t,{zoom:r,lut:n},(e=>"fill-bridge-guard-rail-color"!==e));}addVertices(e,t){const r=this.unevalVertices.length;for(let r=0;r=i.min.x&&u.x<=i.max.x&&u.y>=i.min.y&&u.y<=i.max.y||c.x>=i.min.x&&c.x<=i.max.x&&c.y>=i.min.y&&c.y<=i.max.y||gc(u,c,o)))continue;if(this.isOnBorder(u.x,c.x)||this.isOnBorder(u.y,c.y))continue;const h=cp.computeEdgeHash(this.unevalVertices[r],this.unevalVertices[l]);let p,d=this.vertexHashLookup.get(cp.computePosHash(u));null!=d?p=d.next:(d=this.vertexHashLookup.get(cp.computePosHash(c)),p=null!=d?d.prev:h),this.unevalEdges.push({polygonIdx:e,a:r,b:l,hash:h,portalHash:p,isTunnel:n,type:"unevaluated",featureInfo:s});}}addPortalCandidates(e,t,r,n,i){if(0===t.length)return;this.portalPolygons.add(e,{geometry:t,zLevel:i});const s=t[0];this.vertexHashLookup.clear();let o=cp.computeEdgeHash(s[s.length-2],s[s.length-1]);for(let t=0;t({vertexOffset:0,primitiveOffset:this.indexArray.length}),r=e=>{e.primitiveLength=this.indexArray.length-e.primitiveOffset;},n=new up(this.vertexPositions,this.vertexNormals,this.indexArray);this.prepareEdges(e.portals,this.unevalEdges);const i=t(),s=t(),o=t(),a=(e,t)=>{e.sort(((e,r)=>e.type===t&&r.type!==t?-1:e.type!==t&&r.type===t?1:0));const r=e.findIndex((e=>e.type!==t));return r>=0?r:e.length};let l=0;this.unevalEdges.length>0&&(l=a(this.unevalEdges,"none"),this.constructBridgeStructures(n,this.unevalVertices,this.unevalHeights,this.unevalEdges,{min:0,max:l},this.tileToMeters)),r(o);const u=t(),c=t();if(this.unevalEdges.length>0){const e=this.unevalEdges.splice(l),t=a(e,"tunnel")+l;this.unevalEdges.push(...e),this.constructTunnelStructures(n,this.unevalVertices,this.unevalHeights,this.unevalEdges,{min:0,max:l},{min:l,max:t});}r(u),n.addTriangles(this.unevalTriangles,this.unevalVertices,this.unevalHeights),r(c),n.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,this.unevalHeights),r(s),n.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,[-.1]),r(i),this.maskSegments=hl.simpleSegment(0,c.primitiveOffset,0,c.primitiveLength),this.depthSegments=hl.simpleSegment(0,s.primitiveOffset,0,s.primitiveLength),this.renderableBridgeSegments=hl.simpleSegment(0,o.primitiveOffset,0,o.primitiveLength),this.renderableTunnelSegments=hl.simpleSegment(0,u.primitiveOffset,0,u.primitiveLength),this.shadowCasterSegments=hl.simpleSegment(0,i.primitiveOffset,0,i.primitiveLength);}update(e,t,r,n,i,s,o,a){this.bridgeProgramConfigurations.updatePaintArrays(e,t,i,r,n,s,o,a),this.tunnelProgramConfigurations.updatePaintArrays(e,t,i,r,n,s,o,a);}upload(e){this.vertexBuffer||0===this.vertexPositions.length||0===this.vertexNormals.length||0===this.indexArray.length||(this.vertexBuffer=e.createVertexBuffer(this.vertexPositions,kh.members),this.vertexBufferNormal=e.createVertexBuffer(this.vertexNormals,zh.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.bridgeProgramConfigurations.upload(e),this.tunnelProgramConfigurations.upload(e));}destroy(){this.vertexBuffer&&(this.vertexBuffer.destroy(),this.vertexBufferNormal.destroy(),this.indexBuffer.destroy()),this.maskSegments&&(this.maskSegments.destroy(),this.depthSegments.destroy(),this.renderableBridgeSegments.destroy(),this.renderableTunnelSegments.destroy(),this.shadowCasterSegments.destroy()),this.bridgeProgramConfigurations.destroy(),this.tunnelProgramConfigurations.destroy();}populatePaintArrays(e,t,r,n,i){const s=(s,o)=>{for(let a=0;aS(e,t[n].x,t[n].y,r[n]*a),c=_(),h=_(),p=_(),d=_(),f=_(),m=(e,r)=>{const n=o.get(cp.computePosHash(t[r])),i=n.from,s=n.to;if(!i||!s)return;u(c,i),u(h,r),u(p,s),q(d),H(c,h)||(X(f,h,c),L(d,f)),H(p,h)||(X(f,p,h),P(d,d,L(f,f)));const a=W(d);return a>0?E(e,d,1/a):void 0};let y=Number.POSITIVE_INFINITY;this.sortSubarray(n,i.min,i.max,((e,t)=>e.featureInfo.featureIndex-t.featureInfo.featureIndex));const g=_(),x=_(),v=_(),b=_(),w=_(),A=_(),M=_(),I=_(),k=_(),z=[_(),_(),_(),_()],T=[_(),_(),_(),_()],B=[{coord:new Me(0,0),height:0},{coord:new Me(0,0),height:0}],V=(e,t)=>e>t;for(let u=i.min;ue.featureInfo.featureIndex-t.featureInfo.featureIndex;this.sortSubarray(n,i.min,i.max,a),this.sortSubarray(n,s.min,s.max,a);const l=e=>L(e,e),u=[{coord:new Me(0,0),height:0},{coord:new Me(0,0),height:0}],c=(e,t)=>ee.hash===t.hash?t.polygonIdx-e.polygonIdx:t.hash>e.hash?1:-1));let r=0,n=0,i=0,s=t[r].polygonIdx;do{n++,(n===t.length||t[r].hash!==t[n].hash)&&((1==n-r||t[n-1].polygonIdx!==s)&&(ie.portalHashs.hash?r++:s.hash>i.portalHash?n++:(i.type=s.type,r++);}}}isOnBorder(e,t){return e<=0&&t<=0||e>=Un&&t>=Un}addFeatureSection(e,t,r,n){return e!==t&&(t=e,r.push({featureIndex:e,vertexStart:n.getVertexCount()}),n.clearVertexLookup()),t}sortSubarray(e,t,r,n){const i=e.slice(t,r);i.sort(n),e.splice(t,i.length,...i);}static computeEdgeHash(e,t){return (e.y===t.y&&e.x>t.x||e.y>t.y)&&([e,t]=[t,e]),BigInt(cp.computePosHash(e))<<32n|BigInt(cp.computePosHash(t))}static computePosHash(e){return ((65535&e.x)<<16|65535&e.y)>>>0}}var hp,pp={exports:{}},dp=(hp||(hp=1,function(e,t){!function(e){function t(e,t){return e>t?1:e0){var a=n+Math.floor(o/2),l={key:t[a],data:r[a],parent:e};return l.left=i(l,t,r,n,a),l.right=i(l,t,r,a+1,s),l}return null}function s(e,t,r,n,i){if(!(r>=n)){for(var o=e[r+n>>1],a=r-1,l=n+1;;){do{a++;}while(i(e[a],o)<0);do{l--;}while(i(e[l],o)>0);if(a>=l)break;var u=e[a];e[a]=e[l],e[l]=u,u=t[a],t[a]=t[l],t[l]=u;}s(e,t,r,l,i),s(e,t,l+1,n,i);}}r.prototype.rotateLeft=function(e){var t=e.right;t&&(e.right=t.left,t.left&&(t.left.parent=e),t.parent=e.parent),e.parent?e===e.parent.left?e.parent.left=t:e.parent.right=t:this._root=t,t&&(t.left=e),e.parent=t;},r.prototype.rotateRight=function(e){var t=e.left;t&&(e.left=t.right,t.right&&(t.right.parent=e),t.parent=e.parent),e.parent?e===e.parent.left?e.parent.left=t:e.parent.right=t:this._root=t,t&&(t.right=e),e.parent=t;},r.prototype._splay=function(e){for(;e.parent;){var t=e.parent;t.parent?t.left===e&&t.parent.left===t?(this.rotateRight(t.parent),this.rotateRight(t)):t.right===e&&t.parent.right===t?(this.rotateLeft(t.parent),this.rotateLeft(t)):t.left===e&&t.parent.right===t?(this.rotateRight(t),this.rotateLeft(t)):(this.rotateLeft(t),this.rotateRight(t)):t.left===e?this.rotateRight(t):this.rotateLeft(t);}},r.prototype.splay=function(e){for(var t,r,n,i,s;e.parent;)(r=(t=e.parent).parent)&&r.parent?((n=r.parent).left===r?n.left=e:n.right=e,e.parent=n):(e.parent=null,this._root=e),i=e.left,s=e.right,e===t.left?(r&&(r.left===t?(t.right?(r.left=t.right,r.left.parent=r):r.left=null,t.right=r,r.parent=t):(i?(r.right=i,i.parent=r):r.right=null,e.left=r,r.parent=e)),s?(t.left=s,s.parent=t):t.left=null,e.right=t,t.parent=e):(r&&(r.right===t?(t.left?(r.right=t.left,r.right.parent=r):r.right=null,t.left=r,r.parent=t):(s?(r.left=s,s.parent=r):r.left=null,e.right=r,r.parent=e)),i?(t.right=i,i.parent=t):t.right=null,e.left=t,t.parent=e);},r.prototype.replace=function(e,t){e.parent?e===e.parent.left?e.parent.left=t:e.parent.right=t:this._root=t,t&&(t.parent=e.parent);},r.prototype.minNode=function(e){if(void 0===e&&(e=this._root),e)for(;e.left;)e=e.left;return e},r.prototype.maxNode=function(e){if(void 0===e&&(e=this._root),e)for(;e.right;)e=e.right;return e},r.prototype.insert=function(e,t){var r=this._root,n=null,i=this._compare;if(this._noDuplicates)for(;r;){if(n=r,0===i(r.key,e))return;r=i(r.key,e)<0?r.right:r.left;}else for(;r;)n=r,r=i(r.key,e)<0?r.right:r.left;return r={key:e,data:t,left:null,right:null,parent:n},n?i(n.key,r.key)<0?n.right=r:n.left=r:this._root=r,this.splay(r),this._size++,r},r.prototype.find=function(e){for(var t=this._root,r=this._compare;t;){var n=r(t.key,e);if(n<0)t=t.right;else {if(!(n>0))return t;t=t.left;}}return null},r.prototype.contains=function(e){for(var t=this._root,r=this._compare;t;){var n=r(e,t.key);if(0===n)return !0;t=n<0?t.left:t.right;}return !1},r.prototype.remove=function(e){var t=this.find(e);if(!t)return !1;if(this.splay(t),t.left)if(t.right){var r=this.minNode(t.right);r.parent!==t&&(this.replace(r,r.right),r.right=t.right,r.right.parent=r),this.replace(t,r),r.left=t.left,r.left.parent=r;}else this.replace(t,t.left);else this.replace(t,t.right);return this._size--,!0},r.prototype.removeNode=function(e){if(!e)return !1;if(this.splay(e),e.left)if(e.right){var t=this.minNode(e.right);t.parent!==e&&(this.replace(t,t.right),t.right=e.right,t.right.parent=t),this.replace(e,t),t.left=e.left,t.left.parent=t;}else this.replace(e,e.left);else this.replace(e,e.right);return this._size--,!0},r.prototype.erase=function(e){var t=this.find(e);if(t){this.splay(t);var r=t.left,n=t.right,i=null;r&&(r.parent=null,i=this.maxNode(r),this.splay(i),this._root=i),n&&(r?i.right=n:this._root=n,n.parent=i),this._size--;}},r.prototype.pop=function(){var e=this._root,t=null;if(e){for(;e.left;)e=e.left;t={key:e.key,data:e.data},this.remove(e.key);}return t},r.prototype.next=function(e){var t=e;if(t)if(t.right)for(t=t.right;t&&t.left;)t=t.left;else for(t=e.parent;t&&t.right===e;)e=t,t=t.parent;return t},r.prototype.prev=function(e){var t=e;if(t)if(t.left)for(t=t.left;t&&t.right;)t=t.right;else for(t=e.parent;t&&t.left===e;)e=t,t=t.parent;return t},r.prototype.forEach=function(e){for(var t=this._root,r=[],n=!1,i=0;!n;)t?(r.push(t),t=t.left):r.length>0?(e(t=r.pop(),i++),t=t.right):n=!0;return this},r.prototype.range=function(e,t,r,n){for(var i=[],s=this._compare,o=this._root;0!==i.length||o;)if(o)i.push(o),o=o.left;else {if(s((o=i.pop()).key,t)>0)break;if(s(o.key,e)>=0&&r.call(n,o))return this;o=o.right;}return this},r.prototype.keys=function(){for(var e=this._root,t=[],r=[],n=!1;!n;)e?(t.push(e),e=e.left):t.length>0?(e=t.pop(),r.push(e.key),e=e.right):n=!0;return r},r.prototype.values=function(){for(var e=this._root,t=[],r=[],n=!1;!n;)e?(t.push(e),e=e.left):t.length>0?(e=t.pop(),r.push(e.data),e=e.right):n=!0;return r},r.prototype.at=function(e){for(var t=this._root,r=[],n=!1,i=0;!n;)if(t)r.push(t),t=t.left;else if(r.length>0){if(t=r.pop(),i===e)return t;i++,t=t.right;}else n=!0;return null},r.prototype.load=function(e,t,r){if(void 0===e&&(e=[]),void 0===t&&(t=[]),void 0===r&&(r=!1),0!==this._size)throw new Error("bulk-load: tree is not empty");var n=e.length;return r&&s(e,t,0,n-1,this._compare),this._root=i(null,e,t,0,n),this._size=n,this},r.prototype.min=function(){var e=this.minNode(this._root);return e?e.key:null},r.prototype.max=function(){var e=this.maxNode(this._root);return e?e.key:null},r.prototype.isEmpty=function(){return null===this._root},n.size.get=function(){return this._size},r.createTree=function(e,t,n,i,s){return new r(n,s).load(e,t,i)},Object.defineProperties(r.prototype,n);var o=0,a=1,l=2,u=3,c=0,h=1,p=2,d=3;function f(e,t,r){null===t?(e.inOut=!1,e.otherInOut=!0):(e.isSubject===t.isSubject?(e.inOut=!t.inOut,e.otherInOut=t.otherInOut):(e.inOut=!t.otherInOut,e.otherInOut=t.isVertical()?!t.inOut:t.inOut),t&&(e.prevInResult=!m(t,r)||t.isVertical()?t.prevInResult:t));var n=m(e,r);e.resultTransition=n?function(e,t){var r,n=!e.inOut,i=!e.otherInOut;switch(t){case c:r=n&&i;break;case h:r=n||i;break;case d:r=n^i;break;case p:r=e.isSubject?n&&!i:i&&!n;}return r?1:-1}(e,r):0;}function m(e,t){switch(e.type){case o:switch(t){case c:return !e.otherInOut;case h:return e.otherInOut;case p:return e.isSubject&&e.otherInOut||!e.isSubject&&!e.otherInOut;case d:return !0}break;case l:return t===c||t===h;case u:return t===p;case a:return !1}return !1}var y=function(e,t,r,n,i){this.left=t,this.point=e,this.otherEvent=r,this.isSubject=n,this.type=i||o,this.inOut=!1,this.otherInOut=!1,this.prevInResult=null,this.resultTransition=0,this.otherPos=-1,this.outputContourId=-1,this.isExteriorRing=!0;},g={inResult:{configurable:!0}};function x(e,t){return e[0]===t[0]&&e[1]===t[1]}y.prototype.isBelow=function(e){var t=this.point,r=this.otherEvent.point;return this.left?(t[0]-e[0])*(r[1]-e[1])-(r[0]-e[0])*(t[1]-e[1])>0:(r[0]-e[0])*(t[1]-e[1])-(t[0]-e[0])*(r[1]-e[1])>0},y.prototype.isAbove=function(e){return !this.isBelow(e)},y.prototype.isVertical=function(){return this.point[0]===this.otherEvent.point[0]},g.inResult.get=function(){return 0!==this.resultTransition},y.prototype.clone=function(){var e=new y(this.point,this.left,this.otherEvent,this.isSubject,this.type);return e.contourId=this.contourId,e.resultTransition=this.resultTransition,e.prevInResult=this.prevInResult,e.isExteriorRing=this.isExteriorRing,e.inOut=this.inOut,e.otherInOut=this.otherInOut,e},Object.defineProperties(y.prototype,g);var v=11102230246251565e-32,b=134217729,w=(3+8*v)*v;function _(e,t,r,n,i){var s,o,a,l,u=t[0],c=n[0],h=0,p=0;c>u==c>-u?(s=u,u=t[++h]):(s=c,c=n[++p]);var d=0;if(hu==c>-u?(a=s-((o=u+s)-u),u=t[++h]):(a=s-((o=c+s)-c),c=n[++p]),s=o,0!==a&&(i[d++]=a);hu==c>-u?(a=s-((o=s+u)-(l=o-s))+(u-l),u=t[++h]):(a=s-((o=s+c)-(l=o-s))+(c-l),c=n[++p]),s=o,0!==a&&(i[d++]=a);for(;h0!=a>0)return l;var u=Math.abs(o+a);return Math.abs(l)>=M*u?l:-function(e,t,r,n,i,s,o){var a,l,u,c,h,p,d,f,m,y,g,x,v,A,M,E,V,F,C=e-i,D=r-i,R=t-s,L=n-s;P[0]=(M=(f=C-(d=(p=b*C)-(p-C)))*(y=L-(m=(p=b*L)-(p-L)))-((A=C*L)-d*m-f*m-d*y))-((g=M-(V=(f=R-(d=(p=b*R)-(p-R)))*(y=D-(m=(p=b*D)-(p-D)))-((E=R*D)-d*m-f*m-d*y)))+(h=M-g))+(h-V),P[1]=(v=A-((x=A+g)-(h=x-A))+(g-h))-((g=v-E)+(h=v-g))+(h-E),P[2]=x-((F=x+g)-(h=F-x))+(g-h),P[3]=F;var O=function(e,t){for(var r=t[0],n=1;n<4;n++)r+=t[n];return r}(0,P),U=I*o;if(O>=U||-O>=U)return O;if(a=e-(C+(h=e-C))+(h-i),u=r-(D+(h=r-D))+(h-i),l=t-(R+(h=t-R))+(h-s),c=n-(L+(h=n-L))+(h-s),0===a&&0===l&&0===u&&0===c)return O;if(U=S*o+w*Math.abs(O),(O+=C*c+L*a-(R*u+D*l))>=U||-O>=U)return O;B[0]=(M=(f=a-(d=(p=b*a)-(p-a)))*(y=L-(m=(p=b*L)-(p-L)))-((A=a*L)-d*m-f*m-d*y))-((g=M-(V=(f=l-(d=(p=b*l)-(p-l)))*(y=D-(m=(p=b*D)-(p-D)))-((E=l*D)-d*m-f*m-d*y)))+(h=M-g))+(h-V),B[1]=(v=A-((x=A+g)-(h=x-A))+(g-h))-((g=v-E)+(h=v-g))+(h-E),B[2]=x-((F=x+g)-(h=F-x))+(g-h),B[3]=F;var N=_(4,P,4,B,k);B[0]=(M=(f=C-(d=(p=b*C)-(p-C)))*(y=c-(m=(p=b*c)-(p-c)))-((A=C*c)-d*m-f*m-d*y))-((g=M-(V=(f=R-(d=(p=b*R)-(p-R)))*(y=u-(m=(p=b*u)-(p-u)))-((E=R*u)-d*m-f*m-d*y)))+(h=M-g))+(h-V),B[1]=(v=A-((x=A+g)-(h=x-A))+(g-h))-((g=v-E)+(h=v-g))+(h-E),B[2]=x-((F=x+g)-(h=F-x))+(g-h),B[3]=F;var j=_(N,k,4,B,z);B[0]=(M=(f=a-(d=(p=b*a)-(p-a)))*(y=c-(m=(p=b*c)-(p-c)))-((A=a*c)-d*m-f*m-d*y))-((g=M-(V=(f=l-(d=(p=b*l)-(p-l)))*(y=u-(m=(p=b*u)-(p-u)))-((E=l*u)-d*m-f*m-d*y)))+(h=M-g))+(h-V),B[1]=(v=A-((x=A+g)-(h=x-A))+(g-h))-((g=v-E)+(h=v-g))+(h-E),B[2]=x-((F=x+g)-(h=F-x))+(g-h),B[3]=F;var $=_(j,z,4,B,T);return T[$-1]}(e,t,r,n,i,s,u)}(e[0],e[1],t[0],t[1],r[0],r[1]);return n>0?-1:n<0?1:0}function V(e,t){var r=e.point,n=t.point;return r[0]>n[0]?1:r[0]n[1]?1:-1:function(e,t,r,n){return e.left!==t.left?e.left?1:-1:0!==E(r,e.otherEvent.point,t.otherEvent.point)?e.isBelow(t.otherEvent.point)?-1:1:!e.isSubject&&t.isSubject?1:-1}(e,t,r)}function F(e,t,r){var n=new y(t,!1,e,e.isSubject),i=new y(t,!0,e.otherEvent,e.isSubject);return x(e.point,e.otherEvent.point)&&console.warn("what is that, a collapsed segment?",e),n.contourId=i.contourId=e.contourId,V(i,e.otherEvent)>0&&(e.otherEvent.left=!0,i.left=!1),e.otherEvent.otherEvent=i,e.otherEvent=n,r.push(i),r.push(n),r}function C(e,t){return e[0]*t[1]-e[1]*t[0]}function D(e,t){return e[0]*t[0]+e[1]*t[1]}function R(e,t,r){var n=function(e,t,r,n,i){var s=[t[0]-e[0],t[1]-e[1]],o=[n[0]-r[0],n[1]-r[1]];function a(e,t,r){return [e[0]+t*r[0],e[1]+t*r[1]]}var l=[r[0]-e[0],r[1]-e[1]],u=C(s,o),c=u*u,h=D(s,s);if(c>0){var p=C(l,o)/u;if(p<0||p>1)return null;var d=C(l,s)/u;return d<0||d>1?null:0===p||1===p?[a(e,p,s)]:0===d||1===d?[a(r,d,o)]:[a(e,p,s)]}if((c=(u=C(l,s))*u)>0)return null;var f=D(s,l)/h,m=f+D(s,o)/h,y=Math.min(f,m),g=Math.max(f,m);return y<=1&&g>=0?1===y?[a(e,y>0?y:0,s)]:0===g?[a(e,g<1?g:1,s)]:[a(e,y>0?y:0,s),a(e,g<1?g:1,s)]:null}(e.point,e.otherEvent.point,t.point,t.otherEvent.point),i=n?n.length:0;if(0===i)return 0;if(1===i&&(x(e.point,t.point)||x(e.otherEvent.point,t.otherEvent.point)))return 0;if(2===i&&e.isSubject===t.isSubject)return 0;if(1===i)return x(e.point,n[0])||x(e.otherEvent.point,n[0])||F(e,n[0],r),x(t.point,n[0])||x(t.otherEvent.point,n[0])||F(t,n[0],r),1;var s=[],o=!1,c=!1;return x(e.point,t.point)?o=!0:1===V(e,t)?s.push(t,e):s.push(e,t),x(e.otherEvent.point,t.otherEvent.point)?c=!0:1===V(e.otherEvent,t.otherEvent)?s.push(t.otherEvent,e.otherEvent):s.push(e.otherEvent,t.otherEvent),o&&c||o?(t.type=a,e.type=t.inOut===e.inOut?l:u,o&&!c&&F(s[1].otherEvent,s[0].point,r),2):c?(F(s[0],s[1].point,r),3):s[0]!==s[3].otherEvent?(F(s[0],s[1].point,r),F(s[1],s[2].point,r),3):(F(s[0],s[1].point,r),F(s[3].otherEvent,s[2].point,r),3)}function L(e,t){if(e===t)return 0;if(0!==E(e.point,e.otherEvent.point,t.point)||0!==E(e.point,e.otherEvent.point,t.otherEvent.point))return x(e.point,t.point)?e.isBelow(t.otherEvent.point)?-1:1:e.point[0]===t.point[0]?e.point[1]t.contourId?1:-1:1===V(e,t)?1:-1}var O=function(){this.points=[],this.holeIds=[],this.holeOf=null,this.depth=null;};function U(e,t,r,n){var i,s=e+1,o=t[e].point,a=t.length;for(sn;)s--;return s}O.prototype.isExterior=function(){return null==this.holeOf};var N=$,j=$;function $(e,t){if(!(this instanceof $))return new $(e,t);if(this.data=e||[],this.length=this.data.length,this.compare=t||G,this.length>0)for(var r=(this.length>>1)-1;r>=0;r--)this._down(r);}function G(e,t){return et?1:0}$.prototype={push:function(e){this.data.push(e),this.length++,this._up(this.length-1);},pop:function(){if(0!==this.length){var e=this.data[0];return this.length--,this.length>0&&(this.data[0]=this.data[this.length],this._down(0)),this.data.pop(),e}},peek:function(){return this.data[0]},_up:function(e){for(var t=this.data,r=this.compare,n=t[e];e>0;){var i=e-1>>1,s=t[i];if(r(n,s)>=0)break;t[e]=s,e=i;}t[e]=n;},_down:function(e){for(var t=this.data,r=this.compare,n=this.length>>1,i=t[e];e=0)break;t[e]=a,e=s;}t[e]=i;}},N.default=j;var q=Math.max,H=Math.min,X=0;function Z(e,t,r,n,i,s){var o,a,l,u,c,h;for(o=0,a=e.length-1;o0?h.left=!0:c.left=!0;var p=l[0],d=l[1];i[0]=H(i[0],p),i[1]=H(i[1],d),i[2]=q(i[2],p),i[3]=q(i[3],d),n.push(c),n.push(h);}}var W=[];function Y(e,t,n){"number"==typeof e[0][0][0]&&(e=[e]),"number"==typeof t[0][0][0]&&(t=[t]);var i=function(e,t,r){var n=null;return e.length*t.length==0&&(r===c?n=W:r===p?n=e:r!==h&&r!==d||(n=0===e.length?t:e)),n}(e,t,n);if(i)return i===W?null:i;var s=[1/0,1/0,-1/0,-1/0],o=[1/0,1/0,-1/0,-1/0],a=function(e,t,r,n,i){var s,o,a,l,u,c,h=new N(null,V);for(a=0,l=e.length;an[2]||n[0]>r[2]||r[1]>n[3]||n[1]>r[3])&&(i===c?s=W:i===p?s=e:i!==h&&i!==d||(s=e.concat(t))),s}(e,t,s,o,n))return i===W?null:i;for(var l=function(e){var t,r,n=function(e){var t,r,n,i,s=[];for(r=0,n=e.length;r0){var o=t[s];if(null!=o.holeOf){var a=o.holeOf;t[a].holeIds.push(r),n.holeOf=a,n.depth=t[s].depth;}else t[s].holeIds.push(r),n.holeOf=s,n.depth=t[s].depth+1;}else n.holeOf=null,n.depth=t[s].depth;}else n.holeOf=null,n.depth=0;return n}(n[t],s,e),o=function(t){i[t]=!0,t=n.length)&&n[a];);s.push(r);}};for(t=0,r=n.length;tm||o===p&&y.point[0]>i[2])break;if(y.left){l=a=h.insert(y),a=a!==(u=h.minNode())?h.prev(a):null,l=h.next(l);var g=a?a.key:null;if(f(y,g,o),l&&2===R(y,l.key,e)&&(f(y,g,o),f(l.key,y,o)),a&&2===R(a.key,y,e)){var x=a;f(g,(x=x!==u?h.prev(x):null)?x.key:null,o),f(y,g,o);}}else l=a=h.find(y=y.otherEvent),a&&l&&(a=a!==u?h.prev(a):null,l=h.next(l),h.remove(y),l&&a&&R(a.key,l.key,e));}return d}(a,0,0,s,o,n)),u=[],m=0;m
+ * @license MIT
+ * @preserve
+ */function fp(e,t,r,n){const i=[],s=0===n?(e,t,r,n,i,s)=>{e.push(new Me(s,r+(s-t)/(n-t)*(i-r)));}:(e,t,r,n,i,s)=>{e.push(new Me(t+(s-r)/(i-r)*(n-t),s));};for(const o of e){const e=[];for(const i of o){if(i.length<=2)continue;const o=[];for(let e=0;et&&s(o,a,l,u,c,t):h>r?p=t&&s(o,a,l,u,c,t),p>r&&h<=r&&s(o,a,l,u,c,r);}let a=i[i.length-1];const l=0===n?a.x:a.y;l>=t&&l<=r&&o.push(a),o.length&&(a=o[o.length-1],o[0].x===a.x&&o[0].y===a.y||o.push(o[0]),e.push(o));}e.length&&i.push(e);}return i}function mp(e,t){const r=gp(e),n=gp([t]),i=dp.intersection(r,n);return null==i?[]:xp(i)}function yp(e,t){const r=65536;let n=gp(e,r);const i=[];for(;t.valid();t.next()){const[e,n]=t.get(),s=e.x*r,o=e.y*r,a=n.x*r,l=n.y*r,u=a-s,c=l-o,h=Math.hypot(u,c);if(0===h)continue;const p=Math.trunc(c/h*3),d=-Math.trunc(u/h*3);i.push([[[s,o],[a,l],[a+p,l+d],[s+p,o+d],[s,o]]]);}return i.length>0&&(n=dp.diff(n,i)),xp(n,1/r)}function gp(e,t=1){return [e.map((e=>e.map((e=>[e.x*t,e.y*t]))))]}function xp(e,t=1){return e.map((e=>e.map(((e,r)=>{const n=e.map((e=>new Me(e[0]*t,e[1]*t).round()));return r>0&&n.reverse(),n}))))}class vp{constructor(e,t){this.layoutVertexArray=new da,this.indexArray=new Fa,this.lineIndexArray=new za,this.triangleSegments=new hl,this.lineSegments=new hl,this.programConfigurations=new Ul(e.layers,{zoom:e.zoom,lut:e.lut}),this.uploaded=!1,t&&(this.elevatedLayoutVertexArray=new ya);}update(e,t,r,n,i,s,o,a){this.programConfigurations.updatePaintArrays(e,t,i,r,n,s,o,a);}isEmpty(){return 0===this.layoutVertexArray.length}needsUpload(){return this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Sh.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.lineIndexBuffer=e.createIndexBuffer(this.lineIndexArray),this.elevatedLayoutVertexArray&&this.elevatedLayoutVertexArray.length>0&&(this.elevatedLayoutVertexBuffer=e.createVertexBuffer(this.elevatedLayoutVertexArray,Ph.members))),this.programConfigurations.upload(e),this.uploaded=!0;}destroy(){this.layoutVertexBuffer&&(this.elevatedLayoutVertexBuffer&&this.elevatedLayoutVertexBuffer.destroy(),this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.lineIndexBuffer.destroy(),this.programConfigurations.destroy(),this.triangleSegments.destroy(),this.lineSegments.destroy());}populatePaintArrays(e,t,r,n,i,s,o){this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,t,r,n,i,s,void 0,o);}}class bp{constructor(e){this.zoom=e.zoom,this.pixelRatio=e.pixelRatio,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((e=>e.fqid)),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.lut=e.lut,this.bufferData=new vp(e,!1),this.elevationBufferData=new vp(e,!0),this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id)),this.projection=e.projection,this.elevationMode=this.layers[0].layout.get("fill-elevation-reference"),this.sourceLayerIndex=e.sourceLayerIndex,this.worldview=e.worldview,this.hasAppearances=null;}updateFootprints(e,t){}updateAppearances(e,t,r,n){}populate(e,t,r,n){this.hasPattern=sp("fill",this.layers,this.pixelRatio,t);const i=this.layers[0].layout.get("fill-sort-key"),s=[];for(const{feature:o,id:a,index:l,sourceLayerIndex:u}of e){const e=this.layers[0]._featureFilter.needGeometry,c=zu(o,e);if(!this.layers[0]._featureFilter.filter(new Io(this.zoom,{worldview:this.worldview,activeFloors:t.activeFloors}),c,r))continue;const h=i?i.evaluate(c,{},r,t.availableImages):void 0,p={id:a,properties:o.properties,type:o.type,sourceLayerIndex:u,index:l,geometry:e?c.geometry:ku(o,r,n),patterns:{},sortKey:h};s.push(p);}i&&s.sort(((e,t)=>e.sortKey-t.sortKey));for(const n of s){const{geometry:i,index:s,sourceLayerIndex:o}=n;if(this.hasPattern){const e=op("fill",this.layers,n,this.zoom,this.pixelRatio,t);this.patternFeatures.push(e);}else this.addFeature(n,i,s,r,{},t.availableImages,t.brightness,t.elevationFeatures);t.featureIndex.insert(e[s].feature,i,s,o,this.index);}}update(e,t,r,n,i,s,o){this.bufferData.update(e,t,r,n,i,s,o,this.worldview),this.elevationBufferData.update(e,t,r,n,i,s,o,this.worldview),this.elevatedStructures&&this.elevatedStructures.update(e,t,r,n,i,s,o,this.worldview);}addFeatures(e,t,r,n,i,s){for(const i of this.patternFeatures)this.addFeature(i,i.geometry,i.index,t,r,n,s,e.elevationFeatures);}isEmpty(){return this.bufferData.isEmpty()&&this.elevationBufferData.isEmpty()}uploadPending(){return !this.uploaded||this.bufferData.needsUpload()||this.elevationBufferData.needsUpload()}upload(e){this.bufferData.upload(e),this.elevationBufferData.upload(e),this.elevatedStructures&&this.elevatedStructures.upload(e);}destroy(){this.bufferData.destroy(),this.elevationBufferData.destroy(),this.elevatedStructures&&this.elevatedStructures.destroy();}addFeature(e,t,r,n,i,s=[],o,a){const l=rp(t,500);"none"!==this.elevationMode?this.addElevatedRoadFeature(e,l,n,r,a):this.addGeometry(l,this.bufferData),this.bufferData.populatePaintArrays(e,r,i,s,n,o,this.worldview),this.elevationBufferData.populatePaintArrays(e,r,i,s,n,o,this.worldview);}getUnevaluatedPortalGraph(){return this.elevatedStructures?this.elevatedStructures.unevaluatedPortals:void 0}getElevationPolygons(){return this.elevatedStructures?this.elevatedStructures.portalPolygons:void 0}setEvaluatedPortalGraph(e,t,r,n,i){this.elevatedStructures&&(this.elevatedStructures.construct(e),this.elevatedStructures.populatePaintArrays(t,r,n,i,this.worldview));}addElevatedRoadFeature(e,t,r,n,i){const s=new Array,o=tc.getElevationFeature(e,i);if(!o)return void this.addGeometry(t,this.bufferData);{const e=this.clipPolygonsToTile(t,1);e.length>0&&s.push({polygons:e,elevationFeature:o,elevationTileID:r});}const a={guardRailEnabled:this.layers[0].layout.get("fill-construct-bridge-guard-rail").evaluate(e,{},r),featureIndex:n};for(const t of s)if(t.elevationFeature){if("hd-road-base"===this.elevationMode){this.elevatedStructures||(this.elevatedStructures=new cp(t.elevationTileID,this.layers,this.zoom,this.lut));const r=t.elevationFeature.isTunnel();let n=0;e.properties.hasOwnProperty(Lu)&&(n=+e.properties[Lu]);for(const e of t.polygons)this.elevatedStructures.addPortalCandidates(t.elevationFeature.id,e,r,t.elevationFeature,n);}null==t.elevationFeature.constantHeight&&(t.polygons=this.prepareElevatedPolygons(t.polygons,t.elevationFeature,t.elevationTileID));const i=new rc(r,t.elevationTileID);this.addElevatedGeometry(t.polygons,i,t.elevationFeature,"hd-road-base"===this.elevationMode?0:.05,n,a);}}addElevatedGeometry(e,t,r,n,i,s){const o={elevation:r,elevationSampler:t,bias:n,index:i,featureInfo:s},[a,l]=this.addGeometry(e,this.elevationBufferData,o);null==this.elevationBufferData.heightRange?this.elevationBufferData.heightRange={min:a,max:l}:(this.elevationBufferData.heightRange.min=Math.min(this.elevationBufferData.heightRange.min,a),this.elevationBufferData.heightRange.max=Math.max(this.elevationBufferData.heightRange.max,l));}addGeometry(e,t,r){let n=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY,s=null;r&&(s=r.elevationSampler.constantElevation(r.elevation,r.bias),null!=s&&(n=s,i=s));const o=(e,o,a)=>{if(null!=r)if(o.push(e),null!=s)t.elevatedLayoutVertexArray.emplaceBack(s),a.push(s);else {const s=r.elevationSampler.pointElevation(e,r.elevation,r.bias);t.elevatedLayoutVertexArray.emplaceBack(s),a.push(s),n=Math.min(n,s),i=Math.max(i,s);}};for(const n of e){let e=0;for(const t of n)e+=t.length;const i=t.triangleSegments.prepareSegment(e,t.layoutVertexArray,t.indexArray),s=i.vertexLength,a=[],l=[],u=[],c=[],h=[],p=t.layoutVertexArray.length;for(const e of n){if(0===e.length)continue;e!==n[0]&&l.push(a.length/2);const i=t.lineSegments.prepareSegment(e.length,t.layoutVertexArray,t.lineIndexArray),s=i.vertexLength;r&&h.push(t.layoutVertexArray.length-p),o(e[0],u,c),t.layoutVertexArray.emplaceBack(e[0].x,e[0].y),t.lineIndexArray.emplaceBack(s+e.length-1,s),a.push(e[0].x),a.push(e[0].y);for(let r=1;r0&&r&&"hd-road-base"===this.elevationMode){const e=r.elevation.isTunnel(),t=r.elevation.safeArea,n=this.elevatedStructures.addVertices(u,c);this.elevatedStructures.addTriangles(d,n,e);const i=h.length;if(i>0){for(let s=0;s=r&&u.max.x<=i&&u.min.y>=n&&u.max.y<=s?a:l).push(t);}if(a.length===e.length)return e;const u=[new Me(r,n),new Me(i,n),new Me(i,s),new Me(r,s),new Me(r,n)],c=a;for(const e of l)c.push(...mp(e,u));return c}}let wp,_p,Ap,Mp;Qs(bp,"FillBucket",{omit:["layers","patternFeatures"]}),Qs(vp,"FillBufferData"),Qs(cp,"ElevatedStructures");class Ip{constructor(e,t,r,n){if(this.triangleCount=t.length/3,this.min=new Me(0,0),this.max=new Me(0,0),this.xScale=0,this.yScale=0,this.cellsX=0,this.cellsY=0,this.cells=[],this.payload=[],0===this.triangleCount||0===e.length)return;const[i,s]=[e[0].clone(),e[0].clone()];for(let t=1;te.cellIdx-t.cellIdx||e.triIdx-t.triIdx));let u=0;for(;uthis.max.x||this.min.x>e.x||e.y>this.max.y||this.min.y>e.y)return;const r=Sp(e.x-this.min.x,this.xScale,this.cellsX),n=Sp(e.y-this.min.y,this.yScale,this.cellsY),i=this.cells[n*this.cellsX+r];if(i){this._lazyInitLookup();for(let e=0;ethis.max.x||this.min.x>t.x)return;if(e.y>this.max.y||this.min.y>t.y)return;this._lazyInitLookup();const n=Sp(e.x-this.min.x,this.xScale,this.cellsX),i=Sp(t.x-this.min.x,this.xScale,this.cellsX),s=Sp(e.y-this.min.y,this.yScale,this.cellsY),o=Sp(t.y-this.min.y,this.yScale,this.cellsY);for(let e=s;e<=o;e++)for(let t=n;t<=i;t++){const n=this.cells[e*this.cellsX+t];if(n)for(let e=0;ee.fqid)),this.index=e.index,this.hasPattern=!1,this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id)),this.footprints=[],this.worldview=e.worldview,this.hasAppearances=null;}updateFootprints(e,t){for(const r of this.footprints)t.push({footprint:r,id:e});}updateAppearances(e,t,r,n){}populate(e,t,r,n){const i=[];for(const{feature:s,id:o,index:a,sourceLayerIndex:l}of e){const e=this.layers[0]._featureFilter.needGeometry,u=zu(s,e);if(!this.layers[0]._featureFilter.filter(new Io(this.zoom,{worldview:this.worldview,activeFloors:t.activeFloors}),u,r))continue;const c={id:o,properties:s.properties,type:s.type,sourceLayerIndex:l,index:a,geometry:e?u.geometry:ku(s,r,n),patterns:{}};i.push(c);}for(const n of i){const{geometry:i,index:s,sourceLayerIndex:o}=n;this.addFeature(n,i,s,r,{},t.availableImages,t.brightness),t.featureIndex.insert(e[s].feature,i,s,o,this.index);}}isEmpty(){return 0===this.footprints.length}uploadPending(){return !1}upload(e){}update(e,t,r,n,i,s,o){}destroy(){}addFeature(e,t,r,n,i,s=[],o){for(const e of rp(t,2)){const t=[],r=[],n=[],i=new Me(1/0,1/0),s=new Me(-1/0,-1/0);for(const o of e)if(0!==o.length){o!==e[0]&&n.push(r.length/2);for(let e=0;et===e))}(n,e.clipScope)}function Op(e,t){return e.x-t.x||e.y-t.y}function Up(e,t){return 0===Op(e.min,t.min)&&0===Op(e.max,t.max)}function Np(e,t){return !(e.min.x>t.max.x||e.max.xt.max.y||e.max.ynew Me((e.x+s.x*Un)*a-o.x*Un,(e.y+s.y*Un)*a-o.y*Un)));}return qp(r,i,e.indices,0,e.indices.length,0,0)}function Xp(e,t,r,n){const i=Math.pow(2,n.z-r.z);return new Me((e+r.x*Un)*i-n.x*Un,(t+r.y*Un)*i-n.y*Un)}function Zp(e,t){const r=[];t.grid.queryPoint(e,r);const n=t.indices,i=t.vertices;for(let t=0;t0&&(n.length>1&&r.push(n),n=[]);}return n.length>1&&r.push(n),r}const Kp=Tu.types,Jp=["fill-extrusion-base","fill-extrusion-height","fill-extrusion-color","fill-extrusion-pattern","fill-extrusion-flood-light-wall-radius","fill-extrusion-line-width","fill-extrusion-emissive-strength"],Qp=["fill-extrusion-flood-light-ground-radius"],ed=Math.pow(2,13),td=Math.pow(2,15)-1,rd=new Me(0,1),nd=2147483648,id=7,sd=450;function od(e,t,r,n,i,s,o,a){e.emplaceBack((t<<1)+o,(r<<1)+s,(Math.floor(n*ed)<<1)+i,Math.round(a));}function ad(e,t,r){e.emplaceBack(t.x*Un,t.y*Un,r?1:0);}function ld(e,t,r,n,i,s){e.emplaceBack(t.x,t.y,(r.x<<1)+n,(r.y<<1)+i,s);}function ud(e,t,r){const n=16384;e.emplaceBack(t.x,t.y,t.z,r[0]*n,r[1]*n,r[2]*n);}class cd{constructor(){this.vertexOffset=0,this.vertexCount=0,this.indexOffset=0,this.indexCount=0;}}class hd{constructor(){this.centroidXY=new Me(0,0),this.vertexArrayOffset=0,this.vertexCount=0,this.groundVertexArrayOffset=0,this.groundVertexCount=0,this.flags=0,this.footprintSegIdx=-1,this.footprintSegLen=0,this.polygonSegIdx=-1,this.polygonSegLen=0,this.min=new Me(Number.MAX_VALUE,Number.MAX_VALUE),this.max=new Me(-Number.MAX_VALUE,-Number.MAX_VALUE),this.height=0,this.buildingId=0;}span(){return new Me(this.max.x-this.min.x,this.max.y-this.min.y)}}class pd{constructor(){this.acc=new Me(0,0),this.accCount=0,this.centroidDataIndex=0;}startRing(e,t){e.min.x===Number.MAX_VALUE&&(e.min.x=e.max.x=t.x,e.min.y=e.max.y=t.y);}appendEdge(e,t,r){this.accCount++,this.acc._add(t);let n=!!this.borders;t.xe.max.x&&(e.max.x=t.x,n=!0),t.ye.max.y&&(e.max.y=t.y,n=!0),((0===t.x||t.x===Un)&&t.x===r.x)!=((0===t.y||t.y===Un)&&t.y===r.y)&&this.processBorderOverlap(t,r),n&&this.checkBorderIntersection(t,r);}checkBorderIntersection(e,t){t.x<0!=e.x<0&&this.addBorderIntersection(0,pr(t.y,e.y,(0-t.x)/(e.x-t.x))),t.x>Un!=e.x>Un&&this.addBorderIntersection(1,pr(t.y,e.y,(Un-t.x)/(e.x-t.x))),t.y<0!=e.y<0&&this.addBorderIntersection(2,pr(t.x,e.x,(0-t.y)/(e.y-t.y))),t.y>Un!=e.y>Un&&this.addBorderIntersection(3,pr(t.x,e.x,(Un-t.y)/(e.y-t.y)));}addBorderIntersection(e,t){this.borders||(this.borders=[[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE]]);const r=this.borders[e];tr[1]&&(r[1]=t);}processBorderOverlap(e,t){if(e.x===t.x){if(e.y===t.y)return;const r=0===e.x?0:1;this.addBorderIntersection(r,t.y),this.addBorderIntersection(r,e.y);}else {const r=0===e.y?2:3;this.addBorderIntersection(r,t.x),this.addBorderIntersection(r,e.x);}}centroid(){return 0===this.accCount?new Me(0,0):new Me(Math.floor(Math.max(0,this.acc.x)/this.accCount),Math.floor(Math.max(0,this.acc.y)/this.accCount))}intersectsCount(){return this.borders?this.borders.reduce(((e,t)=>e+ +(t[0]!==Number.MAX_VALUE)),0):0}}function dd(e,t){const r=e.add(t)._unit(),n=Fe(e.x*r.x+e.y*r.y,-1,1);var i,s,o;return i=Math.acos(n),Math.min(4,Math.max(-4,Math.tan(i)))/4*td*((s=e).x*(o=t).y-s.y*o.x<0?-1:1)}const fd=[e=>e.x<0,e=>e.x>Un,e=>e.y<0,e=>e.y>Un];function md(e,t,r,n){const i=[4];if(0===n)return i;r._mult(n);const s=e.sub(r),o=t.sub(r),a=[e,t,s,o];for(let e=0;e<4;e++)for(const t of a)if(fd[e](t)){i.push(e);break}return i}class yd{constructor(e){this.groundRadiusArray=null,this.groundRadiusBuffer=null,this.vertexArray=new va,this.indexArray=new Fa,this.programConfigurations=new Ul(e.layers,{zoom:e.zoom,lut:e.lut},(e=>Qp.includes(e))),this._segments=new hl,this.hiddenByLandmarkVertexArray=new Za,this._segmentToGroundQuads={},this._segmentToGroundQuads[0]=[],this._segmentToRegionTriCounts={},this._segmentToRegionTriCounts[0]=[0,0,0,0,0],this.regionSegments={},this.regionSegments[4]=new hl;}getDefaultSegment(){return this.regionSegments[4]}hasData(){return 0!==this.vertexArray.length}addData(e,t,r,n=!1){const i=e.length;if(i>2){let s=Math.max(0,this._segments.get().length-1);const o=this._segments._prepareSegment(4*i,this.vertexArray.length,2*this._segmentToGroundQuads[s].length);let a;s!==this._segments.get().length-1&&(s++,this._segmentToGroundQuads[s]=[],this._segmentToRegionTriCounts[s]=[0,0,0,0,0]);{const t=e[0],r=e[1];a=dd(t.sub(e[i-1])._perp()._unit(),r.sub(t)._perp()._unit());}for(let l=0;le.region-t.region));for(let r=0;re+t),0);let s=0;for(let e=0;e<=4;e++){const t=i[e];if(0!==t){let r=this.regionSegments[e];r||(r=this.regionSegments[e]=new hl);const i={vertexOffset:n.vertexOffset,primitiveOffset:n.primitiveOffset+s,vertexLength:n.vertexLength,primitiveLength:t};r.get().push(i);}s+=t;}for(let e=0;e0?this.hiddenByLandmarkVertexBuffer=e.createVertexBuffer(this.hiddenByLandmarkVertexArray,Vp.members,!0):this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexBuffer.updateData(this.hiddenByLandmarkVertexArray),this._needsHiddenByLandmarkUpdate=!1);}destroy(){if(this.vertexBuffer){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexBuffer.destroy(),this.groundRadiusBuffer&&this.groundRadiusBuffer.destroy(),this._segments&&this._segments.destroy(),this.programConfigurations.destroy();for(let e=0;e<=4;e++){const t=this.regionSegments[e];t&&t.destroy();}}}}class gd{constructor(e){this.zoom=e.zoom,this.canonical=e.canonical,this.overscaling=e.overscaling,this.layers=e.layers,this.pixelRatio=e.pixelRatio,this.layerIds=this.layers.map((e=>e.fqid)),this.index=e.index,this.hasPattern=!1,this.edgeRadius=0,this.projection=e.projection,this.activeReplacements=[],this.replacementUpdateTime=0,this.centroidData=[],this.footprintIndices=new Fa,this.footprintVertices=new da,this.footprintSegments=[],this.layoutVertexArray=new ma,this.centroidVertexArray=new sl,this.wallVertexArray=new al,this.indexArray=new Fa,this.programConfigurations=new Ul(e.layers,{zoom:e.zoom,lut:e.lut},(e=>Jp.includes(e))),this.segments=new hl,this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id)),this.groundEffect=new yd(e),this.maxHeight=0,this.partLookup={},this.triangleSubSegments=[],this.polygonSegments=[],this.worldview=e.worldview,this.hasAppearances=null;}updateFootprints(e,t){}updateAppearances(e,t,r,n){}populate(e,t,r,n){this.features=[],this.hasPattern=sp("fill-extrusion",this.layers,this.pixelRatio,t),this.featuresOnBorder=[],this.borderFeatureIndices=[[],[],[],[]],this.borderDoneWithNeighborZ=[-1,-1,-1,-1],this.selfDEMTileTimestamp=Number.MAX_VALUE,this.borderDEMTileTimestamp=[Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE],this.tileToMeter=vu(r),this.edgeRadius=this.layers[0].layout.get("fill-extrusion-edge-radius")/this.tileToMeter,this.wallMode=0!==this.layers[0].paint.get("fill-extrusion-line-width").constantOr(1);for(const{feature:i,id:s,index:o,sourceLayerIndex:a}of e){const e=this.layers[0]._featureFilter.needGeometry,l=zu(i,e);if(!this.layers[0]._featureFilter.filter(new Io(this.zoom,{worldview:this.worldview,activeFloors:t.activeFloors}),l,r))continue;const u={id:s,sourceLayerIndex:a,index:o,geometry:e?l.geometry:ku(i,r,n),properties:i.properties,type:i.type,patterns:{}},c=this.layoutVertexArray.length,h="Polygon"===Kp[u.type];if(this.hasPattern)this.features.push({featureId:i.id,feature:op("fill-extrusion",this.layers,u,this.zoom,this.pixelRatio,t)});else if(this.wallMode)for(const e of u.geometry)for(const s of Yp(e,h))this.addFeature(i.id,u,[s],o,r,{},t.availableImages,n,t.brightness);else this.addFeature(i.id,u,u.geometry,o,r,{},t.availableImages,n,t.brightness);t.featureIndex.insert(i,u.geometry,o,a,this.index,c);}this.sortBorders(),"mercator"===this.projection.name&&this.splitToSubtiles(),this.groundEffect.prepareBorderSegments(),this.polygonSegments.length=0;}addFeatures(e,t,r,n,i,s){for(const{featureId:e,feature:o}of this.features){const a="Polygon"===Kp[o.type],{geometry:l}=o;if(this.wallMode)for(const u of l)for(const l of Yp(u,a))this.addFeature(e,o,[l],o.index,t,r,n,i,s);else this.addFeature(e,o,l,o.index,t,r,n,i,s);}this.sortBorders(),"mercator"===this.projection.name&&this.splitToSubtiles();}update(e,t,r,n,i,s,o){this.programConfigurations.updatePaintArrays(e,t,i,r,n,s,o,this.worldview),this.groundEffect.update(e,t,i,r,n,s,o,this.worldview);}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return !this.uploaded||this.programConfigurations.needsUpload||this.groundEffect.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Cp),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.wallVertexBuffer=e.createVertexBuffer(this.wallVertexArray,Ep.members),this.layoutVertexExtArray&&(this.layoutVertexExtBuffer=e.createVertexBuffer(this.layoutVertexExtArray,Fp.members,!0)),this.groundEffect.upload(e)),this.groundEffect.uploadPaintProperties(e),this.programConfigurations.upload(e),this.uploaded=!0;}uploadCentroid(e){this.groundEffect.uploadHiddenByLandmark(e),this.needsCentroidUpdate&&(!this.centroidVertexBuffer&&this.centroidVertexArray.length>0?this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,Bp.members,!0):this.centroidVertexBuffer&&this.centroidVertexBuffer.updateData(this.centroidVertexArray),this.needsCentroidUpdate=!1);}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.centroidVertexBuffer&&this.centroidVertexBuffer.destroy(),this.layoutVertexExtBuffer&&this.layoutVertexExtBuffer.destroy(),this.groundEffect.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy());}addFeature(e,t,r,n,i,s,o,a,l){const u=this.layers[0].paint.get("fill-extrusion-flood-light-ground-radius").evaluate(t,{})/this.tileToMeter,c=[new Me(0,0),new Me(Un,Un)],h=a.projection,p="globe"===h.name,d=this.wallMode||"Polygon"===Kp[t.type],f=new pd;f.centroidDataIndex=this.centroidData.length;const m=new hd;m.buildingId=e,t.properties&&t.properties.hasOwnProperty("building_id")&&(m.buildingId=t.properties.building_id);const y=this.layers[0].paint.get("fill-extrusion-base").evaluate(t,{},i)<=0,g=this.layers[0].paint.get("fill-extrusion-height").evaluate(t,{},i);let x;if(m.height=g,m.vertexArrayOffset=this.layoutVertexArray.length,m.groundVertexArrayOffset=this.groundEffect.vertexArray.length,p&&!this.layoutVertexExtArray&&(this.layoutVertexExtArray=new Ma),this.wallMode){if(p)return void Xe("Non zero fill-extrusion-line-width is not yet supported on globe.");if(1!==r.length)return;x=function(e){const t=e[0].x===e[e.length-1].x&&e[0].y===e[e.length-1].y,r=function(e){let t=0;const r=e.length;for(let n=0;n=0}(e);r||(e=e.reverse());const n={geometry:[],joinNormals:[],indices:[]},i=[],s=[],o=[];let a=e.length;for(;a>=2&&e[a-1].equals(e[a-2]);)a--;if(a<(t?3:2))return n;let l,u,c,h,p,d=0;for(;d0;let g="miter";const x=2;"miter"===g&&m>x&&(g="bevel"),"bevel"===g&&(m>100&&(g="flipbevel"),m{const a=new Me(e.x,e.y),l=new Me(e.x,e.y);a.x+=t.x*n,a.y+=t.y*n,l.x-=t.x*Math.max(r,1),l.y-=t.y*Math.max(r,1),o.push(t),i.push(a),s.push(l);};if("miter"===g)n._mult(m),v(l,n,0,0);else if("flipbevel"===g)n=p.mult(-1),v(l,n,0,0),v(l,n.mult(-1),0,0);else {const e=-Math.sqrt(m*m-1),t=y?e:0,r=y?0:e;u&&v(l,h,t,r),c&&v(l,p,t,r);}}n.geometry=[...i,...s.reverse(),i[0]],n.joinNormals=[...o,...o.reverse(),o[o.length-1]];const f=n.geometry.length-1;for(let e=0;ee<(t.length-1)/2||e===t.length-1,b=this.wallMode?[r]:rp(r,500);for(let e=b.length-1;e>=0;e--){const t=b[e];(0===t.length||(w=t[0]).every((e=>e.x<=0))||w.every((e=>e.x>=Un))||w.every((e=>e.y<=0))||w.every((e=>e.y>=Un)))&&b.splice(e,1);}var w;let _;if(p)_=Sd(b,c,i);else {_=[];for(const e of b)_.push({polygon:e,bounds:c});}const A=d?this.edgeRadius:0,M=A>0&&this.zoom<17,I=(e,t)=>{if(0===e.length)return !1;const r=e[e.length-1];return t.x===r.x&&t.y===r.y};for(const{polygon:e,bounds:t}of _){let r=0,n=0;for(const t of e)d&&!t[0].equals(t[t.length-1])&&t.push(t[0]),n+=d?t.length-1:t.length;const s=this.segments.prepareSegment((d?5:4)*n,this.layoutVertexArray,this.indexArray);m.footprintSegIdx<0&&(m.footprintSegIdx=this.footprintSegments.length),m.polygonSegIdx<0&&(m.polygonSegIdx=this.polygonSegments.length);const o={triangleArrayOffset:this.indexArray.length,triangleCount:0,triangleSegIdx:this.segments.segments.length-1},a=new cd;if(a.vertexOffset=this.footprintVertices.length,a.indexOffset=3*this.footprintIndices.length,a.ringIndices=[],d){const n=[],o=[];r=s.vertexLength;for(let r=0;r4&&Ad(o[o.length-2],o[0],o[1]),l=A?vd(o[o.length-2],o[0],o[1],A):0;const c=[];let g,b,w;b=o[1].sub(o[0])._perp()._unit();let _=!0;for(let e=1,n=0;e0?1:0,z=u.dist(d);if(n+z>32768&&(n=0),A){w=M.sub(d)._perp()._unit();let e=bd(u,d,M,xd(b,w),A);isNaN(e)&&(e=0);const t=d.sub(u)._unit();u=u.add(t.mult(l))._round(),d=d.add(t.mult(-e))._round(),l=e,b=w,y&&this.zoom>=17&&(I(c,u)||c.push(u),I(c,d)||c.push(d));}const T=s.vertexLength,B=o.length>4&&Ad(u,d,M);let E=Md(n,a,_);if(od(this.layoutVertexArray,u.x,u.y,P,k,0,0,E),od(this.layoutVertexArray,u.x,u.y,P,k,0,1,E),this.wallMode){const t=v(e-1,o),r=x.joinNormals[e-1];ad(this.wallVertexArray,r,t),ad(this.wallVertexArray,r,t);}if(n+=z,E=Md(n,B,!_),a=B,od(this.layoutVertexArray,d.x,d.y,P,k,0,0,E),od(this.layoutVertexArray,d.x,d.y,P,k,0,1,E),this.wallMode){const t=v(e,o),r=x.joinNormals[e];ad(this.wallVertexArray,r,t),ad(this.wallVertexArray,r,t);}if(s.vertexLength+=4,this.indexArray.emplaceBack(T+0,T+1,T+2),this.indexArray.emplaceBack(T+1,T+3,T+2),s.primitiveLength+=2,A){const n=r+(1===e?o.length-2:e-2),i=1===e?r:n+1;if(this.indexArray.emplaceBack(T+1,n,T+3),this.indexArray.emplaceBack(n,i,T+3),s.primitiveLength+=2,void 0===g&&(g=T),!wd(M,o[e],t)){const t=e===o.length-1?g:s.vertexLength;this.indexArray.emplaceBack(T+2,T+3,t),this.indexArray.emplaceBack(T+3,t+1,t),this.indexArray.emplaceBack(T+3,i,t+1),s.primitiveLength+=3;}_=!_;}if(p){const e=this.layoutVertexExtArray,t=h.projectTilePoint(u.x,u.y,i),r=h.projectTilePoint(d.x,d.y,i),n=h.upVector(i,u.x,u.y),s=h.upVector(i,d.x,d.y);ud(e,t,n),ud(e,t,n),ud(e,r,s),ud(e,r,s);}}d&&(r+=o.length-1),y&&A&&this.zoom>=17&&(0!==c.length&&I(c,c[0])&&c.pop(),this.groundEffect.addData(c,t,u,A>0));}this.footprintSegments.push(a),o.triangleCount=this.indexArray.length-o.triangleArrayOffset,this.polygonSegments.push(o),++m.footprintSegLen,++m.polygonSegLen;}if(m.vertexCount=this.layoutVertexArray.length-m.vertexArrayOffset,m.groundVertexCount=this.groundEffect.vertexArray.length-m.groundVertexArrayOffset,0!==m.vertexCount){if(m.centroidXY=f.borders?rd:this.encodeCentroid(f,m),this.centroidData.push(m),f.borders){this.featuresOnBorder.push(f);const e=this.featuresOnBorder.length-1;for(let t=0;tthis.featuresOnBorder[t].borders[e][0]-this.featuresOnBorder[r].borders[e][0]));}splitToSubtiles(){const e=[];for(let t=0;tUn),i=2*n+(+(r.min.x+r.max.x>Un)^n);for(let n=0;ne.triangleSegmentIdx===t.triangleSegmentIdx?e.subtile-t.subtile:e.triangleSegmentIdx-t.triangleSegmentIdx));let r=0,n=0,i=0;for(const t of e){if(t.triangleSegmentIdx!==r)break;i++;}const s=e.length;for(;n!==e.length;){r=e[n].triangleSegmentIdx;let o=0,a=n,l=n;for(let t=a;t0&&this.triangleSubSegments.push({segment:c,min:s,max:u}),a=l;for(let t=a;t[e[0]*(1-r[0])+t[0]*r[0],e[1]*(1-r[1])+t[1]*r[1]],p=[],d=[];for(const e of this.triangleSubSegments){p[0]=e.min.x/Un,p[1]=e.min.y/Un,d[0]=e.max.x/Un,d[1]=e.max.y/Un;const t=h(u,c,p),o=h(u,c,d);if(0===new Ju([t[0],t[1],i],[o[0],o[1],s]).intersectsPrecise(r)){l&&(n.segments.push(l),l=void 0);continue}const a=e.segment;l&&l.vertexOffset!==a.vertexOffset&&(n.segments.push(l),l=void 0),l?(l.vertexLength+=a.vertexLength,l.primitiveLength+=a.primitiveLength):l={vertexOffset:a.vertexOffset,primitiveLength:a.primitiveLength,vertexLength:a.vertexLength,primitiveOffset:a.primitiveOffset,sortKey:void 0,vaos:{}};}return l&&n.segments.push(l),n}encodeCentroid(e,t){const r=e.centroid(),n=t.span(),i=Math.min(7,Math.round(n.x*this.tileToMeter/10)),s=Math.min(7,Math.round(n.y*this.tileToMeter/10));return new Me(Fe(r.x,1,Un-1)<<3|i,Fe(r.y,1,Un-1)<<3|s)}encodeBorderCentroid(e){if(!e.borders)return new Me(0,0);const t=e.borders,r=Number.MAX_VALUE;if(t[0][0]!==r||t[1][0]!==r){const e=t[0][0]!==r?0:1;return new Me(6|(t[0][0]!==r?0:65528),(t[e][0]+t[e][1])/2<<3|6)}{const e=t[2][0]!==r?2:3;return new Me((t[e][0]+t[e][1])/2<<3|6,6|(t[2][0]!==r?0:65528))}}showCentroid(e){const t=this.centroidData[e.centroidDataIndex];t.flags&=2147483647,t.centroidXY.x=0,t.centroidXY.y=0,this.writeCentroidToBuffer(t);}writeCentroidToBuffer(e){this.groundEffect.updateHiddenByLandmark(e);const t=e.vertexArrayOffset,r=e.vertexCount+e.vertexArrayOffset,n=e.flags&nd?rd:e.centroidXY,i=this.centroidVertexArray.geta_centroid_pos0(t);if(this.centroidVertexArray.geta_centroid_pos1(t)!==n.y||i!==n.x){for(let e=t;er.max.x||r.min.x>t.max.x||t.min.y>r.max.y||r.min.y>t.max.y))for(let s=0;st!=l>t&&e<(this.footprintVertices.int16[2*(a+s.vertexOffset)+0]-r)*(t-o)/(l-o)+r&&(n=!n);}o=r;}}return n}getHeightAtTileCoord(e,t){let r=Number.NEGATIVE_INFINITY,n=!0;const i=4*(e+Un)*Un+(t+Un);if(this.partLookup.hasOwnProperty(i)){const e=this.partLookup[i];return e?{height:e.height,hidden:!!(e.flags&nd)}:void 0}for(const s of this.centroidData)e>s.max.x||s.min.x>e||t>s.max.y||s.min.y>t||s.height<=r||this.footprintContainsPoint(e,t,s)&&(r=s.height,this.partLookup[i]=s,n=!!(s.flags&nd));if(r!==Number.NEGATIVE_INFINITY)return {height:r,hidden:n};this.partLookup[i]=void 0;}}function xd(e,t){const r=e.add(t)._unit();return e.x*r.x+e.y*r.y}function vd(e,t,r,n){const i=t.sub(e)._perp()._unit(),s=r.sub(t)._perp()._unit();return bd(e,t,r,xd(i,s),n)}function bd(e,t,r,n,i){const s=Math.sqrt(1-n*n);return Math.min(e.dist(t)/3,t.dist(r)/3,i*s/n)}function wd(e,t,r){return e.xr[1].x&&t.x>r[1].x||e.yr[1].y&&t.y>r[1].y}function _d(e,t){return e.xt[1].x||e.yt[1].y}function Ad(e,t,r){if(e.x<0||e.x>=Un||t.x<0||t.x>=Un||r.x<0||r.x>=Un)return !1;const n=r.sub(t),i=n.perp(),s=e.sub(t);return (n.x*s.x+n.y*s.y)/Math.sqrt((n.x*n.x+n.y*n.y)*(s.x*s.x+s.y*s.y))>-.866&&i.x*s.x+i.y*s.y<0}function Md(e,t,r){const n=t?2|e:-3&e;return r?1|n:-2&n}function Id(){const e=Math.PI/32,t=Math.tan(e),r=ru;return r*Math.sqrt(1+2*t*t)-r}function Sd(e,t,r){const n=1<{for(const r of e)o.push({polygon:r,bounds:t});},l=Math.ceil(Math.log2(r)),u=Math.ceil(Math.log2(n)),c=l-u,h=[];for(let e=0;e0?0:1);for(let e=0;et+1?d.push({polygons:p,bounds:e,depth:t+1}):a(p,e);}if(f.length){const e=[new Me(0===r?c:n.x,1===r?c:n.y),o];h.length>t+1?d.push({polygons:f,bounds:e,depth:t+1}):a(f,e);}}return o}(e,t,Math.ceil((s-i)/11.25),Math.ceil((o-a)/11.25),1,((e,t,i)=>{if(0===e)return .5*(t+i);{const e=du((r.y+t/Un)/n);return (cu(.5*(du((r.y+i/Un)/n)+e))*n-r.y)*Un}}))}function Pd(e,t,r,n,i,s){const o=Math.pow(2,n.z-i.z);for(let a=0;a=o[r]&&(n=t,o=e),n[r]i&&Ed(n,o,r,i),n[r]s&&Ed(o,n,r,s);}}function Fd(e,t,r,n,i,s){const o=[];for(let a=0;a=n&&p.x>=n||(c.x>=n?c=new Me(n,c.y+(n-c.x)/(p.x-c.x)*(p.y-c.y))._round():p.x>=n&&(p=new Me(n,c.y+(n-c.x)/(p.x-c.x)*(p.y-c.y))._round()),c.y>=i&&p.y>=i||(c.y>=i?c=new Me(c.x+(i-c.y)/(p.y-c.y)*(p.x-c.x),i)._round():p.y>=i&&(p=new Me(c.x+(i-c.y)/(p.y-c.y)*(p.x-c.x),i)._round()),u&&c.equals(u[u.length-1])||(u=[c],o.push(u),s&&s.push({progress:{min:f+Dd(m,y,c)*d,max:1},parentIndex:a,prevPoint:m,nextPoint:y})),u.push(p),s&&(s[s.length-1].progress.max=f+Dd(m,y,p)*d,s[s.length-1].nextPoint=y)))));}if(s&&h>0)for(let e=c;ee.t-t.t));let o=0,a=0,l=[];for(n.push(l);o!==e.length;){if(a===s.length){for(;o!==e.length;)0!==l.length&&l[l.length-1].equals(e[o])||l.push(e[o]),o++;break}s[a].t<=o?(0!==l.length&&l[l.length-1].equals(s[a].point)||l.push(s[a].point),Math.trunc(s[a].t),a++):(0!==l.length&&l[l.length-1].equals(e[o])||l.push(e[o]),o++);}}function Dd(e,t,r){return e.x!==t.x?(r.x-e.x)/(t.x-e.x):e.y!==t.y?(r.y-e.y)/(t.y-e.y):0}function Rd(e,t){return e.x*t.x+e.y*t.y}function Ld(e,t){if(1===e.length){let r=0;const n=t[r++];let i;for(;!i||n.equals(i);)if(i=t[r++],!i)return 1/0;for(;r{e[0]=t,e[1]=r,e[2]=n,e[3]=1;},g=Id();r>0&&(r+=g),n+=g;for(const g of t){const t=[],x=[];for(const h of g){const p=h.x+i.x,g=h.y+i.y,v=e.projection.projectTilePoint(p,g,c),b=e.projection.upVector(c,h.x,h.y);let w=r,_=n;if(o){const e=Nd(p,g,r,n,o,a,l,u);w+=e.base,_+=e.top;}0!==r?y(f,v.x+b[0]*d*w,v.y+b[1]*d*w,v.z+b[2]*d*w):y(f,v.x,v.y,v.z),y(m,v.x+b[0]*d*_,v.y+b[1]*d*_,v.z+b[2]*d*_),j(f,f,s),j(m,m,s),t.push(new Td(f[0],f[1],f[2])),x.push(new Td(m[0],m[1],m[2]));}h.push(t),p.push(x);}return [h,p]}(e,t,r,n,i,s,o,a,l,u,c):o?function(e,t,r,n,i,s,o,a,l){const u=[],c=[],h=[0,0,0,1];for(const p of e){const e=[],d=[];for(const u of p){const c=u.x+n.x,p=u.y+n.y,f=Nd(c,p,t,r,s,o,a,l);h[0]=c,h[1]=p,h[2]=f.base,h[3]=1,Q(h,h,i),h[3]=Math.max(h[3],1e-5);const m=new Td(h[0]/h[3],h[1]/h[3],h[2]/h[3]);h[0]=c,h[1]=p,h[2]=f.top,h[3]=1,Q(h,h,i),h[3]=Math.max(h[3],1e-5);const y=new Td(h[0]/h[3],h[1]/h[3],h[2]/h[3]);e.push(m),d.push(y);}u.push(e),c.push(d);}return [u,c]}(t,r,n,i,s,o,a,l,u):function(e,t,r,n,i){const s=[],o=[],a=i[8]*t,l=i[9]*t,u=i[10]*t,c=i[11]*t,h=i[8]*r,p=i[9]*r,d=i[10]*r,f=i[11]*r;for(const t of e){const e=[],r=[];for(const s of t){const t=s.x+n.x,o=s.y+n.y,m=i[0]*t+i[4]*o+i[12],y=i[1]*t+i[5]*o+i[13],g=i[2]*t+i[6]*o+i[14],x=i[3]*t+i[7]*o+i[15],v=m+a,b=y+l,w=g+u,_=Math.max(x+c,1e-5),A=m+h,M=y+p,I=g+d,S=Math.max(x+f,1e-5);e.push(new Td(v/_,b/_,w/_)),r.push(new Td(A/S,M/S,I/S));}s.push(e),o.push(r);}return [s,o]}(t,r,n,i,s)}function Nd(e,t,r,n,i,s,o,a){const l=o*i.getElevationAt(e,t,!0,!0),u=0!==s[0],c=u?0===s[1]?o*(s[0]/id-sd):o*function(e,t,r){const n=Math.floor(t[0]/8),i=Math.floor(t[1]/8),s=10*(t[0]-8*n),o=10*(t[1]-8*i),a=e.getElevationAt(n,i,!0,!0),l=e.getMeterToDEM(r),u=Math.floor(.5*(s*l-1)),c=Math.floor(.5*(o*l-1)),h=e.tileCoordToPixel(n,i),p=2*u+1,d=2*c+1,f=function(e,t,r,n,i){return [e.getElevationAtPixel(t,r,!0),e.getElevationAtPixel(t+i,r,!0),e.getElevationAtPixel(t,r+i,!0),e.getElevationAtPixel(t+n,r+i,!0)]}(e,h.x-u,h.y-c,p,d),m=Math.abs(f[0]-f[1]),y=Math.abs(f[2]-f[3]),g=Math.abs(f[0]-f[2])+Math.abs(f[1]-f[3]),x=Math.min(.25,.5*l*(m+y)/p),v=Math.min(.25,.5*l*g/d);return a+Math.max(x*s,v*o)}(i,s,a):l;return {base:l+(0===r?-1:r),top:u?Math.max(c+n,l+r+2):l+n}}class jd{constructor(e){this._callback=e,this._triggered=!1,"undefined"!=typeof MessageChannel&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._callback();});}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout((()=>{this._triggered=!1,this._callback();}),0));}remove(){this._channel=void 0,this._callback=()=>{};}}class $d{constructor(){this.tasks={},this.taskQueue=[],Ne(["process"],this),this.invoker=new jd(this.process),this.nextId=0;}add(e,t){const r=this.nextId++,n=function({type:e,isSymbolTile:t,zoom:r}){return r=r||0,"message"===e?0:"maybePrepare"!==e||t?"parseTile"!==e||t?"parseTile"===e&&t?300-r:"maybePrepare"===e&&t?400-r:500:200-r:100-r}(t);if(0===n){try{e();}finally{}return null}return this.tasks[r]={fn:e,metadata:t,priority:n,id:r},this.taskQueue.push(r),this.invoker.trigger(),{cancel:()=>{delete this.tasks[r];}}}process(){try{if(this.taskQueue=this.taskQueue.filter((e=>!!this.tasks[e])),!this.taskQueue.length)return;const e=this.pick();if(null===e)return;const t=this.tasks[e];if(delete this.tasks[e],this.taskQueue.length&&this.invoker.trigger(),!t)return;t.fn();}finally{}}pick(){let e=null,t=1/0;for(let r=0;r{r&&delete this.callbacks[o],this.target.postMessage({id:o,type:"",targetMapId:n,sourceMapId:this.mapId});}}}receive(e){const t=e.data;if(!t)return;const r=t.id;if(r&&(!t.targetMapId||this.mapId===t.targetMapId))if(""===t.type){const e=this.cancelCallbacks[r];delete this.cancelCallbacks[r],e&&e.cancel();}else if(t.mustQueue||Ke(self)){const e=this.callbacks[r],n=this.scheduler.add((()=>this.processTask(r,t)),e&&e.metadata||{type:"message"});n&&(this.cancelCallbacks[r]=n);}else this.processTask(r,t);}processTask(e,t){if(delete this.cancelCallbacks[e],""===t.type){const r=this.callbacks[e];delete this.callbacks[e],r&&(t.error?r(no(t.error)):r(null,no(t.data)));}else {const r=new Set,n=t.hasCallback?(t,n)=>{this.target.postMessage({id:e,type:"",sourceMapId:this.mapId,error:t?ro(t):null,data:ro(n,r)},r);}:()=>{},i=no(t.data);if(this.parent[t.type])this.parent[t.type](t.sourceMapId,i,n);else if(this.parent.getWorkerSource){const e=t.type.split("."),{source:r,scope:s}=i;this.parent.getWorkerSource(t.sourceMapId,e[0],r,s)[e[1]](i,n);}else n(new Error(`Could not find function ${t.type}`));}}remove(){this.scheduler.remove(),this.target.removeEventListener("message",this.receive,!1);}}var qd={workerUrl:"",workerClass:null,workerParams:void 0};const Hd="mapboxgl_preloaded_worker_pool";class Xd{constructor(){this.active={};}acquire(e,t=Xd.workerCount){if(!this.workers)for(this.workers=[];this.workers.length{e.terminate();})),this.workers=null);}isPreloaded(){return !!this.active[Hd]}numActive(){return Object.keys(this.active).length}}Xd.workerCount=2;class Zd{constructor(e,t,r="Worker",n=Xd.workerCount){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=Oe();const i=this.workerPool.acquire(this.id,n);for(let e=0;e{this.ready=!0;}));}broadcast(e,t,r){Re(this.actors,((r,n)=>{r.send(e,t,n);}),r=r||function(){});}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(){this.actors.forEach((e=>{e.remove();})),this.actors=[],this.workerPool.release(this.id);}}let Wd,Yd;function Kd(){return Wd||(Wd=new Xd),Wd}Zd.Actor=Gd;class Jd{constructor(e){this.module=e;}createIntArray(e){const t=new Int32Array(e),r=this.module.malloc(t.length*t.BYTES_PER_ELEMENT);return this.module.heap32.set(t,r/t.BYTES_PER_ELEMENT),r}createFloatArray(e){const t=new Float32Array(e),r=this.module.malloc(t.length*t.BYTES_PER_ELEMENT);return this.module.heapF32.set(t,r/t.BYTES_PER_ELEMENT),r}createStringBuffer(e){const t=this.module.malloc(e.length+1);for(let r=0;re.arrayBuffer())).then((e=>{t.buffers[r]=e;}))}function Mf(e,t){const r=e.json.bufferViews[t];return new Uint8Array(e.buffers[r.buffer],r.byteOffset||0,r.byteLength)}function If(e,t,r,n){if(e.uri){const i=_f(e.uri,n);return fetch(i).then((e=>e.blob())).then((e=>createImageBitmap(e))).then((e=>{t.images[r]=e;}))}if(void 0!==e.bufferView){const n=Mf(t,e.bufferView),i=new Blob([n],{type:e.mimeType});return createImageBitmap(i).then((e=>{t.images[r]=e;}))}}function Sf(e,t=0,r){const n={json:null,images:[],buffers:[]};if(new Uint32Array(e,t,1)[0]===bf){const r=new Uint32Array(e,t);let i=2;const s=(r[i++]>>2)-3,o=r[i++]>>2;if(i++,n.json=JSON.parse(wf.decode(r.subarray(i,i+o))),i+=o,i{const e=[],t=a&&a.includes(yf),i=a&&a.includes(xf);if(t&&e.push(function(){if(!tf)return null!=Qd?Qd:(Qd=function(e){let t,r=null;function n(){t=new Uint8Array(r.buffer);}function i(){throw new Error("Unexpected Draco error.")}const s={a:{a:i,d:function(e,r,n){return t.copyWithin(e,r,r+n)},c:function(e){const i=t.length,s=Math.max(e>>>0,Math.ceil(1.2*i)),o=Math.ceil((s-i)/65536);try{return r.grow(o),n(),!0}catch(e){return !1}},b:i}};return (WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(e,s):e.then((e=>e.arrayBuffer())).then((e=>WebAssembly.instantiate(e,s)))).then((e=>{const{Rb:i,Qb:s,P:o,T:a,X:l,Ja:u,La:c,Qa:h,Va:p,Wa:d,eb:f,jb:m,f:y,e:g,yb:x,zb:v,Ab:b,Bb:w,Db:_,Gb:A}=e.instance.exports;r=g;const M=(()=>{let e=0,r=0,n=0,o=0;return a=>{n&&(i(o),i(e),r+=n,n=e=0),e||(r+=128,e=s(r));const l=a.length+7&-8;let u=e;l>=r&&(n=l,u=o=s(l));for(let e=0;e{tf=e,Qd=void 0;})))}()),i&&e.push(function(){if(nf)return;const e=function(e){let t;const r=WebAssembly.instantiateStreaming(e,{}).then((e=>{t=e.instance,t.exports.__wasm_call_ctors();})),n={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},i={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};return {ready:r,supported:!0,decodeGltfBuffer(e,r,s,o,a,l){!function(e,t,r,n,i,s,o){const a=e.exports.sbrk,l=n+3&-4,u=a(l*i),c=a(s.length),h=new Uint8Array(e.exports.memory.buffer);h.set(s,c);const p=t(u,n,i,c,s.length);if(0===p&&o&&o(u,l,i),r.set(h.subarray(u,u+n*i)),a(u-a(0)),0!==p)throw new Error(`Malformed buffer data: ${p}`)}(t,t.exports[i[a]],e,r,s,o,t.exports[n[l]]);}}}(fetch(cf()));return e.ready.then((()=>{nf=e;}))}()),s)for(let t=0;t{if(t&&o)for(const{primitives:e}of o)for(const t of e)gf(t,n);if(i&&o&&l)for(const e of l)vf(e,n);return n}))}))}function Pf(e){return fetch(e).then((e=>e.arrayBuffer())).then((t=>Sf(t,0,e)))}function kf(e){switch(e){case WebGL2RenderingContext.RGBA8:return WebGL2RenderingContext.RGBA;case WebGL2RenderingContext.DEPTH_COMPONENT16:return WebGL2RenderingContext.DEPTH_COMPONENT;case WebGL2RenderingContext.DEPTH24_STENCIL8:return WebGL2RenderingContext.DEPTH_STENCIL;case WebGL2RenderingContext.R8:case WebGL2RenderingContext.R32F:return WebGL2RenderingContext.RED}}function zf(e){switch(e){case WebGL2RenderingContext.RGBA8:return WebGL2RenderingContext.UNSIGNED_BYTE;case WebGL2RenderingContext.DEPTH_COMPONENT16:return WebGL2RenderingContext.UNSIGNED_SHORT;case WebGL2RenderingContext.DEPTH24_STENCIL8:return WebGL2RenderingContext.UNSIGNED_INT_24_8;case WebGL2RenderingContext.R8:return WebGL2RenderingContext.UNSIGNED_BYTE;case WebGL2RenderingContext.R32F:return WebGL2RenderingContext.FLOAT}}class Tf{constructor(e,t,r,n){this.context=e,this.format=r,this.useMipmap=n&&n.useMipmap,this.texture=e.gl.createTexture(),this.update(t,{premultiply:n&&n.premultiply});}update(e,t){const r=e&&e instanceof HTMLVideoElement&&0===e.width?e.videoWidth:e.width,n=e&&e instanceof HTMLVideoElement&&0===e.height?e.videoHeight:e.height,{context:i}=this,{gl:s}=i,{x:o,y:a}=t&&t.position?t.position:{x:0,y:0},l=o+r,u=a+n;!this.size||this.size[0]===l&&this.size[1]===u||(s.bindTexture(s.TEXTURE_2D,null),s.deleteTexture(this.texture),this.texture=s.createTexture(),this.size=null),s.bindTexture(s.TEXTURE_2D,this.texture),i.pixelStoreUnpackFlipY.set(!1),i.pixelStoreUnpack.set(1),i.pixelStoreUnpackPremultiplyAlpha.set(this.format===s.RGBA8&&(!t||!1!==t.premultiply));const c=e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||ImageBitmap&&e instanceof ImageBitmap;if(!this.size&&l>0&&u>0){const e=this.useMipmap?Math.floor(Math.log2(Math.max(l,u)))+1:1;s.texStorage2D(s.TEXTURE_2D,e,this.format,l,u),this.size=[l,u];}this.size&&(c?s.texSubImage2D(s.TEXTURE_2D,0,o,a,kf(this.format),zf(this.format),e):"data"in e&&e.data&&s.texSubImage2D(s.TEXTURE_2D,0,o,a,r,n,kf(this.format),zf(this.format),e.data)),this.useMipmap&&s.generateMipmap(s.TEXTURE_2D);}bind(e,t,r=!1){const{context:n}=this,{gl:i}=n;i.bindTexture(i.TEXTURE_2D,this.texture),e!==this.minFilter&&(i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,e),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,this.useMipmap&&!r?e===i.NEAREST?i.NEAREST_MIPMAP_NEAREST:i.LINEAR_MIPMAP_LINEAR:e),this.minFilter=e),t!==this.wrapS&&(i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,t),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,t),this.wrapS=t);}bindExtraParam(e,t,r,n,i){const{context:s}=this,{gl:o}=s;o.bindTexture(o.TEXTURE_2D,this.texture),t!==this.magFilter&&(o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,t),this.magFilter=t),e!==this.minFilter&&(o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,this.useMipmap?e===o.NEAREST?o.NEAREST_MIPMAP_NEAREST:o.LINEAR_MIPMAP_LINEAR:e),this.minFilter=e),r!==this.wrapS&&(o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,r),this.wrapS=r),n!==this.wrapT&&(o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,n),this.wrapT=n),i!==this.compareMode&&(i?(o.texParameteri(o.TEXTURE_2D,o.TEXTURE_COMPARE_MODE,o.COMPARE_REF_TO_TEXTURE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_COMPARE_FUNC,i)):o.texParameteri(o.TEXTURE_2D,o.TEXTURE_COMPARE_MODE,o.NONE),this.compareMode=i);}destroy(){const{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null;}}class Bf{constructor(e,t){this.context=e,this.texture=t;}bind(e,t){const{context:r}=this,{gl:n}=r;n.bindTexture(n.TEXTURE_2D,this.texture),e!==this.minFilter&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,e),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,e),this.minFilter=e),t!==this.wrapS&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,t),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,t),this.wrapS=t);}}const Ef=ha([{name:"a_pos_3f",components:3,type:"Float32"}]),Vf=ha([{name:"a_color_3f",components:3,type:"Float32"}]),Ff=ha([{name:"a_color_4f",components:4,type:"Float32"}]),Cf=ha([{name:"a_uv_2f",components:2,type:"Float32"}]),Df=ha([{name:"a_normal_3f",components:3,type:"Float32"}]),Rf=ha([{name:"a_normal_matrix0",components:4,type:"Float32"},{name:"a_normal_matrix1",components:4,type:"Float32"},{name:"a_normal_matrix2",components:4,type:"Float32"},{name:"a_normal_matrix3",components:4,type:"Float32"}]),Lf=ha([{name:"a_pbr",components:4,type:"Uint16"},{name:"a_heightBasedEmissiveStrength",components:3,type:"Float32"}]);function Of(e,t){const r=Nf(e.projection,e.zoom,e.width,e.height),n=function(e,t,r,n,i){const s=new iu(r.lng-180*jf,r.lat),o=new iu(r.lng+180*jf,r.lat),a=e.project(s.lng,s.lat),l=e.project(o.lng,o.lat),c=-Math.atan2(l.y-a.y,l.x-a.x),p=bu.fromLngLat(r);p.y=Fe(p.y,-1+jf,1-jf);const f=p.toLngLat(),m=e.project(f.lng,f.lat),g=bu.fromLngLat(f);g.x+=jf;const x=g.toLngLat(),v=e.project(x.lng,x.lat),b=Gf(v.x-m.x,v.y-m.y,c),w=bu.fromLngLat(f);w.y+=jf;const _=w.toLngLat(),A=e.project(_.lng,_.lat),M=Gf(A.x-m.x,A.y-m.y,c),I=Math.abs(b.x)/Math.abs(M.y),S=u([]);y(S,S,-c*(1-(i?0:n)));const P=u([]);return d(P,P,[1,1-(1-I)*n,1]),P[4]=-M.x/M.y*n,y(P,P,c),h(P,S,P),P}(e.projection,0,e.center,r,t),i=Uf(e);return d(n,n,[i,i,1]),n}function Uf(e){const t=e.projection,r=Nf(e.projection,e.zoom,e.width,e.height),n=$f(t,e.center),i=$f(t,iu.convert(t.center));return Math.pow(2,n*r+(1-r)*i)}function Nf(e,t,r,n,i=1/0){const s=e.range;if(!s)return 0;const o=Math.min(i,Math.max(r,n)),a=Math.log2(o/1024);return Ce(s[0]+a,s[1]+a,t)}const jf=1/4e4;function $f(e,t){const r=Fe(t.lat,-mu,mu),n=new iu(t.lng-180*jf,r),i=new iu(t.lng+180*jf,r),s=e.project(n.lng,r),o=e.project(i.lng,r),a=bu.fromLngLat(n),l=bu.fromLngLat(i),u=o.x-s.x,c=o.y-s.y,h=l.x-a.x,p=l.y-a.y,d=Math.sqrt((h*h+p*p)/(u*u+c*c));return Math.log2(d)}function Gf(e,t,r){const n=Math.cos(r),i=Math.sin(r);return {x:e*n-t*i,y:e*i+t*n}}function qf(e,t,r){u(e),y(e,e,ke(t[2])),f(e,e,ke(t[0])),m(e,e,ke(t[1])),d(e,e,r),h(e,e,[1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,1]);}function Hf(e,t,r,n,i,s,o,a){const l=[r[0]-t[0],r[1]-t[1],0],u=[n[0]-t[0],n[1]-t[1],0];if(M(l)<1e-12||M(u)<1e-12)return te(e);const c=U([],l,u);L(c,c),k(u,n,t),l[2]=(s-i)*a,u[2]=(o-i)*a;const h=l;return U(h,l,u),L(h,h),le(e,c,h)}function Xf(e,t,r=!1){const n=th(t.zoom),i=function(e,t,r){const n=t.worldSize,i=[e[12],e[13],e[14]],s=du(i[1]/n),o=pu(i[0]/n),a=u([]),l=hu(1,s)*n,c=hu(1,0)*n*gu(s,t.zoom),f=1/Jc(n);let m=c*f;if(r){const e=Nf(t.projection,t.zoom,t.width,t.height,1024);m=f*t.projection.pixelSpaceConversion(t.center.lat,n,e);}const y=tu(s,o);P(y,y,E([],L([],y),l*m*i[2]));const g=function(e){const t=[e[0],e[1],e[2]];let r=[0,1,0];const n=U([],r,t);return U(r,t,n),0===D(r)&&(r=[0,1,0],U(n,t,r)),L(n,n),L(r,r),L(t,t),[n[0],n[1],n[2],0,r[0],r[1],r[2],0,t[0],t[1],t[2],0,e[0],e[1],e[2],1]}(y);d(a,a,[m,m,m*l]),p(a,a,[-i[0],-i[1],-i[2]]);const x=h([],t.globeMatrix,g);return h(x,x,a),h(x,x,e),x}(e,t,r);if(n>0){const r=function(e,t){const r=t.worldSize,n=hu(1,0)*r*gu(t.center.lat,t.zoom)/Jc(r),i=hu(1,t.center.lat)*r,s=u([]);m(s,s,ke(t.center.lng)),f(s,s,ke(t.center.lat)),p(s,s,[0,0,Hl]),d(s,s,[n,n,n*i]);const o=t.point;return p(s,s,[-o.x,-o.y,0]),h(s,s,e),h(s,t.globeMatrix,s)}(e,t);return function(e,t,r){const n=(e,t,r)=>{const n=M(e),i=M(t),s=jc(e,t,r);return E(s,s,1/M(s)*pr(n,i,r))},i=n([e[0],e[1],e[2]],[t[0],t[1],t[2]],r),s=n([e[4],e[5],e[6]],[t[4],t[5],t[6]],r),o=n([e[8],e[9],e[10]],[t[8],t[9],t[10]],r),a=jc([e[12],e[13],e[14]],[t[12],t[13],t[14]],r);return [i[0],i[1],i[2],0,s[0],s[1],s[2],0,o[0],o[1],o[2],0,a[0],a[1],a[2],1]}(i,r,n)}return i}function Zf(e,t,r,n){const i=Ju.projectAabbCorners(n,r);let s=Number.MAX_VALUE;for(let e=0;e0||0===o&&r[0]*s[0]+r[1]*s[1]>=0&&r[0]*r[0]+r[1]*r[1]>s[0]*s[0]+s[1]*s[1])&&(n=t);}i=n;}while(i!==r);return t.length>0&&t.push(t[0]),t}(i);if(ic(e,o))return s}const Wf=64,Yf={CoordinateSpaceTile:1,HasMapboxMeshFeatures:4,HasMeshoptCompression:8};function Kf(e,t,r,n,i,s,o,a,l,c=!1){const f=r.zoom,m=r.project(n),y=gu(n.lat,f),g=1/y;u(e),p(e,e,[m.x+o[0]*g,m.y+o[1]*g,o[2]]);let x=1,v=1;const w=r.worldSize;if(c){if("mercator"===r.projection.name){let e=0;r.elevation&&(e=r.elevation.getAtPointOrZero(new bu(m.x/w,m.y/w),0));const t=Q([],[m.x,m.y,e,1],r.projMatrix)[3]/r.cameraToCenterDistance;x=t,v=t*gu(r.center.lat,f);}else if("globe"===r.projection.name){const t=Xf(e,r),i=[0,0,0,1];Q(i,i,h([],r.projMatrix,t));const s=i[3]/r.cameraToCenterDistance,o=th(f),a=r.projection.pixelsPerMeter(n.lat,w)*gu(n.lat,f),l=r.projection.pixelsPerMeter(r.center.lat,w)*gu(r.center.lat,f);x=s/pr(a,yu(r.center.lat),o),v=s*y/a,x*=l,v*=l;}}else x=g;d(e,e,[x,x,v]);const _=[...e],A=t.orientation,M=[];if(qf(M,[A[0]+(i?i[0]:0),A[1]+(i?i[1]:0),A[2]+(i?i[2]:0)],s),h(e,_,M),a&&r.elevation){let i=0;const s=[];if(l&&r.elevation){i=function(e,t,r,n,i){const s=t.elevation;if(!s)return 0;const o=Ju.projectAabbCorners(r,n),a=hu(1,i.lat)*t.worldSize,l=function(e,t){const r=[0,0,1],n=[{corners:[0,1,3,2],dotProductWithUp:0},{corners:[1,5,2,6],dotProductWithUp:0},{corners:[0,4,1,5],dotProductWithUp:0},{corners:[2,6,3,7],dotProductWithUp:0},{corners:[4,7,5,6],dotProductWithUp:0},{corners:[0,3,4,7],dotProductWithUp:0}];for(const i of n){const n=e[i.corners[0]],s=e[i.corners[1]],o=e[i.corners[2]],a=[s[0]-n[0],s[1]-n[1],t*(s[2]-n[2])],l=U(a,a,[o[0]-n[0],o[1]-n[1],t*(o[2]-n[2])]);L(l,l),i.dotProductWithUp=O(l,r);}return n.sort(((e,t)=>e.dotProductWithUp-t.dotProductWithUp)),n[0].corners}(o,a),u=o[l[0]],c=o[l[1]],h=o[l[2]],p=o[l[3]],d=s.getAtPointOrZero(new bu(u[0]/t.worldSize,u[1]/t.worldSize),0),f=s.getAtPointOrZero(new bu(c[0]/t.worldSize,c[1]/t.worldSize),0),m=s.getAtPointOrZero(new bu(h[0]/t.worldSize,h[1]/t.worldSize),0),y=s.getAtPointOrZero(new bu(p[0]/t.worldSize,p[1]/t.worldSize),0),g=(d+y)/2,x=(f+m)/2;return g>x?f=t.gl.NEAREST_MIPMAP_NEAREST}),e.uploaded=!0,e.image=null);}function em(e,t,r){e.indexBuffer=t.createIndexBuffer(e.indexArray,!1,!0),e.vertexBuffer=t.createVertexBuffer(e.vertexArray,Ef.members,!1,!0),e.normalArray&&(e.normalBuffer=t.createVertexBuffer(e.normalArray,Df.members,!1,!0)),e.texcoordArray&&(e.texcoordBuffer=t.createVertexBuffer(e.texcoordArray,Cf.members,!1,!0)),e.colorArray&&(e.colorBuffer=t.createVertexBuffer(e.colorArray,(12===e.colorArray.bytesPerElement?Vf:Ff).members,!1,!0)),e.featureArray&&(e.pbrBuffer=t.createVertexBuffer(e.featureArray,Lf.members,!0)),e.segments=hl.simpleSegment(0,0,e.vertexArray.length,e.indexArray.length);const n=e.material;n.pbrMetallicRoughness.baseColorTexture&&Qf(n.pbrMetallicRoughness.baseColorTexture,t),n.pbrMetallicRoughness.metallicRoughnessTexture&&Qf(n.pbrMetallicRoughness.metallicRoughnessTexture,t),n.normalTexture&&Qf(n.normalTexture,t),n.occlusionTexture&&Qf(n.occlusionTexture,t,r),n.emissionTexture&&Qf(n.emissionTexture,t);}function tm(e,t,r){if(e.meshes)for(const n of e.meshes)em(n,t,r);if(e.children)for(const n of e.children)tm(n,t,r);}function rm(e){if(e.meshes)for(const t of e.meshes)t.indexArray.destroy(),t.vertexArray.destroy(),t.colorArray&&t.colorArray.destroy(),t.normalArray&&t.normalArray.destroy(),t.texcoordArray&&t.texcoordArray.destroy(),t.featureArray&&t.featureArray.destroy();if(e.children)for(const t of e.children)rm(t);}function nm(e){if(e.meshes)for(const r of e.meshes)r.vertexBuffer&&(r.vertexBuffer.destroy(),r.indexBuffer.destroy(),r.normalBuffer&&r.normalBuffer.destroy(),r.texcoordBuffer&&r.texcoordBuffer.destroy(),r.colorBuffer&&r.colorBuffer.destroy(),r.pbrBuffer&&r.pbrBuffer.destroy(),r.segments.destroy(),r.material&&((t=r.material).pbrMetallicRoughness.baseColorTexture&&t.pbrMetallicRoughness.baseColorTexture.gfxTexture&&t.pbrMetallicRoughness.baseColorTexture.gfxTexture.destroy(),t.pbrMetallicRoughness.metallicRoughnessTexture&&t.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture&&t.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture.destroy(),t.normalTexture&&t.normalTexture.gfxTexture&&t.normalTexture.gfxTexture.destroy(),t.emissionTexture&&t.emissionTexture.gfxTexture&&t.emissionTexture.gfxTexture.destroy(),t.occlusionTexture&&t.occlusionTexture.gfxTexture&&t.occlusionTexture.gfxTexture.destroy()));var t;if(e.children)for(const t of e.children)nm(t);}function im(e,t){const r=e.json.bufferViews[t.bufferView],n=pf[t.componentType];return new n(e.buffers[r.buffer],(t.byteOffset||0)+(r.byteOffset||0),t.count*(r.byteStride&&r.byteStride!==ff[t.type]*n.BYTES_PER_ELEMENT?r.byteStride/n.BYTES_PER_ELEMENT:ff[t.type]))}function sm(e,t,r,n){const i=pf[t.componentType],s=function(e){switch(e){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:return 1}}(i),o=e.json.bufferViews[t.bufferView],a=o.byteStride?o.byteStride/i.BYTES_PER_ELEMENT:ff[t.type],l=r.float32,u=l.length/r.capacity;for(let e=0,r=0;e0){for(let i=0;i0){s.texcoordArray=new ja;const e=t.json.accessors[i.TEXCOORD_0];s.texcoordArray.resize(e.count);const r=im(t,e);sm(t,e,s.texcoordArray,r);}if(void 0!==i._FEATURE_ID_RGBA4444){const e=t.json.accessors[i._FEATURE_ID_RGBA4444];t.json.extensionsUsed&&t.json.extensionsUsed.includes("EXT_meshopt_compression")&&(s.featureData=im(t,e));}void 0!==i._FEATURE_RGBA4444&&(s.featureData=new Uint32Array(im(t,t.json.accessors[i._FEATURE_RGBA4444]).buffer));const h=e.material;return s.material=function(e,t){const{emissiveFactor:r=[0,0,0],alphaMode:n="OPAQUE",alphaCutoff:i=.5,normalTexture:s,occlusionTexture:o,emissiveTexture:a,doubleSided:l,name:u}=e,{baseColorFactor:c=[1,1,1,1],metallicFactor:h=1,roughnessFactor:p=1,baseColorTexture:d,metallicRoughnessTexture:f}=e.pbrMetallicRoughness||{},m=o?t[o.index]:void 0;if(o&&o.extensions&&o.extensions.KHR_texture_transform&&m){const e=o.extensions.KHR_texture_transform;m.offsetScale=[e.offset[0],e.offset[1],e.scale[0],e.scale[1]];}return {name:u,pbrMetallicRoughness:{baseColorFactor:new lr(...c),metallicFactor:h,roughnessFactor:p,baseColorTexture:d?t[d.index]:void 0,metallicRoughnessTexture:f?t[f.index]:void 0},doubleSided:l,emissiveFactor:new lr(...r),alphaMode:n,alphaCutoff:i,normalTexture:s?t[s.index]:void 0,occlusionTexture:m,emissionTexture:a?t[a.index]:void 0,defined:void 0===e.defined}}(void 0!==h?t.json.materials[h]:{defined:!1},r),s}function am(e,t,r){const{matrix:n,rotation:i,translation:s,scale:o,mesh:a,extras:u,children:c,name:h}=e,p={};if(p.name=h,p.localMatrix=n||function(e,t,r,n){var i=t[0],s=t[1],o=t[2],a=t[3],l=i+i,u=s+s,c=o+o,h=i*l,p=i*u,d=i*c,f=s*u,m=s*c,y=o*c,g=a*l,x=a*u,v=a*c,b=n[0],w=n[1],_=n[2];return e[0]=(1-(f+y))*b,e[1]=(p+v)*b,e[2]=(d-x)*b,e[3]=0,e[4]=(p-v)*w,e[5]=(1-(h+y))*w,e[6]=(m+g)*w,e[7]=0,e[8]=(d+x)*_,e[9]=(m-g)*_,e[10]=(1-(h+f))*_,e[11]=0,e[12]=r[0],e[13]=r[1],e[14]=r[2],e[15]=1,e}([],i||[0,0,0,1],s||[0,0,0],o||[1,1,1]),p.globalMatrix=l(p.localMatrix),void 0!==a){p.meshes=r[a];const e=p.anchor=[0,0];for(const t of p.meshes){const{min:r,max:n}=t.aabb;e[0]+=r[0]+n[0],e[1]+=r[1]+n[1];}e[0]=Math.floor(e[0]/p.meshes.length/2),e[1]=Math.floor(e[1]/p.meshes.length/2);}if(u&&(u.id&&(p.id=u.id),u.lights&&(p.lights=function(e){if(!e.length)return [];const t=function(e){const t=atob(e),r=new Uint8Array(t.length);for(let e=0;e1&&n[n.length-1].equals(n[0])&&n.pop();let i=0;for(let e=0;e0&&n.reverse();const s=Th(n.flatMap((e=>[e.x,e.y])),[]);return 0===s.length?null:{vertices:n,indices:s}}function cm(e,t){const r=[],n=[];let i=0;const s=[];for(const o of e){i=r.length;const e=o.vertexArray.float32,a=o.indexArray.uint16;for(let n=0;n0&&([n[e+1],n[e+2]]=[n[e+2],n[e+1]]);}return {vertices:r,indices:n}}function hm(e){const t=function(e,t){const r=[],n=WebGL2RenderingContext;if(e.json.textures)for(const i of e.json.textures){const s={magFilter:n.LINEAR,minFilter:n.NEAREST,wrapS:n.REPEAT,wrapT:n.REPEAT};void 0!==i.sampler&&Object.assign(s,e.json.samplers[i.sampler]),r.push({image:t[i.source],sampler:s,uploaded:!1});}return r}(e,e.images),r=function(e,t){const r=[];for(const n of e.json.meshes){const i=[];for(const r of n.primitives)i.push(om(r,e,t));r.push(i);}return r}(e,t),{scenes:n,scene:i,nodes:s}=e.json,o=n?n[i||0].nodes:[...s.keys()],a=[];for(const t of o)a.push(am(s[t],e,r));return function(e,t,r){const n={},i=new Set;for(let s=0;s0){const t=Array.from(i.values()).sort(((e,t)=>e-t));for(let r=t.length-1;r>=0;r--)e.splice(t[r],1);}}(a,o,e.json.nodes),a}function pm(e){e.heightmap=new Float32Array(4096),e.heightmap.fill(-1);const t=e.vertexArray.float32,r=e.aabb.min[0]-1,n=e.aabb.min[1]-1,i=Wf/(e.aabb.max[0]-r+2),s=Wf/(e.aabb.max[1]-n+2);for(let o=0;oe.heightmap[u*Wf+l]&&(e.heightmap[u*Wf+l]=a);}}function dm(e,t,r,n,i){r.reserve(r.length+4*e.length),n.reserve(n.length+10*e.length),i.reserve(i.length+10*e.length);let s=n.length;for(const o of e){const e=Math.min(10,Math.max(4,1.3*o.height))*t,a=[-o.normal[1],o.normal[0],0],l=Math.min(.29,.1*o.width/o.depth),u=o.width-2*o.depth*t*(l+.01),c=V([],o.pos,a,u/2),h=V([],o.pos,a,-u/2),p=[c[0],c[1],c[2]+o.height],d=[h[0],h[1],h[2]+o.height],f=V([],o.normal,a,l);E(f,f,e);const m=V([],o.normal,a,-l);E(m,m,e),P(f,c,f),P(m,h,m),c[2]+=.1,h[2]+=.1,n.emplaceBack(f[0],f[1],f[2]),n.emplaceBack(m[0],m[1],m[2]),n.emplaceBack(c[0],c[1],c[2]),n.emplaceBack(h[0],h[1],h[2]),n.emplaceBack(p[0],p[1],p[2]),n.emplaceBack(d[0],d[1],d[2]),n.emplaceBack(c[0],c[1],c[2]),n.emplaceBack(h[0],h[1],h[2]),n.emplaceBack(f[0],f[1],f[2]),n.emplaceBack(m[0],m[1],m[2]);const y=u/e/2;i.emplaceBack(-y-l,-1,y,.8),i.emplaceBack(y+l,-1,y,.8),i.emplaceBack(-y,0,y,1.3),i.emplaceBack(y,0,y,1.3),i.emplaceBack(y+l,-.8,y,.7),i.emplaceBack(y+l,-.8,y,.7),i.emplaceBack(0,0,y,1.3),i.emplaceBack(0,0,y,1.3),i.emplaceBack(y+l,-1.2,y,.8),i.emplaceBack(y+l,-1.2,y,.8),r.emplaceBack(6+s,4+s,8+s),r.emplaceBack(7+s,9+s,5+s),r.emplaceBack(0+s,1+s,2+s),r.emplaceBack(1+s,3+s,2+s),s+=10;}}function fm(e,t){const r={};r.indexArray=new Fa,r.vertexArray=new wa,r.colorArray=new Pa,dm(e,t,r.indexArray,r.vertexArray,r.colorArray);const n={defined:!0};n.emissiveFactor=lr.black;const i={};return i.baseColorFactor=lr.white,n.pbrMetallicRoughness=i,r.material=n,r.aabb=new Ju([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),r}const mm=ha([{name:"a_pos_3f",components:3,type:"Float32"}]),ym=ha([{name:"a_normal_3",components:3,type:"Int16"}]),gm=ha([{name:"a_centroid_3",components:3,type:"Int16"}]),xm=ha([{name:"a_part_color_emissive",components:2,type:"Uint16"}]),vm=ha([{name:"a_faux_facade_color_emissive",components:2,type:"Uint16"}]),bm=ha([{name:"a_faux_facade_data",components:4,type:"Uint16"}]),wm=ha([{name:"a_faux_facade_vertical_range",components:2,type:"Uint16"}]),_m=ha([{name:"a_bloom_attenuation",components:4,type:"Float32"}]),Am=ha([{name:"a_flood_light_wall_radius_1i16",components:1,type:"Uint16"}]),Mm=Tu.types,Im=32767;function Sm(e,t){const r=Un+t;for(const n of e)for(const e of n)if(e.x<-t||e.x>r||e.y<-t||e.y>r)return !1;return !0}class Pm{constructor(){this.layoutVertexArray=new wa,this.layoutAttenuationArray=new Pa,this.layoutColorArray=new za,this.indexArray=new Fa,this.indexArrayForConflation=new Fa,this.segmentsBucket=new hl;}}class km{constructor(){this.layoutVertexArray=new wa,this.layoutNormalArray=new fa,this.layoutCentroidArray=new fa,this.layoutColorArray=new za,this.layoutFacadePaintArray=null,this.layoutFacadeDataArray=null,this.layoutFacadeVerticalRangeArray=null,this.layoutFloodLightDataArray=new Ga,this.layoutAOArray=new ya,this.indexArray=new Fa,this.indexArrayForConflation=new Fa,this.segmentsBucket=new hl,this.entranceBloom=new Pm;}}class zm{constructor(e){this.colorBufferUploaded=!1,this.maxHeight=0,this.replacementUpdateTime=0,this.activeReplacements=[],this.footprints=[],this.featuresOnBorder=[],this.buildingFeatures=[],this.buildingWithoutFacade=new km,this.buildingWithFacade=new km,this.indexArrayForConflationUploaded=!1,this.featureFootprintLookup=new Map,this.footprintLookup={},this.zoom=e.zoom,this.canonical=e.canonical,this.layers=e.layers,this.layerIds=this.layers.map((e=>e.fqid)),this.index=e.index,this.hasPattern=!1,this.worldview=e.worldview,this.lut=e.lut,this.buildingWithFacade.layoutFacadePaintArray=new za,this.buildingWithFacade.layoutFacadeDataArray=new Aa,this.buildingWithFacade.layoutFacadeVerticalRangeArray=new za,this.programConfigurations=new Ul(e.layers,{zoom:e.zoom,lut:e.lut}),this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id)),this.projection=e.projection,this.groundEffect=new yd(e),this.groundEffect.groundRadiusArray=new ya,this.hasAppearances=null;}updateFootprints(e,t){for(const r of this.footprints)t.push({footprint:r,id:e});}updateAppearances(e,t,r,n){}prepare(){return function(){if(null!=lf||null!=af)return null;if(null!=of)return of;const e=fetch(ot.BUILDING_GEN_URL);return of=function(e){let t,r,n,i;function s(){t=new Uint8Array(i.buffer),r=new Int32Array(i.buffer),n=new Float32Array(i.buffer);}function o(){throw new Error("Unexpected BuildingGen error.")}const a=()=>{},l={a:{a:o,f:function(e){const r=t.length,n=Math.max(e>>>0,Math.ceil(1.2*r)),o=Math.ceil((n-r)/65536);try{return i.grow(o),s(),!0}catch(e){return !1}},g:o,b:a,c:a,d:a,e:a}};return (WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(e,l):e.then((e=>e.arrayBuffer())).then((e=>WebAssembly.instantiate(e,l)))).then((e=>{const o=e.instance.exports;return (0,o.g)(),i=o.f,s(),new Jd({setStyle:o.h,setAOOptions:o.i,setMetricOptions:o.j,setStructuralOptions:o.k,setFacadeOptions:o.l,setFauxFacadeOptions:o.m,setFacadeClassifierOptions:o.n,addFeature:o.o,addFacade:o.p,generateMesh:o.q,getLastError:o.r,getOuterRingLength:o.s,getMeshCount:o.t,getPositionsPtr:o.u,getPositionsLength:o.v,getNormalsPtr:o.w,getNormalsLength:o.x,getColorsPtr:o.y,getColorsLength:o.z,getAOPtr:o.A,getAOLength:o.B,getUVPtr:o.C,getUVLength:o.D,getFauxFacadePtr:o.E,getFauxFacadeLength:o.F,getIndicesPtr:o.G,getIndicesLength:o.H,getBuildingPart:o.I,getRingCount:o.J,getRingPtr:o.K,getRingLength:o.L,free:o.M,malloc:o.N,heapU8:t,heap32:r,heapF32:n})}))}(e).then((e=>(of=null,lf=e,lf))).catch((e=>{Xe("Could not load building-gen"),of=null,af=e;})),of}()}populate(e,t,r,n){const i=hf();if(!i)return;const s=vu(r);this.tileToMeter=s,this.brightness=t.brightness,i.setStyle({convertToMeters:!1,entranceColorRgb:[1,1,1],facadeGlazingColorRgb:[.5607843137254902,.6745098039215687,.7215686274509804],normalScale:[1,-1,s],ridgeHeight:3,roofColorRgb:[.886274516,.784313738,.713725507],tileToMeters:s,tileZoom:16,wallColorRgb:[.988235294,.933333337,.811764717]}),i.setAOOptions(!1,.3),i.setMetricOptions(!1,16),i.setStructuralOptions(!0),i.setFacadeClassifierOptions(3);const o=new Map,a=new Map;for(const{feature:t}of e){if("LineString"!==Mm[t.type]){o.set(t.id,t.properties.source_id);continue}const e=this.layers[0]._featureFilter.needGeometry,i=zu(t,e);if(!this.layers[0]._featureFilter.filter(new Io(this.zoom),i,r))continue;const s=e?i.geometry:ku(t,r,n),l=[];for(const e of s)for(const t of e)l.push({x:t.x,y:t.y});const u={coordinates:l,crossPerc:t.properties.cross_perc,distanceToRoad:t.properties.distance_to_road,entrances:t.properties.entrances,sourceId:0},c=t.properties.source_id;let h=a.get(c);h||(h=[],a.set(c,h)),h.push(u);}this.maxHeight=0;for(const{feature:l,id:u,index:c,sourceLayerIndex:h}of e){if("LineString"===Mm[l.type])continue;const e=this.layers[0]._featureFilter.needGeometry,p=zu(l,e);if(!this.layers[0]._featureFilter.filter(new Io(this.zoom),p,r))continue;const d=e?p.geometry:ku(l,r,n),f=rp(d,500);if(!Sm(d,163))continue;const m=this.layers[0],y=m.layout.get("building-roof-shape").evaluate(l,{},r);if("flat"===y)continue;const g=m.layout.get("building-base").evaluate(l,{},r),x=m.layout.get("building-height").evaluate(l,{},r),v=m.layout.get("building-flood-light-ground-radius").evaluate(l,{},r),b=m.paint.get("building-ambient-occlusion-intensity"),w=v/this.tileToMeter;let _=m.layout.get("building-flood-light-wall-radius").evaluate(l,{},r);_=Fe(_,0,2048);const A=_/2048*Im,M=o.get(u);let I;I=a.has(M)?a.get(M):[];const S=0!==I.length&&m.layout.get("building-facade").evaluate(l,{},r);i.setFacadeOptions(4,!0),i.setFauxFacadeOptions(S,!1,1);let P=0,k=0,z=0,T=0,B=0,E=0;if(S){let e=Math.round(m.layout.get("building-facade-floors").evaluate(l,{},r));if(0===g){e=Math.max(1,e-(I.length>0?1:0));let t=4;if(x>100){const e=[10,13,15];t=e[l.id?l.id%e.length:0],i.setFacadeOptions(t,!0);}B=1.6803*t/s;}else B=g/s;E=x/s,B=Math.min(B,E),z=m.layout.get("building-facade-unit-width").evaluate(l,{},r)/s,T=(E-B)/e,i.setFauxFacadeOptions(!0,!0,z);const t=m.layout.get("building-facade-window").evaluate(l,{},r);P=t[0],k=t[1];}const V=[],F=new Me(1/0,1/0),C=new Me(-1/0,-1/0),D=new Me(0,0);let R=0;for(const e of f)if(e.length>0){const t=[];for(const r of e){const e=[];for(let t=r.length-1;t>=0;t--){const n=r[t];e.push({x:n.x,y:n.y}),F.x=Math.min(F.x,n.x),F.y=Math.min(F.y,n.y),C.x=Math.max(C.x,n.x),C.y=Math.max(C.y,n.y),D.x+=n.x,D.y+=n.y,R++;}t.push(e);}V.push({id:l.id?l.id:0,height:x,minHeight:g,sourceId:0,roofType:y,coordinates:t});}D.x/=R||1,D.y/=R||1;const L=i.generateMesh(V,I);if("string"==typeof L){Xe(`Unable to generate building ${l.id}: ${L}`);continue}if(0===L.meshes.length||0===L.modifiedPolygonRings.length)continue;let O=0;for(const e of L.meshes)O+=e.positions.length/3;const U=S?this.buildingWithFacade:this.buildingWithoutFacade,N=U.segmentsBucket.prepareSegment(O,U.layoutVertexArray,U.indexArray),j=[];let $=null,G=0,q=-1;const H=U.layoutVertexArray.length,X=U.indexArray.length;let Z=0;for(const e of L.meshes){const t=U.layoutVertexArray.length;if("entrance"===e.buildingPart){const t=new Array;for(let r=0;rUn||F.y<0||C.y>Un)&&this.featuresOnBorder.push({featureId:l.id,footprintIndex:this.footprints.length});{const e=Th(Y,null,2),t=new Ip(K,e,8,256);let r=l.id;l.properties&&l.properties.hasOwnProperty("building_id")&&(r=l.properties.building_id);const n={vertices:K,indices:e,grid:t,min:J,max:Q,buildingId:r,hiddenFlags:0,indicesOffset:X,indicesLength:W,bloomIndicesOffset:G,bloomIndicesLength:q,groundEffectVertexOffset:ee,groundEffectVertexLength:te,hasFauxFacade:S,segment:N,height:Z};void 0!==l.id&&this.featureFootprintLookup.set(l.id,this.footprints.length),this.footprints.push(n);}this.programConfigurations.populatePaintArrays(U.layoutVertexArray.length,l,c,{},t.availableImages,r,t.brightness),this.groundEffect.addPaintPropertiesData(l,c,{},t.availableImages,r,t.brightness),t.featureIndex.insert(l,d,c,h,this.index,H);}this.groundEffect.prepareBorderSegments(),this.evaluate(this.layers[0],{});}update(e,t,r,n,i,s,o){this.programConfigurations.updatePaintArrays(e,t,i,r,n,s,o),this.groundEffect.update(e,t,i,r,n,s,o),this.evaluate(this.layers[0],e),this.colorBufferUploaded=!1;}isEmpty(){return 0===this.buildingWithoutFacade.layoutVertexArray.length&&0===this.buildingWithFacade.layoutVertexArray.length}uploadPending(){return !this.uploaded||this.programConfigurations.needsUpload||this.groundEffect.programConfigurations.needsUpload}upload(e){const t=t=>{t.layoutVertexBuffer=e.createVertexBuffer(t.layoutVertexArray,mm.members),t.layoutNormalBuffer=e.createVertexBuffer(t.layoutNormalArray,ym.members),t.layoutCentroidBuffer=e.createVertexBuffer(t.layoutCentroidArray,gm.members),t.layoutFloodLightDataBuffer=e.createVertexBuffer(t.layoutFloodLightDataArray,Am.members),t.layoutFacadeDataArray&&t.layoutFacadeDataArray.length&&(t.layoutFacadeDataBuffer=e.createVertexBuffer(t.layoutFacadeDataArray,bm.members)),t.layoutFacadeVerticalRangeArray&&t.layoutFacadeVerticalRangeArray.length&&(t.layoutFacadeVerticalRangeBuffer=e.createVertexBuffer(t.layoutFacadeVerticalRangeArray,wm.members)),t.entranceBloom.layoutVertexArray.length&&(t.entranceBloom.layoutVertexBuffer=e.createVertexBuffer(t.entranceBloom.layoutVertexArray,mm.members),t.entranceBloom.layoutAttenuationBuffer=e.createVertexBuffer(t.entranceBloom.layoutAttenuationArray,_m.members)),this.uploadUpdatedColorBuffer(e),this.uploadUpdatedIndexBuffer(e);};this.uploaded||(t(this.buildingWithoutFacade),t(this.buildingWithFacade),this.groundEffect.upload(e)),this.groundEffect.uploadPaintProperties(e),this.programConfigurations.upload(e),this.uploaded=!0;}destroy(){const e=e=>{e.layoutVertexBuffer&&(e.layoutVertexBuffer.destroy(),e.layoutNormalBuffer.destroy(),e.layoutColorBuffer.destroy(),e.segmentsBucket.destroy(),e.indexBuffer&&e.indexBuffer.destroy(),e.entranceBloom.layoutVertexBuffer&&(e.entranceBloom.layoutVertexBuffer.destroy(),e.entranceBloom.layoutColorBuffer.destroy(),e.entranceBloom.layoutAttenuationBuffer.destroy(),e.entranceBloom.indexBuffer.destroy(),e.entranceBloom.segmentsBucket.destroy()));};e(this.buildingWithoutFacade),e(this.buildingWithFacade),this.groundEffect.destroy(),this.programConfigurations.destroy();}updateFootprintHiddenFlags(e,t,r=!0){let n=!1;const i=r?t:0,s=0|(r?-1:~t);0===this.groundEffect.hiddenByLandmarkVertexArray.length&&this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length);for(const t of e){const e=this.footprints[t],r=e.hiddenFlags&s|i;e.hiddenFlags!==r&&(e.hiddenFlags=r,n=!0,this.groundEffect.updateHiddenByLandmarkRange(e.groundEffectVertexOffset,e.groundEffectVertexLength,0!==e.hiddenFlags));}return n&&(this.indexArrayForConflationUploaded=!1),n}uploadUpdatedIndexBuffer(e){if(this.groundEffect.uploadHiddenByLandmark(e),this.indexArrayForConflationUploaded)return;const t=e=>{0!==e.indexArray.length&&(e.indexArrayForConflation.resize(e.indexArray.length),e.indexArrayForConflation.uint16.set(e.indexArray.uint16),e.entranceBloom.indexArrayForConflation.resize(e.entranceBloom.indexArray.length),e.entranceBloom.indexArrayForConflation.uint16.set(e.entranceBloom.indexArray.uint16));};t(this.buildingWithoutFacade),t(this.buildingWithFacade);for(const e of this.footprints){const t=e.hasFauxFacade?this.buildingWithFacade:this.buildingWithoutFacade,r=e.indicesOffset+e.indicesLength;if(0!==e.hiddenFlags){for(let n=e.indicesOffset;n{0!==t.indexArray.length&&(t.indexBuffer?t.indexBuffer.updateData(t.indexArrayForConflation):t.indexBuffer=e.createIndexBuffer(t.indexArrayForConflation,!0),t.entranceBloom.indexBuffer?t.entranceBloom.indexBuffer.updateData(t.entranceBloom.indexArrayForConflation):t.entranceBloom.indexBuffer=e.createIndexBuffer(t.entranceBloom.indexArrayForConflation,!0));};r(this.buildingWithoutFacade),r(this.buildingWithFacade),this.indexArrayForConflationUploaded=!0;}uploadUpdatedColorBuffer(e){const t=t=>{t.layoutColorBuffer?t.layoutColorBuffer.updateData(t.layoutColorArray):t.layoutColorBuffer=e.createVertexBuffer(t.layoutColorArray,xm.members,!0),t.layoutFacadePaintArray&&(t.layoutFacadePaintBuffer?t.layoutFacadePaintBuffer.updateData(t.layoutFacadePaintArray):t.layoutFacadePaintBuffer=e.createVertexBuffer(t.layoutFacadePaintArray,vm.members,!0)),t.entranceBloom.layoutColorBuffer?t.entranceBloom.layoutColorBuffer.updateData(t.entranceBloom.layoutColorArray):t.entranceBloom.layoutColorBuffer=e.createVertexBuffer(t.entranceBloom.layoutColorArray,xm.members,!0);};t(this.buildingWithoutFacade),t(this.buildingWithFacade),this.colorBufferUploaded=!0;}evaluate(e,t){const r=e.paint.get("building-ambient-occlusion-intensity");for(const n of this.buildingFeatures){const i=t[n.promoteId],s=n.feature;s.properties["building-part"]="roof";const o=e.paint.get("building-color").evaluate(s,i,this.canonical).toPremultipliedRenderColor(this.lut),a=e.paint.get("building-emissive-strength").evaluate(s,i,this.canonical);s.properties["building-part"]="wall";const l=e.paint.get("building-color").evaluate(s,i,this.canonical).toPremultipliedRenderColor(this.lut),u=e.paint.get("building-emissive-strength").evaluate(s,i,this.canonical);s.properties["building-part"]="window";const c=e.paint.get("building-color").evaluate(s,i,this.canonical).toPremultipliedRenderColor(this.lut),h=e.paint.get("building-emissive-strength").evaluate(s,i,this.canonical);s.properties["building-part"]="door";const p=e.paint.get("building-color").evaluate(s,i,this.canonical).toPremultipliedRenderColor(this.lut),d=e.paint.get("building-emissive-strength").evaluate(s,i,this.canonical),f=n.hasFauxFacade?this.buildingWithFacade:this.buildingWithoutFacade;for(const e of n.parts){let t,i=o;"roof"===e.part?(i=o,t=a):"wall"===e.part?(i=l,t=u):"facade_glazing"===e.part?(i=c,t=h):"entrance"===e.part&&(i=p,t=d),t=Fe(t,0,1);for(let s=0;st.max.x||n.max.xt.max.y||n.max.yo.max.x||o.min.x>e||t>o.max.y||o.min.y>t||o.height<=r||Zp(s,o)&&(r=o.height,this.footprintLookup[i]=o,n=0!==o.hiddenFlags);if(r!==Number.NEGATIVE_INFINITY)return {height:r,hidden:n};this.footprintLookup[i]=void 0;}}function Tm(e,t,r,n,i,s){const o=Math.pow(2,n.z-i.z);for(let a=0;a1&&(o=e[++s]);const l=Math.abs(a-o.left),u=Math.abs(a-o.right),c=Math.min(l,u);let h;const p=t/r*(n+1);if(o.isDash){const e=n-Math.abs(p);h=Math.sqrt(c*c+e*e);}else h=n-Math.sqrt(c*c+p*p);this.image.data[i+a]=Math.max(0,Math.min(255,h+128));}}}addRegularDash(e,t){for(let t=e.length-1;t>=0;--t){const r=e[t],n=e[t+1];r.zeroLength?e.splice(t,1):n&&n.isDash===r.isDash&&(n.left=r.left,e.splice(t,1));}const r=e[0],n=e[e.length-1];r.isDash===n.isDash&&(r.left=n.left-this.width,n.right=r.right+this.width);const i=this.width*this.nextRow;let s=0,o=e[s];for(let r=0;r1&&(o=e[++s]);const n=Math.abs(r-o.left),a=Math.abs(r-o.right),l=Math.min(n,a);this.image.data[i+r]=Math.max(0,Math.min(255,(o.isDash?l:-l)+t+128));}}addDash(e,t){const r=this.getKey(e,t);if(this.positions[r])return this.positions[r];const n="round"===t,i=n?7:0,s=2*i+1;if(this.nextRow+s>this.height)return Xe("LineAtlas out of space"),null;0===e.length&&e.push(1);let o=0;for(let t=0;te.fqid)),this.index=e.index,this.projection=e.projection,this.hasPattern=!1,this.hasCrossSlope=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach((e=>{this.gradients[e.id]={};})),this.layoutVertexArray=new ba,this.layoutVertexArray2=new wa,this.patternVertexArray=new wa,this.indexArray=new Fa,this.programConfigurations=new Ul(e.layers,{zoom:e.zoom,lut:e.lut}),this.segments=new hl,this.maxLineLength=0,this.zOffsetVertexArray=new wa,this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id)),this.tessellationStep=e.tessellationStep?e.tessellationStep:Un/64,this.worldview=e.worldview,this.hasAppearances=null;}updateFootprints(e,t){}updateAppearances(e,t,r,n){}populate(e,t,r,n){this.hasPattern=sp("line",this.layers,this.pixelRatio,t);const i=this.layers[0].layout.get("line-sort-key");this.tileToMeter=vu(r);const s=this.layers[0].layout.get("line-elevation-reference");if("hd-road-markup"===s)this.elevationType="road";else {const e=this.layers[0].layout.get("line-z-offset"),t=e.isConstant()&&!e.constantOr(0);this.elevationType="sea"!==s&&"ground"!==s&&t?"none":"offset","offset"===this.elevationType&&"none"===s&&Xe(`line-elevation-reference: ground is used for the layer ${this.layerIds[0]} because non-zero line-z-offset value was found.`);}const o=this.layers[0].layout.get("line-cross-slope");this.hasCrossSlope="offset"===this.elevationType&&void 0!==o;const a=[];for(const{feature:s,id:o,index:l,sourceLayerIndex:u}of e){const e=this.layers[0]._featureFilter.needGeometry,c=zu(s,e);if(!this.layers[0]._featureFilter.filter(new Io(this.zoom,{worldview:this.worldview,activeFloors:t.activeFloors}),c,r))continue;const h=i?i.evaluate(c,{},r):void 0,p={id:o,properties:s.properties,type:s.type,sourceLayerIndex:u,index:l,geometry:e?c.geometry:ku(s,r,n),patterns:{},sortKey:h};a.push(p);}i&&a.sort(((e,t)=>e.sortKey-t.sortKey));const{lineAtlas:l,featureIndex:u}=t,c=this.addConstantDashes(l);for(const n of a){const{geometry:i,index:s,sourceLayerIndex:o}=n;if(c&&this.addFeatureDashes(n,l),this.hasPattern){const e=op("line",this.layers,n,this.zoom,this.pixelRatio,t);this.patternFeatures.push(e);}else this.addFeature(n,i,s,r,l.positions,t.availableImages,t.brightness,t.elevationFeatures);u.insert(e[s].feature,i,s,o,this.index);}}addConstantDashes(e){let t=!1;for(const r of this.layers){const n=r.paint.get("line-dasharray").value,i=r.layout.get("line-cap").value;if("constant"!==n.kind||"constant"!==i.kind)t=!0;else {const t=i.value,r=n.value;if(!r)continue;e.addDash(r,t);}}return t}addFeatureDashes(e,t){const r=this.zoom;for(const n of this.layers){const i=n.paint.get("line-dasharray").value,s=n.layout.get("line-cap").value;if("constant"===i.kind&&"constant"===s.kind)continue;let o,a;if("constant"===i.kind){if(o=i.value,!o)continue}else o=i.evaluate({zoom:r},e);a="constant"===s.kind?s.value:s.evaluate({zoom:r},e),t.addDash(o,a),e.patterns[n.id]=[t.getKey(o,a)];}}update(e,t,r,n,i,s,o,a){this.programConfigurations.updatePaintArrays(e,t,i,r,n,s,o,a);}addFeatures(e,t,r,n,i,s){for(const e of this.patternFeatures)this.addFeature(e,e.geometry,e.index,t,r,n,s);}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return !this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(0!==this.layoutVertexArray2.length&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,Rm)),0!==this.patternVertexArray.length&&(this.patternVertexBuffer=e.createVertexBuffer(this.patternVertexArray,Om)),!this.zOffsetVertexBuffer&&this.zOffsetVertexArray.length>0&&(this.zOffsetVertexBuffer=e.createVertexBuffer(this.zOffsetVertexArray,Fm.members,!0)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Cm),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0;}destroy(){this.layoutVertexBuffer&&(this.zOffsetVertexBuffer&&this.zOffsetVertexBuffer.destroy(),this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy());}lineFeatureClips(e,t){let r,n;if(t&&t>0?(r=`mapbox_clip_start_${t}`,n=`mapbox_clip_end_${t}`):(r="mapbox_clip_start",n="mapbox_clip_end"),e.properties&&e.properties.hasOwnProperty(r)&&e.properties.hasOwnProperty(n))return {start:+e.properties[r],end:+e.properties[n]}}addFeature(e,t,r,n,i,s,o,a){const l=this.layers[0].layout,u=l.get("line-join").evaluate(e,{}),c=l.get("line-cap").evaluate(e,{}),h=l.get("line-miter-limit"),p=l.get("line-round-limit");this.lineClips=this.lineFeatureClips(e),this.lineFeature=e;const d=!(!e.properties||!e.properties.hasOwnProperty("mapbox_line_metrics"))&&e.properties.mapbox_line_metrics;this.zOffsetValue=l.get("line-z-offset").value;const f=this.layers[0].paint.get("line-width").value;if("constant"!==f.kind&&!1===f.isLineProgressConstant&&(this.variableWidthValue=f),"road"===this.elevationType){const r=this.layoutVertexArray.length;if(!this.addElevatedRoadFeature(e,t,n,a,u,c,h,p)){const[i,s]=this.clipRuntimeLinesToTile(t,1);for(let t=0;t0?o.parentIndex:null);}this.fillNonElevatedRoadSegment(r);}}else for(let r=0;r0?r:null);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,r,i,s,n,o,void 0,this.worldview);}computeSegNextDir(e,t){return e.nextPoint.sub(t.at(-2)).unit()}computeSegPrevDir(e,t){return t[1].sub(e.prevPoint).unit()}clipLinesToTile(e,t){return Fd(e,-t,-t,Un+t,Un+t)}clipRuntimeLinesToTile(e,t){const r=[];return [Fd(e,-t,-t,Un+t,Un+t,r),r]}addElevatedRoadFeature(e,t,r,n,i,s,o,a){const l=[],u=tc.getElevationFeature(e,n);if(u){const e=this.clipLinesToTile(t,1),n=this.prepareElevatedLines(e,u,r);for(const e of n)l.push({geometry:e,elevation:u,elevationTileID:r,segment:{progress:{min:0,max:1},nextDir:void 0,prevDir:void 0}});}if(0===l.length)return !1;for(const t of l){const n=this.layoutVertexArray.length;this.addLine(t.geometry,e,r,i,s,o,a);const l=new rc(r,t.elevationTileID);if(t.elevation)for(let e=n;e>1,this.layoutVertexArray.int16[6*e+1]>>1),n=l.pointElevation(r,t.elevation,.05);this.updateHeightRange(n),this.zOffsetVertexArray.emplaceBack(n,0,0);}else this.fillNonElevatedRoadSegment(n);}return !0}prepareElevatedLines(e,t,r){if(null!=t.constantHeight)return e;const n=[],i=1/vu(r);for(const r of e)Cd(r,new Qu(t,i),0,n);return n}fillNonElevatedRoadSegment(e){for(let t=e;t0,h=a&&a.progress.max<1;if(this.lineClips){let r={min:this.lineClips.start,max:this.lineClips.end},n=1;if(a){const e=this.lineClips.end-this.lineClips.start;r=function(e,t,r){return {min:st(e.min,t,r),max:st(e.max,t,r)}}(a.progress,{min:0,max:1},r),e>0&&(n=(r.max-r.min)/e);}const i=+t.properties.mapbox_clip_feature_len,s=+t.properties.mapbox_clip_seg_len;if(Number.isNaN(i)||Number.isNaN(s)){for(let t=0;t=2&&e[d-1].equals(e[d-2]);)d--;let f=0;for(;f0,T=this.overscaling<=16?15*Un/(512*this.overscaling):0;if(r&&"round"===a)if(Ss&&(a="bevel"),"bevel"===a&&(S>2&&(a="flipbevel"),S2*T){const t=y.sub(y.sub(g)._mult(T/e)._round());this.updateDistance(g,t),this.addCurrentVertex(t,v,0,0,m,A),g=t;}this.updateDistance(g,y),M._mult(S),this.addCurrentVertex(y,M,0,0,m,A);const t=y.dist(x);if(t>2*T){const e=y.add(x.sub(y)._mult(T/t)._round());this.updateDistance(y,e),this.addCurrentVertex(e,b,0,0,m,A),y=e;}}else M._mult(S),this.addCurrentVertex(y,M,0,0,m,A);else if("flipbevel"===a){if(S>100)M=b.mult(-1);else {const e=S*v.add(b).mag()/v.sub(b).mag();M._perp()._mult(e*(z?-1:1));}this.addCurrentVertex(y,M,0,0,m,A),this.addCurrentVertex(y,M.mult(-1),0,0,m,A);}else if("bevel"===a||"fakeround"===a){null!=A&&g&&this.addCurrentVertex(y,_||v,-1,-1,m,A);const e=y.dist(g)<=2*T&&"bevel"!==a,t=M.mult(z?1:-1);t._mult(S);const r=b.mult(z?-1:1),n=v.mult(z?-1:1),i=this.evaluateLineProgressFeatures(this.distance);if(null==A&&(this.addHalfVertex(y,t.x,t.y,!1,!z,0,m,i),e||this.addHalfVertex(y,t.x+2*n.x,t.y+2*n.y,!1,z,0,m,i)),"fakeround"===a){const e=Math.round(180*P/Math.PI/20);this.addHalfVertex(y,n.x,n.y,!1,z,0,m,i);for(let t=0;t1){this.lineSoFar=e.w;const p=(t.x-e.x)/c,d=(t.y-e.y)/c,f=(t.z-e.z)/c,m=(t.w-e.w)/c;for(let t=1;t=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,u),a.primitiveLength++),s?this.e2=u:this.e1=u,null!=l&&this.zOffsetVertexArray.emplaceBack(l.zOffset,l.variableWidth,l.variableWidth);}updateScaledDistance(){this.lineClips?(this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=this.totalFeatureLength*this.lineClips.start+this.distance):this.lineSoFar=this.distance;}updateDistance(e,t){this.prevDistance=this.distance,this.distance+=e.dist(t),this.updateScaledDistance();}}function qm(e,t,r){return e.xr||e.yr}let Hm,Xm;function Zm(e,t,r){return t*(Un/(e.tileSize*Math.pow(2,r-e.tileID.overscaledZ)))}Qs(Gm,"LineBucket",{omit:["layers","patternFeatures","currentVertex","currentVertexIsOutside"]});const Wm=(e,t,r)=>(1-r)*e+r*t;function Ym(e,t){return 1/Zm(e,1,t.tileZoom)}function Km(e,t,r,n){return e.translatePosMatrix(n||t.tileID.projMatrix,t,r.paint.get("line-translate"),r.paint.get("line-translate-anchor"))}const Jm=e=>{const t=[];Qm(e)&&t.push("RENDER_LINE_DASH"),e.paint.get("line-gradient")&&t.push("RENDER_LINE_GRADIENT");const r=e.paint.get("line-trim-offset");0===r[0]&&0===r[1]||t.push("RENDER_LINE_TRIM_OFFSET"),0!==e.paint.get("line-border-width").constantOr(1)&&t.push("RENDER_LINE_BORDER");const n="none"===e.layout.get("line-join").constantOr("miter"),i=!!e.paint.get("line-pattern").constantOr(1);return n&&i&&t.push("LINE_JOIN_NONE"),t};function Qm(e){const t=e.paint.get("line-dasharray").value;return "constant"!==t.kind||t.value}let ey;const ty=()=>ey||(ey={layout:Hm||(Hm=new Ro({"line-cap":new Co(Lo.layout_line["line-cap"]),"line-join":new Co(Lo.layout_line["line-join"]),"line-miter-limit":new Fo(Lo.layout_line["line-miter-limit"]),"line-round-limit":new Fo(Lo.layout_line["line-round-limit"]),"line-sort-key":new Co(Lo.layout_line["line-sort-key"]),"line-z-offset":new Co(Lo.layout_line["line-z-offset"]),"line-elevation-reference":new Fo(Lo.layout_line["line-elevation-reference"]),"line-cross-slope":new Fo(Lo.layout_line["line-cross-slope"]),visibility:new Fo(Lo.layout_line.visibility),"line-width-unit":new Fo(Lo.layout_line["line-width-unit"])})),paint:Xm||(Xm=new Ro({"line-opacity":new Co(Lo.paint_line["line-opacity"]),"line-color":new Co(Lo.paint_line["line-color"]),"line-translate":new Fo(Lo.paint_line["line-translate"]),"line-translate-anchor":new Fo(Lo.paint_line["line-translate-anchor"]),"line-width":new Co(Lo.paint_line["line-width"]),"line-gap-width":new Co(Lo.paint_line["line-gap-width"]),"line-offset":new Co(Lo.paint_line["line-offset"]),"line-blur":new Co(Lo.paint_line["line-blur"]),"line-dasharray":new Co(Lo.paint_line["line-dasharray"]),"line-pattern":new Co(Lo.paint_line["line-pattern"]),"line-pattern-cross-fade":new Fo(Lo.paint_line["line-pattern-cross-fade"]),"line-gradient":new Do(Lo.paint_line["line-gradient"]),"line-trim-offset":new Fo(Lo.paint_line["line-trim-offset"]),"line-trim-fade-range":new Fo(Lo.paint_line["line-trim-fade-range"]),"line-trim-color":new Fo(Lo.paint_line["line-trim-color"]),"line-emissive-strength":new Fo(Lo.paint_line["line-emissive-strength"]),"line-border-width":new Co(Lo.paint_line["line-border-width"]),"line-border-color":new Co(Lo.paint_line["line-border-color"]),"line-occlusion-opacity":new Fo(Lo.paint_line["line-occlusion-opacity"]),"line-color-use-theme":new Co({type:"string",default:"default","property-type":"data-driven"}),"line-gradient-use-theme":new Co({type:"string",default:"default","property-type":"data-driven"}),"line-trim-color-use-theme":new Co({type:"string",default:"default","property-type":"data-driven"}),"line-border-color-use-theme":new Co({type:"string",default:"default","property-type":"data-driven"})}))},ey);class ry extends Co{possiblyEvaluate(e,t){return t=new Io(Math.floor(t.zoom),{now:t.now,fadeDuration:t.fadeDuration,transition:t.transition,worldview:t.worldview}),super.possiblyEvaluate(e,t)}evaluate(e,t,r,n){return t=Object.assign({},t,{zoom:Math.floor(t.zoom)}),super.evaluate(e,t,r,n)}}let ny;function iy(e,t){return t>0?t+2*e:e}const sy=ha([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_tex_size",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),oy=ha([{name:"a_globe_anchor",components:3,type:"Int16"},{name:"a_globe_normal",components:3,type:"Float32"}],4),ay=ha([{name:"a_projected_pos",components:4,type:"Float32"}],4);ha([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const ly=ha([{name:"a_auto_z_offset",components:1,type:"Float32"}],4),uy=ha([{name:"a_x_axis",components:3,type:"Float32"},{name:"a_y_axis",components:3,type:"Float32"}]),cy=ha([{name:"a_texb",components:2,type:"Uint16"}]),hy=ha([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_elevation_from_sea",components:2,type:"Float32"}]),py=ha([{name:"a_size_scale",components:1,type:"Float32"},{name:"a_padding",components:2,type:"Float32"},{name:"a_auto_z_offset",components:1,type:"Float32"}]);ha([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Int16",name:"tileAnchorX"},{type:"Int16",name:"tileAnchorY"},{type:"Float32",name:"x1"},{type:"Float32",name:"y1"},{type:"Float32",name:"x2"},{type:"Float32",name:"y2"},{type:"Int16",name:"padding"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);const dy=ha([{name:"a_pos",components:3,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),fy=ha([{name:"a_pos_2f",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);ha([{name:"triangle",components:3,type:"Uint16"}]),ha([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Float32",name:"tileAnchorX"},{type:"Float32",name:"tileAnchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"},{type:"Uint8",name:"flipState"}]),ha([{type:"Float32",name:"tileAnchorX"},{type:"Float32",name:"tileAnchorY"},{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",components:2,name:"textOffset"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Float32",name:"zOffset"},{type:"Uint8",name:"hasIconTextFit"},{type:"Uint16",name:"elevationFeatureIndex"}]),ha([{type:"Float32",name:"offsetX"}]),ha([{type:"Int16",name:"x"},{type:"Int16",name:"y"}]);var my=24;function yy(e,t,r){return e.sections.forEach((e=>{e.text=function(e,t,r){const n=t.layout.get("text-transform").evaluate(r,{});return "uppercase"===n?e=e.toLocaleUpperCase():"lowercase"===n&&(e=e.toLocaleLowerCase()),Mo.applyArabicShaping&&(e=Mo.applyArabicShaping(e)),e}(e.text,t,r);})),e}const gy={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂","←":"↑","→":"↓"};function xy(e){return "︶"===e||"﹈"===e||"︸"===e||"﹄"===e||"﹂"===e||"︾"===e||"︼"===e||"︺"===e||"︘"===e||"﹀"===e||"︐"===e||"︓"===e||"︔"===e||"`"===e||" ̄"===e||"︑"===e||"︒"===e}function vy(e){return "︵"===e||"﹇"===e||"︷"===e||"﹃"===e||"﹁"===e||"︽"===e||"︻"===e||"︹"===e||"︗"===e||"︿"===e}const by=4294967296,wy=1/by,_y="undefined"==typeof TextDecoder?null:new TextDecoder("utf-8");let Ay=class{constructor(e=new Uint8Array(16)){this.buf=ArrayBuffer.isView(e)?e:new Uint8Array(e),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this.length=this.buf.length;}readFields(e,t,r=this.length){for(;this.pos>3,i=this.pos;this.type=7&r,e(n,t,this),this.pos===i&&this.skip(r);}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)*by;return this.pos+=8,e}readSFixed64(){const e=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*by;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;let r,n;return n=t[this.pos++],r=127&n,n<128?r:(n=t[this.pos++],r|=(127&n)<<7,n<128?r:(n=t[this.pos++],r|=(127&n)<<14,n<128?r:(n=t[this.pos++],r|=(127&n)<<21,n<128?r:(n=t[this.pos],r|=(15&n)<<28,function(e,t,r){const n=r.buf;let i,s;if(s=n[r.pos++],i=(112&s)>>4,s<128)return My(e,i,t);if(s=n[r.pos++],i|=(127&s)<<3,s<128)return My(e,i,t);if(s=n[r.pos++],i|=(127&s)<<10,s<128)return My(e,i,t);if(s=n[r.pos++],i|=(127&s)<<17,s<128)return My(e,i,t);if(s=n[r.pos++],i|=(127&s)<<24,s<128)return My(e,i,t);if(s=n[r.pos++],i|=(1&s)<<31,s<128)return My(e,i,t);throw new Error("Expected varint not more than 10 bytes")}(r,e,this)))))}readVarint64(){return this.readVarint(!0)}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&&_y?_y.decode(this.buf.subarray(t,e)):function(e,t,r){let n="",i=t;for(;i239?4:t>223?3:t>191?2:1;if(i+u>r)break;1===u?t<128&&(l=t):2===u?(s=e[i+1],128==(192&s)&&(l=(31&t)<<6|63&s,l<=127&&(l=null))):3===u?(s=e[i+1],o=e[i+2],128==(192&s)&&128==(192&o)&&(l=(15&t)<<12|(63&s)<<6|63&o,(l<=2047||l>=55296&&l<=57343)&&(l=null))):4===u&&(s=e[i+1],o=e[i+2],a=e[i+3],128==(192&s)&&128==(192&o)&&128==(192&a)&&(l=(15&t)<<18|(63&s)<<12|(63&o)<<6|63&a,(l<=65535||l>=1114112)&&(l=null))),null===l?(l=65533,u=1):l>65535&&(l-=65536,n+=String.fromCharCode(l>>>10&1023|55296),l=56320|1023&l),n+=String.fromCharCode(l),i+=u;}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 r=this.readPackedEnd();for(;this.pos127;);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;}}writeTag(e,t){this.writeVarint(e<<3|t);}realloc(e){let t=this.length||16;for(;t268435455||e<0?function(e,t){let r,n;if(e>=0?(r=e%4294967296|0,n=e/4294967296|0):(r=~(-e%4294967296),n=~(-e/4294967296),4294967295^r?r=r+1|0:(r=0,n=n+1|0)),e>=0x10000000000000000||e<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");t.realloc(10),function(e,t,r){r.buf[r.pos++]=127&e|128,e>>>=7,r.buf[r.pos++]=127&e|128,e>>>=7,r.buf[r.pos++]=127&e|128,e>>>=7,r.buf[r.pos++]=127&e|128,r.buf[r.pos]=127&(e>>>=7);}(r,0,t),function(e,t){const r=(7&e)<<4;t.buf[t.pos++]|=r|((e>>>=3)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(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,r){for(let n,i,s=0;s55295&&n<57344){if(!i){n>56319||s+1===t.length?(e[r++]=239,e[r++]=191,e[r++]=189):i=n;continue}if(n<56320){e[r++]=239,e[r++]=191,e[r++]=189,i=n;continue}n=i-55296<<10|n-56320|65536,i=null;}else i&&(e[r++]=239,e[r++]=191,e[r++]=189,i=null);n<128?e[r++]=n:(n<2048?e[r++]=n>>6|192:(n<65536?e[r++]=n>>12|224:(e[r++]=n>>18|240,e[r++]=n>>12&63|128),e[r++]=n>>6&63|128),e[r++]=63&n|128);}return r}(this.buf,e,this.pos);const r=this.pos-t;r>=128&&Iy(t,r,this),this.pos=t-1,this.writeVarint(r),this.pos+=r;}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);for(let r=0;r=128&&Iy(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n;}writeMessage(e,t,r){this.writeTag(e,2),this.writeRawMessage(t,r);}writePackedVarint(e,t){t.length&&this.writeMessage(e,Sy,t);}writePackedSVarint(e,t){t.length&&this.writeMessage(e,Py,t);}writePackedBoolean(e,t){t.length&&this.writeMessage(e,Ty,t);}writePackedFloat(e,t){t.length&&this.writeMessage(e,ky,t);}writePackedDouble(e,t){t.length&&this.writeMessage(e,zy,t);}writePackedFixed32(e,t){t.length&&this.writeMessage(e,By,t);}writePackedSFixed32(e,t){t.length&&this.writeMessage(e,Ey,t);}writePackedFixed64(e,t){t.length&&this.writeMessage(e,Vy,t);}writePackedSFixed64(e,t){t.length&&this.writeMessage(e,Fy,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 My(e,t,r){return r?4294967296*t+(e>>>0):4294967296*(t>>>0)+(e>>>0)}function Iy(e,t,r){const n=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(7*Math.LN2));r.realloc(n);for(let t=r.pos-1;t>=e;t--)r.buf[t+n]=r.buf[t];}function Sy(e,t){for(let r=0;r=0&&r>=e&&Gy[this.text.charCodeAt(r)];r--)t--;this.text=this.text.substring(e,t),this.sectionIndex=this.sectionIndex.slice(e,t);}substring(e,t){const r=new jy;return r.text=this.text.substring(e,t),r.sectionIndex=this.sectionIndex.slice(e,t),r.sections=this.sections,r}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce(((e,t)=>Math.max(e,this.sections[t].scale)),0)}addTextSection(e,t){this.text+=e.text,this.sections.push(Ny.forText(e.scale,e.fontStack||t));const r=this.sections.length-1;for(let t=0;t=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function $y(e,t,r,n,i,s,o,a,l,u,c,h,p,d,f,m=1){const y=jy.fromFeature(e,i,m);h===Uy.vertical&&y.verticalizePunctuation(p);let g=[];const x=function(e,t,r,n,i,s){if(!e)return [];const o=[],a=function(e,t,r,n,i,s){let o=0;for(let r=0;r=0;let u=0;for(let r=0;r0&&s>w&&(w=s);}else {const e=r[a.fontStack];if(!e)continue;e[m]&&(M=e[m]);const n=t[a.fontStack];if(!n)continue;const s=n.glyphs[m];if(!s)continue;if(v=s.metrics,S=8203!==m?my:0,y){const e=void 0!==n.ascender?Math.abs(n.ascender):0,t=void 0!==n.descender?Math.abs(n.descender):0,r=(e+t)*g;_-r/2;){if(o--,o<0)return !1;a-=e[o].dist(s),s=e[o];}a+=e[o].dist(e[o+1]),o++;const l=[];let u=0;for(;an;)u-=l.shift().angleDelta;if(u>i)return !1;o++,a+=t.dist(r);}return !0}function hg(e){let t=0;for(let r=0;ru){const c=(u-l)/s,h=pr(n.x,i.x,c),p=pr(n.y,i.y,c),d=new ug(h,p,0,i.angleTo(n),r);return !o||cg(e,d,a,o,t)?d:void 0}l+=s;}}function mg(e,t,r,n,i,s,o,a,l){const u=pg(n,s,o),c=dg(n,i),h=c*o,p=0===e[0].x||e[0].x===l||0===e[0].y||e[0].y===l;return t-h=0&&g=0&&x=0&&p+u<=c){const r=new ug(g,x,0,m,t);n&&!cg(e,r,s,n,i)||d.push(r);}}h+=f;}return a||d.length||o||(d=yg(e,h/2,r,n,i,s,o,!0,l)),d}function gg(e){let t=0,r=0;for(const n of e)t+=n.w*n.h,r=Math.max(r,n.w);e.sort(((e,t)=>t.h-e.h));const n=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(t/.95)),r),h:1/0}];let i=0,s=0;for(const t of e)for(let e=n.length-1;e>=0;e--){const r=n[e];if(!(t.w>r.w||t.h>r.h)){if(t.x=r.x,t.y=r.y,s=Math.max(s,t.y+t.h),i=Math.max(i,t.x+t.w),t.w===r.w&&t.h===r.h){const t=n.pop();t&&e1?o-1:o,Ah.copy(n.data,l,{x:0,y:0},{x:a,y:u},n.data,r),Ah.copy(n.data,l,{x:0,y:h-o},{x:a,y:u-o},{width:c,height:o},r),Ah.copy(n.data,l,{x:0,y:0},{x:a,y:u+h},{width:c,height:o},r),Ah.copy(n.data,l,{x:c-o,y:0},{x:a-o,y:u},{width:o,height:h},r),Ah.copy(n.data,l,{x:0,y:0},{x:a+c,y:u},{width:o,height:h},r),Ah.copy(n.data,l,{x:c-o,y:h-o},{x:a-o,y:u-o},{width:o,height:o},r),Ah.copy(n.data,l,{x:0,y:h-o},{x:a+c,y:u-o},{width:o,height:o},r),Ah.copy(n.data,l,{x:0,y:0},{x:a+c,y:u+h},{width:o,height:o},r),Ah.copy(n.data,l,{x:c-o,y:0},{x:a-o,y:u+h},{width:o,height:o},r);}this.lut=r,this.image=l,this.iconPositions=n,this.patternPositions=i;}addImages(e,t,r,n){for(const[i,s]of e.entries()){const{bin:e,imagePosition:o,imageVariant:a}=bg(i,s,r);t.set(i,o),n.push(e),s.hasRenderCallback&&this.haveRenderCallbacks.push(a.id);}}patchUpdatedImages(e,t,r){this.haveRenderCallbacks=this.haveRenderCallbacks.filter((t=>e.hasImage(t,r))),e.dispatchRenderCallbacks(this.haveRenderCallbacks,r);for(const n of e.getUpdatedImages(r)){for(const i of this.iconPositions.keys()){const s=Rr.parse(i);if(ir.isEqual(s.id,n)){const s=e.getImage(n,r);this.patchUpdatedImage(this.iconPositions.get(i),s,t,null);}}for(const i of this.patternPositions.keys()){const s=Rr.parse(i);if(ir.isEqual(s.id,n)){const s=e.getImage(n,r);this.patchUpdatedImage(this.patternPositions.get(i),s,t,this.lut);}}}}patchUpdatedImage(e,t,r,n=null){if(!e||!t)return;if(e.version===t.version)return;e.version=t.version;const[i,s]=e.tl,o=e.sdf;if(this.lut||o){const e={width:t.data.width,height:t.data.height},a=new Ah(e);Ah.copy(t.data,a,{x:0,y:0},{x:0,y:0},e,n,o),r.update(a,{position:{x:i,y:s}});}else r.update(t.data,{position:{x:i,y:s}});}}Qs(vg,"ImagePosition"),Qs(wg,"ImageAtlas");const _g=1e20;function Ag(e,t,r,n,i,s,o,a,l){for(let u=t;u-1);l++,s[l]=a,o[l]=u,o[l+1]=_g;}for(let a=0,l=0;a{let i=this.entries[e];i||(i=this.entries[e]={glyphs:{},requests:{},ranges:{},ascender:void 0,descender:void 0});let s=i.glyphs[t];if(void 0!==s)return void r(null,{stack:e,id:t,glyph:s});if(s=this._tinySDF(i,e,t),s)return i.glyphs[t]=s,void r(null,{stack:e,id:t,glyph:s});const o=Math.floor(t/256);if(256*o>65535)return Xe("glyphs > 65535 not supported"),void r(null,{stack:e,id:t,glyph:s});if(i.ranges[o])return void r(null,{stack:e,id:t,glyph:s});let a=i.requests[o];a||(a=i.requests[o]=[],Pg.loadGlyphRange(e,o,n,this.requestManager,((e,t)=>{if(t){i.ascender=t.ascender,i.descender=t.descender;for(const e in t.glyphs)this._doesCharSupportLocalGlyph(+e)||(i.glyphs[+e]=t.glyphs[+e]);i.ranges[o]=!0;}for(const r of a)r(e,t);delete i.requests[o];}))),a.push(((n,i)=>{n?r(n):i&&r(null,{stack:e,id:t,glyph:i.glyphs[t]||null});}));}),((e,r)=>{if(e)t(e);else if(r){const e={};for(const{stack:t,id:n,glyph:i}of r)void 0===e[t]&&(e[t]={}),void 0===e[t].glyphs&&(e[t].glyphs={}),e[t].glyphs[n]=i&&{id:i.id,bitmap:i.bitmap.clone(),metrics:i.metrics},e[t].ascender=this.entries[t].ascender,e[t].descender=this.entries[t].descender;t(null,e);}}));}_doesCharSupportLocalGlyph(e){return this.localGlyphMode!==Sg.none&&(this.localGlyphMode===Sg.all?!!this.localFontFamily:!!this.localFontFamily&&(io["CJK Unified Ideographs"](e)||io["Hangul Syllables"](e)||io.Hiragana(e)||io.Katakana(e)||io["CJK Symbols and Punctuation"](e)||io["CJK Unified Ideographs Extension A"](e)||io["CJK Unified Ideographs Extension B"](e)||io.Osage(e)))}_tinySDF(e,t,r){const n=this.localFontFamily;if(!n||!this._doesCharSupportLocalGlyph(r))return;let i=e.tinySDF;if(!i){let r="400";/bold/i.test(t)?r="900":/medium/i.test(t)?r="500":/light/i.test(t)&&(r="200"),i=e.tinySDF=new Pg.TinySDF({fontFamily:n,fontWeight:r,fontSize:24*Ig,buffer:3*Ig,radius:8*Ig}),i.fontWeight=r;}if(this.localGlyphs[i.fontWeight][r])return this.localGlyphs[i.fontWeight][r];const s=String.fromCodePoint(r),{data:o,width:a,height:l,glyphWidth:u,glyphHeight:c,glyphLeft:h,glyphTop:p,glyphAdvance:d}=i.draw(s);return this.localGlyphs[i.fontWeight][r]={id:r,bitmap:new _h({width:a,height:l},o),metrics:{width:u/Ig,height:c/Ig,left:h/Ig,top:p/Ig-27,advance:d/Ig,localGlyph:!0}}}}Pg.loadGlyphRange=function(e,t,r,n,i){const s=256*t,o=s+255,a=n.transformRequest(n.normalizeGlyphsURL(r).replace("{fontstack}",e).replace("{range}",`${s}-${o}`),Ct.Glyphs);Ot(a,((e,t)=>{if(e)i(e);else if(t){const e={},r=function(e){return new Ay(e).readFields(Dy,{})}(t);for(const t of r.glyphs)e[t.id]=t;i(null,{glyphs:e,ascender:r.ascender,descender:r.descender});}}));},Pg.TinySDF=class{constructor({fontSize:e=24,buffer:t=3,radius:r=8,cutoff:n=.25,fontFamily:i="sans-serif",fontWeight:s="normal",fontStyle:o="normal",lang:a=null}={}){this.buffer=t,this.cutoff=n,this.radius=r,this.lang=a;const l=this.size=e+4*t,u=this._createCanvas(l),c=this.ctx=u.getContext("2d",{willReadFrequently:!0});c.font=`${o} ${s} ${e}px ${i}`,c.textBaseline="alphabetic",c.textAlign="left",c.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){const t=document.createElement("canvas");return t.width=t.height=e,t}draw(e){const{width:t,actualBoundingBoxAscent:r,actualBoundingBoxDescent:n,actualBoundingBoxLeft:i,actualBoundingBoxRight:s}=this.ctx.measureText(e),o=Math.ceil(r),a=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(s-i))),l=Math.min(this.size-this.buffer,o+Math.ceil(n)),u=a+2*this.buffer,c=l+2*this.buffer,h=Math.max(u*c,0),p=new Uint8ClampedArray(h),d={data:p,width:u,height:c,glyphWidth:a,glyphHeight:l,glyphTop:o,glyphLeft:0,glyphAdvance:t};if(0===a||0===l)return d;const{ctx:f,buffer:m,gridInner:y,gridOuter:g}=this;this.lang&&(f.lang=this.lang),f.clearRect(m,m,a,l),f.fillText(e,m,m+o);const x=f.getImageData(m,m,a,l);g.fill(_g,0,h),y.fill(0,0,h);for(let e=0;e0?e*e:0,y[n]=e<0?e*e:0;}}Ag(g,0,0,u,c,u,this.f,this.v,this.z),Ag(y,m,m,a,l,u,this.f,this.v,this.z);for(let e=0;e{const p=Cg(n.stretch-x,v,c,e.left*i),d=Dg(n.fixed-_,A,n.stretch,f),y=Cg(s.stretch-b,w,h,e.top*i),g=Dg(s.fixed-M,I,s.stretch,m),S=Cg(l.stretch-x,v,c,e.left*i),P=Dg(l.fixed-_,A,l.stretch,f),k=Cg(u.stretch-b,w,h,e.top*i),z=Dg(u.fixed-M,I,u.stretch,m),T=new Me(p,y),B=new Me(S,y),E=new Me(S,k),V=new Me(p,k),F=new Me(d/a,g/a),C=new Me(P/a,z/a),D=t*Math.PI/180;if(D){const e=Math.sin(D),t=Math.cos(D),r=[t,-e,e,t];T._matMult(r),B._matMult(r),V._matMult(r),E._matMult(r);}const R=n.stretch+n.fixed,L=l.stretch+l.fixed,O=s.stretch+s.fixed,U=u.stretch+u.fixed,N=e.imageSecondary;return {tl:T,tr:B,bl:V,br:E,texPrimary:{x:o.paddedRect.x+kg+R,y:o.paddedRect.y+kg+O,w:L-R,h:U-O},texSecondary:N?{x:N.paddedRect.x+kg+R,y:N.paddedRect.y+kg+O,w:L-R,h:U-O}:void 0,writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:F,pixelOffsetBR:C,minFontScaleX:A/a/c,minFontScaleY:I/a/h,isSDF:r}};if(n&&(o.stretchX||o.stretchY)){const e=Vg(p,y,f),t=Vg(d,g,m);for(let r=0;rs)&&(s=t.x),(!e||t.y>o)&&(o=t.y);}const l=Math.min(s-n,o-i);let u=l/2;const c=new On([],Og);if(0===l)return new Me(n,i);for(let t=n;th.d||!h.d)&&(h=n,r&&console.log("found best %d after %d probes",Math.round(1e4*n.d)/1e4,p)),n.max-h.d<=t||(u=n.h/2,c.push(new Ug(n.p.x-u,n.p.y-u,u,e)),c.push(new Ug(n.p.x+u,n.p.y-u,u,e)),c.push(new Ug(n.p.x-u,n.p.y+u,u,e)),c.push(new Ug(n.p.x+u,n.p.y+u,u,e)),p+=4);}return r&&(console.log(`num probes: ${p}`),console.log(`best distance: ${h.d}`)),h.p}function Og(e,t){return t.max-e.max}class Ug{constructor(e,t,r,n){this.p=new Me(e,t),this.h=r,this.d=function(e,t){let r=!1,n=1/0;for(let i=0;ie.y!=a.y>e.y&&e.x<(a.x-i.x)*(e.y-i.y)/(a.y-i.y)+i.x&&(r=!r),n=Math.min(n,dc(e,i,a));}}return (r?1:-1)*Math.sqrt(n)}(this.p,n),this.max=this.d+this.h*Math.SQRT2;}}const Ng=Object.keys,jg=Number.POSITIVE_INFINITY,$g=Math.sqrt(2);function Gg(e,t,r,n){const i=e.collisionPadding||[0,0,0,0],s={top:e.top-i[1],bottom:e.bottom+i[3],left:e.left-i[0],right:e.right+i[2],scaled:!1};return void 0!==n&&function(e,t){e.top*=t,e.bottom*=t,e.left*=t,e.right*=t,e.scaled=!0;}(s,n),r&&function(e,t){if(!t)return;const r=ke(t),n=new Me(e.left,e.top),i=new Me(e.right,e.top),s=new Me(e.left,e.bottom),o=new Me(e.right,e.bottom);n._rotateAround(r,new Me(0,0)),i._rotateAround(r,new Me(0,0)),s._rotateAround(r,new Me(0,0)),o._rotateAround(r,new Me(0,0)),e.left=Math.min(n.x,i.x,s.x,o.x),e.right=Math.max(n.x,i.x,s.x,o.x),e.top=Math.min(n.y,i.y,s.y,o.y),e.bottom=Math.max(n.y,i.y,s.y,o.y);}(s,r),t?{top:Math.min(t.top,s.top),bottom:Math.max(t.bottom,s.bottom),left:Math.min(t.left,s.left),right:Math.max(t.right,s.right),scaled:t.scaled||s.scaled}:s}function qg(e,[t,r]){let n=0,i=0;if(r===jg){t<0&&(t=0);const r=t/$g;switch(e){case "top-right":case "top-left":i=r-7;break;case "bottom-right":case "bottom-left":i=7-r;break;case "bottom":i=7-t;break;case "top":i=t-7;}switch(e){case "top-right":case "bottom-right":n=-r;break;case "top-left":case "bottom-left":n=r;break;case "left":n=t;break;case "right":n=-t;}}else {switch(t=Math.abs(t),r=Math.abs(r),e){case "top-right":case "top-left":case "top":i=r-7;break;case "bottom-right":case "bottom-left":case "bottom":i=7-r;}switch(e){case "top-right":case "bottom-right":case "right":n=-t;break;case "top-left":case "bottom-left":case "left":n=t;}}return [n,i]}function Hg(e,t,r,n,i,s,o,a,l,u,c){const h=e.layers[0],p=h.appearances;if(0===p.length)return {iconBBox:null,iconVerticalBBox:null};let d=null,f=null;const m=n.get("icon-rotate").evaluate(i,{},s);t&&(d=Gg(t,d,m,o),r)&&(f=Gg(r,f,m+90,o));const[y,g]=n.get("icon-size-scale-range"),x=Fe(1,y,g);for(const r of p){const n=r.getUnevaluatedProperties(),p=void 0!==n._values["icon-image"].value,y=void 0!==n._values["icon-size"].value,g=void 0!==n._values["icon-offset"].value,v=void 0!==n._values["icon-rotate"].value;if(p||y||g||v){const b=g?h.getAppearanceValueAndResolveTokens(r,"icon-offset",i,s,[]):null,w=b&&Array.isArray(b)?b:a,_=v?h.getAppearanceValueAndResolveTokens(r,"icon-rotate",i,s,[]):null,A="number"==typeof _?_:m,M=y?h.getAppearanceValueAndResolveTokens(r,"icon-size",i,s,[]):null,I="number"==typeof M?M*l.iconScaleFactor:o;let S=null,P=null,k=null;if(p){const t=h.getAppearanceValueAndResolveTokens(r,"icon-image",i,s,[]);if(t){const r=e.getResolvedImageFromTokens(t),o=n._values["icon-size"],a=Wg(r,og(e.zoom,o,e.worldview),o,s,e.zoom,i,e.pixelRatio,x,e.worldview);k=u.get(a.iconPrimary.toString());}}else t&&(k=t.imagePrimary);k&&(S=eg(k,null,w,c),e.allowVerticalPlacement&&(P=eg(k,null,w,c))),S&&(d=Gg(S,d,A,I)),P&&(f=Gg(P,f,A+90,I));}}return {iconBBox:d,iconVerticalBBox:f}}function Xg(e,t,r,n,i,s,o,a,l){if(!t||!t.usvg)return;const u=ig(n),c=ig(i),h="both"!==s&&"width"!==s||!rg(n)?1:c.width/u.width,p="both"!==s&&"height"!==s||!ng(n)?1:c.height/u.height;r.scaleSelf(h,p);const d=r.toString();o.set(d,r),a.set(d,t);const{imagePosition:f}=bg(d,t,xg);l.set(d,f);}function Zg(e,t,r,n,i,s,o,a,l){if(!e)return;const u=function(e,t,r,n,i,s){if("camera"===e.kind)return e.maxSize;if("composite"===e.kind){const n=t.possiblyEvaluate(new Io(e.maxZoom,{worldview:s}),r).evaluate(i,{},r),o=t.possiblyEvaluate(new Io(e.minZoom,{worldview:s}),r).evaluate(i,{},r);return Math.max(n,o)}return t.possiblyEvaluate(new Io(n,{worldview:s})).evaluate(i,{},r)}(t,r,n,i,s,l);return e.scaleSelf(u*a*o)}function Wg(e,t,r,n,i,s,o,a,l){return {iconPrimary:Zg(e.getPrimary(),t,r,n,i,s,o,a,l),iconSecondary:Zg(e.getSecondary(),t,r,n,i,s,o,a,l)}}function Yg(e,t,r){if(!t)return;const n=r.get(e.toString()),i=r.get(t.toString());n&&i&&(n.paddedRect.w===i.paddedRect.w&&n.paddedRect.h===i.paddedRect.h||Xe(`Mismatch in icon variant sizes: ${e.toString()} and ${t.toString()}`),n.usvg!==i.usvg&&Xe(`Mismatch in icon variant image types: ${e.id} and ${t.id}`));}function Kg(e,t,r,n){if(!e)return;const i=t.get(r.toString());if(e.imagePrimary=i,n){const r=t.get(n.toString());e.imageSecondary=r;}}function Jg(e,t){for(const r in e.horizontal)Qg(e.horizontal[r],t);Qg(e.vertical,t);}function Qg(e,t){if(e)for(const r of e.positionedLines)for(const e of r.positionedGlyphs)if(null!==e.image){const r=e.image.toString();e.rect=t.get(r).paddedRect;}}function ex(e){switch(e){case "right":case "top-right":case "bottom-right":return "right";case "left":case "top-left":case "bottom-left":return "left"}return "center"}function tx(e,t,r,n,i,s,o,a,l){const u=ox(s.horizontal)||s.vertical,c=r.get("icon-text-fit-padding").evaluate(n,{},i);let h,p=t;return t&&"none"!==l&&(e.allowVerticalPlacement&&s.vertical&&(h=tg(t,s.vertical,l,c,a,o)),u&&(p=tg(t,u,l,c,a,o))),{defaultShapedIcon:p,verticallyShapedIcon:h}}function rx(e,t,r,n,i,s,o,a,l,u,c,h,p,d,f,m,y,g,x,v,b,w){let _=o.textMaxSize.evaluate(t,{},p);void 0===_?_=a*o.textScaleFactor:_*=o.textScaleFactor;const A=e.layers[0].layout,M=my,I=a*o.textScaleFactor/M,S=ox(r.horizontal)||r.vertical;if("none"!==y&&e.appearanceFeatureData&&t.index18&&C>2&&(C>>=1),Math.max(Un/(512*C),1)*A.get("symbol-spacing")),T=A.get("text-padding")*e.tilePixelRatio,B=A.get("icon-padding")*e.tilePixelRatio,E=ke(A.get("text-max-angle")),V="map"===A.get("icon-rotation-alignment")&&"point"!==v,F=z/2;var C;!1===e.hasAnyIconTextFit&&"none"!==y&&(e.hasAnyIconTextFit=!0);const D=t.properties?+t.properties[Ru]:null,R=D&&e.elevationFeatureIdToIndex?e.elevationFeatureIdToIndex.get(D):65535,L=(a,l,v)=>{if(l.x<0||l.x>=Un||l.y<0||l.y>=Un)return;let _=null;if(P){const{x:e,y:t,z:r}=d.projectTilePoint(l.x,l.y,v);_={anchor:new ug(e,t,r,0,void 0),up:d.upVector(v,l.x,l.y)};}!function(e,t,r,n,i,s,o,a,l,u,c,h,p,d,f,m,y,g,x,v,b,w,_,A,M,I,S,P,k,z,T){const B=e.addToLineVertexArray(t,n);let E,V,F,C,D,R,L,O=0,U=0,N=0,j=0,$=-1,G=-1;const q={};let H=Jt("");const X=r?r.anchor:t,Z="none"!==P;let W=0,Y=0;if(void 0===l._unevaluatedLayout.getValue("text-radial-offset")){const e=l.layout.get("text-offset").evaluate(b,{},M);W=e[0]*my,Y=e[1]*my;}else W=l.layout.get("text-radial-offset").evaluate(b,{},M)*my,Y=jg;if(e.allowVerticalPlacement&&i.vertical){const e=i.vertical;if(f)R=lx(e),a&&(L=lx(a));else {const r=l.layout.get("text-rotate").evaluate(b,{},M)+90;F=ax(u,X,t,c,h,p,e,d,r,m),a&&(C=ax(u,X,t,c,h,p,a,g,r,null,T));}}if(s){const n=e.iconSizeData,i=l.layout.get("icon-rotate").evaluate(b,{},M),o=Tg(s,i,_,Z,w.iconScaleFactor),d=a?Tg(a,i,_,Z,w.iconScaleFactor):void 0;V=ax(u,X,t,c,h,p,s,g,i,null,z);const f=function(e,t,r,n,i,s,o,a){const l=e.layers[0],u=l.appearances;let c=t.length;if(r&&(c=Math.max(c,r.length)),0===u.length)return c;const[h,p]=n.get("icon-size-scale-range"),d=Fe(1,h,p);for(const t of u){const r=t.getUnevaluatedProperties();if(void 0!==r._values["icon-image"].value){const n=l.getAppearanceValueAndResolveTokens(t,"icon-image",i,s,[]);if(n){const t=e.getResolvedImageFromTokens(n);if(t){const n=r._values["icon-size"],l=Wg(t,og(e.zoom,n,e.worldview),n,s,e.zoom,i,e.pixelRatio,d,e.worldview),u=o.get(l.iconPrimary.toString());c=Math.max(c,Bg(u,a));}}}}return c}(e,o,d,l.layout,b,M,e.iconAtlasPositions,Z);O=4*f;let m=null;"source"===n.kind?(m=[sg*l.layout.get("icon-size").evaluate(b,{},M)*w.iconScaleFactor],m[0]>ix&&Xe(`${e.layerIds[0]}: Value for "icon-size" is >= ${nx}. Reduce your "icon-size".`)):"composite"===n.kind&&(m=[sg*w.compositeIconSizes[0].evaluate(b,{},M)*w.iconScaleFactor,sg*w.compositeIconSizes[1].evaluate(b,{},M)*w.iconScaleFactor],(m[0]>ix||m[1]>ix)&&Xe(`${e.layerIds[0]}: Value for "icon-size" is >= ${nx}. Reduce your "icon-size".`)),e.addSymbols(e.icon,o,m,v,x,b,void 0,r,t,B.lineStartIndex,B.lineLength,-1,A,M,I,S,e.symbolInstances.length,f),$=e.icon.placedSymbolArray.length-1,d&&(U=4*f,e.addSymbols(e.icon,d,m,v,x,b,Uy.vertical,r,t,B.lineStartIndex,B.lineLength,-1,A,M,I,S,e.symbolInstances.length,f),G=e.icon.placedSymbolArray.length-1);}for(const n in i.horizontal){const s=n,a=i.horizontal[s];E||(H=Jt(a.text),f?D=lx(a):E=ax(u,X,t,c,h,p,a,d,l.layout.get("text-rotate").evaluate(b,{},M),m));const y=1===a.positionedLines.length;if(N+=sx(e,r,t,a,o,l,f,b,m,B,i.vertical?Uy.horizontal:Uy.horizontalOnly,y?Ng(i.horizontal):[s],q,$,w,A,M,e.symbolInstances.length,I),y)break}i.vertical&&(j+=sx(e,r,t,i.vertical,o,l,f,b,m,B,Uy.vertical,["vertical"],q,G,w,A,M,e.symbolInstances.length,I));let K=-1;const J=(e,t)=>e?Math.max(e,t):t;K=J(D,K),K=J(R,K),K=J(L,K);const Q=K>-1?1:0;e.glyphOffsetArray.length>=65535&&Xe("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==b.sortKey&&e.addToSortKeyRanges(e.symbolInstances.length,b.sortKey),e.symbolInstances.emplaceBack(t.x,t.y,X.x,X.y,X.z,q.right>=0?q.right:-1,q.center>=0?q.center:-1,q.left>=0?q.left:-1,q.vertical>=0?q.vertical:-1,$,G,H,void 0!==E?E:e.collisionBoxArray.length,void 0!==E?E+1:e.collisionBoxArray.length,void 0!==F?F:e.collisionBoxArray.length,void 0!==F?F+1:e.collisionBoxArray.length,void 0!==V?V:e.collisionBoxArray.length,void 0!==V?V+1:e.collisionBoxArray.length,C||e.collisionBoxArray.length,C?C+1:e.collisionBoxArray.length,c,N,j,O,U,Q,0,W,Y,K,0,Z?1:0,k);}(e,l,_,a,r,n,s,i,e.layers[0],e.collisionBoxArray,t.index,t.sourceLayerIndex,e.index,T,x,u,0,B,V,g,t,o,c,h,p,f,m,y,R,b,w);};if("line"===v)for(const i of Fd(t.geometry,0,0,Un,Un)){const t=mg(i,z,E,r.vertical||S,n,M,k,e.overscaling,Un);for(const r of t)S&&ux(e,S.text,F,r)||L(i,r,p);}else if("line-center"===v){for(const e of t.geometry)if(e.length>1){const t=fg(e,E,r.vertical||S,n,M,k);t&&L(e,t,p);}}else if("Polygon"===t.type)for(const e of rp(t.geometry,0)){const t=Lg(e,16);L(e[0],new ug(t.x,t.y,0,0,void 0),p);}else if("LineString"===t.type)for(const e of t.geometry)L(e,new ug(e[0].x,e[0].y,0,0,void 0),p);else if("Point"===t.type)for(const e of t.geometry)for(const t of e)L([t],new ug(t.x,t.y,0,0,void 0),p);}const nx=255,ix=nx*sg;function sx(e,t,r,n,i,s,o,a,l,u,c,h,p,d,f,m,y,g,x){const v=function(e,t,r,n,i,s,o,a){const l=[];if(0===t.positionedLines.length)return l;const u=n.layout.get("text-rotate").evaluate(s,{})*Math.PI/180,c=function(e){const t=e[0],r=e[1],n=t*r;return n>0?[t,-r]:n<0?[-t,r]:0===t?[r,t]:[r,-t]}(r);let h=Math.abs(t.top-t.bottom);for(const e of t.positionedLines)h-=e.lineOffset;const p=t.positionedLines.length,d=h/p;let f=t.top-r[1];for(let e=0;e